From: support Date: Mon, 19 Dec 2022 15:45:57 +0000 (+0000) Subject: Built motion from commit 7b0d5213.|2.6.25 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png//%22%27?a=commitdiff_plain;h=b26cd0ac74974c363332dd36ff304b3b40130444;p=motion2.git Built motion from commit 7b0d5213.|2.6.25 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 5f9c025..4bc2573 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-12-15T16:00:28.653Z", + "time": "2022-12-19T15:37:31.967Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 34ccdd0..e4e6c1e 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-15T16:00:28.653Z", + "time": "2022-12-19T15:37:31.967Z", "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 1662bfb..d9cc35b 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 _0x958f=['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','contactManager','integration','jscripty','browser','bot','script','STRING','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)]','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)]'];(function(_0x1bdfe7,_0x5c062c){var _0x6dc98e=function(_0x50d021){while(--_0x50d021){_0x1bdfe7['push'](_0x1bdfe7['shift']());}};_0x6dc98e(++_0x5c062c);}(_0x958f,0x16e));var _0xf958=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x958f[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require('sequelize');module[_0xf958('0x0')]={'name':{'type':Sequelize[_0xf958('0x1')],'get':function(_0x3986ae){return this[_0xf958('0x2')](_0xf958('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xf958('0x4'),_0xf958('0x5'),'motionbar',_0xf958('0x6'),'urlForward',_0xf958('0x7'),_0xf958('0x8'),_0xf958('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xf958('0xa')](0x1000),'comment':_0xf958('0xb')},'data2':{'type':Sequelize[_0xf958('0xa')](0x1000),'comment':_0xf958('0xc')},'data3':{'type':Sequelize[_0xf958('0xa')](0x1000),'comment':_0xf958('0xd')},'data4':{'type':Sequelize[_0xf958('0xa')](0x1000),'comments':_0xf958('0xe')},'data5':{'type':Sequelize[_0xf958('0xa')](0x1000),'comments':_0xf958('0xf')},'data6':{'type':Sequelize[_0xf958('0xa')],'comments':_0xf958('0x10')},'data7':{'type':Sequelize[_0xf958('0x11')],'comments':_0xf958('0x12')}}; \ No newline at end of file +var _0x4e96=['TEXT','urlForward[body]','exports','VIRTUAL','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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)]','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]'];(function(_0x41fad4,_0x38710b){var _0x2a57e0=function(_0x1d0763){while(--_0x1d0763){_0x41fad4['push'](_0x41fad4['shift']());}};_0x2a57e0(++_0x38710b);}(_0x4e96,0xca));var _0x64e9=function(_0x14b39a,_0x1ca14c){_0x14b39a=_0x14b39a-0x0;var _0x5a9727=_0x4e96[_0x14b39a];return _0x5a9727;};'use strict';var Sequelize=require('sequelize');module[_0x64e9('0x0')]={'name':{'type':Sequelize[_0x64e9('0x1')],'get':function(_0x506694){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x64e9('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x64e9('0x3'),_0x64e9('0x4'),_0x64e9('0x5'),_0x64e9('0x6'),_0x64e9('0x7'),_0x64e9('0x8'),_0x64e9('0x9'),_0x64e9('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x64e9('0xb')},'data1':{'type':Sequelize[_0x64e9('0x2')](0x1000),'comment':_0x64e9('0xc')},'data2':{'type':Sequelize[_0x64e9('0x2')](0x1000),'comment':_0x64e9('0xd')},'data3':{'type':Sequelize[_0x64e9('0x2')](0x1000),'comment':_0x64e9('0xe')},'data4':{'type':Sequelize[_0x64e9('0x2')](0x1000),'comments':_0x64e9('0xf')},'data5':{'type':Sequelize[_0x64e9('0x2')](0x1000),'comments':_0x64e9('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x64e9('0x11')},'data7':{'type':Sequelize[_0x64e9('0x12')],'comments':_0x64e9('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c3216ba..8488b8c 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 _0x807d=['update','destroy','then','end','sendStatus','error','name','send','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save'];(function(_0x23b07a,_0x43cbec){var _0x5d5099=function(_0x43dfec){while(--_0x43dfec){_0x23b07a['push'](_0x23b07a['shift']());}};_0x5d5099(++_0x43cbec);}(_0x807d,0x133));var _0xd807=function(_0x5b0bea,_0x4ad02f){_0x5b0bea=_0x5b0bea-0x0;var _0x42e123=_0x807d[_0x5b0bea];return _0x42e123;};'use strict';var emlformat=require(_0xd807('0x0'));var rimraf=require(_0xd807('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd807('0x2'));var rp=require(_0xd807('0x3'));var moment=require(_0xd807('0x4'));var BPromise=require(_0xd807('0x5'));var Mustache=require(_0xd807('0x6'));var util=require(_0xd807('0x7'));var path=require(_0xd807('0x8'));var sox=require(_0xd807('0x9'));var csv=require(_0xd807('0xa'));var ejs=require(_0xd807('0xb'));var fs=require('fs');var fs_extra=require(_0xd807('0xc'));var _=require('lodash');var squel=require(_0xd807('0xd'));var crypto=require(_0xd807('0xe'));var jsforce=require(_0xd807('0xf'));var deskjs=require(_0xd807('0x10'));var toCsv=require(_0xd807('0xa'));var querystring=require(_0xd807('0x11'));var Papa=require(_0xd807('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd807('0x13'));var as=require(_0xd807('0x14'));var hardwareService=require(_0xd807('0x15'));var logger=require(_0xd807('0x16'))(_0xd807('0x17'));var utils=require('../../config/utils');var config=require(_0xd807('0x18'));var licenseUtil=require(_0xd807('0x19'));var db=require(_0xd807('0x1a'))['db'];function respondWithStatusCode(_0x217a1a,_0x24e5a0){_0x24e5a0=_0x24e5a0||0xcc;return function(_0x46e684){if(_0x46e684){return _0x217a1a['sendStatus'](_0x24e5a0);}return _0x217a1a['status'](_0x24e5a0)['end']();};}function respondWithResult(_0x1e94a4,_0x35007a){_0x35007a=_0x35007a||0xc8;return function(_0x171a72){if(_0x171a72){return _0x1e94a4[_0xd807('0x1b')](_0x35007a)[_0xd807('0x1c')](_0x171a72);}};}function respondWithFilteredResult(_0x4458e2,_0x3c2048){return function(_0x5656bd){if(_0x5656bd){var _0x385e5d=typeof _0x3c2048[_0xd807('0x1d')]===_0xd807('0x1e')&&typeof _0x3c2048[_0xd807('0x1f')]===_0xd807('0x1e');var _0x53d46c=_0x5656bd[_0xd807('0x20')];var _0x4522c8=_0x385e5d?0x0:_0x3c2048['offset'];var _0x50725d=_0x385e5d?_0x5656bd[_0xd807('0x20')]:_0x3c2048['offset']+_0x3c2048['limit'];var _0x9c54ef;if(_0x50725d>=_0x53d46c){_0x50725d=_0x53d46c;_0x9c54ef=0xc8;}else{_0x9c54ef=0xce;}_0x4458e2['status'](_0x9c54ef);return _0x4458e2['set'](_0xd807('0x21'),_0x4522c8+'-'+_0x50725d+'/'+_0x53d46c)[_0xd807('0x1c')](_0x5656bd);}return null;};}function patchUpdates(_0x42f860){return function(_0x5702da){try{jsonpatch['apply'](_0x5702da,_0x42f860,!![]);}catch(_0x5065ad){return BPromise[_0xd807('0x22')](_0x5065ad);}return _0x5702da[_0xd807('0x23')]();};}function saveUpdates(_0x33f0b0,_0x421123){return function(_0xf872d2){if(_0xf872d2){return _0xf872d2[_0xd807('0x24')](_0x33f0b0)['then'](function(_0x5483c7){return _0x5483c7;});}return null;};}function removeEntity(_0x539c9b,_0x1dabce){return function(_0x47c84a){if(_0x47c84a){return _0x47c84a[_0xd807('0x25')]()[_0xd807('0x26')](function(){_0x539c9b[_0xd807('0x1b')](0xcc)[_0xd807('0x27')]();});}};}function handleEntityNotFound(_0x402b8f,_0xf5a5d8){return function(_0x44b967){if(!_0x44b967){_0x402b8f[_0xd807('0x28')](0x194);}return _0x44b967;};}function handleError(_0xe287b,_0xea861b){_0xea861b=_0xea861b||0x1f4;return function(_0x3dfd26){logger[_0xd807('0x29')](_0x3dfd26['stack']);if(_0x3dfd26[_0xd807('0x2a')]){delete _0x3dfd26[_0xd807('0x2a')];}_0xe287b[_0xd807('0x1b')](_0xea861b)[_0xd807('0x2b')](_0x3dfd26);};}exports[_0xd807('0x24')]=function(_0x5c0710,_0x48e713){if(_0x5c0710[_0xd807('0x2c')]['id']){delete _0x5c0710[_0xd807('0x2c')]['id'];}return db[_0xd807('0x2d')][_0xd807('0x2e')]({'where':{'id':_0x5c0710[_0xd807('0x2f')]['id']}})[_0xd807('0x26')](handleEntityNotFound(_0x48e713,null))[_0xd807('0x26')](saveUpdates(_0x5c0710[_0xd807('0x2c')],null))[_0xd807('0x26')](respondWithResult(_0x48e713,null))[_0xd807('0x30')](handleError(_0x48e713,null));};exports['destroy']=function(_0x49518a,_0xd26356){return db[_0xd807('0x2d')][_0xd807('0x2e')]({'where':{'id':_0x49518a['params']['id']}})[_0xd807('0x26')](handleEntityNotFound(_0xd26356,null))['then'](removeEntity(_0xd26356,null))[_0xd807('0x30')](handleError(_0xd26356,null));}; \ No newline at end of file +var _0xb039=['destroy','end','error','stack','name','send','body','Action','find','then','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../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','offset','undefined','limit','count','set','Content-Range','reject','save','update'];(function(_0x395ba5,_0x27e35a){var _0x19e204=function(_0x5e76a8){while(--_0x5e76a8){_0x395ba5['push'](_0x395ba5['shift']());}};_0x19e204(++_0x27e35a);}(_0xb039,0x1c3));var _0x9b03=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0xb039[_0x349a9e];return _0x24c207;};'use strict';var emlformat=require(_0x9b03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b03('0x1'));var jsonpatch=require(_0x9b03('0x2'));var rp=require('request-promise');var moment=require(_0x9b03('0x3'));var BPromise=require(_0x9b03('0x4'));var Mustache=require(_0x9b03('0x5'));var util=require(_0x9b03('0x6'));var path=require(_0x9b03('0x7'));var sox=require(_0x9b03('0x8'));var csv=require('to-csv');var ejs=require(_0x9b03('0x9'));var fs=require('fs');var fs_extra=require(_0x9b03('0xa'));var _=require(_0x9b03('0xb'));var squel=require(_0x9b03('0xc'));var crypto=require(_0x9b03('0xd'));var jsforce=require(_0x9b03('0xe'));var deskjs=require(_0x9b03('0xf'));var toCsv=require(_0x9b03('0x10'));var querystring=require('querystring');var Papa=require(_0x9b03('0x11'));var Redis=require('ioredis');var authService=require(_0x9b03('0x12'));var qs=require(_0x9b03('0x13'));var as=require(_0x9b03('0x14'));var hardwareService=require(_0x9b03('0x15'));var logger=require(_0x9b03('0x16'))(_0x9b03('0x17'));var utils=require(_0x9b03('0x18'));var config=require(_0x9b03('0x19'));var licenseUtil=require(_0x9b03('0x1a'));var db=require(_0x9b03('0x1b'))['db'];function respondWithStatusCode(_0x33aa56,_0x527923){_0x527923=_0x527923||0xcc;return function(_0x87330){if(_0x87330){return _0x33aa56[_0x9b03('0x1c')](_0x527923);}return _0x33aa56[_0x9b03('0x1d')](_0x527923)['end']();};}function respondWithResult(_0x4fd74d,_0x395344){_0x395344=_0x395344||0xc8;return function(_0x5cb84c){if(_0x5cb84c){return _0x4fd74d[_0x9b03('0x1d')](_0x395344)['json'](_0x5cb84c);}};}function respondWithFilteredResult(_0x9065f3,_0x18dff0){return function(_0x487bd6){if(_0x487bd6){var _0xf03395=typeof _0x18dff0[_0x9b03('0x1e')]===_0x9b03('0x1f')&&typeof _0x18dff0[_0x9b03('0x20')]===_0x9b03('0x1f');var _0x3966db=_0x487bd6[_0x9b03('0x21')];var _0xa881c6=_0xf03395?0x0:_0x18dff0[_0x9b03('0x1e')];var _0x32cbe2=_0xf03395?_0x487bd6[_0x9b03('0x21')]:_0x18dff0[_0x9b03('0x1e')]+_0x18dff0['limit'];var _0x230de5;if(_0x32cbe2>=_0x3966db){_0x32cbe2=_0x3966db;_0x230de5=0xc8;}else{_0x230de5=0xce;}_0x9065f3['status'](_0x230de5);return _0x9065f3[_0x9b03('0x22')](_0x9b03('0x23'),_0xa881c6+'-'+_0x32cbe2+'/'+_0x3966db)['json'](_0x487bd6);}return null;};}function patchUpdates(_0x40b04c){return function(_0x59f72b){try{jsonpatch['apply'](_0x59f72b,_0x40b04c,!![]);}catch(_0x5aed44){return BPromise[_0x9b03('0x24')](_0x5aed44);}return _0x59f72b[_0x9b03('0x25')]();};}function saveUpdates(_0x31b4d3,_0x3a2b89){return function(_0xcac366){if(_0xcac366){return _0xcac366[_0x9b03('0x26')](_0x31b4d3)['then'](function(_0x471138){return _0x471138;});}return null;};}function removeEntity(_0x17a521,_0x3e9553){return function(_0x1e98ce){if(_0x1e98ce){return _0x1e98ce[_0x9b03('0x27')]()['then'](function(){_0x17a521[_0x9b03('0x1d')](0xcc)[_0x9b03('0x28')]();});}};}function handleEntityNotFound(_0x5707d7,_0x3936ee){return function(_0x310840){if(!_0x310840){_0x5707d7['sendStatus'](0x194);}return _0x310840;};}function handleError(_0x295339,_0x19c232){_0x19c232=_0x19c232||0x1f4;return function(_0x119d3f){logger[_0x9b03('0x29')](_0x119d3f[_0x9b03('0x2a')]);if(_0x119d3f[_0x9b03('0x2b')]){delete _0x119d3f[_0x9b03('0x2b')];}_0x295339['status'](_0x19c232)[_0x9b03('0x2c')](_0x119d3f);};}exports[_0x9b03('0x26')]=function(_0x428683,_0x2de291){if(_0x428683[_0x9b03('0x2d')]['id']){delete _0x428683[_0x9b03('0x2d')]['id'];}return db[_0x9b03('0x2e')][_0x9b03('0x2f')]({'where':{'id':_0x428683['params']['id']}})[_0x9b03('0x30')](handleEntityNotFound(_0x2de291,null))[_0x9b03('0x30')](saveUpdates(_0x428683[_0x9b03('0x2d')],null))[_0x9b03('0x30')](respondWithResult(_0x2de291,null))['catch'](handleError(_0x2de291,null));};exports[_0x9b03('0x27')]=function(_0x1883c4,_0x460f61){return db[_0x9b03('0x2e')][_0x9b03('0x2f')]({'where':{'id':_0x1883c4['params']['id']}})[_0x9b03('0x30')](handleEntityNotFound(_0x460f61,null))[_0x9b03('0x30')](removeEntity(_0x460f61,null))['catch'](handleError(_0x460f61,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 462c09a..9c29aeb 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 _0x6e83=['Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./action.attributes','exports'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x6e83,0x16d));var _0x36e8=function(_0x39714b,_0x5e0b0e){_0x39714b=_0x39714b-0x0;var _0x45ed60=_0x6e83[_0x39714b];return _0x45ed60;};'use strict';var _=require(_0x36e8('0x0'));var util=require(_0x36e8('0x1'));var logger=require(_0x36e8('0x2'))('api');var moment=require(_0x36e8('0x3'));var BPromise=require(_0x36e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x36e8('0x5'));var config=require(_0x36e8('0x6'));var attributes=require(_0x36e8('0x7'));module[_0x36e8('0x8')]=function(_0x725f09,_0x3ba506){return _0x725f09['define'](_0x36e8('0x9'),attributes,{'tableName':_0x36e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081e=['bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','lodash','util','api'];(function(_0x40744e,_0x563df5){var _0xa0808=function(_0x381326){while(--_0x381326){_0x40744e['push'](_0x40744e['shift']());}};_0xa0808(++_0x563df5);}(_0x081e,0xc5));var _0xe081=function(_0x2c1b1c,_0x5e9c8e){_0x2c1b1c=_0x2c1b1c-0x0;var _0x1520fb=_0x081e[_0x2c1b1c];return _0x1520fb;};'use strict';var _=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var logger=require('../../config/logger')(_0xe081('0x2'));var moment=require('moment');var BPromise=require(_0xe081('0x3'));var rp=require(_0xe081('0x4'));var fs=require('fs');var path=require(_0xe081('0x5'));var rimraf=require(_0xe081('0x6'));var config=require(_0xe081('0x7'));var attributes=require(_0xe081('0x8'));module[_0xe081('0x9')]=function(_0x50d6cb,_0x2271b4){return _0x50d6cb['define']('Action',attributes,{'tableName':'tools_actions','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 670eabe..14e765f 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0xf494,0x1c6));var _0x4f49=function(_0x47c0fa,_0x1d5300){_0x47c0fa=_0x47c0fa-0x0;var _0x2f1b5d=_0xf494[_0x47c0fa];return _0x2f1b5d;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xf494,0x1c6));var _0x4f49=function(_0xc5e8e5,_0x593874){_0xc5e8e5=_0xc5e8e5-0x0;var _0x2d138c=_0xf494[_0xc5e8e5];return _0x2d138c;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 151a5d7..a90778e 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 _0x8fdf=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','update','isAuthenticated','destroy','exports'];(function(_0xbe39c5,_0x32cd2d){var _0x11a518=function(_0x2b0447){while(--_0x2b0447){_0xbe39c5['push'](_0xbe39c5['shift']());}};_0x11a518(++_0x32cd2d);}(_0x8fdf,0xd0));var _0xf8fd=function(_0x3e51c3,_0x1910d8){_0x3e51c3=_0x3e51c3-0x0;var _0x30cf8e=_0x8fdf[_0x3e51c3];return _0x30cf8e;};'use strict';var multer=require('multer');var util=require(_0xf8fd('0x0'));var path=require(_0xf8fd('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8fd('0x2'));var router=express[_0xf8fd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf8fd('0x4'));var interaction=require(_0xf8fd('0x5'));var config=require(_0xf8fd('0x6'));var controller=require('./action.controller');router[_0xf8fd('0x7')](_0xf8fd('0x8'),auth['isAuthenticated'](),controller[_0xf8fd('0x9')]);router['delete'](_0xf8fd('0x8'),auth[_0xf8fd('0xa')](),controller[_0xf8fd('0xb')]);module[_0xf8fd('0xc')]=router; \ No newline at end of file +var _0x5b50=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4a2a81,_0x29becc){var _0x28ce5a=function(_0x22f390){while(--_0x22f390){_0x4a2a81['push'](_0x4a2a81['shift']());}};_0x28ce5a(++_0x29becc);}(_0x5b50,0x1bd));var _0x05b5=function(_0x1f79b6,_0x1c9324){_0x1f79b6=_0x1f79b6-0x0;var _0xf5d04f=_0x5b50[_0x1f79b6];return _0xf5d04f;};'use strict';var multer=require(_0x05b5('0x0'));var util=require(_0x05b5('0x1'));var path=require('path');var timeout=require(_0x05b5('0x2'));var express=require(_0x05b5('0x3'));var router=express[_0x05b5('0x4')]();var fs_extra=require(_0x05b5('0x5'));var auth=require(_0x05b5('0x6'));var interaction=require(_0x05b5('0x7'));var config=require('../../config/environment');var controller=require(_0x05b5('0x8'));router[_0x05b5('0x9')](_0x05b5('0xa'),auth[_0x05b5('0xb')](),controller[_0x05b5('0xc')]);router[_0x05b5('0xd')](_0x05b5('0xa'),auth[_0x05b5('0xb')](),controller[_0x05b5('0xe')]);module[_0x05b5('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 6fb5763..e6b324f 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 _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x30199a,_0x22b7c2){var _0x2cd040=function(_0x403a60){while(--_0x403a60){_0x30199a['push'](_0x30199a['shift']());}};_0x2cd040(++_0x22b7c2);}(_0xeff8,0x186));var _0x8eff=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xeff8[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','TEXT'];(function(_0x5ab543,_0x593293){var _0xba284f=function(_0x3ccbb5){while(--_0x3ccbb5){_0x5ab543['push'](_0x5ab543['shift']());}};_0xba284f(++_0x593293);}(_0x7217,0x19e));var _0x7721=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7217[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 4451d5f..f9fe5cc 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 _0x30ad=['cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','function','format','groupBy','group','orderBy','alias','joins','includes','foreignTable','foreignKey','table','parentKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','left_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','replace','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','QueryTypes','run','runReport','DATE(%s)','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticCustomReport','includeAll','include','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join'];(function(_0x339bc1,_0x3c5d17){var _0xad4978=function(_0x1d672a){while(--_0x1d672a){_0x339bc1['push'](_0x339bc1['shift']());}};_0xad4978(++_0x3c5d17);}(_0x30ad,0x1ac));var _0xd30a=function(_0x15d327,_0x35e74b){_0x15d327=_0x15d327-0x0;var _0x4314db=_0x30ad[_0x15d327];return _0x4314db;};'use strict';var emlformat=require(_0xd30a('0x0'));var rimraf=require(_0xd30a('0x1'));var zipdir=require(_0xd30a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd30a('0x3'));var moment=require(_0xd30a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd30a('0x5'));var util=require('util');var path=require(_0xd30a('0x6'));var sox=require(_0xd30a('0x7'));var csv=require(_0xd30a('0x8'));var ejs=require(_0xd30a('0x9'));var fs=require('fs');var fs_extra=require(_0xd30a('0xa'));var _=require(_0xd30a('0xb'));var squel=require(_0xd30a('0xc'));var crypto=require(_0xd30a('0xd'));var jsforce=require(_0xd30a('0xe'));var deskjs=require(_0xd30a('0xf'));var toCsv=require(_0xd30a('0x8'));var querystring=require(_0xd30a('0x10'));var Papa=require(_0xd30a('0x11'));var Redis=require(_0xd30a('0x12'));var authService=require(_0xd30a('0x13'));var qs=require(_0xd30a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd30a('0x15'));var logger=require(_0xd30a('0x16'))(_0xd30a('0x17'));var utils=require(_0xd30a('0x18'));var config=require(_0xd30a('0x19'));var licenseUtil=require(_0xd30a('0x1a'));var db=require(_0xd30a('0x1b'))['db'];var dbH=require(_0xd30a('0x1b'))[_0xd30a('0x1c')];function respondWithStatusCode(_0x3f7796,_0x1e17f6){_0x1e17f6=_0x1e17f6||0xcc;return function(_0x1d8589){if(_0x1d8589){return _0x3f7796[_0xd30a('0x1d')](_0x1e17f6);}return _0x3f7796['status'](_0x1e17f6)[_0xd30a('0x1e')]();};}function respondWithResult(_0x21f0cd,_0x549b7e){_0x549b7e=_0x549b7e||0xc8;return function(_0x348db2){if(_0x348db2){return _0x21f0cd[_0xd30a('0x1f')](_0x549b7e)[_0xd30a('0x20')](_0x348db2);}};}function respondWithFilteredResult(_0x25a683,_0xc17b16){return function(_0x11c1d0){if(_0x11c1d0){var _0x36ed31=typeof _0xc17b16[_0xd30a('0x21')]===_0xd30a('0x22')&&typeof _0xc17b16[_0xd30a('0x23')]===_0xd30a('0x22');var _0x4ba80a=_0x11c1d0[_0xd30a('0x24')];var _0x1ab9d6=_0x36ed31?0x0:_0xc17b16['offset'];var _0xdd3a25=_0x36ed31?_0x11c1d0['count']:_0xc17b16[_0xd30a('0x21')]+_0xc17b16[_0xd30a('0x23')];var _0x1fc5ca;if(_0xdd3a25>=_0x4ba80a){_0xdd3a25=_0x4ba80a;_0x1fc5ca=0xc8;}else{_0x1fc5ca=0xce;}_0x25a683[_0xd30a('0x1f')](_0x1fc5ca);return _0x25a683[_0xd30a('0x25')](_0xd30a('0x26'),_0x1ab9d6+'-'+_0xdd3a25+'/'+_0x4ba80a)[_0xd30a('0x20')](_0x11c1d0);}return null;};}function patchUpdates(_0x667cc2){return function(_0xacfc89){try{jsonpatch[_0xd30a('0x27')](_0xacfc89,_0x667cc2,!![]);}catch(_0x126759){return BPromise['reject'](_0x126759);}return _0xacfc89[_0xd30a('0x28')]();};}function saveUpdates(_0xa7bf92,_0x342f51){return function(_0x481542){if(_0x481542){return _0x481542[_0xd30a('0x29')](_0xa7bf92)[_0xd30a('0x2a')](function(_0xda6431){return _0xda6431;});}return null;};}function removeEntity(_0x343df7,_0x1d9ec1){return function(_0x54caa5){if(_0x54caa5){return _0x54caa5[_0xd30a('0x2b')]()['then'](function(){var _0x610a13=_0x54caa5[_0xd30a('0x2c')]({'plain':!![]});var _0x2d9bf3=_0xd30a('0x2d');return db[_0xd30a('0x2e')][_0xd30a('0x2b')]({'where':{'type':_0x2d9bf3,'resourceId':_0x610a13['id']}})[_0xd30a('0x2a')](function(){return _0x54caa5;});})[_0xd30a('0x2a')](function(){_0x343df7[_0xd30a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a3fa5,_0x13070b){return function(_0x9802a2){if(!_0x9802a2){_0x1a3fa5[_0xd30a('0x1d')](0x194);}return _0x9802a2;};}function handleError(_0x339e28,_0x3ebd03){_0x3ebd03=_0x3ebd03||0x1f4;return function(_0x392051){logger[_0xd30a('0x2f')](_0x392051[_0xd30a('0x30')]);if(_0x392051[_0xd30a('0x31')]){delete _0x392051[_0xd30a('0x31')];}_0x339e28['status'](_0x3ebd03)[_0xd30a('0x32')](_0x392051);};}exports[_0xd30a('0x33')]=function(_0x2c39f8,_0x5b212d){var _0x4c7db={},_0x61e2cd={},_0x5b7aa2={'count':0x0,'rows':[]};var _0x9b8fed=_['map'](db['AnalyticCustomReport'][_0xd30a('0x34')],function(_0x417e6f){return{'name':_0x417e6f[_0xd30a('0x35')],'type':_0x417e6f[_0xd30a('0x36')][_0xd30a('0x37')]};});_0x61e2cd[_0xd30a('0x38')]=_[_0xd30a('0x39')](_0x9b8fed,_0xd30a('0x31'));_0x61e2cd[_0xd30a('0x3a')]=_['keys'](_0x2c39f8[_0xd30a('0x3a')]);_0x61e2cd[_0xd30a('0x3b')]=_[_0xd30a('0x3c')](_0x61e2cd[_0xd30a('0x38')],_0x61e2cd[_0xd30a('0x3a')]);_0x4c7db[_0xd30a('0x3d')]=_['intersection'](_0x61e2cd[_0xd30a('0x38')],qs['fields'](_0x2c39f8['query'][_0xd30a('0x3e')]));_0x4c7db['attributes']=_0x4c7db[_0xd30a('0x3d')][_0xd30a('0x3f')]?_0x4c7db[_0xd30a('0x3d')]:_0x61e2cd[_0xd30a('0x38')];if(!_0x2c39f8[_0xd30a('0x3a')][_0xd30a('0x40')](_0xd30a('0x41'))){_0x4c7db[_0xd30a('0x23')]=qs[_0xd30a('0x23')](_0x2c39f8[_0xd30a('0x3a')][_0xd30a('0x23')]);_0x4c7db[_0xd30a('0x21')]=qs['offset'](_0x2c39f8[_0xd30a('0x3a')]['offset']);}_0x4c7db[_0xd30a('0x42')]=qs[_0xd30a('0x43')](_0x2c39f8[_0xd30a('0x3a')][_0xd30a('0x43')]);_0x4c7db[_0xd30a('0x44')]=qs['filters'](_[_0xd30a('0x45')](_0x2c39f8[_0xd30a('0x3a')],_0x61e2cd[_0xd30a('0x3b')]),_0x9b8fed);if(_0x2c39f8[_0xd30a('0x3a')]['filter']){_0x4c7db[_0xd30a('0x44')]=_[_0xd30a('0x46')](_0x4c7db['where'],{'$or':_[_0xd30a('0x39')](_0x9b8fed,function(_0x562ed3){if(_0x562ed3[_0xd30a('0x36')]!==_0xd30a('0x47')){var _0x5260d7={};_0x5260d7[_0x562ed3[_0xd30a('0x31')]]={'$like':'%'+_0x2c39f8[_0xd30a('0x3a')][_0xd30a('0x48')]+'%'};return _0x5260d7;}})});}_0x4c7db=_[_0xd30a('0x46')]({},_0x4c7db,_0x2c39f8[_0xd30a('0x49')]);var _0x2e215f={'where':_0x4c7db[_0xd30a('0x44')]};return db[_0xd30a('0x4a')][_0xd30a('0x24')](_0x2e215f)[_0xd30a('0x2a')](function(_0x55ed43){_0x5b7aa2[_0xd30a('0x24')]=_0x55ed43;if(_0x2c39f8['query'][_0xd30a('0x4b')]){_0x4c7db[_0xd30a('0x4c')]=[{'all':!![]}];}return db[_0xd30a('0x4a')]['findAll'](_0x4c7db);})[_0xd30a('0x2a')](function(_0x5b605b){_0x5b7aa2[_0xd30a('0x4d')]=_0x5b605b;return _0x5b7aa2;})[_0xd30a('0x2a')](respondWithFilteredResult(_0x5b212d,_0x4c7db))['catch'](handleError(_0x5b212d,null));};exports[_0xd30a('0x4e')]=function(_0x176f29,_0x5a0d83){var _0x288931={'raw':![],'where':{'id':_0x176f29[_0xd30a('0x4f')]['id']}},_0x1b1898={};_0x1b1898[_0xd30a('0x38')]=_[_0xd30a('0x50')](db[_0xd30a('0x4a')]['rawAttributes']);_0x1b1898[_0xd30a('0x3a')]=_[_0xd30a('0x50')](_0x176f29[_0xd30a('0x3a')]);_0x1b1898[_0xd30a('0x3b')]=_['intersection'](_0x1b1898['model'],_0x1b1898[_0xd30a('0x3a')]);_0x288931[_0xd30a('0x3d')]=_['intersection'](_0x1b1898[_0xd30a('0x38')],qs['fields'](_0x176f29[_0xd30a('0x3a')][_0xd30a('0x3e')]));_0x288931[_0xd30a('0x3d')]=_0x288931[_0xd30a('0x3d')][_0xd30a('0x3f')]?_0x288931['attributes']:_0x1b1898['model'];if(_0x176f29[_0xd30a('0x3a')]['includeAll']){_0x288931[_0xd30a('0x4c')]=[{'all':!![]}];}_0x288931=_[_0xd30a('0x46')]({},_0x288931,_0x176f29[_0xd30a('0x49')]);return db[_0xd30a('0x4a')][_0xd30a('0x51')](_0x288931)[_0xd30a('0x2a')](handleEntityNotFound(_0x5a0d83,null))[_0xd30a('0x2a')](respondWithResult(_0x5a0d83,null))[_0xd30a('0x52')](handleError(_0x5a0d83,null));};exports[_0xd30a('0x53')]=function(_0x10649d,_0x142441){return db['AnalyticCustomReport']['create'](_0x10649d[_0xd30a('0x54')],{})['then'](function(_0x249989){var _0x1cae88=_0x10649d[_0xd30a('0x55')][_0xd30a('0x2c')]({'plain':!![]});if(!_0x1cae88)throw new Error(_0xd30a('0x56'));if(_0x1cae88['role']===_0xd30a('0x55')){var _0x3f6a30=_0x249989[_0xd30a('0x2c')]({'plain':!![]});var _0x59688c='Reports';return db[_0xd30a('0x57')][_0xd30a('0x51')]({'where':{'name':_0x59688c,'userProfileId':_0x1cae88[_0xd30a('0x58')]},'raw':!![]})[_0xd30a('0x2a')](function(_0x322d86){if(_0x322d86&&_0x322d86[_0xd30a('0x59')]===0x0){return db[_0xd30a('0x2e')][_0xd30a('0x53')]({'name':_0x3f6a30['name'],'resourceId':_0x3f6a30['id'],'type':'CustomReports','sectionId':_0x322d86['id']},{})['then'](function(){return _0x249989;});}else{return _0x249989;}})[_0xd30a('0x52')](function(_0x3b87a5){logger[_0xd30a('0x2f')](_0xd30a('0x5a'),_0x3b87a5);throw _0x3b87a5;});}return _0x249989;})[_0xd30a('0x2a')](respondWithResult(_0x142441,0xc9))['catch'](handleError(_0x142441,null));};exports[_0xd30a('0x29')]=function(_0xb60bc5,_0x4bf5f7){if(_0xb60bc5[_0xd30a('0x54')]['id']){delete _0xb60bc5['body']['id'];}return db[_0xd30a('0x4a')][_0xd30a('0x51')]({'where':{'id':_0xb60bc5[_0xd30a('0x4f')]['id']}})[_0xd30a('0x2a')](handleEntityNotFound(_0x4bf5f7,null))[_0xd30a('0x2a')](saveUpdates(_0xb60bc5[_0xd30a('0x54')],null))[_0xd30a('0x2a')](respondWithResult(_0x4bf5f7,null))['catch'](handleError(_0x4bf5f7,null));};exports[_0xd30a('0x2b')]=function(_0x3d5ab6,_0x494c63){return db[_0xd30a('0x4a')]['find']({'where':{'id':_0x3d5ab6['params']['id']}})[_0xd30a('0x2a')](handleEntityNotFound(_0x494c63,null))[_0xd30a('0x2a')](removeEntity(_0x494c63,null))[_0xd30a('0x52')](handleError(_0x494c63,null));};exports[_0xd30a('0x5b')]=function(_0x1bea11,_0x45640f){var _0x24c5a9=0xa;var _0x4cae60=[_0xd30a('0x5c'),'left_join',_0xd30a('0x5d'),_0xd30a('0x5e')];var _0x140041={'SUM':_0xd30a('0x5f'),'COUNT':_0xd30a('0x60'),'COUNT DISTINCT':_0xd30a('0x61'),'MAX':_0xd30a('0x62'),'MIN':_0xd30a('0x63'),'AVG':_0xd30a('0x64'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd30a('0x65'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2b71fe={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xd30a('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x57e459=function(_0x44b13f){return!_['includes']([_0xd30a('0x67'),_0xd30a('0x68'),_0xd30a('0x69'),_0xd30a('0x6a')],_0x44b13f);};var _0x265e19=function(_0x204f2c){if(!_0x204f2c||!_0x204f2c[_0xd30a('0x6b')][_0xd30a('0x3f')]){return'';}for(var _0x57ac3c='(',_0x51c529=0x0;_0x51c529<_0x204f2c[_0xd30a('0x6b')][_0xd30a('0x3f')];_0x51c529+=0x1){_0x51c529>0x0&&(_0x57ac3c+='\x20'+_0x204f2c[_0xd30a('0x6c')]+'\x20');_0x57ac3c+=_0x204f2c[_0xd30a('0x6b')][_0x51c529]['group']?_0x265e19(_0x204f2c['rules'][_0x51c529]['group']):_0x204f2c[_0xd30a('0x6b')][_0x51c529][_0xd30a('0x6d')]+'\x20'+_0x204f2c[_0xd30a('0x6b')][_0x51c529][_0xd30a('0x6e')]+(_0x57e459(_0x204f2c[_0xd30a('0x6b')][_0x51c529][_0xd30a('0x6e')])?'\x20'+_0x204f2c['rules'][_0x51c529][_0xd30a('0x6f')]:'');}return _0x57ac3c+')';};var _0x1c879e={'where':{'id':_0x1bea11[_0xd30a('0x4f')]['id']}},_0x397951,_0x56cf77,_0x5d7f73,_0x2dbcc1,_0x3e7249;_0x1c879e=_['merge']({},_0x1c879e,_0x1bea11[_0xd30a('0x49')]);return db[_0xd30a('0x4a')]['find'](_0x1c879e)['then'](function(_0x5ed407){if(_0x5ed407){_0x397951=_0x5ed407;return _0x5ed407[_0xd30a('0x70')]();}return null;})['then'](function(_0x6c6b0d){if(_0x6c6b0d){if(!_0x6c6b0d[_0xd30a('0x3f')]){throw new db[(_0xd30a('0x71'))][(_0xd30a('0x72'))](_0xd30a('0x73'),0x193);}_0x56cf77=_0x6c6b0d;return db[_0xd30a('0x74')][_0xd30a('0x75')]({'raw':!![]});}return null;})[_0xd30a('0x2a')](function(_0x56ca82){if(_0x56ca82){_0x5d7f73=_[_0xd30a('0x76')](_0x56ca82,'id');var _0x11110d;var _0x2e9e86=squel[_0xd30a('0x77')]();_0x2e9e86[_0xd30a('0x78')](_0x397951['table']);for(var _0xcd6934=0x0;_0xcd6934<_0x56cf77['length'];_0xcd6934+=0x1){_0x11110d=_0x56cf77[_0xcd6934][_0xd30a('0x79')]?_0x5d7f73[_0x56cf77[_0xcd6934][_0xd30a('0x79')]][_0xd30a('0x7a')]:_0x56cf77[_0xcd6934][_0xd30a('0x6d')];_0x11110d=_0x56cf77[_0xcd6934]['function']?_['replace'](_0x140041[_0x56cf77[_0xcd6934][_0xd30a('0x7b')]],'%s',_0x11110d):_0x11110d;_0x11110d=_0x56cf77[_0xcd6934][_0xd30a('0x7c')]?_['replace'](_0x2b71fe[_0x56cf77[_0xcd6934][_0xd30a('0x7c')]],'%s',_0x11110d):_0x11110d;if(_0x56cf77[_0xcd6934][_0xd30a('0x7d')]){_0x2e9e86[_0xd30a('0x7e')](_0x11110d);}_0x56cf77[_0xcd6934][_0xd30a('0x7f')]&&_0x2e9e86[_0xd30a('0x42')](_0x11110d,_0x56cf77[_0xcd6934][_0xd30a('0x7f')]==='DESC'?![]:!![]);_0x2e9e86[_0xd30a('0x6d')](_0x11110d,_0x56cf77[_0xcd6934][_0xd30a('0x80')]||_0x11110d);}if(_0x397951[_0xd30a('0x81')]){_0x397951['joins']=JSON['parse'](_0x397951[_0xd30a('0x81')]);for(var _0x2d61b3=0x0;_0x2d61b3<_0x397951['joins']['length'];_0x2d61b3+=0x1){if(_0x397951[_0xd30a('0x81')][_0x2d61b3][_0xd30a('0x36')]&&_[_0xd30a('0x82')](_0x4cae60,_0x397951[_0xd30a('0x81')][_0x2d61b3][_0xd30a('0x36')])&&_0x397951[_0xd30a('0x81')][_0x2d61b3]['parentKey']&&_0x397951['joins'][_0x2d61b3][_0xd30a('0x83')]&&_0x397951['joins'][_0x2d61b3][_0xd30a('0x84')]){_0x2e9e86[_0x397951[_0xd30a('0x81')][_0x2d61b3]['type']](_0x397951[_0xd30a('0x81')][_0x2d61b3][_0xd30a('0x83')],null,util[_0xd30a('0x7c')]('%s.%s\x20=\x20%s.%s',_0x397951[_0xd30a('0x85')],_0x397951[_0xd30a('0x81')][_0x2d61b3][_0xd30a('0x86')],_0x397951[_0xd30a('0x81')][_0x2d61b3][_0xd30a('0x83')],_0x397951['joins'][_0x2d61b3][_0xd30a('0x84')]));}}}if(_0x397951[_0xd30a('0x87')]){_0x397951[_0xd30a('0x87')]=JSON[_0xd30a('0x88')](_0x397951[_0xd30a('0x87')]);_0x2e9e86[_0xd30a('0x44')](_0x265e19(_0x397951[_0xd30a('0x87')][_0xd30a('0x7e')]));}_0x3e7249=_0x2e9e86[_0xd30a('0x89')]();_0x2e9e86[_0xd30a('0x23')](_0x24c5a9);_0x2e9e86[_0xd30a('0x21')](0x0);logger[_0xd30a('0x8a')](_0xd30a('0x8b'),_0x2e9e86[_0xd30a('0x8c')]());return dbH[_0xd30a('0x8d')][_0xd30a('0x3a')](_0x2e9e86[_0xd30a('0x8c')](),{'type':dbH[_0xd30a('0x8d')]['QueryTypes'][_0xd30a('0x8e')]});}})[_0xd30a('0x2a')](respondWithResult(_0x45640f,null))['catch'](handleError(_0x45640f,null));};function runReport(_0x509abb,_0x3007ff,_0x49e0ee){var _0x16ca0a=_0x3007ff[_0xd30a('0x31')];var _0x2625a7=0xa;var _0x3ceec3=[_0xd30a('0x5c'),_0xd30a('0x8f'),_0xd30a('0x5d'),'cross_join'];var _0x12d1a8={'SUM':'SUM(%s)','COUNT':_0xd30a('0x60'),'COUNT DISTINCT':_0xd30a('0x61'),'MAX':_0xd30a('0x62'),'MIN':_0xd30a('0x63'),'AVG':_0xd30a('0x64'),'GROUP_CONCAT':_0xd30a('0x90'),'GROUP_CONCAT ASC':_0xd30a('0x65'),'GROUP_CONCAT DESC':_0xd30a('0x91')};var _0x2d57a9={'SEC_TO_TIME':_0xd30a('0x92'),'DATE':'DATE(%s)','HOUR':_0xd30a('0x66'),'ROUND':_0xd30a('0x93'),'UNIX_TIMESTAMP':_0xd30a('0x94')};var _0x5eebff=function(_0x29081f){return!_[_0xd30a('0x82')]([_0xd30a('0x67'),_0xd30a('0x68'),_0xd30a('0x69'),'IS\x20NOT\x20EMPTY'],_0x29081f);};var _0x32b6e3=function(_0x4e2a68){if(!_0x4e2a68||!_0x4e2a68['rules']['length']){return'';}for(var _0x5219d2='(',_0x51bbd4=0x0;_0x51bbd4<_0x4e2a68['rules'][_0xd30a('0x3f')];_0x51bbd4+=0x1){_0x51bbd4>0x0&&(_0x5219d2+='\x20'+_0x4e2a68['operator']+'\x20');_0x5219d2+=_0x4e2a68[_0xd30a('0x6b')][_0x51bbd4][_0xd30a('0x7e')]?_0x32b6e3(_0x4e2a68[_0xd30a('0x6b')][_0x51bbd4]['group']):_0x4e2a68[_0xd30a('0x6b')][_0x51bbd4][_0xd30a('0x6d')]+'\x20'+_0x4e2a68['rules'][_0x51bbd4][_0xd30a('0x6e')]+(_0x5eebff(_0x4e2a68[_0xd30a('0x6b')][_0x51bbd4][_0xd30a('0x6e')])?'\x20'+_0x4e2a68[_0xd30a('0x6b')][_0x51bbd4]['value']:'');}return _0x5219d2+')';};var _0x47a80b={'where':{'id':_0x509abb['id']}},_0x461bc0,_0x9398a,_0x204971,_0x191412,_0x1e88ed;_0x47a80b=_[_0xd30a('0x46')]({},_0x47a80b,_0x49e0ee);return db[_0xd30a('0x4a')][_0xd30a('0x51')](_0x47a80b)[_0xd30a('0x2a')](function(_0x91604e){if(_0x91604e){_0x461bc0=_0x91604e;return _0x91604e['getFields']();}return null;})[_0xd30a('0x2a')](function(_0x6b8222){if(_0x6b8222){if(!_0x6b8222[_0xd30a('0x3f')]){throw new db[(_0xd30a('0x71'))][(_0xd30a('0x72'))](_0xd30a('0x73'),0x193);}_0x9398a=_0x6b8222;return db[_0xd30a('0x74')]['findAll']({'raw':!![]});}return null;})[_0xd30a('0x2a')](function(_0x2206c6){if(_0x2206c6){_0x204971=_['keyBy'](_0x2206c6,'id');var _0x40cb11;var _0x488208=squel[_0xd30a('0x77')]();_0x488208[_0xd30a('0x78')](_0x461bc0['table']);for(var _0x39f746=0x0;_0x39f746<_0x9398a[_0xd30a('0x3f')];_0x39f746+=0x1){_0x40cb11=_0x9398a[_0x39f746]['MetricId']?_0x204971[_0x9398a[_0x39f746][_0xd30a('0x79')]][_0xd30a('0x7a')]:_0x9398a[_0x39f746][_0xd30a('0x6d')];_0x40cb11=_0x9398a[_0x39f746][_0xd30a('0x7b')]?_[_0xd30a('0x95')](_0x12d1a8[_0x9398a[_0x39f746][_0xd30a('0x7b')]],'%s',_0x40cb11):_0x40cb11;_0x40cb11=_0x9398a[_0x39f746][_0xd30a('0x7c')]?_[_0xd30a('0x95')](_0x2d57a9[_0x9398a[_0x39f746][_0xd30a('0x7c')]],'%s',_0x40cb11):_0x40cb11;if(_0x9398a[_0x39f746][_0xd30a('0x7d')]){_0x488208[_0xd30a('0x7e')](_0x40cb11);}_0x9398a[_0x39f746]['orderBy']&&_0x488208[_0xd30a('0x42')](_0x40cb11,_0x9398a[_0x39f746][_0xd30a('0x7f')]===_0xd30a('0x96')?![]:!![]);_0x488208[_0xd30a('0x6d')](_0x40cb11,_0x9398a[_0x39f746]['alias']||_0x40cb11);}if(_0x461bc0[_0xd30a('0x81')]){_0x461bc0[_0xd30a('0x81')]=JSON[_0xd30a('0x88')](_0x461bc0[_0xd30a('0x81')]);for(var _0x26bafc=0x0;_0x26bafc<_0x461bc0[_0xd30a('0x81')][_0xd30a('0x3f')];_0x26bafc+=0x1){if(_0x461bc0[_0xd30a('0x81')][_0x26bafc][_0xd30a('0x36')]&&_[_0xd30a('0x82')](_0x3ceec3,_0x461bc0[_0xd30a('0x81')][_0x26bafc]['type'])&&_0x461bc0[_0xd30a('0x81')][_0x26bafc][_0xd30a('0x86')]&&_0x461bc0[_0xd30a('0x81')][_0x26bafc][_0xd30a('0x83')]&&_0x461bc0[_0xd30a('0x81')][_0x26bafc][_0xd30a('0x84')]){_0x488208[_0x461bc0[_0xd30a('0x81')][_0x26bafc]['type']](_0x461bc0[_0xd30a('0x81')][_0x26bafc][_0xd30a('0x83')],null,util['format'](_0xd30a('0x97'),_0x461bc0[_0xd30a('0x85')],_0x461bc0[_0xd30a('0x81')][_0x26bafc][_0xd30a('0x86')],_0x461bc0[_0xd30a('0x81')][_0x26bafc][_0xd30a('0x83')],_0x461bc0[_0xd30a('0x81')][_0x26bafc][_0xd30a('0x84')]));}}}if(_0x461bc0[_0xd30a('0x87')]){_0x461bc0['conditions']=JSON[_0xd30a('0x88')](_0x461bc0[_0xd30a('0x87')]);_0x488208[_0xd30a('0x44')](_0x32b6e3(_0x461bc0['conditions'][_0xd30a('0x7e')]));}_0x1e88ed=_0x488208['clone']();_0x488208[_0xd30a('0x23')](_0x2625a7);_0x488208[_0xd30a('0x21')](0x0);return;}})[_0xd30a('0x2a')](function(){if(_0x3007ff[_0xd30a('0x98')]===_0xd30a('0x99')){return null;}var _0x2a67e4=_[_0xd30a('0x46')](_0x3007ff,{'name':_0x3007ff[_0xd30a('0x9a')]||_0x3007ff['name']||_0x461bc0[_0xd30a('0x31')],'basename':_0x16ca0a,'savename':util['format'](_0xd30a('0x9b'),_0x3007ff[_0xd30a('0x31')]||_0x461bc0[_0xd30a('0x31')],require(_0xd30a('0x9c'))['generate'](0x4),_0x3007ff['output']||'csv'),'reportId':_0x461bc0['id'],'reportType':'custom'});return db[_0xd30a('0x9d')][_0xd30a('0x53')](_0x2a67e4,{'raw':!![]});})['then'](function(_0x45fa5e){if(_0x461bc0[_0xd30a('0x85')]===_0xd30a('0x9e')){_0x1e88ed[_0xd30a('0x44')](_0x461bc0[_0xd30a('0x85')]+_0xd30a('0x9f'),_0x3007ff['startDate'],_0x3007ff['endDate']);}else{_0x1e88ed[_0xd30a('0x44')](_0x461bc0[_0xd30a('0x85')]+_0xd30a('0xa0'),_0x3007ff[_0xd30a('0xa1')],_0x3007ff[_0xd30a('0xa2')]);}if(_0x45fa5e){logger[_0xd30a('0xa3')](_0xd30a('0xa4'),_0x1e88ed[_0xd30a('0x8c')]());require(_0xd30a('0xa5'))[_0xd30a('0xa6')](path['join'](__dirname,'../../components/export/',_0x45fa5e['output']),[_0x45fa5e['id'],_0x1e88ed[_0xd30a('0x8c')](),path['join'](__dirname,_0xd30a('0xa7'),_0x45fa5e[_0xd30a('0xa8')]),_0x16ca0a]);return _0x45fa5e;}else{var _0x475f82=squel[_0xd30a('0x77')]();_0x475f82['from']('('+_0x1e88ed[_0xd30a('0x8c')]()+')','countTable');_0x475f82[_0xd30a('0x6d')](_0xd30a('0xa9'),_0xd30a('0x24'));_0x1e88ed[_0xd30a('0x23')](_0x3007ff[_0xd30a('0x23')]||_0x2625a7);_0x1e88ed['offset'](_0x3007ff[_0xd30a('0x21')]||0x0);return dbH[_0xd30a('0x8d')][_0xd30a('0x3a')](_0x475f82['toString'](),{'type':dbH[_0xd30a('0x8d')]['QueryTypes'][_0xd30a('0x8e')]})[_0xd30a('0x2a')](function(_0x36c13e){if(!_0x36c13e['length']){_0x191412=0x0;}else{_0x191412=_0x36c13e[0x0][_0xd30a('0x24')]||0x0;}return dbH[_0xd30a('0x8d')][_0xd30a('0x3a')](_0x1e88ed['toString'](),{'type':dbH[_0xd30a('0x8d')][_0xd30a('0xaa')][_0xd30a('0x8e')]});})[_0xd30a('0x2a')](function(_0xeda1a0){return{'rows':_0xeda1a0||[],'count':_0x191412};});}});}exports[_0xd30a('0xab')]=function(_0x30dda3,_0x2538c8){return runReport(_0x30dda3[_0xd30a('0x4f')],_0x30dda3['query'],_0x30dda3[_0xd30a('0x49')])[_0xd30a('0x2a')](respondWithResult(_0x2538c8,null))[_0xd30a('0x52')](handleError(_0x2538c8,null));};exports[_0xd30a('0xac')]=runReport;exports[_0xd30a('0x3a')]=function(_0x498e0c,_0x1e39d4){var _0x52242f=0xa;var _0x3f4a19=[_0xd30a('0x5c'),_0xd30a('0x8f'),_0xd30a('0x5d'),_0xd30a('0x5e')];var _0x8cdc2c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd30a('0x62'),'MIN':_0xd30a('0x63'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd30a('0x90'),'GROUP_CONCAT ASC':_0xd30a('0x65'),'GROUP_CONCAT DESC':_0xd30a('0x91')};var _0x78b7c={'SEC_TO_TIME':_0xd30a('0x92'),'DATE':_0xd30a('0xad'),'HOUR':_0xd30a('0x66'),'ROUND':_0xd30a('0x93'),'UNIX_TIMESTAMP':_0xd30a('0x94')};var _0xb962c9=function(_0x4f6e49){return!_[_0xd30a('0x82')]([_0xd30a('0x67'),_0xd30a('0x68'),_0xd30a('0x69'),_0xd30a('0x6a')],_0x4f6e49);};var _0x51a958=function(_0x1c4b1b){if(!_0x1c4b1b||!_0x1c4b1b[_0xd30a('0x6b')]['length']){return'';}for(var _0x3a0691='(',_0x85eb0a=0x0;_0x85eb0a<_0x1c4b1b['rules'][_0xd30a('0x3f')];_0x85eb0a+=0x1){_0x85eb0a>0x0&&(_0x3a0691+='\x20'+_0x1c4b1b[_0xd30a('0x6c')]+'\x20');_0x3a0691+=_0x1c4b1b[_0xd30a('0x6b')][_0x85eb0a][_0xd30a('0x7e')]?_0x51a958(_0x1c4b1b[_0xd30a('0x6b')][_0x85eb0a][_0xd30a('0x7e')]):_0x1c4b1b[_0xd30a('0x6b')][_0x85eb0a][_0xd30a('0x6d')]+'\x20'+_0x1c4b1b['rules'][_0x85eb0a][_0xd30a('0x6e')]+(_0xb962c9(_0x1c4b1b['rules'][_0x85eb0a][_0xd30a('0x6e')])?'\x20'+_0x1c4b1b[_0xd30a('0x6b')][_0x85eb0a][_0xd30a('0x6f')]:'');}return _0x3a0691+')';};var _0x2ccf80={'where':{'id':_0x498e0c[_0xd30a('0x4f')]['id']}},_0x136925,_0x39d6e3,_0xe98828,_0x555f90,_0x445b24;_0x2ccf80=_['merge']({},_0x2ccf80,_0x498e0c[_0xd30a('0x49')]);return db['AnalyticCustomReport'][_0xd30a('0x51')](_0x2ccf80)['then'](function(_0x323237){if(_0x323237){_0x136925=_0x323237;return _0x323237[_0xd30a('0x70')]();}return null;})[_0xd30a('0x2a')](function(_0x55a484){if(_0x55a484){if(!_0x55a484[_0xd30a('0x3f')]){throw new db[(_0xd30a('0x71'))][(_0xd30a('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x39d6e3=_0x55a484;return db[_0xd30a('0x74')][_0xd30a('0x75')]({'raw':!![]});}return null;})[_0xd30a('0x2a')](function(_0x153182){if(_0x153182){_0xe98828=_[_0xd30a('0x76')](_0x153182,'id');var _0x447bbd;var _0x3a3e55=squel[_0xd30a('0x77')]();_0x3a3e55[_0xd30a('0x78')](_0x136925['table']);for(var _0x50cc2b=0x0;_0x50cc2b<_0x39d6e3[_0xd30a('0x3f')];_0x50cc2b+=0x1){_0x447bbd=_0x39d6e3[_0x50cc2b][_0xd30a('0x79')]?_0xe98828[_0x39d6e3[_0x50cc2b][_0xd30a('0x79')]][_0xd30a('0x7a')]:_0x39d6e3[_0x50cc2b][_0xd30a('0x6d')];_0x447bbd=_0x39d6e3[_0x50cc2b]['function']?_['replace'](_0x8cdc2c[_0x39d6e3[_0x50cc2b]['function']],'%s',_0x447bbd):_0x447bbd;_0x447bbd=_0x39d6e3[_0x50cc2b]['format']?_[_0xd30a('0x95')](_0x78b7c[_0x39d6e3[_0x50cc2b][_0xd30a('0x7c')]],'%s',_0x447bbd):_0x447bbd;if(_0x39d6e3[_0x50cc2b]['groupBy']){_0x3a3e55[_0xd30a('0x7e')](_0x447bbd);}_0x39d6e3[_0x50cc2b]['orderBy']&&_0x3a3e55['order'](_0x447bbd,_0x39d6e3[_0x50cc2b]['orderBy']===_0xd30a('0x96')?![]:!![]);_0x3a3e55[_0xd30a('0x6d')](_0x447bbd,_0x39d6e3[_0x50cc2b][_0xd30a('0x80')]||_0x447bbd);}if(_0x136925[_0xd30a('0x81')]){_0x136925[_0xd30a('0x81')]=JSON[_0xd30a('0x88')](_0x136925[_0xd30a('0x81')]);for(var _0x551ce0=0x0;_0x551ce0<_0x136925['joins'][_0xd30a('0x3f')];_0x551ce0+=0x1){if(_0x136925[_0xd30a('0x81')][_0x551ce0][_0xd30a('0x36')]&&_['includes'](_0x3f4a19,_0x136925[_0xd30a('0x81')][_0x551ce0][_0xd30a('0x36')])&&_0x136925[_0xd30a('0x81')][_0x551ce0][_0xd30a('0x86')]&&_0x136925['joins'][_0x551ce0][_0xd30a('0x83')]&&_0x136925[_0xd30a('0x81')][_0x551ce0]['foreignKey']){_0x3a3e55[_0x136925[_0xd30a('0x81')][_0x551ce0]['type']](_0x136925[_0xd30a('0x81')][_0x551ce0][_0xd30a('0x83')],null,util[_0xd30a('0x7c')](_0xd30a('0x97'),_0x136925['table'],_0x136925[_0xd30a('0x81')][_0x551ce0][_0xd30a('0x86')],_0x136925[_0xd30a('0x81')][_0x551ce0][_0xd30a('0x83')],_0x136925[_0xd30a('0x81')][_0x551ce0][_0xd30a('0x84')]));}}}if(_0x136925['conditions']){_0x136925[_0xd30a('0x87')]=JSON[_0xd30a('0x88')](_0x136925['conditions']);_0x3a3e55['where'](_0x51a958(_0x136925[_0xd30a('0x87')][_0xd30a('0x7e')]));}_0x445b24=_0x3a3e55[_0xd30a('0x89')]();_0x3a3e55[_0xd30a('0x23')](_0x52242f);_0x3a3e55[_0xd30a('0x21')](0x0);logger['debug'](_0xd30a('0x8b'),_0x3a3e55[_0xd30a('0x8c')]());return dbH['sequelize'][_0xd30a('0x3a')](_0x3a3e55['toString'](),{'type':dbH[_0xd30a('0x8d')][_0xd30a('0xaa')][_0xd30a('0x8e')]});}})[_0xd30a('0x2a')](function(){return{'sql':_0x445b24[_0xd30a('0x8c')]()};})[_0xd30a('0x2a')](respondWithResult(_0x1e39d4,null))['catch'](handleError(_0x1e39d4,null));}; \ No newline at end of file +var _0x8ff9=['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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','field','function','replace','groupBy','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','format','%s.%s\x20=\x20%s.%s','table','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','right_join','MIN(%s)','DATE(%s)','HOUR(%s)','select','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','endDate','startDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','metric','DESC','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','dbH','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','UserProfileResource','CustomReports','update','preview','join','left_join','SUM(%s)'];(function(_0x264baa,_0x36a8ee){var _0x1f906b=function(_0x14b6b1){while(--_0x14b6b1){_0x264baa['push'](_0x264baa['shift']());}};_0x1f906b(++_0x36a8ee);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x1eca30,_0x470949){_0x1eca30=_0x1eca30-0x0;var _0x1a6d53=_0x8ff9[_0x1eca30];return _0x1a6d53;};'use strict';var emlformat=require(_0x98ff('0x0'));var rimraf=require(_0x98ff('0x1'));var zipdir=require(_0x98ff('0x2'));var jsonpatch=require(_0x98ff('0x3'));var rp=require(_0x98ff('0x4'));var moment=require(_0x98ff('0x5'));var BPromise=require(_0x98ff('0x6'));var Mustache=require(_0x98ff('0x7'));var util=require(_0x98ff('0x8'));var path=require(_0x98ff('0x9'));var sox=require(_0x98ff('0xa'));var csv=require('to-csv');var ejs=require(_0x98ff('0xb'));var fs=require('fs');var fs_extra=require(_0x98ff('0xc'));var _=require(_0x98ff('0xd'));var squel=require(_0x98ff('0xe'));var crypto=require(_0x98ff('0xf'));var jsforce=require(_0x98ff('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x98ff('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98ff('0x12'));var authService=require(_0x98ff('0x13'));var qs=require(_0x98ff('0x14'));var as=require(_0x98ff('0x15'));var hardwareService=require(_0x98ff('0x16'));var logger=require('../../config/logger')(_0x98ff('0x17'));var utils=require('../../config/utils');var config=require(_0x98ff('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x98ff('0x19'))[_0x98ff('0x1a')];function respondWithStatusCode(_0x24a64e,_0x54dc3c){_0x54dc3c=_0x54dc3c||0xcc;return function(_0xd359c2){if(_0xd359c2){return _0x24a64e['sendStatus'](_0x54dc3c);}return _0x24a64e[_0x98ff('0x1b')](_0x54dc3c)[_0x98ff('0x1c')]();};}function respondWithResult(_0x2c4e4d,_0x3a7e21){_0x3a7e21=_0x3a7e21||0xc8;return function(_0x2aae4d){if(_0x2aae4d){return _0x2c4e4d[_0x98ff('0x1b')](_0x3a7e21)['json'](_0x2aae4d);}};}function respondWithFilteredResult(_0x3573a4,_0x196f27){return function(_0xb48c72){if(_0xb48c72){var _0x5af32=typeof _0x196f27[_0x98ff('0x1d')]===_0x98ff('0x1e')&&typeof _0x196f27[_0x98ff('0x1f')]===_0x98ff('0x1e');var _0x268121=_0xb48c72[_0x98ff('0x20')];var _0x91e31c=_0x5af32?0x0:_0x196f27[_0x98ff('0x1d')];var _0x188f58=_0x5af32?_0xb48c72[_0x98ff('0x20')]:_0x196f27['offset']+_0x196f27[_0x98ff('0x1f')];var _0x31f525;if(_0x188f58>=_0x268121){_0x188f58=_0x268121;_0x31f525=0xc8;}else{_0x31f525=0xce;}_0x3573a4[_0x98ff('0x1b')](_0x31f525);return _0x3573a4[_0x98ff('0x21')](_0x98ff('0x22'),_0x91e31c+'-'+_0x188f58+'/'+_0x268121)[_0x98ff('0x23')](_0xb48c72);}return null;};}function patchUpdates(_0x205633){return function(_0x3a6c52){try{jsonpatch[_0x98ff('0x24')](_0x3a6c52,_0x205633,!![]);}catch(_0x1514eb){return BPromise[_0x98ff('0x25')](_0x1514eb);}return _0x3a6c52[_0x98ff('0x26')]();};}function saveUpdates(_0x2fdbc2,_0x4ea518){return function(_0x5155bf){if(_0x5155bf){return _0x5155bf['update'](_0x2fdbc2)[_0x98ff('0x27')](function(_0x3ee01b){return _0x3ee01b;});}return null;};}function removeEntity(_0x547fab,_0xd0293e){return function(_0x58b281){if(_0x58b281){return _0x58b281[_0x98ff('0x28')]()[_0x98ff('0x27')](function(){var _0x308efd=_0x58b281[_0x98ff('0x29')]({'plain':!![]});var _0x4003de='CustomReports';return db['UserProfileResource'][_0x98ff('0x28')]({'where':{'type':_0x4003de,'resourceId':_0x308efd['id']}})[_0x98ff('0x27')](function(){return _0x58b281;});})[_0x98ff('0x27')](function(){_0x547fab[_0x98ff('0x1b')](0xcc)[_0x98ff('0x1c')]();});}};}function handleEntityNotFound(_0x231e00,_0x1c7fdb){return function(_0x28e0a0){if(!_0x28e0a0){_0x231e00[_0x98ff('0x2a')](0x194);}return _0x28e0a0;};}function handleError(_0x25a658,_0x4b6e9c){_0x4b6e9c=_0x4b6e9c||0x1f4;return function(_0x43e12c){logger[_0x98ff('0x2b')](_0x43e12c[_0x98ff('0x2c')]);if(_0x43e12c[_0x98ff('0x2d')]){delete _0x43e12c[_0x98ff('0x2d')];}_0x25a658[_0x98ff('0x1b')](_0x4b6e9c)[_0x98ff('0x2e')](_0x43e12c);};}exports[_0x98ff('0x2f')]=function(_0x42213a,_0x205d85){var _0x3fa70c={},_0x1472cb={},_0x257722={'count':0x0,'rows':[]};var _0xadf638=_[_0x98ff('0x30')](db[_0x98ff('0x31')][_0x98ff('0x32')],function(_0x12d6cc){return{'name':_0x12d6cc[_0x98ff('0x33')],'type':_0x12d6cc[_0x98ff('0x34')][_0x98ff('0x35')]};});_0x1472cb['model']=_[_0x98ff('0x30')](_0xadf638,_0x98ff('0x2d'));_0x1472cb[_0x98ff('0x36')]=_[_0x98ff('0x37')](_0x42213a[_0x98ff('0x36')]);_0x1472cb['filters']=_[_0x98ff('0x38')](_0x1472cb['model'],_0x1472cb[_0x98ff('0x36')]);_0x3fa70c[_0x98ff('0x39')]=_[_0x98ff('0x38')](_0x1472cb[_0x98ff('0x3a')],qs[_0x98ff('0x3b')](_0x42213a[_0x98ff('0x36')][_0x98ff('0x3b')]));_0x3fa70c[_0x98ff('0x39')]=_0x3fa70c[_0x98ff('0x39')][_0x98ff('0x3c')]?_0x3fa70c['attributes']:_0x1472cb[_0x98ff('0x3a')];if(!_0x42213a[_0x98ff('0x36')][_0x98ff('0x3d')](_0x98ff('0x3e'))){_0x3fa70c[_0x98ff('0x1f')]=qs[_0x98ff('0x1f')](_0x42213a[_0x98ff('0x36')][_0x98ff('0x1f')]);_0x3fa70c['offset']=qs[_0x98ff('0x1d')](_0x42213a['query'][_0x98ff('0x1d')]);}_0x3fa70c[_0x98ff('0x3f')]=qs[_0x98ff('0x40')](_0x42213a[_0x98ff('0x36')][_0x98ff('0x40')]);_0x3fa70c['where']=qs['filters'](_[_0x98ff('0x41')](_0x42213a[_0x98ff('0x36')],_0x1472cb[_0x98ff('0x42')]),_0xadf638);if(_0x42213a[_0x98ff('0x36')][_0x98ff('0x43')]){_0x3fa70c[_0x98ff('0x44')]=_[_0x98ff('0x45')](_0x3fa70c['where'],{'$or':_[_0x98ff('0x30')](_0xadf638,function(_0x2931a7){if(_0x2931a7[_0x98ff('0x34')]!==_0x98ff('0x46')){var _0x37113a={};_0x37113a[_0x2931a7[_0x98ff('0x2d')]]={'$like':'%'+_0x42213a[_0x98ff('0x36')]['filter']+'%'};return _0x37113a;}})});}_0x3fa70c=_[_0x98ff('0x45')]({},_0x3fa70c,_0x42213a[_0x98ff('0x47')]);var _0x2ef8cf={'where':_0x3fa70c[_0x98ff('0x44')]};return db[_0x98ff('0x31')]['count'](_0x2ef8cf)['then'](function(_0x865df7){_0x257722['count']=_0x865df7;if(_0x42213a[_0x98ff('0x36')][_0x98ff('0x48')]){_0x3fa70c[_0x98ff('0x49')]=[{'all':!![]}];}return db[_0x98ff('0x31')][_0x98ff('0x4a')](_0x3fa70c);})[_0x98ff('0x27')](function(_0x49dc32){_0x257722['rows']=_0x49dc32;return _0x257722;})[_0x98ff('0x27')](respondWithFilteredResult(_0x205d85,_0x3fa70c))['catch'](handleError(_0x205d85,null));};exports[_0x98ff('0x4b')]=function(_0x61d31d,_0xd3c5b0){var _0x1be690={'raw':![],'where':{'id':_0x61d31d[_0x98ff('0x4c')]['id']}},_0x2211b0={};_0x2211b0['model']=_[_0x98ff('0x37')](db[_0x98ff('0x31')][_0x98ff('0x32')]);_0x2211b0['query']=_[_0x98ff('0x37')](_0x61d31d[_0x98ff('0x36')]);_0x2211b0[_0x98ff('0x42')]=_[_0x98ff('0x38')](_0x2211b0[_0x98ff('0x3a')],_0x2211b0[_0x98ff('0x36')]);_0x1be690[_0x98ff('0x39')]=_[_0x98ff('0x38')](_0x2211b0[_0x98ff('0x3a')],qs[_0x98ff('0x3b')](_0x61d31d[_0x98ff('0x36')][_0x98ff('0x3b')]));_0x1be690[_0x98ff('0x39')]=_0x1be690[_0x98ff('0x39')][_0x98ff('0x3c')]?_0x1be690[_0x98ff('0x39')]:_0x2211b0['model'];if(_0x61d31d['query'][_0x98ff('0x48')]){_0x1be690['include']=[{'all':!![]}];}_0x1be690=_[_0x98ff('0x45')]({},_0x1be690,_0x61d31d[_0x98ff('0x47')]);return db[_0x98ff('0x31')][_0x98ff('0x4d')](_0x1be690)[_0x98ff('0x27')](handleEntityNotFound(_0xd3c5b0,null))[_0x98ff('0x27')](respondWithResult(_0xd3c5b0,null))[_0x98ff('0x4e')](handleError(_0xd3c5b0,null));};exports[_0x98ff('0x4f')]=function(_0x45ed50,_0x4dd8c3){return db[_0x98ff('0x31')]['create'](_0x45ed50[_0x98ff('0x50')],{})[_0x98ff('0x27')](function(_0x5e3283){var _0x1e62ec=_0x45ed50[_0x98ff('0x51')]['get']({'plain':!![]});if(!_0x1e62ec)throw new Error(_0x98ff('0x52'));if(_0x1e62ec[_0x98ff('0x53')]==='user'){var _0x21910b=_0x5e3283[_0x98ff('0x29')]({'plain':!![]});var _0x225dce=_0x98ff('0x54');return db[_0x98ff('0x55')][_0x98ff('0x4d')]({'where':{'name':_0x225dce,'userProfileId':_0x1e62ec['userProfileId']},'raw':!![]})[_0x98ff('0x27')](function(_0x41d3ad){if(_0x41d3ad&&_0x41d3ad[_0x98ff('0x56')]===0x0){return db[_0x98ff('0x57')][_0x98ff('0x4f')]({'name':_0x21910b[_0x98ff('0x2d')],'resourceId':_0x21910b['id'],'type':_0x98ff('0x58'),'sectionId':_0x41d3ad['id']},{})[_0x98ff('0x27')](function(){return _0x5e3283;});}else{return _0x5e3283;}})[_0x98ff('0x4e')](function(_0x2ef341){logger[_0x98ff('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef341);throw _0x2ef341;});}return _0x5e3283;})['then'](respondWithResult(_0x4dd8c3,0xc9))[_0x98ff('0x4e')](handleError(_0x4dd8c3,null));};exports[_0x98ff('0x59')]=function(_0x3fe60f,_0x2b9789){if(_0x3fe60f[_0x98ff('0x50')]['id']){delete _0x3fe60f[_0x98ff('0x50')]['id'];}return db[_0x98ff('0x31')][_0x98ff('0x4d')]({'where':{'id':_0x3fe60f[_0x98ff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b9789,null))[_0x98ff('0x27')](saveUpdates(_0x3fe60f[_0x98ff('0x50')],null))[_0x98ff('0x27')](respondWithResult(_0x2b9789,null))[_0x98ff('0x4e')](handleError(_0x2b9789,null));};exports[_0x98ff('0x28')]=function(_0x126ef9,_0x407fc8){return db[_0x98ff('0x31')][_0x98ff('0x4d')]({'where':{'id':_0x126ef9[_0x98ff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x407fc8,null))['then'](removeEntity(_0x407fc8,null))[_0x98ff('0x4e')](handleError(_0x407fc8,null));};exports[_0x98ff('0x5a')]=function(_0x56b10a,_0x302e7c){var _0x4d290c=0xa;var _0x4b9ae1=[_0x98ff('0x5b'),_0x98ff('0x5c'),'right_join','cross_join'];var _0x432081={'SUM':_0x98ff('0x5d'),'COUNT':_0x98ff('0x5e'),'COUNT DISTINCT':_0x98ff('0x5f'),'MAX':_0x98ff('0x60'),'MIN':'MIN(%s)','AVG':_0x98ff('0x61'),'GROUP_CONCAT':_0x98ff('0x62'),'GROUP_CONCAT ASC':_0x98ff('0x63'),'GROUP_CONCAT DESC':_0x98ff('0x64')};var _0x23479a={'SEC_TO_TIME':_0x98ff('0x65'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x98ff('0x66'),'UNIX_TIMESTAMP':_0x98ff('0x67')};var _0x369eae=function(_0x47eaf2){return!_[_0x98ff('0x68')]([_0x98ff('0x69'),_0x98ff('0x6a'),_0x98ff('0x6b'),_0x98ff('0x6c')],_0x47eaf2);};var _0x13572c=function(_0x40b3bc){if(!_0x40b3bc||!_0x40b3bc[_0x98ff('0x6d')]['length']){return'';}for(var _0x3467f1='(',_0x1d3bf6=0x0;_0x1d3bf6<_0x40b3bc['rules'][_0x98ff('0x3c')];_0x1d3bf6+=0x1){_0x1d3bf6>0x0&&(_0x3467f1+='\x20'+_0x40b3bc[_0x98ff('0x6e')]+'\x20');_0x3467f1+=_0x40b3bc[_0x98ff('0x6d')][_0x1d3bf6][_0x98ff('0x6f')]?_0x13572c(_0x40b3bc['rules'][_0x1d3bf6][_0x98ff('0x6f')]):_0x40b3bc['rules'][_0x1d3bf6]['field']+'\x20'+_0x40b3bc[_0x98ff('0x6d')][_0x1d3bf6][_0x98ff('0x70')]+(_0x369eae(_0x40b3bc[_0x98ff('0x6d')][_0x1d3bf6][_0x98ff('0x70')])?'\x20'+_0x40b3bc[_0x98ff('0x6d')][_0x1d3bf6][_0x98ff('0x71')]:'');}return _0x3467f1+')';};var _0x1809f4={'where':{'id':_0x56b10a['params']['id']}},_0x12bbb,_0x4880d2,_0x24ff5b,_0x173abc,_0x5894f1;_0x1809f4=_['merge']({},_0x1809f4,_0x56b10a[_0x98ff('0x47')]);return db['AnalyticCustomReport'][_0x98ff('0x4d')](_0x1809f4)[_0x98ff('0x27')](function(_0x367c77){if(_0x367c77){_0x12bbb=_0x367c77;return _0x367c77[_0x98ff('0x72')]();}return null;})[_0x98ff('0x27')](function(_0x3960e2){if(_0x3960e2){if(!_0x3960e2[_0x98ff('0x3c')]){throw new db[(_0x98ff('0x73'))][(_0x98ff('0x74'))](_0x98ff('0x75'),0x193);}_0x4880d2=_0x3960e2;return db[_0x98ff('0x76')][_0x98ff('0x4a')]({'raw':!![]});}return null;})[_0x98ff('0x27')](function(_0x4f27ed){if(_0x4f27ed){_0x24ff5b=_[_0x98ff('0x77')](_0x4f27ed,'id');var _0x4c8cc9;var _0x2d2c36=squel['select']();_0x2d2c36[_0x98ff('0x78')](_0x12bbb['table']);for(var _0x35f31e=0x0;_0x35f31e<_0x4880d2[_0x98ff('0x3c')];_0x35f31e+=0x1){_0x4c8cc9=_0x4880d2[_0x35f31e][_0x98ff('0x79')]?_0x24ff5b[_0x4880d2[_0x35f31e][_0x98ff('0x79')]]['metric']:_0x4880d2[_0x35f31e][_0x98ff('0x7a')];_0x4c8cc9=_0x4880d2[_0x35f31e][_0x98ff('0x7b')]?_[_0x98ff('0x7c')](_0x432081[_0x4880d2[_0x35f31e][_0x98ff('0x7b')]],'%s',_0x4c8cc9):_0x4c8cc9;_0x4c8cc9=_0x4880d2[_0x35f31e]['format']?_['replace'](_0x23479a[_0x4880d2[_0x35f31e]['format']],'%s',_0x4c8cc9):_0x4c8cc9;if(_0x4880d2[_0x35f31e][_0x98ff('0x7d')]){_0x2d2c36[_0x98ff('0x6f')](_0x4c8cc9);}_0x4880d2[_0x35f31e][_0x98ff('0x7e')]&&_0x2d2c36[_0x98ff('0x3f')](_0x4c8cc9,_0x4880d2[_0x35f31e][_0x98ff('0x7e')]==='DESC'?![]:!![]);_0x2d2c36[_0x98ff('0x7a')](_0x4c8cc9,_0x4880d2[_0x35f31e][_0x98ff('0x7f')]||_0x4c8cc9);}if(_0x12bbb[_0x98ff('0x80')]){_0x12bbb[_0x98ff('0x80')]=JSON[_0x98ff('0x81')](_0x12bbb['joins']);for(var _0x20c845=0x0;_0x20c845<_0x12bbb['joins']['length'];_0x20c845+=0x1){if(_0x12bbb[_0x98ff('0x80')][_0x20c845][_0x98ff('0x34')]&&_[_0x98ff('0x68')](_0x4b9ae1,_0x12bbb[_0x98ff('0x80')][_0x20c845][_0x98ff('0x34')])&&_0x12bbb['joins'][_0x20c845][_0x98ff('0x82')]&&_0x12bbb['joins'][_0x20c845]['foreignTable']&&_0x12bbb[_0x98ff('0x80')][_0x20c845][_0x98ff('0x83')]){_0x2d2c36[_0x12bbb[_0x98ff('0x80')][_0x20c845]['type']](_0x12bbb[_0x98ff('0x80')][_0x20c845][_0x98ff('0x84')],null,util[_0x98ff('0x85')](_0x98ff('0x86'),_0x12bbb[_0x98ff('0x87')],_0x12bbb[_0x98ff('0x80')][_0x20c845][_0x98ff('0x82')],_0x12bbb['joins'][_0x20c845][_0x98ff('0x84')],_0x12bbb['joins'][_0x20c845]['foreignKey']));}}}if(_0x12bbb[_0x98ff('0x88')]){_0x12bbb[_0x98ff('0x88')]=JSON[_0x98ff('0x81')](_0x12bbb[_0x98ff('0x88')]);_0x2d2c36[_0x98ff('0x44')](_0x13572c(_0x12bbb[_0x98ff('0x88')][_0x98ff('0x6f')]));}_0x5894f1=_0x2d2c36[_0x98ff('0x89')]();_0x2d2c36[_0x98ff('0x1f')](_0x4d290c);_0x2d2c36[_0x98ff('0x1d')](0x0);logger['debug'](_0x98ff('0x8a'),_0x2d2c36[_0x98ff('0x8b')]());return dbH[_0x98ff('0x8c')]['query'](_0x2d2c36[_0x98ff('0x8b')](),{'type':dbH[_0x98ff('0x8c')][_0x98ff('0x8d')]['SELECT']});}})[_0x98ff('0x27')](respondWithResult(_0x302e7c,null))[_0x98ff('0x4e')](handleError(_0x302e7c,null));};function runReport(_0x41ca49,_0x39bfa4,_0x184005){var _0x2014ab=_0x39bfa4[_0x98ff('0x2d')];var _0x93ea98=0xa;var _0x4b847f=[_0x98ff('0x5b'),_0x98ff('0x5c'),_0x98ff('0x8e'),'cross_join'];var _0x5c388c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x98ff('0x60'),'MIN':_0x98ff('0x8f'),'AVG':_0x98ff('0x61'),'GROUP_CONCAT':_0x98ff('0x62'),'GROUP_CONCAT ASC':_0x98ff('0x63'),'GROUP_CONCAT DESC':_0x98ff('0x64')};var _0x5ac776={'SEC_TO_TIME':_0x98ff('0x65'),'DATE':_0x98ff('0x90'),'HOUR':_0x98ff('0x91'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x591239=function(_0x8f0813){return!_['includes']([_0x98ff('0x69'),_0x98ff('0x6a'),_0x98ff('0x6b'),_0x98ff('0x6c')],_0x8f0813);};var _0x52e8af=function(_0x5279de){if(!_0x5279de||!_0x5279de['rules']['length']){return'';}for(var _0x235042='(',_0x7f8e80=0x0;_0x7f8e80<_0x5279de[_0x98ff('0x6d')][_0x98ff('0x3c')];_0x7f8e80+=0x1){_0x7f8e80>0x0&&(_0x235042+='\x20'+_0x5279de[_0x98ff('0x6e')]+'\x20');_0x235042+=_0x5279de[_0x98ff('0x6d')][_0x7f8e80][_0x98ff('0x6f')]?_0x52e8af(_0x5279de['rules'][_0x7f8e80][_0x98ff('0x6f')]):_0x5279de['rules'][_0x7f8e80][_0x98ff('0x7a')]+'\x20'+_0x5279de['rules'][_0x7f8e80][_0x98ff('0x70')]+(_0x591239(_0x5279de['rules'][_0x7f8e80][_0x98ff('0x70')])?'\x20'+_0x5279de[_0x98ff('0x6d')][_0x7f8e80]['value']:'');}return _0x235042+')';};var _0x528cb3={'where':{'id':_0x41ca49['id']}},_0x39fab1,_0x527d68,_0x2bc84f,_0x358fb6,_0x19dd5d;_0x528cb3=_[_0x98ff('0x45')]({},_0x528cb3,_0x184005);return db[_0x98ff('0x31')][_0x98ff('0x4d')](_0x528cb3)['then'](function(_0x5b9a6d){if(_0x5b9a6d){_0x39fab1=_0x5b9a6d;return _0x5b9a6d[_0x98ff('0x72')]();}return null;})[_0x98ff('0x27')](function(_0x4326fd){if(_0x4326fd){if(!_0x4326fd[_0x98ff('0x3c')]){throw new db[(_0x98ff('0x73'))][(_0x98ff('0x74'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x527d68=_0x4326fd;return db['AnalyticMetric'][_0x98ff('0x4a')]({'raw':!![]});}return null;})[_0x98ff('0x27')](function(_0x8b1ee1){if(_0x8b1ee1){_0x2bc84f=_[_0x98ff('0x77')](_0x8b1ee1,'id');var _0x468157;var _0x30de9b=squel[_0x98ff('0x92')]();_0x30de9b[_0x98ff('0x78')](_0x39fab1['table']);for(var _0x425de1=0x0;_0x425de1<_0x527d68['length'];_0x425de1+=0x1){_0x468157=_0x527d68[_0x425de1][_0x98ff('0x79')]?_0x2bc84f[_0x527d68[_0x425de1][_0x98ff('0x79')]]['metric']:_0x527d68[_0x425de1][_0x98ff('0x7a')];_0x468157=_0x527d68[_0x425de1][_0x98ff('0x7b')]?_[_0x98ff('0x7c')](_0x5c388c[_0x527d68[_0x425de1][_0x98ff('0x7b')]],'%s',_0x468157):_0x468157;_0x468157=_0x527d68[_0x425de1][_0x98ff('0x85')]?_[_0x98ff('0x7c')](_0x5ac776[_0x527d68[_0x425de1][_0x98ff('0x85')]],'%s',_0x468157):_0x468157;if(_0x527d68[_0x425de1][_0x98ff('0x7d')]){_0x30de9b[_0x98ff('0x6f')](_0x468157);}_0x527d68[_0x425de1][_0x98ff('0x7e')]&&_0x30de9b[_0x98ff('0x3f')](_0x468157,_0x527d68[_0x425de1]['orderBy']==='DESC'?![]:!![]);_0x30de9b[_0x98ff('0x7a')](_0x468157,_0x527d68[_0x425de1][_0x98ff('0x7f')]||_0x468157);}if(_0x39fab1['joins']){_0x39fab1['joins']=JSON['parse'](_0x39fab1['joins']);for(var _0x44f052=0x0;_0x44f052<_0x39fab1[_0x98ff('0x80')][_0x98ff('0x3c')];_0x44f052+=0x1){if(_0x39fab1[_0x98ff('0x80')][_0x44f052][_0x98ff('0x34')]&&_[_0x98ff('0x68')](_0x4b847f,_0x39fab1[_0x98ff('0x80')][_0x44f052][_0x98ff('0x34')])&&_0x39fab1[_0x98ff('0x80')][_0x44f052][_0x98ff('0x82')]&&_0x39fab1['joins'][_0x44f052][_0x98ff('0x84')]&&_0x39fab1[_0x98ff('0x80')][_0x44f052][_0x98ff('0x83')]){_0x30de9b[_0x39fab1[_0x98ff('0x80')][_0x44f052]['type']](_0x39fab1[_0x98ff('0x80')][_0x44f052][_0x98ff('0x84')],null,util['format'](_0x98ff('0x86'),_0x39fab1[_0x98ff('0x87')],_0x39fab1['joins'][_0x44f052][_0x98ff('0x82')],_0x39fab1[_0x98ff('0x80')][_0x44f052][_0x98ff('0x84')],_0x39fab1[_0x98ff('0x80')][_0x44f052][_0x98ff('0x83')]));}}}if(_0x39fab1[_0x98ff('0x88')]){_0x39fab1['conditions']=JSON[_0x98ff('0x81')](_0x39fab1['conditions']);_0x30de9b['where'](_0x52e8af(_0x39fab1[_0x98ff('0x88')][_0x98ff('0x6f')]));}_0x19dd5d=_0x30de9b[_0x98ff('0x89')]();_0x30de9b['limit'](_0x93ea98);_0x30de9b['offset'](0x0);return;}})[_0x98ff('0x27')](function(){if(_0x39bfa4[_0x98ff('0x93')]===_0x98ff('0x94')){return null;}var _0x12fa2a=_[_0x98ff('0x45')](_0x39bfa4,{'name':_0x39bfa4[_0x98ff('0x95')]||_0x39bfa4[_0x98ff('0x2d')]||_0x39fab1[_0x98ff('0x2d')],'basename':_0x2014ab,'savename':util[_0x98ff('0x85')]('%s-%s.%s',_0x39bfa4['name']||_0x39fab1['name'],require(_0x98ff('0x96'))[_0x98ff('0x97')](0x4),_0x39bfa4[_0x98ff('0x93')]||_0x98ff('0x98')),'reportId':_0x39fab1['id'],'reportType':_0x98ff('0x99')});return db[_0x98ff('0x9a')][_0x98ff('0x4f')](_0x12fa2a,{'raw':!![]});})['then'](function(_0x80d1e8){if(_0x39fab1[_0x98ff('0x87')]===_0x98ff('0x9b')){_0x19dd5d['where'](_0x39fab1[_0x98ff('0x87')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x39bfa4['startDate'],_0x39bfa4[_0x98ff('0x9c')]);}else{_0x19dd5d[_0x98ff('0x44')](_0x39fab1[_0x98ff('0x87')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x39bfa4[_0x98ff('0x9d')],_0x39bfa4[_0x98ff('0x9c')]);}if(_0x80d1e8){logger[_0x98ff('0x9e')](_0x98ff('0x9f'),_0x19dd5d['toString']());require('child_process')[_0x98ff('0xa0')](path['join'](__dirname,_0x98ff('0xa1'),_0x80d1e8[_0x98ff('0x93')]),[_0x80d1e8['id'],_0x19dd5d['toString'](),path[_0x98ff('0x5b')](__dirname,_0x98ff('0xa2'),_0x80d1e8[_0x98ff('0xa3')]),_0x2014ab]);return _0x80d1e8;}else{var _0x5b9d5b=squel[_0x98ff('0x92')]();_0x5b9d5b[_0x98ff('0x78')]('('+_0x19dd5d['toString']()+')',_0x98ff('0xa4'));_0x5b9d5b[_0x98ff('0x7a')](_0x98ff('0xa5'),_0x98ff('0x20'));_0x19dd5d[_0x98ff('0x1f')](_0x39bfa4[_0x98ff('0x1f')]||_0x93ea98);_0x19dd5d[_0x98ff('0x1d')](_0x39bfa4[_0x98ff('0x1d')]||0x0);return dbH[_0x98ff('0x8c')][_0x98ff('0x36')](_0x5b9d5b[_0x98ff('0x8b')](),{'type':dbH[_0x98ff('0x8c')][_0x98ff('0x8d')]['SELECT']})[_0x98ff('0x27')](function(_0x38c46d){if(!_0x38c46d[_0x98ff('0x3c')]){_0x358fb6=0x0;}else{_0x358fb6=_0x38c46d[0x0][_0x98ff('0x20')]||0x0;}return dbH[_0x98ff('0x8c')][_0x98ff('0x36')](_0x19dd5d[_0x98ff('0x8b')](),{'type':dbH[_0x98ff('0x8c')][_0x98ff('0x8d')][_0x98ff('0xa6')]});})[_0x98ff('0x27')](function(_0x196d19){return{'rows':_0x196d19||[],'count':_0x358fb6};});}});}exports[_0x98ff('0xa7')]=function(_0x2d42e1,_0x523171){return runReport(_0x2d42e1[_0x98ff('0x4c')],_0x2d42e1['query'],_0x2d42e1[_0x98ff('0x47')])[_0x98ff('0x27')](respondWithResult(_0x523171,null))[_0x98ff('0x4e')](handleError(_0x523171,null));};exports[_0x98ff('0xa8')]=runReport;exports[_0x98ff('0x36')]=function(_0x1d9892,_0x2b29b4){var _0x46e9d1=0xa;var _0x4bc94a=['join',_0x98ff('0x5c'),'right_join','cross_join'];var _0x11041d={'SUM':_0x98ff('0x5d'),'COUNT':_0x98ff('0x5e'),'COUNT DISTINCT':_0x98ff('0x5f'),'MAX':_0x98ff('0x60'),'MIN':_0x98ff('0x8f'),'AVG':_0x98ff('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x98ff('0x63'),'GROUP_CONCAT DESC':_0x98ff('0x64')};var _0x4d8e2e={'SEC_TO_TIME':_0x98ff('0x65'),'DATE':_0x98ff('0x90'),'HOUR':'HOUR(%s)','ROUND':_0x98ff('0x66'),'UNIX_TIMESTAMP':_0x98ff('0x67')};var _0x472582=function(_0x332ed2){return!_[_0x98ff('0x68')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x98ff('0x6b'),_0x98ff('0x6c')],_0x332ed2);};var _0x4dd1c8=function(_0x3015fa){if(!_0x3015fa||!_0x3015fa[_0x98ff('0x6d')][_0x98ff('0x3c')]){return'';}for(var _0x355094='(',_0xfb5b5a=0x0;_0xfb5b5a<_0x3015fa[_0x98ff('0x6d')][_0x98ff('0x3c')];_0xfb5b5a+=0x1){_0xfb5b5a>0x0&&(_0x355094+='\x20'+_0x3015fa['operator']+'\x20');_0x355094+=_0x3015fa['rules'][_0xfb5b5a]['group']?_0x4dd1c8(_0x3015fa[_0x98ff('0x6d')][_0xfb5b5a][_0x98ff('0x6f')]):_0x3015fa[_0x98ff('0x6d')][_0xfb5b5a][_0x98ff('0x7a')]+'\x20'+_0x3015fa[_0x98ff('0x6d')][_0xfb5b5a][_0x98ff('0x70')]+(_0x472582(_0x3015fa[_0x98ff('0x6d')][_0xfb5b5a][_0x98ff('0x70')])?'\x20'+_0x3015fa[_0x98ff('0x6d')][_0xfb5b5a]['value']:'');}return _0x355094+')';};var _0x32e286={'where':{'id':_0x1d9892[_0x98ff('0x4c')]['id']}},_0x59ff1b,_0x502ac3,_0x4443b4,_0x19048b,_0x5d74aa;_0x32e286=_['merge']({},_0x32e286,_0x1d9892['options']);return db['AnalyticCustomReport'][_0x98ff('0x4d')](_0x32e286)[_0x98ff('0x27')](function(_0xb965dd){if(_0xb965dd){_0x59ff1b=_0xb965dd;return _0xb965dd[_0x98ff('0x72')]();}return null;})[_0x98ff('0x27')](function(_0x19e769){if(_0x19e769){if(!_0x19e769[_0x98ff('0x3c')]){throw new db['Sequelize'][(_0x98ff('0x74'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x502ac3=_0x19e769;return db[_0x98ff('0x76')][_0x98ff('0x4a')]({'raw':!![]});}return null;})[_0x98ff('0x27')](function(_0x1dccd1){if(_0x1dccd1){_0x4443b4=_['keyBy'](_0x1dccd1,'id');var _0x37068d;var _0x9268f6=squel['select']();_0x9268f6['from'](_0x59ff1b[_0x98ff('0x87')]);for(var _0x57211a=0x0;_0x57211a<_0x502ac3[_0x98ff('0x3c')];_0x57211a+=0x1){_0x37068d=_0x502ac3[_0x57211a][_0x98ff('0x79')]?_0x4443b4[_0x502ac3[_0x57211a]['MetricId']][_0x98ff('0xa9')]:_0x502ac3[_0x57211a][_0x98ff('0x7a')];_0x37068d=_0x502ac3[_0x57211a]['function']?_[_0x98ff('0x7c')](_0x11041d[_0x502ac3[_0x57211a]['function']],'%s',_0x37068d):_0x37068d;_0x37068d=_0x502ac3[_0x57211a][_0x98ff('0x85')]?_[_0x98ff('0x7c')](_0x4d8e2e[_0x502ac3[_0x57211a][_0x98ff('0x85')]],'%s',_0x37068d):_0x37068d;if(_0x502ac3[_0x57211a]['groupBy']){_0x9268f6[_0x98ff('0x6f')](_0x37068d);}_0x502ac3[_0x57211a]['orderBy']&&_0x9268f6[_0x98ff('0x3f')](_0x37068d,_0x502ac3[_0x57211a][_0x98ff('0x7e')]===_0x98ff('0xaa')?![]:!![]);_0x9268f6[_0x98ff('0x7a')](_0x37068d,_0x502ac3[_0x57211a][_0x98ff('0x7f')]||_0x37068d);}if(_0x59ff1b[_0x98ff('0x80')]){_0x59ff1b['joins']=JSON[_0x98ff('0x81')](_0x59ff1b['joins']);for(var _0x2d0755=0x0;_0x2d0755<_0x59ff1b['joins']['length'];_0x2d0755+=0x1){if(_0x59ff1b['joins'][_0x2d0755]['type']&&_[_0x98ff('0x68')](_0x4bc94a,_0x59ff1b['joins'][_0x2d0755][_0x98ff('0x34')])&&_0x59ff1b[_0x98ff('0x80')][_0x2d0755][_0x98ff('0x82')]&&_0x59ff1b[_0x98ff('0x80')][_0x2d0755][_0x98ff('0x84')]&&_0x59ff1b['joins'][_0x2d0755][_0x98ff('0x83')]){_0x9268f6[_0x59ff1b[_0x98ff('0x80')][_0x2d0755]['type']](_0x59ff1b[_0x98ff('0x80')][_0x2d0755][_0x98ff('0x84')],null,util[_0x98ff('0x85')](_0x98ff('0x86'),_0x59ff1b[_0x98ff('0x87')],_0x59ff1b['joins'][_0x2d0755]['parentKey'],_0x59ff1b[_0x98ff('0x80')][_0x2d0755]['foreignTable'],_0x59ff1b[_0x98ff('0x80')][_0x2d0755]['foreignKey']));}}}if(_0x59ff1b[_0x98ff('0x88')]){_0x59ff1b[_0x98ff('0x88')]=JSON[_0x98ff('0x81')](_0x59ff1b['conditions']);_0x9268f6[_0x98ff('0x44')](_0x4dd1c8(_0x59ff1b[_0x98ff('0x88')][_0x98ff('0x6f')]));}_0x5d74aa=_0x9268f6[_0x98ff('0x89')]();_0x9268f6[_0x98ff('0x1f')](_0x46e9d1);_0x9268f6[_0x98ff('0x1d')](0x0);logger[_0x98ff('0xab')]('Limited\x20Query:',_0x9268f6['toString']());return dbH[_0x98ff('0x8c')][_0x98ff('0x36')](_0x9268f6['toString'](),{'type':dbH['sequelize'][_0x98ff('0x8d')][_0x98ff('0xa6')]});}})[_0x98ff('0x27')](function(){return{'sql':_0x5d74aa['toString']()};})[_0x98ff('0x27')](respondWithResult(_0x2b29b4,null))['catch'](handleError(_0x2b29b4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index dd0c066..abc95f7 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 _0x0d24=['path','rimraf','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4e6fcc,_0x1c31e9){var _0x365502=function(_0x352d72){while(--_0x352d72){_0x4e6fcc['push'](_0x4e6fcc['shift']());}};_0x365502(++_0x1c31e9);}(_0x0d24,0x186));var _0x40d2=function(_0x1c5cc7,_0x1e6d3b){_0x1c5cc7=_0x1c5cc7-0x0;var _0x2e34fc=_0x0d24[_0x1c5cc7];return _0x2e34fc;};'use strict';var _=require(_0x40d2('0x0'));var util=require(_0x40d2('0x1'));var logger=require(_0x40d2('0x2'))(_0x40d2('0x3'));var moment=require(_0x40d2('0x4'));var BPromise=require(_0x40d2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40d2('0x6'));var rimraf=require(_0x40d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x40d2('0x8'));module['exports']=function(_0x1f50e5,_0x532bef){return _0x1f50e5[_0x40d2('0x9')](_0x40d2('0xa'),attributes,{'tableName':_0x40d2('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7d2=['path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x27413c,_0xe7e75a){var _0x5ec999=function(_0x438dd6){while(--_0x438dd6){_0x27413c['push'](_0x27413c['shift']());}};_0x5ec999(++_0xe7e75a);}(_0xd7d2,0xf7));var _0x2d7d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd7d2[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2d7d('0x0'));var util=require('util');var logger=require(_0x2d7d('0x1'))('api');var moment=require(_0x2d7d('0x2'));var BPromise=require(_0x2d7d('0x3'));var rp=require(_0x2d7d('0x4'));var fs=require('fs');var path=require(_0x2d7d('0x5'));var rimraf=require(_0x2d7d('0x6'));var config=require(_0x2d7d('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x2d7d('0x8')]=function(_0x45e87e,_0x14f6fe){return _0x45e87e[_0x2d7d('0x9')](_0x2d7d('0xa'),attributes,{'tableName':_0x2d7d('0xb'),'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 c8996e0..063fa60 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 _0x878d=['error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ab045,_0x5e7e11){var _0x3fe545=function(_0x29308c){while(--_0x29308c){_0x2ab045['push'](_0x2ab045['shift']());}};_0x3fe545(++_0x5e7e11);}(_0x878d,0x9c));var _0xd878=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x878d[_0x23f8c8];return _0x3dc718;};'use strict';var _=require(_0xd878('0x0'));var util=require(_0xd878('0x1'));var moment=require(_0xd878('0x2'));var BPromise=require(_0xd878('0x3'));var rs=require(_0xd878('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd878('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd878('0x6'))(_0xd878('0x7'));var config=require(_0xd878('0x8'));var jayson=require(_0xd878('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17be9b,_0x151208,_0x46088e){return new BPromise(function(_0xaf62f,_0x2556db){return client['request'](_0x17be9b,_0x46088e)[_0xd878('0xa')](function(_0x572095){logger[_0xd878('0xb')](_0xd878('0xc'),_0x151208,_0xd878('0xd'));logger[_0xd878('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x151208,_0xd878('0xd'),JSON['stringify'](_0x572095));if(_0x572095[_0xd878('0xf')]){if(_0x572095['error'][_0xd878('0x10')]===0x1f4){logger['error'](_0xd878('0xc'),_0x151208,_0x572095[_0xd878('0xf')]['message']);return _0x2556db(_0x572095[_0xd878('0xf')][_0xd878('0x11')]);}logger[_0xd878('0xf')](_0xd878('0xc'),_0x151208,_0x572095['error']['message']);return _0xaf62f(_0x572095[_0xd878('0xf')]['message']);}else{logger[_0xd878('0xb')](_0xd878('0xc'),_0x151208,_0xd878('0xd'));_0xaf62f(_0x572095[_0xd878('0x12')]['message']);}})['catch'](function(_0xbc9a24){logger['error'](_0xd878('0xc'),_0x151208,_0xbc9a24);_0x2556db(_0xbc9a24);});});} \ No newline at end of file +var _0x9240=['stringify','error','code','message','info','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x9f0422,_0x4fbfed){var _0x46e1f4=function(_0x28b147){while(--_0x28b147){_0x9f0422['push'](_0x9f0422['shift']());}};_0x46e1f4(++_0x4fbfed);}(_0x9240,0x157));var _0x0924=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9240[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0x0924('0x0'));var moment=require('moment');var BPromise=require(_0x0924('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0924('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0924('0x3'));var logger=require(_0x0924('0x4'))('rpc');var config=require(_0x0924('0x5'));var jayson=require(_0x0924('0x6'));var client=jayson[_0x0924('0x7')][_0x0924('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bf614,_0x4b4a28,_0x558b4b){return new BPromise(function(_0x4722cd,_0x329ca7){return client['request'](_0x2bf614,_0x558b4b)[_0x0924('0x9')](function(_0xdf8d6c){logger['info'](_0x0924('0xa'),_0x4b4a28,_0x0924('0xb'));logger[_0x0924('0xc')](_0x0924('0xd'),_0x4b4a28,_0x0924('0xb'),JSON[_0x0924('0xe')](_0xdf8d6c));if(_0xdf8d6c[_0x0924('0xf')]){if(_0xdf8d6c[_0x0924('0xf')][_0x0924('0x10')]===0x1f4){logger[_0x0924('0xf')](_0x0924('0xa'),_0x4b4a28,_0xdf8d6c[_0x0924('0xf')][_0x0924('0x11')]);return _0x329ca7(_0xdf8d6c[_0x0924('0xf')][_0x0924('0x11')]);}logger[_0x0924('0xf')](_0x0924('0xa'),_0x4b4a28,_0xdf8d6c['error']['message']);return _0x4722cd(_0xdf8d6c[_0x0924('0xf')]['message']);}else{logger[_0x0924('0x12')](_0x0924('0xa'),_0x4b4a28,_0x0924('0xb'));_0x4722cd(_0xdf8d6c[_0x0924('0x13')][_0x0924('0x11')]);}})[_0x0924('0x14')](function(_0x2876c4){logger[_0x0924('0xf')](_0x0924('0xa'),_0x4b4a28,_0x2876c4);_0x329ca7(_0x2876c4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7992979..7357b73 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 _0x9d99=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','query','post','create','update','destroy'];(function(_0x5ecab7,_0x3bccce){var _0x284022=function(_0x148eca){while(--_0x148eca){_0x5ecab7['push'](_0x5ecab7['shift']());}};_0x284022(++_0x3bccce);}(_0x9d99,0xe6));var _0x99d9=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x9d99[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require(_0x99d9('0x0'));var util=require(_0x99d9('0x1'));var path=require(_0x99d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x99d9('0x3'));var router=express[_0x99d9('0x4')]();var fs_extra=require(_0x99d9('0x5'));var auth=require(_0x99d9('0x6'));var interaction=require(_0x99d9('0x7'));var config=require(_0x99d9('0x8'));var controller=require(_0x99d9('0x9'));router[_0x99d9('0xa')]('/',auth[_0x99d9('0xb')](),controller[_0x99d9('0xc')]);router[_0x99d9('0xa')](_0x99d9('0xd'),auth[_0x99d9('0xb')](),controller[_0x99d9('0xe')]);router[_0x99d9('0xa')](_0x99d9('0xf'),auth['isAuthenticated'](),controller[_0x99d9('0x10')]);router[_0x99d9('0xa')](_0x99d9('0x11'),auth[_0x99d9('0xb')](),controller['run']);router[_0x99d9('0xa')]('/:id/query',auth[_0x99d9('0xb')](),controller[_0x99d9('0x12')]);router[_0x99d9('0x13')]('/',auth[_0x99d9('0xb')](),controller[_0x99d9('0x14')]);router['put'](_0x99d9('0xd'),auth[_0x99d9('0xb')](),controller[_0x99d9('0x15')]);router['delete'](_0x99d9('0xd'),auth['isAuthenticated'](),controller[_0x99d9('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7f89=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/query','query','create','put','update'];(function(_0x48ce62,_0x35eea5){var _0x528571=function(_0x134d2e){while(--_0x134d2e){_0x48ce62['push'](_0x48ce62['shift']());}};_0x528571(++_0x35eea5);}(_0x7f89,0x117));var _0x97f8=function(_0x403ca4,_0x459190){_0x403ca4=_0x403ca4-0x0;var _0x4a5338=_0x7f89[_0x403ca4];return _0x4a5338;};'use strict';var multer=require(_0x97f8('0x0'));var util=require(_0x97f8('0x1'));var path=require(_0x97f8('0x2'));var timeout=require(_0x97f8('0x3'));var express=require('express');var router=express[_0x97f8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x97f8('0x5'));var interaction=require(_0x97f8('0x6'));var config=require(_0x97f8('0x7'));var controller=require(_0x97f8('0x8'));router[_0x97f8('0x9')]('/',auth[_0x97f8('0xa')](),controller[_0x97f8('0xb')]);router['get'](_0x97f8('0xc'),auth[_0x97f8('0xa')](),controller[_0x97f8('0xd')]);router[_0x97f8('0x9')](_0x97f8('0xe'),auth[_0x97f8('0xa')](),controller['preview']);router[_0x97f8('0x9')]('/:id/run',auth[_0x97f8('0xa')](),controller['run']);router['get'](_0x97f8('0xf'),auth[_0x97f8('0xa')](),controller[_0x97f8('0x10')]);router['post']('/',auth[_0x97f8('0xa')](),controller[_0x97f8('0x11')]);router[_0x97f8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x97f8('0x13')]);router[_0x97f8('0x14')](_0x97f8('0xc'),auth[_0x97f8('0xa')](),controller[_0x97f8('0x15')]);module[_0x97f8('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index bb787cd..4a4b915 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 _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x2ef49b,_0x9661a7){var _0x663f4b=function(_0x336a7a){while(--_0x336a7a){_0x2ef49b['push'](_0x2ef49b['shift']());}};_0x663f4b(++_0x9661a7);}(_0xac9d,0x14d));var _0xdac9=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xac9d[_0x71e493];return _0x3d40ab;};'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 +var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x5da4f6,_0x1dc161){var _0x400b18=function(_0x3a4785){while(--_0x3a4785){_0x5da4f6['push'](_0x5da4f6['shift']());}};_0x400b18(++_0x1dc161);}(_0xd8fb,0x99));var _0xbd8f=function(_0x25c9c6,_0x5c5506){_0x25c9c6=_0x25c9c6-0x0;var _0x542336=_0xd8fb[_0x25c9c6];return _0x542336;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 304b4e4..380a155 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x2ef3,0xba));var _0x32ef=function(_0x10a131,_0x54b78c){_0x10a131=_0x10a131-0x0;var _0xe0f9e9=_0x2ef3[_0x10a131];return _0xe0f9e9;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','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)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x152196,_0x4d4dfe){var _0xf894d1=function(_0xa446f6){while(--_0xa446f6){_0x152196['push'](_0x152196['shift']());}};_0xf894d1(++_0x4d4dfe);}(_0xda19,0xd5));var _0x9da1=function(_0x2d44fc,_0x3b62d3){_0x2d44fc=_0x2d44fc-0x0;var _0x40b695=_0xda19[_0x2d44fc];return _0x40b695;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 7a0a5e9..e43b71f 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 _0xe0ba=['../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x562fc8,_0x2ff988){var _0x4b42d8=function(_0x4dde26){while(--_0x4dde26){_0x562fc8['push'](_0x562fc8['shift']());}};_0x4b42d8(++_0x2ff988);}(_0xe0ba,0x180));var _0xae0b=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xe0ba[_0x1b7368];return _0x25d54c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae0b('0x0'))(_0xae0b('0x1'));var moment=require(_0xae0b('0x2'));var BPromise=require(_0xae0b('0x3'));var rp=require(_0xae0b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae0b('0x5'));var config=require(_0xae0b('0x6'));var attributes=require(_0xae0b('0x7'));module['exports']=function(_0xf6b747,_0x38ee1e){return _0xf6b747[_0xae0b('0x8')](_0xae0b('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3313=['moment','bluebird','request-promise','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x3313,0xef));var _0x3331=function(_0x5d9722,_0xda2268){_0x5d9722=_0x5d9722-0x0;var _0x455dca=_0x3313[_0x5d9722];return _0x455dca;};'use strict';var _=require(_0x3331('0x0'));var util=require('util');var logger=require(_0x3331('0x1'))(_0x3331('0x2'));var moment=require(_0x3331('0x3'));var BPromise=require(_0x3331('0x4'));var rp=require(_0x3331('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3331('0x6'));var attributes=require(_0x3331('0x7'));module['exports']=function(_0x15910b,_0x3612e){return _0x15910b[_0x3331('0x8')](_0x3331('0x9'),attributes,{'tableName':_0x3331('0xa'),'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 c27f607..48f7821 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 _0xdfa9=['AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error'];(function(_0x471edc,_0x26a5f1){var _0x258c5d=function(_0x4e72d3){while(--_0x4e72d3){_0x471edc['push'](_0x471edc['shift']());}};_0x258c5d(++_0x26a5f1);}(_0xdfa9,0x96));var _0x9dfa=function(_0x5d72e4,_0x5a4786){_0x5d72e4=_0x5d72e4-0x0;var _0x3e2e58=_0xdfa9[_0x5d72e4];return _0x3e2e58;};'use strict';var _=require(_0x9dfa('0x0'));var util=require(_0x9dfa('0x1'));var moment=require(_0x9dfa('0x2'));var BPromise=require(_0x9dfa('0x3'));var rs=require(_0x9dfa('0x4'));var fs=require('fs');var Redis=require(_0x9dfa('0x5'));var db=require(_0x9dfa('0x6'))['db'];var utils=require(_0x9dfa('0x7'));var logger=require(_0x9dfa('0x8'))('rpc');var config=require(_0x9dfa('0x9'));var jayson=require(_0x9dfa('0xa'));var client=jayson['client'][_0x9dfa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ac6a3,_0x373c6c,_0x560953){return new BPromise(function(_0x23caf1,_0x382df2){return client[_0x9dfa('0xc')](_0x4ac6a3,_0x560953)[_0x9dfa('0xd')](function(_0x3c940f){logger[_0x9dfa('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x373c6c,_0x9dfa('0xf'));logger[_0x9dfa('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x373c6c,_0x9dfa('0xf'),JSON['stringify'](_0x3c940f));if(_0x3c940f[_0x9dfa('0x11')]){if(_0x3c940f['error']['code']===0x1f4){logger[_0x9dfa('0x11')](_0x9dfa('0x12'),_0x373c6c,_0x3c940f[_0x9dfa('0x11')]['message']);return _0x382df2(_0x3c940f['error'][_0x9dfa('0x13')]);}logger[_0x9dfa('0x11')](_0x9dfa('0x12'),_0x373c6c,_0x3c940f[_0x9dfa('0x11')][_0x9dfa('0x13')]);return _0x23caf1(_0x3c940f[_0x9dfa('0x11')]['message']);}else{logger[_0x9dfa('0xe')](_0x9dfa('0x12'),_0x373c6c,_0x9dfa('0xf'));_0x23caf1(_0x3c940f[_0x9dfa('0x14')][_0x9dfa('0x13')]);}})['catch'](function(_0x535f2a){logger['error'](_0x9dfa('0x12'),_0x373c6c,_0x535f2a);_0x382df2(_0x535f2a);});});} \ No newline at end of file +var _0x447e=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x533daf,_0x19a7bf){var _0x3c161f=function(_0x521824){while(--_0x521824){_0x533daf['push'](_0x533daf['shift']());}};_0x3c161f(++_0x19a7bf);}(_0x447e,0x122));var _0xe447=function(_0x5b12ad,_0x46fb77){_0x5b12ad=_0x5b12ad-0x0;var _0x3f5403=_0x447e[_0x5b12ad];return _0x3f5403;};'use strict';var _=require(_0xe447('0x0'));var util=require(_0xe447('0x1'));var moment=require(_0xe447('0x2'));var BPromise=require(_0xe447('0x3'));var rs=require(_0xe447('0x4'));var fs=require('fs');var Redis=require(_0xe447('0x5'));var db=require(_0xe447('0x6'))['db'];var utils=require(_0xe447('0x7'));var logger=require(_0xe447('0x8'))('rpc');var config=require(_0xe447('0x9'));var jayson=require(_0xe447('0xa'));var client=jayson[_0xe447('0xb')][_0xe447('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ebd00,_0x3768e4,_0x33dfcf){return new BPromise(function(_0xe3687f,_0x515f87){return client[_0xe447('0xd')](_0x1ebd00,_0x33dfcf)[_0xe447('0xe')](function(_0x3364e8){logger['info'](_0xe447('0xf'),_0x3768e4,_0xe447('0x10'));logger[_0xe447('0x11')](_0xe447('0x12'),_0x3768e4,_0xe447('0x10'),JSON[_0xe447('0x13')](_0x3364e8));if(_0x3364e8['error']){if(_0x3364e8[_0xe447('0x14')][_0xe447('0x15')]===0x1f4){logger[_0xe447('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3768e4,_0x3364e8[_0xe447('0x14')][_0xe447('0x16')]);return _0x515f87(_0x3364e8[_0xe447('0x14')]['message']);}logger[_0xe447('0x14')](_0xe447('0xf'),_0x3768e4,_0x3364e8['error'][_0xe447('0x16')]);return _0xe3687f(_0x3364e8['error']['message']);}else{logger[_0xe447('0x17')](_0xe447('0xf'),_0x3768e4,'request\x20sent');_0xe3687f(_0x3364e8[_0xe447('0x18')][_0xe447('0x16')]);}})[_0xe447('0x19')](function(_0x2596ba){logger[_0xe447('0x14')](_0xe447('0xf'),_0x3768e4,_0x2596ba);_0x515f87(_0x2596ba);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c20fbfb..a4329eb 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 _0x6493=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/preview','/:id/run','run','/:id/query','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x29b653,_0x32cf68){var _0x105d59=function(_0x1ec488){while(--_0x1ec488){_0x29b653['push'](_0x29b653['shift']());}};_0x105d59(++_0x32cf68);}(_0x6493,0xc2));var _0x3649=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x6493[_0x34c553];return _0x1357d2;};'use strict';var multer=require(_0x3649('0x0'));var util=require(_0x3649('0x1'));var path=require(_0x3649('0x2'));var timeout=require(_0x3649('0x3'));var express=require('express');var router=express[_0x3649('0x4')]();var fs_extra=require(_0x3649('0x5'));var auth=require(_0x3649('0x6'));var interaction=require(_0x3649('0x7'));var config=require(_0x3649('0x8'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x3649('0x9')](),controller[_0x3649('0xa')]);router['get'](_0x3649('0xb'),auth['isAuthenticated'](),controller[_0x3649('0xc')]);router[_0x3649('0xd')](_0x3649('0xe'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x3649('0xf'),auth[_0x3649('0x9')](),controller[_0x3649('0x10')]);router[_0x3649('0xd')](_0x3649('0x11'),auth[_0x3649('0x9')](),controller['query']);router['post']('/',auth[_0x3649('0x9')](),controller['create']);router['put'](_0x3649('0xb'),auth[_0x3649('0x9')](),controller[_0x3649('0x12')]);router[_0x3649('0x13')](_0x3649('0xb'),auth[_0x3649('0x9')](),controller[_0x3649('0x14')]);module[_0x3649('0x15')]=router; \ No newline at end of file +var _0x36a6=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','run','/:id/query','query','post','create','put','update','delete','exports','multer','util'];(function(_0x4fabc,_0x39aa66){var _0x23926a=function(_0x3846b2){while(--_0x3846b2){_0x4fabc['push'](_0x4fabc['shift']());}};_0x23926a(++_0x39aa66);}(_0x36a6,0x1a2));var _0x636a=function(_0x4bb2c8,_0x5a1c01){_0x4bb2c8=_0x4bb2c8-0x0;var _0x486406=_0x36a6[_0x4bb2c8];return _0x486406;};'use strict';var multer=require(_0x636a('0x0'));var util=require(_0x636a('0x1'));var path=require(_0x636a('0x2'));var timeout=require(_0x636a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x636a('0x4'));var auth=require(_0x636a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x636a('0x6'));var controller=require(_0x636a('0x7'));router['get']('/',auth[_0x636a('0x8')](),controller[_0x636a('0x9')]);router[_0x636a('0xa')](_0x636a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x636a('0xa')]('/:id/preview',auth[_0x636a('0x8')](),controller['preview']);router[_0x636a('0xa')]('/:id/run',auth[_0x636a('0x8')](),controller[_0x636a('0xc')]);router[_0x636a('0xa')](_0x636a('0xd'),auth[_0x636a('0x8')](),controller[_0x636a('0xe')]);router[_0x636a('0xf')]('/',auth[_0x636a('0x8')](),controller[_0x636a('0x10')]);router[_0x636a('0x11')]('/:id',auth[_0x636a('0x8')](),controller[_0x636a('0x12')]);router[_0x636a('0x13')](_0x636a('0xb'),auth[_0x636a('0x8')](),controller['destroy']);module[_0x636a('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index aced1ce..258e6fd 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 _0xaf22=['ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','UNSIGNED','sequelize','moment','STRING'];(function(_0x1512ad,_0x569295){var _0x4b0f08=function(_0x4a7964){while(--_0x4a7964){_0x1512ad['push'](_0x1512ad['shift']());}};_0x4b0f08(++_0x569295);}(_0xaf22,0x1d1));var _0x2af2=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xaf22[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x2af2('0x0'));var moment=require(_0x2af2('0x1'));module['exports']={'name':{'type':Sequelize[_0x2af2('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x2af2('0x3')](_0x2af2('0x4'),_0x2af2('0x5'),_0x2af2('0x6')),'allowNull':![],'defaultValue':_0x2af2('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x2af2('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x2af2('0x8')},'type':{'type':Sequelize[_0x2af2('0x3')]('manual',_0x2af2('0x9')),'allowNull':![],'defaultValue':_0x2af2('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x2af2('0xb')]},'reportType':{'type':Sequelize[_0x2af2('0x2')]}}; \ No newline at end of file +var _0xcd00=['scheduled','manual','INTEGER','UNSIGNED','exports','csv','pdf','STRING','DATE','Loading','ENUM'];(function(_0x505aaa,_0x3d91ce){var _0x1025e3=function(_0x268f2a){while(--_0x268f2a){_0x505aaa['push'](_0x505aaa['shift']());}};_0x1025e3(++_0x3d91ce);}(_0xcd00,0x7d));var _0x0cd0=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xcd00[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0cd0('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x0cd0('0x1'),_0x0cd0('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x0cd0('0x1')},'savename':{'type':Sequelize[_0x0cd0('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0cd0('0x4')]},'endDate':{'type':Sequelize[_0x0cd0('0x4')]},'status':{'type':Sequelize[_0x0cd0('0x3')],'defaultValue':_0x0cd0('0x5')},'type':{'type':Sequelize[_0x0cd0('0x6')]('manual',_0x0cd0('0x7')),'allowNull':![],'defaultValue':_0x0cd0('0x8')},'reportId':{'type':Sequelize[_0x0cd0('0x9')](0xb)[_0x0cd0('0xa')]},'reportType':{'type':Sequelize[_0x0cd0('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 1d82ab3..7b42a39 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 _0xe504=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','send','index','AnalyticExtractedReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','include','findAll','catch','show','params','length','includeAll','find','create','body','get','role','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','error','download','basename','savename','existsSync','root','Report\x20not\x20found\x20or\x20empty','join','server/files/reports','format','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3f6ed1,_0x50fc69){var _0x2cdc36=function(_0x214786){while(--_0x214786){_0x3f6ed1['push'](_0x3f6ed1['shift']());}};_0x2cdc36(++_0x50fc69);}(_0xe504,0xa9));var _0x4e50=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe504[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x4e50('0x0'));var rimraf=require(_0x4e50('0x1'));var zipdir=require(_0x4e50('0x2'));var jsonpatch=require(_0x4e50('0x3'));var rp=require(_0x4e50('0x4'));var moment=require(_0x4e50('0x5'));var BPromise=require(_0x4e50('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4e50('0x7'));var ejs=require(_0x4e50('0x8'));var fs=require('fs');var fs_extra=require(_0x4e50('0x9'));var _=require(_0x4e50('0xa'));var squel=require('squel');var crypto=require(_0x4e50('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4e50('0xc'));var toCsv=require(_0x4e50('0x7'));var querystring=require(_0x4e50('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4e50('0xe'));var qs=require(_0x4e50('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e50('0x10'));var logger=require(_0x4e50('0x11'))(_0x4e50('0x12'));var utils=require(_0x4e50('0x13'));var config=require(_0x4e50('0x14'));var licenseUtil=require(_0x4e50('0x15'));var db=require(_0x4e50('0x16'))['db'];function respondWithStatusCode(_0x27a89a,_0x5c9d41){_0x5c9d41=_0x5c9d41||0xcc;return function(_0x40db5a){if(_0x40db5a){return _0x27a89a[_0x4e50('0x17')](_0x5c9d41);}return _0x27a89a[_0x4e50('0x18')](_0x5c9d41)[_0x4e50('0x19')]();};}function respondWithResult(_0x73b52f,_0xf0ab07){_0xf0ab07=_0xf0ab07||0xc8;return function(_0x1c2ec0){if(_0x1c2ec0){return _0x73b52f['status'](_0xf0ab07)[_0x4e50('0x1a')](_0x1c2ec0);}};}function respondWithFilteredResult(_0x592459,_0x1992c4){return function(_0x3df8a4){if(_0x3df8a4){var _0x34a898=typeof _0x1992c4[_0x4e50('0x1b')]===_0x4e50('0x1c')&&typeof _0x1992c4['limit']===_0x4e50('0x1c');var _0x400c8d=_0x3df8a4['count'];var _0xe6e4c8=_0x34a898?0x0:_0x1992c4[_0x4e50('0x1b')];var _0x3a5be9=_0x34a898?_0x3df8a4[_0x4e50('0x1d')]:_0x1992c4[_0x4e50('0x1b')]+_0x1992c4[_0x4e50('0x1e')];var _0x4e5646;if(_0x3a5be9>=_0x400c8d){_0x3a5be9=_0x400c8d;_0x4e5646=0xc8;}else{_0x4e5646=0xce;}_0x592459[_0x4e50('0x18')](_0x4e5646);return _0x592459[_0x4e50('0x1f')](_0x4e50('0x20'),_0xe6e4c8+'-'+_0x3a5be9+'/'+_0x400c8d)[_0x4e50('0x1a')](_0x3df8a4);}return null;};}function patchUpdates(_0x2dd441){return function(_0x5ae2a1){try{jsonpatch[_0x4e50('0x21')](_0x5ae2a1,_0x2dd441,!![]);}catch(_0x3544d1){return BPromise[_0x4e50('0x22')](_0x3544d1);}return _0x5ae2a1[_0x4e50('0x23')]();};}function saveUpdates(_0x1227d2,_0x321a86){return function(_0x4e5562){if(_0x4e5562){return _0x4e5562[_0x4e50('0x24')](_0x1227d2)[_0x4e50('0x25')](function(_0x2e82a3){return _0x2e82a3;});}return null;};}function removeEntity(_0x257188,_0x187ce2){return function(_0x14b3c5){if(_0x14b3c5){return _0x14b3c5[_0x4e50('0x26')]()[_0x4e50('0x25')](function(){var _0x2cf3a2=_0x14b3c5['get']({'plain':!![]});var _0x20aff3='ExtractedReports';return db[_0x4e50('0x27')]['destroy']({'where':{'type':_0x20aff3,'resourceId':_0x2cf3a2['id']}})[_0x4e50('0x25')](function(){return _0x14b3c5;});})[_0x4e50('0x25')](function(){_0x257188[_0x4e50('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb131,_0x21dec3){return function(_0x3020e7){if(!_0x3020e7){_0xdb131['sendStatus'](0x194);}return _0x3020e7;};}function handleError(_0x5d155d,_0x1c11dd){_0x1c11dd=_0x1c11dd||0x1f4;return function(_0x3e7d0b){logger['error'](_0x3e7d0b['stack']);if(_0x3e7d0b['name']){delete _0x3e7d0b['name'];}_0x5d155d[_0x4e50('0x18')](_0x1c11dd)[_0x4e50('0x28')](_0x3e7d0b);};}exports[_0x4e50('0x29')]=function(_0x35ae5b,_0x2d0143){var _0x49f586={},_0x2cbc7b={},_0x146386={'count':0x0,'rows':[]};var _0x23ed91=_['map'](db[_0x4e50('0x2a')][_0x4e50('0x2b')],function(_0x241fe6){return{'name':_0x241fe6['fieldName'],'type':_0x241fe6['type'][_0x4e50('0x2c')]};});_0x2cbc7b[_0x4e50('0x2d')]=_[_0x4e50('0x2e')](_0x23ed91,'name');_0x2cbc7b[_0x4e50('0x2f')]=_[_0x4e50('0x30')](_0x35ae5b['query']);_0x2cbc7b[_0x4e50('0x31')]=_[_0x4e50('0x32')](_0x2cbc7b['model'],_0x2cbc7b[_0x4e50('0x2f')]);_0x49f586[_0x4e50('0x33')]=_['intersection'](_0x2cbc7b['model'],qs[_0x4e50('0x34')](_0x35ae5b[_0x4e50('0x2f')]['fields']));_0x49f586['attributes']=_0x49f586[_0x4e50('0x33')]['length']?_0x49f586[_0x4e50('0x33')]:_0x2cbc7b[_0x4e50('0x2d')];if(!_0x35ae5b['query'][_0x4e50('0x35')](_0x4e50('0x36'))){_0x49f586[_0x4e50('0x1e')]=qs[_0x4e50('0x1e')](_0x35ae5b[_0x4e50('0x2f')]['limit']);_0x49f586['offset']=qs[_0x4e50('0x1b')](_0x35ae5b[_0x4e50('0x2f')][_0x4e50('0x1b')]);}_0x49f586[_0x4e50('0x37')]=qs[_0x4e50('0x38')](_0x35ae5b[_0x4e50('0x2f')][_0x4e50('0x38')]);_0x49f586[_0x4e50('0x39')]=qs['filters'](_[_0x4e50('0x3a')](_0x35ae5b['query'],_0x2cbc7b[_0x4e50('0x31')]),_0x23ed91);if(_0x35ae5b[_0x4e50('0x2f')][_0x4e50('0x3b')]){_0x49f586[_0x4e50('0x39')]=_[_0x4e50('0x3c')](_0x49f586[_0x4e50('0x39')],{'$or':_[_0x4e50('0x2e')](_0x23ed91,function(_0x1ebece){if(_0x1ebece[_0x4e50('0x3d')]!==_0x4e50('0x3e')){var _0x3ee1aa={};_0x3ee1aa[_0x1ebece[_0x4e50('0x3f')]]={'$like':'%'+_0x35ae5b['query'][_0x4e50('0x3b')]+'%'};return _0x3ee1aa;}})});}_0x49f586=_['merge']({},_0x49f586,_0x35ae5b['options']);var _0x1d45e1={'where':_0x49f586[_0x4e50('0x39')]};return db['AnalyticExtractedReport'][_0x4e50('0x1d')](_0x1d45e1)[_0x4e50('0x25')](function(_0x1b30c1){_0x146386[_0x4e50('0x1d')]=_0x1b30c1;if(_0x35ae5b[_0x4e50('0x2f')]['includeAll']){_0x49f586[_0x4e50('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x4e50('0x41')](_0x49f586);})[_0x4e50('0x25')](function(_0x5567ec){_0x146386['rows']=_0x5567ec;return _0x146386;})[_0x4e50('0x25')](respondWithFilteredResult(_0x2d0143,_0x49f586))[_0x4e50('0x42')](handleError(_0x2d0143,null));};exports[_0x4e50('0x43')]=function(_0x254469,_0x11d469){var _0x209b32={'raw':!![],'where':{'id':_0x254469[_0x4e50('0x44')]['id']}},_0x2666c8={};_0x2666c8[_0x4e50('0x2d')]=_['keys'](db[_0x4e50('0x2a')][_0x4e50('0x2b')]);_0x2666c8[_0x4e50('0x2f')]=_[_0x4e50('0x30')](_0x254469[_0x4e50('0x2f')]);_0x2666c8[_0x4e50('0x31')]=_[_0x4e50('0x32')](_0x2666c8[_0x4e50('0x2d')],_0x2666c8['query']);_0x209b32[_0x4e50('0x33')]=_[_0x4e50('0x32')](_0x2666c8['model'],qs['fields'](_0x254469[_0x4e50('0x2f')]['fields']));_0x209b32[_0x4e50('0x33')]=_0x209b32[_0x4e50('0x33')][_0x4e50('0x45')]?_0x209b32[_0x4e50('0x33')]:_0x2666c8[_0x4e50('0x2d')];if(_0x254469[_0x4e50('0x2f')][_0x4e50('0x46')]){_0x209b32[_0x4e50('0x40')]=[{'all':!![]}];}_0x209b32=_[_0x4e50('0x3c')]({},_0x209b32,_0x254469['options']);return db[_0x4e50('0x2a')][_0x4e50('0x47')](_0x209b32)['then'](handleEntityNotFound(_0x11d469,null))[_0x4e50('0x25')](respondWithResult(_0x11d469,null))[_0x4e50('0x42')](handleError(_0x11d469,null));};exports['create']=function(_0x1bc4c3,_0x2f5fb8){return db[_0x4e50('0x2a')][_0x4e50('0x48')](_0x1bc4c3[_0x4e50('0x49')],{})[_0x4e50('0x25')](function(_0x5b21b2){var _0x5186df=_0x1bc4c3['user'][_0x4e50('0x4a')]({'plain':!![]});if(!_0x5186df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5186df[_0x4e50('0x4b')]===_0x4e50('0x4c')){var _0x12c527=_0x5b21b2[_0x4e50('0x4a')]({'plain':!![]});var _0x16d2c7=_0x4e50('0x4d');return db[_0x4e50('0x4e')][_0x4e50('0x47')]({'where':{'name':_0x16d2c7,'userProfileId':_0x5186df[_0x4e50('0x4f')]},'raw':!![]})[_0x4e50('0x25')](function(_0x1ec66c){if(_0x1ec66c&&_0x1ec66c[_0x4e50('0x50')]===0x0){return db[_0x4e50('0x27')][_0x4e50('0x48')]({'name':_0x12c527[_0x4e50('0x3f')],'resourceId':_0x12c527['id'],'type':_0x1ec66c['name'],'sectionId':_0x1ec66c['id']},{})[_0x4e50('0x25')](function(){return _0x5b21b2;});}else{return _0x5b21b2;}})[_0x4e50('0x42')](function(_0x244ade){logger[_0x4e50('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x244ade);throw _0x244ade;});}return _0x5b21b2;})[_0x4e50('0x25')](respondWithResult(_0x2f5fb8,0xc9))[_0x4e50('0x42')](handleError(_0x2f5fb8,null));};exports[_0x4e50('0x24')]=function(_0x42326b,_0x53fe2a){if(_0x42326b[_0x4e50('0x49')]['id']){delete _0x42326b[_0x4e50('0x49')]['id'];}return db[_0x4e50('0x2a')][_0x4e50('0x47')]({'where':{'id':_0x42326b[_0x4e50('0x44')]['id']}})[_0x4e50('0x25')](handleEntityNotFound(_0x53fe2a,null))[_0x4e50('0x25')](saveUpdates(_0x42326b['body'],null))[_0x4e50('0x25')](respondWithResult(_0x53fe2a,null))[_0x4e50('0x42')](handleError(_0x53fe2a,null));};exports[_0x4e50('0x26')]=function(_0xd6660d,_0x3886f9){return db[_0x4e50('0x2a')]['find']({'where':{'id':_0xd6660d[_0x4e50('0x44')]['id']}})['then'](handleEntityNotFound(_0x3886f9,null))[_0x4e50('0x25')](removeEntity(_0x3886f9,null))[_0x4e50('0x42')](handleError(_0x3886f9,null));};exports[_0x4e50('0x52')]=function(_0x10a210,_0x215656,_0x180e79){return db[_0x4e50('0x2a')][_0x4e50('0x47')]({'where':{'id':_0x10a210[_0x4e50('0x44')]['id']},'attributes':[_0x4e50('0x3f'),_0x4e50('0x53'),_0x4e50('0x54'),'output'],'raw':!![]})[_0x4e50('0x25')](handleEntityNotFound(_0x215656,null))[_0x4e50('0x25')](function(_0x1c78ba){if(_0x1c78ba){if(!fs[_0x4e50('0x55')](path['join'](config[_0x4e50('0x56')],'server/files/reports',_0x1c78ba['savename']))){throw new db['Sequelize']['ValidationError'](_0x4e50('0x57'));}if(_0x10a210['query']['exists']){return _0x215656[_0x4e50('0x17')](0xc8);}return _0x215656[_0x4e50('0x52')](path[_0x4e50('0x58')](config[_0x4e50('0x56')],_0x4e50('0x59'),_0x1c78ba[_0x4e50('0x54')]),util[_0x4e50('0x5a')]('%s.%s',_0x1c78ba[_0x4e50('0x53')]||_0x1c78ba[_0x4e50('0x3f')],_0x1c78ba[_0x4e50('0x5b')][_0x4e50('0x5c')]()));}})[_0x4e50('0x42')](handleError(_0x215656,null));}; \ No newline at end of file +var _0xf557=['toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','count','set','json','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','AnalyticExtractedReport','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','basename'];(function(_0xaf5a3e,_0x1269c5){var _0x4ff8a5=function(_0x77231){while(--_0x77231){_0xaf5a3e['push'](_0xaf5a3e['shift']());}};_0x4ff8a5(++_0x1269c5);}(_0xf557,0x127));var _0x7f55=function(_0x4c9852,_0x112896){_0x4c9852=_0x4c9852-0x0;var _0x25f9f8=_0xf557[_0x4c9852];return _0x25f9f8;};'use strict';var emlformat=require(_0x7f55('0x0'));var rimraf=require(_0x7f55('0x1'));var zipdir=require(_0x7f55('0x2'));var jsonpatch=require(_0x7f55('0x3'));var rp=require(_0x7f55('0x4'));var moment=require(_0x7f55('0x5'));var BPromise=require(_0x7f55('0x6'));var Mustache=require(_0x7f55('0x7'));var util=require(_0x7f55('0x8'));var path=require(_0x7f55('0x9'));var sox=require('sox');var csv=require(_0x7f55('0xa'));var ejs=require(_0x7f55('0xb'));var fs=require('fs');var fs_extra=require(_0x7f55('0xc'));var _=require(_0x7f55('0xd'));var squel=require(_0x7f55('0xe'));var crypto=require(_0x7f55('0xf'));var jsforce=require(_0x7f55('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7f55('0xa'));var querystring=require(_0x7f55('0x11'));var Papa=require('papaparse');var Redis=require(_0x7f55('0x12'));var authService=require(_0x7f55('0x13'));var qs=require(_0x7f55('0x14'));var as=require(_0x7f55('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f55('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7f55('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f55('0x18'))['db'];function respondWithStatusCode(_0x15f5d2,_0x473e64){_0x473e64=_0x473e64||0xcc;return function(_0x5a8cc8){if(_0x5a8cc8){return _0x15f5d2[_0x7f55('0x19')](_0x473e64);}return _0x15f5d2[_0x7f55('0x1a')](_0x473e64)[_0x7f55('0x1b')]();};}function respondWithResult(_0x1a9e62,_0x325af5){_0x325af5=_0x325af5||0xc8;return function(_0x48de85){if(_0x48de85){return _0x1a9e62['status'](_0x325af5)['json'](_0x48de85);}};}function respondWithFilteredResult(_0x26e2ba,_0x2f48c8){return function(_0x45a684){if(_0x45a684){var _0x5020a5=typeof _0x2f48c8[_0x7f55('0x1c')]==='undefined'&&typeof _0x2f48c8['limit']==='undefined';var _0x57eb14=_0x45a684[_0x7f55('0x1d')];var _0x472aa=_0x5020a5?0x0:_0x2f48c8['offset'];var _0xccc182=_0x5020a5?_0x45a684[_0x7f55('0x1d')]:_0x2f48c8[_0x7f55('0x1c')]+_0x2f48c8['limit'];var _0x3c51ee;if(_0xccc182>=_0x57eb14){_0xccc182=_0x57eb14;_0x3c51ee=0xc8;}else{_0x3c51ee=0xce;}_0x26e2ba[_0x7f55('0x1a')](_0x3c51ee);return _0x26e2ba[_0x7f55('0x1e')]('Content-Range',_0x472aa+'-'+_0xccc182+'/'+_0x57eb14)[_0x7f55('0x1f')](_0x45a684);}return null;};}function patchUpdates(_0x197227){return function(_0x2e84f0){try{jsonpatch[_0x7f55('0x20')](_0x2e84f0,_0x197227,!![]);}catch(_0x56da30){return BPromise[_0x7f55('0x21')](_0x56da30);}return _0x2e84f0['save']();};}function saveUpdates(_0x3cfc0a,_0x112e5d){return function(_0xf26f8e){if(_0xf26f8e){return _0xf26f8e[_0x7f55('0x22')](_0x3cfc0a)[_0x7f55('0x23')](function(_0x5421e8){return _0x5421e8;});}return null;};}function removeEntity(_0x487504,_0x181520){return function(_0x4781cb){if(_0x4781cb){return _0x4781cb[_0x7f55('0x24')]()[_0x7f55('0x23')](function(){var _0x35ca7c=_0x4781cb[_0x7f55('0x25')]({'plain':!![]});var _0x204eec=_0x7f55('0x26');return db[_0x7f55('0x27')][_0x7f55('0x24')]({'where':{'type':_0x204eec,'resourceId':_0x35ca7c['id']}})['then'](function(){return _0x4781cb;});})[_0x7f55('0x23')](function(){_0x487504[_0x7f55('0x1a')](0xcc)[_0x7f55('0x1b')]();});}};}function handleEntityNotFound(_0x38529d,_0x38e60f){return function(_0x50aac0){if(!_0x50aac0){_0x38529d[_0x7f55('0x19')](0x194);}return _0x50aac0;};}function handleError(_0x4d838c,_0x2e0a88){_0x2e0a88=_0x2e0a88||0x1f4;return function(_0x408bff){logger[_0x7f55('0x28')](_0x408bff[_0x7f55('0x29')]);if(_0x408bff[_0x7f55('0x2a')]){delete _0x408bff[_0x7f55('0x2a')];}_0x4d838c['status'](_0x2e0a88)[_0x7f55('0x2b')](_0x408bff);};}exports['index']=function(_0x14d701,_0x3d3774){var _0x144423={},_0x40031e={},_0x583b8e={'count':0x0,'rows':[]};var _0x2cd3fa=_[_0x7f55('0x2c')](db['AnalyticExtractedReport'][_0x7f55('0x2d')],function(_0x43b3f8){return{'name':_0x43b3f8[_0x7f55('0x2e')],'type':_0x43b3f8[_0x7f55('0x2f')][_0x7f55('0x30')]};});_0x40031e['model']=_[_0x7f55('0x2c')](_0x2cd3fa,_0x7f55('0x2a'));_0x40031e[_0x7f55('0x31')]=_[_0x7f55('0x32')](_0x14d701[_0x7f55('0x31')]);_0x40031e[_0x7f55('0x33')]=_[_0x7f55('0x34')](_0x40031e[_0x7f55('0x35')],_0x40031e['query']);_0x144423[_0x7f55('0x36')]=_['intersection'](_0x40031e['model'],qs['fields'](_0x14d701[_0x7f55('0x31')][_0x7f55('0x37')]));_0x144423[_0x7f55('0x36')]=_0x144423[_0x7f55('0x36')][_0x7f55('0x38')]?_0x144423[_0x7f55('0x36')]:_0x40031e[_0x7f55('0x35')];if(!_0x14d701[_0x7f55('0x31')][_0x7f55('0x39')](_0x7f55('0x3a'))){_0x144423[_0x7f55('0x3b')]=qs[_0x7f55('0x3b')](_0x14d701['query'][_0x7f55('0x3b')]);_0x144423[_0x7f55('0x1c')]=qs[_0x7f55('0x1c')](_0x14d701[_0x7f55('0x31')][_0x7f55('0x1c')]);}_0x144423['order']=qs[_0x7f55('0x3c')](_0x14d701[_0x7f55('0x31')]['sort']);_0x144423[_0x7f55('0x3d')]=qs[_0x7f55('0x33')](_[_0x7f55('0x3e')](_0x14d701[_0x7f55('0x31')],_0x40031e[_0x7f55('0x33')]),_0x2cd3fa);if(_0x14d701[_0x7f55('0x31')][_0x7f55('0x3f')]){_0x144423[_0x7f55('0x3d')]=_[_0x7f55('0x40')](_0x144423[_0x7f55('0x3d')],{'$or':_['map'](_0x2cd3fa,function(_0xa07415){if(_0xa07415[_0x7f55('0x2f')]!==_0x7f55('0x41')){var _0x2bbaca={};_0x2bbaca[_0xa07415[_0x7f55('0x2a')]]={'$like':'%'+_0x14d701[_0x7f55('0x31')][_0x7f55('0x3f')]+'%'};return _0x2bbaca;}})});}_0x144423=_['merge']({},_0x144423,_0x14d701['options']);var _0x38ca31={'where':_0x144423[_0x7f55('0x3d')]};return db['AnalyticExtractedReport'][_0x7f55('0x1d')](_0x38ca31)[_0x7f55('0x23')](function(_0x248bc1){_0x583b8e[_0x7f55('0x1d')]=_0x248bc1;if(_0x14d701[_0x7f55('0x31')][_0x7f55('0x42')]){_0x144423[_0x7f55('0x43')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7f55('0x44')](_0x144423);})[_0x7f55('0x23')](function(_0x5d6901){_0x583b8e[_0x7f55('0x45')]=_0x5d6901;return _0x583b8e;})[_0x7f55('0x23')](respondWithFilteredResult(_0x3d3774,_0x144423))[_0x7f55('0x46')](handleError(_0x3d3774,null));};exports[_0x7f55('0x47')]=function(_0x2316bf,_0x3fedaf){var _0x3c7ec5={'raw':!![],'where':{'id':_0x2316bf[_0x7f55('0x48')]['id']}},_0x128fc0={};_0x128fc0['model']=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x128fc0['query']=_['keys'](_0x2316bf[_0x7f55('0x31')]);_0x128fc0[_0x7f55('0x33')]=_['intersection'](_0x128fc0['model'],_0x128fc0[_0x7f55('0x31')]);_0x3c7ec5[_0x7f55('0x36')]=_[_0x7f55('0x34')](_0x128fc0[_0x7f55('0x35')],qs[_0x7f55('0x37')](_0x2316bf['query']['fields']));_0x3c7ec5[_0x7f55('0x36')]=_0x3c7ec5[_0x7f55('0x36')][_0x7f55('0x38')]?_0x3c7ec5[_0x7f55('0x36')]:_0x128fc0[_0x7f55('0x35')];if(_0x2316bf[_0x7f55('0x31')][_0x7f55('0x42')]){_0x3c7ec5[_0x7f55('0x43')]=[{'all':!![]}];}_0x3c7ec5=_[_0x7f55('0x40')]({},_0x3c7ec5,_0x2316bf[_0x7f55('0x49')]);return db[_0x7f55('0x4a')]['find'](_0x3c7ec5)[_0x7f55('0x23')](handleEntityNotFound(_0x3fedaf,null))[_0x7f55('0x23')](respondWithResult(_0x3fedaf,null))[_0x7f55('0x46')](handleError(_0x3fedaf,null));};exports['create']=function(_0x5338b8,_0x4a0be0){return db[_0x7f55('0x4a')]['create'](_0x5338b8[_0x7f55('0x4b')],{})[_0x7f55('0x23')](function(_0x5c7364){var _0x51848a=_0x5338b8[_0x7f55('0x4c')]['get']({'plain':!![]});if(!_0x51848a)throw new Error(_0x7f55('0x4d'));if(_0x51848a[_0x7f55('0x4e')]===_0x7f55('0x4c')){var _0x13a428=_0x5c7364[_0x7f55('0x25')]({'plain':!![]});var _0x2bf4f0=_0x7f55('0x26');return db[_0x7f55('0x4f')][_0x7f55('0x50')]({'where':{'name':_0x2bf4f0,'userProfileId':_0x51848a['userProfileId']},'raw':!![]})[_0x7f55('0x23')](function(_0x4fcc58){if(_0x4fcc58&&_0x4fcc58[_0x7f55('0x51')]===0x0){return db['UserProfileResource'][_0x7f55('0x52')]({'name':_0x13a428[_0x7f55('0x2a')],'resourceId':_0x13a428['id'],'type':_0x4fcc58[_0x7f55('0x2a')],'sectionId':_0x4fcc58['id']},{})['then'](function(){return _0x5c7364;});}else{return _0x5c7364;}})[_0x7f55('0x46')](function(_0x3d2c18){logger[_0x7f55('0x28')](_0x7f55('0x53'),_0x3d2c18);throw _0x3d2c18;});}return _0x5c7364;})['then'](respondWithResult(_0x4a0be0,0xc9))[_0x7f55('0x46')](handleError(_0x4a0be0,null));};exports['update']=function(_0x1024b7,_0x5c8931){if(_0x1024b7[_0x7f55('0x4b')]['id']){delete _0x1024b7[_0x7f55('0x4b')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1024b7[_0x7f55('0x48')]['id']}})[_0x7f55('0x23')](handleEntityNotFound(_0x5c8931,null))[_0x7f55('0x23')](saveUpdates(_0x1024b7[_0x7f55('0x4b')],null))[_0x7f55('0x23')](respondWithResult(_0x5c8931,null))[_0x7f55('0x46')](handleError(_0x5c8931,null));};exports['destroy']=function(_0x4f4e42,_0x5ea12b){return db[_0x7f55('0x4a')]['find']({'where':{'id':_0x4f4e42[_0x7f55('0x48')]['id']}})[_0x7f55('0x23')](handleEntityNotFound(_0x5ea12b,null))[_0x7f55('0x23')](removeEntity(_0x5ea12b,null))[_0x7f55('0x46')](handleError(_0x5ea12b,null));};exports[_0x7f55('0x54')]=function(_0x1d36f5,_0x21a976,_0x5b57d7){return db[_0x7f55('0x4a')][_0x7f55('0x50')]({'where':{'id':_0x1d36f5[_0x7f55('0x48')]['id']},'attributes':[_0x7f55('0x2a'),'basename',_0x7f55('0x55'),_0x7f55('0x56')],'raw':!![]})[_0x7f55('0x23')](handleEntityNotFound(_0x21a976,null))[_0x7f55('0x23')](function(_0x2d4307){if(_0x2d4307){if(!fs[_0x7f55('0x57')](path[_0x7f55('0x58')](config[_0x7f55('0x59')],_0x7f55('0x5a'),_0x2d4307[_0x7f55('0x55')]))){throw new db[(_0x7f55('0x5b'))][(_0x7f55('0x5c'))](_0x7f55('0x5d'));}if(_0x1d36f5[_0x7f55('0x31')][_0x7f55('0x5e')]){return _0x21a976['sendStatus'](0xc8);}return _0x21a976[_0x7f55('0x54')](path[_0x7f55('0x58')](config[_0x7f55('0x59')],_0x7f55('0x5a'),_0x2d4307[_0x7f55('0x55')]),util[_0x7f55('0x5f')]('%s.%s',_0x2d4307[_0x7f55('0x60')]||_0x2d4307[_0x7f55('0x2a')],_0x2d4307[_0x7f55('0x56')][_0x7f55('0x61')]()));}})[_0x7f55('0x46')](handleError(_0x21a976,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ee63e20..f7e1653 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 _0x14f3=['moment','bluebird','path','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util'];(function(_0x4475e9,_0x343989){var _0x501df1=function(_0x35c38a){while(--_0x35c38a){_0x4475e9['push'](_0x4475e9['shift']());}};_0x501df1(++_0x343989);}(_0x14f3,0x10d));var _0x314f=function(_0x587ee7,_0x94b2bf){_0x587ee7=_0x587ee7-0x0;var _0x4b244f=_0x14f3[_0x587ee7];return _0x4b244f;};'use strict';var _=require('lodash');var util=require(_0x314f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x314f('0x1'));var BPromise=require(_0x314f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x314f('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x314f('0x4'));module[_0x314f('0x5')]=function(_0x455d8c,_0x2257b9){return _0x455d8c[_0x314f('0x6')](_0x314f('0x7'),attributes,{'tableName':_0x314f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5db3=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','lodash','api','bluebird','request-promise'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x5db3,0x10a));var _0x35db=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x5db3[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0x35db('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x35db('0x1'));var moment=require('moment');var BPromise=require(_0x35db('0x2'));var rp=require(_0x35db('0x3'));var fs=require('fs');var path=require(_0x35db('0x4'));var rimraf=require(_0x35db('0x5'));var config=require(_0x35db('0x6'));var attributes=require(_0x35db('0x7'));module[_0x35db('0x8')]=function(_0x504dda,_0x3c10be){return _0x504dda[_0x35db('0x9')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','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 8cb8c95..9c92aff 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 _0x5a7e=['request','then','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x4b256a,_0x154505){var _0x14ca6f=function(_0x3c9f41){while(--_0x3c9f41){_0x4b256a['push'](_0x4b256a['shift']());}};_0x14ca6f(++_0x154505);}(_0x5a7e,0x8a));var _0xe5a7=function(_0x5afcca,_0x533f8d){_0x5afcca=_0x5afcca-0x0;var _0x134e8a=_0x5a7e[_0x5afcca];return _0x134e8a;};'use strict';var _=require(_0xe5a7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe5a7('0x1'));var rs=require(_0xe5a7('0x2'));var fs=require('fs');var Redis=require(_0xe5a7('0x3'));var db=require(_0xe5a7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5a7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe5a7('0x6'));var client=jayson[_0xe5a7('0x7')][_0xe5a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19adac,_0x262c9b,_0x519916){return new BPromise(function(_0x2290a2,_0x3946b8){return client[_0xe5a7('0x9')](_0x19adac,_0x519916)[_0xe5a7('0xa')](function(_0xc51545){logger['info'](_0xe5a7('0xb'),_0x262c9b,'request\x20sent');logger['debug'](_0xe5a7('0xc'),_0x262c9b,_0xe5a7('0xd'),JSON[_0xe5a7('0xe')](_0xc51545));if(_0xc51545[_0xe5a7('0xf')]){if(_0xc51545[_0xe5a7('0xf')][_0xe5a7('0x10')]===0x1f4){logger[_0xe5a7('0xf')](_0xe5a7('0xb'),_0x262c9b,_0xc51545[_0xe5a7('0xf')][_0xe5a7('0x11')]);return _0x3946b8(_0xc51545['error'][_0xe5a7('0x11')]);}logger[_0xe5a7('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x262c9b,_0xc51545[_0xe5a7('0xf')][_0xe5a7('0x11')]);return _0x2290a2(_0xc51545[_0xe5a7('0xf')][_0xe5a7('0x11')]);}else{logger[_0xe5a7('0x12')](_0xe5a7('0xb'),_0x262c9b,_0xe5a7('0xd'));_0x2290a2(_0xc51545[_0xe5a7('0x13')][_0xe5a7('0x11')]);}})[_0xe5a7('0x14')](function(_0x4d0466){logger[_0xe5a7('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x262c9b,_0x4d0466);_0x3946b8(_0x4d0466);});});} \ No newline at end of file +var _0xf4fb=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xf4fb,0x12d));var _0xbf4f=function(_0x4877ea,_0x41f2af){_0x4877ea=_0x4877ea-0x0;var _0x4c3979=_0xf4fb[_0x4877ea];return _0x4c3979;};'use strict';var _=require(_0xbf4f('0x0'));var util=require('util');var moment=require(_0xbf4f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4f('0x2'));var db=require(_0xbf4f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf4f('0x4'))(_0xbf4f('0x5'));var config=require(_0xbf4f('0x6'));var jayson=require(_0xbf4f('0x7'));var client=jayson['client'][_0xbf4f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7166,_0xfc6bde,_0x5a4e78){return new BPromise(function(_0x40242a,_0x597b74){return client[_0xbf4f('0x9')](_0x3f7166,_0x5a4e78)[_0xbf4f('0xa')](function(_0x499eca){logger[_0xbf4f('0xb')](_0xbf4f('0xc'),_0xfc6bde,'request\x20sent');logger[_0xbf4f('0xd')](_0xbf4f('0xe'),_0xfc6bde,_0xbf4f('0xf'),JSON[_0xbf4f('0x10')](_0x499eca));if(_0x499eca[_0xbf4f('0x11')]){if(_0x499eca[_0xbf4f('0x11')][_0xbf4f('0x12')]===0x1f4){logger[_0xbf4f('0x11')](_0xbf4f('0xc'),_0xfc6bde,_0x499eca[_0xbf4f('0x11')][_0xbf4f('0x13')]);return _0x597b74(_0x499eca['error']['message']);}logger[_0xbf4f('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xfc6bde,_0x499eca[_0xbf4f('0x11')][_0xbf4f('0x13')]);return _0x40242a(_0x499eca[_0xbf4f('0x11')][_0xbf4f('0x13')]);}else{logger[_0xbf4f('0xb')](_0xbf4f('0xc'),_0xfc6bde,_0xbf4f('0xf'));_0x40242a(_0x499eca[_0xbf4f('0x14')][_0xbf4f('0x13')]);}})['catch'](function(_0x5d6264){logger[_0xbf4f('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xfc6bde,_0x5d6264);_0x597b74(_0x5d6264);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a01f13a..2d14d7a 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 _0x3940=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','download','post','create','update','exports','multer','util'];(function(_0x4a9636,_0x528697){var _0x319338=function(_0x45b68b){while(--_0x45b68b){_0x4a9636['push'](_0x4a9636['shift']());}};_0x319338(++_0x528697);}(_0x3940,0xce));var _0x0394=function(_0x320c93,_0x37fc25){_0x320c93=_0x320c93-0x0;var _0x4a10dd=_0x3940[_0x320c93];return _0x4a10dd;};'use strict';var multer=require(_0x0394('0x0'));var util=require(_0x0394('0x1'));var path=require(_0x0394('0x2'));var timeout=require(_0x0394('0x3'));var express=require('express');var router=express[_0x0394('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0394('0x5'));var interaction=require(_0x0394('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x0394('0x7')]('/',auth[_0x0394('0x8')](),controller['index']);router[_0x0394('0x7')](_0x0394('0x9'),auth['isAuthenticated'](),controller[_0x0394('0xa')]);router[_0x0394('0x7')]('/:id/download',auth[_0x0394('0x8')](),controller[_0x0394('0xb')]);router[_0x0394('0xc')]('/',auth[_0x0394('0x8')](),controller[_0x0394('0xd')]);router['put'](_0x0394('0x9'),auth[_0x0394('0x8')](),controller[_0x0394('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0394('0xf')]=router; \ No newline at end of file +var _0x1215=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','put','update'];(function(_0x3cbe85,_0x4c3091){var _0x396936=function(_0x11f23){while(--_0x11f23){_0x3cbe85['push'](_0x3cbe85['shift']());}};_0x396936(++_0x4c3091);}(_0x1215,0x1d1));var _0x5121=function(_0x4d0d3a,_0x2ccb29){_0x4d0d3a=_0x4d0d3a-0x0;var _0x73a18e=_0x1215[_0x4d0d3a];return _0x73a18e;};'use strict';var multer=require(_0x5121('0x0'));var util=require(_0x5121('0x1'));var path=require('path');var timeout=require(_0x5121('0x2'));var express=require(_0x5121('0x3'));var router=express[_0x5121('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5121('0x5'));var interaction=require(_0x5121('0x6'));var config=require(_0x5121('0x7'));var controller=require(_0x5121('0x8'));router[_0x5121('0x9')]('/',auth[_0x5121('0xa')](),controller[_0x5121('0xb')]);router['get'](_0x5121('0xc'),auth[_0x5121('0xa')](),controller[_0x5121('0xd')]);router['get'](_0x5121('0xe'),auth[_0x5121('0xa')](),controller[_0x5121('0xf')]);router['post']('/',auth[_0x5121('0xa')](),controller['create']);router[_0x5121('0x10')](_0x5121('0xc'),auth[_0x5121('0xa')](),controller[_0x5121('0x11')]);router[_0x5121('0x12')](_0x5121('0xc'),auth[_0x5121('0xa')](),controller[_0x5121('0x13')]);module[_0x5121('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 19443c7..0b3b47f 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 _0x585d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x654299,_0x2d543d){var _0x13638a=function(_0x2cabaa){while(--_0x2cabaa){_0x654299['push'](_0x654299['shift']());}};_0x13638a(++_0x2d543d);}(_0x585d,0x172));var _0xd585=function(_0x373edb,_0x5bdb46){_0x373edb=_0x373edb-0x0;var _0x20ac0b=_0x585d[_0x373edb];return _0x20ac0b;};'use strict';var Sequelize=require(_0xd585('0x0'));module[_0xd585('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd585('0x2')]},'function':{'type':Sequelize[_0xd585('0x2')]},'format':{'type':Sequelize[_0xd585('0x2')]},'groupBy':{'type':Sequelize[_0xd585('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd585('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7cc9=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0xb6a9a2,_0x3d27da){var _0x1fdb2a=function(_0x40d2f4){while(--_0x40d2f4){_0xb6a9a2['push'](_0xb6a9a2['shift']());}};_0x1fdb2a(++_0x3d27da);}(_0x7cc9,0xfe));var _0x97cc=function(_0x2ff38f,_0xefceba){_0x2ff38f=_0x2ff38f-0x0;var _0x19a75f=_0x7cc9[_0x2ff38f];return _0x19a75f;};'use strict';var Sequelize=require(_0x97cc('0x0'));module[_0x97cc('0x1')]={'field':{'type':Sequelize[_0x97cc('0x2')]},'alias':{'type':Sequelize[_0x97cc('0x3')]},'function':{'type':Sequelize[_0x97cc('0x3')]},'format':{'type':Sequelize[_0x97cc('0x3')]},'groupBy':{'type':Sequelize[_0x97cc('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x97cc('0x3')]},'custom':{'type':Sequelize[_0x97cc('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 0c1b473..70cd1e8 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 _0x8a24=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','map','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','where','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','rows','catch','show','rawAttributes','include','find','create','body','bulkCreate','update','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a24,0x132));var _0x48a2=function(_0x4df5b7,_0x4a028a){_0x4df5b7=_0x4df5b7-0x0;var _0x2ed018=_0x8a24[_0x4df5b7];return _0x2ed018;};'use strict';var emlformat=require(_0x48a2('0x0'));var rimraf=require(_0x48a2('0x1'));var zipdir=require(_0x48a2('0x2'));var jsonpatch=require(_0x48a2('0x3'));var rp=require(_0x48a2('0x4'));var moment=require(_0x48a2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x48a2('0x6'));var path=require(_0x48a2('0x7'));var sox=require('sox');var csv=require(_0x48a2('0x8'));var ejs=require(_0x48a2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48a2('0xa'));var squel=require(_0x48a2('0xb'));var crypto=require(_0x48a2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x48a2('0xd'));var toCsv=require(_0x48a2('0x8'));var querystring=require(_0x48a2('0xe'));var Papa=require(_0x48a2('0xf'));var Redis=require(_0x48a2('0x10'));var authService=require(_0x48a2('0x11'));var qs=require(_0x48a2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x48a2('0x13'))(_0x48a2('0x14'));var utils=require(_0x48a2('0x15'));var config=require(_0x48a2('0x16'));var licenseUtil=require(_0x48a2('0x17'));var db=require(_0x48a2('0x18'))['db'];function respondWithStatusCode(_0x4b4951,_0x57b642){_0x57b642=_0x57b642||0xcc;return function(_0x266375){if(_0x266375){return _0x4b4951['sendStatus'](_0x57b642);}return _0x4b4951[_0x48a2('0x19')](_0x57b642)[_0x48a2('0x1a')]();};}function respondWithResult(_0x2c9386,_0x1afe75){_0x1afe75=_0x1afe75||0xc8;return function(_0x5604d9){if(_0x5604d9){return _0x2c9386[_0x48a2('0x19')](_0x1afe75)['json'](_0x5604d9);}};}function respondWithFilteredResult(_0x3a771e,_0x581b32){return function(_0x498f3c){if(_0x498f3c){var _0x44158f=typeof _0x581b32[_0x48a2('0x1b')]===_0x48a2('0x1c')&&typeof _0x581b32[_0x48a2('0x1d')]===_0x48a2('0x1c');var _0x391443=_0x498f3c[_0x48a2('0x1e')];var _0x1aa653=_0x44158f?0x0:_0x581b32[_0x48a2('0x1b')];var _0x1f5937=_0x44158f?_0x498f3c[_0x48a2('0x1e')]:_0x581b32['offset']+_0x581b32['limit'];var _0x1f3d36;if(_0x1f5937>=_0x391443){_0x1f5937=_0x391443;_0x1f3d36=0xc8;}else{_0x1f3d36=0xce;}_0x3a771e['status'](_0x1f3d36);return _0x3a771e[_0x48a2('0x1f')](_0x48a2('0x20'),_0x1aa653+'-'+_0x1f5937+'/'+_0x391443)[_0x48a2('0x21')](_0x498f3c);}return null;};}function patchUpdates(_0x1e3001){return function(_0x5573a5){try{jsonpatch[_0x48a2('0x22')](_0x5573a5,_0x1e3001,!![]);}catch(_0x2c849d){return BPromise[_0x48a2('0x23')](_0x2c849d);}return _0x5573a5['save']();};}function saveUpdates(_0x26a6c9,_0x4fc801){return function(_0x479262){if(_0x479262){return _0x479262['update'](_0x26a6c9)[_0x48a2('0x24')](function(_0x3302f7){return _0x3302f7;});}return null;};}function removeEntity(_0x1e697c,_0x443f5b){return function(_0x6c227b){if(_0x6c227b){return _0x6c227b[_0x48a2('0x25')]()['then'](function(){_0x1e697c[_0x48a2('0x19')](0xcc)[_0x48a2('0x1a')]();});}};}function handleEntityNotFound(_0x17bc1a,_0x56fe7c){return function(_0x598458){if(!_0x598458){_0x17bc1a['sendStatus'](0x194);}return _0x598458;};}function handleError(_0x4dd77f,_0x2306fd){_0x2306fd=_0x2306fd||0x1f4;return function(_0x3ed51a){logger[_0x48a2('0x26')](_0x3ed51a[_0x48a2('0x27')]);if(_0x3ed51a[_0x48a2('0x28')]){delete _0x3ed51a['name'];}_0x4dd77f[_0x48a2('0x19')](_0x2306fd)[_0x48a2('0x29')](_0x3ed51a);};}exports['index']=function(_0x3059dd,_0x42ca67){var _0x37a184={},_0x2eaa58={},_0x4d54f8={'count':0x0,'rows':[]};var _0x4e3e68=_[_0x48a2('0x2a')](db['AnalyticFieldReport']['rawAttributes'],function(_0x5897cb){return{'name':_0x5897cb[_0x48a2('0x2b')],'type':_0x5897cb[_0x48a2('0x2c')][_0x48a2('0x2d')]};});_0x2eaa58[_0x48a2('0x2e')]=_[_0x48a2('0x2a')](_0x4e3e68,'name');_0x2eaa58['query']=_[_0x48a2('0x2f')](_0x3059dd['query']);_0x2eaa58[_0x48a2('0x30')]=_[_0x48a2('0x31')](_0x2eaa58[_0x48a2('0x2e')],_0x2eaa58['query']);_0x37a184[_0x48a2('0x32')]=_[_0x48a2('0x31')](_0x2eaa58['model'],qs[_0x48a2('0x33')](_0x3059dd[_0x48a2('0x34')][_0x48a2('0x33')]));_0x37a184['attributes']=_0x37a184[_0x48a2('0x32')][_0x48a2('0x35')]?_0x37a184[_0x48a2('0x32')]:_0x2eaa58[_0x48a2('0x2e')];if(!_0x3059dd['query']['hasOwnProperty']('nolimit')){_0x37a184['limit']=qs[_0x48a2('0x1d')](_0x3059dd[_0x48a2('0x34')]['limit']);_0x37a184[_0x48a2('0x1b')]=qs['offset'](_0x3059dd[_0x48a2('0x34')][_0x48a2('0x1b')]);}_0x37a184[_0x48a2('0x36')]=qs[_0x48a2('0x37')](_0x3059dd['query']['sort']);_0x37a184[_0x48a2('0x38')]=qs[_0x48a2('0x30')](_['pick'](_0x3059dd[_0x48a2('0x34')],_0x2eaa58[_0x48a2('0x30')]),_0x4e3e68);if(_0x3059dd[_0x48a2('0x34')][_0x48a2('0x39')]){_0x37a184[_0x48a2('0x38')]=_[_0x48a2('0x3a')](_0x37a184[_0x48a2('0x38')],{'$or':_[_0x48a2('0x2a')](_0x4e3e68,function(_0x2c3e44){if(_0x2c3e44[_0x48a2('0x2c')]!==_0x48a2('0x3b')){var _0x559bf6={};_0x559bf6[_0x2c3e44[_0x48a2('0x28')]]={'$like':'%'+_0x3059dd[_0x48a2('0x34')]['filter']+'%'};return _0x559bf6;}})});}_0x37a184=_[_0x48a2('0x3a')]({},_0x37a184,_0x3059dd[_0x48a2('0x3c')]);var _0x5f5633={'where':_0x37a184[_0x48a2('0x38')]};return db[_0x48a2('0x3d')][_0x48a2('0x1e')](_0x5f5633)[_0x48a2('0x24')](function(_0x3b8f82){_0x4d54f8[_0x48a2('0x1e')]=_0x3b8f82;if(_0x3059dd['query'][_0x48a2('0x3e')]){_0x37a184['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x37a184);})[_0x48a2('0x24')](function(_0x39c5b7){_0x4d54f8[_0x48a2('0x3f')]=_0x39c5b7;return _0x4d54f8;})[_0x48a2('0x24')](respondWithFilteredResult(_0x42ca67,_0x37a184))[_0x48a2('0x40')](handleError(_0x42ca67,null));};exports[_0x48a2('0x41')]=function(_0x1907a6,_0x54eb9e){var _0x4cf422={'raw':![],'where':{'id':_0x1907a6['params']['id']}},_0x5f29b0={};_0x5f29b0[_0x48a2('0x2e')]=_[_0x48a2('0x2f')](db[_0x48a2('0x3d')][_0x48a2('0x42')]);_0x5f29b0[_0x48a2('0x34')]=_[_0x48a2('0x2f')](_0x1907a6[_0x48a2('0x34')]);_0x5f29b0['filters']=_[_0x48a2('0x31')](_0x5f29b0['model'],_0x5f29b0[_0x48a2('0x34')]);_0x4cf422[_0x48a2('0x32')]=_[_0x48a2('0x31')](_0x5f29b0[_0x48a2('0x2e')],qs['fields'](_0x1907a6[_0x48a2('0x34')][_0x48a2('0x33')]));_0x4cf422[_0x48a2('0x32')]=_0x4cf422[_0x48a2('0x32')][_0x48a2('0x35')]?_0x4cf422[_0x48a2('0x32')]:_0x5f29b0[_0x48a2('0x2e')];if(_0x1907a6[_0x48a2('0x34')][_0x48a2('0x3e')]){_0x4cf422[_0x48a2('0x43')]=[{'all':!![]}];}_0x4cf422=_['merge']({},_0x4cf422,_0x1907a6[_0x48a2('0x3c')]);return db[_0x48a2('0x3d')][_0x48a2('0x44')](_0x4cf422)[_0x48a2('0x24')](handleEntityNotFound(_0x54eb9e,null))[_0x48a2('0x24')](respondWithResult(_0x54eb9e,null))[_0x48a2('0x40')](handleError(_0x54eb9e,null));};exports[_0x48a2('0x45')]=function(_0xdad143,_0x32f5b7){return db[_0x48a2('0x3d')][_0x48a2('0x45')](_0xdad143[_0x48a2('0x46')],{})[_0x48a2('0x24')](respondWithResult(_0x32f5b7,0xc9))[_0x48a2('0x40')](handleError(_0x32f5b7,null));};exports[_0x48a2('0x47')]=function(_0x1d5cc2,_0x525de2){return db[_0x48a2('0x3d')][_0x48a2('0x47')](_0x1d5cc2[_0x48a2('0x46')],{'raw':![],'individualHooks':!![]})[_0x48a2('0x24')](respondWithResult(_0x525de2,0xc9))[_0x48a2('0x40')](handleError(_0x525de2,null));};exports[_0x48a2('0x48')]=function(_0x569d40,_0x245581){if(_0x569d40['body']['id']){delete _0x569d40[_0x48a2('0x46')]['id'];}return db[_0x48a2('0x3d')][_0x48a2('0x44')]({'where':{'id':_0x569d40['params']['id']}})[_0x48a2('0x24')](handleEntityNotFound(_0x245581,null))[_0x48a2('0x24')](saveUpdates(_0x569d40[_0x48a2('0x46')],null))['then'](respondWithResult(_0x245581,null))[_0x48a2('0x40')](handleError(_0x245581,null));};exports[_0x48a2('0x25')]=function(_0x5de387,_0x5b791f){return db[_0x48a2('0x3d')][_0x48a2('0x44')]({'where':{'id':_0x5de387[_0x48a2('0x49')]['id']}})[_0x48a2('0x24')](handleEntityNotFound(_0x5b791f,null))['then'](removeEntity(_0x5b791f,null))['catch'](handleError(_0x5b791f,null));};exports[_0x48a2('0x4a')]=function(_0xa260a9,_0x1ced1b){return db[_0x48a2('0x3d')][_0x48a2('0x25')]({'where':{'id':_0xa260a9[_0x48a2('0x34')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x48a2('0x24')](respondWithResult(_0x1ced1b,0xcc))[_0x48a2('0x40')](handleError(_0x1ced1b,null));};exports[_0x48a2('0x4b')]=function(_0x54bb23,_0x528168,_0x3b531f){return db[_0x48a2('0x4c')][_0x48a2('0x4d')]({'where':{'id':_0x54bb23[_0x48a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x528168,null))[_0x48a2('0x24')](function(_0x512ab8){if(_0x512ab8){return db[_0x48a2('0x4e')]['transaction'](function(_0x47f95c){return db[_0x48a2('0x3d')][_0x48a2('0x25')]({'where':{'CustomReportId':_0x54bb23[_0x48a2('0x49')]['id']},'transaction':_0x47f95c})['then'](function(_0x5ddadb){var _0x4cd033=_[_0x48a2('0x2a')](_0x54bb23[_0x48a2('0x46')],function(_0x1ab9da){delete _0x1ab9da['id'];_0x1ab9da[_0x48a2('0x4f')]=_0x54bb23[_0x48a2('0x49')]['id'];return _0x1ab9da;});return db[_0x48a2('0x3d')][_0x48a2('0x47')](_0x4cd033,{'transaction':_0x47f95c});});})['then'](function(){return db[_0x48a2('0x3d')][_0x48a2('0x50')]({'where':{'CustomReportId':_0x54bb23[_0x48a2('0x49')]['id']}});});}})['then'](respondWithResult(_0x528168,null))[_0x48a2('0x40')](handleError(_0x528168,null));}; \ No newline at end of file +var _0xeb5f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','sendStatus','error','name','index','AnalyticFieldReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','bulkCreate','ids','findOne','sequelize','transaction'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0xeb5f,0x1c8));var _0xfeb5=function(_0x499fd3,_0x204a61){_0x499fd3=_0x499fd3-0x0;var _0x4a515f=_0xeb5f[_0x499fd3];return _0x4a515f;};'use strict';var emlformat=require(_0xfeb5('0x0'));var rimraf=require(_0xfeb5('0x1'));var zipdir=require(_0xfeb5('0x2'));var jsonpatch=require(_0xfeb5('0x3'));var rp=require(_0xfeb5('0x4'));var moment=require('moment');var BPromise=require(_0xfeb5('0x5'));var Mustache=require('mustache');var util=require(_0xfeb5('0x6'));var path=require(_0xfeb5('0x7'));var sox=require(_0xfeb5('0x8'));var csv=require(_0xfeb5('0x9'));var ejs=require(_0xfeb5('0xa'));var fs=require('fs');var fs_extra=require(_0xfeb5('0xb'));var _=require(_0xfeb5('0xc'));var squel=require(_0xfeb5('0xd'));var crypto=require(_0xfeb5('0xe'));var jsforce=require(_0xfeb5('0xf'));var deskjs=require(_0xfeb5('0x10'));var toCsv=require(_0xfeb5('0x9'));var querystring=require(_0xfeb5('0x11'));var Papa=require('papaparse');var Redis=require(_0xfeb5('0x12'));var authService=require(_0xfeb5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfeb5('0x14'));var logger=require(_0xfeb5('0x15'))(_0xfeb5('0x16'));var utils=require(_0xfeb5('0x17'));var config=require(_0xfeb5('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a150f,_0x13e11b){_0x13e11b=_0x13e11b||0xcc;return function(_0x1dc106){if(_0x1dc106){return _0x3a150f['sendStatus'](_0x13e11b);}return _0x3a150f[_0xfeb5('0x19')](_0x13e11b)[_0xfeb5('0x1a')]();};}function respondWithResult(_0x3e4148,_0x2e03b0){_0x2e03b0=_0x2e03b0||0xc8;return function(_0x2d50e7){if(_0x2d50e7){return _0x3e4148[_0xfeb5('0x19')](_0x2e03b0)[_0xfeb5('0x1b')](_0x2d50e7);}};}function respondWithFilteredResult(_0x2d58c2,_0x5c5b1e){return function(_0x4c27bc){if(_0x4c27bc){var _0x5e26e7=typeof _0x5c5b1e[_0xfeb5('0x1c')]==='undefined'&&typeof _0x5c5b1e[_0xfeb5('0x1d')]===_0xfeb5('0x1e');var _0x5e2307=_0x4c27bc['count'];var _0x2d3962=_0x5e26e7?0x0:_0x5c5b1e['offset'];var _0x260248=_0x5e26e7?_0x4c27bc[_0xfeb5('0x1f')]:_0x5c5b1e[_0xfeb5('0x1c')]+_0x5c5b1e[_0xfeb5('0x1d')];var _0x18a5c3;if(_0x260248>=_0x5e2307){_0x260248=_0x5e2307;_0x18a5c3=0xc8;}else{_0x18a5c3=0xce;}_0x2d58c2[_0xfeb5('0x19')](_0x18a5c3);return _0x2d58c2[_0xfeb5('0x20')](_0xfeb5('0x21'),_0x2d3962+'-'+_0x260248+'/'+_0x5e2307)[_0xfeb5('0x1b')](_0x4c27bc);}return null;};}function patchUpdates(_0x5cc38a){return function(_0x5d78ae){try{jsonpatch['apply'](_0x5d78ae,_0x5cc38a,!![]);}catch(_0x5d7d69){return BPromise[_0xfeb5('0x22')](_0x5d7d69);}return _0x5d78ae['save']();};}function saveUpdates(_0xc5a4e4,_0x2a0ae8){return function(_0x58493d){if(_0x58493d){return _0x58493d[_0xfeb5('0x23')](_0xc5a4e4)['then'](function(_0x487e87){return _0x487e87;});}return null;};}function removeEntity(_0x4bee04,_0x4ffc18){return function(_0x2449f8){if(_0x2449f8){return _0x2449f8[_0xfeb5('0x24')]()[_0xfeb5('0x25')](function(){_0x4bee04[_0xfeb5('0x19')](0xcc)[_0xfeb5('0x1a')]();});}};}function handleEntityNotFound(_0x465f73,_0x31da3d){return function(_0x3883fb){if(!_0x3883fb){_0x465f73[_0xfeb5('0x26')](0x194);}return _0x3883fb;};}function handleError(_0x3f9003,_0x450637){_0x450637=_0x450637||0x1f4;return function(_0x163da6){logger[_0xfeb5('0x27')](_0x163da6['stack']);if(_0x163da6[_0xfeb5('0x28')]){delete _0x163da6[_0xfeb5('0x28')];}_0x3f9003[_0xfeb5('0x19')](_0x450637)['send'](_0x163da6);};}exports[_0xfeb5('0x29')]=function(_0x28502a,_0x226b20){var _0x4a4edc={},_0x46e28a={},_0xd7efce={'count':0x0,'rows':[]};var _0x4c4341=_['map'](db[_0xfeb5('0x2a')][_0xfeb5('0x2b')],function(_0x5c43b0){return{'name':_0x5c43b0['fieldName'],'type':_0x5c43b0[_0xfeb5('0x2c')][_0xfeb5('0x2d')]};});_0x46e28a[_0xfeb5('0x2e')]=_[_0xfeb5('0x2f')](_0x4c4341,_0xfeb5('0x28'));_0x46e28a[_0xfeb5('0x30')]=_[_0xfeb5('0x31')](_0x28502a[_0xfeb5('0x30')]);_0x46e28a['filters']=_[_0xfeb5('0x32')](_0x46e28a[_0xfeb5('0x2e')],_0x46e28a['query']);_0x4a4edc[_0xfeb5('0x33')]=_['intersection'](_0x46e28a[_0xfeb5('0x2e')],qs['fields'](_0x28502a['query'][_0xfeb5('0x34')]));_0x4a4edc['attributes']=_0x4a4edc[_0xfeb5('0x33')][_0xfeb5('0x35')]?_0x4a4edc[_0xfeb5('0x33')]:_0x46e28a[_0xfeb5('0x2e')];if(!_0x28502a[_0xfeb5('0x30')][_0xfeb5('0x36')]('nolimit')){_0x4a4edc[_0xfeb5('0x1d')]=qs[_0xfeb5('0x1d')](_0x28502a[_0xfeb5('0x30')][_0xfeb5('0x1d')]);_0x4a4edc[_0xfeb5('0x1c')]=qs['offset'](_0x28502a[_0xfeb5('0x30')][_0xfeb5('0x1c')]);}_0x4a4edc[_0xfeb5('0x37')]=qs[_0xfeb5('0x38')](_0x28502a[_0xfeb5('0x30')][_0xfeb5('0x38')]);_0x4a4edc[_0xfeb5('0x39')]=qs[_0xfeb5('0x3a')](_[_0xfeb5('0x3b')](_0x28502a[_0xfeb5('0x30')],_0x46e28a[_0xfeb5('0x3a')]),_0x4c4341);if(_0x28502a[_0xfeb5('0x30')][_0xfeb5('0x3c')]){_0x4a4edc['where']=_[_0xfeb5('0x3d')](_0x4a4edc[_0xfeb5('0x39')],{'$or':_[_0xfeb5('0x2f')](_0x4c4341,function(_0x29c605){if(_0x29c605[_0xfeb5('0x2c')]!=='VIRTUAL'){var _0x138de4={};_0x138de4[_0x29c605[_0xfeb5('0x28')]]={'$like':'%'+_0x28502a[_0xfeb5('0x30')][_0xfeb5('0x3c')]+'%'};return _0x138de4;}})});}_0x4a4edc=_[_0xfeb5('0x3d')]({},_0x4a4edc,_0x28502a[_0xfeb5('0x3e')]);var _0x75e5d1={'where':_0x4a4edc[_0xfeb5('0x39')]};return db[_0xfeb5('0x2a')]['count'](_0x75e5d1)[_0xfeb5('0x25')](function(_0x7f6b3e){_0xd7efce[_0xfeb5('0x1f')]=_0x7f6b3e;if(_0x28502a[_0xfeb5('0x30')][_0xfeb5('0x3f')]){_0x4a4edc[_0xfeb5('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x4a4edc);})[_0xfeb5('0x25')](function(_0x45a083){_0xd7efce['rows']=_0x45a083;return _0xd7efce;})[_0xfeb5('0x25')](respondWithFilteredResult(_0x226b20,_0x4a4edc))[_0xfeb5('0x41')](handleError(_0x226b20,null));};exports[_0xfeb5('0x42')]=function(_0x471477,_0x3d390b){var _0x4a7f6f={'raw':![],'where':{'id':_0x471477[_0xfeb5('0x43')]['id']}},_0x38e391={};_0x38e391['model']=_[_0xfeb5('0x31')](db[_0xfeb5('0x2a')][_0xfeb5('0x2b')]);_0x38e391[_0xfeb5('0x30')]=_['keys'](_0x471477[_0xfeb5('0x30')]);_0x38e391[_0xfeb5('0x3a')]=_[_0xfeb5('0x32')](_0x38e391['model'],_0x38e391[_0xfeb5('0x30')]);_0x4a7f6f['attributes']=_[_0xfeb5('0x32')](_0x38e391['model'],qs[_0xfeb5('0x34')](_0x471477['query'][_0xfeb5('0x34')]));_0x4a7f6f[_0xfeb5('0x33')]=_0x4a7f6f[_0xfeb5('0x33')][_0xfeb5('0x35')]?_0x4a7f6f['attributes']:_0x38e391['model'];if(_0x471477[_0xfeb5('0x30')][_0xfeb5('0x3f')]){_0x4a7f6f['include']=[{'all':!![]}];}_0x4a7f6f=_['merge']({},_0x4a7f6f,_0x471477[_0xfeb5('0x3e')]);return db[_0xfeb5('0x2a')][_0xfeb5('0x44')](_0x4a7f6f)['then'](handleEntityNotFound(_0x3d390b,null))['then'](respondWithResult(_0x3d390b,null))[_0xfeb5('0x41')](handleError(_0x3d390b,null));};exports[_0xfeb5('0x45')]=function(_0x46494c,_0x2bc4c8){return db[_0xfeb5('0x2a')][_0xfeb5('0x45')](_0x46494c[_0xfeb5('0x46')],{})[_0xfeb5('0x25')](respondWithResult(_0x2bc4c8,0xc9))[_0xfeb5('0x41')](handleError(_0x2bc4c8,null));};exports['bulkCreate']=function(_0x43acda,_0x24a0f7){return db[_0xfeb5('0x2a')][_0xfeb5('0x47')](_0x43acda[_0xfeb5('0x46')],{'raw':![],'individualHooks':!![]})[_0xfeb5('0x25')](respondWithResult(_0x24a0f7,0xc9))[_0xfeb5('0x41')](handleError(_0x24a0f7,null));};exports[_0xfeb5('0x23')]=function(_0x4f4a1d,_0x143061){if(_0x4f4a1d[_0xfeb5('0x46')]['id']){delete _0x4f4a1d['body']['id'];}return db[_0xfeb5('0x2a')][_0xfeb5('0x44')]({'where':{'id':_0x4f4a1d['params']['id']}})[_0xfeb5('0x25')](handleEntityNotFound(_0x143061,null))[_0xfeb5('0x25')](saveUpdates(_0x4f4a1d[_0xfeb5('0x46')],null))[_0xfeb5('0x25')](respondWithResult(_0x143061,null))['catch'](handleError(_0x143061,null));};exports['destroy']=function(_0x5ac104,_0x5e87b9){return db[_0xfeb5('0x2a')]['find']({'where':{'id':_0x5ac104[_0xfeb5('0x43')]['id']}})[_0xfeb5('0x25')](handleEntityNotFound(_0x5e87b9,null))[_0xfeb5('0x25')](removeEntity(_0x5e87b9,null))['catch'](handleError(_0x5e87b9,null));};exports['bulkDestroy']=function(_0x566e44,_0x8894c3){return db['AnalyticFieldReport'][_0xfeb5('0x24')]({'where':{'id':_0x566e44['query'][_0xfeb5('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xfeb5('0x25')](respondWithResult(_0x8894c3,0xcc))['catch'](handleError(_0x8894c3,null));};exports['addFields']=function(_0x354bd2,_0x42e5f6,_0x16478d){return db['AnalyticCustomReport'][_0xfeb5('0x49')]({'where':{'id':_0x354bd2[_0xfeb5('0x43')]['id']}})['then'](handleEntityNotFound(_0x42e5f6,null))[_0xfeb5('0x25')](function(_0x310472){if(_0x310472){return db[_0xfeb5('0x4a')][_0xfeb5('0x4b')](function(_0x1a685d){return db['AnalyticFieldReport'][_0xfeb5('0x24')]({'where':{'CustomReportId':_0x354bd2[_0xfeb5('0x43')]['id']},'transaction':_0x1a685d})[_0xfeb5('0x25')](function(_0x270b6f){var _0x4c1adc=_[_0xfeb5('0x2f')](_0x354bd2[_0xfeb5('0x46')],function(_0x4d610b){delete _0x4d610b['id'];_0x4d610b['CustomReportId']=_0x354bd2[_0xfeb5('0x43')]['id'];return _0x4d610b;});return db[_0xfeb5('0x2a')][_0xfeb5('0x47')](_0x4c1adc,{'transaction':_0x1a685d});});})[_0xfeb5('0x25')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x354bd2['params']['id']}});});}})[_0xfeb5('0x25')](respondWithResult(_0x42e5f6,null))['catch'](handleError(_0x42e5f6,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ffdf471..21f5161 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 _0x5a93=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','util'];(function(_0x243345,_0x25b3c1){var _0x16881d=function(_0x446f75){while(--_0x446f75){_0x243345['push'](_0x243345['shift']());}};_0x16881d(++_0x25b3c1);}(_0x5a93,0x128));var _0x35a9=function(_0x19b052,_0x55c9d1){_0x19b052=_0x19b052-0x0;var _0xf3acf2=_0x5a93[_0x19b052];return _0xf3acf2;};'use strict';var _=require('lodash');var util=require(_0x35a9('0x0'));var logger=require(_0x35a9('0x1'))('api');var moment=require(_0x35a9('0x2'));var BPromise=require('bluebird');var rp=require(_0x35a9('0x3'));var fs=require('fs');var path=require(_0x35a9('0x4'));var rimraf=require(_0x35a9('0x5'));var config=require(_0x35a9('0x6'));var attributes=require(_0x35a9('0x7'));module[_0x35a9('0x8')]=function(_0x525323,_0xd9c9c7){return _0x525323[_0x35a9('0x9')](_0x35a9('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe66c=['../../config/environment','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x2a7e1a,_0xd188fa){var _0x202852=function(_0x382afc){while(--_0x382afc){_0x2a7e1a['push'](_0x2a7e1a['shift']());}};_0x202852(++_0xd188fa);}(_0xe66c,0x1b2));var _0xce66=function(_0x51a960,_0x383ab8){_0x51a960=_0x51a960-0x0;var _0x2a9b18=_0xe66c[_0x51a960];return _0x2a9b18;};'use strict';var _=require(_0xce66('0x0'));var util=require(_0xce66('0x1'));var logger=require(_0xce66('0x2'))(_0xce66('0x3'));var moment=require('moment');var BPromise=require(_0xce66('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce66('0x5'));var config=require(_0xce66('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0xce66('0x7')]=function(_0x5d926a,_0x268c2){return _0x5d926a['define'](_0xce66('0x8'),attributes,{'tableName':_0xce66('0x9'),'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 5fffe25..459faed 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 _0x74c1=['../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x440917,_0x20ea7b){var _0x5e906b=function(_0x27cba5){while(--_0x27cba5){_0x440917['push'](_0x440917['shift']());}};_0x5e906b(++_0x20ea7b);}(_0x74c1,0x1b3));var _0x174c=function(_0x1526bf,_0x1d728c){_0x1526bf=_0x1526bf-0x0;var _0x13eb64=_0x74c1[_0x1526bf];return _0x13eb64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x174c('0x0'));var BPromise=require(_0x174c('0x1'));var rs=require(_0x174c('0x2'));var fs=require('fs');var Redis=require(_0x174c('0x3'));var db=require(_0x174c('0x4'))['db'];var utils=require(_0x174c('0x5'));var logger=require('../../config/logger')(_0x174c('0x6'));var config=require('../../config/environment');var jayson=require(_0x174c('0x7'));var client=jayson['client'][_0x174c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ab116,_0xd3a4fe,_0xe40e1){return new BPromise(function(_0x57ce3c,_0x207d90){return client[_0x174c('0x9')](_0x1ab116,_0xe40e1)[_0x174c('0xa')](function(_0x1c1921){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xd3a4fe,_0x174c('0xb'));logger[_0x174c('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xd3a4fe,_0x174c('0xb'),JSON[_0x174c('0xd')](_0x1c1921));if(_0x1c1921[_0x174c('0xe')]){if(_0x1c1921[_0x174c('0xe')][_0x174c('0xf')]===0x1f4){logger[_0x174c('0xe')](_0x174c('0x10'),_0xd3a4fe,_0x1c1921['error'][_0x174c('0x11')]);return _0x207d90(_0x1c1921[_0x174c('0xe')]['message']);}logger[_0x174c('0xe')](_0x174c('0x10'),_0xd3a4fe,_0x1c1921['error'][_0x174c('0x11')]);return _0x57ce3c(_0x1c1921[_0x174c('0xe')][_0x174c('0x11')]);}else{logger[_0x174c('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd3a4fe,_0x174c('0xb'));_0x57ce3c(_0x1c1921[_0x174c('0x13')][_0x174c('0x11')]);}})['catch'](function(_0x48eafc){logger[_0x174c('0xe')](_0x174c('0x10'),_0xd3a4fe,_0x48eafc);_0x207d90(_0x48eafc);});});} \ No newline at end of file +var _0x78ca=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3b88f0,_0x200fee){var _0x9c6b9a=function(_0x31d6a9){while(--_0x31d6a9){_0x3b88f0['push'](_0x3b88f0['shift']());}};_0x9c6b9a(++_0x200fee);}(_0x78ca,0xee));var _0xa78c=function(_0x2825e8,_0x4b49ba){_0x2825e8=_0x2825e8-0x0;var _0x2ce74c=_0x78ca[_0x2825e8];return _0x2ce74c;};'use strict';var _=require(_0xa78c('0x0'));var util=require(_0xa78c('0x1'));var moment=require(_0xa78c('0x2'));var BPromise=require(_0xa78c('0x3'));var rs=require(_0xa78c('0x4'));var fs=require('fs');var Redis=require(_0xa78c('0x5'));var db=require(_0xa78c('0x6'))['db'];var utils=require(_0xa78c('0x7'));var logger=require('../../config/logger')(_0xa78c('0x8'));var config=require('../../config/environment');var jayson=require(_0xa78c('0x9'));var client=jayson[_0xa78c('0xa')][_0xa78c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfce202,_0x584f69,_0x191ef8){return new BPromise(function(_0x3897dc,_0x46324b){return client[_0xa78c('0xc')](_0xfce202,_0x191ef8)[_0xa78c('0xd')](function(_0xdae7f9){logger[_0xa78c('0xe')](_0xa78c('0xf'),_0x584f69,_0xa78c('0x10'));logger[_0xa78c('0x11')](_0xa78c('0x12'),_0x584f69,_0xa78c('0x10'),JSON[_0xa78c('0x13')](_0xdae7f9));if(_0xdae7f9[_0xa78c('0x14')]){if(_0xdae7f9[_0xa78c('0x14')][_0xa78c('0x15')]===0x1f4){logger[_0xa78c('0x14')](_0xa78c('0xf'),_0x584f69,_0xdae7f9[_0xa78c('0x14')][_0xa78c('0x16')]);return _0x46324b(_0xdae7f9[_0xa78c('0x14')][_0xa78c('0x16')]);}logger[_0xa78c('0x14')](_0xa78c('0xf'),_0x584f69,_0xdae7f9['error']['message']);return _0x3897dc(_0xdae7f9['error']['message']);}else{logger[_0xa78c('0xe')](_0xa78c('0xf'),_0x584f69,_0xa78c('0x10'));_0x3897dc(_0xdae7f9['result'][_0xa78c('0x16')]);}})['catch'](function(_0x13625f){logger[_0xa78c('0x14')](_0xa78c('0xf'),_0x584f69,_0x13625f);_0x46324b(_0x13625f);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c3a53c6..90febd1 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(_0x20c740,_0x5b88bb){var _0x227312=function(_0x1ec742){while(--_0x1ec742){_0x20c740['push'](_0x20c740['shift']());}};_0x227312(++_0x5b88bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x359a7b,_0x422cd7){var _0xe0f88b=function(_0x520599){while(--_0x520599){_0x359a7b['push'](_0x359a7b['shift']());}};_0xe0f88b(++_0x422cd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 d615d99..d630cf2 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 _0xa9e0=['exports','STRING','TEXT','sequelize'];(function(_0x354a81,_0x77297b){var _0x4139d1=function(_0x1b98d3){while(--_0x1b98d3){_0x354a81['push'](_0x354a81['shift']());}};_0x4139d1(++_0x77297b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x0a9e('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1752=['TEXT','exports','STRING','name'];(function(_0x558615,_0x1eb496){var _0x1e032a=function(_0x538f1d){while(--_0x538f1d){_0x558615['push'](_0x558615['shift']());}};_0x1e032a(++_0x1eb496);}(_0x1752,0xa5));var _0x2175=function(_0x2114a0,_0x1ba2e2){_0x2114a0=_0x2114a0-0x0;var _0x244ce6=_0x1752[_0x2114a0];return _0x244ce6;};'use strict';var Sequelize=require('sequelize');module[_0x2175('0x0')]={'name':{'type':Sequelize[_0x2175('0x1')],'allowNull':![],'unique':_0x2175('0x2')},'table':{'type':Sequelize[_0x2175('0x1')]},'metric':{'type':Sequelize[_0x2175('0x3')]},'description':{'type':Sequelize[_0x2175('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a28af5a..6d0722d 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 _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x7da7,0x10d));var _0x77da=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x7da7[_0x34c027];return _0x47bff0;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,null));}; \ No newline at end of file +var _0x8d0e=['then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy'];(function(_0x1f43f4,_0x16d500){var _0x5435b7=function(_0x54f029){while(--_0x54f029){_0x1f43f4['push'](_0x1f43f4['shift']());}};_0x5435b7(++_0x16d500);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2be564,_0x1ebda2){_0x2be564=_0x2be564-0x0;var _0x1703a3=_0x8d0e[_0x2be564];return _0x1703a3;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){var _0xd86c76=_0x106614[_0xe8d0('0x28')]({'plain':!![]});var _0x149dfd=_0xe8d0('0x29');return db[_0xe8d0('0x2a')][_0xe8d0('0x26')]({'where':{'type':_0x149dfd,'resourceId':_0xd86c76['id']}})[_0xe8d0('0x27')](function(){return _0x106614;});})[_0xe8d0('0x27')](function(){_0x9f747['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x26dd52,_0x10dec2){return function(_0x486f49){if(!_0x486f49){_0x26dd52[_0xe8d0('0x2c')](0x194);}return _0x486f49;};}function handleError(_0x343b08,_0x526240){_0x526240=_0x526240||0x1f4;return function(_0x1519e2){logger[_0xe8d0('0x2d')](_0x1519e2[_0xe8d0('0x2e')]);if(_0x1519e2[_0xe8d0('0x2f')]){delete _0x1519e2[_0xe8d0('0x2f')];}_0x343b08['status'](_0x526240)[_0xe8d0('0x30')](_0x1519e2);};}exports['index']=function(_0x5d3276,_0x50ad3c){var _0x547a2b={},_0x13cd4c={},_0x36ccec={'count':0x0,'rows':[]};var _0x5151fa=_['map'](db[_0xe8d0('0x31')]['rawAttributes'],function(_0x3b5d31){return{'name':_0x3b5d31[_0xe8d0('0x32')],'type':_0x3b5d31[_0xe8d0('0x33')][_0xe8d0('0x34')]};});_0x13cd4c[_0xe8d0('0x35')]=_['map'](_0x5151fa,_0xe8d0('0x2f'));_0x13cd4c[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x5d3276[_0xe8d0('0x36')]);_0x13cd4c['filters']=_[_0xe8d0('0x38')](_0x13cd4c[_0xe8d0('0x35')],_0x13cd4c['query']);_0x547a2b[_0xe8d0('0x39')]=_['intersection'](_0x13cd4c[_0xe8d0('0x35')],qs['fields'](_0x5d3276[_0xe8d0('0x36')]['fields']));_0x547a2b[_0xe8d0('0x39')]=_0x547a2b[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x547a2b[_0xe8d0('0x39')]:_0x13cd4c['model'];if(!_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x547a2b['limit']=qs[_0xe8d0('0x1e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x1e')]);_0x547a2b[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x5d3276['query'][_0xe8d0('0x1f')]);}_0x547a2b[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3e')]);_0x547a2b[_0xe8d0('0x3f')]=qs[_0xe8d0('0x40')](_[_0xe8d0('0x41')](_0x5d3276['query'],_0x13cd4c['filters']),_0x5151fa);if(_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x42')]){_0x547a2b[_0xe8d0('0x3f')]=_[_0xe8d0('0x43')](_0x547a2b[_0xe8d0('0x3f')],{'$or':_['map'](_0x5151fa,function(_0x2e4362){if(_0x2e4362['type']!==_0xe8d0('0x44')){var _0x458294={};_0x458294[_0x2e4362[_0xe8d0('0x2f')]]={'$like':'%'+_0x5d3276['query'][_0xe8d0('0x42')]+'%'};return _0x458294;}})});}_0x547a2b=_[_0xe8d0('0x43')]({},_0x547a2b,_0x5d3276[_0xe8d0('0x45')]);var _0x230a90={'where':_0x547a2b[_0xe8d0('0x3f')]};return db['AnalyticMetric']['count'](_0x230a90)['then'](function(_0x4cf0da){_0x36ccec[_0xe8d0('0x20')]=_0x4cf0da;if(_0x5d3276['query'][_0xe8d0('0x46')]){_0x547a2b[_0xe8d0('0x47')]=[{'all':!![]}];}return db[_0xe8d0('0x31')][_0xe8d0('0x48')](_0x547a2b);})[_0xe8d0('0x27')](function(_0x1156da){_0x36ccec[_0xe8d0('0x49')]=_0x1156da;return _0x36ccec;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x50ad3c,_0x547a2b))['catch'](handleError(_0x50ad3c,null));};exports[_0xe8d0('0x4a')]=function(_0x1da8b2,_0x4a3740){var _0x4bcdff={'raw':!![],'where':{'id':_0x1da8b2[_0xe8d0('0x4b')]['id']}},_0x3825a1={};_0x3825a1[_0xe8d0('0x35')]=_['keys'](db[_0xe8d0('0x31')][_0xe8d0('0x4c')]);_0x3825a1['query']=_[_0xe8d0('0x37')](_0x1da8b2[_0xe8d0('0x36')]);_0x3825a1['filters']=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],_0x3825a1[_0xe8d0('0x36')]);_0x4bcdff[_0xe8d0('0x39')]=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],qs[_0xe8d0('0x4d')](_0x1da8b2[_0xe8d0('0x36')]['fields']));_0x4bcdff[_0xe8d0('0x39')]=_0x4bcdff[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x4bcdff[_0xe8d0('0x39')]:_0x3825a1[_0xe8d0('0x35')];if(_0x1da8b2[_0xe8d0('0x36')][_0xe8d0('0x46')]){_0x4bcdff[_0xe8d0('0x47')]=[{'all':!![]}];}_0x4bcdff=_[_0xe8d0('0x43')]({},_0x4bcdff,_0x1da8b2[_0xe8d0('0x45')]);return db[_0xe8d0('0x31')][_0xe8d0('0x4e')](_0x4bcdff)['then'](handleEntityNotFound(_0x4a3740,null))[_0xe8d0('0x27')](respondWithResult(_0x4a3740,null))[_0xe8d0('0x4f')](handleError(_0x4a3740,null));};exports[_0xe8d0('0x50')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x31')][_0xe8d0('0x50')](_0xad7d94['body'],{})[_0xe8d0('0x27')](function(_0x424764){var _0x151cf4=_0xad7d94[_0xe8d0('0x51')]['get']({'plain':!![]});if(!_0x151cf4)throw new Error(_0xe8d0('0x52'));if(_0x151cf4['role']===_0xe8d0('0x51')){var _0x382ae9=_0x424764[_0xe8d0('0x28')]({'plain':!![]});var _0x158d24=_0xe8d0('0x29');return db[_0xe8d0('0x53')][_0xe8d0('0x4e')]({'where':{'name':_0x158d24,'userProfileId':_0x151cf4['userProfileId']},'raw':!![]})[_0xe8d0('0x27')](function(_0x55f93d){if(_0x55f93d&&_0x55f93d['autoAssociation']===0x0){return db[_0xe8d0('0x2a')]['create']({'name':_0x382ae9[_0xe8d0('0x2f')],'resourceId':_0x382ae9['id'],'type':_0x55f93d['name'],'sectionId':_0x55f93d['id']},{})[_0xe8d0('0x27')](function(){return _0x424764;});}else{return _0x424764;}})[_0xe8d0('0x4f')](function(_0x13713c){logger[_0xe8d0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13713c);throw _0x13713c;});}return _0x424764;})[_0xe8d0('0x27')](respondWithResult(_0x34047c,0xc9))[_0xe8d0('0x4f')](handleError(_0x34047c,null));};exports[_0xe8d0('0x25')]=function(_0x2e3f1d,_0x18cc14){if(_0x2e3f1d['body']['id']){delete _0x2e3f1d[_0xe8d0('0x54')]['id'];}return db[_0xe8d0('0x31')][_0xe8d0('0x4e')]({'where':{'id':_0x2e3f1d['params']['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x18cc14,null))['then'](saveUpdates(_0x2e3f1d['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x18cc14,null))[_0xe8d0('0x4f')](handleError(_0x18cc14,null));};exports['destroy']=function(_0xcb6ce2,_0x3a8074){return db['AnalyticMetric'][_0xe8d0('0x4e')]({'where':{'id':_0xcb6ce2[_0xe8d0('0x4b')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x3a8074,null))[_0xe8d0('0x27')](removeEntity(_0x3a8074,null))['catch'](handleError(_0x3a8074,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 91545bc..53bc57b 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 _0x5549=['rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x359aa2,_0x331149){var _0x28742d=function(_0xc5a1be){while(--_0xc5a1be){_0x359aa2['push'](_0x359aa2['shift']());}};_0x28742d(++_0x331149);}(_0x5549,0x1f4));var _0x9554=function(_0x446e12,_0xcca17b){_0x446e12=_0x446e12-0x0;var _0x3e31c2=_0x5549[_0x446e12];return _0x3e31c2;};'use strict';var _=require(_0x9554('0x0'));var util=require(_0x9554('0x1'));var logger=require(_0x9554('0x2'))(_0x9554('0x3'));var moment=require(_0x9554('0x4'));var BPromise=require('bluebird');var rp=require(_0x9554('0x5'));var fs=require('fs');var path=require(_0x9554('0x6'));var rimraf=require(_0x9554('0x7'));var config=require(_0x9554('0x8'));var attributes=require(_0x9554('0x9'));module['exports']=function(_0x3a0631,_0x4e8442){return _0x3a0631[_0x9554('0xa')](_0x9554('0xb'),attributes,{'tableName':_0x9554('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bae=['../../config/environment','exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x336d1c,_0x513b95){var _0x25c4cf=function(_0x1881bf){while(--_0x1881bf){_0x336d1c['push'](_0x336d1c['shift']());}};_0x25c4cf(++_0x513b95);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe2ba('0x0'));var util=require(_0xe2ba('0x1'));var logger=require(_0xe2ba('0x2'))(_0xe2ba('0x3'));var moment=require(_0xe2ba('0x4'));var BPromise=require(_0xe2ba('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ba('0x6'));var rimraf=require('rimraf');var config=require(_0xe2ba('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xe2ba('0x8')]=function(_0x129677,_0x21601e){return _0x129677['define'](_0xe2ba('0x9'),attributes,{'tableName':_0xe2ba('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 5471d8b..5d4a501 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 _0x8efb=['util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash'];(function(_0x16dd98,_0x11d346){var _0xfc7fb3=function(_0x40d7d8){while(--_0x40d7d8){_0x16dd98['push'](_0x16dd98['shift']());}};_0xfc7fb3(++_0x11d346);}(_0x8efb,0x1da));var _0xb8ef=function(_0x10ebac,_0x295199){_0x10ebac=_0x10ebac-0x0;var _0x263908=_0x8efb[_0x10ebac];return _0x263908;};'use strict';var _=require(_0xb8ef('0x0'));var util=require(_0xb8ef('0x1'));var moment=require('moment');var BPromise=require(_0xb8ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8ef('0x3'));var db=require(_0xb8ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8ef('0x5'))(_0xb8ef('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8ef('0x7')][_0xb8ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f88b4,_0x53a06e,_0x22980f){return new BPromise(function(_0xfbe63b,_0x323646){return client[_0xb8ef('0x9')](_0x4f88b4,_0x22980f)[_0xb8ef('0xa')](function(_0x17cdd9){logger[_0xb8ef('0xb')](_0xb8ef('0xc'),_0x53a06e,'request\x20sent');logger[_0xb8ef('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x53a06e,_0xb8ef('0xe'),JSON['stringify'](_0x17cdd9));if(_0x17cdd9[_0xb8ef('0xf')]){if(_0x17cdd9[_0xb8ef('0xf')]['code']===0x1f4){logger[_0xb8ef('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x53a06e,_0x17cdd9[_0xb8ef('0xf')][_0xb8ef('0x10')]);return _0x323646(_0x17cdd9[_0xb8ef('0xf')]['message']);}logger['error'](_0xb8ef('0xc'),_0x53a06e,_0x17cdd9[_0xb8ef('0xf')][_0xb8ef('0x10')]);return _0xfbe63b(_0x17cdd9[_0xb8ef('0xf')][_0xb8ef('0x10')]);}else{logger[_0xb8ef('0xb')](_0xb8ef('0xc'),_0x53a06e,_0xb8ef('0xe'));_0xfbe63b(_0x17cdd9[_0xb8ef('0x11')][_0xb8ef('0x10')]);}})[_0xb8ef('0x12')](function(_0x328754){logger['error'](_0xb8ef('0xc'),_0x53a06e,_0x328754);_0x323646(_0x328754);});});} \ No newline at end of file +var _0x91a5=['../../config/logger','jayson/promise','client','http','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x11f247,_0x577d13){var _0x38828b=function(_0x16187f){while(--_0x16187f){_0x11f247['push'](_0x11f247['shift']());}};_0x38828b(++_0x577d13);}(_0x91a5,0x19a));var _0x591a=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x91a5[_0xb66df];return _0x42a702;};'use strict';var _=require(_0x591a('0x0'));var util=require(_0x591a('0x1'));var moment=require(_0x591a('0x2'));var BPromise=require(_0x591a('0x3'));var rs=require(_0x591a('0x4'));var fs=require('fs');var Redis=require(_0x591a('0x5'));var db=require(_0x591a('0x6'))['db'];var utils=require(_0x591a('0x7'));var logger=require(_0x591a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x591a('0x9'));var client=jayson[_0x591a('0xa')][_0x591a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ad93,_0x44e208,_0x16f682){return new BPromise(function(_0x231430,_0x10efd5){return client['request'](_0x54ad93,_0x16f682)['then'](function(_0x579bae){logger['info'](_0x591a('0xc'),_0x44e208,_0x591a('0xd'));logger[_0x591a('0xe')](_0x591a('0xf'),_0x44e208,_0x591a('0xd'),JSON[_0x591a('0x10')](_0x579bae));if(_0x579bae[_0x591a('0x11')]){if(_0x579bae[_0x591a('0x11')][_0x591a('0x12')]===0x1f4){logger[_0x591a('0x11')](_0x591a('0xc'),_0x44e208,_0x579bae['error']['message']);return _0x10efd5(_0x579bae[_0x591a('0x11')][_0x591a('0x13')]);}logger[_0x591a('0x11')](_0x591a('0xc'),_0x44e208,_0x579bae[_0x591a('0x11')][_0x591a('0x13')]);return _0x231430(_0x579bae[_0x591a('0x11')]['message']);}else{logger[_0x591a('0x14')](_0x591a('0xc'),_0x44e208,_0x591a('0xd'));_0x231430(_0x579bae['result'][_0x591a('0x13')]);}})[_0x591a('0x15')](function(_0x3e55a7){logger['error'](_0x591a('0xc'),_0x44e208,_0x3e55a7);_0x10efd5(_0x3e55a7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 6d5ad90..91e0e1b 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 _0xf776=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x1b33ec,_0x4c5bb3){var _0x36c0a4=function(_0x4845cb){while(--_0x4845cb){_0x1b33ec['push'](_0x1b33ec['shift']());}};_0x36c0a4(++_0x4c5bb3);}(_0xf776,0x169));var _0x6f77=function(_0x561969,_0x143ea7){_0x561969=_0x561969-0x0;var _0x3983d2=_0xf776[_0x561969];return _0x3983d2;};'use strict';var multer=require(_0x6f77('0x0'));var util=require('util');var path=require(_0x6f77('0x1'));var timeout=require(_0x6f77('0x2'));var express=require('express');var router=express[_0x6f77('0x3')]();var fs_extra=require(_0x6f77('0x4'));var auth=require(_0x6f77('0x5'));var interaction=require(_0x6f77('0x6'));var config=require('../../config/environment');var controller=require(_0x6f77('0x7'));router['get']('/',auth[_0x6f77('0x8')](),controller[_0x6f77('0x9')]);router[_0x6f77('0xa')](_0x6f77('0xb'),auth['isAuthenticated'](),controller[_0x6f77('0xc')]);router['post']('/',auth[_0x6f77('0x8')](),controller[_0x6f77('0xd')]);router[_0x6f77('0xe')](_0x6f77('0xb'),auth['isAuthenticated'](),controller[_0x6f77('0xf')]);router[_0x6f77('0x10')](_0x6f77('0xb'),auth[_0x6f77('0x8')](),controller[_0x6f77('0x11')]);module[_0x6f77('0x12')]=router; \ No newline at end of file +var _0x9b97=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b97,0x11e));var _0x79b9=function(_0x1ba6fa,_0x34b9b6){_0x1ba6fa=_0x1ba6fa-0x0;var _0x126931=_0x9b97[_0x1ba6fa];return _0x126931;};'use strict';var multer=require(_0x79b9('0x0'));var util=require('util');var path=require(_0x79b9('0x1'));var timeout=require(_0x79b9('0x2'));var express=require(_0x79b9('0x3'));var router=express[_0x79b9('0x4')]();var fs_extra=require(_0x79b9('0x5'));var auth=require(_0x79b9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b9('0x7'));router[_0x79b9('0x8')]('/',auth[_0x79b9('0x9')](),controller['index']);router[_0x79b9('0x8')](_0x79b9('0xa'),auth['isAuthenticated'](),controller[_0x79b9('0xb')]);router[_0x79b9('0xc')]('/',auth[_0x79b9('0x9')](),controller[_0x79b9('0xd')]);router[_0x79b9('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x79b9('0xf')]);router[_0x79b9('0x10')](_0x79b9('0xa'),auth[_0x79b9('0x9')](),controller[_0x79b9('0x11')]);module[_0x79b9('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 874cfe6..9f02c13 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 _0x9fbb=['TEXT','exports'];(function(_0xa8ea48,_0x5a753a){var _0x43dde0=function(_0x2ffb0a){while(--_0x2ffb0a){_0xa8ea48['push'](_0xa8ea48['shift']());}};_0x43dde0(++_0x5a753a);}(_0x9fbb,0xcd));var _0xb9fb=function(_0x277de4,_0x2d2f94){_0x277de4=_0x277de4-0x0;var _0xec533b=_0x9fbb[_0x277de4];return _0xec533b;};'use strict';var Sequelize=require('sequelize');module[_0xb9fb('0x0')]={'tree':{'type':Sequelize[_0xb9fb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9b22=['TEXT','sequelize','exports'];(function(_0x255850,_0x5511dd){var _0x5ceacf=function(_0x260ecf){while(--_0x260ecf){_0x255850['push'](_0x255850['shift']());}};_0x5ceacf(++_0x5511dd);}(_0x9b22,0x133));var _0x29b2=function(_0x506eff,_0x408942){_0x506eff=_0x506eff-0x0;var _0x291576=_0x9b22[_0x506eff];return _0x291576;};'use strict';var Sequelize=require(_0x29b2('0x0'));module[_0x29b2('0x1')]={'tree':{'type':Sequelize[_0x29b2('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 3892d0c..6496213 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 _0x672a=['where','pick','filter','merge','type','VIRTUAL','options','rows','params','rawAttributes','filters','includeAll','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','fieldName','map','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0x672a,0x1cc));var _0xa672=function(_0x141397,_0x3274e4){_0x141397=_0x141397-0x0;var _0x284d9c=_0x672a[_0x141397];return _0x284d9c;};'use strict';var emlformat=require(_0xa672('0x0'));var rimraf=require(_0xa672('0x1'));var zipdir=require(_0xa672('0x2'));var jsonpatch=require(_0xa672('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa672('0x4'));var Mustache=require(_0xa672('0x5'));var util=require(_0xa672('0x6'));var path=require(_0xa672('0x7'));var sox=require(_0xa672('0x8'));var csv=require(_0xa672('0x9'));var ejs=require(_0xa672('0xa'));var fs=require('fs');var fs_extra=require(_0xa672('0xb'));var _=require('lodash');var squel=require(_0xa672('0xc'));var crypto=require(_0xa672('0xd'));var jsforce=require(_0xa672('0xe'));var deskjs=require(_0xa672('0xf'));var toCsv=require(_0xa672('0x9'));var querystring=require(_0xa672('0x10'));var Papa=require(_0xa672('0x11'));var Redis=require('ioredis');var authService=require(_0xa672('0x12'));var qs=require(_0xa672('0x13'));var as=require(_0xa672('0x14'));var hardwareService=require(_0xa672('0x15'));var logger=require('../../config/logger')(_0xa672('0x16'));var utils=require(_0xa672('0x17'));var config=require(_0xa672('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa672('0x19'))['db'];function respondWithStatusCode(_0x365de5,_0x224a2b){_0x224a2b=_0x224a2b||0xcc;return function(_0x2aaa22){if(_0x2aaa22){return _0x365de5[_0xa672('0x1a')](_0x224a2b);}return _0x365de5[_0xa672('0x1b')](_0x224a2b)[_0xa672('0x1c')]();};}function respondWithResult(_0x3d8e49,_0x5db093){_0x5db093=_0x5db093||0xc8;return function(_0x102874){if(_0x102874){return _0x3d8e49[_0xa672('0x1b')](_0x5db093)[_0xa672('0x1d')](_0x102874);}};}function respondWithFilteredResult(_0x202614,_0x43325f){return function(_0x54bff8){if(_0x54bff8){var _0x48f8a3=typeof _0x43325f[_0xa672('0x1e')]===_0xa672('0x1f')&&typeof _0x43325f[_0xa672('0x20')]===_0xa672('0x1f');var _0x4499c8=_0x54bff8[_0xa672('0x21')];var _0xef586=_0x48f8a3?0x0:_0x43325f['offset'];var _0x457d2e=_0x48f8a3?_0x54bff8['count']:_0x43325f[_0xa672('0x1e')]+_0x43325f[_0xa672('0x20')];var _0x1900f5;if(_0x457d2e>=_0x4499c8){_0x457d2e=_0x4499c8;_0x1900f5=0xc8;}else{_0x1900f5=0xce;}_0x202614[_0xa672('0x1b')](_0x1900f5);return _0x202614[_0xa672('0x22')]('Content-Range',_0xef586+'-'+_0x457d2e+'/'+_0x4499c8)[_0xa672('0x1d')](_0x54bff8);}return null;};}function patchUpdates(_0x2704cc){return function(_0x172530){try{jsonpatch[_0xa672('0x23')](_0x172530,_0x2704cc,!![]);}catch(_0x1993c2){return BPromise['reject'](_0x1993c2);}return _0x172530[_0xa672('0x24')]();};}function saveUpdates(_0x38f0d0,_0x4d1d61){return function(_0x2d6240){if(_0x2d6240){return _0x2d6240[_0xa672('0x25')](_0x38f0d0)[_0xa672('0x26')](function(_0x15f48c){return _0x15f48c;});}return null;};}function removeEntity(_0xc1112c,_0x225881){return function(_0x30dc79){if(_0x30dc79){return _0x30dc79[_0xa672('0x27')]()['then'](function(){_0xc1112c[_0xa672('0x1b')](0xcc)[_0xa672('0x1c')]();});}};}function handleEntityNotFound(_0x53d49c,_0x3f6c6b){return function(_0x48f46b){if(!_0x48f46b){_0x53d49c[_0xa672('0x1a')](0x194);}return _0x48f46b;};}function handleError(_0x392a61,_0x1752a6){_0x1752a6=_0x1752a6||0x1f4;return function(_0x274f7b){logger[_0xa672('0x28')](_0x274f7b[_0xa672('0x29')]);if(_0x274f7b[_0xa672('0x2a')]){delete _0x274f7b[_0xa672('0x2a')];}_0x392a61['status'](_0x1752a6)[_0xa672('0x2b')](_0x274f7b);};}exports[_0xa672('0x2c')]=function(_0x53f612,_0x32e609){var _0x5d65d9={},_0x58b464={},_0x5e92de={'count':0x0,'rows':[]};var _0x4f30df=_['map'](db[_0xa672('0x2d')]['rawAttributes'],function(_0x47ee2){return{'name':_0x47ee2[_0xa672('0x2e')],'type':_0x47ee2['type']['key']};});_0x58b464['model']=_[_0xa672('0x2f')](_0x4f30df,_0xa672('0x2a'));_0x58b464['query']=_[_0xa672('0x30')](_0x53f612[_0xa672('0x31')]);_0x58b464['filters']=_[_0xa672('0x32')](_0x58b464[_0xa672('0x33')],_0x58b464[_0xa672('0x31')]);_0x5d65d9[_0xa672('0x34')]=_['intersection'](_0x58b464[_0xa672('0x33')],qs['fields'](_0x53f612[_0xa672('0x31')][_0xa672('0x35')]));_0x5d65d9[_0xa672('0x34')]=_0x5d65d9[_0xa672('0x34')][_0xa672('0x36')]?_0x5d65d9[_0xa672('0x34')]:_0x58b464['model'];if(!_0x53f612[_0xa672('0x31')]['hasOwnProperty'](_0xa672('0x37'))){_0x5d65d9[_0xa672('0x20')]=qs['limit'](_0x53f612[_0xa672('0x31')][_0xa672('0x20')]);_0x5d65d9['offset']=qs[_0xa672('0x1e')](_0x53f612[_0xa672('0x31')][_0xa672('0x1e')]);}_0x5d65d9[_0xa672('0x38')]=qs[_0xa672('0x39')](_0x53f612['query']['sort']);_0x5d65d9[_0xa672('0x3a')]=qs['filters'](_[_0xa672('0x3b')](_0x53f612['query'],_0x58b464['filters']),_0x4f30df);if(_0x53f612[_0xa672('0x31')][_0xa672('0x3c')]){_0x5d65d9['where']=_[_0xa672('0x3d')](_0x5d65d9['where'],{'$or':_[_0xa672('0x2f')](_0x4f30df,function(_0x1a9767){if(_0x1a9767[_0xa672('0x3e')]!==_0xa672('0x3f')){var _0x3f261b={};_0x3f261b[_0x1a9767[_0xa672('0x2a')]]={'$like':'%'+_0x53f612[_0xa672('0x31')][_0xa672('0x3c')]+'%'};return _0x3f261b;}})});}_0x5d65d9=_['merge']({},_0x5d65d9,_0x53f612[_0xa672('0x40')]);var _0x3b9d67={'where':_0x5d65d9['where']};return db[_0xa672('0x2d')][_0xa672('0x21')](_0x3b9d67)[_0xa672('0x26')](function(_0x4539ca){_0x5e92de['count']=_0x4539ca;if(_0x53f612[_0xa672('0x31')]['includeAll']){_0x5d65d9['include']=[{'all':!![]}];}return db[_0xa672('0x2d')]['findAll'](_0x5d65d9);})[_0xa672('0x26')](function(_0x115dbb){_0x5e92de[_0xa672('0x41')]=_0x115dbb;return _0x5e92de;})[_0xa672('0x26')](respondWithFilteredResult(_0x32e609,_0x5d65d9))['catch'](handleError(_0x32e609,null));};exports['show']=function(_0x28f66a,_0x152e3){var _0x216d01={'raw':!![],'where':{'id':_0x28f66a[_0xa672('0x42')]['id']}},_0x5de27b={};_0x5de27b[_0xa672('0x33')]=_['keys'](db[_0xa672('0x2d')][_0xa672('0x43')]);_0x5de27b[_0xa672('0x31')]=_[_0xa672('0x30')](_0x28f66a[_0xa672('0x31')]);_0x5de27b[_0xa672('0x44')]=_[_0xa672('0x32')](_0x5de27b[_0xa672('0x33')],_0x5de27b[_0xa672('0x31')]);_0x216d01['attributes']=_[_0xa672('0x32')](_0x5de27b['model'],qs['fields'](_0x28f66a['query']['fields']));_0x216d01[_0xa672('0x34')]=_0x216d01[_0xa672('0x34')][_0xa672('0x36')]?_0x216d01[_0xa672('0x34')]:_0x5de27b[_0xa672('0x33')];if(_0x28f66a[_0xa672('0x31')][_0xa672('0x45')]){_0x216d01['include']=[{'all':!![]}];}_0x216d01=_['merge']({},_0x216d01,_0x28f66a[_0xa672('0x40')]);return db[_0xa672('0x2d')][_0xa672('0x46')](_0x216d01)[_0xa672('0x26')](handleEntityNotFound(_0x152e3,null))[_0xa672('0x26')](respondWithResult(_0x152e3,null))['catch'](handleError(_0x152e3,null));};exports[_0xa672('0x47')]=function(_0x1e0b92,_0x590198){return db[_0xa672('0x2d')]['create'](_0x1e0b92[_0xa672('0x48')],{})[_0xa672('0x26')](respondWithResult(_0x590198,0xc9))['catch'](handleError(_0x590198,null));};exports['update']=function(_0x5a8288,_0x28ab58){if(_0x5a8288[_0xa672('0x48')]['id']){delete _0x5a8288['body']['id'];}return db[_0xa672('0x2d')][_0xa672('0x46')]({'where':{'id':_0x5a8288[_0xa672('0x42')]['id']}})[_0xa672('0x26')](handleEntityNotFound(_0x28ab58,null))[_0xa672('0x26')](saveUpdates(_0x5a8288[_0xa672('0x48')],null))[_0xa672('0x26')](respondWithResult(_0x28ab58,null))[_0xa672('0x49')](handleError(_0x28ab58,null));};exports[_0xa672('0x27')]=function(_0x283ba8,_0x1c80a1){return db['AnalyticTreeReport'][_0xa672('0x46')]({'where':{'id':_0x283ba8['params']['id']}})[_0xa672('0x26')](handleEntityNotFound(_0x1c80a1,null))[_0xa672('0x26')](removeEntity(_0x1c80a1,null))['catch'](handleError(_0x1c80a1,null));}; \ No newline at end of file +var _0xe51e=['model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','apply','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key'];(function(_0x4a6979,_0x5f3d1a){var _0x226f93=function(_0x471572){while(--_0x471572){_0x4a6979['push'](_0x4a6979['shift']());}};_0x226f93(++_0x5f3d1a);}(_0xe51e,0xfd));var _0xee51=function(_0x23d3da,_0x5a837e){_0x23d3da=_0x23d3da-0x0;var _0x29b120=_0xe51e[_0x23d3da];return _0x29b120;};'use strict';var emlformat=require(_0xee51('0x0'));var rimraf=require(_0xee51('0x1'));var zipdir=require(_0xee51('0x2'));var jsonpatch=require(_0xee51('0x3'));var rp=require(_0xee51('0x4'));var moment=require(_0xee51('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee51('0x6'));var path=require(_0xee51('0x7'));var sox=require(_0xee51('0x8'));var csv=require(_0xee51('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee51('0xa'));var _=require(_0xee51('0xb'));var squel=require(_0xee51('0xc'));var crypto=require(_0xee51('0xd'));var jsforce=require(_0xee51('0xe'));var deskjs=require(_0xee51('0xf'));var toCsv=require('to-csv');var querystring=require(_0xee51('0x10'));var Papa=require(_0xee51('0x11'));var Redis=require('ioredis');var authService=require(_0xee51('0x12'));var qs=require(_0xee51('0x13'));var as=require(_0xee51('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee51('0x15'));var utils=require('../../config/utils');var config=require(_0xee51('0x16'));var licenseUtil=require(_0xee51('0x17'));var db=require(_0xee51('0x18'))['db'];function respondWithStatusCode(_0x49bae4,_0x11d585){_0x11d585=_0x11d585||0xcc;return function(_0x1a9987){if(_0x1a9987){return _0x49bae4['sendStatus'](_0x11d585);}return _0x49bae4[_0xee51('0x19')](_0x11d585)[_0xee51('0x1a')]();};}function respondWithResult(_0x42e596,_0x1ab857){_0x1ab857=_0x1ab857||0xc8;return function(_0x45c1cb){if(_0x45c1cb){return _0x42e596['status'](_0x1ab857)[_0xee51('0x1b')](_0x45c1cb);}};}function respondWithFilteredResult(_0x487727,_0x4b995d){return function(_0x4be28a){if(_0x4be28a){var _0x179935=typeof _0x4b995d[_0xee51('0x1c')]===_0xee51('0x1d')&&typeof _0x4b995d[_0xee51('0x1e')]===_0xee51('0x1d');var _0x443feb=_0x4be28a['count'];var _0x40bc21=_0x179935?0x0:_0x4b995d[_0xee51('0x1c')];var _0x325596=_0x179935?_0x4be28a['count']:_0x4b995d['offset']+_0x4b995d['limit'];var _0x2572bd;if(_0x325596>=_0x443feb){_0x325596=_0x443feb;_0x2572bd=0xc8;}else{_0x2572bd=0xce;}_0x487727['status'](_0x2572bd);return _0x487727['set']('Content-Range',_0x40bc21+'-'+_0x325596+'/'+_0x443feb)['json'](_0x4be28a);}return null;};}function patchUpdates(_0xf48ae4){return function(_0x20aece){try{jsonpatch[_0xee51('0x1f')](_0x20aece,_0xf48ae4,!![]);}catch(_0x6eb6bc){return BPromise[_0xee51('0x20')](_0x6eb6bc);}return _0x20aece[_0xee51('0x21')]();};}function saveUpdates(_0x112a5d,_0x24e264){return function(_0x7751b4){if(_0x7751b4){return _0x7751b4['update'](_0x112a5d)[_0xee51('0x22')](function(_0x1653e4){return _0x1653e4;});}return null;};}function removeEntity(_0x1c33d4,_0x1f58f4){return function(_0x49c5a9){if(_0x49c5a9){return _0x49c5a9[_0xee51('0x23')]()[_0xee51('0x22')](function(){_0x1c33d4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46e62a,_0x583c61){return function(_0x5af914){if(!_0x5af914){_0x46e62a['sendStatus'](0x194);}return _0x5af914;};}function handleError(_0x3d433d,_0xe4541f){_0xe4541f=_0xe4541f||0x1f4;return function(_0x79c264){logger[_0xee51('0x24')](_0x79c264[_0xee51('0x25')]);if(_0x79c264[_0xee51('0x26')]){delete _0x79c264[_0xee51('0x26')];}_0x3d433d['status'](_0xe4541f)[_0xee51('0x27')](_0x79c264);};}exports[_0xee51('0x28')]=function(_0x351ed2,_0x186e0e){var _0x163acf={},_0x41d11f={},_0x132618={'count':0x0,'rows':[]};var _0x1295f1=_[_0xee51('0x29')](db[_0xee51('0x2a')][_0xee51('0x2b')],function(_0x143ac3){return{'name':_0x143ac3[_0xee51('0x2c')],'type':_0x143ac3[_0xee51('0x2d')][_0xee51('0x2e')]};});_0x41d11f[_0xee51('0x2f')]=_[_0xee51('0x29')](_0x1295f1,_0xee51('0x26'));_0x41d11f[_0xee51('0x30')]=_[_0xee51('0x31')](_0x351ed2['query']);_0x41d11f[_0xee51('0x32')]=_[_0xee51('0x33')](_0x41d11f[_0xee51('0x2f')],_0x41d11f['query']);_0x163acf[_0xee51('0x34')]=_[_0xee51('0x33')](_0x41d11f[_0xee51('0x2f')],qs[_0xee51('0x35')](_0x351ed2[_0xee51('0x30')][_0xee51('0x35')]));_0x163acf[_0xee51('0x34')]=_0x163acf[_0xee51('0x34')]['length']?_0x163acf['attributes']:_0x41d11f[_0xee51('0x2f')];if(!_0x351ed2[_0xee51('0x30')]['hasOwnProperty']('nolimit')){_0x163acf['limit']=qs[_0xee51('0x1e')](_0x351ed2[_0xee51('0x30')][_0xee51('0x1e')]);_0x163acf[_0xee51('0x1c')]=qs[_0xee51('0x1c')](_0x351ed2['query'][_0xee51('0x1c')]);}_0x163acf[_0xee51('0x36')]=qs[_0xee51('0x37')](_0x351ed2['query']['sort']);_0x163acf[_0xee51('0x38')]=qs[_0xee51('0x32')](_[_0xee51('0x39')](_0x351ed2[_0xee51('0x30')],_0x41d11f[_0xee51('0x32')]),_0x1295f1);if(_0x351ed2[_0xee51('0x30')][_0xee51('0x3a')]){_0x163acf[_0xee51('0x38')]=_[_0xee51('0x3b')](_0x163acf[_0xee51('0x38')],{'$or':_['map'](_0x1295f1,function(_0x4bd51b){if(_0x4bd51b[_0xee51('0x2d')]!==_0xee51('0x3c')){var _0x38c0fa={};_0x38c0fa[_0x4bd51b[_0xee51('0x26')]]={'$like':'%'+_0x351ed2[_0xee51('0x30')][_0xee51('0x3a')]+'%'};return _0x38c0fa;}})});}_0x163acf=_[_0xee51('0x3b')]({},_0x163acf,_0x351ed2[_0xee51('0x3d')]);var _0x43fcf8={'where':_0x163acf[_0xee51('0x38')]};return db[_0xee51('0x2a')][_0xee51('0x3e')](_0x43fcf8)[_0xee51('0x22')](function(_0x579661){_0x132618[_0xee51('0x3e')]=_0x579661;if(_0x351ed2[_0xee51('0x30')][_0xee51('0x3f')]){_0x163acf[_0xee51('0x40')]=[{'all':!![]}];}return db[_0xee51('0x2a')][_0xee51('0x41')](_0x163acf);})['then'](function(_0x3012a5){_0x132618[_0xee51('0x42')]=_0x3012a5;return _0x132618;})[_0xee51('0x22')](respondWithFilteredResult(_0x186e0e,_0x163acf))[_0xee51('0x43')](handleError(_0x186e0e,null));};exports[_0xee51('0x44')]=function(_0x366310,_0x289e88){var _0x2b93f5={'raw':!![],'where':{'id':_0x366310[_0xee51('0x45')]['id']}},_0xcc8084={};_0xcc8084['model']=_['keys'](db[_0xee51('0x2a')][_0xee51('0x2b')]);_0xcc8084[_0xee51('0x30')]=_[_0xee51('0x31')](_0x366310[_0xee51('0x30')]);_0xcc8084[_0xee51('0x32')]=_[_0xee51('0x33')](_0xcc8084[_0xee51('0x2f')],_0xcc8084[_0xee51('0x30')]);_0x2b93f5[_0xee51('0x34')]=_[_0xee51('0x33')](_0xcc8084[_0xee51('0x2f')],qs[_0xee51('0x35')](_0x366310[_0xee51('0x30')][_0xee51('0x35')]));_0x2b93f5[_0xee51('0x34')]=_0x2b93f5[_0xee51('0x34')][_0xee51('0x46')]?_0x2b93f5[_0xee51('0x34')]:_0xcc8084['model'];if(_0x366310[_0xee51('0x30')][_0xee51('0x3f')]){_0x2b93f5[_0xee51('0x40')]=[{'all':!![]}];}_0x2b93f5=_[_0xee51('0x3b')]({},_0x2b93f5,_0x366310[_0xee51('0x3d')]);return db[_0xee51('0x2a')][_0xee51('0x47')](_0x2b93f5)[_0xee51('0x22')](handleEntityNotFound(_0x289e88,null))[_0xee51('0x22')](respondWithResult(_0x289e88,null))[_0xee51('0x43')](handleError(_0x289e88,null));};exports[_0xee51('0x48')]=function(_0x2cc331,_0x519792){return db['AnalyticTreeReport'][_0xee51('0x48')](_0x2cc331[_0xee51('0x49')],{})[_0xee51('0x22')](respondWithResult(_0x519792,0xc9))[_0xee51('0x43')](handleError(_0x519792,null));};exports[_0xee51('0x4a')]=function(_0x56dfdb,_0x38d626){if(_0x56dfdb[_0xee51('0x49')]['id']){delete _0x56dfdb[_0xee51('0x49')]['id'];}return db[_0xee51('0x2a')][_0xee51('0x47')]({'where':{'id':_0x56dfdb[_0xee51('0x45')]['id']}})[_0xee51('0x22')](handleEntityNotFound(_0x38d626,null))[_0xee51('0x22')](saveUpdates(_0x56dfdb[_0xee51('0x49')],null))[_0xee51('0x22')](respondWithResult(_0x38d626,null))[_0xee51('0x43')](handleError(_0x38d626,null));};exports[_0xee51('0x23')]=function(_0x475356,_0x5c36de){return db[_0xee51('0x2a')][_0xee51('0x47')]({'where':{'id':_0x475356[_0xee51('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c36de,null))[_0xee51('0x22')](removeEntity(_0x5c36de,null))[_0xee51('0x43')](handleError(_0x5c36de,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 64ee693..07f05a5 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 _0x76b1=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc363b3,_0x405327){var _0x5f20cf=function(_0x45bab0){while(--_0x45bab0){_0xc363b3['push'](_0xc363b3['shift']());}};_0x5f20cf(++_0x405327);}(_0x76b1,0x1cd));var _0x176b=function(_0x1a5706,_0x5557bd){_0x1a5706=_0x1a5706-0x0;var _0x42fcba=_0x76b1[_0x1a5706];return _0x42fcba;};'use strict';var _=require(_0x176b('0x0'));var util=require(_0x176b('0x1'));var logger=require(_0x176b('0x2'))(_0x176b('0x3'));var moment=require(_0x176b('0x4'));var BPromise=require(_0x176b('0x5'));var rp=require(_0x176b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x176b('0x7'));var config=require(_0x176b('0x8'));var attributes=require(_0x176b('0x9'));module[_0x176b('0xa')]=function(_0x265dc2,_0x2831d1){return _0x265dc2['define'](_0x176b('0xb'),attributes,{'tableName':_0x176b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6712=['moment','bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','util','../../config/logger'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0x6712,0x10c));var _0x2671=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x6712[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require(_0x2671('0x0'));var logger=require(_0x2671('0x1'))('api');var moment=require(_0x2671('0x2'));var BPromise=require(_0x2671('0x3'));var rp=require(_0x2671('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2671('0x5'));var attributes=require(_0x2671('0x6'));module['exports']=function(_0x3a219d,_0x38e5a9){return _0x3a219d[_0x2671('0x7')](_0x2671('0x8'),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 0339454..57e95d0 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x4996ae,_0x3a123d){var _0x16a5fb=function(_0x2c270a){while(--_0x2c270a){_0x4996ae['push'](_0x4996ae['shift']());}};_0x16a5fb(++_0x3a123d);}(_0xdb28,0x106));var _0x8db2=function(_0x285dbc,_0x50f10d){_0x285dbc=_0x285dbc-0x0;var _0x30ed90=_0xdb28[_0x285dbc];return _0x30ed90;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +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(_0x11dc4d,_0x45f353){var _0x125d12=function(_0x59c927){while(--_0x59c927){_0x11dc4d['push'](_0x11dc4d['shift']());}};_0x125d12(++_0x45f353);}(_0x2ef3,0xba));var _0x32ef=function(_0x41345c,_0x32fa7b){_0x41345c=_0x41345c-0x0;var _0x2bfde3=_0x2ef3[_0x41345c];return _0x2bfde3;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a05860b..93c318c 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 _0xf83e=['Router','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x558671,_0x323735){var _0x3958d1=function(_0x590b42){while(--_0x590b42){_0x558671['push'](_0x558671['shift']());}};_0x3958d1(++_0x323735);}(_0xf83e,0x12b));var _0xef83=function(_0x508abe,_0x37d20c){_0x508abe=_0x508abe-0x0;var _0x23d357=_0xf83e[_0x508abe];return _0x23d357;};'use strict';var multer=require(_0xef83('0x0'));var util=require(_0xef83('0x1'));var path=require(_0xef83('0x2'));var timeout=require(_0xef83('0x3'));var express=require(_0xef83('0x4'));var router=express[_0xef83('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xef83('0x6'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xef83('0x7')]('/',auth[_0xef83('0x8')](),controller[_0xef83('0x9')]);router[_0xef83('0x7')]('/:id',auth[_0xef83('0x8')](),controller[_0xef83('0xa')]);router[_0xef83('0xb')]('/',auth[_0xef83('0x8')](),controller[_0xef83('0xc')]);router[_0xef83('0xd')](_0xef83('0xe'),auth[_0xef83('0x8')](),controller[_0xef83('0xf')]);router[_0xef83('0x10')](_0xef83('0xe'),auth[_0xef83('0x8')](),controller[_0xef83('0x11')]);module[_0xef83('0x12')]=router; \ No newline at end of file +var _0x5b63=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x585b86,_0x515d4b){var _0x5f949e=function(_0x4fb750){while(--_0x4fb750){_0x585b86['push'](_0x585b86['shift']());}};_0x5f949e(++_0x515d4b);}(_0x5b63,0xff));var _0x35b6=function(_0x40b9b9,_0x1305b7){_0x40b9b9=_0x40b9b9-0x0;var _0x19ee96=_0x5b63[_0x40b9b9];return _0x19ee96;};'use strict';var multer=require(_0x35b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x35b6('0x1'));var express=require(_0x35b6('0x2'));var router=express[_0x35b6('0x3')]();var fs_extra=require(_0x35b6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x35b6('0x5'));router[_0x35b6('0x6')]('/',auth[_0x35b6('0x7')](),controller[_0x35b6('0x8')]);router[_0x35b6('0x6')]('/:id',auth[_0x35b6('0x7')](),controller[_0x35b6('0x9')]);router[_0x35b6('0xa')]('/',auth['isAuthenticated'](),controller[_0x35b6('0xb')]);router[_0x35b6('0xc')](_0x35b6('0xd'),auth['isAuthenticated'](),controller[_0x35b6('0xe')]);router[_0x35b6('0xf')](_0x35b6('0xd'),auth[_0x35b6('0x7')](),controller[_0x35b6('0x10')]);module[_0x35b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1f3de19..f7b1cf4 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 _0xd493=['STRING','sequelize'];(function(_0x2de977,_0x1d7ab9){var _0x151174=function(_0x56e553){while(--_0x56e553){_0x2de977['push'](_0x2de977['shift']());}};_0x151174(++_0x1d7ab9);}(_0xd493,0x1bd));var _0x3d49=function(_0x3b1d06,_0x11890e){_0x3b1d06=_0x3b1d06-0x0;var _0x3ee6b6=_0xd493[_0x3b1d06];return _0x3ee6b6;};'use strict';var Sequelize=require(_0x3d49('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d49('0x1')]},'basename':{'type':Sequelize[_0x3d49('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb2b3=['exports','STRING','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb2b3,0x71));var _0x3b2b=function(_0x21ada0,_0x563afb){_0x21ada0=_0x21ada0-0x0;var _0x60caee=_0xb2b3[_0x21ada0];return _0x60caee;};'use strict';var Sequelize=require(_0x3b2b('0x0'));module[_0x3b2b('0x1')]={'name':{'type':Sequelize[_0x3b2b('0x2')]},'basename':{'type':Sequelize[_0x3b2b('0x2')]},'type':{'type':Sequelize[_0x3b2b('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3cca4bb..2e2ea51 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 _0x8ea3=['fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','Attachment','rawAttributes','type','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','findAll','catch','show','params','options','find','clone','get','createdAt','updatedAt','body','update','destroy','create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x1e2d00,_0x205f9f){var _0x5a4ed3=function(_0x26b93a){while(--_0x26b93a){_0x1e2d00['push'](_0x1e2d00['shift']());}};_0x5a4ed3(++_0x205f9f);}(_0x8ea3,0x1ba));var _0x38ea=function(_0x1c9e42,_0x123295){_0x1c9e42=_0x1c9e42-0x0;var _0x45aa33=_0x8ea3[_0x1c9e42];return _0x45aa33;};'use strict';var emlformat=require(_0x38ea('0x0'));var rimraf=require(_0x38ea('0x1'));var zipdir=require(_0x38ea('0x2'));var jsonpatch=require(_0x38ea('0x3'));var rp=require(_0x38ea('0x4'));var moment=require(_0x38ea('0x5'));var BPromise=require(_0x38ea('0x6'));var Mustache=require(_0x38ea('0x7'));var util=require(_0x38ea('0x8'));var path=require(_0x38ea('0x9'));var sox=require(_0x38ea('0xa'));var csv=require(_0x38ea('0xb'));var ejs=require(_0x38ea('0xc'));var fs=require('fs');var fs_extra=require(_0x38ea('0xd'));var _=require('lodash');var squel=require(_0x38ea('0xe'));var crypto=require(_0x38ea('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x38ea('0x10'));var toCsv=require(_0x38ea('0xb'));var querystring=require(_0x38ea('0x11'));var Papa=require(_0x38ea('0x12'));var Redis=require(_0x38ea('0x13'));var authService=require(_0x38ea('0x14'));var qs=require(_0x38ea('0x15'));var as=require(_0x38ea('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x38ea('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x38ea('0x18'));var licenseUtil=require(_0x38ea('0x19'));var db=require(_0x38ea('0x1a'))['db'];function respondWithStatusCode(_0x2df06e,_0x4b7de1){_0x4b7de1=_0x4b7de1||0xcc;return function(_0xe60452){if(_0xe60452){return _0x2df06e[_0x38ea('0x1b')](_0x4b7de1);}return _0x2df06e[_0x38ea('0x1c')](_0x4b7de1)[_0x38ea('0x1d')]();};}function respondWithResult(_0x202171,_0x45d5a9){_0x45d5a9=_0x45d5a9||0xc8;return function(_0x52da61){if(_0x52da61){return _0x202171['status'](_0x45d5a9)[_0x38ea('0x1e')](_0x52da61);}};}function respondWithFilteredResult(_0x46db99,_0x107d90){return function(_0x424c56){if(_0x424c56){var _0x45f728=typeof _0x107d90['offset']===_0x38ea('0x1f')&&typeof _0x107d90[_0x38ea('0x20')]===_0x38ea('0x1f');var _0x4fd1c8=_0x424c56[_0x38ea('0x21')];var _0x2c621d=_0x45f728?0x0:_0x107d90['offset'];var _0x23030f=_0x45f728?_0x424c56[_0x38ea('0x21')]:_0x107d90[_0x38ea('0x22')]+_0x107d90[_0x38ea('0x20')];var _0x3fb7e7;if(_0x23030f>=_0x4fd1c8){_0x23030f=_0x4fd1c8;_0x3fb7e7=0xc8;}else{_0x3fb7e7=0xce;}_0x46db99['status'](_0x3fb7e7);return _0x46db99[_0x38ea('0x23')](_0x38ea('0x24'),_0x2c621d+'-'+_0x23030f+'/'+_0x4fd1c8)[_0x38ea('0x1e')](_0x424c56);}return null;};}function patchUpdates(_0x492ba0){return function(_0x216925){try{jsonpatch[_0x38ea('0x25')](_0x216925,_0x492ba0,!![]);}catch(_0x264905){return BPromise[_0x38ea('0x26')](_0x264905);}return _0x216925[_0x38ea('0x27')]();};}function saveUpdates(_0x322410,_0x1755df){return function(_0x5e9eaf){if(_0x5e9eaf){return _0x5e9eaf['update'](_0x322410)[_0x38ea('0x28')](function(_0x47d339){return _0x47d339;});}return null;};}function removeEntity(_0xfad40e,_0x1da3da){return function(_0x4cd4fe){if(_0x4cd4fe){return _0x4cd4fe['destroy']()[_0x38ea('0x28')](function(){_0xfad40e['status'](0xcc)[_0x38ea('0x1d')]();});}};}function handleEntityNotFound(_0x274ad4,_0x2abc3b){return function(_0x1a230f){if(!_0x1a230f){_0x274ad4['sendStatus'](0x194);}return _0x1a230f;};}function handleError(_0x282ae6,_0x4444a9){_0x4444a9=_0x4444a9||0x1f4;return function(_0x28b201){logger[_0x38ea('0x29')](_0x28b201[_0x38ea('0x2a')]);if(_0x28b201[_0x38ea('0x2b')]){delete _0x28b201[_0x38ea('0x2b')];}_0x282ae6[_0x38ea('0x1c')](_0x4444a9)['send'](_0x28b201);};}exports[_0x38ea('0x2c')]=function(_0x19c64d,_0x10bcd2){var _0x9e9da8={},_0x5d686f={},_0x14e504={'count':0x0,'rows':[]};var _0x542299=_[_0x38ea('0x2d')](db[_0x38ea('0x2e')][_0x38ea('0x2f')],function(_0xdbcc7e){return{'name':_0xdbcc7e['fieldName'],'type':_0xdbcc7e[_0x38ea('0x30')]['key']};});_0x5d686f['model']=_['map'](_0x542299,_0x38ea('0x2b'));_0x5d686f[_0x38ea('0x31')]=_[_0x38ea('0x32')](_0x19c64d[_0x38ea('0x31')]);_0x5d686f[_0x38ea('0x33')]=_['intersection'](_0x5d686f['model'],_0x5d686f[_0x38ea('0x31')]);_0x9e9da8['attributes']=_[_0x38ea('0x34')](_0x5d686f['model'],qs[_0x38ea('0x35')](_0x19c64d['query'][_0x38ea('0x35')]));_0x9e9da8['attributes']=_0x9e9da8[_0x38ea('0x36')][_0x38ea('0x37')]?_0x9e9da8[_0x38ea('0x36')]:_0x5d686f[_0x38ea('0x38')];if(!_0x19c64d[_0x38ea('0x31')][_0x38ea('0x39')](_0x38ea('0x3a'))){_0x9e9da8[_0x38ea('0x20')]=qs['limit'](_0x19c64d['query'][_0x38ea('0x20')]);_0x9e9da8[_0x38ea('0x22')]=qs[_0x38ea('0x22')](_0x19c64d[_0x38ea('0x31')][_0x38ea('0x22')]);}_0x9e9da8['order']=qs['sort'](_0x19c64d['query'][_0x38ea('0x3b')]);_0x9e9da8[_0x38ea('0x3c')]=qs[_0x38ea('0x33')](_['pick'](_0x19c64d['query'],_0x5d686f[_0x38ea('0x33')]),_0x542299);if(_0x19c64d[_0x38ea('0x31')][_0x38ea('0x3d')]){_0x9e9da8['where']=_[_0x38ea('0x3e')](_0x9e9da8[_0x38ea('0x3c')],{'$or':_[_0x38ea('0x2d')](_0x542299,function(_0x8443d2){if(_0x8443d2[_0x38ea('0x30')]!=='VIRTUAL'){var _0x49565d={};_0x49565d[_0x8443d2[_0x38ea('0x2b')]]={'$like':'%'+_0x19c64d[_0x38ea('0x31')][_0x38ea('0x3d')]+'%'};return _0x49565d;}})});}_0x9e9da8=_[_0x38ea('0x3e')]({},_0x9e9da8,_0x19c64d['options']);var _0x2ba1a4={'where':_0x9e9da8[_0x38ea('0x3c')]};return db[_0x38ea('0x2e')][_0x38ea('0x21')](_0x2ba1a4)[_0x38ea('0x28')](function(_0x9f94bc){_0x14e504[_0x38ea('0x21')]=_0x9f94bc;if(_0x19c64d[_0x38ea('0x31')][_0x38ea('0x3f')]){_0x9e9da8[_0x38ea('0x40')]=[{'all':!![]}];}return db['Attachment'][_0x38ea('0x41')](_0x9e9da8);})[_0x38ea('0x28')](function(_0x58c0a4){_0x14e504['rows']=_0x58c0a4;return _0x14e504;})['then'](respondWithFilteredResult(_0x10bcd2,_0x9e9da8))[_0x38ea('0x42')](handleError(_0x10bcd2,null));};exports[_0x38ea('0x43')]=function(_0x11fe45,_0x12cdd1){var _0x529bc1={'raw':!![],'where':{'id':_0x11fe45[_0x38ea('0x44')]['id']}},_0x5d2701={};_0x5d2701['model']=_['keys'](db['Attachment'][_0x38ea('0x2f')]);_0x5d2701[_0x38ea('0x31')]=_[_0x38ea('0x32')](_0x11fe45['query']);_0x5d2701[_0x38ea('0x33')]=_[_0x38ea('0x34')](_0x5d2701['model'],_0x5d2701['query']);_0x529bc1['attributes']=_[_0x38ea('0x34')](_0x5d2701[_0x38ea('0x38')],qs[_0x38ea('0x35')](_0x11fe45[_0x38ea('0x31')][_0x38ea('0x35')]));_0x529bc1[_0x38ea('0x36')]=_0x529bc1[_0x38ea('0x36')][_0x38ea('0x37')]?_0x529bc1[_0x38ea('0x36')]:_0x5d2701[_0x38ea('0x38')];if(_0x11fe45['query'][_0x38ea('0x3f')]){_0x529bc1['include']=[{'all':!![]}];}_0x529bc1=_['merge']({},_0x529bc1,_0x11fe45[_0x38ea('0x45')]);return db[_0x38ea('0x2e')][_0x38ea('0x46')](_0x529bc1)[_0x38ea('0x28')](handleEntityNotFound(_0x12cdd1,null))[_0x38ea('0x28')](respondWithResult(_0x12cdd1,null))[_0x38ea('0x42')](handleError(_0x12cdd1,null));};exports[_0x38ea('0x47')]=function(_0x4330e8,_0x16419c){var _0x42d494={'where':{'id':_0x4330e8['params']['id']}},_0x7b5e8d={};_0x7b5e8d[_0x38ea('0x38')]=_['keys'](db[_0x38ea('0x2e')]['rawAttributes']);_0x42d494[_0x38ea('0x36')]=_[_0x38ea('0x34')](_0x7b5e8d[_0x38ea('0x38')],qs[_0x38ea('0x35')](_0x4330e8[_0x38ea('0x31')]['fields']));_0x42d494[_0x38ea('0x36')]=_0x42d494[_0x38ea('0x36')][_0x38ea('0x37')]?_0x42d494[_0x38ea('0x36')]:_0x7b5e8d[_0x38ea('0x38')];if(_0x4330e8[_0x38ea('0x31')][_0x38ea('0x3f')]){_0x42d494['include']=[{'all':!![]}];}_0x42d494=_[_0x38ea('0x3e')]({},_0x42d494,_0x4330e8['options']);return db[_0x38ea('0x2e')]['find'](_0x42d494)[_0x38ea('0x28')](handleEntityNotFound(_0x16419c,null))[_0x38ea('0x28')](function(_0x4090ab){if(_0x4090ab){var _0x18a00c=_0x4090ab[_0x38ea('0x48')]({'plain':!![]});_0x18a00c=qs['omit'](_0x18a00c,['id',_0x38ea('0x49'),_0x38ea('0x4a')]);_0x4330e8['body']=_['omit'](_0x4330e8[_0x38ea('0x4b')],['id','createdAt','updatedAt']);return db[_0x38ea('0x2e')]['create'](_[_0x38ea('0x3e')](_0x18a00c,_0x4330e8[_0x38ea('0x4b')]),{'include':_0x4330e8[_0x38ea('0x31')][_0x38ea('0x3f')]?[{'all':!![]}]:undefined});}})[_0x38ea('0x28')](respondWithResult(_0x16419c,0xc9))[_0x38ea('0x42')](handleError(_0x16419c,null));};exports[_0x38ea('0x4c')]=function(_0x3725e4,_0x1934a0){if(_0x3725e4[_0x38ea('0x4b')]['id']){delete _0x3725e4[_0x38ea('0x4b')]['id'];}return db[_0x38ea('0x2e')][_0x38ea('0x46')]({'where':{'id':_0x3725e4[_0x38ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x1934a0,null))[_0x38ea('0x28')](saveUpdates(_0x3725e4['body'],null))[_0x38ea('0x28')](respondWithResult(_0x1934a0,null))[_0x38ea('0x42')](handleError(_0x1934a0,null));};exports[_0x38ea('0x4d')]=function(_0x5f4b81,_0xdbef17){return db[_0x38ea('0x2e')][_0x38ea('0x46')]({'where':{'id':_0x5f4b81[_0x38ea('0x44')]['id']}})['then'](handleEntityNotFound(_0xdbef17,null))['then'](removeEntity(_0xdbef17,null))[_0x38ea('0x42')](handleError(_0xdbef17,null));};exports[_0x38ea('0x4e')]=function(_0x27c0eb,_0x72a67c,_0x46450b){_0x27c0eb[_0x38ea('0x4b')]['name']=_0x27c0eb[_0x38ea('0x4f')][_0x38ea('0x50')];_0x27c0eb[_0x38ea('0x4b')][_0x38ea('0x51')]=_0x27c0eb['file'][_0x38ea('0x52')];_0x27c0eb[_0x38ea('0x4b')]['type']=_0x27c0eb['file'][_0x38ea('0x53')];return db[_0x38ea('0x2e')]['create'](_0x27c0eb['body'])[_0x38ea('0x28')](respondWithResult(_0x72a67c,0xc9))[_0x38ea('0x42')](handleError(_0x72a67c,null));};exports['download']=function(_0x14a544,_0x1b9a8e,_0x1500d2){return db['Attachment'][_0x38ea('0x54')]({'where':{'id':_0x14a544['params']['id']},'raw':!![]})[_0x38ea('0x28')](handleEntityNotFound(_0x1b9a8e,null))[_0x38ea('0x28')](function(_0x2f420a){if(_0x2f420a){var _0x23a50=_0x2f420a[_0x38ea('0x55')]!==null;var _0xd967b4=path['join'](config[_0x38ea('0x56')],_0x38ea('0x57'));if(_0x23a50){_0xd967b4=path[_0x38ea('0x58')](_0xd967b4,_0x38ea('0x59'));}var _0x47159f=path[_0x38ea('0x58')](_0xd967b4,_0x2f420a[_0x38ea('0x51')]);return _0x1b9a8e[_0x38ea('0x5a')](_0x47159f);}})['catch'](handleError(_0x1b9a8e,null));}; \ No newline at end of file +var _0x8a48=['map','Attachment','rawAttributes','type','key','query','keys','filters','model','intersection','attributes','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','length','find','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','root','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x35c8f5,_0x399f44){var _0xb5c718=function(_0x50450c){while(--_0x50450c){_0x35c8f5['push'](_0x35c8f5['shift']());}};_0xb5c718(++_0x399f44);}(_0x8a48,0xd9));var _0x88a4=function(_0x1ed621,_0x4285cd){_0x1ed621=_0x1ed621-0x0;var _0xfa474f=_0x8a48[_0x1ed621];return _0xfa474f;};'use strict';var emlformat=require(_0x88a4('0x0'));var rimraf=require(_0x88a4('0x1'));var zipdir=require(_0x88a4('0x2'));var jsonpatch=require(_0x88a4('0x3'));var rp=require(_0x88a4('0x4'));var moment=require(_0x88a4('0x5'));var BPromise=require(_0x88a4('0x6'));var Mustache=require(_0x88a4('0x7'));var util=require('util');var path=require(_0x88a4('0x8'));var sox=require(_0x88a4('0x9'));var csv=require(_0x88a4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88a4('0xb'));var _=require(_0x88a4('0xc'));var squel=require('squel');var crypto=require(_0x88a4('0xd'));var jsforce=require(_0x88a4('0xe'));var deskjs=require(_0x88a4('0xf'));var toCsv=require(_0x88a4('0xa'));var querystring=require(_0x88a4('0x10'));var Papa=require(_0x88a4('0x11'));var Redis=require('ioredis');var authService=require(_0x88a4('0x12'));var qs=require(_0x88a4('0x13'));var as=require(_0x88a4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88a4('0x15'))(_0x88a4('0x16'));var utils=require(_0x88a4('0x17'));var config=require(_0x88a4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x88a4('0x19'))['db'];function respondWithStatusCode(_0x54e0ec,_0x1a8b43){_0x1a8b43=_0x1a8b43||0xcc;return function(_0x5b163a){if(_0x5b163a){return _0x54e0ec['sendStatus'](_0x1a8b43);}return _0x54e0ec[_0x88a4('0x1a')](_0x1a8b43)[_0x88a4('0x1b')]();};}function respondWithResult(_0x4b3530,_0x34d55e){_0x34d55e=_0x34d55e||0xc8;return function(_0xdc7457){if(_0xdc7457){return _0x4b3530[_0x88a4('0x1a')](_0x34d55e)[_0x88a4('0x1c')](_0xdc7457);}};}function respondWithFilteredResult(_0x5410fd,_0x4e242c){return function(_0x38f7a9){if(_0x38f7a9){var _0x12e2cb=typeof _0x4e242c[_0x88a4('0x1d')]===_0x88a4('0x1e')&&typeof _0x4e242c[_0x88a4('0x1f')]==='undefined';var _0x108776=_0x38f7a9['count'];var _0x3b05ba=_0x12e2cb?0x0:_0x4e242c[_0x88a4('0x1d')];var _0x1963d5=_0x12e2cb?_0x38f7a9[_0x88a4('0x20')]:_0x4e242c[_0x88a4('0x1d')]+_0x4e242c[_0x88a4('0x1f')];var _0x437b28;if(_0x1963d5>=_0x108776){_0x1963d5=_0x108776;_0x437b28=0xc8;}else{_0x437b28=0xce;}_0x5410fd[_0x88a4('0x1a')](_0x437b28);return _0x5410fd[_0x88a4('0x21')](_0x88a4('0x22'),_0x3b05ba+'-'+_0x1963d5+'/'+_0x108776)[_0x88a4('0x1c')](_0x38f7a9);}return null;};}function patchUpdates(_0xff8f18){return function(_0x230c22){try{jsonpatch[_0x88a4('0x23')](_0x230c22,_0xff8f18,!![]);}catch(_0x159f16){return BPromise[_0x88a4('0x24')](_0x159f16);}return _0x230c22[_0x88a4('0x25')]();};}function saveUpdates(_0x54ba81,_0x527b31){return function(_0x72cb96){if(_0x72cb96){return _0x72cb96[_0x88a4('0x26')](_0x54ba81)['then'](function(_0x39045a){return _0x39045a;});}return null;};}function removeEntity(_0x3aa1ec,_0x26b74e){return function(_0x2524e3){if(_0x2524e3){return _0x2524e3[_0x88a4('0x27')]()[_0x88a4('0x28')](function(){_0x3aa1ec[_0x88a4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b03aa,_0x40560d){return function(_0x43d8d4){if(!_0x43d8d4){_0x1b03aa['sendStatus'](0x194);}return _0x43d8d4;};}function handleError(_0x419d0f,_0x482643){_0x482643=_0x482643||0x1f4;return function(_0x35aa73){logger[_0x88a4('0x29')](_0x35aa73[_0x88a4('0x2a')]);if(_0x35aa73[_0x88a4('0x2b')]){delete _0x35aa73[_0x88a4('0x2b')];}_0x419d0f[_0x88a4('0x1a')](_0x482643)['send'](_0x35aa73);};}exports['index']=function(_0x48241b,_0x516b90){var _0x3a8eb8={},_0x2fbe62={},_0x1afe21={'count':0x0,'rows':[]};var _0x28be89=_[_0x88a4('0x2c')](db[_0x88a4('0x2d')][_0x88a4('0x2e')],function(_0xe9f26a){return{'name':_0xe9f26a['fieldName'],'type':_0xe9f26a[_0x88a4('0x2f')][_0x88a4('0x30')]};});_0x2fbe62['model']=_[_0x88a4('0x2c')](_0x28be89,_0x88a4('0x2b'));_0x2fbe62[_0x88a4('0x31')]=_[_0x88a4('0x32')](_0x48241b[_0x88a4('0x31')]);_0x2fbe62[_0x88a4('0x33')]=_['intersection'](_0x2fbe62[_0x88a4('0x34')],_0x2fbe62['query']);_0x3a8eb8['attributes']=_[_0x88a4('0x35')](_0x2fbe62[_0x88a4('0x34')],qs['fields'](_0x48241b[_0x88a4('0x31')]['fields']));_0x3a8eb8[_0x88a4('0x36')]=_0x3a8eb8[_0x88a4('0x36')]['length']?_0x3a8eb8[_0x88a4('0x36')]:_0x2fbe62['model'];if(!_0x48241b[_0x88a4('0x31')][_0x88a4('0x37')](_0x88a4('0x38'))){_0x3a8eb8[_0x88a4('0x1f')]=qs['limit'](_0x48241b[_0x88a4('0x31')]['limit']);_0x3a8eb8[_0x88a4('0x1d')]=qs['offset'](_0x48241b[_0x88a4('0x31')][_0x88a4('0x1d')]);}_0x3a8eb8[_0x88a4('0x39')]=qs['sort'](_0x48241b[_0x88a4('0x31')]['sort']);_0x3a8eb8[_0x88a4('0x3a')]=qs[_0x88a4('0x33')](_['pick'](_0x48241b[_0x88a4('0x31')],_0x2fbe62['filters']),_0x28be89);if(_0x48241b[_0x88a4('0x31')][_0x88a4('0x3b')]){_0x3a8eb8[_0x88a4('0x3a')]=_[_0x88a4('0x3c')](_0x3a8eb8[_0x88a4('0x3a')],{'$or':_[_0x88a4('0x2c')](_0x28be89,function(_0x26dc50){if(_0x26dc50[_0x88a4('0x2f')]!==_0x88a4('0x3d')){var _0x38a52e={};_0x38a52e[_0x26dc50[_0x88a4('0x2b')]]={'$like':'%'+_0x48241b['query'][_0x88a4('0x3b')]+'%'};return _0x38a52e;}})});}_0x3a8eb8=_[_0x88a4('0x3c')]({},_0x3a8eb8,_0x48241b[_0x88a4('0x3e')]);var _0x300617={'where':_0x3a8eb8[_0x88a4('0x3a')]};return db[_0x88a4('0x2d')]['count'](_0x300617)['then'](function(_0x2e8b04){_0x1afe21['count']=_0x2e8b04;if(_0x48241b[_0x88a4('0x31')][_0x88a4('0x3f')]){_0x3a8eb8[_0x88a4('0x40')]=[{'all':!![]}];}return db['Attachment'][_0x88a4('0x41')](_0x3a8eb8);})[_0x88a4('0x28')](function(_0x16fcba){_0x1afe21[_0x88a4('0x42')]=_0x16fcba;return _0x1afe21;})['then'](respondWithFilteredResult(_0x516b90,_0x3a8eb8))[_0x88a4('0x43')](handleError(_0x516b90,null));};exports['show']=function(_0x50dd29,_0xb32661){var _0x8cbc45={'raw':!![],'where':{'id':_0x50dd29[_0x88a4('0x44')]['id']}},_0x458194={};_0x458194['model']=_[_0x88a4('0x32')](db[_0x88a4('0x2d')][_0x88a4('0x2e')]);_0x458194[_0x88a4('0x31')]=_['keys'](_0x50dd29[_0x88a4('0x31')]);_0x458194[_0x88a4('0x33')]=_[_0x88a4('0x35')](_0x458194[_0x88a4('0x34')],_0x458194[_0x88a4('0x31')]);_0x8cbc45[_0x88a4('0x36')]=_[_0x88a4('0x35')](_0x458194[_0x88a4('0x34')],qs[_0x88a4('0x45')](_0x50dd29[_0x88a4('0x31')][_0x88a4('0x45')]));_0x8cbc45[_0x88a4('0x36')]=_0x8cbc45[_0x88a4('0x36')][_0x88a4('0x46')]?_0x8cbc45['attributes']:_0x458194[_0x88a4('0x34')];if(_0x50dd29[_0x88a4('0x31')]['includeAll']){_0x8cbc45[_0x88a4('0x40')]=[{'all':!![]}];}_0x8cbc45=_[_0x88a4('0x3c')]({},_0x8cbc45,_0x50dd29[_0x88a4('0x3e')]);return db[_0x88a4('0x2d')][_0x88a4('0x47')](_0x8cbc45)[_0x88a4('0x28')](handleEntityNotFound(_0xb32661,null))[_0x88a4('0x28')](respondWithResult(_0xb32661,null))[_0x88a4('0x43')](handleError(_0xb32661,null));};exports['clone']=function(_0x3cad92,_0x2bca86){var _0x6e6af4={'where':{'id':_0x3cad92[_0x88a4('0x44')]['id']}},_0x1038b={};_0x1038b[_0x88a4('0x34')]=_[_0x88a4('0x32')](db[_0x88a4('0x2d')]['rawAttributes']);_0x6e6af4['attributes']=_['intersection'](_0x1038b[_0x88a4('0x34')],qs[_0x88a4('0x45')](_0x3cad92['query'][_0x88a4('0x45')]));_0x6e6af4[_0x88a4('0x36')]=_0x6e6af4['attributes'][_0x88a4('0x46')]?_0x6e6af4[_0x88a4('0x36')]:_0x1038b['model'];if(_0x3cad92[_0x88a4('0x31')]['includeAll']){_0x6e6af4['include']=[{'all':!![]}];}_0x6e6af4=_[_0x88a4('0x3c')]({},_0x6e6af4,_0x3cad92[_0x88a4('0x3e')]);return db[_0x88a4('0x2d')][_0x88a4('0x47')](_0x6e6af4)['then'](handleEntityNotFound(_0x2bca86,null))[_0x88a4('0x28')](function(_0x3be9fc){if(_0x3be9fc){var _0x6bb6e0=_0x3be9fc['get']({'plain':!![]});_0x6bb6e0=qs[_0x88a4('0x48')](_0x6bb6e0,['id',_0x88a4('0x49'),_0x88a4('0x4a')]);_0x3cad92[_0x88a4('0x4b')]=_[_0x88a4('0x48')](_0x3cad92[_0x88a4('0x4b')],['id',_0x88a4('0x49'),'updatedAt']);return db['Attachment'][_0x88a4('0x4c')](_[_0x88a4('0x3c')](_0x6bb6e0,_0x3cad92[_0x88a4('0x4b')]),{'include':_0x3cad92[_0x88a4('0x31')][_0x88a4('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2bca86,0xc9))[_0x88a4('0x43')](handleError(_0x2bca86,null));};exports[_0x88a4('0x26')]=function(_0x21809c,_0x379979){if(_0x21809c['body']['id']){delete _0x21809c[_0x88a4('0x4b')]['id'];}return db[_0x88a4('0x2d')]['find']({'where':{'id':_0x21809c[_0x88a4('0x44')]['id']}})[_0x88a4('0x28')](handleEntityNotFound(_0x379979,null))[_0x88a4('0x28')](saveUpdates(_0x21809c[_0x88a4('0x4b')],null))[_0x88a4('0x28')](respondWithResult(_0x379979,null))[_0x88a4('0x43')](handleError(_0x379979,null));};exports['destroy']=function(_0x4cd64e,_0x3e5e34){return db[_0x88a4('0x2d')]['find']({'where':{'id':_0x4cd64e[_0x88a4('0x44')]['id']}})[_0x88a4('0x28')](handleEntityNotFound(_0x3e5e34,null))['then'](removeEntity(_0x3e5e34,null))[_0x88a4('0x43')](handleError(_0x3e5e34,null));};exports['create']=function(_0x2d4b0c,_0x310cfe,_0x42d1fd){_0x2d4b0c['body'][_0x88a4('0x2b')]=_0x2d4b0c[_0x88a4('0x4d')][_0x88a4('0x4e')];_0x2d4b0c[_0x88a4('0x4b')][_0x88a4('0x4f')]=_0x2d4b0c[_0x88a4('0x4d')][_0x88a4('0x50')];_0x2d4b0c['body'][_0x88a4('0x2f')]=_0x2d4b0c[_0x88a4('0x4d')][_0x88a4('0x51')];return db[_0x88a4('0x2d')][_0x88a4('0x4c')](_0x2d4b0c[_0x88a4('0x4b')])[_0x88a4('0x28')](respondWithResult(_0x310cfe,0xc9))[_0x88a4('0x43')](handleError(_0x310cfe,null));};exports[_0x88a4('0x52')]=function(_0x44e4d1,_0x28d640,_0x145e4d){return db[_0x88a4('0x2d')]['findOne']({'where':{'id':_0x44e4d1[_0x88a4('0x44')]['id']},'raw':!![]})[_0x88a4('0x28')](handleEntityNotFound(_0x28d640,null))[_0x88a4('0x28')](function(_0x42523e){if(_0x42523e){var _0x6082b6=_0x42523e[_0x88a4('0x53')]!==null;var _0xa3263=path['join'](config[_0x88a4('0x54')],'server/files/attachments/');if(_0x6082b6){_0xa3263=path[_0x88a4('0x55')](_0xa3263,_0x88a4('0x56'));}var _0x4264de=path[_0x88a4('0x55')](_0xa3263,_0x42523e[_0x88a4('0x4f')]);return _0x28d640[_0x88a4('0x52')](_0x4264de);}})[_0x88a4('0x43')](handleError(_0x28d640,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index aa900d9..a5d73dc 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 _0x567d=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x567d,0xb5));var _0xd567=function(_0x162bbf,_0x352570){_0x162bbf=_0x162bbf-0x0;var _0x24814d=_0x567d[_0x162bbf];return _0x24814d;};'use strict';var _=require(_0xd567('0x0'));var util=require(_0xd567('0x1'));var logger=require('../../config/logger')(_0xd567('0x2'));var moment=require(_0xd567('0x3'));var BPromise=require(_0xd567('0x4'));var rp=require(_0xd567('0x5'));var fs=require('fs');var path=require(_0xd567('0x6'));var rimraf=require(_0xd567('0x7'));var config=require(_0xd567('0x8'));var attributes=require(_0xd567('0x9'));module[_0xd567('0xa')]=function(_0x3afe8e,_0x42abcb){return _0x3afe8e[_0xd567('0xb')](_0xd567('0xc'),attributes,{'tableName':_0xd567('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777d=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash'];(function(_0x12a7c2,_0x36cebc){var _0x18b2ca=function(_0x5f5d5b){while(--_0x5f5d5b){_0x12a7c2['push'](_0x12a7c2['shift']());}};_0x18b2ca(++_0x36cebc);}(_0x777d,0x77));var _0xd777=function(_0x392f82,_0x4dc713){_0x392f82=_0x392f82-0x0;var _0x3ad0b8=_0x777d[_0x392f82];return _0x3ad0b8;};'use strict';var _=require(_0xd777('0x0'));var util=require(_0xd777('0x1'));var logger=require('../../config/logger')(_0xd777('0x2'));var moment=require(_0xd777('0x3'));var BPromise=require(_0xd777('0x4'));var rp=require(_0xd777('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd777('0x6'));var config=require(_0xd777('0x7'));var attributes=require('./attachment.attributes');module[_0xd777('0x8')]=function(_0xece4b9,_0x3fb74e){return _0xece4b9[_0xd777('0x9')](_0xd777('0xa'),attributes,{'tableName':_0xd777('0xb'),'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 4188df4..8bb6c04 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 _0xc5ba=['catch','CreateAttachment','Attachment','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x13a0b9,_0x480013){var _0x3ca303=function(_0x439706){while(--_0x439706){_0x13a0b9['push'](_0x13a0b9['shift']());}};_0x3ca303(++_0x480013);}(_0xc5ba,0xb9));var _0xac5b=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xc5ba[_0x487496];return _0x539dc8;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var BPromise=require(_0xac5b('0x3'));var rs=require(_0xac5b('0x4'));var fs=require('fs');var Redis=require(_0xac5b('0x5'));var db=require(_0xac5b('0x6'))['db'];var utils=require(_0xac5b('0x7'));var logger=require(_0xac5b('0x8'))(_0xac5b('0x9'));var config=require(_0xac5b('0xa'));var jayson=require(_0xac5b('0xb'));var client=jayson[_0xac5b('0xc')][_0xac5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38602a,_0xc09fbc,_0xc193a7){return new BPromise(function(_0x4a7fc7,_0x525e20){return client[_0xac5b('0xe')](_0x38602a,_0xc193a7)['then'](function(_0x3c5bd3){logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));logger[_0xac5b('0x12')](_0xac5b('0x13'),_0xc09fbc,_0xac5b('0x11'),JSON[_0xac5b('0x14')](_0x3c5bd3));if(_0x3c5bd3[_0xac5b('0x15')]){if(_0x3c5bd3['error'][_0xac5b('0x16')]===0x1f4){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x525e20(_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);}logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x4a7fc7(_0x3c5bd3[_0xac5b('0x15')]['message']);}else{logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));_0x4a7fc7(_0x3c5bd3[_0xac5b('0x18')][_0xac5b('0x17')]);}})[_0xac5b('0x19')](function(_0x363de5){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x363de5);_0x525e20(_0x363de5);});});}exports[_0xac5b('0x1a')]=function(_0x11e6fa){var _0x551ccf=this;return new Promise(function(_0x2db8d1,_0x4c46e5){return db[_0xac5b('0x1b')]['create'](_0x11e6fa[_0xac5b('0x1c')],{'raw':_0x11e6fa[_0xac5b('0x1d')]?_0x11e6fa['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3dbc5b){logger['info'](_0xac5b('0x1a'),_0x11e6fa);logger[_0xac5b('0x12')](_0xac5b('0x1a'),_0x11e6fa,JSON[_0xac5b('0x14')](_0x3dbc5b));_0x2db8d1(_0x3dbc5b);})[_0xac5b('0x19')](function(_0x5a4b94){logger['error']('CreateAttachment',_0x5a4b94[_0xac5b('0x17')],_0x11e6fa);_0x4c46e5(_0x551ccf['error'](0x1f4,_0x5a4b94[_0xac5b('0x17')]));});});}; \ No newline at end of file +var _0x0a9a=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','CreateAttachment','Attachment','create','body','options','raw','debug','util','bluebird','randomstring'];(function(_0x1781e7,_0x5cdbab){var _0x259c49=function(_0x2c1a7a){while(--_0x2c1a7a){_0x1781e7['push'](_0x1781e7['shift']());}};_0x259c49(++_0x5cdbab);}(_0x0a9a,0x183));var _0xa0a9=function(_0x2a7d73,_0x5bac95){_0x2a7d73=_0x2a7d73-0x0;var _0x2eee92=_0x0a9a[_0x2a7d73];return _0x2eee92;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('Attachment,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('Attachment,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});}exports[_0xa0a9('0x13')]=function(_0x568409){var _0x320735=this;return new Promise(function(_0x126401,_0x33eb8f){return db[_0xa0a9('0x14')][_0xa0a9('0x15')](_0x568409[_0xa0a9('0x16')],{'raw':_0x568409['options']?_0x568409[_0xa0a9('0x17')][_0xa0a9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x53b99d){logger[_0xa0a9('0x11')](_0xa0a9('0x13'),_0x568409);logger[_0xa0a9('0x19')]('CreateAttachment',_0x568409,JSON[_0xa0a9('0xe')](_0x53b99d));_0x126401(_0x53b99d);})['catch'](function(_0x1fb36b){logger['error'](_0xa0a9('0x13'),_0x1fb36b[_0xa0a9('0x10')],_0x568409);_0x33eb8f(_0x320735[_0xa0a9('0xf')](0x1f4,_0x1fb36b[_0xa0a9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 886ce59..09fa461 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 _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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0b0e,0x187));var _0xe0b0=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x0b0e[_0x251e8c];return _0x1e0c1d;};'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 +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4006ce5..615c6e8 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 _0xcb8f=['Strategy','moment','bluebird','../../mysqldb','../../components/auth/service','../../config/environment','api','activedirectory','undefined','url','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','then','name','domain','clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xcb8f,0xdb));var _0xfcb8=function(_0x54a923,_0x583ad2){_0x54a923=_0x54a923-0x0;var _0x4aa73f=_0xcb8f[_0x54a923];return _0x4aa73f;};'use strict';var passport=require(_0xfcb8('0x0'));var LocalStrategy=require('passport-local')[_0xfcb8('0x1')];var moment=require(_0xfcb8('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xfcb8('0x3'));var util=require('util');var db=require(_0xfcb8('0x4'))['db'];var authService=require(_0xfcb8('0x5'));var utils=require('../../config/utils');var config=require(_0xfcb8('0x6'));var logger=require('../../config/logger')(_0xfcb8('0x7'));function isActiveDirectoryConfigured(_0x490cc5){var _0x324f6e=![];if(typeof _0x490cc5[_0xfcb8('0x8')]!==_0xfcb8('0x9')){_0x324f6e=_0x490cc5[_0xfcb8('0x8')]['baseDN']&&_0x490cc5['activedirectory'][_0xfcb8('0xa')]&&_0x490cc5['activedirectory']['domain'];}return _0x324f6e;}function adAuthenticate(_0x1a3bee,_0x1e10a1,_0x5766ae){return new BPromise(function(_0x535b26,_0x365215){try{var _0x559006=new ActiveDirectory(_0x1a3bee);_0x559006[_0xfcb8('0xb')](_0x1e10a1,_0x5766ae,function(_0xd0448a,_0x5e46a6){if(_0xd0448a){logger[_0xfcb8('0xc')]('Error\x20authenticate\x20%s:\x20%s',_0x1e10a1,util[_0xfcb8('0xd')](_0xd0448a,{'showHidden':![],'depth':null}));_0x365215(_0xfcb8('0xe'));}else if(!_0x5e46a6){logger['error'](_0xfcb8('0xf'),_0x1e10a1);_0x365215(_0xfcb8('0xe'));}else{_0x535b26(_0x5e46a6);}});}catch(_0x1d6baf){_0x365215(_0x1d6baf);}});}function ActiveDirectoryAuthenticate(_0x34de87,_0x4f9e29,_0x34bca6,_0x5b2059){var _0x39c0a2,_0x233b37;if(!isActiveDirectoryConfigured(config)){logger[_0xfcb8('0xc')](_0xfcb8('0x10'),_0x4f9e29);return _0x5b2059(null,![],{'message':_0xfcb8('0xe')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xfcb8('0x11'),_0xfcb8('0x12')],'raw':!![]})['then'](function(_0x3a0278){_0x39c0a2=_0x3a0278;if(!_0x39c0a2[_0xfcb8('0x11')]){logger[_0xfcb8('0xc')](_0xfcb8('0x13'),_0x4f9e29);throw new Error(_0xfcb8('0xe'));}return _0x34de87['findOne']({'attributes':['id','name',_0xfcb8('0x14'),_0xfcb8('0x15'),_0xfcb8('0x16'),_0xfcb8('0x17'),_0xfcb8('0x18'),_0xfcb8('0x19'),_0xfcb8('0x1a')],'where':{'name':_0x4f9e29,'role':{'$or':[_0xfcb8('0x1b'),_0xfcb8('0x1c'),_0xfcb8('0x1d')]},'adSsoEnabled':!![]}});})[_0xfcb8('0x1e')](function(_0x4a3745){if(!_0x4a3745||_0x4a3745&&_0x4a3745[_0xfcb8('0x1f')]!==_0x4f9e29){throw new Error(_0xfcb8('0xe'));}_0x233b37=_0x4a3745;var _0x3c35a6=_0x233b37[_0xfcb8('0x1f')]+'@'+config[_0xfcb8('0x8')][_0xfcb8('0x20')];return adAuthenticate(config[_0xfcb8('0x8')],_0x3c35a6,_0x34bca6);})[_0xfcb8('0x1e')](function(_0x5024df){if(_0x233b37[_0xfcb8('0x17')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x39c0a2[_0xfcb8('0x12')]>0x0){if(_0x233b37[_0xfcb8('0x18')]){if(moment(_0x233b37['blockedAt'])['add'](_0x39c0a2[_0xfcb8('0x12')],'minutes')>moment()){throw new Error(_0xfcb8('0xe'));}return utils[_0xfcb8('0x21')](_0x233b37,0x0,![],null)[_0xfcb8('0x1e')](function(){return utils[_0xfcb8('0x22')](_0x233b37);})[_0xfcb8('0x1e')](function(){return _0x5b2059(null,_0x233b37);});}else{return utils[_0xfcb8('0x22')](_0x233b37)[_0xfcb8('0x1e')](function(){return _0x5b2059(null,_0x233b37);});}}else{return utils[_0xfcb8('0x22')](_0x233b37)[_0xfcb8('0x1e')](function(){return _0x5b2059(null,_0x233b37);});}})[_0xfcb8('0x23')](function(_0xfb9e36){return _0x5b2059(null,![],_0xfb9e36);});}function handleError(_0x5527db,_0x5ddecc,_0x170804){return _0x5527db[_0xfcb8('0x24')](_0x5ddecc||0x1f4)[_0xfcb8('0x25')]({'message':_0x170804?_0x170804['message']||_0x170804:''});}exports[_0xfcb8('0x26')]=function(_0x550f08,_0x132fe0,_0x1c5909){passport[_0xfcb8('0xb')](_0xfcb8('0x27'),function(_0x168a19,_0x2f6c60,_0x51d03b){var _0x202b6c=_0x168a19||_0x51d03b;if(_0x202b6c){return handleError(_0x132fe0,0x191,_0x202b6c);}if(!_0x2f6c60){return handleError(_0x132fe0,0x194,{'message':_0xfcb8('0x28')});}else{var _0x416d76={'payload':{'id':_0x2f6c60['id'],'role':_0x2f6c60[_0xfcb8('0x16')]},'options':{'expiresIn':0x15180}};return authService[_0xfcb8('0x29')](_0x416d76)[_0xfcb8('0x1e')](function(_0x23617c){_0x132fe0[_0xfcb8('0x2a')]({'id':_0x2f6c60['id'],'token':_0x23617c,'statusCall':'','isAlreadyLogged':_0x2f6c60[_0xfcb8('0x1a')]});});}})(_0x550f08,_0x132fe0,_0x1c5909);};passport['use'](_0xfcb8('0x27'),new LocalStrategy({'usernameField':_0xfcb8('0x1f'),'passwordField':'password'},function(_0x3030f9,_0x4f23e3,_0x373468){return ActiveDirectoryAuthenticate(db[_0xfcb8('0x2b')],_0x3030f9,_0x4f23e3,_0x373468);})); \ No newline at end of file +var _0xe998=['../../config/logger','api','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','admin','then','add','clearBlockUser','getLicense','catch','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','User','passport-local','Strategy','moment','activedirectory2','../../config/utils','../../config/environment'];(function(_0x5af2f4,_0xe66457){var _0x1c4b05=function(_0x39ec66){while(--_0x39ec66){_0x5af2f4['push'](_0x5af2f4['shift']());}};_0x1c4b05(++_0xe66457);}(_0xe998,0x87));var _0x8e99=function(_0x16ac03,_0x161baf){_0x16ac03=_0x16ac03-0x0;var _0x2c27b4=_0xe998[_0x16ac03];return _0x2c27b4;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x8e99('0x0'))[_0x8e99('0x1')];var moment=require(_0x8e99('0x2'));var ActiveDirectory=require(_0x8e99('0x3'));var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x8e99('0x4'));var config=require(_0x8e99('0x5'));var logger=require(_0x8e99('0x6'))(_0x8e99('0x7'));function isActiveDirectoryConfigured(_0x550d97){var _0xc270d9=![];if(typeof _0x550d97[_0x8e99('0x8')]!==_0x8e99('0x9')){_0xc270d9=_0x550d97[_0x8e99('0x8')][_0x8e99('0xa')]&&_0x550d97[_0x8e99('0x8')][_0x8e99('0xb')]&&_0x550d97[_0x8e99('0x8')][_0x8e99('0xc')];}return _0xc270d9;}function adAuthenticate(_0x4ef57c,_0x441ed7,_0x1b90d0){return new BPromise(function(_0x3bf003,_0x23cedf){try{var _0x4ead6d=new ActiveDirectory(_0x4ef57c);_0x4ead6d['authenticate'](_0x441ed7,_0x1b90d0,function(_0x1b8e51,_0x11a8cd){if(_0x1b8e51){logger[_0x8e99('0xd')](_0x8e99('0xe'),_0x441ed7,util['inspect'](_0x1b8e51,{'showHidden':![],'depth':null}));_0x23cedf(_0x8e99('0xf'));}else if(!_0x11a8cd){logger['error'](_0x8e99('0x10'),_0x441ed7);_0x23cedf('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3bf003(_0x11a8cd);}});}catch(_0x178cfc){_0x23cedf(_0x178cfc);}});}function ActiveDirectoryAuthenticate(_0x54a938,_0x3fef5e,_0x15da52,_0x4ccfa7){var _0x1bb52f,_0x2148e7;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x8e99('0x11'),_0x3fef5e);return _0x4ccfa7(null,![],{'message':_0x8e99('0xf')});}return db[_0x8e99('0x12')][_0x8e99('0x13')]({'where':{'id':0x1},'attributes':[_0x8e99('0x14'),_0x8e99('0x15')],'raw':!![]})['then'](function(_0x3d5366){_0x1bb52f=_0x3d5366;if(!_0x1bb52f[_0x8e99('0x14')]){logger[_0x8e99('0xd')](_0x8e99('0x16'),_0x3fef5e);throw new Error(_0x8e99('0xf'));}return _0x54a938[_0x8e99('0x13')]({'attributes':['id',_0x8e99('0x17'),_0x8e99('0x18'),_0x8e99('0x19'),_0x8e99('0x1a'),_0x8e99('0x1b'),_0x8e99('0x1c'),_0x8e99('0x1d'),'online'],'where':{'name':_0x3fef5e,'role':{'$or':[_0x8e99('0x1e'),'user','agent']},'adSsoEnabled':!![]}});})['then'](function(_0x1d9623){if(!_0x1d9623||_0x1d9623&&_0x1d9623[_0x8e99('0x17')]!==_0x3fef5e){throw new Error(_0x8e99('0xf'));}_0x2148e7=_0x1d9623;var _0x2fd783=_0x2148e7['name']+'@'+config[_0x8e99('0x8')][_0x8e99('0xc')];return adAuthenticate(config[_0x8e99('0x8')],_0x2fd783,_0x15da52);})[_0x8e99('0x1f')](function(_0x615399){if(_0x2148e7['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x1bb52f[_0x8e99('0x15')]>0x0){if(_0x2148e7[_0x8e99('0x1c')]){if(moment(_0x2148e7[_0x8e99('0x1d')])[_0x8e99('0x20')](_0x1bb52f[_0x8e99('0x15')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x8e99('0x21')](_0x2148e7,0x0,![],null)[_0x8e99('0x1f')](function(){return utils[_0x8e99('0x22')](_0x2148e7);})[_0x8e99('0x1f')](function(){return _0x4ccfa7(null,_0x2148e7);});}else{return utils['getLicense'](_0x2148e7)['then'](function(){return _0x4ccfa7(null,_0x2148e7);});}}else{return utils['getLicense'](_0x2148e7)[_0x8e99('0x1f')](function(){return _0x4ccfa7(null,_0x2148e7);});}})[_0x8e99('0x23')](function(_0x577a08){return _0x4ccfa7(null,![],_0x577a08);});}function handleError(_0x153b2a,_0x33ea04,_0x660e5){return _0x153b2a['status'](_0x33ea04||0x1f4)[_0x8e99('0x24')]({'message':_0x660e5?_0x660e5[_0x8e99('0x25')]||_0x660e5:''});}exports[_0x8e99('0x26')]=function(_0x9e1b65,_0x343175,_0x3dc11d){passport[_0x8e99('0x27')](_0x8e99('0x28'),function(_0x5ec590,_0xc7266d,_0x5a681d){var _0x5c0491=_0x5ec590||_0x5a681d;if(_0x5c0491){return handleError(_0x343175,0x191,_0x5c0491);}if(!_0xc7266d){return handleError(_0x343175,0x194,{'message':_0x8e99('0x29')});}else{var _0x2ae9d8={'payload':{'id':_0xc7266d['id'],'role':_0xc7266d[_0x8e99('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x8e99('0x2a')](_0x2ae9d8)[_0x8e99('0x1f')](function(_0x2a1952){_0x343175[_0x8e99('0x2b')]({'id':_0xc7266d['id'],'token':_0x2a1952,'statusCall':'','isAlreadyLogged':_0xc7266d[_0x8e99('0x2c')]});});}})(_0x9e1b65,_0x343175,_0x3dc11d);};passport[_0x8e99('0x2d')](_0x8e99('0x28'),new LocalStrategy({'usernameField':_0x8e99('0x17'),'passwordField':_0x8e99('0x18')},function(_0x2dbc9b,_0x59753b,_0x44bff3){return ActiveDirectoryAuthenticate(db[_0x8e99('0x2e')],_0x2dbc9b,_0x59753b,_0x44bff3);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 7590c2c..8a4d315 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 _0x7f7e=['login','exports','Router','./authActiveDirectory.controller','post'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7f7e,0x11a));var _0xe7f7=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7f7e[_0x46698a];return _0x356db0;};'use strict';var express=require('express');var router=express[_0xe7f7('0x0')]();var controller=require(_0xe7f7('0x1'));router[_0xe7f7('0x2')]('/',controller[_0xe7f7('0x3')]);module[_0xe7f7('0x4')]=router; \ No newline at end of file +var _0x4541=['Router','./authActiveDirectory.controller','post','login'];(function(_0x1d70af,_0x44e5c3){var _0x36d5bc=function(_0x3d3cc1){while(--_0x3d3cc1){_0x1d70af['push'](_0x1d70af['shift']());}};_0x36d5bc(++_0x44e5c3);}(_0x4541,0x130));var _0x1454=function(_0x44e0d2,_0x13d1f6){_0x44e0d2=_0x44e0d2-0x0;var _0x5f533e=_0x4541[_0x44e0d2];return _0x5f533e;};'use strict';var express=require('express');var router=express[_0x1454('0x0')]();var controller=require(_0x1454('0x1'));router[_0x1454('0x2')]('/',controller[_0x1454('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4bbcfef..b023f23 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(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7a54,0x106));var _0x47a5=function(_0x390ae8,_0x179258){_0x390ae8=_0x390ae8-0x0;var _0x30bd29=_0x7a54[_0x390ae8];return _0x30bd29;};'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 _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(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x5c4195,_0x37a5cc){_0x5c4195=_0x5c4195-0x0;var _0x18447a=_0x7a54[_0x5c4195];return _0x18447a;};'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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 50d1cf1..dca4e46 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 _0xac1d=['express','passport','Router','../user/user.controller.js','../../components/auth/service','login','get','callback','isMiddleware','setTokenCookie','exports'];(function(_0x2d69b4,_0x11503a){var _0x52300c=function(_0x5719e8){while(--_0x5719e8){_0x2d69b4['push'](_0x2d69b4['shift']());}};_0x52300c(++_0x11503a);}(_0xac1d,0xfd));var _0xdac1=function(_0x581032,_0x26a2c8){_0x581032=_0x581032-0x0;var _0x1f594a=_0xac1d[_0x581032];return _0x1f594a;};'use strict';var express=require(_0xdac1('0x0'));var passport=require(_0xdac1('0x1'));var router=express[_0xdac1('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xdac1('0x3'));var authService=require(_0xdac1('0x4'));router['get']('/',controller[_0xdac1('0x5')]);router[_0xdac1('0x6')]('/callback',controller[_0xdac1('0x7')],authService[_0xdac1('0x8')],userController[_0xdac1('0x5')],authService[_0xdac1('0x9')]);module[_0xdac1('0xa')]=router; \ No newline at end of file +var _0xcc37=['get','login','/callback','isMiddleware','exports','passport','Router','../user/user.controller.js','../../components/auth/service'];(function(_0x499a3f,_0x3d74c6){var _0x256a84=function(_0xb2d1a1){while(--_0xb2d1a1){_0x499a3f['push'](_0x499a3f['shift']());}};_0x256a84(++_0x3d74c6);}(_0xcc37,0xa7));var _0x7cc3=function(_0x5923fa,_0x21be16){_0x5923fa=_0x5923fa-0x0;var _0xd422f7=_0xcc37[_0x5923fa];return _0xd422f7;};'use strict';var express=require('express');var passport=require(_0x7cc3('0x0'));var router=express[_0x7cc3('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x7cc3('0x2'));var authService=require(_0x7cc3('0x3'));router[_0x7cc3('0x4')]('/',controller[_0x7cc3('0x5')]);router[_0x7cc3('0x4')](_0x7cc3('0x6'),controller['callback'],authService[_0x7cc3('0x7')],userController[_0x7cc3('0x5')],authService['setTokenCookie']);module[_0x7cc3('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e59f92d..d04ed0c 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 _0x5487=['email','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','Email\x20parameter\x20is\x20missing','body','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','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','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','save','use','passport','passport-local','Strategy','jayson/promise','lodash','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','disabled','blockedAt','loginAttempts','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','format'];(function(_0x239a37,_0x1675c8){var _0x46db3c=function(_0x3c02a2){while(--_0x3c02a2){_0x239a37['push'](_0x239a37['shift']());}};_0x46db3c(++_0x1675c8);}(_0x5487,0x111));var _0x7548=function(_0x3d7b32,_0x52517f){_0x3d7b32=_0x3d7b32-0x0;var _0x4fbdf6=_0x5487[_0x3d7b32];return _0x4fbdf6;};'use strict';var util=require('util');var passport=require(_0x7548('0x0'));var LocalStrategy=require(_0x7548('0x1'))[_0x7548('0x2')];var jayson=require(_0x7548('0x3'));var _=require(_0x7548('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x7548('0x5'))['db'];var authService=require(_0x7548('0x6'));var utils=require(_0x7548('0x7'));var client=jayson['client'][_0x7548('0x8')]({'port':0x232b});function localAuthenticate(_0x1e9ee6,_0x2dde0f,_0x2e6145,_0x25ac6b){var _0x5bf078,_0x5cb3ae;return db[_0x7548('0x9')][_0x7548('0xa')]({'where':{'id':0x1},'attributes':[_0x7548('0xb'),_0x7548('0xc')],'raw':!![]})['then'](function(_0x11bbd1){_0x5bf078=_0x11bbd1;return _0x1e9ee6[_0x7548('0xa')]({'attributes':['id',_0x7548('0xd'),_0x7548('0xe'),'salt','role',_0x7548('0xf'),'blocked',_0x7548('0x10'),_0x7548('0x11')],'where':{'name':_0x2dde0f,'role':{'$or':['admin',_0x7548('0x12'),_0x7548('0x13')]}}});})[_0x7548('0x14')](function(_0x1d0f74){if(!_0x1d0f74||_0x1d0f74&&_0x1d0f74['name']!==_0x2dde0f){throw new Error(_0x7548('0x15'));}else{_0x5cb3ae=_0x1d0f74;return _0x5cb3ae;}})[_0x7548('0x14')](function(){_0x5cb3ae[_0x7548('0x16')](_0x2e6145,function(_0x27ce73,_0x2836f9){var _0x13e925=_0x5cb3ae['loginAttempts']+0x1;if(_0x27ce73){return _0x25ac6b(_0x27ce73);}else if(!_0x2836f9){if(_0x5cb3ae[_0x7548('0xf')]){return _0x25ac6b(null,![],{'message':_0x7548('0x15')});}else if(_0x5bf078[_0x7548('0xb')]>0x0){if(_0x5cb3ae[_0x7548('0x17')]){if(_0x5bf078['blockDuration']>0x0){if(moment(_0x5cb3ae['blockedAt'])[_0x7548('0x18')](_0x5bf078[_0x7548('0xc')],_0x7548('0x19'))>moment()){return _0x25ac6b(null,![],{'message':_0x7548('0x15')});}else{return utils[_0x7548('0x1a')](_0x5cb3ae,_0x13e925,![],null)['then'](function(){return _0x25ac6b(null,![],{'message':_0x7548('0x15')});});}}else{return _0x25ac6b(null,![],{'message':_0x7548('0x15')});}}else{if(_0x13e925>=_0x5bf078[_0x7548('0xb')]){return utils[_0x7548('0x1a')](_0x5cb3ae,0x0,!![],moment())[_0x7548('0x14')](function(){return _0x25ac6b(null,![],{'message':_0x7548('0x15')});});}else{return utils[_0x7548('0x1a')](_0x5cb3ae,_0x13e925,![],null)['then'](function(){return _0x25ac6b(null,![],{'message':_0x7548('0x15')});});}}}else{return _0x25ac6b(null,![],{'message':_0x7548('0x15')});}}else{if(_0x5cb3ae[_0x7548('0xf')]){return _0x25ac6b(null,![],{'message':_0x7548('0x15')});}else if(_0x5bf078[_0x7548('0xb')]>0x0){if(_0x5cb3ae[_0x7548('0x17')]){if(_0x5bf078[_0x7548('0xc')]>0x0){if(moment(_0x5cb3ae[_0x7548('0x10')])[_0x7548('0x18')](_0x5bf078[_0x7548('0xc')],_0x7548('0x19'))>moment()){return _0x25ac6b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x5cb3ae,0x0,![],null)['then'](function(){return utils[_0x7548('0x1b')](_0x5cb3ae);})['then'](function(){return _0x25ac6b(null,_0x5cb3ae);});}}else{return _0x25ac6b(null,![],{'message':_0x7548('0x15')});}}else{return utils[_0x7548('0x1a')](_0x5cb3ae,0x0,![],null)[_0x7548('0x14')](function(){return utils['getLicense'](_0x5cb3ae);})[_0x7548('0x14')](function(){return _0x25ac6b(null,_0x5cb3ae);})['catch'](function(_0x51d67b){return _0x25ac6b(null,![],_0x51d67b);});}}else{if(_0x5cb3ae[_0x7548('0x17')]){return _0x25ac6b(null,![],{'message':_0x7548('0x15')});}else{return utils[_0x7548('0x1b')](_0x5cb3ae)[_0x7548('0x14')](function(){return _0x25ac6b(null,_0x5cb3ae);});}}}});})[_0x7548('0x1c')](function(_0x351eb3){return _0x25ac6b(null,![],_0x351eb3);});}function sendServiceMail(_0x4d3a3f){return db[_0x7548('0x1d')][_0x7548('0x1e')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0x7548('0x1f'),'include':[{'model':db[_0x7548('0x20')],'as':_0x7548('0x20')}]}]})['then'](function(_0x42b2b5){if(!_0x42b2b5){throw new Error(_0x7548('0x21'));}var _0x3b3a4e=_0x42b2b5['getSmtpOptions']();var _0x377306={'account':_0x3b3a4e,'message':_['merge']({'from':util[_0x7548('0x22')]('\x22%s\x22\x20<%s>',_0x42b2b5[_0x7548('0xd')],_0x42b2b5[_0x7548('0x23')]||_0x42b2b5['Smtp'][_0x7548('0x12')])},_0x4d3a3f)};return client['request'](_0x7548('0x24'),_0x377306);})['then'](function(_0x51bf8b){if(_0x51bf8b[_0x7548('0x25')]){throw new Error(util[_0x7548('0x22')](_0x7548('0x26'),_0x51bf8b[_0x7548('0x25')][_0x7548('0x27')]||JSON[_0x7548('0x28')](_0x51bf8b[_0x7548('0x25')])));}return!![];});}function handleError(_0x555a26,_0x5cf87e,_0x1f6357){return _0x555a26[_0x7548('0x29')](_0x5cf87e||0x1f4)['send']({'message':_0x1f6357?_0x1f6357['message']||_0x1f6357:''});}exports[_0x7548('0x2a')]=function(_0x246066,_0x1ecf95,_0x4e752f){passport[_0x7548('0x16')](_0x7548('0x2b'),function(_0x4f69cb,_0x5e8fea,_0x321de2){var _0x3076fc=_0x4f69cb||_0x321de2;if(_0x3076fc){return handleError(_0x1ecf95,0x191,_0x3076fc);}if(!_0x5e8fea){return handleError(_0x1ecf95,0x194,{'message':_0x7548('0x2c')});}else{var _0x3a0898={'payload':{'id':_0x5e8fea['id'],'role':_0x5e8fea['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3a0898)[_0x7548('0x14')](function(_0x16e254){_0x1ecf95[_0x7548('0x2d')]({'id':_0x5e8fea['id'],'token':_0x16e254,'statusCall':'','isAlreadyLogged':_0x5e8fea['online']});});}})(_0x246066,_0x1ecf95,_0x4e752f);};exports['forgot']=function(_0x12cd37,_0x50cec1){if(!_0x12cd37['body'][_0x7548('0x23')]){return handleError(_0x50cec1,0x1f4,{'message':_0x7548('0x2e')});}var _0x46fe9a=rs['generate']();_0x12cd37[_0x7548('0x2f')][_0x7548('0x23')]=_0x12cd37[_0x7548('0x2f')][_0x7548('0x23')][_0x7548('0x30')]()[_0x7548('0x31')]();var _0x30d16e;return db[_0x7548('0x9')][_0x7548('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7548('0xc')],'raw':!![]})[_0x7548('0x14')](function(_0x2137f7){_0x30d16e=_0x2137f7;return db['User'][_0x7548('0x1e')]({'where':{'email':_0x12cd37[_0x7548('0x2f')][_0x7548('0x23')]}});})[_0x7548('0x14')](function(_0x4c8ce5){if(!_0x4c8ce5){throw new Error(_0x7548('0x32'));}if(_0x4c8ce5[_0x7548('0xf')]){throw new Error(_0x7548('0x33'));}if(_0x4c8ce5[_0x7548('0x17')]){if(moment(_0x4c8ce5[_0x7548('0x10')])['add'](_0x30d16e[_0x7548('0xc')],_0x7548('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4c8ce5[_0x7548('0x17')]=![];_0x4c8ce5[_0x7548('0x10')]=null;}}_0x4c8ce5['resetPasswordToken']=_0x46fe9a;_0x4c8ce5[_0x7548('0x34')]=Date['now']()+0x36ee80;return _0x4c8ce5['save']();})[_0x7548('0x14')](function(){return sendServiceMail({'to':_0x12cd37['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x7548('0x35')+_0x7548('0x36')+_0x7548('0x37')+_0x12cd37[_0x7548('0x38')][_0x7548('0x39')]+_0x7548('0x3a')+_0x46fe9a+'\x0a\x0a'+_0x7548('0x3b')});})['then'](function(){_0x50cec1['status'](0xc8)[_0x7548('0x3c')]({'message':_0x7548('0x3d')});})[_0x7548('0x1c')](function(_0x222534){return handleError(_0x50cec1,0x1f4,_0x222534);});};exports[_0x7548('0x3e')]=function(_0x28e38c,_0x316683){return db[_0x7548('0x3f')][_0x7548('0x1e')]({'where':{'resetPasswordToken':_0x28e38c[_0x7548('0x40')][_0x7548('0x41')],'resetPasswordExpires':{'$gt':Date[_0x7548('0x42')]()}}})[_0x7548('0x14')](function(_0x175a76){if(!_0x175a76){throw new Error(_0x7548('0x43'));}return db[_0x7548('0x9')][_0x7548('0xa')]({'attributes':['id',_0x7548('0x44'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x7548('0x14')](function(_0x406558){if(_0x406558['securePassword'])authService[_0x7548('0x45')](_0x28e38c['body']['password']);if(!_0x406558[_0x7548('0x46')]||!_0x175a76[_0x7548('0x47')])return _0x175a76;authService[_0x7548('0x48')](_0x28e38c[_0x7548('0x2f')][_0x7548('0xe')],_0x175a76[_0x7548('0x47')],_0x406558[_0x7548('0x49')]);return _0x175a76;})[_0x7548('0x14')](function(){_0x175a76[_0x7548('0xe')]=_0x28e38c['body'][_0x7548('0xe')];_0x175a76[_0x7548('0x4a')]=null;_0x175a76[_0x7548('0x34')]=null;return _0x175a76[_0x7548('0x4b')]();});})[_0x7548('0x14')](function(){_0x316683[_0x7548('0x29')](0xc8)[_0x7548('0x3c')]({'message':'Password\x20reset!'});})['catch'](function(_0x1b9f2a){return handleError(_0x316683,0x1f4,_0x1b9f2a);});};passport[_0x7548('0x4c')](_0x7548('0x2b'),new LocalStrategy({'usernameField':_0x7548('0xd'),'passwordField':'password'},function(_0x493475,_0x3c0566,_0x52bc87){return localAuthenticate(db[_0x7548('0x3f')],_0x493475,_0x3c0566,_0x52bc87);})); \ No newline at end of file +var _0x8a3d=['json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','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','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','send','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','password','salt','role','blockedAt','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','disabled','blocked','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x4f3b1e,_0x2acf11){var _0x343004=function(_0x52a098){while(--_0x52a098){_0x4f3b1e['push'](_0x4f3b1e['shift']());}};_0x343004(++_0x2acf11);}(_0x8a3d,0x7b));var _0xd8a3=function(_0x201331,_0x493fde){_0x201331=_0x201331-0x0;var _0x271513=_0x8a3d[_0x201331];return _0x271513;};'use strict';var util=require(_0xd8a3('0x0'));var passport=require('passport');var LocalStrategy=require(_0xd8a3('0x1'))[_0xd8a3('0x2')];var jayson=require(_0xd8a3('0x3'));var _=require('lodash');var rs=require(_0xd8a3('0x4'));var moment=require('moment');var db=require(_0xd8a3('0x5'))['db'];var authService=require(_0xd8a3('0x6'));var utils=require(_0xd8a3('0x7'));var client=jayson[_0xd8a3('0x8')][_0xd8a3('0x9')]({'port':0x232b});function localAuthenticate(_0xf683f2,_0x33e21c,_0x521408,_0xa87ff7){var _0x128d8b,_0x2879ad;return db['Setting'][_0xd8a3('0xa')]({'where':{'id':0x1},'attributes':[_0xd8a3('0xb'),_0xd8a3('0xc')],'raw':!![]})[_0xd8a3('0xd')](function(_0xad08bb){_0x128d8b=_0xad08bb;return _0xf683f2['findOne']({'attributes':['id','name',_0xd8a3('0xe'),_0xd8a3('0xf'),_0xd8a3('0x10'),'disabled','blocked',_0xd8a3('0x11'),'loginAttempts'],'where':{'name':_0x33e21c,'role':{'$or':[_0xd8a3('0x12'),_0xd8a3('0x13'),_0xd8a3('0x14')]}}});})[_0xd8a3('0xd')](function(_0x5606ec){if(!_0x5606ec||_0x5606ec&&_0x5606ec[_0xd8a3('0x15')]!==_0x33e21c){throw new Error(_0xd8a3('0x16'));}else{_0x2879ad=_0x5606ec;return _0x2879ad;}})['then'](function(){_0x2879ad['authenticate'](_0x521408,function(_0x59548d,_0x3ef179){var _0x187da2=_0x2879ad[_0xd8a3('0x17')]+0x1;if(_0x59548d){return _0xa87ff7(_0x59548d);}else if(!_0x3ef179){if(_0x2879ad[_0xd8a3('0x18')]){return _0xa87ff7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x128d8b[_0xd8a3('0xb')]>0x0){if(_0x2879ad[_0xd8a3('0x19')]){if(_0x128d8b[_0xd8a3('0xc')]>0x0){if(moment(_0x2879ad['blockedAt'])[_0xd8a3('0x1a')](_0x128d8b['blockDuration'],'minutes')>moment()){return _0xa87ff7(null,![],{'message':_0xd8a3('0x16')});}else{return utils[_0xd8a3('0x1b')](_0x2879ad,_0x187da2,![],null)['then'](function(){return _0xa87ff7(null,![],{'message':_0xd8a3('0x16')});});}}else{return _0xa87ff7(null,![],{'message':_0xd8a3('0x16')});}}else{if(_0x187da2>=_0x128d8b[_0xd8a3('0xb')]){return utils['clearBlockUser'](_0x2879ad,0x0,!![],moment())['then'](function(){return _0xa87ff7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xd8a3('0x1b')](_0x2879ad,_0x187da2,![],null)['then'](function(){return _0xa87ff7(null,![],{'message':_0xd8a3('0x16')});});}}}else{return _0xa87ff7(null,![],{'message':_0xd8a3('0x16')});}}else{if(_0x2879ad[_0xd8a3('0x18')]){return _0xa87ff7(null,![],{'message':_0xd8a3('0x16')});}else if(_0x128d8b[_0xd8a3('0xb')]>0x0){if(_0x2879ad['blocked']){if(_0x128d8b[_0xd8a3('0xc')]>0x0){if(moment(_0x2879ad[_0xd8a3('0x11')])[_0xd8a3('0x1a')](_0x128d8b[_0xd8a3('0xc')],_0xd8a3('0x1c'))>moment()){return _0xa87ff7(null,![],{'message':_0xd8a3('0x16')});}else{return utils[_0xd8a3('0x1b')](_0x2879ad,0x0,![],null)[_0xd8a3('0xd')](function(){return utils['getLicense'](_0x2879ad);})['then'](function(){return _0xa87ff7(null,_0x2879ad);});}}else{return _0xa87ff7(null,![],{'message':_0xd8a3('0x16')});}}else{return utils[_0xd8a3('0x1b')](_0x2879ad,0x0,![],null)[_0xd8a3('0xd')](function(){return utils[_0xd8a3('0x1d')](_0x2879ad);})[_0xd8a3('0xd')](function(){return _0xa87ff7(null,_0x2879ad);})[_0xd8a3('0x1e')](function(_0x50f274){return _0xa87ff7(null,![],_0x50f274);});}}else{if(_0x2879ad['blocked']){return _0xa87ff7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd8a3('0x1d')](_0x2879ad)[_0xd8a3('0xd')](function(){return _0xa87ff7(null,_0x2879ad);});}}}});})[_0xd8a3('0x1e')](function(_0x2d2f9e){return _0xa87ff7(null,![],_0x2d2f9e);});}function sendServiceMail(_0x46c90a){return db[_0xd8a3('0x1f')][_0xd8a3('0x20')]({'where':{'service':!![]},'attributes':['id',_0xd8a3('0x15'),'email'],'include':[{'model':db[_0xd8a3('0x21')],'as':_0xd8a3('0x22'),'include':[{'model':db['CloudProvider'],'as':_0xd8a3('0x23')}]}]})[_0xd8a3('0xd')](function(_0x382451){if(!_0x382451){throw new Error(_0xd8a3('0x24'));}var _0x4d2a9c=_0x382451['getSmtpOptions']();var _0x4d2961={'account':_0x4d2a9c,'message':_[_0xd8a3('0x25')]({'from':util[_0xd8a3('0x26')](_0xd8a3('0x27'),_0x382451[_0xd8a3('0x15')],_0x382451[_0xd8a3('0x28')]||_0x382451['Smtp'][_0xd8a3('0x13')])},_0x46c90a)};return client[_0xd8a3('0x29')](_0xd8a3('0x2a'),_0x4d2961);})[_0xd8a3('0xd')](function(_0x309803){if(_0x309803[_0xd8a3('0x2b')]){throw new Error(util[_0xd8a3('0x26')](_0xd8a3('0x2c'),_0x309803['error']['message']||JSON[_0xd8a3('0x2d')](_0x309803['error'])));}return!![];});}function handleError(_0x193c13,_0x47c98d,_0xcd20ea){return _0x193c13[_0xd8a3('0x2e')](_0x47c98d||0x1f4)['send']({'message':_0xcd20ea?_0xcd20ea['message']||_0xcd20ea:''});}exports[_0xd8a3('0x2f')]=function(_0x4da933,_0x140269,_0x58ac22){passport['authenticate'](_0xd8a3('0x30'),function(_0x30d708,_0x1e2c2d,_0x5f361d){var _0x455c2e=_0x30d708||_0x5f361d;if(_0x455c2e){return handleError(_0x140269,0x191,_0x455c2e);}if(!_0x1e2c2d){return handleError(_0x140269,0x194,{'message':_0xd8a3('0x31')});}else{var _0x1ec776={'payload':{'id':_0x1e2c2d['id'],'role':_0x1e2c2d['role']},'options':{'expiresIn':0x15180}};return authService[_0xd8a3('0x32')](_0x1ec776)['then'](function(_0x18a39f){_0x140269[_0xd8a3('0x33')]({'id':_0x1e2c2d['id'],'token':_0x18a39f,'statusCall':'','isAlreadyLogged':_0x1e2c2d[_0xd8a3('0x34')]});});}})(_0x4da933,_0x140269,_0x58ac22);};exports['forgot']=function(_0x2841ac,_0x5cdc2e){if(!_0x2841ac[_0xd8a3('0x35')]['email']){return handleError(_0x5cdc2e,0x1f4,{'message':_0xd8a3('0x36')});}var _0x118f54=rs[_0xd8a3('0x37')]();_0x2841ac[_0xd8a3('0x35')]['email']=_0x2841ac['body']['email'][_0xd8a3('0x38')]()[_0xd8a3('0x39')]();var _0x114f4e;return db[_0xd8a3('0x3a')][_0xd8a3('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd8a3('0xc')],'raw':!![]})[_0xd8a3('0xd')](function(_0x84dc1a){_0x114f4e=_0x84dc1a;return db[_0xd8a3('0x3b')][_0xd8a3('0x20')]({'where':{'email':_0x2841ac[_0xd8a3('0x35')][_0xd8a3('0x28')]}});})[_0xd8a3('0xd')](function(_0x2f4e8b){if(!_0x2f4e8b){throw new Error(_0xd8a3('0x3c'));}if(_0x2f4e8b[_0xd8a3('0x18')]){throw new Error(_0xd8a3('0x3d'));}if(_0x2f4e8b[_0xd8a3('0x19')]){if(moment(_0x2f4e8b[_0xd8a3('0x11')])[_0xd8a3('0x1a')](_0x114f4e[_0xd8a3('0xc')],_0xd8a3('0x1c'))>moment()){throw new Error(_0xd8a3('0x3e'));}else{_0x2f4e8b[_0xd8a3('0x19')]=![];_0x2f4e8b[_0xd8a3('0x11')]=null;}}_0x2f4e8b[_0xd8a3('0x3f')]=_0x118f54;_0x2f4e8b[_0xd8a3('0x40')]=Date['now']()+0x36ee80;return _0x2f4e8b[_0xd8a3('0x41')]();})['then'](function(){return sendServiceMail({'to':_0x2841ac[_0xd8a3('0x35')][_0xd8a3('0x28')],'subject':_0xd8a3('0x42'),'text':_0xd8a3('0x43')+_0xd8a3('0x44')+_0xd8a3('0x45')+_0x2841ac[_0xd8a3('0x46')][_0xd8a3('0x47')]+_0xd8a3('0x48')+_0x118f54+'\x0a\x0a'+_0xd8a3('0x49')});})[_0xd8a3('0xd')](function(){_0x5cdc2e['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0xd8a3('0x1e')](function(_0x461bb6){return handleError(_0x5cdc2e,0x1f4,_0x461bb6);});};exports[_0xd8a3('0x4a')]=function(_0x5343d3,_0x4b30e8){return db[_0xd8a3('0x3b')][_0xd8a3('0x20')]({'where':{'resetPasswordToken':_0x5343d3[_0xd8a3('0x4b')][_0xd8a3('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xd8a3('0x4d')]()}}})[_0xd8a3('0xd')](function(_0x3c7881){if(!_0x3c7881){throw new Error(_0xd8a3('0x4e'));}return db[_0xd8a3('0x3a')]['findOne']({'attributes':['id',_0xd8a3('0x4f'),_0xd8a3('0x50'),_0xd8a3('0x51')]})['then'](function(_0x1d3de5){if(_0x1d3de5['securePassword'])authService['validatePasswordPattern'](_0x5343d3[_0xd8a3('0x35')][_0xd8a3('0xe')]);if(!_0x1d3de5[_0xd8a3('0x50')]||!_0x3c7881[_0xd8a3('0x52')])return _0x3c7881;authService[_0xd8a3('0x53')](_0x5343d3['body'][_0xd8a3('0xe')],_0x3c7881[_0xd8a3('0x52')],_0x1d3de5[_0xd8a3('0x51')]);return _0x3c7881;})[_0xd8a3('0xd')](function(){_0x3c7881[_0xd8a3('0xe')]=_0x5343d3[_0xd8a3('0x35')][_0xd8a3('0xe')];_0x3c7881['resetPasswordToken']=null;_0x3c7881[_0xd8a3('0x40')]=null;return _0x3c7881[_0xd8a3('0x41')]();});})['then'](function(){_0x4b30e8['status'](0xc8)[_0xd8a3('0x54')]({'message':_0xd8a3('0x55')});})[_0xd8a3('0x1e')](function(_0x1b36e9){return handleError(_0x4b30e8,0x1f4,_0x1b36e9);});};passport[_0xd8a3('0x56')]('local-login',new LocalStrategy({'usernameField':_0xd8a3('0x15'),'passwordField':_0xd8a3('0xe')},function(_0x25d14b,_0x246979,_0x46edbc){return localAuthenticate(db[_0xd8a3('0x3b')],_0x25d14b,_0x246979,_0x46edbc);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 6e9bb8d..51362fa 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 _0x19a6=['login','forgot','reset','exports','express','Router','./authLocal.controller','post'];(function(_0xbf6cb3,_0x279890){var _0x4992b2=function(_0x43774d){while(--_0x43774d){_0xbf6cb3['push'](_0xbf6cb3['shift']());}};_0x4992b2(++_0x279890);}(_0x19a6,0x1f4));var _0x619a=function(_0x101422,_0x13684d){_0x101422=_0x101422-0x0;var _0xc103c2=_0x19a6[_0x101422];return _0xc103c2;};'use strict';var express=require(_0x619a('0x0'));var router=express[_0x619a('0x1')]();var controller=require(_0x619a('0x2'));router[_0x619a('0x3')]('/',controller[_0x619a('0x4')]);router[_0x619a('0x3')]('/forgot',controller[_0x619a('0x5')]);router[_0x619a('0x3')]('/reset/:token',controller[_0x619a('0x6')]);module[_0x619a('0x7')]=router; \ No newline at end of file +var _0x2305=['post','/forgot','/reset/:token','reset','exports','login'];(function(_0x5f5c59,_0x169b7c){var _0x5a5f48=function(_0x5c6489){while(--_0x5c6489){_0x5f5c59['push'](_0x5f5c59['shift']());}};_0x5a5f48(++_0x169b7c);}(_0x2305,0x83));var _0x5230=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x2305[_0x20cc29];return _0x28d513;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller[_0x5230('0x0')]);router[_0x5230('0x1')](_0x5230('0x2'),controller['forgot']);router[_0x5230('0x1')](_0x5230('0x3'),controller[_0x5230('0x4')]);module[_0x5230('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 784aa7b..0f63cad 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 _0x48a5=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x34dfb5,_0x18bfbd){var _0xdf48f2=function(_0x2348fa){while(--_0x2348fa){_0x34dfb5['push'](_0x34dfb5['shift']());}};_0xdf48f2(++_0x18bfbd);}(_0x48a5,0x11a));var _0x548a=function(_0x2afdce,_0x55666f){_0x2afdce=_0x2afdce-0x0;var _0x4b4706=_0x48a5[_0x2afdce];return _0x4b4706;};'use strict';var Sequelize=require(_0x548a('0x0'));module[_0x548a('0x1')]={'name':{'type':Sequelize[_0x548a('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x548a('0x2')]},'status':{'type':Sequelize[_0x548a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x548a('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x2ebc=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x2ebc,0x111));var _0xc2eb=function(_0x5d1055,_0x3ebc71){_0x5d1055=_0x5d1055-0x0;var _0x3f8da1=_0x2ebc[_0x5d1055];return _0x3f8da1;};'use strict';var Sequelize=require(_0xc2eb('0x0'));module['exports']={'name':{'type':Sequelize[_0xc2eb('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xc2eb('0x1')]},'description':{'type':Sequelize[_0xc2eb('0x1')]},'status':{'type':Sequelize[_0xc2eb('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc2eb('0x3')],'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 3224360..31baca8 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 _0x7305=['addActions','getActions','sort','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','end','error','stack','name','send','map','Automation','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','addConditions','Condition','ids','omit','getConditions','findOne','length','nolimit','Action'];(function(_0x1fa436,_0x75851b){var _0x3329da=function(_0x474f5a){while(--_0x474f5a){_0x1fa436['push'](_0x1fa436['shift']());}};_0x3329da(++_0x75851b);}(_0x7305,0xb1));var _0x5730=function(_0x4e84d5,_0x8d87fe){_0x4e84d5=_0x4e84d5-0x0;var _0x4b1852=_0x7305[_0x4e84d5];return _0x4b1852;};'use strict';var emlformat=require(_0x5730('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5730('0x1'));var rp=require('request-promise');var moment=require(_0x5730('0x2'));var BPromise=require(_0x5730('0x3'));var Mustache=require(_0x5730('0x4'));var util=require(_0x5730('0x5'));var path=require(_0x5730('0x6'));var sox=require(_0x5730('0x7'));var csv=require(_0x5730('0x8'));var ejs=require(_0x5730('0x9'));var fs=require('fs');var fs_extra=require(_0x5730('0xa'));var _=require(_0x5730('0xb'));var squel=require(_0x5730('0xc'));var crypto=require(_0x5730('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5730('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5730('0xf'));var Papa=require(_0x5730('0x10'));var Redis=require(_0x5730('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5730('0x12'));var as=require(_0x5730('0x13'));var hardwareService=require(_0x5730('0x14'));var logger=require(_0x5730('0x15'))(_0x5730('0x16'));var utils=require(_0x5730('0x17'));var config=require(_0x5730('0x18'));var licenseUtil=require(_0x5730('0x19'));var db=require(_0x5730('0x1a'))['db'];function respondWithStatusCode(_0x23b2da,_0x420177){_0x420177=_0x420177||0xcc;return function(_0x3aac8a){if(_0x3aac8a){return _0x23b2da[_0x5730('0x1b')](_0x420177);}return _0x23b2da[_0x5730('0x1c')](_0x420177)['end']();};}function respondWithResult(_0x305272,_0x2b0d1c){_0x2b0d1c=_0x2b0d1c||0xc8;return function(_0x336f15){if(_0x336f15){return _0x305272[_0x5730('0x1c')](_0x2b0d1c)[_0x5730('0x1d')](_0x336f15);}};}function respondWithFilteredResult(_0x432f52,_0x43888c){return function(_0x25c9aa){if(_0x25c9aa){var _0x5473f5=typeof _0x43888c[_0x5730('0x1e')]===_0x5730('0x1f')&&typeof _0x43888c[_0x5730('0x20')]===_0x5730('0x1f');var _0x7b127d=_0x25c9aa[_0x5730('0x21')];var _0x187a08=_0x5473f5?0x0:_0x43888c[_0x5730('0x1e')];var _0xbbb2a2=_0x5473f5?_0x25c9aa[_0x5730('0x21')]:_0x43888c[_0x5730('0x1e')]+_0x43888c[_0x5730('0x20')];var _0x1a55f7;if(_0xbbb2a2>=_0x7b127d){_0xbbb2a2=_0x7b127d;_0x1a55f7=0xc8;}else{_0x1a55f7=0xce;}_0x432f52[_0x5730('0x1c')](_0x1a55f7);return _0x432f52[_0x5730('0x22')](_0x5730('0x23'),_0x187a08+'-'+_0xbbb2a2+'/'+_0x7b127d)['json'](_0x25c9aa);}return null;};}function patchUpdates(_0x135683){return function(_0x4e9cc1){try{jsonpatch['apply'](_0x4e9cc1,_0x135683,!![]);}catch(_0xf88878){return BPromise['reject'](_0xf88878);}return _0x4e9cc1[_0x5730('0x24')]();};}function saveUpdates(_0x2bfcc8,_0x284e74){return function(_0x22881c){if(_0x22881c){return _0x22881c['update'](_0x2bfcc8)[_0x5730('0x25')](function(_0x3b1a98){return _0x3b1a98;});}return null;};}function removeEntity(_0x4731dc,_0x2be306){return function(_0x49e2ef){if(_0x49e2ef){return _0x49e2ef[_0x5730('0x26')]()[_0x5730('0x25')](function(){_0x4731dc[_0x5730('0x1c')](0xcc)[_0x5730('0x27')]();});}};}function handleEntityNotFound(_0x3f9a0b,_0x432497){return function(_0x2f9a03){if(!_0x2f9a03){_0x3f9a0b['sendStatus'](0x194);}return _0x2f9a03;};}function handleError(_0x4d17cf,_0x3200dd){_0x3200dd=_0x3200dd||0x1f4;return function(_0xfa9d8f){logger[_0x5730('0x28')](_0xfa9d8f[_0x5730('0x29')]);if(_0xfa9d8f[_0x5730('0x2a')]){delete _0xfa9d8f['name'];}_0x4d17cf[_0x5730('0x1c')](_0x3200dd)[_0x5730('0x2b')](_0xfa9d8f);};}exports['index']=function(_0x478e87,_0x4d0cc4){var _0x52d4e5={},_0x4a9ac8={},_0x173715={'count':0x0,'rows':[]};var _0x5c45f2=_[_0x5730('0x2c')](db[_0x5730('0x2d')][_0x5730('0x2e')],function(_0x3c1687){return{'name':_0x3c1687['fieldName'],'type':_0x3c1687[_0x5730('0x2f')][_0x5730('0x30')]};});_0x4a9ac8[_0x5730('0x31')]=_[_0x5730('0x2c')](_0x5c45f2,'name');_0x4a9ac8[_0x5730('0x32')]=_[_0x5730('0x33')](_0x478e87[_0x5730('0x32')]);_0x4a9ac8[_0x5730('0x34')]=_[_0x5730('0x35')](_0x4a9ac8['model'],_0x4a9ac8[_0x5730('0x32')]);_0x52d4e5[_0x5730('0x36')]=_[_0x5730('0x35')](_0x4a9ac8['model'],qs[_0x5730('0x37')](_0x478e87['query'][_0x5730('0x37')]));_0x52d4e5[_0x5730('0x36')]=_0x52d4e5[_0x5730('0x36')]['length']?_0x52d4e5['attributes']:_0x4a9ac8[_0x5730('0x31')];if(!_0x478e87[_0x5730('0x32')][_0x5730('0x38')]('nolimit')){_0x52d4e5['limit']=qs[_0x5730('0x20')](_0x478e87[_0x5730('0x32')]['limit']);_0x52d4e5['offset']=qs[_0x5730('0x1e')](_0x478e87[_0x5730('0x32')][_0x5730('0x1e')]);}_0x52d4e5[_0x5730('0x39')]=qs['sort'](_0x478e87[_0x5730('0x32')]['sort']);_0x52d4e5['where']=qs['filters'](_[_0x5730('0x3a')](_0x478e87[_0x5730('0x32')],_0x4a9ac8[_0x5730('0x34')]),_0x5c45f2);if(_0x478e87[_0x5730('0x32')]['filter']){_0x52d4e5[_0x5730('0x3b')]=_[_0x5730('0x3c')](_0x52d4e5[_0x5730('0x3b')],{'$or':_[_0x5730('0x2c')](_0x5c45f2,function(_0x509cb3){if(_0x509cb3['type']!==_0x5730('0x3d')){var _0x228868={};_0x228868[_0x509cb3[_0x5730('0x2a')]]={'$like':'%'+_0x478e87['query'][_0x5730('0x3e')]+'%'};return _0x228868;}})});}_0x52d4e5=_[_0x5730('0x3c')]({},_0x52d4e5,_0x478e87[_0x5730('0x3f')]);var _0x2aa6d1={'where':_0x52d4e5[_0x5730('0x3b')]};return db[_0x5730('0x2d')][_0x5730('0x21')](_0x2aa6d1)[_0x5730('0x25')](function(_0xa06769){_0x173715[_0x5730('0x21')]=_0xa06769;if(_0x478e87[_0x5730('0x32')][_0x5730('0x40')]){_0x52d4e5[_0x5730('0x41')]=[{'all':!![]}];}return db[_0x5730('0x2d')][_0x5730('0x42')](_0x52d4e5);})[_0x5730('0x25')](function(_0x19c4ed){_0x173715[_0x5730('0x43')]=_0x19c4ed;return _0x173715;})[_0x5730('0x25')](respondWithFilteredResult(_0x4d0cc4,_0x52d4e5))[_0x5730('0x44')](handleError(_0x4d0cc4,null));};exports[_0x5730('0x45')]=function(_0x2e0fad,_0x5b6967){var _0x1dddb6={'raw':![],'where':{'id':_0x2e0fad[_0x5730('0x46')]['id']}},_0x18a8f9={};_0x18a8f9[_0x5730('0x31')]=_['keys'](db['Automation'][_0x5730('0x2e')]);_0x18a8f9[_0x5730('0x32')]=_[_0x5730('0x33')](_0x2e0fad[_0x5730('0x32')]);_0x18a8f9['filters']=_[_0x5730('0x35')](_0x18a8f9[_0x5730('0x31')],_0x18a8f9[_0x5730('0x32')]);_0x1dddb6[_0x5730('0x36')]=_[_0x5730('0x35')](_0x18a8f9[_0x5730('0x31')],qs['fields'](_0x2e0fad['query'][_0x5730('0x37')]));_0x1dddb6['attributes']=_0x1dddb6[_0x5730('0x36')]['length']?_0x1dddb6[_0x5730('0x36')]:_0x18a8f9['model'];if(_0x2e0fad['query']['includeAll']){_0x1dddb6[_0x5730('0x41')]=[{'all':!![]}];}_0x1dddb6=_[_0x5730('0x3c')]({},_0x1dddb6,_0x2e0fad[_0x5730('0x3f')]);return db[_0x5730('0x2d')]['find'](_0x1dddb6)[_0x5730('0x25')](handleEntityNotFound(_0x5b6967,null))[_0x5730('0x25')](respondWithResult(_0x5b6967,null))['catch'](handleError(_0x5b6967,null));};exports['create']=function(_0x13833a,_0x1edf57){return db['Automation'][_0x5730('0x47')](_0x13833a['body'],{})['then'](respondWithResult(_0x1edf57,0xc9))[_0x5730('0x44')](handleError(_0x1edf57,null));};exports[_0x5730('0x48')]=function(_0x443aa1,_0x163e2e){if(_0x443aa1[_0x5730('0x49')]['id']){delete _0x443aa1['body']['id'];}return db[_0x5730('0x2d')][_0x5730('0x4a')]({'where':{'id':_0x443aa1[_0x5730('0x46')]['id']}})[_0x5730('0x25')](handleEntityNotFound(_0x163e2e,null))[_0x5730('0x25')](saveUpdates(_0x443aa1[_0x5730('0x49')],null))['then'](respondWithResult(_0x163e2e,null))['catch'](handleError(_0x163e2e,null));};exports[_0x5730('0x26')]=function(_0x477d64,_0x1e6ab3){return db['Automation']['find']({'where':{'id':_0x477d64[_0x5730('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e6ab3,null))[_0x5730('0x25')](removeEntity(_0x1e6ab3,null))[_0x5730('0x44')](handleError(_0x1e6ab3,null));};exports[_0x5730('0x4b')]=function(_0xa7b7a2,_0x5f3a69,_0x245b07){return db[_0x5730('0x4c')][_0x5730('0x4a')]({'where':{'id':_0xa7b7a2['params']['id']}})[_0x5730('0x25')](handleEntityNotFound(_0x5f3a69,null))['then'](function(_0x4dfc39){if(_0x4dfc39){return _0x4dfc39['addConditions'](_0xa7b7a2[_0x5730('0x49')][_0x5730('0x4d')],_[_0x5730('0x4e')](_0xa7b7a2[_0x5730('0x49')],[_0x5730('0x4d'),'id'])||{});}})[_0x5730('0x25')](respondWithResult(_0x5f3a69,null))[_0x5730('0x44')](handleError(_0x5f3a69,null));};exports[_0x5730('0x4f')]=function(_0x24d907,_0x135db8,_0x3e8e30){var _0x434a24={};var _0x175469={};var _0x34c3b0;var _0x29b079;return db[_0x5730('0x2d')][_0x5730('0x50')]({'where':{'id':_0x24d907[_0x5730('0x46')]['id']}})[_0x5730('0x25')](handleEntityNotFound(_0x135db8,null))[_0x5730('0x25')](function(_0x29f897){if(_0x29f897){_0x34c3b0=_0x29f897;_0x175469['model']=_[_0x5730('0x33')](db[_0x5730('0x4c')][_0x5730('0x2e')]);_0x175469[_0x5730('0x32')]=_['keys'](_0x24d907[_0x5730('0x32')]);_0x175469[_0x5730('0x34')]=_['intersection'](_0x175469[_0x5730('0x31')],_0x175469[_0x5730('0x32')]);_0x434a24[_0x5730('0x36')]=_[_0x5730('0x35')](_0x175469[_0x5730('0x31')],qs[_0x5730('0x37')](_0x24d907['query'][_0x5730('0x37')]));_0x434a24[_0x5730('0x36')]=_0x434a24[_0x5730('0x36')][_0x5730('0x51')]?_0x434a24['attributes']:_0x175469[_0x5730('0x31')];_0x434a24[_0x5730('0x39')]=qs['sort'](_0x24d907[_0x5730('0x32')]['sort']);_0x434a24[_0x5730('0x3b')]=qs[_0x5730('0x34')](_['pick'](_0x24d907[_0x5730('0x32')],_0x175469[_0x5730('0x34')]));if(_0x24d907['query'][_0x5730('0x3e')]){_0x434a24[_0x5730('0x3b')]=_['merge'](_0x434a24[_0x5730('0x3b')],{'$or':_['map'](_0x434a24['attributes'],function(_0x521924){var _0x3b5e7d={};_0x3b5e7d[_0x521924]={'$like':'%'+_0x24d907[_0x5730('0x32')]['filter']+'%'};return _0x3b5e7d;})});}_0x434a24=_['merge']({},_0x434a24,_0x24d907[_0x5730('0x3f')]);return _0x34c3b0[_0x5730('0x4f')](_0x434a24);}})[_0x5730('0x25')](function(_0x18acd0){if(_0x18acd0){_0x29b079=_0x18acd0[_0x5730('0x51')];if(!_0x24d907[_0x5730('0x32')]['hasOwnProperty'](_0x5730('0x52'))){_0x434a24[_0x5730('0x20')]=qs[_0x5730('0x20')](_0x24d907[_0x5730('0x32')][_0x5730('0x20')]);_0x434a24[_0x5730('0x1e')]=qs[_0x5730('0x1e')](_0x24d907['query']['offset']);}return _0x34c3b0[_0x5730('0x4f')](_0x434a24);}})['then'](function(_0xc16eb4){if(_0xc16eb4){return _0xc16eb4?{'count':_0x29b079,'rows':_0xc16eb4}:null;}})['then'](respondWithResult(_0x135db8,null))[_0x5730('0x44')](handleError(_0x135db8,null));};exports['addActions']=function(_0x4b0130,_0x345c0a,_0x533b45){return db[_0x5730('0x53')][_0x5730('0x4a')]({'where':{'id':_0x4b0130[_0x5730('0x46')]['id']}})[_0x5730('0x25')](handleEntityNotFound(_0x345c0a,null))[_0x5730('0x25')](function(_0x8545d8){if(_0x8545d8){return _0x8545d8[_0x5730('0x54')](_0x4b0130[_0x5730('0x49')]['ids'],_[_0x5730('0x4e')](_0x4b0130[_0x5730('0x49')],[_0x5730('0x4d'),'id'])||{});}})[_0x5730('0x25')](respondWithResult(_0x345c0a,null))['catch'](handleError(_0x345c0a,null));};exports[_0x5730('0x55')]=function(_0x4c7e5,_0x1c1276,_0x2e9cf1){var _0x391712={};var _0xeec2a9={};var _0xa65374;var _0x20ca84;return db[_0x5730('0x2d')][_0x5730('0x50')]({'where':{'id':_0x4c7e5[_0x5730('0x46')]['id']}})[_0x5730('0x25')](handleEntityNotFound(_0x1c1276,null))['then'](function(_0x1074c4){if(_0x1074c4){_0xa65374=_0x1074c4;_0xeec2a9[_0x5730('0x31')]=_['keys'](db[_0x5730('0x53')][_0x5730('0x2e')]);_0xeec2a9[_0x5730('0x32')]=_[_0x5730('0x33')](_0x4c7e5[_0x5730('0x32')]);_0xeec2a9['filters']=_['intersection'](_0xeec2a9[_0x5730('0x31')],_0xeec2a9[_0x5730('0x32')]);_0x391712[_0x5730('0x36')]=_['intersection'](_0xeec2a9[_0x5730('0x31')],qs[_0x5730('0x37')](_0x4c7e5[_0x5730('0x32')]['fields']));_0x391712[_0x5730('0x36')]=_0x391712[_0x5730('0x36')]['length']?_0x391712[_0x5730('0x36')]:_0xeec2a9[_0x5730('0x31')];_0x391712[_0x5730('0x39')]=qs[_0x5730('0x56')](_0x4c7e5[_0x5730('0x32')][_0x5730('0x56')]);_0x391712[_0x5730('0x3b')]=qs[_0x5730('0x34')](_[_0x5730('0x3a')](_0x4c7e5[_0x5730('0x32')],_0xeec2a9[_0x5730('0x34')]));if(_0x4c7e5['query']['filter']){_0x391712[_0x5730('0x3b')]=_[_0x5730('0x3c')](_0x391712[_0x5730('0x3b')],{'$or':_[_0x5730('0x2c')](_0x391712[_0x5730('0x36')],function(_0xf33c7b){var _0x35fcfd={};_0x35fcfd[_0xf33c7b]={'$like':'%'+_0x4c7e5[_0x5730('0x32')][_0x5730('0x3e')]+'%'};return _0x35fcfd;})});}_0x391712=_[_0x5730('0x3c')]({},_0x391712,_0x4c7e5[_0x5730('0x3f')]);return _0xa65374[_0x5730('0x55')](_0x391712);}})['then'](function(_0xeb9521){if(_0xeb9521){_0x20ca84=_0xeb9521[_0x5730('0x51')];if(!_0x4c7e5['query'][_0x5730('0x38')](_0x5730('0x52'))){_0x391712[_0x5730('0x20')]=qs[_0x5730('0x20')](_0x4c7e5[_0x5730('0x32')][_0x5730('0x20')]);_0x391712[_0x5730('0x1e')]=qs[_0x5730('0x1e')](_0x4c7e5['query'][_0x5730('0x1e')]);}return _0xa65374['getActions'](_0x391712);}})[_0x5730('0x25')](function(_0xb935cd){if(_0xb935cd){return _0xb935cd?{'count':_0x20ca84,'rows':_0xb935cd}:null;}})[_0x5730('0x25')](respondWithResult(_0x1c1276,null))[_0x5730('0x44')](handleError(_0x1c1276,null));}; \ No newline at end of file +var _0xbfcf=['fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','length','find','create','body','catch','update','addConditions','Condition','ids','omit','getConditions','nolimit','addActions','Action','getActions','findOne','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes'];(function(_0x5c8c43,_0x2d2571){var _0x53522d=function(_0x3440fb){while(--_0x3440fb){_0x5c8c43['push'](_0x5c8c43['shift']());}};_0x53522d(++_0x2d2571);}(_0xbfcf,0xcc));var _0xfbfc=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0xbfcf[_0x9307ea];return _0x295554;};'use strict';var emlformat=require(_0xfbfc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbfc('0x1'));var jsonpatch=require(_0xfbfc('0x2'));var rp=require('request-promise');var moment=require(_0xfbfc('0x3'));var BPromise=require(_0xfbfc('0x4'));var Mustache=require(_0xfbfc('0x5'));var util=require(_0xfbfc('0x6'));var path=require(_0xfbfc('0x7'));var sox=require(_0xfbfc('0x8'));var csv=require(_0xfbfc('0x9'));var ejs=require(_0xfbfc('0xa'));var fs=require('fs');var fs_extra=require(_0xfbfc('0xb'));var _=require(_0xfbfc('0xc'));var squel=require(_0xfbfc('0xd'));var crypto=require(_0xfbfc('0xe'));var jsforce=require(_0xfbfc('0xf'));var deskjs=require(_0xfbfc('0x10'));var toCsv=require(_0xfbfc('0x9'));var querystring=require(_0xfbfc('0x11'));var Papa=require(_0xfbfc('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfbfc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbfc('0x14'));var logger=require(_0xfbfc('0x15'))(_0xfbfc('0x16'));var utils=require('../../config/utils');var config=require(_0xfbfc('0x17'));var licenseUtil=require(_0xfbfc('0x18'));var db=require(_0xfbfc('0x19'))['db'];function respondWithStatusCode(_0x3adac3,_0x25fdb0){_0x25fdb0=_0x25fdb0||0xcc;return function(_0x41fc1e){if(_0x41fc1e){return _0x3adac3['sendStatus'](_0x25fdb0);}return _0x3adac3[_0xfbfc('0x1a')](_0x25fdb0)[_0xfbfc('0x1b')]();};}function respondWithResult(_0x1bbdb0,_0x77ba2e){_0x77ba2e=_0x77ba2e||0xc8;return function(_0x1ef4ab){if(_0x1ef4ab){return _0x1bbdb0[_0xfbfc('0x1a')](_0x77ba2e)[_0xfbfc('0x1c')](_0x1ef4ab);}};}function respondWithFilteredResult(_0x18a9a8,_0x1dd088){return function(_0x52a358){if(_0x52a358){var _0x466f36=typeof _0x1dd088[_0xfbfc('0x1d')]==='undefined'&&typeof _0x1dd088[_0xfbfc('0x1e')]===_0xfbfc('0x1f');var _0x477fda=_0x52a358[_0xfbfc('0x20')];var _0x311373=_0x466f36?0x0:_0x1dd088[_0xfbfc('0x1d')];var _0x3a8978=_0x466f36?_0x52a358[_0xfbfc('0x20')]:_0x1dd088[_0xfbfc('0x1d')]+_0x1dd088[_0xfbfc('0x1e')];var _0x2b469b;if(_0x3a8978>=_0x477fda){_0x3a8978=_0x477fda;_0x2b469b=0xc8;}else{_0x2b469b=0xce;}_0x18a9a8['status'](_0x2b469b);return _0x18a9a8[_0xfbfc('0x21')](_0xfbfc('0x22'),_0x311373+'-'+_0x3a8978+'/'+_0x477fda)[_0xfbfc('0x1c')](_0x52a358);}return null;};}function patchUpdates(_0x3eab44){return function(_0x35b7f1){try{jsonpatch[_0xfbfc('0x23')](_0x35b7f1,_0x3eab44,!![]);}catch(_0x24c8ff){return BPromise[_0xfbfc('0x24')](_0x24c8ff);}return _0x35b7f1['save']();};}function saveUpdates(_0xaf39a2,_0x181edf){return function(_0x4dc800){if(_0x4dc800){return _0x4dc800['update'](_0xaf39a2)[_0xfbfc('0x25')](function(_0xcf23d4){return _0xcf23d4;});}return null;};}function removeEntity(_0x20d885,_0x1e4317){return function(_0x2c6f1a){if(_0x2c6f1a){return _0x2c6f1a[_0xfbfc('0x26')]()['then'](function(){_0x20d885['status'](0xcc)[_0xfbfc('0x1b')]();});}};}function handleEntityNotFound(_0x1e49e6,_0x574759){return function(_0x3294cd){if(!_0x3294cd){_0x1e49e6[_0xfbfc('0x27')](0x194);}return _0x3294cd;};}function handleError(_0x3eca2e,_0x5dc485){_0x5dc485=_0x5dc485||0x1f4;return function(_0x22dba4){logger['error'](_0x22dba4[_0xfbfc('0x28')]);if(_0x22dba4[_0xfbfc('0x29')]){delete _0x22dba4['name'];}_0x3eca2e[_0xfbfc('0x1a')](_0x5dc485)['send'](_0x22dba4);};}exports[_0xfbfc('0x2a')]=function(_0x3110b1,_0x3b989e){var _0x572ea1={},_0x59885d={},_0x3199b9={'count':0x0,'rows':[]};var _0x4c5432=_[_0xfbfc('0x2b')](db[_0xfbfc('0x2c')][_0xfbfc('0x2d')],function(_0x4361a7){return{'name':_0x4361a7[_0xfbfc('0x2e')],'type':_0x4361a7[_0xfbfc('0x2f')][_0xfbfc('0x30')]};});_0x59885d[_0xfbfc('0x31')]=_[_0xfbfc('0x2b')](_0x4c5432,_0xfbfc('0x29'));_0x59885d['query']=_[_0xfbfc('0x32')](_0x3110b1[_0xfbfc('0x33')]);_0x59885d[_0xfbfc('0x34')]=_['intersection'](_0x59885d['model'],_0x59885d[_0xfbfc('0x33')]);_0x572ea1[_0xfbfc('0x35')]=_['intersection'](_0x59885d['model'],qs[_0xfbfc('0x36')](_0x3110b1[_0xfbfc('0x33')][_0xfbfc('0x36')]));_0x572ea1['attributes']=_0x572ea1[_0xfbfc('0x35')]['length']?_0x572ea1['attributes']:_0x59885d[_0xfbfc('0x31')];if(!_0x3110b1['query'][_0xfbfc('0x37')]('nolimit')){_0x572ea1[_0xfbfc('0x1e')]=qs[_0xfbfc('0x1e')](_0x3110b1[_0xfbfc('0x33')][_0xfbfc('0x1e')]);_0x572ea1[_0xfbfc('0x1d')]=qs[_0xfbfc('0x1d')](_0x3110b1[_0xfbfc('0x33')][_0xfbfc('0x1d')]);}_0x572ea1[_0xfbfc('0x38')]=qs['sort'](_0x3110b1[_0xfbfc('0x33')][_0xfbfc('0x39')]);_0x572ea1[_0xfbfc('0x3a')]=qs[_0xfbfc('0x34')](_[_0xfbfc('0x3b')](_0x3110b1['query'],_0x59885d[_0xfbfc('0x34')]),_0x4c5432);if(_0x3110b1[_0xfbfc('0x33')][_0xfbfc('0x3c')]){_0x572ea1[_0xfbfc('0x3a')]=_[_0xfbfc('0x3d')](_0x572ea1[_0xfbfc('0x3a')],{'$or':_['map'](_0x4c5432,function(_0x5ca2da){if(_0x5ca2da[_0xfbfc('0x2f')]!==_0xfbfc('0x3e')){var _0x3068d5={};_0x3068d5[_0x5ca2da['name']]={'$like':'%'+_0x3110b1[_0xfbfc('0x33')][_0xfbfc('0x3c')]+'%'};return _0x3068d5;}})});}_0x572ea1=_[_0xfbfc('0x3d')]({},_0x572ea1,_0x3110b1[_0xfbfc('0x3f')]);var _0x4baa9b={'where':_0x572ea1[_0xfbfc('0x3a')]};return db[_0xfbfc('0x2c')][_0xfbfc('0x20')](_0x4baa9b)[_0xfbfc('0x25')](function(_0x2c46f2){_0x3199b9[_0xfbfc('0x20')]=_0x2c46f2;if(_0x3110b1[_0xfbfc('0x33')][_0xfbfc('0x40')]){_0x572ea1[_0xfbfc('0x41')]=[{'all':!![]}];}return db['Automation'][_0xfbfc('0x42')](_0x572ea1);})[_0xfbfc('0x25')](function(_0x4ea25d){_0x3199b9['rows']=_0x4ea25d;return _0x3199b9;})[_0xfbfc('0x25')](respondWithFilteredResult(_0x3b989e,_0x572ea1))['catch'](handleError(_0x3b989e,null));};exports[_0xfbfc('0x43')]=function(_0x13f9d6,_0x5454ce){var _0x222fd2={'raw':![],'where':{'id':_0x13f9d6[_0xfbfc('0x44')]['id']}},_0x1cdd9d={};_0x1cdd9d[_0xfbfc('0x31')]=_['keys'](db[_0xfbfc('0x2c')][_0xfbfc('0x2d')]);_0x1cdd9d[_0xfbfc('0x33')]=_[_0xfbfc('0x32')](_0x13f9d6[_0xfbfc('0x33')]);_0x1cdd9d[_0xfbfc('0x34')]=_[_0xfbfc('0x45')](_0x1cdd9d['model'],_0x1cdd9d[_0xfbfc('0x33')]);_0x222fd2[_0xfbfc('0x35')]=_[_0xfbfc('0x45')](_0x1cdd9d[_0xfbfc('0x31')],qs[_0xfbfc('0x36')](_0x13f9d6[_0xfbfc('0x33')][_0xfbfc('0x36')]));_0x222fd2[_0xfbfc('0x35')]=_0x222fd2[_0xfbfc('0x35')][_0xfbfc('0x46')]?_0x222fd2[_0xfbfc('0x35')]:_0x1cdd9d[_0xfbfc('0x31')];if(_0x13f9d6[_0xfbfc('0x33')][_0xfbfc('0x40')]){_0x222fd2[_0xfbfc('0x41')]=[{'all':!![]}];}_0x222fd2=_[_0xfbfc('0x3d')]({},_0x222fd2,_0x13f9d6[_0xfbfc('0x3f')]);return db['Automation'][_0xfbfc('0x47')](_0x222fd2)[_0xfbfc('0x25')](handleEntityNotFound(_0x5454ce,null))[_0xfbfc('0x25')](respondWithResult(_0x5454ce,null))['catch'](handleError(_0x5454ce,null));};exports[_0xfbfc('0x48')]=function(_0xed28ca,_0x65c715){return db[_0xfbfc('0x2c')][_0xfbfc('0x48')](_0xed28ca[_0xfbfc('0x49')],{})[_0xfbfc('0x25')](respondWithResult(_0x65c715,0xc9))[_0xfbfc('0x4a')](handleError(_0x65c715,null));};exports[_0xfbfc('0x4b')]=function(_0x37b262,_0x593243){if(_0x37b262[_0xfbfc('0x49')]['id']){delete _0x37b262[_0xfbfc('0x49')]['id'];}return db[_0xfbfc('0x2c')][_0xfbfc('0x47')]({'where':{'id':_0x37b262['params']['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x593243,null))[_0xfbfc('0x25')](saveUpdates(_0x37b262[_0xfbfc('0x49')],null))[_0xfbfc('0x25')](respondWithResult(_0x593243,null))[_0xfbfc('0x4a')](handleError(_0x593243,null));};exports['destroy']=function(_0x3aea49,_0x5d29d0){return db['Automation'][_0xfbfc('0x47')]({'where':{'id':_0x3aea49[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x5d29d0,null))['then'](removeEntity(_0x5d29d0,null))[_0xfbfc('0x4a')](handleError(_0x5d29d0,null));};exports[_0xfbfc('0x4c')]=function(_0xefb370,_0x372ea1,_0x4f4ea4){return db[_0xfbfc('0x4d')][_0xfbfc('0x47')]({'where':{'id':_0xefb370[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x372ea1,null))[_0xfbfc('0x25')](function(_0x41dac3){if(_0x41dac3){return _0x41dac3[_0xfbfc('0x4c')](_0xefb370[_0xfbfc('0x49')][_0xfbfc('0x4e')],_[_0xfbfc('0x4f')](_0xefb370[_0xfbfc('0x49')],[_0xfbfc('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x372ea1,null))[_0xfbfc('0x4a')](handleError(_0x372ea1,null));};exports[_0xfbfc('0x50')]=function(_0x49fe5d,_0x1a0e56,_0x4f9fc1){var _0x18e10a={};var _0x76bd3d={};var _0x41e4ca;var _0x5d46df;return db[_0xfbfc('0x2c')]['findOne']({'where':{'id':_0x49fe5d[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x1a0e56,null))[_0xfbfc('0x25')](function(_0x2df585){if(_0x2df585){_0x41e4ca=_0x2df585;_0x76bd3d[_0xfbfc('0x31')]=_[_0xfbfc('0x32')](db['Condition'][_0xfbfc('0x2d')]);_0x76bd3d['query']=_[_0xfbfc('0x32')](_0x49fe5d[_0xfbfc('0x33')]);_0x76bd3d['filters']=_[_0xfbfc('0x45')](_0x76bd3d[_0xfbfc('0x31')],_0x76bd3d[_0xfbfc('0x33')]);_0x18e10a[_0xfbfc('0x35')]=_['intersection'](_0x76bd3d['model'],qs[_0xfbfc('0x36')](_0x49fe5d[_0xfbfc('0x33')][_0xfbfc('0x36')]));_0x18e10a[_0xfbfc('0x35')]=_0x18e10a['attributes'][_0xfbfc('0x46')]?_0x18e10a['attributes']:_0x76bd3d[_0xfbfc('0x31')];_0x18e10a[_0xfbfc('0x38')]=qs[_0xfbfc('0x39')](_0x49fe5d[_0xfbfc('0x33')]['sort']);_0x18e10a[_0xfbfc('0x3a')]=qs[_0xfbfc('0x34')](_[_0xfbfc('0x3b')](_0x49fe5d['query'],_0x76bd3d[_0xfbfc('0x34')]));if(_0x49fe5d[_0xfbfc('0x33')][_0xfbfc('0x3c')]){_0x18e10a[_0xfbfc('0x3a')]=_['merge'](_0x18e10a[_0xfbfc('0x3a')],{'$or':_[_0xfbfc('0x2b')](_0x18e10a[_0xfbfc('0x35')],function(_0x3e6b7d){var _0x234663={};_0x234663[_0x3e6b7d]={'$like':'%'+_0x49fe5d[_0xfbfc('0x33')]['filter']+'%'};return _0x234663;})});}_0x18e10a=_[_0xfbfc('0x3d')]({},_0x18e10a,_0x49fe5d[_0xfbfc('0x3f')]);return _0x41e4ca[_0xfbfc('0x50')](_0x18e10a);}})[_0xfbfc('0x25')](function(_0x3d8709){if(_0x3d8709){_0x5d46df=_0x3d8709[_0xfbfc('0x46')];if(!_0x49fe5d[_0xfbfc('0x33')][_0xfbfc('0x37')](_0xfbfc('0x51'))){_0x18e10a[_0xfbfc('0x1e')]=qs[_0xfbfc('0x1e')](_0x49fe5d[_0xfbfc('0x33')][_0xfbfc('0x1e')]);_0x18e10a[_0xfbfc('0x1d')]=qs[_0xfbfc('0x1d')](_0x49fe5d[_0xfbfc('0x33')][_0xfbfc('0x1d')]);}return _0x41e4ca[_0xfbfc('0x50')](_0x18e10a);}})[_0xfbfc('0x25')](function(_0x3434c8){if(_0x3434c8){return _0x3434c8?{'count':_0x5d46df,'rows':_0x3434c8}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x1a0e56,null))[_0xfbfc('0x4a')](handleError(_0x1a0e56,null));};exports[_0xfbfc('0x52')]=function(_0x40b572,_0x37503b,_0x56e187){return db[_0xfbfc('0x53')][_0xfbfc('0x47')]({'where':{'id':_0x40b572[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x37503b,null))[_0xfbfc('0x25')](function(_0x89c573){if(_0x89c573){return _0x89c573[_0xfbfc('0x52')](_0x40b572['body']['ids'],_[_0xfbfc('0x4f')](_0x40b572[_0xfbfc('0x49')],[_0xfbfc('0x4e'),'id'])||{});}})[_0xfbfc('0x25')](respondWithResult(_0x37503b,null))[_0xfbfc('0x4a')](handleError(_0x37503b,null));};exports[_0xfbfc('0x54')]=function(_0x41ddf7,_0x3e1f0f,_0x3560ec){var _0x26233f={};var _0x40845f={};var _0x20cf8d;var _0x102cbd;return db[_0xfbfc('0x2c')][_0xfbfc('0x55')]({'where':{'id':_0x41ddf7[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x3e1f0f,null))[_0xfbfc('0x25')](function(_0x30bfa5){if(_0x30bfa5){_0x20cf8d=_0x30bfa5;_0x40845f[_0xfbfc('0x31')]=_[_0xfbfc('0x32')](db['Action']['rawAttributes']);_0x40845f['query']=_[_0xfbfc('0x32')](_0x41ddf7[_0xfbfc('0x33')]);_0x40845f[_0xfbfc('0x34')]=_[_0xfbfc('0x45')](_0x40845f[_0xfbfc('0x31')],_0x40845f[_0xfbfc('0x33')]);_0x26233f[_0xfbfc('0x35')]=_[_0xfbfc('0x45')](_0x40845f['model'],qs[_0xfbfc('0x36')](_0x41ddf7[_0xfbfc('0x33')][_0xfbfc('0x36')]));_0x26233f['attributes']=_0x26233f[_0xfbfc('0x35')][_0xfbfc('0x46')]?_0x26233f[_0xfbfc('0x35')]:_0x40845f[_0xfbfc('0x31')];_0x26233f[_0xfbfc('0x38')]=qs[_0xfbfc('0x39')](_0x41ddf7['query'][_0xfbfc('0x39')]);_0x26233f[_0xfbfc('0x3a')]=qs['filters'](_[_0xfbfc('0x3b')](_0x41ddf7['query'],_0x40845f['filters']));if(_0x41ddf7[_0xfbfc('0x33')][_0xfbfc('0x3c')]){_0x26233f['where']=_[_0xfbfc('0x3d')](_0x26233f[_0xfbfc('0x3a')],{'$or':_[_0xfbfc('0x2b')](_0x26233f[_0xfbfc('0x35')],function(_0x3aa00d){var _0x50e4b6={};_0x50e4b6[_0x3aa00d]={'$like':'%'+_0x41ddf7[_0xfbfc('0x33')]['filter']+'%'};return _0x50e4b6;})});}_0x26233f=_['merge']({},_0x26233f,_0x41ddf7[_0xfbfc('0x3f')]);return _0x20cf8d[_0xfbfc('0x54')](_0x26233f);}})[_0xfbfc('0x25')](function(_0x143abd){if(_0x143abd){_0x102cbd=_0x143abd[_0xfbfc('0x46')];if(!_0x41ddf7[_0xfbfc('0x33')][_0xfbfc('0x37')](_0xfbfc('0x51'))){_0x26233f[_0xfbfc('0x1e')]=qs[_0xfbfc('0x1e')](_0x41ddf7[_0xfbfc('0x33')][_0xfbfc('0x1e')]);_0x26233f['offset']=qs[_0xfbfc('0x1d')](_0x41ddf7[_0xfbfc('0x33')][_0xfbfc('0x1d')]);}return _0x20cf8d['getActions'](_0x26233f);}})[_0xfbfc('0x25')](function(_0x27f526){if(_0x27f526){return _0x27f526?{'count':_0x102cbd,'rows':_0x27f526}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x3e1f0f,null))['catch'](handleError(_0x3e1f0f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 50227ff..a2d6666 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 _0xd705=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_automations','lodash'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0xd705,0xf6));var _0x5d70=function(_0x5af165,_0x325cfe){_0x5af165=_0x5af165-0x0;var _0x186ce2=_0xd705[_0x5af165];return _0x186ce2;};'use strict';var _=require(_0x5d70('0x0'));var util=require(_0x5d70('0x1'));var logger=require(_0x5d70('0x2'))(_0x5d70('0x3'));var moment=require(_0x5d70('0x4'));var BPromise=require(_0x5d70('0x5'));var rp=require(_0x5d70('0x6'));var fs=require('fs');var path=require(_0x5d70('0x7'));var rimraf=require(_0x5d70('0x8'));var config=require(_0x5d70('0x9'));var attributes=require('./automation.attributes');module[_0x5d70('0xa')]=function(_0x4df8e4,_0x42611f){return _0x4df8e4[_0x5d70('0xb')]('Automation',attributes,{'tableName':_0x5d70('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98fd=['request-promise','path','rimraf','./automation.attributes','exports','define','tools_automations','lodash','util','../../config/logger','moment'];(function(_0x6ff657,_0x15eb0b){var _0x53dafd=function(_0x1c4fe6){while(--_0x1c4fe6){_0x6ff657['push'](_0x6ff657['shift']());}};_0x53dafd(++_0x15eb0b);}(_0x98fd,0xcd));var _0xd98f=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x98fd[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0xd98f('0x0'));var util=require(_0xd98f('0x1'));var logger=require(_0xd98f('0x2'))('api');var moment=require(_0xd98f('0x3'));var BPromise=require('bluebird');var rp=require(_0xd98f('0x4'));var fs=require('fs');var path=require(_0xd98f('0x5'));var rimraf=require(_0xd98f('0x6'));var config=require('../../config/environment');var attributes=require(_0xd98f('0x7'));module[_0xd98f('0x8')]=function(_0x1d294,_0x3f2c4d){return _0x1d294[_0xd98f('0x9')]('Automation',attributes,{'tableName':_0xd98f('0xa'),'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 c2917a8..a6af7a4 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 _0xe785=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring'];(function(_0x3c8801,_0x8b125f){var _0x2616da=function(_0xe6c9c3){while(--_0xe6c9c3){_0x3c8801['push'](_0x3c8801['shift']());}};_0x2616da(++_0x8b125f);}(_0xe785,0x128));var _0x5e78=function(_0x586d8f,_0x266752){_0x586d8f=_0x586d8f-0x0;var _0x5ce092=_0xe785[_0x586d8f];return _0x5ce092;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var moment=require('moment');var BPromise=require(_0x5e78('0x2'));var rs=require(_0x5e78('0x3'));var fs=require('fs');var Redis=require(_0x5e78('0x4'));var db=require(_0x5e78('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e78('0x6'));var config=require(_0x5e78('0x7'));var jayson=require(_0x5e78('0x8'));var client=jayson[_0x5e78('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x525cfa,_0x1d32e7,_0x16cc23){return new BPromise(function(_0x441435,_0x5c7d82){return client[_0x5e78('0xa')](_0x525cfa,_0x16cc23)['then'](function(_0x5de5e){logger['info'](_0x5e78('0xb'),_0x1d32e7,_0x5e78('0xc'));logger['debug'](_0x5e78('0xd'),_0x1d32e7,_0x5e78('0xc'),JSON[_0x5e78('0xe')](_0x5de5e));if(_0x5de5e[_0x5e78('0xf')]){if(_0x5de5e[_0x5e78('0xf')][_0x5e78('0x10')]===0x1f4){logger[_0x5e78('0xf')]('Automation,\x20%s,\x20%s',_0x1d32e7,_0x5de5e[_0x5e78('0xf')][_0x5e78('0x11')]);return _0x5c7d82(_0x5de5e[_0x5e78('0xf')]['message']);}logger[_0x5e78('0xf')](_0x5e78('0xb'),_0x1d32e7,_0x5de5e[_0x5e78('0xf')][_0x5e78('0x11')]);return _0x441435(_0x5de5e['error'][_0x5e78('0x11')]);}else{logger[_0x5e78('0x12')](_0x5e78('0xb'),_0x1d32e7,_0x5e78('0xc'));_0x441435(_0x5de5e[_0x5e78('0x13')][_0x5e78('0x11')]);}})['catch'](function(_0x575201){logger[_0x5e78('0xf')](_0x5e78('0xb'),_0x1d32e7,_0x575201);_0x5c7d82(_0x575201);});});} \ No newline at end of file +var _0x980c=['../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1fc84f,_0x5578fa){var _0x63b5d1=function(_0x14ceb3){while(--_0x14ceb3){_0x1fc84f['push'](_0x1fc84f['shift']());}};_0x63b5d1(++_0x5578fa);}(_0x980c,0x100));var _0xc980=function(_0x480b20,_0xe98f5f){_0x480b20=_0x480b20-0x0;var _0x29f6ef=_0x980c[_0x480b20];return _0x29f6ef;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var moment=require(_0xc980('0x2'));var BPromise=require(_0xc980('0x3'));var rs=require(_0xc980('0x4'));var fs=require('fs');var Redis=require(_0xc980('0x5'));var db=require(_0xc980('0x6'))['db'];var utils=require(_0xc980('0x7'));var logger=require(_0xc980('0x8'))(_0xc980('0x9'));var config=require(_0xc980('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc980('0xb')][_0xc980('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36d2dd,_0x3175e7,_0x389546){return new BPromise(function(_0x4523c0,_0x355bfa){return client['request'](_0x36d2dd,_0x389546)['then'](function(_0x5b99c8){logger[_0xc980('0xd')]('Automation,\x20%s,\x20%s',_0x3175e7,_0xc980('0xe'));logger[_0xc980('0xf')](_0xc980('0x10'),_0x3175e7,'request\x20sent',JSON[_0xc980('0x11')](_0x5b99c8));if(_0x5b99c8[_0xc980('0x12')]){if(_0x5b99c8[_0xc980('0x12')]['code']===0x1f4){logger[_0xc980('0x12')](_0xc980('0x13'),_0x3175e7,_0x5b99c8[_0xc980('0x12')][_0xc980('0x14')]);return _0x355bfa(_0x5b99c8[_0xc980('0x12')][_0xc980('0x14')]);}logger[_0xc980('0x12')](_0xc980('0x13'),_0x3175e7,_0x5b99c8[_0xc980('0x12')][_0xc980('0x14')]);return _0x4523c0(_0x5b99c8[_0xc980('0x12')][_0xc980('0x14')]);}else{logger[_0xc980('0xd')]('Automation,\x20%s,\x20%s',_0x3175e7,'request\x20sent');_0x4523c0(_0x5b99c8[_0xc980('0x15')]['message']);}})['catch'](function(_0x1d1de0){logger[_0xc980('0x12')](_0xc980('0x13'),_0x3175e7,_0x1d1de0);_0x355bfa(_0x1d1de0);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0dda02b..f856c8c 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 _0xd5ec=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','/:id/actions','getActions','post','put','update','delete','destroy','exports'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0xd5ec,0xb8));var _0xcd5e=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xd5ec[_0x5a7d5f];return _0x5dcded;};'use strict';var multer=require(_0xcd5e('0x0'));var util=require(_0xcd5e('0x1'));var path=require(_0xcd5e('0x2'));var timeout=require(_0xcd5e('0x3'));var express=require('express');var router=express[_0xcd5e('0x4')]();var fs_extra=require(_0xcd5e('0x5'));var auth=require(_0xcd5e('0x6'));var interaction=require(_0xcd5e('0x7'));var config=require(_0xcd5e('0x8'));var controller=require(_0xcd5e('0x9'));router[_0xcd5e('0xa')]('/',auth[_0xcd5e('0xb')](),controller[_0xcd5e('0xc')]);router[_0xcd5e('0xa')](_0xcd5e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcd5e('0xa')](_0xcd5e('0xe'),auth[_0xcd5e('0xb')](),controller['getConditions']);router[_0xcd5e('0xa')](_0xcd5e('0xf'),auth[_0xcd5e('0xb')](),controller[_0xcd5e('0x10')]);router['post']('/',auth[_0xcd5e('0xb')](),controller['create']);router[_0xcd5e('0x11')](_0xcd5e('0xe'),auth[_0xcd5e('0xb')](),controller['addConditions']);router[_0xcd5e('0x11')](_0xcd5e('0xf'),auth[_0xcd5e('0xb')](),controller['addActions']);router[_0xcd5e('0x12')](_0xcd5e('0xd'),auth[_0xcd5e('0xb')](),controller[_0xcd5e('0x13')]);router[_0xcd5e('0x14')](_0xcd5e('0xd'),auth['isAuthenticated'](),controller[_0xcd5e('0x15')]);module[_0xcd5e('0x16')]=router; \ No newline at end of file +var _0xc718=['get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','index','/:id','isAuthenticated','show'];(function(_0x49a5f6,_0x2eea42){var _0x22fe92=function(_0x4ed337){while(--_0x4ed337){_0x49a5f6['push'](_0x49a5f6['shift']());}};_0x22fe92(++_0x2eea42);}(_0xc718,0xb6));var _0x8c71=function(_0x813e01,_0x572bdb){_0x813e01=_0x813e01-0x0;var _0x544b1f=_0xc718[_0x813e01];return _0x544b1f;};'use strict';var multer=require(_0x8c71('0x0'));var util=require('util');var path=require(_0x8c71('0x1'));var timeout=require(_0x8c71('0x2'));var express=require('express');var router=express[_0x8c71('0x3')]();var fs_extra=require(_0x8c71('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c71('0x5'));var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8c71('0x6')]);router['get'](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0x9')]);router[_0x8c71('0xa')](_0x8c71('0xb'),auth['isAuthenticated'](),controller[_0x8c71('0xc')]);router[_0x8c71('0xa')](_0x8c71('0xd'),auth[_0x8c71('0x8')](),controller[_0x8c71('0xe')]);router[_0x8c71('0xf')]('/',auth[_0x8c71('0x8')](),controller[_0x8c71('0x10')]);router[_0x8c71('0xf')]('/:id/conditions',auth[_0x8c71('0x8')](),controller[_0x8c71('0x11')]);router[_0x8c71('0xf')](_0x8c71('0xd'),auth[_0x8c71('0x8')](),controller[_0x8c71('0x12')]);router[_0x8c71('0x13')](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0x14')]);router[_0x8c71('0x15')](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0x16')]);module[_0x8c71('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index be146f1..29084e6 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 _0xaaba=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','name','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','STRING','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','onlyIfOpen','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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)'];(function(_0x52851e,_0x535d7a){var _0x1c581e=function(_0x3f2bfd){while(--_0x3f2bfd){_0x52851e['push'](_0x52851e['shift']());}};_0x1c581e(++_0x535d7a);}(_0xaaba,0x10f));var _0xaaab=function(_0x3fbb40,_0x408c22){_0x3fbb40=_0x3fbb40-0x0;var _0x3a9c8=_0xaaba[_0x3fbb40];return _0x3a9c8;};'use strict';var Sequelize=require(_0xaaab('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xaaab('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xaaab('0x2')),'allowNull':![],'defaultValue':_0xaaab('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xaaab('0x3')},'limitCalls':{'type':Sequelize[_0xaaab('0x4')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xaaab('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0xaaab('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaaab('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0xaaab('0x4')](0x3)[_0xaaab('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaaab('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xaaab('0x4')](0x3)[_0xaaab('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaaab('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaaab('0x4')](0x5)[_0xaaab('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaaab('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xaaab('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaaab('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xaaab('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaaab('0x4')](0x3)[_0xaaab('0x7')],'defaultValue':0x3,'comment':_0xaaab('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaaab('0x4')](0x5)[_0xaaab('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaaab('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaaab('0xd')},'dialTimezone':{'type':Sequelize[_0xaaab('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xaaab('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xaaab('0xf')]('always','never',_0xaaab('0x10')),'defaultValue':_0xaaab('0x11')},'dialAMDActive':{'type':Sequelize[_0xaaab('0x12')],'defaultValue':0x0,'comment':_0xaaab('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xaaab('0x4')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaaab('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xaaab('0x4')](0x9)[_0xaaab('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaaab('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaaab('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xaaab('0x4')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaaab('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xaaab('0x4')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaaab('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xaaab('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xaaab('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaaab('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaaab('0x4')](0x5)[_0xaaab('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaaab('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaaab('0x4')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xaaab('0xf')](_0xaaab('0x1a'),_0xaaab('0x1b')),'defaultValue':_0xaaab('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xaaab('0x4')](0x3)[_0xaaab('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaaab('0x1c')},'dialCutDigit':{'type':Sequelize[_0xaaab('0x4')](0x3)[_0xaaab('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaaab('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xaaab('0x4')](0x3)[_0xaaab('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaaab('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaaab('0x4')](0x5)[_0xaaab('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaaab('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xaaab('0x4')](0x3)[_0xaaab('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaaab('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xaaab('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaaab('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xaaab('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaaab('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xaaab('0x4')](0x5)[_0xaaab('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xaaab('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaaab('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xaaab('0x4')](0x5)[_0xaaab('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaaab('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaaab('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaaab('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xaaab('0x4')](0x5)[_0xaaab('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x3d2a=['#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','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x549e1f,_0x2d993e){var _0xa696de=function(_0x449edc){while(--_0x449edc){_0x549e1f['push'](_0x549e1f['shift']());}};_0xa696de(++_0x2d993e);}(_0x3d2a,0xdf));var _0xa3d2=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0x3d2a[_0x478e2f];return _0x4b088d;};'use strict';var Sequelize=require('sequelize');module[_0xa3d2('0x0')]={'name':{'type':Sequelize[_0xa3d2('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa3d2('0x2')](_0xa3d2('0x3')),'allowNull':![],'defaultValue':_0xa3d2('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa3d2('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xa3d2('0x5')](0x4)[_0xa3d2('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa3d2('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa3d2('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa3d2('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xa3d2('0x5')](0x3)[_0xa3d2('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3d2('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa3d2('0x5')](0x3)[_0xa3d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3d2('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa3d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3d2('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3d2('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa3d2('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3d2('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa3d2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3d2('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa3d2('0x5')](0x3)[_0xa3d2('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa3d2('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa3d2('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xa3d2('0x2')](_0xa3d2('0xf'),_0xa3d2('0x10'),_0xa3d2('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa3d2('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xa3d2('0x5')](0x9)[_0xa3d2('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa3d2('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa3d2('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa3d2('0x5')](0x9)[_0xa3d2('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa3d2('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa3d2('0x5')](0x9)[_0xa3d2('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa3d2('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xa3d2('0x5')](0x9)[_0xa3d2('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa3d2('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa3d2('0x5')](0x9)[_0xa3d2('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa3d2('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa3d2('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa3d2('0x5')](0x5)[_0xa3d2('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa3d2('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa3d2('0x5')](0x9)[_0xa3d2('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xa3d2('0x1b'),_0xa3d2('0x1c')),'defaultValue':_0xa3d2('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa3d2('0x5')](0x3)[_0xa3d2('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xa3d2('0x5')](0x3)[_0xa3d2('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa3d2('0x5')](0x3)[_0xa3d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3d2('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa3d2('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3d2('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa3d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3d2('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xa3d2('0x5')](0x5)[_0xa3d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa3d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa3d2('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3d2('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3d2('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa3d2('0x5')](0x3)[_0xa3d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa3d2('0x5')](0x5)[_0xa3d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3d2('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4e46340..649206f 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 _0x4502=['ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','CmList','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','stack','name','index','map','Campaign','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','fromQuery','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','insert','cm_hopper_additional_phones','cmHopperId','OrderBy'];(function(_0x1e78f1,_0x4d5852){var _0x34d063=function(_0x4c8e1d){while(--_0x4c8e1d){_0x1e78f1['push'](_0x1e78f1['shift']());}};_0x34d063(++_0x4d5852);}(_0x4502,0xa0));var _0x2450=function(_0x7e2c2a,_0x47bcae){_0x7e2c2a=_0x7e2c2a-0x0;var _0x151271=_0x4502[_0x7e2c2a];return _0x151271;};'use strict';var emlformat=require(_0x2450('0x0'));var rimraf=require(_0x2450('0x1'));var zipdir=require(_0x2450('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2450('0x3'));var Mustache=require(_0x2450('0x4'));var util=require('util');var path=require(_0x2450('0x5'));var sox=require(_0x2450('0x6'));var csv=require(_0x2450('0x7'));var ejs=require(_0x2450('0x8'));var fs=require('fs');var fs_extra=require(_0x2450('0x9'));var _=require('lodash');var squel=require(_0x2450('0xa'));var crypto=require('crypto');var jsforce=require(_0x2450('0xb'));var deskjs=require(_0x2450('0xc'));var toCsv=require(_0x2450('0x7'));var querystring=require(_0x2450('0xd'));var Papa=require(_0x2450('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2450('0xf'));var as=require(_0x2450('0x10'));var hardwareService=require(_0x2450('0x11'));var logger=require(_0x2450('0x12'))('api');var utils=require(_0x2450('0x13'));var config=require(_0x2450('0x14'));var licenseUtil=require(_0x2450('0x15'));var db=require(_0x2450('0x16'))['db'];function respondWithStatusCode(_0x46b49f,_0x252bee){_0x252bee=_0x252bee||0xcc;return function(_0x22bda4){if(_0x22bda4){return _0x46b49f['sendStatus'](_0x252bee);}return _0x46b49f[_0x2450('0x17')](_0x252bee)[_0x2450('0x18')]();};}function respondWithResult(_0x3bc485,_0x2b7f29){_0x2b7f29=_0x2b7f29||0xc8;return function(_0x1b1fd7){if(_0x1b1fd7){return _0x3bc485[_0x2450('0x17')](_0x2b7f29)[_0x2450('0x19')](_0x1b1fd7);}};}function respondWithFilteredResult(_0x585f22,_0x12eddd){return function(_0xc50004){if(_0xc50004){var _0x110b9a=typeof _0x12eddd[_0x2450('0x1a')]===_0x2450('0x1b')&&typeof _0x12eddd[_0x2450('0x1c')]==='undefined';var _0x2bfcfb=_0xc50004[_0x2450('0x1d')];var _0x1ae639=_0x110b9a?0x0:_0x12eddd[_0x2450('0x1a')];var _0x11b331=_0x110b9a?_0xc50004[_0x2450('0x1d')]:_0x12eddd[_0x2450('0x1a')]+_0x12eddd['limit'];var _0x59abce;if(_0x11b331>=_0x2bfcfb){_0x11b331=_0x2bfcfb;_0x59abce=0xc8;}else{_0x59abce=0xce;}_0x585f22[_0x2450('0x17')](_0x59abce);return _0x585f22[_0x2450('0x1e')]('Content-Range',_0x1ae639+'-'+_0x11b331+'/'+_0x2bfcfb)[_0x2450('0x19')](_0xc50004);}return null;};}function patchUpdates(_0x3d8968){return function(_0xf75aff){try{jsonpatch[_0x2450('0x1f')](_0xf75aff,_0x3d8968,!![]);}catch(_0x2d2ac3){return BPromise[_0x2450('0x20')](_0x2d2ac3);}return _0xf75aff[_0x2450('0x21')]();};}function saveUpdates(_0x468e19,_0x1fb375){return function(_0x2556a2){if(_0x2556a2){return _0x2556a2[_0x2450('0x22')](_0x468e19)[_0x2450('0x23')](function(_0x3276a3){return _0x3276a3;});}return null;};}function removeEntity(_0x2731dd,_0x41e185){return function(_0xd566c0){if(_0xd566c0){return _0xd566c0[_0x2450('0x24')]()['then'](function(){var _0x12fc2d=_0xd566c0[_0x2450('0x25')]({'plain':!![]});var _0x22c841=_0x2450('0x26');return db[_0x2450('0x27')]['destroy']({'where':{'type':_0x22c841,'resourceId':_0x12fc2d['id']}})[_0x2450('0x23')](function(){return _0xd566c0;});})[_0x2450('0x23')](function(){_0x2731dd[_0x2450('0x17')](0xcc)[_0x2450('0x18')]();});}};}function handleEntityNotFound(_0x566d87,_0x36ab03){return function(_0x35a844){if(!_0x35a844){_0x566d87[_0x2450('0x28')](0x194);}return _0x35a844;};}function handleError(_0x2aaaf1,_0xd9be6b){_0xd9be6b=_0xd9be6b||0x1f4;return function(_0x2ec839){logger['error'](_0x2ec839[_0x2450('0x29')]);if(_0x2ec839[_0x2450('0x2a')]){delete _0x2ec839[_0x2450('0x2a')];}_0x2aaaf1[_0x2450('0x17')](_0xd9be6b)['send'](_0x2ec839);};}exports[_0x2450('0x2b')]=function(_0x11c663,_0x1e7caf){var _0x567cb0={},_0xc6ba2={},_0x39c0d6={'count':0x0,'rows':[]};var _0x5bb42c=_[_0x2450('0x2c')](db[_0x2450('0x2d')]['rawAttributes'],function(_0x3251ff){return{'name':_0x3251ff[_0x2450('0x2e')],'type':_0x3251ff[_0x2450('0x2f')][_0x2450('0x30')]};});_0xc6ba2[_0x2450('0x31')]=_[_0x2450('0x2c')](_0x5bb42c,_0x2450('0x2a'));_0xc6ba2[_0x2450('0x32')]=_['keys'](_0x11c663[_0x2450('0x32')]);_0xc6ba2['filters']=_[_0x2450('0x33')](_0xc6ba2[_0x2450('0x31')],_0xc6ba2[_0x2450('0x32')]);_0x567cb0[_0x2450('0x34')]=_[_0x2450('0x33')](_0xc6ba2['model'],qs[_0x2450('0x35')](_0x11c663[_0x2450('0x32')][_0x2450('0x35')]));_0x567cb0['attributes']=_0x567cb0[_0x2450('0x34')][_0x2450('0x36')]?_0x567cb0[_0x2450('0x34')]:_0xc6ba2[_0x2450('0x31')];if(!_0x11c663[_0x2450('0x32')]['hasOwnProperty'](_0x2450('0x37'))){_0x567cb0[_0x2450('0x1c')]=qs[_0x2450('0x1c')](_0x11c663[_0x2450('0x32')]['limit']);_0x567cb0['offset']=qs[_0x2450('0x1a')](_0x11c663[_0x2450('0x32')][_0x2450('0x1a')]);}_0x567cb0[_0x2450('0x38')]=qs['sort'](_0x11c663[_0x2450('0x32')][_0x2450('0x39')]);_0x567cb0['where']=qs[_0x2450('0x3a')](_[_0x2450('0x3b')](_0x11c663[_0x2450('0x32')],_0xc6ba2['filters']),_0x5bb42c);if(_0x11c663[_0x2450('0x32')]['filter']){_0x567cb0[_0x2450('0x3c')]=_[_0x2450('0x3d')](_0x567cb0['where'],{'$or':_[_0x2450('0x2c')](_0x5bb42c,function(_0x1644b4){if(_0x1644b4[_0x2450('0x2f')]!==_0x2450('0x3e')){var _0xfbf18c={};_0xfbf18c[_0x1644b4[_0x2450('0x2a')]]={'$like':'%'+_0x11c663[_0x2450('0x32')][_0x2450('0x3f')]+'%'};return _0xfbf18c;}})});}_0x567cb0=_[_0x2450('0x3d')]({},_0x567cb0,_0x11c663[_0x2450('0x40')]);var _0x402d32={'where':_0x567cb0[_0x2450('0x3c')]};return db[_0x2450('0x2d')][_0x2450('0x1d')](_0x402d32)[_0x2450('0x23')](function(_0x2667b0){_0x39c0d6[_0x2450('0x1d')]=_0x2667b0;if(_0x11c663['query'][_0x2450('0x41')]){_0x567cb0[_0x2450('0x42')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x567cb0);})[_0x2450('0x23')](function(_0x41606f){_0x39c0d6[_0x2450('0x43')]=_0x41606f;return _0x39c0d6;})[_0x2450('0x23')](respondWithFilteredResult(_0x1e7caf,_0x567cb0))[_0x2450('0x44')](handleError(_0x1e7caf,null));};exports['show']=function(_0x8e9cb9,_0x11ca3e){var _0x435408={'raw':![],'where':{'id':_0x8e9cb9[_0x2450('0x45')]['id']}},_0x28722d={};_0x28722d[_0x2450('0x31')]=_[_0x2450('0x46')](db[_0x2450('0x2d')][_0x2450('0x47')]);_0x28722d[_0x2450('0x32')]=_[_0x2450('0x46')](_0x8e9cb9[_0x2450('0x32')]);_0x28722d[_0x2450('0x3a')]=_['intersection'](_0x28722d['model'],_0x28722d[_0x2450('0x32')]);_0x435408[_0x2450('0x34')]=_[_0x2450('0x33')](_0x28722d[_0x2450('0x31')],qs['fields'](_0x8e9cb9[_0x2450('0x32')][_0x2450('0x35')]));_0x435408[_0x2450('0x34')]=_0x435408['attributes'][_0x2450('0x36')]?_0x435408['attributes']:_0x28722d[_0x2450('0x31')];if(_0x8e9cb9['query']['includeAll']){_0x435408['include']=[{'all':!![]}];}_0x435408=_[_0x2450('0x3d')]({},_0x435408,_0x8e9cb9[_0x2450('0x40')]);return db[_0x2450('0x2d')][_0x2450('0x48')](_0x435408)[_0x2450('0x23')](handleEntityNotFound(_0x11ca3e,null))[_0x2450('0x23')](respondWithResult(_0x11ca3e,null))[_0x2450('0x44')](handleError(_0x11ca3e,null));};exports[_0x2450('0x49')]=function(_0x57217a,_0x4e605e){return db['Campaign'][_0x2450('0x49')](_0x57217a[_0x2450('0x4a')],{})[_0x2450('0x23')](function(_0x49a05d){var _0x5a6c44=_0x57217a[_0x2450('0x4b')][_0x2450('0x25')]({'plain':!![]});if(!_0x5a6c44)throw new Error(_0x2450('0x4c'));if(_0x5a6c44[_0x2450('0x4d')]==='user'){var _0x361024=_0x49a05d[_0x2450('0x25')]({'plain':!![]});var _0x2be718='IvrCampaigns';return db[_0x2450('0x4e')][_0x2450('0x48')]({'where':{'name':_0x2be718,'userProfileId':_0x5a6c44[_0x2450('0x4f')]},'raw':!![]})[_0x2450('0x23')](function(_0x2b489c){if(_0x2b489c&&_0x2b489c[_0x2450('0x50')]===0x0){return db[_0x2450('0x27')][_0x2450('0x49')]({'name':_0x361024[_0x2450('0x2a')],'resourceId':_0x361024['id'],'type':_0x2b489c[_0x2450('0x2a')],'sectionId':_0x2b489c['id']},{})['then'](function(){return _0x49a05d;});}else{return _0x49a05d;}})[_0x2450('0x44')](function(_0x4df731){logger[_0x2450('0x51')](_0x2450('0x52'),_0x4df731);throw _0x4df731;});}return _0x49a05d;})[_0x2450('0x23')](respondWithResult(_0x4e605e,0xc9))['catch'](handleError(_0x4e605e,null));};exports[_0x2450('0x53')]=function(_0x19a64c,_0x156710){var _0x3e6d06={'where':{'id':_0x19a64c[_0x2450('0x45')]['id']}},_0x5b2108={};_0x5b2108[_0x2450('0x31')]=_[_0x2450('0x46')](db[_0x2450('0x2d')][_0x2450('0x47')]);_0x3e6d06[_0x2450('0x34')]=_[_0x2450('0x33')](_0x5b2108[_0x2450('0x31')],qs['fields'](_0x19a64c[_0x2450('0x32')][_0x2450('0x35')]));_0x3e6d06[_0x2450('0x34')]=_0x3e6d06[_0x2450('0x34')][_0x2450('0x36')]?_0x3e6d06[_0x2450('0x34')]:_0x5b2108[_0x2450('0x31')];if(_0x19a64c[_0x2450('0x32')][_0x2450('0x41')]){_0x3e6d06[_0x2450('0x42')]=[{'all':!![]}];}_0x3e6d06=_[_0x2450('0x3d')]({},_0x3e6d06,_0x19a64c[_0x2450('0x40')]);return db[_0x2450('0x2d')][_0x2450('0x48')](_0x3e6d06)[_0x2450('0x23')](handleEntityNotFound(_0x156710,null))[_0x2450('0x23')](function(_0x8f2eaa){if(_0x8f2eaa){var _0x37bc7e=_0x8f2eaa[_0x2450('0x25')]({'plain':!![]});_0x37bc7e=qs[_0x2450('0x54')](_0x37bc7e,['id',_0x2450('0x55'),_0x2450('0x56')]);_0x19a64c[_0x2450('0x4a')]=_[_0x2450('0x54')](_0x19a64c[_0x2450('0x4a')],['id',_0x2450('0x55'),'updatedAt']);return db[_0x2450('0x2d')][_0x2450('0x49')](_[_0x2450('0x3d')](_0x37bc7e,_0x19a64c[_0x2450('0x4a')]),{'include':_0x19a64c[_0x2450('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x2450('0x23')](function(_0x3ac5ed){var _0x3eba47=_0x19a64c[_0x2450('0x4b')]['get']({'plain':!![]});if(!_0x3eba47)throw new Error(_0x2450('0x4c'));if(_0x3eba47[_0x2450('0x4d')]==='user'){var _0x5a96d4=_0x3ac5ed[_0x2450('0x25')]({'plain':!![]});var _0x1123e4=_0x2450('0x26');return db[_0x2450('0x4e')]['find']({'where':{'name':_0x1123e4,'userProfileId':_0x3eba47['userProfileId']},'raw':!![]})[_0x2450('0x23')](function(_0x514b17){if(_0x514b17&&_0x514b17[_0x2450('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a96d4[_0x2450('0x2a')],'resourceId':_0x5a96d4['id'],'type':_0x514b17['name'],'sectionId':_0x514b17['id']},{})['then'](function(){return _0x3ac5ed;});}else{return _0x3ac5ed;}})['catch'](function(_0x1c228f){logger[_0x2450('0x51')](_0x2450('0x52'),_0x1c228f);throw _0x1c228f;});}return _0x3ac5ed;});}})['then'](respondWithResult(_0x156710,0xc9))[_0x2450('0x44')](handleError(_0x156710,null));};exports['update']=function(_0x28187a,_0x418cc5){if(_0x28187a[_0x2450('0x4a')]['id']){delete _0x28187a[_0x2450('0x4a')]['id'];}return db[_0x2450('0x2d')][_0x2450('0x48')]({'where':{'id':_0x28187a['params']['id']}})[_0x2450('0x23')](handleEntityNotFound(_0x418cc5,null))[_0x2450('0x23')](saveUpdates(_0x28187a['body'],null))[_0x2450('0x23')](respondWithResult(_0x418cc5,null))[_0x2450('0x44')](handleError(_0x418cc5,null));};exports['destroy']=function(_0x208972,_0x4b0672){return db[_0x2450('0x2d')][_0x2450('0x48')]({'where':{'id':_0x208972['params']['id']}})[_0x2450('0x23')](handleEntityNotFound(_0x4b0672,null))[_0x2450('0x23')](removeEntity(_0x4b0672,null))['catch'](handleError(_0x4b0672,null));};exports[_0x2450('0x57')]=function(_0x199129,_0x3b367b,_0x493c39){var _0x42e1cc={'raw':!![],'where':{}};var _0x19a1b7={};var _0x27d4da={'count':0x0,'rows':[]};return db['Campaign'][_0x2450('0x58')]({'where':{'id':_0x199129['params']['id']}})['then'](handleEntityNotFound(_0x3b367b,null))[_0x2450('0x23')](function(_0x49544a){if(_0x49544a){_0x19a1b7[_0x2450('0x31')]=_[_0x2450('0x46')](db[_0x2450('0x59')][_0x2450('0x47')]);_0x19a1b7[_0x2450('0x32')]=_[_0x2450('0x46')](_0x199129[_0x2450('0x32')]);_0x19a1b7['filters']=_[_0x2450('0x33')](_0x19a1b7[_0x2450('0x31')],_0x19a1b7[_0x2450('0x32')]);_0x42e1cc[_0x2450('0x34')]=_['intersection'](_0x19a1b7[_0x2450('0x31')],qs[_0x2450('0x35')](_0x199129[_0x2450('0x32')][_0x2450('0x35')]));_0x42e1cc[_0x2450('0x34')]=_0x42e1cc[_0x2450('0x34')]['length']?_0x42e1cc[_0x2450('0x34')]:_0x19a1b7[_0x2450('0x31')];if(!_0x199129[_0x2450('0x32')]['hasOwnProperty']('nolimit')){_0x42e1cc[_0x2450('0x1c')]=qs['limit'](_0x199129[_0x2450('0x32')][_0x2450('0x1c')]);_0x42e1cc[_0x2450('0x1a')]=qs[_0x2450('0x1a')](_0x199129[_0x2450('0x32')]['offset']);}_0x42e1cc[_0x2450('0x38')]=qs[_0x2450('0x39')](_0x199129[_0x2450('0x32')][_0x2450('0x39')]);_0x42e1cc['where']=qs[_0x2450('0x3a')](_[_0x2450('0x3b')](_0x199129['query'],_0x19a1b7['filters']));_0x42e1cc[_0x2450('0x3c')][_0x2450('0x5a')]=_0x49544a['id'];if(_0x199129[_0x2450('0x32')][_0x2450('0x3f')]){_0x42e1cc['where']=_[_0x2450('0x3d')](_0x42e1cc[_0x2450('0x3c')],{'$or':_[_0x2450('0x2c')](_0x42e1cc[_0x2450('0x34')],function(_0x30836d){var _0x31a79d={};_0x31a79d[_0x30836d]={'$like':'%'+_0x199129[_0x2450('0x32')][_0x2450('0x3f')]+'%'};return _0x31a79d;})});}_0x42e1cc=_[_0x2450('0x3d')]({},_0x42e1cc,_0x199129[_0x2450('0x40')]);return db['CmHopper']['count']({'where':_0x42e1cc[_0x2450('0x3c')]})[_0x2450('0x23')](function(_0x57d348){_0x27d4da['count']=_0x57d348;if(_0x199129[_0x2450('0x32')][_0x2450('0x41')]){_0x42e1cc['include']=[{'all':!![]}];}return db[_0x2450('0x59')]['findAll'](_0x42e1cc);})[_0x2450('0x23')](function(_0x4e6a85){_0x27d4da[_0x2450('0x43')]=_0x4e6a85;return _0x27d4da;});}})['then'](respondWithFilteredResult(_0x3b367b,_0x42e1cc))[_0x2450('0x44')](handleError(_0x3b367b,null));};exports[_0x2450('0x5b')]=function(_0x43154e,_0x46cb43,_0x56de45){var _0x34424d={'raw':!![],'where':{}};var _0xab9563={};var _0x663e7c={'count':0x0,'rows':[]};return db[_0x2450('0x2d')][_0x2450('0x58')]({'where':{'id':_0x43154e[_0x2450('0x45')]['id']}})['then'](handleEntityNotFound(_0x46cb43,null))['then'](function(_0x2c2c84){if(_0x2c2c84){_0xab9563[_0x2450('0x31')]=_[_0x2450('0x46')](db[_0x2450('0x5c')][_0x2450('0x47')]);_0xab9563[_0x2450('0x32')]=_[_0x2450('0x46')](_0x43154e[_0x2450('0x32')]);_0xab9563[_0x2450('0x3a')]=_[_0x2450('0x33')](_0xab9563[_0x2450('0x31')],_0xab9563[_0x2450('0x32')]);_0x34424d[_0x2450('0x34')]=_['intersection'](_0xab9563[_0x2450('0x31')],qs['fields'](_0x43154e[_0x2450('0x32')][_0x2450('0x35')]));_0x34424d[_0x2450('0x34')]=_0x34424d[_0x2450('0x34')][_0x2450('0x36')]?_0x34424d[_0x2450('0x34')]:_0xab9563['model'];if(!_0x43154e['query'][_0x2450('0x5d')](_0x2450('0x37'))){_0x34424d[_0x2450('0x1c')]=qs[_0x2450('0x1c')](_0x43154e[_0x2450('0x32')]['limit']);_0x34424d[_0x2450('0x1a')]=qs[_0x2450('0x1a')](_0x43154e[_0x2450('0x32')][_0x2450('0x1a')]);}_0x34424d[_0x2450('0x38')]=qs['sort'](_0x43154e[_0x2450('0x32')][_0x2450('0x39')]);_0x34424d['where']=qs['filters'](_[_0x2450('0x3b')](_0x43154e['query'],_0xab9563['filters']));_0x34424d[_0x2450('0x3c')][_0x2450('0x5a')]=_0x2c2c84['id'];if(_0x43154e[_0x2450('0x32')][_0x2450('0x3f')]){_0x34424d['where']=_['merge'](_0x34424d[_0x2450('0x3c')],{'$or':_[_0x2450('0x2c')](_0x34424d[_0x2450('0x34')],function(_0x198545){var _0xcb2ccc={};_0xcb2ccc[_0x198545]={'$like':'%'+_0x43154e[_0x2450('0x32')][_0x2450('0x3f')]+'%'};return _0xcb2ccc;})});}_0x34424d=_[_0x2450('0x3d')]({},_0x34424d,_0x43154e['options']);return db[_0x2450('0x5c')][_0x2450('0x1d')]({'where':_0x34424d[_0x2450('0x3c')]})[_0x2450('0x23')](function(_0x33a1f1){_0x663e7c[_0x2450('0x1d')]=_0x33a1f1;if(_0x43154e[_0x2450('0x32')][_0x2450('0x41')]){_0x34424d[_0x2450('0x42')]=[{'all':!![]}];}return db[_0x2450('0x5c')]['findAll'](_0x34424d);})[_0x2450('0x23')](function(_0x5a6a9d){_0x663e7c['rows']=_0x5a6a9d;return _0x663e7c;});}})[_0x2450('0x23')](respondWithFilteredResult(_0x46cb43,_0x34424d))[_0x2450('0x44')](handleError(_0x46cb43,null));};exports[_0x2450('0x5e')]=function(_0x1063ca,_0x48ed91,_0x4adccb){var _0x253ff3={'raw':!![],'where':{}};var _0x770d65={};var _0x352065={'count':0x0,'rows':[]};return db[_0x2450('0x2d')][_0x2450('0x58')]({'where':{'id':_0x1063ca[_0x2450('0x45')]['id']}})[_0x2450('0x23')](handleEntityNotFound(_0x48ed91,null))[_0x2450('0x23')](function(_0x5d52a2){if(_0x5d52a2){_0x770d65[_0x2450('0x31')]=_['keys'](db[_0x2450('0x5f')]['rawAttributes']);_0x770d65[_0x2450('0x32')]=_[_0x2450('0x46')](_0x1063ca[_0x2450('0x32')]);_0x770d65[_0x2450('0x3a')]=_[_0x2450('0x33')](_0x770d65[_0x2450('0x31')],_0x770d65[_0x2450('0x32')]);_0x253ff3[_0x2450('0x34')]=_[_0x2450('0x33')](_0x770d65[_0x2450('0x31')],qs[_0x2450('0x35')](_0x1063ca[_0x2450('0x32')][_0x2450('0x35')]));_0x253ff3[_0x2450('0x34')]=_0x253ff3[_0x2450('0x34')][_0x2450('0x36')]?_0x253ff3[_0x2450('0x34')]:_0x770d65[_0x2450('0x31')];if(!_0x1063ca['query'][_0x2450('0x5d')](_0x2450('0x37'))){_0x253ff3[_0x2450('0x1c')]=qs[_0x2450('0x1c')](_0x1063ca[_0x2450('0x32')]['limit']);_0x253ff3[_0x2450('0x1a')]=qs[_0x2450('0x1a')](_0x1063ca[_0x2450('0x32')][_0x2450('0x1a')]);}_0x253ff3[_0x2450('0x38')]=qs[_0x2450('0x39')](_0x1063ca[_0x2450('0x32')][_0x2450('0x39')]);_0x253ff3[_0x2450('0x3c')]=qs[_0x2450('0x3a')](_['pick'](_0x1063ca[_0x2450('0x32')],_0x770d65[_0x2450('0x3a')]));_0x253ff3[_0x2450('0x3c')]['CampaignId']=_0x5d52a2['id'];if(_0x1063ca[_0x2450('0x32')]['filter']){_0x253ff3[_0x2450('0x3c')]=_['merge'](_0x253ff3[_0x2450('0x3c')],{'$or':_[_0x2450('0x2c')](_0x253ff3[_0x2450('0x34')],function(_0x53ed2f){var _0x45d3ce={};_0x45d3ce[_0x53ed2f]={'$like':'%'+_0x1063ca[_0x2450('0x32')][_0x2450('0x3f')]+'%'};return _0x45d3ce;})});}_0x253ff3=_[_0x2450('0x3d')]({},_0x253ff3,_0x1063ca[_0x2450('0x40')]);return db['CmHopperFinal'][_0x2450('0x1d')]({'where':_0x253ff3[_0x2450('0x3c')]})[_0x2450('0x23')](function(_0x1e4d99){_0x352065[_0x2450('0x1d')]=_0x1e4d99;if(_0x1063ca['query'][_0x2450('0x41')]){_0x253ff3[_0x2450('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x253ff3);})[_0x2450('0x23')](function(_0x22cbb6){_0x352065[_0x2450('0x43')]=_0x22cbb6;return _0x352065;});}})[_0x2450('0x23')](respondWithFilteredResult(_0x48ed91,_0x253ff3))[_0x2450('0x44')](handleError(_0x48ed91,null));};exports[_0x2450('0x60')]=function(_0x11b19c,_0x54e7d2,_0x1431d9){var _0x3ec35a={'raw':!![],'where':{}};var _0x177eba={};var _0x39ccc5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x11b19c[_0x2450('0x45')]['id']}})[_0x2450('0x23')](handleEntityNotFound(_0x54e7d2,null))[_0x2450('0x23')](function(_0x423a0d){if(_0x423a0d){_0x177eba[_0x2450('0x31')]=_['keys'](db[_0x2450('0x61')][_0x2450('0x47')]);_0x177eba['query']=_[_0x2450('0x46')](_0x11b19c[_0x2450('0x32')]);_0x177eba[_0x2450('0x3a')]=_['intersection'](_0x177eba[_0x2450('0x31')],_0x177eba[_0x2450('0x32')]);_0x3ec35a[_0x2450('0x34')]=_[_0x2450('0x33')](_0x177eba[_0x2450('0x31')],qs[_0x2450('0x35')](_0x11b19c['query']['fields']));_0x3ec35a[_0x2450('0x34')]=_0x3ec35a[_0x2450('0x34')][_0x2450('0x36')]?_0x3ec35a[_0x2450('0x34')]:_0x177eba[_0x2450('0x31')];if(!_0x11b19c[_0x2450('0x32')][_0x2450('0x5d')]('nolimit')){_0x3ec35a[_0x2450('0x1c')]=qs[_0x2450('0x1c')](_0x11b19c[_0x2450('0x32')][_0x2450('0x1c')]);_0x3ec35a[_0x2450('0x1a')]=qs[_0x2450('0x1a')](_0x11b19c[_0x2450('0x32')][_0x2450('0x1a')]);}_0x3ec35a[_0x2450('0x38')]=qs[_0x2450('0x39')](_0x11b19c[_0x2450('0x32')][_0x2450('0x39')]);_0x3ec35a[_0x2450('0x3c')]=qs[_0x2450('0x3a')](_[_0x2450('0x3b')](_0x11b19c[_0x2450('0x32')],_0x177eba[_0x2450('0x3a')]));_0x3ec35a[_0x2450('0x3c')]['CampaignId']=_0x423a0d['id'];if(_0x11b19c[_0x2450('0x32')][_0x2450('0x3f')]){_0x3ec35a[_0x2450('0x3c')]=_[_0x2450('0x3d')](_0x3ec35a[_0x2450('0x3c')],{'$or':_[_0x2450('0x2c')](_0x3ec35a[_0x2450('0x34')],function(_0x36e159){var _0x1f7102={};_0x1f7102[_0x36e159]={'$like':'%'+_0x11b19c[_0x2450('0x32')][_0x2450('0x3f')]+'%'};return _0x1f7102;})});}_0x3ec35a=_[_0x2450('0x3d')]({},_0x3ec35a,_0x11b19c['options']);return db[_0x2450('0x61')][_0x2450('0x1d')]({'where':_0x3ec35a[_0x2450('0x3c')]})[_0x2450('0x23')](function(_0x54f8a3){_0x39ccc5['count']=_0x54f8a3;if(_0x11b19c[_0x2450('0x32')][_0x2450('0x41')]){_0x3ec35a[_0x2450('0x42')]=[{'all':!![]}];}return db[_0x2450('0x61')]['findAll'](_0x3ec35a);})[_0x2450('0x23')](function(_0x15287e){_0x39ccc5[_0x2450('0x43')]=_0x15287e;return _0x39ccc5;});}})[_0x2450('0x23')](respondWithFilteredResult(_0x54e7d2,_0x3ec35a))['catch'](handleError(_0x54e7d2,null));};exports['getLists']=function(_0x369e3e,_0x1c230b,_0x2e4991){var _0x268d26={};var _0x8c56fe={};var _0x190356;var _0x1d58fb;return db['Campaign'][_0x2450('0x58')]({'where':{'id':_0x369e3e[_0x2450('0x45')]['id']}})[_0x2450('0x23')](handleEntityNotFound(_0x1c230b,null))[_0x2450('0x23')](function(_0x3eeee6){if(_0x3eeee6){_0x190356=_0x3eeee6;_0x8c56fe[_0x2450('0x31')]=_[_0x2450('0x46')](db['CmList'][_0x2450('0x47')]);_0x8c56fe[_0x2450('0x32')]=_[_0x2450('0x46')](_0x369e3e[_0x2450('0x32')]);_0x8c56fe[_0x2450('0x3a')]=_[_0x2450('0x33')](_0x8c56fe['model'],_0x8c56fe[_0x2450('0x32')]);_0x268d26[_0x2450('0x34')]=_[_0x2450('0x33')](_0x8c56fe[_0x2450('0x31')],qs[_0x2450('0x35')](_0x369e3e['query']['fields']));_0x268d26['attributes']=_0x268d26[_0x2450('0x34')][_0x2450('0x36')]?_0x268d26['attributes']:_0x8c56fe[_0x2450('0x31')];_0x268d26['order']=qs[_0x2450('0x39')](_0x369e3e['query'][_0x2450('0x39')]);_0x268d26['where']=qs[_0x2450('0x3a')](_[_0x2450('0x3b')](_0x369e3e[_0x2450('0x32')],_0x8c56fe[_0x2450('0x3a')]));if(_0x369e3e[_0x2450('0x32')][_0x2450('0x3f')]){_0x268d26[_0x2450('0x3c')]=_['merge'](_0x268d26[_0x2450('0x3c')],{'$or':_[_0x2450('0x2c')](_0x268d26[_0x2450('0x34')],function(_0x1195b5){var _0x5ed502={};_0x5ed502[_0x1195b5]={'$like':'%'+_0x369e3e[_0x2450('0x32')]['filter']+'%'};return _0x5ed502;})});}_0x268d26=_[_0x2450('0x3d')]({},_0x268d26,_0x369e3e[_0x2450('0x40')]);return _0x190356[_0x2450('0x62')](_0x268d26);}})[_0x2450('0x23')](function(_0xf3bdbc){if(_0xf3bdbc){_0x1d58fb=_0xf3bdbc[_0x2450('0x36')];if(!_0x369e3e[_0x2450('0x32')][_0x2450('0x5d')](_0x2450('0x37'))){_0x268d26['limit']=qs[_0x2450('0x1c')](_0x369e3e[_0x2450('0x32')]['limit']);_0x268d26[_0x2450('0x1a')]=qs[_0x2450('0x1a')](_0x369e3e['query']['offset']);}return _0x190356[_0x2450('0x62')](_0x268d26);}})['then'](function(_0x404eb6){if(_0x404eb6){return _0x404eb6?{'count':_0x1d58fb,'rows':_0x404eb6}:null;}})[_0x2450('0x23')](respondWithResult(_0x1c230b,null))[_0x2450('0x44')](handleError(_0x1c230b,null));};exports[_0x2450('0x63')]=function(_0x1491d4,_0x1894d1,_0x41a88d){var _0x47f06b,_0x3495a8;var _0xed55fb=[];var _0x5b6eb6=moment()[_0x2450('0x64')](_0x2450('0x65'));return db['Campaign'][_0x2450('0x48')]({'where':{'id':_0x1491d4[_0x2450('0x45')]['id']}})['then'](handleEntityNotFound(_0x1894d1,null))[_0x2450('0x23')](function(_0x2f5404){if(_0x2f5404){_0x3495a8=_0x2f5404;return _0x2f5404[_0x2450('0x63')](_0x1491d4[_0x2450('0x4a')][_0x2450('0x66')],_[_0x2450('0x54')](_0x1491d4['body'],[_0x2450('0x66'),'id'])||{});}return null;})['spread'](function(_0x10809c){var _0x1be2ee;var _0x468d16;_0x47f06b=_0x10809c||[];var _0x2c06c1=[];if(_0x10809c){for(var _0x39f951=0x0;_0x39f951<_0x10809c[_0x2450('0x36')];_0x39f951+=0x1){var _0x2e11cd=_0x10809c[_0x39f951][_0x2450('0x25')]({'plain':!![]});_0x3495a8[_0x2450('0x67')]=_0x1491d4['body'][_0x2450('0x67')]?_0x1491d4[_0x2450('0x4a')][_0x2450('0x67')]:_0x3495a8[_0x2450('0x67')];switch(_0x3495a8[_0x2450('0x67')]){case'always':_0x1be2ee=squel['insert']()[_0x2450('0x68')](_0x2450('0x69'))['fromQuery']([_0x2450('0x6a'),_0x2450('0x6b'),_0x2450('0x6c'),_0x2450('0x6d'),_0x2450('0x5a'),'createdAt',_0x2450('0x56')],squel[_0x2450('0x6e')]()[_0x2450('0x6f')]('phone',_0x2450('0x6a'))[_0x2450('0x6f')](_0x2450('0x70'),_0x2450('0x6b'))[_0x2450('0x6f')]('id',_0x2450('0x6c'))[_0x2450('0x6f')](_0x2e11cd['CmListId'][_0x2450('0x71')](),'ListId')[_0x2450('0x6f')](_0x1491d4[_0x2450('0x45')]['id'][_0x2450('0x71')](),_0x2450('0x5a'))[_0x2450('0x6f')]('\x27'+_0x5b6eb6+'\x27','createdAt')[_0x2450('0x6f')]('\x27'+_0x5b6eb6+'\x27','updatedAt')[_0x2450('0x72')]('cm_contacts')['where'](_0x2450('0x73'))[_0x2450('0x3c')]('ListId\x20=\x20?',_0x2e11cd[_0x2450('0x74')]['toString']())[_0x2450('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x2450('0x3c')](_0x2450('0x75'),squel[_0x2450('0x6e')]()[_0x2450('0x6f')](_0x2450('0x76'))['from'](_0x2450('0x77'))[_0x2450('0x3c')](_0x2450('0x78'),_0x1491d4[_0x2450('0x45')]['id']['toString']()))[_0x2450('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2450('0x6e')]()[_0x2450('0x6f')]('COALESCE(phone,\x27\x27)')[_0x2450('0x72')](_0x2450('0x69'))[_0x2450('0x3c')](_0x2450('0x78'),_0x1491d4[_0x2450('0x45')]['id'][_0x2450('0x71')]())))[_0x2450('0x71')]();break;case'onlyIfOpen':_0x1be2ee=squel['insert']()['into'](_0x2450('0x69'))[_0x2450('0x79')]([_0x2450('0x6a'),_0x2450('0x6b'),_0x2450('0x6c'),_0x2450('0x6d'),'CampaignId','createdAt',_0x2450('0x56')],squel[_0x2450('0x6e')]()[_0x2450('0x6f')](_0x2450('0x6a'),'phone')[_0x2450('0x6f')]('NOW()',_0x2450('0x6b'))[_0x2450('0x6f')]('id',_0x2450('0x6c'))[_0x2450('0x6f')](_0x2e11cd['CmListId']['toString'](),_0x2450('0x6d'))[_0x2450('0x6f')](_0x1491d4[_0x2450('0x45')]['id'][_0x2450('0x71')](),'CampaignId')[_0x2450('0x6f')]('\x27'+_0x5b6eb6+'\x27','createdAt')['field']('\x27'+_0x5b6eb6+'\x27','updatedAt')[_0x2450('0x72')](_0x2450('0x7a'))['where'](_0x2450('0x73'))[_0x2450('0x3c')](_0x2450('0x7b'),_0x2e11cd[_0x2450('0x74')][_0x2450('0x71')]())[_0x2450('0x3c')](_0x2450('0x7c'))['where'](_0x2450('0x75'),squel[_0x2450('0x6e')]()['field'](_0x2450('0x7d'))[_0x2450('0x72')](_0x2450('0x69'))[_0x2450('0x3c')](_0x2450('0x78'),_0x1491d4[_0x2450('0x45')]['id']['toString']())))[_0x2450('0x71')]();break;default:_0x1be2ee=squel[_0x2450('0x7e')]()[_0x2450('0x68')]('cm_hopper')[_0x2450('0x79')](['phone',_0x2450('0x6b'),_0x2450('0x6c'),'ListId','CampaignId','createdAt',_0x2450('0x56')],squel[_0x2450('0x6e')]()[_0x2450('0x6f')](_0x2450('0x6a'),_0x2450('0x6a'))[_0x2450('0x6f')](_0x2450('0x70'),'scheduledAt')[_0x2450('0x6f')]('id',_0x2450('0x6c'))[_0x2450('0x6f')](_0x2e11cd[_0x2450('0x74')]['toString'](),_0x2450('0x6d'))[_0x2450('0x6f')](_0x1491d4['params']['id'][_0x2450('0x71')](),_0x2450('0x5a'))[_0x2450('0x6f')]('\x27'+_0x5b6eb6+'\x27',_0x2450('0x55'))[_0x2450('0x6f')]('\x27'+_0x5b6eb6+'\x27',_0x2450('0x56'))[_0x2450('0x72')](_0x2450('0x7a'))[_0x2450('0x3c')](_0x2450('0x73'))['where']('ListId\x20=\x20?',_0x2e11cd[_0x2450('0x74')][_0x2450('0x71')]())['where'](_0x2450('0x7c')))[_0x2450('0x71')]();}_0x468d16=squel[_0x2450('0x7e')]()[_0x2450('0x68')](_0x2450('0x7f'))[_0x2450('0x79')]([_0x2450('0x80'),'scheduledAt','phone',_0x2450('0x81'),'createdAt','updatedAt'],squel['select']()['field']('h.id','id')[_0x2450('0x6f')]('NOW()',_0x2450('0x6b'))['field'](_0x2450('0x82'),_0x2450('0x6a'))[_0x2450('0x6f')](_0x2450('0x83'),_0x2450('0x81'))[_0x2450('0x6f')]('\x27'+_0x5b6eb6+'\x27',_0x2450('0x55'))[_0x2450('0x6f')]('\x27'+_0x5b6eb6+'\x27',_0x2450('0x56'))[_0x2450('0x72')](_0x2450('0x84'),'ci')[_0x2450('0x85')](_0x2450('0x69'),'h',_0x2450('0x86'))[_0x2450('0x3c')]('h.ListId\x20=\x20?',_0x2e11cd[_0x2450('0x74')][_0x2450('0x71')]())[_0x2450('0x3c')](_0x2450('0x87'),_0x1491d4[_0x2450('0x45')]['id'][_0x2450('0x71')]())[_0x2450('0x3c')](_0x2450('0x88'),_0x5b6eb6))[_0x2450('0x71')]();_0x2c06c1['push'](db[_0x2450('0x89')][_0x2450('0x32')](_0x1be2ee));_0xed55fb[_0x2450('0x8a')](db[_0x2450('0x89')]['query'](_0x468d16));}return BPromise[_0x2450('0x8b')](_0x2c06c1);}})[_0x2450('0x23')](function(){return BPromise[_0x2450('0x8b')](_0xed55fb);})['then'](function(){return _0x47f06b;})[_0x2450('0x23')](respondWithResult(_0x1894d1,null))['catch'](handleError(_0x1894d1,null));};exports[_0x2450('0x8c')]=function(_0x50c2d7,_0x3e807c,_0x43b195){return db[_0x2450('0x2d')][_0x2450('0x48')]({'where':{'id':_0x50c2d7['params']['id']}})[_0x2450('0x23')](handleEntityNotFound(_0x3e807c,null))[_0x2450('0x23')](function(_0x31be97){if(_0x31be97){return _0x31be97['removeLists'](_0x50c2d7[_0x2450('0x32')][_0x2450('0x66')]);}})[_0x2450('0x23')](function(_0x374aab){if(_0x374aab){return db[_0x2450('0x59')][_0x2450('0x24')]({'where':{'ListId':_0x50c2d7['query'][_0x2450('0x66')],'CampaignId':_0x50c2d7[_0x2450('0x45')]['id']}})[_0x2450('0x23')](function(){return _0x374aab;});}})[_0x2450('0x23')](respondWithStatusCode(_0x3e807c,null))[_0x2450('0x44')](handleError(_0x3e807c,null));};exports['getBlackLists']=function(_0x4683a4,_0x23ee2c,_0x231377){var _0x41963f={};var _0x5b76ae={};var _0x54f99c;var _0x22db62;return db[_0x2450('0x2d')]['findOne']({'where':{'id':_0x4683a4[_0x2450('0x45')]['id']}})['then'](handleEntityNotFound(_0x23ee2c,null))['then'](function(_0x58d5b7){if(_0x58d5b7){_0x54f99c=_0x58d5b7;_0x5b76ae[_0x2450('0x31')]=_[_0x2450('0x46')](db[_0x2450('0x8d')][_0x2450('0x47')]);_0x5b76ae['query']=_[_0x2450('0x46')](_0x4683a4['query']);_0x5b76ae[_0x2450('0x3a')]=_[_0x2450('0x33')](_0x5b76ae[_0x2450('0x31')],_0x5b76ae[_0x2450('0x32')]);_0x41963f[_0x2450('0x34')]=_[_0x2450('0x33')](_0x5b76ae[_0x2450('0x31')],qs[_0x2450('0x35')](_0x4683a4['query']['fields']));_0x41963f[_0x2450('0x34')]=_0x41963f[_0x2450('0x34')][_0x2450('0x36')]?_0x41963f[_0x2450('0x34')]:_0x5b76ae[_0x2450('0x31')];_0x41963f[_0x2450('0x38')]=qs[_0x2450('0x39')](_0x4683a4['query'][_0x2450('0x39')]);_0x41963f[_0x2450('0x3c')]=qs[_0x2450('0x3a')](_[_0x2450('0x3b')](_0x4683a4['query'],_0x5b76ae[_0x2450('0x3a')]));if(_0x4683a4[_0x2450('0x32')]['filter']){_0x41963f['where']=_[_0x2450('0x3d')](_0x41963f[_0x2450('0x3c')],{'$or':_['map'](_0x41963f['attributes'],function(_0x3a56c9){var _0x1219d3={};_0x1219d3[_0x3a56c9]={'$like':'%'+_0x4683a4['query'][_0x2450('0x3f')]+'%'};return _0x1219d3;})});}_0x41963f=_[_0x2450('0x3d')]({},_0x41963f,_0x4683a4['options']);return _0x54f99c[_0x2450('0x8e')](_0x41963f);}})[_0x2450('0x23')](function(_0x5d337d){if(_0x5d337d){_0x22db62=_0x5d337d[_0x2450('0x36')];if(!_0x4683a4['query'][_0x2450('0x5d')](_0x2450('0x37'))){_0x41963f[_0x2450('0x1c')]=qs[_0x2450('0x1c')](_0x4683a4[_0x2450('0x32')]['limit']);_0x41963f[_0x2450('0x1a')]=qs[_0x2450('0x1a')](_0x4683a4[_0x2450('0x32')][_0x2450('0x1a')]);}return _0x54f99c[_0x2450('0x8e')](_0x41963f);}})[_0x2450('0x23')](function(_0x4f3db1){if(_0x4f3db1){return _0x4f3db1?{'count':_0x22db62,'rows':_0x4f3db1}:null;}})['then'](respondWithResult(_0x23ee2c,null))[_0x2450('0x44')](handleError(_0x23ee2c,null));};exports[_0x2450('0x8f')]=function(_0x1b071f,_0x13bd66,_0x3857bd){var _0x34bdcb,_0x22ba7f;var _0x4fee9b=[];var _0x2af0f0=moment()[_0x2450('0x64')](_0x2450('0x65'));return db[_0x2450('0x2d')]['find']({'where':{'id':_0x1b071f['params']['id']}})[_0x2450('0x23')](handleEntityNotFound(_0x13bd66,null))[_0x2450('0x23')](function(_0x28c003){if(_0x28c003){_0x22ba7f=_0x28c003;return _0x28c003[_0x2450('0x8f')](_0x1b071f['body'][_0x2450('0x66')],_['omit'](_0x1b071f[_0x2450('0x4a')],[_0x2450('0x66'),'id'])||{});}return null;})['spread'](function(_0x24c01b){var _0x2f07aa;var _0x5d18e5;_0x34bdcb=_0x24c01b||[];var _0x59c333=[];if(_0x24c01b){for(var _0x24b5ca=0x0;_0x24b5ca<_0x24c01b['length'];_0x24b5ca+=0x1){var _0x26a955=_0x24c01b[_0x24b5ca][_0x2450('0x25')]({'plain':!![]});_0x2f07aa=squel['insert']()['into']('cm_hopper_black')[_0x2450('0x79')]([_0x2450('0x6a'),_0x2450('0x6c'),_0x2450('0x6d'),_0x2450('0x5a'),_0x2450('0x55'),_0x2450('0x56')],squel['select']()[_0x2450('0x6f')](_0x2450('0x6a'),_0x2450('0x6a'))['field']('id','ContactId')[_0x2450('0x6f')](_0x26a955['CmListId']['toString'](),'ListId')['field'](_0x1b071f[_0x2450('0x45')]['id']['toString'](),_0x2450('0x5a'))[_0x2450('0x6f')](_0x2450('0x70'),_0x2450('0x55'))[_0x2450('0x6f')]('NOW()',_0x2450('0x56'))['from'](_0x2450('0x7a'))[_0x2450('0x3c')]('deletedAt\x20IS\x20NULL')[_0x2450('0x3c')](_0x2450('0x7b'),_0x26a955[_0x2450('0x74')][_0x2450('0x71')]())[_0x2450('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x2450('0x71')]();_0x59c333['push'](db[_0x2450('0x89')][_0x2450('0x32')](_0x2f07aa));}return BPromise['all'](_0x59c333);}})['then'](function(){return _0x34bdcb;})['then'](respondWithResult(_0x13bd66,null))['catch'](handleError(_0x13bd66,null));};exports[_0x2450('0x90')]=function(_0x165cc0,_0x40ca75,_0xfffe0c){return db['Campaign']['find']({'where':{'id':_0x165cc0[_0x2450('0x45')]['id']}})[_0x2450('0x23')](handleEntityNotFound(_0x40ca75,null))[_0x2450('0x23')](function(_0x5798e8){if(_0x5798e8){return _0x5798e8['removeBlackLists'](_0x165cc0['query'][_0x2450('0x66')]);}})['then'](function(_0x53872c){if(_0x53872c){return db['CmHopperBlack'][_0x2450('0x24')]({'where':{'ListId':_0x165cc0[_0x2450('0x32')][_0x2450('0x66')],'CampaignId':_0x165cc0[_0x2450('0x45')]['id']}})[_0x2450('0x23')](function(){return _0x53872c;});}})[_0x2450('0x23')](respondWithStatusCode(_0x40ca75,null))[_0x2450('0x44')](handleError(_0x40ca75,null));}; \ No newline at end of file +var _0xce25=['limit','set','Content-Range','apply','reject','save','then','IvrCampaigns','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','findOne','CmHopper','hasOwnProperty','nolimit','pick','CampaignId','getHopperHistories','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','scheduledAt','select','field','phone','toString','from','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','cm_hopper','fromQuery','ListId','NOW()','ContactId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','insert','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','OrderBy','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','zip-dir','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count'];(function(_0x24d8db,_0x2392c6){var _0x13d20d=function(_0x568f80){while(--_0x568f80){_0x24d8db['push'](_0x24d8db['shift']());}};_0x13d20d(++_0x2392c6);}(_0xce25,0x196));var _0x5ce2=function(_0x231068,_0x5bbe87){_0x231068=_0x231068-0x0;var _0x13aa8b=_0xce25[_0x231068];return _0x13aa8b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5ce2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ce2('0x1'));var Mustache=require(_0x5ce2('0x2'));var util=require('util');var path=require(_0x5ce2('0x3'));var sox=require(_0x5ce2('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ce2('0x5'));var _=require(_0x5ce2('0x6'));var squel=require(_0x5ce2('0x7'));var crypto=require(_0x5ce2('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5ce2('0x9'));var toCsv=require(_0x5ce2('0xa'));var querystring=require(_0x5ce2('0xb'));var Papa=require('papaparse');var Redis=require(_0x5ce2('0xc'));var authService=require(_0x5ce2('0xd'));var qs=require(_0x5ce2('0xe'));var as=require(_0x5ce2('0xf'));var hardwareService=require(_0x5ce2('0x10'));var logger=require(_0x5ce2('0x11'))('api');var utils=require(_0x5ce2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5ce2('0x13'));var db=require(_0x5ce2('0x14'))['db'];function respondWithStatusCode(_0x5387b2,_0x496c1e){_0x496c1e=_0x496c1e||0xcc;return function(_0x595d33){if(_0x595d33){return _0x5387b2['sendStatus'](_0x496c1e);}return _0x5387b2[_0x5ce2('0x15')](_0x496c1e)['end']();};}function respondWithResult(_0x5360b8,_0x3a69ec){_0x3a69ec=_0x3a69ec||0xc8;return function(_0x56bd1b){if(_0x56bd1b){return _0x5360b8[_0x5ce2('0x15')](_0x3a69ec)[_0x5ce2('0x16')](_0x56bd1b);}};}function respondWithFilteredResult(_0x24522c,_0x53e047){return function(_0x36a2a5){if(_0x36a2a5){var _0x2727c7=typeof _0x53e047[_0x5ce2('0x17')]==='undefined'&&typeof _0x53e047['limit']===_0x5ce2('0x18');var _0x2509c6=_0x36a2a5[_0x5ce2('0x19')];var _0x5369e7=_0x2727c7?0x0:_0x53e047[_0x5ce2('0x17')];var _0x30cb39=_0x2727c7?_0x36a2a5[_0x5ce2('0x19')]:_0x53e047[_0x5ce2('0x17')]+_0x53e047[_0x5ce2('0x1a')];var _0x2f9013;if(_0x30cb39>=_0x2509c6){_0x30cb39=_0x2509c6;_0x2f9013=0xc8;}else{_0x2f9013=0xce;}_0x24522c[_0x5ce2('0x15')](_0x2f9013);return _0x24522c[_0x5ce2('0x1b')](_0x5ce2('0x1c'),_0x5369e7+'-'+_0x30cb39+'/'+_0x2509c6)[_0x5ce2('0x16')](_0x36a2a5);}return null;};}function patchUpdates(_0x3519c4){return function(_0x2d32c9){try{jsonpatch[_0x5ce2('0x1d')](_0x2d32c9,_0x3519c4,!![]);}catch(_0x3cf781){return BPromise[_0x5ce2('0x1e')](_0x3cf781);}return _0x2d32c9[_0x5ce2('0x1f')]();};}function saveUpdates(_0x13d32d,_0x28899f){return function(_0x350fd9){if(_0x350fd9){return _0x350fd9['update'](_0x13d32d)['then'](function(_0x2e6251){return _0x2e6251;});}return null;};}function removeEntity(_0x2e9675,_0x3440b5){return function(_0x4f27aa){if(_0x4f27aa){return _0x4f27aa['destroy']()[_0x5ce2('0x20')](function(){var _0x43580f=_0x4f27aa['get']({'plain':!![]});var _0x3008af=_0x5ce2('0x21');return db[_0x5ce2('0x22')][_0x5ce2('0x23')]({'where':{'type':_0x3008af,'resourceId':_0x43580f['id']}})[_0x5ce2('0x20')](function(){return _0x4f27aa;});})[_0x5ce2('0x20')](function(){_0x2e9675[_0x5ce2('0x15')](0xcc)[_0x5ce2('0x24')]();});}};}function handleEntityNotFound(_0x41af3d,_0x642b21){return function(_0x2f4ccd){if(!_0x2f4ccd){_0x41af3d[_0x5ce2('0x25')](0x194);}return _0x2f4ccd;};}function handleError(_0x41883a,_0xff0a11){_0xff0a11=_0xff0a11||0x1f4;return function(_0xf57c7e){logger[_0x5ce2('0x26')](_0xf57c7e[_0x5ce2('0x27')]);if(_0xf57c7e[_0x5ce2('0x28')]){delete _0xf57c7e[_0x5ce2('0x28')];}_0x41883a[_0x5ce2('0x15')](_0xff0a11)[_0x5ce2('0x29')](_0xf57c7e);};}exports[_0x5ce2('0x2a')]=function(_0x30a01f,_0x35bb72){var _0x26332f={},_0x458314={},_0x234f97={'count':0x0,'rows':[]};var _0x1d5e67=_[_0x5ce2('0x2b')](db[_0x5ce2('0x2c')][_0x5ce2('0x2d')],function(_0x3d15d3){return{'name':_0x3d15d3['fieldName'],'type':_0x3d15d3[_0x5ce2('0x2e')][_0x5ce2('0x2f')]};});_0x458314[_0x5ce2('0x30')]=_['map'](_0x1d5e67,'name');_0x458314[_0x5ce2('0x31')]=_[_0x5ce2('0x32')](_0x30a01f[_0x5ce2('0x31')]);_0x458314['filters']=_['intersection'](_0x458314[_0x5ce2('0x30')],_0x458314[_0x5ce2('0x31')]);_0x26332f['attributes']=_[_0x5ce2('0x33')](_0x458314[_0x5ce2('0x30')],qs[_0x5ce2('0x34')](_0x30a01f[_0x5ce2('0x31')][_0x5ce2('0x34')]));_0x26332f[_0x5ce2('0x35')]=_0x26332f[_0x5ce2('0x35')][_0x5ce2('0x36')]?_0x26332f[_0x5ce2('0x35')]:_0x458314[_0x5ce2('0x30')];if(!_0x30a01f[_0x5ce2('0x31')]['hasOwnProperty']('nolimit')){_0x26332f['limit']=qs['limit'](_0x30a01f[_0x5ce2('0x31')][_0x5ce2('0x1a')]);_0x26332f[_0x5ce2('0x17')]=qs[_0x5ce2('0x17')](_0x30a01f[_0x5ce2('0x31')][_0x5ce2('0x17')]);}_0x26332f[_0x5ce2('0x37')]=qs[_0x5ce2('0x38')](_0x30a01f[_0x5ce2('0x31')][_0x5ce2('0x38')]);_0x26332f[_0x5ce2('0x39')]=qs[_0x5ce2('0x3a')](_['pick'](_0x30a01f[_0x5ce2('0x31')],_0x458314[_0x5ce2('0x3a')]),_0x1d5e67);if(_0x30a01f['query'][_0x5ce2('0x3b')]){_0x26332f[_0x5ce2('0x39')]=_[_0x5ce2('0x3c')](_0x26332f[_0x5ce2('0x39')],{'$or':_['map'](_0x1d5e67,function(_0x234789){if(_0x234789[_0x5ce2('0x2e')]!==_0x5ce2('0x3d')){var _0x21393e={};_0x21393e[_0x234789[_0x5ce2('0x28')]]={'$like':'%'+_0x30a01f[_0x5ce2('0x31')]['filter']+'%'};return _0x21393e;}})});}_0x26332f=_[_0x5ce2('0x3c')]({},_0x26332f,_0x30a01f[_0x5ce2('0x3e')]);var _0x5c290a={'where':_0x26332f[_0x5ce2('0x39')]};return db[_0x5ce2('0x2c')]['count'](_0x5c290a)[_0x5ce2('0x20')](function(_0x413a16){_0x234f97[_0x5ce2('0x19')]=_0x413a16;if(_0x30a01f[_0x5ce2('0x31')][_0x5ce2('0x3f')]){_0x26332f[_0x5ce2('0x40')]=[{'all':!![]}];}return db[_0x5ce2('0x2c')][_0x5ce2('0x41')](_0x26332f);})[_0x5ce2('0x20')](function(_0x49a759){_0x234f97[_0x5ce2('0x42')]=_0x49a759;return _0x234f97;})[_0x5ce2('0x20')](respondWithFilteredResult(_0x35bb72,_0x26332f))['catch'](handleError(_0x35bb72,null));};exports[_0x5ce2('0x43')]=function(_0x51cc8c,_0x444e4f){var _0x24f829={'raw':![],'where':{'id':_0x51cc8c[_0x5ce2('0x44')]['id']}},_0x27c8b6={};_0x27c8b6[_0x5ce2('0x30')]=_[_0x5ce2('0x32')](db[_0x5ce2('0x2c')]['rawAttributes']);_0x27c8b6[_0x5ce2('0x31')]=_[_0x5ce2('0x32')](_0x51cc8c[_0x5ce2('0x31')]);_0x27c8b6[_0x5ce2('0x3a')]=_['intersection'](_0x27c8b6[_0x5ce2('0x30')],_0x27c8b6[_0x5ce2('0x31')]);_0x24f829[_0x5ce2('0x35')]=_[_0x5ce2('0x33')](_0x27c8b6['model'],qs[_0x5ce2('0x34')](_0x51cc8c[_0x5ce2('0x31')][_0x5ce2('0x34')]));_0x24f829[_0x5ce2('0x35')]=_0x24f829['attributes'][_0x5ce2('0x36')]?_0x24f829[_0x5ce2('0x35')]:_0x27c8b6[_0x5ce2('0x30')];if(_0x51cc8c[_0x5ce2('0x31')][_0x5ce2('0x3f')]){_0x24f829['include']=[{'all':!![]}];}_0x24f829=_[_0x5ce2('0x3c')]({},_0x24f829,_0x51cc8c[_0x5ce2('0x3e')]);return db[_0x5ce2('0x2c')][_0x5ce2('0x45')](_0x24f829)[_0x5ce2('0x20')](handleEntityNotFound(_0x444e4f,null))[_0x5ce2('0x20')](respondWithResult(_0x444e4f,null))[_0x5ce2('0x46')](handleError(_0x444e4f,null));};exports[_0x5ce2('0x47')]=function(_0x1c29af,_0x215d5){return db['Campaign'][_0x5ce2('0x47')](_0x1c29af[_0x5ce2('0x48')],{})[_0x5ce2('0x20')](function(_0x5a1f56){var _0x24b693=_0x1c29af['user'][_0x5ce2('0x49')]({'plain':!![]});if(!_0x24b693)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24b693[_0x5ce2('0x4a')]==='user'){var _0x50568c=_0x5a1f56['get']({'plain':!![]});var _0x3d9fd4=_0x5ce2('0x21');return db[_0x5ce2('0x4b')][_0x5ce2('0x45')]({'where':{'name':_0x3d9fd4,'userProfileId':_0x24b693[_0x5ce2('0x4c')]},'raw':!![]})[_0x5ce2('0x20')](function(_0x3d80b8){if(_0x3d80b8&&_0x3d80b8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x50568c['name'],'resourceId':_0x50568c['id'],'type':_0x3d80b8[_0x5ce2('0x28')],'sectionId':_0x3d80b8['id']},{})['then'](function(){return _0x5a1f56;});}else{return _0x5a1f56;}})[_0x5ce2('0x46')](function(_0x296ea8){logger[_0x5ce2('0x26')](_0x5ce2('0x4d'),_0x296ea8);throw _0x296ea8;});}return _0x5a1f56;})['then'](respondWithResult(_0x215d5,0xc9))[_0x5ce2('0x46')](handleError(_0x215d5,null));};exports[_0x5ce2('0x4e')]=function(_0x187b74,_0x16d507){var _0x1252fb={'where':{'id':_0x187b74[_0x5ce2('0x44')]['id']}},_0x2b5fc5={};_0x2b5fc5['model']=_[_0x5ce2('0x32')](db[_0x5ce2('0x2c')][_0x5ce2('0x2d')]);_0x1252fb[_0x5ce2('0x35')]=_['intersection'](_0x2b5fc5[_0x5ce2('0x30')],qs[_0x5ce2('0x34')](_0x187b74['query'][_0x5ce2('0x34')]));_0x1252fb[_0x5ce2('0x35')]=_0x1252fb[_0x5ce2('0x35')][_0x5ce2('0x36')]?_0x1252fb[_0x5ce2('0x35')]:_0x2b5fc5[_0x5ce2('0x30')];if(_0x187b74[_0x5ce2('0x31')][_0x5ce2('0x3f')]){_0x1252fb[_0x5ce2('0x40')]=[{'all':!![]}];}_0x1252fb=_[_0x5ce2('0x3c')]({},_0x1252fb,_0x187b74['options']);return db[_0x5ce2('0x2c')]['find'](_0x1252fb)[_0x5ce2('0x20')](handleEntityNotFound(_0x16d507,null))[_0x5ce2('0x20')](function(_0x8a3ec4){if(_0x8a3ec4){var _0x4a659a=_0x8a3ec4[_0x5ce2('0x49')]({'plain':!![]});_0x4a659a=qs['omit'](_0x4a659a,['id','createdAt',_0x5ce2('0x4f')]);_0x187b74[_0x5ce2('0x48')]=_[_0x5ce2('0x50')](_0x187b74['body'],['id',_0x5ce2('0x51'),_0x5ce2('0x4f')]);return db[_0x5ce2('0x2c')][_0x5ce2('0x47')](_[_0x5ce2('0x3c')](_0x4a659a,_0x187b74['body']),{'include':_0x187b74[_0x5ce2('0x31')][_0x5ce2('0x3f')]?[{'all':!![]}]:undefined})[_0x5ce2('0x20')](function(_0x2dd112){var _0x33888d=_0x187b74[_0x5ce2('0x52')][_0x5ce2('0x49')]({'plain':!![]});if(!_0x33888d)throw new Error(_0x5ce2('0x53'));if(_0x33888d[_0x5ce2('0x4a')]==='user'){var _0x4f4827=_0x2dd112[_0x5ce2('0x49')]({'plain':!![]});var _0xe46941='IvrCampaigns';return db['UserProfileSection'][_0x5ce2('0x45')]({'where':{'name':_0xe46941,'userProfileId':_0x33888d[_0x5ce2('0x4c')]},'raw':!![]})[_0x5ce2('0x20')](function(_0x58e990){if(_0x58e990&&_0x58e990['autoAssociation']===0x0){return db[_0x5ce2('0x22')][_0x5ce2('0x47')]({'name':_0x4f4827[_0x5ce2('0x28')],'resourceId':_0x4f4827['id'],'type':_0x58e990[_0x5ce2('0x28')],'sectionId':_0x58e990['id']},{})[_0x5ce2('0x20')](function(){return _0x2dd112;});}else{return _0x2dd112;}})[_0x5ce2('0x46')](function(_0x1514e8){logger[_0x5ce2('0x26')](_0x5ce2('0x4d'),_0x1514e8);throw _0x1514e8;});}return _0x2dd112;});}})['then'](respondWithResult(_0x16d507,0xc9))['catch'](handleError(_0x16d507,null));};exports[_0x5ce2('0x54')]=function(_0x423799,_0x3551a3){if(_0x423799[_0x5ce2('0x48')]['id']){delete _0x423799[_0x5ce2('0x48')]['id'];}return db['Campaign'][_0x5ce2('0x45')]({'where':{'id':_0x423799[_0x5ce2('0x44')]['id']}})[_0x5ce2('0x20')](handleEntityNotFound(_0x3551a3,null))[_0x5ce2('0x20')](saveUpdates(_0x423799[_0x5ce2('0x48')],null))[_0x5ce2('0x20')](respondWithResult(_0x3551a3,null))[_0x5ce2('0x46')](handleError(_0x3551a3,null));};exports['destroy']=function(_0x466a8b,_0x3167cc){return db['Campaign'][_0x5ce2('0x45')]({'where':{'id':_0x466a8b[_0x5ce2('0x44')]['id']}})[_0x5ce2('0x20')](handleEntityNotFound(_0x3167cc,null))[_0x5ce2('0x20')](removeEntity(_0x3167cc,null))[_0x5ce2('0x46')](handleError(_0x3167cc,null));};exports['getHoppers']=function(_0x9174b5,_0x5f39ba,_0x5a4505){var _0x39a5f7={'raw':!![],'where':{}};var _0x151507={};var _0x46bd13={'count':0x0,'rows':[]};return db[_0x5ce2('0x2c')][_0x5ce2('0x55')]({'where':{'id':_0x9174b5[_0x5ce2('0x44')]['id']}})[_0x5ce2('0x20')](handleEntityNotFound(_0x5f39ba,null))[_0x5ce2('0x20')](function(_0x2800a7){if(_0x2800a7){_0x151507[_0x5ce2('0x30')]=_['keys'](db[_0x5ce2('0x56')][_0x5ce2('0x2d')]);_0x151507['query']=_[_0x5ce2('0x32')](_0x9174b5['query']);_0x151507[_0x5ce2('0x3a')]=_[_0x5ce2('0x33')](_0x151507[_0x5ce2('0x30')],_0x151507[_0x5ce2('0x31')]);_0x39a5f7['attributes']=_['intersection'](_0x151507[_0x5ce2('0x30')],qs['fields'](_0x9174b5['query'][_0x5ce2('0x34')]));_0x39a5f7[_0x5ce2('0x35')]=_0x39a5f7[_0x5ce2('0x35')][_0x5ce2('0x36')]?_0x39a5f7[_0x5ce2('0x35')]:_0x151507[_0x5ce2('0x30')];if(!_0x9174b5['query'][_0x5ce2('0x57')](_0x5ce2('0x58'))){_0x39a5f7['limit']=qs[_0x5ce2('0x1a')](_0x9174b5[_0x5ce2('0x31')][_0x5ce2('0x1a')]);_0x39a5f7['offset']=qs[_0x5ce2('0x17')](_0x9174b5[_0x5ce2('0x31')]['offset']);}_0x39a5f7['order']=qs['sort'](_0x9174b5['query'][_0x5ce2('0x38')]);_0x39a5f7[_0x5ce2('0x39')]=qs[_0x5ce2('0x3a')](_[_0x5ce2('0x59')](_0x9174b5[_0x5ce2('0x31')],_0x151507[_0x5ce2('0x3a')]));_0x39a5f7['where'][_0x5ce2('0x5a')]=_0x2800a7['id'];if(_0x9174b5['query'][_0x5ce2('0x3b')]){_0x39a5f7[_0x5ce2('0x39')]=_[_0x5ce2('0x3c')](_0x39a5f7[_0x5ce2('0x39')],{'$or':_['map'](_0x39a5f7[_0x5ce2('0x35')],function(_0x1bfe8e){var _0x5e3658={};_0x5e3658[_0x1bfe8e]={'$like':'%'+_0x9174b5[_0x5ce2('0x31')]['filter']+'%'};return _0x5e3658;})});}_0x39a5f7=_[_0x5ce2('0x3c')]({},_0x39a5f7,_0x9174b5['options']);return db[_0x5ce2('0x56')]['count']({'where':_0x39a5f7[_0x5ce2('0x39')]})[_0x5ce2('0x20')](function(_0x12a72){_0x46bd13[_0x5ce2('0x19')]=_0x12a72;if(_0x9174b5[_0x5ce2('0x31')]['includeAll']){_0x39a5f7[_0x5ce2('0x40')]=[{'all':!![]}];}return db[_0x5ce2('0x56')][_0x5ce2('0x41')](_0x39a5f7);})[_0x5ce2('0x20')](function(_0x5ea5d1){_0x46bd13[_0x5ce2('0x42')]=_0x5ea5d1;return _0x46bd13;});}})[_0x5ce2('0x20')](respondWithFilteredResult(_0x5f39ba,_0x39a5f7))['catch'](handleError(_0x5f39ba,null));};exports[_0x5ce2('0x5b')]=function(_0x21b8a6,_0x26d552,_0x3941e4){var _0x15fde6={'raw':!![],'where':{}};var _0x41ade2={};var _0x76d122={'count':0x0,'rows':[]};return db[_0x5ce2('0x2c')][_0x5ce2('0x55')]({'where':{'id':_0x21b8a6[_0x5ce2('0x44')]['id']}})[_0x5ce2('0x20')](handleEntityNotFound(_0x26d552,null))[_0x5ce2('0x20')](function(_0x48ffdc){if(_0x48ffdc){_0x41ade2[_0x5ce2('0x30')]=_[_0x5ce2('0x32')](db['CmHopperHistory']['rawAttributes']);_0x41ade2[_0x5ce2('0x31')]=_['keys'](_0x21b8a6[_0x5ce2('0x31')]);_0x41ade2[_0x5ce2('0x3a')]=_[_0x5ce2('0x33')](_0x41ade2['model'],_0x41ade2[_0x5ce2('0x31')]);_0x15fde6['attributes']=_[_0x5ce2('0x33')](_0x41ade2[_0x5ce2('0x30')],qs[_0x5ce2('0x34')](_0x21b8a6[_0x5ce2('0x31')][_0x5ce2('0x34')]));_0x15fde6[_0x5ce2('0x35')]=_0x15fde6['attributes'][_0x5ce2('0x36')]?_0x15fde6[_0x5ce2('0x35')]:_0x41ade2[_0x5ce2('0x30')];if(!_0x21b8a6['query'][_0x5ce2('0x57')](_0x5ce2('0x58'))){_0x15fde6[_0x5ce2('0x1a')]=qs[_0x5ce2('0x1a')](_0x21b8a6[_0x5ce2('0x31')][_0x5ce2('0x1a')]);_0x15fde6[_0x5ce2('0x17')]=qs[_0x5ce2('0x17')](_0x21b8a6[_0x5ce2('0x31')][_0x5ce2('0x17')]);}_0x15fde6[_0x5ce2('0x37')]=qs[_0x5ce2('0x38')](_0x21b8a6['query'][_0x5ce2('0x38')]);_0x15fde6[_0x5ce2('0x39')]=qs[_0x5ce2('0x3a')](_[_0x5ce2('0x59')](_0x21b8a6[_0x5ce2('0x31')],_0x41ade2[_0x5ce2('0x3a')]));_0x15fde6['where']['CampaignId']=_0x48ffdc['id'];if(_0x21b8a6[_0x5ce2('0x31')]['filter']){_0x15fde6['where']=_[_0x5ce2('0x3c')](_0x15fde6['where'],{'$or':_['map'](_0x15fde6[_0x5ce2('0x35')],function(_0x2ba157){var _0x932d4d={};_0x932d4d[_0x2ba157]={'$like':'%'+_0x21b8a6[_0x5ce2('0x31')][_0x5ce2('0x3b')]+'%'};return _0x932d4d;})});}_0x15fde6=_['merge']({},_0x15fde6,_0x21b8a6[_0x5ce2('0x3e')]);return db['CmHopperHistory']['count']({'where':_0x15fde6['where']})[_0x5ce2('0x20')](function(_0x4f20c5){_0x76d122[_0x5ce2('0x19')]=_0x4f20c5;if(_0x21b8a6[_0x5ce2('0x31')][_0x5ce2('0x3f')]){_0x15fde6[_0x5ce2('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5ce2('0x41')](_0x15fde6);})[_0x5ce2('0x20')](function(_0x3c28e3){_0x76d122[_0x5ce2('0x42')]=_0x3c28e3;return _0x76d122;});}})[_0x5ce2('0x20')](respondWithFilteredResult(_0x26d552,_0x15fde6))[_0x5ce2('0x46')](handleError(_0x26d552,null));};exports[_0x5ce2('0x5c')]=function(_0x4f9f03,_0x2997cc,_0x39bcbf){var _0x349410={'raw':!![],'where':{}};var _0x791ae6={};var _0x30486b={'count':0x0,'rows':[]};return db[_0x5ce2('0x2c')][_0x5ce2('0x55')]({'where':{'id':_0x4f9f03[_0x5ce2('0x44')]['id']}})[_0x5ce2('0x20')](handleEntityNotFound(_0x2997cc,null))[_0x5ce2('0x20')](function(_0x982e04){if(_0x982e04){_0x791ae6[_0x5ce2('0x30')]=_[_0x5ce2('0x32')](db[_0x5ce2('0x5d')][_0x5ce2('0x2d')]);_0x791ae6[_0x5ce2('0x31')]=_[_0x5ce2('0x32')](_0x4f9f03['query']);_0x791ae6[_0x5ce2('0x3a')]=_[_0x5ce2('0x33')](_0x791ae6[_0x5ce2('0x30')],_0x791ae6[_0x5ce2('0x31')]);_0x349410[_0x5ce2('0x35')]=_[_0x5ce2('0x33')](_0x791ae6[_0x5ce2('0x30')],qs[_0x5ce2('0x34')](_0x4f9f03[_0x5ce2('0x31')][_0x5ce2('0x34')]));_0x349410[_0x5ce2('0x35')]=_0x349410[_0x5ce2('0x35')][_0x5ce2('0x36')]?_0x349410['attributes']:_0x791ae6[_0x5ce2('0x30')];if(!_0x4f9f03[_0x5ce2('0x31')][_0x5ce2('0x57')]('nolimit')){_0x349410[_0x5ce2('0x1a')]=qs[_0x5ce2('0x1a')](_0x4f9f03['query'][_0x5ce2('0x1a')]);_0x349410[_0x5ce2('0x17')]=qs['offset'](_0x4f9f03[_0x5ce2('0x31')][_0x5ce2('0x17')]);}_0x349410['order']=qs[_0x5ce2('0x38')](_0x4f9f03[_0x5ce2('0x31')][_0x5ce2('0x38')]);_0x349410[_0x5ce2('0x39')]=qs[_0x5ce2('0x3a')](_['pick'](_0x4f9f03[_0x5ce2('0x31')],_0x791ae6[_0x5ce2('0x3a')]));_0x349410['where'][_0x5ce2('0x5a')]=_0x982e04['id'];if(_0x4f9f03[_0x5ce2('0x31')][_0x5ce2('0x3b')]){_0x349410[_0x5ce2('0x39')]=_[_0x5ce2('0x3c')](_0x349410['where'],{'$or':_[_0x5ce2('0x2b')](_0x349410[_0x5ce2('0x35')],function(_0x31a07e){var _0x405ba1={};_0x405ba1[_0x31a07e]={'$like':'%'+_0x4f9f03['query'][_0x5ce2('0x3b')]+'%'};return _0x405ba1;})});}_0x349410=_[_0x5ce2('0x3c')]({},_0x349410,_0x4f9f03[_0x5ce2('0x3e')]);return db['CmHopperFinal'][_0x5ce2('0x19')]({'where':_0x349410[_0x5ce2('0x39')]})['then'](function(_0x144610){_0x30486b['count']=_0x144610;if(_0x4f9f03[_0x5ce2('0x31')]['includeAll']){_0x349410[_0x5ce2('0x40')]=[{'all':!![]}];}return db[_0x5ce2('0x5d')][_0x5ce2('0x41')](_0x349410);})['then'](function(_0x125838){_0x30486b[_0x5ce2('0x42')]=_0x125838;return _0x30486b;});}})[_0x5ce2('0x20')](respondWithFilteredResult(_0x2997cc,_0x349410))[_0x5ce2('0x46')](handleError(_0x2997cc,null));};exports[_0x5ce2('0x5e')]=function(_0x29693f,_0x552bfb,_0x4cd630){var _0x12cb5a={'raw':!![],'where':{}};var _0x2f74d9={};var _0x2ad383={'count':0x0,'rows':[]};return db['Campaign'][_0x5ce2('0x55')]({'where':{'id':_0x29693f[_0x5ce2('0x44')]['id']}})['then'](handleEntityNotFound(_0x552bfb,null))[_0x5ce2('0x20')](function(_0x2532ab){if(_0x2532ab){_0x2f74d9[_0x5ce2('0x30')]=_[_0x5ce2('0x32')](db['CmHopperBlack'][_0x5ce2('0x2d')]);_0x2f74d9[_0x5ce2('0x31')]=_[_0x5ce2('0x32')](_0x29693f[_0x5ce2('0x31')]);_0x2f74d9[_0x5ce2('0x3a')]=_[_0x5ce2('0x33')](_0x2f74d9[_0x5ce2('0x30')],_0x2f74d9[_0x5ce2('0x31')]);_0x12cb5a[_0x5ce2('0x35')]=_['intersection'](_0x2f74d9[_0x5ce2('0x30')],qs[_0x5ce2('0x34')](_0x29693f[_0x5ce2('0x31')][_0x5ce2('0x34')]));_0x12cb5a[_0x5ce2('0x35')]=_0x12cb5a['attributes'][_0x5ce2('0x36')]?_0x12cb5a[_0x5ce2('0x35')]:_0x2f74d9[_0x5ce2('0x30')];if(!_0x29693f['query'][_0x5ce2('0x57')]('nolimit')){_0x12cb5a[_0x5ce2('0x1a')]=qs[_0x5ce2('0x1a')](_0x29693f[_0x5ce2('0x31')][_0x5ce2('0x1a')]);_0x12cb5a[_0x5ce2('0x17')]=qs[_0x5ce2('0x17')](_0x29693f['query'][_0x5ce2('0x17')]);}_0x12cb5a[_0x5ce2('0x37')]=qs[_0x5ce2('0x38')](_0x29693f[_0x5ce2('0x31')][_0x5ce2('0x38')]);_0x12cb5a['where']=qs['filters'](_[_0x5ce2('0x59')](_0x29693f['query'],_0x2f74d9[_0x5ce2('0x3a')]));_0x12cb5a[_0x5ce2('0x39')][_0x5ce2('0x5a')]=_0x2532ab['id'];if(_0x29693f['query'][_0x5ce2('0x3b')]){_0x12cb5a[_0x5ce2('0x39')]=_[_0x5ce2('0x3c')](_0x12cb5a[_0x5ce2('0x39')],{'$or':_[_0x5ce2('0x2b')](_0x12cb5a[_0x5ce2('0x35')],function(_0x327d4e){var _0x51b937={};_0x51b937[_0x327d4e]={'$like':'%'+_0x29693f['query'][_0x5ce2('0x3b')]+'%'};return _0x51b937;})});}_0x12cb5a=_[_0x5ce2('0x3c')]({},_0x12cb5a,_0x29693f[_0x5ce2('0x3e')]);return db[_0x5ce2('0x5f')]['count']({'where':_0x12cb5a[_0x5ce2('0x39')]})['then'](function(_0x3cd70c){_0x2ad383[_0x5ce2('0x19')]=_0x3cd70c;if(_0x29693f[_0x5ce2('0x31')]['includeAll']){_0x12cb5a[_0x5ce2('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5ce2('0x41')](_0x12cb5a);})[_0x5ce2('0x20')](function(_0x5833e3){_0x2ad383['rows']=_0x5833e3;return _0x2ad383;});}})[_0x5ce2('0x20')](respondWithFilteredResult(_0x552bfb,_0x12cb5a))['catch'](handleError(_0x552bfb,null));};exports['getLists']=function(_0x420452,_0x1637ad,_0x32c761){var _0x18a638={};var _0x3a71ea={};var _0x75c8c5;var _0x2e5d3e;return db[_0x5ce2('0x2c')][_0x5ce2('0x55')]({'where':{'id':_0x420452['params']['id']}})['then'](handleEntityNotFound(_0x1637ad,null))[_0x5ce2('0x20')](function(_0x5cdf89){if(_0x5cdf89){_0x75c8c5=_0x5cdf89;_0x3a71ea[_0x5ce2('0x30')]=_['keys'](db[_0x5ce2('0x60')][_0x5ce2('0x2d')]);_0x3a71ea[_0x5ce2('0x31')]=_['keys'](_0x420452[_0x5ce2('0x31')]);_0x3a71ea['filters']=_[_0x5ce2('0x33')](_0x3a71ea[_0x5ce2('0x30')],_0x3a71ea[_0x5ce2('0x31')]);_0x18a638['attributes']=_[_0x5ce2('0x33')](_0x3a71ea[_0x5ce2('0x30')],qs[_0x5ce2('0x34')](_0x420452[_0x5ce2('0x31')][_0x5ce2('0x34')]));_0x18a638[_0x5ce2('0x35')]=_0x18a638[_0x5ce2('0x35')]['length']?_0x18a638[_0x5ce2('0x35')]:_0x3a71ea[_0x5ce2('0x30')];_0x18a638[_0x5ce2('0x37')]=qs[_0x5ce2('0x38')](_0x420452[_0x5ce2('0x31')][_0x5ce2('0x38')]);_0x18a638[_0x5ce2('0x39')]=qs[_0x5ce2('0x3a')](_[_0x5ce2('0x59')](_0x420452[_0x5ce2('0x31')],_0x3a71ea[_0x5ce2('0x3a')]));if(_0x420452[_0x5ce2('0x31')][_0x5ce2('0x3b')]){_0x18a638[_0x5ce2('0x39')]=_[_0x5ce2('0x3c')](_0x18a638['where'],{'$or':_[_0x5ce2('0x2b')](_0x18a638['attributes'],function(_0x547283){var _0x474d3e={};_0x474d3e[_0x547283]={'$like':'%'+_0x420452[_0x5ce2('0x31')][_0x5ce2('0x3b')]+'%'};return _0x474d3e;})});}_0x18a638=_[_0x5ce2('0x3c')]({},_0x18a638,_0x420452[_0x5ce2('0x3e')]);return _0x75c8c5[_0x5ce2('0x61')](_0x18a638);}})[_0x5ce2('0x20')](function(_0x550a42){if(_0x550a42){_0x2e5d3e=_0x550a42[_0x5ce2('0x36')];if(!_0x420452[_0x5ce2('0x31')]['hasOwnProperty']('nolimit')){_0x18a638[_0x5ce2('0x1a')]=qs[_0x5ce2('0x1a')](_0x420452[_0x5ce2('0x31')][_0x5ce2('0x1a')]);_0x18a638[_0x5ce2('0x17')]=qs[_0x5ce2('0x17')](_0x420452[_0x5ce2('0x31')][_0x5ce2('0x17')]);}return _0x75c8c5['getLists'](_0x18a638);}})[_0x5ce2('0x20')](function(_0xbd5a22){if(_0xbd5a22){return _0xbd5a22?{'count':_0x2e5d3e,'rows':_0xbd5a22}:null;}})['then'](respondWithResult(_0x1637ad,null))[_0x5ce2('0x46')](handleError(_0x1637ad,null));};exports[_0x5ce2('0x62')]=function(_0xbd0b6b,_0xafe101,_0x253999){var _0x46eefe,_0x24797c;var _0x3f305e=[];var _0x414982=moment()[_0x5ce2('0x63')](_0x5ce2('0x64'));return db['Campaign']['find']({'where':{'id':_0xbd0b6b[_0x5ce2('0x44')]['id']}})[_0x5ce2('0x20')](handleEntityNotFound(_0xafe101,null))[_0x5ce2('0x20')](function(_0x3408ff){if(_0x3408ff){_0x24797c=_0x3408ff;return _0x3408ff[_0x5ce2('0x62')](_0xbd0b6b['body'][_0x5ce2('0x65')],_[_0x5ce2('0x50')](_0xbd0b6b[_0x5ce2('0x48')],['ids','id'])||{});}return null;})[_0x5ce2('0x66')](function(_0x2f28ac){var _0x5026e9;var _0x79033d;_0x46eefe=_0x2f28ac||[];var _0xd9e563=[];if(_0x2f28ac){for(var _0x4bf87e=0x0;_0x4bf87e<_0x2f28ac[_0x5ce2('0x36')];_0x4bf87e+=0x1){var _0x2bdfd3=_0x2f28ac[_0x4bf87e][_0x5ce2('0x49')]({'plain':!![]});_0x24797c[_0x5ce2('0x67')]=_0xbd0b6b['body'][_0x5ce2('0x67')]?_0xbd0b6b[_0x5ce2('0x48')][_0x5ce2('0x67')]:_0x24797c[_0x5ce2('0x67')];switch(_0x24797c[_0x5ce2('0x67')]){case _0x5ce2('0x68'):_0x5026e9=squel['insert']()[_0x5ce2('0x69')]('cm_hopper')['fromQuery'](['phone',_0x5ce2('0x6a'),'ContactId','ListId',_0x5ce2('0x5a'),_0x5ce2('0x51'),'updatedAt'],squel[_0x5ce2('0x6b')]()[_0x5ce2('0x6c')](_0x5ce2('0x6d'),_0x5ce2('0x6d'))[_0x5ce2('0x6c')]('NOW()',_0x5ce2('0x6a'))[_0x5ce2('0x6c')]('id','ContactId')['field'](_0x2bdfd3['CmListId'][_0x5ce2('0x6e')](),'ListId')[_0x5ce2('0x6c')](_0xbd0b6b[_0x5ce2('0x44')]['id'][_0x5ce2('0x6e')](),_0x5ce2('0x5a'))[_0x5ce2('0x6c')]('\x27'+_0x414982+'\x27',_0x5ce2('0x51'))[_0x5ce2('0x6c')]('\x27'+_0x414982+'\x27',_0x5ce2('0x4f'))[_0x5ce2('0x6f')]('cm_contacts')[_0x5ce2('0x39')]('deletedAt\x20IS\x20NULL')['where'](_0x5ce2('0x70'),_0x2bdfd3[_0x5ce2('0x71')][_0x5ce2('0x6e')]())[_0x5ce2('0x39')](_0x5ce2('0x72'))[_0x5ce2('0x39')](_0x5ce2('0x73'),squel['select']()['field'](_0x5ce2('0x74'))[_0x5ce2('0x6f')](_0x5ce2('0x75'))[_0x5ce2('0x39')](_0x5ce2('0x76'),_0xbd0b6b[_0x5ce2('0x44')]['id'][_0x5ce2('0x6e')]()))[_0x5ce2('0x39')](_0x5ce2('0x73'),squel[_0x5ce2('0x6b')]()[_0x5ce2('0x6c')]('COALESCE(phone,\x27\x27)')[_0x5ce2('0x6f')](_0x5ce2('0x77'))[_0x5ce2('0x39')]('CampaignId\x20=\x20?',_0xbd0b6b['params']['id'][_0x5ce2('0x6e')]())))[_0x5ce2('0x6e')]();break;case'onlyIfOpen':_0x5026e9=squel['insert']()['into']('cm_hopper')[_0x5ce2('0x78')]([_0x5ce2('0x6d'),_0x5ce2('0x6a'),'ContactId',_0x5ce2('0x79'),_0x5ce2('0x5a'),_0x5ce2('0x51'),_0x5ce2('0x4f')],squel[_0x5ce2('0x6b')]()[_0x5ce2('0x6c')](_0x5ce2('0x6d'),_0x5ce2('0x6d'))[_0x5ce2('0x6c')](_0x5ce2('0x7a'),'scheduledAt')['field']('id',_0x5ce2('0x7b'))[_0x5ce2('0x6c')](_0x2bdfd3['CmListId'][_0x5ce2('0x6e')](),_0x5ce2('0x79'))[_0x5ce2('0x6c')](_0xbd0b6b[_0x5ce2('0x44')]['id']['toString'](),_0x5ce2('0x5a'))[_0x5ce2('0x6c')]('\x27'+_0x414982+'\x27',_0x5ce2('0x51'))[_0x5ce2('0x6c')]('\x27'+_0x414982+'\x27',_0x5ce2('0x4f'))['from'](_0x5ce2('0x7c'))[_0x5ce2('0x39')](_0x5ce2('0x7d'))[_0x5ce2('0x39')](_0x5ce2('0x70'),_0x2bdfd3[_0x5ce2('0x71')][_0x5ce2('0x6e')]())[_0x5ce2('0x39')](_0x5ce2('0x72'))[_0x5ce2('0x39')](_0x5ce2('0x73'),squel[_0x5ce2('0x6b')]()[_0x5ce2('0x6c')](_0x5ce2('0x7e'))[_0x5ce2('0x6f')](_0x5ce2('0x77'))[_0x5ce2('0x39')](_0x5ce2('0x76'),_0xbd0b6b[_0x5ce2('0x44')]['id'][_0x5ce2('0x6e')]())))[_0x5ce2('0x6e')]();break;default:_0x5026e9=squel['insert']()['into'](_0x5ce2('0x77'))[_0x5ce2('0x78')](['phone','scheduledAt','ContactId',_0x5ce2('0x79'),_0x5ce2('0x5a'),_0x5ce2('0x51'),_0x5ce2('0x4f')],squel[_0x5ce2('0x6b')]()[_0x5ce2('0x6c')]('phone',_0x5ce2('0x6d'))[_0x5ce2('0x6c')]('NOW()',_0x5ce2('0x6a'))[_0x5ce2('0x6c')]('id',_0x5ce2('0x7b'))[_0x5ce2('0x6c')](_0x2bdfd3['CmListId'][_0x5ce2('0x6e')](),'ListId')[_0x5ce2('0x6c')](_0xbd0b6b[_0x5ce2('0x44')]['id'][_0x5ce2('0x6e')](),_0x5ce2('0x5a'))['field']('\x27'+_0x414982+'\x27',_0x5ce2('0x51'))[_0x5ce2('0x6c')]('\x27'+_0x414982+'\x27',_0x5ce2('0x4f'))[_0x5ce2('0x6f')](_0x5ce2('0x7c'))[_0x5ce2('0x39')](_0x5ce2('0x7d'))['where']('ListId\x20=\x20?',_0x2bdfd3['CmListId'][_0x5ce2('0x6e')]())[_0x5ce2('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x5ce2('0x6e')]();}_0x79033d=squel[_0x5ce2('0x7f')]()['into'](_0x5ce2('0x80'))['fromQuery']([_0x5ce2('0x81'),_0x5ce2('0x6a'),'phone','OrderBy','createdAt',_0x5ce2('0x4f')],squel[_0x5ce2('0x6b')]()[_0x5ce2('0x6c')](_0x5ce2('0x82'),'id')[_0x5ce2('0x6c')](_0x5ce2('0x7a'),'scheduledAt')[_0x5ce2('0x6c')](_0x5ce2('0x83'),_0x5ce2('0x6d'))[_0x5ce2('0x6c')]('ci.OrderBY',_0x5ce2('0x84'))[_0x5ce2('0x6c')]('\x27'+_0x414982+'\x27',_0x5ce2('0x51'))[_0x5ce2('0x6c')]('\x27'+_0x414982+'\x27',_0x5ce2('0x4f'))['from']('cm_contact_has_items','ci')[_0x5ce2('0x85')]('cm_hopper','h',_0x5ce2('0x86'))['where'](_0x5ce2('0x87'),_0x2bdfd3[_0x5ce2('0x71')][_0x5ce2('0x6e')]())[_0x5ce2('0x39')](_0x5ce2('0x88'),_0xbd0b6b[_0x5ce2('0x44')]['id'][_0x5ce2('0x6e')]())[_0x5ce2('0x39')]('h.createdAt\x20=\x20?',_0x414982))[_0x5ce2('0x6e')]();_0xd9e563['push'](db['sequelize']['query'](_0x5026e9));_0x3f305e[_0x5ce2('0x89')](db[_0x5ce2('0x8a')][_0x5ce2('0x31')](_0x79033d));}return BPromise[_0x5ce2('0x8b')](_0xd9e563);}})['then'](function(){return BPromise[_0x5ce2('0x8b')](_0x3f305e);})[_0x5ce2('0x20')](function(){return _0x46eefe;})['then'](respondWithResult(_0xafe101,null))[_0x5ce2('0x46')](handleError(_0xafe101,null));};exports[_0x5ce2('0x8c')]=function(_0xc11898,_0x339c1c,_0x306a43){return db[_0x5ce2('0x2c')]['find']({'where':{'id':_0xc11898[_0x5ce2('0x44')]['id']}})['then'](handleEntityNotFound(_0x339c1c,null))[_0x5ce2('0x20')](function(_0x1ced05){if(_0x1ced05){return _0x1ced05['removeLists'](_0xc11898['query'][_0x5ce2('0x65')]);}})[_0x5ce2('0x20')](function(_0x1f2c63){if(_0x1f2c63){return db['CmHopper'][_0x5ce2('0x23')]({'where':{'ListId':_0xc11898[_0x5ce2('0x31')][_0x5ce2('0x65')],'CampaignId':_0xc11898['params']['id']}})[_0x5ce2('0x20')](function(){return _0x1f2c63;});}})[_0x5ce2('0x20')](respondWithStatusCode(_0x339c1c,null))[_0x5ce2('0x46')](handleError(_0x339c1c,null));};exports['getBlackLists']=function(_0x1f9cca,_0x363280,_0x567bb8){var _0x2ef0f2={};var _0x17b10b={};var _0x1938f6;var _0x465fc8;return db[_0x5ce2('0x2c')]['findOne']({'where':{'id':_0x1f9cca[_0x5ce2('0x44')]['id']}})['then'](handleEntityNotFound(_0x363280,null))['then'](function(_0x517a37){if(_0x517a37){_0x1938f6=_0x517a37;_0x17b10b[_0x5ce2('0x30')]=_[_0x5ce2('0x32')](db[_0x5ce2('0x60')][_0x5ce2('0x2d')]);_0x17b10b[_0x5ce2('0x31')]=_[_0x5ce2('0x32')](_0x1f9cca[_0x5ce2('0x31')]);_0x17b10b['filters']=_['intersection'](_0x17b10b[_0x5ce2('0x30')],_0x17b10b[_0x5ce2('0x31')]);_0x2ef0f2[_0x5ce2('0x35')]=_[_0x5ce2('0x33')](_0x17b10b[_0x5ce2('0x30')],qs['fields'](_0x1f9cca['query'][_0x5ce2('0x34')]));_0x2ef0f2[_0x5ce2('0x35')]=_0x2ef0f2['attributes'][_0x5ce2('0x36')]?_0x2ef0f2[_0x5ce2('0x35')]:_0x17b10b[_0x5ce2('0x30')];_0x2ef0f2['order']=qs[_0x5ce2('0x38')](_0x1f9cca[_0x5ce2('0x31')]['sort']);_0x2ef0f2[_0x5ce2('0x39')]=qs['filters'](_[_0x5ce2('0x59')](_0x1f9cca['query'],_0x17b10b['filters']));if(_0x1f9cca[_0x5ce2('0x31')][_0x5ce2('0x3b')]){_0x2ef0f2[_0x5ce2('0x39')]=_[_0x5ce2('0x3c')](_0x2ef0f2['where'],{'$or':_[_0x5ce2('0x2b')](_0x2ef0f2[_0x5ce2('0x35')],function(_0x4f12ac){var _0x38365={};_0x38365[_0x4f12ac]={'$like':'%'+_0x1f9cca[_0x5ce2('0x31')][_0x5ce2('0x3b')]+'%'};return _0x38365;})});}_0x2ef0f2=_[_0x5ce2('0x3c')]({},_0x2ef0f2,_0x1f9cca['options']);return _0x1938f6['getBlackLists'](_0x2ef0f2);}})['then'](function(_0xb55f4b){if(_0xb55f4b){_0x465fc8=_0xb55f4b[_0x5ce2('0x36')];if(!_0x1f9cca['query'][_0x5ce2('0x57')](_0x5ce2('0x58'))){_0x2ef0f2[_0x5ce2('0x1a')]=qs[_0x5ce2('0x1a')](_0x1f9cca['query'][_0x5ce2('0x1a')]);_0x2ef0f2[_0x5ce2('0x17')]=qs[_0x5ce2('0x17')](_0x1f9cca[_0x5ce2('0x31')][_0x5ce2('0x17')]);}return _0x1938f6[_0x5ce2('0x8d')](_0x2ef0f2);}})[_0x5ce2('0x20')](function(_0x533843){if(_0x533843){return _0x533843?{'count':_0x465fc8,'rows':_0x533843}:null;}})[_0x5ce2('0x20')](respondWithResult(_0x363280,null))[_0x5ce2('0x46')](handleError(_0x363280,null));};exports[_0x5ce2('0x8e')]=function(_0x2c3e67,_0x12537b,_0x8e9e68){var _0x7f520b,_0x168c5b;var _0x34b03b=[];var _0x443744=moment()[_0x5ce2('0x63')](_0x5ce2('0x64'));return db['Campaign'][_0x5ce2('0x45')]({'where':{'id':_0x2c3e67[_0x5ce2('0x44')]['id']}})[_0x5ce2('0x20')](handleEntityNotFound(_0x12537b,null))[_0x5ce2('0x20')](function(_0x46296e){if(_0x46296e){_0x168c5b=_0x46296e;return _0x46296e[_0x5ce2('0x8e')](_0x2c3e67[_0x5ce2('0x48')][_0x5ce2('0x65')],_['omit'](_0x2c3e67[_0x5ce2('0x48')],[_0x5ce2('0x65'),'id'])||{});}return null;})['spread'](function(_0x2551b6){var _0x1cbbda;var _0x109f4f;_0x7f520b=_0x2551b6||[];var _0x15b61d=[];if(_0x2551b6){for(var _0x3fcfc1=0x0;_0x3fcfc1<_0x2551b6[_0x5ce2('0x36')];_0x3fcfc1+=0x1){var _0x1a055d=_0x2551b6[_0x3fcfc1][_0x5ce2('0x49')]({'plain':!![]});_0x1cbbda=squel['insert']()[_0x5ce2('0x69')](_0x5ce2('0x8f'))['fromQuery']([_0x5ce2('0x6d'),_0x5ce2('0x7b'),'ListId',_0x5ce2('0x5a'),_0x5ce2('0x51'),_0x5ce2('0x4f')],squel['select']()['field'](_0x5ce2('0x6d'),_0x5ce2('0x6d'))['field']('id',_0x5ce2('0x7b'))[_0x5ce2('0x6c')](_0x1a055d['CmListId'][_0x5ce2('0x6e')](),'ListId')[_0x5ce2('0x6c')](_0x2c3e67['params']['id'][_0x5ce2('0x6e')](),_0x5ce2('0x5a'))[_0x5ce2('0x6c')](_0x5ce2('0x7a'),_0x5ce2('0x51'))[_0x5ce2('0x6c')](_0x5ce2('0x7a'),_0x5ce2('0x4f'))['from'](_0x5ce2('0x7c'))[_0x5ce2('0x39')](_0x5ce2('0x7d'))[_0x5ce2('0x39')](_0x5ce2('0x70'),_0x1a055d['CmListId'][_0x5ce2('0x6e')]())[_0x5ce2('0x39')](_0x5ce2('0x72')))[_0x5ce2('0x6e')]();_0x15b61d['push'](db[_0x5ce2('0x8a')]['query'](_0x1cbbda));}return BPromise[_0x5ce2('0x8b')](_0x15b61d);}})['then'](function(){return _0x7f520b;})[_0x5ce2('0x20')](respondWithResult(_0x12537b,null))[_0x5ce2('0x46')](handleError(_0x12537b,null));};exports['removeBlackLists']=function(_0x33ef55,_0x13a691,_0x59ed80){return db['Campaign']['find']({'where':{'id':_0x33ef55[_0x5ce2('0x44')]['id']}})[_0x5ce2('0x20')](handleEntityNotFound(_0x13a691,null))[_0x5ce2('0x20')](function(_0x58e42a){if(_0x58e42a){return _0x58e42a['removeBlackLists'](_0x33ef55[_0x5ce2('0x31')][_0x5ce2('0x65')]);}})[_0x5ce2('0x20')](function(_0x32cc71){if(_0x32cc71){return db[_0x5ce2('0x5f')][_0x5ce2('0x23')]({'where':{'ListId':_0x33ef55['query']['ids'],'CampaignId':_0x33ef55[_0x5ce2('0x44')]['id']}})['then'](function(){return _0x32cc71;});}})['then'](respondWithStatusCode(_0x13a691,null))['catch'](handleError(_0x13a691,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 25c0fd5..b742cca 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1003eb,_0xc3c682){var _0x3e9558=function(_0x3106f6){while(--_0x3106f6){_0x1003eb['push'](_0x1003eb['shift']());}};_0x3e9558(++_0xc3c682);}(_0x7a54,0x106));var _0x47a5=function(_0x330d71,_0x16e906){_0x330d71=_0x330d71-0x0;var _0x212e20=_0x7a54[_0x330d71];return _0x212e20;};'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 +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index a03b276..9014b41 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 _0x21a3=['include','model','GetCampaign','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Campaign','findAll','options','raw','where','attributes','limit','map'];(function(_0x3460d1,_0x2d9677){var _0xbb30bd=function(_0xc7f647){while(--_0xc7f647){_0x3460d1['push'](_0x3460d1['shift']());}};_0xbb30bd(++_0x2d9677);}(_0x21a3,0x66));var _0x321a=function(_0x1233d2,_0x5416f4){_0x1233d2=_0x1233d2-0x0;var _0x22759e=_0x21a3[_0x1233d2];return _0x22759e;};'use strict';var _=require(_0x321a('0x0'));var util=require('util');var moment=require(_0x321a('0x1'));var BPromise=require(_0x321a('0x2'));var rs=require(_0x321a('0x3'));var fs=require('fs');var Redis=require(_0x321a('0x4'));var db=require(_0x321a('0x5'))['db'];var utils=require(_0x321a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x321a('0x7'));var jayson=require(_0x321a('0x8'));var client=jayson[_0x321a('0x9')][_0x321a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f3b81,_0x388901,_0x24a04c){return new BPromise(function(_0x10c1d3,_0xdfd6b8){return client[_0x321a('0xb')](_0x5f3b81,_0x24a04c)[_0x321a('0xc')](function(_0x2c52dc){logger[_0x321a('0xd')](_0x321a('0xe'),_0x388901,_0x321a('0xf'));logger[_0x321a('0x10')](_0x321a('0x11'),_0x388901,'request\x20sent',JSON[_0x321a('0x12')](_0x2c52dc));if(_0x2c52dc[_0x321a('0x13')]){if(_0x2c52dc['error']['code']===0x1f4){logger[_0x321a('0x13')]('Campaign,\x20%s,\x20%s',_0x388901,_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);return _0xdfd6b8(_0x2c52dc['error']['message']);}logger[_0x321a('0x13')](_0x321a('0xe'),_0x388901,_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);return _0x10c1d3(_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);}else{logger[_0x321a('0xd')](_0x321a('0xe'),_0x388901,'request\x20sent');_0x10c1d3(_0x2c52dc[_0x321a('0x15')][_0x321a('0x14')]);}})['catch'](function(_0x45ceb2){logger[_0x321a('0x13')](_0x321a('0xe'),_0x388901,_0x45ceb2);_0xdfd6b8(_0x45ceb2);});});}exports['GetCampaign']=function(_0x5b1810){var _0x464bd7=this;return new Promise(function(_0x35fd6f,_0x58595b){return db[_0x321a('0x16')][_0x321a('0x17')]({'raw':_0x5b1810[_0x321a('0x18')]?_0x5b1810['options'][_0x321a('0x19')]===undefined?!![]:![]:!![],'where':_0x5b1810[_0x321a('0x18')]?_0x5b1810[_0x321a('0x18')][_0x321a('0x1a')]||null:null,'attributes':_0x5b1810[_0x321a('0x18')]?_0x5b1810[_0x321a('0x18')][_0x321a('0x1b')]||null:null,'limit':_0x5b1810[_0x321a('0x18')]?_0x5b1810[_0x321a('0x18')][_0x321a('0x1c')]||null:null,'include':_0x5b1810[_0x321a('0x18')]?_0x5b1810[_0x321a('0x18')]['include']?_[_0x321a('0x1d')](_0x5b1810[_0x321a('0x18')][_0x321a('0x1e')],function(_0x5ae154){return{'model':db[_0x5ae154[_0x321a('0x1f')]],'as':_0x5ae154['as'],'attributes':_0x5ae154[_0x321a('0x1b')],'include':_0x5ae154['include']?_['map'](_0x5ae154[_0x321a('0x1e')],function(_0x5a66c2){return{'model':db[_0x5a66c2[_0x321a('0x1f')]],'as':_0x5a66c2['as'],'attributes':_0x5a66c2[_0x321a('0x1b')],'include':_0x5a66c2[_0x321a('0x1e')]?_[_0x321a('0x1d')](_0x5a66c2[_0x321a('0x1e')],function(_0xdce138){return{'model':db[_0xdce138['model']],'as':_0xdce138['as'],'attributes':_0xdce138['attributes']};}):[]};}):[]};}):[]:[]})[_0x321a('0xc')](function(_0x105216){logger[_0x321a('0xd')]('GetCampaign',_0x5b1810);logger[_0x321a('0x10')](_0x321a('0x20'),_0x5b1810,JSON[_0x321a('0x12')](_0x105216));_0x35fd6f(_0x105216);})['catch'](function(_0x8a09bb){logger[_0x321a('0x13')](_0x321a('0x20'),_0x8a09bb[_0x321a('0x14')],_0x5b1810);_0x58595b(_0x464bd7[_0x321a('0x13')](0x1f4,_0x8a09bb[_0x321a('0x14')]));});});}; \ No newline at end of file +var _0xdb13=['result','catch','GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x2077f5,_0x4ab0d9){var _0x30978b=function(_0x3679ea){while(--_0x3679ea){_0x2077f5['push'](_0x2077f5['shift']());}};_0x30978b(++_0x4ab0d9);}(_0xdb13,0x10c));var _0x3db1=function(_0x3b736c,_0x219ecf){_0x3b736c=_0x3b736c-0x0;var _0x14d90f=_0xdb13[_0x3b736c];return _0x14d90f;};'use strict';var _=require('lodash');var util=require(_0x3db1('0x0'));var moment=require(_0x3db1('0x1'));var BPromise=require(_0x3db1('0x2'));var rs=require(_0x3db1('0x3'));var fs=require('fs');var Redis=require(_0x3db1('0x4'));var db=require(_0x3db1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3db1('0x6'))(_0x3db1('0x7'));var config=require(_0x3db1('0x8'));var jayson=require(_0x3db1('0x9'));var client=jayson[_0x3db1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37ae52,_0x2e1935,_0x28e7b6){return new BPromise(function(_0x379cfb,_0x22f0c7){return client[_0x3db1('0xb')](_0x37ae52,_0x28e7b6)[_0x3db1('0xc')](function(_0x9a9677){logger[_0x3db1('0xd')](_0x3db1('0xe'),_0x2e1935,_0x3db1('0xf'));logger[_0x3db1('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x2e1935,_0x3db1('0xf'),JSON[_0x3db1('0x11')](_0x9a9677));if(_0x9a9677[_0x3db1('0x12')]){if(_0x9a9677[_0x3db1('0x12')]['code']===0x1f4){logger['error'](_0x3db1('0xe'),_0x2e1935,_0x9a9677[_0x3db1('0x12')][_0x3db1('0x13')]);return _0x22f0c7(_0x9a9677[_0x3db1('0x12')][_0x3db1('0x13')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x2e1935,_0x9a9677['error']['message']);return _0x379cfb(_0x9a9677[_0x3db1('0x12')][_0x3db1('0x13')]);}else{logger[_0x3db1('0xd')](_0x3db1('0xe'),_0x2e1935,_0x3db1('0xf'));_0x379cfb(_0x9a9677[_0x3db1('0x14')]['message']);}})[_0x3db1('0x15')](function(_0x6b8af0){logger['error'](_0x3db1('0xe'),_0x2e1935,_0x6b8af0);_0x22f0c7(_0x6b8af0);});});}exports[_0x3db1('0x16')]=function(_0x549a0e){var _0x26edb2=this;return new Promise(function(_0x5f3203,_0x16d339){return db[_0x3db1('0x17')][_0x3db1('0x18')]({'raw':_0x549a0e[_0x3db1('0x19')]?_0x549a0e['options'][_0x3db1('0x1a')]===undefined?!![]:![]:!![],'where':_0x549a0e[_0x3db1('0x19')]?_0x549a0e[_0x3db1('0x19')]['where']||null:null,'attributes':_0x549a0e[_0x3db1('0x19')]?_0x549a0e[_0x3db1('0x19')][_0x3db1('0x1b')]||null:null,'limit':_0x549a0e[_0x3db1('0x19')]?_0x549a0e[_0x3db1('0x19')][_0x3db1('0x1c')]||null:null,'include':_0x549a0e[_0x3db1('0x19')]?_0x549a0e[_0x3db1('0x19')][_0x3db1('0x1d')]?_[_0x3db1('0x1e')](_0x549a0e[_0x3db1('0x19')][_0x3db1('0x1d')],function(_0x1ee0c6){return{'model':db[_0x1ee0c6[_0x3db1('0x1f')]],'as':_0x1ee0c6['as'],'attributes':_0x1ee0c6[_0x3db1('0x1b')],'include':_0x1ee0c6['include']?_[_0x3db1('0x1e')](_0x1ee0c6[_0x3db1('0x1d')],function(_0x2263c6){return{'model':db[_0x2263c6['model']],'as':_0x2263c6['as'],'attributes':_0x2263c6[_0x3db1('0x1b')],'include':_0x2263c6[_0x3db1('0x1d')]?_[_0x3db1('0x1e')](_0x2263c6[_0x3db1('0x1d')],function(_0x5bd826){return{'model':db[_0x5bd826[_0x3db1('0x1f')]],'as':_0x5bd826['as'],'attributes':_0x5bd826[_0x3db1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x408d1c){logger[_0x3db1('0xd')](_0x3db1('0x16'),_0x549a0e);logger['debug'](_0x3db1('0x16'),_0x549a0e,JSON[_0x3db1('0x11')](_0x408d1c));_0x5f3203(_0x408d1c);})[_0x3db1('0x15')](function(_0x51ec2f){logger['error'](_0x3db1('0x16'),_0x51ec2f[_0x3db1('0x13')],_0x549a0e);_0x16d339(_0x26edb2['error'](0x1f4,_0x51ec2f['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 186c35d..4dc1576 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 _0xc4c2=['multer','util','connect-timeout','express','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','create','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','removeLists','exports'];(function(_0x184dcb,_0x30e024){var _0xff6c33=function(_0x4eb883){while(--_0x4eb883){_0x184dcb['push'](_0x184dcb['shift']());}};_0xff6c33(++_0x30e024);}(_0xc4c2,0x155));var _0x2c4c=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xc4c2[_0x342700];return _0x53406f;};'use strict';var multer=require(_0x2c4c('0x0'));var util=require(_0x2c4c('0x1'));var path=require('path');var timeout=require(_0x2c4c('0x2'));var express=require(_0x2c4c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c4c('0x4'));var controller=require(_0x2c4c('0x5'));router[_0x2c4c('0x6')]('/',auth[_0x2c4c('0x7')](),controller[_0x2c4c('0x8')]);router[_0x2c4c('0x6')](_0x2c4c('0x9'),auth[_0x2c4c('0x7')](),controller[_0x2c4c('0xa')]);router[_0x2c4c('0x6')](_0x2c4c('0xb'),auth['isAuthenticated'](),controller[_0x2c4c('0xc')]);router['get'](_0x2c4c('0xd'),auth[_0x2c4c('0x7')](),controller[_0x2c4c('0xe')]);router[_0x2c4c('0x6')]('/:id/hopper_finals',auth[_0x2c4c('0x7')](),controller['getHopperFinals']);router[_0x2c4c('0x6')](_0x2c4c('0xf'),auth[_0x2c4c('0x7')](),controller[_0x2c4c('0x10')]);router['get'](_0x2c4c('0x11'),auth[_0x2c4c('0x7')](),controller[_0x2c4c('0x12')]);router[_0x2c4c('0x6')]('/:id/blacklists',auth[_0x2c4c('0x7')](),controller['getBlackLists']);router['post']('/',auth[_0x2c4c('0x7')](),controller[_0x2c4c('0x13')]);router[_0x2c4c('0x14')](_0x2c4c('0x15'),auth[_0x2c4c('0x7')](),controller[_0x2c4c('0x16')]);router[_0x2c4c('0x14')](_0x2c4c('0x11'),auth[_0x2c4c('0x7')](),controller[_0x2c4c('0x17')]);router['post'](_0x2c4c('0x18'),auth[_0x2c4c('0x7')](),controller[_0x2c4c('0x19')]);router[_0x2c4c('0x1a')](_0x2c4c('0x9'),auth[_0x2c4c('0x7')](),controller[_0x2c4c('0x1b')]);router['delete']('/:id',auth[_0x2c4c('0x7')](),controller['destroy']);router[_0x2c4c('0x1c')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2c4c('0x1d')]);router[_0x2c4c('0x1c')]('/:id/blacklists',auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x2c4c('0x1e')]=router; \ No newline at end of file +var _0xb0de=['getBlackLists','post','create','/:id/clone','clone','addBlackLists','put','/:id','update','delete','destroy','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists'];(function(_0x3e5987,_0x5f4374){var _0x4b3e2f=function(_0x22766e){while(--_0x22766e){_0x3e5987['push'](_0x3e5987['shift']());}};_0x4b3e2f(++_0x5f4374);}(_0xb0de,0x148));var _0xeb0d=function(_0x141da6,_0x156bb1){_0x141da6=_0x141da6-0x0;var _0x5c9d77=_0xb0de[_0x141da6];return _0x5c9d77;};'use strict';var multer=require(_0xeb0d('0x0'));var util=require('util');var path=require(_0xeb0d('0x1'));var timeout=require(_0xeb0d('0x2'));var express=require(_0xeb0d('0x3'));var router=express[_0xeb0d('0x4')]();var fs_extra=require(_0xeb0d('0x5'));var auth=require(_0xeb0d('0x6'));var interaction=require(_0xeb0d('0x7'));var config=require(_0xeb0d('0x8'));var controller=require('./campaign.controller');router[_0xeb0d('0x9')]('/',auth['isAuthenticated'](),controller[_0xeb0d('0xa')]);router[_0xeb0d('0x9')]('/:id',auth[_0xeb0d('0xb')](),controller[_0xeb0d('0xc')]);router[_0xeb0d('0x9')](_0xeb0d('0xd'),auth['isAuthenticated'](),controller[_0xeb0d('0xe')]);router['get']('/:id/hopper_histories',auth[_0xeb0d('0xb')](),controller[_0xeb0d('0xf')]);router[_0xeb0d('0x9')](_0xeb0d('0x10'),auth[_0xeb0d('0xb')](),controller['getHopperFinals']);router[_0xeb0d('0x9')](_0xeb0d('0x11'),auth[_0xeb0d('0xb')](),controller[_0xeb0d('0x12')]);router[_0xeb0d('0x9')](_0xeb0d('0x13'),auth[_0xeb0d('0xb')](),controller[_0xeb0d('0x14')]);router[_0xeb0d('0x9')](_0xeb0d('0x15'),auth[_0xeb0d('0xb')](),controller[_0xeb0d('0x16')]);router[_0xeb0d('0x17')]('/',auth['isAuthenticated'](),controller[_0xeb0d('0x18')]);router[_0xeb0d('0x17')](_0xeb0d('0x19'),auth[_0xeb0d('0xb')](),controller[_0xeb0d('0x1a')]);router[_0xeb0d('0x17')]('/:id/lists',auth[_0xeb0d('0xb')](),controller['addLists']);router[_0xeb0d('0x17')](_0xeb0d('0x15'),auth[_0xeb0d('0xb')](),controller[_0xeb0d('0x1b')]);router[_0xeb0d('0x1c')](_0xeb0d('0x1d'),auth['isAuthenticated'](),controller[_0xeb0d('0x1e')]);router[_0xeb0d('0x1f')](_0xeb0d('0x1d'),auth[_0xeb0d('0xb')](),controller[_0xeb0d('0x20')]);router['delete']('/:id/lists',auth[_0xeb0d('0xb')](),controller['removeLists']);router[_0xeb0d('0x1f')](_0xeb0d('0x15'),auth[_0xeb0d('0xb')](),controller[_0xeb0d('0x21')]);module[_0xeb0d('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 1720381..2720096 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 _0x6a15=['key','sequelize','exports','getDataValue'];(function(_0x1321df,_0x56df75){var _0x4a050d=function(_0x4d6cb7){while(--_0x4d6cb7){_0x1321df['push'](_0x1321df['shift']());}};_0x4a050d(++_0x56df75);}(_0x6a15,0xd5));var _0x56a1=function(_0x341286,_0xc3d8f0){_0x341286=_0x341286-0x0;var _0x4e5b06=_0x6a15[_0x341286];return _0x4e5b06;};'use strict';var Sequelize=require(_0x56a1('0x0'));module[_0x56a1('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x56a1('0x2')](_0x56a1('0x3'));}}}; \ No newline at end of file +var _0xb8b5=['key','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x14e107,_0x1c9553){var _0x407a24=function(_0xe2a3eb){while(--_0xe2a3eb){_0x14e107['push'](_0x14e107['shift']());}};_0x407a24(++_0x1c9553);}(_0xb8b5,0x1a5));var _0x5b8b=function(_0x313a0f,_0x412cc1){_0x313a0f=_0x313a0f-0x0;var _0x57e036=_0xb8b5[_0x313a0f];return _0x57e036;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x5b8b('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x5b8b('0x1')],'length':_0x5b8b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5b8b('0x0')]},'name':{'type':Sequelize[_0x5b8b('0x3')],'get':function(){return this[_0x5b8b('0x4')](_0x5b8b('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 63c2b9e..8a5a019 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 _0x7195=['create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','CannedAnswers','sendStatus','error','name','index','map','CannedAnswer','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','filters','options','body','find'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x7195,0x68));var _0x5719=function(_0x58487f,_0x48e686){_0x58487f=_0x58487f-0x0;var _0x3222da=_0x7195[_0x58487f];return _0x3222da;};'use strict';var emlformat=require(_0x5719('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5719('0x1'));var jsonpatch=require(_0x5719('0x2'));var rp=require(_0x5719('0x3'));var moment=require(_0x5719('0x4'));var BPromise=require(_0x5719('0x5'));var Mustache=require('mustache');var util=require(_0x5719('0x6'));var path=require(_0x5719('0x7'));var sox=require(_0x5719('0x8'));var csv=require('to-csv');var ejs=require(_0x5719('0x9'));var fs=require('fs');var fs_extra=require(_0x5719('0xa'));var _=require(_0x5719('0xb'));var squel=require(_0x5719('0xc'));var crypto=require(_0x5719('0xd'));var jsforce=require(_0x5719('0xe'));var deskjs=require(_0x5719('0xf'));var toCsv=require(_0x5719('0x10'));var querystring=require(_0x5719('0x11'));var Papa=require(_0x5719('0x12'));var Redis=require(_0x5719('0x13'));var authService=require(_0x5719('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5719('0x15'));var hardwareService=require(_0x5719('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5719('0x17'));var db=require(_0x5719('0x18'))['db'];function respondWithStatusCode(_0x3b3be9,_0x1c995c){_0x1c995c=_0x1c995c||0xcc;return function(_0x1939a1){if(_0x1939a1){return _0x3b3be9['sendStatus'](_0x1c995c);}return _0x3b3be9[_0x5719('0x19')](_0x1c995c)[_0x5719('0x1a')]();};}function respondWithResult(_0x4b018c,_0x477f91){_0x477f91=_0x477f91||0xc8;return function(_0x974868){if(_0x974868){return _0x4b018c[_0x5719('0x19')](_0x477f91)['json'](_0x974868);}};}function respondWithFilteredResult(_0xa1c7eb,_0x488df0){return function(_0x2bc9f2){if(_0x2bc9f2){var _0x7f03f1=typeof _0x488df0[_0x5719('0x1b')]===_0x5719('0x1c')&&typeof _0x488df0[_0x5719('0x1d')]===_0x5719('0x1c');var _0x5791e3=_0x2bc9f2[_0x5719('0x1e')];var _0x10f0c0=_0x7f03f1?0x0:_0x488df0[_0x5719('0x1b')];var _0x3bc331=_0x7f03f1?_0x2bc9f2['count']:_0x488df0[_0x5719('0x1b')]+_0x488df0['limit'];var _0x5505e5;if(_0x3bc331>=_0x5791e3){_0x3bc331=_0x5791e3;_0x5505e5=0xc8;}else{_0x5505e5=0xce;}_0xa1c7eb['status'](_0x5505e5);return _0xa1c7eb[_0x5719('0x1f')]('Content-Range',_0x10f0c0+'-'+_0x3bc331+'/'+_0x5791e3)[_0x5719('0x20')](_0x2bc9f2);}return null;};}function patchUpdates(_0x573f06){return function(_0x3098ec){try{jsonpatch[_0x5719('0x21')](_0x3098ec,_0x573f06,!![]);}catch(_0xc6fc5b){return BPromise['reject'](_0xc6fc5b);}return _0x3098ec[_0x5719('0x22')]();};}function saveUpdates(_0x469f7e,_0x2c7063){return function(_0x4aed8c){if(_0x4aed8c){return _0x4aed8c[_0x5719('0x23')](_0x469f7e)['then'](function(_0x5880f8){return _0x5880f8;});}return null;};}function removeEntity(_0xfeb698,_0x16feaa){return function(_0x5a2078){if(_0x5a2078){return _0x5a2078[_0x5719('0x24')]()[_0x5719('0x25')](function(){var _0x4fd915=_0x5a2078['get']({'plain':!![]});var _0x45d9be=_0x5719('0x26');return db['UserProfileResource'][_0x5719('0x24')]({'where':{'type':_0x45d9be,'resourceId':_0x4fd915['id']}})['then'](function(){return _0x5a2078;});})['then'](function(){_0xfeb698[_0x5719('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b5e65,_0x23d6cb){return function(_0x57257a){if(!_0x57257a){_0x3b5e65[_0x5719('0x27')](0x194);}return _0x57257a;};}function handleError(_0x438cf5,_0x33547e){_0x33547e=_0x33547e||0x1f4;return function(_0x186bc8){logger[_0x5719('0x28')](_0x186bc8['stack']);if(_0x186bc8[_0x5719('0x29')]){delete _0x186bc8[_0x5719('0x29')];}_0x438cf5[_0x5719('0x19')](_0x33547e)['send'](_0x186bc8);};}exports[_0x5719('0x2a')]=function(_0x3c2c8d,_0x265112){var _0x4812d8={},_0x314d14={},_0x515573={'count':0x0,'rows':[]};var _0x575497=_[_0x5719('0x2b')](db[_0x5719('0x2c')][_0x5719('0x2d')],function(_0x43b1d1){return{'name':_0x43b1d1[_0x5719('0x2e')],'type':_0x43b1d1['type']['key']};});_0x314d14[_0x5719('0x2f')]=_[_0x5719('0x2b')](_0x575497,'name');_0x314d14[_0x5719('0x30')]=_[_0x5719('0x31')](_0x3c2c8d[_0x5719('0x30')]);_0x314d14['filters']=_[_0x5719('0x32')](_0x314d14['model'],_0x314d14[_0x5719('0x30')]);_0x4812d8['attributes']=_[_0x5719('0x32')](_0x314d14[_0x5719('0x2f')],qs[_0x5719('0x33')](_0x3c2c8d[_0x5719('0x30')][_0x5719('0x33')]));_0x4812d8[_0x5719('0x34')]=_0x4812d8[_0x5719('0x34')][_0x5719('0x35')]?_0x4812d8[_0x5719('0x34')]:_0x314d14[_0x5719('0x2f')];if(!_0x3c2c8d[_0x5719('0x30')]['hasOwnProperty'](_0x5719('0x36'))){_0x4812d8[_0x5719('0x1d')]=qs[_0x5719('0x1d')](_0x3c2c8d['query'][_0x5719('0x1d')]);_0x4812d8['offset']=qs[_0x5719('0x1b')](_0x3c2c8d[_0x5719('0x30')][_0x5719('0x1b')]);}_0x4812d8['order']=qs['sort'](_0x3c2c8d[_0x5719('0x30')][_0x5719('0x37')]);_0x4812d8[_0x5719('0x38')]=qs['filters'](_[_0x5719('0x39')](_0x3c2c8d[_0x5719('0x30')],_0x314d14['filters']),_0x575497);if(_0x3c2c8d[_0x5719('0x30')][_0x5719('0x3a')]){_0x4812d8[_0x5719('0x38')]=_[_0x5719('0x3b')](_0x4812d8[_0x5719('0x38')],{'$or':[{'key':{'$like':'%'+_0x3c2c8d[_0x5719('0x30')][_0x5719('0x3a')]+'%'}},{'value':{'$like':'%'+_0x3c2c8d[_0x5719('0x30')][_0x5719('0x3a')]+'%'}}]});}_0x4812d8=_[_0x5719('0x3b')]({},_0x4812d8,_0x3c2c8d['options']);var _0x40ba1f={'where':_0x4812d8[_0x5719('0x38')]};return db[_0x5719('0x2c')]['count'](_0x40ba1f)['then'](function(_0x2e6240){_0x515573[_0x5719('0x1e')]=_0x2e6240;if(_0x3c2c8d[_0x5719('0x30')][_0x5719('0x3c')]){_0x4812d8[_0x5719('0x3d')]=[{'all':!![]}];}return db[_0x5719('0x2c')][_0x5719('0x3e')](_0x4812d8);})['then'](function(_0x1d7acd){_0x515573['rows']=_0x1d7acd;return _0x515573;})[_0x5719('0x25')](respondWithFilteredResult(_0x265112,_0x4812d8))[_0x5719('0x3f')](handleError(_0x265112,null));};exports[_0x5719('0x40')]=function(_0x11290b,_0x1be4ca){var _0xfdfaaa={'raw':!![],'where':{'id':_0x11290b[_0x5719('0x41')]['id']}},_0x58d95f={};_0x58d95f['model']=_['keys'](db['CannedAnswer'][_0x5719('0x2d')]);_0x58d95f[_0x5719('0x30')]=_[_0x5719('0x31')](_0x11290b[_0x5719('0x30')]);_0x58d95f[_0x5719('0x42')]=_[_0x5719('0x32')](_0x58d95f[_0x5719('0x2f')],_0x58d95f['query']);_0xfdfaaa['attributes']=_['intersection'](_0x58d95f[_0x5719('0x2f')],qs[_0x5719('0x33')](_0x11290b[_0x5719('0x30')][_0x5719('0x33')]));_0xfdfaaa[_0x5719('0x34')]=_0xfdfaaa[_0x5719('0x34')][_0x5719('0x35')]?_0xfdfaaa[_0x5719('0x34')]:_0x58d95f[_0x5719('0x2f')];if(_0x11290b[_0x5719('0x30')][_0x5719('0x3c')]){_0xfdfaaa[_0x5719('0x3d')]=[{'all':!![]}];}_0xfdfaaa=_[_0x5719('0x3b')]({},_0xfdfaaa,_0x11290b[_0x5719('0x43')]);return db[_0x5719('0x2c')]['find'](_0xfdfaaa)['then'](handleEntityNotFound(_0x1be4ca,null))[_0x5719('0x25')](respondWithResult(_0x1be4ca,null))[_0x5719('0x3f')](handleError(_0x1be4ca,null));};exports[_0x5719('0x23')]=function(_0x39cc8e,_0x478033){if(_0x39cc8e[_0x5719('0x44')]['id']){delete _0x39cc8e['body']['id'];}return db[_0x5719('0x2c')][_0x5719('0x45')]({'where':{'id':_0x39cc8e['params']['id']}})[_0x5719('0x25')](handleEntityNotFound(_0x478033,null))[_0x5719('0x25')](saveUpdates(_0x39cc8e[_0x5719('0x44')],null))['then'](respondWithResult(_0x478033,null))[_0x5719('0x3f')](handleError(_0x478033,null));};exports[_0x5719('0x24')]=function(_0x121cd1,_0x4cef66){return db['CannedAnswer'][_0x5719('0x45')]({'where':{'id':_0x121cd1[_0x5719('0x41')]['id']}})[_0x5719('0x25')](handleEntityNotFound(_0x4cef66,null))['then'](removeEntity(_0x4cef66,null))[_0x5719('0x3f')](handleError(_0x4cef66,null));};exports[_0x5719('0x46')]=function(_0x427ed4,_0x17891b){var _0x3fc4e3={'key':_0x427ed4['body'][_0x5719('0x47')]};if(_0x427ed4[_0x5719('0x44')][_0x5719('0x48')]){_0x3fc4e3[_0x5719('0x48')]=_0x427ed4['body'][_0x5719('0x48')];}else if(_0x427ed4['body']['SmsAccountId']){_0x3fc4e3['SmsAccountId']=_0x427ed4['body'][_0x5719('0x49')];}else if(_0x427ed4[_0x5719('0x44')][_0x5719('0x4a')]){_0x3fc4e3[_0x5719('0x4a')]=_0x427ed4[_0x5719('0x44')][_0x5719('0x4a')];}else if(_0x427ed4['body']['ChatWebsiteId']){_0x3fc4e3[_0x5719('0x4b')]=_0x427ed4[_0x5719('0x44')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x3fc4e3})['then'](function(_0x514800){if(_0x514800){throw new db[(_0x5719('0x4c'))][(_0x5719('0x4d'))](_0x5719('0x4e'));}return db[_0x5719('0x2c')][_0x5719('0x46')](_0x427ed4[_0x5719('0x44')]);})[_0x5719('0x25')](function(_0x4fd1a9){var _0x36e31a=_0x427ed4['user'][_0x5719('0x4f')]({'plain':!![]});if(!_0x36e31a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36e31a[_0x5719('0x50')]===_0x5719('0x51')){var _0x25e2e5=_0x4fd1a9['get']({'plain':!![]});return db[_0x5719('0x52')][_0x5719('0x45')]({'where':{'name':_0x5719('0x26'),'userProfileId':_0x36e31a[_0x5719('0x53')]},'raw':!![]})[_0x5719('0x25')](function(_0x3ef9ee){if(_0x3ef9ee&&_0x3ef9ee[_0x5719('0x54')]===0x0){return db[_0x5719('0x55')][_0x5719('0x46')]({'name':_0x25e2e5['name'],'resourceId':_0x25e2e5['id'],'type':_0x3ef9ee[_0x5719('0x29')],'sectionId':_0x3ef9ee['id']},{})[_0x5719('0x25')](function(){return _0x4fd1a9;});}else{return _0x4fd1a9;}})[_0x5719('0x3f')](function(_0x173eb3){logger[_0x5719('0x28')](_0x5719('0x56'),_0x173eb3);throw _0x173eb3;});}return _0x4fd1a9;})[_0x5719('0x25')](respondWithResult(_0x17891b,0xc9))[_0x5719('0x3f')](handleError(_0x17891b,null));}; \ No newline at end of file +var _0xac30=['MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','CannedAnswers','UserProfileResource','then','error','stack','name','send','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','catch','show','length','merge','find','update','body','params'];(function(_0x3a2f76,_0x12c754){var _0x62fd4e=function(_0x41abf3){while(--_0x41abf3){_0x3a2f76['push'](_0x3a2f76['shift']());}};_0x62fd4e(++_0x12c754);}(_0xac30,0x16f));var _0x0ac3=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xac30[_0x3b150c];return _0x5cd414;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ac3('0x0'));var zipdir=require(_0x0ac3('0x1'));var jsonpatch=require(_0x0ac3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0ac3('0x3'));var Mustache=require('mustache');var util=require(_0x0ac3('0x4'));var path=require(_0x0ac3('0x5'));var sox=require(_0x0ac3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ac3('0x7'));var squel=require(_0x0ac3('0x8'));var crypto=require('crypto');var jsforce=require(_0x0ac3('0x9'));var deskjs=require(_0x0ac3('0xa'));var toCsv=require(_0x0ac3('0xb'));var querystring=require('querystring');var Papa=require(_0x0ac3('0xc'));var Redis=require('ioredis');var authService=require(_0x0ac3('0xd'));var qs=require(_0x0ac3('0xe'));var as=require(_0x0ac3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ac3('0x10'))(_0x0ac3('0x11'));var utils=require(_0x0ac3('0x12'));var config=require(_0x0ac3('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ac3('0x14'))['db'];function respondWithStatusCode(_0x368b46,_0x20f996){_0x20f996=_0x20f996||0xcc;return function(_0x49bf39){if(_0x49bf39){return _0x368b46[_0x0ac3('0x15')](_0x20f996);}return _0x368b46[_0x0ac3('0x16')](_0x20f996)[_0x0ac3('0x17')]();};}function respondWithResult(_0x8b08bf,_0x18c130){_0x18c130=_0x18c130||0xc8;return function(_0x58f201){if(_0x58f201){return _0x8b08bf['status'](_0x18c130)[_0x0ac3('0x18')](_0x58f201);}};}function respondWithFilteredResult(_0x4b5159,_0x18014d){return function(_0x2846e9){if(_0x2846e9){var _0x19c878=typeof _0x18014d[_0x0ac3('0x19')]===_0x0ac3('0x1a')&&typeof _0x18014d[_0x0ac3('0x1b')]===_0x0ac3('0x1a');var _0x4e3d6c=_0x2846e9[_0x0ac3('0x1c')];var _0x5d497a=_0x19c878?0x0:_0x18014d['offset'];var _0x248fc8=_0x19c878?_0x2846e9[_0x0ac3('0x1c')]:_0x18014d['offset']+_0x18014d[_0x0ac3('0x1b')];var _0x53ccb0;if(_0x248fc8>=_0x4e3d6c){_0x248fc8=_0x4e3d6c;_0x53ccb0=0xc8;}else{_0x53ccb0=0xce;}_0x4b5159[_0x0ac3('0x16')](_0x53ccb0);return _0x4b5159[_0x0ac3('0x1d')](_0x0ac3('0x1e'),_0x5d497a+'-'+_0x248fc8+'/'+_0x4e3d6c)[_0x0ac3('0x18')](_0x2846e9);}return null;};}function patchUpdates(_0x178e05){return function(_0x18f622){try{jsonpatch['apply'](_0x18f622,_0x178e05,!![]);}catch(_0x405adc){return BPromise[_0x0ac3('0x1f')](_0x405adc);}return _0x18f622['save']();};}function saveUpdates(_0x18b2b6,_0x36d6bc){return function(_0x59ed21){if(_0x59ed21){return _0x59ed21['update'](_0x18b2b6)['then'](function(_0x58f1f2){return _0x58f1f2;});}return null;};}function removeEntity(_0x54f789,_0x4299b3){return function(_0x578f1c){if(_0x578f1c){return _0x578f1c[_0x0ac3('0x20')]()['then'](function(){var _0x11b1c2=_0x578f1c['get']({'plain':!![]});var _0x3b3645=_0x0ac3('0x21');return db[_0x0ac3('0x22')][_0x0ac3('0x20')]({'where':{'type':_0x3b3645,'resourceId':_0x11b1c2['id']}})['then'](function(){return _0x578f1c;});})[_0x0ac3('0x23')](function(){_0x54f789[_0x0ac3('0x16')](0xcc)[_0x0ac3('0x17')]();});}};}function handleEntityNotFound(_0x1841a6,_0x4d2f48){return function(_0x1c68e8){if(!_0x1c68e8){_0x1841a6[_0x0ac3('0x15')](0x194);}return _0x1c68e8;};}function handleError(_0x5179a7,_0x2d659c){_0x2d659c=_0x2d659c||0x1f4;return function(_0x263d57){logger[_0x0ac3('0x24')](_0x263d57[_0x0ac3('0x25')]);if(_0x263d57[_0x0ac3('0x26')]){delete _0x263d57[_0x0ac3('0x26')];}_0x5179a7[_0x0ac3('0x16')](_0x2d659c)[_0x0ac3('0x27')](_0x263d57);};}exports['index']=function(_0x29c5a5,_0xa8c206){var _0x580e80={},_0x318615={},_0x20e2ca={'count':0x0,'rows':[]};var _0x416e37=_['map'](db[_0x0ac3('0x28')][_0x0ac3('0x29')],function(_0x48d6b4){return{'name':_0x48d6b4[_0x0ac3('0x2a')],'type':_0x48d6b4[_0x0ac3('0x2b')][_0x0ac3('0x2c')]};});_0x318615[_0x0ac3('0x2d')]=_[_0x0ac3('0x2e')](_0x416e37,_0x0ac3('0x26'));_0x318615[_0x0ac3('0x2f')]=_[_0x0ac3('0x30')](_0x29c5a5[_0x0ac3('0x2f')]);_0x318615['filters']=_['intersection'](_0x318615[_0x0ac3('0x2d')],_0x318615['query']);_0x580e80[_0x0ac3('0x31')]=_[_0x0ac3('0x32')](_0x318615['model'],qs['fields'](_0x29c5a5[_0x0ac3('0x2f')][_0x0ac3('0x33')]));_0x580e80['attributes']=_0x580e80['attributes']['length']?_0x580e80['attributes']:_0x318615['model'];if(!_0x29c5a5[_0x0ac3('0x2f')][_0x0ac3('0x34')](_0x0ac3('0x35'))){_0x580e80['limit']=qs[_0x0ac3('0x1b')](_0x29c5a5['query']['limit']);_0x580e80[_0x0ac3('0x19')]=qs[_0x0ac3('0x19')](_0x29c5a5['query']['offset']);}_0x580e80[_0x0ac3('0x36')]=qs[_0x0ac3('0x37')](_0x29c5a5[_0x0ac3('0x2f')][_0x0ac3('0x37')]);_0x580e80[_0x0ac3('0x38')]=qs[_0x0ac3('0x39')](_[_0x0ac3('0x3a')](_0x29c5a5['query'],_0x318615[_0x0ac3('0x39')]),_0x416e37);if(_0x29c5a5[_0x0ac3('0x2f')][_0x0ac3('0x3b')]){_0x580e80[_0x0ac3('0x38')]=_['merge'](_0x580e80[_0x0ac3('0x38')],{'$or':[{'key':{'$like':'%'+_0x29c5a5[_0x0ac3('0x2f')][_0x0ac3('0x3b')]+'%'}},{'value':{'$like':'%'+_0x29c5a5[_0x0ac3('0x2f')][_0x0ac3('0x3b')]+'%'}}]});}_0x580e80=_['merge']({},_0x580e80,_0x29c5a5[_0x0ac3('0x3c')]);var _0xa19c44={'where':_0x580e80[_0x0ac3('0x38')]};return db[_0x0ac3('0x28')][_0x0ac3('0x1c')](_0xa19c44)[_0x0ac3('0x23')](function(_0x24fb8b){_0x20e2ca[_0x0ac3('0x1c')]=_0x24fb8b;if(_0x29c5a5[_0x0ac3('0x2f')][_0x0ac3('0x3d')]){_0x580e80[_0x0ac3('0x3e')]=[{'all':!![]}];}return db[_0x0ac3('0x28')][_0x0ac3('0x3f')](_0x580e80);})[_0x0ac3('0x23')](function(_0x31c196){_0x20e2ca[_0x0ac3('0x40')]=_0x31c196;return _0x20e2ca;})['then'](respondWithFilteredResult(_0xa8c206,_0x580e80))[_0x0ac3('0x41')](handleError(_0xa8c206,null));};exports[_0x0ac3('0x42')]=function(_0x4a94f9,_0x2558a2){var _0xb1446b={'raw':!![],'where':{'id':_0x4a94f9['params']['id']}},_0x48b912={};_0x48b912[_0x0ac3('0x2d')]=_[_0x0ac3('0x30')](db[_0x0ac3('0x28')][_0x0ac3('0x29')]);_0x48b912[_0x0ac3('0x2f')]=_[_0x0ac3('0x30')](_0x4a94f9[_0x0ac3('0x2f')]);_0x48b912[_0x0ac3('0x39')]=_[_0x0ac3('0x32')](_0x48b912[_0x0ac3('0x2d')],_0x48b912[_0x0ac3('0x2f')]);_0xb1446b[_0x0ac3('0x31')]=_[_0x0ac3('0x32')](_0x48b912[_0x0ac3('0x2d')],qs[_0x0ac3('0x33')](_0x4a94f9[_0x0ac3('0x2f')]['fields']));_0xb1446b[_0x0ac3('0x31')]=_0xb1446b[_0x0ac3('0x31')][_0x0ac3('0x43')]?_0xb1446b[_0x0ac3('0x31')]:_0x48b912['model'];if(_0x4a94f9[_0x0ac3('0x2f')][_0x0ac3('0x3d')]){_0xb1446b[_0x0ac3('0x3e')]=[{'all':!![]}];}_0xb1446b=_[_0x0ac3('0x44')]({},_0xb1446b,_0x4a94f9['options']);return db['CannedAnswer'][_0x0ac3('0x45')](_0xb1446b)['then'](handleEntityNotFound(_0x2558a2,null))[_0x0ac3('0x23')](respondWithResult(_0x2558a2,null))['catch'](handleError(_0x2558a2,null));};exports[_0x0ac3('0x46')]=function(_0x288424,_0x32d32f){if(_0x288424[_0x0ac3('0x47')]['id']){delete _0x288424['body']['id'];}return db[_0x0ac3('0x28')]['find']({'where':{'id':_0x288424[_0x0ac3('0x48')]['id']}})[_0x0ac3('0x23')](handleEntityNotFound(_0x32d32f,null))[_0x0ac3('0x23')](saveUpdates(_0x288424[_0x0ac3('0x47')],null))[_0x0ac3('0x23')](respondWithResult(_0x32d32f,null))[_0x0ac3('0x41')](handleError(_0x32d32f,null));};exports[_0x0ac3('0x20')]=function(_0x522953,_0x9ddc80){return db[_0x0ac3('0x28')][_0x0ac3('0x45')]({'where':{'id':_0x522953[_0x0ac3('0x48')]['id']}})[_0x0ac3('0x23')](handleEntityNotFound(_0x9ddc80,null))[_0x0ac3('0x23')](removeEntity(_0x9ddc80,null))[_0x0ac3('0x41')](handleError(_0x9ddc80,null));};exports['create']=function(_0x3bb0ba,_0x5e97ce){var _0x17bfd7={'key':_0x3bb0ba[_0x0ac3('0x47')][_0x0ac3('0x2c')]};if(_0x3bb0ba[_0x0ac3('0x47')][_0x0ac3('0x49')]){_0x17bfd7[_0x0ac3('0x49')]=_0x3bb0ba['body'][_0x0ac3('0x49')];}else if(_0x3bb0ba[_0x0ac3('0x47')][_0x0ac3('0x4a')]){_0x17bfd7[_0x0ac3('0x4a')]=_0x3bb0ba[_0x0ac3('0x47')][_0x0ac3('0x4a')];}else if(_0x3bb0ba['body'][_0x0ac3('0x4b')]){_0x17bfd7[_0x0ac3('0x4b')]=_0x3bb0ba[_0x0ac3('0x47')][_0x0ac3('0x4b')];}else if(_0x3bb0ba[_0x0ac3('0x47')][_0x0ac3('0x4c')]){_0x17bfd7[_0x0ac3('0x4c')]=_0x3bb0ba['body'][_0x0ac3('0x4c')];}return db[_0x0ac3('0x28')][_0x0ac3('0x45')]({'where':_0x17bfd7})[_0x0ac3('0x23')](function(_0x12b15b){if(_0x12b15b){throw new db[(_0x0ac3('0x4d'))][(_0x0ac3('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x0ac3('0x28')][_0x0ac3('0x4f')](_0x3bb0ba['body']);})[_0x0ac3('0x23')](function(_0x5d93ca){var _0xf12420=_0x3bb0ba[_0x0ac3('0x50')][_0x0ac3('0x51')]({'plain':!![]});if(!_0xf12420)throw new Error(_0x0ac3('0x52'));if(_0xf12420[_0x0ac3('0x53')]===_0x0ac3('0x50')){var _0x1d8acb=_0x5d93ca[_0x0ac3('0x51')]({'plain':!![]});return db[_0x0ac3('0x54')][_0x0ac3('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0xf12420[_0x0ac3('0x55')]},'raw':!![]})['then'](function(_0x8f15b9){if(_0x8f15b9&&_0x8f15b9[_0x0ac3('0x56')]===0x0){return db[_0x0ac3('0x22')]['create']({'name':_0x1d8acb[_0x0ac3('0x26')],'resourceId':_0x1d8acb['id'],'type':_0x8f15b9['name'],'sectionId':_0x8f15b9['id']},{})['then'](function(){return _0x5d93ca;});}else{return _0x5d93ca;}})[_0x0ac3('0x41')](function(_0x4810c9){logger[_0x0ac3('0x24')](_0x0ac3('0x57'),_0x4810c9);throw _0x4810c9;});}return _0x5d93ca;})[_0x0ac3('0x23')](respondWithResult(_0x5e97ce,0xc9))[_0x0ac3('0x41')](handleError(_0x5e97ce,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2e0e158..f947602 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 _0x8145=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2aacfc,_0x50b93f){var _0x14a1c1=function(_0x499452){while(--_0x499452){_0x2aacfc['push'](_0x2aacfc['shift']());}};_0x14a1c1(++_0x50b93f);}(_0x8145,0xdd));var _0x5814=function(_0x56ddf5,_0xaf18e8){_0x56ddf5=_0x56ddf5-0x0;var _0x10b842=_0x8145[_0x56ddf5];return _0x10b842;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5814('0x0'))(_0x5814('0x1'));var moment=require(_0x5814('0x2'));var BPromise=require(_0x5814('0x3'));var rp=require(_0x5814('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5814('0x5'));var config=require(_0x5814('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x5814('0x7')]=function(_0x4b066b,_0x2a4a5a){return _0x4b066b[_0x5814('0x8')](_0x5814('0x9'),attributes,{'tableName':_0x5814('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5814('0xb')});}; \ No newline at end of file +var _0x1442=['bluebird','path','rimraf','exports','define','tools_canned_answers','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x3a07ca,_0x40b793){var _0x3560ac=function(_0x332ad6){while(--_0x332ad6){_0x3a07ca['push'](_0x3a07ca['shift']());}};_0x3560ac(++_0x40b793);}(_0x1442,0x1b4));var _0x2144=function(_0x3d4d01,_0x27c0fa){_0x3d4d01=_0x3d4d01-0x0;var _0x2ce595=_0x1442[_0x3d4d01];return _0x2ce595;};'use strict';var _=require(_0x2144('0x0'));var util=require('util');var logger=require(_0x2144('0x1'))(_0x2144('0x2'));var moment=require(_0x2144('0x3'));var BPromise=require(_0x2144('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2144('0x5'));var rimraf=require(_0x2144('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x2144('0x7')]=function(_0x4277b9,_0x1078a7){return _0x4277b9[_0x2144('0x8')]('CannedAnswer',attributes,{'tableName':_0x2144('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2144('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 9387453..f8b9f17 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(_0x150ec5,_0x13b281){var _0x579c6f=function(_0x2e89a2){while(--_0x2e89a2){_0x150ec5['push'](_0x150ec5['shift']());}};_0x579c6f(++_0x13b281);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x58785a,_0x506ec6){var _0x2b76d9=function(_0x341041){while(--_0x341041){_0x58785a['push'](_0x58785a['shift']());}};_0x2b76d9(++_0x506ec6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 9de4478..5dd75f8 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 _0xa567=['isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get'];(function(_0x132edb,_0x54e052){var _0x294aab=function(_0x3630cf){while(--_0x3630cf){_0x132edb['push'](_0x132edb['shift']());}};_0x294aab(++_0x54e052);}(_0xa567,0x129));var _0x7a56=function(_0x37e704,_0x46171f){_0x37e704=_0x37e704-0x0;var _0x2d9754=_0xa567[_0x37e704];return _0x2d9754;};'use strict';var multer=require(_0x7a56('0x0'));var util=require(_0x7a56('0x1'));var path=require(_0x7a56('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a56('0x3'));var router=express['Router']();var fs_extra=require(_0x7a56('0x4'));var auth=require(_0x7a56('0x5'));var interaction=require(_0x7a56('0x6'));var config=require('../../config/environment');var controller=require(_0x7a56('0x7'));router[_0x7a56('0x8')]('/',auth[_0x7a56('0x9')](),controller['index']);router[_0x7a56('0x8')](_0x7a56('0xa'),auth[_0x7a56('0x9')](),controller['show']);router[_0x7a56('0xb')]('/',auth[_0x7a56('0x9')](),controller[_0x7a56('0xc')]);router['put'](_0x7a56('0xa'),auth[_0x7a56('0x9')](),controller[_0x7a56('0xd')]);router[_0x7a56('0xe')](_0x7a56('0xa'),auth[_0x7a56('0x9')](),controller[_0x7a56('0xf')]);module[_0x7a56('0x10')]=router; \ No newline at end of file +var _0x79e2=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','/:id','update','delete','destroy','exports','multer'];(function(_0x411546,_0x2c0f79){var _0x533cb6=function(_0x2b6e1b){while(--_0x2b6e1b){_0x411546['push'](_0x411546['shift']());}};_0x533cb6(++_0x2c0f79);}(_0x79e2,0x16f));var _0x279e=function(_0x18d500,_0x58f17d){_0x18d500=_0x18d500-0x0;var _0x49a468=_0x79e2[_0x18d500];return _0x49a468;};'use strict';var multer=require(_0x279e('0x0'));var util=require(_0x279e('0x1'));var path=require(_0x279e('0x2'));var timeout=require(_0x279e('0x3'));var express=require(_0x279e('0x4'));var router=express['Router']();var fs_extra=require(_0x279e('0x5'));var auth=require(_0x279e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x279e('0x7')]('/',auth[_0x279e('0x8')](),controller[_0x279e('0x9')]);router[_0x279e('0x7')]('/:id',auth[_0x279e('0x8')](),controller[_0x279e('0xa')]);router['post']('/',auth[_0x279e('0x8')](),controller['create']);router['put'](_0x279e('0xb'),auth[_0x279e('0x8')](),controller[_0x279e('0xc')]);router[_0x279e('0xd')]('/:id',auth[_0x279e('0x8')](),controller[_0x279e('0xe')]);module[_0x279e('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 7132d4d..e74d9a8 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 _0x4bcc=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x39defe,_0x6d6d59){var _0xae3d4e=function(_0x6147f6){while(--_0x6147f6){_0x39defe['push'](_0x39defe['shift']());}};_0xae3d4e(++_0x6d6d59);}(_0x4bcc,0x1a6));var _0xc4bc=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x4bcc[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0xc4bc('0x0'));module[_0xc4bc('0x1')]={'calldate':{'type':Sequelize[_0xc4bc('0x2')],'allowNull':![],'defaultValue':_0xc4bc('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xc4bc('0x4')]},'dst':{'type':Sequelize[_0xc4bc('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc4bc('0x4')]},'dstchannel':{'type':Sequelize[_0xc4bc('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc4bc('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc4bc('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xc4bc('0x4')]},'uniqueid':{'type':Sequelize[_0xc4bc('0x4')]},'linkedid':{'type':Sequelize[_0xc4bc('0x4')]},'sequence':{'type':Sequelize[_0xc4bc('0x4')]},'peeraccount':{'type':Sequelize[_0xc4bc('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xc4bc('0x4')]}}; \ No newline at end of file +var _0x0506=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0x1ec11e,_0x408b6d){var _0x1fe04e=function(_0x3125ca){while(--_0x3125ca){_0x1ec11e['push'](_0x1ec11e['shift']());}};_0x1fe04e(++_0x408b6d);}(_0x0506,0x1d1));var _0x6050=function(_0x36e4e5,_0x3f43cd){_0x36e4e5=_0x36e4e5-0x0;var _0x42f853=_0x0506[_0x36e4e5];return _0x42f853;};'use strict';var Sequelize=require(_0x6050('0x0'));module[_0x6050('0x1')]={'calldate':{'type':Sequelize[_0x6050('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x6050('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x6050('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x6050('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6050('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6050('0x3')]},'amaflags':{'type':Sequelize[_0x6050('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6050('0x3')]},'userfield':{'type':Sequelize[_0x6050('0x3')]},'uniqueid':{'type':Sequelize[_0x6050('0x3')]},'linkedid':{'type':Sequelize[_0x6050('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x6050('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x6050('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 149ff68..4792da0 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 _0x0bde=['end','json','offset','undefined','count','set','Content-Range','reject','save','then','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','Cdr','include','findAll','rows','catch','params','length','includeAll','merge','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1aebc7,_0x232d09){var _0x135896=function(_0x2815ba){while(--_0x2815ba){_0x1aebc7['push'](_0x1aebc7['shift']());}};_0x135896(++_0x232d09);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xe0bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0bd('0x1'));var jsonpatch=require(_0xe0bd('0x2'));var rp=require('request-promise');var moment=require(_0xe0bd('0x3'));var BPromise=require(_0xe0bd('0x4'));var Mustache=require(_0xe0bd('0x5'));var util=require('util');var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0bd('0xa'));var _=require(_0xe0bd('0xb'));var squel=require(_0xe0bd('0xc'));var crypto=require(_0xe0bd('0xd'));var jsforce=require(_0xe0bd('0xe'));var deskjs=require(_0xe0bd('0xf'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0x10'));var Papa=require(_0xe0bd('0x11'));var Redis=require('ioredis');var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0bd('0x14'));var logger=require('../../config/logger')(_0xe0bd('0x15'));var utils=require(_0xe0bd('0x16'));var config=require(_0xe0bd('0x17'));var licenseUtil=require(_0xe0bd('0x18'));var db=require(_0xe0bd('0x19'))['db'];function respondWithStatusCode(_0x16c3a9,_0x1905b2){_0x1905b2=_0x1905b2||0xcc;return function(_0x500a9e){if(_0x500a9e){return _0x16c3a9[_0xe0bd('0x1a')](_0x1905b2);}return _0x16c3a9[_0xe0bd('0x1b')](_0x1905b2)[_0xe0bd('0x1c')]();};}function respondWithResult(_0x5c76f1,_0x479438){_0x479438=_0x479438||0xc8;return function(_0x48afde){if(_0x48afde){return _0x5c76f1[_0xe0bd('0x1b')](_0x479438)[_0xe0bd('0x1d')](_0x48afde);}};}function respondWithFilteredResult(_0x3f5ef7,_0x3042e1){return function(_0x361429){if(_0x361429){var _0x302f5f=typeof _0x3042e1[_0xe0bd('0x1e')]===_0xe0bd('0x1f')&&typeof _0x3042e1['limit']==='undefined';var _0x2d2ba3=_0x361429[_0xe0bd('0x20')];var _0x1c4533=_0x302f5f?0x0:_0x3042e1[_0xe0bd('0x1e')];var _0xa6be32=_0x302f5f?_0x361429[_0xe0bd('0x20')]:_0x3042e1['offset']+_0x3042e1['limit'];var _0x29bd21;if(_0xa6be32>=_0x2d2ba3){_0xa6be32=_0x2d2ba3;_0x29bd21=0xc8;}else{_0x29bd21=0xce;}_0x3f5ef7[_0xe0bd('0x1b')](_0x29bd21);return _0x3f5ef7[_0xe0bd('0x21')](_0xe0bd('0x22'),_0x1c4533+'-'+_0xa6be32+'/'+_0x2d2ba3)[_0xe0bd('0x1d')](_0x361429);}return null;};}function patchUpdates(_0x154480){return function(_0x3dbd98){try{jsonpatch['apply'](_0x3dbd98,_0x154480,!![]);}catch(_0x5ad8bf){return BPromise[_0xe0bd('0x23')](_0x5ad8bf);}return _0x3dbd98[_0xe0bd('0x24')]();};}function saveUpdates(_0x3927ab,_0xdcb789){return function(_0x290c1e){if(_0x290c1e){return _0x290c1e['update'](_0x3927ab)[_0xe0bd('0x25')](function(_0x4795ac){return _0x4795ac;});}return null;};}function removeEntity(_0x242cbe,_0x296f64){return function(_0x3f24b6){if(_0x3f24b6){return _0x3f24b6['destroy']()[_0xe0bd('0x25')](function(){_0x242cbe[_0xe0bd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ca10,_0x5e6496){return function(_0x2debcb){if(!_0x2debcb){_0x41ca10['sendStatus'](0x194);}return _0x2debcb;};}function handleError(_0x198a1c,_0x72e284){_0x72e284=_0x72e284||0x1f4;return function(_0x3c851d){logger['error'](_0x3c851d[_0xe0bd('0x26')]);if(_0x3c851d['name']){delete _0x3c851d[_0xe0bd('0x27')];}_0x198a1c[_0xe0bd('0x1b')](_0x72e284)['send'](_0x3c851d);};}exports['index']=function(_0x273b95,_0x3789a1){var _0x441475={},_0x23a317={},_0x2d7f2f={'count':0x0,'rows':[]};var _0x17e614=_[_0xe0bd('0x28')](db['Cdr'][_0xe0bd('0x29')],function(_0x137206){return{'name':_0x137206[_0xe0bd('0x2a')],'type':_0x137206[_0xe0bd('0x2b')][_0xe0bd('0x2c')]};});_0x23a317[_0xe0bd('0x2d')]=_['map'](_0x17e614,_0xe0bd('0x27'));_0x23a317[_0xe0bd('0x2e')]=_[_0xe0bd('0x2f')](_0x273b95[_0xe0bd('0x2e')]);_0x23a317[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x23a317[_0xe0bd('0x2d')],_0x23a317[_0xe0bd('0x2e')]);_0x441475['attributes']=_['intersection'](_0x23a317[_0xe0bd('0x2d')],qs[_0xe0bd('0x32')](_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x32')]));_0x441475[_0xe0bd('0x33')]=_0x441475['attributes']['length']?_0x441475['attributes']:_0x23a317[_0xe0bd('0x2d')];if(!_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x34')](_0xe0bd('0x35'))){_0x441475[_0xe0bd('0x36')]=qs[_0xe0bd('0x36')](_0x273b95['query'][_0xe0bd('0x36')]);_0x441475[_0xe0bd('0x1e')]=qs[_0xe0bd('0x1e')](_0x273b95['query'][_0xe0bd('0x1e')]);}_0x441475[_0xe0bd('0x37')]=qs['sort'](_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x38')]);_0x441475[_0xe0bd('0x39')]=qs['filters'](_[_0xe0bd('0x3a')](_0x273b95['query'],_0x23a317[_0xe0bd('0x30')]),_0x17e614);if(_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x3b')]){_0x441475[_0xe0bd('0x39')]=_['merge'](_0x441475[_0xe0bd('0x39')],{'$or':_[_0xe0bd('0x28')](_0x17e614,function(_0x7f9272){if(_0x7f9272['type']!=='VIRTUAL'){var _0x23064a={};_0x23064a[_0x7f9272[_0xe0bd('0x27')]]={'$like':'%'+_0x273b95[_0xe0bd('0x2e')]['filter']+'%'};return _0x23064a;}})});}_0x441475=_['merge']({},_0x441475,_0x273b95[_0xe0bd('0x3c')]);var _0x383b08={'where':_0x441475[_0xe0bd('0x39')]};return db[_0xe0bd('0x3d')]['count'](_0x383b08)[_0xe0bd('0x25')](function(_0x23b596){_0x2d7f2f[_0xe0bd('0x20')]=_0x23b596;if(_0x273b95['query']['includeAll']){_0x441475[_0xe0bd('0x3e')]=[{'all':!![]}];}return db[_0xe0bd('0x3d')][_0xe0bd('0x3f')](_0x441475);})[_0xe0bd('0x25')](function(_0x5ada76){_0x2d7f2f[_0xe0bd('0x40')]=_0x5ada76;return _0x2d7f2f;})[_0xe0bd('0x25')](respondWithFilteredResult(_0x3789a1,_0x441475))[_0xe0bd('0x41')](handleError(_0x3789a1,null));};exports['show']=function(_0x499e16,_0x27a582){var _0x52a0af={'raw':!![],'where':{'id':_0x499e16[_0xe0bd('0x42')]['id']}},_0x24be53={};_0x24be53['model']=_[_0xe0bd('0x2f')](db[_0xe0bd('0x3d')][_0xe0bd('0x29')]);_0x24be53['query']=_[_0xe0bd('0x2f')](_0x499e16[_0xe0bd('0x2e')]);_0x24be53[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x24be53[_0xe0bd('0x2d')],_0x24be53[_0xe0bd('0x2e')]);_0x52a0af[_0xe0bd('0x33')]=_[_0xe0bd('0x31')](_0x24be53['model'],qs[_0xe0bd('0x32')](_0x499e16[_0xe0bd('0x2e')][_0xe0bd('0x32')]));_0x52a0af[_0xe0bd('0x33')]=_0x52a0af[_0xe0bd('0x33')][_0xe0bd('0x43')]?_0x52a0af[_0xe0bd('0x33')]:_0x24be53[_0xe0bd('0x2d')];if(_0x499e16['query'][_0xe0bd('0x44')]){_0x52a0af[_0xe0bd('0x3e')]=[{'all':!![]}];}_0x52a0af=_[_0xe0bd('0x45')]({},_0x52a0af,_0x499e16[_0xe0bd('0x3c')]);return db[_0xe0bd('0x3d')]['find'](_0x52a0af)[_0xe0bd('0x25')](handleEntityNotFound(_0x27a582,null))['then'](respondWithResult(_0x27a582,null))['catch'](handleError(_0x27a582,null));};exports['create']=function(_0x2d7e00,_0x55dd83){return db['Cdr'][_0xe0bd('0x46')](_0x2d7e00[_0xe0bd('0x47')],{})[_0xe0bd('0x25')](respondWithResult(_0x55dd83,0xc9))[_0xe0bd('0x41')](handleError(_0x55dd83,null));};exports[_0xe0bd('0x48')]=function(_0x220147,_0xe2b989){if(_0x220147[_0xe0bd('0x47')]['id']){delete _0x220147[_0xe0bd('0x47')]['id'];}return db[_0xe0bd('0x3d')]['find']({'where':{'id':_0x220147[_0xe0bd('0x42')]['id']}})['then'](handleEntityNotFound(_0xe2b989,null))['then'](saveUpdates(_0x220147[_0xe0bd('0x47')],null))[_0xe0bd('0x25')](respondWithResult(_0xe2b989,null))[_0xe0bd('0x41')](handleError(_0xe2b989,null));};exports['destroy']=function(_0x281a60,_0x3fe076){return db[_0xe0bd('0x3d')][_0xe0bd('0x49')]({'where':{'id':_0x281a60[_0xe0bd('0x42')]['id']}})[_0xe0bd('0x25')](handleEntityNotFound(_0x3fe076,null))[_0xe0bd('0x25')](removeEntity(_0x3fe076,null))[_0xe0bd('0x41')](handleError(_0x3fe076,null));};exports[_0xe0bd('0x4a')]=function(_0x1f85ef,_0x29c7f8){return db[_0xe0bd('0x3d')]['describe']()[_0xe0bd('0x25')](respondWithResult(_0x29c7f8,null))[_0xe0bd('0x41')](handleError(_0x29c7f8,null));}; \ No newline at end of file +var _0x3248=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service'];(function(_0x441a70,_0x129c0a){var _0x287ec9=function(_0x2078a3){while(--_0x2078a3){_0x441a70['push'](_0x441a70['shift']());}};_0x287ec9(++_0x129c0a);}(_0x3248,0x1b0));var _0x8324=function(_0x4a1465,_0x5c0eb8){_0x4a1465=_0x4a1465-0x0;var _0x4aaf0a=_0x3248[_0x4a1465];return _0x4aaf0a;};'use strict';var emlformat=require(_0x8324('0x0'));var rimraf=require(_0x8324('0x1'));var zipdir=require(_0x8324('0x2'));var jsonpatch=require(_0x8324('0x3'));var rp=require(_0x8324('0x4'));var moment=require(_0x8324('0x5'));var BPromise=require(_0x8324('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8324('0x7'));var sox=require(_0x8324('0x8'));var csv=require('to-csv');var ejs=require(_0x8324('0x9'));var fs=require('fs');var fs_extra=require(_0x8324('0xa'));var _=require(_0x8324('0xb'));var squel=require(_0x8324('0xc'));var crypto=require(_0x8324('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8324('0xe'));var toCsv=require(_0x8324('0xf'));var querystring=require(_0x8324('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8324('0x11'));var qs=require(_0x8324('0x12'));var as=require(_0x8324('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8324('0x14'))(_0x8324('0x15'));var utils=require(_0x8324('0x16'));var config=require(_0x8324('0x17'));var licenseUtil=require(_0x8324('0x18'));var db=require(_0x8324('0x19'))['db'];function respondWithStatusCode(_0x4f000e,_0x59d3b1){_0x59d3b1=_0x59d3b1||0xcc;return function(_0x55e203){if(_0x55e203){return _0x4f000e[_0x8324('0x1a')](_0x59d3b1);}return _0x4f000e['status'](_0x59d3b1)['end']();};}function respondWithResult(_0x3bb793,_0xdd6c0e){_0xdd6c0e=_0xdd6c0e||0xc8;return function(_0x13131d){if(_0x13131d){return _0x3bb793['status'](_0xdd6c0e)[_0x8324('0x1b')](_0x13131d);}};}function respondWithFilteredResult(_0x1ab2eb,_0xb94f60){return function(_0x578c0d){if(_0x578c0d){var _0x297035=typeof _0xb94f60[_0x8324('0x1c')]===_0x8324('0x1d')&&typeof _0xb94f60[_0x8324('0x1e')]===_0x8324('0x1d');var _0x3f067c=_0x578c0d['count'];var _0x4ef97c=_0x297035?0x0:_0xb94f60[_0x8324('0x1c')];var _0x404d16=_0x297035?_0x578c0d[_0x8324('0x1f')]:_0xb94f60['offset']+_0xb94f60[_0x8324('0x1e')];var _0x19a888;if(_0x404d16>=_0x3f067c){_0x404d16=_0x3f067c;_0x19a888=0xc8;}else{_0x19a888=0xce;}_0x1ab2eb[_0x8324('0x20')](_0x19a888);return _0x1ab2eb[_0x8324('0x21')](_0x8324('0x22'),_0x4ef97c+'-'+_0x404d16+'/'+_0x3f067c)['json'](_0x578c0d);}return null;};}function patchUpdates(_0xbafbed){return function(_0x5e07b5){try{jsonpatch[_0x8324('0x23')](_0x5e07b5,_0xbafbed,!![]);}catch(_0x5aba37){return BPromise[_0x8324('0x24')](_0x5aba37);}return _0x5e07b5['save']();};}function saveUpdates(_0x71f390,_0xb31584){return function(_0xb248c6){if(_0xb248c6){return _0xb248c6[_0x8324('0x25')](_0x71f390)[_0x8324('0x26')](function(_0x354842){return _0x354842;});}return null;};}function removeEntity(_0x44042f,_0x10fc10){return function(_0x2f44f0){if(_0x2f44f0){return _0x2f44f0[_0x8324('0x27')]()[_0x8324('0x26')](function(){_0x44042f[_0x8324('0x20')](0xcc)[_0x8324('0x28')]();});}};}function handleEntityNotFound(_0x38a09a,_0x3904b0){return function(_0x1fd50e){if(!_0x1fd50e){_0x38a09a[_0x8324('0x1a')](0x194);}return _0x1fd50e;};}function handleError(_0x32510a,_0x3a94fe){_0x3a94fe=_0x3a94fe||0x1f4;return function(_0x2b77e4){logger[_0x8324('0x29')](_0x2b77e4[_0x8324('0x2a')]);if(_0x2b77e4[_0x8324('0x2b')]){delete _0x2b77e4[_0x8324('0x2b')];}_0x32510a[_0x8324('0x20')](_0x3a94fe)['send'](_0x2b77e4);};}exports[_0x8324('0x2c')]=function(_0x43e43d,_0x38cae6){var _0x17bda7={},_0x4ee093={},_0x2fda80={'count':0x0,'rows':[]};var _0x268345=_[_0x8324('0x2d')](db[_0x8324('0x2e')][_0x8324('0x2f')],function(_0x7dc4c9){return{'name':_0x7dc4c9[_0x8324('0x30')],'type':_0x7dc4c9['type'][_0x8324('0x31')]};});_0x4ee093[_0x8324('0x32')]=_[_0x8324('0x2d')](_0x268345,_0x8324('0x2b'));_0x4ee093[_0x8324('0x33')]=_[_0x8324('0x34')](_0x43e43d['query']);_0x4ee093[_0x8324('0x35')]=_[_0x8324('0x36')](_0x4ee093['model'],_0x4ee093[_0x8324('0x33')]);_0x17bda7[_0x8324('0x37')]=_[_0x8324('0x36')](_0x4ee093['model'],qs[_0x8324('0x38')](_0x43e43d[_0x8324('0x33')]['fields']));_0x17bda7['attributes']=_0x17bda7[_0x8324('0x37')][_0x8324('0x39')]?_0x17bda7[_0x8324('0x37')]:_0x4ee093['model'];if(!_0x43e43d['query']['hasOwnProperty'](_0x8324('0x3a'))){_0x17bda7[_0x8324('0x1e')]=qs[_0x8324('0x1e')](_0x43e43d[_0x8324('0x33')]['limit']);_0x17bda7[_0x8324('0x1c')]=qs[_0x8324('0x1c')](_0x43e43d[_0x8324('0x33')][_0x8324('0x1c')]);}_0x17bda7['order']=qs[_0x8324('0x3b')](_0x43e43d[_0x8324('0x33')][_0x8324('0x3b')]);_0x17bda7[_0x8324('0x3c')]=qs['filters'](_[_0x8324('0x3d')](_0x43e43d[_0x8324('0x33')],_0x4ee093[_0x8324('0x35')]),_0x268345);if(_0x43e43d[_0x8324('0x33')][_0x8324('0x3e')]){_0x17bda7[_0x8324('0x3c')]=_[_0x8324('0x3f')](_0x17bda7[_0x8324('0x3c')],{'$or':_[_0x8324('0x2d')](_0x268345,function(_0x50097f){if(_0x50097f['type']!=='VIRTUAL'){var _0x127ebf={};_0x127ebf[_0x50097f[_0x8324('0x2b')]]={'$like':'%'+_0x43e43d[_0x8324('0x33')][_0x8324('0x3e')]+'%'};return _0x127ebf;}})});}_0x17bda7=_['merge']({},_0x17bda7,_0x43e43d[_0x8324('0x40')]);var _0x5f2c9d={'where':_0x17bda7[_0x8324('0x3c')]};return db[_0x8324('0x2e')]['count'](_0x5f2c9d)[_0x8324('0x26')](function(_0x21113d){_0x2fda80[_0x8324('0x1f')]=_0x21113d;if(_0x43e43d[_0x8324('0x33')][_0x8324('0x41')]){_0x17bda7[_0x8324('0x42')]=[{'all':!![]}];}return db[_0x8324('0x2e')][_0x8324('0x43')](_0x17bda7);})[_0x8324('0x26')](function(_0x145b52){_0x2fda80[_0x8324('0x44')]=_0x145b52;return _0x2fda80;})[_0x8324('0x26')](respondWithFilteredResult(_0x38cae6,_0x17bda7))[_0x8324('0x45')](handleError(_0x38cae6,null));};exports['show']=function(_0x172b4d,_0x270e95){var _0x587e4c={'raw':!![],'where':{'id':_0x172b4d['params']['id']}},_0x34506c={};_0x34506c[_0x8324('0x32')]=_['keys'](db[_0x8324('0x2e')][_0x8324('0x2f')]);_0x34506c[_0x8324('0x33')]=_[_0x8324('0x34')](_0x172b4d[_0x8324('0x33')]);_0x34506c['filters']=_['intersection'](_0x34506c[_0x8324('0x32')],_0x34506c[_0x8324('0x33')]);_0x587e4c[_0x8324('0x37')]=_[_0x8324('0x36')](_0x34506c['model'],qs[_0x8324('0x38')](_0x172b4d['query'][_0x8324('0x38')]));_0x587e4c[_0x8324('0x37')]=_0x587e4c[_0x8324('0x37')][_0x8324('0x39')]?_0x587e4c['attributes']:_0x34506c[_0x8324('0x32')];if(_0x172b4d['query'][_0x8324('0x41')]){_0x587e4c[_0x8324('0x42')]=[{'all':!![]}];}_0x587e4c=_[_0x8324('0x3f')]({},_0x587e4c,_0x172b4d[_0x8324('0x40')]);return db['Cdr'][_0x8324('0x46')](_0x587e4c)[_0x8324('0x26')](handleEntityNotFound(_0x270e95,null))[_0x8324('0x26')](respondWithResult(_0x270e95,null))['catch'](handleError(_0x270e95,null));};exports[_0x8324('0x47')]=function(_0x5a4816,_0x226e8c){return db[_0x8324('0x2e')][_0x8324('0x47')](_0x5a4816[_0x8324('0x48')],{})['then'](respondWithResult(_0x226e8c,0xc9))[_0x8324('0x45')](handleError(_0x226e8c,null));};exports[_0x8324('0x25')]=function(_0x119b8c,_0x18f459){if(_0x119b8c[_0x8324('0x48')]['id']){delete _0x119b8c['body']['id'];}return db[_0x8324('0x2e')][_0x8324('0x46')]({'where':{'id':_0x119b8c['params']['id']}})['then'](handleEntityNotFound(_0x18f459,null))[_0x8324('0x26')](saveUpdates(_0x119b8c['body'],null))['then'](respondWithResult(_0x18f459,null))[_0x8324('0x45')](handleError(_0x18f459,null));};exports[_0x8324('0x27')]=function(_0x5ded79,_0x1951e8){return db['Cdr']['find']({'where':{'id':_0x5ded79[_0x8324('0x49')]['id']}})['then'](handleEntityNotFound(_0x1951e8,null))[_0x8324('0x26')](removeEntity(_0x1951e8,null))[_0x8324('0x45')](handleError(_0x1951e8,null));};exports[_0x8324('0x4a')]=function(_0x32a8f5,_0x4c2b56){return db[_0x8324('0x2e')][_0x8324('0x4a')]()[_0x8324('0x26')](respondWithResult(_0x4c2b56,null))[_0x8324('0x45')](handleError(_0x4c2b56,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0163a75..feb9295 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(_0x5688c0,_0x74dc2c){var _0x5012fe=function(_0x4c32f3){while(--_0x4c32f3){_0x5688c0['push'](_0x5688c0['shift']());}};_0x5012fe(++_0x74dc2c);}(_0x7a54,0x106));var _0x47a5=function(_0x53fa0a,_0x4fc039){_0x53fa0a=_0x53fa0a-0x0;var _0x2a292d=_0x7a54[_0x53fa0a];return _0x2a292d;};'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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5ebc79,_0x324fe1){var _0x128373=function(_0x34d395){while(--_0x34d395){_0x5ebc79['push'](_0x5ebc79['shift']());}};_0x128373(++_0x324fe1);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index a46bb0c..ca6ffde 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 _0xa869=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x1caf3f,_0x1b4800){var _0x1905f0=function(_0x36e1eb){while(--_0x36e1eb){_0x1caf3f['push'](_0x1caf3f['shift']());}};_0x1905f0(++_0x1b4800);}(_0xa869,0x16e));var _0x9a86=function(_0x35e95b,_0x3ce613){_0x35e95b=_0x35e95b-0x0;var _0x5c7ea5=_0xa869[_0x35e95b];return _0x5c7ea5;};'use strict';var _=require(_0x9a86('0x0'));var util=require(_0x9a86('0x1'));var moment=require(_0x9a86('0x2'));var BPromise=require(_0x9a86('0x3'));var rs=require(_0x9a86('0x4'));var fs=require('fs');var Redis=require(_0x9a86('0x5'));var db=require(_0x9a86('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9a86('0x7'));var client=jayson[_0x9a86('0x8')][_0x9a86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x179bfb,_0x5028b1,_0x597094){return new BPromise(function(_0x4f4ab3,_0x46007a){return client[_0x9a86('0xa')](_0x179bfb,_0x597094)[_0x9a86('0xb')](function(_0xa94e97){logger['info'](_0x9a86('0xc'),_0x5028b1,_0x9a86('0xd'));logger['debug'](_0x9a86('0xe'),_0x5028b1,_0x9a86('0xd'),JSON[_0x9a86('0xf')](_0xa94e97));if(_0xa94e97[_0x9a86('0x10')]){if(_0xa94e97[_0x9a86('0x10')]['code']===0x1f4){logger[_0x9a86('0x10')]('Cdr,\x20%s,\x20%s',_0x5028b1,_0xa94e97[_0x9a86('0x10')]['message']);return _0x46007a(_0xa94e97[_0x9a86('0x10')]['message']);}logger[_0x9a86('0x10')](_0x9a86('0xc'),_0x5028b1,_0xa94e97[_0x9a86('0x10')]['message']);return _0x4f4ab3(_0xa94e97[_0x9a86('0x10')]['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x5028b1,_0x9a86('0xd'));_0x4f4ab3(_0xa94e97[_0x9a86('0x11')][_0x9a86('0x12')]);}})[_0x9a86('0x13')](function(_0x496a59){logger['error'](_0x9a86('0xc'),_0x5028b1,_0x496a59);_0x46007a(_0x496a59);});});} \ No newline at end of file +var _0x3fe7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x10b138,_0x245e8b){var _0x1668a4=function(_0x2da0c5){while(--_0x2da0c5){_0x10b138['push'](_0x10b138['shift']());}};_0x1668a4(++_0x245e8b);}(_0x3fe7,0x141));var _0x73fe=function(_0x57b3df,_0x445081){_0x57b3df=_0x57b3df-0x0;var _0x206656=_0x3fe7[_0x57b3df];return _0x206656;};'use strict';var _=require(_0x73fe('0x0'));var util=require(_0x73fe('0x1'));var moment=require(_0x73fe('0x2'));var BPromise=require(_0x73fe('0x3'));var rs=require(_0x73fe('0x4'));var fs=require('fs');var Redis=require(_0x73fe('0x5'));var db=require(_0x73fe('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x73fe('0x7'));var config=require(_0x73fe('0x8'));var jayson=require(_0x73fe('0x9'));var client=jayson['client'][_0x73fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b37fd,_0x34a63,_0x1d1a42){return new BPromise(function(_0x1d801e,_0x4206ef){return client[_0x73fe('0xb')](_0x4b37fd,_0x1d1a42)[_0x73fe('0xc')](function(_0x3c8aa0){logger[_0x73fe('0xd')](_0x73fe('0xe'),_0x34a63,_0x73fe('0xf'));logger[_0x73fe('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x34a63,_0x73fe('0xf'),JSON[_0x73fe('0x11')](_0x3c8aa0));if(_0x3c8aa0[_0x73fe('0x12')]){if(_0x3c8aa0['error'][_0x73fe('0x13')]===0x1f4){logger[_0x73fe('0x12')]('Cdr,\x20%s,\x20%s',_0x34a63,_0x3c8aa0[_0x73fe('0x12')]['message']);return _0x4206ef(_0x3c8aa0['error'][_0x73fe('0x14')]);}logger[_0x73fe('0x12')]('Cdr,\x20%s,\x20%s',_0x34a63,_0x3c8aa0[_0x73fe('0x12')][_0x73fe('0x14')]);return _0x1d801e(_0x3c8aa0[_0x73fe('0x12')]['message']);}else{logger[_0x73fe('0xd')](_0x73fe('0xe'),_0x34a63,_0x73fe('0xf'));_0x1d801e(_0x3c8aa0[_0x73fe('0x15')][_0x73fe('0x14')]);}})[_0x73fe('0x16')](function(_0x7b73af){logger[_0x73fe('0x12')](_0x73fe('0xe'),_0x34a63,_0x7b73af);_0x4206ef(_0x7b73af);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6f3c153..89e4dc4 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(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 _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(_0x324e58,_0x5667bf){var _0x41bda1=function(_0x370b04){while(--_0x370b04){_0x324e58['push'](_0x324e58['shift']());}};_0x41bda1(++_0x5667bf);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a091230..52ed1dd 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 _0x47f6=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0x47f6,0x1d9));var _0x647f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47f6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x647f('0x0'));module[_0x647f('0x1')]={'priority':{'type':Sequelize[_0x647f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x647f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x647f('0x4')]()},'description':{'type':Sequelize[_0x647f('0x3')]},'interval':{'type':Sequelize[_0x647f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd428=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x1948e6,_0x4e7a65){var _0x2d0192=function(_0x3eaf8e){while(--_0x3eaf8e){_0x1948e6['push'](_0x1948e6['shift']());}};_0x2d0192(++_0x4e7a65);}(_0xd428,0x16f));var _0x8d42=function(_0x86cc9,_0x1e619f){_0x86cc9=_0x86cc9-0x0;var _0x11c499=_0xd428[_0x86cc9];return _0x11c499;};'use strict';var Sequelize=require(_0x8d42('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8d42('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8d42('0x2')],'allowNull':![],'defaultValue':_0x8d42('0x3')},'appdata':{'type':Sequelize[_0x8d42('0x4')]()},'description':{'type':Sequelize[_0x8d42('0x2')]},'interval':{'type':Sequelize[_0x8d42('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 dd22cb7..6616892 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 _0x2f3a=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','name','show','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','length','include','find','catch','params','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2cbba2,_0x790d0c){var _0x2dc93c=function(_0x120c82){while(--_0x120c82){_0x2cbba2['push'](_0x2cbba2['shift']());}};_0x2dc93c(++_0x790d0c);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x5dda31,_0x5555ef){_0x5dda31=_0x5dda31-0x0;var _0x4e5b19=_0x2f3a[_0x5dda31];return _0x4e5b19;};'use strict';var emlformat=require(_0xa2f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa2f3('0x1'));var rp=require(_0xa2f3('0x2'));var moment=require(_0xa2f3('0x3'));var BPromise=require(_0xa2f3('0x4'));var Mustache=require(_0xa2f3('0x5'));var util=require(_0xa2f3('0x6'));var path=require('path');var sox=require(_0xa2f3('0x7'));var csv=require('to-csv');var ejs=require(_0xa2f3('0x8'));var fs=require('fs');var fs_extra=require(_0xa2f3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2f3('0xa'));var jsforce=require(_0xa2f3('0xb'));var deskjs=require(_0xa2f3('0xc'));var toCsv=require(_0xa2f3('0xd'));var querystring=require('querystring');var Papa=require(_0xa2f3('0xe'));var Redis=require(_0xa2f3('0xf'));var authService=require(_0xa2f3('0x10'));var qs=require(_0xa2f3('0x11'));var as=require(_0xa2f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2f3('0x13'))(_0xa2f3('0x14'));var utils=require('../../config/utils');var config=require(_0xa2f3('0x15'));var licenseUtil=require(_0xa2f3('0x16'));var db=require(_0xa2f3('0x17'))['db'];function respondWithStatusCode(_0x58f6df,_0x6aa8f2){_0x6aa8f2=_0x6aa8f2||0xcc;return function(_0x194281){if(_0x194281){return _0x58f6df[_0xa2f3('0x18')](_0x6aa8f2);}return _0x58f6df[_0xa2f3('0x19')](_0x6aa8f2)[_0xa2f3('0x1a')]();};}function respondWithResult(_0xd4f9db,_0x3907fe){_0x3907fe=_0x3907fe||0xc8;return function(_0x4544d4){if(_0x4544d4){return _0xd4f9db[_0xa2f3('0x19')](_0x3907fe)['json'](_0x4544d4);}};}function respondWithFilteredResult(_0xdc3967,_0x33bf10){return function(_0x74fb58){if(_0x74fb58){var _0x51d297=typeof _0x33bf10[_0xa2f3('0x1b')]===_0xa2f3('0x1c')&&typeof _0x33bf10['limit']==='undefined';var _0xb1fe06=_0x74fb58[_0xa2f3('0x1d')];var _0x2db0d2=_0x51d297?0x0:_0x33bf10[_0xa2f3('0x1b')];var _0x205578=_0x51d297?_0x74fb58[_0xa2f3('0x1d')]:_0x33bf10[_0xa2f3('0x1b')]+_0x33bf10[_0xa2f3('0x1e')];var _0x550d68;if(_0x205578>=_0xb1fe06){_0x205578=_0xb1fe06;_0x550d68=0xc8;}else{_0x550d68=0xce;}_0xdc3967[_0xa2f3('0x19')](_0x550d68);return _0xdc3967[_0xa2f3('0x1f')]('Content-Range',_0x2db0d2+'-'+_0x205578+'/'+_0xb1fe06)['json'](_0x74fb58);}return null;};}function patchUpdates(_0x2f74a0){return function(_0x53af81){try{jsonpatch[_0xa2f3('0x20')](_0x53af81,_0x2f74a0,!![]);}catch(_0x147fb7){return BPromise['reject'](_0x147fb7);}return _0x53af81[_0xa2f3('0x21')]();};}function saveUpdates(_0x3e055d,_0x14d989){return function(_0x2685bb){if(_0x2685bb){return _0x2685bb[_0xa2f3('0x22')](_0x3e055d)[_0xa2f3('0x23')](function(_0x37f8c2){return _0x37f8c2;});}return null;};}function removeEntity(_0xa02908,_0x49a589){return function(_0x81af9b){if(_0x81af9b){return _0x81af9b[_0xa2f3('0x24')]()[_0xa2f3('0x23')](function(){_0xa02908[_0xa2f3('0x19')](0xcc)[_0xa2f3('0x1a')]();});}};}function handleEntityNotFound(_0x2e6332,_0x1be0c1){return function(_0x5347de){if(!_0x5347de){_0x2e6332['sendStatus'](0x194);}return _0x5347de;};}function handleError(_0x2f4248,_0x4319f3){_0x4319f3=_0x4319f3||0x1f4;return function(_0x1dd4ec){logger[_0xa2f3('0x25')](_0x1dd4ec['stack']);if(_0x1dd4ec[_0xa2f3('0x26')]){delete _0x1dd4ec[_0xa2f3('0x26')];}_0x2f4248[_0xa2f3('0x19')](_0x4319f3)['send'](_0x1dd4ec);};}exports[_0xa2f3('0x27')]=function(_0x4ec4ab,_0x1ceea4){var _0x5b868c={'raw':!![],'where':{'id':_0x4ec4ab['params']['id']}},_0x452142={};_0x452142[_0xa2f3('0x28')]=_['keys'](db[_0xa2f3('0x29')][_0xa2f3('0x2a')]);_0x452142[_0xa2f3('0x2b')]=_[_0xa2f3('0x2c')](_0x4ec4ab[_0xa2f3('0x2b')]);_0x452142['filters']=_[_0xa2f3('0x2d')](_0x452142[_0xa2f3('0x28')],_0x452142[_0xa2f3('0x2b')]);_0x5b868c[_0xa2f3('0x2e')]=_[_0xa2f3('0x2d')](_0x452142[_0xa2f3('0x28')],qs[_0xa2f3('0x2f')](_0x4ec4ab[_0xa2f3('0x2b')][_0xa2f3('0x2f')]));_0x5b868c['attributes']=_0x5b868c[_0xa2f3('0x2e')][_0xa2f3('0x30')]?_0x5b868c[_0xa2f3('0x2e')]:_0x452142[_0xa2f3('0x28')];if(_0x4ec4ab[_0xa2f3('0x2b')]['includeAll']){_0x5b868c[_0xa2f3('0x31')]=[{'all':!![]}];}_0x5b868c=_['merge']({},_0x5b868c,_0x4ec4ab['options']);return db[_0xa2f3('0x29')][_0xa2f3('0x32')](_0x5b868c)['then'](handleEntityNotFound(_0x1ceea4,null))[_0xa2f3('0x23')](respondWithResult(_0x1ceea4,null))[_0xa2f3('0x33')](handleError(_0x1ceea4,null));};exports['update']=function(_0x386f66,_0x3cb618){if(_0x386f66['body']['id']){delete _0x386f66['body']['id'];}return db[_0xa2f3('0x29')][_0xa2f3('0x32')]({'where':{'id':_0x386f66[_0xa2f3('0x34')]['id']}})[_0xa2f3('0x23')](handleEntityNotFound(_0x3cb618,null))['then'](saveUpdates(_0x386f66[_0xa2f3('0x35')],null))['then'](respondWithResult(_0x3cb618,null))[_0xa2f3('0x33')](handleError(_0x3cb618,null));};exports['destroy']=function(_0x5ac995,_0x37cd82){return db[_0xa2f3('0x29')]['find']({'where':{'id':_0x5ac995[_0xa2f3('0x34')]['id']}})['then'](handleEntityNotFound(_0x37cd82,null))[_0xa2f3('0x23')](removeEntity(_0x37cd82,null))[_0xa2f3('0x33')](handleError(_0x37cd82,null));}; \ No newline at end of file +var _0x657b=['save','update','then','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','options','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x4d9e51,_0xd04690){var _0x45bfd1=function(_0x48011b){while(--_0x48011b){_0x4d9e51['push'](_0x4d9e51['shift']());}};_0x45bfd1(++_0xd04690);}(_0x657b,0x131));var _0xb657=function(_0x51ec8f,_0x3eb5df){_0x51ec8f=_0x51ec8f-0x0;var _0x2f3aa9=_0x657b[_0x51ec8f];return _0x2f3aa9;};'use strict';var emlformat=require(_0xb657('0x0'));var rimraf=require(_0xb657('0x1'));var zipdir=require(_0xb657('0x2'));var jsonpatch=require(_0xb657('0x3'));var rp=require(_0xb657('0x4'));var moment=require('moment');var BPromise=require(_0xb657('0x5'));var Mustache=require(_0xb657('0x6'));var util=require('util');var path=require(_0xb657('0x7'));var sox=require(_0xb657('0x8'));var csv=require(_0xb657('0x9'));var ejs=require(_0xb657('0xa'));var fs=require('fs');var fs_extra=require(_0xb657('0xb'));var _=require('lodash');var squel=require(_0xb657('0xc'));var crypto=require('crypto');var jsforce=require(_0xb657('0xd'));var deskjs=require(_0xb657('0xe'));var toCsv=require(_0xb657('0x9'));var querystring=require('querystring');var Papa=require(_0xb657('0xf'));var Redis=require('ioredis');var authService=require(_0xb657('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb657('0x11'));var hardwareService=require(_0xb657('0x12'));var logger=require(_0xb657('0x13'))('api');var utils=require(_0xb657('0x14'));var config=require(_0xb657('0x15'));var licenseUtil=require(_0xb657('0x16'));var db=require(_0xb657('0x17'))['db'];function respondWithStatusCode(_0x51228b,_0x3e1ea1){_0x3e1ea1=_0x3e1ea1||0xcc;return function(_0x3ebcc2){if(_0x3ebcc2){return _0x51228b['sendStatus'](_0x3e1ea1);}return _0x51228b[_0xb657('0x18')](_0x3e1ea1)[_0xb657('0x19')]();};}function respondWithResult(_0xf04de9,_0x3ca0b4){_0x3ca0b4=_0x3ca0b4||0xc8;return function(_0x4aedb7){if(_0x4aedb7){return _0xf04de9[_0xb657('0x18')](_0x3ca0b4)[_0xb657('0x1a')](_0x4aedb7);}};}function respondWithFilteredResult(_0x511057,_0x4d253b){return function(_0x144eaf){if(_0x144eaf){var _0xbde891=typeof _0x4d253b[_0xb657('0x1b')]===_0xb657('0x1c')&&typeof _0x4d253b[_0xb657('0x1d')]===_0xb657('0x1c');var _0x20919b=_0x144eaf[_0xb657('0x1e')];var _0x9e98be=_0xbde891?0x0:_0x4d253b[_0xb657('0x1b')];var _0x2f0ba0=_0xbde891?_0x144eaf['count']:_0x4d253b[_0xb657('0x1b')]+_0x4d253b[_0xb657('0x1d')];var _0x21474b;if(_0x2f0ba0>=_0x20919b){_0x2f0ba0=_0x20919b;_0x21474b=0xc8;}else{_0x21474b=0xce;}_0x511057[_0xb657('0x18')](_0x21474b);return _0x511057['set']('Content-Range',_0x9e98be+'-'+_0x2f0ba0+'/'+_0x20919b)[_0xb657('0x1a')](_0x144eaf);}return null;};}function patchUpdates(_0x926b57){return function(_0xee3c7e){try{jsonpatch['apply'](_0xee3c7e,_0x926b57,!![]);}catch(_0x19f1e9){return BPromise['reject'](_0x19f1e9);}return _0xee3c7e[_0xb657('0x1f')]();};}function saveUpdates(_0x466a42,_0x2895ab){return function(_0x12fd7d){if(_0x12fd7d){return _0x12fd7d[_0xb657('0x20')](_0x466a42)['then'](function(_0x3de4eb){return _0x3de4eb;});}return null;};}function removeEntity(_0x13cea8,_0x38b4a0){return function(_0xfdd680){if(_0xfdd680){return _0xfdd680['destroy']()[_0xb657('0x21')](function(){_0x13cea8['status'](0xcc)[_0xb657('0x19')]();});}};}function handleEntityNotFound(_0x4e8587,_0x221794){return function(_0x4fe1c5){if(!_0x4fe1c5){_0x4e8587[_0xb657('0x22')](0x194);}return _0x4fe1c5;};}function handleError(_0x154f83,_0x5d4b01){_0x5d4b01=_0x5d4b01||0x1f4;return function(_0x241301){logger[_0xb657('0x23')](_0x241301[_0xb657('0x24')]);if(_0x241301['name']){delete _0x241301[_0xb657('0x25')];}_0x154f83[_0xb657('0x18')](_0x5d4b01)[_0xb657('0x26')](_0x241301);};}exports[_0xb657('0x27')]=function(_0x37a5af,_0xba9c05){var _0x66d5af={'raw':!![],'where':{'id':_0x37a5af[_0xb657('0x28')]['id']}},_0x3be5de={};_0x3be5de[_0xb657('0x29')]=_[_0xb657('0x2a')](db[_0xb657('0x2b')][_0xb657('0x2c')]);_0x3be5de[_0xb657('0x2d')]=_[_0xb657('0x2a')](_0x37a5af[_0xb657('0x2d')]);_0x3be5de[_0xb657('0x2e')]=_['intersection'](_0x3be5de[_0xb657('0x29')],_0x3be5de['query']);_0x66d5af[_0xb657('0x2f')]=_[_0xb657('0x30')](_0x3be5de['model'],qs[_0xb657('0x31')](_0x37a5af[_0xb657('0x2d')][_0xb657('0x31')]));_0x66d5af[_0xb657('0x2f')]=_0x66d5af[_0xb657('0x2f')]['length']?_0x66d5af[_0xb657('0x2f')]:_0x3be5de[_0xb657('0x29')];if(_0x37a5af[_0xb657('0x2d')][_0xb657('0x32')]){_0x66d5af[_0xb657('0x33')]=[{'all':!![]}];}_0x66d5af=_['merge']({},_0x66d5af,_0x37a5af[_0xb657('0x34')]);return db[_0xb657('0x2b')][_0xb657('0x35')](_0x66d5af)['then'](handleEntityNotFound(_0xba9c05,null))[_0xb657('0x21')](respondWithResult(_0xba9c05,null))['catch'](handleError(_0xba9c05,null));};exports[_0xb657('0x20')]=function(_0x461f65,_0x14021f){if(_0x461f65[_0xb657('0x36')]['id']){delete _0x461f65[_0xb657('0x36')]['id'];}return db[_0xb657('0x2b')][_0xb657('0x35')]({'where':{'id':_0x461f65[_0xb657('0x28')]['id']}})[_0xb657('0x21')](handleEntityNotFound(_0x14021f,null))[_0xb657('0x21')](saveUpdates(_0x461f65[_0xb657('0x36')],null))['then'](respondWithResult(_0x14021f,null))['catch'](handleError(_0x14021f,null));};exports[_0xb657('0x37')]=function(_0x1878e5,_0x22f93b){return db[_0xb657('0x2b')][_0xb657('0x35')]({'where':{'id':_0x1878e5[_0xb657('0x28')]['id']}})['then'](handleEntityNotFound(_0x22f93b,null))[_0xb657('0x21')](removeEntity(_0x22f93b,null))['catch'](handleError(_0x22f93b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a217072..2e52418 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 _0x5997=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','exports','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x488b4d,_0x233540){var _0x51ee8f=function(_0x166556){while(--_0x166556){_0x488b4d['push'](_0x488b4d['shift']());}};_0x51ee8f(++_0x233540);}(_0x5997,0x6d));var _0x7599=function(_0x1ece77,_0x1291e2){_0x1ece77=_0x1ece77-0x0;var _0x5973b3=_0x5997[_0x1ece77];return _0x5973b3;};'use strict';var _=require(_0x7599('0x0'));var util=require('util');var logger=require(_0x7599('0x1'))('api');var moment=require(_0x7599('0x2'));var BPromise=require('bluebird');var rp=require(_0x7599('0x3'));var fs=require('fs');var path=require(_0x7599('0x4'));var rimraf=require(_0x7599('0x5'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x7599('0x6')]=function(_0x33ddec,_0x5c99f4){return _0x33ddec[_0x7599('0x7')](_0x7599('0x8'),attributes,{'tableName':_0x7599('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7599('0xa'),'collate':_0x7599('0xb')});}; \ No newline at end of file +var _0xdfaa=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x3428d1,_0x3631ff){var _0x510ece=function(_0x263760){while(--_0x263760){_0x3428d1['push'](_0x3428d1['shift']());}};_0x510ece(++_0x3631ff);}(_0xdfaa,0x14a));var _0xadfa=function(_0x12a893,_0x34bdd9){_0x12a893=_0x12a893-0x0;var _0xf1f8e3=_0xdfaa[_0x12a893];return _0xf1f8e3;};'use strict';var _=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var logger=require(_0xadfa('0x2'))(_0xadfa('0x3'));var moment=require(_0xadfa('0x4'));var BPromise=require('bluebird');var rp=require(_0xadfa('0x5'));var fs=require('fs');var path=require(_0xadfa('0x6'));var rimraf=require(_0xadfa('0x7'));var config=require(_0xadfa('0x8'));var attributes=require(_0xadfa('0x9'));module[_0xadfa('0xa')]=function(_0x1c2ae4,_0x1c9e2a){return _0x1c2ae4[_0xadfa('0xb')](_0xadfa('0xc'),attributes,{'tableName':_0xadfa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xadfa('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 731005d..b3fc373 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 _0x187e=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1d0ea0,_0x9c7ccf){var _0x3bdb2d=function(_0x339b69){while(--_0x339b69){_0x1d0ea0['push'](_0x1d0ea0['shift']());}};_0x3bdb2d(++_0x9c7ccf);}(_0x187e,0x191));var _0xe187=function(_0x3f3d98,_0x274f73){_0x3f3d98=_0x3f3d98-0x0;var _0x1556b9=_0x187e[_0x3f3d98];return _0x1556b9;};'use strict';var _=require(_0xe187('0x0'));var util=require(_0xe187('0x1'));var moment=require('moment');var BPromise=require(_0xe187('0x2'));var rs=require(_0xe187('0x3'));var fs=require('fs');var Redis=require(_0xe187('0x4'));var db=require(_0xe187('0x5'))['db'];var utils=require(_0xe187('0x6'));var logger=require('../../config/logger')(_0xe187('0x7'));var config=require(_0xe187('0x8'));var jayson=require(_0xe187('0x9'));var client=jayson[_0xe187('0xa')][_0xe187('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14c2d9,_0x1963c1,_0xc2452a){return new BPromise(function(_0xc3f1d2,_0x202565){return client[_0xe187('0xc')](_0x14c2d9,_0xc2452a)[_0xe187('0xd')](function(_0x47b284){logger[_0xe187('0xe')](_0xe187('0xf'),_0x1963c1,_0xe187('0x10'));logger['debug'](_0xe187('0x11'),_0x1963c1,'request\x20sent',JSON[_0xe187('0x12')](_0x47b284));if(_0x47b284[_0xe187('0x13')]){if(_0x47b284[_0xe187('0x13')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x1963c1,_0x47b284[_0xe187('0x13')]['message']);return _0x202565(_0x47b284['error']['message']);}logger['error'](_0xe187('0xf'),_0x1963c1,_0x47b284['error'][_0xe187('0x14')]);return _0xc3f1d2(_0x47b284[_0xe187('0x13')][_0xe187('0x14')]);}else{logger[_0xe187('0xe')](_0xe187('0xf'),_0x1963c1,_0xe187('0x10'));_0xc3f1d2(_0x47b284[_0xe187('0x15')][_0xe187('0x14')]);}})[_0xe187('0x16')](function(_0x78b2d2){logger[_0xe187('0x13')](_0xe187('0xf'),_0x1963c1,_0x78b2d2);_0x202565(_0x78b2d2);});});} \ No newline at end of file +var _0x75d7=['debug','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatApplication,\x20%s,\x20%s'];(function(_0x42d678,_0x358094){var _0x3c59f1=function(_0x49f94e){while(--_0x49f94e){_0x42d678['push'](_0x42d678['shift']());}};_0x3c59f1(++_0x358094);}(_0x75d7,0x85));var _0x775d=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x75d7[_0x3358ba];return _0x296e73;};'use strict';var _=require(_0x775d('0x0'));var util=require(_0x775d('0x1'));var moment=require(_0x775d('0x2'));var BPromise=require(_0x775d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x775d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x775d('0x5'));var logger=require(_0x775d('0x6'))(_0x775d('0x7'));var config=require(_0x775d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x775d('0x9')][_0x775d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c38d3,_0x54998d,_0x433364){return new BPromise(function(_0x23cd67,_0x344905){return client['request'](_0x1c38d3,_0x433364)[_0x775d('0xb')](function(_0x4474b4){logger[_0x775d('0xc')](_0x775d('0xd'),_0x54998d,'request\x20sent');logger[_0x775d('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x54998d,'request\x20sent',JSON['stringify'](_0x4474b4));if(_0x4474b4['error']){if(_0x4474b4[_0x775d('0xf')][_0x775d('0x10')]===0x1f4){logger[_0x775d('0xf')](_0x775d('0xd'),_0x54998d,_0x4474b4[_0x775d('0xf')][_0x775d('0x11')]);return _0x344905(_0x4474b4['error'][_0x775d('0x11')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x54998d,_0x4474b4[_0x775d('0xf')][_0x775d('0x11')]);return _0x23cd67(_0x4474b4[_0x775d('0xf')]['message']);}else{logger['info'](_0x775d('0xd'),_0x54998d,_0x775d('0x12'));_0x23cd67(_0x4474b4[_0x775d('0x13')]['message']);}})[_0x775d('0x14')](function(_0xdc03a9){logger[_0x775d('0xf')](_0x775d('0xd'),_0x54998d,_0xdc03a9);_0x344905(_0xdc03a9);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f72432a..71f4b16 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 _0x8858=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete'];(function(_0x1e1af0,_0x5abc3c){var _0x3d161d=function(_0x2c2df0){while(--_0x2c2df0){_0x1e1af0['push'](_0x1e1af0['shift']());}};_0x3d161d(++_0x5abc3c);}(_0x8858,0x172));var _0x8885=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x8858[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x8885('0x0'));var util=require(_0x8885('0x1'));var path=require(_0x8885('0x2'));var timeout=require(_0x8885('0x3'));var express=require('express');var router=express[_0x8885('0x4')]();var fs_extra=require(_0x8885('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8885('0x6'));var config=require('../../config/environment');var controller=require(_0x8885('0x7'));router[_0x8885('0x8')](_0x8885('0x9'),auth[_0x8885('0xa')](),controller['show']);router[_0x8885('0xb')](_0x8885('0x9'),auth[_0x8885('0xa')](),controller[_0x8885('0xc')]);router[_0x8885('0xd')](_0x8885('0x9'),auth['isAuthenticated'](),controller[_0x8885('0xe')]);module[_0x8885('0xf')]=router; \ No newline at end of file +var _0x49db=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','destroy'];(function(_0xca78f1,_0x2c90c8){var _0xda435e=function(_0x375d7a){while(--_0x375d7a){_0xca78f1['push'](_0xca78f1['shift']());}};_0xda435e(++_0x2c90c8);}(_0x49db,0xa9));var _0xb49d=function(_0x5dfa21,_0x313b78){_0x5dfa21=_0x5dfa21-0x0;var _0x3fdd5d=_0x49db[_0x5dfa21];return _0x3fdd5d;};'use strict';var multer=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var path=require('path');var timeout=require(_0xb49d('0x2'));var express=require('express');var router=express[_0xb49d('0x3')]();var fs_extra=require(_0xb49d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb49d('0x5'));var config=require('../../config/environment');var controller=require(_0xb49d('0x6'));router[_0xb49d('0x7')](_0xb49d('0x8'),auth[_0xb49d('0x9')](),controller[_0xb49d('0xa')]);router[_0xb49d('0xb')](_0xb49d('0x8'),auth[_0xb49d('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb49d('0xc')]);module[_0xb49d('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 590a2d0..66b339d 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 _0x00a5=['sequelize','BOOLEAN'];(function(_0x541763,_0x4ad935){var _0x39ad32=function(_0x17fca9){while(--_0x17fca9){_0x541763['push'](_0x541763['shift']());}};_0x39ad32(++_0x4ad935);}(_0x00a5,0x19e));var _0x500a=function(_0x41cbbb,_0x1c634b){_0x41cbbb=_0x41cbbb-0x0;var _0x4a7e12=_0x00a5[_0x41cbbb];return _0x4a7e12;};'use strict';var Sequelize=require(_0x500a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x500a('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbeba=['sequelize','exports','STRING','BOOLEAN'];(function(_0x26a400,_0x18cc0e){var _0x386829=function(_0x2a1e40){while(--_0x2a1e40){_0x26a400['push'](_0x26a400['shift']());}};_0x386829(++_0x18cc0e);}(_0xbeba,0x64));var _0xabeb=function(_0x1fe4db,_0x4c23de){_0x1fe4db=_0x1fe4db-0x0;var _0x5bc637=_0xbeba[_0x1fe4db];return _0x5bc637;};'use strict';var Sequelize=require(_0xabeb('0x0'));module[_0xabeb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xabeb('0x2')]},'write':{'type':Sequelize[_0xabeb('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 c443b9a..2f55f8b 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 _0x28bd=['find','create','body','update','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','filter','options','nolimit','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','offset','undefined','count','limit','set','Content-Range','json','then','destroy','error','name','index','map','ChatGroup','rawAttributes','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0xc52ab0,_0x357144){var _0x5d7827=function(_0x10103e){while(--_0x10103e){_0xc52ab0['push'](_0xc52ab0['shift']());}};_0x5d7827(++_0x357144);}(_0x28bd,0x75));var _0xd28b=function(_0x957f74,_0x687fe1){_0x957f74=_0x957f74-0x0;var _0x45347a=_0x28bd[_0x957f74];return _0x45347a;};'use strict';var emlformat=require(_0xd28b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd28b('0x1'));var moment=require(_0xd28b('0x2'));var BPromise=require(_0xd28b('0x3'));var Mustache=require(_0xd28b('0x4'));var util=require(_0xd28b('0x5'));var path=require(_0xd28b('0x6'));var sox=require(_0xd28b('0x7'));var csv=require(_0xd28b('0x8'));var ejs=require(_0xd28b('0x9'));var fs=require('fs');var fs_extra=require(_0xd28b('0xa'));var _=require(_0xd28b('0xb'));var squel=require(_0xd28b('0xc'));var crypto=require(_0xd28b('0xd'));var jsforce=require(_0xd28b('0xe'));var deskjs=require(_0xd28b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd28b('0x10'));var qs=require(_0xd28b('0x11'));var as=require(_0xd28b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd28b('0x13'))('api');var utils=require(_0xd28b('0x14'));var config=require(_0xd28b('0x15'));var licenseUtil=require(_0xd28b('0x16'));var db=require('../../mysqldb')['db'];config[_0xd28b('0x17')]=_[_0xd28b('0x18')](config[_0xd28b('0x17')],{'host':_0xd28b('0x19'),'port':0x18eb});var socket=require(_0xd28b('0x1a'))(new Redis(config[_0xd28b('0x17')]));require(_0xd28b('0x1b'))[_0xd28b('0x1c')](socket);function respondWithStatusCode(_0x27a8f0,_0x2fc7a8){_0x2fc7a8=_0x2fc7a8||0xcc;return function(_0x511bd2){if(_0x511bd2){return _0x27a8f0['sendStatus'](_0x2fc7a8);}return _0x27a8f0[_0xd28b('0x1d')](_0x2fc7a8)[_0xd28b('0x1e')]();};}function respondWithResult(_0x3eb597,_0xef3923){_0xef3923=_0xef3923||0xc8;return function(_0x4385b7){if(_0x4385b7){return _0x3eb597[_0xd28b('0x1d')](_0xef3923)['json'](_0x4385b7);}};}function respondWithFilteredResult(_0x4c54b0,_0x564a6e){return function(_0x330d7b){if(_0x330d7b){var _0x25de3d=typeof _0x564a6e[_0xd28b('0x1f')]===_0xd28b('0x20')&&typeof _0x564a6e['limit']===_0xd28b('0x20');var _0x36e315=_0x330d7b[_0xd28b('0x21')];var _0x22b5cb=_0x25de3d?0x0:_0x564a6e[_0xd28b('0x1f')];var _0xc4f2a6=_0x25de3d?_0x330d7b[_0xd28b('0x21')]:_0x564a6e['offset']+_0x564a6e[_0xd28b('0x22')];var _0x3eb6eb;if(_0xc4f2a6>=_0x36e315){_0xc4f2a6=_0x36e315;_0x3eb6eb=0xc8;}else{_0x3eb6eb=0xce;}_0x4c54b0[_0xd28b('0x1d')](_0x3eb6eb);return _0x4c54b0[_0xd28b('0x23')](_0xd28b('0x24'),_0x22b5cb+'-'+_0xc4f2a6+'/'+_0x36e315)[_0xd28b('0x25')](_0x330d7b);}return null;};}function patchUpdates(_0x2cb3c4){return function(_0x56267a){try{jsonpatch['apply'](_0x56267a,_0x2cb3c4,!![]);}catch(_0xaf6bb8){return BPromise['reject'](_0xaf6bb8);}return _0x56267a['save']();};}function saveUpdates(_0x462bb5,_0x39c89f){return function(_0x44e0a7){if(_0x44e0a7){return _0x44e0a7['update'](_0x462bb5)[_0xd28b('0x26')](function(_0x36f731){return _0x36f731;});}return null;};}function removeEntity(_0xdbc9e4,_0x479fa5){return function(_0x214a90){if(_0x214a90){return _0x214a90[_0xd28b('0x27')]()['then'](function(){_0xdbc9e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2399de,_0x1c377c){return function(_0x513362){if(!_0x513362){_0x2399de['sendStatus'](0x194);}return _0x513362;};}function handleError(_0x3242ae,_0x2bbe24){_0x2bbe24=_0x2bbe24||0x1f4;return function(_0x2d2689){logger[_0xd28b('0x28')](_0x2d2689['stack']);if(_0x2d2689['name']){delete _0x2d2689[_0xd28b('0x29')];}_0x3242ae[_0xd28b('0x1d')](_0x2bbe24)['send'](_0x2d2689);};}exports[_0xd28b('0x2a')]=function(_0x4951bf,_0x1dd509){var _0x1201a1={},_0x197ed3={},_0x42bfd9={'count':0x0,'rows':[]};var _0x45d166=_[_0xd28b('0x2b')](db[_0xd28b('0x2c')][_0xd28b('0x2d')],function(_0x5c34be){return{'name':_0x5c34be['fieldName'],'type':_0x5c34be['type']['key']};});_0x197ed3['model']=_[_0xd28b('0x2b')](_0x45d166,_0xd28b('0x29'));_0x197ed3[_0xd28b('0x2e')]=_['keys'](_0x4951bf[_0xd28b('0x2e')]);_0x197ed3['filters']=_[_0xd28b('0x2f')](_0x197ed3[_0xd28b('0x30')],_0x197ed3[_0xd28b('0x2e')]);_0x1201a1[_0xd28b('0x31')]=_[_0xd28b('0x2f')](_0x197ed3['model'],qs['fields'](_0x4951bf[_0xd28b('0x2e')][_0xd28b('0x32')]));_0x1201a1[_0xd28b('0x31')]=_0x1201a1[_0xd28b('0x31')][_0xd28b('0x33')]?_0x1201a1[_0xd28b('0x31')]:_0x197ed3['model'];if(!_0x4951bf[_0xd28b('0x2e')][_0xd28b('0x34')]('nolimit')){_0x1201a1[_0xd28b('0x22')]=qs[_0xd28b('0x22')](_0x4951bf['query'][_0xd28b('0x22')]);_0x1201a1[_0xd28b('0x1f')]=qs[_0xd28b('0x1f')](_0x4951bf[_0xd28b('0x2e')][_0xd28b('0x1f')]);}_0x1201a1[_0xd28b('0x35')]=qs[_0xd28b('0x36')](_0x4951bf[_0xd28b('0x2e')]['sort']);_0x1201a1[_0xd28b('0x37')]=qs[_0xd28b('0x38')](_[_0xd28b('0x39')](_0x4951bf[_0xd28b('0x2e')],_0x197ed3[_0xd28b('0x38')]),_0x45d166);if(_0x4951bf['query']['filter']){_0x1201a1[_0xd28b('0x37')]=_[_0xd28b('0x3a')](_0x1201a1[_0xd28b('0x37')],{'$or':_['map'](_0x45d166,function(_0x128752){if(_0x128752[_0xd28b('0x3b')]!==_0xd28b('0x3c')){var _0x5ec591={};_0x5ec591[_0x128752[_0xd28b('0x29')]]={'$like':'%'+_0x4951bf[_0xd28b('0x2e')]['filter']+'%'};return _0x5ec591;}})});}_0x1201a1=_[_0xd28b('0x3a')]({},_0x1201a1,_0x4951bf['options']);var _0x15bccb={'where':_0x1201a1['where']};return db['ChatGroup'][_0xd28b('0x21')](_0x15bccb)['then'](function(_0x50c176){_0x42bfd9[_0xd28b('0x21')]=_0x50c176;if(_0x4951bf[_0xd28b('0x2e')][_0xd28b('0x3d')]){_0x1201a1[_0xd28b('0x3e')]=[{'all':!![]}];}return db[_0xd28b('0x2c')][_0xd28b('0x3f')](_0x1201a1);})[_0xd28b('0x26')](function(_0x433d97){_0x42bfd9[_0xd28b('0x40')]=_0x433d97;return _0x42bfd9;})[_0xd28b('0x26')](respondWithFilteredResult(_0x1dd509,_0x1201a1))[_0xd28b('0x41')](handleError(_0x1dd509,null));};exports[_0xd28b('0x42')]=function(_0x354543,_0x78a618){var _0x185c64={'raw':!![],'where':{'id':_0x354543[_0xd28b('0x43')]['id']}},_0x52e5d0={};_0x52e5d0[_0xd28b('0x30')]=_['keys'](db[_0xd28b('0x2c')][_0xd28b('0x2d')]);_0x52e5d0[_0xd28b('0x2e')]=_[_0xd28b('0x44')](_0x354543[_0xd28b('0x2e')]);_0x52e5d0[_0xd28b('0x38')]=_['intersection'](_0x52e5d0[_0xd28b('0x30')],_0x52e5d0[_0xd28b('0x2e')]);_0x185c64[_0xd28b('0x31')]=_['intersection'](_0x52e5d0[_0xd28b('0x30')],qs['fields'](_0x354543[_0xd28b('0x2e')]['fields']));_0x185c64[_0xd28b('0x31')]=_0x185c64[_0xd28b('0x31')]['length']?_0x185c64['attributes']:_0x52e5d0[_0xd28b('0x30')];if(_0x354543[_0xd28b('0x2e')][_0xd28b('0x3d')]){_0x185c64[_0xd28b('0x3e')]=[{'all':!![]}];}_0x185c64=_[_0xd28b('0x3a')]({},_0x185c64,_0x354543['options']);return db[_0xd28b('0x2c')][_0xd28b('0x45')](_0x185c64)[_0xd28b('0x26')](handleEntityNotFound(_0x78a618,null))[_0xd28b('0x26')](respondWithResult(_0x78a618,null))[_0xd28b('0x41')](handleError(_0x78a618,null));};exports['create']=function(_0x349cb9,_0x368e52){return db[_0xd28b('0x2c')][_0xd28b('0x46')](_0x349cb9[_0xd28b('0x47')],{})[_0xd28b('0x26')](respondWithResult(_0x368e52,0xc9))['catch'](handleError(_0x368e52,null));};exports[_0xd28b('0x48')]=function(_0x1fa981,_0x111f96){if(_0x1fa981['body']['id']){delete _0x1fa981[_0xd28b('0x47')]['id'];}return db['ChatGroup'][_0xd28b('0x45')]({'where':{'id':_0x1fa981[_0xd28b('0x43')]['id']}})[_0xd28b('0x26')](handleEntityNotFound(_0x111f96,null))[_0xd28b('0x26')](saveUpdates(_0x1fa981['body'],null))[_0xd28b('0x26')](respondWithResult(_0x111f96,null))[_0xd28b('0x41')](handleError(_0x111f96,null));};exports[_0xd28b('0x27')]=function(_0x50f38d,_0x160c6f){return db[_0xd28b('0x2c')][_0xd28b('0x45')]({'where':{'id':_0x50f38d['params']['id']}})['then'](handleEntityNotFound(_0x160c6f,null))[_0xd28b('0x26')](removeEntity(_0x160c6f,null))[_0xd28b('0x41')](handleError(_0x160c6f,null));};exports[_0xd28b('0x49')]=function(_0x4f5fa6,_0xe319fc){return db[_0xd28b('0x2c')][_0xd28b('0x49')]()[_0xd28b('0x26')](respondWithResult(_0xe319fc,null))[_0xd28b('0x41')](handleError(_0xe319fc,null));};exports[_0xd28b('0x4a')]=function(_0x463065,_0x6f2c99,_0x539a8c){return db[_0xd28b('0x4b')][_0xd28b('0x21')]({'where':{'ChatGroupId':_0x463065[_0xd28b('0x43')]['id'],'ToId':_0x463065[_0xd28b('0x4c')]['id'],'read':![]}})[_0xd28b('0x26')](function(_0x5f6d5a){return{'id':_['toInteger'](_0x463065[_0xd28b('0x43')]['id']),'count':_0x5f6d5a};})['then'](respondWithResult(_0x6f2c99,null))[_0xd28b('0x41')](handleError(_0x6f2c99,null));};exports[_0xd28b('0x4d')]=function(_0x4807af,_0x5816d2,_0x58845c){return db[_0xd28b('0x2c')][_0xd28b('0x45')]({'where':{'id':_0x4807af['params']['id']}})['then'](handleEntityNotFound(_0x5816d2,null))[_0xd28b('0x26')](function(_0x57cfe9){if(_0x57cfe9){return _0x57cfe9[_0xd28b('0x4d')](_0x4807af[_0xd28b('0x47')][_0xd28b('0x4e')],_[_0xd28b('0x4f')](_0x4807af[_0xd28b('0x47')],['ids','id'])||{});}})[_0xd28b('0x26')](respondWithResult(_0x5816d2,null))[_0xd28b('0x41')](handleError(_0x5816d2,null));};exports[_0xd28b('0x50')]=function(_0x52f8da,_0x34962c,_0xcd2f57){var _0x4b93a0={};var _0x5cd230={};var _0x13d093;var _0x5d4e7d;return db['ChatGroup'][_0xd28b('0x51')]({'where':{'id':_0x52f8da['params']['id']}})[_0xd28b('0x26')](handleEntityNotFound(_0x34962c,null))[_0xd28b('0x26')](function(_0x2b1d71){if(_0x2b1d71){_0x13d093=_0x2b1d71;_0x5cd230['model']=_[_0xd28b('0x44')](db[_0xd28b('0x52')]['rawAttributes']);_0x5cd230['query']=_[_0xd28b('0x44')](_0x52f8da['query']);_0x5cd230['filters']=_[_0xd28b('0x2f')](_0x5cd230[_0xd28b('0x30')],_0x5cd230['query']);_0x4b93a0[_0xd28b('0x31')]=_[_0xd28b('0x2f')](_0x5cd230[_0xd28b('0x30')],qs[_0xd28b('0x32')](_0x52f8da[_0xd28b('0x2e')]['fields']));_0x4b93a0['attributes']=_0x4b93a0['attributes'][_0xd28b('0x33')]?_0x4b93a0['attributes']:_0x5cd230[_0xd28b('0x30')];_0x4b93a0[_0xd28b('0x35')]=qs[_0xd28b('0x36')](_0x52f8da['query'][_0xd28b('0x36')]);_0x4b93a0[_0xd28b('0x37')]=qs[_0xd28b('0x38')](_[_0xd28b('0x39')](_0x52f8da[_0xd28b('0x2e')],_0x5cd230['filters']));if(_0x52f8da[_0xd28b('0x2e')][_0xd28b('0x53')]){_0x4b93a0[_0xd28b('0x37')]=_[_0xd28b('0x3a')](_0x4b93a0[_0xd28b('0x37')],{'$or':_[_0xd28b('0x2b')](_0x4b93a0[_0xd28b('0x31')],function(_0x575990){var _0x5b385c={};_0x5b385c[_0x575990]={'$like':'%'+_0x52f8da[_0xd28b('0x2e')][_0xd28b('0x53')]+'%'};return _0x5b385c;})});}_0x4b93a0=_['merge']({},_0x4b93a0,_0x52f8da[_0xd28b('0x54')]);return _0x13d093['getMembers'](_0x4b93a0);}})[_0xd28b('0x26')](function(_0x725a67){if(_0x725a67){_0x5d4e7d=_0x725a67['length'];if(!_0x52f8da[_0xd28b('0x2e')][_0xd28b('0x34')](_0xd28b('0x55'))){_0x4b93a0[_0xd28b('0x22')]=qs[_0xd28b('0x22')](_0x52f8da[_0xd28b('0x2e')][_0xd28b('0x22')]);_0x4b93a0['offset']=qs['offset'](_0x52f8da[_0xd28b('0x2e')][_0xd28b('0x1f')]);}return _0x13d093[_0xd28b('0x50')](_0x4b93a0);}})[_0xd28b('0x26')](function(_0x34d652){if(_0x34d652){return _0x34d652?{'count':_0x5d4e7d,'rows':_0x34d652}:null;}})[_0xd28b('0x26')](respondWithResult(_0x34962c,null))[_0xd28b('0x41')](handleError(_0x34962c,null));};exports[_0xd28b('0x56')]=function(_0x3fd035,_0x46acad,_0x2c4cdf){return db[_0xd28b('0x2c')][_0xd28b('0x45')]({'where':{'id':_0x3fd035['params']['id']}})[_0xd28b('0x26')](handleEntityNotFound(_0x46acad,null))[_0xd28b('0x26')](function(_0x4d3456){if(_0x4d3456){return _0x4d3456[_0xd28b('0x56')](_0x3fd035[_0xd28b('0x2e')][_0xd28b('0x4e')]);}})[_0xd28b('0x26')](respondWithStatusCode(_0x46acad,null))[_0xd28b('0x41')](handleError(_0x46acad,null));};exports['addMessage']=function(_0x1d1de5,_0x47b4f0,_0x204bc0){if(_0x1d1de5[_0xd28b('0x47')]['id']){delete _0x1d1de5[_0xd28b('0x47')]['id'];}return db[_0xd28b('0x2c')][_0xd28b('0x45')]({'where':{'id':_0x1d1de5[_0xd28b('0x43')]['id']}})[_0xd28b('0x26')](handleEntityNotFound(_0x47b4f0,null))[_0xd28b('0x26')](function(_0x5bfb95){if(_0x5bfb95){_0x1d1de5[_0xd28b('0x47')][_0xd28b('0x57')]=_0x5bfb95['id'];return db['ChatInternalMessage'][_0xd28b('0x46')](_0x1d1de5['body']);}})[_0xd28b('0x26')](respondWithResult(_0x47b4f0,null))[_0xd28b('0x41')](handleError(_0x47b4f0,null));};exports[_0xd28b('0x58')]=function(_0x542e0a,_0x2079eb,_0x7eccd9){var _0x566fde={};var _0xd3eecb={};var _0x5b87e2;var _0x61772b;return db[_0xd28b('0x2c')][_0xd28b('0x51')]({'where':{'id':_0x542e0a[_0xd28b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2079eb,null))['then'](function(_0x214173){if(_0x214173){_0x5b87e2=_0x214173;_0xd3eecb[_0xd28b('0x30')]=_['keys'](db[_0xd28b('0x4b')][_0xd28b('0x2d')]);_0xd3eecb['query']=_['keys'](_0x542e0a[_0xd28b('0x2e')]);_0xd3eecb[_0xd28b('0x38')]=_['intersection'](_0xd3eecb[_0xd28b('0x30')],_0xd3eecb[_0xd28b('0x2e')]);_0x566fde['attributes']=_[_0xd28b('0x2f')](_0xd3eecb['model'],qs[_0xd28b('0x32')](_0x542e0a[_0xd28b('0x2e')]['fields']));_0x566fde[_0xd28b('0x31')]=_0x566fde[_0xd28b('0x31')][_0xd28b('0x33')]?_0x566fde['attributes']:_0xd3eecb[_0xd28b('0x30')];_0x566fde[_0xd28b('0x35')]=qs['sort'](_0x542e0a[_0xd28b('0x2e')][_0xd28b('0x36')]);_0x566fde[_0xd28b('0x37')]=qs['filters'](_['pick'](_0x542e0a[_0xd28b('0x2e')],_0xd3eecb[_0xd28b('0x38')]));if(_0x542e0a['query']['filter']){_0x566fde[_0xd28b('0x37')]=_[_0xd28b('0x3a')](_0x566fde[_0xd28b('0x37')],{'$or':_[_0xd28b('0x2b')](_0x566fde[_0xd28b('0x31')],function(_0x3310c7){var _0x5d6dc4={};_0x5d6dc4[_0x3310c7]={'$like':'%'+_0x542e0a[_0xd28b('0x2e')][_0xd28b('0x53')]+'%'};return _0x5d6dc4;})});}if(_0x542e0a['query'][_0xd28b('0x59')]){var _0x2acfa6=_0x542e0a[_0xd28b('0x2e')][_0xd28b('0x59')][_0xd28b('0x5a')](',');var _0x5c9aa5={};_0x5c9aa5[_0x2acfa6[0x0]]={'$gte':moment(_0x2acfa6[0x1])[_0xd28b('0x5b')](_0xd28b('0x5c'))};_0x566fde[_0xd28b('0x37')]=_[_0xd28b('0x3a')](_0x566fde['where'],_0x5c9aa5);}_0x566fde=_['merge']({},_0x566fde,_0x542e0a[_0xd28b('0x54')]);return _0x5b87e2['getMessages'](_0x566fde);}})[_0xd28b('0x26')](function(_0x3af0ba){if(_0x3af0ba){_0x61772b=_0x3af0ba[_0xd28b('0x33')];if(!_0x542e0a['query'][_0xd28b('0x34')]('nolimit')){_0x566fde[_0xd28b('0x22')]=qs['limit'](_0x542e0a[_0xd28b('0x2e')][_0xd28b('0x22')]);_0x566fde[_0xd28b('0x1f')]=qs['offset'](_0x542e0a[_0xd28b('0x2e')]['offset']);}return _0x5b87e2[_0xd28b('0x58')](_0x566fde);}})[_0xd28b('0x26')](function(_0x443a1f){if(_0x443a1f){return _0x443a1f?{'count':_0x61772b,'rows':_0x443a1f}:null;}})[_0xd28b('0x26')](respondWithResult(_0x2079eb,null))[_0xd28b('0x41')](handleError(_0x2079eb,null));}; \ No newline at end of file +var _0x6c3c=['end','sendStatus','stack','name','send','index','map','ChatGroup','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','getUnread','toInteger','addMembers','ids','findOne','User','pick','getMembers','nolimit','removeMembers','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','status','undefined','limit','count','offset','apply','reject','save','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c3c,0x149));var _0xc6c3=function(_0x40c8d0,_0x5560f7){_0x40c8d0=_0x40c8d0-0x0;var _0x4e46d4=_0x6c3c[_0x40c8d0];return _0x4e46d4;};'use strict';var emlformat=require(_0xc6c3('0x0'));var rimraf=require(_0xc6c3('0x1'));var zipdir=require(_0xc6c3('0x2'));var jsonpatch=require(_0xc6c3('0x3'));var rp=require(_0xc6c3('0x4'));var moment=require(_0xc6c3('0x5'));var BPromise=require(_0xc6c3('0x6'));var Mustache=require('mustache');var util=require(_0xc6c3('0x7'));var path=require(_0xc6c3('0x8'));var sox=require('sox');var csv=require(_0xc6c3('0x9'));var ejs=require(_0xc6c3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6c3('0xb'));var squel=require(_0xc6c3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc6c3('0x9'));var querystring=require(_0xc6c3('0xd'));var Papa=require('papaparse');var Redis=require(_0xc6c3('0xe'));var authService=require(_0xc6c3('0xf'));var qs=require(_0xc6c3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6c3('0x11'));var logger=require(_0xc6c3('0x12'))(_0xc6c3('0x13'));var utils=require(_0xc6c3('0x14'));var config=require(_0xc6c3('0x15'));var licenseUtil=require(_0xc6c3('0x16'));var db=require(_0xc6c3('0x17'))['db'];config[_0xc6c3('0x18')]=_[_0xc6c3('0x19')](config[_0xc6c3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6c3('0x1a'))(new Redis(config[_0xc6c3('0x18')]));require(_0xc6c3('0x1b'))['register'](socket);function respondWithStatusCode(_0x42de4a,_0x237312){_0x237312=_0x237312||0xcc;return function(_0x34037b){if(_0x34037b){return _0x42de4a['sendStatus'](_0x237312);}return _0x42de4a[_0xc6c3('0x1c')](_0x237312)['end']();};}function respondWithResult(_0x1834d0,_0x187020){_0x187020=_0x187020||0xc8;return function(_0x9f0e25){if(_0x9f0e25){return _0x1834d0[_0xc6c3('0x1c')](_0x187020)['json'](_0x9f0e25);}};}function respondWithFilteredResult(_0x2d776e,_0x1ef60e){return function(_0x595720){if(_0x595720){var _0x520971=typeof _0x1ef60e['offset']===_0xc6c3('0x1d')&&typeof _0x1ef60e[_0xc6c3('0x1e')]===_0xc6c3('0x1d');var _0x288fc2=_0x595720[_0xc6c3('0x1f')];var _0x65dde3=_0x520971?0x0:_0x1ef60e['offset'];var _0xd54a71=_0x520971?_0x595720[_0xc6c3('0x1f')]:_0x1ef60e[_0xc6c3('0x20')]+_0x1ef60e[_0xc6c3('0x1e')];var _0x9964ee;if(_0xd54a71>=_0x288fc2){_0xd54a71=_0x288fc2;_0x9964ee=0xc8;}else{_0x9964ee=0xce;}_0x2d776e['status'](_0x9964ee);return _0x2d776e['set']('Content-Range',_0x65dde3+'-'+_0xd54a71+'/'+_0x288fc2)['json'](_0x595720);}return null;};}function patchUpdates(_0x22fa66){return function(_0x50db52){try{jsonpatch[_0xc6c3('0x21')](_0x50db52,_0x22fa66,!![]);}catch(_0x5889b1){return BPromise[_0xc6c3('0x22')](_0x5889b1);}return _0x50db52[_0xc6c3('0x23')]();};}function saveUpdates(_0x8c9873,_0x5a2982){return function(_0x250d43){if(_0x250d43){return _0x250d43[_0xc6c3('0x24')](_0x8c9873)[_0xc6c3('0x25')](function(_0x5a9654){return _0x5a9654;});}return null;};}function removeEntity(_0x3cc223,_0x5e106c){return function(_0x116b64){if(_0x116b64){return _0x116b64[_0xc6c3('0x26')]()[_0xc6c3('0x25')](function(){_0x3cc223['status'](0xcc)[_0xc6c3('0x27')]();});}};}function handleEntityNotFound(_0x4d1b8b,_0x54d31f){return function(_0x2c3825){if(!_0x2c3825){_0x4d1b8b[_0xc6c3('0x28')](0x194);}return _0x2c3825;};}function handleError(_0x2a144f,_0x3f082c){_0x3f082c=_0x3f082c||0x1f4;return function(_0x47c290){logger['error'](_0x47c290[_0xc6c3('0x29')]);if(_0x47c290[_0xc6c3('0x2a')]){delete _0x47c290[_0xc6c3('0x2a')];}_0x2a144f[_0xc6c3('0x1c')](_0x3f082c)[_0xc6c3('0x2b')](_0x47c290);};}exports[_0xc6c3('0x2c')]=function(_0x54733a,_0x55cf7e){var _0x4f4209={},_0x1d5b99={},_0x3f6d0e={'count':0x0,'rows':[]};var _0x4eb61a=_[_0xc6c3('0x2d')](db[_0xc6c3('0x2e')]['rawAttributes'],function(_0x15b7ad){return{'name':_0x15b7ad['fieldName'],'type':_0x15b7ad[_0xc6c3('0x2f')][_0xc6c3('0x30')]};});_0x1d5b99[_0xc6c3('0x31')]=_[_0xc6c3('0x2d')](_0x4eb61a,_0xc6c3('0x2a'));_0x1d5b99[_0xc6c3('0x32')]=_[_0xc6c3('0x33')](_0x54733a[_0xc6c3('0x32')]);_0x1d5b99['filters']=_[_0xc6c3('0x34')](_0x1d5b99['model'],_0x1d5b99[_0xc6c3('0x32')]);_0x4f4209[_0xc6c3('0x35')]=_[_0xc6c3('0x34')](_0x1d5b99[_0xc6c3('0x31')],qs[_0xc6c3('0x36')](_0x54733a[_0xc6c3('0x32')][_0xc6c3('0x36')]));_0x4f4209['attributes']=_0x4f4209[_0xc6c3('0x35')]['length']?_0x4f4209['attributes']:_0x1d5b99['model'];if(!_0x54733a[_0xc6c3('0x32')][_0xc6c3('0x37')]('nolimit')){_0x4f4209[_0xc6c3('0x1e')]=qs['limit'](_0x54733a['query'][_0xc6c3('0x1e')]);_0x4f4209[_0xc6c3('0x20')]=qs[_0xc6c3('0x20')](_0x54733a[_0xc6c3('0x32')]['offset']);}_0x4f4209[_0xc6c3('0x38')]=qs['sort'](_0x54733a[_0xc6c3('0x32')][_0xc6c3('0x39')]);_0x4f4209[_0xc6c3('0x3a')]=qs[_0xc6c3('0x3b')](_['pick'](_0x54733a[_0xc6c3('0x32')],_0x1d5b99[_0xc6c3('0x3b')]),_0x4eb61a);if(_0x54733a[_0xc6c3('0x32')][_0xc6c3('0x3c')]){_0x4f4209[_0xc6c3('0x3a')]=_[_0xc6c3('0x3d')](_0x4f4209[_0xc6c3('0x3a')],{'$or':_[_0xc6c3('0x2d')](_0x4eb61a,function(_0x26bbeb){if(_0x26bbeb[_0xc6c3('0x2f')]!==_0xc6c3('0x3e')){var _0x256c51={};_0x256c51[_0x26bbeb[_0xc6c3('0x2a')]]={'$like':'%'+_0x54733a['query'][_0xc6c3('0x3c')]+'%'};return _0x256c51;}})});}_0x4f4209=_['merge']({},_0x4f4209,_0x54733a['options']);var _0x458bd6={'where':_0x4f4209[_0xc6c3('0x3a')]};return db[_0xc6c3('0x2e')][_0xc6c3('0x1f')](_0x458bd6)[_0xc6c3('0x25')](function(_0x5a295d){_0x3f6d0e['count']=_0x5a295d;if(_0x54733a[_0xc6c3('0x32')][_0xc6c3('0x3f')]){_0x4f4209[_0xc6c3('0x40')]=[{'all':!![]}];}return db['ChatGroup'][_0xc6c3('0x41')](_0x4f4209);})[_0xc6c3('0x25')](function(_0x305c5a){_0x3f6d0e[_0xc6c3('0x42')]=_0x305c5a;return _0x3f6d0e;})[_0xc6c3('0x25')](respondWithFilteredResult(_0x55cf7e,_0x4f4209))[_0xc6c3('0x43')](handleError(_0x55cf7e,null));};exports[_0xc6c3('0x44')]=function(_0x4b407e,_0x7ee6df){var _0xf05439={'raw':!![],'where':{'id':_0x4b407e[_0xc6c3('0x45')]['id']}},_0x348f36={};_0x348f36[_0xc6c3('0x31')]=_['keys'](db[_0xc6c3('0x2e')][_0xc6c3('0x46')]);_0x348f36[_0xc6c3('0x32')]=_[_0xc6c3('0x33')](_0x4b407e[_0xc6c3('0x32')]);_0x348f36[_0xc6c3('0x3b')]=_[_0xc6c3('0x34')](_0x348f36[_0xc6c3('0x31')],_0x348f36[_0xc6c3('0x32')]);_0xf05439[_0xc6c3('0x35')]=_['intersection'](_0x348f36[_0xc6c3('0x31')],qs[_0xc6c3('0x36')](_0x4b407e[_0xc6c3('0x32')][_0xc6c3('0x36')]));_0xf05439[_0xc6c3('0x35')]=_0xf05439['attributes'][_0xc6c3('0x47')]?_0xf05439[_0xc6c3('0x35')]:_0x348f36[_0xc6c3('0x31')];if(_0x4b407e['query'][_0xc6c3('0x3f')]){_0xf05439[_0xc6c3('0x40')]=[{'all':!![]}];}_0xf05439=_[_0xc6c3('0x3d')]({},_0xf05439,_0x4b407e[_0xc6c3('0x48')]);return db[_0xc6c3('0x2e')][_0xc6c3('0x49')](_0xf05439)[_0xc6c3('0x25')](handleEntityNotFound(_0x7ee6df,null))['then'](respondWithResult(_0x7ee6df,null))[_0xc6c3('0x43')](handleError(_0x7ee6df,null));};exports['create']=function(_0x717b2e,_0x471ed6){return db[_0xc6c3('0x2e')][_0xc6c3('0x4a')](_0x717b2e[_0xc6c3('0x4b')],{})[_0xc6c3('0x25')](respondWithResult(_0x471ed6,0xc9))['catch'](handleError(_0x471ed6,null));};exports[_0xc6c3('0x24')]=function(_0x1077ff,_0xaf5e3c){if(_0x1077ff[_0xc6c3('0x4b')]['id']){delete _0x1077ff[_0xc6c3('0x4b')]['id'];}return db[_0xc6c3('0x2e')]['find']({'where':{'id':_0x1077ff[_0xc6c3('0x45')]['id']}})[_0xc6c3('0x25')](handleEntityNotFound(_0xaf5e3c,null))['then'](saveUpdates(_0x1077ff[_0xc6c3('0x4b')],null))[_0xc6c3('0x25')](respondWithResult(_0xaf5e3c,null))[_0xc6c3('0x43')](handleError(_0xaf5e3c,null));};exports[_0xc6c3('0x26')]=function(_0x16b8dc,_0x13ef3c){return db['ChatGroup'][_0xc6c3('0x49')]({'where':{'id':_0x16b8dc['params']['id']}})[_0xc6c3('0x25')](handleEntityNotFound(_0x13ef3c,null))['then'](removeEntity(_0x13ef3c,null))[_0xc6c3('0x43')](handleError(_0x13ef3c,null));};exports['describe']=function(_0x36cc77,_0x137722){return db[_0xc6c3('0x2e')]['describe']()['then'](respondWithResult(_0x137722,null))[_0xc6c3('0x43')](handleError(_0x137722,null));};exports[_0xc6c3('0x4c')]=function(_0x471aea,_0x191637,_0x74577){return db['ChatInternalMessage'][_0xc6c3('0x1f')]({'where':{'ChatGroupId':_0x471aea[_0xc6c3('0x45')]['id'],'ToId':_0x471aea['user']['id'],'read':![]}})['then'](function(_0x4a4b5f){return{'id':_[_0xc6c3('0x4d')](_0x471aea[_0xc6c3('0x45')]['id']),'count':_0x4a4b5f};})[_0xc6c3('0x25')](respondWithResult(_0x191637,null))['catch'](handleError(_0x191637,null));};exports['addMembers']=function(_0x31a0f7,_0x370ebc,_0x23f97e){return db[_0xc6c3('0x2e')][_0xc6c3('0x49')]({'where':{'id':_0x31a0f7[_0xc6c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x370ebc,null))['then'](function(_0x3c52c4){if(_0x3c52c4){return _0x3c52c4[_0xc6c3('0x4e')](_0x31a0f7[_0xc6c3('0x4b')]['ids'],_['omit'](_0x31a0f7[_0xc6c3('0x4b')],[_0xc6c3('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x370ebc,null))['catch'](handleError(_0x370ebc,null));};exports['getMembers']=function(_0x2906a7,_0x327290,_0x32d6e8){var _0x8d2fee={};var _0x6afde={};var _0x33ffc8;var _0x13beb5;return db[_0xc6c3('0x2e')][_0xc6c3('0x50')]({'where':{'id':_0x2906a7[_0xc6c3('0x45')]['id']}})[_0xc6c3('0x25')](handleEntityNotFound(_0x327290,null))[_0xc6c3('0x25')](function(_0x35be0e){if(_0x35be0e){_0x33ffc8=_0x35be0e;_0x6afde['model']=_[_0xc6c3('0x33')](db[_0xc6c3('0x51')][_0xc6c3('0x46')]);_0x6afde[_0xc6c3('0x32')]=_[_0xc6c3('0x33')](_0x2906a7[_0xc6c3('0x32')]);_0x6afde[_0xc6c3('0x3b')]=_['intersection'](_0x6afde['model'],_0x6afde[_0xc6c3('0x32')]);_0x8d2fee['attributes']=_[_0xc6c3('0x34')](_0x6afde[_0xc6c3('0x31')],qs['fields'](_0x2906a7[_0xc6c3('0x32')][_0xc6c3('0x36')]));_0x8d2fee[_0xc6c3('0x35')]=_0x8d2fee[_0xc6c3('0x35')][_0xc6c3('0x47')]?_0x8d2fee[_0xc6c3('0x35')]:_0x6afde[_0xc6c3('0x31')];_0x8d2fee['order']=qs[_0xc6c3('0x39')](_0x2906a7[_0xc6c3('0x32')][_0xc6c3('0x39')]);_0x8d2fee['where']=qs['filters'](_[_0xc6c3('0x52')](_0x2906a7['query'],_0x6afde[_0xc6c3('0x3b')]));if(_0x2906a7[_0xc6c3('0x32')]['filter']){_0x8d2fee[_0xc6c3('0x3a')]=_['merge'](_0x8d2fee['where'],{'$or':_[_0xc6c3('0x2d')](_0x8d2fee[_0xc6c3('0x35')],function(_0x31809d){var _0x5950d5={};_0x5950d5[_0x31809d]={'$like':'%'+_0x2906a7[_0xc6c3('0x32')][_0xc6c3('0x3c')]+'%'};return _0x5950d5;})});}_0x8d2fee=_['merge']({},_0x8d2fee,_0x2906a7['options']);return _0x33ffc8[_0xc6c3('0x53')](_0x8d2fee);}})[_0xc6c3('0x25')](function(_0x3d5ba0){if(_0x3d5ba0){_0x13beb5=_0x3d5ba0[_0xc6c3('0x47')];if(!_0x2906a7[_0xc6c3('0x32')][_0xc6c3('0x37')](_0xc6c3('0x54'))){_0x8d2fee[_0xc6c3('0x1e')]=qs[_0xc6c3('0x1e')](_0x2906a7[_0xc6c3('0x32')][_0xc6c3('0x1e')]);_0x8d2fee[_0xc6c3('0x20')]=qs[_0xc6c3('0x20')](_0x2906a7['query'][_0xc6c3('0x20')]);}return _0x33ffc8[_0xc6c3('0x53')](_0x8d2fee);}})[_0xc6c3('0x25')](function(_0x5d97d7){if(_0x5d97d7){return _0x5d97d7?{'count':_0x13beb5,'rows':_0x5d97d7}:null;}})[_0xc6c3('0x25')](respondWithResult(_0x327290,null))[_0xc6c3('0x43')](handleError(_0x327290,null));};exports[_0xc6c3('0x55')]=function(_0x3cef2b,_0x54cf63,_0x36578e){return db['ChatGroup'][_0xc6c3('0x49')]({'where':{'id':_0x3cef2b[_0xc6c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x54cf63,null))[_0xc6c3('0x25')](function(_0x43a7cc){if(_0x43a7cc){return _0x43a7cc['removeMembers'](_0x3cef2b[_0xc6c3('0x32')]['ids']);}})[_0xc6c3('0x25')](respondWithStatusCode(_0x54cf63,null))[_0xc6c3('0x43')](handleError(_0x54cf63,null));};exports['addMessage']=function(_0xbe85fc,_0x40c50e,_0x96d364){if(_0xbe85fc[_0xc6c3('0x4b')]['id']){delete _0xbe85fc[_0xc6c3('0x4b')]['id'];}return db['ChatGroup'][_0xc6c3('0x49')]({'where':{'id':_0xbe85fc['params']['id']}})[_0xc6c3('0x25')](handleEntityNotFound(_0x40c50e,null))[_0xc6c3('0x25')](function(_0x11fd14){if(_0x11fd14){_0xbe85fc[_0xc6c3('0x4b')]['ChatGroupId']=_0x11fd14['id'];return db[_0xc6c3('0x56')]['create'](_0xbe85fc[_0xc6c3('0x4b')]);}})[_0xc6c3('0x25')](respondWithResult(_0x40c50e,null))[_0xc6c3('0x43')](handleError(_0x40c50e,null));};exports['getMessages']=function(_0x28d78c,_0x27f29e,_0x1e67de){var _0x200071={};var _0x16f312={};var _0x3f93b3;var _0x67c569;return db[_0xc6c3('0x2e')][_0xc6c3('0x50')]({'where':{'id':_0x28d78c[_0xc6c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x27f29e,null))['then'](function(_0x438520){if(_0x438520){_0x3f93b3=_0x438520;_0x16f312[_0xc6c3('0x31')]=_['keys'](db[_0xc6c3('0x56')][_0xc6c3('0x46')]);_0x16f312[_0xc6c3('0x32')]=_['keys'](_0x28d78c['query']);_0x16f312[_0xc6c3('0x3b')]=_['intersection'](_0x16f312[_0xc6c3('0x31')],_0x16f312[_0xc6c3('0x32')]);_0x200071[_0xc6c3('0x35')]=_[_0xc6c3('0x34')](_0x16f312[_0xc6c3('0x31')],qs['fields'](_0x28d78c[_0xc6c3('0x32')]['fields']));_0x200071[_0xc6c3('0x35')]=_0x200071[_0xc6c3('0x35')][_0xc6c3('0x47')]?_0x200071[_0xc6c3('0x35')]:_0x16f312[_0xc6c3('0x31')];_0x200071[_0xc6c3('0x38')]=qs['sort'](_0x28d78c[_0xc6c3('0x32')][_0xc6c3('0x39')]);_0x200071[_0xc6c3('0x3a')]=qs[_0xc6c3('0x3b')](_[_0xc6c3('0x52')](_0x28d78c[_0xc6c3('0x32')],_0x16f312[_0xc6c3('0x3b')]));if(_0x28d78c[_0xc6c3('0x32')]['filter']){_0x200071[_0xc6c3('0x3a')]=_[_0xc6c3('0x3d')](_0x200071[_0xc6c3('0x3a')],{'$or':_[_0xc6c3('0x2d')](_0x200071['attributes'],function(_0x34eb0b){var _0x5afa99={};_0x5afa99[_0x34eb0b]={'$like':'%'+_0x28d78c['query'][_0xc6c3('0x3c')]+'%'};return _0x5afa99;})});}if(_0x28d78c[_0xc6c3('0x32')][_0xc6c3('0x57')]){var _0x3a30ab=_0x28d78c[_0xc6c3('0x32')][_0xc6c3('0x57')][_0xc6c3('0x58')](',');var _0x3cf6f3={};_0x3cf6f3[_0x3a30ab[0x0]]={'$gte':moment(_0x3a30ab[0x1])[_0xc6c3('0x59')](_0xc6c3('0x5a'))};_0x200071['where']=_[_0xc6c3('0x3d')](_0x200071[_0xc6c3('0x3a')],_0x3cf6f3);}_0x200071=_[_0xc6c3('0x3d')]({},_0x200071,_0x28d78c[_0xc6c3('0x48')]);return _0x3f93b3[_0xc6c3('0x5b')](_0x200071);}})['then'](function(_0x3025a8){if(_0x3025a8){_0x67c569=_0x3025a8[_0xc6c3('0x47')];if(!_0x28d78c[_0xc6c3('0x32')][_0xc6c3('0x37')](_0xc6c3('0x54'))){_0x200071[_0xc6c3('0x1e')]=qs[_0xc6c3('0x1e')](_0x28d78c['query']['limit']);_0x200071[_0xc6c3('0x20')]=qs['offset'](_0x28d78c[_0xc6c3('0x32')]['offset']);}return _0x3f93b3[_0xc6c3('0x5b')](_0x200071);}})[_0xc6c3('0x25')](function(_0x2a8b4b){if(_0x2a8b4b){return _0x2a8b4b?{'count':_0x67c569,'rows':_0x2a8b4b}:null;}})[_0xc6c3('0x25')](respondWithResult(_0x27f29e,null))['catch'](handleError(_0x27f29e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f786edc..d14833c 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 _0x8cb8=['setMaxListeners','remove','emit','exports','../../mysqldb'];(function(_0x51fec9,_0x1365db){var _0x1c1815=function(_0x3c8a7b){while(--_0x3c8a7b){_0x51fec9['push'](_0x51fec9['shift']());}};_0x1c1815(++_0x1365db);}(_0x8cb8,0x1da));var _0x88cb=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0x8cb8[_0x301c34];return _0x1a8c5a;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x88cb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x88cb('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x88cb('0x2')};function emitEvent(_0x34501e){return function(_0x3d0714,_0x535248,_0x5298d8){ChatGroupEvents[_0x88cb('0x3')](_0x34501e+':'+_0x3d0714['id'],_0x3d0714);ChatGroupEvents[_0x88cb('0x3')](_0x34501e,_0x3d0714);_0x5298d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x88cb('0x4')]=ChatGroupEvents; \ No newline at end of file +var _0x0ed1=['exports','events','ChatGroup','save','update','remove','emit','hasOwnProperty'];(function(_0x39f1d4,_0xbabf59){var _0x468f70=function(_0x5a86a3){while(--_0x5a86a3){_0x39f1d4['push'](_0x39f1d4['shift']());}};_0x468f70(++_0xbabf59);}(_0x0ed1,0xb1));var _0x10ed=function(_0x38435c,_0x33fdab){_0x38435c=_0x38435c-0x0;var _0x233d0a=_0x0ed1[_0x38435c];return _0x233d0a;};'use strict';var EventEmitter=require(_0x10ed('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x10ed('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x10ed('0x2'),'afterUpdate':_0x10ed('0x3'),'afterDestroy':_0x10ed('0x4')};function emitEvent(_0x22ccc1){return function(_0x3c4bff,_0x472f08,_0x1e478c){ChatGroupEvents['emit'](_0x22ccc1+':'+_0x3c4bff['id'],_0x3c4bff);ChatGroupEvents[_0x10ed('0x5')](_0x22ccc1,_0x3c4bff);_0x1e478c(null);};}for(var e in events){if(events[_0x10ed('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x10ed('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7b75ef8..657fcac 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 _0xd2b6=['api','request-promise','path','../../config/environment','./chatGroup.attributes','ChatGroup','chat_groups','lodash'];(function(_0x6b7636,_0x59bca8){var _0x251ce7=function(_0x240d9f){while(--_0x240d9f){_0x6b7636['push'](_0x6b7636['shift']());}};_0x251ce7(++_0x59bca8);}(_0xd2b6,0xe7));var _0x6d2b=function(_0x124397,_0x482c88){_0x124397=_0x124397-0x0;var _0x2afc00=_0xd2b6[_0x124397];return _0x2afc00;};'use strict';var _=require(_0x6d2b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6d2b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6d2b('0x2'));var fs=require('fs');var path=require(_0x6d2b('0x3'));var rimraf=require('rimraf');var config=require(_0x6d2b('0x4'));var attributes=require(_0x6d2b('0x5'));module['exports']=function(_0xc16659,_0x160f06){return _0xc16659['define'](_0x6d2b('0x6'),attributes,{'tableName':_0x6d2b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a05=['util','../../config/logger','api','moment','bluebird','request-promise','path','./chatGroup.attributes','exports','chat_groups','lodash'];(function(_0x5d00fc,_0x5ae81d){var _0x5e7901=function(_0x7d3d8f){while(--_0x7d3d8f){_0x5d00fc['push'](_0x5d00fc['shift']());}};_0x5e7901(++_0x5ae81d);}(_0x7a05,0x13e));var _0x57a0=function(_0x30cf1d,_0x4f43d2){_0x30cf1d=_0x30cf1d-0x0;var _0x1eed74=_0x7a05[_0x30cf1d];return _0x1eed74;};'use strict';var _=require(_0x57a0('0x0'));var util=require(_0x57a0('0x1'));var logger=require(_0x57a0('0x2'))(_0x57a0('0x3'));var moment=require(_0x57a0('0x4'));var BPromise=require(_0x57a0('0x5'));var rp=require(_0x57a0('0x6'));var fs=require('fs');var path=require(_0x57a0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x57a0('0x8'));module[_0x57a0('0x9')]=function(_0xd68ee4,_0x33cf37){return _0xd68ee4['define']('ChatGroup',attributes,{'tableName':_0x57a0('0xa'),'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 35c5845..ea96022 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 _0xc716=['socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc716,0x16c));var _0x6c71=function(_0x2ea948,_0x8728c5){_0x2ea948=_0x2ea948-0x0;var _0x131699=_0xc716[_0x2ea948];return _0x131699;};'use strict';var _=require(_0x6c71('0x0'));var util=require('util');var moment=require(_0x6c71('0x1'));var BPromise=require(_0x6c71('0x2'));var rs=require(_0x6c71('0x3'));var fs=require('fs');var Redis=require(_0x6c71('0x4'));var db=require(_0x6c71('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c71('0x6'))('rpc');var config=require(_0x6c71('0x7'));var jayson=require(_0x6c71('0x8'));var client=jayson[_0x6c71('0x9')][_0x6c71('0xa')]({'port':0x232a});config[_0x6c71('0xb')]=_[_0x6c71('0xc')](config[_0x6c71('0xb')],{'host':_0x6c71('0xd'),'port':0x18eb});var socket=require(_0x6c71('0xe'))(new Redis(config['redis']));require(_0x6c71('0xf'))['register'](socket);function respondWithRpcPromise(_0x26158a,_0x490c03,_0x4a8136){return new BPromise(function(_0x177979,_0x4e1196){return client[_0x6c71('0x10')](_0x26158a,_0x4a8136)[_0x6c71('0x11')](function(_0x427060){logger[_0x6c71('0x12')](_0x6c71('0x13'),_0x490c03,_0x6c71('0x14'));logger[_0x6c71('0x15')](_0x6c71('0x16'),_0x490c03,'request\x20sent',JSON[_0x6c71('0x17')](_0x427060));if(_0x427060[_0x6c71('0x18')]){if(_0x427060[_0x6c71('0x18')]['code']===0x1f4){logger[_0x6c71('0x18')](_0x6c71('0x13'),_0x490c03,_0x427060['error'][_0x6c71('0x19')]);return _0x4e1196(_0x427060['error'][_0x6c71('0x19')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x490c03,_0x427060[_0x6c71('0x18')][_0x6c71('0x19')]);return _0x177979(_0x427060['error']['message']);}else{logger['info'](_0x6c71('0x13'),_0x490c03,_0x6c71('0x14'));_0x177979(_0x427060['result'][_0x6c71('0x19')]);}})[_0x6c71('0x1a')](function(_0x3b5cae){logger['error']('ChatGroup,\x20%s,\x20%s',_0x490c03,_0x3b5cae);_0x4e1196(_0x3b5cae);});});} \ No newline at end of file +var _0x1501=['ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x155bbf,_0x1bca34){var _0x1cb0ac=function(_0x101c7c){while(--_0x101c7c){_0x155bbf['push'](_0x155bbf['shift']());}};_0x1cb0ac(++_0x1bca34);}(_0x1501,0x126));var _0x1150=function(_0x22be2e,_0x43a2d1){_0x22be2e=_0x22be2e-0x0;var _0x332ce3=_0x1501[_0x22be2e];return _0x332ce3;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var moment=require(_0x1150('0x1'));var BPromise=require(_0x1150('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1150('0x3'));var db=require(_0x1150('0x4'))['db'];var utils=require(_0x1150('0x5'));var logger=require(_0x1150('0x6'))('rpc');var config=require(_0x1150('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1150('0x8')][_0x1150('0x9')]({'port':0x232a});config[_0x1150('0xa')]=_[_0x1150('0xb')](config[_0x1150('0xa')],{'host':_0x1150('0xc'),'port':0x18eb});var socket=require(_0x1150('0xd'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x1150('0xe')](socket);function respondWithRpcPromise(_0x428427,_0x4d28c6,_0x53cfec){return new BPromise(function(_0x2b8008,_0x29d989){return client[_0x1150('0xf')](_0x428427,_0x53cfec)[_0x1150('0x10')](function(_0x5b5294){logger[_0x1150('0x11')](_0x1150('0x12'),_0x4d28c6,'request\x20sent');logger[_0x1150('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4d28c6,_0x1150('0x14'),JSON[_0x1150('0x15')](_0x5b5294));if(_0x5b5294[_0x1150('0x16')]){if(_0x5b5294[_0x1150('0x16')][_0x1150('0x17')]===0x1f4){logger[_0x1150('0x16')](_0x1150('0x12'),_0x4d28c6,_0x5b5294[_0x1150('0x16')]['message']);return _0x29d989(_0x5b5294['error'][_0x1150('0x18')]);}logger[_0x1150('0x16')](_0x1150('0x12'),_0x4d28c6,_0x5b5294[_0x1150('0x16')][_0x1150('0x18')]);return _0x2b8008(_0x5b5294[_0x1150('0x16')][_0x1150('0x18')]);}else{logger[_0x1150('0x11')](_0x1150('0x12'),_0x4d28c6,_0x1150('0x14'));_0x2b8008(_0x5b5294['result']['message']);}})[_0x1150('0x19')](function(_0x32e391){logger['error'](_0x1150('0x12'),_0x4d28c6,_0x32e391);_0x29d989(_0x32e391);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 3d72089..285dfe4 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 _0xa867=['update','emit','removeListener','register','length','./chatGroup.events','save'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xa867,0x194));var _0x7a86=function(_0x25694e,_0x777b0e){_0x25694e=_0x25694e-0x0;var _0x195008=_0xa867[_0x25694e];return _0x195008;};'use strict';var ChatGroupEvents=require(_0x7a86('0x0'));var events=[_0x7a86('0x1'),'remove',_0x7a86('0x2')];function createListener(_0x2dfad3,_0x3f76e7){return function(_0x39bbaa){_0x3f76e7[_0x7a86('0x3')](_0x2dfad3,_0x39bbaa);};}function removeListener(_0x14f343,_0x59fe31){return function(){ChatGroupEvents[_0x7a86('0x4')](_0x14f343,_0x59fe31);};}exports[_0x7a86('0x5')]=function(_0x271a08){for(var _0x646232=0x0,_0x14fbc7=events[_0x7a86('0x6')];_0x646232<_0x14fbc7;_0x646232++){var _0x3aab58=events[_0x646232];var _0x250c92=createListener('chatGroup:'+_0x3aab58,_0x271a08);ChatGroupEvents['on'](_0x3aab58,_0x250c92);}}; \ No newline at end of file +var _0x9020=['register','length','chatGroup:','./chatGroup.events','remove','update','emit','removeListener'];(function(_0x1988f1,_0x290a23){var _0x3c848e=function(_0x3600e7){while(--_0x3600e7){_0x1988f1['push'](_0x1988f1['shift']());}};_0x3c848e(++_0x290a23);}(_0x9020,0x83));var _0x0902=function(_0x2e0b95,_0x141c82){_0x2e0b95=_0x2e0b95-0x0;var _0x139971=_0x9020[_0x2e0b95];return _0x139971;};'use strict';var ChatGroupEvents=require(_0x0902('0x0'));var events=['save',_0x0902('0x1'),_0x0902('0x2')];function createListener(_0x5a1638,_0x278f3c){return function(_0x2daa46){_0x278f3c[_0x0902('0x3')](_0x5a1638,_0x2daa46);};}function removeListener(_0x556ac1,_0xd280e6){return function(){ChatGroupEvents[_0x0902('0x4')](_0x556ac1,_0xd280e6);};}exports[_0x0902('0x5')]=function(_0x451d5d){for(var _0x54a184=0x0,_0x24c492=events[_0x0902('0x6')];_0x54a184<_0x24c492;_0x54a184++){var _0x157828=events[_0x54a184];var _0x3d5f78=createListener(_0x0902('0x7')+_0x157828,_0x451d5d);ChatGroupEvents['on'](_0x157828,_0x3d5f78);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ec15180..f1e3dcd 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 _0x7da8=['index','get','/describe','isAuthenticated','describe','/:id/members','/:id/messages','create','post','addMembers','put','/:id','update','delete','removeMembers','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0x7da8,0xcf));var _0x87da=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7da8[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x87da('0x0'));var util=require(_0x87da('0x1'));var path=require(_0x87da('0x2'));var timeout=require(_0x87da('0x3'));var express=require(_0x87da('0x4'));var router=express[_0x87da('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x87da('0x6'));var config=require(_0x87da('0x7'));var controller=require(_0x87da('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x87da('0x9')]);router[_0x87da('0xa')](_0x87da('0xb'),auth[_0x87da('0xc')](),controller[_0x87da('0xd')]);router[_0x87da('0xa')]('/:id',auth[_0x87da('0xc')](),controller['show']);router[_0x87da('0xa')]('/:id/unread',auth[_0x87da('0xc')](),controller['getUnread']);router['get'](_0x87da('0xe'),auth[_0x87da('0xc')](),controller['getMembers']);router[_0x87da('0xa')](_0x87da('0xf'),auth[_0x87da('0xc')](),controller['getMessages']);router['post']('/',auth[_0x87da('0xc')](),controller[_0x87da('0x10')]);router[_0x87da('0x11')](_0x87da('0xe'),auth[_0x87da('0xc')](),controller[_0x87da('0x12')]);router['post'](_0x87da('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x87da('0x13')](_0x87da('0x14'),auth[_0x87da('0xc')](),controller[_0x87da('0x15')]);router[_0x87da('0x16')](_0x87da('0x14'),auth[_0x87da('0xc')](),controller['destroy']);router[_0x87da('0x16')](_0x87da('0xe'),auth[_0x87da('0xc')](),controller[_0x87da('0x17')]);module['exports']=router; \ No newline at end of file +var _0xeaee=['delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','addMembers','addMessage','put','/:id','update','destroy'];(function(_0x40051c,_0x3ff786){var _0x17482f=function(_0x42d908){while(--_0x42d908){_0x40051c['push'](_0x40051c['shift']());}};_0x17482f(++_0x3ff786);}(_0xeaee,0x1c2));var _0xeeae=function(_0x4a1568,_0x4ad2dd){_0x4a1568=_0x4a1568-0x0;var _0x4d4e8b=_0xeaee[_0x4a1568];return _0x4d4e8b;};'use strict';var multer=require(_0xeeae('0x0'));var util=require('util');var path=require(_0xeeae('0x1'));var timeout=require('connect-timeout');var express=require(_0xeeae('0x2'));var router=express[_0xeeae('0x3')]();var fs_extra=require(_0xeeae('0x4'));var auth=require(_0xeeae('0x5'));var interaction=require(_0xeeae('0x6'));var config=require(_0xeeae('0x7'));var controller=require(_0xeeae('0x8'));router[_0xeeae('0x9')]('/',auth['isAuthenticated'](),controller[_0xeeae('0xa')]);router[_0xeeae('0x9')](_0xeeae('0xb'),auth[_0xeeae('0xc')](),controller['describe']);router[_0xeeae('0x9')]('/:id',auth[_0xeeae('0xc')](),controller[_0xeeae('0xd')]);router['get'](_0xeeae('0xe'),auth[_0xeeae('0xc')](),controller[_0xeeae('0xf')]);router['get'](_0xeeae('0x10'),auth[_0xeeae('0xc')](),controller['getMembers']);router[_0xeeae('0x9')](_0xeeae('0x11'),auth[_0xeeae('0xc')](),controller[_0xeeae('0x12')]);router['post']('/',auth[_0xeeae('0xc')](),controller['create']);router[_0xeeae('0x13')]('/:id/members',auth['isAuthenticated'](),controller[_0xeeae('0x14')]);router['post'](_0xeeae('0x11'),auth['isAuthenticated'](),controller[_0xeeae('0x15')]);router[_0xeeae('0x16')](_0xeeae('0x17'),auth[_0xeeae('0xc')](),controller[_0xeeae('0x18')]);router['delete'](_0xeeae('0x17'),auth[_0xeeae('0xc')](),controller[_0xeeae('0x19')]);router[_0xeeae('0x1a')](_0xeeae('0x10'),auth[_0xeeae('0xc')](),controller['removeMembers']);module[_0xeeae('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 5ade753..3546685 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 _0x21f9=['DATE','long','out','sequelize','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING'];(function(_0x3b1774,_0x4d4151){var _0x163643=function(_0x1ddeea){while(--_0x1ddeea){_0x3b1774['push'](_0x3b1774['shift']());}};_0x163643(++_0x4d4151);}(_0x21f9,0x71));var _0x921f=function(_0x13931f,_0x4ec47e){_0x13931f=_0x13931f-0x0;var _0x31797e=_0x21f9[_0x13931f];return _0x31797e;};'use strict';var Sequelize=require(_0x921f('0x0'));module['exports']={'closed':{'type':Sequelize[_0x921f('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x921f('0x2')]},'ratingType':{'type':Sequelize[_0x921f('0x3')]('star',_0x921f('0x4')),'defaultValue':_0x921f('0x5')},'ratingMessage':{'type':Sequelize[_0x921f('0x6')]},'pathTranscript':{'type':Sequelize[_0x921f('0x6')]},'mailTranscript':{'type':Sequelize[_0x921f('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x921f('0x8')]},'disposition':{'type':Sequelize[_0x921f('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x921f('0x7')]},'note':{'type':Sequelize[_0x921f('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x921f('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x921f('0x7')]},'deviceModel':{'type':Sequelize[_0x921f('0x7')]},'deviceVendor':{'type':Sequelize[_0x921f('0x7')]},'deviceType':{'type':Sequelize[_0x921f('0x7')]},'referer':{'type':Sequelize[_0x921f('0x6')]},'customerIp':{'type':Sequelize[_0x921f('0x7')]},'formData':{'type':Sequelize[_0x921f('0x6')](_0x921f('0x9'))},'read1stAt':{'type':Sequelize[_0x921f('0x8')]},'lastMsgAt':{'type':Sequelize[_0x921f('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x921f('0x3')]('in',_0x921f('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x921f('0x7')]},'customerPort':{'type':Sequelize[_0x921f('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x921f('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x921f('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x921f('0x2')]}}; \ No newline at end of file +var _0x25e1=['long','DATE','out','BOOLEAN','sequelize','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x43b8b3,_0x5b1df6){var _0x2e833a=function(_0x325081){while(--_0x325081){_0x43b8b3['push'](_0x43b8b3['shift']());}};_0x2e833a(++_0x5b1df6);}(_0x25e1,0xb4));var _0x125e=function(_0x34827d,_0x216e99){_0x34827d=_0x34827d-0x0;var _0x7a060a=_0x25e1[_0x34827d];return _0x7a060a;};'use strict';var Sequelize=require(_0x125e('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x125e('0x1')]},'ratingType':{'type':Sequelize[_0x125e('0x2')](_0x125e('0x3'),_0x125e('0x4')),'defaultValue':_0x125e('0x3')},'ratingMessage':{'type':Sequelize[_0x125e('0x5')]},'pathTranscript':{'type':Sequelize[_0x125e('0x5')]},'mailTranscript':{'type':Sequelize[_0x125e('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x125e('0x6')]},'thirdDisposition':{'type':Sequelize[_0x125e('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x125e('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x125e('0x6')]},'osVersion':{'type':Sequelize[_0x125e('0x6')]},'deviceModel':{'type':Sequelize[_0x125e('0x6')]},'deviceVendor':{'type':Sequelize[_0x125e('0x6')]},'deviceType':{'type':Sequelize[_0x125e('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x125e('0x5')](_0x125e('0x7'))},'read1stAt':{'type':Sequelize[_0x125e('0x8')]},'lastMsgAt':{'type':Sequelize[_0x125e('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x125e('0x2')]('in',_0x125e('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x125e('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x125e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x125e('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f3ce30f..dae0219 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 _0xbbe2=['Account','createdAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','update','stack','name','send','render','body','contact','agent','interaction','index','map','rawAttributes','fieldName','type','getOptions','findAll','chat','catch','show','params','model','ChatInteraction','query','intersection','attributes','fields','length','includeAll','include','merge','find','create','destroy','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooMetadata','vidaooApiKey','user','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','closed','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','User','ContactId','Messages','%s%d','UserId','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','keys','filters','hasOwnProperty','nolimit','limit','sort','where','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','getMyMessages','push','fullname','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','download','toString','files','tmp','server','attachments','transcript-%d-%s.zip','lastName','direction','read','Owner','get','mkdirSync'];(function(_0x1c4754,_0x4599f5){var _0x48b1e4=function(_0x31d401){while(--_0x31d401){_0x1c4754['push'](_0x1c4754['shift']());}};_0x48b1e4(++_0x4599f5);}(_0xbbe2,0x1c2));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x2bbe('0x0'));var zipdir=require(_0x2bbe('0x1'));var rp=require(_0x2bbe('0x2'));var moment=require(_0x2bbe('0x3'));var BPromise=require(_0x2bbe('0x4'));var Mustache=require(_0x2bbe('0x5'));var util=require(_0x2bbe('0x6'));var path=require(_0x2bbe('0x7'));var ejs=require(_0x2bbe('0x8'));var fs=require('fs');var _=require(_0x2bbe('0x9'));var Redis=require(_0x2bbe('0xa'));var interaction=require(_0x2bbe('0xb'));var qs=require(_0x2bbe('0xc'));var pdf=require(_0x2bbe('0xd'));var logger=require(_0x2bbe('0xe'))(_0x2bbe('0xf'));var config=require(_0x2bbe('0x10'));var db=require('../../mysqldb')['db'];config[_0x2bbe('0x11')]=_[_0x2bbe('0x12')](config['redis'],{'host':_0x2bbe('0x13'),'port':0x18eb});var socket=require(_0x2bbe('0x14'))(new Redis(config['redis']));require(_0x2bbe('0x15'))[_0x2bbe('0x16')](socket);var jayson=require(_0x2bbe('0x17'));var client=jayson[_0x2bbe('0x18')][_0x2bbe('0x19')]({'port':0x232b});var client9004=jayson['client'][_0x2bbe('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x18b7e2,_0x12ca85,_0x361e5d,_0x1f0c68){return new BPromise(function(_0x1f7806,_0x2c6c88){var _0x2dd296=_0x1f0c68||client;return _0x2dd296[_0x2bbe('0x1a')](_0x18b7e2,_0x361e5d)[_0x2bbe('0x1b')](function(_0x4d611c){logger['info'](_0x2bbe('0x1c'),_0x12ca85,'request\x20sent');logger[_0x2bbe('0x1d')](_0x2bbe('0x1e'),_0x12ca85,_0x2bbe('0x1f'),JSON[_0x2bbe('0x20')](_0x4d611c));if(_0x4d611c['error']){if(_0x4d611c[_0x2bbe('0x21')][_0x2bbe('0x22')]===0x1f4){logger[_0x2bbe('0x21')](_0x2bbe('0x1c'),_0x12ca85,_0x4d611c[_0x2bbe('0x21')][_0x2bbe('0x23')]);return _0x2c6c88(_0x4d611c[_0x2bbe('0x21')][_0x2bbe('0x23')]);}logger[_0x2bbe('0x21')](_0x2bbe('0x1c'),_0x12ca85,_0x4d611c[_0x2bbe('0x21')][_0x2bbe('0x23')]);return _0x1f7806(_0x4d611c['error'][_0x2bbe('0x23')]);}else{logger[_0x2bbe('0x24')](_0x2bbe('0x1c'),_0x12ca85,_0x2bbe('0x1f'));_0x1f7806(_0x4d611c[_0x2bbe('0x25')][_0x2bbe('0x23')]);}})['catch'](function(_0x499533){logger[_0x2bbe('0x21')](_0x2bbe('0x1c'),_0x12ca85,_0x499533);_0x2c6c88(_0x499533);});});}function respondWithStatusCode(_0x19ed14,_0x3041fd){_0x3041fd=_0x3041fd||0xcc;return function(_0x806166){if(_0x806166){return _0x19ed14[_0x2bbe('0x26')](_0x3041fd);}return _0x19ed14[_0x2bbe('0x27')](_0x3041fd)[_0x2bbe('0x28')]();};}function respondWithResult(_0x252176,_0x5025c6){_0x5025c6=_0x5025c6||0xc8;return function(_0x4dd38f){if(_0x4dd38f){return _0x252176['status'](_0x5025c6)[_0x2bbe('0x29')](_0x4dd38f);}};}function respondWithFilteredResult(_0xbecfdc,_0x45079c){return function(_0x397e42){if(_0x397e42){var _0x808c6=typeof _0x45079c['offset']==='undefined'&&typeof _0x45079c['limit']===_0x2bbe('0x2a');var _0x5ee194=_0x397e42[_0x2bbe('0x2b')];var _0x3e1301=_0x808c6?0x0:_0x45079c[_0x2bbe('0x2c')];var _0x18b03e=_0x808c6?_0x397e42['count']:_0x45079c[_0x2bbe('0x2c')]+_0x45079c['limit'];var _0x2d7b8e;if(_0x18b03e>=_0x5ee194){_0x18b03e=_0x5ee194;_0x2d7b8e=0xc8;}else{_0x2d7b8e=0xce;}_0xbecfdc[_0x2bbe('0x27')](_0x2d7b8e);return _0xbecfdc[_0x2bbe('0x2d')](_0x2bbe('0x2e'),_0x3e1301+'-'+_0x18b03e+'/'+_0x5ee194)[_0x2bbe('0x29')](_0x397e42);}return null;};}function saveUpdates(_0xd843e2){return function(_0x57339f){if(_0x57339f){return _0x57339f[_0x2bbe('0x2f')](_0xd843e2)['then'](function(_0x1eadfd){return _0x1eadfd;});}return null;};}function removeEntity(_0x2d1c79){return function(_0x4a10a3){if(_0x4a10a3){return _0x4a10a3['destroy']()['then'](function(){_0x2d1c79[_0x2bbe('0x27')](0xcc)[_0x2bbe('0x28')]();});}};}function handleEntityNotFound(_0x255e1e){return function(_0x4139b5){if(!_0x4139b5){_0x255e1e[_0x2bbe('0x26')](0x194);}return _0x4139b5;};}function handleError(_0x17dcea,_0x4a1fba){_0x4a1fba=_0x4a1fba||0x1f4;return function(_0x1e52bb){logger['error'](_0x1e52bb[_0x2bbe('0x30')]);if(_0x1e52bb[_0x2bbe('0x31')]){delete _0x1e52bb[_0x2bbe('0x31')];}_0x17dcea['status'](_0x4a1fba)[_0x2bbe('0x32')](_0x1e52bb);};}function getMustacheRender(_0x2201ba,_0x4fc4aa){return Mustache[_0x2bbe('0x33')](_0x2201ba,_['merge'](_0x4fc4aa[_0x2bbe('0x34')],{'contact':_0x4fc4aa[_0x2bbe('0x35')],'message':_0x4fc4aa['message'],'agent':_0x4fc4aa[_0x2bbe('0x36')],'interaction':_0x4fc4aa[_0x2bbe('0x37')],'account':_0x4fc4aa['account']}))||'';}exports[_0x2bbe('0x38')]=function(_0x25d212,_0x5c9f65){var _0x5b2465={};var _0x2bd053=_[_0x2bbe('0x39')](db['ChatInteraction'][_0x2bbe('0x3a')],function(_0x3a82e9){return{'name':_0x3a82e9[_0x2bbe('0x3b')],'type':_0x3a82e9[_0x2bbe('0x3c')]['key']};});_0x5b2465=qs[_0x2bbe('0x3d')](_0x2bd053,_0x25d212);return interaction[_0x2bbe('0x3e')](_0x2bbe('0x3f'),_0x25d212['query'],_0x25d212['user'],_0x5b2465,_0x2bd053)[_0x2bbe('0x1b')](respondWithFilteredResult(_0x5c9f65,_0x5b2465))[_0x2bbe('0x40')](handleError(_0x5c9f65,null));};exports[_0x2bbe('0x41')]=function(_0x18d843,_0xe0356a){var _0x1e0e83={'raw':![],'where':{'id':_0x18d843[_0x2bbe('0x42')]['id']}},_0x5c14db={};_0x5c14db[_0x2bbe('0x43')]=_['keys'](db[_0x2bbe('0x44')][_0x2bbe('0x3a')]);_0x5c14db[_0x2bbe('0x45')]=_['keys'](_0x18d843[_0x2bbe('0x45')]);_0x5c14db['filters']=_[_0x2bbe('0x46')](_0x5c14db[_0x2bbe('0x43')],_0x5c14db[_0x2bbe('0x45')]);_0x1e0e83[_0x2bbe('0x47')]=_[_0x2bbe('0x46')](_0x5c14db[_0x2bbe('0x43')],qs['fields'](_0x18d843['query'][_0x2bbe('0x48')]));_0x1e0e83[_0x2bbe('0x47')]=_0x1e0e83[_0x2bbe('0x47')][_0x2bbe('0x49')]?_0x1e0e83[_0x2bbe('0x47')]:_0x5c14db[_0x2bbe('0x43')];if(_0x18d843[_0x2bbe('0x45')][_0x2bbe('0x4a')]){_0x1e0e83[_0x2bbe('0x4b')]=[{'all':!![]}];}_0x1e0e83=_[_0x2bbe('0x4c')]({},_0x1e0e83,_0x18d843['options']);return db['ChatInteraction'][_0x2bbe('0x4d')](_0x1e0e83)[_0x2bbe('0x1b')](handleEntityNotFound(_0xe0356a,null))[_0x2bbe('0x1b')](respondWithResult(_0xe0356a,null))['catch'](handleError(_0xe0356a,null));};exports[_0x2bbe('0x4e')]=function(_0x49e2fd,_0x536c16){return db[_0x2bbe('0x44')]['create'](_0x49e2fd[_0x2bbe('0x34')],{})[_0x2bbe('0x1b')](respondWithResult(_0x536c16,0xc9))[_0x2bbe('0x40')](handleError(_0x536c16,null));};exports[_0x2bbe('0x2f')]=function(_0x2b29e0,_0x4ee558){if(_0x2b29e0[_0x2bbe('0x34')]['id']){delete _0x2b29e0[_0x2bbe('0x34')]['id'];}return db[_0x2bbe('0x44')][_0x2bbe('0x4d')]({'where':{'id':_0x2b29e0[_0x2bbe('0x42')]['id']}})[_0x2bbe('0x1b')](handleEntityNotFound(_0x4ee558,null))['then'](saveUpdates(_0x2b29e0['body'],null))[_0x2bbe('0x1b')](respondWithResult(_0x4ee558,null))[_0x2bbe('0x40')](handleError(_0x4ee558,null));};exports[_0x2bbe('0x4f')]=function(_0x4383c6,_0x76ad26){return db['ChatInteraction'][_0x2bbe('0x4d')]({'where':{'id':_0x4383c6['params']['id']}})[_0x2bbe('0x1b')](handleEntityNotFound(_0x76ad26,null))['then'](removeEntity(_0x76ad26,null))[_0x2bbe('0x40')](handleError(_0x76ad26,null));};exports['describe']=function(_0x56d776,_0x258250){return db['ChatInteraction'][_0x2bbe('0x50')]()[_0x2bbe('0x1b')](respondWithResult(_0x258250,null))[_0x2bbe('0x40')](handleError(_0x258250,null));};exports[_0x2bbe('0x51')]=function(_0x2c6226,_0x2594af){var _0x321725=_0x2c6226[_0x2bbe('0x42')]['id'];var _0x4a46fc;var _0x3f5790;var _0x294c1b;return db[_0x2bbe('0x44')]['findOne']({'where':{'id':_0x321725}})['then'](function(_0xb35f87){_0x4a46fc=_0xb35f87;return db[_0x2bbe('0x52')][_0x2bbe('0x53')]({'where':{'id':_0xb35f87[_0x2bbe('0x54')]},'attributes':['id','vidaooApiKey',_0x2bbe('0x55'),_0x2bbe('0x56'),'vidaooNote',_0x2bbe('0x57')],'raw':!![]});})[_0x2bbe('0x1b')](function(_0x30f203){if(_0x30f203&&_0x30f203[_0x2bbe('0x58')]&&_0x30f203[_0x2bbe('0x55')]){_0x3f5790=_0x30f203;var _0x1c08df={'interaction':{'id':_0x321725},'agent':{'id':_0x2c6226[_0x2bbe('0x59')]['id'],'name':_0x2c6226[_0x2bbe('0x59')]['name'],'fullname':_0x2c6226[_0x2bbe('0x59')]['fullname'],'email':_0x2c6226[_0x2bbe('0x59')][_0x2bbe('0x5a')]},'contact':_0x2c6226[_0x2bbe('0x34')][_0x2bbe('0x35')],'account':_0x2c6226['body'][_0x2bbe('0x5b')]};var _0x279049={'rejectUnauthorized':![],'method':_0x2bbe('0x5c'),'url':_0x2bbe('0x5d'),'headers':{'X-APIKEY':_0x30f203[_0x2bbe('0x58')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2c6226['user'][_0x2bbe('0x5a')]],'buttons':null,'topic':_0x3f5790[_0x2bbe('0x56')],'note':_[_0x2bbe('0x5e')](_0x3f5790['vidaooNote'])?null:getMustacheRender(_0x3f5790[_0x2bbe('0x5f')],_0x1c08df),'metadata':null},'redirect':_0x2bbe('0x60'),'json':!![]};try{if(!_['isNull'](_0x3f5790[_0x2bbe('0x57')])){var _0x40416b=getMustacheRender(_0x3f5790['vidaooMetadata'],_0x1c08df);var _0x3988e8=JSON[_0x2bbe('0x61')](_0x40416b);_0x279049['body'][_0x2bbe('0x62')]=_0x3988e8;}}catch(_0x54fca7){throw new db[(_0x2bbe('0x63'))]['ValidationError'](_0x2bbe('0x64'));}return rp(_0x279049);}else{throw new db['Sequelize'][(_0x2bbe('0x65'))](_0x2bbe('0x66'));}})['then'](function(_0x36b95a){_0x294c1b=_0x36b95a;if(_0x294c1b['id']){var _0x219e66={'body':_0x294c1b['join_url'],'ChatWebsiteId':_0x3f5790['id'],'ChatInteractionId':_0x4a46fc['id'],'direction':_0x2bbe('0x67'),'UserId':_0x2c6226['user']['id']};return db[_0x2bbe('0x68')][_0x2bbe('0x4e')](_0x219e66,{});}else{throw new db['Sequelize'][(_0x2bbe('0x65'))](_0x2bbe('0x69'));}})[_0x2bbe('0x1b')](function(){return _0x4a46fc['updateAttributes']({'vidaooSessionId':_0x294c1b['id']});})[_0x2bbe('0x1b')](respondWithResult(_0x2594af,null))['catch'](handleError(_0x2594af,null));};exports['customUpdate']=function(_0x2aad72,_0xbca34){if(_0x2aad72[_0x2bbe('0x34')]['id']){delete _0x2aad72[_0x2bbe('0x34')]['id'];}return db[_0x2bbe('0x44')][_0x2bbe('0x4d')]({'where':{'id':_0x2aad72[_0x2bbe('0x42')]['id']},'include':[{'model':db[_0x2bbe('0x6a')],'as':_0x2bbe('0x6b')}]})[_0x2bbe('0x1b')](handleEntityNotFound(_0xbca34,null))[_0x2bbe('0x1b')](saveUpdates(_0x2aad72[_0x2bbe('0x34')],null))['then'](respondWithResult(_0xbca34,null))[_0x2bbe('0x40')](handleError(_0xbca34,null));};exports['abandon']=function(_0x137ee3,_0x4c0fe4){if(_0x137ee3[_0x2bbe('0x34')]['id']){delete _0x137ee3['body']['id'];}return db['ChatInteraction'][_0x2bbe('0x4d')]({'where':{'id':_0x137ee3['params']['id']}})['then'](function(_0x9f46e8){if(!_0x9f46e8){logger[_0x2bbe('0x21')](_0x2bbe('0x6c'),_0x2bbe('0x6d'),0x194,_0x2bbe('0x6e'));_0x4c0fe4[_0x2bbe('0x26')](0x194);}else{if(_0x9f46e8['UserId']){throw new db[(_0x2bbe('0x63'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x9f46e8;})[_0x2bbe('0x1b')](function(_0x1be866){if(_0x1be866){return _0x1be866[_0x2bbe('0x2f')]({'closed':_0x137ee3[_0x2bbe('0x34')][_0x2bbe('0x6f')],'disposition':_0x137ee3[_0x2bbe('0x34')][_0x2bbe('0x70')]})['then'](function(_0x3f0dec){return _0x3f0dec;});}})['then'](function(){return respondWithRpcPromise(_0x2bbe('0x71'),_0x2bbe('0x6d'),_0x137ee3[_0x2bbe('0x34')],client9004);})[_0x2bbe('0x1b')](respondWithResult(_0x4c0fe4,null))[_0x2bbe('0x40')](handleError(_0x4c0fe4,null));};exports[_0x2bbe('0x72')]=function(_0x34e1e8,_0x1c18db){_0x34e1e8['body'][_0x2bbe('0x31')]=_0x34e1e8[_0x2bbe('0x73')]['originalname'];_0x34e1e8[_0x2bbe('0x34')][_0x2bbe('0x74')]=_0x34e1e8[_0x2bbe('0x73')][_0x2bbe('0x75')];_0x34e1e8['body'][_0x2bbe('0x3c')]=_0x34e1e8[_0x2bbe('0x73')][_0x2bbe('0x76')];return db[_0x2bbe('0x77')][_0x2bbe('0x4e')](_0x34e1e8['body'])[_0x2bbe('0x1b')](respondWithResult(_0x1c18db,0xc9))[_0x2bbe('0x40')](handleError(_0x1c18db,null));};exports[_0x2bbe('0x78')]=function(_0x31ffbb,_0x30ca34){return db['ChatInteraction']['findOne']({'where':{'id':_0x31ffbb['params']['id']},'raw':!![]})[_0x2bbe('0x1b')](handleEntityNotFound(_0x30ca34,null))['then'](function(_0xd4489){if(_0xd4489){if(_0xd4489[_0x2bbe('0x6f')]){return _0x30ca34[_0x2bbe('0x27')](0x193)[_0x2bbe('0x29')]({'status':0x193,'message':_0x2bbe('0x79')});}return db[_0x2bbe('0x77')]['findOne']({'where':{'id':_0x31ffbb[_0x2bbe('0x45')][_0x2bbe('0x7a')]},'raw':!![]})['then'](handleEntityNotFound(_0x30ca34,null));}})[_0x2bbe('0x1b')](function(_0x285403){if(_0x285403){var _0x5b5b33=_0x285403[_0x2bbe('0x7b')]!==null;var _0x40f1f3=path['join'](config[_0x2bbe('0x7c')],_0x2bbe('0x7d'));if(_0x5b5b33){_0x40f1f3=path['join'](_0x40f1f3,'offline-chat/');}var _0x1e3c4a=path[_0x2bbe('0x7e')](_0x40f1f3,_0x285403[_0x2bbe('0x74')]);return _0x30ca34['download'](_0x1e3c4a);}})[_0x2bbe('0x40')](handleError(_0x30ca34,null));};exports['close']=function(_0x17ff10,_0x40ec73){var _0x520be6=null;var _0x46717b=null;var _0x5d85f7=null;if(_0x17ff10[_0x2bbe('0x34')]['id']){delete _0x17ff10[_0x2bbe('0x34')]['id'];}if(_0x17ff10['body'][_0x2bbe('0x7f')]){_0x5d85f7=path['join'](config[_0x2bbe('0x7c')],_0x2bbe('0x80'),util[_0x2bbe('0x81')]('transcript-%s.txt',Date[_0x2bbe('0x82')]()));_0x17ff10['body'][_0x2bbe('0x83')]=_0x5d85f7;}return db[_0x2bbe('0x44')][_0x2bbe('0x4d')]({'where':{'id':_0x17ff10[_0x2bbe('0x42')]['id']},'include':[{'model':db[_0x2bbe('0x68')],'as':'Messages','include':[{'model':db[_0x2bbe('0x84')],'as':_0x2bbe('0x84')}]}]})['then'](handleEntityNotFound(_0x40ec73,null))[_0x2bbe('0x1b')](saveUpdates(_0x17ff10[_0x2bbe('0x34')],null))['then'](function(_0x25b553){if(_0x25b553){_0x520be6=_0x25b553;return db[_0x2bbe('0x52')]['find']({'where':{'id':_0x520be6[_0x2bbe('0x54')]}});}})[_0x2bbe('0x1b')](function(_0x414610){if(_0x414610){_0x46717b=_0x414610;return db[_0x2bbe('0x6a')][_0x2bbe('0x4d')]({'where':{'id':_0x520be6[_0x2bbe('0x85')]}});}})[_0x2bbe('0x1b')](function(_0x38331c){if(_0x38331c){if(_0x5d85f7){var _0x4e875c=null;for(var _0x343dd0=0x1;_0x343dd0<_0x520be6[_0x2bbe('0x86')][_0x2bbe('0x49')];++_0x343dd0){_0x4e875c=_0x520be6[_0x2bbe('0x86')][_0x343dd0];var _0x3bb2b6=_0x4e875c['UserId']?util[_0x2bbe('0x81')](_0x2bbe('0x87'),_0x46717b['agentAlias'],_0x4e875c[_0x2bbe('0x88')]):_0x2bbe('0x89');var _0x456cca=_0x17ff10['body'][_0x2bbe('0x8a')]||util[_0x2bbe('0x81')](_0x2bbe('0x87'),_0x2bbe('0x8b'),_0x4e875c['ContactId']);switch(_0x46717b[_0x2bbe('0x8c')]){case _0x2bbe('0x8d'):_0x3bb2b6=_0x4e875c[_0x2bbe('0x88')]?util[_0x2bbe('0x81')](_0x2bbe('0x87'),_0x46717b[_0x2bbe('0x8e')],_0x4e875c[_0x2bbe('0x88')]):_0x2bbe('0x89');break;case _0x2bbe('0x8f'):_0x3bb2b6=_0x4e875c[_0x2bbe('0x88')]?_0x4e875c['User'][_0x2bbe('0x90')]||_0x4e875c[_0x2bbe('0x84')]['fullname']:_0x2bbe('0x89');break;case _0x2bbe('0x91'):_0x3bb2b6=_0x4e875c[_0x2bbe('0x88')]?_0x4e875c[_0x2bbe('0x84')]['fullname']:_0x2bbe('0x89');break;default:_0x3bb2b6=_0x4e875c[_0x2bbe('0x88')]?util['format'](_0x2bbe('0x87'),_0x46717b[_0x2bbe('0x8e')],_0x4e875c[_0x2bbe('0x88')]):'System';}var _0x4eaad7=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x4e875c['createdAt'])[_0x2bbe('0x81')](_0x2bbe('0x92')),_0x4e875c['direction']==='in'?_0x456cca:_0x3bb2b6,_0x4e875c[_0x2bbe('0x34')]);if(!_0x4e875c[_0x2bbe('0x93')]){fs['appendFileSync'](_0x5d85f7,_0x4eaad7);}}return db[_0x2bbe('0x94')][_0x2bbe('0x53')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2bbe('0x95'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2bbe('0x96'),'raw':!![]}]}]});}}})[_0x2bbe('0x1b')](function(_0x2afeb1){if(!_0x2afeb1||!_0x2afeb1['Smtp']||!_0x17ff10[_0x2bbe('0x34')])return _0x520be6;var _0x406ec8=_0x2afeb1[_0x2bbe('0x97')]();return respondWithRpcPromise(_0x2bbe('0x98'),'sendMail',{'account':_0x406ec8,'message':{'from':util[_0x2bbe('0x81')](_0x2bbe('0x99'),_0x2afeb1['name'],_0x2afeb1['email']||_0x2afeb1[_0x2bbe('0x95')][_0x2bbe('0x59')]),'to':_0x17ff10[_0x2bbe('0x34')][_0x2bbe('0x7f')],'subject':_0x2bbe('0x9a'),'text':util['format'](_0x2bbe('0x9b'),_0x17ff10[_0x2bbe('0x34')][_0x2bbe('0x7f')]),'attachments':[{'path':_0x5d85f7}]}})[_0x2bbe('0x1b')](function(){return _0x520be6;})[_0x2bbe('0x40')](function(_0x490ff5){logger['error'](_0x490ff5);});})[_0x2bbe('0x1b')](respondWithStatusCode(_0x40ec73,0xc8))[_0x2bbe('0x40')](handleError(_0x40ec73,null));};exports[_0x2bbe('0x9c')]=function(_0x586257,_0x72f34e){return db[_0x2bbe('0x68')]['find']({'where':{'id':_0x586257[_0x2bbe('0x42')]['id']}})[_0x2bbe('0x1b')](handleEntityNotFound(_0x72f34e,null))['then'](function(_0x5dfd91){if(_0x5dfd91){return _0x5dfd91[_0x2bbe('0x9c')](_0x586257['body'][_0x2bbe('0x9d')],_[_0x2bbe('0x9e')](_0x586257['body'],[_0x2bbe('0x9d'),'id'])||{});}})[_0x2bbe('0x1b')](respondWithResult(_0x72f34e,null))[_0x2bbe('0x40')](handleError(_0x72f34e,null));};exports[_0x2bbe('0x9f')]=function(_0x3a6c4c,_0x35db64){var _0x141139={'raw':![],'where':{}};var _0x449419={};var _0x461ef9={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2bbe('0x53')]({'where':{'id':_0x3a6c4c['params']['id']}})['then'](handleEntityNotFound(_0x35db64,null))['then'](function(_0x4b7358){if(_0x4b7358){_0x449419['model']=_[_0x2bbe('0xa0')](db[_0x2bbe('0x68')][_0x2bbe('0x3a')]);_0x449419['query']=_[_0x2bbe('0xa0')](_0x3a6c4c[_0x2bbe('0x45')]);_0x449419[_0x2bbe('0xa1')]=_['intersection'](_0x449419[_0x2bbe('0x43')],_0x449419[_0x2bbe('0x45')]);_0x141139['attributes']=_[_0x2bbe('0x46')](_0x449419[_0x2bbe('0x43')],qs['fields'](_0x3a6c4c[_0x2bbe('0x45')][_0x2bbe('0x48')]));_0x141139[_0x2bbe('0x47')]=_0x141139[_0x2bbe('0x47')][_0x2bbe('0x49')]?_0x141139[_0x2bbe('0x47')]:_0x449419[_0x2bbe('0x43')];if(!_0x3a6c4c[_0x2bbe('0x45')][_0x2bbe('0xa2')](_0x2bbe('0xa3'))){_0x141139[_0x2bbe('0xa4')]=qs[_0x2bbe('0xa4')](_0x3a6c4c['query'][_0x2bbe('0xa4')]);_0x141139['offset']=qs[_0x2bbe('0x2c')](_0x3a6c4c[_0x2bbe('0x45')]['offset']);}_0x141139['order']=qs[_0x2bbe('0xa5')](_0x3a6c4c['query'][_0x2bbe('0xa5')]);_0x141139[_0x2bbe('0xa6')]=qs[_0x2bbe('0xa1')](_['pick'](_0x3a6c4c['query'],_0x449419[_0x2bbe('0xa1')]));_0x141139[_0x2bbe('0xa6')][_0x2bbe('0xa7')]=_0x4b7358['id'];if(_0x3a6c4c[_0x2bbe('0x45')][_0x2bbe('0xa8')]){_0x141139[_0x2bbe('0xa6')]=_[_0x2bbe('0x4c')](_0x141139[_0x2bbe('0xa6')],{'$or':_[_0x2bbe('0x39')](_0x141139['attributes'],function(_0x1c61d7){var _0x5a0875={};_0x5a0875[_0x1c61d7]={'$like':'%'+_0x3a6c4c[_0x2bbe('0x45')][_0x2bbe('0xa8')]+'%'};return _0x5a0875;})});}if(_0x3a6c4c[_0x2bbe('0x45')][_0x2bbe('0xa9')]){var _0x375175=_0x3a6c4c[_0x2bbe('0x45')][_0x2bbe('0xa9')]['split'](',');var _0x21962b={};_0x21962b[_0x375175[0x0]]={'$gte':moment(_0x375175[0x1])[_0x2bbe('0x81')](_0x2bbe('0xaa'))};_0x141139[_0x2bbe('0xa6')]=_[_0x2bbe('0x4c')](_0x141139[_0x2bbe('0xa6')],_0x21962b);}_0x141139=_[_0x2bbe('0x4c')]({},_0x141139,_0x3a6c4c[_0x2bbe('0xab')]);return db['ChatMessage'][_0x2bbe('0x2b')]({'where':_0x141139[_0x2bbe('0xa6')]})[_0x2bbe('0x1b')](function(_0x38f2c4){_0x461ef9[_0x2bbe('0x2b')]=_0x38f2c4;if(_0x3a6c4c[_0x2bbe('0x45')][_0x2bbe('0x4a')]){_0x141139[_0x2bbe('0x4b')]=[{'all':!![]}];}return db[_0x2bbe('0x68')][_0x2bbe('0x3e')](_0x141139);})[_0x2bbe('0x1b')](function(_0x4e996d){_0x461ef9['rows']=_0x4e996d;return _0x461ef9;});}})[_0x2bbe('0x1b')](respondWithFilteredResult(_0x35db64,_0x141139))[_0x2bbe('0x40')](handleError(_0x35db64,null));};exports[_0x2bbe('0xac')]=function(_0x3bfbad,_0x5cfa02){var _0x1e9c2c={'where':{}},_0x524024={},_0x54ecaf={'count':0x0,'rows':[]};return db[_0x2bbe('0x44')][_0x2bbe('0x53')]({'where':{'id':_0x3bfbad[_0x2bbe('0x42')]['id']}})['then'](handleEntityNotFound(_0x5cfa02,null))[_0x2bbe('0x1b')](function(_0x173ae9){if(_0x173ae9){_0x524024['model']=_[_0x2bbe('0xa0')](db[_0x2bbe('0x68')]['rawAttributes']);_0x524024[_0x2bbe('0x45')]=_[_0x2bbe('0xa0')](_0x3bfbad[_0x2bbe('0x45')]);_0x524024['filters']=_[_0x2bbe('0x46')](_0x524024[_0x2bbe('0x43')],_0x524024[_0x2bbe('0x45')]);_0x1e9c2c['attributes']=_[_0x2bbe('0x46')](_0x524024[_0x2bbe('0x43')],qs['fields'](_0x3bfbad[_0x2bbe('0x45')][_0x2bbe('0x48')]));_0x1e9c2c[_0x2bbe('0x47')]=_0x1e9c2c[_0x2bbe('0x47')][_0x2bbe('0x49')]?_0x1e9c2c[_0x2bbe('0x47')]:_0x524024[_0x2bbe('0x43')];if(!_0x3bfbad['query'][_0x2bbe('0xa2')]('nolimit')){_0x1e9c2c[_0x2bbe('0xa4')]=qs['limit'](_0x3bfbad[_0x2bbe('0x45')][_0x2bbe('0xa4')]);_0x1e9c2c[_0x2bbe('0x2c')]=qs[_0x2bbe('0x2c')](_0x3bfbad['query']['offset']);}_0x1e9c2c['order']=qs[_0x2bbe('0xa5')](_0x3bfbad[_0x2bbe('0x45')][_0x2bbe('0xa5')]);_0x1e9c2c[_0x2bbe('0xa6')]=qs['filters'](_['pick'](_0x3bfbad[_0x2bbe('0x45')],_0x524024[_0x2bbe('0xa1')]));_0x1e9c2c[_0x2bbe('0xa6')][_0x2bbe('0xa7')]=_0x173ae9['id'];if(_0x3bfbad[_0x2bbe('0x45')][_0x2bbe('0xa8')]){_0x1e9c2c[_0x2bbe('0xa6')]=_[_0x2bbe('0x4c')](_0x1e9c2c['where'],{'$or':_[_0x2bbe('0x39')](_0x1e9c2c[_0x2bbe('0x47')],function(_0xbd1314){var _0x340055={};_0x340055[_0xbd1314]={'$like':'%'+_0x3bfbad[_0x2bbe('0x45')]['filter']+'%'};return _0x340055;})});}_0x1e9c2c['where'][_0x2bbe('0x93')]=![];if(_0x3bfbad[_0x2bbe('0x45')]['id']){_0x1e9c2c['where']['id']={'$gt':_0x3bfbad[_0x2bbe('0x45')]['id']};}_0x1e9c2c=_[_0x2bbe('0x4c')]({},_0x1e9c2c,_0x3bfbad[_0x2bbe('0xab')]);return db[_0x2bbe('0x68')][_0x2bbe('0x2b')]({'where':_0x1e9c2c['where']})[_0x2bbe('0x1b')](function(_0x416d32){_0x54ecaf[_0x2bbe('0x2b')]=_0x416d32;_0x1e9c2c['include']=[];if(_0x3bfbad[_0x2bbe('0x45')]['includeAgent']){_0x1e9c2c['include'][_0x2bbe('0xad')]({'model':db[_0x2bbe('0x84')],'as':_0x2bbe('0x84'),'attributes':['id',_0x2bbe('0xae'),_0x2bbe('0x90')]});}if(_0x3bfbad[_0x2bbe('0x45')][_0x2bbe('0x4a')]){_0x1e9c2c[_0x2bbe('0x4b')]=[{'all':!![]}];}return db[_0x2bbe('0x68')][_0x2bbe('0x3e')](_0x1e9c2c);})['then'](function(_0x9352e){_0x54ecaf['rows']=_0x9352e;return _0x54ecaf;});}})[_0x2bbe('0x1b')](respondWithFilteredResult(_0x5cfa02,_0x1e9c2c))[_0x2bbe('0x40')](handleError(_0x5cfa02,null));};exports[_0x2bbe('0xaf')]=function(_0xa2f378,_0x46f6ad){return db[_0x2bbe('0x44')][_0x2bbe('0x4d')]({'where':{'id':_0xa2f378['params']['id']}})[_0x2bbe('0x1b')](handleEntityNotFound(_0x46f6ad,null))[_0x2bbe('0x1b')](function(_0x18c0f7){if(_0x18c0f7){return _0x18c0f7[_0x2bbe('0xb0')](_0xa2f378['body'][_0x2bbe('0x9d')],_['omit'](_0xa2f378[_0x2bbe('0x34')],[_0x2bbe('0x9d'),'id'])||{})['spread'](function(){return db[_0x2bbe('0xb1')][_0x2bbe('0x3e')]({'attributes':['id',_0x2bbe('0x31'),_0x2bbe('0xb2')],'where':{'id':_0xa2f378[_0x2bbe('0x34')][_0x2bbe('0x9d')]}});})['then'](function(_0x527653){socket[_0x2bbe('0xb3')](_0x2bbe('0xb4'),{'id':Number(_0xa2f378[_0x2bbe('0x42')]['id']),'tags':_0x527653||[]});return{'id':Number(_0xa2f378['params']['id']),'tags':_0x527653||[]};});}})[_0x2bbe('0x1b')](respondWithResult(_0x46f6ad,null))[_0x2bbe('0x40')](handleError(_0x46f6ad,null));};exports[_0x2bbe('0xb5')]=function(_0x2d4b9d,_0x4b7207){return db[_0x2bbe('0x44')][_0x2bbe('0x4d')]({'where':{'id':_0x2d4b9d['params']['id']}})[_0x2bbe('0x1b')](handleEntityNotFound(_0x4b7207,null))[_0x2bbe('0x1b')](function(_0x12a99a){if(_0x12a99a){return _0x12a99a[_0x2bbe('0xb5')](_0x2d4b9d[_0x2bbe('0x45')][_0x2bbe('0x9d')]);}})[_0x2bbe('0x1b')](respondWithStatusCode(_0x4b7207,null))[_0x2bbe('0x40')](handleError(_0x4b7207,null));};exports[_0x2bbe('0xb6')]=function(_0x46f2d0,_0x2722c7){var _0x57361e=moment()['unix']()[_0x2bbe('0xb7')]();var _0x1ee96b=path[_0x2bbe('0x7e')](config['root'],'server',_0x2bbe('0xb8'),_0x2bbe('0xb9'));var _0x2c0ff5=path[_0x2bbe('0x7e')](config[_0x2bbe('0x7c')],_0x2bbe('0xba'),_0x2bbe('0xb8'),_0x2bbe('0xbb'));var _0x26397c=path[_0x2bbe('0x7e')](_0x1ee96b,_0x57361e);var _0x3f5647=util[_0x2bbe('0x81')](_0x2bbe('0xbc'),_0x46f2d0[_0x2bbe('0x42')]['id'],_0x57361e);var _0x5605ff=path['join'](_0x1ee96b,_0x3f5647);var _0x47b8e9=[];_0x47b8e9['push']({'model':db[_0x2bbe('0x84')],'as':_0x2bbe('0x84'),'attributes':['id',_0x2bbe('0xae')],'raw':!![]});_0x47b8e9[_0x2bbe('0xad')]({'model':db[_0x2bbe('0x6a')],'as':_0x2bbe('0x6b'),'attributes':['id','firstName',_0x2bbe('0xbd')],'raw':!![]});if(_0x46f2d0['query'][_0x2bbe('0xbb')]){_0x47b8e9[_0x2bbe('0xad')]({'model':db[_0x2bbe('0x77')],'as':_0x2bbe('0x77'),'raw':!![]});}var _0x59f357=[{'model':db[_0x2bbe('0x68')],'as':_0x2bbe('0x86'),'attributes':['id',_0x2bbe('0x34'),'createdAt',_0x2bbe('0xbe'),_0x2bbe('0x93'),_0x2bbe('0xbf')],'include':_0x47b8e9}];_0x59f357[_0x2bbe('0xad')]({'model':db[_0x2bbe('0x52')],'as':'Account','attributes':['id',_0x2bbe('0x31')]});_0x59f357[_0x2bbe('0xad')]({'model':db[_0x2bbe('0x84')],'as':_0x2bbe('0xc0'),'attributes':['id',_0x2bbe('0xae')]});return db[_0x2bbe('0x44')]['find']({'where':{'id':_0x46f2d0[_0x2bbe('0x42')]['id']},'include':_0x59f357})[_0x2bbe('0x1b')](handleEntityNotFound(_0x2722c7,null))['then'](function(_0x2e3c56){if(_0x2e3c56){var _0x403590=_0x2e3c56[_0x2bbe('0xc1')]({'plain':!![]});fs[_0x2bbe('0xc2')](_0x26397c);var _0x2d3ca4={'channel':'Chat','account':_0x403590[_0x2bbe('0xc3')][_0x2bbe('0x31')],'agent':_0x403590[_0x2bbe('0xc0')]?_0x403590['Owner'][_0x2bbe('0xae')]:'N.A.','createdAt':moment(_0x403590[_0x2bbe('0xc4')])['format'](_0x2bbe('0xaa'))[_0x2bbe('0xb7')](),'closedAt':_0x403590[_0x2bbe('0x6f')]?moment(_0x403590['closedAt'])[_0x2bbe('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2bbe('0xb7')]():'','disposition':_0x403590[_0x2bbe('0x70')],'chatInfo':{'browser':_0x403590[_0x2bbe('0xc5')],'os':_0x403590[_0x2bbe('0xc6')],'referer':_0x403590[_0x2bbe('0xc7')],'customerIp':_0x403590[_0x2bbe('0xc8')],'customerPort':_0x403590['customerPort']?_0x403590[_0x2bbe('0xc9')]:'N.A.'},'messages':_(_0x403590[_0x2bbe('0x86')])[_0x2bbe('0xca')]()[_0x2bbe('0xa8')]({'secret':![]})['map'](function(_0x465b09){if(_0x465b09[_0x2bbe('0x77')]){var _0x35a969=path[_0x2bbe('0x7e')](_0x2c0ff5,_0x465b09['Attachment'][_0x2bbe('0x74')]);if(fs[_0x2bbe('0xcb')](_0x35a969)){fs[_0x2bbe('0xcc')](_0x35a969)[_0x2bbe('0xcd')](fs[_0x2bbe('0xce')](path[_0x2bbe('0x7e')](_0x26397c,_0x465b09[_0x2bbe('0x77')][_0x2bbe('0x74')])));}}return{'date':moment(_0x465b09[_0x2bbe('0xc4')])[_0x2bbe('0x81')](_0x2bbe('0xaa'))['toString'](),'sender':_0x465b09['direction']===_0x2bbe('0x67')?_0x465b09[_0x2bbe('0x84')]?_0x465b09[_0x2bbe('0x84')]['fullname']:_0x2bbe('0x89'):_0x465b09[_0x2bbe('0x6b')][_0x2bbe('0xcf')]+(_0x465b09[_0x2bbe('0x6b')][_0x2bbe('0xbd')]?'\x20'+_0x465b09['Contact'][_0x2bbe('0xbd')]:''),'body':_0x465b09[_0x2bbe('0x77')]?_0x465b09['Attachment'][_0x2bbe('0x74')]:_0x465b09[_0x2bbe('0x34')],'direction':_0x465b09[_0x2bbe('0xbe')]==='out'?'A':'C','secret':_0x465b09[_0x2bbe('0x93')],'read':_0x465b09['read'],'attachment':_0x465b09[_0x2bbe('0x77')]};})[_0x2bbe('0xd0')]()};return ejs[_0x2bbe('0xd1')](path[_0x2bbe('0x7e')](config[_0x2bbe('0x7c')],_0x2bbe('0xba'),_0x2bbe('0xd2'),_0x2bbe('0xd3')),{'interaction':_0x2d3ca4})[_0x2bbe('0x1b')](function(_0x148e1a){var _0x68f19f=path[_0x2bbe('0x7e')](_0x26397c,'transcript-'+_0x403590['id']+'-'+_0x57361e+_0x2bbe('0xd4'));var _0x11ccf8={'path':_0x68f19f,'channel':'Chat','interactionId':_0x403590['id']};return pdf['createPdfFromHTML'](_0x148e1a,_0x11ccf8);})[_0x2bbe('0x1b')](function(){return new Promise(function(_0x47cdce,_0x2eae2e){zipdir(_0x26397c,{'saveTo':_0x5605ff},function(_0x5df2e2,_0x3d90b2){if(_0x5df2e2)return _0x2eae2e(_0x5df2e2);return _0x47cdce(_0x3d90b2);});})[_0x2bbe('0x1b')](function(){return new BPromise(function(_0x145057,_0x242bb4){rimraf(_0x26397c,function(_0x2feb19){if(_0x2feb19)_0x242bb4(_0x2feb19);return _0x145057();});});})[_0x2bbe('0x1b')](function(){return _0x2722c7[_0x2bbe('0xb6')](_0x5605ff,_0x3f5647,function(_0x4bf0f9){if(_0x4bf0f9){logger[_0x2bbe('0x21')](_0x2bbe('0xd5'),_0x4bf0f9);}else{fs[_0x2bbe('0xd6')](_0x5605ff);}});});});}else{return _0x2722c7['sendStatus'](0xc8);}})[_0x2bbe('0x40')](handleError(_0x2722c7,null));}; \ No newline at end of file +var _0xd014=['chatInteractionTags:save','removeTags','download','unix','toString','server','files','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','get','mkdirSync','N.A.','createdAt','closedAt','browserName','customerIp','customerPort','tail','basename','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','.pdf','Chat','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','name','send','render','merge','body','contact','interaction','account','map','ChatInteraction','rawAttributes','fieldName','type','key','findAll','chat','query','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','filename','file','mimetype','attachmentDownload','closed','Attachment','join','root','offline-chat/','mailTranscript','server/files/chat/upload/','transcript-%s.txt','ChatMessage','Messages','User','ContactId','format','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','order','pick','includeAgent','addTags','setTags','omit','spread','Tag','color'];(function(_0x281447,_0x36adae){var _0x4159ee=function(_0xba3eec){while(--_0xba3eec){_0x281447['push'](_0x281447['shift']());}};_0x4159ee(++_0x36adae);}(_0xd014,0xf2));var _0x4d01=function(_0x3a1b6f,_0x46a22e){_0x3a1b6f=_0x3a1b6f-0x0;var _0x4f4de7=_0xd014[_0x3a1b6f];return _0x4f4de7;};'use strict';var rimraf=require(_0x4d01('0x0'));var zipdir=require(_0x4d01('0x1'));var rp=require(_0x4d01('0x2'));var moment=require('moment');var BPromise=require(_0x4d01('0x3'));var Mustache=require(_0x4d01('0x4'));var util=require('util');var path=require(_0x4d01('0x5'));var ejs=require(_0x4d01('0x6'));var fs=require('fs');var _=require(_0x4d01('0x7'));var Redis=require(_0x4d01('0x8'));var interaction=require(_0x4d01('0x9'));var qs=require(_0x4d01('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0x4d01('0xb'))(_0x4d01('0xc'));var config=require('../../config/environment');var db=require(_0x4d01('0xd'))['db'];config['redis']=_['defaults'](config[_0x4d01('0xe')],{'host':_0x4d01('0xf'),'port':0x18eb});var socket=require(_0x4d01('0x10'))(new Redis(config[_0x4d01('0xe')]));require(_0x4d01('0x11'))[_0x4d01('0x12')](socket);var jayson=require(_0x4d01('0x13'));var client=jayson[_0x4d01('0x14')][_0x4d01('0x15')]({'port':0x232b});var client9004=jayson['client'][_0x4d01('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x458d25,_0x421740,_0x15511d,_0x423d1d){return new BPromise(function(_0x2f549e,_0x1c74fd){var _0x294868=_0x423d1d||client;return _0x294868[_0x4d01('0x16')](_0x458d25,_0x15511d)[_0x4d01('0x17')](function(_0x36dc21){logger[_0x4d01('0x18')](_0x4d01('0x19'),_0x421740,_0x4d01('0x1a'));logger[_0x4d01('0x1b')](_0x4d01('0x1c'),_0x421740,_0x4d01('0x1a'),JSON[_0x4d01('0x1d')](_0x36dc21));if(_0x36dc21[_0x4d01('0x1e')]){if(_0x36dc21[_0x4d01('0x1e')]['code']===0x1f4){logger[_0x4d01('0x1e')](_0x4d01('0x19'),_0x421740,_0x36dc21[_0x4d01('0x1e')]['message']);return _0x1c74fd(_0x36dc21[_0x4d01('0x1e')]['message']);}logger[_0x4d01('0x1e')](_0x4d01('0x19'),_0x421740,_0x36dc21[_0x4d01('0x1e')][_0x4d01('0x1f')]);return _0x2f549e(_0x36dc21[_0x4d01('0x1e')][_0x4d01('0x1f')]);}else{logger[_0x4d01('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x421740,_0x4d01('0x1a'));_0x2f549e(_0x36dc21[_0x4d01('0x20')]['message']);}})['catch'](function(_0x1d86ba){logger[_0x4d01('0x1e')](_0x4d01('0x19'),_0x421740,_0x1d86ba);_0x1c74fd(_0x1d86ba);});});}function respondWithStatusCode(_0x1a72c8,_0x3e1c3d){_0x3e1c3d=_0x3e1c3d||0xcc;return function(_0x2d905d){if(_0x2d905d){return _0x1a72c8[_0x4d01('0x21')](_0x3e1c3d);}return _0x1a72c8[_0x4d01('0x22')](_0x3e1c3d)[_0x4d01('0x23')]();};}function respondWithResult(_0x583207,_0x3f82bf){_0x3f82bf=_0x3f82bf||0xc8;return function(_0x32cf1c){if(_0x32cf1c){return _0x583207['status'](_0x3f82bf)[_0x4d01('0x24')](_0x32cf1c);}};}function respondWithFilteredResult(_0x13a3ec,_0x438fd2){return function(_0x4580f1){if(_0x4580f1){var _0x5d7c49=typeof _0x438fd2[_0x4d01('0x25')]===_0x4d01('0x26')&&typeof _0x438fd2[_0x4d01('0x27')]===_0x4d01('0x26');var _0x5927ba=_0x4580f1[_0x4d01('0x28')];var _0x390cae=_0x5d7c49?0x0:_0x438fd2['offset'];var _0x5f26b8=_0x5d7c49?_0x4580f1[_0x4d01('0x28')]:_0x438fd2[_0x4d01('0x25')]+_0x438fd2[_0x4d01('0x27')];var _0xea5988;if(_0x5f26b8>=_0x5927ba){_0x5f26b8=_0x5927ba;_0xea5988=0xc8;}else{_0xea5988=0xce;}_0x13a3ec[_0x4d01('0x22')](_0xea5988);return _0x13a3ec[_0x4d01('0x29')](_0x4d01('0x2a'),_0x390cae+'-'+_0x5f26b8+'/'+_0x5927ba)[_0x4d01('0x24')](_0x4580f1);}return null;};}function saveUpdates(_0x511241){return function(_0x37f82d){if(_0x37f82d){return _0x37f82d[_0x4d01('0x2b')](_0x511241)[_0x4d01('0x17')](function(_0x1dd61b){return _0x1dd61b;});}return null;};}function removeEntity(_0x567ca2){return function(_0xefdf99){if(_0xefdf99){return _0xefdf99['destroy']()['then'](function(){_0x567ca2[_0x4d01('0x22')](0xcc)[_0x4d01('0x23')]();});}};}function handleEntityNotFound(_0x55695e){return function(_0x94d498){if(!_0x94d498){_0x55695e[_0x4d01('0x21')](0x194);}return _0x94d498;};}function handleError(_0x38f1c1,_0x2448bb){_0x2448bb=_0x2448bb||0x1f4;return function(_0x4c8111){logger[_0x4d01('0x1e')](_0x4c8111['stack']);if(_0x4c8111[_0x4d01('0x2c')]){delete _0x4c8111[_0x4d01('0x2c')];}_0x38f1c1[_0x4d01('0x22')](_0x2448bb)[_0x4d01('0x2d')](_0x4c8111);};}function getMustacheRender(_0x2b4f4e,_0x214d10){return Mustache[_0x4d01('0x2e')](_0x2b4f4e,_[_0x4d01('0x2f')](_0x214d10[_0x4d01('0x30')],{'contact':_0x214d10[_0x4d01('0x31')],'message':_0x214d10[_0x4d01('0x1f')],'agent':_0x214d10['agent'],'interaction':_0x214d10[_0x4d01('0x32')],'account':_0x214d10[_0x4d01('0x33')]}))||'';}exports['index']=function(_0x346a1a,_0x2023df){var _0x3ddf67={};var _0x1d4caf=_[_0x4d01('0x34')](db[_0x4d01('0x35')][_0x4d01('0x36')],function(_0x59d5a2){return{'name':_0x59d5a2[_0x4d01('0x37')],'type':_0x59d5a2[_0x4d01('0x38')][_0x4d01('0x39')]};});_0x3ddf67=qs['getOptions'](_0x1d4caf,_0x346a1a);return interaction[_0x4d01('0x3a')](_0x4d01('0x3b'),_0x346a1a[_0x4d01('0x3c')],_0x346a1a['user'],_0x3ddf67,_0x1d4caf)[_0x4d01('0x17')](respondWithFilteredResult(_0x2023df,_0x3ddf67))['catch'](handleError(_0x2023df,null));};exports[_0x4d01('0x3d')]=function(_0x38a640,_0x573df2){var _0x2d659b={'raw':![],'where':{'id':_0x38a640[_0x4d01('0x3e')]['id']}},_0x55fc20={};_0x55fc20[_0x4d01('0x3f')]=_[_0x4d01('0x40')](db['ChatInteraction'][_0x4d01('0x36')]);_0x55fc20['query']=_['keys'](_0x38a640[_0x4d01('0x3c')]);_0x55fc20[_0x4d01('0x41')]=_[_0x4d01('0x42')](_0x55fc20[_0x4d01('0x3f')],_0x55fc20[_0x4d01('0x3c')]);_0x2d659b[_0x4d01('0x43')]=_[_0x4d01('0x42')](_0x55fc20[_0x4d01('0x3f')],qs[_0x4d01('0x44')](_0x38a640['query'][_0x4d01('0x44')]));_0x2d659b['attributes']=_0x2d659b[_0x4d01('0x43')][_0x4d01('0x45')]?_0x2d659b[_0x4d01('0x43')]:_0x55fc20['model'];if(_0x38a640[_0x4d01('0x3c')][_0x4d01('0x46')]){_0x2d659b[_0x4d01('0x47')]=[{'all':!![]}];}_0x2d659b=_[_0x4d01('0x2f')]({},_0x2d659b,_0x38a640[_0x4d01('0x48')]);return db['ChatInteraction'][_0x4d01('0x49')](_0x2d659b)[_0x4d01('0x17')](handleEntityNotFound(_0x573df2,null))['then'](respondWithResult(_0x573df2,null))[_0x4d01('0x4a')](handleError(_0x573df2,null));};exports[_0x4d01('0x4b')]=function(_0x19d439,_0xbf9793){return db[_0x4d01('0x35')][_0x4d01('0x4b')](_0x19d439[_0x4d01('0x30')],{})[_0x4d01('0x17')](respondWithResult(_0xbf9793,0xc9))[_0x4d01('0x4a')](handleError(_0xbf9793,null));};exports[_0x4d01('0x2b')]=function(_0x5e3a4b,_0x44964c){if(_0x5e3a4b['body']['id']){delete _0x5e3a4b[_0x4d01('0x30')]['id'];}return db[_0x4d01('0x35')][_0x4d01('0x49')]({'where':{'id':_0x5e3a4b[_0x4d01('0x3e')]['id']}})[_0x4d01('0x17')](handleEntityNotFound(_0x44964c,null))['then'](saveUpdates(_0x5e3a4b[_0x4d01('0x30')],null))['then'](respondWithResult(_0x44964c,null))[_0x4d01('0x4a')](handleError(_0x44964c,null));};exports[_0x4d01('0x4c')]=function(_0x42b79b,_0x418279){return db['ChatInteraction'][_0x4d01('0x49')]({'where':{'id':_0x42b79b[_0x4d01('0x3e')]['id']}})[_0x4d01('0x17')](handleEntityNotFound(_0x418279,null))[_0x4d01('0x17')](removeEntity(_0x418279,null))[_0x4d01('0x4a')](handleError(_0x418279,null));};exports[_0x4d01('0x4d')]=function(_0x3bc15a,_0x555790){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x555790,null))[_0x4d01('0x4a')](handleError(_0x555790,null));};exports[_0x4d01('0x4e')]=function(_0xa86d22,_0x1b9f1e){var _0x102e37=_0xa86d22['params']['id'];var _0x48919f;var _0x205cf2;var _0x135c70;return db['ChatInteraction'][_0x4d01('0x4f')]({'where':{'id':_0x102e37}})[_0x4d01('0x17')](function(_0x2371c7){_0x48919f=_0x2371c7;return db[_0x4d01('0x50')][_0x4d01('0x4f')]({'where':{'id':_0x2371c7[_0x4d01('0x51')]},'attributes':['id',_0x4d01('0x52'),_0x4d01('0x53'),_0x4d01('0x54'),_0x4d01('0x55'),_0x4d01('0x56')],'raw':!![]});})[_0x4d01('0x17')](function(_0x407756){if(_0x407756&&_0x407756['vidaooApiKey']&&_0x407756['vidaooEscalation']){_0x205cf2=_0x407756;var _0x5c9881={'interaction':{'id':_0x102e37},'agent':{'id':_0xa86d22['user']['id'],'name':_0xa86d22[_0x4d01('0x57')][_0x4d01('0x2c')],'fullname':_0xa86d22['user'][_0x4d01('0x58')],'email':_0xa86d22[_0x4d01('0x57')][_0x4d01('0x59')]},'contact':_0xa86d22[_0x4d01('0x30')][_0x4d01('0x31')],'account':_0xa86d22[_0x4d01('0x30')]['account']};var _0xd2d921={'rejectUnauthorized':![],'method':_0x4d01('0x5a'),'url':_0x4d01('0x5b'),'headers':{'X-APIKEY':_0x407756[_0x4d01('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xa86d22[_0x4d01('0x57')][_0x4d01('0x59')]],'buttons':null,'topic':_0x205cf2[_0x4d01('0x54')],'note':_[_0x4d01('0x5c')](_0x205cf2[_0x4d01('0x55')])?null:getMustacheRender(_0x205cf2['vidaooNote'],_0x5c9881),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x205cf2[_0x4d01('0x56')])){var _0x390c26=getMustacheRender(_0x205cf2['vidaooMetadata'],_0x5c9881);var _0x5ccfb6=JSON[_0x4d01('0x5d')](_0x390c26);_0xd2d921[_0x4d01('0x30')][_0x4d01('0x5e')]=_0x5ccfb6;}}catch(_0x390e0c){throw new db[(_0x4d01('0x5f'))]['ValidationError'](_0x4d01('0x60'));}return rp(_0xd2d921);}else{throw new db['Sequelize']['ValidationError'](_0x4d01('0x61'));}})['then'](function(_0x1ceda8){_0x135c70=_0x1ceda8;if(_0x135c70['id']){var _0x6a5bf5={'body':_0x135c70[_0x4d01('0x62')],'ChatWebsiteId':_0x205cf2['id'],'ChatInteractionId':_0x48919f['id'],'direction':_0x4d01('0x63'),'UserId':_0xa86d22[_0x4d01('0x57')]['id']};return db['ChatMessage'][_0x4d01('0x4b')](_0x6a5bf5,{});}else{throw new db[(_0x4d01('0x5f'))][(_0x4d01('0x64'))](_0x4d01('0x65'));}})[_0x4d01('0x17')](function(){return _0x48919f[_0x4d01('0x66')]({'vidaooSessionId':_0x135c70['id']});})[_0x4d01('0x17')](respondWithResult(_0x1b9f1e,null))[_0x4d01('0x4a')](handleError(_0x1b9f1e,null));};exports[_0x4d01('0x67')]=function(_0x47a9e3,_0x8f53d1){if(_0x47a9e3['body']['id']){delete _0x47a9e3['body']['id'];}return db[_0x4d01('0x35')][_0x4d01('0x49')]({'where':{'id':_0x47a9e3[_0x4d01('0x3e')]['id']},'include':[{'model':db[_0x4d01('0x68')],'as':_0x4d01('0x69')}]})[_0x4d01('0x17')](handleEntityNotFound(_0x8f53d1,null))[_0x4d01('0x17')](saveUpdates(_0x47a9e3[_0x4d01('0x30')],null))['then'](respondWithResult(_0x8f53d1,null))[_0x4d01('0x4a')](handleError(_0x8f53d1,null));};exports['abandon']=function(_0x11e856,_0x15c51a){if(_0x11e856['body']['id']){delete _0x11e856['body']['id'];}return db['ChatInteraction'][_0x4d01('0x49')]({'where':{'id':_0x11e856['params']['id']}})[_0x4d01('0x17')](function(_0x341cee){if(!_0x341cee){logger[_0x4d01('0x1e')](_0x4d01('0x6a'),_0x4d01('0x6b'),0x194,'entity\x20not\x20found');_0x15c51a[_0x4d01('0x21')](0x194);}else{if(_0x341cee[_0x4d01('0x6c')]){throw new db[(_0x4d01('0x5f'))][(_0x4d01('0x64'))](_0x4d01('0x6d'));}}return _0x341cee;})['then'](function(_0x1298dc){if(_0x1298dc){return _0x1298dc['update']({'closed':_0x11e856[_0x4d01('0x30')]['closed'],'disposition':_0x11e856['body'][_0x4d01('0x6e')]})[_0x4d01('0x17')](function(_0x5db6cf){return _0x5db6cf;});}})[_0x4d01('0x17')](function(){return respondWithRpcPromise(_0x4d01('0x6f'),'abandon',_0x11e856[_0x4d01('0x30')],client9004);})['then'](respondWithResult(_0x15c51a,null))[_0x4d01('0x4a')](handleError(_0x15c51a,null));};exports[_0x4d01('0x70')]=function(_0x1c2dc9,_0x16a555){_0x1c2dc9['body'][_0x4d01('0x2c')]=_0x1c2dc9['file']['originalname'];_0x1c2dc9[_0x4d01('0x30')]['basename']=_0x1c2dc9['file'][_0x4d01('0x71')];_0x1c2dc9[_0x4d01('0x30')][_0x4d01('0x38')]=_0x1c2dc9[_0x4d01('0x72')][_0x4d01('0x73')];return db['Attachment'][_0x4d01('0x4b')](_0x1c2dc9['body'])[_0x4d01('0x17')](respondWithResult(_0x16a555,0xc9))[_0x4d01('0x4a')](handleError(_0x16a555,null));};exports[_0x4d01('0x74')]=function(_0x366bef,_0x149b82){return db['ChatInteraction'][_0x4d01('0x4f')]({'where':{'id':_0x366bef[_0x4d01('0x3e')]['id']},'raw':!![]})[_0x4d01('0x17')](handleEntityNotFound(_0x149b82,null))[_0x4d01('0x17')](function(_0x1f6250){if(_0x1f6250){if(_0x1f6250[_0x4d01('0x75')]){return _0x149b82[_0x4d01('0x22')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x4d01('0x76')][_0x4d01('0x4f')]({'where':{'id':_0x366bef[_0x4d01('0x3c')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x149b82,null));}})[_0x4d01('0x17')](function(_0x202f10){if(_0x202f10){var _0x2e420f=_0x202f10['ChatOfflineMessageId']!==null;var _0x2198d4=path[_0x4d01('0x77')](config[_0x4d01('0x78')],'server/files/attachments/');if(_0x2e420f){_0x2198d4=path[_0x4d01('0x77')](_0x2198d4,_0x4d01('0x79'));}var _0x1b96d3=path[_0x4d01('0x77')](_0x2198d4,_0x202f10['basename']);return _0x149b82['download'](_0x1b96d3);}})['catch'](handleError(_0x149b82,null));};exports['close']=function(_0x3a6d5d,_0x5dec91){var _0x27ec45=null;var _0x1a7039=null;var _0x13103c=null;if(_0x3a6d5d[_0x4d01('0x30')]['id']){delete _0x3a6d5d['body']['id'];}if(_0x3a6d5d[_0x4d01('0x30')][_0x4d01('0x7a')]){_0x13103c=path[_0x4d01('0x77')](config[_0x4d01('0x78')],_0x4d01('0x7b'),util['format'](_0x4d01('0x7c'),Date['now']()));_0x3a6d5d[_0x4d01('0x30')]['pathTranscript']=_0x13103c;}return db[_0x4d01('0x35')]['find']({'where':{'id':_0x3a6d5d['params']['id']},'include':[{'model':db[_0x4d01('0x7d')],'as':_0x4d01('0x7e'),'include':[{'model':db[_0x4d01('0x7f')],'as':_0x4d01('0x7f')}]}]})[_0x4d01('0x17')](handleEntityNotFound(_0x5dec91,null))[_0x4d01('0x17')](saveUpdates(_0x3a6d5d[_0x4d01('0x30')],null))['then'](function(_0x59cf89){if(_0x59cf89){_0x27ec45=_0x59cf89;return db[_0x4d01('0x50')][_0x4d01('0x49')]({'where':{'id':_0x27ec45[_0x4d01('0x51')]}});}})[_0x4d01('0x17')](function(_0x3c84e7){if(_0x3c84e7){_0x1a7039=_0x3c84e7;return db['CmContact'][_0x4d01('0x49')]({'where':{'id':_0x27ec45[_0x4d01('0x80')]}});}})['then'](function(_0x144ba6){if(_0x144ba6){if(_0x13103c){var _0x4b4ed3=null;for(var _0x58b146=0x1;_0x58b146<_0x27ec45[_0x4d01('0x7e')][_0x4d01('0x45')];++_0x58b146){_0x4b4ed3=_0x27ec45['Messages'][_0x58b146];var _0x1d6bef=_0x4b4ed3['UserId']?util[_0x4d01('0x81')](_0x4d01('0x82'),_0x1a7039[_0x4d01('0x83')],_0x4b4ed3[_0x4d01('0x6c')]):_0x4d01('0x84');var _0x220b35=_0x3a6d5d['body']['customer']||util[_0x4d01('0x81')](_0x4d01('0x82'),_0x4d01('0x85'),_0x4b4ed3[_0x4d01('0x80')]);switch(_0x1a7039[_0x4d01('0x86')]){case _0x4d01('0x87'):_0x1d6bef=_0x4b4ed3['UserId']?util[_0x4d01('0x81')](_0x4d01('0x82'),_0x1a7039['agentAlias'],_0x4b4ed3[_0x4d01('0x6c')]):_0x4d01('0x84');break;case _0x4d01('0x88'):_0x1d6bef=_0x4b4ed3[_0x4d01('0x6c')]?_0x4b4ed3['User'][_0x4d01('0x89')]||_0x4b4ed3[_0x4d01('0x7f')][_0x4d01('0x58')]:_0x4d01('0x84');break;case _0x4d01('0x8a'):_0x1d6bef=_0x4b4ed3[_0x4d01('0x6c')]?_0x4b4ed3[_0x4d01('0x7f')][_0x4d01('0x58')]:_0x4d01('0x84');break;default:_0x1d6bef=_0x4b4ed3[_0x4d01('0x6c')]?util[_0x4d01('0x81')](_0x4d01('0x82'),_0x1a7039['agentAlias'],_0x4b4ed3[_0x4d01('0x6c')]):_0x4d01('0x84');}var _0x5671f8=util[_0x4d01('0x81')](_0x4d01('0x8b'),moment(_0x4b4ed3['createdAt'])['format'](_0x4d01('0x8c')),_0x4b4ed3[_0x4d01('0x8d')]==='in'?_0x220b35:_0x1d6bef,_0x4b4ed3[_0x4d01('0x30')]);if(!_0x4b4ed3[_0x4d01('0x8e')]){fs[_0x4d01('0x8f')](_0x13103c,_0x5671f8);}}return db[_0x4d01('0x90')][_0x4d01('0x4f')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4d01('0x91'),'raw':!![],'include':[{'model':db[_0x4d01('0x92')],'as':_0x4d01('0x92'),'raw':!![]}]}]});}}})['then'](function(_0x419a2f){if(!_0x419a2f||!_0x419a2f['Smtp']||!_0x3a6d5d['body'])return _0x27ec45;var _0x42b0cf=_0x419a2f[_0x4d01('0x93')]();return respondWithRpcPromise(_0x4d01('0x94'),'sendMail',{'account':_0x42b0cf,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x419a2f[_0x4d01('0x2c')],_0x419a2f['email']||_0x419a2f[_0x4d01('0x91')][_0x4d01('0x57')]),'to':_0x3a6d5d['body'][_0x4d01('0x7a')],'subject':_0x4d01('0x95'),'text':util[_0x4d01('0x81')](_0x4d01('0x96'),_0x3a6d5d['body']['mailTranscript']),'attachments':[{'path':_0x13103c}]}})['then'](function(){return _0x27ec45;})[_0x4d01('0x4a')](function(_0x3060fe){logger[_0x4d01('0x1e')](_0x3060fe);});})[_0x4d01('0x17')](respondWithStatusCode(_0x5dec91,0xc8))[_0x4d01('0x4a')](handleError(_0x5dec91,null));};exports[_0x4d01('0x97')]=function(_0x45a929,_0x4b46bc){return db['ChatMessage'][_0x4d01('0x49')]({'where':{'id':_0x45a929[_0x4d01('0x3e')]['id']}})[_0x4d01('0x17')](handleEntityNotFound(_0x4b46bc,null))[_0x4d01('0x17')](function(_0x4e5dc5){if(_0x4e5dc5){return _0x4e5dc5[_0x4d01('0x97')](_0x45a929[_0x4d01('0x30')][_0x4d01('0x98')],_['omit'](_0x45a929[_0x4d01('0x30')],[_0x4d01('0x98'),'id'])||{});}})[_0x4d01('0x17')](respondWithResult(_0x4b46bc,null))[_0x4d01('0x4a')](handleError(_0x4b46bc,null));};exports[_0x4d01('0x99')]=function(_0x4a5c66,_0x4c9d09){var _0x5bc1ef={'raw':![],'where':{}};var _0x53d6a7={};var _0x592c55={'count':0x0,'rows':[]};return db[_0x4d01('0x35')][_0x4d01('0x4f')]({'where':{'id':_0x4a5c66[_0x4d01('0x3e')]['id']}})[_0x4d01('0x17')](handleEntityNotFound(_0x4c9d09,null))[_0x4d01('0x17')](function(_0x478af6){if(_0x478af6){_0x53d6a7[_0x4d01('0x3f')]=_['keys'](db[_0x4d01('0x7d')][_0x4d01('0x36')]);_0x53d6a7[_0x4d01('0x3c')]=_['keys'](_0x4a5c66[_0x4d01('0x3c')]);_0x53d6a7[_0x4d01('0x41')]=_[_0x4d01('0x42')](_0x53d6a7['model'],_0x53d6a7['query']);_0x5bc1ef[_0x4d01('0x43')]=_['intersection'](_0x53d6a7[_0x4d01('0x3f')],qs[_0x4d01('0x44')](_0x4a5c66[_0x4d01('0x3c')][_0x4d01('0x44')]));_0x5bc1ef[_0x4d01('0x43')]=_0x5bc1ef[_0x4d01('0x43')]['length']?_0x5bc1ef[_0x4d01('0x43')]:_0x53d6a7['model'];if(!_0x4a5c66[_0x4d01('0x3c')][_0x4d01('0x9a')]('nolimit')){_0x5bc1ef[_0x4d01('0x27')]=qs[_0x4d01('0x27')](_0x4a5c66['query']['limit']);_0x5bc1ef[_0x4d01('0x25')]=qs[_0x4d01('0x25')](_0x4a5c66['query'][_0x4d01('0x25')]);}_0x5bc1ef['order']=qs[_0x4d01('0x9b')](_0x4a5c66[_0x4d01('0x3c')][_0x4d01('0x9b')]);_0x5bc1ef[_0x4d01('0x9c')]=qs[_0x4d01('0x41')](_['pick'](_0x4a5c66[_0x4d01('0x3c')],_0x53d6a7['filters']));_0x5bc1ef['where'][_0x4d01('0x9d')]=_0x478af6['id'];if(_0x4a5c66['query'][_0x4d01('0x9e')]){_0x5bc1ef[_0x4d01('0x9c')]=_[_0x4d01('0x2f')](_0x5bc1ef[_0x4d01('0x9c')],{'$or':_['map'](_0x5bc1ef[_0x4d01('0x43')],function(_0x7df712){var _0x30bdca={};_0x30bdca[_0x7df712]={'$like':'%'+_0x4a5c66[_0x4d01('0x3c')][_0x4d01('0x9e')]+'%'};return _0x30bdca;})});}if(_0x4a5c66[_0x4d01('0x3c')][_0x4d01('0x9f')]){var _0x548cfe=_0x4a5c66['query'][_0x4d01('0x9f')][_0x4d01('0xa0')](',');var _0x16d6e0={};_0x16d6e0[_0x548cfe[0x0]]={'$gte':moment(_0x548cfe[0x1])[_0x4d01('0x81')](_0x4d01('0xa1'))};_0x5bc1ef[_0x4d01('0x9c')]=_[_0x4d01('0x2f')](_0x5bc1ef[_0x4d01('0x9c')],_0x16d6e0);}_0x5bc1ef=_[_0x4d01('0x2f')]({},_0x5bc1ef,_0x4a5c66[_0x4d01('0x48')]);return db[_0x4d01('0x7d')]['count']({'where':_0x5bc1ef[_0x4d01('0x9c')]})[_0x4d01('0x17')](function(_0x267918){_0x592c55['count']=_0x267918;if(_0x4a5c66[_0x4d01('0x3c')]['includeAll']){_0x5bc1ef[_0x4d01('0x47')]=[{'all':!![]}];}return db[_0x4d01('0x7d')][_0x4d01('0x3a')](_0x5bc1ef);})[_0x4d01('0x17')](function(_0x2f04a7){_0x592c55[_0x4d01('0xa2')]=_0x2f04a7;return _0x592c55;});}})['then'](respondWithFilteredResult(_0x4c9d09,_0x5bc1ef))['catch'](handleError(_0x4c9d09,null));};exports['getMyMessages']=function(_0xc5c1bd,_0x302400){var _0x500f13={'where':{}},_0x149290={},_0x2fe294={'count':0x0,'rows':[]};return db[_0x4d01('0x35')][_0x4d01('0x4f')]({'where':{'id':_0xc5c1bd[_0x4d01('0x3e')]['id']}})['then'](handleEntityNotFound(_0x302400,null))['then'](function(_0x5d410a){if(_0x5d410a){_0x149290[_0x4d01('0x3f')]=_[_0x4d01('0x40')](db[_0x4d01('0x7d')][_0x4d01('0x36')]);_0x149290[_0x4d01('0x3c')]=_[_0x4d01('0x40')](_0xc5c1bd[_0x4d01('0x3c')]);_0x149290['filters']=_['intersection'](_0x149290['model'],_0x149290[_0x4d01('0x3c')]);_0x500f13[_0x4d01('0x43')]=_[_0x4d01('0x42')](_0x149290[_0x4d01('0x3f')],qs[_0x4d01('0x44')](_0xc5c1bd[_0x4d01('0x3c')][_0x4d01('0x44')]));_0x500f13[_0x4d01('0x43')]=_0x500f13[_0x4d01('0x43')]['length']?_0x500f13[_0x4d01('0x43')]:_0x149290[_0x4d01('0x3f')];if(!_0xc5c1bd[_0x4d01('0x3c')][_0x4d01('0x9a')]('nolimit')){_0x500f13[_0x4d01('0x27')]=qs[_0x4d01('0x27')](_0xc5c1bd[_0x4d01('0x3c')][_0x4d01('0x27')]);_0x500f13[_0x4d01('0x25')]=qs['offset'](_0xc5c1bd[_0x4d01('0x3c')][_0x4d01('0x25')]);}_0x500f13[_0x4d01('0xa3')]=qs[_0x4d01('0x9b')](_0xc5c1bd['query']['sort']);_0x500f13[_0x4d01('0x9c')]=qs[_0x4d01('0x41')](_[_0x4d01('0xa4')](_0xc5c1bd[_0x4d01('0x3c')],_0x149290['filters']));_0x500f13[_0x4d01('0x9c')]['ChatInteractionId']=_0x5d410a['id'];if(_0xc5c1bd['query'][_0x4d01('0x9e')]){_0x500f13[_0x4d01('0x9c')]=_[_0x4d01('0x2f')](_0x500f13[_0x4d01('0x9c')],{'$or':_[_0x4d01('0x34')](_0x500f13[_0x4d01('0x43')],function(_0x52e423){var _0x5dfce5={};_0x5dfce5[_0x52e423]={'$like':'%'+_0xc5c1bd['query'][_0x4d01('0x9e')]+'%'};return _0x5dfce5;})});}_0x500f13['where'][_0x4d01('0x8e')]=![];if(_0xc5c1bd['query']['id']){_0x500f13[_0x4d01('0x9c')]['id']={'$gt':_0xc5c1bd[_0x4d01('0x3c')]['id']};}_0x500f13=_[_0x4d01('0x2f')]({},_0x500f13,_0xc5c1bd[_0x4d01('0x48')]);return db[_0x4d01('0x7d')][_0x4d01('0x28')]({'where':_0x500f13[_0x4d01('0x9c')]})[_0x4d01('0x17')](function(_0x903f14){_0x2fe294[_0x4d01('0x28')]=_0x903f14;_0x500f13[_0x4d01('0x47')]=[];if(_0xc5c1bd[_0x4d01('0x3c')][_0x4d01('0xa5')]){_0x500f13[_0x4d01('0x47')]['push']({'model':db[_0x4d01('0x7f')],'as':_0x4d01('0x7f'),'attributes':['id',_0x4d01('0x58'),_0x4d01('0x89')]});}if(_0xc5c1bd[_0x4d01('0x3c')][_0x4d01('0x46')]){_0x500f13[_0x4d01('0x47')]=[{'all':!![]}];}return db['ChatMessage'][_0x4d01('0x3a')](_0x500f13);})[_0x4d01('0x17')](function(_0x320b5c){_0x2fe294[_0x4d01('0xa2')]=_0x320b5c;return _0x2fe294;});}})[_0x4d01('0x17')](respondWithFilteredResult(_0x302400,_0x500f13))[_0x4d01('0x4a')](handleError(_0x302400,null));};exports[_0x4d01('0xa6')]=function(_0x1c2ee6,_0x42810a){return db[_0x4d01('0x35')]['find']({'where':{'id':_0x1c2ee6['params']['id']}})[_0x4d01('0x17')](handleEntityNotFound(_0x42810a,null))['then'](function(_0x20881d){if(_0x20881d){return _0x20881d[_0x4d01('0xa7')](_0x1c2ee6['body'][_0x4d01('0x98')],_[_0x4d01('0xa8')](_0x1c2ee6['body'],['ids','id'])||{})[_0x4d01('0xa9')](function(){return db[_0x4d01('0xaa')][_0x4d01('0x3a')]({'attributes':['id',_0x4d01('0x2c'),_0x4d01('0xab')],'where':{'id':_0x1c2ee6[_0x4d01('0x30')][_0x4d01('0x98')]}});})[_0x4d01('0x17')](function(_0x420bda){socket['emit'](_0x4d01('0xac'),{'id':Number(_0x1c2ee6[_0x4d01('0x3e')]['id']),'tags':_0x420bda||[]});return{'id':Number(_0x1c2ee6[_0x4d01('0x3e')]['id']),'tags':_0x420bda||[]};});}})[_0x4d01('0x17')](respondWithResult(_0x42810a,null))[_0x4d01('0x4a')](handleError(_0x42810a,null));};exports[_0x4d01('0xad')]=function(_0x106cc2,_0x1cd2c7){return db[_0x4d01('0x35')][_0x4d01('0x49')]({'where':{'id':_0x106cc2['params']['id']}})[_0x4d01('0x17')](handleEntityNotFound(_0x1cd2c7,null))[_0x4d01('0x17')](function(_0x48527f){if(_0x48527f){return _0x48527f[_0x4d01('0xad')](_0x106cc2['query'][_0x4d01('0x98')]);}})[_0x4d01('0x17')](respondWithStatusCode(_0x1cd2c7,null))['catch'](handleError(_0x1cd2c7,null));};exports[_0x4d01('0xae')]=function(_0x18a656,_0x3aed27){var _0x33cfa5=moment()[_0x4d01('0xaf')]()[_0x4d01('0xb0')]();var _0x4fd697=path['join'](config[_0x4d01('0x78')],_0x4d01('0xb1'),_0x4d01('0xb2'),'tmp');var _0x11b02a=path[_0x4d01('0x77')](config['root'],_0x4d01('0xb1'),_0x4d01('0xb2'),_0x4d01('0xb3'));var _0x1cfb93=path['join'](_0x4fd697,_0x33cfa5);var _0x53bb21=util['format'](_0x4d01('0xb4'),_0x18a656[_0x4d01('0x3e')]['id'],_0x33cfa5);var _0x3839ee=path[_0x4d01('0x77')](_0x4fd697,_0x53bb21);var _0x51a700=[];_0x51a700[_0x4d01('0xb5')]({'model':db[_0x4d01('0x7f')],'as':'User','attributes':['id',_0x4d01('0x58')],'raw':!![]});_0x51a700[_0x4d01('0xb5')]({'model':db[_0x4d01('0x68')],'as':_0x4d01('0x69'),'attributes':['id',_0x4d01('0xb6'),_0x4d01('0xb7')],'raw':!![]});if(_0x18a656[_0x4d01('0x3c')][_0x4d01('0xb3')]){_0x51a700[_0x4d01('0xb5')]({'model':db[_0x4d01('0x76')],'as':'Attachment','raw':!![]});}var _0x3a7143=[{'model':db[_0x4d01('0x7d')],'as':_0x4d01('0x7e'),'attributes':['id',_0x4d01('0x30'),'createdAt',_0x4d01('0x8d'),_0x4d01('0x8e'),_0x4d01('0xb8')],'include':_0x51a700}];_0x3a7143['push']({'model':db[_0x4d01('0x50')],'as':_0x4d01('0xb9'),'attributes':['id',_0x4d01('0x2c')]});_0x3a7143[_0x4d01('0xb5')]({'model':db[_0x4d01('0x7f')],'as':_0x4d01('0xba'),'attributes':['id','fullname']});return db[_0x4d01('0x35')]['find']({'where':{'id':_0x18a656['params']['id']},'include':_0x3a7143})[_0x4d01('0x17')](handleEntityNotFound(_0x3aed27,null))[_0x4d01('0x17')](function(_0x3da4f4){if(_0x3da4f4){var _0x309d30=_0x3da4f4[_0x4d01('0xbb')]({'plain':!![]});fs[_0x4d01('0xbc')](_0x1cfb93);var _0x1b11d2={'channel':'Chat','account':_0x309d30[_0x4d01('0xb9')][_0x4d01('0x2c')],'agent':_0x309d30[_0x4d01('0xba')]?_0x309d30[_0x4d01('0xba')][_0x4d01('0x58')]:_0x4d01('0xbd'),'createdAt':moment(_0x309d30[_0x4d01('0xbe')])[_0x4d01('0x81')](_0x4d01('0xa1'))['toString'](),'closedAt':_0x309d30[_0x4d01('0x75')]?moment(_0x309d30[_0x4d01('0xbf')])[_0x4d01('0x81')](_0x4d01('0xa1'))['toString']():'','disposition':_0x309d30[_0x4d01('0x6e')],'chatInfo':{'browser':_0x309d30[_0x4d01('0xc0')],'os':_0x309d30['osName'],'referer':_0x309d30['referer'],'customerIp':_0x309d30[_0x4d01('0xc1')],'customerPort':_0x309d30[_0x4d01('0xc2')]?_0x309d30[_0x4d01('0xc2')]:_0x4d01('0xbd')},'messages':_(_0x309d30[_0x4d01('0x7e')])[_0x4d01('0xc3')]()[_0x4d01('0x9e')]({'secret':![]})[_0x4d01('0x34')](function(_0x50094b){if(_0x50094b[_0x4d01('0x76')]){var _0x143f1a=path[_0x4d01('0x77')](_0x11b02a,_0x50094b['Attachment'][_0x4d01('0xc4')]);if(fs['existsSync'](_0x143f1a)){fs['createReadStream'](_0x143f1a)[_0x4d01('0xc5')](fs[_0x4d01('0xc6')](path[_0x4d01('0x77')](_0x1cfb93,_0x50094b[_0x4d01('0x76')][_0x4d01('0xc4')])));}}return{'date':moment(_0x50094b[_0x4d01('0xbe')])[_0x4d01('0x81')](_0x4d01('0xa1'))[_0x4d01('0xb0')](),'sender':_0x50094b[_0x4d01('0x8d')]===_0x4d01('0x63')?_0x50094b[_0x4d01('0x7f')]?_0x50094b[_0x4d01('0x7f')][_0x4d01('0x58')]:_0x4d01('0x84'):_0x50094b['Contact']['firstName']+(_0x50094b[_0x4d01('0x69')]['lastName']?'\x20'+_0x50094b[_0x4d01('0x69')][_0x4d01('0xb7')]:''),'body':_0x50094b['Attachment']?_0x50094b[_0x4d01('0x76')][_0x4d01('0xc4')]:_0x50094b[_0x4d01('0x30')],'direction':_0x50094b[_0x4d01('0x8d')]===_0x4d01('0x63')?'A':'C','secret':_0x50094b[_0x4d01('0x8e')],'read':_0x50094b['read'],'attachment':_0x50094b[_0x4d01('0x76')]};})[_0x4d01('0xc7')]()};return ejs[_0x4d01('0xc8')](path[_0x4d01('0x77')](config[_0x4d01('0x78')],_0x4d01('0xb1'),_0x4d01('0xc9'),_0x4d01('0xca')),{'interaction':_0x1b11d2})[_0x4d01('0x17')](function(_0x33ef9e){var _0x2955bd=path[_0x4d01('0x77')](_0x1cfb93,'transcript-'+_0x309d30['id']+'-'+_0x33cfa5+_0x4d01('0xcb'));var _0x1bcb92={'path':_0x2955bd,'channel':_0x4d01('0xcc'),'interactionId':_0x309d30['id']};return pdf[_0x4d01('0xcd')](_0x33ef9e,_0x1bcb92);})[_0x4d01('0x17')](function(){return new Promise(function(_0x45816b,_0x528352){zipdir(_0x1cfb93,{'saveTo':_0x3839ee},function(_0x16d7c8,_0x33be2c){if(_0x16d7c8)return _0x528352(_0x16d7c8);return _0x45816b(_0x33be2c);});})['then'](function(){return new BPromise(function(_0x633074,_0x4a7704){rimraf(_0x1cfb93,function(_0x48fafc){if(_0x48fafc)_0x4a7704(_0x48fafc);return _0x633074();});});})[_0x4d01('0x17')](function(){return _0x3aed27[_0x4d01('0xae')](_0x3839ee,_0x53bb21,function(_0x2f7527){if(_0x2f7527){logger['error']('err',_0x2f7527);}else{fs[_0x4d01('0xce')](_0x3839ee);}});});});}else{return _0x3aed27[_0x4d01('0x21')](0xc8);}})['catch'](handleError(_0x3aed27,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c0237da..7141cb1 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 _0xc8df=['findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','then','setDataValue','map'];(function(_0x691f91,_0x5a6e09){var _0x5c4b05=function(_0x408e6e){while(--_0x408e6e){_0x691f91['push'](_0x691f91['shift']());}};_0x5c4b05(++_0x5a6e09);}(_0xc8df,0x1aa));var _0xfc8d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc8df[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0xfc8d('0x0'));var ChatInteraction=require(_0xfc8d('0x1'))['db'][_0xfc8d('0x2')];var ChatMessage=require(_0xfc8d('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfc8d('0x3')](0x0);var events={'afterCreate':_0xfc8d('0x4'),'afterUpdate':_0xfc8d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4fadde){return function(_0x48dfcc,_0x4ff605,_0x175d47){_0x48dfcc['getUsers']({'attributes':['id'],'raw':!![]})[_0xfc8d('0x6')](function(_0x2b4f69){_0x48dfcc[_0xfc8d('0x7')]('Users',_0x2b4f69[_0xfc8d('0x8')](function(_0x289af3){return{'id':_0x289af3['id']};}));return ChatMessage[_0xfc8d('0x9')]({'where':{'ChatInteractionId':_0x48dfcc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfc8d('0x6')](function(_0x3da636){_0x48dfcc[_0xfc8d('0x7')](_0xfc8d('0xa'),_0x3da636['length']);ChatInteractionEvents['emit'](_0x4fadde+':'+_0x48dfcc['id'],_0x48dfcc);ChatInteractionEvents[_0xfc8d('0xb')](_0x4fadde,_0x48dfcc);_0x175d47(null);})['catch'](_0x175d47(null));};}for(var e in events){if(events[_0xfc8d('0xc')](e)){var event=events[e];ChatInteraction[_0xfc8d('0xd')](e,emitEvent(event));}}module[_0xfc8d('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x21bf=['length','emit','catch','exports','../../mysqldb','ChatInteraction','ChatMessage','save','update','then','setDataValue'];(function(_0xa55b74,_0x5226ad){var _0x5c72c7=function(_0x1f7f41){while(--_0x1f7f41){_0xa55b74['push'](_0xa55b74['shift']());}};_0x5c72c7(++_0x5226ad);}(_0x21bf,0x7d));var _0xf21b=function(_0x56aee7,_0x4b8425){_0x56aee7=_0x56aee7-0x0;var _0x259b27=_0x21bf[_0x56aee7];return _0x259b27;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xf21b('0x0'))['db'][_0xf21b('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0xf21b('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf21b('0x3'),'afterUpdate':_0xf21b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1449eb){return function(_0x216c6b,_0x1d3ab0,_0x5d5d29){_0x216c6b['getUsers']({'attributes':['id'],'raw':!![]})[_0xf21b('0x5')](function(_0x22a1de){_0x216c6b[_0xf21b('0x6')]('Users',_0x22a1de['map'](function(_0xd6896){return{'id':_0xd6896['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x216c6b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x517eb8){_0x216c6b[_0xf21b('0x6')]('unreadMessages',_0x517eb8[_0xf21b('0x7')]);ChatInteractionEvents['emit'](_0x1449eb+':'+_0x216c6b['id'],_0x216c6b);ChatInteractionEvents[_0xf21b('0x8')](_0x1449eb,_0x216c6b);_0x5d5d29(null);})[_0xf21b('0x9')](_0x5d5d29(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xf21b('0xa')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index d4e0b87..4dd2a26 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 _0x9c58=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x384d2d,_0x5b6fbc){var _0xb3d07=function(_0x284ca7){while(--_0x284ca7){_0x384d2d['push'](_0x384d2d['shift']());}};_0xb3d07(++_0x5b6fbc);}(_0x9c58,0x1cb));var _0x89c5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9c58[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x89c5('0x0'));var util=require(_0x89c5('0x1'));var logger=require(_0x89c5('0x2'))(_0x89c5('0x3'));var moment=require(_0x89c5('0x4'));var BPromise=require(_0x89c5('0x5'));var rp=require(_0x89c5('0x6'));var fs=require('fs');var path=require(_0x89c5('0x7'));var rimraf=require(_0x89c5('0x8'));var config=require(_0x89c5('0x9'));var attributes=require('./chatInteraction.attributes');module[_0x89c5('0xa')]=function(_0x39eb20,_0x141100){return _0x39eb20[_0x89c5('0xb')](_0x89c5('0xc'),attributes,{'tableName':_0x89c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c3cd9,_0x3aea9c,_0xd4d4b7){if(_0x1c3cd9[_0x89c5('0xe')](_0x89c5('0xf'))){_0x1c3cd9[_0x89c5('0x10')]=moment()[_0x89c5('0x11')](_0x89c5('0x12'));}_0xd4d4b7(null,_0x1c3cd9);}},'charset':_0x89c5('0x13'),'collate':_0x89c5('0x14')});}; \ No newline at end of file +var _0x4b6a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x58cbcb,_0x2e475f){var _0xcaebc2=function(_0xc2adcc){while(--_0xc2adcc){_0x58cbcb['push'](_0x58cbcb['shift']());}};_0xcaebc2(++_0x2e475f);}(_0x4b6a,0x1b2));var _0xa4b6=function(_0x533b7e,_0x6c878d){_0x533b7e=_0x533b7e-0x0;var _0x4111ae=_0x4b6a[_0x533b7e];return _0x4111ae;};'use strict';var _=require(_0xa4b6('0x0'));var util=require(_0xa4b6('0x1'));var logger=require(_0xa4b6('0x2'))('api');var moment=require(_0xa4b6('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4b6('0x4'));var fs=require('fs');var path=require(_0xa4b6('0x5'));var rimraf=require(_0xa4b6('0x6'));var config=require(_0xa4b6('0x7'));var attributes=require(_0xa4b6('0x8'));module[_0xa4b6('0x9')]=function(_0x1a05a2,_0xcbc011){return _0x1a05a2[_0xa4b6('0xa')](_0xa4b6('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x315490,_0x495274,_0x30b125){if(_0x315490[_0xa4b6('0xc')]('closed')){_0x315490[_0xa4b6('0xd')]=moment()[_0xa4b6('0xe')](_0xa4b6('0xf'));}_0x30b125(null,_0x315490);}},'charset':_0xa4b6('0x10'),'collate':_0xa4b6('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ba28cd8..d6df979 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 _0xa236=['omit','spread','AddTags','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','find','addTags','ids'];(function(_0x597707,_0x56b0aa){var _0x54596a=function(_0x585c89){while(--_0x585c89){_0x597707['push'](_0x597707['shift']());}};_0x54596a(++_0x56b0aa);}(_0xa236,0x189));var _0x6a23=function(_0x255bbe,_0x216781){_0x255bbe=_0x255bbe-0x0;var _0x4fa7b3=_0xa236[_0x255bbe];return _0x4fa7b3;};'use strict';var _=require('lodash');var util=require(_0x6a23('0x0'));var moment=require(_0x6a23('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a23('0x2'));var db=require(_0x6a23('0x3'))['db'];var utils=require(_0x6a23('0x4'));var logger=require(_0x6a23('0x5'))(_0x6a23('0x6'));var config=require(_0x6a23('0x7'));var jayson=require(_0x6a23('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6a23('0x9')]=_[_0x6a23('0xa')](config[_0x6a23('0x9')],{'host':_0x6a23('0xb'),'port':0x18eb});var socket=require(_0x6a23('0xc'))(new Redis(config['redis']));require(_0x6a23('0xd'))['register'](socket);function respondWithRpcPromise(_0x14e913,_0x95167d,_0x4e1a9a){return new BPromise(function(_0x12d86e,_0x42cf5b){return client[_0x6a23('0xe')](_0x14e913,_0x4e1a9a)[_0x6a23('0xf')](function(_0x35e6e1){logger[_0x6a23('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x95167d,_0x6a23('0x11'));logger[_0x6a23('0x12')](_0x6a23('0x13'),_0x95167d,_0x6a23('0x11'),JSON[_0x6a23('0x14')](_0x35e6e1));if(_0x35e6e1[_0x6a23('0x15')]){if(_0x35e6e1['error'][_0x6a23('0x16')]===0x1f4){logger[_0x6a23('0x15')](_0x6a23('0x17'),_0x95167d,_0x35e6e1['error'][_0x6a23('0x18')]);return _0x42cf5b(_0x35e6e1[_0x6a23('0x15')][_0x6a23('0x18')]);}logger[_0x6a23('0x15')](_0x6a23('0x17'),_0x95167d,_0x35e6e1['error'][_0x6a23('0x18')]);return _0x12d86e(_0x35e6e1[_0x6a23('0x15')][_0x6a23('0x18')]);}else{logger[_0x6a23('0x10')](_0x6a23('0x17'),_0x95167d,_0x6a23('0x11'));_0x12d86e(_0x35e6e1['result'][_0x6a23('0x18')]);}})[_0x6a23('0x19')](function(_0x571a22){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x95167d,_0x571a22);_0x42cf5b(_0x571a22);});});}exports[_0x6a23('0x1a')]=function(_0x4798df){var _0x51a61b=this;return new Promise(function(_0x331fb0,_0x38499e){return db[_0x6a23('0x1b')][_0x6a23('0x1c')](_0x4798df[_0x6a23('0x1d')],{'raw':_0x4798df[_0x6a23('0x1e')]?_0x4798df[_0x6a23('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4798df['options']?_0x4798df[_0x6a23('0x1e')][_0x6a23('0x1f')]||null:null,'attributes':_0x4798df['options']?_0x4798df['options'][_0x6a23('0x20')]||null:null,'limit':_0x4798df[_0x6a23('0x1e')]?_0x4798df[_0x6a23('0x1e')]['limit']||null:null})[_0x6a23('0xf')](function(_0x208415){logger[_0x6a23('0x10')](_0x6a23('0x1a'),_0x4798df);logger[_0x6a23('0x12')](_0x6a23('0x1a'),_0x4798df,JSON[_0x6a23('0x14')](_0x208415));_0x331fb0(_0x208415);})[_0x6a23('0x19')](function(_0x2c0c94){logger['error'](_0x6a23('0x1a'),_0x2c0c94[_0x6a23('0x18')],_0x4798df);_0x38499e(_0x51a61b['error'](0x1f4,_0x2c0c94[_0x6a23('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x498633){return new Promise(function(_0x543eed,_0x938648){return db[_0x6a23('0x1b')][_0x6a23('0x21')]({'where':_0x498633[_0x6a23('0x1e')]?_0x498633[_0x6a23('0x1e')]['where']||null:null})[_0x6a23('0xf')](function(_0x29ca27){if(_0x29ca27){return _0x29ca27[_0x6a23('0x22')](_0x498633[_0x6a23('0x1d')][_0x6a23('0x23')],_[_0x6a23('0x24')](_0x498633[_0x6a23('0x1d')],[_0x6a23('0x23'),'id'])||{});}})[_0x6a23('0x25')](function(_0x2bd8d7){logger[_0x6a23('0x10')](_0x6a23('0x26'),_0x498633);logger[_0x6a23('0x12')](_0x6a23('0x26'),_0x498633,JSON['stringify'](_0x2bd8d7));_0x543eed(_0x2bd8d7);})[_0x6a23('0x19')](function(_0x542109){logger[_0x6a23('0x15')](_0x6a23('0x26'),_0x542109[_0x6a23('0x18')],_0x498633);_0x938648(_this[_0x6a23('0x15')](0x1f4,_0x542109[_0x6a23('0x18')]));});});}; \ No newline at end of file +var _0xca23=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','ChatInteraction','body','options','attributes','limit','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d3778,_0x584a55){var _0x1a6943=function(_0x3565a6){while(--_0x3565a6){_0x3d3778['push'](_0x3d3778['shift']());}};_0x1a6943(++_0x584a55);}(_0xca23,0x17d));var _0x3ca2=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xca23[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x3ca2('0x0'));var util=require(_0x3ca2('0x1'));var moment=require(_0x3ca2('0x2'));var BPromise=require(_0x3ca2('0x3'));var rs=require(_0x3ca2('0x4'));var fs=require('fs');var Redis=require(_0x3ca2('0x5'));var db=require(_0x3ca2('0x6'))['db'];var utils=require(_0x3ca2('0x7'));var logger=require(_0x3ca2('0x8'))(_0x3ca2('0x9'));var config=require(_0x3ca2('0xa'));var jayson=require(_0x3ca2('0xb'));var client=jayson[_0x3ca2('0xc')][_0x3ca2('0xd')]({'port':0x232a});config[_0x3ca2('0xe')]=_[_0x3ca2('0xf')](config[_0x3ca2('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ca2('0x10'))(new Redis(config[_0x3ca2('0xe')]));require(_0x3ca2('0x11'))['register'](socket);function respondWithRpcPromise(_0x41eb3,_0x23cee2,_0x4440e4){return new BPromise(function(_0x2c5294,_0x1c1b77){return client[_0x3ca2('0x12')](_0x41eb3,_0x4440e4)[_0x3ca2('0x13')](function(_0x561c12){logger[_0x3ca2('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x23cee2,_0x3ca2('0x15'));logger[_0x3ca2('0x16')](_0x3ca2('0x17'),_0x23cee2,_0x3ca2('0x15'),JSON[_0x3ca2('0x18')](_0x561c12));if(_0x561c12[_0x3ca2('0x19')]){if(_0x561c12[_0x3ca2('0x19')][_0x3ca2('0x1a')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x23cee2,_0x561c12[_0x3ca2('0x19')][_0x3ca2('0x1b')]);return _0x1c1b77(_0x561c12['error'][_0x3ca2('0x1b')]);}logger[_0x3ca2('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x23cee2,_0x561c12['error'][_0x3ca2('0x1b')]);return _0x2c5294(_0x561c12[_0x3ca2('0x19')][_0x3ca2('0x1b')]);}else{logger['info'](_0x3ca2('0x1c'),_0x23cee2,'request\x20sent');_0x2c5294(_0x561c12[_0x3ca2('0x1d')][_0x3ca2('0x1b')]);}})[_0x3ca2('0x1e')](function(_0x5e2f3d){logger[_0x3ca2('0x19')](_0x3ca2('0x1c'),_0x23cee2,_0x5e2f3d);_0x1c1b77(_0x5e2f3d);});});}exports[_0x3ca2('0x1f')]=function(_0x2c6ef9){var _0x3a893a=this;return new Promise(function(_0x1831eb,_0x16e8cf){return db[_0x3ca2('0x20')]['update'](_0x2c6ef9[_0x3ca2('0x21')],{'raw':_0x2c6ef9[_0x3ca2('0x22')]?_0x2c6ef9[_0x3ca2('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6ef9[_0x3ca2('0x22')]?_0x2c6ef9[_0x3ca2('0x22')]['where']||null:null,'attributes':_0x2c6ef9[_0x3ca2('0x22')]?_0x2c6ef9[_0x3ca2('0x22')][_0x3ca2('0x23')]||null:null,'limit':_0x2c6ef9['options']?_0x2c6ef9[_0x3ca2('0x22')][_0x3ca2('0x24')]||null:null})['then'](function(_0x104355){logger[_0x3ca2('0x14')](_0x3ca2('0x1f'),_0x2c6ef9);logger['debug'](_0x3ca2('0x1f'),_0x2c6ef9,JSON['stringify'](_0x104355));_0x1831eb(_0x104355);})[_0x3ca2('0x1e')](function(_0x50a9cb){logger[_0x3ca2('0x19')](_0x3ca2('0x1f'),_0x50a9cb[_0x3ca2('0x1b')],_0x2c6ef9);_0x16e8cf(_0x3a893a[_0x3ca2('0x19')](0x1f4,_0x50a9cb[_0x3ca2('0x1b')]));});});};exports['AddTagsToChatInteraction']=function(_0x4eaa88){return new Promise(function(_0x477f9b,_0x62f230){return db[_0x3ca2('0x20')]['find']({'where':_0x4eaa88[_0x3ca2('0x22')]?_0x4eaa88[_0x3ca2('0x22')][_0x3ca2('0x25')]||null:null})[_0x3ca2('0x13')](function(_0x503463){if(_0x503463){return _0x503463[_0x3ca2('0x26')](_0x4eaa88[_0x3ca2('0x21')][_0x3ca2('0x27')],_[_0x3ca2('0x28')](_0x4eaa88[_0x3ca2('0x21')],[_0x3ca2('0x27'),'id'])||{});}})[_0x3ca2('0x29')](function(_0x2975d2){logger[_0x3ca2('0x14')](_0x3ca2('0x2a'),_0x4eaa88);logger[_0x3ca2('0x16')](_0x3ca2('0x2a'),_0x4eaa88,JSON[_0x3ca2('0x18')](_0x2975d2));_0x477f9b(_0x2975d2);})[_0x3ca2('0x1e')](function(_0x40803a){logger[_0x3ca2('0x19')](_0x3ca2('0x2a'),_0x40803a[_0x3ca2('0x1b')],_0x4eaa88);_0x62f230(_this[_0x3ca2('0x19')](0x1f4,_0x40803a[_0x3ca2('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0c42059..44b436c 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 _0x77ed=['remove','emit','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x30238c,_0x7f942b){var _0x527de1=function(_0x48664d){while(--_0x48664d){_0x30238c['push'](_0x30238c['shift']());}};_0x527de1(++_0x7f942b);}(_0x77ed,0x76));var _0xd77e=function(_0x42efe5,_0x22f8de){_0x42efe5=_0x42efe5-0x0;var _0x56e38b=_0x77ed[_0x42efe5];return _0x56e38b;};'use strict';var ChatInteractionEvents=require(_0xd77e('0x0'));var events=[_0xd77e('0x1'),_0xd77e('0x2'),'update'];function createListener(_0x247fbf,_0x274421){return function(_0x52ba5b){_0x274421[_0xd77e('0x3')](_0x247fbf,_0x52ba5b);};}function removeListener(_0x598a71,_0x1bc01d){return function(){ChatInteractionEvents['removeListener'](_0x598a71,_0x1bc01d);};}exports['register']=function(_0x1cb046){for(var _0x1b6fea=0x0,_0x1db115=events[_0xd77e('0x4')];_0x1b6fea<_0x1db115;_0x1b6fea++){var _0x49881e=events[_0x1b6fea];var _0x4c0554=createListener(_0xd77e('0x5')+_0x49881e,_0x1cb046);ChatInteractionEvents['on'](_0x49881e,_0x4c0554);}}; \ No newline at end of file +var _0xa4c3=['./chatInteraction.events','save','remove','update','removeListener','chatInteraction:'];(function(_0x351dff,_0x1dbada){var _0x53d13b=function(_0x9597a9){while(--_0x9597a9){_0x351dff['push'](_0x351dff['shift']());}};_0x53d13b(++_0x1dbada);}(_0xa4c3,0xb4));var _0x3a4c=function(_0x5781fc,_0x59b7d1){_0x5781fc=_0x5781fc-0x0;var _0x3722e8=_0xa4c3[_0x5781fc];return _0x3722e8;};'use strict';var ChatInteractionEvents=require(_0x3a4c('0x0'));var events=[_0x3a4c('0x1'),_0x3a4c('0x2'),_0x3a4c('0x3')];function createListener(_0x367410,_0x5b9a68){return function(_0x10bdf9){_0x5b9a68['emit'](_0x367410,_0x10bdf9);};}function removeListener(_0x4593ba,_0x3e5d77){return function(){ChatInteractionEvents[_0x3a4c('0x4')](_0x4593ba,_0x3e5d77);};}exports['register']=function(_0x4e8cb2){for(var _0xcb3198=0x0,_0x58d22e=events['length'];_0xcb3198<_0x58d22e;_0xcb3198++){var _0x49c6ba=events[_0xcb3198];var _0x50fe82=createListener(_0x3a4c('0x5')+_0x49c6ba,_0x4e8cb2);ChatInteractionEvents['on'](_0x49c6ba,_0x50fe82);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 439ba89..23d852b 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 _0x48a9=['isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','/:id'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x48a9,0x10f));var _0x948a=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x48a9[_0x4b12ae];return _0x16957b;};'use strict';var multer=require(_0x948a('0x0'));var util=require('util');var path=require(_0x948a('0x1'));var timeout=require(_0x948a('0x2'));var express=require(_0x948a('0x3'));var router=express[_0x948a('0x4')]();var fs_extra=require(_0x948a('0x5'));var auth=require(_0x948a('0x6'));var interaction=require(_0x948a('0x7'));var config=require(_0x948a('0x8'));var controller=require(_0x948a('0x9'));router[_0x948a('0xa')]('/',auth[_0x948a('0xb')](),controller['index']);router[_0x948a('0xa')](_0x948a('0xc'),auth[_0x948a('0xb')](),controller['describe']);router[_0x948a('0xa')](_0x948a('0xd'),auth[_0x948a('0xe')](),controller['show']);router[_0x948a('0xa')](_0x948a('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x948a('0x10')]);router[_0x948a('0xa')]('/:id/messages',auth[_0x948a('0xb')](),controller[_0x948a('0x11')]);router[_0x948a('0xa')](_0x948a('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x948a('0x13')]);router['get'](_0x948a('0x14'),auth['isAuthenticated'](),controller[_0x948a('0x15')]);router[_0x948a('0x16')]('/',auth[_0x948a('0xb')](),controller[_0x948a('0x17')]);router['post'](_0x948a('0x18'),auth[_0x948a('0xb')](),controller[_0x948a('0x19')]);var upload=multer({'storage':multer[_0x948a('0x1a')]({'destination':function(_0x54d4cc,_0x5353a4,_0x1b614f){_0x1b614f(null,path[_0x948a('0x1b')](config['root'],_0x948a('0x1c')));},'filename':function(_0x299e0b,_0x420958,_0x59aa66){_0x59aa66(null,util[_0x948a('0x1d')](_0x948a('0x1e'),Date[_0x948a('0x1f')](),_0x420958['originalname'][_0x948a('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x948a('0x16')](_0x948a('0x21'),upload[_0x948a('0x22')](_0x948a('0x23')),controller[_0x948a('0x24')]);router[_0x948a('0x16')](_0x948a('0x25'),auth['isChatInteractionAuthorized'](),controller[_0x948a('0x26')]);router[_0x948a('0x16')](_0x948a('0x27'),auth[_0x948a('0xb')](),interaction[_0x948a('0x28')](_0x948a('0x29'),_0x948a('0x2a')),controller[_0x948a('0x2b')]);router[_0x948a('0x2c')](_0x948a('0xd'),auth[_0x948a('0xb')](),interaction[_0x948a('0x28')](_0x948a('0x29'),_0x948a('0x2d')),controller[_0x948a('0x2e')]);router[_0x948a('0x2c')](_0x948a('0x2f'),controller[_0x948a('0x30')]);router['put'](_0x948a('0x31'),auth[_0x948a('0xe')](),controller[_0x948a('0x32')]);router['put'](_0x948a('0x33'),controller[_0x948a('0x34')]);router[_0x948a('0x35')](_0x948a('0xd'),auth[_0x948a('0xb')](),interaction[_0x948a('0x28')](_0x948a('0x29'),_0x948a('0x36')),controller['destroy']);router['delete'](_0x948a('0x27'),auth[_0x948a('0xb')](),controller[_0x948a('0x37')]);module[_0x948a('0x38')]=router; \ No newline at end of file +var _0xb077=['post','createVidaooSession','diskStorage','join','root','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download'];(function(_0x28e2a7,_0x5ae5e9){var _0x58f155=function(_0x12b28a){while(--_0x12b28a){_0x28e2a7['push'](_0x28e2a7['shift']());}};_0x58f155(++_0x5ae5e9);}(_0xb077,0xbe));var _0x7b07=function(_0x4994b1,_0x12c122){_0x4994b1=_0x4994b1-0x0;var _0x4dc366=_0xb077[_0x4994b1];return _0x4dc366;};'use strict';var multer=require(_0x7b07('0x0'));var util=require(_0x7b07('0x1'));var path=require(_0x7b07('0x2'));var timeout=require(_0x7b07('0x3'));var express=require('express');var router=express[_0x7b07('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7b07('0x5'));var config=require(_0x7b07('0x6'));var controller=require(_0x7b07('0x7'));router[_0x7b07('0x8')]('/',auth[_0x7b07('0x9')](),controller[_0x7b07('0xa')]);router['get'](_0x7b07('0xb'),auth[_0x7b07('0x9')](),controller[_0x7b07('0xc')]);router[_0x7b07('0x8')](_0x7b07('0xd'),auth[_0x7b07('0xe')](),controller['show']);router[_0x7b07('0x8')](_0x7b07('0xf'),auth[_0x7b07('0xe')](),controller[_0x7b07('0x10')]);router[_0x7b07('0x8')](_0x7b07('0x11'),auth['isAuthenticated'](),controller[_0x7b07('0x12')]);router[_0x7b07('0x8')](_0x7b07('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x7b07('0x14')]);router[_0x7b07('0x8')]('/:id/download',auth[_0x7b07('0x9')](),controller[_0x7b07('0x15')]);router['post']('/',auth[_0x7b07('0x9')](),controller['create']);router[_0x7b07('0x16')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x7b07('0x17')]);var upload=multer({'storage':multer[_0x7b07('0x18')]({'destination':function(_0x53e813,_0x5a196b,_0x2f2f4a){_0x2f2f4a(null,path[_0x7b07('0x19')](config[_0x7b07('0x1a')],'server/files/attachments/'));},'filename':function(_0x2e18e5,_0x2247e7,_0x3d6e9e){_0x3d6e9e(null,util['format'](_0x7b07('0x1b'),Date[_0x7b07('0x1c')](),_0x2247e7[_0x7b07('0x1d')][_0x7b07('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7b07('0x16')](_0x7b07('0x1f'),upload[_0x7b07('0x20')](_0x7b07('0x21')),controller[_0x7b07('0x22')]);router[_0x7b07('0x16')]('/:id/messages',auth[_0x7b07('0xe')](),controller['addMessage']);router['post'](_0x7b07('0x23'),auth['isAuthenticated'](),interaction[_0x7b07('0x24')](_0x7b07('0x25'),_0x7b07('0x26')),controller[_0x7b07('0x27')]);router[_0x7b07('0x28')](_0x7b07('0xd'),auth[_0x7b07('0x9')](),interaction[_0x7b07('0x24')](_0x7b07('0x25'),'chatinteraction:update'),controller[_0x7b07('0x29')]);router[_0x7b07('0x28')](_0x7b07('0x2a'),controller[_0x7b07('0x2b')]);router[_0x7b07('0x28')](_0x7b07('0x2c'),auth['isChatInteractionAuthorized'](),controller[_0x7b07('0x2d')]);router[_0x7b07('0x28')](_0x7b07('0x2e'),controller[_0x7b07('0x2f')]);router['delete'](_0x7b07('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x7b07('0x25'),_0x7b07('0x30')),controller[_0x7b07('0x31')]);router[_0x7b07('0x32')](_0x7b07('0x23'),auth[_0x7b07('0x9')](),controller[_0x7b07('0x33')]);module[_0x7b07('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e9822da..3877a0c 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 _0x2f32=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x7384fa,_0x205b2d){var _0x59b618=function(_0x216da3){while(--_0x216da3){_0x7384fa['push'](_0x7384fa['shift']());}};_0x59b618(++_0x205b2d);}(_0x2f32,0x1c9));var _0x22f3=function(_0x45e944,_0x4aa5c3){_0x45e944=_0x45e944-0x0;var _0x53a39c=_0x2f32[_0x45e944];return _0x53a39c;};'use strict';var Sequelize=require(_0x22f3('0x0'));module[_0x22f3('0x1')]={'body':{'type':Sequelize[_0x22f3('0x2')](_0x22f3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x22f3('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x22f3('0x5')]}}; \ No newline at end of file +var _0x1781=['sequelize','TEXT','medium','INTEGER'];(function(_0x4fbc1f,_0x26bd2f){var _0x480d32=function(_0x44f1ea){while(--_0x44f1ea){_0x4fbc1f['push'](_0x4fbc1f['shift']());}};_0x480d32(++_0x26bd2f);}(_0x1781,0x1e0));var _0x1178=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1781[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x1178('0x0'));module['exports']={'body':{'type':Sequelize[_0x1178('0x1')](_0x1178('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1178('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fba62f4..5870574 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 _0x6c64=['type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x6c64,0x11e));var _0x46c6=function(_0xbd30dd,_0x2c5b64){_0xbd30dd=_0xbd30dd-0x0;var _0x1abd40=_0x6c64[_0xbd30dd];return _0x1abd40;};'use strict';var emlformat=require(_0x46c6('0x0'));var rimraf=require(_0x46c6('0x1'));var zipdir=require(_0x46c6('0x2'));var jsonpatch=require(_0x46c6('0x3'));var rp=require('request-promise');var moment=require(_0x46c6('0x4'));var BPromise=require(_0x46c6('0x5'));var Mustache=require(_0x46c6('0x6'));var util=require(_0x46c6('0x7'));var path=require(_0x46c6('0x8'));var sox=require(_0x46c6('0x9'));var csv=require('to-csv');var ejs=require(_0x46c6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46c6('0xb'));var squel=require('squel');var crypto=require(_0x46c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x46c6('0xd'));var toCsv=require(_0x46c6('0xe'));var querystring=require(_0x46c6('0xf'));var Papa=require(_0x46c6('0x10'));var Redis=require(_0x46c6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x46c6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46c6('0x13'));var logger=require(_0x46c6('0x14'))(_0x46c6('0x15'));var utils=require(_0x46c6('0x16'));var config=require(_0x46c6('0x17'));var licenseUtil=require(_0x46c6('0x18'));var db=require('../../mysqldb')['db'];config[_0x46c6('0x19')]=_[_0x46c6('0x1a')](config[_0x46c6('0x19')],{'host':_0x46c6('0x1b'),'port':0x18eb});var socket=require(_0x46c6('0x1c'))(new Redis(config[_0x46c6('0x19')]));require(_0x46c6('0x1d'))[_0x46c6('0x1e')](socket);function respondWithStatusCode(_0x188eaa,_0x42eceb){_0x42eceb=_0x42eceb||0xcc;return function(_0x476c63){if(_0x476c63){return _0x188eaa[_0x46c6('0x1f')](_0x42eceb);}return _0x188eaa[_0x46c6('0x20')](_0x42eceb)[_0x46c6('0x21')]();};}function respondWithResult(_0xc87c3a,_0xed622c){_0xed622c=_0xed622c||0xc8;return function(_0x46da73){if(_0x46da73){return _0xc87c3a[_0x46c6('0x20')](_0xed622c)[_0x46c6('0x22')](_0x46da73);}};}function respondWithFilteredResult(_0x2aab76,_0x53c087){return function(_0x2e4e8b){if(_0x2e4e8b){var _0x75eb06=typeof _0x53c087[_0x46c6('0x23')]===_0x46c6('0x24')&&typeof _0x53c087['limit']===_0x46c6('0x24');var _0x515d32=_0x2e4e8b[_0x46c6('0x25')];var _0x2469a8=_0x75eb06?0x0:_0x53c087['offset'];var _0x181b5a=_0x75eb06?_0x2e4e8b[_0x46c6('0x25')]:_0x53c087[_0x46c6('0x23')]+_0x53c087[_0x46c6('0x26')];var _0x1bbb20;if(_0x181b5a>=_0x515d32){_0x181b5a=_0x515d32;_0x1bbb20=0xc8;}else{_0x1bbb20=0xce;}_0x2aab76['status'](_0x1bbb20);return _0x2aab76['set'](_0x46c6('0x27'),_0x2469a8+'-'+_0x181b5a+'/'+_0x515d32)[_0x46c6('0x22')](_0x2e4e8b);}return null;};}function patchUpdates(_0x864d1a){return function(_0x17ed0c){try{jsonpatch[_0x46c6('0x28')](_0x17ed0c,_0x864d1a,!![]);}catch(_0x44c4ce){return BPromise['reject'](_0x44c4ce);}return _0x17ed0c[_0x46c6('0x29')]();};}function saveUpdates(_0x493f6c,_0x15150c){return function(_0x16758d){if(_0x16758d){return _0x16758d[_0x46c6('0x2a')](_0x493f6c)['then'](function(_0x3d852e){return _0x3d852e;});}return null;};}function removeEntity(_0x4392db,_0x5598c6){return function(_0x58bc13){if(_0x58bc13){return _0x58bc13[_0x46c6('0x2b')]()[_0x46c6('0x2c')](function(){_0x4392db[_0x46c6('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb3e4a4,_0x2f3d01){return function(_0x560c3d){if(!_0x560c3d){_0xb3e4a4[_0x46c6('0x1f')](0x194);}return _0x560c3d;};}function handleError(_0x2ec8e8,_0xbed1d3){_0xbed1d3=_0xbed1d3||0x1f4;return function(_0x24d822){logger[_0x46c6('0x2d')](_0x24d822[_0x46c6('0x2e')]);if(_0x24d822[_0x46c6('0x2f')]){delete _0x24d822['name'];}_0x2ec8e8[_0x46c6('0x20')](_0xbed1d3)[_0x46c6('0x30')](_0x24d822);};}exports[_0x46c6('0x31')]=function(_0x29dfb9,_0x509df4){var _0x3e48d2={},_0x4f1910={},_0x284279={'count':0x0,'rows':[]};var _0x167b14=_[_0x46c6('0x32')](db[_0x46c6('0x33')][_0x46c6('0x34')],function(_0x459e4c){return{'name':_0x459e4c['fieldName'],'type':_0x459e4c[_0x46c6('0x35')]['key']};});_0x4f1910[_0x46c6('0x36')]=_[_0x46c6('0x32')](_0x167b14,_0x46c6('0x2f'));_0x4f1910[_0x46c6('0x37')]=_[_0x46c6('0x38')](_0x29dfb9['query']);_0x4f1910[_0x46c6('0x39')]=_[_0x46c6('0x3a')](_0x4f1910[_0x46c6('0x36')],_0x4f1910[_0x46c6('0x37')]);_0x3e48d2[_0x46c6('0x3b')]=_[_0x46c6('0x3a')](_0x4f1910['model'],qs[_0x46c6('0x3c')](_0x29dfb9[_0x46c6('0x37')][_0x46c6('0x3c')]));_0x3e48d2[_0x46c6('0x3b')]=_0x3e48d2['attributes'][_0x46c6('0x3d')]?_0x3e48d2[_0x46c6('0x3b')]:_0x4f1910[_0x46c6('0x36')];if(!_0x29dfb9[_0x46c6('0x37')][_0x46c6('0x3e')](_0x46c6('0x3f'))){_0x3e48d2[_0x46c6('0x26')]=qs['limit'](_0x29dfb9[_0x46c6('0x37')][_0x46c6('0x26')]);_0x3e48d2[_0x46c6('0x23')]=qs['offset'](_0x29dfb9[_0x46c6('0x37')]['offset']);}_0x3e48d2[_0x46c6('0x40')]=qs['sort'](_0x29dfb9[_0x46c6('0x37')][_0x46c6('0x41')]);_0x3e48d2[_0x46c6('0x42')]=qs[_0x46c6('0x39')](_[_0x46c6('0x43')](_0x29dfb9[_0x46c6('0x37')],_0x4f1910[_0x46c6('0x39')]),_0x167b14);if(_0x29dfb9[_0x46c6('0x37')][_0x46c6('0x44')]){_0x3e48d2[_0x46c6('0x42')]=_[_0x46c6('0x45')](_0x3e48d2[_0x46c6('0x42')],{'$or':_[_0x46c6('0x32')](_0x167b14,function(_0x152f17){if(_0x152f17['type']!==_0x46c6('0x46')){var _0x3fc1ba={};_0x3fc1ba[_0x152f17[_0x46c6('0x2f')]]={'$like':'%'+_0x29dfb9[_0x46c6('0x37')][_0x46c6('0x44')]+'%'};return _0x3fc1ba;}})});}_0x3e48d2=_[_0x46c6('0x45')]({},_0x3e48d2,_0x29dfb9[_0x46c6('0x47')]);var _0x57ee0e={'where':_0x3e48d2[_0x46c6('0x42')]};return db['ChatInternalMessage'][_0x46c6('0x25')](_0x57ee0e)[_0x46c6('0x2c')](function(_0x3809a3){_0x284279[_0x46c6('0x25')]=_0x3809a3;if(_0x29dfb9[_0x46c6('0x37')][_0x46c6('0x48')]){_0x3e48d2[_0x46c6('0x49')]=[{'all':!![]}];}return db[_0x46c6('0x33')][_0x46c6('0x4a')](_0x3e48d2);})[_0x46c6('0x2c')](function(_0x3c174a){_0x284279['rows']=_0x3c174a;return _0x284279;})['then'](respondWithFilteredResult(_0x509df4,_0x3e48d2))[_0x46c6('0x4b')](handleError(_0x509df4,null));};exports[_0x46c6('0x4c')]=function(_0x25fc0e,_0x4fd892){var _0x329001={'raw':!![],'where':{'id':_0x25fc0e[_0x46c6('0x4d')]['id']}},_0x2a14ee={};_0x2a14ee['model']=_[_0x46c6('0x38')](db[_0x46c6('0x33')][_0x46c6('0x34')]);_0x2a14ee[_0x46c6('0x37')]=_[_0x46c6('0x38')](_0x25fc0e[_0x46c6('0x37')]);_0x2a14ee[_0x46c6('0x39')]=_[_0x46c6('0x3a')](_0x2a14ee[_0x46c6('0x36')],_0x2a14ee[_0x46c6('0x37')]);_0x329001['attributes']=_[_0x46c6('0x3a')](_0x2a14ee[_0x46c6('0x36')],qs[_0x46c6('0x3c')](_0x25fc0e[_0x46c6('0x37')][_0x46c6('0x3c')]));_0x329001[_0x46c6('0x3b')]=_0x329001['attributes'][_0x46c6('0x3d')]?_0x329001[_0x46c6('0x3b')]:_0x2a14ee['model'];if(_0x25fc0e['query'][_0x46c6('0x48')]){_0x329001['include']=[{'all':!![]}];}_0x329001=_['merge']({},_0x329001,_0x25fc0e[_0x46c6('0x47')]);return db[_0x46c6('0x33')][_0x46c6('0x4e')](_0x329001)[_0x46c6('0x2c')](handleEntityNotFound(_0x4fd892,null))['then'](respondWithResult(_0x4fd892,null))[_0x46c6('0x4b')](handleError(_0x4fd892,null));};exports[_0x46c6('0x4f')]=function(_0x5c68ab,_0x37da01){return db['ChatInternalMessage'][_0x46c6('0x4f')](_0x5c68ab[_0x46c6('0x50')],{})[_0x46c6('0x2c')](respondWithResult(_0x37da01,0xc9))[_0x46c6('0x4b')](handleError(_0x37da01,null));};exports[_0x46c6('0x2a')]=function(_0x1fe17b,_0x52bf08){if(_0x1fe17b[_0x46c6('0x50')]['id']){delete _0x1fe17b['body']['id'];}return db[_0x46c6('0x33')]['find']({'where':{'id':_0x1fe17b[_0x46c6('0x4d')]['id']}})[_0x46c6('0x2c')](handleEntityNotFound(_0x52bf08,null))[_0x46c6('0x2c')](saveUpdates(_0x1fe17b['body'],null))['then'](respondWithResult(_0x52bf08,null))[_0x46c6('0x4b')](handleError(_0x52bf08,null));};exports[_0x46c6('0x2b')]=function(_0x3a435d,_0x37acb7){return db[_0x46c6('0x33')][_0x46c6('0x4e')]({'where':{'id':_0x3a435d[_0x46c6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37acb7,null))[_0x46c6('0x2c')](removeEntity(_0x37acb7,null))[_0x46c6('0x4b')](handleError(_0x37acb7,null));};exports[_0x46c6('0x51')]=function(_0x3df905,_0x15d39a){return db[_0x46c6('0x33')][_0x46c6('0x51')]()[_0x46c6('0x2c')](respondWithResult(_0x15d39a,null))[_0x46c6('0x4b')](handleError(_0x15d39a,null));};function wrapUser(_0x3d41c8){return function(_0x111fac){var _0x43081b=_0x3d41c8[_0x46c6('0x52')]({'plain':!![]});_0x43081b[_0x46c6('0x53')]=[];if(_0x111fac){_0x43081b[_0x46c6('0x54')]=_0x111fac[_0x46c6('0x55')];_0x43081b[_0x46c6('0x56')]=_0x111fac;}else{_0x43081b[_0x46c6('0x54')]=moment(0x0)[_0x46c6('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x43081b['lastMessage']={};}return _0x43081b;};}exports[_0x46c6('0x58')]=function(_0x349f5a,_0x497fc0,_0x5484a6){var _0x44912b=[];return db[_0x46c6('0x59')][_0x46c6('0x4a')]({'where':{'role':[_0x46c6('0x5a'),'admin',_0x46c6('0x5b')]},'attributes':['id',_0x46c6('0x5c'),_0x46c6('0x2f'),_0x46c6('0x5d'),_0x46c6('0x5e'),_0x46c6('0x5f'),'online',_0x46c6('0x60'),_0x46c6('0x61'),_0x46c6('0x62')],'order':qs[_0x46c6('0x41')](_0x46c6('0x63')),'include':[{'model':db[_0x46c6('0x64')],'as':_0x46c6('0x65'),'attributes':['id','name',_0x46c6('0x35')],'through':{'attributes':[]}}]})[_0x46c6('0x2c')](function(_0x111f4a){if(_0x111f4a){var _0x1033b=_0x349f5a[_0x46c6('0x5b')]['get']({'plain':!![]});if(!_0x1033b)throw new Error(_0x46c6('0x66'));if(_0x1033b[_0x46c6('0x5d')]===_0x46c6('0x5b')){return db[_0x46c6('0x67')][_0x46c6('0x4e')]({'where':{'name':_0x46c6('0x68'),'userProfileId':_0x1033b[_0x46c6('0x69')]},'raw':!![]})[_0x46c6('0x2c')](function(_0x4a53fa){if(_0x4a53fa){if(_0x4a53fa[_0x46c6('0x6a')]===0x0){return db['UserProfileResource'][_0x46c6('0x4a')]({'where':{'sectionId':_0x4a53fa['id']},'raw':!![]})[_0x46c6('0x2c')](function(_0x2267e4){var _0x446d23=[];if(_[_0x46c6('0x6b')](_0x2267e4)){_0x446d23=_[_0x46c6('0x44')](_0x111f4a,function(_0x49154d){if(_0x49154d['role']!==_0x46c6('0x5a')){return _0x49154d;}});return _0x446d23;}else{for(var _0x2e65b0=0x0;_0x2e65b0<_0x111f4a[_0x46c6('0x3d')];_0x2e65b0++){var _0x39aec7=_0x111f4a[_0x2e65b0];if(_0x39aec7[_0x46c6('0x5d')]===_0x46c6('0x5a')){var _0x4c3554=_['find'](_0x2267e4,function(_0x3908a2){return _0x3908a2[_0x46c6('0x6c')]===_0x39aec7['id'];});if(_0x4c3554)_0x446d23[_0x46c6('0x6d')](_0x39aec7);}else{_0x446d23[_0x46c6('0x6d')](_0x39aec7);}}return _0x446d23;}});}else{return _0x111f4a;}}else{var _0x440243=_[_0x46c6('0x44')](_0x111f4a,function(_0x303eb8){if(_0x303eb8['role']!=='agent'){return _0x303eb8;}});return _0x440243;}});}else{return _0x111f4a;}}})[_0x46c6('0x2c')](function(_0x143e8d){var _0x1fd8b8=[];if(_0x143e8d){_0x44912b=_0x143e8d;for(var _0x15ea98=0x0;_0x15ea98<_0x143e8d[_0x46c6('0x3d')];_0x15ea98+=0x1){_0x44912b[_0x15ea98][_0x46c6('0x53')]=[];_0x1fd8b8[_0x46c6('0x6d')](db[_0x46c6('0x33')][_0x46c6('0x4e')]({'where':{'FromId':[_0x349f5a['user']['id'],_0x143e8d[_0x15ea98]['id']],'ToId':[_0x349f5a[_0x46c6('0x5b')]['id'],_0x143e8d[_0x15ea98]['id']],'ChatGroupId':null},'attributes':['id',_0x46c6('0x55'),_0x46c6('0x6e'),'ToId',_0x46c6('0x6f'),_0x46c6('0x50')],'order':qs[_0x46c6('0x41')](_0x46c6('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x46c6('0x2c')](wrapUser(_0x143e8d[_0x15ea98])));}return BPromise['all'](_0x1fd8b8);}return[];})[_0x46c6('0x2c')](function(_0x582714){return{'rows':_0x582714,'count':_0x582714[_0x46c6('0x3d')]};})[_0x46c6('0x2c')](respondWithResult(_0x497fc0,null))['catch'](handleError(_0x497fc0,null));}; \ No newline at end of file +var _0xa89a=['UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','destroy','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','role','userpic','internal','online','showWebBar','VoiceQueue','VoiceQueues','type','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation'];(function(_0x127f8b,_0x592c8a){var _0x893898=function(_0x38aac9){while(--_0x38aac9){_0x127f8b['push'](_0x127f8b['shift']());}};_0x893898(++_0x592c8a);}(_0xa89a,0x76));var _0xaa89=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa89a[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xaa89('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa89('0x1'));var jsonpatch=require(_0xaa89('0x2'));var rp=require(_0xaa89('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaa89('0x4'));var sox=require(_0xaa89('0x5'));var csv=require(_0xaa89('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa89('0x7'));var _=require(_0xaa89('0x8'));var squel=require('squel');var crypto=require(_0xaa89('0x9'));var jsforce=require(_0xaa89('0xa'));var deskjs=require(_0xaa89('0xb'));var toCsv=require(_0xaa89('0x6'));var querystring=require(_0xaa89('0xc'));var Papa=require(_0xaa89('0xd'));var Redis=require(_0xaa89('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaa89('0xf'));var as=require(_0xaa89('0x10'));var hardwareService=require(_0xaa89('0x11'));var logger=require(_0xaa89('0x12'))(_0xaa89('0x13'));var utils=require(_0xaa89('0x14'));var config=require(_0xaa89('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xaa89('0x16'),'port':0x18eb});var socket=require(_0xaa89('0x17'))(new Redis(config['redis']));require(_0xaa89('0x18'))[_0xaa89('0x19')](socket);function respondWithStatusCode(_0x502b28,_0x1caaa0){_0x1caaa0=_0x1caaa0||0xcc;return function(_0x3d1677){if(_0x3d1677){return _0x502b28[_0xaa89('0x1a')](_0x1caaa0);}return _0x502b28[_0xaa89('0x1b')](_0x1caaa0)[_0xaa89('0x1c')]();};}function respondWithResult(_0x11974d,_0x4dcb23){_0x4dcb23=_0x4dcb23||0xc8;return function(_0x2e3ed){if(_0x2e3ed){return _0x11974d[_0xaa89('0x1b')](_0x4dcb23)[_0xaa89('0x1d')](_0x2e3ed);}};}function respondWithFilteredResult(_0x3e0de5,_0x46fe96){return function(_0x427aef){if(_0x427aef){var _0xc537=typeof _0x46fe96[_0xaa89('0x1e')]===_0xaa89('0x1f')&&typeof _0x46fe96['limit']===_0xaa89('0x1f');var _0x2bff4f=_0x427aef[_0xaa89('0x20')];var _0x13a17e=_0xc537?0x0:_0x46fe96['offset'];var _0x2027b2=_0xc537?_0x427aef[_0xaa89('0x20')]:_0x46fe96[_0xaa89('0x1e')]+_0x46fe96[_0xaa89('0x21')];var _0x40fb35;if(_0x2027b2>=_0x2bff4f){_0x2027b2=_0x2bff4f;_0x40fb35=0xc8;}else{_0x40fb35=0xce;}_0x3e0de5[_0xaa89('0x1b')](_0x40fb35);return _0x3e0de5[_0xaa89('0x22')](_0xaa89('0x23'),_0x13a17e+'-'+_0x2027b2+'/'+_0x2bff4f)[_0xaa89('0x1d')](_0x427aef);}return null;};}function patchUpdates(_0x57eaad){return function(_0x12215b){try{jsonpatch['apply'](_0x12215b,_0x57eaad,!![]);}catch(_0x559787){return BPromise[_0xaa89('0x24')](_0x559787);}return _0x12215b[_0xaa89('0x25')]();};}function saveUpdates(_0x22a544,_0x19b85a){return function(_0x3bfa9d){if(_0x3bfa9d){return _0x3bfa9d[_0xaa89('0x26')](_0x22a544)[_0xaa89('0x27')](function(_0x4d28f4){return _0x4d28f4;});}return null;};}function removeEntity(_0x317f7b,_0x485dab){return function(_0x4bab50){if(_0x4bab50){return _0x4bab50['destroy']()[_0xaa89('0x27')](function(){_0x317f7b[_0xaa89('0x1b')](0xcc)[_0xaa89('0x1c')]();});}};}function handleEntityNotFound(_0x4292d4,_0x5cb1f8){return function(_0x5d39f5){if(!_0x5d39f5){_0x4292d4[_0xaa89('0x1a')](0x194);}return _0x5d39f5;};}function handleError(_0x56d37a,_0xec84e8){_0xec84e8=_0xec84e8||0x1f4;return function(_0xc7c4a3){logger[_0xaa89('0x28')](_0xc7c4a3[_0xaa89('0x29')]);if(_0xc7c4a3[_0xaa89('0x2a')]){delete _0xc7c4a3[_0xaa89('0x2a')];}_0x56d37a['status'](_0xec84e8)[_0xaa89('0x2b')](_0xc7c4a3);};}exports[_0xaa89('0x2c')]=function(_0x55171e,_0x437646){var _0x120cd3={},_0x10a5e6={},_0x55a80a={'count':0x0,'rows':[]};var _0x3db643=_[_0xaa89('0x2d')](db[_0xaa89('0x2e')][_0xaa89('0x2f')],function(_0x280121){return{'name':_0x280121[_0xaa89('0x30')],'type':_0x280121['type'][_0xaa89('0x31')]};});_0x10a5e6[_0xaa89('0x32')]=_['map'](_0x3db643,'name');_0x10a5e6['query']=_[_0xaa89('0x33')](_0x55171e[_0xaa89('0x34')]);_0x10a5e6[_0xaa89('0x35')]=_[_0xaa89('0x36')](_0x10a5e6[_0xaa89('0x32')],_0x10a5e6[_0xaa89('0x34')]);_0x120cd3[_0xaa89('0x37')]=_[_0xaa89('0x36')](_0x10a5e6['model'],qs[_0xaa89('0x38')](_0x55171e[_0xaa89('0x34')][_0xaa89('0x38')]));_0x120cd3[_0xaa89('0x37')]=_0x120cd3[_0xaa89('0x37')][_0xaa89('0x39')]?_0x120cd3[_0xaa89('0x37')]:_0x10a5e6[_0xaa89('0x32')];if(!_0x55171e[_0xaa89('0x34')][_0xaa89('0x3a')]('nolimit')){_0x120cd3['limit']=qs[_0xaa89('0x21')](_0x55171e[_0xaa89('0x34')][_0xaa89('0x21')]);_0x120cd3['offset']=qs['offset'](_0x55171e[_0xaa89('0x34')][_0xaa89('0x1e')]);}_0x120cd3[_0xaa89('0x3b')]=qs[_0xaa89('0x3c')](_0x55171e[_0xaa89('0x34')]['sort']);_0x120cd3[_0xaa89('0x3d')]=qs[_0xaa89('0x35')](_[_0xaa89('0x3e')](_0x55171e[_0xaa89('0x34')],_0x10a5e6[_0xaa89('0x35')]),_0x3db643);if(_0x55171e[_0xaa89('0x34')][_0xaa89('0x3f')]){_0x120cd3['where']=_[_0xaa89('0x40')](_0x120cd3[_0xaa89('0x3d')],{'$or':_['map'](_0x3db643,function(_0x3d0bfd){if(_0x3d0bfd['type']!==_0xaa89('0x41')){var _0x1c6dce={};_0x1c6dce[_0x3d0bfd['name']]={'$like':'%'+_0x55171e[_0xaa89('0x34')]['filter']+'%'};return _0x1c6dce;}})});}_0x120cd3=_[_0xaa89('0x40')]({},_0x120cd3,_0x55171e['options']);var _0x31b1e8={'where':_0x120cd3['where']};return db['ChatInternalMessage'][_0xaa89('0x20')](_0x31b1e8)[_0xaa89('0x27')](function(_0x1d4cb7){_0x55a80a[_0xaa89('0x20')]=_0x1d4cb7;if(_0x55171e[_0xaa89('0x34')][_0xaa89('0x42')]){_0x120cd3[_0xaa89('0x43')]=[{'all':!![]}];}return db[_0xaa89('0x2e')]['findAll'](_0x120cd3);})[_0xaa89('0x27')](function(_0xd25fa6){_0x55a80a[_0xaa89('0x44')]=_0xd25fa6;return _0x55a80a;})[_0xaa89('0x27')](respondWithFilteredResult(_0x437646,_0x120cd3))[_0xaa89('0x45')](handleError(_0x437646,null));};exports['show']=function(_0x106b7b,_0x2f2938){var _0x17d3be={'raw':!![],'where':{'id':_0x106b7b[_0xaa89('0x46')]['id']}},_0x3ca2d3={};_0x3ca2d3['model']=_[_0xaa89('0x33')](db[_0xaa89('0x2e')]['rawAttributes']);_0x3ca2d3[_0xaa89('0x34')]=_[_0xaa89('0x33')](_0x106b7b[_0xaa89('0x34')]);_0x3ca2d3[_0xaa89('0x35')]=_['intersection'](_0x3ca2d3['model'],_0x3ca2d3[_0xaa89('0x34')]);_0x17d3be['attributes']=_[_0xaa89('0x36')](_0x3ca2d3['model'],qs['fields'](_0x106b7b[_0xaa89('0x34')][_0xaa89('0x38')]));_0x17d3be['attributes']=_0x17d3be['attributes'][_0xaa89('0x39')]?_0x17d3be[_0xaa89('0x37')]:_0x3ca2d3[_0xaa89('0x32')];if(_0x106b7b['query'][_0xaa89('0x42')]){_0x17d3be[_0xaa89('0x43')]=[{'all':!![]}];}_0x17d3be=_[_0xaa89('0x40')]({},_0x17d3be,_0x106b7b[_0xaa89('0x47')]);return db[_0xaa89('0x2e')][_0xaa89('0x48')](_0x17d3be)[_0xaa89('0x27')](handleEntityNotFound(_0x2f2938,null))[_0xaa89('0x27')](respondWithResult(_0x2f2938,null))['catch'](handleError(_0x2f2938,null));};exports[_0xaa89('0x49')]=function(_0x16e5d4,_0x55b747){return db[_0xaa89('0x2e')][_0xaa89('0x49')](_0x16e5d4[_0xaa89('0x4a')],{})[_0xaa89('0x27')](respondWithResult(_0x55b747,0xc9))['catch'](handleError(_0x55b747,null));};exports['update']=function(_0x4fd1ce,_0x1c6789){if(_0x4fd1ce['body']['id']){delete _0x4fd1ce[_0xaa89('0x4a')]['id'];}return db[_0xaa89('0x2e')][_0xaa89('0x48')]({'where':{'id':_0x4fd1ce[_0xaa89('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c6789,null))[_0xaa89('0x27')](saveUpdates(_0x4fd1ce['body'],null))[_0xaa89('0x27')](respondWithResult(_0x1c6789,null))[_0xaa89('0x45')](handleError(_0x1c6789,null));};exports[_0xaa89('0x4b')]=function(_0x2c2193,_0x2e44b0){return db[_0xaa89('0x2e')]['find']({'where':{'id':_0x2c2193['params']['id']}})[_0xaa89('0x27')](handleEntityNotFound(_0x2e44b0,null))['then'](removeEntity(_0x2e44b0,null))[_0xaa89('0x45')](handleError(_0x2e44b0,null));};exports[_0xaa89('0x4c')]=function(_0x51df76,_0x204a5e){return db[_0xaa89('0x2e')][_0xaa89('0x4c')]()[_0xaa89('0x27')](respondWithResult(_0x204a5e,null))[_0xaa89('0x45')](handleError(_0x204a5e,null));};function wrapUser(_0x5340c9){return function(_0x294f8d){var _0x44ff59=_0x5340c9['get']({'plain':!![]});_0x44ff59[_0xaa89('0x4d')]=[];if(_0x294f8d){_0x44ff59[_0xaa89('0x4e')]=_0x294f8d['createdAt'];_0x44ff59[_0xaa89('0x4f')]=_0x294f8d;}else{_0x44ff59['lastMessageAt']=moment(0x0)[_0xaa89('0x50')](_0xaa89('0x51'));_0x44ff59['lastMessage']={};}return _0x44ff59;};}exports[_0xaa89('0x52')]=function(_0x65d55e,_0x5a5cba,_0x4814a4){var _0x4d75df=[];return db[_0xaa89('0x53')][_0xaa89('0x54')]({'where':{'role':[_0xaa89('0x55'),'admin',_0xaa89('0x56')]},'attributes':['id',_0xaa89('0x57'),_0xaa89('0x2a'),_0xaa89('0x58'),_0xaa89('0x59'),_0xaa89('0x5a'),_0xaa89('0x5b'),'lastLoginAt','allowmessenger',_0xaa89('0x5c')],'order':qs['sort']('-online'),'include':[{'model':db[_0xaa89('0x5d')],'as':_0xaa89('0x5e'),'attributes':['id','name',_0xaa89('0x5f')],'through':{'attributes':[]}}]})[_0xaa89('0x27')](function(_0x201977){if(_0x201977){var _0xddb8e3=_0x65d55e['user'][_0xaa89('0x60')]({'plain':!![]});if(!_0xddb8e3)throw new Error(_0xaa89('0x61'));if(_0xddb8e3['role']===_0xaa89('0x56')){return db[_0xaa89('0x62')][_0xaa89('0x48')]({'where':{'name':'Agents','userProfileId':_0xddb8e3['userProfileId']},'raw':!![]})[_0xaa89('0x27')](function(_0x38c5af){if(_0x38c5af){if(_0x38c5af[_0xaa89('0x63')]===0x0){return db[_0xaa89('0x64')][_0xaa89('0x54')]({'where':{'sectionId':_0x38c5af['id']},'raw':!![]})[_0xaa89('0x27')](function(_0x26daf4){var _0x1368ae=[];if(_[_0xaa89('0x65')](_0x26daf4)){_0x1368ae=_[_0xaa89('0x3f')](_0x201977,function(_0x2fdd3f){if(_0x2fdd3f[_0xaa89('0x58')]!==_0xaa89('0x55')){return _0x2fdd3f;}});return _0x1368ae;}else{for(var _0x27561d=0x0;_0x27561d<_0x201977[_0xaa89('0x39')];_0x27561d++){var _0x499e6c=_0x201977[_0x27561d];if(_0x499e6c['role']===_0xaa89('0x55')){var _0x4a7783=_[_0xaa89('0x48')](_0x26daf4,function(_0x1839b7){return _0x1839b7[_0xaa89('0x66')]===_0x499e6c['id'];});if(_0x4a7783)_0x1368ae[_0xaa89('0x67')](_0x499e6c);}else{_0x1368ae['push'](_0x499e6c);}}return _0x1368ae;}});}else{return _0x201977;}}else{var _0x20a0fe=_[_0xaa89('0x3f')](_0x201977,function(_0x5a1d1f){if(_0x5a1d1f[_0xaa89('0x58')]!==_0xaa89('0x55')){return _0x5a1d1f;}});return _0x20a0fe;}});}else{return _0x201977;}}})['then'](function(_0x416723){var _0x5f5774=[];if(_0x416723){_0x4d75df=_0x416723;for(var _0x5786a7=0x0;_0x5786a7<_0x416723[_0xaa89('0x39')];_0x5786a7+=0x1){_0x4d75df[_0x5786a7][_0xaa89('0x4d')]=[];_0x5f5774['push'](db[_0xaa89('0x2e')][_0xaa89('0x48')]({'where':{'FromId':[_0x65d55e['user']['id'],_0x416723[_0x5786a7]['id']],'ToId':[_0x65d55e['user']['id'],_0x416723[_0x5786a7]['id']],'ChatGroupId':null},'attributes':['id',_0xaa89('0x68'),_0xaa89('0x69'),'ToId',_0xaa89('0x6a'),'body'],'order':qs[_0xaa89('0x3c')](_0xaa89('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xaa89('0x27')](wrapUser(_0x416723[_0x5786a7])));}return BPromise[_0xaa89('0x6c')](_0x5f5774);}return[];})[_0xaa89('0x27')](function(_0x4ffa14){return{'rows':_0x4ffa14,'count':_0x4ffa14[_0xaa89('0x39')]};})[_0xaa89('0x27')](respondWithResult(_0x5a5cba,null))[_0xaa89('0x45')](handleError(_0x5a5cba,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index bcc0a7d..ba4e92f 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 _0xf8fe=['../../mysqldb','update','remove','emit','hasOwnProperty','exports'];(function(_0x3238da,_0x486015){var _0x540d8b=function(_0x1fa6d7){while(--_0x1fa6d7){_0x3238da['push'](_0x3238da['shift']());}};_0x540d8b(++_0x486015);}(_0xf8fe,0xea));var _0xef8f=function(_0x32768c,_0x415a06){_0x32768c=_0x32768c-0x0;var _0x1ca355=_0xf8fe[_0x32768c];return _0x1ca355;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xef8f('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xef8f('0x1'),'afterDestroy':_0xef8f('0x2')};function emitEvent(_0x1da4ea){return function(_0x55165e,_0x2c11d4,_0x2e6c92){ChatInternalMessageEvents[_0xef8f('0x3')](_0x1da4ea+':'+_0x55165e['id'],_0x55165e);ChatInternalMessageEvents[_0xef8f('0x3')](_0x1da4ea,_0x55165e);_0x2e6c92(null);};}for(var e in events){if(events[_0xef8f('0x4')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xef8f('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xf24b=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x4ab5f4,_0x199174){var _0x2fe644=function(_0x3393da){while(--_0x3393da){_0x4ab5f4['push'](_0x4ab5f4['shift']());}};_0x2fe644(++_0x199174);}(_0xf24b,0xad));var _0xbf24=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0xf24b[_0x5447aa];return _0xb21e53;};'use strict';var EventEmitter=require(_0xbf24('0x0'));var ChatInternalMessage=require(_0xbf24('0x1'))['db'][_0xbf24('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbf24('0x3'),'afterUpdate':'update','afterDestroy':_0xbf24('0x4')};function emitEvent(_0x192eb0){return function(_0x5a2d0b,_0x161abf,_0x2476fd){ChatInternalMessageEvents[_0xbf24('0x5')](_0x192eb0+':'+_0x5a2d0b['id'],_0x5a2d0b);ChatInternalMessageEvents[_0xbf24('0x5')](_0x192eb0,_0x5a2d0b);_0x2476fd(null);};}for(var e in events){if(events[_0xbf24('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xbf24('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 e7da86f..ca98b04 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 _0x19d2=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x4e029f,_0x177074){var _0x135b7e=function(_0x37caff){while(--_0x37caff){_0x4e029f['push'](_0x4e029f['shift']());}};_0x135b7e(++_0x177074);}(_0x19d2,0x124));var _0x219d=function(_0x125aa7,_0x107f48){_0x125aa7=_0x125aa7-0x0;var _0x3792da=_0x19d2[_0x125aa7];return _0x3792da;};'use strict';var _=require(_0x219d('0x0'));var util=require('util');var logger=require(_0x219d('0x1'))(_0x219d('0x2'));var moment=require(_0x219d('0x3'));var BPromise=require('bluebird');var rp=require(_0x219d('0x4'));var fs=require('fs');var path=require(_0x219d('0x5'));var rimraf=require(_0x219d('0x6'));var config=require(_0x219d('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x219d('0x8')]=function(_0x24b2ac,_0x4d949a){return _0x24b2ac[_0x219d('0x9')](_0x219d('0xa'),attributes,{'tableName':_0x219d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x219d('0xc'),'collate':_0x219d('0xd')});}; \ No newline at end of file +var _0xa19b=['lodash','api','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa19b,0x90));var _0xba19=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa19b[_0x432682];return _0x463d05;};'use strict';var _=require(_0xba19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba19('0x1'));var moment=require('moment');var BPromise=require(_0xba19('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba19('0x3'));var rimraf=require(_0xba19('0x4'));var config=require(_0xba19('0x5'));var attributes=require(_0xba19('0x6'));module[_0xba19('0x7')]=function(_0x5d89b1,_0x107abc){return _0x5d89b1[_0xba19('0x8')]('ChatInternalMessage',attributes,{'tableName':_0xba19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba19('0xa'),'collate':_0xba19('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index a850247..aef6032 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 _0xb9c6=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x454b06,_0x40e829){var _0x461e40=function(_0x1b839f){while(--_0x1b839f){_0x454b06['push'](_0x454b06['shift']());}};_0x461e40(++_0x40e829);}(_0xb9c6,0x1d8));var _0x6b9c=function(_0x3bf266,_0x4f2609){_0x3bf266=_0x3bf266-0x0;var _0x211ec8=_0xb9c6[_0x3bf266];return _0x211ec8;};'use strict';var _=require(_0x6b9c('0x0'));var util=require(_0x6b9c('0x1'));var moment=require(_0x6b9c('0x2'));var BPromise=require(_0x6b9c('0x3'));var rs=require(_0x6b9c('0x4'));var fs=require('fs');var Redis=require(_0x6b9c('0x5'));var db=require(_0x6b9c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b9c('0x7'));var config=require(_0x6b9c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6b9c('0x9')]({'port':0x232a});config['redis']=_[_0x6b9c('0xa')](config[_0x6b9c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b9c('0xc'))(new Redis(config[_0x6b9c('0xb')]));require(_0x6b9c('0xd'))[_0x6b9c('0xe')](socket);function respondWithRpcPromise(_0x33cac2,_0x130753,_0x263c9e){return new BPromise(function(_0x458c20,_0x5595d7){return client[_0x6b9c('0xf')](_0x33cac2,_0x263c9e)[_0x6b9c('0x10')](function(_0x115237){logger[_0x6b9c('0x11')](_0x6b9c('0x12'),_0x130753,'request\x20sent');logger[_0x6b9c('0x13')](_0x6b9c('0x14'),_0x130753,_0x6b9c('0x15'),JSON['stringify'](_0x115237));if(_0x115237['error']){if(_0x115237[_0x6b9c('0x16')]['code']===0x1f4){logger[_0x6b9c('0x16')](_0x6b9c('0x12'),_0x130753,_0x115237[_0x6b9c('0x16')]['message']);return _0x5595d7(_0x115237[_0x6b9c('0x16')][_0x6b9c('0x17')]);}logger['error'](_0x6b9c('0x12'),_0x130753,_0x115237[_0x6b9c('0x16')][_0x6b9c('0x17')]);return _0x458c20(_0x115237[_0x6b9c('0x16')][_0x6b9c('0x17')]);}else{logger[_0x6b9c('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x130753,_0x6b9c('0x15'));_0x458c20(_0x115237[_0x6b9c('0x18')][_0x6b9c('0x17')]);}})[_0x6b9c('0x19')](function(_0x26b975){logger[_0x6b9c('0x16')](_0x6b9c('0x12'),_0x130753,_0x26b975);_0x5595d7(_0x26b975);});});} \ No newline at end of file +var _0xe9d5=['then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request'];(function(_0x48a81d,_0x2b3d9e){var _0x19699a=function(_0x117ebf){while(--_0x117ebf){_0x48a81d['push'](_0x48a81d['shift']());}};_0x19699a(++_0x2b3d9e);}(_0xe9d5,0x191));var _0x5e9d=function(_0x42ce25,_0x7f11aa){_0x42ce25=_0x42ce25-0x0;var _0x14b4cd=_0xe9d5[_0x42ce25];return _0x14b4cd;};'use strict';var _=require(_0x5e9d('0x0'));var util=require(_0x5e9d('0x1'));var moment=require(_0x5e9d('0x2'));var BPromise=require(_0x5e9d('0x3'));var rs=require(_0x5e9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e9d('0x5'))['db'];var utils=require(_0x5e9d('0x6'));var logger=require(_0x5e9d('0x7'))(_0x5e9d('0x8'));var config=require(_0x5e9d('0x9'));var jayson=require(_0x5e9d('0xa'));var client=jayson[_0x5e9d('0xb')][_0x5e9d('0xc')]({'port':0x232a});config[_0x5e9d('0xd')]=_[_0x5e9d('0xe')](config[_0x5e9d('0xd')],{'host':_0x5e9d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e9d('0xd')]));require(_0x5e9d('0x10'))[_0x5e9d('0x11')](socket);function respondWithRpcPromise(_0x43a167,_0x11d50b,_0x289b5f){return new BPromise(function(_0x206aaa,_0x4ffe05){return client[_0x5e9d('0x12')](_0x43a167,_0x289b5f)[_0x5e9d('0x13')](function(_0x4d7f33){logger[_0x5e9d('0x14')](_0x5e9d('0x15'),_0x11d50b,_0x5e9d('0x16'));logger[_0x5e9d('0x17')](_0x5e9d('0x18'),_0x11d50b,_0x5e9d('0x16'),JSON[_0x5e9d('0x19')](_0x4d7f33));if(_0x4d7f33[_0x5e9d('0x1a')]){if(_0x4d7f33[_0x5e9d('0x1a')][_0x5e9d('0x1b')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x11d50b,_0x4d7f33[_0x5e9d('0x1a')][_0x5e9d('0x1c')]);return _0x4ffe05(_0x4d7f33[_0x5e9d('0x1a')]['message']);}logger['error'](_0x5e9d('0x15'),_0x11d50b,_0x4d7f33[_0x5e9d('0x1a')][_0x5e9d('0x1c')]);return _0x206aaa(_0x4d7f33[_0x5e9d('0x1a')]['message']);}else{logger[_0x5e9d('0x14')](_0x5e9d('0x15'),_0x11d50b,'request\x20sent');_0x206aaa(_0x4d7f33[_0x5e9d('0x1d')][_0x5e9d('0x1c')]);}})['catch'](function(_0x53b7c4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x11d50b,_0x53b7c4);_0x4ffe05(_0x53b7c4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 018730f..2170e97 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 _0xad38=['chatInternalMessage:','remove','update','emit','removeListener','register'];(function(_0xbb9475,_0x2bf0d1){var _0x1c1883=function(_0x141b57){while(--_0x141b57){_0xbb9475['push'](_0xbb9475['shift']());}};_0x1c1883(++_0x2bf0d1);}(_0xad38,0x163));var _0x8ad3=function(_0x5e4a0a,_0x44b745){_0x5e4a0a=_0x5e4a0a-0x0;var _0x487960=_0xad38[_0x5e4a0a];return _0x487960;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x8ad3('0x0'),_0x8ad3('0x1')];function createListener(_0x31a856,_0x46299f){return function(_0x597639){_0x46299f[_0x8ad3('0x2')](_0x31a856,_0x597639);};}function removeListener(_0x4e8ec3,_0x194d7c){return function(){ChatInternalMessageEvents[_0x8ad3('0x3')](_0x4e8ec3,_0x194d7c);};}exports[_0x8ad3('0x4')]=function(_0x2bdd16){for(var _0xc5d455=0x0,_0x392031=events['length'];_0xc5d455<_0x392031;_0xc5d455++){var _0x2e574a=events[_0xc5d455];var _0x132ab8=createListener(_0x8ad3('0x5')+_0x2e574a,_0x2bdd16);ChatInternalMessageEvents['on'](_0x2e574a,_0x132ab8);}}; \ No newline at end of file +var _0xe57b=['update','emit','removeListener','register','length','./chatInternalMessage.events','save'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe57b,0x1b0));var _0xbe57=function(_0x29ef86,_0x189bd1){_0x29ef86=_0x29ef86-0x0;var _0x37afd7=_0xe57b[_0x29ef86];return _0x37afd7;};'use strict';var ChatInternalMessageEvents=require(_0xbe57('0x0'));var events=[_0xbe57('0x1'),'remove',_0xbe57('0x2')];function createListener(_0x1eabbe,_0x790f04){return function(_0x5e5781){_0x790f04[_0xbe57('0x3')](_0x1eabbe,_0x5e5781);};}function removeListener(_0x1f0e1c,_0x111787){return function(){ChatInternalMessageEvents[_0xbe57('0x4')](_0x1f0e1c,_0x111787);};}exports[_0xbe57('0x5')]=function(_0x345b87){for(var _0x23608a=0x0,_0x4165b7=events[_0xbe57('0x6')];_0x23608a<_0x4165b7;_0x23608a++){var _0x9e18c1=events[_0x23608a];var _0x5cd66a=createListener('chatInternalMessage:'+_0x9e18c1,_0x345b87);ChatInternalMessageEvents['on'](_0x9e18c1,_0x5cd66a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 6c20f59..ce1bde7 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 _0xb478=['index','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x3560de,_0x28b150){var _0x2d31c1=function(_0x1c13d9){while(--_0x1c13d9){_0x3560de['push'](_0x3560de['shift']());}};_0x2d31c1(++_0x28b150);}(_0xb478,0xef));var _0x8b47=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0xb478[_0x15c5b8];return _0xd45fe6;};'use strict';var multer=require(_0x8b47('0x0'));var util=require(_0x8b47('0x1'));var path=require(_0x8b47('0x2'));var timeout=require(_0x8b47('0x3'));var express=require(_0x8b47('0x4'));var router=express[_0x8b47('0x5')]();var fs_extra=require(_0x8b47('0x6'));var auth=require(_0x8b47('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8b47('0x8'));router[_0x8b47('0x9')]('/',auth[_0x8b47('0xa')](),controller[_0x8b47('0xb')]);router['get'](_0x8b47('0xc'),auth['isAuthenticated'](),controller[_0x8b47('0xd')]);router['get'](_0x8b47('0xe'),auth['isAuthenticated'](),controller[_0x8b47('0xf')]);router[_0x8b47('0x9')](_0x8b47('0x10'),auth[_0x8b47('0xa')](),controller[_0x8b47('0x11')]);router[_0x8b47('0x12')]('/',auth[_0x8b47('0xa')](),controller[_0x8b47('0x13')]);router[_0x8b47('0x14')](_0x8b47('0x10'),controller[_0x8b47('0x15')]);router[_0x8b47('0x16')]('/:id',auth[_0x8b47('0xa')](),controller[_0x8b47('0x17')]);module[_0x8b47('0x18')]=router; \ No newline at end of file +var _0x1b95=['./chatInternalMessage.controller','isAuthenticated','index','/describe','describe','get','/users','getUsers','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23b766,_0xcf9d63){var _0x48043c=function(_0x2fa23e){while(--_0x2fa23e){_0x23b766['push'](_0x23b766['shift']());}};_0x48043c(++_0xcf9d63);}(_0x1b95,0xfa));var _0x51b9=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x1b95[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0x51b9('0x0'));var util=require(_0x51b9('0x1'));var path=require(_0x51b9('0x2'));var timeout=require(_0x51b9('0x3'));var express=require(_0x51b9('0x4'));var router=express[_0x51b9('0x5')]();var fs_extra=require(_0x51b9('0x6'));var auth=require(_0x51b9('0x7'));var interaction=require(_0x51b9('0x8'));var config=require(_0x51b9('0x9'));var controller=require(_0x51b9('0xa'));router['get']('/',auth[_0x51b9('0xb')](),controller[_0x51b9('0xc')]);router['get'](_0x51b9('0xd'),auth[_0x51b9('0xb')](),controller[_0x51b9('0xe')]);router[_0x51b9('0xf')](_0x51b9('0x10'),auth[_0x51b9('0xb')](),controller[_0x51b9('0x11')]);router[_0x51b9('0xf')](_0x51b9('0x12'),auth[_0x51b9('0xb')](),controller[_0x51b9('0x13')]);router[_0x51b9('0x14')]('/',auth[_0x51b9('0xb')](),controller[_0x51b9('0x15')]);router[_0x51b9('0x16')]('/:id',controller[_0x51b9('0x17')]);router['delete'](_0x51b9('0x12'),auth[_0x51b9('0xb')](),controller[_0x51b9('0x18')]);module[_0x51b9('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 5e357fd..0b8c908 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 _0x14b7=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x17d239,_0x30fd40){var _0x47014d=function(_0x127386){while(--_0x127386){_0x17d239['push'](_0x17d239['shift']());}};_0x47014d(++_0x30fd40);}(_0x14b7,0x144));var _0x714b=function(_0x6f0911,_0x5721c6){_0x6f0911=_0x6f0911-0x0;var _0x48cf3b=_0x14b7[_0x6f0911];return _0x48cf3b;};'use strict';var Sequelize=require(_0x714b('0x0'));module[_0x714b('0x1')]={'body':{'type':Sequelize[_0x714b('0x2')](_0x714b('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x714b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x714b('0x5')]('in',_0x714b('0x6')),'defaultValue':_0x714b('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x714b('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa699=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x2d2a28,_0x1e4f9a){var _0xc4cd58=function(_0x28d4a8){while(--_0x28d4a8){_0x2d2a28['push'](_0x2d2a28['shift']());}};_0xc4cd58(++_0x1e4f9a);}(_0xa699,0x6b));var _0x9a69=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xa699[_0x420f2a];return _0x28f802;};'use strict';var Sequelize=require(_0x9a69('0x0'));module[_0x9a69('0x1')]={'body':{'type':Sequelize[_0x9a69('0x2')](_0x9a69('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9a69('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9a69('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9a69('0x5')]('in',_0x9a69('0x6')),'defaultValue':_0x9a69('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9a69('0x7')]},'providerName':{'type':Sequelize[_0x9a69('0x8')]},'providerResponse':{'type':Sequelize[_0x9a69('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index deff7a5..a685dd2 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 _0xa6b8=['options','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','contact','internal','event','formData','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','include','show','params','length','includeAll'];(function(_0x1d2bbb,_0x5c1e3b){var _0x2878df=function(_0x23f10a){while(--_0x23f10a){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x2878df(++_0x5c1e3b);}(_0xa6b8,0x1bd));var _0x8a6b=function(_0x3a4078,_0x56ceac){_0x3a4078=_0x3a4078-0x0;var _0x59f16d=_0xa6b8[_0x3a4078];return _0x59f16d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a6b('0x0'));var zipdir=require(_0x8a6b('0x1'));var jsonpatch=require(_0x8a6b('0x2'));var rp=require(_0x8a6b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8a6b('0x4'));var util=require(_0x8a6b('0x5'));var path=require(_0x8a6b('0x6'));var sox=require(_0x8a6b('0x7'));var csv=require(_0x8a6b('0x8'));var ejs=require(_0x8a6b('0x9'));var fs=require('fs');var fs_extra=require(_0x8a6b('0xa'));var _=require(_0x8a6b('0xb'));var squel=require(_0x8a6b('0xc'));var crypto=require('crypto');var jsforce=require(_0x8a6b('0xd'));var deskjs=require(_0x8a6b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8a6b('0xf'));var Papa=require('papaparse');var Redis=require(_0x8a6b('0x10'));var authService=require(_0x8a6b('0x11'));var qs=require(_0x8a6b('0x12'));var as=require(_0x8a6b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a6b('0x14'))(_0x8a6b('0x15'));var utils=require(_0x8a6b('0x16'));var config=require(_0x8a6b('0x17'));var licenseUtil=require(_0x8a6b('0x18'));var db=require(_0x8a6b('0x19'))['db'];config[_0x8a6b('0x1a')]=_[_0x8a6b('0x1b')](config[_0x8a6b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a6b('0x1c'))(new Redis(config[_0x8a6b('0x1a')]));require(_0x8a6b('0x1d'))['register'](socket);var jayson=require(_0x8a6b('0x1e'));var client=jayson[_0x8a6b('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x8a6b('0x1f')][_0x8a6b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3ed90e,_0x47bd22,_0x389bde,_0x294435){return new BPromise(function(_0x35ef69,_0x1ad18e){var _0x524649=_0x294435||client;return _0x524649[_0x8a6b('0x21')](_0x3ed90e,_0x389bde)[_0x8a6b('0x22')](function(_0x2b74a0){logger[_0x8a6b('0x23')](_0x8a6b('0x24'),_0x47bd22,'request\x20sent');logger[_0x8a6b('0x25')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x47bd22,'request\x20sent',JSON[_0x8a6b('0x26')](_0x2b74a0));if(_0x2b74a0['error']){if(_0x2b74a0[_0x8a6b('0x27')]['code']===0x1f4){logger[_0x8a6b('0x27')]('ChatMessage,\x20%s,\x20%s',_0x47bd22,_0x2b74a0[_0x8a6b('0x27')][_0x8a6b('0x28')]);return _0x1ad18e(_0x2b74a0[_0x8a6b('0x27')][_0x8a6b('0x28')]);}logger['error'](_0x8a6b('0x24'),_0x47bd22,_0x2b74a0[_0x8a6b('0x27')][_0x8a6b('0x28')]);return _0x35ef69(_0x2b74a0[_0x8a6b('0x27')][_0x8a6b('0x28')]);}else{logger[_0x8a6b('0x23')](_0x8a6b('0x24'),_0x47bd22,_0x8a6b('0x29'));_0x35ef69(_0x2b74a0[_0x8a6b('0x2a')][_0x8a6b('0x28')]);}})[_0x8a6b('0x2b')](function(_0x2fe3cd){logger['error']('ChatMessage,\x20%s,\x20%s',_0x47bd22,_0x2fe3cd);_0x1ad18e(_0x2fe3cd);});});}function respondWithStatusCode(_0x228423,_0x1874ca){_0x1874ca=_0x1874ca||0xcc;return function(_0x54d220){if(_0x54d220){return _0x228423[_0x8a6b('0x2c')](_0x1874ca);}return _0x228423[_0x8a6b('0x2d')](_0x1874ca)[_0x8a6b('0x2e')]();};}function respondWithResult(_0x3ceee5,_0x41ff27){_0x41ff27=_0x41ff27||0xc8;return function(_0x4ac05e){if(_0x4ac05e){return _0x3ceee5[_0x8a6b('0x2d')](_0x41ff27)[_0x8a6b('0x2f')](_0x4ac05e);}};}function respondWithFilteredResult(_0x48515b,_0x564b15){return function(_0x3469a4){if(_0x3469a4){var _0x31d162=typeof _0x564b15[_0x8a6b('0x30')]==='undefined'&&typeof _0x564b15[_0x8a6b('0x31')]===_0x8a6b('0x32');var _0x44846b=_0x3469a4['count'];var _0x2b20f1=_0x31d162?0x0:_0x564b15['offset'];var _0x5c8dbb=_0x31d162?_0x3469a4[_0x8a6b('0x33')]:_0x564b15[_0x8a6b('0x30')]+_0x564b15[_0x8a6b('0x31')];var _0x4da7f4;if(_0x5c8dbb>=_0x44846b){_0x5c8dbb=_0x44846b;_0x4da7f4=0xc8;}else{_0x4da7f4=0xce;}_0x48515b[_0x8a6b('0x2d')](_0x4da7f4);return _0x48515b[_0x8a6b('0x34')]('Content-Range',_0x2b20f1+'-'+_0x5c8dbb+'/'+_0x44846b)[_0x8a6b('0x2f')](_0x3469a4);}return null;};}function patchUpdates(_0x8757e5){return function(_0x6ee551){try{jsonpatch['apply'](_0x6ee551,_0x8757e5,!![]);}catch(_0x20cf9a){return BPromise['reject'](_0x20cf9a);}return _0x6ee551['save']();};}function saveUpdates(_0x397249,_0x2cb984){return function(_0x3a637d){if(_0x3a637d){return _0x3a637d[_0x8a6b('0x35')](_0x397249)[_0x8a6b('0x22')](function(_0x2c0352){return _0x2c0352;});}return null;};}function removeEntity(_0x2139f2,_0x2b810e){return function(_0x3581c5){if(_0x3581c5){return _0x3581c5[_0x8a6b('0x36')]()[_0x8a6b('0x22')](function(){_0x2139f2['status'](0xcc)[_0x8a6b('0x2e')]();});}};}function handleEntityNotFound(_0x487559,_0x1db5f3){return function(_0x23abac){if(!_0x23abac){_0x487559[_0x8a6b('0x2c')](0x194);}return _0x23abac;};}function handleError(_0x2bc3b5,_0x378d25){_0x378d25=_0x378d25||0x1f4;return function(_0x3d256f){logger[_0x8a6b('0x27')](_0x3d256f[_0x8a6b('0x37')]);if(_0x3d256f[_0x8a6b('0x38')]){delete _0x3d256f[_0x8a6b('0x38')];}_0x2bc3b5[_0x8a6b('0x2d')](_0x378d25)[_0x8a6b('0x39')](_0x3d256f);};}exports[_0x8a6b('0x3a')]=function(_0x2d4aba,_0x5edf50){var _0x2e9a11={},_0x3a82ad={},_0x54b485={'count':0x0,'rows':[]};var _0x4ee133=_[_0x8a6b('0x3b')](db[_0x8a6b('0x3c')][_0x8a6b('0x3d')],function(_0x465a60){return{'name':_0x465a60[_0x8a6b('0x3e')],'type':_0x465a60[_0x8a6b('0x3f')]['key']};});_0x3a82ad[_0x8a6b('0x40')]=_[_0x8a6b('0x3b')](_0x4ee133,_0x8a6b('0x38'));_0x3a82ad[_0x8a6b('0x41')]=_[_0x8a6b('0x42')](_0x2d4aba['query']);_0x3a82ad['filters']=_[_0x8a6b('0x43')](_0x3a82ad[_0x8a6b('0x40')],_0x3a82ad[_0x8a6b('0x41')]);_0x2e9a11[_0x8a6b('0x44')]=_[_0x8a6b('0x43')](_0x3a82ad['model'],qs[_0x8a6b('0x45')](_0x2d4aba[_0x8a6b('0x41')]['fields']));_0x2e9a11[_0x8a6b('0x44')]=_0x2e9a11[_0x8a6b('0x44')]['length']?_0x2e9a11[_0x8a6b('0x44')]:_0x3a82ad['model'];if(!_0x2d4aba[_0x8a6b('0x41')]['hasOwnProperty'](_0x8a6b('0x46'))){_0x2e9a11[_0x8a6b('0x31')]=qs[_0x8a6b('0x31')](_0x2d4aba[_0x8a6b('0x41')]['limit']);_0x2e9a11['offset']=qs[_0x8a6b('0x30')](_0x2d4aba[_0x8a6b('0x41')][_0x8a6b('0x30')]);}_0x2e9a11[_0x8a6b('0x47')]=qs['sort'](_0x2d4aba[_0x8a6b('0x41')][_0x8a6b('0x48')]);_0x2e9a11[_0x8a6b('0x49')]=qs[_0x8a6b('0x4a')](_['pick'](_0x2d4aba[_0x8a6b('0x41')],_0x3a82ad[_0x8a6b('0x4a')]),_0x4ee133);if(_0x2d4aba[_0x8a6b('0x41')]['filter']){_0x2e9a11['where']=_[_0x8a6b('0x4b')](_0x2e9a11['where'],{'$or':_['map'](_0x4ee133,function(_0x30d5b3){if(_0x30d5b3[_0x8a6b('0x3f')]!==_0x8a6b('0x4c')){var _0x46cf45={};_0x46cf45[_0x30d5b3[_0x8a6b('0x38')]]={'$like':'%'+_0x2d4aba[_0x8a6b('0x41')][_0x8a6b('0x4d')]+'%'};return _0x46cf45;}})});}_0x2e9a11=_[_0x8a6b('0x4b')]({},_0x2e9a11,_0x2d4aba['options']);var _0x409aa2={'where':_0x2e9a11[_0x8a6b('0x49')]};return db[_0x8a6b('0x3c')]['count'](_0x409aa2)[_0x8a6b('0x22')](function(_0x52870a){_0x54b485[_0x8a6b('0x33')]=_0x52870a;if(_0x2d4aba[_0x8a6b('0x41')]['includeAll']){_0x2e9a11[_0x8a6b('0x4e')]=[{'all':!![]}];}return db[_0x8a6b('0x3c')]['findAll'](_0x2e9a11);})[_0x8a6b('0x22')](function(_0x2a3c44){_0x54b485['rows']=_0x2a3c44;return _0x54b485;})[_0x8a6b('0x22')](respondWithFilteredResult(_0x5edf50,_0x2e9a11))[_0x8a6b('0x2b')](handleError(_0x5edf50,null));};exports[_0x8a6b('0x4f')]=function(_0x2907ef,_0x32fa83){var _0x2ac311={'raw':!![],'where':{'id':_0x2907ef[_0x8a6b('0x50')]['id']}},_0x3176c1={};_0x3176c1[_0x8a6b('0x40')]=_[_0x8a6b('0x42')](db[_0x8a6b('0x3c')]['rawAttributes']);_0x3176c1[_0x8a6b('0x41')]=_[_0x8a6b('0x42')](_0x2907ef[_0x8a6b('0x41')]);_0x3176c1[_0x8a6b('0x4a')]=_['intersection'](_0x3176c1[_0x8a6b('0x40')],_0x3176c1[_0x8a6b('0x41')]);_0x2ac311[_0x8a6b('0x44')]=_[_0x8a6b('0x43')](_0x3176c1['model'],qs[_0x8a6b('0x45')](_0x2907ef[_0x8a6b('0x41')][_0x8a6b('0x45')]));_0x2ac311['attributes']=_0x2ac311['attributes'][_0x8a6b('0x51')]?_0x2ac311['attributes']:_0x3176c1[_0x8a6b('0x40')];if(_0x2907ef[_0x8a6b('0x41')][_0x8a6b('0x52')]){_0x2ac311[_0x8a6b('0x4e')]=[{'all':!![]}];}_0x2ac311=_[_0x8a6b('0x4b')]({},_0x2ac311,_0x2907ef[_0x8a6b('0x53')]);return db[_0x8a6b('0x3c')][_0x8a6b('0x54')](_0x2ac311)[_0x8a6b('0x22')](handleEntityNotFound(_0x32fa83,null))['then'](respondWithResult(_0x32fa83,null))[_0x8a6b('0x2b')](handleError(_0x32fa83,null));};exports[_0x8a6b('0x55')]=function(_0x139052,_0x581fc1){return db[_0x8a6b('0x3c')][_0x8a6b('0x55')](_0x139052[_0x8a6b('0x56')],{})['then'](respondWithResult(_0x581fc1,0xc9))['catch'](handleError(_0x581fc1,null));};exports['update']=function(_0x54b7d1,_0x2e76e4){if(_0x54b7d1[_0x8a6b('0x56')]['id']){delete _0x54b7d1[_0x8a6b('0x56')]['id'];}return db['ChatMessage'][_0x8a6b('0x54')]({'where':{'id':_0x54b7d1['params']['id']}})['then'](handleEntityNotFound(_0x2e76e4,null))['then'](saveUpdates(_0x54b7d1[_0x8a6b('0x56')],null))[_0x8a6b('0x22')](respondWithResult(_0x2e76e4,null))[_0x8a6b('0x2b')](handleError(_0x2e76e4,null));};exports[_0x8a6b('0x36')]=function(_0x71b14d,_0x578956){return db[_0x8a6b('0x3c')][_0x8a6b('0x54')]({'where':{'id':_0x71b14d[_0x8a6b('0x50')]['id']}})[_0x8a6b('0x22')](handleEntityNotFound(_0x578956,null))[_0x8a6b('0x22')](removeEntity(_0x578956,null))[_0x8a6b('0x2b')](handleError(_0x578956,null));};exports['describe']=function(_0x28ccf0,_0x2b5708){return db[_0x8a6b('0x3c')][_0x8a6b('0x57')]()['then'](respondWithResult(_0x2b5708,null))[_0x8a6b('0x2b')](handleError(_0x2b5708,null));};var interaction_log=require(_0x8a6b('0x14'))(_0x8a6b('0x58'));exports[_0x8a6b('0x59')]=function(_0x2ccc80,_0x57bfec,_0x212f81){var _0x9b5692={'agent':{},'channel':_0x8a6b('0x5a')};if(_0x2ccc80['body']['id']){delete _0x2ccc80['body']['id'];}_0x2ccc80[_0x8a6b('0x56')][_0x8a6b('0x5b')]=!![];_0x2ccc80[_0x8a6b('0x56')][_0x8a6b('0x5c')]=moment()[_0x8a6b('0x5d')](_0x8a6b('0x5e'));_0x2ccc80['body'][_0x8a6b('0x5f')]=_0x2ccc80[_0x8a6b('0x56')]['UserId']||_0x2ccc80[_0x8a6b('0x60')]['id'];_0x9b5692[_0x8a6b('0x61')]['id']=_0x2ccc80[_0x8a6b('0x56')][_0x8a6b('0x5f')];return db[_0x8a6b('0x3c')][_0x8a6b('0x54')]({'where':{'id':_0x2ccc80[_0x8a6b('0x50')]['id'],'UserId':null}})[_0x8a6b('0x22')](handleEntityNotFound(_0x57bfec,null))[_0x8a6b('0x22')](saveUpdates(_0x2ccc80[_0x8a6b('0x56')],null))[_0x8a6b('0x22')](function(_0x47d2a9){if(_0x47d2a9){_0x9b5692['message']=_0x47d2a9[_0x8a6b('0x62')]({'plain':!![]});return db[_0x8a6b('0x63')][_0x8a6b('0x54')]({'where':{'id':_0x47d2a9[_0x8a6b('0x64')]}});}return null;})[_0x8a6b('0x22')](handleEntityNotFound(_0x57bfec,null))[_0x8a6b('0x22')](function(_0x1910fe){if(_0x1910fe){return _0x1910fe['update']({'UserId':_0x2ccc80['body'][_0x8a6b('0x5f')],'read1stAt':_[_0x8a6b('0x65')](_0x1910fe[_0x8a6b('0x66')])?moment()['format'](_0x8a6b('0x5e')):undefined});}return null;})['then'](function(_0x36ed56){if(_0x36ed56){_0x9b5692[_0x8a6b('0x67')]=_0x36ed56['get']({'plain':!![]});interaction_log[_0x8a6b('0x23')](_0x8a6b('0x68'),_0x2ccc80[_0x8a6b('0x60')]['id'],_0x2ccc80[_0x8a6b('0x60')]['name'],_0x2ccc80[_0x8a6b('0x60')][_0x8a6b('0x69')],_0x9b5692[_0x8a6b('0x67')]['id'],_0x2ccc80[_0x8a6b('0x56')]?JSON[_0x8a6b('0x26')](_0x2ccc80[_0x8a6b('0x56')]):_0x8a6b('0x6a'));return respondWithRpcPromise(_0x8a6b('0x6b'),_0x8a6b('0x6c'),_0x9b5692);}return null;})[_0x8a6b('0x22')](function(_0x12c331){var _0x4aa208=_0x8a6b('0x6d')+_0x12c331[_0x8a6b('0x28')][_0x8a6b('0x6e')];return db[_0x8a6b('0x6f')][_0x8a6b('0x41')](_0x4aa208,{'type':db[_0x8a6b('0x70')][_0x8a6b('0x71')]['SELECT'],'raw':!![]})[_0x8a6b('0x22')](function(_0x26eacd){return _0x26eacd;});})[_0x8a6b('0x22')](function(_0x4633cd){if(_0x4633cd){_0x9b5692[_0x8a6b('0x28')]['contact']=_0x4633cd[0x0];if(!_0x2ccc80[_0x8a6b('0x56')][_0x8a6b('0x5f')])return;return db[_0x8a6b('0x72')][_0x8a6b('0x54')]({'where':{'id':_0x2ccc80[_0x8a6b('0x56')]['UserId'],'role':_0x8a6b('0x61')},'attributes':['id',_0x8a6b('0x38'),_0x8a6b('0x73'),_0x8a6b('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2acb94){if(!_0x2acb94)return null;_0x9b5692[_0x8a6b('0x28')][_0x8a6b('0x61')]=_0x2acb94;return _0x9b5692;})['then'](function(_0x674d0e){if(_0x674d0e){if(_0x2ccc80[_0x8a6b('0x56')]['manual']){_0x9b5692['message']['interface']=util[_0x8a6b('0x5d')](_0x8a6b('0x75'),_0x2ccc80[_0x8a6b('0x60')][_0x8a6b('0x38')]);_0x9b5692[_0x8a6b('0x28')][_0x8a6b('0x76')]=_0x9b5692[_0x8a6b('0x76')];_0x9b5692[_0x8a6b('0x28')][_0x8a6b('0x77')]=_0x9b5692[_0x8a6b('0x76')];_0x9b5692[_0x8a6b('0x28')]['event']=_0x8a6b('0x59');return respondWithRpcPromise(_0x8a6b('0x78'),'EventManager',{'event':_0x8a6b('0x79'),'message':_[_0x8a6b('0x4b')](_0x9b5692[_0x8a6b('0x28')],JSON[_0x8a6b('0x7a')](_0x9b5692[_0x8a6b('0x67')]['formData']))},client9002)[_0x8a6b('0x22')](function(){return _0x9b5692;});}return _0x9b5692;}return null;})[_0x8a6b('0x22')](respondWithResult(_0x57bfec,null))[_0x8a6b('0x2b')](handleError(_0x57bfec,null));};var interaction_log=require(_0x8a6b('0x14'))(_0x8a6b('0x58'));exports[_0x8a6b('0x7b')]=function(_0xad151,_0x526591,_0x2a3733){var _0x26a07e={'agent':{},'channel':_0x8a6b('0x5a')};if(_0xad151[_0x8a6b('0x56')]['id']){delete _0xad151['body']['id'];}_0xad151[_0x8a6b('0x56')]['UserId']=_0xad151['body']['UserId']||_0xad151[_0x8a6b('0x60')]['id'];_0x26a07e[_0x8a6b('0x61')]['id']=_0xad151[_0x8a6b('0x56')][_0x8a6b('0x5f')];return db['ChatMessage'][_0x8a6b('0x54')]({'where':{'id':_0xad151[_0x8a6b('0x50')]['id'],'UserId':null}})[_0x8a6b('0x22')](handleEntityNotFound(_0x526591,null))[_0x8a6b('0x22')](function(_0x3d6e44){if(_0x3d6e44){_0x26a07e[_0x8a6b('0x28')]=_0x3d6e44[_0x8a6b('0x62')]({'plain':!![]});return db[_0x8a6b('0x63')][_0x8a6b('0x54')]({'where':{'id':_0x3d6e44[_0x8a6b('0x64')]}});}return null;})[_0x8a6b('0x22')](handleEntityNotFound(_0x526591,null))[_0x8a6b('0x22')](function(_0xad2eb1){if(_0xad2eb1){_0x26a07e['interaction']=_0xad2eb1['get']({'plain':!![]});interaction_log['info'](_0x8a6b('0x7c'),_0xad151[_0x8a6b('0x60')]['id'],_0xad151[_0x8a6b('0x60')][_0x8a6b('0x38')],_0xad151[_0x8a6b('0x60')][_0x8a6b('0x69')],_0x26a07e[_0x8a6b('0x67')]['id'],_0xad151[_0x8a6b('0x56')]?JSON['stringify'](_0xad151['body']):_0x8a6b('0x6a'));return respondWithRpcPromise(_0x8a6b('0x7d'),_0x8a6b('0x7e'),_0x26a07e);}return null;})[_0x8a6b('0x22')](function(_0x213683){var _0x4dbc06=_0x8a6b('0x6d')+_0x213683[_0x8a6b('0x28')][_0x8a6b('0x6e')];return db[_0x8a6b('0x6f')]['query'](_0x4dbc06,{'type':db[_0x8a6b('0x70')][_0x8a6b('0x71')][_0x8a6b('0x7f')],'raw':!![]})[_0x8a6b('0x22')](function(_0x25134b){return _0x25134b;});})[_0x8a6b('0x22')](function(_0x53fa23){if(_0x53fa23){_0x26a07e[_0x8a6b('0x28')][_0x8a6b('0x80')]=_0x53fa23[0x0];if(!_0xad151[_0x8a6b('0x56')][_0x8a6b('0x5f')])return;return db[_0x8a6b('0x72')][_0x8a6b('0x54')]({'where':{'id':_0xad151['body'][_0x8a6b('0x5f')],'role':_0x8a6b('0x61')},'attributes':['id',_0x8a6b('0x38'),_0x8a6b('0x73'),'email',_0x8a6b('0x81')],'raw':!![]});}return null;})['then'](function(_0x2bb4b1){if(!_0x2bb4b1)return null;_0x26a07e['message'][_0x8a6b('0x61')]=_0x2bb4b1;return _0x26a07e;})[_0x8a6b('0x22')](function(_0xb7eba4){if(_0xb7eba4){_0xb7eba4[_0x8a6b('0x28')]['interface']=util[_0x8a6b('0x5d')](_0x8a6b('0x75'),_0xad151[_0x8a6b('0x60')][_0x8a6b('0x38')]);_0xb7eba4['message'][_0x8a6b('0x76')]=_0x26a07e[_0x8a6b('0x76')];_0xb7eba4[_0x8a6b('0x28')][_0x8a6b('0x77')]=_0x26a07e[_0x8a6b('0x76')];_0xb7eba4[_0x8a6b('0x28')][_0x8a6b('0x82')]='reject';respondWithRpcPromise('EventManager',_0x8a6b('0x78'),{'event':'rejectmessage','message':_[_0x8a6b('0x4b')](_0x26a07e[_0x8a6b('0x28')],JSON['parse'](_0x26a07e[_0x8a6b('0x67')][_0x8a6b('0x83')]))},client9002);return _0x26a07e;}return null;})[_0x8a6b('0x22')](respondWithResult(_0x526591,null))[_0x8a6b('0x2b')](handleError(_0x526591,null));}; \ No newline at end of file +var _0xdb12=['message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ChatMessage','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','RejectMessage','rejectMessage','formData','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','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','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb12,0xe9));var _0x2db1=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xdb12[_0x11155f];return _0xd07e48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2db1('0x0'));var zipdir=require(_0x2db1('0x1'));var jsonpatch=require(_0x2db1('0x2'));var rp=require(_0x2db1('0x3'));var moment=require(_0x2db1('0x4'));var BPromise=require(_0x2db1('0x5'));var Mustache=require(_0x2db1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2db1('0x7'));var csv=require(_0x2db1('0x8'));var ejs=require(_0x2db1('0x9'));var fs=require('fs');var fs_extra=require(_0x2db1('0xa'));var _=require(_0x2db1('0xb'));var squel=require(_0x2db1('0xc'));var crypto=require(_0x2db1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2db1('0xe'));var toCsv=require(_0x2db1('0x8'));var querystring=require(_0x2db1('0xf'));var Papa=require(_0x2db1('0x10'));var Redis=require(_0x2db1('0x11'));var authService=require(_0x2db1('0x12'));var qs=require(_0x2db1('0x13'));var as=require(_0x2db1('0x14'));var hardwareService=require(_0x2db1('0x15'));var logger=require(_0x2db1('0x16'))(_0x2db1('0x17'));var utils=require(_0x2db1('0x18'));var config=require(_0x2db1('0x19'));var licenseUtil=require(_0x2db1('0x1a'));var db=require(_0x2db1('0x1b'))['db'];config[_0x2db1('0x1c')]=_[_0x2db1('0x1d')](config[_0x2db1('0x1c')],{'host':_0x2db1('0x1e'),'port':0x18eb});var socket=require(_0x2db1('0x1f'))(new Redis(config['redis']));require(_0x2db1('0x20'))[_0x2db1('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2db1('0x22')][_0x2db1('0x23')]({'port':0x232c});var client9002=jayson[_0x2db1('0x22')][_0x2db1('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x55f278,_0x5ec687,_0x409335,_0x5b5eb7){return new BPromise(function(_0x437af5,_0x25939b){var _0x2c84d2=_0x5b5eb7||client;return _0x2c84d2[_0x2db1('0x24')](_0x55f278,_0x409335)['then'](function(_0x1d81f6){logger['info'](_0x2db1('0x25'),_0x5ec687,_0x2db1('0x26'));logger[_0x2db1('0x27')](_0x2db1('0x28'),_0x5ec687,'request\x20sent',JSON[_0x2db1('0x29')](_0x1d81f6));if(_0x1d81f6[_0x2db1('0x2a')]){if(_0x1d81f6[_0x2db1('0x2a')]['code']===0x1f4){logger[_0x2db1('0x2a')](_0x2db1('0x25'),_0x5ec687,_0x1d81f6[_0x2db1('0x2a')]['message']);return _0x25939b(_0x1d81f6[_0x2db1('0x2a')][_0x2db1('0x2b')]);}logger[_0x2db1('0x2a')](_0x2db1('0x25'),_0x5ec687,_0x1d81f6['error'][_0x2db1('0x2b')]);return _0x437af5(_0x1d81f6[_0x2db1('0x2a')][_0x2db1('0x2b')]);}else{logger[_0x2db1('0x2c')]('ChatMessage,\x20%s,\x20%s',_0x5ec687,'request\x20sent');_0x437af5(_0x1d81f6['result'][_0x2db1('0x2b')]);}})[_0x2db1('0x2d')](function(_0xa8dc1a){logger['error'](_0x2db1('0x25'),_0x5ec687,_0xa8dc1a);_0x25939b(_0xa8dc1a);});});}function respondWithStatusCode(_0x42ba5d,_0x393430){_0x393430=_0x393430||0xcc;return function(_0x53b7ff){if(_0x53b7ff){return _0x42ba5d[_0x2db1('0x2e')](_0x393430);}return _0x42ba5d[_0x2db1('0x2f')](_0x393430)[_0x2db1('0x30')]();};}function respondWithResult(_0x2e8dba,_0x4ae483){_0x4ae483=_0x4ae483||0xc8;return function(_0x1587b2){if(_0x1587b2){return _0x2e8dba[_0x2db1('0x2f')](_0x4ae483)[_0x2db1('0x31')](_0x1587b2);}};}function respondWithFilteredResult(_0x3ad478,_0x4f12a4){return function(_0x566a77){if(_0x566a77){var _0xb2eb04=typeof _0x4f12a4[_0x2db1('0x32')]===_0x2db1('0x33')&&typeof _0x4f12a4[_0x2db1('0x34')]===_0x2db1('0x33');var _0x1f812e=_0x566a77[_0x2db1('0x35')];var _0x49858d=_0xb2eb04?0x0:_0x4f12a4[_0x2db1('0x32')];var _0x1cd2b1=_0xb2eb04?_0x566a77[_0x2db1('0x35')]:_0x4f12a4[_0x2db1('0x32')]+_0x4f12a4[_0x2db1('0x34')];var _0x178a7f;if(_0x1cd2b1>=_0x1f812e){_0x1cd2b1=_0x1f812e;_0x178a7f=0xc8;}else{_0x178a7f=0xce;}_0x3ad478[_0x2db1('0x2f')](_0x178a7f);return _0x3ad478[_0x2db1('0x36')](_0x2db1('0x37'),_0x49858d+'-'+_0x1cd2b1+'/'+_0x1f812e)[_0x2db1('0x31')](_0x566a77);}return null;};}function patchUpdates(_0x48ab26){return function(_0xd07d1d){try{jsonpatch[_0x2db1('0x38')](_0xd07d1d,_0x48ab26,!![]);}catch(_0x14fb2c){return BPromise[_0x2db1('0x39')](_0x14fb2c);}return _0xd07d1d[_0x2db1('0x3a')]();};}function saveUpdates(_0x4a554c,_0x22c32e){return function(_0x92dd85){if(_0x92dd85){return _0x92dd85[_0x2db1('0x3b')](_0x4a554c)[_0x2db1('0x3c')](function(_0x5cdf85){return _0x5cdf85;});}return null;};}function removeEntity(_0x23d998,_0x53aa44){return function(_0x35daaa){if(_0x35daaa){return _0x35daaa['destroy']()[_0x2db1('0x3c')](function(){_0x23d998[_0x2db1('0x2f')](0xcc)[_0x2db1('0x30')]();});}};}function handleEntityNotFound(_0x310538,_0x5600c6){return function(_0x5e9f23){if(!_0x5e9f23){_0x310538[_0x2db1('0x2e')](0x194);}return _0x5e9f23;};}function handleError(_0xb2a4cd,_0x5d9ffc){_0x5d9ffc=_0x5d9ffc||0x1f4;return function(_0x52a1d2){logger[_0x2db1('0x2a')](_0x52a1d2[_0x2db1('0x3d')]);if(_0x52a1d2[_0x2db1('0x3e')]){delete _0x52a1d2[_0x2db1('0x3e')];}_0xb2a4cd[_0x2db1('0x2f')](_0x5d9ffc)['send'](_0x52a1d2);};}exports[_0x2db1('0x3f')]=function(_0x53ff72,_0x457a43){var _0x404385={},_0x3ddbbf={},_0x5aeb13={'count':0x0,'rows':[]};var _0x39692e=_[_0x2db1('0x40')](db[_0x2db1('0x41')]['rawAttributes'],function(_0x48a71b){return{'name':_0x48a71b[_0x2db1('0x42')],'type':_0x48a71b[_0x2db1('0x43')][_0x2db1('0x44')]};});_0x3ddbbf[_0x2db1('0x45')]=_[_0x2db1('0x40')](_0x39692e,'name');_0x3ddbbf['query']=_[_0x2db1('0x46')](_0x53ff72['query']);_0x3ddbbf[_0x2db1('0x47')]=_[_0x2db1('0x48')](_0x3ddbbf['model'],_0x3ddbbf[_0x2db1('0x49')]);_0x404385[_0x2db1('0x4a')]=_[_0x2db1('0x48')](_0x3ddbbf[_0x2db1('0x45')],qs[_0x2db1('0x4b')](_0x53ff72['query'][_0x2db1('0x4b')]));_0x404385[_0x2db1('0x4a')]=_0x404385['attributes'][_0x2db1('0x4c')]?_0x404385['attributes']:_0x3ddbbf[_0x2db1('0x45')];if(!_0x53ff72[_0x2db1('0x49')][_0x2db1('0x4d')](_0x2db1('0x4e'))){_0x404385[_0x2db1('0x34')]=qs['limit'](_0x53ff72[_0x2db1('0x49')][_0x2db1('0x34')]);_0x404385['offset']=qs['offset'](_0x53ff72['query'][_0x2db1('0x32')]);}_0x404385[_0x2db1('0x4f')]=qs[_0x2db1('0x50')](_0x53ff72[_0x2db1('0x49')][_0x2db1('0x50')]);_0x404385[_0x2db1('0x51')]=qs[_0x2db1('0x47')](_[_0x2db1('0x52')](_0x53ff72[_0x2db1('0x49')],_0x3ddbbf[_0x2db1('0x47')]),_0x39692e);if(_0x53ff72[_0x2db1('0x49')][_0x2db1('0x53')]){_0x404385[_0x2db1('0x51')]=_['merge'](_0x404385[_0x2db1('0x51')],{'$or':_[_0x2db1('0x40')](_0x39692e,function(_0x49f19f){if(_0x49f19f[_0x2db1('0x43')]!==_0x2db1('0x54')){var _0x528117={};_0x528117[_0x49f19f[_0x2db1('0x3e')]]={'$like':'%'+_0x53ff72['query']['filter']+'%'};return _0x528117;}})});}_0x404385=_[_0x2db1('0x55')]({},_0x404385,_0x53ff72[_0x2db1('0x56')]);var _0x442c06={'where':_0x404385['where']};return db[_0x2db1('0x41')][_0x2db1('0x35')](_0x442c06)[_0x2db1('0x3c')](function(_0x5ee032){_0x5aeb13[_0x2db1('0x35')]=_0x5ee032;if(_0x53ff72['query'][_0x2db1('0x57')]){_0x404385[_0x2db1('0x58')]=[{'all':!![]}];}return db[_0x2db1('0x41')][_0x2db1('0x59')](_0x404385);})[_0x2db1('0x3c')](function(_0x7c94da){_0x5aeb13[_0x2db1('0x5a')]=_0x7c94da;return _0x5aeb13;})[_0x2db1('0x3c')](respondWithFilteredResult(_0x457a43,_0x404385))[_0x2db1('0x2d')](handleError(_0x457a43,null));};exports[_0x2db1('0x5b')]=function(_0x3246b4,_0xc468a){var _0x5d94e1={'raw':!![],'where':{'id':_0x3246b4[_0x2db1('0x5c')]['id']}},_0x5ed5da={};_0x5ed5da['model']=_['keys'](db['ChatMessage'][_0x2db1('0x5d')]);_0x5ed5da[_0x2db1('0x49')]=_[_0x2db1('0x46')](_0x3246b4[_0x2db1('0x49')]);_0x5ed5da[_0x2db1('0x47')]=_[_0x2db1('0x48')](_0x5ed5da[_0x2db1('0x45')],_0x5ed5da[_0x2db1('0x49')]);_0x5d94e1[_0x2db1('0x4a')]=_['intersection'](_0x5ed5da[_0x2db1('0x45')],qs['fields'](_0x3246b4[_0x2db1('0x49')][_0x2db1('0x4b')]));_0x5d94e1[_0x2db1('0x4a')]=_0x5d94e1[_0x2db1('0x4a')][_0x2db1('0x4c')]?_0x5d94e1[_0x2db1('0x4a')]:_0x5ed5da['model'];if(_0x3246b4['query'][_0x2db1('0x57')]){_0x5d94e1[_0x2db1('0x58')]=[{'all':!![]}];}_0x5d94e1=_[_0x2db1('0x55')]({},_0x5d94e1,_0x3246b4['options']);return db[_0x2db1('0x41')][_0x2db1('0x5e')](_0x5d94e1)['then'](handleEntityNotFound(_0xc468a,null))[_0x2db1('0x3c')](respondWithResult(_0xc468a,null))[_0x2db1('0x2d')](handleError(_0xc468a,null));};exports[_0x2db1('0x5f')]=function(_0x563572,_0xc707c2){return db['ChatMessage'][_0x2db1('0x5f')](_0x563572[_0x2db1('0x60')],{})[_0x2db1('0x3c')](respondWithResult(_0xc707c2,0xc9))[_0x2db1('0x2d')](handleError(_0xc707c2,null));};exports[_0x2db1('0x3b')]=function(_0x415848,_0x35fd61){if(_0x415848[_0x2db1('0x60')]['id']){delete _0x415848[_0x2db1('0x60')]['id'];}return db[_0x2db1('0x41')]['find']({'where':{'id':_0x415848[_0x2db1('0x5c')]['id']}})[_0x2db1('0x3c')](handleEntityNotFound(_0x35fd61,null))[_0x2db1('0x3c')](saveUpdates(_0x415848[_0x2db1('0x60')],null))['then'](respondWithResult(_0x35fd61,null))[_0x2db1('0x2d')](handleError(_0x35fd61,null));};exports['destroy']=function(_0x10412f,_0x3b29a0){return db[_0x2db1('0x41')]['find']({'where':{'id':_0x10412f['params']['id']}})[_0x2db1('0x3c')](handleEntityNotFound(_0x3b29a0,null))[_0x2db1('0x3c')](removeEntity(_0x3b29a0,null))[_0x2db1('0x2d')](handleError(_0x3b29a0,null));};exports[_0x2db1('0x61')]=function(_0x1cca13,_0x193d90){return db[_0x2db1('0x41')]['describe']()[_0x2db1('0x3c')](respondWithResult(_0x193d90,null))[_0x2db1('0x2d')](handleError(_0x193d90,null));};var interaction_log=require(_0x2db1('0x16'))(_0x2db1('0x62'));exports[_0x2db1('0x63')]=function(_0x26ac12,_0x1e6a7e,_0x1f084a){var _0x3b5434={'agent':{},'channel':_0x2db1('0x64')};if(_0x26ac12['body']['id']){delete _0x26ac12[_0x2db1('0x60')]['id'];}_0x26ac12[_0x2db1('0x60')][_0x2db1('0x65')]=!![];_0x26ac12[_0x2db1('0x60')]['readAt']=moment()[_0x2db1('0x66')](_0x2db1('0x67'));_0x26ac12[_0x2db1('0x60')][_0x2db1('0x68')]=_0x26ac12[_0x2db1('0x60')]['UserId']||_0x26ac12[_0x2db1('0x69')]['id'];_0x3b5434[_0x2db1('0x6a')]['id']=_0x26ac12[_0x2db1('0x60')][_0x2db1('0x68')];return db['ChatMessage']['find']({'where':{'id':_0x26ac12[_0x2db1('0x5c')]['id'],'UserId':null}})[_0x2db1('0x3c')](handleEntityNotFound(_0x1e6a7e,null))[_0x2db1('0x3c')](saveUpdates(_0x26ac12[_0x2db1('0x60')],null))[_0x2db1('0x3c')](function(_0x54d5ab){if(_0x54d5ab){_0x3b5434['message']=_0x54d5ab['get']({'plain':!![]});return db[_0x2db1('0x6b')][_0x2db1('0x5e')]({'where':{'id':_0x54d5ab[_0x2db1('0x6c')]}});}return null;})[_0x2db1('0x3c')](handleEntityNotFound(_0x1e6a7e,null))[_0x2db1('0x3c')](function(_0x21a4df){if(_0x21a4df){return _0x21a4df[_0x2db1('0x3b')]({'UserId':_0x26ac12[_0x2db1('0x60')][_0x2db1('0x68')],'read1stAt':_['isNil'](_0x21a4df[_0x2db1('0x6d')])?moment()[_0x2db1('0x66')](_0x2db1('0x67')):undefined});}return null;})[_0x2db1('0x3c')](function(_0x2598b6){if(_0x2598b6){_0x3b5434[_0x2db1('0x6e')]=_0x2598b6[_0x2db1('0x6f')]({'plain':!![]});interaction_log[_0x2db1('0x2c')](_0x2db1('0x70'),_0x26ac12[_0x2db1('0x69')]['id'],_0x26ac12[_0x2db1('0x69')][_0x2db1('0x3e')],_0x26ac12[_0x2db1('0x69')][_0x2db1('0x71')],_0x3b5434[_0x2db1('0x6e')]['id'],_0x26ac12['body']?JSON[_0x2db1('0x29')](_0x26ac12[_0x2db1('0x60')]):_0x2db1('0x72'));return respondWithRpcPromise('AcceptMessage',_0x2db1('0x73'),_0x3b5434);}return null;})[_0x2db1('0x3c')](function(_0x14ae81){var _0x33b92b=_0x2db1('0x74')+_0x14ae81[_0x2db1('0x2b')][_0x2db1('0x75')];return db[_0x2db1('0x76')]['query'](_0x33b92b,{'type':db[_0x2db1('0x77')][_0x2db1('0x78')][_0x2db1('0x79')],'raw':!![]})['then'](function(_0x4c2be3){return _0x4c2be3;});})['then'](function(_0x4878de){if(_0x4878de){_0x3b5434[_0x2db1('0x2b')][_0x2db1('0x7a')]=_0x4878de[0x0];if(!_0x26ac12[_0x2db1('0x60')]['UserId'])return;return db[_0x2db1('0x7b')][_0x2db1('0x5e')]({'where':{'id':_0x26ac12[_0x2db1('0x60')][_0x2db1('0x68')],'role':_0x2db1('0x6a')},'attributes':['id',_0x2db1('0x3e'),_0x2db1('0x7c'),_0x2db1('0x7d'),_0x2db1('0x7e')],'raw':!![]});}return null;})[_0x2db1('0x3c')](function(_0x32bcbe){if(!_0x32bcbe)return null;_0x3b5434['message'][_0x2db1('0x6a')]=_0x32bcbe;return _0x3b5434;})[_0x2db1('0x3c')](function(_0x38f2df){if(_0x38f2df){if(_0x26ac12[_0x2db1('0x60')][_0x2db1('0x7f')]){_0x3b5434[_0x2db1('0x2b')]['interface']=util[_0x2db1('0x66')](_0x2db1('0x80'),_0x26ac12['user'][_0x2db1('0x3e')]);_0x3b5434[_0x2db1('0x2b')][_0x2db1('0x81')]=_0x3b5434[_0x2db1('0x81')];_0x3b5434[_0x2db1('0x2b')][_0x2db1('0x82')]=_0x3b5434[_0x2db1('0x81')];_0x3b5434[_0x2db1('0x2b')][_0x2db1('0x83')]=_0x2db1('0x63');return respondWithRpcPromise(_0x2db1('0x84'),_0x2db1('0x84'),{'event':_0x2db1('0x85'),'message':_[_0x2db1('0x55')](_0x3b5434['message'],JSON[_0x2db1('0x86')](_0x3b5434[_0x2db1('0x6e')]['formData']))},client9002)['then'](function(){return _0x3b5434;});}return _0x3b5434;}return null;})[_0x2db1('0x3c')](respondWithResult(_0x1e6a7e,null))[_0x2db1('0x2d')](handleError(_0x1e6a7e,null));};var interaction_log=require(_0x2db1('0x16'))(_0x2db1('0x62'));exports[_0x2db1('0x39')]=function(_0x36e59f,_0x517a50,_0x269e7d){var _0x430d67={'agent':{},'channel':'chat'};if(_0x36e59f[_0x2db1('0x60')]['id']){delete _0x36e59f[_0x2db1('0x60')]['id'];}_0x36e59f['body'][_0x2db1('0x68')]=_0x36e59f[_0x2db1('0x60')]['UserId']||_0x36e59f[_0x2db1('0x69')]['id'];_0x430d67['agent']['id']=_0x36e59f['body'][_0x2db1('0x68')];return db[_0x2db1('0x41')]['find']({'where':{'id':_0x36e59f[_0x2db1('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x517a50,null))['then'](function(_0x45e109){if(_0x45e109){_0x430d67[_0x2db1('0x2b')]=_0x45e109[_0x2db1('0x6f')]({'plain':!![]});return db[_0x2db1('0x6b')][_0x2db1('0x5e')]({'where':{'id':_0x45e109[_0x2db1('0x6c')]}});}return null;})[_0x2db1('0x3c')](handleEntityNotFound(_0x517a50,null))[_0x2db1('0x3c')](function(_0x4d42ff){if(_0x4d42ff){_0x430d67[_0x2db1('0x6e')]=_0x4d42ff[_0x2db1('0x6f')]({'plain':!![]});interaction_log[_0x2db1('0x2c')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x36e59f['user']['id'],_0x36e59f[_0x2db1('0x69')][_0x2db1('0x3e')],_0x36e59f[_0x2db1('0x69')]['role'],_0x430d67[_0x2db1('0x6e')]['id'],_0x36e59f[_0x2db1('0x60')]?JSON[_0x2db1('0x29')](_0x36e59f[_0x2db1('0x60')]):_0x2db1('0x72'));return respondWithRpcPromise(_0x2db1('0x87'),_0x2db1('0x88'),_0x430d67);}return null;})[_0x2db1('0x3c')](function(_0x3610d4){var _0x2c3b53=_0x2db1('0x74')+_0x3610d4[_0x2db1('0x2b')]['ContactId'];return db[_0x2db1('0x76')][_0x2db1('0x49')](_0x2c3b53,{'type':db[_0x2db1('0x77')]['QueryTypes'][_0x2db1('0x79')],'raw':!![]})[_0x2db1('0x3c')](function(_0x5b02ec){return _0x5b02ec;});})[_0x2db1('0x3c')](function(_0x24854e){if(_0x24854e){_0x430d67[_0x2db1('0x2b')]['contact']=_0x24854e[0x0];if(!_0x36e59f[_0x2db1('0x60')][_0x2db1('0x68')])return;return db[_0x2db1('0x7b')][_0x2db1('0x5e')]({'where':{'id':_0x36e59f[_0x2db1('0x60')][_0x2db1('0x68')],'role':_0x2db1('0x6a')},'attributes':['id',_0x2db1('0x3e'),_0x2db1('0x7c'),_0x2db1('0x7d'),_0x2db1('0x7e')],'raw':!![]});}return null;})['then'](function(_0x5d411f){if(!_0x5d411f)return null;_0x430d67['message'][_0x2db1('0x6a')]=_0x5d411f;return _0x430d67;})[_0x2db1('0x3c')](function(_0x4c69f6){if(_0x4c69f6){_0x4c69f6[_0x2db1('0x2b')]['interface']=util['format']('SIP/%s',_0x36e59f['user'][_0x2db1('0x3e')]);_0x4c69f6['message']['channel']=_0x430d67['channel'];_0x4c69f6['message'][_0x2db1('0x82')]=_0x430d67['channel'];_0x4c69f6[_0x2db1('0x2b')][_0x2db1('0x83')]=_0x2db1('0x39');respondWithRpcPromise('EventManager',_0x2db1('0x84'),{'event':'rejectmessage','message':_[_0x2db1('0x55')](_0x430d67[_0x2db1('0x2b')],JSON['parse'](_0x430d67['interaction'][_0x2db1('0x89')]))},client9002);return _0x430d67;}return null;})[_0x2db1('0x3c')](respondWithResult(_0x517a50,null))[_0x2db1('0x2d')](handleError(_0x517a50,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 707423f..ff14ef5 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 _0xae46=['ChatMessage','setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xae46,0x86));var _0x6ae4=function(_0x46d09b,_0x167779){_0x46d09b=_0x46d09b-0x0;var _0x205f50=_0xae46[_0x46d09b];return _0x205f50;};'use strict';var EventEmitter=require(_0x6ae4('0x0'));var ChatMessage=require(_0x6ae4('0x1'))['db'][_0x6ae4('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6ae4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x26b94b){return function(_0x57d90d,_0x404903,_0x1b3a11){ChatMessageEvents[_0x6ae4('0x4')](_0x26b94b+':'+_0x57d90d['id'],_0x57d90d);ChatMessageEvents[_0x6ae4('0x4')](_0x26b94b,_0x57d90d);_0x1b3a11(null);};}for(var e in events){if(events[_0x6ae4('0x5')](e)){var event=events[e];ChatMessage[_0x6ae4('0x6')](e,emitEvent(event));}}module[_0x6ae4('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x6bcf=['emit','hasOwnProperty','hook','exports','events','ChatMessage','setMaxListeners','save','remove'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x6bcf,0x17e));var _0xf6bc=function(_0x1e7a31,_0x19a337){_0x1e7a31=_0x1e7a31-0x0;var _0x4ab2f2=_0x6bcf[_0x1e7a31];return _0x4ab2f2;};'use strict';var EventEmitter=require(_0xf6bc('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xf6bc('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf6bc('0x2')](0x0);var events={'afterCreate':_0xf6bc('0x3'),'afterUpdate':'update','afterDestroy':_0xf6bc('0x4')};function emitEvent(_0x48713a){return function(_0x5c856f,_0x4ec847,_0x4f3a86){ChatMessageEvents[_0xf6bc('0x5')](_0x48713a+':'+_0x5c856f['id'],_0x5c856f);ChatMessageEvents[_0xf6bc('0x5')](_0x48713a,_0x5c856f);_0x4f3a86(null);};}for(var e in events){if(events[_0xf6bc('0x6')](e)){var event=events[e];ChatMessage[_0xf6bc('0x7')](e,emitEvent(event));}}module[_0xf6bc('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a79414e..e82cb04 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 _0x76da=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch'];(function(_0x20a158,_0x9caeb2){var _0x5e1a99=function(_0x5806da){while(--_0x5806da){_0x20a158['push'](_0x20a158['shift']());}};_0x5e1a99(++_0x9caeb2);}(_0x76da,0x15e));var _0xa76d=function(_0x4dda17,_0x13ca0e){_0x4dda17=_0x4dda17-0x0;var _0x445826=_0x76da[_0x4dda17];return _0x445826;};'use strict';var _=require(_0xa76d('0x0'));var util=require('util');var logger=require(_0xa76d('0x1'))(_0xa76d('0x2'));var moment=require(_0xa76d('0x3'));var BPromise=require(_0xa76d('0x4'));var rp=require(_0xa76d('0x5'));var fs=require('fs');var path=require(_0xa76d('0x6'));var rimraf=require('rimraf');var config=require(_0xa76d('0x7'));var attributes=require('./chatMessage.attributes');module[_0xa76d('0x8')]=function(_0xf47fec,_0x43eba4){return _0xf47fec[_0xa76d('0x9')](_0xa76d('0xa'),attributes,{'tableName':_0xa76d('0xb'),'paranoid':![],'indexes':[{'name':_0xa76d('0xc'),'fields':['body'],'type':_0xa76d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15e839,_0x7a17ab,_0xf8cb8d){var _0x21042c=_0xf47fec['models'];var _0x403ac4=_0x15e839[_0xa76d('0xe')]({'plain':!![]});if(_0x403ac4[_0xa76d('0xf')][_0xa76d('0x10')]()==='in'||_0x403ac4[_0xa76d('0xf')][_0xa76d('0x10')]()===_0xa76d('0x11')&&!_0x403ac4[_0xa76d('0x12')]&&!_[_0xa76d('0x13')](_0x403ac4[_0xa76d('0x14')])){_0x21042c[_0xa76d('0x15')]['findOne']({'where':{'id':_0x403ac4[_0xa76d('0x16')]}})[_0xa76d('0x17')](function(_0x1ea3e6){if(_0x1ea3e6){_0x1ea3e6[_0xa76d('0x18')]({'lastMsgAt':_0x403ac4[_0xa76d('0x19')],'lastMsgDirection':_0x403ac4[_0xa76d('0xf')][_0xa76d('0x10')]()});}})[_0xa76d('0x1a')](function(_0x49c244){console['error'](_0x49c244);});}_0xf8cb8d();}},'charset':_0xa76d('0x1b'),'collate':_0xa76d('0x1c')});}; \ No newline at end of file +var _0x02fd=['isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x38add1,_0x44b935){var _0x234c6f=function(_0x150c98){while(--_0x150c98){_0x38add1['push'](_0x38add1['shift']());}};_0x234c6f(++_0x44b935);}(_0x02fd,0x83));var _0xd02f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x02fd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xd02f('0x0'));var util=require('util');var logger=require(_0xd02f('0x1'))(_0xd02f('0x2'));var moment=require(_0xd02f('0x3'));var BPromise=require(_0xd02f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd02f('0x5'));var rimraf=require(_0xd02f('0x6'));var config=require(_0xd02f('0x7'));var attributes=require(_0xd02f('0x8'));module['exports']=function(_0x121ddb,_0x32f0b6){return _0x121ddb[_0xd02f('0x9')](_0xd02f('0xa'),attributes,{'tableName':_0xd02f('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xd02f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38c1d4,_0x2c201a,_0x41d860){var _0x26f45a=_0x121ddb[_0xd02f('0xd')];var _0x1b941e=_0x38c1d4[_0xd02f('0xe')]({'plain':!![]});if(_0x1b941e[_0xd02f('0xf')][_0xd02f('0x10')]()==='in'||_0x1b941e['direction'][_0xd02f('0x10')]()===_0xd02f('0x11')&&!_0x1b941e[_0xd02f('0x12')]&&!_[_0xd02f('0x13')](_0x1b941e[_0xd02f('0x14')])){_0x26f45a[_0xd02f('0x15')][_0xd02f('0x16')]({'where':{'id':_0x1b941e['ChatInteractionId']}})[_0xd02f('0x17')](function(_0x4c2f2c){if(_0x4c2f2c){_0x4c2f2c[_0xd02f('0x18')]({'lastMsgAt':_0x1b941e[_0xd02f('0x19')],'lastMsgDirection':_0x1b941e['direction']['toLowerCase']()});}})[_0xd02f('0x1a')](function(_0x2c6c66){console[_0xd02f('0x1b')](_0x2c6c66);});}_0x41d860();}},'charset':_0xd02f('0x1c'),'collate':_0xd02f('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9bf5014..4654964 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 _0xd910=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd910,0xf2));var _0x0d91=function(_0x46fb23,_0x19472c){_0x46fb23=_0x46fb23-0x0;var _0xfcb00d=_0xd910[_0x46fb23];return _0xfcb00d;};'use strict';var _=require(_0x0d91('0x0'));var util=require(_0x0d91('0x1'));var moment=require(_0x0d91('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d91('0x3'));var fs=require('fs');var Redis=require(_0x0d91('0x4'));var db=require(_0x0d91('0x5'))['db'];var utils=require(_0x0d91('0x6'));var logger=require(_0x0d91('0x7'))(_0x0d91('0x8'));var config=require(_0x0d91('0x9'));var jayson=require(_0x0d91('0xa'));var client=jayson[_0x0d91('0xb')][_0x0d91('0xc')]({'port':0x232a});config[_0x0d91('0xd')]=_[_0x0d91('0xe')](config[_0x0d91('0xd')],{'host':_0x0d91('0xf'),'port':0x18eb});var socket=require(_0x0d91('0x10'))(new Redis(config[_0x0d91('0xd')]));require(_0x0d91('0x11'))['register'](socket);function respondWithRpcPromise(_0x26334f,_0x42dc11,_0x486a8c){return new BPromise(function(_0xa14394,_0x3d4a02){return client[_0x0d91('0x12')](_0x26334f,_0x486a8c)[_0x0d91('0x13')](function(_0x50cdbb){logger['info']('ChatMessage,\x20%s,\x20%s',_0x42dc11,_0x0d91('0x14'));logger[_0x0d91('0x15')](_0x0d91('0x16'),_0x42dc11,_0x0d91('0x14'),JSON[_0x0d91('0x17')](_0x50cdbb));if(_0x50cdbb[_0x0d91('0x18')]){if(_0x50cdbb[_0x0d91('0x18')][_0x0d91('0x19')]===0x1f4){logger[_0x0d91('0x18')](_0x0d91('0x1a'),_0x42dc11,_0x50cdbb[_0x0d91('0x18')][_0x0d91('0x1b')]);return _0x3d4a02(_0x50cdbb[_0x0d91('0x18')][_0x0d91('0x1b')]);}logger[_0x0d91('0x18')](_0x0d91('0x1a'),_0x42dc11,_0x50cdbb['error'][_0x0d91('0x1b')]);return _0xa14394(_0x50cdbb[_0x0d91('0x18')][_0x0d91('0x1b')]);}else{logger[_0x0d91('0x1c')](_0x0d91('0x1a'),_0x42dc11,'request\x20sent');_0xa14394(_0x50cdbb[_0x0d91('0x1d')][_0x0d91('0x1b')]);}})[_0x0d91('0x1e')](function(_0x5d94be){logger[_0x0d91('0x18')]('ChatMessage,\x20%s,\x20%s',_0x42dc11,_0x5d94be);_0x3d4a02(_0x5d94be);});});}exports[_0x0d91('0x1f')]=function(_0x2655f9){var _0x4359b4=this;return new Promise(function(_0x5ffd37,_0x5914a7){return db[_0x0d91('0x20')][_0x0d91('0x21')](_0x2655f9['body'],{'raw':_0x2655f9[_0x0d91('0x22')]?_0x2655f9[_0x0d91('0x22')][_0x0d91('0x23')]===undefined?!![]:![]:!![]})[_0x0d91('0x13')](function(_0x1b2690){logger['info'](_0x0d91('0x1f'),_0x2655f9);logger[_0x0d91('0x15')](_0x0d91('0x1f'),_0x2655f9,JSON['stringify'](_0x1b2690));_0x5ffd37(_0x1b2690);})[_0x0d91('0x1e')](function(_0x160c90){logger[_0x0d91('0x18')](_0x0d91('0x1f'),_0x160c90[_0x0d91('0x1b')],_0x2655f9);_0x5914a7(_0x4359b4[_0x0d91('0x18')](0x1f4,_0x160c90[_0x0d91('0x1b')]));});});}; \ No newline at end of file +var _0x87c9=['ChatMessage','create','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','defaults','redis','localhost','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatMessage'];(function(_0x52d018,_0x283241){var _0x22ccc1=function(_0x563ee3){while(--_0x563ee3){_0x52d018['push'](_0x52d018['shift']());}};_0x22ccc1(++_0x283241);}(_0x87c9,0x196));var _0x987c=function(_0x795657,_0x9d0d75){_0x795657=_0x795657-0x0;var _0x3f0322=_0x87c9[_0x795657];return _0x3f0322;};'use strict';var _=require(_0x987c('0x0'));var util=require(_0x987c('0x1'));var moment=require('moment');var BPromise=require(_0x987c('0x2'));var rs=require(_0x987c('0x3'));var fs=require('fs');var Redis=require(_0x987c('0x4'));var db=require(_0x987c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x987c('0x6'));var client=jayson[_0x987c('0x7')][_0x987c('0x8')]({'port':0x232a});config['redis']=_[_0x987c('0x9')](config[_0x987c('0xa')],{'host':_0x987c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x987c('0xc'))[_0x987c('0xd')](socket);function respondWithRpcPromise(_0x1dcaae,_0x2a6679,_0x1a43e6){return new BPromise(function(_0x51167e,_0x5ecb82){return client[_0x987c('0xe')](_0x1dcaae,_0x1a43e6)[_0x987c('0xf')](function(_0x5da9ea){logger['info'](_0x987c('0x10'),_0x2a6679,_0x987c('0x11'));logger[_0x987c('0x12')](_0x987c('0x13'),_0x2a6679,'request\x20sent',JSON[_0x987c('0x14')](_0x5da9ea));if(_0x5da9ea[_0x987c('0x15')]){if(_0x5da9ea[_0x987c('0x15')][_0x987c('0x16')]===0x1f4){logger[_0x987c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x2a6679,_0x5da9ea[_0x987c('0x15')]['message']);return _0x5ecb82(_0x5da9ea[_0x987c('0x15')]['message']);}logger[_0x987c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x2a6679,_0x5da9ea['error'][_0x987c('0x17')]);return _0x51167e(_0x5da9ea[_0x987c('0x15')][_0x987c('0x17')]);}else{logger[_0x987c('0x18')](_0x987c('0x10'),_0x2a6679,'request\x20sent');_0x51167e(_0x5da9ea[_0x987c('0x19')]['message']);}})[_0x987c('0x1a')](function(_0x2d71c1){logger['error'](_0x987c('0x10'),_0x2a6679,_0x2d71c1);_0x5ecb82(_0x2d71c1);});});}exports[_0x987c('0x1b')]=function(_0x3c0e6c){var _0x29d6df=this;return new Promise(function(_0x1fed4a,_0x2ae2d7){return db[_0x987c('0x1c')][_0x987c('0x1d')](_0x3c0e6c[_0x987c('0x1e')],{'raw':_0x3c0e6c['options']?_0x3c0e6c['options']['raw']===undefined?!![]:![]:!![]})[_0x987c('0xf')](function(_0x466ac4){logger[_0x987c('0x18')](_0x987c('0x1b'),_0x3c0e6c);logger[_0x987c('0x12')]('CreateChatMessage',_0x3c0e6c,JSON[_0x987c('0x14')](_0x466ac4));_0x1fed4a(_0x466ac4);})[_0x987c('0x1a')](function(_0x52ed8b){logger[_0x987c('0x15')]('CreateChatMessage',_0x52ed8b['message'],_0x3c0e6c);_0x2ae2d7(_0x29d6df['error'](0x1f4,_0x52ed8b[_0x987c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a7bb278..632d749 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 _0x45d1=['removeListener','register','length','./chatMessage.events','save','update'];(function(_0xe62d9c,_0x1982f2){var _0x59f177=function(_0x408bae){while(--_0x408bae){_0xe62d9c['push'](_0xe62d9c['shift']());}};_0x59f177(++_0x1982f2);}(_0x45d1,0x1cb));var _0x145d=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x45d1[_0x204eb7];return _0x37e444;};'use strict';var ChatMessageEvents=require(_0x145d('0x0'));var events=[_0x145d('0x1'),'remove',_0x145d('0x2')];function createListener(_0x1d1ab1,_0x4f5dd4){return function(_0x22f728){_0x4f5dd4['emit'](_0x1d1ab1,_0x22f728);};}function removeListener(_0x3076c2,_0x327cd3){return function(){ChatMessageEvents[_0x145d('0x3')](_0x3076c2,_0x327cd3);};}exports[_0x145d('0x4')]=function(_0x14ddd8){for(var _0x2896c3=0x0,_0xbc4161=events[_0x145d('0x5')];_0x2896c3<_0xbc4161;_0x2896c3++){var _0x46a729=events[_0x2896c3];var _0x47eadc=createListener('chatMessage:'+_0x46a729,_0x14ddd8);ChatMessageEvents['on'](_0x46a729,_0x47eadc);}}; \ No newline at end of file +var _0xbbbd=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x7aef14,_0xbbf34b){var _0x1aff7f=function(_0x58d70f){while(--_0x58d70f){_0x7aef14['push'](_0x7aef14['shift']());}};_0x1aff7f(++_0xbbf34b);}(_0xbbbd,0x86));var _0xdbbb=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xbbbd[_0x36c5b0];return _0xf19333;};'use strict';var ChatMessageEvents=require(_0xdbbb('0x0'));var events=[_0xdbbb('0x1'),_0xdbbb('0x2'),_0xdbbb('0x3')];function createListener(_0x364f2b,_0x21cb13){return function(_0x2f4a15){_0x21cb13[_0xdbbb('0x4')](_0x364f2b,_0x2f4a15);};}function removeListener(_0x3b665d,_0x114d3a){return function(){ChatMessageEvents[_0xdbbb('0x5')](_0x3b665d,_0x114d3a);};}exports[_0xdbbb('0x6')]=function(_0x4e9523){for(var _0xa5399d=0x0,_0x42ea38=events[_0xdbbb('0x7')];_0xa5399d<_0x42ea38;_0xa5399d++){var _0x478756=events[_0xa5399d];var _0x463ea6=createListener(_0xdbbb('0x8')+_0x478756,_0x4e9523);ChatMessageEvents['on'](_0x478756,_0x463ea6);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 508bf9e..fc255ed 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 _0xa75b=['chat','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/:id','post','tracked'];(function(_0x3b4195,_0x2cccb1){var _0x1aaf69=function(_0x129056){while(--_0x129056){_0x3b4195['push'](_0x3b4195['shift']());}};_0x1aaf69(++_0x2cccb1);}(_0xa75b,0x190));var _0xba75=function(_0x57711e,_0x31e04f){_0x57711e=_0x57711e-0x0;var _0x4e9546=_0xa75b[_0x57711e];return _0x4e9546;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require(_0xba75('0x1'));var timeout=require(_0xba75('0x2'));var express=require(_0xba75('0x3'));var router=express[_0xba75('0x4')]();var fs_extra=require(_0xba75('0x5'));var auth=require(_0xba75('0x6'));var interaction=require(_0xba75('0x7'));var config=require(_0xba75('0x8'));var controller=require(_0xba75('0x9'));router[_0xba75('0xa')]('/',auth[_0xba75('0xb')](),controller[_0xba75('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xba75('0xa')](_0xba75('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0xe')]('/',auth[_0xba75('0xb')](),interaction[_0xba75('0xf')](_0xba75('0x10'),'chatmessage:create'),controller[_0xba75('0x11')]);router['put']('/:id',controller['update']);router[_0xba75('0x12')](_0xba75('0x13'),auth['isAuthenticated'](),controller[_0xba75('0x14')]);router[_0xba75('0x12')](_0xba75('0x15'),auth['isAuthenticated'](),controller[_0xba75('0x16')]);router[_0xba75('0x17')](_0xba75('0xd'),auth[_0xba75('0xb')](),controller[_0xba75('0x18')]);module[_0xba75('0x19')]=router; \ No newline at end of file +var _0x8015=['isAuthenticated','index','describe','/:id','show','tracked','chat','chatmessage:create','create','put','update','/:id/reject','reject','delete','destroy','exports','../../components/interaction/service','../../config/environment','./chatMessage.controller','get'];(function(_0x90ae4b,_0x40a3b6){var _0x23e212=function(_0xdf876b){while(--_0xdf876b){_0x90ae4b['push'](_0x90ae4b['shift']());}};_0x23e212(++_0x40a3b6);}(_0x8015,0x164));var _0x5801=function(_0x3e2cc3,_0x2816ac){_0x3e2cc3=_0x3e2cc3-0x0;var _0x141bba=_0x8015[_0x3e2cc3];return _0x141bba;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5801('0x0'));var config=require(_0x5801('0x1'));var controller=require(_0x5801('0x2'));router[_0x5801('0x3')]('/',auth[_0x5801('0x4')](),controller[_0x5801('0x5')]);router[_0x5801('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x5801('0x6')]);router[_0x5801('0x3')](_0x5801('0x7'),auth[_0x5801('0x4')](),controller[_0x5801('0x8')]);router['post']('/',auth[_0x5801('0x4')](),interaction[_0x5801('0x9')](_0x5801('0xa'),_0x5801('0xb')),controller[_0x5801('0xc')]);router[_0x5801('0xd')](_0x5801('0x7'),controller[_0x5801('0xe')]);router[_0x5801('0xd')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x5801('0xd')](_0x5801('0xf'),auth['isAuthenticated'](),controller[_0x5801('0x10')]);router[_0x5801('0x11')](_0x5801('0x7'),auth[_0x5801('0x4')](),controller[_0x5801('0x12')]);module[_0x5801('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 5241950..8b0e8b1 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 _0x757a=['exports','TEXT'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x757a,0xde));var _0xa757=function(_0x172d44,_0x1dbfbc){_0x172d44=_0x172d44-0x0;var _0x15d568=_0x757a[_0x172d44];return _0x15d568;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x34e004,_0x5e6d6d){var _0xd28ac2=function(_0x5bc8ae){while(--_0x5bc8ae){_0x34e004['push'](_0x34e004['shift']());}};_0xd28ac2(++_0x5e6d6d);}(_0xdb28,0x106));var _0x8db2=function(_0x2098d3,_0x464d5d){_0x2098d3=_0x2098d3-0x0;var _0x4c79fb=_0xdb28[_0x2098d3];return _0x4c79fb;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('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 39ac2ba..642fa30 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(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7a54,0x106));var _0x47a5=function(_0x6720c7,_0x5e8147){_0x6720c7=_0x6720c7-0x0;var _0x48b5f7=_0x7a54[_0x6720c7];return _0x48b5f7;};'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 _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xf3f018,_0x5a1105){var _0x22c030=function(_0x5e8a16){while(--_0x5e8a16){_0xf3f018['push'](_0xf3f018['shift']());}};_0x22c030(++_0x5a1105);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index c7e2edf..b7d318b 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 _0xcde7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xcde7,0x129));var _0x7cde=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcde7[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0x7cde('0x0'));var ChatOfflineMessage=require(_0x7cde('0x1'))['db'][_0x7cde('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7cde('0x3')](0x0);var events={'afterCreate':_0x7cde('0x4'),'afterUpdate':_0x7cde('0x5'),'afterDestroy':_0x7cde('0x6')};function emitEvent(_0x448052){return function(_0x1d7396,_0x3eb574,_0x555d77){ChatOfflineMessageEvents[_0x7cde('0x7')](_0x448052+':'+_0x1d7396['id'],_0x1d7396);ChatOfflineMessageEvents[_0x7cde('0x7')](_0x448052,_0x1d7396);_0x555d77(null);};}for(var e in events){if(events[_0x7cde('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x7cde('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xb6b3=['ChatOfflineMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xb6b3,0x76));var _0x3b6b=function(_0x3bd796,_0xfbb8f8){_0x3bd796=_0x3bd796-0x0;var _0x55b2ae=_0xb6b3[_0x3bd796];return _0x55b2ae;};'use strict';var EventEmitter=require(_0x3b6b('0x0'));var ChatOfflineMessage=require(_0x3b6b('0x1'))['db'][_0x3b6b('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x3b6b('0x3')](0x0);var events={'afterCreate':_0x3b6b('0x4'),'afterUpdate':'update','afterDestroy':_0x3b6b('0x5')};function emitEvent(_0x173737){return function(_0x4ad0e6,_0x17803b,_0x5aa348){ChatOfflineMessageEvents[_0x3b6b('0x6')](_0x173737+':'+_0x4ad0e6['id'],_0x4ad0e6);ChatOfflineMessageEvents[_0x3b6b('0x6')](_0x173737,_0x4ad0e6);_0x5aa348(null);};}for(var e in events){if(events[_0x3b6b('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x3b6b('0x8')](e,emitEvent(event));}}module[_0x3b6b('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 1ae5778..8f7d746 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 _0xa06e=['ChatOfflineMessage','utf8mb4_unicode_ci','define'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xa06e,0xd7));var _0xea06=function(_0x35c718,_0x33a696){_0x35c718=_0x35c718-0x0;var _0x5c3099=_0xa06e[_0x35c718];return _0x5c3099;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0xd1ac4){return _0xd1ac4[_0xea06('0x0')](_0xea06('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xea06('0x2')});}; \ No newline at end of file +var _0x9c65=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x30d994,_0x4ed410){var _0x17e704=function(_0x477dce){while(--_0x477dce){_0x30d994['push'](_0x30d994['shift']());}};_0x17e704(++_0x4ed410);}(_0x9c65,0xdf));var _0x59c6=function(_0x1cc832,_0x2f9b02){_0x1cc832=_0x1cc832-0x0;var _0x5b2f9f=_0x9c65[_0x1cc832];return _0x5b2f9f;};'use strict';var attributes=require(_0x59c6('0x0'));module[_0x59c6('0x1')]=function(_0x39184b){return _0x39184b[_0x59c6('0x2')](_0x59c6('0x3'),attributes,{'tableName':_0x59c6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59c6('0x5'),'collate':_0x59c6('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 441c961..321c854 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 _0x724d=['message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x724d,0xe5));var _0xd724=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x724d[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0xd724('0x0'));var util=require(_0xd724('0x1'));var moment=require(_0xd724('0x2'));var BPromise=require('bluebird');var rs=require(_0xd724('0x3'));var fs=require('fs');var Redis=require(_0xd724('0x4'));var db=require(_0xd724('0x5'))['db'];var utils=require(_0xd724('0x6'));var logger=require(_0xd724('0x7'))(_0xd724('0x8'));var config=require(_0xd724('0x9'));var jayson=require(_0xd724('0xa'));var client=jayson[_0xd724('0xb')][_0xd724('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x100428,_0x260b44,_0x37938f){return new BPromise(function(_0x53601e,_0x46ce16){return client[_0xd724('0xd')](_0x100428,_0x37938f)[_0xd724('0xe')](function(_0x3884aa){logger[_0xd724('0xf')](_0xd724('0x10'),_0x260b44,'request\x20sent');logger[_0xd724('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x260b44,'request\x20sent',JSON[_0xd724('0x12')](_0x3884aa));if(_0x3884aa[_0xd724('0x13')]){if(_0x3884aa[_0xd724('0x13')][_0xd724('0x14')]===0x1f4){logger[_0xd724('0x13')](_0xd724('0x10'),_0x260b44,_0x3884aa[_0xd724('0x13')][_0xd724('0x15')]);return _0x46ce16(_0x3884aa[_0xd724('0x13')][_0xd724('0x15')]);}logger[_0xd724('0x13')](_0xd724('0x10'),_0x260b44,_0x3884aa[_0xd724('0x13')][_0xd724('0x15')]);return _0x53601e(_0x3884aa[_0xd724('0x13')][_0xd724('0x15')]);}else{logger['info'](_0xd724('0x10'),_0x260b44,_0xd724('0x16'));_0x53601e(_0x3884aa[_0xd724('0x17')][_0xd724('0x15')]);}})[_0xd724('0x18')](function(_0x23280){logger[_0xd724('0x13')](_0xd724('0x10'),_0x260b44,_0x23280);_0x46ce16(_0x23280);});});} \ No newline at end of file +var _0xb6a8=['http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb6a8,0xc8));var _0x8b6a=function(_0x50c1c8,_0x3de03e){_0x50c1c8=_0x50c1c8-0x0;var _0x3b8e69=_0xb6a8[_0x50c1c8];return _0x3b8e69;};'use strict';var _=require(_0x8b6a('0x0'));var util=require(_0x8b6a('0x1'));var moment=require(_0x8b6a('0x2'));var BPromise=require(_0x8b6a('0x3'));var rs=require(_0x8b6a('0x4'));var fs=require('fs');var Redis=require(_0x8b6a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8b6a('0x6'));var jayson=require(_0x8b6a('0x7'));var client=jayson[_0x8b6a('0x8')][_0x8b6a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x275feb,_0x27b1f5,_0x2843cf){return new BPromise(function(_0x3fba29,_0x7915b3){return client[_0x8b6a('0xa')](_0x275feb,_0x2843cf)['then'](function(_0x102e1b){logger['info'](_0x8b6a('0xb'),_0x27b1f5,_0x8b6a('0xc'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x27b1f5,_0x8b6a('0xc'),JSON[_0x8b6a('0xd')](_0x102e1b));if(_0x102e1b[_0x8b6a('0xe')]){if(_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0xf')]===0x1f4){logger['error'](_0x8b6a('0xb'),_0x27b1f5,_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);return _0x7915b3(_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);}logger[_0x8b6a('0xe')](_0x8b6a('0xb'),_0x27b1f5,_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);return _0x3fba29(_0x102e1b['error'][_0x8b6a('0x10')]);}else{logger[_0x8b6a('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27b1f5,_0x8b6a('0xc'));_0x3fba29(_0x102e1b['result'][_0x8b6a('0x10')]);}})[_0x8b6a('0x12')](function(_0x2ed166){logger[_0x8b6a('0xe')](_0x8b6a('0xb'),_0x27b1f5,_0x2ed166);_0x7915b3(_0x2ed166);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 244e48a..99a2c6b 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 _0x0929=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','exports','multer','path'];(function(_0x3d2e3b,_0x351cc6){var _0x22edc6=function(_0x18b557){while(--_0x18b557){_0x3d2e3b['push'](_0x3d2e3b['shift']());}};_0x22edc6(++_0x351cc6);}(_0x0929,0x152));var _0x9092=function(_0x3c80e8,_0x2bb4ff){_0x3c80e8=_0x3c80e8-0x0;var _0xe57191=_0x0929[_0x3c80e8];return _0xe57191;};'use strict';var multer=require(_0x9092('0x0'));var util=require('util');var path=require(_0x9092('0x1'));var timeout=require('connect-timeout');var express=require(_0x9092('0x2'));var router=express[_0x9092('0x3')]();var fs_extra=require(_0x9092('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9092('0x5'));var config=require(_0x9092('0x6'));var controller=require(_0x9092('0x7'));router['get']('/',auth[_0x9092('0x8')](),controller[_0x9092('0x9')]);router[_0x9092('0xa')](_0x9092('0xb'),auth['isAuthenticated'](),controller[_0x9092('0xc')]);router[_0x9092('0xa')](_0x9092('0xd'),auth[_0x9092('0x8')](),controller[_0x9092('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9092('0xf')]);router[_0x9092('0x10')](_0x9092('0xd'),auth[_0x9092('0x8')](),controller[_0x9092('0x11')]);router[_0x9092('0x12')](_0x9092('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9092('0x13')]=router; \ No newline at end of file +var _0x2e04=['/:id','show','post','put','update','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe'];(function(_0x175401,_0x281048){var _0x4d7689=function(_0x48349d){while(--_0x48349d){_0x175401['push'](_0x175401['shift']());}};_0x4d7689(++_0x281048);}(_0x2e04,0x16b));var _0x42e0=function(_0x1a0dd5,_0x5b64b7){_0x1a0dd5=_0x1a0dd5-0x0;var _0x1a6209=_0x2e04[_0x1a0dd5];return _0x1a6209;};'use strict';var multer=require(_0x42e0('0x0'));var util=require(_0x42e0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x42e0('0x2')]();var fs_extra=require(_0x42e0('0x3'));var auth=require(_0x42e0('0x4'));var interaction=require(_0x42e0('0x5'));var config=require(_0x42e0('0x6'));var controller=require(_0x42e0('0x7'));router[_0x42e0('0x8')]('/',auth[_0x42e0('0x9')](),controller['index']);router['get']('/describe',auth[_0x42e0('0x9')](),controller[_0x42e0('0xa')]);router['get'](_0x42e0('0xb'),auth['isAuthenticated'](),controller[_0x42e0('0xc')]);router[_0x42e0('0xd')]('/',auth[_0x42e0('0x9')](),controller['create']);router[_0x42e0('0xe')]('/:id',auth[_0x42e0('0x9')](),controller[_0x42e0('0xf')]);router['delete'](_0x42e0('0xb'),auth[_0x42e0('0x9')](),controller[_0x42e0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 8d288e7..543b041 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 _0xf7c1=['exports','ENUM','timeout','mouseOver','sequelize'];(function(_0x2e25cf,_0x283810){var _0x23c0ff=function(_0x210a54){while(--_0x210a54){_0x2e25cf['push'](_0x2e25cf['shift']());}};_0x23c0ff(++_0x283810);}(_0xf7c1,0x1f3));var _0x1f7c=function(_0x45fad5,_0x350c95){_0x45fad5=_0x45fad5-0x0;var _0x441cec=_0xf7c1[_0x45fad5];return _0x441cec;};'use strict';var Sequelize=require(_0x1f7c('0x0'));module[_0x1f7c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1f7c('0x2')]('mouseOver',_0x1f7c('0x3')),'defaultValue':_0x1f7c('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x035d=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x1c977f,_0x20954e){var _0x5d57ef=function(_0x1275cb){while(--_0x1275cb){_0x1c977f['push'](_0x1c977f['shift']());}};_0x5d57ef(++_0x20954e);}(_0x035d,0x1c1));var _0xd035=function(_0x38054e,_0x12fdc0){_0x38054e=_0x38054e-0x0;var _0x1e7b8d=_0x035d[_0x38054e];return _0x1e7b8d;};'use strict';var Sequelize=require(_0xd035('0x0'));module[_0xd035('0x1')]={'name':{'type':Sequelize[_0xd035('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd035('0x3'),_0xd035('0x4')),'defaultValue':_0xd035('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd035('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ccf5d9b..6aee578 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 _0xfa2b=['../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','update','destroy','error','name','send','params','model','ChatProactiveAction','query','keys','intersection','fields','attributes','length','includeAll','merge','options','find','then','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xf2c0a3,_0x3a63a0){var _0x2ba903=function(_0x3f64c6){while(--_0x3f64c6){_0xf2c0a3['push'](_0xf2c0a3['shift']());}};_0x2ba903(++_0x3a63a0);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x910a8a,_0xaa6d5){_0x910a8a=_0x910a8a-0x0;var _0x364efc=_0xfa2b[_0x910a8a];return _0x364efc;};'use strict';var emlformat=require(_0xbfa2('0x0'));var rimraf=require(_0xbfa2('0x1'));var zipdir=require(_0xbfa2('0x2'));var jsonpatch=require(_0xbfa2('0x3'));var rp=require(_0xbfa2('0x4'));var moment=require(_0xbfa2('0x5'));var BPromise=require(_0xbfa2('0x6'));var Mustache=require(_0xbfa2('0x7'));var util=require(_0xbfa2('0x8'));var path=require(_0xbfa2('0x9'));var sox=require(_0xbfa2('0xa'));var csv=require(_0xbfa2('0xb'));var ejs=require(_0xbfa2('0xc'));var fs=require('fs');var fs_extra=require(_0xbfa2('0xd'));var _=require(_0xbfa2('0xe'));var squel=require(_0xbfa2('0xf'));var crypto=require('crypto');var jsforce=require(_0xbfa2('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbfa2('0xb'));var querystring=require(_0xbfa2('0x11'));var Papa=require(_0xbfa2('0x12'));var Redis=require(_0xbfa2('0x13'));var authService=require(_0xbfa2('0x14'));var qs=require(_0xbfa2('0x15'));var as=require(_0xbfa2('0x16'));var hardwareService=require(_0xbfa2('0x17'));var logger=require(_0xbfa2('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbfa2('0x19'));var db=require(_0xbfa2('0x1a'))['db'];function respondWithStatusCode(_0x62b1e9,_0x829a72){_0x829a72=_0x829a72||0xcc;return function(_0x137e0d){if(_0x137e0d){return _0x62b1e9[_0xbfa2('0x1b')](_0x829a72);}return _0x62b1e9['status'](_0x829a72)[_0xbfa2('0x1c')]();};}function respondWithResult(_0xaf815f,_0x458653){_0x458653=_0x458653||0xc8;return function(_0x445598){if(_0x445598){return _0xaf815f[_0xbfa2('0x1d')](_0x458653)['json'](_0x445598);}};}function respondWithFilteredResult(_0xa988cc,_0x47db68){return function(_0x5d3aa2){if(_0x5d3aa2){var _0xee34b8=typeof _0x47db68['offset']==='undefined'&&typeof _0x47db68[_0xbfa2('0x1e')]===_0xbfa2('0x1f');var _0x54cdb2=_0x5d3aa2[_0xbfa2('0x20')];var _0x12627a=_0xee34b8?0x0:_0x47db68[_0xbfa2('0x21')];var _0x4088c5=_0xee34b8?_0x5d3aa2[_0xbfa2('0x20')]:_0x47db68[_0xbfa2('0x21')]+_0x47db68[_0xbfa2('0x1e')];var _0x5c3123;if(_0x4088c5>=_0x54cdb2){_0x4088c5=_0x54cdb2;_0x5c3123=0xc8;}else{_0x5c3123=0xce;}_0xa988cc[_0xbfa2('0x1d')](_0x5c3123);return _0xa988cc[_0xbfa2('0x22')](_0xbfa2('0x23'),_0x12627a+'-'+_0x4088c5+'/'+_0x54cdb2)['json'](_0x5d3aa2);}return null;};}function patchUpdates(_0x2ac6c3){return function(_0x3073ae){try{jsonpatch['apply'](_0x3073ae,_0x2ac6c3,!![]);}catch(_0xd5760d){return BPromise['reject'](_0xd5760d);}return _0x3073ae['save']();};}function saveUpdates(_0xc42b51,_0xdb059b){return function(_0x1ec19f){if(_0x1ec19f){return _0x1ec19f[_0xbfa2('0x24')](_0xc42b51)['then'](function(_0x5bb514){return _0x5bb514;});}return null;};}function removeEntity(_0x599df2,_0x13db3e){return function(_0x5e6e80){if(_0x5e6e80){return _0x5e6e80[_0xbfa2('0x25')]()['then'](function(){_0x599df2[_0xbfa2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x289c04,_0xbe4d26){return function(_0x8488e1){if(!_0x8488e1){_0x289c04[_0xbfa2('0x1b')](0x194);}return _0x8488e1;};}function handleError(_0x1e1c76,_0x50d83a){_0x50d83a=_0x50d83a||0x1f4;return function(_0x310d74){logger[_0xbfa2('0x26')](_0x310d74['stack']);if(_0x310d74[_0xbfa2('0x27')]){delete _0x310d74[_0xbfa2('0x27')];}_0x1e1c76['status'](_0x50d83a)[_0xbfa2('0x28')](_0x310d74);};}exports['show']=function(_0x16bc84,_0x56dd44){var _0x8b7c9={'raw':!![],'where':{'id':_0x16bc84[_0xbfa2('0x29')]['id']}},_0x596e72={};_0x596e72[_0xbfa2('0x2a')]=_['keys'](db[_0xbfa2('0x2b')]['rawAttributes']);_0x596e72[_0xbfa2('0x2c')]=_[_0xbfa2('0x2d')](_0x16bc84[_0xbfa2('0x2c')]);_0x596e72['filters']=_[_0xbfa2('0x2e')](_0x596e72[_0xbfa2('0x2a')],_0x596e72[_0xbfa2('0x2c')]);_0x8b7c9['attributes']=_['intersection'](_0x596e72['model'],qs[_0xbfa2('0x2f')](_0x16bc84[_0xbfa2('0x2c')]['fields']));_0x8b7c9[_0xbfa2('0x30')]=_0x8b7c9[_0xbfa2('0x30')][_0xbfa2('0x31')]?_0x8b7c9[_0xbfa2('0x30')]:_0x596e72['model'];if(_0x16bc84[_0xbfa2('0x2c')][_0xbfa2('0x32')]){_0x8b7c9['include']=[{'all':!![]}];}_0x8b7c9=_[_0xbfa2('0x33')]({},_0x8b7c9,_0x16bc84[_0xbfa2('0x34')]);return db[_0xbfa2('0x2b')][_0xbfa2('0x35')](_0x8b7c9)[_0xbfa2('0x36')](handleEntityNotFound(_0x56dd44,null))[_0xbfa2('0x36')](respondWithResult(_0x56dd44,null))[_0xbfa2('0x37')](handleError(_0x56dd44,null));};exports[_0xbfa2('0x38')]=function(_0x787887,_0x5d6c57){return db[_0xbfa2('0x2b')]['create'](_0x787887[_0xbfa2('0x39')],{})['then'](respondWithResult(_0x5d6c57,0xc9))[_0xbfa2('0x37')](handleError(_0x5d6c57,null));};exports[_0xbfa2('0x24')]=function(_0x1611b0,_0xa665d8){if(_0x1611b0[_0xbfa2('0x39')]['id']){delete _0x1611b0['body']['id'];}return db[_0xbfa2('0x2b')][_0xbfa2('0x35')]({'where':{'id':_0x1611b0[_0xbfa2('0x29')]['id']}})[_0xbfa2('0x36')](handleEntityNotFound(_0xa665d8,null))[_0xbfa2('0x36')](saveUpdates(_0x1611b0['body'],null))['then'](respondWithResult(_0xa665d8,null))[_0xbfa2('0x37')](handleError(_0xa665d8,null));};exports[_0xbfa2('0x25')]=function(_0x242139,_0x55180c){return db['ChatProactiveAction'][_0xbfa2('0x35')]({'where':{'id':_0x242139[_0xbfa2('0x29')]['id']}})['then'](handleEntityNotFound(_0x55180c,null))['then'](removeEntity(_0x55180c,null))[_0xbfa2('0x37')](handleError(_0x55180c,null));}; \ No newline at end of file +var _0xc01b=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','json','reject','save','update','destroy','then','sendStatus','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc01b,0x65));var _0xbc01=function(_0x158502,_0x1bb597){_0x158502=_0x158502-0x0;var _0x858904=_0xc01b[_0x158502];return _0x858904;};'use strict';var emlformat=require(_0xbc01('0x0'));var rimraf=require(_0xbc01('0x1'));var zipdir=require(_0xbc01('0x2'));var jsonpatch=require(_0xbc01('0x3'));var rp=require('request-promise');var moment=require(_0xbc01('0x4'));var BPromise=require(_0xbc01('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbc01('0x6'));var csv=require(_0xbc01('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc01('0x8'));var squel=require(_0xbc01('0x9'));var crypto=require(_0xbc01('0xa'));var jsforce=require(_0xbc01('0xb'));var deskjs=require(_0xbc01('0xc'));var toCsv=require(_0xbc01('0x7'));var querystring=require(_0xbc01('0xd'));var Papa=require('papaparse');var Redis=require(_0xbc01('0xe'));var authService=require(_0xbc01('0xf'));var qs=require(_0xbc01('0x10'));var as=require(_0xbc01('0x11'));var hardwareService=require(_0xbc01('0x12'));var logger=require(_0xbc01('0x13'))(_0xbc01('0x14'));var utils=require(_0xbc01('0x15'));var config=require(_0xbc01('0x16'));var licenseUtil=require(_0xbc01('0x17'));var db=require(_0xbc01('0x18'))['db'];function respondWithStatusCode(_0x13d9ff,_0x403af3){_0x403af3=_0x403af3||0xcc;return function(_0x2d3cc4){if(_0x2d3cc4){return _0x13d9ff['sendStatus'](_0x403af3);}return _0x13d9ff[_0xbc01('0x19')](_0x403af3)[_0xbc01('0x1a')]();};}function respondWithResult(_0xfc7e92,_0x5de273){_0x5de273=_0x5de273||0xc8;return function(_0x20aedd){if(_0x20aedd){return _0xfc7e92[_0xbc01('0x19')](_0x5de273)['json'](_0x20aedd);}};}function respondWithFilteredResult(_0x3d3fe6,_0x30a0fe){return function(_0x45736c){if(_0x45736c){var _0xf61d88=typeof _0x30a0fe['offset']==='undefined'&&typeof _0x30a0fe[_0xbc01('0x1b')]===_0xbc01('0x1c');var _0x47b5b2=_0x45736c[_0xbc01('0x1d')];var _0x48c750=_0xf61d88?0x0:_0x30a0fe[_0xbc01('0x1e')];var _0x21821a=_0xf61d88?_0x45736c[_0xbc01('0x1d')]:_0x30a0fe[_0xbc01('0x1e')]+_0x30a0fe['limit'];var _0x17cc53;if(_0x21821a>=_0x47b5b2){_0x21821a=_0x47b5b2;_0x17cc53=0xc8;}else{_0x17cc53=0xce;}_0x3d3fe6[_0xbc01('0x19')](_0x17cc53);return _0x3d3fe6[_0xbc01('0x1f')]('Content-Range',_0x48c750+'-'+_0x21821a+'/'+_0x47b5b2)[_0xbc01('0x20')](_0x45736c);}return null;};}function patchUpdates(_0x121670){return function(_0x4a944c){try{jsonpatch['apply'](_0x4a944c,_0x121670,!![]);}catch(_0x4a9656){return BPromise[_0xbc01('0x21')](_0x4a9656);}return _0x4a944c[_0xbc01('0x22')]();};}function saveUpdates(_0x3ae9d6,_0x1299a7){return function(_0x23d4f0){if(_0x23d4f0){return _0x23d4f0[_0xbc01('0x23')](_0x3ae9d6)['then'](function(_0x77a41a){return _0x77a41a;});}return null;};}function removeEntity(_0x5b283b,_0x230ae9){return function(_0x535ad7){if(_0x535ad7){return _0x535ad7[_0xbc01('0x24')]()[_0xbc01('0x25')](function(){_0x5b283b[_0xbc01('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf13b08,_0xd90813){return function(_0x56383f){if(!_0x56383f){_0xf13b08[_0xbc01('0x26')](0x194);}return _0x56383f;};}function handleError(_0x23c9f8,_0x1097f6){_0x1097f6=_0x1097f6||0x1f4;return function(_0x14dbcb){logger[_0xbc01('0x27')](_0x14dbcb[_0xbc01('0x28')]);if(_0x14dbcb[_0xbc01('0x29')]){delete _0x14dbcb[_0xbc01('0x29')];}_0x23c9f8[_0xbc01('0x19')](_0x1097f6)[_0xbc01('0x2a')](_0x14dbcb);};}exports[_0xbc01('0x2b')]=function(_0x5778d7,_0x305628){var _0x46d0de={'raw':!![],'where':{'id':_0x5778d7[_0xbc01('0x2c')]['id']}},_0x1a146f={};_0x1a146f[_0xbc01('0x2d')]=_[_0xbc01('0x2e')](db[_0xbc01('0x2f')]['rawAttributes']);_0x1a146f[_0xbc01('0x30')]=_['keys'](_0x5778d7[_0xbc01('0x30')]);_0x1a146f[_0xbc01('0x31')]=_['intersection'](_0x1a146f[_0xbc01('0x2d')],_0x1a146f[_0xbc01('0x30')]);_0x46d0de['attributes']=_[_0xbc01('0x32')](_0x1a146f[_0xbc01('0x2d')],qs[_0xbc01('0x33')](_0x5778d7['query'][_0xbc01('0x33')]));_0x46d0de[_0xbc01('0x34')]=_0x46d0de[_0xbc01('0x34')][_0xbc01('0x35')]?_0x46d0de[_0xbc01('0x34')]:_0x1a146f['model'];if(_0x5778d7[_0xbc01('0x30')][_0xbc01('0x36')]){_0x46d0de['include']=[{'all':!![]}];}_0x46d0de=_[_0xbc01('0x37')]({},_0x46d0de,_0x5778d7[_0xbc01('0x38')]);return db[_0xbc01('0x2f')][_0xbc01('0x39')](_0x46d0de)[_0xbc01('0x25')](handleEntityNotFound(_0x305628,null))[_0xbc01('0x25')](respondWithResult(_0x305628,null))[_0xbc01('0x3a')](handleError(_0x305628,null));};exports[_0xbc01('0x3b')]=function(_0xdfbe96,_0x2b64c6){return db[_0xbc01('0x2f')]['create'](_0xdfbe96[_0xbc01('0x3c')],{})[_0xbc01('0x25')](respondWithResult(_0x2b64c6,0xc9))['catch'](handleError(_0x2b64c6,null));};exports[_0xbc01('0x23')]=function(_0x308503,_0x4b639c){if(_0x308503[_0xbc01('0x3c')]['id']){delete _0x308503[_0xbc01('0x3c')]['id'];}return db[_0xbc01('0x2f')][_0xbc01('0x39')]({'where':{'id':_0x308503[_0xbc01('0x2c')]['id']}})[_0xbc01('0x25')](handleEntityNotFound(_0x4b639c,null))[_0xbc01('0x25')](saveUpdates(_0x308503[_0xbc01('0x3c')],null))[_0xbc01('0x25')](respondWithResult(_0x4b639c,null))[_0xbc01('0x3a')](handleError(_0x4b639c,null));};exports[_0xbc01('0x24')]=function(_0x575de2,_0x3fabda){return db['ChatProactiveAction'][_0xbc01('0x39')]({'where':{'id':_0x575de2[_0xbc01('0x2c')]['id']}})[_0xbc01('0x25')](handleEntityNotFound(_0x3fabda,null))[_0xbc01('0x25')](removeEntity(_0x3fabda,null))[_0xbc01('0x3a')](handleError(_0x3fabda,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 3c3e28e..090453d 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 _0x42ab=['../../config/environment','./chatProactiveAction.attributes','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x5ae150,_0x51409d){var _0x420c7=function(_0x448668){while(--_0x448668){_0x5ae150['push'](_0x5ae150['shift']());}};_0x420c7(++_0x51409d);}(_0x42ab,0xaa));var _0xb42a=function(_0x38ead5,_0x5b4fa2){_0x38ead5=_0x38ead5-0x0;var _0x4e40bc=_0x42ab[_0x38ead5];return _0x4e40bc;};'use strict';var _=require('lodash');var util=require(_0xb42a('0x0'));var logger=require('../../config/logger')(_0xb42a('0x1'));var moment=require(_0xb42a('0x2'));var BPromise=require(_0xb42a('0x3'));var rp=require(_0xb42a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb42a('0x5'));var config=require(_0xb42a('0x6'));var attributes=require(_0xb42a('0x7'));module['exports']=function(_0x16786f,_0x5e3f46){return _0x16786f['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe57f=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x5bfe2d,_0x2e8694){var _0x14e037=function(_0x57979c){while(--_0x57979c){_0x5bfe2d['push'](_0x5bfe2d['shift']());}};_0x14e037(++_0x2e8694);}(_0xe57f,0x143));var _0xfe57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe57f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfe57('0x0'));var util=require(_0xfe57('0x1'));var logger=require('../../config/logger')(_0xfe57('0x2'));var moment=require(_0xfe57('0x3'));var BPromise=require(_0xfe57('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe57('0x5'));var rimraf=require(_0xfe57('0x6'));var config=require(_0xfe57('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0xfe57('0x8')]=function(_0x3d3644,_0x300bd0){return _0x3d3644[_0xfe57('0x9')](_0xfe57('0xa'),attributes,{'tableName':_0xfe57('0xb'),'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 e6f7c2a..ac22f9f 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 _0x361f=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x7b01b1,_0x4227fa){var _0x1f82b8=function(_0x4e6c17){while(--_0x4e6c17){_0x7b01b1['push'](_0x7b01b1['shift']());}};_0x1f82b8(++_0x4227fa);}(_0x361f,0x13c));var _0xf361=function(_0x4a031c,_0x20b1fa){_0x4a031c=_0x4a031c-0x0;var _0x4078f4=_0x361f[_0x4a031c];return _0x4078f4;};'use strict';var _=require(_0xf361('0x0'));var util=require(_0xf361('0x1'));var moment=require(_0xf361('0x2'));var BPromise=require(_0xf361('0x3'));var rs=require(_0xf361('0x4'));var fs=require('fs');var Redis=require(_0xf361('0x5'));var db=require(_0xf361('0x6'))['db'];var utils=require(_0xf361('0x7'));var logger=require('../../config/logger')(_0xf361('0x8'));var config=require(_0xf361('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf361('0xa')][_0xf361('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40b235,_0x2acb10,_0x13df2b){return new BPromise(function(_0x5b9b7f,_0x83c2dd){return client[_0xf361('0xc')](_0x40b235,_0x13df2b)[_0xf361('0xd')](function(_0x29c703){logger[_0xf361('0xe')](_0xf361('0xf'),_0x2acb10,_0xf361('0x10'));logger[_0xf361('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2acb10,'request\x20sent',JSON['stringify'](_0x29c703));if(_0x29c703[_0xf361('0x12')]){if(_0x29c703[_0xf361('0x12')][_0xf361('0x13')]===0x1f4){logger['error'](_0xf361('0xf'),_0x2acb10,_0x29c703['error'][_0xf361('0x14')]);return _0x83c2dd(_0x29c703[_0xf361('0x12')][_0xf361('0x14')]);}logger[_0xf361('0x12')](_0xf361('0xf'),_0x2acb10,_0x29c703[_0xf361('0x12')][_0xf361('0x14')]);return _0x5b9b7f(_0x29c703['error']['message']);}else{logger[_0xf361('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2acb10,_0xf361('0x10'));_0x5b9b7f(_0x29c703[_0xf361('0x15')]['message']);}})[_0xf361('0x16')](function(_0x8a3a96){logger[_0xf361('0x12')](_0xf361('0xf'),_0x2acb10,_0x8a3a96);_0x83c2dd(_0x8a3a96);});});} \ No newline at end of file +var _0xfca4=['code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xfca4,0x87));var _0x4fca=function(_0x5ee0ef,_0x34f2b1){_0x5ee0ef=_0x5ee0ef-0x0;var _0x144aab=_0xfca4[_0x5ee0ef];return _0x144aab;};'use strict';var _=require(_0x4fca('0x0'));var util=require(_0x4fca('0x1'));var moment=require(_0x4fca('0x2'));var BPromise=require(_0x4fca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fca('0x4'));var db=require(_0x4fca('0x5'))['db'];var utils=require(_0x4fca('0x6'));var logger=require(_0x4fca('0x7'))(_0x4fca('0x8'));var config=require(_0x4fca('0x9'));var jayson=require(_0x4fca('0xa'));var client=jayson['client'][_0x4fca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x370b5a,_0x1ded57,_0x1b0af3){return new BPromise(function(_0x2115ca,_0x2b0954){return client[_0x4fca('0xc')](_0x370b5a,_0x1b0af3)['then'](function(_0x8d806d){logger[_0x4fca('0xd')](_0x4fca('0xe'),_0x1ded57,_0x4fca('0xf'));logger[_0x4fca('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1ded57,_0x4fca('0xf'),JSON[_0x4fca('0x11')](_0x8d806d));if(_0x8d806d['error']){if(_0x8d806d[_0x4fca('0x12')][_0x4fca('0x13')]===0x1f4){logger['error'](_0x4fca('0xe'),_0x1ded57,_0x8d806d[_0x4fca('0x12')][_0x4fca('0x14')]);return _0x2b0954(_0x8d806d[_0x4fca('0x12')][_0x4fca('0x14')]);}logger[_0x4fca('0x12')](_0x4fca('0xe'),_0x1ded57,_0x8d806d[_0x4fca('0x12')][_0x4fca('0x14')]);return _0x2115ca(_0x8d806d[_0x4fca('0x12')][_0x4fca('0x14')]);}else{logger['info'](_0x4fca('0xe'),_0x1ded57,_0x4fca('0xf'));_0x2115ca(_0x8d806d['result'][_0x4fca('0x14')]);}})[_0x4fca('0x15')](function(_0x2ca696){logger[_0x4fca('0x12')](_0x4fca('0xe'),_0x1ded57,_0x2ca696);_0x2b0954(_0x2ca696);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a8f7e0f..e709571 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 _0x1cb9=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller'];(function(_0x3149cf,_0x1266eb){var _0x4d283a=function(_0x544724){while(--_0x544724){_0x3149cf['push'](_0x3149cf['shift']());}};_0x4d283a(++_0x1266eb);}(_0x1cb9,0x14e));var _0x91cb=function(_0x422f26,_0x553aa8){_0x422f26=_0x422f26-0x0;var _0x11661e=_0x1cb9[_0x422f26];return _0x11661e;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0xb')]);router[_0x91cb('0xc')]('/',auth['isAuthenticated'](),controller[_0x91cb('0xd')]);router['put'](_0x91cb('0x9'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0x10')]);module[_0x91cb('0x11')]=router; \ No newline at end of file +var _0xeec6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','put','update','delete','exports'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0xeec6,0x1c2));var _0x6eec=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xeec6[_0x17c483];return _0x112bdb;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get'](_0x6eec('0xa'),auth[_0x6eec('0xb')](),controller['show']);router[_0x6eec('0xc')]('/',auth[_0x6eec('0xb')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6eec('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 0bab473..837af07 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 _0x8ce8=['roundrobin','exports','name','ENUM','rrmemory','beepall'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x8ce8,0x1db));var _0x88ce=function(_0x5c7a48,_0x3f259d){_0x5c7a48=_0x5c7a48-0x0;var _0x4c2e26=_0x8ce8[_0x5c7a48];return _0x4c2e26;};'use strict';var Sequelize=require('sequelize');module[_0x88ce('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x88ce('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x88ce('0x2')](_0x88ce('0x3'),_0x88ce('0x4'),_0x88ce('0x5'))}}; \ No newline at end of file +var _0xa313=['sequelize','exports','STRING','name','ENUM','beepall','roundrobin'];(function(_0x233dfa,_0x15a2b8){var _0x385567=function(_0x4de008){while(--_0x4de008){_0x233dfa['push'](_0x233dfa['shift']());}};_0x385567(++_0x15a2b8);}(_0xa313,0x11f));var _0x3a31=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0xa313[_0x20f96d];return _0x9a7524;};'use strict';var Sequelize=require(_0x3a31('0x0'));module[_0x3a31('0x1')]={'name':{'type':Sequelize[_0x3a31('0x2')],'unique':_0x3a31('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3a31('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3a31('0x4')]('rrmemory',_0x3a31('0x5'),_0x3a31('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3ccc290..ae94f1d 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 _0x337c=['nolimit','bluebird','util','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./chatQueue.socket','sendStatus','status','end','json','limit','offset','count','set','Content-Range','update','then','destroy','ChatQueues','UserProfileResource','error','stack','send','index','map','fieldName','type','key','getOptions','where','ChatQueue','include','query','show','model','keys','rawAttributes','filters','attributes','fields','length','includeAll','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','params','UserChatQueue','intersection','hasOwnProperty','sort','pick','ChatQueueId','filter','merge','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','order','getTeams','addTeams','ids','Agents','interface','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents'];(function(_0x544fbc,_0x2e2d16){var _0x43c8ef=function(_0x2613c3){while(--_0x2613c3){_0x544fbc['push'](_0x544fbc['shift']());}};_0x43c8ef(++_0x2e2d16);}(_0x337c,0x1d1));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xc337('0x0'));var util=require(_0xc337('0x1'));var _=require('lodash');var squel=require(_0xc337('0x2'));var Redis=require('ioredis');var qs=require(_0xc337('0x3'));var logger=require(_0xc337('0x4'))(_0xc337('0x5'));var config=require(_0xc337('0x6'));var db=require(_0xc337('0x7'))['db'];config[_0xc337('0x8')]=_[_0xc337('0x9')](config[_0xc337('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc337('0x8')]));require(_0xc337('0xa'))['register'](socket);function respondWithStatusCode(_0x1ee670,_0x200be7){_0x200be7=_0x200be7||0xcc;return function(_0x45e9b1){if(_0x45e9b1){return _0x1ee670[_0xc337('0xb')](_0x200be7);}return _0x1ee670[_0xc337('0xc')](_0x200be7)[_0xc337('0xd')]();};}function respondWithResult(_0x1550b5,_0x1d822f){_0x1d822f=_0x1d822f||0xc8;return function(_0x470a0b){if(_0x470a0b){return _0x1550b5[_0xc337('0xc')](_0x1d822f)[_0xc337('0xe')](_0x470a0b);}};}function respondWithFilteredResult(_0x17ce4e,_0x2aeb08){return function(_0x1ef585){if(_0x1ef585){var _0x2e1023=typeof _0x2aeb08['offset']==='undefined'&&typeof _0x2aeb08[_0xc337('0xf')]==='undefined';var _0x5f5eb9=_0x1ef585['count'];var _0x3591ce=_0x2e1023?0x0:_0x2aeb08[_0xc337('0x10')];var _0x4fa510=_0x2e1023?_0x1ef585[_0xc337('0x11')]:_0x2aeb08[_0xc337('0x10')]+_0x2aeb08[_0xc337('0xf')];var _0xa7e1f4;if(_0x4fa510>=_0x5f5eb9){_0x4fa510=_0x5f5eb9;_0xa7e1f4=0xc8;}else{_0xa7e1f4=0xce;}_0x17ce4e[_0xc337('0xc')](_0xa7e1f4);return _0x17ce4e[_0xc337('0x12')](_0xc337('0x13'),_0x3591ce+'-'+_0x4fa510+'/'+_0x5f5eb9)['json'](_0x1ef585);}return null;};}function saveUpdates(_0x23febf){return function(_0x53684c){if(_0x53684c){return _0x53684c[_0xc337('0x14')](_0x23febf)[_0xc337('0x15')](function(_0x55ec66){return _0x55ec66;});}return null;};}function removeEntity(_0x1a17d9){return function(_0x1a8c50){if(_0x1a8c50){return _0x1a8c50[_0xc337('0x16')]()['then'](function(){var _0x395a55=_0x1a8c50['get']({'plain':!![]});var _0x44c7ad=_0xc337('0x17');return db[_0xc337('0x18')][_0xc337('0x16')]({'where':{'type':_0x44c7ad,'resourceId':_0x395a55['id']}})['then'](function(){return _0x1a8c50;});})[_0xc337('0x15')](function(){_0x1a17d9['status'](0xcc)[_0xc337('0xd')]();});}};}function handleEntityNotFound(_0x17e26f){return function(_0x22c896){if(!_0x22c896){_0x17e26f['sendStatus'](0x194);}return _0x22c896;};}function handleError(_0x4c1ead,_0x3b5582){_0x3b5582=_0x3b5582||0x1f4;return function(_0x212374){logger[_0xc337('0x19')](_0x212374[_0xc337('0x1a')]);if(_0x212374['name']){delete _0x212374['name'];}_0x4c1ead[_0xc337('0xc')](_0x3b5582)[_0xc337('0x1b')](_0x212374);};}exports[_0xc337('0x1c')]=function(_0xe341cc,_0x2fb667){var _0x2357ab={};var _0x217c13={'count':0x0,'rows':[]};var _0x4c7e94=_[_0xc337('0x1d')](db['ChatQueue']['rawAttributes'],function(_0x4bf103){return{'name':_0x4bf103[_0xc337('0x1e')],'type':_0x4bf103[_0xc337('0x1f')][_0xc337('0x20')]};});_0x2357ab=qs[_0xc337('0x21')](_0x4c7e94,_0xe341cc);var _0x3b8c25={'where':_0x2357ab[_0xc337('0x22')]};return db[_0xc337('0x23')][_0xc337('0x11')](_0x3b8c25)[_0xc337('0x15')](function(_0x39d9dc){_0x217c13['count']=_0x39d9dc;_0x2357ab[_0xc337('0x24')]=qs[_0xc337('0x24')](_0xe341cc[_0xc337('0x25')]);return db[_0xc337('0x23')]['findAll'](_0x2357ab);})[_0xc337('0x15')](function(_0x2e7879){_0x217c13['rows']=_0x2e7879;return _0x217c13;})[_0xc337('0x15')](respondWithFilteredResult(_0x2fb667,_0x2357ab))['catch'](handleError(_0x2fb667,null));};exports[_0xc337('0x26')]=function(_0x306240,_0x9c4c30){var _0x3755da={'raw':!![],'where':{'id':_0x306240['params']['id']}},_0x1d60a5={};_0x1d60a5[_0xc337('0x27')]=_[_0xc337('0x28')](db[_0xc337('0x23')][_0xc337('0x29')]);_0x1d60a5[_0xc337('0x25')]=_[_0xc337('0x28')](_0x306240[_0xc337('0x25')]);_0x1d60a5[_0xc337('0x2a')]=_['intersection'](_0x1d60a5[_0xc337('0x27')],_0x1d60a5[_0xc337('0x25')]);_0x3755da[_0xc337('0x2b')]=_['intersection'](_0x1d60a5[_0xc337('0x27')],qs[_0xc337('0x2c')](_0x306240[_0xc337('0x25')][_0xc337('0x2c')]));_0x3755da[_0xc337('0x2b')]=_0x3755da['attributes'][_0xc337('0x2d')]?_0x3755da[_0xc337('0x2b')]:_0x1d60a5[_0xc337('0x27')];if(_0x306240[_0xc337('0x25')][_0xc337('0x2e')]){_0x3755da['include']=[{'all':!![]}];}_0x3755da=_['merge']({},_0x3755da,_0x306240[_0xc337('0x2f')]);return db['ChatQueue'][_0xc337('0x30')](_0x3755da)[_0xc337('0x15')](handleEntityNotFound(_0x9c4c30,null))[_0xc337('0x15')](respondWithResult(_0x9c4c30,null))[_0xc337('0x31')](handleError(_0x9c4c30,null));};exports[_0xc337('0x32')]=function(_0x1c90f7,_0x382f6c){return db[_0xc337('0x23')][_0xc337('0x32')](_0x1c90f7[_0xc337('0x33')],{})['then'](function(_0x1687e3){var _0x4a60a5=_0x1c90f7[_0xc337('0x34')][_0xc337('0x35')]({'plain':!![]});if(!_0x4a60a5)throw new Error(_0xc337('0x36'));if(_0x4a60a5['role']===_0xc337('0x34')){var _0x2df0e9=_0x1687e3[_0xc337('0x35')]({'plain':!![]});var _0x328f0e=_0xc337('0x17');return db['UserProfileSection'][_0xc337('0x30')]({'where':{'name':_0x328f0e,'userProfileId':_0x4a60a5['userProfileId']},'raw':!![]})[_0xc337('0x15')](function(_0x31803b){if(_0x31803b&&_0x31803b[_0xc337('0x37')]===0x0){return db[_0xc337('0x18')]['create']({'name':_0x2df0e9[_0xc337('0x38')],'resourceId':_0x2df0e9['id'],'type':_0x31803b[_0xc337('0x38')],'sectionId':_0x31803b['id']},{})[_0xc337('0x15')](function(){return _0x1687e3;});}else{return _0x1687e3;}})[_0xc337('0x31')](function(_0xd8466d){logger[_0xc337('0x19')](_0xc337('0x39'),_0xd8466d);throw _0xd8466d;});}return _0x1687e3;})[_0xc337('0x15')](respondWithResult(_0x382f6c,0xc9))[_0xc337('0x31')](handleError(_0x382f6c,null));};exports[_0xc337('0x14')]=function(_0x35eec4,_0x42bfa6){if(_0x35eec4['body']['id']){delete _0x35eec4[_0xc337('0x33')]['id'];}return db['ChatQueue'][_0xc337('0x30')]({'where':{'id':_0x35eec4['params']['id']}})[_0xc337('0x15')](handleEntityNotFound(_0x42bfa6,null))[_0xc337('0x15')](saveUpdates(_0x35eec4[_0xc337('0x33')],null))['then'](respondWithResult(_0x42bfa6,null))['catch'](handleError(_0x42bfa6,null));};exports[_0xc337('0x16')]=function(_0x57c4e9,_0x5e0d4b){return db[_0xc337('0x23')]['find']({'where':{'id':_0x57c4e9['params']['id']}})['then'](handleEntityNotFound(_0x5e0d4b,null))['then'](removeEntity(_0x5e0d4b,null))[_0xc337('0x31')](handleError(_0x5e0d4b,null));};exports[_0xc337('0x3a')]=function(_0xfe937,_0x37cc5e){return db[_0xc337('0x23')][_0xc337('0x3a')]()[_0xc337('0x15')](respondWithResult(_0x37cc5e,null))[_0xc337('0x31')](handleError(_0x37cc5e,null));};exports['getMembers']=function(_0x1542eb,_0x153ca2){var _0x1284bf={'raw':!![],'where':{}},_0x22f7d4={},_0x1b90ce;return db[_0xc337('0x23')][_0xc337('0x3b')]({'where':{'id':_0x1542eb[_0xc337('0x3c')]['id']}})[_0xc337('0x15')](handleEntityNotFound(_0x153ca2,null))[_0xc337('0x15')](function(_0x3436db){if(_0x3436db){_0x1b90ce=_0x3436db[_0xc337('0x35')]({'plain':!![]});_0x22f7d4[_0xc337('0x27')]=_[_0xc337('0x28')](db[_0xc337('0x3d')][_0xc337('0x29')]);_0x22f7d4[_0xc337('0x25')]=_[_0xc337('0x28')](_0x1542eb[_0xc337('0x25')]);_0x22f7d4[_0xc337('0x2a')]=_[_0xc337('0x3e')](_0x22f7d4[_0xc337('0x27')],_0x22f7d4[_0xc337('0x25')]);_0x1284bf[_0xc337('0x2b')]=_['intersection'](_0x22f7d4['model'],qs[_0xc337('0x2c')](_0x1542eb['query'][_0xc337('0x2c')]));_0x1284bf['attributes']=_0x1284bf[_0xc337('0x2b')][_0xc337('0x2d')]?_0x1284bf['attributes']:_0x22f7d4['model'];if(!_0x1542eb[_0xc337('0x25')][_0xc337('0x3f')]('nolimit')){_0x1284bf['limit']=qs['limit'](_0x1542eb[_0xc337('0x25')][_0xc337('0xf')]);_0x1284bf['offset']=qs[_0xc337('0x10')](_0x1542eb['query'][_0xc337('0x10')]);}_0x1284bf['order']=qs[_0xc337('0x40')](_0x1542eb['query'][_0xc337('0x40')]);_0x1284bf[_0xc337('0x22')]=qs[_0xc337('0x2a')](_[_0xc337('0x41')](_0x1542eb['query'],_0x22f7d4[_0xc337('0x2a')]));_0x1284bf[_0xc337('0x22')][_0xc337('0x42')]=_0x3436db['id'];if(_0x1542eb[_0xc337('0x25')][_0xc337('0x43')]){_0x1284bf[_0xc337('0x22')]=_['merge'](_0x1284bf[_0xc337('0x22')],{'$or':_[_0xc337('0x1d')](_0x1284bf[_0xc337('0x2b')],function(_0x156676){var _0xe5cde8={};_0xe5cde8[_0x156676]={'$like':'%'+_0x1542eb[_0xc337('0x25')][_0xc337('0x43')]+'%'};return _0xe5cde8;})});}_0x1284bf=_[_0xc337('0x44')]({},_0x1284bf,_0x1542eb['options']);return db['UserChatQueue'][_0xc337('0x45')](_0x1284bf);}})[_0xc337('0x15')](function(_0x1c2a39){if(_0x1c2a39){return db[_0xc337('0x46')]['findAndCountAll']({'where':{'id':_['map'](_0x1c2a39,_0xc337('0x47')),'role':_0xc337('0x48')},'attributes':['id',_0xc337('0x38'),_0xc337('0x49'),_0xc337('0x4a'),_0xc337('0x4b')]});}})['then'](function(_0x1bb8a5){if(_0x1bb8a5){return{'count':_0x1bb8a5[_0xc337('0x11')],'rows':_[_0xc337('0x1d')](_0x1bb8a5[_0xc337('0x4c')],function(_0xc35f0d){return{'membername':_0xc35f0d[_0xc337('0x38')],'UserId':_0xc35f0d['id'],'queue_name':_0x1b90ce['name'],'ChatQueueId':_0x1b90ce['id'],'interface':util[_0xc337('0x4d')](_0xc337('0x4e'),_0xc337('0x4f'),_0xc35f0d[_0xc337('0x38')]),'penalty':0x0,'paused':_0xc35f0d[_0xc337('0x49')],'createdAt':_0xc35f0d['createdAt'],'updatedAt':_0xc35f0d[_0xc337('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc337('0x15')](respondWithFilteredResult(_0x153ca2,_0x1284bf))['catch'](handleError(_0x153ca2,null));};exports['getTeams']=function(_0x11ea88,_0x40308f){var _0x47fdbf={};var _0x10faf6={};var _0x4c1494;var _0xa366e2;return db[_0xc337('0x23')]['findOne']({'where':{'id':_0x11ea88[_0xc337('0x3c')]['id']}})[_0xc337('0x15')](handleEntityNotFound(_0x40308f,null))[_0xc337('0x15')](function(_0x259de0){if(_0x259de0){_0x4c1494=_0x259de0;_0x10faf6[_0xc337('0x27')]=_['keys'](db[_0xc337('0x50')][_0xc337('0x29')]);_0x10faf6[_0xc337('0x25')]=_[_0xc337('0x28')](_0x11ea88['query']);_0x10faf6[_0xc337('0x2a')]=_['intersection'](_0x10faf6[_0xc337('0x27')],_0x10faf6['query']);_0x47fdbf[_0xc337('0x2b')]=_['intersection'](_0x10faf6[_0xc337('0x27')],qs[_0xc337('0x2c')](_0x11ea88['query']['fields']));_0x47fdbf[_0xc337('0x2b')]=_0x47fdbf[_0xc337('0x2b')][_0xc337('0x2d')]?_0x47fdbf['attributes']:_0x10faf6[_0xc337('0x27')];_0x47fdbf[_0xc337('0x51')]=qs['sort'](_0x11ea88['query'][_0xc337('0x40')]);_0x47fdbf[_0xc337('0x22')]=qs[_0xc337('0x2a')](_[_0xc337('0x41')](_0x11ea88[_0xc337('0x25')],_0x10faf6[_0xc337('0x2a')]));if(_0x11ea88[_0xc337('0x25')][_0xc337('0x43')]){_0x47fdbf['where']=_[_0xc337('0x44')](_0x47fdbf['where'],{'$or':_[_0xc337('0x1d')](_0x47fdbf[_0xc337('0x2b')],function(_0x2da934){var _0x28f4ad={};_0x28f4ad[_0x2da934]={'$like':'%'+_0x11ea88[_0xc337('0x25')][_0xc337('0x43')]+'%'};return _0x28f4ad;})});}_0x47fdbf=_[_0xc337('0x44')]({},_0x47fdbf,_0x11ea88[_0xc337('0x2f')]);return _0x4c1494[_0xc337('0x52')](_0x47fdbf);}})[_0xc337('0x15')](function(_0x384193){if(_0x384193){_0xa366e2=_0x384193[_0xc337('0x2d')];if(!_0x11ea88[_0xc337('0x25')][_0xc337('0x3f')]('nolimit')){_0x47fdbf[_0xc337('0xf')]=qs[_0xc337('0xf')](_0x11ea88['query'][_0xc337('0xf')]);_0x47fdbf['offset']=qs[_0xc337('0x10')](_0x11ea88[_0xc337('0x25')][_0xc337('0x10')]);}return _0x4c1494[_0xc337('0x52')](_0x47fdbf);}})['then'](function(_0x20c8e7){if(_0x20c8e7){return _0x20c8e7?{'count':_0xa366e2,'rows':_0x20c8e7}:null;}})[_0xc337('0x15')](respondWithResult(_0x40308f,null))[_0xc337('0x31')](handleError(_0x40308f,null));};exports[_0xc337('0x53')]=function(_0x21b373,_0x3d3b6e){var _0x4a6666=_0x21b373[_0xc337('0x33')][_0xc337('0x54')];return db[_0xc337('0x50')][_0xc337('0x45')]({'where':{'id':_0x4a6666},'attributes':['id'],'include':[{'model':db[_0xc337('0x46')],'as':_0xc337('0x55'),'attributes':['id',_0xc337('0x38'),'online','voicePause',_0xc337('0x56')],'raw':!![]}]})[_0xc337('0x15')](function(_0x1a5bff){if(_0x1a5bff){var _0x449dbd=_['flatMap'](_0x1a5bff,function(_0x240e05){var _0x5a1300=_0x240e05[_0xc337('0x35')]({'plain':!![]});return _0x5a1300['Agents'];});return db[_0xc337('0x23')]['find']({'where':{'id':_0x21b373[_0xc337('0x3c')]['id']}})['then'](function(_0x58fe57){return db['sequelize'][_0xc337('0x57')](function(_0x2f133b){return _0x58fe57[_0xc337('0x53')](_0x4a6666,{'transaction':_0x2f133b})[_0xc337('0x15')](function(){return BPromise[_0xc337('0x58')](_0x449dbd,function(_0x48cd52){return db[_0xc337('0x3d')]['findOrCreate']({'where':{'UserId':_0x48cd52['id'],'ChatQueueId':_0x21b373[_0xc337('0x3c')]['id']},'transaction':_0x2f133b});});})[_0xc337('0x15')](function(){_0x449dbd[_0xc337('0x59')](function(_0x90da9){socket[_0xc337('0x5a')](_0xc337('0x5b'),{'UserId':_0x90da9['id'],'ChatQueueId':_0x58fe57['id']});});});});});}})[_0xc337('0x15')](respondWithStatusCode(_0x3d3b6e,null))[_0xc337('0x31')](handleError(_0x3d3b6e,null));};exports[_0xc337('0x5c')]=function(_0x317935,_0x54a6bc){return db[_0xc337('0x50')][_0xc337('0x45')]({'where':{'id':_0x317935[_0xc337('0x25')][_0xc337('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc337('0x15')](handleEntityNotFound(_0x54a6bc,null))[_0xc337('0x15')](function(_0x2f6b38){var _0x36a31a=_[_0xc337('0x1d')](_0x2f6b38,'id');var _0x13f9e3=[];var _0x296666=[];var _0x18ef6e=squel[_0xc337('0x5d')]();_0x18ef6e['field']('tq.TeamId')['from'](_0xc337('0x5e'),'tq')[_0xc337('0x5f')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc337('0x60'),_0x317935[_0xc337('0x3c')]['id']);for(var _0x19420a=0x0;_0x19420a<_0x2f6b38[_0xc337('0x2d')];_0x19420a+=0x1){let _0x1f276c=_0x2f6b38[_0x19420a];for(var _0x32ea85=0x0;_0x32ea85<_0x1f276c[_0xc337('0x55')][_0xc337('0x2d')];_0x32ea85+=0x1){let _0x1877b8=_0x1f276c[_0xc337('0x55')][_0x32ea85];var _0x40fc03=_0x18ef6e[_0xc337('0x61')]();_0x40fc03[_0xc337('0x22')]('ut.UserId\x20=\x20?',_0x1877b8['id']);_0x296666[_0xc337('0x62')](db[_0xc337('0x63')][_0xc337('0x25')](_0x40fc03['toString'](),{'type':db[_0xc337('0x63')][_0xc337('0x64')][_0xc337('0x65')]})[_0xc337('0x15')](function(_0xb43799){if(_0xb43799[_0xc337('0x2d')]===0x1){return _0x1877b8['id'];}else{var _0x319c85=_['every'](_[_0xc337('0x1d')](_0xb43799,_0xc337('0x66')),function(_0x1834c0){return _[_0xc337('0x67')](_0x36a31a,_0x1834c0);});if(_0x319c85){return _0x1877b8['id'];}}}));}}return BPromise[_0xc337('0x68')](_0x296666)[_0xc337('0x15')](function(_0x2888a9){_0x13f9e3=_(_0x13f9e3)[_0xc337('0x69')](_0x2888a9)[_0xc337('0x6a')]()[_0xc337('0x6b')]();return db['ChatQueue'][_0xc337('0x30')]({'where':{'id':_0x317935['params']['id']}})[_0xc337('0x15')](function(_0x3ac744){return db[_0xc337('0x63')]['transaction'](function(_0x112a7c){return _0x3ac744[_0xc337('0x5c')](_0x317935[_0xc337('0x25')][_0xc337('0x54')],{'transaction':_0x112a7c})['then'](function(){if(!_['isEmpty'](_0x13f9e3)){return _0x3ac744[_0xc337('0x6c')](_0x13f9e3,{'transaction':_0x112a7c});}})['then'](function(){_0x13f9e3[_0xc337('0x59')](function(_0x5407ec){socket[_0xc337('0x5a')]('userChatQueue:remove',{'UserId':_0x5407ec,'ChatQueueId':_0x3ac744['id']});});});});});});})[_0xc337('0x15')](respondWithStatusCode(_0x54a6bc,null))['catch'](handleError(_0x54a6bc,null));};exports[_0xc337('0x6d')]=function(_0x18d55e,_0x2663b6){return db[_0xc337('0x23')]['find']({'where':{'id':_0x18d55e[_0xc337('0x3c')]['id']}})[_0xc337('0x15')](handleEntityNotFound(_0x2663b6,null))[_0xc337('0x15')](function(_0x6ce70a){if(_0x6ce70a){return _0x6ce70a[_0xc337('0x6d')](_0x18d55e['body'][_0xc337('0x54')],_[_0xc337('0x6e')](_0x18d55e[_0xc337('0x33')],[_0xc337('0x54'),'id'])||{})[_0xc337('0x6f')](function(_0x5260a9){for(var _0x678e26=0x0;_0x678e26<_0x18d55e[_0xc337('0x33')][_0xc337('0x54')][_0xc337('0x2d')];_0x678e26+=0x1){socket[_0xc337('0x5a')](_0xc337('0x5b'),{'UserId':Number(_0x18d55e[_0xc337('0x33')]['ids'][_0x678e26]),'ChatQueueId':Number(_0x18d55e['params']['id'])});}return _0x5260a9;});}})[_0xc337('0x15')](respondWithResult(_0x2663b6,null))[_0xc337('0x31')](handleError(_0x2663b6,null));};exports[_0xc337('0x6c')]=function(_0x2a60f4,_0xa492bb){return db[_0xc337('0x23')][_0xc337('0x30')]({'where':{'id':_0x2a60f4[_0xc337('0x3c')]['id']}})[_0xc337('0x15')](handleEntityNotFound(_0xa492bb,null))[_0xc337('0x15')](function(_0x52dfc1){if(_0x52dfc1){return _0x52dfc1[_0xc337('0x6c')](_0x2a60f4[_0xc337('0x25')][_0xc337('0x54')])[_0xc337('0x15')](function(){if(_[_0xc337('0x70')](_0x2a60f4[_0xc337('0x25')][_0xc337('0x54')])){for(var _0x4f79fc=0x0;_0x4f79fc<_0x2a60f4[_0xc337('0x25')][_0xc337('0x54')][_0xc337('0x2d')];_0x4f79fc+=0x1){socket['emit'](_0xc337('0x71'),{'UserId':Number(_0x2a60f4['query']['ids'][_0x4f79fc]),'ChatQueueId':Number(_0x2a60f4[_0xc337('0x3c')]['id'])});}}else{socket[_0xc337('0x5a')](_0xc337('0x71'),{'UserId':Number(_0x2a60f4[_0xc337('0x25')]['ids']),'ChatQueueId':Number(_0x2a60f4[_0xc337('0x3c')]['id'])});}});}})[_0xc337('0x15')](respondWithStatusCode(_0xa492bb,null))['catch'](handleError(_0xa492bb,null));};exports[_0xc337('0x72')]=function(_0x2c3cac,_0x361dbd){var _0x1f609c={};var _0x8a07e2={};var _0x3e406b;var _0x3dbd59;return db[_0xc337('0x23')][_0xc337('0x3b')]({'where':{'id':_0x2c3cac[_0xc337('0x3c')]['id']}})['then'](handleEntityNotFound(_0x361dbd,null))[_0xc337('0x15')](function(_0x482185){if(_0x482185){_0x3e406b=_0x482185;_0x8a07e2[_0xc337('0x27')]=_[_0xc337('0x28')](db[_0xc337('0x46')][_0xc337('0x29')]);_0x8a07e2[_0xc337('0x25')]=_['keys'](_0x2c3cac['query']);_0x8a07e2['filters']=_['intersection'](_0x8a07e2['model'],_0x8a07e2[_0xc337('0x25')]);_0x1f609c['attributes']=_[_0xc337('0x3e')](_0x8a07e2[_0xc337('0x27')],qs[_0xc337('0x2c')](_0x2c3cac[_0xc337('0x25')][_0xc337('0x2c')]));_0x1f609c[_0xc337('0x2b')]=_0x1f609c['attributes'][_0xc337('0x2d')]?_0x1f609c[_0xc337('0x2b')]:_0x8a07e2[_0xc337('0x27')];_0x1f609c[_0xc337('0x51')]=qs[_0xc337('0x40')](_0x2c3cac[_0xc337('0x25')][_0xc337('0x40')]);_0x1f609c[_0xc337('0x22')]=qs[_0xc337('0x2a')](_[_0xc337('0x41')](_0x2c3cac['query'],_0x8a07e2[_0xc337('0x2a')]));if(_0x2c3cac['query'][_0xc337('0x43')]){_0x1f609c[_0xc337('0x22')]=_['merge'](_0x1f609c['where'],{'$or':_[_0xc337('0x1d')](_0x1f609c['attributes'],function(_0x227ded){var _0x197f8b={};_0x197f8b[_0x227ded]={'$like':'%'+_0x2c3cac[_0xc337('0x25')][_0xc337('0x43')]+'%'};return _0x197f8b;})});}_0x1f609c=_['merge']({},_0x1f609c,_0x2c3cac[_0xc337('0x2f')]);return _0x3e406b['getAgents'](_0x1f609c);}})[_0xc337('0x15')](function(_0x432c63){if(_0x432c63){_0x3dbd59=_0x432c63['length'];if(!_0x2c3cac['query'][_0xc337('0x3f')](_0xc337('0x73'))){_0x1f609c[_0xc337('0xf')]=qs[_0xc337('0xf')](_0x2c3cac[_0xc337('0x25')][_0xc337('0xf')]);_0x1f609c[_0xc337('0x10')]=qs['offset'](_0x2c3cac['query'][_0xc337('0x10')]);}return _0x3e406b[_0xc337('0x72')](_0x1f609c);}})[_0xc337('0x15')](function(_0x2de7f7){if(_0x2de7f7){return _0x2de7f7?{'count':_0x3dbd59,'rows':_0x2de7f7}:null;}})['then'](respondWithResult(_0x361dbd,null))[_0xc337('0x31')](handleError(_0x361dbd,null));}; \ No newline at end of file +var _0x422b=['model','fields','attributes','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','options','UserChatQueue','findAll','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','online','interface','Agents','each','findOrCreate','emit','removeTeams','select','tq.TeamId','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','push','sequelize','toString','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','omit','userChatQueue:save','userChatQueue:remove','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','count','update','then','get','ChatQueues','UserProfileResource','stack','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','keys','filters','intersection'];(function(_0x3faedc,_0x1ae833){var _0x44fb12=function(_0x2a90b9){while(--_0x2a90b9){_0x3faedc['push'](_0x3faedc['shift']());}};_0x44fb12(++_0x1ae833);}(_0x422b,0x129));var _0xb422=function(_0x838158,_0x5cd02a){_0x838158=_0x838158-0x0;var _0x13e7e4=_0x422b[_0x838158];return _0x13e7e4;};'use strict';var BPromise=require(_0xb422('0x0'));var util=require(_0xb422('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xb422('0x2'));var qs=require(_0xb422('0x3'));var logger=require(_0xb422('0x4'))(_0xb422('0x5'));var config=require('../../config/environment');var db=require(_0xb422('0x6'))['db'];config['redis']=_['defaults'](config[_0xb422('0x7')],{'host':_0xb422('0x8'),'port':0x18eb});var socket=require(_0xb422('0x9'))(new Redis(config[_0xb422('0x7')]));require('./chatQueue.socket')[_0xb422('0xa')](socket);function respondWithStatusCode(_0x1f926b,_0x20834f){_0x20834f=_0x20834f||0xcc;return function(_0x3353a5){if(_0x3353a5){return _0x1f926b[_0xb422('0xb')](_0x20834f);}return _0x1f926b[_0xb422('0xc')](_0x20834f)[_0xb422('0xd')]();};}function respondWithResult(_0x57dc09,_0x379b7a){_0x379b7a=_0x379b7a||0xc8;return function(_0xe488df){if(_0xe488df){return _0x57dc09[_0xb422('0xc')](_0x379b7a)['json'](_0xe488df);}};}function respondWithFilteredResult(_0xd1acf8,_0x1dea8e){return function(_0x4c20d2){if(_0x4c20d2){var _0x47772e=typeof _0x1dea8e[_0xb422('0xe')]==='undefined'&&typeof _0x1dea8e[_0xb422('0xf')]==='undefined';var _0x2fead7=_0x4c20d2['count'];var _0x5b0a5a=_0x47772e?0x0:_0x1dea8e[_0xb422('0xe')];var _0x4b3d1d=_0x47772e?_0x4c20d2[_0xb422('0x10')]:_0x1dea8e[_0xb422('0xe')]+_0x1dea8e[_0xb422('0xf')];var _0x3d696f;if(_0x4b3d1d>=_0x2fead7){_0x4b3d1d=_0x2fead7;_0x3d696f=0xc8;}else{_0x3d696f=0xce;}_0xd1acf8['status'](_0x3d696f);return _0xd1acf8['set']('Content-Range',_0x5b0a5a+'-'+_0x4b3d1d+'/'+_0x2fead7)['json'](_0x4c20d2);}return null;};}function saveUpdates(_0x1b68c0){return function(_0x360387){if(_0x360387){return _0x360387[_0xb422('0x11')](_0x1b68c0)[_0xb422('0x12')](function(_0x239a34){return _0x239a34;});}return null;};}function removeEntity(_0x125b91){return function(_0x1a91ac){if(_0x1a91ac){return _0x1a91ac['destroy']()[_0xb422('0x12')](function(){var _0x179e0c=_0x1a91ac[_0xb422('0x13')]({'plain':!![]});var _0x5adde8=_0xb422('0x14');return db[_0xb422('0x15')]['destroy']({'where':{'type':_0x5adde8,'resourceId':_0x179e0c['id']}})[_0xb422('0x12')](function(){return _0x1a91ac;});})[_0xb422('0x12')](function(){_0x125b91[_0xb422('0xc')](0xcc)[_0xb422('0xd')]();});}};}function handleEntityNotFound(_0x235bc4){return function(_0x2032b5){if(!_0x2032b5){_0x235bc4['sendStatus'](0x194);}return _0x2032b5;};}function handleError(_0xffad6d,_0x23fce2){_0x23fce2=_0x23fce2||0x1f4;return function(_0x1d45d0){logger['error'](_0x1d45d0[_0xb422('0x16')]);if(_0x1d45d0['name']){delete _0x1d45d0['name'];}_0xffad6d[_0xb422('0xc')](_0x23fce2)[_0xb422('0x17')](_0x1d45d0);};}exports[_0xb422('0x18')]=function(_0x54e2ed,_0x5a3436){var _0x20618f={};var _0x2e1442={'count':0x0,'rows':[]};var _0x5a969c=_[_0xb422('0x19')](db[_0xb422('0x1a')][_0xb422('0x1b')],function(_0xf822cd){return{'name':_0xf822cd[_0xb422('0x1c')],'type':_0xf822cd[_0xb422('0x1d')][_0xb422('0x1e')]};});_0x20618f=qs[_0xb422('0x1f')](_0x5a969c,_0x54e2ed);var _0x4be21f={'where':_0x20618f[_0xb422('0x20')]};return db[_0xb422('0x1a')]['count'](_0x4be21f)[_0xb422('0x12')](function(_0x2ced6c){_0x2e1442[_0xb422('0x10')]=_0x2ced6c;_0x20618f[_0xb422('0x21')]=qs[_0xb422('0x21')](_0x54e2ed[_0xb422('0x22')]);return db[_0xb422('0x1a')]['findAll'](_0x20618f);})[_0xb422('0x12')](function(_0x569c75){_0x2e1442[_0xb422('0x23')]=_0x569c75;return _0x2e1442;})['then'](respondWithFilteredResult(_0x5a3436,_0x20618f))[_0xb422('0x24')](handleError(_0x5a3436,null));};exports[_0xb422('0x25')]=function(_0xd02cb2,_0x2fd77b){var _0x4e35bd={'raw':!![],'where':{'id':_0xd02cb2[_0xb422('0x26')]['id']}},_0x4931f7={};_0x4931f7['model']=_[_0xb422('0x27')](db[_0xb422('0x1a')][_0xb422('0x1b')]);_0x4931f7[_0xb422('0x22')]=_['keys'](_0xd02cb2[_0xb422('0x22')]);_0x4931f7[_0xb422('0x28')]=_[_0xb422('0x29')](_0x4931f7[_0xb422('0x2a')],_0x4931f7[_0xb422('0x22')]);_0x4e35bd['attributes']=_['intersection'](_0x4931f7[_0xb422('0x2a')],qs['fields'](_0xd02cb2['query'][_0xb422('0x2b')]));_0x4e35bd[_0xb422('0x2c')]=_0x4e35bd[_0xb422('0x2c')][_0xb422('0x2d')]?_0x4e35bd[_0xb422('0x2c')]:_0x4931f7[_0xb422('0x2a')];if(_0xd02cb2['query']['includeAll']){_0x4e35bd[_0xb422('0x21')]=[{'all':!![]}];}_0x4e35bd=_[_0xb422('0x2e')]({},_0x4e35bd,_0xd02cb2['options']);return db[_0xb422('0x1a')][_0xb422('0x2f')](_0x4e35bd)['then'](handleEntityNotFound(_0x2fd77b,null))['then'](respondWithResult(_0x2fd77b,null))[_0xb422('0x24')](handleError(_0x2fd77b,null));};exports[_0xb422('0x30')]=function(_0x11c57c,_0x38a8da){return db[_0xb422('0x1a')]['create'](_0x11c57c[_0xb422('0x31')],{})['then'](function(_0x58d685){var _0x40ba91=_0x11c57c[_0xb422('0x32')][_0xb422('0x13')]({'plain':!![]});if(!_0x40ba91)throw new Error(_0xb422('0x33'));if(_0x40ba91['role']===_0xb422('0x32')){var _0x16fe70=_0x58d685[_0xb422('0x13')]({'plain':!![]});var _0x16e6fb=_0xb422('0x14');return db[_0xb422('0x34')][_0xb422('0x2f')]({'where':{'name':_0x16e6fb,'userProfileId':_0x40ba91['userProfileId']},'raw':!![]})[_0xb422('0x12')](function(_0xe35604){if(_0xe35604&&_0xe35604['autoAssociation']===0x0){return db['UserProfileResource'][_0xb422('0x30')]({'name':_0x16fe70['name'],'resourceId':_0x16fe70['id'],'type':_0xe35604[_0xb422('0x35')],'sectionId':_0xe35604['id']},{})[_0xb422('0x12')](function(){return _0x58d685;});}else{return _0x58d685;}})[_0xb422('0x24')](function(_0x6090ce){logger['error'](_0xb422('0x36'),_0x6090ce);throw _0x6090ce;});}return _0x58d685;})['then'](respondWithResult(_0x38a8da,0xc9))[_0xb422('0x24')](handleError(_0x38a8da,null));};exports[_0xb422('0x11')]=function(_0x2e6ccd,_0x22824b){if(_0x2e6ccd[_0xb422('0x31')]['id']){delete _0x2e6ccd[_0xb422('0x31')]['id'];}return db['ChatQueue'][_0xb422('0x2f')]({'where':{'id':_0x2e6ccd['params']['id']}})['then'](handleEntityNotFound(_0x22824b,null))[_0xb422('0x12')](saveUpdates(_0x2e6ccd[_0xb422('0x31')],null))[_0xb422('0x12')](respondWithResult(_0x22824b,null))[_0xb422('0x24')](handleError(_0x22824b,null));};exports[_0xb422('0x37')]=function(_0x52c8c7,_0x3a50bf){return db[_0xb422('0x1a')][_0xb422('0x2f')]({'where':{'id':_0x52c8c7[_0xb422('0x26')]['id']}})[_0xb422('0x12')](handleEntityNotFound(_0x3a50bf,null))[_0xb422('0x12')](removeEntity(_0x3a50bf,null))['catch'](handleError(_0x3a50bf,null));};exports[_0xb422('0x38')]=function(_0x4438d1,_0x4b3ebe){return db[_0xb422('0x1a')]['describe']()[_0xb422('0x12')](respondWithResult(_0x4b3ebe,null))[_0xb422('0x24')](handleError(_0x4b3ebe,null));};exports[_0xb422('0x39')]=function(_0x34fbd3,_0x1b7ad8){var _0x41865a={'raw':!![],'where':{}},_0x347838={},_0x466042;return db[_0xb422('0x1a')][_0xb422('0x3a')]({'where':{'id':_0x34fbd3[_0xb422('0x26')]['id']}})['then'](handleEntityNotFound(_0x1b7ad8,null))[_0xb422('0x12')](function(_0x4e3c21){if(_0x4e3c21){_0x466042=_0x4e3c21[_0xb422('0x13')]({'plain':!![]});_0x347838[_0xb422('0x2a')]=_[_0xb422('0x27')](db['UserChatQueue']['rawAttributes']);_0x347838[_0xb422('0x22')]=_['keys'](_0x34fbd3['query']);_0x347838['filters']=_[_0xb422('0x29')](_0x347838[_0xb422('0x2a')],_0x347838[_0xb422('0x22')]);_0x41865a[_0xb422('0x2c')]=_[_0xb422('0x29')](_0x347838['model'],qs[_0xb422('0x2b')](_0x34fbd3[_0xb422('0x22')][_0xb422('0x2b')]));_0x41865a['attributes']=_0x41865a[_0xb422('0x2c')][_0xb422('0x2d')]?_0x41865a['attributes']:_0x347838[_0xb422('0x2a')];if(!_0x34fbd3[_0xb422('0x22')][_0xb422('0x3b')](_0xb422('0x3c'))){_0x41865a['limit']=qs[_0xb422('0xf')](_0x34fbd3['query']['limit']);_0x41865a[_0xb422('0xe')]=qs[_0xb422('0xe')](_0x34fbd3['query']['offset']);}_0x41865a[_0xb422('0x3d')]=qs['sort'](_0x34fbd3[_0xb422('0x22')][_0xb422('0x3e')]);_0x41865a[_0xb422('0x20')]=qs['filters'](_[_0xb422('0x3f')](_0x34fbd3[_0xb422('0x22')],_0x347838[_0xb422('0x28')]));_0x41865a[_0xb422('0x20')][_0xb422('0x40')]=_0x4e3c21['id'];if(_0x34fbd3['query'][_0xb422('0x41')]){_0x41865a[_0xb422('0x20')]=_[_0xb422('0x2e')](_0x41865a[_0xb422('0x20')],{'$or':_[_0xb422('0x19')](_0x41865a[_0xb422('0x2c')],function(_0x3a4ab2){var _0x817d00={};_0x817d00[_0x3a4ab2]={'$like':'%'+_0x34fbd3[_0xb422('0x22')]['filter']+'%'};return _0x817d00;})});}_0x41865a=_[_0xb422('0x2e')]({},_0x41865a,_0x34fbd3[_0xb422('0x42')]);return db[_0xb422('0x43')][_0xb422('0x44')](_0x41865a);}})[_0xb422('0x12')](function(_0x379528){if(_0x379528){return db[_0xb422('0x45')][_0xb422('0x46')]({'where':{'id':_[_0xb422('0x19')](_0x379528,'UserId'),'role':_0xb422('0x47')},'attributes':['id',_0xb422('0x35'),_0xb422('0x48'),_0xb422('0x49'),_0xb422('0x4a')]});}})[_0xb422('0x12')](function(_0x64011e){if(_0x64011e){return{'count':_0x64011e[_0xb422('0x10')],'rows':_[_0xb422('0x19')](_0x64011e[_0xb422('0x23')],function(_0x19a688){return{'membername':_0x19a688[_0xb422('0x35')],'UserId':_0x19a688['id'],'queue_name':_0x466042[_0xb422('0x35')],'ChatQueueId':_0x466042['id'],'interface':util[_0xb422('0x4b')](_0xb422('0x4c'),'SIP',_0x19a688[_0xb422('0x35')]),'penalty':0x0,'paused':_0x19a688[_0xb422('0x48')],'createdAt':_0x19a688[_0xb422('0x4a')],'updatedAt':_0x19a688[_0xb422('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb422('0x12')](respondWithFilteredResult(_0x1b7ad8,_0x41865a))[_0xb422('0x24')](handleError(_0x1b7ad8,null));};exports[_0xb422('0x4d')]=function(_0x4d00c1,_0x549a56){var _0x4df16c={};var _0x2d1a47={};var _0x19cca6;var _0xfe3d3d;return db[_0xb422('0x1a')][_0xb422('0x3a')]({'where':{'id':_0x4d00c1['params']['id']}})[_0xb422('0x12')](handleEntityNotFound(_0x549a56,null))['then'](function(_0x3c1a5f){if(_0x3c1a5f){_0x19cca6=_0x3c1a5f;_0x2d1a47[_0xb422('0x2a')]=_['keys'](db[_0xb422('0x4e')]['rawAttributes']);_0x2d1a47[_0xb422('0x22')]=_[_0xb422('0x27')](_0x4d00c1['query']);_0x2d1a47[_0xb422('0x28')]=_[_0xb422('0x29')](_0x2d1a47[_0xb422('0x2a')],_0x2d1a47['query']);_0x4df16c[_0xb422('0x2c')]=_[_0xb422('0x29')](_0x2d1a47[_0xb422('0x2a')],qs['fields'](_0x4d00c1[_0xb422('0x22')][_0xb422('0x2b')]));_0x4df16c[_0xb422('0x2c')]=_0x4df16c[_0xb422('0x2c')][_0xb422('0x2d')]?_0x4df16c[_0xb422('0x2c')]:_0x2d1a47[_0xb422('0x2a')];_0x4df16c[_0xb422('0x3d')]=qs[_0xb422('0x3e')](_0x4d00c1[_0xb422('0x22')]['sort']);_0x4df16c['where']=qs[_0xb422('0x28')](_[_0xb422('0x3f')](_0x4d00c1[_0xb422('0x22')],_0x2d1a47['filters']));if(_0x4d00c1[_0xb422('0x22')][_0xb422('0x41')]){_0x4df16c[_0xb422('0x20')]=_[_0xb422('0x2e')](_0x4df16c['where'],{'$or':_[_0xb422('0x19')](_0x4df16c[_0xb422('0x2c')],function(_0x36e040){var _0x441914={};_0x441914[_0x36e040]={'$like':'%'+_0x4d00c1[_0xb422('0x22')][_0xb422('0x41')]+'%'};return _0x441914;})});}_0x4df16c=_[_0xb422('0x2e')]({},_0x4df16c,_0x4d00c1[_0xb422('0x42')]);return _0x19cca6[_0xb422('0x4d')](_0x4df16c);}})[_0xb422('0x12')](function(_0x26f6cc){if(_0x26f6cc){_0xfe3d3d=_0x26f6cc[_0xb422('0x2d')];if(!_0x4d00c1[_0xb422('0x22')][_0xb422('0x3b')](_0xb422('0x3c'))){_0x4df16c['limit']=qs[_0xb422('0xf')](_0x4d00c1['query']['limit']);_0x4df16c[_0xb422('0xe')]=qs[_0xb422('0xe')](_0x4d00c1[_0xb422('0x22')][_0xb422('0xe')]);}return _0x19cca6[_0xb422('0x4d')](_0x4df16c);}})[_0xb422('0x12')](function(_0x1ce2c6){if(_0x1ce2c6){return _0x1ce2c6?{'count':_0xfe3d3d,'rows':_0x1ce2c6}:null;}})[_0xb422('0x12')](respondWithResult(_0x549a56,null))[_0xb422('0x24')](handleError(_0x549a56,null));};exports[_0xb422('0x4f')]=function(_0x151f34,_0x159831){var _0x4121fb=_0x151f34['body'][_0xb422('0x50')];return db[_0xb422('0x4e')][_0xb422('0x44')]({'where':{'id':_0x4121fb},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb422('0x35'),_0xb422('0x51'),'voicePause',_0xb422('0x52')],'raw':!![]}]})['then'](function(_0x17a2c8){if(_0x17a2c8){var _0x306e82=_['flatMap'](_0x17a2c8,function(_0x1eea1a){var _0x39b877=_0x1eea1a['get']({'plain':!![]});return _0x39b877[_0xb422('0x53')];});return db[_0xb422('0x1a')][_0xb422('0x2f')]({'where':{'id':_0x151f34[_0xb422('0x26')]['id']}})[_0xb422('0x12')](function(_0x2961e9){return db['sequelize']['transaction'](function(_0x556049){return _0x2961e9['addTeams'](_0x4121fb,{'transaction':_0x556049})[_0xb422('0x12')](function(){return BPromise[_0xb422('0x54')](_0x306e82,function(_0x1e7ca0){return db[_0xb422('0x43')][_0xb422('0x55')]({'where':{'UserId':_0x1e7ca0['id'],'ChatQueueId':_0x151f34['params']['id']},'transaction':_0x556049});});})[_0xb422('0x12')](function(){_0x306e82['forEach'](function(_0x366828){socket[_0xb422('0x56')]('userChatQueue:save',{'UserId':_0x366828['id'],'ChatQueueId':_0x2961e9['id']});});});});});}})[_0xb422('0x12')](respondWithStatusCode(_0x159831,null))[_0xb422('0x24')](handleError(_0x159831,null));};exports[_0xb422('0x57')]=function(_0x270581,_0x35a7e1){return db[_0xb422('0x4e')][_0xb422('0x44')]({'where':{'id':_0x270581[_0xb422('0x22')][_0xb422('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb422('0x53'),'attributes':['id'],'raw':!![]}]})[_0xb422('0x12')](handleEntityNotFound(_0x35a7e1,null))[_0xb422('0x12')](function(_0x5284af){var _0x1434cf=_[_0xb422('0x19')](_0x5284af,'id');var _0x1fd240=[];var _0x2d7244=[];var _0xb96db4=squel[_0xb422('0x58')]();_0xb96db4['field'](_0xb422('0x59'))['from'](_0xb422('0x5a'),'tq')[_0xb422('0x5b')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb422('0x20')](_0xb422('0x5c'),_0x270581[_0xb422('0x26')]['id']);for(var _0x53d1d1=0x0;_0x53d1d1<_0x5284af[_0xb422('0x2d')];_0x53d1d1+=0x1){let _0x30c743=_0x5284af[_0x53d1d1];for(var _0x318d63=0x0;_0x318d63<_0x30c743[_0xb422('0x53')]['length'];_0x318d63+=0x1){let _0x1ee1ab=_0x30c743['Agents'][_0x318d63];var _0x198e65=_0xb96db4[_0xb422('0x5d')]();_0x198e65[_0xb422('0x20')]('ut.UserId\x20=\x20?',_0x1ee1ab['id']);_0x2d7244[_0xb422('0x5e')](db[_0xb422('0x5f')]['query'](_0x198e65[_0xb422('0x60')](),{'type':db[_0xb422('0x5f')]['QueryTypes'][_0xb422('0x61')]})[_0xb422('0x12')](function(_0x2f1c95){if(_0x2f1c95[_0xb422('0x2d')]===0x1){return _0x1ee1ab['id'];}else{var _0x2eeefa=_[_0xb422('0x62')](_[_0xb422('0x19')](_0x2f1c95,'TeamId'),function(_0x5a87d4){return _[_0xb422('0x63')](_0x1434cf,_0x5a87d4);});if(_0x2eeefa){return _0x1ee1ab['id'];}}}));}}return BPromise[_0xb422('0x64')](_0x2d7244)['then'](function(_0x5550c9){_0x1fd240=_(_0x1fd240)[_0xb422('0x65')](_0x5550c9)[_0xb422('0x66')]()[_0xb422('0x67')]();return db[_0xb422('0x1a')][_0xb422('0x2f')]({'where':{'id':_0x270581[_0xb422('0x26')]['id']}})['then'](function(_0x428b0c){return db[_0xb422('0x5f')][_0xb422('0x68')](function(_0xa0c5b8){return _0x428b0c[_0xb422('0x57')](_0x270581[_0xb422('0x22')][_0xb422('0x50')],{'transaction':_0xa0c5b8})[_0xb422('0x12')](function(){if(!_[_0xb422('0x69')](_0x1fd240)){return _0x428b0c[_0xb422('0x6a')](_0x1fd240,{'transaction':_0xa0c5b8});}})[_0xb422('0x12')](function(){_0x1fd240[_0xb422('0x6b')](function(_0x551dd7){socket[_0xb422('0x56')]('userChatQueue:remove',{'UserId':_0x551dd7,'ChatQueueId':_0x428b0c['id']});});});});});});})[_0xb422('0x12')](respondWithStatusCode(_0x35a7e1,null))[_0xb422('0x24')](handleError(_0x35a7e1,null));};exports['addAgents']=function(_0x3a217e,_0x3cc295){return db[_0xb422('0x1a')][_0xb422('0x2f')]({'where':{'id':_0x3a217e[_0xb422('0x26')]['id']}})[_0xb422('0x12')](handleEntityNotFound(_0x3cc295,null))[_0xb422('0x12')](function(_0x3327ed){if(_0x3327ed){return _0x3327ed[_0xb422('0x6c')](_0x3a217e['body'][_0xb422('0x50')],_[_0xb422('0x6d')](_0x3a217e[_0xb422('0x31')],['ids','id'])||{})['spread'](function(_0x5758e4){for(var _0x44ede6=0x0;_0x44ede6<_0x3a217e[_0xb422('0x31')][_0xb422('0x50')][_0xb422('0x2d')];_0x44ede6+=0x1){socket[_0xb422('0x56')](_0xb422('0x6e'),{'UserId':Number(_0x3a217e[_0xb422('0x31')]['ids'][_0x44ede6]),'ChatQueueId':Number(_0x3a217e[_0xb422('0x26')]['id'])});}return _0x5758e4;});}})['then'](respondWithResult(_0x3cc295,null))[_0xb422('0x24')](handleError(_0x3cc295,null));};exports['removeAgents']=function(_0x5d1bb2,_0x40db3e){return db[_0xb422('0x1a')][_0xb422('0x2f')]({'where':{'id':_0x5d1bb2[_0xb422('0x26')]['id']}})['then'](handleEntityNotFound(_0x40db3e,null))[_0xb422('0x12')](function(_0xafff01){if(_0xafff01){return _0xafff01[_0xb422('0x6a')](_0x5d1bb2[_0xb422('0x22')][_0xb422('0x50')])[_0xb422('0x12')](function(){if(_['isArray'](_0x5d1bb2[_0xb422('0x22')][_0xb422('0x50')])){for(var _0x138ddd=0x0;_0x138ddd<_0x5d1bb2[_0xb422('0x22')][_0xb422('0x50')][_0xb422('0x2d')];_0x138ddd+=0x1){socket[_0xb422('0x56')](_0xb422('0x6f'),{'UserId':Number(_0x5d1bb2[_0xb422('0x22')][_0xb422('0x50')][_0x138ddd]),'ChatQueueId':Number(_0x5d1bb2[_0xb422('0x26')]['id'])});}}else{socket[_0xb422('0x56')](_0xb422('0x6f'),{'UserId':Number(_0x5d1bb2['query'][_0xb422('0x50')]),'ChatQueueId':Number(_0x5d1bb2[_0xb422('0x26')]['id'])});}});}})[_0xb422('0x12')](respondWithStatusCode(_0x40db3e,null))[_0xb422('0x24')](handleError(_0x40db3e,null));};exports[_0xb422('0x70')]=function(_0x123ea7,_0x58f81e){var _0x5d835b={};var _0x46915f={};var _0x27ecb5;var _0x4839ea;return db[_0xb422('0x1a')][_0xb422('0x3a')]({'where':{'id':_0x123ea7['params']['id']}})['then'](handleEntityNotFound(_0x58f81e,null))['then'](function(_0x132125){if(_0x132125){_0x27ecb5=_0x132125;_0x46915f['model']=_['keys'](db['User']['rawAttributes']);_0x46915f[_0xb422('0x22')]=_[_0xb422('0x27')](_0x123ea7[_0xb422('0x22')]);_0x46915f[_0xb422('0x28')]=_[_0xb422('0x29')](_0x46915f['model'],_0x46915f[_0xb422('0x22')]);_0x5d835b[_0xb422('0x2c')]=_[_0xb422('0x29')](_0x46915f[_0xb422('0x2a')],qs['fields'](_0x123ea7[_0xb422('0x22')][_0xb422('0x2b')]));_0x5d835b[_0xb422('0x2c')]=_0x5d835b[_0xb422('0x2c')]['length']?_0x5d835b[_0xb422('0x2c')]:_0x46915f[_0xb422('0x2a')];_0x5d835b[_0xb422('0x3d')]=qs[_0xb422('0x3e')](_0x123ea7[_0xb422('0x22')][_0xb422('0x3e')]);_0x5d835b[_0xb422('0x20')]=qs[_0xb422('0x28')](_[_0xb422('0x3f')](_0x123ea7['query'],_0x46915f[_0xb422('0x28')]));if(_0x123ea7[_0xb422('0x22')][_0xb422('0x41')]){_0x5d835b[_0xb422('0x20')]=_[_0xb422('0x2e')](_0x5d835b[_0xb422('0x20')],{'$or':_[_0xb422('0x19')](_0x5d835b[_0xb422('0x2c')],function(_0x4298c8){var _0x1ca6af={};_0x1ca6af[_0x4298c8]={'$like':'%'+_0x123ea7[_0xb422('0x22')][_0xb422('0x41')]+'%'};return _0x1ca6af;})});}_0x5d835b=_[_0xb422('0x2e')]({},_0x5d835b,_0x123ea7[_0xb422('0x42')]);return _0x27ecb5[_0xb422('0x70')](_0x5d835b);}})['then'](function(_0x7bd2c){if(_0x7bd2c){_0x4839ea=_0x7bd2c[_0xb422('0x2d')];if(!_0x123ea7['query'][_0xb422('0x3b')](_0xb422('0x3c'))){_0x5d835b[_0xb422('0xf')]=qs[_0xb422('0xf')](_0x123ea7[_0xb422('0x22')][_0xb422('0xf')]);_0x5d835b['offset']=qs['offset'](_0x123ea7['query']['offset']);}return _0x27ecb5['getAgents'](_0x5d835b);}})[_0xb422('0x12')](function(_0x2ed8bf){if(_0x2ed8bf){return _0x2ed8bf?{'count':_0x4839ea,'rows':_0x2ed8bf}:null;}})[_0xb422('0x12')](respondWithResult(_0x58f81e,null))[_0xb422('0x24')](handleError(_0x58f81e,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 41e3c4b..4dc6484 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 _0xfb44=['hook','events','../../mysqldb','ChatQueue','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x230ff5,_0x481570){var _0x26c86f=function(_0x2cd1ce){while(--_0x2cd1ce){_0x230ff5['push'](_0x230ff5['shift']());}};_0x26c86f(++_0x481570);}(_0xfb44,0xd9));var _0x4fb4=function(_0x430401,_0x365a51){_0x430401=_0x430401-0x0;var _0x16c4c0=_0xfb44[_0x430401];return _0x16c4c0;};'use strict';var EventEmitter=require(_0x4fb4('0x0'));var ChatQueue=require(_0x4fb4('0x1'))['db'][_0x4fb4('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4fb4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4fb4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d0ed9){return function(_0x5ddaf7,_0xcbc2d2,_0x530882){ChatQueueEvents['emit'](_0x3d0ed9+':'+_0x5ddaf7['id'],_0x5ddaf7);ChatQueueEvents[_0x4fb4('0x5')](_0x3d0ed9,_0x5ddaf7);_0x530882(null);};}for(var e in events){if(events[_0x4fb4('0x6')](e)){var event=events[e];ChatQueue[_0x4fb4('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5044=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5044,0xc8));var _0x4504=function(_0x16b8e6,_0xce24fe){_0x16b8e6=_0x16b8e6-0x0;var _0xf5bab2=_0x5044[_0x16b8e6];return _0xf5bab2;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x4504('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4504('0x1')](0x0);var events={'afterCreate':_0x4504('0x2'),'afterUpdate':_0x4504('0x3'),'afterDestroy':_0x4504('0x4')};function emitEvent(_0x254de4){return function(_0x3e3c2d,_0x19f90c,_0x12f408){ChatQueueEvents['emit'](_0x254de4+':'+_0x3e3c2d['id'],_0x3e3c2d);ChatQueueEvents[_0x4504('0x5')](_0x254de4,_0x3e3c2d);_0x12f408(null);};}for(var e in events){if(events[_0x4504('0x6')](e)){var event=events[e];ChatQueue[_0x4504('0x7')](e,emitEvent(event));}}module[_0x4504('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index f76e0a1..1e08632 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 _0x1fa5=['api','moment','bluebird','exports','define','ChatQueue','chat_queues','lodash','util'];(function(_0x3e318e,_0x16524e){var _0x5609c7=function(_0x2e8f02){while(--_0x2e8f02){_0x3e318e['push'](_0x3e318e['shift']());}};_0x5609c7(++_0x16524e);}(_0x1fa5,0xcd));var _0x51fa=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x1fa5[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x51fa('0x0'));var util=require(_0x51fa('0x1'));var logger=require('../../config/logger')(_0x51fa('0x2'));var moment=require(_0x51fa('0x3'));var BPromise=require(_0x51fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x51fa('0x5')]=function(_0xc16c2,_0x525b33){return _0xc16c2[_0x51fa('0x6')](_0x51fa('0x7'),attributes,{'tableName':_0x51fa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a01=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','chat_queues','util','../../config/logger','api','moment'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x3a01,0xa4));var _0x13a0=function(_0x1fd165,_0x3dd959){_0x1fd165=_0x1fd165-0x0;var _0x29c2b1=_0x3a01[_0x1fd165];return _0x29c2b1;};'use strict';var _=require('lodash');var util=require(_0x13a0('0x0'));var logger=require(_0x13a0('0x1'))(_0x13a0('0x2'));var moment=require(_0x13a0('0x3'));var BPromise=require(_0x13a0('0x4'));var rp=require(_0x13a0('0x5'));var fs=require('fs');var path=require(_0x13a0('0x6'));var rimraf=require(_0x13a0('0x7'));var config=require(_0x13a0('0x8'));var attributes=require(_0x13a0('0x9'));module[_0x13a0('0xa')]=function(_0x3ba6ad,_0x84e4a3){return _0x3ba6ad['define']('ChatQueue',attributes,{'tableName':_0x13a0('0xb'),'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 049b76c..8e135e4 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 _0x6aa4=['where','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','code','error','message','ChatQueue,\x20%s,\x20%s','result','catch','GetChatQueue','findAll','options','attributes','limit','include','map','model','debug','ShowChatQueue','find','raw'];(function(_0x505088,_0x23a321){var _0x3eb2c9=function(_0x2fcf8d){while(--_0x2fcf8d){_0x505088['push'](_0x505088['shift']());}};_0x3eb2c9(++_0x23a321);}(_0x6aa4,0xb2));var _0x46aa=function(_0x2a620a,_0x500067){_0x2a620a=_0x2a620a-0x0;var _0x4a17ea=_0x6aa4[_0x2a620a];return _0x4a17ea;};'use strict';var _=require(_0x46aa('0x0'));var util=require(_0x46aa('0x1'));var moment=require(_0x46aa('0x2'));var BPromise=require('bluebird');var rs=require(_0x46aa('0x3'));var fs=require('fs');var Redis=require(_0x46aa('0x4'));var db=require(_0x46aa('0x5'))['db'];var utils=require(_0x46aa('0x6'));var logger=require(_0x46aa('0x7'))(_0x46aa('0x8'));var config=require(_0x46aa('0x9'));var jayson=require(_0x46aa('0xa'));var client=jayson[_0x46aa('0xb')][_0x46aa('0xc')]({'port':0x232a});config[_0x46aa('0xd')]=_[_0x46aa('0xe')](config['redis'],{'host':_0x46aa('0xf'),'port':0x18eb});var socket=require(_0x46aa('0x10'))(new Redis(config[_0x46aa('0xd')]));require(_0x46aa('0x11'))[_0x46aa('0x12')](socket);function respondWithRpcPromise(_0x1b58ae,_0x55b104,_0x2886de){return new BPromise(function(_0x9a558e,_0x5a82d5){return client[_0x46aa('0x13')](_0x1b58ae,_0x2886de)[_0x46aa('0x14')](function(_0x253d3b){logger[_0x46aa('0x15')]('ChatQueue,\x20%s,\x20%s',_0x55b104,_0x46aa('0x16'));logger['debug'](_0x46aa('0x17'),_0x55b104,_0x46aa('0x16'),JSON['stringify'](_0x253d3b));if(_0x253d3b['error']){if(_0x253d3b['error'][_0x46aa('0x18')]===0x1f4){logger[_0x46aa('0x19')]('ChatQueue,\x20%s,\x20%s',_0x55b104,_0x253d3b[_0x46aa('0x19')][_0x46aa('0x1a')]);return _0x5a82d5(_0x253d3b[_0x46aa('0x19')][_0x46aa('0x1a')]);}logger[_0x46aa('0x19')](_0x46aa('0x1b'),_0x55b104,_0x253d3b[_0x46aa('0x19')][_0x46aa('0x1a')]);return _0x9a558e(_0x253d3b['error'][_0x46aa('0x1a')]);}else{logger['info'](_0x46aa('0x1b'),_0x55b104,_0x46aa('0x16'));_0x9a558e(_0x253d3b[_0x46aa('0x1c')][_0x46aa('0x1a')]);}})[_0x46aa('0x1d')](function(_0x1417ce){logger[_0x46aa('0x19')](_0x46aa('0x1b'),_0x55b104,_0x1417ce);_0x5a82d5(_0x1417ce);});});}exports[_0x46aa('0x1e')]=function(_0x476d78){var _0x27a370=this;return new Promise(function(_0x1bafa6,_0x547695){return db['ChatQueue'][_0x46aa('0x1f')]({'raw':_0x476d78[_0x46aa('0x20')]?_0x476d78[_0x46aa('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x476d78[_0x46aa('0x20')]?_0x476d78[_0x46aa('0x20')]['where']||null:null,'attributes':_0x476d78[_0x46aa('0x20')]?_0x476d78['options'][_0x46aa('0x21')]||null:null,'limit':_0x476d78[_0x46aa('0x20')]?_0x476d78[_0x46aa('0x20')][_0x46aa('0x22')]||null:null,'include':_0x476d78[_0x46aa('0x20')]?_0x476d78[_0x46aa('0x20')][_0x46aa('0x23')]?_[_0x46aa('0x24')](_0x476d78[_0x46aa('0x20')]['include'],function(_0x515dff){return{'model':db[_0x515dff['model']],'as':_0x515dff['as'],'attributes':_0x515dff[_0x46aa('0x21')],'include':_0x515dff['include']?_[_0x46aa('0x24')](_0x515dff[_0x46aa('0x23')],function(_0x5b213d){return{'model':db[_0x5b213d[_0x46aa('0x25')]],'as':_0x5b213d['as'],'attributes':_0x5b213d['attributes'],'include':_0x5b213d[_0x46aa('0x23')]?_[_0x46aa('0x24')](_0x5b213d['include'],function(_0xae5250){return{'model':db[_0xae5250[_0x46aa('0x25')]],'as':_0xae5250['as'],'attributes':_0xae5250['attributes']};}):[]};}):[]};}):[]:[]})[_0x46aa('0x14')](function(_0x3d3747){logger[_0x46aa('0x15')](_0x46aa('0x1e'),_0x476d78);logger[_0x46aa('0x26')](_0x46aa('0x1e'),_0x476d78,JSON['stringify'](_0x3d3747));_0x1bafa6(_0x3d3747);})['catch'](function(_0x452112){logger[_0x46aa('0x19')](_0x46aa('0x1e'),_0x452112[_0x46aa('0x1a')],_0x476d78);_0x547695(_0x27a370[_0x46aa('0x19')](0x1f4,_0x452112[_0x46aa('0x1a')]));});});};exports[_0x46aa('0x27')]=function(_0x262c4a){var _0x5f671f=this;return new Promise(function(_0x15d69f,_0x36a0fc){return db['ChatQueue'][_0x46aa('0x28')]({'raw':_0x262c4a[_0x46aa('0x20')]?_0x262c4a[_0x46aa('0x20')][_0x46aa('0x29')]===undefined?!![]:![]:!![],'where':_0x262c4a[_0x46aa('0x20')]?_0x262c4a['options'][_0x46aa('0x2a')]||null:null,'attributes':_0x262c4a[_0x46aa('0x20')]?_0x262c4a['options'][_0x46aa('0x21')]||null:null,'include':_0x262c4a[_0x46aa('0x20')]?_0x262c4a[_0x46aa('0x20')][_0x46aa('0x23')]?_[_0x46aa('0x24')](_0x262c4a[_0x46aa('0x20')]['include'],function(_0x585543){return{'model':db[_0x585543['model']],'as':_0x585543['as'],'attributes':_0x585543[_0x46aa('0x21')],'include':_0x585543[_0x46aa('0x23')]?_['map'](_0x585543['include'],function(_0x290317){return{'model':db[_0x290317[_0x46aa('0x25')]],'as':_0x290317['as'],'attributes':_0x290317[_0x46aa('0x21')],'include':_0x290317['include']?_[_0x46aa('0x24')](_0x290317[_0x46aa('0x23')],function(_0x6d73c6){return{'model':db[_0x6d73c6[_0x46aa('0x25')]],'as':_0x6d73c6['as'],'attributes':_0x6d73c6[_0x46aa('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46aa('0x14')](function(_0x2fb1fb){logger[_0x46aa('0x15')]('ShowChatQueue',_0x262c4a);logger['debug'](_0x46aa('0x27'),_0x262c4a,JSON[_0x46aa('0x2b')](_0x2fb1fb));_0x15d69f(_0x2fb1fb);})[_0x46aa('0x1d')](function(_0x163f66){logger['error'](_0x46aa('0x27'),_0x163f66[_0x46aa('0x1a')],_0x262c4a);_0x36a0fc(_0x5f671f[_0x46aa('0x19')](0x1f4,_0x163f66[_0x46aa('0x1a')]));});});}; \ No newline at end of file +var _0xe458=['rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowChatQueue','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5d9194,_0x1a08a1){var _0x520cec=function(_0x361777){while(--_0x361777){_0x5d9194['push'](_0x5d9194['shift']());}};_0x520cec(++_0x1a08a1);}(_0xe458,0x160));var _0x8e45=function(_0x12e54a,_0x4a1bc1){_0x12e54a=_0x12e54a-0x0;var _0x25a662=_0xe458[_0x12e54a];return _0x25a662;};'use strict';var _=require(_0x8e45('0x0'));var util=require(_0x8e45('0x1'));var moment=require('moment');var BPromise=require(_0x8e45('0x2'));var rs=require(_0x8e45('0x3'));var fs=require('fs');var Redis=require(_0x8e45('0x4'));var db=require(_0x8e45('0x5'))['db'];var utils=require(_0x8e45('0x6'));var logger=require(_0x8e45('0x7'))(_0x8e45('0x8'));var config=require(_0x8e45('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8e45('0xa')]({'port':0x232a});config[_0x8e45('0xb')]=_[_0x8e45('0xc')](config[_0x8e45('0xb')],{'host':_0x8e45('0xd'),'port':0x18eb});var socket=require(_0x8e45('0xe'))(new Redis(config[_0x8e45('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4a23d8,_0x5e442b,_0x17f5aa){return new BPromise(function(_0x342f7f,_0x3dabac){return client['request'](_0x4a23d8,_0x17f5aa)[_0x8e45('0xf')](function(_0x43372f){logger['info'](_0x8e45('0x10'),_0x5e442b,_0x8e45('0x11'));logger['debug'](_0x8e45('0x12'),_0x5e442b,_0x8e45('0x11'),JSON['stringify'](_0x43372f));if(_0x43372f[_0x8e45('0x13')]){if(_0x43372f[_0x8e45('0x13')][_0x8e45('0x14')]===0x1f4){logger['error'](_0x8e45('0x10'),_0x5e442b,_0x43372f[_0x8e45('0x13')][_0x8e45('0x15')]);return _0x3dabac(_0x43372f[_0x8e45('0x13')][_0x8e45('0x15')]);}logger[_0x8e45('0x13')](_0x8e45('0x10'),_0x5e442b,_0x43372f[_0x8e45('0x13')][_0x8e45('0x15')]);return _0x342f7f(_0x43372f[_0x8e45('0x13')][_0x8e45('0x15')]);}else{logger[_0x8e45('0x16')](_0x8e45('0x10'),_0x5e442b,_0x8e45('0x11'));_0x342f7f(_0x43372f[_0x8e45('0x17')][_0x8e45('0x15')]);}})[_0x8e45('0x18')](function(_0x4902dc){logger[_0x8e45('0x13')](_0x8e45('0x10'),_0x5e442b,_0x4902dc);_0x3dabac(_0x4902dc);});});}exports[_0x8e45('0x19')]=function(_0x4c6660){var _0x200adb=this;return new Promise(function(_0x4c3f52,_0x162856){return db[_0x8e45('0x1a')][_0x8e45('0x1b')]({'raw':_0x4c6660[_0x8e45('0x1c')]?_0x4c6660['options'][_0x8e45('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c6660['options']?_0x4c6660[_0x8e45('0x1c')][_0x8e45('0x1e')]||null:null,'attributes':_0x4c6660[_0x8e45('0x1c')]?_0x4c6660[_0x8e45('0x1c')][_0x8e45('0x1f')]||null:null,'limit':_0x4c6660[_0x8e45('0x1c')]?_0x4c6660[_0x8e45('0x1c')][_0x8e45('0x20')]||null:null,'include':_0x4c6660[_0x8e45('0x1c')]?_0x4c6660[_0x8e45('0x1c')][_0x8e45('0x21')]?_[_0x8e45('0x22')](_0x4c6660[_0x8e45('0x1c')]['include'],function(_0x312211){return{'model':db[_0x312211[_0x8e45('0x23')]],'as':_0x312211['as'],'attributes':_0x312211[_0x8e45('0x1f')],'include':_0x312211[_0x8e45('0x21')]?_[_0x8e45('0x22')](_0x312211[_0x8e45('0x21')],function(_0x20827b){return{'model':db[_0x20827b[_0x8e45('0x23')]],'as':_0x20827b['as'],'attributes':_0x20827b[_0x8e45('0x1f')],'include':_0x20827b['include']?_[_0x8e45('0x22')](_0x20827b['include'],function(_0xb0295d){return{'model':db[_0xb0295d[_0x8e45('0x23')]],'as':_0xb0295d['as'],'attributes':_0xb0295d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e45('0xf')](function(_0x46792a){logger[_0x8e45('0x16')](_0x8e45('0x19'),_0x4c6660);logger[_0x8e45('0x24')](_0x8e45('0x19'),_0x4c6660,JSON['stringify'](_0x46792a));_0x4c3f52(_0x46792a);})[_0x8e45('0x18')](function(_0x313d41){logger['error']('GetChatQueue',_0x313d41[_0x8e45('0x15')],_0x4c6660);_0x162856(_0x200adb['error'](0x1f4,_0x313d41['message']));});});};exports['ShowChatQueue']=function(_0x4a96c8){var _0x2714d0=this;return new Promise(function(_0x4f95cf,_0x2d1a3d){return db[_0x8e45('0x1a')][_0x8e45('0x25')]({'raw':_0x4a96c8[_0x8e45('0x1c')]?_0x4a96c8[_0x8e45('0x1c')][_0x8e45('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a96c8[_0x8e45('0x1c')]?_0x4a96c8[_0x8e45('0x1c')][_0x8e45('0x1e')]||null:null,'attributes':_0x4a96c8[_0x8e45('0x1c')]?_0x4a96c8[_0x8e45('0x1c')]['attributes']||null:null,'include':_0x4a96c8[_0x8e45('0x1c')]?_0x4a96c8[_0x8e45('0x1c')][_0x8e45('0x21')]?_['map'](_0x4a96c8[_0x8e45('0x1c')][_0x8e45('0x21')],function(_0x1fe872){return{'model':db[_0x1fe872[_0x8e45('0x23')]],'as':_0x1fe872['as'],'attributes':_0x1fe872[_0x8e45('0x1f')],'include':_0x1fe872[_0x8e45('0x21')]?_[_0x8e45('0x22')](_0x1fe872[_0x8e45('0x21')],function(_0x3f3be7){return{'model':db[_0x3f3be7['model']],'as':_0x3f3be7['as'],'attributes':_0x3f3be7['attributes'],'include':_0x3f3be7[_0x8e45('0x21')]?_[_0x8e45('0x22')](_0x3f3be7[_0x8e45('0x21')],function(_0x539e93){return{'model':db[_0x539e93['model']],'as':_0x539e93['as'],'attributes':_0x539e93[_0x8e45('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8e45('0xf')](function(_0x18c62f){logger[_0x8e45('0x16')](_0x8e45('0x26'),_0x4a96c8);logger[_0x8e45('0x24')](_0x8e45('0x26'),_0x4a96c8,JSON[_0x8e45('0x27')](_0x18c62f));_0x4f95cf(_0x18c62f);})[_0x8e45('0x18')](function(_0x218166){logger[_0x8e45('0x13')](_0x8e45('0x26'),_0x218166[_0x8e45('0x15')],_0x4a96c8);_0x2d1a3d(_0x2714d0[_0x8e45('0x13')](0x1f4,_0x218166[_0x8e45('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c2f40b2..7173946 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 _0x3e74=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','remove','update'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x3e74,0x175));var _0x43e7=function(_0x16d40d,_0x40d0ef){_0x16d40d=_0x16d40d-0x0;var _0x359df5=_0x3e74[_0x16d40d];return _0x359df5;};'use strict';var ChatQueueEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){ChatQueueEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);ChatQueueEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file +var _0xed1f=['register','length','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xed1f,0x6a));var _0xfed1=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xed1f[_0x5d6456];return _0x4d66c1;};'use strict';var ChatQueueEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),_0xfed1('0x2'),_0xfed1('0x3')];function createListener(_0xa45937,_0x25f345){return function(_0x1dd614){_0x25f345[_0xfed1('0x4')](_0xa45937,_0x1dd614);};}function removeListener(_0x2209b3,_0x45c3c1){return function(){ChatQueueEvents[_0xfed1('0x5')](_0x2209b3,_0x45c3c1);};}exports[_0xfed1('0x6')]=function(_0x3d6706){for(var _0x42751d=0x0,_0x380e18=events[_0xfed1('0x7')];_0x42751d<_0x380e18;_0x42751d++){var _0x2a6082=events[_0x42751d];var _0x2967ef=createListener('chatQueue:'+_0x2a6082,_0x3d6706);ChatQueueEvents['on'](_0x2a6082,_0x2967ef);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8023f15..7ec70b1 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x5e2ea4,_0x3977d7){var _0x170f56=function(_0x497cd1){while(--_0x497cd1){_0x5e2ea4['push'](_0x5e2ea4['shift']());}};_0x170f56(++_0x3977d7);}(_0x55ca,0x126));var _0xa55c=function(_0x234577,_0x3b9004){_0x234577=_0x234577-0x0;var _0x28fea6=_0x55ca[_0x234577];return _0x28fea6;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x122f7c,_0x23fd32){var _0xe17566=function(_0x5c4099){while(--_0x5c4099){_0x122f7c['push'](_0x122f7c['shift']());}};_0xe17566(++_0x23fd32);}(_0x814b,0x1a2));var _0xb814=function(_0x1e2671,_0x4cf90a){_0x1e2671=_0x1e2671-0x0;var _0x492489=_0x814b[_0x1e2671];return _0x492489;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c9eff04..1812592 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 _0x765e=['STRING','DATE','moment','sequelize','exports'];(function(_0x4523db,_0x3dcac5){var _0x481dd7=function(_0x322485){while(--_0x322485){_0x4523db['push'](_0x4523db['shift']());}};_0x481dd7(++_0x3dcac5);}(_0x765e,0x1bf));var _0xe765=function(_0x13a3f5,_0x278b0c){_0x13a3f5=_0x13a3f5-0x0;var _0x3437df=_0x765e[_0x13a3f5];return _0x3437df;};'use strict';var moment=require(_0xe765('0x0'));var Sequelize=require(_0xe765('0x1'));module[_0xe765('0x2')]={'uniqueid':{'type':Sequelize[_0xe765('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe765('0x3')]},'joinAt':{'type':Sequelize[_0xe765('0x4')]},'leaveAt':{'type':Sequelize[_0xe765('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe765('0x4')]},'reason':{'type':Sequelize[_0xe765('0x3')]}}; \ No newline at end of file +var _0x0d79=['STRING','DATE','moment','sequelize','exports'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x0d79,0x14c));var _0x90d7=function(_0x2cdf41,_0x4a277c){_0x2cdf41=_0x2cdf41-0x0;var _0x39a70e=_0x0d79[_0x2cdf41];return _0x39a70e;};'use strict';var moment=require(_0x90d7('0x0'));var Sequelize=require(_0x90d7('0x1'));module[_0x90d7('0x2')]={'uniqueid':{'type':Sequelize[_0x90d7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x90d7('0x3')]},'joinAt':{'type':Sequelize[_0x90d7('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x90d7('0x4')]},'exitAt':{'type':Sequelize[_0x90d7('0x4')]},'reason':{'type':Sequelize[_0x90d7('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index cf6bb0a..b6a87bf 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 _0xb7ac=['name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','error','stack'];(function(_0x443ee7,_0x3514c7){var _0x2d1fb7=function(_0x21ab1b){while(--_0x21ab1b){_0x443ee7['push'](_0x443ee7['shift']());}};_0x2d1fb7(++_0x3514c7);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x9d549c,_0x42b705){_0x9d549c=_0x9d549c-0x0;var _0x1e9fa2=_0xb7ac[_0x9d549c];return _0x1e9fa2;};'use strict';var emlformat=require(_0xcb7a('0x0'));var rimraf=require(_0xcb7a('0x1'));var zipdir=require(_0xcb7a('0x2'));var jsonpatch=require(_0xcb7a('0x3'));var rp=require(_0xcb7a('0x4'));var moment=require('moment');var BPromise=require(_0xcb7a('0x5'));var Mustache=require('mustache');var util=require(_0xcb7a('0x6'));var path=require(_0xcb7a('0x7'));var sox=require('sox');var csv=require(_0xcb7a('0x8'));var ejs=require(_0xcb7a('0x9'));var fs=require('fs');var fs_extra=require(_0xcb7a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcb7a('0xb'));var jsforce=require(_0xcb7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb7a('0x8'));var querystring=require(_0xcb7a('0xd'));var Papa=require(_0xcb7a('0xe'));var Redis=require(_0xcb7a('0xf'));var authService=require(_0xcb7a('0x10'));var qs=require(_0xcb7a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb7a('0x12'));var logger=require(_0xcb7a('0x13'))(_0xcb7a('0x14'));var utils=require('../../config/utils');var config=require(_0xcb7a('0x15'));var licenseUtil=require(_0xcb7a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x260f43,_0x3ec2fe){_0x3ec2fe=_0x3ec2fe||0xcc;return function(_0x29a931){if(_0x29a931){return _0x260f43[_0xcb7a('0x17')](_0x3ec2fe);}return _0x260f43[_0xcb7a('0x18')](_0x3ec2fe)[_0xcb7a('0x19')]();};}function respondWithResult(_0x37459c,_0x1050ca){_0x1050ca=_0x1050ca||0xc8;return function(_0x1669ed){if(_0x1669ed){return _0x37459c['status'](_0x1050ca)[_0xcb7a('0x1a')](_0x1669ed);}};}function respondWithFilteredResult(_0x54b0ce,_0x3b3851){return function(_0x38acef){if(_0x38acef){var _0x7f1071=typeof _0x3b3851[_0xcb7a('0x1b')]==='undefined'&&typeof _0x3b3851[_0xcb7a('0x1c')]===_0xcb7a('0x1d');var _0x28d09d=_0x38acef[_0xcb7a('0x1e')];var _0x118dde=_0x7f1071?0x0:_0x3b3851[_0xcb7a('0x1b')];var _0x119bb2=_0x7f1071?_0x38acef['count']:_0x3b3851[_0xcb7a('0x1b')]+_0x3b3851[_0xcb7a('0x1c')];var _0x1c6630;if(_0x119bb2>=_0x28d09d){_0x119bb2=_0x28d09d;_0x1c6630=0xc8;}else{_0x1c6630=0xce;}_0x54b0ce[_0xcb7a('0x18')](_0x1c6630);return _0x54b0ce['set']('Content-Range',_0x118dde+'-'+_0x119bb2+'/'+_0x28d09d)['json'](_0x38acef);}return null;};}function patchUpdates(_0x25a27e){return function(_0x54de2c){try{jsonpatch[_0xcb7a('0x1f')](_0x54de2c,_0x25a27e,!![]);}catch(_0x112d6e){return BPromise[_0xcb7a('0x20')](_0x112d6e);}return _0x54de2c[_0xcb7a('0x21')]();};}function saveUpdates(_0x45e54b,_0x26f4a4){return function(_0x18da58){if(_0x18da58){return _0x18da58[_0xcb7a('0x22')](_0x45e54b)[_0xcb7a('0x23')](function(_0x120bbc){return _0x120bbc;});}return null;};}function removeEntity(_0x63dd64,_0x5a29a7){return function(_0x5c9191){if(_0x5c9191){return _0x5c9191['destroy']()[_0xcb7a('0x23')](function(){_0x63dd64[_0xcb7a('0x18')](0xcc)[_0xcb7a('0x19')]();});}};}function handleEntityNotFound(_0x28682a,_0x4830ff){return function(_0x527ae8){if(!_0x527ae8){_0x28682a[_0xcb7a('0x17')](0x194);}return _0x527ae8;};}function handleError(_0x282350,_0x2c59d8){_0x2c59d8=_0x2c59d8||0x1f4;return function(_0x558c42){logger[_0xcb7a('0x24')](_0x558c42[_0xcb7a('0x25')]);if(_0x558c42['name']){delete _0x558c42[_0xcb7a('0x26')];}_0x282350[_0xcb7a('0x18')](_0x2c59d8)[_0xcb7a('0x27')](_0x558c42);};}exports[_0xcb7a('0x28')]=function(_0x4680ea,_0x5ba723){var _0x3aa77c={},_0x59c56a={},_0x291580={'count':0x0,'rows':[]};var _0x4ebadb=_['map'](db[_0xcb7a('0x29')][_0xcb7a('0x2a')],function(_0x38be8b){return{'name':_0x38be8b[_0xcb7a('0x2b')],'type':_0x38be8b[_0xcb7a('0x2c')]['key']};});_0x59c56a[_0xcb7a('0x2d')]=_[_0xcb7a('0x2e')](_0x4ebadb,_0xcb7a('0x26'));_0x59c56a[_0xcb7a('0x2f')]=_[_0xcb7a('0x30')](_0x4680ea[_0xcb7a('0x2f')]);_0x59c56a[_0xcb7a('0x31')]=_[_0xcb7a('0x32')](_0x59c56a[_0xcb7a('0x2d')],_0x59c56a[_0xcb7a('0x2f')]);_0x3aa77c[_0xcb7a('0x33')]=_[_0xcb7a('0x32')](_0x59c56a[_0xcb7a('0x2d')],qs['fields'](_0x4680ea[_0xcb7a('0x2f')]['fields']));_0x3aa77c[_0xcb7a('0x33')]=_0x3aa77c[_0xcb7a('0x33')][_0xcb7a('0x34')]?_0x3aa77c[_0xcb7a('0x33')]:_0x59c56a['model'];if(!_0x4680ea[_0xcb7a('0x2f')]['hasOwnProperty'](_0xcb7a('0x35'))){_0x3aa77c[_0xcb7a('0x1c')]=qs[_0xcb7a('0x1c')](_0x4680ea['query'][_0xcb7a('0x1c')]);_0x3aa77c[_0xcb7a('0x1b')]=qs['offset'](_0x4680ea[_0xcb7a('0x2f')][_0xcb7a('0x1b')]);}_0x3aa77c[_0xcb7a('0x36')]=qs[_0xcb7a('0x37')](_0x4680ea['query'][_0xcb7a('0x37')]);_0x3aa77c[_0xcb7a('0x38')]=qs[_0xcb7a('0x31')](_['pick'](_0x4680ea[_0xcb7a('0x2f')],_0x59c56a[_0xcb7a('0x31')]),_0x4ebadb);if(_0x4680ea[_0xcb7a('0x2f')][_0xcb7a('0x39')]){_0x3aa77c[_0xcb7a('0x38')]=_[_0xcb7a('0x3a')](_0x3aa77c['where'],{'$or':_[_0xcb7a('0x2e')](_0x4ebadb,function(_0x2d8d71){if(_0x2d8d71[_0xcb7a('0x2c')]!==_0xcb7a('0x3b')){var _0x4c4dfc={};_0x4c4dfc[_0x2d8d71[_0xcb7a('0x26')]]={'$like':'%'+_0x4680ea[_0xcb7a('0x2f')][_0xcb7a('0x39')]+'%'};return _0x4c4dfc;}})});}_0x3aa77c=_[_0xcb7a('0x3a')]({},_0x3aa77c,_0x4680ea[_0xcb7a('0x3c')]);var _0x52c756={'where':_0x3aa77c[_0xcb7a('0x38')]};return db[_0xcb7a('0x29')][_0xcb7a('0x1e')](_0x52c756)[_0xcb7a('0x23')](function(_0x25395b){_0x291580['count']=_0x25395b;if(_0x4680ea['query']['includeAll']){_0x3aa77c[_0xcb7a('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xcb7a('0x3e')](_0x3aa77c);})[_0xcb7a('0x23')](function(_0xe6b453){_0x291580['rows']=_0xe6b453;return _0x291580;})[_0xcb7a('0x23')](respondWithFilteredResult(_0x5ba723,_0x3aa77c))[_0xcb7a('0x3f')](handleError(_0x5ba723,null));};exports[_0xcb7a('0x40')]=function(_0xb33841,_0x5363a9){var _0x11e73d={'raw':!![],'where':{'id':_0xb33841[_0xcb7a('0x41')]['id']}},_0x318147={};_0x318147[_0xcb7a('0x2d')]=_['keys'](db[_0xcb7a('0x29')][_0xcb7a('0x2a')]);_0x318147['query']=_[_0xcb7a('0x30')](_0xb33841['query']);_0x318147[_0xcb7a('0x31')]=_['intersection'](_0x318147[_0xcb7a('0x2d')],_0x318147['query']);_0x11e73d['attributes']=_[_0xcb7a('0x32')](_0x318147[_0xcb7a('0x2d')],qs[_0xcb7a('0x42')](_0xb33841['query'][_0xcb7a('0x42')]));_0x11e73d[_0xcb7a('0x33')]=_0x11e73d[_0xcb7a('0x33')][_0xcb7a('0x34')]?_0x11e73d[_0xcb7a('0x33')]:_0x318147['model'];if(_0xb33841[_0xcb7a('0x2f')]['includeAll']){_0x11e73d[_0xcb7a('0x3d')]=[{'all':!![]}];}_0x11e73d=_[_0xcb7a('0x3a')]({},_0x11e73d,_0xb33841[_0xcb7a('0x3c')]);return db[_0xcb7a('0x29')][_0xcb7a('0x43')](_0x11e73d)[_0xcb7a('0x23')](handleEntityNotFound(_0x5363a9,null))[_0xcb7a('0x23')](respondWithResult(_0x5363a9,null))[_0xcb7a('0x3f')](handleError(_0x5363a9,null));};exports[_0xcb7a('0x44')]=function(_0x445d63,_0x3c1f9a){return db[_0xcb7a('0x29')][_0xcb7a('0x44')](_0x445d63[_0xcb7a('0x45')],{})[_0xcb7a('0x23')](respondWithResult(_0x3c1f9a,0xc9))[_0xcb7a('0x3f')](handleError(_0x3c1f9a,null));};exports['update']=function(_0x440c9e,_0xca7b9b){if(_0x440c9e[_0xcb7a('0x45')]['id']){delete _0x440c9e[_0xcb7a('0x45')]['id'];}return db[_0xcb7a('0x29')][_0xcb7a('0x43')]({'where':{'id':_0x440c9e[_0xcb7a('0x41')]['id']}})['then'](handleEntityNotFound(_0xca7b9b,null))[_0xcb7a('0x23')](saveUpdates(_0x440c9e[_0xcb7a('0x45')],null))[_0xcb7a('0x23')](respondWithResult(_0xca7b9b,null))[_0xcb7a('0x3f')](handleError(_0xca7b9b,null));};exports[_0xcb7a('0x46')]=function(_0x2ce33b,_0x147614){return db[_0xcb7a('0x29')][_0xcb7a('0x43')]({'where':{'id':_0x2ce33b[_0xcb7a('0x41')]['id']}})[_0xcb7a('0x23')](handleEntityNotFound(_0x147614,null))[_0xcb7a('0x23')](removeEntity(_0x147614,null))[_0xcb7a('0x3f')](handleError(_0x147614,null));};exports[_0xcb7a('0x47')]=function(_0x51a9d8,_0x3a93da){return db[_0xcb7a('0x29')]['describe']()[_0xcb7a('0x23')](respondWithResult(_0x3a93da,null))['catch'](handleError(_0x3a93da,null));}; \ No newline at end of file +var _0x84c6=['include','findAll','rows','params','rawAttributes','length','find','catch','create','body','update','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','json','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','end','sendStatus','name','send','index','map','ChatQueueReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x48e035,_0x44e806){var _0x5956f5=function(_0x18052a){while(--_0x18052a){_0x48e035['push'](_0x48e035['shift']());}};_0x5956f5(++_0x44e806);}(_0x84c6,0xe7));var _0x684c=function(_0x18e933,_0x48aae6){_0x18e933=_0x18e933-0x0;var _0x196c22=_0x84c6[_0x18e933];return _0x196c22;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x684c('0x0'));var jsonpatch=require(_0x684c('0x1'));var rp=require(_0x684c('0x2'));var moment=require('moment');var BPromise=require(_0x684c('0x3'));var Mustache=require('mustache');var util=require(_0x684c('0x4'));var path=require(_0x684c('0x5'));var sox=require(_0x684c('0x6'));var csv=require(_0x684c('0x7'));var ejs=require(_0x684c('0x8'));var fs=require('fs');var fs_extra=require(_0x684c('0x9'));var _=require(_0x684c('0xa'));var squel=require(_0x684c('0xb'));var crypto=require(_0x684c('0xc'));var jsforce=require(_0x684c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x684c('0x7'));var querystring=require(_0x684c('0xe'));var Papa=require('papaparse');var Redis=require(_0x684c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x684c('0x10'));var as=require(_0x684c('0x11'));var hardwareService=require(_0x684c('0x12'));var logger=require(_0x684c('0x13'))(_0x684c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x684c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a6a4,_0xd74811){_0xd74811=_0xd74811||0xcc;return function(_0x403e92){if(_0x403e92){return _0x15a6a4['sendStatus'](_0xd74811);}return _0x15a6a4[_0x684c('0x16')](_0xd74811)['end']();};}function respondWithResult(_0xd3c0bc,_0x21827e){_0x21827e=_0x21827e||0xc8;return function(_0x4e6a97){if(_0x4e6a97){return _0xd3c0bc[_0x684c('0x16')](_0x21827e)[_0x684c('0x17')](_0x4e6a97);}};}function respondWithFilteredResult(_0x1d4883,_0x3bee69){return function(_0x125c77){if(_0x125c77){var _0x319df7=typeof _0x3bee69['offset']===_0x684c('0x18')&&typeof _0x3bee69['limit']==='undefined';var _0xaae9f4=_0x125c77[_0x684c('0x19')];var _0x421404=_0x319df7?0x0:_0x3bee69[_0x684c('0x1a')];var _0x304099=_0x319df7?_0x125c77['count']:_0x3bee69[_0x684c('0x1a')]+_0x3bee69['limit'];var _0x527731;if(_0x304099>=_0xaae9f4){_0x304099=_0xaae9f4;_0x527731=0xc8;}else{_0x527731=0xce;}_0x1d4883[_0x684c('0x16')](_0x527731);return _0x1d4883['set'](_0x684c('0x1b'),_0x421404+'-'+_0x304099+'/'+_0xaae9f4)['json'](_0x125c77);}return null;};}function patchUpdates(_0xc159e7){return function(_0x330660){try{jsonpatch[_0x684c('0x1c')](_0x330660,_0xc159e7,!![]);}catch(_0x4cfeff){return BPromise[_0x684c('0x1d')](_0x4cfeff);}return _0x330660[_0x684c('0x1e')]();};}function saveUpdates(_0x143987,_0xa062fb){return function(_0x389f81){if(_0x389f81){return _0x389f81['update'](_0x143987)[_0x684c('0x1f')](function(_0x281592){return _0x281592;});}return null;};}function removeEntity(_0x24e2ab,_0x416912){return function(_0x33524a){if(_0x33524a){return _0x33524a[_0x684c('0x20')]()['then'](function(){_0x24e2ab[_0x684c('0x16')](0xcc)[_0x684c('0x21')]();});}};}function handleEntityNotFound(_0x1962a0,_0x3be964){return function(_0xddd459){if(!_0xddd459){_0x1962a0[_0x684c('0x22')](0x194);}return _0xddd459;};}function handleError(_0x6e0408,_0xe7294c){_0xe7294c=_0xe7294c||0x1f4;return function(_0xa2fbd9){logger['error'](_0xa2fbd9['stack']);if(_0xa2fbd9['name']){delete _0xa2fbd9[_0x684c('0x23')];}_0x6e0408[_0x684c('0x16')](_0xe7294c)[_0x684c('0x24')](_0xa2fbd9);};}exports[_0x684c('0x25')]=function(_0x5d8bf9,_0xb9435d){var _0x478eb1={},_0x63a41f={},_0x508289={'count':0x0,'rows':[]};var _0x41c406=_[_0x684c('0x26')](db[_0x684c('0x27')]['rawAttributes'],function(_0x2420d5){return{'name':_0x2420d5[_0x684c('0x28')],'type':_0x2420d5['type'][_0x684c('0x29')]};});_0x63a41f[_0x684c('0x2a')]=_[_0x684c('0x26')](_0x41c406,'name');_0x63a41f[_0x684c('0x2b')]=_[_0x684c('0x2c')](_0x5d8bf9[_0x684c('0x2b')]);_0x63a41f[_0x684c('0x2d')]=_['intersection'](_0x63a41f[_0x684c('0x2a')],_0x63a41f[_0x684c('0x2b')]);_0x478eb1[_0x684c('0x2e')]=_[_0x684c('0x2f')](_0x63a41f['model'],qs[_0x684c('0x30')](_0x5d8bf9['query'][_0x684c('0x30')]));_0x478eb1[_0x684c('0x2e')]=_0x478eb1[_0x684c('0x2e')]['length']?_0x478eb1[_0x684c('0x2e')]:_0x63a41f[_0x684c('0x2a')];if(!_0x5d8bf9[_0x684c('0x2b')][_0x684c('0x31')](_0x684c('0x32'))){_0x478eb1[_0x684c('0x33')]=qs[_0x684c('0x33')](_0x5d8bf9[_0x684c('0x2b')][_0x684c('0x33')]);_0x478eb1[_0x684c('0x1a')]=qs[_0x684c('0x1a')](_0x5d8bf9[_0x684c('0x2b')]['offset']);}_0x478eb1[_0x684c('0x34')]=qs['sort'](_0x5d8bf9[_0x684c('0x2b')]['sort']);_0x478eb1[_0x684c('0x35')]=qs['filters'](_[_0x684c('0x36')](_0x5d8bf9['query'],_0x63a41f[_0x684c('0x2d')]),_0x41c406);if(_0x5d8bf9['query'][_0x684c('0x37')]){_0x478eb1[_0x684c('0x35')]=_[_0x684c('0x38')](_0x478eb1[_0x684c('0x35')],{'$or':_[_0x684c('0x26')](_0x41c406,function(_0x221264){if(_0x221264[_0x684c('0x39')]!==_0x684c('0x3a')){var _0x166e67={};_0x166e67[_0x221264[_0x684c('0x23')]]={'$like':'%'+_0x5d8bf9['query'][_0x684c('0x37')]+'%'};return _0x166e67;}})});}_0x478eb1=_['merge']({},_0x478eb1,_0x5d8bf9[_0x684c('0x3b')]);var _0x13d545={'where':_0x478eb1['where']};return db['ChatQueueReport'][_0x684c('0x19')](_0x13d545)[_0x684c('0x1f')](function(_0x427501){_0x508289[_0x684c('0x19')]=_0x427501;if(_0x5d8bf9[_0x684c('0x2b')][_0x684c('0x3c')]){_0x478eb1[_0x684c('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x684c('0x3e')](_0x478eb1);})[_0x684c('0x1f')](function(_0x2a37b0){_0x508289[_0x684c('0x3f')]=_0x2a37b0;return _0x508289;})['then'](respondWithFilteredResult(_0xb9435d,_0x478eb1))['catch'](handleError(_0xb9435d,null));};exports['show']=function(_0x36c450,_0x39747d){var _0x3943a4={'raw':!![],'where':{'id':_0x36c450[_0x684c('0x40')]['id']}},_0x146994={};_0x146994['model']=_[_0x684c('0x2c')](db['ChatQueueReport'][_0x684c('0x41')]);_0x146994[_0x684c('0x2b')]=_['keys'](_0x36c450[_0x684c('0x2b')]);_0x146994[_0x684c('0x2d')]=_['intersection'](_0x146994['model'],_0x146994[_0x684c('0x2b')]);_0x3943a4[_0x684c('0x2e')]=_[_0x684c('0x2f')](_0x146994[_0x684c('0x2a')],qs['fields'](_0x36c450['query'][_0x684c('0x30')]));_0x3943a4['attributes']=_0x3943a4['attributes'][_0x684c('0x42')]?_0x3943a4[_0x684c('0x2e')]:_0x146994[_0x684c('0x2a')];if(_0x36c450[_0x684c('0x2b')][_0x684c('0x3c')]){_0x3943a4[_0x684c('0x3d')]=[{'all':!![]}];}_0x3943a4=_[_0x684c('0x38')]({},_0x3943a4,_0x36c450[_0x684c('0x3b')]);return db[_0x684c('0x27')][_0x684c('0x43')](_0x3943a4)[_0x684c('0x1f')](handleEntityNotFound(_0x39747d,null))['then'](respondWithResult(_0x39747d,null))[_0x684c('0x44')](handleError(_0x39747d,null));};exports[_0x684c('0x45')]=function(_0x3dfadd,_0x571694){return db['ChatQueueReport'][_0x684c('0x45')](_0x3dfadd[_0x684c('0x46')],{})[_0x684c('0x1f')](respondWithResult(_0x571694,0xc9))[_0x684c('0x44')](handleError(_0x571694,null));};exports[_0x684c('0x47')]=function(_0x3c51af,_0x548479){if(_0x3c51af[_0x684c('0x46')]['id']){delete _0x3c51af[_0x684c('0x46')]['id'];}return db['ChatQueueReport'][_0x684c('0x43')]({'where':{'id':_0x3c51af[_0x684c('0x40')]['id']}})['then'](handleEntityNotFound(_0x548479,null))[_0x684c('0x1f')](saveUpdates(_0x3c51af[_0x684c('0x46')],null))[_0x684c('0x1f')](respondWithResult(_0x548479,null))[_0x684c('0x44')](handleError(_0x548479,null));};exports[_0x684c('0x20')]=function(_0x3dda8f,_0x3e9b5c){return db['ChatQueueReport'][_0x684c('0x43')]({'where':{'id':_0x3dda8f[_0x684c('0x40')]['id']}})[_0x684c('0x1f')](handleEntityNotFound(_0x3e9b5c,null))[_0x684c('0x1f')](removeEntity(_0x3e9b5c,null))['catch'](handleError(_0x3e9b5c,null));};exports[_0x684c('0x48')]=function(_0x1c5729,_0x283186){return db[_0x684c('0x27')]['describe']()[_0x684c('0x1f')](respondWithResult(_0x283186,null))[_0x684c('0x44')](handleError(_0x283186,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 421ebb2..9835b0b 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x54c5db,_0x53dac8){var _0x3abaac=function(_0x1b58c0){while(--_0x1b58c0){_0x54c5db['push'](_0x54c5db['shift']());}};_0x3abaac(++_0x53dac8);}(_0xb7e7,0x121));var _0x7b7e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb7e7[_0xefd519];return _0x4bb882;};'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 +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x150961,_0x27c91d){var _0x31733c=function(_0x2aedaf){while(--_0x2aedaf){_0x150961['push'](_0x150961['shift']());}};_0x31733c(++_0x27c91d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index ee106ec..3724787 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 _0x353c=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','info','UpdateChatQueueReport','update','where','attributes','debug','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4a2365,_0x733b1f){var _0x188dc2=function(_0x2526b2){while(--_0x2526b2){_0x4a2365['push'](_0x4a2365['shift']());}};_0x188dc2(++_0x733b1f);}(_0x353c,0x153));var _0xc353=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x353c[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xc353('0x0'));var util=require('util');var moment=require(_0xc353('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc353('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc353('0x3'));var logger=require(_0xc353('0x4'))(_0xc353('0x5'));var config=require(_0xc353('0x6'));var jayson=require(_0xc353('0x7'));var client=jayson['client'][_0xc353('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4add4c,_0x5eea3e,_0x32d653){return new BPromise(function(_0x13e674,_0x1e241f){return client[_0xc353('0x9')](_0x4add4c,_0x32d653)[_0xc353('0xa')](function(_0x207795){logger['info'](_0xc353('0xb'),_0x5eea3e,_0xc353('0xc'));logger['debug'](_0xc353('0xd'),_0x5eea3e,'request\x20sent',JSON[_0xc353('0xe')](_0x207795));if(_0x207795[_0xc353('0xf')]){if(_0x207795['error'][_0xc353('0x10')]===0x1f4){logger[_0xc353('0xf')](_0xc353('0xb'),_0x5eea3e,_0x207795['error'][_0xc353('0x11')]);return _0x1e241f(_0x207795['error']['message']);}logger[_0xc353('0xf')](_0xc353('0xb'),_0x5eea3e,_0x207795[_0xc353('0xf')]['message']);return _0x13e674(_0x207795['error'][_0xc353('0x11')]);}else{logger['info'](_0xc353('0xb'),_0x5eea3e,_0xc353('0xc'));_0x13e674(_0x207795[_0xc353('0x12')][_0xc353('0x11')]);}})[_0xc353('0x13')](function(_0x3bba41){logger[_0xc353('0xf')](_0xc353('0xb'),_0x5eea3e,_0x3bba41);_0x1e241f(_0x3bba41);});});}exports[_0xc353('0x14')]=function(_0x18c144){var _0x466373=this;return new Promise(function(_0x511cb1,_0x27444){return db[_0xc353('0x15')][_0xc353('0x16')](_0x18c144[_0xc353('0x17')],{'raw':_0x18c144[_0xc353('0x18')]?_0x18c144[_0xc353('0x18')][_0xc353('0x19')]===undefined?!![]:![]:!![]})[_0xc353('0xa')](function(_0x1d6050){logger[_0xc353('0x1a')](_0xc353('0x14'),_0x18c144);logger['debug'](_0xc353('0x14'),_0x18c144,JSON[_0xc353('0xe')](_0x1d6050));_0x511cb1(_0x1d6050);})[_0xc353('0x13')](function(_0x32bda0){logger[_0xc353('0xf')](_0xc353('0x14'),_0x32bda0['message'],_0x18c144);_0x27444(_0x466373[_0xc353('0xf')](0x1f4,_0x32bda0[_0xc353('0x11')]));});});};exports[_0xc353('0x1b')]=function(_0x2ce6bc){var _0x20bd0d=this;return new Promise(function(_0x547ccb,_0x4d91f6){return db[_0xc353('0x15')][_0xc353('0x1c')](_0x2ce6bc[_0xc353('0x17')],{'raw':_0x2ce6bc['options']?_0x2ce6bc['options'][_0xc353('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ce6bc[_0xc353('0x18')]?_0x2ce6bc[_0xc353('0x18')][_0xc353('0x1d')]||null:null,'attributes':_0x2ce6bc['options']?_0x2ce6bc[_0xc353('0x18')][_0xc353('0x1e')]||null:null,'limit':_0x2ce6bc[_0xc353('0x18')]?_0x2ce6bc[_0xc353('0x18')]['limit']||null:null})['then'](function(_0x35777b){logger[_0xc353('0x1a')](_0xc353('0x1b'),_0x2ce6bc);logger[_0xc353('0x1f')](_0xc353('0x1b'),_0x2ce6bc,JSON['stringify'](_0x35777b));_0x547ccb(_0x35777b);})[_0xc353('0x13')](function(_0x5c2d3c){logger['error'](_0xc353('0x1b'),_0x5c2d3c[_0xc353('0x11')],_0x2ce6bc);_0x4d91f6(_0x20bd0d[_0xc353('0xf')](0x1f4,_0x5c2d3c[_0xc353('0x11')]));});});}; \ No newline at end of file +var _0x864b=['where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','update'];(function(_0x2c2c9d,_0x20788f){var _0x5af7e9=function(_0x57b071){while(--_0x57b071){_0x2c2c9d['push'](_0x2c2c9d['shift']());}};_0x5af7e9(++_0x20788f);}(_0x864b,0x179));var _0xb864=function(_0x2f57a1,_0x12a758){_0x2f57a1=_0x2f57a1-0x0;var _0x3641aa=_0x864b[_0x2f57a1];return _0x3641aa;};'use strict';var _=require(_0xb864('0x0'));var util=require(_0xb864('0x1'));var moment=require('moment');var BPromise=require(_0xb864('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb864('0x3'));var db=require(_0xb864('0x4'))['db'];var utils=require(_0xb864('0x5'));var logger=require(_0xb864('0x6'))(_0xb864('0x7'));var config=require(_0xb864('0x8'));var jayson=require(_0xb864('0x9'));var client=jayson['client'][_0xb864('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c06e4,_0x1ce4e9,_0x525999){return new BPromise(function(_0x2ae8a3,_0x460a36){return client[_0xb864('0xb')](_0x2c06e4,_0x525999)[_0xb864('0xc')](function(_0x362b82){logger[_0xb864('0xd')](_0xb864('0xe'),_0x1ce4e9,_0xb864('0xf'));logger['debug'](_0xb864('0x10'),_0x1ce4e9,_0xb864('0xf'),JSON[_0xb864('0x11')](_0x362b82));if(_0x362b82['error']){if(_0x362b82[_0xb864('0x12')][_0xb864('0x13')]===0x1f4){logger[_0xb864('0x12')](_0xb864('0xe'),_0x1ce4e9,_0x362b82[_0xb864('0x12')][_0xb864('0x14')]);return _0x460a36(_0x362b82[_0xb864('0x12')]['message']);}logger[_0xb864('0x12')](_0xb864('0xe'),_0x1ce4e9,_0x362b82[_0xb864('0x12')][_0xb864('0x14')]);return _0x2ae8a3(_0x362b82['error'][_0xb864('0x14')]);}else{logger[_0xb864('0xd')](_0xb864('0xe'),_0x1ce4e9,_0xb864('0xf'));_0x2ae8a3(_0x362b82['result'][_0xb864('0x14')]);}})[_0xb864('0x15')](function(_0x228d54){logger['error'](_0xb864('0xe'),_0x1ce4e9,_0x228d54);_0x460a36(_0x228d54);});});}exports[_0xb864('0x16')]=function(_0x3ffa5c){var _0x18f10f=this;return new Promise(function(_0x51bdeb,_0x181a47){return db[_0xb864('0x17')][_0xb864('0x18')](_0x3ffa5c[_0xb864('0x19')],{'raw':_0x3ffa5c[_0xb864('0x1a')]?_0x3ffa5c[_0xb864('0x1a')][_0xb864('0x1b')]===undefined?!![]:![]:!![]})[_0xb864('0xc')](function(_0x5e1f47){logger[_0xb864('0xd')]('CreateChatQueueReport',_0x3ffa5c);logger[_0xb864('0x1c')]('CreateChatQueueReport',_0x3ffa5c,JSON[_0xb864('0x11')](_0x5e1f47));_0x51bdeb(_0x5e1f47);})[_0xb864('0x15')](function(_0x2c4ae3){logger['error']('CreateChatQueueReport',_0x2c4ae3[_0xb864('0x14')],_0x3ffa5c);_0x181a47(_0x18f10f[_0xb864('0x12')](0x1f4,_0x2c4ae3[_0xb864('0x14')]));});});};exports[_0xb864('0x1d')]=function(_0x5f3e76){var _0x110f2b=this;return new Promise(function(_0xcf627d,_0x227f0c){return db[_0xb864('0x17')][_0xb864('0x1e')](_0x5f3e76[_0xb864('0x19')],{'raw':_0x5f3e76[_0xb864('0x1a')]?_0x5f3e76[_0xb864('0x1a')][_0xb864('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f3e76[_0xb864('0x1a')]?_0x5f3e76[_0xb864('0x1a')][_0xb864('0x1f')]||null:null,'attributes':_0x5f3e76[_0xb864('0x1a')]?_0x5f3e76[_0xb864('0x1a')][_0xb864('0x20')]||null:null,'limit':_0x5f3e76['options']?_0x5f3e76['options'][_0xb864('0x21')]||null:null})[_0xb864('0xc')](function(_0x1c70ce){logger[_0xb864('0xd')](_0xb864('0x1d'),_0x5f3e76);logger['debug'](_0xb864('0x1d'),_0x5f3e76,JSON[_0xb864('0x11')](_0x1c70ce));_0xcf627d(_0x1c70ce);})[_0xb864('0x15')](function(_0x568d92){logger['error'](_0xb864('0x1d'),_0x568d92[_0xb864('0x14')],_0x5f3e76);_0x227f0c(_0x110f2b[_0xb864('0x12')](0x1f4,_0x568d92['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d471d0d..5e444f9 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 _0x4322=['../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x4322,0x1b0));var _0x2432=function(_0x296a5c,_0x1eeca4){_0x296a5c=_0x296a5c-0x0;var _0x4fc3cb=_0x4322[_0x296a5c];return _0x4fc3cb;};'use strict';var multer=require(_0x2432('0x0'));var util=require(_0x2432('0x1'));var path=require(_0x2432('0x2'));var timeout=require(_0x2432('0x3'));var express=require(_0x2432('0x4'));var router=express[_0x2432('0x5')]();var fs_extra=require(_0x2432('0x6'));var auth=require(_0x2432('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2432('0x8'));var controller=require(_0x2432('0x9'));router[_0x2432('0xa')]('/',auth[_0x2432('0xb')](),controller[_0x2432('0xc')]);router[_0x2432('0xa')](_0x2432('0xd'),auth[_0x2432('0xb')](),controller[_0x2432('0xe')]);router[_0x2432('0xa')]('/:id',auth[_0x2432('0xb')](),controller[_0x2432('0xf')]);router[_0x2432('0x10')]('/',auth[_0x2432('0xb')](),controller[_0x2432('0x11')]);router['put'](_0x2432('0x12'),auth[_0x2432('0xb')](),controller['update']);router[_0x2432('0x13')](_0x2432('0x12'),auth[_0x2432('0xb')](),controller[_0x2432('0x14')]);module[_0x2432('0x15')]=router; \ No newline at end of file +var _0x6df5=['update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0x6df5,0x1b3));var _0x56df=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x6df5[_0x16de68];return _0x1c277e;};'use strict';var multer=require(_0x56df('0x0'));var util=require(_0x56df('0x1'));var path=require(_0x56df('0x2'));var timeout=require('connect-timeout');var express=require(_0x56df('0x3'));var router=express['Router']();var fs_extra=require(_0x56df('0x4'));var auth=require(_0x56df('0x5'));var interaction=require(_0x56df('0x6'));var config=require(_0x56df('0x7'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x56df('0x8')](),controller[_0x56df('0x9')]);router[_0x56df('0xa')]('/describe',auth[_0x56df('0x8')](),controller['describe']);router[_0x56df('0xa')](_0x56df('0xb'),auth[_0x56df('0x8')](),controller[_0x56df('0xc')]);router[_0x56df('0xd')]('/',auth[_0x56df('0x8')](),controller[_0x56df('0xe')]);router['put'](_0x56df('0xb'),auth['isAuthenticated'](),controller[_0x56df('0xf')]);router[_0x56df('0x10')](_0x56df('0xb'),auth[_0x56df('0x8')](),controller['destroy']);module[_0x56df('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 45206ce..9f14299 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x466c41,_0x37137c){var _0x1d991f=function(_0x1be8ae){while(--_0x1be8ae){_0x466c41['push'](_0x466c41['shift']());}};_0x1d991f(++_0x37137c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xf3cd[_0x361d3f];return _0x320229;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xddf047,_0x24e5cb){var _0x2280a0=function(_0x5deb4e){while(--_0x5deb4e){_0xddf047['push'](_0xddf047['shift']());}};_0x2280a0(++_0x24e5cb);}(_0xaa88,0x137));var _0x8aa8=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xaa88[_0x3c6dce];return _0x1450e9;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index adfc3d6..c4a8709 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 _0x68cc=['ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map'];(function(_0x2b01ad,_0x49c05e){var _0x42d954=function(_0x38c1a6){while(--_0x38c1a6){_0x2b01ad['push'](_0x2b01ad['shift']());}};_0x42d954(++_0x49c05e);}(_0x68cc,0x104));var _0xc68c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x68cc[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0xc68c('0x0'));var rimraf=require(_0xc68c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc68c('0x2'));var rp=require(_0xc68c('0x3'));var moment=require(_0xc68c('0x4'));var BPromise=require(_0xc68c('0x5'));var Mustache=require('mustache');var util=require(_0xc68c('0x6'));var path=require(_0xc68c('0x7'));var sox=require(_0xc68c('0x8'));var csv=require(_0xc68c('0x9'));var ejs=require(_0xc68c('0xa'));var fs=require('fs');var fs_extra=require(_0xc68c('0xb'));var _=require(_0xc68c('0xc'));var squel=require('squel');var crypto=require(_0xc68c('0xd'));var jsforce=require(_0xc68c('0xe'));var deskjs=require(_0xc68c('0xf'));var toCsv=require(_0xc68c('0x9'));var querystring=require(_0xc68c('0x10'));var Papa=require(_0xc68c('0x11'));var Redis=require(_0xc68c('0x12'));var authService=require(_0xc68c('0x13'));var qs=require(_0xc68c('0x14'));var as=require(_0xc68c('0x15'));var hardwareService=require(_0xc68c('0x16'));var logger=require(_0xc68c('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xc68c('0x18'));var licenseUtil=require(_0xc68c('0x19'));var db=require(_0xc68c('0x1a'))['db'];function respondWithStatusCode(_0x3bd02a,_0xdf8b6e){_0xdf8b6e=_0xdf8b6e||0xcc;return function(_0x45e085){if(_0x45e085){return _0x3bd02a[_0xc68c('0x1b')](_0xdf8b6e);}return _0x3bd02a[_0xc68c('0x1c')](_0xdf8b6e)['end']();};}function respondWithResult(_0x58016a,_0x3e652a){_0x3e652a=_0x3e652a||0xc8;return function(_0x23904a){if(_0x23904a){return _0x58016a[_0xc68c('0x1c')](_0x3e652a)[_0xc68c('0x1d')](_0x23904a);}};}function respondWithFilteredResult(_0x8b9f6e,_0x1b3773){return function(_0xacd708){if(_0xacd708){var _0x64119e=typeof _0x1b3773[_0xc68c('0x1e')]===_0xc68c('0x1f')&&typeof _0x1b3773[_0xc68c('0x20')]===_0xc68c('0x1f');var _0x39249a=_0xacd708[_0xc68c('0x21')];var _0x4df55a=_0x64119e?0x0:_0x1b3773[_0xc68c('0x1e')];var _0x343468=_0x64119e?_0xacd708[_0xc68c('0x21')]:_0x1b3773[_0xc68c('0x1e')]+_0x1b3773[_0xc68c('0x20')];var _0x3d6cbf;if(_0x343468>=_0x39249a){_0x343468=_0x39249a;_0x3d6cbf=0xc8;}else{_0x3d6cbf=0xce;}_0x8b9f6e[_0xc68c('0x1c')](_0x3d6cbf);return _0x8b9f6e['set'](_0xc68c('0x22'),_0x4df55a+'-'+_0x343468+'/'+_0x39249a)[_0xc68c('0x1d')](_0xacd708);}return null;};}function patchUpdates(_0xc7f628){return function(_0x5a151){try{jsonpatch[_0xc68c('0x23')](_0x5a151,_0xc7f628,!![]);}catch(_0x1a1b4f){return BPromise[_0xc68c('0x24')](_0x1a1b4f);}return _0x5a151[_0xc68c('0x25')]();};}function saveUpdates(_0xd371ff,_0x1b9314){return function(_0x584460){if(_0x584460){return _0x584460[_0xc68c('0x26')](_0xd371ff)[_0xc68c('0x27')](function(_0x31a80d){return _0x31a80d;});}return null;};}function removeEntity(_0x53aa43,_0x4aa090){return function(_0xd40343){if(_0xd40343){return _0xd40343[_0xc68c('0x28')]()['then'](function(){_0x53aa43[_0xc68c('0x1c')](0xcc)[_0xc68c('0x29')]();});}};}function handleEntityNotFound(_0x2c7e92,_0x2058ee){return function(_0x4cb68d){if(!_0x4cb68d){_0x2c7e92[_0xc68c('0x1b')](0x194);}return _0x4cb68d;};}function handleError(_0x469454,_0x31f6a6){_0x31f6a6=_0x31f6a6||0x1f4;return function(_0x4003c7){logger[_0xc68c('0x2a')](_0x4003c7[_0xc68c('0x2b')]);if(_0x4003c7[_0xc68c('0x2c')]){delete _0x4003c7[_0xc68c('0x2c')];}_0x469454['status'](_0x31f6a6)[_0xc68c('0x2d')](_0x4003c7);};}exports[_0xc68c('0x2e')]=function(_0x165907,_0x165106){var _0x18f674={},_0x21a5fb={},_0x3fb7a5={'count':0x0,'rows':[]};var _0x32c2ef=_[_0xc68c('0x2f')](db[_0xc68c('0x30')][_0xc68c('0x31')],function(_0x387d06){return{'name':_0x387d06[_0xc68c('0x32')],'type':_0x387d06[_0xc68c('0x33')]['key']};});_0x21a5fb[_0xc68c('0x34')]=_[_0xc68c('0x2f')](_0x32c2ef,_0xc68c('0x2c'));_0x21a5fb[_0xc68c('0x35')]=_[_0xc68c('0x36')](_0x165907[_0xc68c('0x35')]);_0x21a5fb[_0xc68c('0x37')]=_['intersection'](_0x21a5fb[_0xc68c('0x34')],_0x21a5fb[_0xc68c('0x35')]);_0x18f674['attributes']=_[_0xc68c('0x38')](_0x21a5fb[_0xc68c('0x34')],qs[_0xc68c('0x39')](_0x165907[_0xc68c('0x35')]['fields']));_0x18f674['attributes']=_0x18f674[_0xc68c('0x3a')][_0xc68c('0x3b')]?_0x18f674[_0xc68c('0x3a')]:_0x21a5fb[_0xc68c('0x34')];if(!_0x165907[_0xc68c('0x35')][_0xc68c('0x3c')](_0xc68c('0x3d'))){_0x18f674[_0xc68c('0x20')]=qs[_0xc68c('0x20')](_0x165907[_0xc68c('0x35')]['limit']);_0x18f674[_0xc68c('0x1e')]=qs['offset'](_0x165907[_0xc68c('0x35')][_0xc68c('0x1e')]);}_0x18f674['order']=qs['sort'](_0x165907[_0xc68c('0x35')][_0xc68c('0x3e')]);_0x18f674[_0xc68c('0x3f')]=qs['filters'](_['pick'](_0x165907[_0xc68c('0x35')],_0x21a5fb[_0xc68c('0x37')]),_0x32c2ef);if(_0x165907[_0xc68c('0x35')][_0xc68c('0x40')]){_0x18f674[_0xc68c('0x3f')]=_[_0xc68c('0x41')](_0x18f674[_0xc68c('0x3f')],{'$or':_[_0xc68c('0x2f')](_0x32c2ef,function(_0x3fd6aa){if(_0x3fd6aa['type']!=='VIRTUAL'){var _0x518b75={};_0x518b75[_0x3fd6aa[_0xc68c('0x2c')]]={'$like':'%'+_0x165907[_0xc68c('0x35')][_0xc68c('0x40')]+'%'};return _0x518b75;}})});}_0x18f674=_[_0xc68c('0x41')]({},_0x18f674,_0x165907[_0xc68c('0x42')]);var _0x3f092c={'where':_0x18f674[_0xc68c('0x3f')]};return db[_0xc68c('0x30')][_0xc68c('0x21')](_0x3f092c)[_0xc68c('0x27')](function(_0x5de054){_0x3fb7a5[_0xc68c('0x21')]=_0x5de054;if(_0x165907[_0xc68c('0x35')][_0xc68c('0x43')]){_0x18f674['include']=[{'all':!![]}];}return db[_0xc68c('0x30')][_0xc68c('0x44')](_0x18f674);})['then'](function(_0x5f2277){_0x3fb7a5[_0xc68c('0x45')]=_0x5f2277;return _0x3fb7a5;})['then'](respondWithFilteredResult(_0x165106,_0x18f674))[_0xc68c('0x46')](handleError(_0x165106,null));};exports[_0xc68c('0x47')]=function(_0x2aff19,_0x4d32fc){var _0x3106b1={'raw':!![],'where':{'id':_0x2aff19[_0xc68c('0x48')]['id']}},_0x7ba362={};_0x7ba362[_0xc68c('0x34')]=_[_0xc68c('0x36')](db[_0xc68c('0x30')]['rawAttributes']);_0x7ba362[_0xc68c('0x35')]=_[_0xc68c('0x36')](_0x2aff19[_0xc68c('0x35')]);_0x7ba362[_0xc68c('0x37')]=_[_0xc68c('0x38')](_0x7ba362[_0xc68c('0x34')],_0x7ba362[_0xc68c('0x35')]);_0x3106b1[_0xc68c('0x3a')]=_[_0xc68c('0x38')](_0x7ba362[_0xc68c('0x34')],qs[_0xc68c('0x39')](_0x2aff19[_0xc68c('0x35')][_0xc68c('0x39')]));_0x3106b1['attributes']=_0x3106b1[_0xc68c('0x3a')]['length']?_0x3106b1[_0xc68c('0x3a')]:_0x7ba362[_0xc68c('0x34')];if(_0x2aff19[_0xc68c('0x35')][_0xc68c('0x43')]){_0x3106b1[_0xc68c('0x49')]=[{'all':!![]}];}_0x3106b1=_['merge']({},_0x3106b1,_0x2aff19[_0xc68c('0x42')]);return db['ChatTransferReport'][_0xc68c('0x4a')](_0x3106b1)[_0xc68c('0x27')](handleEntityNotFound(_0x4d32fc,null))[_0xc68c('0x27')](respondWithResult(_0x4d32fc,null))['catch'](handleError(_0x4d32fc,null));};exports['create']=function(_0x1db3b7,_0x385d8f){return db['ChatTransferReport']['create'](_0x1db3b7[_0xc68c('0x4b')],{})[_0xc68c('0x27')](respondWithResult(_0x385d8f,0xc9))[_0xc68c('0x46')](handleError(_0x385d8f,null));};exports[_0xc68c('0x26')]=function(_0x1597c8,_0x43e093){if(_0x1597c8[_0xc68c('0x4b')]['id']){delete _0x1597c8[_0xc68c('0x4b')]['id'];}return db[_0xc68c('0x30')][_0xc68c('0x4a')]({'where':{'id':_0x1597c8[_0xc68c('0x48')]['id']}})['then'](handleEntityNotFound(_0x43e093,null))[_0xc68c('0x27')](saveUpdates(_0x1597c8['body'],null))[_0xc68c('0x27')](respondWithResult(_0x43e093,null))[_0xc68c('0x46')](handleError(_0x43e093,null));};exports[_0xc68c('0x28')]=function(_0x5d1d86,_0x211c2e){return db[_0xc68c('0x30')][_0xc68c('0x4a')]({'where':{'id':_0x5d1d86['params']['id']}})['then'](handleEntityNotFound(_0x211c2e,null))['then'](removeEntity(_0x211c2e,null))[_0xc68c('0x46')](handleError(_0x211c2e,null));};exports[_0xc68c('0x4c')]=function(_0x2c1c30,_0x1d5ca4){return db['ChatTransferReport'][_0xc68c('0x4c')]()[_0xc68c('0x27')](respondWithResult(_0x1d5ca4,null))[_0xc68c('0x46')](handleError(_0x1d5ca4,null));}; \ No newline at end of file +var _0x75f3=['find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update','destroy','then','error','name','send','index','ChatTransferReport','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','options'];(function(_0x1425e8,_0x2c195b){var _0x1cd239=function(_0x404246){while(--_0x404246){_0x1425e8['push'](_0x1425e8['shift']());}};_0x1cd239(++_0x2c195b);}(_0x75f3,0x125));var _0x375f=function(_0x5ce8e4,_0x20b026){_0x5ce8e4=_0x5ce8e4-0x0;var _0x549a21=_0x75f3[_0x5ce8e4];return _0x549a21;};'use strict';var emlformat=require(_0x375f('0x0'));var rimraf=require(_0x375f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x375f('0x2'));var rp=require(_0x375f('0x3'));var moment=require(_0x375f('0x4'));var BPromise=require(_0x375f('0x5'));var Mustache=require(_0x375f('0x6'));var util=require(_0x375f('0x7'));var path=require(_0x375f('0x8'));var sox=require('sox');var csv=require(_0x375f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x375f('0xa'));var _=require(_0x375f('0xb'));var squel=require('squel');var crypto=require(_0x375f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x375f('0xd'));var toCsv=require(_0x375f('0x9'));var querystring=require(_0x375f('0xe'));var Papa=require('papaparse');var Redis=require(_0x375f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x375f('0x10'));var hardwareService=require(_0x375f('0x11'));var logger=require(_0x375f('0x12'))(_0x375f('0x13'));var utils=require('../../config/utils');var config=require(_0x375f('0x14'));var licenseUtil=require(_0x375f('0x15'));var db=require(_0x375f('0x16'))['db'];function respondWithStatusCode(_0x5e025c,_0x2a81d0){_0x2a81d0=_0x2a81d0||0xcc;return function(_0x4113c3){if(_0x4113c3){return _0x5e025c[_0x375f('0x17')](_0x2a81d0);}return _0x5e025c[_0x375f('0x18')](_0x2a81d0)[_0x375f('0x19')]();};}function respondWithResult(_0x43f4a1,_0x2edd4c){_0x2edd4c=_0x2edd4c||0xc8;return function(_0x285720){if(_0x285720){return _0x43f4a1[_0x375f('0x18')](_0x2edd4c)[_0x375f('0x1a')](_0x285720);}};}function respondWithFilteredResult(_0xe11e65,_0x57c6ba){return function(_0x56f9a8){if(_0x56f9a8){var _0x3b073f=typeof _0x57c6ba['offset']===_0x375f('0x1b')&&typeof _0x57c6ba[_0x375f('0x1c')]===_0x375f('0x1b');var _0x1c7f74=_0x56f9a8['count'];var _0x48b7a1=_0x3b073f?0x0:_0x57c6ba[_0x375f('0x1d')];var _0x35afd8=_0x3b073f?_0x56f9a8[_0x375f('0x1e')]:_0x57c6ba[_0x375f('0x1d')]+_0x57c6ba[_0x375f('0x1c')];var _0x21089c;if(_0x35afd8>=_0x1c7f74){_0x35afd8=_0x1c7f74;_0x21089c=0xc8;}else{_0x21089c=0xce;}_0xe11e65[_0x375f('0x18')](_0x21089c);return _0xe11e65[_0x375f('0x1f')](_0x375f('0x20'),_0x48b7a1+'-'+_0x35afd8+'/'+_0x1c7f74)[_0x375f('0x1a')](_0x56f9a8);}return null;};}function patchUpdates(_0x21260c){return function(_0x302138){try{jsonpatch['apply'](_0x302138,_0x21260c,!![]);}catch(_0x1a66a8){return BPromise[_0x375f('0x21')](_0x1a66a8);}return _0x302138['save']();};}function saveUpdates(_0x3e0512,_0x48dd51){return function(_0x181d15){if(_0x181d15){return _0x181d15[_0x375f('0x22')](_0x3e0512)['then'](function(_0x1c24a9){return _0x1c24a9;});}return null;};}function removeEntity(_0x5266a5,_0x4c3e8b){return function(_0x44df99){if(_0x44df99){return _0x44df99[_0x375f('0x23')]()[_0x375f('0x24')](function(){_0x5266a5[_0x375f('0x18')](0xcc)[_0x375f('0x19')]();});}};}function handleEntityNotFound(_0x50fc79,_0x396515){return function(_0x78d775){if(!_0x78d775){_0x50fc79['sendStatus'](0x194);}return _0x78d775;};}function handleError(_0xab812f,_0xfb4436){_0xfb4436=_0xfb4436||0x1f4;return function(_0x1d678e){logger[_0x375f('0x25')](_0x1d678e['stack']);if(_0x1d678e['name']){delete _0x1d678e[_0x375f('0x26')];}_0xab812f[_0x375f('0x18')](_0xfb4436)[_0x375f('0x27')](_0x1d678e);};}exports[_0x375f('0x28')]=function(_0x97633,_0x587182){var _0x4b760d={},_0x25ae5d={},_0x3ba218={'count':0x0,'rows':[]};var _0x1f5ff8=_['map'](db[_0x375f('0x29')][_0x375f('0x2a')],function(_0x28770f){return{'name':_0x28770f['fieldName'],'type':_0x28770f[_0x375f('0x2b')][_0x375f('0x2c')]};});_0x25ae5d[_0x375f('0x2d')]=_[_0x375f('0x2e')](_0x1f5ff8,_0x375f('0x26'));_0x25ae5d['query']=_[_0x375f('0x2f')](_0x97633[_0x375f('0x30')]);_0x25ae5d['filters']=_[_0x375f('0x31')](_0x25ae5d[_0x375f('0x2d')],_0x25ae5d['query']);_0x4b760d[_0x375f('0x32')]=_[_0x375f('0x31')](_0x25ae5d[_0x375f('0x2d')],qs[_0x375f('0x33')](_0x97633['query'][_0x375f('0x33')]));_0x4b760d[_0x375f('0x32')]=_0x4b760d[_0x375f('0x32')][_0x375f('0x34')]?_0x4b760d[_0x375f('0x32')]:_0x25ae5d[_0x375f('0x2d')];if(!_0x97633[_0x375f('0x30')][_0x375f('0x35')]('nolimit')){_0x4b760d['limit']=qs[_0x375f('0x1c')](_0x97633[_0x375f('0x30')][_0x375f('0x1c')]);_0x4b760d[_0x375f('0x1d')]=qs[_0x375f('0x1d')](_0x97633[_0x375f('0x30')][_0x375f('0x1d')]);}_0x4b760d[_0x375f('0x36')]=qs['sort'](_0x97633[_0x375f('0x30')]['sort']);_0x4b760d[_0x375f('0x37')]=qs[_0x375f('0x38')](_[_0x375f('0x39')](_0x97633['query'],_0x25ae5d[_0x375f('0x38')]),_0x1f5ff8);if(_0x97633[_0x375f('0x30')]['filter']){_0x4b760d['where']=_['merge'](_0x4b760d[_0x375f('0x37')],{'$or':_['map'](_0x1f5ff8,function(_0x281e9b){if(_0x281e9b[_0x375f('0x2b')]!==_0x375f('0x3a')){var _0x4e5fe3={};_0x4e5fe3[_0x281e9b['name']]={'$like':'%'+_0x97633[_0x375f('0x30')][_0x375f('0x3b')]+'%'};return _0x4e5fe3;}})});}_0x4b760d=_[_0x375f('0x3c')]({},_0x4b760d,_0x97633['options']);var _0x132021={'where':_0x4b760d['where']};return db['ChatTransferReport'][_0x375f('0x1e')](_0x132021)[_0x375f('0x24')](function(_0x27ef90){_0x3ba218[_0x375f('0x1e')]=_0x27ef90;if(_0x97633['query'][_0x375f('0x3d')]){_0x4b760d[_0x375f('0x3e')]=[{'all':!![]}];}return db[_0x375f('0x29')][_0x375f('0x3f')](_0x4b760d);})['then'](function(_0x363267){_0x3ba218['rows']=_0x363267;return _0x3ba218;})[_0x375f('0x24')](respondWithFilteredResult(_0x587182,_0x4b760d))[_0x375f('0x40')](handleError(_0x587182,null));};exports[_0x375f('0x41')]=function(_0x323327,_0x2fb7a2){var _0x1c4b4b={'raw':!![],'where':{'id':_0x323327['params']['id']}},_0x357629={};_0x357629[_0x375f('0x2d')]=_[_0x375f('0x2f')](db[_0x375f('0x29')][_0x375f('0x2a')]);_0x357629[_0x375f('0x30')]=_[_0x375f('0x2f')](_0x323327[_0x375f('0x30')]);_0x357629[_0x375f('0x38')]=_[_0x375f('0x31')](_0x357629[_0x375f('0x2d')],_0x357629[_0x375f('0x30')]);_0x1c4b4b[_0x375f('0x32')]=_[_0x375f('0x31')](_0x357629[_0x375f('0x2d')],qs[_0x375f('0x33')](_0x323327['query'][_0x375f('0x33')]));_0x1c4b4b[_0x375f('0x32')]=_0x1c4b4b['attributes'][_0x375f('0x34')]?_0x1c4b4b['attributes']:_0x357629[_0x375f('0x2d')];if(_0x323327[_0x375f('0x30')][_0x375f('0x3d')]){_0x1c4b4b[_0x375f('0x3e')]=[{'all':!![]}];}_0x1c4b4b=_['merge']({},_0x1c4b4b,_0x323327[_0x375f('0x42')]);return db[_0x375f('0x29')][_0x375f('0x43')](_0x1c4b4b)[_0x375f('0x24')](handleEntityNotFound(_0x2fb7a2,null))['then'](respondWithResult(_0x2fb7a2,null))[_0x375f('0x40')](handleError(_0x2fb7a2,null));};exports[_0x375f('0x44')]=function(_0x1ddfb4,_0x1cabbc){return db[_0x375f('0x29')][_0x375f('0x44')](_0x1ddfb4[_0x375f('0x45')],{})[_0x375f('0x24')](respondWithResult(_0x1cabbc,0xc9))[_0x375f('0x40')](handleError(_0x1cabbc,null));};exports['update']=function(_0x43bca0,_0x84471e){if(_0x43bca0[_0x375f('0x45')]['id']){delete _0x43bca0['body']['id'];}return db[_0x375f('0x29')][_0x375f('0x43')]({'where':{'id':_0x43bca0[_0x375f('0x46')]['id']}})['then'](handleEntityNotFound(_0x84471e,null))['then'](saveUpdates(_0x43bca0[_0x375f('0x45')],null))[_0x375f('0x24')](respondWithResult(_0x84471e,null))['catch'](handleError(_0x84471e,null));};exports[_0x375f('0x23')]=function(_0x4dd467,_0x3b4f48){return db[_0x375f('0x29')]['find']({'where':{'id':_0x4dd467['params']['id']}})['then'](handleEntityNotFound(_0x3b4f48,null))['then'](removeEntity(_0x3b4f48,null))[_0x375f('0x40')](handleError(_0x3b4f48,null));};exports[_0x375f('0x47')]=function(_0xda7537,_0x105890){return db[_0x375f('0x29')]['describe']()['then'](respondWithResult(_0x105890,null))['catch'](handleError(_0x105890,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 55f0585..67d9287 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 _0xf67d=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x38440c,_0x39b283){var _0x3f6ec0=function(_0x38e247){while(--_0x38e247){_0x38440c['push'](_0x38440c['shift']());}};_0x3f6ec0(++_0x39b283);}(_0xf67d,0x90));var _0xdf67=function(_0x4abf6b,_0x11823c){_0x4abf6b=_0x4abf6b-0x0;var _0x44d51c=_0xf67d[_0x4abf6b];return _0x44d51c;};'use strict';var _=require(_0xdf67('0x0'));var util=require(_0xdf67('0x1'));var logger=require('../../config/logger')(_0xdf67('0x2'));var moment=require(_0xdf67('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf67('0x4'));var fs=require('fs');var path=require(_0xdf67('0x5'));var rimraf=require(_0xdf67('0x6'));var config=require(_0xdf67('0x7'));var attributes=require(_0xdf67('0x8'));module[_0xdf67('0x9')]=function(_0x231c3c,_0x47a7d9){return _0x231c3c[_0xdf67('0xa')](_0xdf67('0xb'),attributes,{'tableName':_0xdf67('0xc'),'paranoid':![],'indexes':[{'name':_0xdf67('0xd'),'fields':[_0xdf67('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c2a=['../../config/logger','api','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x54be74,_0x37c908){var _0x47da47=function(_0x233b4b){while(--_0x233b4b){_0x54be74['push'](_0x54be74['shift']());}};_0x47da47(++_0x37c908);}(_0x4c2a,0x1e8));var _0xa4c2=function(_0x3cb405,_0x19d4a1){_0x3cb405=_0x3cb405-0x0;var _0x15587a=_0x4c2a[_0x3cb405];return _0x15587a;};'use strict';var _=require(_0xa4c2('0x0'));var util=require(_0xa4c2('0x1'));var logger=require(_0xa4c2('0x2'))(_0xa4c2('0x3'));var moment=require(_0xa4c2('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4c2('0x5'));var fs=require('fs');var path=require(_0xa4c2('0x6'));var rimraf=require('rimraf');var config=require(_0xa4c2('0x7'));var attributes=require(_0xa4c2('0x8'));module[_0xa4c2('0x9')]=function(_0x2e4b6d,_0x42684c){return _0x2e4b6d[_0xa4c2('0xa')](_0xa4c2('0xb'),attributes,{'tableName':_0xa4c2('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa4c2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 1456fa6..0161290 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 _0x0a94=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x66ab66,_0x41d98a){var _0x235614=function(_0x30478e){while(--_0x30478e){_0x66ab66['push'](_0x66ab66['shift']());}};_0x235614(++_0x41d98a);}(_0x0a94,0x15c));var _0x40a9=function(_0x2dd230,_0x47ebd4){_0x2dd230=_0x2dd230-0x0;var _0x275813=_0x0a94[_0x2dd230];return _0x275813;};'use strict';var _=require(_0x40a9('0x0'));var util=require(_0x40a9('0x1'));var moment=require('moment');var BPromise=require(_0x40a9('0x2'));var rs=require(_0x40a9('0x3'));var fs=require('fs');var Redis=require(_0x40a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x40a9('0x5'));var logger=require('../../config/logger')(_0x40a9('0x6'));var config=require(_0x40a9('0x7'));var jayson=require(_0x40a9('0x8'));var client=jayson[_0x40a9('0x9')][_0x40a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20df5f,_0x2d9e37,_0xdadaf5){return new BPromise(function(_0x1becc4,_0x24ffe6){return client[_0x40a9('0xb')](_0x20df5f,_0xdadaf5)[_0x40a9('0xc')](function(_0x3158e5){logger[_0x40a9('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x2d9e37,'request\x20sent');logger['debug'](_0x40a9('0xe'),_0x2d9e37,'request\x20sent',JSON[_0x40a9('0xf')](_0x3158e5));if(_0x3158e5[_0x40a9('0x10')]){if(_0x3158e5['error'][_0x40a9('0x11')]===0x1f4){logger[_0x40a9('0x10')](_0x40a9('0x12'),_0x2d9e37,_0x3158e5[_0x40a9('0x10')][_0x40a9('0x13')]);return _0x24ffe6(_0x3158e5[_0x40a9('0x10')][_0x40a9('0x13')]);}logger[_0x40a9('0x10')](_0x40a9('0x12'),_0x2d9e37,_0x3158e5[_0x40a9('0x10')][_0x40a9('0x13')]);return _0x1becc4(_0x3158e5[_0x40a9('0x10')]['message']);}else{logger[_0x40a9('0xd')](_0x40a9('0x12'),_0x2d9e37,'request\x20sent');_0x1becc4(_0x3158e5[_0x40a9('0x14')]['message']);}})[_0x40a9('0x15')](function(_0x5d95ee){logger[_0x40a9('0x10')](_0x40a9('0x12'),_0x2d9e37,_0x5d95ee);_0x24ffe6(_0x5d95ee);});});} \ No newline at end of file +var _0x7de1=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x227eff,_0x268fbb){var _0x48f8e9=function(_0x34dcea){while(--_0x34dcea){_0x227eff['push'](_0x227eff['shift']());}};_0x48f8e9(++_0x268fbb);}(_0x7de1,0x116));var _0x17de=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x7de1[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0x17de('0x0'));var util=require(_0x17de('0x1'));var moment=require(_0x17de('0x2'));var BPromise=require(_0x17de('0x3'));var rs=require(_0x17de('0x4'));var fs=require('fs');var Redis=require(_0x17de('0x5'));var db=require(_0x17de('0x6'))['db'];var utils=require(_0x17de('0x7'));var logger=require(_0x17de('0x8'))(_0x17de('0x9'));var config=require(_0x17de('0xa'));var jayson=require(_0x17de('0xb'));var client=jayson[_0x17de('0xc')][_0x17de('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x37da2c,_0x35ff2a,_0x19577a){return new BPromise(function(_0x3c6b6d,_0x467022){return client['request'](_0x37da2c,_0x19577a)[_0x17de('0xe')](function(_0x1c23ba){logger[_0x17de('0xf')](_0x17de('0x10'),_0x35ff2a,_0x17de('0x11'));logger[_0x17de('0x12')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x35ff2a,'request\x20sent',JSON[_0x17de('0x13')](_0x1c23ba));if(_0x1c23ba['error']){if(_0x1c23ba[_0x17de('0x14')][_0x17de('0x15')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x35ff2a,_0x1c23ba[_0x17de('0x14')][_0x17de('0x16')]);return _0x467022(_0x1c23ba['error']['message']);}logger['error'](_0x17de('0x10'),_0x35ff2a,_0x1c23ba[_0x17de('0x14')][_0x17de('0x16')]);return _0x3c6b6d(_0x1c23ba[_0x17de('0x14')][_0x17de('0x16')]);}else{logger['info'](_0x17de('0x10'),_0x35ff2a,_0x17de('0x11'));_0x3c6b6d(_0x1c23ba[_0x17de('0x17')][_0x17de('0x16')]);}})[_0x17de('0x18')](function(_0x5f2ead){logger[_0x17de('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x35ff2a,_0x5f2ead);_0x467022(_0x5f2ead);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index f5dfef5..6ee520c 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 _0x9683=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','describe','get','/:id','show'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x9683,0x16b));var _0x3968=function(_0x17788d,_0x3b0958){_0x17788d=_0x17788d-0x0;var _0x2ab0b2=_0x9683[_0x17788d];return _0x2ab0b2;};'use strict';var multer=require(_0x3968('0x0'));var util=require(_0x3968('0x1'));var path=require(_0x3968('0x2'));var timeout=require(_0x3968('0x3'));var express=require(_0x3968('0x4'));var router=express[_0x3968('0x5')]();var fs_extra=require(_0x3968('0x6'));var auth=require(_0x3968('0x7'));var interaction=require(_0x3968('0x8'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x3968('0x9')](),controller['index']);router['get'](_0x3968('0xa'),auth[_0x3968('0x9')](),controller[_0x3968('0xb')]);router[_0x3968('0xc')](_0x3968('0xd'),auth[_0x3968('0x9')](),controller[_0x3968('0xe')]);router[_0x3968('0xf')]('/',auth[_0x3968('0x9')](),controller[_0x3968('0x10')]);router[_0x3968('0x11')](_0x3968('0xd'),auth[_0x3968('0x9')](),controller[_0x3968('0x12')]);router[_0x3968('0x13')]('/:id',auth[_0x3968('0x9')](),controller[_0x3968('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5465=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xd985a1,_0x3be431){var _0x5d0135=function(_0x73ddb){while(--_0x73ddb){_0xd985a1['push'](_0xd985a1['shift']());}};_0x5d0135(++_0x3be431);}(_0x5465,0x152));var _0x5546=function(_0x23cf8f,_0x58c22c){_0x23cf8f=_0x23cf8f-0x0;var _0x2848a6=_0x5465[_0x23cf8f];return _0x2848a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5546('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5546('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x5546('0x2'));var interaction=require(_0x5546('0x3'));var config=require(_0x5546('0x4'));var controller=require(_0x5546('0x5'));router[_0x5546('0x6')]('/',auth[_0x5546('0x7')](),controller[_0x5546('0x8')]);router['get'](_0x5546('0x9'),auth[_0x5546('0x7')](),controller['describe']);router[_0x5546('0x6')](_0x5546('0xa'),auth[_0x5546('0x7')](),controller[_0x5546('0xb')]);router[_0x5546('0xc')]('/',auth[_0x5546('0x7')](),controller['create']);router[_0x5546('0xd')](_0x5546('0xa'),auth[_0x5546('0x7')](),controller[_0x5546('0xe')]);router[_0x5546('0xf')](_0x5546('0xa'),auth[_0x5546('0x7')](),controller[_0x5546('0x10')]);module[_0x5546('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4f7f8df..b38b89f 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 _0xf487=['star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','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','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','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','BOOLEAN','Feedback','ENUM'];(function(_0x4e83ce,_0x289cde){var _0x287356=function(_0x30b9a3){while(--_0x30b9a3){_0x4e83ce['push'](_0x4e83ce['shift']());}};_0x287356(++_0x289cde);}(_0xf487,0xf2));var _0x7f48=function(_0x1055e9,_0x2b321b){_0x1055e9=_0x1055e9-0x0;var _0x11d83c=_0xf487[_0x1055e9];return _0x11d83c;};'use strict';var Sequelize=require(_0x7f48('0x0'));var rs=require(_0x7f48('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x7f48('0x2')],'allowNull':![],'unique':_0x7f48('0x3')},'description':{'type':Sequelize[_0x7f48('0x2')]},'mapKey':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x4')},'mapKeyOffline':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x5')},'customerAlias':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7f48('0x2')],'allowNull':![],'defaultValue':_0x7f48('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7f48('0x2')],'allowNull':![],'defaultValue':_0x7f48('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7f48('0x2')],'allowNull':![],'defaultValue':_0x7f48('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7f48('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7f48('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7f48('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x7f48('0x9'),_0x7f48('0xa')),'defaultValue':_0x7f48('0x9')},'header_online':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0xb')},'start_chat_button':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0xc')},'offline_chat_button':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0xd')},'header_offline':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7f48('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7f48('0xf')]},'closingQuestion':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7f48('0x10')},'noteTitle':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x11')},'placeholderMessage':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x12')},'closingMessage':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x13')},'conditionAgreement':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x15')},'ratingType':{'type':Sequelize[_0x7f48('0x16')](_0x7f48('0x17'),_0x7f48('0x18')),'defaultValue':_0x7f48('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x7f48('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7f48('0xf')],'defaultValue':function(){return JSON[_0x7f48('0x19')]({'items':[{'type':_0x7f48('0x1a'),'variable':null,'config':{'placeholder':_0x7f48('0x1b'),'type':_0x7f48('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x7f48('0x1a'),'props':{'title':_0x7f48('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x7f48('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x7f48('0x1d')](_0x7f48('0x1e'))?JSON[_0x7f48('0x1f')](this[_0x7f48('0x1d')]('onlineForm')):{};},'set':function(_0x18fe24){return this[_0x7f48('0x20')]('onlineForm',JSON[_0x7f48('0x19')](_0x18fe24));}},'offlineForm':{'type':Sequelize[_0x7f48('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x7f48('0x1a'),'props':{'title':_0x7f48('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x7f48('0x4'),'type':'email'},'variable':null},{'type':_0x7f48('0x21'),'config':{'placeholder':_0x7f48('0x22')},'props':{'title':_0x7f48('0x22'),'helpText':_0x7f48('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x7f48('0x1d')]('offlineForm')?JSON[_0x7f48('0x1f')](this[_0x7f48('0x1d')](_0x7f48('0x24'))):{};},'set':function(_0x3cfac5){return this[_0x7f48('0x20')]('offlineForm',JSON['stringify'](_0x3cfac5));}},'token':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':function(){return rs[_0x7f48('0x25')]();}},'autoclose':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7f48('0x2')]},'forwardOffline':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x26')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7f48('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x7f48('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x29')},'skipUnmanaged':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x13')},'sendUnmanaged':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7f48('0xf')],'defaultValue':function(){return _0x7f48('0x2a');}},'notificationSound':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7f48('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7f48('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x2c')},'verticalAlignment':{'type':Sequelize[_0x7f48('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x2d')},'messagesAlignment':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x2e')},'defaultTitle':{'type':Sequelize[_0x7f48('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7f48('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7f48('0x2')],'allowNull':![],'defaultValue':_0x7f48('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7f48('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7f48('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7f48('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':_0x7f48('0x30')},'systemAvatar':{'type':Sequelize[_0x7f48('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7f48('0x8')],'comment':_0x7f48('0x31')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7f48('0x32'),'set':function(_0x5d567b){if(!_0x5d567b)this[_0x7f48('0x20')](_0x7f48('0x33'),null);this[_0x7f48('0x20')](_0x7f48('0x34'),_0x5d567b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x7f48('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x7f48('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x7f48('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7f48('0xf')]}}; \ No newline at end of file +var _0x0204=['Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','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','Your\x20request\x20has\x20not\x20been\x20processed.','bottom_right','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}}','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error'];(function(_0x2dd67e,_0x41548d){var _0x361b46=function(_0x4e4191){while(--_0x4e4191){_0x2dd67e['push'](_0x2dd67e['shift']());}};_0x361b46(++_0x41548d);}(_0x0204,0x194));var _0x4020=function(_0x1828a,_0x5d5039){_0x1828a=_0x1828a-0x0;var _0x2fbf87=_0x0204[_0x1828a];return _0x2fbf87;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4020('0x0'));module[_0x4020('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x4020('0x2')],'allowNull':![],'unique':_0x4020('0x3')},'description':{'type':Sequelize[_0x4020('0x2')]},'mapKey':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x4020('0x4')},'key':{'type':Sequelize[_0x4020('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0x5')},'customerAlias':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4020('0x2')],'allowNull':![],'defaultValue':_0x4020('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4020('0x2')],'allowNull':![],'defaultValue':_0x4020('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4020('0x2')],'allowNull':![],'defaultValue':_0x4020('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x4020('0x2')],'allowNull':![],'defaultValue':_0x4020('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x4020('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x4020('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4020('0xa')]('rounded',_0x4020('0xb')),'defaultValue':_0x4020('0xc')},'header_online':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0xd')},'start_chat_button':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0xe')},'header_offline':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0xf')},'download_transcript':{'type':Sequelize[_0x4020('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4020('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x4020('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4020('0x11')]},'closingQuestion':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4020('0x12')},'noteTitle':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4020('0x14')},'closingMessageButton':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x4020('0x16'),_0x4020('0x17')),'defaultValue':_0x4020('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x4020('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4020('0x11')],'defaultValue':function(){return JSON[_0x4020('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x4020('0x19'),'type':_0x4020('0x1a'),'required':!![]},'props':{'title':_0x4020('0x19'),'helpText':''}},{'type':_0x4020('0x1b'),'props':{'title':_0x4020('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4020('0x4'),'type':_0x4020('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4020('0x1c')](_0x4020('0x1d'))?JSON[_0x4020('0x1e')](this['getDataValue'](_0x4020('0x1d'))):{};},'set':function(_0x76de20){return this[_0x4020('0x1f')](_0x4020('0x1d'),JSON[_0x4020('0x18')](_0x76de20));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x4020('0x1b'),'props':{'title':_0x4020('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4020('0x4'),'type':'email'},'variable':null},{'type':_0x4020('0x20'),'config':{'placeholder':_0x4020('0x21')},'props':{'title':_0x4020('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x4020('0x22'))?JSON[_0x4020('0x1e')](this[_0x4020('0x1c')](_0x4020('0x22'))):{};},'set':function(_0x4281e5){return this['setDataValue'](_0x4020('0x22'),JSON[_0x4020('0x18')](_0x4281e5));}},'token':{'type':Sequelize[_0x4020('0x2')],'defaultValue':function(){return rs[_0x4020('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4020('0x2')]},'forwardOffline':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4020('0x2')]},'waitingTitle':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4020('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x4020('0x26')},'offlineMessageBody':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4020('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4020('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4020('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x4020('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4020('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4020('0x2')],'defaultValue':_0x4020('0x28')},'verticalAlignment':{'type':Sequelize[_0x4020('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x4020('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4020('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4020('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4020('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4020('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4020('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x4020('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4020('0x8')],'comment':_0x4020('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![],'comment':_0x4020('0x2a'),'set':function(_0x3fe061){if(!_0x3fe061)this[_0x4020('0x1f')](_0x4020('0x2b'),null);this[_0x4020('0x1f')](_0x4020('0x2c'),_0x3fe061);}},'vidaooEscalation':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4020('0x2')]},'vidaooTopic':{'type':Sequelize[_0x4020('0x2')],'allowNull':![],'defaultValue':_0x4020('0x2d')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x4020('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0x4020('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4020('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4020('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index a0af75d..180aafc 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 _0x6b6d=['custom','isNil','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','chat','from','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','includes','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','Applications','Interval','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','timezone','ifTime','account','list','applications','priority','asc','headers','threadId','closed','ChatInteraction','externalUrl','ContactId','interaction','referer','Writing\x20on\x20closed\x20interaction','contact','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','ValidationError','no\x20available\x20attributes','difference','Sequelize','from\x20is\x20mandatory','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','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','findOne','Contact','User','Owner','fullname','Tag','color','tag','interval','../../config/license/util','virtual','increment','URL','address','3.8.0','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','online','offlineForm','onlineForm','fromKey','ChatOfflineMessage','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','fs-extra','querystring','jayson/promise','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','APIOutOfIntervalError','../../errors/api','APIConflictError','APIBadRequestError','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','model','device','%s\x20%s\x20%s','vendor','type','index','Pause','map','rawAttributes','fieldName','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','ChatWebsite','findAll','rows','include','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','Disposition','create','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','addAvatar','filename','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense'];(function(_0x42152a,_0x18cac8){var _0x22d4af=function(_0x39c2ea){while(--_0x39c2ea){_0x42152a['push'](_0x42152a['shift']());}};_0x22d4af(++_0x18cac8);}(_0x6b6d,0x1d3));var _0xd6b6=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x6b6d[_0x2b9b7f];return _0x4ed19a;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6b6('0x0'));var _=require('lodash');var querystring=require(_0xd6b6('0x1'));var htmlToText=require('html-to-text');var Redis=require('ioredis');var jayson=require(_0xd6b6('0x2'));var url=require(_0xd6b6('0x3'));var qs=require(_0xd6b6('0x4'));var logger=require(_0xd6b6('0x5'))(_0xd6b6('0x6'));var config=require(_0xd6b6('0x7'));var APIOutOfIntervalError=require('../../errors/api')[_0xd6b6('0x8')];var APIConflictError=require(_0xd6b6('0x9'))[_0xd6b6('0xa')];var APIBadRequestError=require('../../errors/api')[_0xd6b6('0xb')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require(_0xd6b6('0x9'))['handleError'];var db=require(_0xd6b6('0xc'))['db'];config[_0xd6b6('0xd')]=_[_0xd6b6('0xe')](config[_0xd6b6('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd6b6('0xf'))(new Redis(config['redis']));require(_0xd6b6('0x10'))[_0xd6b6('0x11')](socket);var client=jayson[_0xd6b6('0x12')][_0xd6b6('0x13')]({'port':0x232c});var client9002=jayson['client'][_0xd6b6('0x13')]({'port':0x232a});var client9003=jayson[_0xd6b6('0x12')][_0xd6b6('0x13')]({'port':0x232b});var client9001=jayson['client'][_0xd6b6('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x59f2cd,_0x294866,_0x24683a,_0x329cb2){return new Promise(function(_0x3015dd,_0x3b0273){var _0x78f05a=_0x329cb2||client;return _0x78f05a['request'](_0x59f2cd,_0x24683a)[_0xd6b6('0x14')](function(_0x2d5db1){logger['info'](_0xd6b6('0x15'),_0x294866,_0xd6b6('0x16'));logger['debug'](_0xd6b6('0x17'),_0x294866,_0xd6b6('0x16'),JSON[_0xd6b6('0x18')](_0x2d5db1));if(_0x2d5db1[_0xd6b6('0x19')]){if(_0x2d5db1[_0xd6b6('0x19')][_0xd6b6('0x1a')]===0x1f4){logger[_0xd6b6('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x294866,_0x2d5db1[_0xd6b6('0x19')][_0xd6b6('0x1b')]);return _0x3b0273(_0x2d5db1[_0xd6b6('0x19')][_0xd6b6('0x1b')]);}logger[_0xd6b6('0x19')](_0xd6b6('0x15'),_0x294866,_0x2d5db1[_0xd6b6('0x19')][_0xd6b6('0x1b')]);return _0x3015dd(_0x2d5db1[_0xd6b6('0x19')][_0xd6b6('0x1b')]);}else{logger[_0xd6b6('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x294866,_0xd6b6('0x16'));_0x3015dd(_0x2d5db1[_0xd6b6('0x1d')][_0xd6b6('0x1b')]);}})[_0xd6b6('0x1e')](function(_0x55ba3c){logger[_0xd6b6('0x19')](_0xd6b6('0x15'),_0x294866,_0x55ba3c);_0x3b0273(_0x55ba3c);});});}function respondWithStatusCode(_0x5a9438,_0x2fb2ab){_0x2fb2ab=_0x2fb2ab||0xcc;return function(_0x413017){if(_0x413017){return _0x5a9438[_0xd6b6('0x1f')](_0x2fb2ab);}return _0x5a9438[_0xd6b6('0x20')](_0x2fb2ab)['end']();};}function respondWithResult(_0x1bc8cf,_0x3489d8){_0x3489d8=_0x3489d8||0xc8;return function(_0x330b5b){if(_0x330b5b){return _0x1bc8cf[_0xd6b6('0x20')](_0x3489d8)[_0xd6b6('0x21')](_0x330b5b);}};}function respondWithFilteredResult(_0xbd8103,_0x1f6344){return function(_0x176939){if(_0x176939){var _0xab9de9=typeof _0x1f6344[_0xd6b6('0x22')]==='undefined'&&typeof _0x1f6344[_0xd6b6('0x23')]===_0xd6b6('0x24');var _0x2ab644=_0x176939[_0xd6b6('0x25')];var _0x33697f=_0xab9de9?0x0:_0x1f6344[_0xd6b6('0x22')];var _0x5a5311=_0xab9de9?_0x176939[_0xd6b6('0x25')]:_0x1f6344[_0xd6b6('0x22')]+_0x1f6344[_0xd6b6('0x23')];var _0x52cb75;if(_0x5a5311>=_0x2ab644){_0x5a5311=_0x2ab644;_0x52cb75=0xc8;}else{_0x52cb75=0xce;}_0xbd8103['status'](_0x52cb75);return _0xbd8103[_0xd6b6('0x26')](_0xd6b6('0x27'),_0x33697f+'-'+_0x5a5311+'/'+_0x2ab644)[_0xd6b6('0x21')](_0x176939);}return null;};}function saveUpdates(_0x450e91){return function(_0xab6338){if(_0xab6338){return _0xab6338[_0xd6b6('0x28')](_0x450e91)['then'](function(_0xb0430f){return _0xb0430f;});}return null;};}function removeEntity(_0x487037){return function(_0x53255e){if(_0x53255e){return _0x53255e[_0xd6b6('0x29')]()[_0xd6b6('0x14')](function(){var _0x46f4ec=_0x53255e[_0xd6b6('0x2a')]({'plain':!![]});var _0x463806='ChatWebsites';return db[_0xd6b6('0x2b')][_0xd6b6('0x29')]({'where':{'type':_0x463806,'resourceId':_0x46f4ec['id']}})[_0xd6b6('0x14')](function(){return _0x53255e;});})[_0xd6b6('0x14')](function(){_0x487037['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d2662){return function(_0x32a1d6){if(!_0x32a1d6){_0x4d2662[_0xd6b6('0x1f')](0x194);}return _0x32a1d6;};}function handleError(_0x5712d1,_0x2847c5){_0x2847c5=_0x2847c5||0x1f4;return function(_0x469602){logger[_0xd6b6('0x19')](_0x469602[_0xd6b6('0x2c')]);if(_0x469602[_0xd6b6('0x2d')]){delete _0x469602['name'];}_0x5712d1[_0xd6b6('0x20')](_0x2847c5)[_0xd6b6('0x2e')](_0x469602);};}function createInteractionObject(_0x921453,_0x4d9e46,_0x229d5b,_0x23a438){var _0x2654d0=require(_0xd6b6('0x2f'));var _0xb054e2=new _0x2654d0();var _0x33c9cd=_0xb054e2['setUA'](_0x229d5b[_0xd6b6('0x30')])[_0xd6b6('0x31')]();var _0x74ffe0=_0x4d9e46[_0xd6b6('0x32')];if(_0x229d5b[_0xd6b6('0x33')]){_0x74ffe0=_0x229d5b[_0xd6b6('0x33')];}else if(_0x229d5b[_0xd6b6('0x34')]){_0x74ffe0=_[_0xd6b6('0x35')](_0x229d5b[_0xd6b6('0x34')][_0xd6b6('0x36')](','));}return{'ContactId':_0x23a438['id'],'ChatWebsiteId':_0x921453,'from':(_0x23a438[_0xd6b6('0x37')]||'')+'\x20'+(_0x23a438[_0xd6b6('0x38')]||''),'customerIp':_0x74ffe0,'customerPort':_0x229d5b[_0xd6b6('0x39')]?_0x229d5b[_0xd6b6('0x39')]:null,'referer':_0x4d9e46['referer'],'browserName':_0x33c9cd[_0xd6b6('0x3a')][_0xd6b6('0x2d')]&&_0x33c9cd[_0xd6b6('0x3a')]['version']?util[_0xd6b6('0x3b')](_0xd6b6('0x3c'),_0x33c9cd[_0xd6b6('0x3a')][_0xd6b6('0x2d')],_0x33c9cd[_0xd6b6('0x3a')][_0xd6b6('0x3d')]):_0xd6b6('0x3e'),'browserVersion':_0x33c9cd[_0xd6b6('0x3a')][_0xd6b6('0x3d')]||_0xd6b6('0x3e'),'osName':util[_0xd6b6('0x3b')](_0xd6b6('0x3c'),_0x33c9cd['os'][_0xd6b6('0x2d')],_0x33c9cd['os'][_0xd6b6('0x3d')]),'osVersion':_0x33c9cd['os'][_0xd6b6('0x3d')],'deviceModel':_0x33c9cd['device'][_0xd6b6('0x3f')]&&_0x33c9cd[_0xd6b6('0x40')]['vendor']?util[_0xd6b6('0x3b')](_0xd6b6('0x41'),_0x33c9cd['device'][_0xd6b6('0x3f')],_0x33c9cd[_0xd6b6('0x40')][_0xd6b6('0x42')],_0x33c9cd[_0xd6b6('0x40')][_0xd6b6('0x43')]):null,'deviceVendor':_0x33c9cd['device'][_0xd6b6('0x42')],'deviceType':_0x33c9cd[_0xd6b6('0x40')][_0xd6b6('0x43')],'formData':JSON[_0xd6b6('0x18')](_0x4d9e46)};}exports[_0xd6b6('0x44')]=function(_0x46c981,_0x3eb9c4){var _0x387099={'include':[{'model':db[_0xd6b6('0x45')],'as':'mandatoryDispositionPause'}]},_0x2dd385={},_0xd7565f={'count':0x0,'rows':[]};var _0x25efbc=_[_0xd6b6('0x46')](db['ChatWebsite'][_0xd6b6('0x47')],function(_0xa1d089){return{'name':_0xa1d089[_0xd6b6('0x48')],'type':_0xa1d089[_0xd6b6('0x43')]['key']};});_0x2dd385['model']=_[_0xd6b6('0x46')](_0x25efbc,_0xd6b6('0x2d'));_0x2dd385[_0xd6b6('0x49')]=_[_0xd6b6('0x4a')](_0x46c981[_0xd6b6('0x49')]);_0x2dd385[_0xd6b6('0x4b')]=_[_0xd6b6('0x4c')](_0x2dd385[_0xd6b6('0x3f')],_0x2dd385['query']);_0x387099['attributes']=_[_0xd6b6('0x4c')](_0x2dd385['model'],qs[_0xd6b6('0x4d')](_0x46c981[_0xd6b6('0x49')][_0xd6b6('0x4d')]));_0x387099[_0xd6b6('0x4e')]=_0x387099[_0xd6b6('0x4e')][_0xd6b6('0x4f')]?_0x387099[_0xd6b6('0x4e')]:_0x2dd385['model'];if(!_0x46c981[_0xd6b6('0x49')][_0xd6b6('0x50')]('nolimit')){_0x387099[_0xd6b6('0x23')]=qs['limit'](_0x46c981[_0xd6b6('0x49')]['limit']);_0x387099[_0xd6b6('0x22')]=qs['offset'](_0x46c981[_0xd6b6('0x49')][_0xd6b6('0x22')]);}_0x387099['order']=qs['sort'](_0x46c981['query'][_0xd6b6('0x51')]);_0x387099['where']=qs['filters'](_[_0xd6b6('0x52')](_0x46c981[_0xd6b6('0x49')],_0x2dd385[_0xd6b6('0x4b')]),_0x25efbc);if(_0x46c981[_0xd6b6('0x49')][_0xd6b6('0x53')]){_0x387099[_0xd6b6('0x54')]=_[_0xd6b6('0x55')](_0x387099[_0xd6b6('0x54')],{'$or':_['map'](_0x25efbc,function(_0x49f057){if(_0x49f057['type']!=='VIRTUAL'){var _0x232f1e={};_0x232f1e[_0x49f057[_0xd6b6('0x2d')]]={'$like':'%'+_0x46c981['query']['filter']+'%'};return _0x232f1e;}})});}_0x387099=_[_0xd6b6('0x55')]({},_0x387099,_0x46c981[_0xd6b6('0x56')]);var _0x4b64e8={'where':_0x387099[_0xd6b6('0x54')]};return db['ChatWebsite'][_0xd6b6('0x25')](_0x4b64e8)[_0xd6b6('0x14')](function(_0xa4e48e){_0xd7565f[_0xd6b6('0x25')]=_0xa4e48e;if(_0x46c981[_0xd6b6('0x49')][_0xd6b6('0x57')]){_0x387099['include']=[{'all':!![]}];}return db[_0xd6b6('0x58')][_0xd6b6('0x59')](_0x387099);})[_0xd6b6('0x14')](function(_0x393758){_0xd7565f[_0xd6b6('0x5a')]=_0x393758;return _0xd7565f;})['then'](respondWithFilteredResult(_0x3eb9c4,_0x387099))[_0xd6b6('0x1e')](handleError(_0x3eb9c4,null));};exports['show']=function(_0x7309f9,_0xba5a45){var _0x35bca4={'raw':![],'where':{'id':_0x7309f9['params']['id']},'include':[{'model':db[_0xd6b6('0x45')],'as':'mandatoryDispositionPause'}]},_0x273f9d={};_0x273f9d[_0xd6b6('0x3f')]=_['keys'](db[_0xd6b6('0x58')][_0xd6b6('0x47')]);_0x273f9d[_0xd6b6('0x49')]=_[_0xd6b6('0x4a')](_0x7309f9[_0xd6b6('0x49')]);_0x273f9d[_0xd6b6('0x4b')]=_[_0xd6b6('0x4c')](_0x273f9d[_0xd6b6('0x3f')],_0x273f9d[_0xd6b6('0x49')]);_0x35bca4[_0xd6b6('0x4e')]=_['intersection'](_0x273f9d[_0xd6b6('0x3f')],qs['fields'](_0x7309f9[_0xd6b6('0x49')]['fields']));_0x35bca4['attributes']=_0x35bca4[_0xd6b6('0x4e')][_0xd6b6('0x4f')]?_0x35bca4[_0xd6b6('0x4e')]:_0x273f9d[_0xd6b6('0x3f')];if(_0x7309f9[_0xd6b6('0x49')][_0xd6b6('0x57')]){_0x35bca4[_0xd6b6('0x5b')]=[{'all':!![]}];}_0x35bca4=_['merge']({},_0x35bca4,_0x7309f9[_0xd6b6('0x56')]);return db[_0xd6b6('0x58')][_0xd6b6('0x5c')](_0x35bca4)[_0xd6b6('0x14')](handleEntityNotFound(_0xba5a45,null))[_0xd6b6('0x14')](respondWithResult(_0xba5a45,null))[_0xd6b6('0x1e')](handleError(_0xba5a45,null));};exports['create']=function(_0xfec4d7,_0x5db688){return db[_0xd6b6('0x58')]['create'](_0xfec4d7['body'],{})[_0xd6b6('0x14')](function(_0x279fd3){var _0x891095=_0xfec4d7['user'][_0xd6b6('0x2a')]({'plain':!![]});if(!_0x891095)throw new Error(_0xd6b6('0x5d'));if(_0x891095['role']==='user'){var _0x21c585=_0x279fd3['get']({'plain':!![]});var _0x173ad4='ChatWebsites';return db[_0xd6b6('0x5e')][_0xd6b6('0x5c')]({'where':{'name':_0x173ad4,'userProfileId':_0x891095[_0xd6b6('0x5f')]},'raw':!![]})[_0xd6b6('0x14')](function(_0x343589){if(_0x343589&&_0x343589[_0xd6b6('0x60')]===0x0){return db[_0xd6b6('0x2b')]['create']({'name':_0x21c585[_0xd6b6('0x2d')],'resourceId':_0x21c585['id'],'type':_0x343589[_0xd6b6('0x2d')],'sectionId':_0x343589['id']},{})[_0xd6b6('0x14')](function(){return _0x279fd3;});}else{return _0x279fd3;}})[_0xd6b6('0x1e')](function(_0x1ced10){logger[_0xd6b6('0x19')](_0xd6b6('0x61'),_0x1ced10);throw _0x1ced10;});}return _0x279fd3;})[_0xd6b6('0x14')](respondWithResult(_0x5db688,0xc9))[_0xd6b6('0x1e')](handleError(_0x5db688,null));};exports[_0xd6b6('0x28')]=function(_0x8a45f5,_0x529028){if(_0x8a45f5[_0xd6b6('0x62')]['id']){delete _0x8a45f5['body']['id'];}return db['ChatWebsite'][_0xd6b6('0x5c')]({'where':{'id':_0x8a45f5[_0xd6b6('0x63')]['id']},'include':[{'model':db[_0xd6b6('0x45')],'as':_0xd6b6('0x64')}]})[_0xd6b6('0x14')](handleEntityNotFound(_0x529028,null))['then'](saveUpdates(_0x8a45f5['body'],null))[_0xd6b6('0x14')](respondWithResult(_0x529028,null))[_0xd6b6('0x1e')](handleError(_0x529028,null));};exports['destroy']=function(_0x8f0566,_0x10545a){return db[_0xd6b6('0x58')]['find']({'where':{'id':_0x8f0566[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x10545a,null))[_0xd6b6('0x14')](removeEntity(_0x10545a,null))[_0xd6b6('0x1e')](handleError(_0x10545a,null));};exports[_0xd6b6('0x65')]=function(_0x25f3fa,_0x5886c8){return db[_0xd6b6('0x58')][_0xd6b6('0x65')]()['then'](respondWithResult(_0x5886c8,null))[_0xd6b6('0x1e')](handleError(_0x5886c8,null));};exports[_0xd6b6('0x66')]=function(_0x21b931,_0x4fe238){if(_0x21b931[_0xd6b6('0x62')]['id']){delete _0x21b931[_0xd6b6('0x62')]['id'];}return db[_0xd6b6('0x58')]['find']({'where':{'id':_0x21b931[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x4fe238,null))['then'](function(_0x39d47e){if(_0x39d47e){_0x21b931[_0xd6b6('0x62')][_0xd6b6('0x67')]=_0x39d47e['id'];return db[_0xd6b6('0x68')][_0xd6b6('0x69')](_0x21b931['body']);}})['then'](respondWithResult(_0x4fe238,null))[_0xd6b6('0x1e')](handleError(_0x4fe238,null));};exports['getDispositions']=function(_0x189916,_0x493fd0){var _0x1a1319={'raw':![],'where':{}};var _0x2108ec={};var _0x5dd0ed={'count':0x0,'rows':[]};return db[_0xd6b6('0x58')]['findOne']({'where':{'id':_0x189916[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x493fd0,null))[_0xd6b6('0x14')](function(_0x1065e4){if(_0x1065e4){_0x2108ec[_0xd6b6('0x3f')]=_['keys'](db[_0xd6b6('0x68')][_0xd6b6('0x47')]);_0x2108ec[_0xd6b6('0x49')]=_[_0xd6b6('0x4a')](_0x189916[_0xd6b6('0x49')]);_0x2108ec[_0xd6b6('0x4b')]=_[_0xd6b6('0x4c')](_0x2108ec[_0xd6b6('0x3f')],_0x2108ec['query']);_0x1a1319[_0xd6b6('0x4e')]=_[_0xd6b6('0x4c')](_0x2108ec[_0xd6b6('0x3f')],qs[_0xd6b6('0x4d')](_0x189916[_0xd6b6('0x49')][_0xd6b6('0x4d')]));_0x1a1319[_0xd6b6('0x4e')]=_0x1a1319['attributes']['length']?_0x1a1319[_0xd6b6('0x4e')]:_0x2108ec[_0xd6b6('0x3f')];if(!_0x189916[_0xd6b6('0x49')][_0xd6b6('0x50')](_0xd6b6('0x6a'))){_0x1a1319['limit']=qs[_0xd6b6('0x23')](_0x189916[_0xd6b6('0x49')][_0xd6b6('0x23')]);_0x1a1319['offset']=qs['offset'](_0x189916[_0xd6b6('0x49')][_0xd6b6('0x22')]);}_0x1a1319[_0xd6b6('0x6b')]=qs['sort'](_0x189916[_0xd6b6('0x49')][_0xd6b6('0x51')]);_0x1a1319[_0xd6b6('0x54')]=qs[_0xd6b6('0x4b')](_['pick'](_0x189916[_0xd6b6('0x49')],_0x2108ec[_0xd6b6('0x4b')]));_0x1a1319[_0xd6b6('0x54')][_0xd6b6('0x67')]=_0x1065e4['id'];if(_0x189916[_0xd6b6('0x49')][_0xd6b6('0x53')]){_0x1a1319[_0xd6b6('0x54')]=_['merge'](_0x1a1319[_0xd6b6('0x54')],{'$or':_[_0xd6b6('0x46')](_0x1a1319[_0xd6b6('0x4e')],function(_0x510bf0){var _0x2ddf4b={};_0x2ddf4b[_0x510bf0]={'$like':'%'+_0x189916['query'][_0xd6b6('0x53')]+'%'};return _0x2ddf4b;})});}_0x1a1319=_[_0xd6b6('0x55')]({},_0x1a1319,_0x189916[_0xd6b6('0x56')]);return db['Disposition']['count']({'where':_0x1a1319[_0xd6b6('0x54')]})[_0xd6b6('0x14')](function(_0x10aa0e){_0x5dd0ed[_0xd6b6('0x25')]=_0x10aa0e;if(_0x189916['query'][_0xd6b6('0x57')]){_0x1a1319[_0xd6b6('0x5b')]=[{'all':!![]}];}return db[_0xd6b6('0x68')][_0xd6b6('0x59')](_0x1a1319);})[_0xd6b6('0x14')](function(_0xaf1857){_0x5dd0ed['rows']=_0xaf1857;return _0x5dd0ed;});}})['then'](respondWithFilteredResult(_0x493fd0,_0x1a1319))[_0xd6b6('0x1e')](handleError(_0x493fd0,null));};exports[_0xd6b6('0x6c')]=function(_0x20fbf6,_0x49af3f){return db[_0xd6b6('0x58')]['find']({'where':{'id':_0x20fbf6[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x49af3f,null))[_0xd6b6('0x14')](function(_0x11ab91){if(_0x11ab91){return _0x11ab91[_0xd6b6('0x6c')](_0x20fbf6[_0xd6b6('0x49')][_0xd6b6('0x6d')]);}})[_0xd6b6('0x14')](respondWithStatusCode(_0x49af3f,null))[_0xd6b6('0x1e')](handleError(_0x49af3f,null));};exports[_0xd6b6('0x6e')]=function(_0x2393e8,_0x44a8e3){if(_0x2393e8[_0xd6b6('0x62')]['id']){delete _0x2393e8[_0xd6b6('0x62')]['id'];}return db[_0xd6b6('0x58')]['find']({'where':{'id':_0x2393e8[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x44a8e3,null))['then'](function(_0x1480ad){if(_0x1480ad){_0x2393e8[_0xd6b6('0x62')][_0xd6b6('0x67')]=_0x1480ad['id'];return db[_0xd6b6('0x6f')][_0xd6b6('0x69')](_0x2393e8[_0xd6b6('0x62')]);}})[_0xd6b6('0x14')](respondWithResult(_0x44a8e3,null))['catch'](handleError(_0x44a8e3,null));};exports[_0xd6b6('0x70')]=function(_0xdbf400,_0x5f539d){var _0x4331fa={'raw':![],'where':{}};var _0x2bc400={};var _0x28f983={'count':0x0,'rows':[]};return db[_0xd6b6('0x58')]['findOne']({'where':{'id':_0xdbf400[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x5f539d,null))[_0xd6b6('0x14')](function(_0x5ed3d5){if(_0x5ed3d5){_0x2bc400[_0xd6b6('0x3f')]=_[_0xd6b6('0x4a')](db['CannedAnswer'][_0xd6b6('0x47')]);_0x2bc400[_0xd6b6('0x49')]=_[_0xd6b6('0x4a')](_0xdbf400[_0xd6b6('0x49')]);_0x2bc400['filters']=_[_0xd6b6('0x4c')](_0x2bc400['model'],_0x2bc400[_0xd6b6('0x49')]);_0x4331fa['attributes']=_[_0xd6b6('0x4c')](_0x2bc400[_0xd6b6('0x3f')],qs['fields'](_0xdbf400[_0xd6b6('0x49')][_0xd6b6('0x4d')]));_0x4331fa[_0xd6b6('0x4e')]=_0x4331fa[_0xd6b6('0x4e')][_0xd6b6('0x4f')]?_0x4331fa[_0xd6b6('0x4e')]:_0x2bc400[_0xd6b6('0x3f')];if(!_0xdbf400[_0xd6b6('0x49')][_0xd6b6('0x50')]('nolimit')){_0x4331fa[_0xd6b6('0x23')]=qs['limit'](_0xdbf400['query'][_0xd6b6('0x23')]);_0x4331fa[_0xd6b6('0x22')]=qs[_0xd6b6('0x22')](_0xdbf400[_0xd6b6('0x49')]['offset']);}_0x4331fa[_0xd6b6('0x6b')]=qs[_0xd6b6('0x51')](_0xdbf400['query'][_0xd6b6('0x51')]);_0x4331fa['where']=qs[_0xd6b6('0x4b')](_[_0xd6b6('0x52')](_0xdbf400[_0xd6b6('0x49')],_0x2bc400[_0xd6b6('0x4b')]));_0x4331fa[_0xd6b6('0x54')][_0xd6b6('0x67')]=_0x5ed3d5['id'];if(_0xdbf400[_0xd6b6('0x49')][_0xd6b6('0x53')]){_0x4331fa[_0xd6b6('0x54')]=_[_0xd6b6('0x55')](_0x4331fa[_0xd6b6('0x54')],{'$or':_[_0xd6b6('0x46')](_0x4331fa[_0xd6b6('0x4e')],function(_0xe90459){var _0x355ccc={};_0x355ccc[_0xe90459]={'$like':'%'+_0xdbf400[_0xd6b6('0x49')][_0xd6b6('0x53')]+'%'};return _0x355ccc;})});}_0x4331fa=_[_0xd6b6('0x55')]({},_0x4331fa,_0xdbf400['options']);return db[_0xd6b6('0x6f')]['count']({'where':_0x4331fa[_0xd6b6('0x54')]})[_0xd6b6('0x14')](function(_0x27d88e){_0x28f983[_0xd6b6('0x25')]=_0x27d88e;if(_0xdbf400[_0xd6b6('0x49')][_0xd6b6('0x57')]){_0x4331fa[_0xd6b6('0x5b')]=[{'all':!![]}];}return db[_0xd6b6('0x6f')]['findAll'](_0x4331fa);})[_0xd6b6('0x14')](function(_0x7fdab0){_0x28f983[_0xd6b6('0x5a')]=_0x7fdab0;return _0x28f983;});}})[_0xd6b6('0x14')](respondWithFilteredResult(_0x5f539d,_0x4331fa))['catch'](handleError(_0x5f539d,null));};exports[_0xd6b6('0x71')]=function(_0x2703c8,_0x1a0a5e){return db[_0xd6b6('0x58')][_0xd6b6('0x5c')]({'where':{'id':_0x2703c8[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x1a0a5e,null))[_0xd6b6('0x14')](function(_0x344e96){if(_0x344e96){return _0x344e96[_0xd6b6('0x71')](_0x2703c8[_0xd6b6('0x49')][_0xd6b6('0x6d')]);}})['then'](respondWithStatusCode(_0x1a0a5e,null))[_0xd6b6('0x1e')](handleError(_0x1a0a5e,null));};exports[_0xd6b6('0x72')]=function(_0x4eff6d,_0x5e224e){_0x4eff6d['body']['sitepic']=_0x4eff6d[_0xd6b6('0x73')]['filename'];return db[_0xd6b6('0x58')]['find']({'where':{'id':_0x4eff6d['params']['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x5e224e,null))[_0xd6b6('0x14')](saveUpdates(_0x4eff6d[_0xd6b6('0x62')],null))['then'](respondWithResult(_0x5e224e,null))[_0xd6b6('0x1e')](handleError(_0x5e224e,null));};exports[_0xd6b6('0x74')]=function(_0x59d0f1,_0x2adb00){_0x59d0f1[_0xd6b6('0x62')]['agentAvatar']=_0x59d0f1['file'][_0xd6b6('0x75')];return db[_0xd6b6('0x58')]['find']({'where':{'id':_0x59d0f1[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x2adb00,null))[_0xd6b6('0x14')](saveUpdates(_0x59d0f1[_0xd6b6('0x62')],null))[_0xd6b6('0x14')](respondWithResult(_0x2adb00,null))[_0xd6b6('0x1e')](handleError(_0x2adb00,null));};exports['addCustomerAvatar']=function(_0x41e906,_0x108311){_0x41e906[_0xd6b6('0x62')][_0xd6b6('0x76')]=_0x41e906[_0xd6b6('0x73')][_0xd6b6('0x75')];return db[_0xd6b6('0x58')]['find']({'where':{'id':_0x41e906[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x108311,null))[_0xd6b6('0x14')](saveUpdates(_0x41e906['body'],null))['then'](respondWithResult(_0x108311,null))[_0xd6b6('0x1e')](handleError(_0x108311,null));};exports['addSystemAvatar']=function(_0x40648d,_0x145cb2){_0x40648d[_0xd6b6('0x62')]['systemAvatar']=_0x40648d['file'][_0xd6b6('0x75')];return db[_0xd6b6('0x58')][_0xd6b6('0x5c')]({'where':{'id':_0x40648d[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x145cb2,null))[_0xd6b6('0x14')](saveUpdates(_0x40648d['body'],null))[_0xd6b6('0x14')](respondWithResult(_0x145cb2,null))[_0xd6b6('0x1e')](handleError(_0x145cb2,null));};exports[_0xd6b6('0x77')]=function(_0x1147a0,_0xb0f5f4){var _0x3cd10b=path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],_0xd6b6('0x7a'));var _0x123533={'where':{'id':_0x1147a0[_0xd6b6('0x63')]['id']},'attributes':['id',_0xd6b6('0x7b')],'raw':!![]};var _0x4ed5a5=![];return require('../../config/license/util')[_0xd6b6('0x7c')]()['then'](function(_0x30ed92){if(_0x30ed92){_0x4ed5a5=_0x30ed92[_0xd6b6('0x7d')];}})[_0xd6b6('0x14')](function(){return db[_0xd6b6('0x58')][_0xd6b6('0x5c')](_0x123533);})[_0xd6b6('0x14')](handleEntityNotFound(_0xb0f5f4,null))['then'](function(_0x54d500){if(_0x54d500){if(!_[_0xd6b6('0x7e')](_0x54d500[_0xd6b6('0x7b')])){if(fs['existsSync'](path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],_0xd6b6('0x7f'),_0x54d500[_0xd6b6('0x7b')]))&&_0x4ed5a5){_0x3cd10b=path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],_0xd6b6('0x7f'),_0x54d500[_0xd6b6('0x7b')]);}}return _0xb0f5f4['download'](_0x3cd10b);}})['catch'](handleError(_0xb0f5f4,null));};exports['getAvatar']=function(_0x28dd09,_0x3e88e7){var _0x45c6e7=path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],_0xd6b6('0x80'));var _0x447d88={'where':{'id':_0x28dd09[_0xd6b6('0x63')]['id']},'attributes':['id',_0xd6b6('0x81')],'raw':!![]};return db[_0xd6b6('0x58')][_0xd6b6('0x5c')](_0x447d88)['then'](handleEntityNotFound(_0x3e88e7,null))[_0xd6b6('0x14')](function(_0x42e5e0){if(_0x42e5e0){if(!_[_0xd6b6('0x7e')](_0x42e5e0['agentAvatar'])){if(fs[_0xd6b6('0x82')](path[_0xd6b6('0x78')](config['root'],_0xd6b6('0x83'),_0x42e5e0[_0xd6b6('0x81')]))){_0x45c6e7=path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],'server/files/images/avatars/',_0x42e5e0[_0xd6b6('0x81')]);}}return _0x3e88e7['download'](_0x45c6e7);}})['catch'](handleError(_0x3e88e7,null));};exports[_0xd6b6('0x84')]=function(_0x191d1d,_0x58e4d5){var _0x4ec00a=path[_0xd6b6('0x78')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x5862de={'where':{'id':_0x191d1d[_0xd6b6('0x63')]['id']},'attributes':['id',_0xd6b6('0x76'),_0xd6b6('0x85')],'raw':!![]};return db[_0xd6b6('0x58')][_0xd6b6('0x5c')](_0x5862de)['then'](handleEntityNotFound(_0x58e4d5,null))[_0xd6b6('0x14')](function(_0x17448d){if(_0x17448d){if(!_[_0xd6b6('0x7e')](_0x17448d[_0xd6b6('0x76')])){if(fs[_0xd6b6('0x82')](path['join'](config[_0xd6b6('0x79')],_0xd6b6('0x83'),_0x17448d['customerAvatar']))&&_0x17448d[_0xd6b6('0x85')]){_0x4ec00a=path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],_0xd6b6('0x83'),_0x17448d[_0xd6b6('0x76')]);}}return _0x58e4d5[_0xd6b6('0x86')](_0x4ec00a);}})[_0xd6b6('0x1e')](handleError(_0x58e4d5,null));};exports[_0xd6b6('0x87')]=function(_0xc91a0b,_0x343b6c){var _0x20e40d=path[_0xd6b6('0x78')](config['root'],_0xd6b6('0x88'));var _0x6daefd={'where':{'id':_0xc91a0b[_0xd6b6('0x63')]['id']},'attributes':['id',_0xd6b6('0x89')],'raw':!![]};return db[_0xd6b6('0x58')][_0xd6b6('0x5c')](_0x6daefd)[_0xd6b6('0x14')](handleEntityNotFound(_0x343b6c,null))['then'](function(_0x395964){if(_0x395964){if(!_[_0xd6b6('0x7e')](_0x395964['systemAvatar'])){if(fs['existsSync'](path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],'server/files/images/avatars/',_0x395964[_0xd6b6('0x89')]))){_0x20e40d=path['join'](config[_0xd6b6('0x79')],'server/files/images/avatars/',_0x395964['systemAvatar']);}}return _0x343b6c['download'](_0x20e40d);}})['catch'](handleError(_0x343b6c,null));};exports[_0xd6b6('0x8a')]=function(_0x42d2fb,_0x17b84b){var _0x1c52ad={'body':_0x42d2fb[_0xd6b6('0x62')],'channel':_0xd6b6('0x8b')};var _0x40e099=[];var _0x3939d1=[];var _0x1b6399={};var _0x243d6b=![];if(_0x42d2fb[_0xd6b6('0x62')]['id']){delete _0x42d2fb[_0xd6b6('0x62')]['id'];}if(_[_0xd6b6('0x7e')](_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0x8c')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xd6b6('0x7e')](_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0x8d')])){throw new APIBadRequestError(_0xd6b6('0x8e'));}if(_[_0xd6b6('0x8f')](_0x42d2fb['body']['body'])){throw new APIBadRequestError(_0xd6b6('0x90'));}return db[_0xd6b6('0x91')][_0xd6b6('0x65')]()[_0xd6b6('0x14')](function(_0x17efe8){if(!_0x17efe8){throw new Error(_0xd6b6('0x92'));}_0x40e099=Object[_0xd6b6('0x4a')](_0x17efe8)['filter'](function(_0x32f98d){return![_0xd6b6('0x93'),'updatedAt'][_0xd6b6('0x94')](_0x32f98d);});_0x3939d1=Object[_0xd6b6('0x4a')](_0x17efe8)['filter'](function(_0x2ea487){return!['createdAt',_0xd6b6('0x95'),_0xd6b6('0x96'),_0xd6b6('0x97')][_0xd6b6('0x94')](_0x2ea487);});if(!_['includes'](_0x3939d1,_0x42d2fb['body'][_0xd6b6('0x8d')])){throw new APIBadRequestError(_0xd6b6('0x98')+_0x3939d1[_0xd6b6('0x78')](',\x20'));}_0x1b6399[_0x42d2fb['body'][_0xd6b6('0x8d')]]=_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0x8c')];})[_0xd6b6('0x14')](function(){return db[_0xd6b6('0x58')][_0xd6b6('0x5c')]({'where':{'id':_0x42d2fb[_0xd6b6('0x63')]['id']},'include':[{'model':db[_0xd6b6('0x99')],'as':_0xd6b6('0x9a'),'include':[{'model':db[_0xd6b6('0x91')],'as':_0xd6b6('0x9b'),'where':_0x1b6399,'limit':0x1,'order':[[_0xd6b6('0x95'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xd6b6('0x9c')},{'model':db[_0xd6b6('0x9d')],'as':_0xd6b6('0x9d'),'include':[{'model':db[_0xd6b6('0x9d')],'as':_0xd6b6('0x9e'),'attributes':['id','interval'],'raw':!![]}]}]});})['then'](function(_0x1da96b){if(!_0x1da96b){throw new APINotFoundError(util[_0xd6b6('0x3b')](_0xd6b6('0x9f'),_0x42d2fb[_0xd6b6('0x63')]['id']));}var _0x261a9b=_0x1da96b[_0xd6b6('0x9d')];if(_0x261a9b){var _0x292889=_0x1da96b[_0xd6b6('0xa0')]||undefined;return _0x261a9b[_0xd6b6('0xa1')](_0x292889)[_0xd6b6('0x14')](function(_0x5728f3){if(!_0x5728f3){throw new APIOutOfIntervalError();}return _0x1da96b;});}else{return _0x1da96b;}})['then'](function(_0x581053){if(!_0x581053[_0xd6b6('0x9a')]){return;}_0x1c52ad[_0xd6b6('0xa2')]=_0x581053;_0x1c52ad[_0xd6b6('0xa3')]=_0x581053['List'];_0x1c52ad[_0xd6b6('0xa4')]=_['orderBy'](_0x581053[_0xd6b6('0x9c')],[_0xd6b6('0xa5')],[_0xd6b6('0xa6')]);if(_0x1c52ad[_0xd6b6('0xa2')][_0xd6b6('0x9c')]){delete _0x1c52ad[_0xd6b6('0xa2')][_0xd6b6('0x9c')];}if(_0x1c52ad[_0xd6b6('0xa2')]['List']&&_0x1c52ad['account'][_0xd6b6('0x9a')][_0xd6b6('0x9b')][_0xd6b6('0x4f')]){return _0x1c52ad[_0xd6b6('0xa2')]['List'][_0xd6b6('0x9b')][0x0];}var _0x2f67d9=_[_0xd6b6('0xe')](_0x42d2fb[_0xd6b6('0x62')],{'firstName':_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0x8c')],'ListId':_0x581053[_0xd6b6('0x97')]});_0x2f67d9[_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0x8d')]]=_0x42d2fb[_0xd6b6('0x62')]['from'];return db[_0xd6b6('0x91')][_0xd6b6('0x69')](_0x2f67d9,{'fields':_0x40e099,'raw':!![]});})['then'](function(_0x54f311){_0x1c52ad['contact']=_0x54f311;var _0x15d9d8=createInteractionObject(_0x42d2fb['params']['id'],_0x42d2fb[_0xd6b6('0x62')],_0x42d2fb[_0xd6b6('0xa7')],_0x54f311);var _0x213a90={'ChatWebsiteId':_0x42d2fb[_0xd6b6('0x63')]['id']};if(_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xa8')]){_0x213a90['threadId']=_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xa8')];_0x213a90[_0xd6b6('0xa9')]=![];return db[_0xd6b6('0xaa')]['find']({'where':_0x213a90})[_0xd6b6('0x14')](function(_0x4c461c){if(_0x4c461c){_0x243d6b=!![];return _0x4c461c;}_0x15d9d8[_0xd6b6('0xa8')]=_0x42d2fb['body']['threadId'];_0x15d9d8[_0xd6b6('0xab')]=_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xab')];return db[_0xd6b6('0xaa')]['create'](_0x15d9d8);});}_0x213a90[_0xd6b6('0xac')]=_0x54f311['id'];if(_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xad')]&&_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xad')]['id']){_0x213a90['id']=_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xad')]['id'];return db['ChatInteraction'][_0xd6b6('0x5c')]({'where':_0x213a90})[_0xd6b6('0x14')](function(_0x6900e1){var _0x2cf194=_0x42d2fb['body'][_0xd6b6('0x32')]&&_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xae')];if(!_0x2cf194&&_0x6900e1&&_0x6900e1['closed']){throw new APIConflictError(_0xd6b6('0xaf'));}else if(_0x6900e1){_0x243d6b=!![];return _0x6900e1;}else{return db[_0xd6b6('0xaa')][_0xd6b6('0x69')](_0x15d9d8);}});}return db[_0xd6b6('0xaa')][_0xd6b6('0x69')](_0x15d9d8);})['then'](function(_0x5a641b){if(!_0x243d6b){return _0x5a641b;}var _0x266f00={'from':(_0x1c52ad[_0xd6b6('0xb0')][_0xd6b6('0x37')]||'')+'\x20'+(_0x1c52ad['contact'][_0xd6b6('0x38')]||'')};if(_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xa8')]&&_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xb1')]&&_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xa8')]!=_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xb1')]){_0x266f00[_0xd6b6('0xa8')]=_0x42d2fb['body']['messageId'];}return _0x5a641b[_0xd6b6('0x28')](_0x266f00);})['then'](function(_0x31b14d){_0x1c52ad[_0xd6b6('0xad')]=_0x31b14d['get']({'plain':!![]});_0x1c52ad['interaction'][_0xd6b6('0xb2')]=!_0x243d6b;if(_0x1c52ad['interaction'][_0xd6b6('0xb2')]){if(_0x1c52ad[_0xd6b6('0xa2')][_0xd6b6('0xb3')]){_0x1c52ad[_0xd6b6('0xa4')]['push']({'id':0x0,'priority':_0x1c52ad[_0xd6b6('0xa4')][_0xd6b6('0x4f')]+0x1,'app':_0xd6b6('0xb4'),'appdata':_0xd6b6('0xb5'),'interval':_0xd6b6('0xb6')});}}return db[_0xd6b6('0xb7')][_0xd6b6('0x69')]({'body':_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0x62')],'ChatWebsiteId':_0x42d2fb[_0xd6b6('0x63')]['id'],'ChatInteractionId':_0x31b14d['id'],'direction':'in','ContactId':_0x1c52ad['contact']['id'],'AttachmentId':_0x42d2fb[_0xd6b6('0x62')][_0xd6b6('0xb8')]});})[_0xd6b6('0x14')](function(_0x3f5243){_0x1c52ad[_0xd6b6('0x1b')]=_0x3f5243;if(!_0x1c52ad[_0xd6b6('0xad')][_0xd6b6('0xb9')]){return;}return db['User'][_0xd6b6('0x5c')]({'attributes':['id','name'],'where':{'id':_0x1c52ad['interaction'][_0xd6b6('0xb9')]}});})[_0xd6b6('0x14')](function(_0x3ddd3b){if(_0x3ddd3b){_0x1c52ad[_0xd6b6('0xa4')][_0xd6b6('0xba')]({'id':0x0,'priority':0x0,'app':_0xd6b6('0xbb'),'appdata':_0x3ddd3b[_0xd6b6('0x2d')]+','+(_0x1c52ad[_0xd6b6('0xa2')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x1c52ad[_0xd6b6('0xbc')]=!![];}if(!_0x1c52ad['interaction'][_0xd6b6('0xbd')]){return;}return db[_0xd6b6('0xbe')]['find']({'attributes':['id',_0xd6b6('0x2d')],'where':{'id':_0x1c52ad[_0xd6b6('0xad')][_0xd6b6('0xbd')]}});})[_0xd6b6('0x14')](function(_0x1db9f7){if(_0x1db9f7){_0x1c52ad['applications'][_0xd6b6('0xba')]({'id':0x0,'priority':0x1,'app':_0xd6b6('0xbf'),'appdata':_0x1db9f7['name']+','+(_0x1c52ad[_0xd6b6('0xa2')][_0xd6b6('0xc0')]||0x12c),'interval':_0xd6b6('0xb6')});}return respondWithRpcPromise('Start',_0xd6b6('0xc1'),_0x1c52ad);})['then'](function(_0x4038df){respondWithRpcPromise(_0xd6b6('0xc2'),_0xd6b6('0xc2'),{'event':'notify','message':_0x4038df},client9002);return _0x4038df;})[_0xd6b6('0x14')](respondWithResult(_0x17b84b,null))[_0xd6b6('0x1e')](APIHandleError(_0x17b84b));};exports[_0xd6b6('0xc3')]=function(_0x466cea,_0x259cc6){var _0x27b8fe,_0x2e506f,_0x1790fd;var _0x29716=[];var _0x29103f={};var _0x165845=_0x466cea['files']||[];var _0x11445b=[];var _0x35964f;return db[_0xd6b6('0x91')][_0xd6b6('0x65')]()[_0xd6b6('0x14')](function(_0x1df958){if(!_0x1df958){throw new db['Sequelize'][(_0xd6b6('0xc4'))](_0xd6b6('0xc5'));}_0x29716=_[_0xd6b6('0xc6')](_['keys'](_0x1df958),[_0xd6b6('0x93'),_0xd6b6('0x95'),_0xd6b6('0x96'),'ListId']);if(_0x466cea[_0xd6b6('0x62')]['id']){delete _0x466cea[_0xd6b6('0x62')]['id'];}if(_[_0xd6b6('0x7e')](_0x466cea[_0xd6b6('0x62')][_0xd6b6('0x8c')])){throw _0x259cc6[_0xd6b6('0x20')](0x1f4)[_0xd6b6('0x2e')](new db[(_0xd6b6('0xc7'))]['ValidationError'](_0xd6b6('0xc8')));}if(_['isNil'](_0x466cea[_0xd6b6('0x62')]['body'])||_0x466cea['body'][_0xd6b6('0x62')]===''){throw _0x259cc6[_0xd6b6('0x20')](0x1f4)[_0xd6b6('0x2e')](new db['Sequelize'][(_0xd6b6('0xc4'))](_0xd6b6('0xc9')));}if(_[_0xd6b6('0x7e')](_0x466cea[_0xd6b6('0x62')][_0xd6b6('0xca')])){throw _0x259cc6[_0xd6b6('0x20')](0x1f4)[_0xd6b6('0x2e')](new db[(_0xd6b6('0xc7'))][(_0xd6b6('0xc4'))](_0xd6b6('0xcb')+_0x29716));}if(!_[_0xd6b6('0x94')](_0x29716,_0x466cea[_0xd6b6('0x62')][_0xd6b6('0xca')])){throw _0x259cc6[_0xd6b6('0x20')](0x1f4)['send'](new db['Sequelize'][(_0xd6b6('0xc4'))](_0xd6b6('0xcc')+_0x29716));}_0x29103f[_0x466cea['body']['mapKeyOffline']]=_0x466cea[_0xd6b6('0x62')][_0xd6b6('0x8c')];})[_0xd6b6('0x14')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x466cea[_0xd6b6('0x63')]['id']},'include':[{'model':db[_0xd6b6('0x99')],'as':_0xd6b6('0x9a')},{'model':db['MailAccount'],'as':_0xd6b6('0xcd')}]});})[_0xd6b6('0x14')](handleEntityNotFound(_0x259cc6,null))[_0xd6b6('0x14')](function(_0x543cdf){if(_0x543cdf&&_0x543cdf[_0xd6b6('0x9a')]){_0x2e506f=_0x543cdf;var _0x45d8ae=_['defaults'](_0x466cea['body'],{'firstName':_0x466cea[_0xd6b6('0x62')][_0xd6b6('0x8c')],'phone':_0x466cea[_0xd6b6('0x62')][_0xd6b6('0x8c')],'ListId':_0x543cdf['ListId']});_0x45d8ae[_0x466cea[_0xd6b6('0x62')][_0xd6b6('0xca')]]=_0x466cea[_0xd6b6('0x62')][_0xd6b6('0x8c')];return db[_0xd6b6('0x91')][_0xd6b6('0xce')]({'where':_0x29103f,'defaults':_0x45d8ae});}})['spread'](function(_0x277d5c){if(_0x277d5c){_0x1790fd=_0x277d5c;var _0x3866be=fs[_0xd6b6('0xcf')](path[_0xd6b6('0x78')](config['root'],_0xd6b6('0xd0')),_0xd6b6('0xd1'));var _0x16f2ac=ejs[_0xd6b6('0xd2')](_0x3866be,{'body':_[_0xd6b6('0xd3')](_0x466cea[_0xd6b6('0x62')][_0xd6b6('0x62')]),'bodyTitle':_0x2e506f[_0xd6b6('0xd4')]});return db['ChatOfflineMessage'][_0xd6b6('0x69')]({'body':_0x16f2ac,'plainBody':htmlToText[_0xd6b6('0xd5')](_0x16f2ac),'ContactId':_0x277d5c['id'],'ChatWebsiteId':_0x2e506f['id']});}})['then'](function(_0x3de068){_0x35964f=_0x3de068;if(_0x165845[_0xd6b6('0x4f')]){var _0x698ec1=_0x165845[_0xd6b6('0x46')](function(_0x192999){return{'name':_0x192999[_0xd6b6('0xd6')],'basename':_0x192999[_0xd6b6('0x75')],'type':_0x192999[_0xd6b6('0xd7')],'ChatOfflineMessageId':_0x3de068['id']};});_0x11445b=_0x698ec1[_0xd6b6('0x46')](_0x556d8d=>{var _0x510091={'filename':_0x556d8d['name'],'path':path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],_0xd6b6('0xd8'),_0xd6b6('0xd9'),_0xd6b6('0xda'),_0xd6b6('0xdb'),_0x556d8d[_0xd6b6('0xdc')])};return _0x510091;});if(!_0x2e506f[_0xd6b6('0xdd')]){return db[_0xd6b6('0xde')]['transaction'](function(_0x21fee5){return db[_0xd6b6('0xdf')][_0xd6b6('0xe0')](_0x698ec1,{'transaction':_0x21fee5});});}}})[_0xd6b6('0x14')](function(){if(_0x35964f){_0x27b8fe=_0x35964f;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd6b6('0xe1'),'raw':!![],'include':[{'model':db[_0xd6b6('0xe2')],'as':_0xd6b6('0xe2'),'raw':!![]}]}]});}})[_0xd6b6('0x14')](function(_0x1b71fc){if(_0x1b71fc&&_0x1b71fc[_0xd6b6('0xe1')]&&_0x2e506f[_0xd6b6('0xe3')]&&_0x2e506f[_0xd6b6('0xe4')]){var _0x5680d7=_0x1b71fc[_0xd6b6('0xe5')]();return respondWithRpcPromise(_0xd6b6('0xe6'),_0xd6b6('0xe7'),{'account':_0x5680d7,'message':{'from':util[_0xd6b6('0x3b')](_0xd6b6('0xe8'),_0x1b71fc['name'],_0x1b71fc[_0xd6b6('0xe9')]||_0x1b71fc[_0xd6b6('0xe1')][_0xd6b6('0xea')]),'to':_0x2e506f[_0xd6b6('0xe4')],'subject':_0x2e506f[_0xd6b6('0xeb')],'html':_0x27b8fe['body'],'attachments':_0x11445b}},client9003)[_0xd6b6('0x14')](function(){return _0x27b8fe;})[_0xd6b6('0x1e')](function(_0x31649e){logger[_0xd6b6('0x19')](_0x31649e);});}})[_0xd6b6('0x14')](function(){if(_0x2e506f&&_0x2e506f[_0xd6b6('0xdd')]&&_0x2e506f[_0xd6b6('0xec')]){var _0x1e7b50=[];if(_0x165845['length']){_0x1e7b50=_0x165845['map'](function(_0x70dca6){return{'name':_0x70dca6['originalname'],'basename':_0x70dca6['filename'],'type':_0x70dca6[_0xd6b6('0xd7')],'ChatOfflineMessageId':_0x35964f['id']};});}var _0x30e039;if(!_[_0xd6b6('0x7e')](_0x2e506f[_0xd6b6('0xed')])){var _0x4b6ed0=_[_0xd6b6('0x46')](_0x466cea[_0xd6b6('0x62')],function(_0x3d0e29){return _0x3d0e29;});var _0x446630=_['toPairsIn'](_0x4b6ed0)[0x0];var _0x2b2636=_[_0xd6b6('0xee')](_0x446630,function(_0x1fdbde){return _0x1fdbde;});_0x30e039=_0x2b2636[0x1][_0x2e506f[_0xd6b6('0xed')]];}var _0x4ae3e2={'from':_0x1790fd['email'],'firstName':_0x1790fd[_0xd6b6('0x37')],'lastName':_0x1790fd['lastName'],'mapKey':_0xd6b6('0xe9'),'message':{'from':_0x1790fd[_0xd6b6('0xe9')],'to':_0x2e506f['MailAccount'][_0xd6b6('0xe9')],'cc':'','subject':_[_0xd6b6('0x7e')](_0x30e039)?_0x2e506f['offlineMessageSubject']:_0x30e039,'messageId':'','sentAt':new Date(),'attach':_0x1e7b50[_0xd6b6('0x4f')],'attachments':_0x1e7b50,'originChannel':_0xd6b6('0xef'),'ChatWebsiteId':_0x2e506f['id'],'ChatOfflineMessageId':_0x27b8fe['id'],'originTo':_0x2e506f[_0xd6b6('0xcd')][_0xd6b6('0xe9')]},'body':_0x27b8fe['body']};var _0x97d904={'account':{'id':_0x2e506f[_0xd6b6('0xec')]},'body':_0x4ae3e2,'log':_0xd6b6('0xf0')};return respondWithRpcPromise('NotifyMailAccount',_0xd6b6('0xf1'),_0x97d904,client9001)['then'](function(){return _0x27b8fe;})[_0xd6b6('0x1e')](function(_0x198ae7){logger[_0xd6b6('0x19')](_0x198ae7);});}return;})[_0xd6b6('0x14')](function(){if(_0x27b8fe){return _0x27b8fe;}})['then'](respondWithResult(_0x259cc6,null))['catch'](function(){for(var _0x3f4012 of _0x165845){var _0x46f214=path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],_0xd6b6('0xd8'),_0xd6b6('0xd9'),_0xd6b6('0xda'),_0xd6b6('0xdb'),_0x3f4012[_0xd6b6('0x75')]);fs_extra['remove'](_0x46f214)['catch'](function(_0x3c8fb0){logger['error'](_0xd6b6('0xf2'),_0x46f214,_0x3c8fb0);});}});};exports[_0xd6b6('0xf3')]=function(_0x51435d,_0x160c6f){return db[_0xd6b6('0xaa')]['find']({'where':{'id':_0x51435d['params']['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x160c6f,null))[_0xd6b6('0x14')](function(_0xe2e89a){if(_0xe2e89a){return _0xe2e89a[_0xd6b6('0xf3')](_0x51435d[_0xd6b6('0x62')][_0xd6b6('0x6d')],_[_0xd6b6('0xf4')](_0x51435d['body'],[_0xd6b6('0x6d'),'id'])||{});}})[_0xd6b6('0x14')](respondWithResult(_0x160c6f,null))[_0xd6b6('0x1e')](handleError(_0x160c6f,null));};exports['getInteractions']=function(_0x2ffcbb,_0x1046a9){var _0x42e25f={'raw':![],'where':{}};var _0x310a87={};var _0x268054={'count':0x0,'rows':[]};return db[_0xd6b6('0x58')][_0xd6b6('0xf5')]({'where':{'id':_0x2ffcbb['params']['id']}})['then'](handleEntityNotFound(_0x1046a9,null))[_0xd6b6('0x14')](function(_0x4f86c5){if(_0x4f86c5){_0x310a87[_0xd6b6('0x3f')]=_[_0xd6b6('0x4a')](db[_0xd6b6('0xaa')][_0xd6b6('0x47')]);_0x310a87[_0xd6b6('0x49')]=_[_0xd6b6('0x4a')](_0x2ffcbb[_0xd6b6('0x49')]);_0x310a87[_0xd6b6('0x4b')]=_[_0xd6b6('0x4c')](_0x310a87[_0xd6b6('0x3f')],_0x310a87['query']);_0x42e25f['attributes']=_['intersection'](_0x310a87[_0xd6b6('0x3f')],qs[_0xd6b6('0x4d')](_0x2ffcbb['query'][_0xd6b6('0x4d')]));_0x42e25f['attributes']=_0x42e25f[_0xd6b6('0x4e')][_0xd6b6('0x4f')]?_0x42e25f[_0xd6b6('0x4e')]:_0x310a87['model'];if(!_0x2ffcbb[_0xd6b6('0x49')][_0xd6b6('0x50')]('nolimit')){_0x42e25f['limit']=qs[_0xd6b6('0x23')](_0x2ffcbb[_0xd6b6('0x49')][_0xd6b6('0x23')]);_0x42e25f[_0xd6b6('0x22')]=qs[_0xd6b6('0x22')](_0x2ffcbb['query'][_0xd6b6('0x22')]);}_0x42e25f[_0xd6b6('0x6b')]=qs[_0xd6b6('0x51')](_0x2ffcbb[_0xd6b6('0x49')][_0xd6b6('0x51')]);_0x42e25f[_0xd6b6('0x54')]=qs[_0xd6b6('0x4b')](_['pick'](_0x2ffcbb[_0xd6b6('0x49')],_0x310a87[_0xd6b6('0x4b')]));_0x42e25f['where'][_0xd6b6('0x67')]=_0x4f86c5['id'];if(_0x2ffcbb[_0xd6b6('0x49')][_0xd6b6('0x53')]){_0x42e25f[_0xd6b6('0x54')]=_[_0xd6b6('0x55')](_0x42e25f[_0xd6b6('0x54')],{'$or':_[_0xd6b6('0x46')](_0x42e25f['attributes'],function(_0x56947f){var _0x389737={};_0x389737[_0x56947f]={'$like':'%'+_0x2ffcbb[_0xd6b6('0x49')][_0xd6b6('0x53')]+'%'};return _0x389737;})});}_0x42e25f=_[_0xd6b6('0x55')]({},_0x42e25f,_0x2ffcbb['options']);return db['ChatInteraction'][_0xd6b6('0x25')]({'where':_0x42e25f[_0xd6b6('0x54')]})[_0xd6b6('0x14')](function(_0x17db79){_0x268054[_0xd6b6('0x25')]=_0x17db79;if(_0x2ffcbb[_0xd6b6('0x49')][_0xd6b6('0x57')]){_0x42e25f[_0xd6b6('0x5b')]=[{'model':db[_0xd6b6('0x91')],'as':_0xd6b6('0xf6'),'required':![]},{'model':db[_0xd6b6('0xf7')],'as':_0xd6b6('0xf8'),'attributes':[_0xd6b6('0x2d'),_0xd6b6('0xf9'),'internal'],'required':![]},{'model':db[_0xd6b6('0xfa')],'as':'Tags','attributes':['id',_0xd6b6('0x2d'),_0xd6b6('0xfb')],'where':_0x2ffcbb[_0xd6b6('0x49')][_0xd6b6('0xfc')]?{'id':_0x2ffcbb['query'][_0xd6b6('0xfc')]}:undefined,'required':_0x2ffcbb[_0xd6b6('0x49')]['tag']?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x42e25f);})[_0xd6b6('0x14')](function(_0x5cf517){_0x268054[_0xd6b6('0x5a')]=_0x5cf517;return _0x268054;});}})[_0xd6b6('0x14')](respondWithFilteredResult(_0x1046a9,_0x42e25f))[_0xd6b6('0x1e')](handleError(_0x1046a9,null));};exports['getSnippet']=function(_0x571ff8,_0x341f89){var _0x19e93b=0x0;var _0x16edb6=0x0;var _0x3b43a3=![];var _0x462a6e;var _0x1784a3;return db[_0xd6b6('0x58')][_0xd6b6('0x5c')]({'where':{'id':_0x571ff8[_0xd6b6('0x63')]['id']},'include':[{'model':db['Interval'],'as':_0xd6b6('0x9d'),'include':[{'model':db[_0xd6b6('0x9d')],'as':'Intervals','attributes':['id',_0xd6b6('0xfd')]}]}]})[_0xd6b6('0x14')](handleEntityNotFound(_0x341f89,null))[_0xd6b6('0x14')](function(_0x2c0eda){if(_0x2c0eda){_0x462a6e=_0x2c0eda;return _0x2c0eda['getProactiveActions']({'raw':!![]});}})[_0xd6b6('0x14')](function(_0x2ffb04){if(_0x462a6e){if(_0x2ffb04){_0x1784a3=_0x2ffb04;}}return require(_0xd6b6('0xfe'))[_0xd6b6('0x7c')]();})[_0xd6b6('0x14')](function(_0x4d0f6d){if(_0x4d0f6d){_0x16edb6=_0x4d0f6d[_0xd6b6('0xff')];_0x3b43a3=_0x4d0f6d[_0xd6b6('0x7d')];}})['then'](function(){return db[_0xd6b6('0xaa')][_0xd6b6('0x25')]({'where':{'closed':![]}});})[_0xd6b6('0x14')](function(_0x362f6d){_0x19e93b=_0x362f6d;if(_0x16edb6&&_0x362f6d>_0x16edb6){return db['License'][_0xd6b6('0xf5')]({'where':{'id':0x1}})[_0xd6b6('0x14')](function(_0x193c52){if(_0x193c52){_0x193c52[_0xd6b6('0x100')]('chatLicenseExceeded');}});}})[_0xd6b6('0x14')](function(){var _0x192978=_0x462a6e[_0xd6b6('0x9d')];var _0x22c56d=_0x462a6e[_0xd6b6('0xa0')]||undefined;return _0x192978?_0x192978['ifTime'](_0x22c56d):!![];})[_0xd6b6('0x14')](function(_0x409c99){var _0x3dbcf5=fs[_0xd6b6('0xcf')](path[_0xd6b6('0x78')](config[_0xd6b6('0x79')],'server/files/chat/iframe.ejs'),_0xd6b6('0xd1'));var _0x4740a0=new url[(_0xd6b6('0x101'))](_0x462a6e[_0xd6b6('0x102')])['origin'];var _0x108d3d=_0xd6b6('0x103');var _0x4588ba=![];var _0x2a64d4={'chatVersion':_0x108d3d,'chatWebsiteAddressOrigin':_0x4740a0,'remote':_0x462a6e[_0xd6b6('0x104')],'query':querystring[_0xd6b6('0x18')](_[_0xd6b6('0x55')](_0x462a6e['get']({'plain':!![]}),{'customerIp':_0x571ff8[_0xd6b6('0xa7')]['x-forwarded-for']||_0x571ff8['headers'][_0xd6b6('0x105')]||_0x571ff8[_0xd6b6('0x106')][_0xd6b6('0x107')]||_0x571ff8['ip'],'referer':_0x571ff8['headers'][_0xd6b6('0xae')],'openedInteractions':_0x19e93b,'maxInteractions':_0x16edb6,'virtual':_0x3b43a3['virtual'],'online':_0x409c99,'custom':_0x3b43a3}))[_0xd6b6('0x108')](/'/g,'\x5c\x27')};_0x341f89[_0xd6b6('0x2e')](ejs['render'](Mustache[_0xd6b6('0xd2')](_0x3dbcf5,_0x2a64d4),{'proactiveActions':_0x1784a3,'alignment':_0x462a6e[_0xd6b6('0x109')],'verticalAlignment':_0x462a6e[_0xd6b6('0x10a')],'div_color':_0x462a6e[_0xd6b6('0xfb')],'labelText':_0x462a6e[_0xd6b6('0x10b')],'text_color':_0x462a6e[_0xd6b6('0x10c')],'text_button_color':_0x462a6e[_0xd6b6('0x10d')],'button_color':_0x462a6e['color_button'],'background_color':_0x462a6e['backgroundColor'],'hideWhenOffline':_0x462a6e[_0xd6b6('0x10e')],'intervalId':_0x462a6e['IntervalId'],'isDevelopment':_0x4588ba,'chatVersion':_0x108d3d}));})[_0xd6b6('0x1e')](handleError(_0x341f89,null));};exports[_0xd6b6('0x10f')]=function(_0x3753e5,_0x4f4d1b){var _0x565da3=_0x3753e5['params']['id'];var _0x34cbab=_0x3753e5[_0xd6b6('0x62')];var _0xa5d0c1=0xc8;var _0x344f1e=null;return db[_0xd6b6('0xde')]['transaction']({'isolationLevel':db[_0xd6b6('0xde')][_0xd6b6('0x110')][_0xd6b6('0x111')][_0xd6b6('0x112')]},function(_0x5553ff){return db[_0xd6b6('0x58')][_0xd6b6('0xf5')]({'where':{'id':_0x565da3},'transaction':_0x5553ff})['then'](function(_0x260017){if(_0x260017){return db[_0xd6b6('0x113')][_0xd6b6('0x29')]({'where':{'ChatWebsiteId':_0x565da3},'transaction':_0x5553ff})['then'](function(){var _0x4d2a6d=_['map'](_0x34cbab,function(_0x287ce9){_0x287ce9[_0xd6b6('0x67')]=_0x565da3;return _0x287ce9;});return db[_0xd6b6('0x113')][_0xd6b6('0xe0')](_0x4d2a6d,{'transaction':_0x5553ff});});}else{_0xa5d0c1=0x194;_0x344f1e=[];}});})[_0xd6b6('0x14')](function(){if(_0xa5d0c1!==0x194){return db[_0xd6b6('0x113')][_0xd6b6('0x114')]({'where':{'ChatWebsiteId':_0x565da3},'order':_0xd6b6('0xa5')})['then'](function(_0x139b80){_0x344f1e=_0x139b80;});}})[_0xd6b6('0x1e')](function(_0x501f3c){_0xa5d0c1=0x1f4;logger[_0xd6b6('0x19')](_0x501f3c[_0xd6b6('0x2c')]);if(_0x501f3c[_0xd6b6('0x2d')]){delete _0x501f3c[_0xd6b6('0x2d')];}_0x344f1e=_0x501f3c;})['finally'](function(){if(_0x344f1e===null){_0x4f4d1b[_0xd6b6('0x1f')](_0xa5d0c1);}else{if(_0xa5d0c1===0x1f4){_0x4f4d1b[_0xd6b6('0x20')](_0xa5d0c1)['send'](_0x344f1e);}else{_0x4f4d1b[_0xd6b6('0x20')](_0xa5d0c1)[_0xd6b6('0x21')](_0x344f1e);}}});};exports[_0xd6b6('0x115')]=function(_0x4fa9d5,_0xb61e6e){var _0x9f79c0={};var _0x2359c4={};var _0x473118;var _0x1a03ce;return db[_0xd6b6('0x58')][_0xd6b6('0xf5')]({'where':{'id':_0x4fa9d5['params']['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0xb61e6e,null))[_0xd6b6('0x14')](function(_0x5db675){if(_0x5db675){_0x473118=_0x5db675;_0x2359c4[_0xd6b6('0x3f')]=_[_0xd6b6('0x4a')](db[_0xd6b6('0x113')][_0xd6b6('0x47')]);_0x2359c4['query']=_[_0xd6b6('0x4a')](_0x4fa9d5[_0xd6b6('0x49')]);_0x2359c4[_0xd6b6('0x4b')]=_[_0xd6b6('0x4c')](_0x2359c4['model'],_0x2359c4[_0xd6b6('0x49')]);_0x9f79c0[_0xd6b6('0x4e')]=_[_0xd6b6('0x4c')](_0x2359c4[_0xd6b6('0x3f')],qs['fields'](_0x4fa9d5[_0xd6b6('0x49')][_0xd6b6('0x4d')]));_0x9f79c0[_0xd6b6('0x4e')]=_0x9f79c0[_0xd6b6('0x4e')][_0xd6b6('0x4f')]?_0x9f79c0[_0xd6b6('0x4e')]:_0x2359c4[_0xd6b6('0x3f')];_0x9f79c0['order']=qs[_0xd6b6('0x51')](_0x4fa9d5[_0xd6b6('0x49')][_0xd6b6('0x51')]);_0x9f79c0[_0xd6b6('0x54')]=qs[_0xd6b6('0x4b')](_[_0xd6b6('0x52')](_0x4fa9d5[_0xd6b6('0x49')],_0x2359c4[_0xd6b6('0x4b')]));if(_0x4fa9d5[_0xd6b6('0x49')][_0xd6b6('0x53')]){_0x9f79c0[_0xd6b6('0x54')]=_[_0xd6b6('0x55')](_0x9f79c0[_0xd6b6('0x54')],{'$or':_[_0xd6b6('0x46')](_0x9f79c0[_0xd6b6('0x4e')],function(_0x174a22){var _0x4ce46f={};_0x4ce46f[_0x174a22]={'$like':'%'+_0x4fa9d5[_0xd6b6('0x49')][_0xd6b6('0x53')]+'%'};return _0x4ce46f;})});}_0x9f79c0=_['merge']({},_0x9f79c0,_0x4fa9d5[_0xd6b6('0x56')]);return _0x473118[_0xd6b6('0x115')](_0x9f79c0);}})[_0xd6b6('0x14')](function(_0x2b12d3){if(_0x2b12d3){_0x1a03ce=_0x2b12d3[_0xd6b6('0x4f')];if(!_0x4fa9d5[_0xd6b6('0x49')][_0xd6b6('0x50')](_0xd6b6('0x6a'))){_0x9f79c0[_0xd6b6('0x23')]=qs[_0xd6b6('0x23')](_0x4fa9d5[_0xd6b6('0x49')]['limit']);_0x9f79c0[_0xd6b6('0x22')]=qs[_0xd6b6('0x22')](_0x4fa9d5[_0xd6b6('0x49')][_0xd6b6('0x22')]);}return _0x473118[_0xd6b6('0x115')](_0x9f79c0);}})[_0xd6b6('0x14')](function(_0x95476a){if(_0x95476a){return _0x95476a?{'count':_0x1a03ce,'rows':_0x95476a}:null;}})[_0xd6b6('0x14')](respondWithResult(_0xb61e6e,null))[_0xd6b6('0x1e')](handleError(_0xb61e6e,null));};exports['addProactiveActions']=function(_0x18d191,_0x442d6e){return db[_0xd6b6('0x116')][_0xd6b6('0x5c')]({'where':{'id':_0x18d191[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x442d6e,null))[_0xd6b6('0x14')](function(_0xeb2a27){if(_0xeb2a27){return _0xeb2a27[_0xd6b6('0x117')](_0x18d191['body'][_0xd6b6('0x6d')],_[_0xd6b6('0xf4')](_0x18d191['body'],[_0xd6b6('0x6d'),'id'])||{});}})[_0xd6b6('0x14')](respondWithResult(_0x442d6e,null))[_0xd6b6('0x1e')](handleError(_0x442d6e,null));};exports[_0xd6b6('0x118')]=function(_0x363bd6,_0x257732){var _0x4f0e93={};var _0x5408fc={};var _0x11016f;var _0x1cead8;return db['ChatWebsite'][_0xd6b6('0xf5')]({'where':{'id':_0x363bd6['params']['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x257732,null))[_0xd6b6('0x14')](function(_0x680396){if(_0x680396){_0x11016f=_0x680396;_0x5408fc[_0xd6b6('0x3f')]=_[_0xd6b6('0x4a')](db[_0xd6b6('0x119')][_0xd6b6('0x47')]);_0x5408fc[_0xd6b6('0x49')]=_[_0xd6b6('0x4a')](_0x363bd6[_0xd6b6('0x49')]);_0x5408fc[_0xd6b6('0x4b')]=_[_0xd6b6('0x4c')](_0x5408fc[_0xd6b6('0x3f')],_0x5408fc[_0xd6b6('0x49')]);_0x4f0e93[_0xd6b6('0x4e')]=_[_0xd6b6('0x4c')](_0x5408fc[_0xd6b6('0x3f')],qs[_0xd6b6('0x4d')](_0x363bd6[_0xd6b6('0x49')][_0xd6b6('0x4d')]));_0x4f0e93[_0xd6b6('0x4e')]=_0x4f0e93[_0xd6b6('0x4e')]['length']?_0x4f0e93[_0xd6b6('0x4e')]:_0x5408fc[_0xd6b6('0x3f')];_0x4f0e93[_0xd6b6('0x6b')]=qs[_0xd6b6('0x51')](_0x363bd6[_0xd6b6('0x49')][_0xd6b6('0x51')]);_0x4f0e93[_0xd6b6('0x54')]=qs[_0xd6b6('0x4b')](_[_0xd6b6('0x52')](_0x363bd6[_0xd6b6('0x49')],_0x5408fc[_0xd6b6('0x4b')]));if(_0x363bd6[_0xd6b6('0x49')]['filter']){_0x4f0e93[_0xd6b6('0x54')]=_['merge'](_0x4f0e93['where'],{'$or':_[_0xd6b6('0x46')](_0x4f0e93['attributes'],function(_0x2f0aaa){var _0x195e23={};_0x195e23[_0x2f0aaa]={'$like':'%'+_0x363bd6[_0xd6b6('0x49')]['filter']+'%'};return _0x195e23;})});}_0x4f0e93=_[_0xd6b6('0x55')]({},_0x4f0e93,_0x363bd6['options']);return _0x11016f[_0xd6b6('0x118')](_0x4f0e93);}})[_0xd6b6('0x14')](function(_0x21b59c){if(_0x21b59c){_0x1cead8=_0x21b59c[_0xd6b6('0x4f')];if(!_0x363bd6[_0xd6b6('0x49')][_0xd6b6('0x50')]('nolimit')){_0x4f0e93[_0xd6b6('0x23')]=qs['limit'](_0x363bd6[_0xd6b6('0x49')][_0xd6b6('0x23')]);_0x4f0e93[_0xd6b6('0x22')]=qs[_0xd6b6('0x22')](_0x363bd6[_0xd6b6('0x49')][_0xd6b6('0x22')]);}return _0x11016f['getProactiveActions'](_0x4f0e93);}})[_0xd6b6('0x14')](function(_0x4b8102){if(_0x4b8102){return _0x4b8102?{'count':_0x1cead8,'rows':_0x4b8102}:null;}})[_0xd6b6('0x14')](respondWithResult(_0x257732,null))[_0xd6b6('0x1e')](handleError(_0x257732,null));};exports['getFields']=function(_0x1510a3,_0x16208c){var _0x5a2949=_0x1510a3[_0xd6b6('0x49')][_0xd6b6('0x11a')]==='false'?_0xd6b6('0x11b'):_0xd6b6('0x11c');return db[_0xd6b6('0x58')][_0xd6b6('0x5c')]({'attributes':['id',_0x5a2949],'where':{'id':_0x1510a3[_0xd6b6('0x63')]['id']}})['then'](handleEntityNotFound(_0x16208c,null))[_0xd6b6('0x14')](function(_0x5a7fa6){if(_0x5a7fa6){var _0x33c8ec=_0x5a7fa6[_0x5a2949];var _0x54342e=_0x33c8ec&&_0x33c8ec['items']?_0x33c8ec['items']:[];_0x16208c[_0xd6b6('0x2e')]({'fromKey':_[_0xd6b6('0x7e')](_0x33c8ec[_0xd6b6('0x11d')])?undefined:_0x33c8ec[_0xd6b6('0x11d')],'count':_0x54342e['length'],'rows':_0x54342e});}})['catch'](handleError(_0x16208c,null));};exports['getOfflineMessages']=function(_0x2eb792,_0x55fc62){var _0x53f16d={'raw':![],'where':{}};var _0x361267={};var _0x2f4ce3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd6b6('0xf5')]({'where':{'id':_0x2eb792[_0xd6b6('0x63')]['id']}})['then'](handleEntityNotFound(_0x55fc62,null))[_0xd6b6('0x14')](function(_0x47dc8e){if(_0x47dc8e){_0x361267['model']=_[_0xd6b6('0x4a')](db[_0xd6b6('0x11e')][_0xd6b6('0x47')]);_0x361267[_0xd6b6('0x49')]=_[_0xd6b6('0x4a')](_0x2eb792[_0xd6b6('0x49')]);_0x361267['filters']=_[_0xd6b6('0x4c')](_0x361267['model'],_0x361267[_0xd6b6('0x49')]);_0x53f16d[_0xd6b6('0x4e')]=_['intersection'](_0x361267[_0xd6b6('0x3f')],qs[_0xd6b6('0x4d')](_0x2eb792[_0xd6b6('0x49')][_0xd6b6('0x4d')]));_0x53f16d[_0xd6b6('0x4e')]=_0x53f16d[_0xd6b6('0x4e')][_0xd6b6('0x4f')]?_0x53f16d['attributes']:_0x361267[_0xd6b6('0x3f')];if(!_0x2eb792[_0xd6b6('0x49')]['hasOwnProperty'](_0xd6b6('0x6a'))){_0x53f16d[_0xd6b6('0x23')]=qs[_0xd6b6('0x23')](_0x2eb792['query']['limit']);_0x53f16d[_0xd6b6('0x22')]=qs[_0xd6b6('0x22')](_0x2eb792['query'][_0xd6b6('0x22')]);}_0x53f16d[_0xd6b6('0x6b')]=qs[_0xd6b6('0x51')](_0x2eb792[_0xd6b6('0x49')][_0xd6b6('0x51')]);_0x53f16d[_0xd6b6('0x54')]=qs[_0xd6b6('0x4b')](_[_0xd6b6('0x52')](_0x2eb792['query'],_0x361267[_0xd6b6('0x4b')]));_0x53f16d[_0xd6b6('0x54')][_0xd6b6('0x67')]=_0x47dc8e['id'];if(_0x2eb792[_0xd6b6('0x49')][_0xd6b6('0x53')]){_0x53f16d[_0xd6b6('0x54')]=_[_0xd6b6('0x55')](_0x53f16d['where'],{'$or':_['map'](_0x53f16d[_0xd6b6('0x4e')],function(_0x5876bd){var _0x1b86a7={};_0x1b86a7[_0x5876bd]={'$like':'%'+_0x2eb792['query'][_0xd6b6('0x53')]+'%'};return _0x1b86a7;})});}_0x53f16d=_[_0xd6b6('0x55')]({},_0x53f16d,_0x2eb792['options']);return db['ChatOfflineMessage'][_0xd6b6('0x25')]({'where':_0x53f16d[_0xd6b6('0x54')]})['then'](function(_0xd8a82f){_0x2f4ce3[_0xd6b6('0x25')]=_0xd8a82f;if(_0x2eb792[_0xd6b6('0x49')][_0xd6b6('0x57')]){_0x53f16d[_0xd6b6('0x5b')]=[{'all':!![]}];}else{_0x53f16d[_0xd6b6('0x5b')]=[{'model':db[_0xd6b6('0x91')],'as':_0xd6b6('0xf6'),'required':![]},{'model':db[_0xd6b6('0xdf')],'as':_0xd6b6('0x11f'),'required':![]}];}return db[_0xd6b6('0x11e')][_0xd6b6('0x59')](_0x53f16d);})[_0xd6b6('0x14')](function(_0x4ccb11){_0x2f4ce3[_0xd6b6('0x5a')]=_0x4ccb11;return _0x2f4ce3;});}})[_0xd6b6('0x14')](respondWithFilteredResult(_0x55fc62,_0x53f16d))[_0xd6b6('0x1e')](handleError(_0x55fc62,null));};exports[_0xd6b6('0x120')]=function(_0x5a53c3,_0xefd420){return db[_0xd6b6('0x58')][_0xd6b6('0x5c')]({'where':{'id':_0x5a53c3[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0xefd420,null))['then'](function(_0x417694){if(_0x417694){return _0x417694[_0xd6b6('0x120')](_0x5a53c3['body'][_0xd6b6('0x6d')],_[_0xd6b6('0xf4')](_0x5a53c3[_0xd6b6('0x62')],['ids','id'])||{})[_0xd6b6('0x121')](function(_0x51d166){for(var _0x840be7=0x0;_0x840be7<_0x5a53c3[_0xd6b6('0x62')]['ids'][_0xd6b6('0x4f')];_0x840be7+=0x1){socket[_0xd6b6('0x122')](_0xd6b6('0x123'),{'UserId':Number(_0x5a53c3['body']['ids'][_0x840be7]),'ChatWebsiteId':Number(_0x5a53c3[_0xd6b6('0x63')]['id'])});}return _0x51d166;});}})[_0xd6b6('0x14')](respondWithResult(_0xefd420,null))[_0xd6b6('0x1e')](handleError(_0xefd420,null));};exports[_0xd6b6('0x124')]=function(_0x598777,_0x40e683){return db['ChatWebsite'][_0xd6b6('0x5c')]({'where':{'id':_0x598777['params']['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x40e683,null))[_0xd6b6('0x14')](function(_0x5dfa5d){if(_0x5dfa5d){return _0x5dfa5d[_0xd6b6('0x124')](_0x598777[_0xd6b6('0x49')]['ids'])[_0xd6b6('0x14')](function(){if(_[_0xd6b6('0x125')](_0x598777[_0xd6b6('0x49')][_0xd6b6('0x6d')])){for(var _0x2ea298=0x0;_0x2ea298<_0x598777[_0xd6b6('0x49')][_0xd6b6('0x6d')][_0xd6b6('0x4f')];_0x2ea298+=0x1){socket[_0xd6b6('0x122')](_0xd6b6('0x126'),{'UserId':Number(_0x598777[_0xd6b6('0x49')][_0xd6b6('0x6d')][_0x2ea298]),'ChatWebsiteId':Number(_0x598777['params']['id'])});}}else{socket[_0xd6b6('0x122')](_0xd6b6('0x126'),{'UserId':Number(_0x598777[_0xd6b6('0x49')][_0xd6b6('0x6d')]),'ChatWebsiteId':Number(_0x598777[_0xd6b6('0x63')]['id'])});}});}})[_0xd6b6('0x14')](respondWithStatusCode(_0x40e683,null))[_0xd6b6('0x1e')](handleError(_0x40e683,null));};exports['getAgents']=function(_0x540c13,_0x59848d){var _0x5507fa={};var _0x21f04c={};var _0x3954c3;var _0x1e6d33;return db[_0xd6b6('0x58')][_0xd6b6('0xf5')]({'where':{'id':_0x540c13[_0xd6b6('0x63')]['id']}})[_0xd6b6('0x14')](handleEntityNotFound(_0x59848d,null))[_0xd6b6('0x14')](function(_0x12f86c){if(_0x12f86c){_0x3954c3=_0x12f86c;_0x21f04c[_0xd6b6('0x3f')]=_[_0xd6b6('0x4a')](db[_0xd6b6('0xf7')][_0xd6b6('0x47')]);_0x21f04c[_0xd6b6('0x49')]=_[_0xd6b6('0x4a')](_0x540c13['query']);_0x21f04c[_0xd6b6('0x4b')]=_[_0xd6b6('0x4c')](_0x21f04c['model'],_0x21f04c[_0xd6b6('0x49')]);_0x5507fa[_0xd6b6('0x4e')]=_[_0xd6b6('0x4c')](_0x21f04c[_0xd6b6('0x3f')],qs[_0xd6b6('0x4d')](_0x540c13[_0xd6b6('0x49')][_0xd6b6('0x4d')]));_0x5507fa[_0xd6b6('0x4e')]=_0x5507fa[_0xd6b6('0x4e')][_0xd6b6('0x4f')]?_0x5507fa[_0xd6b6('0x4e')]:_0x21f04c['model'];_0x5507fa[_0xd6b6('0x6b')]=qs['sort'](_0x540c13[_0xd6b6('0x49')][_0xd6b6('0x51')]);_0x5507fa[_0xd6b6('0x54')]=qs[_0xd6b6('0x4b')](_[_0xd6b6('0x52')](_0x540c13[_0xd6b6('0x49')],_0x21f04c[_0xd6b6('0x4b')]));if(_0x540c13[_0xd6b6('0x49')][_0xd6b6('0x53')]){_0x5507fa[_0xd6b6('0x54')]=_[_0xd6b6('0x55')](_0x5507fa[_0xd6b6('0x54')],{'$or':_[_0xd6b6('0x46')](_0x5507fa['attributes'],function(_0x42c942){var _0x16a843={};_0x16a843[_0x42c942]={'$like':'%'+_0x540c13[_0xd6b6('0x49')][_0xd6b6('0x53')]+'%'};return _0x16a843;})});}_0x5507fa=_[_0xd6b6('0x55')]({},_0x5507fa,_0x540c13[_0xd6b6('0x56')]);return _0x3954c3[_0xd6b6('0x127')](_0x5507fa);}})[_0xd6b6('0x14')](function(_0x2c4e21){if(_0x2c4e21){_0x1e6d33=_0x2c4e21[_0xd6b6('0x4f')];if(!_0x540c13['query'][_0xd6b6('0x50')](_0xd6b6('0x6a'))){_0x5507fa[_0xd6b6('0x23')]=qs['limit'](_0x540c13[_0xd6b6('0x49')][_0xd6b6('0x23')]);_0x5507fa[_0xd6b6('0x22')]=qs['offset'](_0x540c13[_0xd6b6('0x49')][_0xd6b6('0x22')]);}return _0x3954c3[_0xd6b6('0x127')](_0x5507fa);}})['then'](function(_0x49d83d){if(_0x49d83d){return _0x49d83d?{'count':_0x1e6d33,'rows':_0x49d83d}:null;}})[_0xd6b6('0x14')](respondWithResult(_0x59848d,null))[_0xd6b6('0x1e')](handleError(_0x59848d,null));}; \ No newline at end of file +var _0x1b37=['ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','x-forwarded-for','first','split','x-real-port','referer','browser','%s\x20%s','version','unknown','format','model','device','vendor','type','Pause','map','ChatWebsite','fieldName','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','mandatoryDispositionPause','rawAttributes','find','create','body','user','autoAssociation','update','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','resolve','timezone','ifTime','chat','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','mapKey','CmList','List','Contacts','DESC','ChatApplication','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','Applications','priority','ListId','list','from','contact','headers','threadId','closed','ChatInteraction','externalUrl','ContactId','interaction','firstName','lastName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','Sequelize','no\x20available\x20attributes','difference','ValidationError','from\x20is\x20mandatory','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','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','Chat','NotifyMailAccount','notifyMail','server','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','3.8.1','remote','x-real-ip','connection','remoteAddress','replace','render','verticalAlignment','labelText','textColor','hideWhenOffline','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','onlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','APIConflictError','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request'];(function(_0x2d51cc,_0x2ca3e2){var _0x3dc46b=function(_0x14bc3b){while(--_0x14bc3b){_0x2d51cc['push'](_0x2d51cc['shift']());}};_0x3dc46b(++_0x2ca3e2);}(_0x1b37,0x11c));var _0x71b3=function(_0x1ae1ae,_0xc793fb){_0x1ae1ae=_0x1ae1ae-0x0;var _0x2da926=_0x1b37[_0x1ae1ae];return _0x2da926;};'use strict';var Mustache=require(_0x71b3('0x0'));var util=require('util');var path=require('path');var ejs=require(_0x71b3('0x1'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71b3('0x2'));var querystring=require(_0x71b3('0x3'));var htmlToText=require(_0x71b3('0x4'));var Redis=require(_0x71b3('0x5'));var jayson=require(_0x71b3('0x6'));var url=require(_0x71b3('0x7'));var qs=require(_0x71b3('0x8'));var logger=require(_0x71b3('0x9'))(_0x71b3('0xa'));var config=require(_0x71b3('0xb'));var APIBadRequestError=require(_0x71b3('0xc'))[_0x71b3('0xd')];var APINotFoundError=require(_0x71b3('0xc'))[_0x71b3('0xe')];var APIOutOfIntervalError=require(_0x71b3('0xc'))[_0x71b3('0xf')];var APIHandleError=require(_0x71b3('0xc'))['handleError'];var APIConflictError=require(_0x71b3('0xc'))[_0x71b3('0x10')];var db=require(_0x71b3('0x11'))['db'];config['redis']=_[_0x71b3('0x12')](config[_0x71b3('0x13')],{'host':_0x71b3('0x14'),'port':0x18eb});var socket=require(_0x71b3('0x15'))(new Redis(config[_0x71b3('0x13')]));require(_0x71b3('0x16'))[_0x71b3('0x17')](socket);var client=jayson[_0x71b3('0x18')]['http']({'port':0x232c});var client9002=jayson[_0x71b3('0x18')][_0x71b3('0x19')]({'port':0x232a});var client9003=jayson[_0x71b3('0x18')]['http']({'port':0x232b});var client9001=jayson[_0x71b3('0x18')]['http']({'port':0x2329});function respondWithRpcPromise(_0x307b00,_0x4bc70b,_0x3621ef,_0x238e7a){return new Promise(function(_0x30c69e,_0x59d608){var _0x312b0d=_0x238e7a||client;return _0x312b0d[_0x71b3('0x1a')](_0x307b00,_0x3621ef)['then'](function(_0x4e4b8e){logger['info'](_0x71b3('0x1b'),_0x4bc70b,_0x71b3('0x1c'));logger['debug'](_0x71b3('0x1d'),_0x4bc70b,_0x71b3('0x1c'),JSON[_0x71b3('0x1e')](_0x4e4b8e));if(_0x4e4b8e[_0x71b3('0x1f')]){if(_0x4e4b8e[_0x71b3('0x1f')][_0x71b3('0x20')]===0x1f4){logger[_0x71b3('0x1f')](_0x71b3('0x1b'),_0x4bc70b,_0x4e4b8e['error'][_0x71b3('0x21')]);return _0x59d608(_0x4e4b8e[_0x71b3('0x1f')][_0x71b3('0x21')]);}logger[_0x71b3('0x1f')](_0x71b3('0x1b'),_0x4bc70b,_0x4e4b8e[_0x71b3('0x1f')][_0x71b3('0x21')]);return _0x30c69e(_0x4e4b8e[_0x71b3('0x1f')][_0x71b3('0x21')]);}else{logger[_0x71b3('0x22')](_0x71b3('0x1b'),_0x4bc70b,_0x71b3('0x1c'));_0x30c69e(_0x4e4b8e[_0x71b3('0x23')]['message']);}})[_0x71b3('0x24')](function(_0x15f316){logger['error'](_0x71b3('0x1b'),_0x4bc70b,_0x15f316);_0x59d608(_0x15f316);});});}function respondWithStatusCode(_0x76fc92,_0x38fea7){_0x38fea7=_0x38fea7||0xcc;return function(_0x57b5a1){if(_0x57b5a1){return _0x76fc92[_0x71b3('0x25')](_0x38fea7);}return _0x76fc92['status'](_0x38fea7)[_0x71b3('0x26')]();};}function respondWithResult(_0x3996f0,_0x5d4709){_0x5d4709=_0x5d4709||0xc8;return function(_0x2b20e0){if(_0x2b20e0){return _0x3996f0[_0x71b3('0x27')](_0x5d4709)[_0x71b3('0x28')](_0x2b20e0);}};}function respondWithFilteredResult(_0x4099a4,_0x36451b){return function(_0x104639){if(_0x104639){var _0x2deb65=typeof _0x36451b['offset']===_0x71b3('0x29')&&typeof _0x36451b[_0x71b3('0x2a')]===_0x71b3('0x29');var _0x5d96dd=_0x104639[_0x71b3('0x2b')];var _0x57fef6=_0x2deb65?0x0:_0x36451b[_0x71b3('0x2c')];var _0x5a2dc7=_0x2deb65?_0x104639[_0x71b3('0x2b')]:_0x36451b[_0x71b3('0x2c')]+_0x36451b[_0x71b3('0x2a')];var _0xf86ddb;if(_0x5a2dc7>=_0x5d96dd){_0x5a2dc7=_0x5d96dd;_0xf86ddb=0xc8;}else{_0xf86ddb=0xce;}_0x4099a4[_0x71b3('0x27')](_0xf86ddb);return _0x4099a4[_0x71b3('0x2d')](_0x71b3('0x2e'),_0x57fef6+'-'+_0x5a2dc7+'/'+_0x5d96dd)[_0x71b3('0x28')](_0x104639);}return null;};}function saveUpdates(_0x1a726b){return function(_0x21be43){if(_0x21be43){return _0x21be43['update'](_0x1a726b)[_0x71b3('0x2f')](function(_0xae1389){return _0xae1389;});}return null;};}function removeEntity(_0x36dd01){return function(_0xa7f618){if(_0xa7f618){return _0xa7f618[_0x71b3('0x30')]()['then'](function(){var _0x5d39ff=_0xa7f618[_0x71b3('0x31')]({'plain':!![]});var _0x5d5009=_0x71b3('0x32');return db[_0x71b3('0x33')]['destroy']({'where':{'type':_0x5d5009,'resourceId':_0x5d39ff['id']}})[_0x71b3('0x2f')](function(){return _0xa7f618;});})['then'](function(){_0x36dd01['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aff3a){return function(_0x397656){if(!_0x397656){_0x5aff3a[_0x71b3('0x25')](0x194);}return _0x397656;};}function handleError(_0x83b78c,_0x58999d){_0x58999d=_0x58999d||0x1f4;return function(_0x5585bb){logger['error'](_0x5585bb[_0x71b3('0x34')]);if(_0x5585bb[_0x71b3('0x35')]){delete _0x5585bb[_0x71b3('0x35')];}_0x83b78c[_0x71b3('0x27')](_0x58999d)[_0x71b3('0x36')](_0x5585bb);};}function createInteractionObject(_0x206367,_0x138f75,_0x189afd,_0x10df24){var _0x30c13d=require(_0x71b3('0x37'));var _0x4e0277=new _0x30c13d();var _0x490486=_0x4e0277[_0x71b3('0x38')](_0x189afd[_0x71b3('0x39')])[_0x71b3('0x3a')]();var _0x97cac6=_0x138f75[_0x71b3('0x3b')];if(_0x189afd['cf-connecting-ip']){_0x97cac6=_0x189afd['cf-connecting-ip'];}else if(_0x189afd[_0x71b3('0x3c')]){_0x97cac6=_[_0x71b3('0x3d')](_0x189afd[_0x71b3('0x3c')][_0x71b3('0x3e')](','));}return{'ContactId':_0x10df24['id'],'ChatWebsiteId':_0x206367,'from':(_0x10df24['firstName']||'')+'\x20'+(_0x10df24['lastName']||''),'customerIp':_0x97cac6,'customerPort':_0x189afd[_0x71b3('0x3f')]?_0x189afd[_0x71b3('0x3f')]:null,'referer':_0x138f75[_0x71b3('0x40')],'browserName':_0x490486[_0x71b3('0x41')][_0x71b3('0x35')]&&_0x490486[_0x71b3('0x41')]['version']?util['format'](_0x71b3('0x42'),_0x490486['browser']['name'],_0x490486[_0x71b3('0x41')][_0x71b3('0x43')]):'unknown','browserVersion':_0x490486[_0x71b3('0x41')][_0x71b3('0x43')]||_0x71b3('0x44'),'osName':util[_0x71b3('0x45')]('%s\x20%s',_0x490486['os']['name'],_0x490486['os'][_0x71b3('0x43')]),'osVersion':_0x490486['os'][_0x71b3('0x43')],'deviceModel':_0x490486['device'][_0x71b3('0x46')]&&_0x490486[_0x71b3('0x47')][_0x71b3('0x48')]?util[_0x71b3('0x45')]('%s\x20%s\x20%s',_0x490486[_0x71b3('0x47')][_0x71b3('0x46')],_0x490486[_0x71b3('0x47')][_0x71b3('0x48')],_0x490486['device'][_0x71b3('0x49')]):null,'deviceVendor':_0x490486[_0x71b3('0x47')]['vendor'],'deviceType':_0x490486[_0x71b3('0x47')][_0x71b3('0x49')],'formData':JSON[_0x71b3('0x1e')](_0x138f75)};}exports['index']=function(_0x1fd7ea,_0x2e89cc){var _0x490f31={'include':[{'model':db[_0x71b3('0x4a')],'as':'mandatoryDispositionPause'}]},_0x251458={},_0x147428={'count':0x0,'rows':[]};var _0x2ca610=_[_0x71b3('0x4b')](db[_0x71b3('0x4c')]['rawAttributes'],function(_0x1dfd3a){return{'name':_0x1dfd3a[_0x71b3('0x4d')],'type':_0x1dfd3a[_0x71b3('0x49')]['key']};});_0x251458[_0x71b3('0x46')]=_[_0x71b3('0x4b')](_0x2ca610,_0x71b3('0x35'));_0x251458[_0x71b3('0x4e')]=_[_0x71b3('0x4f')](_0x1fd7ea['query']);_0x251458[_0x71b3('0x50')]=_[_0x71b3('0x51')](_0x251458['model'],_0x251458[_0x71b3('0x4e')]);_0x490f31[_0x71b3('0x52')]=_[_0x71b3('0x51')](_0x251458['model'],qs[_0x71b3('0x53')](_0x1fd7ea['query'][_0x71b3('0x53')]));_0x490f31[_0x71b3('0x52')]=_0x490f31[_0x71b3('0x52')][_0x71b3('0x54')]?_0x490f31[_0x71b3('0x52')]:_0x251458[_0x71b3('0x46')];if(!_0x1fd7ea['query'][_0x71b3('0x55')](_0x71b3('0x56'))){_0x490f31[_0x71b3('0x2a')]=qs[_0x71b3('0x2a')](_0x1fd7ea[_0x71b3('0x4e')][_0x71b3('0x2a')]);_0x490f31[_0x71b3('0x2c')]=qs['offset'](_0x1fd7ea['query'][_0x71b3('0x2c')]);}_0x490f31['order']=qs[_0x71b3('0x57')](_0x1fd7ea[_0x71b3('0x4e')][_0x71b3('0x57')]);_0x490f31[_0x71b3('0x58')]=qs[_0x71b3('0x50')](_[_0x71b3('0x59')](_0x1fd7ea[_0x71b3('0x4e')],_0x251458[_0x71b3('0x50')]),_0x2ca610);if(_0x1fd7ea[_0x71b3('0x4e')][_0x71b3('0x5a')]){_0x490f31[_0x71b3('0x58')]=_[_0x71b3('0x5b')](_0x490f31[_0x71b3('0x58')],{'$or':_[_0x71b3('0x4b')](_0x2ca610,function(_0x294595){if(_0x294595[_0x71b3('0x49')]!==_0x71b3('0x5c')){var _0x25c2d7={};_0x25c2d7[_0x294595[_0x71b3('0x35')]]={'$like':'%'+_0x1fd7ea[_0x71b3('0x4e')][_0x71b3('0x5a')]+'%'};return _0x25c2d7;}})});}_0x490f31=_[_0x71b3('0x5b')]({},_0x490f31,_0x1fd7ea[_0x71b3('0x5d')]);var _0x29c6f0={'where':_0x490f31[_0x71b3('0x58')]};return db[_0x71b3('0x4c')][_0x71b3('0x2b')](_0x29c6f0)[_0x71b3('0x2f')](function(_0x32e308){_0x147428[_0x71b3('0x2b')]=_0x32e308;if(_0x1fd7ea['query'][_0x71b3('0x5e')]){_0x490f31[_0x71b3('0x5f')]=[{'all':!![]}];}return db[_0x71b3('0x4c')]['findAll'](_0x490f31);})['then'](function(_0x5be2ff){_0x147428[_0x71b3('0x60')]=_0x5be2ff;return _0x147428;})[_0x71b3('0x2f')](respondWithFilteredResult(_0x2e89cc,_0x490f31))[_0x71b3('0x24')](handleError(_0x2e89cc,null));};exports[_0x71b3('0x61')]=function(_0x1fdde6,_0x6588b){var _0x425ac5={'raw':![],'where':{'id':_0x1fdde6['params']['id']},'include':[{'model':db[_0x71b3('0x4a')],'as':_0x71b3('0x62')}]},_0x57290b={};_0x57290b[_0x71b3('0x46')]=_[_0x71b3('0x4f')](db['ChatWebsite'][_0x71b3('0x63')]);_0x57290b[_0x71b3('0x4e')]=_[_0x71b3('0x4f')](_0x1fdde6[_0x71b3('0x4e')]);_0x57290b['filters']=_['intersection'](_0x57290b['model'],_0x57290b[_0x71b3('0x4e')]);_0x425ac5[_0x71b3('0x52')]=_['intersection'](_0x57290b['model'],qs[_0x71b3('0x53')](_0x1fdde6['query'][_0x71b3('0x53')]));_0x425ac5['attributes']=_0x425ac5[_0x71b3('0x52')]['length']?_0x425ac5[_0x71b3('0x52')]:_0x57290b[_0x71b3('0x46')];if(_0x1fdde6[_0x71b3('0x4e')][_0x71b3('0x5e')]){_0x425ac5['include']=[{'all':!![]}];}_0x425ac5=_['merge']({},_0x425ac5,_0x1fdde6['options']);return db[_0x71b3('0x4c')][_0x71b3('0x64')](_0x425ac5)[_0x71b3('0x2f')](handleEntityNotFound(_0x6588b,null))[_0x71b3('0x2f')](respondWithResult(_0x6588b,null))[_0x71b3('0x24')](handleError(_0x6588b,null));};exports[_0x71b3('0x65')]=function(_0x3d0bad,_0x228c57){return db['ChatWebsite'][_0x71b3('0x65')](_0x3d0bad[_0x71b3('0x66')],{})[_0x71b3('0x2f')](function(_0x37c089){var _0x5bfa56=_0x3d0bad[_0x71b3('0x67')][_0x71b3('0x31')]({'plain':!![]});if(!_0x5bfa56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bfa56['role']==='user'){var _0x506545=_0x37c089[_0x71b3('0x31')]({'plain':!![]});var _0x2269c1=_0x71b3('0x32');return db['UserProfileSection'][_0x71b3('0x64')]({'where':{'name':_0x2269c1,'userProfileId':_0x5bfa56['userProfileId']},'raw':!![]})[_0x71b3('0x2f')](function(_0x192e03){if(_0x192e03&&_0x192e03[_0x71b3('0x68')]===0x0){return db[_0x71b3('0x33')][_0x71b3('0x65')]({'name':_0x506545[_0x71b3('0x35')],'resourceId':_0x506545['id'],'type':_0x192e03[_0x71b3('0x35')],'sectionId':_0x192e03['id']},{})[_0x71b3('0x2f')](function(){return _0x37c089;});}else{return _0x37c089;}})['catch'](function(_0xb6c3ed){logger[_0x71b3('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb6c3ed);throw _0xb6c3ed;});}return _0x37c089;})[_0x71b3('0x2f')](respondWithResult(_0x228c57,0xc9))[_0x71b3('0x24')](handleError(_0x228c57,null));};exports[_0x71b3('0x69')]=function(_0x579912,_0x2f9b73){if(_0x579912[_0x71b3('0x66')]['id']){delete _0x579912[_0x71b3('0x66')]['id'];}return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x579912['params']['id']},'include':[{'model':db[_0x71b3('0x4a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2f9b73,null))[_0x71b3('0x2f')](saveUpdates(_0x579912['body'],null))['then'](respondWithResult(_0x2f9b73,null))[_0x71b3('0x24')](handleError(_0x2f9b73,null));};exports['destroy']=function(_0x2bdd81,_0x3098e1){return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x2bdd81[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x3098e1,null))['then'](removeEntity(_0x3098e1,null))[_0x71b3('0x24')](handleError(_0x3098e1,null));};exports[_0x71b3('0x6b')]=function(_0x5c2c2f,_0x575d38){return db[_0x71b3('0x4c')][_0x71b3('0x6b')]()['then'](respondWithResult(_0x575d38,null))['catch'](handleError(_0x575d38,null));};exports[_0x71b3('0x6c')]=function(_0x28b29e,_0x1550a2){if(_0x28b29e['body']['id']){delete _0x28b29e[_0x71b3('0x66')]['id'];}return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x28b29e[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x1550a2,null))[_0x71b3('0x2f')](function(_0xf347c4){if(_0xf347c4){_0x28b29e[_0x71b3('0x66')][_0x71b3('0x6d')]=_0xf347c4['id'];return db[_0x71b3('0x6e')][_0x71b3('0x65')](_0x28b29e['body']);}})['then'](respondWithResult(_0x1550a2,null))[_0x71b3('0x24')](handleError(_0x1550a2,null));};exports[_0x71b3('0x6f')]=function(_0x327117,_0x4cadb4){var _0x516391={'raw':![],'where':{}};var _0x7965d7={};var _0x4da001={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x71b3('0x70')]({'where':{'id':_0x327117[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x4cadb4,null))[_0x71b3('0x2f')](function(_0x2adddc){if(_0x2adddc){_0x7965d7[_0x71b3('0x46')]=_[_0x71b3('0x4f')](db[_0x71b3('0x6e')][_0x71b3('0x63')]);_0x7965d7[_0x71b3('0x4e')]=_[_0x71b3('0x4f')](_0x327117[_0x71b3('0x4e')]);_0x7965d7[_0x71b3('0x50')]=_['intersection'](_0x7965d7[_0x71b3('0x46')],_0x7965d7[_0x71b3('0x4e')]);_0x516391[_0x71b3('0x52')]=_['intersection'](_0x7965d7[_0x71b3('0x46')],qs[_0x71b3('0x53')](_0x327117[_0x71b3('0x4e')][_0x71b3('0x53')]));_0x516391[_0x71b3('0x52')]=_0x516391[_0x71b3('0x52')][_0x71b3('0x54')]?_0x516391[_0x71b3('0x52')]:_0x7965d7['model'];if(!_0x327117[_0x71b3('0x4e')][_0x71b3('0x55')]('nolimit')){_0x516391[_0x71b3('0x2a')]=qs['limit'](_0x327117[_0x71b3('0x4e')]['limit']);_0x516391[_0x71b3('0x2c')]=qs[_0x71b3('0x2c')](_0x327117[_0x71b3('0x4e')][_0x71b3('0x2c')]);}_0x516391[_0x71b3('0x71')]=qs[_0x71b3('0x57')](_0x327117[_0x71b3('0x4e')][_0x71b3('0x57')]);_0x516391[_0x71b3('0x58')]=qs[_0x71b3('0x50')](_[_0x71b3('0x59')](_0x327117[_0x71b3('0x4e')],_0x7965d7['filters']));_0x516391[_0x71b3('0x58')]['ChatWebsiteId']=_0x2adddc['id'];if(_0x327117[_0x71b3('0x4e')]['filter']){_0x516391[_0x71b3('0x58')]=_[_0x71b3('0x5b')](_0x516391[_0x71b3('0x58')],{'$or':_[_0x71b3('0x4b')](_0x516391[_0x71b3('0x52')],function(_0x5756be){var _0x5ba0da={};_0x5ba0da[_0x5756be]={'$like':'%'+_0x327117[_0x71b3('0x4e')]['filter']+'%'};return _0x5ba0da;})});}_0x516391=_[_0x71b3('0x5b')]({},_0x516391,_0x327117[_0x71b3('0x5d')]);return db[_0x71b3('0x6e')][_0x71b3('0x2b')]({'where':_0x516391['where']})['then'](function(_0x56f419){_0x4da001['count']=_0x56f419;if(_0x327117[_0x71b3('0x4e')][_0x71b3('0x5e')]){_0x516391[_0x71b3('0x5f')]=[{'all':!![]}];}return db[_0x71b3('0x6e')][_0x71b3('0x72')](_0x516391);})['then'](function(_0x5e2896){_0x4da001[_0x71b3('0x60')]=_0x5e2896;return _0x4da001;});}})[_0x71b3('0x2f')](respondWithFilteredResult(_0x4cadb4,_0x516391))[_0x71b3('0x24')](handleError(_0x4cadb4,null));};exports[_0x71b3('0x73')]=function(_0x4d183a,_0x34902a){return db['ChatWebsite'][_0x71b3('0x64')]({'where':{'id':_0x4d183a[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x34902a,null))[_0x71b3('0x2f')](function(_0x3e5ec0){if(_0x3e5ec0){return _0x3e5ec0['removeDispositions'](_0x4d183a[_0x71b3('0x4e')][_0x71b3('0x74')]);}})[_0x71b3('0x2f')](respondWithStatusCode(_0x34902a,null))[_0x71b3('0x24')](handleError(_0x34902a,null));};exports[_0x71b3('0x75')]=function(_0xf34a35,_0x19acde){if(_0xf34a35[_0x71b3('0x66')]['id']){delete _0xf34a35[_0x71b3('0x66')]['id'];}return db[_0x71b3('0x4c')]['find']({'where':{'id':_0xf34a35[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x19acde,null))[_0x71b3('0x2f')](function(_0x386595){if(_0x386595){_0xf34a35[_0x71b3('0x66')][_0x71b3('0x6d')]=_0x386595['id'];return db[_0x71b3('0x76')][_0x71b3('0x65')](_0xf34a35[_0x71b3('0x66')]);}})['then'](respondWithResult(_0x19acde,null))[_0x71b3('0x24')](handleError(_0x19acde,null));};exports[_0x71b3('0x77')]=function(_0x23b0ea,_0x40d790){var _0x54af06={'raw':![],'where':{}};var _0x40c90f={};var _0x2e908b={'count':0x0,'rows':[]};return db[_0x71b3('0x4c')][_0x71b3('0x70')]({'where':{'id':_0x23b0ea[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x40d790,null))[_0x71b3('0x2f')](function(_0x1d4046){if(_0x1d4046){_0x40c90f['model']=_[_0x71b3('0x4f')](db['CannedAnswer'][_0x71b3('0x63')]);_0x40c90f[_0x71b3('0x4e')]=_['keys'](_0x23b0ea[_0x71b3('0x4e')]);_0x40c90f['filters']=_[_0x71b3('0x51')](_0x40c90f['model'],_0x40c90f['query']);_0x54af06[_0x71b3('0x52')]=_['intersection'](_0x40c90f['model'],qs[_0x71b3('0x53')](_0x23b0ea[_0x71b3('0x4e')][_0x71b3('0x53')]));_0x54af06['attributes']=_0x54af06[_0x71b3('0x52')][_0x71b3('0x54')]?_0x54af06['attributes']:_0x40c90f[_0x71b3('0x46')];if(!_0x23b0ea['query'][_0x71b3('0x55')](_0x71b3('0x56'))){_0x54af06[_0x71b3('0x2a')]=qs[_0x71b3('0x2a')](_0x23b0ea[_0x71b3('0x4e')]['limit']);_0x54af06[_0x71b3('0x2c')]=qs[_0x71b3('0x2c')](_0x23b0ea['query']['offset']);}_0x54af06[_0x71b3('0x71')]=qs[_0x71b3('0x57')](_0x23b0ea[_0x71b3('0x4e')]['sort']);_0x54af06[_0x71b3('0x58')]=qs[_0x71b3('0x50')](_[_0x71b3('0x59')](_0x23b0ea['query'],_0x40c90f[_0x71b3('0x50')]));_0x54af06['where'][_0x71b3('0x6d')]=_0x1d4046['id'];if(_0x23b0ea[_0x71b3('0x4e')]['filter']){_0x54af06[_0x71b3('0x58')]=_['merge'](_0x54af06[_0x71b3('0x58')],{'$or':_['map'](_0x54af06[_0x71b3('0x52')],function(_0x993ef1){var _0x3ff236={};_0x3ff236[_0x993ef1]={'$like':'%'+_0x23b0ea[_0x71b3('0x4e')][_0x71b3('0x5a')]+'%'};return _0x3ff236;})});}_0x54af06=_[_0x71b3('0x5b')]({},_0x54af06,_0x23b0ea['options']);return db[_0x71b3('0x76')][_0x71b3('0x2b')]({'where':_0x54af06['where']})['then'](function(_0x3c6b45){_0x2e908b[_0x71b3('0x2b')]=_0x3c6b45;if(_0x23b0ea['query'][_0x71b3('0x5e')]){_0x54af06[_0x71b3('0x5f')]=[{'all':!![]}];}return db[_0x71b3('0x76')][_0x71b3('0x72')](_0x54af06);})[_0x71b3('0x2f')](function(_0x59d7fc){_0x2e908b[_0x71b3('0x60')]=_0x59d7fc;return _0x2e908b;});}})['then'](respondWithFilteredResult(_0x40d790,_0x54af06))[_0x71b3('0x24')](handleError(_0x40d790,null));};exports['removeAnswers']=function(_0x44a157,_0x5eae55){return db[_0x71b3('0x4c')]['find']({'where':{'id':_0x44a157[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x5eae55,null))[_0x71b3('0x2f')](function(_0x587b7e){if(_0x587b7e){return _0x587b7e[_0x71b3('0x78')](_0x44a157[_0x71b3('0x4e')][_0x71b3('0x74')]);}})['then'](respondWithStatusCode(_0x5eae55,null))[_0x71b3('0x24')](handleError(_0x5eae55,null));};exports[_0x71b3('0x79')]=function(_0xb0508e,_0x50f01d){_0xb0508e[_0x71b3('0x66')]['sitepic']=_0xb0508e[_0x71b3('0x7a')][_0x71b3('0x7b')];return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0xb0508e[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x50f01d,null))[_0x71b3('0x2f')](saveUpdates(_0xb0508e[_0x71b3('0x66')],null))[_0x71b3('0x2f')](respondWithResult(_0x50f01d,null))[_0x71b3('0x24')](handleError(_0x50f01d,null));};exports[_0x71b3('0x7c')]=function(_0x53565e,_0x299c50){_0x53565e[_0x71b3('0x66')][_0x71b3('0x7d')]=_0x53565e[_0x71b3('0x7a')][_0x71b3('0x7b')];return db['ChatWebsite'][_0x71b3('0x64')]({'where':{'id':_0x53565e[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x299c50,null))['then'](saveUpdates(_0x53565e[_0x71b3('0x66')],null))['then'](respondWithResult(_0x299c50,null))[_0x71b3('0x24')](handleError(_0x299c50,null));};exports[_0x71b3('0x7e')]=function(_0x5e7ec5,_0x56f5b0){_0x5e7ec5[_0x71b3('0x66')]['customerAvatar']=_0x5e7ec5['file'][_0x71b3('0x7b')];return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x5e7ec5[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x56f5b0,null))[_0x71b3('0x2f')](saveUpdates(_0x5e7ec5[_0x71b3('0x66')],null))[_0x71b3('0x2f')](respondWithResult(_0x56f5b0,null))[_0x71b3('0x24')](handleError(_0x56f5b0,null));};exports[_0x71b3('0x7f')]=function(_0x15d82e,_0x4ec6b2){_0x15d82e[_0x71b3('0x66')]['systemAvatar']=_0x15d82e[_0x71b3('0x7a')][_0x71b3('0x7b')];return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x15d82e[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x4ec6b2,null))[_0x71b3('0x2f')](saveUpdates(_0x15d82e[_0x71b3('0x66')],null))['then'](respondWithResult(_0x4ec6b2,null))['catch'](handleError(_0x4ec6b2,null));};exports[_0x71b3('0x80')]=function(_0x235e62,_0x3e7f22){var _0x123882=path[_0x71b3('0x81')](config[_0x71b3('0x82')],_0x71b3('0x83'));var _0x35e88c={'where':{'id':_0x235e62['params']['id']},'attributes':['id',_0x71b3('0x84')],'raw':!![]};var _0x379081=![];return require(_0x71b3('0x85'))[_0x71b3('0x86')]()[_0x71b3('0x2f')](function(_0x368390){if(_0x368390){_0x379081=_0x368390[_0x71b3('0x87')];}})['then'](function(){return db[_0x71b3('0x4c')]['find'](_0x35e88c);})[_0x71b3('0x2f')](handleEntityNotFound(_0x3e7f22,null))['then'](function(_0x37ad3e){if(_0x37ad3e){if(!_[_0x71b3('0x88')](_0x37ad3e[_0x71b3('0x84')])){if(fs[_0x71b3('0x89')](path[_0x71b3('0x81')](config[_0x71b3('0x82')],_0x71b3('0x8a'),_0x37ad3e[_0x71b3('0x84')]))&&_0x379081){_0x123882=path[_0x71b3('0x81')](config['root'],'server/files/images/logos/',_0x37ad3e[_0x71b3('0x84')]);}}return _0x3e7f22['download'](_0x123882);}})[_0x71b3('0x24')](handleError(_0x3e7f22,null));};exports[_0x71b3('0x8b')]=function(_0x26a5aa,_0x3808d9){var _0x1823d8=path['join'](config[_0x71b3('0x82')],'server/files/images/avatars/default_avatar.png');var _0x1db561={'where':{'id':_0x26a5aa['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x71b3('0x4c')][_0x71b3('0x64')](_0x1db561)[_0x71b3('0x2f')](handleEntityNotFound(_0x3808d9,null))['then'](function(_0x4ad3c7){if(_0x4ad3c7){if(!_[_0x71b3('0x88')](_0x4ad3c7['agentAvatar'])){if(fs['existsSync'](path[_0x71b3('0x81')](config[_0x71b3('0x82')],_0x71b3('0x8c'),_0x4ad3c7[_0x71b3('0x7d')]))){_0x1823d8=path[_0x71b3('0x81')](config[_0x71b3('0x82')],'server/files/images/avatars/',_0x4ad3c7[_0x71b3('0x7d')]);}}return _0x3808d9[_0x71b3('0x8d')](_0x1823d8);}})['catch'](handleError(_0x3808d9,null));};exports[_0x71b3('0x8e')]=function(_0x3e97c9,_0x83f08f){var _0xd8f15a=path[_0x71b3('0x81')](config[_0x71b3('0x82')],_0x71b3('0x8f'));var _0xb64fe7={'where':{'id':_0x3e97c9[_0x71b3('0x6a')]['id']},'attributes':['id',_0x71b3('0x90'),_0x71b3('0x91')],'raw':!![]};return db[_0x71b3('0x4c')][_0x71b3('0x64')](_0xb64fe7)['then'](handleEntityNotFound(_0x83f08f,null))['then'](function(_0x2b1a27){if(_0x2b1a27){if(!_[_0x71b3('0x88')](_0x2b1a27[_0x71b3('0x90')])){if(fs[_0x71b3('0x89')](path[_0x71b3('0x81')](config[_0x71b3('0x82')],_0x71b3('0x8c'),_0x2b1a27['customerAvatar']))&&_0x2b1a27[_0x71b3('0x91')]){_0xd8f15a=path[_0x71b3('0x81')](config['root'],'server/files/images/avatars/',_0x2b1a27[_0x71b3('0x90')]);}}return _0x83f08f[_0x71b3('0x8d')](_0xd8f15a);}})[_0x71b3('0x24')](handleError(_0x83f08f,null));};exports[_0x71b3('0x92')]=function(_0x5daed4,_0xbae6d2){var _0x11da1a=path['join'](config[_0x71b3('0x82')],_0x71b3('0x93'));var _0x201fec={'where':{'id':_0x5daed4['params']['id']},'attributes':['id',_0x71b3('0x94')],'raw':!![]};return db[_0x71b3('0x4c')][_0x71b3('0x64')](_0x201fec)[_0x71b3('0x2f')](handleEntityNotFound(_0xbae6d2,null))[_0x71b3('0x2f')](function(_0x2e8bf1){if(_0x2e8bf1){if(!_[_0x71b3('0x88')](_0x2e8bf1['systemAvatar'])){if(fs[_0x71b3('0x89')](path[_0x71b3('0x81')](config[_0x71b3('0x82')],'server/files/images/avatars/',_0x2e8bf1['systemAvatar']))){_0x11da1a=path['join'](config[_0x71b3('0x82')],_0x71b3('0x8c'),_0x2e8bf1[_0x71b3('0x94')]);}}return _0xbae6d2['download'](_0x11da1a);}})['catch'](handleError(_0xbae6d2,null));};function checkWebsiteInterval(_0x1a1ce7){var _0x17bc32=_0x1a1ce7[_0x71b3('0x95')];if(!_0x17bc32){return Promise[_0x71b3('0x96')](_0x1a1ce7);}var _0x3ddfca=_0x1a1ce7[_0x71b3('0x97')]||undefined;return _0x17bc32[_0x71b3('0x98')](_0x3ddfca)[_0x71b3('0x2f')](function(_0x3414ef){if(!_0x3414ef){throw new APIOutOfIntervalError();}return _0x1a1ce7;});}exports['notify']=function(_0x2bcb9c,_0x4b254f){var _0x206144={'body':_0x2bcb9c[_0x71b3('0x66')],'channel':_0x71b3('0x99')};var _0x40a0f0=[];var _0x1585ce=[];var _0x26a753={};var _0x1d1ca3=![];if(_0x2bcb9c['body']['id']){delete _0x2bcb9c[_0x71b3('0x66')]['id'];}if(_[_0x71b3('0x88')](_0x2bcb9c[_0x71b3('0x66')]['from'])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x71b3('0x88')](_0x2bcb9c['body']['mapKey'])){throw new APIBadRequestError(_0x71b3('0x9a'));}if(_[_0x71b3('0x9b')](_0x2bcb9c['body']['body'])){throw new APIBadRequestError(_0x71b3('0x9c'));}var _0x1d8c95=_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0x3b')]&&_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0x40')];return db[_0x71b3('0x9d')][_0x71b3('0x6b')]()['then'](function(_0x6da073){if(!_0x6da073){throw new Error(_0x71b3('0x9e'));}_0x40a0f0=Object[_0x71b3('0x4f')](_0x6da073)[_0x71b3('0x5a')](function(_0x4dead4){return![_0x71b3('0x9f'),_0x71b3('0xa0')][_0x71b3('0xa1')](_0x4dead4);});_0x1585ce=Object[_0x71b3('0x4f')](_0x6da073)[_0x71b3('0x5a')](function(_0x5c5215){return!['createdAt',_0x71b3('0xa0'),_0x71b3('0xa2'),'ListId'][_0x71b3('0xa1')](_0x5c5215);});if(!_[_0x71b3('0xa1')](_0x1585ce,_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xa3')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x1585ce[_0x71b3('0x81')](',\x20'));}_0x26a753[_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xa3')]]=_0x2bcb9c[_0x71b3('0x66')]['from'];})[_0x71b3('0x2f')](function(){return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x2bcb9c[_0x71b3('0x6a')]['id']},'include':[{'model':db[_0x71b3('0xa4')],'as':_0x71b3('0xa5'),'include':[{'model':db[_0x71b3('0x9d')],'as':_0x71b3('0xa6'),'where':_0x26a753,'limit':0x1,'order':[[_0x71b3('0xa0'),_0x71b3('0xa7')]]}]},{'model':db[_0x71b3('0xa8')],'as':'Applications'},{'model':db[_0x71b3('0x95')],'as':_0x71b3('0x95'),'include':[{'model':db[_0x71b3('0x95')],'as':_0x71b3('0xa9'),'attributes':['id',_0x71b3('0xaa')],'raw':!![]}]}]});})[_0x71b3('0x2f')](function(_0x33c275){if(!_0x33c275){throw new APINotFoundError(util[_0x71b3('0x45')](_0x71b3('0xab'),_0x2bcb9c[_0x71b3('0x6a')]['id']));}if(_0x1d8c95){return checkWebsiteInterval(_0x33c275);}return _0x33c275;})[_0x71b3('0x2f')](function(_0x382077){_0x206144[_0x71b3('0xac')]=_0x382077;_0x206144[_0x71b3('0xad')]=_[_0x71b3('0xae')](_0x382077[_0x71b3('0xaf')],[_0x71b3('0xb0')],['asc']);if(_0x206144[_0x71b3('0xac')][_0x71b3('0xaf')]){delete _0x206144[_0x71b3('0xac')][_0x71b3('0xaf')];}_0x206144['list']=_0x382077['List']||{'id':_0x382077[_0x71b3('0xb1')]};if(_0x206144['list']&&_0x206144[_0x71b3('0xb2')][_0x71b3('0xa6')][_0x71b3('0x54')]){return _0x206144[_0x71b3('0xb2')]['Contacts'][0x0];}var _0x102b93=_['defaults'](_0x2bcb9c[_0x71b3('0x66')],{'firstName':_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xb3')],'ListId':_0x382077[_0x71b3('0xb1')]});_0x102b93[_0x2bcb9c['body'][_0x71b3('0xa3')]]=_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xb3')];return db[_0x71b3('0x9d')][_0x71b3('0x65')](_0x102b93,{'fields':_0x40a0f0,'raw':!![]});})[_0x71b3('0x2f')](function(_0x12aef8){_0x206144[_0x71b3('0xb4')]=_0x12aef8;var _0x8c5df0=createInteractionObject(_0x2bcb9c[_0x71b3('0x6a')]['id'],_0x2bcb9c[_0x71b3('0x66')],_0x2bcb9c[_0x71b3('0xb5')],_0x12aef8);var _0x5ed6ab={'ChatWebsiteId':_0x2bcb9c[_0x71b3('0x6a')]['id']};if(_0x2bcb9c['body'][_0x71b3('0xb6')]){_0x5ed6ab['threadId']=_0x2bcb9c[_0x71b3('0x66')]['threadId'];_0x5ed6ab[_0x71b3('0xb7')]=![];return db[_0x71b3('0xb8')][_0x71b3('0x64')]({'where':_0x5ed6ab})[_0x71b3('0x2f')](function(_0x1d7db6){if(_0x1d7db6){_0x1d1ca3=!![];return _0x1d7db6;}else if(!_0x1d8c95&&_0x1d7db6&&_0x1d7db6[_0x71b3('0xb7')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x8c5df0[_0x71b3('0xb6')]=_0x2bcb9c[_0x71b3('0x66')]['threadId'];_0x8c5df0[_0x71b3('0xb9')]=_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xb9')];return db[_0x71b3('0xb8')][_0x71b3('0x65')](_0x8c5df0);});}_0x5ed6ab[_0x71b3('0xba')]=_0x12aef8['id'];if(_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xbb')]&&_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xbb')]['id']){_0x5ed6ab['id']=_0x2bcb9c['body']['interaction']['id'];return db[_0x71b3('0xb8')][_0x71b3('0x64')]({'where':_0x5ed6ab})[_0x71b3('0x2f')](function(_0x330a65){if(_0x330a65){_0x1d1ca3=!![];return _0x330a65;}return db[_0x71b3('0xb8')][_0x71b3('0x65')](_0x8c5df0);});}return db[_0x71b3('0xb8')][_0x71b3('0x65')](_0x8c5df0);})[_0x71b3('0x2f')](function(_0x2a9e5f){if(!_0x1d1ca3){return _0x2a9e5f;}var _0xebd469={'from':(_0x206144['contact'][_0x71b3('0xbc')]||'')+'\x20'+(_0x206144[_0x71b3('0xb4')][_0x71b3('0xbd')]||'')};if(_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xb6')]&&_0x2bcb9c['body'][_0x71b3('0xbe')]&&_0x2bcb9c[_0x71b3('0x66')]['threadId']!=_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xbe')]){_0xebd469[_0x71b3('0xb6')]=_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xbe')];}return _0x2a9e5f[_0x71b3('0x69')](_0xebd469);})[_0x71b3('0x2f')](function(_0xfb4a84){_0x206144['interaction']=_0xfb4a84[_0x71b3('0x31')]({'plain':!![]});_0x206144[_0x71b3('0xbb')][_0x71b3('0xbf')]=!_0x1d1ca3;if(_0x206144['interaction'][_0x71b3('0xbf')]){if(_0x206144[_0x71b3('0xac')][_0x71b3('0xc0')]){_0x206144[_0x71b3('0xad')][_0x71b3('0xc1')]({'id':0x0,'priority':_0x206144[_0x71b3('0xad')][_0x71b3('0x54')]+0x1,'app':_0x71b3('0xc2'),'appdata':_0x71b3('0xc3'),'interval':'*,*,*,*'});}}return db[_0x71b3('0xc4')][_0x71b3('0x65')]({'body':_0x2bcb9c['body'][_0x71b3('0x66')],'ChatWebsiteId':_0x2bcb9c[_0x71b3('0x6a')]['id'],'ChatInteractionId':_0xfb4a84['id'],'direction':'in','ContactId':_0x206144[_0x71b3('0xb4')]['id'],'AttachmentId':_0x2bcb9c[_0x71b3('0x66')][_0x71b3('0xc5')]});})[_0x71b3('0x2f')](function(_0x5163f0){_0x206144[_0x71b3('0x21')]=_0x5163f0;if(!_0x206144[_0x71b3('0xbb')][_0x71b3('0xc6')]){return;}return db[_0x71b3('0xc7')]['find']({'attributes':['id','name'],'where':{'id':_0x206144[_0x71b3('0xbb')][_0x71b3('0xc6')]}});})['then'](function(_0x131657){if(_0x131657){_0x206144[_0x71b3('0xad')][_0x71b3('0xc8')]({'id':0x0,'priority':0x0,'app':_0x71b3('0xc9'),'appdata':_0x131657['name']+','+(_0x206144[_0x71b3('0xac')][_0x71b3('0xca')]||0xa),'interval':_0x71b3('0xcb')});_0x206144[_0x71b3('0xcc')]=!![];}if(!_0x206144[_0x71b3('0xbb')]['queueId']){return;}return db[_0x71b3('0xcd')][_0x71b3('0x64')]({'attributes':['id',_0x71b3('0x35')],'where':{'id':_0x206144[_0x71b3('0xbb')][_0x71b3('0xce')]}});})[_0x71b3('0x2f')](function(_0x47bed6){if(_0x47bed6){_0x206144[_0x71b3('0xad')][_0x71b3('0xc8')]({'id':0x0,'priority':0x1,'app':_0x71b3('0xcf'),'appdata':_0x47bed6['name']+','+(_0x206144[_0x71b3('0xac')][_0x71b3('0xd0')]||0x12c),'interval':_0x71b3('0xcb')});}return respondWithRpcPromise(_0x71b3('0xd1'),'startRouting',_0x206144);})[_0x71b3('0x2f')](function(_0x20726b){respondWithRpcPromise(_0x71b3('0xd2'),_0x71b3('0xd2'),{'event':'notify','message':_0x20726b},client9002);return _0x20726b;})[_0x71b3('0x2f')](respondWithResult(_0x4b254f,null))[_0x71b3('0x24')](APIHandleError(_0x4b254f));};exports[_0x71b3('0xd3')]=function(_0x5a4e84,_0x1591bd){var _0x34b6c8,_0x366020,_0x3fd304;var _0x33ad6c=[];var _0x1cc2ba={};var _0x5043b2=_0x5a4e84[_0x71b3('0xd4')]||[];var _0xce00ce=[];var _0x1d8e93;return db[_0x71b3('0x9d')]['describe']()[_0x71b3('0x2f')](function(_0x11f5bf){if(!_0x11f5bf){throw new db[(_0x71b3('0xd5'))]['ValidationError'](_0x71b3('0xd6'));}_0x33ad6c=_[_0x71b3('0xd7')](_['keys'](_0x11f5bf),[_0x71b3('0x9f'),'updatedAt','CompanyId',_0x71b3('0xb1')]);if(_0x5a4e84[_0x71b3('0x66')]['id']){delete _0x5a4e84[_0x71b3('0x66')]['id'];}if(_[_0x71b3('0x88')](_0x5a4e84[_0x71b3('0x66')][_0x71b3('0xb3')])){throw _0x1591bd[_0x71b3('0x27')](0x1f4)['send'](new db[(_0x71b3('0xd5'))][(_0x71b3('0xd8'))](_0x71b3('0xd9')));}if(_[_0x71b3('0x88')](_0x5a4e84[_0x71b3('0x66')]['body'])||_0x5a4e84[_0x71b3('0x66')]['body']===''){throw _0x1591bd[_0x71b3('0x27')](0x1f4)[_0x71b3('0x36')](new db[(_0x71b3('0xd5'))][(_0x71b3('0xd8'))](_0x71b3('0xda')));}if(_[_0x71b3('0x88')](_0x5a4e84['body'][_0x71b3('0xdb')])){throw _0x1591bd[_0x71b3('0x27')](0x1f4)[_0x71b3('0x36')](new db[(_0x71b3('0xd5'))][(_0x71b3('0xd8'))](_0x71b3('0xdc')+_0x33ad6c));}if(!_[_0x71b3('0xa1')](_0x33ad6c,_0x5a4e84[_0x71b3('0x66')][_0x71b3('0xdb')])){throw _0x1591bd[_0x71b3('0x27')](0x1f4)['send'](new db['Sequelize'][(_0x71b3('0xd8'))](_0x71b3('0xdd')+_0x33ad6c));}_0x1cc2ba[_0x5a4e84[_0x71b3('0x66')]['mapKeyOffline']]=_0x5a4e84[_0x71b3('0x66')][_0x71b3('0xb3')];})[_0x71b3('0x2f')](function(){return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x5a4e84['params']['id']},'include':[{'model':db[_0x71b3('0xa4')],'as':_0x71b3('0xa5')},{'model':db[_0x71b3('0xde')],'as':_0x71b3('0xde')}]});})['then'](handleEntityNotFound(_0x1591bd,null))[_0x71b3('0x2f')](function(_0xe61f5){if(_0xe61f5&&_0xe61f5[_0x71b3('0xa5')]){_0x366020=_0xe61f5;var _0x329180=_[_0x71b3('0x12')](_0x5a4e84['body'],{'firstName':_0x5a4e84[_0x71b3('0x66')][_0x71b3('0xb3')],'phone':_0x5a4e84[_0x71b3('0x66')][_0x71b3('0xb3')],'ListId':_0xe61f5['ListId']});_0x329180[_0x5a4e84[_0x71b3('0x66')][_0x71b3('0xdb')]]=_0x5a4e84[_0x71b3('0x66')][_0x71b3('0xb3')];return db['CmContact']['findOrCreate']({'where':_0x1cc2ba,'defaults':_0x329180});}})[_0x71b3('0xdf')](function(_0x2363c4){if(_0x2363c4){_0x3fd304=_0x2363c4;var _0x4b2329=fs[_0x71b3('0xe0')](path[_0x71b3('0x81')](config[_0x71b3('0x82')],_0x71b3('0xe1')),'utf8');var _0x34a3e5=ejs['render'](_0x4b2329,{'body':_[_0x71b3('0xe2')](_0x5a4e84[_0x71b3('0x66')][_0x71b3('0x66')]),'bodyTitle':_0x366020['offlineMessageBody']});return db[_0x71b3('0xe3')]['create']({'body':_0x34a3e5,'plainBody':htmlToText[_0x71b3('0xe4')](_0x34a3e5),'ContactId':_0x2363c4['id'],'ChatWebsiteId':_0x366020['id']});}})[_0x71b3('0x2f')](function(_0x174605){_0x1d8e93=_0x174605;if(_0x5043b2['length']){var _0x47f7e6=_0x5043b2[_0x71b3('0x4b')](function(_0x510731){return{'name':_0x510731[_0x71b3('0xe5')],'basename':_0x510731[_0x71b3('0x7b')],'type':_0x510731[_0x71b3('0xe6')],'ChatOfflineMessageId':_0x174605['id']};});_0xce00ce=_0x47f7e6['map'](_0x5d5d98=>{var _0x307fb0={'filename':_0x5d5d98[_0x71b3('0x35')],'path':path[_0x71b3('0x81')](config[_0x71b3('0x82')],'server','files',_0x71b3('0xe7'),'offline-chat',_0x5d5d98[_0x71b3('0xe8')])};return _0x307fb0;});if(!_0x366020[_0x71b3('0xe9')]){return db['sequelize'][_0x71b3('0xea')](function(_0x1b0d44){return db[_0x71b3('0xeb')][_0x71b3('0xec')](_0x47f7e6,{'transaction':_0x1b0d44});});}}})['then'](function(){if(_0x1d8e93){_0x34b6c8=_0x1d8e93;return db['MailAccount'][_0x71b3('0x70')]({'where':{'service':!![]},'include':[{'model':db[_0x71b3('0xed')],'as':_0x71b3('0xee'),'raw':!![],'include':[{'model':db[_0x71b3('0xef')],'as':_0x71b3('0xef'),'raw':!![]}]}]});}})[_0x71b3('0x2f')](function(_0x16cf0e){if(_0x16cf0e&&_0x16cf0e[_0x71b3('0xee')]&&_0x366020[_0x71b3('0xf0')]&&_0x366020[_0x71b3('0xf1')]){var _0x450c60=_0x16cf0e[_0x71b3('0xf2')]();return respondWithRpcPromise(_0x71b3('0xf3'),_0x71b3('0xf4'),{'account':_0x450c60,'message':{'from':util[_0x71b3('0x45')](_0x71b3('0xf5'),_0x16cf0e[_0x71b3('0x35')],_0x16cf0e[_0x71b3('0xf6')]||_0x16cf0e[_0x71b3('0xee')][_0x71b3('0x67')]),'to':_0x366020['forwardOfflineAddress'],'subject':_0x366020[_0x71b3('0xf7')],'html':_0x34b6c8[_0x71b3('0x66')],'attachments':_0xce00ce}},client9003)['then'](function(){return _0x34b6c8;})[_0x71b3('0x24')](function(_0x3bc3eb){logger[_0x71b3('0x1f')](_0x3bc3eb);});}})[_0x71b3('0x2f')](function(){if(_0x366020&&_0x366020[_0x71b3('0xe9')]&&_0x366020[_0x71b3('0xf8')]){var _0x398e6c=[];if(_0x5043b2[_0x71b3('0x54')]){_0x398e6c=_0x5043b2[_0x71b3('0x4b')](function(_0x4c846e){return{'name':_0x4c846e['originalname'],'basename':_0x4c846e['filename'],'type':_0x4c846e['mimetype'],'ChatOfflineMessageId':_0x1d8e93['id']};});}var _0x17f243;if(!_['isNil'](_0x366020['subjectOffline'])){var _0x1a9375=_[_0x71b3('0x4b')](_0x5a4e84[_0x71b3('0x66')],function(_0x35eb0a){return _0x35eb0a;});var _0xd1b28a=_['toPairsIn'](_0x1a9375)[0x0];var _0x566462=_['mapValues'](_0xd1b28a,function(_0x54f641){return _0x54f641;});_0x17f243=_0x566462[0x1][_0x366020[_0x71b3('0xf9')]];}var _0x5673c5={'from':_0x3fd304[_0x71b3('0xf6')],'firstName':_0x3fd304[_0x71b3('0xbc')],'lastName':_0x3fd304[_0x71b3('0xbd')],'mapKey':'email','message':{'from':_0x3fd304[_0x71b3('0xf6')],'to':_0x366020[_0x71b3('0xde')][_0x71b3('0xf6')],'cc':'','subject':_[_0x71b3('0x88')](_0x17f243)?_0x366020[_0x71b3('0xf7')]:_0x17f243,'messageId':'','sentAt':new Date(),'attach':_0x398e6c[_0x71b3('0x54')],'attachments':_0x398e6c,'originChannel':_0x71b3('0xfa'),'ChatWebsiteId':_0x366020['id'],'ChatOfflineMessageId':_0x34b6c8['id'],'originTo':_0x366020[_0x71b3('0xde')][_0x71b3('0xf6')]},'body':_0x34b6c8[_0x71b3('0x66')]};var _0xea2bbd={'account':{'id':_0x366020['MailAccountId']},'body':_0x5673c5,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x71b3('0xfb'),_0x71b3('0xfc'),_0xea2bbd,client9001)[_0x71b3('0x2f')](function(){return _0x34b6c8;})[_0x71b3('0x24')](function(_0x12df09){logger[_0x71b3('0x1f')](_0x12df09);});}return;})[_0x71b3('0x2f')](function(){if(_0x34b6c8){return _0x34b6c8;}})[_0x71b3('0x2f')](respondWithResult(_0x1591bd,null))[_0x71b3('0x24')](function(){for(var _0x2cb912 of _0x5043b2){var _0x82f256=path[_0x71b3('0x81')](config[_0x71b3('0x82')],_0x71b3('0xfd'),_0x71b3('0xd4'),'attachments',_0x71b3('0xfe'),_0x2cb912[_0x71b3('0x7b')]);fs_extra[_0x71b3('0xff')](_0x82f256)[_0x71b3('0x24')](function(_0x3b6f23){logger[_0x71b3('0x1f')](_0x71b3('0x100'),_0x82f256,_0x3b6f23);});}});};exports[_0x71b3('0x101')]=function(_0x500e50,_0x2b236){return db[_0x71b3('0xb8')][_0x71b3('0x64')]({'where':{'id':_0x500e50['params']['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x2b236,null))[_0x71b3('0x2f')](function(_0x2304f2){if(_0x2304f2){return _0x2304f2[_0x71b3('0x101')](_0x500e50['body'][_0x71b3('0x74')],_[_0x71b3('0x102')](_0x500e50[_0x71b3('0x66')],[_0x71b3('0x74'),'id'])||{});}})[_0x71b3('0x2f')](respondWithResult(_0x2b236,null))[_0x71b3('0x24')](handleError(_0x2b236,null));};exports[_0x71b3('0x103')]=function(_0x5b36e4,_0x557020){var _0x5cfe43={'raw':![],'where':{}};var _0x5ee00a={};var _0x6614dd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x71b3('0x70')]({'where':{'id':_0x5b36e4[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x557020,null))['then'](function(_0x531cb2){if(_0x531cb2){_0x5ee00a['model']=_[_0x71b3('0x4f')](db[_0x71b3('0xb8')]['rawAttributes']);_0x5ee00a[_0x71b3('0x4e')]=_[_0x71b3('0x4f')](_0x5b36e4[_0x71b3('0x4e')]);_0x5ee00a[_0x71b3('0x50')]=_[_0x71b3('0x51')](_0x5ee00a['model'],_0x5ee00a[_0x71b3('0x4e')]);_0x5cfe43['attributes']=_[_0x71b3('0x51')](_0x5ee00a[_0x71b3('0x46')],qs[_0x71b3('0x53')](_0x5b36e4['query'][_0x71b3('0x53')]));_0x5cfe43['attributes']=_0x5cfe43[_0x71b3('0x52')][_0x71b3('0x54')]?_0x5cfe43[_0x71b3('0x52')]:_0x5ee00a[_0x71b3('0x46')];if(!_0x5b36e4[_0x71b3('0x4e')][_0x71b3('0x55')](_0x71b3('0x56'))){_0x5cfe43[_0x71b3('0x2a')]=qs[_0x71b3('0x2a')](_0x5b36e4[_0x71b3('0x4e')]['limit']);_0x5cfe43[_0x71b3('0x2c')]=qs[_0x71b3('0x2c')](_0x5b36e4['query'][_0x71b3('0x2c')]);}_0x5cfe43[_0x71b3('0x71')]=qs[_0x71b3('0x57')](_0x5b36e4[_0x71b3('0x4e')][_0x71b3('0x57')]);_0x5cfe43[_0x71b3('0x58')]=qs[_0x71b3('0x50')](_[_0x71b3('0x59')](_0x5b36e4[_0x71b3('0x4e')],_0x5ee00a[_0x71b3('0x50')]));_0x5cfe43[_0x71b3('0x58')][_0x71b3('0x6d')]=_0x531cb2['id'];if(_0x5b36e4[_0x71b3('0x4e')][_0x71b3('0x5a')]){_0x5cfe43[_0x71b3('0x58')]=_[_0x71b3('0x5b')](_0x5cfe43['where'],{'$or':_[_0x71b3('0x4b')](_0x5cfe43['attributes'],function(_0x321d77){var _0x1b4ae0={};_0x1b4ae0[_0x321d77]={'$like':'%'+_0x5b36e4['query'][_0x71b3('0x5a')]+'%'};return _0x1b4ae0;})});}_0x5cfe43=_[_0x71b3('0x5b')]({},_0x5cfe43,_0x5b36e4[_0x71b3('0x5d')]);return db[_0x71b3('0xb8')][_0x71b3('0x2b')]({'where':_0x5cfe43[_0x71b3('0x58')]})[_0x71b3('0x2f')](function(_0x5320ef){_0x6614dd[_0x71b3('0x2b')]=_0x5320ef;if(_0x5b36e4[_0x71b3('0x4e')][_0x71b3('0x5e')]){_0x5cfe43[_0x71b3('0x5f')]=[{'model':db['CmContact'],'as':_0x71b3('0x104'),'required':![]},{'model':db[_0x71b3('0xc7')],'as':_0x71b3('0x105'),'attributes':['name',_0x71b3('0x106'),_0x71b3('0x107')],'required':![]},{'model':db[_0x71b3('0x108')],'as':_0x71b3('0x109'),'attributes':['id','name',_0x71b3('0x10a')],'where':_0x5b36e4[_0x71b3('0x4e')][_0x71b3('0x10b')]?{'id':_0x5b36e4[_0x71b3('0x4e')]['tag']}:undefined,'required':_0x5b36e4[_0x71b3('0x4e')][_0x71b3('0x10b')]?!![]:![]}];}return db[_0x71b3('0xb8')][_0x71b3('0x72')](_0x5cfe43);})[_0x71b3('0x2f')](function(_0x34f457){_0x6614dd[_0x71b3('0x60')]=_0x34f457;return _0x6614dd;});}})[_0x71b3('0x2f')](respondWithFilteredResult(_0x557020,_0x5cfe43))[_0x71b3('0x24')](handleError(_0x557020,null));};exports[_0x71b3('0x10c')]=function(_0x28325f,_0x26ce0b){var _0x53a049=0x0;var _0x5c9840=0x0;var _0x16ebc1=![];var _0x5687ff;var _0x32462c;return db[_0x71b3('0x4c')]['find']({'where':{'id':_0x28325f[_0x71b3('0x6a')]['id']},'include':[{'model':db[_0x71b3('0x95')],'as':_0x71b3('0x95'),'include':[{'model':db[_0x71b3('0x95')],'as':_0x71b3('0xa9'),'attributes':['id',_0x71b3('0xaa')]}]}]})[_0x71b3('0x2f')](handleEntityNotFound(_0x26ce0b,null))[_0x71b3('0x2f')](function(_0x1f538d){if(_0x1f538d){_0x5687ff=_0x1f538d;return _0x1f538d[_0x71b3('0x10d')]({'raw':!![]});}})[_0x71b3('0x2f')](function(_0x542a4d){if(_0x5687ff){if(_0x542a4d){_0x32462c=_0x542a4d;}}return require(_0x71b3('0x85'))[_0x71b3('0x86')]();})[_0x71b3('0x2f')](function(_0x586554){if(_0x586554){_0x5c9840=_0x586554[_0x71b3('0x10e')];_0x16ebc1=_0x586554['custom'];}})['then'](function(){return db[_0x71b3('0xb8')][_0x71b3('0x2b')]({'where':{'closed':![]}});})[_0x71b3('0x2f')](function(_0x167490){_0x53a049=_0x167490;if(_0x5c9840&&_0x167490>_0x5c9840){return db[_0x71b3('0x10f')]['findOne']({'where':{'id':0x1}})[_0x71b3('0x2f')](function(_0x78b796){if(_0x78b796){_0x78b796[_0x71b3('0x110')](_0x71b3('0x111'));}});}})['then'](function(){var _0x1b0bd6=_0x5687ff['Interval'];var _0xf95335=_0x5687ff[_0x71b3('0x97')]||undefined;return _0x1b0bd6?_0x1b0bd6[_0x71b3('0x98')](_0xf95335):!![];})[_0x71b3('0x2f')](function(_0x52b309){var _0xfe12f7=fs[_0x71b3('0xe0')](path['join'](config[_0x71b3('0x82')],_0x71b3('0x112')),'utf8');var _0x5676d2=new url[(_0x71b3('0x113'))](_0x5687ff[_0x71b3('0x114')])['origin'];var _0x2f03e5=_0x71b3('0x115');var _0x57b2b2=![];var _0x52859b={'chatVersion':_0x2f03e5,'chatWebsiteAddressOrigin':_0x5676d2,'remote':_0x5687ff[_0x71b3('0x116')],'query':querystring['stringify'](_['merge'](_0x5687ff[_0x71b3('0x31')]({'plain':!![]}),{'customerIp':_0x28325f['headers'][_0x71b3('0x3c')]||_0x28325f[_0x71b3('0xb5')][_0x71b3('0x117')]||_0x28325f[_0x71b3('0x118')][_0x71b3('0x119')]||_0x28325f['ip'],'referer':_0x28325f[_0x71b3('0xb5')][_0x71b3('0x40')],'openedInteractions':_0x53a049,'maxInteractions':_0x5c9840,'virtual':_0x16ebc1[_0x71b3('0x10e')],'online':_0x52b309,'custom':_0x16ebc1}))[_0x71b3('0x11a')](/'/g,'\x5c\x27')};_0x26ce0b['send'](ejs[_0x71b3('0x11b')](Mustache[_0x71b3('0x11b')](_0xfe12f7,_0x52859b),{'proactiveActions':_0x32462c,'alignment':_0x5687ff['alignment'],'verticalAlignment':_0x5687ff[_0x71b3('0x11c')],'div_color':_0x5687ff[_0x71b3('0x10a')],'labelText':_0x5687ff[_0x71b3('0x11d')],'text_color':_0x5687ff[_0x71b3('0x11e')],'text_button_color':_0x5687ff['textButtonColor'],'button_color':_0x5687ff['color_button'],'background_color':_0x5687ff['backgroundColor'],'hideWhenOffline':_0x5687ff[_0x71b3('0x11f')],'intervalId':_0x5687ff['IntervalId'],'isDevelopment':_0x57b2b2,'chatVersion':_0x2f03e5}));})[_0x71b3('0x24')](handleError(_0x26ce0b,null));};exports[_0x71b3('0x120')]=function(_0x4a43af,_0x2037b8){var _0xfd7c23=_0x4a43af[_0x71b3('0x6a')]['id'];var _0x4a66e2=_0x4a43af['body'];var _0x506395=0xc8;var _0x4a5fbb=null;return db[_0x71b3('0x121')][_0x71b3('0xea')]({'isolationLevel':db['sequelize'][_0x71b3('0x122')][_0x71b3('0x123')][_0x71b3('0x124')]},function(_0xc8154c){return db['ChatWebsite'][_0x71b3('0x70')]({'where':{'id':_0xfd7c23},'transaction':_0xc8154c})[_0x71b3('0x2f')](function(_0x5f5ad9){if(_0x5f5ad9){return db[_0x71b3('0xa8')][_0x71b3('0x30')]({'where':{'ChatWebsiteId':_0xfd7c23},'transaction':_0xc8154c})[_0x71b3('0x2f')](function(){var _0x40b2d1=_[_0x71b3('0x4b')](_0x4a66e2,function(_0x5f0395){_0x5f0395['ChatWebsiteId']=_0xfd7c23;return _0x5f0395;});return db[_0x71b3('0xa8')]['bulkCreate'](_0x40b2d1,{'transaction':_0xc8154c});});}else{_0x506395=0x194;_0x4a5fbb=[];}});})[_0x71b3('0x2f')](function(){if(_0x506395!==0x194){return db[_0x71b3('0xa8')][_0x71b3('0x125')]({'where':{'ChatWebsiteId':_0xfd7c23},'order':_0x71b3('0xb0')})[_0x71b3('0x2f')](function(_0x4329ed){_0x4a5fbb=_0x4329ed;});}})['catch'](function(_0x47721f){_0x506395=0x1f4;logger[_0x71b3('0x1f')](_0x47721f[_0x71b3('0x34')]);if(_0x47721f[_0x71b3('0x35')]){delete _0x47721f[_0x71b3('0x35')];}_0x4a5fbb=_0x47721f;})[_0x71b3('0x126')](function(){if(_0x4a5fbb===null){_0x2037b8[_0x71b3('0x25')](_0x506395);}else{if(_0x506395===0x1f4){_0x2037b8[_0x71b3('0x27')](_0x506395)[_0x71b3('0x36')](_0x4a5fbb);}else{_0x2037b8[_0x71b3('0x27')](_0x506395)[_0x71b3('0x28')](_0x4a5fbb);}}});};exports[_0x71b3('0x127')]=function(_0x18201b,_0x48359b){var _0xfc5f35={};var _0x4ab338={};var _0x31b1ef;var _0x53910e;return db['ChatWebsite'][_0x71b3('0x70')]({'where':{'id':_0x18201b['params']['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x48359b,null))[_0x71b3('0x2f')](function(_0x4aa3ca){if(_0x4aa3ca){_0x31b1ef=_0x4aa3ca;_0x4ab338[_0x71b3('0x46')]=_['keys'](db[_0x71b3('0xa8')][_0x71b3('0x63')]);_0x4ab338[_0x71b3('0x4e')]=_[_0x71b3('0x4f')](_0x18201b[_0x71b3('0x4e')]);_0x4ab338[_0x71b3('0x50')]=_[_0x71b3('0x51')](_0x4ab338[_0x71b3('0x46')],_0x4ab338[_0x71b3('0x4e')]);_0xfc5f35[_0x71b3('0x52')]=_['intersection'](_0x4ab338['model'],qs[_0x71b3('0x53')](_0x18201b['query'][_0x71b3('0x53')]));_0xfc5f35[_0x71b3('0x52')]=_0xfc5f35[_0x71b3('0x52')]['length']?_0xfc5f35[_0x71b3('0x52')]:_0x4ab338[_0x71b3('0x46')];_0xfc5f35[_0x71b3('0x71')]=qs[_0x71b3('0x57')](_0x18201b['query'][_0x71b3('0x57')]);_0xfc5f35[_0x71b3('0x58')]=qs[_0x71b3('0x50')](_[_0x71b3('0x59')](_0x18201b['query'],_0x4ab338[_0x71b3('0x50')]));if(_0x18201b[_0x71b3('0x4e')][_0x71b3('0x5a')]){_0xfc5f35[_0x71b3('0x58')]=_['merge'](_0xfc5f35['where'],{'$or':_[_0x71b3('0x4b')](_0xfc5f35[_0x71b3('0x52')],function(_0x1e3aca){var _0x1c856e={};_0x1c856e[_0x1e3aca]={'$like':'%'+_0x18201b[_0x71b3('0x4e')]['filter']+'%'};return _0x1c856e;})});}_0xfc5f35=_[_0x71b3('0x5b')]({},_0xfc5f35,_0x18201b[_0x71b3('0x5d')]);return _0x31b1ef[_0x71b3('0x127')](_0xfc5f35);}})['then'](function(_0x124165){if(_0x124165){_0x53910e=_0x124165['length'];if(!_0x18201b['query']['hasOwnProperty'](_0x71b3('0x56'))){_0xfc5f35[_0x71b3('0x2a')]=qs[_0x71b3('0x2a')](_0x18201b[_0x71b3('0x4e')]['limit']);_0xfc5f35[_0x71b3('0x2c')]=qs['offset'](_0x18201b[_0x71b3('0x4e')]['offset']);}return _0x31b1ef[_0x71b3('0x127')](_0xfc5f35);}})[_0x71b3('0x2f')](function(_0x13f4c1){if(_0x13f4c1){return _0x13f4c1?{'count':_0x53910e,'rows':_0x13f4c1}:null;}})[_0x71b3('0x2f')](respondWithResult(_0x48359b,null))[_0x71b3('0x24')](handleError(_0x48359b,null));};exports[_0x71b3('0x128')]=function(_0xfc344,_0x3f2ffd){return db[_0x71b3('0x129')][_0x71b3('0x64')]({'where':{'id':_0xfc344[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x3f2ffd,null))[_0x71b3('0x2f')](function(_0x222ec3){if(_0x222ec3){return _0x222ec3[_0x71b3('0x128')](_0xfc344['body']['ids'],_[_0x71b3('0x102')](_0xfc344['body'],[_0x71b3('0x74'),'id'])||{});}})[_0x71b3('0x2f')](respondWithResult(_0x3f2ffd,null))[_0x71b3('0x24')](handleError(_0x3f2ffd,null));};exports['getProactiveActions']=function(_0x379597,_0x4e7568){var _0x477c19={};var _0x3bc2c3={};var _0x3d11e8;var _0x305091;return db[_0x71b3('0x4c')][_0x71b3('0x70')]({'where':{'id':_0x379597[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x4e7568,null))[_0x71b3('0x2f')](function(_0x33cd50){if(_0x33cd50){_0x3d11e8=_0x33cd50;_0x3bc2c3[_0x71b3('0x46')]=_[_0x71b3('0x4f')](db[_0x71b3('0x12a')][_0x71b3('0x63')]);_0x3bc2c3[_0x71b3('0x4e')]=_[_0x71b3('0x4f')](_0x379597['query']);_0x3bc2c3[_0x71b3('0x50')]=_['intersection'](_0x3bc2c3['model'],_0x3bc2c3[_0x71b3('0x4e')]);_0x477c19[_0x71b3('0x52')]=_['intersection'](_0x3bc2c3[_0x71b3('0x46')],qs[_0x71b3('0x53')](_0x379597['query'][_0x71b3('0x53')]));_0x477c19[_0x71b3('0x52')]=_0x477c19[_0x71b3('0x52')][_0x71b3('0x54')]?_0x477c19[_0x71b3('0x52')]:_0x3bc2c3[_0x71b3('0x46')];_0x477c19[_0x71b3('0x71')]=qs[_0x71b3('0x57')](_0x379597['query'][_0x71b3('0x57')]);_0x477c19[_0x71b3('0x58')]=qs[_0x71b3('0x50')](_[_0x71b3('0x59')](_0x379597[_0x71b3('0x4e')],_0x3bc2c3[_0x71b3('0x50')]));if(_0x379597[_0x71b3('0x4e')]['filter']){_0x477c19[_0x71b3('0x58')]=_[_0x71b3('0x5b')](_0x477c19[_0x71b3('0x58')],{'$or':_[_0x71b3('0x4b')](_0x477c19[_0x71b3('0x52')],function(_0x133bdc){var _0x16c88f={};_0x16c88f[_0x133bdc]={'$like':'%'+_0x379597[_0x71b3('0x4e')][_0x71b3('0x5a')]+'%'};return _0x16c88f;})});}_0x477c19=_[_0x71b3('0x5b')]({},_0x477c19,_0x379597['options']);return _0x3d11e8[_0x71b3('0x10d')](_0x477c19);}})[_0x71b3('0x2f')](function(_0xa6cb1d){if(_0xa6cb1d){_0x305091=_0xa6cb1d[_0x71b3('0x54')];if(!_0x379597[_0x71b3('0x4e')]['hasOwnProperty'](_0x71b3('0x56'))){_0x477c19['limit']=qs[_0x71b3('0x2a')](_0x379597[_0x71b3('0x4e')]['limit']);_0x477c19['offset']=qs[_0x71b3('0x2c')](_0x379597['query'][_0x71b3('0x2c')]);}return _0x3d11e8[_0x71b3('0x10d')](_0x477c19);}})[_0x71b3('0x2f')](function(_0x3e709d){if(_0x3e709d){return _0x3e709d?{'count':_0x305091,'rows':_0x3e709d}:null;}})[_0x71b3('0x2f')](respondWithResult(_0x4e7568,null))['catch'](handleError(_0x4e7568,null));};exports['getFields']=function(_0x6c1ad5,_0x2133e7){var _0x4c8fff=_0x6c1ad5[_0x71b3('0x4e')][_0x71b3('0x12b')]===_0x71b3('0x12c')?'offlineForm':_0x71b3('0x12d');return db['ChatWebsite'][_0x71b3('0x64')]({'attributes':['id',_0x4c8fff],'where':{'id':_0x6c1ad5['params']['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x2133e7,null))[_0x71b3('0x2f')](function(_0x2f693a){if(_0x2f693a){var _0x4028d7=_0x2f693a[_0x4c8fff];var _0x273664=_0x4028d7&&_0x4028d7[_0x71b3('0x12e')]?_0x4028d7['items']:[];_0x2133e7[_0x71b3('0x36')]({'fromKey':_[_0x71b3('0x88')](_0x4028d7['fromKey'])?undefined:_0x4028d7[_0x71b3('0x12f')],'count':_0x273664[_0x71b3('0x54')],'rows':_0x273664});}})[_0x71b3('0x24')](handleError(_0x2133e7,null));};exports['getOfflineMessages']=function(_0xf6875f,_0xfb7ef7){var _0x404214={'raw':![],'where':{}};var _0x1fea92={};var _0x1aa2c4={'count':0x0,'rows':[]};return db[_0x71b3('0x4c')][_0x71b3('0x70')]({'where':{'id':_0xf6875f['params']['id']}})['then'](handleEntityNotFound(_0xfb7ef7,null))[_0x71b3('0x2f')](function(_0x1857be){if(_0x1857be){_0x1fea92['model']=_[_0x71b3('0x4f')](db['ChatOfflineMessage'][_0x71b3('0x63')]);_0x1fea92[_0x71b3('0x4e')]=_[_0x71b3('0x4f')](_0xf6875f[_0x71b3('0x4e')]);_0x1fea92[_0x71b3('0x50')]=_['intersection'](_0x1fea92[_0x71b3('0x46')],_0x1fea92[_0x71b3('0x4e')]);_0x404214[_0x71b3('0x52')]=_[_0x71b3('0x51')](_0x1fea92[_0x71b3('0x46')],qs[_0x71b3('0x53')](_0xf6875f[_0x71b3('0x4e')]['fields']));_0x404214[_0x71b3('0x52')]=_0x404214[_0x71b3('0x52')]['length']?_0x404214['attributes']:_0x1fea92[_0x71b3('0x46')];if(!_0xf6875f['query'][_0x71b3('0x55')](_0x71b3('0x56'))){_0x404214[_0x71b3('0x2a')]=qs[_0x71b3('0x2a')](_0xf6875f[_0x71b3('0x4e')][_0x71b3('0x2a')]);_0x404214[_0x71b3('0x2c')]=qs[_0x71b3('0x2c')](_0xf6875f[_0x71b3('0x4e')][_0x71b3('0x2c')]);}_0x404214[_0x71b3('0x71')]=qs[_0x71b3('0x57')](_0xf6875f[_0x71b3('0x4e')][_0x71b3('0x57')]);_0x404214['where']=qs[_0x71b3('0x50')](_[_0x71b3('0x59')](_0xf6875f[_0x71b3('0x4e')],_0x1fea92[_0x71b3('0x50')]));_0x404214[_0x71b3('0x58')][_0x71b3('0x6d')]=_0x1857be['id'];if(_0xf6875f['query'][_0x71b3('0x5a')]){_0x404214[_0x71b3('0x58')]=_[_0x71b3('0x5b')](_0x404214[_0x71b3('0x58')],{'$or':_['map'](_0x404214[_0x71b3('0x52')],function(_0x45c066){var _0x31f908={};_0x31f908[_0x45c066]={'$like':'%'+_0xf6875f[_0x71b3('0x4e')][_0x71b3('0x5a')]+'%'};return _0x31f908;})});}_0x404214=_[_0x71b3('0x5b')]({},_0x404214,_0xf6875f[_0x71b3('0x5d')]);return db[_0x71b3('0xe3')]['count']({'where':_0x404214['where']})['then'](function(_0xa42264){_0x1aa2c4['count']=_0xa42264;if(_0xf6875f[_0x71b3('0x4e')][_0x71b3('0x5e')]){_0x404214[_0x71b3('0x5f')]=[{'all':!![]}];}else{_0x404214[_0x71b3('0x5f')]=[{'model':db[_0x71b3('0x9d')],'as':_0x71b3('0x104'),'required':![]},{'model':db[_0x71b3('0xeb')],'as':'Attachments','required':![]}];}return db[_0x71b3('0xe3')][_0x71b3('0x72')](_0x404214);})[_0x71b3('0x2f')](function(_0x13de65){_0x1aa2c4['rows']=_0x13de65;return _0x1aa2c4;});}})['then'](respondWithFilteredResult(_0xfb7ef7,_0x404214))[_0x71b3('0x24')](handleError(_0xfb7ef7,null));};exports[_0x71b3('0x130')]=function(_0x56ff49,_0xd554a5){return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x56ff49[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0xd554a5,null))[_0x71b3('0x2f')](function(_0x2df75c){if(_0x2df75c){return _0x2df75c[_0x71b3('0x130')](_0x56ff49[_0x71b3('0x66')][_0x71b3('0x74')],_[_0x71b3('0x102')](_0x56ff49[_0x71b3('0x66')],['ids','id'])||{})['spread'](function(_0x3204c4){for(var _0x9f0190=0x0;_0x9f0190<_0x56ff49[_0x71b3('0x66')]['ids']['length'];_0x9f0190+=0x1){socket[_0x71b3('0x131')](_0x71b3('0x132'),{'UserId':Number(_0x56ff49['body'][_0x71b3('0x74')][_0x9f0190]),'ChatWebsiteId':Number(_0x56ff49['params']['id'])});}return _0x3204c4;});}})[_0x71b3('0x2f')](respondWithResult(_0xd554a5,null))[_0x71b3('0x24')](handleError(_0xd554a5,null));};exports[_0x71b3('0x133')]=function(_0x2dfc3f,_0x21accd){return db[_0x71b3('0x4c')][_0x71b3('0x64')]({'where':{'id':_0x2dfc3f[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0x21accd,null))[_0x71b3('0x2f')](function(_0x4f0bf9){if(_0x4f0bf9){return _0x4f0bf9[_0x71b3('0x133')](_0x2dfc3f[_0x71b3('0x4e')][_0x71b3('0x74')])[_0x71b3('0x2f')](function(){if(_[_0x71b3('0x134')](_0x2dfc3f[_0x71b3('0x4e')][_0x71b3('0x74')])){for(var _0x547f32=0x0;_0x547f32<_0x2dfc3f[_0x71b3('0x4e')]['ids'][_0x71b3('0x54')];_0x547f32+=0x1){socket['emit'](_0x71b3('0x135'),{'UserId':Number(_0x2dfc3f['query'][_0x71b3('0x74')][_0x547f32]),'ChatWebsiteId':Number(_0x2dfc3f[_0x71b3('0x6a')]['id'])});}}else{socket[_0x71b3('0x131')]('userChatWebsite:remove',{'UserId':Number(_0x2dfc3f[_0x71b3('0x4e')]['ids']),'ChatWebsiteId':Number(_0x2dfc3f[_0x71b3('0x6a')]['id'])});}});}})[_0x71b3('0x2f')](respondWithStatusCode(_0x21accd,null))[_0x71b3('0x24')](handleError(_0x21accd,null));};exports['getAgents']=function(_0x468841,_0xda2964){var _0x1ea682={};var _0x3bffd6={};var _0x44fbd5;var _0x1a2fd0;return db[_0x71b3('0x4c')][_0x71b3('0x70')]({'where':{'id':_0x468841[_0x71b3('0x6a')]['id']}})[_0x71b3('0x2f')](handleEntityNotFound(_0xda2964,null))[_0x71b3('0x2f')](function(_0x3b308f){if(_0x3b308f){_0x44fbd5=_0x3b308f;_0x3bffd6['model']=_[_0x71b3('0x4f')](db[_0x71b3('0xc7')]['rawAttributes']);_0x3bffd6[_0x71b3('0x4e')]=_[_0x71b3('0x4f')](_0x468841[_0x71b3('0x4e')]);_0x3bffd6[_0x71b3('0x50')]=_['intersection'](_0x3bffd6[_0x71b3('0x46')],_0x3bffd6[_0x71b3('0x4e')]);_0x1ea682[_0x71b3('0x52')]=_['intersection'](_0x3bffd6['model'],qs['fields'](_0x468841[_0x71b3('0x4e')][_0x71b3('0x53')]));_0x1ea682[_0x71b3('0x52')]=_0x1ea682[_0x71b3('0x52')][_0x71b3('0x54')]?_0x1ea682[_0x71b3('0x52')]:_0x3bffd6[_0x71b3('0x46')];_0x1ea682[_0x71b3('0x71')]=qs[_0x71b3('0x57')](_0x468841[_0x71b3('0x4e')]['sort']);_0x1ea682[_0x71b3('0x58')]=qs[_0x71b3('0x50')](_['pick'](_0x468841['query'],_0x3bffd6[_0x71b3('0x50')]));if(_0x468841['query'][_0x71b3('0x5a')]){_0x1ea682[_0x71b3('0x58')]=_['merge'](_0x1ea682[_0x71b3('0x58')],{'$or':_[_0x71b3('0x4b')](_0x1ea682['attributes'],function(_0xd574f8){var _0x395ad4={};_0x395ad4[_0xd574f8]={'$like':'%'+_0x468841[_0x71b3('0x4e')]['filter']+'%'};return _0x395ad4;})});}_0x1ea682=_[_0x71b3('0x5b')]({},_0x1ea682,_0x468841[_0x71b3('0x5d')]);return _0x44fbd5[_0x71b3('0x136')](_0x1ea682);}})[_0x71b3('0x2f')](function(_0x3bd2d1){if(_0x3bd2d1){_0x1a2fd0=_0x3bd2d1['length'];if(!_0x468841['query']['hasOwnProperty'](_0x71b3('0x56'))){_0x1ea682[_0x71b3('0x2a')]=qs['limit'](_0x468841[_0x71b3('0x4e')][_0x71b3('0x2a')]);_0x1ea682[_0x71b3('0x2c')]=qs[_0x71b3('0x2c')](_0x468841['query']['offset']);}return _0x44fbd5[_0x71b3('0x136')](_0x1ea682);}})[_0x71b3('0x2f')](function(_0x3d8985){if(_0x3d8985){return _0x3d8985?{'count':_0x1a2fd0,'rows':_0x3d8985}:null;}})[_0x71b3('0x2f')](respondWithResult(_0xda2964,null))['catch'](handleError(_0xda2964,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 8cddbae..e1611e0 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 _0x8388=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hook'];(function(_0x51c44d,_0x387aa4){var _0x4ed5a9=function(_0x3c6c33){while(--_0x3c6c33){_0x51c44d['push'](_0x51c44d['shift']());}};_0x4ed5a9(++_0x387aa4);}(_0x8388,0x18d));var _0x8838=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x8388[_0x13b392];return _0x39db24;};'use strict';var EventEmitter=require(_0x8838('0x0'));var ChatWebsite=require(_0x8838('0x1'))['db'][_0x8838('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8838('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8838('0x4'),'afterDestroy':_0x8838('0x5')};function emitEvent(_0x316297){return function(_0x20a813,_0xd474f2,_0x5036bd){ChatWebsiteEvents[_0x8838('0x6')](_0x316297+':'+_0x20a813['id'],_0x20a813);ChatWebsiteEvents[_0x8838('0x6')](_0x316297,_0x20a813);_0x5036bd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x8838('0x7')](e,emitEvent(event));}}module[_0x8838('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x64f5=['remove','emit','hasOwnProperty','exports','events','save'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x64f5,0x17e));var _0x564f=function(_0x2cc5ab,_0x158ac0){_0x2cc5ab=_0x2cc5ab-0x0;var _0x415e0b=_0x64f5[_0x2cc5ab];return _0x415e0b;};'use strict';var EventEmitter=require(_0x564f('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x564f('0x1'),'afterUpdate':'update','afterDestroy':_0x564f('0x2')};function emitEvent(_0x1594b5){return function(_0x59c424,_0x2607d6,_0x23328d){ChatWebsiteEvents[_0x564f('0x3')](_0x1594b5+':'+_0x59c424['id'],_0x59c424);ChatWebsiteEvents[_0x564f('0x3')](_0x1594b5,_0x59c424);_0x23328d(null);};}for(var e in events){if(events[_0x564f('0x4')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x564f('0x5')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 9824f81..15681c2 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 _0x4e1e=['../../config/environment','exports','define','ChatWebsite','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x3df1c2,_0x1d32db){var _0x70d3e8=function(_0x314e20){while(--_0x314e20){_0x3df1c2['push'](_0x3df1c2['shift']());}};_0x70d3e8(++_0x1d32db);}(_0x4e1e,0x7c));var _0xe4e1=function(_0x41699c,_0x317092){_0x41699c=_0x41699c-0x0;var _0xb1e0ad=_0x4e1e[_0x41699c];return _0xb1e0ad;};'use strict';var _=require('lodash');var util=require(_0xe4e1('0x0'));var logger=require(_0xe4e1('0x1'))(_0xe4e1('0x2'));var moment=require('moment');var BPromise=require(_0xe4e1('0x3'));var rp=require(_0xe4e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4e1('0x5'));var config=require(_0xe4e1('0x6'));var attributes=require('./chatWebsite.attributes');module[_0xe4e1('0x7')]=function(_0x258a07,_0xd2d2f8){return _0x258a07[_0xe4e1('0x8')](_0xe4e1('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd50a=['rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x23d50b,_0x4ea290){var _0x19abbf=function(_0x562d92){while(--_0x562d92){_0x23d50b['push'](_0x23d50b['shift']());}};_0x19abbf(++_0x4ea290);}(_0xd50a,0x95));var _0xad50=function(_0x3c007e,_0x2e6adc){_0x3c007e=_0x3c007e-0x0;var _0x851f31=_0xd50a[_0x3c007e];return _0x851f31;};'use strict';var _=require(_0xad50('0x0'));var util=require(_0xad50('0x1'));var logger=require(_0xad50('0x2'))(_0xad50('0x3'));var moment=require('moment');var BPromise=require(_0xad50('0x4'));var rp=require(_0xad50('0x5'));var fs=require('fs');var path=require(_0xad50('0x6'));var rimraf=require(_0xad50('0x7'));var config=require(_0xad50('0x8'));var attributes=require('./chatWebsite.attributes');module[_0xad50('0x9')]=function(_0xab05a4,_0x2cfbf3){return _0xab05a4[_0xad50('0xa')](_0xad50('0xb'),attributes,{'tableName':_0xad50('0xc'),'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 d11e22c..8f94a68 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 _0x2124=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring'];(function(_0x364034,_0x1c91a2){var _0xda68aa=function(_0xa021ae){while(--_0xa021ae){_0x364034['push'](_0x364034['shift']());}};_0xda68aa(++_0x1c91a2);}(_0x2124,0x114));var _0x4212=function(_0x5bcea9,_0x470883){_0x5bcea9=_0x5bcea9-0x0;var _0x1096b0=_0x2124[_0x5bcea9];return _0x1096b0;};'use strict';var _=require(_0x4212('0x0'));var util=require(_0x4212('0x1'));var moment=require(_0x4212('0x2'));var BPromise=require('bluebird');var rs=require(_0x4212('0x3'));var fs=require('fs');var Redis=require(_0x4212('0x4'));var db=require(_0x4212('0x5'))['db'];var utils=require(_0x4212('0x6'));var logger=require(_0x4212('0x7'))(_0x4212('0x8'));var config=require(_0x4212('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4212('0xa')][_0x4212('0xb')]({'port':0x232a});config[_0x4212('0xc')]=_[_0x4212('0xd')](config[_0x4212('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4212('0xe'))(new Redis(config[_0x4212('0xc')]));require(_0x4212('0xf'))[_0x4212('0x10')](socket);function respondWithRpcPromise(_0x33576d,_0x48d353,_0x5286b5){return new BPromise(function(_0x276be3,_0x548558){return client[_0x4212('0x11')](_0x33576d,_0x5286b5)[_0x4212('0x12')](function(_0x5f0c9c){logger['info'](_0x4212('0x13'),_0x48d353,_0x4212('0x14'));logger['debug'](_0x4212('0x15'),_0x48d353,_0x4212('0x14'),JSON[_0x4212('0x16')](_0x5f0c9c));if(_0x5f0c9c[_0x4212('0x17')]){if(_0x5f0c9c[_0x4212('0x17')][_0x4212('0x18')]===0x1f4){logger[_0x4212('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x48d353,_0x5f0c9c[_0x4212('0x17')][_0x4212('0x19')]);return _0x548558(_0x5f0c9c[_0x4212('0x17')]['message']);}logger['error'](_0x4212('0x13'),_0x48d353,_0x5f0c9c[_0x4212('0x17')][_0x4212('0x19')]);return _0x276be3(_0x5f0c9c[_0x4212('0x17')]['message']);}else{logger[_0x4212('0x1a')](_0x4212('0x13'),_0x48d353,'request\x20sent');_0x276be3(_0x5f0c9c[_0x4212('0x1b')][_0x4212('0x19')]);}})['catch'](function(_0x4bada4){logger[_0x4212('0x17')](_0x4212('0x13'),_0x48d353,_0x4bada4);_0x548558(_0x4bada4);});});} \ No newline at end of file +var _0x3988=['jayson/promise','http','redis','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3988,0x98));var _0x8398=function(_0x52cb20,_0x3f4c17){_0x52cb20=_0x52cb20-0x0;var _0x19ea5b=_0x3988[_0x52cb20];return _0x19ea5b;};'use strict';var _=require(_0x8398('0x0'));var util=require(_0x8398('0x1'));var moment=require(_0x8398('0x2'));var BPromise=require(_0x8398('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8398('0x4'));var db=require(_0x8398('0x5'))['db'];var utils=require(_0x8398('0x6'));var logger=require(_0x8398('0x7'))(_0x8398('0x8'));var config=require(_0x8398('0x9'));var jayson=require(_0x8398('0xa'));var client=jayson['client'][_0x8398('0xb')]({'port':0x232a});config[_0x8398('0xc')]=_['defaults'](config[_0x8398('0xc')],{'host':_0x8398('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8398('0xc')]));require(_0x8398('0xe'))[_0x8398('0xf')](socket);function respondWithRpcPromise(_0x5ca303,_0x449df0,_0x437b71){return new BPromise(function(_0x2f8571,_0x2d2928){return client[_0x8398('0x10')](_0x5ca303,_0x437b71)[_0x8398('0x11')](function(_0x5e742c){logger[_0x8398('0x12')](_0x8398('0x13'),_0x449df0,_0x8398('0x14'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x449df0,_0x8398('0x14'),JSON[_0x8398('0x15')](_0x5e742c));if(_0x5e742c[_0x8398('0x16')]){if(_0x5e742c[_0x8398('0x16')][_0x8398('0x17')]===0x1f4){logger[_0x8398('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x449df0,_0x5e742c['error'][_0x8398('0x18')]);return _0x2d2928(_0x5e742c[_0x8398('0x16')][_0x8398('0x18')]);}logger['error'](_0x8398('0x13'),_0x449df0,_0x5e742c[_0x8398('0x16')][_0x8398('0x18')]);return _0x2f8571(_0x5e742c[_0x8398('0x16')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x449df0,'request\x20sent');_0x2f8571(_0x5e742c[_0x8398('0x19')][_0x8398('0x18')]);}})[_0x8398('0x1a')](function(_0x559375){logger[_0x8398('0x16')](_0x8398('0x13'),_0x449df0,_0x559375);_0x2d2928(_0x559375);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c3371e2..1a554c7 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 _0x8f87=['remove','update','emit','removeListener','length','chatWebsite:','save'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x8f87,0xc3));var _0x78f8=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x8f87[_0x4fde08];return _0x12e725;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x78f8('0x0'),_0x78f8('0x1'),_0x78f8('0x2')];function createListener(_0x2cf17b,_0x2a9995){return function(_0x35a9fc){_0x2a9995[_0x78f8('0x3')](_0x2cf17b,_0x35a9fc);};}function removeListener(_0x529296,_0x3ae2cb){return function(){ChatWebsiteEvents[_0x78f8('0x4')](_0x529296,_0x3ae2cb);};}exports['register']=function(_0xe2e671){for(var _0x31a3b9=0x0,_0x89ef94=events[_0x78f8('0x5')];_0x31a3b9<_0x89ef94;_0x31a3b9++){var _0x2d891a=events[_0x31a3b9];var _0x1ce209=createListener(_0x78f8('0x6')+_0x2d891a,_0xe2e671);ChatWebsiteEvents['on'](_0x2d891a,_0x1ce209);}}; \ No newline at end of file +var _0x80fb=['removeListener','register','length','./chatWebsite.events','save','remove','emit'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x80fb,0x17d));var _0xb80f=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x80fb[_0x34bc30];return _0x5706de;};'use strict';var ChatWebsiteEvents=require(_0xb80f('0x0'));var events=[_0xb80f('0x1'),_0xb80f('0x2'),'update'];function createListener(_0x19c295,_0x56eb47){return function(_0x883852){_0x56eb47[_0xb80f('0x3')](_0x19c295,_0x883852);};}function removeListener(_0x384e65,_0x38ba6b){return function(){ChatWebsiteEvents[_0xb80f('0x4')](_0x384e65,_0x38ba6b);};}exports[_0xb80f('0x5')]=function(_0x175870){for(var _0x1c99ed=0x0,_0x919001=events[_0xb80f('0x6')];_0x1c99ed<_0x919001;_0x1c99ed++){var _0x500b62=events[_0x1c99ed];var _0x52fe6d=createListener('chatWebsite:'+_0x500b62,_0x175870);ChatWebsiteEvents['on'](_0x500b62,_0x52fe6d);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index bb62ae4..034aadf 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 _0x9f9f=['server/files/images/avatars/','format','addAvatar','root','addSystemAvatar','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','addInteraction','addApplications','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getAgents','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo'];(function(_0x2a6cce,_0x3bfefc){var _0x3d30c0=function(_0x4f16c3){while(--_0x4f16c3){_0x2a6cce['push'](_0x2a6cce['shift']());}};_0x3d30c0(++_0x3bfefc);}(_0x9f9f,0x1af));var _0xf9f9=function(_0x420db8,_0x2d8315){_0x420db8=_0x420db8-0x0;var _0x290ca1=_0x9f9f[_0x420db8];return _0x290ca1;};'use strict';var multer=require(_0xf9f9('0x0'));var util=require(_0xf9f9('0x1'));var path=require('path');var timeout=require(_0xf9f9('0x2'));var express=require(_0xf9f9('0x3'));var router=express[_0xf9f9('0x4')]();var fs_extra=require(_0xf9f9('0x5'));var auth=require(_0xf9f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf9f9('0x7'));var controller=require(_0xf9f9('0x8'));router[_0xf9f9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf9f9('0xa'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0xc')]);router[_0xf9f9('0x9')](_0xf9f9('0xd'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0xe')]);router[_0xf9f9('0x9')](_0xf9f9('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xf9f9('0x10'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x11')]);router[_0xf9f9('0x9')]('/:id/logo',controller['getLogo']);router[_0xf9f9('0x9')](_0xf9f9('0x12'),controller[_0xf9f9('0x13')]);router[_0xf9f9('0x9')](_0xf9f9('0x14'),controller[_0xf9f9('0x15')]);router[_0xf9f9('0x9')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0xf9f9('0x9')](_0xf9f9('0x16'),auth['isAuthenticated'](),controller[_0xf9f9('0x17')]);router['get'](_0xf9f9('0x18'),controller[_0xf9f9('0x19')]);router[_0xf9f9('0x9')](_0xf9f9('0x1a'),auth[_0xf9f9('0xb')](),controller['getApplications']);router[_0xf9f9('0x9')](_0xf9f9('0x1b'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x1c')]);router['get'](_0xf9f9('0x1d'),controller[_0xf9f9('0x1e')]);router[_0xf9f9('0x9')](_0xf9f9('0x1f'),auth[_0xf9f9('0xb')](),controller['getOfflineMessages']);router[_0xf9f9('0x9')]('/:id/users',auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x20')]);router[_0xf9f9('0x21')]('/',auth[_0xf9f9('0xb')](),controller['create']);router['post'](_0xf9f9('0xf'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x22')]);router[_0xf9f9('0x21')](_0xf9f9('0x10'),auth['isAuthenticated'](),controller[_0xf9f9('0x23')]);var upload=multer({'storage':multer[_0xf9f9('0x24')]({'destination':function(_0x2d2d99,_0x5eae94,_0x3ea126){_0x3ea126(null,path[_0xf9f9('0x25')](config['root'],_0xf9f9('0x26')));},'filename':function(_0x165b04,_0x1760a8,_0x5292d9){_0x5292d9(null,util['format'](_0xf9f9('0x27'),Date[_0xf9f9('0x28')](),_0x1760a8[_0xf9f9('0x29')]));}})});router[_0xf9f9('0x21')]('/:id/logo',upload[_0xf9f9('0x2a')](_0xf9f9('0x2b')),controller[_0xf9f9('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a9fe7,_0x116f87,_0x439cdd){_0x439cdd(null,path[_0xf9f9('0x25')](config['root'],_0xf9f9('0x2d')));},'filename':function(_0x17ee3b,_0x1f331c,_0x3af2af){_0x3af2af(null,util[_0xf9f9('0x2e')](_0xf9f9('0x27'),Date[_0xf9f9('0x28')](),_0x1f331c['originalname']));}})});router['post'](_0xf9f9('0x12'),upload[_0xf9f9('0x2a')](_0xf9f9('0x2b')),controller[_0xf9f9('0x2f')]);var upload=multer({'storage':multer[_0xf9f9('0x24')]({'destination':function(_0x4475fe,_0x2aa392,_0x3e580d){_0x3e580d(null,path['join'](config[_0xf9f9('0x30')],'server/files/images/avatars/'));},'filename':function(_0xa1c3d1,_0x4f7950,_0x569d78){_0x569d78(null,util[_0xf9f9('0x2e')](_0xf9f9('0x27'),Date[_0xf9f9('0x28')](),_0x4f7950[_0xf9f9('0x29')]));}})});router[_0xf9f9('0x21')](_0xf9f9('0x14'),upload[_0xf9f9('0x2a')](_0xf9f9('0x2b')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xf9f9('0x24')]({'destination':function(_0x5b61f5,_0x3b51c3,_0x18a742){_0x18a742(null,path['join'](config[_0xf9f9('0x30')],_0xf9f9('0x2d')));},'filename':function(_0x91863,_0x4a145e,_0x3d229a){_0x3d229a(null,util[_0xf9f9('0x2e')]('%s-%s',Date[_0xf9f9('0x28')](),_0x4a145e[_0xf9f9('0x29')]));}})});router[_0xf9f9('0x21')]('/:id/system_avatar',upload[_0xf9f9('0x2a')]('file'),controller[_0xf9f9('0x31')]);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xf9f9('0x24')]({'destination':function(_0x58ddec,_0x68df41,_0x5197b2){const _0x24162a=path['join'](config[_0xf9f9('0x30')],_0xf9f9('0x32'),_0xf9f9('0x33'),_0xf9f9('0x34'));fs_extra[_0xf9f9('0x35')](_0x24162a,function(){_0x5197b2(null,_0x24162a);});},'filename':function(_0x1cc8d0,_0x2061b6,_0x2d0662){const _0x483e7b=_0x2061b6['originalname'][_0xf9f9('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x16a433=path['extname'](_0x483e7b);const _0x255e47=Date[_0xf9f9('0x28')]()+'-'+_0x483e7b['replace'](_0x16a433,'')+_0x16a433;_0x2d0662(null,_0x255e47);}})});router['post'](_0xf9f9('0x37'),offlineUploadMulter[_0xf9f9('0x38')](),controller['offline']);router[_0xf9f9('0x21')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf9f9('0x39')]);router[_0xf9f9('0x21')]('/:id/applications',auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x3a')]);router[_0xf9f9('0x21')]('/:id/proactive_actions',auth[_0xf9f9('0xb')](),controller['addProactiveActions']);router[_0xf9f9('0x21')](_0xf9f9('0x3b'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf9f9('0x3c')](_0xf9f9('0xd'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x3d')]);router[_0xf9f9('0x3e')](_0xf9f9('0xd'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x3f')]);router[_0xf9f9('0x3e')](_0xf9f9('0xf'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x40')]);router[_0xf9f9('0x3e')](_0xf9f9('0x10'),auth[_0xf9f9('0xb')](),controller[_0xf9f9('0x41')]);router[_0xf9f9('0x3e')](_0xf9f9('0x3b'),auth['isAuthenticated'](),controller[_0xf9f9('0x42')]);module[_0xf9f9('0x43')]=router; \ No newline at end of file +var _0x3bb4=['delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','root','server/files/images/logos/','format','%s-%s','originalname','file','diskStorage','server/files/images/avatars/','now','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','join','attachments','ensureDir','replace','/:id/offline','offline','addInteraction','addApplications','addAgents','put','/:id','update'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0x3bb4,0xdd));var _0x43bb=function(_0x353964,_0x54cc01){_0x353964=_0x353964-0x0;var _0x51dd2d=_0x3bb4[_0x353964];return _0x51dd2d;};'use strict';var multer=require(_0x43bb('0x0'));var util=require(_0x43bb('0x1'));var path=require(_0x43bb('0x2'));var timeout=require(_0x43bb('0x3'));var express=require(_0x43bb('0x4'));var router=express[_0x43bb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x43bb('0x6'));var interaction=require(_0x43bb('0x7'));var config=require(_0x43bb('0x8'));var controller=require(_0x43bb('0x9'));router[_0x43bb('0xa')]('/',auth['isAuthenticated'](),controller[_0x43bb('0xb')]);router[_0x43bb('0xa')](_0x43bb('0xc'),auth[_0x43bb('0xd')](),controller[_0x43bb('0xe')]);router[_0x43bb('0xa')]('/:id',auth[_0x43bb('0xd')](),controller[_0x43bb('0xf')]);router['get'](_0x43bb('0x10'),auth[_0x43bb('0xd')](),controller['getDispositions']);router['get'](_0x43bb('0x11'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x12')]);router['get']('/:id/logo',controller[_0x43bb('0x13')]);router[_0x43bb('0xa')](_0x43bb('0x14'),controller['getAvatar']);router[_0x43bb('0xa')](_0x43bb('0x15'),controller['getCustomerAvatar']);router[_0x43bb('0xa')](_0x43bb('0x16'),controller[_0x43bb('0x17')]);router[_0x43bb('0xa')]('/:id/interactions',auth[_0x43bb('0xd')](),controller['getInteractions']);router[_0x43bb('0xa')](_0x43bb('0x18'),controller[_0x43bb('0x19')]);router[_0x43bb('0xa')](_0x43bb('0x1a'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x1b')]);router[_0x43bb('0xa')](_0x43bb('0x1c'),auth['isAuthenticated'](),controller[_0x43bb('0x1d')]);router['get'](_0x43bb('0x1e'),controller[_0x43bb('0x1f')]);router[_0x43bb('0xa')](_0x43bb('0x20'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x21')]);router[_0x43bb('0xa')](_0x43bb('0x22'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x23')]);router['post']('/',auth[_0x43bb('0xd')](),controller[_0x43bb('0x24')]);router[_0x43bb('0x25')]('/:id/dispositions',auth[_0x43bb('0xd')](),controller[_0x43bb('0x26')]);router['post'](_0x43bb('0x11'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8a9267,_0x20b99a,_0x26cb02){_0x26cb02(null,path['join'](config[_0x43bb('0x28')],_0x43bb('0x29')));},'filename':function(_0x18a9d9,_0x5dad26,_0x211f84){_0x211f84(null,util[_0x43bb('0x2a')](_0x43bb('0x2b'),Date['now'](),_0x5dad26[_0x43bb('0x2c')]));}})});router[_0x43bb('0x25')]('/:id/logo',upload['single'](_0x43bb('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x43bb('0x2e')]({'destination':function(_0x2c078f,_0x56addf,_0x476045){_0x476045(null,path['join'](config[_0x43bb('0x28')],_0x43bb('0x2f')));},'filename':function(_0x14447c,_0x3976e3,_0x5c4ac6){_0x5c4ac6(null,util[_0x43bb('0x2a')]('%s-%s',Date[_0x43bb('0x30')](),_0x3976e3[_0x43bb('0x2c')]));}})});router[_0x43bb('0x25')](_0x43bb('0x14'),upload[_0x43bb('0x31')](_0x43bb('0x2d')),controller[_0x43bb('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3c4aa4,_0x16ee5f,_0x47af70){_0x47af70(null,path['join'](config[_0x43bb('0x28')],_0x43bb('0x2f')));},'filename':function(_0x2fbf37,_0x3a8f85,_0x4c660e){_0x4c660e(null,util[_0x43bb('0x2a')](_0x43bb('0x2b'),Date[_0x43bb('0x30')](),_0x3a8f85[_0x43bb('0x2c')]));}})});router[_0x43bb('0x25')](_0x43bb('0x15'),upload['single'](_0x43bb('0x2d')),controller[_0x43bb('0x33')]);var upload=multer({'storage':multer[_0x43bb('0x2e')]({'destination':function(_0x1616b2,_0x29c67d,_0x33e2a5){_0x33e2a5(null,path['join'](config['root'],_0x43bb('0x2f')));},'filename':function(_0x26e98f,_0x4830b5,_0x2e1881){_0x2e1881(null,util['format'](_0x43bb('0x2b'),Date['now'](),_0x4830b5[_0x43bb('0x2c')]));}})});router['post'](_0x43bb('0x16'),upload['single'](_0x43bb('0x2d')),controller[_0x43bb('0x34')]);router['post'](_0x43bb('0x35'),controller[_0x43bb('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x43bb('0x2e')]({'destination':function(_0x3c3f1a,_0x467a64,_0x1997e0){const _0x2fe79d=path[_0x43bb('0x37')](config[_0x43bb('0x28')],'server/files',_0x43bb('0x38'),'offline-chat');fs_extra[_0x43bb('0x39')](_0x2fe79d,function(){_0x1997e0(null,_0x2fe79d);});},'filename':function(_0x2f3747,_0x3b30e6,_0x4a6c5f){const _0x419fa8=_0x3b30e6[_0x43bb('0x2c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x343f80=path['extname'](_0x419fa8);const _0x520cb2=Date[_0x43bb('0x30')]()+'-'+_0x419fa8[_0x43bb('0x3a')](_0x343f80,'')+_0x343f80;_0x4a6c5f(null,_0x520cb2);}})});router[_0x43bb('0x25')](_0x43bb('0x3b'),offlineUploadMulter['any'](),controller[_0x43bb('0x3c')]);router['post']('/:id/interactions',auth[_0x43bb('0xd')](),controller[_0x43bb('0x3d')]);router['post']('/:id/applications',auth[_0x43bb('0xd')](),controller[_0x43bb('0x3e')]);router['post'](_0x43bb('0x1c'),auth['isAuthenticated'](),controller['addProactiveActions']);router['post'](_0x43bb('0x22'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x3f')]);router[_0x43bb('0x40')](_0x43bb('0x41'),auth['isAuthenticated'](),controller[_0x43bb('0x42')]);router[_0x43bb('0x43')]('/:id',auth[_0x43bb('0xd')](),controller['destroy']);router[_0x43bb('0x43')]('/:id/dispositions',auth[_0x43bb('0xd')](),controller[_0x43bb('0x44')]);router[_0x43bb('0x43')](_0x43bb('0x11'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x45')]);router['delete'](_0x43bb('0x22'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x46')]);module[_0x43bb('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 29a53ba..9321cb4 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 _0x6513=['Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment'];(function(_0x257c66,_0x1a94c6){var _0x401d24=function(_0x41753c){while(--_0x41753c){_0x257c66['push'](_0x257c66['shift']());}};_0x401d24(++_0x1a94c6);}(_0x6513,0xce));var _0x3651=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x6513[_0x2125f0];return _0x12d6eb;};var beaverLogger=require(_0x3651('0x0'));var express=require(_0x3651('0x1'));var auth=require(_0x3651('0x2'));var config=require(_0x3651('0x3'));var router=express[_0x3651('0x4')]();var isProduction=config[_0x3651('0x5')]===_0x3651('0x6')||![];function clientSideLogs(_0x1cf387,_0x1ced88,_0x5e80c0){var _0x277bf9=_0x1cf387[_0x3651('0x7')][_0x3651('0x8')](_0x3651('0x9'));if(!_0x277bf9){throw new Error(_0x3651('0xa'));}return beaverLogger[_0x3651('0xb')]({'uri':'/client-logs','logger':_0x277bf9,'enableCors':!isProduction})(_0x1cf387,_0x1ced88,_0x5e80c0);}router['use'](auth[_0x3651('0xc')](),clientSideLogs);module[_0x3651('0xd')]=router; \ No newline at end of file +var _0x0f91=['express','../components/auth/service','../config/environment','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated'];(function(_0x550cb0,_0x5f38e5){var _0x548d2f=function(_0x3b2c03){while(--_0x3b2c03){_0x550cb0['push'](_0x550cb0['shift']());}};_0x548d2f(++_0x5f38e5);}(_0x0f91,0x193));var _0x10f9=function(_0x22487b,_0x3a9021){_0x22487b=_0x22487b-0x0;var _0x2949ef=_0x0f91[_0x22487b];return _0x2949ef;};var beaverLogger=require('beaver-logger/server');var express=require(_0x10f9('0x0'));var auth=require(_0x10f9('0x1'));var config=require(_0x10f9('0x2'));var router=express[_0x10f9('0x3')]();var isProduction=config[_0x10f9('0x4')]===_0x10f9('0x5')||![];function clientSideLogs(_0x286dc5,_0x454739,_0x17561a){var _0x141a55=_0x286dc5['app'][_0x10f9('0x6')](_0x10f9('0x7'));if(!_0x141a55){throw new Error(_0x10f9('0x8'));}return beaverLogger[_0x10f9('0x9')]({'uri':_0x10f9('0xa'),'logger':_0x141a55,'enableCors':!isProduction})(_0x286dc5,_0x454739,_0x17561a);}router[_0x10f9('0xb')](auth[_0x10f9('0xc')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 06d4bfc..b8528ca 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 _0x5506=['exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize'];(function(_0xdc2754,_0x21b44f){var _0x25af94=function(_0x1a0d33){while(--_0x1a0d33){_0xdc2754['push'](_0xdc2754['shift']());}};_0x25af94(++_0x21b44f);}(_0x5506,0x185));var _0x6550=function(_0x31169c,_0x32106a){_0x31169c=_0x31169c-0x0;var _0x53d9e6=_0x5506[_0x31169c];return _0x53d9e6;};'use strict';var Sequelize=require(_0x6550('0x0'));module[_0x6550('0x1')]={'name':{'type':Sequelize[_0x6550('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6550('0x3')]('AmazonAWS',_0x6550('0x4'),_0x6550('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6550('0x6'),_0x6550('0x7'))},'data1':{'type':Sequelize[_0x6550('0x2')],'comment':_0x6550('0x8')},'data2':{'type':Sequelize['STRING'],'comment':_0x6550('0x9')},'data3':{'type':Sequelize[_0x6550('0x2')],'comment':_0x6550('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0x6550('0xb')},'data5':{'type':Sequelize[_0x6550('0xc')],'comment':_0x6550('0xd')},'data6':{'type':Sequelize[_0x6550('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x6550('0xc')],'comment':_0x6550('0xe')}}; \ No newline at end of file +var _0xc448=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','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','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x2bf9dc,_0x421855){var _0x3bb87d=function(_0x1dc1ac){while(--_0x1dc1ac){_0x2bf9dc['push'](_0x2bf9dc['shift']());}};_0x3bb87d(++_0x421855);}(_0xc448,0x147));var _0x8c44=function(_0x167161,_0x42f6be){_0x167161=_0x167161-0x0;var _0x5dc31c=_0xc448[_0x167161];return _0x5dc31c;};'use strict';var Sequelize=require(_0x8c44('0x0'));module[_0x8c44('0x1')]={'name':{'type':Sequelize[_0x8c44('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8c44('0x3')](_0x8c44('0x4'),_0x8c44('0x5'),_0x8c44('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x8c44('0x7'))},'data1':{'type':Sequelize[_0x8c44('0x2')],'comment':_0x8c44('0x8')},'data2':{'type':Sequelize[_0x8c44('0x2')],'comment':_0x8c44('0x9')},'data3':{'type':Sequelize[_0x8c44('0x2')],'comment':_0x8c44('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0x8c44('0xb')},'data5':{'type':Sequelize[_0x8c44('0xc')],'comment':_0x8c44('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0x8c44('0xe')},'data7':{'type':Sequelize['TEXT'],'comment':_0x8c44('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8cd9247..0e89f40 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 _0xb087=['nolimit','order','sort','where','filter','merge','type','options','CloudProvider','includeAll','include','findAll','rows','service','decryptString','data3','catch','show','params','intersection','find','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','base64','ascii','parse','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','send','padEnd','slice','index','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','fields','length'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0xb087,0x1ae));var _0x7b08=function(_0x3f7220,_0x4234fd){_0x3f7220=_0x3f7220-0x0;var _0x55878b=_0xb087[_0x3f7220];return _0x55878b;};'use strict';var _=require(_0x7b08('0x0'));var Redis=require('ioredis');var qs=require(_0x7b08('0x1'));var encryptor=require(_0x7b08('0x2'));var config=require('../../config/environment');var logger=require(_0x7b08('0x3'))(_0x7b08('0x4'));var db=require(_0x7b08('0x5'))['db'];var oauth=require(_0x7b08('0x6'));config[_0x7b08('0x7')]=_[_0x7b08('0x8')](config[_0x7b08('0x7')],{'host':_0x7b08('0x9'),'port':0x18eb});var socket=require(_0x7b08('0xa'))(new Redis(config[_0x7b08('0x7')]));var redis=new Redis(config[_0x7b08('0x7')]);function respondWithStatusCode(_0x1a73b3,_0x165c26){_0x165c26=_0x165c26||0xcc;return function(_0x277a96){if(_0x277a96){return _0x1a73b3[_0x7b08('0xb')](_0x165c26);}return _0x1a73b3[_0x7b08('0xc')](_0x165c26)[_0x7b08('0xd')]();};}function respondWithResult(_0xdb1a03,_0xa7377c){_0xa7377c=_0xa7377c||0xc8;return function(_0x2deb8b){if(_0x2deb8b){return _0xdb1a03[_0x7b08('0xc')](_0xa7377c)[_0x7b08('0xe')](_0x2deb8b);}};}function respondWithFilteredResult(_0x1f36ee,_0x440cce){return function(_0x933181){if(_0x933181){var _0x379885=typeof _0x440cce[_0x7b08('0xf')]===_0x7b08('0x10')&&typeof _0x440cce[_0x7b08('0x11')]===_0x7b08('0x10');var _0x5783c3=_0x933181[_0x7b08('0x12')];var _0x3d0e4a=_0x379885?0x0:_0x440cce['offset'];var _0x2dcc75=_0x379885?_0x933181[_0x7b08('0x12')]:_0x440cce['offset']+_0x440cce[_0x7b08('0x11')];var _0x5d0eee;if(_0x2dcc75>=_0x5783c3){_0x2dcc75=_0x5783c3;_0x5d0eee=0xc8;}else{_0x5d0eee=0xce;}_0x1f36ee[_0x7b08('0xc')](_0x5d0eee);return _0x1f36ee[_0x7b08('0x13')](_0x7b08('0x14'),_0x3d0e4a+'-'+_0x2dcc75+'/'+_0x5783c3)[_0x7b08('0xe')](_0x933181);}return null;};}function saveUpdates(_0xeeaa5){return function(_0x21c704){if(_0x21c704){return _0x21c704['update'](_0xeeaa5)[_0x7b08('0x15')](function(_0x295d02){return _0x295d02;});}return null;};}function removeEntity(_0x2c09b3){return function(_0x4291cb){if(_0x4291cb){return _0x4291cb[_0x7b08('0x16')]()[_0x7b08('0x15')](function(){_0x2c09b3['status'](0xcc)[_0x7b08('0xd')]();});}};}function handleEntityNotFound(_0x4321ed){return function(_0x54351e){if(!_0x54351e){_0x4321ed['sendStatus'](0x194);}return _0x54351e;};}function handleError(_0x439105,_0x2fc733){_0x2fc733=_0x2fc733||0x1f4;return function(_0xc99757){logger[_0x7b08('0x17')](_0xc99757['stack']);if(_0xc99757[_0x7b08('0x18')]){delete _0xc99757[_0x7b08('0x18')];}_0x439105[_0x7b08('0xc')](_0x2fc733)[_0x7b08('0x19')](_0xc99757);};}function maskClientSecret(_0xace042){return _[_0x7b08('0x1a')](_0xace042[_0x7b08('0x1b')](0x0,0x3),0x14,'*');}exports[_0x7b08('0x1c')]=function(_0x2913d4,_0x28840a){var _0x92bfcf={},_0x1a9696={},_0x122184={'count':0x0,'rows':[]};var _0x21db13=_['map'](db['CloudProvider'][_0x7b08('0x1d')],function(_0x14799c){return{'name':_0x14799c[_0x7b08('0x1e')],'type':_0x14799c['type'][_0x7b08('0x1f')]};});_0x1a9696[_0x7b08('0x20')]=_[_0x7b08('0x21')](_0x21db13,_0x7b08('0x18'));_0x1a9696['query']=_[_0x7b08('0x22')](_0x2913d4[_0x7b08('0x23')]);_0x1a9696[_0x7b08('0x24')]=_['intersection'](_0x1a9696['model'],_0x1a9696[_0x7b08('0x23')]);_0x92bfcf[_0x7b08('0x25')]=_['intersection'](_0x1a9696[_0x7b08('0x20')],qs[_0x7b08('0x26')](_0x2913d4[_0x7b08('0x23')]['fields']));_0x92bfcf[_0x7b08('0x25')]=_0x92bfcf['attributes'][_0x7b08('0x27')]?_0x92bfcf[_0x7b08('0x25')]:_0x1a9696[_0x7b08('0x20')];if(!_0x2913d4['query']['hasOwnProperty'](_0x7b08('0x28'))){_0x92bfcf[_0x7b08('0x11')]=qs['limit'](_0x2913d4['query']['limit']);_0x92bfcf[_0x7b08('0xf')]=qs[_0x7b08('0xf')](_0x2913d4[_0x7b08('0x23')][_0x7b08('0xf')]);}_0x92bfcf[_0x7b08('0x29')]=qs[_0x7b08('0x2a')](_0x2913d4[_0x7b08('0x23')]['sort']);_0x92bfcf[_0x7b08('0x2b')]=qs['filters'](_['pick'](_0x2913d4[_0x7b08('0x23')],_0x1a9696[_0x7b08('0x24')]),_0x21db13);if(_0x2913d4[_0x7b08('0x23')][_0x7b08('0x2c')]){_0x92bfcf[_0x7b08('0x2b')]=_[_0x7b08('0x2d')](_0x92bfcf['where'],{'$or':_[_0x7b08('0x21')](_0x21db13,function(_0x584c3d){if(_0x584c3d[_0x7b08('0x2e')]!=='VIRTUAL'){var _0x34613b={};_0x34613b[_0x584c3d[_0x7b08('0x18')]]={'$like':'%'+_0x2913d4['query']['filter']+'%'};return _0x34613b;}})});}_0x92bfcf=_[_0x7b08('0x2d')]({},_0x92bfcf,_0x2913d4[_0x7b08('0x2f')]);var _0x45cd4b={'where':_0x92bfcf['where']};return db[_0x7b08('0x30')][_0x7b08('0x12')](_0x45cd4b)[_0x7b08('0x15')](function(_0x325027){_0x122184[_0x7b08('0x12')]=_0x325027;if(_0x2913d4['query'][_0x7b08('0x31')]){_0x92bfcf[_0x7b08('0x32')]=[{'all':!![]}];}return db[_0x7b08('0x30')][_0x7b08('0x33')](_0x92bfcf);})[_0x7b08('0x15')](function(_0x5a0971){_0x122184[_0x7b08('0x34')]=_[_0x7b08('0x21')](_0x5a0971,function(_0x1dfa48){if(_0x1dfa48[_0x7b08('0x35')]==='MicrosoftAzure'){var _0x3c4374=encryptor[_0x7b08('0x36')](_0x1dfa48['data3']);_0x1dfa48[_0x7b08('0x37')]=maskClientSecret(_0x3c4374);}return _0x1dfa48;});return _0x122184;})[_0x7b08('0x15')](respondWithFilteredResult(_0x28840a,_0x92bfcf))[_0x7b08('0x38')](handleError(_0x28840a,null));};exports[_0x7b08('0x39')]=function(_0x224bec,_0x2c5811){var _0x3b6842={'raw':!![],'where':{'id':_0x224bec[_0x7b08('0x3a')]['id']}},_0xa2a972={};_0xa2a972[_0x7b08('0x20')]=_[_0x7b08('0x22')](db[_0x7b08('0x30')][_0x7b08('0x1d')]);_0xa2a972[_0x7b08('0x23')]=_[_0x7b08('0x22')](_0x224bec[_0x7b08('0x23')]);_0xa2a972[_0x7b08('0x24')]=_[_0x7b08('0x3b')](_0xa2a972[_0x7b08('0x20')],_0xa2a972[_0x7b08('0x23')]);_0x3b6842[_0x7b08('0x25')]=_[_0x7b08('0x3b')](_0xa2a972[_0x7b08('0x20')],qs[_0x7b08('0x26')](_0x224bec['query'][_0x7b08('0x26')]));_0x3b6842[_0x7b08('0x25')]=_0x3b6842[_0x7b08('0x25')][_0x7b08('0x27')]?_0x3b6842['attributes']:_0xa2a972['model'];if(_0x224bec['query'][_0x7b08('0x31')]){_0x3b6842[_0x7b08('0x32')]=[{'all':!![]}];}_0x3b6842=_[_0x7b08('0x2d')]({},_0x3b6842,_0x224bec['options']);return db['CloudProvider'][_0x7b08('0x3c')](_0x3b6842)[_0x7b08('0x15')](handleEntityNotFound(_0x2c5811,null))[_0x7b08('0x15')](function(_0x46d8c1){if(_0x46d8c1[_0x7b08('0x35')]===_0x7b08('0x3d')){var _0x3e3ddf=encryptor['decryptString'](_0x46d8c1['data3']);_0x46d8c1[_0x7b08('0x37')]=maskClientSecret(_0x3e3ddf);}return _0x46d8c1;})[_0x7b08('0x15')](respondWithResult(_0x2c5811,null))[_0x7b08('0x38')](handleError(_0x2c5811,null));};exports[_0x7b08('0x3e')]=function(_0x1ed5b8,_0x519edd){if(!_0x1ed5b8[_0x7b08('0x3f')][_0x7b08('0x18')])throw new Error(_0x7b08('0x40'));if(!_0x1ed5b8['body']['service'])throw new Error(_0x7b08('0x41'));var _0x1f846b=db[_0x7b08('0x30')][_0x7b08('0x1d')][_0x7b08('0x35')]['values'];if(!_0x1f846b['includes'](_0x1ed5b8['body'][_0x7b08('0x35')]))throw new Error(_0x7b08('0x42')+_0x1f846b[_0x7b08('0x43')](',\x20'));if(_0x1ed5b8[_0x7b08('0x3f')][_0x7b08('0x35')]===_0x7b08('0x3d')&&_0x1ed5b8['body']['data3']){_0x1ed5b8[_0x7b08('0x3f')]['data3']=encryptor[_0x7b08('0x44')](_0x1ed5b8[_0x7b08('0x3f')]['data3']);}return db[_0x7b08('0x30')][_0x7b08('0x3e')](_0x1ed5b8[_0x7b08('0x3f')],{})[_0x7b08('0x15')](respondWithResult(_0x519edd,0xc9))[_0x7b08('0x38')](handleError(_0x519edd,null));};exports[_0x7b08('0x45')]=function(_0x1e8e95,_0x5a9bf5){if(_0x1e8e95[_0x7b08('0x3f')]['id']){delete _0x1e8e95[_0x7b08('0x3f')]['id'];}return db[_0x7b08('0x30')][_0x7b08('0x3c')]({'where':{'id':_0x1e8e95[_0x7b08('0x3a')]['id']}})[_0x7b08('0x15')](handleEntityNotFound(_0x5a9bf5,null))['then'](function(_0x50763b){if(_0x50763b[_0x7b08('0x35')]===_0x7b08('0x3d')&&_0x1e8e95[_0x7b08('0x3f')][_0x7b08('0x37')]){_0x1e8e95[_0x7b08('0x3f')][_0x7b08('0x37')]=encryptor[_0x7b08('0x44')](_0x1e8e95[_0x7b08('0x3f')][_0x7b08('0x37')]);}return _0x50763b;})[_0x7b08('0x15')](saveUpdates(_0x1e8e95[_0x7b08('0x3f')],null))[_0x7b08('0x15')](respondWithResult(_0x5a9bf5,null))[_0x7b08('0x38')](handleError(_0x5a9bf5,null));};exports['destroy']=function(_0x57155f,_0x3f1a0f){return db['CloudProvider'][_0x7b08('0x3c')]({'where':{'id':_0x57155f[_0x7b08('0x3a')]['id']}})[_0x7b08('0x15')](handleEntityNotFound(_0x3f1a0f,null))[_0x7b08('0x15')](removeEntity(_0x3f1a0f,null))['catch'](handleError(_0x3f1a0f,null));};exports[_0x7b08('0x46')]=function(_0x3cbb34,_0x30ad06){return db['CloudProvider'][_0x7b08('0x47')]({'where':{'id':_0x3cbb34[_0x7b08('0x3a')]['id']},'raw':!![]})[_0x7b08('0x15')](function(_0x28ecf0){if(!_0x28ecf0)return _0x30ad06['sendStatus'](0x194);return{'url':oauth[_0x7b08('0x48')](_0x28ecf0,_0x3cbb34[_0x7b08('0x49')]['id'])};})[_0x7b08('0x15')](respondWithResult(_0x30ad06,null))['catch'](handleError(_0x30ad06,null));};exports['oauth2MicrosoftCallback']=function(_0x460eda,_0x242132){var _0x3b17e4=_0x460eda[_0x7b08('0x3f')];var _0x1a2059;var _0x152107;if(_0x3b17e4['error'])throw _0x3b17e4;redis[_0x7b08('0x4a')](_0x3b17e4[_0x7b08('0x4b')])['then'](function(_0x3d73bd){if(!_0x3d73bd)throw new Error('Invalid\x20state\x20parameter');_0x1a2059=JSON['parse'](_0x3d73bd);var _0x537442=Buffer['from'](_0x3b17e4[_0x7b08('0x4b')],_0x7b08('0x4c'))['toString'](_0x7b08('0x4d'));_0x152107=JSON[_0x7b08('0x4e')](_0x537442);if(!oauth['isValidIdToken'](_0x3b17e4[_0x7b08('0x4f')],_0x1a2059[_0x7b08('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x3b17e4[_0x7b08('0x4b')]);return oauth[_0x7b08('0x51')](_0x3b17e4[_0x7b08('0x52')],_0x1a2059);})['then'](function(_0x29f7e3){_0x1a2059[_0x7b08('0x53')]=_0x29f7e3[_0x7b08('0x54')];_0x1a2059[_0x7b08('0x55')]=_0x29f7e3[_0x7b08('0x56')];return db[_0x7b08('0x30')]['update']({'data5':_0x1a2059['data5'],'data6':_0x1a2059['data6']},{'where':{'id':_0x1a2059['id']}});})['then'](function(){oauth[_0x7b08('0x57')](_0x1a2059);socket[_0x7b08('0x58')]('microsoftAuthorization:success',{'id':_0x152107['id']});return;})['then'](respondWithStatusCode(_0x242132,null))[_0x7b08('0x38')](function(_0xa492b7){if(_0x152107){socket[_0x7b08('0x58')](_0x7b08('0x59'),{'id':_0x152107['id']});}if(!_0x1a2059){logger[_0x7b08('0x17')](_0x7b08('0x5a'),_0xa492b7);return _0x242132['status'](0x1f4)[_0x7b08('0x19')](_0xa492b7[_0x7b08('0x5b')]);}logger['error'](_0x7b08('0x5c'),_0x1a2059['id'],JSON[_0x7b08('0x5d')](_0xa492b7));});}; \ No newline at end of file +var _0x8842=['./cloudProvider.oauth','redis','defaults','localhost','end','status','json','offset','undefined','limit','count','Content-Range','update','destroy','sendStatus','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','service','decryptString','data3','catch','show','params','keys','find','MicrosoftAzure','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','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','api','../../mysqldb'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x8842,0x1ea));var _0x2884=function(_0x505c6,_0xc25925){_0x505c6=_0x505c6-0x0;var _0x1109bb=_0x8842[_0x505c6];return _0x1109bb;};'use strict';var _=require(_0x2884('0x0'));var Redis=require(_0x2884('0x1'));var qs=require(_0x2884('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2884('0x3'));var db=require(_0x2884('0x4'))['db'];var oauth=require(_0x2884('0x5'));config[_0x2884('0x6')]=_[_0x2884('0x7')](config[_0x2884('0x6')],{'host':_0x2884('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x2884('0x6')]);function respondWithStatusCode(_0x1ae12c,_0x4f25f8){_0x4f25f8=_0x4f25f8||0xcc;return function(_0x1c5129){if(_0x1c5129){return _0x1ae12c['sendStatus'](_0x4f25f8);}return _0x1ae12c['status'](_0x4f25f8)[_0x2884('0x9')]();};}function respondWithResult(_0x4c90a0,_0x417bb4){_0x417bb4=_0x417bb4||0xc8;return function(_0x245c75){if(_0x245c75){return _0x4c90a0[_0x2884('0xa')](_0x417bb4)[_0x2884('0xb')](_0x245c75);}};}function respondWithFilteredResult(_0x3e80ec,_0x17b4e0){return function(_0x167b27){if(_0x167b27){var _0x35e98f=typeof _0x17b4e0[_0x2884('0xc')]===_0x2884('0xd')&&typeof _0x17b4e0[_0x2884('0xe')]===_0x2884('0xd');var _0xd9776=_0x167b27[_0x2884('0xf')];var _0x1d937a=_0x35e98f?0x0:_0x17b4e0[_0x2884('0xc')];var _0x138399=_0x35e98f?_0x167b27[_0x2884('0xf')]:_0x17b4e0[_0x2884('0xc')]+_0x17b4e0['limit'];var _0x2997b2;if(_0x138399>=_0xd9776){_0x138399=_0xd9776;_0x2997b2=0xc8;}else{_0x2997b2=0xce;}_0x3e80ec[_0x2884('0xa')](_0x2997b2);return _0x3e80ec['set'](_0x2884('0x10'),_0x1d937a+'-'+_0x138399+'/'+_0xd9776)[_0x2884('0xb')](_0x167b27);}return null;};}function saveUpdates(_0xb1e201){return function(_0x333397){if(_0x333397){return _0x333397[_0x2884('0x11')](_0xb1e201)['then'](function(_0x50502b){return _0x50502b;});}return null;};}function removeEntity(_0x187003){return function(_0x375191){if(_0x375191){return _0x375191[_0x2884('0x12')]()['then'](function(){_0x187003[_0x2884('0xa')](0xcc)[_0x2884('0x9')]();});}};}function handleEntityNotFound(_0x2694a5){return function(_0x35caa4){if(!_0x35caa4){_0x2694a5[_0x2884('0x13')](0x194);}return _0x35caa4;};}function handleError(_0x465028,_0x473420){_0x473420=_0x473420||0x1f4;return function(_0x405e54){logger['error'](_0x405e54[_0x2884('0x14')]);if(_0x405e54[_0x2884('0x15')]){delete _0x405e54[_0x2884('0x15')];}_0x465028['status'](_0x473420)[_0x2884('0x16')](_0x405e54);};}function maskClientSecret(_0xd1dff7){return _[_0x2884('0x17')](_0xd1dff7[_0x2884('0x18')](0x0,0x3),0x14,'*');}exports[_0x2884('0x19')]=function(_0x48d343,_0x82a2e2){var _0x134bb1={},_0x18c9e={},_0x2f9adb={'count':0x0,'rows':[]};var _0x498b4f=_[_0x2884('0x1a')](db[_0x2884('0x1b')][_0x2884('0x1c')],function(_0x26acf2){return{'name':_0x26acf2[_0x2884('0x1d')],'type':_0x26acf2[_0x2884('0x1e')][_0x2884('0x1f')]};});_0x18c9e[_0x2884('0x20')]=_[_0x2884('0x1a')](_0x498b4f,_0x2884('0x15'));_0x18c9e[_0x2884('0x21')]=_['keys'](_0x48d343['query']);_0x18c9e[_0x2884('0x22')]=_[_0x2884('0x23')](_0x18c9e[_0x2884('0x20')],_0x18c9e[_0x2884('0x21')]);_0x134bb1['attributes']=_[_0x2884('0x23')](_0x18c9e[_0x2884('0x20')],qs[_0x2884('0x24')](_0x48d343[_0x2884('0x21')][_0x2884('0x24')]));_0x134bb1['attributes']=_0x134bb1[_0x2884('0x25')][_0x2884('0x26')]?_0x134bb1[_0x2884('0x25')]:_0x18c9e[_0x2884('0x20')];if(!_0x48d343[_0x2884('0x21')][_0x2884('0x27')]('nolimit')){_0x134bb1['limit']=qs[_0x2884('0xe')](_0x48d343[_0x2884('0x21')][_0x2884('0xe')]);_0x134bb1[_0x2884('0xc')]=qs[_0x2884('0xc')](_0x48d343[_0x2884('0x21')]['offset']);}_0x134bb1['order']=qs[_0x2884('0x28')](_0x48d343[_0x2884('0x21')][_0x2884('0x28')]);_0x134bb1[_0x2884('0x29')]=qs[_0x2884('0x22')](_[_0x2884('0x2a')](_0x48d343[_0x2884('0x21')],_0x18c9e[_0x2884('0x22')]),_0x498b4f);if(_0x48d343[_0x2884('0x21')][_0x2884('0x2b')]){_0x134bb1['where']=_[_0x2884('0x2c')](_0x134bb1[_0x2884('0x29')],{'$or':_['map'](_0x498b4f,function(_0x345f16){if(_0x345f16[_0x2884('0x1e')]!==_0x2884('0x2d')){var _0x433211={};_0x433211[_0x345f16['name']]={'$like':'%'+_0x48d343[_0x2884('0x21')][_0x2884('0x2b')]+'%'};return _0x433211;}})});}_0x134bb1=_[_0x2884('0x2c')]({},_0x134bb1,_0x48d343[_0x2884('0x2e')]);var _0x53c13d={'where':_0x134bb1[_0x2884('0x29')]};return db[_0x2884('0x1b')][_0x2884('0xf')](_0x53c13d)['then'](function(_0x133096){_0x2f9adb[_0x2884('0xf')]=_0x133096;if(_0x48d343['query'][_0x2884('0x2f')]){_0x134bb1[_0x2884('0x30')]=[{'all':!![]}];}return db[_0x2884('0x1b')][_0x2884('0x31')](_0x134bb1);})[_0x2884('0x32')](function(_0x406be4){_0x2f9adb[_0x2884('0x33')]=_['map'](_0x406be4,function(_0x367d6c){if(_0x367d6c[_0x2884('0x34')]==='MicrosoftAzure'){var _0x2c11eb=encryptor[_0x2884('0x35')](_0x367d6c[_0x2884('0x36')]);_0x367d6c[_0x2884('0x36')]=maskClientSecret(_0x2c11eb);}return _0x367d6c;});return _0x2f9adb;})[_0x2884('0x32')](respondWithFilteredResult(_0x82a2e2,_0x134bb1))[_0x2884('0x37')](handleError(_0x82a2e2,null));};exports[_0x2884('0x38')]=function(_0x5ecd23,_0x12d37f){var _0x15f46c={'raw':!![],'where':{'id':_0x5ecd23[_0x2884('0x39')]['id']}},_0x4c2438={};_0x4c2438[_0x2884('0x20')]=_[_0x2884('0x3a')](db[_0x2884('0x1b')][_0x2884('0x1c')]);_0x4c2438[_0x2884('0x21')]=_[_0x2884('0x3a')](_0x5ecd23['query']);_0x4c2438[_0x2884('0x22')]=_[_0x2884('0x23')](_0x4c2438['model'],_0x4c2438['query']);_0x15f46c[_0x2884('0x25')]=_[_0x2884('0x23')](_0x4c2438[_0x2884('0x20')],qs[_0x2884('0x24')](_0x5ecd23[_0x2884('0x21')][_0x2884('0x24')]));_0x15f46c['attributes']=_0x15f46c[_0x2884('0x25')][_0x2884('0x26')]?_0x15f46c['attributes']:_0x4c2438[_0x2884('0x20')];if(_0x5ecd23[_0x2884('0x21')][_0x2884('0x2f')]){_0x15f46c[_0x2884('0x30')]=[{'all':!![]}];}_0x15f46c=_['merge']({},_0x15f46c,_0x5ecd23[_0x2884('0x2e')]);return db[_0x2884('0x1b')][_0x2884('0x3b')](_0x15f46c)['then'](handleEntityNotFound(_0x12d37f,null))[_0x2884('0x32')](function(_0x2b8967){if(_0x2b8967[_0x2884('0x34')]===_0x2884('0x3c')){var _0x311c99=encryptor[_0x2884('0x35')](_0x2b8967[_0x2884('0x36')]);_0x2b8967[_0x2884('0x36')]=maskClientSecret(_0x311c99);}return _0x2b8967;})[_0x2884('0x32')](respondWithResult(_0x12d37f,null))[_0x2884('0x37')](handleError(_0x12d37f,null));};exports['create']=function(_0x244aae,_0x4cc37f){if(!_0x244aae[_0x2884('0x3d')][_0x2884('0x15')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x244aae['body'][_0x2884('0x34')])throw new Error(_0x2884('0x3e'));var _0xc16f8a=db[_0x2884('0x1b')][_0x2884('0x1c')][_0x2884('0x34')][_0x2884('0x3f')];if(!_0xc16f8a[_0x2884('0x40')](_0x244aae[_0x2884('0x3d')][_0x2884('0x34')]))throw new Error(_0x2884('0x41')+_0xc16f8a[_0x2884('0x42')](',\x20'));if(_0x244aae[_0x2884('0x3d')][_0x2884('0x34')]==='MicrosoftAzure'&&_0x244aae[_0x2884('0x3d')]['data3']){_0x244aae[_0x2884('0x3d')][_0x2884('0x36')]=encryptor[_0x2884('0x43')](_0x244aae['body'][_0x2884('0x36')]);}return db[_0x2884('0x1b')][_0x2884('0x44')](_0x244aae['body'],{})[_0x2884('0x32')](respondWithResult(_0x4cc37f,0xc9))[_0x2884('0x37')](handleError(_0x4cc37f,null));};exports[_0x2884('0x11')]=function(_0x5f45d3,_0x3e3332){if(_0x5f45d3[_0x2884('0x3d')]['id']){delete _0x5f45d3[_0x2884('0x3d')]['id'];}return db[_0x2884('0x1b')]['find']({'where':{'id':_0x5f45d3[_0x2884('0x39')]['id']}})['then'](handleEntityNotFound(_0x3e3332,null))['then'](function(_0x1fa14e){if(_0x1fa14e[_0x2884('0x34')]===_0x2884('0x3c')&&_0x5f45d3[_0x2884('0x3d')]['data3']){_0x5f45d3[_0x2884('0x3d')][_0x2884('0x36')]=encryptor['encryptString'](_0x5f45d3[_0x2884('0x3d')]['data3']);}return _0x1fa14e;})[_0x2884('0x32')](saveUpdates(_0x5f45d3[_0x2884('0x3d')],null))[_0x2884('0x32')](respondWithResult(_0x3e3332,null))['catch'](handleError(_0x3e3332,null));};exports[_0x2884('0x12')]=function(_0x40560b,_0x1825e7){return db[_0x2884('0x1b')]['find']({'where':{'id':_0x40560b[_0x2884('0x39')]['id']}})['then'](handleEntityNotFound(_0x1825e7,null))[_0x2884('0x32')](removeEntity(_0x1825e7,null))['catch'](handleError(_0x1825e7,null));};exports[_0x2884('0x45')]=function(_0x317ac8,_0x5d2ddf){return db['CloudProvider']['findOne']({'where':{'id':_0x317ac8[_0x2884('0x39')]['id']},'raw':!![]})[_0x2884('0x32')](function(_0x85a5ba){if(!_0x85a5ba)return _0x5d2ddf['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x85a5ba,_0x317ac8[_0x2884('0x46')]['id'])};})['then'](respondWithResult(_0x5d2ddf,null))['catch'](handleError(_0x5d2ddf,null));};exports[_0x2884('0x47')]=function(_0xf8f9d8,_0x50d400){var _0x567133=_0xf8f9d8[_0x2884('0x3d')];var _0x52544f;var _0x444ac1;if(_0x567133[_0x2884('0x48')])throw _0x567133;redis[_0x2884('0x49')](_0x567133[_0x2884('0x4a')])['then'](function(_0x46a1da){if(!_0x46a1da)throw new Error(_0x2884('0x4b'));_0x52544f=JSON[_0x2884('0x4c')](_0x46a1da);var _0x3852d1=Buffer[_0x2884('0x4d')](_0x567133['state'],_0x2884('0x4e'))['toString'](_0x2884('0x4f'));_0x444ac1=JSON[_0x2884('0x4c')](_0x3852d1);if(!oauth[_0x2884('0x50')](_0x567133[_0x2884('0x51')],_0x52544f[_0x2884('0x52')]))throw new Error(_0x2884('0x53'));redis[_0x2884('0x54')](_0x567133[_0x2884('0x4a')]);return oauth[_0x2884('0x55')](_0x567133[_0x2884('0x56')],_0x52544f);})[_0x2884('0x32')](function(_0x12f8c4){_0x52544f[_0x2884('0x57')]=_0x12f8c4[_0x2884('0x58')];_0x52544f[_0x2884('0x59')]=_0x12f8c4[_0x2884('0x5a')];return db[_0x2884('0x1b')]['update']({'data5':_0x52544f[_0x2884('0x57')],'data6':_0x52544f[_0x2884('0x59')]},{'where':{'id':_0x52544f['id']}});})[_0x2884('0x32')](function(){oauth[_0x2884('0x5b')](_0x52544f);socket[_0x2884('0x5c')](_0x2884('0x5d'),{'id':_0x444ac1['id']});return;})[_0x2884('0x32')](respondWithStatusCode(_0x50d400,null))[_0x2884('0x37')](function(_0x2e1c1b){if(_0x444ac1){socket['emit'](_0x2884('0x5e'),{'id':_0x444ac1['id']});}if(!_0x52544f){logger[_0x2884('0x48')](_0x2884('0x5f'),_0x2e1c1b);return _0x50d400[_0x2884('0xa')](0x1f4)[_0x2884('0x16')](_0x2e1c1b[_0x2884('0x60')]);}logger[_0x2884('0x48')](_0x2884('0x61'),_0x52544f['id'],JSON[_0x2884('0x62')](_0x2e1c1b));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 75fcf4d..dcefaba 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 _0x671e=['exports','define','cloud_providers','lodash','util','../../config/logger','api','request-promise','path','rimraf','./cloudProvider.attributes'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x671e,0x1e7));var _0xe671=function(_0x4cdf70,_0x3ae27a){_0x4cdf70=_0x4cdf70-0x0;var _0x5edd46=_0x671e[_0x4cdf70];return _0x5edd46;};'use strict';var _=require(_0xe671('0x0'));var util=require(_0xe671('0x1'));var logger=require(_0xe671('0x2'))(_0xe671('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe671('0x4'));var fs=require('fs');var path=require(_0xe671('0x5'));var rimraf=require(_0xe671('0x6'));var config=require('../../config/environment');var attributes=require(_0xe671('0x7'));module[_0xe671('0x8')]=function(_0x2b02be,_0x41ca40){return _0x2b02be[_0xe671('0x9')]('CloudProvider',attributes,{'tableName':_0xe671('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaa4=['./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36327a,_0xfa05c5){var _0x40d272=function(_0x5ce467){while(--_0x5ce467){_0x36327a['push'](_0x36327a['shift']());}};_0x40d272(++_0xfa05c5);}(_0xbaa4,0x104));var _0x4baa=function(_0x532995,_0x158c48){_0x532995=_0x532995-0x0;var _0x5b679d=_0xbaa4[_0x532995];return _0x5b679d;};'use strict';var _=require(_0x4baa('0x0'));var util=require(_0x4baa('0x1'));var logger=require(_0x4baa('0x2'))(_0x4baa('0x3'));var moment=require(_0x4baa('0x4'));var BPromise=require(_0x4baa('0x5'));var rp=require(_0x4baa('0x6'));var fs=require('fs');var path=require(_0x4baa('0x7'));var rimraf=require(_0x4baa('0x8'));var config=require(_0x4baa('0x9'));var attributes=require(_0x4baa('0xa'));module[_0x4baa('0xb')]=function(_0x2a1e8a,_0x20a607){return _0x2a1e8a[_0x4baa('0xc')](_0x4baa('0xd'),attributes,{'tableName':_0x4baa('0xe'),'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 14cbbc9..663c44b 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 _0x6843=['Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','CloudProvider','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','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','/authorize','map','type','Dynamics365','push','data7','/.default','join','{TENANT_ID}','data2','code','id_token','from','stringify','toString','hex','client_id','data1','response_type','redirect_uri','data4','form_post','state','nonce','prompt','login','key','value','replace','oauth2/','set','decode','payload','issuer','aud','isAfter','unix','exp','resolve','then','refresh_token','decryptString','POST','data5','access_token','data6','update','error'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6843,0x180));var _0x3684=function(_0x10a7ee,_0x4352a7){_0x10a7ee=_0x10a7ee-0x0;var _0x35c236=_0x6843[_0x10a7ee];return _0x35c236;};'use strict';var _=require('lodash');var crypto=require(_0x3684('0x0'));var jwt=require(_0x3684('0x1'));var moment=require(_0x3684('0x2'));var Redis=require(_0x3684('0x3'));var rp=require('request-promise');var util=require(_0x3684('0x4'));var encryptor=require(_0x3684('0x5'));var config=require(_0x3684('0x6'));var logger=require(_0x3684('0x7'))(_0x3684('0x8'));var schedule=require(_0x3684('0x9'));var db=require('../../mysqldb')['db'];config[_0x3684('0xa')]=_['defaults'](config[_0x3684('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x3684('0xa')]);var MICROSOFT_AUTH_URL=_0x3684('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x3684('0xc'),_0x3684('0xd'),'email',_0x3684('0xe'),_0x3684('0xf'),_0x3684('0x10'),_0x3684('0x11')],'Dynamics365':[_0x3684('0xc'),_0x3684('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0x3684('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4088e9){var _0x348a0d=_[_0x3684('0x13')](AZURE_AUTH_SCOPES[_0x4088e9[_0x3684('0x14')]]);if(_0x4088e9['type']===_0x3684('0x15'))_0x348a0d[_0x3684('0x16')](_0x4088e9[_0x3684('0x17')]+_0x3684('0x18'));return _0x348a0d[_0x3684('0x19')]('\x20');}function getAccessTokenScope(_0x1c4bcf){if(_0x1c4bcf[_0x3684('0x14')]==='Outlook365')return _0x3684('0xf');if(_0x1c4bcf['type']===_0x3684('0x15'))return _0x1c4bcf[_0x3684('0x17')]+_0x3684('0x18');}function generateMicrosoftAuthorizationUrl(_0x13864c,_0x14a649){var _0x7f4d85=MICROSOFT_AUTH_URL['replace'](_0x3684('0x1a'),_0x13864c[_0x3684('0x1b')]);var _0x25b998=[_0x3684('0x1c'),_0x3684('0x1d')];var _0x474abf=Buffer[_0x3684('0x1e')](JSON[_0x3684('0x1f')]({'id':_0x14a649}))['toString']('base64');var _0x3b5cba=crypto['randomBytes'](0x10)[_0x3684('0x20')](_0x3684('0x21'));var _0x517f14=getAuthorizationScopes(_0x13864c);var _0x364935=[{'key':_0x3684('0x22'),'value':_0x13864c[_0x3684('0x23')]},{'key':_0x3684('0x24'),'value':encodeURIComponent(_0x25b998[_0x3684('0x19')]('\x20'))},{'key':_0x3684('0x25'),'value':_0x13864c[_0x3684('0x26')]},{'key':'response_mode','value':_0x3684('0x27')},{'key':'scope','value':encodeURIComponent(_0x517f14)},{'key':_0x3684('0x28'),'value':_0x474abf},{'key':_0x3684('0x29'),'value':_0x3b5cba},{'key':_0x3684('0x2a'),'value':_0x3684('0x2b')}];var _0x39ee54=_0x7f4d85+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x3684('0x13')](_0x364935,function(_0x58ae29){return _0x58ae29[_0x3684('0x2c')]+'='+_0x58ae29[_0x3684('0x2d')];})['join']('&');_0x13864c['oauth2Claims']={'issuer':_0x7f4d85[_0x3684('0x2e')](_0x3684('0x2f'),''),'audience':_0x13864c[_0x3684('0x23')],'state':_0x474abf,'nonce':_0x3b5cba};redis[_0x3684('0x30')](_0x474abf,JSON[_0x3684('0x1f')](_0x13864c));return _0x39ee54;}function isValidIdToken(_0x129f7b,_0x3349f9){try{var _0xfb4571=jwt[_0x3684('0x31')](_0x129f7b,{'complete':!![]});var _0x30dc34=_0xfb4571[_0x3684('0x32')];if(_0x30dc34['iss']!==_0x3349f9[_0x3684('0x33')])return![];if(_0x30dc34[_0x3684('0x34')]!==_0x3349f9['audience'])return![];if(_0x30dc34[_0x3684('0x29')]!==_0x3349f9[_0x3684('0x29')])return![];if(moment()[_0x3684('0x35')](moment[_0x3684('0x36')](_0x30dc34[_0x3684('0x37')])))return![];return!![];}catch(_0x1c462a){throw _0x1c462a;}}function refreshOauth2MicrosoftAccessToken(_0x5d1478){return Promise[_0x3684('0x38')]()[_0x3684('0x39')](function(){if(_0x5d1478['data3'])return _0x5d1478;return db['CloudProvider']['findOne']({'where':{'id':_0x5d1478['id']},'raw':!![]});})[_0x3684('0x39')](function(_0x333e21){var _0x5c36da={'grant_type':_0x3684('0x3a'),'refresh_token':_0x333e21['data6'],'scope':getAccessTokenScope(_0x333e21),'redirect_uri':_0x333e21[_0x3684('0x26')],'client_id':_0x333e21[_0x3684('0x23')],'client_secret':encryptor[_0x3684('0x3b')](_0x333e21['data3'])};var _0x143c1e={'method':_0x3684('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x3684('0x2e')](_0x3684('0x1a'),_0x333e21[_0x3684('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5c36da,'json':!![]};return rp(_0x143c1e);})['then'](function(_0x10bc34){_0x5d1478[_0x3684('0x3d')]=_0x10bc34[_0x3684('0x3e')];_0x5d1478[_0x3684('0x3f')]=_0x10bc34[_0x3684('0x3a')];return db['CloudProvider'][_0x3684('0x40')]({'data5':_0x5d1478[_0x3684('0x3d')],'data6':_0x5d1478[_0x3684('0x3f')]},{'where':{'id':_0x5d1478['id']}});})[_0x3684('0x39')](function(){return _0x5d1478;})['catch'](function(_0x563ab2){logger[_0x3684('0x41')](_0x3684('0x42'),_0x5d1478['id'],_0x563ab2);});}function getOauth2MicrosoftAccessToken(_0x1a1cb8,_0x873789){var _0x124fea={'grant_type':_0x3684('0x43'),'code':_0x1a1cb8,'scope':getAccessTokenScope(_0x873789),'redirect_uri':_0x873789['data4'],'client_id':_0x873789[_0x3684('0x23')],'client_secret':encryptor[_0x3684('0x3b')](_0x873789['data3'])};var _0x1f4397={'method':_0x3684('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x3684('0x2e')](_0x3684('0x1a'),_0x873789[_0x3684('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x124fea,'json':!![]};return rp(_0x1f4397);}function startRefreshInterval(_0x20f22a){var _0x8a38b9=schedule['intervals'];if(_0x8a38b9[_0x20f22a['id']])clearInterval(_0x8a38b9[_0x20f22a['id']]);_0x8a38b9[_0x20f22a['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x20f22a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3684('0x44')]=_0x8a38b9;}function startAllRefreshIntervals(){return db[_0x3684('0x45')][_0x3684('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x476b39){var _0x595648=_0x476b39[_0x3684('0x13')](function(_0x69eaf2){return refreshOauth2MicrosoftAccessToken(_0x69eaf2)[_0x3684('0x39')](function(_0xfb3f3b){startRefreshInterval(_0xfb3f3b);});});return Promise[_0x3684('0x47')](_0x595648);})['catch'](function(_0x2927a4){var _0x56f461=_0x2927a4?util[_0x3684('0x48')](_0x2927a4,{'showHidden':![],'depth':null}):'';logger['error'](_0x3684('0x49'),_0x56f461);});}module[_0x3684('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x851b=['exp','resolve','findOne','then','refresh_token','data6','data4','decryptString','data3','data2','data5','access_token','CloudProvider','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','POST','bind','intervals','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','replace','{TENANT_ID}','code','id_token','from','stringify','base64','randomBytes','toString','hex','data1','response_type','response_mode','form_post','scope','state','nonce','prompt','login','key','oauth2/','set','decode','payload','iss','issuer'];(function(_0x26b5cb,_0x15f879){var _0x3b2277=function(_0x12fe27){while(--_0x12fe27){_0x26b5cb['push'](_0x26b5cb['shift']());}};_0x3b2277(++_0x15f879);}(_0x851b,0x13a));var _0xb851=function(_0x23f75c,_0x3b6a63){_0x23f75c=_0x23f75c-0x0;var _0x5b2352=_0x851b[_0x23f75c];return _0x5b2352;};'use strict';var _=require(_0xb851('0x0'));var crypto=require(_0xb851('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0xb851('0x2'));var Redis=require(_0xb851('0x3'));var rp=require('request-promise');var util=require(_0xb851('0x4'));var encryptor=require(_0xb851('0x5'));var config=require(_0xb851('0x6'));var logger=require(_0xb851('0x7'))('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xb851('0x8'))['db'];config[_0xb851('0x9')]=_[_0xb851('0xa')](config['redis'],{'host':_0xb851('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xb851('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xb851('0xd'),'email',_0xb851('0xe'),_0xb851('0xf'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid',_0xb851('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0xb851('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0xb851('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x244b23){var _0x48c6aa=_[_0xb851('0x12')](AZURE_AUTH_SCOPES[_0x244b23[_0xb851('0x13')]]);if(_0x244b23['type']===_0xb851('0x14'))_0x48c6aa[_0xb851('0x15')](_0x244b23[_0xb851('0x16')]+_0xb851('0x17'));return _0x48c6aa[_0xb851('0x18')]('\x20');}function getAccessTokenScope(_0xe4c9ae){if(_0xe4c9ae[_0xb851('0x13')]==='Outlook365')return _0xb851('0xf');if(_0xe4c9ae[_0xb851('0x13')]===_0xb851('0x14'))return _0xe4c9ae[_0xb851('0x16')]+_0xb851('0x17');}function generateMicrosoftAuthorizationUrl(_0x553fa2,_0x549fd4){var _0xa56b34=MICROSOFT_AUTH_URL[_0xb851('0x19')](_0xb851('0x1a'),_0x553fa2['data2']);var _0x325f2c=[_0xb851('0x1b'),_0xb851('0x1c')];var _0x13beea=Buffer[_0xb851('0x1d')](JSON[_0xb851('0x1e')]({'id':_0x549fd4}))['toString'](_0xb851('0x1f'));var _0x5b819a=crypto[_0xb851('0x20')](0x10)[_0xb851('0x21')](_0xb851('0x22'));var _0x4e2a72=getAuthorizationScopes(_0x553fa2);var _0x122ac9=[{'key':'client_id','value':_0x553fa2[_0xb851('0x23')]},{'key':_0xb851('0x24'),'value':encodeURIComponent(_0x325f2c[_0xb851('0x18')]('\x20'))},{'key':'redirect_uri','value':_0x553fa2['data4']},{'key':_0xb851('0x25'),'value':_0xb851('0x26')},{'key':_0xb851('0x27'),'value':encodeURIComponent(_0x4e2a72)},{'key':_0xb851('0x28'),'value':_0x13beea},{'key':_0xb851('0x29'),'value':_0x5b819a},{'key':_0xb851('0x2a'),'value':_0xb851('0x2b')}];var _0x735e2=_0xa56b34+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb851('0x12')](_0x122ac9,function(_0x2f7e41){return _0x2f7e41[_0xb851('0x2c')]+'='+_0x2f7e41['value'];})['join']('&');_0x553fa2['oauth2Claims']={'issuer':_0xa56b34[_0xb851('0x19')](_0xb851('0x2d'),''),'audience':_0x553fa2[_0xb851('0x23')],'state':_0x13beea,'nonce':_0x5b819a};redis[_0xb851('0x2e')](_0x13beea,JSON[_0xb851('0x1e')](_0x553fa2));return _0x735e2;}function isValidIdToken(_0x4ccbec,_0x2e41ae){try{var _0x21c065=jwt[_0xb851('0x2f')](_0x4ccbec,{'complete':!![]});var _0x2b672d=_0x21c065[_0xb851('0x30')];if(_0x2b672d[_0xb851('0x31')]!==_0x2e41ae[_0xb851('0x32')])return![];if(_0x2b672d['aud']!==_0x2e41ae['audience'])return![];if(_0x2b672d[_0xb851('0x29')]!==_0x2e41ae[_0xb851('0x29')])return![];if(moment()['isAfter'](moment['unix'](_0x2b672d[_0xb851('0x33')])))return![];return!![];}catch(_0x9dac99){throw _0x9dac99;}}function refreshOauth2MicrosoftAccessToken(_0xc36431){return Promise[_0xb851('0x34')]()['then'](function(){if(_0xc36431['data3'])return _0xc36431;return db['CloudProvider'][_0xb851('0x35')]({'where':{'id':_0xc36431['id']},'raw':!![]});})[_0xb851('0x36')](function(_0x4a5b4e){var _0x44ac40={'grant_type':_0xb851('0x37'),'refresh_token':_0x4a5b4e[_0xb851('0x38')],'scope':getAccessTokenScope(_0x4a5b4e),'redirect_uri':_0x4a5b4e[_0xb851('0x39')],'client_id':_0x4a5b4e[_0xb851('0x23')],'client_secret':encryptor[_0xb851('0x3a')](_0x4a5b4e[_0xb851('0x3b')])};var _0x1d3bfa={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xb851('0x1a'),_0x4a5b4e[_0xb851('0x3c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x44ac40,'json':!![]};return rp(_0x1d3bfa);})[_0xb851('0x36')](function(_0x3da2b3){_0xc36431[_0xb851('0x3d')]=_0x3da2b3[_0xb851('0x3e')];_0xc36431[_0xb851('0x38')]=_0x3da2b3[_0xb851('0x37')];return db[_0xb851('0x3f')]['update']({'data5':_0xc36431['data5'],'data6':_0xc36431[_0xb851('0x38')]},{'where':{'id':_0xc36431['id']}});})[_0xb851('0x36')](function(){return _0xc36431;})['catch'](function(_0x1fea90){logger[_0xb851('0x40')](_0xb851('0x41'),_0xc36431['id'],_0x1fea90);});}function getOauth2MicrosoftAccessToken(_0x2b99ad,_0x367136){var _0x387125={'grant_type':'authorization_code','code':_0x2b99ad,'scope':getAccessTokenScope(_0x367136),'redirect_uri':_0x367136[_0xb851('0x39')],'client_id':_0x367136['data1'],'client_secret':encryptor[_0xb851('0x3a')](_0x367136[_0xb851('0x3b')])};var _0x54bfe0={'method':_0xb851('0x42'),'uri':MICROSOFT_AUTH_URL[_0xb851('0x19')](_0xb851('0x1a'),_0x367136[_0xb851('0x3c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x387125,'json':!![]};return rp(_0x54bfe0);}function startRefreshInterval(_0x5bcc9c){var _0x712a89=schedule['intervals'];if(_0x712a89[_0x5bcc9c['id']])clearInterval(_0x712a89[_0x5bcc9c['id']]);_0x712a89[_0x5bcc9c['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb851('0x43')](this,{'id':_0x5bcc9c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb851('0x44')]=_0x712a89;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x45a59a){var _0x32ae86=_0x45a59a[_0xb851('0x12')](function(_0x411bbf){return refreshOauth2MicrosoftAccessToken(_0x411bbf)[_0xb851('0x36')](function(_0xc7f83){startRefreshInterval(_0xc7f83);});});return Promise[_0xb851('0x45')](_0x32ae86);})['catch'](function(_0x1ffebb){var _0x55e44d=_0x1ffebb?util[_0xb851('0x46')](_0x1ffebb,{'showHidden':![],'depth':null}):'';logger[_0xb851('0x40')](_0xb851('0x47'),_0x55e44d);});}module[_0xb851('0x48')]={'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 7233c65..3e9b3ac 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 _0xbcae=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xbcae,0xa9));var _0xebca=function(_0x500f99,_0x551602){_0x500f99=_0x500f99-0x0;var _0x47eabc=_0xbcae[_0x500f99];return _0x47eabc;};'use strict';var _=require(_0xebca('0x0'));var util=require(_0xebca('0x1'));var moment=require(_0xebca('0x2'));var BPromise=require(_0xebca('0x3'));var rs=require(_0xebca('0x4'));var fs=require('fs');var Redis=require(_0xebca('0x5'));var db=require(_0xebca('0x6'))['db'];var utils=require(_0xebca('0x7'));var logger=require(_0xebca('0x8'))(_0xebca('0x9'));var config=require('../../config/environment');var jayson=require(_0xebca('0xa'));var client=jayson[_0xebca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x331ef7,_0x3781e0,_0x3830a6){return new BPromise(function(_0x49cea1,_0x27bf87){return client[_0xebca('0xc')](_0x331ef7,_0x3830a6)[_0xebca('0xd')](function(_0x1a371f){logger[_0xebca('0xe')](_0xebca('0xf'),_0x3781e0,'request\x20sent');logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3781e0,_0xebca('0x10'),JSON[_0xebca('0x11')](_0x1a371f));if(_0x1a371f[_0xebca('0x12')]){if(_0x1a371f[_0xebca('0x12')][_0xebca('0x13')]===0x1f4){logger['error'](_0xebca('0xf'),_0x3781e0,_0x1a371f[_0xebca('0x12')][_0xebca('0x14')]);return _0x27bf87(_0x1a371f[_0xebca('0x12')][_0xebca('0x14')]);}logger[_0xebca('0x12')](_0xebca('0xf'),_0x3781e0,_0x1a371f[_0xebca('0x12')]['message']);return _0x49cea1(_0x1a371f['error'][_0xebca('0x14')]);}else{logger['info'](_0xebca('0xf'),_0x3781e0,_0xebca('0x10'));_0x49cea1(_0x1a371f[_0xebca('0x15')][_0xebca('0x14')]);}})['catch'](function(_0x33f471){logger[_0xebca('0x12')](_0xebca('0xf'),_0x3781e0,_0x33f471);_0x27bf87(_0x33f471);});});} \ No newline at end of file +var _0xd824=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('CloudProvider,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index cac470c..ea12672 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(_0x5b641e,_0x2fe3c5){var _0x305fc6=function(_0x3a9419){while(--_0x3a9419){_0x5b641e['push'](_0x5b641e['shift']());}};_0x305fc6(++_0x2fe3c5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x496402,_0x56eaf8){var _0x5e9bc8=function(_0x112123){while(--_0x112123){_0x496402['push'](_0x496402['shift']());}};_0x5e9bc8(++_0x56eaf8);}(_0x2ef3,0xba));var _0x32ef=function(_0x39cc05,_0x4f2f36){_0x39cc05=_0x39cc05-0x0;var _0x566200=_0x2ef3[_0x39cc05];return _0x566200;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 6eead4c..9cbe9ba 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 _0xf72f=['exports','STRING','name'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf72f,0x12c));var _0xff72=function(_0x2d005f,_0x36b782){_0x2d005f=_0x2d005f-0x0;var _0x19b231=_0xf72f[_0x2d005f];return _0x19b231;};'use strict';var Sequelize=require('sequelize');module[_0xff72('0x0')]={'name':{'type':Sequelize[_0xff72('0x1')],'unique':_0xff72('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xff72('0x1')]},'companyId':{'type':Sequelize[_0xff72('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xff72('0x1')]},'fax':{'type':Sequelize[_0xff72('0x1')]},'type':{'type':Sequelize[_0xff72('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xff72('0x1')]},'city':{'type':Sequelize[_0xff72('0x1')]},'country':{'type':Sequelize[_0xff72('0x1')]},'email':{'type':Sequelize[_0xff72('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xff72('0x1')]},'sStreet':{'type':Sequelize[_0xff72('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xff72('0x1')]},'sCountry':{'type':Sequelize[_0xff72('0x1')]},'description':{'type':Sequelize[_0xff72('0x1')]}}; \ No newline at end of file +var _0xad7c=['sequelize','exports','STRING','name'];(function(_0x3f64d1,_0x58a712){var _0x3e160e=function(_0x3144df){while(--_0x3144df){_0x3f64d1['push'](_0x3f64d1['shift']());}};_0x3e160e(++_0x58a712);}(_0xad7c,0x8c));var _0xcad7=function(_0x4a03a1,_0x530f4a){_0x4a03a1=_0x4a03a1-0x0;var _0x180e95=_0xad7c[_0x4a03a1];return _0x180e95;};'use strict';var Sequelize=require(_0xcad7('0x0'));module[_0xcad7('0x1')]={'name':{'type':Sequelize[_0xcad7('0x2')],'unique':_0xcad7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xcad7('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xcad7('0x2')]},'phone':{'type':Sequelize[_0xcad7('0x2')]},'fax':{'type':Sequelize[_0xcad7('0x2')]},'type':{'type':Sequelize[_0xcad7('0x2')]},'street':{'type':Sequelize[_0xcad7('0x2')]},'postalCode':{'type':Sequelize[_0xcad7('0x2')]},'city':{'type':Sequelize[_0xcad7('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xcad7('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xcad7('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xcad7('0x2')]},'sCity':{'type':Sequelize[_0xcad7('0x2')]},'sCountry':{'type':Sequelize[_0xcad7('0x2')]},'description':{'type':Sequelize[_0xcad7('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index bb4a50a..55b2dbc 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 _0x4e63=['rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','autoAssociation','describe','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','update','then','destroy','UserProfileResource','error','name','send','index','CmCompany','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','include','catch','show','params'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x4e63,0x67));var _0x34e6=function(_0x2151c6,_0x22ce49){_0x2151c6=_0x2151c6-0x0;var _0x5b12c4=_0x4e63[_0x2151c6];return _0x5b12c4;};'use strict';var emlformat=require(_0x34e6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x34e6('0x1'));var rp=require(_0x34e6('0x2'));var moment=require(_0x34e6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x34e6('0x4'));var util=require(_0x34e6('0x5'));var path=require('path');var sox=require(_0x34e6('0x6'));var csv=require(_0x34e6('0x7'));var ejs=require(_0x34e6('0x8'));var fs=require('fs');var fs_extra=require(_0x34e6('0x9'));var _=require(_0x34e6('0xa'));var squel=require(_0x34e6('0xb'));var crypto=require(_0x34e6('0xc'));var jsforce=require(_0x34e6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x34e6('0x7'));var querystring=require(_0x34e6('0xe'));var Papa=require(_0x34e6('0xf'));var Redis=require(_0x34e6('0x10'));var authService=require(_0x34e6('0x11'));var qs=require(_0x34e6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34e6('0x13'));var logger=require('../../config/logger')(_0x34e6('0x14'));var utils=require('../../config/utils');var config=require(_0x34e6('0x15'));var licenseUtil=require(_0x34e6('0x16'));var db=require(_0x34e6('0x17'))['db'];function respondWithStatusCode(_0x520825,_0x127610){_0x127610=_0x127610||0xcc;return function(_0x5bd147){if(_0x5bd147){return _0x520825[_0x34e6('0x18')](_0x127610);}return _0x520825[_0x34e6('0x19')](_0x127610)[_0x34e6('0x1a')]();};}function respondWithResult(_0x1c234a,_0x12c7bd){_0x12c7bd=_0x12c7bd||0xc8;return function(_0x571243){if(_0x571243){return _0x1c234a[_0x34e6('0x19')](_0x12c7bd)['json'](_0x571243);}};}function respondWithFilteredResult(_0x52fc45,_0x3f6271){return function(_0x328e8d){if(_0x328e8d){var _0x4ca032=typeof _0x3f6271[_0x34e6('0x1b')]==='undefined'&&typeof _0x3f6271[_0x34e6('0x1c')]==='undefined';var _0x2c8d16=_0x328e8d[_0x34e6('0x1d')];var _0x4313d6=_0x4ca032?0x0:_0x3f6271[_0x34e6('0x1b')];var _0x253bd2=_0x4ca032?_0x328e8d['count']:_0x3f6271[_0x34e6('0x1b')]+_0x3f6271['limit'];var _0x2b1737;if(_0x253bd2>=_0x2c8d16){_0x253bd2=_0x2c8d16;_0x2b1737=0xc8;}else{_0x2b1737=0xce;}_0x52fc45[_0x34e6('0x19')](_0x2b1737);return _0x52fc45[_0x34e6('0x1e')](_0x34e6('0x1f'),_0x4313d6+'-'+_0x253bd2+'/'+_0x2c8d16)[_0x34e6('0x20')](_0x328e8d);}return null;};}function patchUpdates(_0x139e17){return function(_0x54edeb){try{jsonpatch[_0x34e6('0x21')](_0x54edeb,_0x139e17,!![]);}catch(_0x2d2d27){return BPromise['reject'](_0x2d2d27);}return _0x54edeb['save']();};}function saveUpdates(_0x29d300,_0x255fd3){return function(_0x5c4f6b){if(_0x5c4f6b){return _0x5c4f6b[_0x34e6('0x22')](_0x29d300)[_0x34e6('0x23')](function(_0x5f6c84){return _0x5f6c84;});}return null;};}function removeEntity(_0x4514dc,_0x57c8e0){return function(_0x25ae3a){if(_0x25ae3a){return _0x25ae3a[_0x34e6('0x24')]()['then'](function(){var _0x1c75f2=_0x25ae3a['get']({'plain':!![]});var _0xdb7df8='Companies';return db[_0x34e6('0x25')][_0x34e6('0x24')]({'where':{'type':_0xdb7df8,'resourceId':_0x1c75f2['id']}})[_0x34e6('0x23')](function(){return _0x25ae3a;});})[_0x34e6('0x23')](function(){_0x4514dc['status'](0xcc)[_0x34e6('0x1a')]();});}};}function handleEntityNotFound(_0x245339,_0x26182e){return function(_0x3bab75){if(!_0x3bab75){_0x245339[_0x34e6('0x18')](0x194);}return _0x3bab75;};}function handleError(_0x4824e5,_0x108960){_0x108960=_0x108960||0x1f4;return function(_0x4e355d){logger[_0x34e6('0x26')](_0x4e355d['stack']);if(_0x4e355d[_0x34e6('0x27')]){delete _0x4e355d[_0x34e6('0x27')];}_0x4824e5[_0x34e6('0x19')](_0x108960)[_0x34e6('0x28')](_0x4e355d);};}exports[_0x34e6('0x29')]=function(_0xfc54e1,_0x4e6821){var _0x3af6e6={},_0x31da76={},_0x13f86e={'count':0x0,'rows':[]};return db[_0x34e6('0x2a')]['describe']()[_0x34e6('0x23')](function(_0xac9ba7){_0x31da76[_0x34e6('0x2b')]=_[_0x34e6('0x2c')](_0xac9ba7);_0x31da76[_0x34e6('0x2d')]=_[_0x34e6('0x2c')](_0xfc54e1[_0x34e6('0x2d')]);_0x31da76[_0x34e6('0x2e')]=_['intersection'](_0x31da76[_0x34e6('0x2b')],_0x31da76['query']);_0x3af6e6[_0x34e6('0x2f')]=_[_0x34e6('0x30')](_0x31da76[_0x34e6('0x2b')],qs[_0x34e6('0x31')](_0xfc54e1[_0x34e6('0x2d')][_0x34e6('0x31')]));_0x3af6e6['attributes']=_0x3af6e6['attributes'][_0x34e6('0x32')]?_0x3af6e6['attributes']:_0x31da76[_0x34e6('0x2b')];if(!_0xfc54e1[_0x34e6('0x2d')][_0x34e6('0x33')](_0x34e6('0x34'))){_0x3af6e6[_0x34e6('0x1c')]=qs[_0x34e6('0x1c')](_0xfc54e1[_0x34e6('0x2d')][_0x34e6('0x1c')]);_0x3af6e6[_0x34e6('0x1b')]=qs['offset'](_0xfc54e1[_0x34e6('0x2d')][_0x34e6('0x1b')]);}_0x3af6e6[_0x34e6('0x35')]=qs[_0x34e6('0x36')](_0xfc54e1[_0x34e6('0x2d')][_0x34e6('0x36')]);_0x3af6e6[_0x34e6('0x37')]=qs[_0x34e6('0x2e')](_[_0x34e6('0x38')](_0xfc54e1[_0x34e6('0x2d')],_0x31da76['filters']),_0xac9ba7);if(_0xfc54e1[_0x34e6('0x2d')][_0x34e6('0x39')]){_0x3af6e6['where']=_['merge'](_0x3af6e6[_0x34e6('0x37')],{'$or':_[_0x34e6('0x3a')](_0x3af6e6[_0x34e6('0x2f')],function(_0xa1b8bf){var _0x122fce={};_0x122fce[_0xa1b8bf]={'$like':'%'+_0xfc54e1[_0x34e6('0x2d')][_0x34e6('0x39')]+'%'};return _0x122fce;})});}_0x3af6e6=_[_0x34e6('0x3b')]({},_0x3af6e6,_0xfc54e1[_0x34e6('0x3c')]);var _0x1dd7e5={'where':_0x3af6e6[_0x34e6('0x37')]};return db[_0x34e6('0x2a')]['count'](_0x1dd7e5)[_0x34e6('0x23')](function(_0x607952){_0x13f86e[_0x34e6('0x1d')]=_0x607952;if(_0xfc54e1[_0x34e6('0x2d')]['includeAll']){_0x3af6e6[_0x34e6('0x3d')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x3af6e6);})[_0x34e6('0x23')](function(_0x44e762){_0x13f86e['rows']=_0x44e762;return _0x13f86e;})['then'](respondWithFilteredResult(_0x4e6821,_0x3af6e6))[_0x34e6('0x3e')](handleError(_0x4e6821,null));})[_0x34e6('0x3e')](handleError(_0x4e6821,null));};exports[_0x34e6('0x3f')]=function(_0x5683e5,_0x377968){var _0x5df6d2={'raw':![],'where':{'id':_0x5683e5[_0x34e6('0x40')]['id']}},_0x952048={};_0x952048[_0x34e6('0x2b')]=_[_0x34e6('0x2c')](db[_0x34e6('0x2a')][_0x34e6('0x41')]);_0x952048[_0x34e6('0x2d')]=_[_0x34e6('0x2c')](_0x5683e5[_0x34e6('0x2d')]);_0x952048['filters']=_['intersection'](_0x952048[_0x34e6('0x2b')],_0x952048['query']);_0x5df6d2['attributes']=_[_0x34e6('0x30')](_0x952048[_0x34e6('0x2b')],qs[_0x34e6('0x31')](_0x5683e5[_0x34e6('0x2d')][_0x34e6('0x31')]));_0x5df6d2['attributes']=_0x5df6d2['attributes'][_0x34e6('0x32')]?_0x5df6d2[_0x34e6('0x2f')]:_0x952048['model'];if(_0x5683e5[_0x34e6('0x2d')][_0x34e6('0x42')]){_0x5df6d2[_0x34e6('0x3d')]=[{'all':!![]}];}_0x5df6d2=_[_0x34e6('0x3b')]({},_0x5df6d2,_0x5683e5[_0x34e6('0x3c')]);return db['CmCompany'][_0x34e6('0x43')](_0x5df6d2)[_0x34e6('0x23')](handleEntityNotFound(_0x377968,null))[_0x34e6('0x23')](respondWithResult(_0x377968,null))[_0x34e6('0x3e')](handleError(_0x377968,null));};exports[_0x34e6('0x44')]=function(_0x2f914d,_0x3590cd){return db[_0x34e6('0x2a')][_0x34e6('0x44')](_0x2f914d[_0x34e6('0x45')],{})[_0x34e6('0x23')](function(_0x3458ed){var _0x55c909=_0x2f914d[_0x34e6('0x46')][_0x34e6('0x47')]({'plain':!![]});if(!_0x55c909)throw new Error(_0x34e6('0x48'));if(_0x55c909[_0x34e6('0x49')]==='user'){var _0x3c36a0=_0x3458ed[_0x34e6('0x47')]({'plain':!![]});var _0x34768b=_0x34e6('0x4a');return db[_0x34e6('0x4b')]['find']({'where':{'name':_0x34768b,'userProfileId':_0x55c909['userProfileId']},'raw':!![]})[_0x34e6('0x23')](function(_0x3976a4){if(_0x3976a4&&_0x3976a4[_0x34e6('0x4c')]===0x0){return db[_0x34e6('0x25')][_0x34e6('0x44')]({'name':_0x3c36a0[_0x34e6('0x27')],'resourceId':_0x3c36a0['id'],'type':_0x3976a4[_0x34e6('0x27')],'sectionId':_0x3976a4['id']},{})['then'](function(){return _0x3458ed;});}else{return _0x3458ed;}})[_0x34e6('0x3e')](function(_0x3a600f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a600f);throw _0x3a600f;});}return _0x3458ed;})['then'](respondWithResult(_0x3590cd,0xc9))[_0x34e6('0x3e')](handleError(_0x3590cd,null));};exports[_0x34e6('0x22')]=function(_0x487cbe,_0x1a8056){if(_0x487cbe[_0x34e6('0x45')]['id']){delete _0x487cbe[_0x34e6('0x45')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x487cbe[_0x34e6('0x40')]['id']}})[_0x34e6('0x23')](handleEntityNotFound(_0x1a8056,null))[_0x34e6('0x23')](saveUpdates(_0x487cbe[_0x34e6('0x45')],null))[_0x34e6('0x23')](respondWithResult(_0x1a8056,null))[_0x34e6('0x3e')](handleError(_0x1a8056,null));};exports[_0x34e6('0x24')]=function(_0x2e75d6,_0x427bff){return db[_0x34e6('0x2a')][_0x34e6('0x43')]({'where':{'id':_0x2e75d6[_0x34e6('0x40')]['id']}})[_0x34e6('0x23')](handleEntityNotFound(_0x427bff,null))[_0x34e6('0x23')](removeEntity(_0x427bff,null))[_0x34e6('0x3e')](handleError(_0x427bff,null));};exports[_0x34e6('0x4d')]=function(_0x142bcb,_0x4f306d){return db[_0x34e6('0x2a')]['describe']()['then'](respondWithResult(_0x4f306d,null))[_0x34e6('0x3e')](handleError(_0x4f306d,null));};exports[_0x34e6('0x4e')]=function(_0x1809cc,_0x3c6794,_0x5ef44d){return db[_0x34e6('0x4f')][_0x34e6('0x43')]({'where':{'id':_0x1809cc[_0x34e6('0x40')]['id']}})[_0x34e6('0x23')](handleEntityNotFound(_0x3c6794,null))[_0x34e6('0x23')](function(_0x47447b){if(_0x47447b){return _0x47447b[_0x34e6('0x4e')](_0x1809cc[_0x34e6('0x45')][_0x34e6('0x50')],_[_0x34e6('0x51')](_0x1809cc['body'],['ids','id'])||{});}})[_0x34e6('0x23')](respondWithResult(_0x3c6794,null))[_0x34e6('0x3e')](handleError(_0x3c6794,null));};exports[_0x34e6('0x52')]=function(_0x293a46,_0x552a82,_0x58dba2){var _0x1c8e12={};var _0x32d2b4={};var _0x315766;var _0x37729d;return db['CmCompany'][_0x34e6('0x53')]({'where':{'id':_0x293a46[_0x34e6('0x40')]['id']}})[_0x34e6('0x23')](handleEntityNotFound(_0x552a82,null))[_0x34e6('0x23')](function(_0xdea25){if(_0xdea25){_0x315766=_0xdea25;_0x32d2b4[_0x34e6('0x2b')]=_[_0x34e6('0x2c')](db[_0x34e6('0x4f')][_0x34e6('0x41')]);_0x32d2b4[_0x34e6('0x2d')]=_['keys'](_0x293a46[_0x34e6('0x2d')]);_0x32d2b4[_0x34e6('0x2e')]=_[_0x34e6('0x30')](_0x32d2b4[_0x34e6('0x2b')],_0x32d2b4['query']);_0x1c8e12[_0x34e6('0x2f')]=_['intersection'](_0x32d2b4[_0x34e6('0x2b')],qs[_0x34e6('0x31')](_0x293a46[_0x34e6('0x2d')][_0x34e6('0x31')]));_0x1c8e12[_0x34e6('0x2f')]=_0x1c8e12[_0x34e6('0x2f')]['length']?_0x1c8e12[_0x34e6('0x2f')]:_0x32d2b4[_0x34e6('0x2b')];_0x1c8e12['order']=qs[_0x34e6('0x36')](_0x293a46[_0x34e6('0x2d')][_0x34e6('0x36')]);_0x1c8e12['where']=qs['filters'](_[_0x34e6('0x38')](_0x293a46['query'],_0x32d2b4['filters']));if(_0x293a46[_0x34e6('0x2d')][_0x34e6('0x39')]){_0x1c8e12[_0x34e6('0x37')]=_[_0x34e6('0x3b')](_0x1c8e12[_0x34e6('0x37')],{'$or':_['map'](_0x1c8e12[_0x34e6('0x2f')],function(_0x241d78){var _0x463e0a={};_0x463e0a[_0x241d78]={'$like':'%'+_0x293a46[_0x34e6('0x2d')][_0x34e6('0x39')]+'%'};return _0x463e0a;})});}_0x1c8e12=_[_0x34e6('0x3b')]({},_0x1c8e12,_0x293a46[_0x34e6('0x3c')]);return _0x315766['getContacts'](_0x1c8e12);}})[_0x34e6('0x23')](function(_0x3c7e4e){if(_0x3c7e4e){_0x37729d=_0x3c7e4e[_0x34e6('0x32')];if(!_0x293a46[_0x34e6('0x2d')][_0x34e6('0x33')]('nolimit')){_0x1c8e12[_0x34e6('0x1c')]=qs[_0x34e6('0x1c')](_0x293a46[_0x34e6('0x2d')]['limit']);_0x1c8e12[_0x34e6('0x1b')]=qs[_0x34e6('0x1b')](_0x293a46[_0x34e6('0x2d')][_0x34e6('0x1b')]);}return _0x315766[_0x34e6('0x52')](_0x1c8e12);}})[_0x34e6('0x23')](function(_0x487cd4){if(_0x487cd4){return _0x487cd4?{'count':_0x37729d,'rows':_0x487cd4}:null;}})[_0x34e6('0x23')](respondWithResult(_0x552a82,null))[_0x34e6('0x3e')](handleError(_0x552a82,null));}; \ No newline at end of file +var _0xcb85=['body','get','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','CmContact','ids','omit','findOne','rawAttributes','length','map','getContacts','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Companies','UserProfileResource','error','name','send','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','params','includeAll','create'];(function(_0x41c7cc,_0xeb6924){var _0x5132eb=function(_0x480c20){while(--_0x480c20){_0x41c7cc['push'](_0x41c7cc['shift']());}};_0x5132eb(++_0xeb6924);}(_0xcb85,0xba));var _0x5cb8=function(_0x1876b2,_0x5d0225){_0x1876b2=_0x1876b2-0x0;var _0x9fb1e0=_0xcb85[_0x1876b2];return _0x9fb1e0;};'use strict';var emlformat=require(_0x5cb8('0x0'));var rimraf=require(_0x5cb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cb8('0x2'));var rp=require('request-promise');var moment=require(_0x5cb8('0x3'));var BPromise=require(_0x5cb8('0x4'));var Mustache=require(_0x5cb8('0x5'));var util=require(_0x5cb8('0x6'));var path=require(_0x5cb8('0x7'));var sox=require(_0x5cb8('0x8'));var csv=require(_0x5cb8('0x9'));var ejs=require(_0x5cb8('0xa'));var fs=require('fs');var fs_extra=require(_0x5cb8('0xb'));var _=require(_0x5cb8('0xc'));var squel=require(_0x5cb8('0xd'));var crypto=require('crypto');var jsforce=require(_0x5cb8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5cb8('0x9'));var querystring=require(_0x5cb8('0xf'));var Papa=require('papaparse');var Redis=require(_0x5cb8('0x10'));var authService=require(_0x5cb8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5cb8('0x12'));var hardwareService=require(_0x5cb8('0x13'));var logger=require('../../config/logger')(_0x5cb8('0x14'));var utils=require(_0x5cb8('0x15'));var config=require(_0x5cb8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5cb8('0x17'))['db'];function respondWithStatusCode(_0x394132,_0x318c2d){_0x318c2d=_0x318c2d||0xcc;return function(_0x53265a){if(_0x53265a){return _0x394132[_0x5cb8('0x18')](_0x318c2d);}return _0x394132[_0x5cb8('0x19')](_0x318c2d)[_0x5cb8('0x1a')]();};}function respondWithResult(_0x151f85,_0x105e4a){_0x105e4a=_0x105e4a||0xc8;return function(_0x37290b){if(_0x37290b){return _0x151f85[_0x5cb8('0x19')](_0x105e4a)[_0x5cb8('0x1b')](_0x37290b);}};}function respondWithFilteredResult(_0x372070,_0x4b4f75){return function(_0xfc58de){if(_0xfc58de){var _0x5dfa6b=typeof _0x4b4f75[_0x5cb8('0x1c')]===_0x5cb8('0x1d')&&typeof _0x4b4f75[_0x5cb8('0x1e')]==='undefined';var _0x4a5a30=_0xfc58de[_0x5cb8('0x1f')];var _0x1b5f5f=_0x5dfa6b?0x0:_0x4b4f75[_0x5cb8('0x1c')];var _0x2bc559=_0x5dfa6b?_0xfc58de['count']:_0x4b4f75[_0x5cb8('0x1c')]+_0x4b4f75['limit'];var _0x55a7ee;if(_0x2bc559>=_0x4a5a30){_0x2bc559=_0x4a5a30;_0x55a7ee=0xc8;}else{_0x55a7ee=0xce;}_0x372070[_0x5cb8('0x19')](_0x55a7ee);return _0x372070[_0x5cb8('0x20')]('Content-Range',_0x1b5f5f+'-'+_0x2bc559+'/'+_0x4a5a30)[_0x5cb8('0x1b')](_0xfc58de);}return null;};}function patchUpdates(_0x49fc36){return function(_0x459a5a){try{jsonpatch[_0x5cb8('0x21')](_0x459a5a,_0x49fc36,!![]);}catch(_0x3ed904){return BPromise[_0x5cb8('0x22')](_0x3ed904);}return _0x459a5a[_0x5cb8('0x23')]();};}function saveUpdates(_0x4f4063,_0x1f7299){return function(_0x5cdfcb){if(_0x5cdfcb){return _0x5cdfcb[_0x5cb8('0x24')](_0x4f4063)[_0x5cb8('0x25')](function(_0x292738){return _0x292738;});}return null;};}function removeEntity(_0x112496,_0x164dda){return function(_0x2efd62){if(_0x2efd62){return _0x2efd62[_0x5cb8('0x26')]()[_0x5cb8('0x25')](function(){var _0x2c0ebd=_0x2efd62['get']({'plain':!![]});var _0xc4955=_0x5cb8('0x27');return db[_0x5cb8('0x28')][_0x5cb8('0x26')]({'where':{'type':_0xc4955,'resourceId':_0x2c0ebd['id']}})[_0x5cb8('0x25')](function(){return _0x2efd62;});})[_0x5cb8('0x25')](function(){_0x112496[_0x5cb8('0x19')](0xcc)[_0x5cb8('0x1a')]();});}};}function handleEntityNotFound(_0x55a2b9,_0x29f4f0){return function(_0x338107){if(!_0x338107){_0x55a2b9['sendStatus'](0x194);}return _0x338107;};}function handleError(_0x4152cb,_0x29795a){_0x29795a=_0x29795a||0x1f4;return function(_0x5b07cc){logger[_0x5cb8('0x29')](_0x5b07cc['stack']);if(_0x5b07cc[_0x5cb8('0x2a')]){delete _0x5b07cc[_0x5cb8('0x2a')];}_0x4152cb['status'](_0x29795a)[_0x5cb8('0x2b')](_0x5b07cc);};}exports[_0x5cb8('0x2c')]=function(_0x5509a6,_0x438078){var _0x55ca06={},_0x339456={},_0x37258b={'count':0x0,'rows':[]};return db[_0x5cb8('0x2d')]['describe']()[_0x5cb8('0x25')](function(_0x30f5fb){_0x339456[_0x5cb8('0x2e')]=_[_0x5cb8('0x2f')](_0x30f5fb);_0x339456[_0x5cb8('0x30')]=_[_0x5cb8('0x2f')](_0x5509a6[_0x5cb8('0x30')]);_0x339456[_0x5cb8('0x31')]=_[_0x5cb8('0x32')](_0x339456[_0x5cb8('0x2e')],_0x339456[_0x5cb8('0x30')]);_0x55ca06[_0x5cb8('0x33')]=_[_0x5cb8('0x32')](_0x339456[_0x5cb8('0x2e')],qs[_0x5cb8('0x34')](_0x5509a6[_0x5cb8('0x30')][_0x5cb8('0x34')]));_0x55ca06[_0x5cb8('0x33')]=_0x55ca06[_0x5cb8('0x33')]['length']?_0x55ca06[_0x5cb8('0x33')]:_0x339456[_0x5cb8('0x2e')];if(!_0x5509a6[_0x5cb8('0x30')][_0x5cb8('0x35')](_0x5cb8('0x36'))){_0x55ca06[_0x5cb8('0x1e')]=qs[_0x5cb8('0x1e')](_0x5509a6[_0x5cb8('0x30')][_0x5cb8('0x1e')]);_0x55ca06[_0x5cb8('0x1c')]=qs['offset'](_0x5509a6[_0x5cb8('0x30')][_0x5cb8('0x1c')]);}_0x55ca06[_0x5cb8('0x37')]=qs[_0x5cb8('0x38')](_0x5509a6[_0x5cb8('0x30')][_0x5cb8('0x38')]);_0x55ca06[_0x5cb8('0x39')]=qs[_0x5cb8('0x31')](_[_0x5cb8('0x3a')](_0x5509a6[_0x5cb8('0x30')],_0x339456[_0x5cb8('0x31')]),_0x30f5fb);if(_0x5509a6['query']['filter']){_0x55ca06['where']=_[_0x5cb8('0x3b')](_0x55ca06[_0x5cb8('0x39')],{'$or':_['map'](_0x55ca06[_0x5cb8('0x33')],function(_0x17432f){var _0x54a214={};_0x54a214[_0x17432f]={'$like':'%'+_0x5509a6[_0x5cb8('0x30')][_0x5cb8('0x3c')]+'%'};return _0x54a214;})});}_0x55ca06=_[_0x5cb8('0x3b')]({},_0x55ca06,_0x5509a6[_0x5cb8('0x3d')]);var _0x5bb82d={'where':_0x55ca06['where']};return db[_0x5cb8('0x2d')][_0x5cb8('0x1f')](_0x5bb82d)[_0x5cb8('0x25')](function(_0x30b0ef){_0x37258b[_0x5cb8('0x1f')]=_0x30b0ef;if(_0x5509a6[_0x5cb8('0x30')]['includeAll']){_0x55ca06[_0x5cb8('0x3e')]=[{'all':!![]}];}return db[_0x5cb8('0x2d')][_0x5cb8('0x3f')](_0x55ca06);})['then'](function(_0x39b159){_0x37258b[_0x5cb8('0x40')]=_0x39b159;return _0x37258b;})[_0x5cb8('0x25')](respondWithFilteredResult(_0x438078,_0x55ca06))[_0x5cb8('0x41')](handleError(_0x438078,null));})[_0x5cb8('0x41')](handleError(_0x438078,null));};exports['show']=function(_0x5e932d,_0x4b074b){var _0x408736={'raw':![],'where':{'id':_0x5e932d[_0x5cb8('0x42')]['id']}},_0x1c8f5b={};_0x1c8f5b[_0x5cb8('0x2e')]=_[_0x5cb8('0x2f')](db[_0x5cb8('0x2d')]['rawAttributes']);_0x1c8f5b[_0x5cb8('0x30')]=_[_0x5cb8('0x2f')](_0x5e932d[_0x5cb8('0x30')]);_0x1c8f5b[_0x5cb8('0x31')]=_[_0x5cb8('0x32')](_0x1c8f5b[_0x5cb8('0x2e')],_0x1c8f5b[_0x5cb8('0x30')]);_0x408736['attributes']=_[_0x5cb8('0x32')](_0x1c8f5b[_0x5cb8('0x2e')],qs[_0x5cb8('0x34')](_0x5e932d['query'][_0x5cb8('0x34')]));_0x408736[_0x5cb8('0x33')]=_0x408736['attributes']['length']?_0x408736[_0x5cb8('0x33')]:_0x1c8f5b['model'];if(_0x5e932d[_0x5cb8('0x30')][_0x5cb8('0x43')]){_0x408736[_0x5cb8('0x3e')]=[{'all':!![]}];}_0x408736=_[_0x5cb8('0x3b')]({},_0x408736,_0x5e932d[_0x5cb8('0x3d')]);return db[_0x5cb8('0x2d')]['find'](_0x408736)['then'](handleEntityNotFound(_0x4b074b,null))[_0x5cb8('0x25')](respondWithResult(_0x4b074b,null))[_0x5cb8('0x41')](handleError(_0x4b074b,null));};exports['create']=function(_0x23bafd,_0x61048a){return db[_0x5cb8('0x2d')][_0x5cb8('0x44')](_0x23bafd[_0x5cb8('0x45')],{})['then'](function(_0x3ddb85){var _0x1a729b=_0x23bafd['user'][_0x5cb8('0x46')]({'plain':!![]});if(!_0x1a729b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a729b[_0x5cb8('0x47')]===_0x5cb8('0x48')){var _0x3963e6=_0x3ddb85[_0x5cb8('0x46')]({'plain':!![]});var _0x51d6c6=_0x5cb8('0x27');return db['UserProfileSection'][_0x5cb8('0x49')]({'where':{'name':_0x51d6c6,'userProfileId':_0x1a729b['userProfileId']},'raw':!![]})['then'](function(_0x34c03c){if(_0x34c03c&&_0x34c03c[_0x5cb8('0x4a')]===0x0){return db['UserProfileResource'][_0x5cb8('0x44')]({'name':_0x3963e6[_0x5cb8('0x2a')],'resourceId':_0x3963e6['id'],'type':_0x34c03c[_0x5cb8('0x2a')],'sectionId':_0x34c03c['id']},{})[_0x5cb8('0x25')](function(){return _0x3ddb85;});}else{return _0x3ddb85;}})[_0x5cb8('0x41')](function(_0x4d824d){logger[_0x5cb8('0x29')](_0x5cb8('0x4b'),_0x4d824d);throw _0x4d824d;});}return _0x3ddb85;})['then'](respondWithResult(_0x61048a,0xc9))['catch'](handleError(_0x61048a,null));};exports[_0x5cb8('0x24')]=function(_0x74c7c1,_0x2b0464){if(_0x74c7c1[_0x5cb8('0x45')]['id']){delete _0x74c7c1[_0x5cb8('0x45')]['id'];}return db[_0x5cb8('0x2d')][_0x5cb8('0x49')]({'where':{'id':_0x74c7c1[_0x5cb8('0x42')]['id']}})[_0x5cb8('0x25')](handleEntityNotFound(_0x2b0464,null))[_0x5cb8('0x25')](saveUpdates(_0x74c7c1[_0x5cb8('0x45')],null))[_0x5cb8('0x25')](respondWithResult(_0x2b0464,null))['catch'](handleError(_0x2b0464,null));};exports['destroy']=function(_0x51127c,_0x51007f){return db[_0x5cb8('0x2d')][_0x5cb8('0x49')]({'where':{'id':_0x51127c[_0x5cb8('0x42')]['id']}})[_0x5cb8('0x25')](handleEntityNotFound(_0x51007f,null))[_0x5cb8('0x25')](removeEntity(_0x51007f,null))['catch'](handleError(_0x51007f,null));};exports['describe']=function(_0x3e8d30,_0x57d802){return db['CmCompany'][_0x5cb8('0x4c')]()['then'](respondWithResult(_0x57d802,null))[_0x5cb8('0x41')](handleError(_0x57d802,null));};exports['addContacts']=function(_0x5cddd6,_0x8d6dab,_0x19ff70){return db[_0x5cb8('0x4d')][_0x5cb8('0x49')]({'where':{'id':_0x5cddd6[_0x5cb8('0x42')]['id']}})[_0x5cb8('0x25')](handleEntityNotFound(_0x8d6dab,null))['then'](function(_0x4b001f){if(_0x4b001f){return _0x4b001f['addContacts'](_0x5cddd6[_0x5cb8('0x45')][_0x5cb8('0x4e')],_[_0x5cb8('0x4f')](_0x5cddd6[_0x5cb8('0x45')],['ids','id'])||{});}})[_0x5cb8('0x25')](respondWithResult(_0x8d6dab,null))[_0x5cb8('0x41')](handleError(_0x8d6dab,null));};exports['getContacts']=function(_0x590174,_0x31542b,_0x377146){var _0x478e32={};var _0x366af4={};var _0x54c2e5;var _0x23b0c0;return db['CmCompany'][_0x5cb8('0x50')]({'where':{'id':_0x590174['params']['id']}})[_0x5cb8('0x25')](handleEntityNotFound(_0x31542b,null))['then'](function(_0x2231b){if(_0x2231b){_0x54c2e5=_0x2231b;_0x366af4[_0x5cb8('0x2e')]=_['keys'](db[_0x5cb8('0x4d')][_0x5cb8('0x51')]);_0x366af4[_0x5cb8('0x30')]=_[_0x5cb8('0x2f')](_0x590174[_0x5cb8('0x30')]);_0x366af4[_0x5cb8('0x31')]=_[_0x5cb8('0x32')](_0x366af4[_0x5cb8('0x2e')],_0x366af4[_0x5cb8('0x30')]);_0x478e32[_0x5cb8('0x33')]=_['intersection'](_0x366af4['model'],qs['fields'](_0x590174[_0x5cb8('0x30')][_0x5cb8('0x34')]));_0x478e32['attributes']=_0x478e32['attributes'][_0x5cb8('0x52')]?_0x478e32[_0x5cb8('0x33')]:_0x366af4[_0x5cb8('0x2e')];_0x478e32[_0x5cb8('0x37')]=qs[_0x5cb8('0x38')](_0x590174[_0x5cb8('0x30')][_0x5cb8('0x38')]);_0x478e32[_0x5cb8('0x39')]=qs['filters'](_['pick'](_0x590174['query'],_0x366af4[_0x5cb8('0x31')]));if(_0x590174[_0x5cb8('0x30')][_0x5cb8('0x3c')]){_0x478e32[_0x5cb8('0x39')]=_[_0x5cb8('0x3b')](_0x478e32[_0x5cb8('0x39')],{'$or':_[_0x5cb8('0x53')](_0x478e32['attributes'],function(_0x13ef1a){var _0x14e2d6={};_0x14e2d6[_0x13ef1a]={'$like':'%'+_0x590174[_0x5cb8('0x30')][_0x5cb8('0x3c')]+'%'};return _0x14e2d6;})});}_0x478e32=_[_0x5cb8('0x3b')]({},_0x478e32,_0x590174[_0x5cb8('0x3d')]);return _0x54c2e5[_0x5cb8('0x54')](_0x478e32);}})[_0x5cb8('0x25')](function(_0x41a1cd){if(_0x41a1cd){_0x23b0c0=_0x41a1cd[_0x5cb8('0x52')];if(!_0x590174[_0x5cb8('0x30')][_0x5cb8('0x35')]('nolimit')){_0x478e32[_0x5cb8('0x1e')]=qs[_0x5cb8('0x1e')](_0x590174[_0x5cb8('0x30')][_0x5cb8('0x1e')]);_0x478e32[_0x5cb8('0x1c')]=qs[_0x5cb8('0x1c')](_0x590174[_0x5cb8('0x30')][_0x5cb8('0x1c')]);}return _0x54c2e5['getContacts'](_0x478e32);}})[_0x5cb8('0x25')](function(_0x652215){if(_0x652215){return _0x652215?{'count':_0x23b0c0,'rows':_0x652215}:null;}})['then'](respondWithResult(_0x31542b,null))['catch'](handleError(_0x31542b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4a0a2f3..c0895d9 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 _0x1797=['moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','util','../../config/logger','api'];(function(_0x384fca,_0x5b7c99){var _0x1cb248=function(_0x400fb2){while(--_0x400fb2){_0x384fca['push'](_0x384fca['shift']());}};_0x1cb248(++_0x5b7c99);}(_0x1797,0x105));var _0x7179=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1797[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x7179('0x0'));var logger=require(_0x7179('0x1'))(_0x7179('0x2'));var moment=require(_0x7179('0x3'));var BPromise=require(_0x7179('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7179('0x5'));var rimraf=require(_0x7179('0x6'));var config=require(_0x7179('0x7'));var attributes=require(_0x7179('0x8'));module[_0x7179('0x9')]=function(_0x4b4fa3,_0x55e354){return _0x4b4fa3[_0x7179('0xa')]('CmCompany',attributes,{'tableName':_0x7179('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6edb=['exports','define','CmCompany','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x146961,_0x5de6aa){var _0x1eae6c=function(_0x67b185){while(--_0x67b185){_0x146961['push'](_0x146961['shift']());}};_0x1eae6c(++_0x5de6aa);}(_0x6edb,0x99));var _0xb6ed=function(_0x936f18,_0x110725){_0x936f18=_0x936f18-0x0;var _0x36b3b7=_0x6edb[_0x936f18];return _0x36b3b7;};'use strict';var _=require(_0xb6ed('0x0'));var util=require(_0xb6ed('0x1'));var logger=require(_0xb6ed('0x2'))(_0xb6ed('0x3'));var moment=require(_0xb6ed('0x4'));var BPromise=require('bluebird');var rp=require(_0xb6ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb6ed('0x6'));var attributes=require('./cmCompany.attributes');module[_0xb6ed('0x7')]=function(_0x11fe95,_0x39add0){return _0x11fe95[_0xb6ed('0x8')](_0xb6ed('0x9'),attributes,{'tableName':'cm_companies','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 eeae573..9a83f35 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 _0x13d3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','stringify','error','message','CmCompany,\x20%s,\x20%s','result','lodash','util'];(function(_0x120435,_0x5b86d3){var _0x5ac07d=function(_0x46926c){while(--_0x46926c){_0x120435['push'](_0x120435['shift']());}};_0x5ac07d(++_0x5b86d3);}(_0x13d3,0x12a));var _0x313d=function(_0x58a043,_0x383c8c){_0x58a043=_0x58a043-0x0;var _0x5a8ca0=_0x13d3[_0x58a043];return _0x5a8ca0;};'use strict';var _=require(_0x313d('0x0'));var util=require(_0x313d('0x1'));var moment=require(_0x313d('0x2'));var BPromise=require(_0x313d('0x3'));var rs=require(_0x313d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x313d('0x5'))['db'];var utils=require(_0x313d('0x6'));var logger=require(_0x313d('0x7'))(_0x313d('0x8'));var config=require(_0x313d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x313d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e8e7d,_0x2a4091,_0x353000){return new BPromise(function(_0x5af2ea,_0x1cecd2){return client[_0x313d('0xb')](_0x5e8e7d,_0x353000)[_0x313d('0xc')](function(_0x23d4d2){logger[_0x313d('0xd')]('CmCompany,\x20%s,\x20%s',_0x2a4091,_0x313d('0xe'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x2a4091,_0x313d('0xe'),JSON[_0x313d('0xf')](_0x23d4d2));if(_0x23d4d2[_0x313d('0x10')]){if(_0x23d4d2['error']['code']===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x2a4091,_0x23d4d2['error'][_0x313d('0x11')]);return _0x1cecd2(_0x23d4d2[_0x313d('0x10')][_0x313d('0x11')]);}logger[_0x313d('0x10')](_0x313d('0x12'),_0x2a4091,_0x23d4d2[_0x313d('0x10')][_0x313d('0x11')]);return _0x5af2ea(_0x23d4d2[_0x313d('0x10')][_0x313d('0x11')]);}else{logger['info'](_0x313d('0x12'),_0x2a4091,_0x313d('0xe'));_0x5af2ea(_0x23d4d2[_0x313d('0x13')][_0x313d('0x11')]);}})['catch'](function(_0x38e71a){logger[_0x313d('0x10')](_0x313d('0x12'),_0x2a4091,_0x38e71a);_0x1cecd2(_0x38e71a);});});} \ No newline at end of file +var _0x8510=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x835a91,_0x5c6f0f){var _0x1ee519=function(_0x514ecc){while(--_0x514ecc){_0x835a91['push'](_0x835a91['shift']());}};_0x1ee519(++_0x5c6f0f);}(_0x8510,0x113));var _0x0851=function(_0x2aef75,_0x13edab){_0x2aef75=_0x2aef75-0x0;var _0x26e106=_0x8510[_0x2aef75];return _0x26e106;};'use strict';var _=require(_0x0851('0x0'));var util=require(_0x0851('0x1'));var moment=require(_0x0851('0x2'));var BPromise=require(_0x0851('0x3'));var rs=require(_0x0851('0x4'));var fs=require('fs');var Redis=require(_0x0851('0x5'));var db=require(_0x0851('0x6'))['db'];var utils=require(_0x0851('0x7'));var logger=require('../../config/logger')(_0x0851('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0851('0x9')][_0x0851('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x483e36,_0x5be703,_0xb1dc67){return new BPromise(function(_0xb8b537,_0x58b4d3){return client[_0x0851('0xb')](_0x483e36,_0xb1dc67)[_0x0851('0xc')](function(_0x1f6adf){logger['info'](_0x0851('0xd'),_0x5be703,_0x0851('0xe'));logger['debug'](_0x0851('0xf'),_0x5be703,_0x0851('0xe'),JSON[_0x0851('0x10')](_0x1f6adf));if(_0x1f6adf['error']){if(_0x1f6adf[_0x0851('0x11')]['code']===0x1f4){logger[_0x0851('0x11')]('CmCompany,\x20%s,\x20%s',_0x5be703,_0x1f6adf[_0x0851('0x11')][_0x0851('0x12')]);return _0x58b4d3(_0x1f6adf[_0x0851('0x11')][_0x0851('0x12')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x5be703,_0x1f6adf[_0x0851('0x11')]['message']);return _0xb8b537(_0x1f6adf[_0x0851('0x11')][_0x0851('0x12')]);}else{logger[_0x0851('0x13')]('CmCompany,\x20%s,\x20%s',_0x5be703,_0x0851('0xe'));_0xb8b537(_0x1f6adf[_0x0851('0x14')][_0x0851('0x12')]);}})['catch'](function(_0x1bcd90){logger[_0x0851('0x11')](_0x0851('0xd'),_0x5be703,_0x1bcd90);_0x58b4d3(_0x1bcd90);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 061acb1..a34c4bd 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 _0x7903=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','get','/describe','describe','show','/:id/contacts','getContacts','post','create','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7903,0x84));var _0x3790=function(_0x1b9204,_0x27f596){_0x1b9204=_0x1b9204-0x0;var _0x2659c7=_0x7903[_0x1b9204];return _0x2659c7;};'use strict';var multer=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var path=require(_0x3790('0x2'));var timeout=require(_0x3790('0x3'));var express=require(_0x3790('0x4'));var router=express[_0x3790('0x5')]();var fs_extra=require(_0x3790('0x6'));var auth=require(_0x3790('0x7'));var interaction=require(_0x3790('0x8'));var config=require(_0x3790('0x9'));var controller=require(_0x3790('0xa'));router['get']('/',auth[_0x3790('0xb')](),controller['index']);router[_0x3790('0xc')](_0x3790('0xd'),auth[_0x3790('0xb')](),controller[_0x3790('0xe')]);router[_0x3790('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x3790('0xf')]);router[_0x3790('0xc')](_0x3790('0x10'),auth[_0x3790('0xb')](),controller[_0x3790('0x11')]);router[_0x3790('0x12')]('/',auth[_0x3790('0xb')](),controller[_0x3790('0x13')]);router[_0x3790('0x12')](_0x3790('0x10'),auth[_0x3790('0xb')](),controller['addContacts']);router[_0x3790('0x14')](_0x3790('0x15'),auth[_0x3790('0xb')](),controller[_0x3790('0x16')]);router[_0x3790('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x3790('0x18')]);module[_0x3790('0x19')]=router; \ No newline at end of file +var _0x76d5=['/:id/contacts','getContacts','post','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x76d5,0x17e));var _0x576d=function(_0xcb5bf6,_0x1fb11d){_0xcb5bf6=_0xcb5bf6-0x0;var _0x299a87=_0x76d5[_0xcb5bf6];return _0x299a87;};'use strict';var multer=require(_0x576d('0x0'));var util=require('util');var path=require(_0x576d('0x1'));var timeout=require('connect-timeout');var express=require(_0x576d('0x2'));var router=express[_0x576d('0x3')]();var fs_extra=require(_0x576d('0x4'));var auth=require(_0x576d('0x5'));var interaction=require(_0x576d('0x6'));var config=require('../../config/environment');var controller=require(_0x576d('0x7'));router[_0x576d('0x8')]('/',auth[_0x576d('0x9')](),controller['index']);router[_0x576d('0x8')](_0x576d('0xa'),auth['isAuthenticated'](),controller[_0x576d('0xb')]);router[_0x576d('0x8')](_0x576d('0xc'),auth[_0x576d('0x9')](),controller[_0x576d('0xd')]);router[_0x576d('0x8')](_0x576d('0xe'),auth['isAuthenticated'](),controller[_0x576d('0xf')]);router[_0x576d('0x10')]('/',auth[_0x576d('0x9')](),controller[_0x576d('0x11')]);router[_0x576d('0x10')](_0x576d('0xe'),auth[_0x576d('0x9')](),controller['addContacts']);router[_0x576d('0x12')](_0x576d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x576d('0x13')](_0x576d('0xc'),auth[_0x576d('0x9')](),controller[_0x576d('0x14')]);module[_0x576d('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 0d64add..abd3677 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 _0xafde=['lodash','sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x983dc2,_0x5cca11){var _0x4b0315=function(_0x1042f9){while(--_0x1042f9){_0x983dc2['push'](_0x983dc2['shift']());}};_0x4b0315(++_0x5cca11);}(_0xafde,0x9a));var _0xeafd=function(_0x459517,_0x3c1dbe){_0x459517=_0x459517-0x0;var _0x2fe044=_0xafde[_0x459517];return _0x2fe044;};'use strict';var _=require(_0xeafd('0x0'));var Sequelize=require(_0xeafd('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xeafd('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xeafd('0x2')]},'street':{'type':Sequelize[_0xeafd('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xeafd('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeafd('0x3')]},'phone':{'type':Sequelize[_0xeafd('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xeafd('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xeafd('0x2')]},'facebook':{'type':Sequelize[_0xeafd('0x2')]},'fb_data':{'type':Sequelize[_0xeafd('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xeafd('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xeafd('0x2')]},'line':{'type':Sequelize[_0xeafd('0x2')]},'wechat':{'type':Sequelize[_0xeafd('0x2')]},'telegram':{'type':Sequelize[_0xeafd('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xeafd('0x2')]},'priority':{'type':Sequelize[_0xeafd('0x4')](0x2)[_0xeafd('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xeafd('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xeafd('0x2')]},'utcOffset':{'type':Sequelize[_0xeafd('0x4')]}}; \ No newline at end of file +var _0x85b7=['INTEGER','UNSIGNED','DATE','lodash','exports','STRING'];(function(_0x48d794,_0x1597d0){var _0x20cea4=function(_0x462f19){while(--_0x462f19){_0x48d794['push'](_0x48d794['shift']());}};_0x20cea4(++_0x1597d0);}(_0x85b7,0x7b));var _0x785b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x85b7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x785b('0x0'));var Sequelize=require('sequelize');module[_0x785b('0x1')]={'firstName':{'type':Sequelize[_0x785b('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x785b('0x2')]},'postalCode':{'type':Sequelize[_0x785b('0x2')]},'city':{'type':Sequelize[_0x785b('0x2')]},'country':{'type':Sequelize[_0x785b('0x2')]},'dateOfBirth':{'type':Sequelize[_0x785b('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x785b('0x2')]},'mobile':{'type':Sequelize[_0x785b('0x2')]},'fax':{'type':Sequelize[_0x785b('0x2')]},'email':{'type':Sequelize[_0x785b('0x2')]},'url':{'type':Sequelize[_0x785b('0x2')]},'facebook':{'type':Sequelize[_0x785b('0x2')]},'fb_data':{'type':Sequelize[_0x785b('0x2')]},'twitter':{'type':Sequelize[_0x785b('0x2')]},'skype':{'type':Sequelize[_0x785b('0x2')]},'teams':{'type':Sequelize[_0x785b('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x785b('0x2')]},'wechat':{'type':Sequelize[_0x785b('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x785b('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x785b('0x2')]},'priority':{'type':Sequelize[_0x785b('0x3')](0x2)[_0x785b('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x785b('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x785b('0x2')]},'utcOffset':{'type':Sequelize[_0x785b('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 4917211..804d99c 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 _0x3879=['lodash','squel','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','set','Content-Range','then','destroy','sendStatus','error','stack','name','index','describe','getOptions','user','catch','CmContact','find','params','tags','keys','length','cf_','columnName','query','analytics','CmCustomField','findAll','displayName','alias','custom','values','info','forEach','hasOwnProperty','merge','body','from','mergeWith','isArray','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','create','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','show','Tag','Tags','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','get','$and','map','format','cf_%d','omit','pickBy','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','nolimit','limit','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','sequelize','`ItemType`.OrderBy','CmHopperId','item','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','findOne','rawAttributes','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','file','filename','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','parse','meta','import','User','agent','binding','firstName','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','child_process','exit','mail','openchannel','fax','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','color','chat','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','substatus','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x3879,0xfc));var _0x9387=function(_0x2bde7c,_0x4e2352){_0x2bde7c=_0x2bde7c-0x0;var _0x41c8dc=_0x3879[_0x2bde7c];return _0x41c8dc;};'use strict';var moment=require(_0x9387('0x0'));var BPromise=require(_0x9387('0x1'));var util=require(_0x9387('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x9387('0x3'));var squel=require(_0x9387('0x4'));var Papa=require(_0x9387('0x5'));var Redis=require(_0x9387('0x6'));var contacts=require('../../components/contacts');var qs=require(_0x9387('0x7'));var logger=require('../../config/logger')(_0x9387('0x8'));var config=require(_0x9387('0x9'));var shared=require('../../config/environment/shared');var db=require(_0x9387('0xa'))['db'];config[_0x9387('0xb')]=_[_0x9387('0xc')](config[_0x9387('0xb')],{'host':_0x9387('0xd'),'port':0x18eb});var socket=require(_0x9387('0xe'))(new Redis(config[_0x9387('0xb')]));require(_0x9387('0xf'))[_0x9387('0x10')](socket);function respondWithResult(_0x23cf50,_0xc2b0ed){_0xc2b0ed=_0xc2b0ed||0xc8;return function(_0x52d5d3){if(_0x52d5d3){return _0x23cf50[_0x9387('0x11')](_0xc2b0ed)[_0x9387('0x12')](_0x52d5d3);}};}function respondWithFilteredResult(_0x5dc380,_0x47f35b){return function(_0x5d8dd5){if(_0x5d8dd5){var _0x30dda8=typeof _0x47f35b[_0x9387('0x13')]===_0x9387('0x14')&&typeof _0x47f35b['limit']==='undefined';var _0x4d5b91=_0x5d8dd5[_0x9387('0x15')];var _0x288aa7=_0x30dda8?0x0:_0x47f35b[_0x9387('0x13')];var _0x642b6d=_0x30dda8?_0x5d8dd5[_0x9387('0x15')]:_0x47f35b[_0x9387('0x13')]+_0x47f35b['limit'];var _0x1cc027;if(_0x642b6d>=_0x4d5b91){_0x642b6d=_0x4d5b91;_0x1cc027=0xc8;}else{_0x1cc027=0xce;}_0x5dc380[_0x9387('0x11')](_0x1cc027);return _0x5dc380[_0x9387('0x16')](_0x9387('0x17'),_0x288aa7+'-'+_0x642b6d+'/'+_0x4d5b91)[_0x9387('0x12')](_0x5d8dd5);}return null;};}function saveUpdates(_0xe7e9a1){return function(_0x21fe84){if(_0x21fe84){return _0x21fe84['update'](_0xe7e9a1)[_0x9387('0x18')](function(_0x18173c){return _0x18173c;});}return null;};}function removeEntity(_0x316db5){return function(_0x417fe5){if(_0x417fe5){return _0x417fe5[_0x9387('0x19')]()[_0x9387('0x18')](function(){_0x316db5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x495357){return function(_0x574eb8){if(!_0x574eb8){_0x495357[_0x9387('0x1a')](0x194);}return _0x574eb8;};}function handleError(_0x2f2183,_0x23eaf9){_0x23eaf9=_0x23eaf9||0x1f4;return function(_0x3289da){logger[_0x9387('0x1b')](_0x3289da[_0x9387('0x1c')]);if(_0x3289da[_0x9387('0x1d')]){delete _0x3289da[_0x9387('0x1d')];}_0x2f2183[_0x9387('0x11')](_0x23eaf9)['send'](_0x3289da);};}exports[_0x9387('0x1e')]=function(_0x206bfe,_0x4b5b0b){var _0x53811a={};return contacts[_0x9387('0x1f')]()[_0x9387('0x18')](function(_0x3cbdbe){_0x53811a=qs[_0x9387('0x20')](_0x3cbdbe,_0x206bfe);return contacts['findAll'](_0x206bfe['query'],_0x206bfe[_0x9387('0x21')],_0x53811a,_0x3cbdbe);})[_0x9387('0x18')](respondWithFilteredResult(_0x4b5b0b,_0x53811a))[_0x9387('0x22')](handleError(_0x4b5b0b,null));};exports[_0x9387('0x19')]=function(_0x2f57a3,_0x3ae1d7){return db[_0x9387('0x23')][_0x9387('0x24')]({'where':{'id':_0x2f57a3[_0x9387('0x25')]['id']}})[_0x9387('0x18')](handleEntityNotFound(_0x3ae1d7,null))[_0x9387('0x18')](removeEntity(_0x3ae1d7,null))[_0x9387('0x22')](handleError(_0x3ae1d7,null));};exports[_0x9387('0x1f')]=function(_0x1dca99,_0x97bc71){return db[_0x9387('0x23')][_0x9387('0x1f')]()[_0x9387('0x18')](function(_0x42731a){delete _0x42731a[_0x9387('0x26')];for(var _0x5da4dc=0x0;_0x5da4dc0x0){return new Promise(function(_0x3721bb){var _0x34b217=[];for(var _0x33d6b8=0x0;_0x33d6b8<_0x2cadd4['length'];_0x33d6b8++){_0x34b217[_0x9387('0x5e')](insertAdditionalPhones(_0x2cadd4[_0x33d6b8][_0x9387('0x62')],_0x2cadd4[_0x33d6b8]['additionalPhones']));}Promise[_0x9387('0x63')](_0x34b217)['then'](function(){_0x3721bb(0x1);});})['then'](function(){return{'success':_0x3f73d2,'failure':_0x1af50e,'duplicates':_0x1a0277};});}else{return{'success':_0x3f73d2,'failure':_0x1af50e,'duplicates':_0x1a0277};}}})[_0x9387('0x18')](respondWithResult(_0x2931b7,0xc9))[_0x9387('0x22')](handleError(_0x2931b7,null));};exports[_0x9387('0x64')]=function(_0x406062,_0x23fa38){var _0xecfd9a;return db[_0x9387('0x23')]['describe']()[_0x9387('0x18')](function(_0xb63ac2){return db[_0x9387('0x23')][_0x9387('0x24')]({'where':{'id':_0x406062[_0x9387('0x25')]['id']},'include':[{'model':db[_0x9387('0x65')],'as':_0x9387('0x66'),'attributes':['id',_0x9387('0x1d'),'color'],'required':_0x406062['query']['tag']?!![]:![]},{'model':db[_0x9387('0x49')],'as':_0x9387('0x67'),'where':{'CmContactId':_0x406062['params']['id']},'required':![],'include':[{'model':db[_0x9387('0x68')],'as':_0x9387('0x69')}]}],'order':[db['sequelize'][_0x9387('0x6a')](_0x9387('0x6b'))],'attributes':_[_0x9387('0x27')](_0xb63ac2)});})[_0x9387('0x18')](function(_0x3cf6db){if(!_[_0x9387('0x54')](_0x3cf6db)){_0xecfd9a=_0x3cf6db[_0x9387('0x6c')]({'plain':!![]});var _0x4c2835={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3cf6db&&_0x3cf6db[_0x9387('0x5f')]){if(_0x3cf6db[_0x9387('0x5f')]){_0x4c2835[_0x9387('0x5c')][_0x9387('0x6d')]['push']({'ListId':{'$ne':_0x3cf6db['ListId']}});}}return db[_0x9387('0x2d')][_0x9387('0x2e')](_0x4c2835);}})['then'](function(_0x4effd1){if(!_[_0x9387('0x54')](_0x4effd1)){return _['omit'](_0xecfd9a,_[_0x9387('0x6e')](_0x4effd1,function(_0x29885f){return util[_0x9387('0x6f')](_0x9387('0x70'),_0x29885f['id']);}));}})[_0x9387('0x18')](handleEntityNotFound(_0x23fa38,null))['then'](respondWithResult(_0x23fa38,null))['catch'](handleError(_0x23fa38,null));};exports[_0x9387('0x40')]=function(_0x8d122d,_0x5e792a){var _0x429982;if(_0x8d122d[_0x9387('0x37')]['id']){delete _0x8d122d[_0x9387('0x37')]['id'];}if(!_['isNil'](_0x8d122d['body'][_0x9387('0x55')])){var _0x598859=_0x8d122d[_0x9387('0x37')]['dialTimezone'];if(!_[_0x9387('0x54')](shared['timezones'][_0x598859]))_0x8d122d[_0x9387('0x37')][_0x9387('0x57')]=shared[_0x9387('0x56')][_0x598859][_0x9387('0x57')];}return db[_0x9387('0x23')][_0x9387('0x24')]({'where':{'id':_0x8d122d['params']['id']}})[_0x9387('0x18')](handleEntityNotFound(_0x5e792a,null))[_0x9387('0x18')](saveUpdates(_0x8d122d[_0x9387('0x37')],null))[_0x9387('0x18')](function(_0x319c7d){_0x429982=_0x319c7d;var _0x207e09={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x319c7d&&_0x319c7d[_0x9387('0x5f')]){if(_0x319c7d[_0x9387('0x5f')]){_0x207e09[_0x9387('0x5c')][_0x9387('0x6d')][_0x9387('0x5e')]({'ListId':{'$ne':_0x319c7d['ListId']}});}}return db['CmCustomField'][_0x9387('0x2e')](_0x207e09);})[_0x9387('0x18')](function(_0x309d53){if(_0x309d53){return _[_0x9387('0x71')](_[_0x9387('0x72')](_0x8d122d['body'],function(_0x48e3b0,_0x4e4116){return _['startsWith'](_0x4e4116,'cf_');}),_[_0x9387('0x6e')](_0x309d53,function(_0x3d1c7a){return util[_0x9387('0x6f')](_0x9387('0x70'),_0x3d1c7a['id']);}));}})[_0x9387('0x18')](function(_0x45e9fe){if(_0x45e9fe&&!_['isEmpty'](_0x45e9fe)){var _0x43c745=squel[_0x9387('0x40')]()[_0x9387('0x73')](_0x9387('0x74'))[_0x9387('0x75')](_0x45e9fe)[_0x9387('0x5c')](_0x9387('0x76'),_0x8d122d[_0x9387('0x25')]['id'])[_0x9387('0x77')]();return db['sequelize'][_0x9387('0x2b')](_0x43c745[_0x9387('0x78')],{'replacements':_0x43c745[_0x9387('0x32')]});}})[_0x9387('0x18')](function(){if(_0x8d122d[_0x9387('0x37')][_0x9387('0x79')]&&_0x429982){return db[_0x9387('0x3c')][_0x9387('0x40')]({'phone':_0x8d122d['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x429982['id']}});}})[_0x9387('0x18')](function(){return _0x429982;})[_0x9387('0x18')](respondWithResult(_0x5e792a,null))[_0x9387('0x22')](handleError(_0x5e792a,null));};exports[_0x9387('0x7a')]=function(_0x44ca35,_0xc19dd2){var _0x1cbe72={};var _0x40d908={};var _0x326deb;var _0x48869c;return db[_0x9387('0x23')]['findOne']({'where':{'id':_0x44ca35[_0x9387('0x25')]['id']}})[_0x9387('0x18')](handleEntityNotFound(_0xc19dd2,null))[_0x9387('0x18')](function(_0x2fcd29){if(_0x2fcd29){_0x326deb=_0x2fcd29;_0x40d908['model']=_[_0x9387('0x27')](db[_0x9387('0x65')]['rawAttributes']);_0x40d908['query']=_[_0x9387('0x27')](_0x44ca35[_0x9387('0x2b')]);_0x40d908[_0x9387('0x7b')]=_[_0x9387('0x7c')](_0x40d908[_0x9387('0x7d')],_0x40d908[_0x9387('0x2b')]);_0x1cbe72[_0x9387('0x7e')]=_['intersection'](_0x40d908[_0x9387('0x7d')],qs['fields'](_0x44ca35['query'][_0x9387('0x7f')]));_0x1cbe72['attributes']=_0x1cbe72[_0x9387('0x7e')]['length']?_0x1cbe72[_0x9387('0x7e')]:_0x40d908[_0x9387('0x7d')];_0x1cbe72[_0x9387('0x80')]=qs[_0x9387('0x81')](_0x44ca35['query'][_0x9387('0x81')]);_0x1cbe72[_0x9387('0x5c')]=qs[_0x9387('0x7b')](_[_0x9387('0x82')](_0x44ca35['query'],_0x40d908[_0x9387('0x7b')]));if(_0x44ca35[_0x9387('0x2b')]['filter']){_0x1cbe72['where']=_[_0x9387('0x36')](_0x1cbe72[_0x9387('0x5c')],{'$or':_[_0x9387('0x6e')](_0x1cbe72[_0x9387('0x7e')],function(_0x4ec482){var _0x54aa09={};_0x54aa09[_0x4ec482]={'$like':'%'+_0x44ca35[_0x9387('0x2b')][_0x9387('0x83')]+'%'};return _0x54aa09;})});}_0x1cbe72=_['merge']({},_0x1cbe72,_0x44ca35[_0x9387('0x84')]);return _0x326deb[_0x9387('0x7a')](_0x1cbe72);}})[_0x9387('0x18')](function(_0x530dd7){if(_0x530dd7){_0x48869c=_0x530dd7[_0x9387('0x28')];if(!_0x44ca35[_0x9387('0x2b')][_0x9387('0x35')](_0x9387('0x85'))){_0x1cbe72[_0x9387('0x86')]=qs['limit'](_0x44ca35[_0x9387('0x2b')][_0x9387('0x86')]);_0x1cbe72['offset']=qs[_0x9387('0x13')](_0x44ca35[_0x9387('0x2b')][_0x9387('0x13')]);}return _0x326deb['getTags'](_0x1cbe72);}})[_0x9387('0x18')](function(_0x23f6e8){if(_0x23f6e8){return _0x23f6e8?{'count':_0x48869c,'rows':_0x23f6e8}:null;}})[_0x9387('0x18')](respondWithResult(_0xc19dd2,null))[_0x9387('0x22')](handleError(_0xc19dd2,null));};exports[_0x9387('0x87')]=function(_0x1b474e,_0x31b336){if(_0x1b474e['body']['id']){delete _0x1b474e[_0x9387('0x37')]['id'];}return db['CmContact']['findOne']({'where':{'id':_0x1b474e[_0x9387('0x25')]['id']}})['then'](handleEntityNotFound(_0x31b336,null))[_0x9387('0x18')](function(_0x243440){if(_0x243440){return _0x243440[_0x9387('0x87')](_0x1b474e[_0x9387('0x37')]['ids']||[]);}return null;})[_0x9387('0x18')](respondWithResult(_0x31b336,null))[_0x9387('0x22')](handleError(_0x31b336,null));};exports[_0x9387('0x88')]=function(_0x64a66d,_0x387fca){var _0x2aeca0=[];_0x2aeca0['push'](addAdditionalPhones(_0x64a66d['body']));Promise[_0x9387('0x63')](_0x2aeca0)[_0x9387('0x18')](function(){_0x2aeca0=[];_0x2aeca0[_0x9387('0x5e')](deleteCmHopperPhones(_0x64a66d[_0x9387('0x37')]['id']));_0x2aeca0['push'](addCmHopperPhones(_0x64a66d[_0x9387('0x37')]['id']));Promise[_0x9387('0x63')](_0x2aeca0)[_0x9387('0x18')](function(){return[0x1];})[_0x9387('0x18')](respondWithResult(_0x387fca,null));});};function addAdditionalPhones(_0x1831a8){var _0x4424bc;return new Promise(function(_0x5d10ee){return db[_0x9387('0x49')][_0x9387('0x19')]({'where':{'CmContactId':_0x1831a8['id']}})[_0x9387('0x18')](function(){db[_0x9387('0x68')][_0x9387('0x2e')]({'raw':!![],'attributes':['id',_0x9387('0x89')]})[_0x9387('0x18')](function(_0x18e229){var _0xc3429d=[];for(var _0x3dc70a=0x0;_0x3dc70a<_0x1831a8[_0x9387('0x8a')][_0x9387('0x28')];_0x3dc70a++){var _0x134593=_0x1831a8[_0x9387('0x8b')]?_[_0x9387('0x54')](_0x1831a8[_0x9387('0x8b')][_0x3dc70a])?'':_0x1831a8[_0x9387('0x8b')][_0x3dc70a]:_0x1831a8[_0x9387('0x8a')][_0x3dc70a][_0x9387('0x8c')]?_0x1831a8[_0x9387('0x8a')][_0x3dc70a][_0x9387('0x8c')]:'';var _0x467b59=_[_0x9387('0x54')](_0x1831a8['items'][_0x3dc70a][_0x9387('0x8d')])?'':_0x1831a8[_0x9387('0x8a')][_0x3dc70a]['description'];var _0x6fda3c=_0x134593+':'+_0x1831a8[_0x9387('0x8a')][_0x3dc70a][_0x9387('0x79')]+'§'+_0x467b59;if(_['isNil'](_0x4424bc))_0x4424bc=_0x6fda3c;else _0x4424bc+=';'+_0x6fda3c;var _0x59028f=null;var _0x94f97f=null;if(_0x1831a8[_0x9387('0x8b')]){if(!_[_0x9387('0x54')](_0x1831a8['item_types'][_0x3dc70a])){_0x94f97f=_['find'](_0x18e229,function(_0x357217){return _0x357217['id']===_0x1831a8[_0x9387('0x8b')][_0x3dc70a];});if(!_[_0x9387('0x54')](_0x94f97f)){_0x59028f=_0x94f97f[_0x9387('0x89')];}}}else{if(!_['isNil'](_0x1831a8[_0x9387('0x8a')][_0x3dc70a])){_0x94f97f=_[_0x9387('0x24')](_0x18e229,function(_0x1d8426){return _0x1d8426['id']===_0x1831a8[_0x9387('0x8a')][_0x3dc70a][_0x9387('0x8c')];});if(!_[_0x9387('0x54')](_0x94f97f)){_0x59028f=_0x3dc70a;}}}if(_[_0x9387('0x54')](_0x59028f)){_0x59028f=0x64;}_0xc3429d[_0x9387('0x5e')](addAdditionalPhone(_0x1831a8['id'],_0x1831a8[_0x9387('0x8a')][_0x3dc70a]['phone'],_0x1831a8[_0x9387('0x8b')]?_[_0x9387('0x54')](_0x1831a8[_0x9387('0x8b')][_0x3dc70a])?null:_0x1831a8[_0x9387('0x8b')][_0x3dc70a]:_0x1831a8[_0x9387('0x8a')][_0x3dc70a][_0x9387('0x8c')]?_0x1831a8[_0x9387('0x8a')][_0x3dc70a][_0x9387('0x8c')]:null,_0x59028f,_0x467b59));}Promise['all'](_0xc3429d)[_0x9387('0x18')](function(){db['CmContact'][_0x9387('0x40')]({'AdditionalPhones':_0x4424bc},{'where':{'id':_0x1831a8['id']}})[_0x9387('0x18')](function(){_0x5d10ee(0x1);});});});});});}function addAdditionalPhone(_0x265aca,_0x57ac52,_0xa69e9d,_0xa427d0,_0x52e013){return db[_0x9387('0x49')]['find']({'where':{'CmContactId':_0x265aca,'item':_0x57ac52}})['then'](function(_0x77a3d2){if(_0x77a3d2)logger['info'](_0x9387('0x8e'),_0x77a3d2);else{db[_0x9387('0x49')][_0x9387('0x53')]({'CmContactId':_0x265aca,'item':_0x57ac52,'ItemTypeId':_0xa69e9d,'OrderBy':_0xa427d0,'ItemClass':_0x9387('0x8f'),'description':_0x52e013});}});}function deleteCmHopperPhones(_0x4f00c1){return new Promise(function(_0x196769){return db['CmHopper'][_0x9387('0x2e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4f00c1}})[_0x9387('0x18')](function(_0x5d5f05){db[_0x9387('0x90')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x9387('0x6e')](_0x5d5f05,'id')}}});})[_0x9387('0x18')](function(){_0x196769(0x1);});});}function addCmHopperPhones(_0x3be291){return new Promise(function(_0x45f78a){return db[_0x9387('0x3c')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3be291}})[_0x9387('0x18')](function(_0x168ffb){var _0x5f305d=[];_['map'](_0x168ffb,function(_0x206a6c){_0x5f305d[_0x9387('0x5e')](createCmHopperPhone(_0x3be291,_0x206a6c['id']));});Promise[_0x9387('0x63')](_0x5f305d)[_0x9387('0x18')](function(){_0x45f78a(0x1);});});});}function createCmHopperPhone(_0x17e8a9,_0x12e94d){return new Promise(function(_0x4ae199){db['CmContactHasItem'][_0x9387('0x2e')]({'raw':!![],'attributes':['item',_0x9387('0x89')],'where':{'CmContactId':_0x17e8a9,'ItemClass':_0x9387('0x8f')},'include':[{'model':db[_0x9387('0x68')],'attributes':[_0x9387('0x89')],'as':_0x9387('0x69')}],'order':[_0x9387('0x89'),db[_0x9387('0x91')][_0x9387('0x6a')](_0x9387('0x92'))]})['then'](function(_0x2021e8){var _0x5bfb55=0x1;var _0x4c56b5=_[_0x9387('0x6e')](_0x2021e8,function(_0x5f3c8a){_0x5f3c8a[_0x9387('0x93')]=_0x12e94d;_0x5f3c8a[_0x9387('0x79')]=_0x5f3c8a[_0x9387('0x94')];_0x5f3c8a[_0x9387('0x89')]=_0x5bfb55;delete _0x5f3c8a['ItemType.OrderBy'];_0x5bfb55=_0x5bfb55+0x1;return _0x5f3c8a;});return db['CmHopperAdditionalPhone'][_0x9387('0x59')](_0x4c56b5,{});})[_0x9387('0x18')](function(){_0x4ae199(0x1);});});}function insertAdditionalPhones(_0x3376a0,_0x31cde9){return new Promise(function(_0x73f1c9){var _0x598252=[];for(var _0x14e228=0x0;_0x14e228<_0x31cde9[_0x9387('0x28')];_0x14e228++){var _0x1749b5=_0x31cde9[_0x14e228];_0x598252[_0x9387('0x5e')](parseContactItemType(_0x1749b5));}Promise[_0x9387('0x63')](_0x598252)[_0x9387('0x18')](function(){var _0x4fd1b={'id':_0x3376a0['id'],'items':_0x31cde9};return addAdditionalPhones(_0x4fd1b)[_0x9387('0x18')](function(){return addCmHopperPhones(_0x3376a0['id']);});})[_0x9387('0x18')](function(){_0x73f1c9(_0x3376a0);});});}function parseContactItemType(_0x3d1dac){return new Promise(function(_0x3a466f){if(_0x3d1dac[_0x9387('0x35')](_0x9387('0x8c'))){_0x3a466f(_0x3d1dac);}else{return db['ContactItemType']['find']({'where':{'name':_0x3d1dac[_0x9387('0x69')]}})[_0x9387('0x18')](function(_0x34c37c){if(_[_0x9387('0x54')](_0x34c37c))_0x3d1dac['ItemTypeId']=null;else _0x3d1dac['ItemTypeId']=_0x34c37c['id'];_0x3a466f(_0x3d1dac);});}});}exports[_0x9387('0x95')]=function(_0x15d967,_0x38574b){return db[_0x9387('0x49')][_0x9387('0x2e')]({'raw':!![],'where':{'CmContactId':_0x15d967[_0x9387('0x25')]['id'],'ItemClass':_0x9387('0x8f')},'include':[{'model':db['ContactItemType'],'as':_0x9387('0x69')}],'order':[[_0x9387('0x89')],[db['sequelize'][_0x9387('0x6a')](_0x9387('0x92'))]]})[_0x9387('0x18')](function(_0x2c9ad2){return _0x2c9ad2;})[_0x9387('0x18')](respondWithResult(_0x38574b,null))[_0x9387('0x22')](handleError(_0x38574b,null));};exports[_0x9387('0x96')]=function(_0x6ff002,_0x39bb35){return db[_0x9387('0x49')][_0x9387('0x2e')]({'raw':!![],'where':{'CmContactId':_0x6ff002[_0x9387('0x37')][_0x9387('0x97')]}})[_0x9387('0x18')](function(_0x39228f){var _0x5642c6=_[_0x9387('0x6e')](_0x39228f,function(_0x4b1481){_0x4b1481['CmContactId']=_0x6ff002['body']['toContactId'];return _0x4b1481;});return db['CmContactHasItem'][_0x9387('0x59')](_0x5642c6,{});})['then'](function(){return addCmHopperPhones(_0x6ff002[_0x9387('0x37')][_0x9387('0x98')]);})[_0x9387('0x18')](function(){return['ok'];})['then'](respondWithResult(_0x39bb35,null))[_0x9387('0x22')](handleError(_0x39bb35,null));};exports[_0x9387('0x99')]=function(_0x2afc37,_0xc69c89){var _0xaefc6=[];_0xaefc6[_0x9387('0x5e')](createCmHopperPhone(_0x2afc37['body']['id'],_0x2afc37[_0x9387('0x37')][_0x9387('0x9a')]));Promise['all'](_0xaefc6)[_0x9387('0x18')](function(){return[0x1];})[_0x9387('0x18')](respondWithResult(_0xc69c89,null));};exports[_0x9387('0x9b')]=function(_0x3abe43,_0x1bd852){var _0x417c32={'raw':![],'where':{}};var _0xd3c449={};var _0x2d280b={'count':0x0,'rows':[]};return db[_0x9387('0x23')][_0x9387('0x9c')]({'where':{'id':_0x3abe43['params']['id']}})['then'](handleEntityNotFound(_0x1bd852,null))['then'](function(_0x436f70){if(_0x436f70){_0xd3c449['model']=_['keys'](db[_0x9387('0x3c')][_0x9387('0x9d')]);_0xd3c449['query']=_['keys'](_0x3abe43[_0x9387('0x2b')]);_0xd3c449['filters']=_['intersection'](_0xd3c449['model'],_0xd3c449[_0x9387('0x2b')]);_0x417c32[_0x9387('0x7e')]=_['intersection'](_0xd3c449[_0x9387('0x7d')],qs['fields'](_0x3abe43[_0x9387('0x2b')][_0x9387('0x7f')]));_0x417c32[_0x9387('0x7e')]=_0x417c32[_0x9387('0x7e')][_0x9387('0x28')]?_0x417c32['attributes']:_0xd3c449[_0x9387('0x7d')];if(!_0x3abe43['query'][_0x9387('0x35')](_0x9387('0x85'))){_0x417c32[_0x9387('0x86')]=qs['limit'](_0x3abe43[_0x9387('0x2b')][_0x9387('0x86')]);_0x417c32['offset']=qs[_0x9387('0x13')](_0x3abe43[_0x9387('0x2b')][_0x9387('0x13')]);}_0x417c32[_0x9387('0x80')]=qs[_0x9387('0x81')](_0x3abe43['query']['sort']);_0x417c32['where']=qs[_0x9387('0x7b')](_[_0x9387('0x82')](_0x3abe43[_0x9387('0x2b')],_0xd3c449['filters']));_0x417c32['where'][_0x9387('0x9e')]=_0x436f70['id'];if(_0x3abe43[_0x9387('0x2b')][_0x9387('0x83')]){_0x417c32[_0x9387('0x5c')]=_['merge'](_0x417c32[_0x9387('0x5c')],{'$or':_[_0x9387('0x6e')](_0x417c32['attributes'],function(_0x12dd07){var _0xa75e98={};_0xa75e98[_0x12dd07]={'$like':'%'+_0x3abe43[_0x9387('0x2b')]['filter']+'%'};return _0xa75e98;})});}_0x417c32=_[_0x9387('0x36')]({},_0x417c32,_0x3abe43[_0x9387('0x84')]);return db['CmHopper'][_0x9387('0x15')]({'where':_0x417c32[_0x9387('0x5c')]})[_0x9387('0x18')](function(_0x3c3311){_0x2d280b[_0x9387('0x15')]=_0x3c3311;if(_0x3abe43[_0x9387('0x2b')][_0x9387('0x9f')]){_0x417c32[_0x9387('0xa0')]=[{'all':!![]}];}return db[_0x9387('0x3c')][_0x9387('0x2e')](_0x417c32);})['then'](function(_0x550822){_0x2d280b[_0x9387('0xa1')]=_0x550822;return _0x2d280b;});}})[_0x9387('0x18')](respondWithFilteredResult(_0x1bd852,_0x417c32))[_0x9387('0x22')](handleError(_0x1bd852,null));};exports[_0x9387('0xa2')]=function(_0x393707,_0x44d82d){var _0x11fdb4={'raw':!![],'where':{}};var _0x90a843={};var _0x3ca6ac={'count':0x0,'rows':[]};return db[_0x9387('0x23')][_0x9387('0x9c')]({'where':{'id':_0x393707[_0x9387('0x25')]['id']}})[_0x9387('0x18')](handleEntityNotFound(_0x44d82d,null))[_0x9387('0x18')](function(_0x26a2fc){if(_0x26a2fc){_0x90a843[_0x9387('0x7d')]=_[_0x9387('0x27')](db[_0x9387('0x4a')][_0x9387('0x9d')]);_0x90a843[_0x9387('0x2b')]=_[_0x9387('0x27')](_0x393707[_0x9387('0x2b')]);_0x90a843[_0x9387('0x7b')]=_[_0x9387('0x7c')](_0x90a843[_0x9387('0x7d')],_0x90a843[_0x9387('0x2b')]);_0x11fdb4[_0x9387('0x7e')]=_[_0x9387('0x7c')](_0x90a843[_0x9387('0x7d')],qs[_0x9387('0x7f')](_0x393707[_0x9387('0x2b')][_0x9387('0x7f')]));_0x11fdb4[_0x9387('0x7e')]=_0x11fdb4['attributes'][_0x9387('0x28')]?_0x11fdb4[_0x9387('0x7e')]:_0x90a843[_0x9387('0x7d')];if(!_0x393707[_0x9387('0x2b')][_0x9387('0x35')](_0x9387('0x85'))){_0x11fdb4[_0x9387('0x86')]=qs['limit'](_0x393707[_0x9387('0x2b')]['limit']);_0x11fdb4[_0x9387('0x13')]=qs['offset'](_0x393707[_0x9387('0x2b')]['offset']);}_0x11fdb4[_0x9387('0x80')]=qs[_0x9387('0x81')](_0x393707[_0x9387('0x2b')][_0x9387('0x81')]);_0x11fdb4[_0x9387('0x5c')]=qs[_0x9387('0x7b')](_['pick'](_0x393707[_0x9387('0x2b')],_0x90a843[_0x9387('0x7b')]));_0x11fdb4['where'][_0x9387('0x9e')]=_0x26a2fc['id'];if(_0x393707['query'][_0x9387('0x83')]){_0x11fdb4[_0x9387('0x5c')]=_[_0x9387('0x36')](_0x11fdb4[_0x9387('0x5c')],{'$or':_[_0x9387('0x6e')](_0x11fdb4[_0x9387('0x7e')],function(_0xb9cd72){var _0x4e435a={};_0x4e435a[_0xb9cd72]={'$like':'%'+_0x393707[_0x9387('0x2b')][_0x9387('0x83')]+'%'};return _0x4e435a;})});}_0x11fdb4=_[_0x9387('0x36')]({},_0x11fdb4,_0x393707[_0x9387('0x84')]);return db[_0x9387('0x4a')]['count']({'where':_0x11fdb4['where']})[_0x9387('0x18')](function(_0x28fa06){_0x3ca6ac[_0x9387('0x15')]=_0x28fa06;if(_0x393707[_0x9387('0x2b')][_0x9387('0x9f')]){_0x11fdb4[_0x9387('0xa0')]=[{'all':!![]}];}return db[_0x9387('0x4a')][_0x9387('0x2e')](_0x11fdb4);})[_0x9387('0x18')](function(_0x4b3014){_0x3ca6ac[_0x9387('0xa1')]=_0x4b3014;return _0x3ca6ac;});}})[_0x9387('0x18')](respondWithFilteredResult(_0x44d82d,_0x11fdb4))[_0x9387('0x22')](handleError(_0x44d82d,null));};exports[_0x9387('0xa3')]=function(_0x38caa7,_0x31ba68){var _0x4087f7={'raw':!![],'where':{}};var _0x32006e={};var _0x3ab46c={'count':0x0,'rows':[]};return db['CmContact'][_0x9387('0x9c')]({'where':{'id':_0x38caa7[_0x9387('0x25')]['id']}})['then'](handleEntityNotFound(_0x31ba68,null))['then'](function(_0x27d59b){if(_0x27d59b){_0x32006e['model']=_[_0x9387('0x27')](db[_0x9387('0xa4')][_0x9387('0x9d')]);_0x32006e['query']=_[_0x9387('0x27')](_0x38caa7[_0x9387('0x2b')]);_0x32006e['filters']=_['intersection'](_0x32006e['model'],_0x32006e[_0x9387('0x2b')]);_0x4087f7[_0x9387('0x7e')]=_[_0x9387('0x7c')](_0x32006e[_0x9387('0x7d')],qs['fields'](_0x38caa7[_0x9387('0x2b')]['fields']));_0x4087f7[_0x9387('0x7e')]=_0x4087f7['attributes'][_0x9387('0x28')]?_0x4087f7[_0x9387('0x7e')]:_0x32006e[_0x9387('0x7d')];if(!_0x38caa7[_0x9387('0x2b')]['hasOwnProperty'](_0x9387('0x85'))){_0x4087f7[_0x9387('0x86')]=qs['limit'](_0x38caa7[_0x9387('0x2b')]['limit']);_0x4087f7['offset']=qs[_0x9387('0x13')](_0x38caa7['query'][_0x9387('0x13')]);}_0x4087f7['order']=qs[_0x9387('0x81')](_0x38caa7['query']['sort']);_0x4087f7['where']=qs[_0x9387('0x7b')](_[_0x9387('0x82')](_0x38caa7[_0x9387('0x2b')],_0x32006e['filters']));_0x4087f7[_0x9387('0x5c')][_0x9387('0x9e')]=_0x27d59b['id'];if(_0x38caa7['query']['filter']){_0x4087f7['where']=_[_0x9387('0x36')](_0x4087f7['where'],{'$or':_[_0x9387('0x6e')](_0x4087f7['attributes'],function(_0x51e040){var _0x488e8f={};_0x488e8f[_0x51e040]={'$like':'%'+_0x38caa7[_0x9387('0x2b')][_0x9387('0x83')]+'%'};return _0x488e8f;})});}_0x4087f7=_[_0x9387('0x36')]({},_0x4087f7,_0x38caa7['options']);return db[_0x9387('0xa4')][_0x9387('0x15')]({'where':_0x4087f7[_0x9387('0x5c')]})[_0x9387('0x18')](function(_0x2d4a3b){_0x3ab46c[_0x9387('0x15')]=_0x2d4a3b;if(_0x38caa7[_0x9387('0x2b')][_0x9387('0x9f')]){_0x4087f7[_0x9387('0xa0')]=[{'all':!![]}];}return db[_0x9387('0xa4')][_0x9387('0x2e')](_0x4087f7);})[_0x9387('0x18')](function(_0x4654d9){_0x3ab46c['rows']=_0x4654d9;return _0x3ab46c;});}})[_0x9387('0x18')](respondWithFilteredResult(_0x31ba68,_0x4087f7))[_0x9387('0x22')](handleError(_0x31ba68,null));};exports[_0x9387('0xa5')]=function(_0x2fc219,_0x5ed3af){var _0x38dadc={'raw':!![],'where':{}};var _0xdc3d4b={};var _0x4455f6={'count':0x0,'rows':[]};return db[_0x9387('0x23')][_0x9387('0x9c')]({'where':{'id':_0x2fc219['params']['id']}})[_0x9387('0x18')](handleEntityNotFound(_0x5ed3af,null))[_0x9387('0x18')](function(_0x3d4c7b){if(_0x3d4c7b){_0xdc3d4b[_0x9387('0x7d')]=_['keys'](db['JscriptySessionReport'][_0x9387('0x9d')]);_0xdc3d4b[_0x9387('0x2b')]=_['keys'](_0x2fc219[_0x9387('0x2b')]);_0xdc3d4b['filters']=_[_0x9387('0x7c')](_0xdc3d4b[_0x9387('0x7d')],_0xdc3d4b[_0x9387('0x2b')]);_0x38dadc[_0x9387('0x7e')]=_[_0x9387('0x7c')](_0xdc3d4b['model'],qs[_0x9387('0x7f')](_0x2fc219['query'][_0x9387('0x7f')]));_0x38dadc['attributes']=_0x38dadc[_0x9387('0x7e')][_0x9387('0x28')]?_0x38dadc[_0x9387('0x7e')]:_0xdc3d4b['model'];if(!_0x2fc219['query'][_0x9387('0x35')](_0x9387('0x85'))){_0x38dadc[_0x9387('0x86')]=qs[_0x9387('0x86')](_0x2fc219[_0x9387('0x2b')][_0x9387('0x86')]);_0x38dadc[_0x9387('0x13')]=qs[_0x9387('0x13')](_0x2fc219[_0x9387('0x2b')][_0x9387('0x13')]);}_0x38dadc[_0x9387('0x80')]=qs[_0x9387('0x81')](_0x2fc219[_0x9387('0x2b')]['sort']);_0x38dadc['where']=qs[_0x9387('0x7b')](_[_0x9387('0x82')](_0x2fc219['query'],_0xdc3d4b['filters']));_0x38dadc['where'][_0x9387('0x9e')]=_0x3d4c7b['id'];if(_0x2fc219[_0x9387('0x2b')]['filter']){_0x38dadc[_0x9387('0x5c')]=_['merge'](_0x38dadc[_0x9387('0x5c')],{'$or':_['map'](_0x38dadc[_0x9387('0x7e')],function(_0x499d98){var _0x252f75={};_0x252f75[_0x499d98]={'$like':'%'+_0x2fc219[_0x9387('0x2b')][_0x9387('0x83')]+'%'};return _0x252f75;})});}_0x38dadc=_[_0x9387('0x36')]({},_0x38dadc,_0x2fc219[_0x9387('0x84')]);return db[_0x9387('0x51')][_0x9387('0x15')]({'where':_0x38dadc['where']})[_0x9387('0x18')](function(_0xbd9a8c){_0x4455f6[_0x9387('0x15')]=_0xbd9a8c;if(_0x2fc219['query'][_0x9387('0x9f')]){_0x38dadc[_0x9387('0xa0')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x9387('0x2e')](_0x38dadc);})[_0x9387('0x18')](function(_0x5bd506){_0x4455f6[_0x9387('0xa1')]=_0x5bd506;return _0x4455f6;});}})[_0x9387('0x18')](respondWithFilteredResult(_0x5ed3af,_0x38dadc))[_0x9387('0x22')](handleError(_0x5ed3af,null));};exports[_0x9387('0xa6')]=function(_0x49e413,_0x5c9fa1){try{if(!_0x49e413[_0x9387('0x37')]['ListId']){throw new Error(_0x9387('0xa7'));}if(!_0x49e413[_0x9387('0x37')]['binding_keys']){throw new Error(_0x9387('0xa8'));}if(!_0x49e413[_0x9387('0x37')][_0x9387('0xa9')]){throw new Error(_0x9387('0xaa'));}if(!_0x49e413[_0x9387('0x37')][_0x9387('0xab')]){throw new Error(_0x9387('0xac'));}var _0x20f409=_0x49e413[_0x9387('0x37')][_0x9387('0xad')][_0x9387('0xae')](',');var _0x346850=_0x49e413[_0x9387('0x37')]['binding_values']['split'](',');if(!_0x20f409[_0x9387('0x28')]||!_0x346850['length']||_0x20f409['length']!==_0x346850[_0x9387('0x28')]){throw new Error(_0x9387('0xaf'));}_0x49e413[_0x9387('0x37')][_0x9387('0x7f')]=_['zipObject'](_0x20f409,_0x346850);if(!_0x49e413['body'][_0x9387('0x7f')][_0x9387('0x79')]){throw new Error(_0x9387('0xb0'));}if(!_0x49e413[_0x9387('0x37')][_0x9387('0x7f')]['firstName']){throw new Error(_0x9387('0xb1'));}var _0x37a7e1=path[_0x9387('0x3b')](config[_0x9387('0xb2')],'server/files/tmp',_0x49e413[_0x9387('0xb3')][_0x9387('0xb4')]);fs['chmodSync'](_0x37a7e1,parseInt(_0x9387('0xb5'),0x8));var _0x13be65=require('child_process')[_0x9387('0xb6')](path['join'](__dirname,_0x9387('0xb7')),[_0x37a7e1,_0x49e413[_0x9387('0x37')][_0x9387('0xad')],_0x49e413[_0x9387('0x37')][_0x9387('0xa9')],_0x49e413['body']['ListId'],_0x49e413[_0x9387('0x37')][_0x9387('0xb8')],_0x49e413['body'][_0x9387('0x5b')],_0x49e413['body'][_0x9387('0xab')]]);return _0x5c9fa1['status'](0xc8)[_0x9387('0x12')]({'message':_0x9387('0xb9'),'pid':_0x13be65[_0x9387('0xba')]});}catch(_0x4b934a){return _0x5c9fa1[_0x9387('0x11')](0x1f4)['send'](_0x4b934a);}};exports['upload']=function(_0x51eeaf,_0x568eed){var _0x3c65ba=fs['createReadStream'](_0x51eeaf[_0x9387('0xb3')]['path']);Papa[_0x9387('0xbb')](_0x3c65ba,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x513aa1){return _0x568eed[_0x9387('0x11')](0xc8)['json']({'file':_0x51eeaf['file'],'fields':_0x513aa1[_0x9387('0xbc')][_0x9387('0x7f')]});}});};exports[_0x9387('0xbd')]=function(_0x6e4b3d,_0x279566){return db[_0x9387('0xbe')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x9387('0xbf')}})[_0x9387('0x18')](function(_0x560970){var _0x4e5cc0=![];if(!_0x6e4b3d[_0x9387('0x37')]['ListId']){throw new Error(_0x9387('0xa7'));}if(!_0x6e4b3d[_0x9387('0x37')]['binding'][_0x9387('0x79')]){throw new Error(_0x9387('0xb0'));}if(!_0x6e4b3d[_0x9387('0x37')][_0x9387('0xc0')][_0x9387('0xc1')]){throw new Error(_0x9387('0xb1'));}if(!_0x6e4b3d[_0x9387('0x37')]['socket_timestamp']){throw new Error(_0x9387('0xac'));}var _0x562724=require('child_process')['fork'](path[_0x9387('0x3b')](__dirname,_0x9387('0xc2')),[_0x6e4b3d[_0x9387('0x25')]['id'],JSON[_0x9387('0xc3')](_0x6e4b3d[_0x9387('0x37')]),JSON['stringify'](_0x560970)]);_0x562724['on'](_0x9387('0xc4'),function(){_0x4e5cc0=!![];return _0x279566['status'](0xc8)[_0x9387('0x12')]({'message':_0x9387('0xc5'),'pid':_0x562724[_0x9387('0xba')]});});_0x562724['on']('exit',function(_0x5b4938){if(_0x5b4938&&!_0x4e5cc0){return _0x279566[_0x9387('0x11')](0x1f4)['json']({'message':_0x9387('0xc6'),'pid':_0x562724[_0x9387('0xba')]});}});})['catch'](handleError(_0x279566,null));};exports[_0x9387('0xc7')]=function(_0x10ed72,_0x195ab1){return db[_0x9387('0xbe')][_0x9387('0x2e')]({'raw':!![],'attributes':['id'],'where':{'role':_0x9387('0xbf')}})[_0x9387('0x18')](function(_0x34a206){var _0x4343ed=![];if(!_0x10ed72['body'][_0x9387('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x10ed72['body'][_0x9387('0xc0')][_0x9387('0x79')]){throw new Error(_0x9387('0xb0'));}if(!_0x10ed72[_0x9387('0x37')][_0x9387('0xc0')][_0x9387('0xc1')]){throw new Error(_0x9387('0xb1'));}if(!_0x10ed72[_0x9387('0x37')][_0x9387('0xab')]){throw new Error(_0x9387('0xac'));}var _0x86db2d=require(_0x9387('0xc8'))[_0x9387('0xb6')](path[_0x9387('0x3b')](__dirname,'../../components/import/cm/csvUpdates'),[_0x10ed72[_0x9387('0x25')]['id'],JSON[_0x9387('0xc3')](_0x10ed72[_0x9387('0x37')]),JSON[_0x9387('0xc3')](_0x34a206)]);_0x86db2d['on'](_0x9387('0xc4'),function(){_0x4343ed=!![];return _0x195ab1[_0x9387('0x11')](0xc8)['json']({'message':_0x9387('0xc5'),'pid':_0x86db2d[_0x9387('0xba')]});});_0x86db2d['on'](_0x9387('0xc9'),function(_0x474084){if(_0x474084&&!_0x4343ed){return _0x195ab1[_0x9387('0x11')](0x1f4)[_0x9387('0x12')]({'message':_0x9387('0xc6'),'pid':_0x86db2d[_0x9387('0xba')]});}});})[_0x9387('0x22')](handleError(_0x195ab1,null));};exports['getJourney']=function(_0xec306b,_0x1c4b1c){var _0x5d77d2=[_0x9387('0xca'),'chat','sms',_0x9387('0xcb'),_0x9387('0xcc'),'whatsapp','voice'];var _0x130fb7={'offset':0x0,'order':qs[_0x9387('0x81')](_0x9387('0xcd'))},_0x22851e={'count':0x0,'rows':[]};Promise[_0x9387('0xce')]()['then'](function(){if(_0xec306b['query'][_0x9387('0xcf')]){if(!_[_0x9387('0xd0')](_0x5d77d2,_0xec306b[_0x9387('0x2b')][_0x9387('0xcf')][_0x9387('0xd1')]())){throw new Error(_0x9387('0xd2'));}_0x5d77d2=[_0xec306b['query']['channel'][_0x9387('0xd1')]()];}if(_0xec306b[_0x9387('0x2b')][_0x9387('0xd3')]){try{var _0x8661f6=JSON[_0x9387('0xbb')](_0xec306b[_0x9387('0x2b')][_0x9387('0xd3')]);if(!moment(_0x8661f6[_0x9387('0x38')])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x8661f6['to'])['isValid']()){throw new Error(_0x9387('0xd4'));}}catch(_0x9434bc){throw new Error(_0x9387('0xd5'));}}if(!_0xec306b['query'][_0x9387('0x35')](_0x9387('0x85'))){_0x130fb7[_0x9387('0x86')]=qs[_0x9387('0x86')](_0xec306b[_0x9387('0x2b')]['limit']||0xa);_0x130fb7[_0x9387('0x13')]=qs[_0x9387('0x13')](_0xec306b[_0x9387('0x2b')][_0x9387('0x13')]);}var _0x138fc=_0x5d77d2[_0x9387('0x6e')](function(_0x64891d){if(_0x64891d===_0x9387('0xd6')){var _0x1371f5={'attributes':['id',_0x9387('0xd7'),'type',_0x9387('0xd8'),_0x9387('0xd9'),_0x9387('0xda'),'starttime',_0x9387('0xdb'),_0x9387('0xdc'),_0x9387('0xdd'),_0x9387('0xde'),_0x9387('0xdf'),_0x9387('0xe0'),_0x9387('0xe1'),'UserId'],'where':{'ContactId':_0xec306b[_0x9387('0x25')]['id']},'include':[{'model':db[_0x9387('0xbe')],'as':_0x9387('0xbe'),'attributes':['id',_0x9387('0x1d'),_0x9387('0xe2'),_0x9387('0x30')]}],'order':[[_0x9387('0xde'),'DESC']]};if(_0xec306b[_0x9387('0x2b')][_0x9387('0xd3')]){_0x1371f5[_0x9387('0x5c')][_0x9387('0xde')]={'$gte':_0x8661f6[_0x9387('0x38')],'$lte':_0x8661f6['to']};}return db[_0x9387('0x4c')]['findAndCountAll'](_0x1371f5)[_0x9387('0x18')](function(_0x115c5a){_0x22851e['count']+=_0x115c5a[_0x9387('0x15')];return _[_0x9387('0x6e')](_0x115c5a['rows'],function(_0x40f4d4){var _0x581c99=_0x40f4d4['get']({'plain':!![]});_0x581c99['channel']=_0x64891d;if(_0x581c99[_0x9387('0xbe')]){_0x581c99[_0x9387('0xbe')]={'id':_0x581c99[_0x9387('0xbe')]['id'],'name':_0x581c99[_0x9387('0xbe')][_0x9387('0x1d')],'fullname':_0x581c99[_0x9387('0xbe')][_0x9387('0xe2')],'alias':_0x581c99[_0x9387('0xbe')]['alias']};}return _0x581c99;});});}else{var _0x3b486e=_[_0x9387('0xe3')](_0x64891d)+(_0x64891d==='chat'?_0x9387('0xe4'):_0x9387('0xe5'));var _0x101c0a={'attributes':['id',_0x9387('0xe6'),_0x9387('0xe7'),_0x9387('0xde'),_0x9387('0xdd'),_0x9387('0xe8'),_0x9387('0xe9'),_0x9387('0xea'),'UserId',_0x3b486e+'Id'],'where':{'ContactId':_0xec306b[_0x9387('0x25')]['id']},'include':[{'model':db[_0x3b486e],'as':_0x9387('0xe5'),'attributes':['id',_0x9387('0x1d'),_0x9387('0xeb')]},{'model':db['User'],'as':_0x9387('0xec'),'attributes':['id',_0x9387('0x1d'),_0x9387('0xe2')]},{'model':db['Tag'],'as':_0x9387('0x66'),'attributes':['id','name',_0x9387('0xed')],'through':{'attributes':[]}}],'order':[[_0x9387('0xde'),'DESC']]};if(_0xec306b[_0x9387('0x2b')][_0x9387('0xd3')]){_0x101c0a[_0x9387('0x5c')]['createdAt']={'$gte':_0x8661f6[_0x9387('0x38')],'$lte':_0x8661f6['to']};}switch(_0x64891d){case _0x9387('0xee'):_0x101c0a[_0x9387('0x7e')][_0x9387('0x5e')](_0x9387('0xef'),_0x9387('0xf0'),_0x9387('0xf1'),_0x9387('0xf2'),_0x9387('0xf3'),_0x9387('0xf4'),_0x9387('0xf5'),_0x9387('0xf6'),_0x9387('0xf7'));break;case _0x9387('0xca'):_0x101c0a['attributes']['push']('subject',_0x9387('0xf8'));break;case _0x9387('0xcb'):_0x101c0a['attributes'][_0x9387('0x5e')]('externalUrl',_0x9387('0xf9'));break;}return db[_['startCase'](_0x64891d)+_0x9387('0xfa')]['findAndCountAll'](_0x101c0a)[_0x9387('0x18')](function(_0x166b10){_0x22851e[_0x9387('0x15')]+=_0x166b10[_0x9387('0x15')];return _[_0x9387('0x6e')](_0x166b10[_0x9387('0xa1')],function(_0x33f852){var _0x2d9303=_0x33f852[_0x9387('0x6c')]({'plain':!![]});_0x2d9303[_0x9387('0xcf')]=_0x64891d;if(_0x2d9303['Owner']){_0x2d9303[_0x9387('0xec')]={'id':_0x2d9303[_0x9387('0xec')]['id'],'name':_0x2d9303[_0x9387('0xec')][_0x9387('0x1d')],'fullname':_0x2d9303['Owner'][_0x9387('0xe2')]};}return _0x2d9303;});});}});return Promise[_0x9387('0x63')](_0x138fc);})[_0x9387('0x18')](function(_0x2fb874){return _(_0x2fb874)[_0x9387('0xfb')]()['sortBy'](_0x9387('0xde'))[_0x9387('0xfc')]()[_0x9387('0xfd')]();})[_0x9387('0x18')](function(_0x5f3e22){_0x22851e['rows']=_0x130fb7[_0x9387('0x86')]?_0x5f3e22[_0x9387('0xfe')](_0x130fb7[_0x9387('0x13')],_0x130fb7[_0x9387('0x13')]+_0x130fb7[_0x9387('0x86')]):_0x5f3e22;return _0x22851e;})[_0x9387('0x18')](respondWithFilteredResult(_0x1c4b1c,_0x130fb7))[_0x9387('0x22')](handleError(_0x1c4b1c,null));}; \ No newline at end of file +var _0x150e=['subject','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','path','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','socket.io-emitter','register','status','offset','undefined','count','limit','set','Content-Range','json','then','destroy','end','sendStatus','name','send','index','describe','getOptions','query','catch','CmContact','find','params','tags','keys','length','startsWith','columnName','displayName','findAll','cf_','alias','custom','type','info','hasOwnProperty','merge','body','from','get','mergeWith','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','join','dialTimezone','isNil','timezones','additionalPhones','each','duplicates','$or','push','where','ListId','findOrCreate','spread','all','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','CmCustomField','omit','cf_%d','utcOffset','pickBy','map','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','phone','CmHopper','getTags','findOne','rawAttributes','intersection','model','attributes','fields','sort','filters','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','ContactId','filter','includeAll','include','rows','getHopperHistories','CmHopperHistory','pick','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','server/files/tmp','file','chmodSync','0777','fork','../../components/import/cm/csv','binding_values','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','agent','binding','firstName','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','Owner','DESC','customerIp','customerPort','osName','ratingMessage','ratingValue','referer','mail'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x150e,0x10b));var _0xe150=function(_0x5853a4,_0x28cd2f){_0x5853a4=_0x5853a4-0x0;var _0x43c5d5=_0x150e[_0x5853a4];return _0x43c5d5;};'use strict';var moment=require(_0xe150('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xe150('0x1'));var fs=require('fs');var _=require(_0xe150('0x2'));var squel=require(_0xe150('0x3'));var Papa=require('papaparse');var Redis=require(_0xe150('0x4'));var contacts=require(_0xe150('0x5'));var qs=require(_0xe150('0x6'));var logger=require(_0xe150('0x7'))(_0xe150('0x8'));var config=require(_0xe150('0x9'));var shared=require(_0xe150('0xa'));var db=require('../../mysqldb')['db'];config[_0xe150('0xb')]=_[_0xe150('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe150('0xd'))(new Redis(config[_0xe150('0xb')]));require('./cmContact.socket')[_0xe150('0xe')](socket);function respondWithResult(_0x2f89b8,_0x52fa72){_0x52fa72=_0x52fa72||0xc8;return function(_0x10e345){if(_0x10e345){return _0x2f89b8[_0xe150('0xf')](_0x52fa72)['json'](_0x10e345);}};}function respondWithFilteredResult(_0x245229,_0x4ece4d){return function(_0x39453b){if(_0x39453b){var _0x149b46=typeof _0x4ece4d[_0xe150('0x10')]===_0xe150('0x11')&&typeof _0x4ece4d['limit']==='undefined';var _0x2208c4=_0x39453b[_0xe150('0x12')];var _0x2b9868=_0x149b46?0x0:_0x4ece4d[_0xe150('0x10')];var _0x3f719d=_0x149b46?_0x39453b[_0xe150('0x12')]:_0x4ece4d[_0xe150('0x10')]+_0x4ece4d[_0xe150('0x13')];var _0x3dbb9b;if(_0x3f719d>=_0x2208c4){_0x3f719d=_0x2208c4;_0x3dbb9b=0xc8;}else{_0x3dbb9b=0xce;}_0x245229[_0xe150('0xf')](_0x3dbb9b);return _0x245229[_0xe150('0x14')](_0xe150('0x15'),_0x2b9868+'-'+_0x3f719d+'/'+_0x2208c4)[_0xe150('0x16')](_0x39453b);}return null;};}function saveUpdates(_0x4cf09b){return function(_0x1d5b61){if(_0x1d5b61){return _0x1d5b61['update'](_0x4cf09b)[_0xe150('0x17')](function(_0x495c1f){return _0x495c1f;});}return null;};}function removeEntity(_0x386e1d){return function(_0x47728a){if(_0x47728a){return _0x47728a[_0xe150('0x18')]()[_0xe150('0x17')](function(){_0x386e1d[_0xe150('0xf')](0xcc)[_0xe150('0x19')]();});}};}function handleEntityNotFound(_0x4e8987){return function(_0x5bbd49){if(!_0x5bbd49){_0x4e8987[_0xe150('0x1a')](0x194);}return _0x5bbd49;};}function handleError(_0x204b08,_0xf28476){_0xf28476=_0xf28476||0x1f4;return function(_0x50a327){logger['error'](_0x50a327['stack']);if(_0x50a327[_0xe150('0x1b')]){delete _0x50a327[_0xe150('0x1b')];}_0x204b08[_0xe150('0xf')](_0xf28476)[_0xe150('0x1c')](_0x50a327);};}exports[_0xe150('0x1d')]=function(_0x1523a8,_0x1ca107){var _0x594533={};return contacts[_0xe150('0x1e')]()[_0xe150('0x17')](function(_0x2c0a5f){_0x594533=qs[_0xe150('0x1f')](_0x2c0a5f,_0x1523a8);return contacts['findAll'](_0x1523a8[_0xe150('0x20')],_0x1523a8['user'],_0x594533,_0x2c0a5f);})[_0xe150('0x17')](respondWithFilteredResult(_0x1ca107,_0x594533))[_0xe150('0x21')](handleError(_0x1ca107,null));};exports[_0xe150('0x18')]=function(_0x437769,_0xab7d29){return db[_0xe150('0x22')][_0xe150('0x23')]({'where':{'id':_0x437769[_0xe150('0x24')]['id']}})[_0xe150('0x17')](handleEntityNotFound(_0xab7d29,null))[_0xe150('0x17')](removeEntity(_0xab7d29,null))['catch'](handleError(_0xab7d29,null));};exports[_0xe150('0x1e')]=function(_0x165015,_0x52c443){return db[_0xe150('0x22')]['describe']()['then'](function(_0xcffe28){delete _0xcffe28[_0xe150('0x25')];for(var _0x11a299=0x0;_0x11a2990x0){return new Promise(function(_0xf5bca3){var _0x21b654=[];for(var _0x25cb6c=0x0;_0x25cb6c<_0x4b0292[_0xe150('0x27')];_0x25cb6c++){_0x21b654[_0xe150('0x58')](insertAdditionalPhones(_0x4b0292[_0x25cb6c]['contact'],_0x4b0292[_0x25cb6c]['additionalPhones']));}Promise[_0xe150('0x5d')](_0x21b654)[_0xe150('0x17')](function(){_0xf5bca3(0x1);});})['then'](function(){return{'success':_0x3d115f,'failure':_0x17371d,'duplicates':_0x312a1d};});}else{return{'success':_0x3d115f,'failure':_0x17371d,'duplicates':_0x312a1d};}}})['then'](respondWithResult(_0x2fcdfe,0xc9))[_0xe150('0x21')](handleError(_0x2fcdfe,null));};exports['show']=function(_0x21f4b6,_0x2213c0){var _0x1558f6;return db['CmContact'][_0xe150('0x1e')]()['then'](function(_0x375f38){return db['CmContact'][_0xe150('0x23')]({'where':{'id':_0x21f4b6[_0xe150('0x24')]['id']},'include':[{'model':db[_0xe150('0x5e')],'as':_0xe150('0x5f'),'attributes':['id','name',_0xe150('0x60')],'required':_0x21f4b6[_0xe150('0x20')][_0xe150('0x61')]?!![]:![]},{'model':db[_0xe150('0x46')],'as':_0xe150('0x62'),'where':{'CmContactId':_0x21f4b6['params']['id']},'required':![],'include':[{'model':db[_0xe150('0x63')],'as':_0xe150('0x64')}]}],'order':[db[_0xe150('0x65')][_0xe150('0x66')](_0xe150('0x67'))],'attributes':_[_0xe150('0x26')](_0x375f38)});})[_0xe150('0x17')](function(_0x41c5c2){if(!_['isNil'](_0x41c5c2)){_0x1558f6=_0x41c5c2[_0xe150('0x35')]({'plain':!![]});var _0x53c85d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x41c5c2&&_0x41c5c2[_0xe150('0x5a')]){if(_0x41c5c2[_0xe150('0x5a')]){_0x53c85d[_0xe150('0x59')][_0xe150('0x68')][_0xe150('0x58')]({'ListId':{'$ne':_0x41c5c2[_0xe150('0x5a')]}});}}return db[_0xe150('0x69')][_0xe150('0x2b')](_0x53c85d);}})[_0xe150('0x17')](function(_0x56dcc7){if(!_[_0xe150('0x52')](_0x56dcc7)){return _[_0xe150('0x6a')](_0x1558f6,_['map'](_0x56dcc7,function(_0x9f9662){return util['format'](_0xe150('0x6b'),_0x9f9662['id']);}));}})[_0xe150('0x17')](handleEntityNotFound(_0x2213c0,null))['then'](respondWithResult(_0x2213c0,null))['catch'](handleError(_0x2213c0,null));};exports[_0xe150('0x3d')]=function(_0xd18670,_0x576711){var _0x14907a;if(_0xd18670[_0xe150('0x33')]['id']){delete _0xd18670[_0xe150('0x33')]['id'];}if(!_[_0xe150('0x52')](_0xd18670[_0xe150('0x33')][_0xe150('0x51')])){var _0x4003e3=_0xd18670[_0xe150('0x33')][_0xe150('0x51')];if(!_[_0xe150('0x52')](shared[_0xe150('0x53')][_0x4003e3]))_0xd18670[_0xe150('0x33')]['utcOffset']=shared[_0xe150('0x53')][_0x4003e3][_0xe150('0x6c')];}return db[_0xe150('0x22')][_0xe150('0x23')]({'where':{'id':_0xd18670['params']['id']}})[_0xe150('0x17')](handleEntityNotFound(_0x576711,null))[_0xe150('0x17')](saveUpdates(_0xd18670[_0xe150('0x33')],null))[_0xe150('0x17')](function(_0x433107){_0x14907a=_0x433107;var _0x410070={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x433107&&_0x433107[_0xe150('0x5a')]){if(_0x433107[_0xe150('0x5a')]){_0x410070[_0xe150('0x59')]['$and'][_0xe150('0x58')]({'ListId':{'$ne':_0x433107['ListId']}});}}return db[_0xe150('0x69')][_0xe150('0x2b')](_0x410070);})['then'](function(_0x5b82ad){if(_0x5b82ad){return _['omit'](_[_0xe150('0x6d')](_0xd18670[_0xe150('0x33')],function(_0x2a144b,_0x24391b){return _[_0xe150('0x28')](_0x24391b,_0xe150('0x2c'));}),_[_0xe150('0x6e')](_0x5b82ad,function(_0x4df459){return util[_0xe150('0x6f')](_0xe150('0x6b'),_0x4df459['id']);}));}})[_0xe150('0x17')](function(_0x409c64){if(_0x409c64&&!_[_0xe150('0x70')](_0x409c64)){var _0x331c8d=squel[_0xe150('0x3d')]()[_0xe150('0x71')](_0xe150('0x72'))[_0xe150('0x73')](_0x409c64)['where'](_0xe150('0x74'),_0xd18670[_0xe150('0x24')]['id'])[_0xe150('0x75')]();return db['sequelize']['query'](_0x331c8d[_0xe150('0x76')],{'replacements':_0x331c8d[_0xe150('0x77')]});}})['then'](function(){if(_0xd18670[_0xe150('0x33')][_0xe150('0x78')]&&_0x14907a){return db[_0xe150('0x79')][_0xe150('0x3d')]({'phone':_0xd18670['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x14907a['id']}});}})['then'](function(){return _0x14907a;})['then'](respondWithResult(_0x576711,null))['catch'](handleError(_0x576711,null));};exports[_0xe150('0x7a')]=function(_0x2bf280,_0x4274cf){var _0x58d12e={};var _0x5f3e6b={};var _0x38e99f;var _0x17a56a;return db[_0xe150('0x22')][_0xe150('0x7b')]({'where':{'id':_0x2bf280[_0xe150('0x24')]['id']}})[_0xe150('0x17')](handleEntityNotFound(_0x4274cf,null))[_0xe150('0x17')](function(_0x509f6f){if(_0x509f6f){_0x38e99f=_0x509f6f;_0x5f3e6b['model']=_[_0xe150('0x26')](db[_0xe150('0x5e')][_0xe150('0x7c')]);_0x5f3e6b[_0xe150('0x20')]=_[_0xe150('0x26')](_0x2bf280['query']);_0x5f3e6b['filters']=_[_0xe150('0x7d')](_0x5f3e6b[_0xe150('0x7e')],_0x5f3e6b[_0xe150('0x20')]);_0x58d12e[_0xe150('0x7f')]=_[_0xe150('0x7d')](_0x5f3e6b['model'],qs['fields'](_0x2bf280[_0xe150('0x20')][_0xe150('0x80')]));_0x58d12e[_0xe150('0x7f')]=_0x58d12e[_0xe150('0x7f')][_0xe150('0x27')]?_0x58d12e[_0xe150('0x7f')]:_0x5f3e6b[_0xe150('0x7e')];_0x58d12e['order']=qs[_0xe150('0x81')](_0x2bf280[_0xe150('0x20')][_0xe150('0x81')]);_0x58d12e[_0xe150('0x59')]=qs[_0xe150('0x82')](_['pick'](_0x2bf280[_0xe150('0x20')],_0x5f3e6b[_0xe150('0x82')]));if(_0x2bf280[_0xe150('0x20')]['filter']){_0x58d12e['where']=_[_0xe150('0x32')](_0x58d12e['where'],{'$or':_['map'](_0x58d12e['attributes'],function(_0x27b25f){var _0x1fb4ce={};_0x1fb4ce[_0x27b25f]={'$like':'%'+_0x2bf280[_0xe150('0x20')]['filter']+'%'};return _0x1fb4ce;})});}_0x58d12e=_['merge']({},_0x58d12e,_0x2bf280[_0xe150('0x83')]);return _0x38e99f[_0xe150('0x7a')](_0x58d12e);}})[_0xe150('0x17')](function(_0x199a6e){if(_0x199a6e){_0x17a56a=_0x199a6e['length'];if(!_0x2bf280['query'][_0xe150('0x31')](_0xe150('0x84'))){_0x58d12e['limit']=qs[_0xe150('0x13')](_0x2bf280[_0xe150('0x20')][_0xe150('0x13')]);_0x58d12e[_0xe150('0x10')]=qs['offset'](_0x2bf280[_0xe150('0x20')][_0xe150('0x10')]);}return _0x38e99f[_0xe150('0x7a')](_0x58d12e);}})[_0xe150('0x17')](function(_0x278f4a){if(_0x278f4a){return _0x278f4a?{'count':_0x17a56a,'rows':_0x278f4a}:null;}})[_0xe150('0x17')](respondWithResult(_0x4274cf,null))['catch'](handleError(_0x4274cf,null));};exports['setTags']=function(_0xb7dbfd,_0x1d3eed){if(_0xb7dbfd[_0xe150('0x33')]['id']){delete _0xb7dbfd['body']['id'];}return db[_0xe150('0x22')][_0xe150('0x7b')]({'where':{'id':_0xb7dbfd['params']['id']}})[_0xe150('0x17')](handleEntityNotFound(_0x1d3eed,null))[_0xe150('0x17')](function(_0x36f274){if(_0x36f274){return _0x36f274[_0xe150('0x85')](_0xb7dbfd[_0xe150('0x33')][_0xe150('0x86')]||[]);}return null;})[_0xe150('0x17')](respondWithResult(_0x1d3eed,null))[_0xe150('0x21')](handleError(_0x1d3eed,null));};exports[_0xe150('0x87')]=function(_0x4e9a0e,_0xd9f79f){var _0x1a68bb=[];_0x1a68bb[_0xe150('0x58')](addAdditionalPhones(_0x4e9a0e['body']));Promise['all'](_0x1a68bb)[_0xe150('0x17')](function(){_0x1a68bb=[];_0x1a68bb[_0xe150('0x58')](deleteCmHopperPhones(_0x4e9a0e['body']['id']));_0x1a68bb['push'](addCmHopperPhones(_0x4e9a0e[_0xe150('0x33')]['id']));Promise['all'](_0x1a68bb)[_0xe150('0x17')](function(){return[0x1];})[_0xe150('0x17')](respondWithResult(_0xd9f79f,null));});};function addAdditionalPhones(_0x533e9b){var _0x1e6214;return new Promise(function(_0x4a76d3){return db[_0xe150('0x46')][_0xe150('0x18')]({'where':{'CmContactId':_0x533e9b['id']}})[_0xe150('0x17')](function(){db[_0xe150('0x63')][_0xe150('0x2b')]({'raw':!![],'attributes':['id',_0xe150('0x88')]})[_0xe150('0x17')](function(_0x478393){var _0x1312eb=[];for(var _0x2e2441=0x0;_0x2e2441<_0x533e9b[_0xe150('0x89')][_0xe150('0x27')];_0x2e2441++){var _0xbaccdd=_0x533e9b['item_types']?_[_0xe150('0x52')](_0x533e9b[_0xe150('0x8a')][_0x2e2441])?'':_0x533e9b[_0xe150('0x8a')][_0x2e2441]:_0x533e9b['items'][_0x2e2441]['ItemTypeId']?_0x533e9b['items'][_0x2e2441][_0xe150('0x8b')]:'';var _0x5a29e5=_['isNil'](_0x533e9b[_0xe150('0x89')][_0x2e2441]['description'])?'':_0x533e9b[_0xe150('0x89')][_0x2e2441][_0xe150('0x8c')];var _0x37eb81=_0xbaccdd+':'+_0x533e9b[_0xe150('0x89')][_0x2e2441][_0xe150('0x78')]+'§'+_0x5a29e5;if(_['isNil'](_0x1e6214))_0x1e6214=_0x37eb81;else _0x1e6214+=';'+_0x37eb81;var _0xce2b8f=null;var _0x4a0257=null;if(_0x533e9b[_0xe150('0x8a')]){if(!_[_0xe150('0x52')](_0x533e9b[_0xe150('0x8a')][_0x2e2441])){_0x4a0257=_[_0xe150('0x23')](_0x478393,function(_0x3887e4){return _0x3887e4['id']===_0x533e9b['item_types'][_0x2e2441];});if(!_['isNil'](_0x4a0257)){_0xce2b8f=_0x4a0257[_0xe150('0x88')];}}}else{if(!_['isNil'](_0x533e9b[_0xe150('0x89')][_0x2e2441])){_0x4a0257=_[_0xe150('0x23')](_0x478393,function(_0x51cc3a){return _0x51cc3a['id']===_0x533e9b[_0xe150('0x89')][_0x2e2441][_0xe150('0x8b')];});if(!_[_0xe150('0x52')](_0x4a0257)){_0xce2b8f=_0x2e2441;}}}if(_['isNil'](_0xce2b8f)){_0xce2b8f=0x64;}_0x1312eb[_0xe150('0x58')](addAdditionalPhone(_0x533e9b['id'],_0x533e9b[_0xe150('0x89')][_0x2e2441][_0xe150('0x78')],_0x533e9b[_0xe150('0x8a')]?_[_0xe150('0x52')](_0x533e9b[_0xe150('0x8a')][_0x2e2441])?null:_0x533e9b[_0xe150('0x8a')][_0x2e2441]:_0x533e9b[_0xe150('0x89')][_0x2e2441][_0xe150('0x8b')]?_0x533e9b['items'][_0x2e2441][_0xe150('0x8b')]:null,_0xce2b8f,_0x5a29e5));}Promise[_0xe150('0x5d')](_0x1312eb)[_0xe150('0x17')](function(){db[_0xe150('0x22')][_0xe150('0x3d')]({'AdditionalPhones':_0x1e6214},{'where':{'id':_0x533e9b['id']}})[_0xe150('0x17')](function(){_0x4a76d3(0x1);});});});});});}function addAdditionalPhone(_0x8bafea,_0x55d632,_0x10beda,_0x43dc40,_0x5a6ffa){return db[_0xe150('0x46')][_0xe150('0x23')]({'where':{'CmContactId':_0x8bafea,'item':_0x55d632}})[_0xe150('0x17')](function(_0x448bcf){if(_0x448bcf)logger[_0xe150('0x30')](_0xe150('0x8d'),_0x448bcf);else{db[_0xe150('0x46')][_0xe150('0x4f')]({'CmContactId':_0x8bafea,'item':_0x55d632,'ItemTypeId':_0x10beda,'OrderBy':_0x43dc40,'ItemClass':_0xe150('0x8e'),'description':_0x5a6ffa});}});}function deleteCmHopperPhones(_0x29504f){return new Promise(function(_0x4097c0){return db[_0xe150('0x79')][_0xe150('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x29504f}})[_0xe150('0x17')](function(_0x412a63){db['CmHopperAdditionalPhone'][_0xe150('0x18')]({'where':{'CmHopperId':{'$in':_[_0xe150('0x6e')](_0x412a63,'id')}}});})['then'](function(){_0x4097c0(0x1);});});}function addCmHopperPhones(_0x1815cd){return new Promise(function(_0xbea305){return db[_0xe150('0x79')][_0xe150('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1815cd}})[_0xe150('0x17')](function(_0x364444){var _0x7fc9e4=[];_[_0xe150('0x6e')](_0x364444,function(_0x34df20){_0x7fc9e4[_0xe150('0x58')](createCmHopperPhone(_0x1815cd,_0x34df20['id']));});Promise[_0xe150('0x5d')](_0x7fc9e4)[_0xe150('0x17')](function(){_0xbea305(0x1);});});});}function createCmHopperPhone(_0x35b959,_0xfde521){return new Promise(function(_0x1a8102){db['CmContactHasItem'][_0xe150('0x2b')]({'raw':!![],'attributes':[_0xe150('0x8f'),_0xe150('0x88')],'where':{'CmContactId':_0x35b959,'ItemClass':_0xe150('0x8e')},'include':[{'model':db[_0xe150('0x63')],'attributes':[_0xe150('0x88')],'as':_0xe150('0x64')}],'order':[_0xe150('0x88'),db['sequelize'][_0xe150('0x66')](_0xe150('0x90'))]})[_0xe150('0x17')](function(_0x4aac35){var _0x292745=0x1;var _0x4dba82=_['map'](_0x4aac35,function(_0xb514eb){_0xb514eb[_0xe150('0x91')]=_0xfde521;_0xb514eb[_0xe150('0x78')]=_0xb514eb[_0xe150('0x8f')];_0xb514eb[_0xe150('0x88')]=_0x292745;delete _0xb514eb[_0xe150('0x92')];_0x292745=_0x292745+0x1;return _0xb514eb;});return db[_0xe150('0x93')][_0xe150('0x94')](_0x4dba82,{});})['then'](function(){_0x1a8102(0x1);});});}function insertAdditionalPhones(_0x31cca7,_0x56c035){return new Promise(function(_0x3057d7){var _0x46195c=[];for(var _0x1cdce4=0x0;_0x1cdce4<_0x56c035[_0xe150('0x27')];_0x1cdce4++){var _0x1f02d1=_0x56c035[_0x1cdce4];_0x46195c[_0xe150('0x58')](parseContactItemType(_0x1f02d1));}Promise[_0xe150('0x5d')](_0x46195c)[_0xe150('0x17')](function(){var _0x3c0188={'id':_0x31cca7['id'],'items':_0x56c035};return addAdditionalPhones(_0x3c0188)[_0xe150('0x17')](function(){return addCmHopperPhones(_0x31cca7['id']);});})[_0xe150('0x17')](function(){_0x3057d7(_0x31cca7);});});}function parseContactItemType(_0xe1099a){return new Promise(function(_0x224c79){if(_0xe1099a['hasOwnProperty'](_0xe150('0x8b'))){_0x224c79(_0xe1099a);}else{return db[_0xe150('0x63')][_0xe150('0x23')]({'where':{'name':_0xe1099a[_0xe150('0x64')]}})['then'](function(_0x1003a5){if(_[_0xe150('0x52')](_0x1003a5))_0xe1099a[_0xe150('0x8b')]=null;else _0xe1099a[_0xe150('0x8b')]=_0x1003a5['id'];_0x224c79(_0xe1099a);});}});}exports[_0xe150('0x95')]=function(_0x417c4e,_0x26bf12){return db[_0xe150('0x46')][_0xe150('0x2b')]({'raw':!![],'where':{'CmContactId':_0x417c4e[_0xe150('0x24')]['id'],'ItemClass':_0xe150('0x8e')},'include':[{'model':db[_0xe150('0x63')],'as':_0xe150('0x64')}],'order':[['OrderBy'],[db[_0xe150('0x65')][_0xe150('0x66')]('`ItemType`.OrderBy')]]})[_0xe150('0x17')](function(_0x31a4a7){return _0x31a4a7;})['then'](respondWithResult(_0x26bf12,null))['catch'](handleError(_0x26bf12,null));};exports[_0xe150('0x96')]=function(_0x3b9e93,_0x416ddd){return db[_0xe150('0x46')][_0xe150('0x2b')]({'raw':!![],'where':{'CmContactId':_0x3b9e93['body']['fromContactId']}})['then'](function(_0x56e8c2){var _0x496471=_[_0xe150('0x6e')](_0x56e8c2,function(_0x2d3cba){_0x2d3cba['CmContactId']=_0x3b9e93[_0xe150('0x33')][_0xe150('0x97')];return _0x2d3cba;});return db[_0xe150('0x46')]['bulkCreate'](_0x496471,{});})[_0xe150('0x17')](function(){return addCmHopperPhones(_0x3b9e93['body'][_0xe150('0x97')]);})['then'](function(){return['ok'];})[_0xe150('0x17')](respondWithResult(_0x416ddd,null))[_0xe150('0x21')](handleError(_0x416ddd,null));};exports[_0xe150('0x98')]=function(_0x4004ff,_0x2452bb){var _0x2173fb=[];_0x2173fb[_0xe150('0x58')](createCmHopperPhone(_0x4004ff[_0xe150('0x33')]['id'],_0x4004ff[_0xe150('0x33')][_0xe150('0x99')]));Promise[_0xe150('0x5d')](_0x2173fb)[_0xe150('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x2452bb,null));};exports[_0xe150('0x9a')]=function(_0x4eef04,_0xbbf161){var _0x39311d={'raw':![],'where':{}};var _0x2e3628={};var _0x599a68={'count':0x0,'rows':[]};return db['CmContact'][_0xe150('0x7b')]({'where':{'id':_0x4eef04[_0xe150('0x24')]['id']}})[_0xe150('0x17')](handleEntityNotFound(_0xbbf161,null))['then'](function(_0x4e98ed){if(_0x4e98ed){_0x2e3628[_0xe150('0x7e')]=_[_0xe150('0x26')](db[_0xe150('0x79')][_0xe150('0x7c')]);_0x2e3628[_0xe150('0x20')]=_[_0xe150('0x26')](_0x4eef04['query']);_0x2e3628[_0xe150('0x82')]=_[_0xe150('0x7d')](_0x2e3628[_0xe150('0x7e')],_0x2e3628[_0xe150('0x20')]);_0x39311d[_0xe150('0x7f')]=_['intersection'](_0x2e3628[_0xe150('0x7e')],qs['fields'](_0x4eef04[_0xe150('0x20')][_0xe150('0x80')]));_0x39311d[_0xe150('0x7f')]=_0x39311d['attributes']['length']?_0x39311d['attributes']:_0x2e3628['model'];if(!_0x4eef04[_0xe150('0x20')][_0xe150('0x31')](_0xe150('0x84'))){_0x39311d['limit']=qs['limit'](_0x4eef04[_0xe150('0x20')][_0xe150('0x13')]);_0x39311d[_0xe150('0x10')]=qs['offset'](_0x4eef04[_0xe150('0x20')][_0xe150('0x10')]);}_0x39311d[_0xe150('0x9b')]=qs[_0xe150('0x81')](_0x4eef04['query']['sort']);_0x39311d['where']=qs[_0xe150('0x82')](_['pick'](_0x4eef04[_0xe150('0x20')],_0x2e3628['filters']));_0x39311d[_0xe150('0x59')][_0xe150('0x9c')]=_0x4e98ed['id'];if(_0x4eef04[_0xe150('0x20')]['filter']){_0x39311d[_0xe150('0x59')]=_[_0xe150('0x32')](_0x39311d['where'],{'$or':_[_0xe150('0x6e')](_0x39311d[_0xe150('0x7f')],function(_0x437eda){var _0x57e500={};_0x57e500[_0x437eda]={'$like':'%'+_0x4eef04['query'][_0xe150('0x9d')]+'%'};return _0x57e500;})});}_0x39311d=_[_0xe150('0x32')]({},_0x39311d,_0x4eef04[_0xe150('0x83')]);return db[_0xe150('0x79')][_0xe150('0x12')]({'where':_0x39311d[_0xe150('0x59')]})[_0xe150('0x17')](function(_0x1e051c){_0x599a68[_0xe150('0x12')]=_0x1e051c;if(_0x4eef04[_0xe150('0x20')][_0xe150('0x9e')]){_0x39311d[_0xe150('0x9f')]=[{'all':!![]}];}return db[_0xe150('0x79')][_0xe150('0x2b')](_0x39311d);})['then'](function(_0x23fb8d){_0x599a68[_0xe150('0xa0')]=_0x23fb8d;return _0x599a68;});}})[_0xe150('0x17')](respondWithFilteredResult(_0xbbf161,_0x39311d))[_0xe150('0x21')](handleError(_0xbbf161,null));};exports[_0xe150('0xa1')]=function(_0x4e7603,_0x46d184){var _0x447efd={'raw':!![],'where':{}};var _0x56ac8f={};var _0x1f68b0={'count':0x0,'rows':[]};return db[_0xe150('0x22')][_0xe150('0x7b')]({'where':{'id':_0x4e7603[_0xe150('0x24')]['id']}})[_0xe150('0x17')](handleEntityNotFound(_0x46d184,null))[_0xe150('0x17')](function(_0xde22a1){if(_0xde22a1){_0x56ac8f[_0xe150('0x7e')]=_[_0xe150('0x26')](db[_0xe150('0xa2')]['rawAttributes']);_0x56ac8f['query']=_['keys'](_0x4e7603[_0xe150('0x20')]);_0x56ac8f[_0xe150('0x82')]=_[_0xe150('0x7d')](_0x56ac8f['model'],_0x56ac8f[_0xe150('0x20')]);_0x447efd[_0xe150('0x7f')]=_['intersection'](_0x56ac8f[_0xe150('0x7e')],qs['fields'](_0x4e7603[_0xe150('0x20')][_0xe150('0x80')]));_0x447efd['attributes']=_0x447efd[_0xe150('0x7f')]['length']?_0x447efd[_0xe150('0x7f')]:_0x56ac8f['model'];if(!_0x4e7603[_0xe150('0x20')]['hasOwnProperty'](_0xe150('0x84'))){_0x447efd['limit']=qs[_0xe150('0x13')](_0x4e7603['query'][_0xe150('0x13')]);_0x447efd['offset']=qs[_0xe150('0x10')](_0x4e7603[_0xe150('0x20')][_0xe150('0x10')]);}_0x447efd[_0xe150('0x9b')]=qs[_0xe150('0x81')](_0x4e7603['query']['sort']);_0x447efd[_0xe150('0x59')]=qs[_0xe150('0x82')](_[_0xe150('0xa3')](_0x4e7603['query'],_0x56ac8f[_0xe150('0x82')]));_0x447efd[_0xe150('0x59')]['ContactId']=_0xde22a1['id'];if(_0x4e7603[_0xe150('0x20')][_0xe150('0x9d')]){_0x447efd[_0xe150('0x59')]=_['merge'](_0x447efd[_0xe150('0x59')],{'$or':_['map'](_0x447efd[_0xe150('0x7f')],function(_0xfacfff){var _0x510643={};_0x510643[_0xfacfff]={'$like':'%'+_0x4e7603[_0xe150('0x20')]['filter']+'%'};return _0x510643;})});}_0x447efd=_[_0xe150('0x32')]({},_0x447efd,_0x4e7603[_0xe150('0x83')]);return db[_0xe150('0xa2')][_0xe150('0x12')]({'where':_0x447efd['where']})[_0xe150('0x17')](function(_0x251291){_0x1f68b0[_0xe150('0x12')]=_0x251291;if(_0x4e7603[_0xe150('0x20')][_0xe150('0x9e')]){_0x447efd[_0xe150('0x9f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe150('0x2b')](_0x447efd);})[_0xe150('0x17')](function(_0x14d772){_0x1f68b0[_0xe150('0xa0')]=_0x14d772;return _0x1f68b0;});}})[_0xe150('0x17')](respondWithFilteredResult(_0x46d184,_0x447efd))[_0xe150('0x21')](handleError(_0x46d184,null));};exports['getHopperFinals']=function(_0x5d1fa9,_0x23a5cb){var _0x10475a={'raw':!![],'where':{}};var _0x367fc1={};var _0x226740={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x5d1fa9['params']['id']}})[_0xe150('0x17')](handleEntityNotFound(_0x23a5cb,null))[_0xe150('0x17')](function(_0x2b99f1){if(_0x2b99f1){_0x367fc1['model']=_[_0xe150('0x26')](db[_0xe150('0x47')][_0xe150('0x7c')]);_0x367fc1[_0xe150('0x20')]=_[_0xe150('0x26')](_0x5d1fa9[_0xe150('0x20')]);_0x367fc1[_0xe150('0x82')]=_[_0xe150('0x7d')](_0x367fc1[_0xe150('0x7e')],_0x367fc1['query']);_0x10475a[_0xe150('0x7f')]=_[_0xe150('0x7d')](_0x367fc1[_0xe150('0x7e')],qs[_0xe150('0x80')](_0x5d1fa9[_0xe150('0x20')][_0xe150('0x80')]));_0x10475a[_0xe150('0x7f')]=_0x10475a[_0xe150('0x7f')][_0xe150('0x27')]?_0x10475a[_0xe150('0x7f')]:_0x367fc1[_0xe150('0x7e')];if(!_0x5d1fa9[_0xe150('0x20')][_0xe150('0x31')](_0xe150('0x84'))){_0x10475a[_0xe150('0x13')]=qs[_0xe150('0x13')](_0x5d1fa9[_0xe150('0x20')][_0xe150('0x13')]);_0x10475a[_0xe150('0x10')]=qs[_0xe150('0x10')](_0x5d1fa9[_0xe150('0x20')]['offset']);}_0x10475a[_0xe150('0x9b')]=qs[_0xe150('0x81')](_0x5d1fa9['query'][_0xe150('0x81')]);_0x10475a[_0xe150('0x59')]=qs['filters'](_[_0xe150('0xa3')](_0x5d1fa9[_0xe150('0x20')],_0x367fc1['filters']));_0x10475a[_0xe150('0x59')][_0xe150('0x9c')]=_0x2b99f1['id'];if(_0x5d1fa9['query'][_0xe150('0x9d')]){_0x10475a[_0xe150('0x59')]=_['merge'](_0x10475a[_0xe150('0x59')],{'$or':_[_0xe150('0x6e')](_0x10475a['attributes'],function(_0x5b292f){var _0x17f321={};_0x17f321[_0x5b292f]={'$like':'%'+_0x5d1fa9[_0xe150('0x20')][_0xe150('0x9d')]+'%'};return _0x17f321;})});}_0x10475a=_[_0xe150('0x32')]({},_0x10475a,_0x5d1fa9['options']);return db['CmHopperFinal']['count']({'where':_0x10475a['where']})[_0xe150('0x17')](function(_0x19b807){_0x226740[_0xe150('0x12')]=_0x19b807;if(_0x5d1fa9[_0xe150('0x20')]['includeAll']){_0x10475a[_0xe150('0x9f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe150('0x2b')](_0x10475a);})[_0xe150('0x17')](function(_0x40c585){_0x226740[_0xe150('0xa0')]=_0x40c585;return _0x226740;});}})[_0xe150('0x17')](respondWithFilteredResult(_0x23a5cb,_0x10475a))['catch'](handleError(_0x23a5cb,null));};exports[_0xe150('0xa4')]=function(_0x24477c,_0x51f616){var _0x2242cd={'raw':!![],'where':{}};var _0xf110bc={};var _0x468577={'count':0x0,'rows':[]};return db['CmContact'][_0xe150('0x7b')]({'where':{'id':_0x24477c[_0xe150('0x24')]['id']}})['then'](handleEntityNotFound(_0x51f616,null))['then'](function(_0x3a02a0){if(_0x3a02a0){_0xf110bc[_0xe150('0x7e')]=_[_0xe150('0x26')](db[_0xe150('0x4c')][_0xe150('0x7c')]);_0xf110bc[_0xe150('0x20')]=_[_0xe150('0x26')](_0x24477c[_0xe150('0x20')]);_0xf110bc[_0xe150('0x82')]=_[_0xe150('0x7d')](_0xf110bc['model'],_0xf110bc[_0xe150('0x20')]);_0x2242cd['attributes']=_[_0xe150('0x7d')](_0xf110bc[_0xe150('0x7e')],qs[_0xe150('0x80')](_0x24477c[_0xe150('0x20')][_0xe150('0x80')]));_0x2242cd[_0xe150('0x7f')]=_0x2242cd[_0xe150('0x7f')][_0xe150('0x27')]?_0x2242cd[_0xe150('0x7f')]:_0xf110bc['model'];if(!_0x24477c[_0xe150('0x20')]['hasOwnProperty'](_0xe150('0x84'))){_0x2242cd[_0xe150('0x13')]=qs[_0xe150('0x13')](_0x24477c['query']['limit']);_0x2242cd[_0xe150('0x10')]=qs['offset'](_0x24477c['query']['offset']);}_0x2242cd[_0xe150('0x9b')]=qs[_0xe150('0x81')](_0x24477c[_0xe150('0x20')][_0xe150('0x81')]);_0x2242cd[_0xe150('0x59')]=qs[_0xe150('0x82')](_[_0xe150('0xa3')](_0x24477c[_0xe150('0x20')],_0xf110bc[_0xe150('0x82')]));_0x2242cd[_0xe150('0x59')][_0xe150('0x9c')]=_0x3a02a0['id'];if(_0x24477c['query']['filter']){_0x2242cd[_0xe150('0x59')]=_[_0xe150('0x32')](_0x2242cd[_0xe150('0x59')],{'$or':_[_0xe150('0x6e')](_0x2242cd[_0xe150('0x7f')],function(_0xc4e9b1){var _0x15179b={};_0x15179b[_0xc4e9b1]={'$like':'%'+_0x24477c[_0xe150('0x20')]['filter']+'%'};return _0x15179b;})});}_0x2242cd=_[_0xe150('0x32')]({},_0x2242cd,_0x24477c['options']);return db[_0xe150('0x4c')]['count']({'where':_0x2242cd[_0xe150('0x59')]})['then'](function(_0x3f893e){_0x468577[_0xe150('0x12')]=_0x3f893e;if(_0x24477c[_0xe150('0x20')][_0xe150('0x9e')]){_0x2242cd[_0xe150('0x9f')]=[{'all':!![]}];}return db[_0xe150('0x4c')][_0xe150('0x2b')](_0x2242cd);})[_0xe150('0x17')](function(_0x4a22b0){_0x468577[_0xe150('0xa0')]=_0x4a22b0;return _0x468577;});}})[_0xe150('0x17')](respondWithFilteredResult(_0x51f616,_0x2242cd))['catch'](handleError(_0x51f616,null));};exports[_0xe150('0xa5')]=function(_0x4e7d29,_0x62bb7f){try{if(!_0x4e7d29[_0xe150('0x33')][_0xe150('0x5a')]){throw new Error(_0xe150('0xa6'));}if(!_0x4e7d29[_0xe150('0x33')][_0xe150('0xa7')]){throw new Error(_0xe150('0xa8'));}if(!_0x4e7d29['body']['binding_values']){throw new Error(_0xe150('0xa9'));}if(!_0x4e7d29[_0xe150('0x33')]['socket_timestamp']){throw new Error(_0xe150('0xaa'));}var _0x22253b=_0x4e7d29[_0xe150('0x33')][_0xe150('0xa7')][_0xe150('0xab')](',');var _0x1c643f=_0x4e7d29[_0xe150('0x33')]['binding_values'][_0xe150('0xab')](',');if(!_0x22253b[_0xe150('0x27')]||!_0x1c643f['length']||_0x22253b[_0xe150('0x27')]!==_0x1c643f[_0xe150('0x27')]){throw new Error(_0xe150('0xac'));}_0x4e7d29[_0xe150('0x33')]['fields']=_['zipObject'](_0x22253b,_0x1c643f);if(!_0x4e7d29[_0xe150('0x33')][_0xe150('0x80')][_0xe150('0x78')]){throw new Error(_0xe150('0xad'));}if(!_0x4e7d29['body']['fields']['firstName']){throw new Error(_0xe150('0xae'));}var _0x16a75f=path[_0xe150('0x50')](config['root'],_0xe150('0xaf'),_0x4e7d29[_0xe150('0xb0')]['filename']);fs[_0xe150('0xb1')](_0x16a75f,parseInt(_0xe150('0xb2'),0x8));var _0x5652c9=require('child_process')[_0xe150('0xb3')](path['join'](__dirname,_0xe150('0xb4')),[_0x16a75f,_0x4e7d29[_0xe150('0x33')][_0xe150('0xa7')],_0x4e7d29['body'][_0xe150('0xb5')],_0x4e7d29['body']['ListId'],_0x4e7d29['body']['CompanyId'],_0x4e7d29[_0xe150('0x33')][_0xe150('0x56')],_0x4e7d29[_0xe150('0x33')][_0xe150('0xb6')]]);return _0x62bb7f[_0xe150('0xf')](0xc8)[_0xe150('0x16')]({'message':_0xe150('0xb7'),'pid':_0x5652c9[_0xe150('0xb8')]});}catch(_0x43753f){return _0x62bb7f[_0xe150('0xf')](0x1f4)['send'](_0x43753f);}};exports[_0xe150('0xb9')]=function(_0x3eca90,_0x13eac6){var _0x193268=fs[_0xe150('0xba')](_0x3eca90[_0xe150('0xb0')]['path']);Papa['parse'](_0x193268,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xbeccab){return _0x13eac6['status'](0xc8)[_0xe150('0x16')]({'file':_0x3eca90[_0xe150('0xb0')],'fields':_0xbeccab[_0xe150('0xbb')][_0xe150('0x80')]});}});};exports[_0xe150('0xbc')]=function(_0x403edd,_0x31edc2){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xe150('0xbd')}})[_0xe150('0x17')](function(_0x324711){var _0x29f491=![];if(!_0x403edd[_0xe150('0x33')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x403edd[_0xe150('0x33')][_0xe150('0xbe')][_0xe150('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x403edd[_0xe150('0x33')]['binding'][_0xe150('0xbf')]){throw new Error(_0xe150('0xae'));}if(!_0x403edd[_0xe150('0x33')][_0xe150('0xb6')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0xc53298=require(_0xe150('0xc0'))[_0xe150('0xb3')](path['join'](__dirname,_0xe150('0xc1')),[_0x403edd[_0xe150('0x24')]['id'],JSON['stringify'](_0x403edd[_0xe150('0x33')]),JSON[_0xe150('0xc2')](_0x324711)]);_0xc53298['on'](_0xe150('0xc3'),function(){_0x29f491=!![];return _0x31edc2[_0xe150('0xf')](0xc8)[_0xe150('0x16')]({'message':_0xe150('0xc4'),'pid':_0xc53298['pid']});});_0xc53298['on'](_0xe150('0xc5'),function(_0x23e6db){if(_0x23e6db&&!_0x29f491){return _0x31edc2[_0xe150('0xf')](0x1f4)[_0xe150('0x16')]({'message':_0xe150('0xc6'),'pid':_0xc53298[_0xe150('0xb8')]});}});})[_0xe150('0x21')](handleError(_0x31edc2,null));};exports[_0xe150('0xc7')]=function(_0x8686bd,_0x5366c3){return db[_0xe150('0xc8')][_0xe150('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':_0xe150('0xbd')}})[_0xe150('0x17')](function(_0x468805){var _0x1fa068=![];if(!_0x8686bd['body'][_0xe150('0x5a')]){throw new Error(_0xe150('0xa6'));}if(!_0x8686bd[_0xe150('0x33')][_0xe150('0xbe')][_0xe150('0x78')]){throw new Error(_0xe150('0xad'));}if(!_0x8686bd['body']['binding'][_0xe150('0xbf')]){throw new Error(_0xe150('0xae'));}if(!_0x8686bd[_0xe150('0x33')][_0xe150('0xb6')]){throw new Error(_0xe150('0xaa'));}var _0x285c77=require(_0xe150('0xc0'))[_0xe150('0xb3')](path[_0xe150('0x50')](__dirname,_0xe150('0xc9')),[_0x8686bd[_0xe150('0x24')]['id'],JSON[_0xe150('0xc2')](_0x8686bd['body']),JSON['stringify'](_0x468805)]);_0x285c77['on'](_0xe150('0xc3'),function(){_0x1fa068=!![];return _0x5366c3['status'](0xc8)['json']({'message':_0xe150('0xc4'),'pid':_0x285c77[_0xe150('0xb8')]});});_0x285c77['on'](_0xe150('0xc5'),function(_0x478831){if(_0x478831&&!_0x1fa068){return _0x5366c3['status'](0x1f4)['json']({'message':_0xe150('0xc6'),'pid':_0x285c77[_0xe150('0xb8')]});}});})['catch'](handleError(_0x5366c3,null));};exports[_0xe150('0xca')]=function(_0x1c331d,_0x5cae82){var _0x2f7109=['mail',_0xe150('0xcb'),_0xe150('0xcc'),_0xe150('0xcd'),_0xe150('0xce'),_0xe150('0xcf'),_0xe150('0xd0')];var _0x3b6e6a={'offset':0x0,'order':qs[_0xe150('0x81')](_0xe150('0xd1'))},_0x28fa66={'count':0x0,'rows':[]};Promise[_0xe150('0xd2')]()['then'](function(){if(_0x1c331d[_0xe150('0x20')][_0xe150('0xd3')]){if(!_[_0xe150('0xd4')](_0x2f7109,_0x1c331d['query'][_0xe150('0xd3')][_0xe150('0xd5')]())){throw new Error(_0xe150('0xd6'));}_0x2f7109=[_0x1c331d[_0xe150('0x20')][_0xe150('0xd3')][_0xe150('0xd5')]()];}if(_0x1c331d[_0xe150('0x20')]['range']){try{var _0x194287=JSON[_0xe150('0xd7')](_0x1c331d[_0xe150('0x20')][_0xe150('0xd8')]);if(!moment(_0x194287['from'])[_0xe150('0xd9')]()){throw new Error(_0xe150('0xda'));}if(!moment(_0x194287['to'])[_0xe150('0xd9')]()){throw new Error(_0xe150('0xdb'));}}catch(_0x382b18){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x1c331d[_0xe150('0x20')][_0xe150('0x31')](_0xe150('0x84'))){_0x3b6e6a[_0xe150('0x13')]=qs[_0xe150('0x13')](_0x1c331d['query']['limit']||0xa);_0x3b6e6a[_0xe150('0x10')]=qs[_0xe150('0x10')](_0x1c331d[_0xe150('0x20')][_0xe150('0x10')]);}var _0x20b592=_0x2f7109[_0xe150('0x6e')](function(_0x236df0){if(_0x236df0==='voice'){var _0x1bd6cf={'attributes':['id',_0xe150('0xdc'),_0xe150('0x2f'),_0xe150('0xdd'),_0xe150('0xde'),_0xe150('0xdf'),_0xe150('0xe0'),_0xe150('0xe1'),'duration',_0xe150('0xe2'),_0xe150('0xe3'),_0xe150('0xe4'),_0xe150('0xe5'),_0xe150('0xe6'),_0xe150('0xe7')],'where':{'ContactId':_0x1c331d[_0xe150('0x24')]['id']},'include':[{'model':db['User'],'as':_0xe150('0xc8'),'attributes':['id',_0xe150('0x1b'),_0xe150('0xe8'),_0xe150('0x2d')]}],'order':[['createdAt','DESC']]};if(_0x1c331d['query'][_0xe150('0xd8')]){_0x1bd6cf[_0xe150('0x59')][_0xe150('0xe3')]={'$gte':_0x194287['from'],'$lte':_0x194287['to']};}return db[_0xe150('0x48')][_0xe150('0xe9')](_0x1bd6cf)[_0xe150('0x17')](function(_0x181f83){_0x28fa66[_0xe150('0x12')]+=_0x181f83['count'];return _[_0xe150('0x6e')](_0x181f83[_0xe150('0xa0')],function(_0x2a1998){var _0x13429d=_0x2a1998['get']({'plain':!![]});_0x13429d['channel']=_0x236df0;if(_0x13429d[_0xe150('0xc8')]){_0x13429d[_0xe150('0xc8')]={'id':_0x13429d[_0xe150('0xc8')]['id'],'name':_0x13429d[_0xe150('0xc8')][_0xe150('0x1b')],'fullname':_0x13429d[_0xe150('0xc8')]['fullname'],'alias':_0x13429d[_0xe150('0xc8')][_0xe150('0x2d')]};}return _0x13429d;});});}else{var _0x2a3849=_[_0xe150('0xea')](_0x236df0)+(_0x236df0===_0xe150('0xcb')?_0xe150('0xeb'):_0xe150('0xec'));var _0x2a4e71={'attributes':['id',_0xe150('0xed'),_0xe150('0xee'),_0xe150('0xe3'),'note',_0xe150('0xef'),_0xe150('0xf0'),_0xe150('0xf1'),_0xe150('0xe7'),_0x2a3849+'Id'],'where':{'ContactId':_0x1c331d[_0xe150('0x24')]['id']},'include':[{'model':db[_0x2a3849],'as':_0xe150('0xec'),'attributes':['id',_0xe150('0x1b'),'key']},{'model':db['User'],'as':_0xe150('0xf2'),'attributes':['id','name',_0xe150('0xe8')]},{'model':db[_0xe150('0x5e')],'as':'Tags','attributes':['id',_0xe150('0x1b'),_0xe150('0x60')],'through':{'attributes':[]}}],'order':[[_0xe150('0xe3'),_0xe150('0xf3')]]};if(_0x1c331d[_0xe150('0x20')][_0xe150('0xd8')]){_0x2a4e71[_0xe150('0x59')][_0xe150('0xe3')]={'$gte':_0x194287[_0xe150('0x34')],'$lte':_0x194287['to']};}switch(_0x236df0){case'chat':_0x2a4e71['attributes']['push']('browserName',_0xe150('0xf4'),_0xe150('0xf5'),'deviceModel',_0xe150('0xf6'),_0xe150('0xf7'),'ratingType',_0xe150('0xf8'),_0xe150('0xf9'));break;case _0xe150('0xfa'):_0x2a4e71[_0xe150('0x7f')][_0xe150('0x58')](_0xe150('0xfb'),'substatus');break;case'openchannel':_0x2a4e71[_0xe150('0x7f')][_0xe150('0x58')]('externalUrl',_0xe150('0xfc'));break;}return db[_['startCase'](_0x236df0)+_0xe150('0xfd')]['findAndCountAll'](_0x2a4e71)['then'](function(_0x3dd441){_0x28fa66[_0xe150('0x12')]+=_0x3dd441[_0xe150('0x12')];return _['map'](_0x3dd441[_0xe150('0xa0')],function(_0x494e63){var _0x53b7c8=_0x494e63[_0xe150('0x35')]({'plain':!![]});_0x53b7c8[_0xe150('0xd3')]=_0x236df0;if(_0x53b7c8['Owner']){_0x53b7c8[_0xe150('0xf2')]={'id':_0x53b7c8['Owner']['id'],'name':_0x53b7c8[_0xe150('0xf2')][_0xe150('0x1b')],'fullname':_0x53b7c8['Owner'][_0xe150('0xe8')]};}return _0x53b7c8;});});}});return Promise['all'](_0x20b592);})[_0xe150('0x17')](function(_0x56cc0f){return _(_0x56cc0f)[_0xe150('0xfe')]()[_0xe150('0xff')](_0xe150('0xe3'))[_0xe150('0x100')]()[_0xe150('0x101')]();})[_0xe150('0x17')](function(_0x2ca47c){_0x28fa66['rows']=_0x3b6e6a[_0xe150('0x13')]?_0x2ca47c[_0xe150('0x102')](_0x3b6e6a['offset'],_0x3b6e6a[_0xe150('0x10')]+_0x3b6e6a[_0xe150('0x13')]):_0x2ca47c;return _0x28fa66;})[_0xe150('0x17')](respondWithFilteredResult(_0x5cae82,_0x3b6e6a))['catch'](handleError(_0x5cae82,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index e1d7aac..7b9618f 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf659=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xf659,0x11f));var _0x9f65=function(_0x31baee,_0x5d82ee){_0x31baee=_0x31baee-0x0;var _0x41c475=_0xf659[_0x31baee];return _0x41c475;};'use strict';var EventEmitter=require(_0x9f65('0x0'));var CmContact=require(_0x9f65('0x1'))['db'][_0x9f65('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9f65('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f65('0x4'),'afterDestroy':_0x9f65('0x5')};function emitEvent(_0x2ce5d7){return function(_0x17e8a4,_0x18f66d,_0x769ed7){CmContactEvents[_0x9f65('0x6')](_0x2ce5d7+':'+_0x17e8a4['id'],_0x17e8a4);CmContactEvents[_0x9f65('0x6')](_0x2ce5d7,_0x17e8a4);_0x769ed7(null);};}for(var e in events){if(events[_0x9f65('0x7')](e)){var event=events[e];CmContact[_0x9f65('0x8')](e,emitEvent(event));}}module[_0x9f65('0x9')]=CmContactEvents; \ No newline at end of file +var _0x9397=['emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9397,0x1e0));var _0x7939=function(_0x463308,_0xd47a4e){_0x463308=_0x463308-0x0;var _0x19076a=_0x9397[_0x463308];return _0x19076a;};'use strict';var EventEmitter=require(_0x7939('0x0'));var CmContact=require(_0x7939('0x1'))['db'][_0x7939('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x7939('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7939('0x4'),'afterDestroy':_0x7939('0x5')};function emitEvent(_0x2086c4){return function(_0x4765ab,_0x344d1a,_0x419459){CmContactEvents[_0x7939('0x6')](_0x2086c4+':'+_0x4765ab['id'],_0x4765ab);CmContactEvents[_0x7939('0x6')](_0x2086c4,_0x4765ab);_0x419459(null);};}for(var e in events){if(events[_0x7939('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x7939('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index fb2e5f6..03392a1 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf2c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','timezones','add','then','CmHopper','priority','callbackUniqueid','catch','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','ListId','error','cmContact','Campaign','utcOffset','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','always','List\x20not\x20found','destroy','ContactId','VoiceQueueId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xaf2c,0x1a8));var _0xcaf2=function(_0x204876,_0x64c2a){_0x204876=_0x204876-0x0;var _0x26c966=_0xaf2c[_0x204876];return _0x26c966;};'use strict';var _=require(_0xcaf2('0x0'));var util=require('util');var logger=require(_0xcaf2('0x1'))(_0xcaf2('0x2'));var moment=require(_0xcaf2('0x3'));var BPromise=require(_0xcaf2('0x4'));var rp=require(_0xcaf2('0x5'));var fs=require('fs');var path=require(_0xcaf2('0x6'));var rimraf=require(_0xcaf2('0x7'));var config=require(_0xcaf2('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0xcaf2('0x9'));module['exports']=function(_0x337eb8,_0x565b59){return _0x337eb8['define'](_0xcaf2('0xa'),attributes,{'tableName':_0xcaf2('0xb'),'paranoid':!![],'indexes':[{'name':_0xcaf2('0xc'),'fields':[_0xcaf2('0xc')]},{'name':_0xcaf2('0xd'),'fields':[_0xcaf2('0xe'),_0xcaf2('0xf'),_0xcaf2('0xc'),'mobile',_0xcaf2('0x10'),_0xcaf2('0x11')],'type':_0xcaf2('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xcaf2('0x13'),'hooks':{'afterCreate':function(_0x1682c0,_0x323768,_0x39f25e){var _0x142631=_0x337eb8[_0xcaf2('0x14')];var _0x2d169f=_0x1682c0[_0xcaf2('0x15')]({'plain':!![]});function _0x386415(){return function(_0x197fb4){logger['error']('cmContact',_0xcaf2('0x16'),util[_0xcaf2('0x17')](_0x197fb4,{'showHidden':![],'depth':null}));};}function _0x22a3d1(_0x26e286,_0x3b169){var _0x404769=_0x3b169[_0xcaf2('0x18')]?_0x3b169[_0xcaf2('0x18')]:moment()[_0xcaf2('0x19')](_0xcaf2('0x1a'));return new BPromise(function(_0x1ad777,_0x14dd44){if(_[_0xcaf2('0x1b')](_0x3b169[_0xcaf2('0x1c')])){_0x1ad777({'ret':_0x404769});}else{_0x142631['VoiceQueue'][_0xcaf2('0x1d')]({'where':{'id':_0x26e286['id']}})['then'](function(_0x208633){if(!_[_0xcaf2('0x1b')](_0x208633)){var _0x52bf12=_0x208633[_0xcaf2('0x1c')];if(!_[_0xcaf2('0x1b')](_0x52bf12)){var _0x32ff47=shared[_0xcaf2('0x1e')];var _0x1de0f1=_0x32ff47[_0x52bf12];var _0x5c9f8e=_0x32ff47[_0x3b169[_0xcaf2('0x1c')]];if(!_[_0xcaf2('0x1b')](_0x1de0f1)&&!_[_0xcaf2('0x1b')](_0x5c9f8e)){var _0x36684c=_0x1de0f1['utcOffset']-_0x5c9f8e['utcOffset'];_0x404769=_0x3b169[_0xcaf2('0x18')]?_0x3b169['scheduledat']:moment();var _0x4b0995=moment(_0x404769)[_0xcaf2('0x1f')](_0x36684c,'minutes');_0x1ad777({'ret':_0x4b0995[_0xcaf2('0x19')](_0xcaf2('0x1a'))});}else _0x1ad777({'ret':_0x404769});}else _0x1ad777({'ret':_0x404769});}else{_0x1ad777({'ret':_0x404769});}});}});return 0xa;}var _0xaaa72f=function(_0x1b7ab9){return new BPromise(function(_0x508afa,_0x1a5410){_0x22a3d1(_0x1b7ab9,_0x2d169f)[_0xcaf2('0x20')](function(_0x2ce326){_0x2d169f[_0xcaf2('0x18')]=_0x2ce326['ret'];_0x142631[_0xcaf2('0x21')][_0xcaf2('0x1d')]({'where':{'phone':_0x2d169f[_0xcaf2('0xc')],'VoiceQueueId':_0x1b7ab9['id']}})[_0xcaf2('0x20')](function(_0x44ffc6){if(!_[_0xcaf2('0x1b')](_0x44ffc6)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2d169f[_0xcaf2('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1b7ab9['id']);}return _0x142631[_0xcaf2('0x21')]['create']({'phone':_0x2d169f[_0xcaf2('0xc')],'ContactId':_0x2d169f['id'],'ListId':_0x2d169f['ListId'],'priority':_0x2d169f[_0xcaf2('0x22')]?_0x2d169f[_0xcaf2('0x22')]:0x2,'scheduledat':_0x2d169f[_0xcaf2('0x18')]?_0x2d169f[_0xcaf2('0x18')]:moment()['format'](_0xcaf2('0x1a')),'callback':_0x2d169f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2d169f[_0xcaf2('0x23')]?_0x2d169f[_0xcaf2('0x23')]:undefined,'callbackat':_0x2d169f[_0xcaf2('0x23')]?moment()[_0xcaf2('0x19')](_0xcaf2('0x1a')):undefined,'VoiceQueueId':_0x1b7ab9['id']});})[_0xcaf2('0x24')](function(_0x43d279){_0x1a5410(_0x43d279);});});});};var _0x230560=function(_0x2f6f6e){return new BPromise(function(_0x1b2861,_0x51a0cd){_0x22a3d1(_0x2f6f6e,_0x2d169f)['then'](function(_0xdbc337){_0x2d169f[_0xcaf2('0x18')]=_0xdbc337[_0xcaf2('0x25')];_0x142631[_0xcaf2('0x21')][_0xcaf2('0x1d')]({'where':{'phone':_0x2d169f['phone'],'VoiceQueueId':_0x2f6f6e['id']}})[_0xcaf2('0x20')](function(_0x495950){if(!_[_0xcaf2('0x1b')](_0x495950)){throw new Error(_0xcaf2('0x26')+_0x2d169f[_0xcaf2('0xc')]+_0xcaf2('0x27')+_0x2f6f6e['id']);}return _0x142631['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x2d169f[_0xcaf2('0xc')],'VoiceQueueId':_0x2f6f6e['id']}});})[_0xcaf2('0x20')](function(_0x2a5d79){if(!_[_0xcaf2('0x1b')](_0x2a5d79)){throw new Error(_0xcaf2('0x28')+_0x2d169f['phone']+_0xcaf2('0x29')+_0x2f6f6e['id']);}return _0x142631['CmHopper'][_0xcaf2('0x2a')]({'phone':_0x2d169f[_0xcaf2('0xc')],'ContactId':_0x2d169f['id'],'ListId':_0x2d169f[_0xcaf2('0x2b')],'priority':_0x2d169f['priority']?_0x2d169f['priority']:0x2,'scheduledat':_0x2d169f[_0xcaf2('0x18')]?_0x2d169f[_0xcaf2('0x18')]:moment()['format'](_0xcaf2('0x1a')),'callback':_0x2d169f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2d169f['callbackUniqueid']?_0x2d169f[_0xcaf2('0x23')]:undefined,'callbackat':_0x2d169f[_0xcaf2('0x23')]?moment()[_0xcaf2('0x19')](_0xcaf2('0x1a')):undefined,'VoiceQueueId':_0x2f6f6e['id']});})[_0xcaf2('0x24')](function(_0x3a240c){_0x51a0cd(_0x3a240c);});});});};function _0x40c97f(){return function(_0x38f08d){logger[_0xcaf2('0x2c')](_0xcaf2('0x2d'),_0xcaf2('0x16'),util[_0xcaf2('0x17')](_0x38f08d,{'showHidden':![],'depth':null}));};}function _0x595806(_0x3edd65,_0x5815d4){var _0x1c2862=_0x5815d4[_0xcaf2('0x18')]?_0x5815d4['scheduledat']:moment()[_0xcaf2('0x19')](_0xcaf2('0x1a'));return new BPromise(function(_0x5483d7,_0x17f835){if(_[_0xcaf2('0x1b')](_0x5815d4['dialTimezone'])){_0x5483d7({'ret':_0x1c2862});}else{_0x142631[_0xcaf2('0x2e')]['findOne']({'where':{'id':_0x3edd65['id']}})['then'](function(_0xdda88b){if(!_[_0xcaf2('0x1b')](_0xdda88b)){var _0x9fab19=_0xdda88b[_0xcaf2('0x1c')];if(!_[_0xcaf2('0x1b')](_0x9fab19)){var _0x3c88be=shared[_0xcaf2('0x1e')];var _0x65c742=_0x3c88be[_0x9fab19];var _0x3f082e=_0x3c88be[_0x5815d4[_0xcaf2('0x1c')]];if(!_['isNil'](_0x65c742)&&!_['isNil'](_0x3f082e)){var _0x272fcd=_0x65c742[_0xcaf2('0x2f')]-_0x3f082e[_0xcaf2('0x2f')];_0x1c2862=_0x5815d4['scheduledat']?_0x5815d4[_0xcaf2('0x18')]:moment();var _0x2494cb=moment(_0x1c2862)[_0xcaf2('0x1f')](_0x272fcd,_0xcaf2('0x30'));_0x5483d7({'ret':_0x2494cb[_0xcaf2('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5483d7({'ret':_0x1c2862});}else _0x5483d7({'ret':_0x1c2862});}else{_0x5483d7({'ret':_0x1c2862});}});}});return 0xa;}var _0x1a7e28=function(_0x4c98ce){return new BPromise(function(_0x35f175,_0x4e43b9){_0x595806(_0x4c98ce,_0x2d169f)['then'](function(_0x261103){_0x2d169f[_0xcaf2('0x18')]=_0x261103[_0xcaf2('0x25')];_0x142631[_0xcaf2('0x21')][_0xcaf2('0x1d')]({'where':{'phone':_0x2d169f[_0xcaf2('0xc')],'CampaignId':_0x4c98ce['id']}})[_0xcaf2('0x20')](function(_0x2d8870){if(!_[_0xcaf2('0x1b')](_0x2d8870)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2d169f[_0xcaf2('0xc')]+_0xcaf2('0x31')+_0x4c98ce['id']);}return _0x142631[_0xcaf2('0x21')]['create']({'phone':_0x2d169f[_0xcaf2('0xc')],'ContactId':_0x2d169f['id'],'ListId':_0x2d169f[_0xcaf2('0x2b')],'priority':_0x2d169f['priority']?_0x2d169f[_0xcaf2('0x22')]:0x2,'scheduledat':_0x2d169f['scheduledat']?_0x2d169f['scheduledat']:moment()[_0xcaf2('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2d169f[_0xcaf2('0x23')]?!![]:![],'callbackuniqueid':_0x2d169f[_0xcaf2('0x23')]?_0x2d169f[_0xcaf2('0x23')]:undefined,'callbackat':_0x2d169f[_0xcaf2('0x23')]?moment()[_0xcaf2('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4c98ce['id']});})['catch'](function(_0x259080){_0x4e43b9(_0x259080);});});});};var _0x45bed5=function(_0x2babd9){return new BPromise(function(_0x200746,_0x1d0053){_0x595806(_0x2babd9,_0x2d169f)[_0xcaf2('0x20')](function(_0x1c4656){_0x2d169f['scheduledat']=_0x1c4656['ret'];_0x142631[_0xcaf2('0x21')][_0xcaf2('0x1d')]({'where':{'phone':_0x2d169f['phone'],'CampaignId':_0x2babd9['id']}})[_0xcaf2('0x20')](function(_0x39b857){if(!_[_0xcaf2('0x1b')](_0x39b857)){throw new Error(_0xcaf2('0x26')+_0x2d169f[_0xcaf2('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x2babd9['id']);}return _0x142631[_0xcaf2('0x32')][_0xcaf2('0x1d')]({'where':{'calleridnum':_0x2d169f['phone'],'CampaignId':_0x2babd9['id']}});})[_0xcaf2('0x20')](function(_0x1e08c5){if(!_['isNil'](_0x1e08c5)){throw new Error(_0xcaf2('0x28')+_0x2d169f[_0xcaf2('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x2babd9['id']);}return _0x142631['CmHopper'][_0xcaf2('0x2a')]({'phone':_0x2d169f[_0xcaf2('0xc')],'ContactId':_0x2d169f['id'],'ListId':_0x2d169f['ListId'],'priority':_0x2d169f[_0xcaf2('0x22')]?_0x2d169f[_0xcaf2('0x22')]:0x2,'scheduledat':_0x2d169f[_0xcaf2('0x18')]?_0x2d169f[_0xcaf2('0x18')]:moment()[_0xcaf2('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2d169f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2d169f[_0xcaf2('0x23')]?_0x2d169f[_0xcaf2('0x23')]:undefined,'callbackat':_0x2d169f[_0xcaf2('0x23')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2babd9['id']});})[_0xcaf2('0x24')](function(_0x1ffab2){_0x1d0053(_0x1ffab2);});});});};if(_0x2d169f[_0xcaf2('0x2b')]){_0x142631[_0xcaf2('0x33')][_0xcaf2('0x34')]({'where':{'type':'outbound'},'attributes':['id',_0xcaf2('0x35'),_0xcaf2('0x1c')],'include':[{'model':_0x142631[_0xcaf2('0x36')],'as':_0xcaf2('0x37'),'where':{'id':_0x2d169f[_0xcaf2('0x2b')]}}]})['then'](function(_0x23cc64){if(_0x23cc64){var _0x3bb2e4=[];for(var _0x36085b=0x0,_0x37187f;_0x36085b<_0x23cc64[_0xcaf2('0x38')];_0x36085b+=0x1){_0x37187f=_0x23cc64[_0x36085b][_0xcaf2('0x15')]({'plain':!![]});switch(_0x37187f[_0xcaf2('0x35')]){case'always':_0x230560(_0x37187f)[_0xcaf2('0x24')](_0x386415());break;case _0xcaf2('0x39'):_0xaaa72f(_0x37187f)[_0xcaf2('0x24')](_0x386415());break;default:_0x595806(_0x37187f,_0x2d169f)['then'](function(_0x25d8a7){_0x2d169f[_0xcaf2('0x18')]=_0x25d8a7[_0xcaf2('0x25')];_0x142631[_0xcaf2('0x21')][_0xcaf2('0x2a')]({'phone':_0x2d169f[_0xcaf2('0xc')],'ContactId':_0x2d169f['id'],'ListId':_0x2d169f['ListId'],'scheduledat':_0x2d169f['scheduledat']?_0x2d169f[_0xcaf2('0x18')]:moment()[_0xcaf2('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2d169f[_0xcaf2('0x22')]?_0x2d169f[_0xcaf2('0x22')]:0x2,'callback':_0x2d169f[_0xcaf2('0x23')]?!![]:![],'callbackuniqueid':_0x2d169f[_0xcaf2('0x23')]?_0x2d169f[_0xcaf2('0x23')]:undefined,'callbackat':_0x2d169f[_0xcaf2('0x23')]?moment()[_0xcaf2('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x37187f['id']})[_0xcaf2('0x24')](_0x386415());});}}}})[_0xcaf2('0x20')](function(){return _0x142631[_0xcaf2('0x33')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x142631[_0xcaf2('0x36')],'as':_0xcaf2('0x3a'),'where':{'id':_0x2d169f[_0xcaf2('0x2b')]}}]})[_0xcaf2('0x20')](function(_0x6f003a){if(_0x6f003a){var _0x58df59=[];for(var _0x5b406b=0x0,_0x870ce7;_0x5b406b<_0x6f003a['length'];_0x5b406b+=0x1){_0x870ce7=_0x6f003a[_0x5b406b][_0xcaf2('0x15')]({'plain':!![]});_0x142631[_0xcaf2('0x3b')]['create']({'phone':_0x2d169f[_0xcaf2('0xc')],'ContactId':_0x2d169f['id'],'ListId':_0x2d169f['ListId'],'VoiceQueueId':_0x870ce7['id']})[_0xcaf2('0x24')](function(_0x205f6d){logger['error'](_0xcaf2('0x3c'),'afterCreate',_0x205f6d[_0xcaf2('0x3d')]);});}}});})[_0xcaf2('0x20')](function(){return _0x142631[_0xcaf2('0x2e')]['findAll']({'attributes':['id',_0xcaf2('0x35'),_0xcaf2('0x1c')],'include':[{'model':_0x142631[_0xcaf2('0x36')],'as':_0xcaf2('0x37'),'where':{'id':_0x2d169f[_0xcaf2('0x2b')]}}]})[_0xcaf2('0x20')](function(_0x3248fc){if(_0x3248fc){var _0x19d0d0=[];for(var _0x712e0e=0x0,_0x104c59;_0x712e0e<_0x3248fc[_0xcaf2('0x38')];_0x712e0e+=0x1){_0x104c59=_0x3248fc[_0x712e0e][_0xcaf2('0x15')]({'plain':!![]});switch(_0x104c59[_0xcaf2('0x35')]){case _0xcaf2('0x3e'):_0x45bed5(_0x104c59)[_0xcaf2('0x24')](_0x40c97f());break;case _0xcaf2('0x39'):_0x1a7e28(_0x104c59)[_0xcaf2('0x24')](_0x40c97f());break;default:_0x142631[_0xcaf2('0x21')][_0xcaf2('0x2a')]({'phone':_0x2d169f['phone'],'ContactId':_0x2d169f['id'],'ListId':_0x2d169f[_0xcaf2('0x2b')],'scheduledat':_0x2d169f[_0xcaf2('0x18')]?_0x2d169f['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2d169f['priority']?_0x2d169f['priority']:0x2,'callback':_0x2d169f[_0xcaf2('0x23')]?!![]:![],'callbackuniqueid':_0x2d169f[_0xcaf2('0x23')]?_0x2d169f['callbackUniqueid']:undefined,'callbackat':_0x2d169f[_0xcaf2('0x23')]?moment()[_0xcaf2('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x104c59['id']})['catch'](_0x40c97f());}}}});})[_0xcaf2('0x20')](function(){return _0x142631[_0xcaf2('0x2e')]['findAll']({'attributes':['id'],'include':[{'model':_0x142631[_0xcaf2('0x36')],'as':_0xcaf2('0x3a'),'where':{'id':_0x2d169f[_0xcaf2('0x2b')]}}]})[_0xcaf2('0x20')](function(_0x27331b){if(_0x27331b){var _0x37c0a5=[];for(var _0x411177=0x0,_0x358ad5;_0x411177<_0x27331b[_0xcaf2('0x38')];_0x411177+=0x1){_0x358ad5=_0x27331b[_0x411177][_0xcaf2('0x15')]({'plain':!![]});_0x142631['CmHopperBlack'][_0xcaf2('0x2a')]({'phone':_0x2d169f[_0xcaf2('0xc')],'ContactId':_0x2d169f['id'],'ListId':_0x2d169f[_0xcaf2('0x2b')],'CampaignId':_0x358ad5['id']})[_0xcaf2('0x24')](function(_0x1e928f){logger[_0xcaf2('0x2c')](_0xcaf2('0x3c'),_0xcaf2('0x16'),_0x1e928f[_0xcaf2('0x3d')]);});}}});})['then'](function(){_0x39f25e();})[_0xcaf2('0x24')](function(_0x1f26b6){logger[_0xcaf2('0x2c')](_0xcaf2('0x3c'),'afterCreate',_0x1f26b6['message']);_0x39f25e(_0x1f26b6);});}else{_0x39f25e(new Error(_0xcaf2('0x3f')));}},'afterDestroy':function(_0x48ab6b,_0x114d87,_0x5967f1){var _0x3bc16d=_0x337eb8[_0xcaf2('0x14')];var _0x5ad4a8=_0x48ab6b['get']({'plain':!![]});return _0x3bc16d[_0xcaf2('0x21')][_0xcaf2('0x34')]({'raw':!![],'where':{'ListId':_0x5ad4a8['ListId'],'ContactId':_0x5ad4a8['id']}})['then'](function(_0xfa5b16){if(!_['isEmpty'](_0xfa5b16)){var _0x401afd=[];for(var _0x4ecdb1=0x0;_0x4ecdb1<_0xfa5b16['length'];_0x4ecdb1+=0x1){var _0x529ab2=_0x3bc16d['CmHopper'][_0xcaf2('0x40')]({'where':{'ListId':_0xfa5b16[_0x4ecdb1][_0xcaf2('0x2b')],'ContactId':_0xfa5b16[_0x4ecdb1][_0xcaf2('0x41')],'VoiceQueueId':_0xfa5b16[_0x4ecdb1][_0xcaf2('0x42')],'CampaignId':_0xfa5b16[_0x4ecdb1]['CampaignId']}});_0x401afd[_0xcaf2('0x43')](_0x529ab2);}return BPromise['all'](_0x401afd);}})[_0xcaf2('0x20')](function(_0x357880){logger[_0xcaf2('0x44')](_0xcaf2('0x45'),util[_0xcaf2('0x17')](_0x357880,{'showHidden':![],'depth':null}));_0x5967f1();})[_0xcaf2('0x24')](function(_0x5cbf44){logger[_0xcaf2('0x2c')](_0xcaf2('0x46'),util[_0xcaf2('0x17')](_0x5cbf44,{'showHidden':![],'depth':null}));_0x5967f1(_0x5cbf44);});}}});}; \ No newline at end of file +var _0xffe4=['ContactId','VoiceQueueId','CampaignId','push','all','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','fti_cm_contacts','firstName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','format','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','create','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','length','findAll','CmList','BlackLists','cmContact,\x20%s,\x20%s','message','always','onlyIfOpen','CmHopperBlack','List\x20not\x20found','isEmpty'];(function(_0xdb628e,_0x103e9a){var _0x493aa5=function(_0x48357e){while(--_0x48357e){_0xdb628e['push'](_0xdb628e['shift']());}};_0x493aa5(++_0x103e9a);}(_0xffe4,0x91));var _0x4ffe=function(_0x1607d4,_0x227ee3){_0x1607d4=_0x1607d4-0x0;var _0x667fcd=_0xffe4[_0x1607d4];return _0x667fcd;};'use strict';var _=require(_0x4ffe('0x0'));var util=require(_0x4ffe('0x1'));var logger=require(_0x4ffe('0x2'))(_0x4ffe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4ffe('0x4'));var fs=require('fs');var path=require(_0x4ffe('0x5'));var rimraf=require('rimraf');var config=require(_0x4ffe('0x6'));var shared=require(_0x4ffe('0x7'));var attributes=require(_0x4ffe('0x8'));module[_0x4ffe('0x9')]=function(_0x46563e,_0x423209){return _0x46563e[_0x4ffe('0xa')](_0x4ffe('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0x4ffe('0xc')]},{'name':_0x4ffe('0xd'),'fields':[_0x4ffe('0xe'),'lastName',_0x4ffe('0xc'),_0x4ffe('0xf'),'fax',_0x4ffe('0x10')],'type':_0x4ffe('0x11')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x4ffe('0x12'),'hooks':{'afterCreate':function(_0x48a0f9,_0x8bb3d6,_0x4d1668){var _0x3ed3d7=_0x46563e[_0x4ffe('0x13')];var _0xe41d2d=_0x48a0f9[_0x4ffe('0x14')]({'plain':!![]});function _0x168e14(){return function(_0x1f944f){logger[_0x4ffe('0x15')](_0x4ffe('0x16'),_0x4ffe('0x17'),util['inspect'](_0x1f944f,{'showHidden':![],'depth':null}));};}function _0x3f1f0c(_0x2af1a6,_0x51ec5a){var _0x132671=_0x51ec5a[_0x4ffe('0x18')]?_0x51ec5a[_0x4ffe('0x18')]:moment()[_0x4ffe('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x1567c7,_0x2df407){if(_[_0x4ffe('0x1a')](_0x51ec5a['dialTimezone'])){_0x1567c7({'ret':_0x132671});}else{_0x3ed3d7[_0x4ffe('0x1b')][_0x4ffe('0x1c')]({'where':{'id':_0x2af1a6['id']}})[_0x4ffe('0x1d')](function(_0x22605f){if(!_['isNil'](_0x22605f)){var _0x2edf76=_0x22605f[_0x4ffe('0x1e')];if(!_[_0x4ffe('0x1a')](_0x2edf76)){var _0xf3d742=shared[_0x4ffe('0x1f')];var _0x1184b4=_0xf3d742[_0x2edf76];var _0xe340db=_0xf3d742[_0x51ec5a['dialTimezone']];if(!_[_0x4ffe('0x1a')](_0x1184b4)&&!_[_0x4ffe('0x1a')](_0xe340db)){var _0x316fe0=_0x1184b4[_0x4ffe('0x20')]-_0xe340db[_0x4ffe('0x20')];_0x132671=_0x51ec5a[_0x4ffe('0x18')]?_0x51ec5a[_0x4ffe('0x18')]:moment();var _0x1b2f68=moment(_0x132671)['add'](_0x316fe0,_0x4ffe('0x21'));_0x1567c7({'ret':_0x1b2f68[_0x4ffe('0x19')](_0x4ffe('0x22'))});}else _0x1567c7({'ret':_0x132671});}else _0x1567c7({'ret':_0x132671});}else{_0x1567c7({'ret':_0x132671});}});}});return 0xa;}var _0x5345c2=function(_0x5c5071){return new BPromise(function(_0x5928e2,_0x58fbb9){_0x3f1f0c(_0x5c5071,_0xe41d2d)['then'](function(_0x3721b5){_0xe41d2d[_0x4ffe('0x18')]=_0x3721b5[_0x4ffe('0x23')];_0x3ed3d7[_0x4ffe('0x24')][_0x4ffe('0x1c')]({'where':{'phone':_0xe41d2d[_0x4ffe('0xc')],'VoiceQueueId':_0x5c5071['id']}})[_0x4ffe('0x1d')](function(_0x4a0add){if(!_[_0x4ffe('0x1a')](_0x4a0add)){throw new Error('cmContact,\x20afterCreate\x20'+_0xe41d2d['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5c5071['id']);}return _0x3ed3d7[_0x4ffe('0x24')][_0x4ffe('0x25')]({'phone':_0xe41d2d[_0x4ffe('0xc')],'ContactId':_0xe41d2d['id'],'ListId':_0xe41d2d[_0x4ffe('0x26')],'priority':_0xe41d2d['priority']?_0xe41d2d[_0x4ffe('0x27')]:0x2,'scheduledat':_0xe41d2d[_0x4ffe('0x18')]?_0xe41d2d[_0x4ffe('0x18')]:moment()[_0x4ffe('0x19')](_0x4ffe('0x22')),'callback':_0xe41d2d[_0x4ffe('0x28')]?!![]:![],'callbackuniqueid':_0xe41d2d[_0x4ffe('0x28')]?_0xe41d2d[_0x4ffe('0x28')]:undefined,'callbackat':_0xe41d2d[_0x4ffe('0x28')]?moment()[_0x4ffe('0x19')](_0x4ffe('0x22')):undefined,'VoiceQueueId':_0x5c5071['id']});})[_0x4ffe('0x29')](function(_0x210c3c){_0x58fbb9(_0x210c3c);});});});};var _0x4ca592=function(_0xeab2ca){return new BPromise(function(_0x529dd7,_0x59a0be){_0x3f1f0c(_0xeab2ca,_0xe41d2d)[_0x4ffe('0x1d')](function(_0x2863af){_0xe41d2d[_0x4ffe('0x18')]=_0x2863af['ret'];_0x3ed3d7[_0x4ffe('0x24')][_0x4ffe('0x1c')]({'where':{'phone':_0xe41d2d[_0x4ffe('0xc')],'VoiceQueueId':_0xeab2ca['id']}})['then'](function(_0x55f7bd){if(!_[_0x4ffe('0x1a')](_0x55f7bd)){throw new Error(_0x4ffe('0x2a')+_0xe41d2d[_0x4ffe('0xc')]+_0x4ffe('0x2b')+_0xeab2ca['id']);}return _0x3ed3d7['CmHopperFinal'][_0x4ffe('0x1c')]({'where':{'calleridnum':_0xe41d2d[_0x4ffe('0xc')],'VoiceQueueId':_0xeab2ca['id']}});})[_0x4ffe('0x1d')](function(_0x45802b){if(!_['isNil'](_0x45802b)){throw new Error(_0x4ffe('0x2c')+_0xe41d2d[_0x4ffe('0xc')]+_0x4ffe('0x2d')+_0xeab2ca['id']);}return _0x3ed3d7[_0x4ffe('0x24')]['create']({'phone':_0xe41d2d[_0x4ffe('0xc')],'ContactId':_0xe41d2d['id'],'ListId':_0xe41d2d[_0x4ffe('0x26')],'priority':_0xe41d2d[_0x4ffe('0x27')]?_0xe41d2d[_0x4ffe('0x27')]:0x2,'scheduledat':_0xe41d2d[_0x4ffe('0x18')]?_0xe41d2d['scheduledat']:moment()[_0x4ffe('0x19')](_0x4ffe('0x22')),'callback':_0xe41d2d[_0x4ffe('0x28')]?!![]:![],'callbackuniqueid':_0xe41d2d[_0x4ffe('0x28')]?_0xe41d2d['callbackUniqueid']:undefined,'callbackat':_0xe41d2d[_0x4ffe('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xeab2ca['id']});})[_0x4ffe('0x29')](function(_0x7fbfd7){_0x59a0be(_0x7fbfd7);});});});};function _0x1e77af(){return function(_0x241915){logger[_0x4ffe('0x15')](_0x4ffe('0x16'),_0x4ffe('0x17'),util[_0x4ffe('0x2e')](_0x241915,{'showHidden':![],'depth':null}));};}function _0x5b07ba(_0x330813,_0x297b4a){var _0x5eb2b4=_0x297b4a['scheduledat']?_0x297b4a[_0x4ffe('0x18')]:moment()[_0x4ffe('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x459a88,_0x102b49){if(_[_0x4ffe('0x1a')](_0x297b4a[_0x4ffe('0x1e')])){_0x459a88({'ret':_0x5eb2b4});}else{_0x3ed3d7[_0x4ffe('0x2f')][_0x4ffe('0x1c')]({'where':{'id':_0x330813['id']}})[_0x4ffe('0x1d')](function(_0xffccc2){if(!_[_0x4ffe('0x1a')](_0xffccc2)){var _0x2b1ba0=_0xffccc2[_0x4ffe('0x1e')];if(!_[_0x4ffe('0x1a')](_0x2b1ba0)){var _0x281344=shared['timezones'];var _0x56462f=_0x281344[_0x2b1ba0];var _0x497cc7=_0x281344[_0x297b4a['dialTimezone']];if(!_[_0x4ffe('0x1a')](_0x56462f)&&!_[_0x4ffe('0x1a')](_0x497cc7)){var _0x4bf542=_0x56462f[_0x4ffe('0x20')]-_0x497cc7[_0x4ffe('0x20')];_0x5eb2b4=_0x297b4a[_0x4ffe('0x18')]?_0x297b4a[_0x4ffe('0x18')]:moment();var _0x322b0c=moment(_0x5eb2b4)['add'](_0x4bf542,_0x4ffe('0x21'));_0x459a88({'ret':_0x322b0c[_0x4ffe('0x19')](_0x4ffe('0x22'))});}else _0x459a88({'ret':_0x5eb2b4});}else _0x459a88({'ret':_0x5eb2b4});}else{_0x459a88({'ret':_0x5eb2b4});}});}});return 0xa;}var _0x1f152c=function(_0x23b861){return new BPromise(function(_0xb420de,_0x476ce0){_0x5b07ba(_0x23b861,_0xe41d2d)[_0x4ffe('0x1d')](function(_0x5e3629){_0xe41d2d[_0x4ffe('0x18')]=_0x5e3629[_0x4ffe('0x23')];_0x3ed3d7[_0x4ffe('0x24')][_0x4ffe('0x1c')]({'where':{'phone':_0xe41d2d[_0x4ffe('0xc')],'CampaignId':_0x23b861['id']}})[_0x4ffe('0x1d')](function(_0xa84a3){if(!_[_0x4ffe('0x1a')](_0xa84a3)){throw new Error('cmContact,\x20afterCreate\x20'+_0xe41d2d[_0x4ffe('0xc')]+_0x4ffe('0x30')+_0x23b861['id']);}return _0x3ed3d7[_0x4ffe('0x24')][_0x4ffe('0x25')]({'phone':_0xe41d2d[_0x4ffe('0xc')],'ContactId':_0xe41d2d['id'],'ListId':_0xe41d2d[_0x4ffe('0x26')],'priority':_0xe41d2d[_0x4ffe('0x27')]?_0xe41d2d[_0x4ffe('0x27')]:0x2,'scheduledat':_0xe41d2d[_0x4ffe('0x18')]?_0xe41d2d[_0x4ffe('0x18')]:moment()[_0x4ffe('0x19')](_0x4ffe('0x22')),'callback':_0xe41d2d[_0x4ffe('0x28')]?!![]:![],'callbackuniqueid':_0xe41d2d[_0x4ffe('0x28')]?_0xe41d2d['callbackUniqueid']:undefined,'callbackat':_0xe41d2d[_0x4ffe('0x28')]?moment()['format'](_0x4ffe('0x22')):undefined,'CampaignId':_0x23b861['id']});})[_0x4ffe('0x29')](function(_0x647dee){_0x476ce0(_0x647dee);});});});};var _0x40f799=function(_0x12c874){return new BPromise(function(_0x30b00a,_0x14ec2b){_0x5b07ba(_0x12c874,_0xe41d2d)[_0x4ffe('0x1d')](function(_0x4acb6a){_0xe41d2d[_0x4ffe('0x18')]=_0x4acb6a[_0x4ffe('0x23')];_0x3ed3d7['CmHopper']['findOne']({'where':{'phone':_0xe41d2d[_0x4ffe('0xc')],'CampaignId':_0x12c874['id']}})[_0x4ffe('0x1d')](function(_0x556019){if(!_[_0x4ffe('0x1a')](_0x556019)){throw new Error(_0x4ffe('0x2a')+_0xe41d2d[_0x4ffe('0xc')]+_0x4ffe('0x31')+_0x12c874['id']);}return _0x3ed3d7[_0x4ffe('0x32')][_0x4ffe('0x1c')]({'where':{'calleridnum':_0xe41d2d[_0x4ffe('0xc')],'CampaignId':_0x12c874['id']}});})[_0x4ffe('0x1d')](function(_0x5115b3){if(!_[_0x4ffe('0x1a')](_0x5115b3)){throw new Error(_0x4ffe('0x2c')+_0xe41d2d['phone']+_0x4ffe('0x33')+_0x12c874['id']);}return _0x3ed3d7[_0x4ffe('0x24')][_0x4ffe('0x25')]({'phone':_0xe41d2d[_0x4ffe('0xc')],'ContactId':_0xe41d2d['id'],'ListId':_0xe41d2d[_0x4ffe('0x26')],'priority':_0xe41d2d[_0x4ffe('0x27')]?_0xe41d2d[_0x4ffe('0x27')]:0x2,'scheduledat':_0xe41d2d[_0x4ffe('0x18')]?_0xe41d2d[_0x4ffe('0x18')]:moment()[_0x4ffe('0x19')](_0x4ffe('0x22')),'callback':_0xe41d2d[_0x4ffe('0x28')]?!![]:![],'callbackuniqueid':_0xe41d2d[_0x4ffe('0x28')]?_0xe41d2d[_0x4ffe('0x28')]:undefined,'callbackat':_0xe41d2d[_0x4ffe('0x28')]?moment()[_0x4ffe('0x19')](_0x4ffe('0x22')):undefined,'CampaignId':_0x12c874['id']});})['catch'](function(_0x566879){_0x14ec2b(_0x566879);});});});};if(_0xe41d2d[_0x4ffe('0x26')]){_0x3ed3d7[_0x4ffe('0x1b')]['findAll']({'where':{'type':_0x4ffe('0x34')},'attributes':['id',_0x4ffe('0x35'),_0x4ffe('0x1e')],'include':[{'model':_0x3ed3d7['CmList'],'as':'Lists','where':{'id':_0xe41d2d['ListId']}}]})['then'](function(_0x398acf){if(_0x398acf){var _0x18fec0=[];for(var _0x5dd42f=0x0,_0x7d631d;_0x5dd42f<_0x398acf[_0x4ffe('0x36')];_0x5dd42f+=0x1){_0x7d631d=_0x398acf[_0x5dd42f]['get']({'plain':!![]});switch(_0x7d631d[_0x4ffe('0x35')]){case'always':_0x4ca592(_0x7d631d)['catch'](_0x168e14());break;case'onlyIfOpen':_0x5345c2(_0x7d631d)[_0x4ffe('0x29')](_0x168e14());break;default:_0x5b07ba(_0x7d631d,_0xe41d2d)[_0x4ffe('0x1d')](function(_0xbf9801){_0xe41d2d['scheduledat']=_0xbf9801[_0x4ffe('0x23')];_0x3ed3d7['CmHopper']['create']({'phone':_0xe41d2d[_0x4ffe('0xc')],'ContactId':_0xe41d2d['id'],'ListId':_0xe41d2d[_0x4ffe('0x26')],'scheduledat':_0xe41d2d[_0x4ffe('0x18')]?_0xe41d2d[_0x4ffe('0x18')]:moment()['format'](_0x4ffe('0x22')),'priority':_0xe41d2d[_0x4ffe('0x27')]?_0xe41d2d[_0x4ffe('0x27')]:0x2,'callback':_0xe41d2d[_0x4ffe('0x28')]?!![]:![],'callbackuniqueid':_0xe41d2d[_0x4ffe('0x28')]?_0xe41d2d[_0x4ffe('0x28')]:undefined,'callbackat':_0xe41d2d[_0x4ffe('0x28')]?moment()['format'](_0x4ffe('0x22')):undefined,'VoiceQueueId':_0x7d631d['id']})[_0x4ffe('0x29')](_0x168e14());});}}}})['then'](function(){return _0x3ed3d7['VoiceQueue'][_0x4ffe('0x37')]({'where':{'type':_0x4ffe('0x34')},'attributes':['id'],'include':[{'model':_0x3ed3d7[_0x4ffe('0x38')],'as':_0x4ffe('0x39'),'where':{'id':_0xe41d2d[_0x4ffe('0x26')]}}]})[_0x4ffe('0x1d')](function(_0x1b11dd){if(_0x1b11dd){var _0x2f3aac=[];for(var _0x2b0e0b=0x0,_0x321454;_0x2b0e0b<_0x1b11dd[_0x4ffe('0x36')];_0x2b0e0b+=0x1){_0x321454=_0x1b11dd[_0x2b0e0b]['get']({'plain':!![]});_0x3ed3d7['CmHopperBlack'][_0x4ffe('0x25')]({'phone':_0xe41d2d[_0x4ffe('0xc')],'ContactId':_0xe41d2d['id'],'ListId':_0xe41d2d[_0x4ffe('0x26')],'VoiceQueueId':_0x321454['id']})['catch'](function(_0x1d78fa){logger[_0x4ffe('0x15')](_0x4ffe('0x3a'),_0x4ffe('0x17'),_0x1d78fa[_0x4ffe('0x3b')]);});}}});})[_0x4ffe('0x1d')](function(){return _0x3ed3d7[_0x4ffe('0x2f')][_0x4ffe('0x37')]({'attributes':['id','dialCheckDuplicateType',_0x4ffe('0x1e')],'include':[{'model':_0x3ed3d7[_0x4ffe('0x38')],'as':'Lists','where':{'id':_0xe41d2d['ListId']}}]})[_0x4ffe('0x1d')](function(_0x595bc0){if(_0x595bc0){var _0x542c9c=[];for(var _0x1e2c4c=0x0,_0x104e9f;_0x1e2c4c<_0x595bc0[_0x4ffe('0x36')];_0x1e2c4c+=0x1){_0x104e9f=_0x595bc0[_0x1e2c4c][_0x4ffe('0x14')]({'plain':!![]});switch(_0x104e9f['dialCheckDuplicateType']){case _0x4ffe('0x3c'):_0x40f799(_0x104e9f)[_0x4ffe('0x29')](_0x1e77af());break;case _0x4ffe('0x3d'):_0x1f152c(_0x104e9f)[_0x4ffe('0x29')](_0x1e77af());break;default:_0x3ed3d7[_0x4ffe('0x24')][_0x4ffe('0x25')]({'phone':_0xe41d2d[_0x4ffe('0xc')],'ContactId':_0xe41d2d['id'],'ListId':_0xe41d2d['ListId'],'scheduledat':_0xe41d2d[_0x4ffe('0x18')]?_0xe41d2d[_0x4ffe('0x18')]:moment()[_0x4ffe('0x19')](_0x4ffe('0x22')),'priority':_0xe41d2d[_0x4ffe('0x27')]?_0xe41d2d[_0x4ffe('0x27')]:0x2,'callback':_0xe41d2d[_0x4ffe('0x28')]?!![]:![],'callbackuniqueid':_0xe41d2d['callbackUniqueid']?_0xe41d2d['callbackUniqueid']:undefined,'callbackat':_0xe41d2d['callbackUniqueid']?moment()[_0x4ffe('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x104e9f['id']})['catch'](_0x1e77af());}}}});})['then'](function(){return _0x3ed3d7[_0x4ffe('0x2f')][_0x4ffe('0x37')]({'attributes':['id'],'include':[{'model':_0x3ed3d7[_0x4ffe('0x38')],'as':_0x4ffe('0x39'),'where':{'id':_0xe41d2d['ListId']}}]})[_0x4ffe('0x1d')](function(_0x955b28){if(_0x955b28){var _0x4acb1f=[];for(var _0x2b7efa=0x0,_0x46cb19;_0x2b7efa<_0x955b28[_0x4ffe('0x36')];_0x2b7efa+=0x1){_0x46cb19=_0x955b28[_0x2b7efa][_0x4ffe('0x14')]({'plain':!![]});_0x3ed3d7[_0x4ffe('0x3e')][_0x4ffe('0x25')]({'phone':_0xe41d2d[_0x4ffe('0xc')],'ContactId':_0xe41d2d['id'],'ListId':_0xe41d2d[_0x4ffe('0x26')],'CampaignId':_0x46cb19['id']})[_0x4ffe('0x29')](function(_0x4d30ff){logger['error'](_0x4ffe('0x3a'),_0x4ffe('0x17'),_0x4d30ff[_0x4ffe('0x3b')]);});}}});})['then'](function(){_0x4d1668();})['catch'](function(_0xf4a9b0){logger[_0x4ffe('0x15')](_0x4ffe('0x3a'),_0x4ffe('0x17'),_0xf4a9b0['message']);_0x4d1668(_0xf4a9b0);});}else{_0x4d1668(new Error(_0x4ffe('0x3f')));}},'afterDestroy':function(_0x5c30ae,_0x43213d,_0x3d3366){var _0x28ada5=_0x46563e[_0x4ffe('0x13')];var _0x4fdaa2=_0x5c30ae[_0x4ffe('0x14')]({'plain':!![]});return _0x28ada5[_0x4ffe('0x24')][_0x4ffe('0x37')]({'raw':!![],'where':{'ListId':_0x4fdaa2[_0x4ffe('0x26')],'ContactId':_0x4fdaa2['id']}})[_0x4ffe('0x1d')](function(_0x3d80d4){if(!_[_0x4ffe('0x40')](_0x3d80d4)){var _0xef3a20=[];for(var _0x5d7cf2=0x0;_0x5d7cf2<_0x3d80d4[_0x4ffe('0x36')];_0x5d7cf2+=0x1){var _0x368eeb=_0x28ada5[_0x4ffe('0x24')]['destroy']({'where':{'ListId':_0x3d80d4[_0x5d7cf2]['ListId'],'ContactId':_0x3d80d4[_0x5d7cf2][_0x4ffe('0x41')],'VoiceQueueId':_0x3d80d4[_0x5d7cf2][_0x4ffe('0x42')],'CampaignId':_0x3d80d4[_0x5d7cf2][_0x4ffe('0x43')]}});_0xef3a20[_0x4ffe('0x44')](_0x368eeb);}return BPromise[_0x4ffe('0x45')](_0xef3a20);}})['then'](function(_0x3ab015){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x4ffe('0x2e')](_0x3ab015,{'showHidden':![],'depth':null}));_0x3d3366();})[_0x4ffe('0x29')](function(_0x3cf1c3){logger[_0x4ffe('0x15')]('[CmContact][afterDestroy][Error]',util[_0x4ffe('0x2e')](_0x3cf1c3,{'showHidden':![],'depth':null}));_0x3d3366(_0x3cf1c3);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 2da3f45..a9265ab 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x44d9e1,_0x2dc72f){var _0x2360a8=function(_0x4701e2){while(--_0x4701e2){_0x44d9e1['push'](_0x44d9e1['shift']());}};_0x2360a8(++_0x2dc72f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 96cfde1..50940c6 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa2f=['PHONE','INTEGER','STRING'];(function(_0xddf8ee,_0x496e49){var _0x193358=function(_0x4eb573){while(--_0x4eb573){_0xddf8ee['push'](_0xddf8ee['shift']());}};_0x193358(++_0x496e49);}(_0xfa2f,0xe8));var _0xffa2=function(_0x325872,_0xdd4c33){_0x325872=_0x325872-0x0;var _0x30b082=_0xfa2f[_0x325872];return _0x30b082;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0xffa2('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xffa2('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xffa2('0x1')],'defaultValue':_0xffa2('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xffa2('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xbb53=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x4a0188,_0x4735a6){var _0x2d6c03=function(_0x558c6f){while(--_0x558c6f){_0x4a0188['push'](_0x4a0188['shift']());}};_0x2d6c03(++_0x4735a6);}(_0xbb53,0x121));var _0x3bb5=function(_0x996322,_0x2ab84e){_0x996322=_0x996322-0x0;var _0x16c488=_0xbb53[_0x996322];return _0x16c488;};'use strict';var Sequelize=require(_0x3bb5('0x0'));module[_0x3bb5('0x1')]={'CmContactId':{'type':Sequelize[_0x3bb5('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3bb5('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3bb5('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3bb5('0x3')],'defaultValue':_0x3bb5('0x4')},'OrderBy':{'type':Sequelize[_0x3bb5('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x3bb5('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 9938004..3b39115 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15c6=['keys','intersection','attributes','fields','sort','where','pick','filters','VIRTUAL','merge','includeAll','include','rows','params','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','CmContactHasItem','fieldName','model','query'];(function(_0x42f1aa,_0x5886a4){var _0x4720f9=function(_0xc547f3){while(--_0xc547f3){_0x42f1aa['push'](_0x42f1aa['shift']());}};_0x4720f9(++_0x5886a4);}(_0x15c6,0xb9));var _0x615c=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x15c6[_0x648163];return _0x199d4d;};'use strict';var emlformat=require(_0x615c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x615c('0x1'));var jsonpatch=require(_0x615c('0x2'));var rp=require(_0x615c('0x3'));var moment=require(_0x615c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x615c('0x5'));var util=require(_0x615c('0x6'));var path=require(_0x615c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x615c('0x8'));var fs=require('fs');var fs_extra=require(_0x615c('0x9'));var _=require(_0x615c('0xa'));var squel=require(_0x615c('0xb'));var crypto=require(_0x615c('0xc'));var jsforce=require(_0x615c('0xd'));var deskjs=require(_0x615c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x615c('0xf'));var Redis=require('ioredis');var authService=require(_0x615c('0x10'));var qs=require(_0x615c('0x11'));var as=require(_0x615c('0x12'));var hardwareService=require(_0x615c('0x13'));var logger=require(_0x615c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x615c('0x15'));var licenseUtil=require(_0x615c('0x16'));var db=require(_0x615c('0x17'))['db'];function respondWithStatusCode(_0x597f6b,_0x8283de){_0x8283de=_0x8283de||0xcc;return function(_0x20358a){if(_0x20358a){return _0x597f6b[_0x615c('0x18')](_0x8283de);}return _0x597f6b[_0x615c('0x19')](_0x8283de)[_0x615c('0x1a')]();};}function respondWithResult(_0x57eb1d,_0x54cb88){_0x54cb88=_0x54cb88||0xc8;return function(_0x4cc7cc){if(_0x4cc7cc){return _0x57eb1d['status'](_0x54cb88)['json'](_0x4cc7cc);}};}function respondWithFilteredResult(_0x324467,_0x5c5db4){return function(_0x2b677f){if(_0x2b677f){var _0x23a751=typeof _0x5c5db4['offset']===_0x615c('0x1b')&&typeof _0x5c5db4[_0x615c('0x1c')]===_0x615c('0x1b');var _0x4d606e=_0x2b677f[_0x615c('0x1d')];var _0x2e65d1=_0x23a751?0x0:_0x5c5db4[_0x615c('0x1e')];var _0x2984ab=_0x23a751?_0x2b677f[_0x615c('0x1d')]:_0x5c5db4[_0x615c('0x1e')]+_0x5c5db4['limit'];var _0x2f790e;if(_0x2984ab>=_0x4d606e){_0x2984ab=_0x4d606e;_0x2f790e=0xc8;}else{_0x2f790e=0xce;}_0x324467[_0x615c('0x19')](_0x2f790e);return _0x324467[_0x615c('0x1f')]('Content-Range',_0x2e65d1+'-'+_0x2984ab+'/'+_0x4d606e)[_0x615c('0x20')](_0x2b677f);}return null;};}function patchUpdates(_0xb25663){return function(_0x3b8e1f){try{jsonpatch[_0x615c('0x21')](_0x3b8e1f,_0xb25663,!![]);}catch(_0x741389){return BPromise[_0x615c('0x22')](_0x741389);}return _0x3b8e1f[_0x615c('0x23')]();};}function saveUpdates(_0x340fba,_0x7006eb){return function(_0x121a5d){if(_0x121a5d){return _0x121a5d[_0x615c('0x24')](_0x340fba)[_0x615c('0x25')](function(_0x5d3489){return _0x5d3489;});}return null;};}function removeEntity(_0x14de7d,_0x30797a){return function(_0x199552){if(_0x199552){return _0x199552[_0x615c('0x26')]()[_0x615c('0x25')](function(){var _0x12c033=_0x199552[_0x615c('0x27')]({'plain':!![]});var _0x2bfd70='CmContactHasItems';return db['UserProfileResource']['destroy']({'where':{'type':_0x2bfd70,'resourceId':_0x12c033['id']}})['then'](function(){return _0x199552;});})[_0x615c('0x25')](function(){_0x14de7d[_0x615c('0x19')](0xcc)[_0x615c('0x1a')]();});}};}function handleEntityNotFound(_0x5a77d3,_0x299c47){return function(_0x2755ee){if(!_0x2755ee){_0x5a77d3[_0x615c('0x18')](0x194);}return _0x2755ee;};}function handleError(_0x31232f,_0x702658){_0x702658=_0x702658||0x1f4;return function(_0x87cedb){logger['error'](_0x87cedb[_0x615c('0x28')]);if(_0x87cedb[_0x615c('0x29')]){delete _0x87cedb[_0x615c('0x29')];}_0x31232f[_0x615c('0x19')](_0x702658)[_0x615c('0x2a')](_0x87cedb);};}exports[_0x615c('0x2b')]=function(_0x4e56f8,_0xa38f6d){var _0x4d5ba3={},_0x4125eb={},_0x52b60d={'count':0x0,'rows':[]};var _0x37dd91=_[_0x615c('0x2c')](db[_0x615c('0x2d')]['rawAttributes'],function(_0x74fbee){return{'name':_0x74fbee[_0x615c('0x2e')],'type':_0x74fbee['type']['key']};});_0x4125eb[_0x615c('0x2f')]=_[_0x615c('0x2c')](_0x37dd91,_0x615c('0x29'));_0x4125eb[_0x615c('0x30')]=_[_0x615c('0x31')](_0x4e56f8[_0x615c('0x30')]);_0x4125eb['filters']=_[_0x615c('0x32')](_0x4125eb[_0x615c('0x2f')],_0x4125eb[_0x615c('0x30')]);_0x4d5ba3[_0x615c('0x33')]=_[_0x615c('0x32')](_0x4125eb[_0x615c('0x2f')],qs[_0x615c('0x34')](_0x4e56f8[_0x615c('0x30')]['fields']));_0x4d5ba3[_0x615c('0x33')]=_0x4d5ba3[_0x615c('0x33')]['length']?_0x4d5ba3[_0x615c('0x33')]:_0x4125eb[_0x615c('0x2f')];if(!_0x4e56f8[_0x615c('0x30')]['hasOwnProperty']('nolimit')){_0x4d5ba3[_0x615c('0x1c')]=qs[_0x615c('0x1c')](_0x4e56f8[_0x615c('0x30')][_0x615c('0x1c')]);_0x4d5ba3[_0x615c('0x1e')]=qs[_0x615c('0x1e')](_0x4e56f8['query'][_0x615c('0x1e')]);}_0x4d5ba3['order']=qs['sort'](_0x4e56f8[_0x615c('0x30')][_0x615c('0x35')]);_0x4d5ba3[_0x615c('0x36')]=qs['filters'](_[_0x615c('0x37')](_0x4e56f8[_0x615c('0x30')],_0x4125eb[_0x615c('0x38')]),_0x37dd91);if(_0x4e56f8['query']['filter']){_0x4d5ba3[_0x615c('0x36')]=_['merge'](_0x4d5ba3[_0x615c('0x36')],{'$or':_[_0x615c('0x2c')](_0x37dd91,function(_0x5d594c){if(_0x5d594c['type']!==_0x615c('0x39')){var _0x59dd35={};_0x59dd35[_0x5d594c[_0x615c('0x29')]]={'$like':'%'+_0x4e56f8[_0x615c('0x30')]['filter']+'%'};return _0x59dd35;}})});}_0x4d5ba3=_[_0x615c('0x3a')]({},_0x4d5ba3,_0x4e56f8['options']);var _0x1fc859={'where':_0x4d5ba3['where']};return db[_0x615c('0x2d')][_0x615c('0x1d')](_0x1fc859)[_0x615c('0x25')](function(_0x3f49e3){_0x52b60d['count']=_0x3f49e3;if(_0x4e56f8[_0x615c('0x30')][_0x615c('0x3b')]){_0x4d5ba3[_0x615c('0x3c')]=[{'all':!![]}];}return db[_0x615c('0x2d')]['findAll'](_0x4d5ba3);})[_0x615c('0x25')](function(_0x27d889){_0x52b60d[_0x615c('0x3d')]=_0x27d889;return _0x52b60d;})[_0x615c('0x25')](respondWithFilteredResult(_0xa38f6d,_0x4d5ba3))['catch'](handleError(_0xa38f6d,null));};exports['show']=function(_0x44e751,_0x34ac91){var _0x15c7e7={'raw':!![],'where':{'id':_0x44e751[_0x615c('0x3e')]['id']}},_0x5df6c1={};_0x5df6c1['model']=_[_0x615c('0x31')](db[_0x615c('0x2d')][_0x615c('0x3f')]);_0x5df6c1[_0x615c('0x30')]=_[_0x615c('0x31')](_0x44e751[_0x615c('0x30')]);_0x5df6c1[_0x615c('0x38')]=_[_0x615c('0x32')](_0x5df6c1['model'],_0x5df6c1[_0x615c('0x30')]);_0x15c7e7['attributes']=_[_0x615c('0x32')](_0x5df6c1[_0x615c('0x2f')],qs[_0x615c('0x34')](_0x44e751['query'][_0x615c('0x34')]));_0x15c7e7[_0x615c('0x33')]=_0x15c7e7[_0x615c('0x33')][_0x615c('0x40')]?_0x15c7e7[_0x615c('0x33')]:_0x5df6c1['model'];if(_0x44e751['query']['includeAll']){_0x15c7e7[_0x615c('0x3c')]=[{'all':!![]}];}_0x15c7e7=_[_0x615c('0x3a')]({},_0x15c7e7,_0x44e751['options']);return db[_0x615c('0x2d')][_0x615c('0x41')](_0x15c7e7)[_0x615c('0x25')](handleEntityNotFound(_0x34ac91,null))[_0x615c('0x25')](respondWithResult(_0x34ac91,null))['catch'](handleError(_0x34ac91,null));};exports[_0x615c('0x42')]=function(_0x106455,_0x2f5603){return db[_0x615c('0x2d')]['create'](_0x106455['body'],{})['then'](function(_0x144452){var _0x53ff73=_0x106455[_0x615c('0x43')][_0x615c('0x27')]({'plain':!![]});if(!_0x53ff73)throw new Error(_0x615c('0x44'));if(_0x53ff73['role']===_0x615c('0x43')){var _0x420b20=_0x144452[_0x615c('0x27')]({'plain':!![]});var _0x1bd5fb=_0x615c('0x45');return db[_0x615c('0x46')][_0x615c('0x41')]({'where':{'name':_0x1bd5fb,'userProfileId':_0x53ff73[_0x615c('0x47')]},'raw':!![]})[_0x615c('0x25')](function(_0x1066fc){if(_0x1066fc&&_0x1066fc[_0x615c('0x48')]===0x0){return db[_0x615c('0x49')][_0x615c('0x42')]({'name':_0x420b20[_0x615c('0x29')],'resourceId':_0x420b20['id'],'type':_0x1066fc[_0x615c('0x29')],'sectionId':_0x1066fc['id']},{})[_0x615c('0x25')](function(){return _0x144452;});}else{return _0x144452;}})[_0x615c('0x4a')](function(_0x176253){logger[_0x615c('0x4b')](_0x615c('0x4c'),_0x176253);throw _0x176253;});}return _0x144452;})[_0x615c('0x25')](respondWithResult(_0x2f5603,0xc9))[_0x615c('0x4a')](handleError(_0x2f5603,null));};exports[_0x615c('0x24')]=function(_0x1a531d,_0x5835b4){if(_0x1a531d['body']['id']){delete _0x1a531d[_0x615c('0x4d')]['id'];}return db[_0x615c('0x2d')][_0x615c('0x41')]({'where':{'id':_0x1a531d[_0x615c('0x3e')]['id']}})[_0x615c('0x25')](handleEntityNotFound(_0x5835b4,null))[_0x615c('0x25')](saveUpdates(_0x1a531d['body'],null))[_0x615c('0x25')](respondWithResult(_0x5835b4,null))[_0x615c('0x4a')](handleError(_0x5835b4,null));};exports['destroy']=function(_0x2630b8,_0x3cd8b3){return db[_0x615c('0x2d')][_0x615c('0x41')]({'where':{'id':_0x2630b8['params']['id']}})[_0x615c('0x25')](handleEntityNotFound(_0x3cd8b3,null))['then'](removeEntity(_0x3cd8b3,null))[_0x615c('0x4a')](handleError(_0x3cd8b3,null));}; \ No newline at end of file +var _0x38ed=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','error','stack','name','send','map','CmContactHasItem','type','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','intersection','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json'];(function(_0x5b2910,_0x19f8d6){var _0x14d5f2=function(_0x2f33f3){while(--_0x2f33f3){_0x5b2910['push'](_0x5b2910['shift']());}};_0x14d5f2(++_0x19f8d6);}(_0x38ed,0x1e8));var _0xd38e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x38ed[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xd38e('0x0'));var rimraf=require(_0xd38e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd38e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd38e('0x3'));var Mustache=require(_0xd38e('0x4'));var util=require(_0xd38e('0x5'));var path=require(_0xd38e('0x6'));var sox=require(_0xd38e('0x7'));var csv=require(_0xd38e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd38e('0x9'));var _=require(_0xd38e('0xa'));var squel=require(_0xd38e('0xb'));var crypto=require(_0xd38e('0xc'));var jsforce=require(_0xd38e('0xd'));var deskjs=require(_0xd38e('0xe'));var toCsv=require(_0xd38e('0x8'));var querystring=require(_0xd38e('0xf'));var Papa=require(_0xd38e('0x10'));var Redis=require('ioredis');var authService=require(_0xd38e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd38e('0x12'));var hardwareService=require(_0xd38e('0x13'));var logger=require('../../config/logger')(_0xd38e('0x14'));var utils=require(_0xd38e('0x15'));var config=require(_0xd38e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd38e('0x17'))['db'];function respondWithStatusCode(_0x5d26e7,_0xed5669){_0xed5669=_0xed5669||0xcc;return function(_0x22b3bf){if(_0x22b3bf){return _0x5d26e7[_0xd38e('0x18')](_0xed5669);}return _0x5d26e7['status'](_0xed5669)[_0xd38e('0x19')]();};}function respondWithResult(_0xe0d87f,_0x1a68cf){_0x1a68cf=_0x1a68cf||0xc8;return function(_0x3041e5){if(_0x3041e5){return _0xe0d87f[_0xd38e('0x1a')](_0x1a68cf)[_0xd38e('0x1b')](_0x3041e5);}};}function respondWithFilteredResult(_0x4e3156,_0x16efda){return function(_0x8e12c2){if(_0x8e12c2){var _0x3fa464=typeof _0x16efda[_0xd38e('0x1c')]===_0xd38e('0x1d')&&typeof _0x16efda[_0xd38e('0x1e')]===_0xd38e('0x1d');var _0x3c4efd=_0x8e12c2[_0xd38e('0x1f')];var _0x4442dc=_0x3fa464?0x0:_0x16efda[_0xd38e('0x1c')];var _0x2eccd8=_0x3fa464?_0x8e12c2[_0xd38e('0x1f')]:_0x16efda[_0xd38e('0x1c')]+_0x16efda[_0xd38e('0x1e')];var _0x3a451f;if(_0x2eccd8>=_0x3c4efd){_0x2eccd8=_0x3c4efd;_0x3a451f=0xc8;}else{_0x3a451f=0xce;}_0x4e3156[_0xd38e('0x1a')](_0x3a451f);return _0x4e3156[_0xd38e('0x20')](_0xd38e('0x21'),_0x4442dc+'-'+_0x2eccd8+'/'+_0x3c4efd)['json'](_0x8e12c2);}return null;};}function patchUpdates(_0x528ecb){return function(_0x16c332){try{jsonpatch[_0xd38e('0x22')](_0x16c332,_0x528ecb,!![]);}catch(_0x4e6a02){return BPromise[_0xd38e('0x23')](_0x4e6a02);}return _0x16c332[_0xd38e('0x24')]();};}function saveUpdates(_0x3ccfcc,_0x1b234e){return function(_0x19f385){if(_0x19f385){return _0x19f385[_0xd38e('0x25')](_0x3ccfcc)[_0xd38e('0x26')](function(_0x5dbcff){return _0x5dbcff;});}return null;};}function removeEntity(_0x4f0bd4,_0x1c3304){return function(_0x3f262a){if(_0x3f262a){return _0x3f262a[_0xd38e('0x27')]()['then'](function(){var _0x21cbcc=_0x3f262a[_0xd38e('0x28')]({'plain':!![]});var _0x5a7c90=_0xd38e('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x5a7c90,'resourceId':_0x21cbcc['id']}})[_0xd38e('0x26')](function(){return _0x3f262a;});})[_0xd38e('0x26')](function(){_0x4f0bd4[_0xd38e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309acf,_0x21f642){return function(_0x4a3176){if(!_0x4a3176){_0x309acf[_0xd38e('0x18')](0x194);}return _0x4a3176;};}function handleError(_0x3672cd,_0x4a541d){_0x4a541d=_0x4a541d||0x1f4;return function(_0x2ce586){logger[_0xd38e('0x2a')](_0x2ce586[_0xd38e('0x2b')]);if(_0x2ce586[_0xd38e('0x2c')]){delete _0x2ce586[_0xd38e('0x2c')];}_0x3672cd[_0xd38e('0x1a')](_0x4a541d)[_0xd38e('0x2d')](_0x2ce586);};}exports['index']=function(_0x15e50f,_0x1ef3db){var _0x5bf75d={},_0x37848a={},_0x37ef88={'count':0x0,'rows':[]};var _0x3a24b5=_[_0xd38e('0x2e')](db[_0xd38e('0x2f')]['rawAttributes'],function(_0x28979b){return{'name':_0x28979b['fieldName'],'type':_0x28979b[_0xd38e('0x30')][_0xd38e('0x31')]};});_0x37848a['model']=_['map'](_0x3a24b5,_0xd38e('0x2c'));_0x37848a[_0xd38e('0x32')]=_[_0xd38e('0x33')](_0x15e50f[_0xd38e('0x32')]);_0x37848a[_0xd38e('0x34')]=_['intersection'](_0x37848a[_0xd38e('0x35')],_0x37848a['query']);_0x5bf75d['attributes']=_['intersection'](_0x37848a[_0xd38e('0x35')],qs[_0xd38e('0x36')](_0x15e50f[_0xd38e('0x32')][_0xd38e('0x36')]));_0x5bf75d[_0xd38e('0x37')]=_0x5bf75d['attributes']['length']?_0x5bf75d[_0xd38e('0x37')]:_0x37848a[_0xd38e('0x35')];if(!_0x15e50f[_0xd38e('0x32')][_0xd38e('0x38')](_0xd38e('0x39'))){_0x5bf75d['limit']=qs[_0xd38e('0x1e')](_0x15e50f['query'][_0xd38e('0x1e')]);_0x5bf75d[_0xd38e('0x1c')]=qs[_0xd38e('0x1c')](_0x15e50f['query']['offset']);}_0x5bf75d[_0xd38e('0x3a')]=qs['sort'](_0x15e50f[_0xd38e('0x32')][_0xd38e('0x3b')]);_0x5bf75d[_0xd38e('0x3c')]=qs[_0xd38e('0x34')](_[_0xd38e('0x3d')](_0x15e50f[_0xd38e('0x32')],_0x37848a[_0xd38e('0x34')]),_0x3a24b5);if(_0x15e50f[_0xd38e('0x32')][_0xd38e('0x3e')]){_0x5bf75d['where']=_[_0xd38e('0x3f')](_0x5bf75d['where'],{'$or':_[_0xd38e('0x2e')](_0x3a24b5,function(_0x2b58af){if(_0x2b58af['type']!==_0xd38e('0x40')){var _0x3502d5={};_0x3502d5[_0x2b58af['name']]={'$like':'%'+_0x15e50f['query'][_0xd38e('0x3e')]+'%'};return _0x3502d5;}})});}_0x5bf75d=_[_0xd38e('0x3f')]({},_0x5bf75d,_0x15e50f[_0xd38e('0x41')]);var _0x4a6559={'where':_0x5bf75d[_0xd38e('0x3c')]};return db[_0xd38e('0x2f')]['count'](_0x4a6559)['then'](function(_0x22fd25){_0x37ef88[_0xd38e('0x1f')]=_0x22fd25;if(_0x15e50f[_0xd38e('0x32')]['includeAll']){_0x5bf75d[_0xd38e('0x42')]=[{'all':!![]}];}return db[_0xd38e('0x2f')][_0xd38e('0x43')](_0x5bf75d);})['then'](function(_0x27b480){_0x37ef88['rows']=_0x27b480;return _0x37ef88;})[_0xd38e('0x26')](respondWithFilteredResult(_0x1ef3db,_0x5bf75d))[_0xd38e('0x44')](handleError(_0x1ef3db,null));};exports[_0xd38e('0x45')]=function(_0x4d2d16,_0x847f55){var _0x3ec4ba={'raw':!![],'where':{'id':_0x4d2d16[_0xd38e('0x46')]['id']}},_0x1fc069={};_0x1fc069[_0xd38e('0x35')]=_[_0xd38e('0x33')](db[_0xd38e('0x2f')][_0xd38e('0x47')]);_0x1fc069['query']=_['keys'](_0x4d2d16[_0xd38e('0x32')]);_0x1fc069['filters']=_[_0xd38e('0x48')](_0x1fc069[_0xd38e('0x35')],_0x1fc069[_0xd38e('0x32')]);_0x3ec4ba[_0xd38e('0x37')]=_['intersection'](_0x1fc069[_0xd38e('0x35')],qs['fields'](_0x4d2d16[_0xd38e('0x32')][_0xd38e('0x36')]));_0x3ec4ba['attributes']=_0x3ec4ba[_0xd38e('0x37')][_0xd38e('0x49')]?_0x3ec4ba[_0xd38e('0x37')]:_0x1fc069[_0xd38e('0x35')];if(_0x4d2d16['query'][_0xd38e('0x4a')]){_0x3ec4ba['include']=[{'all':!![]}];}_0x3ec4ba=_[_0xd38e('0x3f')]({},_0x3ec4ba,_0x4d2d16[_0xd38e('0x41')]);return db[_0xd38e('0x2f')][_0xd38e('0x4b')](_0x3ec4ba)['then'](handleEntityNotFound(_0x847f55,null))[_0xd38e('0x26')](respondWithResult(_0x847f55,null))[_0xd38e('0x44')](handleError(_0x847f55,null));};exports[_0xd38e('0x4c')]=function(_0x48ef68,_0x2d0436){return db[_0xd38e('0x2f')]['create'](_0x48ef68['body'],{})[_0xd38e('0x26')](function(_0x2ced1e){var _0x554a0d=_0x48ef68[_0xd38e('0x4d')][_0xd38e('0x28')]({'plain':!![]});if(!_0x554a0d)throw new Error(_0xd38e('0x4e'));if(_0x554a0d[_0xd38e('0x4f')]===_0xd38e('0x4d')){var _0x3d342b=_0x2ced1e[_0xd38e('0x28')]({'plain':!![]});var _0x17727e=_0xd38e('0x29');return db[_0xd38e('0x50')][_0xd38e('0x4b')]({'where':{'name':_0x17727e,'userProfileId':_0x554a0d[_0xd38e('0x51')]},'raw':!![]})[_0xd38e('0x26')](function(_0xa3093b){if(_0xa3093b&&_0xa3093b[_0xd38e('0x52')]===0x0){return db[_0xd38e('0x53')][_0xd38e('0x4c')]({'name':_0x3d342b[_0xd38e('0x2c')],'resourceId':_0x3d342b['id'],'type':_0xa3093b['name'],'sectionId':_0xa3093b['id']},{})[_0xd38e('0x26')](function(){return _0x2ced1e;});}else{return _0x2ced1e;}})[_0xd38e('0x44')](function(_0x1a56a7){logger[_0xd38e('0x2a')](_0xd38e('0x54'),_0x1a56a7);throw _0x1a56a7;});}return _0x2ced1e;})[_0xd38e('0x26')](respondWithResult(_0x2d0436,0xc9))[_0xd38e('0x44')](handleError(_0x2d0436,null));};exports[_0xd38e('0x25')]=function(_0x3f15a0,_0x19deb6){if(_0x3f15a0[_0xd38e('0x55')]['id']){delete _0x3f15a0[_0xd38e('0x55')]['id'];}return db[_0xd38e('0x2f')]['find']({'where':{'id':_0x3f15a0[_0xd38e('0x46')]['id']}})['then'](handleEntityNotFound(_0x19deb6,null))[_0xd38e('0x26')](saveUpdates(_0x3f15a0[_0xd38e('0x55')],null))[_0xd38e('0x26')](respondWithResult(_0x19deb6,null))[_0xd38e('0x44')](handleError(_0x19deb6,null));};exports[_0xd38e('0x27')]=function(_0xf41c43,_0x204fa6){return db[_0xd38e('0x2f')]['find']({'where':{'id':_0xf41c43[_0xd38e('0x46')]['id']}})[_0xd38e('0x26')](handleEntityNotFound(_0x204fa6,null))[_0xd38e('0x26')](removeEntity(_0x204fa6,null))['catch'](handleError(_0x204fa6,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 72b5605..78baf9b 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ada=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','lodash'];(function(_0x26c8cb,_0x26acd4){var _0x177804=function(_0x28d7d4){while(--_0x28d7d4){_0x26c8cb['push'](_0x26c8cb['shift']());}};_0x177804(++_0x26acd4);}(_0x5ada,0x1a3));var _0xa5ad=function(_0x2853dd,_0x36df3b){_0x2853dd=_0x2853dd-0x0;var _0x420394=_0x5ada[_0x2853dd];return _0x420394;};'use strict';var _=require(_0xa5ad('0x0'));var util=require(_0xa5ad('0x1'));var logger=require(_0xa5ad('0x2'))(_0xa5ad('0x3'));var moment=require(_0xa5ad('0x4'));var BPromise=require(_0xa5ad('0x5'));var rp=require(_0xa5ad('0x6'));var fs=require('fs');var path=require(_0xa5ad('0x7'));var rimraf=require(_0xa5ad('0x8'));var config=require(_0xa5ad('0x9'));var attributes=require(_0xa5ad('0xa'));module['exports']=function(_0x573999,_0xe92df4){return _0x573999[_0xa5ad('0xb')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d2a=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x6d2a,0x10e));var _0xa6d2=function(_0x502a32,_0x23d261){_0x502a32=_0x502a32-0x0;var _0x30191c=_0x6d2a[_0x502a32];return _0x30191c;};'use strict';var _=require(_0xa6d2('0x0'));var util=require(_0xa6d2('0x1'));var logger=require(_0xa6d2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa6d2('0x3'));var rp=require(_0xa6d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6d2('0x5'));var config=require(_0xa6d2('0x6'));var attributes=require(_0xa6d2('0x7'));module['exports']=function(_0x54fa5a,_0x30d4f3){return _0x54fa5a[_0xa6d2('0x8')](_0xa6d2('0x9'),attributes,{'tableName':_0xa6d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 4e65526..73a14dc 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7127=['info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4eca25,_0x1423e2){var _0x48fcf5=function(_0xa1fb7e){while(--_0xa1fb7e){_0x4eca25['push'](_0x4eca25['shift']());}};_0x48fcf5(++_0x1423e2);}(_0x7127,0x145));var _0x7712=function(_0x21e153,_0x35820c){_0x21e153=_0x21e153-0x0;var _0x5ccc65=_0x7127[_0x21e153];return _0x5ccc65;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7712('0x0'));var BPromise=require(_0x7712('0x1'));var rs=require(_0x7712('0x2'));var fs=require('fs');var Redis=require(_0x7712('0x3'));var db=require(_0x7712('0x4'))['db'];var utils=require(_0x7712('0x5'));var logger=require(_0x7712('0x6'))(_0x7712('0x7'));var config=require(_0x7712('0x8'));var jayson=require(_0x7712('0x9'));var client=jayson['client'][_0x7712('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f1034,_0x544710,_0x540463){return new BPromise(function(_0x55492e,_0x1fa649){return client['request'](_0x3f1034,_0x540463)['then'](function(_0x3db7c2){logger['info'](_0x7712('0xb'),_0x544710,_0x7712('0xc'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x544710,_0x7712('0xc'),JSON[_0x7712('0xd')](_0x3db7c2));if(_0x3db7c2['error']){if(_0x3db7c2[_0x7712('0xe')][_0x7712('0xf')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x544710,_0x3db7c2['error'][_0x7712('0x10')]);return _0x1fa649(_0x3db7c2[_0x7712('0xe')]['message']);}logger[_0x7712('0xe')](_0x7712('0xb'),_0x544710,_0x3db7c2[_0x7712('0xe')][_0x7712('0x10')]);return _0x55492e(_0x3db7c2[_0x7712('0xe')][_0x7712('0x10')]);}else{logger[_0x7712('0x11')](_0x7712('0xb'),_0x544710,_0x7712('0xc'));_0x55492e(_0x3db7c2['result'][_0x7712('0x10')]);}})[_0x7712('0x12')](function(_0x43db32){logger[_0x7712('0xe')](_0x7712('0xb'),_0x544710,_0x43db32);_0x1fa649(_0x43db32);});});} \ No newline at end of file +var _0x34b3=['info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x34b3,0x142));var _0x334b=function(_0x34cb47,_0x27d2c0){_0x34cb47=_0x34cb47-0x0;var _0x99a10c=_0x34b3[_0x34cb47];return _0x99a10c;};'use strict';var _=require(_0x334b('0x0'));var util=require('util');var moment=require(_0x334b('0x1'));var BPromise=require(_0x334b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x334b('0x3'));var db=require(_0x334b('0x4'))['db'];var utils=require(_0x334b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x334b('0x6'));var jayson=require(_0x334b('0x7'));var client=jayson[_0x334b('0x8')][_0x334b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b80e9,_0x57d1ac,_0xf6136){return new BPromise(function(_0x34a98c,_0x55bd96){return client[_0x334b('0xa')](_0x3b80e9,_0xf6136)[_0x334b('0xb')](function(_0x2eca52){logger['info'](_0x334b('0xc'),_0x57d1ac,_0x334b('0xd'));logger[_0x334b('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x57d1ac,'request\x20sent',JSON[_0x334b('0xf')](_0x2eca52));if(_0x2eca52[_0x334b('0x10')]){if(_0x2eca52[_0x334b('0x10')]['code']===0x1f4){logger[_0x334b('0x10')](_0x334b('0xc'),_0x57d1ac,_0x2eca52[_0x334b('0x10')][_0x334b('0x11')]);return _0x55bd96(_0x2eca52[_0x334b('0x10')][_0x334b('0x11')]);}logger[_0x334b('0x10')](_0x334b('0xc'),_0x57d1ac,_0x2eca52[_0x334b('0x10')]['message']);return _0x34a98c(_0x2eca52[_0x334b('0x10')][_0x334b('0x11')]);}else{logger[_0x334b('0x12')](_0x334b('0xc'),_0x57d1ac,'request\x20sent');_0x34a98c(_0x2eca52[_0x334b('0x13')][_0x334b('0x11')]);}})['catch'](function(_0x528008){logger[_0x334b('0x10')](_0x334b('0xc'),_0x57d1ac,_0x528008);_0x55bd96(_0x528008);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 5c9fda9..ceaad63 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60b4=['destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','put','update','delete'];(function(_0x49df88,_0x539856){var _0x41769d=function(_0x5565bb){while(--_0x5565bb){_0x49df88['push'](_0x49df88['shift']());}};_0x41769d(++_0x539856);}(_0x60b4,0xb5));var _0x460b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60b4[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x460b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x460b('0x1'));var express=require(_0x460b('0x2'));var router=express[_0x460b('0x3')]();var fs_extra=require(_0x460b('0x4'));var auth=require(_0x460b('0x5'));var interaction=require(_0x460b('0x6'));var config=require(_0x460b('0x7'));var controller=require(_0x460b('0x8'));router['get']('/',auth[_0x460b('0x9')](),controller[_0x460b('0xa')]);router[_0x460b('0xb')](_0x460b('0xc'),auth['isAuthenticated'](),controller[_0x460b('0xd')]);router['post']('/',auth[_0x460b('0x9')](),controller['create']);router[_0x460b('0xe')](_0x460b('0xc'),auth[_0x460b('0x9')](),controller[_0x460b('0xf')]);router[_0x460b('0x10')](_0x460b('0xc'),auth['isAuthenticated'](),controller[_0x460b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x57a1=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../config/environment','./cmContactHasItem.controller','index','show','post','isAuthenticated','create','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57a1,0x148));var _0x157a=function(_0x52d4ad,_0x25e611){_0x52d4ad=_0x52d4ad-0x0;var _0x34a767=_0x57a1[_0x52d4ad];return _0x34a767;};'use strict';var multer=require(_0x157a('0x0'));var util=require('util');var path=require(_0x157a('0x1'));var timeout=require(_0x157a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x157a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x157a('0x4'));var controller=require(_0x157a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x157a('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x157a('0x7')]);router[_0x157a('0x8')]('/',auth[_0x157a('0x9')](),controller[_0x157a('0xa')]);router[_0x157a('0xb')](_0x157a('0xc'),auth[_0x157a('0x9')](),controller[_0x157a('0xd')]);router[_0x157a('0xe')]('/:id',auth[_0x157a('0x9')](),controller[_0x157a('0xf')]);module[_0x157a('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 71a5e1e..0e11071 100644 --- a/server/api/cmCustomField/cmCustomField.attributes.js +++ b/server/api/cmCustomField/cmCustomField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f48=['lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x2f79f9,_0xc1b001){var _0x19c0a9=function(_0x181ffa){while(--_0x181ffa){_0x2f79f9['push'](_0x2f79f9['shift']());}};_0x19c0a9(++_0xc1b001);}(_0x5f48,0x1c1));var _0x85f4=function(_0x5e948b,_0x2bd861){_0x5e948b=_0x5e948b-0x0;var _0x529b76=_0x5f48[_0x5e948b];return _0x529b76;};'use strict';var Sequelize=require(_0x85f4('0x0'));var _=require(_0x85f4('0x1'));module[_0x85f4('0x2')]={'name':{'type':Sequelize[_0x85f4('0x3')],'get':function(_0x422348){return this[_0x85f4('0x4')](_0x85f4('0x5'));}},'alias':{'type':Sequelize[_0x85f4('0x6')],'allowNull':![],'set':function(_0x4a3f08){this[_0x85f4('0x7')]('alias',_0x4a3f08?_0x4a3f08:this[_0x85f4('0x4')](_0x85f4('0x8')));}},'type':{'type':Sequelize[_0x85f4('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x85f4('0x9')]('long'),'get':function(){if(this['getDataValue']('type')===_0x85f4('0xa')){return JSON[_0x85f4('0xb')](this[_0x85f4('0x4')](_0x85f4('0xc')));}else{return this[_0x85f4('0x4')](_0x85f4('0xc'));}},'set':function(_0x23bcfc){if(Array[_0x85f4('0xd')](_0x23bcfc)){this[_0x85f4('0x7')]('values',JSON[_0x85f4('0xe')](_0x23bcfc));}else{this[_0x85f4('0x7')]('values',_0x23bcfc);}}},'required':{'type':Sequelize[_0x85f4('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x85f4('0x10')](_0x85f4('0x11'))}}; \ No newline at end of file +var _0xb2d8=['type','parse','values','ENUM','voice','sequelize','lodash','getDataValue','alias','STRING','setDataValue','name','TEXT','long'];(function(_0x3777d2,_0x62a17b){var _0x1e9c70=function(_0x288c4e){while(--_0x288c4e){_0x3777d2['push'](_0x3777d2['shift']());}};_0x1e9c70(++_0x62a17b);}(_0xb2d8,0x163));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8b2d('0x0'));var _=require(_0x8b2d('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x9f71a6){return this[_0x8b2d('0x2')](_0x8b2d('0x3'));}},'alias':{'type':Sequelize[_0x8b2d('0x4')],'allowNull':![],'set':function(_0x121737){this[_0x8b2d('0x5')](_0x8b2d('0x3'),_0x121737?_0x121737:this[_0x8b2d('0x2')](_0x8b2d('0x6')));}},'type':{'type':Sequelize[_0x8b2d('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x8b2d('0x7')](_0x8b2d('0x8')),'get':function(){if(this[_0x8b2d('0x2')](_0x8b2d('0x9'))==='select'){return JSON[_0x8b2d('0xa')](this['getDataValue'](_0x8b2d('0xb')));}else{return this['getDataValue'](_0x8b2d('0xb'));}},'set':function(_0x169e9c){if(Array['isArray'](_0x169e9c)){this[_0x8b2d('0x5')](_0x8b2d('0xb'),JSON['stringify'](_0x169e9c));}else{this[_0x8b2d('0x5')]('values',_0x169e9c);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8b2d('0xc')](_0x8b2d('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 3d3d1b6..1d3b838 100644 --- a/server/api/cmCustomField/cmCustomField.controller.js +++ b/server/api/cmCustomField/cmCustomField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae16=['find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','addColumn','format','cf_%d','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','differenceBy','map','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmCustomField','includeAll','rows','catch','show','params','keys','fields','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae16,0x1ac));var _0x6ae1=function(_0xb244ec,_0x51e0f7){_0xb244ec=_0xb244ec-0x0;var _0x3bb9fc=_0xae16[_0xb244ec];return _0x3bb9fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ae1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ae1('0x1'));var rp=require(_0x6ae1('0x2'));var moment=require(_0x6ae1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ae1('0x4'));var path=require(_0x6ae1('0x5'));var sox=require(_0x6ae1('0x6'));var csv=require(_0x6ae1('0x7'));var ejs=require(_0x6ae1('0x8'));var fs=require('fs');var fs_extra=require(_0x6ae1('0x9'));var _=require(_0x6ae1('0xa'));var squel=require('squel');var crypto=require(_0x6ae1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6ae1('0xc'));var toCsv=require(_0x6ae1('0x7'));var querystring=require(_0x6ae1('0xd'));var Papa=require(_0x6ae1('0xe'));var Redis=require('ioredis');var authService=require(_0x6ae1('0xf'));var qs=require(_0x6ae1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6ae1('0x11'));var utils=require(_0x6ae1('0x12'));var config=require(_0x6ae1('0x13'));var licenseUtil=require(_0x6ae1('0x14'));var db=require(_0x6ae1('0x15'))['db'];function respondWithStatusCode(_0x11b148,_0x46d721){_0x46d721=_0x46d721||0xcc;return function(_0x4e8684){if(_0x4e8684){return _0x11b148[_0x6ae1('0x16')](_0x46d721);}return _0x11b148[_0x6ae1('0x17')](_0x46d721)[_0x6ae1('0x18')]();};}function respondWithResult(_0x1e714f,_0x59f69f){_0x59f69f=_0x59f69f||0xc8;return function(_0x2e283d){if(_0x2e283d){return _0x1e714f[_0x6ae1('0x17')](_0x59f69f)[_0x6ae1('0x19')](_0x2e283d);}};}function respondWithFilteredResult(_0x2a144e,_0x527cb6){return function(_0x330178){if(_0x330178){var _0x5d59cf=typeof _0x527cb6[_0x6ae1('0x1a')]===_0x6ae1('0x1b')&&typeof _0x527cb6[_0x6ae1('0x1c')]==='undefined';var _0x5424b3=_0x330178[_0x6ae1('0x1d')];var _0x1b6f39=_0x5d59cf?0x0:_0x527cb6[_0x6ae1('0x1a')];var _0x169873=_0x5d59cf?_0x330178[_0x6ae1('0x1d')]:_0x527cb6[_0x6ae1('0x1a')]+_0x527cb6[_0x6ae1('0x1c')];var _0x5683ec;if(_0x169873>=_0x5424b3){_0x169873=_0x5424b3;_0x5683ec=0xc8;}else{_0x5683ec=0xce;}_0x2a144e[_0x6ae1('0x17')](_0x5683ec);return _0x2a144e[_0x6ae1('0x1e')](_0x6ae1('0x1f'),_0x1b6f39+'-'+_0x169873+'/'+_0x5424b3)[_0x6ae1('0x19')](_0x330178);}return null;};}function patchUpdates(_0x3d2399){return function(_0x2eb56c){try{jsonpatch[_0x6ae1('0x20')](_0x2eb56c,_0x3d2399,!![]);}catch(_0x165bae){return BPromise['reject'](_0x165bae);}return _0x2eb56c[_0x6ae1('0x21')]();};}function saveUpdates(_0x52f269,_0x4916ea){return function(_0x148765){if(_0x148765){return _0x148765[_0x6ae1('0x22')](_0x52f269)[_0x6ae1('0x23')](function(_0x18a33d){return _0x18a33d;});}return null;};}function removeEntity(_0x90cd3b,_0x41bef2){return function(_0x447cbb){if(_0x447cbb){return _0x447cbb[_0x6ae1('0x24')]()[_0x6ae1('0x23')](function(){_0x90cd3b[_0x6ae1('0x17')](0xcc)[_0x6ae1('0x18')]();});}};}function handleEntityNotFound(_0x4d7231,_0x1f9421){return function(_0x4c468a){if(!_0x4c468a){_0x4d7231['sendStatus'](0x194);}return _0x4c468a;};}function handleError(_0x51af6d,_0x30d15f){_0x30d15f=_0x30d15f||0x1f4;return function(_0x1bdeee){logger[_0x6ae1('0x25')](_0x1bdeee['stack']);if(_0x1bdeee['name']){delete _0x1bdeee[_0x6ae1('0x26')];}_0x51af6d[_0x6ae1('0x17')](_0x30d15f)[_0x6ae1('0x27')](_0x1bdeee);};}exports[_0x6ae1('0x28')]=function(_0x478064,_0x40e8f5){var _0x420c46={},_0x186af8={},_0x4839e8={'count':0x0,'rows':[]};var _0x3f35f3=_['map'](db['CmCustomField']['rawAttributes'],function(_0x3fb316){return{'name':_0x3fb316[_0x6ae1('0x29')],'type':_0x3fb316[_0x6ae1('0x2a')][_0x6ae1('0x2b')]};});_0x186af8[_0x6ae1('0x2c')]=_[_0x6ae1('0x2d')](_[_0x6ae1('0x2e')](_0x3f35f3,_0x6ae1('0x26')),[_0x6ae1('0x26')]);_0x186af8[_0x6ae1('0x2f')]=_['keys'](_0x478064[_0x6ae1('0x2f')]);_0x186af8[_0x6ae1('0x30')]=_[_0x6ae1('0x31')](_0x186af8[_0x6ae1('0x2c')],_0x186af8['query']);_0x420c46[_0x6ae1('0x32')]=_[_0x6ae1('0x31')](_0x186af8[_0x6ae1('0x2c')],qs['fields'](_0x478064[_0x6ae1('0x2f')]['fields']));_0x420c46['attributes']=_0x420c46[_0x6ae1('0x32')][_0x6ae1('0x33')]?_0x420c46[_0x6ae1('0x32')]:_0x186af8[_0x6ae1('0x2c')];if(!_0x478064[_0x6ae1('0x2f')]['hasOwnProperty'](_0x6ae1('0x34'))){_0x420c46[_0x6ae1('0x1c')]=qs[_0x6ae1('0x1c')](_0x478064[_0x6ae1('0x2f')][_0x6ae1('0x1c')]);_0x420c46[_0x6ae1('0x1a')]=qs[_0x6ae1('0x1a')](_0x478064[_0x6ae1('0x2f')][_0x6ae1('0x1a')]);}_0x420c46[_0x6ae1('0x35')]=qs[_0x6ae1('0x36')](_0x478064[_0x6ae1('0x2f')][_0x6ae1('0x36')]);_0x420c46[_0x6ae1('0x37')]=qs[_0x6ae1('0x30')](_[_0x6ae1('0x38')](_0x478064[_0x6ae1('0x2f')],_0x186af8[_0x6ae1('0x30')]),_0x3f35f3);if(_0x478064[_0x6ae1('0x2f')][_0x6ae1('0x39')]){_0x420c46[_0x6ae1('0x37')]=_['merge'](_0x420c46[_0x6ae1('0x37')],{'$or':_[_0x6ae1('0x2e')](_0x3f35f3,function(_0x564769){if(_0x564769[_0x6ae1('0x2a')]!==_0x6ae1('0x3a')){var _0x316362={};_0x316362[_0x564769[_0x6ae1('0x26')]]={'$like':'%'+_0x478064[_0x6ae1('0x2f')][_0x6ae1('0x39')]+'%'};return _0x316362;}})});}_0x420c46=_[_0x6ae1('0x3b')]({},_0x420c46,_0x478064[_0x6ae1('0x3c')]);var _0x566b41={'where':_0x420c46[_0x6ae1('0x37')]};return db[_0x6ae1('0x3d')][_0x6ae1('0x1d')](_0x566b41)['then'](function(_0x3f5721){_0x4839e8[_0x6ae1('0x1d')]=_0x3f5721;if(_0x478064[_0x6ae1('0x2f')][_0x6ae1('0x3e')]){_0x420c46['include']=[{'all':!![]}];}return db[_0x6ae1('0x3d')]['findAll'](_0x420c46);})['then'](function(_0x5083ff){_0x4839e8[_0x6ae1('0x3f')]=_0x5083ff;return _0x4839e8;})[_0x6ae1('0x23')](respondWithFilteredResult(_0x40e8f5,_0x420c46))[_0x6ae1('0x40')](handleError(_0x40e8f5,null));};exports[_0x6ae1('0x41')]=function(_0x527d9b,_0x4c7e7a){var _0x4e20cd={'raw':!![],'where':{'id':_0x527d9b[_0x6ae1('0x42')]['id']}},_0x2c7c5a={};_0x2c7c5a[_0x6ae1('0x2c')]=_[_0x6ae1('0x43')](db[_0x6ae1('0x3d')]['rawAttributes']);_0x2c7c5a[_0x6ae1('0x2f')]=_[_0x6ae1('0x43')](_0x527d9b[_0x6ae1('0x2f')]);_0x2c7c5a['filters']=_[_0x6ae1('0x31')](_0x2c7c5a[_0x6ae1('0x2c')],_0x2c7c5a[_0x6ae1('0x2f')]);_0x4e20cd[_0x6ae1('0x32')]=_[_0x6ae1('0x31')](_0x2c7c5a['model'],qs[_0x6ae1('0x44')](_0x527d9b[_0x6ae1('0x2f')][_0x6ae1('0x44')]));_0x4e20cd[_0x6ae1('0x32')]=_0x4e20cd[_0x6ae1('0x32')][_0x6ae1('0x33')]?_0x4e20cd[_0x6ae1('0x32')]:_0x2c7c5a[_0x6ae1('0x2c')];if(_0x527d9b[_0x6ae1('0x2f')][_0x6ae1('0x3e')]){_0x4e20cd[_0x6ae1('0x45')]=[{'all':!![]}];}_0x4e20cd=_[_0x6ae1('0x3b')]({},_0x4e20cd,_0x527d9b[_0x6ae1('0x3c')]);return db[_0x6ae1('0x3d')][_0x6ae1('0x46')](_0x4e20cd)[_0x6ae1('0x23')](handleEntityNotFound(_0x4c7e7a,null))['then'](respondWithResult(_0x4c7e7a,null))[_0x6ae1('0x40')](handleError(_0x4c7e7a,null));};exports[_0x6ae1('0x22')]=function(_0x3b4c68,_0x24a9bb){if(_0x3b4c68['body']['id']){delete _0x3b4c68['body']['id'];}return db['CmCustomField']['find']({'where':{'id':_0x3b4c68[_0x6ae1('0x42')]['id']}})[_0x6ae1('0x23')](handleEntityNotFound(_0x24a9bb,null))[_0x6ae1('0x23')](saveUpdates(_0x3b4c68[_0x6ae1('0x47')],null))[_0x6ae1('0x23')](respondWithResult(_0x24a9bb,null))[_0x6ae1('0x40')](handleError(_0x24a9bb,null));};exports['destroy']=function(_0xf763ec,_0x3482ba){return db[_0x6ae1('0x3d')][_0x6ae1('0x46')]({'where':{'id':_0xf763ec['params']['id']}})[_0x6ae1('0x23')](handleEntityNotFound(_0x3482ba,null))[_0x6ae1('0x23')](removeEntity(_0x3482ba,null))[_0x6ae1('0x40')](handleError(_0x3482ba,null));};exports[_0x6ae1('0x48')]=function(_0x417296,_0xb9a8d7){var _0x4a4962;return db[_0x6ae1('0x49')][_0x6ae1('0x4a')](function(_0x5ad60f){return db[_0x6ae1('0x3d')]['create'](_0x417296[_0x6ae1('0x47')],{'transaction':_0x5ad60f})[_0x6ae1('0x23')](function(_0x4a06bc){_0x4a4962=_0x4a06bc;var _0x16449f={'type':db[_0x6ae1('0x4b')][_0x6ae1('0x4c')],'transaction':_0x5ad60f};switch(_0x417296[_0x6ae1('0x47')][_0x6ae1('0x2a')]){case _0x6ae1('0x4d'):_0x16449f[_0x6ae1('0x2a')]=db[_0x6ae1('0x4b')][_0x6ae1('0x4c')];break;case _0x6ae1('0x4e'):_0x16449f[_0x6ae1('0x2a')]=db['Sequelize'][_0x6ae1('0x4f')];break;case'switch':_0x16449f[_0x6ae1('0x2a')]=db[_0x6ae1('0x4b')]['BOOLEAN'];_0x16449f['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x6ae1('0x50')]('cm_contacts',util[_0x6ae1('0x51')](_0x6ae1('0x52'),_0x4a4962['id']),_0x16449f);})[_0x6ae1('0x23')](function(){return _0x4a4962;});})[_0x6ae1('0x23')](respondWithResult(_0xb9a8d7,0xc9))['catch'](handleError(_0xb9a8d7,null));}; \ No newline at end of file +var _0x5c12=['catch','show','params','body','destroy','find','create','sequelize','transaction','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','offset','count','limit','status','set','json','reject','save','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','differenceBy','keys','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x48c550,_0x428ac2){var _0x4bf9ee=function(_0x265900){while(--_0x265900){_0x48c550['push'](_0x48c550['shift']());}};_0x4bf9ee(++_0x428ac2);}(_0x5c12,0x6f));var _0x25c1=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x5c12[_0x12d951];return _0x44de17;};'use strict';var emlformat=require(_0x25c1('0x0'));var rimraf=require(_0x25c1('0x1'));var zipdir=require(_0x25c1('0x2'));var jsonpatch=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var moment=require(_0x25c1('0x5'));var BPromise=require(_0x25c1('0x6'));var Mustache=require(_0x25c1('0x7'));var util=require('util');var path=require(_0x25c1('0x8'));var sox=require(_0x25c1('0x9'));var csv=require(_0x25c1('0xa'));var ejs=require(_0x25c1('0xb'));var fs=require('fs');var fs_extra=require(_0x25c1('0xc'));var _=require(_0x25c1('0xd'));var squel=require(_0x25c1('0xe'));var crypto=require('crypto');var jsforce=require(_0x25c1('0xf'));var deskjs=require(_0x25c1('0x10'));var toCsv=require(_0x25c1('0xa'));var querystring=require(_0x25c1('0x11'));var Papa=require(_0x25c1('0x12'));var Redis=require('ioredis');var authService=require(_0x25c1('0x13'));var qs=require(_0x25c1('0x14'));var as=require(_0x25c1('0x15'));var hardwareService=require(_0x25c1('0x16'));var logger=require(_0x25c1('0x17'))('api');var utils=require(_0x25c1('0x18'));var config=require(_0x25c1('0x19'));var licenseUtil=require(_0x25c1('0x1a'));var db=require(_0x25c1('0x1b'))['db'];function respondWithStatusCode(_0x11bf1c,_0x4ae573){_0x4ae573=_0x4ae573||0xcc;return function(_0x206946){if(_0x206946){return _0x11bf1c[_0x25c1('0x1c')](_0x4ae573);}return _0x11bf1c['status'](_0x4ae573)[_0x25c1('0x1d')]();};}function respondWithResult(_0xa2d6dc,_0xfb981c){_0xfb981c=_0xfb981c||0xc8;return function(_0x2d4f7b){if(_0x2d4f7b){return _0xa2d6dc['status'](_0xfb981c)['json'](_0x2d4f7b);}};}function respondWithFilteredResult(_0x22f010,_0xb5a802){return function(_0x167258){if(_0x167258){var _0x2783fc=typeof _0xb5a802['offset']===_0x25c1('0x1e')&&typeof _0xb5a802['limit']==='undefined';var _0x5b19d3=_0x167258['count'];var _0xda4342=_0x2783fc?0x0:_0xb5a802[_0x25c1('0x1f')];var _0x13a072=_0x2783fc?_0x167258[_0x25c1('0x20')]:_0xb5a802['offset']+_0xb5a802[_0x25c1('0x21')];var _0x46b143;if(_0x13a072>=_0x5b19d3){_0x13a072=_0x5b19d3;_0x46b143=0xc8;}else{_0x46b143=0xce;}_0x22f010[_0x25c1('0x22')](_0x46b143);return _0x22f010[_0x25c1('0x23')]('Content-Range',_0xda4342+'-'+_0x13a072+'/'+_0x5b19d3)[_0x25c1('0x24')](_0x167258);}return null;};}function patchUpdates(_0x57b72b){return function(_0x2f01d0){try{jsonpatch['apply'](_0x2f01d0,_0x57b72b,!![]);}catch(_0x43d514){return BPromise[_0x25c1('0x25')](_0x43d514);}return _0x2f01d0[_0x25c1('0x26')]();};}function saveUpdates(_0x46c543,_0x2ee882){return function(_0xdfc1c){if(_0xdfc1c){return _0xdfc1c[_0x25c1('0x27')](_0x46c543)[_0x25c1('0x28')](function(_0x40ebc6){return _0x40ebc6;});}return null;};}function removeEntity(_0x448574,_0x4cea2d){return function(_0x39b2dc){if(_0x39b2dc){return _0x39b2dc['destroy']()[_0x25c1('0x28')](function(){_0x448574['status'](0xcc)[_0x25c1('0x1d')]();});}};}function handleEntityNotFound(_0x3b1ee9,_0xa6cf4b){return function(_0x5a53a7){if(!_0x5a53a7){_0x3b1ee9[_0x25c1('0x1c')](0x194);}return _0x5a53a7;};}function handleError(_0x8fb29,_0xa73297){_0xa73297=_0xa73297||0x1f4;return function(_0x585a99){logger[_0x25c1('0x29')](_0x585a99[_0x25c1('0x2a')]);if(_0x585a99['name']){delete _0x585a99[_0x25c1('0x2b')];}_0x8fb29[_0x25c1('0x22')](_0xa73297)[_0x25c1('0x2c')](_0x585a99);};}exports[_0x25c1('0x2d')]=function(_0x127a0a,_0x18e12e){var _0x378fc3={},_0x5580da={},_0x354651={'count':0x0,'rows':[]};var _0x53125b=_[_0x25c1('0x2e')](db[_0x25c1('0x2f')][_0x25c1('0x30')],function(_0x2c7be4){return{'name':_0x2c7be4['fieldName'],'type':_0x2c7be4[_0x25c1('0x31')]['key']};});_0x5580da['model']=_[_0x25c1('0x32')](_[_0x25c1('0x2e')](_0x53125b,'name'),['name']);_0x5580da['query']=_[_0x25c1('0x33')](_0x127a0a[_0x25c1('0x34')]);_0x5580da['filters']=_[_0x25c1('0x35')](_0x5580da[_0x25c1('0x36')],_0x5580da[_0x25c1('0x34')]);_0x378fc3[_0x25c1('0x37')]=_[_0x25c1('0x35')](_0x5580da[_0x25c1('0x36')],qs[_0x25c1('0x38')](_0x127a0a[_0x25c1('0x34')]['fields']));_0x378fc3['attributes']=_0x378fc3[_0x25c1('0x37')][_0x25c1('0x39')]?_0x378fc3['attributes']:_0x5580da[_0x25c1('0x36')];if(!_0x127a0a[_0x25c1('0x34')]['hasOwnProperty'](_0x25c1('0x3a'))){_0x378fc3[_0x25c1('0x21')]=qs[_0x25c1('0x21')](_0x127a0a['query']['limit']);_0x378fc3[_0x25c1('0x1f')]=qs[_0x25c1('0x1f')](_0x127a0a[_0x25c1('0x34')][_0x25c1('0x1f')]);}_0x378fc3['order']=qs['sort'](_0x127a0a[_0x25c1('0x34')][_0x25c1('0x3b')]);_0x378fc3[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_[_0x25c1('0x3e')](_0x127a0a[_0x25c1('0x34')],_0x5580da[_0x25c1('0x3d')]),_0x53125b);if(_0x127a0a[_0x25c1('0x34')][_0x25c1('0x3f')]){_0x378fc3['where']=_[_0x25c1('0x40')](_0x378fc3[_0x25c1('0x3c')],{'$or':_['map'](_0x53125b,function(_0x22354c){if(_0x22354c[_0x25c1('0x31')]!==_0x25c1('0x41')){var _0x38e6e1={};_0x38e6e1[_0x22354c['name']]={'$like':'%'+_0x127a0a[_0x25c1('0x34')][_0x25c1('0x3f')]+'%'};return _0x38e6e1;}})});}_0x378fc3=_['merge']({},_0x378fc3,_0x127a0a[_0x25c1('0x42')]);var _0x19ac9c={'where':_0x378fc3[_0x25c1('0x3c')]};return db['CmCustomField'][_0x25c1('0x20')](_0x19ac9c)[_0x25c1('0x28')](function(_0x1ac1bf){_0x354651[_0x25c1('0x20')]=_0x1ac1bf;if(_0x127a0a[_0x25c1('0x34')][_0x25c1('0x43')]){_0x378fc3[_0x25c1('0x44')]=[{'all':!![]}];}return db[_0x25c1('0x2f')][_0x25c1('0x45')](_0x378fc3);})[_0x25c1('0x28')](function(_0x1edcdd){_0x354651[_0x25c1('0x46')]=_0x1edcdd;return _0x354651;})['then'](respondWithFilteredResult(_0x18e12e,_0x378fc3))[_0x25c1('0x47')](handleError(_0x18e12e,null));};exports[_0x25c1('0x48')]=function(_0x425b45,_0x3bf618){var _0xff7a1e={'raw':!![],'where':{'id':_0x425b45[_0x25c1('0x49')]['id']}},_0x41beb7={};_0x41beb7[_0x25c1('0x36')]=_[_0x25c1('0x33')](db[_0x25c1('0x2f')][_0x25c1('0x30')]);_0x41beb7['query']=_[_0x25c1('0x33')](_0x425b45[_0x25c1('0x34')]);_0x41beb7[_0x25c1('0x3d')]=_[_0x25c1('0x35')](_0x41beb7[_0x25c1('0x36')],_0x41beb7[_0x25c1('0x34')]);_0xff7a1e[_0x25c1('0x37')]=_[_0x25c1('0x35')](_0x41beb7[_0x25c1('0x36')],qs['fields'](_0x425b45['query']['fields']));_0xff7a1e[_0x25c1('0x37')]=_0xff7a1e[_0x25c1('0x37')]['length']?_0xff7a1e[_0x25c1('0x37')]:_0x41beb7[_0x25c1('0x36')];if(_0x425b45['query']['includeAll']){_0xff7a1e[_0x25c1('0x44')]=[{'all':!![]}];}_0xff7a1e=_[_0x25c1('0x40')]({},_0xff7a1e,_0x425b45[_0x25c1('0x42')]);return db[_0x25c1('0x2f')]['find'](_0xff7a1e)[_0x25c1('0x28')](handleEntityNotFound(_0x3bf618,null))[_0x25c1('0x28')](respondWithResult(_0x3bf618,null))['catch'](handleError(_0x3bf618,null));};exports['update']=function(_0x116bed,_0x2f6564){if(_0x116bed['body']['id']){delete _0x116bed[_0x25c1('0x4a')]['id'];}return db[_0x25c1('0x2f')]['find']({'where':{'id':_0x116bed[_0x25c1('0x49')]['id']}})[_0x25c1('0x28')](handleEntityNotFound(_0x2f6564,null))[_0x25c1('0x28')](saveUpdates(_0x116bed['body'],null))[_0x25c1('0x28')](respondWithResult(_0x2f6564,null))[_0x25c1('0x47')](handleError(_0x2f6564,null));};exports[_0x25c1('0x4b')]=function(_0x56a0ba,_0x104e86){return db['CmCustomField'][_0x25c1('0x4c')]({'where':{'id':_0x56a0ba['params']['id']}})[_0x25c1('0x28')](handleEntityNotFound(_0x104e86,null))[_0x25c1('0x28')](removeEntity(_0x104e86,null))[_0x25c1('0x47')](handleError(_0x104e86,null));};exports[_0x25c1('0x4d')]=function(_0x471b32,_0x4a37d0){var _0x7c1c98;return db[_0x25c1('0x4e')][_0x25c1('0x4f')](function(_0x4dbf3c){return db[_0x25c1('0x2f')][_0x25c1('0x4d')](_0x471b32[_0x25c1('0x4a')],{'transaction':_0x4dbf3c})[_0x25c1('0x28')](function(_0x2fea2b){_0x7c1c98=_0x2fea2b;var _0x3e310f={'type':db['Sequelize']['TEXT'],'transaction':_0x4dbf3c};switch(_0x471b32[_0x25c1('0x4a')][_0x25c1('0x31')]){case _0x25c1('0x50'):_0x3e310f['type']=db[_0x25c1('0x51')][_0x25c1('0x52')];break;case _0x25c1('0x53'):_0x3e310f['type']=db[_0x25c1('0x51')][_0x25c1('0x54')];break;case _0x25c1('0x55'):_0x3e310f['type']=db[_0x25c1('0x51')][_0x25c1('0x56')];_0x3e310f[_0x25c1('0x57')]=![];break;default:}return db[_0x25c1('0x4e')]['queryInterface'][_0x25c1('0x58')](_0x25c1('0x59'),util['format'](_0x25c1('0x5a'),_0x7c1c98['id']),_0x3e310f);})[_0x25c1('0x28')](function(){return _0x7c1c98;});})[_0x25c1('0x28')](respondWithResult(_0x4a37d0,0xc9))[_0x25c1('0x47')](handleError(_0x4a37d0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f64f616..8e3fe7f 100644 --- a/server/api/cmCustomField/cmCustomField.model.js +++ b/server/api/cmCustomField/cmCustomField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e39=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields'];(function(_0x574a5b,_0x32775a){var _0x389669=function(_0xd4d465){while(--_0xd4d465){_0x574a5b['push'](_0x574a5b['shift']());}};_0x389669(++_0x32775a);}(_0x2e39,0x196));var _0x92e3=function(_0x291ab9,_0x44d219){_0x291ab9=_0x291ab9-0x0;var _0x1bb463=_0x2e39[_0x291ab9];return _0x1bb463;};'use strict';var _=require(_0x92e3('0x0'));var util=require(_0x92e3('0x1'));var logger=require(_0x92e3('0x2'))(_0x92e3('0x3'));var moment=require(_0x92e3('0x4'));var BPromise=require(_0x92e3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92e3('0x6'));var rimraf=require(_0x92e3('0x7'));var config=require(_0x92e3('0x8'));var attributes=require(_0x92e3('0x9'));module[_0x92e3('0xa')]=function(_0x223d49,_0x32a86d){return _0x223d49[_0x92e3('0xb')](_0x92e3('0xc'),attributes,{'tableName':_0x92e3('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc834=['api','moment','bluebird','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc834,0x1a1));var _0x4c83=function(_0x155124,_0xb2dac3){_0x155124=_0x155124-0x0;var _0x1aaabd=_0xc834[_0x155124];return _0x1aaabd;};'use strict';var _=require(_0x4c83('0x0'));var util=require(_0x4c83('0x1'));var logger=require(_0x4c83('0x2'))(_0x4c83('0x3'));var moment=require(_0x4c83('0x4'));var BPromise=require(_0x4c83('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c83('0x6'));var rimraf=require(_0x4c83('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c83('0x8'));module[_0x4c83('0x9')]=function(_0x1c0b27,_0x4595af){return _0x1c0b27[_0x4c83('0xa')](_0x4c83('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 758303f..c182c5b 100644 --- a/server/api/cmCustomField/cmCustomField.rpc.js +++ b/server/api/cmCustomField/cmCustomField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdca1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0xe1a964,_0x5ec09d){var _0x3de37b=function(_0x406ffc){while(--_0x406ffc){_0xe1a964['push'](_0xe1a964['shift']());}};_0x3de37b(++_0x5ec09d);}(_0xdca1,0x171));var _0x1dca=function(_0x34e298,_0x5e7260){_0x34e298=_0x34e298-0x0;var _0x668b44=_0xdca1[_0x34e298];return _0x668b44;};'use strict';var _=require(_0x1dca('0x0'));var util=require(_0x1dca('0x1'));var moment=require(_0x1dca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dca('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dca('0x4'))(_0x1dca('0x5'));var config=require(_0x1dca('0x6'));var jayson=require(_0x1dca('0x7'));var client=jayson[_0x1dca('0x8')][_0x1dca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cc0ca,_0x15cd0e,_0x26362d){return new BPromise(function(_0x46065e,_0x83eb79){return client[_0x1dca('0xa')](_0x4cc0ca,_0x26362d)[_0x1dca('0xb')](function(_0x32c29d){logger[_0x1dca('0xc')](_0x1dca('0xd'),_0x15cd0e,_0x1dca('0xe'));logger[_0x1dca('0xf')](_0x1dca('0x10'),_0x15cd0e,_0x1dca('0xe'),JSON['stringify'](_0x32c29d));if(_0x32c29d[_0x1dca('0x11')]){if(_0x32c29d[_0x1dca('0x11')][_0x1dca('0x12')]===0x1f4){logger[_0x1dca('0x11')](_0x1dca('0xd'),_0x15cd0e,_0x32c29d[_0x1dca('0x11')][_0x1dca('0x13')]);return _0x83eb79(_0x32c29d[_0x1dca('0x11')][_0x1dca('0x13')]);}logger[_0x1dca('0x11')](_0x1dca('0xd'),_0x15cd0e,_0x32c29d[_0x1dca('0x11')][_0x1dca('0x13')]);return _0x46065e(_0x32c29d['error'][_0x1dca('0x13')]);}else{logger[_0x1dca('0xc')](_0x1dca('0xd'),_0x15cd0e,_0x1dca('0xe'));_0x46065e(_0x32c29d[_0x1dca('0x14')][_0x1dca('0x13')]);}})[_0x1dca('0x15')](function(_0x57880f){logger[_0x1dca('0x11')](_0x1dca('0xd'),_0x15cd0e,_0x57880f);_0x83eb79(_0x57880f);});});} \ No newline at end of file +var _0x059e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x059e,0x19d));var _0xe059=function(_0x1d34cc,_0x44d9f0){_0x1d34cc=_0x1d34cc-0x0;var _0x48b83c=_0x059e[_0x1d34cc];return _0x48b83c;};'use strict';var _=require(_0xe059('0x0'));var util=require(_0xe059('0x1'));var moment=require(_0xe059('0x2'));var BPromise=require(_0xe059('0x3'));var rs=require(_0xe059('0x4'));var fs=require('fs');var Redis=require(_0xe059('0x5'));var db=require(_0xe059('0x6'))['db'];var utils=require(_0xe059('0x7'));var logger=require(_0xe059('0x8'))(_0xe059('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe059('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c56c9,_0x59350b,_0x1c3b94){return new BPromise(function(_0x3b44e6,_0x5dbcb1){return client[_0xe059('0xb')](_0x4c56c9,_0x1c3b94)['then'](function(_0x2d74ab){logger[_0xe059('0xc')](_0xe059('0xd'),_0x59350b,_0xe059('0xe'));logger[_0xe059('0xf')](_0xe059('0x10'),_0x59350b,'request\x20sent',JSON[_0xe059('0x11')](_0x2d74ab));if(_0x2d74ab[_0xe059('0x12')]){if(_0x2d74ab[_0xe059('0x12')][_0xe059('0x13')]===0x1f4){logger[_0xe059('0x12')](_0xe059('0xd'),_0x59350b,_0x2d74ab['error'][_0xe059('0x14')]);return _0x5dbcb1(_0x2d74ab[_0xe059('0x12')][_0xe059('0x14')]);}logger[_0xe059('0x12')](_0xe059('0xd'),_0x59350b,_0x2d74ab[_0xe059('0x12')][_0xe059('0x14')]);return _0x3b44e6(_0x2d74ab['error']['message']);}else{logger[_0xe059('0xc')]('CmCustomField,\x20%s,\x20%s',_0x59350b,_0xe059('0xe'));_0x3b44e6(_0x2d74ab[_0xe059('0x15')][_0xe059('0x14')]);}})['catch'](function(_0x2cac97){logger[_0xe059('0x12')](_0xe059('0xd'),_0x59350b,_0x2cac97);_0x5dbcb1(_0x2cac97);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 955d6f0..94b93b3 100644 --- a/server/api/cmCustomField/index.js +++ b/server/api/cmCustomField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6753=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x3431f5,_0x4f5d35){var _0x35d22c=function(_0x3aa80a){while(--_0x3aa80a){_0x3431f5['push'](_0x3431f5['shift']());}};_0x35d22c(++_0x4f5d35);}(_0x6753,0xa1));var _0x3675=function(_0x59b870,_0x820405){_0x59b870=_0x59b870-0x0;var _0x2e492a=_0x6753[_0x59b870];return _0x2e492a;};'use strict';var multer=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var path=require(_0x3675('0x2'));var timeout=require(_0x3675('0x3'));var express=require('express');var router=express[_0x3675('0x4')]();var fs_extra=require(_0x3675('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3675('0x8')]);router[_0x3675('0x9')](_0x3675('0xa'),auth[_0x3675('0xb')](),controller[_0x3675('0xc')]);router[_0x3675('0xd')]('/',auth[_0x3675('0xb')](),controller[_0x3675('0xe')]);router[_0x3675('0xf')](_0x3675('0xa'),auth[_0x3675('0xb')](),controller[_0x3675('0x10')]);router[_0x3675('0x11')](_0x3675('0xa'),auth['isAuthenticated'](),controller[_0x3675('0x12')]);module[_0x3675('0x13')]=router; \ No newline at end of file +var _0x8819=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x429b6b,_0x4a2859){var _0x315616=function(_0x385696){while(--_0x385696){_0x429b6b['push'](_0x429b6b['shift']());}};_0x315616(++_0x4a2859);}(_0x8819,0x94));var _0x9881=function(_0x17df7f,_0x1cd9e4){_0x17df7f=_0x17df7f-0x0;var _0x3ba5b0=_0x8819[_0x17df7f];return _0x3ba5b0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9881('0x0'));var timeout=require(_0x9881('0x1'));var express=require(_0x9881('0x2'));var router=express[_0x9881('0x3')]();var fs_extra=require(_0x9881('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var controller=require(_0x9881('0x7'));router[_0x9881('0x8')]('/',auth[_0x9881('0x9')](),controller[_0x9881('0xa')]);router['get'](_0x9881('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9881('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9881('0xd')]('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0xe')]);router[_0x9881('0xf')]('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0x10')]);module[_0x9881('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f3e95d0..357e914 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x218a=['BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','sequelize','STRING'];(function(_0x545fb8,_0x25d956){var _0x3f107c=function(_0x59793e){while(--_0x59793e){_0x545fb8['push'](_0x545fb8['shift']());}};_0x3f107c(++_0x25d956);}(_0x218a,0x10e));var _0xa218=function(_0x340389,_0x3af734){_0x340389=_0x340389-0x0;var _0x41c0a3=_0x218a[_0x340389];return _0x41c0a3;};'use strict';var moment=require('moment');var Sequelize=require(_0xa218('0x0'));module['exports']={'phone':{'type':Sequelize[_0xa218('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xa218('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xa218('0x3')](_0xa218('0x4'))},'countbusyretry':{'type':Sequelize[_0xa218('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa218('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa218('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa218('0x6')]},'priority':{'type':Sequelize[_0xa218('0x5')](0x2)[_0xa218('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa218('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xa218('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xa218('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xa218('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xa218('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa218('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa218('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa218('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xa218('0x6')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xeed7=['moment','sequelize','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue'];(function(_0x5d872e,_0x464858){var _0x1073c9=function(_0x525d5a){while(--_0x525d5a){_0x5d872e['push'](_0x5d872e['shift']());}};_0x1073c9(++_0x464858);}(_0xeed7,0x19a));var _0x7eed=function(_0x1d7e61,_0x44c9b6){_0x1d7e61=_0x1d7e61-0x0;var _0x347cb2=_0xeed7[_0x1d7e61];return _0x347cb2;};'use strict';var moment=require(_0x7eed('0x0'));var Sequelize=require(_0x7eed('0x1'));module[_0x7eed('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x7eed('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7eed('0x4')],'defaultValue':moment()['format'](_0x7eed('0x5'))},'countbusyretry':{'type':Sequelize[_0x7eed('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7eed('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7eed('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7eed('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7eed('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x7eed('0x6')](0x2)[_0x7eed('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7eed('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7eed('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x7eed('0x6')],'unique':_0x7eed('0x9')},'UserId':{'type':Sequelize[_0x7eed('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x7eed('0x6')],'unique':_0x7eed('0x9')},'CampaignId':{'type':Sequelize[_0x7eed('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x7eed('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7eed('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7eed('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7eed('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7eed('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7eed('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7eed('0x7')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 4353196..19ef0b2 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90b5=['VoiceQueue','CampaignId','dataValues','createdAt','updatedAt','deleted','campaign','membername','format','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','status','user','getVoiceQueues','outbound','dialPreviewAutoRecallMe','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','phone','recallme','UPDATE','Contact','Company','CmList','Queue','dialActive','getPreviewRecall','findOne','scheduledat','LOCK','List','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','CmHopper','rawAttributes','type','key','model','map','query','filters','$and','$gte','$lte','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','catch','show','params','keys','intersection','length','includeAll','find','create','body','describe','destroy','VoiceQueueId'];(function(_0x43a882,_0x1212b0){var _0x5b3ca5=function(_0x58b6ed){while(--_0x58b6ed){_0x43a882['push'](_0x43a882['shift']());}};_0x5b3ca5(++_0x1212b0);}(_0x90b5,0x139));var _0x590b=function(_0x5b89c7,_0x22994c){_0x5b89c7=_0x5b89c7-0x0;var _0x332b50=_0x90b5[_0x5b89c7];return _0x332b50;};'use strict';var moment=require(_0x590b('0x0'));var _=require('lodash');var qs=require(_0x590b('0x1'));var logger=require(_0x590b('0x2'))(_0x590b('0x3'));var shared=require(_0x590b('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x4cf794,_0x2318b8){_0x2318b8=_0x2318b8||0xc8;return function(_0x27e96f){if(_0x27e96f){return _0x4cf794['status'](_0x2318b8)[_0x590b('0x5')](_0x27e96f);}};}function respondWithFilteredResult(_0x2059e4,_0x88a5f9){return function(_0x5e54fe){if(_0x5e54fe){var _0x30bc6e=typeof _0x88a5f9[_0x590b('0x6')]===_0x590b('0x7')&&typeof _0x88a5f9[_0x590b('0x8')]===_0x590b('0x7');var _0x268b0a=_0x5e54fe[_0x590b('0x9')];var _0xe0b13d=_0x30bc6e?0x0:_0x88a5f9[_0x590b('0x6')];var _0x50a7b8=_0x30bc6e?_0x5e54fe[_0x590b('0x9')]:_0x88a5f9[_0x590b('0x6')]+_0x88a5f9['limit'];var _0x2962b0;if(_0x50a7b8>=_0x268b0a){_0x50a7b8=_0x268b0a;_0x2962b0=0xc8;}else{_0x2962b0=0xce;}_0x2059e4['status'](_0x2962b0);return _0x2059e4[_0x590b('0xa')](_0x590b('0xb'),_0xe0b13d+'-'+_0x50a7b8+'/'+_0x268b0a)[_0x590b('0x5')](_0x5e54fe);}return null;};}function saveUpdates(_0x477069,_0x527487){return function(_0xb0ca22){if(_0xb0ca22){return _0xb0ca22[_0x590b('0xc')](_0x477069)[_0x590b('0xd')](function(_0x1c8607){return _0x1c8607;});}return null;};}function handleEntityNotFound(_0x2e85b1,_0x6ad7e7){return function(_0x45ac04){if(!_0x45ac04){_0x2e85b1[_0x590b('0xe')](0x194);}return _0x45ac04;};}function handleError(_0x168bde,_0x1fbc84){_0x1fbc84=_0x1fbc84||0x1f4;return function(_0x3fc5ca){logger[_0x590b('0xf')](_0x3fc5ca[_0x590b('0x10')]);if(_0x3fc5ca[_0x590b('0x11')]){delete _0x3fc5ca[_0x590b('0x11')];}_0x168bde['status'](_0x1fbc84)[_0x590b('0x12')](_0x3fc5ca);};}exports['index']=function(_0x5c788,_0x115309){var _0xf05b00={},_0x53337c={},_0x4b2c3c={'count':0x0,'rows':[]};var _0x466dcc=_['map'](db[_0x590b('0x13')][_0x590b('0x14')],function(_0x3fbeb2){return{'name':_0x3fbeb2['fieldName'],'type':_0x3fbeb2[_0x590b('0x15')][_0x590b('0x16')]};});_0x53337c[_0x590b('0x17')]=_[_0x590b('0x18')](_0x466dcc,'name');_0x53337c[_0x590b('0x19')]=_['keys'](_0x5c788[_0x590b('0x19')]);_0x53337c[_0x590b('0x1a')]=_['intersection'](_0x53337c['model'],_0x53337c[_0x590b('0x19')]);_0x53337c[_0x590b('0x1a')]=_['concat'](_0x53337c[_0x590b('0x1a')],[_0x590b('0x1b'),'$or','$gt',_0x590b('0x1c'),'$lt',_0x590b('0x1d'),'$ne','$eq',_0x590b('0x1e'),_0x590b('0x1f'),'$notBetween',_0x590b('0x20'),_0x590b('0x21'),_0x590b('0x22'),_0x590b('0x23'),_0x590b('0x24'),'$notILike',_0x590b('0x22'),_0x590b('0x25'),_0x590b('0x26'),_0x590b('0x27'),_0x590b('0x28')]);_0xf05b00[_0x590b('0x29')]=_['intersection'](_0x53337c[_0x590b('0x17')],qs['fields'](_0x5c788[_0x590b('0x19')][_0x590b('0x2a')]));_0xf05b00[_0x590b('0x29')]=_0xf05b00[_0x590b('0x29')]['length']?_0xf05b00[_0x590b('0x29')]:_0x53337c['model'];if(!_0x5c788[_0x590b('0x19')][_0x590b('0x2b')](_0x590b('0x2c'))){_0xf05b00[_0x590b('0x8')]=qs[_0x590b('0x8')](_0x5c788['query'][_0x590b('0x8')]);_0xf05b00[_0x590b('0x6')]=qs[_0x590b('0x6')](_0x5c788[_0x590b('0x19')]['offset']);}_0xf05b00['order']=qs[_0x590b('0x2d')](_0x5c788[_0x590b('0x19')][_0x590b('0x2d')]);_0xf05b00[_0x590b('0x2e')]=qs['filters'](_['pick'](_0x5c788[_0x590b('0x19')],_0x53337c['filters']),_0x466dcc);if(_0x5c788[_0x590b('0x19')][_0x590b('0x2f')]){_0xf05b00[_0x590b('0x2e')]=_[_0x590b('0x30')](_0xf05b00[_0x590b('0x2e')],{'$or':_[_0x590b('0x18')](_0x466dcc,function(_0x251cab){if(_0x251cab[_0x590b('0x15')]!==_0x590b('0x31')){var _0x3e5c5e={};_0x3e5c5e[_0x251cab['name']]={'$like':'%'+_0x5c788['query'][_0x590b('0x2f')]+'%'};return _0x3e5c5e;}})});}_0xf05b00=_[_0x590b('0x30')]({},_0xf05b00,_0x5c788[_0x590b('0x32')]);var _0x3a03ff={'where':_0xf05b00[_0x590b('0x2e')]};return db['CmHopper'][_0x590b('0x9')](_0x3a03ff)[_0x590b('0xd')](function(_0x3e5ca5){_0x4b2c3c[_0x590b('0x9')]=_0x3e5ca5;if(_0x5c788[_0x590b('0x19')]['includeAll']){_0xf05b00[_0x590b('0x33')]=[{'all':!![]}];}return db[_0x590b('0x13')]['findAll'](_0xf05b00);})['then'](function(_0x46dbf3){_0x4b2c3c['rows']=_0x46dbf3;return _0x4b2c3c;})[_0x590b('0xd')](respondWithFilteredResult(_0x115309,_0xf05b00))[_0x590b('0x34')](handleError(_0x115309,null));};exports[_0x590b('0x35')]=function(_0x2a67fc,_0x210af8){var _0x419e6a={'raw':!![],'where':{'id':_0x2a67fc[_0x590b('0x36')]['id']}},_0x2fc05c={};_0x2fc05c[_0x590b('0x17')]=_[_0x590b('0x37')](db['CmHopper'][_0x590b('0x14')]);_0x2fc05c[_0x590b('0x19')]=_[_0x590b('0x37')](_0x2a67fc['query']);_0x2fc05c[_0x590b('0x1a')]=_[_0x590b('0x38')](_0x2fc05c[_0x590b('0x17')],_0x2fc05c[_0x590b('0x19')]);_0x419e6a[_0x590b('0x29')]=_[_0x590b('0x38')](_0x2fc05c[_0x590b('0x17')],qs[_0x590b('0x2a')](_0x2a67fc['query'][_0x590b('0x2a')]));_0x419e6a['attributes']=_0x419e6a[_0x590b('0x29')][_0x590b('0x39')]?_0x419e6a[_0x590b('0x29')]:_0x2fc05c['model'];if(_0x2a67fc[_0x590b('0x19')][_0x590b('0x3a')]){_0x419e6a[_0x590b('0x33')]=[{'all':!![]}];}_0x419e6a=_[_0x590b('0x30')]({},_0x419e6a,_0x2a67fc['options']);return db[_0x590b('0x13')][_0x590b('0x3b')](_0x419e6a)['then'](handleEntityNotFound(_0x210af8,null))['then'](respondWithResult(_0x210af8,null))['catch'](handleError(_0x210af8,null));};exports[_0x590b('0x3c')]=function(_0x44defc,_0x3bd990){return db['CmHopper']['create'](_0x44defc[_0x590b('0x3d')],{})[_0x590b('0xd')](respondWithResult(_0x3bd990,0xc9))['catch'](handleError(_0x3bd990,null));};exports[_0x590b('0xc')]=function(_0x1a9678,_0x44d1d8){if(_0x1a9678[_0x590b('0x3d')]['id']){delete _0x1a9678[_0x590b('0x3d')]['id'];}return db[_0x590b('0x13')][_0x590b('0x3b')]({'where':{'id':_0x1a9678[_0x590b('0x36')]['id']}})[_0x590b('0xd')](handleEntityNotFound(_0x44d1d8,null))[_0x590b('0xd')](saveUpdates(_0x1a9678[_0x590b('0x3d')],null))[_0x590b('0xd')](respondWithResult(_0x44d1d8,null))[_0x590b('0x34')](handleError(_0x44d1d8,null));};exports['describe']=function(_0x5e79c5,_0x1a92fb){return db[_0x590b('0x13')][_0x590b('0x3e')]()[_0x590b('0xd')](respondWithResult(_0x1a92fb,null))['catch'](handleError(_0x1a92fb,null));};exports[_0x590b('0x3f')]=function(_0x11bb48,_0x2f492a){var _0x5cc53f;var _0x1964c5=_0x11bb48[_0x590b('0x36')]['id'];return db['CmHopper']['find']({'where':{'id':_0x11bb48[_0x590b('0x36')]['id']}})[_0x590b('0xd')](handleEntityNotFound(_0x2f492a,null))['then'](function(_0x218c86){if(_0x218c86){return _0x218c86[_0x590b('0x3f')]()['then'](function(_0x67ee4f){return _0x67ee4f;});}})[_0x590b('0xd')](function(_0x446910){_0x5cc53f=_0x446910;if(_0x446910){if(_0x446910['VoiceQueueId']||_0x446910['CampaignId']){return db[_0x446910[_0x590b('0x40')]?_0x590b('0x41'):'Campaign'][_0x590b('0x3b')]({'where':{'id':_0x446910[_0x590b('0x40')]?_0x446910[_0x590b('0x40')]:_0x446910[_0x590b('0x42')]},'attributes':['id',_0x590b('0x11')],'raw':!![]});}}})[_0x590b('0xd')](function(_0x2a74b8){var _0x4b51ac={};if(_0x2a74b8){_[_0x590b('0x30')](_0x4b51ac,_['omit'](_0x5cc53f[_0x590b('0x43')],[_0x590b('0x44'),_0x590b('0x45'),'id']));_0x4b51ac['state']=0x15;_0x4b51ac['statedesc']=_0x590b('0x46');_0x4b51ac[_0x590b('0x47')]=_0x2a74b8[_0x590b('0x11')];_0x4b51ac[_0x590b('0x48')]=_0x11bb48['user'][_0x590b('0x11')];_0x4b51ac['UserId']=_0x11bb48['user']['id'];_0x4b51ac[_0x590b('0x46')]=!![];_0x4b51ac['deletedat']=moment()[_0x590b('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b51ac[_0x590b('0x4a')]=_0x5cc53f['phone'];_0x4b51ac[_0x590b('0x4b')]=_0x5cc53f[_0x590b('0x40')]?_0x590b('0x4c'):_0x590b('0x4d');return db[_0x590b('0x4e')][_0x590b('0x3b')]({'where':{'id':_0x4b51ac[_0x590b('0x4f')]},'attributes':[_0x590b('0x50'),_0x590b('0x51')]})['then'](function(_0x3ec016){if(!_[_0x590b('0x52')](_0x2f492a)&&!_['isNil'](_0x3ec016[_0x590b('0x50')])){_0x4b51ac[_0x590b('0x53')]=_0x3ec016[_0x590b('0x50')];if(!_[_0x590b('0x52')](_0x3ec016['lastName'])){_0x4b51ac[_0x590b('0x53')]+='\x20'+_0x3ec016[_0x590b('0x51')];}}})[_0x590b('0x54')](function(){return db[_0x590b('0x55')]['create'](_0x4b51ac);});}})[_0x590b('0xd')](function(_0x58dfdc){return db[_0x590b('0x56')][_0x590b('0x3f')]({'where':{'CmHopperId':_0x1964c5}});})[_0x590b('0xd')](function(){return _0x2f492a[_0x590b('0x57')](0xcc)['end']();})[_0x590b('0x34')](handleError(_0x2f492a,null));};exports['getPreview']=function(_0xc22794,_0x426470){var _0x3ef6d3=[];return db['CmContact'][_0x590b('0x3e')]()['then'](function(_0x1b0cbb){_0x3ef6d3=_['keys'](_0x1b0cbb);return _0xc22794[_0x590b('0x58')][_0x590b('0x59')]({'where':{'type':_0x590b('0x5a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x590b('0x5b')],'raw':!![]});})[_0x590b('0xd')](function(_0x3e32d2){if(_0x3e32d2&&_0x3e32d2[_0x590b('0x39')]){return db['sequelize'][_0x590b('0x5c')](function(_0x5eb081){var _0x236aa8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x590b('0x49')](_0x590b('0x5d'))},'VoiceQueueId':{'$in':_[_0x590b('0x18')](_0x3e32d2,'id')},'$or':[{'UserId':null},{'UserId':_0xc22794[_0x590b('0x58')]['id']}]};var _0x5836c9={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3e32d2)['filter']([_0x590b('0x5b'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0xc22794[_0x590b('0x58')]['id']}]};var _0x1c14bf={'$or':[_0x236aa8,_0x5836c9]};var _0x4d16a1=[];if(_0xc22794[_0x590b('0x3d')][_0x590b('0x5e')]&&_0xc22794['body'][_0x590b('0x5e')]===_0x590b('0x5f')){if(!_['isEmpty'](_0xc22794[_0x590b('0x3d')]['hopperIds'])){_0x1c14bf['id']={'$in':_0xc22794[_0x590b('0x3d')][_0x590b('0x60')]};}_0x4d16a1=[[_0x590b('0x61'),'ASC'],[_0x590b('0x62'),_0x3e32d2[0x0][_0x590b('0x63')]===_0x590b('0x64')?_0x590b('0x65'):'ASC'],db[_0x590b('0x66')][_0x590b('0x67')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x590b('0x65')]];}else{if(!_['isEmpty'](_0xc22794[_0x590b('0x3d')][_0x590b('0x60')])){_0x1c14bf['id']={'$notIn':_0xc22794[_0x590b('0x3d')][_0x590b('0x60')]};}_0x4d16a1=[[_0x590b('0x61'),_0x590b('0x65')],[_0x590b('0x62'),_0x3e32d2[0x0][_0x590b('0x63')]],db['sequelize'][_0x590b('0x67')](_0x590b('0x68')),['id',_0x590b('0x64')]];}return db[_0x590b('0x13')]['findOne']({'attributes':['id','scheduledat',_0x590b('0x69'),_0x590b('0x6a')],'where':_0x1c14bf,'order':_0x4d16a1,'transaction':_0x5eb081,'lock':_0x5eb081['LOCK'][_0x590b('0x6b')],'include':[{'model':db[_0x590b('0x4e')],'as':_0x590b('0x6c'),'attributes':_0x3ef6d3,'include':[{'model':db['CmCompany'],'as':_0x590b('0x6d'),'attributes':['id','name']}]},{'model':db[_0x590b('0x6e')],'as':'List','attributes':['id','name']},{'model':db[_0x590b('0x41')],'as':_0x590b('0x6f'),'attributes':['id','name',_0x590b('0x70')]}]})[_0x590b('0xd')](function(_0x397a00){if(_0x397a00){return _0x397a00[_0x590b('0xc')]({'UserId':_0xc22794['user']['id']},{'transaction':_0x5eb081});}});});}})[_0x590b('0xd')](handleEntityNotFound(_0x426470,null))[_0x590b('0xd')](respondWithResult(_0x426470,null))[_0x590b('0x34')](handleError(_0x426470,null));};exports[_0x590b('0x71')]=function(_0x1be3fc,_0x319b9c,_0x251272){var _0xfa8e7d=[];var _0x421547=_0x1be3fc['params']['id'];var _0x4b81f=_0x1be3fc['user']['id'];return db[_0x590b('0x4e')][_0x590b('0x3e')]()[_0x590b('0xd')](function(_0x3859f6){_0xfa8e7d=_['keys'](_0x3859f6);return db[_0x590b('0x66')][_0x590b('0x5c')](function(_0x1e0778){const _0x5411ac={'id':_0x421547};return db[_0x590b('0x13')][_0x590b('0x72')]({'attributes':['id',_0x590b('0x73'),_0x590b('0x6a')],'where':_0x5411ac,'transaction':_0x1e0778,'lock':_0x1e0778[_0x590b('0x74')]['UPDATE'],'include':[{'model':db[_0x590b('0x4e')],'as':_0x590b('0x6c'),'attributes':_0xfa8e7d,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0x590b('0x6e')],'as':_0x590b('0x75'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x590b('0x6f'),'attributes':['id','name',_0x590b('0x70')]}]})[_0x590b('0xd')](function(_0x21be96){if(_0x21be96){return _0x21be96['update']({'UserId':_0x4b81f},{'transaction':_0x1e0778});}});});})[_0x590b('0xd')](handleEntityNotFound(_0x319b9c,null))[_0x590b('0xd')](respondWithResult(_0x319b9c,null))[_0x590b('0x34')](handleError(_0x319b9c,null));};exports['getOpenContacts']=function(_0x18b10f,_0x3d1617){return _0x18b10f[_0x590b('0x58')]['getVoiceQueues']({'where':{'type':_0x590b('0x5a'),'dialActive':!![],'dialMethod':_0x590b('0x76')},'attributes':['id'],'raw':!![]})[_0x590b('0xd')](function(_0x31c37b){if(_0x31c37b&&_0x31c37b['length']){return db[_0x590b('0x13')][_0x590b('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x590b('0x49')](_0x590b('0x5d'))},'VoiceQueueId':{'$in':_[_0x590b('0x18')](_0x31c37b,'id')},'$or':[{'UserId':null},{'UserId':_0x18b10f[_0x590b('0x58')]['id']}]}});}return 0x0;})['then'](function(_0x20baa9){if(!_[_0x590b('0x52')](_0x20baa9)&&_[_0x590b('0x77')](_0x20baa9)){return _0x3d1617[_0x590b('0x57')](0xc8)[_0x590b('0x5')]({'contacts':_0x20baa9});}else{logger['error'](_0x590b('0x78'),_0x590b('0x79'),0x194,_0x590b('0x7a'));_0x3d1617['sendStatus'](0x194);}})['catch'](handleError(_0x3d1617,null));};exports[_0x590b('0x7b')]=function(_0x1c3797,_0x3c6dd5){var _0x4b0c5d=shared[_0x590b('0x7c')];var _0x4b5870=[];_[_0x590b('0x18')](_0x4b0c5d,function(_0x616cdf){_0x4b5870['push']({'id':_0x616cdf[_0x590b('0x11')],'name':_0x616cdf[_0x590b('0x11')],'utcOffset':_0x616cdf['utcOffset']});});return _0x3c6dd5[_0x590b('0x57')](0xc8)[_0x590b('0x5')]({'tz':_0x4b5870});};exports[_0x590b('0x7d')]=function(_0x1f17f2,_0x16dea7){var _0x6281dc=shared['timezones'];var _0x1d8bdf={};if(!_[_0x590b('0x52')](_0x6281dc[_0x1f17f2['body']['id']]))_0x1d8bdf=_0x6281dc[_0x1f17f2[_0x590b('0x3d')]['id']];return _0x16dea7[_0x590b('0x57')](0xc8)[_0x590b('0x5')](_0x1d8bdf);}; \ No newline at end of file +var _0x4c4e=['options','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','scheduledAt','sequelize','findOne','scheduledat','phone','LOCK','UPDATE','Company','CmList','List','Queue','dialActive','recallme','Contact','getOpenContacts','getVoiceQueues','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','then','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','intersection','concat','$gt','$lt','$ne','$not','$notBetween','$iLike','$overlap','$contains','attributes','fields','length','sort','where','pick','filter','merge'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x4c4e,0x152));var _0xe4c4=function(_0x490096,_0x557617){_0x490096=_0x490096-0x0;var _0x5b04f6=_0x4c4e[_0x490096];return _0x5b04f6;};'use strict';var moment=require(_0xe4c4('0x0'));var _=require('lodash');var qs=require(_0xe4c4('0x1'));var logger=require(_0xe4c4('0x2'))(_0xe4c4('0x3'));var shared=require('../../config/environment');var db=require(_0xe4c4('0x4'))['db'];function respondWithResult(_0x7d7655,_0x1a4483){_0x1a4483=_0x1a4483||0xc8;return function(_0x4cd652){if(_0x4cd652){return _0x7d7655[_0xe4c4('0x5')](_0x1a4483)['json'](_0x4cd652);}};}function respondWithFilteredResult(_0x177732,_0x1a12a6){return function(_0x262b64){if(_0x262b64){var _0xad105=typeof _0x1a12a6[_0xe4c4('0x6')]===_0xe4c4('0x7')&&typeof _0x1a12a6[_0xe4c4('0x8')]===_0xe4c4('0x7');var _0x4c953c=_0x262b64['count'];var _0x31f879=_0xad105?0x0:_0x1a12a6[_0xe4c4('0x6')];var _0x27ad42=_0xad105?_0x262b64[_0xe4c4('0x9')]:_0x1a12a6[_0xe4c4('0x6')]+_0x1a12a6[_0xe4c4('0x8')];var _0x50264f;if(_0x27ad42>=_0x4c953c){_0x27ad42=_0x4c953c;_0x50264f=0xc8;}else{_0x50264f=0xce;}_0x177732[_0xe4c4('0x5')](_0x50264f);return _0x177732[_0xe4c4('0xa')](_0xe4c4('0xb'),_0x31f879+'-'+_0x27ad42+'/'+_0x4c953c)[_0xe4c4('0xc')](_0x262b64);}return null;};}function saveUpdates(_0x50bfab,_0x262083){return function(_0x115802){if(_0x115802){return _0x115802['update'](_0x50bfab)[_0xe4c4('0xd')](function(_0x1a44e5){return _0x1a44e5;});}return null;};}function handleEntityNotFound(_0x5aa89b,_0x42ce9e){return function(_0x29766a){if(!_0x29766a){_0x5aa89b['sendStatus'](0x194);}return _0x29766a;};}function handleError(_0x307aa8,_0x465c9b){_0x465c9b=_0x465c9b||0x1f4;return function(_0x26ea05){logger[_0xe4c4('0xe')](_0x26ea05[_0xe4c4('0xf')]);if(_0x26ea05[_0xe4c4('0x10')]){delete _0x26ea05[_0xe4c4('0x10')];}_0x307aa8[_0xe4c4('0x5')](_0x465c9b)[_0xe4c4('0x11')](_0x26ea05);};}exports[_0xe4c4('0x12')]=function(_0x23b7e6,_0x42242c){var _0x3820c7={},_0x43a9ce={},_0x376585={'count':0x0,'rows':[]};var _0x5a32b5=_[_0xe4c4('0x13')](db[_0xe4c4('0x14')][_0xe4c4('0x15')],function(_0x317cc8){return{'name':_0x317cc8['fieldName'],'type':_0x317cc8[_0xe4c4('0x16')][_0xe4c4('0x17')]};});_0x43a9ce[_0xe4c4('0x18')]=_[_0xe4c4('0x13')](_0x5a32b5,_0xe4c4('0x10'));_0x43a9ce[_0xe4c4('0x19')]=_[_0xe4c4('0x1a')](_0x23b7e6[_0xe4c4('0x19')]);_0x43a9ce[_0xe4c4('0x1b')]=_[_0xe4c4('0x1c')](_0x43a9ce[_0xe4c4('0x18')],_0x43a9ce[_0xe4c4('0x19')]);_0x43a9ce[_0xe4c4('0x1b')]=_[_0xe4c4('0x1d')](_0x43a9ce[_0xe4c4('0x1b')],['$and','$or',_0xe4c4('0x1e'),'$gte',_0xe4c4('0x1f'),'$lte',_0xe4c4('0x20'),'$eq',_0xe4c4('0x21'),'$between',_0xe4c4('0x22'),'$in','$notIn','$like','$notLike',_0xe4c4('0x23'),'$notILike','$like',_0xe4c4('0x24'),_0xe4c4('0x25'),'$contained','$any']);_0x3820c7[_0xe4c4('0x26')]=_[_0xe4c4('0x1c')](_0x43a9ce['model'],qs[_0xe4c4('0x27')](_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x27')]));_0x3820c7['attributes']=_0x3820c7['attributes'][_0xe4c4('0x28')]?_0x3820c7[_0xe4c4('0x26')]:_0x43a9ce[_0xe4c4('0x18')];if(!_0x23b7e6[_0xe4c4('0x19')]['hasOwnProperty']('nolimit')){_0x3820c7[_0xe4c4('0x8')]=qs[_0xe4c4('0x8')](_0x23b7e6['query'][_0xe4c4('0x8')]);_0x3820c7[_0xe4c4('0x6')]=qs[_0xe4c4('0x6')](_0x23b7e6['query'][_0xe4c4('0x6')]);}_0x3820c7['order']=qs[_0xe4c4('0x29')](_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x29')]);_0x3820c7[_0xe4c4('0x2a')]=qs[_0xe4c4('0x1b')](_[_0xe4c4('0x2b')](_0x23b7e6[_0xe4c4('0x19')],_0x43a9ce[_0xe4c4('0x1b')]),_0x5a32b5);if(_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x2c')]){_0x3820c7[_0xe4c4('0x2a')]=_[_0xe4c4('0x2d')](_0x3820c7['where'],{'$or':_[_0xe4c4('0x13')](_0x5a32b5,function(_0x25eb81){if(_0x25eb81[_0xe4c4('0x16')]!=='VIRTUAL'){var _0xac6cb4={};_0xac6cb4[_0x25eb81[_0xe4c4('0x10')]]={'$like':'%'+_0x23b7e6[_0xe4c4('0x19')]['filter']+'%'};return _0xac6cb4;}})});}_0x3820c7=_[_0xe4c4('0x2d')]({},_0x3820c7,_0x23b7e6[_0xe4c4('0x2e')]);var _0x4a3644={'where':_0x3820c7[_0xe4c4('0x2a')]};return db[_0xe4c4('0x14')][_0xe4c4('0x9')](_0x4a3644)[_0xe4c4('0xd')](function(_0x44f4eb){_0x376585[_0xe4c4('0x9')]=_0x44f4eb;if(_0x23b7e6[_0xe4c4('0x19')]['includeAll']){_0x3820c7[_0xe4c4('0x2f')]=[{'all':!![]}];}return db[_0xe4c4('0x14')][_0xe4c4('0x30')](_0x3820c7);})[_0xe4c4('0xd')](function(_0x4c5551){_0x376585[_0xe4c4('0x31')]=_0x4c5551;return _0x376585;})[_0xe4c4('0xd')](respondWithFilteredResult(_0x42242c,_0x3820c7))['catch'](handleError(_0x42242c,null));};exports[_0xe4c4('0x32')]=function(_0x185959,_0x4db15d){var _0x433f0c={'raw':!![],'where':{'id':_0x185959[_0xe4c4('0x33')]['id']}},_0x3cd4d3={};_0x3cd4d3[_0xe4c4('0x18')]=_[_0xe4c4('0x1a')](db[_0xe4c4('0x14')][_0xe4c4('0x15')]);_0x3cd4d3[_0xe4c4('0x19')]=_[_0xe4c4('0x1a')](_0x185959[_0xe4c4('0x19')]);_0x3cd4d3[_0xe4c4('0x1b')]=_[_0xe4c4('0x1c')](_0x3cd4d3['model'],_0x3cd4d3[_0xe4c4('0x19')]);_0x433f0c[_0xe4c4('0x26')]=_[_0xe4c4('0x1c')](_0x3cd4d3[_0xe4c4('0x18')],qs[_0xe4c4('0x27')](_0x185959[_0xe4c4('0x19')]['fields']));_0x433f0c[_0xe4c4('0x26')]=_0x433f0c['attributes'][_0xe4c4('0x28')]?_0x433f0c[_0xe4c4('0x26')]:_0x3cd4d3[_0xe4c4('0x18')];if(_0x185959[_0xe4c4('0x19')][_0xe4c4('0x34')]){_0x433f0c['include']=[{'all':!![]}];}_0x433f0c=_['merge']({},_0x433f0c,_0x185959[_0xe4c4('0x2e')]);return db[_0xe4c4('0x14')][_0xe4c4('0x35')](_0x433f0c)['then'](handleEntityNotFound(_0x4db15d,null))[_0xe4c4('0xd')](respondWithResult(_0x4db15d,null))[_0xe4c4('0x36')](handleError(_0x4db15d,null));};exports[_0xe4c4('0x37')]=function(_0x36e7b1,_0x54e073){return db[_0xe4c4('0x14')][_0xe4c4('0x37')](_0x36e7b1[_0xe4c4('0x38')],{})[_0xe4c4('0xd')](respondWithResult(_0x54e073,0xc9))[_0xe4c4('0x36')](handleError(_0x54e073,null));};exports[_0xe4c4('0x39')]=function(_0x1eda5e,_0x176712){if(_0x1eda5e[_0xe4c4('0x38')]['id']){delete _0x1eda5e['body']['id'];}return db[_0xe4c4('0x14')]['find']({'where':{'id':_0x1eda5e[_0xe4c4('0x33')]['id']}})[_0xe4c4('0xd')](handleEntityNotFound(_0x176712,null))[_0xe4c4('0xd')](saveUpdates(_0x1eda5e[_0xe4c4('0x38')],null))[_0xe4c4('0xd')](respondWithResult(_0x176712,null))[_0xe4c4('0x36')](handleError(_0x176712,null));};exports[_0xe4c4('0x3a')]=function(_0xeb6432,_0x36f8ad){return db[_0xe4c4('0x14')][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](respondWithResult(_0x36f8ad,null))[_0xe4c4('0x36')](handleError(_0x36f8ad,null));};exports[_0xe4c4('0x3b')]=function(_0x535bcc,_0x4922f5){var _0xe0e351;var _0x198961=_0x535bcc['params']['id'];return db[_0xe4c4('0x14')][_0xe4c4('0x35')]({'where':{'id':_0x535bcc[_0xe4c4('0x33')]['id']}})[_0xe4c4('0xd')](handleEntityNotFound(_0x4922f5,null))[_0xe4c4('0xd')](function(_0x5587b2){if(_0x5587b2){return _0x5587b2[_0xe4c4('0x3b')]()[_0xe4c4('0xd')](function(_0x4f6e03){return _0x4f6e03;});}})[_0xe4c4('0xd')](function(_0x24b0e7){_0xe0e351=_0x24b0e7;if(_0x24b0e7){if(_0x24b0e7['VoiceQueueId']||_0x24b0e7[_0xe4c4('0x3c')]){return db[_0x24b0e7['VoiceQueueId']?_0xe4c4('0x3d'):_0xe4c4('0x3e')][_0xe4c4('0x35')]({'where':{'id':_0x24b0e7[_0xe4c4('0x3f')]?_0x24b0e7[_0xe4c4('0x3f')]:_0x24b0e7['CampaignId']},'attributes':['id',_0xe4c4('0x10')],'raw':!![]});}}})[_0xe4c4('0xd')](function(_0x33bcec){var _0x2350d7={};if(_0x33bcec){_[_0xe4c4('0x2d')](_0x2350d7,_[_0xe4c4('0x40')](_0xe0e351[_0xe4c4('0x41')],[_0xe4c4('0x42'),_0xe4c4('0x43'),'id']));_0x2350d7[_0xe4c4('0x44')]=0x15;_0x2350d7[_0xe4c4('0x45')]=_0xe4c4('0x46');_0x2350d7[_0xe4c4('0x47')]=_0x33bcec[_0xe4c4('0x10')];_0x2350d7[_0xe4c4('0x48')]=_0x535bcc[_0xe4c4('0x49')]['name'];_0x2350d7[_0xe4c4('0x4a')]=_0x535bcc[_0xe4c4('0x49')]['id'];_0x2350d7[_0xe4c4('0x46')]=!![];_0x2350d7['deletedat']=moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'));_0x2350d7[_0xe4c4('0x4d')]=_0xe0e351['phone'];_0x2350d7[_0xe4c4('0x4e')]=_0xe0e351['VoiceQueueId']?_0xe4c4('0x4f'):_0xe4c4('0x50');return db[_0xe4c4('0x51')]['find']({'where':{'id':_0x2350d7['ContactId']},'attributes':[_0xe4c4('0x52'),_0xe4c4('0x53')]})[_0xe4c4('0xd')](function(_0x5edcae){if(!_[_0xe4c4('0x54')](_0x4922f5)&&!_['isNil'](_0x5edcae['firstName'])){_0x2350d7['calleridname']=_0x5edcae['firstName'];if(!_[_0xe4c4('0x54')](_0x5edcae[_0xe4c4('0x53')])){_0x2350d7[_0xe4c4('0x55')]+='\x20'+_0x5edcae[_0xe4c4('0x53')];}}})[_0xe4c4('0x56')](function(){return db[_0xe4c4('0x57')]['create'](_0x2350d7);});}})[_0xe4c4('0xd')](function(_0x44eb3b){return db[_0xe4c4('0x58')][_0xe4c4('0x3b')]({'where':{'CmHopperId':_0x198961}});})[_0xe4c4('0xd')](function(){return _0x4922f5[_0xe4c4('0x5')](0xcc)['end']();})['catch'](handleError(_0x4922f5,null));};exports[_0xe4c4('0x59')]=function(_0x6f374e,_0x1986ab){var _0x3c8e44=[];return db[_0xe4c4('0x51')][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](function(_0x24e1a2){_0x3c8e44=_[_0xe4c4('0x1a')](_0x24e1a2);return _0x6f374e['user']['getVoiceQueues']({'where':{'type':_0xe4c4('0x5a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xe4c4('0x5b'),_0xe4c4('0x5c')],'raw':!![]});})[_0xe4c4('0xd')](function(_0x58f2dd){if(_0x58f2dd&&_0x58f2dd[_0xe4c4('0x28')]){return db['sequelize'][_0xe4c4('0x5d')](function(_0x56ead3){var _0x5d6c0a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'))},'VoiceQueueId':{'$in':_[_0xe4c4('0x13')](_0x58f2dd,'id')},'$or':[{'UserId':null},{'UserId':_0x6f374e['user']['id']}]};var _0x57e38e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x58f2dd)['filter']([_0xe4c4('0x5c'),0x0])[_0xe4c4('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x6f374e[_0xe4c4('0x49')]['id']}]};var _0x3850da={'$or':[_0x5d6c0a,_0x57e38e]};var _0x11115a=[];if(_0x6f374e['body']['direction']&&_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x5e')]===_0xe4c4('0x5f')){if(!_[_0xe4c4('0x60')](_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')])){_0x3850da['id']={'$in':_0x6f374e['body'][_0xe4c4('0x61')]};}_0x11115a=[[_0xe4c4('0x62'),_0xe4c4('0x63')],['scheduledAt',_0x58f2dd[0x0][_0xe4c4('0x5b')]===_0xe4c4('0x63')?_0xe4c4('0x64'):'ASC'],db['sequelize'][_0xe4c4('0x65')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xe4c4('0x60')](_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')])){_0x3850da['id']={'$notIn':_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')]};}_0x11115a=[[_0xe4c4('0x62'),_0xe4c4('0x64')],[_0xe4c4('0x66'),_0x58f2dd[0x0]['dialOrderByScheduledAt']],db[_0xe4c4('0x67')][_0xe4c4('0x65')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xe4c4('0x14')][_0xe4c4('0x68')]({'attributes':['id',_0xe4c4('0x69'),_0xe4c4('0x6a'),'recallme'],'where':_0x3850da,'order':_0x11115a,'transaction':_0x56ead3,'lock':_0x56ead3[_0xe4c4('0x6b')][_0xe4c4('0x6c')],'include':[{'model':db[_0xe4c4('0x51')],'as':'Contact','attributes':_0x3c8e44,'include':[{'model':db['CmCompany'],'as':_0xe4c4('0x6d'),'attributes':['id',_0xe4c4('0x10')]}]},{'model':db[_0xe4c4('0x6e')],'as':_0xe4c4('0x6f'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xe4c4('0x70'),'attributes':['id',_0xe4c4('0x10'),_0xe4c4('0x71')]}]})[_0xe4c4('0xd')](function(_0x1c9f4b){if(_0x1c9f4b){return _0x1c9f4b['update']({'UserId':_0x6f374e[_0xe4c4('0x49')]['id']},{'transaction':_0x56ead3});}});});}})['then'](handleEntityNotFound(_0x1986ab,null))[_0xe4c4('0xd')](respondWithResult(_0x1986ab,null))[_0xe4c4('0x36')](handleError(_0x1986ab,null));};exports['getPreviewRecall']=function(_0x570f1f,_0x4eddfd,_0x279075){var _0x250bb8=[];var _0x1f880f=_0x570f1f[_0xe4c4('0x33')]['id'];var _0x5b41e6=_0x570f1f['user']['id'];return db['CmContact'][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](function(_0x4c10ef){_0x250bb8=_[_0xe4c4('0x1a')](_0x4c10ef);return db[_0xe4c4('0x67')][_0xe4c4('0x5d')](function(_0xb0a006){const _0x5cbc28={'id':_0x1f880f};return db['CmHopper'][_0xe4c4('0x68')]({'attributes':['id',_0xe4c4('0x69'),_0xe4c4('0x72')],'where':_0x5cbc28,'transaction':_0xb0a006,'lock':_0xb0a006[_0xe4c4('0x6b')][_0xe4c4('0x6c')],'include':[{'model':db[_0xe4c4('0x51')],'as':_0xe4c4('0x73'),'attributes':_0x250bb8,'include':[{'model':db['CmCompany'],'as':_0xe4c4('0x6d'),'attributes':['id',_0xe4c4('0x10')]}]},{'model':db[_0xe4c4('0x6e')],'as':_0xe4c4('0x6f'),'attributes':['id','name']},{'model':db[_0xe4c4('0x3d')],'as':_0xe4c4('0x70'),'attributes':['id',_0xe4c4('0x10'),_0xe4c4('0x71')]}]})['then'](function(_0x209602){if(_0x209602){return _0x209602[_0xe4c4('0x39')]({'UserId':_0x5b41e6},{'transaction':_0xb0a006});}});});})['then'](handleEntityNotFound(_0x4eddfd,null))['then'](respondWithResult(_0x4eddfd,null))[_0xe4c4('0x36')](handleError(_0x4eddfd,null));};exports[_0xe4c4('0x74')]=function(_0x3314d6,_0xe30faf){return _0x3314d6[_0xe4c4('0x49')][_0xe4c4('0x75')]({'where':{'type':_0xe4c4('0x5a'),'dialActive':!![],'dialMethod':_0xe4c4('0x76')},'attributes':['id'],'raw':!![]})['then'](function(_0x5ae9f0){if(_0x5ae9f0&&_0x5ae9f0[_0xe4c4('0x28')]){return db[_0xe4c4('0x14')][_0xe4c4('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'))},'VoiceQueueId':{'$in':_['map'](_0x5ae9f0,'id')},'$or':[{'UserId':null},{'UserId':_0x3314d6[_0xe4c4('0x49')]['id']}]}});}return 0x0;})[_0xe4c4('0xd')](function(_0x425f38){if(!_[_0xe4c4('0x54')](_0x425f38)&&_[_0xe4c4('0x77')](_0x425f38)){return _0xe30faf[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')]({'contacts':_0x425f38});}else{logger[_0xe4c4('0xe')](_0xe4c4('0x78'),_0xe4c4('0x74'),0x194,_0xe4c4('0x79'));_0xe30faf[_0xe4c4('0x7a')](0x194);}})[_0xe4c4('0x36')](handleError(_0xe30faf,null));};exports[_0xe4c4('0x7b')]=function(_0x1ccdb2,_0x1295a4){var _0x52c3e0=shared['timezones'];var _0x340983=[];_['map'](_0x52c3e0,function(_0x46de38){_0x340983[_0xe4c4('0x7c')]({'id':_0x46de38[_0xe4c4('0x10')],'name':_0x46de38[_0xe4c4('0x10')],'utcOffset':_0x46de38[_0xe4c4('0x7d')]});});return _0x1295a4[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')]({'tz':_0x340983});};exports[_0xe4c4('0x7e')]=function(_0x371947,_0x1579fe){var _0x37bf48=shared[_0xe4c4('0x7f')];var _0x3030f6={};if(!_['isNil'](_0x37bf48[_0x371947[_0xe4c4('0x38')]['id']]))_0x3030f6=_0x37bf48[_0x371947[_0xe4c4('0x38')]['id']];return _0x1579fe[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')](_0x3030f6);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4e9bca0..fa2d497 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','priority','lodash'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x326f,0xd1));var _0xf326=function(_0x39c7fc,_0x11c427){_0x39c7fc=_0x39c7fc-0x0;var _0x1a33ee=_0x326f[_0x39c7fc];return _0x1a33ee;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0xf326('0xe'),'fields':[_0xf326('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['util','../../config/logger','api','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','phone'];(function(_0x268f54,_0x168e53){var _0x39039b=function(_0x51ddb4){while(--_0x51ddb4){_0x268f54['push'](_0x268f54['shift']());}};_0x39039b(++_0x168e53);}(_0x038b,0x114));var _0xb038=function(_0x35d559,_0x5830ab){_0x35d559=_0x35d559-0x0;var _0x285e99=_0x038b[_0x35d559];return _0x285e99;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xb038('0xb'),'fields':[_0xb038('0xb')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e3700e3..cfb984f 100644 --- a/server/api/cmHopper/cmHopper.rpc.js +++ b/server/api/cmHopper/cmHopper.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x249d=['model','then','info','debug','stringify','catch','error','message','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','voicePause','length','UserId','push','update','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','findOne','dialTimezone','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','literal','name','CmList','List','NOW()','CmHopperHandlePreviewRecallNotifications','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x120d30,_0x1d818c){var _0x388624=function(_0x42a959){while(--_0x42a959){_0x120d30['push'](_0x120d30['shift']());}};_0x388624(++_0x1d818c);}(_0x249d,0x126));var _0xd249=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x249d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd249('0x0'));var BPromise=require(_0xd249('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xd249('0x2'))(_0xd249('0x3'));exports[_0xd249('0x4')]=function(_0x1c620b){var _0x3cf037=this;return new Promise(function(_0x88d25d,_0x47cb4b){return db[_0xd249('0x5')][_0xd249('0x6')]({'raw':_0x1c620b[_0xd249('0x7')]?_0x1c620b['options'][_0xd249('0x8')]===undefined?!![]:![]:!![],'where':_0x1c620b['options']?_0x1c620b[_0xd249('0x7')][_0xd249('0x9')]||null:null,'attributes':_0x1c620b['options']?_0x1c620b[_0xd249('0x7')][_0xd249('0xa')]||null:null,'limit':_0x1c620b[_0xd249('0x7')]?_0x1c620b[_0xd249('0x7')][_0xd249('0xb')]||null:null,'include':_0x1c620b['options']?_0x1c620b[_0xd249('0x7')][_0xd249('0xc')]?_[_0xd249('0xd')](_0x1c620b[_0xd249('0x7')][_0xd249('0xc')],function(_0x1fac21){return{'model':db[_0x1fac21[_0xd249('0xe')]],'as':_0x1fac21['as'],'attributes':_0x1fac21[_0xd249('0xa')],'include':_0x1fac21[_0xd249('0xc')]?_[_0xd249('0xd')](_0x1fac21[_0xd249('0xc')],function(_0x4d8e59){return{'model':db[_0x4d8e59[_0xd249('0xe')]],'as':_0x4d8e59['as'],'attributes':_0x4d8e59[_0xd249('0xa')],'include':_0x4d8e59['include']?_['map'](_0x4d8e59['include'],function(_0x1a5dbd){return{'model':db[_0x1a5dbd[_0xd249('0xe')]],'as':_0x1a5dbd['as'],'attributes':_0x1a5dbd['attributes']};}):[]};}):[]};}):[]:[]})[_0xd249('0xf')](function(_0x988323){logger[_0xd249('0x10')](_0xd249('0x4'),_0x1c620b);logger[_0xd249('0x11')]('GetCmHopper',_0x1c620b,JSON[_0xd249('0x12')](_0x988323));_0x88d25d(_0x988323);})[_0xd249('0x13')](function(_0x1a6f5e){logger[_0xd249('0x14')](_0xd249('0x4'),_0x1a6f5e[_0xd249('0x15')],_0x1c620b);_0x47cb4b(_0x3cf037[_0xd249('0x14')](0x1f4,_0x1a6f5e[_0xd249('0x15')]));});});};exports[_0xd249('0x16')]=function(_0x3ac691){var _0x25474f=this;return new Promise(function(_0x256bf5,_0x126241){return db[_0xd249('0x5')]['find']({'raw':_0x3ac691[_0xd249('0x7')]?_0x3ac691['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ac691[_0xd249('0x7')]?_0x3ac691[_0xd249('0x7')][_0xd249('0x9')]||null:null,'attributes':_0x3ac691[_0xd249('0x7')]?_0x3ac691[_0xd249('0x7')][_0xd249('0xa')]||null:null,'include':_0x3ac691[_0xd249('0x7')]?_0x3ac691['options'][_0xd249('0xc')]?_[_0xd249('0xd')](_0x3ac691[_0xd249('0x7')][_0xd249('0xc')],function(_0x3483ff){return{'model':db[_0x3483ff['model']],'as':_0x3483ff['as'],'attributes':_0x3483ff[_0xd249('0xa')],'include':_0x3483ff['include']?_[_0xd249('0xd')](_0x3483ff['include'],function(_0x5a4707){return{'model':db[_0x5a4707[_0xd249('0xe')]],'as':_0x5a4707['as'],'attributes':_0x5a4707[_0xd249('0xa')],'include':_0x5a4707[_0xd249('0xc')]?_[_0xd249('0xd')](_0x5a4707['include'],function(_0x301979){return{'model':db[_0x301979[_0xd249('0xe')]],'as':_0x301979['as'],'attributes':_0x301979['attributes']};}):[]};}):[]};}):[]:[]})[_0xd249('0xf')](function(_0xbea04a){logger[_0xd249('0x10')](_0xd249('0x16'),_0x3ac691);logger[_0xd249('0x11')](_0xd249('0x16'),_0x3ac691,JSON[_0xd249('0x12')](_0xbea04a));_0x256bf5(_0xbea04a);})[_0xd249('0x13')](function(_0x4ec2a9){logger['error'](_0xd249('0x16'),_0x4ec2a9['message'],_0x3ac691);_0x126241(_0x25474f['error'](0x1f4,_0x4ec2a9['message']));});});};exports['CreateCmHopper']=function(_0x38ad52){var _0x206ba4=this;return new Promise(function(_0x9fb330,_0x2cec16){return db['CmHopper'][_0xd249('0x17')](_0x38ad52[_0xd249('0x18')],{'raw':_0x38ad52[_0xd249('0x7')]?_0x38ad52[_0xd249('0x7')][_0xd249('0x8')]===undefined?!![]:![]:!![]})[_0xd249('0xf')](function(_0x1d2553){logger[_0xd249('0x10')](_0xd249('0x19'),_0x38ad52);logger[_0xd249('0x11')]('CreateCmHopper',_0x38ad52,JSON[_0xd249('0x12')](_0x1d2553));_0x9fb330(_0x1d2553);})['catch'](function(_0x53de79){logger[_0xd249('0x14')]('CreateCmHopper',_0x53de79[_0xd249('0x15')],_0x38ad52);_0x2cec16(_0x206ba4[_0xd249('0x14')](0x1f4,_0x53de79[_0xd249('0x15')]));});});};exports['UpdateCmHopper']=function(_0x5d10f9){var _0x577bb3=this;return new Promise(function(_0x605c7d,_0x5e295b){return db['CmHopper']['update'](_0x5d10f9['body'],{'raw':_0x5d10f9[_0xd249('0x7')]?_0x5d10f9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d10f9[_0xd249('0x7')]?_0x5d10f9[_0xd249('0x7')][_0xd249('0x9')]||null:null,'attributes':_0x5d10f9[_0xd249('0x7')]?_0x5d10f9[_0xd249('0x7')][_0xd249('0xa')]||null:null,'limit':_0x5d10f9[_0xd249('0x7')]?_0x5d10f9[_0xd249('0x7')]['limit']||null:null})[_0xd249('0xf')](function(_0x2edf87){logger[_0xd249('0x10')](_0xd249('0x1a'),_0x5d10f9);logger['info'](_0xd249('0x1b'),JSON[_0xd249('0x12')](_0x5d10f9[_0xd249('0x7')][_0xd249('0x9')]),_0x5d10f9[_0xd249('0x18')]['active']);logger[_0xd249('0x11')](_0xd249('0x1a'),_0x5d10f9,JSON[_0xd249('0x12')](_0x2edf87));_0x605c7d(_0x2edf87);})[_0xd249('0x13')](function(_0x5b9409){logger[_0xd249('0x14')]('UpdateCmHopper',_0x5b9409[_0xd249('0x15')],_0x5d10f9);_0x5e295b(_0x577bb3[_0xd249('0x14')](0x1f4,_0x5b9409[_0xd249('0x15')]));});});};exports[_0xd249('0x1c')]=function(_0x36c05e){var _0x15a49f=this;return new Promise(function(_0x710531,_0x453d29){return db[_0xd249('0x5')][_0xd249('0x1d')]({'where':_0x36c05e[_0xd249('0x7')]?_0x36c05e[_0xd249('0x7')]['where']||null:null})['then'](function(_0x1b4d37){logger[_0xd249('0x10')](_0xd249('0x1c'),_0x36c05e);logger['debug'](_0xd249('0x1c'),_0x36c05e,JSON['stringify'](_0x1b4d37));_0x710531(_0x1b4d37);})[_0xd249('0x13')](function(_0x4adc94){logger[_0xd249('0x14')](_0xd249('0x1c'),_0x4adc94[_0xd249('0x15')],_0x36c05e);_0x453d29(_0x15a49f[_0xd249('0x14')](0x1f4,_0x4adc94['message']));});});};exports[_0xd249('0x1e')]=function(_0x515890){var _0x34996f=this;return new Promise(function(_0x585830,_0x58f76a){return db[_0xd249('0x1f')][_0xd249('0x20')]()[_0xd249('0xf')](function(_0x38a8a6){return db[_0xd249('0x21')][_0xd249('0x22')](function(_0x2ffa9c){return db['CmHopper'][_0xd249('0x6')]({'where':_0x515890[_0xd249('0x7')]?_0x515890[_0xd249('0x7')][_0xd249('0x9')]||null:null,'attributes':_0x515890[_0xd249('0x7')]?_0x515890[_0xd249('0x7')]['attributes']||null:null,'limit':_0x515890[_0xd249('0x7')]?_0x515890[_0xd249('0x7')][_0xd249('0xb')]||null:null,'order':_0x515890['options']?_0x515890[_0xd249('0x7')][_0xd249('0x23')]||null:null,'transaction':_0x2ffa9c,'lock':_0x2ffa9c[_0xd249('0x24')][_0xd249('0x25')],'include':[{'model':db['CmContact'],'as':_0xd249('0x26'),'attributes':_[_0xd249('0x27')](_0x38a8a6)},{'model':db[_0xd249('0x28')],'as':_0xd249('0x29'),'attributes':['id','name',_0xd249('0x2a')]}]})[_0xd249('0xf')](function(_0x3f3621){var _0xa20f5c=[];var _0x211c78=[];for(var _0x105aed=0x0;_0x105aed<_0x3f3621[_0xd249('0x2b')];_0x105aed+=0x1){var _0x514286=_0x3f3621[_0x105aed][_0xd249('0x2c')];if(_0x514286===null){_0xa20f5c[_0xd249('0x2d')](_0x3f3621[_0x105aed]['update'](_0x515890[_0xd249('0x18')],{'transaction':_0x2ffa9c}));}else if(!_0x211c78['includes'](_0x514286)){_0x211c78[_0xd249('0x2d')](_0x514286);_0xa20f5c[_0xd249('0x2d')](_0x3f3621[_0x105aed][_0xd249('0x2e')](_0x515890['body'],{'transaction':_0x2ffa9c}));}}return BPromise[_0xd249('0x2f')](_0xa20f5c);});})['then'](function(_0x2db234){logger[_0xd249('0x10')](_0xd249('0x1e'),_0x515890);if(_0x2db234[_0xd249('0x2b')]>0x0){logger[_0xd249('0x10')](_0xd249('0x30'),_0x2db234[0x0][_0xd249('0x31')]['id'],_0x2db234[0x0][_0xd249('0x31')][_0xd249('0x32')],_0x2db234[0x0][_0xd249('0x31')][_0xd249('0x33')]);}logger['debug'](_0xd249('0x1e'),_0x515890,JSON[_0xd249('0x12')](_0x2db234));_0x585830(_0x2db234);})[_0xd249('0x13')](function(_0x1aacba){logger[_0xd249('0x14')](_0xd249('0x1e'),_0x1aacba['message'],_0x515890);_0x58f76a(_0x34996f[_0xd249('0x14')](0x1f4,_0x1aacba[_0xd249('0x15')]));});});});};exports[_0xd249('0x34')]=function(_0xe12936){var _0x337007=this;return new Promise(function(_0x292882,_0x1a6e0e){return db['sequelize'][_0xd249('0x22')](function(_0x3e4723){return db['CmHopperFinal'][_0xd249('0x17')](_0xe12936[_0xd249('0x18')],{'raw':_0xe12936[_0xd249('0x7')]?_0xe12936[_0xd249('0x7')][_0xd249('0x8')]===undefined?!![]:![]:!![],'transaction':_0x3e4723})[_0xd249('0xf')](function(){logger[_0xd249('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0xe12936[_0xd249('0x7')][_0xd249('0x9')]),_0xe12936[_0xd249('0x7')][_0xd249('0x9')][_0xd249('0x33')]);return db[_0xd249('0x5')][_0xd249('0x1d')]({'where':_0xe12936[_0xd249('0x7')]?_0xe12936[_0xd249('0x7')][_0xd249('0x9')]||null:null,'transaction':_0x3e4723});});})[_0xd249('0xf')](function(_0x3686ed){logger['info'](_0xd249('0x34'),_0xe12936);logger[_0xd249('0x11')](_0xd249('0x34'),_0xe12936,JSON[_0xd249('0x12')](_0x3686ed));_0x292882(_0x3686ed);})['catch'](function(_0x4de184){logger[_0xd249('0x14')]('MoveContactManagedDialer',_0x4de184['message'],_0xe12936);_0x1a6e0e(_0x337007[_0xd249('0x14')](0x1f4,_0x4de184[_0xd249('0x15')]));});});};exports[_0xd249('0x35')]=function(_0xeb01e1){var _0xb64106=this;return new Promise(function(_0x19f1c9,_0x7ddd68){return db['CmHopper']['findAll']({'raw':_0xeb01e1['options']?_0xeb01e1[_0xd249('0x7')][_0xd249('0x8')]===undefined?!![]:![]:!![],'where':_0xeb01e1[_0xd249('0x7')]?_0xeb01e1['options'][_0xd249('0x9')]||null:null,'attributes':[[db[_0xd249('0x21')]['fn'](_0xd249('0x36'),db['sequelize']['fn']('IF',db[_0xd249('0x21')]['literal'](_0xd249('0x37')+util[_0xd249('0x38')](_0xd249('0x39'),moment()[_0xd249('0x38')](_0xd249('0x3a')))+_0xd249('0x3b')))),_0xd249('0x3c')]]})[_0xd249('0xf')](function(_0x307cd5){logger[_0xd249('0x10')]('CountReScheduled',_0xeb01e1);logger[_0xd249('0x11')]('CountReScheduled',_0xeb01e1,JSON[_0xd249('0x12')](_0x307cd5));_0x19f1c9(_0x307cd5);})[_0xd249('0x13')](function(_0x7cbb83){logger[_0xd249('0x14')](_0xd249('0x35'),_0x7cbb83['message'],_0xeb01e1);_0x7ddd68(_0xb64106[_0xd249('0x14')](0x1f4,_0x7cbb83['message']));});});};exports[_0xd249('0x3d')]=function(_0x460b68){var _0x181750=this;return new Promise(function(_0x39b6e4,_0x2d28fe){return db[_0xd249('0x1f')]['describe']()[_0xd249('0xf')](function(){return db['sequelize']['transaction'](function(_0x4f6e7b){return db[_0xd249('0x5')][_0xd249('0x6')]({'where':_0x460b68[_0xd249('0x7')]?_0x460b68[_0xd249('0x7')][_0xd249('0x9')]||null:null,'attributes':_0x460b68[_0xd249('0x7')]?_0x460b68['options'][_0xd249('0xa')]||null:null,'limit':0x1,'order':_0x460b68['options']?_0x460b68[_0xd249('0x7')]['order']||null:null,'group':db[_0xd249('0x5')]['UserId'],'transaction':_0x4f6e7b,'lock':_0x4f6e7b[_0xd249('0x24')][_0xd249('0x25')],'include':_0x460b68['options']?_0x460b68[_0xd249('0x7')][_0xd249('0xc')]?_[_0xd249('0xd')](_0x460b68['options']['include'],function(_0x389571){return{'model':db[_0x389571[_0xd249('0xe')]],'as':_0x389571['as'],'attributes':_0x389571[_0xd249('0xa')],'include':_0x389571['include']?_[_0xd249('0xd')](_0x389571[_0xd249('0xc')],function(_0x369bfb){return{'model':db[_0x369bfb['model']],'as':_0x369bfb['as'],'attributes':_0x369bfb['attributes'],'include':_0x369bfb['include']?_[_0xd249('0xd')](_0x369bfb[_0xd249('0xc')],function(_0x4f01d4){return{'model':db[_0x4f01d4[_0xd249('0xe')]],'as':_0x4f01d4['as'],'attributes':_0x4f01d4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd249('0xf')](function(_0x320276){var _0x295379=[];for(var _0x3a0616=0x0;_0x3a0616<_0x320276[_0xd249('0x2b')];_0x3a0616+=0x1){_0x295379['push'](_0x320276[_0x3a0616][_0xd249('0x2e')](_0x460b68['body'],{'transaction':_0x4f6e7b}));}return BPromise[_0xd249('0x2f')](_0x295379);});})['then'](function(_0x3247ff){logger[_0xd249('0x10')](_0xd249('0x3d'),_0x460b68);logger[_0xd249('0x11')](_0xd249('0x3d'),_0x460b68,JSON[_0xd249('0x12')](_0x3247ff));_0x39b6e4(_0x3247ff);})[_0xd249('0x13')](function(_0x4e4ae8){logger[_0xd249('0x14')](_0xd249('0x3d'),_0x4e4ae8[_0xd249('0x15')],_0x460b68);_0x2d28fe(_0x181750[_0xd249('0x14')](0x1f4,_0x4e4ae8['message']));});});});};exports['GetCmHopperPreview']=function(_0x52b8b6){var _0x158df0=this;return new Promise(function(_0x588034,_0x18b644){db[_0xd249('0x1f')]['describe']()[_0xd249('0xf')](function(_0x3f5d6c){return db[_0xd249('0x5')]['findAll']({'raw':_0x52b8b6['options']?_0x52b8b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x52b8b6[_0xd249('0x7')]?_0x52b8b6[_0xd249('0x7')][_0xd249('0x9')]||null:null,'attributes':_0x52b8b6[_0xd249('0x7')]?_0x52b8b6['options'][_0xd249('0xa')]||null:null,'limit':_0x52b8b6[_0xd249('0x7')]?_0x52b8b6[_0xd249('0x7')][_0xd249('0xb')]||null:null,'include':_0x52b8b6[_0xd249('0x7')]?_0x52b8b6[_0xd249('0x7')][_0xd249('0xc')]?_[_0xd249('0xd')](_0x52b8b6['options'][_0xd249('0xc')],function(_0x190bdc){return{'model':db[_0x190bdc['model']],'as':_0x190bdc['as'],'attributes':_0x190bdc['as']===_0xd249('0x26')?_['keys'](_0x3f5d6c):_0x190bdc[_0xd249('0xa')],'include':_0x190bdc[_0xd249('0xc')]?_['map'](_0x190bdc[_0xd249('0xc')],function(_0x21592d){return{'model':db[_0x21592d[_0xd249('0xe')]],'as':_0x21592d['as'],'attributes':_0x21592d[_0xd249('0xa')],'include':_0x21592d[_0xd249('0xc')]?_[_0xd249('0xd')](_0x21592d[_0xd249('0xc')],function(_0x121294){return{'model':db[_0x121294[_0xd249('0xe')]],'as':_0x121294['as'],'attributes':_0x121294[_0xd249('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd249('0xf')](function(_0x5dfb70){logger[_0xd249('0x10')]('GetCmHopper',_0x52b8b6);logger['debug'](_0xd249('0x4'),_0x52b8b6,JSON[_0xd249('0x12')](_0x5dfb70));_0x588034(_0x5dfb70);})[_0xd249('0x13')](function(_0x4083bf){logger['error'](_0xd249('0x4'),_0x4083bf[_0xd249('0x15')],_0x52b8b6);_0x18b644(_0x158df0['error'](0x1f4,_0x4083bf[_0xd249('0x15')]));});});});};exports['GetContactByPhone']=function(_0x23a8a0){var _0x31689d=this;return new Promise(function(_0x2afe72,_0x532252){return db[_0xd249('0x1f')][_0xd249('0x3e')]({'raw':!![],'where':{'phone':_0x23a8a0['options'][_0xd249('0x9')]['phone']},'attributes':['id',_0xd249('0x3f')],'order':[['id','DESC']]})[_0xd249('0xf')](function(_0x12fe2f){logger['info'](_0xd249('0x40'),_0x23a8a0);logger[_0xd249('0x11')](_0xd249('0x40'),_0x23a8a0,JSON[_0xd249('0x12')](_0x12fe2f));_0x2afe72(_0x12fe2f);})[_0xd249('0x13')](function(_0x219f14){logger[_0xd249('0x14')](_0xd249('0x40'),_0x219f14[_0xd249('0x15')],_0x23a8a0);_0x532252(_0x31689d[_0xd249('0x14')](0x1f4,_0x219f14[_0xd249('0x15')]));});});};exports[_0xd249('0x41')]=function(_0x38023c){var _0x4817b5=this;return new Promise(function(_0x5d227b,_0x33d62f){return db['sequelize'][_0xd249('0x22')](function(_0x58d2aa){var _0x54091e=_0x38023c[_0xd249('0x7')]&&_0x38023c[_0xd249('0x7')]['where']?_0x38023c['options']['where']:{};return db[_0xd249('0x5')][_0xd249('0x2e')](_0x38023c[_0xd249('0x18')],{'where':_0x54091e,'transaction':_0x58d2aa})[_0xd249('0xf')](function(_0x41d4c0){logger[_0xd249('0x10')](_0xd249('0x41'),_0x38023c);logger['debug'](_0xd249('0x41'),_0x38023c,JSON[_0xd249('0x12')](_0x41d4c0));_0x5d227b(_0x41d4c0);})[_0xd249('0x13')](function(_0x204e7f){logger[_0xd249('0x14')](_0xd249('0x41'),_0x204e7f[_0xd249('0x15')],_0x38023c);_0x33d62f(_0x4817b5['error'](0x1f4,_0x204e7f[_0xd249('0x15')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0xd18b16){var _0x2b6928=this;var _0x1e3dd5=_0xd18b16['body'][_0xd249('0x9')][_0xd249('0x42')];var _0x37157d=_0xd18b16[_0xd249('0x18')]['where'][_0xd249('0x43')];var _0x3570e3=_0xd18b16['body']['where'][_0xd249('0x44')];return new Promise(function(_0x5d2761,_0xd9e5c5){return db['CmHopper'][_0xd249('0x6')]({'where':{'voiceQueueId':{'$in':_0x1e3dd5},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd249('0x21')]['literal'](_0xd249('0x45')+_0x37157d+_0xd249('0x46')),'$gt':db[_0xd249('0x21')][_0xd249('0x47')]('NOW()')}},'UserId':{'$in':_0x3570e3}},'include':[{'model':db[_0xd249('0x1f')],'as':_0xd249('0x26')},{'model':db['User'],'as':_0xd249('0x29'),'attributes':['id',_0xd249('0x48'),_0xd249('0x2a')]},{'model':db[_0xd249('0x49')],'as':_0xd249('0x4a')}]})[_0xd249('0xf')](function(_0xf4d15e){if(_0xf4d15e[_0xd249('0x2b')]>0x0){return db[_0xd249('0x21')][_0xd249('0x22')](function(_0x4bb378){return db[_0xd249('0x5')][_0xd249('0x2e')]({'recallmeNotifiedDate':db[_0xd249('0x21')][_0xd249('0x47')](_0xd249('0x4b'))},{'where':{'id':{'$in':_[_0xd249('0xd')](_0xf4d15e,'id')}},'transaction':_0x4bb378})[_0xd249('0xf')](function(){_0x5d2761(_0xf4d15e);})['catch'](function(_0x1fd033){logger['error'](_0xd249('0x4c'),_0x1fd033['message'],_0xd18b16);_0xd9e5c5(_0x2b6928[_0xd249('0x14')](0x1f4,_0x1fd033[_0xd249('0x15')]));});})[_0xd249('0x13')](function(_0x29f4b4){logger[_0xd249('0x14')](_0xd249('0x4c'),_0x29f4b4[_0xd249('0x15')],_0xd18b16);_0xd9e5c5(_0x2b6928[_0xd249('0x14')](0x1f4,_0x29f4b4[_0xd249('0x15')]));});}else{_0x5d2761(_0xf4d15e);}});});}; \ No newline at end of file +var _0xc7f4=['GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','all','GetContactRecallMe','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Contact','CmList','List','CmHopperHandlePreviewRecallNotifications','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','error','message','ShowCmHopper','then','info','catch','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','User','Agent','name','voicePause','length','UserId','push','update','includes'];(function(_0x3c14dc,_0x2a1e9b){var _0x16fb4a=function(_0x52fed1){while(--_0x52fed1){_0x3c14dc['push'](_0x3c14dc['shift']());}};_0x16fb4a(++_0x2a1e9b);}(_0xc7f4,0x10e));var _0x4c7f=function(_0x154f2c,_0x51f84c){_0x154f2c=_0x154f2c-0x0;var _0x11f849=_0xc7f4[_0x154f2c];return _0x11f849;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c7f('0x0'));var BPromise=require(_0x4c7f('0x1'));var db=require(_0x4c7f('0x2'))['db'];var logger=require('../../config/logger')(_0x4c7f('0x3'));exports[_0x4c7f('0x4')]=function(_0x491f3c){var _0x5557c5=this;return new Promise(function(_0x428ee0,_0x49e893){return db[_0x4c7f('0x5')][_0x4c7f('0x6')]({'raw':_0x491f3c['options']?_0x491f3c[_0x4c7f('0x7')][_0x4c7f('0x8')]===undefined?!![]:![]:!![],'where':_0x491f3c[_0x4c7f('0x7')]?_0x491f3c[_0x4c7f('0x7')][_0x4c7f('0x9')]||null:null,'attributes':_0x491f3c[_0x4c7f('0x7')]?_0x491f3c[_0x4c7f('0x7')][_0x4c7f('0xa')]||null:null,'limit':_0x491f3c[_0x4c7f('0x7')]?_0x491f3c['options'][_0x4c7f('0xb')]||null:null,'include':_0x491f3c[_0x4c7f('0x7')]?_0x491f3c[_0x4c7f('0x7')][_0x4c7f('0xc')]?_[_0x4c7f('0xd')](_0x491f3c['options'][_0x4c7f('0xc')],function(_0x3d9f79){return{'model':db[_0x3d9f79[_0x4c7f('0xe')]],'as':_0x3d9f79['as'],'attributes':_0x3d9f79[_0x4c7f('0xa')],'include':_0x3d9f79['include']?_[_0x4c7f('0xd')](_0x3d9f79[_0x4c7f('0xc')],function(_0x1ddaad){return{'model':db[_0x1ddaad['model']],'as':_0x1ddaad['as'],'attributes':_0x1ddaad['attributes'],'include':_0x1ddaad[_0x4c7f('0xc')]?_[_0x4c7f('0xd')](_0x1ddaad[_0x4c7f('0xc')],function(_0x44287f){return{'model':db[_0x44287f[_0x4c7f('0xe')]],'as':_0x44287f['as'],'attributes':_0x44287f[_0x4c7f('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a5c01){logger['info']('GetCmHopper',_0x491f3c);logger[_0x4c7f('0xf')](_0x4c7f('0x4'),_0x491f3c,JSON[_0x4c7f('0x10')](_0x5a5c01));_0x428ee0(_0x5a5c01);})['catch'](function(_0x231c12){logger[_0x4c7f('0x11')](_0x4c7f('0x4'),_0x231c12[_0x4c7f('0x12')],_0x491f3c);_0x49e893(_0x5557c5[_0x4c7f('0x11')](0x1f4,_0x231c12[_0x4c7f('0x12')]));});});};exports[_0x4c7f('0x13')]=function(_0x5070b0){var _0x15e557=this;return new Promise(function(_0x30522d,_0x5d5965){return db['CmHopper']['find']({'raw':_0x5070b0[_0x4c7f('0x7')]?_0x5070b0['options'][_0x4c7f('0x8')]===undefined?!![]:![]:!![],'where':_0x5070b0[_0x4c7f('0x7')]?_0x5070b0[_0x4c7f('0x7')]['where']||null:null,'attributes':_0x5070b0['options']?_0x5070b0[_0x4c7f('0x7')][_0x4c7f('0xa')]||null:null,'include':_0x5070b0[_0x4c7f('0x7')]?_0x5070b0['options'][_0x4c7f('0xc')]?_['map'](_0x5070b0[_0x4c7f('0x7')]['include'],function(_0x4437a6){return{'model':db[_0x4437a6[_0x4c7f('0xe')]],'as':_0x4437a6['as'],'attributes':_0x4437a6['attributes'],'include':_0x4437a6[_0x4c7f('0xc')]?_[_0x4c7f('0xd')](_0x4437a6[_0x4c7f('0xc')],function(_0x544fdd){return{'model':db[_0x544fdd[_0x4c7f('0xe')]],'as':_0x544fdd['as'],'attributes':_0x544fdd[_0x4c7f('0xa')],'include':_0x544fdd[_0x4c7f('0xc')]?_[_0x4c7f('0xd')](_0x544fdd[_0x4c7f('0xc')],function(_0x3af8b5){return{'model':db[_0x3af8b5['model']],'as':_0x3af8b5['as'],'attributes':_0x3af8b5['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c7f('0x14')](function(_0x4974fd){logger[_0x4c7f('0x15')](_0x4c7f('0x13'),_0x5070b0);logger[_0x4c7f('0xf')](_0x4c7f('0x13'),_0x5070b0,JSON[_0x4c7f('0x10')](_0x4974fd));_0x30522d(_0x4974fd);})[_0x4c7f('0x16')](function(_0x25e212){logger[_0x4c7f('0x11')](_0x4c7f('0x13'),_0x25e212[_0x4c7f('0x12')],_0x5070b0);_0x5d5965(_0x15e557[_0x4c7f('0x11')](0x1f4,_0x25e212[_0x4c7f('0x12')]));});});};exports[_0x4c7f('0x17')]=function(_0x347cfd){var _0x5ceb4b=this;return new Promise(function(_0x1f4851,_0x53f54f){return db[_0x4c7f('0x5')][_0x4c7f('0x18')](_0x347cfd[_0x4c7f('0x19')],{'raw':_0x347cfd[_0x4c7f('0x7')]?_0x347cfd['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5a2b60){logger['info'](_0x4c7f('0x17'),_0x347cfd);logger['debug'](_0x4c7f('0x17'),_0x347cfd,JSON[_0x4c7f('0x10')](_0x5a2b60));_0x1f4851(_0x5a2b60);})[_0x4c7f('0x16')](function(_0x4e7eec){logger[_0x4c7f('0x11')](_0x4c7f('0x17'),_0x4e7eec[_0x4c7f('0x12')],_0x347cfd);_0x53f54f(_0x5ceb4b[_0x4c7f('0x11')](0x1f4,_0x4e7eec[_0x4c7f('0x12')]));});});};exports['UpdateCmHopper']=function(_0x99492a){var _0x131e8a=this;return new Promise(function(_0x1365a5,_0x34de25){return db[_0x4c7f('0x5')]['update'](_0x99492a['body'],{'raw':_0x99492a['options']?_0x99492a[_0x4c7f('0x7')][_0x4c7f('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x99492a['options']?_0x99492a['options'][_0x4c7f('0x9')]||null:null,'attributes':_0x99492a['options']?_0x99492a[_0x4c7f('0x7')]['attributes']||null:null,'limit':_0x99492a[_0x4c7f('0x7')]?_0x99492a[_0x4c7f('0x7')][_0x4c7f('0xb')]||null:null})[_0x4c7f('0x14')](function(_0x27f168){logger['info'](_0x4c7f('0x1a'),_0x99492a);logger[_0x4c7f('0x15')](_0x4c7f('0x1b'),JSON[_0x4c7f('0x10')](_0x99492a[_0x4c7f('0x7')][_0x4c7f('0x9')]),_0x99492a['body'][_0x4c7f('0x1c')]);logger[_0x4c7f('0xf')](_0x4c7f('0x1a'),_0x99492a,JSON[_0x4c7f('0x10')](_0x27f168));_0x1365a5(_0x27f168);})[_0x4c7f('0x16')](function(_0x3eaeab){logger[_0x4c7f('0x11')]('UpdateCmHopper',_0x3eaeab[_0x4c7f('0x12')],_0x99492a);_0x34de25(_0x131e8a['error'](0x1f4,_0x3eaeab[_0x4c7f('0x12')]));});});};exports[_0x4c7f('0x1d')]=function(_0x2a2fb5){var _0x5142f5=this;return new Promise(function(_0x288c62,_0x49d23b){return db['CmHopper']['destroy']({'where':_0x2a2fb5[_0x4c7f('0x7')]?_0x2a2fb5[_0x4c7f('0x7')][_0x4c7f('0x9')]||null:null})[_0x4c7f('0x14')](function(_0x11837c){logger[_0x4c7f('0x15')](_0x4c7f('0x1d'),_0x2a2fb5);logger[_0x4c7f('0xf')](_0x4c7f('0x1d'),_0x2a2fb5,JSON[_0x4c7f('0x10')](_0x11837c));_0x288c62(_0x11837c);})[_0x4c7f('0x16')](function(_0x3d9422){logger[_0x4c7f('0x11')](_0x4c7f('0x1d'),_0x3d9422[_0x4c7f('0x12')],_0x2a2fb5);_0x49d23b(_0x5142f5[_0x4c7f('0x11')](0x1f4,_0x3d9422[_0x4c7f('0x12')]));});});};exports[_0x4c7f('0x1e')]=function(_0x30f807){var _0x1d9467=this;return new Promise(function(_0x46dfc2,_0x32ff6e){return db[_0x4c7f('0x1f')][_0x4c7f('0x20')]()['then'](function(_0x484b9f){return db['sequelize'][_0x4c7f('0x21')](function(_0x42cbf7){return db[_0x4c7f('0x5')][_0x4c7f('0x6')]({'where':_0x30f807[_0x4c7f('0x7')]?_0x30f807['options'][_0x4c7f('0x9')]||null:null,'attributes':_0x30f807[_0x4c7f('0x7')]?_0x30f807[_0x4c7f('0x7')][_0x4c7f('0xa')]||null:null,'limit':_0x30f807[_0x4c7f('0x7')]?_0x30f807['options']['limit']||null:null,'order':_0x30f807[_0x4c7f('0x7')]?_0x30f807['options'][_0x4c7f('0x22')]||null:null,'transaction':_0x42cbf7,'lock':_0x42cbf7[_0x4c7f('0x23')][_0x4c7f('0x24')],'include':[{'model':db[_0x4c7f('0x1f')],'as':'Contact','attributes':_['keys'](_0x484b9f)},{'model':db[_0x4c7f('0x25')],'as':_0x4c7f('0x26'),'attributes':['id',_0x4c7f('0x27'),_0x4c7f('0x28')]}]})['then'](function(_0x43831e){var _0xbe6ead=[];var _0x3d4bb4=[];for(var _0x7149ad=0x0;_0x7149ad<_0x43831e[_0x4c7f('0x29')];_0x7149ad+=0x1){var _0x409910=_0x43831e[_0x7149ad][_0x4c7f('0x2a')];if(_0x409910===null){_0xbe6ead[_0x4c7f('0x2b')](_0x43831e[_0x7149ad][_0x4c7f('0x2c')](_0x30f807[_0x4c7f('0x19')],{'transaction':_0x42cbf7}));}else if(!_0x3d4bb4[_0x4c7f('0x2d')](_0x409910)){_0x3d4bb4[_0x4c7f('0x2b')](_0x409910);_0xbe6ead[_0x4c7f('0x2b')](_0x43831e[_0x7149ad][_0x4c7f('0x2c')](_0x30f807[_0x4c7f('0x19')],{'transaction':_0x42cbf7}));}}return BPromise['all'](_0xbe6ead);});})[_0x4c7f('0x14')](function(_0x5883e4){logger[_0x4c7f('0x15')](_0x4c7f('0x1e'),_0x30f807);if(_0x5883e4[_0x4c7f('0x29')]>0x0){logger[_0x4c7f('0x15')](_0x4c7f('0x2e'),_0x5883e4[0x0]['dataValues']['id'],_0x5883e4[0x0]['dataValues'][_0x4c7f('0x2f')],_0x5883e4[0x0][_0x4c7f('0x30')][_0x4c7f('0x1c')]);}logger[_0x4c7f('0xf')](_0x4c7f('0x1e'),_0x30f807,JSON['stringify'](_0x5883e4));_0x46dfc2(_0x5883e4);})[_0x4c7f('0x16')](function(_0x10a1d0){logger[_0x4c7f('0x11')]('GetContactDialer',_0x10a1d0[_0x4c7f('0x12')],_0x30f807);_0x32ff6e(_0x1d9467[_0x4c7f('0x11')](0x1f4,_0x10a1d0[_0x4c7f('0x12')]));});});});};exports[_0x4c7f('0x31')]=function(_0x3023f9){var _0x1c4c34=this;return new Promise(function(_0xa24c61,_0x3e2b4d){return db['sequelize']['transaction'](function(_0x4323a7){return db[_0x4c7f('0x32')][_0x4c7f('0x18')](_0x3023f9[_0x4c7f('0x19')],{'raw':_0x3023f9['options']?_0x3023f9['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x4323a7})['then'](function(){logger[_0x4c7f('0x15')](_0x4c7f('0x33'),JSON[_0x4c7f('0x10')](_0x3023f9[_0x4c7f('0x7')][_0x4c7f('0x9')]),_0x3023f9['options'][_0x4c7f('0x9')][_0x4c7f('0x1c')]);return db[_0x4c7f('0x5')]['destroy']({'where':_0x3023f9[_0x4c7f('0x7')]?_0x3023f9['options'][_0x4c7f('0x9')]||null:null,'transaction':_0x4323a7});});})[_0x4c7f('0x14')](function(_0x1800b1){logger['info'](_0x4c7f('0x31'),_0x3023f9);logger[_0x4c7f('0xf')](_0x4c7f('0x31'),_0x3023f9,JSON[_0x4c7f('0x10')](_0x1800b1));_0xa24c61(_0x1800b1);})[_0x4c7f('0x16')](function(_0x2b05e6){logger[_0x4c7f('0x11')](_0x4c7f('0x31'),_0x2b05e6[_0x4c7f('0x12')],_0x3023f9);_0x3e2b4d(_0x1c4c34[_0x4c7f('0x11')](0x1f4,_0x2b05e6[_0x4c7f('0x12')]));});});};exports[_0x4c7f('0x34')]=function(_0x43fa92){var _0x9cff32=this;return new Promise(function(_0x40d0db,_0x158a8f){return db[_0x4c7f('0x5')][_0x4c7f('0x6')]({'raw':_0x43fa92['options']?_0x43fa92[_0x4c7f('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x43fa92[_0x4c7f('0x7')]?_0x43fa92['options']['where']||null:null,'attributes':[[db[_0x4c7f('0x35')]['fn'](_0x4c7f('0x36'),db['sequelize']['fn']('IF',db['sequelize'][_0x4c7f('0x37')](_0x4c7f('0x38')+util[_0x4c7f('0x39')]('\x22%s\x22',moment()[_0x4c7f('0x39')](_0x4c7f('0x3a')))+_0x4c7f('0x3b')))),_0x4c7f('0x3c')]]})[_0x4c7f('0x14')](function(_0x5c81de){logger[_0x4c7f('0x15')](_0x4c7f('0x34'),_0x43fa92);logger['debug']('CountReScheduled',_0x43fa92,JSON[_0x4c7f('0x10')](_0x5c81de));_0x40d0db(_0x5c81de);})[_0x4c7f('0x16')](function(_0xd00b62){logger['error'](_0x4c7f('0x34'),_0xd00b62[_0x4c7f('0x12')],_0x43fa92);_0x158a8f(_0x9cff32[_0x4c7f('0x11')](0x1f4,_0xd00b62[_0x4c7f('0x12')]));});});};exports['GetContactRecallMe']=function(_0x21d814){var _0x2e90b1=this;return new Promise(function(_0xe3ae01,_0x55a812){return db['CmContact'][_0x4c7f('0x20')]()[_0x4c7f('0x14')](function(){return db[_0x4c7f('0x35')][_0x4c7f('0x21')](function(_0x2110f2){return db[_0x4c7f('0x5')][_0x4c7f('0x6')]({'where':_0x21d814[_0x4c7f('0x7')]?_0x21d814[_0x4c7f('0x7')][_0x4c7f('0x9')]||null:null,'attributes':_0x21d814[_0x4c7f('0x7')]?_0x21d814['options'][_0x4c7f('0xa')]||null:null,'limit':0x1,'order':_0x21d814[_0x4c7f('0x7')]?_0x21d814['options'][_0x4c7f('0x22')]||null:null,'group':db[_0x4c7f('0x5')][_0x4c7f('0x2a')],'transaction':_0x2110f2,'lock':_0x2110f2[_0x4c7f('0x23')][_0x4c7f('0x24')],'include':_0x21d814[_0x4c7f('0x7')]?_0x21d814[_0x4c7f('0x7')][_0x4c7f('0xc')]?_[_0x4c7f('0xd')](_0x21d814['options'][_0x4c7f('0xc')],function(_0x3bea90){return{'model':db[_0x3bea90[_0x4c7f('0xe')]],'as':_0x3bea90['as'],'attributes':_0x3bea90['attributes'],'include':_0x3bea90[_0x4c7f('0xc')]?_[_0x4c7f('0xd')](_0x3bea90['include'],function(_0x2fd32a){return{'model':db[_0x2fd32a[_0x4c7f('0xe')]],'as':_0x2fd32a['as'],'attributes':_0x2fd32a['attributes'],'include':_0x2fd32a['include']?_[_0x4c7f('0xd')](_0x2fd32a[_0x4c7f('0xc')],function(_0x249cd3){return{'model':db[_0x249cd3[_0x4c7f('0xe')]],'as':_0x249cd3['as'],'attributes':_0x249cd3[_0x4c7f('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4c7f('0x14')](function(_0x4cb0ab){var _0x1ae94f=[];for(var _0x3eef98=0x0;_0x3eef98<_0x4cb0ab[_0x4c7f('0x29')];_0x3eef98+=0x1){_0x1ae94f['push'](_0x4cb0ab[_0x3eef98][_0x4c7f('0x2c')](_0x21d814[_0x4c7f('0x19')],{'transaction':_0x2110f2}));}return BPromise[_0x4c7f('0x3d')](_0x1ae94f);});})[_0x4c7f('0x14')](function(_0x28956d){logger[_0x4c7f('0x15')](_0x4c7f('0x3e'),_0x21d814);logger['debug'](_0x4c7f('0x3e'),_0x21d814,JSON[_0x4c7f('0x10')](_0x28956d));_0xe3ae01(_0x28956d);})['catch'](function(_0x5a418e){logger['error'](_0x4c7f('0x3e'),_0x5a418e['message'],_0x21d814);_0x55a812(_0x2e90b1[_0x4c7f('0x11')](0x1f4,_0x5a418e['message']));});});});};exports['GetCmHopperPreview']=function(_0x51d1d2){var _0x54dcf5=this;return new Promise(function(_0x3b636c,_0x2d5a34){db[_0x4c7f('0x1f')][_0x4c7f('0x20')]()['then'](function(_0x250251){return db[_0x4c7f('0x5')][_0x4c7f('0x6')]({'raw':_0x51d1d2['options']?_0x51d1d2[_0x4c7f('0x7')][_0x4c7f('0x8')]===undefined?!![]:![]:!![],'where':_0x51d1d2[_0x4c7f('0x7')]?_0x51d1d2['options']['where']||null:null,'attributes':_0x51d1d2[_0x4c7f('0x7')]?_0x51d1d2[_0x4c7f('0x7')][_0x4c7f('0xa')]||null:null,'limit':_0x51d1d2['options']?_0x51d1d2[_0x4c7f('0x7')]['limit']||null:null,'include':_0x51d1d2[_0x4c7f('0x7')]?_0x51d1d2[_0x4c7f('0x7')]['include']?_[_0x4c7f('0xd')](_0x51d1d2[_0x4c7f('0x7')]['include'],function(_0x35023b){return{'model':db[_0x35023b[_0x4c7f('0xe')]],'as':_0x35023b['as'],'attributes':_0x35023b['as']==='Contact'?_['keys'](_0x250251):_0x35023b[_0x4c7f('0xa')],'include':_0x35023b[_0x4c7f('0xc')]?_['map'](_0x35023b['include'],function(_0xd7ef07){return{'model':db[_0xd7ef07['model']],'as':_0xd7ef07['as'],'attributes':_0xd7ef07[_0x4c7f('0xa')],'include':_0xd7ef07[_0x4c7f('0xc')]?_['map'](_0xd7ef07[_0x4c7f('0xc')],function(_0x2551ae){return{'model':db[_0x2551ae[_0x4c7f('0xe')]],'as':_0x2551ae['as'],'attributes':_0x2551ae[_0x4c7f('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10a6a1){logger[_0x4c7f('0x15')]('GetCmHopper',_0x51d1d2);logger[_0x4c7f('0xf')](_0x4c7f('0x4'),_0x51d1d2,JSON[_0x4c7f('0x10')](_0x10a6a1));_0x3b636c(_0x10a6a1);})[_0x4c7f('0x16')](function(_0x14dccb){logger[_0x4c7f('0x11')](_0x4c7f('0x4'),_0x14dccb[_0x4c7f('0x12')],_0x51d1d2);_0x2d5a34(_0x54dcf5[_0x4c7f('0x11')](0x1f4,_0x14dccb[_0x4c7f('0x12')]));});});});};exports[_0x4c7f('0x3f')]=function(_0x539f5d){var _0x1b913f=this;return new Promise(function(_0x489b9c,_0x167696){return db[_0x4c7f('0x1f')][_0x4c7f('0x40')]({'raw':!![],'where':{'phone':_0x539f5d[_0x4c7f('0x7')]['where'][_0x4c7f('0x41')]},'attributes':['id',_0x4c7f('0x42')],'order':[['id',_0x4c7f('0x43')]]})[_0x4c7f('0x14')](function(_0x46372d){logger['info'](_0x4c7f('0x44'),_0x539f5d);logger[_0x4c7f('0xf')](_0x4c7f('0x44'),_0x539f5d,JSON[_0x4c7f('0x10')](_0x46372d));_0x489b9c(_0x46372d);})[_0x4c7f('0x16')](function(_0x156918){logger[_0x4c7f('0x11')]('getContactByPhone',_0x156918[_0x4c7f('0x12')],_0x539f5d);_0x167696(_0x1b913f[_0x4c7f('0x11')](0x1f4,_0x156918[_0x4c7f('0x12')]));});});};exports[_0x4c7f('0x45')]=function(_0x45c6a3){var _0x4b90eb=this;return new Promise(function(_0x175fc0,_0x46adf5){return db[_0x4c7f('0x35')][_0x4c7f('0x21')](function(_0xc30e73){var _0x41e0b3=_0x45c6a3['options']&&_0x45c6a3[_0x4c7f('0x7')][_0x4c7f('0x9')]?_0x45c6a3['options'][_0x4c7f('0x9')]:{};return db[_0x4c7f('0x5')][_0x4c7f('0x2c')](_0x45c6a3[_0x4c7f('0x19')],{'where':_0x41e0b3,'transaction':_0xc30e73})['then'](function(_0x1506a5){logger[_0x4c7f('0x15')]('ResetActiveCalls',_0x45c6a3);logger[_0x4c7f('0xf')](_0x4c7f('0x45'),_0x45c6a3,JSON[_0x4c7f('0x10')](_0x1506a5));_0x175fc0(_0x1506a5);})['catch'](function(_0x3bba80){logger['error'](_0x4c7f('0x45'),_0x3bba80[_0x4c7f('0x12')],_0x45c6a3);_0x46adf5(_0x4b90eb[_0x4c7f('0x11')](0x1f4,_0x3bba80[_0x4c7f('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4db07c){var _0x162253=this;var _0xb0903b=_0x4db07c['body']['where']['voiceQueueIds'];var _0x38bad9=_0x4db07c[_0x4c7f('0x19')][_0x4c7f('0x9')][_0x4c7f('0x46')];var _0x4e048b=_0x4db07c[_0x4c7f('0x19')]['where'][_0x4c7f('0x47')];return new Promise(function(_0x5320ab,_0xcfe1f7){return db[_0x4c7f('0x5')][_0x4c7f('0x6')]({'where':{'voiceQueueId':{'$in':_0xb0903b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4c7f('0x35')][_0x4c7f('0x37')](_0x4c7f('0x48')+_0x38bad9+_0x4c7f('0x49')),'$gt':db['sequelize']['literal'](_0x4c7f('0x4a'))}},'UserId':{'$in':_0x4e048b}},'include':[{'model':db[_0x4c7f('0x1f')],'as':_0x4c7f('0x4b')},{'model':db['User'],'as':_0x4c7f('0x26'),'attributes':['id',_0x4c7f('0x27'),_0x4c7f('0x28')]},{'model':db[_0x4c7f('0x4c')],'as':_0x4c7f('0x4d')}]})[_0x4c7f('0x14')](function(_0x545268){if(_0x545268[_0x4c7f('0x29')]>0x0){return db['sequelize'][_0x4c7f('0x21')](function(_0x8f5be5){return db['CmHopper'][_0x4c7f('0x2c')]({'recallmeNotifiedDate':db[_0x4c7f('0x35')][_0x4c7f('0x37')]('NOW()')},{'where':{'id':{'$in':_[_0x4c7f('0xd')](_0x545268,'id')}},'transaction':_0x8f5be5})['then'](function(){_0x5320ab(_0x545268);})[_0x4c7f('0x16')](function(_0x584ff2){logger['error'](_0x4c7f('0x4e'),_0x584ff2[_0x4c7f('0x12')],_0x4db07c);_0xcfe1f7(_0x162253[_0x4c7f('0x11')](0x1f4,_0x584ff2['message']));});})[_0x4c7f('0x16')](function(_0x1f74e7){logger[_0x4c7f('0x11')](_0x4c7f('0x4e'),_0x1f74e7[_0x4c7f('0x12')],_0x4db07c);_0xcfe1f7(_0x162253[_0x4c7f('0x11')](0x1f4,_0x1f74e7['message']));});}else{_0x5320ab(_0x545268);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 09eb6fd..28b8b88 100644 --- a/server/api/cmHopper/index.js +++ b/server/api/cmHopper/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba50=['./cmHopper.controller','get','isAuthenticated','describe','/timezones','getTimezones','/:id','/:id/previewrecall','post','/timezone','getTimezone','put','update','destroy','Router'];(function(_0x498729,_0x18d920){var _0x3342f2=function(_0x3fba51){while(--_0x3fba51){_0x498729['push'](_0x498729['shift']());}};_0x3342f2(++_0x18d920);}(_0xba50,0xe0));var _0x0ba5=function(_0x3e1e91,_0x970a2e){_0x3e1e91=_0x3e1e91-0x0;var _0x4db75d=_0xba50[_0x3e1e91];return _0x4db75d;};'use strict';var express=require('express');var router=express[_0x0ba5('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x0ba5('0x1'));router[_0x0ba5('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0ba5('0x2')]('/describe',auth[_0x0ba5('0x3')](),controller[_0x0ba5('0x4')]);router['get']('/opencontacts',auth[_0x0ba5('0x3')](),controller['getOpenContacts']);router[_0x0ba5('0x2')](_0x0ba5('0x5'),auth['isAuthenticated'](),controller[_0x0ba5('0x6')]);router[_0x0ba5('0x2')](_0x0ba5('0x7'),auth[_0x0ba5('0x3')](),controller['show']);router[_0x0ba5('0x2')](_0x0ba5('0x8'),auth['isAuthenticated'](),controller['getPreviewRecall']);router['post']('/',auth[_0x0ba5('0x3')](),controller['create']);router[_0x0ba5('0x9')]('/preview',auth[_0x0ba5('0x3')](),controller['getPreview']);router[_0x0ba5('0x9')](_0x0ba5('0xa'),auth['isAuthenticated'](),controller[_0x0ba5('0xb')]);router[_0x0ba5('0xc')](_0x0ba5('0x7'),auth[_0x0ba5('0x3')](),controller[_0x0ba5('0xd')]);router['delete']('/:id',auth[_0x0ba5('0x3')](),controller[_0x0ba5('0xe')]);module['exports']=router; \ No newline at end of file +var _0x2d2c=['/:id','update','delete','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','create','post','/preview','getPreview','/timezone','getTimezone'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x2d2c,0x100));var _0xc2d2=function(_0x2c3bd9,_0x45f815){_0x2c3bd9=_0x2c3bd9-0x0;var _0x112e55=_0x2d2c[_0x2c3bd9];return _0x112e55;};'use strict';var express=require(_0xc2d2('0x0'));var router=express[_0xc2d2('0x1')]();var auth=require(_0xc2d2('0x2'));var controller=require('./cmHopper.controller');router[_0xc2d2('0x3')]('/',auth[_0xc2d2('0x4')](),controller[_0xc2d2('0x5')]);router['get'](_0xc2d2('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0xc2d2('0x3')](_0xc2d2('0x7'),auth[_0xc2d2('0x4')](),controller[_0xc2d2('0x8')]);router[_0xc2d2('0x3')](_0xc2d2('0x9'),auth[_0xc2d2('0x4')](),controller[_0xc2d2('0xa')]);router[_0xc2d2('0x3')]('/:id',auth[_0xc2d2('0x4')](),controller[_0xc2d2('0xb')]);router[_0xc2d2('0x3')](_0xc2d2('0xc'),auth['isAuthenticated'](),controller[_0xc2d2('0xd')]);router['post']('/',auth[_0xc2d2('0x4')](),controller[_0xc2d2('0xe')]);router[_0xc2d2('0xf')](_0xc2d2('0x10'),auth['isAuthenticated'](),controller[_0xc2d2('0x11')]);router[_0xc2d2('0xf')](_0xc2d2('0x12'),auth[_0xc2d2('0x4')](),controller[_0xc2d2('0x13')]);router['put'](_0xc2d2('0x14'),auth['isAuthenticated'](),controller[_0xc2d2('0x15')]);router[_0xc2d2('0x16')](_0xc2d2('0x14'),auth[_0xc2d2('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 3e6b915..e788335 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69ac=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x10a00b,_0x2a3c2a){var _0x349213=function(_0x518421){while(--_0x518421){_0x10a00b['push'](_0x10a00b['shift']());}};_0x349213(++_0x2a3c2a);}(_0x69ac,0x141));var _0xc69a=function(_0x1ade37,_0x4ba0a6){_0x1ade37=_0x1ade37-0x0;var _0x1f4f27=_0x69ac[_0x1ade37];return _0x1f4f27;};'use strict';var moment=require(_0xc69a('0x0'));var Sequelize=require(_0xc69a('0x1'));module[_0xc69a('0x2')]={'CmHopperId':{'type':Sequelize[_0xc69a('0x3')]},'phone':{'type':Sequelize[_0xc69a('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xc69a('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc69a('0x5')],'defaultValue':moment()[_0xc69a('0x6')](_0xc69a('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc69a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc69a('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc69a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc69a('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc69a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2376=['exports','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x34daed,_0x16e1b4){var _0x3a9961=function(_0x2e47b8){while(--_0x2e47b8){_0x34daed['push'](_0x34daed['shift']());}};_0x3a9961(++_0x16e1b4);}(_0x2376,0xb4));var _0x6237=function(_0xbaa29c,_0x2975a9){_0xbaa29c=_0xbaa29c-0x0;var _0x36b1eb=_0x2376[_0xbaa29c];return _0x36b1eb;};'use strict';var moment=require(_0x6237('0x0'));var Sequelize=require(_0x6237('0x1'));module[_0x6237('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6237('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6237('0x4')],'defaultValue':moment()[_0x6237('0x5')](_0x6237('0x6'))},'countbusyretry':{'type':Sequelize[_0x6237('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6237('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6237('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6237('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6237('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 6bcffd1..061151f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5377=['status','json','offset','undefined','count','limit','apply','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x10acf1,_0x35ab1f){var _0x4ebdd0=function(_0x3aba9f){while(--_0x3aba9f){_0x10acf1['push'](_0x10acf1['shift']());}};_0x4ebdd0(++_0x35ab1f);}(_0x5377,0x91));var _0x7537=function(_0x202721,_0x23d314){_0x202721=_0x202721-0x0;var _0x55459c=_0x5377[_0x202721];return _0x55459c;};'use strict';var emlformat=require(_0x7537('0x0'));var rimraf=require(_0x7537('0x1'));var zipdir=require(_0x7537('0x2'));var jsonpatch=require(_0x7537('0x3'));var rp=require(_0x7537('0x4'));var moment=require(_0x7537('0x5'));var BPromise=require(_0x7537('0x6'));var Mustache=require(_0x7537('0x7'));var util=require(_0x7537('0x8'));var path=require(_0x7537('0x9'));var sox=require(_0x7537('0xa'));var csv=require(_0x7537('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7537('0xc'));var _=require(_0x7537('0xd'));var squel=require(_0x7537('0xe'));var crypto=require(_0x7537('0xf'));var jsforce=require(_0x7537('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7537('0xb'));var querystring=require('querystring');var Papa=require(_0x7537('0x11'));var Redis=require(_0x7537('0x12'));var authService=require(_0x7537('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7537('0x14'));var hardwareService=require(_0x7537('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x7537('0x16'));var config=require(_0x7537('0x17'));var licenseUtil=require(_0x7537('0x18'));var db=require(_0x7537('0x19'))['db'];function respondWithStatusCode(_0x172278,_0xba862e){_0xba862e=_0xba862e||0xcc;return function(_0xff2ea6){if(_0xff2ea6){return _0x172278[_0x7537('0x1a')](_0xba862e);}return _0x172278[_0x7537('0x1b')](_0xba862e)['end']();};}function respondWithResult(_0x30fefa,_0x26ec6c){_0x26ec6c=_0x26ec6c||0xc8;return function(_0x350d73){if(_0x350d73){return _0x30fefa[_0x7537('0x1b')](_0x26ec6c)[_0x7537('0x1c')](_0x350d73);}};}function respondWithFilteredResult(_0x570cb7,_0xa22309){return function(_0x1c02da){if(_0x1c02da){var _0x448e51=typeof _0xa22309[_0x7537('0x1d')]===_0x7537('0x1e')&&typeof _0xa22309['limit']===_0x7537('0x1e');var _0x407b94=_0x1c02da['count'];var _0x257a0e=_0x448e51?0x0:_0xa22309['offset'];var _0x22b263=_0x448e51?_0x1c02da[_0x7537('0x1f')]:_0xa22309[_0x7537('0x1d')]+_0xa22309[_0x7537('0x20')];var _0x133868;if(_0x22b263>=_0x407b94){_0x22b263=_0x407b94;_0x133868=0xc8;}else{_0x133868=0xce;}_0x570cb7[_0x7537('0x1b')](_0x133868);return _0x570cb7['set']('Content-Range',_0x257a0e+'-'+_0x22b263+'/'+_0x407b94)[_0x7537('0x1c')](_0x1c02da);}return null;};}function patchUpdates(_0x4de3c9){return function(_0x16f728){try{jsonpatch[_0x7537('0x21')](_0x16f728,_0x4de3c9,!![]);}catch(_0x59387c){return BPromise[_0x7537('0x22')](_0x59387c);}return _0x16f728[_0x7537('0x23')]();};}function saveUpdates(_0x542324,_0x219f18){return function(_0x4b41c7){if(_0x4b41c7){return _0x4b41c7[_0x7537('0x24')](_0x542324)[_0x7537('0x25')](function(_0x1b27a7){return _0x1b27a7;});}return null;};}function removeEntity(_0x2ae5e6,_0x2dd2a2){return function(_0x1202cb){if(_0x1202cb){return _0x1202cb['destroy']()['then'](function(){var _0x372676=_0x1202cb[_0x7537('0x26')]({'plain':!![]});var _0x892c3d=_0x7537('0x27');return db[_0x7537('0x28')][_0x7537('0x29')]({'where':{'type':_0x892c3d,'resourceId':_0x372676['id']}})[_0x7537('0x25')](function(){return _0x1202cb;});})[_0x7537('0x25')](function(){_0x2ae5e6['status'](0xcc)[_0x7537('0x2a')]();});}};}function handleEntityNotFound(_0x3d132b,_0x47d701){return function(_0x5841fe){if(!_0x5841fe){_0x3d132b[_0x7537('0x1a')](0x194);}return _0x5841fe;};}function handleError(_0x167a84,_0x4a49fd){_0x4a49fd=_0x4a49fd||0x1f4;return function(_0x42ca8d){logger[_0x7537('0x2b')](_0x42ca8d[_0x7537('0x2c')]);if(_0x42ca8d[_0x7537('0x2d')]){delete _0x42ca8d[_0x7537('0x2d')];}_0x167a84[_0x7537('0x1b')](_0x4a49fd)[_0x7537('0x2e')](_0x42ca8d);};}exports[_0x7537('0x2f')]=function(_0x5e5bdc,_0x2617a8){var _0x51ec67={},_0x53d075={},_0x4afbce={'count':0x0,'rows':[]};var _0x487bf9=_[_0x7537('0x30')](db[_0x7537('0x31')][_0x7537('0x32')],function(_0x486dd8){return{'name':_0x486dd8[_0x7537('0x33')],'type':_0x486dd8[_0x7537('0x34')][_0x7537('0x35')]};});_0x53d075[_0x7537('0x36')]=_[_0x7537('0x30')](_0x487bf9,'name');_0x53d075[_0x7537('0x37')]=_[_0x7537('0x38')](_0x5e5bdc[_0x7537('0x37')]);_0x53d075[_0x7537('0x39')]=_[_0x7537('0x3a')](_0x53d075[_0x7537('0x36')],_0x53d075['query']);_0x51ec67[_0x7537('0x3b')]=_[_0x7537('0x3a')](_0x53d075['model'],qs[_0x7537('0x3c')](_0x5e5bdc[_0x7537('0x37')][_0x7537('0x3c')]));_0x51ec67[_0x7537('0x3b')]=_0x51ec67[_0x7537('0x3b')][_0x7537('0x3d')]?_0x51ec67[_0x7537('0x3b')]:_0x53d075['model'];if(!_0x5e5bdc[_0x7537('0x37')][_0x7537('0x3e')](_0x7537('0x3f'))){_0x51ec67[_0x7537('0x20')]=qs['limit'](_0x5e5bdc[_0x7537('0x37')][_0x7537('0x20')]);_0x51ec67['offset']=qs[_0x7537('0x1d')](_0x5e5bdc['query'][_0x7537('0x1d')]);}_0x51ec67[_0x7537('0x40')]=qs[_0x7537('0x41')](_0x5e5bdc[_0x7537('0x37')]['sort']);_0x51ec67[_0x7537('0x42')]=qs[_0x7537('0x39')](_[_0x7537('0x43')](_0x5e5bdc[_0x7537('0x37')],_0x53d075[_0x7537('0x39')]),_0x487bf9);if(_0x5e5bdc[_0x7537('0x37')][_0x7537('0x44')]){_0x51ec67['where']=_['merge'](_0x51ec67['where'],{'$or':_['map'](_0x487bf9,function(_0x4291f3){if(_0x4291f3[_0x7537('0x34')]!==_0x7537('0x45')){var _0x2d8a47={};_0x2d8a47[_0x4291f3[_0x7537('0x2d')]]={'$like':'%'+_0x5e5bdc[_0x7537('0x37')]['filter']+'%'};return _0x2d8a47;}})});}_0x51ec67=_[_0x7537('0x46')]({},_0x51ec67,_0x5e5bdc[_0x7537('0x47')]);var _0x3ba07d={'where':_0x51ec67['where']};return db['CmHopperAdditionalPhone'][_0x7537('0x1f')](_0x3ba07d)[_0x7537('0x25')](function(_0x2e19e4){_0x4afbce[_0x7537('0x1f')]=_0x2e19e4;if(_0x5e5bdc[_0x7537('0x37')][_0x7537('0x48')]){_0x51ec67[_0x7537('0x49')]=[{'all':!![]}];}return db[_0x7537('0x31')]['findAll'](_0x51ec67);})[_0x7537('0x25')](function(_0x13273d){_0x4afbce[_0x7537('0x4a')]=_0x13273d;return _0x4afbce;})[_0x7537('0x25')](respondWithFilteredResult(_0x2617a8,_0x51ec67))[_0x7537('0x4b')](handleError(_0x2617a8,null));};exports[_0x7537('0x4c')]=function(_0x2881bb,_0x5cfd4e){var _0x379c1e={'raw':!![],'where':{'id':_0x2881bb['params']['id']}},_0x490d1f={};_0x490d1f[_0x7537('0x36')]=_['keys'](db[_0x7537('0x31')][_0x7537('0x32')]);_0x490d1f[_0x7537('0x37')]=_[_0x7537('0x38')](_0x2881bb[_0x7537('0x37')]);_0x490d1f[_0x7537('0x39')]=_['intersection'](_0x490d1f['model'],_0x490d1f['query']);_0x379c1e[_0x7537('0x3b')]=_[_0x7537('0x3a')](_0x490d1f[_0x7537('0x36')],qs[_0x7537('0x3c')](_0x2881bb[_0x7537('0x37')][_0x7537('0x3c')]));_0x379c1e[_0x7537('0x3b')]=_0x379c1e[_0x7537('0x3b')][_0x7537('0x3d')]?_0x379c1e[_0x7537('0x3b')]:_0x490d1f[_0x7537('0x36')];if(_0x2881bb['query'][_0x7537('0x48')]){_0x379c1e[_0x7537('0x49')]=[{'all':!![]}];}_0x379c1e=_['merge']({},_0x379c1e,_0x2881bb[_0x7537('0x47')]);return db['CmHopperAdditionalPhone'][_0x7537('0x4d')](_0x379c1e)[_0x7537('0x25')](handleEntityNotFound(_0x5cfd4e,null))[_0x7537('0x25')](respondWithResult(_0x5cfd4e,null))['catch'](handleError(_0x5cfd4e,null));};exports[_0x7537('0x4e')]=function(_0x544ca3,_0x3eb7ef){return db[_0x7537('0x31')][_0x7537('0x4e')](_0x544ca3[_0x7537('0x4f')],{})['then'](function(_0x5592c9){var _0x42dd2f=_0x544ca3[_0x7537('0x50')][_0x7537('0x26')]({'plain':!![]});if(!_0x42dd2f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42dd2f[_0x7537('0x51')]===_0x7537('0x50')){var _0x5761ac=_0x5592c9[_0x7537('0x26')]({'plain':!![]});var _0x396016='CmHopperAdditionalPhones';return db['UserProfileSection'][_0x7537('0x4d')]({'where':{'name':_0x396016,'userProfileId':_0x42dd2f[_0x7537('0x52')]},'raw':!![]})['then'](function(_0x5665c4){if(_0x5665c4&&_0x5665c4[_0x7537('0x53')]===0x0){return db[_0x7537('0x28')]['create']({'name':_0x5761ac['name'],'resourceId':_0x5761ac['id'],'type':_0x5665c4['name'],'sectionId':_0x5665c4['id']},{})[_0x7537('0x25')](function(){return _0x5592c9;});}else{return _0x5592c9;}})[_0x7537('0x4b')](function(_0x50f9a0){logger[_0x7537('0x2b')](_0x7537('0x54'),_0x50f9a0);throw _0x50f9a0;});}return _0x5592c9;})[_0x7537('0x25')](respondWithResult(_0x3eb7ef,0xc9))[_0x7537('0x4b')](handleError(_0x3eb7ef,null));};exports[_0x7537('0x24')]=function(_0x33929e,_0x3efccf){if(_0x33929e[_0x7537('0x4f')]['id']){delete _0x33929e[_0x7537('0x4f')]['id'];}return db[_0x7537('0x31')][_0x7537('0x4d')]({'where':{'id':_0x33929e[_0x7537('0x55')]['id']}})[_0x7537('0x25')](handleEntityNotFound(_0x3efccf,null))[_0x7537('0x25')](saveUpdates(_0x33929e['body'],null))['then'](respondWithResult(_0x3efccf,null))[_0x7537('0x4b')](handleError(_0x3efccf,null));};exports[_0x7537('0x29')]=function(_0x493cc7,_0x19664d){return db[_0x7537('0x31')]['find']({'where':{'id':_0x493cc7['params']['id']}})[_0x7537('0x25')](handleEntityNotFound(_0x19664d,null))[_0x7537('0x25')](removeEntity(_0x19664d,null))[_0x7537('0x4b')](handleError(_0x19664d,null));}; \ No newline at end of file +var _0x8f9e=['../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','UserProfileResource','destroy','error','stack','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','name','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','filter','merge','type','count','include','findAll','catch','show','params','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x5e2112,_0x5c9f53){var _0x5eb552=function(_0x3852a5){while(--_0x3852a5){_0x5e2112['push'](_0x5e2112['shift']());}};_0x5eb552(++_0x5c9f53);}(_0x8f9e,0x17f));var _0xe8f9=function(_0x2aebc,_0x55165f){_0x2aebc=_0x2aebc-0x0;var _0x1e8405=_0x8f9e[_0x2aebc];return _0x1e8405;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8f9('0x0'));var zipdir=require(_0xe8f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8f9('0x2'));var moment=require(_0xe8f9('0x3'));var BPromise=require(_0xe8f9('0x4'));var Mustache=require(_0xe8f9('0x5'));var util=require(_0xe8f9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe8f9('0x7'));var ejs=require(_0xe8f9('0x8'));var fs=require('fs');var fs_extra=require(_0xe8f9('0x9'));var _=require('lodash');var squel=require(_0xe8f9('0xa'));var crypto=require(_0xe8f9('0xb'));var jsforce=require(_0xe8f9('0xc'));var deskjs=require(_0xe8f9('0xd'));var toCsv=require(_0xe8f9('0x7'));var querystring=require(_0xe8f9('0xe'));var Papa=require(_0xe8f9('0xf'));var Redis=require(_0xe8f9('0x10'));var authService=require(_0xe8f9('0x11'));var qs=require(_0xe8f9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8f9('0x13'));var logger=require(_0xe8f9('0x14'))('api');var utils=require(_0xe8f9('0x15'));var config=require(_0xe8f9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196168,_0x45fac4){_0x45fac4=_0x45fac4||0xcc;return function(_0x281976){if(_0x281976){return _0x196168[_0xe8f9('0x17')](_0x45fac4);}return _0x196168[_0xe8f9('0x18')](_0x45fac4)[_0xe8f9('0x19')]();};}function respondWithResult(_0x433c89,_0x1382e1){_0x1382e1=_0x1382e1||0xc8;return function(_0x3e16b9){if(_0x3e16b9){return _0x433c89[_0xe8f9('0x18')](_0x1382e1)[_0xe8f9('0x1a')](_0x3e16b9);}};}function respondWithFilteredResult(_0x3669a5,_0x216441){return function(_0x107743){if(_0x107743){var _0x43a535=typeof _0x216441[_0xe8f9('0x1b')]===_0xe8f9('0x1c')&&typeof _0x216441[_0xe8f9('0x1d')]==='undefined';var _0x50a142=_0x107743['count'];var _0x31c51e=_0x43a535?0x0:_0x216441[_0xe8f9('0x1b')];var _0x369595=_0x43a535?_0x107743['count']:_0x216441[_0xe8f9('0x1b')]+_0x216441[_0xe8f9('0x1d')];var _0xaff952;if(_0x369595>=_0x50a142){_0x369595=_0x50a142;_0xaff952=0xc8;}else{_0xaff952=0xce;}_0x3669a5['status'](_0xaff952);return _0x3669a5[_0xe8f9('0x1e')]('Content-Range',_0x31c51e+'-'+_0x369595+'/'+_0x50a142)[_0xe8f9('0x1a')](_0x107743);}return null;};}function patchUpdates(_0x5ac322){return function(_0x44d92b){try{jsonpatch[_0xe8f9('0x1f')](_0x44d92b,_0x5ac322,!![]);}catch(_0x4b8dbe){return BPromise[_0xe8f9('0x20')](_0x4b8dbe);}return _0x44d92b[_0xe8f9('0x21')]();};}function saveUpdates(_0x1a4aa3,_0x5deb93){return function(_0x586531){if(_0x586531){return _0x586531[_0xe8f9('0x22')](_0x1a4aa3)[_0xe8f9('0x23')](function(_0x44459e){return _0x44459e;});}return null;};}function removeEntity(_0x258d6c,_0x191d16){return function(_0x410fbd){if(_0x410fbd){return _0x410fbd['destroy']()['then'](function(){var _0x5507a6=_0x410fbd['get']({'plain':!![]});var _0x1867c8='CmHopperAdditionalPhones';return db[_0xe8f9('0x24')][_0xe8f9('0x25')]({'where':{'type':_0x1867c8,'resourceId':_0x5507a6['id']}})[_0xe8f9('0x23')](function(){return _0x410fbd;});})[_0xe8f9('0x23')](function(){_0x258d6c[_0xe8f9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b7e5,_0x658f75){return function(_0x5b13d8){if(!_0x5b13d8){_0x20b7e5[_0xe8f9('0x17')](0x194);}return _0x5b13d8;};}function handleError(_0x4e4e64,_0x18c78e){_0x18c78e=_0x18c78e||0x1f4;return function(_0x3c065f){logger[_0xe8f9('0x26')](_0x3c065f[_0xe8f9('0x27')]);if(_0x3c065f['name']){delete _0x3c065f['name'];}_0x4e4e64[_0xe8f9('0x18')](_0x18c78e)[_0xe8f9('0x28')](_0x3c065f);};}exports[_0xe8f9('0x29')]=function(_0x946db3,_0x2221a0){var _0x252e88={},_0x22ce07={},_0x21e6e0={'count':0x0,'rows':[]};var _0x2b51b4=_[_0xe8f9('0x2a')](db[_0xe8f9('0x2b')][_0xe8f9('0x2c')],function(_0x1924bb){return{'name':_0x1924bb[_0xe8f9('0x2d')],'type':_0x1924bb['type'][_0xe8f9('0x2e')]};});_0x22ce07['model']=_[_0xe8f9('0x2a')](_0x2b51b4,_0xe8f9('0x2f'));_0x22ce07[_0xe8f9('0x30')]=_[_0xe8f9('0x31')](_0x946db3[_0xe8f9('0x30')]);_0x22ce07[_0xe8f9('0x32')]=_[_0xe8f9('0x33')](_0x22ce07['model'],_0x22ce07[_0xe8f9('0x30')]);_0x252e88[_0xe8f9('0x34')]=_[_0xe8f9('0x33')](_0x22ce07['model'],qs[_0xe8f9('0x35')](_0x946db3[_0xe8f9('0x30')][_0xe8f9('0x35')]));_0x252e88['attributes']=_0x252e88[_0xe8f9('0x34')][_0xe8f9('0x36')]?_0x252e88[_0xe8f9('0x34')]:_0x22ce07[_0xe8f9('0x37')];if(!_0x946db3['query']['hasOwnProperty'](_0xe8f9('0x38'))){_0x252e88[_0xe8f9('0x1d')]=qs[_0xe8f9('0x1d')](_0x946db3[_0xe8f9('0x30')][_0xe8f9('0x1d')]);_0x252e88[_0xe8f9('0x1b')]=qs[_0xe8f9('0x1b')](_0x946db3[_0xe8f9('0x30')][_0xe8f9('0x1b')]);}_0x252e88[_0xe8f9('0x39')]=qs[_0xe8f9('0x3a')](_0x946db3[_0xe8f9('0x30')]['sort']);_0x252e88[_0xe8f9('0x3b')]=qs['filters'](_['pick'](_0x946db3[_0xe8f9('0x30')],_0x22ce07[_0xe8f9('0x32')]),_0x2b51b4);if(_0x946db3[_0xe8f9('0x30')][_0xe8f9('0x3c')]){_0x252e88['where']=_[_0xe8f9('0x3d')](_0x252e88[_0xe8f9('0x3b')],{'$or':_[_0xe8f9('0x2a')](_0x2b51b4,function(_0x4e6d48){if(_0x4e6d48[_0xe8f9('0x3e')]!=='VIRTUAL'){var _0x111a34={};_0x111a34[_0x4e6d48[_0xe8f9('0x2f')]]={'$like':'%'+_0x946db3[_0xe8f9('0x30')][_0xe8f9('0x3c')]+'%'};return _0x111a34;}})});}_0x252e88=_[_0xe8f9('0x3d')]({},_0x252e88,_0x946db3['options']);var _0x5bf831={'where':_0x252e88[_0xe8f9('0x3b')]};return db['CmHopperAdditionalPhone'][_0xe8f9('0x3f')](_0x5bf831)['then'](function(_0xce07ab){_0x21e6e0[_0xe8f9('0x3f')]=_0xce07ab;if(_0x946db3[_0xe8f9('0x30')]['includeAll']){_0x252e88[_0xe8f9('0x40')]=[{'all':!![]}];}return db[_0xe8f9('0x2b')][_0xe8f9('0x41')](_0x252e88);})[_0xe8f9('0x23')](function(_0x27894a){_0x21e6e0['rows']=_0x27894a;return _0x21e6e0;})[_0xe8f9('0x23')](respondWithFilteredResult(_0x2221a0,_0x252e88))[_0xe8f9('0x42')](handleError(_0x2221a0,null));};exports[_0xe8f9('0x43')]=function(_0x52cbfa,_0xeb9d9b){var _0x147429={'raw':!![],'where':{'id':_0x52cbfa[_0xe8f9('0x44')]['id']}},_0x3c3a31={};_0x3c3a31[_0xe8f9('0x37')]=_[_0xe8f9('0x31')](db[_0xe8f9('0x2b')][_0xe8f9('0x2c')]);_0x3c3a31[_0xe8f9('0x30')]=_[_0xe8f9('0x31')](_0x52cbfa[_0xe8f9('0x30')]);_0x3c3a31[_0xe8f9('0x32')]=_[_0xe8f9('0x33')](_0x3c3a31[_0xe8f9('0x37')],_0x3c3a31['query']);_0x147429[_0xe8f9('0x34')]=_['intersection'](_0x3c3a31[_0xe8f9('0x37')],qs[_0xe8f9('0x35')](_0x52cbfa[_0xe8f9('0x30')][_0xe8f9('0x35')]));_0x147429[_0xe8f9('0x34')]=_0x147429[_0xe8f9('0x34')][_0xe8f9('0x36')]?_0x147429[_0xe8f9('0x34')]:_0x3c3a31[_0xe8f9('0x37')];if(_0x52cbfa[_0xe8f9('0x30')][_0xe8f9('0x45')]){_0x147429[_0xe8f9('0x40')]=[{'all':!![]}];}_0x147429=_[_0xe8f9('0x3d')]({},_0x147429,_0x52cbfa[_0xe8f9('0x46')]);return db['CmHopperAdditionalPhone'][_0xe8f9('0x47')](_0x147429)[_0xe8f9('0x23')](handleEntityNotFound(_0xeb9d9b,null))[_0xe8f9('0x23')](respondWithResult(_0xeb9d9b,null))['catch'](handleError(_0xeb9d9b,null));};exports[_0xe8f9('0x48')]=function(_0xa45cb2,_0x4b20cd){return db[_0xe8f9('0x2b')][_0xe8f9('0x48')](_0xa45cb2[_0xe8f9('0x49')],{})[_0xe8f9('0x23')](function(_0x2f0702){var _0x28021d=_0xa45cb2[_0xe8f9('0x4a')][_0xe8f9('0x4b')]({'plain':!![]});if(!_0x28021d)throw new Error(_0xe8f9('0x4c'));if(_0x28021d[_0xe8f9('0x4d')]==='user'){var _0x19a5c2=_0x2f0702[_0xe8f9('0x4b')]({'plain':!![]});var _0x3c8ea4=_0xe8f9('0x4e');return db[_0xe8f9('0x4f')][_0xe8f9('0x47')]({'where':{'name':_0x3c8ea4,'userProfileId':_0x28021d[_0xe8f9('0x50')]},'raw':!![]})[_0xe8f9('0x23')](function(_0x613950){if(_0x613950&&_0x613950['autoAssociation']===0x0){return db[_0xe8f9('0x24')][_0xe8f9('0x48')]({'name':_0x19a5c2[_0xe8f9('0x2f')],'resourceId':_0x19a5c2['id'],'type':_0x613950[_0xe8f9('0x2f')],'sectionId':_0x613950['id']},{})[_0xe8f9('0x23')](function(){return _0x2f0702;});}else{return _0x2f0702;}})[_0xe8f9('0x42')](function(_0x779f5){logger[_0xe8f9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x779f5);throw _0x779f5;});}return _0x2f0702;})[_0xe8f9('0x23')](respondWithResult(_0x4b20cd,0xc9))[_0xe8f9('0x42')](handleError(_0x4b20cd,null));};exports[_0xe8f9('0x22')]=function(_0x41044b,_0x4c200d){if(_0x41044b[_0xe8f9('0x49')]['id']){delete _0x41044b[_0xe8f9('0x49')]['id'];}return db[_0xe8f9('0x2b')][_0xe8f9('0x47')]({'where':{'id':_0x41044b['params']['id']}})[_0xe8f9('0x23')](handleEntityNotFound(_0x4c200d,null))[_0xe8f9('0x23')](saveUpdates(_0x41044b[_0xe8f9('0x49')],null))[_0xe8f9('0x23')](respondWithResult(_0x4c200d,null))[_0xe8f9('0x42')](handleError(_0x4c200d,null));};exports[_0xe8f9('0x25')]=function(_0x819dba,_0x1e5e67){return db[_0xe8f9('0x2b')]['find']({'where':{'id':_0x819dba[_0xe8f9('0x44')]['id']}})[_0xe8f9('0x23')](handleEntityNotFound(_0x1e5e67,null))[_0xe8f9('0x23')](removeEntity(_0x1e5e67,null))[_0xe8f9('0x42')](handleError(_0x1e5e67,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 86cce3c..688ed77 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21dc=['util','../../config/logger','api','moment','request-promise','path','./cmHopperAdditionalPhone.attributes','define','lodash'];(function(_0xb58f94,_0x55d9f1){var _0x4fb6e2=function(_0x94b579){while(--_0x94b579){_0xb58f94['push'](_0xb58f94['shift']());}};_0x4fb6e2(++_0x55d9f1);}(_0x21dc,0x170));var _0xc21d=function(_0x4db05a,_0x312cfc){_0x4db05a=_0x4db05a-0x0;var _0x437280=_0x21dc[_0x4db05a];return _0x437280;};'use strict';var _=require(_0xc21d('0x0'));var util=require(_0xc21d('0x1'));var logger=require(_0xc21d('0x2'))(_0xc21d('0x3'));var moment=require(_0xc21d('0x4'));var BPromise=require('bluebird');var rp=require(_0xc21d('0x5'));var fs=require('fs');var path=require(_0xc21d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc21d('0x7'));module['exports']=function(_0x4e492b,_0x51637a){return _0x4e492b[_0xc21d('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cc8=['bluebird','request-promise','path','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','moment'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x6cc8,0x1c9));var _0x86cc=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x6cc8[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x86cc('0x0'));var util=require(_0x86cc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x86cc('0x2'));var BPromise=require(_0x86cc('0x3'));var rp=require(_0x86cc('0x4'));var fs=require('fs');var path=require(_0x86cc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x86cc('0x6'));module['exports']=function(_0x357013,_0x19e5b0){return _0x357013[_0x86cc('0x7')](_0x86cc('0x8'),attributes,{'tableName':_0x86cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 660ce2b..e014899 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x983f=['update','activateAdditionalPhone','IncrementPreviewCounters','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countagentrejectretry','SwapAdditionalPhones','ListId','duration','CmHopperAdditionalPhone','add','minutes','isNil','phone','createdAt','updatedAt','transaction'];(function(_0x4a6362,_0x9e782a){var _0x2653a5=function(_0x52b12b){while(--_0x52b12b){_0x4a6362['push'](_0x4a6362['shift']());}};_0x2653a5(++_0x9e782a);}(_0x983f,0x184));var _0xf983=function(_0x398436,_0x281e48){_0x398436=_0x398436-0x0;var _0xc944fb=_0x983f[_0x398436];return _0xc944fb;};'use strict';var _=require('lodash');var util=require(_0xf983('0x0'));var moment=require(_0xf983('0x1'));var BPromise=require(_0xf983('0x2'));var rs=require(_0xf983('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf983('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf983('0x5'))(_0xf983('0x6'));var config=require(_0xf983('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf983('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x293b2e,_0xfa78ad,_0x39486f){return new BPromise(function(_0x212e55,_0xdaf328){return client[_0xf983('0x9')](_0x293b2e,_0x39486f)[_0xf983('0xa')](function(_0x21c18b){logger[_0xf983('0xb')](_0xf983('0xc'),_0xfa78ad,_0xf983('0xd'));logger[_0xf983('0xe')](_0xf983('0xf'),_0xfa78ad,_0xf983('0xd'),JSON[_0xf983('0x10')](_0x21c18b));if(_0x21c18b[_0xf983('0x11')]){if(_0x21c18b['error'][_0xf983('0x12')]===0x1f4){logger[_0xf983('0x11')](_0xf983('0xc'),_0xfa78ad,_0x21c18b[_0xf983('0x11')][_0xf983('0x13')]);return _0xdaf328(_0x21c18b['error'][_0xf983('0x13')]);}logger[_0xf983('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xfa78ad,_0x21c18b[_0xf983('0x11')]['message']);return _0x212e55(_0x21c18b['error'][_0xf983('0x13')]);}else{logger[_0xf983('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xfa78ad,_0xf983('0xd'));_0x212e55(_0x21c18b[_0xf983('0x14')][_0xf983('0x13')]);}})[_0xf983('0x15')](function(_0x35ca26){logger['error'](_0xf983('0xc'),_0xfa78ad,_0x35ca26);_0xdaf328(_0x35ca26);});});}exports[_0xf983('0x16')]=function(_0x7d711c){var _0x4f8f1c=this;return new Promise(function(_0x20db81,_0x470a9c){return db[_0xf983('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x7d711c[_0xf983('0x18')][_0xf983('0x19')],'ListId':_0x7d711c['body']['ListId'],'VoiceQueueId':_0x7d711c[_0xf983('0x18')][_0xf983('0x1a')]===undefined?null:_0x7d711c[_0xf983('0x18')][_0xf983('0x1a')],'CampaignId':_0x7d711c[_0xf983('0x18')][_0xf983('0x1b')]===undefined?null:_0x7d711c[_0xf983('0x18')]['CampaignId']}})[_0xf983('0xa')](function(_0x52edf0){if(_0x52edf0!=null){return db['CmHopperAdditionalPhone'][_0xf983('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x52edf0['id'],'OrderBy':{'$gt':_0x52edf0[_0xf983('0x1d')]}},'order':[[_0xf983('0x1d'),_0xf983('0x1e')]]})[_0xf983('0xa')](function(_0x4a7fac){var _0x3be0f2=0x0;if(_0x4a7fac){if(_0x4a7fac[_0xf983('0x1f')]+_0x4a7fac[_0xf983('0x20')]+_0x4a7fac[_0xf983('0x21')]+_0x4a7fac[_0xf983('0x22')]+_0x4a7fac[_0xf983('0x23')]+_0x4a7fac[_0xf983('0x24')]+_0x4a7fac[_0xf983('0x25')]+_0x4a7fac['countagentrejectretry']<_0x7d711c[_0xf983('0x26')][_0xf983('0x27')])_0x3be0f2=0x1;_0x20db81({'additional':_0x3be0f2});}else{return db['CmHopperAdditionalPhone'][_0xf983('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x52edf0['id']},'order':[[_0xf983('0x1d'),_0xf983('0x1e')]]})[_0xf983('0xa')](function(_0x56e94){var _0x5af5dd=0x0;if(_0x56e94){if(_0x56e94[_0xf983('0x1f')]+_0x56e94['countcongestionretry']+_0x56e94[_0xf983('0x21')]+_0x56e94['countnosuchnumberretry']+_0x56e94['countdropretry']+_0x56e94[_0xf983('0x24')]+_0x56e94['countmachineretry']+_0x56e94[_0xf983('0x28')]<_0x7d711c['entity'][_0xf983('0x27')])_0x5af5dd=0x1;_0x20db81({'additional':_0x5af5dd});}else{_0x20db81({'additional':0x0});}})[_0xf983('0x15')](function(_0x5b9b6a){logger[_0xf983('0x11')](_0xf983('0x16'),_0x5b9b6a[_0xf983('0x13')]);_0x470a9c(_0x4f8f1c[_0xf983('0x11')](0x1f4,_0x5b9b6a[_0xf983('0x13')]));});}})[_0xf983('0x15')](function(_0xfb6db5){logger['error'](_0xf983('0x16'),_0xfb6db5[_0xf983('0x13')]);_0x470a9c(_0x4f8f1c[_0xf983('0x11')](0x1f4,_0xfb6db5[_0xf983('0x13')]));});}else _0x20db81({'additional':0x0});});});};exports[_0xf983('0x29')]=function(_0x38b151){var _0x3a80fa=this;return new Promise(function(_0x3a2d8d,_0x1de428){return db[_0xf983('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x38b151[_0xf983('0x18')]['ContactId'],'ListId':_0x38b151[_0xf983('0x18')][_0xf983('0x2a')],'VoiceQueueId':_0x38b151[_0xf983('0x18')][_0xf983('0x1a')]===undefined?null:_0x38b151[_0xf983('0x18')][_0xf983('0x1a')],'CampaignId':_0x38b151['body'][_0xf983('0x1b')]===undefined?null:_0x38b151[_0xf983('0x18')]['CampaignId']}})[_0xf983('0xa')](function(_0x2cfceb){if(_0x2cfceb!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2cfceb['id'],'OrderBy':{'$gte':_0x2cfceb[_0xf983('0x1d')]}},'order':[['OrderBy',_0xf983('0x1e')]]})[_0xf983('0xa')](function(_0x34a3a8){if(_0x34a3a8)return activateAdditionalPhone(_0x2cfceb,_0x38b151[_0xf983('0x18')],_0x34a3a8,_0x38b151[_0xf983('0x2b')],_0x38b151['waitTime'])[_0xf983('0xa')](function(_0x434a9c){_0x3a2d8d(_0x434a9c);});else{return db[_0xf983('0x2c')][_0xf983('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x2cfceb['id']},'order':[[_0xf983('0x1d'),_0xf983('0x1e')]]})[_0xf983('0xa')](function(_0x45ffb1){if(_0x45ffb1)return activateAdditionalPhone(_0x2cfceb,_0x38b151[_0xf983('0x18')],_0x45ffb1,_0x38b151[_0xf983('0x2b')],_0x38b151['waitTime'])[_0xf983('0xa')](function(_0x177d31){_0x3a2d8d(_0x177d31);});else{_0x3a2d8d({'id':_0x2cfceb['id'],'phone':''});}})[_0xf983('0x15')](function(_0x16801b){logger[_0xf983('0x11')]('VerifyAdditionalPhones',_0x16801b[_0xf983('0x13')]);_0x1de428(_0x3a80fa[_0xf983('0x11')](0x1f4,_0x16801b['message']));});}})[_0xf983('0x15')](function(_0x100067){logger[_0xf983('0x11')](_0xf983('0x16'),_0x100067[_0xf983('0x13')]);_0x1de428(_0x3a80fa[_0xf983('0x11')](0x1f4,_0x100067[_0xf983('0x13')]));});}else _0x3a2d8d(0x1);});});};function activateAdditionalPhone(_0x236f95,_0x27373b,_0x5be211,_0x123a0c,_0x8c1f34){return new Promise(function(_0x3abf87,_0x131ccd){var _0x45d928;if(_['isNil'](_0x5be211['scheduledat'])){_0x5be211['scheduledat']=moment();}if(moment()>moment(_0x5be211['scheduledat'])){_0x45d928=moment()[_0xf983('0x2d')](_0x8c1f34||0x3,'minutes');}else{if(_0x5be211[_0xf983('0x1d')]==0x0){_0x45d928=moment(_0x5be211['scheduledat']);}else{_0x45d928=moment()[_0xf983('0x2d')](_0x8c1f34||0x3,_0xf983('0x2e'));}}if(_[_0xf983('0x2f')](_0x45d928)){_0x45d928=moment()[_0xf983('0x2d')](_0x8c1f34||0x3,_0xf983('0x2e'));}var _0x27cfb6={'phone':_0x236f95[_0xf983('0x30')],'active':0x0,'OrderBy':_[_0xf983('0x2f')](_0x236f95[_0xf983('0x1d')])?0x0:_0x236f95['OrderBy'],'scheduledat':moment()[_0xf983('0x2d')](_0x123a0c||0x1,'minutes'),'countbusyretry':_0x27373b[_0xf983('0x1f')],'countcongestionretry':_0x27373b['countcongestionretry'],'countnoanswerretry':_0x27373b[_0xf983('0x21')],'countnosuchnumberretry':_0x27373b['countnosuchnumberretry'],'countdropretry':_0x27373b[_0xf983('0x23')],'countabandonedretry':_0x27373b[_0xf983('0x24')],'countmachineretry':_0x27373b[_0xf983('0x25')],'countagentrejectretry':_0x27373b['countagentrejectretry'],'createdAt':_0x27373b[_0xf983('0x31')],'updatedAt':_0x27373b['updatedAt']};var _0x3a7b57={'CmHopperId':_0x236f95['id'],'phone':_0x5be211[_0xf983('0x30')],'active':0x0,'OrderBy':_[_0xf983('0x2f')](_0x5be211[_0xf983('0x1d')])?0x0:_0x5be211[_0xf983('0x1d')],'scheduledat':_0x45d928,'countbusyretry':_0x5be211[_0xf983('0x1f')],'countcongestionretry':_0x5be211[_0xf983('0x20')],'countnoanswerretry':_0x5be211[_0xf983('0x21')],'countnosuchnumberretry':_0x5be211[_0xf983('0x22')],'countdropretry':_0x5be211[_0xf983('0x23')],'countabandonedretry':_0x5be211[_0xf983('0x24')],'countmachineretry':_0x5be211[_0xf983('0x25')],'countagentrejectretry':_0x5be211[_0xf983('0x28')],'createdAt':_0x5be211[_0xf983('0x31')],'updatedAt':_0x5be211[_0xf983('0x32')]};return db['sequelize'][_0xf983('0x33')](function(_0x554196){return db['CmHopperAdditionalPhone']['update'](_0x27cfb6,{'where':{'id':_0x5be211['id']}},{'transaction':_0x554196})[_0xf983('0xa')](function(){return db['CmHopper'][_0xf983('0x34')](_0x3a7b57,{'where':{'id':_0x236f95['id']}},{'transaction':_0x554196});});})['then'](function(_0x3f4192){_0x3abf87({'id':_0x236f95['id'],'phone':_0x5be211[_0xf983('0x30')]});})[_0xf983('0x15')](function(_0x115b56){logger[_0xf983('0x11')](_0xf983('0x35'),_0x115b56['message']);_0x131ccd({'error':_0x115b56['message']});});});}exports[_0xf983('0x36')]=function(_0x2d8e53){var _0x352f9c=this;return new Promise(function(_0x4f21c7,_0x4f94b3){return db[_0xf983('0x17')]['update'](_0x2d8e53['body']['field'],{'where':{'id':_0x2d8e53[_0xf983('0x18')]['id']}})[_0xf983('0xa')](function(_0x4b9bd8){_0x4f21c7(_0x4b9bd8);})['catch'](function(_0x21e8c6){logger['error'](_0xf983('0x36'),_0x21e8c6[_0xf983('0x13')]);_0x4f94b3(_0x352f9c['error'](0x1f4,_0x21e8c6[_0xf983('0x13')]));});});}; \ No newline at end of file +var _0x7496=['VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','countnoanswerretry','dialGlobalMaxRetry','catch','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result'];(function(_0xc82582,_0x526d7d){var _0x3f7e59=function(_0x221095){while(--_0x221095){_0xc82582['push'](_0xc82582['shift']());}};_0x3f7e59(++_0x526d7d);}(_0x7496,0x16e));var _0x6749=function(_0x482d5c,_0x841427){_0x482d5c=_0x482d5c-0x0;var _0x592efb=_0x7496[_0x482d5c];return _0x592efb;};'use strict';var _=require(_0x6749('0x0'));var util=require('util');var moment=require(_0x6749('0x1'));var BPromise=require(_0x6749('0x2'));var rs=require(_0x6749('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6749('0x4'));var logger=require(_0x6749('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6749('0x6'));var client=jayson[_0x6749('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b0bb2,_0x51d311,_0x2c55e){return new BPromise(function(_0x1fdf4a,_0x19d2b4){return client[_0x6749('0x8')](_0x4b0bb2,_0x2c55e)['then'](function(_0x4ebbd2){logger[_0x6749('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x51d311,_0x6749('0xa'));logger[_0x6749('0xb')](_0x6749('0xc'),_0x51d311,_0x6749('0xa'),JSON[_0x6749('0xd')](_0x4ebbd2));if(_0x4ebbd2[_0x6749('0xe')]){if(_0x4ebbd2[_0x6749('0xe')][_0x6749('0xf')]===0x1f4){logger[_0x6749('0xe')](_0x6749('0x10'),_0x51d311,_0x4ebbd2[_0x6749('0xe')][_0x6749('0x11')]);return _0x19d2b4(_0x4ebbd2[_0x6749('0xe')][_0x6749('0x11')]);}logger[_0x6749('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x51d311,_0x4ebbd2['error'][_0x6749('0x11')]);return _0x1fdf4a(_0x4ebbd2[_0x6749('0xe')][_0x6749('0x11')]);}else{logger['info'](_0x6749('0x10'),_0x51d311,'request\x20sent');_0x1fdf4a(_0x4ebbd2[_0x6749('0x12')]['message']);}})['catch'](function(_0x31e6a9){logger[_0x6749('0xe')](_0x6749('0x10'),_0x51d311,_0x31e6a9);_0x19d2b4(_0x31e6a9);});});}exports[_0x6749('0x13')]=function(_0x18fee0){var _0x2baff0=this;return new Promise(function(_0x129d24,_0x36ee49){return db[_0x6749('0x14')][_0x6749('0x15')]({'raw':!![],'where':{'ContactId':_0x18fee0['body'][_0x6749('0x16')],'ListId':_0x18fee0[_0x6749('0x17')][_0x6749('0x18')],'VoiceQueueId':_0x18fee0[_0x6749('0x17')][_0x6749('0x19')]===undefined?null:_0x18fee0[_0x6749('0x17')][_0x6749('0x19')],'CampaignId':_0x18fee0[_0x6749('0x17')][_0x6749('0x1a')]===undefined?null:_0x18fee0[_0x6749('0x17')]['CampaignId']}})['then'](function(_0x2f5e62){if(_0x2f5e62!=null){return db[_0x6749('0x1b')][_0x6749('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2f5e62['id'],'OrderBy':{'$gt':_0x2f5e62[_0x6749('0x1c')]}},'order':[[_0x6749('0x1c'),_0x6749('0x1d')]]})[_0x6749('0x1e')](function(_0x1a4116){var _0x97f899=0x0;if(_0x1a4116){if(_0x1a4116[_0x6749('0x1f')]+_0x1a4116[_0x6749('0x20')]+_0x1a4116['countnoanswerretry']+_0x1a4116[_0x6749('0x21')]+_0x1a4116[_0x6749('0x22')]+_0x1a4116[_0x6749('0x23')]+_0x1a4116[_0x6749('0x24')]+_0x1a4116['countagentrejectretry']<_0x18fee0[_0x6749('0x25')]['dialGlobalMaxRetry'])_0x97f899=0x1;_0x129d24({'additional':_0x97f899});}else{return db['CmHopperAdditionalPhone'][_0x6749('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2f5e62['id']},'order':[[_0x6749('0x1c'),'ASC']]})[_0x6749('0x1e')](function(_0x373156){var _0x5b101b=0x0;if(_0x373156){if(_0x373156[_0x6749('0x1f')]+_0x373156[_0x6749('0x20')]+_0x373156[_0x6749('0x26')]+_0x373156[_0x6749('0x21')]+_0x373156[_0x6749('0x22')]+_0x373156[_0x6749('0x23')]+_0x373156[_0x6749('0x24')]+_0x373156['countagentrejectretry']<_0x18fee0[_0x6749('0x25')][_0x6749('0x27')])_0x5b101b=0x1;_0x129d24({'additional':_0x5b101b});}else{_0x129d24({'additional':0x0});}})[_0x6749('0x28')](function(_0xa60c09){logger[_0x6749('0xe')](_0x6749('0x13'),_0xa60c09[_0x6749('0x11')]);_0x36ee49(_0x2baff0['error'](0x1f4,_0xa60c09[_0x6749('0x11')]));});}})['catch'](function(_0x5edd3f){logger[_0x6749('0xe')](_0x6749('0x13'),_0x5edd3f['message']);_0x36ee49(_0x2baff0[_0x6749('0xe')](0x1f4,_0x5edd3f[_0x6749('0x11')]));});}else _0x129d24({'additional':0x0});});});};exports[_0x6749('0x29')]=function(_0x38decc){var _0x4ae8a5=this;return new Promise(function(_0x415066,_0x48e714){return db[_0x6749('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x38decc[_0x6749('0x17')]['ContactId'],'ListId':_0x38decc[_0x6749('0x17')][_0x6749('0x18')],'VoiceQueueId':_0x38decc['body']['VoiceQueueId']===undefined?null:_0x38decc[_0x6749('0x17')][_0x6749('0x19')],'CampaignId':_0x38decc['body']['CampaignId']===undefined?null:_0x38decc['body'][_0x6749('0x1a')]}})[_0x6749('0x1e')](function(_0x332e52){if(_0x332e52!=null){return db[_0x6749('0x1b')][_0x6749('0x15')]({'raw':!![],'where':{'CmHopperId':_0x332e52['id'],'OrderBy':{'$gte':_0x332e52['OrderBy']}},'order':[[_0x6749('0x1c'),_0x6749('0x1d')]]})[_0x6749('0x1e')](function(_0x43c950){if(_0x43c950)return activateAdditionalPhone(_0x332e52,_0x38decc[_0x6749('0x17')],_0x43c950,_0x38decc[_0x6749('0x2a')],_0x38decc['waitTime'])[_0x6749('0x1e')](function(_0x4fdd6e){_0x415066(_0x4fdd6e);});else{return db[_0x6749('0x1b')][_0x6749('0x15')]({'raw':!![],'where':{'CmHopperId':_0x332e52['id']},'order':[[_0x6749('0x1c'),_0x6749('0x1d')]]})[_0x6749('0x1e')](function(_0x4cdc0e){if(_0x4cdc0e)return activateAdditionalPhone(_0x332e52,_0x38decc[_0x6749('0x17')],_0x4cdc0e,_0x38decc[_0x6749('0x2a')],_0x38decc[_0x6749('0x2b')])['then'](function(_0x16c584){_0x415066(_0x16c584);});else{_0x415066({'id':_0x332e52['id'],'phone':''});}})[_0x6749('0x28')](function(_0x398420){logger[_0x6749('0xe')](_0x6749('0x13'),_0x398420['message']);_0x48e714(_0x4ae8a5[_0x6749('0xe')](0x1f4,_0x398420[_0x6749('0x11')]));});}})[_0x6749('0x28')](function(_0x5cf7be){logger[_0x6749('0xe')]('VerifyAdditionalPhones',_0x5cf7be[_0x6749('0x11')]);_0x48e714(_0x4ae8a5[_0x6749('0xe')](0x1f4,_0x5cf7be[_0x6749('0x11')]));});}else _0x415066(0x1);});});};function activateAdditionalPhone(_0x1505e8,_0x1b771a,_0x215519,_0x1f5d65,_0x18ba3c){return new Promise(function(_0x39141d,_0x2eac6d){var _0x1a2257;if(_['isNil'](_0x215519[_0x6749('0x2c')])){_0x215519[_0x6749('0x2c')]=moment();}if(moment()>moment(_0x215519[_0x6749('0x2c')])){_0x1a2257=moment()[_0x6749('0x2d')](_0x18ba3c||0x3,_0x6749('0x2e'));}else{if(_0x215519['OrderBy']==0x0){_0x1a2257=moment(_0x215519[_0x6749('0x2c')]);}else{_0x1a2257=moment()['add'](_0x18ba3c||0x3,_0x6749('0x2e'));}}if(_[_0x6749('0x2f')](_0x1a2257)){_0x1a2257=moment()['add'](_0x18ba3c||0x3,_0x6749('0x2e'));}var _0x283671={'phone':_0x1505e8[_0x6749('0x30')],'active':0x0,'OrderBy':_[_0x6749('0x2f')](_0x1505e8[_0x6749('0x1c')])?0x0:_0x1505e8[_0x6749('0x1c')],'scheduledat':moment()[_0x6749('0x2d')](_0x1f5d65||0x1,_0x6749('0x2e')),'countbusyretry':_0x1b771a[_0x6749('0x1f')],'countcongestionretry':_0x1b771a['countcongestionretry'],'countnoanswerretry':_0x1b771a[_0x6749('0x26')],'countnosuchnumberretry':_0x1b771a[_0x6749('0x21')],'countdropretry':_0x1b771a[_0x6749('0x22')],'countabandonedretry':_0x1b771a[_0x6749('0x23')],'countmachineretry':_0x1b771a[_0x6749('0x24')],'countagentrejectretry':_0x1b771a['countagentrejectretry'],'createdAt':_0x1b771a[_0x6749('0x31')],'updatedAt':_0x1b771a[_0x6749('0x32')]};var _0x2b5ab3={'CmHopperId':_0x1505e8['id'],'phone':_0x215519[_0x6749('0x30')],'active':0x0,'OrderBy':_[_0x6749('0x2f')](_0x215519[_0x6749('0x1c')])?0x0:_0x215519[_0x6749('0x1c')],'scheduledat':_0x1a2257,'countbusyretry':_0x215519[_0x6749('0x1f')],'countcongestionretry':_0x215519[_0x6749('0x20')],'countnoanswerretry':_0x215519[_0x6749('0x26')],'countnosuchnumberretry':_0x215519['countnosuchnumberretry'],'countdropretry':_0x215519[_0x6749('0x22')],'countabandonedretry':_0x215519[_0x6749('0x23')],'countmachineretry':_0x215519[_0x6749('0x24')],'countagentrejectretry':_0x215519['countagentrejectretry'],'createdAt':_0x215519[_0x6749('0x31')],'updatedAt':_0x215519[_0x6749('0x32')]};return db[_0x6749('0x33')][_0x6749('0x34')](function(_0x1cc44a){return db[_0x6749('0x1b')][_0x6749('0x35')](_0x283671,{'where':{'id':_0x215519['id']}},{'transaction':_0x1cc44a})[_0x6749('0x1e')](function(){return db[_0x6749('0x14')][_0x6749('0x35')](_0x2b5ab3,{'where':{'id':_0x1505e8['id']}},{'transaction':_0x1cc44a});});})[_0x6749('0x1e')](function(_0x5868c3){_0x39141d({'id':_0x1505e8['id'],'phone':_0x215519[_0x6749('0x30')]});})[_0x6749('0x28')](function(_0xb306a9){logger['error']('activateAdditionalPhone',_0xb306a9[_0x6749('0x11')]);_0x2eac6d({'error':_0xb306a9[_0x6749('0x11')]});});});}exports[_0x6749('0x36')]=function(_0x2d4571){var _0x3f96b1=this;return new Promise(function(_0x54beef,_0x4f0ec8){return db[_0x6749('0x14')]['update'](_0x2d4571[_0x6749('0x17')]['field'],{'where':{'id':_0x2d4571[_0x6749('0x17')]['id']}})[_0x6749('0x1e')](function(_0x47292c){_0x54beef(_0x47292c);})['catch'](function(_0x5469bc){logger[_0x6749('0xe')]('IncrementPreviewCounters',_0x5469bc[_0x6749('0x11')]);_0x4f0ec8(_0x3f96b1[_0x6749('0xe')](0x1f4,_0x5469bc[_0x6749('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 65d8bb0..e10830a 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2c9=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','get','isAuthenticated','show','create','put'];(function(_0x643826,_0xe197a5){var _0x1c5408=function(_0x1f0441){while(--_0x1f0441){_0x643826['push'](_0x643826['shift']());}};_0x1c5408(++_0xe197a5);}(_0xf2c9,0xa4));var _0x9f2c=function(_0x28b95f,_0x19a5fa){_0x28b95f=_0x28b95f-0x0;var _0x2a1bf4=_0xf2c9[_0x28b95f];return _0x2a1bf4;};'use strict';var multer=require(_0x9f2c('0x0'));var util=require(_0x9f2c('0x1'));var path=require(_0x9f2c('0x2'));var timeout=require(_0x9f2c('0x3'));var express=require(_0x9f2c('0x4'));var router=express['Router']();var fs_extra=require(_0x9f2c('0x5'));var auth=require(_0x9f2c('0x6'));var interaction=require(_0x9f2c('0x7'));var config=require(_0x9f2c('0x8'));var controller=require(_0x9f2c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9f2c('0xa')]);router[_0x9f2c('0xb')]('/:id',auth[_0x9f2c('0xc')](),controller[_0x9f2c('0xd')]);router['post']('/',auth[_0x9f2c('0xc')](),controller[_0x9f2c('0xe')]);router[_0x9f2c('0xf')](_0x9f2c('0x10'),auth[_0x9f2c('0xc')](),controller[_0x9f2c('0x11')]);router['delete'](_0x9f2c('0x10'),auth[_0x9f2c('0xc')](),controller[_0x9f2c('0x12')]);module[_0x9f2c('0x13')]=router; \ No newline at end of file +var _0x26c8=['../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x26c8,0xc9));var _0x826c=function(_0x585814,_0x67fb7c){_0x585814=_0x585814-0x0;var _0x15c032=_0x26c8[_0x585814];return _0x15c032;};'use strict';var multer=require(_0x826c('0x0'));var util=require(_0x826c('0x1'));var path=require(_0x826c('0x2'));var timeout=require(_0x826c('0x3'));var express=require(_0x826c('0x4'));var router=express[_0x826c('0x5')]();var fs_extra=require(_0x826c('0x6'));var auth=require(_0x826c('0x7'));var interaction=require(_0x826c('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x826c('0x9')]('/',auth[_0x826c('0xa')](),controller['index']);router['get'](_0x826c('0xb'),auth[_0x826c('0xa')](),controller[_0x826c('0xc')]);router[_0x826c('0xd')]('/',auth[_0x826c('0xa')](),controller[_0x826c('0xe')]);router[_0x826c('0xf')](_0x826c('0xb'),auth[_0x826c('0xa')](),controller['update']);router[_0x826c('0x10')]('/:id',auth[_0x826c('0xa')](),controller[_0x826c('0x11')]);module[_0x826c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 015c15a..cff652f 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.attributes.js +++ b/server/api/cmHopperBlack/cmHopperBlack.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf131=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0xf4d05,_0x5e601f){var _0x47c971=function(_0x17aae3){while(--_0x17aae3){_0xf4d05['push'](_0xf4d05['shift']());}};_0x47c971(++_0x5e601f);}(_0xf131,0x1a1));var _0x1f13=function(_0x299e6b,_0x98005){_0x299e6b=_0x299e6b-0x0;var _0xae8fdf=_0xf131[_0x299e6b];return _0xae8fdf;};'use strict';var moment=require(_0x1f13('0x0'));var Sequelize=require(_0x1f13('0x1'));module[_0x1f13('0x2')]={'phone':{'type':Sequelize[_0x1f13('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1f13('0x4')],'unique':_0x1f13('0x5')},'ListId':{'type':Sequelize[_0x1f13('0x4')],'unique':_0x1f13('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x1f13('0x5')}}; \ No newline at end of file +var _0xf69d=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x22e02f,_0x322b37){var _0x511df3=function(_0x3c22c2){while(--_0x3c22c2){_0x22e02f['push'](_0x22e02f['shift']());}};_0x511df3(++_0x322b37);}(_0xf69d,0xd3));var _0xdf69=function(_0x339bc1,_0x3c5d17){_0x339bc1=_0x339bc1-0x0;var _0xad4978=_0xf69d[_0x339bc1];return _0xad4978;};'use strict';var moment=require(_0xdf69('0x0'));var Sequelize=require(_0xdf69('0x1'));module[_0xdf69('0x2')]={'phone':{'type':Sequelize[_0xdf69('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdf69('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xdf69('0x4')],'unique':_0xdf69('0x5')},'VoiceQueueId':{'type':Sequelize[_0xdf69('0x4')],'unique':_0xdf69('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a5fe38f..5eca9b4 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bc9=['bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','catch','body','describe','rimraf','zip-dir','fast-json-patch','moment'];(function(_0xe1ccd9,_0xacc0ee){var _0x51b73f=function(_0x467950){while(--_0x467950){_0xe1ccd9['push'](_0xe1ccd9['shift']());}};_0x51b73f(++_0xacc0ee);}(_0x9bc9,0x8c));var _0x99bc=function(_0x415ca6,_0x10f33c){_0x415ca6=_0x415ca6-0x0;var _0x5aa79b=_0x9bc9[_0x415ca6];return _0x5aa79b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99bc('0x0'));var zipdir=require(_0x99bc('0x1'));var jsonpatch=require(_0x99bc('0x2'));var rp=require('request-promise');var moment=require(_0x99bc('0x3'));var BPromise=require(_0x99bc('0x4'));var Mustache=require(_0x99bc('0x5'));var util=require(_0x99bc('0x6'));var path=require('path');var sox=require(_0x99bc('0x7'));var csv=require(_0x99bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x99bc('0x9'));var crypto=require(_0x99bc('0xa'));var jsforce=require(_0x99bc('0xb'));var deskjs=require(_0x99bc('0xc'));var toCsv=require(_0x99bc('0x8'));var querystring=require('querystring');var Papa=require(_0x99bc('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x99bc('0xe'));var as=require(_0x99bc('0xf'));var hardwareService=require(_0x99bc('0x10'));var logger=require(_0x99bc('0x11'))('api');var utils=require(_0x99bc('0x12'));var config=require(_0x99bc('0x13'));var licenseUtil=require(_0x99bc('0x14'));var db=require(_0x99bc('0x15'))['db'];function respondWithStatusCode(_0xd46489,_0x46df31){_0x46df31=_0x46df31||0xcc;return function(_0x2c4a3a){if(_0x2c4a3a){return _0xd46489['sendStatus'](_0x46df31);}return _0xd46489[_0x99bc('0x16')](_0x46df31)['end']();};}function respondWithResult(_0x1e35ee,_0x10cde8){_0x10cde8=_0x10cde8||0xc8;return function(_0x401582){if(_0x401582){return _0x1e35ee[_0x99bc('0x16')](_0x10cde8)['json'](_0x401582);}};}function respondWithFilteredResult(_0xbb6c2f,_0x554d83){return function(_0x5c8cac){if(_0x5c8cac){var _0x2b5139=typeof _0x554d83[_0x99bc('0x17')]===_0x99bc('0x18')&&typeof _0x554d83[_0x99bc('0x19')]==='undefined';var _0x54805b=_0x5c8cac[_0x99bc('0x1a')];var _0x408257=_0x2b5139?0x0:_0x554d83[_0x99bc('0x17')];var _0x4813f7=_0x2b5139?_0x5c8cac['count']:_0x554d83['offset']+_0x554d83[_0x99bc('0x19')];var _0x84f4e0;if(_0x4813f7>=_0x54805b){_0x4813f7=_0x54805b;_0x84f4e0=0xc8;}else{_0x84f4e0=0xce;}_0xbb6c2f[_0x99bc('0x16')](_0x84f4e0);return _0xbb6c2f[_0x99bc('0x1b')]('Content-Range',_0x408257+'-'+_0x4813f7+'/'+_0x54805b)['json'](_0x5c8cac);}return null;};}function patchUpdates(_0x4fc496){return function(_0x564501){try{jsonpatch[_0x99bc('0x1c')](_0x564501,_0x4fc496,!![]);}catch(_0x5096dd){return BPromise[_0x99bc('0x1d')](_0x5096dd);}return _0x564501[_0x99bc('0x1e')]();};}function saveUpdates(_0x33bb15,_0x325dfe){return function(_0x35c581){if(_0x35c581){return _0x35c581[_0x99bc('0x1f')](_0x33bb15)[_0x99bc('0x20')](function(_0x5c521d){return _0x5c521d;});}return null;};}function removeEntity(_0x50f849,_0x26db31){return function(_0x12baa6){if(_0x12baa6){return _0x12baa6[_0x99bc('0x21')]()[_0x99bc('0x20')](function(){_0x50f849[_0x99bc('0x16')](0xcc)[_0x99bc('0x22')]();});}};}function handleEntityNotFound(_0x2232f2,_0x4d5353){return function(_0x47f8f3){if(!_0x47f8f3){_0x2232f2[_0x99bc('0x23')](0x194);}return _0x47f8f3;};}function handleError(_0x4fb03d,_0x2fa99b){_0x2fa99b=_0x2fa99b||0x1f4;return function(_0x39fe47){logger[_0x99bc('0x24')](_0x39fe47['stack']);if(_0x39fe47['name']){delete _0x39fe47[_0x99bc('0x25')];}_0x4fb03d[_0x99bc('0x16')](_0x2fa99b)[_0x99bc('0x26')](_0x39fe47);};}exports[_0x99bc('0x27')]=function(_0x4153f4,_0x212eaa){var _0x3cff3c={},_0x515c58={},_0x6ea3b3={'count':0x0,'rows':[]};var _0x2eb273=_['map'](db[_0x99bc('0x28')][_0x99bc('0x29')],function(_0x3c2b36){return{'name':_0x3c2b36[_0x99bc('0x2a')],'type':_0x3c2b36[_0x99bc('0x2b')][_0x99bc('0x2c')]};});_0x515c58[_0x99bc('0x2d')]=_[_0x99bc('0x2e')](_0x2eb273,_0x99bc('0x25'));_0x515c58[_0x99bc('0x2f')]=_[_0x99bc('0x30')](_0x4153f4[_0x99bc('0x2f')]);_0x515c58['filters']=_[_0x99bc('0x31')](_0x515c58[_0x99bc('0x2d')],_0x515c58[_0x99bc('0x2f')]);_0x3cff3c[_0x99bc('0x32')]=_['intersection'](_0x515c58[_0x99bc('0x2d')],qs[_0x99bc('0x33')](_0x4153f4[_0x99bc('0x2f')][_0x99bc('0x33')]));_0x3cff3c[_0x99bc('0x32')]=_0x3cff3c[_0x99bc('0x32')][_0x99bc('0x34')]?_0x3cff3c['attributes']:_0x515c58[_0x99bc('0x2d')];if(!_0x4153f4[_0x99bc('0x2f')][_0x99bc('0x35')]('nolimit')){_0x3cff3c['limit']=qs[_0x99bc('0x19')](_0x4153f4['query'][_0x99bc('0x19')]);_0x3cff3c['offset']=qs[_0x99bc('0x17')](_0x4153f4[_0x99bc('0x2f')][_0x99bc('0x17')]);}_0x3cff3c[_0x99bc('0x36')]=qs[_0x99bc('0x37')](_0x4153f4[_0x99bc('0x2f')][_0x99bc('0x37')]);_0x3cff3c[_0x99bc('0x38')]=qs[_0x99bc('0x39')](_[_0x99bc('0x3a')](_0x4153f4[_0x99bc('0x2f')],_0x515c58[_0x99bc('0x39')]),_0x2eb273);if(_0x4153f4[_0x99bc('0x2f')]['filter']){_0x3cff3c[_0x99bc('0x38')]=_[_0x99bc('0x3b')](_0x3cff3c[_0x99bc('0x38')],{'$or':_[_0x99bc('0x2e')](_0x2eb273,function(_0x2c9b06){if(_0x2c9b06['type']!==_0x99bc('0x3c')){var _0x46f94c={};_0x46f94c[_0x2c9b06[_0x99bc('0x25')]]={'$like':'%'+_0x4153f4[_0x99bc('0x2f')][_0x99bc('0x3d')]+'%'};return _0x46f94c;}})});}_0x3cff3c=_[_0x99bc('0x3b')]({},_0x3cff3c,_0x4153f4['options']);var _0x157e56={'where':_0x3cff3c['where']};return db[_0x99bc('0x28')][_0x99bc('0x1a')](_0x157e56)[_0x99bc('0x20')](function(_0x32bde1){_0x6ea3b3['count']=_0x32bde1;if(_0x4153f4['query'][_0x99bc('0x3e')]){_0x3cff3c[_0x99bc('0x3f')]=[{'all':!![]}];}return db[_0x99bc('0x28')][_0x99bc('0x40')](_0x3cff3c);})[_0x99bc('0x20')](function(_0x75e3b2){_0x6ea3b3['rows']=_0x75e3b2;return _0x6ea3b3;})['then'](respondWithFilteredResult(_0x212eaa,_0x3cff3c))['catch'](handleError(_0x212eaa,null));};exports[_0x99bc('0x41')]=function(_0x13e679,_0x2485c0){var _0x51a54a={'raw':!![],'where':{'id':_0x13e679[_0x99bc('0x42')]['id']}},_0x3b3289={};_0x3b3289[_0x99bc('0x2d')]=_[_0x99bc('0x30')](db[_0x99bc('0x28')][_0x99bc('0x29')]);_0x3b3289['query']=_[_0x99bc('0x30')](_0x13e679[_0x99bc('0x2f')]);_0x3b3289['filters']=_[_0x99bc('0x31')](_0x3b3289[_0x99bc('0x2d')],_0x3b3289[_0x99bc('0x2f')]);_0x51a54a[_0x99bc('0x32')]=_[_0x99bc('0x31')](_0x3b3289[_0x99bc('0x2d')],qs[_0x99bc('0x33')](_0x13e679[_0x99bc('0x2f')][_0x99bc('0x33')]));_0x51a54a['attributes']=_0x51a54a[_0x99bc('0x32')][_0x99bc('0x34')]?_0x51a54a[_0x99bc('0x32')]:_0x3b3289[_0x99bc('0x2d')];if(_0x13e679[_0x99bc('0x2f')][_0x99bc('0x3e')]){_0x51a54a['include']=[{'all':!![]}];}_0x51a54a=_[_0x99bc('0x3b')]({},_0x51a54a,_0x13e679[_0x99bc('0x43')]);return db[_0x99bc('0x28')][_0x99bc('0x44')](_0x51a54a)[_0x99bc('0x20')](handleEntityNotFound(_0x2485c0,null))[_0x99bc('0x20')](respondWithResult(_0x2485c0,null))[_0x99bc('0x45')](handleError(_0x2485c0,null));};exports['update']=function(_0x211e09,_0x4bd6d1){if(_0x211e09[_0x99bc('0x46')]['id']){delete _0x211e09[_0x99bc('0x46')]['id'];}return db[_0x99bc('0x28')][_0x99bc('0x44')]({'where':{'id':_0x211e09[_0x99bc('0x42')]['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x4bd6d1,null))[_0x99bc('0x20')](saveUpdates(_0x211e09['body'],null))[_0x99bc('0x20')](respondWithResult(_0x4bd6d1,null))[_0x99bc('0x45')](handleError(_0x4bd6d1,null));};exports[_0x99bc('0x21')]=function(_0x97a2c3,_0x5578d5){return db['CmHopperBlack']['find']({'where':{'id':_0x97a2c3[_0x99bc('0x42')]['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x5578d5,null))['then'](removeEntity(_0x5578d5,null))[_0x99bc('0x45')](handleError(_0x5578d5,null));};exports[_0x99bc('0x47')]=function(_0x15f97e,_0x1d4e5d){return db[_0x99bc('0x28')][_0x99bc('0x47')]()[_0x99bc('0x20')](respondWithResult(_0x1d4e5d,null))[_0x99bc('0x45')](handleError(_0x1d4e5d,null));}; \ No newline at end of file +var _0x672a=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x320e94,_0x4140b1){var _0x1002be=function(_0x3244e2){while(--_0x3244e2){_0x320e94['push'](_0x320e94['shift']());}};_0x1002be(++_0x4140b1);}(_0x672a,0x122));var _0xa672=function(_0x3fa4ca,_0xf1b97c){_0x3fa4ca=_0x3fa4ca-0x0;var _0x330003=_0x672a[_0x3fa4ca];return _0x330003;};'use strict';var emlformat=require(_0xa672('0x0'));var rimraf=require(_0xa672('0x1'));var zipdir=require(_0xa672('0x2'));var jsonpatch=require(_0xa672('0x3'));var rp=require(_0xa672('0x4'));var moment=require(_0xa672('0x5'));var BPromise=require(_0xa672('0x6'));var Mustache=require(_0xa672('0x7'));var util=require(_0xa672('0x8'));var path=require(_0xa672('0x9'));var sox=require(_0xa672('0xa'));var csv=require('to-csv');var ejs=require(_0xa672('0xb'));var fs=require('fs');var fs_extra=require(_0xa672('0xc'));var _=require(_0xa672('0xd'));var squel=require(_0xa672('0xe'));var crypto=require(_0xa672('0xf'));var jsforce=require(_0xa672('0x10'));var deskjs=require(_0xa672('0x11'));var toCsv=require(_0xa672('0x12'));var querystring=require(_0xa672('0x13'));var Papa=require(_0xa672('0x14'));var Redis=require(_0xa672('0x15'));var authService=require(_0xa672('0x16'));var qs=require(_0xa672('0x17'));var as=require(_0xa672('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa672('0x19'))(_0xa672('0x1a'));var utils=require('../../config/utils');var config=require(_0xa672('0x1b'));var licenseUtil=require(_0xa672('0x1c'));var db=require(_0xa672('0x1d'))['db'];function respondWithStatusCode(_0x3df690,_0x413577){_0x413577=_0x413577||0xcc;return function(_0x25a041){if(_0x25a041){return _0x3df690[_0xa672('0x1e')](_0x413577);}return _0x3df690[_0xa672('0x1f')](_0x413577)[_0xa672('0x20')]();};}function respondWithResult(_0x540a20,_0x3e101f){_0x3e101f=_0x3e101f||0xc8;return function(_0x3e1855){if(_0x3e1855){return _0x540a20['status'](_0x3e101f)['json'](_0x3e1855);}};}function respondWithFilteredResult(_0x43eab2,_0x5bc33f){return function(_0x54950e){if(_0x54950e){var _0x598ebd=typeof _0x5bc33f[_0xa672('0x21')]==='undefined'&&typeof _0x5bc33f['limit']===_0xa672('0x22');var _0x1943d9=_0x54950e[_0xa672('0x23')];var _0xc5eeb3=_0x598ebd?0x0:_0x5bc33f[_0xa672('0x21')];var _0x10dc1c=_0x598ebd?_0x54950e[_0xa672('0x23')]:_0x5bc33f[_0xa672('0x21')]+_0x5bc33f[_0xa672('0x24')];var _0x389fe4;if(_0x10dc1c>=_0x1943d9){_0x10dc1c=_0x1943d9;_0x389fe4=0xc8;}else{_0x389fe4=0xce;}_0x43eab2['status'](_0x389fe4);return _0x43eab2[_0xa672('0x25')](_0xa672('0x26'),_0xc5eeb3+'-'+_0x10dc1c+'/'+_0x1943d9)[_0xa672('0x27')](_0x54950e);}return null;};}function patchUpdates(_0x39da72){return function(_0x39acfb){try{jsonpatch[_0xa672('0x28')](_0x39acfb,_0x39da72,!![]);}catch(_0x47c96e){return BPromise[_0xa672('0x29')](_0x47c96e);}return _0x39acfb[_0xa672('0x2a')]();};}function saveUpdates(_0x14cd8b,_0x894eef){return function(_0x394e54){if(_0x394e54){return _0x394e54['update'](_0x14cd8b)[_0xa672('0x2b')](function(_0x140537){return _0x140537;});}return null;};}function removeEntity(_0x2bc5db,_0x47000f){return function(_0x4a9d19){if(_0x4a9d19){return _0x4a9d19['destroy']()[_0xa672('0x2b')](function(){_0x2bc5db['status'](0xcc)[_0xa672('0x20')]();});}};}function handleEntityNotFound(_0x31f755,_0x13141c){return function(_0x6f8ffa){if(!_0x6f8ffa){_0x31f755[_0xa672('0x1e')](0x194);}return _0x6f8ffa;};}function handleError(_0x117a65,_0x5442b0){_0x5442b0=_0x5442b0||0x1f4;return function(_0x5388f1){logger[_0xa672('0x2c')](_0x5388f1[_0xa672('0x2d')]);if(_0x5388f1[_0xa672('0x2e')]){delete _0x5388f1['name'];}_0x117a65[_0xa672('0x1f')](_0x5442b0)[_0xa672('0x2f')](_0x5388f1);};}exports['index']=function(_0x3cfa40,_0x3ccbf7){var _0x5032c6={},_0x210c42={},_0x1f5344={'count':0x0,'rows':[]};var _0x47daa1=_[_0xa672('0x30')](db[_0xa672('0x31')][_0xa672('0x32')],function(_0x19760c){return{'name':_0x19760c[_0xa672('0x33')],'type':_0x19760c['type'][_0xa672('0x34')]};});_0x210c42[_0xa672('0x35')]=_[_0xa672('0x30')](_0x47daa1,_0xa672('0x2e'));_0x210c42[_0xa672('0x36')]=_[_0xa672('0x37')](_0x3cfa40['query']);_0x210c42[_0xa672('0x38')]=_['intersection'](_0x210c42[_0xa672('0x35')],_0x210c42[_0xa672('0x36')]);_0x5032c6[_0xa672('0x39')]=_[_0xa672('0x3a')](_0x210c42[_0xa672('0x35')],qs['fields'](_0x3cfa40['query']['fields']));_0x5032c6[_0xa672('0x39')]=_0x5032c6['attributes'][_0xa672('0x3b')]?_0x5032c6[_0xa672('0x39')]:_0x210c42[_0xa672('0x35')];if(!_0x3cfa40[_0xa672('0x36')]['hasOwnProperty'](_0xa672('0x3c'))){_0x5032c6[_0xa672('0x24')]=qs[_0xa672('0x24')](_0x3cfa40[_0xa672('0x36')]['limit']);_0x5032c6['offset']=qs[_0xa672('0x21')](_0x3cfa40[_0xa672('0x36')][_0xa672('0x21')]);}_0x5032c6[_0xa672('0x3d')]=qs[_0xa672('0x3e')](_0x3cfa40[_0xa672('0x36')]['sort']);_0x5032c6[_0xa672('0x3f')]=qs['filters'](_[_0xa672('0x40')](_0x3cfa40[_0xa672('0x36')],_0x210c42[_0xa672('0x38')]),_0x47daa1);if(_0x3cfa40[_0xa672('0x36')][_0xa672('0x41')]){_0x5032c6[_0xa672('0x3f')]=_['merge'](_0x5032c6['where'],{'$or':_[_0xa672('0x30')](_0x47daa1,function(_0x7821bc){if(_0x7821bc[_0xa672('0x42')]!==_0xa672('0x43')){var _0x165bd1={};_0x165bd1[_0x7821bc[_0xa672('0x2e')]]={'$like':'%'+_0x3cfa40[_0xa672('0x36')][_0xa672('0x41')]+'%'};return _0x165bd1;}})});}_0x5032c6=_[_0xa672('0x44')]({},_0x5032c6,_0x3cfa40[_0xa672('0x45')]);var _0x423517={'where':_0x5032c6[_0xa672('0x3f')]};return db[_0xa672('0x31')]['count'](_0x423517)[_0xa672('0x2b')](function(_0x5db469){_0x1f5344[_0xa672('0x23')]=_0x5db469;if(_0x3cfa40[_0xa672('0x36')][_0xa672('0x46')]){_0x5032c6['include']=[{'all':!![]}];}return db[_0xa672('0x31')]['findAll'](_0x5032c6);})[_0xa672('0x2b')](function(_0x39f217){_0x1f5344[_0xa672('0x47')]=_0x39f217;return _0x1f5344;})[_0xa672('0x2b')](respondWithFilteredResult(_0x3ccbf7,_0x5032c6))[_0xa672('0x48')](handleError(_0x3ccbf7,null));};exports[_0xa672('0x49')]=function(_0x12585d,_0x4e485c){var _0x45f150={'raw':!![],'where':{'id':_0x12585d[_0xa672('0x4a')]['id']}},_0x3e5594={};_0x3e5594[_0xa672('0x35')]=_[_0xa672('0x37')](db[_0xa672('0x31')][_0xa672('0x32')]);_0x3e5594[_0xa672('0x36')]=_['keys'](_0x12585d[_0xa672('0x36')]);_0x3e5594[_0xa672('0x38')]=_['intersection'](_0x3e5594[_0xa672('0x35')],_0x3e5594[_0xa672('0x36')]);_0x45f150['attributes']=_[_0xa672('0x3a')](_0x3e5594[_0xa672('0x35')],qs['fields'](_0x12585d[_0xa672('0x36')]['fields']));_0x45f150[_0xa672('0x39')]=_0x45f150['attributes'][_0xa672('0x3b')]?_0x45f150[_0xa672('0x39')]:_0x3e5594[_0xa672('0x35')];if(_0x12585d[_0xa672('0x36')]['includeAll']){_0x45f150['include']=[{'all':!![]}];}_0x45f150=_[_0xa672('0x44')]({},_0x45f150,_0x12585d[_0xa672('0x45')]);return db[_0xa672('0x31')][_0xa672('0x4b')](_0x45f150)['then'](handleEntityNotFound(_0x4e485c,null))[_0xa672('0x2b')](respondWithResult(_0x4e485c,null))[_0xa672('0x48')](handleError(_0x4e485c,null));};exports['update']=function(_0x5f085e,_0x54787e){if(_0x5f085e[_0xa672('0x4c')]['id']){delete _0x5f085e[_0xa672('0x4c')]['id'];}return db[_0xa672('0x31')]['find']({'where':{'id':_0x5f085e[_0xa672('0x4a')]['id']}})[_0xa672('0x2b')](handleEntityNotFound(_0x54787e,null))['then'](saveUpdates(_0x5f085e[_0xa672('0x4c')],null))['then'](respondWithResult(_0x54787e,null))['catch'](handleError(_0x54787e,null));};exports[_0xa672('0x4d')]=function(_0x299b8d,_0x2ea664){return db[_0xa672('0x31')][_0xa672('0x4b')]({'where':{'id':_0x299b8d[_0xa672('0x4a')]['id']}})[_0xa672('0x2b')](handleEntityNotFound(_0x2ea664,null))[_0xa672('0x2b')](removeEntity(_0x2ea664,null))['catch'](handleError(_0x2ea664,null));};exports[_0xa672('0x4e')]=function(_0x5d79ce,_0x4d0258){return db[_0xa672('0x31')][_0xa672('0x4e')]()[_0xa672('0x2b')](respondWithResult(_0x4d0258,null))[_0xa672('0x48')](handleError(_0x4d0258,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b380506..3a0ebad 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae32=['exports','define','CmHopperBlack','cm_hopper_black','util','api','request-promise','path','rimraf','./cmHopperBlack.attributes'];(function(_0x1bd655,_0x568614){var _0x4040e4=function(_0x2c6944){while(--_0x2c6944){_0x1bd655['push'](_0x1bd655['shift']());}};_0x4040e4(++_0x568614);}(_0xae32,0x72));var _0x2ae3=function(_0x34612f,_0x14eee7){_0x34612f=_0x34612f-0x0;var _0x3c770b=_0xae32[_0x34612f];return _0x3c770b;};'use strict';var _=require('lodash');var util=require(_0x2ae3('0x0'));var logger=require('../../config/logger')(_0x2ae3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ae3('0x2'));var fs=require('fs');var path=require(_0x2ae3('0x3'));var rimraf=require(_0x2ae3('0x4'));var config=require('../../config/environment');var attributes=require(_0x2ae3('0x5'));module[_0x2ae3('0x6')]=function(_0x272afc,_0x3fa613){return _0x272afc[_0x2ae3('0x7')](_0x2ae3('0x8'),attributes,{'tableName':_0x2ae3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaff=['bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xfaff,0x18b));var _0xffaf=function(_0x396052,_0x46a315){_0x396052=_0x396052-0x0;var _0x2221c4=_0xfaff[_0x396052];return _0x2221c4;};'use strict';var _=require(_0xffaf('0x0'));var util=require(_0xffaf('0x1'));var logger=require(_0xffaf('0x2'))(_0xffaf('0x3'));var moment=require(_0xffaf('0x4'));var BPromise=require(_0xffaf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xffaf('0x6'));var config=require(_0xffaf('0x7'));var attributes=require(_0xffaf('0x8'));module['exports']=function(_0x577711,_0x1b61e0){return _0x577711['define']('CmHopperBlack',attributes,{'tableName':_0xffaf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index f55cce7..f51b19c 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.rpc.js +++ b/server/api/cmHopperBlack/cmHopperBlack.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b95=['include','map','model','then','stringify','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit'];(function(_0x462042,_0x524279){var _0x585608=function(_0x3811df){while(--_0x3811df){_0x462042['push'](_0x462042['shift']());}};_0x585608(++_0x524279);}(_0x3b95,0x10f));var _0x53b9=function(_0x1d5e95,_0xc688b9){_0x1d5e95=_0x1d5e95-0x0;var _0x51ab92=_0x3b95[_0x1d5e95];return _0x51ab92;};'use strict';var _=require(_0x53b9('0x0'));var util=require(_0x53b9('0x1'));var moment=require(_0x53b9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53b9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x53b9('0x4'));var logger=require(_0x53b9('0x5'))('rpc');var config=require(_0x53b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x53b9('0x7')][_0x53b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x242cd5,_0x3dbbd4,_0x20fba0){return new BPromise(function(_0x2daed1,_0x54cfc3){return client[_0x53b9('0x9')](_0x242cd5,_0x20fba0)['then'](function(_0x5146cb){logger[_0x53b9('0xa')](_0x53b9('0xb'),_0x3dbbd4,_0x53b9('0xc'));logger[_0x53b9('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x3dbbd4,'request\x20sent',JSON['stringify'](_0x5146cb));if(_0x5146cb['error']){if(_0x5146cb[_0x53b9('0xe')]['code']===0x1f4){logger[_0x53b9('0xe')](_0x53b9('0xb'),_0x3dbbd4,_0x5146cb[_0x53b9('0xe')][_0x53b9('0xf')]);return _0x54cfc3(_0x5146cb['error'][_0x53b9('0xf')]);}logger[_0x53b9('0xe')](_0x53b9('0xb'),_0x3dbbd4,_0x5146cb[_0x53b9('0xe')][_0x53b9('0xf')]);return _0x2daed1(_0x5146cb[_0x53b9('0xe')]['message']);}else{logger[_0x53b9('0xa')](_0x53b9('0xb'),_0x3dbbd4,'request\x20sent');_0x2daed1(_0x5146cb[_0x53b9('0x10')]['message']);}})[_0x53b9('0x11')](function(_0x2e8445){logger[_0x53b9('0xe')](_0x53b9('0xb'),_0x3dbbd4,_0x2e8445);_0x54cfc3(_0x2e8445);});});}exports[_0x53b9('0x12')]=function(_0x54db4d){var _0x591ebb=this;return new Promise(function(_0x2caf02,_0x5795f3){return db[_0x53b9('0x13')][_0x53b9('0x14')]({'raw':_0x54db4d[_0x53b9('0x15')]?_0x54db4d[_0x53b9('0x15')][_0x53b9('0x16')]===undefined?!![]:![]:!![],'where':_0x54db4d['options']?_0x54db4d['options'][_0x53b9('0x17')]||null:null,'attributes':_0x54db4d[_0x53b9('0x15')]?_0x54db4d[_0x53b9('0x15')][_0x53b9('0x18')]||null:null,'limit':_0x54db4d[_0x53b9('0x15')]?_0x54db4d[_0x53b9('0x15')][_0x53b9('0x19')]||null:null,'include':_0x54db4d[_0x53b9('0x15')]?_0x54db4d[_0x53b9('0x15')][_0x53b9('0x1a')]?_['map'](_0x54db4d[_0x53b9('0x15')][_0x53b9('0x1a')],function(_0x5691e2){return{'model':db[_0x5691e2['model']],'as':_0x5691e2['as'],'attributes':_0x5691e2[_0x53b9('0x18')],'include':_0x5691e2[_0x53b9('0x1a')]?_[_0x53b9('0x1b')](_0x5691e2[_0x53b9('0x1a')],function(_0x3ed78a){return{'model':db[_0x3ed78a[_0x53b9('0x1c')]],'as':_0x3ed78a['as'],'attributes':_0x3ed78a[_0x53b9('0x18')],'include':_0x3ed78a[_0x53b9('0x1a')]?_[_0x53b9('0x1b')](_0x3ed78a['include'],function(_0x3139f7){return{'model':db[_0x3139f7[_0x53b9('0x1c')]],'as':_0x3139f7['as'],'attributes':_0x3139f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x53b9('0x1d')](function(_0x219380){logger[_0x53b9('0xa')](_0x53b9('0x12'),_0x54db4d);logger['debug']('GetCmHopperBlack',_0x54db4d,JSON[_0x53b9('0x1e')](_0x219380));_0x2caf02(_0x219380);})[_0x53b9('0x11')](function(_0x8c935c){logger[_0x53b9('0xe')]('GetCmHopperBlack',_0x8c935c['message'],_0x54db4d);_0x5795f3(_0x591ebb[_0x53b9('0xe')](0x1f4,_0x8c935c['message']));});});};exports[_0x53b9('0x1f')]=function(_0x5d18c9){var _0x107bb1=this;return new Promise(function(_0x1cc787,_0x942af2){return db[_0x53b9('0x13')]['update'](_0x5d18c9['body'],{'raw':_0x5d18c9['options']?_0x5d18c9[_0x53b9('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d18c9[_0x53b9('0x15')]?_0x5d18c9[_0x53b9('0x15')]['where']||null:null,'attributes':_0x5d18c9['options']?_0x5d18c9[_0x53b9('0x15')][_0x53b9('0x18')]||null:null,'limit':_0x5d18c9[_0x53b9('0x15')]?_0x5d18c9[_0x53b9('0x15')][_0x53b9('0x19')]||null:null})[_0x53b9('0x1d')](function(_0x6c0a2e){logger[_0x53b9('0xa')](_0x53b9('0x1f'),_0x5d18c9);logger[_0x53b9('0xd')](_0x53b9('0x1f'),_0x5d18c9,JSON[_0x53b9('0x1e')](_0x6c0a2e));_0x1cc787(_0x6c0a2e);})['catch'](function(_0x1982d3){logger[_0x53b9('0xe')](_0x53b9('0x1f'),_0x1982d3['message'],_0x5d18c9);_0x942af2(_0x107bb1['error'](0x1f4,_0x1982d3[_0x53b9('0xf')]));});});};exports[_0x53b9('0x20')]=function(_0x37b945){var _0x9da47f=this;return new Promise(function(_0x33f8c5,_0x435d1a){return db[_0x53b9('0x13')]['destroy']({'where':_0x37b945['options']?_0x37b945['options'][_0x53b9('0x17')]||null:null})[_0x53b9('0x1d')](function(_0x4316f1){logger[_0x53b9('0xa')](_0x53b9('0x20'),_0x37b945);logger[_0x53b9('0xd')]('DestroyCmHopperBlack',_0x37b945,JSON[_0x53b9('0x1e')](_0x4316f1));_0x33f8c5(_0x4316f1);})[_0x53b9('0x11')](function(_0x1474c7){logger[_0x53b9('0xe')](_0x53b9('0x20'),_0x1474c7[_0x53b9('0xf')],_0x37b945);_0x435d1a(_0x9da47f[_0x53b9('0xe')](0x1f4,_0x1474c7[_0x53b9('0xf')]));});});}; \ No newline at end of file +var _0x6149=['findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetCmHopperBlack'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x6149,0x1f0));var _0x9614=function(_0x42217a,_0x2ca2f4){_0x42217a=_0x42217a-0x0;var _0x5c042d=_0x6149[_0x42217a];return _0x5c042d;};'use strict';var _=require(_0x9614('0x0'));var util=require(_0x9614('0x1'));var moment=require(_0x9614('0x2'));var BPromise=require(_0x9614('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9614('0x4'));var db=require(_0x9614('0x5'))['db'];var utils=require(_0x9614('0x6'));var logger=require(_0x9614('0x7'))(_0x9614('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9614('0x9')][_0x9614('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4143cc,_0x49b88c,_0x5e345b){return new BPromise(function(_0x36bd8b,_0x35b27d){return client[_0x9614('0xb')](_0x4143cc,_0x5e345b)[_0x9614('0xc')](function(_0x1607c1){logger[_0x9614('0xd')](_0x9614('0xe'),_0x49b88c,_0x9614('0xf'));logger[_0x9614('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x49b88c,_0x9614('0xf'),JSON[_0x9614('0x11')](_0x1607c1));if(_0x1607c1['error']){if(_0x1607c1[_0x9614('0x12')]['code']===0x1f4){logger[_0x9614('0x12')](_0x9614('0xe'),_0x49b88c,_0x1607c1[_0x9614('0x12')][_0x9614('0x13')]);return _0x35b27d(_0x1607c1[_0x9614('0x12')][_0x9614('0x13')]);}logger['error'](_0x9614('0xe'),_0x49b88c,_0x1607c1[_0x9614('0x12')]['message']);return _0x36bd8b(_0x1607c1[_0x9614('0x12')][_0x9614('0x13')]);}else{logger['info'](_0x9614('0xe'),_0x49b88c,_0x9614('0xf'));_0x36bd8b(_0x1607c1['result'][_0x9614('0x13')]);}})[_0x9614('0x14')](function(_0x51016b){logger['error'](_0x9614('0xe'),_0x49b88c,_0x51016b);_0x35b27d(_0x51016b);});});}exports[_0x9614('0x15')]=function(_0x6a49ad){var _0x314636=this;return new Promise(function(_0x3ff473,_0x52bbb3){return db['CmHopperBlack'][_0x9614('0x16')]({'raw':_0x6a49ad['options']?_0x6a49ad[_0x9614('0x17')][_0x9614('0x18')]===undefined?!![]:![]:!![],'where':_0x6a49ad[_0x9614('0x17')]?_0x6a49ad[_0x9614('0x17')][_0x9614('0x19')]||null:null,'attributes':_0x6a49ad['options']?_0x6a49ad[_0x9614('0x17')][_0x9614('0x1a')]||null:null,'limit':_0x6a49ad[_0x9614('0x17')]?_0x6a49ad[_0x9614('0x17')][_0x9614('0x1b')]||null:null,'include':_0x6a49ad['options']?_0x6a49ad[_0x9614('0x17')][_0x9614('0x1c')]?_[_0x9614('0x1d')](_0x6a49ad['options'][_0x9614('0x1c')],function(_0x64daef){return{'model':db[_0x64daef['model']],'as':_0x64daef['as'],'attributes':_0x64daef[_0x9614('0x1a')],'include':_0x64daef[_0x9614('0x1c')]?_['map'](_0x64daef['include'],function(_0x4b3f0f){return{'model':db[_0x4b3f0f[_0x9614('0x1e')]],'as':_0x4b3f0f['as'],'attributes':_0x4b3f0f[_0x9614('0x1a')],'include':_0x4b3f0f[_0x9614('0x1c')]?_[_0x9614('0x1d')](_0x4b3f0f['include'],function(_0x2730ac){return{'model':db[_0x2730ac[_0x9614('0x1e')]],'as':_0x2730ac['as'],'attributes':_0x2730ac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52e247){logger[_0x9614('0xd')](_0x9614('0x15'),_0x6a49ad);logger['debug'](_0x9614('0x15'),_0x6a49ad,JSON[_0x9614('0x11')](_0x52e247));_0x3ff473(_0x52e247);})['catch'](function(_0x3781f1){logger[_0x9614('0x12')](_0x9614('0x15'),_0x3781f1[_0x9614('0x13')],_0x6a49ad);_0x52bbb3(_0x314636['error'](0x1f4,_0x3781f1[_0x9614('0x13')]));});});};exports[_0x9614('0x1f')]=function(_0x5926f3){var _0xc52992=this;return new Promise(function(_0x19ecd0,_0x203c81){return db[_0x9614('0x20')][_0x9614('0x21')](_0x5926f3[_0x9614('0x22')],{'raw':_0x5926f3[_0x9614('0x17')]?_0x5926f3[_0x9614('0x17')][_0x9614('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5926f3[_0x9614('0x17')]?_0x5926f3[_0x9614('0x17')][_0x9614('0x19')]||null:null,'attributes':_0x5926f3['options']?_0x5926f3[_0x9614('0x17')]['attributes']||null:null,'limit':_0x5926f3[_0x9614('0x17')]?_0x5926f3[_0x9614('0x17')][_0x9614('0x1b')]||null:null})[_0x9614('0xc')](function(_0x14d68f){logger[_0x9614('0xd')](_0x9614('0x1f'),_0x5926f3);logger[_0x9614('0x10')](_0x9614('0x1f'),_0x5926f3,JSON[_0x9614('0x11')](_0x14d68f));_0x19ecd0(_0x14d68f);})[_0x9614('0x14')](function(_0x10fa26){logger[_0x9614('0x12')](_0x9614('0x1f'),_0x10fa26[_0x9614('0x13')],_0x5926f3);_0x203c81(_0xc52992[_0x9614('0x12')](0x1f4,_0x10fa26[_0x9614('0x13')]));});});};exports[_0x9614('0x23')]=function(_0x1b2775){var _0x11084d=this;return new Promise(function(_0x3c41a4,_0x5eaccf){return db[_0x9614('0x20')][_0x9614('0x24')]({'where':_0x1b2775[_0x9614('0x17')]?_0x1b2775['options'][_0x9614('0x19')]||null:null})[_0x9614('0xc')](function(_0x3e64b5){logger[_0x9614('0xd')](_0x9614('0x23'),_0x1b2775);logger['debug'](_0x9614('0x23'),_0x1b2775,JSON['stringify'](_0x3e64b5));_0x3c41a4(_0x3e64b5);})['catch'](function(_0x41bd6e){logger[_0x9614('0x12')]('DestroyCmHopperBlack',_0x41bd6e[_0x9614('0x13')],_0x1b2775);_0x5eaccf(_0x11084d[_0x9614('0x12')](0x1f4,_0x41bd6e['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 681f108..77051d7 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fb4=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy'];(function(_0x358bf3,_0x40ec1f){var _0x248106=function(_0x2eb1f3){while(--_0x2eb1f3){_0x358bf3['push'](_0x358bf3['shift']());}};_0x248106(++_0x40ec1f);}(_0x4fb4,0x190));var _0x44fb=function(_0x1189f1,_0x3f2503){_0x1189f1=_0x1189f1-0x0;var _0x2f4ce0=_0x4fb4[_0x1189f1];return _0x2f4ce0;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var fs_extra=require(_0x44fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var controller=require(_0x44fb('0x8'));router[_0x44fb('0x9')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0xb')]);router[_0x44fb('0x9')](_0x44fb('0xc'),auth['isAuthenticated'](),controller[_0x44fb('0xd')]);router[_0x44fb('0x9')]('/:id',auth[_0x44fb('0xa')](),controller[_0x44fb('0xe')]);router[_0x44fb('0xf')](_0x44fb('0x10'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x11')]);router[_0x44fb('0x12')](_0x44fb('0x10'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x33af=['isAuthenticated','describe','show','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','index','/describe'];(function(_0x5d1a40,_0x33a0f3){var _0x2d9da8=function(_0x137fce){while(--_0x137fce){_0x5d1a40['push'](_0x5d1a40['shift']());}};_0x2d9da8(++_0x33a0f3);}(_0x33af,0xec));var _0xf33a=function(_0x4ade33,_0x103537){_0x4ade33=_0x4ade33-0x0;var _0x162cc1=_0x33af[_0x4ade33];return _0x162cc1;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')](_0xf33a('0xf'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router['delete']('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0x11')]);module[_0xf33a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ba2b4ba..7fb2790 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.attributes.js +++ b/server/api/cmHopperFinal/cmHopperFinal.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c40=['setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports','STRING','DATE','INTEGER','endtime'];(function(_0x52143e,_0x441f81){var _0x280a58=function(_0x5ca7d7){while(--_0x5ca7d7){_0x52143e['push'](_0x52143e['shift']());}};_0x280a58(++_0x441f81);}(_0x3c40,0x1f4));var _0x03c4=function(_0x12b71a,_0x5a0f68){_0x12b71a=_0x12b71a-0x0;var _0xfa09c6=_0x3c40[_0x12b71a];return _0xfa09c6;};'use strict';var Sequelize=require(_0x03c4('0x0'));var moment=require('moment');module[_0x03c4('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x03c4('0x2')]},'scheduledat':{'type':Sequelize[_0x03c4('0x3')]},'countbusyretry':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x03c4('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x03c4('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x03c4('0x2')]},'calleridname':{'type':Sequelize[_0x03c4('0x2')]},'starttime':{'type':Sequelize[_0x03c4('0x3')]},'responsetime':{'type':Sequelize[_0x03c4('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x03c4('0x3')]},'endtime':{'type':Sequelize[_0x03c4('0x3')]},'ringtime':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x03c4('0x2')]},'campaign':{'type':Sequelize[_0x03c4('0x2')]},'campaigntype':{'type':Sequelize[_0x03c4('0x2')]},'membername':{'type':Sequelize[_0x03c4('0x2')]},'reason':{'type':Sequelize[_0x03c4('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x03c4('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x03c4('0x3')],'set':function(_0x4eda91){var _0xa2918b=this['getDataValue'](_0x03c4('0x5'));if(_0xa2918b&&_0x4eda91){this[_0x03c4('0x6')](_0x03c4('0x7'),moment(_0x4eda91)[_0x03c4('0x8')](moment(_0xa2918b),_0x03c4('0x9')));}}},'amd':{'type':Sequelize[_0x03c4('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x03c4('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x03c4('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x03c4('0x3')]},'callback':{'type':Sequelize[_0x03c4('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x03c4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x03c4('0x3')]},'deleted':{'type':Sequelize[_0x03c4('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x03c4('0x3')]},'recallme':{'type':Sequelize[_0x03c4('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x03c4('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x03c4('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6476=['exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','BOOLEAN','sequelize','moment'];(function(_0x5e0ee5,_0x42b55c){var _0x452f4a=function(_0x3db46c){while(--_0x3db46c){_0x5e0ee5['push'](_0x5e0ee5['shift']());}};_0x452f4a(++_0x42b55c);}(_0x6476,0x17f));var _0x6647=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x6476[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x6647('0x0'));var moment=require(_0x6647('0x1'));module[_0x6647('0x2')]={'state':{'type':Sequelize[_0x6647('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x6647('0x4')]},'scheduledat':{'type':Sequelize[_0x6647('0x5')]},'countbusyretry':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6647('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x6647('0x4')]},'originatecalleridname':{'type':Sequelize[_0x6647('0x4')]},'calleridnum':{'type':Sequelize[_0x6647('0x4')]},'calleridname':{'type':Sequelize[_0x6647('0x4')]},'starttime':{'type':Sequelize[_0x6647('0x5')]},'responsetime':{'type':Sequelize[_0x6647('0x5')]},'answertime':{'type':Sequelize[_0x6647('0x5')]},'droptime':{'type':Sequelize[_0x6647('0x5')]},'endtime':{'type':Sequelize[_0x6647('0x5')]},'ringtime':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6647('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6647('0x4')]},'reason':{'type':Sequelize[_0x6647('0x4')]},'disposition':{'type':Sequelize[_0x6647('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6647('0x4')]},'dispositionat':{'type':Sequelize[_0x6647('0x5')],'set':function(_0x311994){var _0x246730=this[_0x6647('0x6')](_0x6647('0x7'));if(_0x246730&&_0x311994){this['setDataValue'](_0x6647('0x8'),moment(_0x311994)[_0x6647('0x9')](moment(_0x246730),'seconds'));}}},'amd':{'type':Sequelize[_0x6647('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6647('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6647('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6647('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x6647('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6647('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x6647('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6647('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6647('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6647('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 0087c29..92e9804 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','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','end','status','json','undefined','limit','count'];(function(_0x25d869,_0x19233e){var _0x47d390=function(_0x199688){while(--_0x199688){_0x25d869['push'](_0x25d869['shift']());}};_0x47d390(++_0x19233e);}(_0x5496,0x175));var _0x6549=function(_0x36c5e3,_0x1a32ae){_0x36c5e3=_0x36c5e3-0x0;var _0x172f24=_0x5496[_0x36c5e3];return _0x172f24;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file +var _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0x21ac10,_0x26c96f){var _0x598a56=function(_0x38ad48){while(--_0x38ad48){_0x21ac10['push'](_0x21ac10['shift']());}};_0x598a56(++_0x26c96f);}(_0x2ef3,0xba));var _0x32ef=function(_0x18490e,_0x1f3d9f){_0x18490e=_0x18490e-0x0;var _0x2766e1=_0x2ef3[_0x18490e];return _0x2766e1;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CmHopperFinal'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CmHopperFinal'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CmHopperFinal']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 78ad521..6f09afd 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.model.js +++ b/server/api/cmHopperFinal/cmHopperFinal.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa92=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaa92,0x17f));var _0x2aa9=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xaa92[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0x2aa9('0x0'));var util=require(_0x2aa9('0x1'));var logger=require(_0x2aa9('0x2'))(_0x2aa9('0x3'));var moment=require(_0x2aa9('0x4'));var BPromise=require(_0x2aa9('0x5'));var rp=require(_0x2aa9('0x6'));var fs=require('fs');var path=require(_0x2aa9('0x7'));var rimraf=require(_0x2aa9('0x8'));var config=require(_0x2aa9('0x9'));var attributes=require(_0x2aa9('0xa'));module[_0x2aa9('0xb')]=function(_0x2f74de,_0x4540b3){return _0x2f74de[_0x2aa9('0xc')](_0x2aa9('0xd'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x2aa9('0xe'),'fields':[_0x2aa9('0xe')]},{'name':'uniqueid','fields':[_0x2aa9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a08=['calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x572505,_0x22cf24){var _0x2cc11d=function(_0x2544a7){while(--_0x2544a7){_0x572505['push'](_0x572505['shift']());}};_0x2cc11d(++_0x22cf24);}(_0x1a08,0x72));var _0x81a0=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0x1a08[_0x7a3247];return _0x1bfde5;};'use strict';var _=require(_0x81a0('0x0'));var util=require(_0x81a0('0x1'));var logger=require(_0x81a0('0x2'))('api');var moment=require(_0x81a0('0x3'));var BPromise=require(_0x81a0('0x4'));var rp=require(_0x81a0('0x5'));var fs=require('fs');var path=require(_0x81a0('0x6'));var rimraf=require('rimraf');var config=require(_0x81a0('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x81a0('0x8')]=function(_0x15f5f3,_0x35445c){return _0x15f5f3[_0x81a0('0x9')](_0x81a0('0xa'),attributes,{'tableName':_0x81a0('0xb'),'paranoid':![],'indexes':[{'name':_0x81a0('0xc'),'fields':[_0x81a0('0xc')]},{'name':_0x81a0('0xd'),'fields':[_0x81a0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 0b319dd..0c321ba 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x16c4ec,_0x4958c5){var _0x2db6bc=function(_0xdbe3f2){while(--_0xdbe3f2){_0x16c4ec['push'](_0x16c4ec['shift']());}};_0x2db6bc(++_0x4958c5);}(_0x7a54,0x106));var _0x47a5=function(_0x49e4e5,_0x1aee26){_0x49e4e5=_0x49e4e5-0x0;var _0x5610c3=_0x7a54[_0x49e4e5];return _0x5610c3;};'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')]('CmHopperFinal,\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);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x32042a,_0x3522e6){var _0x3049c0=function(_0x1ce5ef){while(--_0x1ce5ef){_0x32042a['push'](_0x32042a['shift']());}};_0x3049c0(++_0x3522e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x590f0c,_0x1f7002){_0x590f0c=_0x590f0c-0x0;var _0x2de6e0=_0xb10b[_0x590f0c];return _0x2de6e0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 89e10f9..6d8222f 100644 --- a/server/api/cmHopperFinal/index.js +++ b/server/api/cmHopperFinal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcf7=['show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','/:id','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x45dde7,_0x4371a8){var _0x44430a=function(_0x42543e){while(--_0x42543e){_0x45dde7['push'](_0x45dde7['shift']());}};_0x44430a(++_0x4371a8);}(_0xbcf7,0xc1));var _0x7bcf=function(_0x3d40e9,_0x107dee){_0x3d40e9=_0x3d40e9-0x0;var _0x4e742d=_0xbcf7[_0x3d40e9];return _0x4e742d;};'use strict';var multer=require(_0x7bcf('0x0'));var util=require(_0x7bcf('0x1'));var path=require('path');var timeout=require(_0x7bcf('0x2'));var express=require(_0x7bcf('0x3'));var router=express[_0x7bcf('0x4')]();var fs_extra=require(_0x7bcf('0x5'));var auth=require(_0x7bcf('0x6'));var interaction=require(_0x7bcf('0x7'));var config=require(_0x7bcf('0x8'));var controller=require(_0x7bcf('0x9'));router[_0x7bcf('0xa')]('/',auth[_0x7bcf('0xb')](),controller[_0x7bcf('0xc')]);router['get'](_0x7bcf('0xd'),auth[_0x7bcf('0xb')](),controller[_0x7bcf('0xe')]);router['get']('/:id',auth[_0x7bcf('0xb')](),controller[_0x7bcf('0xf')]);router[_0x7bcf('0xa')](_0x7bcf('0x10'),auth[_0x7bcf('0xb')](),controller[_0x7bcf('0x11')]);router[_0x7bcf('0xa')](_0x7bcf('0x12'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x7bcf('0x13')](_0x7bcf('0x14'),auth[_0x7bcf('0xb')](),controller[_0x7bcf('0x15')]);router[_0x7bcf('0x13')](_0x7bcf('0x16'),auth[_0x7bcf('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x7bcf('0x13')]('/checkContactHopper',auth[_0x7bcf('0xb')](),controller[_0x7bcf('0x17')]);router['put'](_0x7bcf('0x18'),auth[_0x7bcf('0xb')](),controller[_0x7bcf('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbb9e=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post'];(function(_0x475923,_0x25d9ec){var _0x374030=function(_0x3f256b){while(--_0x3f256b){_0x475923['push'](_0x475923['shift']());}};_0x374030(++_0x25d9ec);}(_0xbb9e,0xf4));var _0xebb9=function(_0x3426eb,_0x245250){_0x3426eb=_0x3426eb-0x0;var _0x10de12=_0xbb9e[_0x3426eb];return _0x10de12;};'use strict';var multer=require(_0xebb9('0x0'));var util=require('util');var path=require(_0xebb9('0x1'));var timeout=require(_0xebb9('0x2'));var express=require(_0xebb9('0x3'));var router=express[_0xebb9('0x4')]();var fs_extra=require(_0xebb9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xebb9('0x6'));var config=require(_0xebb9('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xebb9('0x8')]);router[_0xebb9('0x9')](_0xebb9('0xa'),auth['isAuthenticated'](),controller[_0xebb9('0xb')]);router[_0xebb9('0x9')](_0xebb9('0xc'),auth[_0xebb9('0xd')](),controller[_0xebb9('0xe')]);router[_0xebb9('0x9')](_0xebb9('0xf'),auth[_0xebb9('0xd')](),controller[_0xebb9('0x10')]);router[_0xebb9('0x9')]('/campaign/countAttributes/:id',auth[_0xebb9('0xd')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xebb9('0x11'),auth[_0xebb9('0xd')](),controller[_0xebb9('0x12')]);router[_0xebb9('0x13')](_0xebb9('0x14'),auth[_0xebb9('0xd')](),controller[_0xebb9('0x15')]);router['post'](_0xebb9('0x16'),auth[_0xebb9('0xd')](),controller['checkContactHopper']);router[_0xebb9('0x17')](_0xebb9('0xc'),auth[_0xebb9('0xd')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 1d1d6be..a0f8b21 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.attributes.js +++ b/server/api/cmHopperHistory/cmHopperHistory.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb245=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x2deb22,_0x1b55ab){var _0x2aa37d=function(_0x4ec7fd){while(--_0x4ec7fd){_0x2deb22['push'](_0x2deb22['shift']());}};_0x2aa37d(++_0x1b55ab);}(_0xb245,0xf8));var _0x5b24=function(_0x499c3d,_0x4039de){_0x499c3d=_0x499c3d-0x0;var _0x553c2e=_0xb245[_0x499c3d];return _0x553c2e;};'use strict';var Sequelize=require(_0x5b24('0x0'));module[_0x5b24('0x1')]={'state':{'type':Sequelize[_0x5b24('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5b24('0x3')]},'countbusyretry':{'type':Sequelize[_0x5b24('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5b24('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5b24('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x5b24('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5b24('0x4')]},'calleridname':{'type':Sequelize[_0x5b24('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5b24('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5b24('0x3')]},'ringtime':{'type':Sequelize[_0x5b24('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5b24('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x5b24('0x4')]},'campaigntype':{'type':Sequelize[_0x5b24('0x4')]},'membername':{'type':Sequelize[_0x5b24('0x4')]},'reason':{'type':Sequelize[_0x5b24('0x4')]},'amd':{'type':Sequelize[_0x5b24('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5b24('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5b24('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5b24('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5b24('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5b24('0x3')]},'edited':{'type':Sequelize[_0x5b24('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5b24('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5b24('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5b24('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5b24('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5b24('0x4')]}}; \ No newline at end of file +var _0x1e43=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x2f32c4,_0x2597ba){var _0x95b5dc=function(_0x4ee89e){while(--_0x4ee89e){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x95b5dc(++_0x2597ba);}(_0x1e43,0x168));var _0x31e4=function(_0x17ac5b,_0x1a2d16){_0x17ac5b=_0x17ac5b-0x0;var _0x2dcec9=_0x1e43[_0x17ac5b];return _0x2dcec9;};'use strict';var Sequelize=require(_0x31e4('0x0'));module[_0x31e4('0x1')]={'state':{'type':Sequelize[_0x31e4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x31e4('0x3')]},'scheduledat':{'type':Sequelize[_0x31e4('0x4')]},'countbusyretry':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x31e4('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x31e4('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x31e4('0x4')]},'droptime':{'type':Sequelize[_0x31e4('0x4')]},'endtime':{'type':Sequelize[_0x31e4('0x4')]},'ringtime':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x31e4('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x31e4('0x3')]},'reason':{'type':Sequelize[_0x31e4('0x3')]},'amd':{'type':Sequelize[_0x31e4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x31e4('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x31e4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x31e4('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x31e4('0x4')]},'recallme':{'type':Sequelize[_0x31e4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x31e4('0x4')]},'edited':{'type':Sequelize[_0x31e4('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x31e4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index cc6ce47..f09e89e 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.controller.js +++ b/server/api/cmHopperHistory/cmHopperHistory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c06=['limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','findAll','rows','catch','params','length','includeAll','include','find','create','body','describe','uniqueid','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x2bc2a2,_0x51e95f){var _0x20de67=function(_0x27f2d2){while(--_0x27f2d2){_0x2bc2a2['push'](_0x2bc2a2['shift']());}};_0x20de67(++_0x51e95f);}(_0x0c06,0x163));var _0x60c0=function(_0x46c23f,_0x2f30b7){_0x46c23f=_0x46c23f-0x0;var _0x27a636=_0x0c06[_0x46c23f];return _0x27a636;};'use strict';var emlformat=require(_0x60c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x60c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60c0('0x2'));var moment=require(_0x60c0('0x3'));var BPromise=require(_0x60c0('0x4'));var Mustache=require(_0x60c0('0x5'));var util=require('util');var path=require(_0x60c0('0x6'));var sox=require(_0x60c0('0x7'));var csv=require(_0x60c0('0x8'));var ejs=require(_0x60c0('0x9'));var fs=require('fs');var fs_extra=require(_0x60c0('0xa'));var _=require('lodash');var squel=require(_0x60c0('0xb'));var crypto=require('crypto');var jsforce=require(_0x60c0('0xc'));var deskjs=require(_0x60c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x60c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x60c0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x60c0('0x10'));var as=require(_0x60c0('0x11'));var hardwareService=require(_0x60c0('0x12'));var logger=require(_0x60c0('0x13'))(_0x60c0('0x14'));var utils=require(_0x60c0('0x15'));var config=require(_0x60c0('0x16'));var licenseUtil=require(_0x60c0('0x17'));var db=require(_0x60c0('0x18'))['db'];function respondWithStatusCode(_0x300ad8,_0x32307b){_0x32307b=_0x32307b||0xcc;return function(_0x47b9c1){if(_0x47b9c1){return _0x300ad8['sendStatus'](_0x32307b);}return _0x300ad8[_0x60c0('0x19')](_0x32307b)[_0x60c0('0x1a')]();};}function respondWithResult(_0x53836e,_0x320474){_0x320474=_0x320474||0xc8;return function(_0x5dc4ed){if(_0x5dc4ed){return _0x53836e['status'](_0x320474)[_0x60c0('0x1b')](_0x5dc4ed);}};}function respondWithFilteredResult(_0x22c4b0,_0xcdf9e8){return function(_0x33c2b8){if(_0x33c2b8){var _0x20b16d=typeof _0xcdf9e8[_0x60c0('0x1c')]===_0x60c0('0x1d')&&typeof _0xcdf9e8[_0x60c0('0x1e')]===_0x60c0('0x1d');var _0x4557cb=_0x33c2b8[_0x60c0('0x1f')];var _0x3e14d3=_0x20b16d?0x0:_0xcdf9e8[_0x60c0('0x1c')];var _0x2b9f07=_0x20b16d?_0x33c2b8[_0x60c0('0x1f')]:_0xcdf9e8[_0x60c0('0x1c')]+_0xcdf9e8[_0x60c0('0x1e')];var _0x1cd378;if(_0x2b9f07>=_0x4557cb){_0x2b9f07=_0x4557cb;_0x1cd378=0xc8;}else{_0x1cd378=0xce;}_0x22c4b0[_0x60c0('0x19')](_0x1cd378);return _0x22c4b0[_0x60c0('0x20')](_0x60c0('0x21'),_0x3e14d3+'-'+_0x2b9f07+'/'+_0x4557cb)[_0x60c0('0x1b')](_0x33c2b8);}return null;};}function patchUpdates(_0x54f1c3){return function(_0xf918e7){try{jsonpatch['apply'](_0xf918e7,_0x54f1c3,!![]);}catch(_0x3abd54){return BPromise[_0x60c0('0x22')](_0x3abd54);}return _0xf918e7[_0x60c0('0x23')]();};}function saveUpdates(_0x3d7e4b,_0x5e1672){return function(_0x4c4c98){if(_0x4c4c98){return _0x4c4c98[_0x60c0('0x24')](_0x3d7e4b)[_0x60c0('0x25')](function(_0x439c9f){return _0x439c9f;});}return null;};}function removeEntity(_0x4201cd,_0x3fa244){return function(_0x2442fb){if(_0x2442fb){return _0x2442fb['destroy']()[_0x60c0('0x25')](function(){_0x4201cd[_0x60c0('0x19')](0xcc)[_0x60c0('0x1a')]();});}};}function handleEntityNotFound(_0x32dd53,_0x568985){return function(_0x53b757){if(!_0x53b757){_0x32dd53[_0x60c0('0x26')](0x194);}return _0x53b757;};}function handleError(_0x3d5457,_0x187341){_0x187341=_0x187341||0x1f4;return function(_0x4fb25a){logger[_0x60c0('0x27')](_0x4fb25a[_0x60c0('0x28')]);if(_0x4fb25a['name']){delete _0x4fb25a[_0x60c0('0x29')];}_0x3d5457['status'](_0x187341)[_0x60c0('0x2a')](_0x4fb25a);};}exports[_0x60c0('0x2b')]=function(_0x168340,_0x29049e){var _0x380c88={},_0x579baf={},_0x25b537={'count':0x0,'rows':[]};var _0xe22495=_['map'](db['CmHopperHistory'][_0x60c0('0x2c')],function(_0x36b7c9){return{'name':_0x36b7c9[_0x60c0('0x2d')],'type':_0x36b7c9[_0x60c0('0x2e')][_0x60c0('0x2f')]};});_0x579baf['model']=_[_0x60c0('0x30')](_0xe22495,_0x60c0('0x29'));_0x579baf[_0x60c0('0x31')]=_[_0x60c0('0x32')](_0x168340[_0x60c0('0x31')]);_0x579baf[_0x60c0('0x33')]=_[_0x60c0('0x34')](_0x579baf[_0x60c0('0x35')],_0x579baf[_0x60c0('0x31')]);_0x380c88[_0x60c0('0x36')]=_[_0x60c0('0x34')](_0x579baf['model'],qs[_0x60c0('0x37')](_0x168340[_0x60c0('0x31')]['fields']));_0x380c88[_0x60c0('0x36')]=_0x380c88[_0x60c0('0x36')]['length']?_0x380c88['attributes']:_0x579baf[_0x60c0('0x35')];if(!_0x168340[_0x60c0('0x31')]['hasOwnProperty'](_0x60c0('0x38'))){_0x380c88['limit']=qs[_0x60c0('0x1e')](_0x168340[_0x60c0('0x31')][_0x60c0('0x1e')]);_0x380c88['offset']=qs[_0x60c0('0x1c')](_0x168340[_0x60c0('0x31')][_0x60c0('0x1c')]);}_0x380c88['order']=qs[_0x60c0('0x39')](_0x168340[_0x60c0('0x31')][_0x60c0('0x39')]);_0x380c88[_0x60c0('0x3a')]=qs[_0x60c0('0x33')](_[_0x60c0('0x3b')](_0x168340['query'],_0x579baf['filters']),_0xe22495);if(_0x168340[_0x60c0('0x31')][_0x60c0('0x3c')]){_0x380c88[_0x60c0('0x3a')]=_[_0x60c0('0x3d')](_0x380c88[_0x60c0('0x3a')],{'$or':_[_0x60c0('0x30')](_0xe22495,function(_0x1aff3a){if(_0x1aff3a[_0x60c0('0x2e')]!==_0x60c0('0x3e')){var _0x2033b9={};_0x2033b9[_0x1aff3a[_0x60c0('0x29')]]={'$like':'%'+_0x168340[_0x60c0('0x31')][_0x60c0('0x3c')]+'%'};return _0x2033b9;}})});}_0x380c88=_['merge']({},_0x380c88,_0x168340[_0x60c0('0x3f')]);var _0x29b773={'where':_0x380c88[_0x60c0('0x3a')]};return db[_0x60c0('0x40')][_0x60c0('0x1f')](_0x29b773)[_0x60c0('0x25')](function(_0x509739){_0x25b537[_0x60c0('0x1f')]=_0x509739;if(_0x168340['query']['includeAll']){_0x380c88['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x60c0('0x41')](_0x380c88);})[_0x60c0('0x25')](function(_0x16b2d7){_0x25b537[_0x60c0('0x42')]=_0x16b2d7;return _0x25b537;})[_0x60c0('0x25')](respondWithFilteredResult(_0x29049e,_0x380c88))[_0x60c0('0x43')](handleError(_0x29049e,null));};exports['show']=function(_0x484c10,_0x1b8aae){var _0x41fe73={'raw':!![],'where':{'id':_0x484c10[_0x60c0('0x44')]['id']}},_0x16a280={};_0x16a280[_0x60c0('0x35')]=_[_0x60c0('0x32')](db[_0x60c0('0x40')][_0x60c0('0x2c')]);_0x16a280[_0x60c0('0x31')]=_[_0x60c0('0x32')](_0x484c10[_0x60c0('0x31')]);_0x16a280[_0x60c0('0x33')]=_[_0x60c0('0x34')](_0x16a280[_0x60c0('0x35')],_0x16a280[_0x60c0('0x31')]);_0x41fe73[_0x60c0('0x36')]=_[_0x60c0('0x34')](_0x16a280[_0x60c0('0x35')],qs[_0x60c0('0x37')](_0x484c10[_0x60c0('0x31')]['fields']));_0x41fe73[_0x60c0('0x36')]=_0x41fe73[_0x60c0('0x36')][_0x60c0('0x45')]?_0x41fe73[_0x60c0('0x36')]:_0x16a280[_0x60c0('0x35')];if(_0x484c10[_0x60c0('0x31')][_0x60c0('0x46')]){_0x41fe73[_0x60c0('0x47')]=[{'all':!![]}];}_0x41fe73=_[_0x60c0('0x3d')]({},_0x41fe73,_0x484c10[_0x60c0('0x3f')]);return db[_0x60c0('0x40')][_0x60c0('0x48')](_0x41fe73)['then'](handleEntityNotFound(_0x1b8aae,null))[_0x60c0('0x25')](respondWithResult(_0x1b8aae,null))[_0x60c0('0x43')](handleError(_0x1b8aae,null));};exports[_0x60c0('0x49')]=function(_0x279ced,_0x55714d){return db['CmHopperHistory'][_0x60c0('0x49')](_0x279ced[_0x60c0('0x4a')],{})[_0x60c0('0x25')](respondWithResult(_0x55714d,0xc9))['catch'](handleError(_0x55714d,null));};exports[_0x60c0('0x4b')]=function(_0x155f80,_0x1edf73){return db[_0x60c0('0x40')]['describe']()[_0x60c0('0x25')](respondWithResult(_0x1edf73,null))[_0x60c0('0x43')](handleError(_0x1edf73,null));};exports[_0x60c0('0x24')]=function(_0x542acb,_0x259062){if(_0x542acb[_0x60c0('0x4a')][_0x60c0('0x4c')]){delete _0x542acb[_0x60c0('0x4a')][_0x60c0('0x4c')];}return db[_0x60c0('0x40')][_0x60c0('0x48')]({'where':{'uniqueid':_0x542acb[_0x60c0('0x44')]['id']}})['then'](handleEntityNotFound(_0x259062,null))['then'](saveUpdates(_0x542acb[_0x60c0('0x4a')],null))[_0x60c0('0x25')](respondWithResult(_0x259062,null))['catch'](handleError(_0x259062,null));}; \ No newline at end of file +var _0x274d=['query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model'];(function(_0x2a7c3b,_0x5098e7){var _0x212198=function(_0xf32235){while(--_0xf32235){_0x2a7c3b['push'](_0x2a7c3b['shift']());}};_0x212198(++_0x5098e7);}(_0x274d,0x1e4));var _0xd274=function(_0x3102d9,_0x300790){_0x3102d9=_0x3102d9-0x0;var _0x399df3=_0x274d[_0x3102d9];return _0x399df3;};'use strict';var emlformat=require(_0xd274('0x0'));var rimraf=require(_0xd274('0x1'));var zipdir=require(_0xd274('0x2'));var jsonpatch=require(_0xd274('0x3'));var rp=require(_0xd274('0x4'));var moment=require(_0xd274('0x5'));var BPromise=require(_0xd274('0x6'));var Mustache=require(_0xd274('0x7'));var util=require(_0xd274('0x8'));var path=require(_0xd274('0x9'));var sox=require(_0xd274('0xa'));var csv=require('to-csv');var ejs=require(_0xd274('0xb'));var fs=require('fs');var fs_extra=require(_0xd274('0xc'));var _=require('lodash');var squel=require(_0xd274('0xd'));var crypto=require(_0xd274('0xe'));var jsforce=require(_0xd274('0xf'));var deskjs=require(_0xd274('0x10'));var toCsv=require(_0xd274('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd274('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd274('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd274('0x14'));var logger=require('../../config/logger')(_0xd274('0x15'));var utils=require('../../config/utils');var config=require(_0xd274('0x16'));var licenseUtil=require(_0xd274('0x17'));var db=require(_0xd274('0x18'))['db'];function respondWithStatusCode(_0xe50ec,_0x157c25){_0x157c25=_0x157c25||0xcc;return function(_0x146812){if(_0x146812){return _0xe50ec['sendStatus'](_0x157c25);}return _0xe50ec['status'](_0x157c25)[_0xd274('0x19')]();};}function respondWithResult(_0xc7c020,_0x5a39c1){_0x5a39c1=_0x5a39c1||0xc8;return function(_0x322e1c){if(_0x322e1c){return _0xc7c020[_0xd274('0x1a')](_0x5a39c1)[_0xd274('0x1b')](_0x322e1c);}};}function respondWithFilteredResult(_0x5a6d5e,_0xe64505){return function(_0x3e9eac){if(_0x3e9eac){var _0xb22acf=typeof _0xe64505[_0xd274('0x1c')]===_0xd274('0x1d')&&typeof _0xe64505[_0xd274('0x1e')]===_0xd274('0x1d');var _0x5624ba=_0x3e9eac[_0xd274('0x1f')];var _0x30ebed=_0xb22acf?0x0:_0xe64505[_0xd274('0x1c')];var _0x30b642=_0xb22acf?_0x3e9eac['count']:_0xe64505[_0xd274('0x1c')]+_0xe64505[_0xd274('0x1e')];var _0x27de63;if(_0x30b642>=_0x5624ba){_0x30b642=_0x5624ba;_0x27de63=0xc8;}else{_0x27de63=0xce;}_0x5a6d5e[_0xd274('0x1a')](_0x27de63);return _0x5a6d5e['set'](_0xd274('0x20'),_0x30ebed+'-'+_0x30b642+'/'+_0x5624ba)[_0xd274('0x1b')](_0x3e9eac);}return null;};}function patchUpdates(_0x4fcd76){return function(_0x1bdb8a){try{jsonpatch[_0xd274('0x21')](_0x1bdb8a,_0x4fcd76,!![]);}catch(_0x3a0e75){return BPromise[_0xd274('0x22')](_0x3a0e75);}return _0x1bdb8a['save']();};}function saveUpdates(_0x42efcc,_0x5c8704){return function(_0x49cd78){if(_0x49cd78){return _0x49cd78['update'](_0x42efcc)[_0xd274('0x23')](function(_0x5a37ef){return _0x5a37ef;});}return null;};}function removeEntity(_0x29b9d2,_0x3de6c5){return function(_0x28deb9){if(_0x28deb9){return _0x28deb9[_0xd274('0x24')]()['then'](function(){_0x29b9d2[_0xd274('0x1a')](0xcc)[_0xd274('0x19')]();});}};}function handleEntityNotFound(_0x1b3c0e,_0x62b5a9){return function(_0x2fe683){if(!_0x2fe683){_0x1b3c0e[_0xd274('0x25')](0x194);}return _0x2fe683;};}function handleError(_0x2467c8,_0x41cf20){_0x41cf20=_0x41cf20||0x1f4;return function(_0x2f6e6a){logger['error'](_0x2f6e6a[_0xd274('0x26')]);if(_0x2f6e6a[_0xd274('0x27')]){delete _0x2f6e6a[_0xd274('0x27')];}_0x2467c8[_0xd274('0x1a')](_0x41cf20)[_0xd274('0x28')](_0x2f6e6a);};}exports['index']=function(_0x2a5e67,_0x299443){var _0x295e05={},_0x5cae1e={},_0x11699e={'count':0x0,'rows':[]};var _0x46f939=_[_0xd274('0x29')](db[_0xd274('0x2a')][_0xd274('0x2b')],function(_0x4ebfcd){return{'name':_0x4ebfcd[_0xd274('0x2c')],'type':_0x4ebfcd[_0xd274('0x2d')][_0xd274('0x2e')]};});_0x5cae1e[_0xd274('0x2f')]=_[_0xd274('0x29')](_0x46f939,_0xd274('0x27'));_0x5cae1e[_0xd274('0x30')]=_['keys'](_0x2a5e67[_0xd274('0x30')]);_0x5cae1e[_0xd274('0x31')]=_[_0xd274('0x32')](_0x5cae1e[_0xd274('0x2f')],_0x5cae1e[_0xd274('0x30')]);_0x295e05['attributes']=_[_0xd274('0x32')](_0x5cae1e[_0xd274('0x2f')],qs[_0xd274('0x33')](_0x2a5e67[_0xd274('0x30')]['fields']));_0x295e05[_0xd274('0x34')]=_0x295e05[_0xd274('0x34')][_0xd274('0x35')]?_0x295e05['attributes']:_0x5cae1e[_0xd274('0x2f')];if(!_0x2a5e67[_0xd274('0x30')]['hasOwnProperty'](_0xd274('0x36'))){_0x295e05[_0xd274('0x1e')]=qs[_0xd274('0x1e')](_0x2a5e67[_0xd274('0x30')][_0xd274('0x1e')]);_0x295e05[_0xd274('0x1c')]=qs['offset'](_0x2a5e67['query'][_0xd274('0x1c')]);}_0x295e05[_0xd274('0x37')]=qs[_0xd274('0x38')](_0x2a5e67[_0xd274('0x30')][_0xd274('0x38')]);_0x295e05[_0xd274('0x39')]=qs['filters'](_['pick'](_0x2a5e67[_0xd274('0x30')],_0x5cae1e['filters']),_0x46f939);if(_0x2a5e67[_0xd274('0x30')][_0xd274('0x3a')]){_0x295e05[_0xd274('0x39')]=_[_0xd274('0x3b')](_0x295e05[_0xd274('0x39')],{'$or':_[_0xd274('0x29')](_0x46f939,function(_0x3de265){if(_0x3de265[_0xd274('0x2d')]!==_0xd274('0x3c')){var _0x552b48={};_0x552b48[_0x3de265[_0xd274('0x27')]]={'$like':'%'+_0x2a5e67['query'][_0xd274('0x3a')]+'%'};return _0x552b48;}})});}_0x295e05=_[_0xd274('0x3b')]({},_0x295e05,_0x2a5e67['options']);var _0x4413f0={'where':_0x295e05[_0xd274('0x39')]};return db[_0xd274('0x2a')][_0xd274('0x1f')](_0x4413f0)[_0xd274('0x23')](function(_0x25321e){_0x11699e[_0xd274('0x1f')]=_0x25321e;if(_0x2a5e67[_0xd274('0x30')][_0xd274('0x3d')]){_0x295e05[_0xd274('0x3e')]=[{'all':!![]}];}return db[_0xd274('0x2a')][_0xd274('0x3f')](_0x295e05);})['then'](function(_0x447eea){_0x11699e[_0xd274('0x40')]=_0x447eea;return _0x11699e;})[_0xd274('0x23')](respondWithFilteredResult(_0x299443,_0x295e05))[_0xd274('0x41')](handleError(_0x299443,null));};exports[_0xd274('0x42')]=function(_0x55e50c,_0x461edd){var _0x418c89={'raw':!![],'where':{'id':_0x55e50c[_0xd274('0x43')]['id']}},_0x49a00f={};_0x49a00f[_0xd274('0x2f')]=_[_0xd274('0x44')](db[_0xd274('0x2a')][_0xd274('0x2b')]);_0x49a00f[_0xd274('0x30')]=_['keys'](_0x55e50c[_0xd274('0x30')]);_0x49a00f[_0xd274('0x31')]=_[_0xd274('0x32')](_0x49a00f[_0xd274('0x2f')],_0x49a00f['query']);_0x418c89['attributes']=_[_0xd274('0x32')](_0x49a00f[_0xd274('0x2f')],qs[_0xd274('0x33')](_0x55e50c[_0xd274('0x30')][_0xd274('0x33')]));_0x418c89[_0xd274('0x34')]=_0x418c89['attributes'][_0xd274('0x35')]?_0x418c89[_0xd274('0x34')]:_0x49a00f['model'];if(_0x55e50c['query'][_0xd274('0x3d')]){_0x418c89[_0xd274('0x3e')]=[{'all':!![]}];}_0x418c89=_[_0xd274('0x3b')]({},_0x418c89,_0x55e50c[_0xd274('0x45')]);return db[_0xd274('0x2a')][_0xd274('0x46')](_0x418c89)[_0xd274('0x23')](handleEntityNotFound(_0x461edd,null))[_0xd274('0x23')](respondWithResult(_0x461edd,null))[_0xd274('0x41')](handleError(_0x461edd,null));};exports[_0xd274('0x47')]=function(_0x4d2999,_0x5a5268){return db[_0xd274('0x2a')][_0xd274('0x47')](_0x4d2999[_0xd274('0x48')],{})[_0xd274('0x23')](respondWithResult(_0x5a5268,0xc9))[_0xd274('0x41')](handleError(_0x5a5268,null));};exports['describe']=function(_0xad5ced,_0x40681e){return db[_0xd274('0x2a')][_0xd274('0x49')]()[_0xd274('0x23')](respondWithResult(_0x40681e,null))[_0xd274('0x41')](handleError(_0x40681e,null));};exports[_0xd274('0x4a')]=function(_0x58ffd8,_0x4231c9){if(_0x58ffd8[_0xd274('0x48')][_0xd274('0x4b')]){delete _0x58ffd8[_0xd274('0x48')]['uniqueid'];}return db[_0xd274('0x2a')][_0xd274('0x46')]({'where':{'uniqueid':_0x58ffd8[_0xd274('0x43')]['id']}})[_0xd274('0x23')](handleEntityNotFound(_0x4231c9,null))['then'](saveUpdates(_0x58ffd8['body'],null))['then'](respondWithResult(_0x4231c9,null))[_0xd274('0x41')](handleError(_0x4231c9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 33ae260..49344c4 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.model.js +++ b/server/api/cmHopperHistory/cmHopperHistory.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6db4=['../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0x6db4,0x111));var _0x46db=function(_0x5890f5,_0x1986bc){_0x5890f5=_0x5890f5-0x0;var _0x55fe0f=_0x6db4[_0x5890f5];return _0x55fe0f;};'use strict';var _=require('lodash');var util=require(_0x46db('0x0'));var logger=require(_0x46db('0x1'))(_0x46db('0x2'));var moment=require(_0x46db('0x3'));var BPromise=require(_0x46db('0x4'));var rp=require(_0x46db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46db('0x6'));var config=require(_0x46db('0x7'));var attributes=require(_0x46db('0x8'));module[_0x46db('0x9')]=function(_0x331e67,_0x2abfd4){return _0x331e67[_0x46db('0xa')]('CmHopperHistory',attributes,{'tableName':_0x46db('0xb'),'paranoid':![],'indexes':[{'name':_0x46db('0xc'),'fields':[_0x46db('0xc')]},{'name':_0x46db('0xd'),'fields':[_0x46db('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb19a=['define','CmHopperHistory','endtime','uniqueid','lodash','api','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x3693e9,_0x312fcd){var _0x480336=function(_0xc881fe){while(--_0xc881fe){_0x3693e9['push'](_0x3693e9['shift']());}};_0x480336(++_0x312fcd);}(_0xb19a,0xd0));var _0xab19=function(_0x1010d6,_0x578bba){_0x1010d6=_0x1010d6-0x0;var _0x2d2e51=_0xb19a[_0x1010d6];return _0x2d2e51;};'use strict';var _=require(_0xab19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xab19('0x2'));var fs=require('fs');var path=require(_0xab19('0x3'));var rimraf=require(_0xab19('0x4'));var config=require(_0xab19('0x5'));var attributes=require(_0xab19('0x6'));module[_0xab19('0x7')]=function(_0x907494,_0x5e77f8){return _0x907494[_0xab19('0x8')](_0xab19('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xab19('0xa'),'fields':['endtime']},{'name':_0xab19('0xb'),'fields':[_0xab19('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 9eb7c22..d54c0ec 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.rpc.js +++ b/server/api/cmHopperHistory/cmHopperHistory.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d9b=['CmHopperHistory,\x20%s,\x20%s','message','result','CmHopperHistory','create','options','CreateCmHopperHistory','debug','catch','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','info','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrAnswerCallsDay','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4da69a,_0x2de2f8){var _0x8e6b07=function(_0x1697bf){while(--_0x1697bf){_0x4da69a['push'](_0x4da69a['shift']());}};_0x8e6b07(++_0x2de2f8);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x333391,_0x37562e){_0x333391=_0x333391-0x0;var _0x679e52=_0x9d9b[_0x333391];return _0x679e52;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var moment=require(_0xb9d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d9('0x3'))['db'];var utils=require(_0xb9d9('0x4'));var logger=require(_0xb9d9('0x5'))('rpc');var config=require(_0xb9d9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb9d9('0x7')][_0xb9d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51af61,_0x13743f,_0x20e0e5){return new BPromise(function(_0x184896,_0x6ee523){return client[_0xb9d9('0x9')](_0x51af61,_0x20e0e5)[_0xb9d9('0xa')](function(_0x1bfec3){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x13743f,'request\x20sent');logger['debug'](_0xb9d9('0xb'),_0x13743f,_0xb9d9('0xc'),JSON[_0xb9d9('0xd')](_0x1bfec3));if(_0x1bfec3['error']){if(_0x1bfec3[_0xb9d9('0xe')][_0xb9d9('0xf')]===0x1f4){logger['error'](_0xb9d9('0x10'),_0x13743f,_0x1bfec3['error'][_0xb9d9('0x11')]);return _0x6ee523(_0x1bfec3[_0xb9d9('0xe')][_0xb9d9('0x11')]);}logger[_0xb9d9('0xe')](_0xb9d9('0x10'),_0x13743f,_0x1bfec3[_0xb9d9('0xe')][_0xb9d9('0x11')]);return _0x184896(_0x1bfec3[_0xb9d9('0xe')]['message']);}else{logger['info'](_0xb9d9('0x10'),_0x13743f,_0xb9d9('0xc'));_0x184896(_0x1bfec3[_0xb9d9('0x12')][_0xb9d9('0x11')]);}})['catch'](function(_0x5ab03a){logger[_0xb9d9('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x13743f,_0x5ab03a);_0x6ee523(_0x5ab03a);});});}exports['CreateCmHopperHistory']=function(_0x2b5e26){var _0x3ef2f4=this;return new Promise(function(_0x1e775d,_0x5aea9e){return db[_0xb9d9('0x13')][_0xb9d9('0x14')](_0x2b5e26['body'],{'raw':_0x2b5e26[_0xb9d9('0x15')]?_0x2b5e26[_0xb9d9('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xb9d9('0xa')](function(_0x36d55e){logger['info'](_0xb9d9('0x16'),_0x2b5e26);logger[_0xb9d9('0x17')](_0xb9d9('0x16'),_0x2b5e26,JSON[_0xb9d9('0xd')](_0x36d55e));_0x1e775d(_0x36d55e);})[_0xb9d9('0x18')](function(_0x362104){logger['error'](_0xb9d9('0x16'),_0x362104[_0xb9d9('0x11')],_0x2b5e26);_0x5aea9e(_0x3ef2f4['error'](0x1f4,_0x362104[_0xb9d9('0x11')]));});});};exports[_0xb9d9('0x19')]=function(_0x43bcab){var _0x1bc364=this;return new Promise(function(_0x543d1a,_0x150085){return db[_0xb9d9('0x13')][_0xb9d9('0x1a')]({'raw':_0x43bcab[_0xb9d9('0x15')]?_0x43bcab[_0xb9d9('0x15')][_0xb9d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x43bcab['options']?_0x43bcab[_0xb9d9('0x15')][_0xb9d9('0x1c')]||null:null,'attributes':[[db[_0xb9d9('0x1d')]['fn']('COUNT',db[_0xb9d9('0x1d')][_0xb9d9('0x1e')]('id')),_0xb9d9('0x1f')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')]['literal'](_0xb9d9('0x21')))),_0xb9d9('0x22')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')]['literal'](_0xb9d9('0x23')))),_0xb9d9('0x24')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db['sequelize']['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x26')))),_0xb9d9('0x27')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0xb9d9('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xb9d9('0x29')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x28'),db['sequelize']['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x2a')))),_0xb9d9('0x2b')]]})[_0xb9d9('0xa')](function(_0xffcf20){logger[_0xb9d9('0x2c')](_0xb9d9('0x19'),_0x43bcab);logger[_0xb9d9('0x17')]('AvgHandleTime',_0x43bcab,JSON['stringify'](_0xffcf20));_0x543d1a(_0xffcf20);})['catch'](function(_0x3730aa){logger[_0xb9d9('0xe')](_0xb9d9('0x19'),_0x3730aa[_0xb9d9('0x11')],_0x43bcab);_0x150085(_0x1bc364[_0xb9d9('0xe')](0x1f4,_0x3730aa[_0xb9d9('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x492702){var _0x492be2=this;return new Promise(function(_0x359a6f,_0x248168){return db[_0xb9d9('0x13')][_0xb9d9('0x1a')]({'raw':_0x492702[_0xb9d9('0x15')]?_0x492702[_0xb9d9('0x15')][_0xb9d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x492702[_0xb9d9('0x15')]?_0x492702[_0xb9d9('0x15')][_0xb9d9('0x1c')]||null:null,'attributes':[[_0xb9d9('0x2d'),_0xb9d9('0x2e')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x2f')))),_0xb9d9('0x30')],[db['sequelize']['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xb9d9('0x31')))),'outboundNoAnswerCallsDay'],[db[_0xb9d9('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x21')))),_0xb9d9('0x32')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xb9d9('0x33')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db['sequelize']['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x34')))),_0xb9d9('0x35')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')]['literal'](_0xb9d9('0x36')))),_0xb9d9('0x37')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x38')))),_0xb9d9('0x39')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x3a')))),_0xb9d9('0x3b')],[db[_0xb9d9('0x1d')]['fn']('COUNT',db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')]['literal'](_0xb9d9('0x3c')))),_0xb9d9('0x3d')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')]['literal'](_0xb9d9('0x3e')))),_0xb9d9('0x3f')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db['sequelize']['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x40')))),'outboundRejectCallsDay'],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')][_0xb9d9('0x25')](_0xb9d9('0x41')))),'outboundAnswerAgiCallsDay'],[db[_0xb9d9('0x1d')]['fn']('COUNT',db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')]['literal'](_0xb9d9('0x42')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xb9d9('0x1d')]['fn']('IF',db[_0xb9d9('0x1d')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xb9d9('0x43')]],'group':['campaign']})['then'](function(_0x38aa89){logger['info'](_0xb9d9('0x44'),_0x492702);logger[_0xb9d9('0x17')](_0xb9d9('0x44'),_0x492702,JSON[_0xb9d9('0xd')](_0x38aa89));_0x359a6f(_0x38aa89);})['catch'](function(_0x47a2d3){logger[_0xb9d9('0xe')]('GetVoiceQueueHopperHistory',_0x47a2d3[_0xb9d9('0x11')],_0x492702);_0x248168(_0x492be2[_0xb9d9('0xe')](0x1f4,_0x47a2d3[_0xb9d9('0x11')]));});});};exports[_0xb9d9('0x45')]=function(_0x2470fa){var _0x25be18=this;return new Promise(function(_0x3578d5,_0x595e71){return db[_0xb9d9('0x13')][_0xb9d9('0x1a')]({'raw':_0x2470fa['options']?_0x2470fa['options']['raw']===undefined?!![]:![]:!![],'where':_0x2470fa[_0xb9d9('0x15')]?_0x2470fa['options'][_0xb9d9('0x1c')]||null:null,'attributes':[[_0xb9d9('0x2d'),_0xb9d9('0x2e')],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db[_0xb9d9('0x1d')][_0xb9d9('0x1e')]('id')),'ivrTotalCallsDays'],[db[_0xb9d9('0x1d')]['fn'](_0xb9d9('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xb9d9('0x21')))),_0xb9d9('0x46')]],'group':['campaign']})[_0xb9d9('0xa')](function(_0xfe0cec){logger[_0xb9d9('0x2c')](_0xb9d9('0x45'),_0x2470fa);logger[_0xb9d9('0x17')](_0xb9d9('0x45'),_0x2470fa,JSON[_0xb9d9('0xd')](_0xfe0cec));_0x3578d5(_0xfe0cec);})[_0xb9d9('0x18')](function(_0x1b241e){logger[_0xb9d9('0xe')](_0xb9d9('0x45'),_0x1b241e[_0xb9d9('0x11')],_0x2470fa);_0x595e71(_0x25be18[_0xb9d9('0xe')](0x1f4,_0x1b241e[_0xb9d9('0x11')]));});});}; \ No newline at end of file +var _0xc8de=['outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateCmHopperHistory','CmHopperHistory','create','options','then','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null'];(function(_0x1107ce,_0x5906ba){var _0x44db22=function(_0x1ad2d9){while(--_0x1ad2d9){_0x1107ce['push'](_0x1107ce['shift']());}};_0x44db22(++_0x5906ba);}(_0xc8de,0x167));var _0xec8d=function(_0x738579,_0x456511){_0x738579=_0x738579-0x0;var _0x5e6b36=_0xc8de[_0x738579];return _0x5e6b36;};'use strict';var _=require('lodash');var util=require(_0xec8d('0x0'));var moment=require(_0xec8d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec8d('0x2'));var db=require(_0xec8d('0x3'))['db'];var utils=require(_0xec8d('0x4'));var logger=require(_0xec8d('0x5'))(_0xec8d('0x6'));var config=require(_0xec8d('0x7'));var jayson=require(_0xec8d('0x8'));var client=jayson['client'][_0xec8d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55e36c,_0x11308b,_0x596921){return new BPromise(function(_0x37de69,_0x597c70){return client[_0xec8d('0xa')](_0x55e36c,_0x596921)['then'](function(_0x2e028d){logger[_0xec8d('0xb')](_0xec8d('0xc'),_0x11308b,_0xec8d('0xd'));logger[_0xec8d('0xe')](_0xec8d('0xf'),_0x11308b,_0xec8d('0xd'),JSON[_0xec8d('0x10')](_0x2e028d));if(_0x2e028d[_0xec8d('0x11')]){if(_0x2e028d[_0xec8d('0x11')]['code']===0x1f4){logger[_0xec8d('0x11')](_0xec8d('0xc'),_0x11308b,_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);return _0x597c70(_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);}logger[_0xec8d('0x11')](_0xec8d('0xc'),_0x11308b,_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);return _0x37de69(_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);}else{logger['info'](_0xec8d('0xc'),_0x11308b,_0xec8d('0xd'));_0x37de69(_0x2e028d[_0xec8d('0x13')][_0xec8d('0x12')]);}})['catch'](function(_0x2fb24f){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x11308b,_0x2fb24f);_0x597c70(_0x2fb24f);});});}exports[_0xec8d('0x14')]=function(_0x3b32c8){var _0x557f9c=this;return new Promise(function(_0x2bdc72,_0x643d54){return db[_0xec8d('0x15')][_0xec8d('0x16')](_0x3b32c8['body'],{'raw':_0x3b32c8['options']?_0x3b32c8[_0xec8d('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xec8d('0x18')](function(_0x19d8f0){logger[_0xec8d('0xb')]('CreateCmHopperHistory',_0x3b32c8);logger['debug']('CreateCmHopperHistory',_0x3b32c8,JSON['stringify'](_0x19d8f0));_0x2bdc72(_0x19d8f0);})[_0xec8d('0x19')](function(_0x154b78){logger['error'](_0xec8d('0x14'),_0x154b78[_0xec8d('0x12')],_0x3b32c8);_0x643d54(_0x557f9c[_0xec8d('0x11')](0x1f4,_0x154b78['message']));});});};exports[_0xec8d('0x1a')]=function(_0xa2ad0a){var _0x4b8007=this;return new Promise(function(_0x2cff34,_0x41c191){return db[_0xec8d('0x15')][_0xec8d('0x1b')]({'raw':_0xa2ad0a[_0xec8d('0x17')]?_0xa2ad0a[_0xec8d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xa2ad0a[_0xec8d('0x17')]?_0xa2ad0a[_0xec8d('0x17')]['where']||null:null,'attributes':[[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db['sequelize'][_0xec8d('0x1e')]('id')),_0xec8d('0x1f')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db['sequelize']['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xec8d('0x1c')]['fn']('COUNT',db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x21')))),_0xec8d('0x22')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')]['literal'](_0xec8d('0x23')))),_0xec8d('0x24')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x25'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x26')))),_0xec8d('0x27')],[db['sequelize']['fn'](_0xec8d('0x25'),db['sequelize']['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x28')))),_0xec8d('0x29')]]})[_0xec8d('0x18')](function(_0x9fd5c2){logger['info'](_0xec8d('0x1a'),_0xa2ad0a);logger[_0xec8d('0xe')](_0xec8d('0x1a'),_0xa2ad0a,JSON[_0xec8d('0x10')](_0x9fd5c2));_0x2cff34(_0x9fd5c2);})[_0xec8d('0x19')](function(_0x5165f7){logger['error'](_0xec8d('0x1a'),_0x5165f7[_0xec8d('0x12')],_0xa2ad0a);_0x41c191(_0x4b8007['error'](0x1f4,_0x5165f7[_0xec8d('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x57567c){var _0x5090b5=this;return new Promise(function(_0x18d838,_0x10fcfd){return db['CmHopperHistory'][_0xec8d('0x1b')]({'raw':_0x57567c[_0xec8d('0x17')]?_0x57567c[_0xec8d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x57567c['options']?_0x57567c[_0xec8d('0x17')][_0xec8d('0x2a')]||null:null,'attributes':[[_0xec8d('0x2b'),_0xec8d('0x2c')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x2d')))),_0xec8d('0x2e')],[db[_0xec8d('0x1c')]['fn']('COUNT',db[_0xec8d('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xec8d('0x2f')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x30')))),_0xec8d('0x31')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db['sequelize'][_0xec8d('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0xec8d('0x32')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x33')))),_0xec8d('0x34')],[db['sequelize']['fn'](_0xec8d('0x1d'),db['sequelize']['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x35')))),_0xec8d('0x36')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db['sequelize']['fn']('IF',db[_0xec8d('0x1c')]['literal'](_0xec8d('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0xec8d('0x1c')]['fn']('COUNT',db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x38')))),_0xec8d('0x39')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x3a')))),_0xec8d('0x3b')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x3c')))),'outboundOriginateFailureCallsDay'],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')]['literal'](_0xec8d('0x3d')))),_0xec8d('0x3e')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0xec8d('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xec8d('0x3e')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')][_0xec8d('0x20')](_0xec8d('0x40')))),_0xec8d('0x41')]],'group':[_0xec8d('0x2b')]})['then'](function(_0x591e4f){logger[_0xec8d('0xb')](_0xec8d('0x42'),_0x57567c);logger['debug'](_0xec8d('0x42'),_0x57567c,JSON[_0xec8d('0x10')](_0x591e4f));_0x18d838(_0x591e4f);})[_0xec8d('0x19')](function(_0x9208d){logger[_0xec8d('0x11')](_0xec8d('0x42'),_0x9208d['message'],_0x57567c);_0x10fcfd(_0x5090b5[_0xec8d('0x11')](0x1f4,_0x9208d[_0xec8d('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0xb3859a){var _0x273707=this;return new Promise(function(_0x1f30aa,_0x54df4c){return db[_0xec8d('0x15')][_0xec8d('0x1b')]({'raw':_0xb3859a[_0xec8d('0x17')]?_0xb3859a[_0xec8d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xb3859a[_0xec8d('0x17')]?_0xb3859a[_0xec8d('0x17')][_0xec8d('0x2a')]||null:null,'attributes':[[_0xec8d('0x2b'),_0xec8d('0x2c')],[db[_0xec8d('0x1c')]['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')][_0xec8d('0x1e')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0xec8d('0x1d'),db[_0xec8d('0x1c')]['fn']('IF',db[_0xec8d('0x1c')]['literal'](_0xec8d('0x30')))),'ivrAnswerCallsDay']],'group':[_0xec8d('0x2b')]})[_0xec8d('0x18')](function(_0x2571f0){logger['info'](_0xec8d('0x43'),_0xb3859a);logger[_0xec8d('0xe')](_0xec8d('0x43'),_0xb3859a,JSON[_0xec8d('0x10')](_0x2571f0));_0x1f30aa(_0x2571f0);})['catch'](function(_0x5c8bfe){logger[_0xec8d('0x11')]('GetCampaignHopperHistory',_0x5c8bfe[_0xec8d('0x12')],_0xb3859a);_0x54df4c(_0x273707['error'](0x1f4,_0x5c8bfe['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 334725a..3a8714d 100644 --- a/server/api/cmHopperHistory/index.js +++ b/server/api/cmHopperHistory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a17=['fs-extra','../../config/environment','./cmHopperHistory.controller','get','index','describe','isAuthenticated','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x117c77,_0x52bf8e){var _0x595950=function(_0x4b7bbb){while(--_0x4b7bbb){_0x117c77['push'](_0x117c77['shift']());}};_0x595950(++_0x52bf8e);}(_0x5a17,0x104));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x75a1('0x0'));var util=require(_0x75a1('0x1'));var path=require(_0x75a1('0x2'));var timeout=require(_0x75a1('0x3'));var express=require(_0x75a1('0x4'));var router=express[_0x75a1('0x5')]();var fs_extra=require(_0x75a1('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x75a1('0x7'));var controller=require(_0x75a1('0x8'));router[_0x75a1('0x9')]('/',auth['isAuthenticated'](),controller[_0x75a1('0xa')]);router[_0x75a1('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x75a1('0xb')]);router[_0x75a1('0x9')]('/:id',auth[_0x75a1('0xc')](),controller['show']);router[_0x75a1('0xd')]('/',auth[_0x75a1('0xc')](),controller[_0x75a1('0xe')]);router[_0x75a1('0xf')](_0x75a1('0x10'),auth['isAuthenticated'](),controller[_0x75a1('0x11')]);module[_0x75a1('0x12')]=router; \ No newline at end of file +var _0x4391=['update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2dccc6,_0x49fe36){var _0x81c016=function(_0x31592d){while(--_0x31592d){_0x2dccc6['push'](_0x2dccc6['shift']());}};_0x81c016(++_0x49fe36);}(_0x4391,0x1e2));var _0x1439=function(_0x3ceb34,_0x54c290){_0x3ceb34=_0x3ceb34-0x0;var _0x2062f5=_0x4391[_0x3ceb34];return _0x2062f5;};'use strict';var multer=require(_0x1439('0x0'));var util=require(_0x1439('0x1'));var path=require(_0x1439('0x2'));var timeout=require(_0x1439('0x3'));var express=require('express');var router=express[_0x1439('0x4')]();var fs_extra=require(_0x1439('0x5'));var auth=require(_0x1439('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1439('0x7'));router[_0x1439('0x8')]('/',auth[_0x1439('0x9')](),controller[_0x1439('0xa')]);router['get'](_0x1439('0xb'),auth['isAuthenticated'](),controller[_0x1439('0xc')]);router['get'](_0x1439('0xd'),auth[_0x1439('0x9')](),controller[_0x1439('0xe')]);router[_0x1439('0xf')]('/',auth[_0x1439('0x9')](),controller[_0x1439('0x10')]);router[_0x1439('0x11')](_0x1439('0xd'),auth['isAuthenticated'](),controller[_0x1439('0x12')]);module[_0x1439('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 399cafc..af04229 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9417=['sequelize','exports','STRING','name'];(function(_0x158250,_0x584720){var _0xf5e297=function(_0x36d669){while(--_0x36d669){_0x158250['push'](_0x158250['shift']());}};_0xf5e297(++_0x584720);}(_0x9417,0xb4));var _0x7941=function(_0x22b6e5,_0x2819c8){_0x22b6e5=_0x22b6e5-0x0;var _0x1c21e5=_0x9417[_0x22b6e5];return _0x1c21e5;};'use strict';var Sequelize=require(_0x7941('0x0'));module[_0x7941('0x1')]={'name':{'type':Sequelize[_0x7941('0x2')],'unique':_0x7941('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x7941('0x2')]}}; \ No newline at end of file +var _0xea44=['name','sequelize','exports','STRING'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0xea44,0x1a5));var _0x4ea4=function(_0x58a259,_0x1e59a5){_0x58a259=_0x58a259-0x0;var _0x209ca=_0xea44[_0x58a259];return _0x209ca;};'use strict';var Sequelize=require(_0x4ea4('0x0'));module[_0x4ea4('0x1')]={'name':{'type':Sequelize[_0x4ea4('0x2')],'unique':_0x4ea4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x4ea4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 319fa8d..2ff7e34 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2387=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','show','params','find','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','addDisposition','ListId','Disposition','findAll','removeDispositions','ids','addContacts','CmContact','tags','push','each','omit','errors','message','getContacts','CustomFields','concat','format','cf_%d','ContactItemType','CmCustomField','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','alias','field','item','from','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','download','addCustomField','findOne','sequelize','transaction','addCustomFields','number','INTEGER','switch','BOOLEAN','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','getAgents','User','info','spread','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x2387,0x185));var _0x7238=function(_0x762393,_0x3bef24){_0x762393=_0x762393-0x0;var _0x54685a=_0x2387[_0x762393];return _0x54685a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7238('0x0'));var jsonpatch=require(_0x7238('0x1'));var rp=require(_0x7238('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7238('0x3'));var path=require(_0x7238('0x4'));var sox=require(_0x7238('0x5'));var csv=require(_0x7238('0x6'));var ejs=require(_0x7238('0x7'));var fs=require('fs');var fs_extra=require(_0x7238('0x8'));var _=require(_0x7238('0x9'));var squel=require(_0x7238('0xa'));var crypto=require('crypto');var jsforce=require(_0x7238('0xb'));var deskjs=require(_0x7238('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7238('0xd'));var authService=require(_0x7238('0xe'));var qs=require(_0x7238('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7238('0x10'));var logger=require('../../config/logger')(_0x7238('0x11'));var utils=require(_0x7238('0x12'));var config=require(_0x7238('0x13'));var licenseUtil=require(_0x7238('0x14'));var db=require(_0x7238('0x15'))['db'];var csv_results;config['redis']=_[_0x7238('0x16')](config[_0x7238('0x17')],{'host':_0x7238('0x18'),'port':0x18eb});var socket=require(_0x7238('0x19'))(new Redis(config[_0x7238('0x17')]));require(_0x7238('0x1a'))[_0x7238('0x1b')](socket);function respondWithStatusCode(_0x38f329,_0x5822dd){_0x5822dd=_0x5822dd||0xcc;return function(_0xd3eb1b){if(_0xd3eb1b){return _0x38f329[_0x7238('0x1c')](_0x5822dd);}return _0x38f329[_0x7238('0x1d')](_0x5822dd)[_0x7238('0x1e')]();};}function respondWithResult(_0x4a5c43,_0x448f32){_0x448f32=_0x448f32||0xc8;return function(_0x105c3d){if(_0x105c3d){return _0x4a5c43[_0x7238('0x1d')](_0x448f32)[_0x7238('0x1f')](_0x105c3d);}};}function respondWithFilteredResult(_0x271a30,_0xeb492d){return function(_0x12095){if(_0x12095){var _0x2b3ca1=typeof _0xeb492d[_0x7238('0x20')]===_0x7238('0x21')&&typeof _0xeb492d[_0x7238('0x22')]===_0x7238('0x21');var _0x676ad=_0x12095[_0x7238('0x23')];var _0x335a11=_0x2b3ca1?0x0:_0xeb492d['offset'];var _0x52a777=_0x2b3ca1?_0x12095[_0x7238('0x23')]:_0xeb492d[_0x7238('0x20')]+_0xeb492d[_0x7238('0x22')];var _0xe58f0f;if(_0x52a777>=_0x676ad){_0x52a777=_0x676ad;_0xe58f0f=0xc8;}else{_0xe58f0f=0xce;}_0x271a30['status'](_0xe58f0f);return _0x271a30['set']('Content-Range',_0x335a11+'-'+_0x52a777+'/'+_0x676ad)[_0x7238('0x1f')](_0x12095);}return null;};}function patchUpdates(_0x43eb17){return function(_0x1ff5c4){try{jsonpatch[_0x7238('0x24')](_0x1ff5c4,_0x43eb17,!![]);}catch(_0xf375f9){return BPromise[_0x7238('0x25')](_0xf375f9);}return _0x1ff5c4[_0x7238('0x26')]();};}function saveUpdates(_0x5215cf,_0x4e18f9){return function(_0x1b4c81){if(_0x1b4c81){return _0x1b4c81[_0x7238('0x27')](_0x5215cf)['then'](function(_0x20e9fd){return _0x20e9fd;});}return null;};}function removeEntity(_0x10c746,_0xe2c4ce){return function(_0x4cc443){if(_0x4cc443){return _0x4cc443['destroy']()[_0x7238('0x28')](function(){var _0x471acf=_0x4cc443['get']({'plain':!![]});var _0x12a531='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x12a531,'resourceId':_0x471acf['id']}})['then'](function(){return _0x4cc443;});})[_0x7238('0x28')](function(){_0x10c746[_0x7238('0x1d')](0xcc)[_0x7238('0x1e')]();});}};}function handleEntityNotFound(_0x344399,_0x5f0dbe){return function(_0x4fb308){if(!_0x4fb308){_0x344399[_0x7238('0x1c')](0x194);}return _0x4fb308;};}function handleError(_0x433d26,_0x391cc0){_0x391cc0=_0x391cc0||0x1f4;return function(_0x3d3dc5){logger['error'](_0x3d3dc5[_0x7238('0x29')]);if(_0x3d3dc5[_0x7238('0x2a')]){delete _0x3d3dc5['name'];}_0x433d26[_0x7238('0x1d')](_0x391cc0)[_0x7238('0x2b')](_0x3d3dc5);};}exports[_0x7238('0x2c')]=function(_0x486efd,_0x4ebf06){var _0x560231={},_0x49c1ef={},_0x2690e6={'count':0x0,'rows':[]};var _0x2601eb=_[_0x7238('0x2d')](db[_0x7238('0x2e')][_0x7238('0x2f')],function(_0x72c5bc){return{'name':_0x72c5bc[_0x7238('0x30')],'type':_0x72c5bc[_0x7238('0x31')][_0x7238('0x32')]};});_0x49c1ef['model']=_[_0x7238('0x2d')](_0x2601eb,_0x7238('0x2a'));_0x49c1ef[_0x7238('0x33')]=_[_0x7238('0x34')](_0x486efd[_0x7238('0x33')]);_0x49c1ef[_0x7238('0x35')]=_[_0x7238('0x36')](_0x49c1ef[_0x7238('0x37')],_0x49c1ef[_0x7238('0x33')]);_0x560231[_0x7238('0x38')]=_['intersection'](_0x49c1ef['model'],qs[_0x7238('0x39')](_0x486efd['query']['fields']));_0x560231[_0x7238('0x38')]=_0x560231[_0x7238('0x38')][_0x7238('0x3a')]?_0x560231[_0x7238('0x38')]:_0x49c1ef[_0x7238('0x37')];if(!_0x486efd[_0x7238('0x33')][_0x7238('0x3b')](_0x7238('0x3c'))){_0x560231[_0x7238('0x22')]=qs[_0x7238('0x22')](_0x486efd[_0x7238('0x33')][_0x7238('0x22')]);_0x560231[_0x7238('0x20')]=qs[_0x7238('0x20')](_0x486efd[_0x7238('0x33')][_0x7238('0x20')]);}_0x560231[_0x7238('0x3d')]=qs[_0x7238('0x3e')](_0x486efd[_0x7238('0x33')]['sort']);_0x560231[_0x7238('0x3f')]=qs[_0x7238('0x35')](_[_0x7238('0x40')](_0x486efd[_0x7238('0x33')],_0x49c1ef['filters']),_0x2601eb);if(_0x486efd[_0x7238('0x33')][_0x7238('0x41')]){_0x560231['where']=_['merge'](_0x560231['where'],{'$or':_[_0x7238('0x2d')](_0x2601eb,function(_0x50c7a0){if(_0x50c7a0['type']!==_0x7238('0x42')){var _0x28392e={};_0x28392e[_0x50c7a0[_0x7238('0x2a')]]={'$like':'%'+_0x486efd['query'][_0x7238('0x41')]+'%'};return _0x28392e;}})});}_0x560231=_[_0x7238('0x43')]({},_0x560231,_0x486efd[_0x7238('0x44')]);var _0x3a4d9c={'where':_0x560231[_0x7238('0x3f')]};return db[_0x7238('0x2e')][_0x7238('0x23')](_0x3a4d9c)['then'](function(_0x4f7006){_0x2690e6[_0x7238('0x23')]=_0x4f7006;if(_0x486efd[_0x7238('0x33')][_0x7238('0x45')]){_0x560231['include']=[{'all':!![]}];}return db[_0x7238('0x2e')]['findAll'](_0x560231);})[_0x7238('0x28')](function(_0xe77710){_0x2690e6['rows']=_0xe77710;return _0x2690e6;})['then'](respondWithFilteredResult(_0x4ebf06,_0x560231))[_0x7238('0x46')](handleError(_0x4ebf06,null));};exports[_0x7238('0x47')]=function(_0x2caf0c,_0x3c4846){var _0x25821d={'raw':![],'where':{'id':_0x2caf0c[_0x7238('0x48')]['id']}},_0x38ef33={};_0x38ef33[_0x7238('0x37')]=_[_0x7238('0x34')](db['CmList'][_0x7238('0x2f')]);_0x38ef33[_0x7238('0x33')]=_[_0x7238('0x34')](_0x2caf0c['query']);_0x38ef33['filters']=_[_0x7238('0x36')](_0x38ef33[_0x7238('0x37')],_0x38ef33[_0x7238('0x33')]);_0x25821d[_0x7238('0x38')]=_[_0x7238('0x36')](_0x38ef33[_0x7238('0x37')],qs[_0x7238('0x39')](_0x2caf0c[_0x7238('0x33')]['fields']));_0x25821d[_0x7238('0x38')]=_0x25821d['attributes'][_0x7238('0x3a')]?_0x25821d[_0x7238('0x38')]:_0x38ef33[_0x7238('0x37')];if(_0x2caf0c[_0x7238('0x33')]['includeAll']){_0x25821d['include']=[{'all':!![]}];}_0x25821d=_[_0x7238('0x43')]({},_0x25821d,_0x2caf0c[_0x7238('0x44')]);return db['CmList'][_0x7238('0x49')](_0x25821d)[_0x7238('0x28')](handleEntityNotFound(_0x3c4846,null))['then'](respondWithResult(_0x3c4846,null))['catch'](handleError(_0x3c4846,null));};exports[_0x7238('0x4a')]=function(_0x417b9a,_0x36f613){return db[_0x7238('0x2e')][_0x7238('0x4a')](_0x417b9a['body'],{})['then'](function(_0x20df66){var _0x289d78=_0x417b9a['user']['get']({'plain':!![]});if(!_0x289d78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x289d78['role']===_0x7238('0x4b')){var _0xadff39=_0x20df66['get']({'plain':!![]});var _0x365dad='Lists';return db[_0x7238('0x4c')]['find']({'where':{'name':_0x365dad,'userProfileId':_0x289d78[_0x7238('0x4d')]},'raw':!![]})[_0x7238('0x28')](function(_0x4c48d2){if(_0x4c48d2&&_0x4c48d2[_0x7238('0x4e')]===0x0){return db[_0x7238('0x4f')][_0x7238('0x4a')]({'name':_0xadff39[_0x7238('0x2a')],'resourceId':_0xadff39['id'],'type':_0x4c48d2[_0x7238('0x2a')],'sectionId':_0x4c48d2['id']},{})[_0x7238('0x28')](function(){return _0x20df66;});}else{return _0x20df66;}})[_0x7238('0x46')](function(_0x268c3b){logger[_0x7238('0x50')](_0x7238('0x51'),_0x268c3b);throw _0x268c3b;});}return _0x20df66;})[_0x7238('0x28')](respondWithResult(_0x36f613,0xc9))[_0x7238('0x46')](handleError(_0x36f613,null));};exports[_0x7238('0x27')]=function(_0x300cf0,_0x520d11){if(_0x300cf0[_0x7238('0x52')]['id']){delete _0x300cf0[_0x7238('0x52')]['id'];}return db[_0x7238('0x2e')][_0x7238('0x49')]({'where':{'id':_0x300cf0[_0x7238('0x48')]['id']}})[_0x7238('0x28')](handleEntityNotFound(_0x520d11,null))[_0x7238('0x28')](saveUpdates(_0x300cf0[_0x7238('0x52')],null))[_0x7238('0x28')](respondWithResult(_0x520d11,null))[_0x7238('0x46')](handleError(_0x520d11,null));};exports[_0x7238('0x53')]=function(_0x4c5975,_0x21ee23){return db['CmList'][_0x7238('0x49')]({'where':{'id':_0x4c5975['params']['id']}})['then'](handleEntityNotFound(_0x21ee23,null))[_0x7238('0x28')](removeEntity(_0x21ee23,null))[_0x7238('0x46')](handleError(_0x21ee23,null));};exports['describe']=function(_0x2fae27,_0x56bd10){return db[_0x7238('0x2e')][_0x7238('0x54')]()[_0x7238('0x28')](respondWithResult(_0x56bd10,null))['catch'](handleError(_0x56bd10,null));};exports[_0x7238('0x55')]=function(_0x50b096,_0x400a2b,_0x11bceb){if(_0x50b096['body']['id']){delete _0x50b096['body']['id'];}return db['CmList']['find']({'where':{'id':_0x50b096[_0x7238('0x48')]['id']}})[_0x7238('0x28')](handleEntityNotFound(_0x400a2b,null))[_0x7238('0x28')](function(_0x40a0f){if(_0x40a0f){_0x50b096[_0x7238('0x52')][_0x7238('0x56')]=_0x40a0f['id'];return db[_0x7238('0x57')][_0x7238('0x4a')](_0x50b096[_0x7238('0x52')]);}})['then'](respondWithResult(_0x400a2b,null))[_0x7238('0x46')](handleError(_0x400a2b,null));};exports['getDispositions']=function(_0x25b146,_0x7dbdbf,_0x421479){var _0x249036={'raw':![],'where':{}};var _0x10341e={};var _0x49d381={'count':0x0,'rows':[]};return db[_0x7238('0x2e')]['findOne']({'where':{'id':_0x25b146[_0x7238('0x48')]['id']}})[_0x7238('0x28')](handleEntityNotFound(_0x7dbdbf,null))['then'](function(_0x1e961f){if(_0x1e961f){_0x10341e[_0x7238('0x37')]=_[_0x7238('0x34')](db[_0x7238('0x57')]['rawAttributes']);_0x10341e[_0x7238('0x33')]=_['keys'](_0x25b146[_0x7238('0x33')]);_0x10341e[_0x7238('0x35')]=_['intersection'](_0x10341e['model'],_0x10341e[_0x7238('0x33')]);_0x249036[_0x7238('0x38')]=_[_0x7238('0x36')](_0x10341e[_0x7238('0x37')],qs[_0x7238('0x39')](_0x25b146[_0x7238('0x33')]['fields']));_0x249036['attributes']=_0x249036['attributes'][_0x7238('0x3a')]?_0x249036[_0x7238('0x38')]:_0x10341e[_0x7238('0x37')];if(!_0x25b146['query']['hasOwnProperty'](_0x7238('0x3c'))){_0x249036['limit']=qs[_0x7238('0x22')](_0x25b146['query'][_0x7238('0x22')]);_0x249036[_0x7238('0x20')]=qs[_0x7238('0x20')](_0x25b146[_0x7238('0x33')][_0x7238('0x20')]);}_0x249036[_0x7238('0x3d')]=qs[_0x7238('0x3e')](_0x25b146[_0x7238('0x33')][_0x7238('0x3e')]);_0x249036[_0x7238('0x3f')]=qs[_0x7238('0x35')](_[_0x7238('0x40')](_0x25b146['query'],_0x10341e['filters']));_0x249036['where'][_0x7238('0x56')]=_0x1e961f['id'];if(_0x25b146[_0x7238('0x33')][_0x7238('0x41')]){_0x249036[_0x7238('0x3f')]=_['merge'](_0x249036['where'],{'$or':_['map'](_0x249036[_0x7238('0x38')],function(_0x69fd98){var _0x16386e={};_0x16386e[_0x69fd98]={'$like':'%'+_0x25b146[_0x7238('0x33')][_0x7238('0x41')]+'%'};return _0x16386e;})});}_0x249036=_[_0x7238('0x43')]({},_0x249036,_0x25b146[_0x7238('0x44')]);return db[_0x7238('0x57')][_0x7238('0x23')]({'where':_0x249036[_0x7238('0x3f')]})[_0x7238('0x28')](function(_0x5543b5){_0x49d381[_0x7238('0x23')]=_0x5543b5;if(_0x25b146[_0x7238('0x33')][_0x7238('0x45')]){_0x249036['include']=[{'all':!![]}];}return db[_0x7238('0x57')][_0x7238('0x58')](_0x249036);})[_0x7238('0x28')](function(_0x2d286a){_0x49d381['rows']=_0x2d286a;return _0x49d381;});}})[_0x7238('0x28')](respondWithFilteredResult(_0x7dbdbf,_0x249036))[_0x7238('0x46')](handleError(_0x7dbdbf,null));};exports[_0x7238('0x59')]=function(_0x421c20,_0x5e0ca5,_0x5181db){return db[_0x7238('0x2e')][_0x7238('0x49')]({'where':{'id':_0x421c20[_0x7238('0x48')]['id']}})[_0x7238('0x28')](handleEntityNotFound(_0x5e0ca5,null))[_0x7238('0x28')](function(_0x40d463){if(_0x40d463){return _0x40d463[_0x7238('0x59')](_0x421c20[_0x7238('0x33')][_0x7238('0x5a')]);}})[_0x7238('0x28')](respondWithStatusCode(_0x5e0ca5,null))[_0x7238('0x46')](handleError(_0x5e0ca5,null));};exports[_0x7238('0x5b')]=function(_0x45af15,_0x194528,_0x101fdc){return db[_0x7238('0x2e')][_0x7238('0x49')]({'where':{'id':_0x45af15[_0x7238('0x48')]['id']}})[_0x7238('0x28')](handleEntityNotFound(_0x194528,null))['then'](function(_0x1c4bc5){if(_0x1c4bc5){var _0x196c28=[];var _0x22a478={'success':[],'errors':[]};return db[_0x7238('0x5c')][_0x7238('0x54')]()[_0x7238('0x28')](function(_0x21e9af){if(_0x45af15[_0x7238('0x52')]['tags']&&_['isArray'](_0x45af15[_0x7238('0x52')][_0x7238('0x5d')])){if(_0x45af15[_0x7238('0x52')][_0x7238('0x5d')][_0x7238('0x3a')]){_0x45af15[_0x7238('0x52')][_0x7238('0x5d')]=_0x45af15[_0x7238('0x52')][_0x7238('0x5d')]['join'](';')+';';}else{_0x45af15[_0x7238('0x52')]['tags']=null;}}else{_0x45af15[_0x7238('0x52')][_0x7238('0x5d')]=null;}if(_0x45af15[_0x7238('0x52')]&&_['isArray'](_0x45af15[_0x7238('0x52')])){for(var _0x139dec=0x0;_0x139dec<_0x45af15[_0x7238('0x52')][_0x7238('0x3a')];_0x139dec+=0x1){_0x45af15[_0x7238('0x52')][_0x139dec]['ListId']=_0x45af15[_0x7238('0x48')]['id'];_0x196c28[_0x7238('0x5e')](_0x45af15['body'][_0x139dec]);}return BPromise[_0x7238('0x5f')](_0x196c28,function(_0x6e1868){return db[_0x7238('0x5c')]['create'](_[_0x7238('0x60')](_0x6e1868,['ids','id'])||{},{'fields':_[_0x7238('0x34')](_0x21e9af),'raw':!![]})['then'](function(_0x574fce){_0x22a478['success']['push'](_0x574fce['dataValues']);})['catch'](function(_0x533031){_0x22a478[_0x7238('0x61')]['push']({'data':_0x6e1868,'error':_0x533031[_0x7238('0x62')]});});})[_0x7238('0x28')](function(_0x2fdebd){return _0x22a478;})[_0x7238('0x46')](function(_0x3c5177){return _0x3c5177;});}else{_0x194528[_0x7238('0x1d')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x194528,null))[_0x7238('0x46')](handleError(_0x194528,null));};exports[_0x7238('0x63')]=function(_0x189c3d,_0x8e88c5,_0x5a15a2){var _0xc9ac36;return db[_0x7238('0x2e')][_0x7238('0x49')]({'where':{'id':_0x189c3d['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x7238('0x64')}]})['then'](handleEntityNotFound(_0x8e88c5,null))[_0x7238('0x28')](function(_0x1e954e){if(_0x1e954e){_0xc9ac36=_0x1e954e;return db[_0x7238('0x5c')]['rawAttributes'];}})['then'](function(_0x4eeb91){if(_0x4eeb91){var _0x166989={};var _0x351ed9={};_0x351ed9[_0x7238('0x37')]=_[_0x7238('0x65')](_['keys'](_0x4eeb91),_['map'](_0xc9ac36['CustomFields'],function(_0xc06619){return util[_0x7238('0x66')](_0x7238('0x67'),_0xc06619['id']);}));_0x351ed9[_0x7238('0x33')]=_[_0x7238('0x34')](_0x189c3d[_0x7238('0x33')]);_0x351ed9[_0x7238('0x35')]=_['intersection'](_0x351ed9[_0x7238('0x37')],_0x351ed9['query']);_0x166989[_0x7238('0x38')]=_[_0x7238('0x36')](_0x351ed9['model'],qs['fields'](_0x189c3d[_0x7238('0x33')][_0x7238('0x39')]));_0x166989[_0x7238('0x38')]=_0x166989['attributes'][_0x7238('0x3a')]?_0x166989[_0x7238('0x38')]:_0x351ed9['model'];if(!_0x189c3d[_0x7238('0x33')][_0x7238('0x3b')](_0x7238('0x3c'))){_0x166989[_0x7238('0x22')]=qs[_0x7238('0x22')](_0x189c3d[_0x7238('0x33')][_0x7238('0x22')]);_0x166989[_0x7238('0x20')]=qs[_0x7238('0x20')](_0x189c3d[_0x7238('0x33')]['offset']);}_0x166989[_0x7238('0x3d')]=qs[_0x7238('0x3e')](_0x189c3d[_0x7238('0x33')][_0x7238('0x3e')]);_0x166989[_0x7238('0x3f')]=qs[_0x7238('0x35')](_[_0x7238('0x40')](_0x189c3d[_0x7238('0x33')],_0x351ed9[_0x7238('0x35')]));_0x166989['raw']=!![];if(_0x189c3d['query'][_0x7238('0x41')]){_0x166989[_0x7238('0x3f')]=_[_0x7238('0x43')](_0x166989['where'],{'$or':_['map'](_0x166989[_0x7238('0x38')],function(_0x4e685a){var _0x1d0860={};_0x1d0860[_0x4e685a]={'$like':'%'+_0x189c3d[_0x7238('0x33')][_0x7238('0x41')]+'%'};return _0x1d0860;})});}_0x166989=_['merge']({},_0x166989,_0x189c3d[_0x7238('0x44')]);return _0xc9ac36[_0x7238('0x63')](_0x166989);}})['then'](respondWithResult(_0x8e88c5,null))[_0x7238('0x46')](handleError(_0x8e88c5,null));};exports['getContactsCsv']=function(_0x2087f3,_0x393424,_0x1923af){var _0x3d670b;var _0xea1bb;var _0x6915bd;var _0x27b54c=_0x2087f3[_0x7238('0x48')]['id'];csv_results=[];return db[_0x7238('0x68')][_0x7238('0x58')]({'attributes':['id',_0x7238('0x2a')],'raw':!![],'order':['OrderBy']})[_0x7238('0x28')](function(_0x42420e){_0x3d670b=_0x42420e;var _0x240be1=_[_0x7238('0x34')](db[_0x7238('0x5c')][_0x7238('0x2f')]);return db[_0x7238('0x69')][_0x7238('0x58')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x10ad44){_0xea1bb=_0x10ad44;var _0x3b3b82=squel[_0x7238('0x6a')]()['fields'](_0x240be1)['from'](_0x7238('0x6b'),'c')[_0x7238('0x3f')](_0x7238('0x6c'),_0x27b54c)[_0x7238('0x3f')](_0x7238('0x6d'))[_0x7238('0x6e')]();for(var _0x5ebdfe=0x0;_0x5ebdfe<_0xea1bb[_0x7238('0x3a')];_0x5ebdfe++){_0x3b3b82['field'](_0x7238('0x6f')+_0xea1bb[_0x5ebdfe]['id'],_0x7238('0x70')+_0xea1bb[_0x5ebdfe][_0x7238('0x71')]);}for(var _0x5ebdfe=0x0;_0x5ebdfe<_0x3d670b[_0x7238('0x3a')];_0x5ebdfe++){_0x3b3b82[_0x7238('0x72')](squel[_0x7238('0x6a')]()['field'](_0x7238('0x73'))[_0x7238('0x74')]('cm_contact_has_items')[_0x7238('0x3f')](_0x7238('0x75'),_0x3d670b[_0x5ebdfe]['id'])[_0x7238('0x3f')](_0x7238('0x76')),'additionalPhone_'+_0x3d670b[_0x5ebdfe][_0x7238('0x2a')]);_0x3b3b82['field'](squel[_0x7238('0x6a')]()[_0x7238('0x72')](_0x7238('0x77'))[_0x7238('0x74')](_0x7238('0x78'))[_0x7238('0x3f')]('ItemTypeId\x20=\x20?',_0x3d670b[_0x5ebdfe]['id'])[_0x7238('0x3f')](_0x7238('0x76')),_0x7238('0x79')+_0x3d670b[_0x5ebdfe]['name']);}var _0x3ecba9=[];_0x3ecba9[_0x7238('0x5e')](_0x3b3b82[_0x7238('0x7a')]());BPromise[_0x7238('0x5f')](_0x3ecba9,handleQuery)[_0x7238('0x28')](function(_0x4ef66f){handleQuery(_0x3b3b82[_0x7238('0x7a')]());var _0x50e610=csv_results[0x0];if(!_[_0x7238('0x7b')](_0x50e610)){var _0x991289=toCsv(_0x50e610);var _0x343d2e=Date['now']();fs[_0x7238('0x7c')](util[_0x7238('0x66')](_0x7238('0x7d'),_0x27b54c,_0x343d2e),_0x991289);_0x393424[_0x7238('0x7e')](_0x7238('0x7f'),'attachment;\x20filename='+util[_0x7238('0x66')]('list_%d_%s.csv',_0x27b54c,_0x343d2e));_0x393424[_0x7238('0x7e')]('Content-type','text/csv');return _0x393424[_0x7238('0x80')](util[_0x7238('0x66')](_0x7238('0x7d'),_0x27b54c,_0x343d2e));}else{return _0x393424[_0x7238('0x1c')](0xcc);}});});});};exports[_0x7238('0x81')]=function(_0x3c2acf,_0xba39eb,_0x23f530){var _0x23ced1;delete _0x3c2acf[_0x7238('0x52')]['id'];return db[_0x7238('0x2e')][_0x7238('0x82')]({'where':{'id':_0x3c2acf['params']['id']}})[_0x7238('0x28')](handleEntityNotFound(_0xba39eb,null))[_0x7238('0x28')](function(_0x5562e2){if(_0x5562e2){return db[_0x7238('0x83')][_0x7238('0x84')](function(_0x4f2c1a){return db[_0x7238('0x69')][_0x7238('0x4a')](_0x3c2acf[_0x7238('0x52')],{'transaction':_0x4f2c1a})[_0x7238('0x28')](function(_0x53e807){_0x23ced1=_0x53e807;return _0x5562e2[_0x7238('0x85')](_0x53e807,{'transaction':_0x4f2c1a});})[_0x7238('0x28')](function(){var _0x46bcdd={'type':db['Sequelize']['TEXT'],'transaction':_0x4f2c1a};switch(_0x3c2acf[_0x7238('0x52')][_0x7238('0x31')]){case'text':_0x46bcdd[_0x7238('0x31')]=db['Sequelize']['TEXT'];break;case _0x7238('0x86'):_0x46bcdd[_0x7238('0x31')]=db['Sequelize'][_0x7238('0x87')];break;case _0x7238('0x88'):_0x46bcdd[_0x7238('0x31')]=db['Sequelize'][_0x7238('0x89')];_0x46bcdd['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x7238('0x8a')](_0x7238('0x6b'),util[_0x7238('0x66')](_0x7238('0x8b'),_0x23ced1['id']),_0x46bcdd);})[_0x7238('0x28')](function(){return _0x23ced1;});});}})['then'](respondWithResult(_0xba39eb,null))[_0x7238('0x46')](handleError(_0xba39eb,null));};exports[_0x7238('0x8c')]=function(_0x36e862,_0x29622,_0x4d76ff){var _0xbcd31d={};var _0x1852ef={};var _0x2231d2;var _0x3d5838;return db['CmList'][_0x7238('0x82')]({'where':{'id':_0x36e862['params']['id']}})[_0x7238('0x28')](handleEntityNotFound(_0x29622,null))[_0x7238('0x28')](function(_0x47aeb5){if(_0x47aeb5){_0x2231d2=_0x47aeb5;_0x1852ef[_0x7238('0x37')]=_[_0x7238('0x34')](db['CmCustomField'][_0x7238('0x2f')]);_0x1852ef[_0x7238('0x33')]=_[_0x7238('0x34')](_0x36e862[_0x7238('0x33')]);_0x1852ef[_0x7238('0x35')]=_['intersection'](_0x1852ef[_0x7238('0x37')],_0x1852ef[_0x7238('0x33')]);_0xbcd31d[_0x7238('0x38')]=_[_0x7238('0x36')](_0x1852ef['model'],qs[_0x7238('0x39')](_0x36e862[_0x7238('0x33')]['fields']));_0xbcd31d[_0x7238('0x38')]=_0xbcd31d[_0x7238('0x38')]['length']?_0xbcd31d[_0x7238('0x38')]:_0x1852ef[_0x7238('0x37')];_0xbcd31d[_0x7238('0x3d')]=qs[_0x7238('0x3e')](_0x36e862[_0x7238('0x33')]['sort']);_0xbcd31d['where']=qs['filters'](_[_0x7238('0x40')](_0x36e862[_0x7238('0x33')],_0x1852ef[_0x7238('0x35')]));_0xbcd31d['where']=_[_0x7238('0x43')](_0xbcd31d[_0x7238('0x3f')],{'$or':[{'ListId':_0x47aeb5['id']},{'ListId':null}]});if(_0x36e862[_0x7238('0x33')][_0x7238('0x41')]){_0xbcd31d[_0x7238('0x3f')]=_['merge'](_0xbcd31d[_0x7238('0x3f')],{'$or':_[_0x7238('0x2d')](_0xbcd31d[_0x7238('0x38')],function(_0x23c941){var _0x107282={};_0x107282[_0x23c941]={'$like':'%'+_0x36e862[_0x7238('0x33')][_0x7238('0x41')]+'%'};return _0x107282;})});}_0xbcd31d=_['merge']({},_0xbcd31d,_0x36e862['options']);return db['CmCustomField'][_0x7238('0x8d')](_0xbcd31d);}})[_0x7238('0x28')](respondWithResult(_0x29622,null))[_0x7238('0x46')](handleError(_0x29622,null));};exports['getGlobalCustomFields']=function(_0x14cef0,_0x26deab){return db[_0x7238('0x69')][_0x7238('0x8d')]({'where':{'ListId':null}})[_0x7238('0x28')](handleEntityNotFound(_0x26deab,null))['then'](function(_0x272b15){return _0x272b15;})['then'](respondWithResult(_0x26deab,null))[_0x7238('0x46')](handleError(_0x26deab,null));};exports[_0x7238('0x8e')]=function(_0x3e36d8,_0x52fbd2,_0x232615){return db[_0x7238('0x2e')][_0x7238('0x49')]({'where':{'id':_0x3e36d8[_0x7238('0x48')]['id']}})[_0x7238('0x28')](handleEntityNotFound(_0x52fbd2,null))[_0x7238('0x28')](function(_0x1cfbfb){if(_0x1cfbfb){return _0x1cfbfb[_0x7238('0x8e')](_0x3e36d8['body'][_0x7238('0x5a')],_[_0x7238('0x60')](_0x3e36d8[_0x7238('0x52')],['ids','id'])||{})['spread'](function(_0x5c0cc9){for(var _0x42ea8f=0x0;_0x42ea8f<_0x3e36d8['body'][_0x7238('0x5a')][_0x7238('0x3a')];_0x42ea8f+=0x1){socket[_0x7238('0x8f')]('userCmList:save',{'UserId':Number(_0x3e36d8['body'][_0x7238('0x5a')][_0x42ea8f]),'CmListId':Number(_0x3e36d8[_0x7238('0x48')]['id'])});}return _0x5c0cc9;});}})['then'](respondWithResult(_0x52fbd2,null))['catch'](handleError(_0x52fbd2,null));};exports[_0x7238('0x90')]=function(_0xfcc87f,_0x857273,_0x7a8a86){return db[_0x7238('0x2e')][_0x7238('0x49')]({'where':{'id':_0xfcc87f[_0x7238('0x48')]['id']}})['then'](handleEntityNotFound(_0x857273,null))[_0x7238('0x28')](function(_0xf1d2da){if(_0xf1d2da){return _0xf1d2da['removeAgents'](_0xfcc87f[_0x7238('0x33')][_0x7238('0x5a')])['then'](function(){if(_['isArray'](_0xfcc87f[_0x7238('0x33')]['ids'])){for(var _0x5aa8d3=0x0;_0x5aa8d3<_0xfcc87f[_0x7238('0x33')][_0x7238('0x5a')][_0x7238('0x3a')];_0x5aa8d3+=0x1){socket[_0x7238('0x8f')](_0x7238('0x91'),{'UserId':Number(_0xfcc87f[_0x7238('0x33')][_0x7238('0x5a')][_0x5aa8d3]),'CmListId':Number(_0xfcc87f[_0x7238('0x48')]['id'])});}}else{socket['emit'](_0x7238('0x91'),{'UserId':Number(_0xfcc87f[_0x7238('0x33')][_0x7238('0x5a')]),'CmListId':Number(_0xfcc87f[_0x7238('0x48')]['id'])});}});}})[_0x7238('0x28')](respondWithStatusCode(_0x857273,null))[_0x7238('0x46')](handleError(_0x857273,null));};exports[_0x7238('0x92')]=function(_0x4f92b3,_0x1e6bc6,_0xfaed76){var _0x2108e9={};var _0x4ad62f={};var _0x414678;var _0x127d30;return db[_0x7238('0x2e')][_0x7238('0x82')]({'where':{'id':_0x4f92b3['params']['id']}})[_0x7238('0x28')](handleEntityNotFound(_0x1e6bc6,null))[_0x7238('0x28')](function(_0x19610e){if(_0x19610e){_0x414678=_0x19610e;_0x4ad62f['model']=_[_0x7238('0x34')](db[_0x7238('0x93')][_0x7238('0x2f')]);_0x4ad62f[_0x7238('0x33')]=_[_0x7238('0x34')](_0x4f92b3[_0x7238('0x33')]);_0x4ad62f[_0x7238('0x35')]=_[_0x7238('0x36')](_0x4ad62f[_0x7238('0x37')],_0x4ad62f[_0x7238('0x33')]);_0x2108e9['attributes']=_[_0x7238('0x36')](_0x4ad62f['model'],qs[_0x7238('0x39')](_0x4f92b3[_0x7238('0x33')][_0x7238('0x39')]));_0x2108e9[_0x7238('0x38')]=_0x2108e9[_0x7238('0x38')]['length']?_0x2108e9[_0x7238('0x38')]:_0x4ad62f[_0x7238('0x37')];_0x2108e9[_0x7238('0x3d')]=qs[_0x7238('0x3e')](_0x4f92b3['query'][_0x7238('0x3e')]);_0x2108e9[_0x7238('0x3f')]=qs[_0x7238('0x35')](_[_0x7238('0x40')](_0x4f92b3['query'],_0x4ad62f['filters']));if(_0x4f92b3['query'][_0x7238('0x41')]){_0x2108e9[_0x7238('0x3f')]=_[_0x7238('0x43')](_0x2108e9[_0x7238('0x3f')],{'$or':_['map'](_0x2108e9[_0x7238('0x38')],function(_0x56198e){var _0x57901e={};_0x57901e[_0x56198e]={'$like':'%'+_0x4f92b3[_0x7238('0x33')][_0x7238('0x41')]+'%'};return _0x57901e;})});}_0x2108e9=_['merge']({},_0x2108e9,_0x4f92b3['options']);return _0x414678['getAgents'](_0x2108e9);}})[_0x7238('0x28')](function(_0x38818a){if(_0x38818a){_0x127d30=_0x38818a['length'];if(!_0x4f92b3[_0x7238('0x33')][_0x7238('0x3b')]('nolimit')){_0x2108e9['limit']=qs['limit'](_0x4f92b3['query'][_0x7238('0x22')]);_0x2108e9['offset']=qs['offset'](_0x4f92b3[_0x7238('0x33')][_0x7238('0x20')]);}return _0x414678[_0x7238('0x92')](_0x2108e9);}})[_0x7238('0x28')](function(_0x59cd1a){if(_0x59cd1a){return _0x59cd1a?{'count':_0x127d30,'rows':_0x59cd1a}:null;}})[_0x7238('0x28')](respondWithResult(_0x1e6bc6,null))[_0x7238('0x46')](handleError(_0x1e6bc6,null));};function handleQuery(_0x3c0b91){logger[_0x7238('0x94')](_0x3c0b91);return db[_0x7238('0x83')][_0x7238('0x33')](_0x3c0b91)[_0x7238('0x95')](function(_0x296ae4){csv_results['push'](_0x296ae4);})[_0x7238('0x46')](function(_0x3b7111){logger[_0x7238('0x50')](_0x3b7111[_0x7238('0x62')]);});} \ No newline at end of file +var _0xfc28=['findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','order','sort','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','cf_%d','raw','getContactsCsv','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','format','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','download','addCustomField','findOne','transaction','addCustomFields','Sequelize','TEXT','INTEGER','BOOLEAN','defaultValue','addColumn','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','include'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc28,0x102));var _0x8fc2=function(_0x5b6e48,_0x9e0e02){_0x5b6e48=_0x5b6e48-0x0;var _0x2821e1=_0xfc28[_0x5b6e48];return _0x2821e1;};'use strict';var emlformat=require(_0x8fc2('0x0'));var rimraf=require(_0x8fc2('0x1'));var zipdir=require(_0x8fc2('0x2'));var jsonpatch=require(_0x8fc2('0x3'));var rp=require(_0x8fc2('0x4'));var moment=require(_0x8fc2('0x5'));var BPromise=require(_0x8fc2('0x6'));var Mustache=require('mustache');var util=require(_0x8fc2('0x7'));var path=require(_0x8fc2('0x8'));var sox=require('sox');var csv=require(_0x8fc2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fc2('0xa'));var _=require('lodash');var squel=require(_0x8fc2('0xb'));var crypto=require(_0x8fc2('0xc'));var jsforce=require(_0x8fc2('0xd'));var deskjs=require(_0x8fc2('0xe'));var toCsv=require(_0x8fc2('0x9'));var querystring=require(_0x8fc2('0xf'));var Papa=require(_0x8fc2('0x10'));var Redis=require(_0x8fc2('0x11'));var authService=require(_0x8fc2('0x12'));var qs=require(_0x8fc2('0x13'));var as=require(_0x8fc2('0x14'));var hardwareService=require(_0x8fc2('0x15'));var logger=require(_0x8fc2('0x16'))('api');var utils=require(_0x8fc2('0x17'));var config=require(_0x8fc2('0x18'));var licenseUtil=require(_0x8fc2('0x19'));var db=require(_0x8fc2('0x1a'))['db'];var csv_results;config['redis']=_[_0x8fc2('0x1b')](config['redis'],{'host':_0x8fc2('0x1c'),'port':0x18eb});var socket=require(_0x8fc2('0x1d'))(new Redis(config['redis']));require(_0x8fc2('0x1e'))[_0x8fc2('0x1f')](socket);function respondWithStatusCode(_0x3f8064,_0x2997e3){_0x2997e3=_0x2997e3||0xcc;return function(_0x400c45){if(_0x400c45){return _0x3f8064[_0x8fc2('0x20')](_0x2997e3);}return _0x3f8064[_0x8fc2('0x21')](_0x2997e3)[_0x8fc2('0x22')]();};}function respondWithResult(_0x54f3de,_0x4ade57){_0x4ade57=_0x4ade57||0xc8;return function(_0x18d1a2){if(_0x18d1a2){return _0x54f3de['status'](_0x4ade57)['json'](_0x18d1a2);}};}function respondWithFilteredResult(_0x1a6fe3,_0x3f46ca){return function(_0x138b58){if(_0x138b58){var _0x39ce59=typeof _0x3f46ca['offset']===_0x8fc2('0x23')&&typeof _0x3f46ca[_0x8fc2('0x24')]===_0x8fc2('0x23');var _0x1874fe=_0x138b58[_0x8fc2('0x25')];var _0x1acf68=_0x39ce59?0x0:_0x3f46ca[_0x8fc2('0x26')];var _0x1bbb74=_0x39ce59?_0x138b58[_0x8fc2('0x25')]:_0x3f46ca[_0x8fc2('0x26')]+_0x3f46ca[_0x8fc2('0x24')];var _0x78f313;if(_0x1bbb74>=_0x1874fe){_0x1bbb74=_0x1874fe;_0x78f313=0xc8;}else{_0x78f313=0xce;}_0x1a6fe3[_0x8fc2('0x21')](_0x78f313);return _0x1a6fe3['set'](_0x8fc2('0x27'),_0x1acf68+'-'+_0x1bbb74+'/'+_0x1874fe)[_0x8fc2('0x28')](_0x138b58);}return null;};}function patchUpdates(_0x1c843b){return function(_0x4baa1e){try{jsonpatch[_0x8fc2('0x29')](_0x4baa1e,_0x1c843b,!![]);}catch(_0x11ced2){return BPromise[_0x8fc2('0x2a')](_0x11ced2);}return _0x4baa1e[_0x8fc2('0x2b')]();};}function saveUpdates(_0x5c128a,_0x16655a){return function(_0x7d794e){if(_0x7d794e){return _0x7d794e[_0x8fc2('0x2c')](_0x5c128a)[_0x8fc2('0x2d')](function(_0x2c5fcf){return _0x2c5fcf;});}return null;};}function removeEntity(_0x20d1fe,_0x304f1b){return function(_0xa5c92){if(_0xa5c92){return _0xa5c92[_0x8fc2('0x2e')]()['then'](function(){var _0x406ff4=_0xa5c92[_0x8fc2('0x2f')]({'plain':!![]});var _0x1edb8c=_0x8fc2('0x30');return db[_0x8fc2('0x31')][_0x8fc2('0x2e')]({'where':{'type':_0x1edb8c,'resourceId':_0x406ff4['id']}})[_0x8fc2('0x2d')](function(){return _0xa5c92;});})[_0x8fc2('0x2d')](function(){_0x20d1fe[_0x8fc2('0x21')](0xcc)[_0x8fc2('0x22')]();});}};}function handleEntityNotFound(_0x171178,_0x14b4d0){return function(_0x1b5d18){if(!_0x1b5d18){_0x171178[_0x8fc2('0x20')](0x194);}return _0x1b5d18;};}function handleError(_0x5fb654,_0x14af13){_0x14af13=_0x14af13||0x1f4;return function(_0x32bdd1){logger[_0x8fc2('0x32')](_0x32bdd1[_0x8fc2('0x33')]);if(_0x32bdd1['name']){delete _0x32bdd1[_0x8fc2('0x34')];}_0x5fb654[_0x8fc2('0x21')](_0x14af13)[_0x8fc2('0x35')](_0x32bdd1);};}exports[_0x8fc2('0x36')]=function(_0x3de2ea,_0x5dd876){var _0xd4c638={},_0x95660={},_0x352e2e={'count':0x0,'rows':[]};var _0x502fb6=_[_0x8fc2('0x37')](db[_0x8fc2('0x38')][_0x8fc2('0x39')],function(_0x3cf06c){return{'name':_0x3cf06c[_0x8fc2('0x3a')],'type':_0x3cf06c['type']['key']};});_0x95660['model']=_[_0x8fc2('0x37')](_0x502fb6,_0x8fc2('0x34'));_0x95660['query']=_[_0x8fc2('0x3b')](_0x3de2ea[_0x8fc2('0x3c')]);_0x95660[_0x8fc2('0x3d')]=_[_0x8fc2('0x3e')](_0x95660[_0x8fc2('0x3f')],_0x95660[_0x8fc2('0x3c')]);_0xd4c638[_0x8fc2('0x40')]=_[_0x8fc2('0x3e')](_0x95660['model'],qs[_0x8fc2('0x41')](_0x3de2ea['query'][_0x8fc2('0x41')]));_0xd4c638[_0x8fc2('0x40')]=_0xd4c638[_0x8fc2('0x40')][_0x8fc2('0x42')]?_0xd4c638[_0x8fc2('0x40')]:_0x95660['model'];if(!_0x3de2ea[_0x8fc2('0x3c')][_0x8fc2('0x43')](_0x8fc2('0x44'))){_0xd4c638[_0x8fc2('0x24')]=qs['limit'](_0x3de2ea['query'][_0x8fc2('0x24')]);_0xd4c638[_0x8fc2('0x26')]=qs['offset'](_0x3de2ea['query'][_0x8fc2('0x26')]);}_0xd4c638['order']=qs['sort'](_0x3de2ea['query']['sort']);_0xd4c638[_0x8fc2('0x45')]=qs[_0x8fc2('0x3d')](_[_0x8fc2('0x46')](_0x3de2ea[_0x8fc2('0x3c')],_0x95660[_0x8fc2('0x3d')]),_0x502fb6);if(_0x3de2ea[_0x8fc2('0x3c')][_0x8fc2('0x47')]){_0xd4c638[_0x8fc2('0x45')]=_[_0x8fc2('0x48')](_0xd4c638[_0x8fc2('0x45')],{'$or':_[_0x8fc2('0x37')](_0x502fb6,function(_0x19fd9b){if(_0x19fd9b[_0x8fc2('0x49')]!==_0x8fc2('0x4a')){var _0x17376b={};_0x17376b[_0x19fd9b[_0x8fc2('0x34')]]={'$like':'%'+_0x3de2ea[_0x8fc2('0x3c')][_0x8fc2('0x47')]+'%'};return _0x17376b;}})});}_0xd4c638=_['merge']({},_0xd4c638,_0x3de2ea['options']);var _0x26614d={'where':_0xd4c638[_0x8fc2('0x45')]};return db['CmList'][_0x8fc2('0x25')](_0x26614d)[_0x8fc2('0x2d')](function(_0x4b2bb6){_0x352e2e[_0x8fc2('0x25')]=_0x4b2bb6;if(_0x3de2ea[_0x8fc2('0x3c')]['includeAll']){_0xd4c638[_0x8fc2('0x4b')]=[{'all':!![]}];}return db[_0x8fc2('0x38')][_0x8fc2('0x4c')](_0xd4c638);})[_0x8fc2('0x2d')](function(_0x586c92){_0x352e2e[_0x8fc2('0x4d')]=_0x586c92;return _0x352e2e;})[_0x8fc2('0x2d')](respondWithFilteredResult(_0x5dd876,_0xd4c638))[_0x8fc2('0x4e')](handleError(_0x5dd876,null));};exports[_0x8fc2('0x4f')]=function(_0x3ec48b,_0x1c37dd){var _0x476afa={'raw':![],'where':{'id':_0x3ec48b[_0x8fc2('0x50')]['id']}},_0x1a2ebe={};_0x1a2ebe[_0x8fc2('0x3f')]=_[_0x8fc2('0x3b')](db[_0x8fc2('0x38')][_0x8fc2('0x39')]);_0x1a2ebe[_0x8fc2('0x3c')]=_['keys'](_0x3ec48b[_0x8fc2('0x3c')]);_0x1a2ebe[_0x8fc2('0x3d')]=_[_0x8fc2('0x3e')](_0x1a2ebe[_0x8fc2('0x3f')],_0x1a2ebe[_0x8fc2('0x3c')]);_0x476afa[_0x8fc2('0x40')]=_[_0x8fc2('0x3e')](_0x1a2ebe[_0x8fc2('0x3f')],qs[_0x8fc2('0x41')](_0x3ec48b[_0x8fc2('0x3c')][_0x8fc2('0x41')]));_0x476afa[_0x8fc2('0x40')]=_0x476afa[_0x8fc2('0x40')][_0x8fc2('0x42')]?_0x476afa[_0x8fc2('0x40')]:_0x1a2ebe[_0x8fc2('0x3f')];if(_0x3ec48b[_0x8fc2('0x3c')][_0x8fc2('0x51')]){_0x476afa[_0x8fc2('0x4b')]=[{'all':!![]}];}_0x476afa=_[_0x8fc2('0x48')]({},_0x476afa,_0x3ec48b[_0x8fc2('0x52')]);return db[_0x8fc2('0x38')][_0x8fc2('0x53')](_0x476afa)[_0x8fc2('0x2d')](handleEntityNotFound(_0x1c37dd,null))['then'](respondWithResult(_0x1c37dd,null))[_0x8fc2('0x4e')](handleError(_0x1c37dd,null));};exports[_0x8fc2('0x54')]=function(_0x3f6d98,_0x232cfb){return db[_0x8fc2('0x38')][_0x8fc2('0x54')](_0x3f6d98[_0x8fc2('0x55')],{})[_0x8fc2('0x2d')](function(_0x10cb6d){var _0x33f113=_0x3f6d98[_0x8fc2('0x56')]['get']({'plain':!![]});if(!_0x33f113)throw new Error(_0x8fc2('0x57'));if(_0x33f113[_0x8fc2('0x58')]==='user'){var _0x218538=_0x10cb6d[_0x8fc2('0x2f')]({'plain':!![]});var _0x34e890=_0x8fc2('0x30');return db[_0x8fc2('0x59')][_0x8fc2('0x53')]({'where':{'name':_0x34e890,'userProfileId':_0x33f113['userProfileId']},'raw':!![]})[_0x8fc2('0x2d')](function(_0x40e96e){if(_0x40e96e&&_0x40e96e[_0x8fc2('0x5a')]===0x0){return db['UserProfileResource'][_0x8fc2('0x54')]({'name':_0x218538[_0x8fc2('0x34')],'resourceId':_0x218538['id'],'type':_0x40e96e[_0x8fc2('0x34')],'sectionId':_0x40e96e['id']},{})[_0x8fc2('0x2d')](function(){return _0x10cb6d;});}else{return _0x10cb6d;}})[_0x8fc2('0x4e')](function(_0x30d510){logger[_0x8fc2('0x32')](_0x8fc2('0x5b'),_0x30d510);throw _0x30d510;});}return _0x10cb6d;})[_0x8fc2('0x2d')](respondWithResult(_0x232cfb,0xc9))[_0x8fc2('0x4e')](handleError(_0x232cfb,null));};exports['update']=function(_0x3c3b80,_0x8c24a7){if(_0x3c3b80[_0x8fc2('0x55')]['id']){delete _0x3c3b80[_0x8fc2('0x55')]['id'];}return db[_0x8fc2('0x38')][_0x8fc2('0x53')]({'where':{'id':_0x3c3b80[_0x8fc2('0x50')]['id']}})[_0x8fc2('0x2d')](handleEntityNotFound(_0x8c24a7,null))[_0x8fc2('0x2d')](saveUpdates(_0x3c3b80[_0x8fc2('0x55')],null))[_0x8fc2('0x2d')](respondWithResult(_0x8c24a7,null))[_0x8fc2('0x4e')](handleError(_0x8c24a7,null));};exports[_0x8fc2('0x2e')]=function(_0x295710,_0x3f2534){return db[_0x8fc2('0x38')][_0x8fc2('0x53')]({'where':{'id':_0x295710[_0x8fc2('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f2534,null))[_0x8fc2('0x2d')](removeEntity(_0x3f2534,null))[_0x8fc2('0x4e')](handleError(_0x3f2534,null));};exports[_0x8fc2('0x5c')]=function(_0x2ca576,_0x37bc36){return db['CmList'][_0x8fc2('0x5c')]()[_0x8fc2('0x2d')](respondWithResult(_0x37bc36,null))[_0x8fc2('0x4e')](handleError(_0x37bc36,null));};exports['addDisposition']=function(_0x11d532,_0x557882,_0x5ba579){if(_0x11d532[_0x8fc2('0x55')]['id']){delete _0x11d532[_0x8fc2('0x55')]['id'];}return db['CmList'][_0x8fc2('0x53')]({'where':{'id':_0x11d532[_0x8fc2('0x50')]['id']}})['then'](handleEntityNotFound(_0x557882,null))[_0x8fc2('0x2d')](function(_0x425c7e){if(_0x425c7e){_0x11d532['body'][_0x8fc2('0x5d')]=_0x425c7e['id'];return db[_0x8fc2('0x5e')][_0x8fc2('0x54')](_0x11d532[_0x8fc2('0x55')]);}})['then'](respondWithResult(_0x557882,null))[_0x8fc2('0x4e')](handleError(_0x557882,null));};exports['getDispositions']=function(_0x455b8d,_0xdd5d4a,_0x6f1560){var _0x1146e4={'raw':![],'where':{}};var _0x36e6cb={};var _0x909069={'count':0x0,'rows':[]};return db[_0x8fc2('0x38')]['findOne']({'where':{'id':_0x455b8d[_0x8fc2('0x50')]['id']}})['then'](handleEntityNotFound(_0xdd5d4a,null))[_0x8fc2('0x2d')](function(_0xc57aa7){if(_0xc57aa7){_0x36e6cb['model']=_[_0x8fc2('0x3b')](db[_0x8fc2('0x5e')][_0x8fc2('0x39')]);_0x36e6cb['query']=_[_0x8fc2('0x3b')](_0x455b8d[_0x8fc2('0x3c')]);_0x36e6cb[_0x8fc2('0x3d')]=_[_0x8fc2('0x3e')](_0x36e6cb[_0x8fc2('0x3f')],_0x36e6cb[_0x8fc2('0x3c')]);_0x1146e4[_0x8fc2('0x40')]=_[_0x8fc2('0x3e')](_0x36e6cb[_0x8fc2('0x3f')],qs[_0x8fc2('0x41')](_0x455b8d[_0x8fc2('0x3c')][_0x8fc2('0x41')]));_0x1146e4[_0x8fc2('0x40')]=_0x1146e4[_0x8fc2('0x40')][_0x8fc2('0x42')]?_0x1146e4['attributes']:_0x36e6cb['model'];if(!_0x455b8d[_0x8fc2('0x3c')]['hasOwnProperty'](_0x8fc2('0x44'))){_0x1146e4[_0x8fc2('0x24')]=qs[_0x8fc2('0x24')](_0x455b8d[_0x8fc2('0x3c')][_0x8fc2('0x24')]);_0x1146e4['offset']=qs[_0x8fc2('0x26')](_0x455b8d['query'][_0x8fc2('0x26')]);}_0x1146e4[_0x8fc2('0x5f')]=qs[_0x8fc2('0x60')](_0x455b8d[_0x8fc2('0x3c')][_0x8fc2('0x60')]);_0x1146e4[_0x8fc2('0x45')]=qs['filters'](_[_0x8fc2('0x46')](_0x455b8d[_0x8fc2('0x3c')],_0x36e6cb[_0x8fc2('0x3d')]));_0x1146e4[_0x8fc2('0x45')][_0x8fc2('0x5d')]=_0xc57aa7['id'];if(_0x455b8d[_0x8fc2('0x3c')][_0x8fc2('0x47')]){_0x1146e4[_0x8fc2('0x45')]=_[_0x8fc2('0x48')](_0x1146e4[_0x8fc2('0x45')],{'$or':_[_0x8fc2('0x37')](_0x1146e4[_0x8fc2('0x40')],function(_0x247e5b){var _0x1e35fe={};_0x1e35fe[_0x247e5b]={'$like':'%'+_0x455b8d[_0x8fc2('0x3c')][_0x8fc2('0x47')]+'%'};return _0x1e35fe;})});}_0x1146e4=_[_0x8fc2('0x48')]({},_0x1146e4,_0x455b8d[_0x8fc2('0x52')]);return db[_0x8fc2('0x5e')][_0x8fc2('0x25')]({'where':_0x1146e4[_0x8fc2('0x45')]})['then'](function(_0x3b8bfc){_0x909069[_0x8fc2('0x25')]=_0x3b8bfc;if(_0x455b8d[_0x8fc2('0x3c')][_0x8fc2('0x51')]){_0x1146e4[_0x8fc2('0x4b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1146e4);})[_0x8fc2('0x2d')](function(_0x159650){_0x909069[_0x8fc2('0x4d')]=_0x159650;return _0x909069;});}})[_0x8fc2('0x2d')](respondWithFilteredResult(_0xdd5d4a,_0x1146e4))['catch'](handleError(_0xdd5d4a,null));};exports['removeDispositions']=function(_0x22e239,_0x867422,_0x1b928e){return db[_0x8fc2('0x38')][_0x8fc2('0x53')]({'where':{'id':_0x22e239[_0x8fc2('0x50')]['id']}})[_0x8fc2('0x2d')](handleEntityNotFound(_0x867422,null))['then'](function(_0x236b41){if(_0x236b41){return _0x236b41[_0x8fc2('0x61')](_0x22e239[_0x8fc2('0x3c')][_0x8fc2('0x62')]);}})[_0x8fc2('0x2d')](respondWithStatusCode(_0x867422,null))['catch'](handleError(_0x867422,null));};exports[_0x8fc2('0x63')]=function(_0x59beeb,_0x4d6321,_0x2900d5){return db['CmList'][_0x8fc2('0x53')]({'where':{'id':_0x59beeb[_0x8fc2('0x50')]['id']}})[_0x8fc2('0x2d')](handleEntityNotFound(_0x4d6321,null))[_0x8fc2('0x2d')](function(_0x4d22d5){if(_0x4d22d5){var _0x402c27=[];var _0x5565e8={'success':[],'errors':[]};return db[_0x8fc2('0x64')][_0x8fc2('0x5c')]()[_0x8fc2('0x2d')](function(_0x32f3b0){if(_0x59beeb[_0x8fc2('0x55')][_0x8fc2('0x65')]&&_[_0x8fc2('0x66')](_0x59beeb[_0x8fc2('0x55')]['tags'])){if(_0x59beeb[_0x8fc2('0x55')][_0x8fc2('0x65')][_0x8fc2('0x42')]){_0x59beeb[_0x8fc2('0x55')]['tags']=_0x59beeb['body'][_0x8fc2('0x65')][_0x8fc2('0x67')](';')+';';}else{_0x59beeb[_0x8fc2('0x55')][_0x8fc2('0x65')]=null;}}else{_0x59beeb['body'][_0x8fc2('0x65')]=null;}if(_0x59beeb[_0x8fc2('0x55')]&&_[_0x8fc2('0x66')](_0x59beeb[_0x8fc2('0x55')])){for(var _0x19dd91=0x0;_0x19dd91<_0x59beeb[_0x8fc2('0x55')][_0x8fc2('0x42')];_0x19dd91+=0x1){_0x59beeb[_0x8fc2('0x55')][_0x19dd91][_0x8fc2('0x5d')]=_0x59beeb[_0x8fc2('0x50')]['id'];_0x402c27['push'](_0x59beeb[_0x8fc2('0x55')][_0x19dd91]);}return BPromise[_0x8fc2('0x68')](_0x402c27,function(_0x25c028){return db[_0x8fc2('0x64')][_0x8fc2('0x54')](_[_0x8fc2('0x69')](_0x25c028,[_0x8fc2('0x62'),'id'])||{},{'fields':_[_0x8fc2('0x3b')](_0x32f3b0),'raw':!![]})['then'](function(_0x294ed5){_0x5565e8[_0x8fc2('0x6a')][_0x8fc2('0x6b')](_0x294ed5[_0x8fc2('0x6c')]);})[_0x8fc2('0x4e')](function(_0x4f4a56){_0x5565e8[_0x8fc2('0x6d')]['push']({'data':_0x25c028,'error':_0x4f4a56[_0x8fc2('0x6e')]});});})[_0x8fc2('0x2d')](function(_0xf05c84){return _0x5565e8;})[_0x8fc2('0x4e')](function(_0x533700){return _0x533700;});}else{_0x4d6321[_0x8fc2('0x21')](0x190)[_0x8fc2('0x28')]({'message':_0x8fc2('0x6f')});}});}})[_0x8fc2('0x2d')](respondWithResult(_0x4d6321,null))[_0x8fc2('0x4e')](handleError(_0x4d6321,null));};exports[_0x8fc2('0x70')]=function(_0x4a4aad,_0x70aac7,_0x6e8daf){var _0x4b184b;return db[_0x8fc2('0x38')][_0x8fc2('0x53')]({'where':{'id':_0x4a4aad['params']['id']},'include':[{'model':db[_0x8fc2('0x71')],'as':'CustomFields'}]})[_0x8fc2('0x2d')](handleEntityNotFound(_0x70aac7,null))[_0x8fc2('0x2d')](function(_0x16b9fe){if(_0x16b9fe){_0x4b184b=_0x16b9fe;return db[_0x8fc2('0x64')][_0x8fc2('0x39')];}})['then'](function(_0x1a4551){if(_0x1a4551){var _0xa69362={};var _0x38dad5={};_0x38dad5['model']=_['concat'](_[_0x8fc2('0x3b')](_0x1a4551),_[_0x8fc2('0x37')](_0x4b184b['CustomFields'],function(_0x48442f){return util['format'](_0x8fc2('0x72'),_0x48442f['id']);}));_0x38dad5[_0x8fc2('0x3c')]=_[_0x8fc2('0x3b')](_0x4a4aad['query']);_0x38dad5[_0x8fc2('0x3d')]=_[_0x8fc2('0x3e')](_0x38dad5[_0x8fc2('0x3f')],_0x38dad5['query']);_0xa69362[_0x8fc2('0x40')]=_[_0x8fc2('0x3e')](_0x38dad5[_0x8fc2('0x3f')],qs['fields'](_0x4a4aad[_0x8fc2('0x3c')][_0x8fc2('0x41')]));_0xa69362[_0x8fc2('0x40')]=_0xa69362[_0x8fc2('0x40')]['length']?_0xa69362[_0x8fc2('0x40')]:_0x38dad5['model'];if(!_0x4a4aad['query'][_0x8fc2('0x43')](_0x8fc2('0x44'))){_0xa69362['limit']=qs[_0x8fc2('0x24')](_0x4a4aad['query'][_0x8fc2('0x24')]);_0xa69362['offset']=qs[_0x8fc2('0x26')](_0x4a4aad[_0x8fc2('0x3c')][_0x8fc2('0x26')]);}_0xa69362['order']=qs[_0x8fc2('0x60')](_0x4a4aad[_0x8fc2('0x3c')][_0x8fc2('0x60')]);_0xa69362['where']=qs[_0x8fc2('0x3d')](_[_0x8fc2('0x46')](_0x4a4aad[_0x8fc2('0x3c')],_0x38dad5['filters']));_0xa69362[_0x8fc2('0x73')]=!![];if(_0x4a4aad[_0x8fc2('0x3c')][_0x8fc2('0x47')]){_0xa69362[_0x8fc2('0x45')]=_[_0x8fc2('0x48')](_0xa69362[_0x8fc2('0x45')],{'$or':_[_0x8fc2('0x37')](_0xa69362[_0x8fc2('0x40')],function(_0xe70ab1){var _0x291e21={};_0x291e21[_0xe70ab1]={'$like':'%'+_0x4a4aad[_0x8fc2('0x3c')]['filter']+'%'};return _0x291e21;})});}_0xa69362=_['merge']({},_0xa69362,_0x4a4aad['options']);return _0x4b184b['getContacts'](_0xa69362);}})[_0x8fc2('0x2d')](respondWithResult(_0x70aac7,null))[_0x8fc2('0x4e')](handleError(_0x70aac7,null));};exports[_0x8fc2('0x74')]=function(_0x46525e,_0x2230e0,_0xc1202f){var _0x4e148b;var _0x1115d2;var _0x1219df;var _0x7c7462=_0x46525e[_0x8fc2('0x50')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x8fc2('0x34')],'raw':!![],'order':[_0x8fc2('0x75')]})[_0x8fc2('0x2d')](function(_0x3bccf0){_0x4e148b=_0x3bccf0;var _0x51d7d2=_['keys'](db[_0x8fc2('0x64')][_0x8fc2('0x39')]);return db[_0x8fc2('0x71')][_0x8fc2('0x4c')]({'raw':!![],'attributes':['id',_0x8fc2('0x76')]})[_0x8fc2('0x2d')](function(_0x2e2453){_0x1115d2=_0x2e2453;var _0x57936c=squel['select']()[_0x8fc2('0x41')](_0x51d7d2)[_0x8fc2('0x77')](_0x8fc2('0x78'),'c')[_0x8fc2('0x45')](_0x8fc2('0x79'),_0x7c7462)['where'](_0x8fc2('0x7a'))[_0x8fc2('0x7b')]();for(var _0x32627a=0x0;_0x32627a<_0x1115d2[_0x8fc2('0x42')];_0x32627a++){_0x57936c[_0x8fc2('0x7c')](_0x8fc2('0x7d')+_0x1115d2[_0x32627a]['id'],_0x8fc2('0x7e')+_0x1115d2[_0x32627a]['alias']);}for(var _0x32627a=0x0;_0x32627a<_0x4e148b[_0x8fc2('0x42')];_0x32627a++){_0x57936c['field'](squel['select']()['field'](_0x8fc2('0x7f'))[_0x8fc2('0x77')]('cm_contact_has_items')[_0x8fc2('0x45')](_0x8fc2('0x80'),_0x4e148b[_0x32627a]['id'])['where'](_0x8fc2('0x81')),_0x8fc2('0x82')+_0x4e148b[_0x32627a]['name']);_0x57936c[_0x8fc2('0x7c')](squel['select']()[_0x8fc2('0x7c')](_0x8fc2('0x83'))['from'](_0x8fc2('0x84'))[_0x8fc2('0x45')](_0x8fc2('0x80'),_0x4e148b[_0x32627a]['id'])[_0x8fc2('0x45')](_0x8fc2('0x81')),_0x8fc2('0x85')+_0x4e148b[_0x32627a][_0x8fc2('0x34')]);}var _0x2606cd=[];_0x2606cd['push'](_0x57936c[_0x8fc2('0x86')]());BPromise[_0x8fc2('0x68')](_0x2606cd,handleQuery)['then'](function(_0x598e3e){handleQuery(_0x57936c['toString']());var _0x145596=csv_results[0x0];if(!_[_0x8fc2('0x87')](_0x145596)){var _0x57dfae=toCsv(_0x145596);var _0x32a7cb=Date[_0x8fc2('0x88')]();fs['writeFileSync'](util[_0x8fc2('0x89')](_0x8fc2('0x8a'),_0x7c7462,_0x32a7cb),_0x57dfae);_0x2230e0['setHeader'](_0x8fc2('0x8b'),_0x8fc2('0x8c')+util[_0x8fc2('0x89')]('list_%d_%s.csv',_0x7c7462,_0x32a7cb));_0x2230e0[_0x8fc2('0x8d')](_0x8fc2('0x8e'),'text/csv');return _0x2230e0[_0x8fc2('0x8f')](util[_0x8fc2('0x89')]('/tmp/list_%d_%s.csv',_0x7c7462,_0x32a7cb));}else{return _0x2230e0['sendStatus'](0xcc);}});});});};exports[_0x8fc2('0x90')]=function(_0x59c16f,_0x3ed4d1,_0x27904e){var _0x402899;delete _0x59c16f['body']['id'];return db['CmList'][_0x8fc2('0x91')]({'where':{'id':_0x59c16f[_0x8fc2('0x50')]['id']}})[_0x8fc2('0x2d')](handleEntityNotFound(_0x3ed4d1,null))[_0x8fc2('0x2d')](function(_0xb2fc6d){if(_0xb2fc6d){return db['sequelize'][_0x8fc2('0x92')](function(_0x11c7e3){return db[_0x8fc2('0x71')][_0x8fc2('0x54')](_0x59c16f[_0x8fc2('0x55')],{'transaction':_0x11c7e3})[_0x8fc2('0x2d')](function(_0x3ec210){_0x402899=_0x3ec210;return _0xb2fc6d[_0x8fc2('0x93')](_0x3ec210,{'transaction':_0x11c7e3});})['then'](function(){var _0xbcfb5a={'type':db[_0x8fc2('0x94')][_0x8fc2('0x95')],'transaction':_0x11c7e3};switch(_0x59c16f[_0x8fc2('0x55')][_0x8fc2('0x49')]){case'text':_0xbcfb5a['type']=db[_0x8fc2('0x94')]['TEXT'];break;case'number':_0xbcfb5a['type']=db[_0x8fc2('0x94')][_0x8fc2('0x96')];break;case'switch':_0xbcfb5a['type']=db['Sequelize'][_0x8fc2('0x97')];_0xbcfb5a[_0x8fc2('0x98')]=![];break;default:}return db['sequelize']['queryInterface'][_0x8fc2('0x99')](_0x8fc2('0x78'),util['format']('cf_%s',_0x402899['id']),_0xbcfb5a);})[_0x8fc2('0x2d')](function(){return _0x402899;});});}})['then'](respondWithResult(_0x3ed4d1,null))['catch'](handleError(_0x3ed4d1,null));};exports[_0x8fc2('0x9a')]=function(_0x533b22,_0x240bcc,_0x4e7360){var _0x155764={};var _0x655db3={};var _0x123c23;var _0x22862d;return db[_0x8fc2('0x38')]['findOne']({'where':{'id':_0x533b22['params']['id']}})[_0x8fc2('0x2d')](handleEntityNotFound(_0x240bcc,null))['then'](function(_0x2974e5){if(_0x2974e5){_0x123c23=_0x2974e5;_0x655db3['model']=_[_0x8fc2('0x3b')](db[_0x8fc2('0x71')][_0x8fc2('0x39')]);_0x655db3[_0x8fc2('0x3c')]=_['keys'](_0x533b22['query']);_0x655db3[_0x8fc2('0x3d')]=_[_0x8fc2('0x3e')](_0x655db3[_0x8fc2('0x3f')],_0x655db3[_0x8fc2('0x3c')]);_0x155764[_0x8fc2('0x40')]=_[_0x8fc2('0x3e')](_0x655db3[_0x8fc2('0x3f')],qs['fields'](_0x533b22[_0x8fc2('0x3c')][_0x8fc2('0x41')]));_0x155764[_0x8fc2('0x40')]=_0x155764['attributes'][_0x8fc2('0x42')]?_0x155764['attributes']:_0x655db3['model'];_0x155764[_0x8fc2('0x5f')]=qs['sort'](_0x533b22[_0x8fc2('0x3c')][_0x8fc2('0x60')]);_0x155764['where']=qs[_0x8fc2('0x3d')](_[_0x8fc2('0x46')](_0x533b22['query'],_0x655db3[_0x8fc2('0x3d')]));_0x155764[_0x8fc2('0x45')]=_['merge'](_0x155764[_0x8fc2('0x45')],{'$or':[{'ListId':_0x2974e5['id']},{'ListId':null}]});if(_0x533b22['query'][_0x8fc2('0x47')]){_0x155764[_0x8fc2('0x45')]=_['merge'](_0x155764[_0x8fc2('0x45')],{'$or':_[_0x8fc2('0x37')](_0x155764[_0x8fc2('0x40')],function(_0x4462f6){var _0x5e4e31={};_0x5e4e31[_0x4462f6]={'$like':'%'+_0x533b22[_0x8fc2('0x3c')][_0x8fc2('0x47')]+'%'};return _0x5e4e31;})});}_0x155764=_['merge']({},_0x155764,_0x533b22['options']);return db[_0x8fc2('0x71')]['findAndCountAll'](_0x155764);}})['then'](respondWithResult(_0x240bcc,null))['catch'](handleError(_0x240bcc,null));};exports[_0x8fc2('0x9b')]=function(_0x417c30,_0x3ad767){return db[_0x8fc2('0x71')][_0x8fc2('0x9c')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x3ad767,null))[_0x8fc2('0x2d')](function(_0x361cc4){return _0x361cc4;})[_0x8fc2('0x2d')](respondWithResult(_0x3ad767,null))['catch'](handleError(_0x3ad767,null));};exports[_0x8fc2('0x9d')]=function(_0x37c089,_0x4e6097,_0x522a1a){return db[_0x8fc2('0x38')]['find']({'where':{'id':_0x37c089[_0x8fc2('0x50')]['id']}})[_0x8fc2('0x2d')](handleEntityNotFound(_0x4e6097,null))[_0x8fc2('0x2d')](function(_0x3d44c8){if(_0x3d44c8){return _0x3d44c8[_0x8fc2('0x9d')](_0x37c089[_0x8fc2('0x55')][_0x8fc2('0x62')],_[_0x8fc2('0x69')](_0x37c089[_0x8fc2('0x55')],[_0x8fc2('0x62'),'id'])||{})[_0x8fc2('0x9e')](function(_0x18d8d8){for(var _0x21b377=0x0;_0x21b377<_0x37c089[_0x8fc2('0x55')][_0x8fc2('0x62')]['length'];_0x21b377+=0x1){socket[_0x8fc2('0x9f')](_0x8fc2('0xa0'),{'UserId':Number(_0x37c089[_0x8fc2('0x55')][_0x8fc2('0x62')][_0x21b377]),'CmListId':Number(_0x37c089[_0x8fc2('0x50')]['id'])});}return _0x18d8d8;});}})[_0x8fc2('0x2d')](respondWithResult(_0x4e6097,null))[_0x8fc2('0x4e')](handleError(_0x4e6097,null));};exports[_0x8fc2('0xa1')]=function(_0x169613,_0x19a637,_0x35f20c){return db[_0x8fc2('0x38')][_0x8fc2('0x53')]({'where':{'id':_0x169613[_0x8fc2('0x50')]['id']}})['then'](handleEntityNotFound(_0x19a637,null))[_0x8fc2('0x2d')](function(_0x565670){if(_0x565670){return _0x565670[_0x8fc2('0xa1')](_0x169613['query'][_0x8fc2('0x62')])[_0x8fc2('0x2d')](function(){if(_[_0x8fc2('0x66')](_0x169613[_0x8fc2('0x3c')][_0x8fc2('0x62')])){for(var _0x40da83=0x0;_0x40da83<_0x169613[_0x8fc2('0x3c')][_0x8fc2('0x62')]['length'];_0x40da83+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x169613[_0x8fc2('0x3c')]['ids'][_0x40da83]),'CmListId':Number(_0x169613[_0x8fc2('0x50')]['id'])});}}else{socket[_0x8fc2('0x9f')](_0x8fc2('0xa2'),{'UserId':Number(_0x169613[_0x8fc2('0x3c')][_0x8fc2('0x62')]),'CmListId':Number(_0x169613['params']['id'])});}});}})['then'](respondWithStatusCode(_0x19a637,null))[_0x8fc2('0x4e')](handleError(_0x19a637,null));};exports[_0x8fc2('0xa3')]=function(_0x3a525b,_0x3d2f9c,_0x2caa37){var _0x3748e6={};var _0x30b6c8={};var _0x217948;var _0xd07e2d;return db[_0x8fc2('0x38')][_0x8fc2('0x91')]({'where':{'id':_0x3a525b[_0x8fc2('0x50')]['id']}})[_0x8fc2('0x2d')](handleEntityNotFound(_0x3d2f9c,null))[_0x8fc2('0x2d')](function(_0x22f20e){if(_0x22f20e){_0x217948=_0x22f20e;_0x30b6c8[_0x8fc2('0x3f')]=_[_0x8fc2('0x3b')](db[_0x8fc2('0xa4')][_0x8fc2('0x39')]);_0x30b6c8[_0x8fc2('0x3c')]=_[_0x8fc2('0x3b')](_0x3a525b[_0x8fc2('0x3c')]);_0x30b6c8[_0x8fc2('0x3d')]=_[_0x8fc2('0x3e')](_0x30b6c8['model'],_0x30b6c8['query']);_0x3748e6[_0x8fc2('0x40')]=_[_0x8fc2('0x3e')](_0x30b6c8[_0x8fc2('0x3f')],qs[_0x8fc2('0x41')](_0x3a525b[_0x8fc2('0x3c')]['fields']));_0x3748e6[_0x8fc2('0x40')]=_0x3748e6[_0x8fc2('0x40')][_0x8fc2('0x42')]?_0x3748e6[_0x8fc2('0x40')]:_0x30b6c8[_0x8fc2('0x3f')];_0x3748e6['order']=qs[_0x8fc2('0x60')](_0x3a525b['query'][_0x8fc2('0x60')]);_0x3748e6[_0x8fc2('0x45')]=qs[_0x8fc2('0x3d')](_[_0x8fc2('0x46')](_0x3a525b['query'],_0x30b6c8[_0x8fc2('0x3d')]));if(_0x3a525b['query'][_0x8fc2('0x47')]){_0x3748e6['where']=_[_0x8fc2('0x48')](_0x3748e6[_0x8fc2('0x45')],{'$or':_[_0x8fc2('0x37')](_0x3748e6[_0x8fc2('0x40')],function(_0x1522ce){var _0x4b97e2={};_0x4b97e2[_0x1522ce]={'$like':'%'+_0x3a525b[_0x8fc2('0x3c')][_0x8fc2('0x47')]+'%'};return _0x4b97e2;})});}_0x3748e6=_['merge']({},_0x3748e6,_0x3a525b[_0x8fc2('0x52')]);return _0x217948['getAgents'](_0x3748e6);}})[_0x8fc2('0x2d')](function(_0x392c99){if(_0x392c99){_0xd07e2d=_0x392c99[_0x8fc2('0x42')];if(!_0x3a525b[_0x8fc2('0x3c')][_0x8fc2('0x43')](_0x8fc2('0x44'))){_0x3748e6[_0x8fc2('0x24')]=qs[_0x8fc2('0x24')](_0x3a525b['query'][_0x8fc2('0x24')]);_0x3748e6[_0x8fc2('0x26')]=qs['offset'](_0x3a525b[_0x8fc2('0x3c')][_0x8fc2('0x26')]);}return _0x217948[_0x8fc2('0xa3')](_0x3748e6);}})[_0x8fc2('0x2d')](function(_0x179765){if(_0x179765){return _0x179765?{'count':_0xd07e2d,'rows':_0x179765}:null;}})[_0x8fc2('0x2d')](respondWithResult(_0x3d2f9c,null))[_0x8fc2('0x4e')](handleError(_0x3d2f9c,null));};function handleQuery(_0x19a8ee){logger[_0x8fc2('0xa5')](_0x19a8ee);return db[_0x8fc2('0xa6')][_0x8fc2('0x3c')](_0x19a8ee)[_0x8fc2('0x9e')](function(_0x7849f1){csv_results['push'](_0x7849f1);})[_0x8fc2('0x4e')](function(_0x1fffe6){logger['error'](_0x1fffe6[_0x8fc2('0x6e')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 80b7384..6f5929d 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4cdcdc,_0x34eac7){var _0x4704ce=function(_0x1de4ed){while(--_0x1de4ed){_0x4cdcdc['push'](_0x4cdcdc['shift']());}};_0x4704ce(++_0x34eac7);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x321253,_0x549d73){_0x321253=_0x321253-0x0;var _0x24f0dd=_0xe14b[_0x321253];return _0x24f0dd;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ed0e199..5407c93 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5a5977,_0x446104){var _0x161297=function(_0x5084be){while(--_0x5084be){_0x5a5977['push'](_0x5a5977['shift']());}};_0x161297(++_0x446104);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4eb=['./cmList.attributes','exports','define','cm_lists','lodash','bluebird','rimraf','../../config/environment'];(function(_0xc0bf56,_0x476134){var _0x43ff64=function(_0x173815){while(--_0x173815){_0xc0bf56['push'](_0xc0bf56['shift']());}};_0x43ff64(++_0x476134);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1211e7,_0x23db94){_0x1211e7=_0x1211e7-0x0;var _0x40e86b=_0xf4eb[_0x1211e7];return _0x40e86b;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('CmList',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 5b518a2..b596063 100644 --- a/server/api/cmList/cmList.rpc.js +++ b/server/api/cmList/cmList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8366=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x8366,0x14c));var _0x6836=function(_0x5744f5,_0x379191){_0x5744f5=_0x5744f5-0x0;var _0x44f320=_0x8366[_0x5744f5];return _0x44f320;};'use strict';var _=require(_0x6836('0x0'));var util=require(_0x6836('0x1'));var moment=require(_0x6836('0x2'));var BPromise=require(_0x6836('0x3'));var rs=require(_0x6836('0x4'));var fs=require('fs');var Redis=require(_0x6836('0x5'));var db=require(_0x6836('0x6'))['db'];var utils=require(_0x6836('0x7'));var logger=require(_0x6836('0x8'))(_0x6836('0x9'));var config=require(_0x6836('0xa'));var jayson=require(_0x6836('0xb'));var client=jayson[_0x6836('0xc')][_0x6836('0xd')]({'port':0x232a});config[_0x6836('0xe')]=_[_0x6836('0xf')](config[_0x6836('0xe')],{'host':_0x6836('0x10'),'port':0x18eb});var socket=require(_0x6836('0x11'))(new Redis(config[_0x6836('0xe')]));require(_0x6836('0x12'))[_0x6836('0x13')](socket);function respondWithRpcPromise(_0x3729d9,_0x5665fa,_0x428113){return new BPromise(function(_0x5a772d,_0x4ef2ef){return client['request'](_0x3729d9,_0x428113)[_0x6836('0x14')](function(_0x38bb71){logger['info']('CmList,\x20%s,\x20%s',_0x5665fa,_0x6836('0x15'));logger[_0x6836('0x16')](_0x6836('0x17'),_0x5665fa,_0x6836('0x15'),JSON[_0x6836('0x18')](_0x38bb71));if(_0x38bb71[_0x6836('0x19')]){if(_0x38bb71[_0x6836('0x19')]['code']===0x1f4){logger[_0x6836('0x19')](_0x6836('0x1a'),_0x5665fa,_0x38bb71[_0x6836('0x19')][_0x6836('0x1b')]);return _0x4ef2ef(_0x38bb71[_0x6836('0x19')]['message']);}logger[_0x6836('0x19')](_0x6836('0x1a'),_0x5665fa,_0x38bb71[_0x6836('0x19')][_0x6836('0x1b')]);return _0x5a772d(_0x38bb71['error'][_0x6836('0x1b')]);}else{logger[_0x6836('0x1c')](_0x6836('0x1a'),_0x5665fa,'request\x20sent');_0x5a772d(_0x38bb71[_0x6836('0x1d')][_0x6836('0x1b')]);}})[_0x6836('0x1e')](function(_0x5b989b){logger[_0x6836('0x19')]('CmList,\x20%s,\x20%s',_0x5665fa,_0x5b989b);_0x4ef2ef(_0x5b989b);});});} \ No newline at end of file +var _0xc5f7=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','redis','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0xc5f7,0x144));var _0x7c5f=function(_0x3a2b2e,_0x37d8b2){_0x3a2b2e=_0x3a2b2e-0x0;var _0x1b3c3e=_0xc5f7[_0x3a2b2e];return _0x1b3c3e;};'use strict';var _=require(_0x7c5f('0x0'));var util=require(_0x7c5f('0x1'));var moment=require(_0x7c5f('0x2'));var BPromise=require(_0x7c5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c5f('0x4'))['db'];var utils=require(_0x7c5f('0x5'));var logger=require(_0x7c5f('0x6'))('rpc');var config=require(_0x7c5f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7c5f('0x8')][_0x7c5f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7c5f('0xa'),'port':0x18eb});var socket=require(_0x7c5f('0xb'))(new Redis(config[_0x7c5f('0xc')]));require(_0x7c5f('0xd'))[_0x7c5f('0xe')](socket);function respondWithRpcPromise(_0x2694b,_0x5df279,_0xe6a338){return new BPromise(function(_0x42ec94,_0x4c5e13){return client[_0x7c5f('0xf')](_0x2694b,_0xe6a338)[_0x7c5f('0x10')](function(_0x29f10d){logger[_0x7c5f('0x11')](_0x7c5f('0x12'),_0x5df279,_0x7c5f('0x13'));logger['debug'](_0x7c5f('0x14'),_0x5df279,_0x7c5f('0x13'),JSON[_0x7c5f('0x15')](_0x29f10d));if(_0x29f10d[_0x7c5f('0x16')]){if(_0x29f10d[_0x7c5f('0x16')][_0x7c5f('0x17')]===0x1f4){logger[_0x7c5f('0x16')]('CmList,\x20%s,\x20%s',_0x5df279,_0x29f10d[_0x7c5f('0x16')]['message']);return _0x4c5e13(_0x29f10d['error'][_0x7c5f('0x18')]);}logger[_0x7c5f('0x16')]('CmList,\x20%s,\x20%s',_0x5df279,_0x29f10d['error']['message']);return _0x42ec94(_0x29f10d[_0x7c5f('0x16')][_0x7c5f('0x18')]);}else{logger[_0x7c5f('0x11')](_0x7c5f('0x12'),_0x5df279,'request\x20sent');_0x42ec94(_0x29f10d[_0x7c5f('0x19')][_0x7c5f('0x18')]);}})[_0x7c5f('0x1a')](function(_0x5b864){logger['error']('CmList,\x20%s,\x20%s',_0x5df279,_0x5b864);_0x4c5e13(_0x5b864);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5137e25..8bd5825 100644 --- a/server/api/cmList/cmList.socket.js +++ b/server/api/cmList/cmList.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cda=['save','remove','update','removeListener','register','./cmList.events'];(function(_0x5da7a9,_0x1bd281){var _0xcfca3f=function(_0xbf6b3d){while(--_0xbf6b3d){_0x5da7a9['push'](_0x5da7a9['shift']());}};_0xcfca3f(++_0x1bd281);}(_0x4cda,0x125));var _0xa4cd=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x4cda[_0x45fc6a];return _0x14bcfd;};'use strict';var CmListEvents=require(_0xa4cd('0x0'));var events=[_0xa4cd('0x1'),_0xa4cd('0x2'),_0xa4cd('0x3')];function createListener(_0xbe7f07,_0x4719d6){return function(_0x442512){_0x4719d6['emit'](_0xbe7f07,_0x442512);};}function removeListener(_0xa8ab16,_0x25712d){return function(){CmListEvents[_0xa4cd('0x4')](_0xa8ab16,_0x25712d);};}exports[_0xa4cd('0x5')]=function(_0x264746){for(var _0x293432=0x0,_0x3b1b1a=events['length'];_0x293432<_0x3b1b1a;_0x293432++){var _0x2e1a0e=events[_0x293432];var _0x241fa7=createListener('cmList:'+_0x2e1a0e,_0x264746);CmListEvents['on'](_0x2e1a0e,_0x241fa7);}}; \ No newline at end of file +var _0x284c=['save','update','emit','register','length','cmList:'];(function(_0x67f8c3,_0x594442){var _0x48ea0f=function(_0x2592bd){while(--_0x2592bd){_0x67f8c3['push'](_0x67f8c3['shift']());}};_0x48ea0f(++_0x594442);}(_0x284c,0xcc));var _0xc284=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x284c[_0x501510];return _0x1e6ee5;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xc284('0x0'),'remove',_0xc284('0x1')];function createListener(_0x4672a5,_0x3bd22a){return function(_0x121390){_0x3bd22a[_0xc284('0x2')](_0x4672a5,_0x121390);};}function removeListener(_0x1397db,_0x437a76){return function(){CmListEvents['removeListener'](_0x1397db,_0x437a76);};}exports[_0xc284('0x3')]=function(_0x126eb0){for(var _0x447f4c=0x0,_0x26087c=events[_0xc284('0x4')];_0x447f4c<_0x26087c;_0x447f4c++){var _0x58364c=events[_0x447f4c];var _0x3a6c94=createListener(_0xc284('0x5')+_0x58364c,_0x126eb0);CmListEvents['on'](_0x58364c,_0x3a6c94);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 0b56793..293a79c 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x928a=['getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post','addDisposition','addContacts','addCustomField','put','update','delete','removeDispositions','removeAgents','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','/describe','describe','get','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions'];(function(_0x585478,_0x45a6ef){var _0x3b1ea9=function(_0x4bf348){while(--_0x4bf348){_0x585478['push'](_0x585478['shift']());}};_0x3b1ea9(++_0x45a6ef);}(_0x928a,0x19b));var _0xa928=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x928a[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require(_0xa928('0x0'));var path=require(_0xa928('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa928('0x2')]();var fs_extra=require(_0xa928('0x3'));var auth=require(_0xa928('0x4'));var interaction=require(_0xa928('0x5'));var config=require(_0xa928('0x6'));var controller=require(_0xa928('0x7'));router['get']('/',auth[_0xa928('0x8')](),controller[_0xa928('0x9')]);router['get'](_0xa928('0xa'),auth[_0xa928('0x8')](),controller[_0xa928('0xb')]);router[_0xa928('0xc')](_0xa928('0xd'),auth[_0xa928('0x8')](),controller[_0xa928('0xe')]);router[_0xa928('0xc')](_0xa928('0xf'),auth[_0xa928('0x8')](),controller[_0xa928('0x10')]);router[_0xa928('0xc')](_0xa928('0x11'),auth[_0xa928('0x8')](),controller[_0xa928('0x12')]);router[_0xa928('0xc')]('/:id/contacts',auth[_0xa928('0x8')](),controller[_0xa928('0x13')]);router[_0xa928('0xc')](_0xa928('0x14'),auth['isAuthenticated'](),controller[_0xa928('0x15')]);router[_0xa928('0xc')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa928('0x16')]);router[_0xa928('0xc')](_0xa928('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa928('0x18')]('/',auth[_0xa928('0x8')](),controller['create']);router[_0xa928('0x18')](_0xa928('0x11'),auth[_0xa928('0x8')](),controller[_0xa928('0x19')]);router[_0xa928('0x18')]('/:id/contacts',auth[_0xa928('0x8')](),controller[_0xa928('0x1a')]);router[_0xa928('0x18')]('/:id/fields',auth[_0xa928('0x8')](),controller[_0xa928('0x1b')]);router['post'](_0xa928('0x17'),auth[_0xa928('0x8')](),controller['addAgents']);router[_0xa928('0x1c')](_0xa928('0xf'),auth['isAuthenticated'](),controller[_0xa928('0x1d')]);router['delete']('/:id',auth[_0xa928('0x8')](),controller['destroy']);router[_0xa928('0x1e')](_0xa928('0x11'),auth[_0xa928('0x8')](),controller[_0xa928('0x1f')]);router[_0xa928('0x1e')](_0xa928('0x17'),auth[_0xa928('0x8')](),controller[_0xa928('0x20')]);module['exports']=router; \ No newline at end of file +var _0x1542=['getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post','addDisposition','/:id/contacts','addContacts','/:id/fields','addCustomField','addAgents','/:id','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions'];(function(_0x20e2b7,_0x3aded3){var _0x2c5ac2=function(_0x4b6c04){while(--_0x4b6c04){_0x20e2b7['push'](_0x20e2b7['shift']());}};_0x2c5ac2(++_0x3aded3);}(_0x1542,0x116));var _0x2154=function(_0x4e3dfa,_0x15e492){_0x4e3dfa=_0x4e3dfa-0x0;var _0x57fae3=_0x1542[_0x4e3dfa];return _0x57fae3;};'use strict';var multer=require(_0x2154('0x0'));var util=require(_0x2154('0x1'));var path=require(_0x2154('0x2'));var timeout=require(_0x2154('0x3'));var express=require(_0x2154('0x4'));var router=express['Router']();var fs_extra=require(_0x2154('0x5'));var auth=require(_0x2154('0x6'));var interaction=require(_0x2154('0x7'));var config=require('../../config/environment');var controller=require(_0x2154('0x8'));router[_0x2154('0x9')]('/',auth['isAuthenticated'](),controller[_0x2154('0xa')]);router[_0x2154('0x9')](_0x2154('0xb'),auth[_0x2154('0xc')](),controller[_0x2154('0xd')]);router[_0x2154('0x9')](_0x2154('0xe'),auth[_0x2154('0xc')](),controller[_0x2154('0xf')]);router[_0x2154('0x9')]('/:id',auth[_0x2154('0xc')](),controller[_0x2154('0x10')]);router[_0x2154('0x9')](_0x2154('0x11'),auth['isAuthenticated'](),controller[_0x2154('0x12')]);router[_0x2154('0x9')]('/:id/contacts',auth[_0x2154('0xc')](),controller[_0x2154('0x13')]);router[_0x2154('0x9')](_0x2154('0x14'),auth[_0x2154('0xc')](),controller[_0x2154('0x15')]);router[_0x2154('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2154('0x16')]);router['get'](_0x2154('0x17'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x2154('0xc')](),controller['create']);router[_0x2154('0x18')]('/:id/dispositions',auth[_0x2154('0xc')](),controller[_0x2154('0x19')]);router[_0x2154('0x18')](_0x2154('0x1a'),auth[_0x2154('0xc')](),controller[_0x2154('0x1b')]);router[_0x2154('0x18')](_0x2154('0x1c'),auth[_0x2154('0xc')](),controller[_0x2154('0x1d')]);router['post'](_0x2154('0x17'),auth[_0x2154('0xc')](),controller[_0x2154('0x1e')]);router['put'](_0x2154('0x1f'),auth[_0x2154('0xc')](),controller[_0x2154('0x20')]);router[_0x2154('0x21')]('/:id',auth[_0x2154('0xc')](),controller[_0x2154('0x22')]);router[_0x2154('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2154('0x23')]);router[_0x2154('0x21')](_0x2154('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x2154('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c8843c2..1c0f1a2 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe82f=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xe82f,0x1d6));var _0xfe82=function(_0x7d6f8,_0x419db4){_0x7d6f8=_0x7d6f8-0x0;var _0x37866f=_0xe82f[_0x7d6f8];return _0x37866f;};'use strict';var Sequelize=require(_0xfe82('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe82('0x1')],'get':function(_0x545882){return this[_0xfe82('0x2')](_0xfe82('0x3'));}},'field':{'type':Sequelize[_0xfe82('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xfe82('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xd2f6=['VIRTUAL','field','STRING','sequelize','exports'];(function(_0x12de26,_0xf1b1af){var _0x51680f=function(_0x2c2041){while(--_0x2c2041){_0x12de26['push'](_0x12de26['shift']());}};_0x51680f(++_0xf1b1af);}(_0xd2f6,0x193));var _0x6d2f=function(_0x47f841,_0x5aa0df){_0x47f841=_0x47f841-0x0;var _0x46bff2=_0xd2f6[_0x47f841];return _0x46bff2;};'use strict';var Sequelize=require(_0x6d2f('0x0'));module[_0x6d2f('0x1')]={'name':{'type':Sequelize[_0x6d2f('0x2')],'get':function(_0xeb95cd){return this['getDataValue'](_0x6d2f('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x6d2f('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x6d2f('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 95c6692..43b48fc 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['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','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xc4414f,_0x46ceee){var _0x423360=function(_0x3c6d9e){while(--_0x3c6d9e){_0xc4414f['push'](_0xc4414f['shift']());}};_0x423360(++_0x46ceee);}(_0x7a54,0x106));var _0x47a5=function(_0x433e14,_0x2a7088){_0x433e14=_0x433e14-0x0;var _0x5c519a=_0x7a54[_0x433e14];return _0x5c519a;};'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('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['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','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4730ed,_0xb09a0c){var _0x389bf1=function(_0x52946c){while(--_0x52946c){_0x4730ed['push'](_0x4730ed['shift']());}};_0x389bf1(++_0xb09a0c);}(_0x7a54,0x106));var _0x47a5=function(_0x215166,_0xfd34d8){_0x215166=_0x215166-0x0;var _0x3330ba=_0x7a54[_0x215166];return _0x3330ba;};'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('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 67c9632..aab2c66 100644 --- a/server/api/condition/condition.model.js +++ b/server/api/condition/condition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9c2=['../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x196867,_0x1ce377){var _0x1b4de7=function(_0x1ce2f5){while(--_0x1ce2f5){_0x196867['push'](_0x196867['shift']());}};_0x1b4de7(++_0x1ce377);}(_0xc9c2,0x1d4));var _0x2c9c=function(_0xea9cf,_0x454f5e){_0xea9cf=_0xea9cf-0x0;var _0x2a98f7=_0xc9c2[_0xea9cf];return _0x2a98f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2c9c('0x0'))('api');var moment=require(_0x2c9c('0x1'));var BPromise=require(_0x2c9c('0x2'));var rp=require(_0x2c9c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c9c('0x4'));var config=require(_0x2c9c('0x5'));var attributes=require(_0x2c9c('0x6'));module[_0x2c9c('0x7')]=function(_0x20b22a,_0x172405){return _0x20b22a[_0x2c9c('0x8')](_0x2c9c('0x9'),attributes,{'tableName':_0x2c9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf48=['request-promise','path','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','util','api','moment','bluebird'];(function(_0x599f33,_0x2cdba0){var _0x1b5735=function(_0x18b4d0){while(--_0x18b4d0){_0x599f33['push'](_0x599f33['shift']());}};_0x1b5735(++_0x2cdba0);}(_0xcf48,0x14b));var _0x8cf4=function(_0x139272,_0x5512fc){_0x139272=_0x139272-0x0;var _0x31a11a=_0xcf48[_0x139272];return _0x31a11a;};'use strict';var _=require(_0x8cf4('0x0'));var util=require(_0x8cf4('0x1'));var logger=require('../../config/logger')(_0x8cf4('0x2'));var moment=require(_0x8cf4('0x3'));var BPromise=require(_0x8cf4('0x4'));var rp=require(_0x8cf4('0x5'));var fs=require('fs');var path=require(_0x8cf4('0x6'));var rimraf=require('rimraf');var config=require(_0x8cf4('0x7'));var attributes=require(_0x8cf4('0x8'));module[_0x8cf4('0x9')]=function(_0x4c313a,_0xdf5bbc){return _0x4c313a['define'](_0x8cf4('0xa'),attributes,{'tableName':_0x8cf4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index e2ea8bd..dcf1ac1 100644 --- a/server/api/condition/condition.rpc.js +++ b/server/api/condition/condition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadf7=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x2cebf1,_0x1cee4e){var _0x572ac4=function(_0x281c4c){while(--_0x281c4c){_0x2cebf1['push'](_0x2cebf1['shift']());}};_0x572ac4(++_0x1cee4e);}(_0xadf7,0x194));var _0x7adf=function(_0x193c2c,_0x2f780b){_0x193c2c=_0x193c2c-0x0;var _0xab4474=_0xadf7[_0x193c2c];return _0xab4474;};'use strict';var _=require(_0x7adf('0x0'));var util=require(_0x7adf('0x1'));var moment=require(_0x7adf('0x2'));var BPromise=require('bluebird');var rs=require(_0x7adf('0x3'));var fs=require('fs');var Redis=require(_0x7adf('0x4'));var db=require(_0x7adf('0x5'))['db'];var utils=require(_0x7adf('0x6'));var logger=require(_0x7adf('0x7'))(_0x7adf('0x8'));var config=require(_0x7adf('0x9'));var jayson=require(_0x7adf('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x93f861,_0x5ef386,_0x502fb9){return new BPromise(function(_0x11e311,_0xf587c3){return client[_0x7adf('0xb')](_0x93f861,_0x502fb9)['then'](function(_0x53fdb5){logger['info'](_0x7adf('0xc'),_0x5ef386,_0x7adf('0xd'));logger[_0x7adf('0xe')](_0x7adf('0xf'),_0x5ef386,'request\x20sent',JSON[_0x7adf('0x10')](_0x53fdb5));if(_0x53fdb5[_0x7adf('0x11')]){if(_0x53fdb5[_0x7adf('0x11')]['code']===0x1f4){logger['error'](_0x7adf('0xc'),_0x5ef386,_0x53fdb5[_0x7adf('0x11')][_0x7adf('0x12')]);return _0xf587c3(_0x53fdb5[_0x7adf('0x11')][_0x7adf('0x12')]);}logger[_0x7adf('0x11')](_0x7adf('0xc'),_0x5ef386,_0x53fdb5['error']['message']);return _0x11e311(_0x53fdb5[_0x7adf('0x11')][_0x7adf('0x12')]);}else{logger[_0x7adf('0x13')]('Condition,\x20%s,\x20%s',_0x5ef386,_0x7adf('0xd'));_0x11e311(_0x53fdb5[_0x7adf('0x14')][_0x7adf('0x12')]);}})[_0x7adf('0x15')](function(_0x55c1b2){logger[_0x7adf('0x11')](_0x7adf('0xc'),_0x5ef386,_0x55c1b2);_0xf587c3(_0x55c1b2);});});} \ No newline at end of file +var _0x57a2=['catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3d8cb6,_0x5a427d){var _0x5d0869=function(_0x469e90){while(--_0x469e90){_0x3d8cb6['push'](_0x3d8cb6['shift']());}};_0x5d0869(++_0x5a427d);}(_0x57a2,0xb1));var _0x257a=function(_0x2b33a6,_0x32ef5b){_0x2b33a6=_0x2b33a6-0x0;var _0x339618=_0x57a2[_0x2b33a6];return _0x339618;};'use strict';var _=require(_0x257a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x257a('0x1'));var rs=require(_0x257a('0x2'));var fs=require('fs');var Redis=require(_0x257a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x257a('0x4'));var logger=require(_0x257a('0x5'))('rpc');var config=require(_0x257a('0x6'));var jayson=require(_0x257a('0x7'));var client=jayson[_0x257a('0x8')][_0x257a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6e37b7,_0x3c5784,_0x44f065){return new BPromise(function(_0x36d45f,_0x1e8c0f){return client[_0x257a('0xa')](_0x6e37b7,_0x44f065)[_0x257a('0xb')](function(_0x38f6eb){logger[_0x257a('0xc')](_0x257a('0xd'),_0x3c5784,_0x257a('0xe'));logger[_0x257a('0xf')](_0x257a('0x10'),_0x3c5784,_0x257a('0xe'),JSON[_0x257a('0x11')](_0x38f6eb));if(_0x38f6eb['error']){if(_0x38f6eb[_0x257a('0x12')][_0x257a('0x13')]===0x1f4){logger[_0x257a('0x12')](_0x257a('0xd'),_0x3c5784,_0x38f6eb[_0x257a('0x12')]['message']);return _0x1e8c0f(_0x38f6eb[_0x257a('0x12')][_0x257a('0x14')]);}logger[_0x257a('0x12')](_0x257a('0xd'),_0x3c5784,_0x38f6eb[_0x257a('0x12')][_0x257a('0x14')]);return _0x36d45f(_0x38f6eb[_0x257a('0x12')]['message']);}else{logger[_0x257a('0xc')](_0x257a('0xd'),_0x3c5784,'request\x20sent');_0x36d45f(_0x38f6eb['result'][_0x257a('0x14')]);}})[_0x257a('0x15')](function(_0x5c74b6){logger[_0x257a('0x12')](_0x257a('0xd'),_0x3c5784,_0x5c74b6);_0x1e8c0f(_0x5c74b6);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index aa17b5a..77a080e 100644 --- a/server/api/condition/index.js +++ b/server/api/condition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cde=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','/:id','isAuthenticated'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x0cde,0x1df));var _0xe0cd=function(_0x243132,_0x53d50f){_0x243132=_0x243132-0x0;var _0x7c3dfe=_0x0cde[_0x243132];return _0x7c3dfe;};'use strict';var multer=require(_0xe0cd('0x0'));var util=require(_0xe0cd('0x1'));var path=require(_0xe0cd('0x2'));var timeout=require(_0xe0cd('0x3'));var express=require(_0xe0cd('0x4'));var router=express[_0xe0cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe0cd('0x6'));var interaction=require(_0xe0cd('0x7'));var config=require('../../config/environment');var controller=require(_0xe0cd('0x8'));router['put'](_0xe0cd('0x9'),auth[_0xe0cd('0xa')](),controller['update']);router[_0xe0cd('0xb')]('/:id',auth[_0xe0cd('0xa')](),controller[_0xe0cd('0xc')]);module[_0xe0cd('0xd')]=router; \ No newline at end of file +var _0x409c=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','destroy','multer','util','path','connect-timeout','Router'];(function(_0x1ee6c1,_0x67ee12){var _0x4eae96=function(_0x270495){while(--_0x270495){_0x1ee6c1['push'](_0x1ee6c1['shift']());}};_0x4eae96(++_0x67ee12);}(_0x409c,0x8b));var _0xc409=function(_0x495ebf,_0x1119cc){_0x495ebf=_0x495ebf-0x0;var _0x3bf4ee=_0x409c[_0x495ebf];return _0x3bf4ee;};'use strict';var multer=require(_0xc409('0x0'));var util=require(_0xc409('0x1'));var path=require(_0xc409('0x2'));var timeout=require(_0xc409('0x3'));var express=require('express');var router=express[_0xc409('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc409('0x5'));var config=require(_0xc409('0x6'));var controller=require(_0xc409('0x7'));router[_0xc409('0x8')](_0xc409('0x9'),auth[_0xc409('0xa')](),controller['update']);router['delete'](_0xc409('0x9'),auth[_0xc409('0xa')](),controller[_0xc409('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index f63c650..c5dfa7a 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x208f=['exports','STRING','INTEGER','sequelize'];(function(_0x89d79e,_0x3b5ddf){var _0x1a01c7=function(_0xdca183){while(--_0xdca183){_0x89d79e['push'](_0x89d79e['shift']());}};_0x1a01c7(++_0x3b5ddf);}(_0x208f,0x167));var _0xf208=function(_0x1249de,_0x14d56c){_0x1249de=_0x1249de-0x0;var _0x15a570=_0x208f[_0x1249de];return _0x15a570;};'use strict';var Sequelize=require(_0xf208('0x0'));module[_0xf208('0x1')]={'name':{'type':Sequelize[_0xf208('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xf208('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x824b=['INTEGER','sequelize','exports','STRING'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x824b,0xcd));var _0xb824=function(_0x4cecf2,_0x16ec20){_0x4cecf2=_0x4cecf2-0x0;var _0x548777=_0x824b[_0x4cecf2];return _0x548777;};'use strict';var Sequelize=require(_0xb824('0x0'));module[_0xb824('0x1')]={'name':{'type':Sequelize[_0xb824('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xb824('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xb824('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 9becee5..2e89af6 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['limit','count','set','Content-Range','apply','save','then','destroy','get','ContactItemTypes','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined'];(function(_0x5c4783,_0x317d6b){var _0x12fc03=function(_0x2cd138){while(--_0x2cd138){_0x5c4783['push'](_0x5c4783['shift']());}};_0x12fc03(++_0x317d6b);}(_0x2032,0xd9));var _0x2203=function(_0x5c38a5,_0x576798){_0x5c38a5=_0x5c38a5-0x0;var _0x5d8fcf=_0x2032[_0x5c38a5];return _0x5d8fcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){var _0x1244f4=_0x2718f5[_0x2203('0x25')]({'plain':!![]});var _0x49c12=_0x2203('0x26');return db['UserProfileResource'][_0x2203('0x24')]({'where':{'type':_0x49c12,'resourceId':_0x1244f4['id']}})[_0x2203('0x23')](function(){return _0x2718f5;});})[_0x2203('0x23')](function(){_0x5c8da9['status'](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x1cec17,_0x5c5fd3){return function(_0xd6e109){if(!_0xd6e109){_0x1cec17[_0x2203('0x27')](0x194);}return _0xd6e109;};}function handleError(_0x1c6a77,_0x46b8b9){_0x46b8b9=_0x46b8b9||0x1f4;return function(_0x28ae02){logger[_0x2203('0x28')](_0x28ae02[_0x2203('0x29')]);if(_0x28ae02['name']){delete _0x28ae02[_0x2203('0x2a')];}_0x1c6a77[_0x2203('0x19')](_0x46b8b9)[_0x2203('0x2b')](_0x28ae02);};}exports[_0x2203('0x2c')]=function(_0x52a426,_0x3a8e23){var _0x21ff0d={},_0x287c95={},_0xf59954={'count':0x0,'rows':[]};var _0x520602=_[_0x2203('0x2d')](db[_0x2203('0x2e')]['rawAttributes'],function(_0x5c0157){return{'name':_0x5c0157[_0x2203('0x2f')],'type':_0x5c0157['type']['key']};});_0x287c95[_0x2203('0x30')]=_[_0x2203('0x2d')](_0x520602,_0x2203('0x2a'));_0x287c95[_0x2203('0x31')]=_[_0x2203('0x32')](_0x52a426['query']);_0x287c95[_0x2203('0x33')]=_[_0x2203('0x34')](_0x287c95['model'],_0x287c95[_0x2203('0x31')]);_0x21ff0d[_0x2203('0x35')]=_[_0x2203('0x34')](_0x287c95[_0x2203('0x30')],qs[_0x2203('0x36')](_0x52a426[_0x2203('0x31')][_0x2203('0x36')]));_0x21ff0d[_0x2203('0x35')]=_0x21ff0d[_0x2203('0x35')]['length']?_0x21ff0d[_0x2203('0x35')]:_0x287c95[_0x2203('0x30')];if(!_0x52a426['query']['hasOwnProperty'](_0x2203('0x37'))){_0x21ff0d['limit']=qs[_0x2203('0x1d')](_0x52a426[_0x2203('0x31')][_0x2203('0x1d')]);_0x21ff0d['offset']=qs['offset'](_0x52a426[_0x2203('0x31')]['offset']);}_0x21ff0d[_0x2203('0x38')]=qs['sort'](_0x52a426[_0x2203('0x31')]['sort']);_0x21ff0d[_0x2203('0x39')]=qs[_0x2203('0x33')](_[_0x2203('0x3a')](_0x52a426[_0x2203('0x31')],_0x287c95[_0x2203('0x33')]),_0x520602);if(_0x52a426['query']['filter']){_0x21ff0d['where']=_[_0x2203('0x3b')](_0x21ff0d[_0x2203('0x39')],{'$or':_[_0x2203('0x2d')](_0x520602,function(_0x3b0c7a){if(_0x3b0c7a[_0x2203('0x3c')]!==_0x2203('0x3d')){var _0x1c7e3d={};_0x1c7e3d[_0x3b0c7a['name']]={'$like':'%'+_0x52a426[_0x2203('0x31')][_0x2203('0x3e')]+'%'};return _0x1c7e3d;}})});}_0x21ff0d=_[_0x2203('0x3b')]({},_0x21ff0d,_0x52a426[_0x2203('0x3f')]);var _0x493d12={'where':_0x21ff0d['where']};return db[_0x2203('0x2e')]['count'](_0x493d12)[_0x2203('0x23')](function(_0x446209){_0xf59954[_0x2203('0x1e')]=_0x446209;if(_0x52a426['query']['includeAll']){_0x21ff0d[_0x2203('0x40')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x41')](_0x21ff0d);})[_0x2203('0x23')](function(_0x372709){_0xf59954[_0x2203('0x42')]=_0x372709;return _0xf59954;})['then'](respondWithFilteredResult(_0x3a8e23,_0x21ff0d))[_0x2203('0x43')](handleError(_0x3a8e23,null));};exports[_0x2203('0x44')]=function(_0x3a866c,_0x266076){var _0x16b452={'raw':!![],'where':{'id':_0x3a866c[_0x2203('0x45')]['id']}},_0x36b99f={};_0x36b99f[_0x2203('0x30')]=_[_0x2203('0x32')](db[_0x2203('0x2e')]['rawAttributes']);_0x36b99f[_0x2203('0x31')]=_[_0x2203('0x32')](_0x3a866c[_0x2203('0x31')]);_0x36b99f[_0x2203('0x33')]=_['intersection'](_0x36b99f['model'],_0x36b99f[_0x2203('0x31')]);_0x16b452['attributes']=_[_0x2203('0x34')](_0x36b99f[_0x2203('0x30')],qs[_0x2203('0x36')](_0x3a866c[_0x2203('0x31')]['fields']));_0x16b452[_0x2203('0x35')]=_0x16b452[_0x2203('0x35')]['length']?_0x16b452[_0x2203('0x35')]:_0x36b99f[_0x2203('0x30')];if(_0x3a866c[_0x2203('0x31')][_0x2203('0x46')]){_0x16b452['include']=[{'all':!![]}];}_0x16b452=_['merge']({},_0x16b452,_0x3a866c[_0x2203('0x3f')]);return db['ContactItemType']['find'](_0x16b452)[_0x2203('0x23')](handleEntityNotFound(_0x266076,null))[_0x2203('0x23')](respondWithResult(_0x266076,null))[_0x2203('0x43')](handleError(_0x266076,null));};exports['create']=function(_0x4c1496,_0x131aec){return db[_0x2203('0x2e')][_0x2203('0x47')](_0x4c1496[_0x2203('0x48')],{})[_0x2203('0x23')](function(_0x21fd78){var _0x4a7f4e=_0x4c1496[_0x2203('0x49')]['get']({'plain':!![]});if(!_0x4a7f4e)throw new Error(_0x2203('0x4a'));if(_0x4a7f4e[_0x2203('0x4b')]===_0x2203('0x49')){var _0x1e49dd=_0x21fd78['get']({'plain':!![]});var _0x506795=_0x2203('0x26');return db[_0x2203('0x4c')][_0x2203('0x4d')]({'where':{'name':_0x506795,'userProfileId':_0x4a7f4e[_0x2203('0x4e')]},'raw':!![]})['then'](function(_0x4de47a){if(_0x4de47a&&_0x4de47a['autoAssociation']===0x0){return db[_0x2203('0x4f')][_0x2203('0x47')]({'name':_0x1e49dd['name'],'resourceId':_0x1e49dd['id'],'type':_0x4de47a[_0x2203('0x2a')],'sectionId':_0x4de47a['id']},{})[_0x2203('0x23')](function(){return _0x21fd78;});}else{return _0x21fd78;}})['catch'](function(_0x32b1db){logger[_0x2203('0x28')](_0x2203('0x50'),_0x32b1db);throw _0x32b1db;});}return _0x21fd78;})[_0x2203('0x23')](respondWithResult(_0x131aec,0xc9))['catch'](handleError(_0x131aec,null));};exports[_0x2203('0x51')]=function(_0x5268d6,_0x3858f0){if(_0x5268d6[_0x2203('0x48')]['id']){delete _0x5268d6['body']['id'];}return db[_0x2203('0x2e')][_0x2203('0x4d')]({'where':{'id':_0x5268d6[_0x2203('0x45')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x3858f0,null))[_0x2203('0x23')](saveUpdates(_0x5268d6[_0x2203('0x48')],null))['then'](respondWithResult(_0x3858f0,null))['catch'](handleError(_0x3858f0,null));};exports[_0x2203('0x24')]=function(_0x524356,_0x56e881){return db[_0x2203('0x2e')][_0x2203('0x4d')]({'where':{'id':_0x524356[_0x2203('0x45')]['id']}})['then'](handleEntityNotFound(_0x56e881,null))[_0x2203('0x23')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x524356[_0x2203('0x45')]['id']}}))['then'](removeEntity(_0x56e881,null))['catch'](handleError(_0x56e881,null));}; \ No newline at end of file +var _0xf4f4=['json','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ContactItemType','includeAll','show','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x22960c,_0x352028){var _0x330529=function(_0x1c2e88){while(--_0x1c2e88){_0x22960c['push'](_0x22960c['shift']());}};_0x330529(++_0x352028);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x30d168,_0x4973a8){_0x30d168=_0x30d168-0x0;var _0x12d723=_0xf4f4[_0x30d168];return _0x12d723;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=typeof _0x4c68f4[_0x4f4f('0x1c')]===_0x4f4f('0x1d')&&typeof _0x4c68f4[_0x4f4f('0x1e')]===_0x4f4f('0x1d');var _0x2d5e5d=_0x47ab66[_0x4f4f('0x1f')];var _0x1245c4=_0x58de77?0x0:_0x4c68f4[_0x4f4f('0x1c')];var _0x929a0b=_0x58de77?_0x47ab66[_0x4f4f('0x1f')]:_0x4c68f4[_0x4f4f('0x1c')]+_0x4c68f4[_0x4f4f('0x1e')];var _0x499277;if(_0x929a0b>=_0x2d5e5d){_0x929a0b=_0x2d5e5d;_0x499277=0xc8;}else{_0x499277=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x499277);return _0x19f2fd[_0x4f4f('0x20')](_0x4f4f('0x21'),_0x1245c4+'-'+_0x929a0b+'/'+_0x2d5e5d)[_0x4f4f('0x22')](_0x47ab66);}return null;};}function patchUpdates(_0x302a79){return function(_0x460b4d){try{jsonpatch[_0x4f4f('0x23')](_0x460b4d,_0x302a79,!![]);}catch(_0x3e33d5){return BPromise[_0x4f4f('0x24')](_0x3e33d5);}return _0x460b4d[_0x4f4f('0x25')]();};}function saveUpdates(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x26')](_0x469a1d)['then'](function(_0x4f7261){return _0x4f7261;});}return null;};}function removeEntity(_0x525529,_0x272125){return function(_0x43e661){if(_0x43e661){return _0x43e661['destroy']()[_0x4f4f('0x27')](function(){var _0x15859c=_0x43e661[_0x4f4f('0x28')]({'plain':!![]});var _0x2ec92a=_0x4f4f('0x29');return db[_0x4f4f('0x2a')][_0x4f4f('0x2b')]({'where':{'type':_0x2ec92a,'resourceId':_0x15859c['id']}})['then'](function(){return _0x43e661;});})[_0x4f4f('0x27')](function(){_0x525529[_0x4f4f('0x1b')](0xcc)[_0x4f4f('0x2c')]();});}};}function handleEntityNotFound(_0x15c79c,_0x18e864){return function(_0x4ad33d){if(!_0x4ad33d){_0x15c79c[_0x4f4f('0x2d')](0x194);}return _0x4ad33d;};}function handleError(_0xaf3de1,_0x7180f8){_0x7180f8=_0x7180f8||0x1f4;return function(_0x5deda9){logger['error'](_0x5deda9['stack']);if(_0x5deda9[_0x4f4f('0x2e')]){delete _0x5deda9['name'];}_0xaf3de1[_0x4f4f('0x1b')](_0x7180f8)[_0x4f4f('0x2f')](_0x5deda9);};}exports[_0x4f4f('0x30')]=function(_0x5eb7c9,_0x460546){var _0x1b6f53={},_0x5dd5a3={},_0x413b71={'count':0x0,'rows':[]};var _0x1a551a=_[_0x4f4f('0x31')](db['ContactItemType'][_0x4f4f('0x32')],function(_0x343c75){return{'name':_0x343c75['fieldName'],'type':_0x343c75['type'][_0x4f4f('0x33')]};});_0x5dd5a3[_0x4f4f('0x34')]=_[_0x4f4f('0x31')](_0x1a551a,_0x4f4f('0x2e'));_0x5dd5a3[_0x4f4f('0x35')]=_[_0x4f4f('0x36')](_0x5eb7c9[_0x4f4f('0x35')]);_0x5dd5a3[_0x4f4f('0x37')]=_[_0x4f4f('0x38')](_0x5dd5a3[_0x4f4f('0x34')],_0x5dd5a3['query']);_0x1b6f53['attributes']=_[_0x4f4f('0x38')](_0x5dd5a3['model'],qs[_0x4f4f('0x39')](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x39')]));_0x1b6f53[_0x4f4f('0x3a')]=_0x1b6f53[_0x4f4f('0x3a')][_0x4f4f('0x3b')]?_0x1b6f53[_0x4f4f('0x3a')]:_0x5dd5a3[_0x4f4f('0x34')];if(!_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x3c')](_0x4f4f('0x3d'))){_0x1b6f53[_0x4f4f('0x1e')]=qs['limit'](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x1e')]);_0x1b6f53[_0x4f4f('0x1c')]=qs[_0x4f4f('0x1c')](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x1c')]);}_0x1b6f53[_0x4f4f('0x3e')]=qs[_0x4f4f('0x3f')](_0x5eb7c9[_0x4f4f('0x35')]['sort']);_0x1b6f53[_0x4f4f('0x40')]=qs[_0x4f4f('0x37')](_[_0x4f4f('0x41')](_0x5eb7c9['query'],_0x5dd5a3['filters']),_0x1a551a);if(_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x42')]){_0x1b6f53[_0x4f4f('0x40')]=_[_0x4f4f('0x43')](_0x1b6f53[_0x4f4f('0x40')],{'$or':_[_0x4f4f('0x31')](_0x1a551a,function(_0x1c012d){if(_0x1c012d[_0x4f4f('0x44')]!==_0x4f4f('0x45')){var _0x455aa0={};_0x455aa0[_0x1c012d[_0x4f4f('0x2e')]]={'$like':'%'+_0x5eb7c9[_0x4f4f('0x35')]['filter']+'%'};return _0x455aa0;}})});}_0x1b6f53=_[_0x4f4f('0x43')]({},_0x1b6f53,_0x5eb7c9[_0x4f4f('0x46')]);var _0x306ee7={'where':_0x1b6f53[_0x4f4f('0x40')]};return db[_0x4f4f('0x47')]['count'](_0x306ee7)['then'](function(_0x134710){_0x413b71[_0x4f4f('0x1f')]=_0x134710;if(_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x48')]){_0x1b6f53['include']=[{'all':!![]}];}return db[_0x4f4f('0x47')]['findAll'](_0x1b6f53);})[_0x4f4f('0x27')](function(_0x5a7c94){_0x413b71['rows']=_0x5a7c94;return _0x413b71;})[_0x4f4f('0x27')](respondWithFilteredResult(_0x460546,_0x1b6f53))['catch'](handleError(_0x460546,null));};exports[_0x4f4f('0x49')]=function(_0x2af7a7,_0x5e1c20){var _0x220df1={'raw':!![],'where':{'id':_0x2af7a7['params']['id']}},_0x2d8ff6={};_0x2d8ff6[_0x4f4f('0x34')]=_[_0x4f4f('0x36')](db[_0x4f4f('0x47')][_0x4f4f('0x32')]);_0x2d8ff6[_0x4f4f('0x35')]=_[_0x4f4f('0x36')](_0x2af7a7[_0x4f4f('0x35')]);_0x2d8ff6[_0x4f4f('0x37')]=_[_0x4f4f('0x38')](_0x2d8ff6[_0x4f4f('0x34')],_0x2d8ff6[_0x4f4f('0x35')]);_0x220df1[_0x4f4f('0x3a')]=_[_0x4f4f('0x38')](_0x2d8ff6[_0x4f4f('0x34')],qs[_0x4f4f('0x39')](_0x2af7a7['query'][_0x4f4f('0x39')]));_0x220df1['attributes']=_0x220df1['attributes'][_0x4f4f('0x3b')]?_0x220df1[_0x4f4f('0x3a')]:_0x2d8ff6['model'];if(_0x2af7a7[_0x4f4f('0x35')][_0x4f4f('0x48')]){_0x220df1[_0x4f4f('0x4a')]=[{'all':!![]}];}_0x220df1=_[_0x4f4f('0x43')]({},_0x220df1,_0x2af7a7[_0x4f4f('0x46')]);return db['ContactItemType'][_0x4f4f('0x4b')](_0x220df1)[_0x4f4f('0x27')](handleEntityNotFound(_0x5e1c20,null))[_0x4f4f('0x27')](respondWithResult(_0x5e1c20,null))[_0x4f4f('0x4c')](handleError(_0x5e1c20,null));};exports[_0x4f4f('0x4d')]=function(_0x433787,_0x29314b){return db[_0x4f4f('0x47')][_0x4f4f('0x4d')](_0x433787['body'],{})[_0x4f4f('0x27')](function(_0xd3b763){var _0x4b33a5=_0x433787['user']['get']({'plain':!![]});if(!_0x4b33a5)throw new Error(_0x4f4f('0x4e'));if(_0x4b33a5[_0x4f4f('0x4f')]===_0x4f4f('0x50')){var _0x5c5077=_0xd3b763[_0x4f4f('0x28')]({'plain':!![]});var _0x5db92e=_0x4f4f('0x29');return db[_0x4f4f('0x51')][_0x4f4f('0x4b')]({'where':{'name':_0x5db92e,'userProfileId':_0x4b33a5[_0x4f4f('0x52')]},'raw':!![]})[_0x4f4f('0x27')](function(_0x1d0867){if(_0x1d0867&&_0x1d0867[_0x4f4f('0x53')]===0x0){return db[_0x4f4f('0x2a')][_0x4f4f('0x4d')]({'name':_0x5c5077['name'],'resourceId':_0x5c5077['id'],'type':_0x1d0867['name'],'sectionId':_0x1d0867['id']},{})[_0x4f4f('0x27')](function(){return _0xd3b763;});}else{return _0xd3b763;}})[_0x4f4f('0x4c')](function(_0x4c04eb){logger['error'](_0x4f4f('0x54'),_0x4c04eb);throw _0x4c04eb;});}return _0xd3b763;})[_0x4f4f('0x27')](respondWithResult(_0x29314b,0xc9))[_0x4f4f('0x4c')](handleError(_0x29314b,null));};exports['update']=function(_0x4a7622,_0x27c7fc){if(_0x4a7622[_0x4f4f('0x55')]['id']){delete _0x4a7622[_0x4f4f('0x55')]['id'];}return db[_0x4f4f('0x47')][_0x4f4f('0x4b')]({'where':{'id':_0x4a7622[_0x4f4f('0x56')]['id']}})[_0x4f4f('0x27')](handleEntityNotFound(_0x27c7fc,null))[_0x4f4f('0x27')](saveUpdates(_0x4a7622[_0x4f4f('0x55')],null))[_0x4f4f('0x27')](respondWithResult(_0x27c7fc,null))[_0x4f4f('0x4c')](handleError(_0x27c7fc,null));};exports['destroy']=function(_0x585c06,_0x376aea){return db[_0x4f4f('0x47')][_0x4f4f('0x4b')]({'where':{'id':_0x585c06[_0x4f4f('0x56')]['id']}})['then'](handleEntityNotFound(_0x376aea,null))[_0x4f4f('0x27')](db['CmContactHasItem'][_0x4f4f('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x585c06[_0x4f4f('0x56')]['id']}}))[_0x4f4f('0x27')](removeEntity(_0x376aea,null))['catch'](handleError(_0x376aea,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 47badb4..a0e1db5 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe56=['tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','define','ContactItemType'];(function(_0x2c1112,_0x3a4d3e){var _0x2e62c2=function(_0x5d419f){while(--_0x5d419f){_0x2c1112['push'](_0x2c1112['shift']());}};_0x2e62c2(++_0x3a4d3e);}(_0xbe56,0xcd));var _0x6be5=function(_0x3cc939,_0x5785aa){_0x3cc939=_0x3cc939-0x0;var _0x492c3c=_0xbe56[_0x3cc939];return _0x492c3c;};'use strict';var _=require(_0x6be5('0x0'));var util=require('util');var logger=require(_0x6be5('0x1'))(_0x6be5('0x2'));var moment=require(_0x6be5('0x3'));var BPromise=require(_0x6be5('0x4'));var rp=require(_0x6be5('0x5'));var fs=require('fs');var path=require(_0x6be5('0x6'));var rimraf=require(_0x6be5('0x7'));var config=require('../../config/environment');var attributes=require(_0x6be5('0x8'));module['exports']=function(_0x2698af,_0xd3904c){return _0x2698af[_0x6be5('0x9')](_0x6be5('0xa'),attributes,{'tableName':_0x6be5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29fb=['bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','moment'];(function(_0x15def4,_0xd7b7bb){var _0x99386=function(_0x33bfee){while(--_0x33bfee){_0x15def4['push'](_0x15def4['shift']());}};_0x99386(++_0xd7b7bb);}(_0x29fb,0xf3));var _0xb29f=function(_0x2e18f9,_0x267287){_0x2e18f9=_0x2e18f9-0x0;var _0x300285=_0x29fb[_0x2e18f9];return _0x300285;};'use strict';var _=require(_0xb29f('0x0'));var util=require(_0xb29f('0x1'));var logger=require(_0xb29f('0x2'))('api');var moment=require(_0xb29f('0x3'));var BPromise=require(_0xb29f('0x4'));var rp=require(_0xb29f('0x5'));var fs=require('fs');var path=require(_0xb29f('0x6'));var rimraf=require(_0xb29f('0x7'));var config=require('../../config/environment');var attributes=require(_0xb29f('0x8'));module[_0xb29f('0x9')]=function(_0x1cb41c,_0x1933c3){return _0x1cb41c[_0xb29f('0xa')](_0xb29f('0xb'),attributes,{'tableName':_0xb29f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 7fd270a..1f4141f 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa900=['../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x586642,_0x3b2e5d){var _0xef997a=function(_0x31839a){while(--_0x31839a){_0x586642['push'](_0x586642['shift']());}};_0xef997a(++_0x3b2e5d);}(_0xa900,0x101));var _0x0a90=function(_0x179b7b,_0x57b44d){_0x179b7b=_0x179b7b-0x0;var _0x5eea20=_0xa900[_0x179b7b];return _0x5eea20;};'use strict';var _=require(_0x0a90('0x0'));var util=require(_0x0a90('0x1'));var moment=require(_0x0a90('0x2'));var BPromise=require(_0x0a90('0x3'));var rs=require(_0x0a90('0x4'));var fs=require('fs');var Redis=require(_0x0a90('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a90('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a90('0x7'));var jayson=require(_0x0a90('0x8'));var client=jayson[_0x0a90('0x9')][_0x0a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56a1e5,_0x3909ac,_0x4718e9){return new BPromise(function(_0x33e3cf,_0x4f2b58){return client[_0x0a90('0xb')](_0x56a1e5,_0x4718e9)[_0x0a90('0xc')](function(_0x36c82f){logger['info'](_0x0a90('0xd'),_0x3909ac,'request\x20sent');logger[_0x0a90('0xe')](_0x0a90('0xf'),_0x3909ac,'request\x20sent',JSON[_0x0a90('0x10')](_0x36c82f));if(_0x36c82f[_0x0a90('0x11')]){if(_0x36c82f[_0x0a90('0x11')][_0x0a90('0x12')]===0x1f4){logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x36c82f[_0x0a90('0x11')][_0x0a90('0x13')]);return _0x4f2b58(_0x36c82f[_0x0a90('0x11')][_0x0a90('0x13')]);}logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x36c82f[_0x0a90('0x11')]['message']);return _0x33e3cf(_0x36c82f['error'][_0x0a90('0x13')]);}else{logger[_0x0a90('0x14')](_0x0a90('0xd'),_0x3909ac,_0x0a90('0x15'));_0x33e3cf(_0x36c82f[_0x0a90('0x16')][_0x0a90('0x13')]);}})[_0x0a90('0x17')](function(_0x4c5979){logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x4c5979);_0x4f2b58(_0x4c5979);});});} \ No newline at end of file +var _0x573c=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x3e3e23,_0xa405cc){var _0x1b2d40=function(_0x431c00){while(--_0x431c00){_0x3e3e23['push'](_0x3e3e23['shift']());}};_0x1b2d40(++_0xa405cc);}(_0x573c,0x125));var _0xc573=function(_0x111fd9,_0x237b96){_0x111fd9=_0x111fd9-0x0;var _0x397c7e=_0x573c[_0x111fd9];return _0x397c7e;};'use strict';var _=require(_0xc573('0x0'));var util=require(_0xc573('0x1'));var moment=require('moment');var BPromise=require(_0xc573('0x2'));var rs=require(_0xc573('0x3'));var fs=require('fs');var Redis=require(_0xc573('0x4'));var db=require(_0xc573('0x5'))['db'];var utils=require(_0xc573('0x6'));var logger=require(_0xc573('0x7'))('rpc');var config=require(_0xc573('0x8'));var jayson=require(_0xc573('0x9'));var client=jayson[_0xc573('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb57aa4,_0x4bda4f,_0x1b5ee7){return new BPromise(function(_0x7f7de5,_0x377ab0){return client[_0xc573('0xb')](_0xb57aa4,_0x1b5ee7)['then'](function(_0x3160be){logger[_0xc573('0xc')](_0xc573('0xd'),_0x4bda4f,_0xc573('0xe'));logger[_0xc573('0xf')](_0xc573('0x10'),_0x4bda4f,_0xc573('0xe'),JSON[_0xc573('0x11')](_0x3160be));if(_0x3160be[_0xc573('0x12')]){if(_0x3160be['error']['code']===0x1f4){logger[_0xc573('0x12')](_0xc573('0xd'),_0x4bda4f,_0x3160be[_0xc573('0x12')][_0xc573('0x13')]);return _0x377ab0(_0x3160be[_0xc573('0x12')][_0xc573('0x13')]);}logger[_0xc573('0x12')](_0xc573('0xd'),_0x4bda4f,_0x3160be[_0xc573('0x12')][_0xc573('0x13')]);return _0x7f7de5(_0x3160be[_0xc573('0x12')][_0xc573('0x13')]);}else{logger[_0xc573('0xc')](_0xc573('0xd'),_0x4bda4f,_0xc573('0xe'));_0x7f7de5(_0x3160be[_0xc573('0x14')]['message']);}})[_0xc573('0x15')](function(_0x22064a){logger['error'](_0xc573('0xd'),_0x4bda4f,_0x22064a);_0x377ab0(_0x22064a);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 5576441..51ca435 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x764f=['post','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','show'];(function(_0x4d47dc,_0x375829){var _0x5d3e88=function(_0xe48285){while(--_0xe48285){_0x4d47dc['push'](_0x4d47dc['shift']());}};_0x5d3e88(++_0x375829);}(_0x764f,0x6b));var _0xf764=function(_0x45783f,_0xdcbb2f){_0x45783f=_0x45783f-0x0;var _0x46c2e8=_0x764f[_0x45783f];return _0x46c2e8;};'use strict';var multer=require(_0xf764('0x0'));var util=require(_0xf764('0x1'));var path=require(_0xf764('0x2'));var timeout=require('connect-timeout');var express=require(_0xf764('0x3'));var router=express[_0xf764('0x4')]();var fs_extra=require(_0xf764('0x5'));var auth=require(_0xf764('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf764('0x7'));var controller=require(_0xf764('0x8'));router[_0xf764('0x9')]('/',auth['isAuthenticated'](),controller[_0xf764('0xa')]);router[_0xf764('0x9')]('/:id',auth[_0xf764('0xb')](),controller[_0xf764('0xc')]);router[_0xf764('0xd')]('/',auth[_0xf764('0xb')](),controller[_0xf764('0xe')]);router[_0xf764('0xf')](_0xf764('0x10'),auth[_0xf764('0xb')](),controller[_0xf764('0x11')]);router['delete'](_0xf764('0x10'),auth[_0xf764('0xb')](),controller[_0xf764('0x12')]);module[_0xf764('0x13')]=router; \ No newline at end of file +var _0xb028=['./contactItemType.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x36d8ff,_0x224895){var _0x906ef5=function(_0x2c21f1){while(--_0x2c21f1){_0x36d8ff['push'](_0x36d8ff['shift']());}};_0x906ef5(++_0x224895);}(_0xb028,0x188));var _0x8b02=function(_0xc65ae2,_0x53119a){_0xc65ae2=_0xc65ae2-0x0;var _0x2432ea=_0xb028[_0xc65ae2];return _0x2432ea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8b02('0x0'));var timeout=require('connect-timeout');var express=require(_0x8b02('0x1'));var router=express[_0x8b02('0x2')]();var fs_extra=require(_0x8b02('0x3'));var auth=require(_0x8b02('0x4'));var interaction=require(_0x8b02('0x5'));var config=require(_0x8b02('0x6'));var controller=require(_0x8b02('0x7'));router[_0x8b02('0x8')]('/',auth[_0x8b02('0x9')](),controller[_0x8b02('0xa')]);router['get'](_0x8b02('0xb'),auth[_0x8b02('0x9')](),controller['show']);router[_0x8b02('0xc')]('/',auth[_0x8b02('0x9')](),controller[_0x8b02('0xd')]);router[_0x8b02('0xe')]('/:id',auth[_0x8b02('0x9')](),controller[_0x8b02('0xf')]);router[_0x8b02('0x10')](_0x8b02('0xb'),auth[_0x8b02('0x9')](),controller[_0x8b02('0x11')]);module[_0x8b02('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index be71bff..770553d 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3db20cb..2f0b34f 100644 --- a/server/api/dashboard/dashboard.controller.js +++ b/server/api/dashboard/dashboard.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf645=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','then','get','CustomDashboards','error','stack','name','send','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','Dashboard','includeAll','include','rows','show','params','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5ca617,_0x48cda5){var _0x2f8d90=function(_0x1937bc){while(--_0x1937bc){_0x5ca617['push'](_0x5ca617['shift']());}};_0x2f8d90(++_0x48cda5);}(_0xf645,0x66));var _0x5f64=function(_0x37b7a0,_0x2ee4f5){_0x37b7a0=_0x37b7a0-0x0;var _0x4fb461=_0xf645[_0x37b7a0];return _0x4fb461;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f64('0x0'));var zipdir=require(_0x5f64('0x1'));var jsonpatch=require(_0x5f64('0x2'));var rp=require('request-promise');var moment=require(_0x5f64('0x3'));var BPromise=require(_0x5f64('0x4'));var Mustache=require(_0x5f64('0x5'));var util=require(_0x5f64('0x6'));var path=require(_0x5f64('0x7'));var sox=require(_0x5f64('0x8'));var csv=require(_0x5f64('0x9'));var ejs=require(_0x5f64('0xa'));var fs=require('fs');var fs_extra=require(_0x5f64('0xb'));var _=require(_0x5f64('0xc'));var squel=require(_0x5f64('0xd'));var crypto=require('crypto');var jsforce=require(_0x5f64('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5f64('0x9'));var querystring=require(_0x5f64('0xf'));var Papa=require(_0x5f64('0x10'));var Redis=require(_0x5f64('0x11'));var authService=require(_0x5f64('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5f64('0x13'));var hardwareService=require(_0x5f64('0x14'));var logger=require(_0x5f64('0x15'))(_0x5f64('0x16'));var utils=require(_0x5f64('0x17'));var config=require(_0x5f64('0x18'));var licenseUtil=require(_0x5f64('0x19'));var db=require(_0x5f64('0x1a'))['db'];config[_0x5f64('0x1b')]=_[_0x5f64('0x1c')](config[_0x5f64('0x1b')],{'host':_0x5f64('0x1d'),'port':0x18eb});var socket=require(_0x5f64('0x1e'))(new Redis(config[_0x5f64('0x1b')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x2bb984,_0x7cdee7){_0x7cdee7=_0x7cdee7||0xcc;return function(_0x1c764c){if(_0x1c764c){return _0x2bb984[_0x5f64('0x1f')](_0x7cdee7);}return _0x2bb984[_0x5f64('0x20')](_0x7cdee7)[_0x5f64('0x21')]();};}function respondWithResult(_0x3b6f72,_0x4cfb25){_0x4cfb25=_0x4cfb25||0xc8;return function(_0x2fdf2e){if(_0x2fdf2e){return _0x3b6f72['status'](_0x4cfb25)[_0x5f64('0x22')](_0x2fdf2e);}};}function respondWithFilteredResult(_0x25d3c1,_0x527b8b){return function(_0x11562e){if(_0x11562e){var _0xf05cc8=typeof _0x527b8b[_0x5f64('0x23')]===_0x5f64('0x24')&&typeof _0x527b8b['limit']===_0x5f64('0x24');var _0x3f3001=_0x11562e[_0x5f64('0x25')];var _0x279043=_0xf05cc8?0x0:_0x527b8b[_0x5f64('0x23')];var _0x4c8081=_0xf05cc8?_0x11562e[_0x5f64('0x25')]:_0x527b8b[_0x5f64('0x23')]+_0x527b8b[_0x5f64('0x26')];var _0x519aa8;if(_0x4c8081>=_0x3f3001){_0x4c8081=_0x3f3001;_0x519aa8=0xc8;}else{_0x519aa8=0xce;}_0x25d3c1['status'](_0x519aa8);return _0x25d3c1['set'](_0x5f64('0x27'),_0x279043+'-'+_0x4c8081+'/'+_0x3f3001)[_0x5f64('0x22')](_0x11562e);}return null;};}function patchUpdates(_0x59908b){return function(_0x4629bc){try{jsonpatch['apply'](_0x4629bc,_0x59908b,!![]);}catch(_0x25891f){return BPromise[_0x5f64('0x28')](_0x25891f);}return _0x4629bc[_0x5f64('0x29')]();};}function saveUpdates(_0x53e66c,_0x482f43){return function(_0x2cbce4){if(_0x2cbce4){return _0x2cbce4[_0x5f64('0x2a')](_0x53e66c)['then'](function(_0x2e845b){return _0x2e845b;});}return null;};}function removeEntity(_0x54d802,_0x1f9bc7){return function(_0x106a99){if(_0x106a99){return _0x106a99[_0x5f64('0x2b')]()[_0x5f64('0x2c')](function(){var _0xa41500=_0x106a99[_0x5f64('0x2d')]({'plain':!![]});var _0x412a73=_0x5f64('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x412a73,'resourceId':_0xa41500['id']}})['then'](function(){return _0x106a99;});})[_0x5f64('0x2c')](function(){_0x54d802[_0x5f64('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x174089,_0x3ccacf){return function(_0x43a764){if(!_0x43a764){_0x174089[_0x5f64('0x1f')](0x194);}return _0x43a764;};}function handleError(_0x7ce398,_0x5d64ec){_0x5d64ec=_0x5d64ec||0x1f4;return function(_0x33983f){logger[_0x5f64('0x2f')](_0x33983f[_0x5f64('0x30')]);if(_0x33983f[_0x5f64('0x31')]){delete _0x33983f[_0x5f64('0x31')];}_0x7ce398[_0x5f64('0x20')](_0x5d64ec)[_0x5f64('0x32')](_0x33983f);};}exports['index']=function(_0x3ceb09,_0x1614e7){var _0x104996={},_0x12619a={},_0x10f0ce={'count':0x0,'rows':[]};var _0x3f12a7=_['map'](db['Dashboard'][_0x5f64('0x33')],function(_0x3439cd){return{'name':_0x3439cd['fieldName'],'type':_0x3439cd[_0x5f64('0x34')][_0x5f64('0x35')]};});_0x12619a['model']=_['map'](_0x3f12a7,'name');_0x12619a[_0x5f64('0x36')]=_[_0x5f64('0x37')](_0x3ceb09[_0x5f64('0x36')]);_0x12619a['filters']=_[_0x5f64('0x38')](_0x12619a[_0x5f64('0x39')],_0x12619a[_0x5f64('0x36')]);_0x104996[_0x5f64('0x3a')]=_[_0x5f64('0x38')](_0x12619a[_0x5f64('0x39')],qs[_0x5f64('0x3b')](_0x3ceb09[_0x5f64('0x36')][_0x5f64('0x3b')]));_0x104996[_0x5f64('0x3a')]=_0x104996[_0x5f64('0x3a')][_0x5f64('0x3c')]?_0x104996[_0x5f64('0x3a')]:_0x12619a[_0x5f64('0x39')];if(!_0x3ceb09['query'][_0x5f64('0x3d')](_0x5f64('0x3e'))){_0x104996[_0x5f64('0x26')]=qs[_0x5f64('0x26')](_0x3ceb09[_0x5f64('0x36')]['limit']);_0x104996[_0x5f64('0x23')]=qs['offset'](_0x3ceb09[_0x5f64('0x36')][_0x5f64('0x23')]);}_0x104996[_0x5f64('0x3f')]=qs[_0x5f64('0x40')](_0x3ceb09[_0x5f64('0x36')][_0x5f64('0x40')]);_0x104996[_0x5f64('0x41')]=qs['filters'](_['pick'](_0x3ceb09[_0x5f64('0x36')],_0x12619a[_0x5f64('0x42')]),_0x3f12a7);if(_0x3ceb09['query'][_0x5f64('0x43')]){_0x104996[_0x5f64('0x41')]=_[_0x5f64('0x44')](_0x104996['where'],{'$or':_[_0x5f64('0x45')](_0x3f12a7,function(_0x1d3707){if(_0x1d3707[_0x5f64('0x34')]!==_0x5f64('0x46')){var _0x42a662={};_0x42a662[_0x1d3707[_0x5f64('0x31')]]={'$like':'%'+_0x3ceb09['query'][_0x5f64('0x43')]+'%'};return _0x42a662;}})});}_0x104996=_['merge']({},_0x104996,_0x3ceb09[_0x5f64('0x47')]);var _0x10fb80={'where':_0x104996[_0x5f64('0x41')]};return db[_0x5f64('0x48')][_0x5f64('0x25')](_0x10fb80)['then'](function(_0x47f8f5){_0x10f0ce[_0x5f64('0x25')]=_0x47f8f5;if(_0x3ceb09[_0x5f64('0x36')][_0x5f64('0x49')]){_0x104996[_0x5f64('0x4a')]=[{'all':!![]}];}return db[_0x5f64('0x48')]['findAll'](_0x104996);})[_0x5f64('0x2c')](function(_0x5bde1b){_0x10f0ce[_0x5f64('0x4b')]=_0x5bde1b;return _0x10f0ce;})[_0x5f64('0x2c')](respondWithFilteredResult(_0x1614e7,_0x104996))['catch'](handleError(_0x1614e7,null));};exports[_0x5f64('0x4c')]=function(_0xdbeb9e,_0x42b5c3){var _0x1392e8={'raw':![],'where':{'id':_0xdbeb9e[_0x5f64('0x4d')]['id']}},_0x61dbfc={};_0x61dbfc[_0x5f64('0x39')]=_['keys'](db['Dashboard']['rawAttributes']);_0x61dbfc[_0x5f64('0x36')]=_[_0x5f64('0x37')](_0xdbeb9e['query']);_0x61dbfc[_0x5f64('0x42')]=_[_0x5f64('0x38')](_0x61dbfc['model'],_0x61dbfc[_0x5f64('0x36')]);_0x1392e8[_0x5f64('0x3a')]=_[_0x5f64('0x38')](_0x61dbfc[_0x5f64('0x39')],qs[_0x5f64('0x3b')](_0xdbeb9e[_0x5f64('0x36')]['fields']));_0x1392e8[_0x5f64('0x3a')]=_0x1392e8['attributes'][_0x5f64('0x3c')]?_0x1392e8[_0x5f64('0x3a')]:_0x61dbfc[_0x5f64('0x39')];if(_0xdbeb9e[_0x5f64('0x36')][_0x5f64('0x49')]){_0x1392e8['include']=[{'all':!![]}];}_0x1392e8=_[_0x5f64('0x44')]({},_0x1392e8,_0xdbeb9e[_0x5f64('0x47')]);return db['Dashboard'][_0x5f64('0x4e')](_0x1392e8)['then'](handleEntityNotFound(_0x42b5c3,null))[_0x5f64('0x2c')](respondWithResult(_0x42b5c3,null))[_0x5f64('0x4f')](handleError(_0x42b5c3,null));};exports[_0x5f64('0x50')]=function(_0x273962,_0x579e20){return db['Dashboard'][_0x5f64('0x50')](_0x273962[_0x5f64('0x51')],{})[_0x5f64('0x2c')](function(_0x4fe0be){var _0x252b7d=_0x273962[_0x5f64('0x52')]['get']({'plain':!![]});if(!_0x252b7d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x252b7d[_0x5f64('0x53')]===_0x5f64('0x52')){var _0x22dc59=_0x4fe0be[_0x5f64('0x2d')]({'plain':!![]});var _0x18f9ae='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x18f9ae,'userProfileId':_0x252b7d[_0x5f64('0x54')]},'raw':!![]})[_0x5f64('0x2c')](function(_0x34a08c){if(_0x34a08c&&_0x34a08c[_0x5f64('0x55')]===0x0){return db['UserProfileResource'][_0x5f64('0x50')]({'name':_0x22dc59[_0x5f64('0x31')],'resourceId':_0x22dc59['id'],'type':_0x34a08c[_0x5f64('0x31')],'sectionId':_0x34a08c['id']},{})[_0x5f64('0x2c')](function(){return _0x4fe0be;});}else{return _0x4fe0be;}})[_0x5f64('0x4f')](function(_0x1a78ed){logger['error'](_0x5f64('0x56'),_0x1a78ed);throw _0x1a78ed;});}return _0x4fe0be;})[_0x5f64('0x2c')](respondWithResult(_0x579e20,0xc9))[_0x5f64('0x4f')](handleError(_0x579e20,null));};exports[_0x5f64('0x57')]=function(_0x563695,_0x44444f){var _0x1a6bbd={'where':{'id':_0x563695[_0x5f64('0x4d')]['id']}},_0x4e75c9={};_0x4e75c9[_0x5f64('0x39')]=_[_0x5f64('0x37')](db[_0x5f64('0x48')][_0x5f64('0x33')]);_0x1a6bbd['attributes']=_[_0x5f64('0x38')](_0x4e75c9[_0x5f64('0x39')],qs[_0x5f64('0x3b')](_0x563695[_0x5f64('0x36')]['fields']));_0x1a6bbd[_0x5f64('0x3a')]=_0x1a6bbd[_0x5f64('0x3a')]['length']?_0x1a6bbd[_0x5f64('0x3a')]:_0x4e75c9[_0x5f64('0x39')];if(_0x563695[_0x5f64('0x36')][_0x5f64('0x49')]){_0x1a6bbd[_0x5f64('0x4a')]=[{'all':!![]}];}_0x1a6bbd=_[_0x5f64('0x44')]({},_0x1a6bbd,_0x563695[_0x5f64('0x47')]);return db[_0x5f64('0x48')]['find'](_0x1a6bbd)[_0x5f64('0x2c')](handleEntityNotFound(_0x44444f,null))['then'](function(_0x8bf59b){if(_0x8bf59b){var _0x113111=_0x8bf59b[_0x5f64('0x2d')]({'plain':!![]});_0x113111=qs[_0x5f64('0x58')](_0x113111,['id',_0x5f64('0x59'),_0x5f64('0x5a')]);_0x563695[_0x5f64('0x51')]=_[_0x5f64('0x58')](_0x563695[_0x5f64('0x51')],['id',_0x5f64('0x59'),_0x5f64('0x5a')]);return db[_0x5f64('0x48')][_0x5f64('0x50')](_[_0x5f64('0x44')](_0x113111,_0x563695['body']),{'include':_0x563695['query'][_0x5f64('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x37ed3e){var _0x5c56bc=_0x563695['user'][_0x5f64('0x2d')]({'plain':!![]});if(!_0x5c56bc)throw new Error(_0x5f64('0x5b'));if(_0x5c56bc[_0x5f64('0x53')]===_0x5f64('0x52')){var _0x16bf82=_0x37ed3e['get']({'plain':!![]});var _0x286c3d=_0x5f64('0x2e');return db['UserProfileSection'][_0x5f64('0x4e')]({'where':{'name':_0x286c3d,'userProfileId':_0x5c56bc[_0x5f64('0x54')]},'raw':!![]})[_0x5f64('0x2c')](function(_0x1bf976){if(_0x1bf976&&_0x1bf976['autoAssociation']===0x0){return db['UserProfileResource'][_0x5f64('0x50')]({'name':_0x16bf82[_0x5f64('0x31')],'resourceId':_0x16bf82['id'],'type':_0x1bf976[_0x5f64('0x31')],'sectionId':_0x1bf976['id']},{})[_0x5f64('0x2c')](function(){return _0x37ed3e;});}else{return _0x37ed3e;}})[_0x5f64('0x4f')](function(_0x129f2e){logger['error'](_0x5f64('0x56'),_0x129f2e);throw _0x129f2e;});}return _0x37ed3e;});}})[_0x5f64('0x2c')](respondWithResult(_0x44444f,0xc9))[_0x5f64('0x4f')](handleError(_0x44444f,null));};exports[_0x5f64('0x2a')]=function(_0x44e7d1,_0x2da567){if(_0x44e7d1[_0x5f64('0x51')]['id']){delete _0x44e7d1['body']['id'];}return db['Dashboard'][_0x5f64('0x4e')]({'where':{'id':_0x44e7d1['params']['id']}})[_0x5f64('0x2c')](handleEntityNotFound(_0x2da567,null))[_0x5f64('0x2c')](saveUpdates(_0x44e7d1['body'],null))[_0x5f64('0x2c')](respondWithResult(_0x2da567,null))[_0x5f64('0x4f')](handleError(_0x2da567,null));};exports['destroy']=function(_0x366f79,_0x342db1){return db[_0x5f64('0x48')]['find']({'where':{'id':_0x366f79[_0x5f64('0x4d')]['id']}})['then'](handleEntityNotFound(_0x342db1,null))[_0x5f64('0x2c')](removeEntity(_0x342db1,null))[_0x5f64('0x4f')](handleError(_0x342db1,null));};function widgetAttributes(_0x417b54){try{switch(_0x417b54[_0x5f64('0x34')]){case _0x5f64('0x5c'):return[{'name':_0x5f64('0x5d'),'value':_0x417b54[_0x5f64('0x5d')]||(_0x417b54['attrs']&&_0x417b54[_0x5f64('0x5e')][0x0]?_0x417b54['attrs'][0x0][_0x5f64('0x5f')]:undefined)||_0x5f64('0x60')}];case'custom':return[{'name':_0x5f64('0x61'),'value':_0x417b54[_0x5f64('0x61')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x0]?_0x417b54[_0x5f64('0x5e')][0x0][_0x5f64('0x5f')]:undefined)||''}];case _0x5f64('0x62'):return[{'name':_0x5f64('0x63'),'value':_0x417b54[_0x5f64('0x63')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x0]?_0x417b54[_0x5f64('0x5e')][0x0][_0x5f64('0x5f')]:undefined)||_0x5f64('0x64')},{'name':_0x5f64('0x65'),'value':_0x417b54[_0x5f64('0x65')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x1]?_0x417b54[_0x5f64('0x5e')][0x1][_0x5f64('0x5f')]:undefined)||_0x5f64('0x66')},{'name':_0x5f64('0x67'),'value':_0x417b54['attrFontSize']||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x2]?_0x417b54[_0x5f64('0x5e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x417b54['attrMetric']||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x0]?_0x417b54[_0x5f64('0x5e')][0x0][_0x5f64('0x5f')]:undefined)||_0x5f64('0x68')},{'name':_0x5f64('0x69'),'value':_0x417b54[_0x5f64('0x69')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x1]?_0x417b54['attrs'][0x1]['value']:undefined)||[]},{'name':_0x5f64('0x67'),'value':_0x417b54[_0x5f64('0x67')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x2]?_0x417b54[_0x5f64('0x5e')][0x2][_0x5f64('0x5f')]:undefined)||0x14},{'name':_0x5f64('0x6a'),'value':_0x417b54[_0x5f64('0x6a')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x3]?_0x417b54['attrs'][0x3][_0x5f64('0x5f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x417b54[_0x5f64('0x6b')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x4]?_0x417b54[_0x5f64('0x5e')][0x4][_0x5f64('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x417b54[_0x5f64('0x6c')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x5]?_0x417b54[_0x5f64('0x5e')][0x5][_0x5f64('0x5f')]:undefined)||''},{'name':_0x5f64('0x6d'),'value':_0x417b54[_0x5f64('0x6d')]||(_0x417b54['attrs']&&_0x417b54[_0x5f64('0x5e')][0x6]?_0x417b54[_0x5f64('0x5e')][0x6][_0x5f64('0x5f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x417b54[_0x5f64('0x6e')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x7]?_0x417b54[_0x5f64('0x5e')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x417b54[_0x5f64('0x6f')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x8]?_0x417b54[_0x5f64('0x5e')][0x8][_0x5f64('0x5f')]:undefined)||''},{'name':_0x5f64('0x70'),'value':_0x417b54[_0x5f64('0x70')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x9]?_0x417b54[_0x5f64('0x5e')][0x9][_0x5f64('0x5f')]:undefined)||''}];case _0x5f64('0x71'):case _0x5f64('0x72'):return[{'name':_0x5f64('0x73'),'value':_0x417b54[_0x5f64('0x73')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x0]?_0x417b54[_0x5f64('0x5e')][0x0]['value']:undefined)||_0x5f64('0x68')},{'name':_0x5f64('0x74'),'value':_0x417b54['attrSerie2']||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x1]?_0x417b54[_0x5f64('0x5e')][0x1][_0x5f64('0x5f')]:undefined)||null},{'name':_0x5f64('0x75'),'value':_0x417b54['attrSerie3']||(_0x417b54['attrs']&&_0x417b54[_0x5f64('0x5e')][0x2]?_0x417b54['attrs'][0x2]['value']:undefined)||null},{'name':_0x5f64('0x69'),'value':_0x417b54[_0x5f64('0x69')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x3]?_0x417b54[_0x5f64('0x5e')][0x3][_0x5f64('0x5f')]:undefined)||[]},{'name':'attrChannel','value':_0x417b54['attrChannel']||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x4]?_0x417b54[_0x5f64('0x5e')][0x4][_0x5f64('0x5f')]:undefined)||_0x5f64('0x76')},{'name':_0x5f64('0x6b'),'value':_0x417b54[_0x5f64('0x6b')]||(_0x417b54['attrs']&&_0x417b54[_0x5f64('0x5e')][0x5]?_0x417b54['attrs'][0x5][_0x5f64('0x5f')]:undefined)||''},{'name':_0x5f64('0x6c'),'value':_0x417b54[_0x5f64('0x6c')]||(_0x417b54['attrs']&&_0x417b54[_0x5f64('0x5e')][0x6]?_0x417b54[_0x5f64('0x5e')][0x6][_0x5f64('0x5f')]:undefined)||''},{'name':_0x5f64('0x6d'),'value':_0x417b54[_0x5f64('0x6d')]||(_0x417b54['attrs']&&_0x417b54[_0x5f64('0x5e')][0x7]?_0x417b54[_0x5f64('0x5e')][0x7][_0x5f64('0x5f')]:undefined)||''},{'name':_0x5f64('0x6e'),'value':_0x417b54['attrOpenchannelAccounts']||(_0x417b54['attrs']&&_0x417b54[_0x5f64('0x5e')][0x8]?_0x417b54['attrs'][0x8][_0x5f64('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x417b54[_0x5f64('0x6f')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x9]?_0x417b54[_0x5f64('0x5e')][0x9][_0x5f64('0x5f')]:undefined)||''},{'name':_0x5f64('0x70'),'value':_0x417b54['attrChatWebsites']||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0xa]?_0x417b54[_0x5f64('0x5e')][0xa][_0x5f64('0x5f')]:undefined)||''}];case _0x5f64('0x77'):return[{'name':_0x5f64('0x78'),'type':_0x417b54[_0x5f64('0x79')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x0]?_0x417b54[_0x5f64('0x5e')][0x0][_0x5f64('0x34')]:undefined)||null,'value':_0x417b54[_0x5f64('0x78')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54[_0x5f64('0x5e')][0x0]?_0x417b54['attrs'][0x0][_0x5f64('0x5f')]:undefined)||null},{'name':_0x5f64('0x7a'),'value':_0x417b54[_0x5f64('0x7a')]||(_0x417b54[_0x5f64('0x5e')]&&_0x417b54['attrs'][0x1]?_0x417b54[_0x5f64('0x5e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x418c10){logger[_0x5f64('0x2f')](_0x5f64('0x7b'),JSON[_0x5f64('0x7c')](_0x418c10));return[];}}exports[_0x5f64('0x7d')]=function(_0x39171c,_0x37e14e,_0x29dbbe){if(_0x39171c[_0x5f64('0x51')]['id']){delete _0x39171c[_0x5f64('0x51')]['id'];}return db['Dashboard'][_0x5f64('0x4e')]({'where':{'id':_0x39171c[_0x5f64('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37e14e,null))[_0x5f64('0x2c')](function(_0x2e3ed6){if(_0x2e3ed6){_0x39171c[_0x5f64('0x51')][_0x5f64('0x7e')]=_0x2e3ed6['id'];_0x39171c[_0x5f64('0x51')][_0x5f64('0x5e')]=widgetAttributes(_0x39171c[_0x5f64('0x51')]);return db['DashboardItem'][_0x5f64('0x50')](_0x39171c['body']);}})[_0x5f64('0x2c')](respondWithResult(_0x37e14e,null))[_0x5f64('0x4f')](handleError(_0x37e14e,null));};exports['getItems']=function(_0xfb7721,_0x271c6b,_0x56a873){var _0x1356ca={};var _0x23e036={};var _0x45d09a;var _0x4ead1d;return db[_0x5f64('0x48')]['findOne']({'where':{'id':_0xfb7721[_0x5f64('0x4d')]['id']}})['then'](handleEntityNotFound(_0x271c6b,null))[_0x5f64('0x2c')](function(_0xc42b03){if(_0xc42b03){_0x45d09a=_0xc42b03;_0x23e036['model']=_[_0x5f64('0x37')](db[_0x5f64('0x7f')][_0x5f64('0x33')]);_0x23e036['query']=_['keys'](_0xfb7721[_0x5f64('0x36')]);_0x23e036['filters']=_['intersection'](_0x23e036[_0x5f64('0x39')],_0x23e036[_0x5f64('0x36')]);_0x1356ca[_0x5f64('0x3a')]=_[_0x5f64('0x38')](_0x23e036[_0x5f64('0x39')],qs[_0x5f64('0x3b')](_0xfb7721[_0x5f64('0x36')][_0x5f64('0x3b')]));_0x1356ca[_0x5f64('0x3a')]=_0x1356ca[_0x5f64('0x3a')][_0x5f64('0x3c')]?_0x1356ca[_0x5f64('0x3a')]:_0x23e036['model'];_0x1356ca[_0x5f64('0x3f')]=qs['sort'](_0xfb7721['query'][_0x5f64('0x40')]);_0x1356ca[_0x5f64('0x41')]=qs[_0x5f64('0x42')](_['pick'](_0xfb7721[_0x5f64('0x36')],_0x23e036['filters']));if(_0xfb7721[_0x5f64('0x36')][_0x5f64('0x43')]){_0x1356ca[_0x5f64('0x41')]=_[_0x5f64('0x44')](_0x1356ca[_0x5f64('0x41')],{'$or':_[_0x5f64('0x45')](_0x1356ca[_0x5f64('0x3a')],function(_0xccd885){var _0x20d61b={};_0x20d61b[_0xccd885]={'$like':'%'+_0xfb7721['query'][_0x5f64('0x43')]+'%'};return _0x20d61b;})});}_0x1356ca=_[_0x5f64('0x44')]({},_0x1356ca,_0xfb7721['options']);return _0x45d09a['getItems'](_0x1356ca);}})[_0x5f64('0x2c')](function(_0x52fb2d){if(_0x52fb2d){_0x4ead1d=_0x52fb2d['length'];if(!_0xfb7721[_0x5f64('0x36')][_0x5f64('0x3d')](_0x5f64('0x3e'))){_0x1356ca[_0x5f64('0x26')]=qs[_0x5f64('0x26')](_0xfb7721[_0x5f64('0x36')][_0x5f64('0x26')]);_0x1356ca[_0x5f64('0x23')]=qs[_0x5f64('0x23')](_0xfb7721[_0x5f64('0x36')][_0x5f64('0x23')]);}return _0x45d09a[_0x5f64('0x80')](_0x1356ca);}})[_0x5f64('0x2c')](function(_0x14391f){if(_0x14391f){return _0x14391f?{'count':_0x4ead1d,'rows':_0x14391f}:null;}})[_0x5f64('0x2c')](respondWithResult(_0x271c6b,null))[_0x5f64('0x4f')](handleError(_0x271c6b,null));}; \ No newline at end of file +var _0xee64=['rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','limit','undefined','count','reject','save','update','then','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','Dashboard','includeAll','include','findAll','catch','show','params','length','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','reportType','widgetAttributes:\x20%s','DashboardId','findOne','pick','nolimit','eml-format'];(function(_0x332ce6,_0x3d7eab){var _0x5db10b=function(_0x4820fe){while(--_0x4820fe){_0x332ce6['push'](_0x332ce6['shift']());}};_0x5db10b(++_0x3d7eab);}(_0xee64,0x7c));var _0x4ee6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xee64[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x4ee6('0x0'));var rimraf=require(_0x4ee6('0x1'));var zipdir=require(_0x4ee6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ee6('0x3'));var moment=require('moment');var BPromise=require(_0x4ee6('0x4'));var Mustache=require(_0x4ee6('0x5'));var util=require('util');var path=require(_0x4ee6('0x6'));var sox=require(_0x4ee6('0x7'));var csv=require(_0x4ee6('0x8'));var ejs=require(_0x4ee6('0x9'));var fs=require('fs');var fs_extra=require(_0x4ee6('0xa'));var _=require(_0x4ee6('0xb'));var squel=require(_0x4ee6('0xc'));var crypto=require(_0x4ee6('0xd'));var jsforce=require(_0x4ee6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4ee6('0x8'));var querystring=require(_0x4ee6('0xf'));var Papa=require('papaparse');var Redis=require(_0x4ee6('0x10'));var authService=require(_0x4ee6('0x11'));var qs=require(_0x4ee6('0x12'));var as=require(_0x4ee6('0x13'));var hardwareService=require(_0x4ee6('0x14'));var logger=require(_0x4ee6('0x15'))(_0x4ee6('0x16'));var utils=require(_0x4ee6('0x17'));var config=require(_0x4ee6('0x18'));var licenseUtil=require(_0x4ee6('0x19'));var db=require(_0x4ee6('0x1a'))['db'];config['redis']=_['defaults'](config[_0x4ee6('0x1b')],{'host':_0x4ee6('0x1c'),'port':0x18eb});var socket=require(_0x4ee6('0x1d'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x2faaf1,_0x27927a){_0x27927a=_0x27927a||0xcc;return function(_0x53d3e9){if(_0x53d3e9){return _0x2faaf1[_0x4ee6('0x1e')](_0x27927a);}return _0x2faaf1[_0x4ee6('0x1f')](_0x27927a)['end']();};}function respondWithResult(_0x27abfd,_0x47e2ab){_0x47e2ab=_0x47e2ab||0xc8;return function(_0x1b2662){if(_0x1b2662){return _0x27abfd[_0x4ee6('0x1f')](_0x47e2ab)[_0x4ee6('0x20')](_0x1b2662);}};}function respondWithFilteredResult(_0xca1b8c,_0x13c761){return function(_0x44489a){if(_0x44489a){var _0x510ef1=typeof _0x13c761[_0x4ee6('0x21')]==='undefined'&&typeof _0x13c761[_0x4ee6('0x22')]===_0x4ee6('0x23');var _0x482b3b=_0x44489a[_0x4ee6('0x24')];var _0x46aa01=_0x510ef1?0x0:_0x13c761[_0x4ee6('0x21')];var _0x266cd1=_0x510ef1?_0x44489a[_0x4ee6('0x24')]:_0x13c761[_0x4ee6('0x21')]+_0x13c761[_0x4ee6('0x22')];var _0x595b3c;if(_0x266cd1>=_0x482b3b){_0x266cd1=_0x482b3b;_0x595b3c=0xc8;}else{_0x595b3c=0xce;}_0xca1b8c[_0x4ee6('0x1f')](_0x595b3c);return _0xca1b8c['set']('Content-Range',_0x46aa01+'-'+_0x266cd1+'/'+_0x482b3b)[_0x4ee6('0x20')](_0x44489a);}return null;};}function patchUpdates(_0x190437){return function(_0x495f5a){try{jsonpatch['apply'](_0x495f5a,_0x190437,!![]);}catch(_0x53b568){return BPromise[_0x4ee6('0x25')](_0x53b568);}return _0x495f5a[_0x4ee6('0x26')]();};}function saveUpdates(_0x289398,_0xffe4b9){return function(_0x420b96){if(_0x420b96){return _0x420b96[_0x4ee6('0x27')](_0x289398)['then'](function(_0x436c95){return _0x436c95;});}return null;};}function removeEntity(_0x27935b,_0x350a72){return function(_0x91a645){if(_0x91a645){return _0x91a645['destroy']()[_0x4ee6('0x28')](function(){var _0xf60abc=_0x91a645[_0x4ee6('0x29')]({'plain':!![]});var _0x4cbbd3=_0x4ee6('0x2a');return db[_0x4ee6('0x2b')]['destroy']({'where':{'type':_0x4cbbd3,'resourceId':_0xf60abc['id']}})[_0x4ee6('0x28')](function(){return _0x91a645;});})[_0x4ee6('0x28')](function(){_0x27935b[_0x4ee6('0x1f')](0xcc)[_0x4ee6('0x2c')]();});}};}function handleEntityNotFound(_0x15e67a,_0x5e2e60){return function(_0x4848bd){if(!_0x4848bd){_0x15e67a[_0x4ee6('0x1e')](0x194);}return _0x4848bd;};}function handleError(_0xe0ecc1,_0xaefae2){_0xaefae2=_0xaefae2||0x1f4;return function(_0x40a877){logger[_0x4ee6('0x2d')](_0x40a877[_0x4ee6('0x2e')]);if(_0x40a877[_0x4ee6('0x2f')]){delete _0x40a877[_0x4ee6('0x2f')];}_0xe0ecc1[_0x4ee6('0x1f')](_0xaefae2)[_0x4ee6('0x30')](_0x40a877);};}exports[_0x4ee6('0x31')]=function(_0x20ebea,_0x3b272c){var _0x5709a4={},_0x2cdc7f={},_0x2313c4={'count':0x0,'rows':[]};var _0x44f5cb=_[_0x4ee6('0x32')](db['Dashboard'][_0x4ee6('0x33')],function(_0x41e139){return{'name':_0x41e139[_0x4ee6('0x34')],'type':_0x41e139[_0x4ee6('0x35')][_0x4ee6('0x36')]};});_0x2cdc7f[_0x4ee6('0x37')]=_[_0x4ee6('0x32')](_0x44f5cb,_0x4ee6('0x2f'));_0x2cdc7f[_0x4ee6('0x38')]=_[_0x4ee6('0x39')](_0x20ebea[_0x4ee6('0x38')]);_0x2cdc7f[_0x4ee6('0x3a')]=_[_0x4ee6('0x3b')](_0x2cdc7f[_0x4ee6('0x37')],_0x2cdc7f['query']);_0x5709a4[_0x4ee6('0x3c')]=_['intersection'](_0x2cdc7f[_0x4ee6('0x37')],qs[_0x4ee6('0x3d')](_0x20ebea[_0x4ee6('0x38')]['fields']));_0x5709a4['attributes']=_0x5709a4[_0x4ee6('0x3c')]['length']?_0x5709a4['attributes']:_0x2cdc7f[_0x4ee6('0x37')];if(!_0x20ebea[_0x4ee6('0x38')][_0x4ee6('0x3e')]('nolimit')){_0x5709a4[_0x4ee6('0x22')]=qs['limit'](_0x20ebea[_0x4ee6('0x38')][_0x4ee6('0x22')]);_0x5709a4[_0x4ee6('0x21')]=qs[_0x4ee6('0x21')](_0x20ebea[_0x4ee6('0x38')][_0x4ee6('0x21')]);}_0x5709a4[_0x4ee6('0x3f')]=qs[_0x4ee6('0x40')](_0x20ebea[_0x4ee6('0x38')][_0x4ee6('0x40')]);_0x5709a4[_0x4ee6('0x41')]=qs[_0x4ee6('0x3a')](_['pick'](_0x20ebea['query'],_0x2cdc7f['filters']),_0x44f5cb);if(_0x20ebea['query'][_0x4ee6('0x42')]){_0x5709a4['where']=_['merge'](_0x5709a4[_0x4ee6('0x41')],{'$or':_[_0x4ee6('0x32')](_0x44f5cb,function(_0x3cf27e){if(_0x3cf27e[_0x4ee6('0x35')]!==_0x4ee6('0x43')){var _0x474028={};_0x474028[_0x3cf27e[_0x4ee6('0x2f')]]={'$like':'%'+_0x20ebea[_0x4ee6('0x38')][_0x4ee6('0x42')]+'%'};return _0x474028;}})});}_0x5709a4=_[_0x4ee6('0x44')]({},_0x5709a4,_0x20ebea[_0x4ee6('0x45')]);var _0x548273={'where':_0x5709a4[_0x4ee6('0x41')]};return db[_0x4ee6('0x46')][_0x4ee6('0x24')](_0x548273)[_0x4ee6('0x28')](function(_0x26f8c8){_0x2313c4[_0x4ee6('0x24')]=_0x26f8c8;if(_0x20ebea[_0x4ee6('0x38')][_0x4ee6('0x47')]){_0x5709a4[_0x4ee6('0x48')]=[{'all':!![]}];}return db[_0x4ee6('0x46')][_0x4ee6('0x49')](_0x5709a4);})[_0x4ee6('0x28')](function(_0x166330){_0x2313c4['rows']=_0x166330;return _0x2313c4;})['then'](respondWithFilteredResult(_0x3b272c,_0x5709a4))[_0x4ee6('0x4a')](handleError(_0x3b272c,null));};exports[_0x4ee6('0x4b')]=function(_0x132dae,_0x4bd78c){var _0xa36f5c={'raw':![],'where':{'id':_0x132dae[_0x4ee6('0x4c')]['id']}},_0x478461={};_0x478461[_0x4ee6('0x37')]=_[_0x4ee6('0x39')](db[_0x4ee6('0x46')][_0x4ee6('0x33')]);_0x478461['query']=_[_0x4ee6('0x39')](_0x132dae[_0x4ee6('0x38')]);_0x478461['filters']=_[_0x4ee6('0x3b')](_0x478461[_0x4ee6('0x37')],_0x478461[_0x4ee6('0x38')]);_0xa36f5c[_0x4ee6('0x3c')]=_[_0x4ee6('0x3b')](_0x478461[_0x4ee6('0x37')],qs[_0x4ee6('0x3d')](_0x132dae[_0x4ee6('0x38')][_0x4ee6('0x3d')]));_0xa36f5c[_0x4ee6('0x3c')]=_0xa36f5c['attributes'][_0x4ee6('0x4d')]?_0xa36f5c[_0x4ee6('0x3c')]:_0x478461['model'];if(_0x132dae[_0x4ee6('0x38')]['includeAll']){_0xa36f5c[_0x4ee6('0x48')]=[{'all':!![]}];}_0xa36f5c=_[_0x4ee6('0x44')]({},_0xa36f5c,_0x132dae[_0x4ee6('0x45')]);return db['Dashboard']['find'](_0xa36f5c)[_0x4ee6('0x28')](handleEntityNotFound(_0x4bd78c,null))[_0x4ee6('0x28')](respondWithResult(_0x4bd78c,null))[_0x4ee6('0x4a')](handleError(_0x4bd78c,null));};exports['create']=function(_0xcd1193,_0x14becb){return db[_0x4ee6('0x46')][_0x4ee6('0x4e')](_0xcd1193[_0x4ee6('0x4f')],{})[_0x4ee6('0x28')](function(_0x548dd4){var _0x1f1769=_0xcd1193[_0x4ee6('0x50')]['get']({'plain':!![]});if(!_0x1f1769)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f1769[_0x4ee6('0x51')]===_0x4ee6('0x50')){var _0xb73793=_0x548dd4['get']({'plain':!![]});var _0xee846f=_0x4ee6('0x2a');return db[_0x4ee6('0x52')][_0x4ee6('0x53')]({'where':{'name':_0xee846f,'userProfileId':_0x1f1769[_0x4ee6('0x54')]},'raw':!![]})[_0x4ee6('0x28')](function(_0x2b90d7){if(_0x2b90d7&&_0x2b90d7[_0x4ee6('0x55')]===0x0){return db[_0x4ee6('0x2b')][_0x4ee6('0x4e')]({'name':_0xb73793[_0x4ee6('0x2f')],'resourceId':_0xb73793['id'],'type':_0x2b90d7[_0x4ee6('0x2f')],'sectionId':_0x2b90d7['id']},{})[_0x4ee6('0x28')](function(){return _0x548dd4;});}else{return _0x548dd4;}})[_0x4ee6('0x4a')](function(_0x361a8a){logger[_0x4ee6('0x2d')](_0x4ee6('0x56'),_0x361a8a);throw _0x361a8a;});}return _0x548dd4;})[_0x4ee6('0x28')](respondWithResult(_0x14becb,0xc9))[_0x4ee6('0x4a')](handleError(_0x14becb,null));};exports[_0x4ee6('0x57')]=function(_0x2e71bd,_0x40086c){var _0x58d3a1={'where':{'id':_0x2e71bd[_0x4ee6('0x4c')]['id']}},_0x574fb1={};_0x574fb1[_0x4ee6('0x37')]=_['keys'](db[_0x4ee6('0x46')][_0x4ee6('0x33')]);_0x58d3a1['attributes']=_[_0x4ee6('0x3b')](_0x574fb1[_0x4ee6('0x37')],qs[_0x4ee6('0x3d')](_0x2e71bd['query'][_0x4ee6('0x3d')]));_0x58d3a1['attributes']=_0x58d3a1['attributes'][_0x4ee6('0x4d')]?_0x58d3a1[_0x4ee6('0x3c')]:_0x574fb1[_0x4ee6('0x37')];if(_0x2e71bd[_0x4ee6('0x38')][_0x4ee6('0x47')]){_0x58d3a1[_0x4ee6('0x48')]=[{'all':!![]}];}_0x58d3a1=_[_0x4ee6('0x44')]({},_0x58d3a1,_0x2e71bd['options']);return db['Dashboard']['find'](_0x58d3a1)[_0x4ee6('0x28')](handleEntityNotFound(_0x40086c,null))[_0x4ee6('0x28')](function(_0x5892ec){if(_0x5892ec){var _0x5f1a7f=_0x5892ec[_0x4ee6('0x29')]({'plain':!![]});_0x5f1a7f=qs[_0x4ee6('0x58')](_0x5f1a7f,['id','createdAt',_0x4ee6('0x59')]);_0x2e71bd[_0x4ee6('0x4f')]=_['omit'](_0x2e71bd['body'],['id',_0x4ee6('0x5a'),_0x4ee6('0x59')]);return db['Dashboard']['create'](_[_0x4ee6('0x44')](_0x5f1a7f,_0x2e71bd[_0x4ee6('0x4f')]),{'include':_0x2e71bd[_0x4ee6('0x38')][_0x4ee6('0x47')]?[{'all':!![]}]:undefined})[_0x4ee6('0x28')](function(_0x465cda){var _0x650594=_0x2e71bd['user'][_0x4ee6('0x29')]({'plain':!![]});if(!_0x650594)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x650594[_0x4ee6('0x51')]===_0x4ee6('0x50')){var _0x406e8a=_0x465cda[_0x4ee6('0x29')]({'plain':!![]});var _0x46e038=_0x4ee6('0x2a');return db[_0x4ee6('0x52')][_0x4ee6('0x53')]({'where':{'name':_0x46e038,'userProfileId':_0x650594['userProfileId']},'raw':!![]})[_0x4ee6('0x28')](function(_0x478f7d){if(_0x478f7d&&_0x478f7d['autoAssociation']===0x0){return db[_0x4ee6('0x2b')][_0x4ee6('0x4e')]({'name':_0x406e8a['name'],'resourceId':_0x406e8a['id'],'type':_0x478f7d[_0x4ee6('0x2f')],'sectionId':_0x478f7d['id']},{})[_0x4ee6('0x28')](function(){return _0x465cda;});}else{return _0x465cda;}})[_0x4ee6('0x4a')](function(_0xa9d491){logger['error'](_0x4ee6('0x56'),_0xa9d491);throw _0xa9d491;});}return _0x465cda;});}})['then'](respondWithResult(_0x40086c,0xc9))['catch'](handleError(_0x40086c,null));};exports[_0x4ee6('0x27')]=function(_0x232f7d,_0x37eca1){if(_0x232f7d[_0x4ee6('0x4f')]['id']){delete _0x232f7d['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x232f7d['params']['id']}})['then'](handleEntityNotFound(_0x37eca1,null))[_0x4ee6('0x28')](saveUpdates(_0x232f7d[_0x4ee6('0x4f')],null))[_0x4ee6('0x28')](respondWithResult(_0x37eca1,null))['catch'](handleError(_0x37eca1,null));};exports['destroy']=function(_0x13c1a9,_0x1f2528){return db['Dashboard']['find']({'where':{'id':_0x13c1a9['params']['id']}})[_0x4ee6('0x28')](handleEntityNotFound(_0x1f2528,null))['then'](removeEntity(_0x1f2528,null))['catch'](handleError(_0x1f2528,null));};function widgetAttributes(_0x4f9533){try{switch(_0x4f9533[_0x4ee6('0x35')]){case _0x4ee6('0x5b'):return[{'name':_0x4ee6('0x5c'),'value':_0x4f9533[_0x4ee6('0x5c')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533['attrs'][0x0]?_0x4f9533[_0x4ee6('0x5d')][0x0]['value']:undefined)||_0x4ee6('0x5e')}];case _0x4ee6('0x5f'):return[{'name':_0x4ee6('0x60'),'value':_0x4f9533[_0x4ee6('0x60')]||(_0x4f9533['attrs']&&_0x4f9533[_0x4ee6('0x5d')][0x0]?_0x4f9533[_0x4ee6('0x5d')][0x0][_0x4ee6('0x61')]:undefined)||''}];case'clock':return[{'name':_0x4ee6('0x62'),'value':_0x4f9533[_0x4ee6('0x62')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x0]?_0x4f9533[_0x4ee6('0x5d')][0x0]['value']:undefined)||_0x4ee6('0x63')},{'name':_0x4ee6('0x64'),'value':_0x4f9533[_0x4ee6('0x64')]||(_0x4f9533['attrs']&&_0x4f9533[_0x4ee6('0x5d')][0x1]?_0x4f9533[_0x4ee6('0x5d')][0x1][_0x4ee6('0x61')]:undefined)||_0x4ee6('0x65')},{'name':'attrFontSize','value':_0x4f9533[_0x4ee6('0x66')]||(_0x4f9533['attrs']&&_0x4f9533[_0x4ee6('0x5d')][0x2]?_0x4f9533[_0x4ee6('0x5d')][0x2][_0x4ee6('0x61')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x4f9533[_0x4ee6('0x67')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x0]?_0x4f9533[_0x4ee6('0x5d')][0x0][_0x4ee6('0x61')]:undefined)||_0x4ee6('0x68')},{'name':'attrVoiceQueues','value':_0x4f9533[_0x4ee6('0x69')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x1]?_0x4f9533[_0x4ee6('0x5d')][0x1][_0x4ee6('0x61')]:undefined)||[]},{'name':_0x4ee6('0x66'),'value':_0x4f9533[_0x4ee6('0x66')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x2]?_0x4f9533['attrs'][0x2][_0x4ee6('0x61')]:undefined)||0x14},{'name':_0x4ee6('0x6a'),'value':_0x4f9533['attrChannel']||(_0x4f9533['attrs']&&_0x4f9533[_0x4ee6('0x5d')][0x3]?_0x4f9533['attrs'][0x3][_0x4ee6('0x61')]:undefined)||_0x4ee6('0x6b')},{'name':'attrEmailAccounts','value':_0x4f9533['attrEmailAccounts']||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x4]?_0x4f9533[_0x4ee6('0x5d')][0x4][_0x4ee6('0x61')]:undefined)||''},{'name':_0x4ee6('0x6c'),'value':_0x4f9533['attrFaxAccounts']||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x5]?_0x4f9533['attrs'][0x5][_0x4ee6('0x61')]:undefined)||''},{'name':_0x4ee6('0x6d'),'value':_0x4f9533['attrSmsAccounts']||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x6]?_0x4f9533['attrs'][0x6][_0x4ee6('0x61')]:undefined)||''},{'name':_0x4ee6('0x6e'),'value':_0x4f9533['attrOpenchannelAccounts']||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x7]?_0x4f9533['attrs'][0x7]['value']:undefined)||''},{'name':_0x4ee6('0x6f'),'value':_0x4f9533[_0x4ee6('0x6f')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x8]?_0x4f9533[_0x4ee6('0x5d')][0x8]['value']:undefined)||''},{'name':_0x4ee6('0x70'),'value':_0x4f9533['attrChatWebsites']||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533['attrs'][0x9]?_0x4f9533[_0x4ee6('0x5d')][0x9][_0x4ee6('0x61')]:undefined)||''}];case'multibar-chart':case _0x4ee6('0x71'):return[{'name':_0x4ee6('0x72'),'value':_0x4f9533['attrSerie1']||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x0]?_0x4f9533[_0x4ee6('0x5d')][0x0][_0x4ee6('0x61')]:undefined)||'total'},{'name':_0x4ee6('0x73'),'value':_0x4f9533[_0x4ee6('0x73')]||(_0x4f9533['attrs']&&_0x4f9533[_0x4ee6('0x5d')][0x1]?_0x4f9533[_0x4ee6('0x5d')][0x1][_0x4ee6('0x61')]:undefined)||null},{'name':_0x4ee6('0x74'),'value':_0x4f9533[_0x4ee6('0x74')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x2]?_0x4f9533[_0x4ee6('0x5d')][0x2][_0x4ee6('0x61')]:undefined)||null},{'name':_0x4ee6('0x69'),'value':_0x4f9533[_0x4ee6('0x69')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x3]?_0x4f9533[_0x4ee6('0x5d')][0x3][_0x4ee6('0x61')]:undefined)||[]},{'name':_0x4ee6('0x6a'),'value':_0x4f9533[_0x4ee6('0x6a')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x4]?_0x4f9533[_0x4ee6('0x5d')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x4f9533[_0x4ee6('0x75')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533['attrs'][0x5]?_0x4f9533['attrs'][0x5][_0x4ee6('0x61')]:undefined)||''},{'name':_0x4ee6('0x6c'),'value':_0x4f9533[_0x4ee6('0x6c')]||(_0x4f9533['attrs']&&_0x4f9533['attrs'][0x6]?_0x4f9533[_0x4ee6('0x5d')][0x6]['value']:undefined)||''},{'name':_0x4ee6('0x6d'),'value':_0x4f9533[_0x4ee6('0x6d')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x7]?_0x4f9533[_0x4ee6('0x5d')][0x7][_0x4ee6('0x61')]:undefined)||''},{'name':_0x4ee6('0x6e'),'value':_0x4f9533['attrOpenchannelAccounts']||(_0x4f9533['attrs']&&_0x4f9533[_0x4ee6('0x5d')][0x8]?_0x4f9533[_0x4ee6('0x5d')][0x8][_0x4ee6('0x61')]:undefined)||''},{'name':_0x4ee6('0x6f'),'value':_0x4f9533[_0x4ee6('0x6f')]||(_0x4f9533['attrs']&&_0x4f9533[_0x4ee6('0x5d')][0x9]?_0x4f9533[_0x4ee6('0x5d')][0x9][_0x4ee6('0x61')]:undefined)||''},{'name':_0x4ee6('0x70'),'value':_0x4f9533[_0x4ee6('0x70')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0xa]?_0x4f9533[_0x4ee6('0x5d')][0xa][_0x4ee6('0x61')]:undefined)||''}];case _0x4ee6('0x76'):return[{'name':'attrReport','type':_0x4f9533[_0x4ee6('0x77')]||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x0]?_0x4f9533[_0x4ee6('0x5d')][0x0][_0x4ee6('0x35')]:undefined)||null,'value':_0x4f9533['attrReport']||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x0]?_0x4f9533['attrs'][0x0][_0x4ee6('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x4f9533['attrRefresh']||(_0x4f9533[_0x4ee6('0x5d')]&&_0x4f9533[_0x4ee6('0x5d')][0x1]?_0x4f9533['attrs'][0x1][_0x4ee6('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x194f8c){logger[_0x4ee6('0x2d')](_0x4ee6('0x78'),JSON['stringify'](_0x194f8c));return[];}}exports['addItem']=function(_0x114ea7,_0x1eeeb2,_0x4eb7f9){if(_0x114ea7[_0x4ee6('0x4f')]['id']){delete _0x114ea7[_0x4ee6('0x4f')]['id'];}return db['Dashboard'][_0x4ee6('0x53')]({'where':{'id':_0x114ea7[_0x4ee6('0x4c')]['id']}})[_0x4ee6('0x28')](handleEntityNotFound(_0x1eeeb2,null))[_0x4ee6('0x28')](function(_0xdfbad0){if(_0xdfbad0){_0x114ea7[_0x4ee6('0x4f')][_0x4ee6('0x79')]=_0xdfbad0['id'];_0x114ea7['body']['attrs']=widgetAttributes(_0x114ea7[_0x4ee6('0x4f')]);return db['DashboardItem']['create'](_0x114ea7[_0x4ee6('0x4f')]);}})[_0x4ee6('0x28')](respondWithResult(_0x1eeeb2,null))[_0x4ee6('0x4a')](handleError(_0x1eeeb2,null));};exports['getItems']=function(_0x35023f,_0x6b2100,_0x184411){var _0x577c62={};var _0x594930={};var _0xf9a9e;var _0x35ecce;return db[_0x4ee6('0x46')][_0x4ee6('0x7a')]({'where':{'id':_0x35023f['params']['id']}})[_0x4ee6('0x28')](handleEntityNotFound(_0x6b2100,null))[_0x4ee6('0x28')](function(_0x3fb168){if(_0x3fb168){_0xf9a9e=_0x3fb168;_0x594930[_0x4ee6('0x37')]=_[_0x4ee6('0x39')](db['DashboardItem'][_0x4ee6('0x33')]);_0x594930[_0x4ee6('0x38')]=_[_0x4ee6('0x39')](_0x35023f[_0x4ee6('0x38')]);_0x594930['filters']=_[_0x4ee6('0x3b')](_0x594930[_0x4ee6('0x37')],_0x594930[_0x4ee6('0x38')]);_0x577c62[_0x4ee6('0x3c')]=_['intersection'](_0x594930[_0x4ee6('0x37')],qs[_0x4ee6('0x3d')](_0x35023f[_0x4ee6('0x38')][_0x4ee6('0x3d')]));_0x577c62[_0x4ee6('0x3c')]=_0x577c62[_0x4ee6('0x3c')]['length']?_0x577c62[_0x4ee6('0x3c')]:_0x594930['model'];_0x577c62['order']=qs[_0x4ee6('0x40')](_0x35023f[_0x4ee6('0x38')]['sort']);_0x577c62['where']=qs[_0x4ee6('0x3a')](_[_0x4ee6('0x7b')](_0x35023f['query'],_0x594930[_0x4ee6('0x3a')]));if(_0x35023f[_0x4ee6('0x38')][_0x4ee6('0x42')]){_0x577c62['where']=_['merge'](_0x577c62[_0x4ee6('0x41')],{'$or':_[_0x4ee6('0x32')](_0x577c62[_0x4ee6('0x3c')],function(_0x4bfc3d){var _0x4dd0aa={};_0x4dd0aa[_0x4bfc3d]={'$like':'%'+_0x35023f[_0x4ee6('0x38')][_0x4ee6('0x42')]+'%'};return _0x4dd0aa;})});}_0x577c62=_[_0x4ee6('0x44')]({},_0x577c62,_0x35023f[_0x4ee6('0x45')]);return _0xf9a9e['getItems'](_0x577c62);}})['then'](function(_0x413324){if(_0x413324){_0x35ecce=_0x413324[_0x4ee6('0x4d')];if(!_0x35023f[_0x4ee6('0x38')][_0x4ee6('0x3e')](_0x4ee6('0x7c'))){_0x577c62[_0x4ee6('0x22')]=qs[_0x4ee6('0x22')](_0x35023f[_0x4ee6('0x38')][_0x4ee6('0x22')]);_0x577c62[_0x4ee6('0x21')]=qs[_0x4ee6('0x21')](_0x35023f[_0x4ee6('0x38')]['offset']);}return _0xf9a9e['getItems'](_0x577c62);}})[_0x4ee6('0x28')](function(_0x2c1838){if(_0x2c1838){return _0x2c1838?{'count':_0x35ecce,'rows':_0x2c1838}:null;}})[_0x4ee6('0x28')](respondWithResult(_0x6b2100,null))[_0x4ee6('0x4a')](handleError(_0x6b2100,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e4a299a..55a127d 100644 --- a/server/api/dashboard/dashboard.events.js +++ b/server/api/dashboard/dashboard.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b8f=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4b8f,0x66));var _0xf4b8=function(_0x2e911b,_0x50e801){_0x2e911b=_0x2e911b-0x0;var _0x24d065=_0x4b8f[_0x2e911b];return _0x24d065;};'use strict';var EventEmitter=require(_0xf4b8('0x0'));var Dashboard=require(_0xf4b8('0x1'))['db'][_0xf4b8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf4b8('0x3')](0x0);var events={'afterCreate':_0xf4b8('0x4'),'afterUpdate':_0xf4b8('0x5'),'afterDestroy':_0xf4b8('0x6')};function emitEvent(_0x3340b8){return function(_0x3bfd74,_0x9b0572,_0x45623e){DashboardEvents[_0xf4b8('0x7')](_0x3340b8+':'+_0x3bfd74['id'],_0x3bfd74);DashboardEvents[_0xf4b8('0x7')](_0x3340b8,_0x3bfd74);_0x45623e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xf4b8('0x8')](e,emitEvent(event));}}module[_0xf4b8('0x9')]=DashboardEvents; \ No newline at end of file +var _0x85e6=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x9ebe65,_0x44c6f1){var _0x5d895e=function(_0x293b4a){while(--_0x293b4a){_0x9ebe65['push'](_0x9ebe65['shift']());}};_0x5d895e(++_0x44c6f1);}(_0x85e6,0x1a5));var _0x685e=function(_0x17b2f9,_0x53a6cf){_0x17b2f9=_0x17b2f9-0x0;var _0x49a1b3=_0x85e6[_0x17b2f9];return _0x49a1b3;};'use strict';var EventEmitter=require(_0x685e('0x0'));var Dashboard=require(_0x685e('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x685e('0x2')](0x0);var events={'afterCreate':_0x685e('0x3'),'afterUpdate':'update','afterDestroy':_0x685e('0x4')};function emitEvent(_0xe95f5d){return function(_0x438489,_0x53630e,_0x1cdf9d){DashboardEvents['emit'](_0xe95f5d+':'+_0x438489['id'],_0x438489);DashboardEvents[_0x685e('0x5')](_0xe95f5d,_0x438489);_0x1cdf9d(null);};}for(var e in events){if(events[_0x685e('0x6')](e)){var event=events[e];Dashboard[_0x685e('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8348e7f..d0904a8 100644 --- a/server/api/dashboard/dashboard.model.js +++ b/server/api/dashboard/dashboard.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a17=['exports','define','Dashboard','dashboards','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x4bb2ae,_0x4cde3b){var _0x38eefd=function(_0x13f023){while(--_0x13f023){_0x4bb2ae['push'](_0x4bb2ae['shift']());}};_0x38eefd(++_0x4cde3b);}(_0x0a17,0x130));var _0x70a1=function(_0x4b3076,_0x3de49d){_0x4b3076=_0x4b3076-0x0;var _0x3cba6c=_0x0a17[_0x4b3076];return _0x3cba6c;};'use strict';var _=require('lodash');var util=require(_0x70a1('0x0'));var logger=require(_0x70a1('0x1'))('api');var moment=require(_0x70a1('0x2'));var BPromise=require(_0x70a1('0x3'));var rp=require(_0x70a1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70a1('0x5'));var config=require(_0x70a1('0x6'));var attributes=require(_0x70a1('0x7'));module[_0x70a1('0x8')]=function(_0x5930cc,_0x51d6ff){return _0x5930cc[_0x70a1('0x9')](_0x70a1('0xa'),attributes,{'tableName':_0x70a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8ff=['define','Dashboard','dashboards','lodash','bluebird','path','./dashboard.attributes','exports'];(function(_0x5e1e4c,_0xe5e9c2){var _0x16183c=function(_0x1e41cd){while(--_0x1e41cd){_0x5e1e4c['push'](_0x5e1e4c['shift']());}};_0x16183c(++_0xe5e9c2);}(_0xa8ff,0x1ab));var _0xfa8f=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa8ff[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0xfa8f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfa8f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa8f('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa8f('0x3'));module[_0xfa8f('0x4')]=function(_0x5cdf23,_0x1dcc61){return _0x5cdf23[_0xfa8f('0x5')](_0xfa8f('0x6'),attributes,{'tableName':_0xfa8f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index a70e548..5b537bf 100644 --- a/server/api/dashboard/dashboard.rpc.js +++ b/server/api/dashboard/dashboard.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa35b=['request\x20sent','debug','error','code','Dashboard,\x20%s,\x20%s','message','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','register','info'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xa35b,0x16e));var _0xba35=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa35b[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xba35('0x0'));var moment=require('moment');var BPromise=require(_0xba35('0x1'));var rs=require(_0xba35('0x2'));var fs=require('fs');var Redis=require(_0xba35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xba35('0x4'));var logger=require(_0xba35('0x5'))(_0xba35('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xba35('0x7')][_0xba35('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xba35('0x9')],{'host':_0xba35('0xa'),'port':0x18eb});var socket=require(_0xba35('0xb'))(new Redis(config[_0xba35('0x9')]));require('./dashboard.socket')[_0xba35('0xc')](socket);function respondWithRpcPromise(_0x316940,_0x14d77a,_0x314fdd){return new BPromise(function(_0x1e8586,_0x4efa1b){return client['request'](_0x316940,_0x314fdd)['then'](function(_0x27c5cd){logger[_0xba35('0xd')]('Dashboard,\x20%s,\x20%s',_0x14d77a,_0xba35('0xe'));logger[_0xba35('0xf')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x14d77a,_0xba35('0xe'),JSON['stringify'](_0x27c5cd));if(_0x27c5cd['error']){if(_0x27c5cd[_0xba35('0x10')][_0xba35('0x11')]===0x1f4){logger[_0xba35('0x10')](_0xba35('0x12'),_0x14d77a,_0x27c5cd[_0xba35('0x10')][_0xba35('0x13')]);return _0x4efa1b(_0x27c5cd['error'][_0xba35('0x13')]);}logger[_0xba35('0x10')](_0xba35('0x12'),_0x14d77a,_0x27c5cd['error'][_0xba35('0x13')]);return _0x1e8586(_0x27c5cd[_0xba35('0x10')][_0xba35('0x13')]);}else{logger['info'](_0xba35('0x12'),_0x14d77a,_0xba35('0xe'));_0x1e8586(_0x27c5cd['result']['message']);}})['catch'](function(_0x1202de){logger[_0xba35('0x10')](_0xba35('0x12'),_0x14d77a,_0x1202de);_0x4efa1b(_0x1202de);});});} \ No newline at end of file +var _0x5fe5=['redis','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','socket.io-emitter'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x5fe5,0x9d));var _0x55fe=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x5fe5[_0x210718];return _0x541bfc;};'use strict';var _=require('lodash');var util=require(_0x55fe('0x0'));var moment=require(_0x55fe('0x1'));var BPromise=require(_0x55fe('0x2'));var rs=require(_0x55fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55fe('0x4'))['db'];var utils=require(_0x55fe('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x55fe('0x6'));var client=jayson[_0x55fe('0x7')][_0x55fe('0x8')]({'port':0x232a});config['redis']=_[_0x55fe('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x55fe('0xa'))(new Redis(config[_0x55fe('0xb')]));require(_0x55fe('0xc'))[_0x55fe('0xd')](socket);function respondWithRpcPromise(_0x3f27e2,_0x52944d,_0x233899){return new BPromise(function(_0x1e161f,_0x34c92a){return client['request'](_0x3f27e2,_0x233899)[_0x55fe('0xe')](function(_0x39a212){logger[_0x55fe('0xf')](_0x55fe('0x10'),_0x52944d,_0x55fe('0x11'));logger[_0x55fe('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x52944d,_0x55fe('0x11'),JSON[_0x55fe('0x13')](_0x39a212));if(_0x39a212[_0x55fe('0x14')]){if(_0x39a212['error'][_0x55fe('0x15')]===0x1f4){logger['error'](_0x55fe('0x10'),_0x52944d,_0x39a212['error']['message']);return _0x34c92a(_0x39a212[_0x55fe('0x14')][_0x55fe('0x16')]);}logger[_0x55fe('0x14')]('Dashboard,\x20%s,\x20%s',_0x52944d,_0x39a212['error'][_0x55fe('0x16')]);return _0x1e161f(_0x39a212[_0x55fe('0x14')]['message']);}else{logger['info'](_0x55fe('0x10'),_0x52944d,_0x55fe('0x11'));_0x1e161f(_0x39a212['result'][_0x55fe('0x16')]);}})[_0x55fe('0x17')](function(_0x31e0ae){logger['error'](_0x55fe('0x10'),_0x52944d,_0x31e0ae);_0x34c92a(_0x31e0ae);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 25a284e..3e1c5c6 100644 --- a/server/api/dashboard/dashboard.socket.js +++ b/server/api/dashboard/dashboard.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1009=['save','remove','update','emit','removeListener','register','dashboard:','./dashboard.events'];(function(_0xd29952,_0x353ba8){var _0x3cd62d=function(_0x2915c4){while(--_0x2915c4){_0xd29952['push'](_0xd29952['shift']());}};_0x3cd62d(++_0x353ba8);}(_0x1009,0x67));var _0x9100=function(_0x1edc91,_0x62fdf8){_0x1edc91=_0x1edc91-0x0;var _0x52b884=_0x1009[_0x1edc91];return _0x52b884;};'use strict';var DashboardEvents=require(_0x9100('0x0'));var events=[_0x9100('0x1'),_0x9100('0x2'),_0x9100('0x3')];function createListener(_0xa3e78b,_0x27932f){return function(_0x5e06be){_0x27932f[_0x9100('0x4')](_0xa3e78b,_0x5e06be);};}function removeListener(_0x4715f4,_0x41bdac){return function(){DashboardEvents[_0x9100('0x5')](_0x4715f4,_0x41bdac);};}exports[_0x9100('0x6')]=function(_0x4297c7){for(var _0x697401=0x0,_0xe6e71d=events['length'];_0x697401<_0xe6e71d;_0x697401++){var _0x5b54c4=events[_0x697401];var _0x263109=createListener(_0x9100('0x7')+_0x5b54c4,_0x4297c7);DashboardEvents['on'](_0x5b54c4,_0x263109);}}; \ No newline at end of file +var _0x44f3=['emit','register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x2727c0,_0x2520c7){var _0x2ffc0b=function(_0x1761cd){while(--_0x1761cd){_0x2727c0['push'](_0x2727c0['shift']());}};_0x2ffc0b(++_0x2520c7);}(_0x44f3,0xdc));var _0x344f=function(_0x13ae4f,_0x12817a){_0x13ae4f=_0x13ae4f-0x0;var _0x2d8a9b=_0x44f3[_0x13ae4f];return _0x2d8a9b;};'use strict';var DashboardEvents=require(_0x344f('0x0'));var events=[_0x344f('0x1'),_0x344f('0x2'),_0x344f('0x3')];function createListener(_0x14bd61,_0x1cabb4){return function(_0x1556ea){_0x1cabb4[_0x344f('0x4')](_0x14bd61,_0x1556ea);};}function removeListener(_0x17babb,_0x101848){return function(){DashboardEvents['removeListener'](_0x17babb,_0x101848);};}exports[_0x344f('0x5')]=function(_0x562688){for(var _0x4981a2=0x0,_0x16cb7a=events[_0x344f('0x6')];_0x4981a2<_0x16cb7a;_0x4981a2++){var _0x1c1bd6=events[_0x4981a2];var _0x570d4a=createListener(_0x344f('0x7')+_0x1c1bd6,_0x562688);DashboardEvents['on'](_0x1c1bd6,_0x570d4a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2f2c49a..0b70cc9 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bd3=['index','get','/:id','isAuthenticated','show','getItems','post','create','/:id/clone','/:id/items','addItem','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0x4b5284,_0x1d73f0){var _0x2bd3d5=function(_0x53ed12){while(--_0x53ed12){_0x4b5284['push'](_0x4b5284['shift']());}};_0x2bd3d5(++_0x1d73f0);}(_0x4bd3,0x1bf));var _0x34bd=function(_0x4533b5,_0x3aac5d){_0x4533b5=_0x4533b5-0x0;var _0x49c2df=_0x4bd3[_0x4533b5];return _0x49c2df;};'use strict';var multer=require(_0x34bd('0x0'));var util=require(_0x34bd('0x1'));var path=require(_0x34bd('0x2'));var timeout=require(_0x34bd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x34bd('0x4'));var auth=require(_0x34bd('0x5'));var interaction=require(_0x34bd('0x6'));var config=require(_0x34bd('0x7'));var controller=require(_0x34bd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x34bd('0x9')]);router[_0x34bd('0xa')](_0x34bd('0xb'),auth[_0x34bd('0xc')](),controller[_0x34bd('0xd')]);router[_0x34bd('0xa')]('/:id/items',auth['isAuthenticated'](),controller[_0x34bd('0xe')]);router[_0x34bd('0xf')]('/',auth[_0x34bd('0xc')](),controller[_0x34bd('0x10')]);router[_0x34bd('0xf')](_0x34bd('0x11'),auth[_0x34bd('0xc')](),controller['clone']);router[_0x34bd('0xf')](_0x34bd('0x12'),auth[_0x34bd('0xc')](),controller[_0x34bd('0x13')]);router['put'](_0x34bd('0xb'),auth[_0x34bd('0xc')](),controller[_0x34bd('0x14')]);router[_0x34bd('0x15')](_0x34bd('0xb'),auth[_0x34bd('0xc')](),controller[_0x34bd('0x16')]);module[_0x34bd('0x17')]=router; \ No newline at end of file +var _0x61b4=['../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','post','/:id/clone','clone','addItem','/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xecdab5,_0x284b5c){var _0xa98503=function(_0x50896d){while(--_0x50896d){_0xecdab5['push'](_0xecdab5['shift']());}};_0xa98503(++_0x284b5c);}(_0x61b4,0x163));var _0x461b=function(_0x16a42b,_0x2d9468){_0x16a42b=_0x16a42b-0x0;var _0x1feccb=_0x61b4[_0x16a42b];return _0x1feccb;};'use strict';var multer=require(_0x461b('0x0'));var util=require(_0x461b('0x1'));var path=require(_0x461b('0x2'));var timeout=require(_0x461b('0x3'));var express=require('express');var router=express[_0x461b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x461b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x461b('0x6'));var controller=require(_0x461b('0x7'));router[_0x461b('0x8')]('/',auth[_0x461b('0x9')](),controller[_0x461b('0xa')]);router[_0x461b('0x8')]('/:id',auth[_0x461b('0x9')](),controller[_0x461b('0xb')]);router['get'](_0x461b('0xc'),auth['isAuthenticated'](),controller['getItems']);router[_0x461b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x461b('0xd')](_0x461b('0xe'),auth['isAuthenticated'](),controller[_0x461b('0xf')]);router[_0x461b('0xd')](_0x461b('0xc'),auth[_0x461b('0x9')](),controller[_0x461b('0x10')]);router['put'](_0x461b('0x11'),auth[_0x461b('0x9')](),controller['update']);router['delete'](_0x461b('0x11'),auth[_0x461b('0x9')](),controller['destroy']);module[_0x461b('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index bf72d34..2ffa037 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0x2542,0x169));var _0x2254=function(_0x543662,_0x4d1d60){_0x543662=_0x543662-0x0;var _0x56e2fe=_0x2542[_0x543662];return _0x56e2fe;};'use strict';var Sequelize=require(_0x2254('0x0'));var squel=require(_0x2254('0x1'));var _=require(_0x2254('0x2'));module[_0x2254('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x2254('0x5')),'get':function(){try{return JSON[_0x2254('0x6')](this[_0x2254('0x7')](_0x2254('0x8')));}catch(_0x76c902){return[];}},'set':function(_0x508183){try{this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')](_0x508183));}catch(_0x3c45ec){this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2254('0xb')]},'col':{'type':Sequelize[_0x2254('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2254('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2254('0x4')],'allowNull':![],'defaultValue':_0x2254('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2254('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x3f8a=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','long'];(function(_0x434ab9,_0x2c3eef){var _0x2ca0d9=function(_0x1bf939){while(--_0x1bf939){_0x434ab9['push'](_0x434ab9['shift']());}};_0x2ca0d9(++_0x2c3eef);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x46d6c2,_0x40ec16){_0x46d6c2=_0x46d6c2-0x0;var _0x22544f=_0x3f8a[_0x46d6c2];return _0x22544f;};'use strict';var Sequelize=require(_0xa3f8('0x0'));var squel=require(_0xa3f8('0x1'));var _=require(_0xa3f8('0x2'));module[_0xa3f8('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa3f8('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa3f8('0x5')](_0xa3f8('0x6')),'get':function(){try{return JSON[_0xa3f8('0x7')](this[_0xa3f8('0x8')](_0xa3f8('0x9')));}catch(_0x39d2e4){return[];}},'set':function(_0x471464){try{this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')](_0x471464));}catch(_0x268332){this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xa3f8('0xc')]},'background':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':_0xa3f8('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa3f8('0x4')]},'titleFontSize':{'type':Sequelize[_0xa3f8('0xc')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 799c901..67039e8 100644 --- a/server/api/dashboardItem/dashboardItem.controller.js +++ b/server/api/dashboardItem/dashboardItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3714=['send','show','params','model','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','merge','options','find','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','error','stringify','body','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name'];(function(_0x288faf,_0x483b0c){var _0x4d931f=function(_0x30c0f8){while(--_0x30c0f8){_0x288faf['push'](_0x288faf['shift']());}};_0x4d931f(++_0x483b0c);}(_0x3714,0x95));var _0x4371=function(_0x1033c6,_0x18bbd1){_0x1033c6=_0x1033c6-0x0;var _0x216169=_0x3714[_0x1033c6];return _0x216169;};'use strict';var emlformat=require(_0x4371('0x0'));var rimraf=require(_0x4371('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4371('0x2'));var rp=require(_0x4371('0x3'));var moment=require(_0x4371('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4371('0x5'));var util=require(_0x4371('0x6'));var path=require(_0x4371('0x7'));var sox=require('sox');var csv=require(_0x4371('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4371('0x9'));var _=require(_0x4371('0xa'));var squel=require('squel');var crypto=require(_0x4371('0xb'));var jsforce=require(_0x4371('0xc'));var deskjs=require(_0x4371('0xd'));var toCsv=require(_0x4371('0x8'));var querystring=require('querystring');var Papa=require(_0x4371('0xe'));var Redis=require('ioredis');var authService=require(_0x4371('0xf'));var qs=require(_0x4371('0x10'));var as=require(_0x4371('0x11'));var hardwareService=require(_0x4371('0x12'));var logger=require('../../config/logger')(_0x4371('0x13'));var utils=require(_0x4371('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4371('0x15'));var db=require(_0x4371('0x16'))['db'];config[_0x4371('0x17')]=_[_0x4371('0x18')](config[_0x4371('0x17')],{'host':_0x4371('0x19'),'port':0x18eb});var socket=require(_0x4371('0x1a'))(new Redis(config[_0x4371('0x17')]));require(_0x4371('0x1b'))[_0x4371('0x1c')](socket);function respondWithStatusCode(_0xf2c4e0,_0x4a1a9e){_0x4a1a9e=_0x4a1a9e||0xcc;return function(_0x247f07){if(_0x247f07){return _0xf2c4e0[_0x4371('0x1d')](_0x4a1a9e);}return _0xf2c4e0[_0x4371('0x1e')](_0x4a1a9e)['end']();};}function respondWithResult(_0x1adca6,_0xe404d9){_0xe404d9=_0xe404d9||0xc8;return function(_0x27f864){if(_0x27f864){return _0x1adca6[_0x4371('0x1e')](_0xe404d9)[_0x4371('0x1f')](_0x27f864);}};}function respondWithFilteredResult(_0x41a55f,_0x2c152d){return function(_0x12dc62){if(_0x12dc62){var _0x305242=typeof _0x2c152d[_0x4371('0x20')]===_0x4371('0x21')&&typeof _0x2c152d[_0x4371('0x22')]===_0x4371('0x21');var _0x5c7c42=_0x12dc62[_0x4371('0x23')];var _0x2f3ba7=_0x305242?0x0:_0x2c152d[_0x4371('0x20')];var _0x2a90a7=_0x305242?_0x12dc62[_0x4371('0x23')]:_0x2c152d['offset']+_0x2c152d['limit'];var _0x596eeb;if(_0x2a90a7>=_0x5c7c42){_0x2a90a7=_0x5c7c42;_0x596eeb=0xc8;}else{_0x596eeb=0xce;}_0x41a55f[_0x4371('0x1e')](_0x596eeb);return _0x41a55f['set'](_0x4371('0x24'),_0x2f3ba7+'-'+_0x2a90a7+'/'+_0x5c7c42)[_0x4371('0x1f')](_0x12dc62);}return null;};}function patchUpdates(_0x3b89a8){return function(_0x2ddff4){try{jsonpatch[_0x4371('0x25')](_0x2ddff4,_0x3b89a8,!![]);}catch(_0x344a3d){return BPromise[_0x4371('0x26')](_0x344a3d);}return _0x2ddff4[_0x4371('0x27')]();};}function saveUpdates(_0x3eaddc,_0xf4e370){return function(_0x154dff){if(_0x154dff){return _0x154dff[_0x4371('0x28')](_0x3eaddc)[_0x4371('0x29')](function(_0x3819d0){return _0x3819d0;});}return null;};}function removeEntity(_0x124e2e,_0x4f40a0){return function(_0x1c6dca){if(_0x1c6dca){return _0x1c6dca['destroy']()[_0x4371('0x29')](function(){_0x124e2e[_0x4371('0x1e')](0xcc)[_0x4371('0x2a')]();});}};}function handleEntityNotFound(_0x179045,_0x303fb6){return function(_0x342133){if(!_0x342133){_0x179045['sendStatus'](0x194);}return _0x342133;};}function handleError(_0x54b4ec,_0x137d76){_0x137d76=_0x137d76||0x1f4;return function(_0x2414ba){logger['error'](_0x2414ba[_0x4371('0x2b')]);if(_0x2414ba[_0x4371('0x2c')]){delete _0x2414ba[_0x4371('0x2c')];}_0x54b4ec[_0x4371('0x1e')](_0x137d76)[_0x4371('0x2d')](_0x2414ba);};}exports[_0x4371('0x2e')]=function(_0x3e3839,_0x3d6d59){var _0x33700b={'raw':![],'where':{'id':_0x3e3839[_0x4371('0x2f')]['id']}},_0x1e2563={};_0x1e2563[_0x4371('0x30')]=_['keys'](db[_0x4371('0x31')][_0x4371('0x32')]);_0x1e2563[_0x4371('0x33')]=_['keys'](_0x3e3839['query']);_0x1e2563[_0x4371('0x34')]=_['intersection'](_0x1e2563[_0x4371('0x30')],_0x1e2563[_0x4371('0x33')]);_0x33700b[_0x4371('0x35')]=_[_0x4371('0x36')](_0x1e2563[_0x4371('0x30')],qs[_0x4371('0x37')](_0x3e3839[_0x4371('0x33')][_0x4371('0x37')]));_0x33700b['attributes']=_0x33700b[_0x4371('0x35')][_0x4371('0x38')]?_0x33700b[_0x4371('0x35')]:_0x1e2563[_0x4371('0x30')];if(_0x3e3839['query'][_0x4371('0x39')]){_0x33700b['include']=[{'all':!![]}];}_0x33700b=_[_0x4371('0x3a')]({},_0x33700b,_0x3e3839[_0x4371('0x3b')]);return db[_0x4371('0x31')]['find'](_0x33700b)[_0x4371('0x29')](handleEntityNotFound(_0x3d6d59,null))['then'](respondWithResult(_0x3d6d59,null))['catch'](handleError(_0x3d6d59,null));};exports['destroy']=function(_0xc21e7,_0x18c3d3){return db['DashboardItem'][_0x4371('0x3c')]({'where':{'id':_0xc21e7[_0x4371('0x2f')]['id']}})['then'](handleEntityNotFound(_0x18c3d3,null))[_0x4371('0x29')](removeEntity(_0x18c3d3,null))['catch'](handleError(_0x18c3d3,null));};function widgetAttributes(_0x18e16d){try{switch(_0x18e16d[_0x4371('0x3d')]){case'iframe':return[{'name':_0x4371('0x3e'),'value':_0x18e16d[_0x4371('0x3e')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x0]?_0x18e16d[_0x4371('0x3f')][0x0][_0x4371('0x40')]:undefined)||'https://'}];case _0x4371('0x41'):return[{'name':_0x4371('0x42'),'value':_0x18e16d[_0x4371('0x42')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x0]?_0x18e16d[_0x4371('0x3f')][0x0]['value']:undefined)||''}];case _0x4371('0x43'):return[{'name':_0x4371('0x44'),'value':_0x18e16d[_0x4371('0x44')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x0]?_0x18e16d[_0x4371('0x3f')][0x0][_0x4371('0x40')]:undefined)||_0x4371('0x45')},{'name':_0x4371('0x46'),'value':_0x18e16d[_0x4371('0x46')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x1]?_0x18e16d['attrs'][0x1][_0x4371('0x40')]:undefined)||_0x4371('0x47')},{'name':_0x4371('0x48'),'value':_0x18e16d[_0x4371('0x48')]||(_0x18e16d['attrs']&&_0x18e16d[_0x4371('0x3f')][0x2]?_0x18e16d[_0x4371('0x3f')][0x2][_0x4371('0x40')]:undefined)||0xc}];case _0x4371('0x49'):return[{'name':_0x4371('0x4a'),'value':_0x18e16d[_0x4371('0x4a')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d['attrs'][0x0]?_0x18e16d[_0x4371('0x3f')][0x0][_0x4371('0x40')]:undefined)||_0x4371('0x4b')},{'name':_0x4371('0x4c'),'value':_0x18e16d[_0x4371('0x4c')]||(_0x18e16d['attrs']&&_0x18e16d[_0x4371('0x3f')][0x1]?_0x18e16d[_0x4371('0x3f')][0x1][_0x4371('0x40')]:undefined)||[]},{'name':_0x4371('0x48'),'value':_0x18e16d[_0x4371('0x48')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d['attrs'][0x2]?_0x18e16d[_0x4371('0x3f')][0x2][_0x4371('0x40')]:undefined)||0x14},{'name':'attrChannel','value':_0x18e16d[_0x4371('0x4d')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x3]?_0x18e16d[_0x4371('0x3f')][0x3][_0x4371('0x40')]:undefined)||'voice'},{'name':_0x4371('0x4e'),'value':_0x18e16d[_0x4371('0x4e')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x4]?_0x18e16d[_0x4371('0x3f')][0x4]['value']:undefined)||''},{'name':_0x4371('0x4f'),'value':_0x18e16d[_0x4371('0x4f')]||(_0x18e16d['attrs']&&_0x18e16d[_0x4371('0x3f')][0x5]?_0x18e16d[_0x4371('0x3f')][0x5]['value']:undefined)||''},{'name':_0x4371('0x50'),'value':_0x18e16d[_0x4371('0x50')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x6]?_0x18e16d[_0x4371('0x3f')][0x6][_0x4371('0x40')]:undefined)||''},{'name':_0x4371('0x51'),'value':_0x18e16d[_0x4371('0x51')]||(_0x18e16d['attrs']&&_0x18e16d[_0x4371('0x3f')][0x7]?_0x18e16d['attrs'][0x7][_0x4371('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x18e16d[_0x4371('0x52')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d['attrs'][0x8]?_0x18e16d[_0x4371('0x3f')][0x8][_0x4371('0x40')]:undefined)||''},{'name':_0x4371('0x53'),'value':_0x18e16d[_0x4371('0x53')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x9]?_0x18e16d['attrs'][0x9][_0x4371('0x40')]:undefined)||''}];case'multibar-chart':case _0x4371('0x54'):return[{'name':_0x4371('0x55'),'value':_0x18e16d[_0x4371('0x55')]||(_0x18e16d['attrs']&&_0x18e16d['attrs'][0x0]?_0x18e16d[_0x4371('0x3f')][0x0][_0x4371('0x40')]:undefined)||'total'},{'name':_0x4371('0x56'),'value':_0x18e16d[_0x4371('0x56')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x1]?_0x18e16d['attrs'][0x1][_0x4371('0x40')]:undefined)||null},{'name':_0x4371('0x57'),'value':_0x18e16d[_0x4371('0x57')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x2]?_0x18e16d[_0x4371('0x3f')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x18e16d[_0x4371('0x4c')]||(_0x18e16d['attrs']&&_0x18e16d['attrs'][0x3]?_0x18e16d[_0x4371('0x3f')][0x3][_0x4371('0x40')]:undefined)||[]},{'name':_0x4371('0x4d'),'value':_0x18e16d['attrChannel']||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d['attrs'][0x4]?_0x18e16d[_0x4371('0x3f')][0x4][_0x4371('0x40')]:undefined)||_0x4371('0x58')},{'name':_0x4371('0x4e'),'value':_0x18e16d[_0x4371('0x4e')]||(_0x18e16d['attrs']&&_0x18e16d['attrs'][0x5]?_0x18e16d['attrs'][0x5][_0x4371('0x40')]:undefined)||''},{'name':_0x4371('0x4f'),'value':_0x18e16d[_0x4371('0x4f')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x6]?_0x18e16d['attrs'][0x6]['value']:undefined)||''},{'name':_0x4371('0x50'),'value':_0x18e16d[_0x4371('0x50')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x7]?_0x18e16d['attrs'][0x7][_0x4371('0x40')]:undefined)||''},{'name':_0x4371('0x51'),'value':_0x18e16d['attrOpenchannelAccounts']||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d['attrs'][0x8]?_0x18e16d['attrs'][0x8][_0x4371('0x40')]:undefined)||''},{'name':_0x4371('0x52'),'value':_0x18e16d['attrWhatsappAccounts']||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x9]?_0x18e16d['attrs'][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x18e16d[_0x4371('0x53')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0xa]?_0x18e16d[_0x4371('0x3f')][0xa][_0x4371('0x40')]:undefined)||''}];case _0x4371('0x59'):return[{'name':_0x4371('0x5a'),'type':_0x18e16d[_0x4371('0x5b')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x0]?_0x18e16d[_0x4371('0x3f')][0x0]['type']:undefined)||null,'value':_0x18e16d[_0x4371('0x5a')]||(_0x18e16d[_0x4371('0x3f')]&&_0x18e16d[_0x4371('0x3f')][0x0]?_0x18e16d[_0x4371('0x3f')][0x0][_0x4371('0x40')]:undefined)||null},{'name':_0x4371('0x5c'),'value':_0x18e16d[_0x4371('0x5c')]||(_0x18e16d['attrs']&&_0x18e16d[_0x4371('0x3f')][0x1]?_0x18e16d[_0x4371('0x3f')][0x1][_0x4371('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x561ec0){logger[_0x4371('0x5d')]('widgetAttributes:\x20%s',JSON[_0x4371('0x5e')](_0x561ec0));return[];}}exports['create']=function(_0x48169a,_0x3152a7){if(_0x48169a[_0x4371('0x5f')]){_0x48169a[_0x4371('0x5f')][_0x4371('0x3f')]=widgetAttributes(_0x48169a[_0x4371('0x5f')]);}return db[_0x4371('0x31')]['create'](_0x48169a['body'],{})[_0x4371('0x29')](respondWithResult(_0x3152a7,0xc9))[_0x4371('0x60')](handleError(_0x3152a7,null));};exports['update']=function(_0x17c62f,_0x256acb){if(_0x17c62f[_0x4371('0x5f')]['id']){delete _0x17c62f[_0x4371('0x5f')]['id'];}_0x17c62f['body']['attrs']=widgetAttributes(_0x17c62f[_0x4371('0x5f')]);return db[_0x4371('0x31')]['find']({'where':{'id':_0x17c62f['params']['id']}})[_0x4371('0x29')](handleEntityNotFound(_0x256acb,null))[_0x4371('0x29')](saveUpdates(_0x17c62f['body'],null))['then'](respondWithResult(_0x256acb,null))[_0x4371('0x60')](handleError(_0x256acb,null));}; \ No newline at end of file +var _0x5502=['widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','find','params','type','iframe','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrChannel','web-report','attrReport','reportType','attrRefresh'];(function(_0x115f4e,_0x49dcaa){var _0xb0be7c=function(_0x2b99a9){while(--_0x2b99a9){_0x115f4e['push'](_0x115f4e['shift']());}};_0xb0be7c(++_0x49dcaa);}(_0x5502,0x69));var _0x2550=function(_0x4722ec,_0x5a706a){_0x4722ec=_0x4722ec-0x0;var _0x301f80=_0x5502[_0x4722ec];return _0x301f80;};'use strict';var emlformat=require(_0x2550('0x0'));var rimraf=require(_0x2550('0x1'));var zipdir=require(_0x2550('0x2'));var jsonpatch=require(_0x2550('0x3'));var rp=require(_0x2550('0x4'));var moment=require(_0x2550('0x5'));var BPromise=require(_0x2550('0x6'));var Mustache=require(_0x2550('0x7'));var util=require(_0x2550('0x8'));var path=require(_0x2550('0x9'));var sox=require(_0x2550('0xa'));var csv=require(_0x2550('0xb'));var ejs=require(_0x2550('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2550('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2550('0xe'));var deskjs=require(_0x2550('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2550('0x10'));var Papa=require('papaparse');var Redis=require(_0x2550('0x11'));var authService=require(_0x2550('0x12'));var qs=require(_0x2550('0x13'));var as=require(_0x2550('0x14'));var hardwareService=require(_0x2550('0x15'));var logger=require(_0x2550('0x16'))('api');var utils=require(_0x2550('0x17'));var config=require(_0x2550('0x18'));var licenseUtil=require(_0x2550('0x19'));var db=require(_0x2550('0x1a'))['db'];config['redis']=_[_0x2550('0x1b')](config[_0x2550('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x2550('0x1d'))(new Redis(config[_0x2550('0x1c')]));require(_0x2550('0x1e'))[_0x2550('0x1f')](socket);function respondWithStatusCode(_0x3fef28,_0x2ddec1){_0x2ddec1=_0x2ddec1||0xcc;return function(_0x5aed8d){if(_0x5aed8d){return _0x3fef28[_0x2550('0x20')](_0x2ddec1);}return _0x3fef28[_0x2550('0x21')](_0x2ddec1)[_0x2550('0x22')]();};}function respondWithResult(_0x179866,_0x3f480b){_0x3f480b=_0x3f480b||0xc8;return function(_0x21de36){if(_0x21de36){return _0x179866['status'](_0x3f480b)[_0x2550('0x23')](_0x21de36);}};}function respondWithFilteredResult(_0x2d06e1,_0x75cd16){return function(_0x5c1bcb){if(_0x5c1bcb){var _0x98f713=typeof _0x75cd16['offset']==='undefined'&&typeof _0x75cd16[_0x2550('0x24')]==='undefined';var _0x2324ce=_0x5c1bcb[_0x2550('0x25')];var _0xb666cd=_0x98f713?0x0:_0x75cd16[_0x2550('0x26')];var _0x3f9b60=_0x98f713?_0x5c1bcb['count']:_0x75cd16['offset']+_0x75cd16['limit'];var _0x15581e;if(_0x3f9b60>=_0x2324ce){_0x3f9b60=_0x2324ce;_0x15581e=0xc8;}else{_0x15581e=0xce;}_0x2d06e1[_0x2550('0x21')](_0x15581e);return _0x2d06e1[_0x2550('0x27')](_0x2550('0x28'),_0xb666cd+'-'+_0x3f9b60+'/'+_0x2324ce)[_0x2550('0x23')](_0x5c1bcb);}return null;};}function patchUpdates(_0x28359b){return function(_0x21b6fb){try{jsonpatch[_0x2550('0x29')](_0x21b6fb,_0x28359b,!![]);}catch(_0x1d3d19){return BPromise['reject'](_0x1d3d19);}return _0x21b6fb[_0x2550('0x2a')]();};}function saveUpdates(_0x4715f6,_0x5c024e){return function(_0x1adb08){if(_0x1adb08){return _0x1adb08[_0x2550('0x2b')](_0x4715f6)['then'](function(_0x418828){return _0x418828;});}return null;};}function removeEntity(_0x3e15d2,_0x1431ea){return function(_0x3da957){if(_0x3da957){return _0x3da957[_0x2550('0x2c')]()[_0x2550('0x2d')](function(){_0x3e15d2[_0x2550('0x21')](0xcc)[_0x2550('0x22')]();});}};}function handleEntityNotFound(_0x2839f2,_0x125452){return function(_0xe2744b){if(!_0xe2744b){_0x2839f2[_0x2550('0x20')](0x194);}return _0xe2744b;};}function handleError(_0x12ea94,_0x511b4a){_0x511b4a=_0x511b4a||0x1f4;return function(_0x2e1fc6){logger[_0x2550('0x2e')](_0x2e1fc6[_0x2550('0x2f')]);if(_0x2e1fc6[_0x2550('0x30')]){delete _0x2e1fc6[_0x2550('0x30')];}_0x12ea94[_0x2550('0x21')](_0x511b4a)[_0x2550('0x31')](_0x2e1fc6);};}exports[_0x2550('0x32')]=function(_0x2beed7,_0x256509){var _0x222f62={'raw':![],'where':{'id':_0x2beed7['params']['id']}},_0x3c6613={};_0x3c6613[_0x2550('0x33')]=_[_0x2550('0x34')](db[_0x2550('0x35')][_0x2550('0x36')]);_0x3c6613[_0x2550('0x37')]=_['keys'](_0x2beed7['query']);_0x3c6613[_0x2550('0x38')]=_[_0x2550('0x39')](_0x3c6613[_0x2550('0x33')],_0x3c6613['query']);_0x222f62[_0x2550('0x3a')]=_[_0x2550('0x39')](_0x3c6613[_0x2550('0x33')],qs['fields'](_0x2beed7[_0x2550('0x37')][_0x2550('0x3b')]));_0x222f62[_0x2550('0x3a')]=_0x222f62['attributes'][_0x2550('0x3c')]?_0x222f62['attributes']:_0x3c6613[_0x2550('0x33')];if(_0x2beed7[_0x2550('0x37')][_0x2550('0x3d')]){_0x222f62['include']=[{'all':!![]}];}_0x222f62=_[_0x2550('0x3e')]({},_0x222f62,_0x2beed7[_0x2550('0x3f')]);return db['DashboardItem']['find'](_0x222f62)[_0x2550('0x2d')](handleEntityNotFound(_0x256509,null))[_0x2550('0x2d')](respondWithResult(_0x256509,null))[_0x2550('0x40')](handleError(_0x256509,null));};exports[_0x2550('0x2c')]=function(_0x1ea349,_0x254456){return db[_0x2550('0x35')][_0x2550('0x41')]({'where':{'id':_0x1ea349[_0x2550('0x42')]['id']}})[_0x2550('0x2d')](handleEntityNotFound(_0x254456,null))[_0x2550('0x2d')](removeEntity(_0x254456,null))[_0x2550('0x40')](handleError(_0x254456,null));};function widgetAttributes(_0x1f7e04){try{switch(_0x1f7e04[_0x2550('0x43')]){case _0x2550('0x44'):return[{'name':'attrUrl','value':_0x1f7e04['attrUrl']||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04['attrs'][0x0]?_0x1f7e04[_0x2550('0x45')][0x0]['value']:undefined)||_0x2550('0x46')}];case _0x2550('0x47'):return[{'name':_0x2550('0x48'),'value':_0x1f7e04['attrPath']||(_0x1f7e04['attrs']&&_0x1f7e04['attrs'][0x0]?_0x1f7e04['attrs'][0x0][_0x2550('0x49')]:undefined)||''}];case'clock':return[{'name':_0x2550('0x4a'),'value':_0x1f7e04[_0x2550('0x4a')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x0]?_0x1f7e04[_0x2550('0x45')][0x0][_0x2550('0x49')]:undefined)||'HH:mm:ss'},{'name':_0x2550('0x4b'),'value':_0x1f7e04[_0x2550('0x4b')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04['attrs'][0x1]?_0x1f7e04[_0x2550('0x45')][0x1]['value']:undefined)||_0x2550('0x4c')},{'name':_0x2550('0x4d'),'value':_0x1f7e04[_0x2550('0x4d')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x2]?_0x1f7e04[_0x2550('0x45')][0x2][_0x2550('0x49')]:undefined)||0xc}];case _0x2550('0x4e'):return[{'name':'attrMetric','value':_0x1f7e04['attrMetric']||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x0]?_0x1f7e04[_0x2550('0x45')][0x0][_0x2550('0x49')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x1f7e04[_0x2550('0x4f')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x1]?_0x1f7e04[_0x2550('0x45')][0x1][_0x2550('0x49')]:undefined)||[]},{'name':_0x2550('0x4d'),'value':_0x1f7e04[_0x2550('0x4d')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x2]?_0x1f7e04[_0x2550('0x45')][0x2][_0x2550('0x49')]:undefined)||0x14},{'name':'attrChannel','value':_0x1f7e04['attrChannel']||(_0x1f7e04['attrs']&&_0x1f7e04['attrs'][0x3]?_0x1f7e04[_0x2550('0x45')][0x3][_0x2550('0x49')]:undefined)||_0x2550('0x50')},{'name':_0x2550('0x51'),'value':_0x1f7e04[_0x2550('0x51')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x4]?_0x1f7e04[_0x2550('0x45')][0x4]['value']:undefined)||''},{'name':_0x2550('0x52'),'value':_0x1f7e04[_0x2550('0x52')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x5]?_0x1f7e04[_0x2550('0x45')][0x5][_0x2550('0x49')]:undefined)||''},{'name':_0x2550('0x53'),'value':_0x1f7e04[_0x2550('0x53')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04['attrs'][0x6]?_0x1f7e04['attrs'][0x6][_0x2550('0x49')]:undefined)||''},{'name':_0x2550('0x54'),'value':_0x1f7e04[_0x2550('0x54')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x7]?_0x1f7e04[_0x2550('0x45')][0x7][_0x2550('0x49')]:undefined)||''},{'name':_0x2550('0x55'),'value':_0x1f7e04[_0x2550('0x55')]||(_0x1f7e04['attrs']&&_0x1f7e04[_0x2550('0x45')][0x8]?_0x1f7e04[_0x2550('0x45')][0x8][_0x2550('0x49')]:undefined)||''},{'name':_0x2550('0x56'),'value':_0x1f7e04[_0x2550('0x56')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x9]?_0x1f7e04[_0x2550('0x45')][0x9]['value']:undefined)||''}];case _0x2550('0x57'):case _0x2550('0x58'):return[{'name':_0x2550('0x59'),'value':_0x1f7e04['attrSerie1']||(_0x1f7e04['attrs']&&_0x1f7e04[_0x2550('0x45')][0x0]?_0x1f7e04[_0x2550('0x45')][0x0]['value']:undefined)||_0x2550('0x5a')},{'name':_0x2550('0x5b'),'value':_0x1f7e04[_0x2550('0x5b')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x1]?_0x1f7e04[_0x2550('0x45')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x1f7e04['attrSerie3']||(_0x1f7e04['attrs']&&_0x1f7e04[_0x2550('0x45')][0x2]?_0x1f7e04[_0x2550('0x45')][0x2][_0x2550('0x49')]:undefined)||null},{'name':_0x2550('0x4f'),'value':_0x1f7e04['attrVoiceQueues']||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04['attrs'][0x3]?_0x1f7e04[_0x2550('0x45')][0x3][_0x2550('0x49')]:undefined)||[]},{'name':_0x2550('0x5c'),'value':_0x1f7e04[_0x2550('0x5c')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x4]?_0x1f7e04[_0x2550('0x45')][0x4][_0x2550('0x49')]:undefined)||_0x2550('0x50')},{'name':_0x2550('0x51'),'value':_0x1f7e04[_0x2550('0x51')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x5]?_0x1f7e04['attrs'][0x5][_0x2550('0x49')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1f7e04[_0x2550('0x52')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x6]?_0x1f7e04[_0x2550('0x45')][0x6][_0x2550('0x49')]:undefined)||''},{'name':_0x2550('0x53'),'value':_0x1f7e04[_0x2550('0x53')]||(_0x1f7e04['attrs']&&_0x1f7e04[_0x2550('0x45')][0x7]?_0x1f7e04[_0x2550('0x45')][0x7][_0x2550('0x49')]:undefined)||''},{'name':_0x2550('0x54'),'value':_0x1f7e04[_0x2550('0x54')]||(_0x1f7e04['attrs']&&_0x1f7e04[_0x2550('0x45')][0x8]?_0x1f7e04[_0x2550('0x45')][0x8]['value']:undefined)||''},{'name':_0x2550('0x55'),'value':_0x1f7e04['attrWhatsappAccounts']||(_0x1f7e04['attrs']&&_0x1f7e04[_0x2550('0x45')][0x9]?_0x1f7e04[_0x2550('0x45')][0x9][_0x2550('0x49')]:undefined)||''},{'name':_0x2550('0x56'),'value':_0x1f7e04[_0x2550('0x56')]||(_0x1f7e04['attrs']&&_0x1f7e04[_0x2550('0x45')][0xa]?_0x1f7e04[_0x2550('0x45')][0xa][_0x2550('0x49')]:undefined)||''}];case _0x2550('0x5d'):return[{'name':_0x2550('0x5e'),'type':_0x1f7e04[_0x2550('0x5f')]||(_0x1f7e04['attrs']&&_0x1f7e04[_0x2550('0x45')][0x0]?_0x1f7e04[_0x2550('0x45')][0x0][_0x2550('0x43')]:undefined)||null,'value':_0x1f7e04[_0x2550('0x5e')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04['attrs'][0x0]?_0x1f7e04[_0x2550('0x45')][0x0][_0x2550('0x49')]:undefined)||null},{'name':'attrRefresh','value':_0x1f7e04[_0x2550('0x60')]||(_0x1f7e04[_0x2550('0x45')]&&_0x1f7e04[_0x2550('0x45')][0x1]?_0x1f7e04[_0x2550('0x45')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2fa07b){logger['error'](_0x2550('0x61'),JSON[_0x2550('0x62')](_0x2fa07b));return[];}}exports['create']=function(_0xd839c8,_0x507f93){if(_0xd839c8[_0x2550('0x63')]){_0xd839c8[_0x2550('0x63')][_0x2550('0x45')]=widgetAttributes(_0xd839c8[_0x2550('0x63')]);}return db['DashboardItem'][_0x2550('0x64')](_0xd839c8[_0x2550('0x63')],{})[_0x2550('0x2d')](respondWithResult(_0x507f93,0xc9))[_0x2550('0x40')](handleError(_0x507f93,null));};exports[_0x2550('0x2b')]=function(_0x81869e,_0x5a92da){if(_0x81869e[_0x2550('0x63')]['id']){delete _0x81869e[_0x2550('0x63')]['id'];}_0x81869e['body'][_0x2550('0x45')]=widgetAttributes(_0x81869e[_0x2550('0x63')]);return db['DashboardItem'][_0x2550('0x41')]({'where':{'id':_0x81869e[_0x2550('0x42')]['id']}})[_0x2550('0x2d')](handleEntityNotFound(_0x5a92da,null))[_0x2550('0x2d')](saveUpdates(_0x81869e[_0x2550('0x63')],null))['then'](respondWithResult(_0x5a92da,null))[_0x2550('0x40')](handleError(_0x5a92da,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index aa9bb92..ba97aa3 100644 --- a/server/api/dashboardItem/dashboardItem.events.js +++ b/server/api/dashboardItem/dashboardItem.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaeb=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x132d16,_0x56a94c){var _0x2827aa=function(_0x270142){while(--_0x270142){_0x132d16['push'](_0x132d16['shift']());}};_0x2827aa(++_0x56a94c);}(_0xfaeb,0x1a4));var _0xbfae=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xfaeb[_0xd0b415];return _0x2bdf2c;};'use strict';var EventEmitter=require(_0xbfae('0x0'));var DashboardItem=require(_0xbfae('0x1'))['db'][_0xbfae('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbfae('0x3')](0x0);var events={'afterCreate':_0xbfae('0x4'),'afterUpdate':_0xbfae('0x5'),'afterDestroy':'remove'};function emitEvent(_0x27c62a){return function(_0x29decd,_0x45b203,_0x31206c){DashboardItemEvents[_0xbfae('0x6')](_0x27c62a+':'+_0x29decd['id'],_0x29decd);DashboardItemEvents[_0xbfae('0x6')](_0x27c62a,_0x29decd);_0x31206c(null);};}for(var e in events){if(events[_0xbfae('0x7')](e)){var event=events[e];DashboardItem[_0xbfae('0x8')](e,emitEvent(event));}}module[_0xbfae('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x4547=['remove','emit','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x1b5080,_0x3e7cc9){var _0x195c87=function(_0x1ef917){while(--_0x1ef917){_0x1b5080['push'](_0x1b5080['shift']());}};_0x195c87(++_0x3e7cc9);}(_0x4547,0x11b));var _0x7454=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x4547[_0x2d61ac];return _0x3f7d3c;};'use strict';var EventEmitter=require(_0x7454('0x0'));var DashboardItem=require(_0x7454('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7454('0x2')](0x0);var events={'afterCreate':_0x7454('0x3'),'afterUpdate':'update','afterDestroy':_0x7454('0x4')};function emitEvent(_0x26c02b){return function(_0x13178d,_0x426747,_0xc47485){DashboardItemEvents[_0x7454('0x5')](_0x26c02b+':'+_0x13178d['id'],_0x13178d);DashboardItemEvents[_0x7454('0x5')](_0x26c02b,_0x13178d);_0xc47485(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x7454('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a9299a2..089bd76 100644 --- a/server/api/dashboardItem/dashboardItem.model.js +++ b/server/api/dashboardItem/dashboardItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8684=['DashboardItem','dashboard_items','lodash','util','api','moment','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x1ebfbf,_0x1f1289){var _0x253f97=function(_0x4db884){while(--_0x4db884){_0x1ebfbf['push'](_0x1ebfbf['shift']());}};_0x253f97(++_0x1f1289);}(_0x8684,0x182));var _0x4868=function(_0x161e43,_0x2ff0b3){_0x161e43=_0x161e43-0x0;var _0x2fdf4d=_0x8684[_0x161e43];return _0x2fdf4d;};'use strict';var _=require(_0x4868('0x0'));var util=require(_0x4868('0x1'));var logger=require('../../config/logger')(_0x4868('0x2'));var moment=require(_0x4868('0x3'));var BPromise=require('bluebird');var rp=require(_0x4868('0x4'));var fs=require('fs');var path=require(_0x4868('0x5'));var rimraf=require('rimraf');var config=require(_0x4868('0x6'));var attributes=require(_0x4868('0x7'));module[_0x4868('0x8')]=function(_0x38cfae,_0x1e84b){return _0x38cfae[_0x4868('0x9')](_0x4868('0xa'),attributes,{'tableName':_0x4868('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc9f=['DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./dashboardItem.attributes'];(function(_0x1b8b81,_0xb30fc5){var _0x4a84ca=function(_0xb5b0d2){while(--_0xb5b0d2){_0x1b8b81['push'](_0x1b8b81['shift']());}};_0x4a84ca(++_0xb30fc5);}(_0xfc9f,0x7a));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xffc9('0x0'));var util=require('util');var logger=require(_0xffc9('0x1'))(_0xffc9('0x2'));var moment=require(_0xffc9('0x3'));var BPromise=require(_0xffc9('0x4'));var rp=require(_0xffc9('0x5'));var fs=require('fs');var path=require(_0xffc9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xffc9('0x7'));module['exports']=function(_0x155cef,_0x122a56){return _0x155cef['define'](_0xffc9('0x8'),attributes,{'tableName':_0xffc9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 0209480..f978bb3 100644 --- a/server/api/dashboardItem/dashboardItem.rpc.js +++ b/server/api/dashboardItem/dashboardItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45b8=['info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./dashboardItem.socket','register','request','then'];(function(_0x142276,_0x8029bf){var _0x1ecd95=function(_0x23c2c7){while(--_0x23c2c7){_0x142276['push'](_0x142276['shift']());}};_0x1ecd95(++_0x8029bf);}(_0x45b8,0x190));var _0x845b=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x45b8[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x845b('0x0'));var util=require(_0x845b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x845b('0x2'));var db=require(_0x845b('0x3'))['db'];var utils=require(_0x845b('0x4'));var logger=require(_0x845b('0x5'))(_0x845b('0x6'));var config=require(_0x845b('0x7'));var jayson=require(_0x845b('0x8'));var client=jayson[_0x845b('0x9')]['http']({'port':0x232a});config[_0x845b('0xa')]=_['defaults'](config[_0x845b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x845b('0xb'))(new Redis(config['redis']));require(_0x845b('0xc'))[_0x845b('0xd')](socket);function respondWithRpcPromise(_0x49c3a,_0x438169,_0x147060){return new BPromise(function(_0x54e88f,_0x500a88){return client[_0x845b('0xe')](_0x49c3a,_0x147060)[_0x845b('0xf')](function(_0x2d6d6a){logger[_0x845b('0x10')](_0x845b('0x11'),_0x438169,'request\x20sent');logger['debug'](_0x845b('0x12'),_0x438169,_0x845b('0x13'),JSON[_0x845b('0x14')](_0x2d6d6a));if(_0x2d6d6a[_0x845b('0x15')]){if(_0x2d6d6a[_0x845b('0x15')][_0x845b('0x16')]===0x1f4){logger[_0x845b('0x15')](_0x845b('0x11'),_0x438169,_0x2d6d6a[_0x845b('0x15')][_0x845b('0x17')]);return _0x500a88(_0x2d6d6a[_0x845b('0x15')]['message']);}logger['error'](_0x845b('0x11'),_0x438169,_0x2d6d6a[_0x845b('0x15')][_0x845b('0x17')]);return _0x54e88f(_0x2d6d6a[_0x845b('0x15')][_0x845b('0x17')]);}else{logger[_0x845b('0x10')](_0x845b('0x11'),_0x438169,'request\x20sent');_0x54e88f(_0x2d6d6a[_0x845b('0x18')][_0x845b('0x17')]);}})[_0x845b('0x19')](function(_0x58a655){logger[_0x845b('0x15')]('DashboardItem,\x20%s,\x20%s',_0x438169,_0x58a655);_0x500a88(_0x58a655);});});} \ No newline at end of file +var _0x9bc0=['../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','./dashboardItem.socket','request','info','DashboardItem,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x9bc0,0x110));var _0x09bc=function(_0x788942,_0x5e8a8c){_0x788942=_0x788942-0x0;var _0x2326fb=_0x9bc0[_0x788942];return _0x2326fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x09bc('0x0'));var rs=require(_0x09bc('0x1'));var fs=require('fs');var Redis=require(_0x09bc('0x2'));var db=require(_0x09bc('0x3'))['db'];var utils=require(_0x09bc('0x4'));var logger=require(_0x09bc('0x5'))(_0x09bc('0x6'));var config=require(_0x09bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x09bc('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x09bc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x09bc('0xa'))(new Redis(config['redis']));require(_0x09bc('0xb'))['register'](socket);function respondWithRpcPromise(_0x22d637,_0x12a43f,_0x204237){return new BPromise(function(_0x53a8e4,_0x159dce){return client[_0x09bc('0xc')](_0x22d637,_0x204237)['then'](function(_0x1df704){logger[_0x09bc('0xd')](_0x09bc('0xe'),_0x12a43f,'request\x20sent');logger[_0x09bc('0xf')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x12a43f,'request\x20sent',JSON[_0x09bc('0x10')](_0x1df704));if(_0x1df704[_0x09bc('0x11')]){if(_0x1df704['error'][_0x09bc('0x12')]===0x1f4){logger[_0x09bc('0x11')](_0x09bc('0xe'),_0x12a43f,_0x1df704[_0x09bc('0x11')][_0x09bc('0x13')]);return _0x159dce(_0x1df704[_0x09bc('0x11')][_0x09bc('0x13')]);}logger['error'](_0x09bc('0xe'),_0x12a43f,_0x1df704['error'][_0x09bc('0x13')]);return _0x53a8e4(_0x1df704['error'][_0x09bc('0x13')]);}else{logger[_0x09bc('0xd')](_0x09bc('0xe'),_0x12a43f,_0x09bc('0x14'));_0x53a8e4(_0x1df704[_0x09bc('0x15')][_0x09bc('0x13')]);}})[_0x09bc('0x16')](function(_0x3e187c){logger[_0x09bc('0x11')]('DashboardItem,\x20%s,\x20%s',_0x12a43f,_0x3e187c);_0x159dce(_0x3e187c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 76b19d8..c56cb07 100644 --- a/server/api/dashboardItem/dashboardItem.socket.js +++ b/server/api/dashboardItem/dashboardItem.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa160=['dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register','length'];(function(_0x530086,_0x382014){var _0x4e29c2=function(_0x2bc473){while(--_0x2bc473){_0x530086['push'](_0x530086['shift']());}};_0x4e29c2(++_0x382014);}(_0xa160,0x149));var _0x0a16=function(_0x13d5fd,_0x2d1287){_0x13d5fd=_0x13d5fd-0x0;var _0x26b28d=_0xa160[_0x13d5fd];return _0x26b28d;};'use strict';var DashboardItemEvents=require(_0x0a16('0x0'));var events=['save',_0x0a16('0x1'),_0x0a16('0x2')];function createListener(_0x44cde4,_0x5ea7b2){return function(_0x32cf7f){_0x5ea7b2[_0x0a16('0x3')](_0x44cde4,_0x32cf7f);};}function removeListener(_0x349388,_0x3e42de){return function(){DashboardItemEvents[_0x0a16('0x4')](_0x349388,_0x3e42de);};}exports[_0x0a16('0x5')]=function(_0x235d1e){for(var _0x2fb79e=0x0,_0x4cb8ad=events[_0x0a16('0x6')];_0x2fb79e<_0x4cb8ad;_0x2fb79e++){var _0x54c0ff=events[_0x2fb79e];var _0x104887=createListener(_0x0a16('0x7')+_0x54c0ff,_0x235d1e);DashboardItemEvents['on'](_0x54c0ff,_0x104887);}}; \ No newline at end of file +var _0xd7ce=['emit','removeListener','register','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x41c31b,_0xdda69e){var _0x356ace=function(_0x7f680d){while(--_0x7f680d){_0x41c31b['push'](_0x41c31b['shift']());}};_0x356ace(++_0xdda69e);}(_0xd7ce,0x1e7));var _0xed7c=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0xd7ce[_0xed5f9c];return _0x3a1c43;};'use strict';var DashboardItemEvents=require(_0xed7c('0x0'));var events=[_0xed7c('0x1'),'remove',_0xed7c('0x2')];function createListener(_0x1ef6f6,_0x1adc28){return function(_0x16725c){_0x1adc28[_0xed7c('0x3')](_0x1ef6f6,_0x16725c);};}function removeListener(_0x2a754c,_0x1fec06){return function(){DashboardItemEvents[_0xed7c('0x4')](_0x2a754c,_0x1fec06);};}exports[_0xed7c('0x5')]=function(_0x3887dd){for(var _0x3622d2=0x0,_0x39febc=events['length'];_0x3622d2<_0x39febc;_0x3622d2++){var _0x5114f0=events[_0x3622d2];var _0x2a7679=createListener(_0xed7c('0x6')+_0x5114f0,_0x3887dd);DashboardItemEvents['on'](_0x5114f0,_0x2a7679);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1572323..ba3ce49 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8dc3=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post','create','delete','/:id','destroy','exports','multer','express'];(function(_0x463cde,_0x1db47a){var _0xd7d34e=function(_0x1efbb1){while(--_0x1efbb1){_0x463cde['push'](_0x463cde['shift']());}};_0xd7d34e(++_0x1db47a);}(_0x8dc3,0x6e));var _0x38dc=function(_0x1b2269,_0x3972eb){_0x1b2269=_0x1b2269-0x0;var _0xb49a7a=_0x8dc3[_0x1b2269];return _0xb49a7a;};'use strict';var multer=require(_0x38dc('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x38dc('0x1'));var router=express['Router']();var fs_extra=require(_0x38dc('0x2'));var auth=require(_0x38dc('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x38dc('0x4'));var controller=require('./dashboardItem.controller');router[_0x38dc('0x5')]('/:id',auth[_0x38dc('0x6')](),controller[_0x38dc('0x7')]);router[_0x38dc('0x8')]('/',auth[_0x38dc('0x6')](),controller[_0x38dc('0x9')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x38dc('0xa')](_0x38dc('0xb'),auth[_0x38dc('0x6')](),controller[_0x38dc('0xc')]);module[_0x38dc('0xd')]=router; \ No newline at end of file +var _0x93cd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x93cd,0xea));var _0xd93c=function(_0xb1b616,_0x3b9023){_0xb1b616=_0xb1b616-0x0;var _0x1259b0=_0x93cd[_0xb1b616];return _0x1259b0;};'use strict';var multer=require(_0xd93c('0x0'));var util=require('util');var path=require(_0xd93c('0x1'));var timeout=require(_0xd93c('0x2'));var express=require(_0xd93c('0x3'));var router=express['Router']();var fs_extra=require(_0xd93c('0x4'));var auth=require(_0xd93c('0x5'));var interaction=require(_0xd93c('0x6'));var config=require(_0xd93c('0x7'));var controller=require('./dashboardItem.controller');router['get'](_0xd93c('0x8'),auth['isAuthenticated'](),controller[_0xd93c('0x9')]);router[_0xd93c('0xa')]('/',auth[_0xd93c('0xb')](),controller[_0xd93c('0xc')]);router[_0xd93c('0xd')](_0xd93c('0x8'),auth[_0xd93c('0xb')](),controller[_0xd93c('0xe')]);router[_0xd93c('0xf')]('/:id',auth[_0xd93c('0xb')](),controller['destroy']);module[_0xd93c('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index bc493e1..8118de6 100644 --- a/server/api/disposition/disposition.attributes.js +++ b/server/api/disposition/disposition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf935=['first','third','sequelize','exports','STRING','ENUM'];(function(_0x4d7b1c,_0x42c330){var _0x58aacd=function(_0x1fbcf3){while(--_0x1fbcf3){_0x4d7b1c['push'](_0x4d7b1c['shift']());}};_0x58aacd(++_0x42c330);}(_0xf935,0x15e));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x5f93('0x0'));module[_0x5f93('0x1')]={'name':{'type':Sequelize[_0x5f93('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x5f93('0x3')](_0x5f93('0x4'),'second',_0x5f93('0x5')),'allowNull':![],'defaultValue':_0x5f93('0x4')},'description':{'type':Sequelize[_0x5f93('0x2')]}}; \ No newline at end of file +var _0xb8f0=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x2efb88,_0x57851b){var _0xeb389a=function(_0x1973ae){while(--_0x1973ae){_0x2efb88['push'](_0x2efb88['shift']());}};_0xeb389a(++_0x57851b);}(_0xb8f0,0x89));var _0x0b8f=function(_0x5dedfd,_0x14455e){_0x5dedfd=_0x5dedfd-0x0;var _0x520fc3=_0xb8f0[_0x5dedfd];return _0x520fc3;};'use strict';var Sequelize=require(_0x0b8f('0x0'));module[_0x0b8f('0x1')]={'name':{'type':Sequelize[_0x0b8f('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x0b8f('0x3')](_0x0b8f('0x4'),_0x0b8f('0x5'),_0x0b8f('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7a59890..94ae7e4 100644 --- a/server/api/disposition/disposition.controller.js +++ b/server/api/disposition/disposition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11ec=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','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','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','Dispositions','error','stack','name','send','map','Disposition','type','key'];(function(_0x3aa779,_0x4a18c5){var _0x2fd150=function(_0x239bb1){while(--_0x239bb1){_0x3aa779['push'](_0x3aa779['shift']());}};_0x2fd150(++_0x4a18c5);}(_0x11ec,0xd1));var _0xc11e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x11ec[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc11e('0x0'));var jsonpatch=require(_0xc11e('0x1'));var rp=require(_0xc11e('0x2'));var moment=require('moment');var BPromise=require(_0xc11e('0x3'));var Mustache=require('mustache');var util=require(_0xc11e('0x4'));var path=require(_0xc11e('0x5'));var sox=require(_0xc11e('0x6'));var csv=require(_0xc11e('0x7'));var ejs=require(_0xc11e('0x8'));var fs=require('fs');var fs_extra=require(_0xc11e('0x9'));var _=require('lodash');var squel=require(_0xc11e('0xa'));var crypto=require(_0xc11e('0xb'));var jsforce=require(_0xc11e('0xc'));var deskjs=require(_0xc11e('0xd'));var toCsv=require(_0xc11e('0x7'));var querystring=require(_0xc11e('0xe'));var Papa=require('papaparse');var Redis=require(_0xc11e('0xf'));var authService=require(_0xc11e('0x10'));var qs=require(_0xc11e('0x11'));var as=require(_0xc11e('0x12'));var hardwareService=require(_0xc11e('0x13'));var logger=require(_0xc11e('0x14'))(_0xc11e('0x15'));var utils=require(_0xc11e('0x16'));var config=require(_0xc11e('0x17'));var licenseUtil=require(_0xc11e('0x18'));var db=require(_0xc11e('0x19'))['db'];function respondWithStatusCode(_0x55868a,_0x16f94a){_0x16f94a=_0x16f94a||0xcc;return function(_0x8292f4){if(_0x8292f4){return _0x55868a[_0xc11e('0x1a')](_0x16f94a);}return _0x55868a[_0xc11e('0x1b')](_0x16f94a)[_0xc11e('0x1c')]();};}function respondWithResult(_0x1b8c55,_0x5937c7){_0x5937c7=_0x5937c7||0xc8;return function(_0x6a3c78){if(_0x6a3c78){return _0x1b8c55[_0xc11e('0x1b')](_0x5937c7)[_0xc11e('0x1d')](_0x6a3c78);}};}function respondWithFilteredResult(_0x149a12,_0x4d6be4){return function(_0x4ca562){if(_0x4ca562){var _0x2c6136=typeof _0x4d6be4[_0xc11e('0x1e')]===_0xc11e('0x1f')&&typeof _0x4d6be4['limit']==='undefined';var _0x4d2312=_0x4ca562[_0xc11e('0x20')];var _0x21566d=_0x2c6136?0x0:_0x4d6be4['offset'];var _0xa63390=_0x2c6136?_0x4ca562[_0xc11e('0x20')]:_0x4d6be4['offset']+_0x4d6be4['limit'];var _0x337f62;if(_0xa63390>=_0x4d2312){_0xa63390=_0x4d2312;_0x337f62=0xc8;}else{_0x337f62=0xce;}_0x149a12[_0xc11e('0x1b')](_0x337f62);return _0x149a12[_0xc11e('0x21')]('Content-Range',_0x21566d+'-'+_0xa63390+'/'+_0x4d2312)[_0xc11e('0x1d')](_0x4ca562);}return null;};}function patchUpdates(_0x5995e5){return function(_0x5e43a7){try{jsonpatch[_0xc11e('0x22')](_0x5e43a7,_0x5995e5,!![]);}catch(_0x25cec2){return BPromise[_0xc11e('0x23')](_0x25cec2);}return _0x5e43a7[_0xc11e('0x24')]();};}function saveUpdates(_0xb148ca,_0xac60d0){return function(_0x590c0e){if(_0x590c0e){return _0x590c0e[_0xc11e('0x25')](_0xb148ca)['then'](function(_0x2b8e0d){return _0x2b8e0d;});}return null;};}function removeEntity(_0x4834a0,_0x826275){return function(_0x487eaa){if(_0x487eaa){return _0x487eaa[_0xc11e('0x26')]()[_0xc11e('0x27')](function(){var _0x1e6a69=_0x487eaa['get']({'plain':!![]});var _0x13fd07=_0xc11e('0x28');return db['UserProfileResource'][_0xc11e('0x26')]({'where':{'type':_0x13fd07,'resourceId':_0x1e6a69['id']}})[_0xc11e('0x27')](function(){return _0x487eaa;});})[_0xc11e('0x27')](function(){_0x4834a0[_0xc11e('0x1b')](0xcc)[_0xc11e('0x1c')]();});}};}function handleEntityNotFound(_0x2d6670,_0x38a9de){return function(_0x214c16){if(!_0x214c16){_0x2d6670[_0xc11e('0x1a')](0x194);}return _0x214c16;};}function handleError(_0x34aae1,_0xaa5863){_0xaa5863=_0xaa5863||0x1f4;return function(_0x325f15){logger[_0xc11e('0x29')](_0x325f15[_0xc11e('0x2a')]);if(_0x325f15[_0xc11e('0x2b')]){delete _0x325f15[_0xc11e('0x2b')];}_0x34aae1['status'](_0xaa5863)[_0xc11e('0x2c')](_0x325f15);};}exports['index']=function(_0x5dcc49,_0x162ec4){var _0x592e4d={},_0x407810={},_0x5c68ba={'count':0x0,'rows':[]};var _0x4f81a9=_[_0xc11e('0x2d')](db[_0xc11e('0x2e')]['rawAttributes'],function(_0xbff994){return{'name':_0xbff994['fieldName'],'type':_0xbff994[_0xc11e('0x2f')][_0xc11e('0x30')]};});_0x407810[_0xc11e('0x31')]=_[_0xc11e('0x2d')](_0x4f81a9,_0xc11e('0x2b'));_0x407810[_0xc11e('0x32')]=_['keys'](_0x5dcc49['query']);_0x407810[_0xc11e('0x33')]=_[_0xc11e('0x34')](_0x407810[_0xc11e('0x31')],_0x407810['query']);_0x592e4d['attributes']=_[_0xc11e('0x34')](_0x407810[_0xc11e('0x31')],qs['fields'](_0x5dcc49[_0xc11e('0x32')][_0xc11e('0x35')]));_0x592e4d[_0xc11e('0x36')]=_0x592e4d[_0xc11e('0x36')][_0xc11e('0x37')]?_0x592e4d[_0xc11e('0x36')]:_0x407810[_0xc11e('0x31')];if(!_0x5dcc49['query'][_0xc11e('0x38')](_0xc11e('0x39'))){_0x592e4d[_0xc11e('0x3a')]=qs[_0xc11e('0x3a')](_0x5dcc49[_0xc11e('0x32')]['limit']);_0x592e4d[_0xc11e('0x1e')]=qs[_0xc11e('0x1e')](_0x5dcc49[_0xc11e('0x32')][_0xc11e('0x1e')]);}_0x592e4d[_0xc11e('0x3b')]=qs[_0xc11e('0x3c')](_0x5dcc49[_0xc11e('0x32')]['sort']);_0x592e4d[_0xc11e('0x3d')]=qs[_0xc11e('0x33')](_['pick'](_0x5dcc49[_0xc11e('0x32')],_0x407810[_0xc11e('0x33')]),_0x4f81a9);if(_0x5dcc49[_0xc11e('0x32')]['filter']){_0x592e4d['where']=_[_0xc11e('0x3e')](_0x592e4d[_0xc11e('0x3d')],{'$or':_[_0xc11e('0x2d')](_0x4f81a9,function(_0x40f993){if(_0x40f993[_0xc11e('0x2f')]!==_0xc11e('0x3f')){var _0x121765={};_0x121765[_0x40f993[_0xc11e('0x2b')]]={'$like':'%'+_0x5dcc49[_0xc11e('0x32')][_0xc11e('0x40')]+'%'};return _0x121765;}})});}_0x592e4d=_[_0xc11e('0x3e')]({},_0x592e4d,_0x5dcc49[_0xc11e('0x41')]);var _0x1d19bf={'where':_0x592e4d['where']};return db[_0xc11e('0x2e')][_0xc11e('0x20')](_0x1d19bf)['then'](function(_0x5ce1fa){_0x5c68ba[_0xc11e('0x20')]=_0x5ce1fa;if(_0x5dcc49[_0xc11e('0x32')][_0xc11e('0x42')]){_0x592e4d['include']=[{'all':!![]}];}return db[_0xc11e('0x2e')][_0xc11e('0x43')](_0x592e4d);})[_0xc11e('0x27')](function(_0x19a452){_0x5c68ba[_0xc11e('0x44')]=_0x19a452;return _0x5c68ba;})[_0xc11e('0x27')](respondWithFilteredResult(_0x162ec4,_0x592e4d))[_0xc11e('0x45')](handleError(_0x162ec4,null));};exports[_0xc11e('0x46')]=function(_0x5a7b9a,_0xaa38ec){var _0x4eabb7={'raw':!![],'where':{'id':_0x5a7b9a[_0xc11e('0x47')]['id']}},_0x53594a={};_0x53594a[_0xc11e('0x31')]=_['keys'](db[_0xc11e('0x2e')][_0xc11e('0x48')]);_0x53594a[_0xc11e('0x32')]=_[_0xc11e('0x49')](_0x5a7b9a[_0xc11e('0x32')]);_0x53594a[_0xc11e('0x33')]=_[_0xc11e('0x34')](_0x53594a[_0xc11e('0x31')],_0x53594a[_0xc11e('0x32')]);_0x4eabb7['attributes']=_[_0xc11e('0x34')](_0x53594a[_0xc11e('0x31')],qs[_0xc11e('0x35')](_0x5a7b9a[_0xc11e('0x32')][_0xc11e('0x35')]));_0x4eabb7[_0xc11e('0x36')]=_0x4eabb7[_0xc11e('0x36')]['length']?_0x4eabb7['attributes']:_0x53594a[_0xc11e('0x31')];if(_0x5a7b9a[_0xc11e('0x32')][_0xc11e('0x42')]){_0x4eabb7['include']=[{'all':!![]}];}_0x4eabb7=_[_0xc11e('0x3e')]({},_0x4eabb7,_0x5a7b9a[_0xc11e('0x41')]);return db[_0xc11e('0x2e')]['find'](_0x4eabb7)[_0xc11e('0x27')](handleEntityNotFound(_0xaa38ec,null))[_0xc11e('0x27')](respondWithResult(_0xaa38ec,null))['catch'](handleError(_0xaa38ec,null));};exports[_0xc11e('0x4a')]=function(_0x3d8f9f,_0x2a3fed){return db[_0xc11e('0x2e')][_0xc11e('0x4a')](_0x3d8f9f[_0xc11e('0x4b')],{})[_0xc11e('0x27')](function(_0x7b3e22){var _0x2602aa=_0x3d8f9f[_0xc11e('0x4c')][_0xc11e('0x4d')]({'plain':!![]});if(!_0x2602aa)throw new Error(_0xc11e('0x4e'));if(_0x2602aa[_0xc11e('0x4f')]==='user'){var _0x196c4d=_0x7b3e22['get']({'plain':!![]});var _0x1a1789='Dispositions';return db[_0xc11e('0x50')][_0xc11e('0x51')]({'where':{'name':_0x1a1789,'userProfileId':_0x2602aa[_0xc11e('0x52')]},'raw':!![]})[_0xc11e('0x27')](function(_0x1f91b3){if(_0x1f91b3&&_0x1f91b3[_0xc11e('0x53')]===0x0){return db[_0xc11e('0x54')]['create']({'name':_0x196c4d[_0xc11e('0x2b')],'resourceId':_0x196c4d['id'],'type':_0x1f91b3[_0xc11e('0x2b')],'sectionId':_0x1f91b3['id']},{})[_0xc11e('0x27')](function(){return _0x7b3e22;});}else{return _0x7b3e22;}})['catch'](function(_0x1b5efe){logger[_0xc11e('0x29')](_0xc11e('0x55'),_0x1b5efe);throw _0x1b5efe;});}return _0x7b3e22;})[_0xc11e('0x27')](respondWithResult(_0x2a3fed,0xc9))[_0xc11e('0x45')](handleError(_0x2a3fed,null));};exports[_0xc11e('0x25')]=function(_0x24a72e,_0x4d038e){if(_0x24a72e[_0xc11e('0x4b')]['id']){delete _0x24a72e[_0xc11e('0x4b')]['id'];}return db[_0xc11e('0x2e')][_0xc11e('0x51')]({'where':{'id':_0x24a72e[_0xc11e('0x47')]['id']}})[_0xc11e('0x27')](handleEntityNotFound(_0x4d038e,null))['then'](saveUpdates(_0x24a72e[_0xc11e('0x4b')],null))[_0xc11e('0x27')](respondWithResult(_0x4d038e,null))[_0xc11e('0x45')](handleError(_0x4d038e,null));};exports[_0xc11e('0x26')]=function(_0x4dc9f8,_0x3f5dc3){return db[_0xc11e('0x2e')][_0xc11e('0x51')]({'where':{'id':_0x4dc9f8[_0xc11e('0x47')]['id']}})[_0xc11e('0x27')](handleEntityNotFound(_0x3f5dc3,null))[_0xc11e('0x27')](removeEntity(_0x3f5dc3,null))['catch'](handleError(_0x3f5dc3,null));}; \ No newline at end of file +var _0x4074=['fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','UserProfileResource','then','error','stack','name','map','Disposition','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x23fbe3,_0x27067c){var _0x28e01a=function(_0x2638b0){while(--_0x2638b0){_0x23fbe3['push'](_0x23fbe3['shift']());}};_0x28e01a(++_0x27067c);}(_0x4074,0xf0));var _0x4407=function(_0x443c7e,_0xb325f0){_0x443c7e=_0x443c7e-0x0;var _0x33934a=_0x4074[_0x443c7e];return _0x33934a;};'use strict';var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require(_0x4407('0x5'));var Mustache=require(_0x4407('0x6'));var util=require(_0x4407('0x7'));var path=require(_0x4407('0x8'));var sox=require(_0x4407('0x9'));var csv=require(_0x4407('0xa'));var ejs=require(_0x4407('0xb'));var fs=require('fs');var fs_extra=require(_0x4407('0xc'));var _=require('lodash');var squel=require(_0x4407('0xd'));var crypto=require('crypto');var jsforce=require(_0x4407('0xe'));var deskjs=require(_0x4407('0xf'));var toCsv=require(_0x4407('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4407('0x10'));var qs=require(_0x4407('0x11'));var as=require(_0x4407('0x12'));var hardwareService=require(_0x4407('0x13'));var logger=require(_0x4407('0x14'))(_0x4407('0x15'));var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var licenseUtil=require(_0x4407('0x18'));var db=require(_0x4407('0x19'))['db'];function respondWithStatusCode(_0x14f398,_0x5d0c41){_0x5d0c41=_0x5d0c41||0xcc;return function(_0x3f8f23){if(_0x3f8f23){return _0x14f398[_0x4407('0x1a')](_0x5d0c41);}return _0x14f398['status'](_0x5d0c41)[_0x4407('0x1b')]();};}function respondWithResult(_0x4c62b9,_0x1d2ec8){_0x1d2ec8=_0x1d2ec8||0xc8;return function(_0x27724a){if(_0x27724a){return _0x4c62b9[_0x4407('0x1c')](_0x1d2ec8)[_0x4407('0x1d')](_0x27724a);}};}function respondWithFilteredResult(_0x1840dd,_0x417e19){return function(_0x1c5a0c){if(_0x1c5a0c){var _0x2e709f=typeof _0x417e19['offset']===_0x4407('0x1e')&&typeof _0x417e19[_0x4407('0x1f')]===_0x4407('0x1e');var _0x367d55=_0x1c5a0c[_0x4407('0x20')];var _0x5b50b7=_0x2e709f?0x0:_0x417e19[_0x4407('0x21')];var _0x54caa1=_0x2e709f?_0x1c5a0c[_0x4407('0x20')]:_0x417e19[_0x4407('0x21')]+_0x417e19[_0x4407('0x1f')];var _0x2db8b2;if(_0x54caa1>=_0x367d55){_0x54caa1=_0x367d55;_0x2db8b2=0xc8;}else{_0x2db8b2=0xce;}_0x1840dd[_0x4407('0x1c')](_0x2db8b2);return _0x1840dd['set'](_0x4407('0x22'),_0x5b50b7+'-'+_0x54caa1+'/'+_0x367d55)['json'](_0x1c5a0c);}return null;};}function patchUpdates(_0x36a948){return function(_0x28bb2c){try{jsonpatch[_0x4407('0x23')](_0x28bb2c,_0x36a948,!![]);}catch(_0x445fe6){return BPromise['reject'](_0x445fe6);}return _0x28bb2c[_0x4407('0x24')]();};}function saveUpdates(_0x1fa9f1,_0x137f8e){return function(_0x2c880a){if(_0x2c880a){return _0x2c880a[_0x4407('0x25')](_0x1fa9f1)['then'](function(_0xa7265d){return _0xa7265d;});}return null;};}function removeEntity(_0x16272f,_0x5e214c){return function(_0x21b048){if(_0x21b048){return _0x21b048[_0x4407('0x26')]()['then'](function(){var _0x2cbc09=_0x21b048['get']({'plain':!![]});var _0x309274='Dispositions';return db[_0x4407('0x27')]['destroy']({'where':{'type':_0x309274,'resourceId':_0x2cbc09['id']}})[_0x4407('0x28')](function(){return _0x21b048;});})['then'](function(){_0x16272f['status'](0xcc)[_0x4407('0x1b')]();});}};}function handleEntityNotFound(_0x1a7436,_0x21d94e){return function(_0x4819af){if(!_0x4819af){_0x1a7436['sendStatus'](0x194);}return _0x4819af;};}function handleError(_0x4ae052,_0x174c1c){_0x174c1c=_0x174c1c||0x1f4;return function(_0x2feb6b){logger[_0x4407('0x29')](_0x2feb6b[_0x4407('0x2a')]);if(_0x2feb6b[_0x4407('0x2b')]){delete _0x2feb6b[_0x4407('0x2b')];}_0x4ae052[_0x4407('0x1c')](_0x174c1c)['send'](_0x2feb6b);};}exports['index']=function(_0x55d91f,_0x28e99e){var _0x37b738={},_0x357a7c={},_0x3e9460={'count':0x0,'rows':[]};var _0x3e08a7=_[_0x4407('0x2c')](db[_0x4407('0x2d')][_0x4407('0x2e')],function(_0x2784ca){return{'name':_0x2784ca[_0x4407('0x2f')],'type':_0x2784ca['type']['key']};});_0x357a7c[_0x4407('0x30')]=_[_0x4407('0x2c')](_0x3e08a7,_0x4407('0x2b'));_0x357a7c['query']=_[_0x4407('0x31')](_0x55d91f[_0x4407('0x32')]);_0x357a7c[_0x4407('0x33')]=_[_0x4407('0x34')](_0x357a7c[_0x4407('0x30')],_0x357a7c['query']);_0x37b738[_0x4407('0x35')]=_['intersection'](_0x357a7c[_0x4407('0x30')],qs['fields'](_0x55d91f['query'][_0x4407('0x36')]));_0x37b738[_0x4407('0x35')]=_0x37b738[_0x4407('0x35')][_0x4407('0x37')]?_0x37b738[_0x4407('0x35')]:_0x357a7c[_0x4407('0x30')];if(!_0x55d91f[_0x4407('0x32')]['hasOwnProperty'](_0x4407('0x38'))){_0x37b738[_0x4407('0x1f')]=qs[_0x4407('0x1f')](_0x55d91f[_0x4407('0x32')][_0x4407('0x1f')]);_0x37b738['offset']=qs[_0x4407('0x21')](_0x55d91f['query'][_0x4407('0x21')]);}_0x37b738[_0x4407('0x39')]=qs[_0x4407('0x3a')](_0x55d91f[_0x4407('0x32')]['sort']);_0x37b738[_0x4407('0x3b')]=qs[_0x4407('0x33')](_[_0x4407('0x3c')](_0x55d91f[_0x4407('0x32')],_0x357a7c[_0x4407('0x33')]),_0x3e08a7);if(_0x55d91f[_0x4407('0x32')][_0x4407('0x3d')]){_0x37b738[_0x4407('0x3b')]=_[_0x4407('0x3e')](_0x37b738['where'],{'$or':_['map'](_0x3e08a7,function(_0x4528fd){if(_0x4528fd[_0x4407('0x3f')]!==_0x4407('0x40')){var _0x13f74b={};_0x13f74b[_0x4528fd['name']]={'$like':'%'+_0x55d91f[_0x4407('0x32')][_0x4407('0x3d')]+'%'};return _0x13f74b;}})});}_0x37b738=_[_0x4407('0x3e')]({},_0x37b738,_0x55d91f['options']);var _0x1621aa={'where':_0x37b738['where']};return db['Disposition'][_0x4407('0x20')](_0x1621aa)[_0x4407('0x28')](function(_0x234fa5){_0x3e9460[_0x4407('0x20')]=_0x234fa5;if(_0x55d91f[_0x4407('0x32')]['includeAll']){_0x37b738[_0x4407('0x41')]=[{'all':!![]}];}return db[_0x4407('0x2d')][_0x4407('0x42')](_0x37b738);})[_0x4407('0x28')](function(_0x5b41cf){_0x3e9460[_0x4407('0x43')]=_0x5b41cf;return _0x3e9460;})[_0x4407('0x28')](respondWithFilteredResult(_0x28e99e,_0x37b738))[_0x4407('0x44')](handleError(_0x28e99e,null));};exports[_0x4407('0x45')]=function(_0x3c5dcc,_0x4c1c40){var _0xc9953f={'raw':!![],'where':{'id':_0x3c5dcc['params']['id']}},_0x53f2c4={};_0x53f2c4[_0x4407('0x30')]=_[_0x4407('0x31')](db['Disposition'][_0x4407('0x2e')]);_0x53f2c4[_0x4407('0x32')]=_[_0x4407('0x31')](_0x3c5dcc[_0x4407('0x32')]);_0x53f2c4['filters']=_[_0x4407('0x34')](_0x53f2c4[_0x4407('0x30')],_0x53f2c4[_0x4407('0x32')]);_0xc9953f[_0x4407('0x35')]=_[_0x4407('0x34')](_0x53f2c4['model'],qs[_0x4407('0x36')](_0x3c5dcc[_0x4407('0x32')][_0x4407('0x36')]));_0xc9953f[_0x4407('0x35')]=_0xc9953f[_0x4407('0x35')]['length']?_0xc9953f[_0x4407('0x35')]:_0x53f2c4[_0x4407('0x30')];if(_0x3c5dcc[_0x4407('0x32')][_0x4407('0x46')]){_0xc9953f['include']=[{'all':!![]}];}_0xc9953f=_[_0x4407('0x3e')]({},_0xc9953f,_0x3c5dcc[_0x4407('0x47')]);return db['Disposition'][_0x4407('0x48')](_0xc9953f)[_0x4407('0x28')](handleEntityNotFound(_0x4c1c40,null))['then'](respondWithResult(_0x4c1c40,null))[_0x4407('0x44')](handleError(_0x4c1c40,null));};exports[_0x4407('0x49')]=function(_0x5ea36,_0x4fbc1f){return db[_0x4407('0x2d')]['create'](_0x5ea36['body'],{})[_0x4407('0x28')](function(_0x100254){var _0x5f3ad6=_0x5ea36[_0x4407('0x4a')][_0x4407('0x4b')]({'plain':!![]});if(!_0x5f3ad6)throw new Error(_0x4407('0x4c'));if(_0x5f3ad6[_0x4407('0x4d')]===_0x4407('0x4a')){var _0x5a2c2b=_0x100254[_0x4407('0x4b')]({'plain':!![]});var _0x2afdd1=_0x4407('0x4e');return db[_0x4407('0x4f')][_0x4407('0x48')]({'where':{'name':_0x2afdd1,'userProfileId':_0x5f3ad6[_0x4407('0x50')]},'raw':!![]})[_0x4407('0x28')](function(_0x1375b6){if(_0x1375b6&&_0x1375b6[_0x4407('0x51')]===0x0){return db['UserProfileResource'][_0x4407('0x49')]({'name':_0x5a2c2b['name'],'resourceId':_0x5a2c2b['id'],'type':_0x1375b6[_0x4407('0x2b')],'sectionId':_0x1375b6['id']},{})[_0x4407('0x28')](function(){return _0x100254;});}else{return _0x100254;}})[_0x4407('0x44')](function(_0x31d0cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31d0cd);throw _0x31d0cd;});}return _0x100254;})['then'](respondWithResult(_0x4fbc1f,0xc9))[_0x4407('0x44')](handleError(_0x4fbc1f,null));};exports[_0x4407('0x25')]=function(_0x5249c1,_0x218b23){if(_0x5249c1[_0x4407('0x52')]['id']){delete _0x5249c1[_0x4407('0x52')]['id'];}return db[_0x4407('0x2d')]['find']({'where':{'id':_0x5249c1[_0x4407('0x53')]['id']}})[_0x4407('0x28')](handleEntityNotFound(_0x218b23,null))['then'](saveUpdates(_0x5249c1[_0x4407('0x52')],null))[_0x4407('0x28')](respondWithResult(_0x218b23,null))[_0x4407('0x44')](handleError(_0x218b23,null));};exports['destroy']=function(_0x385b11,_0x56b637){return db[_0x4407('0x2d')][_0x4407('0x48')]({'where':{'id':_0x385b11[_0x4407('0x53')]['id']}})[_0x4407('0x28')](handleEntityNotFound(_0x56b637,null))['then'](removeEntity(_0x56b637,null))[_0x4407('0x44')](handleError(_0x56b637,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0c032df..96b2efb 100644 --- a/server/api/disposition/disposition.model.js +++ b/server/api/disposition/disposition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x905a=['rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name','MailAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x18a5fb,_0x33726f){var _0x1a6972=function(_0x13a12e){while(--_0x13a12e){_0x18a5fb['push'](_0x18a5fb['shift']());}};_0x1a6972(++_0x33726f);}(_0x905a,0xeb));var _0xa905=function(_0x5eda82,_0x14bb80){_0x5eda82=_0x5eda82-0x0;var _0x4d1dc9=_0x905a[_0x5eda82];return _0x4d1dc9;};'use strict';var _=require(_0xa905('0x0'));var util=require('util');var logger=require(_0xa905('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa905('0x2'));var rp=require(_0xa905('0x3'));var fs=require('fs');var path=require(_0xa905('0x4'));var rimraf=require(_0xa905('0x5'));var config=require(_0xa905('0x6'));var attributes=require(_0xa905('0x7'));module[_0xa905('0x8')]=function(_0x312150,_0x7667dd){return _0x312150[_0xa905('0x9')](_0xa905('0xa'),attributes,{'tableName':_0xa905('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa905('0xc'),'fields':['name',_0xa905('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xa905('0xe'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xa905('0xe'),_0xa905('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0xa905('0xe'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xa905('0xe'),_0xa905('0x10')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xa905('0x11')]},{'unique':!![],'name':_0xa905('0x12'),'fields':[_0xa905('0xe'),_0xa905('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d28=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_dispositions','name','ListId'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1d28,0x11e));var _0x81d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x81d2('0x0'));var util=require(_0x81d2('0x1'));var logger=require(_0x81d2('0x2'))('api');var moment=require(_0x81d2('0x3'));var BPromise=require(_0x81d2('0x4'));var rp=require(_0x81d2('0x5'));var fs=require('fs');var path=require(_0x81d2('0x6'));var rimraf=require(_0x81d2('0x7'));var config=require(_0x81d2('0x8'));var attributes=require('./disposition.attributes');module[_0x81d2('0x9')]=function(_0x9d3d1a,_0x2d493f){return _0x9d3d1a[_0x81d2('0xa')]('Disposition',attributes,{'tableName':_0x81d2('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x81d2('0xc'),_0x81d2('0xd')]},{'unique':!![],'name':_0x81d2('0xe'),'fields':[_0x81d2('0xc'),_0x81d2('0xf')]},{'unique':!![],'name':_0x81d2('0x10'),'fields':[_0x81d2('0xc'),_0x81d2('0x11')]},{'unique':!![],'name':_0x81d2('0x12'),'fields':[_0x81d2('0xc'),_0x81d2('0x13')]},{'unique':!![],'name':_0x81d2('0x14'),'fields':[_0x81d2('0xc'),_0x81d2('0x15')]},{'unique':!![],'name':_0x81d2('0x16'),'fields':[_0x81d2('0xc'),_0x81d2('0x17')]},{'unique':!![],'name':_0x81d2('0x18'),'fields':[_0x81d2('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d5f99e1..a1a8d2c 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\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(_0x9f61f6,_0xe43827){var _0x47fe14=function(_0x38b38a){while(--_0x38b38a){_0x9f61f6['push'](_0x9f61f6['shift']());}};_0x47fe14(++_0xe43827);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\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(_0x2da885,_0x1e7d1a){var _0x359bef=function(_0x316e21){while(--_0x316e21){_0x2da885['push'](_0x2da885['shift']());}};_0x359bef(++_0x1e7d1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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/disposition/index.js b/server/api/disposition/index.js index 0d5fef5..01cc226 100644 --- a/server/api/disposition/index.js +++ b/server/api/disposition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5267=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','update','destroy','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5267,0xa2));var _0x7526=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5267[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7526('0x0'));var util=require(_0x7526('0x1'));var path=require(_0x7526('0x2'));var timeout=require(_0x7526('0x3'));var express=require(_0x7526('0x4'));var router=express['Router']();var fs_extra=require(_0x7526('0x5'));var auth=require(_0x7526('0x6'));var interaction=require(_0x7526('0x7'));var config=require(_0x7526('0x8'));var controller=require(_0x7526('0x9'));router[_0x7526('0xa')]('/',auth[_0x7526('0xb')](),controller['index']);router[_0x7526('0xa')](_0x7526('0xc'),auth[_0x7526('0xb')](),controller[_0x7526('0xd')]);router[_0x7526('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7526('0xf')]);router['delete'](_0x7526('0xc'),auth[_0x7526('0xb')](),controller[_0x7526('0x10')]);module[_0x7526('0x11')]=router; \ No newline at end of file +var _0xb475=['destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','create','put','delete'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xb475,0x1e2));var _0x5b47=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0xb475[_0x35d59c];return _0x18cd27;};'use strict';var multer=require(_0x5b47('0x0'));var util=require('util');var path=require(_0x5b47('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b47('0x2'));var router=express['Router']();var fs_extra=require(_0x5b47('0x3'));var auth=require(_0x5b47('0x4'));var interaction=require(_0x5b47('0x5'));var config=require(_0x5b47('0x6'));var controller=require(_0x5b47('0x7'));router[_0x5b47('0x8')]('/',auth[_0x5b47('0x9')](),controller['index']);router['get'](_0x5b47('0xa'),auth[_0x5b47('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5b47('0xb')]);router[_0x5b47('0xc')](_0x5b47('0xa'),auth[_0x5b47('0x9')](),controller['update']);router[_0x5b47('0xd')](_0x5b47('0xa'),auth['isAuthenticated'](),controller[_0x5b47('0xe')]);module[_0x5b47('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 5a81d96..896dfb0 100644 --- a/server/api/faxAccount/faxAccount.attributes.js +++ b/server/api/faxAccount/faxAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9c3=['yes','xCALLY\x20Motion\x20Fax','localstationid','7200','9600','12000','14400','4800','2400','v17,v27,v29','INTEGER','SIP','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM'];(function(_0x53112b,_0x17a208){var _0x44267a=function(_0x470ef1){while(--_0x470ef1){_0x53112b['push'](_0x53112b['shift']());}};_0x44267a(++_0x17a208);}(_0xc9c3,0x96));var _0x3c9c=function(_0x5406ae,_0x440448){_0x5406ae=_0x5406ae-0x0;var _0x5a5bb2=_0xc9c3[_0x5406ae];return _0x5a5bb2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3c9c('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x3c9c('0x1')](_0x3c9c('0x2'),'no'),'defaultValue':_0x3c9c('0x2')},'headerinfo':{'type':Sequelize[_0x3c9c('0x0')],'defaultValue':_0x3c9c('0x3')},'localstationid':{'type':Sequelize[_0x3c9c('0x0')],'unique':_0x3c9c('0x4')},'minrate':{'type':Sequelize['ENUM']('2400','4800',_0x3c9c('0x5'),_0x3c9c('0x6'),_0x3c9c('0x7'),_0x3c9c('0x8')),'defaultValue':_0x3c9c('0x9')},'maxrate':{'type':Sequelize[_0x3c9c('0x1')](_0x3c9c('0xa'),_0x3c9c('0x9'),_0x3c9c('0x5'),_0x3c9c('0x6'),'12000',_0x3c9c('0x8')),'defaultValue':_0x3c9c('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x3c9c('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3c9c('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x3c9c('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3c9c('0x1')](_0x3c9c('0xd'),'IAX','DADHI','KHOMP'),'defaultValue':_0x3c9c('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3c9c('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3c9c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3c9c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3c9c('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3c9c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3c9c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3c9c('0xf'),'set':function(_0x32d94a){if(!_0x32d94a)this[_0x3c9c('0x10')](_0x3c9c('0x11'),null);this[_0x3c9c('0x10')](_0x3c9c('0x12'),_0x32d94a);}}}; \ No newline at end of file +var _0x9536=['4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM'];(function(_0x1fbcf5,_0x34fd7f){var _0x1f8261=function(_0x48fe09){while(--_0x48fe09){_0x1fbcf5['push'](_0x1fbcf5['shift']());}};_0x1f8261(++_0x34fd7f);}(_0x9536,0x179));var _0x6953=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x9536[_0x4a599b];return _0x2d53d3;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize[_0x6953('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6953('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x6953('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x6953('0x2')],'defaultValue':_0x6953('0x4')},'localstationid':{'type':Sequelize[_0x6953('0x2')],'unique':_0x6953('0x5')},'minrate':{'type':Sequelize[_0x6953('0x6')]('2400',_0x6953('0x7'),_0x6953('0x8'),_0x6953('0x9'),_0x6953('0xa'),_0x6953('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x6953('0x6')](_0x6953('0xc'),_0x6953('0x7'),'7200',_0x6953('0x9'),_0x6953('0xa'),_0x6953('0xb')),'defaultValue':_0x6953('0xb')},'modem':{'type':Sequelize[_0x6953('0x2')],'defaultValue':_0x6953('0xd')},'gateway':{'type':Sequelize[_0x6953('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6953('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6953('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x6953('0xf'),'IAX',_0x6953('0x10'),_0x6953('0x11')),'defaultValue':_0x6953('0xf')},'key':{'type':Sequelize[_0x6953('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6953('0x12')],'defaultValue':function(){return _0x6953('0x13');}},'notificationSound':{'type':Sequelize[_0x6953('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6953('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6953('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6953('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6953('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6953('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6953('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x6953('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x6953('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b6dcb){if(!_0x1b6dcb)this[_0x6953('0x16')]('mandatoryDispositionPauseId',null);this[_0x6953('0x16')](_0x6953('0x17'),_0x1b6dcb);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8e0732f..a610df4 100644 --- a/server/api/faxAccount/faxAccount.controller.js +++ b/server/api/faxAccount/faxAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0132=['intersection','attributes','fields','nolimit','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','show','params','mandatoryDispositionPause','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','hasOwnProperty','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','User','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','length','from-voip-provider','exten','localstationid','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','VoiceExtension','updateAccountApplications','update','omit','updatedAt','TrunkId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','ListId','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','destroy','get','FaxAccounts','sendStatus','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x2822b8,_0x4f5fa5){var _0x57e882=function(_0x2ed8a2){while(--_0x2ed8a2){_0x2822b8['push'](_0x2822b8['shift']());}};_0x57e882(++_0x4f5fa5);}(_0x0132,0x1f4));var _0x2013=function(_0xf81cc8,_0x2eb96e){_0xf81cc8=_0xf81cc8-0x0;var _0x4868d2=_0x0132[_0xf81cc8];return _0x4868d2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2013('0x0'));var moment=require(_0x2013('0x1'));var BPromise=require(_0x2013('0x2'));var Mustache=require('mustache');var util=require(_0x2013('0x3'));var path=require(_0x2013('0x4'));var sox=require('sox');var csv=require(_0x2013('0x5'));var ejs=require(_0x2013('0x6'));var fs=require('fs');var fs_extra=require(_0x2013('0x7'));var _=require('lodash');var squel=require(_0x2013('0x8'));var crypto=require(_0x2013('0x9'));var jsforce=require(_0x2013('0xa'));var deskjs=require(_0x2013('0xb'));var toCsv=require(_0x2013('0x5'));var querystring=require('querystring');var Papa=require(_0x2013('0xc'));var Redis=require('ioredis');var authService=require(_0x2013('0xd'));var qs=require(_0x2013('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2013('0xf'));var logger=require('../../config/logger')(_0x2013('0x10'));var utils=require('../../config/utils');var config=require(_0x2013('0x11'));var licenseUtil=require(_0x2013('0x12'));var db=require(_0x2013('0x13'))['db'];config[_0x2013('0x14')]=_[_0x2013('0x15')](config[_0x2013('0x14')],{'host':_0x2013('0x16'),'port':0x18eb});var socket=require(_0x2013('0x17'))(new Redis(config[_0x2013('0x14')]));require(_0x2013('0x18'))['register'](socket);var jayson=require(_0x2013('0x19'));var client=jayson[_0x2013('0x1a')][_0x2013('0x1b')]({'port':0x232c});var client9002=jayson[_0x2013('0x1a')][_0x2013('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5a00e2,_0x1e6eb5,_0x2269be,_0x50273d){return new BPromise(function(_0x21763f,_0x1c24ae){var _0x365898=_0x50273d||client;return _0x365898[_0x2013('0x1c')](_0x5a00e2,_0x2269be)[_0x2013('0x1d')](function(_0x19cef6){logger['info'](_0x2013('0x1e'),_0x1e6eb5,_0x2013('0x1f'));logger['debug'](_0x2013('0x20'),_0x1e6eb5,_0x2013('0x1f'),JSON['stringify'](_0x19cef6));if(_0x19cef6[_0x2013('0x21')]){if(_0x19cef6[_0x2013('0x21')][_0x2013('0x22')]===0x1f4){logger[_0x2013('0x21')]('FaxAccount,\x20%s,\x20%s',_0x1e6eb5,_0x19cef6[_0x2013('0x21')][_0x2013('0x23')]);return _0x1c24ae(_0x19cef6[_0x2013('0x21')]['message']);}logger[_0x2013('0x21')](_0x2013('0x1e'),_0x1e6eb5,_0x19cef6[_0x2013('0x21')][_0x2013('0x23')]);return _0x21763f(_0x19cef6[_0x2013('0x21')][_0x2013('0x23')]);}else{logger[_0x2013('0x24')](_0x2013('0x1e'),_0x1e6eb5,_0x2013('0x1f'));_0x21763f(_0x19cef6['result'][_0x2013('0x23')]);}})[_0x2013('0x25')](function(_0x317533){logger[_0x2013('0x21')](_0x2013('0x1e'),_0x1e6eb5,_0x317533);_0x1c24ae(_0x317533);});});}function respondWithStatusCode(_0x5c70dd,_0x4645fd){_0x4645fd=_0x4645fd||0xcc;return function(_0xf12233){if(_0xf12233){return _0x5c70dd['sendStatus'](_0x4645fd);}return _0x5c70dd[_0x2013('0x26')](_0x4645fd)[_0x2013('0x27')]();};}function respondWithResult(_0x21c5b5,_0x31a710){_0x31a710=_0x31a710||0xc8;return function(_0x1d45ef){if(_0x1d45ef){return _0x21c5b5[_0x2013('0x26')](_0x31a710)[_0x2013('0x28')](_0x1d45ef);}};}function respondWithFilteredResult(_0x28b268,_0x5686ce){return function(_0x325f34){if(_0x325f34){var _0x1994c1=typeof _0x5686ce['offset']===_0x2013('0x29')&&typeof _0x5686ce['limit']===_0x2013('0x29');var _0x75b0ad=_0x325f34[_0x2013('0x2a')];var _0x38ad63=_0x1994c1?0x0:_0x5686ce[_0x2013('0x2b')];var _0x1fadbb=_0x1994c1?_0x325f34[_0x2013('0x2a')]:_0x5686ce[_0x2013('0x2b')]+_0x5686ce[_0x2013('0x2c')];var _0x1de9db;if(_0x1fadbb>=_0x75b0ad){_0x1fadbb=_0x75b0ad;_0x1de9db=0xc8;}else{_0x1de9db=0xce;}_0x28b268[_0x2013('0x26')](_0x1de9db);return _0x28b268[_0x2013('0x2d')](_0x2013('0x2e'),_0x38ad63+'-'+_0x1fadbb+'/'+_0x75b0ad)[_0x2013('0x28')](_0x325f34);}return null;};}function patchUpdates(_0x169fc4){return function(_0x5a67e0){try{jsonpatch['apply'](_0x5a67e0,_0x169fc4,!![]);}catch(_0x32a75f){return BPromise[_0x2013('0x2f')](_0x32a75f);}return _0x5a67e0[_0x2013('0x30')]();};}function saveUpdates(_0x4734ad,_0x2f416d){return function(_0xd1dcf7){if(_0xd1dcf7){return _0xd1dcf7['update'](_0x4734ad)[_0x2013('0x1d')](function(_0x48e3b1){return _0x48e3b1;});}return null;};}function removeEntity(_0x43d345,_0x1281e6){return function(_0x3e74f8){if(_0x3e74f8){return _0x3e74f8[_0x2013('0x31')]()[_0x2013('0x1d')](function(){var _0x134882=_0x3e74f8[_0x2013('0x32')]({'plain':!![]});var _0x2ef723=_0x2013('0x33');return db['UserProfileResource']['destroy']({'where':{'type':_0x2ef723,'resourceId':_0x134882['id']}})[_0x2013('0x1d')](function(){return _0x3e74f8;});})[_0x2013('0x1d')](function(){_0x43d345[_0x2013('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b50ff,_0x2fca2f){return function(_0x1ac22f){if(!_0x1ac22f){_0x3b50ff[_0x2013('0x34')](0x194);}return _0x1ac22f;};}function handleError(_0x34067e,_0x5be85e){_0x5be85e=_0x5be85e||0x1f4;return function(_0x59fe92){logger[_0x2013('0x21')](_0x59fe92['stack']);if(_0x59fe92['name']){delete _0x59fe92[_0x2013('0x35')];}_0x34067e[_0x2013('0x26')](_0x5be85e)[_0x2013('0x36')](_0x59fe92);};}exports[_0x2013('0x37')]=function(_0x1335ba,_0xee5c5c){var _0x5564d2={'include':[{'model':db[_0x2013('0x38')],'as':'mandatoryDispositionPause'}]},_0x3902a9={},_0x479015={'count':0x0,'rows':[]};var _0x5be6e7=_[_0x2013('0x39')](db[_0x2013('0x3a')][_0x2013('0x3b')],function(_0x45e240){return{'name':_0x45e240[_0x2013('0x3c')],'type':_0x45e240[_0x2013('0x3d')][_0x2013('0x3e')]};});_0x3902a9[_0x2013('0x3f')]=_[_0x2013('0x39')](_0x5be6e7,_0x2013('0x35'));_0x3902a9[_0x2013('0x40')]=_[_0x2013('0x41')](_0x1335ba[_0x2013('0x40')]);_0x3902a9[_0x2013('0x42')]=_[_0x2013('0x43')](_0x3902a9[_0x2013('0x3f')],_0x3902a9[_0x2013('0x40')]);_0x5564d2[_0x2013('0x44')]=_[_0x2013('0x43')](_0x3902a9[_0x2013('0x3f')],qs[_0x2013('0x45')](_0x1335ba[_0x2013('0x40')]['fields']));_0x5564d2[_0x2013('0x44')]=_0x5564d2[_0x2013('0x44')]['length']?_0x5564d2['attributes']:_0x3902a9['model'];if(!_0x1335ba[_0x2013('0x40')]['hasOwnProperty'](_0x2013('0x46'))){_0x5564d2['limit']=qs[_0x2013('0x2c')](_0x1335ba[_0x2013('0x40')][_0x2013('0x2c')]);_0x5564d2[_0x2013('0x2b')]=qs[_0x2013('0x2b')](_0x1335ba[_0x2013('0x40')][_0x2013('0x2b')]);}_0x5564d2['order']=qs[_0x2013('0x47')](_0x1335ba[_0x2013('0x40')][_0x2013('0x47')]);_0x5564d2['where']=qs[_0x2013('0x42')](_[_0x2013('0x48')](_0x1335ba[_0x2013('0x40')],_0x3902a9[_0x2013('0x42')]),_0x5be6e7);if(_0x1335ba['query'][_0x2013('0x49')]){_0x5564d2[_0x2013('0x4a')]=_['merge'](_0x5564d2[_0x2013('0x4a')],{'$or':_[_0x2013('0x39')](_0x5be6e7,function(_0x49c04a){if(_0x49c04a['type']!==_0x2013('0x4b')){var _0x572b99={};_0x572b99[_0x49c04a[_0x2013('0x35')]]={'$like':'%'+_0x1335ba[_0x2013('0x40')][_0x2013('0x49')]+'%'};return _0x572b99;}})});}_0x5564d2=_['merge']({},_0x5564d2,_0x1335ba[_0x2013('0x4c')]);var _0x4a4717={'where':_0x5564d2[_0x2013('0x4a')]};return db['FaxAccount'][_0x2013('0x2a')](_0x4a4717)[_0x2013('0x1d')](function(_0x565bad){_0x479015[_0x2013('0x2a')]=_0x565bad;if(_0x1335ba[_0x2013('0x40')]['includeAll']){_0x5564d2[_0x2013('0x4d')]=[{'all':!![]}];}return db[_0x2013('0x3a')][_0x2013('0x4e')](_0x5564d2);})[_0x2013('0x1d')](function(_0x3dc199){_0x479015[_0x2013('0x4f')]=_0x3dc199;return _0x479015;})[_0x2013('0x1d')](respondWithFilteredResult(_0xee5c5c,_0x5564d2))['catch'](handleError(_0xee5c5c,null));};exports[_0x2013('0x50')]=function(_0x2b84f9,_0x1c7b68){var _0x501900={'raw':![],'where':{'id':_0x2b84f9[_0x2013('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x2013('0x52')}]},_0x2ce02d={};_0x2ce02d[_0x2013('0x3f')]=_['keys'](db['FaxAccount'][_0x2013('0x3b')]);_0x2ce02d[_0x2013('0x40')]=_[_0x2013('0x41')](_0x2b84f9['query']);_0x2ce02d[_0x2013('0x42')]=_['intersection'](_0x2ce02d['model'],_0x2ce02d[_0x2013('0x40')]);_0x501900['attributes']=_[_0x2013('0x43')](_0x2ce02d['model'],qs[_0x2013('0x45')](_0x2b84f9[_0x2013('0x40')][_0x2013('0x45')]));_0x501900['attributes']=_0x501900['attributes']['length']?_0x501900['attributes']:_0x2ce02d[_0x2013('0x3f')];if(_0x2b84f9[_0x2013('0x40')][_0x2013('0x53')]){_0x501900[_0x2013('0x4d')]=[{'all':!![]}];}_0x501900=_[_0x2013('0x54')]({},_0x501900,_0x2b84f9[_0x2013('0x4c')]);return db[_0x2013('0x3a')][_0x2013('0x55')](_0x501900)['then'](handleEntityNotFound(_0x1c7b68,null))[_0x2013('0x1d')](respondWithResult(_0x1c7b68,null))['catch'](handleError(_0x1c7b68,null));};exports[_0x2013('0x56')]=function(_0x34d4f0,_0x542297){return db['FaxAccount'][_0x2013('0x56')](_0x34d4f0[_0x2013('0x57')],{})['then'](function(_0x69b351){var _0x3578f2=_0x34d4f0[_0x2013('0x58')][_0x2013('0x32')]({'plain':!![]});if(!_0x3578f2)throw new Error(_0x2013('0x59'));if(_0x3578f2[_0x2013('0x5a')]===_0x2013('0x58')){var _0x4a7148=_0x69b351[_0x2013('0x32')]({'plain':!![]});var _0x53f12d=_0x2013('0x33');return db[_0x2013('0x5b')][_0x2013('0x55')]({'where':{'name':_0x53f12d,'userProfileId':_0x3578f2[_0x2013('0x5c')]},'raw':!![]})[_0x2013('0x1d')](function(_0x33cb1a){if(_0x33cb1a&&_0x33cb1a[_0x2013('0x5d')]===0x0){return db[_0x2013('0x5e')][_0x2013('0x56')]({'name':_0x4a7148['name'],'resourceId':_0x4a7148['id'],'type':_0x33cb1a[_0x2013('0x35')],'sectionId':_0x33cb1a['id']},{})[_0x2013('0x1d')](function(){return _0x69b351;});}else{return _0x69b351;}})[_0x2013('0x25')](function(_0x336e1e){logger[_0x2013('0x21')](_0x2013('0x5f'),_0x336e1e);throw _0x336e1e;});}return _0x69b351;})['then'](respondWithResult(_0x542297,0xc9))['catch'](handleError(_0x542297,null));};exports['update']=function(_0x176a20,_0x4e5024){if(_0x176a20['body']['id']){delete _0x176a20[_0x2013('0x57')]['id'];}return db['FaxAccount'][_0x2013('0x55')]({'where':{'id':_0x176a20[_0x2013('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x2013('0x52')}]})[_0x2013('0x1d')](handleEntityNotFound(_0x4e5024,null))[_0x2013('0x1d')](saveUpdates(_0x176a20[_0x2013('0x57')],null))[_0x2013('0x1d')](respondWithResult(_0x4e5024,null))['catch'](handleError(_0x4e5024,null));};exports[_0x2013('0x31')]=function(_0x2c9593,_0x38002c){return db[_0x2013('0x3a')][_0x2013('0x55')]({'where':{'id':_0x2c9593[_0x2013('0x51')]['id']}})['then'](handleEntityNotFound(_0x38002c,null))['then'](removeEntity(_0x38002c,null))[_0x2013('0x25')](handleError(_0x38002c,null));};exports['describe']=function(_0x3df9fb,_0x53aa8d){return db[_0x2013('0x3a')]['describe']()[_0x2013('0x1d')](respondWithResult(_0x53aa8d,null))[_0x2013('0x25')](handleError(_0x53aa8d,null));};exports[_0x2013('0x60')]=function(_0x337d0d,_0x2fecfa,_0x2e3ed9){if(_0x337d0d[_0x2013('0x57')]['id']){delete _0x337d0d[_0x2013('0x57')]['id'];}return db['FaxAccount'][_0x2013('0x55')]({'where':{'id':_0x337d0d[_0x2013('0x51')]['id']}})['then'](handleEntityNotFound(_0x2fecfa,null))[_0x2013('0x1d')](function(_0xb648b2){if(_0xb648b2){_0x337d0d[_0x2013('0x57')][_0x2013('0x61')]=_0xb648b2['id'];return db['Disposition'][_0x2013('0x56')](_0x337d0d['body']);}})[_0x2013('0x1d')](respondWithResult(_0x2fecfa,null))[_0x2013('0x25')](handleError(_0x2fecfa,null));};exports[_0x2013('0x62')]=function(_0x2c4d79,_0xf17712,_0x13c1f5){var _0xe7d9ee={'raw':![],'where':{}};var _0x332e0f={};var _0x5d4cd0={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2013('0x63')]({'where':{'id':_0x2c4d79[_0x2013('0x51')]['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0xf17712,null))[_0x2013('0x1d')](function(_0xa8a9da){if(_0xa8a9da){_0x332e0f[_0x2013('0x3f')]=_[_0x2013('0x41')](db[_0x2013('0x64')]['rawAttributes']);_0x332e0f[_0x2013('0x40')]=_[_0x2013('0x41')](_0x2c4d79[_0x2013('0x40')]);_0x332e0f[_0x2013('0x42')]=_[_0x2013('0x43')](_0x332e0f[_0x2013('0x3f')],_0x332e0f['query']);_0xe7d9ee[_0x2013('0x44')]=_['intersection'](_0x332e0f['model'],qs[_0x2013('0x45')](_0x2c4d79['query']['fields']));_0xe7d9ee[_0x2013('0x44')]=_0xe7d9ee[_0x2013('0x44')]['length']?_0xe7d9ee[_0x2013('0x44')]:_0x332e0f[_0x2013('0x3f')];if(!_0x2c4d79['query'][_0x2013('0x65')](_0x2013('0x46'))){_0xe7d9ee[_0x2013('0x2c')]=qs[_0x2013('0x2c')](_0x2c4d79[_0x2013('0x40')][_0x2013('0x2c')]);_0xe7d9ee[_0x2013('0x2b')]=qs[_0x2013('0x2b')](_0x2c4d79[_0x2013('0x40')]['offset']);}_0xe7d9ee[_0x2013('0x66')]=qs[_0x2013('0x47')](_0x2c4d79[_0x2013('0x40')][_0x2013('0x47')]);_0xe7d9ee[_0x2013('0x4a')]=qs['filters'](_[_0x2013('0x48')](_0x2c4d79['query'],_0x332e0f[_0x2013('0x42')]));_0xe7d9ee['where']['FaxAccountId']=_0xa8a9da['id'];if(_0x2c4d79[_0x2013('0x40')][_0x2013('0x49')]){_0xe7d9ee[_0x2013('0x4a')]=_[_0x2013('0x54')](_0xe7d9ee[_0x2013('0x4a')],{'$or':_['map'](_0xe7d9ee[_0x2013('0x44')],function(_0xc4fbe7){var _0x2a8f73={};_0x2a8f73[_0xc4fbe7]={'$like':'%'+_0x2c4d79[_0x2013('0x40')][_0x2013('0x49')]+'%'};return _0x2a8f73;})});}_0xe7d9ee=_[_0x2013('0x54')]({},_0xe7d9ee,_0x2c4d79[_0x2013('0x4c')]);return db[_0x2013('0x64')][_0x2013('0x2a')]({'where':_0xe7d9ee[_0x2013('0x4a')]})[_0x2013('0x1d')](function(_0x50bf73){_0x5d4cd0[_0x2013('0x2a')]=_0x50bf73;if(_0x2c4d79[_0x2013('0x40')]['includeAll']){_0xe7d9ee[_0x2013('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0x2013('0x4e')](_0xe7d9ee);})[_0x2013('0x1d')](function(_0x588cfe){_0x5d4cd0['rows']=_0x588cfe;return _0x5d4cd0;});}})[_0x2013('0x1d')](respondWithFilteredResult(_0xf17712,_0xe7d9ee))[_0x2013('0x25')](handleError(_0xf17712,null));};exports[_0x2013('0x67')]=function(_0x35d244,_0x45f409,_0x2dbba4){return db[_0x2013('0x3a')][_0x2013('0x55')]({'where':{'id':_0x35d244[_0x2013('0x51')]['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0x45f409,null))[_0x2013('0x1d')](function(_0x591749){if(_0x591749){return _0x591749[_0x2013('0x67')](_0x35d244[_0x2013('0x40')][_0x2013('0x68')]);}})['then'](respondWithStatusCode(_0x45f409,null))[_0x2013('0x25')](handleError(_0x45f409,null));};exports[_0x2013('0x69')]=function(_0x4ec6a6,_0x437ef7,_0x4844ae){if(_0x4ec6a6['body']['id']){delete _0x4ec6a6['body']['id'];}return db[_0x2013('0x3a')][_0x2013('0x55')]({'where':{'id':_0x4ec6a6['params']['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0x437ef7,null))[_0x2013('0x1d')](function(_0x574662){if(_0x574662){_0x4ec6a6[_0x2013('0x57')][_0x2013('0x61')]=_0x574662['id'];return db['CannedAnswer'][_0x2013('0x56')](_0x4ec6a6[_0x2013('0x57')]);}})[_0x2013('0x1d')](respondWithResult(_0x437ef7,null))['catch'](handleError(_0x437ef7,null));};exports[_0x2013('0x6a')]=function(_0x393e4c,_0x5dad4e,_0x4a4cad){var _0x180d4d={'raw':![],'where':{}};var _0x4dcb07={};var _0x5be4c1={'count':0x0,'rows':[]};return db[_0x2013('0x3a')][_0x2013('0x63')]({'where':{'id':_0x393e4c['params']['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0x5dad4e,null))[_0x2013('0x1d')](function(_0x2f2461){if(_0x2f2461){_0x4dcb07[_0x2013('0x3f')]=_[_0x2013('0x41')](db[_0x2013('0x6b')][_0x2013('0x3b')]);_0x4dcb07['query']=_[_0x2013('0x41')](_0x393e4c[_0x2013('0x40')]);_0x4dcb07[_0x2013('0x42')]=_[_0x2013('0x43')](_0x4dcb07[_0x2013('0x3f')],_0x4dcb07[_0x2013('0x40')]);_0x180d4d[_0x2013('0x44')]=_[_0x2013('0x43')](_0x4dcb07['model'],qs['fields'](_0x393e4c[_0x2013('0x40')]['fields']));_0x180d4d[_0x2013('0x44')]=_0x180d4d[_0x2013('0x44')]['length']?_0x180d4d[_0x2013('0x44')]:_0x4dcb07['model'];if(!_0x393e4c[_0x2013('0x40')]['hasOwnProperty'](_0x2013('0x46'))){_0x180d4d[_0x2013('0x2c')]=qs[_0x2013('0x2c')](_0x393e4c[_0x2013('0x40')][_0x2013('0x2c')]);_0x180d4d[_0x2013('0x2b')]=qs[_0x2013('0x2b')](_0x393e4c['query'][_0x2013('0x2b')]);}_0x180d4d[_0x2013('0x66')]=qs[_0x2013('0x47')](_0x393e4c['query'][_0x2013('0x47')]);_0x180d4d[_0x2013('0x4a')]=qs['filters'](_['pick'](_0x393e4c[_0x2013('0x40')],_0x4dcb07[_0x2013('0x42')]));_0x180d4d[_0x2013('0x4a')]['FaxAccountId']=_0x2f2461['id'];if(_0x393e4c['query'][_0x2013('0x49')]){_0x180d4d[_0x2013('0x4a')]=_[_0x2013('0x54')](_0x180d4d['where'],{'$or':_['map'](_0x180d4d['attributes'],function(_0x3ac815){var _0x2979bf={};_0x2979bf[_0x3ac815]={'$like':'%'+_0x393e4c['query'][_0x2013('0x49')]+'%'};return _0x2979bf;})});}_0x180d4d=_[_0x2013('0x54')]({},_0x180d4d,_0x393e4c[_0x2013('0x4c')]);return db['CannedAnswer'][_0x2013('0x2a')]({'where':_0x180d4d[_0x2013('0x4a')]})[_0x2013('0x1d')](function(_0x2f886d){_0x5be4c1[_0x2013('0x2a')]=_0x2f886d;if(_0x393e4c[_0x2013('0x40')][_0x2013('0x53')]){_0x180d4d[_0x2013('0x4d')]=[{'all':!![]}];}return db[_0x2013('0x6b')][_0x2013('0x4e')](_0x180d4d);})[_0x2013('0x1d')](function(_0xcb9d10){_0x5be4c1[_0x2013('0x4f')]=_0xcb9d10;return _0x5be4c1;});}})[_0x2013('0x1d')](respondWithFilteredResult(_0x5dad4e,_0x180d4d))[_0x2013('0x25')](handleError(_0x5dad4e,null));};exports[_0x2013('0x6c')]=function(_0xf084a1,_0x30dd33,_0x256efc){return db[_0x2013('0x3a')][_0x2013('0x55')]({'where':{'id':_0xf084a1[_0x2013('0x51')]['id']}})['then'](handleEntityNotFound(_0x30dd33,null))['then'](function(_0x5494b7){if(_0x5494b7){return _0x5494b7[_0x2013('0x6c')](_0xf084a1[_0x2013('0x40')][_0x2013('0x68')]);}})[_0x2013('0x1d')](respondWithStatusCode(_0x30dd33,null))['catch'](handleError(_0x30dd33,null));};exports[_0x2013('0x6d')]=function(_0xf336af,_0x532875,_0xaa9dc3){return db['FaxInteraction'][_0x2013('0x55')]({'where':{'id':_0xf336af[_0x2013('0x51')]['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0x532875,null))[_0x2013('0x1d')](function(_0x33c15d){if(_0x33c15d){return _0x33c15d['addInteraction'](_0xf336af['body'][_0x2013('0x68')],_['omit'](_0xf336af['body'],['ids','id'])||{});}})[_0x2013('0x1d')](respondWithResult(_0x532875,null))[_0x2013('0x25')](handleError(_0x532875,null));};exports[_0x2013('0x6e')]=function(_0xfa1cc8,_0x18041b,_0x30a006){var _0x921316={'raw':![],'where':{}};var _0x144fd7={};var _0x3f71c1={'count':0x0,'rows':[]};return db[_0x2013('0x3a')][_0x2013('0x63')]({'where':{'id':_0xfa1cc8[_0x2013('0x51')]['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0x18041b,null))[_0x2013('0x1d')](function(_0x3b33b9){if(_0x3b33b9){_0x144fd7[_0x2013('0x3f')]=_['keys'](db[_0x2013('0x6f')]['rawAttributes']);_0x144fd7[_0x2013('0x40')]=_[_0x2013('0x41')](_0xfa1cc8[_0x2013('0x40')]);_0x144fd7['filters']=_['intersection'](_0x144fd7[_0x2013('0x3f')],_0x144fd7[_0x2013('0x40')]);_0x921316['attributes']=_[_0x2013('0x43')](_0x144fd7['model'],qs[_0x2013('0x45')](_0xfa1cc8['query'][_0x2013('0x45')]));_0x921316[_0x2013('0x44')]=_0x921316[_0x2013('0x44')]['length']?_0x921316[_0x2013('0x44')]:_0x144fd7[_0x2013('0x3f')];if(!_0xfa1cc8[_0x2013('0x40')][_0x2013('0x65')](_0x2013('0x46'))){_0x921316[_0x2013('0x2c')]=qs['limit'](_0xfa1cc8[_0x2013('0x40')][_0x2013('0x2c')]);_0x921316[_0x2013('0x2b')]=qs[_0x2013('0x2b')](_0xfa1cc8[_0x2013('0x40')][_0x2013('0x2b')]);}_0x921316['order']=qs[_0x2013('0x47')](_0xfa1cc8[_0x2013('0x40')][_0x2013('0x47')]);_0x921316[_0x2013('0x4a')]=qs[_0x2013('0x42')](_[_0x2013('0x48')](_0xfa1cc8[_0x2013('0x40')],_0x144fd7[_0x2013('0x42')]));_0x921316[_0x2013('0x4a')][_0x2013('0x61')]=_0x3b33b9['id'];if(_0xfa1cc8['query'][_0x2013('0x49')]){_0x921316[_0x2013('0x4a')]=_['merge'](_0x921316[_0x2013('0x4a')],{'$or':_['map'](_0x921316[_0x2013('0x44')],function(_0x3e9b1c){var _0x160a1b={};_0x160a1b[_0x3e9b1c]={'$like':'%'+_0xfa1cc8[_0x2013('0x40')]['filter']+'%'};return _0x160a1b;})});}_0x921316=_[_0x2013('0x54')]({},_0x921316,_0xfa1cc8[_0x2013('0x4c')]);return db[_0x2013('0x6f')][_0x2013('0x2a')]({'where':_0x921316[_0x2013('0x4a')]})[_0x2013('0x1d')](function(_0x4a5a30){_0x3f71c1[_0x2013('0x2a')]=_0x4a5a30;if(_0xfa1cc8[_0x2013('0x40')][_0x2013('0x53')]){_0x921316[_0x2013('0x4d')]=[{'model':db[_0x2013('0x70')],'as':'Contact','required':![]},{'model':db[_0x2013('0x71')],'as':_0x2013('0x72'),'attributes':['name',_0x2013('0x73'),_0x2013('0x74')],'required':![]},{'model':db[_0x2013('0x75')],'as':'Tags','attributes':['id',_0x2013('0x35'),'color'],'where':_0xfa1cc8[_0x2013('0x40')]['tag']?{'id':_0xfa1cc8[_0x2013('0x40')][_0x2013('0x76')]}:undefined,'required':_0xfa1cc8['query'][_0x2013('0x76')]?!![]:![]}];}return db['FaxInteraction'][_0x2013('0x4e')](_0x921316);})[_0x2013('0x1d')](function(_0x25ed03){_0x3f71c1[_0x2013('0x4f')]=_0x25ed03;return _0x3f71c1;});}})[_0x2013('0x1d')](respondWithFilteredResult(_0x18041b,_0x921316))['catch'](handleError(_0x18041b,null));};exports[_0x2013('0x77')]=function(_0x91989d,_0x42540e){var _0x2cb8f=_0x91989d['params']['id'];var _0x378c21=_0x91989d[_0x2013('0x57')];var _0x5a0989=0xc8;var _0x4ed024=null;return db[_0x2013('0x78')][_0x2013('0x79')]({'isolationLevel':db[_0x2013('0x78')]['Transaction'][_0x2013('0x7a')][_0x2013('0x7b')]},function(_0x223374){return db[_0x2013('0x3a')]['findOne']({'where':{'id':_0x2cb8f},'transaction':_0x223374})['then'](function(_0xce8a7b){if(_0xce8a7b){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x2cb8f},'transaction':_0x223374})[_0x2013('0x1d')](function(){var _0x52ae77=_[_0x2013('0x39')](_0x378c21,function(_0x525757){_0x525757[_0x2013('0x61')]=_0x2cb8f;return _0x525757;});return db[_0x2013('0x7c')][_0x2013('0x7d')](_0x52ae77,{'transaction':_0x223374});});}else{_0x5a0989=0x194;_0x4ed024=[];}});})[_0x2013('0x1d')](function(){if(_0x5a0989!==0x194){return db[_0x2013('0x7c')][_0x2013('0x7e')]({'where':{'FaxAccountId':_0x2cb8f},'order':_0x2013('0x7f')})[_0x2013('0x1d')](function(_0x3caf10){_0x4ed024=_0x3caf10;});}})[_0x2013('0x25')](function(_0x5e78a1){_0x5a0989=0x1f4;logger[_0x2013('0x21')](_0x5e78a1[_0x2013('0x80')]);if(_0x5e78a1[_0x2013('0x35')]){delete _0x5e78a1[_0x2013('0x35')];}_0x4ed024=_0x5e78a1;})[_0x2013('0x81')](function(){if(_0x4ed024===null){_0x42540e[_0x2013('0x34')](_0x5a0989);}else{if(_0x5a0989===0x1f4){_0x42540e[_0x2013('0x26')](_0x5a0989)[_0x2013('0x36')](_0x4ed024);}else{_0x42540e[_0x2013('0x26')](_0x5a0989)['json'](_0x4ed024);}}});};exports[_0x2013('0x82')]=function(_0x254e98,_0xc9bf30,_0x59c9d7){var _0x210876={};var _0x5d3165={};var _0x56c25c;var _0x580ef7;return db[_0x2013('0x3a')][_0x2013('0x63')]({'where':{'id':_0x254e98['params']['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0xc9bf30,null))[_0x2013('0x1d')](function(_0x5e8413){if(_0x5e8413){_0x56c25c=_0x5e8413;_0x5d3165[_0x2013('0x3f')]=_[_0x2013('0x41')](db[_0x2013('0x7c')]['rawAttributes']);_0x5d3165[_0x2013('0x40')]=_['keys'](_0x254e98[_0x2013('0x40')]);_0x5d3165[_0x2013('0x42')]=_[_0x2013('0x43')](_0x5d3165[_0x2013('0x3f')],_0x5d3165['query']);_0x210876[_0x2013('0x44')]=_[_0x2013('0x43')](_0x5d3165['model'],qs[_0x2013('0x45')](_0x254e98['query'][_0x2013('0x45')]));_0x210876[_0x2013('0x44')]=_0x210876[_0x2013('0x44')]['length']?_0x210876['attributes']:_0x5d3165['model'];_0x210876[_0x2013('0x66')]=qs[_0x2013('0x47')](_0x254e98[_0x2013('0x40')][_0x2013('0x47')]);_0x210876[_0x2013('0x4a')]=qs['filters'](_[_0x2013('0x48')](_0x254e98[_0x2013('0x40')],_0x5d3165[_0x2013('0x42')]));if(_0x254e98[_0x2013('0x40')][_0x2013('0x49')]){_0x210876[_0x2013('0x4a')]=_['merge'](_0x210876[_0x2013('0x4a')],{'$or':_[_0x2013('0x39')](_0x210876['attributes'],function(_0x512885){var _0x37c2a4={};_0x37c2a4[_0x512885]={'$like':'%'+_0x254e98[_0x2013('0x40')]['filter']+'%'};return _0x37c2a4;})});}_0x210876=_[_0x2013('0x54')]({},_0x210876,_0x254e98[_0x2013('0x4c')]);return _0x56c25c['getApplications'](_0x210876);}})[_0x2013('0x1d')](function(_0x45fa73){if(_0x45fa73){_0x580ef7=_0x45fa73[_0x2013('0x83')];if(!_0x254e98['query'][_0x2013('0x65')](_0x2013('0x46'))){_0x210876[_0x2013('0x2c')]=qs[_0x2013('0x2c')](_0x254e98['query'][_0x2013('0x2c')]);_0x210876[_0x2013('0x2b')]=qs[_0x2013('0x2b')](_0x254e98['query']['offset']);}return _0x56c25c['getApplications'](_0x210876);}})[_0x2013('0x1d')](function(_0x22c5a6){if(_0x22c5a6){return _0x22c5a6?{'count':_0x580ef7,'rows':_0x22c5a6}:null;}})['then'](respondWithResult(_0xc9bf30,null))[_0x2013('0x25')](handleError(_0xc9bf30,null));};function Extension(_0x41f77d,_0x33f29c,_0x5d7f2e,_0x37dcc6){this['context']=_0x2013('0x84');this[_0x2013('0x85')]=_0x41f77d[_0x2013('0x86')];this['app']=_0x37dcc6;this['type']='system';this['description']=_0x2013('0x87');this['FaxAccountId']=_0x41f77d['id'];this[_0x2013('0x7f')]=_0x33f29c;this[_0x2013('0x88')]=_0x5d7f2e;}function createExtensionsReciveFax(_0x5bc7c7){var _0x4e1cca=0x1;var _0x46e5a0=[];_0x46e5a0['push'](new Extension(_0x5bc7c7,_0x4e1cca,'','Answer'));_0x4e1cca+=0x1;_0x46e5a0[_0x2013('0x89')](new Extension(_0x5bc7c7,_0x4e1cca,_0x2013('0x8a'),_0x2013('0x8b')));_0x4e1cca+=0x1;for(var _0x4ddd13 in _0x5bc7c7){if(_0x5bc7c7[_0x2013('0x65')](_0x4ddd13)&&(_0x4ddd13===_0x2013('0x8c')||_0x4ddd13===_0x2013('0x86')||_0x4ddd13==='gateway'||_0x4ddd13==='faxdetect'||_0x4ddd13===_0x2013('0x8d')||_0x4ddd13===_0x2013('0x8e')||_0x4ddd13===_0x2013('0x8f')||_0x4ddd13===_0x2013('0x90')||_0x4ddd13===_0x2013('0x91'))){_0x46e5a0['push'](new Extension(_0x5bc7c7,_0x4e1cca,_0x2013('0x92')+_0x4ddd13+')='+_0x5bc7c7[_0x4ddd13],_0x2013('0x8b')));_0x4e1cca+=0x1;}}_0x46e5a0[_0x2013('0x89')](new Extension(_0x5bc7c7,_0x4e1cca,'6',_0x2013('0x93')));_0x4e1cca+=0x1;_0x46e5a0['push'](new Extension(_0x5bc7c7,_0x4e1cca,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0x2013('0x94')));_0x4e1cca=0x0;return _0x46e5a0;}exports['addAccountApplications']=function(_0x4da8cd,_0x1f8ab0,_0x151e5d){var _0x3f8f01;return db['sequelize'][_0x2013('0x79')](function(_0x5549dc){return db[_0x2013('0x3a')]['create'](_0x4da8cd[_0x2013('0x57')],{'transaction':_0x5549dc})['then'](function(_0x4f10e2){_0x3f8f01=_0x4f10e2[_0x2013('0x32')]({'plain':!![]});return db[_0x2013('0x95')][_0x2013('0x7d')](createExtensionsReciveFax(_0x3f8f01),{'transaction':_0x5549dc});});})[_0x2013('0x1d')](function(){return _0x3f8f01;})[_0x2013('0x1d')](respondWithResult(_0x1f8ab0,null))[_0x2013('0x25')](handleError(_0x1f8ab0,null));};exports[_0x2013('0x96')]=function(_0x225209,_0x10fb84,_0x34da4b){var _0x26404e;return db['sequelize'][_0x2013('0x79')](function(_0x4aac04){return db[_0x2013('0x3a')][_0x2013('0x97')](_0x225209[_0x2013('0x57')],{'where':{'id':_0x225209[_0x2013('0x57')]['id']},'transaction':_0x4aac04})[_0x2013('0x1d')](function(_0x5e0218){return db[_0x2013('0x95')][_0x2013('0x31')]({'where':{'FaxAccountId':_0x225209[_0x2013('0x57')]['id']},'transaction':_0x4aac04})['then'](function(_0x4e19c9){return db[_0x2013('0x95')]['bulkCreate'](createExtensionsReciveFax(_[_0x2013('0x98')](_0x225209['body'],['tech',_0x2013('0x3e'),'createdAt',_0x2013('0x99'),_0x2013('0x9a'),'ListId'])),{'transaction':_0x4aac04});});});})[_0x2013('0x1d')](function(){return db[_0x2013('0x3a')][_0x2013('0x9b')](_0x225209[_0x2013('0x57')]['id']);})[_0x2013('0x1d')](respondWithResult(_0x10fb84,null))[_0x2013('0x25')](handleError(_0x10fb84,null));};exports['getMessages']=function(_0x34b3ec,_0x1495b2,_0x5490d6){var _0x4eeeb5={'raw':!![],'where':{}};var _0x3b0c0c={};var _0x48e375={'count':0x0,'rows':[]};return db[_0x2013('0x3a')][_0x2013('0x63')]({'where':{'id':_0x34b3ec[_0x2013('0x51')]['id']}})['then'](handleEntityNotFound(_0x1495b2,null))[_0x2013('0x1d')](function(_0x5e2dff){if(_0x5e2dff){_0x3b0c0c['model']=_[_0x2013('0x41')](db[_0x2013('0x9c')][_0x2013('0x3b')]);_0x3b0c0c[_0x2013('0x40')]=_[_0x2013('0x41')](_0x34b3ec[_0x2013('0x40')]);_0x3b0c0c[_0x2013('0x42')]=_[_0x2013('0x43')](_0x3b0c0c[_0x2013('0x3f')],_0x3b0c0c[_0x2013('0x40')]);_0x4eeeb5[_0x2013('0x44')]=_[_0x2013('0x43')](_0x3b0c0c[_0x2013('0x3f')],qs['fields'](_0x34b3ec['query'][_0x2013('0x45')]));_0x4eeeb5[_0x2013('0x44')]=_0x4eeeb5['attributes'][_0x2013('0x83')]?_0x4eeeb5[_0x2013('0x44')]:_0x3b0c0c[_0x2013('0x3f')];if(!_0x34b3ec['query'][_0x2013('0x65')](_0x2013('0x46'))){_0x4eeeb5['limit']=qs[_0x2013('0x2c')](_0x34b3ec[_0x2013('0x40')][_0x2013('0x2c')]);_0x4eeeb5['offset']=qs[_0x2013('0x2b')](_0x34b3ec[_0x2013('0x40')][_0x2013('0x2b')]);}_0x4eeeb5[_0x2013('0x66')]=qs[_0x2013('0x47')](_0x34b3ec[_0x2013('0x40')][_0x2013('0x47')]);_0x4eeeb5[_0x2013('0x4a')]=qs[_0x2013('0x42')](_[_0x2013('0x48')](_0x34b3ec[_0x2013('0x40')],_0x3b0c0c[_0x2013('0x42')]));_0x4eeeb5[_0x2013('0x4a')][_0x2013('0x61')]=_0x5e2dff['id'];if(_0x34b3ec[_0x2013('0x40')][_0x2013('0x49')]){_0x4eeeb5[_0x2013('0x4a')]=_['merge'](_0x4eeeb5[_0x2013('0x4a')],{'$or':_['map'](_0x4eeeb5[_0x2013('0x44')],function(_0x583bfa){var _0x34794c={};_0x34794c[_0x583bfa]={'$like':'%'+_0x34b3ec[_0x2013('0x40')]['filter']+'%'};return _0x34794c;})});}if(_0x34b3ec[_0x2013('0x40')][_0x2013('0x9d')]){var _0x202992=_0x34b3ec[_0x2013('0x40')][_0x2013('0x9d')][_0x2013('0x9e')](',');var _0x299af7={};_0x299af7[_0x202992[0x0]]={'$gte':moment(_0x202992[0x1])[_0x2013('0x9f')](_0x2013('0xa0'))};_0x4eeeb5[_0x2013('0x4a')]=_[_0x2013('0x54')](_0x4eeeb5[_0x2013('0x4a')],_0x299af7);}_0x4eeeb5=_[_0x2013('0x54')]({},_0x4eeeb5,_0x34b3ec[_0x2013('0x4c')]);return db[_0x2013('0x9c')]['count']({'where':_0x4eeeb5[_0x2013('0x4a')]})['then'](function(_0x36f3c6){_0x48e375[_0x2013('0x2a')]=_0x36f3c6;if(_0x34b3ec[_0x2013('0x40')][_0x2013('0x53')]){_0x4eeeb5['include']=[{'all':!![]}];}return db[_0x2013('0x9c')][_0x2013('0x4e')](_0x4eeeb5);})['then'](function(_0x53918e){_0x48e375[_0x2013('0x4f')]=_0x53918e;return _0x48e375;});}})[_0x2013('0x1d')](respondWithFilteredResult(_0x1495b2,_0x4eeeb5))[_0x2013('0x25')](handleError(_0x1495b2,null));};exports[_0x2013('0x36')]=function(_0x2708c0,_0x1c567d,_0x5d256d){var _0x1174e9,_0x1c7ba1={},_0x337428;if(_0x2708c0[_0x2013('0x57')]['to']){_0x337428=_0x2708c0[_0x2013('0x57')]['to'][0x0];}return db[_0x2013('0x3a')][_0x2013('0x55')]({'where':{'id':_0x2708c0[_0x2013('0x51')]['id']},'include':[{'model':db[_0x2013('0xa1')],'as':_0x2013('0xa2'),'include':[{'model':db[_0x2013('0x70')],'as':_0x2013('0xa3'),'where':{'fax':_0x337428},'limit':0x1,'order':[[_0x2013('0x99'),'DESC']]}]}]})[_0x2013('0x1d')](handleEntityNotFound(_0x1c567d,null))[_0x2013('0x1d')](function(_0x3241f0){_0x1174e9=_0x3241f0;if(_0x2708c0[_0x2013('0x57')][_0x2013('0xa4')]&&_0x2708c0['body'][_0x2013('0xa4')][_0x2013('0x83')]){for(var _0x41076b=0x0;_0x41076b<_0x2708c0[_0x2013('0x57')]['attachments']['length'];_0x41076b+=0x1){_0x2708c0[_0x2013('0x57')][_0x2013('0xa4')][_0x41076b]={'filename':_0x2708c0[_0x2013('0x57')][_0x2013('0xa4')][_0x41076b][_0x2013('0x35')],'id':_0x2708c0[_0x2013('0x57')][_0x2013('0xa4')][_0x41076b]['id'],'path':path[_0x2013('0xa5')](config['root'],_0x2013('0xa6'),_0x2708c0['body']['attachments'][_0x41076b][_0x2013('0xa7')])};}}return respondWithRpcPromise(_0x2013('0xa8'),_0x2013('0xa8'),{'FaxAccountId':_[_0x2013('0xa9')](_0x2708c0[_0x2013('0x51')]['id'])?undefined:_0x2708c0[_0x2013('0x51')]['id'],'path':_[_0x2013('0xa9')](_0x2708c0[_0x2013('0x57')]['attachments'][0x0][_0x2013('0x4')])?undefined:_0x2708c0[_0x2013('0x57')][_0x2013('0xa4')][0x0][_0x2013('0x4')],'fax':_[_0x2013('0xa9')](_0x2708c0[_0x2013('0x57')]['to'][0x0])?undefined:_0x2708c0[_0x2013('0x57')]['to'][0x0]},client9002);})['then'](function(){if(_0x1174e9){if(_[_0x2013('0xa9')](_0x2708c0[_0x2013('0x57')]['from'])){_0x2708c0['body']['from']=util[_0x2013('0x9f')](_0x2013('0xaa'),_0x1174e9[_0x2013('0x35')],_0x1174e9['fax']);}if(_0x1174e9[_0x2013('0xa2')]){if(_0x1174e9[_0x2013('0xa2')][_0x2013('0xa3')][_0x2013('0x83')]){return _0x1174e9[_0x2013('0xa2')]['Contacts'][0x0];}else{return db['CmContact'][_0x2013('0x56')](_['defaults'](_0x2708c0[_0x2013('0x57')],{'firstName':_0x2708c0[_0x2013('0x57')]['to'][0x0],'phone':_0x2708c0[_0x2013('0x57')]['to'][0x0],'fax':_0x2708c0[_0x2013('0x57')]['to'][0x0],'ListId':_0x1174e9[_0x2013('0xab')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x2013('0xac'));}})['then'](function(_0x196584){if(_0x196584){return db[_0x2013('0x6f')][_0x2013('0x55')]({'where':{'ContactId':_0x196584['id'],'closed':![],'FaxAccountId':_0x1174e9['id']}})[_0x2013('0x1d')](function(_0x5373aa){if(_0x5373aa){return[_0x5373aa,![]];}return db[_0x2013('0x6f')][_0x2013('0x56')]({'UserId':_0x2708c0['user']['id'],'ContactId':_0x196584['id'],'FaxAccountId':_0x1174e9['id'],'fax':_0x2708c0['body']['to'][0x0],'firstMsgDirection':_0x2013('0xad'),'Messages':[_[_0x2013('0x54')](_0x2708c0[_0x2013('0x57')],{'read':![],'body':_0x2708c0['body'][_0x2013('0xa4')][0x0][_0x2013('0xae')],'FaxAccountId':_0x1174e9['id'],'UserId':_0x2708c0[_0x2013('0x58')]['id'],'ContactId':_0x196584['id'],'AttachmentId':_0x2708c0[_0x2013('0x57')][_0x2013('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0x2013('0x9c')],'as':_0x2013('0xaf')}]})[_0x2013('0x1d')](function(_0x5476bf){return[_0x5476bf,!![]];});});}else{throw new Error(_0x2013('0xb0'));}})['spread'](function(_0x23da2b,_0x42651d){if(_0x42651d){return _0x23da2b;}return db[_0x2013('0x9c')][_0x2013('0x56')]({'direction':_0x2013('0xad'),'read':![],'body':_0x2708c0[_0x2013('0x57')]['attachments'][0x0][_0x2013('0xae')],'FaxAccountId':_0x1174e9['id'],'FaxInteractionId':_0x23da2b['id'],'UserId':_0x2708c0[_0x2013('0x58')]['id'],'ContactId':_0x23da2b[_0x2013('0xb1')],'AttachmentId':_0x2708c0['body'][_0x2013('0xa4')][0x0]['id']})[_0x2013('0x1d')](function(_0x56be80){_0x23da2b[_0x2013('0xb2')][_0x2013('0xaf')]=[];_0x23da2b['dataValues']['Messages'][_0x2013('0x89')](_0x56be80[_0x2013('0xb2')]);return _0x23da2b;});})[_0x2013('0x1d')](function(_0x17941e){respondWithRpcPromise(_0x2013('0xb3'),_0x2013('0xb3'),{'FaxAccountId':_['isNil'](_0x2708c0[_0x2013('0x51')]['id'])?undefined:_0x2708c0['params']['id'],'path':_['isNil'](_0x2708c0[_0x2013('0x57')]['attachments'][0x0][_0x2013('0x4')])?undefined:_0x2708c0[_0x2013('0x57')]['attachments'][0x0][_0x2013('0x4')],'fax':_[_0x2013('0xa9')](_0x2708c0['body']['to'][0x0])?undefined:_0x2708c0[_0x2013('0x57')]['to'][0x0],'AttachmentId':_0x2708c0[_0x2013('0x57')]['attachments'][0x0]['id']},client9002)[_0x2013('0x1d')](function(_0x230d10){logger[_0x2013('0x24')]('SendFaxRpc,\x20%s',_0x230d10);})[_0x2013('0x25')](function(_0x5ef89b){logger[_0x2013('0x24')](_0x2013('0xb4'),_0x5ef89b);});return _0x17941e;})['then'](respondWithResult(_0x1c567d,null))[_0x2013('0x25')](handleError(_0x1c567d,null));};exports[_0x2013('0xb5')]=function(_0x38f24d,_0x3b4c43,_0x4fcc81){return db[_0x2013('0x3a')][_0x2013('0x55')]({'where':{'id':_0x38f24d[_0x2013('0x51')]['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0x3b4c43,null))[_0x2013('0x1d')](function(_0x12b1e8){if(_0x12b1e8){return _0x12b1e8['addAgents'](_0x38f24d[_0x2013('0x57')][_0x2013('0x68')],_[_0x2013('0x98')](_0x38f24d['body'],['ids','id'])||{})[_0x2013('0xb6')](function(_0x584c2c){for(var _0x26a321=0x0;_0x26a321<_0x38f24d[_0x2013('0x57')][_0x2013('0x68')]['length'];_0x26a321+=0x1){socket[_0x2013('0xb7')](_0x2013('0xb8'),{'UserId':Number(_0x38f24d[_0x2013('0x57')][_0x2013('0x68')][_0x26a321]),'FaxAccountId':Number(_0x38f24d[_0x2013('0x51')]['id'])});}return _0x584c2c;});}})[_0x2013('0x1d')](respondWithResult(_0x3b4c43,null))[_0x2013('0x25')](handleError(_0x3b4c43,null));};exports[_0x2013('0xb9')]=function(_0x2e5f3b,_0x1bc683,_0x38d243){return db['FaxAccount'][_0x2013('0x55')]({'where':{'id':_0x2e5f3b['params']['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0x1bc683,null))['then'](function(_0x4d22f8){if(_0x4d22f8){return _0x4d22f8[_0x2013('0xb9')](_0x2e5f3b['query'][_0x2013('0x68')])['then'](function(){if(_[_0x2013('0xba')](_0x2e5f3b[_0x2013('0x40')][_0x2013('0x68')])){for(var _0x1702a2=0x0;_0x1702a2<_0x2e5f3b[_0x2013('0x40')][_0x2013('0x68')][_0x2013('0x83')];_0x1702a2+=0x1){socket['emit'](_0x2013('0xbb'),{'UserId':Number(_0x2e5f3b[_0x2013('0x40')]['ids'][_0x1702a2]),'FaxAccountId':Number(_0x2e5f3b[_0x2013('0x51')]['id'])});}}else{socket[_0x2013('0xb7')](_0x2013('0xbb'),{'UserId':Number(_0x2e5f3b[_0x2013('0x40')][_0x2013('0x68')]),'FaxAccountId':Number(_0x2e5f3b[_0x2013('0x51')]['id'])});}});}})[_0x2013('0x1d')](respondWithStatusCode(_0x1bc683,null))[_0x2013('0x25')](handleError(_0x1bc683,null));};exports[_0x2013('0xbc')]=function(_0xf3687,_0x28761a,_0x154c94){var _0x164469={};var _0x4c73a0={};var _0x48a0e8;var _0x29d501;return db[_0x2013('0x3a')][_0x2013('0x63')]({'where':{'id':_0xf3687[_0x2013('0x51')]['id']}})[_0x2013('0x1d')](handleEntityNotFound(_0x28761a,null))[_0x2013('0x1d')](function(_0x1b6c7a){if(_0x1b6c7a){_0x48a0e8=_0x1b6c7a;_0x4c73a0['model']=_[_0x2013('0x41')](db[_0x2013('0x71')][_0x2013('0x3b')]);_0x4c73a0[_0x2013('0x40')]=_[_0x2013('0x41')](_0xf3687[_0x2013('0x40')]);_0x4c73a0[_0x2013('0x42')]=_[_0x2013('0x43')](_0x4c73a0['model'],_0x4c73a0[_0x2013('0x40')]);_0x164469[_0x2013('0x44')]=_[_0x2013('0x43')](_0x4c73a0[_0x2013('0x3f')],qs['fields'](_0xf3687[_0x2013('0x40')][_0x2013('0x45')]));_0x164469[_0x2013('0x44')]=_0x164469[_0x2013('0x44')][_0x2013('0x83')]?_0x164469[_0x2013('0x44')]:_0x4c73a0['model'];_0x164469[_0x2013('0x66')]=qs[_0x2013('0x47')](_0xf3687[_0x2013('0x40')]['sort']);_0x164469[_0x2013('0x4a')]=qs[_0x2013('0x42')](_[_0x2013('0x48')](_0xf3687[_0x2013('0x40')],_0x4c73a0[_0x2013('0x42')]));if(_0xf3687[_0x2013('0x40')][_0x2013('0x49')]){_0x164469[_0x2013('0x4a')]=_[_0x2013('0x54')](_0x164469['where'],{'$or':_[_0x2013('0x39')](_0x164469[_0x2013('0x44')],function(_0x4e7f29){var _0x5f27db={};_0x5f27db[_0x4e7f29]={'$like':'%'+_0xf3687[_0x2013('0x40')]['filter']+'%'};return _0x5f27db;})});}_0x164469=_[_0x2013('0x54')]({},_0x164469,_0xf3687[_0x2013('0x4c')]);return _0x48a0e8[_0x2013('0xbc')](_0x164469);}})['then'](function(_0x4bd125){if(_0x4bd125){_0x29d501=_0x4bd125['length'];if(!_0xf3687[_0x2013('0x40')]['hasOwnProperty'](_0x2013('0x46'))){_0x164469[_0x2013('0x2c')]=qs[_0x2013('0x2c')](_0xf3687['query']['limit']);_0x164469['offset']=qs[_0x2013('0x2b')](_0xf3687['query']['offset']);}return _0x48a0e8[_0x2013('0xbc')](_0x164469);}})[_0x2013('0x1d')](function(_0x416c23){if(_0x416c23){return _0x416c23?{'count':_0x29d501,'rows':_0x416c23}:null;}})[_0x2013('0x1d')](respondWithResult(_0x28761a,null))[_0x2013('0x25')](handleError(_0x28761a,null));}; \ No newline at end of file +var _0x6fd9=['get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','fields','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','hasOwnProperty','order','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','FaxMessage','$gte','split','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','undefined','set','apply','reject','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6fd9,0x159));var _0x96fd=function(_0x59fa86,_0x1f4ef8){_0x59fa86=_0x59fa86-0x0;var _0x39ffe9=_0x6fd9[_0x59fa86];return _0x39ffe9;};'use strict';var emlformat=require(_0x96fd('0x0'));var rimraf=require(_0x96fd('0x1'));var zipdir=require(_0x96fd('0x2'));var jsonpatch=require(_0x96fd('0x3'));var rp=require(_0x96fd('0x4'));var moment=require(_0x96fd('0x5'));var BPromise=require(_0x96fd('0x6'));var Mustache=require(_0x96fd('0x7'));var util=require(_0x96fd('0x8'));var path=require(_0x96fd('0x9'));var sox=require(_0x96fd('0xa'));var csv=require(_0x96fd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96fd('0xc'));var _=require(_0x96fd('0xd'));var squel=require(_0x96fd('0xe'));var crypto=require(_0x96fd('0xf'));var jsforce=require(_0x96fd('0x10'));var deskjs=require(_0x96fd('0x11'));var toCsv=require(_0x96fd('0xb'));var querystring=require(_0x96fd('0x12'));var Papa=require(_0x96fd('0x13'));var Redis=require(_0x96fd('0x14'));var authService=require(_0x96fd('0x15'));var qs=require(_0x96fd('0x16'));var as=require(_0x96fd('0x17'));var hardwareService=require(_0x96fd('0x18'));var logger=require(_0x96fd('0x19'))('api');var utils=require(_0x96fd('0x1a'));var config=require(_0x96fd('0x1b'));var licenseUtil=require(_0x96fd('0x1c'));var db=require(_0x96fd('0x1d'))['db'];config[_0x96fd('0x1e')]=_['defaults'](config[_0x96fd('0x1e')],{'host':_0x96fd('0x1f'),'port':0x18eb});var socket=require(_0x96fd('0x20'))(new Redis(config['redis']));require(_0x96fd('0x21'))['register'](socket);var jayson=require(_0x96fd('0x22'));var client=jayson[_0x96fd('0x23')][_0x96fd('0x24')]({'port':0x232c});var client9002=jayson[_0x96fd('0x23')][_0x96fd('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x379952,_0x212ca7,_0x4dc0bd,_0x5007d6){return new BPromise(function(_0x298fb1,_0x149088){var _0x2e7f26=_0x5007d6||client;return _0x2e7f26[_0x96fd('0x25')](_0x379952,_0x4dc0bd)[_0x96fd('0x26')](function(_0x579b1f){logger[_0x96fd('0x27')](_0x96fd('0x28'),_0x212ca7,_0x96fd('0x29'));logger['debug'](_0x96fd('0x2a'),_0x212ca7,_0x96fd('0x29'),JSON[_0x96fd('0x2b')](_0x579b1f));if(_0x579b1f[_0x96fd('0x2c')]){if(_0x579b1f['error'][_0x96fd('0x2d')]===0x1f4){logger[_0x96fd('0x2c')](_0x96fd('0x28'),_0x212ca7,_0x579b1f[_0x96fd('0x2c')][_0x96fd('0x2e')]);return _0x149088(_0x579b1f[_0x96fd('0x2c')][_0x96fd('0x2e')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x212ca7,_0x579b1f[_0x96fd('0x2c')][_0x96fd('0x2e')]);return _0x298fb1(_0x579b1f[_0x96fd('0x2c')][_0x96fd('0x2e')]);}else{logger[_0x96fd('0x27')](_0x96fd('0x28'),_0x212ca7,_0x96fd('0x29'));_0x298fb1(_0x579b1f['result'][_0x96fd('0x2e')]);}})['catch'](function(_0x4dfd65){logger[_0x96fd('0x2c')](_0x96fd('0x28'),_0x212ca7,_0x4dfd65);_0x149088(_0x4dfd65);});});}function respondWithStatusCode(_0x25828a,_0x2270d0){_0x2270d0=_0x2270d0||0xcc;return function(_0x5ab629){if(_0x5ab629){return _0x25828a[_0x96fd('0x2f')](_0x2270d0);}return _0x25828a['status'](_0x2270d0)['end']();};}function respondWithResult(_0x3da724,_0x4a3d6a){_0x4a3d6a=_0x4a3d6a||0xc8;return function(_0x321aa9){if(_0x321aa9){return _0x3da724[_0x96fd('0x30')](_0x4a3d6a)[_0x96fd('0x31')](_0x321aa9);}};}function respondWithFilteredResult(_0x400e4b,_0x555982){return function(_0x19386b){if(_0x19386b){var _0x5703b7=typeof _0x555982[_0x96fd('0x32')]==='undefined'&&typeof _0x555982[_0x96fd('0x33')]===_0x96fd('0x34');var _0x17c6ab=_0x19386b['count'];var _0x570c47=_0x5703b7?0x0:_0x555982[_0x96fd('0x32')];var _0x38e925=_0x5703b7?_0x19386b['count']:_0x555982['offset']+_0x555982[_0x96fd('0x33')];var _0x3dfba9;if(_0x38e925>=_0x17c6ab){_0x38e925=_0x17c6ab;_0x3dfba9=0xc8;}else{_0x3dfba9=0xce;}_0x400e4b[_0x96fd('0x30')](_0x3dfba9);return _0x400e4b[_0x96fd('0x35')]('Content-Range',_0x570c47+'-'+_0x38e925+'/'+_0x17c6ab)[_0x96fd('0x31')](_0x19386b);}return null;};}function patchUpdates(_0x1db0a2){return function(_0x102461){try{jsonpatch[_0x96fd('0x36')](_0x102461,_0x1db0a2,!![]);}catch(_0x59b88e){return BPromise[_0x96fd('0x37')](_0x59b88e);}return _0x102461['save']();};}function saveUpdates(_0x36abe3,_0x80e2af){return function(_0xa65741){if(_0xa65741){return _0xa65741['update'](_0x36abe3)[_0x96fd('0x26')](function(_0x167a44){return _0x167a44;});}return null;};}function removeEntity(_0x22f285,_0x230c08){return function(_0x32db69){if(_0x32db69){return _0x32db69[_0x96fd('0x38')]()['then'](function(){var _0x4dc4fc=_0x32db69[_0x96fd('0x39')]({'plain':!![]});var _0x4eaaed=_0x96fd('0x3a');return db[_0x96fd('0x3b')][_0x96fd('0x38')]({'where':{'type':_0x4eaaed,'resourceId':_0x4dc4fc['id']}})['then'](function(){return _0x32db69;});})['then'](function(){_0x22f285['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4788cf,_0x1af019){return function(_0x1c36e9){if(!_0x1c36e9){_0x4788cf[_0x96fd('0x2f')](0x194);}return _0x1c36e9;};}function handleError(_0x54a3c9,_0x557d04){_0x557d04=_0x557d04||0x1f4;return function(_0x452b6d){logger[_0x96fd('0x2c')](_0x452b6d[_0x96fd('0x3c')]);if(_0x452b6d[_0x96fd('0x3d')]){delete _0x452b6d[_0x96fd('0x3d')];}_0x54a3c9[_0x96fd('0x30')](_0x557d04)[_0x96fd('0x3e')](_0x452b6d);};}exports['index']=function(_0x40b51a,_0x3290ad){var _0x4b634d={'include':[{'model':db[_0x96fd('0x3f')],'as':_0x96fd('0x40')}]},_0x2a24fc={},_0x11644e={'count':0x0,'rows':[]};var _0x2aca2f=_['map'](db[_0x96fd('0x41')][_0x96fd('0x42')],function(_0x45eb82){return{'name':_0x45eb82[_0x96fd('0x43')],'type':_0x45eb82[_0x96fd('0x44')][_0x96fd('0x45')]};});_0x2a24fc['model']=_[_0x96fd('0x46')](_0x2aca2f,_0x96fd('0x3d'));_0x2a24fc[_0x96fd('0x47')]=_[_0x96fd('0x48')](_0x40b51a['query']);_0x2a24fc['filters']=_[_0x96fd('0x49')](_0x2a24fc['model'],_0x2a24fc[_0x96fd('0x47')]);_0x4b634d[_0x96fd('0x4a')]=_['intersection'](_0x2a24fc[_0x96fd('0x4b')],qs['fields'](_0x40b51a[_0x96fd('0x47')][_0x96fd('0x4c')]));_0x4b634d['attributes']=_0x4b634d[_0x96fd('0x4a')][_0x96fd('0x4d')]?_0x4b634d[_0x96fd('0x4a')]:_0x2a24fc[_0x96fd('0x4b')];if(!_0x40b51a[_0x96fd('0x47')]['hasOwnProperty'](_0x96fd('0x4e'))){_0x4b634d[_0x96fd('0x33')]=qs[_0x96fd('0x33')](_0x40b51a[_0x96fd('0x47')][_0x96fd('0x33')]);_0x4b634d[_0x96fd('0x32')]=qs['offset'](_0x40b51a[_0x96fd('0x47')]['offset']);}_0x4b634d['order']=qs[_0x96fd('0x4f')](_0x40b51a[_0x96fd('0x47')][_0x96fd('0x4f')]);_0x4b634d[_0x96fd('0x50')]=qs[_0x96fd('0x51')](_[_0x96fd('0x52')](_0x40b51a[_0x96fd('0x47')],_0x2a24fc[_0x96fd('0x51')]),_0x2aca2f);if(_0x40b51a[_0x96fd('0x47')]['filter']){_0x4b634d[_0x96fd('0x50')]=_[_0x96fd('0x53')](_0x4b634d[_0x96fd('0x50')],{'$or':_[_0x96fd('0x46')](_0x2aca2f,function(_0xd4d39b){if(_0xd4d39b[_0x96fd('0x44')]!==_0x96fd('0x54')){var _0x5a732b={};_0x5a732b[_0xd4d39b['name']]={'$like':'%'+_0x40b51a[_0x96fd('0x47')][_0x96fd('0x55')]+'%'};return _0x5a732b;}})});}_0x4b634d=_[_0x96fd('0x53')]({},_0x4b634d,_0x40b51a[_0x96fd('0x56')]);var _0x47f5d={'where':_0x4b634d[_0x96fd('0x50')]};return db[_0x96fd('0x41')]['count'](_0x47f5d)[_0x96fd('0x26')](function(_0x2dbc4c){_0x11644e[_0x96fd('0x57')]=_0x2dbc4c;if(_0x40b51a[_0x96fd('0x47')][_0x96fd('0x58')]){_0x4b634d['include']=[{'all':!![]}];}return db[_0x96fd('0x41')][_0x96fd('0x59')](_0x4b634d);})[_0x96fd('0x26')](function(_0x1ca19e){_0x11644e[_0x96fd('0x5a')]=_0x1ca19e;return _0x11644e;})[_0x96fd('0x26')](respondWithFilteredResult(_0x3290ad,_0x4b634d))[_0x96fd('0x5b')](handleError(_0x3290ad,null));};exports[_0x96fd('0x5c')]=function(_0x3e7059,_0x426e9c){var _0x15b628={'raw':![],'where':{'id':_0x3e7059[_0x96fd('0x5d')]['id']},'include':[{'model':db[_0x96fd('0x3f')],'as':_0x96fd('0x40')}]},_0xdad0c0={};_0xdad0c0[_0x96fd('0x4b')]=_[_0x96fd('0x48')](db['FaxAccount'][_0x96fd('0x42')]);_0xdad0c0[_0x96fd('0x47')]=_['keys'](_0x3e7059[_0x96fd('0x47')]);_0xdad0c0[_0x96fd('0x51')]=_[_0x96fd('0x49')](_0xdad0c0[_0x96fd('0x4b')],_0xdad0c0[_0x96fd('0x47')]);_0x15b628[_0x96fd('0x4a')]=_[_0x96fd('0x49')](_0xdad0c0[_0x96fd('0x4b')],qs[_0x96fd('0x4c')](_0x3e7059[_0x96fd('0x47')][_0x96fd('0x4c')]));_0x15b628['attributes']=_0x15b628['attributes'][_0x96fd('0x4d')]?_0x15b628[_0x96fd('0x4a')]:_0xdad0c0['model'];if(_0x3e7059['query']['includeAll']){_0x15b628[_0x96fd('0x5e')]=[{'all':!![]}];}_0x15b628=_[_0x96fd('0x53')]({},_0x15b628,_0x3e7059[_0x96fd('0x56')]);return db[_0x96fd('0x41')][_0x96fd('0x5f')](_0x15b628)[_0x96fd('0x26')](handleEntityNotFound(_0x426e9c,null))[_0x96fd('0x26')](respondWithResult(_0x426e9c,null))['catch'](handleError(_0x426e9c,null));};exports[_0x96fd('0x60')]=function(_0x2fa03c,_0x3f37f1){return db[_0x96fd('0x41')][_0x96fd('0x60')](_0x2fa03c[_0x96fd('0x61')],{})[_0x96fd('0x26')](function(_0x448803){var _0x54effb=_0x2fa03c[_0x96fd('0x62')][_0x96fd('0x39')]({'plain':!![]});if(!_0x54effb)throw new Error(_0x96fd('0x63'));if(_0x54effb[_0x96fd('0x64')]===_0x96fd('0x62')){var _0x4a9f26=_0x448803[_0x96fd('0x39')]({'plain':!![]});var _0x339f22=_0x96fd('0x3a');return db['UserProfileSection'][_0x96fd('0x5f')]({'where':{'name':_0x339f22,'userProfileId':_0x54effb[_0x96fd('0x65')]},'raw':!![]})[_0x96fd('0x26')](function(_0x3aa416){if(_0x3aa416&&_0x3aa416[_0x96fd('0x66')]===0x0){return db[_0x96fd('0x3b')][_0x96fd('0x60')]({'name':_0x4a9f26[_0x96fd('0x3d')],'resourceId':_0x4a9f26['id'],'type':_0x3aa416[_0x96fd('0x3d')],'sectionId':_0x3aa416['id']},{})['then'](function(){return _0x448803;});}else{return _0x448803;}})['catch'](function(_0x18eaa3){logger['error'](_0x96fd('0x67'),_0x18eaa3);throw _0x18eaa3;});}return _0x448803;})[_0x96fd('0x26')](respondWithResult(_0x3f37f1,0xc9))['catch'](handleError(_0x3f37f1,null));};exports['update']=function(_0x185491,_0x3e0a84){if(_0x185491[_0x96fd('0x61')]['id']){delete _0x185491[_0x96fd('0x61')]['id'];}return db[_0x96fd('0x41')]['find']({'where':{'id':_0x185491[_0x96fd('0x5d')]['id']},'include':[{'model':db[_0x96fd('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x96fd('0x26')](handleEntityNotFound(_0x3e0a84,null))[_0x96fd('0x26')](saveUpdates(_0x185491[_0x96fd('0x61')],null))[_0x96fd('0x26')](respondWithResult(_0x3e0a84,null))['catch'](handleError(_0x3e0a84,null));};exports[_0x96fd('0x38')]=function(_0x360e6c,_0x5446df){return db[_0x96fd('0x41')][_0x96fd('0x5f')]({'where':{'id':_0x360e6c[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x5446df,null))['then'](removeEntity(_0x5446df,null))[_0x96fd('0x5b')](handleError(_0x5446df,null));};exports[_0x96fd('0x68')]=function(_0xa5797f,_0x54314e){return db[_0x96fd('0x41')]['describe']()[_0x96fd('0x26')](respondWithResult(_0x54314e,null))['catch'](handleError(_0x54314e,null));};exports[_0x96fd('0x69')]=function(_0x310534,_0x416926,_0x483452){if(_0x310534[_0x96fd('0x61')]['id']){delete _0x310534[_0x96fd('0x61')]['id'];}return db[_0x96fd('0x41')][_0x96fd('0x5f')]({'where':{'id':_0x310534[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x416926,null))[_0x96fd('0x26')](function(_0x5140f6){if(_0x5140f6){_0x310534[_0x96fd('0x61')][_0x96fd('0x6a')]=_0x5140f6['id'];return db[_0x96fd('0x6b')]['create'](_0x310534[_0x96fd('0x61')]);}})['then'](respondWithResult(_0x416926,null))[_0x96fd('0x5b')](handleError(_0x416926,null));};exports['getDispositions']=function(_0x5081c6,_0x15f3b9,_0xa49bbf){var _0x29264a={'raw':![],'where':{}};var _0x47cc24={};var _0x55786a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x5081c6[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x15f3b9,null))[_0x96fd('0x26')](function(_0x39a8c6){if(_0x39a8c6){_0x47cc24[_0x96fd('0x4b')]=_['keys'](db[_0x96fd('0x6b')][_0x96fd('0x42')]);_0x47cc24[_0x96fd('0x47')]=_[_0x96fd('0x48')](_0x5081c6[_0x96fd('0x47')]);_0x47cc24[_0x96fd('0x51')]=_[_0x96fd('0x49')](_0x47cc24['model'],_0x47cc24['query']);_0x29264a[_0x96fd('0x4a')]=_['intersection'](_0x47cc24[_0x96fd('0x4b')],qs['fields'](_0x5081c6[_0x96fd('0x47')][_0x96fd('0x4c')]));_0x29264a[_0x96fd('0x4a')]=_0x29264a['attributes'][_0x96fd('0x4d')]?_0x29264a[_0x96fd('0x4a')]:_0x47cc24[_0x96fd('0x4b')];if(!_0x5081c6[_0x96fd('0x47')][_0x96fd('0x6c')](_0x96fd('0x4e'))){_0x29264a[_0x96fd('0x33')]=qs['limit'](_0x5081c6[_0x96fd('0x47')][_0x96fd('0x33')]);_0x29264a['offset']=qs[_0x96fd('0x32')](_0x5081c6[_0x96fd('0x47')][_0x96fd('0x32')]);}_0x29264a[_0x96fd('0x6d')]=qs[_0x96fd('0x4f')](_0x5081c6[_0x96fd('0x47')]['sort']);_0x29264a[_0x96fd('0x50')]=qs[_0x96fd('0x51')](_[_0x96fd('0x52')](_0x5081c6[_0x96fd('0x47')],_0x47cc24[_0x96fd('0x51')]));_0x29264a[_0x96fd('0x50')][_0x96fd('0x6a')]=_0x39a8c6['id'];if(_0x5081c6[_0x96fd('0x47')][_0x96fd('0x55')]){_0x29264a[_0x96fd('0x50')]=_[_0x96fd('0x53')](_0x29264a[_0x96fd('0x50')],{'$or':_[_0x96fd('0x46')](_0x29264a[_0x96fd('0x4a')],function(_0x48baee){var _0x28a5c0={};_0x28a5c0[_0x48baee]={'$like':'%'+_0x5081c6[_0x96fd('0x47')][_0x96fd('0x55')]+'%'};return _0x28a5c0;})});}_0x29264a=_[_0x96fd('0x53')]({},_0x29264a,_0x5081c6[_0x96fd('0x56')]);return db[_0x96fd('0x6b')]['count']({'where':_0x29264a[_0x96fd('0x50')]})[_0x96fd('0x26')](function(_0x352eae){_0x55786a['count']=_0x352eae;if(_0x5081c6[_0x96fd('0x47')][_0x96fd('0x58')]){_0x29264a[_0x96fd('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x96fd('0x59')](_0x29264a);})[_0x96fd('0x26')](function(_0x14d6b6){_0x55786a[_0x96fd('0x5a')]=_0x14d6b6;return _0x55786a;});}})[_0x96fd('0x26')](respondWithFilteredResult(_0x15f3b9,_0x29264a))[_0x96fd('0x5b')](handleError(_0x15f3b9,null));};exports[_0x96fd('0x6e')]=function(_0x487a0b,_0x57401f,_0x214148){return db[_0x96fd('0x41')][_0x96fd('0x5f')]({'where':{'id':_0x487a0b[_0x96fd('0x5d')]['id']}})['then'](handleEntityNotFound(_0x57401f,null))[_0x96fd('0x26')](function(_0x43655e){if(_0x43655e){return _0x43655e['removeDispositions'](_0x487a0b[_0x96fd('0x47')][_0x96fd('0x6f')]);}})[_0x96fd('0x26')](respondWithStatusCode(_0x57401f,null))['catch'](handleError(_0x57401f,null));};exports[_0x96fd('0x70')]=function(_0x3f6544,_0x53ab5e,_0x28e6ab){if(_0x3f6544[_0x96fd('0x61')]['id']){delete _0x3f6544[_0x96fd('0x61')]['id'];}return db['FaxAccount'][_0x96fd('0x5f')]({'where':{'id':_0x3f6544[_0x96fd('0x5d')]['id']}})['then'](handleEntityNotFound(_0x53ab5e,null))[_0x96fd('0x26')](function(_0x561270){if(_0x561270){_0x3f6544[_0x96fd('0x61')][_0x96fd('0x6a')]=_0x561270['id'];return db[_0x96fd('0x71')]['create'](_0x3f6544['body']);}})['then'](respondWithResult(_0x53ab5e,null))[_0x96fd('0x5b')](handleError(_0x53ab5e,null));};exports['getAnswers']=function(_0x4472d5,_0x12053e,_0x25ffe2){var _0x111b65={'raw':![],'where':{}};var _0x3d07eb={};var _0x3d449e={'count':0x0,'rows':[]};return db[_0x96fd('0x41')][_0x96fd('0x72')]({'where':{'id':_0x4472d5['params']['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x12053e,null))[_0x96fd('0x26')](function(_0x37ca87){if(_0x37ca87){_0x3d07eb[_0x96fd('0x4b')]=_[_0x96fd('0x48')](db[_0x96fd('0x71')]['rawAttributes']);_0x3d07eb['query']=_[_0x96fd('0x48')](_0x4472d5[_0x96fd('0x47')]);_0x3d07eb[_0x96fd('0x51')]=_['intersection'](_0x3d07eb[_0x96fd('0x4b')],_0x3d07eb[_0x96fd('0x47')]);_0x111b65[_0x96fd('0x4a')]=_[_0x96fd('0x49')](_0x3d07eb['model'],qs[_0x96fd('0x4c')](_0x4472d5[_0x96fd('0x47')][_0x96fd('0x4c')]));_0x111b65[_0x96fd('0x4a')]=_0x111b65[_0x96fd('0x4a')][_0x96fd('0x4d')]?_0x111b65[_0x96fd('0x4a')]:_0x3d07eb['model'];if(!_0x4472d5[_0x96fd('0x47')][_0x96fd('0x6c')]('nolimit')){_0x111b65[_0x96fd('0x33')]=qs[_0x96fd('0x33')](_0x4472d5['query']['limit']);_0x111b65[_0x96fd('0x32')]=qs[_0x96fd('0x32')](_0x4472d5[_0x96fd('0x47')]['offset']);}_0x111b65[_0x96fd('0x6d')]=qs[_0x96fd('0x4f')](_0x4472d5[_0x96fd('0x47')]['sort']);_0x111b65[_0x96fd('0x50')]=qs['filters'](_[_0x96fd('0x52')](_0x4472d5['query'],_0x3d07eb['filters']));_0x111b65[_0x96fd('0x50')][_0x96fd('0x6a')]=_0x37ca87['id'];if(_0x4472d5['query'][_0x96fd('0x55')]){_0x111b65[_0x96fd('0x50')]=_['merge'](_0x111b65[_0x96fd('0x50')],{'$or':_[_0x96fd('0x46')](_0x111b65[_0x96fd('0x4a')],function(_0x145efd){var _0x2cc4f3={};_0x2cc4f3[_0x145efd]={'$like':'%'+_0x4472d5[_0x96fd('0x47')]['filter']+'%'};return _0x2cc4f3;})});}_0x111b65=_[_0x96fd('0x53')]({},_0x111b65,_0x4472d5['options']);return db[_0x96fd('0x71')][_0x96fd('0x57')]({'where':_0x111b65[_0x96fd('0x50')]})[_0x96fd('0x26')](function(_0x1edd11){_0x3d449e[_0x96fd('0x57')]=_0x1edd11;if(_0x4472d5[_0x96fd('0x47')]['includeAll']){_0x111b65[_0x96fd('0x5e')]=[{'all':!![]}];}return db[_0x96fd('0x71')][_0x96fd('0x59')](_0x111b65);})['then'](function(_0x35aea5){_0x3d449e[_0x96fd('0x5a')]=_0x35aea5;return _0x3d449e;});}})[_0x96fd('0x26')](respondWithFilteredResult(_0x12053e,_0x111b65))[_0x96fd('0x5b')](handleError(_0x12053e,null));};exports['removeAnswers']=function(_0x1f054f,_0x4b0938,_0x168724){return db[_0x96fd('0x41')][_0x96fd('0x5f')]({'where':{'id':_0x1f054f[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x4b0938,null))[_0x96fd('0x26')](function(_0x5343e8){if(_0x5343e8){return _0x5343e8[_0x96fd('0x73')](_0x1f054f[_0x96fd('0x47')][_0x96fd('0x6f')]);}})['then'](respondWithStatusCode(_0x4b0938,null))['catch'](handleError(_0x4b0938,null));};exports[_0x96fd('0x74')]=function(_0x3a413d,_0x5ac8ed,_0x6eafc9){return db[_0x96fd('0x75')][_0x96fd('0x5f')]({'where':{'id':_0x3a413d[_0x96fd('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5ac8ed,null))[_0x96fd('0x26')](function(_0x6a21e4){if(_0x6a21e4){return _0x6a21e4['addInteraction'](_0x3a413d['body']['ids'],_[_0x96fd('0x76')](_0x3a413d['body'],[_0x96fd('0x6f'),'id'])||{});}})[_0x96fd('0x26')](respondWithResult(_0x5ac8ed,null))[_0x96fd('0x5b')](handleError(_0x5ac8ed,null));};exports[_0x96fd('0x77')]=function(_0x229680,_0x228aee,_0xa2a91a){var _0xcd653b={'raw':![],'where':{}};var _0x30f965={};var _0x2ea8b5={'count':0x0,'rows':[]};return db[_0x96fd('0x41')][_0x96fd('0x72')]({'where':{'id':_0x229680[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x228aee,null))[_0x96fd('0x26')](function(_0xd4c190){if(_0xd4c190){_0x30f965[_0x96fd('0x4b')]=_[_0x96fd('0x48')](db[_0x96fd('0x75')][_0x96fd('0x42')]);_0x30f965['query']=_['keys'](_0x229680[_0x96fd('0x47')]);_0x30f965[_0x96fd('0x51')]=_[_0x96fd('0x49')](_0x30f965['model'],_0x30f965['query']);_0xcd653b['attributes']=_[_0x96fd('0x49')](_0x30f965[_0x96fd('0x4b')],qs[_0x96fd('0x4c')](_0x229680['query']['fields']));_0xcd653b[_0x96fd('0x4a')]=_0xcd653b[_0x96fd('0x4a')][_0x96fd('0x4d')]?_0xcd653b[_0x96fd('0x4a')]:_0x30f965[_0x96fd('0x4b')];if(!_0x229680['query'][_0x96fd('0x6c')](_0x96fd('0x4e'))){_0xcd653b[_0x96fd('0x33')]=qs[_0x96fd('0x33')](_0x229680['query']['limit']);_0xcd653b[_0x96fd('0x32')]=qs['offset'](_0x229680[_0x96fd('0x47')][_0x96fd('0x32')]);}_0xcd653b[_0x96fd('0x6d')]=qs[_0x96fd('0x4f')](_0x229680[_0x96fd('0x47')]['sort']);_0xcd653b[_0x96fd('0x50')]=qs['filters'](_[_0x96fd('0x52')](_0x229680['query'],_0x30f965[_0x96fd('0x51')]));_0xcd653b['where'][_0x96fd('0x6a')]=_0xd4c190['id'];if(_0x229680[_0x96fd('0x47')][_0x96fd('0x55')]){_0xcd653b[_0x96fd('0x50')]=_['merge'](_0xcd653b[_0x96fd('0x50')],{'$or':_[_0x96fd('0x46')](_0xcd653b[_0x96fd('0x4a')],function(_0x2f15a2){var _0x16b1c5={};_0x16b1c5[_0x2f15a2]={'$like':'%'+_0x229680['query'][_0x96fd('0x55')]+'%'};return _0x16b1c5;})});}_0xcd653b=_[_0x96fd('0x53')]({},_0xcd653b,_0x229680['options']);return db['FaxInteraction'][_0x96fd('0x57')]({'where':_0xcd653b[_0x96fd('0x50')]})[_0x96fd('0x26')](function(_0x48bc68){_0x2ea8b5[_0x96fd('0x57')]=_0x48bc68;if(_0x229680[_0x96fd('0x47')][_0x96fd('0x58')]){_0xcd653b['include']=[{'model':db[_0x96fd('0x78')],'as':_0x96fd('0x79'),'required':![]},{'model':db[_0x96fd('0x7a')],'as':'Owner','attributes':[_0x96fd('0x3d'),_0x96fd('0x7b'),'internal'],'required':![]},{'model':db[_0x96fd('0x7c')],'as':_0x96fd('0x7d'),'attributes':['id',_0x96fd('0x3d'),_0x96fd('0x7e')],'where':_0x229680[_0x96fd('0x47')][_0x96fd('0x7f')]?{'id':_0x229680[_0x96fd('0x47')][_0x96fd('0x7f')]}:undefined,'required':_0x229680['query']['tag']?!![]:![]}];}return db[_0x96fd('0x75')]['findAll'](_0xcd653b);})[_0x96fd('0x26')](function(_0x2a4d29){_0x2ea8b5['rows']=_0x2a4d29;return _0x2ea8b5;});}})[_0x96fd('0x26')](respondWithFilteredResult(_0x228aee,_0xcd653b))[_0x96fd('0x5b')](handleError(_0x228aee,null));};exports[_0x96fd('0x80')]=function(_0x59bd28,_0x2b98cd){var _0x1b24cd=_0x59bd28[_0x96fd('0x5d')]['id'];var _0x5260dc=_0x59bd28[_0x96fd('0x61')];var _0x5dfe2d=0xc8;var _0x22fe0d=null;return db['sequelize'][_0x96fd('0x81')]({'isolationLevel':db['sequelize'][_0x96fd('0x82')][_0x96fd('0x83')][_0x96fd('0x84')]},function(_0x36cdcc){return db['FaxAccount'][_0x96fd('0x72')]({'where':{'id':_0x1b24cd},'transaction':_0x36cdcc})[_0x96fd('0x26')](function(_0xaa5682){if(_0xaa5682){return db[_0x96fd('0x85')][_0x96fd('0x38')]({'where':{'FaxAccountId':_0x1b24cd},'transaction':_0x36cdcc})[_0x96fd('0x26')](function(){var _0x5aa44d=_[_0x96fd('0x46')](_0x5260dc,function(_0x30c9ce){_0x30c9ce[_0x96fd('0x6a')]=_0x1b24cd;return _0x30c9ce;});return db[_0x96fd('0x85')][_0x96fd('0x86')](_0x5aa44d,{'transaction':_0x36cdcc});});}else{_0x5dfe2d=0x194;_0x22fe0d=[];}});})[_0x96fd('0x26')](function(){if(_0x5dfe2d!==0x194){return db[_0x96fd('0x85')][_0x96fd('0x87')]({'where':{'FaxAccountId':_0x1b24cd},'order':_0x96fd('0x88')})[_0x96fd('0x26')](function(_0x28c8ea){_0x22fe0d=_0x28c8ea;});}})[_0x96fd('0x5b')](function(_0xc98f0){_0x5dfe2d=0x1f4;logger[_0x96fd('0x2c')](_0xc98f0[_0x96fd('0x3c')]);if(_0xc98f0['name']){delete _0xc98f0['name'];}_0x22fe0d=_0xc98f0;})[_0x96fd('0x89')](function(){if(_0x22fe0d===null){_0x2b98cd[_0x96fd('0x2f')](_0x5dfe2d);}else{if(_0x5dfe2d===0x1f4){_0x2b98cd[_0x96fd('0x30')](_0x5dfe2d)[_0x96fd('0x3e')](_0x22fe0d);}else{_0x2b98cd['status'](_0x5dfe2d)[_0x96fd('0x31')](_0x22fe0d);}}});};exports[_0x96fd('0x8a')]=function(_0x3c0cf6,_0x104f5e,_0x426e5c){var _0x2ce036={};var _0x26d16a={};var _0x3d8444;var _0xcc9732;return db[_0x96fd('0x41')][_0x96fd('0x72')]({'where':{'id':_0x3c0cf6[_0x96fd('0x5d')]['id']}})['then'](handleEntityNotFound(_0x104f5e,null))[_0x96fd('0x26')](function(_0x18af8e){if(_0x18af8e){_0x3d8444=_0x18af8e;_0x26d16a[_0x96fd('0x4b')]=_[_0x96fd('0x48')](db['FaxApplication'][_0x96fd('0x42')]);_0x26d16a[_0x96fd('0x47')]=_[_0x96fd('0x48')](_0x3c0cf6[_0x96fd('0x47')]);_0x26d16a[_0x96fd('0x51')]=_[_0x96fd('0x49')](_0x26d16a[_0x96fd('0x4b')],_0x26d16a[_0x96fd('0x47')]);_0x2ce036[_0x96fd('0x4a')]=_[_0x96fd('0x49')](_0x26d16a[_0x96fd('0x4b')],qs['fields'](_0x3c0cf6[_0x96fd('0x47')]['fields']));_0x2ce036['attributes']=_0x2ce036[_0x96fd('0x4a')][_0x96fd('0x4d')]?_0x2ce036[_0x96fd('0x4a')]:_0x26d16a[_0x96fd('0x4b')];_0x2ce036[_0x96fd('0x6d')]=qs[_0x96fd('0x4f')](_0x3c0cf6[_0x96fd('0x47')][_0x96fd('0x4f')]);_0x2ce036[_0x96fd('0x50')]=qs[_0x96fd('0x51')](_[_0x96fd('0x52')](_0x3c0cf6[_0x96fd('0x47')],_0x26d16a[_0x96fd('0x51')]));if(_0x3c0cf6[_0x96fd('0x47')][_0x96fd('0x55')]){_0x2ce036[_0x96fd('0x50')]=_['merge'](_0x2ce036['where'],{'$or':_[_0x96fd('0x46')](_0x2ce036[_0x96fd('0x4a')],function(_0x49604a){var _0x1c2ae8={};_0x1c2ae8[_0x49604a]={'$like':'%'+_0x3c0cf6['query']['filter']+'%'};return _0x1c2ae8;})});}_0x2ce036=_['merge']({},_0x2ce036,_0x3c0cf6['options']);return _0x3d8444[_0x96fd('0x8a')](_0x2ce036);}})[_0x96fd('0x26')](function(_0x1bc898){if(_0x1bc898){_0xcc9732=_0x1bc898['length'];if(!_0x3c0cf6['query']['hasOwnProperty']('nolimit')){_0x2ce036[_0x96fd('0x33')]=qs[_0x96fd('0x33')](_0x3c0cf6[_0x96fd('0x47')]['limit']);_0x2ce036[_0x96fd('0x32')]=qs[_0x96fd('0x32')](_0x3c0cf6[_0x96fd('0x47')][_0x96fd('0x32')]);}return _0x3d8444['getApplications'](_0x2ce036);}})[_0x96fd('0x26')](function(_0x36d655){if(_0x36d655){return _0x36d655?{'count':_0xcc9732,'rows':_0x36d655}:null;}})['then'](respondWithResult(_0x104f5e,null))[_0x96fd('0x5b')](handleError(_0x104f5e,null));};function Extension(_0x5badb7,_0x3d96ca,_0x2dd751,_0x2fe4c4){this[_0x96fd('0x8b')]=_0x96fd('0x8c');this[_0x96fd('0x8d')]=_0x5badb7[_0x96fd('0x8e')];this[_0x96fd('0x8f')]=_0x2fe4c4;this[_0x96fd('0x44')]=_0x96fd('0x90');this[_0x96fd('0x91')]=_0x96fd('0x92');this[_0x96fd('0x6a')]=_0x5badb7['id'];this['priority']=_0x3d96ca;this['appdata']=_0x2dd751;}function createExtensionsReciveFax(_0x344fff){var _0x55214e=0x1;var _0x57aae3=[];_0x57aae3[_0x96fd('0x93')](new Extension(_0x344fff,_0x55214e,'','Answer'));_0x55214e+=0x1;_0x57aae3['push'](new Extension(_0x344fff,_0x55214e,_0x96fd('0x94'),'Set'));_0x55214e+=0x1;for(var _0x2b3148 in _0x344fff){if(_0x344fff['hasOwnProperty'](_0x2b3148)&&(_0x2b3148===_0x96fd('0x95')||_0x2b3148===_0x96fd('0x8e')||_0x2b3148==='gateway'||_0x2b3148===_0x96fd('0x96')||_0x2b3148===_0x96fd('0x97')||_0x2b3148===_0x96fd('0x98')||_0x2b3148===_0x96fd('0x99')||_0x2b3148===_0x96fd('0x9a')||_0x2b3148===_0x96fd('0x9b'))){_0x57aae3[_0x96fd('0x93')](new Extension(_0x344fff,_0x55214e,'FAXOPT('+_0x2b3148+')='+_0x344fff[_0x2b3148],_0x96fd('0x9c')));_0x55214e+=0x1;}}_0x57aae3['push'](new Extension(_0x344fff,_0x55214e,'6','Wait'));_0x55214e+=0x1;_0x57aae3[_0x96fd('0x93')](new Extension(_0x344fff,_0x55214e,_0x96fd('0x9d'),_0x96fd('0x9e')));_0x55214e=0x0;return _0x57aae3;}exports[_0x96fd('0x9f')]=function(_0x4ad3aa,_0x14db2c,_0x2903a2){var _0x41d4bd;return db[_0x96fd('0xa0')][_0x96fd('0x81')](function(_0x5ba324){return db[_0x96fd('0x41')][_0x96fd('0x60')](_0x4ad3aa[_0x96fd('0x61')],{'transaction':_0x5ba324})['then'](function(_0xc755bf){_0x41d4bd=_0xc755bf[_0x96fd('0x39')]({'plain':!![]});return db[_0x96fd('0xa1')][_0x96fd('0x86')](createExtensionsReciveFax(_0x41d4bd),{'transaction':_0x5ba324});});})['then'](function(){return _0x41d4bd;})[_0x96fd('0x26')](respondWithResult(_0x14db2c,null))[_0x96fd('0x5b')](handleError(_0x14db2c,null));};exports[_0x96fd('0xa2')]=function(_0x522c4c,_0x196147,_0xb903f){var _0x3c3dc5;return db[_0x96fd('0xa0')][_0x96fd('0x81')](function(_0x8d95f3){return db['FaxAccount']['update'](_0x522c4c[_0x96fd('0x61')],{'where':{'id':_0x522c4c[_0x96fd('0x61')]['id']},'transaction':_0x8d95f3})['then'](function(_0x40c7c3){return db[_0x96fd('0xa1')]['destroy']({'where':{'FaxAccountId':_0x522c4c['body']['id']},'transaction':_0x8d95f3})['then'](function(_0x3e2020){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x96fd('0x76')](_0x522c4c[_0x96fd('0x61')],[_0x96fd('0xa3'),_0x96fd('0x45'),_0x96fd('0xa4'),_0x96fd('0xa5'),_0x96fd('0xa6'),'ListId'])),{'transaction':_0x8d95f3});});});})[_0x96fd('0x26')](function(){return db[_0x96fd('0x41')][_0x96fd('0xa7')](_0x522c4c[_0x96fd('0x61')]['id']);})[_0x96fd('0x26')](respondWithResult(_0x196147,null))[_0x96fd('0x5b')](handleError(_0x196147,null));};exports['getMessages']=function(_0x2c79ed,_0x1bafaf,_0x2bedc3){var _0x417cb5={'raw':!![],'where':{}};var _0x206d1a={};var _0x3f0ec0={'count':0x0,'rows':[]};return db[_0x96fd('0x41')][_0x96fd('0x72')]({'where':{'id':_0x2c79ed[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x1bafaf,null))['then'](function(_0x22afa9){if(_0x22afa9){_0x206d1a['model']=_[_0x96fd('0x48')](db[_0x96fd('0xa8')][_0x96fd('0x42')]);_0x206d1a[_0x96fd('0x47')]=_['keys'](_0x2c79ed[_0x96fd('0x47')]);_0x206d1a[_0x96fd('0x51')]=_[_0x96fd('0x49')](_0x206d1a['model'],_0x206d1a['query']);_0x417cb5[_0x96fd('0x4a')]=_[_0x96fd('0x49')](_0x206d1a[_0x96fd('0x4b')],qs[_0x96fd('0x4c')](_0x2c79ed[_0x96fd('0x47')][_0x96fd('0x4c')]));_0x417cb5[_0x96fd('0x4a')]=_0x417cb5[_0x96fd('0x4a')][_0x96fd('0x4d')]?_0x417cb5['attributes']:_0x206d1a['model'];if(!_0x2c79ed[_0x96fd('0x47')][_0x96fd('0x6c')](_0x96fd('0x4e'))){_0x417cb5[_0x96fd('0x33')]=qs[_0x96fd('0x33')](_0x2c79ed[_0x96fd('0x47')][_0x96fd('0x33')]);_0x417cb5['offset']=qs[_0x96fd('0x32')](_0x2c79ed[_0x96fd('0x47')][_0x96fd('0x32')]);}_0x417cb5[_0x96fd('0x6d')]=qs[_0x96fd('0x4f')](_0x2c79ed[_0x96fd('0x47')][_0x96fd('0x4f')]);_0x417cb5['where']=qs[_0x96fd('0x51')](_[_0x96fd('0x52')](_0x2c79ed['query'],_0x206d1a[_0x96fd('0x51')]));_0x417cb5['where'][_0x96fd('0x6a')]=_0x22afa9['id'];if(_0x2c79ed[_0x96fd('0x47')][_0x96fd('0x55')]){_0x417cb5[_0x96fd('0x50')]=_[_0x96fd('0x53')](_0x417cb5[_0x96fd('0x50')],{'$or':_['map'](_0x417cb5['attributes'],function(_0x34f9b6){var _0x46baed={};_0x46baed[_0x34f9b6]={'$like':'%'+_0x2c79ed[_0x96fd('0x47')]['filter']+'%'};return _0x46baed;})});}if(_0x2c79ed[_0x96fd('0x47')][_0x96fd('0xa9')]){var _0x4775bb=_0x2c79ed[_0x96fd('0x47')][_0x96fd('0xa9')][_0x96fd('0xaa')](',');var _0x326322={};_0x326322[_0x4775bb[0x0]]={'$gte':moment(_0x4775bb[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x417cb5[_0x96fd('0x50')]=_[_0x96fd('0x53')](_0x417cb5[_0x96fd('0x50')],_0x326322);}_0x417cb5=_[_0x96fd('0x53')]({},_0x417cb5,_0x2c79ed[_0x96fd('0x56')]);return db[_0x96fd('0xa8')][_0x96fd('0x57')]({'where':_0x417cb5[_0x96fd('0x50')]})[_0x96fd('0x26')](function(_0x1a69b6){_0x3f0ec0[_0x96fd('0x57')]=_0x1a69b6;if(_0x2c79ed['query'][_0x96fd('0x58')]){_0x417cb5[_0x96fd('0x5e')]=[{'all':!![]}];}return db[_0x96fd('0xa8')][_0x96fd('0x59')](_0x417cb5);})[_0x96fd('0x26')](function(_0x12fcd2){_0x3f0ec0[_0x96fd('0x5a')]=_0x12fcd2;return _0x3f0ec0;});}})[_0x96fd('0x26')](respondWithFilteredResult(_0x1bafaf,_0x417cb5))['catch'](handleError(_0x1bafaf,null));};exports[_0x96fd('0x3e')]=function(_0x3ac265,_0x358fad,_0x5da165){var _0x1693d1,_0x2ce3d7={},_0x1b7c46;if(_0x3ac265[_0x96fd('0x61')]['to']){_0x1b7c46=_0x3ac265[_0x96fd('0x61')]['to'][0x0];}return db[_0x96fd('0x41')][_0x96fd('0x5f')]({'where':{'id':_0x3ac265['params']['id']},'include':[{'model':db[_0x96fd('0xab')],'as':_0x96fd('0xac'),'include':[{'model':db[_0x96fd('0x78')],'as':_0x96fd('0xad'),'where':{'fax':_0x1b7c46},'limit':0x1,'order':[[_0x96fd('0xa5'),_0x96fd('0xae')]]}]}]})[_0x96fd('0x26')](handleEntityNotFound(_0x358fad,null))[_0x96fd('0x26')](function(_0x383f23){_0x1693d1=_0x383f23;if(_0x3ac265[_0x96fd('0x61')][_0x96fd('0xaf')]&&_0x3ac265[_0x96fd('0x61')][_0x96fd('0xaf')]['length']){for(var _0x3ea2bc=0x0;_0x3ea2bc<_0x3ac265[_0x96fd('0x61')]['attachments'][_0x96fd('0x4d')];_0x3ea2bc+=0x1){_0x3ac265['body']['attachments'][_0x3ea2bc]={'filename':_0x3ac265[_0x96fd('0x61')][_0x96fd('0xaf')][_0x3ea2bc][_0x96fd('0x3d')],'id':_0x3ac265[_0x96fd('0x61')][_0x96fd('0xaf')][_0x3ea2bc]['id'],'path':path['join'](config[_0x96fd('0xb0')],_0x96fd('0xb1'),_0x3ac265[_0x96fd('0x61')][_0x96fd('0xaf')][_0x3ea2bc][_0x96fd('0xb2')])};}}return respondWithRpcPromise(_0x96fd('0xb3'),'CheckAfterSend',{'FaxAccountId':_[_0x96fd('0xb4')](_0x3ac265['params']['id'])?undefined:_0x3ac265['params']['id'],'path':_[_0x96fd('0xb4')](_0x3ac265[_0x96fd('0x61')]['attachments'][0x0][_0x96fd('0x9')])?undefined:_0x3ac265[_0x96fd('0x61')]['attachments'][0x0][_0x96fd('0x9')],'fax':_[_0x96fd('0xb4')](_0x3ac265[_0x96fd('0x61')]['to'][0x0])?undefined:_0x3ac265[_0x96fd('0x61')]['to'][0x0]},client9002);})[_0x96fd('0x26')](function(){if(_0x1693d1){if(_[_0x96fd('0xb4')](_0x3ac265[_0x96fd('0x61')][_0x96fd('0xb5')])){_0x3ac265[_0x96fd('0x61')]['from']=util[_0x96fd('0xb6')](_0x96fd('0xb7'),_0x1693d1['name'],_0x1693d1['fax']);}if(_0x1693d1[_0x96fd('0xac')]){if(_0x1693d1[_0x96fd('0xac')]['Contacts'][_0x96fd('0x4d')]){return _0x1693d1[_0x96fd('0xac')][_0x96fd('0xad')][0x0];}else{return db[_0x96fd('0x78')][_0x96fd('0x60')](_['defaults'](_0x3ac265[_0x96fd('0x61')],{'firstName':_0x3ac265[_0x96fd('0x61')]['to'][0x0],'phone':_0x3ac265['body']['to'][0x0],'fax':_0x3ac265[_0x96fd('0x61')]['to'][0x0],'ListId':_0x1693d1[_0x96fd('0xb8')]}));}}else{throw new Error(_0x96fd('0xb9'));}}else{throw new Error(_0x96fd('0xba'));}})[_0x96fd('0x26')](function(_0x123adf){if(_0x123adf){return db[_0x96fd('0x75')][_0x96fd('0x5f')]({'where':{'ContactId':_0x123adf['id'],'closed':![],'FaxAccountId':_0x1693d1['id']}})[_0x96fd('0x26')](function(_0x14e543){if(_0x14e543){return[_0x14e543,![]];}return db[_0x96fd('0x75')][_0x96fd('0x60')]({'UserId':_0x3ac265[_0x96fd('0x62')]['id'],'ContactId':_0x123adf['id'],'FaxAccountId':_0x1693d1['id'],'fax':_0x3ac265['body']['to'][0x0],'firstMsgDirection':_0x96fd('0xbb'),'Messages':[_[_0x96fd('0x53')](_0x3ac265[_0x96fd('0x61')],{'read':![],'body':_0x3ac265[_0x96fd('0x61')][_0x96fd('0xaf')][0x0][_0x96fd('0xbc')],'FaxAccountId':_0x1693d1['id'],'UserId':_0x3ac265[_0x96fd('0x62')]['id'],'ContactId':_0x123adf['id'],'AttachmentId':_0x3ac265[_0x96fd('0x61')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x96fd('0xa8')],'as':_0x96fd('0xbd')}]})[_0x96fd('0x26')](function(_0x59d8ce){return[_0x59d8ce,!![]];});});}else{throw new Error(_0x96fd('0xbe'));}})['spread'](function(_0x5751cd,_0x4a58c6){if(_0x4a58c6){return _0x5751cd;}return db[_0x96fd('0xa8')]['create']({'direction':_0x96fd('0xbb'),'read':![],'body':_0x3ac265[_0x96fd('0x61')]['attachments'][0x0][_0x96fd('0xbc')],'FaxAccountId':_0x1693d1['id'],'FaxInteractionId':_0x5751cd['id'],'UserId':_0x3ac265[_0x96fd('0x62')]['id'],'ContactId':_0x5751cd[_0x96fd('0xbf')],'AttachmentId':_0x3ac265[_0x96fd('0x61')]['attachments'][0x0]['id']})[_0x96fd('0x26')](function(_0x1ca56d){_0x5751cd['dataValues'][_0x96fd('0xbd')]=[];_0x5751cd[_0x96fd('0xc0')][_0x96fd('0xbd')]['push'](_0x1ca56d[_0x96fd('0xc0')]);return _0x5751cd;});})[_0x96fd('0x26')](function(_0x2764c0){respondWithRpcPromise(_0x96fd('0xc1'),_0x96fd('0xc1'),{'FaxAccountId':_[_0x96fd('0xb4')](_0x3ac265[_0x96fd('0x5d')]['id'])?undefined:_0x3ac265[_0x96fd('0x5d')]['id'],'path':_[_0x96fd('0xb4')](_0x3ac265['body'][_0x96fd('0xaf')][0x0][_0x96fd('0x9')])?undefined:_0x3ac265[_0x96fd('0x61')]['attachments'][0x0][_0x96fd('0x9')],'fax':_[_0x96fd('0xb4')](_0x3ac265[_0x96fd('0x61')]['to'][0x0])?undefined:_0x3ac265['body']['to'][0x0],'AttachmentId':_0x3ac265[_0x96fd('0x61')][_0x96fd('0xaf')][0x0]['id']},client9002)[_0x96fd('0x26')](function(_0x1b393b){logger['info'](_0x96fd('0xc2'),_0x1b393b);})[_0x96fd('0x5b')](function(_0x53976f){logger['info']('SendFaxRpc,\x20%s',_0x53976f);});return _0x2764c0;})['then'](respondWithResult(_0x358fad,null))['catch'](handleError(_0x358fad,null));};exports[_0x96fd('0xc3')]=function(_0x445df9,_0x2408df,_0x5319db){return db[_0x96fd('0x41')][_0x96fd('0x5f')]({'where':{'id':_0x445df9[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x2408df,null))[_0x96fd('0x26')](function(_0xa8ddb4){if(_0xa8ddb4){return _0xa8ddb4[_0x96fd('0xc3')](_0x445df9[_0x96fd('0x61')]['ids'],_[_0x96fd('0x76')](_0x445df9['body'],[_0x96fd('0x6f'),'id'])||{})['spread'](function(_0x33fbac){for(var _0x43ecf6=0x0;_0x43ecf6<_0x445df9[_0x96fd('0x61')][_0x96fd('0x6f')][_0x96fd('0x4d')];_0x43ecf6+=0x1){socket[_0x96fd('0xc4')](_0x96fd('0xc5'),{'UserId':Number(_0x445df9[_0x96fd('0x61')][_0x96fd('0x6f')][_0x43ecf6]),'FaxAccountId':Number(_0x445df9['params']['id'])});}return _0x33fbac;});}})[_0x96fd('0x26')](respondWithResult(_0x2408df,null))[_0x96fd('0x5b')](handleError(_0x2408df,null));};exports[_0x96fd('0xc6')]=function(_0x5a250f,_0x4867b1,_0x108f17){return db[_0x96fd('0x41')]['find']({'where':{'id':_0x5a250f[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x4867b1,null))[_0x96fd('0x26')](function(_0x1e6c81){if(_0x1e6c81){return _0x1e6c81[_0x96fd('0xc6')](_0x5a250f[_0x96fd('0x47')][_0x96fd('0x6f')])[_0x96fd('0x26')](function(){if(_['isArray'](_0x5a250f[_0x96fd('0x47')][_0x96fd('0x6f')])){for(var _0x2cfd71=0x0;_0x2cfd71<_0x5a250f[_0x96fd('0x47')][_0x96fd('0x6f')][_0x96fd('0x4d')];_0x2cfd71+=0x1){socket[_0x96fd('0xc4')](_0x96fd('0xc7'),{'UserId':Number(_0x5a250f[_0x96fd('0x47')]['ids'][_0x2cfd71]),'FaxAccountId':Number(_0x5a250f[_0x96fd('0x5d')]['id'])});}}else{socket[_0x96fd('0xc4')](_0x96fd('0xc7'),{'UserId':Number(_0x5a250f[_0x96fd('0x47')][_0x96fd('0x6f')]),'FaxAccountId':Number(_0x5a250f[_0x96fd('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x4867b1,null))[_0x96fd('0x5b')](handleError(_0x4867b1,null));};exports['getAgents']=function(_0x5307ec,_0x1171c7,_0x1b93be){var _0x4cb086={};var _0x34b07e={};var _0x5acfa9;var _0x4cdfb4;return db['FaxAccount'][_0x96fd('0x72')]({'where':{'id':_0x5307ec[_0x96fd('0x5d')]['id']}})[_0x96fd('0x26')](handleEntityNotFound(_0x1171c7,null))['then'](function(_0x598c91){if(_0x598c91){_0x5acfa9=_0x598c91;_0x34b07e[_0x96fd('0x4b')]=_[_0x96fd('0x48')](db[_0x96fd('0x7a')][_0x96fd('0x42')]);_0x34b07e[_0x96fd('0x47')]=_[_0x96fd('0x48')](_0x5307ec[_0x96fd('0x47')]);_0x34b07e[_0x96fd('0x51')]=_[_0x96fd('0x49')](_0x34b07e[_0x96fd('0x4b')],_0x34b07e['query']);_0x4cb086[_0x96fd('0x4a')]=_[_0x96fd('0x49')](_0x34b07e[_0x96fd('0x4b')],qs[_0x96fd('0x4c')](_0x5307ec['query'][_0x96fd('0x4c')]));_0x4cb086[_0x96fd('0x4a')]=_0x4cb086[_0x96fd('0x4a')][_0x96fd('0x4d')]?_0x4cb086[_0x96fd('0x4a')]:_0x34b07e[_0x96fd('0x4b')];_0x4cb086[_0x96fd('0x6d')]=qs['sort'](_0x5307ec[_0x96fd('0x47')]['sort']);_0x4cb086[_0x96fd('0x50')]=qs[_0x96fd('0x51')](_['pick'](_0x5307ec[_0x96fd('0x47')],_0x34b07e['filters']));if(_0x5307ec['query'][_0x96fd('0x55')]){_0x4cb086[_0x96fd('0x50')]=_[_0x96fd('0x53')](_0x4cb086[_0x96fd('0x50')],{'$or':_[_0x96fd('0x46')](_0x4cb086[_0x96fd('0x4a')],function(_0x422333){var _0x37cb29={};_0x37cb29[_0x422333]={'$like':'%'+_0x5307ec[_0x96fd('0x47')][_0x96fd('0x55')]+'%'};return _0x37cb29;})});}_0x4cb086=_[_0x96fd('0x53')]({},_0x4cb086,_0x5307ec[_0x96fd('0x56')]);return _0x5acfa9[_0x96fd('0xc8')](_0x4cb086);}})[_0x96fd('0x26')](function(_0x53ddf0){if(_0x53ddf0){_0x4cdfb4=_0x53ddf0[_0x96fd('0x4d')];if(!_0x5307ec[_0x96fd('0x47')][_0x96fd('0x6c')]('nolimit')){_0x4cb086['limit']=qs[_0x96fd('0x33')](_0x5307ec[_0x96fd('0x47')][_0x96fd('0x33')]);_0x4cb086[_0x96fd('0x32')]=qs['offset'](_0x5307ec['query'][_0x96fd('0x32')]);}return _0x5acfa9[_0x96fd('0xc8')](_0x4cb086);}})[_0x96fd('0x26')](function(_0x32f81d){if(_0x32f81d){return _0x32f81d?{'count':_0x4cdfb4,'rows':_0x32f81d}:null;}})['then'](respondWithResult(_0x1171c7,null))[_0x96fd('0x5b')](handleError(_0x1171c7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d60fc3d..ad859c8 100644 --- a/server/api/faxAccount/faxAccount.events.js +++ b/server/api/faxAccount/faxAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x105f=['emit','hasOwnProperty','exports','../../mysqldb','update'];(function(_0x818500,_0xe7620c){var _0x342023=function(_0x17c939){while(--_0x17c939){_0x818500['push'](_0x818500['shift']());}};_0x342023(++_0xe7620c);}(_0x105f,0x71));var _0xf105=function(_0x8cf4f8,_0x331c71){_0x8cf4f8=_0x8cf4f8-0x0;var _0x41aa6f=_0x105f[_0x8cf4f8];return _0x41aa6f;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xf105('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf105('0x1'),'afterDestroy':'remove'};function emitEvent(_0x16e167){return function(_0x34d5e7,_0x7bfadd,_0x368830){FaxAccountEvents['emit'](_0x16e167+':'+_0x34d5e7['id'],_0x34d5e7);FaxAccountEvents[_0xf105('0x2')](_0x16e167,_0x34d5e7);_0x368830(null);};}for(var e in events){if(events[_0xf105('0x3')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xf105('0x4')]=FaxAccountEvents; \ No newline at end of file +var _0x6462=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount'];(function(_0xa0ab99,_0x5496c1){var _0x3bf6b5=function(_0x270d0a){while(--_0x270d0a){_0xa0ab99['push'](_0xa0ab99['shift']());}};_0x3bf6b5(++_0x5496c1);}(_0x6462,0x65));var _0x2646=function(_0x379ca9,_0x268f7f){_0x379ca9=_0x379ca9-0x0;var _0x8c3467=_0x6462[_0x379ca9];return _0x8c3467;};'use strict';var EventEmitter=require(_0x2646('0x0'));var FaxAccount=require(_0x2646('0x1'))['db'][_0x2646('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2646('0x3'),'afterDestroy':_0x2646('0x4')};function emitEvent(_0x543e78){return function(_0x149875,_0x1ca4e0,_0x2b28a6){FaxAccountEvents[_0x2646('0x5')](_0x543e78+':'+_0x149875['id'],_0x149875);FaxAccountEvents['emit'](_0x543e78,_0x149875);_0x2b28a6(null);};}for(var e in events){if(events[_0x2646('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x2646('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 75460c9..1e85315 100644 --- a/server/api/faxAccount/faxAccount.model.js +++ b/server/api/faxAccount/faxAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f9a=['./faxAccount.attributes','define','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4f9a,0x1ef));var _0xa4f9=function(_0x20e7ba,_0x45dff1){_0x20e7ba=_0x20e7ba-0x0;var _0x5d734a=_0x4f9a[_0x20e7ba];return _0x5d734a;};'use strict';var _=require(_0xa4f9('0x0'));var util=require(_0xa4f9('0x1'));var logger=require(_0xa4f9('0x2'))(_0xa4f9('0x3'));var moment=require(_0xa4f9('0x4'));var BPromise=require(_0xa4f9('0x5'));var rp=require(_0xa4f9('0x6'));var fs=require('fs');var path=require(_0xa4f9('0x7'));var rimraf=require(_0xa4f9('0x8'));var config=require('../../config/environment');var attributes=require(_0xa4f9('0x9'));module['exports']=function(_0x32ad97,_0x3d2403){return _0x32ad97[_0xa4f9('0xa')](_0xa4f9('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4f1=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports'];(function(_0xef89d,_0x287047){var _0x23d599=function(_0x20ebad){while(--_0x20ebad){_0xef89d['push'](_0xef89d['shift']());}};_0x23d599(++_0x287047);}(_0xb4f1,0x153));var _0x1b4f=function(_0x2fdebb,_0x4bc888){_0x2fdebb=_0x2fdebb-0x0;var _0x4c9f86=_0xb4f1[_0x2fdebb];return _0x4c9f86;};'use strict';var _=require(_0x1b4f('0x0'));var util=require(_0x1b4f('0x1'));var logger=require(_0x1b4f('0x2'))(_0x1b4f('0x3'));var moment=require(_0x1b4f('0x4'));var BPromise=require(_0x1b4f('0x5'));var rp=require(_0x1b4f('0x6'));var fs=require('fs');var path=require(_0x1b4f('0x7'));var rimraf=require('rimraf');var config=require(_0x1b4f('0x8'));var attributes=require(_0x1b4f('0x9'));module[_0x1b4f('0xa')]=function(_0x4b12e6,_0x3a5cb2){return _0x4b12e6[_0x1b4f('0xb')](_0x1b4f('0xc'),attributes,{'tableName':_0x1b4f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 06465f4..dd61d74 100644 --- a/server/api/faxAccount/faxAccount.rpc.js +++ b/server/api/faxAccount/faxAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba72=['ListId','body','from','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','find','account','Contacts','DESC','FaxApplication','Applications','applications','list','List','orderBy','priority','length','create','FaxInteraction','spread','get','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','queueId','FaxQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','catch','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId'];(function(_0x35aadd,_0x5c6ee4){var _0x3f5450=function(_0x25e036){while(--_0x25e036){_0x35aadd['push'](_0x35aadd['shift']());}};_0x3f5450(++_0x5c6ee4);}(_0xba72,0xe5));var _0x2ba7=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xba72[_0x251e8c];return _0x1e0c1d;};'use strict';var _=require(_0x2ba7('0x0'));var util=require(_0x2ba7('0x1'));var moment=require(_0x2ba7('0x2'));var BPromise=require(_0x2ba7('0x3'));var rs=require(_0x2ba7('0x4'));var fs=require('fs');var Redis=require(_0x2ba7('0x5'));var db=require(_0x2ba7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ba7('0x7'));var jayson=require(_0x2ba7('0x8'));var client=jayson[_0x2ba7('0x9')][_0x2ba7('0xa')]({'port':0x232c});config[_0x2ba7('0xb')]=_[_0x2ba7('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2ba7('0xd'))['register'](socket);function respondWithRpcPromise(_0x53d0db,_0x486a87,_0x224403){return new BPromise(function(_0x3bfa59,_0x1680cc){return client[_0x2ba7('0xe')](_0x53d0db,_0x224403)[_0x2ba7('0xf')](function(_0x5620a2){logger[_0x2ba7('0x10')](_0x2ba7('0x11'),_0x486a87,_0x2ba7('0x12'));logger[_0x2ba7('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x486a87,'request\x20sent',JSON[_0x2ba7('0x14')](_0x5620a2));if(_0x5620a2[_0x2ba7('0x15')]){if(_0x5620a2[_0x2ba7('0x15')][_0x2ba7('0x16')]===0x1f4){logger[_0x2ba7('0x15')](_0x2ba7('0x11'),_0x486a87,_0x5620a2[_0x2ba7('0x15')][_0x2ba7('0x17')]);return _0x1680cc(_0x5620a2[_0x2ba7('0x15')][_0x2ba7('0x17')]);}logger[_0x2ba7('0x15')](_0x2ba7('0x11'),_0x486a87,_0x5620a2[_0x2ba7('0x15')][_0x2ba7('0x17')]);return _0x3bfa59(_0x5620a2['error'][_0x2ba7('0x17')]);}else{logger[_0x2ba7('0x10')](_0x2ba7('0x11'),_0x486a87,_0x2ba7('0x12'));_0x3bfa59(_0x5620a2['result'][_0x2ba7('0x17')]);}})['catch'](function(_0x128820){logger['error'](_0x2ba7('0x11'),_0x486a87,_0x128820);_0x1680cc(_0x128820);});});}exports[_0x2ba7('0x18')]=function(_0x4493ea){var _0x24b7a1=this;return new Promise(function(_0x247110,_0x2e841f){return db[_0x2ba7('0x19')][_0x2ba7('0x1a')]({'raw':_0x4493ea[_0x2ba7('0x1b')]?_0x4493ea[_0x2ba7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4493ea['options']?_0x4493ea[_0x2ba7('0x1b')][_0x2ba7('0x1c')]||null:null,'attributes':_0x4493ea[_0x2ba7('0x1b')]?_0x4493ea[_0x2ba7('0x1b')][_0x2ba7('0x1d')]||null:null,'limit':_0x4493ea[_0x2ba7('0x1b')]?_0x4493ea[_0x2ba7('0x1b')][_0x2ba7('0x1e')]||null:null,'include':_0x4493ea[_0x2ba7('0x1b')]?_0x4493ea['options'][_0x2ba7('0x1f')]?_[_0x2ba7('0x20')](_0x4493ea[_0x2ba7('0x1b')][_0x2ba7('0x1f')],function(_0x28093e){return{'model':db[_0x28093e['model']],'as':_0x28093e['as'],'attributes':_0x28093e[_0x2ba7('0x1d')],'include':_0x28093e[_0x2ba7('0x1f')]?_[_0x2ba7('0x20')](_0x28093e[_0x2ba7('0x1f')],function(_0x494da8){return{'model':db[_0x494da8['model']],'as':_0x494da8['as'],'attributes':_0x494da8[_0x2ba7('0x1d')],'include':_0x494da8[_0x2ba7('0x1f')]?_[_0x2ba7('0x20')](_0x494da8['include'],function(_0x12f3c6){return{'model':db[_0x12f3c6[_0x2ba7('0x21')]],'as':_0x12f3c6['as'],'attributes':_0x12f3c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ba7('0xf')](function(_0x55364a){logger[_0x2ba7('0x10')]('GetFaxAccount',_0x4493ea);logger[_0x2ba7('0x13')]('GetFaxAccount',_0x4493ea,JSON[_0x2ba7('0x14')](_0x55364a));_0x247110(_0x55364a);})[_0x2ba7('0x22')](function(_0x158bc7){logger[_0x2ba7('0x15')](_0x2ba7('0x18'),_0x158bc7[_0x2ba7('0x17')],_0x4493ea);_0x2e841f(_0x24b7a1[_0x2ba7('0x15')](0x1f4,_0x158bc7['message']));});});};exports[_0x2ba7('0x23')]=function(_0x16dd3f,_0x2573f7,_0xb2f8c9){var _0x39c239=this;return new Promise(function(_0x590b32,_0x57ae8c){var _0xcfa77b={'body':_0x16dd3f['body'],'channel':_0x2ba7('0x24')};var _0x4e84e3=[];var _0x39d841=[];var _0x3762b7={};return db[_0x2ba7('0x25')][_0x2ba7('0x26')]()[_0x2ba7('0xf')](function(_0x4d15d8){if(!_0x4d15d8){throw new db[(_0x2ba7('0x27'))][(_0x2ba7('0x28'))](_0x2ba7('0x29'));}_0x4e84e3=_[_0x2ba7('0x2a')](_[_0x2ba7('0x2b')](_0x4d15d8),[_0x2ba7('0x2c'),_0x2ba7('0x2d')]);_0x39d841=_['difference'](_[_0x2ba7('0x2b')](_0x4d15d8),[_0x2ba7('0x2c'),_0x2ba7('0x2d'),_0x2ba7('0x2e'),_0x2ba7('0x2f')]);if(_0x16dd3f[_0x2ba7('0x30')]['id']){delete _0x16dd3f['body']['id'];}if(_['isNil'](_0x16dd3f[_0x2ba7('0x30')][_0x2ba7('0x31')])){throw new db[(_0x2ba7('0x27'))][(_0x2ba7('0x28'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x16dd3f[_0x2ba7('0x30')]['body'])||_0x16dd3f[_0x2ba7('0x30')][_0x2ba7('0x30')]===''){throw new db[(_0x2ba7('0x27'))]['ValidationError'](_0x2ba7('0x32'));}if(_['isNil'](_0x16dd3f[_0x2ba7('0x30')][_0x2ba7('0x33')])){throw new db[(_0x2ba7('0x27'))][(_0x2ba7('0x28'))](_0x2ba7('0x34')+_0x39d841);}if(!_[_0x2ba7('0x35')](_0x39d841,_0x16dd3f[_0x2ba7('0x30')][_0x2ba7('0x33')])){throw new db[(_0x2ba7('0x27'))][(_0x2ba7('0x28'))](_0x2ba7('0x36')+_0x39d841);}_0x3762b7[_0x16dd3f['body'][_0x2ba7('0x33')]]=_0x16dd3f[_0x2ba7('0x30')][_0x2ba7('0x31')];})[_0x2ba7('0xf')](function(){return db[_0x2ba7('0x19')][_0x2ba7('0x37')]({'where':{'id':_0x16dd3f[_0x2ba7('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2ba7('0x25')],'as':_0x2ba7('0x39'),'where':_0x3762b7,'limit':0x1,'order':[[_0x2ba7('0x2d'),_0x2ba7('0x3a')]]}]},{'model':db[_0x2ba7('0x3b')],'as':_0x2ba7('0x3c')}]});})[_0x2ba7('0xf')](function(_0xbeb4b2){if(_0xbeb4b2&&_0xbeb4b2['List']){var _0x40034e=_0xbeb4b2['get']({'plain':!![]});_0xcfa77b[_0x2ba7('0x38')]=_0x40034e;_0xcfa77b[_0x2ba7('0x3d')]=_0x40034e[_0x2ba7('0x3c')];_0xcfa77b[_0x2ba7('0x3e')]=_0x40034e[_0x2ba7('0x3f')];_0xcfa77b[_0x2ba7('0x3d')]=_[_0x2ba7('0x40')](_0xcfa77b[_0x2ba7('0x3d')],[_0x2ba7('0x41')],['asc']);if(_0xcfa77b[_0x2ba7('0x38')][_0x2ba7('0x3c')]){delete _0xcfa77b[_0x2ba7('0x38')]['Applications'];}if(_0xcfa77b[_0x2ba7('0x38')][_0x2ba7('0x3f')]&&_0xcfa77b[_0x2ba7('0x38')]['List'][_0x2ba7('0x39')][_0x2ba7('0x42')]){return _0xcfa77b['account'][_0x2ba7('0x3f')][_0x2ba7('0x39')][0x0];}var _0x13b1e3=_[_0x2ba7('0xc')](_0x16dd3f[_0x2ba7('0x30')],{'firstName':_0x16dd3f[_0x2ba7('0x30')]['from'],'ListId':_0x40034e[_0x2ba7('0x2f')]});_0x13b1e3[_0x16dd3f['body']['mapKey']]=_0x16dd3f[_0x2ba7('0x30')][_0x2ba7('0x31')];return db[_0x2ba7('0x25')][_0x2ba7('0x43')](_0x13b1e3,{'fields':_0x4e84e3,'raw':!![]});}})['then'](function(_0x5044f4){_0xcfa77b['contact']=_0x5044f4;if(_0x5044f4){var _0x50ed68={'ContactId':_0x5044f4['id'],'FaxAccountId':_0x16dd3f[_0x2ba7('0x38')]['id'],'fax':_0x5044f4[_0x2ba7('0x24')]};return db[_0x2ba7('0x44')][_0x2ba7('0x37')]({'where':{'ContactId':_0x5044f4['id'],'closed':![],'FaxAccountId':_0x16dd3f[_0x2ba7('0x38')]['id']}})[_0x2ba7('0xf')](function(_0xa72227){if(_0xa72227){return[_0xa72227,![]];}return db[_0x2ba7('0x44')][_0x2ba7('0x43')](_0x50ed68)['then'](function(_0x29e9da){return[_0x29e9da,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x2ba7('0x45')](function(_0x77f986,_0x317ce4){var _0x45d387=_0x77f986[_0x2ba7('0x46')]({'plain':!![]});if(_0x317ce4){if(_0xcfa77b[_0x2ba7('0x38')][_0x2ba7('0x47')]){_0xcfa77b[_0x2ba7('0x3d')]['push']({'id':0x0,'priority':_0xcfa77b['applications']['length']+0x1,'app':_0x2ba7('0x48'),'appdata':_0x2ba7('0x49'),'interval':_0x2ba7('0x4a')});}_0x45d387[_0x2ba7('0x4b')]=!![];}else{_0x45d387[_0x2ba7('0x4b')]=![];}_0xcfa77b[_0x2ba7('0x4c')]=_0x45d387;return db[_0x2ba7('0x4d')]['create']({'body':_0x16dd3f[_0x2ba7('0x30')]['body'],'FaxAccountId':_0x16dd3f[_0x2ba7('0x38')]['id'],'FaxInteractionId':_0x77f986['id'],'direction':'in','ContactId':_0x77f986[_0x2ba7('0x4e')],'AttachmentId':_0x16dd3f['body'][_0x2ba7('0x4f')]});})[_0x2ba7('0xf')](function(_0x50bece){_0xcfa77b[_0x2ba7('0x17')]=_0x50bece;if(!_0xcfa77b[_0x2ba7('0x4c')][_0x2ba7('0x50')])return;return db[_0x2ba7('0x51')]['find']({'attributes':['id',_0x2ba7('0x52')],'where':{'id':_0xcfa77b[_0x2ba7('0x4c')][_0x2ba7('0x50')]}});})[_0x2ba7('0xf')](function(_0xc88858){if(_0xc88858){_0xcfa77b[_0x2ba7('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2ba7('0x53'),'appdata':_0xc88858[_0x2ba7('0x52')]+','+(_0xcfa77b['account'][_0x2ba7('0x54')]||0xa),'interval':_0x2ba7('0x4a')});}if(!_0xcfa77b['interaction'][_0x2ba7('0x55')])return;return db[_0x2ba7('0x56')]['find']({'attributes':['id',_0x2ba7('0x52')],'where':{'id':_0xcfa77b['interaction'][_0x2ba7('0x55')]}});})[_0x2ba7('0xf')](function(_0x527354){if(_0x527354){_0xcfa77b[_0x2ba7('0x3d')][_0x2ba7('0x57')]({'id':0x0,'priority':0x1,'app':_0x2ba7('0x58'),'appdata':_0x527354[_0x2ba7('0x52')]+','+(_0xcfa77b[_0x2ba7('0x38')][_0x2ba7('0x59')]||0x12c),'interval':_0x2ba7('0x4a')});}return respondWithRpcPromise(_0x2ba7('0x5a'),_0x2ba7('0x5b'),_0xcfa77b);})[_0x2ba7('0xf')](function(_0x4f56f1){_0x590b32(_0x4f56f1);})['catch'](function(_0x2cbe4d){_0x57ae8c(_0x39c239[_0x2ba7('0x15')](0x1f4,_0x2cbe4d[_0x2ba7('0x17')]));});});}; \ No newline at end of file +var _0x2888=['list','orderBy','priority','asc','Contacts','length','defaults','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','interaction','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','include','model','map','then','debug','stringify','body','CmContact','describe','Sequelize','ValidationError','difference','updatedAt','keys','createdAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','Applications','get','applications'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x2888,0x1d3));var _0x8288=function(_0x31a983,_0x25e3e8){_0x31a983=_0x31a983-0x0;var _0x4c26d8=_0x2888[_0x31a983];return _0x4c26d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8288('0x0'));var rs=require(_0x8288('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8288('0x2'))(_0x8288('0x3'));var config=require(_0x8288('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8288('0x5')][_0x8288('0x6')]({'port':0x232c});config[_0x8288('0x7')]=_['defaults'](config[_0x8288('0x7')],{'host':_0x8288('0x8'),'port':0x18eb});var socket=require(_0x8288('0x9'))(new Redis(config[_0x8288('0x7')]));require(_0x8288('0xa'))['register'](socket);function respondWithRpcPromise(_0x28b443,_0x2b3057,_0x153900){return new BPromise(function(_0x8e530c,_0x60293f){return client['request'](_0x28b443,_0x153900)['then'](function(_0x15f635){logger['info'](_0x8288('0xb'),_0x2b3057,_0x8288('0xc'));logger['debug'](_0x8288('0xd'),_0x2b3057,_0x8288('0xc'),JSON['stringify'](_0x15f635));if(_0x15f635[_0x8288('0xe')]){if(_0x15f635['error']['code']===0x1f4){logger[_0x8288('0xe')](_0x8288('0xb'),_0x2b3057,_0x15f635[_0x8288('0xe')][_0x8288('0xf')]);return _0x60293f(_0x15f635[_0x8288('0xe')][_0x8288('0xf')]);}logger[_0x8288('0xe')](_0x8288('0xb'),_0x2b3057,_0x15f635[_0x8288('0xe')][_0x8288('0xf')]);return _0x8e530c(_0x15f635['error'][_0x8288('0xf')]);}else{logger[_0x8288('0x10')](_0x8288('0xb'),_0x2b3057,'request\x20sent');_0x8e530c(_0x15f635['result'][_0x8288('0xf')]);}})[_0x8288('0x11')](function(_0x704419){logger[_0x8288('0xe')](_0x8288('0xb'),_0x2b3057,_0x704419);_0x60293f(_0x704419);});});}exports[_0x8288('0x12')]=function(_0x3f7003){var _0x1e885b=this;return new Promise(function(_0x2f0681,_0x41ff04){return db[_0x8288('0x13')][_0x8288('0x14')]({'raw':_0x3f7003['options']?_0x3f7003[_0x8288('0x15')][_0x8288('0x16')]===undefined?!![]:![]:!![],'where':_0x3f7003[_0x8288('0x15')]?_0x3f7003[_0x8288('0x15')]['where']||null:null,'attributes':_0x3f7003[_0x8288('0x15')]?_0x3f7003[_0x8288('0x15')][_0x8288('0x17')]||null:null,'limit':_0x3f7003[_0x8288('0x15')]?_0x3f7003[_0x8288('0x15')]['limit']||null:null,'include':_0x3f7003['options']?_0x3f7003[_0x8288('0x15')]['include']?_['map'](_0x3f7003[_0x8288('0x15')][_0x8288('0x18')],function(_0x5eb65d){return{'model':db[_0x5eb65d[_0x8288('0x19')]],'as':_0x5eb65d['as'],'attributes':_0x5eb65d[_0x8288('0x17')],'include':_0x5eb65d[_0x8288('0x18')]?_[_0x8288('0x1a')](_0x5eb65d[_0x8288('0x18')],function(_0x38d07b){return{'model':db[_0x38d07b[_0x8288('0x19')]],'as':_0x38d07b['as'],'attributes':_0x38d07b[_0x8288('0x17')],'include':_0x38d07b[_0x8288('0x18')]?_[_0x8288('0x1a')](_0x38d07b[_0x8288('0x18')],function(_0xfaf00f){return{'model':db[_0xfaf00f[_0x8288('0x19')]],'as':_0xfaf00f['as'],'attributes':_0xfaf00f[_0x8288('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8288('0x1b')](function(_0xcffa54){logger['info'](_0x8288('0x12'),_0x3f7003);logger[_0x8288('0x1c')](_0x8288('0x12'),_0x3f7003,JSON[_0x8288('0x1d')](_0xcffa54));_0x2f0681(_0xcffa54);})[_0x8288('0x11')](function(_0xa457da){logger['error'](_0x8288('0x12'),_0xa457da[_0x8288('0xf')],_0x3f7003);_0x41ff04(_0x1e885b[_0x8288('0xe')](0x1f4,_0xa457da['message']));});});};exports['NotifyFaxAccount']=function(_0x1abf14,_0x343ebe,_0x5c1d25){var _0x5d0feb=this;return new Promise(function(_0x4bd387,_0x2ba5c8){var _0x17262b={'body':_0x1abf14[_0x8288('0x1e')],'channel':'fax'};var _0x591b14=[];var _0x12f494=[];var _0x54eebe={};return db[_0x8288('0x1f')][_0x8288('0x20')]()['then'](function(_0x52015a){if(!_0x52015a){throw new db[(_0x8288('0x21'))][(_0x8288('0x22'))]('no\x20available\x20attributes');}_0x591b14=_[_0x8288('0x23')](_['keys'](_0x52015a),['createdAt',_0x8288('0x24')]);_0x12f494=_['difference'](_[_0x8288('0x25')](_0x52015a),[_0x8288('0x26'),_0x8288('0x24'),'CompanyId',_0x8288('0x27')]);if(_0x1abf14[_0x8288('0x1e')]['id']){delete _0x1abf14[_0x8288('0x1e')]['id'];}if(_[_0x8288('0x28')](_0x1abf14[_0x8288('0x1e')][_0x8288('0x29')])){throw new db[(_0x8288('0x21'))]['ValidationError'](_0x8288('0x2a'));}if(_['isNil'](_0x1abf14['body'][_0x8288('0x1e')])||_0x1abf14[_0x8288('0x1e')]['body']===''){throw new db[(_0x8288('0x21'))]['ValidationError'](_0x8288('0x2b'));}if(_['isNil'](_0x1abf14[_0x8288('0x1e')][_0x8288('0x2c')])){throw new db[(_0x8288('0x21'))][(_0x8288('0x22'))](_0x8288('0x2d')+_0x12f494);}if(!_['includes'](_0x12f494,_0x1abf14['body'][_0x8288('0x2c')])){throw new db[(_0x8288('0x21'))][(_0x8288('0x22'))](_0x8288('0x2e')+_0x12f494);}_0x54eebe[_0x1abf14[_0x8288('0x1e')][_0x8288('0x2c')]]=_0x1abf14[_0x8288('0x1e')][_0x8288('0x29')];})['then'](function(){return db[_0x8288('0x13')][_0x8288('0x2f')]({'where':{'id':_0x1abf14[_0x8288('0x30')]['id']},'include':[{'model':db[_0x8288('0x31')],'as':_0x8288('0x32'),'include':[{'model':db[_0x8288('0x1f')],'as':'Contacts','where':_0x54eebe,'limit':0x1,'order':[[_0x8288('0x24'),_0x8288('0x33')]]}]},{'model':db['FaxApplication'],'as':_0x8288('0x34')}]});})[_0x8288('0x1b')](function(_0x2a7b7d){if(_0x2a7b7d&&_0x2a7b7d[_0x8288('0x32')]){var _0xe60058=_0x2a7b7d[_0x8288('0x35')]({'plain':!![]});_0x17262b[_0x8288('0x30')]=_0xe60058;_0x17262b[_0x8288('0x36')]=_0xe60058[_0x8288('0x34')];_0x17262b[_0x8288('0x37')]=_0xe60058['List'];_0x17262b['applications']=_[_0x8288('0x38')](_0x17262b['applications'],[_0x8288('0x39')],[_0x8288('0x3a')]);if(_0x17262b['account'][_0x8288('0x34')]){delete _0x17262b[_0x8288('0x30')][_0x8288('0x34')];}if(_0x17262b['account'][_0x8288('0x32')]&&_0x17262b['account']['List'][_0x8288('0x3b')][_0x8288('0x3c')]){return _0x17262b[_0x8288('0x30')][_0x8288('0x32')][_0x8288('0x3b')][0x0];}var _0x33902c=_[_0x8288('0x3d')](_0x1abf14[_0x8288('0x1e')],{'firstName':_0x1abf14[_0x8288('0x1e')][_0x8288('0x29')],'ListId':_0xe60058[_0x8288('0x27')]});_0x33902c[_0x1abf14[_0x8288('0x1e')]['mapKey']]=_0x1abf14[_0x8288('0x1e')][_0x8288('0x29')];return db['CmContact'][_0x8288('0x3e')](_0x33902c,{'fields':_0x591b14,'raw':!![]});}})[_0x8288('0x1b')](function(_0x6a909c){_0x17262b[_0x8288('0x3f')]=_0x6a909c;if(_0x6a909c){var _0x14ce25={'ContactId':_0x6a909c['id'],'FaxAccountId':_0x1abf14[_0x8288('0x30')]['id'],'fax':_0x6a909c[_0x8288('0x40')]};return db[_0x8288('0x41')]['find']({'where':{'ContactId':_0x6a909c['id'],'closed':![],'FaxAccountId':_0x1abf14[_0x8288('0x30')]['id']}})['then'](function(_0x39ba94){if(_0x39ba94){return[_0x39ba94,![]];}return db[_0x8288('0x41')][_0x8288('0x3e')](_0x14ce25)[_0x8288('0x1b')](function(_0x40c85c){return[_0x40c85c,!![]];});});}else{throw new Error(_0x8288('0x42'));}})[_0x8288('0x43')](function(_0x21a253,_0x45ae56){var _0xbcf98c=_0x21a253['get']({'plain':!![]});if(_0x45ae56){if(_0x17262b[_0x8288('0x30')][_0x8288('0x44')]){_0x17262b[_0x8288('0x36')]['push']({'id':0x0,'priority':_0x17262b[_0x8288('0x36')][_0x8288('0x3c')]+0x1,'app':_0x8288('0x45'),'appdata':_0x8288('0x46'),'interval':_0x8288('0x47')});}_0xbcf98c[_0x8288('0x48')]=!![];}else{_0xbcf98c[_0x8288('0x48')]=![];}_0x17262b['interaction']=_0xbcf98c;return db[_0x8288('0x49')][_0x8288('0x3e')]({'body':_0x1abf14[_0x8288('0x1e')][_0x8288('0x1e')],'FaxAccountId':_0x1abf14[_0x8288('0x30')]['id'],'FaxInteractionId':_0x21a253['id'],'direction':'in','ContactId':_0x21a253[_0x8288('0x4a')],'AttachmentId':_0x1abf14[_0x8288('0x1e')][_0x8288('0x4b')]});})['then'](function(_0x4dd932){_0x17262b['message']=_0x4dd932;if(!_0x17262b['interaction'][_0x8288('0x4c')])return;return db[_0x8288('0x4d')][_0x8288('0x2f')]({'attributes':['id',_0x8288('0x4e')],'where':{'id':_0x17262b['interaction']['UserId']}});})[_0x8288('0x1b')](function(_0x2290ff){if(_0x2290ff){_0x17262b['applications'][_0x8288('0x4f')]({'id':0x0,'priority':0x0,'app':_0x8288('0x50'),'appdata':_0x2290ff[_0x8288('0x4e')]+','+(_0x17262b[_0x8288('0x30')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x17262b[_0x8288('0x51')][_0x8288('0x52')])return;return db[_0x8288('0x53')][_0x8288('0x2f')]({'attributes':['id',_0x8288('0x4e')],'where':{'id':_0x17262b[_0x8288('0x51')][_0x8288('0x52')]}});})['then'](function(_0x2a60e9){if(_0x2a60e9){_0x17262b[_0x8288('0x36')][_0x8288('0x4f')]({'id':0x0,'priority':0x1,'app':_0x8288('0x54'),'appdata':_0x2a60e9[_0x8288('0x4e')]+','+(_0x17262b[_0x8288('0x30')][_0x8288('0x55')]||0x12c),'interval':_0x8288('0x47')});}return respondWithRpcPromise('Start',_0x8288('0x56'),_0x17262b);})[_0x8288('0x1b')](function(_0x28ef73){_0x4bd387(_0x28ef73);})[_0x8288('0x11')](function(_0x2da070){_0x2ba5c8(_0x5d0feb[_0x8288('0xe')](0x1f4,_0x2da070[_0x8288('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a1fd5b3..427e7d2 100644 --- a/server/api/faxAccount/faxAccount.socket.js +++ b/server/api/faxAccount/faxAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf637=['update','removeListener','register','length','faxAccount:','save'];(function(_0x1573c6,_0x4d73e9){var _0x34ab50=function(_0x6a6754){while(--_0x6a6754){_0x1573c6['push'](_0x1573c6['shift']());}};_0x34ab50(++_0x4d73e9);}(_0xf637,0x1a9));var _0x7f63=function(_0x275aa8,_0x17833c){_0x275aa8=_0x275aa8-0x0;var _0xca68f9=_0xf637[_0x275aa8];return _0xca68f9;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7f63('0x0'),'remove',_0x7f63('0x1')];function createListener(_0x59823f,_0x4eea10){return function(_0x3224f4){_0x4eea10['emit'](_0x59823f,_0x3224f4);};}function removeListener(_0x49d502,_0x382aa0){return function(){FaxAccountEvents[_0x7f63('0x2')](_0x49d502,_0x382aa0);};}exports[_0x7f63('0x3')]=function(_0x54b93f){for(var _0x40bb42=0x0,_0x13b307=events[_0x7f63('0x4')];_0x40bb42<_0x13b307;_0x40bb42++){var _0x366884=events[_0x40bb42];var _0x1d435f=createListener(_0x7f63('0x5')+_0x366884,_0x54b93f);FaxAccountEvents['on'](_0x366884,_0x1d435f);}}; \ No newline at end of file +var _0xd1c3=['removeListener','register','faxAccount:','./faxAccount.events','save','remove'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd1c3,0x13b));var _0x3d1c=function(_0x554126,_0x88b33f){_0x554126=_0x554126-0x0;var _0x4cca3b=_0xd1c3[_0x554126];return _0x4cca3b;};'use strict';var FaxAccountEvents=require(_0x3d1c('0x0'));var events=[_0x3d1c('0x1'),_0x3d1c('0x2'),'update'];function createListener(_0xb34299,_0x5baa02){return function(_0x25e864){_0x5baa02['emit'](_0xb34299,_0x25e864);};}function removeListener(_0x354572,_0x5d8d29){return function(){FaxAccountEvents[_0x3d1c('0x3')](_0x354572,_0x5d8d29);};}exports[_0x3d1c('0x4')]=function(_0x18c923){for(var _0x435fdf=0x0,_0x44d9a9=events['length'];_0x435fdf<_0x44d9a9;_0x435fdf++){var _0x174041=events[_0x435fdf];var _0x4db160=createListener(_0x3d1c('0x5')+_0x174041,_0x18c923);FaxAccountEvents['on'](_0x174041,_0x4db160);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index fd93266..b5f8a36 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fbc=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x8fc548,_0x1caf99){var _0x23f125=function(_0x3ee82a){while(--_0x3ee82a){_0x8fc548['push'](_0x8fc548['shift']());}};_0x23f125(++_0x1caf99);}(_0x1fbc,0x15a));var _0xc1fb=function(_0x1047f7,_0x4c885e){_0x1047f7=_0x1047f7-0x0;var _0xea299e=_0x1fbc[_0x1047f7];return _0xea299e;};'use strict';var multer=require('multer');var util=require(_0xc1fb('0x0'));var path=require(_0xc1fb('0x1'));var timeout=require(_0xc1fb('0x2'));var express=require(_0xc1fb('0x3'));var router=express[_0xc1fb('0x4')]();var fs_extra=require(_0xc1fb('0x5'));var auth=require(_0xc1fb('0x6'));var interaction=require(_0xc1fb('0x7'));var config=require(_0xc1fb('0x8'));var controller=require('./faxAccount.controller');router[_0xc1fb('0x9')]('/',auth[_0xc1fb('0xa')](),controller[_0xc1fb('0xb')]);router['get'](_0xc1fb('0xc'),auth[_0xc1fb('0xa')](),controller[_0xc1fb('0xd')]);router[_0xc1fb('0x9')](_0xc1fb('0xe'),auth[_0xc1fb('0xa')](),controller[_0xc1fb('0xf')]);router[_0xc1fb('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc1fb('0x10')]);router[_0xc1fb('0x9')](_0xc1fb('0x11'),auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x12')]);router[_0xc1fb('0x9')](_0xc1fb('0x13'),auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x14')]);router['get'](_0xc1fb('0x15'),auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x16')]);router['get']('/:id/messages',auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x17')]);router[_0xc1fb('0x9')](_0xc1fb('0x18'),auth[_0xc1fb('0xa')](),controller['getAgents']);router[_0xc1fb('0x19')]('/',auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x1a')]);router[_0xc1fb('0x19')](_0xc1fb('0x1b'),auth['isAuthenticated'](),controller[_0xc1fb('0x1c')]);router[_0xc1fb('0x19')](_0xc1fb('0x11'),auth['isAuthenticated'](),controller[_0xc1fb('0x1d')]);router[_0xc1fb('0x19')](_0xc1fb('0x13'),auth['isAuthenticated'](),controller[_0xc1fb('0x1e')]);router['post']('/:id/applications',auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x1f')]);router[_0xc1fb('0x19')](_0xc1fb('0x20'),auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x21')]);router['post'](_0xc1fb('0x22'),auth['isAuthenticated'](),controller[_0xc1fb('0x23')]);router[_0xc1fb('0x19')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xc1fb('0x19')](_0xc1fb('0x18'),auth['isAuthenticated'](),controller[_0xc1fb('0x24')]);router['put'](_0xc1fb('0xe'),auth['isAuthenticated'](),controller[_0xc1fb('0x25')]);router[_0xc1fb('0x26')](_0xc1fb('0xe'),auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x27')]);router[_0xc1fb('0x26')](_0xc1fb('0x1b'),auth['isAuthenticated'](),controller[_0xc1fb('0x28')]);router[_0xc1fb('0x26')]('/:id/canned_answers',auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x29')]);router['delete'](_0xc1fb('0x18'),auth[_0xc1fb('0xa')](),controller[_0xc1fb('0x2a')]);module[_0xc1fb('0x2b')]=router; \ No newline at end of file +var _0x080c=['delete','/:id','destroy','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents'];(function(_0x32d955,_0xc82d82){var _0x219936=function(_0x2b0577){while(--_0x2b0577){_0x32d955['push'](_0x32d955['shift']());}};_0x219936(++_0xc82d82);}(_0x080c,0x74));var _0xc080=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x080c[_0x11e05d];return _0x335588;};'use strict';var multer=require(_0xc080('0x0'));var util=require('util');var path=require(_0xc080('0x1'));var timeout=require(_0xc080('0x2'));var express=require(_0xc080('0x3'));var router=express[_0xc080('0x4')]();var fs_extra=require(_0xc080('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xc080('0x6')]('/',auth[_0xc080('0x7')](),controller[_0xc080('0x8')]);router[_0xc080('0x6')](_0xc080('0x9'),auth[_0xc080('0x7')](),controller[_0xc080('0xa')]);router[_0xc080('0x6')]('/:id',auth[_0xc080('0x7')](),controller[_0xc080('0xb')]);router[_0xc080('0x6')](_0xc080('0xc'),auth[_0xc080('0x7')](),controller[_0xc080('0xd')]);router[_0xc080('0x6')](_0xc080('0xe'),auth[_0xc080('0x7')](),controller[_0xc080('0xf')]);router[_0xc080('0x6')](_0xc080('0x10'),auth[_0xc080('0x7')](),controller[_0xc080('0x11')]);router[_0xc080('0x6')](_0xc080('0x12'),auth[_0xc080('0x7')](),controller['getApplications']);router[_0xc080('0x6')](_0xc080('0x13'),auth[_0xc080('0x7')](),controller['getMessages']);router[_0xc080('0x6')](_0xc080('0x14'),auth[_0xc080('0x7')](),controller[_0xc080('0x15')]);router[_0xc080('0x16')]('/',auth[_0xc080('0x7')](),controller['create']);router[_0xc080('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc080('0x17')]);router[_0xc080('0x16')](_0xc080('0xe'),auth[_0xc080('0x7')](),controller[_0xc080('0x18')]);router['post'](_0xc080('0x10'),auth[_0xc080('0x7')](),controller[_0xc080('0x19')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xc080('0x1a')]);router[_0xc080('0x16')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0xc080('0x1b')]);router[_0xc080('0x16')](_0xc080('0x1c'),auth[_0xc080('0x7')](),controller['updateAccountApplications']);router['post'](_0xc080('0x1d'),auth[_0xc080('0x7')](),controller[_0xc080('0x1e')]);router[_0xc080('0x16')](_0xc080('0x14'),auth[_0xc080('0x7')](),controller[_0xc080('0x1f')]);router['put']('/:id',auth[_0xc080('0x7')](),controller['update']);router[_0xc080('0x20')](_0xc080('0x21'),auth['isAuthenticated'](),controller[_0xc080('0x22')]);router[_0xc080('0x20')](_0xc080('0xc'),auth['isAuthenticated'](),controller[_0xc080('0x23')]);router[_0xc080('0x20')](_0xc080('0xe'),auth[_0xc080('0x7')](),controller[_0xc080('0x24')]);router['delete'](_0xc080('0x14'),auth[_0xc080('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index fb8ecc3..228224a 100644 --- a/server/api/faxApplication/faxApplication.attributes.js +++ b/server/api/faxApplication/faxApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cc7=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x8747ca,_0x110e4f){var _0x3ded44=function(_0xab8054){while(--_0xab8054){_0x8747ca['push'](_0x8747ca['shift']());}};_0x3ded44(++_0x110e4f);}(_0x5cc7,0x1a4));var _0x75cc=function(_0x3405d2,_0x36b60b){_0x3405d2=_0x3405d2-0x0;var _0xdf1ecb=_0x5cc7[_0x3405d2];return _0xdf1ecb;};'use strict';var Sequelize=require(_0x75cc('0x0'));module[_0x75cc('0x1')]={'priority':{'type':Sequelize[_0x75cc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x75cc('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x75cc('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x75cc('0x3')],'defaultValue':_0x75cc('0x5')}}; \ No newline at end of file +var _0x63f0=['noop','sequelize','exports','STRING'];(function(_0xd8d422,_0x2a29cb){var _0x554af6=function(_0x4f5385){while(--_0x4f5385){_0xd8d422['push'](_0xd8d422['shift']());}};_0x554af6(++_0x2a29cb);}(_0x63f0,0xbd));var _0x063f=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x63f0[_0x75f869];return _0x10af8b;};'use strict';var Sequelize=require(_0x063f('0x0'));module[_0x063f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x063f('0x2')],'allowNull':![],'defaultValue':_0x063f('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x063f('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5db569b..e0f25b8 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x857b=['nolimit','sort','where','pick','merge','VIRTUAL','filter','options','FaxApplication','includeAll','include','rows','catch','show','params','keys','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','destroy','then','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','fields','model','hasOwnProperty'];(function(_0x2341ad,_0x5240e2){var _0x15a760=function(_0x35f908){while(--_0x35f908){_0x2341ad['push'](_0x2341ad['shift']());}};_0x15a760(++_0x5240e2);}(_0x857b,0x134));var _0xb857=function(_0x1c0a4f,_0x4db92c){_0x1c0a4f=_0x1c0a4f-0x0;var _0x5678bd=_0x857b[_0x1c0a4f];return _0x5678bd;};'use strict';var emlformat=require(_0xb857('0x0'));var rimraf=require(_0xb857('0x1'));var zipdir=require(_0xb857('0x2'));var jsonpatch=require(_0xb857('0x3'));var rp=require('request-promise');var moment=require(_0xb857('0x4'));var BPromise=require(_0xb857('0x5'));var Mustache=require(_0xb857('0x6'));var util=require(_0xb857('0x7'));var path=require(_0xb857('0x8'));var sox=require(_0xb857('0x9'));var csv=require(_0xb857('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb857('0xb'));var _=require('lodash');var squel=require(_0xb857('0xc'));var crypto=require(_0xb857('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb857('0xe'));var Papa=require(_0xb857('0xf'));var Redis=require(_0xb857('0x10'));var authService=require(_0xb857('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb857('0x12'));var hardwareService=require(_0xb857('0x13'));var logger=require(_0xb857('0x14'))(_0xb857('0x15'));var utils=require('../../config/utils');var config=require(_0xb857('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb857('0x17'))['db'];function respondWithStatusCode(_0x494795,_0x1c2589){_0x1c2589=_0x1c2589||0xcc;return function(_0x432c5f){if(_0x432c5f){return _0x494795[_0xb857('0x18')](_0x1c2589);}return _0x494795[_0xb857('0x19')](_0x1c2589)[_0xb857('0x1a')]();};}function respondWithResult(_0x51a123,_0x39990c){_0x39990c=_0x39990c||0xc8;return function(_0x4eb038){if(_0x4eb038){return _0x51a123[_0xb857('0x19')](_0x39990c)['json'](_0x4eb038);}};}function respondWithFilteredResult(_0x3b332d,_0xabf18b){return function(_0x317d12){if(_0x317d12){var _0x133626=typeof _0xabf18b[_0xb857('0x1b')]===_0xb857('0x1c')&&typeof _0xabf18b[_0xb857('0x1d')]==='undefined';var _0x16640d=_0x317d12[_0xb857('0x1e')];var _0x14e884=_0x133626?0x0:_0xabf18b['offset'];var _0xa60dd6=_0x133626?_0x317d12['count']:_0xabf18b['offset']+_0xabf18b[_0xb857('0x1d')];var _0x1d0632;if(_0xa60dd6>=_0x16640d){_0xa60dd6=_0x16640d;_0x1d0632=0xc8;}else{_0x1d0632=0xce;}_0x3b332d[_0xb857('0x19')](_0x1d0632);return _0x3b332d['set']('Content-Range',_0x14e884+'-'+_0xa60dd6+'/'+_0x16640d)[_0xb857('0x1f')](_0x317d12);}return null;};}function patchUpdates(_0x4c37cb){return function(_0x2c7204){try{jsonpatch[_0xb857('0x20')](_0x2c7204,_0x4c37cb,!![]);}catch(_0x38cbd3){return BPromise[_0xb857('0x21')](_0x38cbd3);}return _0x2c7204[_0xb857('0x22')]();};}function saveUpdates(_0x2745a6,_0x1847cc){return function(_0x61dacc){if(_0x61dacc){return _0x61dacc['update'](_0x2745a6)['then'](function(_0x526dd0){return _0x526dd0;});}return null;};}function removeEntity(_0x2d1cc9,_0x3f4075){return function(_0x2de0c7){if(_0x2de0c7){return _0x2de0c7[_0xb857('0x23')]()[_0xb857('0x24')](function(){_0x2d1cc9[_0xb857('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0858,_0x44b5f){return function(_0x44f609){if(!_0x44f609){_0x1d0858['sendStatus'](0x194);}return _0x44f609;};}function handleError(_0x609f44,_0x406be3){_0x406be3=_0x406be3||0x1f4;return function(_0x4eeae7){logger['error'](_0x4eeae7['stack']);if(_0x4eeae7[_0xb857('0x25')]){delete _0x4eeae7[_0xb857('0x25')];}_0x609f44['status'](_0x406be3)[_0xb857('0x26')](_0x4eeae7);};}exports[_0xb857('0x27')]=function(_0x5ada20,_0x3d17c1){var _0x2a3a2e={},_0x18a9a2={},_0x3cb496={'count':0x0,'rows':[]};var _0x3ef733=_['map'](db['FaxApplication'][_0xb857('0x28')],function(_0x536eb3){return{'name':_0x536eb3[_0xb857('0x29')],'type':_0x536eb3[_0xb857('0x2a')][_0xb857('0x2b')]};});_0x18a9a2['model']=_[_0xb857('0x2c')](_0x3ef733,_0xb857('0x25'));_0x18a9a2['query']=_['keys'](_0x5ada20[_0xb857('0x2d')]);_0x18a9a2[_0xb857('0x2e')]=_[_0xb857('0x2f')](_0x18a9a2['model'],_0x18a9a2['query']);_0x2a3a2e[_0xb857('0x30')]=_['intersection'](_0x18a9a2['model'],qs[_0xb857('0x31')](_0x5ada20[_0xb857('0x2d')]['fields']));_0x2a3a2e[_0xb857('0x30')]=_0x2a3a2e[_0xb857('0x30')]['length']?_0x2a3a2e['attributes']:_0x18a9a2[_0xb857('0x32')];if(!_0x5ada20[_0xb857('0x2d')][_0xb857('0x33')](_0xb857('0x34'))){_0x2a3a2e['limit']=qs[_0xb857('0x1d')](_0x5ada20[_0xb857('0x2d')][_0xb857('0x1d')]);_0x2a3a2e[_0xb857('0x1b')]=qs['offset'](_0x5ada20['query'][_0xb857('0x1b')]);}_0x2a3a2e['order']=qs[_0xb857('0x35')](_0x5ada20['query']['sort']);_0x2a3a2e[_0xb857('0x36')]=qs['filters'](_[_0xb857('0x37')](_0x5ada20[_0xb857('0x2d')],_0x18a9a2[_0xb857('0x2e')]),_0x3ef733);if(_0x5ada20[_0xb857('0x2d')]['filter']){_0x2a3a2e['where']=_[_0xb857('0x38')](_0x2a3a2e[_0xb857('0x36')],{'$or':_[_0xb857('0x2c')](_0x3ef733,function(_0x2884d7){if(_0x2884d7['type']!==_0xb857('0x39')){var _0x226ad4={};_0x226ad4[_0x2884d7['name']]={'$like':'%'+_0x5ada20[_0xb857('0x2d')][_0xb857('0x3a')]+'%'};return _0x226ad4;}})});}_0x2a3a2e=_['merge']({},_0x2a3a2e,_0x5ada20[_0xb857('0x3b')]);var _0x458396={'where':_0x2a3a2e[_0xb857('0x36')]};return db[_0xb857('0x3c')][_0xb857('0x1e')](_0x458396)[_0xb857('0x24')](function(_0x314ce3){_0x3cb496[_0xb857('0x1e')]=_0x314ce3;if(_0x5ada20[_0xb857('0x2d')][_0xb857('0x3d')]){_0x2a3a2e[_0xb857('0x3e')]=[{'all':!![]}];}return db[_0xb857('0x3c')]['findAll'](_0x2a3a2e);})[_0xb857('0x24')](function(_0x5dd535){_0x3cb496[_0xb857('0x3f')]=_0x5dd535;return _0x3cb496;})[_0xb857('0x24')](respondWithFilteredResult(_0x3d17c1,_0x2a3a2e))[_0xb857('0x40')](handleError(_0x3d17c1,null));};exports[_0xb857('0x41')]=function(_0x28df45,_0x53b773){var _0x10859a={'raw':!![],'where':{'id':_0x28df45[_0xb857('0x42')]['id']}},_0x598eef={};_0x598eef[_0xb857('0x32')]=_[_0xb857('0x43')](db['FaxApplication'][_0xb857('0x28')]);_0x598eef[_0xb857('0x2d')]=_[_0xb857('0x43')](_0x28df45['query']);_0x598eef[_0xb857('0x2e')]=_['intersection'](_0x598eef[_0xb857('0x32')],_0x598eef['query']);_0x10859a[_0xb857('0x30')]=_[_0xb857('0x2f')](_0x598eef[_0xb857('0x32')],qs['fields'](_0x28df45[_0xb857('0x2d')]['fields']));_0x10859a[_0xb857('0x30')]=_0x10859a[_0xb857('0x30')]['length']?_0x10859a[_0xb857('0x30')]:_0x598eef[_0xb857('0x32')];if(_0x28df45[_0xb857('0x2d')]['includeAll']){_0x10859a[_0xb857('0x3e')]=[{'all':!![]}];}_0x10859a=_[_0xb857('0x38')]({},_0x10859a,_0x28df45[_0xb857('0x3b')]);return db[_0xb857('0x3c')][_0xb857('0x44')](_0x10859a)[_0xb857('0x24')](handleEntityNotFound(_0x53b773,null))[_0xb857('0x24')](respondWithResult(_0x53b773,null))[_0xb857('0x40')](handleError(_0x53b773,null));};exports['create']=function(_0x562bc2,_0x2943dd){return db['FaxApplication'][_0xb857('0x45')](_0x562bc2['body'],{})['then'](respondWithResult(_0x2943dd,0xc9))['catch'](handleError(_0x2943dd,null));};exports[_0xb857('0x46')]=function(_0x1048b8,_0x321058){if(_0x1048b8[_0xb857('0x47')]['id']){delete _0x1048b8[_0xb857('0x47')]['id'];}return db['FaxApplication'][_0xb857('0x44')]({'where':{'id':_0x1048b8[_0xb857('0x42')]['id']}})[_0xb857('0x24')](handleEntityNotFound(_0x321058,null))[_0xb857('0x24')](saveUpdates(_0x1048b8['body'],null))['then'](respondWithResult(_0x321058,null))[_0xb857('0x40')](handleError(_0x321058,null));};exports[_0xb857('0x23')]=function(_0x1baa3a,_0x3ac22b){return db[_0xb857('0x3c')]['find']({'where':{'id':_0x1baa3a[_0xb857('0x42')]['id']}})['then'](handleEntityNotFound(_0x3ac22b,null))[_0xb857('0x24')](removeEntity(_0x3ac22b,null))['catch'](handleError(_0x3ac22b,null));}; \ No newline at end of file +var _0x4173=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x154621,_0x9e23a5){var _0x347062=function(_0x55ad71){while(--_0x55ad71){_0x154621['push'](_0x154621['shift']());}};_0x347062(++_0x9e23a5);}(_0x4173,0xda));var _0x3417=function(_0x2d6dc4,_0x5e2d29){_0x2d6dc4=_0x2d6dc4-0x0;var _0x52991e=_0x4173[_0x2d6dc4];return _0x52991e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3417('0x0'));var zipdir=require(_0x3417('0x1'));var jsonpatch=require(_0x3417('0x2'));var rp=require(_0x3417('0x3'));var moment=require(_0x3417('0x4'));var BPromise=require(_0x3417('0x5'));var Mustache=require(_0x3417('0x6'));var util=require(_0x3417('0x7'));var path=require(_0x3417('0x8'));var sox=require(_0x3417('0x9'));var csv=require(_0x3417('0xa'));var ejs=require(_0x3417('0xb'));var fs=require('fs');var fs_extra=require(_0x3417('0xc'));var _=require(_0x3417('0xd'));var squel=require('squel');var crypto=require(_0x3417('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3417('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3417('0xf'));var authService=require(_0x3417('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3417('0x11'));var logger=require(_0x3417('0x12'))(_0x3417('0x13'));var utils=require('../../config/utils');var config=require(_0x3417('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fb906,_0x192c25){_0x192c25=_0x192c25||0xcc;return function(_0x420ca4){if(_0x420ca4){return _0x1fb906['sendStatus'](_0x192c25);}return _0x1fb906[_0x3417('0x15')](_0x192c25)[_0x3417('0x16')]();};}function respondWithResult(_0x5e37f3,_0x4a2753){_0x4a2753=_0x4a2753||0xc8;return function(_0xc8aaad){if(_0xc8aaad){return _0x5e37f3[_0x3417('0x15')](_0x4a2753)[_0x3417('0x17')](_0xc8aaad);}};}function respondWithFilteredResult(_0x3192e2,_0x44ac52){return function(_0x1f6fd3){if(_0x1f6fd3){var _0x330cda=typeof _0x44ac52[_0x3417('0x18')]===_0x3417('0x19')&&typeof _0x44ac52[_0x3417('0x1a')]==='undefined';var _0x5ca69b=_0x1f6fd3['count'];var _0x39a0a9=_0x330cda?0x0:_0x44ac52[_0x3417('0x18')];var _0x317907=_0x330cda?_0x1f6fd3['count']:_0x44ac52[_0x3417('0x18')]+_0x44ac52['limit'];var _0x56c70d;if(_0x317907>=_0x5ca69b){_0x317907=_0x5ca69b;_0x56c70d=0xc8;}else{_0x56c70d=0xce;}_0x3192e2[_0x3417('0x15')](_0x56c70d);return _0x3192e2[_0x3417('0x1b')](_0x3417('0x1c'),_0x39a0a9+'-'+_0x317907+'/'+_0x5ca69b)[_0x3417('0x17')](_0x1f6fd3);}return null;};}function patchUpdates(_0x40a174){return function(_0x317009){try{jsonpatch[_0x3417('0x1d')](_0x317009,_0x40a174,!![]);}catch(_0x26b5ff){return BPromise[_0x3417('0x1e')](_0x26b5ff);}return _0x317009[_0x3417('0x1f')]();};}function saveUpdates(_0x3d82f5,_0x290b3f){return function(_0x57445c){if(_0x57445c){return _0x57445c['update'](_0x3d82f5)[_0x3417('0x20')](function(_0xef9579){return _0xef9579;});}return null;};}function removeEntity(_0x6c1809,_0x4a5941){return function(_0x1cfcdc){if(_0x1cfcdc){return _0x1cfcdc[_0x3417('0x21')]()['then'](function(){_0x6c1809[_0x3417('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230406,_0x1b6532){return function(_0x4ba401){if(!_0x4ba401){_0x230406[_0x3417('0x22')](0x194);}return _0x4ba401;};}function handleError(_0xe9b15c,_0x2873b0){_0x2873b0=_0x2873b0||0x1f4;return function(_0x5adff2){logger[_0x3417('0x23')](_0x5adff2['stack']);if(_0x5adff2[_0x3417('0x24')]){delete _0x5adff2[_0x3417('0x24')];}_0xe9b15c[_0x3417('0x15')](_0x2873b0)[_0x3417('0x25')](_0x5adff2);};}exports[_0x3417('0x26')]=function(_0xf57e5d,_0x2095e3){var _0x246fd4={},_0x885406={},_0x257550={'count':0x0,'rows':[]};var _0x4b0e2c=_[_0x3417('0x27')](db[_0x3417('0x28')][_0x3417('0x29')],function(_0x44eb07){return{'name':_0x44eb07[_0x3417('0x2a')],'type':_0x44eb07[_0x3417('0x2b')][_0x3417('0x2c')]};});_0x885406[_0x3417('0x2d')]=_[_0x3417('0x27')](_0x4b0e2c,_0x3417('0x24'));_0x885406['query']=_[_0x3417('0x2e')](_0xf57e5d[_0x3417('0x2f')]);_0x885406[_0x3417('0x30')]=_[_0x3417('0x31')](_0x885406['model'],_0x885406[_0x3417('0x2f')]);_0x246fd4[_0x3417('0x32')]=_[_0x3417('0x31')](_0x885406[_0x3417('0x2d')],qs[_0x3417('0x33')](_0xf57e5d[_0x3417('0x2f')][_0x3417('0x33')]));_0x246fd4[_0x3417('0x32')]=_0x246fd4['attributes'][_0x3417('0x34')]?_0x246fd4[_0x3417('0x32')]:_0x885406['model'];if(!_0xf57e5d['query'][_0x3417('0x35')](_0x3417('0x36'))){_0x246fd4[_0x3417('0x1a')]=qs[_0x3417('0x1a')](_0xf57e5d[_0x3417('0x2f')][_0x3417('0x1a')]);_0x246fd4['offset']=qs[_0x3417('0x18')](_0xf57e5d[_0x3417('0x2f')][_0x3417('0x18')]);}_0x246fd4[_0x3417('0x37')]=qs[_0x3417('0x38')](_0xf57e5d[_0x3417('0x2f')][_0x3417('0x38')]);_0x246fd4[_0x3417('0x39')]=qs[_0x3417('0x30')](_[_0x3417('0x3a')](_0xf57e5d[_0x3417('0x2f')],_0x885406['filters']),_0x4b0e2c);if(_0xf57e5d[_0x3417('0x2f')][_0x3417('0x3b')]){_0x246fd4[_0x3417('0x39')]=_[_0x3417('0x3c')](_0x246fd4[_0x3417('0x39')],{'$or':_[_0x3417('0x27')](_0x4b0e2c,function(_0x45425a){if(_0x45425a[_0x3417('0x2b')]!==_0x3417('0x3d')){var _0x17c9d2={};_0x17c9d2[_0x45425a[_0x3417('0x24')]]={'$like':'%'+_0xf57e5d[_0x3417('0x2f')]['filter']+'%'};return _0x17c9d2;}})});}_0x246fd4=_['merge']({},_0x246fd4,_0xf57e5d[_0x3417('0x3e')]);var _0x38df17={'where':_0x246fd4[_0x3417('0x39')]};return db[_0x3417('0x28')][_0x3417('0x3f')](_0x38df17)['then'](function(_0x2467f9){_0x257550[_0x3417('0x3f')]=_0x2467f9;if(_0xf57e5d['query'][_0x3417('0x40')]){_0x246fd4[_0x3417('0x41')]=[{'all':!![]}];}return db[_0x3417('0x28')][_0x3417('0x42')](_0x246fd4);})['then'](function(_0x3b0468){_0x257550[_0x3417('0x43')]=_0x3b0468;return _0x257550;})[_0x3417('0x20')](respondWithFilteredResult(_0x2095e3,_0x246fd4))[_0x3417('0x44')](handleError(_0x2095e3,null));};exports[_0x3417('0x45')]=function(_0x5e1df3,_0x6acc37){var _0x105571={'raw':!![],'where':{'id':_0x5e1df3[_0x3417('0x46')]['id']}},_0x3f1d39={};_0x3f1d39[_0x3417('0x2d')]=_[_0x3417('0x2e')](db[_0x3417('0x28')][_0x3417('0x29')]);_0x3f1d39[_0x3417('0x2f')]=_[_0x3417('0x2e')](_0x5e1df3[_0x3417('0x2f')]);_0x3f1d39[_0x3417('0x30')]=_[_0x3417('0x31')](_0x3f1d39['model'],_0x3f1d39[_0x3417('0x2f')]);_0x105571[_0x3417('0x32')]=_[_0x3417('0x31')](_0x3f1d39[_0x3417('0x2d')],qs[_0x3417('0x33')](_0x5e1df3[_0x3417('0x2f')][_0x3417('0x33')]));_0x105571[_0x3417('0x32')]=_0x105571[_0x3417('0x32')][_0x3417('0x34')]?_0x105571['attributes']:_0x3f1d39[_0x3417('0x2d')];if(_0x5e1df3[_0x3417('0x2f')][_0x3417('0x40')]){_0x105571['include']=[{'all':!![]}];}_0x105571=_[_0x3417('0x3c')]({},_0x105571,_0x5e1df3[_0x3417('0x3e')]);return db[_0x3417('0x28')][_0x3417('0x47')](_0x105571)[_0x3417('0x20')](handleEntityNotFound(_0x6acc37,null))[_0x3417('0x20')](respondWithResult(_0x6acc37,null))[_0x3417('0x44')](handleError(_0x6acc37,null));};exports[_0x3417('0x48')]=function(_0x166dbc,_0x3e3f08){return db['FaxApplication'][_0x3417('0x48')](_0x166dbc[_0x3417('0x49')],{})[_0x3417('0x20')](respondWithResult(_0x3e3f08,0xc9))[_0x3417('0x44')](handleError(_0x3e3f08,null));};exports[_0x3417('0x4a')]=function(_0x51b224,_0x12120a){if(_0x51b224[_0x3417('0x49')]['id']){delete _0x51b224[_0x3417('0x49')]['id'];}return db[_0x3417('0x28')]['find']({'where':{'id':_0x51b224[_0x3417('0x46')]['id']}})['then'](handleEntityNotFound(_0x12120a,null))[_0x3417('0x20')](saveUpdates(_0x51b224[_0x3417('0x49')],null))[_0x3417('0x20')](respondWithResult(_0x12120a,null))['catch'](handleError(_0x12120a,null));};exports[_0x3417('0x21')]=function(_0x48a352,_0x520986){return db[_0x3417('0x28')][_0x3417('0x47')]({'where':{'id':_0x48a352[_0x3417('0x46')]['id']}})[_0x3417('0x20')](handleEntityNotFound(_0x520986,null))[_0x3417('0x20')](removeEntity(_0x520986,null))[_0x3417('0x44')](handleError(_0x520986,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 07db5c9..2c51ad0 100644 --- a/server/api/faxApplication/faxApplication.model.js +++ b/server/api/faxApplication/faxApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x819d=['lodash','../../config/logger','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x22cb0f,_0x37c81a){var _0x51317f=function(_0x68e3b0){while(--_0x68e3b0){_0x22cb0f['push'](_0x22cb0f['shift']());}};_0x51317f(++_0x37c81a);}(_0x819d,0xd8));var _0xd819=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x819d[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xd819('0x0'));var util=require('util');var logger=require(_0xd819('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd819('0x2'));var rimraf=require('rimraf');var config=require(_0xd819('0x3'));var attributes=require(_0xd819('0x4'));module['exports']=function(_0x423b09,_0x4d7f23){return _0x423b09[_0xd819('0x5')](_0xd819('0x6'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd819('0x7'),'collate':_0xd819('0x8')});}; \ No newline at end of file +var _0x1556=['api','moment','bluebird','request-promise','path','../../config/environment','exports','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x1556,0x1c6));var _0x6155=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1556[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6155('0x0'));var util=require(_0x6155('0x1'));var logger=require('../../config/logger')(_0x6155('0x2'));var moment=require(_0x6155('0x3'));var BPromise=require(_0x6155('0x4'));var rp=require(_0x6155('0x5'));var fs=require('fs');var path=require(_0x6155('0x6'));var rimraf=require('rimraf');var config=require(_0x6155('0x7'));var attributes=require('./faxApplication.attributes');module[_0x6155('0x8')]=function(_0xfeddcf,_0x449297){return _0xfeddcf['define']('FaxApplication',attributes,{'tableName':_0x6155('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6155('0xa'),'collate':_0x6155('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 54374fc..1e34d6b 100644 --- a/server/api/faxApplication/faxApplication.rpc.js +++ b/server/api/faxApplication/faxApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20ef=['code','message','request\x20sent','result','catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x513a3e,_0xa7d9c5){var _0x2c8d04=function(_0xd47298){while(--_0xd47298){_0x513a3e['push'](_0x513a3e['shift']());}};_0x2c8d04(++_0xa7d9c5);}(_0x20ef,0xe6));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf20e('0x0'));var util=require(_0xf20e('0x1'));var moment=require(_0xf20e('0x2'));var BPromise=require(_0xf20e('0x3'));var rs=require(_0xf20e('0x4'));var fs=require('fs');var Redis=require(_0xf20e('0x5'));var db=require(_0xf20e('0x6'))['db'];var utils=require(_0xf20e('0x7'));var logger=require(_0xf20e('0x8'))(_0xf20e('0x9'));var config=require(_0xf20e('0xa'));var jayson=require(_0xf20e('0xb'));var client=jayson[_0xf20e('0xc')][_0xf20e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2c3e72,_0x61ffcc,_0x58817a){return new BPromise(function(_0x2d773f,_0x103798){return client[_0xf20e('0xe')](_0x2c3e72,_0x58817a)[_0xf20e('0xf')](function(_0x1a507b){logger[_0xf20e('0x10')](_0xf20e('0x11'),_0x61ffcc,'request\x20sent');logger[_0xf20e('0x12')](_0xf20e('0x13'),_0x61ffcc,'request\x20sent',JSON[_0xf20e('0x14')](_0x1a507b));if(_0x1a507b[_0xf20e('0x15')]){if(_0x1a507b['error'][_0xf20e('0x16')]===0x1f4){logger['error'](_0xf20e('0x11'),_0x61ffcc,_0x1a507b[_0xf20e('0x15')][_0xf20e('0x17')]);return _0x103798(_0x1a507b[_0xf20e('0x15')]['message']);}logger[_0xf20e('0x15')](_0xf20e('0x11'),_0x61ffcc,_0x1a507b['error'][_0xf20e('0x17')]);return _0x2d773f(_0x1a507b[_0xf20e('0x15')][_0xf20e('0x17')]);}else{logger[_0xf20e('0x10')](_0xf20e('0x11'),_0x61ffcc,_0xf20e('0x18'));_0x2d773f(_0x1a507b[_0xf20e('0x19')][_0xf20e('0x17')]);}})[_0xf20e('0x1a')](function(_0x2de831){logger[_0xf20e('0x15')](_0xf20e('0x11'),_0x61ffcc,_0x2de831);_0x103798(_0x2de831);});});}exports['UpdateFaxApplication']=function(_0x4f0f3b){var _0x36aa75=this;return new Promise(function(_0x5948af,_0x47e3a2){return db[_0xf20e('0x1b')][_0xf20e('0x1c')](_0x4f0f3b[_0xf20e('0x1d')],{'raw':_0x4f0f3b[_0xf20e('0x1e')]?_0x4f0f3b[_0xf20e('0x1e')][_0xf20e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0f3b['options']?_0x4f0f3b[_0xf20e('0x1e')][_0xf20e('0x20')]||null:null,'attributes':_0x4f0f3b['options']?_0x4f0f3b[_0xf20e('0x1e')][_0xf20e('0x21')]||null:null,'limit':_0x4f0f3b[_0xf20e('0x1e')]?_0x4f0f3b[_0xf20e('0x1e')][_0xf20e('0x22')]||null:null})['then'](function(_0x332ba2){logger[_0xf20e('0x10')]('UpdateFaxApplication',_0x4f0f3b);logger[_0xf20e('0x12')](_0xf20e('0x23'),_0x4f0f3b,JSON[_0xf20e('0x14')](_0x332ba2));_0x5948af(_0x332ba2);})[_0xf20e('0x1a')](function(_0x5caca7){logger['error'](_0xf20e('0x23'),_0x5caca7['message'],_0x4f0f3b);_0x47e3a2(_0x36aa75[_0xf20e('0x15')](0x1f4,_0x5caca7[_0xf20e('0x17')]));});});}; \ No newline at end of file +var _0x6a24=['update','body','options','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication'];(function(_0x35529b,_0x528262){var _0x4d58f7=function(_0x4b067c){while(--_0x4b067c){_0x35529b['push'](_0x35529b['shift']());}};_0x4d58f7(++_0x528262);}(_0x6a24,0x16d));var _0x46a2=function(_0x8a3ebd,_0x5123ef){_0x8a3ebd=_0x8a3ebd-0x0;var _0x28ae52=_0x6a24[_0x8a3ebd];return _0x28ae52;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require(_0x46a2('0x2'));var BPromise=require(_0x46a2('0x3'));var rs=require(_0x46a2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require(_0x46a2('0x7'))('rpc');var config=require(_0x46a2('0x8'));var jayson=require(_0x46a2('0x9'));var client=jayson['client'][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ffae2,_0x26187d,_0x167794){return new BPromise(function(_0x4a9a79,_0x25fb23){return client[_0x46a2('0xb')](_0x4ffae2,_0x167794)[_0x46a2('0xc')](function(_0x69e902){logger[_0x46a2('0xd')](_0x46a2('0xe'),_0x26187d,_0x46a2('0xf'));logger[_0x46a2('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x26187d,_0x46a2('0xf'),JSON[_0x46a2('0x11')](_0x69e902));if(_0x69e902[_0x46a2('0x12')]){if(_0x69e902[_0x46a2('0x12')][_0x46a2('0x13')]===0x1f4){logger[_0x46a2('0x12')]('FaxApplication,\x20%s,\x20%s',_0x26187d,_0x69e902['error'][_0x46a2('0x14')]);return _0x25fb23(_0x69e902[_0x46a2('0x12')][_0x46a2('0x14')]);}logger[_0x46a2('0x12')]('FaxApplication,\x20%s,\x20%s',_0x26187d,_0x69e902['error'][_0x46a2('0x14')]);return _0x4a9a79(_0x69e902['error'][_0x46a2('0x14')]);}else{logger[_0x46a2('0xd')](_0x46a2('0xe'),_0x26187d,'request\x20sent');_0x4a9a79(_0x69e902[_0x46a2('0x15')][_0x46a2('0x14')]);}})[_0x46a2('0x16')](function(_0x5895b1){logger[_0x46a2('0x12')](_0x46a2('0xe'),_0x26187d,_0x5895b1);_0x25fb23(_0x5895b1);});});}exports[_0x46a2('0x17')]=function(_0x3d859a){var _0x3cd722=this;return new Promise(function(_0x72b7fc,_0xa0b3a5){return db[_0x46a2('0x18')][_0x46a2('0x19')](_0x3d859a[_0x46a2('0x1a')],{'raw':_0x3d859a[_0x46a2('0x1b')]?_0x3d859a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d859a[_0x46a2('0x1b')]?_0x3d859a[_0x46a2('0x1b')]['where']||null:null,'attributes':_0x3d859a[_0x46a2('0x1b')]?_0x3d859a[_0x46a2('0x1b')][_0x46a2('0x1c')]||null:null,'limit':_0x3d859a[_0x46a2('0x1b')]?_0x3d859a[_0x46a2('0x1b')][_0x46a2('0x1d')]||null:null})[_0x46a2('0xc')](function(_0x24c5b4){logger[_0x46a2('0xd')](_0x46a2('0x17'),_0x3d859a);logger['debug']('UpdateFaxApplication',_0x3d859a,JSON['stringify'](_0x24c5b4));_0x72b7fc(_0x24c5b4);})[_0x46a2('0x16')](function(_0x35055e){logger[_0x46a2('0x12')](_0x46a2('0x17'),_0x35055e[_0x46a2('0x14')],_0x3d859a);_0xa0b3a5(_0x3cd722[_0x46a2('0x12')](0x1f4,_0x35055e[_0x46a2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7910200..6fe159f 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cb4=['get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated'];(function(_0x3d3fa6,_0x51b42c){var _0x101b02=function(_0x5d3d1c){while(--_0x5d3d1c){_0x3d3fa6['push'](_0x3d3fa6['shift']());}};_0x101b02(++_0x51b42c);}(_0x6cb4,0xff));var _0x46cb=function(_0x3fce45,_0x36b436){_0x3fce45=_0x3fce45-0x0;var _0x236471=_0x6cb4[_0x3fce45];return _0x236471;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xe')]('/',auth[_0x46cb('0xa')](),controller['create']);router[_0x46cb('0xf')](_0x46cb('0xc'),auth['isAuthenticated'](),controller[_0x46cb('0x10')]);router[_0x46cb('0x11')]('/:id',auth[_0x46cb('0xa')](),controller[_0x46cb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x59fb80,_0x38583c){var _0x51a3d8=function(_0x5d012f){while(--_0x5d012f){_0x59fb80['push'](_0x59fb80['shift']());}};_0x51a3d8(++_0x38583c);}(_0x34b7,0x196));var _0x734b=function(_0x5dea35,_0x4403ce){_0x5dea35=_0x5dea35-0x0;var _0x420537=_0x34b7[_0x5dea35];return _0x420537;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e259c99..5e41b6c 100644 --- a/server/api/faxInteraction/faxInteraction.attributes.js +++ b/server/api/faxInteraction/faxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['out','INTEGER','BOOLEAN','DATE','STRING','ENUM'];(function(_0xdb9db5,_0x16cb80){var _0x35c68f=function(_0x26117c){while(--_0x26117c){_0xdb9db5['push'](_0xdb9db5['shift']());}};_0x35c68f(++_0x16cb80);}(_0x524e,0x15e));var _0xe524=function(_0xdd20b1,_0x4ac882){_0xdd20b1=_0xdd20b1-0x0;var _0x3a12c7=_0x524e[_0xdd20b1];return _0x3a12c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xe524('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe524('0x1')]},'disposition':{'type':Sequelize[_0xe524('0x2')]},'secondDisposition':{'type':Sequelize[_0xe524('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe524('0x2')]},'note':{'type':Sequelize[_0xe524('0x2')]},'read1stAt':{'type':Sequelize[_0xe524('0x1')]},'fax':{'type':Sequelize[_0xe524('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xe524('0x3')]('in',_0xe524('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe524('0x3')]('in',_0xe524('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xe524('0x5')]}}; \ No newline at end of file +var _0x7096=['STRING','ENUM','out','INTEGER','exports','DATE'];(function(_0x2c81e7,_0x5a7ac5){var _0x401c2b=function(_0x25e42c){while(--_0x25e42c){_0x2c81e7['push'](_0x2c81e7['shift']());}};_0x401c2b(++_0x5a7ac5);}(_0x7096,0x10c));var _0x6709=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7096[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6709('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6709('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6709('0x2')]},'note':{'type':Sequelize[_0x6709('0x2')]},'read1stAt':{'type':Sequelize[_0x6709('0x1')]},'fax':{'type':Sequelize[_0x6709('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6709('0x3')]('in',_0x6709('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6709('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x6709('0x3')]('in',_0x6709('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x6709('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 45c1411..9fef45f 100644 --- a/server/api/faxInteraction/faxInteraction.controller.js +++ b/server/api/faxInteraction/faxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f5c=['redis','localhost','./faxInteraction.socket','register','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','sendStatus','error','stack','name','send','index','FaxInteraction','rawAttributes','getOptions','findAll','fax','catch','show','params','query','keys','filters','intersection','attributes','model','fields','length','includeAll','find','create','body','describe','addMessage','omit','ids','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','FaxMessage','addTags','Tag','color','faxInteractionTags:save','removeTags','download','toString','join','server','files','tmp','root','attachments','format','push','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','log','err','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb'];(function(_0x3a6032,_0x11a46c){var _0x134648=function(_0x52d31d){while(--_0x52d31d){_0x3a6032['push'](_0x3a6032['shift']());}};_0x134648(++_0x11a46c);}(_0x6f5c,0xbb));var _0xc6f5=function(_0x4b8e18,_0x3ba43b){_0x4b8e18=_0x4b8e18-0x0;var _0x59356c=_0x6f5c[_0x4b8e18];return _0x59356c;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc6f5('0x0'));var moment=require(_0xc6f5('0x1'));var BPromise=require(_0xc6f5('0x2'));var util=require(_0xc6f5('0x3'));var path=require(_0xc6f5('0x4'));var fs=require('fs');var _=require(_0xc6f5('0x5'));var Redis=require('ioredis');var interaction=require(_0xc6f5('0x6'));var qs=require(_0xc6f5('0x7'));var logger=require('../../config/logger')(_0xc6f5('0x8'));var config=require(_0xc6f5('0x9'));var db=require(_0xc6f5('0xa'))['db'];config[_0xc6f5('0xb')]=_['defaults'](config[_0xc6f5('0xb')],{'host':_0xc6f5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc6f5('0xd'))[_0xc6f5('0xe')](socket);function respondWithStatusCode(_0x5d4708,_0x2ff3f4){_0x2ff3f4=_0x2ff3f4||0xcc;return function(_0x45fb44){if(_0x45fb44){return _0x5d4708['sendStatus'](_0x2ff3f4);}return _0x5d4708['status'](_0x2ff3f4)[_0xc6f5('0xf')]();};}function respondWithResult(_0xf5ea0e,_0x2a09f7){_0x2a09f7=_0x2a09f7||0xc8;return function(_0x558ead){if(_0x558ead){return _0xf5ea0e['status'](_0x2a09f7)[_0xc6f5('0x10')](_0x558ead);}};}function respondWithFilteredResult(_0x499b9a,_0x4263aa){return function(_0x6601dc){if(_0x6601dc){var _0x31d51=typeof _0x4263aa[_0xc6f5('0x11')]===_0xc6f5('0x12')&&typeof _0x4263aa[_0xc6f5('0x13')]===_0xc6f5('0x12');var _0x28a4db=_0x6601dc['count'];var _0x38b76c=_0x31d51?0x0:_0x4263aa[_0xc6f5('0x11')];var _0x328f01=_0x31d51?_0x6601dc[_0xc6f5('0x14')]:_0x4263aa[_0xc6f5('0x11')]+_0x4263aa[_0xc6f5('0x13')];var _0x509184;if(_0x328f01>=_0x28a4db){_0x328f01=_0x28a4db;_0x509184=0xc8;}else{_0x509184=0xce;}_0x499b9a['status'](_0x509184);return _0x499b9a[_0xc6f5('0x15')](_0xc6f5('0x16'),_0x38b76c+'-'+_0x328f01+'/'+_0x28a4db)['json'](_0x6601dc);}return null;};}function saveUpdates(_0x230745){return function(_0x40ac1d){if(_0x40ac1d){return _0x40ac1d[_0xc6f5('0x17')](_0x230745)[_0xc6f5('0x18')](function(_0x1acc5b){return _0x1acc5b;});}return null;};}function removeEntity(_0x225d1e){return function(_0x200a7b){if(_0x200a7b){return _0x200a7b[_0xc6f5('0x19')]()[_0xc6f5('0x18')](function(){_0x225d1e[_0xc6f5('0x1a')](0xcc)[_0xc6f5('0xf')]();});}};}function handleEntityNotFound(_0x57fe2a){return function(_0x5480f2){if(!_0x5480f2){_0x57fe2a[_0xc6f5('0x1b')](0x194);}return _0x5480f2;};}function handleError(_0x2ebea8,_0xc1da4f){_0xc1da4f=_0xc1da4f||0x1f4;return function(_0x1afe58){logger[_0xc6f5('0x1c')](_0x1afe58[_0xc6f5('0x1d')]);if(_0x1afe58[_0xc6f5('0x1e')]){delete _0x1afe58[_0xc6f5('0x1e')];}_0x2ebea8['status'](_0xc1da4f)[_0xc6f5('0x1f')](_0x1afe58);};}exports[_0xc6f5('0x20')]=function(_0x4f76f0,_0x483119){var _0x50c196={};var _0x4e989f=_['map'](db[_0xc6f5('0x21')][_0xc6f5('0x22')],function(_0x396c0a){return{'name':_0x396c0a['fieldName'],'type':_0x396c0a['type']['key']};});_0x50c196=qs[_0xc6f5('0x23')](_0x4e989f,_0x4f76f0);return interaction[_0xc6f5('0x24')](_0xc6f5('0x25'),_0x4f76f0['query'],_0x4f76f0['user'],_0x50c196,_0x4e989f)[_0xc6f5('0x18')](respondWithFilteredResult(_0x483119,_0x50c196))[_0xc6f5('0x26')](handleError(_0x483119,null));};exports[_0xc6f5('0x27')]=function(_0x12959b,_0x1ead6c){var _0x14bccd={'raw':![],'where':{'id':_0x12959b[_0xc6f5('0x28')]['id']}},_0x29af10={};_0x29af10['model']=_['keys'](db[_0xc6f5('0x21')]['rawAttributes']);_0x29af10[_0xc6f5('0x29')]=_[_0xc6f5('0x2a')](_0x12959b[_0xc6f5('0x29')]);_0x29af10[_0xc6f5('0x2b')]=_[_0xc6f5('0x2c')](_0x29af10['model'],_0x29af10[_0xc6f5('0x29')]);_0x14bccd[_0xc6f5('0x2d')]=_['intersection'](_0x29af10[_0xc6f5('0x2e')],qs['fields'](_0x12959b['query'][_0xc6f5('0x2f')]));_0x14bccd[_0xc6f5('0x2d')]=_0x14bccd['attributes'][_0xc6f5('0x30')]?_0x14bccd[_0xc6f5('0x2d')]:_0x29af10[_0xc6f5('0x2e')];if(_0x12959b[_0xc6f5('0x29')][_0xc6f5('0x31')]){_0x14bccd['include']=[{'all':!![]}];}_0x14bccd=_['merge']({},_0x14bccd,_0x12959b['options']);return db[_0xc6f5('0x21')][_0xc6f5('0x32')](_0x14bccd)[_0xc6f5('0x18')](handleEntityNotFound(_0x1ead6c,null))['then'](respondWithResult(_0x1ead6c,null))[_0xc6f5('0x26')](handleError(_0x1ead6c,null));};exports[_0xc6f5('0x33')]=function(_0x1dd91d,_0x119aa2){return db[_0xc6f5('0x21')][_0xc6f5('0x33')](_0x1dd91d[_0xc6f5('0x34')],{})['then'](respondWithResult(_0x119aa2,0xc9))[_0xc6f5('0x26')](handleError(_0x119aa2,null));};exports[_0xc6f5('0x17')]=function(_0x32fe27,_0xd56e78){if(_0x32fe27[_0xc6f5('0x34')]['id']){delete _0x32fe27[_0xc6f5('0x34')]['id'];}return db[_0xc6f5('0x21')][_0xc6f5('0x32')]({'where':{'id':_0x32fe27[_0xc6f5('0x28')]['id']}})[_0xc6f5('0x18')](handleEntityNotFound(_0xd56e78,null))[_0xc6f5('0x18')](saveUpdates(_0x32fe27[_0xc6f5('0x34')],null))[_0xc6f5('0x18')](respondWithResult(_0xd56e78,null))[_0xc6f5('0x26')](handleError(_0xd56e78,null));};exports[_0xc6f5('0x19')]=function(_0xc04fdc,_0x330c0d){return db[_0xc6f5('0x21')][_0xc6f5('0x32')]({'where':{'id':_0xc04fdc[_0xc6f5('0x28')]['id']}})[_0xc6f5('0x18')](handleEntityNotFound(_0x330c0d,null))[_0xc6f5('0x18')](removeEntity(_0x330c0d,null))[_0xc6f5('0x26')](handleError(_0x330c0d,null));};exports[_0xc6f5('0x35')]=function(_0x5125fe,_0x59f3f8){return db[_0xc6f5('0x21')][_0xc6f5('0x35')]()[_0xc6f5('0x18')](respondWithResult(_0x59f3f8,null))['catch'](handleError(_0x59f3f8,null));};exports[_0xc6f5('0x36')]=function(_0x2a2e37,_0x4a9952){return db['FaxMessage'][_0xc6f5('0x32')]({'where':{'id':_0x2a2e37[_0xc6f5('0x28')]['id']}})[_0xc6f5('0x18')](handleEntityNotFound(_0x4a9952,null))[_0xc6f5('0x18')](function(_0x207865){if(_0x207865){return _0x207865[_0xc6f5('0x36')](_0x2a2e37['body']['ids'],_[_0xc6f5('0x37')](_0x2a2e37['body'],[_0xc6f5('0x38'),'id'])||{});}})['then'](respondWithResult(_0x4a9952,null))['catch'](handleError(_0x4a9952,null));};exports['getMessages']=function(_0x593762,_0xc0823d){var _0x53f3bd={'raw':![],'where':{}};var _0x26e03c={};var _0x5e5ca1={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x593762[_0xc6f5('0x28')]['id']}})[_0xc6f5('0x18')](handleEntityNotFound(_0xc0823d,null))['then'](function(_0xb64053){if(_0xb64053){_0x26e03c[_0xc6f5('0x2e')]=_[_0xc6f5('0x2a')](db['FaxMessage'][_0xc6f5('0x22')]);_0x26e03c[_0xc6f5('0x29')]=_['keys'](_0x593762[_0xc6f5('0x29')]);_0x26e03c[_0xc6f5('0x2b')]=_['intersection'](_0x26e03c[_0xc6f5('0x2e')],_0x26e03c[_0xc6f5('0x29')]);_0x53f3bd[_0xc6f5('0x2d')]=_[_0xc6f5('0x2c')](_0x26e03c[_0xc6f5('0x2e')],qs[_0xc6f5('0x2f')](_0x593762[_0xc6f5('0x29')][_0xc6f5('0x2f')]));_0x53f3bd[_0xc6f5('0x2d')]=_0x53f3bd[_0xc6f5('0x2d')][_0xc6f5('0x30')]?_0x53f3bd['attributes']:_0x26e03c[_0xc6f5('0x2e')];if(!_0x593762[_0xc6f5('0x29')][_0xc6f5('0x39')](_0xc6f5('0x3a'))){_0x53f3bd[_0xc6f5('0x13')]=qs['limit'](_0x593762[_0xc6f5('0x29')][_0xc6f5('0x13')]);_0x53f3bd[_0xc6f5('0x11')]=qs[_0xc6f5('0x11')](_0x593762[_0xc6f5('0x29')][_0xc6f5('0x11')]);}_0x53f3bd[_0xc6f5('0x3b')]=qs['sort'](_0x593762[_0xc6f5('0x29')][_0xc6f5('0x3c')]);_0x53f3bd[_0xc6f5('0x3d')]=qs[_0xc6f5('0x2b')](_[_0xc6f5('0x3e')](_0x593762[_0xc6f5('0x29')],_0x26e03c[_0xc6f5('0x2b')]));_0x53f3bd[_0xc6f5('0x3d')][_0xc6f5('0x3f')]=_0xb64053['id'];if(_0x593762[_0xc6f5('0x29')][_0xc6f5('0x40')]){_0x53f3bd[_0xc6f5('0x3d')]=_[_0xc6f5('0x41')](_0x53f3bd[_0xc6f5('0x3d')],{'$or':_[_0xc6f5('0x42')](_0x53f3bd[_0xc6f5('0x2d')],function(_0x4bdfa9){var _0x64d760={};_0x64d760[_0x4bdfa9]={'$like':'%'+_0x593762[_0xc6f5('0x29')][_0xc6f5('0x40')]+'%'};return _0x64d760;})});}if(_0x593762[_0xc6f5('0x29')]['$gte']){var _0x22717f=_0x593762[_0xc6f5('0x29')][_0xc6f5('0x43')][_0xc6f5('0x44')](',');var _0xcd9b99={};_0xcd9b99[_0x22717f[0x0]]={'$gte':moment(_0x22717f[0x1])['format'](_0xc6f5('0x45'))};_0x53f3bd[_0xc6f5('0x3d')]=_[_0xc6f5('0x41')](_0x53f3bd[_0xc6f5('0x3d')],_0xcd9b99);}_0x53f3bd=_[_0xc6f5('0x41')]({},_0x53f3bd,_0x593762[_0xc6f5('0x46')]);return db['FaxMessage'][_0xc6f5('0x14')]({'where':_0x53f3bd[_0xc6f5('0x3d')]})['then'](function(_0x3a7c3a){_0x5e5ca1[_0xc6f5('0x14')]=_0x3a7c3a;if(_0x593762[_0xc6f5('0x29')]['includeAll']){_0x53f3bd['include']=[{'all':!![]}];}return db[_0xc6f5('0x47')]['findAll'](_0x53f3bd);})[_0xc6f5('0x18')](function(_0x6e18cf){_0x5e5ca1['rows']=_0x6e18cf;return _0x5e5ca1;});}})[_0xc6f5('0x18')](respondWithFilteredResult(_0xc0823d,_0x53f3bd))[_0xc6f5('0x26')](handleError(_0xc0823d,null));};exports[_0xc6f5('0x48')]=function(_0x196997,_0x199249){return db['FaxInteraction'][_0xc6f5('0x32')]({'where':{'id':_0x196997[_0xc6f5('0x28')]['id']}})['then'](handleEntityNotFound(_0x199249,null))[_0xc6f5('0x18')](function(_0x29a9e6){if(_0x29a9e6){return _0x29a9e6['setTags'](_0x196997[_0xc6f5('0x34')][_0xc6f5('0x38')],_['omit'](_0x196997['body'],[_0xc6f5('0x38'),'id'])||{})['spread'](function(){return db[_0xc6f5('0x49')]['findAll']({'attributes':['id','name',_0xc6f5('0x4a')],'where':{'id':_0x196997['body']['ids']}});})[_0xc6f5('0x18')](function(_0x35c680){socket['emit'](_0xc6f5('0x4b'),{'id':Number(_0x196997[_0xc6f5('0x28')]['id']),'tags':_0x35c680||[]});return{'id':Number(_0x196997[_0xc6f5('0x28')]['id']),'tags':_0x35c680||[]};});}})['then'](respondWithResult(_0x199249,null))[_0xc6f5('0x26')](handleError(_0x199249,null));};exports[_0xc6f5('0x4c')]=function(_0x23eb18,_0xd39192){return db[_0xc6f5('0x21')][_0xc6f5('0x32')]({'where':{'id':_0x23eb18[_0xc6f5('0x28')]['id']}})[_0xc6f5('0x18')](handleEntityNotFound(_0xd39192,null))[_0xc6f5('0x18')](function(_0x4b7e91){if(_0x4b7e91){return _0x4b7e91['removeTags'](_0x23eb18[_0xc6f5('0x29')][_0xc6f5('0x38')]);}})[_0xc6f5('0x18')](respondWithStatusCode(_0xd39192,null))[_0xc6f5('0x26')](handleError(_0xd39192,null));};exports[_0xc6f5('0x4d')]=function(_0x2a48e8,_0x30e250){var _0x393b98=moment()['unix']()[_0xc6f5('0x4e')]();var _0x10223b=path[_0xc6f5('0x4f')](config['root'],_0xc6f5('0x50'),_0xc6f5('0x51'),_0xc6f5('0x52'));var _0x376dda=path['join'](config[_0xc6f5('0x53')],_0xc6f5('0x50'),_0xc6f5('0x51'),_0xc6f5('0x54'));var _0x267827=path['join'](_0x10223b,_0x393b98);var _0x377ea2=util[_0xc6f5('0x55')]('transcript-%d-%s.zip',_0x2a48e8[_0xc6f5('0x28')]['id'],_0x393b98);var _0xe3493b=path[_0xc6f5('0x4f')](_0x10223b,_0x377ea2);var _0x17ebd8=[];_0x17ebd8[_0xc6f5('0x56')]({'model':db[_0xc6f5('0x57')],'as':_0xc6f5('0x57'),'raw':!![]});var _0x52b6fb=[{'model':db[_0xc6f5('0x47')],'as':_0xc6f5('0x58'),'attributes':['id',_0xc6f5('0x34'),_0xc6f5('0x59')],'include':_0x17ebd8}];return db[_0xc6f5('0x21')]['find']({'where':{'id':_0x2a48e8[_0xc6f5('0x28')]['id']},'include':_0x52b6fb})['then'](handleEntityNotFound(_0x30e250,null))['then'](function(_0x953ad4){if(_0x953ad4&&_0x953ad4[_0xc6f5('0x58')]){var _0x59616c=_0x953ad4['get']({'plain':!![]});fs[_0xc6f5('0x5a')](_0x267827);for(var _0x50e345=0x0;_0x50e345<_0x59616c[_0xc6f5('0x58')][_0xc6f5('0x30')];_0x50e345++){var _0x483640=_0x59616c['Messages'][_0x50e345][_0xc6f5('0x57')];if(_0x483640){var _0x3ecd14=path[_0xc6f5('0x4f')](_0x376dda,_0x483640['basename']);if(fs[_0xc6f5('0x5b')](_0x3ecd14)){fs[_0xc6f5('0x5c')](_0x3ecd14)[_0xc6f5('0x5d')](fs[_0xc6f5('0x5e')](path['join'](_0x267827,_0x483640[_0xc6f5('0x5f')])));}}}return BPromise[_0xc6f5('0x60')]()['then'](function(){return new BPromise(function(_0x4bb7cb,_0x4488cb){zipdir(_0x267827,{'saveTo':_0xe3493b},function(_0x120da0,_0xe0cb0c){if(_0x120da0)return _0x4488cb(_0x120da0);return _0x4bb7cb(_0xe0cb0c);});})[_0xc6f5('0x18')](function(){return new BPromise(function(_0x44cb3a,_0x16def8){rimraf(_0x267827,function(_0x50aceb){if(_0x50aceb)_0x16def8(_0x50aceb);return _0x44cb3a();});});})[_0xc6f5('0x18')](function(){return _0x30e250[_0xc6f5('0x4d')](_0xe3493b,_0x377ea2,function(_0x24add7){if(_0x24add7){console[_0xc6f5('0x61')](_0xc6f5('0x62'),_0x24add7);}else{fs['unlinkSync'](_0xe3493b);}});});});}else{return _0x30e250[_0xc6f5('0x1b')](0xc8);}})['catch'](handleError(_0x30e250,null));}; \ No newline at end of file +var _0x6088=['model','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','omit','ids','getMessages','findOne','FaxMessage','filters','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','spread','Tag','color','emit','faxInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','pipe','resolve','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','update','end','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','user','then','params'];(function(_0x15a74d,_0x42217f){var _0x414fc6=function(_0x2b8ed7){while(--_0x2b8ed7){_0x15a74d['push'](_0x15a74d['shift']());}};_0x414fc6(++_0x42217f);}(_0x6088,0xa4));var _0x8608=function(_0x4c0e5f,_0x19c2a4){_0x4c0e5f=_0x4c0e5f-0x0;var _0x542170=_0x6088[_0x4c0e5f];return _0x542170;};'use strict';var rimraf=require(_0x8608('0x0'));var zipdir=require(_0x8608('0x1'));var moment=require('moment');var BPromise=require(_0x8608('0x2'));var util=require(_0x8608('0x3'));var path=require(_0x8608('0x4'));var fs=require('fs');var _=require(_0x8608('0x5'));var Redis=require(_0x8608('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x8608('0x7'));var logger=require(_0x8608('0x8'))(_0x8608('0x9'));var config=require(_0x8608('0xa'));var db=require('../../mysqldb')['db'];config[_0x8608('0xb')]=_[_0x8608('0xc')](config[_0x8608('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8608('0xd'))(new Redis(config['redis']));require(_0x8608('0xe'))[_0x8608('0xf')](socket);function respondWithStatusCode(_0x1ef791,_0x545399){_0x545399=_0x545399||0xcc;return function(_0x5bf2af){if(_0x5bf2af){return _0x1ef791['sendStatus'](_0x545399);}return _0x1ef791[_0x8608('0x10')](_0x545399)['end']();};}function respondWithResult(_0x125a9b,_0x463663){_0x463663=_0x463663||0xc8;return function(_0x16dee0){if(_0x16dee0){return _0x125a9b['status'](_0x463663)[_0x8608('0x11')](_0x16dee0);}};}function respondWithFilteredResult(_0xef93da,_0x2fdc1d){return function(_0x27ea71){if(_0x27ea71){var _0x1e285d=typeof _0x2fdc1d['offset']===_0x8608('0x12')&&typeof _0x2fdc1d[_0x8608('0x13')]===_0x8608('0x12');var _0x1cab35=_0x27ea71[_0x8608('0x14')];var _0x47e068=_0x1e285d?0x0:_0x2fdc1d[_0x8608('0x15')];var _0x5c3629=_0x1e285d?_0x27ea71['count']:_0x2fdc1d['offset']+_0x2fdc1d[_0x8608('0x13')];var _0x3b7dee;if(_0x5c3629>=_0x1cab35){_0x5c3629=_0x1cab35;_0x3b7dee=0xc8;}else{_0x3b7dee=0xce;}_0xef93da[_0x8608('0x10')](_0x3b7dee);return _0xef93da[_0x8608('0x16')](_0x8608('0x17'),_0x47e068+'-'+_0x5c3629+'/'+_0x1cab35)[_0x8608('0x11')](_0x27ea71);}return null;};}function saveUpdates(_0x55edbd){return function(_0x3dcc55){if(_0x3dcc55){return _0x3dcc55[_0x8608('0x18')](_0x55edbd)['then'](function(_0x8cf766){return _0x8cf766;});}return null;};}function removeEntity(_0x208bd0){return function(_0x42f857){if(_0x42f857){return _0x42f857['destroy']()['then'](function(){_0x208bd0[_0x8608('0x10')](0xcc)[_0x8608('0x19')]();});}};}function handleEntityNotFound(_0x39881e){return function(_0x578570){if(!_0x578570){_0x39881e['sendStatus'](0x194);}return _0x578570;};}function handleError(_0x25c2f7,_0xa50462){_0xa50462=_0xa50462||0x1f4;return function(_0x2d725f){logger[_0x8608('0x1a')](_0x2d725f[_0x8608('0x1b')]);if(_0x2d725f['name']){delete _0x2d725f[_0x8608('0x1c')];}_0x25c2f7[_0x8608('0x10')](_0xa50462)['send'](_0x2d725f);};}exports[_0x8608('0x1d')]=function(_0x59e57e,_0x450926){var _0x19e07e={};var _0x343b5d=_[_0x8608('0x1e')](db[_0x8608('0x1f')][_0x8608('0x20')],function(_0x5dd74a){return{'name':_0x5dd74a[_0x8608('0x21')],'type':_0x5dd74a[_0x8608('0x22')][_0x8608('0x23')]};});_0x19e07e=qs[_0x8608('0x24')](_0x343b5d,_0x59e57e);return interaction[_0x8608('0x25')](_0x8608('0x26'),_0x59e57e['query'],_0x59e57e[_0x8608('0x27')],_0x19e07e,_0x343b5d)[_0x8608('0x28')](respondWithFilteredResult(_0x450926,_0x19e07e))['catch'](handleError(_0x450926,null));};exports['show']=function(_0x2d6c1d,_0x27f746){var _0x111548={'raw':![],'where':{'id':_0x2d6c1d[_0x8608('0x29')]['id']}},_0x163ed3={};_0x163ed3[_0x8608('0x2a')]=_[_0x8608('0x2b')](db[_0x8608('0x1f')][_0x8608('0x20')]);_0x163ed3[_0x8608('0x2c')]=_[_0x8608('0x2b')](_0x2d6c1d[_0x8608('0x2c')]);_0x163ed3['filters']=_[_0x8608('0x2d')](_0x163ed3['model'],_0x163ed3[_0x8608('0x2c')]);_0x111548['attributes']=_['intersection'](_0x163ed3['model'],qs['fields'](_0x2d6c1d['query'][_0x8608('0x2e')]));_0x111548[_0x8608('0x2f')]=_0x111548[_0x8608('0x2f')][_0x8608('0x30')]?_0x111548['attributes']:_0x163ed3['model'];if(_0x2d6c1d['query'][_0x8608('0x31')]){_0x111548[_0x8608('0x32')]=[{'all':!![]}];}_0x111548=_[_0x8608('0x33')]({},_0x111548,_0x2d6c1d[_0x8608('0x34')]);return db[_0x8608('0x1f')][_0x8608('0x35')](_0x111548)[_0x8608('0x28')](handleEntityNotFound(_0x27f746,null))['then'](respondWithResult(_0x27f746,null))[_0x8608('0x36')](handleError(_0x27f746,null));};exports['create']=function(_0x51a0d4,_0x498eda){return db['FaxInteraction'][_0x8608('0x37')](_0x51a0d4['body'],{})[_0x8608('0x28')](respondWithResult(_0x498eda,0xc9))[_0x8608('0x36')](handleError(_0x498eda,null));};exports['update']=function(_0x5533ab,_0x199bfd){if(_0x5533ab[_0x8608('0x38')]['id']){delete _0x5533ab[_0x8608('0x38')]['id'];}return db[_0x8608('0x1f')]['find']({'where':{'id':_0x5533ab['params']['id']}})['then'](handleEntityNotFound(_0x199bfd,null))[_0x8608('0x28')](saveUpdates(_0x5533ab[_0x8608('0x38')],null))[_0x8608('0x28')](respondWithResult(_0x199bfd,null))[_0x8608('0x36')](handleError(_0x199bfd,null));};exports['destroy']=function(_0x556a0f,_0x4b04b6){return db[_0x8608('0x1f')][_0x8608('0x35')]({'where':{'id':_0x556a0f[_0x8608('0x29')]['id']}})[_0x8608('0x28')](handleEntityNotFound(_0x4b04b6,null))[_0x8608('0x28')](removeEntity(_0x4b04b6,null))[_0x8608('0x36')](handleError(_0x4b04b6,null));};exports[_0x8608('0x39')]=function(_0x2fdf49,_0x3c28e3){return db[_0x8608('0x1f')][_0x8608('0x39')]()[_0x8608('0x28')](respondWithResult(_0x3c28e3,null))[_0x8608('0x36')](handleError(_0x3c28e3,null));};exports[_0x8608('0x3a')]=function(_0x25669f,_0x1f8298){return db['FaxMessage'][_0x8608('0x35')]({'where':{'id':_0x25669f[_0x8608('0x29')]['id']}})[_0x8608('0x28')](handleEntityNotFound(_0x1f8298,null))['then'](function(_0x1b9ae5){if(_0x1b9ae5){return _0x1b9ae5[_0x8608('0x3a')](_0x25669f['body']['ids'],_[_0x8608('0x3b')](_0x25669f[_0x8608('0x38')],[_0x8608('0x3c'),'id'])||{});}})[_0x8608('0x28')](respondWithResult(_0x1f8298,null))['catch'](handleError(_0x1f8298,null));};exports[_0x8608('0x3d')]=function(_0x56ace4,_0x51860c){var _0xc82b35={'raw':![],'where':{}};var _0x3048ff={};var _0x1950a6={'count':0x0,'rows':[]};return db[_0x8608('0x1f')][_0x8608('0x3e')]({'where':{'id':_0x56ace4[_0x8608('0x29')]['id']}})[_0x8608('0x28')](handleEntityNotFound(_0x51860c,null))['then'](function(_0x40321d){if(_0x40321d){_0x3048ff['model']=_['keys'](db[_0x8608('0x3f')]['rawAttributes']);_0x3048ff[_0x8608('0x2c')]=_[_0x8608('0x2b')](_0x56ace4[_0x8608('0x2c')]);_0x3048ff[_0x8608('0x40')]=_[_0x8608('0x2d')](_0x3048ff[_0x8608('0x2a')],_0x3048ff[_0x8608('0x2c')]);_0xc82b35[_0x8608('0x2f')]=_['intersection'](_0x3048ff[_0x8608('0x2a')],qs[_0x8608('0x2e')](_0x56ace4[_0x8608('0x2c')][_0x8608('0x2e')]));_0xc82b35['attributes']=_0xc82b35[_0x8608('0x2f')][_0x8608('0x30')]?_0xc82b35[_0x8608('0x2f')]:_0x3048ff['model'];if(!_0x56ace4[_0x8608('0x2c')][_0x8608('0x41')](_0x8608('0x42'))){_0xc82b35[_0x8608('0x13')]=qs[_0x8608('0x13')](_0x56ace4[_0x8608('0x2c')][_0x8608('0x13')]);_0xc82b35[_0x8608('0x15')]=qs[_0x8608('0x15')](_0x56ace4['query'][_0x8608('0x15')]);}_0xc82b35[_0x8608('0x43')]=qs[_0x8608('0x44')](_0x56ace4['query'][_0x8608('0x44')]);_0xc82b35[_0x8608('0x45')]=qs[_0x8608('0x40')](_[_0x8608('0x46')](_0x56ace4[_0x8608('0x2c')],_0x3048ff[_0x8608('0x40')]));_0xc82b35[_0x8608('0x45')][_0x8608('0x47')]=_0x40321d['id'];if(_0x56ace4[_0x8608('0x2c')][_0x8608('0x48')]){_0xc82b35[_0x8608('0x45')]=_[_0x8608('0x33')](_0xc82b35[_0x8608('0x45')],{'$or':_[_0x8608('0x1e')](_0xc82b35[_0x8608('0x2f')],function(_0x54806b){var _0xdac69c={};_0xdac69c[_0x54806b]={'$like':'%'+_0x56ace4[_0x8608('0x2c')]['filter']+'%'};return _0xdac69c;})});}if(_0x56ace4[_0x8608('0x2c')][_0x8608('0x49')]){var _0x18f085=_0x56ace4[_0x8608('0x2c')][_0x8608('0x49')][_0x8608('0x4a')](',');var _0x53fbd3={};_0x53fbd3[_0x18f085[0x0]]={'$gte':moment(_0x18f085[0x1])['format'](_0x8608('0x4b'))};_0xc82b35[_0x8608('0x45')]=_[_0x8608('0x33')](_0xc82b35[_0x8608('0x45')],_0x53fbd3);}_0xc82b35=_['merge']({},_0xc82b35,_0x56ace4['options']);return db['FaxMessage'][_0x8608('0x14')]({'where':_0xc82b35['where']})[_0x8608('0x28')](function(_0x5ba671){_0x1950a6[_0x8608('0x14')]=_0x5ba671;if(_0x56ace4[_0x8608('0x2c')][_0x8608('0x31')]){_0xc82b35[_0x8608('0x32')]=[{'all':!![]}];}return db[_0x8608('0x3f')][_0x8608('0x25')](_0xc82b35);})[_0x8608('0x28')](function(_0x54a719){_0x1950a6[_0x8608('0x4c')]=_0x54a719;return _0x1950a6;});}})[_0x8608('0x28')](respondWithFilteredResult(_0x51860c,_0xc82b35))[_0x8608('0x36')](handleError(_0x51860c,null));};exports['addTags']=function(_0x375b56,_0x3c3d0f){return db[_0x8608('0x1f')][_0x8608('0x35')]({'where':{'id':_0x375b56['params']['id']}})['then'](handleEntityNotFound(_0x3c3d0f,null))[_0x8608('0x28')](function(_0xc7a2e6){if(_0xc7a2e6){return _0xc7a2e6['setTags'](_0x375b56[_0x8608('0x38')][_0x8608('0x3c')],_[_0x8608('0x3b')](_0x375b56[_0x8608('0x38')],[_0x8608('0x3c'),'id'])||{})[_0x8608('0x4d')](function(){return db[_0x8608('0x4e')]['findAll']({'attributes':['id',_0x8608('0x1c'),_0x8608('0x4f')],'where':{'id':_0x375b56[_0x8608('0x38')][_0x8608('0x3c')]}});})['then'](function(_0x457205){socket[_0x8608('0x50')](_0x8608('0x51'),{'id':Number(_0x375b56[_0x8608('0x29')]['id']),'tags':_0x457205||[]});return{'id':Number(_0x375b56[_0x8608('0x29')]['id']),'tags':_0x457205||[]};});}})[_0x8608('0x28')](respondWithResult(_0x3c3d0f,null))['catch'](handleError(_0x3c3d0f,null));};exports['removeTags']=function(_0x523544,_0x2a15e2){return db[_0x8608('0x1f')][_0x8608('0x35')]({'where':{'id':_0x523544[_0x8608('0x29')]['id']}})['then'](handleEntityNotFound(_0x2a15e2,null))[_0x8608('0x28')](function(_0xf9edf3){if(_0xf9edf3){return _0xf9edf3[_0x8608('0x52')](_0x523544['query'][_0x8608('0x3c')]);}})[_0x8608('0x28')](respondWithStatusCode(_0x2a15e2,null))[_0x8608('0x36')](handleError(_0x2a15e2,null));};exports['download']=function(_0x137156,_0x380e95){var _0x32ad7a=moment()[_0x8608('0x53')]()[_0x8608('0x54')]();var _0x388526=path[_0x8608('0x55')](config[_0x8608('0x56')],_0x8608('0x57'),'files',_0x8608('0x58'));var _0x23eb90=path[_0x8608('0x55')](config[_0x8608('0x56')],'server',_0x8608('0x59'),_0x8608('0x5a'));var _0xc69c11=path[_0x8608('0x55')](_0x388526,_0x32ad7a);var _0x4af88d=util[_0x8608('0x5b')](_0x8608('0x5c'),_0x137156[_0x8608('0x29')]['id'],_0x32ad7a);var _0x4022aa=path[_0x8608('0x55')](_0x388526,_0x4af88d);var _0x5870a7=[];_0x5870a7[_0x8608('0x5d')]({'model':db['Attachment'],'as':_0x8608('0x5e'),'raw':!![]});var _0x30e516=[{'model':db[_0x8608('0x3f')],'as':'Messages','attributes':['id',_0x8608('0x38'),'createdAt'],'include':_0x5870a7}];return db['FaxInteraction'][_0x8608('0x35')]({'where':{'id':_0x137156[_0x8608('0x29')]['id']},'include':_0x30e516})[_0x8608('0x28')](handleEntityNotFound(_0x380e95,null))[_0x8608('0x28')](function(_0x45a110){if(_0x45a110&&_0x45a110[_0x8608('0x5f')]){var _0x4f12c9=_0x45a110[_0x8608('0x60')]({'plain':!![]});fs[_0x8608('0x61')](_0xc69c11);for(var _0x513e44=0x0;_0x513e44<_0x4f12c9['Messages'][_0x8608('0x30')];_0x513e44++){var _0xb7abd5=_0x4f12c9[_0x8608('0x5f')][_0x513e44][_0x8608('0x5e')];if(_0xb7abd5){var _0x52812b=path[_0x8608('0x55')](_0x23eb90,_0xb7abd5[_0x8608('0x62')]);if(fs['existsSync'](_0x52812b)){fs['createReadStream'](_0x52812b)[_0x8608('0x63')](fs['createWriteStream'](path[_0x8608('0x55')](_0xc69c11,_0xb7abd5[_0x8608('0x62')])));}}}return BPromise[_0x8608('0x64')]()[_0x8608('0x28')](function(){return new BPromise(function(_0x2ab1e5,_0x28a661){zipdir(_0xc69c11,{'saveTo':_0x4022aa},function(_0x2015b8,_0x15acb3){if(_0x2015b8)return _0x28a661(_0x2015b8);return _0x2ab1e5(_0x15acb3);});})[_0x8608('0x28')](function(){return new BPromise(function(_0x15949d,_0x34a38c){rimraf(_0xc69c11,function(_0x5c3650){if(_0x5c3650)_0x34a38c(_0x5c3650);return _0x15949d();});});})[_0x8608('0x28')](function(){return _0x380e95['download'](_0x4022aa,_0x4af88d,function(_0x3af561){if(_0x3af561){console['log'](_0x8608('0x65'),_0x3af561);}else{fs[_0x8608('0x66')](_0x4022aa);}});});});}else{return _0x380e95['sendStatus'](0xc8);}})[_0x8608('0x36')](handleError(_0x380e95,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 5409410..054e46c 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x033c=['length','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','save','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages'];(function(_0x5aed5d,_0x26ee01){var _0x4f5949=function(_0x154c81){while(--_0x154c81){_0x5aed5d['push'](_0x5aed5d['shift']());}};_0x4f5949(++_0x26ee01);}(_0x033c,0x195));var _0xc033=function(_0x3ce63a,_0x4e0b54){_0x3ce63a=_0x3ce63a-0x0;var _0x3570b8=_0x033c[_0x3ce63a];return _0x3570b8;};'use strict';var EventEmitter=require(_0xc033('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xc033('0x1')];var FaxMessage=require(_0xc033('0x2'))['db'][_0xc033('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc033('0x4'),'afterUpdate':'update','afterDestroy':_0xc033('0x5')};function emitEvent(_0x89928e){return function(_0x272c26,_0x17ebf7,_0x244656){_0x272c26[_0xc033('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3eeb9b){_0x272c26[_0xc033('0x7')](_0xc033('0x8'),_0x3eeb9b[_0xc033('0x9')](function(_0x5e5c4f){return{'id':_0x5e5c4f['id']};}));return FaxMessage[_0xc033('0xa')]({'where':{'FaxInteractionId':_0x272c26['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc033('0xb')](function(_0xc52b0b){_0x272c26[_0xc033('0x7')](_0xc033('0xc'),_0xc52b0b[_0xc033('0xd')]);FaxInteractionEvents[_0xc033('0xe')](_0x89928e+':'+_0x272c26['id'],_0x272c26);FaxInteractionEvents['emit'](_0x89928e,_0x272c26);_0x244656(null);})[_0xc033('0xf')](_0x244656(null));};}for(var e in events){if(events[_0xc033('0x10')](e)){var event=events[e];FaxInteraction[_0xc033('0x11')](e,emitEvent(event));}}module[_0xc033('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x245a=['../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','then','Users','map','findAll','unreadMessages','length','emit','catch','exports','events'];(function(_0x296b09,_0x29309a){var _0x1c076e=function(_0x58da3f){while(--_0x58da3f){_0x296b09['push'](_0x296b09['shift']());}};_0x1c076e(++_0x29309a);}(_0x245a,0x153));var _0xa245=function(_0x320194,_0xc61cc1){_0x320194=_0x320194-0x0;var _0x120c3b=_0x245a[_0x320194];return _0x120c3b;};'use strict';var EventEmitter=require(_0xa245('0x0'));var FaxInteraction=require(_0xa245('0x1'))['db'][_0xa245('0x2')];var FaxMessage=require(_0xa245('0x1'))['db'][_0xa245('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa245('0x4'),'afterUpdate':_0xa245('0x5'),'afterDestroy':_0xa245('0x6')};function emitEvent(_0xc33851){return function(_0x47a8a2,_0x4e402e,_0x28398d){_0x47a8a2[_0xa245('0x7')]({'attributes':['id'],'raw':!![]})[_0xa245('0x8')](function(_0x34df41){_0x47a8a2['setDataValue'](_0xa245('0x9'),_0x34df41[_0xa245('0xa')](function(_0x121246){return{'id':_0x121246['id']};}));return FaxMessage[_0xa245('0xb')]({'where':{'FaxInteractionId':_0x47a8a2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa245('0x8')](function(_0xce64a6){_0x47a8a2['setDataValue'](_0xa245('0xc'),_0xce64a6[_0xa245('0xd')]);FaxInteractionEvents[_0xa245('0xe')](_0xc33851+':'+_0x47a8a2['id'],_0x47a8a2);FaxInteractionEvents[_0xa245('0xe')](_0xc33851,_0x47a8a2);_0x28398d(null);})[_0xa245('0xf')](_0x28398d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xa245('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index da4d2cf..b9c3bd4 100644 --- a/server/api/faxInteraction/faxInteraction.model.js +++ b/server/api/faxInteraction/faxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ef9=['moment','bluebird','request-promise','rimraf','../../config/environment','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x0ef9,0x1ce));var _0x90ef=function(_0x240860,_0x20c04d){_0x240860=_0x240860-0x0;var _0x40e288=_0x0ef9[_0x240860];return _0x40e288;};'use strict';var _=require(_0x90ef('0x0'));var util=require(_0x90ef('0x1'));var logger=require(_0x90ef('0x2'))('api');var moment=require(_0x90ef('0x3'));var BPromise=require(_0x90ef('0x4'));var rp=require(_0x90ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90ef('0x6'));var config=require(_0x90ef('0x7'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x207b7e,_0x4e834e){return _0x207b7e[_0x90ef('0x8')]('FaxInteraction',attributes,{'tableName':_0x90ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30f56c,_0x15c393,_0x3ecc98){if(_0x30f56c[_0x90ef('0xa')](_0x90ef('0xb'))){_0x30f56c[_0x90ef('0xc')]=moment()[_0x90ef('0xd')](_0x90ef('0xe'));}_0x3ecc98(null,_0x30f56c);}}});}; \ No newline at end of file +var _0x820d=['api','bluebird','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x299793,_0x2ddb47){var _0x24ef6a=function(_0x542ea9){while(--_0x542ea9){_0x299793['push'](_0x299793['shift']());}};_0x24ef6a(++_0x2ddb47);}(_0x820d,0x13e));var _0xd820=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x820d[_0x411add];return _0x238242;};'use strict';var _=require(_0xd820('0x0'));var util=require('util');var logger=require(_0xd820('0x1'))(_0xd820('0x2'));var moment=require('moment');var BPromise=require(_0xd820('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd820('0x4'));var rimraf=require('rimraf');var config=require(_0xd820('0x5'));var attributes=require(_0xd820('0x6'));module[_0xd820('0x7')]=function(_0x2081f3,_0x14be7d){return _0x2081f3[_0xd820('0x8')](_0xd820('0x9'),attributes,{'tableName':_0xd820('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x44cf0c,_0x9f4a9b,_0x489108){if(_0x44cf0c[_0xd820('0xb')](_0xd820('0xc'))){_0x44cf0c[_0xd820('0xd')]=moment()[_0xd820('0xe')](_0xd820('0xf'));}_0x489108(null,_0x44cf0c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 34980fc..be88f62 100644 --- a/server/api/faxInteraction/faxInteraction.rpc.js +++ b/server/api/faxInteraction/faxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d34=['FaxInteraction','update','options','raw','where','limit','info','stringify','AddTagsToFaxInteraction','find','then','omit','body','ids','spread','AddTags','util','randomstring','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction'];(function(_0x9c017d,_0x5d2711){var _0x2de5ce=function(_0x4c1c9b){while(--_0x4c1c9b){_0x9c017d['push'](_0x9c017d['shift']());}};_0x2de5ce(++_0x5d2711);}(_0x2d34,0xa8));var _0x42d3=function(_0x583a2f,_0x3e3a5c){_0x583a2f=_0x583a2f-0x0;var _0x38134e=_0x2d34[_0x583a2f];return _0x38134e;};'use strict';var _=require('lodash');var util=require(_0x42d3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x42d3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x42d3('0x2'));var logger=require(_0x42d3('0x3'))('rpc');var config=require(_0x42d3('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x42d3('0x5')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x42d3('0x6')],{'host':_0x42d3('0x7'),'port':0x18eb});var socket=require(_0x42d3('0x8'))(new Redis(config[_0x42d3('0x6')]));require(_0x42d3('0x9'))[_0x42d3('0xa')](socket);function respondWithRpcPromise(_0x2e5dda,_0x2c312d,_0x3ccc87){return new BPromise(function(_0x33c86f,_0x571492){return client[_0x42d3('0xb')](_0x2e5dda,_0x3ccc87)['then'](function(_0xca95b){logger['info'](_0x42d3('0xc'),_0x2c312d,_0x42d3('0xd'));logger[_0x42d3('0xe')](_0x42d3('0xf'),_0x2c312d,_0x42d3('0xd'),JSON['stringify'](_0xca95b));if(_0xca95b[_0x42d3('0x10')]){if(_0xca95b[_0x42d3('0x10')][_0x42d3('0x11')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2c312d,_0xca95b[_0x42d3('0x10')]['message']);return _0x571492(_0xca95b[_0x42d3('0x10')][_0x42d3('0x12')]);}logger[_0x42d3('0x10')](_0x42d3('0xc'),_0x2c312d,_0xca95b[_0x42d3('0x10')][_0x42d3('0x12')]);return _0x33c86f(_0xca95b['error'][_0x42d3('0x12')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x2c312d,_0x42d3('0xd'));_0x33c86f(_0xca95b[_0x42d3('0x13')][_0x42d3('0x12')]);}})[_0x42d3('0x14')](function(_0x39b714){logger['error'](_0x42d3('0xc'),_0x2c312d,_0x39b714);_0x571492(_0x39b714);});});}exports[_0x42d3('0x15')]=function(_0x30acf4){var _0xf68194=this;return new Promise(function(_0x250718,_0x560f8a){return db[_0x42d3('0x16')][_0x42d3('0x17')](_0x30acf4['body'],{'raw':_0x30acf4['options']?_0x30acf4[_0x42d3('0x18')][_0x42d3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30acf4[_0x42d3('0x18')]?_0x30acf4['options'][_0x42d3('0x1a')]||null:null,'attributes':_0x30acf4[_0x42d3('0x18')]?_0x30acf4[_0x42d3('0x18')]['attributes']||null:null,'limit':_0x30acf4[_0x42d3('0x18')]?_0x30acf4[_0x42d3('0x18')][_0x42d3('0x1b')]||null:null})['then'](function(_0x554ac0){logger[_0x42d3('0x1c')](_0x42d3('0x15'),_0x30acf4);logger['debug'](_0x42d3('0x15'),_0x30acf4,JSON[_0x42d3('0x1d')](_0x554ac0));_0x250718(_0x554ac0);})[_0x42d3('0x14')](function(_0x30f6cd){logger['error'](_0x42d3('0x15'),_0x30f6cd[_0x42d3('0x12')],_0x30acf4);_0x560f8a(_0xf68194['error'](0x1f4,_0x30f6cd[_0x42d3('0x12')]));});});};exports[_0x42d3('0x1e')]=function(_0x3c9eb9){return new Promise(function(_0x5e2df9,_0x2b46a6){return db[_0x42d3('0x16')][_0x42d3('0x1f')]({'where':_0x3c9eb9['options']?_0x3c9eb9['options'][_0x42d3('0x1a')]||null:null})[_0x42d3('0x20')](function(_0x1e57d2){if(_0x1e57d2){return _0x1e57d2['addTags'](_0x3c9eb9['body']['ids'],_[_0x42d3('0x21')](_0x3c9eb9[_0x42d3('0x22')],[_0x42d3('0x23'),'id'])||{});}})[_0x42d3('0x24')](function(_0x438fdb){logger[_0x42d3('0x1c')](_0x42d3('0x25'),_0x3c9eb9);logger[_0x42d3('0xe')](_0x42d3('0x25'),_0x3c9eb9,JSON['stringify'](_0x438fdb));_0x5e2df9(_0x438fdb);})[_0x42d3('0x14')](function(_0x122234){logger[_0x42d3('0x10')](_0x42d3('0x25'),_0x122234['message'],_0x3c9eb9);_0x2b46a6(_this[_0x42d3('0x10')](0x1f4,_0x122234[_0x42d3('0x12')]));});});}; \ No newline at end of file +var _0x2df0=['AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','attributes','AddTagsToFaxInteraction','find','where','addTags','ids','omit','spread'];(function(_0x2c2266,_0x2df34f){var _0x2d0b71=function(_0xc2a6c1){while(--_0xc2a6c1){_0x2c2266['push'](_0x2c2266['shift']());}};_0x2d0b71(++_0x2df34f);}(_0x2df0,0x1da));var _0x02df=function(_0x59941f,_0x211569){_0x59941f=_0x59941f-0x0;var _0x4cdaf0=_0x2df0[_0x59941f];return _0x4cdaf0;};'use strict';var _=require(_0x02df('0x0'));var util=require(_0x02df('0x1'));var moment=require(_0x02df('0x2'));var BPromise=require(_0x02df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02df('0x4'));var db=require(_0x02df('0x5'))['db'];var utils=require(_0x02df('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x02df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x02df('0x8')][_0x02df('0x9')]({'port':0x232a});config[_0x02df('0xa')]=_[_0x02df('0xb')](config['redis'],{'host':_0x02df('0xc'),'port':0x18eb});var socket=require(_0x02df('0xd'))(new Redis(config[_0x02df('0xa')]));require(_0x02df('0xe'))[_0x02df('0xf')](socket);function respondWithRpcPromise(_0x3f712d,_0x550bda,_0x472b8d){return new BPromise(function(_0x5b34cb,_0x21a6d7){return client[_0x02df('0x10')](_0x3f712d,_0x472b8d)[_0x02df('0x11')](function(_0x13c4b2){logger[_0x02df('0x12')](_0x02df('0x13'),_0x550bda,'request\x20sent');logger[_0x02df('0x14')](_0x02df('0x15'),_0x550bda,_0x02df('0x16'),JSON[_0x02df('0x17')](_0x13c4b2));if(_0x13c4b2[_0x02df('0x18')]){if(_0x13c4b2[_0x02df('0x18')][_0x02df('0x19')]===0x1f4){logger[_0x02df('0x18')](_0x02df('0x13'),_0x550bda,_0x13c4b2[_0x02df('0x18')][_0x02df('0x1a')]);return _0x21a6d7(_0x13c4b2[_0x02df('0x18')]['message']);}logger[_0x02df('0x18')](_0x02df('0x13'),_0x550bda,_0x13c4b2['error'][_0x02df('0x1a')]);return _0x5b34cb(_0x13c4b2[_0x02df('0x18')][_0x02df('0x1a')]);}else{logger[_0x02df('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x550bda,'request\x20sent');_0x5b34cb(_0x13c4b2[_0x02df('0x1b')]['message']);}})[_0x02df('0x1c')](function(_0x560530){logger['error'](_0x02df('0x13'),_0x550bda,_0x560530);_0x21a6d7(_0x560530);});});}exports[_0x02df('0x1d')]=function(_0x479ca8){var _0x425bf1=this;return new Promise(function(_0xe9d760,_0x1c3210){return db[_0x02df('0x1e')][_0x02df('0x1f')](_0x479ca8[_0x02df('0x20')],{'raw':_0x479ca8['options']?_0x479ca8[_0x02df('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x479ca8[_0x02df('0x21')]?_0x479ca8[_0x02df('0x21')]['where']||null:null,'attributes':_0x479ca8[_0x02df('0x21')]?_0x479ca8[_0x02df('0x21')][_0x02df('0x22')]||null:null,'limit':_0x479ca8[_0x02df('0x21')]?_0x479ca8[_0x02df('0x21')]['limit']||null:null})['then'](function(_0x1c524e){logger[_0x02df('0x12')](_0x02df('0x1d'),_0x479ca8);logger[_0x02df('0x14')]('UpdateFaxInteraction',_0x479ca8,JSON['stringify'](_0x1c524e));_0xe9d760(_0x1c524e);})[_0x02df('0x1c')](function(_0x3c6bf2){logger[_0x02df('0x18')](_0x02df('0x1d'),_0x3c6bf2[_0x02df('0x1a')],_0x479ca8);_0x1c3210(_0x425bf1[_0x02df('0x18')](0x1f4,_0x3c6bf2[_0x02df('0x1a')]));});});};exports[_0x02df('0x23')]=function(_0x1c8c12){return new Promise(function(_0x24b423,_0x4a5346){return db['FaxInteraction'][_0x02df('0x24')]({'where':_0x1c8c12[_0x02df('0x21')]?_0x1c8c12[_0x02df('0x21')][_0x02df('0x25')]||null:null})[_0x02df('0x11')](function(_0x33ee0a){if(_0x33ee0a){return _0x33ee0a[_0x02df('0x26')](_0x1c8c12[_0x02df('0x20')][_0x02df('0x27')],_[_0x02df('0x28')](_0x1c8c12[_0x02df('0x20')],['ids','id'])||{});}})[_0x02df('0x29')](function(_0x2a8f0a){logger[_0x02df('0x12')](_0x02df('0x2a'),_0x1c8c12);logger[_0x02df('0x14')](_0x02df('0x2a'),_0x1c8c12,JSON[_0x02df('0x17')](_0x2a8f0a));_0x24b423(_0x2a8f0a);})[_0x02df('0x1c')](function(_0x503710){logger[_0x02df('0x18')](_0x02df('0x2a'),_0x503710[_0x02df('0x1a')],_0x1c8c12);_0x4a5346(_this[_0x02df('0x18')](0x1f4,_0x503710[_0x02df('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6ef49fd..347fd13 100644 --- a/server/api/faxInteraction/faxInteraction.socket.js +++ b/server/api/faxInteraction/faxInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd763=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','register'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0xd763,0x1c8));var _0x3d76=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd763[_0x46698a];return _0x356db0;};'use strict';var FaxInteractionEvents=require(_0x3d76('0x0'));var events=[_0x3d76('0x1'),_0x3d76('0x2'),_0x3d76('0x3')];function createListener(_0x2dabf1,_0x1176fe){return function(_0xfdf6d4){_0x1176fe[_0x3d76('0x4')](_0x2dabf1,_0xfdf6d4);};}function removeListener(_0x2f0f08,_0x18398b){return function(){FaxInteractionEvents['removeListener'](_0x2f0f08,_0x18398b);};}exports[_0x3d76('0x5')]=function(_0x47cc91){for(var _0x404df8=0x0,_0x3d4b13=events['length'];_0x404df8<_0x3d4b13;_0x404df8++){var _0x5cddd6=events[_0x404df8];var _0x5eafbc=createListener(_0x3d76('0x6')+_0x5cddd6,_0x47cc91);FaxInteractionEvents['on'](_0x5cddd6,_0x5eafbc);}}; \ No newline at end of file +var _0x9c7a=['register','length','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x4ab5ed,_0xfcdb97){var _0x4ffdf7=function(_0x281638){while(--_0x281638){_0x4ab5ed['push'](_0x4ab5ed['shift']());}};_0x4ffdf7(++_0xfcdb97);}(_0x9c7a,0x191));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0xa9c7('0x0'));var events=[_0xa9c7('0x1'),_0xa9c7('0x2'),_0xa9c7('0x3')];function createListener(_0x193c52,_0x6895a8){return function(_0x4af04d){_0x6895a8['emit'](_0x193c52,_0x4af04d);};}function removeListener(_0x955b5a,_0x4b9543){return function(){FaxInteractionEvents[_0xa9c7('0x4')](_0x955b5a,_0x4b9543);};}exports[_0xa9c7('0x5')]=function(_0x307267){for(var _0x18259e=0x0,_0x1d2706=events[_0xa9c7('0x6')];_0x18259e<_0x1d2706;_0x18259e++){var _0x42811c=events[_0x18259e];var _0x520e25=createListener('faxInteraction:'+_0x42811c,_0x307267);FaxInteractionEvents['on'](_0x42811c,_0x520e25);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1fc0a7c..060bd14 100644 --- a/server/api/faxInteraction/index.js +++ b/server/api/faxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe18c=['removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy'];(function(_0x5e5c29,_0x33fa27){var _0x10da09=function(_0x203f3f){while(--_0x203f3f){_0x5e5c29['push'](_0x5e5c29['shift']());}};_0x10da09(++_0x33fa27);}(_0xe18c,0x178));var _0xce18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce18('0x0'));var util=require(_0xce18('0x1'));var path=require('path');var timeout=require(_0xce18('0x2'));var express=require(_0xce18('0x3'));var router=express['Router']();var fs_extra=require(_0xce18('0x4'));var auth=require(_0xce18('0x5'));var interaction=require(_0xce18('0x6'));var config=require(_0xce18('0x7'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xce18('0x8')](),controller[_0xce18('0x9')]);router[_0xce18('0xa')](_0xce18('0xb'),auth[_0xce18('0x8')](),controller[_0xce18('0xc')]);router[_0xce18('0xa')]('/:id',auth[_0xce18('0x8')](),controller['show']);router[_0xce18('0xa')](_0xce18('0xd'),auth[_0xce18('0x8')](),controller[_0xce18('0xe')]);router[_0xce18('0xa')](_0xce18('0xf'),auth['isAuthenticated'](),controller[_0xce18('0x10')]);router[_0xce18('0x11')]('/',auth[_0xce18('0x8')](),controller[_0xce18('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xce18('0x13')]);router[_0xce18('0x11')](_0xce18('0x14'),auth[_0xce18('0x8')](),interaction[_0xce18('0x15')](_0xce18('0x16'),_0xce18('0x17')),controller[_0xce18('0x18')]);router[_0xce18('0x19')](_0xce18('0x1a'),auth[_0xce18('0x8')](),interaction[_0xce18('0x15')](_0xce18('0x16'),_0xce18('0x1b')),controller[_0xce18('0x1c')]);router[_0xce18('0x1d')](_0xce18('0x1a'),auth[_0xce18('0x8')](),interaction[_0xce18('0x15')]('fax',_0xce18('0x1e')),controller[_0xce18('0x1f')]);router[_0xce18('0x1d')](_0xce18('0x14'),auth[_0xce18('0x8')](),controller[_0xce18('0x20')]);module[_0xce18('0x21')]=router; \ No newline at end of file +var _0x7f4c=['download','create','post','addMessage','/:id/tags','tracked','fax','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','/:id/download'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7f4c,0x1eb));var _0xc7f4=function(_0x1ae419,_0x5b1fc0){_0x1ae419=_0x1ae419-0x0;var _0x11f984=_0x7f4c[_0x1ae419];return _0x11f984;};'use strict';var multer=require(_0xc7f4('0x0'));var util=require('util');var path=require(_0xc7f4('0x1'));var timeout=require('connect-timeout');var express=require(_0xc7f4('0x2'));var router=express['Router']();var fs_extra=require(_0xc7f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc7f4('0x4'));var config=require('../../config/environment');var controller=require(_0xc7f4('0x5'));router[_0xc7f4('0x6')]('/',auth[_0xc7f4('0x7')](),controller['index']);router[_0xc7f4('0x6')](_0xc7f4('0x8'),auth[_0xc7f4('0x7')](),controller[_0xc7f4('0x9')]);router[_0xc7f4('0x6')]('/:id',auth[_0xc7f4('0x7')](),controller[_0xc7f4('0xa')]);router[_0xc7f4('0x6')](_0xc7f4('0xb'),auth[_0xc7f4('0x7')](),controller['getMessages']);router[_0xc7f4('0x6')](_0xc7f4('0xc'),auth[_0xc7f4('0x7')](),controller[_0xc7f4('0xd')]);router['post']('/',auth[_0xc7f4('0x7')](),controller[_0xc7f4('0xe')]);router[_0xc7f4('0xf')](_0xc7f4('0xb'),auth[_0xc7f4('0x7')](),controller[_0xc7f4('0x10')]);router[_0xc7f4('0xf')](_0xc7f4('0x11'),auth[_0xc7f4('0x7')](),interaction[_0xc7f4('0x12')](_0xc7f4('0x13'),'faxinteraction:addtags'),controller['addTags']);router['put'](_0xc7f4('0x14'),auth[_0xc7f4('0x7')](),interaction[_0xc7f4('0x12')](_0xc7f4('0x13'),_0xc7f4('0x15')),controller[_0xc7f4('0x16')]);router[_0xc7f4('0x17')](_0xc7f4('0x14'),auth[_0xc7f4('0x7')](),interaction['tracked']('fax',_0xc7f4('0x18')),controller[_0xc7f4('0x19')]);router['delete'](_0xc7f4('0x11'),auth[_0xc7f4('0x7')](),controller[_0xc7f4('0x1a')]);module[_0xc7f4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index aa7feff..a0889ea 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29d4=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x29d4,0x1a1));var _0x429d=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x29d4[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x429d('0x0'));module['exports']={'body':{'type':Sequelize[_0x429d('0x1')](_0x429d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x429d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x429d('0x4')]('in',_0x429d('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x429d('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x429d('0x6')]}}; \ No newline at end of file +var _0x1ef3=['sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x3ec69d,_0xf8aade){var _0x394c7e=function(_0x16764b){while(--_0x16764b){_0x3ec69d['push'](_0x3ec69d['shift']());}};_0x394c7e(++_0xf8aade);}(_0x1ef3,0x69));var _0x31ef=function(_0x305d11,_0x186ea8){_0x305d11=_0x305d11-0x0;var _0x58a893=_0x1ef3[_0x305d11];return _0x58a893;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x31ef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x31ef('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x31ef('0x4')]('in','out'),'defaultValue':_0x31ef('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x31ef('0x6')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b48a82f..2d0392d 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x365d=['../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxMessage.socket','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','keys','include','find','body','params','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','event','rejectmessage','create','CmContact','findOne','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','server','files','Attachment','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x40358c,_0x356900){var _0x36c709=function(_0x190db0){while(--_0x190db0){_0x40358c['push'](_0x40358c['shift']());}};_0x36c709(++_0x356900);}(_0x365d,0x19c));var _0xd365=function(_0x59e622,_0x449789){_0x59e622=_0x59e622-0x0;var _0x3cafd5=_0x365d[_0x59e622];return _0x3cafd5;};'use strict';var emlformat=require(_0xd365('0x0'));var rimraf=require(_0xd365('0x1'));var zipdir=require(_0xd365('0x2'));var jsonpatch=require(_0xd365('0x3'));var rp=require(_0xd365('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd365('0x5'));var path=require(_0xd365('0x6'));var sox=require('sox');var csv=require(_0xd365('0x7'));var ejs=require(_0xd365('0x8'));var fs=require('fs');var fs_extra=require(_0xd365('0x9'));var _=require(_0xd365('0xa'));var squel=require(_0xd365('0xb'));var crypto=require(_0xd365('0xc'));var jsforce=require(_0xd365('0xd'));var deskjs=require(_0xd365('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd365('0xf'));var Papa=require('papaparse');var Redis=require(_0xd365('0x10'));var authService=require(_0xd365('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd365('0x12'));var logger=require('../../config/logger')(_0xd365('0x13'));var utils=require(_0xd365('0x14'));var config=require(_0xd365('0x15'));var licenseUtil=require(_0xd365('0x16'));var db=require('../../mysqldb')['db'];config[_0xd365('0x17')]=_[_0xd365('0x18')](config[_0xd365('0x17')],{'host':_0xd365('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd365('0x17')]));require(_0xd365('0x1a'))['register'](socket);var jayson=require(_0xd365('0x1b'));var client=jayson[_0xd365('0x1c')][_0xd365('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f28d9,_0x34fcf8,_0xee910b,_0x1b565d){return new BPromise(function(_0x429085,_0x4d1b3a){var _0x3e6a52=_0x1b565d||client;return _0x3e6a52['request'](_0x4f28d9,_0xee910b)[_0xd365('0x1e')](function(_0x2b2e77){logger[_0xd365('0x1f')](_0xd365('0x20'),_0x34fcf8,'request\x20sent');logger[_0xd365('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x34fcf8,_0xd365('0x22'),JSON[_0xd365('0x23')](_0x2b2e77));if(_0x2b2e77[_0xd365('0x24')]){if(_0x2b2e77[_0xd365('0x24')][_0xd365('0x25')]===0x1f4){logger[_0xd365('0x24')](_0xd365('0x20'),_0x34fcf8,_0x2b2e77[_0xd365('0x24')]['message']);return _0x4d1b3a(_0x2b2e77[_0xd365('0x24')][_0xd365('0x26')]);}logger['error'](_0xd365('0x20'),_0x34fcf8,_0x2b2e77[_0xd365('0x24')][_0xd365('0x26')]);return _0x429085(_0x2b2e77[_0xd365('0x24')][_0xd365('0x26')]);}else{logger[_0xd365('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x34fcf8,'request\x20sent');_0x429085(_0x2b2e77[_0xd365('0x27')][_0xd365('0x26')]);}})['catch'](function(_0x5e7a33){logger[_0xd365('0x24')]('FaxMessage,\x20%s,\x20%s',_0x34fcf8,_0x5e7a33);_0x4d1b3a(_0x5e7a33);});});}function respondWithStatusCode(_0x19d896,_0xbbe379){_0xbbe379=_0xbbe379||0xcc;return function(_0x380ea1){if(_0x380ea1){return _0x19d896[_0xd365('0x28')](_0xbbe379);}return _0x19d896[_0xd365('0x29')](_0xbbe379)[_0xd365('0x2a')]();};}function respondWithResult(_0xccfe8a,_0x57e8a1){_0x57e8a1=_0x57e8a1||0xc8;return function(_0x246e73){if(_0x246e73){return _0xccfe8a[_0xd365('0x29')](_0x57e8a1)[_0xd365('0x2b')](_0x246e73);}};}function respondWithFilteredResult(_0x58251a,_0x5970d3){return function(_0x36f970){if(_0x36f970){var _0x1f3b2f=typeof _0x5970d3[_0xd365('0x2c')]===_0xd365('0x2d')&&typeof _0x5970d3[_0xd365('0x2e')]===_0xd365('0x2d');var _0x15f0d9=_0x36f970['count'];var _0x22c370=_0x1f3b2f?0x0:_0x5970d3['offset'];var _0x534c48=_0x1f3b2f?_0x36f970[_0xd365('0x2f')]:_0x5970d3[_0xd365('0x2c')]+_0x5970d3[_0xd365('0x2e')];var _0x126751;if(_0x534c48>=_0x15f0d9){_0x534c48=_0x15f0d9;_0x126751=0xc8;}else{_0x126751=0xce;}_0x58251a[_0xd365('0x29')](_0x126751);return _0x58251a['set'](_0xd365('0x30'),_0x22c370+'-'+_0x534c48+'/'+_0x15f0d9)[_0xd365('0x2b')](_0x36f970);}return null;};}function patchUpdates(_0x196f17){return function(_0x34ceab){try{jsonpatch[_0xd365('0x31')](_0x34ceab,_0x196f17,!![]);}catch(_0x2db1e9){return BPromise['reject'](_0x2db1e9);}return _0x34ceab[_0xd365('0x32')]();};}function saveUpdates(_0x4bd080,_0x4f947b){return function(_0x12269a){if(_0x12269a){return _0x12269a[_0xd365('0x33')](_0x4bd080)['then'](function(_0x31caad){return _0x31caad;});}return null;};}function removeEntity(_0x1fb3fa,_0x3dfd07){return function(_0x2158da){if(_0x2158da){return _0x2158da[_0xd365('0x34')]()[_0xd365('0x1e')](function(){_0x1fb3fa['status'](0xcc)[_0xd365('0x2a')]();});}};}function handleEntityNotFound(_0x2308fd,_0x1dfefb){return function(_0x3e1625){if(!_0x3e1625){_0x2308fd['sendStatus'](0x194);}return _0x3e1625;};}function handleError(_0x147be6,_0xf4ef57){_0xf4ef57=_0xf4ef57||0x1f4;return function(_0x523098){logger[_0xd365('0x24')](_0x523098[_0xd365('0x35')]);if(_0x523098['name']){delete _0x523098[_0xd365('0x36')];}_0x147be6[_0xd365('0x29')](_0xf4ef57)[_0xd365('0x37')](_0x523098);};}exports[_0xd365('0x38')]=function(_0x1f61bb,_0x10d031){var _0x5b33a9={},_0x45d53d={},_0x523baa={'count':0x0,'rows':[]};var _0x5c2d7c=_[_0xd365('0x39')](db[_0xd365('0x3a')][_0xd365('0x3b')],function(_0x44f277){return{'name':_0x44f277['fieldName'],'type':_0x44f277['type'][_0xd365('0x3c')]};});_0x45d53d[_0xd365('0x3d')]=_[_0xd365('0x39')](_0x5c2d7c,_0xd365('0x36'));_0x45d53d[_0xd365('0x3e')]=_['keys'](_0x1f61bb['query']);_0x45d53d[_0xd365('0x3f')]=_[_0xd365('0x40')](_0x45d53d[_0xd365('0x3d')],_0x45d53d['query']);_0x5b33a9['attributes']=_[_0xd365('0x40')](_0x45d53d['model'],qs[_0xd365('0x41')](_0x1f61bb[_0xd365('0x3e')][_0xd365('0x41')]));_0x5b33a9[_0xd365('0x42')]=_0x5b33a9[_0xd365('0x42')][_0xd365('0x43')]?_0x5b33a9[_0xd365('0x42')]:_0x45d53d[_0xd365('0x3d')];if(!_0x1f61bb[_0xd365('0x3e')]['hasOwnProperty'](_0xd365('0x44'))){_0x5b33a9['limit']=qs['limit'](_0x1f61bb[_0xd365('0x3e')][_0xd365('0x2e')]);_0x5b33a9[_0xd365('0x2c')]=qs[_0xd365('0x2c')](_0x1f61bb[_0xd365('0x3e')][_0xd365('0x2c')]);}_0x5b33a9[_0xd365('0x45')]=qs[_0xd365('0x46')](_0x1f61bb[_0xd365('0x3e')][_0xd365('0x46')]);_0x5b33a9[_0xd365('0x47')]=qs[_0xd365('0x3f')](_['pick'](_0x1f61bb[_0xd365('0x3e')],_0x45d53d[_0xd365('0x3f')]),_0x5c2d7c);if(_0x1f61bb[_0xd365('0x3e')][_0xd365('0x48')]){_0x5b33a9[_0xd365('0x47')]=_['merge'](_0x5b33a9[_0xd365('0x47')],{'$or':_[_0xd365('0x39')](_0x5c2d7c,function(_0x32d6b8){if(_0x32d6b8[_0xd365('0x49')]!==_0xd365('0x4a')){var _0x56dab6={};_0x56dab6[_0x32d6b8[_0xd365('0x36')]]={'$like':'%'+_0x1f61bb[_0xd365('0x3e')][_0xd365('0x48')]+'%'};return _0x56dab6;}})});}_0x5b33a9=_[_0xd365('0x4b')]({},_0x5b33a9,_0x1f61bb[_0xd365('0x4c')]);var _0x3cea6f={'where':_0x5b33a9[_0xd365('0x47')]};return db[_0xd365('0x3a')]['count'](_0x3cea6f)[_0xd365('0x1e')](function(_0x27f98a){_0x523baa[_0xd365('0x2f')]=_0x27f98a;if(_0x1f61bb[_0xd365('0x3e')][_0xd365('0x4d')]){_0x5b33a9['include']=[{'all':!![]}];}return db[_0xd365('0x3a')][_0xd365('0x4e')](_0x5b33a9);})[_0xd365('0x1e')](function(_0x44d0d9){_0x523baa[_0xd365('0x4f')]=_0x44d0d9;return _0x523baa;})['then'](respondWithFilteredResult(_0x10d031,_0x5b33a9))[_0xd365('0x50')](handleError(_0x10d031,null));};exports['show']=function(_0x20befb,_0x1cd86a){var _0x24e056={'raw':!![],'where':{'id':_0x20befb['params']['id']}},_0x1b9b72={};_0x1b9b72[_0xd365('0x3d')]=_[_0xd365('0x51')](db[_0xd365('0x3a')]['rawAttributes']);_0x1b9b72[_0xd365('0x3e')]=_['keys'](_0x20befb['query']);_0x1b9b72[_0xd365('0x3f')]=_['intersection'](_0x1b9b72[_0xd365('0x3d')],_0x1b9b72[_0xd365('0x3e')]);_0x24e056[_0xd365('0x42')]=_['intersection'](_0x1b9b72[_0xd365('0x3d')],qs['fields'](_0x20befb[_0xd365('0x3e')][_0xd365('0x41')]));_0x24e056[_0xd365('0x42')]=_0x24e056[_0xd365('0x42')][_0xd365('0x43')]?_0x24e056['attributes']:_0x1b9b72[_0xd365('0x3d')];if(_0x20befb[_0xd365('0x3e')][_0xd365('0x4d')]){_0x24e056[_0xd365('0x52')]=[{'all':!![]}];}_0x24e056=_[_0xd365('0x4b')]({},_0x24e056,_0x20befb[_0xd365('0x4c')]);return db['FaxMessage'][_0xd365('0x53')](_0x24e056)['then'](handleEntityNotFound(_0x1cd86a,null))[_0xd365('0x1e')](respondWithResult(_0x1cd86a,null))[_0xd365('0x50')](handleError(_0x1cd86a,null));};exports[_0xd365('0x33')]=function(_0x4de477,_0x433fe1){if(_0x4de477[_0xd365('0x54')]['id']){delete _0x4de477[_0xd365('0x54')]['id'];}return db[_0xd365('0x3a')][_0xd365('0x53')]({'where':{'id':_0x4de477[_0xd365('0x55')]['id']}})[_0xd365('0x1e')](handleEntityNotFound(_0x433fe1,null))['then'](saveUpdates(_0x4de477[_0xd365('0x54')],null))[_0xd365('0x1e')](respondWithResult(_0x433fe1,null))[_0xd365('0x50')](handleError(_0x433fe1,null));};exports[_0xd365('0x34')]=function(_0x5eaa3c,_0x4b64ec){return db['FaxMessage'][_0xd365('0x53')]({'where':{'id':_0x5eaa3c['params']['id']}})[_0xd365('0x1e')](handleEntityNotFound(_0x4b64ec,null))[_0xd365('0x1e')](removeEntity(_0x4b64ec,null))[_0xd365('0x50')](handleError(_0x4b64ec,null));};exports[_0xd365('0x56')]=function(_0x484c0d,_0x3e448b){return db[_0xd365('0x3a')][_0xd365('0x56')]()[_0xd365('0x1e')](respondWithResult(_0x3e448b,null))[_0xd365('0x50')](handleError(_0x3e448b,null));};var interaction_log=require(_0xd365('0x57'))(_0xd365('0x58'));exports[_0xd365('0x59')]=function(_0x3d7020,_0x513904,_0x56b26b){var _0x133454={'agent':{},'channel':_0xd365('0x5a')};if(_0x3d7020[_0xd365('0x54')]['id']){delete _0x3d7020['body']['id'];}_0x3d7020[_0xd365('0x54')][_0xd365('0x5b')]=!![];_0x3d7020[_0xd365('0x54')][_0xd365('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3d7020[_0xd365('0x54')][_0xd365('0x5d')]=_0x3d7020['body'][_0xd365('0x5d')]||_0x3d7020['user']['id'];_0x133454[_0xd365('0x5e')]['id']=_0x3d7020[_0xd365('0x54')][_0xd365('0x5d')];return db[_0xd365('0x3a')][_0xd365('0x53')]({'where':{'id':_0x3d7020[_0xd365('0x55')]['id'],'UserId':null}})[_0xd365('0x1e')](handleEntityNotFound(_0x513904,null))[_0xd365('0x1e')](saveUpdates(_0x3d7020[_0xd365('0x54')],null))[_0xd365('0x1e')](function(_0xf38147){if(_0xf38147){_0x133454[_0xd365('0x26')]=_0xf38147[_0xd365('0x5f')]({'plain':!![]});return db[_0xd365('0x60')][_0xd365('0x53')]({'where':{'id':_0xf38147[_0xd365('0x61')]}});}return null;})[_0xd365('0x1e')](handleEntityNotFound(_0x513904,null))[_0xd365('0x1e')](function(_0x4b8330){if(_0x4b8330){return _0x4b8330[_0xd365('0x33')]({'UserId':_0x3d7020['body']['UserId'],'read1stAt':_[_0xd365('0x62')](_0x4b8330[_0xd365('0x63')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x577d98){if(_0x577d98){_0x133454[_0xd365('0x64')]=_0x577d98['get']({'plain':!![]});interaction_log[_0xd365('0x1f')](_0xd365('0x65'),_0x3d7020['user']['id'],_0x3d7020[_0xd365('0x66')][_0xd365('0x36')],_0x3d7020[_0xd365('0x66')][_0xd365('0x67')],_0x133454[_0xd365('0x64')]['id'],_0x3d7020[_0xd365('0x54')]?JSON[_0xd365('0x23')](_0x3d7020[_0xd365('0x54')]):_0xd365('0x68'));return respondWithRpcPromise(_0xd365('0x69'),_0xd365('0x6a'),_0x133454);}return null;})[_0xd365('0x1e')](function(_0x282bea){var _0x1b3a2e=_0xd365('0x6b')+_0x282bea['message']['ContactId'];return db[_0xd365('0x6c')][_0xd365('0x3e')](_0x1b3a2e,{'type':db[_0xd365('0x6d')][_0xd365('0x6e')][_0xd365('0x6f')],'raw':!![]})['then'](function(_0x14214b){return _0x14214b;});})['then'](function(_0x484ade){if(_0x484ade){_0x133454[_0xd365('0x26')]['contact']=_0x484ade[0x0];if(!_0x3d7020['body'][_0xd365('0x5d')])return;return db[_0xd365('0x70')][_0xd365('0x53')]({'where':{'id':_0x3d7020[_0xd365('0x54')][_0xd365('0x5d')],'role':_0xd365('0x5e')},'attributes':['id',_0xd365('0x36'),_0xd365('0x71'),_0xd365('0x72'),_0xd365('0x73')],'raw':!![]});}return null;})[_0xd365('0x1e')](function(_0x552e01){if(!_0x552e01)return null;_0x133454[_0xd365('0x26')][_0xd365('0x5e')]=_0x552e01;return _0x133454;})[_0xd365('0x1e')](function(_0x1aff31){if(_0x1aff31){if(_0x3d7020['body'][_0xd365('0x74')]){_0x133454['message'][_0xd365('0x75')]=util[_0xd365('0x76')](_0xd365('0x77'),_0x3d7020[_0xd365('0x66')]['name']);_0x133454[_0xd365('0x26')][_0xd365('0x78')]=_0x133454['channel'];_0x133454[_0xd365('0x26')][_0xd365('0x79')]=_0x133454[_0xd365('0x78')];_0x133454[_0xd365('0x26')]['event']='accept';return respondWithRpcPromise(_0xd365('0x7a'),_0xd365('0x7a'),{'event':_0xd365('0x7b'),'message':_0x133454['message']},client9002)['then'](function(){return _0x133454;});}return _0x133454;}return null;})[_0xd365('0x1e')](respondWithResult(_0x513904,null))[_0xd365('0x50')](handleError(_0x513904,null));};var interaction_log=require(_0xd365('0x57'))(_0xd365('0x58'));exports[_0xd365('0x7c')]=function(_0x55ef69,_0x4193cd,_0x21d51d){var _0x25a3bd={'agent':{},'channel':_0xd365('0x5a')};if(_0x55ef69[_0xd365('0x54')]['id']){delete _0x55ef69[_0xd365('0x54')]['id'];}_0x55ef69[_0xd365('0x54')][_0xd365('0x5d')]=_0x55ef69[_0xd365('0x54')]['UserId']||_0x55ef69[_0xd365('0x66')]['id'];_0x25a3bd[_0xd365('0x5e')]['id']=_0x55ef69[_0xd365('0x54')][_0xd365('0x5d')];return db[_0xd365('0x3a')]['find']({'where':{'id':_0x55ef69['params']['id'],'UserId':null}})[_0xd365('0x1e')](handleEntityNotFound(_0x4193cd,null))['then'](function(_0x4c30ea){if(_0x4c30ea){_0x25a3bd[_0xd365('0x26')]=_0x4c30ea['get']({'plain':!![]});return db[_0xd365('0x60')]['find']({'where':{'id':_0x4c30ea[_0xd365('0x61')]}});}return null;})[_0xd365('0x1e')](handleEntityNotFound(_0x4193cd,null))[_0xd365('0x1e')](function(_0x5ae9ea){if(_0x5ae9ea){_0x25a3bd['interaction']=_0x5ae9ea[_0xd365('0x5f')]({'plain':!![]});interaction_log['info'](_0xd365('0x7d'),_0x55ef69['user']['id'],_0x55ef69[_0xd365('0x66')][_0xd365('0x36')],_0x55ef69[_0xd365('0x66')][_0xd365('0x67')],_0x25a3bd[_0xd365('0x64')]['id'],_0x55ef69[_0xd365('0x54')]?JSON[_0xd365('0x23')](_0x55ef69[_0xd365('0x54')]):_0xd365('0x68'));return respondWithRpcPromise(_0xd365('0x7e'),_0xd365('0x7f'),_0x25a3bd);}return null;})['then'](function(_0x496e64){var _0xa20f38=_0xd365('0x6b')+_0x496e64[_0xd365('0x26')]['ContactId'];return db[_0xd365('0x6c')]['query'](_0xa20f38,{'type':db[_0xd365('0x6d')][_0xd365('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0xf87934){return _0xf87934;});})[_0xd365('0x1e')](function(_0x3402ad){if(_0x3402ad){_0x25a3bd['message'][_0xd365('0x80')]=_0x3402ad[0x0];if(!_0x55ef69[_0xd365('0x54')][_0xd365('0x5d')])return;return db[_0xd365('0x70')][_0xd365('0x53')]({'where':{'id':_0x55ef69[_0xd365('0x54')][_0xd365('0x5d')],'role':'agent'},'attributes':['id',_0xd365('0x36'),_0xd365('0x71'),_0xd365('0x72'),'internal'],'raw':!![]});}return null;})[_0xd365('0x1e')](function(_0xc4ddbd){if(!_0xc4ddbd)return null;_0x25a3bd[_0xd365('0x26')]['agent']=_0xc4ddbd;return _0x25a3bd;})[_0xd365('0x1e')](function(_0x45b972){if(_0x45b972){_0x45b972['message']['interface']=util['format'](_0xd365('0x77'),_0x55ef69[_0xd365('0x66')][_0xd365('0x36')]);_0x45b972['message'][_0xd365('0x78')]=_0x25a3bd[_0xd365('0x78')];_0x45b972[_0xd365('0x26')][_0xd365('0x79')]=_0x25a3bd['channel'];_0x45b972[_0xd365('0x26')][_0xd365('0x81')]='reject';respondWithRpcPromise(_0xd365('0x7a'),'EventManager',{'event':_0xd365('0x82'),'message':_0x45b972[_0xd365('0x26')]},client9002);return _0x25a3bd;}return null;})[_0xd365('0x1e')](respondWithResult(_0x4193cd,null))[_0xd365('0x50')](handleError(_0x4193cd,null));};exports['create']=function(_0x7b9fac,_0x4b5678){var _0x3aaf87;return db['FaxMessage'][_0xd365('0x83')](_0x7b9fac[_0xd365('0x54')],{})[_0xd365('0x1e')](function(_0x2f145b){_0x3aaf87=_0x2f145b;return db[_0xd365('0x84')]['findOne']({'where':{'id':_0x3aaf87['ContactId']}});})[_0xd365('0x1e')](function(_0x19bb4b){if(_[_0xd365('0x62')](_0x19bb4b)){return;}else{_0x3aaf87[_0xd365('0x5a')]=_0x19bb4b[_0xd365('0x5a')];return db['Attachment'][_0xd365('0x85')]({'where':{'id':_0x3aaf87['AttachmentId']}});}})['then'](function(_0x51bb4f){return respondWithRpcPromise(_0xd365('0x86'),_0xd365('0x86'),{'FaxAccountId':_[_0xd365('0x62')](_0x7b9fac[_0xd365('0x54')])?undefined:_0x7b9fac[_0xd365('0x54')]['FaxAccountId'],'path':_[_0xd365('0x62')](_0x51bb4f)?undefined:util[_0xd365('0x76')](_0xd365('0x87'),_0x51bb4f[_0xd365('0x88')]),'fax':_['isNil'](_0x3aaf87[_0xd365('0x5a')])?undefined:_0x3aaf87[_0xd365('0x5a')],'AttachmentId':_0x3aaf87[_0xd365('0x89')]},client9002);})[_0xd365('0x1e')](respondWithResult(_0x4b5678,0xc9))[_0xd365('0x50')](handleError(_0x4b5678,null));};exports['download']=function(_0x2042f1,_0x34e5ab){var _0x3b02b6=path[_0xd365('0x8a')](config[_0xd365('0x8b')],_0xd365('0x8c'),_0xd365('0x8d'),'attachments');return db['FaxMessage'][_0xd365('0x53')]({'where':{'id':_0x2042f1[_0xd365('0x55')]['id']},'include':[{'model':db[_0xd365('0x8e')],'as':_0xd365('0x8e')}]})[_0xd365('0x1e')](handleEntityNotFound(_0x34e5ab,null))[_0xd365('0x1e')](function(_0x4a5d77){if(_0x4a5d77){return _0x34e5ab[_0xd365('0x8f')](path[_0xd365('0x8a')](_0x3b02b6,_0x4a5d77[_0xd365('0x8e')][_0xd365('0x88')]));}})[_0xd365('0x50')](handleError(_0x34e5ab,null));}; \ No newline at end of file +var _0xfc97=['moment','bluebird','mustache','path','to-csv','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','VIRTUAL','options','FaxMessage','includeAll','findAll','rows','params','include','merge','find','body','destroy','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','SIP/%s','create','CmContact','findOne','SendFax','FaxAccountId','download','join','server','files','attachments','Attachment','basename','eml-format','rimraf','request-promise'];(function(_0x39e896,_0x5811a6){var _0x1d381c=function(_0x46a5ac){while(--_0x46a5ac){_0x39e896['push'](_0x39e896['shift']());}};_0x1d381c(++_0x5811a6);}(_0xfc97,0x183));var _0x7fc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfc97[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7fc9('0x0'));var rimraf=require(_0x7fc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fc9('0x2'));var moment=require(_0x7fc9('0x3'));var BPromise=require(_0x7fc9('0x4'));var Mustache=require(_0x7fc9('0x5'));var util=require('util');var path=require(_0x7fc9('0x6'));var sox=require('sox');var csv=require(_0x7fc9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fc9('0x8'));var squel=require(_0x7fc9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7fc9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7fc9('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x7fc9('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7fc9('0xc'));var utils=require(_0x7fc9('0xd'));var config=require(_0x7fc9('0xe'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fc9('0xf'))['db'];config[_0x7fc9('0x10')]=_[_0x7fc9('0x11')](config[_0x7fc9('0x10')],{'host':_0x7fc9('0x12'),'port':0x18eb});var socket=require(_0x7fc9('0x13'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x7fc9('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x368d2f,_0x2ca346,_0x3cca49,_0x32c828){return new BPromise(function(_0x219558,_0x4fca8c){var _0x30599d=_0x32c828||client;return _0x30599d[_0x7fc9('0x15')](_0x368d2f,_0x3cca49)['then'](function(_0x30e5df){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2ca346,_0x7fc9('0x16'));logger[_0x7fc9('0x17')](_0x7fc9('0x18'),_0x2ca346,_0x7fc9('0x16'),JSON['stringify'](_0x30e5df));if(_0x30e5df[_0x7fc9('0x19')]){if(_0x30e5df[_0x7fc9('0x19')]['code']===0x1f4){logger['error'](_0x7fc9('0x1a'),_0x2ca346,_0x30e5df['error'][_0x7fc9('0x1b')]);return _0x4fca8c(_0x30e5df[_0x7fc9('0x19')]['message']);}logger['error'](_0x7fc9('0x1a'),_0x2ca346,_0x30e5df[_0x7fc9('0x19')][_0x7fc9('0x1b')]);return _0x219558(_0x30e5df[_0x7fc9('0x19')][_0x7fc9('0x1b')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2ca346,'request\x20sent');_0x219558(_0x30e5df[_0x7fc9('0x1c')][_0x7fc9('0x1b')]);}})[_0x7fc9('0x1d')](function(_0x4f3a30){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2ca346,_0x4f3a30);_0x4fca8c(_0x4f3a30);});});}function respondWithStatusCode(_0x21ee24,_0x581a5e){_0x581a5e=_0x581a5e||0xcc;return function(_0x5b3551){if(_0x5b3551){return _0x21ee24[_0x7fc9('0x1e')](_0x581a5e);}return _0x21ee24[_0x7fc9('0x1f')](_0x581a5e)[_0x7fc9('0x20')]();};}function respondWithResult(_0x58f960,_0x1328ab){_0x1328ab=_0x1328ab||0xc8;return function(_0x5698f0){if(_0x5698f0){return _0x58f960[_0x7fc9('0x1f')](_0x1328ab)['json'](_0x5698f0);}};}function respondWithFilteredResult(_0x3cc815,_0xa4d0e4){return function(_0x500b2c){if(_0x500b2c){var _0x448201=typeof _0xa4d0e4[_0x7fc9('0x21')]===_0x7fc9('0x22')&&typeof _0xa4d0e4[_0x7fc9('0x23')]===_0x7fc9('0x22');var _0x15e0ac=_0x500b2c['count'];var _0x329957=_0x448201?0x0:_0xa4d0e4['offset'];var _0x3cecca=_0x448201?_0x500b2c[_0x7fc9('0x24')]:_0xa4d0e4[_0x7fc9('0x21')]+_0xa4d0e4['limit'];var _0x231f40;if(_0x3cecca>=_0x15e0ac){_0x3cecca=_0x15e0ac;_0x231f40=0xc8;}else{_0x231f40=0xce;}_0x3cc815[_0x7fc9('0x1f')](_0x231f40);return _0x3cc815[_0x7fc9('0x25')]('Content-Range',_0x329957+'-'+_0x3cecca+'/'+_0x15e0ac)['json'](_0x500b2c);}return null;};}function patchUpdates(_0x43e299){return function(_0x83cb84){try{jsonpatch[_0x7fc9('0x26')](_0x83cb84,_0x43e299,!![]);}catch(_0x1b1634){return BPromise[_0x7fc9('0x27')](_0x1b1634);}return _0x83cb84['save']();};}function saveUpdates(_0x1b8b40,_0x2be243){return function(_0x1f6ef3){if(_0x1f6ef3){return _0x1f6ef3[_0x7fc9('0x28')](_0x1b8b40)['then'](function(_0x5a3835){return _0x5a3835;});}return null;};}function removeEntity(_0x19cd91,_0x5d775d){return function(_0x1dbcd4){if(_0x1dbcd4){return _0x1dbcd4['destroy']()[_0x7fc9('0x29')](function(){_0x19cd91[_0x7fc9('0x1f')](0xcc)[_0x7fc9('0x20')]();});}};}function handleEntityNotFound(_0xc5b4c5,_0x34261c){return function(_0x9a9140){if(!_0x9a9140){_0xc5b4c5[_0x7fc9('0x1e')](0x194);}return _0x9a9140;};}function handleError(_0x159b30,_0x179fb2){_0x179fb2=_0x179fb2||0x1f4;return function(_0x392b76){logger[_0x7fc9('0x19')](_0x392b76[_0x7fc9('0x2a')]);if(_0x392b76[_0x7fc9('0x2b')]){delete _0x392b76['name'];}_0x159b30['status'](_0x179fb2)[_0x7fc9('0x2c')](_0x392b76);};}exports[_0x7fc9('0x2d')]=function(_0x40aeed,_0x3d408e){var _0x293d62={},_0x4e6d36={},_0x16cacf={'count':0x0,'rows':[]};var _0x2475de=_['map'](db['FaxMessage'][_0x7fc9('0x2e')],function(_0x2a01c3){return{'name':_0x2a01c3[_0x7fc9('0x2f')],'type':_0x2a01c3[_0x7fc9('0x30')]['key']};});_0x4e6d36['model']=_[_0x7fc9('0x31')](_0x2475de,'name');_0x4e6d36[_0x7fc9('0x32')]=_[_0x7fc9('0x33')](_0x40aeed[_0x7fc9('0x32')]);_0x4e6d36[_0x7fc9('0x34')]=_[_0x7fc9('0x35')](_0x4e6d36[_0x7fc9('0x36')],_0x4e6d36[_0x7fc9('0x32')]);_0x293d62[_0x7fc9('0x37')]=_[_0x7fc9('0x35')](_0x4e6d36['model'],qs[_0x7fc9('0x38')](_0x40aeed['query']['fields']));_0x293d62[_0x7fc9('0x37')]=_0x293d62[_0x7fc9('0x37')][_0x7fc9('0x39')]?_0x293d62[_0x7fc9('0x37')]:_0x4e6d36['model'];if(!_0x40aeed[_0x7fc9('0x32')][_0x7fc9('0x3a')](_0x7fc9('0x3b'))){_0x293d62[_0x7fc9('0x23')]=qs['limit'](_0x40aeed['query'][_0x7fc9('0x23')]);_0x293d62[_0x7fc9('0x21')]=qs[_0x7fc9('0x21')](_0x40aeed['query']['offset']);}_0x293d62['order']=qs['sort'](_0x40aeed[_0x7fc9('0x32')]['sort']);_0x293d62['where']=qs[_0x7fc9('0x34')](_[_0x7fc9('0x3c')](_0x40aeed[_0x7fc9('0x32')],_0x4e6d36[_0x7fc9('0x34')]),_0x2475de);if(_0x40aeed[_0x7fc9('0x32')][_0x7fc9('0x3d')]){_0x293d62[_0x7fc9('0x3e')]=_['merge'](_0x293d62['where'],{'$or':_[_0x7fc9('0x31')](_0x2475de,function(_0xf090e2){if(_0xf090e2[_0x7fc9('0x30')]!==_0x7fc9('0x3f')){var _0x32da2d={};_0x32da2d[_0xf090e2[_0x7fc9('0x2b')]]={'$like':'%'+_0x40aeed['query'][_0x7fc9('0x3d')]+'%'};return _0x32da2d;}})});}_0x293d62=_['merge']({},_0x293d62,_0x40aeed[_0x7fc9('0x40')]);var _0x1a6497={'where':_0x293d62[_0x7fc9('0x3e')]};return db[_0x7fc9('0x41')][_0x7fc9('0x24')](_0x1a6497)[_0x7fc9('0x29')](function(_0x431bba){_0x16cacf['count']=_0x431bba;if(_0x40aeed[_0x7fc9('0x32')][_0x7fc9('0x42')]){_0x293d62['include']=[{'all':!![]}];}return db[_0x7fc9('0x41')][_0x7fc9('0x43')](_0x293d62);})[_0x7fc9('0x29')](function(_0xf04716){_0x16cacf[_0x7fc9('0x44')]=_0xf04716;return _0x16cacf;})['then'](respondWithFilteredResult(_0x3d408e,_0x293d62))[_0x7fc9('0x1d')](handleError(_0x3d408e,null));};exports['show']=function(_0x3a42a2,_0x11a087){var _0x17473a={'raw':!![],'where':{'id':_0x3a42a2[_0x7fc9('0x45')]['id']}},_0x412373={};_0x412373['model']=_[_0x7fc9('0x33')](db[_0x7fc9('0x41')]['rawAttributes']);_0x412373[_0x7fc9('0x32')]=_[_0x7fc9('0x33')](_0x3a42a2[_0x7fc9('0x32')]);_0x412373[_0x7fc9('0x34')]=_[_0x7fc9('0x35')](_0x412373['model'],_0x412373[_0x7fc9('0x32')]);_0x17473a[_0x7fc9('0x37')]=_['intersection'](_0x412373[_0x7fc9('0x36')],qs[_0x7fc9('0x38')](_0x3a42a2[_0x7fc9('0x32')]['fields']));_0x17473a[_0x7fc9('0x37')]=_0x17473a[_0x7fc9('0x37')]['length']?_0x17473a[_0x7fc9('0x37')]:_0x412373[_0x7fc9('0x36')];if(_0x3a42a2[_0x7fc9('0x32')][_0x7fc9('0x42')]){_0x17473a[_0x7fc9('0x46')]=[{'all':!![]}];}_0x17473a=_[_0x7fc9('0x47')]({},_0x17473a,_0x3a42a2[_0x7fc9('0x40')]);return db['FaxMessage'][_0x7fc9('0x48')](_0x17473a)['then'](handleEntityNotFound(_0x11a087,null))[_0x7fc9('0x29')](respondWithResult(_0x11a087,null))['catch'](handleError(_0x11a087,null));};exports[_0x7fc9('0x28')]=function(_0x55b9ac,_0x5ac80d){if(_0x55b9ac[_0x7fc9('0x49')]['id']){delete _0x55b9ac[_0x7fc9('0x49')]['id'];}return db[_0x7fc9('0x41')][_0x7fc9('0x48')]({'where':{'id':_0x55b9ac[_0x7fc9('0x45')]['id']}})[_0x7fc9('0x29')](handleEntityNotFound(_0x5ac80d,null))[_0x7fc9('0x29')](saveUpdates(_0x55b9ac[_0x7fc9('0x49')],null))[_0x7fc9('0x29')](respondWithResult(_0x5ac80d,null))[_0x7fc9('0x1d')](handleError(_0x5ac80d,null));};exports[_0x7fc9('0x4a')]=function(_0x3b8b08,_0x4536d8){return db[_0x7fc9('0x41')][_0x7fc9('0x48')]({'where':{'id':_0x3b8b08[_0x7fc9('0x45')]['id']}})['then'](handleEntityNotFound(_0x4536d8,null))[_0x7fc9('0x29')](removeEntity(_0x4536d8,null))[_0x7fc9('0x1d')](handleError(_0x4536d8,null));};exports[_0x7fc9('0x4b')]=function(_0x24bad8,_0x140d68){return db[_0x7fc9('0x41')][_0x7fc9('0x4b')]()[_0x7fc9('0x29')](respondWithResult(_0x140d68,null))['catch'](handleError(_0x140d68,null));};var interaction_log=require(_0x7fc9('0x4c'))(_0x7fc9('0x4d'));exports[_0x7fc9('0x4e')]=function(_0x53aff8,_0x591d56,_0x514630){var _0x49e22c={'agent':{},'channel':_0x7fc9('0x4f')};if(_0x53aff8[_0x7fc9('0x49')]['id']){delete _0x53aff8[_0x7fc9('0x49')]['id'];}_0x53aff8['body'][_0x7fc9('0x50')]=!![];_0x53aff8['body'][_0x7fc9('0x51')]=moment()[_0x7fc9('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x53aff8[_0x7fc9('0x49')]['UserId']=_0x53aff8[_0x7fc9('0x49')][_0x7fc9('0x53')]||_0x53aff8[_0x7fc9('0x54')]['id'];_0x49e22c[_0x7fc9('0x55')]['id']=_0x53aff8[_0x7fc9('0x49')][_0x7fc9('0x53')];return db['FaxMessage'][_0x7fc9('0x48')]({'where':{'id':_0x53aff8['params']['id'],'UserId':null}})[_0x7fc9('0x29')](handleEntityNotFound(_0x591d56,null))[_0x7fc9('0x29')](saveUpdates(_0x53aff8[_0x7fc9('0x49')],null))['then'](function(_0x5b5626){if(_0x5b5626){_0x49e22c[_0x7fc9('0x1b')]=_0x5b5626[_0x7fc9('0x56')]({'plain':!![]});return db[_0x7fc9('0x57')][_0x7fc9('0x48')]({'where':{'id':_0x5b5626[_0x7fc9('0x58')]}});}return null;})[_0x7fc9('0x29')](handleEntityNotFound(_0x591d56,null))[_0x7fc9('0x29')](function(_0x15568b){if(_0x15568b){return _0x15568b['update']({'UserId':_0x53aff8[_0x7fc9('0x49')][_0x7fc9('0x53')],'read1stAt':_[_0x7fc9('0x59')](_0x15568b[_0x7fc9('0x5a')])?moment()['format'](_0x7fc9('0x5b')):undefined});}return null;})[_0x7fc9('0x29')](function(_0x2a9194){if(_0x2a9194){_0x49e22c[_0x7fc9('0x5c')]=_0x2a9194[_0x7fc9('0x56')]({'plain':!![]});interaction_log[_0x7fc9('0x5d')](_0x7fc9('0x5e'),_0x53aff8[_0x7fc9('0x54')]['id'],_0x53aff8[_0x7fc9('0x54')][_0x7fc9('0x2b')],_0x53aff8['user'][_0x7fc9('0x5f')],_0x49e22c['interaction']['id'],_0x53aff8[_0x7fc9('0x49')]?JSON[_0x7fc9('0x60')](_0x53aff8[_0x7fc9('0x49')]):_0x7fc9('0x61'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x49e22c);}return null;})[_0x7fc9('0x29')](function(_0x596b62){var _0x3db137=_0x7fc9('0x62')+_0x596b62['message'][_0x7fc9('0x63')];return db[_0x7fc9('0x64')][_0x7fc9('0x32')](_0x3db137,{'type':db[_0x7fc9('0x65')][_0x7fc9('0x66')][_0x7fc9('0x67')],'raw':!![]})[_0x7fc9('0x29')](function(_0x27e9c7){return _0x27e9c7;});})[_0x7fc9('0x29')](function(_0x5be9b8){if(_0x5be9b8){_0x49e22c['message'][_0x7fc9('0x68')]=_0x5be9b8[0x0];if(!_0x53aff8[_0x7fc9('0x49')][_0x7fc9('0x53')])return;return db['User']['find']({'where':{'id':_0x53aff8[_0x7fc9('0x49')][_0x7fc9('0x53')],'role':_0x7fc9('0x55')},'attributes':['id',_0x7fc9('0x2b'),_0x7fc9('0x69'),_0x7fc9('0x6a'),_0x7fc9('0x6b')],'raw':!![]});}return null;})[_0x7fc9('0x29')](function(_0x5b3b06){if(!_0x5b3b06)return null;_0x49e22c['message'][_0x7fc9('0x55')]=_0x5b3b06;return _0x49e22c;})['then'](function(_0x3f887c){if(_0x3f887c){if(_0x53aff8['body'][_0x7fc9('0x6c')]){_0x49e22c['message'][_0x7fc9('0x6d')]=util['format']('SIP/%s',_0x53aff8[_0x7fc9('0x54')][_0x7fc9('0x2b')]);_0x49e22c[_0x7fc9('0x1b')][_0x7fc9('0x6e')]=_0x49e22c[_0x7fc9('0x6e')];_0x49e22c['message'][_0x7fc9('0x6f')]=_0x49e22c[_0x7fc9('0x6e')];_0x49e22c['message'][_0x7fc9('0x70')]=_0x7fc9('0x4e');return respondWithRpcPromise('EventManager',_0x7fc9('0x71'),{'event':'acceptmessage','message':_0x49e22c[_0x7fc9('0x1b')]},client9002)[_0x7fc9('0x29')](function(){return _0x49e22c;});}return _0x49e22c;}return null;})[_0x7fc9('0x29')](respondWithResult(_0x591d56,null))[_0x7fc9('0x1d')](handleError(_0x591d56,null));};var interaction_log=require(_0x7fc9('0x4c'))('fax-interactions');exports[_0x7fc9('0x27')]=function(_0x4de71b,_0x6fbfb0,_0x52b6c3){var _0x36f2f4={'agent':{},'channel':_0x7fc9('0x4f')};if(_0x4de71b['body']['id']){delete _0x4de71b['body']['id'];}_0x4de71b[_0x7fc9('0x49')]['UserId']=_0x4de71b[_0x7fc9('0x49')][_0x7fc9('0x53')]||_0x4de71b[_0x7fc9('0x54')]['id'];_0x36f2f4[_0x7fc9('0x55')]['id']=_0x4de71b[_0x7fc9('0x49')][_0x7fc9('0x53')];return db[_0x7fc9('0x41')][_0x7fc9('0x48')]({'where':{'id':_0x4de71b[_0x7fc9('0x45')]['id'],'UserId':null}})[_0x7fc9('0x29')](handleEntityNotFound(_0x6fbfb0,null))[_0x7fc9('0x29')](function(_0xa4c166){if(_0xa4c166){_0x36f2f4[_0x7fc9('0x1b')]=_0xa4c166[_0x7fc9('0x56')]({'plain':!![]});return db['FaxInteraction'][_0x7fc9('0x48')]({'where':{'id':_0xa4c166[_0x7fc9('0x58')]}});}return null;})[_0x7fc9('0x29')](handleEntityNotFound(_0x6fbfb0,null))[_0x7fc9('0x29')](function(_0x2456ce){if(_0x2456ce){_0x36f2f4[_0x7fc9('0x5c')]=_0x2456ce[_0x7fc9('0x56')]({'plain':!![]});interaction_log[_0x7fc9('0x5d')](_0x7fc9('0x72'),_0x4de71b[_0x7fc9('0x54')]['id'],_0x4de71b[_0x7fc9('0x54')][_0x7fc9('0x2b')],_0x4de71b['user'][_0x7fc9('0x5f')],_0x36f2f4[_0x7fc9('0x5c')]['id'],_0x4de71b['body']?JSON[_0x7fc9('0x60')](_0x4de71b[_0x7fc9('0x49')]):_0x7fc9('0x61'));return respondWithRpcPromise('RejectMessage',_0x7fc9('0x73'),_0x36f2f4);}return null;})[_0x7fc9('0x29')](function(_0x4d89e3){var _0x8155ed=_0x7fc9('0x62')+_0x4d89e3[_0x7fc9('0x1b')]['ContactId'];return db['sequelize'][_0x7fc9('0x32')](_0x8155ed,{'type':db['Sequelize']['QueryTypes'][_0x7fc9('0x67')],'raw':!![]})[_0x7fc9('0x29')](function(_0x1dd859){return _0x1dd859;});})[_0x7fc9('0x29')](function(_0x2cd2a1){if(_0x2cd2a1){_0x36f2f4['message'][_0x7fc9('0x68')]=_0x2cd2a1[0x0];if(!_0x4de71b[_0x7fc9('0x49')]['UserId'])return;return db[_0x7fc9('0x74')][_0x7fc9('0x48')]({'where':{'id':_0x4de71b['body']['UserId'],'role':_0x7fc9('0x55')},'attributes':['id',_0x7fc9('0x2b'),_0x7fc9('0x69'),_0x7fc9('0x6a'),_0x7fc9('0x6b')],'raw':!![]});}return null;})['then'](function(_0x364371){if(!_0x364371)return null;_0x36f2f4['message'][_0x7fc9('0x55')]=_0x364371;return _0x36f2f4;})['then'](function(_0x559ed0){if(_0x559ed0){_0x559ed0[_0x7fc9('0x1b')][_0x7fc9('0x6d')]=util['format'](_0x7fc9('0x75'),_0x4de71b[_0x7fc9('0x54')][_0x7fc9('0x2b')]);_0x559ed0[_0x7fc9('0x1b')]['channel']=_0x36f2f4[_0x7fc9('0x6e')];_0x559ed0['message'][_0x7fc9('0x6f')]=_0x36f2f4['channel'];_0x559ed0[_0x7fc9('0x1b')][_0x7fc9('0x70')]=_0x7fc9('0x27');respondWithRpcPromise(_0x7fc9('0x71'),_0x7fc9('0x71'),{'event':'rejectmessage','message':_0x559ed0[_0x7fc9('0x1b')]},client9002);return _0x36f2f4;}return null;})['then'](respondWithResult(_0x6fbfb0,null))[_0x7fc9('0x1d')](handleError(_0x6fbfb0,null));};exports[_0x7fc9('0x76')]=function(_0xff4f12,_0x1a3b78){var _0x110a90;return db[_0x7fc9('0x41')][_0x7fc9('0x76')](_0xff4f12['body'],{})['then'](function(_0xeab71e){_0x110a90=_0xeab71e;return db[_0x7fc9('0x77')][_0x7fc9('0x78')]({'where':{'id':_0x110a90[_0x7fc9('0x63')]}});})[_0x7fc9('0x29')](function(_0xe5025c){if(_['isNil'](_0xe5025c)){return;}else{_0x110a90[_0x7fc9('0x4f')]=_0xe5025c[_0x7fc9('0x4f')];return db['Attachment']['findOne']({'where':{'id':_0x110a90['AttachmentId']}});}})[_0x7fc9('0x29')](function(_0x413430){return respondWithRpcPromise(_0x7fc9('0x79'),_0x7fc9('0x79'),{'FaxAccountId':_[_0x7fc9('0x59')](_0xff4f12['body'])?undefined:_0xff4f12['body'][_0x7fc9('0x7a')],'path':_['isNil'](_0x413430)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x413430['basename']),'fax':_[_0x7fc9('0x59')](_0x110a90[_0x7fc9('0x4f')])?undefined:_0x110a90[_0x7fc9('0x4f')],'AttachmentId':_0x110a90['AttachmentId']},client9002);})[_0x7fc9('0x29')](respondWithResult(_0x1a3b78,0xc9))[_0x7fc9('0x1d')](handleError(_0x1a3b78,null));};exports[_0x7fc9('0x7b')]=function(_0x130b49,_0x46c5b2){var _0x178aef=path[_0x7fc9('0x7c')](config['root'],_0x7fc9('0x7d'),_0x7fc9('0x7e'),_0x7fc9('0x7f'));return db[_0x7fc9('0x41')][_0x7fc9('0x48')]({'where':{'id':_0x130b49[_0x7fc9('0x45')]['id']},'include':[{'model':db[_0x7fc9('0x80')],'as':_0x7fc9('0x80')}]})[_0x7fc9('0x29')](handleEntityNotFound(_0x46c5b2,null))[_0x7fc9('0x29')](function(_0x507648){if(_0x507648){return _0x46c5b2[_0x7fc9('0x7b')](path[_0x7fc9('0x7c')](_0x178aef,_0x507648['Attachment'][_0x7fc9('0x81')]));}})[_0x7fc9('0x1d')](handleError(_0x46c5b2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 28e31c5..4379da3 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66da=['../../mysqldb','FaxMessage','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x2b2b32,_0x177044){var _0x55d4bd=function(_0x2c763f){while(--_0x2c763f){_0x2b2b32['push'](_0x2b2b32['shift']());}};_0x55d4bd(++_0x177044);}(_0x66da,0x16f));var _0xa66d=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x66da[_0x5b34c0];return _0x242bd3;};'use strict';var EventEmitter=require(_0xa66d('0x0'));var FaxMessage=require(_0xa66d('0x1'))['db'][_0xa66d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa66d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17b831){return function(_0x950036,_0x1326e8,_0x436606){FaxMessageEvents[_0xa66d('0x4')](_0x17b831+':'+_0x950036['id'],_0x950036);FaxMessageEvents['emit'](_0x17b831,_0x950036);_0x436606(null);};}for(var e in events){if(events[_0xa66d('0x5')](e)){var event=events[e];FaxMessage[_0xa66d('0x6')](e,emitEvent(event));}}module[_0xa66d('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xad68=['remove','emit','hook','exports','FaxMessage','setMaxListeners'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0xad68,0x100));var _0x8ad6=function(_0x2e0d2a,_0x8d568){_0x2e0d2a=_0x2e0d2a-0x0;var _0x4014f0=_0xad68[_0x2e0d2a];return _0x4014f0;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x8ad6('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8ad6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8ad6('0x2')};function emitEvent(_0x2b533e){return function(_0x186cec,_0x1aec69,_0x11451d){FaxMessageEvents[_0x8ad6('0x3')](_0x2b533e+':'+_0x186cec['id'],_0x186cec);FaxMessageEvents[_0x8ad6('0x3')](_0x2b533e,_0x186cec);_0x11451d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x8ad6('0x4')](e,emitEvent(event));}}module[_0x8ad6('0x5')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index f0f170f..8e4ebd3 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf180=['exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','toLowerCase','direction','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x301082,_0x541737){var _0x110e70=function(_0x420919){while(--_0x420919){_0x301082['push'](_0x301082['shift']());}};_0x110e70(++_0x541737);}(_0xf180,0x103));var _0x0f18=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf180[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0f18('0x0'));var util=require(_0x0f18('0x1'));var logger=require(_0x0f18('0x2'))(_0x0f18('0x3'));var moment=require(_0x0f18('0x4'));var BPromise=require(_0x0f18('0x5'));var rp=require(_0x0f18('0x6'));var fs=require('fs');var path=require(_0x0f18('0x7'));var rimraf=require(_0x0f18('0x8'));var config=require(_0x0f18('0x9'));var attributes=require(_0x0f18('0xa'));module[_0x0f18('0xb')]=function(_0x5caf16,_0x1dfd9d){return _0x5caf16[_0x0f18('0xc')](_0x0f18('0xd'),attributes,{'tableName':_0x0f18('0xe'),'paranoid':![],'indexes':[{'name':_0x0f18('0xf'),'fields':[_0x0f18('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50635f,_0x2aeecc,_0x103009){var _0x1de385=_0x5caf16[_0x0f18('0x11')];var _0x45274=_0x50635f[_0x0f18('0x12')]({'plain':!![]});if(_0x45274['direction'][_0x0f18('0x13')]()==='in'||_0x45274[_0x0f18('0x14')]['toLowerCase']()===_0x0f18('0x15')&&!_0x45274[_0x0f18('0x16')]&&!_['isNil'](_0x45274[_0x0f18('0x17')])){_0x1de385[_0x0f18('0x18')][_0x0f18('0x19')]({'where':{'id':_0x45274[_0x0f18('0x1a')]}})[_0x0f18('0x1b')](function(_0x1c2da6){if(_0x1c2da6){_0x1c2da6['update']({'lastMsgAt':_0x45274[_0x0f18('0x1c')],'lastMsgDirection':_0x45274['direction'][_0x0f18('0x13')]()});}})['catch'](function(_0x98c937){console[_0x0f18('0x1d')](_0x98c937);});}_0x103009();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x004a=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','out','secret','isNil','FaxInteraction','findOne','createdAt','toLowerCase','catch','error','utf8mb4'];(function(_0x2e2533,_0x4399fb){var _0x47d768=function(_0x36574f){while(--_0x36574f){_0x2e2533['push'](_0x2e2533['shift']());}};_0x47d768(++_0x4399fb);}(_0x004a,0x68));var _0xa004=function(_0x55d1d3,_0x414178){_0x55d1d3=_0x55d1d3-0x0;var _0x375aef=_0x004a[_0x55d1d3];return _0x375aef;};'use strict';var _=require(_0xa004('0x0'));var util=require('util');var logger=require(_0xa004('0x1'))('api');var moment=require(_0xa004('0x2'));var BPromise=require(_0xa004('0x3'));var rp=require(_0xa004('0x4'));var fs=require('fs');var path=require(_0xa004('0x5'));var rimraf=require(_0xa004('0x6'));var config=require(_0xa004('0x7'));var attributes=require(_0xa004('0x8'));module[_0xa004('0x9')]=function(_0x2b2518,_0x1bc367){return _0x2b2518['define']('FaxMessage',attributes,{'tableName':_0xa004('0xa'),'paranoid':![],'indexes':[{'name':_0xa004('0xb'),'fields':[_0xa004('0xc')],'type':_0xa004('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1791a0,_0x283d0e,_0x2f77e9){var _0x20c0bb=_0x2b2518[_0xa004('0xe')];var _0x2c9e44=_0x1791a0['get']({'plain':!![]});if(_0x2c9e44[_0xa004('0xf')]['toLowerCase']()==='in'||_0x2c9e44['direction']['toLowerCase']()===_0xa004('0x10')&&!_0x2c9e44[_0xa004('0x11')]&&!_[_0xa004('0x12')](_0x2c9e44['UserId'])){_0x20c0bb[_0xa004('0x13')][_0xa004('0x14')]({'where':{'id':_0x2c9e44['FaxInteractionId']}})['then'](function(_0x4c949c){if(_0x4c949c){_0x4c949c['update']({'lastMsgAt':_0x2c9e44[_0xa004('0x15')],'lastMsgDirection':_0x2c9e44[_0xa004('0xf')][_0xa004('0x16')]()});}})[_0xa004('0x17')](function(_0x2c5c1d){console[_0xa004('0x18')](_0x2c5c1d);});}_0x2f77e9();}},'charset':_0xa004('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5a18e90..5723070 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb458=['info','result','catch','FaxMessage','create','body','options','then','CreateFaxMessage','update','raw','where','attributes','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','register','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xb458,0x103));var _0x8b45=function(_0x6cb701,_0x6e56db){_0x6cb701=_0x6cb701-0x0;var _0x28259e=_0xb458[_0x6cb701];return _0x28259e;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});config[_0x8b45('0x9')]=_[_0x8b45('0xa')](config[_0x8b45('0x9')],{'host':_0x8b45('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b45('0x9')]));require(_0x8b45('0xc'))[_0x8b45('0xd')](socket);function respondWithRpcPromise(_0x2bc809,_0x2f7117,_0x499899){return new BPromise(function(_0x2a4c83,_0x7cc49b){return client['request'](_0x2bc809,_0x499899)['then'](function(_0x5bb708){logger['info'](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));logger[_0x8b45('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2f7117,_0x8b45('0xf'),JSON[_0x8b45('0x11')](_0x5bb708));if(_0x5bb708[_0x8b45('0x12')]){if(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x13')]===0x1f4){logger[_0x8b45('0x12')]('FaxMessage,\x20%s,\x20%s',_0x2f7117,_0x5bb708['error'][_0x8b45('0x14')]);return _0x7cc49b(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);return _0x2a4c83(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}else{logger[_0x8b45('0x15')](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));_0x2a4c83(_0x5bb708[_0x8b45('0x16')][_0x8b45('0x14')]);}})[_0x8b45('0x17')](function(_0x31c6b4){logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x31c6b4);_0x7cc49b(_0x31c6b4);});});}exports['CreateFaxMessage']=function(_0x25e8a1){var _0x2db2d1=this;return new Promise(function(_0x1767d5,_0x46e21a){return db[_0x8b45('0x18')][_0x8b45('0x19')](_0x25e8a1[_0x8b45('0x1a')],{'raw':_0x25e8a1[_0x8b45('0x1b')]?_0x25e8a1['options']['raw']===undefined?!![]:![]:!![]})[_0x8b45('0x1c')](function(_0x580e17){logger[_0x8b45('0x15')](_0x8b45('0x1d'),_0x25e8a1);logger[_0x8b45('0x10')](_0x8b45('0x1d'),_0x25e8a1,JSON[_0x8b45('0x11')](_0x580e17));_0x1767d5(_0x580e17);})[_0x8b45('0x17')](function(_0x32b12b){logger['error']('CreateFaxMessage',_0x32b12b[_0x8b45('0x14')],_0x25e8a1);_0x46e21a(_0x2db2d1[_0x8b45('0x12')](0x1f4,_0x32b12b['message']));});});};exports['UpdateFaxMessage']=function(_0x129c35){var _0x32f6f0=this;return new Promise(function(_0x2ca2d9,_0x2f37bc){return db['FaxMessage'][_0x8b45('0x1e')](_0x129c35[_0x8b45('0x1a')],{'raw':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x20')]||null:null,'attributes':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x21')]||null:null,'limit':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')]['limit']||null:null})[_0x8b45('0x1c')](function(_0x36db96){logger[_0x8b45('0x15')](_0x8b45('0x22'),_0x129c35);logger[_0x8b45('0x10')](_0x8b45('0x22'),_0x129c35,JSON[_0x8b45('0x11')](_0x36db96));_0x2ca2d9(_0x36db96);})[_0x8b45('0x17')](function(_0x5d8938){logger[_0x8b45('0x12')](_0x8b45('0x22'),_0x5d8938[_0x8b45('0x14')],_0x129c35);_0x2f37bc(_0x32f6f0[_0x8b45('0x12')](0x1f4,_0x5d8938[_0x8b45('0x14')]));});});}; \ No newline at end of file +var _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x551232,_0x1b7d64){var _0x55bb29=function(_0x31ad0d){while(--_0x31ad0d){_0x551232['push'](_0x551232['shift']());}};_0x55bb29(++_0x1b7d64);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x4b84[_0x4b1032];return _0x5a1d55;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c22dfa5..195056f 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18bd=['update','emit','removeListener','register','faxMessage:','./faxMessage.events','remove'];(function(_0x5b330e,_0x3f46f1){var _0x460823=function(_0x158a58){while(--_0x158a58){_0x5b330e['push'](_0x5b330e['shift']());}};_0x460823(++_0x3f46f1);}(_0x18bd,0x1b0));var _0xd18b=function(_0xc3d6fc,_0x32ca0b){_0xc3d6fc=_0xc3d6fc-0x0;var _0x4d2acc=_0x18bd[_0xc3d6fc];return _0x4d2acc;};'use strict';var FaxMessageEvents=require(_0xd18b('0x0'));var events=['save',_0xd18b('0x1'),_0xd18b('0x2')];function createListener(_0x40cc3c,_0x4fcd29){return function(_0x3a4d7b){_0x4fcd29[_0xd18b('0x3')](_0x40cc3c,_0x3a4d7b);};}function removeListener(_0x442302,_0x4304b9){return function(){FaxMessageEvents[_0xd18b('0x4')](_0x442302,_0x4304b9);};}exports[_0xd18b('0x5')]=function(_0x3487eb){for(var _0x58d668=0x0,_0x1acb67=events['length'];_0x58d668<_0x1acb67;_0x58d668++){var _0x532e40=events[_0x58d668];var _0x10a994=createListener(_0xd18b('0x6')+_0x532e40,_0x3487eb);FaxMessageEvents['on'](_0x532e40,_0x10a994);}}; \ No newline at end of file +var _0x66f8=['faxMessage:','./faxMessage.events','save','remove','update','emit','register','length'];(function(_0x4dfe12,_0x4ab2c0){var _0x4018e0=function(_0x59bc0e){while(--_0x59bc0e){_0x4dfe12['push'](_0x4dfe12['shift']());}};_0x4018e0(++_0x4ab2c0);}(_0x66f8,0x119));var _0x866f=function(_0x383036,_0x3b57ba){_0x383036=_0x383036-0x0;var _0x5151c6=_0x66f8[_0x383036];return _0x5151c6;};'use strict';var FaxMessageEvents=require(_0x866f('0x0'));var events=[_0x866f('0x1'),_0x866f('0x2'),_0x866f('0x3')];function createListener(_0x44adfc,_0x2c5276){return function(_0x2bf55f){_0x2c5276[_0x866f('0x4')](_0x44adfc,_0x2bf55f);};}function removeListener(_0x7f3670,_0x363ce2){return function(){FaxMessageEvents['removeListener'](_0x7f3670,_0x363ce2);};}exports[_0x866f('0x5')]=function(_0x477943){for(var _0x1d833d=0x0,_0x1ef18f=events[_0x866f('0x6')];_0x1d833d<_0x1ef18f;_0x1d833d++){var _0x508aef=events[_0x1d833d];var _0x1cd8d1=createListener(_0x866f('0x7')+_0x508aef,_0x477943);FaxMessageEvents['on'](_0x508aef,_0x1cd8d1);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 43e7ba5..22db7e2 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c76=['path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util'];(function(_0x7642c,_0x2ec4b0){var _0x5412fd=function(_0xffc8e3){while(--_0xffc8e3){_0x7642c['push'](_0x7642c['shift']());}};_0x5412fd(++_0x2ec4b0);}(_0x6c76,0x184));var _0x66c7=function(_0x554769,_0x1b3ea1){_0x554769=_0x554769-0x0;var _0x515264=_0x6c76[_0x554769];return _0x515264;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./faxMessage.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['download']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),interaction[_0x66c7('0xe')](_0x66c7('0xf'),_0x66c7('0x10')),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);router[_0x66c7('0x12')](_0x66c7('0x14'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x15')]);router[_0x66c7('0x12')](_0x66c7('0x16'),auth[_0x66c7('0x8')](),controller['reject']);router[_0x66c7('0x17')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x18')]);module[_0x66c7('0x19')]=router; \ No newline at end of file +var _0xc6d8=['describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','delete','exports','multer','path','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x2dc1d3,_0x27595b){var _0x1366f7=function(_0x5f2961){while(--_0x5f2961){_0x2dc1d3['push'](_0x2dc1d3['shift']());}};_0x1366f7(++_0x27595b);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x3e8f4d,_0x2973ed){_0x3e8f4d=_0x3e8f4d-0x0;var _0x590a2e=_0xc6d8[_0x3e8f4d];return _0x590a2e;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),auth['isAuthenticated'](),controller[_0x8c6d('0xa')]);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth['isAuthenticated'](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0x6')](_0x8c6d('0xd'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')]('/',auth[_0x8c6d('0x7')](),interaction[_0x8c6d('0x10')]('fax',_0x8c6d('0x11')),controller['create']);router['put'](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x12')]);router[_0x8c6d('0x13')](_0x8c6d('0x14'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x15')]);router[_0x8c6d('0x13')](_0x8c6d('0x16'),auth[_0x8c6d('0x7')](),controller['reject']);router[_0x8c6d('0x17')]('/:id',auth[_0x8c6d('0x7')](),controller['destroy']);module[_0x8c6d('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index c67957e..3926a32 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91ed=['ENUM','rrmemory','roundrobin','STRING','name','INTEGER'];(function(_0x1b76cd,_0x3cf9f9){var _0x5045aa=function(_0xd50b64){while(--_0xd50b64){_0x1b76cd['push'](_0x1b76cd['shift']());}};_0x5045aa(++_0x3cf9f9);}(_0x91ed,0x99));var _0xd91e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x91ed[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd91e('0x0')],'unique':_0xd91e('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd91e('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd91e('0x3')](_0xd91e('0x4'),'beepall',_0xd91e('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3ecb=['rrmemory','sequelize','name','STRING','INTEGER','ENUM'];(function(_0x58995d,_0x169d76){var _0x41680f=function(_0x52cdf6){while(--_0x52cdf6){_0x58995d['push'](_0x58995d['shift']());}};_0x41680f(++_0x169d76);}(_0x3ecb,0x181));var _0xb3ec=function(_0x544baa,_0x1b17fe){_0x544baa=_0x544baa-0x0;var _0x5e8cc1=_0x3ecb[_0x544baa];return _0x5e8cc1;};'use strict';var Sequelize=require(_0xb3ec('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb3ec('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb3ec('0x2')]},'timeout':{'type':Sequelize[_0xb3ec('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb3ec('0x4')](_0xb3ec('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb3ec('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 449629d..eaa5adb 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['userFaxQueue:remove','addAgents','omit','isArray','getAgents','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','destroy','then','FaxQueues','name','send','map','FaxQueue','rawAttributes','key','getOptions','where','include','query','findAll','catch','params','model','keys','filters','intersection','fields','attributes','length','includeAll','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','update','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','merge','UserFaxQueue','findAndCountAll','updatedAt','createdAt','rows','SIP','faxPause','Team','getTeams','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','emit'];(function(_0x78dbed,_0x50564a){var _0x3aafac=function(_0x1ac564){while(--_0x1ac564){_0x78dbed['push'](_0x78dbed['shift']());}};_0x3aafac(++_0x50564a);}(_0x524e,0x15e));var _0xe524=function(_0x2ab00f,_0x16c62a){_0x2ab00f=_0x2ab00f-0x0;var _0x48e529=_0x524e[_0x2ab00f];return _0x48e529;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe524('0x0'));var squel=require(_0xe524('0x1'));var Redis=require(_0xe524('0x2'));var qs=require(_0xe524('0x3'));var logger=require(_0xe524('0x4'))(_0xe524('0x5'));var config=require(_0xe524('0x6'));var db=require(_0xe524('0x7'))['db'];config[_0xe524('0x8')]=_[_0xe524('0x9')](config['redis'],{'host':_0xe524('0xa'),'port':0x18eb});var socket=require(_0xe524('0xb'))(new Redis(config[_0xe524('0x8')]));require('./faxQueue.socket')[_0xe524('0xc')](socket);function respondWithStatusCode(_0x3e4cda,_0x24114d){_0x24114d=_0x24114d||0xcc;return function(_0x1f36e5){if(_0x1f36e5){return _0x3e4cda[_0xe524('0xd')](_0x24114d);}return _0x3e4cda[_0xe524('0xe')](_0x24114d)[_0xe524('0xf')]();};}function respondWithResult(_0xb3eb9f,_0x1b75bd){_0x1b75bd=_0x1b75bd||0xc8;return function(_0x1641ec){if(_0x1641ec){return _0xb3eb9f[_0xe524('0xe')](_0x1b75bd)[_0xe524('0x10')](_0x1641ec);}};}function respondWithFilteredResult(_0x1184df,_0x2f0e86){return function(_0x1bdcee){if(_0x1bdcee){var _0x26cc77=typeof _0x2f0e86['offset']==='undefined'&&typeof _0x2f0e86[_0xe524('0x11')]===_0xe524('0x12');var _0x11adbc=_0x1bdcee[_0xe524('0x13')];var _0x20a852=_0x26cc77?0x0:_0x2f0e86['offset'];var _0x12ff75=_0x26cc77?_0x1bdcee['count']:_0x2f0e86[_0xe524('0x14')]+_0x2f0e86[_0xe524('0x11')];var _0x48165e;if(_0x12ff75>=_0x11adbc){_0x12ff75=_0x11adbc;_0x48165e=0xc8;}else{_0x48165e=0xce;}_0x1184df[_0xe524('0xe')](_0x48165e);return _0x1184df['set'](_0xe524('0x15'),_0x20a852+'-'+_0x12ff75+'/'+_0x11adbc)['json'](_0x1bdcee);}return null;};}function saveUpdates(_0x29a031){return function(_0x5f17fe){if(_0x5f17fe){return _0x5f17fe['update'](_0x29a031)['then'](function(_0x3a4027){return _0x3a4027;});}return null;};}function removeEntity(_0x4f1dfb){return function(_0x11b2a1){if(_0x11b2a1){return _0x11b2a1[_0xe524('0x16')]()[_0xe524('0x17')](function(){var _0x209d0b=_0x11b2a1['get']({'plain':!![]});var _0x1fd93a=_0xe524('0x18');return db['UserProfileResource'][_0xe524('0x16')]({'where':{'type':_0x1fd93a,'resourceId':_0x209d0b['id']}})[_0xe524('0x17')](function(){return _0x11b2a1;});})[_0xe524('0x17')](function(){_0x4f1dfb[_0xe524('0xe')](0xcc)[_0xe524('0xf')]();});}};}function handleEntityNotFound(_0x1cab6c){return function(_0xbf059b){if(!_0xbf059b){_0x1cab6c[_0xe524('0xd')](0x194);}return _0xbf059b;};}function handleError(_0x7dfe97,_0x5c4d21){_0x5c4d21=_0x5c4d21||0x1f4;return function(_0x7d1f92){logger['error'](_0x7d1f92['stack']);if(_0x7d1f92[_0xe524('0x19')]){delete _0x7d1f92[_0xe524('0x19')];}_0x7dfe97[_0xe524('0xe')](_0x5c4d21)[_0xe524('0x1a')](_0x7d1f92);};}exports['index']=function(_0x158f07,_0x4a03bc){var _0x17e245={};var _0xcf5db={'count':0x0,'rows':[]};var _0xd62772=_[_0xe524('0x1b')](db[_0xe524('0x1c')][_0xe524('0x1d')],function(_0x2141db){return{'name':_0x2141db['fieldName'],'type':_0x2141db['type'][_0xe524('0x1e')]};});_0x17e245=qs[_0xe524('0x1f')](_0xd62772,_0x158f07);var _0x476572={'where':_0x17e245[_0xe524('0x20')]};return db[_0xe524('0x1c')]['count'](_0x476572)['then'](function(_0x4b1ff){_0xcf5db[_0xe524('0x13')]=_0x4b1ff;_0x17e245[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x158f07[_0xe524('0x22')]);return db['FaxQueue'][_0xe524('0x23')](_0x17e245);})[_0xe524('0x17')](function(_0x4a4e15){_0xcf5db['rows']=_0x4a4e15;return _0xcf5db;})[_0xe524('0x17')](respondWithFilteredResult(_0x4a03bc,_0x17e245))[_0xe524('0x24')](handleError(_0x4a03bc,null));};exports['show']=function(_0x31d4a7,_0x535354){var _0x3fec06={'raw':!![],'where':{'id':_0x31d4a7[_0xe524('0x25')]['id']}},_0x54af2a={};_0x54af2a[_0xe524('0x26')]=_[_0xe524('0x27')](db['FaxQueue'][_0xe524('0x1d')]);_0x54af2a['query']=_[_0xe524('0x27')](_0x31d4a7[_0xe524('0x22')]);_0x54af2a[_0xe524('0x28')]=_['intersection'](_0x54af2a[_0xe524('0x26')],_0x54af2a[_0xe524('0x22')]);_0x3fec06['attributes']=_[_0xe524('0x29')](_0x54af2a[_0xe524('0x26')],qs[_0xe524('0x2a')](_0x31d4a7[_0xe524('0x22')]['fields']));_0x3fec06[_0xe524('0x2b')]=_0x3fec06[_0xe524('0x2b')][_0xe524('0x2c')]?_0x3fec06[_0xe524('0x2b')]:_0x54af2a[_0xe524('0x26')];if(_0x31d4a7[_0xe524('0x22')][_0xe524('0x2d')]){_0x3fec06[_0xe524('0x21')]=[{'all':!![]}];}_0x3fec06=_['merge']({},_0x3fec06,_0x31d4a7[_0xe524('0x2e')]);return db['FaxQueue'][_0xe524('0x2f')](_0x3fec06)[_0xe524('0x17')](handleEntityNotFound(_0x535354,null))['then'](respondWithResult(_0x535354,null))[_0xe524('0x24')](handleError(_0x535354,null));};exports['create']=function(_0x1c3aae,_0x41af26){return db[_0xe524('0x1c')][_0xe524('0x30')](_0x1c3aae[_0xe524('0x31')],{})[_0xe524('0x17')](function(_0x3a0d20){var _0x13762c=_0x1c3aae['user'][_0xe524('0x32')]({'plain':!![]});if(!_0x13762c)throw new Error(_0xe524('0x33'));if(_0x13762c[_0xe524('0x34')]===_0xe524('0x35')){var _0xbd4ae3=_0x3a0d20[_0xe524('0x32')]({'plain':!![]});var _0x1d9648=_0xe524('0x18');return db['UserProfileSection'][_0xe524('0x2f')]({'where':{'name':_0x1d9648,'userProfileId':_0x13762c[_0xe524('0x36')]},'raw':!![]})[_0xe524('0x17')](function(_0x59781b){if(_0x59781b&&_0x59781b[_0xe524('0x37')]===0x0){return db['UserProfileResource'][_0xe524('0x30')]({'name':_0xbd4ae3[_0xe524('0x19')],'resourceId':_0xbd4ae3['id'],'type':_0x59781b[_0xe524('0x19')],'sectionId':_0x59781b['id']},{})[_0xe524('0x17')](function(){return _0x3a0d20;});}else{return _0x3a0d20;}})[_0xe524('0x24')](function(_0x4746cd){logger[_0xe524('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4746cd);throw _0x4746cd;});}return _0x3a0d20;})[_0xe524('0x17')](respondWithResult(_0x41af26,0xc9))[_0xe524('0x24')](handleError(_0x41af26,null));};exports[_0xe524('0x39')]=function(_0x376505,_0x438962){if(_0x376505[_0xe524('0x31')]['id']){delete _0x376505['body']['id'];}return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x376505[_0xe524('0x25')]['id']}})['then'](handleEntityNotFound(_0x438962,null))[_0xe524('0x17')](saveUpdates(_0x376505['body'],null))['then'](respondWithResult(_0x438962,null))[_0xe524('0x24')](handleError(_0x438962,null));};exports[_0xe524('0x16')]=function(_0x4da26f,_0x1e4e9f){return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x4da26f[_0xe524('0x25')]['id']}})['then'](handleEntityNotFound(_0x1e4e9f,null))['then'](removeEntity(_0x1e4e9f,null))[_0xe524('0x24')](handleError(_0x1e4e9f,null));};exports[_0xe524('0x3a')]=function(_0x53c204,_0x30d278){return db['FaxQueue'][_0xe524('0x3a')]()[_0xe524('0x17')](respondWithResult(_0x30d278,null))[_0xe524('0x24')](handleError(_0x30d278,null));};exports[_0xe524('0x3b')]=function(_0xbde17b,_0x36f90a){var _0x305503={'raw':!![],'where':{}},_0x22fb42={},_0x1642a7;return db[_0xe524('0x1c')][_0xe524('0x3c')]({'where':{'id':_0xbde17b[_0xe524('0x25')]['id']}})[_0xe524('0x17')](handleEntityNotFound(_0x36f90a,null))[_0xe524('0x17')](function(_0x37d44d){if(_0x37d44d){_0x1642a7=_0x37d44d['get']({'plain':!![]});_0x22fb42[_0xe524('0x26')]=_['keys'](db['UserFaxQueue'][_0xe524('0x1d')]);_0x22fb42['query']=_[_0xe524('0x27')](_0xbde17b[_0xe524('0x22')]);_0x22fb42['filters']=_[_0xe524('0x29')](_0x22fb42['model'],_0x22fb42['query']);_0x305503[_0xe524('0x2b')]=_[_0xe524('0x29')](_0x22fb42[_0xe524('0x26')],qs['fields'](_0xbde17b['query']['fields']));_0x305503['attributes']=_0x305503['attributes']['length']?_0x305503[_0xe524('0x2b')]:_0x22fb42[_0xe524('0x26')];if(!_0xbde17b['query'][_0xe524('0x3d')](_0xe524('0x3e'))){_0x305503[_0xe524('0x11')]=qs[_0xe524('0x11')](_0xbde17b[_0xe524('0x22')]['limit']);_0x305503[_0xe524('0x14')]=qs[_0xe524('0x14')](_0xbde17b[_0xe524('0x22')]['offset']);}_0x305503[_0xe524('0x3f')]=qs['sort'](_0xbde17b[_0xe524('0x22')][_0xe524('0x40')]);_0x305503[_0xe524('0x20')]=qs[_0xe524('0x28')](_[_0xe524('0x41')](_0xbde17b[_0xe524('0x22')],_0x22fb42[_0xe524('0x28')]));_0x305503[_0xe524('0x20')][_0xe524('0x42')]=_0x37d44d['id'];if(_0xbde17b[_0xe524('0x22')][_0xe524('0x43')]){_0x305503[_0xe524('0x20')]=_['merge'](_0x305503['where'],{'$or':_['map'](_0x305503[_0xe524('0x2b')],function(_0x469f67){var _0xe7de83={};_0xe7de83[_0x469f67]={'$like':'%'+_0xbde17b[_0xe524('0x22')][_0xe524('0x43')]+'%'};return _0xe7de83;})});}_0x305503=_[_0xe524('0x44')]({},_0x305503,_0xbde17b[_0xe524('0x2e')]);return db[_0xe524('0x45')][_0xe524('0x23')](_0x305503);}})[_0xe524('0x17')](function(_0x3cc1ab){if(_0x3cc1ab){return db['User'][_0xe524('0x46')]({'where':{'id':_[_0xe524('0x1b')](_0x3cc1ab,'UserId'),'role':'agent'},'attributes':['id','name','faxPause',_0xe524('0x47'),_0xe524('0x48')]});}})[_0xe524('0x17')](function(_0x8a2c00){if(_0x8a2c00){return{'count':_0x8a2c00['count'],'rows':_[_0xe524('0x1b')](_0x8a2c00[_0xe524('0x49')],function(_0xefe0e0){return{'membername':_0xefe0e0[_0xe524('0x19')],'UserId':_0xefe0e0['id'],'queue_name':_0x1642a7['name'],'FaxQueueId':_0x1642a7['id'],'interface':util['format']('%s/%s',_0xe524('0x4a'),_0xefe0e0['name']),'penalty':0x0,'paused':_0xefe0e0[_0xe524('0x4b')],'createdAt':_0xefe0e0[_0xe524('0x48')],'updatedAt':_0xefe0e0[_0xe524('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe524('0x17')](respondWithFilteredResult(_0x36f90a,_0x305503))[_0xe524('0x24')](handleError(_0x36f90a,null));};exports['getTeams']=function(_0x5d0507,_0x29a519){var _0x415476={};var _0x3b0c8f={};var _0x8e6e1f;var _0x214c66;return db[_0xe524('0x1c')]['findOne']({'where':{'id':_0x5d0507[_0xe524('0x25')]['id']}})[_0xe524('0x17')](handleEntityNotFound(_0x29a519,null))[_0xe524('0x17')](function(_0x5d3b9c){if(_0x5d3b9c){_0x8e6e1f=_0x5d3b9c;_0x3b0c8f[_0xe524('0x26')]=_[_0xe524('0x27')](db[_0xe524('0x4c')]['rawAttributes']);_0x3b0c8f['query']=_[_0xe524('0x27')](_0x5d0507[_0xe524('0x22')]);_0x3b0c8f[_0xe524('0x28')]=_[_0xe524('0x29')](_0x3b0c8f[_0xe524('0x26')],_0x3b0c8f['query']);_0x415476[_0xe524('0x2b')]=_[_0xe524('0x29')](_0x3b0c8f[_0xe524('0x26')],qs[_0xe524('0x2a')](_0x5d0507[_0xe524('0x22')][_0xe524('0x2a')]));_0x415476[_0xe524('0x2b')]=_0x415476[_0xe524('0x2b')][_0xe524('0x2c')]?_0x415476[_0xe524('0x2b')]:_0x3b0c8f[_0xe524('0x26')];_0x415476['order']=qs[_0xe524('0x40')](_0x5d0507[_0xe524('0x22')][_0xe524('0x40')]);_0x415476[_0xe524('0x20')]=qs[_0xe524('0x28')](_['pick'](_0x5d0507[_0xe524('0x22')],_0x3b0c8f[_0xe524('0x28')]));if(_0x5d0507[_0xe524('0x22')][_0xe524('0x43')]){_0x415476[_0xe524('0x20')]=_[_0xe524('0x44')](_0x415476[_0xe524('0x20')],{'$or':_['map'](_0x415476[_0xe524('0x2b')],function(_0x245501){var _0x35ca22={};_0x35ca22[_0x245501]={'$like':'%'+_0x5d0507[_0xe524('0x22')]['filter']+'%'};return _0x35ca22;})});}_0x415476=_[_0xe524('0x44')]({},_0x415476,_0x5d0507['options']);return _0x8e6e1f[_0xe524('0x4d')](_0x415476);}})[_0xe524('0x17')](function(_0x52e84e){if(_0x52e84e){_0x214c66=_0x52e84e['length'];if(!_0x5d0507[_0xe524('0x22')][_0xe524('0x3d')](_0xe524('0x3e'))){_0x415476[_0xe524('0x11')]=qs[_0xe524('0x11')](_0x5d0507['query'][_0xe524('0x11')]);_0x415476[_0xe524('0x14')]=qs[_0xe524('0x14')](_0x5d0507[_0xe524('0x22')][_0xe524('0x14')]);}return _0x8e6e1f['getTeams'](_0x415476);}})[_0xe524('0x17')](function(_0x629baa){if(_0x629baa){return _0x629baa?{'count':_0x214c66,'rows':_0x629baa}:null;}})[_0xe524('0x17')](respondWithResult(_0x29a519,null))[_0xe524('0x24')](handleError(_0x29a519,null));};exports[_0xe524('0x4e')]=function(_0x1bde09,_0x54a1e1){var _0x42b95d=_0x1bde09[_0xe524('0x31')][_0xe524('0x4f')];return db['Team'][_0xe524('0x23')]({'where':{'id':_0x42b95d},'attributes':['id'],'include':[{'model':db[_0xe524('0x50')],'as':'Agents','attributes':['id',_0xe524('0x19'),_0xe524('0x51'),_0xe524('0x52'),_0xe524('0x53')],'raw':!![]}]})[_0xe524('0x17')](function(_0xf6934){if(_0xf6934){var _0x52e1bd=_[_0xe524('0x54')](_0xf6934,function(_0x3fd61e){var _0x410bd3=_0x3fd61e[_0xe524('0x32')]({'plain':!![]});return _0x410bd3[_0xe524('0x55')];});return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x1bde09[_0xe524('0x25')]['id']}})[_0xe524('0x17')](function(_0x16893f){return db[_0xe524('0x56')][_0xe524('0x57')](function(_0x3c82e7){return _0x16893f[_0xe524('0x4e')](_0x42b95d,{'transaction':_0x3c82e7})[_0xe524('0x17')](function(){return BPromise['each'](_0x52e1bd,function(_0x933c2a){return db[_0xe524('0x45')][_0xe524('0x58')]({'where':{'UserId':_0x933c2a['id'],'FaxQueueId':_0x1bde09['params']['id']},'transaction':_0x3c82e7});});})[_0xe524('0x17')](function(){_0x52e1bd[_0xe524('0x59')](function(_0x5c29aa){socket['emit'](_0xe524('0x5a'),{'UserId':_0x5c29aa['id'],'FaxQueueId':_0x16893f['id']});});});});});}})['then'](respondWithStatusCode(_0x54a1e1,null))[_0xe524('0x24')](handleError(_0x54a1e1,null));};exports['removeTeams']=function(_0x22b3fd,_0x1ed60b){return db[_0xe524('0x4c')][_0xe524('0x23')]({'where':{'id':_0x22b3fd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe524('0x50')],'as':_0xe524('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1ed60b,null))[_0xe524('0x17')](function(_0x449842){var _0x1f3ed1=_['map'](_0x449842,'id');var _0x19b063=[];var _0x140a4e=[];var _0x3f9d65=squel[_0xe524('0x5b')]();_0x3f9d65[_0xe524('0x5c')](_0xe524('0x5d'))['from']('team_has_fax_queues','tq')[_0xe524('0x5e')]('user_has_teams','ut',_0xe524('0x5f'))[_0xe524('0x20')](_0xe524('0x60'),_0x22b3fd['params']['id']);for(var _0x216a77=0x0;_0x216a77<_0x449842['length'];_0x216a77+=0x1){let _0x1681c5=_0x449842[_0x216a77];for(var _0x41e693=0x0;_0x41e693<_0x1681c5[_0xe524('0x55')][_0xe524('0x2c')];_0x41e693+=0x1){let _0x382ecc=_0x1681c5[_0xe524('0x55')][_0x41e693];var _0x50f5e3=_0x3f9d65[_0xe524('0x61')]();_0x50f5e3[_0xe524('0x20')](_0xe524('0x62'),_0x382ecc['id']);_0x140a4e['push'](db[_0xe524('0x56')][_0xe524('0x22')](_0x50f5e3['toString'](),{'type':db[_0xe524('0x56')][_0xe524('0x63')][_0xe524('0x64')]})[_0xe524('0x17')](function(_0x58d29e){if(_0x58d29e[_0xe524('0x2c')]===0x1){return _0x382ecc['id'];}else{var _0x20779a=_[_0xe524('0x65')](_['map'](_0x58d29e,_0xe524('0x66')),function(_0x494333){return _[_0xe524('0x67')](_0x1f3ed1,_0x494333);});if(_0x20779a){return _0x382ecc['id'];}}}));}}return BPromise[_0xe524('0x68')](_0x140a4e)[_0xe524('0x17')](function(_0x4d0ce5){_0x19b063=_(_0x19b063)[_0xe524('0x69')](_0x4d0ce5)[_0xe524('0x6a')]()[_0xe524('0x6b')]();return db['FaxQueue']['find']({'where':{'id':_0x22b3fd[_0xe524('0x25')]['id']}})['then'](function(_0x903e24){return db['sequelize'][_0xe524('0x57')](function(_0x246c62){return _0x903e24['removeTeams'](_0x22b3fd[_0xe524('0x22')][_0xe524('0x4f')],{'transaction':_0x246c62})['then'](function(){if(!_['isEmpty'](_0x19b063)){return _0x903e24[_0xe524('0x6c')](_0x19b063,{'transaction':_0x246c62});}})[_0xe524('0x17')](function(){_0x19b063[_0xe524('0x59')](function(_0x5b6313){socket[_0xe524('0x6d')](_0xe524('0x6e'),{'UserId':_0x5b6313,'FaxQueueId':_0x903e24['id']});});});});});});})[_0xe524('0x17')](respondWithStatusCode(_0x1ed60b,null))[_0xe524('0x24')](handleError(_0x1ed60b,null));};exports[_0xe524('0x6f')]=function(_0x1b2277,_0x57501c){return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x1b2277['params']['id']}})['then'](handleEntityNotFound(_0x57501c,null))[_0xe524('0x17')](function(_0x1fb002){if(_0x1fb002){return _0x1fb002[_0xe524('0x6f')](_0x1b2277[_0xe524('0x31')]['ids'],_[_0xe524('0x70')](_0x1b2277[_0xe524('0x31')],['ids','id'])||{})['spread'](function(_0x475f24){for(var _0x269e79=0x0;_0x269e79<_0x1b2277[_0xe524('0x31')][_0xe524('0x4f')][_0xe524('0x2c')];_0x269e79+=0x1){socket[_0xe524('0x6d')]('userFaxQueue:save',{'UserId':Number(_0x1b2277['body'][_0xe524('0x4f')][_0x269e79]),'FaxQueueId':Number(_0x1b2277[_0xe524('0x25')]['id'])});}return _0x475f24;});}})['then'](respondWithResult(_0x57501c,null))['catch'](handleError(_0x57501c,null));};exports[_0xe524('0x6c')]=function(_0x187872,_0x30fa81){return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x187872[_0xe524('0x25')]['id']}})['then'](handleEntityNotFound(_0x30fa81,null))['then'](function(_0x3e8668){if(_0x3e8668){return _0x3e8668[_0xe524('0x6c')](_0x187872[_0xe524('0x22')][_0xe524('0x4f')])[_0xe524('0x17')](function(){if(_[_0xe524('0x71')](_0x187872[_0xe524('0x22')][_0xe524('0x4f')])){for(var _0x507a9d=0x0;_0x507a9d<_0x187872[_0xe524('0x22')][_0xe524('0x4f')][_0xe524('0x2c')];_0x507a9d+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x187872[_0xe524('0x22')][_0xe524('0x4f')][_0x507a9d]),'FaxQueueId':Number(_0x187872[_0xe524('0x25')]['id'])});}}else{socket[_0xe524('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x187872[_0xe524('0x22')][_0xe524('0x4f')]),'FaxQueueId':Number(_0x187872[_0xe524('0x25')]['id'])});}});}})[_0xe524('0x17')](respondWithStatusCode(_0x30fa81,null))[_0xe524('0x24')](handleError(_0x30fa81,null));};exports['getAgents']=function(_0x2fa9c7,_0x5d8c54){var _0x4217ff={};var _0x37f754={};var _0x4a86bf;var _0x412e2f;return db[_0xe524('0x1c')]['findOne']({'where':{'id':_0x2fa9c7[_0xe524('0x25')]['id']}})['then'](handleEntityNotFound(_0x5d8c54,null))[_0xe524('0x17')](function(_0xf2058c){if(_0xf2058c){_0x4a86bf=_0xf2058c;_0x37f754[_0xe524('0x26')]=_[_0xe524('0x27')](db[_0xe524('0x50')][_0xe524('0x1d')]);_0x37f754[_0xe524('0x22')]=_[_0xe524('0x27')](_0x2fa9c7['query']);_0x37f754[_0xe524('0x28')]=_['intersection'](_0x37f754['model'],_0x37f754[_0xe524('0x22')]);_0x4217ff['attributes']=_[_0xe524('0x29')](_0x37f754[_0xe524('0x26')],qs[_0xe524('0x2a')](_0x2fa9c7[_0xe524('0x22')][_0xe524('0x2a')]));_0x4217ff[_0xe524('0x2b')]=_0x4217ff['attributes']['length']?_0x4217ff[_0xe524('0x2b')]:_0x37f754[_0xe524('0x26')];_0x4217ff[_0xe524('0x3f')]=qs[_0xe524('0x40')](_0x2fa9c7[_0xe524('0x22')][_0xe524('0x40')]);_0x4217ff[_0xe524('0x20')]=qs[_0xe524('0x28')](_[_0xe524('0x41')](_0x2fa9c7[_0xe524('0x22')],_0x37f754['filters']));if(_0x2fa9c7[_0xe524('0x22')][_0xe524('0x43')]){_0x4217ff[_0xe524('0x20')]=_[_0xe524('0x44')](_0x4217ff[_0xe524('0x20')],{'$or':_[_0xe524('0x1b')](_0x4217ff['attributes'],function(_0x1cc750){var _0x43f3bf={};_0x43f3bf[_0x1cc750]={'$like':'%'+_0x2fa9c7[_0xe524('0x22')][_0xe524('0x43')]+'%'};return _0x43f3bf;})});}_0x4217ff=_[_0xe524('0x44')]({},_0x4217ff,_0x2fa9c7[_0xe524('0x2e')]);return _0x4a86bf[_0xe524('0x72')](_0x4217ff);}})[_0xe524('0x17')](function(_0x599bd9){if(_0x599bd9){_0x412e2f=_0x599bd9['length'];if(!_0x2fa9c7['query'][_0xe524('0x3d')](_0xe524('0x3e'))){_0x4217ff['limit']=qs[_0xe524('0x11')](_0x2fa9c7[_0xe524('0x22')]['limit']);_0x4217ff[_0xe524('0x14')]=qs[_0xe524('0x14')](_0x2fa9c7['query'][_0xe524('0x14')]);}return _0x4a86bf[_0xe524('0x72')](_0x4217ff);}})[_0xe524('0x17')](function(_0x542182){if(_0x542182){return _0x542182?{'count':_0x412e2f,'rows':_0x542182}:null;}})[_0xe524('0x17')](respondWithResult(_0x5d8c54,null))[_0xe524('0x24')](handleError(_0x5d8c54,null));}; \ No newline at end of file +var _0x7412=['localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','then','destroy','get','FaxQueues','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','getOptions','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','fields','includeAll','options','find','create','body','user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserFaxQueue','intersection','length','hasOwnProperty','nolimit','sort','where','FaxQueueId','filter','merge','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','order','ids','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','squel','../../components/parsers/qs','redis'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0x7412,0x161));var _0x2741=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7412[_0x3e5086];return _0xfeb102;};'use strict';var BPromise=require(_0x2741('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x2741('0x1'));var Redis=require('ioredis');var qs=require(_0x2741('0x2'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x2741('0x3')],{'host':_0x2741('0x4'),'port':0x18eb});var socket=require(_0x2741('0x5'))(new Redis(config['redis']));require(_0x2741('0x6'))[_0x2741('0x7')](socket);function respondWithStatusCode(_0x3883ec,_0x2f3fb1){_0x2f3fb1=_0x2f3fb1||0xcc;return function(_0x5109f1){if(_0x5109f1){return _0x3883ec[_0x2741('0x8')](_0x2f3fb1);}return _0x3883ec[_0x2741('0x9')](_0x2f3fb1)[_0x2741('0xa')]();};}function respondWithResult(_0x4214ae,_0x67581){_0x67581=_0x67581||0xc8;return function(_0x4eb13b){if(_0x4eb13b){return _0x4214ae[_0x2741('0x9')](_0x67581)[_0x2741('0xb')](_0x4eb13b);}};}function respondWithFilteredResult(_0x127aff,_0x24866a){return function(_0x3c83ba){if(_0x3c83ba){var _0x3736f4=typeof _0x24866a[_0x2741('0xc')]===_0x2741('0xd')&&typeof _0x24866a['limit']===_0x2741('0xd');var _0xecf933=_0x3c83ba[_0x2741('0xe')];var _0x4347d5=_0x3736f4?0x0:_0x24866a[_0x2741('0xc')];var _0xc535ee=_0x3736f4?_0x3c83ba[_0x2741('0xe')]:_0x24866a[_0x2741('0xc')]+_0x24866a[_0x2741('0xf')];var _0x56a04c;if(_0xc535ee>=_0xecf933){_0xc535ee=_0xecf933;_0x56a04c=0xc8;}else{_0x56a04c=0xce;}_0x127aff[_0x2741('0x9')](_0x56a04c);return _0x127aff[_0x2741('0x10')]('Content-Range',_0x4347d5+'-'+_0xc535ee+'/'+_0xecf933)[_0x2741('0xb')](_0x3c83ba);}return null;};}function saveUpdates(_0x4537c5){return function(_0x527242){if(_0x527242){return _0x527242['update'](_0x4537c5)[_0x2741('0x11')](function(_0x8fb51f){return _0x8fb51f;});}return null;};}function removeEntity(_0x14cfa8){return function(_0x27feb7){if(_0x27feb7){return _0x27feb7[_0x2741('0x12')]()[_0x2741('0x11')](function(){var _0x1d3720=_0x27feb7[_0x2741('0x13')]({'plain':!![]});var _0x5c289d=_0x2741('0x14');return db['UserProfileResource'][_0x2741('0x12')]({'where':{'type':_0x5c289d,'resourceId':_0x1d3720['id']}})['then'](function(){return _0x27feb7;});})['then'](function(){_0x14cfa8[_0x2741('0x9')](0xcc)[_0x2741('0xa')]();});}};}function handleEntityNotFound(_0x33acb2){return function(_0x5b4b49){if(!_0x5b4b49){_0x33acb2[_0x2741('0x8')](0x194);}return _0x5b4b49;};}function handleError(_0xf6861e,_0x462c1e){_0x462c1e=_0x462c1e||0x1f4;return function(_0x7da79c){logger['error'](_0x7da79c[_0x2741('0x15')]);if(_0x7da79c[_0x2741('0x16')]){delete _0x7da79c['name'];}_0xf6861e['status'](_0x462c1e)[_0x2741('0x17')](_0x7da79c);};}exports['index']=function(_0x5a5706,_0x303d6e){var _0x4d09c9={};var _0x52f2ab={'count':0x0,'rows':[]};var _0x23cb80=_[_0x2741('0x18')](db[_0x2741('0x19')][_0x2741('0x1a')],function(_0x53aab8){return{'name':_0x53aab8[_0x2741('0x1b')],'type':_0x53aab8[_0x2741('0x1c')]['key']};});_0x4d09c9=qs[_0x2741('0x1d')](_0x23cb80,_0x5a5706);var _0x3a11ae={'where':_0x4d09c9['where']};return db[_0x2741('0x19')]['count'](_0x3a11ae)[_0x2741('0x11')](function(_0x57b16d){_0x52f2ab[_0x2741('0xe')]=_0x57b16d;_0x4d09c9['include']=qs[_0x2741('0x1e')](_0x5a5706[_0x2741('0x1f')]);return db[_0x2741('0x19')][_0x2741('0x20')](_0x4d09c9);})[_0x2741('0x11')](function(_0x29e4c5){_0x52f2ab[_0x2741('0x21')]=_0x29e4c5;return _0x52f2ab;})[_0x2741('0x11')](respondWithFilteredResult(_0x303d6e,_0x4d09c9))[_0x2741('0x22')](handleError(_0x303d6e,null));};exports[_0x2741('0x23')]=function(_0x587993,_0x4f698b){var _0x35edbf={'raw':!![],'where':{'id':_0x587993[_0x2741('0x24')]['id']}},_0x805b49={};_0x805b49[_0x2741('0x25')]=_[_0x2741('0x26')](db[_0x2741('0x19')]['rawAttributes']);_0x805b49[_0x2741('0x1f')]=_['keys'](_0x587993['query']);_0x805b49[_0x2741('0x27')]=_['intersection'](_0x805b49[_0x2741('0x25')],_0x805b49[_0x2741('0x1f')]);_0x35edbf[_0x2741('0x28')]=_['intersection'](_0x805b49[_0x2741('0x25')],qs['fields'](_0x587993[_0x2741('0x1f')][_0x2741('0x29')]));_0x35edbf[_0x2741('0x28')]=_0x35edbf['attributes']['length']?_0x35edbf[_0x2741('0x28')]:_0x805b49[_0x2741('0x25')];if(_0x587993[_0x2741('0x1f')][_0x2741('0x2a')]){_0x35edbf[_0x2741('0x1e')]=[{'all':!![]}];}_0x35edbf=_['merge']({},_0x35edbf,_0x587993[_0x2741('0x2b')]);return db['FaxQueue'][_0x2741('0x2c')](_0x35edbf)[_0x2741('0x11')](handleEntityNotFound(_0x4f698b,null))[_0x2741('0x11')](respondWithResult(_0x4f698b,null))[_0x2741('0x22')](handleError(_0x4f698b,null));};exports['create']=function(_0x3ccc96,_0x16a5b0){return db[_0x2741('0x19')][_0x2741('0x2d')](_0x3ccc96[_0x2741('0x2e')],{})['then'](function(_0x412284){var _0x1b1d5a=_0x3ccc96[_0x2741('0x2f')][_0x2741('0x13')]({'plain':!![]});if(!_0x1b1d5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b1d5a[_0x2741('0x30')]===_0x2741('0x2f')){var _0x2eb065=_0x412284[_0x2741('0x13')]({'plain':!![]});var _0x3722ab='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x3722ab,'userProfileId':_0x1b1d5a['userProfileId']},'raw':!![]})[_0x2741('0x11')](function(_0x3781f3){if(_0x3781f3&&_0x3781f3[_0x2741('0x31')]===0x0){return db[_0x2741('0x32')][_0x2741('0x2d')]({'name':_0x2eb065[_0x2741('0x16')],'resourceId':_0x2eb065['id'],'type':_0x3781f3[_0x2741('0x16')],'sectionId':_0x3781f3['id']},{})['then'](function(){return _0x412284;});}else{return _0x412284;}})[_0x2741('0x22')](function(_0x3f7301){logger['error'](_0x2741('0x33'),_0x3f7301);throw _0x3f7301;});}return _0x412284;})[_0x2741('0x11')](respondWithResult(_0x16a5b0,0xc9))[_0x2741('0x22')](handleError(_0x16a5b0,null));};exports[_0x2741('0x34')]=function(_0x1ac4c2,_0x4dc9fa){if(_0x1ac4c2[_0x2741('0x2e')]['id']){delete _0x1ac4c2[_0x2741('0x2e')]['id'];}return db['FaxQueue'][_0x2741('0x2c')]({'where':{'id':_0x1ac4c2[_0x2741('0x24')]['id']}})['then'](handleEntityNotFound(_0x4dc9fa,null))[_0x2741('0x11')](saveUpdates(_0x1ac4c2['body'],null))[_0x2741('0x11')](respondWithResult(_0x4dc9fa,null))['catch'](handleError(_0x4dc9fa,null));};exports[_0x2741('0x12')]=function(_0x5011b6,_0x2815ab){return db[_0x2741('0x19')][_0x2741('0x2c')]({'where':{'id':_0x5011b6[_0x2741('0x24')]['id']}})[_0x2741('0x11')](handleEntityNotFound(_0x2815ab,null))[_0x2741('0x11')](removeEntity(_0x2815ab,null))[_0x2741('0x22')](handleError(_0x2815ab,null));};exports['describe']=function(_0x228824,_0x37e7bf){return db[_0x2741('0x19')][_0x2741('0x35')]()[_0x2741('0x11')](respondWithResult(_0x37e7bf,null))[_0x2741('0x22')](handleError(_0x37e7bf,null));};exports[_0x2741('0x36')]=function(_0x1a5082,_0x2382a5){var _0x390224={'raw':!![],'where':{}},_0xa3355d={},_0xcb2a53;return db[_0x2741('0x19')]['findOne']({'where':{'id':_0x1a5082[_0x2741('0x24')]['id']}})['then'](handleEntityNotFound(_0x2382a5,null))[_0x2741('0x11')](function(_0x317b94){if(_0x317b94){_0xcb2a53=_0x317b94['get']({'plain':!![]});_0xa3355d[_0x2741('0x25')]=_[_0x2741('0x26')](db[_0x2741('0x37')]['rawAttributes']);_0xa3355d[_0x2741('0x1f')]=_[_0x2741('0x26')](_0x1a5082[_0x2741('0x1f')]);_0xa3355d['filters']=_['intersection'](_0xa3355d[_0x2741('0x25')],_0xa3355d[_0x2741('0x1f')]);_0x390224['attributes']=_[_0x2741('0x38')](_0xa3355d['model'],qs[_0x2741('0x29')](_0x1a5082[_0x2741('0x1f')][_0x2741('0x29')]));_0x390224[_0x2741('0x28')]=_0x390224[_0x2741('0x28')][_0x2741('0x39')]?_0x390224[_0x2741('0x28')]:_0xa3355d[_0x2741('0x25')];if(!_0x1a5082[_0x2741('0x1f')][_0x2741('0x3a')](_0x2741('0x3b'))){_0x390224[_0x2741('0xf')]=qs[_0x2741('0xf')](_0x1a5082['query'][_0x2741('0xf')]);_0x390224[_0x2741('0xc')]=qs[_0x2741('0xc')](_0x1a5082[_0x2741('0x1f')][_0x2741('0xc')]);}_0x390224['order']=qs[_0x2741('0x3c')](_0x1a5082['query']['sort']);_0x390224[_0x2741('0x3d')]=qs[_0x2741('0x27')](_['pick'](_0x1a5082[_0x2741('0x1f')],_0xa3355d[_0x2741('0x27')]));_0x390224[_0x2741('0x3d')][_0x2741('0x3e')]=_0x317b94['id'];if(_0x1a5082[_0x2741('0x1f')][_0x2741('0x3f')]){_0x390224[_0x2741('0x3d')]=_[_0x2741('0x40')](_0x390224[_0x2741('0x3d')],{'$or':_[_0x2741('0x18')](_0x390224['attributes'],function(_0x315acb){var _0x2ecc35={};_0x2ecc35[_0x315acb]={'$like':'%'+_0x1a5082[_0x2741('0x1f')][_0x2741('0x3f')]+'%'};return _0x2ecc35;})});}_0x390224=_[_0x2741('0x40')]({},_0x390224,_0x1a5082[_0x2741('0x2b')]);return db[_0x2741('0x37')]['findAll'](_0x390224);}})[_0x2741('0x11')](function(_0x2edc11){if(_0x2edc11){return db[_0x2741('0x41')][_0x2741('0x42')]({'where':{'id':_['map'](_0x2edc11,_0x2741('0x43')),'role':_0x2741('0x44')},'attributes':['id',_0x2741('0x16'),_0x2741('0x45'),'updatedAt',_0x2741('0x46')]});}})[_0x2741('0x11')](function(_0x53ce65){if(_0x53ce65){return{'count':_0x53ce65[_0x2741('0xe')],'rows':_['map'](_0x53ce65[_0x2741('0x21')],function(_0x3b7d81){return{'membername':_0x3b7d81['name'],'UserId':_0x3b7d81['id'],'queue_name':_0xcb2a53[_0x2741('0x16')],'FaxQueueId':_0xcb2a53['id'],'interface':util[_0x2741('0x47')](_0x2741('0x48'),_0x2741('0x49'),_0x3b7d81['name']),'penalty':0x0,'paused':_0x3b7d81['faxPause'],'createdAt':_0x3b7d81[_0x2741('0x46')],'updatedAt':_0x3b7d81[_0x2741('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2382a5,_0x390224))['catch'](handleError(_0x2382a5,null));};exports[_0x2741('0x4b')]=function(_0x589384,_0x306409){var _0x222d47={};var _0x3965dd={};var _0x5f336f;var _0x182890;return db[_0x2741('0x19')][_0x2741('0x4c')]({'where':{'id':_0x589384[_0x2741('0x24')]['id']}})[_0x2741('0x11')](handleEntityNotFound(_0x306409,null))[_0x2741('0x11')](function(_0x276330){if(_0x276330){_0x5f336f=_0x276330;_0x3965dd[_0x2741('0x25')]=_[_0x2741('0x26')](db[_0x2741('0x4d')][_0x2741('0x1a')]);_0x3965dd['query']=_['keys'](_0x589384[_0x2741('0x1f')]);_0x3965dd[_0x2741('0x27')]=_[_0x2741('0x38')](_0x3965dd[_0x2741('0x25')],_0x3965dd[_0x2741('0x1f')]);_0x222d47['attributes']=_[_0x2741('0x38')](_0x3965dd['model'],qs[_0x2741('0x29')](_0x589384['query'][_0x2741('0x29')]));_0x222d47[_0x2741('0x28')]=_0x222d47[_0x2741('0x28')]['length']?_0x222d47['attributes']:_0x3965dd['model'];_0x222d47[_0x2741('0x4e')]=qs[_0x2741('0x3c')](_0x589384[_0x2741('0x1f')][_0x2741('0x3c')]);_0x222d47[_0x2741('0x3d')]=qs[_0x2741('0x27')](_['pick'](_0x589384[_0x2741('0x1f')],_0x3965dd[_0x2741('0x27')]));if(_0x589384[_0x2741('0x1f')]['filter']){_0x222d47[_0x2741('0x3d')]=_[_0x2741('0x40')](_0x222d47[_0x2741('0x3d')],{'$or':_[_0x2741('0x18')](_0x222d47['attributes'],function(_0x101b86){var _0x2dfc1a={};_0x2dfc1a[_0x101b86]={'$like':'%'+_0x589384[_0x2741('0x1f')][_0x2741('0x3f')]+'%'};return _0x2dfc1a;})});}_0x222d47=_[_0x2741('0x40')]({},_0x222d47,_0x589384[_0x2741('0x2b')]);return _0x5f336f[_0x2741('0x4b')](_0x222d47);}})[_0x2741('0x11')](function(_0x149c42){if(_0x149c42){_0x182890=_0x149c42[_0x2741('0x39')];if(!_0x589384[_0x2741('0x1f')][_0x2741('0x3a')]('nolimit')){_0x222d47[_0x2741('0xf')]=qs[_0x2741('0xf')](_0x589384[_0x2741('0x1f')][_0x2741('0xf')]);_0x222d47[_0x2741('0xc')]=qs['offset'](_0x589384[_0x2741('0x1f')]['offset']);}return _0x5f336f[_0x2741('0x4b')](_0x222d47);}})['then'](function(_0x2d1ec3){if(_0x2d1ec3){return _0x2d1ec3?{'count':_0x182890,'rows':_0x2d1ec3}:null;}})[_0x2741('0x11')](respondWithResult(_0x306409,null))[_0x2741('0x22')](handleError(_0x306409,null));};exports['addTeams']=function(_0x3ecca7,_0x27c543){var _0x4dfe21=_0x3ecca7[_0x2741('0x2e')][_0x2741('0x4f')];return db[_0x2741('0x4d')]['findAll']({'where':{'id':_0x4dfe21},'attributes':['id'],'include':[{'model':db[_0x2741('0x41')],'as':'Agents','attributes':['id','name',_0x2741('0x50'),_0x2741('0x51'),_0x2741('0x52')],'raw':!![]}]})[_0x2741('0x11')](function(_0x4e0c2d){if(_0x4e0c2d){var _0xa79d7a=_[_0x2741('0x53')](_0x4e0c2d,function(_0x40f32c){var _0x2a0207=_0x40f32c[_0x2741('0x13')]({'plain':!![]});return _0x2a0207['Agents'];});return db['FaxQueue'][_0x2741('0x2c')]({'where':{'id':_0x3ecca7[_0x2741('0x24')]['id']}})[_0x2741('0x11')](function(_0x2772ee){return db[_0x2741('0x54')][_0x2741('0x55')](function(_0x7c8ddd){return _0x2772ee[_0x2741('0x56')](_0x4dfe21,{'transaction':_0x7c8ddd})[_0x2741('0x11')](function(){return BPromise[_0x2741('0x57')](_0xa79d7a,function(_0x2824ed){return db['UserFaxQueue'][_0x2741('0x58')]({'where':{'UserId':_0x2824ed['id'],'FaxQueueId':_0x3ecca7['params']['id']},'transaction':_0x7c8ddd});});})['then'](function(){_0xa79d7a[_0x2741('0x59')](function(_0x2f8009){socket[_0x2741('0x5a')](_0x2741('0x5b'),{'UserId':_0x2f8009['id'],'FaxQueueId':_0x2772ee['id']});});});});});}})['then'](respondWithStatusCode(_0x27c543,null))['catch'](handleError(_0x27c543,null));};exports[_0x2741('0x5c')]=function(_0x2d0c32,_0x3c2bca){return db[_0x2741('0x4d')][_0x2741('0x20')]({'where':{'id':_0x2d0c32[_0x2741('0x1f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2741('0x41')],'as':_0x2741('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x2741('0x11')](handleEntityNotFound(_0x3c2bca,null))[_0x2741('0x11')](function(_0x2964e6){var _0x5148cb=_['map'](_0x2964e6,'id');var _0x59d7d6=[];var _0xdefb19=[];var _0x8c0ddf=squel[_0x2741('0x5e')]();_0x8c0ddf[_0x2741('0x5f')](_0x2741('0x60'))[_0x2741('0x61')]('team_has_fax_queues','tq')[_0x2741('0x62')](_0x2741('0x63'),'ut',_0x2741('0x64'))[_0x2741('0x3d')](_0x2741('0x65'),_0x2d0c32['params']['id']);for(var _0xf1221a=0x0;_0xf1221a<_0x2964e6[_0x2741('0x39')];_0xf1221a+=0x1){let _0x4be756=_0x2964e6[_0xf1221a];for(var _0x4c05d4=0x0;_0x4c05d4<_0x4be756['Agents'][_0x2741('0x39')];_0x4c05d4+=0x1){let _0x3e6fd8=_0x4be756['Agents'][_0x4c05d4];var _0x9b80ab=_0x8c0ddf[_0x2741('0x66')]();_0x9b80ab[_0x2741('0x3d')]('ut.UserId\x20=\x20?',_0x3e6fd8['id']);_0xdefb19['push'](db[_0x2741('0x54')][_0x2741('0x1f')](_0x9b80ab[_0x2741('0x67')](),{'type':db[_0x2741('0x54')]['QueryTypes'][_0x2741('0x68')]})[_0x2741('0x11')](function(_0x3944a6){if(_0x3944a6[_0x2741('0x39')]===0x1){return _0x3e6fd8['id'];}else{var _0x1240e2=_['every'](_[_0x2741('0x18')](_0x3944a6,_0x2741('0x69')),function(_0x109184){return _[_0x2741('0x6a')](_0x5148cb,_0x109184);});if(_0x1240e2){return _0x3e6fd8['id'];}}}));}}return BPromise[_0x2741('0x6b')](_0xdefb19)[_0x2741('0x11')](function(_0x269334){_0x59d7d6=_(_0x59d7d6)[_0x2741('0x6c')](_0x269334)[_0x2741('0x6d')]()[_0x2741('0x6e')]();return db[_0x2741('0x19')][_0x2741('0x2c')]({'where':{'id':_0x2d0c32[_0x2741('0x24')]['id']}})['then'](function(_0x40450d){return db[_0x2741('0x54')]['transaction'](function(_0x3c1f4a){return _0x40450d[_0x2741('0x5c')](_0x2d0c32[_0x2741('0x1f')][_0x2741('0x4f')],{'transaction':_0x3c1f4a})[_0x2741('0x11')](function(){if(!_[_0x2741('0x6f')](_0x59d7d6)){return _0x40450d[_0x2741('0x70')](_0x59d7d6,{'transaction':_0x3c1f4a});}})[_0x2741('0x11')](function(){_0x59d7d6['forEach'](function(_0x331c95){socket[_0x2741('0x5a')]('userFaxQueue:remove',{'UserId':_0x331c95,'FaxQueueId':_0x40450d['id']});});});});});});})[_0x2741('0x11')](respondWithStatusCode(_0x3c2bca,null))[_0x2741('0x22')](handleError(_0x3c2bca,null));};exports['addAgents']=function(_0x3bbd8b,_0x141513){return db['FaxQueue'][_0x2741('0x2c')]({'where':{'id':_0x3bbd8b[_0x2741('0x24')]['id']}})[_0x2741('0x11')](handleEntityNotFound(_0x141513,null))['then'](function(_0x22bd25){if(_0x22bd25){return _0x22bd25[_0x2741('0x71')](_0x3bbd8b['body'][_0x2741('0x4f')],_[_0x2741('0x72')](_0x3bbd8b[_0x2741('0x2e')],['ids','id'])||{})[_0x2741('0x73')](function(_0x25e4fb){for(var _0x1ea629=0x0;_0x1ea629<_0x3bbd8b[_0x2741('0x2e')][_0x2741('0x4f')][_0x2741('0x39')];_0x1ea629+=0x1){socket[_0x2741('0x5a')](_0x2741('0x5b'),{'UserId':Number(_0x3bbd8b[_0x2741('0x2e')][_0x2741('0x4f')][_0x1ea629]),'FaxQueueId':Number(_0x3bbd8b[_0x2741('0x24')]['id'])});}return _0x25e4fb;});}})['then'](respondWithResult(_0x141513,null))[_0x2741('0x22')](handleError(_0x141513,null));};exports[_0x2741('0x70')]=function(_0x4875a7,_0x2b6439){return db[_0x2741('0x19')][_0x2741('0x2c')]({'where':{'id':_0x4875a7[_0x2741('0x24')]['id']}})[_0x2741('0x11')](handleEntityNotFound(_0x2b6439,null))[_0x2741('0x11')](function(_0x36438c){if(_0x36438c){return _0x36438c[_0x2741('0x70')](_0x4875a7[_0x2741('0x1f')][_0x2741('0x4f')])['then'](function(){if(_[_0x2741('0x74')](_0x4875a7[_0x2741('0x1f')][_0x2741('0x4f')])){for(var _0x573519=0x0;_0x573519<_0x4875a7[_0x2741('0x1f')][_0x2741('0x4f')][_0x2741('0x39')];_0x573519+=0x1){socket['emit'](_0x2741('0x75'),{'UserId':Number(_0x4875a7[_0x2741('0x1f')][_0x2741('0x4f')][_0x573519]),'FaxQueueId':Number(_0x4875a7['params']['id'])});}}else{socket[_0x2741('0x5a')](_0x2741('0x75'),{'UserId':Number(_0x4875a7[_0x2741('0x1f')][_0x2741('0x4f')]),'FaxQueueId':Number(_0x4875a7[_0x2741('0x24')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b6439,null))[_0x2741('0x22')](handleError(_0x2b6439,null));};exports[_0x2741('0x76')]=function(_0x1bbb34,_0x216e6e){var _0x184030={};var _0xbcc0d2={};var _0x5b16e8;var _0x5ca592;return db[_0x2741('0x19')][_0x2741('0x4c')]({'where':{'id':_0x1bbb34['params']['id']}})['then'](handleEntityNotFound(_0x216e6e,null))['then'](function(_0x97a0be){if(_0x97a0be){_0x5b16e8=_0x97a0be;_0xbcc0d2[_0x2741('0x25')]=_[_0x2741('0x26')](db[_0x2741('0x41')]['rawAttributes']);_0xbcc0d2[_0x2741('0x1f')]=_[_0x2741('0x26')](_0x1bbb34[_0x2741('0x1f')]);_0xbcc0d2[_0x2741('0x27')]=_[_0x2741('0x38')](_0xbcc0d2[_0x2741('0x25')],_0xbcc0d2[_0x2741('0x1f')]);_0x184030[_0x2741('0x28')]=_[_0x2741('0x38')](_0xbcc0d2[_0x2741('0x25')],qs[_0x2741('0x29')](_0x1bbb34['query']['fields']));_0x184030[_0x2741('0x28')]=_0x184030['attributes'][_0x2741('0x39')]?_0x184030['attributes']:_0xbcc0d2[_0x2741('0x25')];_0x184030['order']=qs[_0x2741('0x3c')](_0x1bbb34[_0x2741('0x1f')][_0x2741('0x3c')]);_0x184030[_0x2741('0x3d')]=qs[_0x2741('0x27')](_['pick'](_0x1bbb34[_0x2741('0x1f')],_0xbcc0d2['filters']));if(_0x1bbb34[_0x2741('0x1f')][_0x2741('0x3f')]){_0x184030[_0x2741('0x3d')]=_[_0x2741('0x40')](_0x184030['where'],{'$or':_[_0x2741('0x18')](_0x184030[_0x2741('0x28')],function(_0x2d0b91){var _0x52bdbc={};_0x52bdbc[_0x2d0b91]={'$like':'%'+_0x1bbb34[_0x2741('0x1f')]['filter']+'%'};return _0x52bdbc;})});}_0x184030=_['merge']({},_0x184030,_0x1bbb34[_0x2741('0x2b')]);return _0x5b16e8[_0x2741('0x76')](_0x184030);}})[_0x2741('0x11')](function(_0xb327c){if(_0xb327c){_0x5ca592=_0xb327c[_0x2741('0x39')];if(!_0x1bbb34['query'][_0x2741('0x3a')](_0x2741('0x3b'))){_0x184030[_0x2741('0xf')]=qs[_0x2741('0xf')](_0x1bbb34['query'][_0x2741('0xf')]);_0x184030[_0x2741('0xc')]=qs['offset'](_0x1bbb34[_0x2741('0x1f')]['offset']);}return _0x5b16e8[_0x2741('0x76')](_0x184030);}})[_0x2741('0x11')](function(_0x341031){if(_0x341031){return _0x341031?{'count':_0x5ca592,'rows':_0x341031}:null;}})[_0x2741('0x11')](respondWithResult(_0x216e6e,null))['catch'](handleError(_0x216e6e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 1f7125e..9a6a72f 100644 --- a/server/api/faxQueue/faxQueue.events.js +++ b/server/api/faxQueue/faxQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5213=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','exports'];(function(_0x455a95,_0x334916){var _0x92a283=function(_0x142138){while(--_0x142138){_0x455a95['push'](_0x455a95['shift']());}};_0x92a283(++_0x334916);}(_0x5213,0x128));var _0x3521=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x5213[_0x19b3f9];return _0x18c3f6;};'use strict';var EventEmitter=require(_0x3521('0x0'));var FaxQueue=require(_0x3521('0x1'))['db'][_0x3521('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3521('0x3')](0x0);var events={'afterCreate':_0x3521('0x4'),'afterUpdate':_0x3521('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1c02e0){return function(_0x1083d5,_0x667d39,_0x22dced){FaxQueueEvents[_0x3521('0x6')](_0x1c02e0+':'+_0x1083d5['id'],_0x1083d5);FaxQueueEvents[_0x3521('0x6')](_0x1c02e0,_0x1083d5);_0x22dced(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x3521('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xe4fb=['FaxQueue','save','update','remove','emit','hook','exports'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xe4fb,0x12d));var _0xbe4f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe4fb[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0xbe4f('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe4f('0x1'),'afterUpdate':_0xbe4f('0x2'),'afterDestroy':_0xbe4f('0x3')};function emitEvent(_0x144f52){return function(_0x333bf4,_0x348045,_0x14cae1){FaxQueueEvents[_0xbe4f('0x4')](_0x144f52+':'+_0x333bf4['id'],_0x333bf4);FaxQueueEvents[_0xbe4f('0x4')](_0x144f52,_0x333bf4);_0x14cae1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xbe4f('0x5')](e,emitEvent(event));}}module[_0xbe4f('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f676e87..71986ac 100644 --- a/server/api/faxQueue/faxQueue.model.js +++ b/server/api/faxQueue/faxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d0c=['define','FaxQueue','moment','bluebird','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x4fe2b5,_0x16114a){var _0x4c00e6=function(_0xb2ca36){while(--_0xb2ca36){_0x4fe2b5['push'](_0x4fe2b5['shift']());}};_0x4c00e6(++_0x16114a);}(_0x2d0c,0x1da));var _0xc2d0=function(_0xb77fe1,_0x39aa4d){_0xb77fe1=_0xb77fe1-0x0;var _0x350e00=_0x2d0c[_0xb77fe1];return _0x350e00;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc2d0('0x0'));var BPromise=require(_0xc2d0('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc2d0('0x2'));var config=require(_0xc2d0('0x3'));var attributes=require(_0xc2d0('0x4'));module[_0xc2d0('0x5')]=function(_0x386cf0,_0x400df0){return _0x386cf0[_0xc2d0('0x6')](_0xc2d0('0x7'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7308=['../../config/environment','./faxQueue.attributes','exports','define','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x3816ad,_0x3a49a8){var _0x2967f5=function(_0x5d71b7){while(--_0x5d71b7){_0x3816ad['push'](_0x3816ad['shift']());}};_0x2967f5(++_0x3a49a8);}(_0x7308,0x19e));var _0x8730=function(_0x233d47,_0x5c74fe){_0x233d47=_0x233d47-0x0;var _0x1d7eed=_0x7308[_0x233d47];return _0x1d7eed;};'use strict';var _=require(_0x8730('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8730('0x1'));var moment=require('moment');var BPromise=require(_0x8730('0x2'));var rp=require(_0x8730('0x3'));var fs=require('fs');var path=require(_0x8730('0x4'));var rimraf=require(_0x8730('0x5'));var config=require(_0x8730('0x6'));var attributes=require(_0x8730('0x7'));module[_0x8730('0x8')]=function(_0x86d230,_0x49caef){return _0x86d230[_0x8730('0x9')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 00a61c7..47668a7 100644 --- a/server/api/faxQueue/faxQueue.rpc.js +++ b/server/api/faxQueue/faxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e51=['FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','model','map','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info'];(function(_0x37d8ae,_0x17e484){var _0x4de500=function(_0x538a36){while(--_0x538a36){_0x37d8ae['push'](_0x37d8ae['shift']());}};_0x4de500(++_0x17e484);}(_0x1e51,0x8d));var _0x11e5=function(_0x1c0f50,_0x3f4946){_0x1c0f50=_0x1c0f50-0x0;var _0x1b880e=_0x1e51[_0x1c0f50];return _0x1b880e;};'use strict';var _=require(_0x11e5('0x0'));var util=require(_0x11e5('0x1'));var moment=require(_0x11e5('0x2'));var BPromise=require(_0x11e5('0x3'));var rs=require(_0x11e5('0x4'));var fs=require('fs');var Redis=require(_0x11e5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x11e5('0x6'));var logger=require('../../config/logger')(_0x11e5('0x7'));var config=require(_0x11e5('0x8'));var jayson=require(_0x11e5('0x9'));var client=jayson[_0x11e5('0xa')]['http']({'port':0x232a});config['redis']=_[_0x11e5('0xb')](config[_0x11e5('0xc')],{'host':_0x11e5('0xd'),'port':0x18eb});var socket=require(_0x11e5('0xe'))(new Redis(config[_0x11e5('0xc')]));require(_0x11e5('0xf'))[_0x11e5('0x10')](socket);function respondWithRpcPromise(_0x306520,_0x1b3374,_0x9d3939){return new BPromise(function(_0x391df9,_0x48e3b7){return client['request'](_0x306520,_0x9d3939)[_0x11e5('0x11')](function(_0x1f2df8){logger[_0x11e5('0x12')](_0x11e5('0x13'),_0x1b3374,'request\x20sent');logger[_0x11e5('0x14')](_0x11e5('0x15'),_0x1b3374,_0x11e5('0x16'),JSON[_0x11e5('0x17')](_0x1f2df8));if(_0x1f2df8[_0x11e5('0x18')]){if(_0x1f2df8[_0x11e5('0x18')][_0x11e5('0x19')]===0x1f4){logger[_0x11e5('0x18')]('FaxQueue,\x20%s,\x20%s',_0x1b3374,_0x1f2df8['error']['message']);return _0x48e3b7(_0x1f2df8[_0x11e5('0x18')]['message']);}logger['error'](_0x11e5('0x13'),_0x1b3374,_0x1f2df8['error']['message']);return _0x391df9(_0x1f2df8[_0x11e5('0x18')]['message']);}else{logger['info'](_0x11e5('0x13'),_0x1b3374,_0x11e5('0x16'));_0x391df9(_0x1f2df8[_0x11e5('0x1a')][_0x11e5('0x1b')]);}})[_0x11e5('0x1c')](function(_0x186508){logger[_0x11e5('0x18')]('FaxQueue,\x20%s,\x20%s',_0x1b3374,_0x186508);_0x48e3b7(_0x186508);});});}exports[_0x11e5('0x1d')]=function(_0x37aac1){var _0x8c3271=this;return new Promise(function(_0x42fe03,_0x22ba73){return db[_0x11e5('0x1e')][_0x11e5('0x1f')]({'raw':_0x37aac1[_0x11e5('0x20')]?_0x37aac1['options'][_0x11e5('0x21')]===undefined?!![]:![]:!![],'where':_0x37aac1[_0x11e5('0x20')]?_0x37aac1[_0x11e5('0x20')][_0x11e5('0x22')]||null:null,'attributes':_0x37aac1[_0x11e5('0x20')]?_0x37aac1[_0x11e5('0x20')][_0x11e5('0x23')]||null:null,'limit':_0x37aac1[_0x11e5('0x20')]?_0x37aac1[_0x11e5('0x20')]['limit']||null:null,'include':_0x37aac1[_0x11e5('0x20')]?_0x37aac1[_0x11e5('0x20')][_0x11e5('0x24')]?_['map'](_0x37aac1[_0x11e5('0x20')]['include'],function(_0x503c0c){return{'model':db[_0x503c0c[_0x11e5('0x25')]],'as':_0x503c0c['as'],'attributes':_0x503c0c[_0x11e5('0x23')],'include':_0x503c0c[_0x11e5('0x24')]?_[_0x11e5('0x26')](_0x503c0c[_0x11e5('0x24')],function(_0x4bc89e){return{'model':db[_0x4bc89e[_0x11e5('0x25')]],'as':_0x4bc89e['as'],'attributes':_0x4bc89e[_0x11e5('0x23')],'include':_0x4bc89e[_0x11e5('0x24')]?_[_0x11e5('0x26')](_0x4bc89e[_0x11e5('0x24')],function(_0x148a17){return{'model':db[_0x148a17[_0x11e5('0x25')]],'as':_0x148a17['as'],'attributes':_0x148a17[_0x11e5('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x321c92){logger[_0x11e5('0x12')](_0x11e5('0x1d'),_0x37aac1);logger[_0x11e5('0x14')]('GetFaxQueue',_0x37aac1,JSON['stringify'](_0x321c92));_0x42fe03(_0x321c92);})[_0x11e5('0x1c')](function(_0x176f9e){logger[_0x11e5('0x18')](_0x11e5('0x1d'),_0x176f9e[_0x11e5('0x1b')],_0x37aac1);_0x22ba73(_0x8c3271['error'](0x1f4,_0x176f9e[_0x11e5('0x1b')]));});});};exports['ShowFaxQueue']=function(_0x25fbb3){var _0xfd897d=this;return new Promise(function(_0x4f17c1,_0x4f18e7){return db[_0x11e5('0x1e')]['find']({'raw':_0x25fbb3['options']?_0x25fbb3[_0x11e5('0x20')][_0x11e5('0x21')]===undefined?!![]:![]:!![],'where':_0x25fbb3[_0x11e5('0x20')]?_0x25fbb3['options'][_0x11e5('0x22')]||null:null,'attributes':_0x25fbb3['options']?_0x25fbb3[_0x11e5('0x20')][_0x11e5('0x23')]||null:null,'include':_0x25fbb3['options']?_0x25fbb3[_0x11e5('0x20')][_0x11e5('0x24')]?_[_0x11e5('0x26')](_0x25fbb3[_0x11e5('0x20')]['include'],function(_0x1b2975){return{'model':db[_0x1b2975[_0x11e5('0x25')]],'as':_0x1b2975['as'],'attributes':_0x1b2975[_0x11e5('0x23')],'include':_0x1b2975[_0x11e5('0x24')]?_['map'](_0x1b2975[_0x11e5('0x24')],function(_0xb98b1f){return{'model':db[_0xb98b1f[_0x11e5('0x25')]],'as':_0xb98b1f['as'],'attributes':_0xb98b1f[_0x11e5('0x23')],'include':_0xb98b1f[_0x11e5('0x24')]?_['map'](_0xb98b1f[_0x11e5('0x24')],function(_0x5c408e){return{'model':db[_0x5c408e[_0x11e5('0x25')]],'as':_0x5c408e['as'],'attributes':_0x5c408e['attributes']};}):[]};}):[]};}):[]:[]})[_0x11e5('0x11')](function(_0x30aa8d){logger[_0x11e5('0x12')]('ShowFaxQueue',_0x25fbb3);logger[_0x11e5('0x14')](_0x11e5('0x27'),_0x25fbb3,JSON[_0x11e5('0x17')](_0x30aa8d));_0x4f17c1(_0x30aa8d);})['catch'](function(_0x394a4d){logger['error'](_0x11e5('0x27'),_0x394a4d[_0x11e5('0x1b')],_0x25fbb3);_0x4f18e7(_0xfd897d[_0x11e5('0x18')](0x1f4,_0x394a4d[_0x11e5('0x1b')]));});});}; \ No newline at end of file +var _0x029b=['error','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','limit','include','model','map','attributes','stringify','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1b8a0b,_0x468c58){var _0x2aab43=function(_0x3ecf15){while(--_0x3ecf15){_0x1b8a0b['push'](_0x1b8a0b['shift']());}};_0x2aab43(++_0x468c58);}(_0x029b,0x161));var _0xb029=function(_0x161b8b,_0x33b0fc){_0x161b8b=_0x161b8b-0x0;var _0x1eadc4=_0x029b[_0x161b8b];return _0x1eadc4;};'use strict';var _=require(_0xb029('0x0'));var util=require(_0xb029('0x1'));var moment=require(_0xb029('0x2'));var BPromise=require(_0xb029('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb029('0x4'));var db=require(_0xb029('0x5'))['db'];var utils=require(_0xb029('0x6'));var logger=require(_0xb029('0x7'))('rpc');var config=require(_0xb029('0x8'));var jayson=require(_0xb029('0x9'));var client=jayson[_0xb029('0xa')][_0xb029('0xb')]({'port':0x232a});config[_0xb029('0xc')]=_[_0xb029('0xd')](config[_0xb029('0xc')],{'host':_0xb029('0xe'),'port':0x18eb});var socket=require(_0xb029('0xf'))(new Redis(config[_0xb029('0xc')]));require(_0xb029('0x10'))[_0xb029('0x11')](socket);function respondWithRpcPromise(_0x4620ee,_0x1b6cfe,_0x4b9ba4){return new BPromise(function(_0x101daa,_0x5360df){return client[_0xb029('0x12')](_0x4620ee,_0x4b9ba4)[_0xb029('0x13')](function(_0x2930cd){logger[_0xb029('0x14')](_0xb029('0x15'),_0x1b6cfe,_0xb029('0x16'));logger[_0xb029('0x17')](_0xb029('0x18'),_0x1b6cfe,_0xb029('0x16'),JSON['stringify'](_0x2930cd));if(_0x2930cd[_0xb029('0x19')]){if(_0x2930cd['error']['code']===0x1f4){logger[_0xb029('0x19')](_0xb029('0x15'),_0x1b6cfe,_0x2930cd['error']['message']);return _0x5360df(_0x2930cd['error'][_0xb029('0x1a')]);}logger[_0xb029('0x19')](_0xb029('0x15'),_0x1b6cfe,_0x2930cd[_0xb029('0x19')]['message']);return _0x101daa(_0x2930cd[_0xb029('0x19')][_0xb029('0x1a')]);}else{logger[_0xb029('0x14')]('FaxQueue,\x20%s,\x20%s',_0x1b6cfe,_0xb029('0x16'));_0x101daa(_0x2930cd[_0xb029('0x1b')][_0xb029('0x1a')]);}})[_0xb029('0x1c')](function(_0x80cf55){logger[_0xb029('0x19')]('FaxQueue,\x20%s,\x20%s',_0x1b6cfe,_0x80cf55);_0x5360df(_0x80cf55);});});}exports[_0xb029('0x1d')]=function(_0x482e12){var _0x5beab6=this;return new Promise(function(_0x5ef593,_0x590623){return db[_0xb029('0x1e')]['findAll']({'raw':_0x482e12[_0xb029('0x1f')]?_0x482e12['options'][_0xb029('0x20')]===undefined?!![]:![]:!![],'where':_0x482e12[_0xb029('0x1f')]?_0x482e12[_0xb029('0x1f')][_0xb029('0x21')]||null:null,'attributes':_0x482e12[_0xb029('0x1f')]?_0x482e12[_0xb029('0x1f')]['attributes']||null:null,'limit':_0x482e12['options']?_0x482e12[_0xb029('0x1f')][_0xb029('0x22')]||null:null,'include':_0x482e12[_0xb029('0x1f')]?_0x482e12['options'][_0xb029('0x23')]?_['map'](_0x482e12[_0xb029('0x1f')][_0xb029('0x23')],function(_0xcfad15){return{'model':db[_0xcfad15[_0xb029('0x24')]],'as':_0xcfad15['as'],'attributes':_0xcfad15['attributes'],'include':_0xcfad15[_0xb029('0x23')]?_[_0xb029('0x25')](_0xcfad15[_0xb029('0x23')],function(_0x344440){return{'model':db[_0x344440[_0xb029('0x24')]],'as':_0x344440['as'],'attributes':_0x344440[_0xb029('0x26')],'include':_0x344440['include']?_[_0xb029('0x25')](_0x344440[_0xb029('0x23')],function(_0x1b0b1f){return{'model':db[_0x1b0b1f['model']],'as':_0x1b0b1f['as'],'attributes':_0x1b0b1f[_0xb029('0x26')]};}):[]};}):[]};}):[]:[]})[_0xb029('0x13')](function(_0x11a88b){logger[_0xb029('0x14')]('GetFaxQueue',_0x482e12);logger[_0xb029('0x17')](_0xb029('0x1d'),_0x482e12,JSON[_0xb029('0x27')](_0x11a88b));_0x5ef593(_0x11a88b);})[_0xb029('0x1c')](function(_0x58b2b8){logger[_0xb029('0x19')](_0xb029('0x1d'),_0x58b2b8['message'],_0x482e12);_0x590623(_0x5beab6[_0xb029('0x19')](0x1f4,_0x58b2b8[_0xb029('0x1a')]));});});};exports[_0xb029('0x28')]=function(_0x25139d){var _0x2af46b=this;return new Promise(function(_0x3c1820,_0x10637b){return db[_0xb029('0x1e')][_0xb029('0x29')]({'raw':_0x25139d[_0xb029('0x1f')]?_0x25139d[_0xb029('0x1f')][_0xb029('0x20')]===undefined?!![]:![]:!![],'where':_0x25139d['options']?_0x25139d['options'][_0xb029('0x21')]||null:null,'attributes':_0x25139d[_0xb029('0x1f')]?_0x25139d[_0xb029('0x1f')][_0xb029('0x26')]||null:null,'include':_0x25139d[_0xb029('0x1f')]?_0x25139d[_0xb029('0x1f')][_0xb029('0x23')]?_['map'](_0x25139d[_0xb029('0x1f')]['include'],function(_0x3a19a8){return{'model':db[_0x3a19a8['model']],'as':_0x3a19a8['as'],'attributes':_0x3a19a8['attributes'],'include':_0x3a19a8[_0xb029('0x23')]?_[_0xb029('0x25')](_0x3a19a8[_0xb029('0x23')],function(_0x514120){return{'model':db[_0x514120[_0xb029('0x24')]],'as':_0x514120['as'],'attributes':_0x514120[_0xb029('0x26')],'include':_0x514120[_0xb029('0x23')]?_[_0xb029('0x25')](_0x514120[_0xb029('0x23')],function(_0x3f8418){return{'model':db[_0x3f8418[_0xb029('0x24')]],'as':_0x3f8418['as'],'attributes':_0x3f8418['attributes']};}):[]};}):[]};}):[]:[]})[_0xb029('0x13')](function(_0x48c850){logger['info']('ShowFaxQueue',_0x25139d);logger[_0xb029('0x17')]('ShowFaxQueue',_0x25139d,JSON[_0xb029('0x27')](_0x48c850));_0x3c1820(_0x48c850);})[_0xb029('0x1c')](function(_0x719070){logger['error']('ShowFaxQueue',_0x719070[_0xb029('0x1a')],_0x25139d);_0x10637b(_0x2af46b[_0xb029('0x19')](0x1f4,_0x719070[_0xb029('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index fbd160f..2701398 100644 --- a/server/api/faxQueue/faxQueue.socket.js +++ b/server/api/faxQueue/faxQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ed8=['update','emit','length','./faxQueue.events','save'];(function(_0x266380,_0x433ef2){var _0x2c093a=function(_0x1a8557){while(--_0x1a8557){_0x266380['push'](_0x266380['shift']());}};_0x2c093a(++_0x433ef2);}(_0x3ed8,0x1e3));var _0x83ed=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x3ed8[_0x318840];return _0x223da4;};'use strict';var FaxQueueEvents=require(_0x83ed('0x0'));var events=[_0x83ed('0x1'),'remove',_0x83ed('0x2')];function createListener(_0x34f6f9,_0x217fcd){return function(_0x444ce5){_0x217fcd[_0x83ed('0x3')](_0x34f6f9,_0x444ce5);};}function removeListener(_0x15387a,_0x4a60fd){return function(){FaxQueueEvents['removeListener'](_0x15387a,_0x4a60fd);};}exports['register']=function(_0x188b75){for(var _0x51f652=0x0,_0x4396df=events[_0x83ed('0x4')];_0x51f652<_0x4396df;_0x51f652++){var _0x14c337=events[_0x51f652];var _0x17bb07=createListener('faxQueue:'+_0x14c337,_0x188b75);FaxQueueEvents['on'](_0x14c337,_0x17bb07);}}; \ No newline at end of file +var _0xe1e4=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x55d103,_0x2af706){var _0x3e9dea=function(_0x275e50){while(--_0x275e50){_0x55d103['push'](_0x55d103['shift']());}};_0x3e9dea(++_0x2af706);}(_0xe1e4,0x18e));var _0x4e1e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe1e4[_0x40a045];return _0x1a687c;};'use strict';var FaxQueueEvents=require(_0x4e1e('0x0'));var events=[_0x4e1e('0x1'),'remove',_0x4e1e('0x2')];function createListener(_0x218b6c,_0x1aa8d0){return function(_0x2a7ecd){_0x1aa8d0[_0x4e1e('0x3')](_0x218b6c,_0x2a7ecd);};}function removeListener(_0x1e0723,_0x473fa0){return function(){FaxQueueEvents[_0x4e1e('0x4')](_0x1e0723,_0x473fa0);};}exports[_0x4e1e('0x5')]=function(_0x1823ef){for(var _0x2f0025=0x0,_0x467d9d=events[_0x4e1e('0x6')];_0x2f0025<_0x467d9d;_0x2f0025++){var _0x479bfa=events[_0x2f0025];var _0xb1e5d7=createListener(_0x4e1e('0x7')+_0x479bfa,_0x1823ef);FaxQueueEvents['on'](_0x479bfa,_0xb1e5d7);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 16da8f0..b384399 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','update','delete','removeAgents','exports','multer','util','path'];(function(_0x1a3064,_0x5397ce){var _0x5e9ebf=function(_0x4ac562){while(--_0x4ac562){_0x1a3064['push'](_0x1a3064['shift']());}};_0x5e9ebf(++_0x5397ce);}(_0x2ef3,0xba));var _0x32ef=function(_0x39f301,_0x57ee6e){_0x39f301=_0x39f301-0x0;var _0x295a14=_0x2ef3[_0x39f301];return _0x295a14;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['get'](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router['post']('/',auth[_0x32ef('0xb')](),controller[_0x32ef('0x14')]);router['post']('/:id/teams',auth[_0x32ef('0xb')](),controller['addTeams']);router[_0x32ef('0x15')](_0x32ef('0x12'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x32ef('0x17')]);router[_0x32ef('0x18')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x32ef('0x18')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller['removeTeams']);router[_0x32ef('0x18')](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x19')]);module[_0x32ef('0x1a')]=router; \ No newline at end of file +var _0x3d04=['/:id','show','/:id/teams','getTeams','getAgents','create','post','addTeams','addAgents','put','destroy','removeTeams','delete','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','describe'];(function(_0x114cd5,_0x512925){var _0xb6ba4e=function(_0x1ed6f0){while(--_0x1ed6f0){_0x114cd5['push'](_0x114cd5['shift']());}};_0xb6ba4e(++_0x512925);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['get']('/:id/members',auth[_0x43d0('0xb')](),controller['getMembers']);router['get'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x10')]);router[_0x43d0('0xa')]('/:id/users',auth[_0x43d0('0xb')](),controller[_0x43d0('0x11')]);router['post']('/',auth[_0x43d0('0xb')](),controller[_0x43d0('0x12')]);router[_0x43d0('0x13')]('/:id/teams',auth[_0x43d0('0xb')](),controller[_0x43d0('0x14')]);router[_0x43d0('0x13')]('/:id/users',auth[_0x43d0('0xb')](),controller[_0x43d0('0x15')]);router[_0x43d0('0x16')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller['update']);router['delete'](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x17')]);router['delete'](_0x43d0('0xf'),auth['isAuthenticated'](),controller[_0x43d0('0x18')]);router[_0x43d0('0x19')](_0x43d0('0x1a'),auth['isAuthenticated'](),controller[_0x43d0('0x1b')]);module[_0x43d0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 6bef12e..e52563f 100644 --- a/server/api/faxQueueReport/faxQueueReport.attributes.js +++ b/server/api/faxQueueReport/faxQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x612d=['sequelize','exports','STRING','DATE','moment'];(function(_0x165c1e,_0x44be8c){var _0xe5a097=function(_0x1a776a){while(--_0x1a776a){_0x165c1e['push'](_0x165c1e['shift']());}};_0xe5a097(++_0x44be8c);}(_0x612d,0x158));var _0xd612=function(_0x36625f,_0x727bd6){_0x36625f=_0x36625f-0x0;var _0x135981=_0x612d[_0x36625f];return _0x135981;};'use strict';var moment=require(_0xd612('0x0'));var Sequelize=require(_0xd612('0x1'));module[_0xd612('0x2')]={'uniqueid':{'type':Sequelize[_0xd612('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd612('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd612('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd612('0x3')]}}; \ No newline at end of file +var _0xfcb8=['DATE','STRING','moment','sequelize','exports'];(function(_0x52c29a,_0x40307c){var _0x430fe0=function(_0x58ba42){while(--_0x58ba42){_0x52c29a['push'](_0x52c29a['shift']());}};_0x430fe0(++_0x40307c);}(_0xfcb8,0x17e));var _0x8fcb=function(_0x30fdf9,_0x89096d){_0x30fdf9=_0x30fdf9-0x0;var _0x3c43bb=_0xfcb8[_0x30fdf9];return _0x3c43bb;};'use strict';var moment=require(_0x8fcb('0x0'));var Sequelize=require(_0x8fcb('0x1'));module[_0x8fcb('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8fcb('0x3')]},'leaveAt':{'type':Sequelize[_0x8fcb('0x3')]},'acceptAt':{'type':Sequelize[_0x8fcb('0x3')]},'exitAt':{'type':Sequelize[_0x8fcb('0x3')]},'reason':{'type':Sequelize[_0x8fcb('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 73330a2..91c5195 100644 --- a/server/api/faxQueueReport/faxQueueReport.controller.js +++ b/server/api/faxQueueReport/faxQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd52a=['request-promise','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','filter','options','then','includeAll','rows','show','params','keys','include','find','create','body','catch','describe','rimraf','fast-json-patch'];(function(_0x37b777,_0xa6c433){var _0x20339d=function(_0x5c55c6){while(--_0x5c55c6){_0x37b777['push'](_0x37b777['shift']());}};_0x20339d(++_0xa6c433);}(_0xd52a,0xca));var _0xad52=function(_0x3fed35,_0x5663f0){_0x3fed35=_0x3fed35-0x0;var _0x384d29=_0xd52a[_0x3fed35];return _0x384d29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad52('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad52('0x1'));var rp=require(_0xad52('0x2'));var moment=require(_0xad52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xad52('0x4'));var util=require(_0xad52('0x5'));var path=require(_0xad52('0x6'));var sox=require(_0xad52('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad52('0x8'));var squel=require('squel');var crypto=require(_0xad52('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad52('0xa'));var toCsv=require(_0xad52('0xb'));var querystring=require('querystring');var Papa=require(_0xad52('0xc'));var Redis=require('ioredis');var authService=require(_0xad52('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xad52('0xe'));var hardwareService=require(_0xad52('0xf'));var logger=require(_0xad52('0x10'))(_0xad52('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad52('0x12'))['db'];function respondWithStatusCode(_0x79b1e7,_0x378b0c){_0x378b0c=_0x378b0c||0xcc;return function(_0x41331e){if(_0x41331e){return _0x79b1e7[_0xad52('0x13')](_0x378b0c);}return _0x79b1e7[_0xad52('0x14')](_0x378b0c)[_0xad52('0x15')]();};}function respondWithResult(_0xd04cde,_0x3d2df6){_0x3d2df6=_0x3d2df6||0xc8;return function(_0x5727a2){if(_0x5727a2){return _0xd04cde[_0xad52('0x14')](_0x3d2df6)[_0xad52('0x16')](_0x5727a2);}};}function respondWithFilteredResult(_0x3bc8f6,_0x42eb20){return function(_0x38be7e){if(_0x38be7e){var _0xcb6cd5=typeof _0x42eb20[_0xad52('0x17')]===_0xad52('0x18')&&typeof _0x42eb20[_0xad52('0x19')]==='undefined';var _0x4abd73=_0x38be7e[_0xad52('0x1a')];var _0x39128c=_0xcb6cd5?0x0:_0x42eb20[_0xad52('0x17')];var _0x1c19e9=_0xcb6cd5?_0x38be7e[_0xad52('0x1a')]:_0x42eb20['offset']+_0x42eb20[_0xad52('0x19')];var _0x5a71c4;if(_0x1c19e9>=_0x4abd73){_0x1c19e9=_0x4abd73;_0x5a71c4=0xc8;}else{_0x5a71c4=0xce;}_0x3bc8f6[_0xad52('0x14')](_0x5a71c4);return _0x3bc8f6[_0xad52('0x1b')](_0xad52('0x1c'),_0x39128c+'-'+_0x1c19e9+'/'+_0x4abd73)['json'](_0x38be7e);}return null;};}function patchUpdates(_0x24fb52){return function(_0x593dfd){try{jsonpatch[_0xad52('0x1d')](_0x593dfd,_0x24fb52,!![]);}catch(_0x179a64){return BPromise[_0xad52('0x1e')](_0x179a64);}return _0x593dfd[_0xad52('0x1f')]();};}function saveUpdates(_0x2c182f,_0x2f1526){return function(_0x4b5f2f){if(_0x4b5f2f){return _0x4b5f2f[_0xad52('0x20')](_0x2c182f)['then'](function(_0x1aac2e){return _0x1aac2e;});}return null;};}function removeEntity(_0x2acbb4,_0x2fa90c){return function(_0x5bce67){if(_0x5bce67){return _0x5bce67[_0xad52('0x21')]()['then'](function(){_0x2acbb4['status'](0xcc)[_0xad52('0x15')]();});}};}function handleEntityNotFound(_0x583999,_0x477b47){return function(_0x3a54a1){if(!_0x3a54a1){_0x583999['sendStatus'](0x194);}return _0x3a54a1;};}function handleError(_0x58adf5,_0xb526bf){_0xb526bf=_0xb526bf||0x1f4;return function(_0x31b5e0){logger[_0xad52('0x22')](_0x31b5e0['stack']);if(_0x31b5e0[_0xad52('0x23')]){delete _0x31b5e0['name'];}_0x58adf5[_0xad52('0x14')](_0xb526bf)[_0xad52('0x24')](_0x31b5e0);};}exports[_0xad52('0x25')]=function(_0x231bbe,_0x503bd0){var _0x426106={},_0x2a604c={},_0x534cc5={'count':0x0,'rows':[]};var _0x3f5757=_[_0xad52('0x26')](db[_0xad52('0x27')][_0xad52('0x28')],function(_0x32f4fe){return{'name':_0x32f4fe['fieldName'],'type':_0x32f4fe['type']['key']};});_0x2a604c[_0xad52('0x29')]=_[_0xad52('0x26')](_0x3f5757,_0xad52('0x23'));_0x2a604c['query']=_['keys'](_0x231bbe[_0xad52('0x2a')]);_0x2a604c[_0xad52('0x2b')]=_[_0xad52('0x2c')](_0x2a604c[_0xad52('0x29')],_0x2a604c[_0xad52('0x2a')]);_0x426106[_0xad52('0x2d')]=_['intersection'](_0x2a604c[_0xad52('0x29')],qs[_0xad52('0x2e')](_0x231bbe[_0xad52('0x2a')][_0xad52('0x2e')]));_0x426106[_0xad52('0x2d')]=_0x426106[_0xad52('0x2d')][_0xad52('0x2f')]?_0x426106[_0xad52('0x2d')]:_0x2a604c[_0xad52('0x29')];if(!_0x231bbe[_0xad52('0x2a')][_0xad52('0x30')]('nolimit')){_0x426106[_0xad52('0x19')]=qs[_0xad52('0x19')](_0x231bbe[_0xad52('0x2a')][_0xad52('0x19')]);_0x426106[_0xad52('0x17')]=qs[_0xad52('0x17')](_0x231bbe['query'][_0xad52('0x17')]);}_0x426106[_0xad52('0x31')]=qs[_0xad52('0x32')](_0x231bbe['query'][_0xad52('0x32')]);_0x426106[_0xad52('0x33')]=qs[_0xad52('0x2b')](_['pick'](_0x231bbe[_0xad52('0x2a')],_0x2a604c[_0xad52('0x2b')]),_0x3f5757);if(_0x231bbe[_0xad52('0x2a')]['filter']){_0x426106[_0xad52('0x33')]=_[_0xad52('0x34')](_0x426106[_0xad52('0x33')],{'$or':_[_0xad52('0x26')](_0x3f5757,function(_0x253c86){if(_0x253c86[_0xad52('0x35')]!=='VIRTUAL'){var _0xb1ea93={};_0xb1ea93[_0x253c86['name']]={'$like':'%'+_0x231bbe[_0xad52('0x2a')][_0xad52('0x36')]+'%'};return _0xb1ea93;}})});}_0x426106=_[_0xad52('0x34')]({},_0x426106,_0x231bbe[_0xad52('0x37')]);var _0x1d5e8a={'where':_0x426106['where']};return db[_0xad52('0x27')][_0xad52('0x1a')](_0x1d5e8a)[_0xad52('0x38')](function(_0x47f02c){_0x534cc5[_0xad52('0x1a')]=_0x47f02c;if(_0x231bbe[_0xad52('0x2a')][_0xad52('0x39')]){_0x426106['include']=[{'all':!![]}];}return db[_0xad52('0x27')]['findAll'](_0x426106);})[_0xad52('0x38')](function(_0x355381){_0x534cc5[_0xad52('0x3a')]=_0x355381;return _0x534cc5;})[_0xad52('0x38')](respondWithFilteredResult(_0x503bd0,_0x426106))['catch'](handleError(_0x503bd0,null));};exports[_0xad52('0x3b')]=function(_0x134d54,_0x249724){var _0x2bd94a={'raw':!![],'where':{'id':_0x134d54[_0xad52('0x3c')]['id']}},_0x3886ec={};_0x3886ec[_0xad52('0x29')]=_[_0xad52('0x3d')](db['FaxQueueReport'][_0xad52('0x28')]);_0x3886ec['query']=_[_0xad52('0x3d')](_0x134d54[_0xad52('0x2a')]);_0x3886ec[_0xad52('0x2b')]=_[_0xad52('0x2c')](_0x3886ec[_0xad52('0x29')],_0x3886ec[_0xad52('0x2a')]);_0x2bd94a[_0xad52('0x2d')]=_[_0xad52('0x2c')](_0x3886ec[_0xad52('0x29')],qs[_0xad52('0x2e')](_0x134d54[_0xad52('0x2a')][_0xad52('0x2e')]));_0x2bd94a[_0xad52('0x2d')]=_0x2bd94a[_0xad52('0x2d')][_0xad52('0x2f')]?_0x2bd94a[_0xad52('0x2d')]:_0x3886ec[_0xad52('0x29')];if(_0x134d54[_0xad52('0x2a')][_0xad52('0x39')]){_0x2bd94a[_0xad52('0x3e')]=[{'all':!![]}];}_0x2bd94a=_['merge']({},_0x2bd94a,_0x134d54[_0xad52('0x37')]);return db[_0xad52('0x27')][_0xad52('0x3f')](_0x2bd94a)['then'](handleEntityNotFound(_0x249724,null))[_0xad52('0x38')](respondWithResult(_0x249724,null))['catch'](handleError(_0x249724,null));};exports[_0xad52('0x40')]=function(_0x5bb02a,_0x4cf477){return db[_0xad52('0x27')][_0xad52('0x40')](_0x5bb02a[_0xad52('0x41')],{})[_0xad52('0x38')](respondWithResult(_0x4cf477,0xc9))['catch'](handleError(_0x4cf477,null));};exports['update']=function(_0x254416,_0x5dede4){if(_0x254416[_0xad52('0x41')]['id']){delete _0x254416['body']['id'];}return db[_0xad52('0x27')][_0xad52('0x3f')]({'where':{'id':_0x254416[_0xad52('0x3c')]['id']}})[_0xad52('0x38')](handleEntityNotFound(_0x5dede4,null))[_0xad52('0x38')](saveUpdates(_0x254416[_0xad52('0x41')],null))['then'](respondWithResult(_0x5dede4,null))[_0xad52('0x42')](handleError(_0x5dede4,null));};exports[_0xad52('0x21')]=function(_0x44c401,_0xb3a238){return db['FaxQueueReport'][_0xad52('0x3f')]({'where':{'id':_0x44c401[_0xad52('0x3c')]['id']}})[_0xad52('0x38')](handleEntityNotFound(_0xb3a238,null))['then'](removeEntity(_0xb3a238,null))[_0xad52('0x42')](handleError(_0xb3a238,null));};exports[_0xad52('0x43')]=function(_0x23400a,_0xe9baec){return db['FaxQueueReport'][_0xad52('0x43')]()[_0xad52('0x38')](respondWithResult(_0xe9baec,null))[_0xad52('0x42')](handleError(_0xe9baec,null));}; \ No newline at end of file +var _0x8482=['count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','options','findAll','rows','show','length','includeAll','include','find','create','body','catch','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x3a31ef,_0x1cabe6){var _0x15bd05=function(_0x14cfef){while(--_0x14cfef){_0x3a31ef['push'](_0x3a31ef['shift']());}};_0x15bd05(++_0x1cabe6);}(_0x8482,0x14e));var _0x2848=function(_0x295ee4,_0x58e026){_0x295ee4=_0x295ee4-0x0;var _0x8ba501=_0x8482[_0x295ee4];return _0x8ba501;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2848('0x0'));var zipdir=require(_0x2848('0x1'));var jsonpatch=require(_0x2848('0x2'));var rp=require(_0x2848('0x3'));var moment=require(_0x2848('0x4'));var BPromise=require(_0x2848('0x5'));var Mustache=require(_0x2848('0x6'));var util=require(_0x2848('0x7'));var path=require(_0x2848('0x8'));var sox=require(_0x2848('0x9'));var csv=require('to-csv');var ejs=require(_0x2848('0xa'));var fs=require('fs');var fs_extra=require(_0x2848('0xb'));var _=require('lodash');var squel=require(_0x2848('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2848('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2848('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2848('0xf'));var as=require(_0x2848('0x10'));var hardwareService=require(_0x2848('0x11'));var logger=require(_0x2848('0x12'))(_0x2848('0x13'));var utils=require(_0x2848('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2848('0x15'))['db'];function respondWithStatusCode(_0x465380,_0xf0658d){_0xf0658d=_0xf0658d||0xcc;return function(_0x566a0b){if(_0x566a0b){return _0x465380[_0x2848('0x16')](_0xf0658d);}return _0x465380[_0x2848('0x17')](_0xf0658d)[_0x2848('0x18')]();};}function respondWithResult(_0x5e64c7,_0xbddd26){_0xbddd26=_0xbddd26||0xc8;return function(_0x501a0e){if(_0x501a0e){return _0x5e64c7[_0x2848('0x17')](_0xbddd26)['json'](_0x501a0e);}};}function respondWithFilteredResult(_0x1002d2,_0xeba65b){return function(_0x6600c5){if(_0x6600c5){var _0x59f39a=typeof _0xeba65b['offset']==='undefined'&&typeof _0xeba65b['limit']===_0x2848('0x19');var _0x1acd41=_0x6600c5[_0x2848('0x1a')];var _0x46755c=_0x59f39a?0x0:_0xeba65b[_0x2848('0x1b')];var _0x3b4eeb=_0x59f39a?_0x6600c5[_0x2848('0x1a')]:_0xeba65b[_0x2848('0x1b')]+_0xeba65b[_0x2848('0x1c')];var _0x193ffa;if(_0x3b4eeb>=_0x1acd41){_0x3b4eeb=_0x1acd41;_0x193ffa=0xc8;}else{_0x193ffa=0xce;}_0x1002d2[_0x2848('0x17')](_0x193ffa);return _0x1002d2['set'](_0x2848('0x1d'),_0x46755c+'-'+_0x3b4eeb+'/'+_0x1acd41)[_0x2848('0x1e')](_0x6600c5);}return null;};}function patchUpdates(_0x1a1f79){return function(_0x5748ae){try{jsonpatch[_0x2848('0x1f')](_0x5748ae,_0x1a1f79,!![]);}catch(_0x1f67a7){return BPromise[_0x2848('0x20')](_0x1f67a7);}return _0x5748ae[_0x2848('0x21')]();};}function saveUpdates(_0x3b99a2,_0x555279){return function(_0x3dd7db){if(_0x3dd7db){return _0x3dd7db[_0x2848('0x22')](_0x3b99a2)[_0x2848('0x23')](function(_0x436709){return _0x436709;});}return null;};}function removeEntity(_0xea4128,_0x40f510){return function(_0x5f38e2){if(_0x5f38e2){return _0x5f38e2[_0x2848('0x24')]()['then'](function(){_0xea4128[_0x2848('0x17')](0xcc)[_0x2848('0x18')]();});}};}function handleEntityNotFound(_0x2d936a,_0x4517d3){return function(_0x51c924){if(!_0x51c924){_0x2d936a[_0x2848('0x16')](0x194);}return _0x51c924;};}function handleError(_0xecd4f4,_0xdba069){_0xdba069=_0xdba069||0x1f4;return function(_0x2dc32e){logger[_0x2848('0x25')](_0x2dc32e[_0x2848('0x26')]);if(_0x2dc32e[_0x2848('0x27')]){delete _0x2dc32e['name'];}_0xecd4f4['status'](_0xdba069)['send'](_0x2dc32e);};}exports[_0x2848('0x28')]=function(_0x18df37,_0x3b9c0d){var _0x3f915b={},_0x189701={},_0x528825={'count':0x0,'rows':[]};var _0x4c9685=_['map'](db[_0x2848('0x29')][_0x2848('0x2a')],function(_0x1ff601){return{'name':_0x1ff601[_0x2848('0x2b')],'type':_0x1ff601[_0x2848('0x2c')][_0x2848('0x2d')]};});_0x189701[_0x2848('0x2e')]=_[_0x2848('0x2f')](_0x4c9685,_0x2848('0x27'));_0x189701[_0x2848('0x30')]=_[_0x2848('0x31')](_0x18df37['query']);_0x189701[_0x2848('0x32')]=_[_0x2848('0x33')](_0x189701[_0x2848('0x2e')],_0x189701[_0x2848('0x30')]);_0x3f915b['attributes']=_[_0x2848('0x33')](_0x189701[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x18df37[_0x2848('0x30')]['fields']));_0x3f915b['attributes']=_0x3f915b['attributes']['length']?_0x3f915b[_0x2848('0x35')]:_0x189701[_0x2848('0x2e')];if(!_0x18df37['query']['hasOwnProperty'](_0x2848('0x36'))){_0x3f915b[_0x2848('0x1c')]=qs[_0x2848('0x1c')](_0x18df37[_0x2848('0x30')][_0x2848('0x1c')]);_0x3f915b['offset']=qs[_0x2848('0x1b')](_0x18df37[_0x2848('0x30')][_0x2848('0x1b')]);}_0x3f915b['order']=qs[_0x2848('0x37')](_0x18df37[_0x2848('0x30')][_0x2848('0x37')]);_0x3f915b[_0x2848('0x38')]=qs[_0x2848('0x32')](_['pick'](_0x18df37['query'],_0x189701[_0x2848('0x32')]),_0x4c9685);if(_0x18df37[_0x2848('0x30')][_0x2848('0x39')]){_0x3f915b[_0x2848('0x38')]=_[_0x2848('0x3a')](_0x3f915b[_0x2848('0x38')],{'$or':_['map'](_0x4c9685,function(_0x489ed8){if(_0x489ed8['type']!=='VIRTUAL'){var _0x5c3d4e={};_0x5c3d4e[_0x489ed8[_0x2848('0x27')]]={'$like':'%'+_0x18df37['query'][_0x2848('0x39')]+'%'};return _0x5c3d4e;}})});}_0x3f915b=_['merge']({},_0x3f915b,_0x18df37[_0x2848('0x3b')]);var _0x24af01={'where':_0x3f915b[_0x2848('0x38')]};return db['FaxQueueReport'][_0x2848('0x1a')](_0x24af01)[_0x2848('0x23')](function(_0x368ef1){_0x528825[_0x2848('0x1a')]=_0x368ef1;if(_0x18df37[_0x2848('0x30')]['includeAll']){_0x3f915b['include']=[{'all':!![]}];}return db[_0x2848('0x29')][_0x2848('0x3c')](_0x3f915b);})[_0x2848('0x23')](function(_0xfe7e37){_0x528825[_0x2848('0x3d')]=_0xfe7e37;return _0x528825;})[_0x2848('0x23')](respondWithFilteredResult(_0x3b9c0d,_0x3f915b))['catch'](handleError(_0x3b9c0d,null));};exports[_0x2848('0x3e')]=function(_0x5ef41f,_0x3208f2){var _0x56d0fa={'raw':!![],'where':{'id':_0x5ef41f['params']['id']}},_0x32f51a={};_0x32f51a['model']=_['keys'](db['FaxQueueReport'][_0x2848('0x2a')]);_0x32f51a[_0x2848('0x30')]=_[_0x2848('0x31')](_0x5ef41f[_0x2848('0x30')]);_0x32f51a[_0x2848('0x32')]=_[_0x2848('0x33')](_0x32f51a[_0x2848('0x2e')],_0x32f51a[_0x2848('0x30')]);_0x56d0fa[_0x2848('0x35')]=_['intersection'](_0x32f51a[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x5ef41f[_0x2848('0x30')]['fields']));_0x56d0fa[_0x2848('0x35')]=_0x56d0fa[_0x2848('0x35')][_0x2848('0x3f')]?_0x56d0fa[_0x2848('0x35')]:_0x32f51a[_0x2848('0x2e')];if(_0x5ef41f['query'][_0x2848('0x40')]){_0x56d0fa[_0x2848('0x41')]=[{'all':!![]}];}_0x56d0fa=_[_0x2848('0x3a')]({},_0x56d0fa,_0x5ef41f[_0x2848('0x3b')]);return db['FaxQueueReport'][_0x2848('0x42')](_0x56d0fa)[_0x2848('0x23')](handleEntityNotFound(_0x3208f2,null))[_0x2848('0x23')](respondWithResult(_0x3208f2,null))['catch'](handleError(_0x3208f2,null));};exports[_0x2848('0x43')]=function(_0xf6c69,_0x53420b){return db['FaxQueueReport'][_0x2848('0x43')](_0xf6c69[_0x2848('0x44')],{})[_0x2848('0x23')](respondWithResult(_0x53420b,0xc9))[_0x2848('0x45')](handleError(_0x53420b,null));};exports[_0x2848('0x22')]=function(_0x4e4b1e,_0x35ed61){if(_0x4e4b1e[_0x2848('0x44')]['id']){delete _0x4e4b1e[_0x2848('0x44')]['id'];}return db[_0x2848('0x29')][_0x2848('0x42')]({'where':{'id':_0x4e4b1e[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x35ed61,null))[_0x2848('0x23')](saveUpdates(_0x4e4b1e[_0x2848('0x44')],null))[_0x2848('0x23')](respondWithResult(_0x35ed61,null))[_0x2848('0x45')](handleError(_0x35ed61,null));};exports[_0x2848('0x24')]=function(_0xe8e50,_0x1a8946){return db[_0x2848('0x29')][_0x2848('0x42')]({'where':{'id':_0xe8e50[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x1a8946,null))[_0x2848('0x23')](removeEntity(_0x1a8946,null))[_0x2848('0x45')](handleError(_0x1a8946,null));};exports['describe']=function(_0x2814a2,_0x3b996e){return db['FaxQueueReport'][_0x2848('0x47')]()[_0x2848('0x23')](respondWithResult(_0x3b996e,null))['catch'](handleError(_0x3b996e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 172c2c3..9a3bb2f 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x4186cd,_0x514297){var _0x4613a0=function(_0x1a7d5a){while(--_0x1a7d5a){_0x4186cd['push'](_0x4186cd['shift']());}};_0x4613a0(++_0x514297);}(_0x7a54,0x106));var _0x47a5=function(_0xdc8b0b,_0x30a915){_0xdc8b0b=_0xdc8b0b-0x0;var _0x53b03c=_0x7a54[_0xdc8b0b];return _0x53b03c;};'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':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x5a6acb,_0x27c588){var _0x3d8718=function(_0x23a907){while(--_0x23a907){_0x5a6acb['push'](_0x5a6acb['shift']());}};_0x3d8718(++_0x27c588);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ebd05d5..8cef117 100644 --- a/server/api/faxQueueReport/faxQueueReport.rpc.js +++ b/server/api/faxQueueReport/faxQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x927a=['UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','create','body','options','stringify','catch','CreateFaxQueueReport'];(function(_0xe498a9,_0x5b1a31){var _0x3625f2=function(_0x21a40e){while(--_0x21a40e){_0xe498a9['push'](_0xe498a9['shift']());}};_0x3625f2(++_0x5b1a31);}(_0x927a,0xf4));var _0xa927=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x927a[_0x54b062];return _0x255e41;};'use strict';var _=require(_0xa927('0x0'));var util=require(_0xa927('0x1'));var moment=require(_0xa927('0x2'));var BPromise=require(_0xa927('0x3'));var rs=require(_0xa927('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa927('0x5'));var logger=require(_0xa927('0x6'))(_0xa927('0x7'));var config=require(_0xa927('0x8'));var jayson=require(_0xa927('0x9'));var client=jayson[_0xa927('0xa')][_0xa927('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bf9e6,_0x573346,_0x4cb767){return new BPromise(function(_0x3e5ea9,_0x35cba9){return client[_0xa927('0xc')](_0x5bf9e6,_0x4cb767)[_0xa927('0xd')](function(_0x57ae19){logger[_0xa927('0xe')](_0xa927('0xf'),_0x573346,_0xa927('0x10'));logger[_0xa927('0x11')](_0xa927('0x12'),_0x573346,'request\x20sent',JSON['stringify'](_0x57ae19));if(_0x57ae19[_0xa927('0x13')]){if(_0x57ae19[_0xa927('0x13')]['code']===0x1f4){logger[_0xa927('0x13')](_0xa927('0xf'),_0x573346,_0x57ae19[_0xa927('0x13')][_0xa927('0x14')]);return _0x35cba9(_0x57ae19[_0xa927('0x13')][_0xa927('0x14')]);}logger[_0xa927('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x573346,_0x57ae19['error'][_0xa927('0x14')]);return _0x3e5ea9(_0x57ae19['error'][_0xa927('0x14')]);}else{logger[_0xa927('0xe')](_0xa927('0xf'),_0x573346,_0xa927('0x10'));_0x3e5ea9(_0x57ae19[_0xa927('0x15')][_0xa927('0x14')]);}})['catch'](function(_0x2847ba){logger[_0xa927('0x13')](_0xa927('0xf'),_0x573346,_0x2847ba);_0x35cba9(_0x2847ba);});});}exports['CreateFaxQueueReport']=function(_0x10effb){var _0x5a14cd=this;return new Promise(function(_0x5387dd,_0x3b16fb){return db['FaxQueueReport'][_0xa927('0x16')](_0x10effb[_0xa927('0x17')],{'raw':_0x10effb[_0xa927('0x18')]?_0x10effb[_0xa927('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa927('0xd')](function(_0x146c73){logger['info']('CreateFaxQueueReport',_0x10effb);logger[_0xa927('0x11')]('CreateFaxQueueReport',_0x10effb,JSON[_0xa927('0x19')](_0x146c73));_0x5387dd(_0x146c73);})[_0xa927('0x1a')](function(_0x946215){logger[_0xa927('0x13')](_0xa927('0x1b'),_0x946215['message'],_0x10effb);_0x3b16fb(_0x5a14cd['error'](0x1f4,_0x946215['message']));});});};exports[_0xa927('0x1c')]=function(_0x44c384){var _0x382b4a=this;return new Promise(function(_0x52caa0,_0x2cd1c1){return db[_0xa927('0x1d')][_0xa927('0x1e')](_0x44c384['body'],{'raw':_0x44c384[_0xa927('0x18')]?_0x44c384['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44c384[_0xa927('0x18')]?_0x44c384[_0xa927('0x18')][_0xa927('0x1f')]||null:null,'attributes':_0x44c384[_0xa927('0x18')]?_0x44c384['options'][_0xa927('0x20')]||null:null,'limit':_0x44c384[_0xa927('0x18')]?_0x44c384[_0xa927('0x18')][_0xa927('0x21')]||null:null})['then'](function(_0x32a1e0){logger[_0xa927('0xe')]('UpdateFaxQueueReport',_0x44c384);logger[_0xa927('0x11')](_0xa927('0x1c'),_0x44c384,JSON[_0xa927('0x19')](_0x32a1e0));_0x52caa0(_0x32a1e0);})[_0xa927('0x1a')](function(_0x1d10a8){logger[_0xa927('0x13')]('UpdateFaxQueueReport',_0x1d10a8[_0xa927('0x14')],_0x44c384);_0x2cd1c1(_0x382b4a[_0xa927('0x13')](0x1f4,_0x1d10a8[_0xa927('0x14')]));});});}; \ No newline at end of file +var _0xbf16=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','update','attributes','limit','debug','util','bluebird','randomstring','../../mysqldb'];(function(_0x2934d1,_0x55c92d){var _0x1df1c9=function(_0x3f3910){while(--_0x3f3910){_0x2934d1['push'](_0x2934d1['shift']());}};_0x1df1c9(++_0x55c92d);}(_0xbf16,0x78));var _0x6bf1=function(_0x5964ee,_0x57e55c){_0x5964ee=_0x5964ee-0x0;var _0x129f50=_0xbf16[_0x5964ee];return _0x129f50;};'use strict';var _=require('lodash');var util=require(_0x6bf1('0x0'));var moment=require('moment');var BPromise=require(_0x6bf1('0x1'));var rs=require(_0x6bf1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bf1('0x3'))['db'];var utils=require(_0x6bf1('0x4'));var logger=require(_0x6bf1('0x5'))(_0x6bf1('0x6'));var config=require(_0x6bf1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6bf1('0x8')][_0x6bf1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x540ee5,_0x5aaa89,_0xa0e1c9){return new BPromise(function(_0x3532a2,_0x36a100){return client['request'](_0x540ee5,_0xa0e1c9)[_0x6bf1('0xa')](function(_0x588944){logger[_0x6bf1('0xb')](_0x6bf1('0xc'),_0x5aaa89,_0x6bf1('0xd'));logger['debug'](_0x6bf1('0xe'),_0x5aaa89,_0x6bf1('0xd'),JSON[_0x6bf1('0xf')](_0x588944));if(_0x588944[_0x6bf1('0x10')]){if(_0x588944['error'][_0x6bf1('0x11')]===0x1f4){logger[_0x6bf1('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x5aaa89,_0x588944[_0x6bf1('0x10')][_0x6bf1('0x12')]);return _0x36a100(_0x588944[_0x6bf1('0x10')][_0x6bf1('0x12')]);}logger[_0x6bf1('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x5aaa89,_0x588944[_0x6bf1('0x10')]['message']);return _0x3532a2(_0x588944[_0x6bf1('0x10')][_0x6bf1('0x12')]);}else{logger[_0x6bf1('0xb')](_0x6bf1('0xc'),_0x5aaa89,_0x6bf1('0xd'));_0x3532a2(_0x588944['result'][_0x6bf1('0x12')]);}})['catch'](function(_0x95aeca){logger[_0x6bf1('0x10')](_0x6bf1('0xc'),_0x5aaa89,_0x95aeca);_0x36a100(_0x95aeca);});});}exports['CreateFaxQueueReport']=function(_0x23f583){var _0x75ec4b=this;return new Promise(function(_0x26a126,_0x185373){return db[_0x6bf1('0x13')][_0x6bf1('0x14')](_0x23f583[_0x6bf1('0x15')],{'raw':_0x23f583[_0x6bf1('0x16')]?_0x23f583['options'][_0x6bf1('0x17')]===undefined?!![]:![]:!![]})[_0x6bf1('0xa')](function(_0x382ab1){logger[_0x6bf1('0xb')](_0x6bf1('0x18'),_0x23f583);logger['debug'](_0x6bf1('0x18'),_0x23f583,JSON[_0x6bf1('0xf')](_0x382ab1));_0x26a126(_0x382ab1);})[_0x6bf1('0x19')](function(_0x286ace){logger['error'](_0x6bf1('0x18'),_0x286ace['message'],_0x23f583);_0x185373(_0x75ec4b['error'](0x1f4,_0x286ace['message']));});});};exports[_0x6bf1('0x1a')]=function(_0x376ed5){var _0x380570=this;return new Promise(function(_0x34c250,_0x467d09){return db[_0x6bf1('0x13')][_0x6bf1('0x1b')](_0x376ed5[_0x6bf1('0x15')],{'raw':_0x376ed5[_0x6bf1('0x16')]?_0x376ed5['options'][_0x6bf1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x376ed5['options']?_0x376ed5['options']['where']||null:null,'attributes':_0x376ed5[_0x6bf1('0x16')]?_0x376ed5[_0x6bf1('0x16')][_0x6bf1('0x1c')]||null:null,'limit':_0x376ed5[_0x6bf1('0x16')]?_0x376ed5['options'][_0x6bf1('0x1d')]||null:null})[_0x6bf1('0xa')](function(_0x26152d){logger['info'](_0x6bf1('0x1a'),_0x376ed5);logger[_0x6bf1('0x1e')](_0x6bf1('0x1a'),_0x376ed5,JSON['stringify'](_0x26152d));_0x34c250(_0x26152d);})[_0x6bf1('0x19')](function(_0x680ceb){logger[_0x6bf1('0x10')](_0x6bf1('0x1a'),_0x680ceb[_0x6bf1('0x12')],_0x376ed5);_0x467d09(_0x380570['error'](0x1f4,_0x680ceb[_0x6bf1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e8a9748..26d8c4a 100644 --- a/server/api/faxQueueReport/index.js +++ b/server/api/faxQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7e2=['delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0xf7e2,0xd3));var _0x2f7e=function(_0x7e4ea1,_0x507baf){_0x7e4ea1=_0x7e4ea1-0x0;var _0x206b4d=_0xf7e2[_0x7e4ea1];return _0x206b4d;};'use strict';var multer=require('multer');var util=require(_0x2f7e('0x0'));var path=require('path');var timeout=require(_0x2f7e('0x1'));var express=require(_0x2f7e('0x2'));var router=express['Router']();var fs_extra=require(_0x2f7e('0x3'));var auth=require(_0x2f7e('0x4'));var interaction=require(_0x2f7e('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x2f7e('0x6')]('/',auth[_0x2f7e('0x7')](),controller[_0x2f7e('0x8')]);router[_0x2f7e('0x6')](_0x2f7e('0x9'),auth[_0x2f7e('0x7')](),controller[_0x2f7e('0xa')]);router[_0x2f7e('0x6')]('/:id',auth[_0x2f7e('0x7')](),controller[_0x2f7e('0xb')]);router[_0x2f7e('0xc')]('/',auth['isAuthenticated'](),controller[_0x2f7e('0xd')]);router[_0x2f7e('0xe')](_0x2f7e('0xf'),auth[_0x2f7e('0x7')](),controller[_0x2f7e('0x10')]);router[_0x2f7e('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2f7e('0x12')]=router; \ No newline at end of file +var _0x0cb5=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','describe','post','create','put','update','destroy','multer','path','connect-timeout'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0x0cb5,0x82));var _0x50cb=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x0cb5[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x50cb('0x0'));var util=require('util');var path=require(_0x50cb('0x1'));var timeout=require(_0x50cb('0x2'));var express=require(_0x50cb('0x3'));var router=express['Router']();var fs_extra=require(_0x50cb('0x4'));var auth=require(_0x50cb('0x5'));var interaction=require(_0x50cb('0x6'));var config=require(_0x50cb('0x7'));var controller=require(_0x50cb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x50cb('0x9')]);router[_0x50cb('0xa')](_0x50cb('0xb'),auth[_0x50cb('0xc')](),controller[_0x50cb('0xd')]);router[_0x50cb('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x50cb('0xe')]('/',auth['isAuthenticated'](),controller[_0x50cb('0xf')]);router[_0x50cb('0x10')]('/:id',auth[_0x50cb('0xc')](),controller[_0x50cb('0x11')]);router['delete']('/:id',auth[_0x50cb('0xc')](),controller[_0x50cb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 875939c..2293400 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1e5875,_0x1cb135){var _0x1b07e2=function(_0x4d806b){while(--_0x4d806b){_0x1e5875['push'](_0x1e5875['shift']());}};_0x1b07e2(++_0x1cb135);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2d2945,_0x58eae3){_0x2d2945=_0x2d2945-0x0;var _0x15b91e=_0xf4eb[_0x2d2945];return _0x15b91e;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x56bedf,_0x54d134){var _0x13cbb0=function(_0x44ae86){while(--_0x44ae86){_0x56bedf['push'](_0x56bedf['shift']());}};_0x13cbb0(++_0x54d134);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5378b5,_0x333e35){_0x5378b5=_0x5378b5-0x0;var _0x2d8bd3=_0xf4eb[_0x5378b5];return _0x2d8bd3;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 2f0e997..8e26688 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bbe=['include','findAll','rows','params','keys','intersection','length','options','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','offset','undefined','count','set','Content-Range','json','save','update','then','destroy','status','end','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','attributes','fields','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll'];(function(_0x376a41,_0x49379f){var _0x5e926f=function(_0x828f18){while(--_0x828f18){_0x376a41['push'](_0x376a41['shift']());}};_0x5e926f(++_0x49379f);}(_0x1bbe,0xa5));var _0xe1bb=function(_0x4924fc,_0x2f1a03){_0x4924fc=_0x4924fc-0x0;var _0xb11cbf=_0x1bbe[_0x4924fc];return _0xb11cbf;};'use strict';var emlformat=require(_0xe1bb('0x0'));var rimraf=require(_0xe1bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1bb('0x2'));var rp=require(_0xe1bb('0x3'));var moment=require(_0xe1bb('0x4'));var BPromise=require(_0xe1bb('0x5'));var Mustache=require(_0xe1bb('0x6'));var util=require(_0xe1bb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe1bb('0x8'));var ejs=require(_0xe1bb('0x9'));var fs=require('fs');var fs_extra=require(_0xe1bb('0xa'));var _=require(_0xe1bb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe1bb('0xc'));var deskjs=require(_0xe1bb('0xd'));var toCsv=require(_0xe1bb('0x8'));var querystring=require('querystring');var Papa=require(_0xe1bb('0xe'));var Redis=require('ioredis');var authService=require(_0xe1bb('0xf'));var qs=require(_0xe1bb('0x10'));var as=require(_0xe1bb('0x11'));var hardwareService=require(_0xe1bb('0x12'));var logger=require(_0xe1bb('0x13'))(_0xe1bb('0x14'));var utils=require(_0xe1bb('0x15'));var config=require(_0xe1bb('0x16'));var licenseUtil=require(_0xe1bb('0x17'));var db=require(_0xe1bb('0x18'))['db'];function respondWithStatusCode(_0x3c0713,_0x35b6dc){_0x35b6dc=_0x35b6dc||0xcc;return function(_0x185218){if(_0x185218){return _0x3c0713['sendStatus'](_0x35b6dc);}return _0x3c0713['status'](_0x35b6dc)['end']();};}function respondWithResult(_0x4b3d3e,_0x551873){_0x551873=_0x551873||0xc8;return function(_0x5496a1){if(_0x5496a1){return _0x4b3d3e['status'](_0x551873)['json'](_0x5496a1);}};}function respondWithFilteredResult(_0x455016,_0x541c58){return function(_0x51b33f){if(_0x51b33f){var _0xa4c477=typeof _0x541c58[_0xe1bb('0x19')]===_0xe1bb('0x1a')&&typeof _0x541c58['limit']===_0xe1bb('0x1a');var _0x5bd5fc=_0x51b33f[_0xe1bb('0x1b')];var _0x496ca7=_0xa4c477?0x0:_0x541c58[_0xe1bb('0x19')];var _0x3f0345=_0xa4c477?_0x51b33f[_0xe1bb('0x1b')]:_0x541c58['offset']+_0x541c58['limit'];var _0x156370;if(_0x3f0345>=_0x5bd5fc){_0x3f0345=_0x5bd5fc;_0x156370=0xc8;}else{_0x156370=0xce;}_0x455016['status'](_0x156370);return _0x455016[_0xe1bb('0x1c')](_0xe1bb('0x1d'),_0x496ca7+'-'+_0x3f0345+'/'+_0x5bd5fc)[_0xe1bb('0x1e')](_0x51b33f);}return null;};}function patchUpdates(_0x378350){return function(_0x184c4c){try{jsonpatch['apply'](_0x184c4c,_0x378350,!![]);}catch(_0x2dddff){return BPromise['reject'](_0x2dddff);}return _0x184c4c[_0xe1bb('0x1f')]();};}function saveUpdates(_0x4041d3,_0x5782fb){return function(_0x2e08bf){if(_0x2e08bf){return _0x2e08bf[_0xe1bb('0x20')](_0x4041d3)[_0xe1bb('0x21')](function(_0x1bc313){return _0x1bc313;});}return null;};}function removeEntity(_0x92d397,_0x39aee6){return function(_0x57fadd){if(_0x57fadd){return _0x57fadd[_0xe1bb('0x22')]()['then'](function(){_0x92d397[_0xe1bb('0x23')](0xcc)[_0xe1bb('0x24')]();});}};}function handleEntityNotFound(_0x5cc176,_0x5a5a56){return function(_0x36e90b){if(!_0x36e90b){_0x5cc176[_0xe1bb('0x25')](0x194);}return _0x36e90b;};}function handleError(_0x308aed,_0x12fa8f){_0x12fa8f=_0x12fa8f||0x1f4;return function(_0x473a04){logger[_0xe1bb('0x26')](_0x473a04[_0xe1bb('0x27')]);if(_0x473a04[_0xe1bb('0x28')]){delete _0x473a04['name'];}_0x308aed[_0xe1bb('0x23')](_0x12fa8f)[_0xe1bb('0x29')](_0x473a04);};}exports[_0xe1bb('0x2a')]=function(_0x54136f,_0x33b8ad){var _0xfb94dd={},_0x567c83={},_0x365e60={'count':0x0,'rows':[]};var _0x112073=_[_0xe1bb('0x2b')](db[_0xe1bb('0x2c')][_0xe1bb('0x2d')],function(_0x2342e0){return{'name':_0x2342e0['fieldName'],'type':_0x2342e0[_0xe1bb('0x2e')][_0xe1bb('0x2f')]};});_0x567c83[_0xe1bb('0x30')]=_[_0xe1bb('0x2b')](_0x112073,_0xe1bb('0x28'));_0x567c83[_0xe1bb('0x31')]=_['keys'](_0x54136f['query']);_0x567c83['filters']=_['intersection'](_0x567c83['model'],_0x567c83[_0xe1bb('0x31')]);_0xfb94dd[_0xe1bb('0x32')]=_['intersection'](_0x567c83[_0xe1bb('0x30')],qs[_0xe1bb('0x33')](_0x54136f[_0xe1bb('0x31')][_0xe1bb('0x33')]));_0xfb94dd[_0xe1bb('0x32')]=_0xfb94dd[_0xe1bb('0x32')]['length']?_0xfb94dd['attributes']:_0x567c83[_0xe1bb('0x30')];if(!_0x54136f[_0xe1bb('0x31')]['hasOwnProperty'](_0xe1bb('0x34'))){_0xfb94dd[_0xe1bb('0x35')]=qs['limit'](_0x54136f['query']['limit']);_0xfb94dd[_0xe1bb('0x19')]=qs[_0xe1bb('0x19')](_0x54136f[_0xe1bb('0x31')][_0xe1bb('0x19')]);}_0xfb94dd[_0xe1bb('0x36')]=qs[_0xe1bb('0x37')](_0x54136f[_0xe1bb('0x31')]['sort']);_0xfb94dd['where']=qs[_0xe1bb('0x38')](_[_0xe1bb('0x39')](_0x54136f[_0xe1bb('0x31')],_0x567c83[_0xe1bb('0x38')]),_0x112073);if(_0x54136f[_0xe1bb('0x31')][_0xe1bb('0x3a')]){_0xfb94dd[_0xe1bb('0x3b')]=_[_0xe1bb('0x3c')](_0xfb94dd['where'],{'$or':_[_0xe1bb('0x2b')](_0x112073,function(_0x487a2b){if(_0x487a2b['type']!==_0xe1bb('0x3d')){var _0x48560a={};_0x48560a[_0x487a2b[_0xe1bb('0x28')]]={'$like':'%'+_0x54136f['query']['filter']+'%'};return _0x48560a;}})});}_0xfb94dd=_[_0xe1bb('0x3c')]({},_0xfb94dd,_0x54136f['options']);var _0x2b16ac={'where':_0xfb94dd[_0xe1bb('0x3b')]};return db[_0xe1bb('0x2c')][_0xe1bb('0x1b')](_0x2b16ac)['then'](function(_0x9c77ea){_0x365e60[_0xe1bb('0x1b')]=_0x9c77ea;if(_0x54136f[_0xe1bb('0x31')][_0xe1bb('0x3e')]){_0xfb94dd[_0xe1bb('0x3f')]=[{'all':!![]}];}return db[_0xe1bb('0x2c')][_0xe1bb('0x40')](_0xfb94dd);})[_0xe1bb('0x21')](function(_0x38aea1){_0x365e60[_0xe1bb('0x41')]=_0x38aea1;return _0x365e60;})[_0xe1bb('0x21')](respondWithFilteredResult(_0x33b8ad,_0xfb94dd))['catch'](handleError(_0x33b8ad,null));};exports['show']=function(_0x25a92f,_0x812342){var _0x4b5635={'raw':!![],'where':{'id':_0x25a92f[_0xe1bb('0x42')]['id']}},_0x3679b8={};_0x3679b8['model']=_[_0xe1bb('0x43')](db[_0xe1bb('0x2c')]['rawAttributes']);_0x3679b8['query']=_[_0xe1bb('0x43')](_0x25a92f[_0xe1bb('0x31')]);_0x3679b8[_0xe1bb('0x38')]=_[_0xe1bb('0x44')](_0x3679b8['model'],_0x3679b8[_0xe1bb('0x31')]);_0x4b5635[_0xe1bb('0x32')]=_['intersection'](_0x3679b8[_0xe1bb('0x30')],qs[_0xe1bb('0x33')](_0x25a92f[_0xe1bb('0x31')][_0xe1bb('0x33')]));_0x4b5635[_0xe1bb('0x32')]=_0x4b5635[_0xe1bb('0x32')][_0xe1bb('0x45')]?_0x4b5635[_0xe1bb('0x32')]:_0x3679b8[_0xe1bb('0x30')];if(_0x25a92f[_0xe1bb('0x31')][_0xe1bb('0x3e')]){_0x4b5635[_0xe1bb('0x3f')]=[{'all':!![]}];}_0x4b5635=_['merge']({},_0x4b5635,_0x25a92f[_0xe1bb('0x46')]);return db[_0xe1bb('0x2c')][_0xe1bb('0x47')](_0x4b5635)[_0xe1bb('0x21')](handleEntityNotFound(_0x812342,null))[_0xe1bb('0x21')](respondWithResult(_0x812342,null))['catch'](handleError(_0x812342,null));};exports['create']=function(_0x426fe2,_0x3476bb){return db[_0xe1bb('0x2c')][_0xe1bb('0x48')](_0x426fe2[_0xe1bb('0x49')],{})[_0xe1bb('0x21')](respondWithResult(_0x3476bb,0xc9))['catch'](handleError(_0x3476bb,null));};exports[_0xe1bb('0x20')]=function(_0x304e25,_0x5f012e){if(_0x304e25['body']['id']){delete _0x304e25[_0xe1bb('0x49')]['id'];}return db[_0xe1bb('0x2c')][_0xe1bb('0x47')]({'where':{'id':_0x304e25[_0xe1bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x5f012e,null))['then'](saveUpdates(_0x304e25[_0xe1bb('0x49')],null))[_0xe1bb('0x21')](respondWithResult(_0x5f012e,null))[_0xe1bb('0x4a')](handleError(_0x5f012e,null));};exports[_0xe1bb('0x22')]=function(_0x17d16a,_0x819e1e){return db[_0xe1bb('0x2c')][_0xe1bb('0x47')]({'where':{'id':_0x17d16a['params']['id']}})['then'](handleEntityNotFound(_0x819e1e,null))[_0xe1bb('0x21')](removeEntity(_0x819e1e,null))[_0xe1bb('0x4a')](handleError(_0x819e1e,null));};exports[_0xe1bb('0x4b')]=function(_0x12658c,_0x5a9ca2){return db[_0xe1bb('0x2c')]['describe']()[_0xe1bb('0x21')](respondWithResult(_0x5a9ca2,null))[_0xe1bb('0x4a')](handleError(_0x5a9ca2,null));}; \ No newline at end of file +var _0xbec8=['ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','apply','save','then','destroy','error','stack','send','map','rawAttributes','fieldName','key','keys','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','name','includeAll','include','FaxTransferReport','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x6ac759,_0x4feeb2){var _0x3daf4e=function(_0x22e31e){while(--_0x22e31e){_0x6ac759['push'](_0x6ac759['shift']());}};_0x3daf4e(++_0x4feeb2);}(_0xbec8,0x154));var _0x8bec=function(_0xc1136d,_0x3d339f){_0xc1136d=_0xc1136d-0x0;var _0x3ba510=_0xbec8[_0xc1136d];return _0x3ba510;};'use strict';var emlformat=require(_0x8bec('0x0'));var rimraf=require(_0x8bec('0x1'));var zipdir=require(_0x8bec('0x2'));var jsonpatch=require(_0x8bec('0x3'));var rp=require('request-promise');var moment=require(_0x8bec('0x4'));var BPromise=require(_0x8bec('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8bec('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8bec('0x7'));var fs=require('fs');var fs_extra=require(_0x8bec('0x8'));var _=require(_0x8bec('0x9'));var squel=require(_0x8bec('0xa'));var crypto=require(_0x8bec('0xb'));var jsforce=require(_0x8bec('0xc'));var deskjs=require(_0x8bec('0xd'));var toCsv=require(_0x8bec('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8bec('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8bec('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bec('0x11'));var logger=require('../../config/logger')(_0x8bec('0x12'));var utils=require('../../config/utils');var config=require(_0x8bec('0x13'));var licenseUtil=require(_0x8bec('0x14'));var db=require(_0x8bec('0x15'))['db'];function respondWithStatusCode(_0x42cffc,_0x34e6d3){_0x34e6d3=_0x34e6d3||0xcc;return function(_0xc5bbc2){if(_0xc5bbc2){return _0x42cffc[_0x8bec('0x16')](_0x34e6d3);}return _0x42cffc['status'](_0x34e6d3)[_0x8bec('0x17')]();};}function respondWithResult(_0x6f48dc,_0x3d33be){_0x3d33be=_0x3d33be||0xc8;return function(_0x4e2449){if(_0x4e2449){return _0x6f48dc['status'](_0x3d33be)['json'](_0x4e2449);}};}function respondWithFilteredResult(_0x3c8865,_0x1172f5){return function(_0x34fdf7){if(_0x34fdf7){var _0x4777d7=typeof _0x1172f5[_0x8bec('0x18')]===_0x8bec('0x19')&&typeof _0x1172f5[_0x8bec('0x1a')]===_0x8bec('0x19');var _0x316b82=_0x34fdf7['count'];var _0x3f3aa0=_0x4777d7?0x0:_0x1172f5[_0x8bec('0x18')];var _0x1ce260=_0x4777d7?_0x34fdf7[_0x8bec('0x1b')]:_0x1172f5[_0x8bec('0x18')]+_0x1172f5[_0x8bec('0x1a')];var _0x330ab5;if(_0x1ce260>=_0x316b82){_0x1ce260=_0x316b82;_0x330ab5=0xc8;}else{_0x330ab5=0xce;}_0x3c8865[_0x8bec('0x1c')](_0x330ab5);return _0x3c8865[_0x8bec('0x1d')]('Content-Range',_0x3f3aa0+'-'+_0x1ce260+'/'+_0x316b82)['json'](_0x34fdf7);}return null;};}function patchUpdates(_0x21460e){return function(_0x4fc0cb){try{jsonpatch[_0x8bec('0x1e')](_0x4fc0cb,_0x21460e,!![]);}catch(_0x3c97e7){return BPromise['reject'](_0x3c97e7);}return _0x4fc0cb[_0x8bec('0x1f')]();};}function saveUpdates(_0x4bcf57,_0x3db847){return function(_0x43ce71){if(_0x43ce71){return _0x43ce71['update'](_0x4bcf57)[_0x8bec('0x20')](function(_0x28e9d3){return _0x28e9d3;});}return null;};}function removeEntity(_0x33eff6,_0x3ea66a){return function(_0x22a0e3){if(_0x22a0e3){return _0x22a0e3[_0x8bec('0x21')]()['then'](function(){_0x33eff6[_0x8bec('0x1c')](0xcc)[_0x8bec('0x17')]();});}};}function handleEntityNotFound(_0x45e9ad,_0x53e5fa){return function(_0x2443a5){if(!_0x2443a5){_0x45e9ad[_0x8bec('0x16')](0x194);}return _0x2443a5;};}function handleError(_0x211cb,_0xfc67fd){_0xfc67fd=_0xfc67fd||0x1f4;return function(_0x60a9c){logger[_0x8bec('0x22')](_0x60a9c[_0x8bec('0x23')]);if(_0x60a9c['name']){delete _0x60a9c['name'];}_0x211cb[_0x8bec('0x1c')](_0xfc67fd)[_0x8bec('0x24')](_0x60a9c);};}exports['index']=function(_0x901e76,_0x29d427){var _0x26ef1f={},_0x15e1b9={},_0x113cbd={'count':0x0,'rows':[]};var _0x5236a6=_[_0x8bec('0x25')](db['FaxTransferReport'][_0x8bec('0x26')],function(_0x5aa921){return{'name':_0x5aa921[_0x8bec('0x27')],'type':_0x5aa921['type'][_0x8bec('0x28')]};});_0x15e1b9['model']=_['map'](_0x5236a6,'name');_0x15e1b9['query']=_[_0x8bec('0x29')](_0x901e76[_0x8bec('0x2a')]);_0x15e1b9['filters']=_['intersection'](_0x15e1b9[_0x8bec('0x2b')],_0x15e1b9[_0x8bec('0x2a')]);_0x26ef1f[_0x8bec('0x2c')]=_[_0x8bec('0x2d')](_0x15e1b9['model'],qs['fields'](_0x901e76[_0x8bec('0x2a')][_0x8bec('0x2e')]));_0x26ef1f[_0x8bec('0x2c')]=_0x26ef1f['attributes']['length']?_0x26ef1f['attributes']:_0x15e1b9[_0x8bec('0x2b')];if(!_0x901e76[_0x8bec('0x2a')][_0x8bec('0x2f')](_0x8bec('0x30'))){_0x26ef1f[_0x8bec('0x1a')]=qs[_0x8bec('0x1a')](_0x901e76[_0x8bec('0x2a')][_0x8bec('0x1a')]);_0x26ef1f[_0x8bec('0x18')]=qs[_0x8bec('0x18')](_0x901e76[_0x8bec('0x2a')][_0x8bec('0x18')]);}_0x26ef1f[_0x8bec('0x31')]=qs[_0x8bec('0x32')](_0x901e76[_0x8bec('0x2a')][_0x8bec('0x32')]);_0x26ef1f['where']=qs[_0x8bec('0x33')](_[_0x8bec('0x34')](_0x901e76[_0x8bec('0x2a')],_0x15e1b9[_0x8bec('0x33')]),_0x5236a6);if(_0x901e76['query'][_0x8bec('0x35')]){_0x26ef1f['where']=_[_0x8bec('0x36')](_0x26ef1f[_0x8bec('0x37')],{'$or':_[_0x8bec('0x25')](_0x5236a6,function(_0x20667a){if(_0x20667a[_0x8bec('0x38')]!==_0x8bec('0x39')){var _0x113b86={};_0x113b86[_0x20667a[_0x8bec('0x3a')]]={'$like':'%'+_0x901e76[_0x8bec('0x2a')][_0x8bec('0x35')]+'%'};return _0x113b86;}})});}_0x26ef1f=_[_0x8bec('0x36')]({},_0x26ef1f,_0x901e76['options']);var _0x4a7714={'where':_0x26ef1f['where']};return db['FaxTransferReport'][_0x8bec('0x1b')](_0x4a7714)[_0x8bec('0x20')](function(_0x3f0cc7){_0x113cbd[_0x8bec('0x1b')]=_0x3f0cc7;if(_0x901e76[_0x8bec('0x2a')][_0x8bec('0x3b')]){_0x26ef1f[_0x8bec('0x3c')]=[{'all':!![]}];}return db[_0x8bec('0x3d')][_0x8bec('0x3e')](_0x26ef1f);})[_0x8bec('0x20')](function(_0x11b879){_0x113cbd[_0x8bec('0x3f')]=_0x11b879;return _0x113cbd;})[_0x8bec('0x20')](respondWithFilteredResult(_0x29d427,_0x26ef1f))[_0x8bec('0x40')](handleError(_0x29d427,null));};exports[_0x8bec('0x41')]=function(_0x542728,_0x497d7f){var _0x1ccfe5={'raw':!![],'where':{'id':_0x542728[_0x8bec('0x42')]['id']}},_0x596b89={};_0x596b89[_0x8bec('0x2b')]=_[_0x8bec('0x29')](db['FaxTransferReport'][_0x8bec('0x26')]);_0x596b89[_0x8bec('0x2a')]=_[_0x8bec('0x29')](_0x542728[_0x8bec('0x2a')]);_0x596b89['filters']=_[_0x8bec('0x2d')](_0x596b89[_0x8bec('0x2b')],_0x596b89['query']);_0x1ccfe5[_0x8bec('0x2c')]=_[_0x8bec('0x2d')](_0x596b89[_0x8bec('0x2b')],qs[_0x8bec('0x2e')](_0x542728[_0x8bec('0x2a')]['fields']));_0x1ccfe5[_0x8bec('0x2c')]=_0x1ccfe5[_0x8bec('0x2c')]['length']?_0x1ccfe5[_0x8bec('0x2c')]:_0x596b89[_0x8bec('0x2b')];if(_0x542728[_0x8bec('0x2a')]['includeAll']){_0x1ccfe5[_0x8bec('0x3c')]=[{'all':!![]}];}_0x1ccfe5=_[_0x8bec('0x36')]({},_0x1ccfe5,_0x542728['options']);return db[_0x8bec('0x3d')]['find'](_0x1ccfe5)[_0x8bec('0x20')](handleEntityNotFound(_0x497d7f,null))[_0x8bec('0x20')](respondWithResult(_0x497d7f,null))[_0x8bec('0x40')](handleError(_0x497d7f,null));};exports[_0x8bec('0x43')]=function(_0xc419e3,_0x36bbc9){return db[_0x8bec('0x3d')][_0x8bec('0x43')](_0xc419e3[_0x8bec('0x44')],{})['then'](respondWithResult(_0x36bbc9,0xc9))['catch'](handleError(_0x36bbc9,null));};exports['update']=function(_0x1274de,_0x3bc794){if(_0x1274de['body']['id']){delete _0x1274de[_0x8bec('0x44')]['id'];}return db[_0x8bec('0x3d')][_0x8bec('0x45')]({'where':{'id':_0x1274de['params']['id']}})[_0x8bec('0x20')](handleEntityNotFound(_0x3bc794,null))['then'](saveUpdates(_0x1274de[_0x8bec('0x44')],null))[_0x8bec('0x20')](respondWithResult(_0x3bc794,null))[_0x8bec('0x40')](handleError(_0x3bc794,null));};exports[_0x8bec('0x21')]=function(_0x2f04b9,_0x284c48){return db['FaxTransferReport'][_0x8bec('0x45')]({'where':{'id':_0x2f04b9[_0x8bec('0x42')]['id']}})[_0x8bec('0x20')](handleEntityNotFound(_0x284c48,null))[_0x8bec('0x20')](removeEntity(_0x284c48,null))['catch'](handleError(_0x284c48,null));};exports[_0x8bec('0x46')]=function(_0xd62b04,_0x390b05){return db[_0x8bec('0x3d')][_0x8bec('0x46')]()[_0x8bec('0x20')](respondWithResult(_0x390b05,null))[_0x8bec('0x40')](handleError(_0x390b05,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index abf0f7c..83c654d 100644 --- a/server/api/faxTransferReport/faxTransferReport.model.js +++ b/server/api/faxTransferReport/faxTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e3e=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x6b600b,_0x31b896){var _0x548c8b=function(_0x57cf4f){while(--_0x57cf4f){_0x6b600b['push'](_0x6b600b['shift']());}};_0x548c8b(++_0x31b896);}(_0x0e3e,0x143));var _0xe0e3=function(_0x5d7782,_0x2b9fb8){_0x5d7782=_0x5d7782-0x0;var _0x47a155=_0x0e3e[_0x5d7782];return _0x47a155;};'use strict';var _=require(_0xe0e3('0x0'));var util=require(_0xe0e3('0x1'));var logger=require(_0xe0e3('0x2'))(_0xe0e3('0x3'));var moment=require(_0xe0e3('0x4'));var BPromise=require(_0xe0e3('0x5'));var rp=require(_0xe0e3('0x6'));var fs=require('fs');var path=require(_0xe0e3('0x7'));var rimraf=require('rimraf');var config=require(_0xe0e3('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xe0e3('0x9')]=function(_0x2c2f0e,_0x1011fb){return _0x2c2f0e[_0xe0e3('0xa')](_0xe0e3('0xb'),attributes,{'tableName':_0xe0e3('0xc'),'paranoid':![],'indexes':[{'name':_0xe0e3('0xd'),'fields':[_0xe0e3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f8f=['define','FaxTransferReport','report_fax_transfer','uniqueid','util','moment','request-promise','path','./faxTransferReport.attributes'];(function(_0x583fa4,_0x11cb1e){var _0x33a62c=function(_0x231e64){while(--_0x231e64){_0x583fa4['push'](_0x583fa4['shift']());}};_0x33a62c(++_0x11cb1e);}(_0x4f8f,0x175));var _0xf4f8=function(_0x58fba6,_0x5de5ba){_0x58fba6=_0x58fba6-0x0;var _0x1960d=_0x4f8f[_0x58fba6];return _0x1960d;};'use strict';var _=require('lodash');var util=require(_0xf4f8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf4f8('0x1'));var BPromise=require('bluebird');var rp=require(_0xf4f8('0x2'));var fs=require('fs');var path=require(_0xf4f8('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf4f8('0x4'));module['exports']=function(_0x22d252,_0x409b25){return _0x22d252[_0xf4f8('0x5')](_0xf4f8('0x6'),attributes,{'tableName':_0xf4f8('0x7'),'paranoid':![],'indexes':[{'name':_0xf4f8('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6353a34..eaefbcc 100644 --- a/server/api/faxTransferReport/faxTransferReport.rpc.js +++ b/server/api/faxTransferReport/faxTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x118b=['code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x30cca9,_0x3dfdad){var _0x553742=function(_0x4e1594){while(--_0x4e1594){_0x30cca9['push'](_0x30cca9['shift']());}};_0x553742(++_0x3dfdad);}(_0x118b,0x72));var _0xb118=function(_0x428d9a,_0x4e724d){_0x428d9a=_0x428d9a-0x0;var _0x50da90=_0x118b[_0x428d9a];return _0x50da90;};'use strict';var _=require('lodash');var util=require(_0xb118('0x0'));var moment=require(_0xb118('0x1'));var BPromise=require('bluebird');var rs=require(_0xb118('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb118('0x3'))['db'];var utils=require(_0xb118('0x4'));var logger=require(_0xb118('0x5'))(_0xb118('0x6'));var config=require(_0xb118('0x7'));var jayson=require(_0xb118('0x8'));var client=jayson[_0xb118('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x251e0c,_0x52b9b9,_0x3b12cb){return new BPromise(function(_0x4970ed,_0x19e9ce){return client[_0xb118('0xa')](_0x251e0c,_0x3b12cb)['then'](function(_0x11b0a1){logger[_0xb118('0xb')](_0xb118('0xc'),_0x52b9b9,'request\x20sent');logger[_0xb118('0xd')](_0xb118('0xe'),_0x52b9b9,_0xb118('0xf'),JSON[_0xb118('0x10')](_0x11b0a1));if(_0x11b0a1[_0xb118('0x11')]){if(_0x11b0a1[_0xb118('0x11')][_0xb118('0x12')]===0x1f4){logger[_0xb118('0x11')](_0xb118('0xc'),_0x52b9b9,_0x11b0a1[_0xb118('0x11')]['message']);return _0x19e9ce(_0x11b0a1['error']['message']);}logger[_0xb118('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x52b9b9,_0x11b0a1[_0xb118('0x11')][_0xb118('0x13')]);return _0x4970ed(_0x11b0a1['error'][_0xb118('0x13')]);}else{logger[_0xb118('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x52b9b9,_0xb118('0xf'));_0x4970ed(_0x11b0a1[_0xb118('0x14')][_0xb118('0x13')]);}})[_0xb118('0x15')](function(_0x3ed354){logger[_0xb118('0x11')](_0xb118('0xc'),_0x52b9b9,_0x3ed354);_0x19e9ce(_0x3ed354);});});} \ No newline at end of file +var _0xa9bb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9bb,0x6c));var _0xba9b=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xa9bb[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0xba9b('0x0'));var util=require(_0xba9b('0x1'));var moment=require(_0xba9b('0x2'));var BPromise=require(_0xba9b('0x3'));var rs=require(_0xba9b('0x4'));var fs=require('fs');var Redis=require(_0xba9b('0x5'));var db=require(_0xba9b('0x6'))['db'];var utils=require(_0xba9b('0x7'));var logger=require(_0xba9b('0x8'))(_0xba9b('0x9'));var config=require(_0xba9b('0xa'));var jayson=require(_0xba9b('0xb'));var client=jayson[_0xba9b('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35be65,_0x518d3b,_0x268b0a){return new BPromise(function(_0x3e0cdf,_0x47205d){return client[_0xba9b('0xd')](_0x35be65,_0x268b0a)[_0xba9b('0xe')](function(_0x4a914e){logger[_0xba9b('0xf')](_0xba9b('0x10'),_0x518d3b,_0xba9b('0x11'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x518d3b,_0xba9b('0x11'),JSON['stringify'](_0x4a914e));if(_0x4a914e['error']){if(_0x4a914e['error'][_0xba9b('0x12')]===0x1f4){logger[_0xba9b('0x13')](_0xba9b('0x10'),_0x518d3b,_0x4a914e[_0xba9b('0x13')][_0xba9b('0x14')]);return _0x47205d(_0x4a914e[_0xba9b('0x13')][_0xba9b('0x14')]);}logger[_0xba9b('0x13')](_0xba9b('0x10'),_0x518d3b,_0x4a914e[_0xba9b('0x13')][_0xba9b('0x14')]);return _0x3e0cdf(_0x4a914e['error']['message']);}else{logger[_0xba9b('0xf')](_0xba9b('0x10'),_0x518d3b,_0xba9b('0x11'));_0x3e0cdf(_0x4a914e[_0xba9b('0x15')][_0xba9b('0x14')]);}})[_0xba9b('0x16')](function(_0x18510d){logger[_0xba9b('0x13')](_0xba9b('0x10'),_0x518d3b,_0x18510d);_0x47205d(_0x18510d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ffdd885..2c9e333 100644 --- a/server/api/faxTransferReport/index.js +++ b/server/api/faxTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb879=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','delete','/:id'];(function(_0x424b05,_0x240f05){var _0x3b36ac=function(_0x1181ff){while(--_0x1181ff){_0x424b05['push'](_0x424b05['shift']());}};_0x3b36ac(++_0x240f05);}(_0xb879,0x10b));var _0x9b87=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xb879[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x9b87('0x0'));var util=require(_0x9b87('0x1'));var path=require('path');var timeout=require(_0x9b87('0x2'));var express=require(_0x9b87('0x3'));var router=express['Router']();var fs_extra=require(_0x9b87('0x4'));var auth=require(_0x9b87('0x5'));var interaction=require(_0x9b87('0x6'));var config=require(_0x9b87('0x7'));var controller=require('./faxTransferReport.controller');router[_0x9b87('0x8')]('/',auth['isAuthenticated'](),controller[_0x9b87('0x9')]);router[_0x9b87('0x8')]('/describe',auth[_0x9b87('0xa')](),controller[_0x9b87('0xb')]);router[_0x9b87('0x8')]('/:id',auth[_0x9b87('0xa')](),controller[_0x9b87('0xc')]);router[_0x9b87('0xd')]('/',auth['isAuthenticated'](),controller[_0x9b87('0xe')]);router[_0x9b87('0xf')]('/:id',auth[_0x9b87('0xa')](),controller['update']);router[_0x9b87('0x10')](_0x9b87('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x9b87('0x12')]=router; \ No newline at end of file +var _0xb781=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x143dd2,_0x1f673b){var _0x32dc59=function(_0x24cfad){while(--_0x24cfad){_0x143dd2['push'](_0x143dd2['shift']());}};_0x32dc59(++_0x1f673b);}(_0xb781,0x138));var _0x1b78=function(_0x4ded8e,_0x3a70de){_0x4ded8e=_0x4ded8e-0x0;var _0x3df30b=_0xb781[_0x4ded8e];return _0x3df30b;};'use strict';var multer=require(_0x1b78('0x0'));var util=require(_0x1b78('0x1'));var path=require(_0x1b78('0x2'));var timeout=require(_0x1b78('0x3'));var express=require(_0x1b78('0x4'));var router=express[_0x1b78('0x5')]();var fs_extra=require(_0x1b78('0x6'));var auth=require(_0x1b78('0x7'));var interaction=require(_0x1b78('0x8'));var config=require(_0x1b78('0x9'));var controller=require(_0x1b78('0xa'));router[_0x1b78('0xb')]('/',auth[_0x1b78('0xc')](),controller[_0x1b78('0xd')]);router[_0x1b78('0xb')](_0x1b78('0xe'),auth[_0x1b78('0xc')](),controller[_0x1b78('0xf')]);router[_0x1b78('0xb')](_0x1b78('0x10'),auth[_0x1b78('0xc')](),controller[_0x1b78('0x11')]);router[_0x1b78('0x12')]('/',auth[_0x1b78('0xc')](),controller[_0x1b78('0x13')]);router['put'](_0x1b78('0x10'),auth['isAuthenticated'](),controller[_0x1b78('0x14')]);router[_0x1b78('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1b78('0x16')]);module[_0x1b78('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 6bfbf62..54ddfa7 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e2a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x1a9cf6,_0x42433e){var _0x3f70f1=function(_0x488ffd){while(--_0x488ffd){_0x1a9cf6['push'](_0x1a9cf6['shift']());}};_0x3f70f1(++_0x42433e);}(_0x0e2a,0x19c));var _0xa0e2=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x0e2a[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0xa0e2('0x0'));var util=require(_0xa0e2('0x1'));var path=require('path');var timeout=require(_0xa0e2('0x2'));var express=require('express');var router=express[_0xa0e2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa0e2('0x4'));var interaction=require(_0xa0e2('0x5'));var config=require(_0xa0e2('0x6'));var controller=require(_0xa0e2('0x7'));router[_0xa0e2('0x8')]('/',auth['isAuthenticated'](),controller[_0xa0e2('0x9')]);router[_0xa0e2('0x8')](_0xa0e2('0xa'),auth[_0xa0e2('0xb')](),controller[_0xa0e2('0xc')]);router[_0xa0e2('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa0e2('0xd')]);router[_0xa0e2('0x8')](_0xa0e2('0xe'),auth['isAuthenticated'](),controller[_0xa0e2('0xf')]);router[_0xa0e2('0x10')]('/',auth[_0xa0e2('0xb')](),controller[_0xa0e2('0x11')]);router['post']('/:id/configurations',auth[_0xa0e2('0xb')](),controller[_0xa0e2('0x12')]);router[_0xa0e2('0x13')](_0xa0e2('0xa'),auth[_0xa0e2('0xb')](),controller[_0xa0e2('0x14')]);router[_0xa0e2('0x15')]('/:id',auth[_0xa0e2('0xb')](),controller[_0xa0e2('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3e6d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x5314d9,_0x3a48cc){var _0x49bffd=function(_0x1d50d4){while(--_0x1d50d4){_0x5314d9['push'](_0x5314d9['shift']());}};_0x49bffd(++_0x3a48cc);}(_0x3e6d,0x1b5));var _0xd3e6=function(_0x553f37,_0x1a63a0){_0x553f37=_0x553f37-0x0;var _0x3fc8d2=_0x3e6d[_0x553f37];return _0x3fc8d2;};'use strict';var multer=require(_0xd3e6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd3e6('0x1'));var express=require(_0xd3e6('0x2'));var router=express[_0xd3e6('0x3')]();var fs_extra=require(_0xd3e6('0x4'));var auth=require(_0xd3e6('0x5'));var interaction=require(_0xd3e6('0x6'));var config=require(_0xd3e6('0x7'));var controller=require('./intDeskAccount.controller');router[_0xd3e6('0x8')]('/',auth[_0xd3e6('0x9')](),controller['index']);router[_0xd3e6('0x8')](_0xd3e6('0xa'),auth[_0xd3e6('0x9')](),controller[_0xd3e6('0xb')]);router['get']('/:id/configurations',auth[_0xd3e6('0x9')](),controller[_0xd3e6('0xc')]);router[_0xd3e6('0x8')](_0xd3e6('0xd'),auth[_0xd3e6('0x9')](),controller['getFields']);router[_0xd3e6('0xe')]('/',auth[_0xd3e6('0x9')](),controller['create']);router[_0xd3e6('0xe')](_0xd3e6('0xf'),auth[_0xd3e6('0x9')](),controller[_0xd3e6('0x10')]);router[_0xd3e6('0x11')](_0xd3e6('0xa'),auth[_0xd3e6('0x9')](),controller['update']);router[_0xd3e6('0x12')](_0xd3e6('0xa'),auth[_0xd3e6('0x9')](),controller[_0xd3e6('0x13')]);module[_0xd3e6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 517ee2c..27cf8f2 100644 --- a/server/api/intDeskAccount/intDeskAccount.attributes.js +++ b/server/api/intDeskAccount/intDeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39fa=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x3f72e2,_0xc25e7d){var _0x2980b8=function(_0x30121f){while(--_0x30121f){_0x3f72e2['push'](_0x3f72e2['shift']());}};_0x2980b8(++_0xc25e7d);}(_0x39fa,0x71));var _0xa39f=function(_0xa983d6,_0x550ca5){_0xa983d6=_0xa983d6-0x0;var _0x31a0e6=_0x39fa[_0xa983d6];return _0x31a0e6;};'use strict';var Sequelize=require(_0xa39f('0x0'));module[_0xa39f('0x1')]={'name':{'type':Sequelize[_0xa39f('0x2')]},'description':{'type':Sequelize[_0xa39f('0x2')]},'username':{'type':Sequelize[_0xa39f('0x2')]},'remoteUri':{'type':Sequelize[_0xa39f('0x2')]},'authType':{'type':Sequelize[_0xa39f('0x3')](_0xa39f('0x4')),'defaultValue':_0xa39f('0x4')},'password':{'type':Sequelize[_0xa39f('0x2')]},'consumerKey':{'type':Sequelize[_0xa39f('0x2')]},'consumerSecret':{'type':Sequelize[_0xa39f('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa39f('0x2')]},'serverUrl':{'type':Sequelize[_0xa39f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa39f('0x3')](_0xa39f('0x5'),_0xa39f('0x6')),'defaultValue':_0xa39f('0x5')}}; \ No newline at end of file +var _0xee07=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0xee07,0x102));var _0x7ee0=function(_0x4bb2af,_0x47935f){_0x4bb2af=_0x4bb2af-0x0;var _0x67b257=_0xee07[_0x4bb2af];return _0x67b257;};'use strict';var Sequelize=require(_0x7ee0('0x0'));module[_0x7ee0('0x1')]={'name':{'type':Sequelize[_0x7ee0('0x2')]},'description':{'type':Sequelize[_0x7ee0('0x2')]},'username':{'type':Sequelize[_0x7ee0('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x7ee0('0x3')](_0x7ee0('0x4')),'defaultValue':_0x7ee0('0x4')},'password':{'type':Sequelize[_0x7ee0('0x2')]},'consumerKey':{'type':Sequelize[_0x7ee0('0x2')]},'consumerSecret':{'type':Sequelize[_0x7ee0('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x7ee0('0x2')]},'serverUrl':{'type':Sequelize[_0x7ee0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7ee0('0x3')](_0x7ee0('0x5'),_0x7ee0('0x6')),'defaultValue':_0x7ee0('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c5c1df7..e4f68ff 100644 --- a/server/api/intDeskAccount/intDeskAccount.controller.js +++ b/server/api/intDeskAccount/intDeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07a3=['toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','DeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskField','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x07a3,0x1e4));var _0x307a=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x07a3[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x307a('0x0'));var rimraf=require(_0x307a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x307a('0x2'));var rp=require(_0x307a('0x3'));var moment=require(_0x307a('0x4'));var BPromise=require(_0x307a('0x5'));var Mustache=require(_0x307a('0x6'));var util=require(_0x307a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x307a('0x8'));var ejs=require(_0x307a('0x9'));var fs=require('fs');var fs_extra=require(_0x307a('0xa'));var _=require(_0x307a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x307a('0xc'));var deskjs=require(_0x307a('0xd'));var toCsv=require(_0x307a('0x8'));var querystring=require(_0x307a('0xe'));var Papa=require(_0x307a('0xf'));var Redis=require(_0x307a('0x10'));var authService=require(_0x307a('0x11'));var qs=require(_0x307a('0x12'));var as=require(_0x307a('0x13'));var hardwareService=require(_0x307a('0x14'));var logger=require(_0x307a('0x15'))(_0x307a('0x16'));var utils=require(_0x307a('0x17'));var config=require(_0x307a('0x18'));var licenseUtil=require(_0x307a('0x19'));var db=require(_0x307a('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x393dac,_0x52d8eb){_0x52d8eb=_0x52d8eb||0xcc;return function(_0x73a354){if(_0x73a354){return _0x393dac['sendStatus'](_0x52d8eb);}return _0x393dac[_0x307a('0x1b')](_0x52d8eb)[_0x307a('0x1c')]();};}function respondWithResult(_0x1bacb4,_0x4c3d8a){_0x4c3d8a=_0x4c3d8a||0xc8;return function(_0x44fbf4){if(_0x44fbf4){return _0x1bacb4[_0x307a('0x1b')](_0x4c3d8a)[_0x307a('0x1d')](_0x44fbf4);}};}function respondWithFilteredResult(_0x323fd3,_0x3b7f70){return function(_0x4394eb){if(_0x4394eb){var _0x5f3848=typeof _0x3b7f70[_0x307a('0x1e')]===_0x307a('0x1f')&&typeof _0x3b7f70[_0x307a('0x20')]===_0x307a('0x1f');var _0x5da77c=_0x4394eb[_0x307a('0x21')];var _0x4abcf0=_0x5f3848?0x0:_0x3b7f70[_0x307a('0x1e')];var _0x141076=_0x5f3848?_0x4394eb[_0x307a('0x21')]:_0x3b7f70['offset']+_0x3b7f70[_0x307a('0x20')];var _0x271a13;if(_0x141076>=_0x5da77c){_0x141076=_0x5da77c;_0x271a13=0xc8;}else{_0x271a13=0xce;}_0x323fd3[_0x307a('0x1b')](_0x271a13);return _0x323fd3[_0x307a('0x22')](_0x307a('0x23'),_0x4abcf0+'-'+_0x141076+'/'+_0x5da77c)['json'](_0x4394eb);}return null;};}function patchUpdates(_0x4eae4d){return function(_0x574deb){try{jsonpatch[_0x307a('0x24')](_0x574deb,_0x4eae4d,!![]);}catch(_0x19f9e2){return BPromise[_0x307a('0x25')](_0x19f9e2);}return _0x574deb[_0x307a('0x26')]();};}function saveUpdates(_0x5e03ab,_0x1d53e6){return function(_0xfe8c5f){if(_0xfe8c5f){return _0xfe8c5f[_0x307a('0x27')](_0x5e03ab)[_0x307a('0x28')](function(_0x58a531){return _0x58a531;});}return null;};}function removeEntity(_0x440190,_0x28fa2e){return function(_0x86380f){if(_0x86380f){return _0x86380f[_0x307a('0x29')]()[_0x307a('0x28')](function(){_0x440190[_0x307a('0x1b')](0xcc)[_0x307a('0x1c')]();});}};}function handleEntityNotFound(_0x12750c,_0x26359a){return function(_0x28ae60){if(!_0x28ae60){_0x12750c['sendStatus'](0x194);}return _0x28ae60;};}function handleError(_0x1be129,_0x1d01e3){_0x1d01e3=_0x1d01e3||0x1f4;return function(_0xba5407){logger[_0x307a('0x2a')](_0xba5407[_0x307a('0x2b')]);if(_0xba5407[_0x307a('0x2c')]){delete _0xba5407[_0x307a('0x2c')];}_0x1be129[_0x307a('0x1b')](_0x1d01e3)[_0x307a('0x2d')](_0xba5407);};}exports['index']=function(_0x1183a6,_0x5a5ddc){var _0x574afb={},_0x197a9a={},_0x1d76fd={'count':0x0,'rows':[]};var _0x43fa24=_[_0x307a('0x2e')](db[_0x307a('0x2f')][_0x307a('0x30')],function(_0x20c845){return{'name':_0x20c845[_0x307a('0x31')],'type':_0x20c845[_0x307a('0x32')][_0x307a('0x33')]};});_0x197a9a['model']=_[_0x307a('0x2e')](_0x43fa24,_0x307a('0x2c'));_0x197a9a[_0x307a('0x34')]=_[_0x307a('0x35')](_0x1183a6[_0x307a('0x34')]);_0x197a9a[_0x307a('0x36')]=_[_0x307a('0x37')](_0x197a9a[_0x307a('0x38')],_0x197a9a[_0x307a('0x34')]);_0x574afb['attributes']=_[_0x307a('0x37')](_0x197a9a[_0x307a('0x38')],qs[_0x307a('0x39')](_0x1183a6['query'][_0x307a('0x39')]));_0x574afb[_0x307a('0x3a')]=_0x574afb[_0x307a('0x3a')][_0x307a('0x3b')]?_0x574afb[_0x307a('0x3a')]:_0x197a9a['model'];if(!_0x1183a6['query'][_0x307a('0x3c')](_0x307a('0x3d'))){_0x574afb[_0x307a('0x20')]=qs[_0x307a('0x20')](_0x1183a6[_0x307a('0x34')][_0x307a('0x20')]);_0x574afb['offset']=qs[_0x307a('0x1e')](_0x1183a6[_0x307a('0x34')]['offset']);}_0x574afb[_0x307a('0x3e')]=qs['sort'](_0x1183a6[_0x307a('0x34')][_0x307a('0x3f')]);_0x574afb['where']=qs[_0x307a('0x36')](_[_0x307a('0x40')](_0x1183a6[_0x307a('0x34')],_0x197a9a[_0x307a('0x36')]),_0x43fa24);if(_0x1183a6[_0x307a('0x34')][_0x307a('0x41')]){_0x574afb[_0x307a('0x42')]=_['merge'](_0x574afb[_0x307a('0x42')],{'$or':_['map'](_0x43fa24,function(_0x5c83c4){if(_0x5c83c4['type']!=='VIRTUAL'){var _0x120cdb={};_0x120cdb[_0x5c83c4[_0x307a('0x2c')]]={'$like':'%'+_0x1183a6['query'][_0x307a('0x41')]+'%'};return _0x120cdb;}})});}_0x574afb=_[_0x307a('0x43')]({},_0x574afb,_0x1183a6[_0x307a('0x44')]);var _0x2471eb={'where':_0x574afb['where']};return db['DeskAccount'][_0x307a('0x21')](_0x2471eb)[_0x307a('0x28')](function(_0x508602){_0x1d76fd[_0x307a('0x21')]=_0x508602;if(_0x1183a6[_0x307a('0x34')][_0x307a('0x45')]){_0x574afb[_0x307a('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0x307a('0x47')](_0x574afb);})['then'](function(_0xf23fd8){_0x1d76fd[_0x307a('0x48')]=_0xf23fd8;return _0x1d76fd;})[_0x307a('0x28')](respondWithFilteredResult(_0x5a5ddc,_0x574afb))[_0x307a('0x49')](handleError(_0x5a5ddc,null));};exports[_0x307a('0x4a')]=function(_0x3092ce,_0x809990){var _0x4be7dc={'raw':![],'where':{'id':_0x3092ce['params']['id']}},_0x571d9e={};_0x571d9e[_0x307a('0x38')]=_[_0x307a('0x35')](db['DeskAccount']['rawAttributes']);_0x571d9e['query']=_[_0x307a('0x35')](_0x3092ce['query']);_0x571d9e['filters']=_[_0x307a('0x37')](_0x571d9e[_0x307a('0x38')],_0x571d9e['query']);_0x4be7dc[_0x307a('0x3a')]=_[_0x307a('0x37')](_0x571d9e[_0x307a('0x38')],qs['fields'](_0x3092ce[_0x307a('0x34')]['fields']));_0x4be7dc[_0x307a('0x3a')]=_0x4be7dc['attributes'][_0x307a('0x3b')]?_0x4be7dc[_0x307a('0x3a')]:_0x571d9e['model'];if(_0x3092ce['query'][_0x307a('0x45')]){_0x4be7dc[_0x307a('0x46')]=[{'all':!![]}];}_0x4be7dc=_['merge']({},_0x4be7dc,_0x3092ce[_0x307a('0x44')]);return db[_0x307a('0x2f')][_0x307a('0x4b')](_0x4be7dc)[_0x307a('0x28')](handleEntityNotFound(_0x809990,null))[_0x307a('0x28')](respondWithResult(_0x809990,null))[_0x307a('0x49')](handleError(_0x809990,null));};exports[_0x307a('0x4c')]=function(_0x13913b,_0x1c2496){return db[_0x307a('0x2f')][_0x307a('0x4c')](_0x13913b[_0x307a('0x4d')],{})[_0x307a('0x28')](respondWithResult(_0x1c2496,0xc9))[_0x307a('0x49')](handleError(_0x1c2496,null));};exports[_0x307a('0x27')]=function(_0x3151c0,_0xe811a0){if(_0x3151c0[_0x307a('0x4d')]['id']){delete _0x3151c0['body']['id'];}return db[_0x307a('0x2f')]['find']({'where':{'id':_0x3151c0['params']['id']}})[_0x307a('0x28')](handleEntityNotFound(_0xe811a0,null))[_0x307a('0x28')](saveUpdates(_0x3151c0[_0x307a('0x4d')],null))['then'](respondWithResult(_0xe811a0,null))[_0x307a('0x49')](handleError(_0xe811a0,null));};exports[_0x307a('0x29')]=function(_0x54604c,_0x42de28){return db[_0x307a('0x2f')][_0x307a('0x4b')]({'where':{'id':_0x54604c[_0x307a('0x4e')]['id']}})[_0x307a('0x28')](handleEntityNotFound(_0x42de28,null))[_0x307a('0x28')](removeEntity(_0x42de28,null))[_0x307a('0x49')](handleError(_0x42de28,null));};exports[_0x307a('0x4f')]=function(_0x24537a,_0x2844be,_0x3c96d0){var _0x1edf6f={};var _0x132d41={};var _0x1c037a;var _0xba665e;return db['DeskAccount']['findOne']({'where':{'id':_0x24537a[_0x307a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2844be,null))['then'](function(_0x5950a5){if(_0x5950a5){_0x1c037a=_0x5950a5;_0x132d41[_0x307a('0x38')]=_[_0x307a('0x35')](db[_0x307a('0x50')]['rawAttributes']);_0x132d41[_0x307a('0x34')]=_[_0x307a('0x35')](_0x24537a['query']);_0x132d41[_0x307a('0x36')]=_[_0x307a('0x37')](_0x132d41[_0x307a('0x38')],_0x132d41[_0x307a('0x34')]);_0x1edf6f[_0x307a('0x3a')]=_['intersection'](_0x132d41['model'],qs[_0x307a('0x39')](_0x24537a[_0x307a('0x34')][_0x307a('0x39')]));_0x1edf6f[_0x307a('0x3a')]=_0x1edf6f[_0x307a('0x3a')][_0x307a('0x3b')]?_0x1edf6f[_0x307a('0x3a')]:_0x132d41[_0x307a('0x38')];_0x1edf6f[_0x307a('0x3e')]=qs['sort'](_0x24537a[_0x307a('0x34')][_0x307a('0x3f')]);_0x1edf6f['where']=qs[_0x307a('0x36')](_[_0x307a('0x40')](_0x24537a[_0x307a('0x34')],_0x132d41[_0x307a('0x36')]));if(_0x24537a['query'][_0x307a('0x41')]){_0x1edf6f['where']=_[_0x307a('0x43')](_0x1edf6f[_0x307a('0x42')],{'$or':_[_0x307a('0x2e')](_0x1edf6f[_0x307a('0x3a')],function(_0x399900){var _0x2aa9dc={};_0x2aa9dc[_0x399900]={'$like':'%'+_0x24537a[_0x307a('0x34')][_0x307a('0x41')]+'%'};return _0x2aa9dc;})});}_0x1edf6f=_[_0x307a('0x43')]({},_0x1edf6f,_0x24537a[_0x307a('0x44')]);return _0x1c037a[_0x307a('0x4f')](_0x1edf6f);}})[_0x307a('0x28')](function(_0x5b67c6){if(_0x5b67c6){_0xba665e=_0x5b67c6[_0x307a('0x3b')];if(!_0x24537a[_0x307a('0x34')]['hasOwnProperty']('nolimit')){_0x1edf6f[_0x307a('0x20')]=qs[_0x307a('0x20')](_0x24537a[_0x307a('0x34')][_0x307a('0x20')]);_0x1edf6f[_0x307a('0x1e')]=qs[_0x307a('0x1e')](_0x24537a[_0x307a('0x34')][_0x307a('0x1e')]);}return _0x1c037a[_0x307a('0x4f')](_0x1edf6f);}})[_0x307a('0x28')](function(_0x2bef09){if(_0x2bef09){return _0x2bef09?{'count':_0xba665e,'rows':_0x2bef09}:null;}})[_0x307a('0x28')](respondWithResult(_0x2844be,null))['catch'](handleError(_0x2844be,null));};exports[_0x307a('0x51')]=function(_0x4af9ce,_0x30105a,_0x13fd13){if(_0x4af9ce[_0x307a('0x4d')]['id']){delete _0x4af9ce[_0x307a('0x4d')]['id'];}return db['DeskAccount'][_0x307a('0x52')]({'where':{'id':_0x4af9ce[_0x307a('0x4e')]['id']}})[_0x307a('0x28')](handleEntityNotFound(_0x30105a,null))['then'](function(_0x40616c){if(_0x40616c){_0x4af9ce[_0x307a('0x4d')][_0x307a('0x53')]=_0x40616c['id'];_0x4af9ce[_0x307a('0x4d')][_0x307a('0x54')]=integrations[_0x307a('0x55')](_0x4af9ce[_0x307a('0x4d')]['channel'],_0x4af9ce[_0x307a('0x4d')][_0x307a('0x32')]);_0x4af9ce[_0x307a('0x4d')][_0x307a('0x56')]=integrations[_0x307a('0x57')](_0x4af9ce['body']['channel'],_0x4af9ce[_0x307a('0x4d')]['type']);return db[_0x307a('0x50')][_0x307a('0x4c')](_0x4af9ce[_0x307a('0x4d')],{'include':[{'model':db[_0x307a('0x58')],'as':_0x307a('0x54')},{'model':db[_0x307a('0x58')],'as':_0x307a('0x56')}]});}return null;})['then'](respondWithResult(_0x30105a,null))['catch'](handleError(_0x30105a,null));};exports['getFields']=function(_0x41a9e5,_0x170816,_0x50770d){var _0x5dcd08=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x509ced='';return db[_0x307a('0x2f')][_0x307a('0x52')]({'where':{'id':_0x41a9e5[_0x307a('0x4e')]['id']},'attributes':['id',_0x307a('0x59'),_0x307a('0x5a'),'username',_0x307a('0x5b'),_0x307a('0x5c'),_0x307a('0x5d'),_0x307a('0x5e'),_0x307a('0x5f')]})[_0x307a('0x28')](handleEntityNotFound(_0x170816,null))[_0x307a('0x28')](function(_0x1d09c6){if(_0x1d09c6){_0x509ced=_0x1d09c6['remoteUri'];var _0x5292d2=_0x509ced[_0x307a('0x60')](-0x1);if(_0x5292d2==='/'){_0x509ced=_0x509ced[_0x307a('0x61')](0x0,_0x509ced['lastIndexOf'](_0x5292d2));}var _0x5b2976={'method':'GET','uri':util[_0x307a('0x62')]('%s/custom_fields',_0x509ced),'headers':{'Content-Type':'application/json','Accept':_0x307a('0x63')},'json':!![]};if(_0x1d09c6[_0x307a('0x5a')]===_0x307a('0x64')){_0x5b2976[_0x307a('0x65')][_0x307a('0x66')]=util[_0x307a('0x62')](_0x307a('0x67'),new Buffer(util[_0x307a('0x62')](_0x307a('0x68'),_0x1d09c6[_0x307a('0x69')],_0x1d09c6[_0x307a('0x5b')]))[_0x307a('0x6a')](_0x307a('0x6b')));}return rp(_0x5b2976)[_0x307a('0x28')](function(_0x4a6075){return _0x5dcd08[_0x307a('0x6c')](_[_0x307a('0x2e')](_0x4a6075[_0x307a('0x6d')][_0x307a('0x6e')],function(_0x4de06a){return{'id':_0x4de06a[_0x307a('0x2c')],'name':_0x4de06a[_0x307a('0x2c')],'type':_0x4de06a[_0x307a('0x32')],'active':_0x4de06a['active'],'label':_0x4de06a[_0x307a('0x6f')],'custom':!![]};}));});}})[_0x307a('0x28')](function(_0x352eb2){return{'count':_0x352eb2[_0x307a('0x3b')],'rows':_0x352eb2};})[_0x307a('0x28')](respondWithResult(_0x170816,null))[_0x307a('0x49')](function(_0xb05021){var _0x18cac7=_0x41a9e5['query'][_0x307a('0x70')]?0x1f4:_0xb05021[_0x307a('0x71')]||0x1f4;logger[_0x307a('0x2a')](_0x307a('0x72'),_0x307a('0x73'),_0x18cac7,JSON[_0x307a('0x74')](_0xb05021));delete _0xb05021['name'];if(_0x18cac7===0x191){_0x18cac7=0x190;}_0x170816[_0x307a('0x1b')](_0x18cac7)[_0x307a('0x2d')](_0x41a9e5[_0x307a('0x34')][_0x307a('0x70')]?{'message':_0x307a('0x75'),'statusCode':_0xb05021['statusCode']}:_0xb05021);});}; \ No newline at end of file +var _0xf3a2=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','error','name','index','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','getConfigurations','findOne','DeskConfiguration','order','addConfiguration','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','%s:%s','toString','base64','concat','_embedded','active','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x90365b,_0x4c75dd){var _0x4f1880=function(_0x48c31c){while(--_0x48c31c){_0x90365b['push'](_0x90365b['shift']());}};_0x4f1880(++_0x4c75dd);}(_0xf3a2,0x142));var _0x2f3a=function(_0x5169e3,_0x52c26f){_0x5169e3=_0x5169e3-0x0;var _0x5cd760=_0xf3a2[_0x5169e3];return _0x5cd760;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f3a('0x0'));var zipdir=require(_0x2f3a('0x1'));var jsonpatch=require(_0x2f3a('0x2'));var rp=require(_0x2f3a('0x3'));var moment=require(_0x2f3a('0x4'));var BPromise=require(_0x2f3a('0x5'));var Mustache=require(_0x2f3a('0x6'));var util=require(_0x2f3a('0x7'));var path=require(_0x2f3a('0x8'));var sox=require(_0x2f3a('0x9'));var csv=require(_0x2f3a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f3a('0xb'));var _=require(_0x2f3a('0xc'));var squel=require(_0x2f3a('0xd'));var crypto=require(_0x2f3a('0xe'));var jsforce=require(_0x2f3a('0xf'));var deskjs=require(_0x2f3a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f3a('0x11'));var Redis=require('ioredis');var authService=require(_0x2f3a('0x12'));var qs=require(_0x2f3a('0x13'));var as=require(_0x2f3a('0x14'));var hardwareService=require(_0x2f3a('0x15'));var logger=require(_0x2f3a('0x16'))(_0x2f3a('0x17'));var utils=require(_0x2f3a('0x18'));var config=require(_0x2f3a('0x19'));var licenseUtil=require(_0x2f3a('0x1a'));var db=require(_0x2f3a('0x1b'))['db'];var integrations=require(_0x2f3a('0x1c'));function respondWithStatusCode(_0x27e7c4,_0x1ca7d){_0x1ca7d=_0x1ca7d||0xcc;return function(_0x300b9b){if(_0x300b9b){return _0x27e7c4[_0x2f3a('0x1d')](_0x1ca7d);}return _0x27e7c4[_0x2f3a('0x1e')](_0x1ca7d)[_0x2f3a('0x1f')]();};}function respondWithResult(_0x3a2c6e,_0xe2bc5c){_0xe2bc5c=_0xe2bc5c||0xc8;return function(_0x166b11){if(_0x166b11){return _0x3a2c6e['status'](_0xe2bc5c)[_0x2f3a('0x20')](_0x166b11);}};}function respondWithFilteredResult(_0xf10bd6,_0x129aba){return function(_0x33d6fd){if(_0x33d6fd){var _0x1ba8fd=typeof _0x129aba[_0x2f3a('0x21')]===_0x2f3a('0x22')&&typeof _0x129aba[_0x2f3a('0x23')]===_0x2f3a('0x22');var _0x317b79=_0x33d6fd[_0x2f3a('0x24')];var _0x12f2fa=_0x1ba8fd?0x0:_0x129aba[_0x2f3a('0x21')];var _0x26b0c2=_0x1ba8fd?_0x33d6fd[_0x2f3a('0x24')]:_0x129aba[_0x2f3a('0x21')]+_0x129aba['limit'];var _0x30e387;if(_0x26b0c2>=_0x317b79){_0x26b0c2=_0x317b79;_0x30e387=0xc8;}else{_0x30e387=0xce;}_0xf10bd6['status'](_0x30e387);return _0xf10bd6[_0x2f3a('0x25')](_0x2f3a('0x26'),_0x12f2fa+'-'+_0x26b0c2+'/'+_0x317b79)[_0x2f3a('0x20')](_0x33d6fd);}return null;};}function patchUpdates(_0x219b2a){return function(_0x19e44a){try{jsonpatch[_0x2f3a('0x27')](_0x19e44a,_0x219b2a,!![]);}catch(_0x2f0986){return BPromise[_0x2f3a('0x28')](_0x2f0986);}return _0x19e44a['save']();};}function saveUpdates(_0x39133a,_0x15c64f){return function(_0x8f7f41){if(_0x8f7f41){return _0x8f7f41['update'](_0x39133a)['then'](function(_0xc77ff9){return _0xc77ff9;});}return null;};}function removeEntity(_0x39de7f,_0x31d14e){return function(_0x28903c){if(_0x28903c){return _0x28903c[_0x2f3a('0x29')]()[_0x2f3a('0x2a')](function(){_0x39de7f[_0x2f3a('0x1e')](0xcc)[_0x2f3a('0x1f')]();});}};}function handleEntityNotFound(_0x6b040b,_0xe41575){return function(_0x3998e3){if(!_0x3998e3){_0x6b040b[_0x2f3a('0x1d')](0x194);}return _0x3998e3;};}function handleError(_0x2771bd,_0x48c343){_0x48c343=_0x48c343||0x1f4;return function(_0x5270d6){logger[_0x2f3a('0x2b')](_0x5270d6['stack']);if(_0x5270d6['name']){delete _0x5270d6[_0x2f3a('0x2c')];}_0x2771bd[_0x2f3a('0x1e')](_0x48c343)['send'](_0x5270d6);};}exports[_0x2f3a('0x2d')]=function(_0x386221,_0x25e3a1){var _0x1874cd={},_0x37e99e={},_0x53bafc={'count':0x0,'rows':[]};var _0x56ccbe=_['map'](db['DeskAccount'][_0x2f3a('0x2e')],function(_0x2e5775){return{'name':_0x2e5775['fieldName'],'type':_0x2e5775['type'][_0x2f3a('0x2f')]};});_0x37e99e[_0x2f3a('0x30')]=_[_0x2f3a('0x31')](_0x56ccbe,_0x2f3a('0x2c'));_0x37e99e[_0x2f3a('0x32')]=_[_0x2f3a('0x33')](_0x386221[_0x2f3a('0x32')]);_0x37e99e[_0x2f3a('0x34')]=_['intersection'](_0x37e99e['model'],_0x37e99e['query']);_0x1874cd['attributes']=_[_0x2f3a('0x35')](_0x37e99e['model'],qs[_0x2f3a('0x36')](_0x386221[_0x2f3a('0x32')]['fields']));_0x1874cd['attributes']=_0x1874cd['attributes']['length']?_0x1874cd[_0x2f3a('0x37')]:_0x37e99e[_0x2f3a('0x30')];if(!_0x386221['query'][_0x2f3a('0x38')]('nolimit')){_0x1874cd[_0x2f3a('0x23')]=qs[_0x2f3a('0x23')](_0x386221[_0x2f3a('0x32')][_0x2f3a('0x23')]);_0x1874cd[_0x2f3a('0x21')]=qs[_0x2f3a('0x21')](_0x386221[_0x2f3a('0x32')][_0x2f3a('0x21')]);}_0x1874cd['order']=qs[_0x2f3a('0x39')](_0x386221[_0x2f3a('0x32')][_0x2f3a('0x39')]);_0x1874cd[_0x2f3a('0x3a')]=qs[_0x2f3a('0x34')](_[_0x2f3a('0x3b')](_0x386221['query'],_0x37e99e['filters']),_0x56ccbe);if(_0x386221[_0x2f3a('0x32')][_0x2f3a('0x3c')]){_0x1874cd[_0x2f3a('0x3a')]=_[_0x2f3a('0x3d')](_0x1874cd[_0x2f3a('0x3a')],{'$or':_['map'](_0x56ccbe,function(_0x569d70){if(_0x569d70['type']!==_0x2f3a('0x3e')){var _0x465f56={};_0x465f56[_0x569d70[_0x2f3a('0x2c')]]={'$like':'%'+_0x386221[_0x2f3a('0x32')][_0x2f3a('0x3c')]+'%'};return _0x465f56;}})});}_0x1874cd=_['merge']({},_0x1874cd,_0x386221[_0x2f3a('0x3f')]);var _0x36510b={'where':_0x1874cd[_0x2f3a('0x3a')]};return db[_0x2f3a('0x40')][_0x2f3a('0x24')](_0x36510b)[_0x2f3a('0x2a')](function(_0x25ac9b){_0x53bafc[_0x2f3a('0x24')]=_0x25ac9b;if(_0x386221[_0x2f3a('0x32')][_0x2f3a('0x41')]){_0x1874cd[_0x2f3a('0x42')]=[{'all':!![]}];}return db[_0x2f3a('0x40')][_0x2f3a('0x43')](_0x1874cd);})['then'](function(_0x392435){_0x53bafc[_0x2f3a('0x44')]=_0x392435;return _0x53bafc;})[_0x2f3a('0x2a')](respondWithFilteredResult(_0x25e3a1,_0x1874cd))[_0x2f3a('0x45')](handleError(_0x25e3a1,null));};exports[_0x2f3a('0x46')]=function(_0x1fbb7f,_0x3ce5b8){var _0x27c731={'raw':![],'where':{'id':_0x1fbb7f['params']['id']}},_0x13371b={};_0x13371b[_0x2f3a('0x30')]=_[_0x2f3a('0x33')](db[_0x2f3a('0x40')][_0x2f3a('0x2e')]);_0x13371b[_0x2f3a('0x32')]=_[_0x2f3a('0x33')](_0x1fbb7f['query']);_0x13371b[_0x2f3a('0x34')]=_['intersection'](_0x13371b[_0x2f3a('0x30')],_0x13371b[_0x2f3a('0x32')]);_0x27c731[_0x2f3a('0x37')]=_[_0x2f3a('0x35')](_0x13371b[_0x2f3a('0x30')],qs[_0x2f3a('0x36')](_0x1fbb7f['query'][_0x2f3a('0x36')]));_0x27c731[_0x2f3a('0x37')]=_0x27c731[_0x2f3a('0x37')][_0x2f3a('0x47')]?_0x27c731[_0x2f3a('0x37')]:_0x13371b[_0x2f3a('0x30')];if(_0x1fbb7f[_0x2f3a('0x32')][_0x2f3a('0x41')]){_0x27c731['include']=[{'all':!![]}];}_0x27c731=_[_0x2f3a('0x3d')]({},_0x27c731,_0x1fbb7f['options']);return db[_0x2f3a('0x40')][_0x2f3a('0x48')](_0x27c731)[_0x2f3a('0x2a')](handleEntityNotFound(_0x3ce5b8,null))[_0x2f3a('0x2a')](respondWithResult(_0x3ce5b8,null))[_0x2f3a('0x45')](handleError(_0x3ce5b8,null));};exports[_0x2f3a('0x49')]=function(_0x116660,_0x5b94dd){return db['DeskAccount']['create'](_0x116660[_0x2f3a('0x4a')],{})['then'](respondWithResult(_0x5b94dd,0xc9))['catch'](handleError(_0x5b94dd,null));};exports[_0x2f3a('0x4b')]=function(_0x22321b,_0x483f28){if(_0x22321b[_0x2f3a('0x4a')]['id']){delete _0x22321b[_0x2f3a('0x4a')]['id'];}return db[_0x2f3a('0x40')][_0x2f3a('0x48')]({'where':{'id':_0x22321b[_0x2f3a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x483f28,null))[_0x2f3a('0x2a')](saveUpdates(_0x22321b[_0x2f3a('0x4a')],null))['then'](respondWithResult(_0x483f28,null))[_0x2f3a('0x45')](handleError(_0x483f28,null));};exports[_0x2f3a('0x29')]=function(_0x28a7f9,_0xac1124){return db[_0x2f3a('0x40')][_0x2f3a('0x48')]({'where':{'id':_0x28a7f9['params']['id']}})[_0x2f3a('0x2a')](handleEntityNotFound(_0xac1124,null))[_0x2f3a('0x2a')](removeEntity(_0xac1124,null))[_0x2f3a('0x45')](handleError(_0xac1124,null));};exports[_0x2f3a('0x4d')]=function(_0x2277e7,_0x27e43c,_0x47358c){var _0x2e2d7c={};var _0x181222={};var _0x12877a;var _0x47ea9c;return db[_0x2f3a('0x40')][_0x2f3a('0x4e')]({'where':{'id':_0x2277e7[_0x2f3a('0x4c')]['id']}})[_0x2f3a('0x2a')](handleEntityNotFound(_0x27e43c,null))['then'](function(_0x57a668){if(_0x57a668){_0x12877a=_0x57a668;_0x181222['model']=_[_0x2f3a('0x33')](db[_0x2f3a('0x4f')][_0x2f3a('0x2e')]);_0x181222[_0x2f3a('0x32')]=_['keys'](_0x2277e7[_0x2f3a('0x32')]);_0x181222[_0x2f3a('0x34')]=_[_0x2f3a('0x35')](_0x181222[_0x2f3a('0x30')],_0x181222[_0x2f3a('0x32')]);_0x2e2d7c[_0x2f3a('0x37')]=_[_0x2f3a('0x35')](_0x181222[_0x2f3a('0x30')],qs[_0x2f3a('0x36')](_0x2277e7['query'][_0x2f3a('0x36')]));_0x2e2d7c[_0x2f3a('0x37')]=_0x2e2d7c[_0x2f3a('0x37')][_0x2f3a('0x47')]?_0x2e2d7c[_0x2f3a('0x37')]:_0x181222['model'];_0x2e2d7c[_0x2f3a('0x50')]=qs[_0x2f3a('0x39')](_0x2277e7[_0x2f3a('0x32')][_0x2f3a('0x39')]);_0x2e2d7c['where']=qs[_0x2f3a('0x34')](_[_0x2f3a('0x3b')](_0x2277e7[_0x2f3a('0x32')],_0x181222[_0x2f3a('0x34')]));if(_0x2277e7[_0x2f3a('0x32')][_0x2f3a('0x3c')]){_0x2e2d7c['where']=_[_0x2f3a('0x3d')](_0x2e2d7c[_0x2f3a('0x3a')],{'$or':_['map'](_0x2e2d7c['attributes'],function(_0xddade9){var _0xad9d1c={};_0xad9d1c[_0xddade9]={'$like':'%'+_0x2277e7[_0x2f3a('0x32')]['filter']+'%'};return _0xad9d1c;})});}_0x2e2d7c=_['merge']({},_0x2e2d7c,_0x2277e7['options']);return _0x12877a[_0x2f3a('0x4d')](_0x2e2d7c);}})[_0x2f3a('0x2a')](function(_0x27bd25){if(_0x27bd25){_0x47ea9c=_0x27bd25['length'];if(!_0x2277e7[_0x2f3a('0x32')][_0x2f3a('0x38')]('nolimit')){_0x2e2d7c['limit']=qs[_0x2f3a('0x23')](_0x2277e7['query']['limit']);_0x2e2d7c[_0x2f3a('0x21')]=qs['offset'](_0x2277e7[_0x2f3a('0x32')][_0x2f3a('0x21')]);}return _0x12877a['getConfigurations'](_0x2e2d7c);}})[_0x2f3a('0x2a')](function(_0x1f97b7){if(_0x1f97b7){return _0x1f97b7?{'count':_0x47ea9c,'rows':_0x1f97b7}:null;}})[_0x2f3a('0x2a')](respondWithResult(_0x27e43c,null))['catch'](handleError(_0x27e43c,null));};exports[_0x2f3a('0x51')]=function(_0x38a24b,_0x196c1b,_0x1b5c9d){if(_0x38a24b[_0x2f3a('0x4a')]['id']){delete _0x38a24b[_0x2f3a('0x4a')]['id'];}return db[_0x2f3a('0x40')][_0x2f3a('0x4e')]({'where':{'id':_0x38a24b[_0x2f3a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x196c1b,null))[_0x2f3a('0x2a')](function(_0xcf20f4){if(_0xcf20f4){_0x38a24b[_0x2f3a('0x4a')]['AccountId']=_0xcf20f4['id'];_0x38a24b[_0x2f3a('0x4a')][_0x2f3a('0x52')]=integrations[_0x2f3a('0x53')](_0x38a24b[_0x2f3a('0x4a')]['channel'],_0x38a24b['body'][_0x2f3a('0x54')]);_0x38a24b[_0x2f3a('0x4a')][_0x2f3a('0x55')]=integrations[_0x2f3a('0x56')](_0x38a24b[_0x2f3a('0x4a')][_0x2f3a('0x57')],_0x38a24b[_0x2f3a('0x4a')][_0x2f3a('0x54')]);return db[_0x2f3a('0x4f')][_0x2f3a('0x49')](_0x38a24b['body'],{'include':[{'model':db[_0x2f3a('0x58')],'as':_0x2f3a('0x52')},{'model':db[_0x2f3a('0x58')],'as':_0x2f3a('0x55')}]});}return null;})[_0x2f3a('0x2a')](respondWithResult(_0x196c1b,null))[_0x2f3a('0x45')](handleError(_0x196c1b,null));};exports[_0x2f3a('0x59')]=function(_0x4c7045,_0x416d53,_0x3e0dd6){var _0x34b2dc=[{'name':_0x2f3a('0x5a'),'label':_0x2f3a('0x5a'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x18cc73='';return db['DeskAccount'][_0x2f3a('0x4e')]({'where':{'id':_0x4c7045[_0x2f3a('0x4c')]['id']},'attributes':['id',_0x2f3a('0x5b'),_0x2f3a('0x5c'),_0x2f3a('0x5d'),_0x2f3a('0x5e'),_0x2f3a('0x5f'),_0x2f3a('0x60'),'token','tokenSecret']})[_0x2f3a('0x2a')](handleEntityNotFound(_0x416d53,null))[_0x2f3a('0x2a')](function(_0x289484){if(_0x289484){_0x18cc73=_0x289484['remoteUri'];var _0x1876a=_0x18cc73[_0x2f3a('0x61')](-0x1);if(_0x1876a==='/'){_0x18cc73=_0x18cc73[_0x2f3a('0x62')](0x0,_0x18cc73[_0x2f3a('0x63')](_0x1876a));}var _0x5837a1={'method':_0x2f3a('0x64'),'uri':util[_0x2f3a('0x65')](_0x2f3a('0x66'),_0x18cc73),'headers':{'Content-Type':'application/json','Accept':_0x2f3a('0x67')},'json':!![]};if(_0x289484[_0x2f3a('0x5c')]==='basic'){_0x5837a1[_0x2f3a('0x68')][_0x2f3a('0x69')]=util[_0x2f3a('0x65')]('Basic\x20%s',new Buffer(util['format'](_0x2f3a('0x6a'),_0x289484['username'],_0x289484[_0x2f3a('0x5e')]))[_0x2f3a('0x6b')](_0x2f3a('0x6c')));}return rp(_0x5837a1)[_0x2f3a('0x2a')](function(_0x117d3b){return _0x34b2dc[_0x2f3a('0x6d')](_['map'](_0x117d3b[_0x2f3a('0x6e')]['entries'],function(_0x25daf5){return{'id':_0x25daf5[_0x2f3a('0x2c')],'name':_0x25daf5[_0x2f3a('0x2c')],'type':_0x25daf5[_0x2f3a('0x54')],'active':_0x25daf5[_0x2f3a('0x6f')],'label':_0x25daf5['label'],'custom':!![]};}));});}})[_0x2f3a('0x2a')](function(_0x8038cc){return{'count':_0x8038cc[_0x2f3a('0x47')],'rows':_0x8038cc};})[_0x2f3a('0x2a')](respondWithResult(_0x416d53,null))[_0x2f3a('0x45')](function(_0x19ac19){var _0x447127=_0x4c7045[_0x2f3a('0x32')]['test']?0x1f4:_0x19ac19['statusCode']||0x1f4;logger[_0x2f3a('0x2b')](_0x2f3a('0x70'),_0x2f3a('0x59'),_0x447127,JSON[_0x2f3a('0x71')](_0x19ac19));delete _0x19ac19['name'];if(_0x447127===0x191){_0x447127=0x190;}_0x416d53[_0x2f3a('0x1e')](_0x447127)[_0x2f3a('0x72')](_0x4c7045['query'][_0x2f3a('0x73')]?{'message':_0x2f3a('0x74'),'statusCode':_0x19ac19[_0x2f3a('0x75')]}:_0x19ac19);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 7642cca..8b479bb 100644 --- a/server/api/intDeskAccount/intDeskAccount.model.js +++ b/server/api/intDeskAccount/intDeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4f2=['bluebird','request-promise','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xb4f2,0x8c));var _0x2b4f=function(_0x2f14bf,_0xa04b72){_0x2f14bf=_0x2f14bf-0x0;var _0x55ee01=_0xb4f2[_0x2f14bf];return _0x55ee01;};'use strict';var _=require(_0x2b4f('0x0'));var util=require(_0x2b4f('0x1'));var logger=require(_0x2b4f('0x2'))(_0x2b4f('0x3'));var moment=require('moment');var BPromise=require(_0x2b4f('0x4'));var rp=require(_0x2b4f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b4f('0x6'));var attributes=require(_0x2b4f('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x2b4f('0x8')]=function(_0x3caf2f,_0x161ba6){return _0x3caf2f[_0x2b4f('0x9')](_0x2b4f('0xa'),attributes,{'tableName':_0x2b4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc792=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b6ce7,_0x53f96e){var _0x4da162=function(_0x181572){while(--_0x181572){_0x2b6ce7['push'](_0x2b6ce7['shift']());}};_0x4da162(++_0x53f96e);}(_0xc792,0xba));var _0x2c79=function(_0x50df20,_0x14aba7){_0x50df20=_0x50df20-0x0;var _0x3a1b8d=_0xc792[_0x50df20];return _0x3a1b8d;};'use strict';var _=require(_0x2c79('0x0'));var util=require(_0x2c79('0x1'));var logger=require(_0x2c79('0x2'))(_0x2c79('0x3'));var moment=require(_0x2c79('0x4'));var BPromise=require(_0x2c79('0x5'));var rp=require(_0x2c79('0x6'));var fs=require('fs');var path=require(_0x2c79('0x7'));var rimraf=require(_0x2c79('0x8'));var config=require(_0x2c79('0x9'));var attributes=require(_0x2c79('0xa'));var integrations=require(_0x2c79('0xb'));module[_0x2c79('0xc')]=function(_0x45f836,_0x30e5a9){return _0x45f836[_0x2c79('0xd')]('DeskAccount',attributes,{'tableName':_0x2c79('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 58bd83e..8152f04 100644 --- a/server/api/intDeskAccount/intDeskAccount.rpc.js +++ b/server/api/intDeskAccount/intDeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfea2=['then','info','request\x20sent','debug','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','findAll','options','raw','attributes','limit','include','model','map','stringify','ShowDeskAccount','DeskAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x22499d,_0x558607){var _0x1080d8=function(_0x5d2a94){while(--_0x5d2a94){_0x22499d['push'](_0x22499d['shift']());}};_0x1080d8(++_0x558607);}(_0xfea2,0x137));var _0x2fea=function(_0x3ee4d1,_0x35cbfd){_0x3ee4d1=_0x3ee4d1-0x0;var _0x24b28a=_0xfea2[_0x3ee4d1];return _0x24b28a;};'use strict';var _=require(_0x2fea('0x0'));var util=require(_0x2fea('0x1'));var moment=require('moment');var BPromise=require(_0x2fea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fea('0x3'));var db=require(_0x2fea('0x4'))['db'];var utils=require(_0x2fea('0x5'));var logger=require(_0x2fea('0x6'))(_0x2fea('0x7'));var config=require(_0x2fea('0x8'));var jayson=require(_0x2fea('0x9'));var client=jayson[_0x2fea('0xa')][_0x2fea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46be88,_0x28a002,_0x22295e){return new BPromise(function(_0x199ba0,_0x4383a0){return client[_0x2fea('0xc')](_0x46be88,_0x22295e)[_0x2fea('0xd')](function(_0x4580a7){logger[_0x2fea('0xe')]('DeskAccount,\x20%s,\x20%s',_0x28a002,_0x2fea('0xf'));logger[_0x2fea('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x28a002,_0x2fea('0xf'),JSON['stringify'](_0x4580a7));if(_0x4580a7['error']){if(_0x4580a7[_0x2fea('0x11')][_0x2fea('0x12')]===0x1f4){logger[_0x2fea('0x11')](_0x2fea('0x13'),_0x28a002,_0x4580a7[_0x2fea('0x11')]['message']);return _0x4383a0(_0x4580a7['error']['message']);}logger['error'](_0x2fea('0x13'),_0x28a002,_0x4580a7['error'][_0x2fea('0x14')]);return _0x199ba0(_0x4580a7[_0x2fea('0x11')][_0x2fea('0x14')]);}else{logger[_0x2fea('0xe')]('DeskAccount,\x20%s,\x20%s',_0x28a002,'request\x20sent');_0x199ba0(_0x4580a7[_0x2fea('0x15')][_0x2fea('0x14')]);}})[_0x2fea('0x16')](function(_0x219806){logger['error'](_0x2fea('0x13'),_0x28a002,_0x219806);_0x4383a0(_0x219806);});});}exports[_0x2fea('0x17')]=function(_0x336fc8){var _0x5d96fc=this;return new Promise(function(_0x212959,_0x54f518){return db['DeskAccount'][_0x2fea('0x18')]({'raw':_0x336fc8['options']?_0x336fc8[_0x2fea('0x19')][_0x2fea('0x1a')]===undefined?!![]:![]:!![],'where':_0x336fc8[_0x2fea('0x19')]?_0x336fc8[_0x2fea('0x19')]['where']||null:null,'attributes':_0x336fc8['options']?_0x336fc8[_0x2fea('0x19')][_0x2fea('0x1b')]||null:null,'limit':_0x336fc8[_0x2fea('0x19')]?_0x336fc8[_0x2fea('0x19')][_0x2fea('0x1c')]||null:null,'include':_0x336fc8[_0x2fea('0x19')]?_0x336fc8['options'][_0x2fea('0x1d')]?_['map'](_0x336fc8['options'][_0x2fea('0x1d')],function(_0x1047ce){return{'model':db[_0x1047ce[_0x2fea('0x1e')]],'as':_0x1047ce['as'],'attributes':_0x1047ce[_0x2fea('0x1b')],'include':_0x1047ce[_0x2fea('0x1d')]?_['map'](_0x1047ce[_0x2fea('0x1d')],function(_0x258d5b){return{'model':db[_0x258d5b[_0x2fea('0x1e')]],'as':_0x258d5b['as'],'attributes':_0x258d5b[_0x2fea('0x1b')],'include':_0x258d5b['include']?_[_0x2fea('0x1f')](_0x258d5b[_0x2fea('0x1d')],function(_0x5cf5a5){return{'model':db[_0x5cf5a5[_0x2fea('0x1e')]],'as':_0x5cf5a5['as'],'attributes':_0x5cf5a5[_0x2fea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2fea('0xd')](function(_0xbd325){logger[_0x2fea('0xe')](_0x2fea('0x17'),_0x336fc8);logger['debug'](_0x2fea('0x17'),_0x336fc8,JSON[_0x2fea('0x20')](_0xbd325));_0x212959(_0xbd325);})[_0x2fea('0x16')](function(_0x131025){logger[_0x2fea('0x11')]('GetDeskAccount',_0x131025[_0x2fea('0x14')],_0x336fc8);_0x54f518(_0x5d96fc[_0x2fea('0x11')](0x1f4,_0x131025[_0x2fea('0x14')]));});});};exports[_0x2fea('0x21')]=function(_0x36f196){var _0x129981=this;return new Promise(function(_0x31a1ba,_0x4ba5be){return db[_0x2fea('0x22')][_0x2fea('0x23')]({'raw':_0x36f196['options']?_0x36f196[_0x2fea('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x36f196['options']?_0x36f196[_0x2fea('0x19')]['where']||null:null,'attributes':_0x36f196[_0x2fea('0x19')]?_0x36f196[_0x2fea('0x19')]['attributes']||null:null,'include':_0x36f196[_0x2fea('0x19')]?_0x36f196[_0x2fea('0x19')][_0x2fea('0x1d')]?_['map'](_0x36f196[_0x2fea('0x19')][_0x2fea('0x1d')],function(_0x3d2e47){return{'model':db[_0x3d2e47['model']],'as':_0x3d2e47['as'],'attributes':_0x3d2e47['attributes'],'include':_0x3d2e47['include']?_[_0x2fea('0x1f')](_0x3d2e47['include'],function(_0x3b7cc6){return{'model':db[_0x3b7cc6[_0x2fea('0x1e')]],'as':_0x3b7cc6['as'],'attributes':_0x3b7cc6[_0x2fea('0x1b')],'include':_0x3b7cc6[_0x2fea('0x1d')]?_[_0x2fea('0x1f')](_0x3b7cc6[_0x2fea('0x1d')],function(_0x2d9cf8){return{'model':db[_0x2d9cf8['model']],'as':_0x2d9cf8['as'],'attributes':_0x2d9cf8[_0x2fea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2fea('0xd')](function(_0x126e7d){logger['info']('ShowDeskAccount',_0x36f196);logger[_0x2fea('0x10')](_0x2fea('0x21'),_0x36f196,JSON[_0x2fea('0x20')](_0x126e7d));_0x31a1ba(_0x126e7d);})[_0x2fea('0x16')](function(_0x17ccae){logger['error'](_0x2fea('0x21'),_0x17ccae[_0x2fea('0x14')],_0x36f196);_0x4ba5be(_0x129981[_0x2fea('0x11')](0x1f4,_0x17ccae[_0x2fea('0x14')]));});});}; \ No newline at end of file +var _0x33d6=['message','result','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','then','catch','ShowDeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e77fd,_0x1eef9b){var _0x2b1f3b=function(_0x58e6b1){while(--_0x58e6b1){_0x1e77fd['push'](_0x1e77fd['shift']());}};_0x2b1f3b(++_0x1eef9b);}(_0x33d6,0x7b));var _0x633d=function(_0xaff290,_0x2ab600){_0xaff290=_0xaff290-0x0;var _0x476e68=_0x33d6[_0xaff290];return _0x476e68;};'use strict';var _=require(_0x633d('0x0'));var util=require('util');var moment=require(_0x633d('0x1'));var BPromise=require(_0x633d('0x2'));var rs=require(_0x633d('0x3'));var fs=require('fs');var Redis=require(_0x633d('0x4'));var db=require(_0x633d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x633d('0x6'))(_0x633d('0x7'));var config=require(_0x633d('0x8'));var jayson=require(_0x633d('0x9'));var client=jayson[_0x633d('0xa')][_0x633d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bb8e2,_0x4b5c22,_0x281397){return new BPromise(function(_0xd1f0d7,_0x54f522){return client[_0x633d('0xc')](_0x2bb8e2,_0x281397)['then'](function(_0x59a16c){logger[_0x633d('0xd')](_0x633d('0xe'),_0x4b5c22,_0x633d('0xf'));logger[_0x633d('0x10')](_0x633d('0x11'),_0x4b5c22,'request\x20sent',JSON[_0x633d('0x12')](_0x59a16c));if(_0x59a16c['error']){if(_0x59a16c[_0x633d('0x13')][_0x633d('0x14')]===0x1f4){logger[_0x633d('0x13')](_0x633d('0xe'),_0x4b5c22,_0x59a16c[_0x633d('0x13')][_0x633d('0x15')]);return _0x54f522(_0x59a16c[_0x633d('0x13')][_0x633d('0x15')]);}logger[_0x633d('0x13')](_0x633d('0xe'),_0x4b5c22,_0x59a16c[_0x633d('0x13')][_0x633d('0x15')]);return _0xd1f0d7(_0x59a16c[_0x633d('0x13')][_0x633d('0x15')]);}else{logger['info'](_0x633d('0xe'),_0x4b5c22,_0x633d('0xf'));_0xd1f0d7(_0x59a16c[_0x633d('0x16')][_0x633d('0x15')]);}})['catch'](function(_0x4002d3){logger[_0x633d('0x13')](_0x633d('0xe'),_0x4b5c22,_0x4002d3);_0x54f522(_0x4002d3);});});}exports[_0x633d('0x17')]=function(_0x99653e){var _0x2d38e9=this;return new Promise(function(_0x21c096,_0x2aae22){return db[_0x633d('0x18')]['findAll']({'raw':_0x99653e['options']?_0x99653e[_0x633d('0x19')][_0x633d('0x1a')]===undefined?!![]:![]:!![],'where':_0x99653e[_0x633d('0x19')]?_0x99653e[_0x633d('0x19')][_0x633d('0x1b')]||null:null,'attributes':_0x99653e[_0x633d('0x19')]?_0x99653e[_0x633d('0x19')][_0x633d('0x1c')]||null:null,'limit':_0x99653e[_0x633d('0x19')]?_0x99653e[_0x633d('0x19')][_0x633d('0x1d')]||null:null,'include':_0x99653e['options']?_0x99653e[_0x633d('0x19')][_0x633d('0x1e')]?_['map'](_0x99653e[_0x633d('0x19')][_0x633d('0x1e')],function(_0x3339dd){return{'model':db[_0x3339dd['model']],'as':_0x3339dd['as'],'attributes':_0x3339dd[_0x633d('0x1c')],'include':_0x3339dd[_0x633d('0x1e')]?_[_0x633d('0x1f')](_0x3339dd[_0x633d('0x1e')],function(_0xf909fa){return{'model':db[_0xf909fa['model']],'as':_0xf909fa['as'],'attributes':_0xf909fa[_0x633d('0x1c')],'include':_0xf909fa[_0x633d('0x1e')]?_[_0x633d('0x1f')](_0xf909fa['include'],function(_0x1842cd){return{'model':db[_0x1842cd[_0x633d('0x20')]],'as':_0x1842cd['as'],'attributes':_0x1842cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x633d('0x21')](function(_0x1b883c){logger[_0x633d('0xd')](_0x633d('0x17'),_0x99653e);logger['debug']('GetDeskAccount',_0x99653e,JSON['stringify'](_0x1b883c));_0x21c096(_0x1b883c);})[_0x633d('0x22')](function(_0x26748a){logger['error'](_0x633d('0x17'),_0x26748a[_0x633d('0x15')],_0x99653e);_0x2aae22(_0x2d38e9[_0x633d('0x13')](0x1f4,_0x26748a['message']));});});};exports[_0x633d('0x23')]=function(_0x1c50a8){var _0x43ce99=this;return new Promise(function(_0x122f66,_0x1b7791){return db[_0x633d('0x18')]['find']({'raw':_0x1c50a8[_0x633d('0x19')]?_0x1c50a8['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c50a8[_0x633d('0x19')]?_0x1c50a8[_0x633d('0x19')][_0x633d('0x1b')]||null:null,'attributes':_0x1c50a8[_0x633d('0x19')]?_0x1c50a8[_0x633d('0x19')][_0x633d('0x1c')]||null:null,'include':_0x1c50a8['options']?_0x1c50a8[_0x633d('0x19')][_0x633d('0x1e')]?_[_0x633d('0x1f')](_0x1c50a8[_0x633d('0x19')]['include'],function(_0x5b73be){return{'model':db[_0x5b73be['model']],'as':_0x5b73be['as'],'attributes':_0x5b73be[_0x633d('0x1c')],'include':_0x5b73be[_0x633d('0x1e')]?_['map'](_0x5b73be[_0x633d('0x1e')],function(_0x2c7ed0){return{'model':db[_0x2c7ed0['model']],'as':_0x2c7ed0['as'],'attributes':_0x2c7ed0[_0x633d('0x1c')],'include':_0x2c7ed0['include']?_[_0x633d('0x1f')](_0x2c7ed0[_0x633d('0x1e')],function(_0x535cec){return{'model':db[_0x535cec[_0x633d('0x20')]],'as':_0x535cec['as'],'attributes':_0x535cec[_0x633d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x633d('0x21')](function(_0x54afca){logger['info'](_0x633d('0x23'),_0x1c50a8);logger['debug'](_0x633d('0x23'),_0x1c50a8,JSON[_0x633d('0x12')](_0x54afca));_0x122f66(_0x54afca);})[_0x633d('0x22')](function(_0x2232df){logger[_0x633d('0x13')](_0x633d('0x23'),_0x2232df[_0x633d('0x15')],_0x1c50a8);_0x1b7791(_0x43ce99[_0x633d('0x13')](0x1f4,_0x2232df[_0x633d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 390ef26..52a84d1 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x131c82,_0x252aa3){var _0x385759=function(_0x40a4c9){while(--_0x40a4c9){_0x131c82['push'](_0x131c82['shift']());}};_0x385759(++_0x252aa3);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x172ffb,_0x221fe7){var _0x2d8ece=function(_0x598b7d){while(--_0x598b7d){_0x172ffb['push'](_0x172ffb['shift']());}};_0x2d8ece(++_0x221fe7);}(_0x008c,0x188));var _0xc008=function(_0x28e0f1,_0xd1bfa0){_0x28e0f1=_0x28e0f1-0x0;var _0x13aedc=_0x008c[_0x28e0f1];return _0x13aedc;};'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')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);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('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 0d6c063..4b69cd1 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeff1=['STRING','sequelize'];(function(_0x448246,_0xc4bd77){var _0x99837d=function(_0x566c20){while(--_0x566c20){_0x448246['push'](_0x448246['shift']());}};_0x99837d(++_0xc4bd77);}(_0xeff1,0x89));var _0x1eff=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xeff1[_0x54c9dd];return _0x855156;};'use strict';var Sequelize=require(_0x1eff('0x0'));module['exports']={'name':{'type':Sequelize[_0x1eff('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ca8=['STRING','exports'];(function(_0x115a16,_0x3a2901){var _0x423eb7=function(_0x483bab){while(--_0x483bab){_0x115a16['push'](_0x115a16['shift']());}};_0x423eb7(++_0x3a2901);}(_0x0ca8,0x81));var _0x80ca=function(_0x2739cf,_0x3f9dd4){_0x2739cf=_0x2739cf-0x0;var _0x3b9c95=_0x0ca8[_0x2739cf];return _0x3b9c95;};'use strict';var Sequelize=require('sequelize');module[_0x80ca('0x0')]={'name':{'type':Sequelize[_0x80ca('0x1')]},'description':{'type':Sequelize[_0x80ca('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 6cb8e00..d09768e 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeab5=['pick','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','rows','catch','show','find','create','body','update','params','getFields','findOne','DeskField','keys','getSubjects','order'];(function(_0x3f6fe6,_0x52243c){var _0xebbe7f=function(_0x49adff){while(--_0x49adff){_0x3f6fe6['push'](_0x3f6fe6['shift']());}};_0xebbe7f(++_0x52243c);}(_0xeab5,0x156));var _0x5eab=function(_0xef6ad6,_0x3b6883){_0xef6ad6=_0xef6ad6-0x0;var _0x3bd0b1=_0xeab5[_0xef6ad6];return _0x3bd0b1;};'use strict';var emlformat=require(_0x5eab('0x0'));var rimraf=require(_0x5eab('0x1'));var zipdir=require(_0x5eab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5eab('0x3'));var moment=require(_0x5eab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5eab('0x5'));var util=require(_0x5eab('0x6'));var path=require(_0x5eab('0x7'));var sox=require(_0x5eab('0x8'));var csv=require(_0x5eab('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5eab('0xa'));var _=require(_0x5eab('0xb'));var squel=require(_0x5eab('0xc'));var crypto=require(_0x5eab('0xd'));var jsforce=require(_0x5eab('0xe'));var deskjs=require(_0x5eab('0xf'));var toCsv=require(_0x5eab('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5eab('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5eab('0x11'));var hardwareService=require(_0x5eab('0x12'));var logger=require(_0x5eab('0x13'))(_0x5eab('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5eab('0x15'));var db=require(_0x5eab('0x16'))['db'];function respondWithStatusCode(_0x2950e4,_0x1e86f5){_0x1e86f5=_0x1e86f5||0xcc;return function(_0x4bd549){if(_0x4bd549){return _0x2950e4[_0x5eab('0x17')](_0x1e86f5);}return _0x2950e4[_0x5eab('0x18')](_0x1e86f5)[_0x5eab('0x19')]();};}function respondWithResult(_0x13aa81,_0x313cd5){_0x313cd5=_0x313cd5||0xc8;return function(_0x40e00f){if(_0x40e00f){return _0x13aa81['status'](_0x313cd5)[_0x5eab('0x1a')](_0x40e00f);}};}function respondWithFilteredResult(_0x4989c1,_0x39f727){return function(_0x3f6e72){if(_0x3f6e72){var _0x1c8aa7=typeof _0x39f727[_0x5eab('0x1b')]===_0x5eab('0x1c')&&typeof _0x39f727[_0x5eab('0x1d')]===_0x5eab('0x1c');var _0x2d7ff6=_0x3f6e72[_0x5eab('0x1e')];var _0x3a2b54=_0x1c8aa7?0x0:_0x39f727[_0x5eab('0x1b')];var _0x3799f1=_0x1c8aa7?_0x3f6e72[_0x5eab('0x1e')]:_0x39f727[_0x5eab('0x1b')]+_0x39f727[_0x5eab('0x1d')];var _0x2bda6d;if(_0x3799f1>=_0x2d7ff6){_0x3799f1=_0x2d7ff6;_0x2bda6d=0xc8;}else{_0x2bda6d=0xce;}_0x4989c1['status'](_0x2bda6d);return _0x4989c1[_0x5eab('0x1f')](_0x5eab('0x20'),_0x3a2b54+'-'+_0x3799f1+'/'+_0x2d7ff6)[_0x5eab('0x1a')](_0x3f6e72);}return null;};}function patchUpdates(_0x51cc92){return function(_0x42b97d){try{jsonpatch['apply'](_0x42b97d,_0x51cc92,!![]);}catch(_0x567c10){return BPromise[_0x5eab('0x21')](_0x567c10);}return _0x42b97d[_0x5eab('0x22')]();};}function saveUpdates(_0x562c4b,_0x5407fc){return function(_0x395082){if(_0x395082){return _0x395082['update'](_0x562c4b)[_0x5eab('0x23')](function(_0x18f83a){return _0x18f83a;});}return null;};}function removeEntity(_0x53f556,_0x3ee393){return function(_0x1444d7){if(_0x1444d7){return _0x1444d7[_0x5eab('0x24')]()[_0x5eab('0x23')](function(){_0x53f556['status'](0xcc)[_0x5eab('0x19')]();});}};}function handleEntityNotFound(_0x480a20,_0x36ece3){return function(_0xcc95c0){if(!_0xcc95c0){_0x480a20[_0x5eab('0x17')](0x194);}return _0xcc95c0;};}function handleError(_0x4cd0fa,_0x5d9284){_0x5d9284=_0x5d9284||0x1f4;return function(_0x4b6b8f){logger[_0x5eab('0x25')](_0x4b6b8f[_0x5eab('0x26')]);if(_0x4b6b8f[_0x5eab('0x27')]){delete _0x4b6b8f['name'];}_0x4cd0fa[_0x5eab('0x18')](_0x5d9284)[_0x5eab('0x28')](_0x4b6b8f);};}exports[_0x5eab('0x29')]=function(_0x4c4985,_0x246db0){var _0x1cb1bd={},_0x4c48b1={},_0x4e104c={'count':0x0,'rows':[]};var _0x3b52ff=_[_0x5eab('0x2a')](db[_0x5eab('0x2b')][_0x5eab('0x2c')],function(_0x401144){return{'name':_0x401144[_0x5eab('0x2d')],'type':_0x401144[_0x5eab('0x2e')][_0x5eab('0x2f')]};});_0x4c48b1[_0x5eab('0x30')]=_['map'](_0x3b52ff,_0x5eab('0x27'));_0x4c48b1[_0x5eab('0x31')]=_['keys'](_0x4c4985[_0x5eab('0x31')]);_0x4c48b1[_0x5eab('0x32')]=_[_0x5eab('0x33')](_0x4c48b1['model'],_0x4c48b1[_0x5eab('0x31')]);_0x1cb1bd['attributes']=_[_0x5eab('0x33')](_0x4c48b1[_0x5eab('0x30')],qs['fields'](_0x4c4985[_0x5eab('0x31')][_0x5eab('0x34')]));_0x1cb1bd[_0x5eab('0x35')]=_0x1cb1bd['attributes'][_0x5eab('0x36')]?_0x1cb1bd[_0x5eab('0x35')]:_0x4c48b1[_0x5eab('0x30')];if(!_0x4c4985[_0x5eab('0x31')][_0x5eab('0x37')](_0x5eab('0x38'))){_0x1cb1bd[_0x5eab('0x1d')]=qs['limit'](_0x4c4985[_0x5eab('0x31')][_0x5eab('0x1d')]);_0x1cb1bd['offset']=qs[_0x5eab('0x1b')](_0x4c4985[_0x5eab('0x31')]['offset']);}_0x1cb1bd['order']=qs['sort'](_0x4c4985[_0x5eab('0x31')][_0x5eab('0x39')]);_0x1cb1bd[_0x5eab('0x3a')]=qs[_0x5eab('0x32')](_['pick'](_0x4c4985[_0x5eab('0x31')],_0x4c48b1[_0x5eab('0x32')]),_0x3b52ff);if(_0x4c4985[_0x5eab('0x31')]['filter']){_0x1cb1bd['where']=_['merge'](_0x1cb1bd[_0x5eab('0x3a')],{'$or':_[_0x5eab('0x2a')](_0x3b52ff,function(_0x3954a8){if(_0x3954a8[_0x5eab('0x2e')]!==_0x5eab('0x3b')){var _0x3e54f2={};_0x3e54f2[_0x3954a8['name']]={'$like':'%'+_0x4c4985[_0x5eab('0x31')][_0x5eab('0x3c')]+'%'};return _0x3e54f2;}})});}_0x1cb1bd=_[_0x5eab('0x3d')]({},_0x1cb1bd,_0x4c4985[_0x5eab('0x3e')]);var _0xf309fc={'where':_0x1cb1bd[_0x5eab('0x3a')]};return db[_0x5eab('0x2b')][_0x5eab('0x1e')](_0xf309fc)['then'](function(_0x4f8468){_0x4e104c[_0x5eab('0x1e')]=_0x4f8468;if(_0x4c4985[_0x5eab('0x31')][_0x5eab('0x3f')]){_0x1cb1bd['include']=[{'all':!![]}];}return db[_0x5eab('0x2b')]['findAll'](_0x1cb1bd);})[_0x5eab('0x23')](function(_0x5b8838){_0x4e104c[_0x5eab('0x40')]=_0x5b8838;return _0x4e104c;})[_0x5eab('0x23')](respondWithFilteredResult(_0x246db0,_0x1cb1bd))[_0x5eab('0x41')](handleError(_0x246db0,null));};exports[_0x5eab('0x42')]=function(_0x29f3b3,_0x3525e4){var _0x3729d5={'raw':![],'where':{'id':_0x29f3b3['params']['id']}},_0x13476f={};_0x13476f[_0x5eab('0x30')]=_['keys'](db[_0x5eab('0x2b')]['rawAttributes']);_0x13476f[_0x5eab('0x31')]=_['keys'](_0x29f3b3[_0x5eab('0x31')]);_0x13476f[_0x5eab('0x32')]=_[_0x5eab('0x33')](_0x13476f[_0x5eab('0x30')],_0x13476f[_0x5eab('0x31')]);_0x3729d5['attributes']=_['intersection'](_0x13476f[_0x5eab('0x30')],qs[_0x5eab('0x34')](_0x29f3b3['query'][_0x5eab('0x34')]));_0x3729d5[_0x5eab('0x35')]=_0x3729d5[_0x5eab('0x35')][_0x5eab('0x36')]?_0x3729d5['attributes']:_0x13476f['model'];if(_0x29f3b3[_0x5eab('0x31')][_0x5eab('0x3f')]){_0x3729d5['include']=[{'all':!![]}];}_0x3729d5=_[_0x5eab('0x3d')]({},_0x3729d5,_0x29f3b3[_0x5eab('0x3e')]);return db[_0x5eab('0x2b')][_0x5eab('0x43')](_0x3729d5)[_0x5eab('0x23')](handleEntityNotFound(_0x3525e4,null))['then'](respondWithResult(_0x3525e4,null))[_0x5eab('0x41')](handleError(_0x3525e4,null));};exports[_0x5eab('0x44')]=function(_0x5ecdb5,_0x59d5c1){return db[_0x5eab('0x2b')][_0x5eab('0x44')](_0x5ecdb5[_0x5eab('0x45')],{})[_0x5eab('0x23')](respondWithResult(_0x59d5c1,0xc9))[_0x5eab('0x41')](handleError(_0x59d5c1,null));};exports[_0x5eab('0x46')]=function(_0x280e3c,_0x2e35f3){if(_0x280e3c['body']['id']){delete _0x280e3c[_0x5eab('0x45')]['id'];}return db[_0x5eab('0x2b')][_0x5eab('0x43')]({'where':{'id':_0x280e3c['params']['id']}})['then'](handleEntityNotFound(_0x2e35f3,null))['then'](saveUpdates(_0x280e3c[_0x5eab('0x45')],null))['then'](respondWithResult(_0x2e35f3,null))['catch'](handleError(_0x2e35f3,null));};exports[_0x5eab('0x24')]=function(_0x153164,_0x1d6395){return db[_0x5eab('0x2b')]['find']({'where':{'id':_0x153164[_0x5eab('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d6395,null))[_0x5eab('0x23')](removeEntity(_0x1d6395,null))['catch'](handleError(_0x1d6395,null));};exports[_0x5eab('0x48')]=function(_0x317b3d,_0x53e9d6,_0x25e427){var _0x691fa6={};var _0x4a7913={};var _0x25f0ad;var _0x1805d4;return db[_0x5eab('0x2b')][_0x5eab('0x49')]({'where':{'id':_0x317b3d[_0x5eab('0x47')]['id']}})[_0x5eab('0x23')](handleEntityNotFound(_0x53e9d6,null))[_0x5eab('0x23')](function(_0x23e8f5){if(_0x23e8f5){_0x25f0ad=_0x23e8f5;_0x4a7913['model']=_['keys'](db[_0x5eab('0x4a')][_0x5eab('0x2c')]);_0x4a7913[_0x5eab('0x31')]=_[_0x5eab('0x4b')](_0x317b3d[_0x5eab('0x31')]);_0x4a7913[_0x5eab('0x32')]=_[_0x5eab('0x33')](_0x4a7913[_0x5eab('0x30')],_0x4a7913[_0x5eab('0x31')]);_0x691fa6[_0x5eab('0x35')]=_[_0x5eab('0x33')](_0x4a7913['model'],qs['fields'](_0x317b3d[_0x5eab('0x31')][_0x5eab('0x34')]));_0x691fa6[_0x5eab('0x35')]=_0x691fa6[_0x5eab('0x35')]['length']?_0x691fa6['attributes']:_0x4a7913[_0x5eab('0x30')];_0x691fa6['order']=qs['sort'](_0x317b3d[_0x5eab('0x31')][_0x5eab('0x39')]);_0x691fa6[_0x5eab('0x3a')]=qs[_0x5eab('0x32')](_['pick'](_0x317b3d[_0x5eab('0x31')],_0x4a7913['filters']));if(_0x317b3d[_0x5eab('0x31')]['filter']){_0x691fa6['where']=_[_0x5eab('0x3d')](_0x691fa6[_0x5eab('0x3a')],{'$or':_[_0x5eab('0x2a')](_0x691fa6['attributes'],function(_0x5c78c0){var _0x2d3782={};_0x2d3782[_0x5c78c0]={'$like':'%'+_0x317b3d[_0x5eab('0x31')][_0x5eab('0x3c')]+'%'};return _0x2d3782;})});}_0x691fa6=_['merge']({},_0x691fa6,_0x317b3d[_0x5eab('0x3e')]);return _0x25f0ad['getFields'](_0x691fa6);}})['then'](function(_0x52d9b7){if(_0x52d9b7){_0x1805d4=_0x52d9b7[_0x5eab('0x36')];if(!_0x317b3d[_0x5eab('0x31')][_0x5eab('0x37')](_0x5eab('0x38'))){_0x691fa6[_0x5eab('0x1d')]=qs['limit'](_0x317b3d['query'][_0x5eab('0x1d')]);_0x691fa6[_0x5eab('0x1b')]=qs[_0x5eab('0x1b')](_0x317b3d[_0x5eab('0x31')][_0x5eab('0x1b')]);}return _0x25f0ad[_0x5eab('0x48')](_0x691fa6);}})['then'](function(_0x845f8b){if(_0x845f8b){return _0x845f8b?{'count':_0x1805d4,'rows':_0x845f8b}:null;}})['then'](respondWithResult(_0x53e9d6,null))[_0x5eab('0x41')](handleError(_0x53e9d6,null));};exports[_0x5eab('0x4c')]=function(_0x3593cb,_0x4ae170,_0x59f263){var _0xf106b7={};var _0x1e5c9d={};var _0xef35cc;var _0x4d2aa7;return db[_0x5eab('0x2b')][_0x5eab('0x49')]({'where':{'id':_0x3593cb[_0x5eab('0x47')]['id']}})[_0x5eab('0x23')](handleEntityNotFound(_0x4ae170,null))[_0x5eab('0x23')](function(_0x27ebc1){if(_0x27ebc1){_0xef35cc=_0x27ebc1;_0x1e5c9d[_0x5eab('0x30')]=_[_0x5eab('0x4b')](db['DeskField'][_0x5eab('0x2c')]);_0x1e5c9d['query']=_[_0x5eab('0x4b')](_0x3593cb[_0x5eab('0x31')]);_0x1e5c9d[_0x5eab('0x32')]=_[_0x5eab('0x33')](_0x1e5c9d['model'],_0x1e5c9d['query']);_0xf106b7[_0x5eab('0x35')]=_[_0x5eab('0x33')](_0x1e5c9d['model'],qs[_0x5eab('0x34')](_0x3593cb[_0x5eab('0x31')][_0x5eab('0x34')]));_0xf106b7[_0x5eab('0x35')]=_0xf106b7['attributes'][_0x5eab('0x36')]?_0xf106b7['attributes']:_0x1e5c9d[_0x5eab('0x30')];_0xf106b7[_0x5eab('0x4d')]=qs['sort'](_0x3593cb[_0x5eab('0x31')][_0x5eab('0x39')]);_0xf106b7[_0x5eab('0x3a')]=qs['filters'](_[_0x5eab('0x4e')](_0x3593cb[_0x5eab('0x31')],_0x1e5c9d[_0x5eab('0x32')]));if(_0x3593cb[_0x5eab('0x31')][_0x5eab('0x3c')]){_0xf106b7[_0x5eab('0x3a')]=_[_0x5eab('0x3d')](_0xf106b7[_0x5eab('0x3a')],{'$or':_['map'](_0xf106b7[_0x5eab('0x35')],function(_0x5b07bc){var _0x3a55cf={};_0x3a55cf[_0x5b07bc]={'$like':'%'+_0x3593cb[_0x5eab('0x31')][_0x5eab('0x3c')]+'%'};return _0x3a55cf;})});}_0xf106b7=_[_0x5eab('0x3d')]({},_0xf106b7,_0x3593cb[_0x5eab('0x3e')]);return _0xef35cc[_0x5eab('0x4c')](_0xf106b7);}})['then'](function(_0x586580){if(_0x586580){_0x4d2aa7=_0x586580[_0x5eab('0x36')];if(!_0x3593cb[_0x5eab('0x31')][_0x5eab('0x37')](_0x5eab('0x38'))){_0xf106b7[_0x5eab('0x1d')]=qs['limit'](_0x3593cb[_0x5eab('0x31')][_0x5eab('0x1d')]);_0xf106b7['offset']=qs[_0x5eab('0x1b')](_0x3593cb['query'][_0x5eab('0x1b')]);}return _0xef35cc['getSubjects'](_0xf106b7);}})['then'](function(_0x2661d8){if(_0x2661d8){return _0x2661d8?{'count':_0x4d2aa7,'rows':_0x2661d8}:null;}})[_0x5eab('0x23')](respondWithResult(_0x4ae170,null))[_0x5eab('0x41')](handleError(_0x4ae170,null));};exports[_0x5eab('0x4f')]=function(_0x1a0f94,_0x521f07,_0x5d611a){var _0x2acb4e={};var _0x81822b={};var _0x4d3e80;var _0x214fc0;return db[_0x5eab('0x2b')]['findOne']({'where':{'id':_0x1a0f94[_0x5eab('0x47')]['id']}})['then'](handleEntityNotFound(_0x521f07,null))[_0x5eab('0x23')](function(_0x3902e8){if(_0x3902e8){_0x4d3e80=_0x3902e8;_0x81822b[_0x5eab('0x30')]=_[_0x5eab('0x4b')](db[_0x5eab('0x4a')][_0x5eab('0x2c')]);_0x81822b[_0x5eab('0x31')]=_['keys'](_0x1a0f94[_0x5eab('0x31')]);_0x81822b[_0x5eab('0x32')]=_[_0x5eab('0x33')](_0x81822b[_0x5eab('0x30')],_0x81822b[_0x5eab('0x31')]);_0x2acb4e[_0x5eab('0x35')]=_[_0x5eab('0x33')](_0x81822b[_0x5eab('0x30')],qs[_0x5eab('0x34')](_0x1a0f94[_0x5eab('0x31')][_0x5eab('0x34')]));_0x2acb4e[_0x5eab('0x35')]=_0x2acb4e[_0x5eab('0x35')][_0x5eab('0x36')]?_0x2acb4e['attributes']:_0x81822b[_0x5eab('0x30')];_0x2acb4e[_0x5eab('0x4d')]=qs[_0x5eab('0x39')](_0x1a0f94[_0x5eab('0x31')][_0x5eab('0x39')]);_0x2acb4e[_0x5eab('0x3a')]=qs[_0x5eab('0x32')](_[_0x5eab('0x4e')](_0x1a0f94[_0x5eab('0x31')],_0x81822b['filters']));if(_0x1a0f94['query'][_0x5eab('0x3c')]){_0x2acb4e[_0x5eab('0x3a')]=_['merge'](_0x2acb4e[_0x5eab('0x3a')],{'$or':_['map'](_0x2acb4e[_0x5eab('0x35')],function(_0x808644){var _0x36164d={};_0x36164d[_0x808644]={'$like':'%'+_0x1a0f94[_0x5eab('0x31')][_0x5eab('0x3c')]+'%'};return _0x36164d;})});}_0x2acb4e=_['merge']({},_0x2acb4e,_0x1a0f94[_0x5eab('0x3e')]);return _0x4d3e80['getDescriptions'](_0x2acb4e);}})[_0x5eab('0x23')](function(_0x390962){if(_0x390962){_0x214fc0=_0x390962[_0x5eab('0x36')];if(!_0x1a0f94[_0x5eab('0x31')][_0x5eab('0x37')](_0x5eab('0x38'))){_0x2acb4e[_0x5eab('0x1d')]=qs['limit'](_0x1a0f94[_0x5eab('0x31')][_0x5eab('0x1d')]);_0x2acb4e[_0x5eab('0x1b')]=qs['offset'](_0x1a0f94[_0x5eab('0x31')]['offset']);}return _0x4d3e80['getDescriptions'](_0x2acb4e);}})[_0x5eab('0x23')](function(_0x1460ac){if(_0x1460ac){return _0x1460ac?{'count':_0x214fc0,'rows':_0x1460ac}:null;}})[_0x5eab('0x23')](respondWithResult(_0x521f07,null))['catch'](handleError(_0x521f07,null));};exports[_0x5eab('0x50')]=function(_0x11f2c7,_0x199f43,_0x474a6d){var _0x52e1f3={};var _0x5bf5fe={};var _0x2a32ff;var _0xdf1a87;return db['DeskConfiguration'][_0x5eab('0x49')]({'where':{'id':_0x11f2c7[_0x5eab('0x47')]['id']}})[_0x5eab('0x23')](handleEntityNotFound(_0x199f43,null))[_0x5eab('0x23')](function(_0x239288){if(_0x239288){_0x2a32ff=_0x239288;_0x5bf5fe['model']=_[_0x5eab('0x4b')](db[_0x5eab('0x51')][_0x5eab('0x2c')]);_0x5bf5fe[_0x5eab('0x31')]=_[_0x5eab('0x4b')](_0x11f2c7[_0x5eab('0x31')]);_0x5bf5fe[_0x5eab('0x32')]=_['intersection'](_0x5bf5fe[_0x5eab('0x30')],_0x5bf5fe['query']);_0x52e1f3[_0x5eab('0x35')]=_['intersection'](_0x5bf5fe[_0x5eab('0x30')],qs[_0x5eab('0x34')](_0x11f2c7[_0x5eab('0x31')][_0x5eab('0x34')]));_0x52e1f3[_0x5eab('0x35')]=_0x52e1f3[_0x5eab('0x35')][_0x5eab('0x36')]?_0x52e1f3['attributes']:_0x5bf5fe['model'];_0x52e1f3[_0x5eab('0x4d')]=qs[_0x5eab('0x39')](_0x11f2c7['query'][_0x5eab('0x39')]);_0x52e1f3['where']=qs[_0x5eab('0x32')](_[_0x5eab('0x4e')](_0x11f2c7[_0x5eab('0x31')],_0x5bf5fe['filters']));if(_0x11f2c7[_0x5eab('0x31')]['filter']){_0x52e1f3['where']=_[_0x5eab('0x3d')](_0x52e1f3['where'],{'$or':_[_0x5eab('0x2a')](_0x52e1f3[_0x5eab('0x35')],function(_0x11e188){var _0x427325={};_0x427325[_0x11e188]={'$like':'%'+_0x11f2c7[_0x5eab('0x31')][_0x5eab('0x3c')]+'%'};return _0x427325;})});}_0x52e1f3=_[_0x5eab('0x3d')]({},_0x52e1f3,_0x11f2c7[_0x5eab('0x3e')]);return _0x2a32ff[_0x5eab('0x50')](_0x52e1f3);}})['then'](function(_0xd34f09){if(_0xd34f09){_0xdf1a87=_0xd34f09[_0x5eab('0x36')];if(!_0x11f2c7[_0x5eab('0x31')][_0x5eab('0x37')](_0x5eab('0x38'))){_0x52e1f3[_0x5eab('0x1d')]=qs[_0x5eab('0x1d')](_0x11f2c7[_0x5eab('0x31')][_0x5eab('0x1d')]);_0x52e1f3['offset']=qs['offset'](_0x11f2c7[_0x5eab('0x31')][_0x5eab('0x1b')]);}return _0x2a32ff[_0x5eab('0x50')](_0x52e1f3);}})[_0x5eab('0x23')](function(_0x3fd4d1){if(_0x3fd4d1){return _0x3fd4d1?{'count':_0xdf1a87,'rows':_0x3fd4d1}:null;}})[_0x5eab('0x23')](respondWithResult(_0x199f43,null))[_0x5eab('0x41')](handleError(_0x199f43,null));};exports[_0x5eab('0x52')]=function(_0x3c97bc,_0xad3255,_0x294765){if(_0x3c97bc[_0x5eab('0x45')]['id']){delete _0x3c97bc['body']['id'];}return db[_0x5eab('0x2b')][_0x5eab('0x49')]({'where':{'id':_0x3c97bc['params']['id']}})[_0x5eab('0x23')](handleEntityNotFound(_0xad3255,null))[_0x5eab('0x23')](function(_0x5d8361){if(_0x5d8361){return _0x5d8361[_0x5eab('0x52')](_0x3c97bc[_0x5eab('0x45')][_0x5eab('0x53')]||[]);}return null;})['then'](respondWithResult(_0xad3255,null))[_0x5eab('0x41')](handleError(_0xad3255,null));}; \ No newline at end of file +var _0xe7a6=['include','findAll','rows','catch','show','params','length','includeAll','find','create','body','getFields','findOne','DeskField','pick','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','count','limit','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xe7a6,0x1c4));var _0x6e7a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe7a6[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6e7a('0x0'));var rimraf=require(_0x6e7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e7a('0x2'));var rp=require(_0x6e7a('0x3'));var moment=require(_0x6e7a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e7a('0x5'));var util=require(_0x6e7a('0x6'));var path=require(_0x6e7a('0x7'));var sox=require(_0x6e7a('0x8'));var csv=require('to-csv');var ejs=require(_0x6e7a('0x9'));var fs=require('fs');var fs_extra=require(_0x6e7a('0xa'));var _=require(_0x6e7a('0xb'));var squel=require(_0x6e7a('0xc'));var crypto=require(_0x6e7a('0xd'));var jsforce=require(_0x6e7a('0xe'));var deskjs=require(_0x6e7a('0xf'));var toCsv=require(_0x6e7a('0x10'));var querystring=require(_0x6e7a('0x11'));var Papa=require('papaparse');var Redis=require(_0x6e7a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6e7a('0x13'));var as=require(_0x6e7a('0x14'));var hardwareService=require(_0x6e7a('0x15'));var logger=require(_0x6e7a('0x16'))(_0x6e7a('0x17'));var utils=require(_0x6e7a('0x18'));var config=require(_0x6e7a('0x19'));var licenseUtil=require(_0x6e7a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x104ae0,_0x3e31c1){_0x3e31c1=_0x3e31c1||0xcc;return function(_0xc1978a){if(_0xc1978a){return _0x104ae0['sendStatus'](_0x3e31c1);}return _0x104ae0[_0x6e7a('0x1b')](_0x3e31c1)[_0x6e7a('0x1c')]();};}function respondWithResult(_0x49ec33,_0x5fd518){_0x5fd518=_0x5fd518||0xc8;return function(_0x5c478a){if(_0x5c478a){return _0x49ec33['status'](_0x5fd518)['json'](_0x5c478a);}};}function respondWithFilteredResult(_0x2b855b,_0x5cdf5e){return function(_0x3a3703){if(_0x3a3703){var _0x7382e3=typeof _0x5cdf5e[_0x6e7a('0x1d')]==='undefined'&&typeof _0x5cdf5e['limit']==='undefined';var _0x11007b=_0x3a3703[_0x6e7a('0x1e')];var _0x8327b3=_0x7382e3?0x0:_0x5cdf5e['offset'];var _0x566736=_0x7382e3?_0x3a3703[_0x6e7a('0x1e')]:_0x5cdf5e[_0x6e7a('0x1d')]+_0x5cdf5e[_0x6e7a('0x1f')];var _0x149207;if(_0x566736>=_0x11007b){_0x566736=_0x11007b;_0x149207=0xc8;}else{_0x149207=0xce;}_0x2b855b['status'](_0x149207);return _0x2b855b['set'](_0x6e7a('0x20'),_0x8327b3+'-'+_0x566736+'/'+_0x11007b)[_0x6e7a('0x21')](_0x3a3703);}return null;};}function patchUpdates(_0x372783){return function(_0x441e27){try{jsonpatch[_0x6e7a('0x22')](_0x441e27,_0x372783,!![]);}catch(_0x5b2934){return BPromise['reject'](_0x5b2934);}return _0x441e27[_0x6e7a('0x23')]();};}function saveUpdates(_0x1db636,_0x1a1176){return function(_0x15f9f2){if(_0x15f9f2){return _0x15f9f2[_0x6e7a('0x24')](_0x1db636)[_0x6e7a('0x25')](function(_0x5272c3){return _0x5272c3;});}return null;};}function removeEntity(_0x35ad55,_0x1cae80){return function(_0x35bfe2){if(_0x35bfe2){return _0x35bfe2[_0x6e7a('0x26')]()[_0x6e7a('0x25')](function(){_0x35ad55[_0x6e7a('0x1b')](0xcc)[_0x6e7a('0x1c')]();});}};}function handleEntityNotFound(_0x35c60d,_0x501ee1){return function(_0x44d25d){if(!_0x44d25d){_0x35c60d[_0x6e7a('0x27')](0x194);}return _0x44d25d;};}function handleError(_0x490ad3,_0x308037){_0x308037=_0x308037||0x1f4;return function(_0x558bd8){logger[_0x6e7a('0x28')](_0x558bd8[_0x6e7a('0x29')]);if(_0x558bd8[_0x6e7a('0x2a')]){delete _0x558bd8[_0x6e7a('0x2a')];}_0x490ad3['status'](_0x308037)[_0x6e7a('0x2b')](_0x558bd8);};}exports['index']=function(_0x15b7a3,_0x4ddd18){var _0x19eb24={},_0x257ec9={},_0x20ced9={'count':0x0,'rows':[]};var _0x267390=_[_0x6e7a('0x2c')](db[_0x6e7a('0x2d')][_0x6e7a('0x2e')],function(_0x56002f){return{'name':_0x56002f[_0x6e7a('0x2f')],'type':_0x56002f[_0x6e7a('0x30')]['key']};});_0x257ec9['model']=_[_0x6e7a('0x2c')](_0x267390,_0x6e7a('0x2a'));_0x257ec9[_0x6e7a('0x31')]=_[_0x6e7a('0x32')](_0x15b7a3['query']);_0x257ec9[_0x6e7a('0x33')]=_[_0x6e7a('0x34')](_0x257ec9['model'],_0x257ec9[_0x6e7a('0x31')]);_0x19eb24[_0x6e7a('0x35')]=_[_0x6e7a('0x34')](_0x257ec9[_0x6e7a('0x36')],qs[_0x6e7a('0x37')](_0x15b7a3[_0x6e7a('0x31')][_0x6e7a('0x37')]));_0x19eb24[_0x6e7a('0x35')]=_0x19eb24[_0x6e7a('0x35')]['length']?_0x19eb24[_0x6e7a('0x35')]:_0x257ec9[_0x6e7a('0x36')];if(!_0x15b7a3['query']['hasOwnProperty'](_0x6e7a('0x38'))){_0x19eb24[_0x6e7a('0x1f')]=qs[_0x6e7a('0x1f')](_0x15b7a3[_0x6e7a('0x31')][_0x6e7a('0x1f')]);_0x19eb24[_0x6e7a('0x1d')]=qs[_0x6e7a('0x1d')](_0x15b7a3[_0x6e7a('0x31')][_0x6e7a('0x1d')]);}_0x19eb24[_0x6e7a('0x39')]=qs['sort'](_0x15b7a3['query'][_0x6e7a('0x3a')]);_0x19eb24[_0x6e7a('0x3b')]=qs[_0x6e7a('0x33')](_['pick'](_0x15b7a3[_0x6e7a('0x31')],_0x257ec9[_0x6e7a('0x33')]),_0x267390);if(_0x15b7a3[_0x6e7a('0x31')][_0x6e7a('0x3c')]){_0x19eb24['where']=_['merge'](_0x19eb24['where'],{'$or':_[_0x6e7a('0x2c')](_0x267390,function(_0x232892){if(_0x232892[_0x6e7a('0x30')]!==_0x6e7a('0x3d')){var _0x3c1c3d={};_0x3c1c3d[_0x232892[_0x6e7a('0x2a')]]={'$like':'%'+_0x15b7a3[_0x6e7a('0x31')][_0x6e7a('0x3c')]+'%'};return _0x3c1c3d;}})});}_0x19eb24=_[_0x6e7a('0x3e')]({},_0x19eb24,_0x15b7a3[_0x6e7a('0x3f')]);var _0x154c18={'where':_0x19eb24[_0x6e7a('0x3b')]};return db[_0x6e7a('0x2d')][_0x6e7a('0x1e')](_0x154c18)[_0x6e7a('0x25')](function(_0x5df3d3){_0x20ced9[_0x6e7a('0x1e')]=_0x5df3d3;if(_0x15b7a3['query']['includeAll']){_0x19eb24[_0x6e7a('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x6e7a('0x41')](_0x19eb24);})[_0x6e7a('0x25')](function(_0x535ea2){_0x20ced9[_0x6e7a('0x42')]=_0x535ea2;return _0x20ced9;})[_0x6e7a('0x25')](respondWithFilteredResult(_0x4ddd18,_0x19eb24))[_0x6e7a('0x43')](handleError(_0x4ddd18,null));};exports[_0x6e7a('0x44')]=function(_0x28bcf5,_0xe5ae70){var _0x4aa7dd={'raw':![],'where':{'id':_0x28bcf5[_0x6e7a('0x45')]['id']}},_0x348c40={};_0x348c40[_0x6e7a('0x36')]=_[_0x6e7a('0x32')](db[_0x6e7a('0x2d')]['rawAttributes']);_0x348c40[_0x6e7a('0x31')]=_[_0x6e7a('0x32')](_0x28bcf5[_0x6e7a('0x31')]);_0x348c40['filters']=_[_0x6e7a('0x34')](_0x348c40['model'],_0x348c40[_0x6e7a('0x31')]);_0x4aa7dd[_0x6e7a('0x35')]=_['intersection'](_0x348c40[_0x6e7a('0x36')],qs[_0x6e7a('0x37')](_0x28bcf5[_0x6e7a('0x31')][_0x6e7a('0x37')]));_0x4aa7dd[_0x6e7a('0x35')]=_0x4aa7dd['attributes'][_0x6e7a('0x46')]?_0x4aa7dd[_0x6e7a('0x35')]:_0x348c40[_0x6e7a('0x36')];if(_0x28bcf5[_0x6e7a('0x31')][_0x6e7a('0x47')]){_0x4aa7dd['include']=[{'all':!![]}];}_0x4aa7dd=_['merge']({},_0x4aa7dd,_0x28bcf5[_0x6e7a('0x3f')]);return db[_0x6e7a('0x2d')][_0x6e7a('0x48')](_0x4aa7dd)['then'](handleEntityNotFound(_0xe5ae70,null))[_0x6e7a('0x25')](respondWithResult(_0xe5ae70,null))[_0x6e7a('0x43')](handleError(_0xe5ae70,null));};exports[_0x6e7a('0x49')]=function(_0x4fab55,_0x226c9c){return db[_0x6e7a('0x2d')][_0x6e7a('0x49')](_0x4fab55[_0x6e7a('0x4a')],{})[_0x6e7a('0x25')](respondWithResult(_0x226c9c,0xc9))[_0x6e7a('0x43')](handleError(_0x226c9c,null));};exports['update']=function(_0x4ab2c0,_0xa0c34){if(_0x4ab2c0[_0x6e7a('0x4a')]['id']){delete _0x4ab2c0[_0x6e7a('0x4a')]['id'];}return db[_0x6e7a('0x2d')][_0x6e7a('0x48')]({'where':{'id':_0x4ab2c0[_0x6e7a('0x45')]['id']}})[_0x6e7a('0x25')](handleEntityNotFound(_0xa0c34,null))[_0x6e7a('0x25')](saveUpdates(_0x4ab2c0[_0x6e7a('0x4a')],null))[_0x6e7a('0x25')](respondWithResult(_0xa0c34,null))['catch'](handleError(_0xa0c34,null));};exports[_0x6e7a('0x26')]=function(_0x2eaee6,_0x51f4bd){return db[_0x6e7a('0x2d')][_0x6e7a('0x48')]({'where':{'id':_0x2eaee6['params']['id']}})[_0x6e7a('0x25')](handleEntityNotFound(_0x51f4bd,null))[_0x6e7a('0x25')](removeEntity(_0x51f4bd,null))[_0x6e7a('0x43')](handleError(_0x51f4bd,null));};exports[_0x6e7a('0x4b')]=function(_0x1dce11,_0x560d7a,_0x5ad689){var _0x198022={};var _0x33e290={};var _0x390b60;var _0x210a53;return db[_0x6e7a('0x2d')][_0x6e7a('0x4c')]({'where':{'id':_0x1dce11[_0x6e7a('0x45')]['id']}})[_0x6e7a('0x25')](handleEntityNotFound(_0x560d7a,null))[_0x6e7a('0x25')](function(_0x6ec754){if(_0x6ec754){_0x390b60=_0x6ec754;_0x33e290[_0x6e7a('0x36')]=_[_0x6e7a('0x32')](db[_0x6e7a('0x4d')][_0x6e7a('0x2e')]);_0x33e290[_0x6e7a('0x31')]=_[_0x6e7a('0x32')](_0x1dce11[_0x6e7a('0x31')]);_0x33e290[_0x6e7a('0x33')]=_[_0x6e7a('0x34')](_0x33e290[_0x6e7a('0x36')],_0x33e290[_0x6e7a('0x31')]);_0x198022['attributes']=_['intersection'](_0x33e290[_0x6e7a('0x36')],qs['fields'](_0x1dce11[_0x6e7a('0x31')][_0x6e7a('0x37')]));_0x198022[_0x6e7a('0x35')]=_0x198022[_0x6e7a('0x35')][_0x6e7a('0x46')]?_0x198022['attributes']:_0x33e290[_0x6e7a('0x36')];_0x198022[_0x6e7a('0x39')]=qs[_0x6e7a('0x3a')](_0x1dce11[_0x6e7a('0x31')][_0x6e7a('0x3a')]);_0x198022['where']=qs['filters'](_[_0x6e7a('0x4e')](_0x1dce11[_0x6e7a('0x31')],_0x33e290[_0x6e7a('0x33')]));if(_0x1dce11[_0x6e7a('0x31')]['filter']){_0x198022['where']=_[_0x6e7a('0x3e')](_0x198022[_0x6e7a('0x3b')],{'$or':_[_0x6e7a('0x2c')](_0x198022[_0x6e7a('0x35')],function(_0x8d7354){var _0x12f3c3={};_0x12f3c3[_0x8d7354]={'$like':'%'+_0x1dce11[_0x6e7a('0x31')][_0x6e7a('0x3c')]+'%'};return _0x12f3c3;})});}_0x198022=_[_0x6e7a('0x3e')]({},_0x198022,_0x1dce11[_0x6e7a('0x3f')]);return _0x390b60['getFields'](_0x198022);}})[_0x6e7a('0x25')](function(_0x112cf6){if(_0x112cf6){_0x210a53=_0x112cf6[_0x6e7a('0x46')];if(!_0x1dce11[_0x6e7a('0x31')]['hasOwnProperty'](_0x6e7a('0x38'))){_0x198022['limit']=qs['limit'](_0x1dce11[_0x6e7a('0x31')][_0x6e7a('0x1f')]);_0x198022[_0x6e7a('0x1d')]=qs[_0x6e7a('0x1d')](_0x1dce11['query'][_0x6e7a('0x1d')]);}return _0x390b60['getFields'](_0x198022);}})[_0x6e7a('0x25')](function(_0x224fbc){if(_0x224fbc){return _0x224fbc?{'count':_0x210a53,'rows':_0x224fbc}:null;}})[_0x6e7a('0x25')](respondWithResult(_0x560d7a,null))[_0x6e7a('0x43')](handleError(_0x560d7a,null));};exports[_0x6e7a('0x4f')]=function(_0x45691b,_0x2e4af3,_0x42926e){var _0xe28949={};var _0x19c4d4={};var _0x5c1ed1;var _0x184c0f;return db[_0x6e7a('0x2d')]['findOne']({'where':{'id':_0x45691b[_0x6e7a('0x45')]['id']}})[_0x6e7a('0x25')](handleEntityNotFound(_0x2e4af3,null))['then'](function(_0x1093af){if(_0x1093af){_0x5c1ed1=_0x1093af;_0x19c4d4[_0x6e7a('0x36')]=_['keys'](db[_0x6e7a('0x4d')][_0x6e7a('0x2e')]);_0x19c4d4[_0x6e7a('0x31')]=_[_0x6e7a('0x32')](_0x45691b['query']);_0x19c4d4[_0x6e7a('0x33')]=_[_0x6e7a('0x34')](_0x19c4d4[_0x6e7a('0x36')],_0x19c4d4[_0x6e7a('0x31')]);_0xe28949['attributes']=_[_0x6e7a('0x34')](_0x19c4d4['model'],qs[_0x6e7a('0x37')](_0x45691b['query'][_0x6e7a('0x37')]));_0xe28949['attributes']=_0xe28949[_0x6e7a('0x35')]['length']?_0xe28949['attributes']:_0x19c4d4[_0x6e7a('0x36')];_0xe28949[_0x6e7a('0x39')]=qs[_0x6e7a('0x3a')](_0x45691b[_0x6e7a('0x31')][_0x6e7a('0x3a')]);_0xe28949[_0x6e7a('0x3b')]=qs['filters'](_['pick'](_0x45691b[_0x6e7a('0x31')],_0x19c4d4['filters']));if(_0x45691b[_0x6e7a('0x31')][_0x6e7a('0x3c')]){_0xe28949[_0x6e7a('0x3b')]=_['merge'](_0xe28949[_0x6e7a('0x3b')],{'$or':_[_0x6e7a('0x2c')](_0xe28949[_0x6e7a('0x35')],function(_0x49e1bb){var _0xd66f2b={};_0xd66f2b[_0x49e1bb]={'$like':'%'+_0x45691b[_0x6e7a('0x31')][_0x6e7a('0x3c')]+'%'};return _0xd66f2b;})});}_0xe28949=_[_0x6e7a('0x3e')]({},_0xe28949,_0x45691b[_0x6e7a('0x3f')]);return _0x5c1ed1[_0x6e7a('0x4f')](_0xe28949);}})[_0x6e7a('0x25')](function(_0x42c40f){if(_0x42c40f){_0x184c0f=_0x42c40f[_0x6e7a('0x46')];if(!_0x45691b[_0x6e7a('0x31')][_0x6e7a('0x50')](_0x6e7a('0x38'))){_0xe28949[_0x6e7a('0x1f')]=qs[_0x6e7a('0x1f')](_0x45691b['query']['limit']);_0xe28949[_0x6e7a('0x1d')]=qs[_0x6e7a('0x1d')](_0x45691b[_0x6e7a('0x31')][_0x6e7a('0x1d')]);}return _0x5c1ed1[_0x6e7a('0x4f')](_0xe28949);}})[_0x6e7a('0x25')](function(_0x4cbcf0){if(_0x4cbcf0){return _0x4cbcf0?{'count':_0x184c0f,'rows':_0x4cbcf0}:null;}})[_0x6e7a('0x25')](respondWithResult(_0x2e4af3,null))[_0x6e7a('0x43')](handleError(_0x2e4af3,null));};exports['getDescriptions']=function(_0x1aba5d,_0x5abd91,_0x227193){var _0x69ea40={};var _0x42b32b={};var _0x31002d;var _0x1682aa;return db[_0x6e7a('0x2d')][_0x6e7a('0x4c')]({'where':{'id':_0x1aba5d[_0x6e7a('0x45')]['id']}})[_0x6e7a('0x25')](handleEntityNotFound(_0x5abd91,null))[_0x6e7a('0x25')](function(_0x59d35a){if(_0x59d35a){_0x31002d=_0x59d35a;_0x42b32b[_0x6e7a('0x36')]=_[_0x6e7a('0x32')](db[_0x6e7a('0x4d')][_0x6e7a('0x2e')]);_0x42b32b[_0x6e7a('0x31')]=_[_0x6e7a('0x32')](_0x1aba5d['query']);_0x42b32b['filters']=_[_0x6e7a('0x34')](_0x42b32b['model'],_0x42b32b['query']);_0x69ea40[_0x6e7a('0x35')]=_[_0x6e7a('0x34')](_0x42b32b[_0x6e7a('0x36')],qs[_0x6e7a('0x37')](_0x1aba5d[_0x6e7a('0x31')][_0x6e7a('0x37')]));_0x69ea40[_0x6e7a('0x35')]=_0x69ea40[_0x6e7a('0x35')][_0x6e7a('0x46')]?_0x69ea40[_0x6e7a('0x35')]:_0x42b32b[_0x6e7a('0x36')];_0x69ea40['order']=qs['sort'](_0x1aba5d[_0x6e7a('0x31')][_0x6e7a('0x3a')]);_0x69ea40[_0x6e7a('0x3b')]=qs['filters'](_[_0x6e7a('0x4e')](_0x1aba5d['query'],_0x42b32b[_0x6e7a('0x33')]));if(_0x1aba5d[_0x6e7a('0x31')][_0x6e7a('0x3c')]){_0x69ea40[_0x6e7a('0x3b')]=_[_0x6e7a('0x3e')](_0x69ea40['where'],{'$or':_[_0x6e7a('0x2c')](_0x69ea40['attributes'],function(_0x4c6a71){var _0x3af89e={};_0x3af89e[_0x4c6a71]={'$like':'%'+_0x1aba5d[_0x6e7a('0x31')][_0x6e7a('0x3c')]+'%'};return _0x3af89e;})});}_0x69ea40=_[_0x6e7a('0x3e')]({},_0x69ea40,_0x1aba5d[_0x6e7a('0x3f')]);return _0x31002d[_0x6e7a('0x51')](_0x69ea40);}})[_0x6e7a('0x25')](function(_0x2ce06f){if(_0x2ce06f){_0x1682aa=_0x2ce06f[_0x6e7a('0x46')];if(!_0x1aba5d[_0x6e7a('0x31')][_0x6e7a('0x50')](_0x6e7a('0x38'))){_0x69ea40[_0x6e7a('0x1f')]=qs[_0x6e7a('0x1f')](_0x1aba5d[_0x6e7a('0x31')][_0x6e7a('0x1f')]);_0x69ea40[_0x6e7a('0x1d')]=qs['offset'](_0x1aba5d['query'][_0x6e7a('0x1d')]);}return _0x31002d[_0x6e7a('0x51')](_0x69ea40);}})[_0x6e7a('0x25')](function(_0x29eec9){if(_0x29eec9){return _0x29eec9?{'count':_0x1682aa,'rows':_0x29eec9}:null;}})['then'](respondWithResult(_0x5abd91,null))['catch'](handleError(_0x5abd91,null));};exports[_0x6e7a('0x52')]=function(_0x268967,_0x1ad076,_0x5ed3a2){var _0xba274e={};var _0x3b535b={};var _0x53d47c;var _0x45ed8a;return db[_0x6e7a('0x2d')]['findOne']({'where':{'id':_0x268967[_0x6e7a('0x45')]['id']}})[_0x6e7a('0x25')](handleEntityNotFound(_0x1ad076,null))[_0x6e7a('0x25')](function(_0x367a56){if(_0x367a56){_0x53d47c=_0x367a56;_0x3b535b[_0x6e7a('0x36')]=_[_0x6e7a('0x32')](db[_0x6e7a('0x53')]['rawAttributes']);_0x3b535b[_0x6e7a('0x31')]=_[_0x6e7a('0x32')](_0x268967[_0x6e7a('0x31')]);_0x3b535b[_0x6e7a('0x33')]=_[_0x6e7a('0x34')](_0x3b535b[_0x6e7a('0x36')],_0x3b535b[_0x6e7a('0x31')]);_0xba274e[_0x6e7a('0x35')]=_['intersection'](_0x3b535b[_0x6e7a('0x36')],qs[_0x6e7a('0x37')](_0x268967[_0x6e7a('0x31')][_0x6e7a('0x37')]));_0xba274e[_0x6e7a('0x35')]=_0xba274e[_0x6e7a('0x35')][_0x6e7a('0x46')]?_0xba274e['attributes']:_0x3b535b[_0x6e7a('0x36')];_0xba274e[_0x6e7a('0x39')]=qs['sort'](_0x268967['query']['sort']);_0xba274e[_0x6e7a('0x3b')]=qs[_0x6e7a('0x33')](_[_0x6e7a('0x4e')](_0x268967[_0x6e7a('0x31')],_0x3b535b[_0x6e7a('0x33')]));if(_0x268967[_0x6e7a('0x31')][_0x6e7a('0x3c')]){_0xba274e[_0x6e7a('0x3b')]=_[_0x6e7a('0x3e')](_0xba274e[_0x6e7a('0x3b')],{'$or':_[_0x6e7a('0x2c')](_0xba274e['attributes'],function(_0x141faa){var _0x99bd44={};_0x99bd44[_0x141faa]={'$like':'%'+_0x268967[_0x6e7a('0x31')][_0x6e7a('0x3c')]+'%'};return _0x99bd44;})});}_0xba274e=_[_0x6e7a('0x3e')]({},_0xba274e,_0x268967[_0x6e7a('0x3f')]);return _0x53d47c[_0x6e7a('0x52')](_0xba274e);}})['then'](function(_0x24c1eb){if(_0x24c1eb){_0x45ed8a=_0x24c1eb[_0x6e7a('0x46')];if(!_0x268967[_0x6e7a('0x31')][_0x6e7a('0x50')](_0x6e7a('0x38'))){_0xba274e[_0x6e7a('0x1f')]=qs['limit'](_0x268967[_0x6e7a('0x31')][_0x6e7a('0x1f')]);_0xba274e[_0x6e7a('0x1d')]=qs[_0x6e7a('0x1d')](_0x268967[_0x6e7a('0x31')]['offset']);}return _0x53d47c[_0x6e7a('0x52')](_0xba274e);}})['then'](function(_0x1bd072){if(_0x1bd072){return _0x1bd072?{'count':_0x45ed8a,'rows':_0x1bd072}:null;}})['then'](respondWithResult(_0x1ad076,null))[_0x6e7a('0x43')](handleError(_0x1ad076,null));};exports['setTags']=function(_0x4ea612,_0x26db14,_0x2fa2f9){if(_0x4ea612[_0x6e7a('0x4a')]['id']){delete _0x4ea612[_0x6e7a('0x4a')]['id'];}return db[_0x6e7a('0x2d')]['findOne']({'where':{'id':_0x4ea612['params']['id']}})[_0x6e7a('0x25')](handleEntityNotFound(_0x26db14,null))['then'](function(_0x47502e){if(_0x47502e){return _0x47502e[_0x6e7a('0x54')](_0x4ea612[_0x6e7a('0x4a')][_0x6e7a('0x55')]||[]);}return null;})[_0x6e7a('0x25')](respondWithResult(_0x26db14,null))[_0x6e7a('0x43')](handleError(_0x26db14,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 06b28b9..1571fe1 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.model.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00f0=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x5acccd,_0x32a8e2){var _0x3edcfc=function(_0x2822e4){while(--_0x2822e4){_0x5acccd['push'](_0x5acccd['shift']());}};_0x3edcfc(++_0x32a8e2);}(_0x00f0,0xf0));var _0x000f=function(_0x50d3e0,_0x15a289){_0x50d3e0=_0x50d3e0-0x0;var _0x2ba9d1=_0x00f0[_0x50d3e0];return _0x2ba9d1;};'use strict';var _=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var logger=require(_0x000f('0x2'))(_0x000f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x000f('0x4'));var fs=require('fs');var path=require(_0x000f('0x5'));var rimraf=require(_0x000f('0x6'));var config=require(_0x000f('0x7'));var attributes=require(_0x000f('0x8'));module[_0x000f('0x9')]=function(_0x5b0fbd,_0x5472a5){return _0x5b0fbd[_0x000f('0xa')](_0x000f('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd654=['DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x4d389d,_0xec145d){var _0x22bd25=function(_0x22cd63){while(--_0x22cd63){_0x4d389d['push'](_0x4d389d['shift']());}};_0x22bd25(++_0xec145d);}(_0xd654,0x16d));var _0x4d65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd654[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4d65('0x0'));var util=require('util');var logger=require(_0x4d65('0x1'))(_0x4d65('0x2'));var moment=require('moment');var BPromise=require(_0x4d65('0x3'));var rp=require(_0x4d65('0x4'));var fs=require('fs');var path=require(_0x4d65('0x5'));var rimraf=require(_0x4d65('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x4d65('0x7')]=function(_0x4603c3,_0x486cdc){return _0x4603c3[_0x4d65('0x8')](_0x4d65('0x9'),attributes,{'tableName':_0x4d65('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 9e70c2f..55b01d0 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa32b=['message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','DeskConfiguration,\x20%s,\x20%s'];(function(_0x279095,_0x15f37e){var _0x5a5cdb=function(_0x2909bd){while(--_0x2909bd){_0x279095['push'](_0x279095['shift']());}};_0x5a5cdb(++_0x15f37e);}(_0xa32b,0x68));var _0xba32=function(_0x166acc,_0x111e4e){_0x166acc=_0x166acc-0x0;var _0x209f4d=_0xa32b[_0x166acc];return _0x209f4d;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var moment=require(_0xba32('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba32('0x2'));var db=require(_0xba32('0x3'))['db'];var utils=require(_0xba32('0x4'));var logger=require('../../config/logger')(_0xba32('0x5'));var config=require(_0xba32('0x6'));var jayson=require(_0xba32('0x7'));var client=jayson[_0xba32('0x8')][_0xba32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a59,_0x1b1332,_0x4edbc6){return new BPromise(function(_0xcdcc5b,_0x13395b){return client[_0xba32('0xa')](_0x5c5a59,_0x4edbc6)[_0xba32('0xb')](function(_0x5d8f64){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x1b1332,'request\x20sent');logger[_0xba32('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1b1332,_0xba32('0xd'),JSON['stringify'](_0x5d8f64));if(_0x5d8f64[_0xba32('0xe')]){if(_0x5d8f64['error']['code']===0x1f4){logger[_0xba32('0xe')](_0xba32('0xf'),_0x1b1332,_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);return _0x13395b(_0x5d8f64[_0xba32('0xe')]['message']);}logger[_0xba32('0xe')](_0xba32('0xf'),_0x1b1332,_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);return _0xcdcc5b(_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);}else{logger[_0xba32('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x1b1332,_0xba32('0xd'));_0xcdcc5b(_0x5d8f64[_0xba32('0x12')][_0xba32('0x10')]);}})[_0xba32('0x13')](function(_0x310dee){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x1b1332,_0x310dee);_0x13395b(_0x310dee);});});} \ No newline at end of file +var _0xe84a=['http','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5998f4,_0x692111){var _0x67aa52=function(_0x153ad3){while(--_0x153ad3){_0x5998f4['push'](_0x5998f4['shift']());}};_0x67aa52(++_0x692111);}(_0xe84a,0x113));var _0xae84=function(_0x5f3b3d,_0x49531a){_0x5f3b3d=_0x5f3b3d-0x0;var _0x2fd348=_0xe84a[_0x5f3b3d];return _0x2fd348;};'use strict';var _=require(_0xae84('0x0'));var util=require(_0xae84('0x1'));var moment=require(_0xae84('0x2'));var BPromise=require(_0xae84('0x3'));var rs=require(_0xae84('0x4'));var fs=require('fs');var Redis=require(_0xae84('0x5'));var db=require(_0xae84('0x6'))['db'];var utils=require(_0xae84('0x7'));var logger=require(_0xae84('0x8'))(_0xae84('0x9'));var config=require('../../config/environment');var jayson=require(_0xae84('0xa'));var client=jayson['client'][_0xae84('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22930e,_0x53b9da,_0x372fbf){return new BPromise(function(_0x38ddc8,_0x426e88){return client['request'](_0x22930e,_0x372fbf)[_0xae84('0xc')](function(_0x4d415a){logger[_0xae84('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x53b9da,_0xae84('0xe'));logger['debug'](_0xae84('0xf'),_0x53b9da,_0xae84('0xe'),JSON[_0xae84('0x10')](_0x4d415a));if(_0x4d415a[_0xae84('0x11')]){if(_0x4d415a[_0xae84('0x11')][_0xae84('0x12')]===0x1f4){logger[_0xae84('0x11')](_0xae84('0x13'),_0x53b9da,_0x4d415a[_0xae84('0x11')]['message']);return _0x426e88(_0x4d415a['error']['message']);}logger[_0xae84('0x11')](_0xae84('0x13'),_0x53b9da,_0x4d415a[_0xae84('0x11')]['message']);return _0x38ddc8(_0x4d415a[_0xae84('0x11')][_0xae84('0x14')]);}else{logger['info'](_0xae84('0x13'),_0x53b9da,_0xae84('0xe'));_0x38ddc8(_0x4d415a['result'][_0xae84('0x14')]);}})[_0xae84('0x15')](function(_0x15943d){logger[_0xae84('0x11')](_0xae84('0x13'),_0x53b9da,_0x15943d);_0x426e88(_0x15943d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ea609e9..0c7e8a4 100644 --- a/server/api/intDeskField/index.js +++ b/server/api/intDeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f93=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f93,0x165));var _0x32f9=function(_0x5dd5e0,_0x71e87f){_0x5dd5e0=_0x5dd5e0-0x0;var _0x447a0a=_0x2f93[_0x5dd5e0];return _0x447a0a;};'use strict';var multer=require(_0x32f9('0x0'));var util=require(_0x32f9('0x1'));var path=require(_0x32f9('0x2'));var timeout=require(_0x32f9('0x3'));var express=require(_0x32f9('0x4'));var router=express['Router']();var fs_extra=require(_0x32f9('0x5'));var auth=require(_0x32f9('0x6'));var interaction=require(_0x32f9('0x7'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x32f9('0x8')]('/',auth[_0x32f9('0x9')](),controller[_0x32f9('0xa')]);router[_0x32f9('0x8')](_0x32f9('0xb'),auth[_0x32f9('0x9')](),controller['show']);router['post']('/',auth[_0x32f9('0x9')](),controller[_0x32f9('0xc')]);router[_0x32f9('0xd')]('/:id',auth[_0x32f9('0x9')](),controller[_0x32f9('0xe')]);router[_0x32f9('0xf')](_0x32f9('0xb'),auth[_0x32f9('0x9')](),controller[_0x32f9('0x10')]);module[_0x32f9('0x11')]=router; \ No newline at end of file +var _0xb44a=['destroy','exports','path','express','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x5d6ed7,_0x340473){var _0x2a3c95=function(_0x3f02e9){while(--_0x3f02e9){_0x5d6ed7['push'](_0x5d6ed7['shift']());}};_0x2a3c95(++_0x340473);}(_0xb44a,0x1c2));var _0xab44=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0xb44a[_0x57b236];return _0x4feb29;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab44('0x0'));var timeout=require('connect-timeout');var express=require(_0xab44('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xab44('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xab44('0x3'));var controller=require(_0xab44('0x4'));router[_0xab44('0x5')]('/',auth[_0xab44('0x6')](),controller[_0xab44('0x7')]);router[_0xab44('0x5')](_0xab44('0x8'),auth[_0xab44('0x6')](),controller[_0xab44('0x9')]);router[_0xab44('0xa')]('/',auth[_0xab44('0x6')](),controller[_0xab44('0xb')]);router[_0xab44('0xc')]('/:id',auth[_0xab44('0x6')](),controller['update']);router[_0xab44('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xab44('0xe')]);module[_0xab44('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2c92346..2112d23 100644 --- a/server/api/intDeskField/intDeskField.attributes.js +++ b/server/api/intDeskField/intDeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ae4=['ENUM','variable','exports','string','customVariable','keyValue','STRING'];(function(_0x496997,_0x5a576c){var _0x3d16b2=function(_0x7cb3e7){while(--_0x7cb3e7){_0x496997['push'](_0x496997['shift']());}};_0x3d16b2(++_0x5a576c);}(_0x3ae4,0xfe));var _0x43ae=function(_0x687695,_0x12f187){_0x687695=_0x687695-0x0;var _0x11e934=_0x3ae4[_0x687695];return _0x11e934;};'use strict';var Sequelize=require('sequelize');module[_0x43ae('0x0')]={'type':{'type':Sequelize['ENUM'](_0x43ae('0x1'),'variable',_0x43ae('0x2'),_0x43ae('0x3'),'picklist'),'defaultValue':_0x43ae('0x1')},'content':{'type':Sequelize[_0x43ae('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x43ae('0x5')]('string',_0x43ae('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x43ae('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7c58=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3b4b31,_0x28e61e){var _0x562b78=function(_0x2ef068){while(--_0x2ef068){_0x3b4b31['push'](_0x3b4b31['shift']());}};_0x562b78(++_0x28e61e);}(_0x7c58,0x7f));var _0x87c5=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x7c58[_0x5a3cf0];return _0x5a64ee;};'use strict';var Sequelize=require(_0x87c5('0x0'));module[_0x87c5('0x1')]={'type':{'type':Sequelize[_0x87c5('0x2')](_0x87c5('0x3'),_0x87c5('0x4'),_0x87c5('0x5'),_0x87c5('0x6'),_0x87c5('0x7')),'defaultValue':_0x87c5('0x3')},'content':{'type':Sequelize[_0x87c5('0x8')]},'key':{'type':Sequelize[_0x87c5('0x8')]},'keyType':{'type':Sequelize[_0x87c5('0x2')]('string',_0x87c5('0x4'),_0x87c5('0x5'))},'keyContent':{'type':Sequelize[_0x87c5('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x87c5('0x8')]},'customField':{'type':Sequelize[_0x87c5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x87c5('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index e9ea30b..b09113c 100644 --- a/server/api/intDeskField/intDeskField.controller.js +++ b/server/api/intDeskField/intDeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x048f=['where','merge','filter','DeskField','includeAll','include','findAll','show','params','keys','fields','length','options','catch','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','nolimit','order','sort'];(function(_0x5120cf,_0x5ec0f1){var _0x540f5d=function(_0x2f0cba){while(--_0x2f0cba){_0x5120cf['push'](_0x5120cf['shift']());}};_0x540f5d(++_0x5ec0f1);}(_0x048f,0x1c7));var _0xf048=function(_0x3b64ff,_0x4d8029){_0x3b64ff=_0x3b64ff-0x0;var _0x4bfd46=_0x048f[_0x3b64ff];return _0x4bfd46;};'use strict';var emlformat=require(_0xf048('0x0'));var rimraf=require(_0xf048('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf048('0x2'));var rp=require('request-promise');var moment=require(_0xf048('0x3'));var BPromise=require(_0xf048('0x4'));var Mustache=require('mustache');var util=require(_0xf048('0x5'));var path=require('path');var sox=require(_0xf048('0x6'));var csv=require(_0xf048('0x7'));var ejs=require(_0xf048('0x8'));var fs=require('fs');var fs_extra=require(_0xf048('0x9'));var _=require(_0xf048('0xa'));var squel=require(_0xf048('0xb'));var crypto=require(_0xf048('0xc'));var jsforce=require(_0xf048('0xd'));var deskjs=require(_0xf048('0xe'));var toCsv=require(_0xf048('0x7'));var querystring=require(_0xf048('0xf'));var Papa=require(_0xf048('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf048('0x11'));var hardwareService=require(_0xf048('0x12'));var logger=require('../../config/logger')(_0xf048('0x13'));var utils=require(_0xf048('0x14'));var config=require(_0xf048('0x15'));var licenseUtil=require(_0xf048('0x16'));var db=require(_0xf048('0x17'))['db'];function respondWithStatusCode(_0x289be7,_0x2ae934){_0x2ae934=_0x2ae934||0xcc;return function(_0x2831cb){if(_0x2831cb){return _0x289be7['sendStatus'](_0x2ae934);}return _0x289be7['status'](_0x2ae934)[_0xf048('0x18')]();};}function respondWithResult(_0x873054,_0x1ec1f3){_0x1ec1f3=_0x1ec1f3||0xc8;return function(_0x34dfe3){if(_0x34dfe3){return _0x873054[_0xf048('0x19')](_0x1ec1f3)[_0xf048('0x1a')](_0x34dfe3);}};}function respondWithFilteredResult(_0x2524b6,_0x9798dc){return function(_0x450073){if(_0x450073){var _0x5b3ac3=typeof _0x9798dc['offset']===_0xf048('0x1b')&&typeof _0x9798dc[_0xf048('0x1c')]===_0xf048('0x1b');var _0xb28e08=_0x450073[_0xf048('0x1d')];var _0x2c15f6=_0x5b3ac3?0x0:_0x9798dc[_0xf048('0x1e')];var _0x425380=_0x5b3ac3?_0x450073[_0xf048('0x1d')]:_0x9798dc[_0xf048('0x1e')]+_0x9798dc[_0xf048('0x1c')];var _0x49a4b3;if(_0x425380>=_0xb28e08){_0x425380=_0xb28e08;_0x49a4b3=0xc8;}else{_0x49a4b3=0xce;}_0x2524b6['status'](_0x49a4b3);return _0x2524b6[_0xf048('0x1f')](_0xf048('0x20'),_0x2c15f6+'-'+_0x425380+'/'+_0xb28e08)[_0xf048('0x1a')](_0x450073);}return null;};}function patchUpdates(_0x59d61c){return function(_0x4e5ee6){try{jsonpatch[_0xf048('0x21')](_0x4e5ee6,_0x59d61c,!![]);}catch(_0x381f65){return BPromise[_0xf048('0x22')](_0x381f65);}return _0x4e5ee6['save']();};}function saveUpdates(_0x4a70e5,_0x3c2b0b){return function(_0x42b107){if(_0x42b107){return _0x42b107[_0xf048('0x23')](_0x4a70e5)[_0xf048('0x24')](function(_0x38e72c){return _0x38e72c;});}return null;};}function removeEntity(_0x3ddec3,_0x25c962){return function(_0x5b20bc){if(_0x5b20bc){return _0x5b20bc['destroy']()[_0xf048('0x24')](function(){_0x3ddec3['status'](0xcc)[_0xf048('0x18')]();});}};}function handleEntityNotFound(_0x74e68c,_0x2a351b){return function(_0x5e0661){if(!_0x5e0661){_0x74e68c[_0xf048('0x25')](0x194);}return _0x5e0661;};}function handleError(_0x513a38,_0x4eae99){_0x4eae99=_0x4eae99||0x1f4;return function(_0x3748da){logger[_0xf048('0x26')](_0x3748da[_0xf048('0x27')]);if(_0x3748da[_0xf048('0x28')]){delete _0x3748da[_0xf048('0x28')];}_0x513a38[_0xf048('0x19')](_0x4eae99)[_0xf048('0x29')](_0x3748da);};}exports[_0xf048('0x2a')]=function(_0x304f6b,_0x4a0a30){var _0x15d1ce={},_0x35d9db={},_0x35d1c6={'count':0x0,'rows':[]};var _0x209758=_[_0xf048('0x2b')](db['DeskField'][_0xf048('0x2c')],function(_0x1338e8){return{'name':_0x1338e8[_0xf048('0x2d')],'type':_0x1338e8[_0xf048('0x2e')][_0xf048('0x2f')]};});_0x35d9db[_0xf048('0x30')]=_[_0xf048('0x2b')](_0x209758,'name');_0x35d9db[_0xf048('0x31')]=_['keys'](_0x304f6b[_0xf048('0x31')]);_0x35d9db[_0xf048('0x32')]=_[_0xf048('0x33')](_0x35d9db['model'],_0x35d9db['query']);_0x15d1ce['attributes']=_[_0xf048('0x33')](_0x35d9db[_0xf048('0x30')],qs['fields'](_0x304f6b[_0xf048('0x31')]['fields']));_0x15d1ce[_0xf048('0x34')]=_0x15d1ce['attributes']['length']?_0x15d1ce[_0xf048('0x34')]:_0x35d9db[_0xf048('0x30')];if(!_0x304f6b[_0xf048('0x31')]['hasOwnProperty'](_0xf048('0x35'))){_0x15d1ce[_0xf048('0x1c')]=qs['limit'](_0x304f6b[_0xf048('0x31')][_0xf048('0x1c')]);_0x15d1ce[_0xf048('0x1e')]=qs[_0xf048('0x1e')](_0x304f6b['query'][_0xf048('0x1e')]);}_0x15d1ce[_0xf048('0x36')]=qs[_0xf048('0x37')](_0x304f6b[_0xf048('0x31')][_0xf048('0x37')]);_0x15d1ce[_0xf048('0x38')]=qs[_0xf048('0x32')](_['pick'](_0x304f6b[_0xf048('0x31')],_0x35d9db['filters']),_0x209758);if(_0x304f6b[_0xf048('0x31')]['filter']){_0x15d1ce[_0xf048('0x38')]=_[_0xf048('0x39')](_0x15d1ce[_0xf048('0x38')],{'$or':_[_0xf048('0x2b')](_0x209758,function(_0x392f79){if(_0x392f79[_0xf048('0x2e')]!=='VIRTUAL'){var _0x5a117e={};_0x5a117e[_0x392f79[_0xf048('0x28')]]={'$like':'%'+_0x304f6b[_0xf048('0x31')][_0xf048('0x3a')]+'%'};return _0x5a117e;}})});}_0x15d1ce=_[_0xf048('0x39')]({},_0x15d1ce,_0x304f6b['options']);var _0x157af6={'where':_0x15d1ce[_0xf048('0x38')]};return db[_0xf048('0x3b')][_0xf048('0x1d')](_0x157af6)[_0xf048('0x24')](function(_0x397cb0){_0x35d1c6[_0xf048('0x1d')]=_0x397cb0;if(_0x304f6b[_0xf048('0x31')][_0xf048('0x3c')]){_0x15d1ce[_0xf048('0x3d')]=[{'all':!![]}];}return db[_0xf048('0x3b')][_0xf048('0x3e')](_0x15d1ce);})[_0xf048('0x24')](function(_0x91abc5){_0x35d1c6['rows']=_0x91abc5;return _0x35d1c6;})['then'](respondWithFilteredResult(_0x4a0a30,_0x15d1ce))['catch'](handleError(_0x4a0a30,null));};exports[_0xf048('0x3f')]=function(_0x39ab82,_0x5c111c){var _0x531e00={'raw':!![],'where':{'id':_0x39ab82[_0xf048('0x40')]['id']}},_0x35fe67={};_0x35fe67['model']=_[_0xf048('0x41')](db[_0xf048('0x3b')][_0xf048('0x2c')]);_0x35fe67[_0xf048('0x31')]=_['keys'](_0x39ab82[_0xf048('0x31')]);_0x35fe67[_0xf048('0x32')]=_['intersection'](_0x35fe67[_0xf048('0x30')],_0x35fe67['query']);_0x531e00['attributes']=_[_0xf048('0x33')](_0x35fe67['model'],qs[_0xf048('0x42')](_0x39ab82['query'][_0xf048('0x42')]));_0x531e00[_0xf048('0x34')]=_0x531e00[_0xf048('0x34')][_0xf048('0x43')]?_0x531e00[_0xf048('0x34')]:_0x35fe67[_0xf048('0x30')];if(_0x39ab82[_0xf048('0x31')]['includeAll']){_0x531e00[_0xf048('0x3d')]=[{'all':!![]}];}_0x531e00=_[_0xf048('0x39')]({},_0x531e00,_0x39ab82[_0xf048('0x44')]);return db[_0xf048('0x3b')]['find'](_0x531e00)['then'](handleEntityNotFound(_0x5c111c,null))[_0xf048('0x24')](respondWithResult(_0x5c111c,null))[_0xf048('0x45')](handleError(_0x5c111c,null));};exports[_0xf048('0x46')]=function(_0x43ae05,_0x816e00){return db['DeskField'][_0xf048('0x46')](_0x43ae05[_0xf048('0x47')],{})[_0xf048('0x24')](respondWithResult(_0x816e00,0xc9))[_0xf048('0x45')](handleError(_0x816e00,null));};exports[_0xf048('0x23')]=function(_0x456f05,_0x2c2f1d){if(_0x456f05['body']['id']){delete _0x456f05[_0xf048('0x47')]['id'];}return db[_0xf048('0x3b')][_0xf048('0x48')]({'where':{'id':_0x456f05[_0xf048('0x40')]['id']}})[_0xf048('0x24')](handleEntityNotFound(_0x2c2f1d,null))[_0xf048('0x24')](saveUpdates(_0x456f05['body'],null))['then'](respondWithResult(_0x2c2f1d,null))[_0xf048('0x45')](handleError(_0x2c2f1d,null));};exports['destroy']=function(_0x3fcb1e,_0x1a947a){return db['DeskField'][_0xf048('0x48')]({'where':{'id':_0x3fcb1e[_0xf048('0x40')]['id']}})[_0xf048('0x24')](handleEntityNotFound(_0x1a947a,null))[_0xf048('0x24')](removeEntity(_0x1a947a,null))[_0xf048('0x45')](handleError(_0x1a947a,null));}; \ No newline at end of file +var _0x81f8=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','name','send','index','map','DeskField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81f8,0x186));var _0x881f=function(_0x34c2c9,_0x3094aa){_0x34c2c9=_0x34c2c9-0x0;var _0x2f7488=_0x81f8[_0x34c2c9];return _0x2f7488;};'use strict';var emlformat=require(_0x881f('0x0'));var rimraf=require(_0x881f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x881f('0x2'));var rp=require(_0x881f('0x3'));var moment=require(_0x881f('0x4'));var BPromise=require(_0x881f('0x5'));var Mustache=require(_0x881f('0x6'));var util=require('util');var path=require(_0x881f('0x7'));var sox=require(_0x881f('0x8'));var csv=require(_0x881f('0x9'));var ejs=require(_0x881f('0xa'));var fs=require('fs');var fs_extra=require(_0x881f('0xb'));var _=require(_0x881f('0xc'));var squel=require(_0x881f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x881f('0xe'));var toCsv=require(_0x881f('0x9'));var querystring=require('querystring');var Papa=require(_0x881f('0xf'));var Redis=require(_0x881f('0x10'));var authService=require(_0x881f('0x11'));var qs=require(_0x881f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x881f('0x13'))(_0x881f('0x14'));var utils=require(_0x881f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x881f('0x16'))['db'];function respondWithStatusCode(_0x422ee5,_0x5ca80e){_0x5ca80e=_0x5ca80e||0xcc;return function(_0x5184bc){if(_0x5184bc){return _0x422ee5[_0x881f('0x17')](_0x5ca80e);}return _0x422ee5[_0x881f('0x18')](_0x5ca80e)[_0x881f('0x19')]();};}function respondWithResult(_0x52c140,_0x20036f){_0x20036f=_0x20036f||0xc8;return function(_0x1f51aa){if(_0x1f51aa){return _0x52c140['status'](_0x20036f)[_0x881f('0x1a')](_0x1f51aa);}};}function respondWithFilteredResult(_0x3d9e50,_0x4b7378){return function(_0x301d66){if(_0x301d66){var _0x167107=typeof _0x4b7378[_0x881f('0x1b')]===_0x881f('0x1c')&&typeof _0x4b7378[_0x881f('0x1d')]===_0x881f('0x1c');var _0x5e897f=_0x301d66[_0x881f('0x1e')];var _0x4f0540=_0x167107?0x0:_0x4b7378['offset'];var _0x1ed77=_0x167107?_0x301d66[_0x881f('0x1e')]:_0x4b7378[_0x881f('0x1b')]+_0x4b7378['limit'];var _0x49c605;if(_0x1ed77>=_0x5e897f){_0x1ed77=_0x5e897f;_0x49c605=0xc8;}else{_0x49c605=0xce;}_0x3d9e50[_0x881f('0x18')](_0x49c605);return _0x3d9e50['set'](_0x881f('0x1f'),_0x4f0540+'-'+_0x1ed77+'/'+_0x5e897f)[_0x881f('0x1a')](_0x301d66);}return null;};}function patchUpdates(_0x2f66d8){return function(_0x537c77){try{jsonpatch['apply'](_0x537c77,_0x2f66d8,!![]);}catch(_0x38f7a7){return BPromise[_0x881f('0x20')](_0x38f7a7);}return _0x537c77[_0x881f('0x21')]();};}function saveUpdates(_0x3fbbd1,_0x4f43ee){return function(_0x1b434d){if(_0x1b434d){return _0x1b434d[_0x881f('0x22')](_0x3fbbd1)[_0x881f('0x23')](function(_0x59c60e){return _0x59c60e;});}return null;};}function removeEntity(_0x16392b,_0x51bbb2){return function(_0x30d73b){if(_0x30d73b){return _0x30d73b['destroy']()[_0x881f('0x23')](function(){_0x16392b[_0x881f('0x18')](0xcc)[_0x881f('0x19')]();});}};}function handleEntityNotFound(_0x341e3c,_0x5f39cc){return function(_0x666de5){if(!_0x666de5){_0x341e3c[_0x881f('0x17')](0x194);}return _0x666de5;};}function handleError(_0x6f6a7e,_0xdcb6b7){_0xdcb6b7=_0xdcb6b7||0x1f4;return function(_0x393433){logger[_0x881f('0x24')](_0x393433['stack']);if(_0x393433[_0x881f('0x25')]){delete _0x393433[_0x881f('0x25')];}_0x6f6a7e[_0x881f('0x18')](_0xdcb6b7)[_0x881f('0x26')](_0x393433);};}exports[_0x881f('0x27')]=function(_0x518ddb,_0x56cc05){var _0x40d75b={},_0x11f353={},_0x2a5c8f={'count':0x0,'rows':[]};var _0x51f20f=_[_0x881f('0x28')](db[_0x881f('0x29')][_0x881f('0x2a')],function(_0x42ba3b){return{'name':_0x42ba3b[_0x881f('0x2b')],'type':_0x42ba3b[_0x881f('0x2c')][_0x881f('0x2d')]};});_0x11f353[_0x881f('0x2e')]=_[_0x881f('0x28')](_0x51f20f,_0x881f('0x25'));_0x11f353[_0x881f('0x2f')]=_[_0x881f('0x30')](_0x518ddb[_0x881f('0x2f')]);_0x11f353['filters']=_[_0x881f('0x31')](_0x11f353[_0x881f('0x2e')],_0x11f353[_0x881f('0x2f')]);_0x40d75b['attributes']=_[_0x881f('0x31')](_0x11f353[_0x881f('0x2e')],qs['fields'](_0x518ddb[_0x881f('0x2f')][_0x881f('0x32')]));_0x40d75b[_0x881f('0x33')]=_0x40d75b[_0x881f('0x33')][_0x881f('0x34')]?_0x40d75b[_0x881f('0x33')]:_0x11f353[_0x881f('0x2e')];if(!_0x518ddb[_0x881f('0x2f')][_0x881f('0x35')](_0x881f('0x36'))){_0x40d75b[_0x881f('0x1d')]=qs['limit'](_0x518ddb[_0x881f('0x2f')][_0x881f('0x1d')]);_0x40d75b['offset']=qs[_0x881f('0x1b')](_0x518ddb[_0x881f('0x2f')][_0x881f('0x1b')]);}_0x40d75b[_0x881f('0x37')]=qs[_0x881f('0x38')](_0x518ddb['query']['sort']);_0x40d75b[_0x881f('0x39')]=qs[_0x881f('0x3a')](_['pick'](_0x518ddb[_0x881f('0x2f')],_0x11f353['filters']),_0x51f20f);if(_0x518ddb[_0x881f('0x2f')][_0x881f('0x3b')]){_0x40d75b[_0x881f('0x39')]=_[_0x881f('0x3c')](_0x40d75b[_0x881f('0x39')],{'$or':_[_0x881f('0x28')](_0x51f20f,function(_0x5bab6b){if(_0x5bab6b[_0x881f('0x2c')]!==_0x881f('0x3d')){var _0x202e93={};_0x202e93[_0x5bab6b['name']]={'$like':'%'+_0x518ddb[_0x881f('0x2f')][_0x881f('0x3b')]+'%'};return _0x202e93;}})});}_0x40d75b=_[_0x881f('0x3c')]({},_0x40d75b,_0x518ddb['options']);var _0x47ff69={'where':_0x40d75b[_0x881f('0x39')]};return db[_0x881f('0x29')][_0x881f('0x1e')](_0x47ff69)[_0x881f('0x23')](function(_0x1557f2){_0x2a5c8f[_0x881f('0x1e')]=_0x1557f2;if(_0x518ddb['query']['includeAll']){_0x40d75b[_0x881f('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x881f('0x3f')](_0x40d75b);})['then'](function(_0x430a5e){_0x2a5c8f[_0x881f('0x40')]=_0x430a5e;return _0x2a5c8f;})[_0x881f('0x23')](respondWithFilteredResult(_0x56cc05,_0x40d75b))[_0x881f('0x41')](handleError(_0x56cc05,null));};exports['show']=function(_0x29369b,_0x506939){var _0x5a6aa8={'raw':!![],'where':{'id':_0x29369b[_0x881f('0x42')]['id']}},_0x2aa0aa={};_0x2aa0aa['model']=_[_0x881f('0x30')](db[_0x881f('0x29')][_0x881f('0x2a')]);_0x2aa0aa[_0x881f('0x2f')]=_[_0x881f('0x30')](_0x29369b['query']);_0x2aa0aa['filters']=_['intersection'](_0x2aa0aa[_0x881f('0x2e')],_0x2aa0aa[_0x881f('0x2f')]);_0x5a6aa8[_0x881f('0x33')]=_[_0x881f('0x31')](_0x2aa0aa[_0x881f('0x2e')],qs[_0x881f('0x32')](_0x29369b[_0x881f('0x2f')][_0x881f('0x32')]));_0x5a6aa8['attributes']=_0x5a6aa8[_0x881f('0x33')][_0x881f('0x34')]?_0x5a6aa8['attributes']:_0x2aa0aa[_0x881f('0x2e')];if(_0x29369b[_0x881f('0x2f')]['includeAll']){_0x5a6aa8['include']=[{'all':!![]}];}_0x5a6aa8=_[_0x881f('0x3c')]({},_0x5a6aa8,_0x29369b[_0x881f('0x43')]);return db['DeskField'][_0x881f('0x44')](_0x5a6aa8)['then'](handleEntityNotFound(_0x506939,null))['then'](respondWithResult(_0x506939,null))['catch'](handleError(_0x506939,null));};exports[_0x881f('0x45')]=function(_0x4db36c,_0xa3a79e){return db[_0x881f('0x29')][_0x881f('0x45')](_0x4db36c[_0x881f('0x46')],{})[_0x881f('0x23')](respondWithResult(_0xa3a79e,0xc9))[_0x881f('0x41')](handleError(_0xa3a79e,null));};exports[_0x881f('0x22')]=function(_0x3d7229,_0x13bee8){if(_0x3d7229[_0x881f('0x46')]['id']){delete _0x3d7229[_0x881f('0x46')]['id'];}return db[_0x881f('0x29')][_0x881f('0x44')]({'where':{'id':_0x3d7229[_0x881f('0x42')]['id']}})[_0x881f('0x23')](handleEntityNotFound(_0x13bee8,null))['then'](saveUpdates(_0x3d7229[_0x881f('0x46')],null))[_0x881f('0x23')](respondWithResult(_0x13bee8,null))['catch'](handleError(_0x13bee8,null));};exports[_0x881f('0x47')]=function(_0x3e051c,_0x424104){return db[_0x881f('0x29')][_0x881f('0x44')]({'where':{'id':_0x3e051c[_0x881f('0x42')]['id']}})[_0x881f('0x23')](handleEntityNotFound(_0x424104,null))[_0x881f('0x23')](removeEntity(_0x424104,null))[_0x881f('0x41')](handleError(_0x424104,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index da1f41b..d628d5a 100644 --- a/server/api/intDeskField/intDeskField.model.js +++ b/server/api/intDeskField/intDeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58b1=['DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','rimraf','./intDeskField.attributes','exports','define'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x58b1,0xd7));var _0x158b=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x58b1[_0x33c9f8];return _0x2d7004;};'use strict';var _=require(_0x158b('0x0'));var util=require('util');var logger=require(_0x158b('0x1'))(_0x158b('0x2'));var moment=require(_0x158b('0x3'));var BPromise=require('bluebird');var rp=require(_0x158b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x158b('0x5'));var config=require('../../config/environment');var attributes=require(_0x158b('0x6'));module[_0x158b('0x7')]=function(_0x27474c,_0x1062c5){return _0x27474c[_0x158b('0x8')](_0x158b('0x9'),attributes,{'tableName':_0x158b('0xa'),'paranoid':![],'indexes':[{'name':_0x158b('0xb'),'fields':[_0x158b('0xc'),_0x158b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x569e=['exports','define','int_desk_fields','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskField.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x569e,0x121));var _0xe569=function(_0x2c6484,_0x4fe72c){_0x2c6484=_0x2c6484-0x0;var _0x3b9d94=_0x569e[_0x2c6484];return _0x3b9d94;};'use strict';var _=require('lodash');var util=require(_0xe569('0x0'));var logger=require(_0xe569('0x1'))(_0xe569('0x2'));var moment=require('moment');var BPromise=require(_0xe569('0x3'));var rp=require(_0xe569('0x4'));var fs=require('fs');var path=require(_0xe569('0x5'));var rimraf=require(_0xe569('0x6'));var config=require('../../config/environment');var attributes=require(_0xe569('0x7'));module[_0xe569('0x8')]=function(_0x3ef226,_0x559532){return _0x3ef226[_0xe569('0x9')]('DeskField',attributes,{'tableName':_0xe569('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index f04cf75..034067e 100644 --- a/server/api/intDeskField/intDeskField.rpc.js +++ b/server/api/intDeskField/intDeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a9e=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x31c579,_0x536d53){var _0x58d74d=function(_0xe36c21){while(--_0xe36c21){_0x31c579['push'](_0x31c579['shift']());}};_0x58d74d(++_0x536d53);}(_0x7a9e,0x197));var _0xe7a9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7a9e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe7a9('0x0'));var util=require(_0xe7a9('0x1'));var moment=require(_0xe7a9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7a9('0x3'));var fs=require('fs');var Redis=require(_0xe7a9('0x4'));var db=require(_0xe7a9('0x5'))['db'];var utils=require(_0xe7a9('0x6'));var logger=require(_0xe7a9('0x7'))('rpc');var config=require(_0xe7a9('0x8'));var jayson=require(_0xe7a9('0x9'));var client=jayson[_0xe7a9('0xa')][_0xe7a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37eec3,_0x2055e4,_0x482816){return new BPromise(function(_0x55e59e,_0x31f171){return client['request'](_0x37eec3,_0x482816)[_0xe7a9('0xc')](function(_0x193e89){logger[_0xe7a9('0xd')]('DeskField,\x20%s,\x20%s',_0x2055e4,'request\x20sent');logger[_0xe7a9('0xe')](_0xe7a9('0xf'),_0x2055e4,'request\x20sent',JSON['stringify'](_0x193e89));if(_0x193e89[_0xe7a9('0x10')]){if(_0x193e89['error'][_0xe7a9('0x11')]===0x1f4){logger[_0xe7a9('0x10')](_0xe7a9('0x12'),_0x2055e4,_0x193e89[_0xe7a9('0x10')][_0xe7a9('0x13')]);return _0x31f171(_0x193e89[_0xe7a9('0x10')]['message']);}logger[_0xe7a9('0x10')](_0xe7a9('0x12'),_0x2055e4,_0x193e89[_0xe7a9('0x10')]['message']);return _0x55e59e(_0x193e89[_0xe7a9('0x10')][_0xe7a9('0x13')]);}else{logger[_0xe7a9('0xd')]('DeskField,\x20%s,\x20%s',_0x2055e4,_0xe7a9('0x14'));_0x55e59e(_0x193e89[_0xe7a9('0x15')]['message']);}})[_0xe7a9('0x16')](function(_0x3d26ab){logger[_0xe7a9('0x10')]('DeskField,\x20%s,\x20%s',_0x2055e4,_0x3d26ab);_0x31f171(_0x3d26ab);});});} \ No newline at end of file +var _0x752a=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x752a,0x176));var _0xa752=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x752a[_0x5ce3c8];return _0xa76867;};'use strict';var _=require(_0xa752('0x0'));var util=require(_0xa752('0x1'));var moment=require(_0xa752('0x2'));var BPromise=require('bluebird');var rs=require(_0xa752('0x3'));var fs=require('fs');var Redis=require(_0xa752('0x4'));var db=require(_0xa752('0x5'))['db'];var utils=require(_0xa752('0x6'));var logger=require(_0xa752('0x7'))(_0xa752('0x8'));var config=require('../../config/environment');var jayson=require(_0xa752('0x9'));var client=jayson['client'][_0xa752('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ebd75,_0x56255e,_0x4367aa){return new BPromise(function(_0x503c04,_0x19c589){return client[_0xa752('0xb')](_0x4ebd75,_0x4367aa)[_0xa752('0xc')](function(_0x4f3dc6){logger[_0xa752('0xd')](_0xa752('0xe'),_0x56255e,_0xa752('0xf'));logger[_0xa752('0x10')](_0xa752('0x11'),_0x56255e,_0xa752('0xf'),JSON[_0xa752('0x12')](_0x4f3dc6));if(_0x4f3dc6['error']){if(_0x4f3dc6[_0xa752('0x13')][_0xa752('0x14')]===0x1f4){logger['error'](_0xa752('0xe'),_0x56255e,_0x4f3dc6[_0xa752('0x13')]['message']);return _0x19c589(_0x4f3dc6[_0xa752('0x13')]['message']);}logger['error'](_0xa752('0xe'),_0x56255e,_0x4f3dc6[_0xa752('0x13')]['message']);return _0x503c04(_0x4f3dc6['error'][_0xa752('0x15')]);}else{logger[_0xa752('0xd')](_0xa752('0xe'),_0x56255e,_0xa752('0xf'));_0x503c04(_0x4f3dc6[_0xa752('0x16')][_0xa752('0x15')]);}})[_0xa752('0x17')](function(_0x5105ad){logger[_0xa752('0x13')]('DeskField,\x20%s,\x20%s',_0x56255e,_0x5105ad);_0x19c589(_0x5105ad);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ad486d9..cf38520 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe0f=['index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x4a28c3,_0x1ea497){var _0x43b4a0=function(_0x4e8944){while(--_0x4e8944){_0x4a28c3['push'](_0x4a28c3['shift']());}};_0x43b4a0(++_0x1ea497);}(_0xbe0f,0xf3));var _0xfbe0=function(_0x33e776,_0x90f1fd){_0x33e776=_0x33e776-0x0;var _0xc32c2a=_0xbe0f[_0x33e776];return _0xc32c2a;};'use strict';var multer=require(_0xfbe0('0x0'));var util=require(_0xfbe0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfbe0('0x2'));var router=express['Router']();var fs_extra=require(_0xfbe0('0x3'));var auth=require(_0xfbe0('0x4'));var interaction=require(_0xfbe0('0x5'));var config=require(_0xfbe0('0x6'));var controller=require(_0xfbe0('0x7'));router[_0xfbe0('0x8')]('/',auth[_0xfbe0('0x9')](),controller[_0xfbe0('0xa')]);router['get'](_0xfbe0('0xb'),auth[_0xfbe0('0x9')](),controller['show']);router[_0xfbe0('0x8')](_0xfbe0('0xc'),auth[_0xfbe0('0x9')](),controller[_0xfbe0('0xd')]);router['get'](_0xfbe0('0xe'),auth[_0xfbe0('0x9')](),controller[_0xfbe0('0xf')]);router[_0xfbe0('0x10')]('/',auth[_0xfbe0('0x9')](),controller[_0xfbe0('0x11')]);router[_0xfbe0('0x10')](_0xfbe0('0xc'),auth['isAuthenticated'](),controller[_0xfbe0('0x12')]);router[_0xfbe0('0x13')](_0xfbe0('0xb'),auth[_0xfbe0('0x9')](),controller[_0xfbe0('0x14')]);router['delete'](_0xfbe0('0xb'),auth[_0xfbe0('0x9')](),controller[_0xfbe0('0x15')]);module[_0xfbe0('0x16')]=router; \ No newline at end of file +var _0x59f1=['index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x1a3835,_0x2eb9a0){var _0x49096f=function(_0x1dca72){while(--_0x1dca72){_0x1a3835['push'](_0x1a3835['shift']());}};_0x49096f(++_0x2eb9a0);}(_0x59f1,0x11c));var _0x159f=function(_0x2edfd2,_0x59afb3){_0x2edfd2=_0x2edfd2-0x0;var _0x3f53bd=_0x59f1[_0x2edfd2];return _0x3f53bd;};'use strict';var multer=require('multer');var util=require(_0x159f('0x0'));var path=require('path');var timeout=require(_0x159f('0x1'));var express=require(_0x159f('0x2'));var router=express[_0x159f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x159f('0x4'));var interaction=require(_0x159f('0x5'));var config=require(_0x159f('0x6'));var controller=require(_0x159f('0x7'));router[_0x159f('0x8')]('/',auth[_0x159f('0x9')](),controller[_0x159f('0xa')]);router['get'](_0x159f('0xb'),auth[_0x159f('0x9')](),controller[_0x159f('0xc')]);router[_0x159f('0x8')](_0x159f('0xd'),auth[_0x159f('0x9')](),controller['getConfigurations']);router[_0x159f('0x8')](_0x159f('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x159f('0xf')]('/',auth[_0x159f('0x9')](),controller[_0x159f('0x10')]);router[_0x159f('0xf')](_0x159f('0xd'),auth[_0x159f('0x9')](),controller[_0x159f('0x11')]);router[_0x159f('0x12')](_0x159f('0xb'),auth[_0x159f('0x9')](),controller[_0x159f('0x13')]);router['delete']('/:id',auth[_0x159f('0x9')](),controller[_0x159f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c08da9a..8a341c1 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcf6=['exports','STRING'];(function(_0x393b28,_0x234b68){var _0xfb4101=function(_0x5db61a){while(--_0x5db61a){_0x393b28['push'](_0x393b28['shift']());}};_0xfb4101(++_0x234b68);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x915a15,_0x31b9d2){_0x915a15=_0x915a15-0x0;var _0x24f642=_0xdcf6[_0x915a15];return _0x24f642;};'use strict';var Sequelize=require('sequelize');module[_0x6dcf('0x0')]={'name':{'type':Sequelize[_0x6dcf('0x1')]},'username':{'type':Sequelize[_0x6dcf('0x1')]},'password':{'type':Sequelize[_0x6dcf('0x1')]},'remoteUri':{'type':Sequelize[_0x6dcf('0x1')]},'tenantId':{'type':Sequelize[_0x6dcf('0x1')]},'clientId':{'type':Sequelize[_0x6dcf('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6dcf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6dcf('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x1419=['exports','STRING','BOOLEAN','sequelize'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0x1419,0x127));var _0x9141=function(_0x96475e,_0x3cb58a){_0x96475e=_0x96475e-0x0;var _0x168f52=_0x1419[_0x96475e];return _0x168f52;};'use strict';var Sequelize=require(_0x9141('0x0'));module[_0x9141('0x1')]={'name':{'type':Sequelize[_0x9141('0x2')]},'username':{'type':Sequelize[_0x9141('0x2')]},'password':{'type':Sequelize[_0x9141('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9141('0x2')]},'clientSecret':{'type':Sequelize[_0x9141('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x9141('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 69fab33..e0d32a2 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bd6=['accountidyominame','actualserviceunits','billedserviceunits','contactidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','Attributes','includes','forEach','substring','@odata.type','all','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','destroy','then','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','length','include','find','create','update','body','params','getConfigurations','findOne','Dynamics365Configuration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','PhoneCall','description','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname'];(function(_0x272b56,_0x4ea571){var _0x59df36=function(_0x1a4084){while(--_0x1a4084){_0x272b56['push'](_0x272b56['shift']());}};_0x59df36(++_0x4ea571);}(_0x8bd6,0x1e0));var _0x68bd=function(_0x5b3fed,_0x5b3bf2){_0x5b3fed=_0x5b3fed-0x0;var _0x1e9282=_0x8bd6[_0x5b3fed];return _0x1e9282;};'use strict';var rp=require(_0x68bd('0x0'));var util=require('util');var _=require(_0x68bd('0x1'));var qs=require(_0x68bd('0x2'));var logger=require(_0x68bd('0x3'))(_0x68bd('0x4'));var db=require(_0x68bd('0x5'))['db'];var integrations=require(_0x68bd('0x6'));function respondWithResult(_0x386818,_0x165c77){_0x165c77=_0x165c77||0xc8;return function(_0x1f8c8a){if(_0x1f8c8a){return _0x386818[_0x68bd('0x7')](_0x165c77)[_0x68bd('0x8')](_0x1f8c8a);}};}function respondWithFilteredResult(_0x1aab79,_0x61bdd1){return function(_0xb9e030){if(_0xb9e030){var _0x4b3273=typeof _0x61bdd1[_0x68bd('0x9')]==='undefined'&&typeof _0x61bdd1[_0x68bd('0xa')]===_0x68bd('0xb');var _0x28da98=_0xb9e030[_0x68bd('0xc')];var _0x4c13dd=_0x4b3273?0x0:_0x61bdd1[_0x68bd('0x9')];var _0x292b13=_0x4b3273?_0xb9e030['count']:_0x61bdd1['offset']+_0x61bdd1[_0x68bd('0xa')];var _0x54f909;if(_0x292b13>=_0x28da98){_0x292b13=_0x28da98;_0x54f909=0xc8;}else{_0x54f909=0xce;}_0x1aab79['status'](_0x54f909);return _0x1aab79[_0x68bd('0xd')](_0x68bd('0xe'),_0x4c13dd+'-'+_0x292b13+'/'+_0x28da98)[_0x68bd('0x8')](_0xb9e030);}return null;};}function saveUpdates(_0x5e79fe){return function(_0x1fc515){if(_0x1fc515){return _0x1fc515['update'](_0x5e79fe)['then'](function(_0x1446d7){return _0x1446d7;});}return null;};}function removeEntity(_0x3becf7){return function(_0x25b939){if(_0x25b939){return _0x25b939[_0x68bd('0xf')]()[_0x68bd('0x10')](function(){_0x3becf7[_0x68bd('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e865){return function(_0x4d5008){if(!_0x4d5008){_0x15e865[_0x68bd('0x11')](0x194);}return _0x4d5008;};}function handleError(_0x16439a,_0x17db38){_0x17db38=_0x17db38||0x1f4;return function(_0x7b845e){logger[_0x68bd('0x12')](_0x7b845e[_0x68bd('0x13')]);if(_0x7b845e[_0x68bd('0x14')]){delete _0x7b845e[_0x68bd('0x14')];}_0x16439a[_0x68bd('0x7')](_0x17db38)[_0x68bd('0x15')](_0x7b845e);};}exports[_0x68bd('0x16')]=function(_0x2c07c5,_0x4b8060){var _0x3291a8={},_0x41d3ec={},_0x3ed047={'count':0x0,'rows':[]};var _0x3b718c=_[_0x68bd('0x17')](db[_0x68bd('0x18')]['rawAttributes'],function(_0x27f717){return{'name':_0x27f717[_0x68bd('0x19')],'type':_0x27f717[_0x68bd('0x1a')][_0x68bd('0x1b')]};});_0x41d3ec[_0x68bd('0x1c')]=_[_0x68bd('0x17')](_0x3b718c,_0x68bd('0x14'));_0x41d3ec[_0x68bd('0x1d')]=_['keys'](_0x2c07c5[_0x68bd('0x1d')]);_0x41d3ec[_0x68bd('0x1e')]=_['intersection'](_0x41d3ec[_0x68bd('0x1c')],_0x41d3ec[_0x68bd('0x1d')]);_0x3291a8[_0x68bd('0x1f')]=_[_0x68bd('0x20')](_0x41d3ec[_0x68bd('0x1c')],qs[_0x68bd('0x21')](_0x2c07c5[_0x68bd('0x1d')][_0x68bd('0x21')]));_0x3291a8[_0x68bd('0x1f')]=_0x3291a8[_0x68bd('0x1f')]['length']?_0x3291a8[_0x68bd('0x1f')]:_0x41d3ec[_0x68bd('0x1c')];if(!_0x2c07c5[_0x68bd('0x1d')]['hasOwnProperty'](_0x68bd('0x22'))){_0x3291a8['limit']=qs[_0x68bd('0xa')](_0x2c07c5[_0x68bd('0x1d')][_0x68bd('0xa')]);_0x3291a8[_0x68bd('0x9')]=qs[_0x68bd('0x9')](_0x2c07c5[_0x68bd('0x1d')][_0x68bd('0x9')]);}_0x3291a8[_0x68bd('0x23')]=qs[_0x68bd('0x24')](_0x2c07c5['query']['sort']);_0x3291a8[_0x68bd('0x25')]=qs[_0x68bd('0x1e')](_[_0x68bd('0x26')](_0x2c07c5[_0x68bd('0x1d')],_0x41d3ec['filters']),_0x3b718c);if(_0x2c07c5[_0x68bd('0x1d')][_0x68bd('0x27')]){_0x3291a8[_0x68bd('0x25')]=_[_0x68bd('0x28')](_0x3291a8[_0x68bd('0x25')],{'$or':_[_0x68bd('0x17')](_0x3b718c,function(_0x951d68){if(_0x951d68[_0x68bd('0x1a')]!==_0x68bd('0x29')){var _0x49814c={};_0x49814c[_0x951d68[_0x68bd('0x14')]]={'$like':'%'+_0x2c07c5['query'][_0x68bd('0x27')]+'%'};return _0x49814c;}})});}_0x3291a8=_[_0x68bd('0x28')]({},_0x3291a8,_0x2c07c5[_0x68bd('0x2a')]);var _0x5aace9={'where':_0x3291a8['where']};return db[_0x68bd('0x18')]['count'](_0x5aace9)['then'](function(_0x19c9ee){_0x3ed047['count']=_0x19c9ee;if(_0x2c07c5[_0x68bd('0x1d')][_0x68bd('0x2b')]){_0x3291a8['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x68bd('0x2c')](_0x3291a8);})[_0x68bd('0x10')](function(_0x4fb65f){_0x3ed047[_0x68bd('0x2d')]=_0x4fb65f;return _0x3ed047;})[_0x68bd('0x10')](respondWithFilteredResult(_0x4b8060,_0x3291a8))[_0x68bd('0x2e')](handleError(_0x4b8060,null));};exports[_0x68bd('0x2f')]=function(_0x21023d,_0x1a1211){var _0x513930={'raw':![],'where':{'id':_0x21023d['params']['id']}},_0x40820d={};_0x40820d[_0x68bd('0x1c')]=_[_0x68bd('0x30')](db[_0x68bd('0x18')][_0x68bd('0x31')]);_0x40820d[_0x68bd('0x1d')]=_[_0x68bd('0x30')](_0x21023d['query']);_0x40820d[_0x68bd('0x1e')]=_[_0x68bd('0x20')](_0x40820d[_0x68bd('0x1c')],_0x40820d[_0x68bd('0x1d')]);_0x513930[_0x68bd('0x1f')]=_[_0x68bd('0x20')](_0x40820d[_0x68bd('0x1c')],qs[_0x68bd('0x21')](_0x21023d[_0x68bd('0x1d')]['fields']));_0x513930[_0x68bd('0x1f')]=_0x513930['attributes'][_0x68bd('0x32')]?_0x513930['attributes']:_0x40820d[_0x68bd('0x1c')];if(_0x21023d[_0x68bd('0x1d')][_0x68bd('0x2b')]){_0x513930[_0x68bd('0x33')]=[{'all':!![]}];}_0x513930=_[_0x68bd('0x28')]({},_0x513930,_0x21023d[_0x68bd('0x2a')]);return db[_0x68bd('0x18')][_0x68bd('0x34')](_0x513930)['then'](handleEntityNotFound(_0x1a1211,null))['then'](respondWithResult(_0x1a1211,null))['catch'](handleError(_0x1a1211,null));};exports[_0x68bd('0x35')]=function(_0x3c1fca,_0x464bba){return db[_0x68bd('0x18')][_0x68bd('0x35')](_0x3c1fca['body'],{})[_0x68bd('0x10')](respondWithResult(_0x464bba,0xc9))[_0x68bd('0x2e')](handleError(_0x464bba,null));};exports[_0x68bd('0x36')]=function(_0x3dc499,_0x2ca833){if(_0x3dc499['body']['id']){delete _0x3dc499[_0x68bd('0x37')]['id'];}return db['Dynamics365Account'][_0x68bd('0x34')]({'where':{'id':_0x3dc499[_0x68bd('0x38')]['id']}})[_0x68bd('0x10')](handleEntityNotFound(_0x2ca833,null))[_0x68bd('0x10')](saveUpdates(_0x3dc499[_0x68bd('0x37')],null))[_0x68bd('0x10')](respondWithResult(_0x2ca833,null))[_0x68bd('0x2e')](handleError(_0x2ca833,null));};exports['destroy']=function(_0x3b4773,_0x4451d4){return db['Dynamics365Account'][_0x68bd('0x34')]({'where':{'id':_0x3b4773[_0x68bd('0x38')]['id']}})[_0x68bd('0x10')](handleEntityNotFound(_0x4451d4,null))['then'](removeEntity(_0x4451d4,null))['catch'](handleError(_0x4451d4,null));};exports[_0x68bd('0x39')]=function(_0xacae55,_0x488fbd){var _0x593765={};var _0x4947bb={};var _0x47bb23;var _0x1744b9;return db[_0x68bd('0x18')][_0x68bd('0x3a')]({'where':{'id':_0xacae55[_0x68bd('0x38')]['id']}})[_0x68bd('0x10')](handleEntityNotFound(_0x488fbd,null))['then'](function(_0x1ddcf8){if(_0x1ddcf8){_0x47bb23=_0x1ddcf8;_0x4947bb[_0x68bd('0x1c')]=_[_0x68bd('0x30')](db[_0x68bd('0x3b')][_0x68bd('0x31')]);_0x4947bb[_0x68bd('0x1d')]=_[_0x68bd('0x30')](_0xacae55[_0x68bd('0x1d')]);_0x4947bb[_0x68bd('0x1e')]=_[_0x68bd('0x20')](_0x4947bb[_0x68bd('0x1c')],_0x4947bb['query']);_0x593765[_0x68bd('0x1f')]=_[_0x68bd('0x20')](_0x4947bb[_0x68bd('0x1c')],qs[_0x68bd('0x21')](_0xacae55[_0x68bd('0x1d')][_0x68bd('0x21')]));_0x593765['attributes']=_0x593765[_0x68bd('0x1f')][_0x68bd('0x32')]?_0x593765[_0x68bd('0x1f')]:_0x4947bb['model'];_0x593765['order']=qs[_0x68bd('0x24')](_0xacae55[_0x68bd('0x1d')]['sort']);_0x593765[_0x68bd('0x25')]=qs[_0x68bd('0x1e')](_[_0x68bd('0x26')](_0xacae55[_0x68bd('0x1d')],_0x4947bb[_0x68bd('0x1e')]));if(_0xacae55[_0x68bd('0x1d')]['filter']){_0x593765[_0x68bd('0x25')]=_[_0x68bd('0x28')](_0x593765[_0x68bd('0x25')],{'$or':_[_0x68bd('0x17')](_0x593765[_0x68bd('0x1f')],function(_0x44e890){var _0x31eb92={};_0x31eb92[_0x44e890]={'$like':'%'+_0xacae55['query'][_0x68bd('0x27')]+'%'};return _0x31eb92;})});}_0x593765=_[_0x68bd('0x28')]({},_0x593765,_0xacae55[_0x68bd('0x2a')]);return _0x47bb23[_0x68bd('0x39')](_0x593765);}})['then'](function(_0x3aa090){if(_0x3aa090){_0x1744b9=_0x3aa090['length'];if(!_0xacae55[_0x68bd('0x1d')]['hasOwnProperty'](_0x68bd('0x22'))){_0x593765[_0x68bd('0xa')]=qs[_0x68bd('0xa')](_0xacae55[_0x68bd('0x1d')][_0x68bd('0xa')]);_0x593765[_0x68bd('0x9')]=qs[_0x68bd('0x9')](_0xacae55['query'][_0x68bd('0x9')]);}return _0x47bb23['getConfigurations'](_0x593765);}})['then'](function(_0xe302d9){if(_0xe302d9){return _0xe302d9?{'count':_0x1744b9,'rows':_0xe302d9}:null;}})['then'](respondWithResult(_0x488fbd,null))[_0x68bd('0x2e')](handleError(_0x488fbd,null));};exports['addConfiguration']=function(_0x697587,_0x119901){if(_0x697587[_0x68bd('0x37')]['id']){delete _0x697587[_0x68bd('0x37')]['id'];}return db['Dynamics365Account'][_0x68bd('0x3a')]({'where':{'id':_0x697587[_0x68bd('0x38')]['id']}})[_0x68bd('0x10')](handleEntityNotFound(_0x119901,null))[_0x68bd('0x10')](function(_0x558202){if(_0x558202){_0x697587[_0x68bd('0x37')]['AccountId']=_0x558202['id'];_0x697587[_0x68bd('0x37')][_0x68bd('0x3c')]=integrations[_0x68bd('0x3d')](_0x697587[_0x68bd('0x37')][_0x68bd('0x3e')],_0x697587[_0x68bd('0x37')][_0x68bd('0x1a')]);_0x697587[_0x68bd('0x37')][_0x68bd('0x3f')]=integrations[_0x68bd('0x40')](_0x697587[_0x68bd('0x37')][_0x68bd('0x3e')],_0x697587[_0x68bd('0x37')][_0x68bd('0x1a')]);return db[_0x68bd('0x3b')]['create'](_0x697587[_0x68bd('0x37')],{'include':[{'model':db[_0x68bd('0x41')],'as':_0x68bd('0x3c')},{'model':db[_0x68bd('0x41')],'as':_0x68bd('0x3f')}]});}return null;})['then'](respondWithResult(_0x119901,null))[_0x68bd('0x2e')](handleError(_0x119901,null));};function sanitizeRemoteUri(_0x447ab1){var _0x4510eb=_0x447ab1[_0x68bd('0x42')](-0x1);if(_0x4510eb==='/')return _0x447ab1['substring'](0x0,_0x447ab1[_0x68bd('0x43')](_0x4510eb));return _0x447ab1;}function getWebApiUrl(_0x14cc5d){return util[_0x68bd('0x44')](_0x68bd('0x45'),_0x14cc5d);}exports[_0x68bd('0x46')]=function(_0x1efb33,_0x478462){var _0x2cd95c=_0x1efb33[_0x68bd('0x1d')][_0x68bd('0x47')];var _0xd1faae=_0x2cd95c==='incident'?'Incident':_0x68bd('0x48');var _0xd6b19e='';var _0x72a718='';var _0x4be016='';var _0x2b90da='';var _0x3cfa40='';var _0xf445d2='';var _0x588f65='';var _0x587799='';var _0x5cd7eb=['title',_0x68bd('0x49'),'customerid',_0x68bd('0x4a'),_0x68bd('0x4b'),_0x68bd('0x4c'),_0x68bd('0x4d'),'regardingobjectid',_0x68bd('0x4e'),_0x68bd('0x4f')];var _0x45818a=[_0x68bd('0x50'),_0x68bd('0x51'),_0x68bd('0x52'),_0x68bd('0x53'),_0x68bd('0x54'),'contactidyominame','contractdetailidname','contractidname',_0x68bd('0x55'),_0x68bd('0x56'),_0x68bd('0x57'),_0x68bd('0x58'),_0x68bd('0x59'),_0x68bd('0x5a'),_0x68bd('0x5b'),_0x68bd('0x5c'),_0x68bd('0x5d'),_0x68bd('0x5e'),_0x68bd('0x5f'),_0x68bd('0x60'),_0x68bd('0x61'),_0x68bd('0x62'),_0x68bd('0x63'),_0x68bd('0x64'),_0x68bd('0x65'),'followupby',_0x68bd('0x66'),_0x68bd('0x67'),'kbarticleidname',_0x68bd('0x68'),_0x68bd('0x69'),'modifiedbyexternalpartyname',_0x68bd('0x6a'),'modifiedbyname','modifiedbyyominame','modifiedon',_0x68bd('0x6b'),'modifiedonbehalfbyyominame',_0x68bd('0x6c'),_0x68bd('0x6d'),_0x68bd('0x6e'),_0x68bd('0x6f'),_0x68bd('0x70'),_0x68bd('0x71'),_0x68bd('0x72'),'owneridyominame','parentcaseidname',_0x68bd('0x73'),_0x68bd('0x74'),_0x68bd('0x75'),'productidname',_0x68bd('0x76'),_0x68bd('0x77'),_0x68bd('0x78'),'responseby','responsiblecontactidname',_0x68bd('0x79'),'sentimentvalue','slainvokedidname',_0x68bd('0x7a'),_0x68bd('0x7b'),_0x68bd('0x7c'),_0x68bd('0x7d'),_0x68bd('0x7e'),_0x68bd('0x7f'),_0x68bd('0x80'),'transactioncurrencyidname',_0x68bd('0x81'),_0x68bd('0x82'),_0x68bd('0x83')];var _0x1df88c=_0x5cd7eb['concat'](_0x45818a);return db[_0x68bd('0x18')]['findOne']({'where':{'id':_0x1efb33['params']['id']},'attributes':['id','username',_0x68bd('0x84'),_0x68bd('0x85'),'tenantId',_0x68bd('0x86'),_0x68bd('0x87'),_0x68bd('0x88')],'include':[{'model':db[_0x68bd('0x89')],'as':_0x68bd('0x89'),'attributes':['id',_0x68bd('0x8a'),_0x68bd('0x8b')]}]})['then'](handleEntityNotFound(_0x478462,null))[_0x68bd('0x10')](function(_0x148485){if(_0x148485){if(_0x148485[_0x68bd('0x88')]){_0x148485[_0x68bd('0x8c')]=_0x148485[_0x68bd('0x89')][_0x68bd('0x8a')];_0x587799=sanitizeRemoteUri(_0x148485['CloudProvider'][_0x68bd('0x8b')]);_0x588f65=getWebApiUrl(_0x587799);return _0x148485;}_0x587799=sanitizeRemoteUri(_0x148485[_0x68bd('0x85')]);_0x588f65=getWebApiUrl(_0x587799);var _0x3fdd52={'method':_0x68bd('0x8d'),'uri':_0x68bd('0x8e')+_0x148485['tenantId']+'/oauth2/token','form':{'client_id':_0x148485[_0x68bd('0x86')],'resource':_0x587799,'username':_0x148485[_0x68bd('0x8f')],'password':_0x148485[_0x68bd('0x84')],'grant_type':_0x68bd('0x84'),'client_secret':_0x148485[_0x68bd('0x87')]},'json':!![]};return rp(_0x3fdd52);}})[_0x68bd('0x10')](function(_0x366583){_0xf445d2=_0x366583['access_token'];var _0xa154d8={'method':_0x68bd('0x90'),'uri':encodeURI(_0x588f65+_0x68bd('0x91')+_0xd1faae+'\x27'),'headers':{'Authorization':_0x68bd('0x92')+_0xf445d2,'If-None-Match':null,'OData-Version':_0x68bd('0x93')},'json':!![]};return rp(_0xa154d8);})[_0x68bd('0x10')](function(_0x427879){var _0x59c97b=_0x427879[_0x68bd('0x94')][0x0];var _0x5b9943=_0x59c97b[_0x68bd('0x95')];var _0x250cf2={'method':_0x68bd('0x90'),'uri':_0x588f65+'EntityDefinitions('+_0x5b9943+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x68bd('0x92')+_0xf445d2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x250cf2);})['then'](function(_0x6a7841){_0xd6b19e=_0x6a7841;_0x72a718=_0xd6b19e[_0x68bd('0x96')];_0x72a718=_['remove'](_0x72a718,function(_0xc2838b){return!_0x1df88c[_0x68bd('0x97')](_0xc2838b['LogicalName']);});var _0x1c7f74=[];var _0x3a953c=[];_0x72a718[_0x68bd('0x98')](function(_0x1433ae){if(_0x1433ae['@odata.type']){var _0x46fd09=_0x1433ae['@odata.type'][_0x68bd('0x99')](_0x1433ae[_0x68bd('0x9a')]['lastIndexOf']('.')+0x1);if(_0x46fd09==='PicklistAttributeMetadata'){_0x1c7f74['push'](getSelectList(_0x588f65,_0x2cd95c,_0x3a953c,_0xd6b19e['MetadataId'],_0x1433ae[_0x68bd('0x95')],_0xf445d2));}}});return Promise[_0x68bd('0x9b')](_0x1c7f74);})[_0x68bd('0x10')](function(_0x34bb8f){_0x4be016=_0x34bb8f[0x0];var _0x3177c4=[];var _0x48e60f=[];_0x72a718[_0x68bd('0x98')](function(_0x441c35){if(!_['isNil'](_0x441c35[_0x68bd('0x9a')])){var _0x3b2418=_0x441c35[_0x68bd('0x9a')][_0x68bd('0x99')](_0x441c35[_0x68bd('0x9a')][_0x68bd('0x43')]('.')+0x1);if(_0x3b2418===_0x68bd('0x9c')){_0x3177c4[_0x68bd('0x9d')](getBooleanList(_0x588f65,_0x2cd95c,_0x48e60f,_0xd6b19e[_0x68bd('0x95')],_0x441c35['MetadataId'],_0xf445d2));}}});return Promise[_0x68bd('0x9b')](_0x3177c4);})[_0x68bd('0x10')](function(_0x156ae1){_0x2b90da=_0x156ae1[0x0];var _0x50473b=[];var _0x2bb9a1=[];_0x72a718[_0x68bd('0x98')](function(_0x4500f7){if(_0x4500f7[_0x68bd('0x9a')]){var _0x11d733=_0x4500f7[_0x68bd('0x9a')][_0x68bd('0x99')](_0x4500f7[_0x68bd('0x9a')][_0x68bd('0x43')]('.')+0x1);if(_0x11d733===_0x68bd('0x9e')||_0x11d733===_0x68bd('0x9f')||_0x11d733===_0x68bd('0xa0')||_0x11d733===_0x68bd('0xa1')||_0x11d733==='MemoAttributeMetadata'||_0x11d733==='DateTimeAttributeMetadata'||_0x11d733===_0x68bd('0xa2')||_0x11d733===_0x68bd('0xa3')||_0x11d733===_0x68bd('0xa4')||_0x11d733===_0x68bd('0xa5')){_0x50473b[_0x68bd('0x9d')](getInputList(_0x588f65,_0x2cd95c,_0x11d733,_0x2bb9a1,_0xd6b19e[_0x68bd('0x95')],_0x4500f7['MetadataId'],_0xf445d2));}}});return Promise['all'](_0x50473b);})[_0x68bd('0x10')](function(_0x1a4914){_0x3cfa40=_0x1a4914[0x0];var _0x3368a7=_0x4be016[_0x68bd('0xa6')](_0x2b90da)['concat'](_0x3cfa40);var _0x33b7fa={'count':_0x3368a7[_0x68bd('0x32')],'rows':_0x3368a7};return _0x33b7fa;})[_0x68bd('0x10')](respondWithResult(_0x478462,null))['catch'](function(_0x5e6341){var _0x3c01d7=_0x1efb33[_0x68bd('0x1d')][_0x68bd('0xa7')]?0x1f4:_0x5e6341[_0x68bd('0xa8')]||0x1f4;logger[_0x68bd('0x12')](_0x5e6341[_0x68bd('0x13')]);delete _0x5e6341[_0x68bd('0x14')];if(_0x3c01d7===0x191){_0x3c01d7=0x190;}_0x478462[_0x68bd('0x7')](_0x3c01d7)[_0x68bd('0x15')](_0x1efb33[_0x68bd('0x1d')][_0x68bd('0xa7')]?{'message':_0x68bd('0xa9'),'statusCode':_0x5e6341[_0x68bd('0xa8')]}:_0x5e6341);});};function getSelectList(_0x5e95e3,_0x1fdf05,_0x51d69f,_0x2927d1,_0xbe8b42,_0x33c838){var _0xbeb4e4={'method':_0x68bd('0x90'),'uri':_0x5e95e3+_0x68bd('0xaa')+_0x2927d1+_0x68bd('0xab')+_0xbe8b42+_0x68bd('0xac')+_0x68bd('0xad'),'headers':{'Authorization':_0x68bd('0x92')+_0x33c838,'If-None-Match':null,'OData-Version':_0x68bd('0x93')},'json':!![]};return rp(_0xbeb4e4)['then'](function(_0x54bd08){var _0x9b655d=[];var _0x331ad7=_0x54bd08[_0x68bd('0xae')][_0x68bd('0xaf')];_0x331ad7[_0x68bd('0x98')](function(_0x39c40d){_0x9b655d[_0x68bd('0x9d')]({'name':_0x39c40d[_0x68bd('0xb0')][_0x68bd('0xb1')][_0x68bd('0xb0')],'value':String(_0x39c40d[_0x68bd('0xb2')])});});var _0x10b87b={'id':_0x1fdf05+'_'+_0x54bd08[_0x68bd('0xb3')],'name':_0x54bd08[_0x68bd('0xb4')][_0x68bd('0xb1')][_0x68bd('0xb0')],'custom':![],'options':_0x9b655d};_0x51d69f[_0x68bd('0x9d')](_0x10b87b);return _0x51d69f;});}function getBooleanList(_0x1ec4fd,_0x19f4d2,_0x2ae3ba,_0x18e9a6,_0x420fac,_0x3a2f69){var _0x5623b7={'method':_0x68bd('0x90'),'uri':_0x1ec4fd+_0x68bd('0xaa')+_0x18e9a6+_0x68bd('0xab')+_0x420fac+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x3a2f69,'If-None-Match':null,'OData-Version':_0x68bd('0x93')},'json':!![]};return rp(_0x5623b7)[_0x68bd('0x10')](function(_0x5cea8e){var _0x1c47c5=[];_0x1c47c5['push']({'name':_0x5cea8e[_0x68bd('0xae')][_0x68bd('0xb5')][_0x68bd('0xb0')]['UserLocalizedLabel'][_0x68bd('0xb0')],'value':_0x68bd('0xb6')},{'name':_0x5cea8e['OptionSet'][_0x68bd('0xb7')][_0x68bd('0xb0')]['UserLocalizedLabel'][_0x68bd('0xb0')],'value':_0x68bd('0xb8')});var _0x5717f8={'id':_0x19f4d2+'_'+_0x5cea8e[_0x68bd('0xb3')],'name':_0x5cea8e[_0x68bd('0xb4')][_0x68bd('0xb1')][_0x68bd('0xb0')],'custom':![],'options':_0x1c47c5};_0x2ae3ba[_0x68bd('0x9d')](_0x5717f8);return _0x2ae3ba;});}function getInputList(_0x369495,_0x3c4b80,_0xb5a253,_0x586115,_0x46ea43,_0x5c0fd4,_0x51a729){var _0xeaa975={'method':'GET','uri':_0x369495+'EntityDefinitions('+_0x46ea43+_0x68bd('0xab')+_0x5c0fd4+_0x68bd('0xb9')+_0xb5a253+_0x68bd('0xba'),'headers':{'Authorization':_0x68bd('0x92')+_0x51a729,'If-None-Match':null,'OData-Version':_0x68bd('0x93')},'json':!![]};return rp(_0xeaa975)[_0x68bd('0x10')](function(_0x1d388c){var _0x31553={'id':_0x3c4b80+'_'+_0x1d388c['LogicalName'],'name':_0x1d388c['DisplayName'][_0x68bd('0xb1')]?_0x1d388c[_0x68bd('0xb4')][_0x68bd('0xb1')][_0x68bd('0xb0')]:_0x1d388c[_0x68bd('0xb3')],'custom':![],'options':[]};_0x586115[_0x68bd('0x9d')](_0x31553);return _0x586115;});} \ No newline at end of file +var _0x8482=['data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','Bearer\x20','4.0','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','test','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','offset','undefined','count','status','set','Content-Range','json','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','Dynamics365Configuration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','ownerid','phonenumber','regardingobjectid','directioncode','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8482,0x1a9));var _0x2848=function(_0x87d5e8,_0x211999){_0x87d5e8=_0x87d5e8-0x0;var _0x45295e=_0x8482[_0x87d5e8];return _0x45295e;};'use strict';var rp=require(_0x2848('0x0'));var util=require(_0x2848('0x1'));var _=require(_0x2848('0x2'));var qs=require(_0x2848('0x3'));var logger=require(_0x2848('0x4'))(_0x2848('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2848('0x6'));function respondWithResult(_0x175432,_0xfcd672){_0xfcd672=_0xfcd672||0xc8;return function(_0x4dc3ce){if(_0x4dc3ce){return _0x175432['status'](_0xfcd672)['json'](_0x4dc3ce);}};}function respondWithFilteredResult(_0x6b411d,_0x544460){return function(_0x2730ae){if(_0x2730ae){var _0x45860e=typeof _0x544460[_0x2848('0x7')]===_0x2848('0x8')&&typeof _0x544460['limit']===_0x2848('0x8');var _0x220c86=_0x2730ae[_0x2848('0x9')];var _0xf3e159=_0x45860e?0x0:_0x544460[_0x2848('0x7')];var _0x14b14b=_0x45860e?_0x2730ae[_0x2848('0x9')]:_0x544460[_0x2848('0x7')]+_0x544460['limit'];var _0x4bf23a;if(_0x14b14b>=_0x220c86){_0x14b14b=_0x220c86;_0x4bf23a=0xc8;}else{_0x4bf23a=0xce;}_0x6b411d[_0x2848('0xa')](_0x4bf23a);return _0x6b411d[_0x2848('0xb')](_0x2848('0xc'),_0xf3e159+'-'+_0x14b14b+'/'+_0x220c86)[_0x2848('0xd')](_0x2730ae);}return null;};}function saveUpdates(_0x3cfd74){return function(_0x5a253d){if(_0x5a253d){return _0x5a253d[_0x2848('0xe')](_0x3cfd74)[_0x2848('0xf')](function(_0x26e848){return _0x26e848;});}return null;};}function removeEntity(_0x50bca0){return function(_0x37b8f5){if(_0x37b8f5){return _0x37b8f5['destroy']()['then'](function(){_0x50bca0[_0x2848('0xa')](0xcc)[_0x2848('0x10')]();});}};}function handleEntityNotFound(_0xe4d16d){return function(_0x285530){if(!_0x285530){_0xe4d16d[_0x2848('0x11')](0x194);}return _0x285530;};}function handleError(_0x11394c,_0xd5a7e5){_0xd5a7e5=_0xd5a7e5||0x1f4;return function(_0xf8537){logger[_0x2848('0x12')](_0xf8537[_0x2848('0x13')]);if(_0xf8537[_0x2848('0x14')]){delete _0xf8537['name'];}_0x11394c[_0x2848('0xa')](_0xd5a7e5)[_0x2848('0x15')](_0xf8537);};}exports[_0x2848('0x16')]=function(_0x4fc668,_0x26452f){var _0x19abe1={},_0x2591fe={},_0x164f20={'count':0x0,'rows':[]};var _0xf1c7e=_[_0x2848('0x17')](db[_0x2848('0x18')]['rawAttributes'],function(_0x2b890a){return{'name':_0x2b890a[_0x2848('0x19')],'type':_0x2b890a['type'][_0x2848('0x1a')]};});_0x2591fe['model']=_[_0x2848('0x17')](_0xf1c7e,_0x2848('0x14'));_0x2591fe[_0x2848('0x1b')]=_[_0x2848('0x1c')](_0x4fc668['query']);_0x2591fe[_0x2848('0x1d')]=_[_0x2848('0x1e')](_0x2591fe['model'],_0x2591fe[_0x2848('0x1b')]);_0x19abe1[_0x2848('0x1f')]=_[_0x2848('0x1e')](_0x2591fe['model'],qs[_0x2848('0x20')](_0x4fc668[_0x2848('0x1b')][_0x2848('0x20')]));_0x19abe1[_0x2848('0x1f')]=_0x19abe1['attributes'][_0x2848('0x21')]?_0x19abe1['attributes']:_0x2591fe[_0x2848('0x22')];if(!_0x4fc668[_0x2848('0x1b')][_0x2848('0x23')](_0x2848('0x24'))){_0x19abe1['limit']=qs[_0x2848('0x25')](_0x4fc668[_0x2848('0x1b')][_0x2848('0x25')]);_0x19abe1[_0x2848('0x7')]=qs[_0x2848('0x7')](_0x4fc668[_0x2848('0x1b')][_0x2848('0x7')]);}_0x19abe1[_0x2848('0x26')]=qs[_0x2848('0x27')](_0x4fc668[_0x2848('0x1b')][_0x2848('0x27')]);_0x19abe1[_0x2848('0x28')]=qs['filters'](_[_0x2848('0x29')](_0x4fc668['query'],_0x2591fe[_0x2848('0x1d')]),_0xf1c7e);if(_0x4fc668[_0x2848('0x1b')][_0x2848('0x2a')]){_0x19abe1[_0x2848('0x28')]=_['merge'](_0x19abe1[_0x2848('0x28')],{'$or':_[_0x2848('0x17')](_0xf1c7e,function(_0x4cddb6){if(_0x4cddb6['type']!==_0x2848('0x2b')){var _0x19b808={};_0x19b808[_0x4cddb6[_0x2848('0x14')]]={'$like':'%'+_0x4fc668['query'][_0x2848('0x2a')]+'%'};return _0x19b808;}})});}_0x19abe1=_[_0x2848('0x2c')]({},_0x19abe1,_0x4fc668[_0x2848('0x2d')]);var _0x346be3={'where':_0x19abe1[_0x2848('0x28')]};return db[_0x2848('0x18')][_0x2848('0x9')](_0x346be3)['then'](function(_0x3b4401){_0x164f20[_0x2848('0x9')]=_0x3b4401;if(_0x4fc668[_0x2848('0x1b')][_0x2848('0x2e')]){_0x19abe1[_0x2848('0x2f')]=[{'all':!![]}];}return db[_0x2848('0x18')][_0x2848('0x30')](_0x19abe1);})[_0x2848('0xf')](function(_0x58666a){_0x164f20['rows']=_0x58666a;return _0x164f20;})[_0x2848('0xf')](respondWithFilteredResult(_0x26452f,_0x19abe1))[_0x2848('0x31')](handleError(_0x26452f,null));};exports[_0x2848('0x32')]=function(_0x5da779,_0x3a64ff){var _0x896f3={'raw':![],'where':{'id':_0x5da779['params']['id']}},_0x1a4a40={};_0x1a4a40[_0x2848('0x22')]=_[_0x2848('0x1c')](db['Dynamics365Account'][_0x2848('0x33')]);_0x1a4a40['query']=_[_0x2848('0x1c')](_0x5da779[_0x2848('0x1b')]);_0x1a4a40[_0x2848('0x1d')]=_['intersection'](_0x1a4a40[_0x2848('0x22')],_0x1a4a40[_0x2848('0x1b')]);_0x896f3[_0x2848('0x1f')]=_['intersection'](_0x1a4a40['model'],qs[_0x2848('0x20')](_0x5da779[_0x2848('0x1b')][_0x2848('0x20')]));_0x896f3['attributes']=_0x896f3[_0x2848('0x1f')]['length']?_0x896f3[_0x2848('0x1f')]:_0x1a4a40['model'];if(_0x5da779[_0x2848('0x1b')]['includeAll']){_0x896f3[_0x2848('0x2f')]=[{'all':!![]}];}_0x896f3=_[_0x2848('0x2c')]({},_0x896f3,_0x5da779[_0x2848('0x2d')]);return db[_0x2848('0x18')][_0x2848('0x34')](_0x896f3)['then'](handleEntityNotFound(_0x3a64ff,null))[_0x2848('0xf')](respondWithResult(_0x3a64ff,null))[_0x2848('0x31')](handleError(_0x3a64ff,null));};exports[_0x2848('0x35')]=function(_0x474473,_0x1af844){return db[_0x2848('0x18')][_0x2848('0x35')](_0x474473[_0x2848('0x36')],{})[_0x2848('0xf')](respondWithResult(_0x1af844,0xc9))[_0x2848('0x31')](handleError(_0x1af844,null));};exports[_0x2848('0xe')]=function(_0xd05f7d,_0x509e51){if(_0xd05f7d[_0x2848('0x36')]['id']){delete _0xd05f7d[_0x2848('0x36')]['id'];}return db[_0x2848('0x18')]['find']({'where':{'id':_0xd05f7d[_0x2848('0x37')]['id']}})['then'](handleEntityNotFound(_0x509e51,null))['then'](saveUpdates(_0xd05f7d[_0x2848('0x36')],null))[_0x2848('0xf')](respondWithResult(_0x509e51,null))[_0x2848('0x31')](handleError(_0x509e51,null));};exports['destroy']=function(_0x5df309,_0x4a969e){return db[_0x2848('0x18')][_0x2848('0x34')]({'where':{'id':_0x5df309[_0x2848('0x37')]['id']}})['then'](handleEntityNotFound(_0x4a969e,null))[_0x2848('0xf')](removeEntity(_0x4a969e,null))[_0x2848('0x31')](handleError(_0x4a969e,null));};exports['getConfigurations']=function(_0x2b7527,_0x199cd8){var _0x3e289e={};var _0x9cd09d={};var _0x204f26;var _0x5c82ce;return db[_0x2848('0x18')]['findOne']({'where':{'id':_0x2b7527[_0x2848('0x37')]['id']}})[_0x2848('0xf')](handleEntityNotFound(_0x199cd8,null))['then'](function(_0x443459){if(_0x443459){_0x204f26=_0x443459;_0x9cd09d[_0x2848('0x22')]=_[_0x2848('0x1c')](db[_0x2848('0x38')][_0x2848('0x33')]);_0x9cd09d[_0x2848('0x1b')]=_[_0x2848('0x1c')](_0x2b7527[_0x2848('0x1b')]);_0x9cd09d[_0x2848('0x1d')]=_[_0x2848('0x1e')](_0x9cd09d[_0x2848('0x22')],_0x9cd09d[_0x2848('0x1b')]);_0x3e289e[_0x2848('0x1f')]=_[_0x2848('0x1e')](_0x9cd09d[_0x2848('0x22')],qs[_0x2848('0x20')](_0x2b7527[_0x2848('0x1b')]['fields']));_0x3e289e[_0x2848('0x1f')]=_0x3e289e[_0x2848('0x1f')][_0x2848('0x21')]?_0x3e289e[_0x2848('0x1f')]:_0x9cd09d[_0x2848('0x22')];_0x3e289e[_0x2848('0x26')]=qs[_0x2848('0x27')](_0x2b7527[_0x2848('0x1b')][_0x2848('0x27')]);_0x3e289e[_0x2848('0x28')]=qs['filters'](_[_0x2848('0x29')](_0x2b7527[_0x2848('0x1b')],_0x9cd09d[_0x2848('0x1d')]));if(_0x2b7527['query'][_0x2848('0x2a')]){_0x3e289e[_0x2848('0x28')]=_['merge'](_0x3e289e['where'],{'$or':_[_0x2848('0x17')](_0x3e289e['attributes'],function(_0x369c92){var _0x43c6aa={};_0x43c6aa[_0x369c92]={'$like':'%'+_0x2b7527[_0x2848('0x1b')]['filter']+'%'};return _0x43c6aa;})});}_0x3e289e=_[_0x2848('0x2c')]({},_0x3e289e,_0x2b7527[_0x2848('0x2d')]);return _0x204f26[_0x2848('0x39')](_0x3e289e);}})[_0x2848('0xf')](function(_0x17c6fe){if(_0x17c6fe){_0x5c82ce=_0x17c6fe['length'];if(!_0x2b7527[_0x2848('0x1b')][_0x2848('0x23')](_0x2848('0x24'))){_0x3e289e[_0x2848('0x25')]=qs['limit'](_0x2b7527[_0x2848('0x1b')]['limit']);_0x3e289e[_0x2848('0x7')]=qs[_0x2848('0x7')](_0x2b7527[_0x2848('0x1b')]['offset']);}return _0x204f26[_0x2848('0x39')](_0x3e289e);}})['then'](function(_0x3eef80){if(_0x3eef80){return _0x3eef80?{'count':_0x5c82ce,'rows':_0x3eef80}:null;}})[_0x2848('0xf')](respondWithResult(_0x199cd8,null))[_0x2848('0x31')](handleError(_0x199cd8,null));};exports[_0x2848('0x3a')]=function(_0x271ae0,_0x2b48c3){if(_0x271ae0[_0x2848('0x36')]['id']){delete _0x271ae0[_0x2848('0x36')]['id'];}return db[_0x2848('0x18')][_0x2848('0x3b')]({'where':{'id':_0x271ae0[_0x2848('0x37')]['id']}})[_0x2848('0xf')](handleEntityNotFound(_0x2b48c3,null))[_0x2848('0xf')](function(_0x556df5){if(_0x556df5){_0x271ae0['body'][_0x2848('0x3c')]=_0x556df5['id'];_0x271ae0[_0x2848('0x36')][_0x2848('0x3d')]=integrations[_0x2848('0x3e')](_0x271ae0['body'][_0x2848('0x3f')],_0x271ae0[_0x2848('0x36')][_0x2848('0x40')]);_0x271ae0[_0x2848('0x36')][_0x2848('0x41')]=integrations[_0x2848('0x42')](_0x271ae0['body'][_0x2848('0x3f')],_0x271ae0[_0x2848('0x36')][_0x2848('0x40')]);return db[_0x2848('0x38')][_0x2848('0x35')](_0x271ae0['body'],{'include':[{'model':db[_0x2848('0x43')],'as':'Subjects'},{'model':db[_0x2848('0x43')],'as':_0x2848('0x41')}]});}return null;})[_0x2848('0xf')](respondWithResult(_0x2b48c3,null))[_0x2848('0x31')](handleError(_0x2b48c3,null));};function sanitizeRemoteUri(_0x4e1cd3){var _0xc58c88=_0x4e1cd3[_0x2848('0x44')](-0x1);if(_0xc58c88==='/')return _0x4e1cd3[_0x2848('0x45')](0x0,_0x4e1cd3[_0x2848('0x46')](_0xc58c88));return _0x4e1cd3;}function getWebApiUrl(_0x4afde7){return util['format'](_0x2848('0x47'),_0x4afde7);}exports[_0x2848('0x48')]=function(_0x13dde3,_0x526d9f){var _0x9faf85=_0x13dde3[_0x2848('0x1b')][_0x2848('0x49')];var _0x407cc4=_0x9faf85===_0x2848('0x4a')?_0x2848('0x4b'):'PhoneCall';var _0xb5c965='';var _0x10eeb9='';var _0x152b08='';var _0x5c0610='';var _0x12cfb1='';var _0x5bdca6='';var _0x1f1f4a='';var _0xdc5380='';var _0x500538=[_0x2848('0x4c'),_0x2848('0x4d'),'customerid',_0x2848('0x4e'),'caseorigincode','subject',_0x2848('0x4f'),_0x2848('0x50'),_0x2848('0x51'),'phonecall_activity_parties'];var _0x26b0f6=['accountidname',_0x2848('0x52'),_0x2848('0x53'),_0x2848('0x54'),_0x2848('0x55'),_0x2848('0x56'),_0x2848('0x57'),_0x2848('0x58'),_0x2848('0x59'),_0x2848('0x5a'),_0x2848('0x5b'),_0x2848('0x5c'),_0x2848('0x5d'),_0x2848('0x5e'),_0x2848('0x5f'),_0x2848('0x60'),_0x2848('0x61'),'customeridyominame','emailaddress',_0x2848('0x62'),_0x2848('0x63'),_0x2848('0x64'),_0x2848('0x65'),_0x2848('0x66'),'firstresponsebykpiidname',_0x2848('0x67'),_0x2848('0x68'),_0x2848('0x69'),_0x2848('0x6a'),_0x2848('0x6b'),_0x2848('0x6c'),_0x2848('0x6d'),_0x2848('0x6e'),_0x2848('0x6f'),_0x2848('0x70'),_0x2848('0x71'),'modifiedonbehalfbyname',_0x2848('0x72'),'msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents',_0x2848('0x73'),_0x2848('0x74'),_0x2848('0x75'),_0x2848('0x76'),_0x2848('0x77'),_0x2848('0x78'),_0x2848('0x79'),_0x2848('0x7a'),'prioritycodename',_0x2848('0x7b'),_0x2848('0x7c'),_0x2848('0x7d'),_0x2848('0x7e'),_0x2848('0x7f'),'responsiblecontactidname',_0x2848('0x80'),_0x2848('0x81'),_0x2848('0x82'),_0x2848('0x83'),_0x2848('0x84'),_0x2848('0x85'),_0x2848('0x86'),_0x2848('0x87'),_0x2848('0x88'),_0x2848('0x89'),_0x2848('0x8a'),_0x2848('0x8b'),_0x2848('0x8c'),'versionnumber'];var _0x385db9=_0x500538[_0x2848('0x8d')](_0x26b0f6);return db['Dynamics365Account'][_0x2848('0x3b')]({'where':{'id':_0x13dde3[_0x2848('0x37')]['id']},'attributes':['id',_0x2848('0x8e'),_0x2848('0x8f'),_0x2848('0x90'),_0x2848('0x91'),_0x2848('0x92'),_0x2848('0x93'),_0x2848('0x94')],'include':[{'model':db[_0x2848('0x95')],'as':'CloudProvider','attributes':['id',_0x2848('0x96'),_0x2848('0x97')]}]})[_0x2848('0xf')](handleEntityNotFound(_0x526d9f,null))[_0x2848('0xf')](function(_0x4f8704){if(_0x4f8704){if(_0x4f8704[_0x2848('0x94')]){_0x4f8704[_0x2848('0x98')]=_0x4f8704[_0x2848('0x95')][_0x2848('0x96')];_0xdc5380=sanitizeRemoteUri(_0x4f8704[_0x2848('0x95')][_0x2848('0x97')]);_0x1f1f4a=getWebApiUrl(_0xdc5380);return _0x4f8704;}_0xdc5380=sanitizeRemoteUri(_0x4f8704[_0x2848('0x90')]);_0x1f1f4a=getWebApiUrl(_0xdc5380);var _0x5bce34={'method':_0x2848('0x99'),'uri':_0x2848('0x9a')+_0x4f8704[_0x2848('0x91')]+_0x2848('0x9b'),'form':{'client_id':_0x4f8704[_0x2848('0x92')],'resource':_0xdc5380,'username':_0x4f8704[_0x2848('0x8e')],'password':_0x4f8704['password'],'grant_type':'password','client_secret':_0x4f8704['clientSecret']},'json':!![]};return rp(_0x5bce34);}})[_0x2848('0xf')](function(_0x3fc55b){_0x5bdca6=_0x3fc55b[_0x2848('0x98')];var _0x4c62c9={'method':'GET','uri':encodeURI(_0x1f1f4a+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x407cc4+'\x27'),'headers':{'Authorization':_0x2848('0x9c')+_0x5bdca6,'If-None-Match':null,'OData-Version':_0x2848('0x9d')},'json':!![]};return rp(_0x4c62c9);})[_0x2848('0xf')](function(_0x2831c5){var _0x147fa5=_0x2831c5['value'][0x0];var _0x5e967d=_0x147fa5['MetadataId'];var _0x33ad63={'method':_0x2848('0x9e'),'uri':_0x1f1f4a+_0x2848('0x9f')+_0x5e967d+_0x2848('0xa0'),'headers':{'Authorization':_0x2848('0x9c')+_0x5bdca6,'If-None-Match':null,'OData-Version':_0x2848('0x9d')},'json':!![]};return rp(_0x33ad63);})[_0x2848('0xf')](function(_0x1cc07a){_0xb5c965=_0x1cc07a;_0x10eeb9=_0xb5c965[_0x2848('0xa1')];_0x10eeb9=_[_0x2848('0xa2')](_0x10eeb9,function(_0x36f1fa){return!_0x385db9['includes'](_0x36f1fa[_0x2848('0xa3')]);});var _0x310571=[];var _0x74f36b=[];_0x10eeb9[_0x2848('0xa4')](function(_0x34e761){if(_0x34e761[_0x2848('0xa5')]){var _0x1b177b=_0x34e761[_0x2848('0xa5')][_0x2848('0x45')](_0x34e761[_0x2848('0xa5')][_0x2848('0x46')]('.')+0x1);if(_0x1b177b===_0x2848('0xa6')){_0x310571['push'](getSelectList(_0x1f1f4a,_0x9faf85,_0x74f36b,_0xb5c965[_0x2848('0xa7')],_0x34e761[_0x2848('0xa7')],_0x5bdca6));}}});return Promise[_0x2848('0xa8')](_0x310571);})[_0x2848('0xf')](function(_0x424657){_0x152b08=_0x424657[0x0];var _0x3d9cea=[];var _0x5df694=[];_0x10eeb9[_0x2848('0xa4')](function(_0x32ae67){if(!_[_0x2848('0xa9')](_0x32ae67['@odata.type'])){var _0x2b7164=_0x32ae67[_0x2848('0xa5')]['substring'](_0x32ae67['@odata.type'][_0x2848('0x46')]('.')+0x1);if(_0x2b7164==='BooleanAttributeMetadata'){_0x3d9cea[_0x2848('0xaa')](getBooleanList(_0x1f1f4a,_0x9faf85,_0x5df694,_0xb5c965[_0x2848('0xa7')],_0x32ae67['MetadataId'],_0x5bdca6));}}});return Promise[_0x2848('0xa8')](_0x3d9cea);})[_0x2848('0xf')](function(_0x3e6714){_0x5c0610=_0x3e6714[0x0];var _0x15d2f7=[];var _0x16af55=[];_0x10eeb9[_0x2848('0xa4')](function(_0x41e3cd){if(_0x41e3cd[_0x2848('0xa5')]){var _0x355ac8=_0x41e3cd[_0x2848('0xa5')][_0x2848('0x45')](_0x41e3cd[_0x2848('0xa5')][_0x2848('0x46')]('.')+0x1);if(_0x355ac8===_0x2848('0xab')||_0x355ac8===_0x2848('0xac')||_0x355ac8===_0x2848('0xad')||_0x355ac8===_0x2848('0xae')||_0x355ac8===_0x2848('0xaf')||_0x355ac8===_0x2848('0xb0')||_0x355ac8===_0x2848('0xb1')||_0x355ac8==='EntityNameAttributeMetadata'||_0x355ac8==='StateAttributeMetadata'||_0x355ac8==='DecimalAttributeMetadata'){_0x15d2f7[_0x2848('0xaa')](getInputList(_0x1f1f4a,_0x9faf85,_0x355ac8,_0x16af55,_0xb5c965[_0x2848('0xa7')],_0x41e3cd[_0x2848('0xa7')],_0x5bdca6));}}});return Promise[_0x2848('0xa8')](_0x15d2f7);})['then'](function(_0x27ff5c){_0x12cfb1=_0x27ff5c[0x0];var _0x5059bb=_0x152b08['concat'](_0x5c0610)['concat'](_0x12cfb1);var _0x5c34ec={'count':_0x5059bb[_0x2848('0x21')],'rows':_0x5059bb};return _0x5c34ec;})[_0x2848('0xf')](respondWithResult(_0x526d9f,null))[_0x2848('0x31')](function(_0x133b04){var _0xebc64e=_0x13dde3[_0x2848('0x1b')][_0x2848('0xb2')]?0x1f4:_0x133b04[_0x2848('0xb3')]||0x1f4;logger[_0x2848('0x12')](_0x133b04['stack']);delete _0x133b04['name'];if(_0xebc64e===0x191){_0xebc64e=0x190;}_0x526d9f['status'](_0xebc64e)[_0x2848('0x15')](_0x13dde3[_0x2848('0x1b')][_0x2848('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x133b04[_0x2848('0xb3')]}:_0x133b04);});};function getSelectList(_0x339dd2,_0x1342f4,_0x725a30,_0x5741c8,_0x464371,_0x72d40d){var _0x3a9046={'method':_0x2848('0x9e'),'uri':_0x339dd2+'EntityDefinitions('+_0x5741c8+_0x2848('0xb4')+_0x464371+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x2848('0xb5'),'headers':{'Authorization':_0x2848('0x9c')+_0x72d40d,'If-None-Match':null,'OData-Version':_0x2848('0x9d')},'json':!![]};return rp(_0x3a9046)[_0x2848('0xf')](function(_0x46be19){var _0x45cb1a=[];var _0x4a95be=_0x46be19['OptionSet']['Options'];_0x4a95be['forEach'](function(_0x5c7a97){_0x45cb1a[_0x2848('0xaa')]({'name':_0x5c7a97[_0x2848('0xb6')][_0x2848('0xb7')][_0x2848('0xb6')],'value':String(_0x5c7a97[_0x2848('0xb8')])});});var _0x2ca311={'id':_0x1342f4+'_'+_0x46be19[_0x2848('0xa3')],'name':_0x46be19['DisplayName'][_0x2848('0xb7')][_0x2848('0xb6')],'custom':![],'options':_0x45cb1a};_0x725a30[_0x2848('0xaa')](_0x2ca311);return _0x725a30;});}function getBooleanList(_0x41a250,_0x532d35,_0x1fe713,_0x166df0,_0x2f25e2,_0x1fc833){var _0x547230={'method':'GET','uri':_0x41a250+'EntityDefinitions('+_0x166df0+_0x2848('0xb4')+_0x2f25e2+_0x2848('0xb9'),'headers':{'Authorization':'Bearer\x20'+_0x1fc833,'If-None-Match':null,'OData-Version':_0x2848('0x9d')},'json':!![]};return rp(_0x547230)[_0x2848('0xf')](function(_0x25e396){var _0x127b53=[];_0x127b53['push']({'name':_0x25e396[_0x2848('0xba')]['TrueOption'][_0x2848('0xb6')][_0x2848('0xb7')][_0x2848('0xb6')],'value':_0x2848('0xbb')},{'name':_0x25e396[_0x2848('0xba')][_0x2848('0xbc')][_0x2848('0xb6')][_0x2848('0xb7')][_0x2848('0xb6')],'value':'false'});var _0x4d7958={'id':_0x532d35+'_'+_0x25e396[_0x2848('0xa3')],'name':_0x25e396[_0x2848('0xbd')][_0x2848('0xb7')][_0x2848('0xb6')],'custom':![],'options':_0x127b53};_0x1fe713[_0x2848('0xaa')](_0x4d7958);return _0x1fe713;});}function getInputList(_0x36b83b,_0x29e938,_0x466a8d,_0x45f1fc,_0x1fd2ce,_0x3b2082,_0x10a1e0){var _0x23b522={'method':_0x2848('0x9e'),'uri':_0x36b83b+_0x2848('0x9f')+_0x1fd2ce+_0x2848('0xb4')+_0x3b2082+_0x2848('0xbe')+_0x466a8d+_0x2848('0xbf'),'headers':{'Authorization':_0x2848('0x9c')+_0x10a1e0,'If-None-Match':null,'OData-Version':_0x2848('0x9d')},'json':!![]};return rp(_0x23b522)[_0x2848('0xf')](function(_0x5951c7){var _0x59fed2={'id':_0x29e938+'_'+_0x5951c7[_0x2848('0xa3')],'name':_0x5951c7[_0x2848('0xbd')][_0x2848('0xb7')]?_0x5951c7['DisplayName']['UserLocalizedLabel']['Label']:_0x5951c7[_0x2848('0xa3')],'custom':![],'options':[]};_0x45f1fc[_0x2848('0xaa')](_0x59fed2);return _0x45f1fc;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6e7ca37..259dbe4 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x26413f,_0x5b103b){var _0x241089=function(_0x1ca65c){while(--_0x1ca65c){_0x26413f['push'](_0x26413f['shift']());}};_0x241089(++_0x5b103b);}(_0xe706,0xa3));var _0x6e70=function(_0x3eee78,_0x5acc63){_0x3eee78=_0x3eee78-0x0;var _0x53a5e5=_0xe706[_0x3eee78];return _0x53a5e5;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x443b23,_0x529bfe){var _0x56c265=function(_0x4b9a45){while(--_0x4b9a45){_0x443b23['push'](_0x443b23['shift']());}};_0x56c265(++_0x529bfe);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 74a4312..c136b7d 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc424=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x7b0029,_0x59f917){var _0x501c7e=function(_0x4f3770){while(--_0x4f3770){_0x7b0029['push'](_0x7b0029['shift']());}};_0x501c7e(++_0x59f917);}(_0xc424,0xd2));var _0x4c42=function(_0x319608,_0x136cf7){_0x319608=_0x319608-0x0;var _0x306f60=_0xc424[_0x319608];return _0x306f60;};'use strict';var _=require('lodash');var util=require(_0x4c42('0x0'));var moment=require(_0x4c42('0x1'));var BPromise=require(_0x4c42('0x2'));var rs=require(_0x4c42('0x3'));var fs=require('fs');var Redis=require(_0x4c42('0x4'));var db=require(_0x4c42('0x5'))['db'];var utils=require(_0x4c42('0x6'));var logger=require(_0x4c42('0x7'))(_0x4c42('0x8'));var config=require(_0x4c42('0x9'));var jayson=require(_0x4c42('0xa'));var client=jayson[_0x4c42('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3977cd,_0x541d71,_0x278cf1){return new BPromise(function(_0x1a5942,_0x30029b){return client['request'](_0x3977cd,_0x278cf1)[_0x4c42('0xc')](function(_0x31a3b7){logger[_0x4c42('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x541d71,_0x4c42('0xe'));logger[_0x4c42('0xf')](_0x4c42('0x10'),_0x541d71,_0x4c42('0xe'),JSON[_0x4c42('0x11')](_0x31a3b7));if(_0x31a3b7[_0x4c42('0x12')]){if(_0x31a3b7['error']['code']===0x1f4){logger[_0x4c42('0x12')](_0x4c42('0x13'),_0x541d71,_0x31a3b7[_0x4c42('0x12')][_0x4c42('0x14')]);return _0x30029b(_0x31a3b7[_0x4c42('0x12')][_0x4c42('0x14')]);}logger['error'](_0x4c42('0x13'),_0x541d71,_0x31a3b7[_0x4c42('0x12')][_0x4c42('0x14')]);return _0x1a5942(_0x31a3b7[_0x4c42('0x12')][_0x4c42('0x14')]);}else{logger['info'](_0x4c42('0x13'),_0x541d71,_0x4c42('0xe'));_0x1a5942(_0x31a3b7[_0x4c42('0x15')][_0x4c42('0x14')]);}})['catch'](function(_0x2203a1){logger[_0x4c42('0x12')](_0x4c42('0x13'),_0x541d71,_0x2203a1);_0x30029b(_0x2203a1);});});}exports[_0x4c42('0x16')]=function(_0x1e9da2){var _0x31d1a9=this;return new Promise(function(_0x3da70c,_0x31e46b){return db[_0x4c42('0x17')][_0x4c42('0x18')]({'raw':_0x1e9da2[_0x4c42('0x19')]?_0x1e9da2[_0x4c42('0x19')][_0x4c42('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e9da2[_0x4c42('0x19')]?_0x1e9da2['options'][_0x4c42('0x1b')]||null:null,'attributes':_0x1e9da2['options']?_0x1e9da2[_0x4c42('0x19')][_0x4c42('0x1c')]||null:null,'limit':_0x1e9da2['options']?_0x1e9da2[_0x4c42('0x19')][_0x4c42('0x1d')]||null:null,'include':_0x1e9da2['options']?_0x1e9da2[_0x4c42('0x19')][_0x4c42('0x1e')]?_[_0x4c42('0x1f')](_0x1e9da2[_0x4c42('0x19')]['include'],function(_0x1ee429){return{'model':db[_0x1ee429[_0x4c42('0x20')]],'as':_0x1ee429['as'],'attributes':_0x1ee429[_0x4c42('0x1c')],'include':_0x1ee429['include']?_['map'](_0x1ee429['include'],function(_0x50c77b){return{'model':db[_0x50c77b[_0x4c42('0x20')]],'as':_0x50c77b['as'],'attributes':_0x50c77b[_0x4c42('0x1c')],'include':_0x50c77b[_0x4c42('0x1e')]?_['map'](_0x50c77b[_0x4c42('0x1e')],function(_0x5a02c){return{'model':db[_0x5a02c['model']],'as':_0x5a02c['as'],'attributes':_0x5a02c[_0x4c42('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b1685){logger[_0x4c42('0xd')](_0x4c42('0x16'),_0x1e9da2);logger['debug'](_0x4c42('0x16'),_0x1e9da2,JSON[_0x4c42('0x11')](_0x1b1685));_0x3da70c(_0x1b1685);})[_0x4c42('0x21')](function(_0x10a096){logger[_0x4c42('0x12')](_0x4c42('0x16'),_0x10a096[_0x4c42('0x14')],_0x1e9da2);_0x31e46b(_0x31d1a9[_0x4c42('0x12')](0x1f4,_0x10a096['message']));});});};exports['ShowDynamics365Account']=function(_0x4c8baa){var _0x3b8f0e=this;return new Promise(function(_0x169d10,_0x2c90cd){return db[_0x4c42('0x17')][_0x4c42('0x22')]({'raw':_0x4c8baa[_0x4c42('0x19')]?_0x4c8baa[_0x4c42('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4c8baa['options']?_0x4c8baa[_0x4c42('0x19')]['where']||null:null,'attributes':_0x4c8baa['options']?_0x4c8baa[_0x4c42('0x19')]['attributes']||null:null,'include':_0x4c8baa[_0x4c42('0x19')]?_0x4c8baa[_0x4c42('0x19')]['include']?_['map'](_0x4c8baa['options'][_0x4c42('0x1e')],function(_0x2937f6){return{'model':db[_0x2937f6[_0x4c42('0x20')]],'as':_0x2937f6['as'],'attributes':_0x2937f6['attributes'],'include':_0x2937f6[_0x4c42('0x1e')]?_[_0x4c42('0x1f')](_0x2937f6[_0x4c42('0x1e')],function(_0x5391f2){return{'model':db[_0x5391f2[_0x4c42('0x20')]],'as':_0x5391f2['as'],'attributes':_0x5391f2[_0x4c42('0x1c')],'include':_0x5391f2['include']?_[_0x4c42('0x1f')](_0x5391f2['include'],function(_0x269c22){return{'model':db[_0x269c22[_0x4c42('0x20')]],'as':_0x269c22['as'],'attributes':_0x269c22[_0x4c42('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4c42('0xc')](function(_0x2064b5){logger['info'](_0x4c42('0x23'),_0x4c8baa);logger[_0x4c42('0xf')](_0x4c42('0x23'),_0x4c8baa,JSON[_0x4c42('0x11')](_0x2064b5));_0x169d10(_0x2064b5);})[_0x4c42('0x21')](function(_0x2e7d29){logger[_0x4c42('0x12')](_0x4c42('0x23'),_0x2e7d29[_0x4c42('0x14')],_0x4c8baa);_0x2c90cd(_0x3b8f0e[_0x4c42('0x12')](0x1f4,_0x2e7d29[_0x4c42('0x14')]));});});}; \ No newline at end of file +var _0x43b9=['limit','include','map','model','then','stringify','find','raw','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes'];(function(_0x1df099,_0x353123){var _0x35f53f=function(_0x7d55fd){while(--_0x7d55fd){_0x1df099['push'](_0x1df099['shift']());}};_0x35f53f(++_0x353123);}(_0x43b9,0xb8));var _0x943b=function(_0x432e0e,_0x5c8e70){_0x432e0e=_0x432e0e-0x0;var _0x29ae3e=_0x43b9[_0x432e0e];return _0x29ae3e;};'use strict';var _=require('lodash');var util=require(_0x943b('0x0'));var moment=require(_0x943b('0x1'));var BPromise=require(_0x943b('0x2'));var rs=require(_0x943b('0x3'));var fs=require('fs');var Redis=require(_0x943b('0x4'));var db=require(_0x943b('0x5'))['db'];var utils=require(_0x943b('0x6'));var logger=require(_0x943b('0x7'))(_0x943b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x943b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a80f0,_0xcb0a9b,_0x493c07){return new BPromise(function(_0x471e0b,_0x1eeb2f){return client[_0x943b('0xa')](_0x4a80f0,_0x493c07)['then'](function(_0x164d47){logger[_0x943b('0xb')](_0x943b('0xc'),_0xcb0a9b,'request\x20sent');logger[_0x943b('0xd')](_0x943b('0xe'),_0xcb0a9b,_0x943b('0xf'),JSON['stringify'](_0x164d47));if(_0x164d47['error']){if(_0x164d47[_0x943b('0x10')][_0x943b('0x11')]===0x1f4){logger[_0x943b('0x10')](_0x943b('0xc'),_0xcb0a9b,_0x164d47['error'][_0x943b('0x12')]);return _0x1eeb2f(_0x164d47['error'][_0x943b('0x12')]);}logger[_0x943b('0x10')](_0x943b('0xc'),_0xcb0a9b,_0x164d47[_0x943b('0x10')][_0x943b('0x12')]);return _0x471e0b(_0x164d47['error'][_0x943b('0x12')]);}else{logger[_0x943b('0xb')](_0x943b('0xc'),_0xcb0a9b,_0x943b('0xf'));_0x471e0b(_0x164d47['result'][_0x943b('0x12')]);}})[_0x943b('0x13')](function(_0x246890){logger[_0x943b('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0xcb0a9b,_0x246890);_0x1eeb2f(_0x246890);});});}exports[_0x943b('0x14')]=function(_0x205cde){var _0x1bc2b9=this;return new Promise(function(_0x1da1fc,_0x23987a){return db[_0x943b('0x15')][_0x943b('0x16')]({'raw':_0x205cde['options']?_0x205cde[_0x943b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x205cde[_0x943b('0x17')]?_0x205cde[_0x943b('0x17')][_0x943b('0x18')]||null:null,'attributes':_0x205cde[_0x943b('0x17')]?_0x205cde[_0x943b('0x17')][_0x943b('0x19')]||null:null,'limit':_0x205cde[_0x943b('0x17')]?_0x205cde['options'][_0x943b('0x1a')]||null:null,'include':_0x205cde['options']?_0x205cde['options'][_0x943b('0x1b')]?_[_0x943b('0x1c')](_0x205cde[_0x943b('0x17')][_0x943b('0x1b')],function(_0x4623da){return{'model':db[_0x4623da[_0x943b('0x1d')]],'as':_0x4623da['as'],'attributes':_0x4623da[_0x943b('0x19')],'include':_0x4623da[_0x943b('0x1b')]?_['map'](_0x4623da[_0x943b('0x1b')],function(_0x119d83){return{'model':db[_0x119d83[_0x943b('0x1d')]],'as':_0x119d83['as'],'attributes':_0x119d83['attributes'],'include':_0x119d83[_0x943b('0x1b')]?_['map'](_0x119d83[_0x943b('0x1b')],function(_0x29f715){return{'model':db[_0x29f715['model']],'as':_0x29f715['as'],'attributes':_0x29f715[_0x943b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x943b('0x1e')](function(_0x5e268c){logger[_0x943b('0xb')](_0x943b('0x14'),_0x205cde);logger[_0x943b('0xd')](_0x943b('0x14'),_0x205cde,JSON[_0x943b('0x1f')](_0x5e268c));_0x1da1fc(_0x5e268c);})['catch'](function(_0x495324){logger[_0x943b('0x10')](_0x943b('0x14'),_0x495324[_0x943b('0x12')],_0x205cde);_0x23987a(_0x1bc2b9[_0x943b('0x10')](0x1f4,_0x495324[_0x943b('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x3451fa){var _0x39298b=this;return new Promise(function(_0x36836d,_0xd9e64f){return db[_0x943b('0x15')][_0x943b('0x20')]({'raw':_0x3451fa['options']?_0x3451fa['options'][_0x943b('0x21')]===undefined?!![]:![]:!![],'where':_0x3451fa[_0x943b('0x17')]?_0x3451fa[_0x943b('0x17')][_0x943b('0x18')]||null:null,'attributes':_0x3451fa[_0x943b('0x17')]?_0x3451fa[_0x943b('0x17')][_0x943b('0x19')]||null:null,'include':_0x3451fa[_0x943b('0x17')]?_0x3451fa[_0x943b('0x17')][_0x943b('0x1b')]?_[_0x943b('0x1c')](_0x3451fa[_0x943b('0x17')][_0x943b('0x1b')],function(_0x555b40){return{'model':db[_0x555b40[_0x943b('0x1d')]],'as':_0x555b40['as'],'attributes':_0x555b40[_0x943b('0x19')],'include':_0x555b40[_0x943b('0x1b')]?_[_0x943b('0x1c')](_0x555b40[_0x943b('0x1b')],function(_0x19c861){return{'model':db[_0x19c861[_0x943b('0x1d')]],'as':_0x19c861['as'],'attributes':_0x19c861['attributes'],'include':_0x19c861[_0x943b('0x1b')]?_['map'](_0x19c861[_0x943b('0x1b')],function(_0x1c7c7b){return{'model':db[_0x1c7c7b['model']],'as':_0x1c7c7b['as'],'attributes':_0x1c7c7b[_0x943b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f1411){logger[_0x943b('0xb')](_0x943b('0x22'),_0x3451fa);logger[_0x943b('0xd')](_0x943b('0x22'),_0x3451fa,JSON[_0x943b('0x1f')](_0x4f1411));_0x36836d(_0x4f1411);})[_0x943b('0x13')](function(_0x52186){logger[_0x943b('0x10')](_0x943b('0x22'),_0x52186[_0x943b('0x12')],_0x3451fa);_0xd9e64f(_0x39298b[_0x943b('0x10')](0x1f4,_0x52186[_0x943b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6bab920..f7ae078 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d2b=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete'];(function(_0x20f2b4,_0x587695){var _0x4da674=function(_0x170272){while(--_0x170272){_0x20f2b4['push'](_0x20f2b4['shift']());}};_0x4da674(++_0x587695);}(_0x8d2b,0x1c9));var _0xb8d2=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x8d2b[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0xb8d2('0x0'));var util=require(_0xb8d2('0x1'));var path=require(_0xb8d2('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8d2('0x3'));var router=express[_0xb8d2('0x4')]();var fs_extra=require(_0xb8d2('0x5'));var auth=require(_0xb8d2('0x6'));var interaction=require(_0xb8d2('0x7'));var config=require(_0xb8d2('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0xb8d2('0x9')]('/',auth[_0xb8d2('0xa')](),controller[_0xb8d2('0xb')]);router[_0xb8d2('0x9')](_0xb8d2('0xc'),auth[_0xb8d2('0xa')](),controller['show']);router[_0xb8d2('0x9')](_0xb8d2('0xd'),auth[_0xb8d2('0xa')](),controller[_0xb8d2('0xe')]);router[_0xb8d2('0x9')](_0xb8d2('0xf'),auth[_0xb8d2('0xa')](),controller[_0xb8d2('0x10')]);router['get'](_0xb8d2('0x11'),auth[_0xb8d2('0xa')](),controller[_0xb8d2('0x12')]);router[_0xb8d2('0x13')]('/',auth[_0xb8d2('0xa')](),controller[_0xb8d2('0x14')]);router[_0xb8d2('0x15')]('/:id',auth[_0xb8d2('0xa')](),controller['update']);router[_0xb8d2('0x16')](_0xb8d2('0xc'),auth[_0xb8d2('0xa')](),controller['destroy']);module[_0xb8d2('0x17')]=router; \ No newline at end of file +var _0x9355=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x171674,_0x222339){var _0x31695e=function(_0x1c4b50){while(--_0x1c4b50){_0x171674['push'](_0x171674['shift']());}};_0x31695e(++_0x222339);}(_0x9355,0x136));var _0x5935=function(_0x7750d6,_0x254544){_0x7750d6=_0x7750d6-0x0;var _0x24d6c9=_0x9355[_0x7750d6];return _0x24d6c9;};'use strict';var multer=require(_0x5935('0x0'));var util=require(_0x5935('0x1'));var path=require('path');var timeout=require(_0x5935('0x2'));var express=require(_0x5935('0x3'));var router=express[_0x5935('0x4')]();var fs_extra=require(_0x5935('0x5'));var auth=require(_0x5935('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5935('0x7'));var controller=require(_0x5935('0x8'));router[_0x5935('0x9')]('/',auth[_0x5935('0xa')](),controller[_0x5935('0xb')]);router[_0x5935('0x9')](_0x5935('0xc'),auth['isAuthenticated'](),controller[_0x5935('0xd')]);router[_0x5935('0x9')]('/:id/fields',auth[_0x5935('0xa')](),controller['getFields']);router[_0x5935('0x9')](_0x5935('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x5935('0x9')](_0x5935('0xf'),auth[_0x5935('0xa')](),controller[_0x5935('0x10')]);router[_0x5935('0x11')]('/',auth['isAuthenticated'](),controller[_0x5935('0x12')]);router[_0x5935('0x13')](_0x5935('0xc'),auth['isAuthenticated'](),controller[_0x5935('0x14')]);router[_0x5935('0x15')](_0x5935('0xc'),auth[_0x5935('0xa')](),controller[_0x5935('0x16')]);module[_0x5935('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 054477d..8c6b722 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d89=['sequelize','exports','STRING','phonecall','incident','ENUM','nothing','contact','BOOLEAN'];(function(_0x14425a,_0x302544){var _0x39305e=function(_0x4a9411){while(--_0x4a9411){_0x14425a['push'](_0x14425a['shift']());}};_0x39305e(++_0x302544);}(_0x9d89,0xb4));var _0x99d8=function(_0x1573e8,_0x23ea5a){_0x1573e8=_0x1573e8-0x0;var _0x2a70a0=_0x9d89[_0x1573e8];return _0x2a70a0;};'use strict';var Sequelize=require(_0x99d8('0x0'));module[_0x99d8('0x1')]={'name':{'type':Sequelize[_0x99d8('0x2')]},'description':{'type':Sequelize[_0x99d8('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x99d8('0x3')),'defaultValue':_0x99d8('0x4')},'moduleCreate':{'type':Sequelize[_0x99d8('0x5')]('contact',_0x99d8('0x6')),'defaultValue':_0x99d8('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x99d8('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x99d8('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1c2b=['ENUM','phonecall','incident','nothing','contact','BOOLEAN','sequelize','exports','STRING'];(function(_0x4d6cd3,_0x4490b6){var _0x4fde97=function(_0x36e801){while(--_0x36e801){_0x4d6cd3['push'](_0x4d6cd3['shift']());}};_0x4fde97(++_0x4490b6);}(_0x1c2b,0x11d));var _0xb1c2=function(_0x1e01ca,_0x14dc80){_0x1e01ca=_0x1e01ca-0x0;var _0x318e7f=_0x1c2b[_0x1e01ca];return _0x318e7f;};'use strict';var Sequelize=require(_0xb1c2('0x0'));module[_0xb1c2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb1c2('0x2')]},'ticketType':{'type':Sequelize[_0xb1c2('0x3')]('incident',_0xb1c2('0x4')),'defaultValue':_0xb1c2('0x5')},'moduleCreate':{'type':Sequelize[_0xb1c2('0x3')]('contact',_0xb1c2('0x6')),'defaultValue':_0xb1c2('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb1c2('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xb1c2('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index b04003b..12b942d 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe10=['type','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','params','find','body','getFields','pick','getSubjects','Dynamics365Field','findOne','getDescriptions','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','key','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where'];(function(_0x33cf1f,_0x3c98ad){var _0x780fd8=function(_0x53303a){while(--_0x53303a){_0x33cf1f['push'](_0x33cf1f['shift']());}};_0x780fd8(++_0x3c98ad);}(_0xfe10,0xac));var _0x0fe1=function(_0x802bd0,_0x147948){_0x802bd0=_0x802bd0-0x0;var _0x36e77a=_0xfe10[_0x802bd0];return _0x36e77a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fe1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe1('0x1'));var rp=require('request-promise');var moment=require(_0x0fe1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0fe1('0x3'));var util=require(_0x0fe1('0x4'));var path=require('path');var sox=require(_0x0fe1('0x5'));var csv=require(_0x0fe1('0x6'));var ejs=require(_0x0fe1('0x7'));var fs=require('fs');var fs_extra=require(_0x0fe1('0x8'));var _=require(_0x0fe1('0x9'));var squel=require(_0x0fe1('0xa'));var crypto=require('crypto');var jsforce=require(_0x0fe1('0xb'));var deskjs=require(_0x0fe1('0xc'));var toCsv=require(_0x0fe1('0x6'));var querystring=require(_0x0fe1('0xd'));var Papa=require('papaparse');var Redis=require(_0x0fe1('0xe'));var authService=require(_0x0fe1('0xf'));var qs=require(_0x0fe1('0x10'));var as=require(_0x0fe1('0x11'));var hardwareService=require(_0x0fe1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0fe1('0x13'));var config=require(_0x0fe1('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26b3c4,_0x1bc5fb){_0x1bc5fb=_0x1bc5fb||0xcc;return function(_0x25f3bc){if(_0x25f3bc){return _0x26b3c4[_0x0fe1('0x15')](_0x1bc5fb);}return _0x26b3c4[_0x0fe1('0x16')](_0x1bc5fb)[_0x0fe1('0x17')]();};}function respondWithResult(_0x17657f,_0x40d199){_0x40d199=_0x40d199||0xc8;return function(_0x5b6f01){if(_0x5b6f01){return _0x17657f[_0x0fe1('0x16')](_0x40d199)[_0x0fe1('0x18')](_0x5b6f01);}};}function respondWithFilteredResult(_0x2fadca,_0x43345c){return function(_0x14334a){if(_0x14334a){var _0x3a594d=typeof _0x43345c[_0x0fe1('0x19')]===_0x0fe1('0x1a')&&typeof _0x43345c['limit']===_0x0fe1('0x1a');var _0x3a2578=_0x14334a['count'];var _0x2abbea=_0x3a594d?0x0:_0x43345c['offset'];var _0x56d9e7=_0x3a594d?_0x14334a[_0x0fe1('0x1b')]:_0x43345c[_0x0fe1('0x19')]+_0x43345c['limit'];var _0x423923;if(_0x56d9e7>=_0x3a2578){_0x56d9e7=_0x3a2578;_0x423923=0xc8;}else{_0x423923=0xce;}_0x2fadca[_0x0fe1('0x16')](_0x423923);return _0x2fadca['set'](_0x0fe1('0x1c'),_0x2abbea+'-'+_0x56d9e7+'/'+_0x3a2578)[_0x0fe1('0x18')](_0x14334a);}return null;};}function patchUpdates(_0xecb6ba){return function(_0x494458){try{jsonpatch[_0x0fe1('0x1d')](_0x494458,_0xecb6ba,!![]);}catch(_0x534256){return BPromise[_0x0fe1('0x1e')](_0x534256);}return _0x494458[_0x0fe1('0x1f')]();};}function saveUpdates(_0x21d111,_0x22c472){return function(_0xbc6358){if(_0xbc6358){return _0xbc6358[_0x0fe1('0x20')](_0x21d111)[_0x0fe1('0x21')](function(_0xa53661){return _0xa53661;});}return null;};}function removeEntity(_0x379aa6,_0x592c48){return function(_0x1110ae){if(_0x1110ae){return _0x1110ae[_0x0fe1('0x22')]()[_0x0fe1('0x21')](function(){_0x379aa6['status'](0xcc)[_0x0fe1('0x17')]();});}};}function handleEntityNotFound(_0x344789,_0x2feb94){return function(_0x18a3f4){if(!_0x18a3f4){_0x344789[_0x0fe1('0x15')](0x194);}return _0x18a3f4;};}function handleError(_0x37bb3d,_0x4e9a3a){_0x4e9a3a=_0x4e9a3a||0x1f4;return function(_0x10a331){logger[_0x0fe1('0x23')](_0x10a331[_0x0fe1('0x24')]);if(_0x10a331['name']){delete _0x10a331['name'];}_0x37bb3d['status'](_0x4e9a3a)[_0x0fe1('0x25')](_0x10a331);};}exports[_0x0fe1('0x26')]=function(_0x5e3985,_0x5eedb8){var _0x3c61e5={},_0x407b92={},_0x4e2184={'count':0x0,'rows':[]};var _0x3736d1=_[_0x0fe1('0x27')](db['Dynamics365Configuration'][_0x0fe1('0x28')],function(_0x7ea0c){return{'name':_0x7ea0c[_0x0fe1('0x29')],'type':_0x7ea0c['type'][_0x0fe1('0x2a')]};});_0x407b92['model']=_[_0x0fe1('0x27')](_0x3736d1,_0x0fe1('0x2b'));_0x407b92[_0x0fe1('0x2c')]=_[_0x0fe1('0x2d')](_0x5e3985['query']);_0x407b92['filters']=_[_0x0fe1('0x2e')](_0x407b92[_0x0fe1('0x2f')],_0x407b92[_0x0fe1('0x2c')]);_0x3c61e5['attributes']=_['intersection'](_0x407b92['model'],qs[_0x0fe1('0x30')](_0x5e3985[_0x0fe1('0x2c')][_0x0fe1('0x30')]));_0x3c61e5['attributes']=_0x3c61e5[_0x0fe1('0x31')][_0x0fe1('0x32')]?_0x3c61e5[_0x0fe1('0x31')]:_0x407b92[_0x0fe1('0x2f')];if(!_0x5e3985[_0x0fe1('0x2c')][_0x0fe1('0x33')](_0x0fe1('0x34'))){_0x3c61e5[_0x0fe1('0x35')]=qs[_0x0fe1('0x35')](_0x5e3985[_0x0fe1('0x2c')][_0x0fe1('0x35')]);_0x3c61e5[_0x0fe1('0x19')]=qs[_0x0fe1('0x19')](_0x5e3985[_0x0fe1('0x2c')][_0x0fe1('0x19')]);}_0x3c61e5[_0x0fe1('0x36')]=qs[_0x0fe1('0x37')](_0x5e3985['query']['sort']);_0x3c61e5['where']=qs[_0x0fe1('0x38')](_['pick'](_0x5e3985['query'],_0x407b92[_0x0fe1('0x38')]),_0x3736d1);if(_0x5e3985[_0x0fe1('0x2c')][_0x0fe1('0x39')]){_0x3c61e5[_0x0fe1('0x3a')]=_['merge'](_0x3c61e5['where'],{'$or':_[_0x0fe1('0x27')](_0x3736d1,function(_0x31a8db){if(_0x31a8db[_0x0fe1('0x3b')]!=='VIRTUAL'){var _0x2c1829={};_0x2c1829[_0x31a8db[_0x0fe1('0x2b')]]={'$like':'%'+_0x5e3985[_0x0fe1('0x2c')][_0x0fe1('0x39')]+'%'};return _0x2c1829;}})});}_0x3c61e5=_[_0x0fe1('0x3c')]({},_0x3c61e5,_0x5e3985[_0x0fe1('0x3d')]);var _0x3b4e19={'where':_0x3c61e5[_0x0fe1('0x3a')]};return db[_0x0fe1('0x3e')]['count'](_0x3b4e19)['then'](function(_0x32b753){_0x4e2184[_0x0fe1('0x1b')]=_0x32b753;if(_0x5e3985['query'][_0x0fe1('0x3f')]){_0x3c61e5[_0x0fe1('0x40')]=[{'all':!![]}];}return db[_0x0fe1('0x3e')][_0x0fe1('0x41')](_0x3c61e5);})[_0x0fe1('0x21')](function(_0x2f933d){_0x4e2184[_0x0fe1('0x42')]=_0x2f933d;return _0x4e2184;})[_0x0fe1('0x21')](respondWithFilteredResult(_0x5eedb8,_0x3c61e5))[_0x0fe1('0x43')](handleError(_0x5eedb8,null));};exports['show']=function(_0x30c948,_0x1ff6d7){var _0x1ca0d2={'raw':![],'where':{'id':_0x30c948[_0x0fe1('0x44')]['id']}},_0x23a019={};_0x23a019[_0x0fe1('0x2f')]=_['keys'](db[_0x0fe1('0x3e')][_0x0fe1('0x28')]);_0x23a019[_0x0fe1('0x2c')]=_[_0x0fe1('0x2d')](_0x30c948[_0x0fe1('0x2c')]);_0x23a019[_0x0fe1('0x38')]=_[_0x0fe1('0x2e')](_0x23a019[_0x0fe1('0x2f')],_0x23a019[_0x0fe1('0x2c')]);_0x1ca0d2[_0x0fe1('0x31')]=_['intersection'](_0x23a019[_0x0fe1('0x2f')],qs[_0x0fe1('0x30')](_0x30c948[_0x0fe1('0x2c')][_0x0fe1('0x30')]));_0x1ca0d2[_0x0fe1('0x31')]=_0x1ca0d2[_0x0fe1('0x31')][_0x0fe1('0x32')]?_0x1ca0d2[_0x0fe1('0x31')]:_0x23a019[_0x0fe1('0x2f')];if(_0x30c948[_0x0fe1('0x2c')][_0x0fe1('0x3f')]){_0x1ca0d2['include']=[{'all':!![]}];}_0x1ca0d2=_[_0x0fe1('0x3c')]({},_0x1ca0d2,_0x30c948['options']);return db[_0x0fe1('0x3e')][_0x0fe1('0x45')](_0x1ca0d2)[_0x0fe1('0x21')](handleEntityNotFound(_0x1ff6d7,null))[_0x0fe1('0x21')](respondWithResult(_0x1ff6d7,null))[_0x0fe1('0x43')](handleError(_0x1ff6d7,null));};exports['create']=function(_0xcf1055,_0x441386){return db[_0x0fe1('0x3e')]['create'](_0xcf1055[_0x0fe1('0x46')],{})[_0x0fe1('0x21')](respondWithResult(_0x441386,0xc9))[_0x0fe1('0x43')](handleError(_0x441386,null));};exports[_0x0fe1('0x20')]=function(_0x1998c5,_0x3fed3f){if(_0x1998c5['body']['id']){delete _0x1998c5['body']['id'];}return db[_0x0fe1('0x3e')][_0x0fe1('0x45')]({'where':{'id':_0x1998c5[_0x0fe1('0x44')]['id']}})[_0x0fe1('0x21')](handleEntityNotFound(_0x3fed3f,null))['then'](saveUpdates(_0x1998c5['body'],null))[_0x0fe1('0x21')](respondWithResult(_0x3fed3f,null))[_0x0fe1('0x43')](handleError(_0x3fed3f,null));};exports[_0x0fe1('0x22')]=function(_0x3102fd,_0x5ed922){return db[_0x0fe1('0x3e')][_0x0fe1('0x45')]({'where':{'id':_0x3102fd[_0x0fe1('0x44')]['id']}})[_0x0fe1('0x21')](handleEntityNotFound(_0x5ed922,null))[_0x0fe1('0x21')](removeEntity(_0x5ed922,null))[_0x0fe1('0x43')](handleError(_0x5ed922,null));};exports[_0x0fe1('0x47')]=function(_0x2ffc4b,_0x2e14b4,_0x319f3a){var _0x11b266={};var _0x68cd15={};var _0x190814;var _0xaa99c9;return db[_0x0fe1('0x3e')]['findOne']({'where':{'id':_0x2ffc4b[_0x0fe1('0x44')]['id']}})[_0x0fe1('0x21')](handleEntityNotFound(_0x2e14b4,null))[_0x0fe1('0x21')](function(_0x1fb4bc){if(_0x1fb4bc){_0x190814=_0x1fb4bc;_0x68cd15['model']=_[_0x0fe1('0x2d')](db['Dynamics365Field'][_0x0fe1('0x28')]);_0x68cd15['query']=_[_0x0fe1('0x2d')](_0x2ffc4b['query']);_0x68cd15[_0x0fe1('0x38')]=_[_0x0fe1('0x2e')](_0x68cd15[_0x0fe1('0x2f')],_0x68cd15[_0x0fe1('0x2c')]);_0x11b266[_0x0fe1('0x31')]=_[_0x0fe1('0x2e')](_0x68cd15[_0x0fe1('0x2f')],qs[_0x0fe1('0x30')](_0x2ffc4b[_0x0fe1('0x2c')][_0x0fe1('0x30')]));_0x11b266[_0x0fe1('0x31')]=_0x11b266[_0x0fe1('0x31')][_0x0fe1('0x32')]?_0x11b266[_0x0fe1('0x31')]:_0x68cd15[_0x0fe1('0x2f')];_0x11b266['order']=qs[_0x0fe1('0x37')](_0x2ffc4b[_0x0fe1('0x2c')][_0x0fe1('0x37')]);_0x11b266[_0x0fe1('0x3a')]=qs[_0x0fe1('0x38')](_[_0x0fe1('0x48')](_0x2ffc4b[_0x0fe1('0x2c')],_0x68cd15['filters']));if(_0x2ffc4b[_0x0fe1('0x2c')][_0x0fe1('0x39')]){_0x11b266['where']=_[_0x0fe1('0x3c')](_0x11b266[_0x0fe1('0x3a')],{'$or':_[_0x0fe1('0x27')](_0x11b266[_0x0fe1('0x31')],function(_0x12e4e6){var _0x249de6={};_0x249de6[_0x12e4e6]={'$like':'%'+_0x2ffc4b[_0x0fe1('0x2c')][_0x0fe1('0x39')]+'%'};return _0x249de6;})});}_0x11b266=_[_0x0fe1('0x3c')]({},_0x11b266,_0x2ffc4b[_0x0fe1('0x3d')]);return _0x190814['getFields'](_0x11b266);}})[_0x0fe1('0x21')](function(_0x58ae7c){if(_0x58ae7c){_0xaa99c9=_0x58ae7c[_0x0fe1('0x32')];if(!_0x2ffc4b[_0x0fe1('0x2c')][_0x0fe1('0x33')](_0x0fe1('0x34'))){_0x11b266['limit']=qs['limit'](_0x2ffc4b[_0x0fe1('0x2c')]['limit']);_0x11b266[_0x0fe1('0x19')]=qs[_0x0fe1('0x19')](_0x2ffc4b['query'][_0x0fe1('0x19')]);}return _0x190814['getFields'](_0x11b266);}})[_0x0fe1('0x21')](function(_0x3c7b13){if(_0x3c7b13){return _0x3c7b13?{'count':_0xaa99c9,'rows':_0x3c7b13}:null;}})['then'](respondWithResult(_0x2e14b4,null))[_0x0fe1('0x43')](handleError(_0x2e14b4,null));};exports[_0x0fe1('0x49')]=function(_0x377e72,_0x2bce53,_0x2550fb){var _0x174736={};var _0x290895={};var _0x174e48;var _0x5c1a1a;return db[_0x0fe1('0x3e')]['findOne']({'where':{'id':_0x377e72[_0x0fe1('0x44')]['id']}})[_0x0fe1('0x21')](handleEntityNotFound(_0x2bce53,null))[_0x0fe1('0x21')](function(_0x40715d){if(_0x40715d){_0x174e48=_0x40715d;_0x290895['model']=_[_0x0fe1('0x2d')](db[_0x0fe1('0x4a')]['rawAttributes']);_0x290895[_0x0fe1('0x2c')]=_[_0x0fe1('0x2d')](_0x377e72['query']);_0x290895[_0x0fe1('0x38')]=_['intersection'](_0x290895[_0x0fe1('0x2f')],_0x290895[_0x0fe1('0x2c')]);_0x174736[_0x0fe1('0x31')]=_[_0x0fe1('0x2e')](_0x290895['model'],qs['fields'](_0x377e72['query'][_0x0fe1('0x30')]));_0x174736[_0x0fe1('0x31')]=_0x174736[_0x0fe1('0x31')][_0x0fe1('0x32')]?_0x174736['attributes']:_0x290895[_0x0fe1('0x2f')];_0x174736['order']=qs['sort'](_0x377e72[_0x0fe1('0x2c')]['sort']);_0x174736[_0x0fe1('0x3a')]=qs[_0x0fe1('0x38')](_[_0x0fe1('0x48')](_0x377e72[_0x0fe1('0x2c')],_0x290895[_0x0fe1('0x38')]));if(_0x377e72[_0x0fe1('0x2c')]['filter']){_0x174736[_0x0fe1('0x3a')]=_['merge'](_0x174736[_0x0fe1('0x3a')],{'$or':_[_0x0fe1('0x27')](_0x174736[_0x0fe1('0x31')],function(_0x31f088){var _0x46b92f={};_0x46b92f[_0x31f088]={'$like':'%'+_0x377e72['query'][_0x0fe1('0x39')]+'%'};return _0x46b92f;})});}_0x174736=_[_0x0fe1('0x3c')]({},_0x174736,_0x377e72[_0x0fe1('0x3d')]);return _0x174e48[_0x0fe1('0x49')](_0x174736);}})['then'](function(_0x25d3cf){if(_0x25d3cf){_0x5c1a1a=_0x25d3cf[_0x0fe1('0x32')];if(!_0x377e72[_0x0fe1('0x2c')][_0x0fe1('0x33')](_0x0fe1('0x34'))){_0x174736[_0x0fe1('0x35')]=qs[_0x0fe1('0x35')](_0x377e72['query'][_0x0fe1('0x35')]);_0x174736[_0x0fe1('0x19')]=qs[_0x0fe1('0x19')](_0x377e72[_0x0fe1('0x2c')][_0x0fe1('0x19')]);}return _0x174e48[_0x0fe1('0x49')](_0x174736);}})[_0x0fe1('0x21')](function(_0x3c0002){if(_0x3c0002){return _0x3c0002?{'count':_0x5c1a1a,'rows':_0x3c0002}:null;}})[_0x0fe1('0x21')](respondWithResult(_0x2bce53,null))[_0x0fe1('0x43')](handleError(_0x2bce53,null));};exports['getDescriptions']=function(_0x10052e,_0x5b9ef8,_0x489538){var _0x406c8b={};var _0x3014af={};var _0x456e17;var _0x284066;return db[_0x0fe1('0x3e')][_0x0fe1('0x4b')]({'where':{'id':_0x10052e[_0x0fe1('0x44')]['id']}})[_0x0fe1('0x21')](handleEntityNotFound(_0x5b9ef8,null))[_0x0fe1('0x21')](function(_0x2dc95){if(_0x2dc95){_0x456e17=_0x2dc95;_0x3014af[_0x0fe1('0x2f')]=_[_0x0fe1('0x2d')](db[_0x0fe1('0x4a')]['rawAttributes']);_0x3014af[_0x0fe1('0x2c')]=_[_0x0fe1('0x2d')](_0x10052e['query']);_0x3014af[_0x0fe1('0x38')]=_[_0x0fe1('0x2e')](_0x3014af[_0x0fe1('0x2f')],_0x3014af['query']);_0x406c8b[_0x0fe1('0x31')]=_[_0x0fe1('0x2e')](_0x3014af[_0x0fe1('0x2f')],qs[_0x0fe1('0x30')](_0x10052e['query'][_0x0fe1('0x30')]));_0x406c8b[_0x0fe1('0x31')]=_0x406c8b[_0x0fe1('0x31')]['length']?_0x406c8b[_0x0fe1('0x31')]:_0x3014af[_0x0fe1('0x2f')];_0x406c8b['order']=qs[_0x0fe1('0x37')](_0x10052e[_0x0fe1('0x2c')][_0x0fe1('0x37')]);_0x406c8b[_0x0fe1('0x3a')]=qs[_0x0fe1('0x38')](_[_0x0fe1('0x48')](_0x10052e['query'],_0x3014af['filters']));if(_0x10052e[_0x0fe1('0x2c')][_0x0fe1('0x39')]){_0x406c8b[_0x0fe1('0x3a')]=_[_0x0fe1('0x3c')](_0x406c8b[_0x0fe1('0x3a')],{'$or':_[_0x0fe1('0x27')](_0x406c8b[_0x0fe1('0x31')],function(_0x249734){var _0x2c2d05={};_0x2c2d05[_0x249734]={'$like':'%'+_0x10052e['query'][_0x0fe1('0x39')]+'%'};return _0x2c2d05;})});}_0x406c8b=_[_0x0fe1('0x3c')]({},_0x406c8b,_0x10052e['options']);return _0x456e17[_0x0fe1('0x4c')](_0x406c8b);}})[_0x0fe1('0x21')](function(_0x183ac8){if(_0x183ac8){_0x284066=_0x183ac8[_0x0fe1('0x32')];if(!_0x10052e['query'][_0x0fe1('0x33')](_0x0fe1('0x34'))){_0x406c8b[_0x0fe1('0x35')]=qs[_0x0fe1('0x35')](_0x10052e[_0x0fe1('0x2c')][_0x0fe1('0x35')]);_0x406c8b[_0x0fe1('0x19')]=qs[_0x0fe1('0x19')](_0x10052e[_0x0fe1('0x2c')]['offset']);}return _0x456e17[_0x0fe1('0x4c')](_0x406c8b);}})[_0x0fe1('0x21')](function(_0x31881c){if(_0x31881c){return _0x31881c?{'count':_0x284066,'rows':_0x31881c}:null;}})[_0x0fe1('0x21')](respondWithResult(_0x5b9ef8,null))['catch'](handleError(_0x5b9ef8,null));}; \ No newline at end of file +var _0x8cb1=['getFields','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','create','body','destroy','findOne','Dynamics365Field','pick'];(function(_0x511bf0,_0x193086){var _0x53513c=function(_0x356eb2){while(--_0x356eb2){_0x511bf0['push'](_0x511bf0['shift']());}};_0x53513c(++_0x193086);}(_0x8cb1,0x14c));var _0x18cb=function(_0x5afa63,_0x448c9a){_0x5afa63=_0x5afa63-0x0;var _0x48b070=_0x8cb1[_0x5afa63];return _0x48b070;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x18cb('0x0'));var zipdir=require(_0x18cb('0x1'));var jsonpatch=require(_0x18cb('0x2'));var rp=require(_0x18cb('0x3'));var moment=require(_0x18cb('0x4'));var BPromise=require(_0x18cb('0x5'));var Mustache=require(_0x18cb('0x6'));var util=require(_0x18cb('0x7'));var path=require(_0x18cb('0x8'));var sox=require(_0x18cb('0x9'));var csv=require(_0x18cb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18cb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x18cb('0xc'));var deskjs=require(_0x18cb('0xd'));var toCsv=require(_0x18cb('0xa'));var querystring=require(_0x18cb('0xe'));var Papa=require(_0x18cb('0xf'));var Redis=require(_0x18cb('0x10'));var authService=require(_0x18cb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18cb('0x12'));var logger=require(_0x18cb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x18cb('0x14'));var licenseUtil=require(_0x18cb('0x15'));var db=require(_0x18cb('0x16'))['db'];function respondWithStatusCode(_0x392161,_0x161649){_0x161649=_0x161649||0xcc;return function(_0x524f79){if(_0x524f79){return _0x392161[_0x18cb('0x17')](_0x161649);}return _0x392161[_0x18cb('0x18')](_0x161649)[_0x18cb('0x19')]();};}function respondWithResult(_0x251d09,_0x5e7a60){_0x5e7a60=_0x5e7a60||0xc8;return function(_0x5700c2){if(_0x5700c2){return _0x251d09[_0x18cb('0x18')](_0x5e7a60)[_0x18cb('0x1a')](_0x5700c2);}};}function respondWithFilteredResult(_0x3a7bc9,_0x575087){return function(_0x117a4c){if(_0x117a4c){var _0xaf254b=typeof _0x575087[_0x18cb('0x1b')]===_0x18cb('0x1c')&&typeof _0x575087[_0x18cb('0x1d')]==='undefined';var _0x1eeb8a=_0x117a4c[_0x18cb('0x1e')];var _0x5c9820=_0xaf254b?0x0:_0x575087[_0x18cb('0x1b')];var _0x30d3dc=_0xaf254b?_0x117a4c[_0x18cb('0x1e')]:_0x575087[_0x18cb('0x1b')]+_0x575087[_0x18cb('0x1d')];var _0x11f403;if(_0x30d3dc>=_0x1eeb8a){_0x30d3dc=_0x1eeb8a;_0x11f403=0xc8;}else{_0x11f403=0xce;}_0x3a7bc9['status'](_0x11f403);return _0x3a7bc9[_0x18cb('0x1f')](_0x18cb('0x20'),_0x5c9820+'-'+_0x30d3dc+'/'+_0x1eeb8a)[_0x18cb('0x1a')](_0x117a4c);}return null;};}function patchUpdates(_0x20c126){return function(_0x50f608){try{jsonpatch[_0x18cb('0x21')](_0x50f608,_0x20c126,!![]);}catch(_0x1bdb74){return BPromise[_0x18cb('0x22')](_0x1bdb74);}return _0x50f608[_0x18cb('0x23')]();};}function saveUpdates(_0x3e346c,_0x5d674f){return function(_0x1a3f51){if(_0x1a3f51){return _0x1a3f51[_0x18cb('0x24')](_0x3e346c)[_0x18cb('0x25')](function(_0x2699b9){return _0x2699b9;});}return null;};}function removeEntity(_0x449f33,_0x3f0ad2){return function(_0x482ef8){if(_0x482ef8){return _0x482ef8['destroy']()[_0x18cb('0x25')](function(){_0x449f33[_0x18cb('0x18')](0xcc)[_0x18cb('0x19')]();});}};}function handleEntityNotFound(_0x462a77,_0x175c7b){return function(_0x37fd5d){if(!_0x37fd5d){_0x462a77[_0x18cb('0x17')](0x194);}return _0x37fd5d;};}function handleError(_0x4b36d2,_0x377997){_0x377997=_0x377997||0x1f4;return function(_0x1257ab){logger['error'](_0x1257ab[_0x18cb('0x26')]);if(_0x1257ab[_0x18cb('0x27')]){delete _0x1257ab['name'];}_0x4b36d2[_0x18cb('0x18')](_0x377997)[_0x18cb('0x28')](_0x1257ab);};}exports[_0x18cb('0x29')]=function(_0x260b41,_0x9eeae4){var _0x4e48e8={},_0x3e52cd={},_0x14f2d4={'count':0x0,'rows':[]};var _0x1bd26e=_[_0x18cb('0x2a')](db[_0x18cb('0x2b')][_0x18cb('0x2c')],function(_0x259740){return{'name':_0x259740[_0x18cb('0x2d')],'type':_0x259740[_0x18cb('0x2e')][_0x18cb('0x2f')]};});_0x3e52cd[_0x18cb('0x30')]=_[_0x18cb('0x2a')](_0x1bd26e,'name');_0x3e52cd[_0x18cb('0x31')]=_['keys'](_0x260b41[_0x18cb('0x31')]);_0x3e52cd[_0x18cb('0x32')]=_['intersection'](_0x3e52cd[_0x18cb('0x30')],_0x3e52cd[_0x18cb('0x31')]);_0x4e48e8['attributes']=_[_0x18cb('0x33')](_0x3e52cd[_0x18cb('0x30')],qs[_0x18cb('0x34')](_0x260b41[_0x18cb('0x31')]['fields']));_0x4e48e8[_0x18cb('0x35')]=_0x4e48e8[_0x18cb('0x35')]['length']?_0x4e48e8[_0x18cb('0x35')]:_0x3e52cd[_0x18cb('0x30')];if(!_0x260b41['query']['hasOwnProperty'](_0x18cb('0x36'))){_0x4e48e8[_0x18cb('0x1d')]=qs[_0x18cb('0x1d')](_0x260b41[_0x18cb('0x31')][_0x18cb('0x1d')]);_0x4e48e8[_0x18cb('0x1b')]=qs[_0x18cb('0x1b')](_0x260b41[_0x18cb('0x31')][_0x18cb('0x1b')]);}_0x4e48e8[_0x18cb('0x37')]=qs[_0x18cb('0x38')](_0x260b41[_0x18cb('0x31')][_0x18cb('0x38')]);_0x4e48e8[_0x18cb('0x39')]=qs['filters'](_['pick'](_0x260b41[_0x18cb('0x31')],_0x3e52cd[_0x18cb('0x32')]),_0x1bd26e);if(_0x260b41[_0x18cb('0x31')][_0x18cb('0x3a')]){_0x4e48e8[_0x18cb('0x39')]=_[_0x18cb('0x3b')](_0x4e48e8['where'],{'$or':_[_0x18cb('0x2a')](_0x1bd26e,function(_0x4987f9){if(_0x4987f9[_0x18cb('0x2e')]!==_0x18cb('0x3c')){var _0x5f2f6e={};_0x5f2f6e[_0x4987f9['name']]={'$like':'%'+_0x260b41[_0x18cb('0x31')][_0x18cb('0x3a')]+'%'};return _0x5f2f6e;}})});}_0x4e48e8=_['merge']({},_0x4e48e8,_0x260b41['options']);var _0xb9cc1a={'where':_0x4e48e8[_0x18cb('0x39')]};return db[_0x18cb('0x2b')][_0x18cb('0x1e')](_0xb9cc1a)['then'](function(_0x5a412f){_0x14f2d4[_0x18cb('0x1e')]=_0x5a412f;if(_0x260b41['query']['includeAll']){_0x4e48e8[_0x18cb('0x3d')]=[{'all':!![]}];}return db[_0x18cb('0x2b')][_0x18cb('0x3e')](_0x4e48e8);})[_0x18cb('0x25')](function(_0x490c27){_0x14f2d4[_0x18cb('0x3f')]=_0x490c27;return _0x14f2d4;})[_0x18cb('0x25')](respondWithFilteredResult(_0x9eeae4,_0x4e48e8))[_0x18cb('0x40')](handleError(_0x9eeae4,null));};exports[_0x18cb('0x41')]=function(_0x5be70a,_0x2634d2){var _0x5a250e={'raw':![],'where':{'id':_0x5be70a[_0x18cb('0x42')]['id']}},_0x5a1906={};_0x5a1906[_0x18cb('0x30')]=_[_0x18cb('0x43')](db[_0x18cb('0x2b')][_0x18cb('0x2c')]);_0x5a1906['query']=_[_0x18cb('0x43')](_0x5be70a[_0x18cb('0x31')]);_0x5a1906[_0x18cb('0x32')]=_[_0x18cb('0x33')](_0x5a1906[_0x18cb('0x30')],_0x5a1906[_0x18cb('0x31')]);_0x5a250e[_0x18cb('0x35')]=_[_0x18cb('0x33')](_0x5a1906[_0x18cb('0x30')],qs[_0x18cb('0x34')](_0x5be70a['query']['fields']));_0x5a250e[_0x18cb('0x35')]=_0x5a250e[_0x18cb('0x35')][_0x18cb('0x44')]?_0x5a250e[_0x18cb('0x35')]:_0x5a1906[_0x18cb('0x30')];if(_0x5be70a[_0x18cb('0x31')][_0x18cb('0x45')]){_0x5a250e[_0x18cb('0x3d')]=[{'all':!![]}];}_0x5a250e=_[_0x18cb('0x3b')]({},_0x5a250e,_0x5be70a[_0x18cb('0x46')]);return db[_0x18cb('0x2b')][_0x18cb('0x47')](_0x5a250e)[_0x18cb('0x25')](handleEntityNotFound(_0x2634d2,null))[_0x18cb('0x25')](respondWithResult(_0x2634d2,null))[_0x18cb('0x40')](handleError(_0x2634d2,null));};exports['create']=function(_0x5ce841,_0x3fa7df){return db[_0x18cb('0x2b')][_0x18cb('0x48')](_0x5ce841[_0x18cb('0x49')],{})[_0x18cb('0x25')](respondWithResult(_0x3fa7df,0xc9))[_0x18cb('0x40')](handleError(_0x3fa7df,null));};exports[_0x18cb('0x24')]=function(_0x2d177f,_0x243030){if(_0x2d177f[_0x18cb('0x49')]['id']){delete _0x2d177f['body']['id'];}return db[_0x18cb('0x2b')][_0x18cb('0x47')]({'where':{'id':_0x2d177f[_0x18cb('0x42')]['id']}})[_0x18cb('0x25')](handleEntityNotFound(_0x243030,null))[_0x18cb('0x25')](saveUpdates(_0x2d177f[_0x18cb('0x49')],null))[_0x18cb('0x25')](respondWithResult(_0x243030,null))[_0x18cb('0x40')](handleError(_0x243030,null));};exports[_0x18cb('0x4a')]=function(_0x254d32,_0x7023d0){return db['Dynamics365Configuration'][_0x18cb('0x47')]({'where':{'id':_0x254d32[_0x18cb('0x42')]['id']}})[_0x18cb('0x25')](handleEntityNotFound(_0x7023d0,null))[_0x18cb('0x25')](removeEntity(_0x7023d0,null))[_0x18cb('0x40')](handleError(_0x7023d0,null));};exports['getFields']=function(_0x1f4ac9,_0x3571cb,_0x307304){var _0x36322b={};var _0x459b79={};var _0x53b942;var _0x45dbb6;return db[_0x18cb('0x2b')][_0x18cb('0x4b')]({'where':{'id':_0x1f4ac9['params']['id']}})[_0x18cb('0x25')](handleEntityNotFound(_0x3571cb,null))[_0x18cb('0x25')](function(_0x4b479f){if(_0x4b479f){_0x53b942=_0x4b479f;_0x459b79[_0x18cb('0x30')]=_[_0x18cb('0x43')](db[_0x18cb('0x4c')]['rawAttributes']);_0x459b79['query']=_[_0x18cb('0x43')](_0x1f4ac9[_0x18cb('0x31')]);_0x459b79[_0x18cb('0x32')]=_[_0x18cb('0x33')](_0x459b79[_0x18cb('0x30')],_0x459b79[_0x18cb('0x31')]);_0x36322b[_0x18cb('0x35')]=_[_0x18cb('0x33')](_0x459b79[_0x18cb('0x30')],qs[_0x18cb('0x34')](_0x1f4ac9[_0x18cb('0x31')][_0x18cb('0x34')]));_0x36322b[_0x18cb('0x35')]=_0x36322b['attributes']['length']?_0x36322b[_0x18cb('0x35')]:_0x459b79[_0x18cb('0x30')];_0x36322b[_0x18cb('0x37')]=qs[_0x18cb('0x38')](_0x1f4ac9[_0x18cb('0x31')][_0x18cb('0x38')]);_0x36322b[_0x18cb('0x39')]=qs[_0x18cb('0x32')](_[_0x18cb('0x4d')](_0x1f4ac9[_0x18cb('0x31')],_0x459b79[_0x18cb('0x32')]));if(_0x1f4ac9['query'][_0x18cb('0x3a')]){_0x36322b['where']=_[_0x18cb('0x3b')](_0x36322b['where'],{'$or':_[_0x18cb('0x2a')](_0x36322b['attributes'],function(_0x41895d){var _0x4f930b={};_0x4f930b[_0x41895d]={'$like':'%'+_0x1f4ac9[_0x18cb('0x31')][_0x18cb('0x3a')]+'%'};return _0x4f930b;})});}_0x36322b=_[_0x18cb('0x3b')]({},_0x36322b,_0x1f4ac9[_0x18cb('0x46')]);return _0x53b942[_0x18cb('0x4e')](_0x36322b);}})['then'](function(_0x8719e4){if(_0x8719e4){_0x45dbb6=_0x8719e4[_0x18cb('0x44')];if(!_0x1f4ac9[_0x18cb('0x31')][_0x18cb('0x4f')](_0x18cb('0x36'))){_0x36322b['limit']=qs['limit'](_0x1f4ac9['query']['limit']);_0x36322b[_0x18cb('0x1b')]=qs[_0x18cb('0x1b')](_0x1f4ac9['query'][_0x18cb('0x1b')]);}return _0x53b942[_0x18cb('0x4e')](_0x36322b);}})['then'](function(_0xc72a98){if(_0xc72a98){return _0xc72a98?{'count':_0x45dbb6,'rows':_0xc72a98}:null;}})[_0x18cb('0x25')](respondWithResult(_0x3571cb,null))[_0x18cb('0x40')](handleError(_0x3571cb,null));};exports[_0x18cb('0x50')]=function(_0x37cb36,_0x213b40,_0x2d47aa){var _0x1b31cb={};var _0x5ea5f8={};var _0x2f17d0;var _0x16ef8e;return db[_0x18cb('0x2b')][_0x18cb('0x4b')]({'where':{'id':_0x37cb36[_0x18cb('0x42')]['id']}})[_0x18cb('0x25')](handleEntityNotFound(_0x213b40,null))[_0x18cb('0x25')](function(_0x4cb2e8){if(_0x4cb2e8){_0x2f17d0=_0x4cb2e8;_0x5ea5f8[_0x18cb('0x30')]=_[_0x18cb('0x43')](db[_0x18cb('0x4c')]['rawAttributes']);_0x5ea5f8[_0x18cb('0x31')]=_[_0x18cb('0x43')](_0x37cb36[_0x18cb('0x31')]);_0x5ea5f8[_0x18cb('0x32')]=_[_0x18cb('0x33')](_0x5ea5f8[_0x18cb('0x30')],_0x5ea5f8['query']);_0x1b31cb['attributes']=_[_0x18cb('0x33')](_0x5ea5f8['model'],qs[_0x18cb('0x34')](_0x37cb36[_0x18cb('0x31')][_0x18cb('0x34')]));_0x1b31cb[_0x18cb('0x35')]=_0x1b31cb['attributes']['length']?_0x1b31cb[_0x18cb('0x35')]:_0x5ea5f8[_0x18cb('0x30')];_0x1b31cb['order']=qs[_0x18cb('0x38')](_0x37cb36['query'][_0x18cb('0x38')]);_0x1b31cb[_0x18cb('0x39')]=qs[_0x18cb('0x32')](_[_0x18cb('0x4d')](_0x37cb36[_0x18cb('0x31')],_0x5ea5f8[_0x18cb('0x32')]));if(_0x37cb36[_0x18cb('0x31')][_0x18cb('0x3a')]){_0x1b31cb[_0x18cb('0x39')]=_['merge'](_0x1b31cb[_0x18cb('0x39')],{'$or':_[_0x18cb('0x2a')](_0x1b31cb[_0x18cb('0x35')],function(_0xfa9cdf){var _0xbac3c4={};_0xbac3c4[_0xfa9cdf]={'$like':'%'+_0x37cb36[_0x18cb('0x31')]['filter']+'%'};return _0xbac3c4;})});}_0x1b31cb=_[_0x18cb('0x3b')]({},_0x1b31cb,_0x37cb36[_0x18cb('0x46')]);return _0x2f17d0['getSubjects'](_0x1b31cb);}})[_0x18cb('0x25')](function(_0x991e33){if(_0x991e33){_0x16ef8e=_0x991e33[_0x18cb('0x44')];if(!_0x37cb36[_0x18cb('0x31')]['hasOwnProperty'](_0x18cb('0x36'))){_0x1b31cb['limit']=qs[_0x18cb('0x1d')](_0x37cb36['query'][_0x18cb('0x1d')]);_0x1b31cb[_0x18cb('0x1b')]=qs['offset'](_0x37cb36['query']['offset']);}return _0x2f17d0[_0x18cb('0x50')](_0x1b31cb);}})[_0x18cb('0x25')](function(_0x1d5f11){if(_0x1d5f11){return _0x1d5f11?{'count':_0x16ef8e,'rows':_0x1d5f11}:null;}})['then'](respondWithResult(_0x213b40,null))[_0x18cb('0x40')](handleError(_0x213b40,null));};exports[_0x18cb('0x51')]=function(_0x37b964,_0x5ec0b6,_0x39daaa){var _0x13b141={};var _0x2df69e={};var _0x15ea4f;var _0x50c813;return db[_0x18cb('0x2b')][_0x18cb('0x4b')]({'where':{'id':_0x37b964[_0x18cb('0x42')]['id']}})[_0x18cb('0x25')](handleEntityNotFound(_0x5ec0b6,null))[_0x18cb('0x25')](function(_0x17f185){if(_0x17f185){_0x15ea4f=_0x17f185;_0x2df69e['model']=_[_0x18cb('0x43')](db[_0x18cb('0x4c')]['rawAttributes']);_0x2df69e[_0x18cb('0x31')]=_[_0x18cb('0x43')](_0x37b964['query']);_0x2df69e[_0x18cb('0x32')]=_[_0x18cb('0x33')](_0x2df69e[_0x18cb('0x30')],_0x2df69e[_0x18cb('0x31')]);_0x13b141['attributes']=_[_0x18cb('0x33')](_0x2df69e['model'],qs[_0x18cb('0x34')](_0x37b964['query'][_0x18cb('0x34')]));_0x13b141[_0x18cb('0x35')]=_0x13b141[_0x18cb('0x35')][_0x18cb('0x44')]?_0x13b141[_0x18cb('0x35')]:_0x2df69e[_0x18cb('0x30')];_0x13b141[_0x18cb('0x37')]=qs['sort'](_0x37b964[_0x18cb('0x31')][_0x18cb('0x38')]);_0x13b141[_0x18cb('0x39')]=qs[_0x18cb('0x32')](_['pick'](_0x37b964[_0x18cb('0x31')],_0x2df69e['filters']));if(_0x37b964[_0x18cb('0x31')][_0x18cb('0x3a')]){_0x13b141[_0x18cb('0x39')]=_[_0x18cb('0x3b')](_0x13b141[_0x18cb('0x39')],{'$or':_[_0x18cb('0x2a')](_0x13b141['attributes'],function(_0x36ce63){var _0x257dd0={};_0x257dd0[_0x36ce63]={'$like':'%'+_0x37b964[_0x18cb('0x31')][_0x18cb('0x3a')]+'%'};return _0x257dd0;})});}_0x13b141=_['merge']({},_0x13b141,_0x37b964[_0x18cb('0x46')]);return _0x15ea4f[_0x18cb('0x51')](_0x13b141);}})[_0x18cb('0x25')](function(_0x48951a){if(_0x48951a){_0x50c813=_0x48951a['length'];if(!_0x37b964['query'][_0x18cb('0x4f')](_0x18cb('0x36'))){_0x13b141[_0x18cb('0x1d')]=qs[_0x18cb('0x1d')](_0x37b964[_0x18cb('0x31')][_0x18cb('0x1d')]);_0x13b141[_0x18cb('0x1b')]=qs[_0x18cb('0x1b')](_0x37b964[_0x18cb('0x31')]['offset']);}return _0x15ea4f[_0x18cb('0x51')](_0x13b141);}})['then'](function(_0x459c7e){if(_0x459c7e){return _0x459c7e?{'count':_0x50c813,'rows':_0x459c7e}:null;}})[_0x18cb('0x25')](respondWithResult(_0x5ec0b6,null))[_0x18cb('0x40')](handleError(_0x5ec0b6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 13b3499..63371a7 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x115efa,_0x454e25){var _0x4a7779=function(_0x45c103){while(--_0x45c103){_0x115efa['push'](_0x115efa['shift']());}};_0x4a7779(++_0x454e25);}(_0x9bde,0xe1));var _0xe9bd=function(_0x36ec65,_0x26fa63){_0x36ec65=_0x36ec65-0x0;var _0x34be1f=_0x9bde[_0x36ec65];return _0x34be1f;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x5593e8,_0x2d805d){var _0x556bc6=function(_0x31da01){while(--_0x31da01){_0x5593e8['push'](_0x5593e8['shift']());}};_0x556bc6(++_0x2d805d);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4549cd,_0x23c19c){_0x4549cd=_0x4549cd-0x0;var _0x22957d=_0x8d0e[_0x4549cd];return _0x22957d;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index df8e8ca..acd2a16 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba37=['http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16a14c,_0x2dbe5c){var _0x12d727=function(_0x15af80){while(--_0x15af80){_0x16a14c['push'](_0x16a14c['shift']());}};_0x12d727(++_0x2dbe5c);}(_0xba37,0x6e));var _0x7ba3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xba37[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x7ba3('0x0'));var util=require('util');var moment=require(_0x7ba3('0x1'));var BPromise=require(_0x7ba3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ba3('0x3'));var db=require(_0x7ba3('0x4'))['db'];var utils=require(_0x7ba3('0x5'));var logger=require(_0x7ba3('0x6'))(_0x7ba3('0x7'));var config=require(_0x7ba3('0x8'));var jayson=require(_0x7ba3('0x9'));var client=jayson['client'][_0x7ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x414903,_0x2dcec6,_0x59002e){return new BPromise(function(_0x19331a,_0x3e0a29){return client[_0x7ba3('0xb')](_0x414903,_0x59002e)[_0x7ba3('0xc')](function(_0xeda75){logger[_0x7ba3('0xd')](_0x7ba3('0xe'),_0x2dcec6,_0x7ba3('0xf'));logger[_0x7ba3('0x10')](_0x7ba3('0x11'),_0x2dcec6,_0x7ba3('0xf'),JSON[_0x7ba3('0x12')](_0xeda75));if(_0xeda75['error']){if(_0xeda75[_0x7ba3('0x13')][_0x7ba3('0x14')]===0x1f4){logger[_0x7ba3('0x13')](_0x7ba3('0xe'),_0x2dcec6,_0xeda75['error'][_0x7ba3('0x15')]);return _0x3e0a29(_0xeda75['error'][_0x7ba3('0x15')]);}logger[_0x7ba3('0x13')](_0x7ba3('0xe'),_0x2dcec6,_0xeda75[_0x7ba3('0x13')][_0x7ba3('0x15')]);return _0x19331a(_0xeda75['error']['message']);}else{logger[_0x7ba3('0xd')](_0x7ba3('0xe'),_0x2dcec6,_0x7ba3('0xf'));_0x19331a(_0xeda75[_0x7ba3('0x16')][_0x7ba3('0x15')]);}})[_0x7ba3('0x17')](function(_0x467c92){logger['error'](_0x7ba3('0xe'),_0x2dcec6,_0x467c92);_0x3e0a29(_0x467c92);});});} \ No newline at end of file +var _0x6d9e=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x4c33f,_0x29e6bf){var _0x4dbfdc=function(_0x3f29c3){while(--_0x3f29c3){_0x4c33f['push'](_0x4c33f['shift']());}};_0x4dbfdc(++_0x29e6bf);}(_0x6d9e,0x10f));var _0xe6d9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6d9e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6d9('0x0'));var util=require('util');var moment=require(_0xe6d9('0x1'));var BPromise=require(_0xe6d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6d9('0x3'));var db=require(_0xe6d9('0x4'))['db'];var utils=require(_0xe6d9('0x5'));var logger=require('../../config/logger')(_0xe6d9('0x6'));var config=require(_0xe6d9('0x7'));var jayson=require(_0xe6d9('0x8'));var client=jayson[_0xe6d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x553759,_0x53ed3e,_0x5d9ac7){return new BPromise(function(_0x3dd7e5,_0x19be21){return client[_0xe6d9('0xa')](_0x553759,_0x5d9ac7)[_0xe6d9('0xb')](function(_0x3abef0){logger[_0xe6d9('0xc')](_0xe6d9('0xd'),_0x53ed3e,_0xe6d9('0xe'));logger[_0xe6d9('0xf')](_0xe6d9('0x10'),_0x53ed3e,_0xe6d9('0xe'),JSON['stringify'](_0x3abef0));if(_0x3abef0[_0xe6d9('0x11')]){if(_0x3abef0[_0xe6d9('0x11')][_0xe6d9('0x12')]===0x1f4){logger[_0xe6d9('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x53ed3e,_0x3abef0[_0xe6d9('0x11')][_0xe6d9('0x13')]);return _0x19be21(_0x3abef0[_0xe6d9('0x11')]['message']);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x53ed3e,_0x3abef0[_0xe6d9('0x11')][_0xe6d9('0x13')]);return _0x3dd7e5(_0x3abef0[_0xe6d9('0x11')][_0xe6d9('0x13')]);}else{logger[_0xe6d9('0xc')](_0xe6d9('0xd'),_0x53ed3e,_0xe6d9('0xe'));_0x3dd7e5(_0x3abef0[_0xe6d9('0x14')]['message']);}})[_0xe6d9('0x15')](function(_0xb1a77a){logger[_0xe6d9('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x53ed3e,_0xb1a77a);_0x19be21(_0xb1a77a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c48404f..5dff90c 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb57=['update','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put'];(function(_0x1713bc,_0x337d8c){var _0x59fe87=function(_0x5ec0c0){while(--_0x5ec0c0){_0x1713bc['push'](_0x1713bc['shift']());}};_0x59fe87(++_0x337d8c);}(_0xfb57,0xf3));var _0x7fb5=function(_0x1489ef,_0x275d93){_0x1489ef=_0x1489ef-0x0;var _0x20e0e6=_0xfb57[_0x1489ef];return _0x20e0e6;};'use strict';var multer=require('multer');var util=require(_0x7fb5('0x0'));var path=require('path');var timeout=require(_0x7fb5('0x1'));var express=require(_0x7fb5('0x2'));var router=express[_0x7fb5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7fb5('0x4'));var config=require(_0x7fb5('0x5'));var controller=require('./intDynamics365Field.controller');router[_0x7fb5('0x6')]('/',auth[_0x7fb5('0x7')](),controller[_0x7fb5('0x8')]);router[_0x7fb5('0x6')]('/:id',auth[_0x7fb5('0x7')](),controller[_0x7fb5('0x9')]);router[_0x7fb5('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7fb5('0xb')]('/:id',auth[_0x7fb5('0x7')](),controller[_0x7fb5('0xc')]);router['delete']('/:id',auth[_0x7fb5('0x7')](),controller[_0x7fb5('0xd')]);module[_0x7fb5('0xe')]=router; \ No newline at end of file +var _0x1cbf=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1cbf,0x11e));var _0xf1cb=function(_0x3f20a5,_0x13ad7f){_0x3f20a5=_0x3f20a5-0x0;var _0x2747f9=_0x1cbf[_0x3f20a5];return _0x2747f9;};'use strict';var multer=require(_0xf1cb('0x0'));var util=require(_0xf1cb('0x1'));var path=require(_0xf1cb('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1cb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf1cb('0x4'));var interaction=require(_0xf1cb('0x5'));var config=require(_0xf1cb('0x6'));var controller=require(_0xf1cb('0x7'));router[_0xf1cb('0x8')]('/',auth['isAuthenticated'](),controller[_0xf1cb('0x9')]);router['get'](_0xf1cb('0xa'),auth[_0xf1cb('0xb')](),controller[_0xf1cb('0xc')]);router['post']('/',auth[_0xf1cb('0xb')](),controller['create']);router[_0xf1cb('0xd')](_0xf1cb('0xa'),auth[_0xf1cb('0xb')](),controller['update']);router[_0xf1cb('0xe')](_0xf1cb('0xa'),auth['isAuthenticated'](),controller[_0xf1cb('0xf')]);module[_0xf1cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index aafcb93..2124edb 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2367=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0x2367,0x132));var _0x7236=function(_0x11a430,_0x3514e5){_0x11a430=_0x11a430-0x0;var _0x3c2ba7=_0x2367[_0x11a430];return _0x3c2ba7;};'use strict';var Sequelize=require(_0x7236('0x0'));module[_0x7236('0x1')]={'type':{'type':Sequelize[_0x7236('0x2')](_0x7236('0x3'),_0x7236('0x4'),_0x7236('0x5'),_0x7236('0x6'),_0x7236('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7236('0x8')]},'key':{'type':Sequelize[_0x7236('0x8')]},'keyType':{'type':Sequelize[_0x7236('0x2')](_0x7236('0x3'),_0x7236('0x4'),_0x7236('0x5'))},'keyContent':{'type':Sequelize[_0x7236('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7236('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7236('0x8')]}}; \ No newline at end of file +var _0x9da1=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x4d4b7d,_0x49fc5a){var _0x404b0f=function(_0x5959b3){while(--_0x5959b3){_0x4d4b7d['push'](_0x4d4b7d['shift']());}};_0x404b0f(++_0x49fc5a);}(_0x9da1,0x121));var _0x19da=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0x9da1[_0xae282f];return _0x5f46d4;};'use strict';var Sequelize=require(_0x19da('0x0'));module[_0x19da('0x1')]={'type':{'type':Sequelize[_0x19da('0x2')](_0x19da('0x3'),_0x19da('0x4'),_0x19da('0x5'),_0x19da('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x19da('0x7')]},'key':{'type':Sequelize[_0x19da('0x7')]},'keyType':{'type':Sequelize[_0x19da('0x2')](_0x19da('0x3'),'variable',_0x19da('0x5'))},'keyContent':{'type':Sequelize[_0x19da('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x19da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2d48621..fa47ae9 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9c1=['model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','key','keys','query','filters','intersection'];(function(_0x189cda,_0x168dfc){var _0x1f10ae=function(_0x365ce2){while(--_0x365ce2){_0x189cda['push'](_0x189cda['shift']());}};_0x1f10ae(++_0x168dfc);}(_0xb9c1,0x1cb));var _0x1b9c=function(_0x246600,_0x151a6b){_0x246600=_0x246600-0x0;var _0x4cba6b=_0xb9c1[_0x246600];return _0x4cba6b;};'use strict';var emlformat=require(_0x1b9c('0x0'));var rimraf=require(_0x1b9c('0x1'));var zipdir=require(_0x1b9c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b9c('0x3'));var moment=require(_0x1b9c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1b9c('0x5'));var util=require(_0x1b9c('0x6'));var path=require(_0x1b9c('0x7'));var sox=require(_0x1b9c('0x8'));var csv=require(_0x1b9c('0x9'));var ejs=require(_0x1b9c('0xa'));var fs=require('fs');var fs_extra=require(_0x1b9c('0xb'));var _=require(_0x1b9c('0xc'));var squel=require(_0x1b9c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1b9c('0xe'));var toCsv=require(_0x1b9c('0x9'));var querystring=require(_0x1b9c('0xf'));var Papa=require(_0x1b9c('0x10'));var Redis=require('ioredis');var authService=require(_0x1b9c('0x11'));var qs=require(_0x1b9c('0x12'));var as=require(_0x1b9c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b9c('0x14'))(_0x1b9c('0x15'));var utils=require(_0x1b9c('0x16'));var config=require(_0x1b9c('0x17'));var licenseUtil=require(_0x1b9c('0x18'));var db=require(_0x1b9c('0x19'))['db'];function respondWithStatusCode(_0x561377,_0x5ee46b){_0x5ee46b=_0x5ee46b||0xcc;return function(_0x22a54e){if(_0x22a54e){return _0x561377[_0x1b9c('0x1a')](_0x5ee46b);}return _0x561377[_0x1b9c('0x1b')](_0x5ee46b)[_0x1b9c('0x1c')]();};}function respondWithResult(_0x13d148,_0x5683db){_0x5683db=_0x5683db||0xc8;return function(_0x65260c){if(_0x65260c){return _0x13d148[_0x1b9c('0x1b')](_0x5683db)[_0x1b9c('0x1d')](_0x65260c);}};}function respondWithFilteredResult(_0x229f2d,_0xf6a5f){return function(_0x592770){if(_0x592770){var _0xa894fe=typeof _0xf6a5f[_0x1b9c('0x1e')]===_0x1b9c('0x1f')&&typeof _0xf6a5f['limit']==='undefined';var _0x41efb6=_0x592770[_0x1b9c('0x20')];var _0x4d5117=_0xa894fe?0x0:_0xf6a5f[_0x1b9c('0x1e')];var _0x22e4e8=_0xa894fe?_0x592770[_0x1b9c('0x20')]:_0xf6a5f[_0x1b9c('0x1e')]+_0xf6a5f[_0x1b9c('0x21')];var _0x32eada;if(_0x22e4e8>=_0x41efb6){_0x22e4e8=_0x41efb6;_0x32eada=0xc8;}else{_0x32eada=0xce;}_0x229f2d[_0x1b9c('0x1b')](_0x32eada);return _0x229f2d['set'](_0x1b9c('0x22'),_0x4d5117+'-'+_0x22e4e8+'/'+_0x41efb6)[_0x1b9c('0x1d')](_0x592770);}return null;};}function patchUpdates(_0x45643d){return function(_0x5ba649){try{jsonpatch[_0x1b9c('0x23')](_0x5ba649,_0x45643d,!![]);}catch(_0x515665){return BPromise['reject'](_0x515665);}return _0x5ba649[_0x1b9c('0x24')]();};}function saveUpdates(_0x120ef9,_0x172e55){return function(_0x20a8a0){if(_0x20a8a0){return _0x20a8a0[_0x1b9c('0x25')](_0x120ef9)[_0x1b9c('0x26')](function(_0x5749ad){return _0x5749ad;});}return null;};}function removeEntity(_0x507ccf,_0x3ce935){return function(_0x27e18e){if(_0x27e18e){return _0x27e18e['destroy']()['then'](function(){_0x507ccf['status'](0xcc)[_0x1b9c('0x1c')]();});}};}function handleEntityNotFound(_0x1cd720,_0x3c4744){return function(_0x9ddeb6){if(!_0x9ddeb6){_0x1cd720[_0x1b9c('0x1a')](0x194);}return _0x9ddeb6;};}function handleError(_0x5b8610,_0x581c08){_0x581c08=_0x581c08||0x1f4;return function(_0x4d41dd){logger[_0x1b9c('0x27')](_0x4d41dd[_0x1b9c('0x28')]);if(_0x4d41dd[_0x1b9c('0x29')]){delete _0x4d41dd[_0x1b9c('0x29')];}_0x5b8610[_0x1b9c('0x1b')](_0x581c08)[_0x1b9c('0x2a')](_0x4d41dd);};}exports[_0x1b9c('0x2b')]=function(_0x38e11d,_0x16a408){var _0x55c0fd={},_0x45344a={},_0x4c7981={'count':0x0,'rows':[]};var _0x356e29=_['map'](db[_0x1b9c('0x2c')][_0x1b9c('0x2d')],function(_0xb97ba5){return{'name':_0xb97ba5[_0x1b9c('0x2e')],'type':_0xb97ba5['type'][_0x1b9c('0x2f')]};});_0x45344a['model']=_['map'](_0x356e29,'name');_0x45344a['query']=_[_0x1b9c('0x30')](_0x38e11d[_0x1b9c('0x31')]);_0x45344a[_0x1b9c('0x32')]=_[_0x1b9c('0x33')](_0x45344a[_0x1b9c('0x34')],_0x45344a['query']);_0x55c0fd['attributes']=_[_0x1b9c('0x33')](_0x45344a['model'],qs[_0x1b9c('0x35')](_0x38e11d[_0x1b9c('0x31')]['fields']));_0x55c0fd['attributes']=_0x55c0fd[_0x1b9c('0x36')][_0x1b9c('0x37')]?_0x55c0fd[_0x1b9c('0x36')]:_0x45344a['model'];if(!_0x38e11d['query'][_0x1b9c('0x38')](_0x1b9c('0x39'))){_0x55c0fd[_0x1b9c('0x21')]=qs[_0x1b9c('0x21')](_0x38e11d[_0x1b9c('0x31')][_0x1b9c('0x21')]);_0x55c0fd['offset']=qs[_0x1b9c('0x1e')](_0x38e11d[_0x1b9c('0x31')][_0x1b9c('0x1e')]);}_0x55c0fd['order']=qs[_0x1b9c('0x3a')](_0x38e11d[_0x1b9c('0x31')][_0x1b9c('0x3a')]);_0x55c0fd[_0x1b9c('0x3b')]=qs[_0x1b9c('0x32')](_['pick'](_0x38e11d[_0x1b9c('0x31')],_0x45344a['filters']),_0x356e29);if(_0x38e11d[_0x1b9c('0x31')][_0x1b9c('0x3c')]){_0x55c0fd['where']=_[_0x1b9c('0x3d')](_0x55c0fd[_0x1b9c('0x3b')],{'$or':_[_0x1b9c('0x3e')](_0x356e29,function(_0x2262ba){if(_0x2262ba['type']!==_0x1b9c('0x3f')){var _0x55e23f={};_0x55e23f[_0x2262ba[_0x1b9c('0x29')]]={'$like':'%'+_0x38e11d[_0x1b9c('0x31')][_0x1b9c('0x3c')]+'%'};return _0x55e23f;}})});}_0x55c0fd=_['merge']({},_0x55c0fd,_0x38e11d[_0x1b9c('0x40')]);var _0x1f8696={'where':_0x55c0fd[_0x1b9c('0x3b')]};return db[_0x1b9c('0x2c')][_0x1b9c('0x20')](_0x1f8696)[_0x1b9c('0x26')](function(_0x5b358a){_0x4c7981[_0x1b9c('0x20')]=_0x5b358a;if(_0x38e11d[_0x1b9c('0x31')][_0x1b9c('0x41')]){_0x55c0fd[_0x1b9c('0x42')]=[{'all':!![]}];}return db[_0x1b9c('0x2c')][_0x1b9c('0x43')](_0x55c0fd);})[_0x1b9c('0x26')](function(_0x24be99){_0x4c7981['rows']=_0x24be99;return _0x4c7981;})[_0x1b9c('0x26')](respondWithFilteredResult(_0x16a408,_0x55c0fd))[_0x1b9c('0x44')](handleError(_0x16a408,null));};exports['show']=function(_0x8fb1d9,_0x42df95){var _0x45e4c9={'raw':!![],'where':{'id':_0x8fb1d9[_0x1b9c('0x45')]['id']}},_0x386a86={};_0x386a86[_0x1b9c('0x34')]=_['keys'](db[_0x1b9c('0x2c')][_0x1b9c('0x2d')]);_0x386a86[_0x1b9c('0x31')]=_[_0x1b9c('0x30')](_0x8fb1d9[_0x1b9c('0x31')]);_0x386a86['filters']=_[_0x1b9c('0x33')](_0x386a86[_0x1b9c('0x34')],_0x386a86['query']);_0x45e4c9[_0x1b9c('0x36')]=_[_0x1b9c('0x33')](_0x386a86[_0x1b9c('0x34')],qs[_0x1b9c('0x35')](_0x8fb1d9[_0x1b9c('0x31')][_0x1b9c('0x35')]));_0x45e4c9[_0x1b9c('0x36')]=_0x45e4c9[_0x1b9c('0x36')][_0x1b9c('0x37')]?_0x45e4c9['attributes']:_0x386a86[_0x1b9c('0x34')];if(_0x8fb1d9[_0x1b9c('0x31')][_0x1b9c('0x41')]){_0x45e4c9[_0x1b9c('0x42')]=[{'all':!![]}];}_0x45e4c9=_['merge']({},_0x45e4c9,_0x8fb1d9['options']);return db['Dynamics365Field'][_0x1b9c('0x46')](_0x45e4c9)[_0x1b9c('0x26')](handleEntityNotFound(_0x42df95,null))[_0x1b9c('0x26')](respondWithResult(_0x42df95,null))[_0x1b9c('0x44')](handleError(_0x42df95,null));};exports[_0x1b9c('0x47')]=function(_0x2e6a97,_0x360c5f){return db[_0x1b9c('0x2c')][_0x1b9c('0x47')](_0x2e6a97['body'],{})[_0x1b9c('0x26')](respondWithResult(_0x360c5f,0xc9))['catch'](handleError(_0x360c5f,null));};exports[_0x1b9c('0x25')]=function(_0x530251,_0x277a83){if(_0x530251[_0x1b9c('0x48')]['id']){delete _0x530251['body']['id'];}return db[_0x1b9c('0x2c')][_0x1b9c('0x46')]({'where':{'id':_0x530251[_0x1b9c('0x45')]['id']}})[_0x1b9c('0x26')](handleEntityNotFound(_0x277a83,null))[_0x1b9c('0x26')](saveUpdates(_0x530251['body'],null))['then'](respondWithResult(_0x277a83,null))[_0x1b9c('0x44')](handleError(_0x277a83,null));};exports['destroy']=function(_0xd2fb4d,_0x1bb92d){return db[_0x1b9c('0x2c')][_0x1b9c('0x46')]({'where':{'id':_0xd2fb4d[_0x1b9c('0x45')]['id']}})[_0x1b9c('0x26')](handleEntityNotFound(_0x1bb92d,null))[_0x1b9c('0x26')](removeEntity(_0x1bb92d,null))['catch'](handleError(_0x1bb92d,null));}; \ No newline at end of file +var _0x8569=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','Dynamics365Field','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','fields','length','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x2d97d1,_0x1d8d88){var _0x6ae222=function(_0x274ff6){while(--_0x274ff6){_0x2d97d1['push'](_0x2d97d1['shift']());}};_0x6ae222(++_0x1d8d88);}(_0x8569,0x1c6));var _0x9856=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x8569[_0x16938f];return _0x5c66e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9856('0x0'));var zipdir=require(_0x9856('0x1'));var jsonpatch=require(_0x9856('0x2'));var rp=require(_0x9856('0x3'));var moment=require('moment');var BPromise=require(_0x9856('0x4'));var Mustache=require(_0x9856('0x5'));var util=require(_0x9856('0x6'));var path=require(_0x9856('0x7'));var sox=require(_0x9856('0x8'));var csv=require(_0x9856('0x9'));var ejs=require(_0x9856('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9856('0xb'));var squel=require(_0x9856('0xc'));var crypto=require(_0x9856('0xd'));var jsforce=require(_0x9856('0xe'));var deskjs=require(_0x9856('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9856('0x10'));var Papa=require(_0x9856('0x11'));var Redis=require(_0x9856('0x12'));var authService=require(_0x9856('0x13'));var qs=require(_0x9856('0x14'));var as=require(_0x9856('0x15'));var hardwareService=require(_0x9856('0x16'));var logger=require(_0x9856('0x17'))(_0x9856('0x18'));var utils=require(_0x9856('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9856('0x1a'))['db'];function respondWithStatusCode(_0x5d8a3e,_0x4c958c){_0x4c958c=_0x4c958c||0xcc;return function(_0x47f284){if(_0x47f284){return _0x5d8a3e[_0x9856('0x1b')](_0x4c958c);}return _0x5d8a3e[_0x9856('0x1c')](_0x4c958c)[_0x9856('0x1d')]();};}function respondWithResult(_0x58853d,_0x1dc15d){_0x1dc15d=_0x1dc15d||0xc8;return function(_0x51d77a){if(_0x51d77a){return _0x58853d[_0x9856('0x1c')](_0x1dc15d)[_0x9856('0x1e')](_0x51d77a);}};}function respondWithFilteredResult(_0x1f50cb,_0x352c69){return function(_0x23d895){if(_0x23d895){var _0x1de25f=typeof _0x352c69[_0x9856('0x1f')]===_0x9856('0x20')&&typeof _0x352c69['limit']===_0x9856('0x20');var _0x501493=_0x23d895['count'];var _0x245492=_0x1de25f?0x0:_0x352c69[_0x9856('0x1f')];var _0x37d2ee=_0x1de25f?_0x23d895['count']:_0x352c69[_0x9856('0x1f')]+_0x352c69[_0x9856('0x21')];var _0x24d12b;if(_0x37d2ee>=_0x501493){_0x37d2ee=_0x501493;_0x24d12b=0xc8;}else{_0x24d12b=0xce;}_0x1f50cb[_0x9856('0x1c')](_0x24d12b);return _0x1f50cb[_0x9856('0x22')](_0x9856('0x23'),_0x245492+'-'+_0x37d2ee+'/'+_0x501493)[_0x9856('0x1e')](_0x23d895);}return null;};}function patchUpdates(_0x15a0dc){return function(_0x4026c3){try{jsonpatch[_0x9856('0x24')](_0x4026c3,_0x15a0dc,!![]);}catch(_0x3bf76e){return BPromise['reject'](_0x3bf76e);}return _0x4026c3[_0x9856('0x25')]();};}function saveUpdates(_0x4946e1,_0x521216){return function(_0x5e5f7c){if(_0x5e5f7c){return _0x5e5f7c[_0x9856('0x26')](_0x4946e1)[_0x9856('0x27')](function(_0x5d53da){return _0x5d53da;});}return null;};}function removeEntity(_0x30cdbb,_0x1b6514){return function(_0x46e869){if(_0x46e869){return _0x46e869[_0x9856('0x28')]()[_0x9856('0x27')](function(){_0x30cdbb[_0x9856('0x1c')](0xcc)[_0x9856('0x1d')]();});}};}function handleEntityNotFound(_0x4accf4,_0x16566a){return function(_0x569f45){if(!_0x569f45){_0x4accf4[_0x9856('0x1b')](0x194);}return _0x569f45;};}function handleError(_0x385d32,_0x23769e){_0x23769e=_0x23769e||0x1f4;return function(_0x285ba2){logger['error'](_0x285ba2['stack']);if(_0x285ba2[_0x9856('0x29')]){delete _0x285ba2['name'];}_0x385d32[_0x9856('0x1c')](_0x23769e)[_0x9856('0x2a')](_0x285ba2);};}exports[_0x9856('0x2b')]=function(_0x31ee7b,_0x40642e){var _0x165425={},_0x1b9701={},_0x3cf052={'count':0x0,'rows':[]};var _0x28c618=_['map'](db[_0x9856('0x2c')][_0x9856('0x2d')],function(_0x5ce074){return{'name':_0x5ce074[_0x9856('0x2e')],'type':_0x5ce074['type'][_0x9856('0x2f')]};});_0x1b9701[_0x9856('0x30')]=_[_0x9856('0x31')](_0x28c618,_0x9856('0x29'));_0x1b9701[_0x9856('0x32')]=_[_0x9856('0x33')](_0x31ee7b[_0x9856('0x32')]);_0x1b9701[_0x9856('0x34')]=_[_0x9856('0x35')](_0x1b9701[_0x9856('0x30')],_0x1b9701[_0x9856('0x32')]);_0x165425[_0x9856('0x36')]=_[_0x9856('0x35')](_0x1b9701[_0x9856('0x30')],qs['fields'](_0x31ee7b[_0x9856('0x32')]['fields']));_0x165425[_0x9856('0x36')]=_0x165425[_0x9856('0x36')]['length']?_0x165425[_0x9856('0x36')]:_0x1b9701[_0x9856('0x30')];if(!_0x31ee7b[_0x9856('0x32')]['hasOwnProperty'](_0x9856('0x37'))){_0x165425[_0x9856('0x21')]=qs[_0x9856('0x21')](_0x31ee7b[_0x9856('0x32')][_0x9856('0x21')]);_0x165425[_0x9856('0x1f')]=qs[_0x9856('0x1f')](_0x31ee7b['query']['offset']);}_0x165425[_0x9856('0x38')]=qs['sort'](_0x31ee7b['query'][_0x9856('0x39')]);_0x165425[_0x9856('0x3a')]=qs[_0x9856('0x34')](_[_0x9856('0x3b')](_0x31ee7b[_0x9856('0x32')],_0x1b9701[_0x9856('0x34')]),_0x28c618);if(_0x31ee7b[_0x9856('0x32')][_0x9856('0x3c')]){_0x165425[_0x9856('0x3a')]=_[_0x9856('0x3d')](_0x165425[_0x9856('0x3a')],{'$or':_[_0x9856('0x31')](_0x28c618,function(_0x19897e){if(_0x19897e[_0x9856('0x3e')]!==_0x9856('0x3f')){var _0x1e20e8={};_0x1e20e8[_0x19897e[_0x9856('0x29')]]={'$like':'%'+_0x31ee7b[_0x9856('0x32')]['filter']+'%'};return _0x1e20e8;}})});}_0x165425=_['merge']({},_0x165425,_0x31ee7b[_0x9856('0x40')]);var _0x3eb375={'where':_0x165425[_0x9856('0x3a')]};return db[_0x9856('0x2c')][_0x9856('0x41')](_0x3eb375)[_0x9856('0x27')](function(_0x941da6){_0x3cf052['count']=_0x941da6;if(_0x31ee7b[_0x9856('0x32')][_0x9856('0x42')]){_0x165425[_0x9856('0x43')]=[{'all':!![]}];}return db[_0x9856('0x2c')][_0x9856('0x44')](_0x165425);})['then'](function(_0x1bbe62){_0x3cf052[_0x9856('0x45')]=_0x1bbe62;return _0x3cf052;})[_0x9856('0x27')](respondWithFilteredResult(_0x40642e,_0x165425))[_0x9856('0x46')](handleError(_0x40642e,null));};exports[_0x9856('0x47')]=function(_0x1e2c7c,_0x337fee){var _0x5a8136={'raw':!![],'where':{'id':_0x1e2c7c[_0x9856('0x48')]['id']}},_0x2bf8d7={};_0x2bf8d7['model']=_[_0x9856('0x33')](db[_0x9856('0x2c')][_0x9856('0x2d')]);_0x2bf8d7['query']=_[_0x9856('0x33')](_0x1e2c7c[_0x9856('0x32')]);_0x2bf8d7[_0x9856('0x34')]=_[_0x9856('0x35')](_0x2bf8d7['model'],_0x2bf8d7['query']);_0x5a8136['attributes']=_[_0x9856('0x35')](_0x2bf8d7['model'],qs['fields'](_0x1e2c7c[_0x9856('0x32')][_0x9856('0x49')]));_0x5a8136['attributes']=_0x5a8136[_0x9856('0x36')][_0x9856('0x4a')]?_0x5a8136['attributes']:_0x2bf8d7[_0x9856('0x30')];if(_0x1e2c7c['query'][_0x9856('0x42')]){_0x5a8136[_0x9856('0x43')]=[{'all':!![]}];}_0x5a8136=_[_0x9856('0x3d')]({},_0x5a8136,_0x1e2c7c[_0x9856('0x40')]);return db[_0x9856('0x2c')]['find'](_0x5a8136)[_0x9856('0x27')](handleEntityNotFound(_0x337fee,null))[_0x9856('0x27')](respondWithResult(_0x337fee,null))[_0x9856('0x46')](handleError(_0x337fee,null));};exports['create']=function(_0x1fed3b,_0x1f2356){return db[_0x9856('0x2c')]['create'](_0x1fed3b['body'],{})['then'](respondWithResult(_0x1f2356,0xc9))[_0x9856('0x46')](handleError(_0x1f2356,null));};exports[_0x9856('0x26')]=function(_0x28a47c,_0x3f510d){if(_0x28a47c[_0x9856('0x4b')]['id']){delete _0x28a47c[_0x9856('0x4b')]['id'];}return db[_0x9856('0x2c')][_0x9856('0x4c')]({'where':{'id':_0x28a47c[_0x9856('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f510d,null))[_0x9856('0x27')](saveUpdates(_0x28a47c[_0x9856('0x4b')],null))['then'](respondWithResult(_0x3f510d,null))[_0x9856('0x46')](handleError(_0x3f510d,null));};exports[_0x9856('0x28')]=function(_0x2e23c6,_0xd6a86d){return db[_0x9856('0x2c')][_0x9856('0x4c')]({'where':{'id':_0x2e23c6[_0x9856('0x48')]['id']}})[_0x9856('0x27')](handleEntityNotFound(_0xd6a86d,null))[_0x9856('0x27')](removeEntity(_0xd6a86d,null))[_0x9856('0x46')](handleError(_0xd6a86d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 24ea228..69b1264 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0x814b,0x92));var _0xb814=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x814b[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require('../../config/logger')(_0xb814('0x2'));var moment=require('moment');var BPromise=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb814('0x5'));var config=require(_0xb814('0x6'));var attributes=require(_0xb814('0x7'));module[_0xb814('0x8')]=function(_0x47f2b4,_0x274791){return _0x47f2b4[_0xb814('0x9')]('Dynamics365Field',attributes,{'tableName':_0xb814('0xa'),'paranoid':![],'indexes':[{'name':_0xb814('0xb'),'fields':[_0xb814('0xc'),_0xb814('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2903=['rimraf','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','path'];(function(_0x2f3c68,_0x1de777){var _0x325af4=function(_0x5873ed){while(--_0x5873ed){_0x2f3c68['push'](_0x2f3c68['shift']());}};_0x325af4(++_0x1de777);}(_0x2903,0x15a));var _0x3290=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x2903[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3290('0x0'))(_0x3290('0x1'));var moment=require(_0x3290('0x2'));var BPromise=require('bluebird');var rp=require(_0x3290('0x3'));var fs=require('fs');var path=require(_0x3290('0x4'));var rimraf=require(_0x3290('0x5'));var config=require('../../config/environment');var attributes=require(_0x3290('0x6'));module[_0x3290('0x7')]=function(_0x59f408,_0x2fe4e7){return _0x59f408[_0x3290('0x8')]('Dynamics365Field',attributes,{'tableName':_0x3290('0x9'),'paranoid':![],'indexes':[{'name':_0x3290('0xa'),'fields':[_0x3290('0xb'),_0x3290('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 6a6114d..7b1bacc 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bec=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash'];(function(_0x26eb26,_0x39230a){var _0x1bd0d3=function(_0x51d6e2){while(--_0x51d6e2){_0x26eb26['push'](_0x26eb26['shift']());}};_0x1bd0d3(++_0x39230a);}(_0x2bec,0xa7));var _0xc2be=function(_0x3541ed,_0x3299db){_0x3541ed=_0x3541ed-0x0;var _0x2e9862=_0x2bec[_0x3541ed];return _0x2e9862;};'use strict';var _=require(_0xc2be('0x0'));var util=require(_0xc2be('0x1'));var moment=require(_0xc2be('0x2'));var BPromise=require(_0xc2be('0x3'));var rs=require(_0xc2be('0x4'));var fs=require('fs');var Redis=require(_0xc2be('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc2be('0x6'))(_0xc2be('0x7'));var config=require(_0xc2be('0x8'));var jayson=require(_0xc2be('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17278b,_0x2ac461,_0x56e4ad){return new BPromise(function(_0x4b97d4,_0x224ff2){return client['request'](_0x17278b,_0x56e4ad)[_0xc2be('0xa')](function(_0xc6a137){logger[_0xc2be('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x2ac461,'request\x20sent');logger[_0xc2be('0xc')](_0xc2be('0xd'),_0x2ac461,_0xc2be('0xe'),JSON[_0xc2be('0xf')](_0xc6a137));if(_0xc6a137[_0xc2be('0x10')]){if(_0xc6a137[_0xc2be('0x10')][_0xc2be('0x11')]===0x1f4){logger[_0xc2be('0x10')](_0xc2be('0x12'),_0x2ac461,_0xc6a137[_0xc2be('0x10')][_0xc2be('0x13')]);return _0x224ff2(_0xc6a137['error']['message']);}logger[_0xc2be('0x10')](_0xc2be('0x12'),_0x2ac461,_0xc6a137[_0xc2be('0x10')][_0xc2be('0x13')]);return _0x4b97d4(_0xc6a137[_0xc2be('0x10')][_0xc2be('0x13')]);}else{logger[_0xc2be('0xb')](_0xc2be('0x12'),_0x2ac461,_0xc2be('0xe'));_0x4b97d4(_0xc6a137[_0xc2be('0x14')][_0xc2be('0x13')]);}})['catch'](function(_0x2b744d){logger[_0xc2be('0x10')](_0xc2be('0x12'),_0x2ac461,_0x2b744d);_0x224ff2(_0x2b744d);});});} \ No newline at end of file +var _0xf69b=['util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x150a49,_0x47b070){var _0xe8c345=function(_0x4c4b73){while(--_0x4c4b73){_0x150a49['push'](_0x150a49['shift']());}};_0xe8c345(++_0x47b070);}(_0xf69b,0x16f));var _0xbf69=function(_0x20e60d,_0x1f1a44){_0x20e60d=_0x20e60d-0x0;var _0x4108ec=_0xf69b[_0x20e60d];return _0x4108ec;};'use strict';var _=require(_0xbf69('0x0'));var util=require(_0xbf69('0x1'));var moment=require(_0xbf69('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf69('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf69('0x4'));var logger=require('../../config/logger')(_0xbf69('0x5'));var config=require(_0xbf69('0x6'));var jayson=require(_0xbf69('0x7'));var client=jayson[_0xbf69('0x8')][_0xbf69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48d44e,_0x1413ac,_0x521705){return new BPromise(function(_0x291556,_0x347d34){return client[_0xbf69('0xa')](_0x48d44e,_0x521705)[_0xbf69('0xb')](function(_0x23be18){logger[_0xbf69('0xc')](_0xbf69('0xd'),_0x1413ac,_0xbf69('0xe'));logger[_0xbf69('0xf')](_0xbf69('0x10'),_0x1413ac,_0xbf69('0xe'),JSON[_0xbf69('0x11')](_0x23be18));if(_0x23be18[_0xbf69('0x12')]){if(_0x23be18[_0xbf69('0x12')][_0xbf69('0x13')]===0x1f4){logger['error'](_0xbf69('0xd'),_0x1413ac,_0x23be18[_0xbf69('0x12')]['message']);return _0x347d34(_0x23be18[_0xbf69('0x12')][_0xbf69('0x14')]);}logger['error'](_0xbf69('0xd'),_0x1413ac,_0x23be18['error'][_0xbf69('0x14')]);return _0x291556(_0x23be18[_0xbf69('0x12')][_0xbf69('0x14')]);}else{logger[_0xbf69('0xc')](_0xbf69('0xd'),_0x1413ac,_0xbf69('0xe'));_0x291556(_0x23be18[_0xbf69('0x15')][_0xbf69('0x14')]);}})[_0xbf69('0x16')](function(_0x1231b4){logger[_0xbf69('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x1413ac,_0x1231b4);_0x347d34(_0x1231b4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index abce4b6..e5ef2be 100644 --- a/server/api/intFreshdeskAccount/index.js +++ b/server/api/intFreshdeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x535a=['fs-extra','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','express','Router'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x535a,0x74));var _0xa535=function(_0x32ba20,_0x11fb08){_0x32ba20=_0x32ba20-0x0;var _0x3f9ee9=_0x535a[_0x32ba20];return _0x3f9ee9;};'use strict';var multer=require(_0xa535('0x0'));var util=require(_0xa535('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa535('0x2'));var router=express[_0xa535('0x3')]();var fs_extra=require(_0xa535('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa535('0x5'));var controller=require(_0xa535('0x6'));router['get']('/',auth[_0xa535('0x7')](),controller[_0xa535('0x8')]);router[_0xa535('0x9')](_0xa535('0xa'),auth[_0xa535('0x7')](),controller[_0xa535('0xb')]);router[_0xa535('0x9')]('/:id/configurations',auth[_0xa535('0x7')](),controller['getConfigurations']);router['get'](_0xa535('0xc'),auth[_0xa535('0x7')](),controller[_0xa535('0xd')]);router[_0xa535('0xe')]('/',auth[_0xa535('0x7')](),controller[_0xa535('0xf')]);router[_0xa535('0xe')]('/:id/configurations',auth[_0xa535('0x7')](),controller[_0xa535('0x10')]);router[_0xa535('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa535('0x12')]);router[_0xa535('0x13')](_0xa535('0xa'),auth[_0xa535('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x31a9=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','/:id','delete','destroy','multer','path'];(function(_0x10cc95,_0x5847e7){var _0x159007=function(_0x293081){while(--_0x293081){_0x10cc95['push'](_0x10cc95['shift']());}};_0x159007(++_0x5847e7);}(_0x31a9,0x11c));var _0x931a=function(_0xb328fb,_0x2c62f2){_0xb328fb=_0xb328fb-0x0;var _0x1965c3=_0x31a9[_0xb328fb];return _0x1965c3;};'use strict';var multer=require(_0x931a('0x0'));var util=require('util');var path=require(_0x931a('0x1'));var timeout=require(_0x931a('0x2'));var express=require(_0x931a('0x3'));var router=express['Router']();var fs_extra=require(_0x931a('0x4'));var auth=require(_0x931a('0x5'));var interaction=require(_0x931a('0x6'));var config=require(_0x931a('0x7'));var controller=require(_0x931a('0x8'));router[_0x931a('0x9')]('/',auth[_0x931a('0xa')](),controller[_0x931a('0xb')]);router[_0x931a('0x9')]('/:id',auth[_0x931a('0xa')](),controller['show']);router[_0x931a('0x9')]('/:id/configurations',auth[_0x931a('0xa')](),controller[_0x931a('0xc')]);router[_0x931a('0x9')](_0x931a('0xd'),auth[_0x931a('0xa')](),controller[_0x931a('0xe')]);router[_0x931a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x931a('0xf')](_0x931a('0x10'),auth[_0x931a('0xa')](),controller[_0x931a('0x11')]);router[_0x931a('0x12')](_0x931a('0x13'),auth[_0x931a('0xa')](),controller['update']);router[_0x931a('0x14')](_0x931a('0x13'),auth[_0x931a('0xa')](),controller[_0x931a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 6ec40d2..3ed8fc9 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x2542,0x169));var _0x2254=function(_0x11705a,_0x3de7a0){_0x11705a=_0x11705a-0x0;var _0x37d1ac=_0x2542[_0x11705a];return _0x37d1ac;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'name':{'type':Sequelize[_0x2254('0x2')]},'description':{'type':Sequelize[_0x2254('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2254('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2254('0x2')],'unique':_0x2254('0x4')},'serverUrl':{'type':Sequelize[_0x2254('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5c3c=['remoteUri','sequelize','exports','STRING','username'];(function(_0x2aa3ed,_0x21bb61){var _0x4e0881=function(_0x581164){while(--_0x581164){_0x2aa3ed['push'](_0x2aa3ed['shift']());}};_0x4e0881(++_0x21bb61);}(_0x5c3c,0x132));var _0xc5c3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5c3c[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'name':{'type':Sequelize[_0xc5c3('0x2')]},'description':{'type':Sequelize[_0xc5c3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc5c3('0x3')},'apiKey':{'type':Sequelize[_0xc5c3('0x2')]},'remoteUri':{'type':Sequelize[_0xc5c3('0x2')],'unique':_0xc5c3('0x4')},'serverUrl':{'type':Sequelize[_0xc5c3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 33e8fe5..816e315 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc25=['key','model','keys','filters','intersection','attributes','query','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','fields','length','find','catch','create','body','params','destroy','getConfigurations','findOne','options','AccountId','getSubjects','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','substring','GET','format','%s/%s','%s:X','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type'];(function(_0xcfe2f6,_0x27effa){var _0x47bc9f=function(_0x95d06b){while(--_0x95d06b){_0xcfe2f6['push'](_0xcfe2f6['shift']());}};_0x47bc9f(++_0x27effa);}(_0xdc25,0x128));var _0x5dc2=function(_0x3516a8,_0x45de65){_0x3516a8=_0x3516a8-0x0;var _0x46de5d=_0xdc25[_0x3516a8];return _0x46de5d;};'use strict';var emlformat=require(_0x5dc2('0x0'));var rimraf=require(_0x5dc2('0x1'));var zipdir=require(_0x5dc2('0x2'));var jsonpatch=require(_0x5dc2('0x3'));var rp=require('request-promise');var moment=require(_0x5dc2('0x4'));var BPromise=require(_0x5dc2('0x5'));var Mustache=require(_0x5dc2('0x6'));var util=require(_0x5dc2('0x7'));var path=require(_0x5dc2('0x8'));var sox=require(_0x5dc2('0x9'));var csv=require(_0x5dc2('0xa'));var ejs=require(_0x5dc2('0xb'));var fs=require('fs');var fs_extra=require(_0x5dc2('0xc'));var _=require(_0x5dc2('0xd'));var squel=require(_0x5dc2('0xe'));var crypto=require(_0x5dc2('0xf'));var jsforce=require(_0x5dc2('0x10'));var deskjs=require(_0x5dc2('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5dc2('0x12'));var Papa=require('papaparse');var Redis=require(_0x5dc2('0x13'));var authService=require(_0x5dc2('0x14'));var qs=require(_0x5dc2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5dc2('0x16'));var logger=require(_0x5dc2('0x17'))('api');var utils=require(_0x5dc2('0x18'));var config=require(_0x5dc2('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x55a0b2,_0x293707){_0x293707=_0x293707||0xcc;return function(_0xf3c8c6){if(_0xf3c8c6){return _0x55a0b2[_0x5dc2('0x1a')](_0x293707);}return _0x55a0b2[_0x5dc2('0x1b')](_0x293707)[_0x5dc2('0x1c')]();};}function respondWithResult(_0x5f1bfe,_0xc1087d){_0xc1087d=_0xc1087d||0xc8;return function(_0x55b441){if(_0x55b441){return _0x5f1bfe[_0x5dc2('0x1b')](_0xc1087d)[_0x5dc2('0x1d')](_0x55b441);}};}function respondWithFilteredResult(_0x33d57d,_0x292b8c){return function(_0x1365db){if(_0x1365db){var _0x1f6132=typeof _0x292b8c[_0x5dc2('0x1e')]===_0x5dc2('0x1f')&&typeof _0x292b8c['limit']===_0x5dc2('0x1f');var _0x3a5752=_0x1365db[_0x5dc2('0x20')];var _0x480cd0=_0x1f6132?0x0:_0x292b8c[_0x5dc2('0x1e')];var _0x413501=_0x1f6132?_0x1365db[_0x5dc2('0x20')]:_0x292b8c['offset']+_0x292b8c[_0x5dc2('0x21')];var _0x1e9ff8;if(_0x413501>=_0x3a5752){_0x413501=_0x3a5752;_0x1e9ff8=0xc8;}else{_0x1e9ff8=0xce;}_0x33d57d[_0x5dc2('0x1b')](_0x1e9ff8);return _0x33d57d[_0x5dc2('0x22')]('Content-Range',_0x480cd0+'-'+_0x413501+'/'+_0x3a5752)[_0x5dc2('0x1d')](_0x1365db);}return null;};}function patchUpdates(_0x33afcb){return function(_0x26d1b4){try{jsonpatch[_0x5dc2('0x23')](_0x26d1b4,_0x33afcb,!![]);}catch(_0x3fd8f3){return BPromise['reject'](_0x3fd8f3);}return _0x26d1b4[_0x5dc2('0x24')]();};}function saveUpdates(_0x2dbe9c,_0x2c966a){return function(_0x599e37){if(_0x599e37){return _0x599e37[_0x5dc2('0x25')](_0x2dbe9c)['then'](function(_0x97cd2f){return _0x97cd2f;});}return null;};}function removeEntity(_0x345684,_0x4fc41e){return function(_0x4f0408){if(_0x4f0408){return _0x4f0408['destroy']()[_0x5dc2('0x26')](function(){_0x345684[_0x5dc2('0x1b')](0xcc)[_0x5dc2('0x1c')]();});}};}function handleEntityNotFound(_0x4dadb6,_0xa43df2){return function(_0x42aec4){if(!_0x42aec4){_0x4dadb6['sendStatus'](0x194);}return _0x42aec4;};}function handleError(_0x12339c,_0x46af00){_0x46af00=_0x46af00||0x1f4;return function(_0x4de2d6){logger[_0x5dc2('0x27')](_0x4de2d6[_0x5dc2('0x28')]);if(_0x4de2d6[_0x5dc2('0x29')]){delete _0x4de2d6['name'];}_0x12339c[_0x5dc2('0x1b')](_0x46af00)[_0x5dc2('0x2a')](_0x4de2d6);};}exports[_0x5dc2('0x2b')]=function(_0x99d515,_0x39d78e){var _0x140051={},_0xd641b3={},_0x356e84={'count':0x0,'rows':[]};var _0x5801f8=_[_0x5dc2('0x2c')](db[_0x5dc2('0x2d')][_0x5dc2('0x2e')],function(_0x43114f){return{'name':_0x43114f[_0x5dc2('0x2f')],'type':_0x43114f[_0x5dc2('0x30')][_0x5dc2('0x31')]};});_0xd641b3[_0x5dc2('0x32')]=_[_0x5dc2('0x2c')](_0x5801f8,'name');_0xd641b3['query']=_[_0x5dc2('0x33')](_0x99d515['query']);_0xd641b3[_0x5dc2('0x34')]=_[_0x5dc2('0x35')](_0xd641b3[_0x5dc2('0x32')],_0xd641b3['query']);_0x140051[_0x5dc2('0x36')]=_[_0x5dc2('0x35')](_0xd641b3['model'],qs['fields'](_0x99d515[_0x5dc2('0x37')]['fields']));_0x140051['attributes']=_0x140051['attributes']['length']?_0x140051[_0x5dc2('0x36')]:_0xd641b3['model'];if(!_0x99d515['query'][_0x5dc2('0x38')]('nolimit')){_0x140051[_0x5dc2('0x21')]=qs[_0x5dc2('0x21')](_0x99d515[_0x5dc2('0x37')]['limit']);_0x140051['offset']=qs['offset'](_0x99d515[_0x5dc2('0x37')]['offset']);}_0x140051[_0x5dc2('0x39')]=qs['sort'](_0x99d515['query'][_0x5dc2('0x3a')]);_0x140051['where']=qs[_0x5dc2('0x34')](_[_0x5dc2('0x3b')](_0x99d515['query'],_0xd641b3['filters']),_0x5801f8);if(_0x99d515['query'][_0x5dc2('0x3c')]){_0x140051[_0x5dc2('0x3d')]=_[_0x5dc2('0x3e')](_0x140051['where'],{'$or':_[_0x5dc2('0x2c')](_0x5801f8,function(_0x55ede2){if(_0x55ede2[_0x5dc2('0x30')]!==_0x5dc2('0x3f')){var _0x45663b={};_0x45663b[_0x55ede2[_0x5dc2('0x29')]]={'$like':'%'+_0x99d515['query'][_0x5dc2('0x3c')]+'%'};return _0x45663b;}})});}_0x140051=_[_0x5dc2('0x3e')]({},_0x140051,_0x99d515['options']);var _0x44ee3e={'where':_0x140051[_0x5dc2('0x3d')]};return db[_0x5dc2('0x2d')]['count'](_0x44ee3e)[_0x5dc2('0x26')](function(_0x8f30aa){_0x356e84[_0x5dc2('0x20')]=_0x8f30aa;if(_0x99d515['query'][_0x5dc2('0x40')]){_0x140051[_0x5dc2('0x41')]=[{'all':!![]}];}return db[_0x5dc2('0x2d')][_0x5dc2('0x42')](_0x140051);})[_0x5dc2('0x26')](function(_0x43881d){_0x356e84['rows']=_0x43881d;return _0x356e84;})[_0x5dc2('0x26')](respondWithFilteredResult(_0x39d78e,_0x140051))['catch'](handleError(_0x39d78e,null));};exports[_0x5dc2('0x43')]=function(_0x231ce4,_0xf6b6c1){var _0x256272={'raw':![],'where':{'id':_0x231ce4['params']['id']}},_0x953fdb={};_0x953fdb[_0x5dc2('0x32')]=_['keys'](db[_0x5dc2('0x2d')][_0x5dc2('0x2e')]);_0x953fdb['query']=_['keys'](_0x231ce4[_0x5dc2('0x37')]);_0x953fdb[_0x5dc2('0x34')]=_[_0x5dc2('0x35')](_0x953fdb['model'],_0x953fdb['query']);_0x256272[_0x5dc2('0x36')]=_[_0x5dc2('0x35')](_0x953fdb[_0x5dc2('0x32')],qs[_0x5dc2('0x44')](_0x231ce4['query'][_0x5dc2('0x44')]));_0x256272[_0x5dc2('0x36')]=_0x256272['attributes'][_0x5dc2('0x45')]?_0x256272['attributes']:_0x953fdb[_0x5dc2('0x32')];if(_0x231ce4['query']['includeAll']){_0x256272['include']=[{'all':!![]}];}_0x256272=_['merge']({},_0x256272,_0x231ce4['options']);return db['FreshdeskAccount'][_0x5dc2('0x46')](_0x256272)[_0x5dc2('0x26')](handleEntityNotFound(_0xf6b6c1,null))[_0x5dc2('0x26')](respondWithResult(_0xf6b6c1,null))[_0x5dc2('0x47')](handleError(_0xf6b6c1,null));};exports[_0x5dc2('0x48')]=function(_0x596b4b,_0x2c468f){return db['FreshdeskAccount'][_0x5dc2('0x48')](_0x596b4b[_0x5dc2('0x49')],{})[_0x5dc2('0x26')](respondWithResult(_0x2c468f,0xc9))['catch'](handleError(_0x2c468f,null));};exports[_0x5dc2('0x25')]=function(_0x251a45,_0x148717){if(_0x251a45['body']['id']){delete _0x251a45[_0x5dc2('0x49')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x251a45[_0x5dc2('0x4a')]['id']}})[_0x5dc2('0x26')](handleEntityNotFound(_0x148717,null))[_0x5dc2('0x26')](saveUpdates(_0x251a45[_0x5dc2('0x49')],null))[_0x5dc2('0x26')](respondWithResult(_0x148717,null))[_0x5dc2('0x47')](handleError(_0x148717,null));};exports[_0x5dc2('0x4b')]=function(_0x4b4cbb,_0x3ff5d1){return db[_0x5dc2('0x2d')]['find']({'where':{'id':_0x4b4cbb[_0x5dc2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ff5d1,null))[_0x5dc2('0x26')](removeEntity(_0x3ff5d1,null))[_0x5dc2('0x47')](handleError(_0x3ff5d1,null));};exports[_0x5dc2('0x4c')]=function(_0x36b7f8,_0x4ec732,_0x15e0c9){var _0x1079b1={};var _0x31465e={};var _0x17e0ae;var _0x358a76;return db['FreshdeskAccount'][_0x5dc2('0x4d')]({'where':{'id':_0x36b7f8[_0x5dc2('0x4a')]['id']}})[_0x5dc2('0x26')](handleEntityNotFound(_0x4ec732,null))['then'](function(_0x5e8973){if(_0x5e8973){_0x17e0ae=_0x5e8973;_0x31465e[_0x5dc2('0x32')]=_['keys'](db['FreshdeskConfiguration'][_0x5dc2('0x2e')]);_0x31465e[_0x5dc2('0x37')]=_[_0x5dc2('0x33')](_0x36b7f8[_0x5dc2('0x37')]);_0x31465e['filters']=_[_0x5dc2('0x35')](_0x31465e[_0x5dc2('0x32')],_0x31465e[_0x5dc2('0x37')]);_0x1079b1[_0x5dc2('0x36')]=_['intersection'](_0x31465e[_0x5dc2('0x32')],qs[_0x5dc2('0x44')](_0x36b7f8[_0x5dc2('0x37')][_0x5dc2('0x44')]));_0x1079b1[_0x5dc2('0x36')]=_0x1079b1[_0x5dc2('0x36')][_0x5dc2('0x45')]?_0x1079b1[_0x5dc2('0x36')]:_0x31465e['model'];_0x1079b1['order']=qs[_0x5dc2('0x3a')](_0x36b7f8[_0x5dc2('0x37')][_0x5dc2('0x3a')]);_0x1079b1[_0x5dc2('0x3d')]=qs[_0x5dc2('0x34')](_['pick'](_0x36b7f8['query'],_0x31465e[_0x5dc2('0x34')]));if(_0x36b7f8[_0x5dc2('0x37')]['filter']){_0x1079b1[_0x5dc2('0x3d')]=_[_0x5dc2('0x3e')](_0x1079b1['where'],{'$or':_[_0x5dc2('0x2c')](_0x1079b1[_0x5dc2('0x36')],function(_0x48e5eb){var _0x4f104b={};_0x4f104b[_0x48e5eb]={'$like':'%'+_0x36b7f8['query'][_0x5dc2('0x3c')]+'%'};return _0x4f104b;})});}_0x1079b1=_[_0x5dc2('0x3e')]({},_0x1079b1,_0x36b7f8[_0x5dc2('0x4e')]);return _0x17e0ae['getConfigurations'](_0x1079b1);}})[_0x5dc2('0x26')](function(_0x56a353){if(_0x56a353){_0x358a76=_0x56a353[_0x5dc2('0x45')];if(!_0x36b7f8[_0x5dc2('0x37')][_0x5dc2('0x38')]('nolimit')){_0x1079b1[_0x5dc2('0x21')]=qs[_0x5dc2('0x21')](_0x36b7f8[_0x5dc2('0x37')][_0x5dc2('0x21')]);_0x1079b1['offset']=qs[_0x5dc2('0x1e')](_0x36b7f8[_0x5dc2('0x37')][_0x5dc2('0x1e')]);}return _0x17e0ae['getConfigurations'](_0x1079b1);}})[_0x5dc2('0x26')](function(_0x4fb255){if(_0x4fb255){return _0x4fb255?{'count':_0x358a76,'rows':_0x4fb255}:null;}})[_0x5dc2('0x26')](respondWithResult(_0x4ec732,null))[_0x5dc2('0x47')](handleError(_0x4ec732,null));};exports['addConfiguration']=function(_0x3795b0,_0x1ced34,_0x1c6b4b){if(_0x3795b0['body']['id']){delete _0x3795b0[_0x5dc2('0x49')]['id'];}return db[_0x5dc2('0x2d')]['findOne']({'where':{'id':_0x3795b0[_0x5dc2('0x4a')]['id']}})[_0x5dc2('0x26')](handleEntityNotFound(_0x1ced34,null))[_0x5dc2('0x26')](function(_0x318de7){if(_0x318de7){_0x3795b0[_0x5dc2('0x49')][_0x5dc2('0x4f')]=_0x318de7['id'];_0x3795b0[_0x5dc2('0x49')]['Subjects']=integrations[_0x5dc2('0x50')](_0x3795b0[_0x5dc2('0x49')]['channel'],_0x3795b0[_0x5dc2('0x49')]['type']);_0x3795b0['body'][_0x5dc2('0x51')]=integrations['getDescriptions'](_0x3795b0[_0x5dc2('0x49')][_0x5dc2('0x52')],_0x3795b0[_0x5dc2('0x49')]['type']);return db[_0x5dc2('0x53')][_0x5dc2('0x48')](_0x3795b0[_0x5dc2('0x49')],{'include':[{'model':db[_0x5dc2('0x54')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x5dc2('0x51')}]});}return null;})[_0x5dc2('0x26')](respondWithResult(_0x1ced34,null))[_0x5dc2('0x47')](handleError(_0x1ced34,null));};exports[_0x5dc2('0x55')]=function(_0x5392fd,_0x3adfa6,_0xee4e46){var _0x117e70='';return db[_0x5dc2('0x2d')][_0x5dc2('0x4d')]({'where':{'id':_0x5392fd[_0x5dc2('0x4a')]['id']},'attributes':['id',_0x5dc2('0x56'),_0x5dc2('0x57')]})['then'](handleEntityNotFound(_0x3adfa6,null))[_0x5dc2('0x26')](function(_0x1854c1){if(_0x1854c1){_0x117e70=_0x1854c1[_0x5dc2('0x56')];var _0x572f3d=_0x117e70['slice'](-0x1);if(_0x572f3d==='/'){_0x117e70=_0x117e70[_0x5dc2('0x58')](0x0,_0x117e70['lastIndexOf'](_0x572f3d));}return rp({'method':_0x5dc2('0x59'),'uri':util[_0x5dc2('0x5a')](_0x5dc2('0x5b'),_0x117e70,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x5dc2('0x5a')]('Basic\x20%s',new Buffer(util[_0x5dc2('0x5a')](_0x5dc2('0x5c'),_0x1854c1[_0x5dc2('0x57')]))['toString'](_0x5dc2('0x5d')))},'json':!![]});}})[_0x5dc2('0x26')](function(_0x33618b){if(_0x33618b){var _0x285a01=[_0x5dc2('0x5e'),_0x5dc2('0x5f'),_0x5dc2('0x60'),_0x5dc2('0x61'),_0x5dc2('0x1b'),_0x5dc2('0x62'),_0x5dc2('0x63'),_0x5dc2('0x64'),_0x5dc2('0x65'),_0x5dc2('0x63'),_0x5dc2('0x66')];_[_0x5dc2('0x67')](_0x33618b,function(_0x44cd58){return _0x285a01[_0x5dc2('0x68')](_0x44cd58['name'])||!_0x44cd58['default']&&_0x44cd58['type']!==_0x5dc2('0x69')&&_0x44cd58[_0x5dc2('0x30')]!==_0x5dc2('0x6a');});return{'count':_0x33618b[_0x5dc2('0x45')],'rows':_[_0x5dc2('0x2c')](_0x33618b,function(_0x3e4e51){return{'id':_0x3e4e51[_0x5dc2('0x29')],'name':_0x3e4e51[_0x5dc2('0x6b')],'custom':!_0x3e4e51[_0x5dc2('0x6c')],'options':_0x3e4e51[_0x5dc2('0x6d')]?_[_0x5dc2('0x2c')](_0x3e4e51[_0x5dc2('0x6d')],function(_0x44c1b2){return{'name':_[_0x5dc2('0x6e')](_0x44c1b2),'value':_0x44c1b2};}):[]};})};}})[_0x5dc2('0x26')](respondWithResult(_0x3adfa6,null))[_0x5dc2('0x47')](function(_0x3a9413){var _0x7c76ed=_0x5392fd[_0x5dc2('0x37')][_0x5dc2('0x6f')]?0x1f4:_0x3a9413[_0x5dc2('0x70')]||0x1f4;logger[_0x5dc2('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x5dc2('0x55'),_0x7c76ed,JSON[_0x5dc2('0x71')](_0x3a9413));delete _0x3a9413['name'];if(_0x7c76ed===0x191){_0x7c76ed=0x190;}_0x3adfa6[_0x5dc2('0x1b')](_0x7c76ed)[_0x5dc2('0x2a')](_0x5392fd[_0x5dc2('0x37')][_0x5dc2('0x6f')]?{'message':_0x5dc2('0x72'),'statusCode':_0x3a9413[_0x5dc2('0x70')]}:_0x3a9413);});}; \ No newline at end of file +var _0x2cb0=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','merge','options','count','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','format','%s:X','toString','base64','requester','subject','agent','description','priority','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','offset','set','apply','reject','destroy','then','error','stack','name','send','FreshdeskAccount','type','key','query','intersection'];(function(_0x38b09a,_0x55c588){var _0x23c012=function(_0x244d99){while(--_0x244d99){_0x38b09a['push'](_0x38b09a['shift']());}};_0x23c012(++_0x55c588);}(_0x2cb0,0x12c));var _0x02cb=function(_0xe5b356,_0x222321){_0xe5b356=_0xe5b356-0x0;var _0x187cf7=_0x2cb0[_0xe5b356];return _0x187cf7;};'use strict';var emlformat=require(_0x02cb('0x0'));var rimraf=require(_0x02cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02cb('0x2'));var rp=require(_0x02cb('0x3'));var moment=require(_0x02cb('0x4'));var BPromise=require(_0x02cb('0x5'));var Mustache=require('mustache');var util=require(_0x02cb('0x6'));var path=require(_0x02cb('0x7'));var sox=require(_0x02cb('0x8'));var csv=require(_0x02cb('0x9'));var ejs=require(_0x02cb('0xa'));var fs=require('fs');var fs_extra=require(_0x02cb('0xb'));var _=require(_0x02cb('0xc'));var squel=require(_0x02cb('0xd'));var crypto=require('crypto');var jsforce=require(_0x02cb('0xe'));var deskjs=require(_0x02cb('0xf'));var toCsv=require(_0x02cb('0x9'));var querystring=require(_0x02cb('0x10'));var Papa=require(_0x02cb('0x11'));var Redis=require('ioredis');var authService=require(_0x02cb('0x12'));var qs=require(_0x02cb('0x13'));var as=require(_0x02cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02cb('0x15'))(_0x02cb('0x16'));var utils=require(_0x02cb('0x17'));var config=require(_0x02cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x02cb('0x19'))['db'];var integrations=require(_0x02cb('0x1a'));function respondWithStatusCode(_0x403cc9,_0x6f43c0){_0x6f43c0=_0x6f43c0||0xcc;return function(_0x45f349){if(_0x45f349){return _0x403cc9[_0x02cb('0x1b')](_0x6f43c0);}return _0x403cc9['status'](_0x6f43c0)[_0x02cb('0x1c')]();};}function respondWithResult(_0x331583,_0x2026f6){_0x2026f6=_0x2026f6||0xc8;return function(_0x4a447b){if(_0x4a447b){return _0x331583[_0x02cb('0x1d')](_0x2026f6)[_0x02cb('0x1e')](_0x4a447b);}};}function respondWithFilteredResult(_0xd34d82,_0x29d567){return function(_0x1c88aa){if(_0x1c88aa){var _0x5305f2=typeof _0x29d567['offset']===_0x02cb('0x1f')&&typeof _0x29d567[_0x02cb('0x20')]===_0x02cb('0x1f');var _0x24cdfb=_0x1c88aa['count'];var _0x319243=_0x5305f2?0x0:_0x29d567['offset'];var _0x365905=_0x5305f2?_0x1c88aa['count']:_0x29d567[_0x02cb('0x21')]+_0x29d567[_0x02cb('0x20')];var _0xd24ebc;if(_0x365905>=_0x24cdfb){_0x365905=_0x24cdfb;_0xd24ebc=0xc8;}else{_0xd24ebc=0xce;}_0xd34d82['status'](_0xd24ebc);return _0xd34d82[_0x02cb('0x22')]('Content-Range',_0x319243+'-'+_0x365905+'/'+_0x24cdfb)[_0x02cb('0x1e')](_0x1c88aa);}return null;};}function patchUpdates(_0x2e7666){return function(_0x463377){try{jsonpatch[_0x02cb('0x23')](_0x463377,_0x2e7666,!![]);}catch(_0x3756d2){return BPromise[_0x02cb('0x24')](_0x3756d2);}return _0x463377['save']();};}function saveUpdates(_0x2c6f84,_0x443ca5){return function(_0x36c192){if(_0x36c192){return _0x36c192['update'](_0x2c6f84)['then'](function(_0x58423b){return _0x58423b;});}return null;};}function removeEntity(_0x4fde1c,_0x286b1c){return function(_0x30f2a4){if(_0x30f2a4){return _0x30f2a4[_0x02cb('0x25')]()[_0x02cb('0x26')](function(){_0x4fde1c[_0x02cb('0x1d')](0xcc)[_0x02cb('0x1c')]();});}};}function handleEntityNotFound(_0x22ee3f,_0x2ee82f){return function(_0x45d31d){if(!_0x45d31d){_0x22ee3f['sendStatus'](0x194);}return _0x45d31d;};}function handleError(_0x30990e,_0x30da3f){_0x30da3f=_0x30da3f||0x1f4;return function(_0x2cd1d2){logger[_0x02cb('0x27')](_0x2cd1d2[_0x02cb('0x28')]);if(_0x2cd1d2[_0x02cb('0x29')]){delete _0x2cd1d2[_0x02cb('0x29')];}_0x30990e[_0x02cb('0x1d')](_0x30da3f)[_0x02cb('0x2a')](_0x2cd1d2);};}exports['index']=function(_0x5816d0,_0xb37fb5){var _0x3c921e={},_0x195700={},_0x37d2c8={'count':0x0,'rows':[]};var _0x418735=_['map'](db[_0x02cb('0x2b')]['rawAttributes'],function(_0x36fc91){return{'name':_0x36fc91['fieldName'],'type':_0x36fc91[_0x02cb('0x2c')][_0x02cb('0x2d')]};});_0x195700['model']=_['map'](_0x418735,_0x02cb('0x29'));_0x195700['query']=_['keys'](_0x5816d0[_0x02cb('0x2e')]);_0x195700['filters']=_[_0x02cb('0x2f')](_0x195700[_0x02cb('0x30')],_0x195700[_0x02cb('0x2e')]);_0x3c921e[_0x02cb('0x31')]=_[_0x02cb('0x2f')](_0x195700[_0x02cb('0x30')],qs[_0x02cb('0x32')](_0x5816d0[_0x02cb('0x2e')][_0x02cb('0x32')]));_0x3c921e[_0x02cb('0x31')]=_0x3c921e[_0x02cb('0x31')][_0x02cb('0x33')]?_0x3c921e['attributes']:_0x195700['model'];if(!_0x5816d0[_0x02cb('0x2e')][_0x02cb('0x34')](_0x02cb('0x35'))){_0x3c921e[_0x02cb('0x20')]=qs[_0x02cb('0x20')](_0x5816d0[_0x02cb('0x2e')][_0x02cb('0x20')]);_0x3c921e[_0x02cb('0x21')]=qs[_0x02cb('0x21')](_0x5816d0[_0x02cb('0x2e')][_0x02cb('0x21')]);}_0x3c921e[_0x02cb('0x36')]=qs[_0x02cb('0x37')](_0x5816d0[_0x02cb('0x2e')][_0x02cb('0x37')]);_0x3c921e['where']=qs[_0x02cb('0x38')](_[_0x02cb('0x39')](_0x5816d0[_0x02cb('0x2e')],_0x195700[_0x02cb('0x38')]),_0x418735);if(_0x5816d0[_0x02cb('0x2e')][_0x02cb('0x3a')]){_0x3c921e['where']=_['merge'](_0x3c921e[_0x02cb('0x3b')],{'$or':_[_0x02cb('0x3c')](_0x418735,function(_0xa99d2d){if(_0xa99d2d['type']!=='VIRTUAL'){var _0x4744de={};_0x4744de[_0xa99d2d['name']]={'$like':'%'+_0x5816d0[_0x02cb('0x2e')][_0x02cb('0x3a')]+'%'};return _0x4744de;}})});}_0x3c921e=_[_0x02cb('0x3d')]({},_0x3c921e,_0x5816d0[_0x02cb('0x3e')]);var _0x8654d8={'where':_0x3c921e[_0x02cb('0x3b')]};return db[_0x02cb('0x2b')][_0x02cb('0x3f')](_0x8654d8)['then'](function(_0x59bb54){_0x37d2c8[_0x02cb('0x3f')]=_0x59bb54;if(_0x5816d0[_0x02cb('0x2e')]['includeAll']){_0x3c921e[_0x02cb('0x40')]=[{'all':!![]}];}return db[_0x02cb('0x2b')][_0x02cb('0x41')](_0x3c921e);})['then'](function(_0x280d94){_0x37d2c8[_0x02cb('0x42')]=_0x280d94;return _0x37d2c8;})[_0x02cb('0x26')](respondWithFilteredResult(_0xb37fb5,_0x3c921e))[_0x02cb('0x43')](handleError(_0xb37fb5,null));};exports[_0x02cb('0x44')]=function(_0x5cf1d4,_0x55b53e){var _0x33e625={'raw':![],'where':{'id':_0x5cf1d4[_0x02cb('0x45')]['id']}},_0x433eda={};_0x433eda[_0x02cb('0x30')]=_['keys'](db['FreshdeskAccount'][_0x02cb('0x46')]);_0x433eda['query']=_[_0x02cb('0x47')](_0x5cf1d4['query']);_0x433eda[_0x02cb('0x38')]=_[_0x02cb('0x2f')](_0x433eda[_0x02cb('0x30')],_0x433eda[_0x02cb('0x2e')]);_0x33e625[_0x02cb('0x31')]=_[_0x02cb('0x2f')](_0x433eda[_0x02cb('0x30')],qs['fields'](_0x5cf1d4[_0x02cb('0x2e')][_0x02cb('0x32')]));_0x33e625[_0x02cb('0x31')]=_0x33e625['attributes'][_0x02cb('0x33')]?_0x33e625[_0x02cb('0x31')]:_0x433eda[_0x02cb('0x30')];if(_0x5cf1d4[_0x02cb('0x2e')][_0x02cb('0x48')]){_0x33e625[_0x02cb('0x40')]=[{'all':!![]}];}_0x33e625=_[_0x02cb('0x3d')]({},_0x33e625,_0x5cf1d4['options']);return db[_0x02cb('0x2b')][_0x02cb('0x49')](_0x33e625)[_0x02cb('0x26')](handleEntityNotFound(_0x55b53e,null))[_0x02cb('0x26')](respondWithResult(_0x55b53e,null))[_0x02cb('0x43')](handleError(_0x55b53e,null));};exports[_0x02cb('0x4a')]=function(_0x192c53,_0x1703ef){return db['FreshdeskAccount'][_0x02cb('0x4a')](_0x192c53[_0x02cb('0x4b')],{})[_0x02cb('0x26')](respondWithResult(_0x1703ef,0xc9))['catch'](handleError(_0x1703ef,null));};exports[_0x02cb('0x4c')]=function(_0x2ada73,_0x95fef1){if(_0x2ada73[_0x02cb('0x4b')]['id']){delete _0x2ada73[_0x02cb('0x4b')]['id'];}return db[_0x02cb('0x2b')][_0x02cb('0x49')]({'where':{'id':_0x2ada73[_0x02cb('0x45')]['id']}})[_0x02cb('0x26')](handleEntityNotFound(_0x95fef1,null))[_0x02cb('0x26')](saveUpdates(_0x2ada73['body'],null))[_0x02cb('0x26')](respondWithResult(_0x95fef1,null))[_0x02cb('0x43')](handleError(_0x95fef1,null));};exports[_0x02cb('0x25')]=function(_0x48c475,_0x3c2899){return db[_0x02cb('0x2b')][_0x02cb('0x49')]({'where':{'id':_0x48c475[_0x02cb('0x45')]['id']}})[_0x02cb('0x26')](handleEntityNotFound(_0x3c2899,null))[_0x02cb('0x26')](removeEntity(_0x3c2899,null))[_0x02cb('0x43')](handleError(_0x3c2899,null));};exports[_0x02cb('0x4d')]=function(_0x51f486,_0x3f03c2,_0x5ccb10){var _0x4011c6={};var _0x24ae12={};var _0x45b197;var _0x50dcb3;return db['FreshdeskAccount'][_0x02cb('0x4e')]({'where':{'id':_0x51f486['params']['id']}})[_0x02cb('0x26')](handleEntityNotFound(_0x3f03c2,null))[_0x02cb('0x26')](function(_0x554583){if(_0x554583){_0x45b197=_0x554583;_0x24ae12[_0x02cb('0x30')]=_[_0x02cb('0x47')](db[_0x02cb('0x4f')][_0x02cb('0x46')]);_0x24ae12[_0x02cb('0x2e')]=_[_0x02cb('0x47')](_0x51f486[_0x02cb('0x2e')]);_0x24ae12[_0x02cb('0x38')]=_[_0x02cb('0x2f')](_0x24ae12[_0x02cb('0x30')],_0x24ae12['query']);_0x4011c6[_0x02cb('0x31')]=_[_0x02cb('0x2f')](_0x24ae12[_0x02cb('0x30')],qs[_0x02cb('0x32')](_0x51f486[_0x02cb('0x2e')][_0x02cb('0x32')]));_0x4011c6[_0x02cb('0x31')]=_0x4011c6['attributes']['length']?_0x4011c6[_0x02cb('0x31')]:_0x24ae12[_0x02cb('0x30')];_0x4011c6[_0x02cb('0x36')]=qs[_0x02cb('0x37')](_0x51f486[_0x02cb('0x2e')][_0x02cb('0x37')]);_0x4011c6[_0x02cb('0x3b')]=qs[_0x02cb('0x38')](_['pick'](_0x51f486[_0x02cb('0x2e')],_0x24ae12[_0x02cb('0x38')]));if(_0x51f486['query'][_0x02cb('0x3a')]){_0x4011c6['where']=_[_0x02cb('0x3d')](_0x4011c6[_0x02cb('0x3b')],{'$or':_[_0x02cb('0x3c')](_0x4011c6['attributes'],function(_0x15fbf7){var _0x508d81={};_0x508d81[_0x15fbf7]={'$like':'%'+_0x51f486[_0x02cb('0x2e')][_0x02cb('0x3a')]+'%'};return _0x508d81;})});}_0x4011c6=_[_0x02cb('0x3d')]({},_0x4011c6,_0x51f486[_0x02cb('0x3e')]);return _0x45b197['getConfigurations'](_0x4011c6);}})[_0x02cb('0x26')](function(_0xa78c83){if(_0xa78c83){_0x50dcb3=_0xa78c83['length'];if(!_0x51f486[_0x02cb('0x2e')]['hasOwnProperty'](_0x02cb('0x35'))){_0x4011c6[_0x02cb('0x20')]=qs[_0x02cb('0x20')](_0x51f486[_0x02cb('0x2e')][_0x02cb('0x20')]);_0x4011c6[_0x02cb('0x21')]=qs[_0x02cb('0x21')](_0x51f486['query'][_0x02cb('0x21')]);}return _0x45b197[_0x02cb('0x4d')](_0x4011c6);}})[_0x02cb('0x26')](function(_0xd4cf68){if(_0xd4cf68){return _0xd4cf68?{'count':_0x50dcb3,'rows':_0xd4cf68}:null;}})[_0x02cb('0x26')](respondWithResult(_0x3f03c2,null))[_0x02cb('0x43')](handleError(_0x3f03c2,null));};exports[_0x02cb('0x50')]=function(_0x580487,_0x1ad9ba,_0x51ee3a){if(_0x580487[_0x02cb('0x4b')]['id']){delete _0x580487['body']['id'];}return db['FreshdeskAccount'][_0x02cb('0x4e')]({'where':{'id':_0x580487[_0x02cb('0x45')]['id']}})[_0x02cb('0x26')](handleEntityNotFound(_0x1ad9ba,null))['then'](function(_0x459c0d){if(_0x459c0d){_0x580487['body'][_0x02cb('0x51')]=_0x459c0d['id'];_0x580487[_0x02cb('0x4b')][_0x02cb('0x52')]=integrations[_0x02cb('0x53')](_0x580487[_0x02cb('0x4b')]['channel'],_0x580487['body']['type']);_0x580487[_0x02cb('0x4b')]['Descriptions']=integrations[_0x02cb('0x54')](_0x580487[_0x02cb('0x4b')]['channel'],_0x580487[_0x02cb('0x4b')][_0x02cb('0x2c')]);return db[_0x02cb('0x4f')][_0x02cb('0x4a')](_0x580487[_0x02cb('0x4b')],{'include':[{'model':db[_0x02cb('0x55')],'as':_0x02cb('0x52')},{'model':db[_0x02cb('0x55')],'as':_0x02cb('0x56')}]});}return null;})['then'](respondWithResult(_0x1ad9ba,null))[_0x02cb('0x43')](handleError(_0x1ad9ba,null));};exports['getFields']=function(_0x441940,_0x21cbb5,_0xd16021){var _0x514adb='';return db[_0x02cb('0x2b')][_0x02cb('0x4e')]({'where':{'id':_0x441940['params']['id']},'attributes':['id',_0x02cb('0x57'),_0x02cb('0x58')]})['then'](handleEntityNotFound(_0x21cbb5,null))['then'](function(_0x45110a){if(_0x45110a){_0x514adb=_0x45110a[_0x02cb('0x57')];var _0x5ef93c=_0x514adb[_0x02cb('0x59')](-0x1);if(_0x5ef93c==='/'){_0x514adb=_0x514adb[_0x02cb('0x5a')](0x0,_0x514adb[_0x02cb('0x5b')](_0x5ef93c));}return rp({'method':'GET','uri':util['format'](_0x02cb('0x5c'),_0x514adb,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x02cb('0x5d')]('Basic\x20%s',new Buffer(util[_0x02cb('0x5d')](_0x02cb('0x5e'),_0x45110a['apiKey']))[_0x02cb('0x5f')](_0x02cb('0x60')))},'json':!![]});}})[_0x02cb('0x26')](function(_0x3dfdbb){if(_0x3dfdbb){var _0x46ff39=[_0x02cb('0x61'),_0x02cb('0x62'),_0x02cb('0x63'),_0x02cb('0x64'),_0x02cb('0x1d'),_0x02cb('0x65'),'group',_0x02cb('0x66'),_0x02cb('0x67'),'group',_0x02cb('0x68')];_[_0x02cb('0x69')](_0x3dfdbb,function(_0xde5078){return _0x46ff39['includes'](_0xde5078[_0x02cb('0x29')])||!_0xde5078[_0x02cb('0x6a')]&&_0xde5078[_0x02cb('0x2c')]!==_0x02cb('0x6b')&&_0xde5078[_0x02cb('0x2c')]!==_0x02cb('0x6c');});return{'count':_0x3dfdbb[_0x02cb('0x33')],'rows':_[_0x02cb('0x3c')](_0x3dfdbb,function(_0x458c89){return{'id':_0x458c89[_0x02cb('0x29')],'name':_0x458c89[_0x02cb('0x6d')],'custom':!_0x458c89[_0x02cb('0x6a')],'options':_0x458c89[_0x02cb('0x6e')]?_[_0x02cb('0x3c')](_0x458c89[_0x02cb('0x6e')],function(_0x35533d){return{'name':_['capitalize'](_0x35533d),'value':_0x35533d};}):[]};})};}})[_0x02cb('0x26')](respondWithResult(_0x21cbb5,null))[_0x02cb('0x43')](function(_0x46711b){var _0x2ac7eb=_0x441940[_0x02cb('0x2e')][_0x02cb('0x6f')]?0x1f4:_0x46711b[_0x02cb('0x70')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x02cb('0x71'),_0x2ac7eb,JSON[_0x02cb('0x72')](_0x46711b));delete _0x46711b[_0x02cb('0x29')];if(_0x2ac7eb===0x191){_0x2ac7eb=0x190;}_0x21cbb5['status'](_0x2ac7eb)[_0x02cb('0x2a')](_0x441940[_0x02cb('0x2e')][_0x02cb('0x6f')]?{'message':_0x02cb('0x73'),'statusCode':_0x46711b[_0x02cb('0x70')]}:_0x46711b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f3d7828..60b8bc3 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5da=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3cc6b4,_0x58b1aa){var _0x1c07b8=function(_0x156458){while(--_0x156458){_0x3cc6b4['push'](_0x3cc6b4['shift']());}};_0x1c07b8(++_0x58b1aa);}(_0xc5da,0x102));var _0xac5d=function(_0x4901c4,_0x24dc97){_0x4901c4=_0x4901c4-0x0;var _0x2b3c04=_0xc5da[_0x4901c4];return _0x2b3c04;};'use strict';var _=require(_0xac5d('0x0'));var util=require(_0xac5d('0x1'));var logger=require(_0xac5d('0x2'))(_0xac5d('0x3'));var moment=require(_0xac5d('0x4'));var BPromise=require(_0xac5d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac5d('0x6'));var rimraf=require('rimraf');var config=require(_0xac5d('0x7'));var attributes=require(_0xac5d('0x8'));var integrations=require(_0xac5d('0x9'));module[_0xac5d('0xa')]=function(_0x297210,_0x5d3aee){return _0x297210[_0xac5d('0xb')](_0xac5d('0xc'),attributes,{'tableName':_0xac5d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cf3=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x3c691c,_0x75c10a){var _0x5703a0=function(_0x4ffc4a){while(--_0x4ffc4a){_0x3c691c['push'](_0x3c691c['shift']());}};_0x5703a0(++_0x75c10a);}(_0x9cf3,0x9a));var _0x39cf=function(_0x3e578e,_0xbab174){_0x3e578e=_0x3e578e-0x0;var _0x296309=_0x9cf3[_0x3e578e];return _0x296309;};'use strict';var _=require(_0x39cf('0x0'));var util=require(_0x39cf('0x1'));var logger=require(_0x39cf('0x2'))('api');var moment=require(_0x39cf('0x3'));var BPromise=require(_0x39cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39cf('0x5'));var rimraf=require(_0x39cf('0x6'));var config=require(_0x39cf('0x7'));var attributes=require(_0x39cf('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x399e6c,_0xb66410){return _0x399e6c['define'](_0x39cf('0x9'),attributes,{'tableName':_0x39cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index f6ff05c..57c9c67 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x738e=['client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','include','map','model','debug','find','ShowFreshdeskAccount','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x50fbd0,_0x1e2d95){var _0x888dec=function(_0x1fda93){while(--_0x1fda93){_0x50fbd0['push'](_0x50fbd0['shift']());}};_0x888dec(++_0x1e2d95);}(_0x738e,0xbe));var _0xe738=function(_0x1dab75,_0x584b43){_0x1dab75=_0x1dab75-0x0;var _0x59df44=_0x738e[_0x1dab75];return _0x59df44;};'use strict';var _=require('lodash');var util=require(_0xe738('0x0'));var moment=require(_0xe738('0x1'));var BPromise=require('bluebird');var rs=require(_0xe738('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe738('0x3'))['db'];var utils=require(_0xe738('0x4'));var logger=require(_0xe738('0x5'))(_0xe738('0x6'));var config=require(_0xe738('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe738('0x8')][_0xe738('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x135fdf,_0x1049a2,_0x50f14c){return new BPromise(function(_0x382280,_0x8fa73b){return client['request'](_0x135fdf,_0x50f14c)[_0xe738('0xa')](function(_0x3e17d2){logger[_0xe738('0xb')](_0xe738('0xc'),_0x1049a2,_0xe738('0xd'));logger['debug'](_0xe738('0xe'),_0x1049a2,_0xe738('0xd'),JSON[_0xe738('0xf')](_0x3e17d2));if(_0x3e17d2['error']){if(_0x3e17d2['error'][_0xe738('0x10')]===0x1f4){logger[_0xe738('0x11')](_0xe738('0xc'),_0x1049a2,_0x3e17d2[_0xe738('0x11')]['message']);return _0x8fa73b(_0x3e17d2[_0xe738('0x11')][_0xe738('0x12')]);}logger[_0xe738('0x11')](_0xe738('0xc'),_0x1049a2,_0x3e17d2['error'][_0xe738('0x12')]);return _0x382280(_0x3e17d2[_0xe738('0x11')][_0xe738('0x12')]);}else{logger[_0xe738('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x1049a2,'request\x20sent');_0x382280(_0x3e17d2[_0xe738('0x13')][_0xe738('0x12')]);}})[_0xe738('0x14')](function(_0x1a487c){logger[_0xe738('0x11')](_0xe738('0xc'),_0x1049a2,_0x1a487c);_0x8fa73b(_0x1a487c);});});}exports[_0xe738('0x15')]=function(_0x3622c0){var _0x2f3c16=this;return new Promise(function(_0x123684,_0x207ae4){return db[_0xe738('0x16')][_0xe738('0x17')]({'raw':_0x3622c0[_0xe738('0x18')]?_0x3622c0[_0xe738('0x18')][_0xe738('0x19')]===undefined?!![]:![]:!![],'where':_0x3622c0[_0xe738('0x18')]?_0x3622c0['options']['where']||null:null,'attributes':_0x3622c0[_0xe738('0x18')]?_0x3622c0['options'][_0xe738('0x1a')]||null:null,'limit':_0x3622c0['options']?_0x3622c0[_0xe738('0x18')]['limit']||null:null,'include':_0x3622c0['options']?_0x3622c0[_0xe738('0x18')][_0xe738('0x1b')]?_[_0xe738('0x1c')](_0x3622c0['options']['include'],function(_0x19ff0c){return{'model':db[_0x19ff0c[_0xe738('0x1d')]],'as':_0x19ff0c['as'],'attributes':_0x19ff0c[_0xe738('0x1a')],'include':_0x19ff0c['include']?_[_0xe738('0x1c')](_0x19ff0c[_0xe738('0x1b')],function(_0x433c1d){return{'model':db[_0x433c1d[_0xe738('0x1d')]],'as':_0x433c1d['as'],'attributes':_0x433c1d['attributes'],'include':_0x433c1d['include']?_['map'](_0x433c1d[_0xe738('0x1b')],function(_0x155f79){return{'model':db[_0x155f79[_0xe738('0x1d')]],'as':_0x155f79['as'],'attributes':_0x155f79['attributes']};}):[]};}):[]};}):[]:[]})[_0xe738('0xa')](function(_0x13dfd4){logger[_0xe738('0xb')](_0xe738('0x15'),_0x3622c0);logger[_0xe738('0x1e')](_0xe738('0x15'),_0x3622c0,JSON[_0xe738('0xf')](_0x13dfd4));_0x123684(_0x13dfd4);})[_0xe738('0x14')](function(_0x5e602f){logger[_0xe738('0x11')](_0xe738('0x15'),_0x5e602f[_0xe738('0x12')],_0x3622c0);_0x207ae4(_0x2f3c16[_0xe738('0x11')](0x1f4,_0x5e602f[_0xe738('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x2d7285){var _0x289662=this;return new Promise(function(_0x3b4c4f,_0x3c2576){return db[_0xe738('0x16')][_0xe738('0x1f')]({'raw':_0x2d7285[_0xe738('0x18')]?_0x2d7285['options'][_0xe738('0x19')]===undefined?!![]:![]:!![],'where':_0x2d7285['options']?_0x2d7285[_0xe738('0x18')]['where']||null:null,'attributes':_0x2d7285[_0xe738('0x18')]?_0x2d7285[_0xe738('0x18')][_0xe738('0x1a')]||null:null,'include':_0x2d7285[_0xe738('0x18')]?_0x2d7285[_0xe738('0x18')][_0xe738('0x1b')]?_[_0xe738('0x1c')](_0x2d7285[_0xe738('0x18')][_0xe738('0x1b')],function(_0x597774){return{'model':db[_0x597774[_0xe738('0x1d')]],'as':_0x597774['as'],'attributes':_0x597774['attributes'],'include':_0x597774[_0xe738('0x1b')]?_[_0xe738('0x1c')](_0x597774[_0xe738('0x1b')],function(_0x5eabe1){return{'model':db[_0x5eabe1['model']],'as':_0x5eabe1['as'],'attributes':_0x5eabe1[_0xe738('0x1a')],'include':_0x5eabe1[_0xe738('0x1b')]?_['map'](_0x5eabe1[_0xe738('0x1b')],function(_0xc64754){return{'model':db[_0xc64754['model']],'as':_0xc64754['as'],'attributes':_0xc64754[_0xe738('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe738('0xa')](function(_0x4bcee4){logger[_0xe738('0xb')](_0xe738('0x20'),_0x2d7285);logger[_0xe738('0x1e')](_0xe738('0x20'),_0x2d7285,JSON[_0xe738('0xf')](_0x4bcee4));_0x3b4c4f(_0x4bcee4);})[_0xe738('0x14')](function(_0x9b3c4f){logger[_0xe738('0x11')](_0xe738('0x20'),_0x9b3c4f[_0xe738('0x12')],_0x2d7285);_0x3c2576(_0x289662[_0xe738('0x11')](0x1f4,_0x9b3c4f[_0xe738('0x12')]));});});}; \ No newline at end of file +var _0xee16=['stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','find','ShowFreshdeskAccount','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1a90fc,_0x1f232f){var _0x48c470=function(_0x4c6f69){while(--_0x4c6f69){_0x1a90fc['push'](_0x1a90fc['shift']());}};_0x48c470(++_0x1f232f);}(_0xee16,0x187));var _0x6ee1=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0xee16[_0x54a2e4];return _0x4742d0;};'use strict';var _=require('lodash');var util=require(_0x6ee1('0x0'));var moment=require(_0x6ee1('0x1'));var BPromise=require(_0x6ee1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ee1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ee1('0x4'));var logger=require('../../config/logger')(_0x6ee1('0x5'));var config=require(_0x6ee1('0x6'));var jayson=require(_0x6ee1('0x7'));var client=jayson[_0x6ee1('0x8')][_0x6ee1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2170aa,_0x5199df,_0x379dee){return new BPromise(function(_0x153954,_0x250f51){return client[_0x6ee1('0xa')](_0x2170aa,_0x379dee)[_0x6ee1('0xb')](function(_0x387cf0){logger[_0x6ee1('0xc')](_0x6ee1('0xd'),_0x5199df,'request\x20sent');logger[_0x6ee1('0xe')](_0x6ee1('0xf'),_0x5199df,_0x6ee1('0x10'),JSON[_0x6ee1('0x11')](_0x387cf0));if(_0x387cf0['error']){if(_0x387cf0[_0x6ee1('0x12')][_0x6ee1('0x13')]===0x1f4){logger[_0x6ee1('0x12')](_0x6ee1('0xd'),_0x5199df,_0x387cf0[_0x6ee1('0x12')][_0x6ee1('0x14')]);return _0x250f51(_0x387cf0['error'][_0x6ee1('0x14')]);}logger[_0x6ee1('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x5199df,_0x387cf0['error']['message']);return _0x153954(_0x387cf0['error'][_0x6ee1('0x14')]);}else{logger[_0x6ee1('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x5199df,'request\x20sent');_0x153954(_0x387cf0['result']['message']);}})[_0x6ee1('0x15')](function(_0x52d7f1){logger['error'](_0x6ee1('0xd'),_0x5199df,_0x52d7f1);_0x250f51(_0x52d7f1);});});}exports[_0x6ee1('0x16')]=function(_0x5838a6){var _0x583aab=this;return new Promise(function(_0x1055ad,_0x310ed6){return db[_0x6ee1('0x17')][_0x6ee1('0x18')]({'raw':_0x5838a6[_0x6ee1('0x19')]?_0x5838a6['options'][_0x6ee1('0x1a')]===undefined?!![]:![]:!![],'where':_0x5838a6[_0x6ee1('0x19')]?_0x5838a6['options']['where']||null:null,'attributes':_0x5838a6[_0x6ee1('0x19')]?_0x5838a6['options'][_0x6ee1('0x1b')]||null:null,'limit':_0x5838a6[_0x6ee1('0x19')]?_0x5838a6[_0x6ee1('0x19')][_0x6ee1('0x1c')]||null:null,'include':_0x5838a6[_0x6ee1('0x19')]?_0x5838a6[_0x6ee1('0x19')][_0x6ee1('0x1d')]?_[_0x6ee1('0x1e')](_0x5838a6['options'][_0x6ee1('0x1d')],function(_0x279a30){return{'model':db[_0x279a30[_0x6ee1('0x1f')]],'as':_0x279a30['as'],'attributes':_0x279a30['attributes'],'include':_0x279a30['include']?_[_0x6ee1('0x1e')](_0x279a30[_0x6ee1('0x1d')],function(_0x1c8406){return{'model':db[_0x1c8406[_0x6ee1('0x1f')]],'as':_0x1c8406['as'],'attributes':_0x1c8406[_0x6ee1('0x1b')],'include':_0x1c8406[_0x6ee1('0x1d')]?_[_0x6ee1('0x1e')](_0x1c8406[_0x6ee1('0x1d')],function(_0x2eecf0){return{'model':db[_0x2eecf0['model']],'as':_0x2eecf0['as'],'attributes':_0x2eecf0[_0x6ee1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ee1('0xb')](function(_0x48cfad){logger[_0x6ee1('0xc')](_0x6ee1('0x16'),_0x5838a6);logger[_0x6ee1('0xe')](_0x6ee1('0x16'),_0x5838a6,JSON[_0x6ee1('0x11')](_0x48cfad));_0x1055ad(_0x48cfad);})[_0x6ee1('0x15')](function(_0xf04613){logger[_0x6ee1('0x12')](_0x6ee1('0x16'),_0xf04613[_0x6ee1('0x14')],_0x5838a6);_0x310ed6(_0x583aab[_0x6ee1('0x12')](0x1f4,_0xf04613['message']));});});};exports['ShowFreshdeskAccount']=function(_0x2a58f7){var _0x2d3787=this;return new Promise(function(_0x5789ef,_0x58fecb){return db[_0x6ee1('0x17')][_0x6ee1('0x20')]({'raw':_0x2a58f7[_0x6ee1('0x19')]?_0x2a58f7[_0x6ee1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2a58f7[_0x6ee1('0x19')]?_0x2a58f7[_0x6ee1('0x19')]['where']||null:null,'attributes':_0x2a58f7['options']?_0x2a58f7[_0x6ee1('0x19')]['attributes']||null:null,'include':_0x2a58f7[_0x6ee1('0x19')]?_0x2a58f7['options'][_0x6ee1('0x1d')]?_['map'](_0x2a58f7[_0x6ee1('0x19')][_0x6ee1('0x1d')],function(_0x1259c1){return{'model':db[_0x1259c1[_0x6ee1('0x1f')]],'as':_0x1259c1['as'],'attributes':_0x1259c1['attributes'],'include':_0x1259c1[_0x6ee1('0x1d')]?_[_0x6ee1('0x1e')](_0x1259c1[_0x6ee1('0x1d')],function(_0x519071){return{'model':db[_0x519071[_0x6ee1('0x1f')]],'as':_0x519071['as'],'attributes':_0x519071[_0x6ee1('0x1b')],'include':_0x519071[_0x6ee1('0x1d')]?_[_0x6ee1('0x1e')](_0x519071[_0x6ee1('0x1d')],function(_0x33ace7){return{'model':db[_0x33ace7[_0x6ee1('0x1f')]],'as':_0x33ace7['as'],'attributes':_0x33ace7['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ee1('0xb')](function(_0x595574){logger[_0x6ee1('0xc')](_0x6ee1('0x21'),_0x2a58f7);logger[_0x6ee1('0xe')](_0x6ee1('0x21'),_0x2a58f7,JSON[_0x6ee1('0x11')](_0x595574));_0x5789ef(_0x595574);})['catch'](function(_0x5dce5a){logger['error'](_0x6ee1('0x21'),_0x5dce5a[_0x6ee1('0x14')],_0x2a58f7);_0x58fecb(_0x2d3787['error'](0x1f4,_0x5dce5a[_0x6ee1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 52c3049..258489c 100644 --- a/server/api/intFreshdeskConfiguration/index.js +++ b/server/api/intFreshdeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b28=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','util','path','express','Router','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x4c3db4,_0x4b21b9){var _0x6e2752=function(_0x2ebcb9){while(--_0x2ebcb9){_0x4c3db4['push'](_0x4c3db4['shift']());}};_0x6e2752(++_0x4b21b9);}(_0x8b28,0x1b1));var _0x88b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b28[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x88b2('0x0'));var path=require(_0x88b2('0x1'));var timeout=require('connect-timeout');var express=require(_0x88b2('0x2'));var router=express[_0x88b2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x88b2('0x4'));var controller=require(_0x88b2('0x5'));router[_0x88b2('0x6')]('/',auth[_0x88b2('0x7')](),controller[_0x88b2('0x8')]);router[_0x88b2('0x6')](_0x88b2('0x9'),auth[_0x88b2('0x7')](),controller[_0x88b2('0xa')]);router['get'](_0x88b2('0xb'),auth['isAuthenticated'](),controller[_0x88b2('0xc')]);router[_0x88b2('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x88b2('0x6')](_0x88b2('0xd'),auth[_0x88b2('0x7')](),controller[_0x88b2('0xe')]);router[_0x88b2('0x6')](_0x88b2('0xf'),auth[_0x88b2('0x7')](),controller['getTags']);router[_0x88b2('0x10')]('/',auth[_0x88b2('0x7')](),controller['create']);router['post'](_0x88b2('0xf'),auth[_0x88b2('0x7')](),controller[_0x88b2('0x11')]);router['put'](_0x88b2('0x9'),auth[_0x88b2('0x7')](),controller[_0x88b2('0x12')]);router[_0x88b2('0x13')](_0x88b2('0x9'),auth[_0x88b2('0x7')](),controller[_0x88b2('0x14')]);module[_0x88b2('0x15')]=router; \ No newline at end of file +var _0xad5e=['post','setTags','put','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xad5e,0x8e));var _0xead5=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0xad5e[_0x176317];return _0xef2759;};'use strict';var multer=require(_0xead5('0x0'));var util=require(_0xead5('0x1'));var path=require(_0xead5('0x2'));var timeout=require(_0xead5('0x3'));var express=require('express');var router=express[_0xead5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xead5('0x5'));var interaction=require(_0xead5('0x6'));var config=require(_0xead5('0x7'));var controller=require(_0xead5('0x8'));router[_0xead5('0x9')]('/',auth[_0xead5('0xa')](),controller[_0xead5('0xb')]);router[_0xead5('0x9')](_0xead5('0xc'),auth['isAuthenticated'](),controller[_0xead5('0xd')]);router[_0xead5('0x9')](_0xead5('0xe'),auth[_0xead5('0xa')](),controller['getFields']);router['get'](_0xead5('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xead5('0x9')](_0xead5('0x10'),auth[_0xead5('0xa')](),controller[_0xead5('0x11')]);router[_0xead5('0x9')](_0xead5('0x12'),auth[_0xead5('0xa')](),controller['getTags']);router[_0xead5('0x13')]('/',auth[_0xead5('0xa')](),controller['create']);router['post'](_0xead5('0x12'),auth[_0xead5('0xa')](),controller[_0xead5('0x14')]);router[_0xead5('0x15')]('/:id',auth[_0xead5('0xa')](),controller['update']);router[_0xead5('0x16')]('/:id',auth[_0xead5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 78bcdaa..f910bef 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeef4=['exports','STRING','sequelize'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xeef4,0x89));var _0x4eef=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xeef4[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require(_0x4eef('0x0'));module[_0x4eef('0x1')]={'name':{'type':Sequelize[_0x4eef('0x2')]},'description':{'type':Sequelize[_0x4eef('0x2')]}}; \ No newline at end of file +var _0x837d=['sequelize','STRING'];(function(_0x1bb29c,_0x297df2){var _0x7262c6=function(_0x53057e){while(--_0x53057e){_0x1bb29c['push'](_0x1bb29c['shift']());}};_0x7262c6(++_0x297df2);}(_0x837d,0x1c2));var _0xd837=function(_0x335f1d,_0x37d09d){_0x335f1d=_0x335f1d-0x0;var _0x254c99=_0x837d[_0x335f1d];return _0x254c99;};'use strict';var Sequelize=require(_0xd837('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd837('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b7cacd0..31b46f4 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb35c=['rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','catch','show','keys','include','find','create','body','params','getFields','findOne','nolimit','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','save','update','then','error','stack','name','index','map','FreshdeskConfiguration'];(function(_0x34290e,_0x5eb3c4){var _0x46ab3c=function(_0xdf8bcd){while(--_0xdf8bcd){_0x34290e['push'](_0x34290e['shift']());}};_0x46ab3c(++_0x5eb3c4);}(_0xb35c,0x189));var _0xcb35=function(_0x3bd108,_0x1af36b){_0x3bd108=_0x3bd108-0x0;var _0x5cd377=_0xb35c[_0x3bd108];return _0x5cd377;};'use strict';var emlformat=require(_0xcb35('0x0'));var rimraf=require(_0xcb35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb35('0x2'));var rp=require('request-promise');var moment=require(_0xcb35('0x3'));var BPromise=require(_0xcb35('0x4'));var Mustache=require(_0xcb35('0x5'));var util=require(_0xcb35('0x6'));var path=require(_0xcb35('0x7'));var sox=require('sox');var csv=require(_0xcb35('0x8'));var ejs=require(_0xcb35('0x9'));var fs=require('fs');var fs_extra=require(_0xcb35('0xa'));var _=require(_0xcb35('0xb'));var squel=require(_0xcb35('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb35('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb35('0xd'));var logger=require(_0xcb35('0xe'))('api');var utils=require(_0xcb35('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xcb35('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45ca3b,_0x19023b){_0x19023b=_0x19023b||0xcc;return function(_0x172a07){if(_0x172a07){return _0x45ca3b[_0xcb35('0x11')](_0x19023b);}return _0x45ca3b[_0xcb35('0x12')](_0x19023b)[_0xcb35('0x13')]();};}function respondWithResult(_0x19dc92,_0x29bc5b){_0x29bc5b=_0x29bc5b||0xc8;return function(_0x221503){if(_0x221503){return _0x19dc92[_0xcb35('0x12')](_0x29bc5b)[_0xcb35('0x14')](_0x221503);}};}function respondWithFilteredResult(_0x187d1a,_0x3b597b){return function(_0x51b2b3){if(_0x51b2b3){var _0x5dee87=typeof _0x3b597b[_0xcb35('0x15')]===_0xcb35('0x16')&&typeof _0x3b597b[_0xcb35('0x17')]===_0xcb35('0x16');var _0x3a9ae2=_0x51b2b3['count'];var _0x3e4197=_0x5dee87?0x0:_0x3b597b[_0xcb35('0x15')];var _0x991f2e=_0x5dee87?_0x51b2b3['count']:_0x3b597b[_0xcb35('0x15')]+_0x3b597b[_0xcb35('0x17')];var _0x24d1e7;if(_0x991f2e>=_0x3a9ae2){_0x991f2e=_0x3a9ae2;_0x24d1e7=0xc8;}else{_0x24d1e7=0xce;}_0x187d1a['status'](_0x24d1e7);return _0x187d1a['set']('Content-Range',_0x3e4197+'-'+_0x991f2e+'/'+_0x3a9ae2)[_0xcb35('0x14')](_0x51b2b3);}return null;};}function patchUpdates(_0x432e03){return function(_0x763783){try{jsonpatch['apply'](_0x763783,_0x432e03,!![]);}catch(_0x2ca00a){return BPromise['reject'](_0x2ca00a);}return _0x763783[_0xcb35('0x18')]();};}function saveUpdates(_0x4ce35f,_0x890bf2){return function(_0x2b34f7){if(_0x2b34f7){return _0x2b34f7[_0xcb35('0x19')](_0x4ce35f)[_0xcb35('0x1a')](function(_0x426749){return _0x426749;});}return null;};}function removeEntity(_0x2a071e,_0x186b09){return function(_0x14173a){if(_0x14173a){return _0x14173a['destroy']()[_0xcb35('0x1a')](function(){_0x2a071e['status'](0xcc)[_0xcb35('0x13')]();});}};}function handleEntityNotFound(_0x57a6e0,_0x30de42){return function(_0x183bfa){if(!_0x183bfa){_0x57a6e0[_0xcb35('0x11')](0x194);}return _0x183bfa;};}function handleError(_0x479105,_0x2c8753){_0x2c8753=_0x2c8753||0x1f4;return function(_0x22c4f7){logger[_0xcb35('0x1b')](_0x22c4f7[_0xcb35('0x1c')]);if(_0x22c4f7[_0xcb35('0x1d')]){delete _0x22c4f7[_0xcb35('0x1d')];}_0x479105[_0xcb35('0x12')](_0x2c8753)['send'](_0x22c4f7);};}exports[_0xcb35('0x1e')]=function(_0x2258bd,_0x3151fc){var _0x75898e={},_0x39d3b1={},_0x1bdfcc={'count':0x0,'rows':[]};var _0x20ecc6=_[_0xcb35('0x1f')](db[_0xcb35('0x20')][_0xcb35('0x21')],function(_0xb1d791){return{'name':_0xb1d791['fieldName'],'type':_0xb1d791[_0xcb35('0x22')]['key']};});_0x39d3b1[_0xcb35('0x23')]=_[_0xcb35('0x1f')](_0x20ecc6,_0xcb35('0x1d'));_0x39d3b1[_0xcb35('0x24')]=_['keys'](_0x2258bd[_0xcb35('0x24')]);_0x39d3b1[_0xcb35('0x25')]=_[_0xcb35('0x26')](_0x39d3b1[_0xcb35('0x23')],_0x39d3b1[_0xcb35('0x24')]);_0x75898e[_0xcb35('0x27')]=_[_0xcb35('0x26')](_0x39d3b1[_0xcb35('0x23')],qs[_0xcb35('0x28')](_0x2258bd[_0xcb35('0x24')]['fields']));_0x75898e['attributes']=_0x75898e[_0xcb35('0x27')][_0xcb35('0x29')]?_0x75898e[_0xcb35('0x27')]:_0x39d3b1['model'];if(!_0x2258bd['query'][_0xcb35('0x2a')]('nolimit')){_0x75898e['limit']=qs['limit'](_0x2258bd[_0xcb35('0x24')][_0xcb35('0x17')]);_0x75898e[_0xcb35('0x15')]=qs[_0xcb35('0x15')](_0x2258bd[_0xcb35('0x24')]['offset']);}_0x75898e[_0xcb35('0x2b')]=qs[_0xcb35('0x2c')](_0x2258bd[_0xcb35('0x24')]['sort']);_0x75898e[_0xcb35('0x2d')]=qs[_0xcb35('0x25')](_[_0xcb35('0x2e')](_0x2258bd[_0xcb35('0x24')],_0x39d3b1[_0xcb35('0x25')]),_0x20ecc6);if(_0x2258bd['query'][_0xcb35('0x2f')]){_0x75898e[_0xcb35('0x2d')]=_[_0xcb35('0x30')](_0x75898e[_0xcb35('0x2d')],{'$or':_['map'](_0x20ecc6,function(_0x3bebdb){if(_0x3bebdb[_0xcb35('0x22')]!==_0xcb35('0x31')){var _0x40f507={};_0x40f507[_0x3bebdb['name']]={'$like':'%'+_0x2258bd['query'][_0xcb35('0x2f')]+'%'};return _0x40f507;}})});}_0x75898e=_['merge']({},_0x75898e,_0x2258bd[_0xcb35('0x32')]);var _0x29f10c={'where':_0x75898e[_0xcb35('0x2d')]};return db['FreshdeskConfiguration'][_0xcb35('0x33')](_0x29f10c)[_0xcb35('0x1a')](function(_0x3e471c){_0x1bdfcc[_0xcb35('0x33')]=_0x3e471c;if(_0x2258bd['query'][_0xcb35('0x34')]){_0x75898e['include']=[{'all':!![]}];}return db[_0xcb35('0x20')]['findAll'](_0x75898e);})[_0xcb35('0x1a')](function(_0x383a5e){_0x1bdfcc['rows']=_0x383a5e;return _0x1bdfcc;})['then'](respondWithFilteredResult(_0x3151fc,_0x75898e))[_0xcb35('0x35')](handleError(_0x3151fc,null));};exports[_0xcb35('0x36')]=function(_0x57b1ea,_0x4112a9){var _0x36521f={'raw':![],'where':{'id':_0x57b1ea['params']['id']}},_0x156c80={};_0x156c80[_0xcb35('0x23')]=_[_0xcb35('0x37')](db[_0xcb35('0x20')][_0xcb35('0x21')]);_0x156c80[_0xcb35('0x24')]=_[_0xcb35('0x37')](_0x57b1ea[_0xcb35('0x24')]);_0x156c80[_0xcb35('0x25')]=_[_0xcb35('0x26')](_0x156c80[_0xcb35('0x23')],_0x156c80['query']);_0x36521f[_0xcb35('0x27')]=_[_0xcb35('0x26')](_0x156c80[_0xcb35('0x23')],qs[_0xcb35('0x28')](_0x57b1ea[_0xcb35('0x24')][_0xcb35('0x28')]));_0x36521f['attributes']=_0x36521f[_0xcb35('0x27')]['length']?_0x36521f[_0xcb35('0x27')]:_0x156c80[_0xcb35('0x23')];if(_0x57b1ea[_0xcb35('0x24')][_0xcb35('0x34')]){_0x36521f[_0xcb35('0x38')]=[{'all':!![]}];}_0x36521f=_[_0xcb35('0x30')]({},_0x36521f,_0x57b1ea['options']);return db['FreshdeskConfiguration'][_0xcb35('0x39')](_0x36521f)[_0xcb35('0x1a')](handleEntityNotFound(_0x4112a9,null))[_0xcb35('0x1a')](respondWithResult(_0x4112a9,null))[_0xcb35('0x35')](handleError(_0x4112a9,null));};exports[_0xcb35('0x3a')]=function(_0x5df443,_0x127699){return db['FreshdeskConfiguration'][_0xcb35('0x3a')](_0x5df443[_0xcb35('0x3b')],{})['then'](respondWithResult(_0x127699,0xc9))[_0xcb35('0x35')](handleError(_0x127699,null));};exports[_0xcb35('0x19')]=function(_0x5e59ed,_0xc730c8){if(_0x5e59ed[_0xcb35('0x3b')]['id']){delete _0x5e59ed['body']['id'];}return db[_0xcb35('0x20')]['find']({'where':{'id':_0x5e59ed['params']['id']}})[_0xcb35('0x1a')](handleEntityNotFound(_0xc730c8,null))[_0xcb35('0x1a')](saveUpdates(_0x5e59ed['body'],null))['then'](respondWithResult(_0xc730c8,null))[_0xcb35('0x35')](handleError(_0xc730c8,null));};exports['destroy']=function(_0x3fa8d9,_0x2e298e){return db[_0xcb35('0x20')][_0xcb35('0x39')]({'where':{'id':_0x3fa8d9[_0xcb35('0x3c')]['id']}})[_0xcb35('0x1a')](handleEntityNotFound(_0x2e298e,null))['then'](removeEntity(_0x2e298e,null))[_0xcb35('0x35')](handleError(_0x2e298e,null));};exports[_0xcb35('0x3d')]=function(_0x2c014f,_0x40ee69,_0x382242){var _0x55cf82={};var _0x519458={};var _0x3ec6db;var _0x43eac6;return db[_0xcb35('0x20')][_0xcb35('0x3e')]({'where':{'id':_0x2c014f[_0xcb35('0x3c')]['id']}})[_0xcb35('0x1a')](handleEntityNotFound(_0x40ee69,null))['then'](function(_0x26a40a){if(_0x26a40a){_0x3ec6db=_0x26a40a;_0x519458[_0xcb35('0x23')]=_[_0xcb35('0x37')](db['FreshdeskField'][_0xcb35('0x21')]);_0x519458[_0xcb35('0x24')]=_[_0xcb35('0x37')](_0x2c014f[_0xcb35('0x24')]);_0x519458[_0xcb35('0x25')]=_['intersection'](_0x519458[_0xcb35('0x23')],_0x519458[_0xcb35('0x24')]);_0x55cf82[_0xcb35('0x27')]=_[_0xcb35('0x26')](_0x519458[_0xcb35('0x23')],qs[_0xcb35('0x28')](_0x2c014f[_0xcb35('0x24')][_0xcb35('0x28')]));_0x55cf82['attributes']=_0x55cf82['attributes'][_0xcb35('0x29')]?_0x55cf82[_0xcb35('0x27')]:_0x519458['model'];_0x55cf82[_0xcb35('0x2b')]=qs['sort'](_0x2c014f[_0xcb35('0x24')][_0xcb35('0x2c')]);_0x55cf82[_0xcb35('0x2d')]=qs[_0xcb35('0x25')](_[_0xcb35('0x2e')](_0x2c014f[_0xcb35('0x24')],_0x519458[_0xcb35('0x25')]));if(_0x2c014f[_0xcb35('0x24')][_0xcb35('0x2f')]){_0x55cf82[_0xcb35('0x2d')]=_['merge'](_0x55cf82[_0xcb35('0x2d')],{'$or':_[_0xcb35('0x1f')](_0x55cf82['attributes'],function(_0xa90cd5){var _0x554f15={};_0x554f15[_0xa90cd5]={'$like':'%'+_0x2c014f[_0xcb35('0x24')][_0xcb35('0x2f')]+'%'};return _0x554f15;})});}_0x55cf82=_['merge']({},_0x55cf82,_0x2c014f[_0xcb35('0x32')]);return _0x3ec6db[_0xcb35('0x3d')](_0x55cf82);}})[_0xcb35('0x1a')](function(_0x51751a){if(_0x51751a){_0x43eac6=_0x51751a[_0xcb35('0x29')];if(!_0x2c014f[_0xcb35('0x24')]['hasOwnProperty'](_0xcb35('0x3f'))){_0x55cf82[_0xcb35('0x17')]=qs['limit'](_0x2c014f[_0xcb35('0x24')][_0xcb35('0x17')]);_0x55cf82[_0xcb35('0x15')]=qs[_0xcb35('0x15')](_0x2c014f[_0xcb35('0x24')]['offset']);}return _0x3ec6db[_0xcb35('0x3d')](_0x55cf82);}})[_0xcb35('0x1a')](function(_0x5f1f9e){if(_0x5f1f9e){return _0x5f1f9e?{'count':_0x43eac6,'rows':_0x5f1f9e}:null;}})['then'](respondWithResult(_0x40ee69,null))['catch'](handleError(_0x40ee69,null));};exports[_0xcb35('0x40')]=function(_0x41dbe1,_0x5e497e,_0x3220b6){var _0x3cc74f={};var _0x21bf4b={};var _0x226072;var _0x30b50c;return db[_0xcb35('0x20')]['findOne']({'where':{'id':_0x41dbe1[_0xcb35('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5e497e,null))[_0xcb35('0x1a')](function(_0x1a4513){if(_0x1a4513){_0x226072=_0x1a4513;_0x21bf4b[_0xcb35('0x23')]=_[_0xcb35('0x37')](db[_0xcb35('0x41')][_0xcb35('0x21')]);_0x21bf4b[_0xcb35('0x24')]=_[_0xcb35('0x37')](_0x41dbe1['query']);_0x21bf4b[_0xcb35('0x25')]=_[_0xcb35('0x26')](_0x21bf4b[_0xcb35('0x23')],_0x21bf4b[_0xcb35('0x24')]);_0x3cc74f['attributes']=_[_0xcb35('0x26')](_0x21bf4b[_0xcb35('0x23')],qs[_0xcb35('0x28')](_0x41dbe1[_0xcb35('0x24')][_0xcb35('0x28')]));_0x3cc74f[_0xcb35('0x27')]=_0x3cc74f['attributes']['length']?_0x3cc74f[_0xcb35('0x27')]:_0x21bf4b[_0xcb35('0x23')];_0x3cc74f['order']=qs['sort'](_0x41dbe1[_0xcb35('0x24')][_0xcb35('0x2c')]);_0x3cc74f['where']=qs[_0xcb35('0x25')](_[_0xcb35('0x2e')](_0x41dbe1[_0xcb35('0x24')],_0x21bf4b[_0xcb35('0x25')]));if(_0x41dbe1[_0xcb35('0x24')][_0xcb35('0x2f')]){_0x3cc74f[_0xcb35('0x2d')]=_[_0xcb35('0x30')](_0x3cc74f[_0xcb35('0x2d')],{'$or':_[_0xcb35('0x1f')](_0x3cc74f[_0xcb35('0x27')],function(_0x5c4303){var _0x311a97={};_0x311a97[_0x5c4303]={'$like':'%'+_0x41dbe1[_0xcb35('0x24')][_0xcb35('0x2f')]+'%'};return _0x311a97;})});}_0x3cc74f=_[_0xcb35('0x30')]({},_0x3cc74f,_0x41dbe1[_0xcb35('0x32')]);return _0x226072[_0xcb35('0x40')](_0x3cc74f);}})[_0xcb35('0x1a')](function(_0x22bc5d){if(_0x22bc5d){_0x30b50c=_0x22bc5d[_0xcb35('0x29')];if(!_0x41dbe1[_0xcb35('0x24')][_0xcb35('0x2a')]('nolimit')){_0x3cc74f[_0xcb35('0x17')]=qs[_0xcb35('0x17')](_0x41dbe1['query']['limit']);_0x3cc74f[_0xcb35('0x15')]=qs[_0xcb35('0x15')](_0x41dbe1[_0xcb35('0x24')][_0xcb35('0x15')]);}return _0x226072[_0xcb35('0x40')](_0x3cc74f);}})[_0xcb35('0x1a')](function(_0x100f0f){if(_0x100f0f){return _0x100f0f?{'count':_0x30b50c,'rows':_0x100f0f}:null;}})[_0xcb35('0x1a')](respondWithResult(_0x5e497e,null))[_0xcb35('0x35')](handleError(_0x5e497e,null));};exports[_0xcb35('0x42')]=function(_0x5501e2,_0xd21f27,_0x2f903c){var _0x1dca47={};var _0xcf2207={};var _0x18cffa;var _0x423209;return db[_0xcb35('0x20')][_0xcb35('0x3e')]({'where':{'id':_0x5501e2[_0xcb35('0x3c')]['id']}})[_0xcb35('0x1a')](handleEntityNotFound(_0xd21f27,null))[_0xcb35('0x1a')](function(_0x37befe){if(_0x37befe){_0x18cffa=_0x37befe;_0xcf2207[_0xcb35('0x23')]=_['keys'](db[_0xcb35('0x41')][_0xcb35('0x21')]);_0xcf2207[_0xcb35('0x24')]=_[_0xcb35('0x37')](_0x5501e2['query']);_0xcf2207[_0xcb35('0x25')]=_[_0xcb35('0x26')](_0xcf2207[_0xcb35('0x23')],_0xcf2207[_0xcb35('0x24')]);_0x1dca47[_0xcb35('0x27')]=_[_0xcb35('0x26')](_0xcf2207[_0xcb35('0x23')],qs[_0xcb35('0x28')](_0x5501e2[_0xcb35('0x24')][_0xcb35('0x28')]));_0x1dca47[_0xcb35('0x27')]=_0x1dca47[_0xcb35('0x27')][_0xcb35('0x29')]?_0x1dca47[_0xcb35('0x27')]:_0xcf2207[_0xcb35('0x23')];_0x1dca47[_0xcb35('0x2b')]=qs[_0xcb35('0x2c')](_0x5501e2[_0xcb35('0x24')][_0xcb35('0x2c')]);_0x1dca47[_0xcb35('0x2d')]=qs[_0xcb35('0x25')](_['pick'](_0x5501e2['query'],_0xcf2207['filters']));if(_0x5501e2[_0xcb35('0x24')][_0xcb35('0x2f')]){_0x1dca47[_0xcb35('0x2d')]=_[_0xcb35('0x30')](_0x1dca47[_0xcb35('0x2d')],{'$or':_['map'](_0x1dca47[_0xcb35('0x27')],function(_0x50f6b2){var _0xc034d8={};_0xc034d8[_0x50f6b2]={'$like':'%'+_0x5501e2[_0xcb35('0x24')][_0xcb35('0x2f')]+'%'};return _0xc034d8;})});}_0x1dca47=_[_0xcb35('0x30')]({},_0x1dca47,_0x5501e2['options']);return _0x18cffa[_0xcb35('0x42')](_0x1dca47);}})['then'](function(_0x5936b3){if(_0x5936b3){_0x423209=_0x5936b3[_0xcb35('0x29')];if(!_0x5501e2[_0xcb35('0x24')][_0xcb35('0x2a')]('nolimit')){_0x1dca47[_0xcb35('0x17')]=qs[_0xcb35('0x17')](_0x5501e2[_0xcb35('0x24')]['limit']);_0x1dca47[_0xcb35('0x15')]=qs['offset'](_0x5501e2[_0xcb35('0x24')][_0xcb35('0x15')]);}return _0x18cffa[_0xcb35('0x42')](_0x1dca47);}})[_0xcb35('0x1a')](function(_0x3a8422){if(_0x3a8422){return _0x3a8422?{'count':_0x423209,'rows':_0x3a8422}:null;}})[_0xcb35('0x1a')](respondWithResult(_0xd21f27,null))['catch'](handleError(_0xd21f27,null));};exports[_0xcb35('0x43')]=function(_0x196e4e,_0x2b3222,_0x316854){var _0x343c23={};var _0x31b498={};var _0x17ae22;var _0x8fb1e3;return db[_0xcb35('0x20')][_0xcb35('0x3e')]({'where':{'id':_0x196e4e[_0xcb35('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2b3222,null))[_0xcb35('0x1a')](function(_0x1a3586){if(_0x1a3586){_0x17ae22=_0x1a3586;_0x31b498['model']=_[_0xcb35('0x37')](db[_0xcb35('0x44')][_0xcb35('0x21')]);_0x31b498[_0xcb35('0x24')]=_[_0xcb35('0x37')](_0x196e4e['query']);_0x31b498[_0xcb35('0x25')]=_[_0xcb35('0x26')](_0x31b498[_0xcb35('0x23')],_0x31b498['query']);_0x343c23['attributes']=_[_0xcb35('0x26')](_0x31b498['model'],qs[_0xcb35('0x28')](_0x196e4e['query'][_0xcb35('0x28')]));_0x343c23[_0xcb35('0x27')]=_0x343c23['attributes'][_0xcb35('0x29')]?_0x343c23[_0xcb35('0x27')]:_0x31b498[_0xcb35('0x23')];_0x343c23['order']=qs['sort'](_0x196e4e['query'][_0xcb35('0x2c')]);_0x343c23[_0xcb35('0x2d')]=qs[_0xcb35('0x25')](_[_0xcb35('0x2e')](_0x196e4e[_0xcb35('0x24')],_0x31b498[_0xcb35('0x25')]));if(_0x196e4e[_0xcb35('0x24')][_0xcb35('0x2f')]){_0x343c23[_0xcb35('0x2d')]=_[_0xcb35('0x30')](_0x343c23[_0xcb35('0x2d')],{'$or':_[_0xcb35('0x1f')](_0x343c23['attributes'],function(_0x1b58df){var _0x4007ae={};_0x4007ae[_0x1b58df]={'$like':'%'+_0x196e4e['query'][_0xcb35('0x2f')]+'%'};return _0x4007ae;})});}_0x343c23=_[_0xcb35('0x30')]({},_0x343c23,_0x196e4e['options']);return _0x17ae22[_0xcb35('0x43')](_0x343c23);}})[_0xcb35('0x1a')](function(_0xa14c1c){if(_0xa14c1c){_0x8fb1e3=_0xa14c1c[_0xcb35('0x29')];if(!_0x196e4e[_0xcb35('0x24')]['hasOwnProperty']('nolimit')){_0x343c23['limit']=qs[_0xcb35('0x17')](_0x196e4e[_0xcb35('0x24')][_0xcb35('0x17')]);_0x343c23[_0xcb35('0x15')]=qs[_0xcb35('0x15')](_0x196e4e[_0xcb35('0x24')][_0xcb35('0x15')]);}return _0x17ae22[_0xcb35('0x43')](_0x343c23);}})[_0xcb35('0x1a')](function(_0x2a5d74){if(_0x2a5d74){return _0x2a5d74?{'count':_0x8fb1e3,'rows':_0x2a5d74}:null;}})['then'](respondWithResult(_0x2b3222,null))[_0xcb35('0x35')](handleError(_0x2b3222,null));};exports[_0xcb35('0x45')]=function(_0x5aeadb,_0x585c0f,_0x545b38){if(_0x5aeadb[_0xcb35('0x3b')]['id']){delete _0x5aeadb[_0xcb35('0x3b')]['id'];}return db[_0xcb35('0x20')][_0xcb35('0x3e')]({'where':{'id':_0x5aeadb['params']['id']}})[_0xcb35('0x1a')](handleEntityNotFound(_0x585c0f,null))[_0xcb35('0x1a')](function(_0x531597){if(_0x531597){return _0x531597[_0xcb35('0x45')](_0x5aeadb[_0xcb35('0x3b')][_0xcb35('0x46')]||[]);}return null;})[_0xcb35('0x1a')](respondWithResult(_0x585c0f,null))[_0xcb35('0x35')](handleError(_0x585c0f,null));}; \ No newline at end of file +var _0x9043=['Tag','getTags','setTags','ids','eml-format','fast-json-patch','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','save','update','then','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','body','destroy','params','findOne','order','getSubjects','getDescriptions'];(function(_0x1ef04e,_0x26c2fd){var _0x59a3c8=function(_0x18fc2e){while(--_0x18fc2e){_0x1ef04e['push'](_0x1ef04e['shift']());}};_0x59a3c8(++_0x26c2fd);}(_0x9043,0x1de));var _0x3904=function(_0x5bd593,_0x49d663){_0x5bd593=_0x5bd593-0x0;var _0x1f92d0=_0x9043[_0x5bd593];return _0x1f92d0;};'use strict';var emlformat=require(_0x3904('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3904('0x1'));var rp=require('request-promise');var moment=require(_0x3904('0x2'));var BPromise=require(_0x3904('0x3'));var Mustache=require(_0x3904('0x4'));var util=require('util');var path=require(_0x3904('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3904('0x6'));var _=require(_0x3904('0x7'));var squel=require(_0x3904('0x8'));var crypto=require('crypto');var jsforce=require(_0x3904('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3904('0xa'));var querystring=require(_0x3904('0xb'));var Papa=require(_0x3904('0xc'));var Redis=require(_0x3904('0xd'));var authService=require(_0x3904('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3904('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3904('0x10'))(_0x3904('0x11'));var utils=require(_0x3904('0x12'));var config=require(_0x3904('0x13'));var licenseUtil=require(_0x3904('0x14'));var db=require(_0x3904('0x15'))['db'];function respondWithStatusCode(_0x2b7b19,_0x534a8d){_0x534a8d=_0x534a8d||0xcc;return function(_0x171397){if(_0x171397){return _0x2b7b19[_0x3904('0x16')](_0x534a8d);}return _0x2b7b19['status'](_0x534a8d)[_0x3904('0x17')]();};}function respondWithResult(_0xed6d8e,_0x301506){_0x301506=_0x301506||0xc8;return function(_0x4e2b1c){if(_0x4e2b1c){return _0xed6d8e[_0x3904('0x18')](_0x301506)['json'](_0x4e2b1c);}};}function respondWithFilteredResult(_0x13c1e9,_0x5ecb5e){return function(_0x191d34){if(_0x191d34){var _0x3adee7=typeof _0x5ecb5e[_0x3904('0x19')]==='undefined'&&typeof _0x5ecb5e[_0x3904('0x1a')]==='undefined';var _0x48a940=_0x191d34[_0x3904('0x1b')];var _0x194a16=_0x3adee7?0x0:_0x5ecb5e[_0x3904('0x19')];var _0x421c44=_0x3adee7?_0x191d34[_0x3904('0x1b')]:_0x5ecb5e['offset']+_0x5ecb5e['limit'];var _0x409075;if(_0x421c44>=_0x48a940){_0x421c44=_0x48a940;_0x409075=0xc8;}else{_0x409075=0xce;}_0x13c1e9[_0x3904('0x18')](_0x409075);return _0x13c1e9[_0x3904('0x1c')](_0x3904('0x1d'),_0x194a16+'-'+_0x421c44+'/'+_0x48a940)[_0x3904('0x1e')](_0x191d34);}return null;};}function patchUpdates(_0x298b6f){return function(_0x14d996){try{jsonpatch[_0x3904('0x1f')](_0x14d996,_0x298b6f,!![]);}catch(_0x2b23d5){return BPromise['reject'](_0x2b23d5);}return _0x14d996[_0x3904('0x20')]();};}function saveUpdates(_0x191213,_0x43a22a){return function(_0xf06fd3){if(_0xf06fd3){return _0xf06fd3[_0x3904('0x21')](_0x191213)[_0x3904('0x22')](function(_0x2b21d7){return _0x2b21d7;});}return null;};}function removeEntity(_0x450d10,_0x13bb5f){return function(_0x3161f7){if(_0x3161f7){return _0x3161f7['destroy']()[_0x3904('0x22')](function(){_0x450d10[_0x3904('0x18')](0xcc)[_0x3904('0x17')]();});}};}function handleEntityNotFound(_0x419854,_0x39eac6){return function(_0xcd2768){if(!_0xcd2768){_0x419854['sendStatus'](0x194);}return _0xcd2768;};}function handleError(_0x3f7400,_0x14c648){_0x14c648=_0x14c648||0x1f4;return function(_0x3f7fb2){logger['error'](_0x3f7fb2[_0x3904('0x23')]);if(_0x3f7fb2[_0x3904('0x24')]){delete _0x3f7fb2[_0x3904('0x24')];}_0x3f7400[_0x3904('0x18')](_0x14c648)[_0x3904('0x25')](_0x3f7fb2);};}exports['index']=function(_0x2a1e17,_0x2859a3){var _0x3fce94={},_0x11555f={},_0x37d288={'count':0x0,'rows':[]};var _0x19d51d=_[_0x3904('0x26')](db[_0x3904('0x27')][_0x3904('0x28')],function(_0x51cf63){return{'name':_0x51cf63[_0x3904('0x29')],'type':_0x51cf63[_0x3904('0x2a')][_0x3904('0x2b')]};});_0x11555f[_0x3904('0x2c')]=_[_0x3904('0x26')](_0x19d51d,'name');_0x11555f[_0x3904('0x2d')]=_[_0x3904('0x2e')](_0x2a1e17[_0x3904('0x2d')]);_0x11555f[_0x3904('0x2f')]=_[_0x3904('0x30')](_0x11555f[_0x3904('0x2c')],_0x11555f['query']);_0x3fce94[_0x3904('0x31')]=_['intersection'](_0x11555f[_0x3904('0x2c')],qs[_0x3904('0x32')](_0x2a1e17[_0x3904('0x2d')][_0x3904('0x32')]));_0x3fce94[_0x3904('0x31')]=_0x3fce94['attributes']['length']?_0x3fce94[_0x3904('0x31')]:_0x11555f[_0x3904('0x2c')];if(!_0x2a1e17['query'][_0x3904('0x33')](_0x3904('0x34'))){_0x3fce94['limit']=qs['limit'](_0x2a1e17[_0x3904('0x2d')]['limit']);_0x3fce94[_0x3904('0x19')]=qs[_0x3904('0x19')](_0x2a1e17['query'][_0x3904('0x19')]);}_0x3fce94['order']=qs[_0x3904('0x35')](_0x2a1e17[_0x3904('0x2d')][_0x3904('0x35')]);_0x3fce94[_0x3904('0x36')]=qs['filters'](_[_0x3904('0x37')](_0x2a1e17[_0x3904('0x2d')],_0x11555f[_0x3904('0x2f')]),_0x19d51d);if(_0x2a1e17[_0x3904('0x2d')][_0x3904('0x38')]){_0x3fce94['where']=_[_0x3904('0x39')](_0x3fce94[_0x3904('0x36')],{'$or':_[_0x3904('0x26')](_0x19d51d,function(_0xdc0413){if(_0xdc0413[_0x3904('0x2a')]!==_0x3904('0x3a')){var _0x26d975={};_0x26d975[_0xdc0413['name']]={'$like':'%'+_0x2a1e17[_0x3904('0x2d')][_0x3904('0x38')]+'%'};return _0x26d975;}})});}_0x3fce94=_[_0x3904('0x39')]({},_0x3fce94,_0x2a1e17[_0x3904('0x3b')]);var _0x5c8305={'where':_0x3fce94[_0x3904('0x36')]};return db[_0x3904('0x27')][_0x3904('0x1b')](_0x5c8305)[_0x3904('0x22')](function(_0xb8a754){_0x37d288['count']=_0xb8a754;if(_0x2a1e17[_0x3904('0x2d')][_0x3904('0x3c')]){_0x3fce94['include']=[{'all':!![]}];}return db[_0x3904('0x27')]['findAll'](_0x3fce94);})[_0x3904('0x22')](function(_0x1c5d32){_0x37d288[_0x3904('0x3d')]=_0x1c5d32;return _0x37d288;})[_0x3904('0x22')](respondWithFilteredResult(_0x2859a3,_0x3fce94))[_0x3904('0x3e')](handleError(_0x2859a3,null));};exports[_0x3904('0x3f')]=function(_0x18d8a0,_0x3c2c70){var _0xe60b14={'raw':![],'where':{'id':_0x18d8a0['params']['id']}},_0x6f8788={};_0x6f8788['model']=_[_0x3904('0x2e')](db[_0x3904('0x27')]['rawAttributes']);_0x6f8788['query']=_['keys'](_0x18d8a0[_0x3904('0x2d')]);_0x6f8788['filters']=_['intersection'](_0x6f8788[_0x3904('0x2c')],_0x6f8788['query']);_0xe60b14[_0x3904('0x31')]=_[_0x3904('0x30')](_0x6f8788[_0x3904('0x2c')],qs[_0x3904('0x32')](_0x18d8a0[_0x3904('0x2d')][_0x3904('0x32')]));_0xe60b14[_0x3904('0x31')]=_0xe60b14['attributes'][_0x3904('0x40')]?_0xe60b14[_0x3904('0x31')]:_0x6f8788[_0x3904('0x2c')];if(_0x18d8a0[_0x3904('0x2d')]['includeAll']){_0xe60b14[_0x3904('0x41')]=[{'all':!![]}];}_0xe60b14=_[_0x3904('0x39')]({},_0xe60b14,_0x18d8a0['options']);return db[_0x3904('0x27')][_0x3904('0x42')](_0xe60b14)['then'](handleEntityNotFound(_0x3c2c70,null))[_0x3904('0x22')](respondWithResult(_0x3c2c70,null))[_0x3904('0x3e')](handleError(_0x3c2c70,null));};exports[_0x3904('0x43')]=function(_0x1fe4d8,_0x48d3da){return db[_0x3904('0x27')][_0x3904('0x43')](_0x1fe4d8[_0x3904('0x44')],{})[_0x3904('0x22')](respondWithResult(_0x48d3da,0xc9))['catch'](handleError(_0x48d3da,null));};exports[_0x3904('0x21')]=function(_0x57bdb4,_0x13843d){if(_0x57bdb4['body']['id']){delete _0x57bdb4[_0x3904('0x44')]['id'];}return db[_0x3904('0x27')]['find']({'where':{'id':_0x57bdb4['params']['id']}})[_0x3904('0x22')](handleEntityNotFound(_0x13843d,null))[_0x3904('0x22')](saveUpdates(_0x57bdb4['body'],null))[_0x3904('0x22')](respondWithResult(_0x13843d,null))[_0x3904('0x3e')](handleError(_0x13843d,null));};exports[_0x3904('0x45')]=function(_0x37fe9f,_0x37b2f0){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x37fe9f[_0x3904('0x46')]['id']}})[_0x3904('0x22')](handleEntityNotFound(_0x37b2f0,null))[_0x3904('0x22')](removeEntity(_0x37b2f0,null))[_0x3904('0x3e')](handleError(_0x37b2f0,null));};exports['getFields']=function(_0x54a172,_0x1835ec,_0x2429f3){var _0x23403a={};var _0x32f6d5={};var _0xa9e20d;var _0x18869f;return db[_0x3904('0x27')][_0x3904('0x47')]({'where':{'id':_0x54a172[_0x3904('0x46')]['id']}})[_0x3904('0x22')](handleEntityNotFound(_0x1835ec,null))[_0x3904('0x22')](function(_0x1e1dcd){if(_0x1e1dcd){_0xa9e20d=_0x1e1dcd;_0x32f6d5[_0x3904('0x2c')]=_['keys'](db['FreshdeskField'][_0x3904('0x28')]);_0x32f6d5[_0x3904('0x2d')]=_[_0x3904('0x2e')](_0x54a172[_0x3904('0x2d')]);_0x32f6d5[_0x3904('0x2f')]=_[_0x3904('0x30')](_0x32f6d5[_0x3904('0x2c')],_0x32f6d5[_0x3904('0x2d')]);_0x23403a[_0x3904('0x31')]=_[_0x3904('0x30')](_0x32f6d5[_0x3904('0x2c')],qs[_0x3904('0x32')](_0x54a172[_0x3904('0x2d')][_0x3904('0x32')]));_0x23403a['attributes']=_0x23403a['attributes'][_0x3904('0x40')]?_0x23403a['attributes']:_0x32f6d5['model'];_0x23403a[_0x3904('0x48')]=qs[_0x3904('0x35')](_0x54a172['query'][_0x3904('0x35')]);_0x23403a['where']=qs['filters'](_['pick'](_0x54a172[_0x3904('0x2d')],_0x32f6d5[_0x3904('0x2f')]));if(_0x54a172[_0x3904('0x2d')][_0x3904('0x38')]){_0x23403a[_0x3904('0x36')]=_[_0x3904('0x39')](_0x23403a[_0x3904('0x36')],{'$or':_[_0x3904('0x26')](_0x23403a[_0x3904('0x31')],function(_0x4e9fdc){var _0x423b67={};_0x423b67[_0x4e9fdc]={'$like':'%'+_0x54a172[_0x3904('0x2d')]['filter']+'%'};return _0x423b67;})});}_0x23403a=_[_0x3904('0x39')]({},_0x23403a,_0x54a172[_0x3904('0x3b')]);return _0xa9e20d['getFields'](_0x23403a);}})[_0x3904('0x22')](function(_0xaa44ee){if(_0xaa44ee){_0x18869f=_0xaa44ee[_0x3904('0x40')];if(!_0x54a172['query']['hasOwnProperty']('nolimit')){_0x23403a[_0x3904('0x1a')]=qs[_0x3904('0x1a')](_0x54a172[_0x3904('0x2d')][_0x3904('0x1a')]);_0x23403a[_0x3904('0x19')]=qs[_0x3904('0x19')](_0x54a172[_0x3904('0x2d')]['offset']);}return _0xa9e20d['getFields'](_0x23403a);}})[_0x3904('0x22')](function(_0x2fb644){if(_0x2fb644){return _0x2fb644?{'count':_0x18869f,'rows':_0x2fb644}:null;}})['then'](respondWithResult(_0x1835ec,null))[_0x3904('0x3e')](handleError(_0x1835ec,null));};exports[_0x3904('0x49')]=function(_0x2331e7,_0x3ba613,_0x4f6d4e){var _0x41ef0a={};var _0x4239bd={};var _0x2cbe21;var _0x11ca84;return db[_0x3904('0x27')][_0x3904('0x47')]({'where':{'id':_0x2331e7[_0x3904('0x46')]['id']}})[_0x3904('0x22')](handleEntityNotFound(_0x3ba613,null))[_0x3904('0x22')](function(_0x46769f){if(_0x46769f){_0x2cbe21=_0x46769f;_0x4239bd[_0x3904('0x2c')]=_[_0x3904('0x2e')](db['FreshdeskField'][_0x3904('0x28')]);_0x4239bd[_0x3904('0x2d')]=_[_0x3904('0x2e')](_0x2331e7['query']);_0x4239bd[_0x3904('0x2f')]=_[_0x3904('0x30')](_0x4239bd[_0x3904('0x2c')],_0x4239bd[_0x3904('0x2d')]);_0x41ef0a[_0x3904('0x31')]=_[_0x3904('0x30')](_0x4239bd[_0x3904('0x2c')],qs['fields'](_0x2331e7[_0x3904('0x2d')][_0x3904('0x32')]));_0x41ef0a[_0x3904('0x31')]=_0x41ef0a['attributes'][_0x3904('0x40')]?_0x41ef0a[_0x3904('0x31')]:_0x4239bd[_0x3904('0x2c')];_0x41ef0a[_0x3904('0x48')]=qs[_0x3904('0x35')](_0x2331e7[_0x3904('0x2d')][_0x3904('0x35')]);_0x41ef0a[_0x3904('0x36')]=qs[_0x3904('0x2f')](_[_0x3904('0x37')](_0x2331e7[_0x3904('0x2d')],_0x4239bd[_0x3904('0x2f')]));if(_0x2331e7[_0x3904('0x2d')][_0x3904('0x38')]){_0x41ef0a[_0x3904('0x36')]=_[_0x3904('0x39')](_0x41ef0a[_0x3904('0x36')],{'$or':_['map'](_0x41ef0a[_0x3904('0x31')],function(_0x5a5231){var _0x3acfce={};_0x3acfce[_0x5a5231]={'$like':'%'+_0x2331e7['query']['filter']+'%'};return _0x3acfce;})});}_0x41ef0a=_['merge']({},_0x41ef0a,_0x2331e7[_0x3904('0x3b')]);return _0x2cbe21[_0x3904('0x49')](_0x41ef0a);}})[_0x3904('0x22')](function(_0x6b4337){if(_0x6b4337){_0x11ca84=_0x6b4337[_0x3904('0x40')];if(!_0x2331e7[_0x3904('0x2d')][_0x3904('0x33')]('nolimit')){_0x41ef0a['limit']=qs[_0x3904('0x1a')](_0x2331e7[_0x3904('0x2d')][_0x3904('0x1a')]);_0x41ef0a[_0x3904('0x19')]=qs['offset'](_0x2331e7[_0x3904('0x2d')]['offset']);}return _0x2cbe21['getSubjects'](_0x41ef0a);}})[_0x3904('0x22')](function(_0x1354e4){if(_0x1354e4){return _0x1354e4?{'count':_0x11ca84,'rows':_0x1354e4}:null;}})['then'](respondWithResult(_0x3ba613,null))[_0x3904('0x3e')](handleError(_0x3ba613,null));};exports[_0x3904('0x4a')]=function(_0x18fa39,_0xd99ef2,_0x28878b){var _0x127de6={};var _0x29d39a={};var _0x229827;var _0x905b93;return db[_0x3904('0x27')]['findOne']({'where':{'id':_0x18fa39[_0x3904('0x46')]['id']}})[_0x3904('0x22')](handleEntityNotFound(_0xd99ef2,null))[_0x3904('0x22')](function(_0x4910e6){if(_0x4910e6){_0x229827=_0x4910e6;_0x29d39a[_0x3904('0x2c')]=_[_0x3904('0x2e')](db['FreshdeskField'][_0x3904('0x28')]);_0x29d39a[_0x3904('0x2d')]=_[_0x3904('0x2e')](_0x18fa39[_0x3904('0x2d')]);_0x29d39a['filters']=_['intersection'](_0x29d39a[_0x3904('0x2c')],_0x29d39a[_0x3904('0x2d')]);_0x127de6['attributes']=_[_0x3904('0x30')](_0x29d39a['model'],qs[_0x3904('0x32')](_0x18fa39['query']['fields']));_0x127de6['attributes']=_0x127de6['attributes']['length']?_0x127de6['attributes']:_0x29d39a[_0x3904('0x2c')];_0x127de6[_0x3904('0x48')]=qs[_0x3904('0x35')](_0x18fa39[_0x3904('0x2d')][_0x3904('0x35')]);_0x127de6['where']=qs[_0x3904('0x2f')](_[_0x3904('0x37')](_0x18fa39[_0x3904('0x2d')],_0x29d39a[_0x3904('0x2f')]));if(_0x18fa39['query'][_0x3904('0x38')]){_0x127de6['where']=_[_0x3904('0x39')](_0x127de6[_0x3904('0x36')],{'$or':_[_0x3904('0x26')](_0x127de6[_0x3904('0x31')],function(_0x379b2e){var _0xa6cde0={};_0xa6cde0[_0x379b2e]={'$like':'%'+_0x18fa39[_0x3904('0x2d')][_0x3904('0x38')]+'%'};return _0xa6cde0;})});}_0x127de6=_[_0x3904('0x39')]({},_0x127de6,_0x18fa39[_0x3904('0x3b')]);return _0x229827[_0x3904('0x4a')](_0x127de6);}})[_0x3904('0x22')](function(_0x1d440a){if(_0x1d440a){_0x905b93=_0x1d440a['length'];if(!_0x18fa39[_0x3904('0x2d')]['hasOwnProperty'](_0x3904('0x34'))){_0x127de6[_0x3904('0x1a')]=qs[_0x3904('0x1a')](_0x18fa39[_0x3904('0x2d')][_0x3904('0x1a')]);_0x127de6[_0x3904('0x19')]=qs['offset'](_0x18fa39[_0x3904('0x2d')][_0x3904('0x19')]);}return _0x229827['getDescriptions'](_0x127de6);}})[_0x3904('0x22')](function(_0x5343e0){if(_0x5343e0){return _0x5343e0?{'count':_0x905b93,'rows':_0x5343e0}:null;}})['then'](respondWithResult(_0xd99ef2,null))[_0x3904('0x3e')](handleError(_0xd99ef2,null));};exports['getTags']=function(_0x2d9769,_0x45b2e1,_0xf68d1b){var _0x412bff={};var _0x59e5e1={};var _0x2dd091;var _0x128e08;return db[_0x3904('0x27')]['findOne']({'where':{'id':_0x2d9769[_0x3904('0x46')]['id']}})[_0x3904('0x22')](handleEntityNotFound(_0x45b2e1,null))[_0x3904('0x22')](function(_0x14b6c0){if(_0x14b6c0){_0x2dd091=_0x14b6c0;_0x59e5e1[_0x3904('0x2c')]=_['keys'](db[_0x3904('0x4b')]['rawAttributes']);_0x59e5e1[_0x3904('0x2d')]=_[_0x3904('0x2e')](_0x2d9769[_0x3904('0x2d')]);_0x59e5e1[_0x3904('0x2f')]=_[_0x3904('0x30')](_0x59e5e1[_0x3904('0x2c')],_0x59e5e1['query']);_0x412bff[_0x3904('0x31')]=_[_0x3904('0x30')](_0x59e5e1[_0x3904('0x2c')],qs[_0x3904('0x32')](_0x2d9769['query'][_0x3904('0x32')]));_0x412bff[_0x3904('0x31')]=_0x412bff['attributes']['length']?_0x412bff[_0x3904('0x31')]:_0x59e5e1[_0x3904('0x2c')];_0x412bff[_0x3904('0x48')]=qs['sort'](_0x2d9769[_0x3904('0x2d')][_0x3904('0x35')]);_0x412bff[_0x3904('0x36')]=qs[_0x3904('0x2f')](_[_0x3904('0x37')](_0x2d9769[_0x3904('0x2d')],_0x59e5e1[_0x3904('0x2f')]));if(_0x2d9769[_0x3904('0x2d')]['filter']){_0x412bff[_0x3904('0x36')]=_[_0x3904('0x39')](_0x412bff[_0x3904('0x36')],{'$or':_['map'](_0x412bff[_0x3904('0x31')],function(_0xd16872){var _0x4e5401={};_0x4e5401[_0xd16872]={'$like':'%'+_0x2d9769[_0x3904('0x2d')][_0x3904('0x38')]+'%'};return _0x4e5401;})});}_0x412bff=_[_0x3904('0x39')]({},_0x412bff,_0x2d9769[_0x3904('0x3b')]);return _0x2dd091[_0x3904('0x4c')](_0x412bff);}})[_0x3904('0x22')](function(_0x128359){if(_0x128359){_0x128e08=_0x128359[_0x3904('0x40')];if(!_0x2d9769[_0x3904('0x2d')][_0x3904('0x33')]('nolimit')){_0x412bff[_0x3904('0x1a')]=qs[_0x3904('0x1a')](_0x2d9769[_0x3904('0x2d')][_0x3904('0x1a')]);_0x412bff[_0x3904('0x19')]=qs[_0x3904('0x19')](_0x2d9769[_0x3904('0x2d')][_0x3904('0x19')]);}return _0x2dd091[_0x3904('0x4c')](_0x412bff);}})[_0x3904('0x22')](function(_0x5d5975){if(_0x5d5975){return _0x5d5975?{'count':_0x128e08,'rows':_0x5d5975}:null;}})[_0x3904('0x22')](respondWithResult(_0x45b2e1,null))[_0x3904('0x3e')](handleError(_0x45b2e1,null));};exports[_0x3904('0x4d')]=function(_0x54dd10,_0x300388,_0x136326){if(_0x54dd10[_0x3904('0x44')]['id']){delete _0x54dd10[_0x3904('0x44')]['id'];}return db['FreshdeskConfiguration'][_0x3904('0x47')]({'where':{'id':_0x54dd10[_0x3904('0x46')]['id']}})[_0x3904('0x22')](handleEntityNotFound(_0x300388,null))[_0x3904('0x22')](function(_0x133f91){if(_0x133f91){return _0x133f91[_0x3904('0x4d')](_0x54dd10[_0x3904('0x44')][_0x3904('0x4e')]||[]);}return null;})[_0x3904('0x22')](respondWithResult(_0x300388,null))[_0x3904('0x3e')](handleError(_0x300388,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 9a9acd7..15b08dd 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde25=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2e8a6e,_0x18e64f){var _0x259829=function(_0x230dac){while(--_0x230dac){_0x2e8a6e['push'](_0x2e8a6e['shift']());}};_0x259829(++_0x18e64f);}(_0xde25,0xc4));var _0x5de2=function(_0x574e71,_0x49165a){_0x574e71=_0x574e71-0x0;var _0x256837=_0xde25[_0x574e71];return _0x256837;};'use strict';var _=require(_0x5de2('0x0'));var util=require(_0x5de2('0x1'));var logger=require(_0x5de2('0x2'))(_0x5de2('0x3'));var moment=require(_0x5de2('0x4'));var BPromise=require(_0x5de2('0x5'));var rp=require(_0x5de2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5de2('0x7'));var config=require(_0x5de2('0x8'));var attributes=require(_0x5de2('0x9'));module[_0x5de2('0xa')]=function(_0x10a172,_0x34d531){return _0x10a172['define']('FreshdeskConfiguration',attributes,{'tableName':_0x5de2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f3c=['rimraf','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x260b0e,_0x437843){var _0x136bb6=function(_0xed40d4){while(--_0xed40d4){_0x260b0e['push'](_0x260b0e['shift']());}};_0x136bb6(++_0x437843);}(_0x5f3c,0x1a7));var _0xc5f3=function(_0x1fa873,_0x1319ab){_0x1fa873=_0x1fa873-0x0;var _0x599fbc=_0x5f3c[_0x1fa873];return _0x599fbc;};'use strict';var _=require(_0xc5f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc5f3('0x1'));var moment=require(_0xc5f3('0x2'));var BPromise=require(_0xc5f3('0x3'));var rp=require(_0xc5f3('0x4'));var fs=require('fs');var path=require(_0xc5f3('0x5'));var rimraf=require(_0xc5f3('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xc5f3('0x7')]=function(_0x386706,_0x529256){return _0x386706[_0xc5f3('0x8')](_0xc5f3('0x9'),attributes,{'tableName':_0xc5f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 8ff7141..b06ec56 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f19=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','util'];(function(_0xe4c1ef,_0x350aea){var _0x40b31b=function(_0x28a40f){while(--_0x28a40f){_0xe4c1ef['push'](_0xe4c1ef['shift']());}};_0x40b31b(++_0x350aea);}(_0x1f19,0xdb));var _0x91f1=function(_0x2d7427,_0x258339){_0x2d7427=_0x2d7427-0x0;var _0x3aa769=_0x1f19[_0x2d7427];return _0x3aa769;};'use strict';var _=require('lodash');var util=require(_0x91f1('0x0'));var moment=require('moment');var BPromise=require(_0x91f1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91f1('0x2'));var db=require(_0x91f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x91f1('0x4'))('rpc');var config=require(_0x91f1('0x5'));var jayson=require(_0x91f1('0x6'));var client=jayson['client'][_0x91f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ce195,_0x1083a2,_0x5b2ccc){return new BPromise(function(_0x4ef286,_0x3ff7f5){return client[_0x91f1('0x8')](_0x2ce195,_0x5b2ccc)['then'](function(_0x5f2153){logger[_0x91f1('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1083a2,'request\x20sent');logger[_0x91f1('0xa')](_0x91f1('0xb'),_0x1083a2,_0x91f1('0xc'),JSON[_0x91f1('0xd')](_0x5f2153));if(_0x5f2153[_0x91f1('0xe')]){if(_0x5f2153['error'][_0x91f1('0xf')]===0x1f4){logger[_0x91f1('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1083a2,_0x5f2153[_0x91f1('0xe')]['message']);return _0x3ff7f5(_0x5f2153[_0x91f1('0xe')]['message']);}logger[_0x91f1('0xe')](_0x91f1('0x10'),_0x1083a2,_0x5f2153[_0x91f1('0xe')][_0x91f1('0x11')]);return _0x4ef286(_0x5f2153['error']['message']);}else{logger[_0x91f1('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1083a2,_0x91f1('0xc'));_0x4ef286(_0x5f2153[_0x91f1('0x12')][_0x91f1('0x11')]);}})[_0x91f1('0x13')](function(_0x2b55fd){logger[_0x91f1('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1083a2,_0x2b55fd);_0x3ff7f5(_0x2b55fd);});});} \ No newline at end of file +var _0xe909=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3706fb,_0x5b0928){var _0xca126d=function(_0x15d51a){while(--_0x15d51a){_0x3706fb['push'](_0x3706fb['shift']());}};_0xca126d(++_0x5b0928);}(_0xe909,0xf7));var _0x9e90=function(_0x2a9288,_0x4f2178){_0x2a9288=_0x2a9288-0x0;var _0x404e4b=_0xe909[_0x2a9288];return _0x404e4b;};'use strict';var _=require(_0x9e90('0x0'));var util=require(_0x9e90('0x1'));var moment=require(_0x9e90('0x2'));var BPromise=require(_0x9e90('0x3'));var rs=require(_0x9e90('0x4'));var fs=require('fs');var Redis=require(_0x9e90('0x5'));var db=require(_0x9e90('0x6'))['db'];var utils=require(_0x9e90('0x7'));var logger=require(_0x9e90('0x8'))(_0x9e90('0x9'));var config=require(_0x9e90('0xa'));var jayson=require(_0x9e90('0xb'));var client=jayson[_0x9e90('0xc')][_0x9e90('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4fe285,_0x2485b2,_0xd9f553){return new BPromise(function(_0x39101c,_0x1f36cd){return client[_0x9e90('0xe')](_0x4fe285,_0xd9f553)[_0x9e90('0xf')](function(_0x1dd6d2){logger[_0x9e90('0x10')](_0x9e90('0x11'),_0x2485b2,'request\x20sent');logger[_0x9e90('0x12')](_0x9e90('0x13'),_0x2485b2,_0x9e90('0x14'),JSON[_0x9e90('0x15')](_0x1dd6d2));if(_0x1dd6d2[_0x9e90('0x16')]){if(_0x1dd6d2['error']['code']===0x1f4){logger[_0x9e90('0x16')](_0x9e90('0x11'),_0x2485b2,_0x1dd6d2[_0x9e90('0x16')]['message']);return _0x1f36cd(_0x1dd6d2[_0x9e90('0x16')]['message']);}logger[_0x9e90('0x16')](_0x9e90('0x11'),_0x2485b2,_0x1dd6d2['error']['message']);return _0x39101c(_0x1dd6d2[_0x9e90('0x16')][_0x9e90('0x17')]);}else{logger[_0x9e90('0x10')](_0x9e90('0x11'),_0x2485b2,'request\x20sent');_0x39101c(_0x1dd6d2[_0x9e90('0x18')][_0x9e90('0x17')]);}})[_0x9e90('0x19')](function(_0x3e7bea){logger['error'](_0x9e90('0x11'),_0x2485b2,_0x3e7bea);_0x1f36cd(_0x3e7bea);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8f591db..b45bbd2 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8c1=['put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','create'];(function(_0x1d1d28,_0x1f276b){var _0x5e8b39=function(_0x37c4d6){while(--_0x37c4d6){_0x1d1d28['push'](_0x1d1d28['shift']());}};_0x5e8b39(++_0x1f276b);}(_0xc8c1,0x1a2));var _0x1c8c=function(_0x524cd2,_0x4086be){_0x524cd2=_0x524cd2-0x0;var _0x2df158=_0xc8c1[_0x524cd2];return _0x2df158;};'use strict';var multer=require('multer');var util=require(_0x1c8c('0x0'));var path=require(_0x1c8c('0x1'));var timeout=require(_0x1c8c('0x2'));var express=require(_0x1c8c('0x3'));var router=express[_0x1c8c('0x4')]();var fs_extra=require(_0x1c8c('0x5'));var auth=require(_0x1c8c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1c8c('0x7'));var controller=require(_0x1c8c('0x8'));router[_0x1c8c('0x9')]('/',auth[_0x1c8c('0xa')](),controller['index']);router[_0x1c8c('0x9')](_0x1c8c('0xb'),auth[_0x1c8c('0xa')](),controller[_0x1c8c('0xc')]);router['post']('/',auth[_0x1c8c('0xa')](),controller[_0x1c8c('0xd')]);router[_0x1c8c('0xe')](_0x1c8c('0xb'),auth[_0x1c8c('0xa')](),controller[_0x1c8c('0xf')]);router[_0x1c8c('0x10')](_0x1c8c('0xb'),auth[_0x1c8c('0xa')](),controller['destroy']);module[_0x1c8c('0x11')]=router; \ No newline at end of file +var _0x4450=['get','/:id','isAuthenticated','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x4450,0x1e9));var _0x0445=function(_0x31857a,_0x522c2b){_0x31857a=_0x31857a-0x0;var _0x3b5442=_0x4450[_0x31857a];return _0x3b5442;};'use strict';var multer=require(_0x0445('0x0'));var util=require(_0x0445('0x1'));var path=require(_0x0445('0x2'));var timeout=require(_0x0445('0x3'));var express=require(_0x0445('0x4'));var router=express[_0x0445('0x5')]();var fs_extra=require(_0x0445('0x6'));var auth=require(_0x0445('0x7'));var interaction=require(_0x0445('0x8'));var config=require(_0x0445('0x9'));var controller=require(_0x0445('0xa'));router[_0x0445('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0445('0xb')](_0x0445('0xc'),auth[_0x0445('0xd')](),controller[_0x0445('0xe')]);router[_0x0445('0xf')]('/',auth[_0x0445('0xd')](),controller[_0x0445('0x10')]);router['put'](_0x0445('0xc'),auth[_0x0445('0xd')](),controller[_0x0445('0x11')]);router['delete'](_0x0445('0xc'),auth[_0x0445('0xd')](),controller[_0x0445('0x12')]);module[_0x0445('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 002cd05..325ba62 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.attributes.js +++ b/server/api/intFreshdeskField/intFreshdeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7dd=['customVariable','keyValue','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x3a24b5,_0x46ecbf){var _0x1a5815=function(_0x158695){while(--_0x158695){_0x3a24b5['push'](_0x3a24b5['shift']());}};_0x1a5815(++_0x46ecbf);}(_0xe7dd,0x12b));var _0xde7d=function(_0x57b484,_0x2272b4){_0x57b484=_0x57b484-0x0;var _0x823cf6=_0xe7dd[_0x57b484];return _0x823cf6;};'use strict';var Sequelize=require(_0xde7d('0x0'));module[_0xde7d('0x1')]={'type':{'type':Sequelize[_0xde7d('0x2')](_0xde7d('0x3'),_0xde7d('0x4'),_0xde7d('0x5'),_0xde7d('0x6'),'picklist'),'defaultValue':_0xde7d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xde7d('0x7')]},'keyType':{'type':Sequelize[_0xde7d('0x2')](_0xde7d('0x3'),_0xde7d('0x4'),_0xde7d('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde7d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x108a=['picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x21c0e1,_0x5f22d8){var _0x5c190a=function(_0x47790f){while(--_0x47790f){_0x21c0e1['push'](_0x21c0e1['shift']());}};_0x5c190a(++_0x5f22d8);}(_0x108a,0x1ab));var _0xa108=function(_0x312a48,_0x53abb2){_0x312a48=_0x312a48-0x0;var _0x5c227a=_0x108a[_0x312a48];return _0x5c227a;};'use strict';var Sequelize=require('sequelize');module[_0xa108('0x0')]={'type':{'type':Sequelize[_0xa108('0x1')](_0xa108('0x2'),'variable',_0xa108('0x3'),_0xa108('0x4'),_0xa108('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa108('0x6')]},'key':{'type':Sequelize[_0xa108('0x6')]},'keyType':{'type':Sequelize[_0xa108('0x1')](_0xa108('0x2'),_0xa108('0x7'),_0xa108('0x3'))},'keyContent':{'type':Sequelize[_0xa108('0x6')]},'idField':{'type':Sequelize[_0xa108('0x6')]},'nameField':{'type':Sequelize[_0xa108('0x6')]},'customField':{'type':Sequelize[_0xa108('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa108('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 4df5910..5d72034 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.controller.js +++ b/server/api/intFreshdeskField/intFreshdeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae60=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','FreshdeskField','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xe4b7bb,_0x334f5e){var _0x37193b=function(_0x344c37){while(--_0x344c37){_0xe4b7bb['push'](_0xe4b7bb['shift']());}};_0x37193b(++_0x334f5e);}(_0xae60,0x1c7));var _0x0ae6=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xae60[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x5b86fe,_0x3630e6){return function(_0x2dcdb7){if(!_0x2dcdb7){_0x5b86fe['sendStatus'](0x194);}return _0x2dcdb7;};}function handleError(_0x55dbe1,_0x44eb95){_0x44eb95=_0x44eb95||0x1f4;return function(_0x3255a7){logger[_0x0ae6('0x2b')](_0x3255a7['stack']);if(_0x3255a7[_0x0ae6('0x2c')]){delete _0x3255a7[_0x0ae6('0x2c')];}_0x55dbe1[_0x0ae6('0x1d')](_0x44eb95)['send'](_0x3255a7);};}exports[_0x0ae6('0x2d')]=function(_0x29fef3,_0x449c33){var _0x232fbd={},_0x14eed5={},_0x257af5={'count':0x0,'rows':[]};var _0x4fc7bd=_['map'](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')],function(_0x4e6df8){return{'name':_0x4e6df8['fieldName'],'type':_0x4e6df8[_0x0ae6('0x30')][_0x0ae6('0x31')]};});_0x14eed5[_0x0ae6('0x32')]=_[_0x0ae6('0x33')](_0x4fc7bd,'name');_0x14eed5[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x29fef3[_0x0ae6('0x34')]);_0x14eed5['filters']=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],_0x14eed5[_0x0ae6('0x34')]);_0x232fbd[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x38')]));_0x232fbd[_0x0ae6('0x37')]=_0x232fbd['attributes'][_0x0ae6('0x39')]?_0x232fbd[_0x0ae6('0x37')]:_0x14eed5['model'];if(!_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3a')](_0x0ae6('0x3b'))){_0x232fbd['limit']=qs[_0x0ae6('0x22')](_0x29fef3['query']['limit']);_0x232fbd[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x20')]);}_0x232fbd[_0x0ae6('0x3c')]=qs['sort'](_0x29fef3['query'][_0x0ae6('0x3d')]);_0x232fbd['where']=qs[_0x0ae6('0x3e')](_['pick'](_0x29fef3[_0x0ae6('0x34')],_0x14eed5['filters']),_0x4fc7bd);if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3f')]){_0x232fbd[_0x0ae6('0x40')]=_[_0x0ae6('0x41')](_0x232fbd['where'],{'$or':_['map'](_0x4fc7bd,function(_0x43414c){if(_0x43414c[_0x0ae6('0x30')]!==_0x0ae6('0x42')){var _0x59480a={};_0x59480a[_0x43414c[_0x0ae6('0x2c')]]={'$like':'%'+_0x29fef3['query'][_0x0ae6('0x3f')]+'%'};return _0x59480a;}})});}_0x232fbd=_[_0x0ae6('0x41')]({},_0x232fbd,_0x29fef3[_0x0ae6('0x43')]);var _0x19403c={'where':_0x232fbd[_0x0ae6('0x40')]};return db[_0x0ae6('0x2e')]['count'](_0x19403c)[_0x0ae6('0x29')](function(_0x601ef9){_0x257af5[_0x0ae6('0x23')]=_0x601ef9;if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x44')]){_0x232fbd[_0x0ae6('0x45')]=[{'all':!![]}];}return db[_0x0ae6('0x2e')][_0x0ae6('0x46')](_0x232fbd);})['then'](function(_0x38faeb){_0x257af5[_0x0ae6('0x47')]=_0x38faeb;return _0x257af5;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x449c33,_0x232fbd))[_0x0ae6('0x48')](handleError(_0x449c33,null));};exports[_0x0ae6('0x49')]=function(_0x167ed1,_0x24c021){var _0x21431e={'raw':!![],'where':{'id':_0x167ed1[_0x0ae6('0x4a')]['id']}},_0xb38cbb={};_0xb38cbb[_0x0ae6('0x32')]=_[_0x0ae6('0x35')](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')]);_0xb38cbb[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x167ed1[_0x0ae6('0x34')]);_0xb38cbb[_0x0ae6('0x3e')]=_['intersection'](_0xb38cbb[_0x0ae6('0x32')],_0xb38cbb[_0x0ae6('0x34')]);_0x21431e[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0xb38cbb[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x167ed1['query'][_0x0ae6('0x38')]));_0x21431e[_0x0ae6('0x37')]=_0x21431e[_0x0ae6('0x37')][_0x0ae6('0x39')]?_0x21431e['attributes']:_0xb38cbb['model'];if(_0x167ed1['query'][_0x0ae6('0x44')]){_0x21431e[_0x0ae6('0x45')]=[{'all':!![]}];}_0x21431e=_[_0x0ae6('0x41')]({},_0x21431e,_0x167ed1['options']);return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')](_0x21431e)['then'](handleEntityNotFound(_0x24c021,null))[_0x0ae6('0x29')](respondWithResult(_0x24c021,null))[_0x0ae6('0x48')](handleError(_0x24c021,null));};exports['create']=function(_0x354efd,_0x3d1e75){return db['FreshdeskField'][_0x0ae6('0x4c')](_0x354efd[_0x0ae6('0x4d')],{})[_0x0ae6('0x29')](respondWithResult(_0x3d1e75,0xc9))['catch'](handleError(_0x3d1e75,null));};exports[_0x0ae6('0x28')]=function(_0x21de54,_0x46075a){if(_0x21de54[_0x0ae6('0x4d')]['id']){delete _0x21de54[_0x0ae6('0x4d')]['id'];}return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x21de54['params']['id']}})['then'](handleEntityNotFound(_0x46075a,null))[_0x0ae6('0x29')](saveUpdates(_0x21de54[_0x0ae6('0x4d')],null))[_0x0ae6('0x29')](respondWithResult(_0x46075a,null))['catch'](handleError(_0x46075a,null));};exports[_0x0ae6('0x2a')]=function(_0x51df5c,_0x582a5e){return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x51df5c[_0x0ae6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x582a5e,null))[_0x0ae6('0x29')](removeEntity(_0x582a5e,null))[_0x0ae6('0x48')](handleError(_0x582a5e,null));}; \ No newline at end of file +var _0x6f2f=['Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','eml-format','rimraf','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count'];(function(_0x4a3acd,_0x4bf641){var _0x3efdaa=function(_0x32842d){while(--_0x32842d){_0x4a3acd['push'](_0x4a3acd['shift']());}};_0x3efdaa(++_0x4bf641);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x6f2f[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0xf6f2('0x0'));var rimraf=require(_0xf6f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6f2('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf6f2('0x3'));var path=require(_0xf6f2('0x4'));var sox=require(_0xf6f2('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6f2('0x6'));var _=require(_0xf6f2('0x7'));var squel=require(_0xf6f2('0x8'));var crypto=require(_0xf6f2('0x9'));var jsforce=require(_0xf6f2('0xa'));var deskjs=require(_0xf6f2('0xb'));var toCsv=require(_0xf6f2('0xc'));var querystring=require(_0xf6f2('0xd'));var Papa=require(_0xf6f2('0xe'));var Redis=require(_0xf6f2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf6f2('0x10'));var as=require(_0xf6f2('0x11'));var hardwareService=require(_0xf6f2('0x12'));var logger=require(_0xf6f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf6f2('0x14'));var db=require(_0xf6f2('0x15'))['db'];function respondWithStatusCode(_0x131a18,_0x4afa2){_0x4afa2=_0x4afa2||0xcc;return function(_0x1626ce){if(_0x1626ce){return _0x131a18[_0xf6f2('0x16')](_0x4afa2);}return _0x131a18['status'](_0x4afa2)[_0xf6f2('0x17')]();};}function respondWithResult(_0x5ef5ac,_0xccf687){_0xccf687=_0xccf687||0xc8;return function(_0x3cf95f){if(_0x3cf95f){return _0x5ef5ac[_0xf6f2('0x18')](_0xccf687)['json'](_0x3cf95f);}};}function respondWithFilteredResult(_0x2b28c1,_0x27c0dc){return function(_0x314f9a){if(_0x314f9a){var _0x26c176=typeof _0x27c0dc[_0xf6f2('0x19')]===_0xf6f2('0x1a')&&typeof _0x27c0dc[_0xf6f2('0x1b')]===_0xf6f2('0x1a');var _0x4115dd=_0x314f9a[_0xf6f2('0x1c')];var _0x400055=_0x26c176?0x0:_0x27c0dc[_0xf6f2('0x19')];var _0x42b93b=_0x26c176?_0x314f9a[_0xf6f2('0x1c')]:_0x27c0dc[_0xf6f2('0x19')]+_0x27c0dc['limit'];var _0x4de8bd;if(_0x42b93b>=_0x4115dd){_0x42b93b=_0x4115dd;_0x4de8bd=0xc8;}else{_0x4de8bd=0xce;}_0x2b28c1[_0xf6f2('0x18')](_0x4de8bd);return _0x2b28c1['set'](_0xf6f2('0x1d'),_0x400055+'-'+_0x42b93b+'/'+_0x4115dd)[_0xf6f2('0x1e')](_0x314f9a);}return null;};}function patchUpdates(_0x312429){return function(_0x1ad76b){try{jsonpatch['apply'](_0x1ad76b,_0x312429,!![]);}catch(_0xd020e6){return BPromise[_0xf6f2('0x1f')](_0xd020e6);}return _0x1ad76b[_0xf6f2('0x20')]();};}function saveUpdates(_0x3321a0,_0x5dce4f){return function(_0x19be8e){if(_0x19be8e){return _0x19be8e['update'](_0x3321a0)[_0xf6f2('0x21')](function(_0x56b97a){return _0x56b97a;});}return null;};}function removeEntity(_0x1e33c,_0x151905){return function(_0x582862){if(_0x582862){return _0x582862[_0xf6f2('0x22')]()[_0xf6f2('0x21')](function(){_0x1e33c[_0xf6f2('0x18')](0xcc)[_0xf6f2('0x17')]();});}};}function handleEntityNotFound(_0x219a12,_0x1f3500){return function(_0x3304ec){if(!_0x3304ec){_0x219a12[_0xf6f2('0x16')](0x194);}return _0x3304ec;};}function handleError(_0x5dac6a,_0x2b233f){_0x2b233f=_0x2b233f||0x1f4;return function(_0x2081f6){logger[_0xf6f2('0x23')](_0x2081f6[_0xf6f2('0x24')]);if(_0x2081f6[_0xf6f2('0x25')]){delete _0x2081f6[_0xf6f2('0x25')];}_0x5dac6a[_0xf6f2('0x18')](_0x2b233f)[_0xf6f2('0x26')](_0x2081f6);};}exports[_0xf6f2('0x27')]=function(_0x40243e,_0x2c643d){var _0x4accfe={},_0x2aa645={},_0x26c4dc={'count':0x0,'rows':[]};var _0x17c63f=_[_0xf6f2('0x28')](db[_0xf6f2('0x29')][_0xf6f2('0x2a')],function(_0x228b24){return{'name':_0x228b24[_0xf6f2('0x2b')],'type':_0x228b24[_0xf6f2('0x2c')][_0xf6f2('0x2d')]};});_0x2aa645[_0xf6f2('0x2e')]=_[_0xf6f2('0x28')](_0x17c63f,'name');_0x2aa645[_0xf6f2('0x2f')]=_[_0xf6f2('0x30')](_0x40243e[_0xf6f2('0x2f')]);_0x2aa645[_0xf6f2('0x31')]=_[_0xf6f2('0x32')](_0x2aa645[_0xf6f2('0x2e')],_0x2aa645[_0xf6f2('0x2f')]);_0x4accfe[_0xf6f2('0x33')]=_[_0xf6f2('0x32')](_0x2aa645[_0xf6f2('0x2e')],qs[_0xf6f2('0x34')](_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x34')]));_0x4accfe['attributes']=_0x4accfe['attributes']['length']?_0x4accfe[_0xf6f2('0x33')]:_0x2aa645[_0xf6f2('0x2e')];if(!_0x40243e['query']['hasOwnProperty'](_0xf6f2('0x35'))){_0x4accfe[_0xf6f2('0x1b')]=qs[_0xf6f2('0x1b')](_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x1b')]);_0x4accfe[_0xf6f2('0x19')]=qs['offset'](_0x40243e[_0xf6f2('0x2f')]['offset']);}_0x4accfe[_0xf6f2('0x36')]=qs[_0xf6f2('0x37')](_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x37')]);_0x4accfe['where']=qs[_0xf6f2('0x31')](_[_0xf6f2('0x38')](_0x40243e[_0xf6f2('0x2f')],_0x2aa645['filters']),_0x17c63f);if(_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x39')]){_0x4accfe[_0xf6f2('0x3a')]=_['merge'](_0x4accfe[_0xf6f2('0x3a')],{'$or':_['map'](_0x17c63f,function(_0x38b20d){if(_0x38b20d[_0xf6f2('0x2c')]!==_0xf6f2('0x3b')){var _0x55e44d={};_0x55e44d[_0x38b20d[_0xf6f2('0x25')]]={'$like':'%'+_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x39')]+'%'};return _0x55e44d;}})});}_0x4accfe=_[_0xf6f2('0x3c')]({},_0x4accfe,_0x40243e[_0xf6f2('0x3d')]);var _0x4ee53f={'where':_0x4accfe[_0xf6f2('0x3a')]};return db[_0xf6f2('0x29')][_0xf6f2('0x1c')](_0x4ee53f)[_0xf6f2('0x21')](function(_0x3986f1){_0x26c4dc[_0xf6f2('0x1c')]=_0x3986f1;if(_0x40243e[_0xf6f2('0x2f')]['includeAll']){_0x4accfe[_0xf6f2('0x3e')]=[{'all':!![]}];}return db[_0xf6f2('0x29')][_0xf6f2('0x3f')](_0x4accfe);})['then'](function(_0x244a8c){_0x26c4dc[_0xf6f2('0x40')]=_0x244a8c;return _0x26c4dc;})[_0xf6f2('0x21')](respondWithFilteredResult(_0x2c643d,_0x4accfe))[_0xf6f2('0x41')](handleError(_0x2c643d,null));};exports[_0xf6f2('0x42')]=function(_0x4c4f17,_0x47090b){var _0x31f367={'raw':!![],'where':{'id':_0x4c4f17[_0xf6f2('0x43')]['id']}},_0x34ba3a={};_0x34ba3a[_0xf6f2('0x2e')]=_['keys'](db[_0xf6f2('0x29')]['rawAttributes']);_0x34ba3a[_0xf6f2('0x2f')]=_[_0xf6f2('0x30')](_0x4c4f17[_0xf6f2('0x2f')]);_0x34ba3a[_0xf6f2('0x31')]=_[_0xf6f2('0x32')](_0x34ba3a[_0xf6f2('0x2e')],_0x34ba3a[_0xf6f2('0x2f')]);_0x31f367[_0xf6f2('0x33')]=_[_0xf6f2('0x32')](_0x34ba3a[_0xf6f2('0x2e')],qs[_0xf6f2('0x34')](_0x4c4f17['query'][_0xf6f2('0x34')]));_0x31f367[_0xf6f2('0x33')]=_0x31f367[_0xf6f2('0x33')]['length']?_0x31f367['attributes']:_0x34ba3a['model'];if(_0x4c4f17[_0xf6f2('0x2f')][_0xf6f2('0x44')]){_0x31f367['include']=[{'all':!![]}];}_0x31f367=_['merge']({},_0x31f367,_0x4c4f17[_0xf6f2('0x3d')]);return db[_0xf6f2('0x29')][_0xf6f2('0x45')](_0x31f367)[_0xf6f2('0x21')](handleEntityNotFound(_0x47090b,null))[_0xf6f2('0x21')](respondWithResult(_0x47090b,null))[_0xf6f2('0x41')](handleError(_0x47090b,null));};exports['create']=function(_0x5b4737,_0x5daa2c){return db['FreshdeskField'][_0xf6f2('0x46')](_0x5b4737['body'],{})[_0xf6f2('0x21')](respondWithResult(_0x5daa2c,0xc9))[_0xf6f2('0x41')](handleError(_0x5daa2c,null));};exports[_0xf6f2('0x47')]=function(_0x3b7d67,_0x28da53){if(_0x3b7d67['body']['id']){delete _0x3b7d67['body']['id'];}return db[_0xf6f2('0x29')]['find']({'where':{'id':_0x3b7d67['params']['id']}})[_0xf6f2('0x21')](handleEntityNotFound(_0x28da53,null))[_0xf6f2('0x21')](saveUpdates(_0x3b7d67[_0xf6f2('0x48')],null))[_0xf6f2('0x21')](respondWithResult(_0x28da53,null))[_0xf6f2('0x41')](handleError(_0x28da53,null));};exports[_0xf6f2('0x22')]=function(_0x5351f5,_0x443277){return db[_0xf6f2('0x29')]['find']({'where':{'id':_0x5351f5[_0xf6f2('0x43')]['id']}})[_0xf6f2('0x21')](handleEntityNotFound(_0x443277,null))[_0xf6f2('0x21')](removeEntity(_0x443277,null))['catch'](handleError(_0x443277,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 4910b99..07f78b8 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.model.js +++ b/server/api/intFreshdeskField/intFreshdeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00b7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x3fdcf0,_0x16238b){var _0x2dc2e3=function(_0xd2c7ec){while(--_0xd2c7ec){_0x3fdcf0['push'](_0x3fdcf0['shift']());}};_0x2dc2e3(++_0x16238b);}(_0x00b7,0x160));var _0x700b=function(_0x29d210,_0x1d3af9){_0x29d210=_0x29d210-0x0;var _0x23755a=_0x00b7[_0x29d210];return _0x23755a;};'use strict';var _=require(_0x700b('0x0'));var util=require(_0x700b('0x1'));var logger=require(_0x700b('0x2'))(_0x700b('0x3'));var moment=require(_0x700b('0x4'));var BPromise=require(_0x700b('0x5'));var rp=require(_0x700b('0x6'));var fs=require('fs');var path=require(_0x700b('0x7'));var rimraf=require(_0x700b('0x8'));var config=require(_0x700b('0x9'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x42c8b6,_0x29f9b7){return _0x42c8b6[_0x700b('0xa')](_0x700b('0xb'),attributes,{'tableName':_0x700b('0xc'),'paranoid':![],'indexes':[{'name':_0x700b('0xd'),'fields':[_0x700b('0xe'),_0x700b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e44=['exports','define','FreshdeskField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes'];(function(_0x34f533,_0x251aee){var _0x1b37d2=function(_0x257a1b){while(--_0x257a1b){_0x34f533['push'](_0x34f533['shift']());}};_0x1b37d2(++_0x251aee);}(_0x1e44,0x1a9));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41e4('0x0'));var util=require(_0x41e4('0x1'));var logger=require(_0x41e4('0x2'))(_0x41e4('0x3'));var moment=require(_0x41e4('0x4'));var BPromise=require(_0x41e4('0x5'));var rp=require(_0x41e4('0x6'));var fs=require('fs');var path=require(_0x41e4('0x7'));var rimraf=require('rimraf');var config=require(_0x41e4('0x8'));var attributes=require(_0x41e4('0x9'));module[_0x41e4('0xa')]=function(_0x4f0c86,_0xf44512){return _0x4f0c86[_0x41e4('0xb')](_0x41e4('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x41e4('0xd'),_0x41e4('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c1a271c..aafd106 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9e9=['client','http','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x9217f,_0x2e0053){var _0x146dec=function(_0x3ef6bc){while(--_0x3ef6bc){_0x9217f['push'](_0x9217f['shift']());}};_0x146dec(++_0x2e0053);}(_0xe9e9,0x185));var _0x9e9e=function(_0x5b6f40,_0x17657b){_0x5b6f40=_0x5b6f40-0x0;var _0x206bf8=_0xe9e9[_0x5b6f40];return _0x206bf8;};'use strict';var _=require(_0x9e9e('0x0'));var util=require(_0x9e9e('0x1'));var moment=require(_0x9e9e('0x2'));var BPromise=require(_0x9e9e('0x3'));var rs=require(_0x9e9e('0x4'));var fs=require('fs');var Redis=require(_0x9e9e('0x5'));var db=require(_0x9e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e9e('0x7'))(_0x9e9e('0x8'));var config=require('../../config/environment');var jayson=require(_0x9e9e('0x9'));var client=jayson[_0x9e9e('0xa')][_0x9e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40ea32,_0xf267f1,_0x2482f5){return new BPromise(function(_0x352ab3,_0x4479a9){return client['request'](_0x40ea32,_0x2482f5)['then'](function(_0x136988){logger[_0x9e9e('0xc')](_0x9e9e('0xd'),_0xf267f1,_0x9e9e('0xe'));logger[_0x9e9e('0xf')](_0x9e9e('0x10'),_0xf267f1,_0x9e9e('0xe'),JSON[_0x9e9e('0x11')](_0x136988));if(_0x136988[_0x9e9e('0x12')]){if(_0x136988[_0x9e9e('0x12')][_0x9e9e('0x13')]===0x1f4){logger['error'](_0x9e9e('0xd'),_0xf267f1,_0x136988['error'][_0x9e9e('0x14')]);return _0x4479a9(_0x136988[_0x9e9e('0x12')]['message']);}logger[_0x9e9e('0x12')]('FreshdeskField,\x20%s,\x20%s',_0xf267f1,_0x136988[_0x9e9e('0x12')]['message']);return _0x352ab3(_0x136988[_0x9e9e('0x12')][_0x9e9e('0x14')]);}else{logger[_0x9e9e('0xc')](_0x9e9e('0xd'),_0xf267f1,_0x9e9e('0xe'));_0x352ab3(_0x136988['result'][_0x9e9e('0x14')]);}})['catch'](function(_0x582e53){logger[_0x9e9e('0x12')](_0x9e9e('0xd'),_0xf267f1,_0x582e53);_0x4479a9(_0x582e53);});});} \ No newline at end of file +var _0xd422=['message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error'];(function(_0x565130,_0x27cfde){var _0x38de76=function(_0x344725){while(--_0x344725){_0x565130['push'](_0x565130['shift']());}};_0x38de76(++_0x27cfde);}(_0xd422,0xd3));var _0x2d42=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xd422[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x2d42('0x0'));var util=require(_0x2d42('0x1'));var moment=require('moment');var BPromise=require(_0x2d42('0x2'));var rs=require(_0x2d42('0x3'));var fs=require('fs');var Redis=require(_0x2d42('0x4'));var db=require(_0x2d42('0x5'))['db'];var utils=require(_0x2d42('0x6'));var logger=require(_0x2d42('0x7'))(_0x2d42('0x8'));var config=require(_0x2d42('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2d42('0xa')][_0x2d42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42872c,_0x27244f,_0x36a6ad){return new BPromise(function(_0x494a34,_0x3e332a){return client[_0x2d42('0xc')](_0x42872c,_0x36a6ad)[_0x2d42('0xd')](function(_0x21eefe){logger['info'](_0x2d42('0xe'),_0x27244f,_0x2d42('0xf'));logger[_0x2d42('0x10')](_0x2d42('0x11'),_0x27244f,'request\x20sent',JSON['stringify'](_0x21eefe));if(_0x21eefe[_0x2d42('0x12')]){if(_0x21eefe['error']['code']===0x1f4){logger['error'](_0x2d42('0xe'),_0x27244f,_0x21eefe['error']['message']);return _0x3e332a(_0x21eefe['error']['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x27244f,_0x21eefe[_0x2d42('0x12')][_0x2d42('0x13')]);return _0x494a34(_0x21eefe[_0x2d42('0x12')][_0x2d42('0x13')]);}else{logger[_0x2d42('0x14')](_0x2d42('0xe'),_0x27244f,_0x2d42('0xf'));_0x494a34(_0x21eefe[_0x2d42('0x15')][_0x2d42('0x13')]);}})[_0x2d42('0x16')](function(_0x5a3ee7){logger[_0x2d42('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x27244f,_0x5a3ee7);_0x3e332a(_0x5a3ee7);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index aec176a..868c691 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','/:id','isAuthenticated','show','get','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa88,0x137));var _0x8aa8=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0xaa88[_0x51a6d6];return _0x5ef1a8;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id/configurations',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0xe')]('/:id/fields',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xc')](),controller['create']);router[_0x8aa8('0x11')](_0x8aa8('0x12'),auth['isAuthenticated'](),controller[_0x8aa8('0x13')]);router[_0x8aa8('0x14')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);router[_0x8aa8('0x16')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14ab25,_0x3cbe44){var _0x1bb2e8=function(_0x1a6a7f){while(--_0x1a6a7f){_0x14ab25['push'](_0x14ab25['shift']());}};_0x1bb2e8(++_0x3cbe44);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5ee73b,_0x282c4c){_0x5ee73b=_0x5ee73b-0x0;var _0x22948a=_0x5eb8[_0x5ee73b];return _0x22948a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x12')]('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0x12')](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['update']);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x15')]);module[_0x85eb('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 91684f3..3364d1c 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef0f=['sequelize','STRING','remoteUri'];(function(_0x107236,_0x31c243){var _0x5dc6a0=function(_0x7b538a){while(--_0x7b538a){_0x107236['push'](_0x107236['shift']());}};_0x5dc6a0(++_0x31c243);}(_0xef0f,0x168));var _0xfef0=function(_0x4efe0d,_0x32f90f){_0x4efe0d=_0x4efe0d-0x0;var _0x27eaa7=_0xef0f[_0x4efe0d];return _0x27eaa7;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')]},'description':{'type':Sequelize[_0xfef0('0x1')]},'username':{'type':Sequelize[_0xfef0('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfef0('0x1')]},'remoteUri':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xffd6=['exports','STRING','username','sequelize'];(function(_0x194f9a,_0x479b58){var _0x559c89=function(_0x243059){while(--_0x243059){_0x194f9a['push'](_0x194f9a['shift']());}};_0x559c89(++_0x479b58);}(_0xffd6,0x97));var _0x6ffd=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xffd6[_0x1e3671];return _0x48d5f5;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6ffd('0x3')},'apiKey':{'type':Sequelize[_0x6ffd('0x2')]},'remoteUri':{'type':Sequelize[_0x6ffd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6ffd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 83a5aa3..f3e467e 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x118d=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','destroy','then','end','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','getConfigurations','FreshsalesConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','substring','GET','format','%s%s','Token\x20token=','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x118d,0x19e));var _0xd118=function(_0x5cf8df,_0x378952){_0x5cf8df=_0x5cf8df-0x0;var _0x308625=_0x118d[_0x5cf8df];return _0x308625;};'use strict';var emlformat=require(_0xd118('0x0'));var rimraf=require(_0xd118('0x1'));var zipdir=require(_0xd118('0x2'));var jsonpatch=require(_0xd118('0x3'));var rp=require(_0xd118('0x4'));var moment=require(_0xd118('0x5'));var BPromise=require(_0xd118('0x6'));var Mustache=require(_0xd118('0x7'));var util=require(_0xd118('0x8'));var path=require(_0xd118('0x9'));var sox=require('sox');var csv=require(_0xd118('0xa'));var ejs=require(_0xd118('0xb'));var fs=require('fs');var fs_extra=require(_0xd118('0xc'));var _=require(_0xd118('0xd'));var squel=require(_0xd118('0xe'));var crypto=require(_0xd118('0xf'));var jsforce=require(_0xd118('0x10'));var deskjs=require(_0xd118('0x11'));var toCsv=require(_0xd118('0xa'));var querystring=require(_0xd118('0x12'));var Papa=require(_0xd118('0x13'));var Redis=require(_0xd118('0x14'));var authService=require(_0xd118('0x15'));var qs=require(_0xd118('0x16'));var as=require(_0xd118('0x17'));var hardwareService=require(_0xd118('0x18'));var logger=require(_0xd118('0x19'))('api');var utils=require(_0xd118('0x1a'));var config=require(_0xd118('0x1b'));var licenseUtil=require(_0xd118('0x1c'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd118('0x1d'));function respondWithStatusCode(_0x3addd1,_0x25c04c){_0x25c04c=_0x25c04c||0xcc;return function(_0x4f7105){if(_0x4f7105){return _0x3addd1[_0xd118('0x1e')](_0x25c04c);}return _0x3addd1['status'](_0x25c04c)['end']();};}function respondWithResult(_0xa97cb7,_0x1d3852){_0x1d3852=_0x1d3852||0xc8;return function(_0x546cc3){if(_0x546cc3){return _0xa97cb7[_0xd118('0x1f')](_0x1d3852)[_0xd118('0x20')](_0x546cc3);}};}function respondWithFilteredResult(_0x2ceb2e,_0x55ed73){return function(_0x2602e1){if(_0x2602e1){var _0x59c647=typeof _0x55ed73[_0xd118('0x21')]===_0xd118('0x22')&&typeof _0x55ed73[_0xd118('0x23')]===_0xd118('0x22');var _0x18b56d=_0x2602e1[_0xd118('0x24')];var _0x5bfe0c=_0x59c647?0x0:_0x55ed73[_0xd118('0x21')];var _0x175f1f=_0x59c647?_0x2602e1[_0xd118('0x24')]:_0x55ed73[_0xd118('0x21')]+_0x55ed73['limit'];var _0x3aa89f;if(_0x175f1f>=_0x18b56d){_0x175f1f=_0x18b56d;_0x3aa89f=0xc8;}else{_0x3aa89f=0xce;}_0x2ceb2e[_0xd118('0x1f')](_0x3aa89f);return _0x2ceb2e[_0xd118('0x25')]('Content-Range',_0x5bfe0c+'-'+_0x175f1f+'/'+_0x18b56d)[_0xd118('0x20')](_0x2602e1);}return null;};}function patchUpdates(_0x1bb2ea){return function(_0x434d7c){try{jsonpatch[_0xd118('0x26')](_0x434d7c,_0x1bb2ea,!![]);}catch(_0x36c8d4){return BPromise['reject'](_0x36c8d4);}return _0x434d7c['save']();};}function saveUpdates(_0xcda952,_0x1e842a){return function(_0x4f3d31){if(_0x4f3d31){return _0x4f3d31[_0xd118('0x27')](_0xcda952)['then'](function(_0x1ac89f){return _0x1ac89f;});}return null;};}function removeEntity(_0xfb12e9,_0x2f4f3a){return function(_0xc5a86f){if(_0xc5a86f){return _0xc5a86f[_0xd118('0x28')]()[_0xd118('0x29')](function(){_0xfb12e9[_0xd118('0x1f')](0xcc)[_0xd118('0x2a')]();});}};}function handleEntityNotFound(_0x5aa942,_0x49eb3c){return function(_0x3e0c57){if(!_0x3e0c57){_0x5aa942['sendStatus'](0x194);}return _0x3e0c57;};}function handleError(_0x22edcb,_0x1c4e42){_0x1c4e42=_0x1c4e42||0x1f4;return function(_0x38af46){logger[_0xd118('0x2b')](_0x38af46[_0xd118('0x2c')]);if(_0x38af46[_0xd118('0x2d')]){delete _0x38af46['name'];}_0x22edcb[_0xd118('0x1f')](_0x1c4e42)[_0xd118('0x2e')](_0x38af46);};}exports[_0xd118('0x2f')]=function(_0x167f5b,_0x4cad7b){var _0x1a4dac={},_0x6e62b2={},_0x5e27b8={'count':0x0,'rows':[]};var _0x570788=_[_0xd118('0x30')](db[_0xd118('0x31')][_0xd118('0x32')],function(_0x32cea5){return{'name':_0x32cea5[_0xd118('0x33')],'type':_0x32cea5[_0xd118('0x34')][_0xd118('0x35')]};});_0x6e62b2[_0xd118('0x36')]=_[_0xd118('0x30')](_0x570788,_0xd118('0x2d'));_0x6e62b2[_0xd118('0x37')]=_[_0xd118('0x38')](_0x167f5b['query']);_0x6e62b2[_0xd118('0x39')]=_[_0xd118('0x3a')](_0x6e62b2[_0xd118('0x36')],_0x6e62b2[_0xd118('0x37')]);_0x1a4dac[_0xd118('0x3b')]=_[_0xd118('0x3a')](_0x6e62b2[_0xd118('0x36')],qs['fields'](_0x167f5b[_0xd118('0x37')][_0xd118('0x3c')]));_0x1a4dac[_0xd118('0x3b')]=_0x1a4dac['attributes'][_0xd118('0x3d')]?_0x1a4dac['attributes']:_0x6e62b2[_0xd118('0x36')];if(!_0x167f5b[_0xd118('0x37')][_0xd118('0x3e')]('nolimit')){_0x1a4dac[_0xd118('0x23')]=qs[_0xd118('0x23')](_0x167f5b[_0xd118('0x37')][_0xd118('0x23')]);_0x1a4dac[_0xd118('0x21')]=qs[_0xd118('0x21')](_0x167f5b[_0xd118('0x37')][_0xd118('0x21')]);}_0x1a4dac[_0xd118('0x3f')]=qs[_0xd118('0x40')](_0x167f5b[_0xd118('0x37')][_0xd118('0x40')]);_0x1a4dac[_0xd118('0x41')]=qs[_0xd118('0x39')](_['pick'](_0x167f5b[_0xd118('0x37')],_0x6e62b2[_0xd118('0x39')]),_0x570788);if(_0x167f5b[_0xd118('0x37')][_0xd118('0x42')]){_0x1a4dac[_0xd118('0x41')]=_[_0xd118('0x43')](_0x1a4dac[_0xd118('0x41')],{'$or':_[_0xd118('0x30')](_0x570788,function(_0x47970a){if(_0x47970a[_0xd118('0x34')]!==_0xd118('0x44')){var _0x52d1d2={};_0x52d1d2[_0x47970a[_0xd118('0x2d')]]={'$like':'%'+_0x167f5b['query'][_0xd118('0x42')]+'%'};return _0x52d1d2;}})});}_0x1a4dac=_[_0xd118('0x43')]({},_0x1a4dac,_0x167f5b['options']);var _0x275f11={'where':_0x1a4dac[_0xd118('0x41')]};return db[_0xd118('0x31')][_0xd118('0x24')](_0x275f11)[_0xd118('0x29')](function(_0x4e4ff3){_0x5e27b8['count']=_0x4e4ff3;if(_0x167f5b[_0xd118('0x37')][_0xd118('0x45')]){_0x1a4dac[_0xd118('0x46')]=[{'all':!![]}];}return db[_0xd118('0x31')]['findAll'](_0x1a4dac);})['then'](function(_0x481f67){_0x5e27b8[_0xd118('0x47')]=_0x481f67;return _0x5e27b8;})[_0xd118('0x29')](respondWithFilteredResult(_0x4cad7b,_0x1a4dac))[_0xd118('0x48')](handleError(_0x4cad7b,null));};exports[_0xd118('0x49')]=function(_0x46574f,_0x834e93){var _0x3e1daa={'raw':![],'where':{'id':_0x46574f[_0xd118('0x4a')]['id']}},_0x281105={};_0x281105[_0xd118('0x36')]=_[_0xd118('0x38')](db[_0xd118('0x31')][_0xd118('0x32')]);_0x281105[_0xd118('0x37')]=_[_0xd118('0x38')](_0x46574f[_0xd118('0x37')]);_0x281105['filters']=_['intersection'](_0x281105[_0xd118('0x36')],_0x281105['query']);_0x3e1daa[_0xd118('0x3b')]=_['intersection'](_0x281105['model'],qs[_0xd118('0x3c')](_0x46574f[_0xd118('0x37')][_0xd118('0x3c')]));_0x3e1daa[_0xd118('0x3b')]=_0x3e1daa[_0xd118('0x3b')]['length']?_0x3e1daa[_0xd118('0x3b')]:_0x281105[_0xd118('0x36')];if(_0x46574f[_0xd118('0x37')][_0xd118('0x45')]){_0x3e1daa[_0xd118('0x46')]=[{'all':!![]}];}_0x3e1daa=_[_0xd118('0x43')]({},_0x3e1daa,_0x46574f[_0xd118('0x4b')]);return db[_0xd118('0x31')][_0xd118('0x4c')](_0x3e1daa)[_0xd118('0x29')](handleEntityNotFound(_0x834e93,null))[_0xd118('0x29')](respondWithResult(_0x834e93,null))[_0xd118('0x48')](handleError(_0x834e93,null));};exports[_0xd118('0x4d')]=function(_0x2c76fc,_0x1e7198){return db[_0xd118('0x31')][_0xd118('0x4d')](_0x2c76fc['body'],{})[_0xd118('0x29')](respondWithResult(_0x1e7198,0xc9))[_0xd118('0x48')](handleError(_0x1e7198,null));};exports['update']=function(_0x950a79,_0x3358c6){if(_0x950a79['body']['id']){delete _0x950a79['body']['id'];}return db[_0xd118('0x31')]['find']({'where':{'id':_0x950a79[_0xd118('0x4a')]['id']}})[_0xd118('0x29')](handleEntityNotFound(_0x3358c6,null))[_0xd118('0x29')](saveUpdates(_0x950a79[_0xd118('0x4e')],null))['then'](respondWithResult(_0x3358c6,null))[_0xd118('0x48')](handleError(_0x3358c6,null));};exports[_0xd118('0x28')]=function(_0x2a9d2c,_0x4180d0){return db['FreshsalesAccount'][_0xd118('0x4c')]({'where':{'id':_0x2a9d2c[_0xd118('0x4a')]['id']}})[_0xd118('0x29')](handleEntityNotFound(_0x4180d0,null))[_0xd118('0x29')](removeEntity(_0x4180d0,null))[_0xd118('0x48')](handleError(_0x4180d0,null));};exports[_0xd118('0x4f')]=function(_0x1e1d45,_0x1d0939,_0x29a3ad){var _0x4df757={};var _0x11eb95={};var _0x581a15;var _0x317b72;return db[_0xd118('0x31')]['findOne']({'where':{'id':_0x1e1d45[_0xd118('0x4a')]['id']}})[_0xd118('0x29')](handleEntityNotFound(_0x1d0939,null))[_0xd118('0x29')](function(_0x240ae5){if(_0x240ae5){_0x581a15=_0x240ae5;_0x11eb95['model']=_[_0xd118('0x38')](db[_0xd118('0x50')][_0xd118('0x32')]);_0x11eb95[_0xd118('0x37')]=_[_0xd118('0x38')](_0x1e1d45[_0xd118('0x37')]);_0x11eb95[_0xd118('0x39')]=_['intersection'](_0x11eb95[_0xd118('0x36')],_0x11eb95[_0xd118('0x37')]);_0x4df757['attributes']=_['intersection'](_0x11eb95[_0xd118('0x36')],qs[_0xd118('0x3c')](_0x1e1d45['query'][_0xd118('0x3c')]));_0x4df757[_0xd118('0x3b')]=_0x4df757[_0xd118('0x3b')]['length']?_0x4df757[_0xd118('0x3b')]:_0x11eb95[_0xd118('0x36')];_0x4df757['order']=qs[_0xd118('0x40')](_0x1e1d45[_0xd118('0x37')][_0xd118('0x40')]);_0x4df757[_0xd118('0x41')]=qs[_0xd118('0x39')](_[_0xd118('0x51')](_0x1e1d45['query'],_0x11eb95['filters']));if(_0x1e1d45[_0xd118('0x37')][_0xd118('0x42')]){_0x4df757[_0xd118('0x41')]=_['merge'](_0x4df757[_0xd118('0x41')],{'$or':_[_0xd118('0x30')](_0x4df757[_0xd118('0x3b')],function(_0xc46dbd){var _0x262392={};_0x262392[_0xc46dbd]={'$like':'%'+_0x1e1d45[_0xd118('0x37')][_0xd118('0x42')]+'%'};return _0x262392;})});}_0x4df757=_[_0xd118('0x43')]({},_0x4df757,_0x1e1d45[_0xd118('0x4b')]);return _0x581a15[_0xd118('0x4f')](_0x4df757);}})[_0xd118('0x29')](function(_0x3af0be){if(_0x3af0be){_0x317b72=_0x3af0be[_0xd118('0x3d')];if(!_0x1e1d45['query'][_0xd118('0x3e')]('nolimit')){_0x4df757['limit']=qs[_0xd118('0x23')](_0x1e1d45[_0xd118('0x37')][_0xd118('0x23')]);_0x4df757[_0xd118('0x21')]=qs['offset'](_0x1e1d45['query']['offset']);}return _0x581a15[_0xd118('0x4f')](_0x4df757);}})[_0xd118('0x29')](function(_0x2d081a){if(_0x2d081a){return _0x2d081a?{'count':_0x317b72,'rows':_0x2d081a}:null;}})[_0xd118('0x29')](respondWithResult(_0x1d0939,null))[_0xd118('0x48')](handleError(_0x1d0939,null));};exports[_0xd118('0x52')]=function(_0x571374,_0x1a014c,_0x18309b){if(_0x571374[_0xd118('0x4e')]['id']){delete _0x571374[_0xd118('0x4e')]['id'];}return db[_0xd118('0x31')][_0xd118('0x53')]({'where':{'id':_0x571374[_0xd118('0x4a')]['id']}})[_0xd118('0x29')](handleEntityNotFound(_0x1a014c,null))['then'](function(_0x1200c2){if(_0x1200c2){_0x571374[_0xd118('0x4e')][_0xd118('0x54')]=_0x1200c2['id'];_0x571374[_0xd118('0x4e')][_0xd118('0x55')]=integrations[_0xd118('0x56')](_0x571374[_0xd118('0x4e')][_0xd118('0x57')],_0x571374['body'][_0xd118('0x34')]);_0x571374[_0xd118('0x4e')][_0xd118('0x58')]=integrations[_0xd118('0x59')](_0x571374[_0xd118('0x4e')][_0xd118('0x57')],_0x571374[_0xd118('0x4e')][_0xd118('0x34')]);return db[_0xd118('0x50')][_0xd118('0x4d')](_0x571374['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xd118('0x55')},{'model':db[_0xd118('0x5a')],'as':'Descriptions'}]});}return null;})[_0xd118('0x29')](respondWithResult(_0x1a014c,null))['catch'](handleError(_0x1a014c,null));};exports[_0xd118('0x5b')]=function(_0x4103b6,_0x155dd6,_0x4aa04a){var _0x9f92f3='';var _0x20208b='';return db[_0xd118('0x31')][_0xd118('0x53')]({'where':{'id':_0x4103b6[_0xd118('0x4a')]['id']},'attributes':['id','username',_0xd118('0x5c'),_0xd118('0x5d')]})[_0xd118('0x29')](handleEntityNotFound(_0x155dd6,null))[_0xd118('0x29')](function(_0x51521f){if(_0x51521f){_0x20208b=_0x51521f[_0xd118('0x5e')];_0x9f92f3=_0x51521f[_0xd118('0x5c')];var _0xede063=_0x51521f[_0xd118('0x5c')]['slice'](-0x1);if(_0xede063==='/'){_0x9f92f3=_0x9f92f3[_0xd118('0x5f')](0x0,_0x9f92f3['lastIndexOf'](_0xede063));}return rp({'method':_0xd118('0x60'),'uri':util[_0xd118('0x61')](_0xd118('0x62'),_0x9f92f3,'/api/selector/owners'),'headers':{'Authorization':_0xd118('0x63')+_0x51521f[_0xd118('0x5d')]},'json':!![]});}})[_0xd118('0x29')](function(_0x157d16){if(_0x157d16){var _0x2df361=_0x157d16[_0xd118('0x64')];var _0x2048b0=![];var _0x116d8d=null;for(_0x116d8d=0x0;_0x116d8d<_0x2df361[_0xd118('0x3d')];_0x116d8d++){if(_0x2df361[_0x116d8d][_0xd118('0x65')]===_0x20208b){_0x2048b0=!![];}}if(_0x2048b0){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xd118('0x29')](respondWithResult(_0x155dd6,null))['catch'](function(_0x2fb2fe){var _0x3d42f=_0x4103b6[_0xd118('0x37')]['test']?0x1f4:_0x2fb2fe[_0xd118('0x66')]||0x1f4;logger['error'](_0xd118('0x67'),_0xd118('0x5b'),_0x3d42f,JSON['stringify'](_0x2fb2fe));delete _0x2fb2fe[_0xd118('0x2d')];if(_0x3d42f===0x191){_0x3d42f=0x190;}_0x155dd6['status'](_0x3d42f)[_0xd118('0x2e')](_0x4103b6[_0xd118('0x37')]['test']?{'message':_0xd118('0x68'),'statusCode':_0x2fb2fe[_0xd118('0x66')]}:_0x2fb2fe);});}; \ No newline at end of file +var _0xc730=['../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','getConfigurations','FreshsalesConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','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','../../config/license/util'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0xc730,0xba));var _0x0c73=function(_0x4f7da9,_0x2cb723){_0x4f7da9=_0x4f7da9-0x0;var _0x500d39=_0xc730[_0x4f7da9];return _0x500d39;};'use strict';var emlformat=require(_0x0c73('0x0'));var rimraf=require(_0x0c73('0x1'));var zipdir=require(_0x0c73('0x2'));var jsonpatch=require(_0x0c73('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0c73('0x4'));var Mustache=require(_0x0c73('0x5'));var util=require(_0x0c73('0x6'));var path=require('path');var sox=require(_0x0c73('0x7'));var csv=require(_0x0c73('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c73('0x9'));var _=require(_0x0c73('0xa'));var squel=require(_0x0c73('0xb'));var crypto=require(_0x0c73('0xc'));var jsforce=require(_0x0c73('0xd'));var deskjs=require(_0x0c73('0xe'));var toCsv=require(_0x0c73('0x8'));var querystring=require(_0x0c73('0xf'));var Papa=require(_0x0c73('0x10'));var Redis=require(_0x0c73('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0c73('0x12'));var as=require(_0x0c73('0x13'));var hardwareService=require(_0x0c73('0x14'));var logger=require(_0x0c73('0x15'))(_0x0c73('0x16'));var utils=require(_0x0c73('0x17'));var config=require(_0x0c73('0x18'));var licenseUtil=require(_0x0c73('0x19'));var db=require(_0x0c73('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xcb3e6f,_0x80ade1){_0x80ade1=_0x80ade1||0xcc;return function(_0x5c4935){if(_0x5c4935){return _0xcb3e6f[_0x0c73('0x1b')](_0x80ade1);}return _0xcb3e6f[_0x0c73('0x1c')](_0x80ade1)['end']();};}function respondWithResult(_0x4af531,_0x1e7b42){_0x1e7b42=_0x1e7b42||0xc8;return function(_0x2b16a7){if(_0x2b16a7){return _0x4af531[_0x0c73('0x1c')](_0x1e7b42)['json'](_0x2b16a7);}};}function respondWithFilteredResult(_0x737393,_0x30df45){return function(_0x2fa587){if(_0x2fa587){var _0xdfe643=typeof _0x30df45[_0x0c73('0x1d')]===_0x0c73('0x1e')&&typeof _0x30df45[_0x0c73('0x1f')]===_0x0c73('0x1e');var _0x37a73e=_0x2fa587[_0x0c73('0x20')];var _0x2de653=_0xdfe643?0x0:_0x30df45[_0x0c73('0x1d')];var _0x115896=_0xdfe643?_0x2fa587[_0x0c73('0x20')]:_0x30df45[_0x0c73('0x1d')]+_0x30df45['limit'];var _0x5af00e;if(_0x115896>=_0x37a73e){_0x115896=_0x37a73e;_0x5af00e=0xc8;}else{_0x5af00e=0xce;}_0x737393['status'](_0x5af00e);return _0x737393[_0x0c73('0x21')](_0x0c73('0x22'),_0x2de653+'-'+_0x115896+'/'+_0x37a73e)[_0x0c73('0x23')](_0x2fa587);}return null;};}function patchUpdates(_0x51c51c){return function(_0x1742e3){try{jsonpatch['apply'](_0x1742e3,_0x51c51c,!![]);}catch(_0x182c5b){return BPromise[_0x0c73('0x24')](_0x182c5b);}return _0x1742e3['save']();};}function saveUpdates(_0x2c480d,_0x2f2f54){return function(_0x3fbf1c){if(_0x3fbf1c){return _0x3fbf1c[_0x0c73('0x25')](_0x2c480d)[_0x0c73('0x26')](function(_0x13a618){return _0x13a618;});}return null;};}function removeEntity(_0x4373b2,_0x1a8865){return function(_0x3d992f){if(_0x3d992f){return _0x3d992f[_0x0c73('0x27')]()[_0x0c73('0x26')](function(){_0x4373b2[_0x0c73('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ecd78,_0x4c6767){return function(_0x18b661){if(!_0x18b661){_0x9ecd78[_0x0c73('0x1b')](0x194);}return _0x18b661;};}function handleError(_0x5d758e,_0xf33445){_0xf33445=_0xf33445||0x1f4;return function(_0x69406c){logger[_0x0c73('0x28')](_0x69406c[_0x0c73('0x29')]);if(_0x69406c['name']){delete _0x69406c[_0x0c73('0x2a')];}_0x5d758e['status'](_0xf33445)[_0x0c73('0x2b')](_0x69406c);};}exports[_0x0c73('0x2c')]=function(_0x400ac2,_0x32d7cf){var _0x4e8351={},_0x4a4432={},_0x3dda35={'count':0x0,'rows':[]};var _0x5b9f03=_[_0x0c73('0x2d')](db[_0x0c73('0x2e')]['rawAttributes'],function(_0x56996f){return{'name':_0x56996f[_0x0c73('0x2f')],'type':_0x56996f[_0x0c73('0x30')][_0x0c73('0x31')]};});_0x4a4432['model']=_[_0x0c73('0x2d')](_0x5b9f03,_0x0c73('0x2a'));_0x4a4432['query']=_[_0x0c73('0x32')](_0x400ac2[_0x0c73('0x33')]);_0x4a4432[_0x0c73('0x34')]=_[_0x0c73('0x35')](_0x4a4432[_0x0c73('0x36')],_0x4a4432[_0x0c73('0x33')]);_0x4e8351[_0x0c73('0x37')]=_[_0x0c73('0x35')](_0x4a4432[_0x0c73('0x36')],qs[_0x0c73('0x38')](_0x400ac2[_0x0c73('0x33')][_0x0c73('0x38')]));_0x4e8351[_0x0c73('0x37')]=_0x4e8351[_0x0c73('0x37')][_0x0c73('0x39')]?_0x4e8351[_0x0c73('0x37')]:_0x4a4432[_0x0c73('0x36')];if(!_0x400ac2[_0x0c73('0x33')][_0x0c73('0x3a')](_0x0c73('0x3b'))){_0x4e8351['limit']=qs['limit'](_0x400ac2[_0x0c73('0x33')][_0x0c73('0x1f')]);_0x4e8351[_0x0c73('0x1d')]=qs[_0x0c73('0x1d')](_0x400ac2[_0x0c73('0x33')][_0x0c73('0x1d')]);}_0x4e8351[_0x0c73('0x3c')]=qs[_0x0c73('0x3d')](_0x400ac2[_0x0c73('0x33')][_0x0c73('0x3d')]);_0x4e8351['where']=qs[_0x0c73('0x34')](_[_0x0c73('0x3e')](_0x400ac2['query'],_0x4a4432[_0x0c73('0x34')]),_0x5b9f03);if(_0x400ac2[_0x0c73('0x33')][_0x0c73('0x3f')]){_0x4e8351[_0x0c73('0x40')]=_[_0x0c73('0x41')](_0x4e8351[_0x0c73('0x40')],{'$or':_[_0x0c73('0x2d')](_0x5b9f03,function(_0x58d117){if(_0x58d117['type']!==_0x0c73('0x42')){var _0x17f43b={};_0x17f43b[_0x58d117['name']]={'$like':'%'+_0x400ac2[_0x0c73('0x33')]['filter']+'%'};return _0x17f43b;}})});}_0x4e8351=_[_0x0c73('0x41')]({},_0x4e8351,_0x400ac2[_0x0c73('0x43')]);var _0x3c4c47={'where':_0x4e8351[_0x0c73('0x40')]};return db['FreshsalesAccount'][_0x0c73('0x20')](_0x3c4c47)[_0x0c73('0x26')](function(_0x31134a){_0x3dda35['count']=_0x31134a;if(_0x400ac2[_0x0c73('0x33')][_0x0c73('0x44')]){_0x4e8351[_0x0c73('0x45')]=[{'all':!![]}];}return db[_0x0c73('0x2e')][_0x0c73('0x46')](_0x4e8351);})[_0x0c73('0x26')](function(_0x1b43ab){_0x3dda35[_0x0c73('0x47')]=_0x1b43ab;return _0x3dda35;})[_0x0c73('0x26')](respondWithFilteredResult(_0x32d7cf,_0x4e8351))[_0x0c73('0x48')](handleError(_0x32d7cf,null));};exports[_0x0c73('0x49')]=function(_0x5032e1,_0x52bfd8){var _0x31a4d9={'raw':![],'where':{'id':_0x5032e1['params']['id']}},_0x4da9ef={};_0x4da9ef[_0x0c73('0x36')]=_[_0x0c73('0x32')](db['FreshsalesAccount'][_0x0c73('0x4a')]);_0x4da9ef[_0x0c73('0x33')]=_[_0x0c73('0x32')](_0x5032e1[_0x0c73('0x33')]);_0x4da9ef[_0x0c73('0x34')]=_[_0x0c73('0x35')](_0x4da9ef[_0x0c73('0x36')],_0x4da9ef[_0x0c73('0x33')]);_0x31a4d9[_0x0c73('0x37')]=_[_0x0c73('0x35')](_0x4da9ef['model'],qs['fields'](_0x5032e1[_0x0c73('0x33')][_0x0c73('0x38')]));_0x31a4d9[_0x0c73('0x37')]=_0x31a4d9['attributes'][_0x0c73('0x39')]?_0x31a4d9[_0x0c73('0x37')]:_0x4da9ef['model'];if(_0x5032e1[_0x0c73('0x33')]['includeAll']){_0x31a4d9[_0x0c73('0x45')]=[{'all':!![]}];}_0x31a4d9=_['merge']({},_0x31a4d9,_0x5032e1[_0x0c73('0x43')]);return db[_0x0c73('0x2e')]['find'](_0x31a4d9)[_0x0c73('0x26')](handleEntityNotFound(_0x52bfd8,null))[_0x0c73('0x26')](respondWithResult(_0x52bfd8,null))[_0x0c73('0x48')](handleError(_0x52bfd8,null));};exports[_0x0c73('0x4b')]=function(_0x5bb765,_0xbdf0ee){return db['FreshsalesAccount'][_0x0c73('0x4b')](_0x5bb765['body'],{})['then'](respondWithResult(_0xbdf0ee,0xc9))['catch'](handleError(_0xbdf0ee,null));};exports[_0x0c73('0x25')]=function(_0x439016,_0x1653fa){if(_0x439016['body']['id']){delete _0x439016[_0x0c73('0x4c')]['id'];}return db[_0x0c73('0x2e')][_0x0c73('0x4d')]({'where':{'id':_0x439016['params']['id']}})[_0x0c73('0x26')](handleEntityNotFound(_0x1653fa,null))['then'](saveUpdates(_0x439016['body'],null))[_0x0c73('0x26')](respondWithResult(_0x1653fa,null))['catch'](handleError(_0x1653fa,null));};exports[_0x0c73('0x27')]=function(_0x13afb7,_0x3839d9){return db[_0x0c73('0x2e')][_0x0c73('0x4d')]({'where':{'id':_0x13afb7[_0x0c73('0x4e')]['id']}})[_0x0c73('0x26')](handleEntityNotFound(_0x3839d9,null))[_0x0c73('0x26')](removeEntity(_0x3839d9,null))[_0x0c73('0x48')](handleError(_0x3839d9,null));};exports[_0x0c73('0x4f')]=function(_0x4f4187,_0x530780,_0x5a5927){var _0x9d1149={};var _0x57464e={};var _0x3a68d1;var _0xfb509b;return db[_0x0c73('0x2e')]['findOne']({'where':{'id':_0x4f4187[_0x0c73('0x4e')]['id']}})[_0x0c73('0x26')](handleEntityNotFound(_0x530780,null))[_0x0c73('0x26')](function(_0x5d890f){if(_0x5d890f){_0x3a68d1=_0x5d890f;_0x57464e[_0x0c73('0x36')]=_[_0x0c73('0x32')](db[_0x0c73('0x50')][_0x0c73('0x4a')]);_0x57464e[_0x0c73('0x33')]=_[_0x0c73('0x32')](_0x4f4187['query']);_0x57464e['filters']=_[_0x0c73('0x35')](_0x57464e['model'],_0x57464e[_0x0c73('0x33')]);_0x9d1149[_0x0c73('0x37')]=_[_0x0c73('0x35')](_0x57464e[_0x0c73('0x36')],qs['fields'](_0x4f4187[_0x0c73('0x33')]['fields']));_0x9d1149[_0x0c73('0x37')]=_0x9d1149[_0x0c73('0x37')]['length']?_0x9d1149[_0x0c73('0x37')]:_0x57464e['model'];_0x9d1149['order']=qs['sort'](_0x4f4187[_0x0c73('0x33')]['sort']);_0x9d1149[_0x0c73('0x40')]=qs[_0x0c73('0x34')](_[_0x0c73('0x3e')](_0x4f4187['query'],_0x57464e['filters']));if(_0x4f4187[_0x0c73('0x33')][_0x0c73('0x3f')]){_0x9d1149[_0x0c73('0x40')]=_[_0x0c73('0x41')](_0x9d1149[_0x0c73('0x40')],{'$or':_[_0x0c73('0x2d')](_0x9d1149['attributes'],function(_0xcca2fb){var _0x4a5e12={};_0x4a5e12[_0xcca2fb]={'$like':'%'+_0x4f4187[_0x0c73('0x33')][_0x0c73('0x3f')]+'%'};return _0x4a5e12;})});}_0x9d1149=_[_0x0c73('0x41')]({},_0x9d1149,_0x4f4187[_0x0c73('0x43')]);return _0x3a68d1['getConfigurations'](_0x9d1149);}})[_0x0c73('0x26')](function(_0x19bbd1){if(_0x19bbd1){_0xfb509b=_0x19bbd1[_0x0c73('0x39')];if(!_0x4f4187[_0x0c73('0x33')][_0x0c73('0x3a')](_0x0c73('0x3b'))){_0x9d1149['limit']=qs['limit'](_0x4f4187[_0x0c73('0x33')][_0x0c73('0x1f')]);_0x9d1149['offset']=qs[_0x0c73('0x1d')](_0x4f4187[_0x0c73('0x33')][_0x0c73('0x1d')]);}return _0x3a68d1['getConfigurations'](_0x9d1149);}})[_0x0c73('0x26')](function(_0x499e28){if(_0x499e28){return _0x499e28?{'count':_0xfb509b,'rows':_0x499e28}:null;}})[_0x0c73('0x26')](respondWithResult(_0x530780,null))['catch'](handleError(_0x530780,null));};exports['addConfiguration']=function(_0x265c18,_0xc5566f,_0x2cef53){if(_0x265c18[_0x0c73('0x4c')]['id']){delete _0x265c18[_0x0c73('0x4c')]['id'];}return db[_0x0c73('0x2e')][_0x0c73('0x51')]({'where':{'id':_0x265c18['params']['id']}})[_0x0c73('0x26')](handleEntityNotFound(_0xc5566f,null))[_0x0c73('0x26')](function(_0xd55883){if(_0xd55883){_0x265c18[_0x0c73('0x4c')][_0x0c73('0x52')]=_0xd55883['id'];_0x265c18[_0x0c73('0x4c')][_0x0c73('0x53')]=integrations['getSubjects'](_0x265c18[_0x0c73('0x4c')][_0x0c73('0x54')],_0x265c18[_0x0c73('0x4c')][_0x0c73('0x30')]);_0x265c18[_0x0c73('0x4c')][_0x0c73('0x55')]=integrations[_0x0c73('0x56')](_0x265c18[_0x0c73('0x4c')][_0x0c73('0x54')],_0x265c18[_0x0c73('0x4c')][_0x0c73('0x30')]);return db[_0x0c73('0x50')][_0x0c73('0x4b')](_0x265c18[_0x0c73('0x4c')],{'include':[{'model':db[_0x0c73('0x57')],'as':_0x0c73('0x53')},{'model':db[_0x0c73('0x57')],'as':_0x0c73('0x55')}]});}return null;})['then'](respondWithResult(_0xc5566f,null))[_0x0c73('0x48')](handleError(_0xc5566f,null));};exports[_0x0c73('0x58')]=function(_0x23c6de,_0x91a092,_0x1e67ce){var _0x35b9d3='';var _0x2f9c2d='';return db[_0x0c73('0x2e')][_0x0c73('0x51')]({'where':{'id':_0x23c6de[_0x0c73('0x4e')]['id']},'attributes':['id','username',_0x0c73('0x59'),_0x0c73('0x5a')]})[_0x0c73('0x26')](handleEntityNotFound(_0x91a092,null))[_0x0c73('0x26')](function(_0x2f0e4d){if(_0x2f0e4d){_0x2f9c2d=_0x2f0e4d[_0x0c73('0x5b')];_0x35b9d3=_0x2f0e4d[_0x0c73('0x59')];var _0x307eb1=_0x2f0e4d[_0x0c73('0x59')][_0x0c73('0x5c')](-0x1);if(_0x307eb1==='/'){_0x35b9d3=_0x35b9d3[_0x0c73('0x5d')](0x0,_0x35b9d3[_0x0c73('0x5e')](_0x307eb1));}return rp({'method':_0x0c73('0x5f'),'uri':util[_0x0c73('0x60')](_0x0c73('0x61'),_0x35b9d3,_0x0c73('0x62')),'headers':{'Authorization':_0x0c73('0x63')+_0x2f0e4d[_0x0c73('0x5a')]},'json':!![]});}})['then'](function(_0x2deffa){if(_0x2deffa){var _0x467e53=_0x2deffa[_0x0c73('0x64')];var _0x15f489=![];var _0x1d4c6d=null;for(_0x1d4c6d=0x0;_0x1d4c6d<_0x467e53[_0x0c73('0x39')];_0x1d4c6d++){if(_0x467e53[_0x1d4c6d][_0x0c73('0x65')]===_0x2f9c2d){_0x15f489=!![];}}if(_0x15f489){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0c73('0x66')});}}})[_0x0c73('0x26')](respondWithResult(_0x91a092,null))[_0x0c73('0x48')](function(_0x52688e){var _0x14412e=_0x23c6de['query']['test']?0x1f4:_0x52688e[_0x0c73('0x67')]||0x1f4;logger['error'](_0x0c73('0x68'),_0x0c73('0x58'),_0x14412e,JSON['stringify'](_0x52688e));delete _0x52688e['name'];if(_0x14412e===0x191){_0x14412e=0x190;}_0x91a092[_0x0c73('0x1c')](_0x14412e)[_0x0c73('0x2b')](_0x23c6de[_0x0c73('0x33')]['test']?{'message':_0x0c73('0x69'),'statusCode':_0x52688e[_0x0c73('0x67')]}:_0x52688e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a3a00ad..6ffc418 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd101=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api'];(function(_0x27d57d,_0xc346ac){var _0x507661=function(_0x59105b){while(--_0x59105b){_0x27d57d['push'](_0x27d57d['shift']());}};_0x507661(++_0xc346ac);}(_0xd101,0xc1));var _0x1d10=function(_0xbb5c0e,_0x4b388f){_0xbb5c0e=_0xbb5c0e-0x0;var _0x1ed9d8=_0xd101[_0xbb5c0e];return _0x1ed9d8;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x1d10('0x9'));module[_0x1d10('0xa')]=function(_0x2a4e2d,_0x27d569){return _0x2a4e2d[_0x1d10('0xb')](_0x1d10('0xc'),attributes,{'tableName':_0x1d10('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x19886f,_0x1019d1){var _0x4c0144=function(_0x31855b){while(--_0x31855b){_0x19886f['push'](_0x19886f['shift']());}};_0x4c0144(++_0x1019d1);}(_0x524e,0x15e));var _0xe524=function(_0x49e45f,_0x36ca17){_0x49e45f=_0x49e45f-0x0;var _0x218400=_0x524e[_0x49e45f];return _0x218400;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));var integrations=require(_0xe524('0x9'));module['exports']=function(_0xaaeaa9,_0x41e1a3){return _0xaaeaa9[_0xe524('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xe524('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 46ca7f3..8aefc8e 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32b6=['raw','where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','GetFreshsalesAccount','FreshsalesAccount','findAll','options'];(function(_0x1c26c0,_0x11fb6a){var _0x530a7a=function(_0x2844cb){while(--_0x2844cb){_0x1c26c0['push'](_0x1c26c0['shift']());}};_0x530a7a(++_0x11fb6a);}(_0x32b6,0x1d1));var _0x632b=function(_0x54de52,_0x1ad124){_0x54de52=_0x54de52-0x0;var _0x3c0633=_0x32b6[_0x54de52];return _0x3c0633;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')]({'raw':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x19')]===undefined?!![]:![]:!![],'where':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x1a')]||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f['options'][_0x632b('0x1b')]||null:null,'limit':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x18')][_0x632b('0x1c')]||null:null,'include':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x3bb27f['options'][_0x632b('0x1d')],function(_0x379dc2){return{'model':db[_0x379dc2[_0x632b('0x1f')]],'as':_0x379dc2['as'],'attributes':_0x379dc2[_0x632b('0x1b')],'include':_0x379dc2[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x379dc2['include'],function(_0x5e7b20){return{'model':db[_0x5e7b20[_0x632b('0x1f')]],'as':_0x5e7b20['as'],'attributes':_0x5e7b20['attributes'],'include':_0x5e7b20[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x5e7b20['include'],function(_0x273e89){return{'model':db[_0x273e89[_0x632b('0x1f')]],'as':_0x273e89['as'],'attributes':_0x273e89[_0x632b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x632b('0xc')](function(_0x4728a8){logger[_0x632b('0x14')](_0x632b('0x15'),_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON['stringify'](_0x4728a8));_0x51c894(_0x4728a8);})[_0x632b('0x20')](function(_0x35348e){logger[_0x632b('0x10')](_0x632b('0x15'),_0x35348e[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x35348e[_0x632b('0x13')]));});});};exports[_0x632b('0x21')]=function(_0x1ace1b){var _0x319df3=this;return new Promise(function(_0x417793,_0x35584f){return db[_0x632b('0x16')][_0x632b('0x22')]({'raw':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')][_0x632b('0x19')]===undefined?!![]:![]:!![],'where':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')][_0x632b('0x1a')]||null:null,'attributes':_0x1ace1b['options']?_0x1ace1b[_0x632b('0x18')][_0x632b('0x1b')]||null:null,'include':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')]['include']?_[_0x632b('0x1e')](_0x1ace1b['options'][_0x632b('0x1d')],function(_0x15b22d){return{'model':db[_0x15b22d['model']],'as':_0x15b22d['as'],'attributes':_0x15b22d[_0x632b('0x1b')],'include':_0x15b22d[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x15b22d[_0x632b('0x1d')],function(_0x27bbf5){return{'model':db[_0x27bbf5[_0x632b('0x1f')]],'as':_0x27bbf5['as'],'attributes':_0x27bbf5[_0x632b('0x1b')],'include':_0x27bbf5[_0x632b('0x1d')]?_['map'](_0x27bbf5['include'],function(_0x22ae6a){return{'model':db[_0x22ae6a[_0x632b('0x1f')]],'as':_0x22ae6a['as'],'attributes':_0x22ae6a[_0x632b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x632b('0xc')](function(_0x384420){logger[_0x632b('0x14')](_0x632b('0x21'),_0x1ace1b);logger[_0x632b('0xd')]('ShowFreshsalesAccount',_0x1ace1b,JSON['stringify'](_0x384420));_0x417793(_0x384420);})[_0x632b('0x20')](function(_0x581b92){logger[_0x632b('0x10')](_0x632b('0x21'),_0x581b92[_0x632b('0x13')],_0x1ace1b);_0x35584f(_0x319df3[_0x632b('0x10')](0x1f4,_0x581b92[_0x632b('0x13')]));});});}; \ No newline at end of file +var _0x0598=['map','model','then','ShowFreshsalesAccount','find','where','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include'];(function(_0x4e2cae,_0x28b0f7){var _0x23b147=function(_0x5db252){while(--_0x5db252){_0x4e2cae['push'](_0x4e2cae['shift']());}};_0x23b147(++_0x28b0f7);}(_0x0598,0x92));var _0x8059=function(_0x2dd164,_0x3a021b){_0x2dd164=_0x2dd164-0x0;var _0x64390b=_0x0598[_0x2dd164];return _0x64390b;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['findAll']({'raw':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55['options'][_0x8059('0x12')]===undefined?!![]:![]:!![],'where':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x11')]['where']||null:null,'attributes':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55[_0x8059('0x11')][_0x8059('0x13')]||null:null,'limit':_0x4b6d55['options']?_0x4b6d55['options'][_0x8059('0x14')]||null:null,'include':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55[_0x8059('0x11')][_0x8059('0x15')]?_['map'](_0x4b6d55[_0x8059('0x11')][_0x8059('0x15')],function(_0x3da080){return{'model':db[_0x3da080['model']],'as':_0x3da080['as'],'attributes':_0x3da080[_0x8059('0x13')],'include':_0x3da080[_0x8059('0x15')]?_[_0x8059('0x16')](_0x3da080[_0x8059('0x15')],function(_0x59d3a6){return{'model':db[_0x59d3a6[_0x8059('0x17')]],'as':_0x59d3a6['as'],'attributes':_0x59d3a6[_0x8059('0x13')],'include':_0x59d3a6[_0x8059('0x15')]?_[_0x8059('0x16')](_0x59d3a6[_0x8059('0x15')],function(_0x54b88b){return{'model':db[_0x54b88b[_0x8059('0x17')]],'as':_0x54b88b['as'],'attributes':_0x54b88b[_0x8059('0x13')]};}):[]};}):[]};}):[]:[]})[_0x8059('0x18')](function(_0x4a294f){logger['info']('GetFreshsalesAccount',_0x4b6d55);logger[_0x8059('0xa')](_0x8059('0xf'),_0x4b6d55,JSON[_0x8059('0xb')](_0x4a294f));_0x2bb670(_0x4a294f);})[_0x8059('0xe')](function(_0x59abe9){logger[_0x8059('0xc')]('GetFreshsalesAccount',_0x59abe9[_0x8059('0xd')],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x59abe9['message']));});});};exports[_0x8059('0x19')]=function(_0x1aead2){var _0x30aac2=this;return new Promise(function(_0x260ba8,_0x2799b7){return db[_0x8059('0x10')][_0x8059('0x1a')]({'raw':_0x1aead2[_0x8059('0x11')]?_0x1aead2['options'][_0x8059('0x12')]===undefined?!![]:![]:!![],'where':_0x1aead2[_0x8059('0x11')]?_0x1aead2[_0x8059('0x11')][_0x8059('0x1b')]||null:null,'attributes':_0x1aead2[_0x8059('0x11')]?_0x1aead2['options'][_0x8059('0x13')]||null:null,'include':_0x1aead2[_0x8059('0x11')]?_0x1aead2[_0x8059('0x11')][_0x8059('0x15')]?_[_0x8059('0x16')](_0x1aead2[_0x8059('0x11')][_0x8059('0x15')],function(_0x175d57){return{'model':db[_0x175d57[_0x8059('0x17')]],'as':_0x175d57['as'],'attributes':_0x175d57[_0x8059('0x13')],'include':_0x175d57['include']?_[_0x8059('0x16')](_0x175d57['include'],function(_0x24194d){return{'model':db[_0x24194d['model']],'as':_0x24194d['as'],'attributes':_0x24194d['attributes'],'include':_0x24194d[_0x8059('0x15')]?_['map'](_0x24194d[_0x8059('0x15')],function(_0x50c745){return{'model':db[_0x50c745[_0x8059('0x17')]],'as':_0x50c745['as'],'attributes':_0x50c745['attributes']};}):[]};}):[]};}):[]:[]})[_0x8059('0x18')](function(_0x5c4aa0){logger['info'](_0x8059('0x19'),_0x1aead2);logger[_0x8059('0xa')](_0x8059('0x19'),_0x1aead2,JSON['stringify'](_0x5c4aa0));_0x260ba8(_0x5c4aa0);})[_0x8059('0xe')](function(_0x4927c9){logger[_0x8059('0xc')]('ShowFreshsalesAccount',_0x4927c9[_0x8059('0xd')],_0x1aead2);_0x2799b7(_0x30aac2[_0x8059('0xc')](0x1f4,_0x4927c9[_0x8059('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e62af97..d721b62 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ae7=['getDescriptions','/:id/fields','getFields','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6ae7,0x1e8));var _0x76ae=function(_0x5b37dc,_0x22564a){_0x5b37dc=_0x5b37dc-0x0;var _0x2a098d=_0x6ae7[_0x5b37dc];return _0x2a098d;};'use strict';var multer=require(_0x76ae('0x0'));var util=require(_0x76ae('0x1'));var path=require(_0x76ae('0x2'));var timeout=require(_0x76ae('0x3'));var express=require(_0x76ae('0x4'));var router=express[_0x76ae('0x5')]();var fs_extra=require(_0x76ae('0x6'));var auth=require(_0x76ae('0x7'));var interaction=require(_0x76ae('0x8'));var config=require(_0x76ae('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x76ae('0xa')]('/',auth[_0x76ae('0xb')](),controller[_0x76ae('0xc')]);router[_0x76ae('0xa')](_0x76ae('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x76ae('0xe'),auth[_0x76ae('0xb')](),controller[_0x76ae('0xf')]);router['get']('/:id/descriptions',auth[_0x76ae('0xb')](),controller[_0x76ae('0x10')]);router['get'](_0x76ae('0x11'),auth[_0x76ae('0xb')](),controller[_0x76ae('0x12')]);router[_0x76ae('0x13')]('/',auth[_0x76ae('0xb')](),controller[_0x76ae('0x14')]);router[_0x76ae('0x15')](_0x76ae('0xd'),auth[_0x76ae('0xb')](),controller['update']);router['delete'](_0x76ae('0xd'),auth['isAuthenticated'](),controller[_0x76ae('0x16')]);module[_0x76ae('0x17')]=router; \ No newline at end of file +var _0xe18e=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','destroy','exports'];(function(_0x36d1bb,_0x516daa){var _0x451817=function(_0x570619){while(--_0x570619){_0x36d1bb['push'](_0x36d1bb['shift']());}};_0x451817(++_0x516daa);}(_0xe18e,0xa8));var _0xee18=function(_0x1c3597,_0x2be082){_0x1c3597=_0x1c3597-0x0;var _0x491312=_0xe18e[_0x1c3597];return _0x491312;};'use strict';var multer=require(_0xee18('0x0'));var util=require(_0xee18('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee18('0x2'));var router=express[_0xee18('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xee18('0x4'));var interaction=require(_0xee18('0x5'));var config=require('../../config/environment');var controller=require(_0xee18('0x6'));router[_0xee18('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee18('0x7')](_0xee18('0x8'),auth[_0xee18('0x9')](),controller[_0xee18('0xa')]);router[_0xee18('0x7')](_0xee18('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xee18('0x7')](_0xee18('0xc'),auth[_0xee18('0x9')](),controller[_0xee18('0xd')]);router['get'](_0xee18('0xe'),auth['isAuthenticated'](),controller[_0xee18('0xf')]);router[_0xee18('0x10')]('/',auth[_0xee18('0x9')](),controller['create']);router[_0xee18('0x11')](_0xee18('0x8'),auth[_0xee18('0x9')](),controller[_0xee18('0x12')]);router['delete'](_0xee18('0x8'),auth[_0xee18('0x9')](),controller[_0xee18('0x13')]);module[_0xee18('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 75cf0d3..11a9452 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67bc=['exports','STRING','sequelize'];(function(_0x169c33,_0x289691){var _0x4ade27=function(_0x54b08c){while(--_0x54b08c){_0x169c33['push'](_0x169c33['shift']());}};_0x4ade27(++_0x289691);}(_0x67bc,0x11c));var _0xc67b=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x67bc[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xc67b('0x0'));module[_0xc67b('0x1')]={'name':{'type':Sequelize[_0xc67b('0x2')]},'description':{'type':Sequelize[_0xc67b('0x2')]}}; \ No newline at end of file +var _0xfc2e=['STRING','exports'];(function(_0x5b5f9e,_0x289079){var _0x4cd063=function(_0x3df97e){while(--_0x3df97e){_0x5b5f9e['push'](_0x5b5f9e['shift']());}};_0x4cd063(++_0x289079);}(_0xfc2e,0xa3));var _0xefc2=function(_0x3b4ee4,_0x510f6c){_0x3b4ee4=_0x3b4ee4-0x0;var _0x38bf0c=_0xfc2e[_0x3b4ee4];return _0x38bf0c;};'use strict';var Sequelize=require('sequelize');module[_0xefc2('0x0')]={'name':{'type':Sequelize[_0xefc2('0x1')]},'description':{'type':Sequelize[_0xefc2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c0aba81..de71e10 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ebc=['VIRTUAL','options','FreshsalesConfiguration','findAll','rows','catch','show','params','includeAll','find','create','body','getSubjects','findOne','FreshsalesField','rawAttributes','hasOwnProperty','nolimit','getDescriptions','pick','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','order','sort','where','filter','merge'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0ebc,0x161));var _0xc0eb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0ebc[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xc0eb('0x0'));var rimraf=require(_0xc0eb('0x1'));var zipdir=require(_0xc0eb('0x2'));var jsonpatch=require(_0xc0eb('0x3'));var rp=require(_0xc0eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0eb('0x5'));var util=require(_0xc0eb('0x6'));var path=require(_0xc0eb('0x7'));var sox=require(_0xc0eb('0x8'));var csv=require(_0xc0eb('0x9'));var ejs=require(_0xc0eb('0xa'));var fs=require('fs');var fs_extra=require(_0xc0eb('0xb'));var _=require(_0xc0eb('0xc'));var squel=require(_0xc0eb('0xd'));var crypto=require(_0xc0eb('0xe'));var jsforce=require(_0xc0eb('0xf'));var deskjs=require(_0xc0eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc0eb('0x11'));var Papa=require(_0xc0eb('0x12'));var Redis=require('ioredis');var authService=require(_0xc0eb('0x13'));var qs=require(_0xc0eb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0eb('0x15'));var logger=require(_0xc0eb('0x16'))('api');var utils=require(_0xc0eb('0x17'));var config=require(_0xc0eb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0eb('0x19'))['db'];function respondWithStatusCode(_0x5d61e2,_0x1fb21e){_0x1fb21e=_0x1fb21e||0xcc;return function(_0x338615){if(_0x338615){return _0x5d61e2[_0xc0eb('0x1a')](_0x1fb21e);}return _0x5d61e2['status'](_0x1fb21e)['end']();};}function respondWithResult(_0x137e91,_0x21e008){_0x21e008=_0x21e008||0xc8;return function(_0x42a693){if(_0x42a693){return _0x137e91[_0xc0eb('0x1b')](_0x21e008)[_0xc0eb('0x1c')](_0x42a693);}};}function respondWithFilteredResult(_0x5803b8,_0x52fdd7){return function(_0x1f3a0c){if(_0x1f3a0c){var _0x419329=typeof _0x52fdd7[_0xc0eb('0x1d')]===_0xc0eb('0x1e')&&typeof _0x52fdd7[_0xc0eb('0x1f')]===_0xc0eb('0x1e');var _0x5c244=_0x1f3a0c[_0xc0eb('0x20')];var _0x36fa33=_0x419329?0x0:_0x52fdd7[_0xc0eb('0x1d')];var _0x4331c5=_0x419329?_0x1f3a0c[_0xc0eb('0x20')]:_0x52fdd7[_0xc0eb('0x1d')]+_0x52fdd7[_0xc0eb('0x1f')];var _0x153280;if(_0x4331c5>=_0x5c244){_0x4331c5=_0x5c244;_0x153280=0xc8;}else{_0x153280=0xce;}_0x5803b8['status'](_0x153280);return _0x5803b8[_0xc0eb('0x21')](_0xc0eb('0x22'),_0x36fa33+'-'+_0x4331c5+'/'+_0x5c244)[_0xc0eb('0x1c')](_0x1f3a0c);}return null;};}function patchUpdates(_0x6f43ed){return function(_0x42ca2a){try{jsonpatch[_0xc0eb('0x23')](_0x42ca2a,_0x6f43ed,!![]);}catch(_0x3dff40){return BPromise[_0xc0eb('0x24')](_0x3dff40);}return _0x42ca2a['save']();};}function saveUpdates(_0x32f588,_0x16df64){return function(_0xe9052b){if(_0xe9052b){return _0xe9052b[_0xc0eb('0x25')](_0x32f588)[_0xc0eb('0x26')](function(_0x94e95c){return _0x94e95c;});}return null;};}function removeEntity(_0x4c06a9,_0x1a6a8d){return function(_0x2a6a33){if(_0x2a6a33){return _0x2a6a33[_0xc0eb('0x27')]()['then'](function(){_0x4c06a9[_0xc0eb('0x1b')](0xcc)[_0xc0eb('0x28')]();});}};}function handleEntityNotFound(_0x11af61,_0x1ffcb8){return function(_0x5410b0){if(!_0x5410b0){_0x11af61[_0xc0eb('0x1a')](0x194);}return _0x5410b0;};}function handleError(_0x214750,_0x28afd9){_0x28afd9=_0x28afd9||0x1f4;return function(_0x458ccb){logger[_0xc0eb('0x29')](_0x458ccb[_0xc0eb('0x2a')]);if(_0x458ccb[_0xc0eb('0x2b')]){delete _0x458ccb[_0xc0eb('0x2b')];}_0x214750[_0xc0eb('0x1b')](_0x28afd9)[_0xc0eb('0x2c')](_0x458ccb);};}exports[_0xc0eb('0x2d')]=function(_0x1cff0e,_0x2f5ac6){var _0x303605={},_0x540bf8={},_0x294ca6={'count':0x0,'rows':[]};var _0x3f9641=_[_0xc0eb('0x2e')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x1e4f86){return{'name':_0x1e4f86[_0xc0eb('0x2f')],'type':_0x1e4f86[_0xc0eb('0x30')]['key']};});_0x540bf8[_0xc0eb('0x31')]=_[_0xc0eb('0x2e')](_0x3f9641,'name');_0x540bf8['query']=_[_0xc0eb('0x32')](_0x1cff0e['query']);_0x540bf8[_0xc0eb('0x33')]=_[_0xc0eb('0x34')](_0x540bf8[_0xc0eb('0x31')],_0x540bf8[_0xc0eb('0x35')]);_0x303605['attributes']=_[_0xc0eb('0x34')](_0x540bf8[_0xc0eb('0x31')],qs['fields'](_0x1cff0e[_0xc0eb('0x35')][_0xc0eb('0x36')]));_0x303605[_0xc0eb('0x37')]=_0x303605[_0xc0eb('0x37')][_0xc0eb('0x38')]?_0x303605[_0xc0eb('0x37')]:_0x540bf8['model'];if(!_0x1cff0e[_0xc0eb('0x35')]['hasOwnProperty']('nolimit')){_0x303605[_0xc0eb('0x1f')]=qs[_0xc0eb('0x1f')](_0x1cff0e['query'][_0xc0eb('0x1f')]);_0x303605['offset']=qs[_0xc0eb('0x1d')](_0x1cff0e[_0xc0eb('0x35')][_0xc0eb('0x1d')]);}_0x303605[_0xc0eb('0x39')]=qs['sort'](_0x1cff0e[_0xc0eb('0x35')][_0xc0eb('0x3a')]);_0x303605[_0xc0eb('0x3b')]=qs[_0xc0eb('0x33')](_['pick'](_0x1cff0e[_0xc0eb('0x35')],_0x540bf8['filters']),_0x3f9641);if(_0x1cff0e['query'][_0xc0eb('0x3c')]){_0x303605[_0xc0eb('0x3b')]=_[_0xc0eb('0x3d')](_0x303605[_0xc0eb('0x3b')],{'$or':_['map'](_0x3f9641,function(_0x360fe8){if(_0x360fe8[_0xc0eb('0x30')]!==_0xc0eb('0x3e')){var _0x12d7ca={};_0x12d7ca[_0x360fe8['name']]={'$like':'%'+_0x1cff0e[_0xc0eb('0x35')][_0xc0eb('0x3c')]+'%'};return _0x12d7ca;}})});}_0x303605=_[_0xc0eb('0x3d')]({},_0x303605,_0x1cff0e[_0xc0eb('0x3f')]);var _0x3ca07e={'where':_0x303605[_0xc0eb('0x3b')]};return db['FreshsalesConfiguration']['count'](_0x3ca07e)[_0xc0eb('0x26')](function(_0x44b130){_0x294ca6[_0xc0eb('0x20')]=_0x44b130;if(_0x1cff0e['query']['includeAll']){_0x303605['include']=[{'all':!![]}];}return db[_0xc0eb('0x40')][_0xc0eb('0x41')](_0x303605);})[_0xc0eb('0x26')](function(_0x3bda00){_0x294ca6[_0xc0eb('0x42')]=_0x3bda00;return _0x294ca6;})['then'](respondWithFilteredResult(_0x2f5ac6,_0x303605))[_0xc0eb('0x43')](handleError(_0x2f5ac6,null));};exports[_0xc0eb('0x44')]=function(_0x49fba8,_0x39f268){var _0x25de4a={'raw':![],'where':{'id':_0x49fba8[_0xc0eb('0x45')]['id']}},_0x4dbbda={};_0x4dbbda[_0xc0eb('0x31')]=_[_0xc0eb('0x32')](db[_0xc0eb('0x40')]['rawAttributes']);_0x4dbbda[_0xc0eb('0x35')]=_[_0xc0eb('0x32')](_0x49fba8[_0xc0eb('0x35')]);_0x4dbbda[_0xc0eb('0x33')]=_['intersection'](_0x4dbbda[_0xc0eb('0x31')],_0x4dbbda['query']);_0x25de4a['attributes']=_[_0xc0eb('0x34')](_0x4dbbda[_0xc0eb('0x31')],qs['fields'](_0x49fba8[_0xc0eb('0x35')][_0xc0eb('0x36')]));_0x25de4a['attributes']=_0x25de4a[_0xc0eb('0x37')]['length']?_0x25de4a[_0xc0eb('0x37')]:_0x4dbbda['model'];if(_0x49fba8[_0xc0eb('0x35')][_0xc0eb('0x46')]){_0x25de4a['include']=[{'all':!![]}];}_0x25de4a=_['merge']({},_0x25de4a,_0x49fba8['options']);return db[_0xc0eb('0x40')][_0xc0eb('0x47')](_0x25de4a)['then'](handleEntityNotFound(_0x39f268,null))[_0xc0eb('0x26')](respondWithResult(_0x39f268,null))[_0xc0eb('0x43')](handleError(_0x39f268,null));};exports[_0xc0eb('0x48')]=function(_0x2e9a63,_0x24a1f2){return db['FreshsalesConfiguration'][_0xc0eb('0x48')](_0x2e9a63['body'],{})[_0xc0eb('0x26')](respondWithResult(_0x24a1f2,0xc9))[_0xc0eb('0x43')](handleError(_0x24a1f2,null));};exports['update']=function(_0x84d73d,_0x5a9a0e){if(_0x84d73d['body']['id']){delete _0x84d73d[_0xc0eb('0x49')]['id'];}return db['FreshsalesConfiguration'][_0xc0eb('0x47')]({'where':{'id':_0x84d73d[_0xc0eb('0x45')]['id']}})[_0xc0eb('0x26')](handleEntityNotFound(_0x5a9a0e,null))[_0xc0eb('0x26')](saveUpdates(_0x84d73d[_0xc0eb('0x49')],null))[_0xc0eb('0x26')](respondWithResult(_0x5a9a0e,null))['catch'](handleError(_0x5a9a0e,null));};exports[_0xc0eb('0x27')]=function(_0x4064f1,_0xacba33){return db[_0xc0eb('0x40')][_0xc0eb('0x47')]({'where':{'id':_0x4064f1[_0xc0eb('0x45')]['id']}})['then'](handleEntityNotFound(_0xacba33,null))[_0xc0eb('0x26')](removeEntity(_0xacba33,null))[_0xc0eb('0x43')](handleError(_0xacba33,null));};exports[_0xc0eb('0x4a')]=function(_0x6b9807,_0x567300,_0x2edbb6){var _0x2d5a7f={};var _0x23f896={};var _0x257ec6;var _0xa2ef7;return db[_0xc0eb('0x40')][_0xc0eb('0x4b')]({'where':{'id':_0x6b9807['params']['id']}})[_0xc0eb('0x26')](handleEntityNotFound(_0x567300,null))[_0xc0eb('0x26')](function(_0x986b24){if(_0x986b24){_0x257ec6=_0x986b24;_0x23f896[_0xc0eb('0x31')]=_[_0xc0eb('0x32')](db[_0xc0eb('0x4c')][_0xc0eb('0x4d')]);_0x23f896['query']=_['keys'](_0x6b9807[_0xc0eb('0x35')]);_0x23f896[_0xc0eb('0x33')]=_[_0xc0eb('0x34')](_0x23f896[_0xc0eb('0x31')],_0x23f896['query']);_0x2d5a7f['attributes']=_[_0xc0eb('0x34')](_0x23f896[_0xc0eb('0x31')],qs[_0xc0eb('0x36')](_0x6b9807['query'][_0xc0eb('0x36')]));_0x2d5a7f[_0xc0eb('0x37')]=_0x2d5a7f[_0xc0eb('0x37')][_0xc0eb('0x38')]?_0x2d5a7f[_0xc0eb('0x37')]:_0x23f896['model'];_0x2d5a7f[_0xc0eb('0x39')]=qs[_0xc0eb('0x3a')](_0x6b9807['query'][_0xc0eb('0x3a')]);_0x2d5a7f[_0xc0eb('0x3b')]=qs[_0xc0eb('0x33')](_['pick'](_0x6b9807[_0xc0eb('0x35')],_0x23f896[_0xc0eb('0x33')]));if(_0x6b9807[_0xc0eb('0x35')][_0xc0eb('0x3c')]){_0x2d5a7f[_0xc0eb('0x3b')]=_[_0xc0eb('0x3d')](_0x2d5a7f[_0xc0eb('0x3b')],{'$or':_[_0xc0eb('0x2e')](_0x2d5a7f[_0xc0eb('0x37')],function(_0x25d313){var _0x40fab5={};_0x40fab5[_0x25d313]={'$like':'%'+_0x6b9807['query']['filter']+'%'};return _0x40fab5;})});}_0x2d5a7f=_['merge']({},_0x2d5a7f,_0x6b9807[_0xc0eb('0x3f')]);return _0x257ec6[_0xc0eb('0x4a')](_0x2d5a7f);}})[_0xc0eb('0x26')](function(_0x5498a2){if(_0x5498a2){_0xa2ef7=_0x5498a2[_0xc0eb('0x38')];if(!_0x6b9807[_0xc0eb('0x35')][_0xc0eb('0x4e')](_0xc0eb('0x4f'))){_0x2d5a7f[_0xc0eb('0x1f')]=qs[_0xc0eb('0x1f')](_0x6b9807[_0xc0eb('0x35')]['limit']);_0x2d5a7f[_0xc0eb('0x1d')]=qs['offset'](_0x6b9807[_0xc0eb('0x35')][_0xc0eb('0x1d')]);}return _0x257ec6[_0xc0eb('0x4a')](_0x2d5a7f);}})[_0xc0eb('0x26')](function(_0x3170fd){if(_0x3170fd){return _0x3170fd?{'count':_0xa2ef7,'rows':_0x3170fd}:null;}})[_0xc0eb('0x26')](respondWithResult(_0x567300,null))['catch'](handleError(_0x567300,null));};exports[_0xc0eb('0x50')]=function(_0x221e32,_0x2b1075,_0x58aeac){var _0x32e39b={};var _0x5cf8ba={};var _0x3956da;var _0x1fe635;return db[_0xc0eb('0x40')]['findOne']({'where':{'id':_0x221e32['params']['id']}})['then'](handleEntityNotFound(_0x2b1075,null))['then'](function(_0x10c04a){if(_0x10c04a){_0x3956da=_0x10c04a;_0x5cf8ba['model']=_[_0xc0eb('0x32')](db[_0xc0eb('0x4c')][_0xc0eb('0x4d')]);_0x5cf8ba['query']=_[_0xc0eb('0x32')](_0x221e32[_0xc0eb('0x35')]);_0x5cf8ba['filters']=_['intersection'](_0x5cf8ba[_0xc0eb('0x31')],_0x5cf8ba['query']);_0x32e39b[_0xc0eb('0x37')]=_[_0xc0eb('0x34')](_0x5cf8ba[_0xc0eb('0x31')],qs[_0xc0eb('0x36')](_0x221e32[_0xc0eb('0x35')][_0xc0eb('0x36')]));_0x32e39b[_0xc0eb('0x37')]=_0x32e39b[_0xc0eb('0x37')][_0xc0eb('0x38')]?_0x32e39b[_0xc0eb('0x37')]:_0x5cf8ba[_0xc0eb('0x31')];_0x32e39b['order']=qs[_0xc0eb('0x3a')](_0x221e32[_0xc0eb('0x35')][_0xc0eb('0x3a')]);_0x32e39b['where']=qs[_0xc0eb('0x33')](_[_0xc0eb('0x51')](_0x221e32[_0xc0eb('0x35')],_0x5cf8ba[_0xc0eb('0x33')]));if(_0x221e32[_0xc0eb('0x35')][_0xc0eb('0x3c')]){_0x32e39b['where']=_[_0xc0eb('0x3d')](_0x32e39b[_0xc0eb('0x3b')],{'$or':_[_0xc0eb('0x2e')](_0x32e39b['attributes'],function(_0x3f551c){var _0x16e0f7={};_0x16e0f7[_0x3f551c]={'$like':'%'+_0x221e32[_0xc0eb('0x35')][_0xc0eb('0x3c')]+'%'};return _0x16e0f7;})});}_0x32e39b=_[_0xc0eb('0x3d')]({},_0x32e39b,_0x221e32[_0xc0eb('0x3f')]);return _0x3956da[_0xc0eb('0x50')](_0x32e39b);}})[_0xc0eb('0x26')](function(_0xaec377){if(_0xaec377){_0x1fe635=_0xaec377['length'];if(!_0x221e32[_0xc0eb('0x35')][_0xc0eb('0x4e')](_0xc0eb('0x4f'))){_0x32e39b[_0xc0eb('0x1f')]=qs['limit'](_0x221e32[_0xc0eb('0x35')]['limit']);_0x32e39b[_0xc0eb('0x1d')]=qs[_0xc0eb('0x1d')](_0x221e32[_0xc0eb('0x35')][_0xc0eb('0x1d')]);}return _0x3956da[_0xc0eb('0x50')](_0x32e39b);}})[_0xc0eb('0x26')](function(_0x22f7b4){if(_0x22f7b4){return _0x22f7b4?{'count':_0x1fe635,'rows':_0x22f7b4}:null;}})[_0xc0eb('0x26')](respondWithResult(_0x2b1075,null))[_0xc0eb('0x43')](handleError(_0x2b1075,null));};exports[_0xc0eb('0x52')]=function(_0x5e55ac,_0x28e59f,_0x27f310){var _0x566bd1={};var _0x24a55d={};var _0x2924df;var _0x245d23;return db[_0xc0eb('0x40')][_0xc0eb('0x4b')]({'where':{'id':_0x5e55ac[_0xc0eb('0x45')]['id']}})[_0xc0eb('0x26')](handleEntityNotFound(_0x28e59f,null))['then'](function(_0x2e2783){if(_0x2e2783){_0x2924df=_0x2e2783;_0x24a55d[_0xc0eb('0x31')]=_['keys'](db['FreshsalesField'][_0xc0eb('0x4d')]);_0x24a55d['query']=_[_0xc0eb('0x32')](_0x5e55ac[_0xc0eb('0x35')]);_0x24a55d[_0xc0eb('0x33')]=_[_0xc0eb('0x34')](_0x24a55d[_0xc0eb('0x31')],_0x24a55d[_0xc0eb('0x35')]);_0x566bd1['attributes']=_[_0xc0eb('0x34')](_0x24a55d[_0xc0eb('0x31')],qs[_0xc0eb('0x36')](_0x5e55ac[_0xc0eb('0x35')][_0xc0eb('0x36')]));_0x566bd1[_0xc0eb('0x37')]=_0x566bd1['attributes'][_0xc0eb('0x38')]?_0x566bd1['attributes']:_0x24a55d[_0xc0eb('0x31')];_0x566bd1['order']=qs[_0xc0eb('0x3a')](_0x5e55ac['query']['sort']);_0x566bd1[_0xc0eb('0x3b')]=qs[_0xc0eb('0x33')](_['pick'](_0x5e55ac[_0xc0eb('0x35')],_0x24a55d[_0xc0eb('0x33')]));if(_0x5e55ac[_0xc0eb('0x35')]['filter']){_0x566bd1[_0xc0eb('0x3b')]=_['merge'](_0x566bd1[_0xc0eb('0x3b')],{'$or':_[_0xc0eb('0x2e')](_0x566bd1['attributes'],function(_0xc1bf43){var _0x3f38bb={};_0x3f38bb[_0xc1bf43]={'$like':'%'+_0x5e55ac[_0xc0eb('0x35')][_0xc0eb('0x3c')]+'%'};return _0x3f38bb;})});}_0x566bd1=_[_0xc0eb('0x3d')]({},_0x566bd1,_0x5e55ac['options']);return _0x2924df[_0xc0eb('0x52')](_0x566bd1);}})['then'](function(_0x142a14){if(_0x142a14){_0x245d23=_0x142a14[_0xc0eb('0x38')];if(!_0x5e55ac['query']['hasOwnProperty'](_0xc0eb('0x4f'))){_0x566bd1[_0xc0eb('0x1f')]=qs[_0xc0eb('0x1f')](_0x5e55ac[_0xc0eb('0x35')]['limit']);_0x566bd1[_0xc0eb('0x1d')]=qs[_0xc0eb('0x1d')](_0x5e55ac['query'][_0xc0eb('0x1d')]);}return _0x2924df[_0xc0eb('0x52')](_0x566bd1);}})['then'](function(_0x1006cb){if(_0x1006cb){return _0x1006cb?{'count':_0x245d23,'rows':_0x1006cb}:null;}})[_0xc0eb('0x26')](respondWithResult(_0x28e59f,null))['catch'](handleError(_0x28e59f,null));}; \ No newline at end of file +var _0xb100=['status','end','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','findOne','FreshsalesField','getSubjects','hasOwnProperty','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus'];(function(_0x9cea18,_0x165d14){var _0x487799=function(_0x4dc45e){while(--_0x4dc45e){_0x9cea18['push'](_0x9cea18['shift']());}};_0x487799(++_0x165d14);}(_0xb100,0x87));var _0x0b10=function(_0x38ff6c,_0x3b8e2b){_0x38ff6c=_0x38ff6c-0x0;var _0x1ee0c1=_0xb100[_0x38ff6c];return _0x1ee0c1;};'use strict';var emlformat=require(_0x0b10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b10('0x1'));var jsonpatch=require(_0x0b10('0x2'));var rp=require(_0x0b10('0x3'));var moment=require('moment');var BPromise=require(_0x0b10('0x4'));var Mustache=require(_0x0b10('0x5'));var util=require(_0x0b10('0x6'));var path=require(_0x0b10('0x7'));var sox=require(_0x0b10('0x8'));var csv=require(_0x0b10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b10('0xa'));var squel=require(_0x0b10('0xb'));var crypto=require(_0x0b10('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0b10('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0b10('0xe'));var Papa=require(_0x0b10('0xf'));var Redis=require(_0x0b10('0x10'));var authService=require(_0x0b10('0x11'));var qs=require(_0x0b10('0x12'));var as=require(_0x0b10('0x13'));var hardwareService=require(_0x0b10('0x14'));var logger=require(_0x0b10('0x15'))('api');var utils=require(_0x0b10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0b10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x366fbc,_0x5eb970){_0x5eb970=_0x5eb970||0xcc;return function(_0x28c77e){if(_0x28c77e){return _0x366fbc[_0x0b10('0x18')](_0x5eb970);}return _0x366fbc[_0x0b10('0x19')](_0x5eb970)[_0x0b10('0x1a')]();};}function respondWithResult(_0x27ae31,_0x16207a){_0x16207a=_0x16207a||0xc8;return function(_0x52f3b4){if(_0x52f3b4){return _0x27ae31[_0x0b10('0x19')](_0x16207a)[_0x0b10('0x1b')](_0x52f3b4);}};}function respondWithFilteredResult(_0xad61f4,_0x218dd4){return function(_0x156196){if(_0x156196){var _0x5334d3=typeof _0x218dd4[_0x0b10('0x1c')]==='undefined'&&typeof _0x218dd4['limit']===_0x0b10('0x1d');var _0x3ce9d3=_0x156196[_0x0b10('0x1e')];var _0x3a2729=_0x5334d3?0x0:_0x218dd4['offset'];var _0x26d558=_0x5334d3?_0x156196[_0x0b10('0x1e')]:_0x218dd4['offset']+_0x218dd4['limit'];var _0x24acda;if(_0x26d558>=_0x3ce9d3){_0x26d558=_0x3ce9d3;_0x24acda=0xc8;}else{_0x24acda=0xce;}_0xad61f4[_0x0b10('0x19')](_0x24acda);return _0xad61f4[_0x0b10('0x1f')](_0x0b10('0x20'),_0x3a2729+'-'+_0x26d558+'/'+_0x3ce9d3)[_0x0b10('0x1b')](_0x156196);}return null;};}function patchUpdates(_0xac10dd){return function(_0x2c193c){try{jsonpatch['apply'](_0x2c193c,_0xac10dd,!![]);}catch(_0x373dbd){return BPromise['reject'](_0x373dbd);}return _0x2c193c[_0x0b10('0x21')]();};}function saveUpdates(_0x5b07a9,_0x340f63){return function(_0x38ce8b){if(_0x38ce8b){return _0x38ce8b[_0x0b10('0x22')](_0x5b07a9)['then'](function(_0x1fca3a){return _0x1fca3a;});}return null;};}function removeEntity(_0x954c3e,_0x1f0df9){return function(_0x5940d1){if(_0x5940d1){return _0x5940d1[_0x0b10('0x23')]()[_0x0b10('0x24')](function(){_0x954c3e[_0x0b10('0x19')](0xcc)[_0x0b10('0x1a')]();});}};}function handleEntityNotFound(_0x16aa6a,_0x854430){return function(_0x11430c){if(!_0x11430c){_0x16aa6a[_0x0b10('0x18')](0x194);}return _0x11430c;};}function handleError(_0x42ece0,_0x4d1160){_0x4d1160=_0x4d1160||0x1f4;return function(_0x2f3964){logger[_0x0b10('0x25')](_0x2f3964[_0x0b10('0x26')]);if(_0x2f3964[_0x0b10('0x27')]){delete _0x2f3964[_0x0b10('0x27')];}_0x42ece0['status'](_0x4d1160)[_0x0b10('0x28')](_0x2f3964);};}exports[_0x0b10('0x29')]=function(_0x72850,_0x3b6dd6){var _0x3d46fc={},_0x4af7b1={},_0x4f123e={'count':0x0,'rows':[]};var _0x5473d0=_['map'](db[_0x0b10('0x2a')][_0x0b10('0x2b')],function(_0x3073c6){return{'name':_0x3073c6[_0x0b10('0x2c')],'type':_0x3073c6['type'][_0x0b10('0x2d')]};});_0x4af7b1['model']=_['map'](_0x5473d0,_0x0b10('0x27'));_0x4af7b1[_0x0b10('0x2e')]=_[_0x0b10('0x2f')](_0x72850[_0x0b10('0x2e')]);_0x4af7b1['filters']=_['intersection'](_0x4af7b1[_0x0b10('0x30')],_0x4af7b1[_0x0b10('0x2e')]);_0x3d46fc[_0x0b10('0x31')]=_[_0x0b10('0x32')](_0x4af7b1['model'],qs[_0x0b10('0x33')](_0x72850[_0x0b10('0x2e')][_0x0b10('0x33')]));_0x3d46fc[_0x0b10('0x31')]=_0x3d46fc[_0x0b10('0x31')][_0x0b10('0x34')]?_0x3d46fc[_0x0b10('0x31')]:_0x4af7b1[_0x0b10('0x30')];if(!_0x72850[_0x0b10('0x2e')]['hasOwnProperty'](_0x0b10('0x35'))){_0x3d46fc[_0x0b10('0x36')]=qs[_0x0b10('0x36')](_0x72850[_0x0b10('0x2e')][_0x0b10('0x36')]);_0x3d46fc[_0x0b10('0x1c')]=qs[_0x0b10('0x1c')](_0x72850[_0x0b10('0x2e')]['offset']);}_0x3d46fc[_0x0b10('0x37')]=qs[_0x0b10('0x38')](_0x72850['query'][_0x0b10('0x38')]);_0x3d46fc[_0x0b10('0x39')]=qs[_0x0b10('0x3a')](_[_0x0b10('0x3b')](_0x72850[_0x0b10('0x2e')],_0x4af7b1['filters']),_0x5473d0);if(_0x72850['query'][_0x0b10('0x3c')]){_0x3d46fc[_0x0b10('0x39')]=_[_0x0b10('0x3d')](_0x3d46fc[_0x0b10('0x39')],{'$or':_[_0x0b10('0x3e')](_0x5473d0,function(_0x50bdc9){if(_0x50bdc9['type']!==_0x0b10('0x3f')){var _0x327adf={};_0x327adf[_0x50bdc9[_0x0b10('0x27')]]={'$like':'%'+_0x72850[_0x0b10('0x2e')][_0x0b10('0x3c')]+'%'};return _0x327adf;}})});}_0x3d46fc=_[_0x0b10('0x3d')]({},_0x3d46fc,_0x72850[_0x0b10('0x40')]);var _0x183f53={'where':_0x3d46fc[_0x0b10('0x39')]};return db['FreshsalesConfiguration'][_0x0b10('0x1e')](_0x183f53)[_0x0b10('0x24')](function(_0x4c627d){_0x4f123e[_0x0b10('0x1e')]=_0x4c627d;if(_0x72850['query'][_0x0b10('0x41')]){_0x3d46fc[_0x0b10('0x42')]=[{'all':!![]}];}return db[_0x0b10('0x2a')][_0x0b10('0x43')](_0x3d46fc);})[_0x0b10('0x24')](function(_0x59bd9a){_0x4f123e[_0x0b10('0x44')]=_0x59bd9a;return _0x4f123e;})[_0x0b10('0x24')](respondWithFilteredResult(_0x3b6dd6,_0x3d46fc))[_0x0b10('0x45')](handleError(_0x3b6dd6,null));};exports['show']=function(_0x303462,_0x35f765){var _0x3904c3={'raw':![],'where':{'id':_0x303462['params']['id']}},_0x450466={};_0x450466[_0x0b10('0x30')]=_[_0x0b10('0x2f')](db[_0x0b10('0x2a')]['rawAttributes']);_0x450466[_0x0b10('0x2e')]=_[_0x0b10('0x2f')](_0x303462['query']);_0x450466['filters']=_[_0x0b10('0x32')](_0x450466[_0x0b10('0x30')],_0x450466[_0x0b10('0x2e')]);_0x3904c3[_0x0b10('0x31')]=_['intersection'](_0x450466[_0x0b10('0x30')],qs[_0x0b10('0x33')](_0x303462['query']['fields']));_0x3904c3[_0x0b10('0x31')]=_0x3904c3['attributes']['length']?_0x3904c3['attributes']:_0x450466['model'];if(_0x303462[_0x0b10('0x2e')][_0x0b10('0x41')]){_0x3904c3[_0x0b10('0x42')]=[{'all':!![]}];}_0x3904c3=_['merge']({},_0x3904c3,_0x303462[_0x0b10('0x40')]);return db[_0x0b10('0x2a')][_0x0b10('0x46')](_0x3904c3)[_0x0b10('0x24')](handleEntityNotFound(_0x35f765,null))[_0x0b10('0x24')](respondWithResult(_0x35f765,null))[_0x0b10('0x45')](handleError(_0x35f765,null));};exports[_0x0b10('0x47')]=function(_0x4e34a1,_0x1fff61){return db[_0x0b10('0x2a')][_0x0b10('0x47')](_0x4e34a1[_0x0b10('0x48')],{})[_0x0b10('0x24')](respondWithResult(_0x1fff61,0xc9))['catch'](handleError(_0x1fff61,null));};exports['update']=function(_0x3bff7,_0x2986d4){if(_0x3bff7[_0x0b10('0x48')]['id']){delete _0x3bff7[_0x0b10('0x48')]['id'];}return db[_0x0b10('0x2a')][_0x0b10('0x46')]({'where':{'id':_0x3bff7[_0x0b10('0x49')]['id']}})[_0x0b10('0x24')](handleEntityNotFound(_0x2986d4,null))[_0x0b10('0x24')](saveUpdates(_0x3bff7[_0x0b10('0x48')],null))[_0x0b10('0x24')](respondWithResult(_0x2986d4,null))[_0x0b10('0x45')](handleError(_0x2986d4,null));};exports[_0x0b10('0x23')]=function(_0x37a6eb,_0x520d0a){return db['FreshsalesConfiguration'][_0x0b10('0x46')]({'where':{'id':_0x37a6eb[_0x0b10('0x49')]['id']}})['then'](handleEntityNotFound(_0x520d0a,null))[_0x0b10('0x24')](removeEntity(_0x520d0a,null))[_0x0b10('0x45')](handleError(_0x520d0a,null));};exports['getSubjects']=function(_0x4f9322,_0xe1e97d,_0x5755bc){var _0x231ef8={};var _0x42688f={};var _0x120bcb;var _0x83e91c;return db['FreshsalesConfiguration'][_0x0b10('0x4a')]({'where':{'id':_0x4f9322[_0x0b10('0x49')]['id']}})[_0x0b10('0x24')](handleEntityNotFound(_0xe1e97d,null))[_0x0b10('0x24')](function(_0x38db50){if(_0x38db50){_0x120bcb=_0x38db50;_0x42688f['model']=_[_0x0b10('0x2f')](db[_0x0b10('0x4b')][_0x0b10('0x2b')]);_0x42688f[_0x0b10('0x2e')]=_[_0x0b10('0x2f')](_0x4f9322['query']);_0x42688f[_0x0b10('0x3a')]=_[_0x0b10('0x32')](_0x42688f[_0x0b10('0x30')],_0x42688f[_0x0b10('0x2e')]);_0x231ef8[_0x0b10('0x31')]=_['intersection'](_0x42688f['model'],qs['fields'](_0x4f9322[_0x0b10('0x2e')][_0x0b10('0x33')]));_0x231ef8[_0x0b10('0x31')]=_0x231ef8['attributes'][_0x0b10('0x34')]?_0x231ef8[_0x0b10('0x31')]:_0x42688f[_0x0b10('0x30')];_0x231ef8['order']=qs[_0x0b10('0x38')](_0x4f9322[_0x0b10('0x2e')]['sort']);_0x231ef8[_0x0b10('0x39')]=qs['filters'](_[_0x0b10('0x3b')](_0x4f9322[_0x0b10('0x2e')],_0x42688f[_0x0b10('0x3a')]));if(_0x4f9322[_0x0b10('0x2e')][_0x0b10('0x3c')]){_0x231ef8[_0x0b10('0x39')]=_['merge'](_0x231ef8[_0x0b10('0x39')],{'$or':_[_0x0b10('0x3e')](_0x231ef8[_0x0b10('0x31')],function(_0x1e79c6){var _0x355ba7={};_0x355ba7[_0x1e79c6]={'$like':'%'+_0x4f9322[_0x0b10('0x2e')][_0x0b10('0x3c')]+'%'};return _0x355ba7;})});}_0x231ef8=_[_0x0b10('0x3d')]({},_0x231ef8,_0x4f9322[_0x0b10('0x40')]);return _0x120bcb[_0x0b10('0x4c')](_0x231ef8);}})[_0x0b10('0x24')](function(_0x2e63ab){if(_0x2e63ab){_0x83e91c=_0x2e63ab[_0x0b10('0x34')];if(!_0x4f9322[_0x0b10('0x2e')][_0x0b10('0x4d')]('nolimit')){_0x231ef8[_0x0b10('0x36')]=qs['limit'](_0x4f9322[_0x0b10('0x2e')][_0x0b10('0x36')]);_0x231ef8['offset']=qs[_0x0b10('0x1c')](_0x4f9322[_0x0b10('0x2e')][_0x0b10('0x1c')]);}return _0x120bcb[_0x0b10('0x4c')](_0x231ef8);}})[_0x0b10('0x24')](function(_0x444f5b){if(_0x444f5b){return _0x444f5b?{'count':_0x83e91c,'rows':_0x444f5b}:null;}})[_0x0b10('0x24')](respondWithResult(_0xe1e97d,null))[_0x0b10('0x45')](handleError(_0xe1e97d,null));};exports[_0x0b10('0x4e')]=function(_0x9feed9,_0x4c3c6b,_0x3bff48){var _0x44cb7a={};var _0x110b77={};var _0x1f404e;var _0xc30e64;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x9feed9[_0x0b10('0x49')]['id']}})[_0x0b10('0x24')](handleEntityNotFound(_0x4c3c6b,null))[_0x0b10('0x24')](function(_0x294ea3){if(_0x294ea3){_0x1f404e=_0x294ea3;_0x110b77[_0x0b10('0x30')]=_['keys'](db[_0x0b10('0x4b')][_0x0b10('0x2b')]);_0x110b77['query']=_[_0x0b10('0x2f')](_0x9feed9[_0x0b10('0x2e')]);_0x110b77[_0x0b10('0x3a')]=_[_0x0b10('0x32')](_0x110b77[_0x0b10('0x30')],_0x110b77['query']);_0x44cb7a[_0x0b10('0x31')]=_[_0x0b10('0x32')](_0x110b77['model'],qs[_0x0b10('0x33')](_0x9feed9[_0x0b10('0x2e')][_0x0b10('0x33')]));_0x44cb7a[_0x0b10('0x31')]=_0x44cb7a['attributes'][_0x0b10('0x34')]?_0x44cb7a[_0x0b10('0x31')]:_0x110b77[_0x0b10('0x30')];_0x44cb7a[_0x0b10('0x37')]=qs[_0x0b10('0x38')](_0x9feed9[_0x0b10('0x2e')]['sort']);_0x44cb7a['where']=qs[_0x0b10('0x3a')](_[_0x0b10('0x3b')](_0x9feed9[_0x0b10('0x2e')],_0x110b77[_0x0b10('0x3a')]));if(_0x9feed9['query'][_0x0b10('0x3c')]){_0x44cb7a['where']=_['merge'](_0x44cb7a[_0x0b10('0x39')],{'$or':_[_0x0b10('0x3e')](_0x44cb7a['attributes'],function(_0x1851d1){var _0x585924={};_0x585924[_0x1851d1]={'$like':'%'+_0x9feed9[_0x0b10('0x2e')][_0x0b10('0x3c')]+'%'};return _0x585924;})});}_0x44cb7a=_[_0x0b10('0x3d')]({},_0x44cb7a,_0x9feed9[_0x0b10('0x40')]);return _0x1f404e[_0x0b10('0x4e')](_0x44cb7a);}})[_0x0b10('0x24')](function(_0x4e196f){if(_0x4e196f){_0xc30e64=_0x4e196f['length'];if(!_0x9feed9['query'][_0x0b10('0x4d')](_0x0b10('0x35'))){_0x44cb7a[_0x0b10('0x36')]=qs[_0x0b10('0x36')](_0x9feed9[_0x0b10('0x2e')][_0x0b10('0x36')]);_0x44cb7a[_0x0b10('0x1c')]=qs[_0x0b10('0x1c')](_0x9feed9[_0x0b10('0x2e')][_0x0b10('0x1c')]);}return _0x1f404e['getDescriptions'](_0x44cb7a);}})['then'](function(_0x44114a){if(_0x44114a){return _0x44114a?{'count':_0xc30e64,'rows':_0x44114a}:null;}})['then'](respondWithResult(_0x4c3c6b,null))[_0x0b10('0x45')](handleError(_0x4c3c6b,null));};exports[_0x0b10('0x4f')]=function(_0x2563bc,_0x53c673,_0x2b3f06){var _0x32c649={};var _0x523df3={};var _0x41cbd7;var _0x16acee;return db['FreshsalesConfiguration'][_0x0b10('0x4a')]({'where':{'id':_0x2563bc[_0x0b10('0x49')]['id']}})[_0x0b10('0x24')](handleEntityNotFound(_0x53c673,null))['then'](function(_0x41bbfe){if(_0x41bbfe){_0x41cbd7=_0x41bbfe;_0x523df3[_0x0b10('0x30')]=_['keys'](db['FreshsalesField'][_0x0b10('0x2b')]);_0x523df3[_0x0b10('0x2e')]=_[_0x0b10('0x2f')](_0x2563bc[_0x0b10('0x2e')]);_0x523df3[_0x0b10('0x3a')]=_['intersection'](_0x523df3[_0x0b10('0x30')],_0x523df3[_0x0b10('0x2e')]);_0x32c649['attributes']=_[_0x0b10('0x32')](_0x523df3['model'],qs[_0x0b10('0x33')](_0x2563bc[_0x0b10('0x2e')]['fields']));_0x32c649[_0x0b10('0x31')]=_0x32c649[_0x0b10('0x31')][_0x0b10('0x34')]?_0x32c649[_0x0b10('0x31')]:_0x523df3[_0x0b10('0x30')];_0x32c649[_0x0b10('0x37')]=qs[_0x0b10('0x38')](_0x2563bc[_0x0b10('0x2e')][_0x0b10('0x38')]);_0x32c649[_0x0b10('0x39')]=qs[_0x0b10('0x3a')](_[_0x0b10('0x3b')](_0x2563bc['query'],_0x523df3[_0x0b10('0x3a')]));if(_0x2563bc['query']['filter']){_0x32c649[_0x0b10('0x39')]=_['merge'](_0x32c649[_0x0b10('0x39')],{'$or':_['map'](_0x32c649[_0x0b10('0x31')],function(_0x31d05f){var _0x14052b={};_0x14052b[_0x31d05f]={'$like':'%'+_0x2563bc['query'][_0x0b10('0x3c')]+'%'};return _0x14052b;})});}_0x32c649=_[_0x0b10('0x3d')]({},_0x32c649,_0x2563bc[_0x0b10('0x40')]);return _0x41cbd7['getFields'](_0x32c649);}})['then'](function(_0x3912d7){if(_0x3912d7){_0x16acee=_0x3912d7[_0x0b10('0x34')];if(!_0x2563bc[_0x0b10('0x2e')][_0x0b10('0x4d')](_0x0b10('0x35'))){_0x32c649['limit']=qs['limit'](_0x2563bc[_0x0b10('0x2e')][_0x0b10('0x36')]);_0x32c649[_0x0b10('0x1c')]=qs['offset'](_0x2563bc[_0x0b10('0x2e')]['offset']);}return _0x41cbd7[_0x0b10('0x4f')](_0x32c649);}})[_0x0b10('0x24')](function(_0x2a90ca){if(_0x2a90ca){return _0x2a90ca?{'count':_0x16acee,'rows':_0x2a90ca}:null;}})[_0x0b10('0x24')](respondWithResult(_0x53c673,null))[_0x0b10('0x45')](handleError(_0x53c673,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 0697a8c..c76e587 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f94=['../../config/environment','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x1f94,0x1e3));var _0x41f9=function(_0x584f66,_0x39a037){_0x584f66=_0x584f66-0x0;var _0x3908b4=_0x1f94[_0x584f66];return _0x3908b4;};'use strict';var _=require(_0x41f9('0x0'));var util=require(_0x41f9('0x1'));var logger=require(_0x41f9('0x2'))(_0x41f9('0x3'));var moment=require(_0x41f9('0x4'));var BPromise=require(_0x41f9('0x5'));var rp=require(_0x41f9('0x6'));var fs=require('fs');var path=require(_0x41f9('0x7'));var rimraf=require(_0x41f9('0x8'));var config=require(_0x41f9('0x9'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x408a4f,_0x55e358){return _0x408a4f[_0x41f9('0xa')](_0x41f9('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x373a=['moment','bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash','util','../../config/logger','api'];(function(_0x2a0cfb,_0x3538ea){var _0x47d016=function(_0x880cb2){while(--_0x880cb2){_0x2a0cfb['push'](_0x2a0cfb['shift']());}};_0x47d016(++_0x3538ea);}(_0x373a,0x80));var _0xa373=function(_0x5cde25,_0xaecb63){_0x5cde25=_0x5cde25-0x0;var _0x33c9fd=_0x373a[_0x5cde25];return _0x33c9fd;};'use strict';var _=require(_0xa373('0x0'));var util=require(_0xa373('0x1'));var logger=require(_0xa373('0x2'))(_0xa373('0x3'));var moment=require(_0xa373('0x4'));var BPromise=require(_0xa373('0x5'));var rp=require(_0xa373('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa373('0x7'));var attributes=require(_0xa373('0x8'));module[_0xa373('0x9')]=function(_0x168e85,_0x5c508d){return _0x168e85[_0xa373('0xa')](_0xa373('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 0afd098..ac8b029 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd095=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x165ac3,_0x379e76){var _0x1448dd=function(_0x4c4f9d){while(--_0x4c4f9d){_0x165ac3['push'](_0x165ac3['shift']());}};_0x1448dd(++_0x379e76);}(_0xd095,0x1e4));var _0x5d09=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd095[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x5d09('0x0'));var util=require(_0x5d09('0x1'));var moment=require(_0x5d09('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d09('0x3'));var fs=require('fs');var Redis=require(_0x5d09('0x4'));var db=require(_0x5d09('0x5'))['db'];var utils=require(_0x5d09('0x6'));var logger=require(_0x5d09('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5d09('0x8'));var client=jayson['client'][_0x5d09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49d0b6,_0x5f0b4b,_0x306b27){return new BPromise(function(_0x2f06d6,_0x5ed4a2){return client['request'](_0x49d0b6,_0x306b27)[_0x5d09('0xa')](function(_0x52fad7){logger[_0x5d09('0xb')](_0x5d09('0xc'),_0x5f0b4b,_0x5d09('0xd'));logger[_0x5d09('0xe')](_0x5d09('0xf'),_0x5f0b4b,_0x5d09('0xd'),JSON['stringify'](_0x52fad7));if(_0x52fad7[_0x5d09('0x10')]){if(_0x52fad7[_0x5d09('0x10')][_0x5d09('0x11')]===0x1f4){logger[_0x5d09('0x10')](_0x5d09('0xc'),_0x5f0b4b,_0x52fad7[_0x5d09('0x10')][_0x5d09('0x12')]);return _0x5ed4a2(_0x52fad7['error']['message']);}logger[_0x5d09('0x10')](_0x5d09('0xc'),_0x5f0b4b,_0x52fad7['error'][_0x5d09('0x12')]);return _0x2f06d6(_0x52fad7['error'][_0x5d09('0x12')]);}else{logger['info'](_0x5d09('0xc'),_0x5f0b4b,_0x5d09('0xd'));_0x2f06d6(_0x52fad7[_0x5d09('0x13')][_0x5d09('0x12')]);}})['catch'](function(_0x3f3c7d){logger['error'](_0x5d09('0xc'),_0x5f0b4b,_0x3f3c7d);_0x5ed4a2(_0x3f3c7d);});});} \ No newline at end of file +var _0x03d7=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x28b69f,_0x26b011){var _0x259fbf=function(_0x48f418){while(--_0x48f418){_0x28b69f['push'](_0x28b69f['shift']());}};_0x259fbf(++_0x26b011);}(_0x03d7,0x160));var _0x703d=function(_0x1115ad,_0x14f1c2){_0x1115ad=_0x1115ad-0x0;var _0xcf5d5c=_0x03d7[_0x1115ad];return _0xcf5d5c;};'use strict';var _=require(_0x703d('0x0'));var util=require(_0x703d('0x1'));var moment=require(_0x703d('0x2'));var BPromise=require('bluebird');var rs=require(_0x703d('0x3'));var fs=require('fs');var Redis=require(_0x703d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x703d('0x5'));var logger=require(_0x703d('0x6'))(_0x703d('0x7'));var config=require('../../config/environment');var jayson=require(_0x703d('0x8'));var client=jayson[_0x703d('0x9')][_0x703d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x192f98,_0x1f37ca,_0x47b1b7){return new BPromise(function(_0x2352ce,_0x1987be){return client[_0x703d('0xb')](_0x192f98,_0x47b1b7)[_0x703d('0xc')](function(_0x37aa7e){logger[_0x703d('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1f37ca,_0x703d('0xe'));logger['debug'](_0x703d('0xf'),_0x1f37ca,_0x703d('0xe'),JSON[_0x703d('0x10')](_0x37aa7e));if(_0x37aa7e[_0x703d('0x11')]){if(_0x37aa7e['error']['code']===0x1f4){logger[_0x703d('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1f37ca,_0x37aa7e[_0x703d('0x11')][_0x703d('0x12')]);return _0x1987be(_0x37aa7e[_0x703d('0x11')][_0x703d('0x12')]);}logger[_0x703d('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1f37ca,_0x37aa7e[_0x703d('0x11')]['message']);return _0x2352ce(_0x37aa7e[_0x703d('0x11')][_0x703d('0x12')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1f37ca,_0x703d('0xe'));_0x2352ce(_0x37aa7e[_0x703d('0x13')][_0x703d('0x12')]);}})[_0x703d('0x14')](function(_0x187bc9){logger[_0x703d('0x11')](_0x703d('0x15'),_0x1f37ca,_0x187bc9);_0x1987be(_0x187bc9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b4f4173..6dc208f 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa739=['exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy'];(function(_0x2b6b3d,_0x3023d4){var _0xb2d98e=function(_0x159414){while(--_0x159414){_0x2b6b3d['push'](_0x2b6b3d['shift']());}};_0xb2d98e(++_0x3023d4);}(_0xa739,0x1e1));var _0x9a73=function(_0x2615aa,_0x1b99b0){_0x2615aa=_0x2615aa-0x0;var _0x440f91=_0xa739[_0x2615aa];return _0x440f91;};'use strict';var multer=require('multer');var util=require(_0x9a73('0x0'));var path=require('path');var timeout=require(_0x9a73('0x1'));var express=require(_0x9a73('0x2'));var router=express['Router']();var fs_extra=require(_0x9a73('0x3'));var auth=require(_0x9a73('0x4'));var interaction=require(_0x9a73('0x5'));var config=require('../../config/environment');var controller=require(_0x9a73('0x6'));router[_0x9a73('0x7')]('/',auth[_0x9a73('0x8')](),controller[_0x9a73('0x9')]);router[_0x9a73('0x7')](_0x9a73('0xa'),auth[_0x9a73('0x8')](),controller[_0x9a73('0xb')]);router['post']('/',auth[_0x9a73('0x8')](),controller['create']);router[_0x9a73('0xc')](_0x9a73('0xa'),auth[_0x9a73('0x8')](),controller['update']);router[_0x9a73('0xd')](_0x9a73('0xa'),auth['isAuthenticated'](),controller[_0x9a73('0xe')]);module[_0x9a73('0xf')]=router; \ No newline at end of file +var _0xe13e=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','put','delete'];(function(_0x1b5192,_0x418571){var _0x56c276=function(_0x4634e4){while(--_0x4634e4){_0x1b5192['push'](_0x1b5192['shift']());}};_0x56c276(++_0x418571);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee13('0x0'));var timeout=require(_0xee13('0x1'));var express=require(_0xee13('0x2'));var router=express[_0xee13('0x3')]();var fs_extra=require(_0xee13('0x4'));var auth=require(_0xee13('0x5'));var interaction=require(_0xee13('0x6'));var config=require(_0xee13('0x7'));var controller=require(_0xee13('0x8'));router[_0xee13('0x9')]('/',auth[_0xee13('0xa')](),controller['index']);router[_0xee13('0x9')](_0xee13('0xb'),auth[_0xee13('0xa')](),controller[_0xee13('0xc')]);router['post']('/',auth[_0xee13('0xa')](),controller[_0xee13('0xd')]);router[_0xee13('0xe')](_0xee13('0xb'),auth[_0xee13('0xa')](),controller['update']);router[_0xee13('0xf')](_0xee13('0xb'),auth['isAuthenticated'](),controller[_0xee13('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 7781d0e..315b91b 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7143=['STRING','BOOLEAN','exports','variable','customVariable','keyValue','picklist'];(function(_0x118489,_0x3e8b9e){var _0x2459c7=function(_0x554693){while(--_0x554693){_0x118489['push'](_0x118489['shift']());}};_0x2459c7(++_0x3e8b9e);}(_0x7143,0x12f));var _0x3714=function(_0x23d30a,_0x57877d){_0x23d30a=_0x23d30a-0x0;var _0x2c3100=_0x7143[_0x23d30a];return _0x2c3100;};'use strict';var Sequelize=require('sequelize');module[_0x3714('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x3714('0x1'),_0x3714('0x2'),_0x3714('0x3'),_0x3714('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3714('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3714('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x3714('0x5')]},'idField':{'type':Sequelize[_0x3714('0x5')]},'nameField':{'type':Sequelize[_0x3714('0x5')]},'customField':{'type':Sequelize[_0x3714('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3714('0x5')]}}; \ No newline at end of file +var _0xf995=['variable','customVariable','keyValue','string','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x46399a,_0x108f44){var _0x3f97ca=function(_0xb8ca74){while(--_0xb8ca74){_0x46399a['push'](_0x46399a['shift']());}};_0x3f97ca(++_0x108f44);}(_0xf995,0x19c));var _0x5f99=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf995[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x5f99('0x0'));module[_0x5f99('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x5f99('0x2'),_0x5f99('0x3'),_0x5f99('0x4'),'picklist'),'defaultValue':_0x5f99('0x5')},'content':{'type':Sequelize[_0x5f99('0x6')]},'key':{'type':Sequelize[_0x5f99('0x6')]},'keyType':{'type':Sequelize[_0x5f99('0x7')](_0x5f99('0x5'),_0x5f99('0x2'),_0x5f99('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5f99('0x6')]},'nameField':{'type':Sequelize[_0x5f99('0x6')]},'customField':{'type':Sequelize[_0x5f99('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5f99('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a4db11f..3b22f71 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2007=['sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesField','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','rimraf','zip-dir','request-promise','bluebird','util','path','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','apply','save','update','then','destroy'];(function(_0x3b1fa9,_0x3c6358){var _0x1a05c7=function(_0x34583c){while(--_0x34583c){_0x3b1fa9['push'](_0x3b1fa9['shift']());}};_0x1a05c7(++_0x3c6358);}(_0x2007,0xb2));var _0x7200=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2007[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7200('0x0'));var zipdir=require(_0x7200('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7200('0x2'));var moment=require('moment');var BPromise=require(_0x7200('0x3'));var Mustache=require('mustache');var util=require(_0x7200('0x4'));var path=require(_0x7200('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7200('0x6'));var _=require(_0x7200('0x7'));var squel=require('squel');var crypto=require(_0x7200('0x8'));var jsforce=require(_0x7200('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7200('0xa'));var Redis=require(_0x7200('0xb'));var authService=require(_0x7200('0xc'));var qs=require(_0x7200('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7200('0xe'));var logger=require(_0x7200('0xf'))('api');var utils=require(_0x7200('0x10'));var config=require(_0x7200('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x7200('0x12'))['db'];function respondWithStatusCode(_0x13d3d4,_0x3ea238){_0x3ea238=_0x3ea238||0xcc;return function(_0x451dfd){if(_0x451dfd){return _0x13d3d4['sendStatus'](_0x3ea238);}return _0x13d3d4['status'](_0x3ea238)[_0x7200('0x13')]();};}function respondWithResult(_0x5a1661,_0x11e1e7){_0x11e1e7=_0x11e1e7||0xc8;return function(_0xd32bad){if(_0xd32bad){return _0x5a1661[_0x7200('0x14')](_0x11e1e7)[_0x7200('0x15')](_0xd32bad);}};}function respondWithFilteredResult(_0xa002f6,_0x28a323){return function(_0x986ec2){if(_0x986ec2){var _0x48fc25=typeof _0x28a323[_0x7200('0x16')]==='undefined'&&typeof _0x28a323[_0x7200('0x17')]==='undefined';var _0x3850fa=_0x986ec2['count'];var _0x223ecd=_0x48fc25?0x0:_0x28a323[_0x7200('0x16')];var _0x23e079=_0x48fc25?_0x986ec2['count']:_0x28a323[_0x7200('0x16')]+_0x28a323[_0x7200('0x17')];var _0x23c03f;if(_0x23e079>=_0x3850fa){_0x23e079=_0x3850fa;_0x23c03f=0xc8;}else{_0x23c03f=0xce;}_0xa002f6[_0x7200('0x14')](_0x23c03f);return _0xa002f6['set']('Content-Range',_0x223ecd+'-'+_0x23e079+'/'+_0x3850fa)['json'](_0x986ec2);}return null;};}function patchUpdates(_0x27a360){return function(_0x440883){try{jsonpatch[_0x7200('0x18')](_0x440883,_0x27a360,!![]);}catch(_0x59d935){return BPromise['reject'](_0x59d935);}return _0x440883[_0x7200('0x19')]();};}function saveUpdates(_0x1ac7f6,_0x11d470){return function(_0x5b96d9){if(_0x5b96d9){return _0x5b96d9[_0x7200('0x1a')](_0x1ac7f6)[_0x7200('0x1b')](function(_0x103ee2){return _0x103ee2;});}return null;};}function removeEntity(_0x2fcbc3,_0x1b9598){return function(_0x254aad){if(_0x254aad){return _0x254aad[_0x7200('0x1c')]()[_0x7200('0x1b')](function(){_0x2fcbc3[_0x7200('0x14')](0xcc)[_0x7200('0x13')]();});}};}function handleEntityNotFound(_0x44c729,_0x5a6f4a){return function(_0x5f9aee){if(!_0x5f9aee){_0x44c729[_0x7200('0x1d')](0x194);}return _0x5f9aee;};}function handleError(_0x41a898,_0x50ab76){_0x50ab76=_0x50ab76||0x1f4;return function(_0x80c275){logger[_0x7200('0x1e')](_0x80c275[_0x7200('0x1f')]);if(_0x80c275[_0x7200('0x20')]){delete _0x80c275[_0x7200('0x20')];}_0x41a898[_0x7200('0x14')](_0x50ab76)[_0x7200('0x21')](_0x80c275);};}exports[_0x7200('0x22')]=function(_0xf8d4d9,_0x202427){var _0x48e357={},_0x8aef58={},_0x30de15={'count':0x0,'rows':[]};var _0x3471be=_[_0x7200('0x23')](db['FreshsalesField'][_0x7200('0x24')],function(_0x442579){return{'name':_0x442579[_0x7200('0x25')],'type':_0x442579[_0x7200('0x26')][_0x7200('0x27')]};});_0x8aef58['model']=_['map'](_0x3471be,_0x7200('0x20'));_0x8aef58[_0x7200('0x28')]=_[_0x7200('0x29')](_0xf8d4d9[_0x7200('0x28')]);_0x8aef58[_0x7200('0x2a')]=_[_0x7200('0x2b')](_0x8aef58[_0x7200('0x2c')],_0x8aef58[_0x7200('0x28')]);_0x48e357[_0x7200('0x2d')]=_[_0x7200('0x2b')](_0x8aef58['model'],qs[_0x7200('0x2e')](_0xf8d4d9[_0x7200('0x28')][_0x7200('0x2e')]));_0x48e357[_0x7200('0x2d')]=_0x48e357[_0x7200('0x2d')]['length']?_0x48e357[_0x7200('0x2d')]:_0x8aef58[_0x7200('0x2c')];if(!_0xf8d4d9[_0x7200('0x28')][_0x7200('0x2f')](_0x7200('0x30'))){_0x48e357['limit']=qs[_0x7200('0x17')](_0xf8d4d9[_0x7200('0x28')]['limit']);_0x48e357[_0x7200('0x16')]=qs['offset'](_0xf8d4d9[_0x7200('0x28')][_0x7200('0x16')]);}_0x48e357[_0x7200('0x31')]=qs[_0x7200('0x32')](_0xf8d4d9['query'][_0x7200('0x32')]);_0x48e357[_0x7200('0x33')]=qs['filters'](_['pick'](_0xf8d4d9[_0x7200('0x28')],_0x8aef58['filters']),_0x3471be);if(_0xf8d4d9[_0x7200('0x28')][_0x7200('0x34')]){_0x48e357[_0x7200('0x33')]=_[_0x7200('0x35')](_0x48e357[_0x7200('0x33')],{'$or':_[_0x7200('0x23')](_0x3471be,function(_0x334544){if(_0x334544['type']!==_0x7200('0x36')){var _0x592333={};_0x592333[_0x334544[_0x7200('0x20')]]={'$like':'%'+_0xf8d4d9[_0x7200('0x28')][_0x7200('0x34')]+'%'};return _0x592333;}})});}_0x48e357=_[_0x7200('0x35')]({},_0x48e357,_0xf8d4d9[_0x7200('0x37')]);var _0x2d837c={'where':_0x48e357[_0x7200('0x33')]};return db[_0x7200('0x38')][_0x7200('0x39')](_0x2d837c)[_0x7200('0x1b')](function(_0x149634){_0x30de15[_0x7200('0x39')]=_0x149634;if(_0xf8d4d9[_0x7200('0x28')][_0x7200('0x3a')]){_0x48e357[_0x7200('0x3b')]=[{'all':!![]}];}return db[_0x7200('0x38')][_0x7200('0x3c')](_0x48e357);})[_0x7200('0x1b')](function(_0x44a877){_0x30de15[_0x7200('0x3d')]=_0x44a877;return _0x30de15;})['then'](respondWithFilteredResult(_0x202427,_0x48e357))[_0x7200('0x3e')](handleError(_0x202427,null));};exports[_0x7200('0x3f')]=function(_0xda529a,_0x1f9ac6){var _0x388d87={'raw':!![],'where':{'id':_0xda529a[_0x7200('0x40')]['id']}},_0x1e9bd6={};_0x1e9bd6['model']=_[_0x7200('0x29')](db[_0x7200('0x38')][_0x7200('0x24')]);_0x1e9bd6[_0x7200('0x28')]=_[_0x7200('0x29')](_0xda529a[_0x7200('0x28')]);_0x1e9bd6['filters']=_[_0x7200('0x2b')](_0x1e9bd6[_0x7200('0x2c')],_0x1e9bd6[_0x7200('0x28')]);_0x388d87[_0x7200('0x2d')]=_[_0x7200('0x2b')](_0x1e9bd6[_0x7200('0x2c')],qs['fields'](_0xda529a[_0x7200('0x28')]['fields']));_0x388d87['attributes']=_0x388d87[_0x7200('0x2d')][_0x7200('0x41')]?_0x388d87[_0x7200('0x2d')]:_0x1e9bd6[_0x7200('0x2c')];if(_0xda529a[_0x7200('0x28')][_0x7200('0x3a')]){_0x388d87[_0x7200('0x3b')]=[{'all':!![]}];}_0x388d87=_['merge']({},_0x388d87,_0xda529a[_0x7200('0x37')]);return db['FreshsalesField'][_0x7200('0x42')](_0x388d87)[_0x7200('0x1b')](handleEntityNotFound(_0x1f9ac6,null))['then'](respondWithResult(_0x1f9ac6,null))[_0x7200('0x3e')](handleError(_0x1f9ac6,null));};exports['create']=function(_0x2d3b0d,_0x4dbce1){return db[_0x7200('0x38')][_0x7200('0x43')](_0x2d3b0d[_0x7200('0x44')],{})[_0x7200('0x1b')](respondWithResult(_0x4dbce1,0xc9))[_0x7200('0x3e')](handleError(_0x4dbce1,null));};exports['update']=function(_0xd2447e,_0x122bf6){if(_0xd2447e[_0x7200('0x44')]['id']){delete _0xd2447e[_0x7200('0x44')]['id'];}return db['FreshsalesField'][_0x7200('0x42')]({'where':{'id':_0xd2447e[_0x7200('0x40')]['id']}})['then'](handleEntityNotFound(_0x122bf6,null))[_0x7200('0x1b')](saveUpdates(_0xd2447e[_0x7200('0x44')],null))[_0x7200('0x1b')](respondWithResult(_0x122bf6,null))[_0x7200('0x3e')](handleError(_0x122bf6,null));};exports[_0x7200('0x1c')]=function(_0x216893,_0x769040){return db[_0x7200('0x38')]['find']({'where':{'id':_0x216893[_0x7200('0x40')]['id']}})[_0x7200('0x1b')](handleEntityNotFound(_0x769040,null))[_0x7200('0x1b')](removeEntity(_0x769040,null))[_0x7200('0x3e')](handleError(_0x769040,null));}; \ No newline at end of file +var _0x66bc=['attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','send','map','FreshsalesField','rawAttributes','fieldName','type','model','name','query','keys','intersection','fields'];(function(_0x329ba0,_0x2e889b){var _0x526123=function(_0x42656e){while(--_0x42656e){_0x329ba0['push'](_0x329ba0['shift']());}};_0x526123(++_0x2e889b);}(_0x66bc,0x1c5));var _0xc66b=function(_0x5be0c1,_0x4bf3e8){_0x5be0c1=_0x5be0c1-0x0;var _0x4198ab=_0x66bc[_0x5be0c1];return _0x4198ab;};'use strict';var emlformat=require(_0xc66b('0x0'));var rimraf=require(_0xc66b('0x1'));var zipdir=require(_0xc66b('0x2'));var jsonpatch=require(_0xc66b('0x3'));var rp=require('request-promise');var moment=require(_0xc66b('0x4'));var BPromise=require(_0xc66b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc66b('0x6'));var sox=require('sox');var csv=require(_0xc66b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc66b('0x8'));var _=require(_0xc66b('0x9'));var squel=require(_0xc66b('0xa'));var crypto=require(_0xc66b('0xb'));var jsforce=require(_0xc66b('0xc'));var deskjs=require(_0xc66b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc66b('0xe'));var authService=require(_0xc66b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc66b('0x10'));var hardwareService=require(_0xc66b('0x11'));var logger=require('../../config/logger')(_0xc66b('0x12'));var utils=require(_0xc66b('0x13'));var config=require(_0xc66b('0x14'));var licenseUtil=require(_0xc66b('0x15'));var db=require(_0xc66b('0x16'))['db'];function respondWithStatusCode(_0x288d72,_0x352d2d){_0x352d2d=_0x352d2d||0xcc;return function(_0x2cef76){if(_0x2cef76){return _0x288d72[_0xc66b('0x17')](_0x352d2d);}return _0x288d72[_0xc66b('0x18')](_0x352d2d)[_0xc66b('0x19')]();};}function respondWithResult(_0x13f364,_0x4c71dc){_0x4c71dc=_0x4c71dc||0xc8;return function(_0x9b3693){if(_0x9b3693){return _0x13f364[_0xc66b('0x18')](_0x4c71dc)[_0xc66b('0x1a')](_0x9b3693);}};}function respondWithFilteredResult(_0xf7d00c,_0x454aad){return function(_0x1d0227){if(_0x1d0227){var _0x3cd9e7=typeof _0x454aad[_0xc66b('0x1b')]==='undefined'&&typeof _0x454aad[_0xc66b('0x1c')]===_0xc66b('0x1d');var _0x4c964c=_0x1d0227['count'];var _0x4a5a88=_0x3cd9e7?0x0:_0x454aad[_0xc66b('0x1b')];var _0x29fc0a=_0x3cd9e7?_0x1d0227[_0xc66b('0x1e')]:_0x454aad['offset']+_0x454aad[_0xc66b('0x1c')];var _0x1a28b5;if(_0x29fc0a>=_0x4c964c){_0x29fc0a=_0x4c964c;_0x1a28b5=0xc8;}else{_0x1a28b5=0xce;}_0xf7d00c['status'](_0x1a28b5);return _0xf7d00c[_0xc66b('0x1f')](_0xc66b('0x20'),_0x4a5a88+'-'+_0x29fc0a+'/'+_0x4c964c)[_0xc66b('0x1a')](_0x1d0227);}return null;};}function patchUpdates(_0x5dab38){return function(_0x485c6b){try{jsonpatch[_0xc66b('0x21')](_0x485c6b,_0x5dab38,!![]);}catch(_0x3a4e5e){return BPromise['reject'](_0x3a4e5e);}return _0x485c6b[_0xc66b('0x22')]();};}function saveUpdates(_0x4f8fab,_0x14dfa5){return function(_0x3165d6){if(_0x3165d6){return _0x3165d6[_0xc66b('0x23')](_0x4f8fab)['then'](function(_0x3c19b1){return _0x3c19b1;});}return null;};}function removeEntity(_0x470bd7,_0x3b9400){return function(_0x4ea242){if(_0x4ea242){return _0x4ea242[_0xc66b('0x24')]()[_0xc66b('0x25')](function(){_0x470bd7[_0xc66b('0x18')](0xcc)[_0xc66b('0x19')]();});}};}function handleEntityNotFound(_0x2a198e,_0x1e99ec){return function(_0x24fd7f){if(!_0x24fd7f){_0x2a198e[_0xc66b('0x17')](0x194);}return _0x24fd7f;};}function handleError(_0x30d030,_0x1cbf2b){_0x1cbf2b=_0x1cbf2b||0x1f4;return function(_0x21307a){logger[_0xc66b('0x26')](_0x21307a['stack']);if(_0x21307a['name']){delete _0x21307a['name'];}_0x30d030[_0xc66b('0x18')](_0x1cbf2b)[_0xc66b('0x27')](_0x21307a);};}exports['index']=function(_0x215163,_0x34aa21){var _0x1fb89a={},_0x2bf0f0={},_0x35cacd={'count':0x0,'rows':[]};var _0x3cdbc1=_[_0xc66b('0x28')](db[_0xc66b('0x29')][_0xc66b('0x2a')],function(_0x25e91f){return{'name':_0x25e91f[_0xc66b('0x2b')],'type':_0x25e91f[_0xc66b('0x2c')]['key']};});_0x2bf0f0[_0xc66b('0x2d')]=_['map'](_0x3cdbc1,_0xc66b('0x2e'));_0x2bf0f0[_0xc66b('0x2f')]=_[_0xc66b('0x30')](_0x215163[_0xc66b('0x2f')]);_0x2bf0f0['filters']=_[_0xc66b('0x31')](_0x2bf0f0[_0xc66b('0x2d')],_0x2bf0f0[_0xc66b('0x2f')]);_0x1fb89a['attributes']=_['intersection'](_0x2bf0f0[_0xc66b('0x2d')],qs[_0xc66b('0x32')](_0x215163['query'][_0xc66b('0x32')]));_0x1fb89a[_0xc66b('0x33')]=_0x1fb89a[_0xc66b('0x33')][_0xc66b('0x34')]?_0x1fb89a[_0xc66b('0x33')]:_0x2bf0f0[_0xc66b('0x2d')];if(!_0x215163[_0xc66b('0x2f')][_0xc66b('0x35')]('nolimit')){_0x1fb89a[_0xc66b('0x1c')]=qs[_0xc66b('0x1c')](_0x215163['query'][_0xc66b('0x1c')]);_0x1fb89a[_0xc66b('0x1b')]=qs[_0xc66b('0x1b')](_0x215163['query'][_0xc66b('0x1b')]);}_0x1fb89a['order']=qs[_0xc66b('0x36')](_0x215163['query'][_0xc66b('0x36')]);_0x1fb89a[_0xc66b('0x37')]=qs[_0xc66b('0x38')](_[_0xc66b('0x39')](_0x215163[_0xc66b('0x2f')],_0x2bf0f0['filters']),_0x3cdbc1);if(_0x215163['query'][_0xc66b('0x3a')]){_0x1fb89a[_0xc66b('0x37')]=_[_0xc66b('0x3b')](_0x1fb89a['where'],{'$or':_[_0xc66b('0x28')](_0x3cdbc1,function(_0x5e80ae){if(_0x5e80ae[_0xc66b('0x2c')]!==_0xc66b('0x3c')){var _0x3322d3={};_0x3322d3[_0x5e80ae[_0xc66b('0x2e')]]={'$like':'%'+_0x215163['query']['filter']+'%'};return _0x3322d3;}})});}_0x1fb89a=_[_0xc66b('0x3b')]({},_0x1fb89a,_0x215163[_0xc66b('0x3d')]);var _0x554cfa={'where':_0x1fb89a[_0xc66b('0x37')]};return db[_0xc66b('0x29')]['count'](_0x554cfa)[_0xc66b('0x25')](function(_0x3b93b9){_0x35cacd['count']=_0x3b93b9;if(_0x215163[_0xc66b('0x2f')][_0xc66b('0x3e')]){_0x1fb89a[_0xc66b('0x3f')]=[{'all':!![]}];}return db['FreshsalesField'][_0xc66b('0x40')](_0x1fb89a);})['then'](function(_0x49b569){_0x35cacd[_0xc66b('0x41')]=_0x49b569;return _0x35cacd;})[_0xc66b('0x25')](respondWithFilteredResult(_0x34aa21,_0x1fb89a))[_0xc66b('0x42')](handleError(_0x34aa21,null));};exports[_0xc66b('0x43')]=function(_0x10c804,_0x292fcb){var _0xe98cc4={'raw':!![],'where':{'id':_0x10c804['params']['id']}},_0x5cc1e2={};_0x5cc1e2[_0xc66b('0x2d')]=_['keys'](db[_0xc66b('0x29')]['rawAttributes']);_0x5cc1e2[_0xc66b('0x2f')]=_[_0xc66b('0x30')](_0x10c804['query']);_0x5cc1e2[_0xc66b('0x38')]=_[_0xc66b('0x31')](_0x5cc1e2[_0xc66b('0x2d')],_0x5cc1e2[_0xc66b('0x2f')]);_0xe98cc4[_0xc66b('0x33')]=_[_0xc66b('0x31')](_0x5cc1e2[_0xc66b('0x2d')],qs['fields'](_0x10c804['query'][_0xc66b('0x32')]));_0xe98cc4[_0xc66b('0x33')]=_0xe98cc4[_0xc66b('0x33')]['length']?_0xe98cc4[_0xc66b('0x33')]:_0x5cc1e2[_0xc66b('0x2d')];if(_0x10c804[_0xc66b('0x2f')]['includeAll']){_0xe98cc4[_0xc66b('0x3f')]=[{'all':!![]}];}_0xe98cc4=_[_0xc66b('0x3b')]({},_0xe98cc4,_0x10c804[_0xc66b('0x3d')]);return db['FreshsalesField'][_0xc66b('0x44')](_0xe98cc4)[_0xc66b('0x25')](handleEntityNotFound(_0x292fcb,null))[_0xc66b('0x25')](respondWithResult(_0x292fcb,null))[_0xc66b('0x42')](handleError(_0x292fcb,null));};exports[_0xc66b('0x45')]=function(_0xfafff8,_0x5cd3c9){return db[_0xc66b('0x29')][_0xc66b('0x45')](_0xfafff8[_0xc66b('0x46')],{})[_0xc66b('0x25')](respondWithResult(_0x5cd3c9,0xc9))['catch'](handleError(_0x5cd3c9,null));};exports['update']=function(_0x374c01,_0x5254ab){if(_0x374c01[_0xc66b('0x46')]['id']){delete _0x374c01[_0xc66b('0x46')]['id'];}return db[_0xc66b('0x29')][_0xc66b('0x44')]({'where':{'id':_0x374c01['params']['id']}})[_0xc66b('0x25')](handleEntityNotFound(_0x5254ab,null))[_0xc66b('0x25')](saveUpdates(_0x374c01[_0xc66b('0x46')],null))[_0xc66b('0x25')](respondWithResult(_0x5254ab,null))[_0xc66b('0x42')](handleError(_0x5254ab,null));};exports[_0xc66b('0x24')]=function(_0x25df63,_0x1d91a8){return db[_0xc66b('0x29')][_0xc66b('0x44')]({'where':{'id':_0x25df63[_0xc66b('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d91a8,null))['then'](removeEntity(_0x1d91a8,null))[_0xc66b('0x42')](handleError(_0x1d91a8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index bda4112..5ee5e1a 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4dc=['freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields'];(function(_0x164b3b,_0x54ad7f){var _0x38fac6=function(_0x59b119){while(--_0x59b119){_0x164b3b['push'](_0x164b3b['shift']());}};_0x38fac6(++_0x54ad7f);}(_0xd4dc,0xff));var _0xcd4d=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xd4dc[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0xcd4d('0x0'));var util=require('util');var logger=require(_0xcd4d('0x1'))(_0xcd4d('0x2'));var moment=require(_0xcd4d('0x3'));var BPromise=require(_0xcd4d('0x4'));var rp=require(_0xcd4d('0x5'));var fs=require('fs');var path=require(_0xcd4d('0x6'));var rimraf=require(_0xcd4d('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd4d('0x8'));module['exports']=function(_0x5d70fb,_0x3c5bbd){return _0x5d70fb['define'](_0xcd4d('0x9'),attributes,{'tableName':_0xcd4d('0xa'),'paranoid':![],'indexes':[{'name':_0xcd4d('0xb'),'fields':[_0xcd4d('0xc'),_0xcd4d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8cb=['rimraf','../../config/environment','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd7309,_0x4bc700){var _0x2ad2cc=function(_0x3134a4){while(--_0x3134a4){_0xd7309['push'](_0xd7309['shift']());}};_0x2ad2cc(++_0x4bc700);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x40c585,_0x663802){_0x40c585=_0x40c585-0x0;var _0x15c3bd=_0xb8cb[_0x40c585];return _0x15c3bd;};'use strict';var _=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var logger=require(_0xbb8c('0x2'))(_0xbb8c('0x3'));var moment=require(_0xbb8c('0x4'));var BPromise=require(_0xbb8c('0x5'));var rp=require(_0xbb8c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb8c('0x7'));var config=require(_0xbb8c('0x8'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x3b2ad2,_0x27c59e){return _0x3b2ad2[_0xbb8c('0x9')]('FreshsalesField',attributes,{'tableName':_0xbb8c('0xa'),'paranoid':![],'indexes':[{'name':_0xbb8c('0xb'),'fields':[_0xbb8c('0xc'),_0xbb8c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index b129d17..5d940d2 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5ee78d,_0x2f6bd6){var _0xf942bb=function(_0x3d821e){while(--_0x3d821e){_0x5ee78d['push'](_0x5ee78d['shift']());}};_0xf942bb(++_0x2f6bd6);}(_0xafc4,0x69));var _0x4afc=function(_0x340db6,_0x50fed9){_0x340db6=_0x340db6-0x0;var _0x4e04a2=_0xafc4[_0x340db6];return _0x4e04a2;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file +var _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x59268d,_0x427b8b){var _0x171163=function(_0x4ea5d9){while(--_0x4ea5d9){_0x59268d['push'](_0x59268d['shift']());}};_0x171163(++_0x427b8b);}(_0x4c60,0xc1));var _0x04c6=function(_0x40e892,_0x2b9393){_0x40e892=_0x40e892-0x0;var _0x36941c=_0x4c60[_0x40e892];return _0x36941c;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 21bc058..dae5f5b 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4e1373,_0x53fbd3){var _0x38a749=function(_0x3aca8d){while(--_0x3aca8d){_0x4e1373['push'](_0x4e1373['shift']());}};_0x38a749(++_0x53fbd3);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x494171,_0x3260ce){var _0x2ffd0b=function(_0x310cfa){while(--_0x310cfa){_0x494171['push'](_0x494171['shift']());}};_0x2ffd0b(++_0x3260ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3609890..b0a3160 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf4=['username','integrationTab','newTab','STRING'];(function(_0x1b95b7,_0xd1cc63){var _0x192d6c=function(_0x5729d0){while(--_0x5729d0){_0x1b95b7['push'](_0x1b95b7['shift']());}};_0x192d6c(++_0xd1cc63);}(_0xacf4,0xe7));var _0x4acf=function(_0x5aaf93,_0x5c0001){_0x5aaf93=_0x5aaf93-0x0;var _0x17d307=_0xacf4[_0x5aaf93];return _0x17d307;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4acf('0x0')]},'description':{'type':Sequelize[_0x4acf('0x0')]},'username':{'type':Sequelize[_0x4acf('0x0')],'unique':_0x4acf('0x1')},'remoteUri':{'type':Sequelize[_0x4acf('0x0')]},'password':{'type':Sequelize[_0x4acf('0x0')]},'clientId':{'type':Sequelize[_0x4acf('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x4acf('0x0')]},'serverUrl':{'type':Sequelize[_0x4acf('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4acf('0x2'),_0x4acf('0x3')),'defaultValue':_0x4acf('0x2')}}; \ No newline at end of file +var _0x02d4=['username','integrationTab','newTab','sequelize','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x02d4,0x111));var _0x402d=function(_0x199a93,_0x53fda3){_0x199a93=_0x199a93-0x0;var _0x98f907=_0x02d4[_0x199a93];return _0x98f907;};'use strict';var Sequelize=require(_0x402d('0x0'));module['exports']={'name':{'type':Sequelize[_0x402d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x402d('0x1')],'unique':_0x402d('0x2')},'remoteUri':{'type':Sequelize[_0x402d('0x1')]},'password':{'type':Sequelize[_0x402d('0x1')]},'clientId':{'type':Sequelize[_0x402d('0x1')]},'clientSecret':{'type':Sequelize[_0x402d('0x1')]},'securityToken':{'type':Sequelize[_0x402d('0x1')]},'serverUrl':{'type':Sequelize[_0x402d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x402d('0x3'),_0x402d('0x4')),'defaultValue':_0x402d('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0cd0685..948def1 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6e3=['sort','where','pick','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','remoteUri','clientId','username','password','substring','lastIndexOf','Connection','clientSecret','login','securityToken','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true','false','test','getFields','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','nolimit','order'];(function(_0x2cdcf9,_0x8a09d1){var _0x39412d=function(_0x7b476e){while(--_0x7b476e){_0x2cdcf9['push'](_0x2cdcf9['shift']());}};_0x39412d(++_0x8a09d1);}(_0xd6e3,0x143));var _0x3d6e=function(_0x18958f,_0x1f40af){_0x18958f=_0x18958f-0x0;var _0xe390d1=_0xd6e3[_0x18958f];return _0xe390d1;};'use strict';var emlformat=require(_0x3d6e('0x0'));var rimraf=require(_0x3d6e('0x1'));var zipdir=require(_0x3d6e('0x2'));var jsonpatch=require(_0x3d6e('0x3'));var rp=require(_0x3d6e('0x4'));var moment=require(_0x3d6e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3d6e('0x6'));var util=require(_0x3d6e('0x7'));var path=require(_0x3d6e('0x8'));var sox=require('sox');var csv=require(_0x3d6e('0x9'));var ejs=require(_0x3d6e('0xa'));var fs=require('fs');var fs_extra=require(_0x3d6e('0xb'));var _=require(_0x3d6e('0xc'));var squel=require('squel');var crypto=require(_0x3d6e('0xd'));var jsforce=require(_0x3d6e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d6e('0xf'));var Papa=require(_0x3d6e('0x10'));var Redis=require(_0x3d6e('0x11'));var authService=require(_0x3d6e('0x12'));var qs=require(_0x3d6e('0x13'));var as=require(_0x3d6e('0x14'));var hardwareService=require(_0x3d6e('0x15'));var logger=require(_0x3d6e('0x16'))(_0x3d6e('0x17'));var utils=require(_0x3d6e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3d6e('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3d6e('0x1a'));function respondWithStatusCode(_0x5250c6,_0x14006a){_0x14006a=_0x14006a||0xcc;return function(_0x35524b){if(_0x35524b){return _0x5250c6['sendStatus'](_0x14006a);}return _0x5250c6['status'](_0x14006a)['end']();};}function respondWithResult(_0x353cdc,_0x2a4672){_0x2a4672=_0x2a4672||0xc8;return function(_0x4c78dc){if(_0x4c78dc){return _0x353cdc['status'](_0x2a4672)[_0x3d6e('0x1b')](_0x4c78dc);}};}function respondWithFilteredResult(_0x222ea2,_0x205413){return function(_0x10f4fa){if(_0x10f4fa){var _0x34fb70=typeof _0x205413[_0x3d6e('0x1c')]===_0x3d6e('0x1d')&&typeof _0x205413[_0x3d6e('0x1e')]===_0x3d6e('0x1d');var _0xd92cb1=_0x10f4fa[_0x3d6e('0x1f')];var _0x265aeb=_0x34fb70?0x0:_0x205413[_0x3d6e('0x1c')];var _0x578617=_0x34fb70?_0x10f4fa['count']:_0x205413[_0x3d6e('0x1c')]+_0x205413[_0x3d6e('0x1e')];var _0x579226;if(_0x578617>=_0xd92cb1){_0x578617=_0xd92cb1;_0x579226=0xc8;}else{_0x579226=0xce;}_0x222ea2[_0x3d6e('0x20')](_0x579226);return _0x222ea2[_0x3d6e('0x21')](_0x3d6e('0x22'),_0x265aeb+'-'+_0x578617+'/'+_0xd92cb1)[_0x3d6e('0x1b')](_0x10f4fa);}return null;};}function patchUpdates(_0x33ad57){return function(_0x546bef){try{jsonpatch[_0x3d6e('0x23')](_0x546bef,_0x33ad57,!![]);}catch(_0x17e59f){return BPromise[_0x3d6e('0x24')](_0x17e59f);}return _0x546bef[_0x3d6e('0x25')]();};}function saveUpdates(_0x296880,_0x49a3ea){return function(_0x47cf3e){if(_0x47cf3e){return _0x47cf3e[_0x3d6e('0x26')](_0x296880)[_0x3d6e('0x27')](function(_0x300c48){return _0x300c48;});}return null;};}function removeEntity(_0x192df2,_0x41cc63){return function(_0x4e26a5){if(_0x4e26a5){return _0x4e26a5['destroy']()[_0x3d6e('0x27')](function(){_0x192df2[_0x3d6e('0x20')](0xcc)[_0x3d6e('0x28')]();});}};}function handleEntityNotFound(_0x290126,_0x40c922){return function(_0x263784){if(!_0x263784){_0x290126[_0x3d6e('0x29')](0x194);}return _0x263784;};}function handleError(_0x3a137f,_0x373345){_0x373345=_0x373345||0x1f4;return function(_0x3ed857){logger[_0x3d6e('0x2a')](_0x3ed857[_0x3d6e('0x2b')]);if(_0x3ed857[_0x3d6e('0x2c')]){delete _0x3ed857['name'];}_0x3a137f[_0x3d6e('0x20')](_0x373345)['send'](_0x3ed857);};}exports[_0x3d6e('0x2d')]=function(_0x2b6b5b,_0x466ccb){var _0x1d72cb={},_0x5acc79={},_0x2bd449={'count':0x0,'rows':[]};var _0x37de42=_[_0x3d6e('0x2e')](db['SalesforceAccount'][_0x3d6e('0x2f')],function(_0x48db59){return{'name':_0x48db59['fieldName'],'type':_0x48db59[_0x3d6e('0x30')]['key']};});_0x5acc79[_0x3d6e('0x31')]=_[_0x3d6e('0x2e')](_0x37de42,_0x3d6e('0x2c'));_0x5acc79[_0x3d6e('0x32')]=_[_0x3d6e('0x33')](_0x2b6b5b[_0x3d6e('0x32')]);_0x5acc79[_0x3d6e('0x34')]=_[_0x3d6e('0x35')](_0x5acc79[_0x3d6e('0x31')],_0x5acc79['query']);_0x1d72cb[_0x3d6e('0x36')]=_[_0x3d6e('0x35')](_0x5acc79[_0x3d6e('0x31')],qs['fields'](_0x2b6b5b[_0x3d6e('0x32')]['fields']));_0x1d72cb[_0x3d6e('0x36')]=_0x1d72cb[_0x3d6e('0x36')][_0x3d6e('0x37')]?_0x1d72cb[_0x3d6e('0x36')]:_0x5acc79[_0x3d6e('0x31')];if(!_0x2b6b5b[_0x3d6e('0x32')]['hasOwnProperty'](_0x3d6e('0x38'))){_0x1d72cb['limit']=qs['limit'](_0x2b6b5b[_0x3d6e('0x32')][_0x3d6e('0x1e')]);_0x1d72cb[_0x3d6e('0x1c')]=qs[_0x3d6e('0x1c')](_0x2b6b5b['query'][_0x3d6e('0x1c')]);}_0x1d72cb[_0x3d6e('0x39')]=qs[_0x3d6e('0x3a')](_0x2b6b5b[_0x3d6e('0x32')][_0x3d6e('0x3a')]);_0x1d72cb[_0x3d6e('0x3b')]=qs[_0x3d6e('0x34')](_[_0x3d6e('0x3c')](_0x2b6b5b[_0x3d6e('0x32')],_0x5acc79[_0x3d6e('0x34')]),_0x37de42);if(_0x2b6b5b['query'][_0x3d6e('0x3d')]){_0x1d72cb[_0x3d6e('0x3b')]=_[_0x3d6e('0x3e')](_0x1d72cb[_0x3d6e('0x3b')],{'$or':_[_0x3d6e('0x2e')](_0x37de42,function(_0x187dee){if(_0x187dee[_0x3d6e('0x30')]!==_0x3d6e('0x3f')){var _0x3b462e={};_0x3b462e[_0x187dee['name']]={'$like':'%'+_0x2b6b5b[_0x3d6e('0x32')][_0x3d6e('0x3d')]+'%'};return _0x3b462e;}})});}_0x1d72cb=_['merge']({},_0x1d72cb,_0x2b6b5b[_0x3d6e('0x40')]);var _0xa74ea7={'where':_0x1d72cb[_0x3d6e('0x3b')]};return db[_0x3d6e('0x41')][_0x3d6e('0x1f')](_0xa74ea7)[_0x3d6e('0x27')](function(_0x56684a){_0x2bd449['count']=_0x56684a;if(_0x2b6b5b[_0x3d6e('0x32')][_0x3d6e('0x42')]){_0x1d72cb['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x3d6e('0x43')](_0x1d72cb);})[_0x3d6e('0x27')](function(_0x41628e){_0x2bd449[_0x3d6e('0x44')]=_0x41628e;return _0x2bd449;})[_0x3d6e('0x27')](respondWithFilteredResult(_0x466ccb,_0x1d72cb))[_0x3d6e('0x45')](handleError(_0x466ccb,null));};exports[_0x3d6e('0x46')]=function(_0x37a2aa,_0x48f5a6){var _0x37c949={'raw':![],'where':{'id':_0x37a2aa[_0x3d6e('0x47')]['id']}},_0x3d387c={};_0x3d387c[_0x3d6e('0x31')]=_[_0x3d6e('0x33')](db[_0x3d6e('0x41')][_0x3d6e('0x2f')]);_0x3d387c[_0x3d6e('0x32')]=_['keys'](_0x37a2aa[_0x3d6e('0x32')]);_0x3d387c['filters']=_[_0x3d6e('0x35')](_0x3d387c['model'],_0x3d387c['query']);_0x37c949[_0x3d6e('0x36')]=_[_0x3d6e('0x35')](_0x3d387c[_0x3d6e('0x31')],qs['fields'](_0x37a2aa['query'][_0x3d6e('0x48')]));_0x37c949[_0x3d6e('0x36')]=_0x37c949[_0x3d6e('0x36')]['length']?_0x37c949['attributes']:_0x3d387c[_0x3d6e('0x31')];if(_0x37a2aa[_0x3d6e('0x32')][_0x3d6e('0x42')]){_0x37c949[_0x3d6e('0x49')]=[{'all':!![]}];}_0x37c949=_[_0x3d6e('0x3e')]({},_0x37c949,_0x37a2aa[_0x3d6e('0x40')]);return db[_0x3d6e('0x41')][_0x3d6e('0x4a')](_0x37c949)[_0x3d6e('0x27')](handleEntityNotFound(_0x48f5a6,null))[_0x3d6e('0x27')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};exports[_0x3d6e('0x4b')]=function(_0x4787b3,_0x5cf63e){return db['SalesforceAccount'][_0x3d6e('0x4b')](_0x4787b3[_0x3d6e('0x4c')],{})['then'](respondWithResult(_0x5cf63e,0xc9))['catch'](handleError(_0x5cf63e,null));};exports[_0x3d6e('0x26')]=function(_0x9f371a,_0x54e12e){if(_0x9f371a[_0x3d6e('0x4c')]['id']){delete _0x9f371a[_0x3d6e('0x4c')]['id'];}return db[_0x3d6e('0x41')][_0x3d6e('0x4a')]({'where':{'id':_0x9f371a[_0x3d6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x54e12e,null))[_0x3d6e('0x27')](saveUpdates(_0x9f371a[_0x3d6e('0x4c')],null))[_0x3d6e('0x27')](respondWithResult(_0x54e12e,null))['catch'](handleError(_0x54e12e,null));};exports['destroy']=function(_0x175f7b,_0x193226){return db[_0x3d6e('0x41')][_0x3d6e('0x4a')]({'where':{'id':_0x175f7b[_0x3d6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x193226,null))[_0x3d6e('0x27')](removeEntity(_0x193226,null))[_0x3d6e('0x45')](handleError(_0x193226,null));};exports[_0x3d6e('0x4d')]=function(_0x22cd28,_0x36bb91,_0x4f3384){var _0x51ebe5={};var _0x1e4fc7={};var _0x28f87b;var _0x358e83;return db[_0x3d6e('0x41')][_0x3d6e('0x4e')]({'where':{'id':_0x22cd28[_0x3d6e('0x47')]['id']}})[_0x3d6e('0x27')](handleEntityNotFound(_0x36bb91,null))[_0x3d6e('0x27')](function(_0x33d053){if(_0x33d053){_0x28f87b=_0x33d053;_0x1e4fc7[_0x3d6e('0x31')]=_['keys'](db[_0x3d6e('0x4f')]['rawAttributes']);_0x1e4fc7['query']=_[_0x3d6e('0x33')](_0x22cd28['query']);_0x1e4fc7[_0x3d6e('0x34')]=_[_0x3d6e('0x35')](_0x1e4fc7['model'],_0x1e4fc7[_0x3d6e('0x32')]);_0x51ebe5[_0x3d6e('0x36')]=_['intersection'](_0x1e4fc7[_0x3d6e('0x31')],qs[_0x3d6e('0x48')](_0x22cd28[_0x3d6e('0x32')][_0x3d6e('0x48')]));_0x51ebe5[_0x3d6e('0x36')]=_0x51ebe5[_0x3d6e('0x36')][_0x3d6e('0x37')]?_0x51ebe5[_0x3d6e('0x36')]:_0x1e4fc7['model'];_0x51ebe5[_0x3d6e('0x39')]=qs[_0x3d6e('0x3a')](_0x22cd28[_0x3d6e('0x32')]['sort']);_0x51ebe5[_0x3d6e('0x3b')]=qs[_0x3d6e('0x34')](_['pick'](_0x22cd28['query'],_0x1e4fc7[_0x3d6e('0x34')]));if(_0x22cd28[_0x3d6e('0x32')][_0x3d6e('0x3d')]){_0x51ebe5[_0x3d6e('0x3b')]=_[_0x3d6e('0x3e')](_0x51ebe5['where'],{'$or':_['map'](_0x51ebe5['attributes'],function(_0x28ffac){var _0x5d2be3={};_0x5d2be3[_0x28ffac]={'$like':'%'+_0x22cd28[_0x3d6e('0x32')]['filter']+'%'};return _0x5d2be3;})});}_0x51ebe5=_[_0x3d6e('0x3e')]({},_0x51ebe5,_0x22cd28['options']);return _0x28f87b[_0x3d6e('0x4d')](_0x51ebe5);}})[_0x3d6e('0x27')](function(_0x3bad9f){if(_0x3bad9f){_0x358e83=_0x3bad9f[_0x3d6e('0x37')];if(!_0x22cd28[_0x3d6e('0x32')][_0x3d6e('0x50')]('nolimit')){_0x51ebe5[_0x3d6e('0x1e')]=qs[_0x3d6e('0x1e')](_0x22cd28['query'][_0x3d6e('0x1e')]);_0x51ebe5[_0x3d6e('0x1c')]=qs[_0x3d6e('0x1c')](_0x22cd28[_0x3d6e('0x32')][_0x3d6e('0x1c')]);}return _0x28f87b['getConfigurations'](_0x51ebe5);}})[_0x3d6e('0x27')](function(_0x3792f8){if(_0x3792f8){return _0x3792f8?{'count':_0x358e83,'rows':_0x3792f8}:null;}})['then'](respondWithResult(_0x36bb91,null))[_0x3d6e('0x45')](handleError(_0x36bb91,null));};exports[_0x3d6e('0x51')]=function(_0xc9d95c,_0x18d8b0,_0x2e74b4){if(_0xc9d95c[_0x3d6e('0x4c')]['id']){delete _0xc9d95c[_0x3d6e('0x4c')]['id'];}return db[_0x3d6e('0x41')][_0x3d6e('0x4e')]({'where':{'id':_0xc9d95c['params']['id']}})[_0x3d6e('0x27')](handleEntityNotFound(_0x18d8b0,null))[_0x3d6e('0x27')](function(_0x12c235){if(_0x12c235){_0xc9d95c['body']['AccountId']=_0x12c235['id'];_0xc9d95c[_0x3d6e('0x4c')][_0x3d6e('0x52')]=integrations[_0x3d6e('0x53')](_0xc9d95c[_0x3d6e('0x4c')][_0x3d6e('0x54')],_0xc9d95c[_0x3d6e('0x4c')][_0x3d6e('0x30')]);_0xc9d95c[_0x3d6e('0x4c')]['Descriptions']=integrations[_0x3d6e('0x55')](_0xc9d95c[_0x3d6e('0x4c')][_0x3d6e('0x54')],_0xc9d95c[_0x3d6e('0x4c')]['type']);return db[_0x3d6e('0x4f')][_0x3d6e('0x4b')](_0xc9d95c[_0x3d6e('0x4c')],{'include':[{'model':db['SalesforceField'],'as':_0x3d6e('0x52')},{'model':db[_0x3d6e('0x56')],'as':_0x3d6e('0x57')}]});}return null;})['then'](respondWithResult(_0x18d8b0,null))[_0x3d6e('0x45')](handleError(_0x18d8b0,null));};exports['getFields']=function(_0x39c286,_0xaa1350,_0x94e9dc){var _0x5c0cfa;var _0x3c70a9='';var _0x41b90a='Task';return db[_0x3d6e('0x41')]['findOne']({'where':{'id':_0x39c286[_0x3d6e('0x47')]['id']},'attributes':['id',_0x3d6e('0x58'),_0x3d6e('0x59'),'clientSecret',_0x3d6e('0x5a'),_0x3d6e('0x5b'),'securityToken']})[_0x3d6e('0x27')](handleEntityNotFound(_0xaa1350,null))[_0x3d6e('0x27')](function(_0x4fdcf2){if(_0x4fdcf2){_0x3c70a9=_0x4fdcf2[_0x3d6e('0x58')];var _0x3fc246=_0x3c70a9['slice'](-0x1);if(_0x3fc246==='/'){_0x3c70a9=_0x3c70a9[_0x3d6e('0x5c')](0x0,_0x3c70a9[_0x3d6e('0x5d')](_0x3fc246));}_0x5c0cfa=new jsforce[(_0x3d6e('0x5e'))]({'oauth2':{'loginUrl':_0x3c70a9,'clientId':_0x4fdcf2['clientId'],'clientSecret':_0x4fdcf2[_0x3d6e('0x5f')]}});return _0x5c0cfa[_0x3d6e('0x60')](_0x4fdcf2[_0x3d6e('0x5a')],_0x4fdcf2[_0x3d6e('0x5b')]['concat'](_0x4fdcf2[_0x3d6e('0x61')]));}})['then'](function(_0x184107){if(_0x184107){if(!_['isNil'](_0x39c286['query'][_0x3d6e('0x62')])){_0x41b90a=_0x39c286['query'][_0x3d6e('0x62')];}return _0x5c0cfa[_0x3d6e('0x63')](_0x41b90a)[_0x3d6e('0x64')]();}})[_0x3d6e('0x27')](function(_0x187ce8){var _0x2b055a=[_0x3d6e('0x65'),_0x3d6e('0x66'),_0x3d6e('0x67'),_0x3d6e('0x68'),_0x3d6e('0x69'),_0x3d6e('0x6a')];var _0x25db54=[_0x3d6e('0x6b'),_0x3d6e('0x6c'),_0x3d6e('0x6d'),_0x3d6e('0x6e'),_0x3d6e('0x6f'),_0x3d6e('0x70'),_0x3d6e('0x71')];if(_0x187ce8){_[_0x3d6e('0x72')](_0x187ce8['fields'],function(_0x5bb8f4){return _0x2b055a['includes'](_0x5bb8f4[_0x3d6e('0x2c')])||!_0x25db54[_0x3d6e('0x73')](_0x5bb8f4[_0x3d6e('0x30')]);});return{'count':_0x187ce8[_0x3d6e('0x48')][_0x3d6e('0x37')],'rows':_[_0x3d6e('0x2e')](_0x187ce8['fields'],function(_0x2c6955){return{'id':_0x2c6955[_0x3d6e('0x2c')],'name':_0x2c6955[_0x3d6e('0x74')],'custom':_0x2c6955['custom'],'options':_0x2c6955[_0x3d6e('0x75')][_0x3d6e('0x37')]>0x0?_['map'](_0x2c6955[_0x3d6e('0x75')],function(_0x1b6941){return{'name':_0x1b6941[_0x3d6e('0x74')],'value':_0x1b6941[_0x3d6e('0x76')]};}):_0x2c6955[_0x3d6e('0x30')]==_0x3d6e('0x6e')?[{'name':_0x3d6e('0x77'),'value':_0x3d6e('0x78')},{'name':'False','value':_0x3d6e('0x79')}]:[]};})};}})[_0x3d6e('0x27')](respondWithResult(_0xaa1350,null))[_0x3d6e('0x45')](function(_0x4b1eda){var _0x59e168=_0x39c286[_0x3d6e('0x32')][_0x3d6e('0x7a')]?0x1f4:_0x4b1eda['statusCode']||0x1f4;logger[_0x3d6e('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x3d6e('0x7b'),_0x59e168,JSON[_0x3d6e('0x7c')](_0x4b1eda));delete _0x4b1eda[_0x3d6e('0x2c')];if(_0x59e168===0x191){_0x59e168=0x190;}_0xaa1350[_0x3d6e('0x20')](_0x59e168)[_0x3d6e('0x7d')](_0x39c286[_0x3d6e('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4b1eda[_0x3d6e('0x7e')]}:_0x4b1eda);});}; \ No newline at end of file +var _0x54b6=['index','map','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','SalesforceAccount','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','find','body','getConfigurations','findOne','SalesforceConfiguration','length','filter','options','AccountId','Subjects','getSubjects','channel','create','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','substring','lastIndexOf','Connection','login','password','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','Subject','Description','string','int','picklist','email','phone','includes','custom','picklistValues','label','value','boolean','True','False','false','test','statusCode','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x15f6d1,_0x47a3d0){var _0x4fe2f1=function(_0x3f1965){while(--_0x3f1965){_0x15f6d1['push'](_0x15f6d1['shift']());}};_0x4fe2f1(++_0x47a3d0);}(_0x54b6,0xca));var _0x654b=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x54b6[_0x4bb581];return _0x316bf5;};'use strict';var emlformat=require(_0x654b('0x0'));var rimraf=require(_0x654b('0x1'));var zipdir=require(_0x654b('0x2'));var jsonpatch=require(_0x654b('0x3'));var rp=require(_0x654b('0x4'));var moment=require(_0x654b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x654b('0x6'));var util=require('util');var path=require(_0x654b('0x7'));var sox=require(_0x654b('0x8'));var csv=require(_0x654b('0x9'));var ejs=require(_0x654b('0xa'));var fs=require('fs');var fs_extra=require(_0x654b('0xb'));var _=require(_0x654b('0xc'));var squel=require(_0x654b('0xd'));var crypto=require('crypto');var jsforce=require(_0x654b('0xe'));var deskjs=require(_0x654b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x654b('0x10'));var Papa=require('papaparse');var Redis=require(_0x654b('0x11'));var authService=require(_0x654b('0x12'));var qs=require(_0x654b('0x13'));var as=require(_0x654b('0x14'));var hardwareService=require(_0x654b('0x15'));var logger=require(_0x654b('0x16'))('api');var utils=require(_0x654b('0x17'));var config=require(_0x654b('0x18'));var licenseUtil=require(_0x654b('0x19'));var db=require(_0x654b('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xfa7d5c,_0x1fb0c3){_0x1fb0c3=_0x1fb0c3||0xcc;return function(_0x1a3686){if(_0x1a3686){return _0xfa7d5c[_0x654b('0x1b')](_0x1fb0c3);}return _0xfa7d5c[_0x654b('0x1c')](_0x1fb0c3)[_0x654b('0x1d')]();};}function respondWithResult(_0x514c9f,_0x22ff39){_0x22ff39=_0x22ff39||0xc8;return function(_0x4b616d){if(_0x4b616d){return _0x514c9f['status'](_0x22ff39)[_0x654b('0x1e')](_0x4b616d);}};}function respondWithFilteredResult(_0x1431cd,_0x5ba405){return function(_0x2b38bd){if(_0x2b38bd){var _0x465460=typeof _0x5ba405['offset']===_0x654b('0x1f')&&typeof _0x5ba405[_0x654b('0x20')]==='undefined';var _0x41ce21=_0x2b38bd[_0x654b('0x21')];var _0x38b2f4=_0x465460?0x0:_0x5ba405[_0x654b('0x22')];var _0x599495=_0x465460?_0x2b38bd[_0x654b('0x21')]:_0x5ba405[_0x654b('0x22')]+_0x5ba405[_0x654b('0x20')];var _0x39f67;if(_0x599495>=_0x41ce21){_0x599495=_0x41ce21;_0x39f67=0xc8;}else{_0x39f67=0xce;}_0x1431cd[_0x654b('0x1c')](_0x39f67);return _0x1431cd[_0x654b('0x23')](_0x654b('0x24'),_0x38b2f4+'-'+_0x599495+'/'+_0x41ce21)[_0x654b('0x1e')](_0x2b38bd);}return null;};}function patchUpdates(_0x47069d){return function(_0x414a23){try{jsonpatch[_0x654b('0x25')](_0x414a23,_0x47069d,!![]);}catch(_0x4f401a){return BPromise[_0x654b('0x26')](_0x4f401a);}return _0x414a23[_0x654b('0x27')]();};}function saveUpdates(_0x63bab0,_0x135a91){return function(_0x667ec6){if(_0x667ec6){return _0x667ec6[_0x654b('0x28')](_0x63bab0)[_0x654b('0x29')](function(_0x41d22d){return _0x41d22d;});}return null;};}function removeEntity(_0x10a56c,_0x2ccfb){return function(_0xc83be3){if(_0xc83be3){return _0xc83be3[_0x654b('0x2a')]()[_0x654b('0x29')](function(){_0x10a56c[_0x654b('0x1c')](0xcc)[_0x654b('0x1d')]();});}};}function handleEntityNotFound(_0x4770db,_0x3b9ba8){return function(_0x275b02){if(!_0x275b02){_0x4770db[_0x654b('0x1b')](0x194);}return _0x275b02;};}function handleError(_0x31f029,_0x513b94){_0x513b94=_0x513b94||0x1f4;return function(_0x316f46){logger[_0x654b('0x2b')](_0x316f46[_0x654b('0x2c')]);if(_0x316f46[_0x654b('0x2d')]){delete _0x316f46[_0x654b('0x2d')];}_0x31f029[_0x654b('0x1c')](_0x513b94)['send'](_0x316f46);};}exports[_0x654b('0x2e')]=function(_0x226ea2,_0x50a866){var _0x212d39={},_0x347f46={},_0x114dfc={'count':0x0,'rows':[]};var _0x10c53b=_[_0x654b('0x2f')](db['SalesforceAccount']['rawAttributes'],function(_0x4964c7){return{'name':_0x4964c7['fieldName'],'type':_0x4964c7[_0x654b('0x30')]['key']};});_0x347f46[_0x654b('0x31')]=_[_0x654b('0x2f')](_0x10c53b,_0x654b('0x2d'));_0x347f46[_0x654b('0x32')]=_[_0x654b('0x33')](_0x226ea2[_0x654b('0x32')]);_0x347f46[_0x654b('0x34')]=_[_0x654b('0x35')](_0x347f46['model'],_0x347f46['query']);_0x212d39['attributes']=_[_0x654b('0x35')](_0x347f46[_0x654b('0x31')],qs['fields'](_0x226ea2['query']['fields']));_0x212d39[_0x654b('0x36')]=_0x212d39[_0x654b('0x36')]['length']?_0x212d39[_0x654b('0x36')]:_0x347f46['model'];if(!_0x226ea2[_0x654b('0x32')][_0x654b('0x37')](_0x654b('0x38'))){_0x212d39[_0x654b('0x20')]=qs[_0x654b('0x20')](_0x226ea2[_0x654b('0x32')][_0x654b('0x20')]);_0x212d39[_0x654b('0x22')]=qs[_0x654b('0x22')](_0x226ea2['query'][_0x654b('0x22')]);}_0x212d39['order']=qs[_0x654b('0x39')](_0x226ea2['query']['sort']);_0x212d39['where']=qs[_0x654b('0x34')](_[_0x654b('0x3a')](_0x226ea2[_0x654b('0x32')],_0x347f46[_0x654b('0x34')]),_0x10c53b);if(_0x226ea2[_0x654b('0x32')]['filter']){_0x212d39[_0x654b('0x3b')]=_[_0x654b('0x3c')](_0x212d39['where'],{'$or':_[_0x654b('0x2f')](_0x10c53b,function(_0x2904bd){if(_0x2904bd[_0x654b('0x30')]!==_0x654b('0x3d')){var _0x4d28b5={};_0x4d28b5[_0x2904bd[_0x654b('0x2d')]]={'$like':'%'+_0x226ea2[_0x654b('0x32')]['filter']+'%'};return _0x4d28b5;}})});}_0x212d39=_[_0x654b('0x3c')]({},_0x212d39,_0x226ea2['options']);var _0x24d44d={'where':_0x212d39['where']};return db[_0x654b('0x3e')][_0x654b('0x21')](_0x24d44d)[_0x654b('0x29')](function(_0x1747fa){_0x114dfc['count']=_0x1747fa;if(_0x226ea2[_0x654b('0x32')]['includeAll']){_0x212d39[_0x654b('0x3f')]=[{'all':!![]}];}return db[_0x654b('0x3e')][_0x654b('0x40')](_0x212d39);})[_0x654b('0x29')](function(_0x56317d){_0x114dfc[_0x654b('0x41')]=_0x56317d;return _0x114dfc;})[_0x654b('0x29')](respondWithFilteredResult(_0x50a866,_0x212d39))[_0x654b('0x42')](handleError(_0x50a866,null));};exports[_0x654b('0x43')]=function(_0x4893a6,_0x2a1356){var _0x4f3265={'raw':![],'where':{'id':_0x4893a6[_0x654b('0x44')]['id']}},_0x95aad5={};_0x95aad5[_0x654b('0x31')]=_[_0x654b('0x33')](db['SalesforceAccount'][_0x654b('0x45')]);_0x95aad5[_0x654b('0x32')]=_[_0x654b('0x33')](_0x4893a6[_0x654b('0x32')]);_0x95aad5[_0x654b('0x34')]=_[_0x654b('0x35')](_0x95aad5[_0x654b('0x31')],_0x95aad5[_0x654b('0x32')]);_0x4f3265['attributes']=_[_0x654b('0x35')](_0x95aad5[_0x654b('0x31')],qs[_0x654b('0x46')](_0x4893a6[_0x654b('0x32')][_0x654b('0x46')]));_0x4f3265[_0x654b('0x36')]=_0x4f3265[_0x654b('0x36')]['length']?_0x4f3265[_0x654b('0x36')]:_0x95aad5[_0x654b('0x31')];if(_0x4893a6[_0x654b('0x32')][_0x654b('0x47')]){_0x4f3265[_0x654b('0x3f')]=[{'all':!![]}];}_0x4f3265=_[_0x654b('0x3c')]({},_0x4f3265,_0x4893a6['options']);return db[_0x654b('0x3e')][_0x654b('0x48')](_0x4f3265)[_0x654b('0x29')](handleEntityNotFound(_0x2a1356,null))['then'](respondWithResult(_0x2a1356,null))[_0x654b('0x42')](handleError(_0x2a1356,null));};exports['create']=function(_0x3b8412,_0x3ab9ae){return db['SalesforceAccount']['create'](_0x3b8412['body'],{})[_0x654b('0x29')](respondWithResult(_0x3ab9ae,0xc9))[_0x654b('0x42')](handleError(_0x3ab9ae,null));};exports[_0x654b('0x28')]=function(_0x5cc814,_0x52e0ff){if(_0x5cc814[_0x654b('0x49')]['id']){delete _0x5cc814[_0x654b('0x49')]['id'];}return db[_0x654b('0x3e')][_0x654b('0x48')]({'where':{'id':_0x5cc814['params']['id']}})[_0x654b('0x29')](handleEntityNotFound(_0x52e0ff,null))[_0x654b('0x29')](saveUpdates(_0x5cc814[_0x654b('0x49')],null))[_0x654b('0x29')](respondWithResult(_0x52e0ff,null))[_0x654b('0x42')](handleError(_0x52e0ff,null));};exports[_0x654b('0x2a')]=function(_0x2e038d,_0x786488){return db[_0x654b('0x3e')][_0x654b('0x48')]({'where':{'id':_0x2e038d['params']['id']}})['then'](handleEntityNotFound(_0x786488,null))[_0x654b('0x29')](removeEntity(_0x786488,null))[_0x654b('0x42')](handleError(_0x786488,null));};exports[_0x654b('0x4a')]=function(_0xb6bf26,_0x4bb0e2,_0x1ed007){var _0x1a104a={};var _0x12e10a={};var _0x46b5e9;var _0x2d32bd;return db[_0x654b('0x3e')][_0x654b('0x4b')]({'where':{'id':_0xb6bf26[_0x654b('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bb0e2,null))[_0x654b('0x29')](function(_0x337715){if(_0x337715){_0x46b5e9=_0x337715;_0x12e10a['model']=_[_0x654b('0x33')](db[_0x654b('0x4c')]['rawAttributes']);_0x12e10a[_0x654b('0x32')]=_[_0x654b('0x33')](_0xb6bf26[_0x654b('0x32')]);_0x12e10a[_0x654b('0x34')]=_['intersection'](_0x12e10a[_0x654b('0x31')],_0x12e10a['query']);_0x1a104a[_0x654b('0x36')]=_[_0x654b('0x35')](_0x12e10a[_0x654b('0x31')],qs[_0x654b('0x46')](_0xb6bf26[_0x654b('0x32')][_0x654b('0x46')]));_0x1a104a[_0x654b('0x36')]=_0x1a104a[_0x654b('0x36')][_0x654b('0x4d')]?_0x1a104a['attributes']:_0x12e10a['model'];_0x1a104a['order']=qs['sort'](_0xb6bf26[_0x654b('0x32')][_0x654b('0x39')]);_0x1a104a['where']=qs['filters'](_[_0x654b('0x3a')](_0xb6bf26[_0x654b('0x32')],_0x12e10a[_0x654b('0x34')]));if(_0xb6bf26['query'][_0x654b('0x4e')]){_0x1a104a[_0x654b('0x3b')]=_[_0x654b('0x3c')](_0x1a104a['where'],{'$or':_[_0x654b('0x2f')](_0x1a104a[_0x654b('0x36')],function(_0x298c96){var _0x2a9afc={};_0x2a9afc[_0x298c96]={'$like':'%'+_0xb6bf26[_0x654b('0x32')][_0x654b('0x4e')]+'%'};return _0x2a9afc;})});}_0x1a104a=_[_0x654b('0x3c')]({},_0x1a104a,_0xb6bf26[_0x654b('0x4f')]);return _0x46b5e9[_0x654b('0x4a')](_0x1a104a);}})[_0x654b('0x29')](function(_0x5a9ad7){if(_0x5a9ad7){_0x2d32bd=_0x5a9ad7[_0x654b('0x4d')];if(!_0xb6bf26[_0x654b('0x32')]['hasOwnProperty'](_0x654b('0x38'))){_0x1a104a[_0x654b('0x20')]=qs[_0x654b('0x20')](_0xb6bf26[_0x654b('0x32')]['limit']);_0x1a104a['offset']=qs[_0x654b('0x22')](_0xb6bf26[_0x654b('0x32')][_0x654b('0x22')]);}return _0x46b5e9[_0x654b('0x4a')](_0x1a104a);}})[_0x654b('0x29')](function(_0x37548c){if(_0x37548c){return _0x37548c?{'count':_0x2d32bd,'rows':_0x37548c}:null;}})[_0x654b('0x29')](respondWithResult(_0x4bb0e2,null))[_0x654b('0x42')](handleError(_0x4bb0e2,null));};exports['addConfiguration']=function(_0x4f3246,_0x29058e,_0x1ce48c){if(_0x4f3246[_0x654b('0x49')]['id']){delete _0x4f3246[_0x654b('0x49')]['id'];}return db['SalesforceAccount'][_0x654b('0x4b')]({'where':{'id':_0x4f3246[_0x654b('0x44')]['id']}})[_0x654b('0x29')](handleEntityNotFound(_0x29058e,null))[_0x654b('0x29')](function(_0x2892b3){if(_0x2892b3){_0x4f3246['body'][_0x654b('0x50')]=_0x2892b3['id'];_0x4f3246[_0x654b('0x49')][_0x654b('0x51')]=integrations[_0x654b('0x52')](_0x4f3246[_0x654b('0x49')][_0x654b('0x53')],_0x4f3246['body'][_0x654b('0x30')]);_0x4f3246['body']['Descriptions']=integrations['getDescriptions'](_0x4f3246[_0x654b('0x49')][_0x654b('0x53')],_0x4f3246[_0x654b('0x49')][_0x654b('0x30')]);return db[_0x654b('0x4c')][_0x654b('0x54')](_0x4f3246['body'],{'include':[{'model':db[_0x654b('0x55')],'as':_0x654b('0x51')},{'model':db[_0x654b('0x55')],'as':_0x654b('0x56')}]});}return null;})[_0x654b('0x29')](respondWithResult(_0x29058e,null))[_0x654b('0x42')](handleError(_0x29058e,null));};exports[_0x654b('0x57')]=function(_0x3bbeda,_0xa27363,_0x346a2d){var _0x3652bb;var _0x19c9e0='';var _0x5f302a=_0x654b('0x58');return db[_0x654b('0x3e')][_0x654b('0x4b')]({'where':{'id':_0x3bbeda[_0x654b('0x44')]['id']},'attributes':['id',_0x654b('0x59'),_0x654b('0x5a'),_0x654b('0x5b'),_0x654b('0x5c'),'password',_0x654b('0x5d')]})[_0x654b('0x29')](handleEntityNotFound(_0xa27363,null))[_0x654b('0x29')](function(_0x22d7f5){if(_0x22d7f5){_0x19c9e0=_0x22d7f5['remoteUri'];var _0x1c66ea=_0x19c9e0['slice'](-0x1);if(_0x1c66ea==='/'){_0x19c9e0=_0x19c9e0[_0x654b('0x5e')](0x0,_0x19c9e0[_0x654b('0x5f')](_0x1c66ea));}_0x3652bb=new jsforce[(_0x654b('0x60'))]({'oauth2':{'loginUrl':_0x19c9e0,'clientId':_0x22d7f5[_0x654b('0x5a')],'clientSecret':_0x22d7f5[_0x654b('0x5b')]}});return _0x3652bb[_0x654b('0x61')](_0x22d7f5[_0x654b('0x5c')],_0x22d7f5[_0x654b('0x62')][_0x654b('0x63')](_0x22d7f5['securityToken']));}})[_0x654b('0x29')](function(_0x332e9d){if(_0x332e9d){if(!_[_0x654b('0x64')](_0x3bbeda[_0x654b('0x32')][_0x654b('0x65')])){_0x5f302a=_0x3bbeda[_0x654b('0x32')][_0x654b('0x65')];}return _0x3652bb[_0x654b('0x66')](_0x5f302a)['describe']();}})[_0x654b('0x29')](function(_0x480f8d){var _0x4a5b58=[_0x654b('0x67'),_0x654b('0x68'),'IsReminderSet','IsRecurrence',_0x654b('0x69'),_0x654b('0x6a')];var _0x12b868=[_0x654b('0x6b'),_0x654b('0x6c'),_0x654b('0x6d'),'boolean',_0x654b('0x6e'),'textarea',_0x654b('0x6f')];if(_0x480f8d){_['remove'](_0x480f8d['fields'],function(_0x10b46b){return _0x4a5b58[_0x654b('0x70')](_0x10b46b[_0x654b('0x2d')])||!_0x12b868[_0x654b('0x70')](_0x10b46b[_0x654b('0x30')]);});return{'count':_0x480f8d['fields'][_0x654b('0x4d')],'rows':_[_0x654b('0x2f')](_0x480f8d[_0x654b('0x46')],function(_0x8b5987){return{'id':_0x8b5987['name'],'name':_0x8b5987['label'],'custom':_0x8b5987[_0x654b('0x71')],'options':_0x8b5987[_0x654b('0x72')]['length']>0x0?_[_0x654b('0x2f')](_0x8b5987['picklistValues'],function(_0x1e93b1){return{'name':_0x1e93b1[_0x654b('0x73')],'value':_0x1e93b1[_0x654b('0x74')]};}):_0x8b5987[_0x654b('0x30')]==_0x654b('0x75')?[{'name':_0x654b('0x76'),'value':'true'},{'name':_0x654b('0x77'),'value':_0x654b('0x78')}]:[]};})};}})[_0x654b('0x29')](respondWithResult(_0xa27363,null))['catch'](function(_0x32b583){var _0x2adb50=_0x3bbeda[_0x654b('0x32')][_0x654b('0x79')]?0x1f4:_0x32b583[_0x654b('0x7a')]||0x1f4;logger[_0x654b('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0x654b('0x57'),_0x2adb50,JSON['stringify'](_0x32b583));delete _0x32b583['name'];if(_0x2adb50===0x191){_0x2adb50=0x190;}_0xa27363['status'](_0x2adb50)[_0x654b('0x7b')](_0x3bbeda[_0x654b('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x32b583[_0x654b('0x7a')]}:_0x32b583);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d59fcad..c192c09 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.model.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35ba=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35ba,0x8c));var _0xa35b=function(_0x2f8140,_0x37076b){_0x2f8140=_0x2f8140-0x0;var _0x21bd12=_0x35ba[_0x2f8140];return _0x21bd12;};'use strict';var _=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var logger=require(_0xa35b('0x2'))(_0xa35b('0x3'));var moment=require('moment');var BPromise=require(_0xa35b('0x4'));var rp=require(_0xa35b('0x5'));var fs=require('fs');var path=require(_0xa35b('0x6'));var rimraf=require(_0xa35b('0x7'));var config=require(_0xa35b('0x8'));var attributes=require(_0xa35b('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xa35b('0xa')]=function(_0x5e6bf7,_0x7f0063){return _0x5e6bf7[_0xa35b('0xb')](_0xa35b('0xc'),attributes,{'tableName':_0xa35b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x756e=['./intSalesforceAccount.attributes','exports','define','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa91678,_0x4527c7){var _0x1b0875=function(_0x6bfc58){while(--_0x6bfc58){_0xa91678['push'](_0xa91678['shift']());}};_0x1b0875(++_0x4527c7);}(_0x756e,0x94));var _0xe756=function(_0xb0baff,_0x5e470a){_0xb0baff=_0xb0baff-0x0;var _0x3fc5c7=_0x756e[_0xb0baff];return _0x3fc5c7;};'use strict';var _=require(_0xe756('0x0'));var util=require(_0xe756('0x1'));var logger=require(_0xe756('0x2'))(_0xe756('0x3'));var moment=require(_0xe756('0x4'));var BPromise=require(_0xe756('0x5'));var rp=require(_0xe756('0x6'));var fs=require('fs');var path=require(_0xe756('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe756('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xe756('0x9')]=function(_0x2d06fd,_0x1e5a4b){return _0x2d06fd[_0xe756('0xa')]('SalesforceAccount',attributes,{'tableName':_0xe756('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 4ab5e9f..ee511a4 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb664=['request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','SalesforceAccount,\x20%s,\x20%s','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowSalesforceAccount','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x43decc,_0x27af21){var _0x547857=function(_0x34bb7a){while(--_0x34bb7a){_0x43decc['push'](_0x43decc['shift']());}};_0x547857(++_0x27af21);}(_0xb664,0x163));var _0x4b66=function(_0x22957a,_0x3b63f9){_0x22957a=_0x22957a-0x0;var _0x1d9dec=_0xb664[_0x22957a];return _0x1d9dec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4b66('0x0'));var BPromise=require('bluebird');var rs=require(_0x4b66('0x1'));var fs=require('fs');var Redis=require(_0x4b66('0x2'));var db=require(_0x4b66('0x3'))['db'];var utils=require(_0x4b66('0x4'));var logger=require(_0x4b66('0x5'))(_0x4b66('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b66('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4716f8,_0x47431c,_0xc232cf){return new BPromise(function(_0xa5c6e2,_0x26f6cb){return client[_0x4b66('0x8')](_0x4716f8,_0xc232cf)[_0x4b66('0x9')](function(_0x27cb09){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x47431c,_0x4b66('0xa'));logger[_0x4b66('0xb')](_0x4b66('0xc'),_0x47431c,'request\x20sent',JSON[_0x4b66('0xd')](_0x27cb09));if(_0x27cb09[_0x4b66('0xe')]){if(_0x27cb09[_0x4b66('0xe')]['code']===0x1f4){logger[_0x4b66('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x47431c,_0x27cb09[_0x4b66('0xe')][_0x4b66('0xf')]);return _0x26f6cb(_0x27cb09[_0x4b66('0xe')][_0x4b66('0xf')]);}logger[_0x4b66('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x47431c,_0x27cb09[_0x4b66('0xe')][_0x4b66('0xf')]);return _0xa5c6e2(_0x27cb09['error'][_0x4b66('0xf')]);}else{logger[_0x4b66('0x10')](_0x4b66('0x11'),_0x47431c,_0x4b66('0xa'));_0xa5c6e2(_0x27cb09[_0x4b66('0x12')][_0x4b66('0xf')]);}})['catch'](function(_0x210b00){logger[_0x4b66('0xe')](_0x4b66('0x11'),_0x47431c,_0x210b00);_0x26f6cb(_0x210b00);});});}exports[_0x4b66('0x13')]=function(_0xdbf304){var _0x293f9b=this;return new Promise(function(_0x4f3cea,_0x131f38){return db[_0x4b66('0x14')][_0x4b66('0x15')]({'raw':_0xdbf304[_0x4b66('0x16')]?_0xdbf304['options'][_0x4b66('0x17')]===undefined?!![]:![]:!![],'where':_0xdbf304[_0x4b66('0x16')]?_0xdbf304[_0x4b66('0x16')][_0x4b66('0x18')]||null:null,'attributes':_0xdbf304[_0x4b66('0x16')]?_0xdbf304['options'][_0x4b66('0x19')]||null:null,'limit':_0xdbf304[_0x4b66('0x16')]?_0xdbf304[_0x4b66('0x16')][_0x4b66('0x1a')]||null:null,'include':_0xdbf304[_0x4b66('0x16')]?_0xdbf304[_0x4b66('0x16')][_0x4b66('0x1b')]?_[_0x4b66('0x1c')](_0xdbf304[_0x4b66('0x16')][_0x4b66('0x1b')],function(_0x255f59){return{'model':db[_0x255f59[_0x4b66('0x1d')]],'as':_0x255f59['as'],'attributes':_0x255f59[_0x4b66('0x19')],'include':_0x255f59['include']?_[_0x4b66('0x1c')](_0x255f59[_0x4b66('0x1b')],function(_0x40b3d2){return{'model':db[_0x40b3d2[_0x4b66('0x1d')]],'as':_0x40b3d2['as'],'attributes':_0x40b3d2[_0x4b66('0x19')],'include':_0x40b3d2['include']?_[_0x4b66('0x1c')](_0x40b3d2[_0x4b66('0x1b')],function(_0x24f0bd){return{'model':db[_0x24f0bd[_0x4b66('0x1d')]],'as':_0x24f0bd['as'],'attributes':_0x24f0bd[_0x4b66('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4b66('0x9')](function(_0x4aefd4){logger['info']('GetSalesforceAccount',_0xdbf304);logger[_0x4b66('0xb')](_0x4b66('0x13'),_0xdbf304,JSON[_0x4b66('0xd')](_0x4aefd4));_0x4f3cea(_0x4aefd4);})[_0x4b66('0x1e')](function(_0x493b15){logger[_0x4b66('0xe')](_0x4b66('0x13'),_0x493b15['message'],_0xdbf304);_0x131f38(_0x293f9b[_0x4b66('0xe')](0x1f4,_0x493b15[_0x4b66('0xf')]));});});};exports[_0x4b66('0x1f')]=function(_0x148000){var _0x4e7d8b=this;return new Promise(function(_0x26564a,_0x169bf0){return db[_0x4b66('0x14')][_0x4b66('0x20')]({'raw':_0x148000[_0x4b66('0x16')]?_0x148000['options'][_0x4b66('0x17')]===undefined?!![]:![]:!![],'where':_0x148000[_0x4b66('0x16')]?_0x148000['options']['where']||null:null,'attributes':_0x148000[_0x4b66('0x16')]?_0x148000['options'][_0x4b66('0x19')]||null:null,'include':_0x148000['options']?_0x148000[_0x4b66('0x16')][_0x4b66('0x1b')]?_[_0x4b66('0x1c')](_0x148000[_0x4b66('0x16')][_0x4b66('0x1b')],function(_0x32e6f7){return{'model':db[_0x32e6f7[_0x4b66('0x1d')]],'as':_0x32e6f7['as'],'attributes':_0x32e6f7[_0x4b66('0x19')],'include':_0x32e6f7[_0x4b66('0x1b')]?_[_0x4b66('0x1c')](_0x32e6f7[_0x4b66('0x1b')],function(_0x3ec691){return{'model':db[_0x3ec691[_0x4b66('0x1d')]],'as':_0x3ec691['as'],'attributes':_0x3ec691[_0x4b66('0x19')],'include':_0x3ec691[_0x4b66('0x1b')]?_[_0x4b66('0x1c')](_0x3ec691[_0x4b66('0x1b')],function(_0x5540af){return{'model':db[_0x5540af[_0x4b66('0x1d')]],'as':_0x5540af['as'],'attributes':_0x5540af[_0x4b66('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4b66('0x9')](function(_0x303079){logger[_0x4b66('0x10')](_0x4b66('0x1f'),_0x148000);logger[_0x4b66('0xb')]('ShowSalesforceAccount',_0x148000,JSON[_0x4b66('0xd')](_0x303079));_0x26564a(_0x303079);})[_0x4b66('0x1e')](function(_0x4dd493){logger['error']('ShowSalesforceAccount',_0x4dd493[_0x4b66('0xf')],_0x148000);_0x169bf0(_0x4e7d8b[_0x4b66('0xe')](0x1f4,_0x4dd493[_0x4b66('0xf')]));});});}; \ No newline at end of file +var _0x9e42=['GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','request\x20sent','result','catch','findAll','options','raw','where','attributes','include','map','model'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x9e42,0xd0));var _0x29e4=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x9e42[_0x456a4b];return _0x42957c;};'use strict';var _=require(_0x29e4('0x0'));var util=require(_0x29e4('0x1'));var moment=require('moment');var BPromise=require(_0x29e4('0x2'));var rs=require(_0x29e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x29e4('0x4'));var logger=require(_0x29e4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x29e4('0x6'));var client=jayson[_0x29e4('0x7')][_0x29e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x167b07,_0x3c6643,_0x53a845){return new BPromise(function(_0x2fa846,_0x5581a3){return client[_0x29e4('0x9')](_0x167b07,_0x53a845)[_0x29e4('0xa')](function(_0x13a6de){logger[_0x29e4('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x3c6643,'request\x20sent');logger[_0x29e4('0xc')](_0x29e4('0xd'),_0x3c6643,'request\x20sent',JSON[_0x29e4('0xe')](_0x13a6de));if(_0x13a6de[_0x29e4('0xf')]){if(_0x13a6de[_0x29e4('0xf')][_0x29e4('0x10')]===0x1f4){logger[_0x29e4('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x3c6643,_0x13a6de[_0x29e4('0xf')][_0x29e4('0x11')]);return _0x5581a3(_0x13a6de['error']['message']);}logger[_0x29e4('0xf')](_0x29e4('0x12'),_0x3c6643,_0x13a6de[_0x29e4('0xf')]['message']);return _0x2fa846(_0x13a6de[_0x29e4('0xf')][_0x29e4('0x11')]);}else{logger[_0x29e4('0xb')](_0x29e4('0x12'),_0x3c6643,_0x29e4('0x13'));_0x2fa846(_0x13a6de[_0x29e4('0x14')][_0x29e4('0x11')]);}})[_0x29e4('0x15')](function(_0x8b2d5c){logger[_0x29e4('0xf')](_0x29e4('0x12'),_0x3c6643,_0x8b2d5c);_0x5581a3(_0x8b2d5c);});});}exports['GetSalesforceAccount']=function(_0x5be8b4){var _0x43b7ad=this;return new Promise(function(_0x22f7a7,_0x36eaaa){return db['SalesforceAccount'][_0x29e4('0x16')]({'raw':_0x5be8b4['options']?_0x5be8b4[_0x29e4('0x17')][_0x29e4('0x18')]===undefined?!![]:![]:!![],'where':_0x5be8b4[_0x29e4('0x17')]?_0x5be8b4['options'][_0x29e4('0x19')]||null:null,'attributes':_0x5be8b4['options']?_0x5be8b4[_0x29e4('0x17')][_0x29e4('0x1a')]||null:null,'limit':_0x5be8b4['options']?_0x5be8b4[_0x29e4('0x17')]['limit']||null:null,'include':_0x5be8b4['options']?_0x5be8b4['options'][_0x29e4('0x1b')]?_[_0x29e4('0x1c')](_0x5be8b4[_0x29e4('0x17')][_0x29e4('0x1b')],function(_0x28f0a0){return{'model':db[_0x28f0a0[_0x29e4('0x1d')]],'as':_0x28f0a0['as'],'attributes':_0x28f0a0['attributes'],'include':_0x28f0a0[_0x29e4('0x1b')]?_['map'](_0x28f0a0[_0x29e4('0x1b')],function(_0x4b8c56){return{'model':db[_0x4b8c56['model']],'as':_0x4b8c56['as'],'attributes':_0x4b8c56[_0x29e4('0x1a')],'include':_0x4b8c56[_0x29e4('0x1b')]?_[_0x29e4('0x1c')](_0x4b8c56['include'],function(_0x3db6ba){return{'model':db[_0x3db6ba['model']],'as':_0x3db6ba['as'],'attributes':_0x3db6ba[_0x29e4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x29e4('0xa')](function(_0x5594c6){logger[_0x29e4('0xb')](_0x29e4('0x1e'),_0x5be8b4);logger[_0x29e4('0xc')](_0x29e4('0x1e'),_0x5be8b4,JSON[_0x29e4('0xe')](_0x5594c6));_0x22f7a7(_0x5594c6);})[_0x29e4('0x15')](function(_0x562096){logger[_0x29e4('0xf')]('GetSalesforceAccount',_0x562096[_0x29e4('0x11')],_0x5be8b4);_0x36eaaa(_0x43b7ad[_0x29e4('0xf')](0x1f4,_0x562096[_0x29e4('0x11')]));});});};exports[_0x29e4('0x1f')]=function(_0x4b7e0b){var _0x1c867d=this;return new Promise(function(_0x33029f,_0x48e3e1){return db[_0x29e4('0x20')][_0x29e4('0x21')]({'raw':_0x4b7e0b[_0x29e4('0x17')]?_0x4b7e0b['options'][_0x29e4('0x18')]===undefined?!![]:![]:!![],'where':_0x4b7e0b['options']?_0x4b7e0b[_0x29e4('0x17')][_0x29e4('0x19')]||null:null,'attributes':_0x4b7e0b[_0x29e4('0x17')]?_0x4b7e0b[_0x29e4('0x17')]['attributes']||null:null,'include':_0x4b7e0b[_0x29e4('0x17')]?_0x4b7e0b[_0x29e4('0x17')][_0x29e4('0x1b')]?_[_0x29e4('0x1c')](_0x4b7e0b[_0x29e4('0x17')][_0x29e4('0x1b')],function(_0x23a799){return{'model':db[_0x23a799['model']],'as':_0x23a799['as'],'attributes':_0x23a799[_0x29e4('0x1a')],'include':_0x23a799[_0x29e4('0x1b')]?_['map'](_0x23a799[_0x29e4('0x1b')],function(_0x1526d1){return{'model':db[_0x1526d1['model']],'as':_0x1526d1['as'],'attributes':_0x1526d1[_0x29e4('0x1a')],'include':_0x1526d1[_0x29e4('0x1b')]?_[_0x29e4('0x1c')](_0x1526d1[_0x29e4('0x1b')],function(_0x506b5a){return{'model':db[_0x506b5a[_0x29e4('0x1d')]],'as':_0x506b5a['as'],'attributes':_0x506b5a[_0x29e4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x141901){logger['info'](_0x29e4('0x1f'),_0x4b7e0b);logger[_0x29e4('0xc')]('ShowSalesforceAccount',_0x4b7e0b,JSON[_0x29e4('0xe')](_0x141901));_0x33029f(_0x141901);})['catch'](function(_0x11169f){logger[_0x29e4('0xf')](_0x29e4('0x1f'),_0x11169f['message'],_0x4b7e0b);_0x48e3e1(_0x1c867d[_0x29e4('0xf')](0x1f4,_0x11169f[_0x29e4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b02c444..5d9a7cb 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xdb28,0x106));var _0x8db2=function(_0x17c01a,_0x33fc9d){_0x17c01a=_0x17c01a-0x0;var _0xdb8528=_0xdb28[_0x17c01a];return _0xdb8528;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0x0b0e[_0x2132a3];return _0x21890c;};'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['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 4d8b929..fe32cf3 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xceb5=['Task','Case','contact_lead','account_contact_lead','ENUM','nothing','contact','lead','sequelize','exports','STRING'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xceb5,0x81));var _0x5ceb=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0xceb5[_0x33c9f8];return _0x2d7004;};'use strict';var Sequelize=require(_0x5ceb('0x0'));module[_0x5ceb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5ceb('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x5ceb('0x3'),_0x5ceb('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x5ceb('0x5'),'contact','lead',_0x5ceb('0x6'),'account'),'defaultValue':_0x5ceb('0x5')},'moduleCreate':{'type':Sequelize[_0x5ceb('0x7')](_0x5ceb('0x8'),_0x5ceb('0x9'),_0x5ceb('0xa'),'account'),'defaultValue':_0x5ceb('0xa')},'leadId':{'type':Sequelize[_0x5ceb('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x5ceb('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b8b=['Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','STRING','ENUM','Task'];(function(_0x1dad74,_0x402513){var _0x90dd3f=function(_0x3b6f98){while(--_0x3b6f98){_0x1dad74['push'](_0x1dad74['shift']());}};_0x90dd3f(++_0x402513);}(_0x5b8b,0x1e0));var _0xb5b8=function(_0xf7c30c,_0x224530){_0xf7c30c=_0xf7c30c-0x0;var _0x10565b=_0x5b8b[_0xf7c30c];return _0x10565b;};'use strict';var Sequelize=require(_0xb5b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5b8('0x1')]},'description':{'type':Sequelize[_0xb5b8('0x1')]},'ticketType':{'type':Sequelize[_0xb5b8('0x2')](_0xb5b8('0x3'),_0xb5b8('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xb5b8('0x5'),_0xb5b8('0x6'),_0xb5b8('0x7'),_0xb5b8('0x8'),_0xb5b8('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xb5b8('0x2')](_0xb5b8('0xa'),_0xb5b8('0x6'),_0xb5b8('0x7'),_0xb5b8('0x9')),'defaultValue':_0xb5b8('0x7')},'leadId':{'type':Sequelize[_0xb5b8('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xb5b8('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xb5b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 06e6875..1f46c90 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe345=['order','getFields','hasOwnProperty','getSubjects','getDescriptions','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','limit','undefined','count','status','reject','save','update','destroy','end','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','nolimit','sort','filters','pick','merge','where','VIRTUAL','filter','options','then','include','findAll','show','params','includeAll','find','catch','create','body','findOne','SalesforceField'];(function(_0x2d9fb2,_0x47490c){var _0x52c478=function(_0x31005c){while(--_0x31005c){_0x2d9fb2['push'](_0x2d9fb2['shift']());}};_0x52c478(++_0x47490c);}(_0xe345,0x99));var _0x5e34=function(_0x1863be,_0x3fb18f){_0x1863be=_0x1863be-0x0;var _0x5835e1=_0xe345[_0x1863be];return _0x5835e1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e34('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e34('0x1'));var moment=require(_0x5e34('0x2'));var BPromise=require(_0x5e34('0x3'));var Mustache=require(_0x5e34('0x4'));var util=require('util');var path=require(_0x5e34('0x5'));var sox=require('sox');var csv=require(_0x5e34('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e34('0x7'));var _=require(_0x5e34('0x8'));var squel=require(_0x5e34('0x9'));var crypto=require(_0x5e34('0xa'));var jsforce=require(_0x5e34('0xb'));var deskjs=require(_0x5e34('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5e34('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5e34('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e34('0xf'));var logger=require(_0x5e34('0x10'))('api');var utils=require(_0x5e34('0x11'));var config=require(_0x5e34('0x12'));var licenseUtil=require(_0x5e34('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x274ac1,_0x35d193){_0x35d193=_0x35d193||0xcc;return function(_0x557f45){if(_0x557f45){return _0x274ac1[_0x5e34('0x14')](_0x35d193);}return _0x274ac1['status'](_0x35d193)['end']();};}function respondWithResult(_0x33649d,_0x238972){_0x238972=_0x238972||0xc8;return function(_0x46becd){if(_0x46becd){return _0x33649d['status'](_0x238972)[_0x5e34('0x15')](_0x46becd);}};}function respondWithFilteredResult(_0x261128,_0x393bd6){return function(_0x9cd698){if(_0x9cd698){var _0x17ae18=typeof _0x393bd6[_0x5e34('0x16')]==='undefined'&&typeof _0x393bd6[_0x5e34('0x17')]===_0x5e34('0x18');var _0x1dd430=_0x9cd698['count'];var _0x190f93=_0x17ae18?0x0:_0x393bd6[_0x5e34('0x16')];var _0xc17d65=_0x17ae18?_0x9cd698[_0x5e34('0x19')]:_0x393bd6['offset']+_0x393bd6[_0x5e34('0x17')];var _0x37aee6;if(_0xc17d65>=_0x1dd430){_0xc17d65=_0x1dd430;_0x37aee6=0xc8;}else{_0x37aee6=0xce;}_0x261128[_0x5e34('0x1a')](_0x37aee6);return _0x261128['set']('Content-Range',_0x190f93+'-'+_0xc17d65+'/'+_0x1dd430)[_0x5e34('0x15')](_0x9cd698);}return null;};}function patchUpdates(_0x8ce4d){return function(_0xc8c33a){try{jsonpatch['apply'](_0xc8c33a,_0x8ce4d,!![]);}catch(_0x416e41){return BPromise[_0x5e34('0x1b')](_0x416e41);}return _0xc8c33a[_0x5e34('0x1c')]();};}function saveUpdates(_0x2e419b,_0x15c2d2){return function(_0x2c57dc){if(_0x2c57dc){return _0x2c57dc[_0x5e34('0x1d')](_0x2e419b)['then'](function(_0x5c5f60){return _0x5c5f60;});}return null;};}function removeEntity(_0x305f5c,_0x7e6721){return function(_0x4b826a){if(_0x4b826a){return _0x4b826a[_0x5e34('0x1e')]()['then'](function(){_0x305f5c['status'](0xcc)[_0x5e34('0x1f')]();});}};}function handleEntityNotFound(_0x47535d,_0x30f61d){return function(_0x2fefa5){if(!_0x2fefa5){_0x47535d[_0x5e34('0x14')](0x194);}return _0x2fefa5;};}function handleError(_0x19c99b,_0x4723c1){_0x4723c1=_0x4723c1||0x1f4;return function(_0x223385){logger['error'](_0x223385[_0x5e34('0x20')]);if(_0x223385[_0x5e34('0x21')]){delete _0x223385[_0x5e34('0x21')];}_0x19c99b[_0x5e34('0x1a')](_0x4723c1)[_0x5e34('0x22')](_0x223385);};}exports['index']=function(_0x21261d,_0x4d0d61){var _0x2c3bc0={},_0x25298a={},_0x303e6c={'count':0x0,'rows':[]};var _0x1eca3e=_[_0x5e34('0x23')](db[_0x5e34('0x24')][_0x5e34('0x25')],function(_0x4b0c77){return{'name':_0x4b0c77[_0x5e34('0x26')],'type':_0x4b0c77[_0x5e34('0x27')][_0x5e34('0x28')]};});_0x25298a['model']=_[_0x5e34('0x23')](_0x1eca3e,_0x5e34('0x21'));_0x25298a[_0x5e34('0x29')]=_[_0x5e34('0x2a')](_0x21261d['query']);_0x25298a['filters']=_[_0x5e34('0x2b')](_0x25298a['model'],_0x25298a[_0x5e34('0x29')]);_0x2c3bc0[_0x5e34('0x2c')]=_['intersection'](_0x25298a['model'],qs[_0x5e34('0x2d')](_0x21261d[_0x5e34('0x29')][_0x5e34('0x2d')]));_0x2c3bc0[_0x5e34('0x2c')]=_0x2c3bc0['attributes'][_0x5e34('0x2e')]?_0x2c3bc0[_0x5e34('0x2c')]:_0x25298a[_0x5e34('0x2f')];if(!_0x21261d[_0x5e34('0x29')]['hasOwnProperty'](_0x5e34('0x30'))){_0x2c3bc0['limit']=qs[_0x5e34('0x17')](_0x21261d[_0x5e34('0x29')]['limit']);_0x2c3bc0[_0x5e34('0x16')]=qs[_0x5e34('0x16')](_0x21261d[_0x5e34('0x29')][_0x5e34('0x16')]);}_0x2c3bc0['order']=qs[_0x5e34('0x31')](_0x21261d[_0x5e34('0x29')][_0x5e34('0x31')]);_0x2c3bc0['where']=qs[_0x5e34('0x32')](_[_0x5e34('0x33')](_0x21261d[_0x5e34('0x29')],_0x25298a[_0x5e34('0x32')]),_0x1eca3e);if(_0x21261d[_0x5e34('0x29')]['filter']){_0x2c3bc0['where']=_[_0x5e34('0x34')](_0x2c3bc0[_0x5e34('0x35')],{'$or':_[_0x5e34('0x23')](_0x1eca3e,function(_0x5249fc){if(_0x5249fc['type']!==_0x5e34('0x36')){var _0x4c5068={};_0x4c5068[_0x5249fc[_0x5e34('0x21')]]={'$like':'%'+_0x21261d['query'][_0x5e34('0x37')]+'%'};return _0x4c5068;}})});}_0x2c3bc0=_['merge']({},_0x2c3bc0,_0x21261d[_0x5e34('0x38')]);var _0x3da905={'where':_0x2c3bc0['where']};return db[_0x5e34('0x24')][_0x5e34('0x19')](_0x3da905)[_0x5e34('0x39')](function(_0x130435){_0x303e6c[_0x5e34('0x19')]=_0x130435;if(_0x21261d[_0x5e34('0x29')]['includeAll']){_0x2c3bc0[_0x5e34('0x3a')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x5e34('0x3b')](_0x2c3bc0);})['then'](function(_0x3e7d32){_0x303e6c['rows']=_0x3e7d32;return _0x303e6c;})[_0x5e34('0x39')](respondWithFilteredResult(_0x4d0d61,_0x2c3bc0))['catch'](handleError(_0x4d0d61,null));};exports[_0x5e34('0x3c')]=function(_0x2f3455,_0x5932ad){var _0x17b146={'raw':![],'where':{'id':_0x2f3455[_0x5e34('0x3d')]['id']}},_0x27c506={};_0x27c506[_0x5e34('0x2f')]=_['keys'](db[_0x5e34('0x24')][_0x5e34('0x25')]);_0x27c506[_0x5e34('0x29')]=_[_0x5e34('0x2a')](_0x2f3455['query']);_0x27c506[_0x5e34('0x32')]=_[_0x5e34('0x2b')](_0x27c506[_0x5e34('0x2f')],_0x27c506[_0x5e34('0x29')]);_0x17b146[_0x5e34('0x2c')]=_[_0x5e34('0x2b')](_0x27c506[_0x5e34('0x2f')],qs['fields'](_0x2f3455[_0x5e34('0x29')][_0x5e34('0x2d')]));_0x17b146[_0x5e34('0x2c')]=_0x17b146[_0x5e34('0x2c')]['length']?_0x17b146['attributes']:_0x27c506[_0x5e34('0x2f')];if(_0x2f3455['query'][_0x5e34('0x3e')]){_0x17b146['include']=[{'all':!![]}];}_0x17b146=_['merge']({},_0x17b146,_0x2f3455[_0x5e34('0x38')]);return db[_0x5e34('0x24')][_0x5e34('0x3f')](_0x17b146)[_0x5e34('0x39')](handleEntityNotFound(_0x5932ad,null))[_0x5e34('0x39')](respondWithResult(_0x5932ad,null))[_0x5e34('0x40')](handleError(_0x5932ad,null));};exports[_0x5e34('0x41')]=function(_0x2d35f0,_0x527b74){return db[_0x5e34('0x24')][_0x5e34('0x41')](_0x2d35f0['body'],{})['then'](respondWithResult(_0x527b74,0xc9))['catch'](handleError(_0x527b74,null));};exports[_0x5e34('0x1d')]=function(_0x5792e3,_0x112aa3){if(_0x5792e3[_0x5e34('0x42')]['id']){delete _0x5792e3[_0x5e34('0x42')]['id'];}return db['SalesforceConfiguration'][_0x5e34('0x3f')]({'where':{'id':_0x5792e3['params']['id']}})[_0x5e34('0x39')](handleEntityNotFound(_0x112aa3,null))[_0x5e34('0x39')](saveUpdates(_0x5792e3[_0x5e34('0x42')],null))[_0x5e34('0x39')](respondWithResult(_0x112aa3,null))[_0x5e34('0x40')](handleError(_0x112aa3,null));};exports[_0x5e34('0x1e')]=function(_0x435a4b,_0x466290){return db[_0x5e34('0x24')]['find']({'where':{'id':_0x435a4b['params']['id']}})[_0x5e34('0x39')](handleEntityNotFound(_0x466290,null))[_0x5e34('0x39')](removeEntity(_0x466290,null))[_0x5e34('0x40')](handleError(_0x466290,null));};exports['getFields']=function(_0x5b3400,_0x529bf0,_0x5878f7){var _0x43c80f={};var _0x344bd8={};var _0x27f70b;var _0x49562c;return db[_0x5e34('0x24')][_0x5e34('0x43')]({'where':{'id':_0x5b3400[_0x5e34('0x3d')]['id']}})['then'](handleEntityNotFound(_0x529bf0,null))[_0x5e34('0x39')](function(_0x574e45){if(_0x574e45){_0x27f70b=_0x574e45;_0x344bd8['model']=_[_0x5e34('0x2a')](db[_0x5e34('0x44')]['rawAttributes']);_0x344bd8[_0x5e34('0x29')]=_[_0x5e34('0x2a')](_0x5b3400[_0x5e34('0x29')]);_0x344bd8[_0x5e34('0x32')]=_['intersection'](_0x344bd8['model'],_0x344bd8[_0x5e34('0x29')]);_0x43c80f['attributes']=_[_0x5e34('0x2b')](_0x344bd8[_0x5e34('0x2f')],qs[_0x5e34('0x2d')](_0x5b3400[_0x5e34('0x29')][_0x5e34('0x2d')]));_0x43c80f['attributes']=_0x43c80f['attributes'][_0x5e34('0x2e')]?_0x43c80f[_0x5e34('0x2c')]:_0x344bd8['model'];_0x43c80f[_0x5e34('0x45')]=qs[_0x5e34('0x31')](_0x5b3400[_0x5e34('0x29')]['sort']);_0x43c80f[_0x5e34('0x35')]=qs['filters'](_[_0x5e34('0x33')](_0x5b3400[_0x5e34('0x29')],_0x344bd8[_0x5e34('0x32')]));if(_0x5b3400[_0x5e34('0x29')][_0x5e34('0x37')]){_0x43c80f['where']=_[_0x5e34('0x34')](_0x43c80f[_0x5e34('0x35')],{'$or':_[_0x5e34('0x23')](_0x43c80f[_0x5e34('0x2c')],function(_0x1f9713){var _0x5f21a9={};_0x5f21a9[_0x1f9713]={'$like':'%'+_0x5b3400[_0x5e34('0x29')]['filter']+'%'};return _0x5f21a9;})});}_0x43c80f=_['merge']({},_0x43c80f,_0x5b3400[_0x5e34('0x38')]);return _0x27f70b[_0x5e34('0x46')](_0x43c80f);}})['then'](function(_0x1532e8){if(_0x1532e8){_0x49562c=_0x1532e8[_0x5e34('0x2e')];if(!_0x5b3400[_0x5e34('0x29')][_0x5e34('0x47')](_0x5e34('0x30'))){_0x43c80f[_0x5e34('0x17')]=qs[_0x5e34('0x17')](_0x5b3400[_0x5e34('0x29')][_0x5e34('0x17')]);_0x43c80f[_0x5e34('0x16')]=qs[_0x5e34('0x16')](_0x5b3400['query'][_0x5e34('0x16')]);}return _0x27f70b['getFields'](_0x43c80f);}})[_0x5e34('0x39')](function(_0x4d750d){if(_0x4d750d){return _0x4d750d?{'count':_0x49562c,'rows':_0x4d750d}:null;}})[_0x5e34('0x39')](respondWithResult(_0x529bf0,null))[_0x5e34('0x40')](handleError(_0x529bf0,null));};exports[_0x5e34('0x48')]=function(_0xc9b40b,_0x3b2be5,_0x469d20){var _0x2dd750={};var _0x559f9b={};var _0x1cc494;var _0x384d49;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0xc9b40b[_0x5e34('0x3d')]['id']}})[_0x5e34('0x39')](handleEntityNotFound(_0x3b2be5,null))['then'](function(_0x84b8b1){if(_0x84b8b1){_0x1cc494=_0x84b8b1;_0x559f9b[_0x5e34('0x2f')]=_[_0x5e34('0x2a')](db['SalesforceField'][_0x5e34('0x25')]);_0x559f9b[_0x5e34('0x29')]=_[_0x5e34('0x2a')](_0xc9b40b['query']);_0x559f9b[_0x5e34('0x32')]=_[_0x5e34('0x2b')](_0x559f9b[_0x5e34('0x2f')],_0x559f9b[_0x5e34('0x29')]);_0x2dd750['attributes']=_['intersection'](_0x559f9b[_0x5e34('0x2f')],qs[_0x5e34('0x2d')](_0xc9b40b[_0x5e34('0x29')][_0x5e34('0x2d')]));_0x2dd750[_0x5e34('0x2c')]=_0x2dd750[_0x5e34('0x2c')]['length']?_0x2dd750[_0x5e34('0x2c')]:_0x559f9b['model'];_0x2dd750[_0x5e34('0x45')]=qs['sort'](_0xc9b40b[_0x5e34('0x29')][_0x5e34('0x31')]);_0x2dd750['where']=qs['filters'](_[_0x5e34('0x33')](_0xc9b40b[_0x5e34('0x29')],_0x559f9b[_0x5e34('0x32')]));if(_0xc9b40b[_0x5e34('0x29')][_0x5e34('0x37')]){_0x2dd750[_0x5e34('0x35')]=_[_0x5e34('0x34')](_0x2dd750['where'],{'$or':_[_0x5e34('0x23')](_0x2dd750['attributes'],function(_0x19e02d){var _0x4c0ac5={};_0x4c0ac5[_0x19e02d]={'$like':'%'+_0xc9b40b[_0x5e34('0x29')][_0x5e34('0x37')]+'%'};return _0x4c0ac5;})});}_0x2dd750=_[_0x5e34('0x34')]({},_0x2dd750,_0xc9b40b['options']);return _0x1cc494[_0x5e34('0x48')](_0x2dd750);}})[_0x5e34('0x39')](function(_0x262e0b){if(_0x262e0b){_0x384d49=_0x262e0b[_0x5e34('0x2e')];if(!_0xc9b40b[_0x5e34('0x29')][_0x5e34('0x47')](_0x5e34('0x30'))){_0x2dd750[_0x5e34('0x17')]=qs['limit'](_0xc9b40b[_0x5e34('0x29')][_0x5e34('0x17')]);_0x2dd750[_0x5e34('0x16')]=qs[_0x5e34('0x16')](_0xc9b40b[_0x5e34('0x29')]['offset']);}return _0x1cc494['getSubjects'](_0x2dd750);}})[_0x5e34('0x39')](function(_0x48a6db){if(_0x48a6db){return _0x48a6db?{'count':_0x384d49,'rows':_0x48a6db}:null;}})['then'](respondWithResult(_0x3b2be5,null))[_0x5e34('0x40')](handleError(_0x3b2be5,null));};exports[_0x5e34('0x49')]=function(_0x22f0cf,_0x236e01,_0x231c7e){var _0x4a0a82={};var _0x469869={};var _0x401bd7;var _0x1ca877;return db['SalesforceConfiguration'][_0x5e34('0x43')]({'where':{'id':_0x22f0cf[_0x5e34('0x3d')]['id']}})[_0x5e34('0x39')](handleEntityNotFound(_0x236e01,null))[_0x5e34('0x39')](function(_0x459ac6){if(_0x459ac6){_0x401bd7=_0x459ac6;_0x469869['model']=_['keys'](db[_0x5e34('0x44')]['rawAttributes']);_0x469869[_0x5e34('0x29')]=_['keys'](_0x22f0cf[_0x5e34('0x29')]);_0x469869['filters']=_[_0x5e34('0x2b')](_0x469869[_0x5e34('0x2f')],_0x469869[_0x5e34('0x29')]);_0x4a0a82[_0x5e34('0x2c')]=_['intersection'](_0x469869[_0x5e34('0x2f')],qs['fields'](_0x22f0cf[_0x5e34('0x29')][_0x5e34('0x2d')]));_0x4a0a82['attributes']=_0x4a0a82[_0x5e34('0x2c')]['length']?_0x4a0a82[_0x5e34('0x2c')]:_0x469869[_0x5e34('0x2f')];_0x4a0a82[_0x5e34('0x45')]=qs[_0x5e34('0x31')](_0x22f0cf[_0x5e34('0x29')][_0x5e34('0x31')]);_0x4a0a82['where']=qs[_0x5e34('0x32')](_[_0x5e34('0x33')](_0x22f0cf[_0x5e34('0x29')],_0x469869[_0x5e34('0x32')]));if(_0x22f0cf[_0x5e34('0x29')]['filter']){_0x4a0a82['where']=_[_0x5e34('0x34')](_0x4a0a82[_0x5e34('0x35')],{'$or':_[_0x5e34('0x23')](_0x4a0a82[_0x5e34('0x2c')],function(_0x4ecbff){var _0x3f0a4a={};_0x3f0a4a[_0x4ecbff]={'$like':'%'+_0x22f0cf['query'][_0x5e34('0x37')]+'%'};return _0x3f0a4a;})});}_0x4a0a82=_[_0x5e34('0x34')]({},_0x4a0a82,_0x22f0cf[_0x5e34('0x38')]);return _0x401bd7['getDescriptions'](_0x4a0a82);}})[_0x5e34('0x39')](function(_0x23785e){if(_0x23785e){_0x1ca877=_0x23785e[_0x5e34('0x2e')];if(!_0x22f0cf['query'][_0x5e34('0x47')]('nolimit')){_0x4a0a82[_0x5e34('0x17')]=qs[_0x5e34('0x17')](_0x22f0cf[_0x5e34('0x29')][_0x5e34('0x17')]);_0x4a0a82[_0x5e34('0x16')]=qs['offset'](_0x22f0cf[_0x5e34('0x29')][_0x5e34('0x16')]);}return _0x401bd7[_0x5e34('0x49')](_0x4a0a82);}})[_0x5e34('0x39')](function(_0xab7d6c){if(_0xab7d6c){return _0xab7d6c?{'count':_0x1ca877,'rows':_0xab7d6c}:null;}})['then'](respondWithResult(_0x236e01,null))[_0x5e34('0x40')](handleError(_0x236e01,null));}; \ No newline at end of file +var _0x573a=['apply','reject','save','update','destroy','then','status','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SalesforceField','pick','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x573a,0x82));var _0xa573=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0x573a[_0x38fb0d];return _0x30a5d6;};'use strict';var emlformat=require(_0xa573('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa573('0x1'));var jsonpatch=require(_0xa573('0x2'));var rp=require(_0xa573('0x3'));var moment=require(_0xa573('0x4'));var BPromise=require(_0xa573('0x5'));var Mustache=require(_0xa573('0x6'));var util=require(_0xa573('0x7'));var path=require('path');var sox=require(_0xa573('0x8'));var csv=require(_0xa573('0x9'));var ejs=require(_0xa573('0xa'));var fs=require('fs');var fs_extra=require(_0xa573('0xb'));var _=require(_0xa573('0xc'));var squel=require('squel');var crypto=require(_0xa573('0xd'));var jsforce=require(_0xa573('0xe'));var deskjs=require(_0xa573('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa573('0x10'));var Papa=require(_0xa573('0x11'));var Redis=require(_0xa573('0x12'));var authService=require(_0xa573('0x13'));var qs=require(_0xa573('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa573('0x15'));var logger=require(_0xa573('0x16'))('api');var utils=require(_0xa573('0x17'));var config=require(_0xa573('0x18'));var licenseUtil=require(_0xa573('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d32bf,_0x564040){_0x564040=_0x564040||0xcc;return function(_0x145856){if(_0x145856){return _0x2d32bf[_0xa573('0x1a')](_0x564040);}return _0x2d32bf['status'](_0x564040)[_0xa573('0x1b')]();};}function respondWithResult(_0x5d2e45,_0x57af71){_0x57af71=_0x57af71||0xc8;return function(_0x4fb2b9){if(_0x4fb2b9){return _0x5d2e45['status'](_0x57af71)[_0xa573('0x1c')](_0x4fb2b9);}};}function respondWithFilteredResult(_0x2da50f,_0x4188d1){return function(_0x28f346){if(_0x28f346){var _0x46b474=typeof _0x4188d1[_0xa573('0x1d')]===_0xa573('0x1e')&&typeof _0x4188d1[_0xa573('0x1f')]===_0xa573('0x1e');var _0x2e5868=_0x28f346[_0xa573('0x20')];var _0x575315=_0x46b474?0x0:_0x4188d1['offset'];var _0x2a288e=_0x46b474?_0x28f346['count']:_0x4188d1[_0xa573('0x1d')]+_0x4188d1[_0xa573('0x1f')];var _0x173499;if(_0x2a288e>=_0x2e5868){_0x2a288e=_0x2e5868;_0x173499=0xc8;}else{_0x173499=0xce;}_0x2da50f['status'](_0x173499);return _0x2da50f['set'](_0xa573('0x21'),_0x575315+'-'+_0x2a288e+'/'+_0x2e5868)[_0xa573('0x1c')](_0x28f346);}return null;};}function patchUpdates(_0x335de3){return function(_0x16707a){try{jsonpatch[_0xa573('0x22')](_0x16707a,_0x335de3,!![]);}catch(_0x3456e4){return BPromise[_0xa573('0x23')](_0x3456e4);}return _0x16707a[_0xa573('0x24')]();};}function saveUpdates(_0x366c59,_0x4e0876){return function(_0x9a0f85){if(_0x9a0f85){return _0x9a0f85[_0xa573('0x25')](_0x366c59)['then'](function(_0x3643ed){return _0x3643ed;});}return null;};}function removeEntity(_0x353182,_0x5a13f2){return function(_0x20bf06){if(_0x20bf06){return _0x20bf06[_0xa573('0x26')]()[_0xa573('0x27')](function(){_0x353182[_0xa573('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x246290,_0x32a803){return function(_0x615796){if(!_0x615796){_0x246290['sendStatus'](0x194);}return _0x615796;};}function handleError(_0x48315b,_0x2a2a51){_0x2a2a51=_0x2a2a51||0x1f4;return function(_0x350cdf){logger[_0xa573('0x29')](_0x350cdf[_0xa573('0x2a')]);if(_0x350cdf[_0xa573('0x2b')]){delete _0x350cdf[_0xa573('0x2b')];}_0x48315b[_0xa573('0x28')](_0x2a2a51)[_0xa573('0x2c')](_0x350cdf);};}exports[_0xa573('0x2d')]=function(_0x252bed,_0x160ef6){var _0x501a46={},_0x5bb570={},_0x525268={'count':0x0,'rows':[]};var _0x3d3bac=_[_0xa573('0x2e')](db['SalesforceConfiguration'][_0xa573('0x2f')],function(_0x40bb0a){return{'name':_0x40bb0a['fieldName'],'type':_0x40bb0a[_0xa573('0x30')]['key']};});_0x5bb570['model']=_[_0xa573('0x2e')](_0x3d3bac,'name');_0x5bb570[_0xa573('0x31')]=_[_0xa573('0x32')](_0x252bed[_0xa573('0x31')]);_0x5bb570[_0xa573('0x33')]=_['intersection'](_0x5bb570['model'],_0x5bb570[_0xa573('0x31')]);_0x501a46[_0xa573('0x34')]=_[_0xa573('0x35')](_0x5bb570['model'],qs[_0xa573('0x36')](_0x252bed[_0xa573('0x31')][_0xa573('0x36')]));_0x501a46[_0xa573('0x34')]=_0x501a46[_0xa573('0x34')][_0xa573('0x37')]?_0x501a46[_0xa573('0x34')]:_0x5bb570[_0xa573('0x38')];if(!_0x252bed[_0xa573('0x31')][_0xa573('0x39')](_0xa573('0x3a'))){_0x501a46[_0xa573('0x1f')]=qs[_0xa573('0x1f')](_0x252bed[_0xa573('0x31')][_0xa573('0x1f')]);_0x501a46['offset']=qs[_0xa573('0x1d')](_0x252bed[_0xa573('0x31')][_0xa573('0x1d')]);}_0x501a46[_0xa573('0x3b')]=qs['sort'](_0x252bed[_0xa573('0x31')][_0xa573('0x3c')]);_0x501a46['where']=qs['filters'](_['pick'](_0x252bed[_0xa573('0x31')],_0x5bb570[_0xa573('0x33')]),_0x3d3bac);if(_0x252bed[_0xa573('0x31')][_0xa573('0x3d')]){_0x501a46['where']=_['merge'](_0x501a46[_0xa573('0x3e')],{'$or':_[_0xa573('0x2e')](_0x3d3bac,function(_0x17e99d){if(_0x17e99d[_0xa573('0x30')]!==_0xa573('0x3f')){var _0x559788={};_0x559788[_0x17e99d[_0xa573('0x2b')]]={'$like':'%'+_0x252bed[_0xa573('0x31')][_0xa573('0x3d')]+'%'};return _0x559788;}})});}_0x501a46=_[_0xa573('0x40')]({},_0x501a46,_0x252bed[_0xa573('0x41')]);var _0xb9abe={'where':_0x501a46[_0xa573('0x3e')]};return db[_0xa573('0x42')][_0xa573('0x20')](_0xb9abe)[_0xa573('0x27')](function(_0xd32a2c){_0x525268['count']=_0xd32a2c;if(_0x252bed[_0xa573('0x31')][_0xa573('0x43')]){_0x501a46[_0xa573('0x44')]=[{'all':!![]}];}return db[_0xa573('0x42')][_0xa573('0x45')](_0x501a46);})['then'](function(_0x120211){_0x525268[_0xa573('0x46')]=_0x120211;return _0x525268;})[_0xa573('0x27')](respondWithFilteredResult(_0x160ef6,_0x501a46))[_0xa573('0x47')](handleError(_0x160ef6,null));};exports[_0xa573('0x48')]=function(_0x3f4b74,_0x4c1b74){var _0x3a0b82={'raw':![],'where':{'id':_0x3f4b74[_0xa573('0x49')]['id']}},_0x1e0d51={};_0x1e0d51['model']=_[_0xa573('0x32')](db[_0xa573('0x42')][_0xa573('0x2f')]);_0x1e0d51['query']=_[_0xa573('0x32')](_0x3f4b74[_0xa573('0x31')]);_0x1e0d51[_0xa573('0x33')]=_['intersection'](_0x1e0d51[_0xa573('0x38')],_0x1e0d51[_0xa573('0x31')]);_0x3a0b82[_0xa573('0x34')]=_['intersection'](_0x1e0d51[_0xa573('0x38')],qs[_0xa573('0x36')](_0x3f4b74[_0xa573('0x31')][_0xa573('0x36')]));_0x3a0b82['attributes']=_0x3a0b82[_0xa573('0x34')]['length']?_0x3a0b82[_0xa573('0x34')]:_0x1e0d51[_0xa573('0x38')];if(_0x3f4b74['query'][_0xa573('0x43')]){_0x3a0b82[_0xa573('0x44')]=[{'all':!![]}];}_0x3a0b82=_[_0xa573('0x40')]({},_0x3a0b82,_0x3f4b74[_0xa573('0x41')]);return db[_0xa573('0x42')][_0xa573('0x4a')](_0x3a0b82)[_0xa573('0x27')](handleEntityNotFound(_0x4c1b74,null))['then'](respondWithResult(_0x4c1b74,null))[_0xa573('0x47')](handleError(_0x4c1b74,null));};exports[_0xa573('0x4b')]=function(_0x44dabf,_0x1171a7){return db[_0xa573('0x42')][_0xa573('0x4b')](_0x44dabf[_0xa573('0x4c')],{})['then'](respondWithResult(_0x1171a7,0xc9))[_0xa573('0x47')](handleError(_0x1171a7,null));};exports[_0xa573('0x25')]=function(_0x571a3d,_0x9a9e00){if(_0x571a3d[_0xa573('0x4c')]['id']){delete _0x571a3d[_0xa573('0x4c')]['id'];}return db['SalesforceConfiguration'][_0xa573('0x4a')]({'where':{'id':_0x571a3d[_0xa573('0x49')]['id']}})[_0xa573('0x27')](handleEntityNotFound(_0x9a9e00,null))[_0xa573('0x27')](saveUpdates(_0x571a3d[_0xa573('0x4c')],null))[_0xa573('0x27')](respondWithResult(_0x9a9e00,null))[_0xa573('0x47')](handleError(_0x9a9e00,null));};exports[_0xa573('0x26')]=function(_0x31d907,_0x561792){return db[_0xa573('0x42')][_0xa573('0x4a')]({'where':{'id':_0x31d907[_0xa573('0x49')]['id']}})[_0xa573('0x27')](handleEntityNotFound(_0x561792,null))[_0xa573('0x27')](removeEntity(_0x561792,null))[_0xa573('0x47')](handleError(_0x561792,null));};exports[_0xa573('0x4d')]=function(_0x15218c,_0x39b134,_0x2a53b0){var _0x155b05={};var _0x50eefb={};var _0x44d2b9;var _0x47e01a;return db[_0xa573('0x42')][_0xa573('0x4e')]({'where':{'id':_0x15218c[_0xa573('0x49')]['id']}})[_0xa573('0x27')](handleEntityNotFound(_0x39b134,null))[_0xa573('0x27')](function(_0x144ace){if(_0x144ace){_0x44d2b9=_0x144ace;_0x50eefb[_0xa573('0x38')]=_[_0xa573('0x32')](db[_0xa573('0x4f')][_0xa573('0x2f')]);_0x50eefb['query']=_[_0xa573('0x32')](_0x15218c[_0xa573('0x31')]);_0x50eefb[_0xa573('0x33')]=_[_0xa573('0x35')](_0x50eefb[_0xa573('0x38')],_0x50eefb['query']);_0x155b05[_0xa573('0x34')]=_['intersection'](_0x50eefb[_0xa573('0x38')],qs['fields'](_0x15218c['query']['fields']));_0x155b05[_0xa573('0x34')]=_0x155b05['attributes'][_0xa573('0x37')]?_0x155b05[_0xa573('0x34')]:_0x50eefb['model'];_0x155b05[_0xa573('0x3b')]=qs[_0xa573('0x3c')](_0x15218c['query'][_0xa573('0x3c')]);_0x155b05[_0xa573('0x3e')]=qs[_0xa573('0x33')](_['pick'](_0x15218c[_0xa573('0x31')],_0x50eefb[_0xa573('0x33')]));if(_0x15218c[_0xa573('0x31')][_0xa573('0x3d')]){_0x155b05[_0xa573('0x3e')]=_[_0xa573('0x40')](_0x155b05[_0xa573('0x3e')],{'$or':_[_0xa573('0x2e')](_0x155b05['attributes'],function(_0x394289){var _0x4c0277={};_0x4c0277[_0x394289]={'$like':'%'+_0x15218c[_0xa573('0x31')][_0xa573('0x3d')]+'%'};return _0x4c0277;})});}_0x155b05=_[_0xa573('0x40')]({},_0x155b05,_0x15218c[_0xa573('0x41')]);return _0x44d2b9[_0xa573('0x4d')](_0x155b05);}})[_0xa573('0x27')](function(_0x52f98f){if(_0x52f98f){_0x47e01a=_0x52f98f[_0xa573('0x37')];if(!_0x15218c[_0xa573('0x31')][_0xa573('0x39')](_0xa573('0x3a'))){_0x155b05['limit']=qs['limit'](_0x15218c[_0xa573('0x31')][_0xa573('0x1f')]);_0x155b05[_0xa573('0x1d')]=qs[_0xa573('0x1d')](_0x15218c['query'][_0xa573('0x1d')]);}return _0x44d2b9[_0xa573('0x4d')](_0x155b05);}})['then'](function(_0x3f23b6){if(_0x3f23b6){return _0x3f23b6?{'count':_0x47e01a,'rows':_0x3f23b6}:null;}})[_0xa573('0x27')](respondWithResult(_0x39b134,null))['catch'](handleError(_0x39b134,null));};exports['getSubjects']=function(_0x329928,_0x694236,_0x515834){var _0x5a0a8d={};var _0x1ab9f5={};var _0x58dd21;var _0x1a1442;return db['SalesforceConfiguration'][_0xa573('0x4e')]({'where':{'id':_0x329928['params']['id']}})['then'](handleEntityNotFound(_0x694236,null))['then'](function(_0x2db30a){if(_0x2db30a){_0x58dd21=_0x2db30a;_0x1ab9f5[_0xa573('0x38')]=_['keys'](db['SalesforceField'][_0xa573('0x2f')]);_0x1ab9f5[_0xa573('0x31')]=_[_0xa573('0x32')](_0x329928[_0xa573('0x31')]);_0x1ab9f5[_0xa573('0x33')]=_[_0xa573('0x35')](_0x1ab9f5['model'],_0x1ab9f5['query']);_0x5a0a8d['attributes']=_[_0xa573('0x35')](_0x1ab9f5[_0xa573('0x38')],qs[_0xa573('0x36')](_0x329928[_0xa573('0x31')][_0xa573('0x36')]));_0x5a0a8d[_0xa573('0x34')]=_0x5a0a8d['attributes'][_0xa573('0x37')]?_0x5a0a8d[_0xa573('0x34')]:_0x1ab9f5[_0xa573('0x38')];_0x5a0a8d[_0xa573('0x3b')]=qs['sort'](_0x329928['query'][_0xa573('0x3c')]);_0x5a0a8d[_0xa573('0x3e')]=qs[_0xa573('0x33')](_[_0xa573('0x50')](_0x329928['query'],_0x1ab9f5[_0xa573('0x33')]));if(_0x329928[_0xa573('0x31')][_0xa573('0x3d')]){_0x5a0a8d[_0xa573('0x3e')]=_[_0xa573('0x40')](_0x5a0a8d[_0xa573('0x3e')],{'$or':_[_0xa573('0x2e')](_0x5a0a8d[_0xa573('0x34')],function(_0xd7a2b7){var _0x542b1a={};_0x542b1a[_0xd7a2b7]={'$like':'%'+_0x329928['query'][_0xa573('0x3d')]+'%'};return _0x542b1a;})});}_0x5a0a8d=_[_0xa573('0x40')]({},_0x5a0a8d,_0x329928[_0xa573('0x41')]);return _0x58dd21['getSubjects'](_0x5a0a8d);}})[_0xa573('0x27')](function(_0x2603c5){if(_0x2603c5){_0x1a1442=_0x2603c5['length'];if(!_0x329928[_0xa573('0x31')][_0xa573('0x39')](_0xa573('0x3a'))){_0x5a0a8d[_0xa573('0x1f')]=qs[_0xa573('0x1f')](_0x329928[_0xa573('0x31')][_0xa573('0x1f')]);_0x5a0a8d[_0xa573('0x1d')]=qs[_0xa573('0x1d')](_0x329928[_0xa573('0x31')][_0xa573('0x1d')]);}return _0x58dd21['getSubjects'](_0x5a0a8d);}})[_0xa573('0x27')](function(_0x1f25c9){if(_0x1f25c9){return _0x1f25c9?{'count':_0x1a1442,'rows':_0x1f25c9}:null;}})[_0xa573('0x27')](respondWithResult(_0x694236,null))[_0xa573('0x47')](handleError(_0x694236,null));};exports['getDescriptions']=function(_0x463285,_0x3b2bde,_0x44a88e){var _0x5cffab={};var _0x3ef23a={};var _0x30a5fc;var _0xb1263;return db[_0xa573('0x42')][_0xa573('0x4e')]({'where':{'id':_0x463285['params']['id']}})[_0xa573('0x27')](handleEntityNotFound(_0x3b2bde,null))[_0xa573('0x27')](function(_0x2f59b9){if(_0x2f59b9){_0x30a5fc=_0x2f59b9;_0x3ef23a['model']=_[_0xa573('0x32')](db['SalesforceField'][_0xa573('0x2f')]);_0x3ef23a[_0xa573('0x31')]=_[_0xa573('0x32')](_0x463285[_0xa573('0x31')]);_0x3ef23a['filters']=_[_0xa573('0x35')](_0x3ef23a[_0xa573('0x38')],_0x3ef23a[_0xa573('0x31')]);_0x5cffab['attributes']=_[_0xa573('0x35')](_0x3ef23a[_0xa573('0x38')],qs[_0xa573('0x36')](_0x463285[_0xa573('0x31')][_0xa573('0x36')]));_0x5cffab['attributes']=_0x5cffab['attributes'][_0xa573('0x37')]?_0x5cffab['attributes']:_0x3ef23a['model'];_0x5cffab[_0xa573('0x3b')]=qs[_0xa573('0x3c')](_0x463285[_0xa573('0x31')][_0xa573('0x3c')]);_0x5cffab[_0xa573('0x3e')]=qs[_0xa573('0x33')](_[_0xa573('0x50')](_0x463285[_0xa573('0x31')],_0x3ef23a[_0xa573('0x33')]));if(_0x463285[_0xa573('0x31')][_0xa573('0x3d')]){_0x5cffab['where']=_[_0xa573('0x40')](_0x5cffab[_0xa573('0x3e')],{'$or':_[_0xa573('0x2e')](_0x5cffab[_0xa573('0x34')],function(_0x3bcb0d){var _0x2feb60={};_0x2feb60[_0x3bcb0d]={'$like':'%'+_0x463285[_0xa573('0x31')][_0xa573('0x3d')]+'%'};return _0x2feb60;})});}_0x5cffab=_[_0xa573('0x40')]({},_0x5cffab,_0x463285[_0xa573('0x41')]);return _0x30a5fc[_0xa573('0x51')](_0x5cffab);}})[_0xa573('0x27')](function(_0x14f0da){if(_0x14f0da){_0xb1263=_0x14f0da[_0xa573('0x37')];if(!_0x463285[_0xa573('0x31')][_0xa573('0x39')](_0xa573('0x3a'))){_0x5cffab[_0xa573('0x1f')]=qs[_0xa573('0x1f')](_0x463285['query'][_0xa573('0x1f')]);_0x5cffab[_0xa573('0x1d')]=qs[_0xa573('0x1d')](_0x463285[_0xa573('0x31')][_0xa573('0x1d')]);}return _0x30a5fc[_0xa573('0x51')](_0x5cffab);}})['then'](function(_0x2d4543){if(_0x2d4543){return _0x2d4543?{'count':_0xb1263,'rows':_0x2d4543}:null;}})[_0xa573('0x27')](respondWithResult(_0x3b2bde,null))[_0xa573('0x47')](handleError(_0x3b2bde,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7ec6e95..b2d123c 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x942a=['rimraf','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3045c9,_0x41afe3){var _0x3f5dd2=function(_0x1d760f){while(--_0x1d760f){_0x3045c9['push'](_0x3045c9['shift']());}};_0x3f5dd2(++_0x41afe3);}(_0x942a,0x130));var _0xa942=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x942a[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xa942('0x0'));var util=require(_0xa942('0x1'));var logger=require(_0xa942('0x2'))(_0xa942('0x3'));var moment=require(_0xa942('0x4'));var BPromise=require(_0xa942('0x5'));var rp=require(_0xa942('0x6'));var fs=require('fs');var path=require(_0xa942('0x7'));var rimraf=require(_0xa942('0x8'));var config=require('../../config/environment');var attributes=require(_0xa942('0x9'));module[_0xa942('0xa')]=function(_0x2abca9,_0x553ef7){return _0x2abca9['define'](_0xa942('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2cb=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','api','moment','bluebird','path','rimraf'];(function(_0x2fb136,_0x31d182){var _0x170aa0=function(_0x573c82){while(--_0x573c82){_0x2fb136['push'](_0x2fb136['shift']());}};_0x170aa0(++_0x31d182);}(_0xe2cb,0x7e));var _0xbe2c=function(_0x301f15,_0x1171bc){_0x301f15=_0x301f15-0x0;var _0x3d3204=_0xe2cb[_0x301f15];return _0x3d3204;};'use strict';var _=require(_0xbe2c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe2c('0x1'));var moment=require(_0xbe2c('0x2'));var BPromise=require(_0xbe2c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe2c('0x4'));var rimraf=require(_0xbe2c('0x5'));var config=require(_0xbe2c('0x6'));var attributes=require(_0xbe2c('0x7'));module[_0xbe2c('0x8')]=function(_0x40443f,_0x5dca6b){return _0x40443f[_0xbe2c('0x9')](_0xbe2c('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index ce1a1b2..de22a2e 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0552=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','catch','lodash','moment','bluebird'];(function(_0x429fb2,_0x23d6d1){var _0x4fbf15=function(_0x438c41){while(--_0x438c41){_0x429fb2['push'](_0x429fb2['shift']());}};_0x4fbf15(++_0x23d6d1);}(_0x0552,0x97));var _0x2055=function(_0x426442,_0x3ae8cb){_0x426442=_0x426442-0x0;var _0x31d9d0=_0x0552[_0x426442];return _0x31d9d0;};'use strict';var _=require(_0x2055('0x0'));var util=require('util');var moment=require(_0x2055('0x1'));var BPromise=require(_0x2055('0x2'));var rs=require(_0x2055('0x3'));var fs=require('fs');var Redis=require(_0x2055('0x4'));var db=require(_0x2055('0x5'))['db'];var utils=require(_0x2055('0x6'));var logger=require(_0x2055('0x7'))(_0x2055('0x8'));var config=require(_0x2055('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2055('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x506113,_0x3405c2,_0x575217){return new BPromise(function(_0x4a4319,_0x26f9d2){return client['request'](_0x506113,_0x575217)[_0x2055('0xb')](function(_0x176702){logger[_0x2055('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3405c2,_0x2055('0xd'));logger[_0x2055('0xe')](_0x2055('0xf'),_0x3405c2,_0x2055('0xd'),JSON[_0x2055('0x10')](_0x176702));if(_0x176702[_0x2055('0x11')]){if(_0x176702['error'][_0x2055('0x12')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3405c2,_0x176702[_0x2055('0x11')][_0x2055('0x13')]);return _0x26f9d2(_0x176702[_0x2055('0x11')][_0x2055('0x13')]);}logger[_0x2055('0x11')](_0x2055('0x14'),_0x3405c2,_0x176702[_0x2055('0x11')][_0x2055('0x13')]);return _0x4a4319(_0x176702[_0x2055('0x11')][_0x2055('0x13')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3405c2,_0x2055('0xd'));_0x4a4319(_0x176702['result'][_0x2055('0x13')]);}})[_0x2055('0x15')](function(_0x4552dc){logger[_0x2055('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3405c2,_0x4552dc);_0x26f9d2(_0x4552dc);});});} \ No newline at end of file +var _0x6d4b=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x6d4b,0xb3));var _0xb6d4=function(_0x1428c4,_0x4563ee){_0x1428c4=_0x1428c4-0x0;var _0x293de6=_0x6d4b[_0x1428c4];return _0x293de6;};'use strict';var _=require(_0xb6d4('0x0'));var util=require(_0xb6d4('0x1'));var moment=require(_0xb6d4('0x2'));var BPromise=require(_0xb6d4('0x3'));var rs=require(_0xb6d4('0x4'));var fs=require('fs');var Redis=require(_0xb6d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb6d4('0x6'));var config=require(_0xb6d4('0x7'));var jayson=require(_0xb6d4('0x8'));var client=jayson[_0xb6d4('0x9')][_0xb6d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x500305,_0x16200e,_0x1e4496){return new BPromise(function(_0x35e366,_0x5702b3){return client[_0xb6d4('0xb')](_0x500305,_0x1e4496)[_0xb6d4('0xc')](function(_0x118afc){logger['info'](_0xb6d4('0xd'),_0x16200e,_0xb6d4('0xe'));logger['debug'](_0xb6d4('0xf'),_0x16200e,'request\x20sent',JSON[_0xb6d4('0x10')](_0x118afc));if(_0x118afc['error']){if(_0x118afc[_0xb6d4('0x11')][_0xb6d4('0x12')]===0x1f4){logger[_0xb6d4('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x16200e,_0x118afc[_0xb6d4('0x11')][_0xb6d4('0x13')]);return _0x5702b3(_0x118afc[_0xb6d4('0x11')]['message']);}logger[_0xb6d4('0x11')](_0xb6d4('0xd'),_0x16200e,_0x118afc['error']['message']);return _0x35e366(_0x118afc[_0xb6d4('0x11')][_0xb6d4('0x13')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x16200e,_0xb6d4('0xe'));_0x35e366(_0x118afc[_0xb6d4('0x14')]['message']);}})[_0xb6d4('0x15')](function(_0x10fef6){logger[_0xb6d4('0x11')](_0xb6d4('0xd'),_0x16200e,_0x10fef6);_0x5702b3(_0x10fef6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 78cc2b4..55ee3af 100644 --- a/server/api/intSalesforceField/index.js +++ b/server/api/intSalesforceField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x121d=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x235b42,_0x5313fb){var _0x154b18=function(_0x29aac7){while(--_0x29aac7){_0x235b42['push'](_0x235b42['shift']());}};_0x154b18(++_0x5313fb);}(_0x121d,0x19b));var _0xd121=function(_0x48599a,_0x39852b){_0x48599a=_0x48599a-0x0;var _0x21ae37=_0x121d[_0x48599a];return _0x21ae37;};'use strict';var multer=require(_0xd121('0x0'));var util=require('util');var path=require(_0xd121('0x1'));var timeout=require('connect-timeout');var express=require(_0xd121('0x2'));var router=express[_0xd121('0x3')]();var fs_extra=require(_0xd121('0x4'));var auth=require(_0xd121('0x5'));var interaction=require(_0xd121('0x6'));var config=require(_0xd121('0x7'));var controller=require(_0xd121('0x8'));router[_0xd121('0x9')]('/',auth[_0xd121('0xa')](),controller[_0xd121('0xb')]);router[_0xd121('0x9')](_0xd121('0xc'),auth[_0xd121('0xa')](),controller[_0xd121('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd121('0xe')]);router[_0xd121('0xf')]('/:id',auth[_0xd121('0xa')](),controller[_0xd121('0x10')]);router[_0xd121('0x11')](_0xd121('0xc'),auth[_0xd121('0xa')](),controller[_0xd121('0x12')]);module[_0xd121('0x13')]=router; \ No newline at end of file +var _0x0821=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','update','delete'];(function(_0x50cb82,_0xae3a9d){var _0x432572=function(_0x2a7f68){while(--_0x2a7f68){_0x50cb82['push'](_0x50cb82['shift']());}};_0x432572(++_0xae3a9d);}(_0x0821,0x1b2));var _0x1082=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x0821[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x1082('0x0'));var util=require(_0x1082('0x1'));var path=require('path');var timeout=require(_0x1082('0x2'));var express=require(_0x1082('0x3'));var router=express[_0x1082('0x4')]();var fs_extra=require(_0x1082('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1082('0x6'));var config=require(_0x1082('0x7'));var controller=require(_0x1082('0x8'));router[_0x1082('0x9')]('/',auth[_0x1082('0xa')](),controller[_0x1082('0xb')]);router[_0x1082('0x9')](_0x1082('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1082('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1082('0xc'),auth['isAuthenticated'](),controller[_0x1082('0xe')]);router[_0x1082('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1082('0x10')]);module[_0x1082('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cc15869..b5a142d 100644 --- a/server/api/intSalesforceField/intSalesforceField.attributes.js +++ b/server/api/intSalesforceField/intSalesforceField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5767=['STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x81aa14,_0x283f55){var _0x403a23=function(_0x3d983c){while(--_0x3d983c){_0x81aa14['push'](_0x81aa14['shift']());}};_0x403a23(++_0x283f55);}(_0x5767,0x169));var _0x7576=function(_0x333d0f,_0x5e49a2){_0x333d0f=_0x333d0f-0x0;var _0x14cdce=_0x5767[_0x333d0f];return _0x14cdce;};'use strict';var Sequelize=require(_0x7576('0x0'));module[_0x7576('0x1')]={'type':{'type':Sequelize[_0x7576('0x2')]('string',_0x7576('0x3'),_0x7576('0x4'),_0x7576('0x5'),_0x7576('0x6')),'defaultValue':_0x7576('0x7')},'content':{'type':Sequelize[_0x7576('0x8')]},'key':{'type':Sequelize[_0x7576('0x8')]},'keyType':{'type':Sequelize[_0x7576('0x2')](_0x7576('0x7'),'variable',_0x7576('0x4'))},'keyContent':{'type':Sequelize[_0x7576('0x8')]},'idField':{'type':Sequelize[_0x7576('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8826=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x3130da,_0x149c63){var _0x520a14=function(_0x20e5a5){while(--_0x20e5a5){_0x3130da['push'](_0x3130da['shift']());}};_0x520a14(++_0x149c63);}(_0x8826,0x14b));var _0x6882=function(_0x583a3d,_0x8b12a2){_0x583a3d=_0x583a3d-0x0;var _0x3d59b7=_0x8826[_0x583a3d];return _0x3d59b7;};'use strict';var Sequelize=require(_0x6882('0x0'));module[_0x6882('0x1')]={'type':{'type':Sequelize[_0x6882('0x2')](_0x6882('0x3'),_0x6882('0x4'),_0x6882('0x5'),_0x6882('0x6'),_0x6882('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6882('0x8')]},'key':{'type':Sequelize[_0x6882('0x8')]},'keyType':{'type':Sequelize[_0x6882('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x6882('0x8')]},'idField':{'type':Sequelize[_0x6882('0x8')]},'variableName':{'type':Sequelize[_0x6882('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 4147a82..697ce85 100644 --- a/server/api/intSalesforceField/intSalesforceField.controller.js +++ b/server/api/intSalesforceField/intSalesforceField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc04a=['fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','then','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','rows','show','includeAll','include','find','catch','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xc04a,0xd7));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xac04('0x0'));var rimraf=require(_0xac04('0x1'));var zipdir=require(_0xac04('0x2'));var jsonpatch=require(_0xac04('0x3'));var rp=require(_0xac04('0x4'));var moment=require(_0xac04('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xac04('0x6'));var util=require(_0xac04('0x7'));var path=require(_0xac04('0x8'));var sox=require('sox');var csv=require(_0xac04('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac04('0xa'));var _=require(_0xac04('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac04('0xc'));var deskjs=require(_0xac04('0xd'));var toCsv=require(_0xac04('0x9'));var querystring=require(_0xac04('0xe'));var Papa=require(_0xac04('0xf'));var Redis=require(_0xac04('0x10'));var authService=require(_0xac04('0x11'));var qs=require(_0xac04('0x12'));var as=require(_0xac04('0x13'));var hardwareService=require(_0xac04('0x14'));var logger=require(_0xac04('0x15'))(_0xac04('0x16'));var utils=require(_0xac04('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac04('0x18'))['db'];function respondWithStatusCode(_0x303a81,_0x2c8768){_0x2c8768=_0x2c8768||0xcc;return function(_0x4806bc){if(_0x4806bc){return _0x303a81[_0xac04('0x19')](_0x2c8768);}return _0x303a81['status'](_0x2c8768)['end']();};}function respondWithResult(_0x6924d,_0x24d37a){_0x24d37a=_0x24d37a||0xc8;return function(_0x5622d7){if(_0x5622d7){return _0x6924d[_0xac04('0x1a')](_0x24d37a)['json'](_0x5622d7);}};}function respondWithFilteredResult(_0x4f3f7b,_0x28e853){return function(_0x46d218){if(_0x46d218){var _0xdaa286=typeof _0x28e853[_0xac04('0x1b')]===_0xac04('0x1c')&&typeof _0x28e853[_0xac04('0x1d')]===_0xac04('0x1c');var _0x33d701=_0x46d218[_0xac04('0x1e')];var _0x388667=_0xdaa286?0x0:_0x28e853['offset'];var _0x4a34b4=_0xdaa286?_0x46d218[_0xac04('0x1e')]:_0x28e853['offset']+_0x28e853[_0xac04('0x1d')];var _0x1fba4f;if(_0x4a34b4>=_0x33d701){_0x4a34b4=_0x33d701;_0x1fba4f=0xc8;}else{_0x1fba4f=0xce;}_0x4f3f7b[_0xac04('0x1a')](_0x1fba4f);return _0x4f3f7b['set']('Content-Range',_0x388667+'-'+_0x4a34b4+'/'+_0x33d701)[_0xac04('0x1f')](_0x46d218);}return null;};}function patchUpdates(_0x3005e1){return function(_0x3c82b3){try{jsonpatch[_0xac04('0x20')](_0x3c82b3,_0x3005e1,!![]);}catch(_0x3f058a){return BPromise[_0xac04('0x21')](_0x3f058a);}return _0x3c82b3[_0xac04('0x22')]();};}function saveUpdates(_0x627374,_0x3a5912){return function(_0x4af9cb){if(_0x4af9cb){return _0x4af9cb[_0xac04('0x23')](_0x627374)[_0xac04('0x24')](function(_0x3ad8d0){return _0x3ad8d0;});}return null;};}function removeEntity(_0xd7454d,_0x229119){return function(_0x547a9){if(_0x547a9){return _0x547a9['destroy']()[_0xac04('0x24')](function(){_0xd7454d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x591535,_0x2699f9){return function(_0x35a724){if(!_0x35a724){_0x591535[_0xac04('0x19')](0x194);}return _0x35a724;};}function handleError(_0x5193f3,_0x45e7ea){_0x45e7ea=_0x45e7ea||0x1f4;return function(_0x37351d){logger[_0xac04('0x25')](_0x37351d[_0xac04('0x26')]);if(_0x37351d['name']){delete _0x37351d[_0xac04('0x27')];}_0x5193f3[_0xac04('0x1a')](_0x45e7ea)['send'](_0x37351d);};}exports[_0xac04('0x28')]=function(_0x5d99bb,_0x366270){var _0x5d1b19={},_0x5ad60d={},_0xd5d74e={'count':0x0,'rows':[]};var _0x132e2f=_[_0xac04('0x29')](db[_0xac04('0x2a')][_0xac04('0x2b')],function(_0x164e99){return{'name':_0x164e99[_0xac04('0x2c')],'type':_0x164e99[_0xac04('0x2d')][_0xac04('0x2e')]};});_0x5ad60d['model']=_[_0xac04('0x29')](_0x132e2f,_0xac04('0x27'));_0x5ad60d[_0xac04('0x2f')]=_[_0xac04('0x30')](_0x5d99bb['query']);_0x5ad60d[_0xac04('0x31')]=_['intersection'](_0x5ad60d[_0xac04('0x32')],_0x5ad60d[_0xac04('0x2f')]);_0x5d1b19[_0xac04('0x33')]=_[_0xac04('0x34')](_0x5ad60d['model'],qs[_0xac04('0x35')](_0x5d99bb[_0xac04('0x2f')][_0xac04('0x35')]));_0x5d1b19['attributes']=_0x5d1b19[_0xac04('0x33')][_0xac04('0x36')]?_0x5d1b19['attributes']:_0x5ad60d[_0xac04('0x32')];if(!_0x5d99bb[_0xac04('0x2f')][_0xac04('0x37')](_0xac04('0x38'))){_0x5d1b19[_0xac04('0x1d')]=qs[_0xac04('0x1d')](_0x5d99bb[_0xac04('0x2f')][_0xac04('0x1d')]);_0x5d1b19[_0xac04('0x1b')]=qs['offset'](_0x5d99bb[_0xac04('0x2f')][_0xac04('0x1b')]);}_0x5d1b19[_0xac04('0x39')]=qs['sort'](_0x5d99bb[_0xac04('0x2f')][_0xac04('0x3a')]);_0x5d1b19['where']=qs['filters'](_[_0xac04('0x3b')](_0x5d99bb[_0xac04('0x2f')],_0x5ad60d[_0xac04('0x31')]),_0x132e2f);if(_0x5d99bb[_0xac04('0x2f')][_0xac04('0x3c')]){_0x5d1b19[_0xac04('0x3d')]=_[_0xac04('0x3e')](_0x5d1b19[_0xac04('0x3d')],{'$or':_[_0xac04('0x29')](_0x132e2f,function(_0x181f23){if(_0x181f23['type']!==_0xac04('0x3f')){var _0xe703b7={};_0xe703b7[_0x181f23[_0xac04('0x27')]]={'$like':'%'+_0x5d99bb[_0xac04('0x2f')][_0xac04('0x3c')]+'%'};return _0xe703b7;}})});}_0x5d1b19=_[_0xac04('0x3e')]({},_0x5d1b19,_0x5d99bb[_0xac04('0x40')]);var _0x161709={'where':_0x5d1b19['where']};return db['SalesforceField'][_0xac04('0x1e')](_0x161709)[_0xac04('0x24')](function(_0x4ebb97){_0xd5d74e['count']=_0x4ebb97;if(_0x5d99bb['query']['includeAll']){_0x5d1b19['include']=[{'all':!![]}];}return db[_0xac04('0x2a')]['findAll'](_0x5d1b19);})[_0xac04('0x24')](function(_0x5e5f18){_0xd5d74e[_0xac04('0x41')]=_0x5e5f18;return _0xd5d74e;})[_0xac04('0x24')](respondWithFilteredResult(_0x366270,_0x5d1b19))['catch'](handleError(_0x366270,null));};exports[_0xac04('0x42')]=function(_0x2fee46,_0x553145){var _0x39d777={'raw':!![],'where':{'id':_0x2fee46['params']['id']}},_0x14675e={};_0x14675e[_0xac04('0x32')]=_[_0xac04('0x30')](db[_0xac04('0x2a')]['rawAttributes']);_0x14675e[_0xac04('0x2f')]=_[_0xac04('0x30')](_0x2fee46[_0xac04('0x2f')]);_0x14675e[_0xac04('0x31')]=_['intersection'](_0x14675e[_0xac04('0x32')],_0x14675e[_0xac04('0x2f')]);_0x39d777[_0xac04('0x33')]=_[_0xac04('0x34')](_0x14675e['model'],qs['fields'](_0x2fee46[_0xac04('0x2f')][_0xac04('0x35')]));_0x39d777[_0xac04('0x33')]=_0x39d777[_0xac04('0x33')][_0xac04('0x36')]?_0x39d777[_0xac04('0x33')]:_0x14675e[_0xac04('0x32')];if(_0x2fee46[_0xac04('0x2f')][_0xac04('0x43')]){_0x39d777[_0xac04('0x44')]=[{'all':!![]}];}_0x39d777=_['merge']({},_0x39d777,_0x2fee46['options']);return db[_0xac04('0x2a')][_0xac04('0x45')](_0x39d777)[_0xac04('0x24')](handleEntityNotFound(_0x553145,null))['then'](respondWithResult(_0x553145,null))[_0xac04('0x46')](handleError(_0x553145,null));};exports[_0xac04('0x47')]=function(_0x3c1761,_0xe19c16){return db[_0xac04('0x2a')][_0xac04('0x47')](_0x3c1761[_0xac04('0x48')],{})[_0xac04('0x24')](respondWithResult(_0xe19c16,0xc9))[_0xac04('0x46')](handleError(_0xe19c16,null));};exports[_0xac04('0x23')]=function(_0x2d63a3,_0x1ad7bb){if(_0x2d63a3[_0xac04('0x48')]['id']){delete _0x2d63a3['body']['id'];}return db['SalesforceField'][_0xac04('0x45')]({'where':{'id':_0x2d63a3['params']['id']}})['then'](handleEntityNotFound(_0x1ad7bb,null))[_0xac04('0x24')](saveUpdates(_0x2d63a3[_0xac04('0x48')],null))[_0xac04('0x24')](respondWithResult(_0x1ad7bb,null))[_0xac04('0x46')](handleError(_0x1ad7bb,null));};exports[_0xac04('0x49')]=function(_0x54ac64,_0x5b3654){return db['SalesforceField'][_0xac04('0x45')]({'where':{'id':_0x54ac64[_0xac04('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b3654,null))[_0xac04('0x24')](removeEntity(_0x5b3654,null))[_0xac04('0x46')](handleError(_0x5b3654,null));}; \ No newline at end of file +var _0x34f9=['nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','SalesforceField','includeAll','include','findAll','catch','show','create','body','update','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','keys','query','intersection','fields','attributes','length'];(function(_0x37e629,_0x5a72d4){var _0x2d3268=function(_0x3fcbcb){while(--_0x3fcbcb){_0x37e629['push'](_0x37e629['shift']());}};_0x2d3268(++_0x5a72d4);}(_0x34f9,0xa9));var _0x934f=function(_0x20d44b,_0x2fdbac){_0x20d44b=_0x20d44b-0x0;var _0x1e7fd1=_0x34f9[_0x20d44b];return _0x1e7fd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x934f('0x0'));var zipdir=require(_0x934f('0x1'));var jsonpatch=require(_0x934f('0x2'));var rp=require(_0x934f('0x3'));var moment=require(_0x934f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x934f('0x5'));var util=require(_0x934f('0x6'));var path=require('path');var sox=require(_0x934f('0x7'));var csv=require(_0x934f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x934f('0x9'));var _=require('lodash');var squel=require(_0x934f('0xa'));var crypto=require(_0x934f('0xb'));var jsforce=require(_0x934f('0xc'));var deskjs=require(_0x934f('0xd'));var toCsv=require(_0x934f('0x8'));var querystring=require(_0x934f('0xe'));var Papa=require('papaparse');var Redis=require(_0x934f('0xf'));var authService=require(_0x934f('0x10'));var qs=require(_0x934f('0x11'));var as=require(_0x934f('0x12'));var hardwareService=require(_0x934f('0x13'));var logger=require('../../config/logger')(_0x934f('0x14'));var utils=require(_0x934f('0x15'));var config=require(_0x934f('0x16'));var licenseUtil=require(_0x934f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314736,_0x424fc9){_0x424fc9=_0x424fc9||0xcc;return function(_0xc6a73f){if(_0xc6a73f){return _0x314736[_0x934f('0x18')](_0x424fc9);}return _0x314736['status'](_0x424fc9)[_0x934f('0x19')]();};}function respondWithResult(_0x44eb71,_0x14d7e1){_0x14d7e1=_0x14d7e1||0xc8;return function(_0x374692){if(_0x374692){return _0x44eb71[_0x934f('0x1a')](_0x14d7e1)['json'](_0x374692);}};}function respondWithFilteredResult(_0x495e94,_0x42f094){return function(_0x615d44){if(_0x615d44){var _0x546814=typeof _0x42f094[_0x934f('0x1b')]===_0x934f('0x1c')&&typeof _0x42f094[_0x934f('0x1d')]===_0x934f('0x1c');var _0x58372b=_0x615d44[_0x934f('0x1e')];var _0x19ed57=_0x546814?0x0:_0x42f094['offset'];var _0x4078e3=_0x546814?_0x615d44[_0x934f('0x1e')]:_0x42f094[_0x934f('0x1b')]+_0x42f094[_0x934f('0x1d')];var _0x49d54c;if(_0x4078e3>=_0x58372b){_0x4078e3=_0x58372b;_0x49d54c=0xc8;}else{_0x49d54c=0xce;}_0x495e94['status'](_0x49d54c);return _0x495e94[_0x934f('0x1f')](_0x934f('0x20'),_0x19ed57+'-'+_0x4078e3+'/'+_0x58372b)[_0x934f('0x21')](_0x615d44);}return null;};}function patchUpdates(_0x5d7b8c){return function(_0x2a565e){try{jsonpatch['apply'](_0x2a565e,_0x5d7b8c,!![]);}catch(_0x1d748c){return BPromise[_0x934f('0x22')](_0x1d748c);}return _0x2a565e[_0x934f('0x23')]();};}function saveUpdates(_0x1a97bf,_0x1e0ddb){return function(_0x3834ac){if(_0x3834ac){return _0x3834ac['update'](_0x1a97bf)[_0x934f('0x24')](function(_0x1dbe06){return _0x1dbe06;});}return null;};}function removeEntity(_0x243c56,_0x11c93d){return function(_0x56bd9e){if(_0x56bd9e){return _0x56bd9e[_0x934f('0x25')]()['then'](function(){_0x243c56[_0x934f('0x1a')](0xcc)[_0x934f('0x19')]();});}};}function handleEntityNotFound(_0x5cd902,_0x1b6e39){return function(_0x331269){if(!_0x331269){_0x5cd902[_0x934f('0x18')](0x194);}return _0x331269;};}function handleError(_0x59c7a6,_0x5b9bb0){_0x5b9bb0=_0x5b9bb0||0x1f4;return function(_0x187b44){logger[_0x934f('0x26')](_0x187b44[_0x934f('0x27')]);if(_0x187b44[_0x934f('0x28')]){delete _0x187b44['name'];}_0x59c7a6[_0x934f('0x1a')](_0x5b9bb0)[_0x934f('0x29')](_0x187b44);};}exports[_0x934f('0x2a')]=function(_0x408087,_0x5ed921){var _0x28908a={},_0x2b4a74={},_0x301918={'count':0x0,'rows':[]};var _0x36d0a6=_[_0x934f('0x2b')](db['SalesforceField'][_0x934f('0x2c')],function(_0x17ab2f){return{'name':_0x17ab2f['fieldName'],'type':_0x17ab2f['type'][_0x934f('0x2d')]};});_0x2b4a74[_0x934f('0x2e')]=_[_0x934f('0x2b')](_0x36d0a6,'name');_0x2b4a74['query']=_[_0x934f('0x2f')](_0x408087[_0x934f('0x30')]);_0x2b4a74['filters']=_[_0x934f('0x31')](_0x2b4a74['model'],_0x2b4a74[_0x934f('0x30')]);_0x28908a['attributes']=_['intersection'](_0x2b4a74[_0x934f('0x2e')],qs[_0x934f('0x32')](_0x408087[_0x934f('0x30')][_0x934f('0x32')]));_0x28908a['attributes']=_0x28908a[_0x934f('0x33')][_0x934f('0x34')]?_0x28908a[_0x934f('0x33')]:_0x2b4a74[_0x934f('0x2e')];if(!_0x408087['query']['hasOwnProperty'](_0x934f('0x35'))){_0x28908a['limit']=qs[_0x934f('0x1d')](_0x408087[_0x934f('0x30')][_0x934f('0x1d')]);_0x28908a['offset']=qs[_0x934f('0x1b')](_0x408087[_0x934f('0x30')]['offset']);}_0x28908a[_0x934f('0x36')]=qs[_0x934f('0x37')](_0x408087[_0x934f('0x30')][_0x934f('0x37')]);_0x28908a[_0x934f('0x38')]=qs[_0x934f('0x39')](_['pick'](_0x408087[_0x934f('0x30')],_0x2b4a74[_0x934f('0x39')]),_0x36d0a6);if(_0x408087[_0x934f('0x30')][_0x934f('0x3a')]){_0x28908a[_0x934f('0x38')]=_[_0x934f('0x3b')](_0x28908a[_0x934f('0x38')],{'$or':_[_0x934f('0x2b')](_0x36d0a6,function(_0x214cee){if(_0x214cee[_0x934f('0x3c')]!==_0x934f('0x3d')){var _0x4d0804={};_0x4d0804[_0x214cee['name']]={'$like':'%'+_0x408087[_0x934f('0x30')][_0x934f('0x3a')]+'%'};return _0x4d0804;}})});}_0x28908a=_[_0x934f('0x3b')]({},_0x28908a,_0x408087[_0x934f('0x3e')]);var _0x5eb0d4={'where':_0x28908a[_0x934f('0x38')]};return db[_0x934f('0x3f')][_0x934f('0x1e')](_0x5eb0d4)[_0x934f('0x24')](function(_0x39bafa){_0x301918['count']=_0x39bafa;if(_0x408087[_0x934f('0x30')][_0x934f('0x40')]){_0x28908a[_0x934f('0x41')]=[{'all':!![]}];}return db[_0x934f('0x3f')][_0x934f('0x42')](_0x28908a);})[_0x934f('0x24')](function(_0x2cf341){_0x301918['rows']=_0x2cf341;return _0x301918;})[_0x934f('0x24')](respondWithFilteredResult(_0x5ed921,_0x28908a))[_0x934f('0x43')](handleError(_0x5ed921,null));};exports[_0x934f('0x44')]=function(_0x42caea,_0x301328){var _0x244943={'raw':!![],'where':{'id':_0x42caea['params']['id']}},_0x54cba1={};_0x54cba1['model']=_['keys'](db[_0x934f('0x3f')][_0x934f('0x2c')]);_0x54cba1['query']=_[_0x934f('0x2f')](_0x42caea[_0x934f('0x30')]);_0x54cba1[_0x934f('0x39')]=_[_0x934f('0x31')](_0x54cba1[_0x934f('0x2e')],_0x54cba1[_0x934f('0x30')]);_0x244943[_0x934f('0x33')]=_[_0x934f('0x31')](_0x54cba1[_0x934f('0x2e')],qs[_0x934f('0x32')](_0x42caea['query'][_0x934f('0x32')]));_0x244943[_0x934f('0x33')]=_0x244943[_0x934f('0x33')][_0x934f('0x34')]?_0x244943[_0x934f('0x33')]:_0x54cba1[_0x934f('0x2e')];if(_0x42caea[_0x934f('0x30')][_0x934f('0x40')]){_0x244943[_0x934f('0x41')]=[{'all':!![]}];}_0x244943=_['merge']({},_0x244943,_0x42caea['options']);return db['SalesforceField']['find'](_0x244943)['then'](handleEntityNotFound(_0x301328,null))[_0x934f('0x24')](respondWithResult(_0x301328,null))['catch'](handleError(_0x301328,null));};exports[_0x934f('0x45')]=function(_0x5197b5,_0x23d71f){return db[_0x934f('0x3f')][_0x934f('0x45')](_0x5197b5[_0x934f('0x46')],{})[_0x934f('0x24')](respondWithResult(_0x23d71f,0xc9))[_0x934f('0x43')](handleError(_0x23d71f,null));};exports[_0x934f('0x47')]=function(_0x484065,_0x2b1280){if(_0x484065['body']['id']){delete _0x484065[_0x934f('0x46')]['id'];}return db[_0x934f('0x3f')][_0x934f('0x48')]({'where':{'id':_0x484065[_0x934f('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b1280,null))[_0x934f('0x24')](saveUpdates(_0x484065[_0x934f('0x46')],null))[_0x934f('0x24')](respondWithResult(_0x2b1280,null))[_0x934f('0x43')](handleError(_0x2b1280,null));};exports[_0x934f('0x25')]=function(_0x2fdd91,_0xc67b3c){return db[_0x934f('0x3f')]['find']({'where':{'id':_0x2fdd91[_0x934f('0x49')]['id']}})[_0x934f('0x24')](handleEntityNotFound(_0xc67b3c,null))['then'](removeEntity(_0xc67b3c,null))[_0x934f('0x43')](handleError(_0xc67b3c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ca0a337..cb215d6 100644 --- a/server/api/intSalesforceField/intSalesforceField.model.js +++ b/server/api/intSalesforceField/intSalesforceField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc361=['path','rimraf','../../config/environment','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1dfc07,_0x32af96){var _0x1504b8=function(_0x37546){while(--_0x37546){_0x1dfc07['push'](_0x1dfc07['shift']());}};_0x1504b8(++_0x32af96);}(_0xc361,0xc9));var _0x1c36=function(_0x543f28,_0x216cab){_0x543f28=_0x543f28-0x0;var _0x951f97=_0xc361[_0x543f28];return _0x951f97;};'use strict';var _=require(_0x1c36('0x0'));var util=require(_0x1c36('0x1'));var logger=require(_0x1c36('0x2'))(_0x1c36('0x3'));var moment=require(_0x1c36('0x4'));var BPromise=require(_0x1c36('0x5'));var rp=require(_0x1c36('0x6'));var fs=require('fs');var path=require(_0x1c36('0x7'));var rimraf=require(_0x1c36('0x8'));var config=require(_0x1c36('0x9'));var attributes=require('./intSalesforceField.attributes');module[_0x1c36('0xa')]=function(_0x44d7da,_0xf27fa1){return _0x44d7da[_0x1c36('0xb')](_0x1c36('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x1c36('0xd'),'fields':[_0x1c36('0xe'),_0x1c36('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc63a=['define','int_salesforce_fields','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x202f67,_0x3ea56f){var _0x50438f=function(_0x581428){while(--_0x581428){_0x202f67['push'](_0x202f67['shift']());}};_0x50438f(++_0x3ea56f);}(_0xc63a,0x84));var _0xac63=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xc63a[_0x4eafed];return _0x159c85;};'use strict';var _=require(_0xac63('0x0'));var util=require(_0xac63('0x1'));var logger=require('../../config/logger')(_0xac63('0x2'));var moment=require(_0xac63('0x3'));var BPromise=require(_0xac63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac63('0x5'));var rimraf=require(_0xac63('0x6'));var config=require(_0xac63('0x7'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x3dd1bf,_0x1e129f){return _0x3dd1bf[_0xac63('0x8')]('SalesforceField',attributes,{'tableName':_0xac63('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b6baf0f..e99bbba 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd79a=['../../config/environment','jayson/promise','client','request','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x80d755,_0x23d02e){var _0x52eae9=function(_0xf64a15){while(--_0xf64a15){_0x80d755['push'](_0x80d755['shift']());}};_0x52eae9(++_0x23d02e);}(_0xd79a,0x108));var _0xad79=function(_0x25c62e,_0x458d70){_0x25c62e=_0x25c62e-0x0;var _0x1e22a6=_0xd79a[_0x25c62e];return _0x1e22a6;};'use strict';var _=require(_0xad79('0x0'));var util=require(_0xad79('0x1'));var moment=require(_0xad79('0x2'));var BPromise=require(_0xad79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad79('0x4'));var db=require(_0xad79('0x5'))['db'];var utils=require(_0xad79('0x6'));var logger=require(_0xad79('0x7'))(_0xad79('0x8'));var config=require(_0xad79('0x9'));var jayson=require(_0xad79('0xa'));var client=jayson[_0xad79('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56c41c,_0x3067bc,_0x321f00){return new BPromise(function(_0x5bed09,_0x3a794b){return client[_0xad79('0xc')](_0x56c41c,_0x321f00)['then'](function(_0x5c8f2a){logger['info'](_0xad79('0xd'),_0x3067bc,_0xad79('0xe'));logger['debug'](_0xad79('0xf'),_0x3067bc,'request\x20sent',JSON[_0xad79('0x10')](_0x5c8f2a));if(_0x5c8f2a[_0xad79('0x11')]){if(_0x5c8f2a['error']['code']===0x1f4){logger[_0xad79('0x11')]('SalesforceField,\x20%s,\x20%s',_0x3067bc,_0x5c8f2a[_0xad79('0x11')][_0xad79('0x12')]);return _0x3a794b(_0x5c8f2a[_0xad79('0x11')][_0xad79('0x12')]);}logger[_0xad79('0x11')](_0xad79('0xd'),_0x3067bc,_0x5c8f2a[_0xad79('0x11')]['message']);return _0x5bed09(_0x5c8f2a[_0xad79('0x11')][_0xad79('0x12')]);}else{logger['info'](_0xad79('0xd'),_0x3067bc,_0xad79('0xe'));_0x5bed09(_0x5c8f2a[_0xad79('0x13')][_0xad79('0x12')]);}})[_0xad79('0x14')](function(_0x1539d9){logger[_0xad79('0x11')](_0xad79('0xd'),_0x3067bc,_0x1539d9);_0x3a794b(_0x1539d9);});});} \ No newline at end of file +var _0xf519=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x57709e,_0x443595){var _0x131292=function(_0xf90d9f){while(--_0xf90d9f){_0x57709e['push'](_0x57709e['shift']());}};_0x131292(++_0x443595);}(_0xf519,0x151));var _0x9f51=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xf519[_0x37cc52];return _0x2b4a90;};'use strict';var _=require(_0x9f51('0x0'));var util=require('util');var moment=require(_0x9f51('0x1'));var BPromise=require(_0x9f51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f51('0x3'));var db=require(_0x9f51('0x4'))['db'];var utils=require(_0x9f51('0x5'));var logger=require(_0x9f51('0x6'))(_0x9f51('0x7'));var config=require(_0x9f51('0x8'));var jayson=require(_0x9f51('0x9'));var client=jayson[_0x9f51('0xa')][_0x9f51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264169,_0x39220f,_0x58fd38){return new BPromise(function(_0x42eba9,_0x18f2ce){return client[_0x9f51('0xc')](_0x264169,_0x58fd38)[_0x9f51('0xd')](function(_0x5279d4){logger[_0x9f51('0xe')](_0x9f51('0xf'),_0x39220f,_0x9f51('0x10'));logger[_0x9f51('0x11')](_0x9f51('0x12'),_0x39220f,_0x9f51('0x10'),JSON['stringify'](_0x5279d4));if(_0x5279d4['error']){if(_0x5279d4[_0x9f51('0x13')][_0x9f51('0x14')]===0x1f4){logger[_0x9f51('0x13')](_0x9f51('0xf'),_0x39220f,_0x5279d4[_0x9f51('0x13')][_0x9f51('0x15')]);return _0x18f2ce(_0x5279d4[_0x9f51('0x13')][_0x9f51('0x15')]);}logger[_0x9f51('0x13')](_0x9f51('0xf'),_0x39220f,_0x5279d4[_0x9f51('0x13')]['message']);return _0x42eba9(_0x5279d4[_0x9f51('0x13')]['message']);}else{logger[_0x9f51('0xe')](_0x9f51('0xf'),_0x39220f,'request\x20sent');_0x42eba9(_0x5279d4[_0x9f51('0x16')][_0x9f51('0x15')]);}})[_0x9f51('0x17')](function(_0x2a4fd1){logger[_0x9f51('0x13')](_0x9f51('0xf'),_0x39220f,_0x2a4fd1);_0x18f2ce(_0x2a4fd1);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b05b959..4252984 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff91=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','/:id','update'];(function(_0x220ea9,_0x4caa02){var _0x122e9f=function(_0x33d063){while(--_0x33d063){_0x220ea9['push'](_0x220ea9['shift']());}};_0x122e9f(++_0x4caa02);}(_0xff91,0x1d1));var _0x1ff9=function(_0x42d6d3,_0x548af5){_0x42d6d3=_0x42d6d3-0x0;var _0x5f2e34=_0xff91[_0x42d6d3];return _0x5f2e34;};'use strict';var multer=require('multer');var util=require(_0x1ff9('0x0'));var path=require(_0x1ff9('0x1'));var timeout=require(_0x1ff9('0x2'));var express=require(_0x1ff9('0x3'));var router=express[_0x1ff9('0x4')]();var fs_extra=require(_0x1ff9('0x5'));var auth=require(_0x1ff9('0x6'));var interaction=require(_0x1ff9('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x1ff9('0x8')](),controller[_0x1ff9('0x9')]);router[_0x1ff9('0xa')]('/:id',auth[_0x1ff9('0x8')](),controller[_0x1ff9('0xb')]);router[_0x1ff9('0xa')](_0x1ff9('0xc'),auth[_0x1ff9('0x8')](),controller[_0x1ff9('0xd')]);router[_0x1ff9('0xa')]('/:id/fields',auth[_0x1ff9('0x8')](),controller[_0x1ff9('0xe')]);router[_0x1ff9('0xf')]('/',auth[_0x1ff9('0x8')](),controller['create']);router[_0x1ff9('0xf')]('/:id/configurations',auth[_0x1ff9('0x8')](),controller[_0x1ff9('0x10')]);router['put'](_0x1ff9('0x11'),auth['isAuthenticated'](),controller[_0x1ff9('0x12')]);router[_0x1ff9('0x13')](_0x1ff9('0x11'),auth[_0x1ff9('0x8')](),controller[_0x1ff9('0x14')]);module[_0x1ff9('0x15')]=router; \ No newline at end of file +var _0x3066=['post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x36aad0,_0x3d2e17){var _0x31e987=function(_0x2d0fe4){while(--_0x2d0fe4){_0x36aad0['push'](_0x36aad0['shift']());}};_0x31e987(++_0x3d2e17);}(_0x3066,0x156));var _0x6306=function(_0x5bd04c,_0x2f2319){_0x5bd04c=_0x5bd04c-0x0;var _0x246571=_0x3066[_0x5bd04c];return _0x246571;};'use strict';var multer=require(_0x6306('0x0'));var util=require(_0x6306('0x1'));var path=require(_0x6306('0x2'));var timeout=require(_0x6306('0x3'));var express=require(_0x6306('0x4'));var router=express[_0x6306('0x5')]();var fs_extra=require(_0x6306('0x6'));var auth=require(_0x6306('0x7'));var interaction=require(_0x6306('0x8'));var config=require(_0x6306('0x9'));var controller=require(_0x6306('0xa'));router[_0x6306('0xb')]('/',auth[_0x6306('0xc')](),controller[_0x6306('0xd')]);router[_0x6306('0xb')](_0x6306('0xe'),auth[_0x6306('0xc')](),controller['show']);router[_0x6306('0xb')](_0x6306('0xf'),auth[_0x6306('0xc')](),controller[_0x6306('0x10')]);router[_0x6306('0xb')](_0x6306('0x11'),auth[_0x6306('0xc')](),controller['getFields']);router[_0x6306('0x12')]('/',auth[_0x6306('0xc')](),controller['create']);router[_0x6306('0x12')](_0x6306('0xf'),auth[_0x6306('0xc')](),controller[_0x6306('0x13')]);router[_0x6306('0x14')](_0x6306('0xe'),auth[_0x6306('0xc')](),controller[_0x6306('0x15')]);router[_0x6306('0x16')]('/:id',auth[_0x6306('0xc')](),controller['destroy']);module[_0x6306('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 11ddd5e..f35586e 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16ab=['username','remoteUri','sequelize','STRING'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x16ab,0x106));var _0xb16a=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x16ab[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0xb16a('0x0'));module['exports']={'name':{'type':Sequelize[_0xb16a('0x1')]},'description':{'type':Sequelize[_0xb16a('0x1')]},'username':{'type':Sequelize[_0xb16a('0x1')],'unique':_0xb16a('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xb16a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x60cc=['exports','STRING','username','remoteUri'];(function(_0x3920ed,_0x545a4d){var _0x41d07f=function(_0x5bca9a){while(--_0x5bca9a){_0x3920ed['push'](_0x3920ed['shift']());}};_0x41d07f(++_0x545a4d);}(_0x60cc,0x114));var _0xc60c=function(_0xafb624,_0x5c66f0){_0xafb624=_0xafb624-0x0;var _0x39accb=_0x60cc[_0xafb624];return _0x39accb;};'use strict';var Sequelize=require('sequelize');module[_0xc60c('0x0')]={'name':{'type':Sequelize[_0xc60c('0x1')]},'description':{'type':Sequelize[_0xc60c('0x1')]},'username':{'type':Sequelize[_0xc60c('0x1')],'unique':_0xc60c('0x2')},'password':{'type':Sequelize[_0xc60c('0x1')]},'email':{'type':Sequelize[_0xc60c('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc60c('0x3')},'serverUrl':{'type':Sequelize[_0xc60c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 68d7457..94bf629 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd980=['sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','priority','expected_start','opened_at','group_list','work_end','reopened_time','caller_id','approval_set','short_description','correlation_display','work_start','assignment_group','additional_assignee_list','description','sys_class_name','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','location','password','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','result','log','incident\x20table\x20objects','assign','forEach','internalType','label','push','all','TCL:\x20_object','remove','includes','concat','test','statusCode','error','send','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','stack','name','index','map','ServicenowAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain'];(function(_0x1b69aa,_0x5aa147){var _0x42647d=function(_0x1743fd){while(--_0x1743fd){_0x1b69aa['push'](_0x1b69aa['shift']());}};_0x42647d(++_0x5aa147);}(_0xd980,0x1b8));var _0x0d98=function(_0x14e87f,_0x584aaf){_0x14e87f=_0x14e87f-0x0;var _0xdf58c1=_0xd980[_0x14e87f];return _0xdf58c1;};'use strict';var emlformat=require(_0x0d98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d98('0x1'));var jsonpatch=require(_0x0d98('0x2'));var rp=require('request-promise');var moment=require(_0x0d98('0x3'));var BPromise=require(_0x0d98('0x4'));var Mustache=require('mustache');var util=require(_0x0d98('0x5'));var path=require(_0x0d98('0x6'));var sox=require(_0x0d98('0x7'));var csv=require(_0x0d98('0x8'));var ejs=require(_0x0d98('0x9'));var fs=require('fs');var fs_extra=require(_0x0d98('0xa'));var _=require(_0x0d98('0xb'));var squel=require('squel');var crypto=require(_0x0d98('0xc'));var jsforce=require(_0x0d98('0xd'));var deskjs=require(_0x0d98('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0d98('0xf'));var Papa=require('papaparse');var Redis=require(_0x0d98('0x10'));var authService=require(_0x0d98('0x11'));var qs=require(_0x0d98('0x12'));var as=require(_0x0d98('0x13'));var hardwareService=require(_0x0d98('0x14'));var logger=require(_0x0d98('0x15'))(_0x0d98('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0d98('0x17'));var db=require(_0x0d98('0x18'))['db'];var integrations=require(_0x0d98('0x19'));function respondWithStatusCode(_0x54defb,_0x4da036){_0x4da036=_0x4da036||0xcc;return function(_0x1f45ec){if(_0x1f45ec){return _0x54defb[_0x0d98('0x1a')](_0x4da036);}return _0x54defb['status'](_0x4da036)[_0x0d98('0x1b')]();};}function respondWithResult(_0x578a5f,_0x22a27d){_0x22a27d=_0x22a27d||0xc8;return function(_0x892024){if(_0x892024){return _0x578a5f[_0x0d98('0x1c')](_0x22a27d)[_0x0d98('0x1d')](_0x892024);}};}function respondWithFilteredResult(_0x51e0b3,_0x58e677){return function(_0x4b2328){if(_0x4b2328){var _0x65b9d5=typeof _0x58e677[_0x0d98('0x1e')]===_0x0d98('0x1f')&&typeof _0x58e677['limit']===_0x0d98('0x1f');var _0x4e563d=_0x4b2328[_0x0d98('0x20')];var _0x4056bd=_0x65b9d5?0x0:_0x58e677[_0x0d98('0x1e')];var _0x4b1595=_0x65b9d5?_0x4b2328[_0x0d98('0x20')]:_0x58e677[_0x0d98('0x1e')]+_0x58e677[_0x0d98('0x21')];var _0x23cf2a;if(_0x4b1595>=_0x4e563d){_0x4b1595=_0x4e563d;_0x23cf2a=0xc8;}else{_0x23cf2a=0xce;}_0x51e0b3[_0x0d98('0x1c')](_0x23cf2a);return _0x51e0b3[_0x0d98('0x22')](_0x0d98('0x23'),_0x4056bd+'-'+_0x4b1595+'/'+_0x4e563d)['json'](_0x4b2328);}return null;};}function patchUpdates(_0x500d5d){return function(_0x385abe){try{jsonpatch[_0x0d98('0x24')](_0x385abe,_0x500d5d,!![]);}catch(_0x5936b0){return BPromise[_0x0d98('0x25')](_0x5936b0);}return _0x385abe['save']();};}function saveUpdates(_0x2a006a,_0x58bb54){return function(_0x26ad6a){if(_0x26ad6a){return _0x26ad6a[_0x0d98('0x26')](_0x2a006a)[_0x0d98('0x27')](function(_0x25bf6d){return _0x25bf6d;});}return null;};}function removeEntity(_0x361f25,_0x460de1){return function(_0x33d154){if(_0x33d154){return _0x33d154['destroy']()[_0x0d98('0x27')](function(){_0x361f25[_0x0d98('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x100111,_0x1c2c6b){return function(_0x2dd527){if(!_0x2dd527){_0x100111[_0x0d98('0x1a')](0x194);}return _0x2dd527;};}function handleError(_0x1aae53,_0x58fbe9){_0x58fbe9=_0x58fbe9||0x1f4;return function(_0x1bd744){logger['error'](_0x1bd744[_0x0d98('0x28')]);if(_0x1bd744[_0x0d98('0x29')]){delete _0x1bd744['name'];}_0x1aae53[_0x0d98('0x1c')](_0x58fbe9)['send'](_0x1bd744);};}exports[_0x0d98('0x2a')]=function(_0x4a4f3d,_0x1bea43){var _0x1a0424={},_0x214b85={},_0x4c1dba={'count':0x0,'rows':[]};var _0x2948bf=_[_0x0d98('0x2b')](db[_0x0d98('0x2c')][_0x0d98('0x2d')],function(_0xf26371){return{'name':_0xf26371['fieldName'],'type':_0xf26371[_0x0d98('0x2e')][_0x0d98('0x2f')]};});_0x214b85[_0x0d98('0x30')]=_[_0x0d98('0x2b')](_0x2948bf,_0x0d98('0x29'));_0x214b85[_0x0d98('0x31')]=_[_0x0d98('0x32')](_0x4a4f3d[_0x0d98('0x31')]);_0x214b85[_0x0d98('0x33')]=_[_0x0d98('0x34')](_0x214b85[_0x0d98('0x30')],_0x214b85[_0x0d98('0x31')]);_0x1a0424[_0x0d98('0x35')]=_['intersection'](_0x214b85[_0x0d98('0x30')],qs[_0x0d98('0x36')](_0x4a4f3d[_0x0d98('0x31')][_0x0d98('0x36')]));_0x1a0424['attributes']=_0x1a0424[_0x0d98('0x35')][_0x0d98('0x37')]?_0x1a0424[_0x0d98('0x35')]:_0x214b85[_0x0d98('0x30')];if(!_0x4a4f3d['query'][_0x0d98('0x38')](_0x0d98('0x39'))){_0x1a0424[_0x0d98('0x21')]=qs[_0x0d98('0x21')](_0x4a4f3d[_0x0d98('0x31')][_0x0d98('0x21')]);_0x1a0424[_0x0d98('0x1e')]=qs[_0x0d98('0x1e')](_0x4a4f3d['query']['offset']);}_0x1a0424[_0x0d98('0x3a')]=qs[_0x0d98('0x3b')](_0x4a4f3d[_0x0d98('0x31')][_0x0d98('0x3b')]);_0x1a0424[_0x0d98('0x3c')]=qs[_0x0d98('0x33')](_['pick'](_0x4a4f3d['query'],_0x214b85[_0x0d98('0x33')]),_0x2948bf);if(_0x4a4f3d[_0x0d98('0x31')][_0x0d98('0x3d')]){_0x1a0424[_0x0d98('0x3c')]=_[_0x0d98('0x3e')](_0x1a0424[_0x0d98('0x3c')],{'$or':_['map'](_0x2948bf,function(_0xe6d020){if(_0xe6d020[_0x0d98('0x2e')]!==_0x0d98('0x3f')){var _0x2cfda2={};_0x2cfda2[_0xe6d020[_0x0d98('0x29')]]={'$like':'%'+_0x4a4f3d[_0x0d98('0x31')]['filter']+'%'};return _0x2cfda2;}})});}_0x1a0424=_[_0x0d98('0x3e')]({},_0x1a0424,_0x4a4f3d['options']);var _0x932ba4={'where':_0x1a0424[_0x0d98('0x3c')]};return db[_0x0d98('0x2c')][_0x0d98('0x20')](_0x932ba4)[_0x0d98('0x27')](function(_0x561b20){_0x4c1dba['count']=_0x561b20;if(_0x4a4f3d['query'][_0x0d98('0x40')]){_0x1a0424[_0x0d98('0x41')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x0d98('0x42')](_0x1a0424);})[_0x0d98('0x27')](function(_0x4d8c09){_0x4c1dba[_0x0d98('0x43')]=_0x4d8c09;return _0x4c1dba;})['then'](respondWithFilteredResult(_0x1bea43,_0x1a0424))[_0x0d98('0x44')](handleError(_0x1bea43,null));};exports[_0x0d98('0x45')]=function(_0x2789bd,_0x41c66b){var _0x4ec213={'raw':![],'where':{'id':_0x2789bd[_0x0d98('0x46')]['id']}},_0x117628={};_0x117628['model']=_[_0x0d98('0x32')](db[_0x0d98('0x2c')][_0x0d98('0x2d')]);_0x117628[_0x0d98('0x31')]=_[_0x0d98('0x32')](_0x2789bd[_0x0d98('0x31')]);_0x117628[_0x0d98('0x33')]=_[_0x0d98('0x34')](_0x117628[_0x0d98('0x30')],_0x117628['query']);_0x4ec213[_0x0d98('0x35')]=_[_0x0d98('0x34')](_0x117628[_0x0d98('0x30')],qs['fields'](_0x2789bd[_0x0d98('0x31')][_0x0d98('0x36')]));_0x4ec213['attributes']=_0x4ec213[_0x0d98('0x35')][_0x0d98('0x37')]?_0x4ec213[_0x0d98('0x35')]:_0x117628['model'];if(_0x2789bd['query'][_0x0d98('0x40')]){_0x4ec213[_0x0d98('0x41')]=[{'all':!![]}];}_0x4ec213=_[_0x0d98('0x3e')]({},_0x4ec213,_0x2789bd[_0x0d98('0x47')]);return db['ServicenowAccount'][_0x0d98('0x48')](_0x4ec213)[_0x0d98('0x27')](handleEntityNotFound(_0x41c66b,null))[_0x0d98('0x27')](respondWithResult(_0x41c66b,null))[_0x0d98('0x44')](handleError(_0x41c66b,null));};exports[_0x0d98('0x49')]=function(_0x1d2cfd,_0x537bd3){return db['ServicenowAccount'][_0x0d98('0x49')](_0x1d2cfd['body'],{})[_0x0d98('0x27')](respondWithResult(_0x537bd3,0xc9))[_0x0d98('0x44')](handleError(_0x537bd3,null));};exports['update']=function(_0x40257c,_0x24625d){if(_0x40257c[_0x0d98('0x4a')]['id']){delete _0x40257c[_0x0d98('0x4a')]['id'];}return db[_0x0d98('0x2c')][_0x0d98('0x48')]({'where':{'id':_0x40257c['params']['id']}})[_0x0d98('0x27')](handleEntityNotFound(_0x24625d,null))[_0x0d98('0x27')](saveUpdates(_0x40257c[_0x0d98('0x4a')],null))['then'](respondWithResult(_0x24625d,null))[_0x0d98('0x44')](handleError(_0x24625d,null));};exports[_0x0d98('0x4b')]=function(_0x49bc02,_0x3fbdfe){return db[_0x0d98('0x2c')][_0x0d98('0x48')]({'where':{'id':_0x49bc02[_0x0d98('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fbdfe,null))[_0x0d98('0x27')](removeEntity(_0x3fbdfe,null))['catch'](handleError(_0x3fbdfe,null));};exports[_0x0d98('0x4c')]=function(_0x6dc7ae,_0x3a78e4,_0x407c13){var _0x53e375={};var _0x2f5cfa={};var _0xae6207;var _0x24ebd8;return db['ServicenowAccount'][_0x0d98('0x4d')]({'where':{'id':_0x6dc7ae[_0x0d98('0x46')]['id']}})[_0x0d98('0x27')](handleEntityNotFound(_0x3a78e4,null))[_0x0d98('0x27')](function(_0x342eb4){if(_0x342eb4){_0xae6207=_0x342eb4;_0x2f5cfa[_0x0d98('0x30')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x2f5cfa['query']=_['keys'](_0x6dc7ae[_0x0d98('0x31')]);_0x2f5cfa[_0x0d98('0x33')]=_[_0x0d98('0x34')](_0x2f5cfa['model'],_0x2f5cfa[_0x0d98('0x31')]);_0x53e375[_0x0d98('0x35')]=_[_0x0d98('0x34')](_0x2f5cfa['model'],qs[_0x0d98('0x36')](_0x6dc7ae[_0x0d98('0x31')][_0x0d98('0x36')]));_0x53e375[_0x0d98('0x35')]=_0x53e375[_0x0d98('0x35')][_0x0d98('0x37')]?_0x53e375[_0x0d98('0x35')]:_0x2f5cfa[_0x0d98('0x30')];_0x53e375[_0x0d98('0x3a')]=qs['sort'](_0x6dc7ae[_0x0d98('0x31')][_0x0d98('0x3b')]);_0x53e375[_0x0d98('0x3c')]=qs['filters'](_['pick'](_0x6dc7ae['query'],_0x2f5cfa[_0x0d98('0x33')]));if(_0x6dc7ae[_0x0d98('0x31')][_0x0d98('0x3d')]){_0x53e375[_0x0d98('0x3c')]=_[_0x0d98('0x3e')](_0x53e375[_0x0d98('0x3c')],{'$or':_['map'](_0x53e375[_0x0d98('0x35')],function(_0xb04ef0){var _0x44ab85={};_0x44ab85[_0xb04ef0]={'$like':'%'+_0x6dc7ae[_0x0d98('0x31')][_0x0d98('0x3d')]+'%'};return _0x44ab85;})});}_0x53e375=_[_0x0d98('0x3e')]({},_0x53e375,_0x6dc7ae[_0x0d98('0x47')]);return _0xae6207[_0x0d98('0x4c')](_0x53e375);}})[_0x0d98('0x27')](function(_0x4d34cb){if(_0x4d34cb){_0x24ebd8=_0x4d34cb[_0x0d98('0x37')];if(!_0x6dc7ae['query']['hasOwnProperty'](_0x0d98('0x39'))){_0x53e375[_0x0d98('0x21')]=qs['limit'](_0x6dc7ae[_0x0d98('0x31')][_0x0d98('0x21')]);_0x53e375[_0x0d98('0x1e')]=qs['offset'](_0x6dc7ae[_0x0d98('0x31')]['offset']);}return _0xae6207[_0x0d98('0x4c')](_0x53e375);}})['then'](function(_0x1f9e6f){if(_0x1f9e6f){return _0x1f9e6f?{'count':_0x24ebd8,'rows':_0x1f9e6f}:null;}})[_0x0d98('0x27')](respondWithResult(_0x3a78e4,null))[_0x0d98('0x44')](handleError(_0x3a78e4,null));};exports[_0x0d98('0x4e')]=function(_0xc33987,_0x3a5a56,_0x1cec5d){if(_0xc33987['body']['id']){delete _0xc33987['body']['id'];}return db[_0x0d98('0x2c')][_0x0d98('0x4d')]({'where':{'id':_0xc33987[_0x0d98('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a5a56,null))[_0x0d98('0x27')](function(_0x5b4b10){if(_0x5b4b10){_0xc33987['body'][_0x0d98('0x4f')]=_0x5b4b10['id'];_0xc33987[_0x0d98('0x4a')]['Subjects']=integrations['getSubjects'](_0xc33987[_0x0d98('0x4a')][_0x0d98('0x50')],_0xc33987[_0x0d98('0x4a')][_0x0d98('0x2e')]);_0xc33987[_0x0d98('0x4a')]['Descriptions']=integrations[_0x0d98('0x51')](_0xc33987[_0x0d98('0x4a')][_0x0d98('0x50')],_0xc33987['body'][_0x0d98('0x2e')]);return db['ServicenowConfiguration'][_0x0d98('0x49')](_0xc33987['body'],{'include':[{'model':db[_0x0d98('0x52')],'as':'Subjects'},{'model':db[_0x0d98('0x52')],'as':_0x0d98('0x53')}]});}return null;})[_0x0d98('0x27')](respondWithResult(_0x3a5a56,null))['catch'](handleError(_0x3a5a56,null));};exports[_0x0d98('0x54')]=function(_0x3f0fb3,_0x3a67bf,_0x1f9d25){var _0x1f5389=[_0x0d98('0x55'),_0x0d98('0x56'),'knowledge',_0x0d98('0x57'),_0x0d98('0x58'),_0x0d98('0x59'),_0x0d98('0x5a'),_0x0d98('0x5b'),_0x0d98('0x5c')];var _0x174bd5=[_0x0d98('0x5d'),'made_sla',_0x0d98('0x5e'),_0x0d98('0x5f'),'upon_reject',_0x0d98('0x60'),_0x0d98('0x61'),_0x0d98('0x56'),_0x0d98('0x62'),_0x0d98('0x63'),_0x0d98('0x64'),_0x0d98('0x65'),_0x0d98('0x66'),_0x0d98('0x67'),_0x0d98('0x68'),_0x0d98('0x69'),'state',_0x0d98('0x6a'),_0x0d98('0x6b'),_0x0d98('0x3a'),_0x0d98('0x6c'),_0x0d98('0x6d'),_0x0d98('0x6e'),_0x0d98('0x6f'),_0x0d98('0x70'),'active',_0x0d98('0x71'),'business_service',_0x0d98('0x72'),'sys_domain_path','rfc','time_worked',_0x0d98('0x73'),_0x0d98('0x74'),'business_duration',_0x0d98('0x75'),_0x0d98('0x76'),_0x0d98('0x77'),'resolved_at',_0x0d98('0x78'),_0x0d98('0x79'),_0x0d98('0x57'),'work_notes',_0x0d98('0x7a'),'close_code',_0x0d98('0x7b'),'delivery_task',_0x0d98('0x7c'),_0x0d98('0x7d'),'business_stc',_0x0d98('0x7e'),_0x0d98('0x7f'),'calendar_duration',_0x0d98('0x59'),_0x0d98('0x80'),'close_notes',_0x0d98('0x81'),_0x0d98('0x82'),_0x0d98('0x83'),'sys_id',_0x0d98('0x84'),_0x0d98('0x85'),_0x0d98('0x5a'),_0x0d98('0x86'),_0x0d98('0x87'),_0x0d98('0x88'),'reassignment_count',_0x0d98('0x89'),_0x0d98('0x8a'),'severity',_0x0d98('0x8b'),_0x0d98('0x8c'),_0x0d98('0x8d'),_0x0d98('0x8e'),'due_date','sys_mod_count',_0x0d98('0x8f'),_0x0d98('0x90'),_0x0d98('0x91'),'upon_approval','correlation_id',_0x0d98('0x92'),'category'];var _0x4b7c99='';var _0x252e12='';var _0x2f9abf=[];var _0x58634d='';var _0x865b25='';var _0x4804b2=[];var _0x2888ef='';var _0x13fb28='';var _0x657c24={};var _0x56ea9d='';return db[_0x0d98('0x2c')][_0x0d98('0x4d')]({'where':{'id':_0x3f0fb3['params']['id']},'attributes':['id','username',_0x0d98('0x93'),_0x0d98('0x94'),_0x0d98('0x95'),_0x0d98('0x96')]})['then'](handleEntityNotFound(_0x3a67bf,null))[_0x0d98('0x27')](function(_0x2d09a9){if(_0x2d09a9){_0x56ea9d=_0x2d09a9[_0x0d98('0x95')];var _0x1dc61b=_0x56ea9d['slice'](-0x1);if(_0x1dc61b==='/'){_0x56ea9d=_0x56ea9d[_0x0d98('0x97')](0x0,_0x56ea9d['lastIndexOf'](_0x1dc61b));}_0x13fb28=util[_0x0d98('0x98')](_0x0d98('0x99'),_0x56ea9d);_0x2888ef=util[_0x0d98('0x98')](_0x0d98('0x9a'),_0x56ea9d);_0x657c24={'user':_0x2d09a9[_0x0d98('0x9b')],'pass':_0x2d09a9[_0x0d98('0x93')]};var _0x23dbdc={'method':_0x0d98('0x9c'),'uri':_0x13fb28+'incident?sysparm_display_value=all','auth':_0x657c24,'json':!![]};return rp(_0x23dbdc);}})['then'](function(_0x7d3077){if(_0x7d3077[_0x0d98('0x9d')][_0x0d98('0x37')]>0x0){_0x4b7c99=_0x7d3077[_0x0d98('0x9d')];}console[_0x0d98('0x9e')](_0x0d98('0x9f'),_0x4b7c99);_0x4804b2=[];_0x252e12=Object[_0x0d98('0xa0')]([],_0x4b7c99);_['remove'](_0x252e12,function(_0x248972){return!_0x1f5389['includes'](_0x248972[_0x0d98('0x29')]);});_0x252e12[_0x0d98('0xa1')](function(_0x505be6){var _0x2847f8=createFieldObject(_0x2888ef,_0x657c24,_0x505be6[_0x0d98('0xa2')],_0x505be6[_0x0d98('0x29')],_0x505be6[_0x0d98('0xa3')],![]);_0x4804b2[_0x0d98('0xa4')](_0x2847f8);});return Promise[_0x0d98('0xa5')](_0x4804b2);})['then'](function(_0x55695f){_0x2f9abf=_0x55695f;_0x58634d=Object[_0x0d98('0xa0')]([],_0x4b7c99);console[_0x0d98('0x9e')](_0x0d98('0xa6'),_0x4b7c99);_[_0x0d98('0xa7')](_0x58634d,function(_0x26a3cd){return _0x174bd5[_0x0d98('0xa8')](_0x26a3cd[_0x0d98('0x29')]);});console[_0x0d98('0x9e')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x58634d);_0x4804b2=[];_0x58634d[_0x0d98('0xa1')](function(_0x2e725a){var _0x3d7e71=createFieldObject(_0x2888ef,_0x657c24,_0x2e725a['internalType'],_0x2e725a[_0x0d98('0x29')],_0x2e725a['label'],!![]);_0x4804b2[_0x0d98('0xa4')](_0x3d7e71);});return Promise[_0x0d98('0xa5')](_0x4804b2);})[_0x0d98('0x27')](function(_0x3c4926){_0x865b25=_0x3c4926;var _0x27d019=_0x2f9abf[_0x0d98('0xa9')](_0x865b25);return{'count':_0x27d019[_0x0d98('0x37')],'rows':_0x27d019};})[_0x0d98('0x27')](respondWithResult(_0x3a67bf,null))['catch'](function(_0x1f6bfb){console[_0x0d98('0x9e')]('ServiceNow\x20error:\x20'+_0x1f6bfb);var _0x4221a1=_0x3f0fb3['query'][_0x0d98('0xaa')]?0x1f4:_0x1f6bfb[_0x0d98('0xab')]||0x1f4;logger[_0x0d98('0xac')](_0x1f6bfb[_0x0d98('0x28')]);delete _0x1f6bfb[_0x0d98('0x29')];if(_0x4221a1===0x191){_0x4221a1=0x190;}_0x3a67bf[_0x0d98('0x1c')](_0x4221a1)[_0x0d98('0xad')](_0x3f0fb3[_0x0d98('0x31')][_0x0d98('0xaa')]?{'message':_0x0d98('0xae'),'statusCode':_0x1f6bfb[_0x0d98('0xab')]}:_0x1f6bfb);});};function createFieldObject(_0x42e88a,_0x50b3d9,_0x762051,_0x4ff021,_0x43a27e,_0x22f9d1){return new Promise(function(_0x16e80a,_0x202fb8){var _0x4347ee={'id':_0x4ff021,'name':_0x43a27e,'custom':_0x22f9d1};if(_0x762051==='boolean'){_0x4347ee[_0x0d98('0x47')]=[{'name':_0x0d98('0xaf'),'value':_0x0d98('0xb0')},{'name':_0x0d98('0xb1'),'value':_0x0d98('0xb2')}];_0x16e80a(_0x4347ee);}else{var _0x51cca1={'method':_0x0d98('0x9c'),'uri':_0x42e88a+_0x0d98('0xb3')+_0x4ff021,'auth':_0x50b3d9,'json':!![]};return rp(_0x51cca1)[_0x0d98('0x27')](function(_0x5954d2){var _0x340e9a=[];if(_0x5954d2[_0x0d98('0x9d')][_0x0d98('0x37')]>0x0){_0x5954d2[_0x0d98('0x9d')][_0x0d98('0xa1')](function(_0x55d016){if(_0x55d016[_0x0d98('0xb4')]===_0x0d98('0xb2')){var _0x6f1318={'name':_0x55d016[_0x0d98('0xa3')],'value':_0x55d016[_0x0d98('0xb5')]};_0x340e9a[_0x0d98('0xa4')](_0x6f1318);}});}_0x4347ee['options']=_0x340e9a;if(_0x4347ee[_0x0d98('0x47')][_0x0d98('0x37')]>0x0){_0x16e80a(_0x4347ee);}else{if(_0x22f9d1==![]){_0x16e80a();}else{_0x16e80a(_0x4347ee);}}});}});} \ No newline at end of file +var _0xbd2a=['remove','includes','internalType','label','push','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','forEach','value','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','order','options','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','close_notes','closed_by','follow_up','sys_id','contact_type','problem_id','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log'];(function(_0x24cb8c,_0x423901){var _0x2b9b59=function(_0x21ded5){while(--_0x21ded5){_0x24cb8c['push'](_0x24cb8c['shift']());}};_0x2b9b59(++_0x423901);}(_0xbd2a,0xcf));var _0xabd2=function(_0x4b90ad,_0x4aca04){_0x4b90ad=_0x4b90ad-0x0;var _0x4c6fce=_0xbd2a[_0x4b90ad];return _0x4c6fce;};'use strict';var emlformat=require(_0xabd2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xabd2('0x1'));var rp=require(_0xabd2('0x2'));var moment=require(_0xabd2('0x3'));var BPromise=require(_0xabd2('0x4'));var Mustache=require(_0xabd2('0x5'));var util=require(_0xabd2('0x6'));var path=require(_0xabd2('0x7'));var sox=require(_0xabd2('0x8'));var csv=require('to-csv');var ejs=require(_0xabd2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabd2('0xa'));var squel=require(_0xabd2('0xb'));var crypto=require(_0xabd2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xabd2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabd2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xabd2('0xf'));var hardwareService=require(_0xabd2('0x10'));var logger=require(_0xabd2('0x11'))(_0xabd2('0x12'));var utils=require(_0xabd2('0x13'));var config=require(_0xabd2('0x14'));var licenseUtil=require(_0xabd2('0x15'));var db=require(_0xabd2('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3fdc7d,_0x180a03){_0x180a03=_0x180a03||0xcc;return function(_0xe268c9){if(_0xe268c9){return _0x3fdc7d[_0xabd2('0x17')](_0x180a03);}return _0x3fdc7d[_0xabd2('0x18')](_0x180a03)[_0xabd2('0x19')]();};}function respondWithResult(_0x11bb79,_0xe64c00){_0xe64c00=_0xe64c00||0xc8;return function(_0x439065){if(_0x439065){return _0x11bb79['status'](_0xe64c00)[_0xabd2('0x1a')](_0x439065);}};}function respondWithFilteredResult(_0x40ad7a,_0x4dff66){return function(_0x188b24){if(_0x188b24){var _0x1e1f4e=typeof _0x4dff66[_0xabd2('0x1b')]==='undefined'&&typeof _0x4dff66['limit']===_0xabd2('0x1c');var _0x1122f1=_0x188b24[_0xabd2('0x1d')];var _0x1b537b=_0x1e1f4e?0x0:_0x4dff66[_0xabd2('0x1b')];var _0x1b3b68=_0x1e1f4e?_0x188b24[_0xabd2('0x1d')]:_0x4dff66[_0xabd2('0x1b')]+_0x4dff66[_0xabd2('0x1e')];var _0x370798;if(_0x1b3b68>=_0x1122f1){_0x1b3b68=_0x1122f1;_0x370798=0xc8;}else{_0x370798=0xce;}_0x40ad7a[_0xabd2('0x18')](_0x370798);return _0x40ad7a['set'](_0xabd2('0x1f'),_0x1b537b+'-'+_0x1b3b68+'/'+_0x1122f1)[_0xabd2('0x1a')](_0x188b24);}return null;};}function patchUpdates(_0x4a2076){return function(_0x1d3636){try{jsonpatch['apply'](_0x1d3636,_0x4a2076,!![]);}catch(_0x3ccba3){return BPromise[_0xabd2('0x20')](_0x3ccba3);}return _0x1d3636['save']();};}function saveUpdates(_0x1ac161,_0x5e556d){return function(_0x440bb7){if(_0x440bb7){return _0x440bb7[_0xabd2('0x21')](_0x1ac161)['then'](function(_0x324230){return _0x324230;});}return null;};}function removeEntity(_0x4812f5,_0x44d654){return function(_0x2ae433){if(_0x2ae433){return _0x2ae433[_0xabd2('0x22')]()[_0xabd2('0x23')](function(){_0x4812f5[_0xabd2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f4da,_0xd62427){return function(_0x2bf997){if(!_0x2bf997){_0x47f4da[_0xabd2('0x17')](0x194);}return _0x2bf997;};}function handleError(_0x44496b,_0x49b9e7){_0x49b9e7=_0x49b9e7||0x1f4;return function(_0x34faed){logger[_0xabd2('0x24')](_0x34faed[_0xabd2('0x25')]);if(_0x34faed[_0xabd2('0x26')]){delete _0x34faed[_0xabd2('0x26')];}_0x44496b[_0xabd2('0x18')](_0x49b9e7)[_0xabd2('0x27')](_0x34faed);};}exports[_0xabd2('0x28')]=function(_0x1e4c02,_0x29ad03){var _0x39a9bd={},_0xe28ce3={},_0x13bd8c={'count':0x0,'rows':[]};var _0x5093f6=_[_0xabd2('0x29')](db[_0xabd2('0x2a')][_0xabd2('0x2b')],function(_0x43bef7){return{'name':_0x43bef7[_0xabd2('0x2c')],'type':_0x43bef7[_0xabd2('0x2d')][_0xabd2('0x2e')]};});_0xe28ce3[_0xabd2('0x2f')]=_[_0xabd2('0x29')](_0x5093f6,_0xabd2('0x26'));_0xe28ce3['query']=_['keys'](_0x1e4c02[_0xabd2('0x30')]);_0xe28ce3[_0xabd2('0x31')]=_[_0xabd2('0x32')](_0xe28ce3['model'],_0xe28ce3[_0xabd2('0x30')]);_0x39a9bd[_0xabd2('0x33')]=_[_0xabd2('0x32')](_0xe28ce3[_0xabd2('0x2f')],qs['fields'](_0x1e4c02['query'][_0xabd2('0x34')]));_0x39a9bd[_0xabd2('0x33')]=_0x39a9bd[_0xabd2('0x33')][_0xabd2('0x35')]?_0x39a9bd[_0xabd2('0x33')]:_0xe28ce3[_0xabd2('0x2f')];if(!_0x1e4c02[_0xabd2('0x30')][_0xabd2('0x36')](_0xabd2('0x37'))){_0x39a9bd[_0xabd2('0x1e')]=qs[_0xabd2('0x1e')](_0x1e4c02[_0xabd2('0x30')][_0xabd2('0x1e')]);_0x39a9bd[_0xabd2('0x1b')]=qs[_0xabd2('0x1b')](_0x1e4c02[_0xabd2('0x30')][_0xabd2('0x1b')]);}_0x39a9bd['order']=qs['sort'](_0x1e4c02[_0xabd2('0x30')][_0xabd2('0x38')]);_0x39a9bd[_0xabd2('0x39')]=qs['filters'](_[_0xabd2('0x3a')](_0x1e4c02[_0xabd2('0x30')],_0xe28ce3[_0xabd2('0x31')]),_0x5093f6);if(_0x1e4c02['query'][_0xabd2('0x3b')]){_0x39a9bd[_0xabd2('0x39')]=_[_0xabd2('0x3c')](_0x39a9bd['where'],{'$or':_['map'](_0x5093f6,function(_0x1a6bfa){if(_0x1a6bfa[_0xabd2('0x2d')]!==_0xabd2('0x3d')){var _0x4b5d4e={};_0x4b5d4e[_0x1a6bfa[_0xabd2('0x26')]]={'$like':'%'+_0x1e4c02['query'][_0xabd2('0x3b')]+'%'};return _0x4b5d4e;}})});}_0x39a9bd=_['merge']({},_0x39a9bd,_0x1e4c02['options']);var _0x3be2a9={'where':_0x39a9bd[_0xabd2('0x39')]};return db[_0xabd2('0x2a')][_0xabd2('0x1d')](_0x3be2a9)[_0xabd2('0x23')](function(_0x1978d8){_0x13bd8c[_0xabd2('0x1d')]=_0x1978d8;if(_0x1e4c02[_0xabd2('0x30')][_0xabd2('0x3e')]){_0x39a9bd[_0xabd2('0x3f')]=[{'all':!![]}];}return db[_0xabd2('0x2a')][_0xabd2('0x40')](_0x39a9bd);})[_0xabd2('0x23')](function(_0x1bbdbf){_0x13bd8c[_0xabd2('0x41')]=_0x1bbdbf;return _0x13bd8c;})['then'](respondWithFilteredResult(_0x29ad03,_0x39a9bd))[_0xabd2('0x42')](handleError(_0x29ad03,null));};exports[_0xabd2('0x43')]=function(_0x3c2083,_0x3b683e){var _0x33b855={'raw':![],'where':{'id':_0x3c2083[_0xabd2('0x44')]['id']}},_0xea0619={};_0xea0619[_0xabd2('0x2f')]=_[_0xabd2('0x45')](db['ServicenowAccount'][_0xabd2('0x2b')]);_0xea0619['query']=_[_0xabd2('0x45')](_0x3c2083['query']);_0xea0619[_0xabd2('0x31')]=_[_0xabd2('0x32')](_0xea0619[_0xabd2('0x2f')],_0xea0619[_0xabd2('0x30')]);_0x33b855[_0xabd2('0x33')]=_[_0xabd2('0x32')](_0xea0619[_0xabd2('0x2f')],qs['fields'](_0x3c2083[_0xabd2('0x30')]['fields']));_0x33b855[_0xabd2('0x33')]=_0x33b855[_0xabd2('0x33')]['length']?_0x33b855[_0xabd2('0x33')]:_0xea0619[_0xabd2('0x2f')];if(_0x3c2083['query'][_0xabd2('0x3e')]){_0x33b855['include']=[{'all':!![]}];}_0x33b855=_[_0xabd2('0x3c')]({},_0x33b855,_0x3c2083['options']);return db[_0xabd2('0x2a')][_0xabd2('0x46')](_0x33b855)[_0xabd2('0x23')](handleEntityNotFound(_0x3b683e,null))[_0xabd2('0x23')](respondWithResult(_0x3b683e,null))[_0xabd2('0x42')](handleError(_0x3b683e,null));};exports[_0xabd2('0x47')]=function(_0x4d20a6,_0x5c0b3f){return db['ServicenowAccount'][_0xabd2('0x47')](_0x4d20a6[_0xabd2('0x48')],{})[_0xabd2('0x23')](respondWithResult(_0x5c0b3f,0xc9))[_0xabd2('0x42')](handleError(_0x5c0b3f,null));};exports['update']=function(_0x838f70,_0x1c378){if(_0x838f70[_0xabd2('0x48')]['id']){delete _0x838f70[_0xabd2('0x48')]['id'];}return db[_0xabd2('0x2a')][_0xabd2('0x46')]({'where':{'id':_0x838f70[_0xabd2('0x44')]['id']}})[_0xabd2('0x23')](handleEntityNotFound(_0x1c378,null))[_0xabd2('0x23')](saveUpdates(_0x838f70[_0xabd2('0x48')],null))[_0xabd2('0x23')](respondWithResult(_0x1c378,null))[_0xabd2('0x42')](handleError(_0x1c378,null));};exports[_0xabd2('0x22')]=function(_0x38c71b,_0x46f97d){return db[_0xabd2('0x2a')][_0xabd2('0x46')]({'where':{'id':_0x38c71b[_0xabd2('0x44')]['id']}})['then'](handleEntityNotFound(_0x46f97d,null))[_0xabd2('0x23')](removeEntity(_0x46f97d,null))[_0xabd2('0x42')](handleError(_0x46f97d,null));};exports[_0xabd2('0x49')]=function(_0x2e90f9,_0x2ff0b6,_0x46b9d5){var _0x5bd8ea={};var _0x2ea7c6={};var _0x22626d;var _0x41d915;return db[_0xabd2('0x2a')]['findOne']({'where':{'id':_0x2e90f9[_0xabd2('0x44')]['id']}})[_0xabd2('0x23')](handleEntityNotFound(_0x2ff0b6,null))[_0xabd2('0x23')](function(_0x6acbe6){if(_0x6acbe6){_0x22626d=_0x6acbe6;_0x2ea7c6[_0xabd2('0x2f')]=_[_0xabd2('0x45')](db['ServicenowConfiguration'][_0xabd2('0x2b')]);_0x2ea7c6['query']=_[_0xabd2('0x45')](_0x2e90f9[_0xabd2('0x30')]);_0x2ea7c6[_0xabd2('0x31')]=_[_0xabd2('0x32')](_0x2ea7c6[_0xabd2('0x2f')],_0x2ea7c6['query']);_0x5bd8ea[_0xabd2('0x33')]=_[_0xabd2('0x32')](_0x2ea7c6[_0xabd2('0x2f')],qs[_0xabd2('0x34')](_0x2e90f9[_0xabd2('0x30')][_0xabd2('0x34')]));_0x5bd8ea[_0xabd2('0x33')]=_0x5bd8ea[_0xabd2('0x33')][_0xabd2('0x35')]?_0x5bd8ea[_0xabd2('0x33')]:_0x2ea7c6[_0xabd2('0x2f')];_0x5bd8ea[_0xabd2('0x4a')]=qs[_0xabd2('0x38')](_0x2e90f9[_0xabd2('0x30')][_0xabd2('0x38')]);_0x5bd8ea[_0xabd2('0x39')]=qs['filters'](_['pick'](_0x2e90f9[_0xabd2('0x30')],_0x2ea7c6[_0xabd2('0x31')]));if(_0x2e90f9[_0xabd2('0x30')][_0xabd2('0x3b')]){_0x5bd8ea[_0xabd2('0x39')]=_[_0xabd2('0x3c')](_0x5bd8ea[_0xabd2('0x39')],{'$or':_[_0xabd2('0x29')](_0x5bd8ea['attributes'],function(_0x23683e){var _0x5f31b1={};_0x5f31b1[_0x23683e]={'$like':'%'+_0x2e90f9['query'][_0xabd2('0x3b')]+'%'};return _0x5f31b1;})});}_0x5bd8ea=_['merge']({},_0x5bd8ea,_0x2e90f9[_0xabd2('0x4b')]);return _0x22626d[_0xabd2('0x49')](_0x5bd8ea);}})[_0xabd2('0x23')](function(_0x26a361){if(_0x26a361){_0x41d915=_0x26a361[_0xabd2('0x35')];if(!_0x2e90f9[_0xabd2('0x30')][_0xabd2('0x36')]('nolimit')){_0x5bd8ea[_0xabd2('0x1e')]=qs[_0xabd2('0x1e')](_0x2e90f9[_0xabd2('0x30')][_0xabd2('0x1e')]);_0x5bd8ea[_0xabd2('0x1b')]=qs['offset'](_0x2e90f9[_0xabd2('0x30')][_0xabd2('0x1b')]);}return _0x22626d['getConfigurations'](_0x5bd8ea);}})[_0xabd2('0x23')](function(_0x31cb12){if(_0x31cb12){return _0x31cb12?{'count':_0x41d915,'rows':_0x31cb12}:null;}})[_0xabd2('0x23')](respondWithResult(_0x2ff0b6,null))[_0xabd2('0x42')](handleError(_0x2ff0b6,null));};exports['addConfiguration']=function(_0x1ec15e,_0xd3c99a,_0x4c3e64){if(_0x1ec15e[_0xabd2('0x48')]['id']){delete _0x1ec15e[_0xabd2('0x48')]['id'];}return db[_0xabd2('0x2a')][_0xabd2('0x4c')]({'where':{'id':_0x1ec15e['params']['id']}})[_0xabd2('0x23')](handleEntityNotFound(_0xd3c99a,null))[_0xabd2('0x23')](function(_0x3ca192){if(_0x3ca192){_0x1ec15e[_0xabd2('0x48')][_0xabd2('0x4d')]=_0x3ca192['id'];_0x1ec15e[_0xabd2('0x48')][_0xabd2('0x4e')]=integrations[_0xabd2('0x4f')](_0x1ec15e[_0xabd2('0x48')]['channel'],_0x1ec15e[_0xabd2('0x48')][_0xabd2('0x2d')]);_0x1ec15e[_0xabd2('0x48')]['Descriptions']=integrations[_0xabd2('0x50')](_0x1ec15e[_0xabd2('0x48')][_0xabd2('0x51')],_0x1ec15e[_0xabd2('0x48')][_0xabd2('0x2d')]);return db['ServicenowConfiguration'][_0xabd2('0x47')](_0x1ec15e[_0xabd2('0x48')],{'include':[{'model':db[_0xabd2('0x52')],'as':'Subjects'},{'model':db[_0xabd2('0x52')],'as':_0xabd2('0x53')}]});}return null;})[_0xabd2('0x23')](respondWithResult(_0xd3c99a,null))[_0xabd2('0x42')](handleError(_0xd3c99a,null));};exports[_0xabd2('0x54')]=function(_0x593199,_0x756e1e,_0x47cbc8){var _0x5e9346=[_0xabd2('0x55'),_0xabd2('0x56'),_0xabd2('0x57'),'subcategory',_0xabd2('0x58'),'notify',_0xabd2('0x59'),_0xabd2('0x5a'),_0xabd2('0x5b')];var _0x39f515=[_0xabd2('0x5c'),_0xabd2('0x55'),_0xabd2('0x5d'),'watch_list',_0xabd2('0x5e'),_0xabd2('0x5f'),_0xabd2('0x60'),_0xabd2('0x56'),_0xabd2('0x61'),'number',_0xabd2('0x62'),_0xabd2('0x63'),'opened_by',_0xabd2('0x64'),_0xabd2('0x65'),_0xabd2('0x66'),_0xabd2('0x67'),_0xabd2('0x68'),_0xabd2('0x57'),_0xabd2('0x4a'),_0xabd2('0x69'),_0xabd2('0x6a'),'cmdb_ci','delivery_plan',_0xabd2('0x6b'),_0xabd2('0x6c'),_0xabd2('0x6d'),_0xabd2('0x6e'),_0xabd2('0x6f'),_0xabd2('0x70'),_0xabd2('0x71'),_0xabd2('0x72'),_0xabd2('0x73'),_0xabd2('0x74'),_0xabd2('0x75'),'group_list',_0xabd2('0x76'),_0xabd2('0x77'),'resolved_at',_0xabd2('0x78'),_0xabd2('0x79'),_0xabd2('0x7a'),_0xabd2('0x7b'),_0xabd2('0x7c'),_0xabd2('0x58'),'correlation_display',_0xabd2('0x7d'),_0xabd2('0x7e'),_0xabd2('0x7f'),_0xabd2('0x80'),_0xabd2('0x81'),_0xabd2('0x82'),_0xabd2('0x83'),_0xabd2('0x84'),'sys_class_name',_0xabd2('0x85'),_0xabd2('0x86'),_0xabd2('0x87'),'parent_incident',_0xabd2('0x88'),_0xabd2('0x89'),'reopened_by','incident_state','urgency',_0xabd2('0x8a'),'company',_0xabd2('0x8b'),_0xabd2('0x8c'),_0xabd2('0x8d'),_0xabd2('0x5a'),'comments',_0xabd2('0x8e'),_0xabd2('0x8f'),_0xabd2('0x90'),_0xabd2('0x91'),_0xabd2('0x92'),_0xabd2('0x93'),_0xabd2('0x94'),'escalation',_0xabd2('0x95'),_0xabd2('0x96'),_0xabd2('0x97'),_0xabd2('0x5b')];var _0x376174='';var _0x245ca4='';var _0x4fc1fd=[];var _0x4f7449='';var _0x8236da='';var _0x54c778=[];var _0xce3faa='';var _0x2568f7='';var _0x4f27a5={};var _0x2005a0='';return db[_0xabd2('0x2a')][_0xabd2('0x4c')]({'where':{'id':_0x593199['params']['id']},'attributes':['id',_0xabd2('0x98'),_0xabd2('0x99'),_0xabd2('0x9a'),_0xabd2('0x9b'),_0xabd2('0x9c')]})[_0xabd2('0x23')](handleEntityNotFound(_0x756e1e,null))[_0xabd2('0x23')](function(_0x2cf3c4){if(_0x2cf3c4){_0x2005a0=_0x2cf3c4[_0xabd2('0x9b')];var _0x3d65f9=_0x2005a0[_0xabd2('0x9d')](-0x1);if(_0x3d65f9==='/'){_0x2005a0=_0x2005a0[_0xabd2('0x9e')](0x0,_0x2005a0[_0xabd2('0x9f')](_0x3d65f9));}_0x2568f7=util['format'](_0xabd2('0xa0'),_0x2005a0);_0xce3faa=util[_0xabd2('0xa1')](_0xabd2('0xa2'),_0x2005a0);_0x4f27a5={'user':_0x2cf3c4[_0xabd2('0x98')],'pass':_0x2cf3c4[_0xabd2('0x99')]};var _0x4a69e2={'method':_0xabd2('0xa3'),'uri':_0x2568f7+_0xabd2('0xa4'),'auth':_0x4f27a5,'json':!![]};return rp(_0x4a69e2);}})[_0xabd2('0x23')](function(_0x302491){if(_0x302491[_0xabd2('0xa5')]['length']>0x0){_0x376174=_0x302491[_0xabd2('0xa5')];}console[_0xabd2('0xa6')]('incident\x20table\x20objects',_0x376174);_0x54c778=[];_0x245ca4=Object['assign']([],_0x376174);_[_0xabd2('0xa7')](_0x245ca4,function(_0x420aee){return!_0x5e9346[_0xabd2('0xa8')](_0x420aee[_0xabd2('0x26')]);});_0x245ca4['forEach'](function(_0x1479c3){var _0x1e8531=createFieldObject(_0xce3faa,_0x4f27a5,_0x1479c3[_0xabd2('0xa9')],_0x1479c3[_0xabd2('0x26')],_0x1479c3[_0xabd2('0xaa')],![]);_0x54c778[_0xabd2('0xab')](_0x1e8531);});return Promise['all'](_0x54c778);})[_0xabd2('0x23')](function(_0x4b9bd8){_0x4fc1fd=_0x4b9bd8;_0x4f7449=Object[_0xabd2('0xac')]([],_0x376174);console['log'](_0xabd2('0xad'),_0x376174);_['remove'](_0x4f7449,function(_0x25c442){return _0x39f515[_0xabd2('0xa8')](_0x25c442['name']);});console[_0xabd2('0xa6')](_0xabd2('0xae'),_0x4f7449);_0x54c778=[];_0x4f7449['forEach'](function(_0x3210f4){var _0x1d04a0=createFieldObject(_0xce3faa,_0x4f27a5,_0x3210f4[_0xabd2('0xa9')],_0x3210f4[_0xabd2('0x26')],_0x3210f4[_0xabd2('0xaa')],!![]);_0x54c778['push'](_0x1d04a0);});return Promise['all'](_0x54c778);})[_0xabd2('0x23')](function(_0x444786){_0x8236da=_0x444786;var _0x19e0c7=_0x4fc1fd[_0xabd2('0xaf')](_0x8236da);return{'count':_0x19e0c7['length'],'rows':_0x19e0c7};})[_0xabd2('0x23')](respondWithResult(_0x756e1e,null))[_0xabd2('0x42')](function(_0x59a949){console[_0xabd2('0xa6')](_0xabd2('0xb0')+_0x59a949);var _0x5eeca8=_0x593199[_0xabd2('0x30')][_0xabd2('0xb1')]?0x1f4:_0x59a949[_0xabd2('0xb2')]||0x1f4;logger[_0xabd2('0x24')](_0x59a949[_0xabd2('0x25')]);delete _0x59a949[_0xabd2('0x26')];if(_0x5eeca8===0x191){_0x5eeca8=0x190;}_0x756e1e[_0xabd2('0x18')](_0x5eeca8)[_0xabd2('0x27')](_0x593199[_0xabd2('0x30')][_0xabd2('0xb1')]?{'message':_0xabd2('0xb3'),'statusCode':_0x59a949[_0xabd2('0xb2')]}:_0x59a949);});};function createFieldObject(_0x466cc1,_0xfbd198,_0x3cf284,_0x37d91f,_0x1f44b3,_0x504d9a){return new Promise(function(_0x389df1,_0x1391fb){var _0x4c1d16={'id':_0x37d91f,'name':_0x1f44b3,'custom':_0x504d9a};if(_0x3cf284===_0xabd2('0xb4')){_0x4c1d16[_0xabd2('0x4b')]=[{'name':'True','value':_0xabd2('0xb5')},{'name':_0xabd2('0xb6'),'value':_0xabd2('0xb7')}];_0x389df1(_0x4c1d16);}else{var _0x103405={'method':_0xabd2('0xa3'),'uri':_0x466cc1+_0xabd2('0xb8')+_0x37d91f,'auth':_0xfbd198,'json':!![]};return rp(_0x103405)[_0xabd2('0x23')](function(_0x6ead59){var _0x18e4e2=[];if(_0x6ead59['result'][_0xabd2('0x35')]>0x0){_0x6ead59[_0xabd2('0xa5')][_0xabd2('0xb9')](function(_0x524803){if(_0x524803['inactive']===_0xabd2('0xb7')){var _0x558596={'name':_0x524803[_0xabd2('0xaa')],'value':_0x524803[_0xabd2('0xba')]};_0x18e4e2[_0xabd2('0xab')](_0x558596);}});}_0x4c1d16['options']=_0x18e4e2;if(_0x4c1d16[_0xabd2('0x4b')][_0xabd2('0x35')]>0x0){_0x389df1(_0x4c1d16);}else{if(_0x504d9a==![]){_0x389df1();}else{_0x389df1(_0x4c1d16);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 61d7277..b4d8aef 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71ab=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','api','bluebird','request-promise'];(function(_0x2d2978,_0x2eecde){var _0x406056=function(_0x5ecb7e){while(--_0x5ecb7e){_0x2d2978['push'](_0x2d2978['shift']());}};_0x406056(++_0x2eecde);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d58=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','bluebird'];(function(_0x3a081b,_0x516437){var _0xb166c4=function(_0x22bc5d){while(--_0x22bc5d){_0x3a081b['push'](_0x3a081b['shift']());}};_0xb166c4(++_0x516437);}(_0x5d58,0x187));var _0x85d5=function(_0x29e15c,_0x51ac22){_0x29e15c=_0x29e15c-0x0;var _0x5e28b3=_0x5d58[_0x29e15c];return _0x5e28b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x85d5('0x4'));module[_0x85d5('0x5')]=function(_0x578fad,_0x46e7b4){return _0x578fad['define'](_0x85d5('0x6'),attributes,{'tableName':_0x85d5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 56b9e8e..f7b9a1d 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb330=['ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','request\x20sent','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','stringify','catch','ShowServicenowAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x31a321,_0x5cd2d4){var _0x53b946=function(_0x2f965e){while(--_0x2f965e){_0x31a321['push'](_0x31a321['shift']());}};_0x53b946(++_0x5cd2d4);}(_0xb330,0x1ac));var _0x0b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb330[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b33('0x0'));var util=require(_0x0b33('0x1'));var moment=require(_0x0b33('0x2'));var BPromise=require(_0x0b33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b33('0x4'))['db'];var utils=require(_0x0b33('0x5'));var logger=require(_0x0b33('0x6'))(_0x0b33('0x7'));var config=require(_0x0b33('0x8'));var jayson=require(_0x0b33('0x9'));var client=jayson[_0x0b33('0xa')][_0x0b33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x326428,_0x3023b1,_0x3f589f){return new BPromise(function(_0x5a1c9b,_0x214f38){return client[_0x0b33('0xc')](_0x326428,_0x3f589f)[_0x0b33('0xd')](function(_0x50c9e3){logger[_0x0b33('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3023b1,'request\x20sent');logger[_0x0b33('0xf')](_0x0b33('0x10'),_0x3023b1,'request\x20sent',JSON['stringify'](_0x50c9e3));if(_0x50c9e3[_0x0b33('0x11')]){if(_0x50c9e3[_0x0b33('0x11')][_0x0b33('0x12')]===0x1f4){logger[_0x0b33('0x11')](_0x0b33('0x13'),_0x3023b1,_0x50c9e3[_0x0b33('0x11')][_0x0b33('0x14')]);return _0x214f38(_0x50c9e3[_0x0b33('0x11')][_0x0b33('0x14')]);}logger[_0x0b33('0x11')](_0x0b33('0x13'),_0x3023b1,_0x50c9e3[_0x0b33('0x11')][_0x0b33('0x14')]);return _0x5a1c9b(_0x50c9e3[_0x0b33('0x11')]['message']);}else{logger[_0x0b33('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3023b1,_0x0b33('0x15'));_0x5a1c9b(_0x50c9e3[_0x0b33('0x16')][_0x0b33('0x14')]);}})['catch'](function(_0x1231d1){logger[_0x0b33('0x11')](_0x0b33('0x13'),_0x3023b1,_0x1231d1);_0x214f38(_0x1231d1);});});}exports[_0x0b33('0x17')]=function(_0x1cc9ec){var _0x2590ec=this;return new Promise(function(_0x5acc46,_0x260c43){return db[_0x0b33('0x18')][_0x0b33('0x19')]({'raw':_0x1cc9ec['options']?_0x1cc9ec[_0x0b33('0x1a')][_0x0b33('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc9ec[_0x0b33('0x1a')]?_0x1cc9ec['options'][_0x0b33('0x1c')]||null:null,'attributes':_0x1cc9ec[_0x0b33('0x1a')]?_0x1cc9ec[_0x0b33('0x1a')][_0x0b33('0x1d')]||null:null,'limit':_0x1cc9ec['options']?_0x1cc9ec[_0x0b33('0x1a')]['limit']||null:null,'include':_0x1cc9ec[_0x0b33('0x1a')]?_0x1cc9ec[_0x0b33('0x1a')][_0x0b33('0x1e')]?_[_0x0b33('0x1f')](_0x1cc9ec[_0x0b33('0x1a')][_0x0b33('0x1e')],function(_0x3d2032){return{'model':db[_0x3d2032[_0x0b33('0x20')]],'as':_0x3d2032['as'],'attributes':_0x3d2032[_0x0b33('0x1d')],'include':_0x3d2032['include']?_[_0x0b33('0x1f')](_0x3d2032[_0x0b33('0x1e')],function(_0x10d48a){return{'model':db[_0x10d48a['model']],'as':_0x10d48a['as'],'attributes':_0x10d48a['attributes'],'include':_0x10d48a[_0x0b33('0x1e')]?_[_0x0b33('0x1f')](_0x10d48a[_0x0b33('0x1e')],function(_0x1bbf22){return{'model':db[_0x1bbf22[_0x0b33('0x20')]],'as':_0x1bbf22['as'],'attributes':_0x1bbf22[_0x0b33('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0b33('0xd')](function(_0x2a9a25){logger[_0x0b33('0xe')](_0x0b33('0x17'),_0x1cc9ec);logger[_0x0b33('0xf')]('GetServicenowAccount',_0x1cc9ec,JSON[_0x0b33('0x21')](_0x2a9a25));_0x5acc46(_0x2a9a25);})[_0x0b33('0x22')](function(_0x1c64fb){logger[_0x0b33('0x11')](_0x0b33('0x17'),_0x1c64fb[_0x0b33('0x14')],_0x1cc9ec);_0x260c43(_0x2590ec['error'](0x1f4,_0x1c64fb[_0x0b33('0x14')]));});});};exports[_0x0b33('0x23')]=function(_0x3817ec){var _0x5dfa77=this;return new Promise(function(_0x1162cf,_0x53603d){return db['ServicenowAccount'][_0x0b33('0x24')]({'raw':_0x3817ec[_0x0b33('0x1a')]?_0x3817ec[_0x0b33('0x1a')][_0x0b33('0x1b')]===undefined?!![]:![]:!![],'where':_0x3817ec[_0x0b33('0x1a')]?_0x3817ec['options'][_0x0b33('0x1c')]||null:null,'attributes':_0x3817ec[_0x0b33('0x1a')]?_0x3817ec[_0x0b33('0x1a')][_0x0b33('0x1d')]||null:null,'include':_0x3817ec[_0x0b33('0x1a')]?_0x3817ec['options'][_0x0b33('0x1e')]?_[_0x0b33('0x1f')](_0x3817ec[_0x0b33('0x1a')][_0x0b33('0x1e')],function(_0x2d1370){return{'model':db[_0x2d1370[_0x0b33('0x20')]],'as':_0x2d1370['as'],'attributes':_0x2d1370[_0x0b33('0x1d')],'include':_0x2d1370[_0x0b33('0x1e')]?_[_0x0b33('0x1f')](_0x2d1370[_0x0b33('0x1e')],function(_0x277fe9){return{'model':db[_0x277fe9[_0x0b33('0x20')]],'as':_0x277fe9['as'],'attributes':_0x277fe9[_0x0b33('0x1d')],'include':_0x277fe9[_0x0b33('0x1e')]?_[_0x0b33('0x1f')](_0x277fe9[_0x0b33('0x1e')],function(_0x5bef27){return{'model':db[_0x5bef27[_0x0b33('0x20')]],'as':_0x5bef27['as'],'attributes':_0x5bef27['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x520348){logger[_0x0b33('0xe')](_0x0b33('0x23'),_0x3817ec);logger['debug'](_0x0b33('0x23'),_0x3817ec,JSON[_0x0b33('0x21')](_0x520348));_0x1162cf(_0x520348);})[_0x0b33('0x22')](function(_0x86272){logger['error'](_0x0b33('0x23'),_0x86272['message'],_0x3817ec);_0x53603d(_0x5dfa77[_0x0b33('0x11')](0x1f4,_0x86272['message']));});});}; \ No newline at end of file +var _0x1067=['jayson/promise','client','http','request','then','request\x20sent','debug','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','find','where','ShowServicenowAccount','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x38fad4,_0x21dd64){var _0x512fec=function(_0x80a52a){while(--_0x80a52a){_0x38fad4['push'](_0x38fad4['shift']());}};_0x512fec(++_0x21dd64);}(_0x1067,0xa8));var _0x7106=function(_0x4dca1d,_0x26be83){_0x4dca1d=_0x4dca1d-0x0;var _0x17646b=_0x1067[_0x4dca1d];return _0x17646b;};'use strict';var _=require('lodash');var util=require(_0x7106('0x0'));var moment=require(_0x7106('0x1'));var BPromise=require(_0x7106('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7106('0x3'))['db'];var utils=require(_0x7106('0x4'));var logger=require(_0x7106('0x5'))('rpc');var config=require(_0x7106('0x6'));var jayson=require(_0x7106('0x7'));var client=jayson[_0x7106('0x8')][_0x7106('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4976d4,_0x1f6d56,_0x2b6522){return new BPromise(function(_0x49abed,_0x14631a){return client[_0x7106('0xa')](_0x4976d4,_0x2b6522)[_0x7106('0xb')](function(_0x316a1b){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1f6d56,_0x7106('0xc'));logger[_0x7106('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1f6d56,'request\x20sent',JSON['stringify'](_0x316a1b));if(_0x316a1b['error']){if(_0x316a1b[_0x7106('0xe')][_0x7106('0xf')]===0x1f4){logger['error'](_0x7106('0x10'),_0x1f6d56,_0x316a1b[_0x7106('0xe')][_0x7106('0x11')]);return _0x14631a(_0x316a1b[_0x7106('0xe')][_0x7106('0x11')]);}logger[_0x7106('0xe')](_0x7106('0x10'),_0x1f6d56,_0x316a1b[_0x7106('0xe')][_0x7106('0x11')]);return _0x49abed(_0x316a1b[_0x7106('0xe')][_0x7106('0x11')]);}else{logger[_0x7106('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x1f6d56,_0x7106('0xc'));_0x49abed(_0x316a1b[_0x7106('0x13')][_0x7106('0x11')]);}})[_0x7106('0x14')](function(_0x3dc068){logger[_0x7106('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x1f6d56,_0x3dc068);_0x14631a(_0x3dc068);});});}exports[_0x7106('0x15')]=function(_0x506eb4){var _0x2898ce=this;return new Promise(function(_0x1ff4d6,_0x160af8){return db[_0x7106('0x16')][_0x7106('0x17')]({'raw':_0x506eb4['options']?_0x506eb4[_0x7106('0x18')][_0x7106('0x19')]===undefined?!![]:![]:!![],'where':_0x506eb4[_0x7106('0x18')]?_0x506eb4['options']['where']||null:null,'attributes':_0x506eb4[_0x7106('0x18')]?_0x506eb4[_0x7106('0x18')][_0x7106('0x1a')]||null:null,'limit':_0x506eb4[_0x7106('0x18')]?_0x506eb4[_0x7106('0x18')][_0x7106('0x1b')]||null:null,'include':_0x506eb4['options']?_0x506eb4[_0x7106('0x18')][_0x7106('0x1c')]?_[_0x7106('0x1d')](_0x506eb4['options']['include'],function(_0x1ab9b1){return{'model':db[_0x1ab9b1['model']],'as':_0x1ab9b1['as'],'attributes':_0x1ab9b1[_0x7106('0x1a')],'include':_0x1ab9b1[_0x7106('0x1c')]?_[_0x7106('0x1d')](_0x1ab9b1[_0x7106('0x1c')],function(_0x279b84){return{'model':db[_0x279b84[_0x7106('0x1e')]],'as':_0x279b84['as'],'attributes':_0x279b84[_0x7106('0x1a')],'include':_0x279b84[_0x7106('0x1c')]?_[_0x7106('0x1d')](_0x279b84[_0x7106('0x1c')],function(_0xce0b82){return{'model':db[_0xce0b82[_0x7106('0x1e')]],'as':_0xce0b82['as'],'attributes':_0xce0b82[_0x7106('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7106('0xb')](function(_0x4ab6d7){logger[_0x7106('0x12')](_0x7106('0x15'),_0x506eb4);logger['debug'](_0x7106('0x15'),_0x506eb4,JSON[_0x7106('0x1f')](_0x4ab6d7));_0x1ff4d6(_0x4ab6d7);})['catch'](function(_0x339cf2){logger[_0x7106('0xe')](_0x7106('0x15'),_0x339cf2[_0x7106('0x11')],_0x506eb4);_0x160af8(_0x2898ce['error'](0x1f4,_0x339cf2[_0x7106('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x2b4e2f){var _0x30e333=this;return new Promise(function(_0x395664,_0xa0d485){return db[_0x7106('0x16')][_0x7106('0x20')]({'raw':_0x2b4e2f[_0x7106('0x18')]?_0x2b4e2f[_0x7106('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2b4e2f[_0x7106('0x18')]?_0x2b4e2f[_0x7106('0x18')][_0x7106('0x21')]||null:null,'attributes':_0x2b4e2f[_0x7106('0x18')]?_0x2b4e2f[_0x7106('0x18')]['attributes']||null:null,'include':_0x2b4e2f[_0x7106('0x18')]?_0x2b4e2f[_0x7106('0x18')]['include']?_['map'](_0x2b4e2f[_0x7106('0x18')][_0x7106('0x1c')],function(_0x3c3175){return{'model':db[_0x3c3175[_0x7106('0x1e')]],'as':_0x3c3175['as'],'attributes':_0x3c3175[_0x7106('0x1a')],'include':_0x3c3175['include']?_[_0x7106('0x1d')](_0x3c3175[_0x7106('0x1c')],function(_0x3b9135){return{'model':db[_0x3b9135['model']],'as':_0x3b9135['as'],'attributes':_0x3b9135[_0x7106('0x1a')],'include':_0x3b9135[_0x7106('0x1c')]?_[_0x7106('0x1d')](_0x3b9135[_0x7106('0x1c')],function(_0x4eb950){return{'model':db[_0x4eb950[_0x7106('0x1e')]],'as':_0x4eb950['as'],'attributes':_0x4eb950['attributes']};}):[]};}):[]};}):[]:[]})[_0x7106('0xb')](function(_0x1159f7){logger[_0x7106('0x12')](_0x7106('0x22'),_0x2b4e2f);logger['debug'](_0x7106('0x22'),_0x2b4e2f,JSON[_0x7106('0x1f')](_0x1159f7));_0x395664(_0x1159f7);})[_0x7106('0x14')](function(_0x5824d5){logger['error'](_0x7106('0x22'),_0x5824d5[_0x7106('0x11')],_0x2b4e2f);_0xa0d485(_0x30e333['error'](0x1f4,_0x5824d5[_0x7106('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 1a8f3ad..ea7e129 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8174=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','../../components/auth/service','../../components/interaction/service','get'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x8174,0x13b));var _0x4817=function(_0x5c6acd,_0x475638){_0x5c6acd=_0x5c6acd-0x0;var _0x20bb67=_0x8174[_0x5c6acd];return _0x20bb67;};'use strict';var multer=require('multer');var util=require(_0x4817('0x0'));var path=require(_0x4817('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4817('0x2'));var interaction=require(_0x4817('0x3'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x4817('0x4')]('/',auth[_0x4817('0x5')](),controller[_0x4817('0x6')]);router[_0x4817('0x4')](_0x4817('0x7'),auth['isAuthenticated'](),controller[_0x4817('0x8')]);router[_0x4817('0x4')](_0x4817('0x9'),auth[_0x4817('0x5')](),controller[_0x4817('0xa')]);router[_0x4817('0x4')]('/:id/subjects',auth[_0x4817('0x5')](),controller['getSubjects']);router[_0x4817('0x4')](_0x4817('0xb'),auth[_0x4817('0x5')](),controller[_0x4817('0xc')]);router[_0x4817('0xd')]('/',auth[_0x4817('0x5')](),controller[_0x4817('0xe')]);router[_0x4817('0xf')](_0x4817('0x7'),auth[_0x4817('0x5')](),controller[_0x4817('0x10')]);router[_0x4817('0x11')](_0x4817('0x7'),auth[_0x4817('0x5')](),controller[_0x4817('0x12')]);module[_0x4817('0x13')]=router; \ No newline at end of file +var _0x3fa0=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','delete','destroy'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x3fa0,0x169));var _0x03fa=function(_0x9e3cda,_0x183ee2){_0x9e3cda=_0x9e3cda-0x0;var _0x42716b=_0x3fa0[_0x9e3cda];return _0x42716b;};'use strict';var multer=require(_0x03fa('0x0'));var util=require(_0x03fa('0x1'));var path=require(_0x03fa('0x2'));var timeout=require(_0x03fa('0x3'));var express=require('express');var router=express[_0x03fa('0x4')]();var fs_extra=require(_0x03fa('0x5'));var auth=require(_0x03fa('0x6'));var interaction=require(_0x03fa('0x7'));var config=require('../../config/environment');var controller=require(_0x03fa('0x8'));router[_0x03fa('0x9')]('/',auth['isAuthenticated'](),controller[_0x03fa('0xa')]);router[_0x03fa('0x9')](_0x03fa('0xb'),auth[_0x03fa('0xc')](),controller[_0x03fa('0xd')]);router['get'](_0x03fa('0xe'),auth['isAuthenticated'](),controller[_0x03fa('0xf')]);router[_0x03fa('0x9')](_0x03fa('0x10'),auth['isAuthenticated'](),controller[_0x03fa('0x11')]);router[_0x03fa('0x9')](_0x03fa('0x12'),auth['isAuthenticated'](),controller[_0x03fa('0x13')]);router['post']('/',auth[_0x03fa('0xc')](),controller['create']);router[_0x03fa('0x14')](_0x03fa('0xb'),auth[_0x03fa('0xc')](),controller['update']);router[_0x03fa('0x15')](_0x03fa('0xb'),auth['isAuthenticated'](),controller[_0x03fa('0x16')]);module[_0x03fa('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2857b1e..e156710 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcca8=['sequelize','exports','STRING'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0xcca8,0x150));var _0x8cca=function(_0x44a5dc,_0x4005f1){_0x44a5dc=_0x44a5dc-0x0;var _0x369c18=_0xcca8[_0x44a5dc];return _0x369c18;};'use strict';var Sequelize=require(_0x8cca('0x0'));module[_0x8cca('0x1')]={'name':{'type':Sequelize[_0x8cca('0x2')]},'description':{'type':Sequelize[_0x8cca('0x2')]}}; \ No newline at end of file +var _0x4f0c=['exports','sequelize'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x4f0c,0xd1));var _0xc4f0=function(_0x500a13,_0x36a2b0){_0x500a13=_0x500a13-0x0;var _0x4d5a5d=_0x4f0c[_0x500a13];return _0x4d5a5d;};'use strict';var Sequelize=require(_0xc4f0('0x0'));module[_0xc4f0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 433143b..edba6da 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe71c=['status','end','json','undefined','limit','count','offset','apply','reject','update','then','error','stack','name','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','map','VIRTUAL','merge','includeAll','include','ServicenowConfiguration','findAll','rows','catch','params','keys','length','options','find','create','body','destroy','getFields','findOne','ServicenowField','order','pick','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x30d398,_0xca5a7b){var _0x418653=function(_0x2c35f5){while(--_0x2c35f5){_0x30d398['push'](_0x30d398['shift']());}};_0x418653(++_0xca5a7b);}(_0xe71c,0x1ba));var _0xce71=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xe71c[_0x34d275];return _0x1379cc;};'use strict';var emlformat=require(_0xce71('0x0'));var rimraf=require(_0xce71('0x1'));var zipdir=require(_0xce71('0x2'));var jsonpatch=require(_0xce71('0x3'));var rp=require(_0xce71('0x4'));var moment=require(_0xce71('0x5'));var BPromise=require(_0xce71('0x6'));var Mustache=require(_0xce71('0x7'));var util=require(_0xce71('0x8'));var path=require('path');var sox=require(_0xce71('0x9'));var csv=require(_0xce71('0xa'));var ejs=require(_0xce71('0xb'));var fs=require('fs');var fs_extra=require(_0xce71('0xc'));var _=require(_0xce71('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xce71('0xe'));var deskjs=require(_0xce71('0xf'));var toCsv=require(_0xce71('0xa'));var querystring=require('querystring');var Papa=require(_0xce71('0x10'));var Redis=require(_0xce71('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce71('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce71('0x13'))(_0xce71('0x14'));var utils=require(_0xce71('0x15'));var config=require(_0xce71('0x16'));var licenseUtil=require(_0xce71('0x17'));var db=require(_0xce71('0x18'))['db'];function respondWithStatusCode(_0x2519b9,_0x60c8ae){_0x60c8ae=_0x60c8ae||0xcc;return function(_0x301c9f){if(_0x301c9f){return _0x2519b9[_0xce71('0x19')](_0x60c8ae);}return _0x2519b9[_0xce71('0x1a')](_0x60c8ae)[_0xce71('0x1b')]();};}function respondWithResult(_0x45eb68,_0x5a7bd7){_0x5a7bd7=_0x5a7bd7||0xc8;return function(_0x2c7346){if(_0x2c7346){return _0x45eb68[_0xce71('0x1a')](_0x5a7bd7)[_0xce71('0x1c')](_0x2c7346);}};}function respondWithFilteredResult(_0x46bc08,_0x188c75){return function(_0x4492db){if(_0x4492db){var _0x2dc6cd=typeof _0x188c75['offset']===_0xce71('0x1d')&&typeof _0x188c75[_0xce71('0x1e')]===_0xce71('0x1d');var _0x343cd0=_0x4492db[_0xce71('0x1f')];var _0x2b86a0=_0x2dc6cd?0x0:_0x188c75[_0xce71('0x20')];var _0x2799c9=_0x2dc6cd?_0x4492db[_0xce71('0x1f')]:_0x188c75[_0xce71('0x20')]+_0x188c75[_0xce71('0x1e')];var _0x73fc29;if(_0x2799c9>=_0x343cd0){_0x2799c9=_0x343cd0;_0x73fc29=0xc8;}else{_0x73fc29=0xce;}_0x46bc08['status'](_0x73fc29);return _0x46bc08['set']('Content-Range',_0x2b86a0+'-'+_0x2799c9+'/'+_0x343cd0)[_0xce71('0x1c')](_0x4492db);}return null;};}function patchUpdates(_0x5eed4b){return function(_0x394459){try{jsonpatch[_0xce71('0x21')](_0x394459,_0x5eed4b,!![]);}catch(_0x52f4e3){return BPromise[_0xce71('0x22')](_0x52f4e3);}return _0x394459['save']();};}function saveUpdates(_0x4c6d25,_0x5d58c9){return function(_0x4e5649){if(_0x4e5649){return _0x4e5649[_0xce71('0x23')](_0x4c6d25)['then'](function(_0x4e662d){return _0x4e662d;});}return null;};}function removeEntity(_0x46e492,_0x494506){return function(_0xcdbb0f){if(_0xcdbb0f){return _0xcdbb0f['destroy']()[_0xce71('0x24')](function(){_0x46e492['status'](0xcc)[_0xce71('0x1b')]();});}};}function handleEntityNotFound(_0x331d3f,_0x192c13){return function(_0xdec8ec){if(!_0xdec8ec){_0x331d3f[_0xce71('0x19')](0x194);}return _0xdec8ec;};}function handleError(_0x40ab83,_0x3d4ecf){_0x3d4ecf=_0x3d4ecf||0x1f4;return function(_0x43d30a){logger[_0xce71('0x25')](_0x43d30a[_0xce71('0x26')]);if(_0x43d30a[_0xce71('0x27')]){delete _0x43d30a[_0xce71('0x27')];}_0x40ab83[_0xce71('0x1a')](_0x3d4ecf)['send'](_0x43d30a);};}exports['index']=function(_0x54e415,_0x34e070){var _0x2957c1={},_0xe507d1={},_0x1b679c={'count':0x0,'rows':[]};var _0x35be0a=_['map'](db['ServicenowConfiguration'][_0xce71('0x28')],function(_0x1e9eb3){return{'name':_0x1e9eb3['fieldName'],'type':_0x1e9eb3[_0xce71('0x29')][_0xce71('0x2a')]};});_0xe507d1['model']=_['map'](_0x35be0a,_0xce71('0x27'));_0xe507d1[_0xce71('0x2b')]=_['keys'](_0x54e415[_0xce71('0x2b')]);_0xe507d1[_0xce71('0x2c')]=_[_0xce71('0x2d')](_0xe507d1['model'],_0xe507d1[_0xce71('0x2b')]);_0x2957c1[_0xce71('0x2e')]=_[_0xce71('0x2d')](_0xe507d1[_0xce71('0x2f')],qs['fields'](_0x54e415['query'][_0xce71('0x30')]));_0x2957c1[_0xce71('0x2e')]=_0x2957c1['attributes']['length']?_0x2957c1[_0xce71('0x2e')]:_0xe507d1['model'];if(!_0x54e415['query'][_0xce71('0x31')](_0xce71('0x32'))){_0x2957c1['limit']=qs['limit'](_0x54e415[_0xce71('0x2b')][_0xce71('0x1e')]);_0x2957c1[_0xce71('0x20')]=qs[_0xce71('0x20')](_0x54e415[_0xce71('0x2b')][_0xce71('0x20')]);}_0x2957c1['order']=qs[_0xce71('0x33')](_0x54e415[_0xce71('0x2b')][_0xce71('0x33')]);_0x2957c1[_0xce71('0x34')]=qs[_0xce71('0x2c')](_['pick'](_0x54e415[_0xce71('0x2b')],_0xe507d1[_0xce71('0x2c')]),_0x35be0a);if(_0x54e415[_0xce71('0x2b')]['filter']){_0x2957c1[_0xce71('0x34')]=_['merge'](_0x2957c1[_0xce71('0x34')],{'$or':_[_0xce71('0x35')](_0x35be0a,function(_0x1c3512){if(_0x1c3512[_0xce71('0x29')]!==_0xce71('0x36')){var _0x23098e={};_0x23098e[_0x1c3512[_0xce71('0x27')]]={'$like':'%'+_0x54e415[_0xce71('0x2b')]['filter']+'%'};return _0x23098e;}})});}_0x2957c1=_[_0xce71('0x37')]({},_0x2957c1,_0x54e415['options']);var _0x187a95={'where':_0x2957c1[_0xce71('0x34')]};return db['ServicenowConfiguration'][_0xce71('0x1f')](_0x187a95)[_0xce71('0x24')](function(_0x5144a0){_0x1b679c[_0xce71('0x1f')]=_0x5144a0;if(_0x54e415['query'][_0xce71('0x38')]){_0x2957c1[_0xce71('0x39')]=[{'all':!![]}];}return db[_0xce71('0x3a')][_0xce71('0x3b')](_0x2957c1);})[_0xce71('0x24')](function(_0x301e03){_0x1b679c[_0xce71('0x3c')]=_0x301e03;return _0x1b679c;})['then'](respondWithFilteredResult(_0x34e070,_0x2957c1))[_0xce71('0x3d')](handleError(_0x34e070,null));};exports['show']=function(_0x226051,_0x48eeea){var _0x10a61d={'raw':![],'where':{'id':_0x226051[_0xce71('0x3e')]['id']}},_0x4f3664={};_0x4f3664[_0xce71('0x2f')]=_[_0xce71('0x3f')](db[_0xce71('0x3a')]['rawAttributes']);_0x4f3664[_0xce71('0x2b')]=_['keys'](_0x226051[_0xce71('0x2b')]);_0x4f3664[_0xce71('0x2c')]=_[_0xce71('0x2d')](_0x4f3664[_0xce71('0x2f')],_0x4f3664[_0xce71('0x2b')]);_0x10a61d[_0xce71('0x2e')]=_[_0xce71('0x2d')](_0x4f3664[_0xce71('0x2f')],qs[_0xce71('0x30')](_0x226051[_0xce71('0x2b')][_0xce71('0x30')]));_0x10a61d[_0xce71('0x2e')]=_0x10a61d[_0xce71('0x2e')][_0xce71('0x40')]?_0x10a61d[_0xce71('0x2e')]:_0x4f3664[_0xce71('0x2f')];if(_0x226051[_0xce71('0x2b')][_0xce71('0x38')]){_0x10a61d[_0xce71('0x39')]=[{'all':!![]}];}_0x10a61d=_[_0xce71('0x37')]({},_0x10a61d,_0x226051[_0xce71('0x41')]);return db[_0xce71('0x3a')][_0xce71('0x42')](_0x10a61d)[_0xce71('0x24')](handleEntityNotFound(_0x48eeea,null))[_0xce71('0x24')](respondWithResult(_0x48eeea,null))[_0xce71('0x3d')](handleError(_0x48eeea,null));};exports[_0xce71('0x43')]=function(_0x1cd87a,_0x9c7d8f){return db[_0xce71('0x3a')][_0xce71('0x43')](_0x1cd87a[_0xce71('0x44')],{})[_0xce71('0x24')](respondWithResult(_0x9c7d8f,0xc9))[_0xce71('0x3d')](handleError(_0x9c7d8f,null));};exports[_0xce71('0x23')]=function(_0x5909d6,_0x464210){if(_0x5909d6['body']['id']){delete _0x5909d6['body']['id'];}return db[_0xce71('0x3a')][_0xce71('0x42')]({'where':{'id':_0x5909d6[_0xce71('0x3e')]['id']}})[_0xce71('0x24')](handleEntityNotFound(_0x464210,null))[_0xce71('0x24')](saveUpdates(_0x5909d6[_0xce71('0x44')],null))[_0xce71('0x24')](respondWithResult(_0x464210,null))['catch'](handleError(_0x464210,null));};exports[_0xce71('0x45')]=function(_0x169d30,_0x22b477){return db[_0xce71('0x3a')]['find']({'where':{'id':_0x169d30[_0xce71('0x3e')]['id']}})[_0xce71('0x24')](handleEntityNotFound(_0x22b477,null))[_0xce71('0x24')](removeEntity(_0x22b477,null))[_0xce71('0x3d')](handleError(_0x22b477,null));};exports[_0xce71('0x46')]=function(_0x398735,_0x621f09,_0x3a944d){var _0x23b670={};var _0x1e41fd={};var _0x13da0a;var _0x39a794;return db[_0xce71('0x3a')][_0xce71('0x47')]({'where':{'id':_0x398735[_0xce71('0x3e')]['id']}})[_0xce71('0x24')](handleEntityNotFound(_0x621f09,null))[_0xce71('0x24')](function(_0x4d9ee3){if(_0x4d9ee3){_0x13da0a=_0x4d9ee3;_0x1e41fd[_0xce71('0x2f')]=_['keys'](db[_0xce71('0x48')][_0xce71('0x28')]);_0x1e41fd[_0xce71('0x2b')]=_['keys'](_0x398735[_0xce71('0x2b')]);_0x1e41fd['filters']=_[_0xce71('0x2d')](_0x1e41fd['model'],_0x1e41fd[_0xce71('0x2b')]);_0x23b670[_0xce71('0x2e')]=_[_0xce71('0x2d')](_0x1e41fd[_0xce71('0x2f')],qs[_0xce71('0x30')](_0x398735[_0xce71('0x2b')][_0xce71('0x30')]));_0x23b670[_0xce71('0x2e')]=_0x23b670[_0xce71('0x2e')][_0xce71('0x40')]?_0x23b670[_0xce71('0x2e')]:_0x1e41fd['model'];_0x23b670[_0xce71('0x49')]=qs[_0xce71('0x33')](_0x398735[_0xce71('0x2b')][_0xce71('0x33')]);_0x23b670[_0xce71('0x34')]=qs[_0xce71('0x2c')](_[_0xce71('0x4a')](_0x398735[_0xce71('0x2b')],_0x1e41fd[_0xce71('0x2c')]));if(_0x398735[_0xce71('0x2b')][_0xce71('0x4b')]){_0x23b670[_0xce71('0x34')]=_['merge'](_0x23b670[_0xce71('0x34')],{'$or':_['map'](_0x23b670[_0xce71('0x2e')],function(_0x215a76){var _0x17b090={};_0x17b090[_0x215a76]={'$like':'%'+_0x398735[_0xce71('0x2b')]['filter']+'%'};return _0x17b090;})});}_0x23b670=_['merge']({},_0x23b670,_0x398735[_0xce71('0x41')]);return _0x13da0a[_0xce71('0x46')](_0x23b670);}})[_0xce71('0x24')](function(_0xadc029){if(_0xadc029){_0x39a794=_0xadc029[_0xce71('0x40')];if(!_0x398735[_0xce71('0x2b')][_0xce71('0x31')](_0xce71('0x32'))){_0x23b670['limit']=qs[_0xce71('0x1e')](_0x398735[_0xce71('0x2b')][_0xce71('0x1e')]);_0x23b670[_0xce71('0x20')]=qs['offset'](_0x398735['query'][_0xce71('0x20')]);}return _0x13da0a[_0xce71('0x46')](_0x23b670);}})['then'](function(_0x5a972f){if(_0x5a972f){return _0x5a972f?{'count':_0x39a794,'rows':_0x5a972f}:null;}})[_0xce71('0x24')](respondWithResult(_0x621f09,null))[_0xce71('0x3d')](handleError(_0x621f09,null));};exports[_0xce71('0x4c')]=function(_0x46c3b9,_0x4f965d,_0xd7e95b){var _0x368ec1={};var _0x2e7cb5={};var _0x3361ae;var _0x59116e;return db[_0xce71('0x3a')][_0xce71('0x47')]({'where':{'id':_0x46c3b9['params']['id']}})[_0xce71('0x24')](handleEntityNotFound(_0x4f965d,null))['then'](function(_0x4ef366){if(_0x4ef366){_0x3361ae=_0x4ef366;_0x2e7cb5[_0xce71('0x2f')]=_[_0xce71('0x3f')](db[_0xce71('0x48')][_0xce71('0x28')]);_0x2e7cb5[_0xce71('0x2b')]=_['keys'](_0x46c3b9[_0xce71('0x2b')]);_0x2e7cb5[_0xce71('0x2c')]=_[_0xce71('0x2d')](_0x2e7cb5[_0xce71('0x2f')],_0x2e7cb5['query']);_0x368ec1['attributes']=_[_0xce71('0x2d')](_0x2e7cb5[_0xce71('0x2f')],qs['fields'](_0x46c3b9['query'][_0xce71('0x30')]));_0x368ec1[_0xce71('0x2e')]=_0x368ec1[_0xce71('0x2e')][_0xce71('0x40')]?_0x368ec1[_0xce71('0x2e')]:_0x2e7cb5[_0xce71('0x2f')];_0x368ec1[_0xce71('0x49')]=qs['sort'](_0x46c3b9[_0xce71('0x2b')][_0xce71('0x33')]);_0x368ec1[_0xce71('0x34')]=qs[_0xce71('0x2c')](_[_0xce71('0x4a')](_0x46c3b9[_0xce71('0x2b')],_0x2e7cb5['filters']));if(_0x46c3b9[_0xce71('0x2b')]['filter']){_0x368ec1[_0xce71('0x34')]=_[_0xce71('0x37')](_0x368ec1[_0xce71('0x34')],{'$or':_[_0xce71('0x35')](_0x368ec1['attributes'],function(_0x17da9e){var _0x320572={};_0x320572[_0x17da9e]={'$like':'%'+_0x46c3b9[_0xce71('0x2b')][_0xce71('0x4b')]+'%'};return _0x320572;})});}_0x368ec1=_[_0xce71('0x37')]({},_0x368ec1,_0x46c3b9[_0xce71('0x41')]);return _0x3361ae[_0xce71('0x4c')](_0x368ec1);}})[_0xce71('0x24')](function(_0x727499){if(_0x727499){_0x59116e=_0x727499[_0xce71('0x40')];if(!_0x46c3b9['query'][_0xce71('0x31')](_0xce71('0x32'))){_0x368ec1['limit']=qs[_0xce71('0x1e')](_0x46c3b9[_0xce71('0x2b')][_0xce71('0x1e')]);_0x368ec1['offset']=qs[_0xce71('0x20')](_0x46c3b9[_0xce71('0x2b')][_0xce71('0x20')]);}return _0x3361ae['getSubjects'](_0x368ec1);}})[_0xce71('0x24')](function(_0x1cc21e){if(_0x1cc21e){return _0x1cc21e?{'count':_0x59116e,'rows':_0x1cc21e}:null;}})[_0xce71('0x24')](respondWithResult(_0x4f965d,null))[_0xce71('0x3d')](handleError(_0x4f965d,null));};exports[_0xce71('0x4d')]=function(_0x3d7bf0,_0x38f551,_0xdb7091){var _0x58f5fb={};var _0x10fab0={};var _0x20ca6c;var _0x385929;return db[_0xce71('0x3a')][_0xce71('0x47')]({'where':{'id':_0x3d7bf0[_0xce71('0x3e')]['id']}})['then'](handleEntityNotFound(_0x38f551,null))[_0xce71('0x24')](function(_0x3cf12f){if(_0x3cf12f){_0x20ca6c=_0x3cf12f;_0x10fab0[_0xce71('0x2f')]=_[_0xce71('0x3f')](db['ServicenowField']['rawAttributes']);_0x10fab0[_0xce71('0x2b')]=_[_0xce71('0x3f')](_0x3d7bf0[_0xce71('0x2b')]);_0x10fab0['filters']=_['intersection'](_0x10fab0['model'],_0x10fab0[_0xce71('0x2b')]);_0x58f5fb[_0xce71('0x2e')]=_[_0xce71('0x2d')](_0x10fab0[_0xce71('0x2f')],qs[_0xce71('0x30')](_0x3d7bf0[_0xce71('0x2b')][_0xce71('0x30')]));_0x58f5fb['attributes']=_0x58f5fb[_0xce71('0x2e')][_0xce71('0x40')]?_0x58f5fb[_0xce71('0x2e')]:_0x10fab0[_0xce71('0x2f')];_0x58f5fb[_0xce71('0x49')]=qs[_0xce71('0x33')](_0x3d7bf0[_0xce71('0x2b')][_0xce71('0x33')]);_0x58f5fb[_0xce71('0x34')]=qs['filters'](_[_0xce71('0x4a')](_0x3d7bf0[_0xce71('0x2b')],_0x10fab0[_0xce71('0x2c')]));if(_0x3d7bf0['query']['filter']){_0x58f5fb[_0xce71('0x34')]=_[_0xce71('0x37')](_0x58f5fb[_0xce71('0x34')],{'$or':_[_0xce71('0x35')](_0x58f5fb['attributes'],function(_0x5b30ea){var _0x4dd4a0={};_0x4dd4a0[_0x5b30ea]={'$like':'%'+_0x3d7bf0[_0xce71('0x2b')]['filter']+'%'};return _0x4dd4a0;})});}_0x58f5fb=_[_0xce71('0x37')]({},_0x58f5fb,_0x3d7bf0[_0xce71('0x41')]);return _0x20ca6c['getDescriptions'](_0x58f5fb);}})[_0xce71('0x24')](function(_0x3416ac){if(_0x3416ac){_0x385929=_0x3416ac[_0xce71('0x40')];if(!_0x3d7bf0['query']['hasOwnProperty']('nolimit')){_0x58f5fb[_0xce71('0x1e')]=qs[_0xce71('0x1e')](_0x3d7bf0[_0xce71('0x2b')][_0xce71('0x1e')]);_0x58f5fb[_0xce71('0x20')]=qs[_0xce71('0x20')](_0x3d7bf0[_0xce71('0x2b')][_0xce71('0x20')]);}return _0x20ca6c[_0xce71('0x4d')](_0x58f5fb);}})['then'](function(_0x25a822){if(_0x25a822){return _0x25a822?{'count':_0x385929,'rows':_0x25a822}:null;}})[_0xce71('0x24')](respondWithResult(_0x38f551,null))[_0xce71('0x3d')](handleError(_0x38f551,null));}; \ No newline at end of file +var _0xfaca=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','create','body','find','params','getFields','findOne','ServicenowField','rawAttributes','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','destroy','then','error','stack','name','index','map','ServicenowConfiguration','fieldName','type','key','query','keys','model','attributes'];(function(_0x5f276e,_0x2f329c){var _0xd555e3=function(_0x480fcd){while(--_0x480fcd){_0x5f276e['push'](_0x5f276e['shift']());}};_0xd555e3(++_0x2f329c);}(_0xfaca,0x71));var _0xafac=function(_0x5817c9,_0xcdb2fa){_0x5817c9=_0x5817c9-0x0;var _0x43a7dc=_0xfaca[_0x5817c9];return _0x43a7dc;};'use strict';var emlformat=require(_0xafac('0x0'));var rimraf=require(_0xafac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xafac('0x2'));var rp=require(_0xafac('0x3'));var moment=require(_0xafac('0x4'));var BPromise=require(_0xafac('0x5'));var Mustache=require(_0xafac('0x6'));var util=require(_0xafac('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xafac('0x8'));var ejs=require(_0xafac('0x9'));var fs=require('fs');var fs_extra=require(_0xafac('0xa'));var _=require(_0xafac('0xb'));var squel=require(_0xafac('0xc'));var crypto=require(_0xafac('0xd'));var jsforce=require(_0xafac('0xe'));var deskjs=require(_0xafac('0xf'));var toCsv=require('to-csv');var querystring=require(_0xafac('0x10'));var Papa=require(_0xafac('0x11'));var Redis=require(_0xafac('0x12'));var authService=require(_0xafac('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xafac('0x14'));var hardwareService=require(_0xafac('0x15'));var logger=require('../../config/logger')(_0xafac('0x16'));var utils=require(_0xafac('0x17'));var config=require(_0xafac('0x18'));var licenseUtil=require(_0xafac('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x462137,_0x2fc94b){_0x2fc94b=_0x2fc94b||0xcc;return function(_0x21915a){if(_0x21915a){return _0x462137[_0xafac('0x1a')](_0x2fc94b);}return _0x462137[_0xafac('0x1b')](_0x2fc94b)[_0xafac('0x1c')]();};}function respondWithResult(_0x26f69b,_0x31704d){_0x31704d=_0x31704d||0xc8;return function(_0x1dfac1){if(_0x1dfac1){return _0x26f69b[_0xafac('0x1b')](_0x31704d)[_0xafac('0x1d')](_0x1dfac1);}};}function respondWithFilteredResult(_0x2134e3,_0x32e31f){return function(_0x53f9e0){if(_0x53f9e0){var _0x527893=typeof _0x32e31f[_0xafac('0x1e')]===_0xafac('0x1f')&&typeof _0x32e31f[_0xafac('0x20')]===_0xafac('0x1f');var _0x5b22fe=_0x53f9e0[_0xafac('0x21')];var _0x5ef942=_0x527893?0x0:_0x32e31f[_0xafac('0x1e')];var _0x32751b=_0x527893?_0x53f9e0['count']:_0x32e31f[_0xafac('0x1e')]+_0x32e31f['limit'];var _0x442791;if(_0x32751b>=_0x5b22fe){_0x32751b=_0x5b22fe;_0x442791=0xc8;}else{_0x442791=0xce;}_0x2134e3[_0xafac('0x1b')](_0x442791);return _0x2134e3[_0xafac('0x22')](_0xafac('0x23'),_0x5ef942+'-'+_0x32751b+'/'+_0x5b22fe)[_0xafac('0x1d')](_0x53f9e0);}return null;};}function patchUpdates(_0x49094f){return function(_0x473dca){try{jsonpatch[_0xafac('0x24')](_0x473dca,_0x49094f,!![]);}catch(_0x326421){return BPromise[_0xafac('0x25')](_0x326421);}return _0x473dca[_0xafac('0x26')]();};}function saveUpdates(_0x5b2e39,_0x31d390){return function(_0x42674c){if(_0x42674c){return _0x42674c[_0xafac('0x27')](_0x5b2e39)['then'](function(_0x42369a){return _0x42369a;});}return null;};}function removeEntity(_0x5be7ce,_0x530610){return function(_0x17daca){if(_0x17daca){return _0x17daca[_0xafac('0x28')]()[_0xafac('0x29')](function(){_0x5be7ce[_0xafac('0x1b')](0xcc)[_0xafac('0x1c')]();});}};}function handleEntityNotFound(_0x2e7747,_0x110a66){return function(_0x1dbe1e){if(!_0x1dbe1e){_0x2e7747['sendStatus'](0x194);}return _0x1dbe1e;};}function handleError(_0x16f2d4,_0x51d86c){_0x51d86c=_0x51d86c||0x1f4;return function(_0x4aa022){logger[_0xafac('0x2a')](_0x4aa022[_0xafac('0x2b')]);if(_0x4aa022[_0xafac('0x2c')]){delete _0x4aa022[_0xafac('0x2c')];}_0x16f2d4[_0xafac('0x1b')](_0x51d86c)['send'](_0x4aa022);};}exports[_0xafac('0x2d')]=function(_0x13609c,_0x4db0c9){var _0x55d18a={},_0x134932={},_0x293a2f={'count':0x0,'rows':[]};var _0x14fd69=_[_0xafac('0x2e')](db[_0xafac('0x2f')]['rawAttributes'],function(_0x5e59a2){return{'name':_0x5e59a2[_0xafac('0x30')],'type':_0x5e59a2[_0xafac('0x31')][_0xafac('0x32')]};});_0x134932['model']=_[_0xafac('0x2e')](_0x14fd69,'name');_0x134932[_0xafac('0x33')]=_[_0xafac('0x34')](_0x13609c['query']);_0x134932['filters']=_['intersection'](_0x134932[_0xafac('0x35')],_0x134932[_0xafac('0x33')]);_0x55d18a[_0xafac('0x36')]=_[_0xafac('0x37')](_0x134932[_0xafac('0x35')],qs[_0xafac('0x38')](_0x13609c[_0xafac('0x33')][_0xafac('0x38')]));_0x55d18a['attributes']=_0x55d18a[_0xafac('0x36')][_0xafac('0x39')]?_0x55d18a[_0xafac('0x36')]:_0x134932[_0xafac('0x35')];if(!_0x13609c['query'][_0xafac('0x3a')](_0xafac('0x3b'))){_0x55d18a['limit']=qs[_0xafac('0x20')](_0x13609c[_0xafac('0x33')][_0xafac('0x20')]);_0x55d18a['offset']=qs[_0xafac('0x1e')](_0x13609c[_0xafac('0x33')][_0xafac('0x1e')]);}_0x55d18a[_0xafac('0x3c')]=qs[_0xafac('0x3d')](_0x13609c[_0xafac('0x33')][_0xafac('0x3d')]);_0x55d18a[_0xafac('0x3e')]=qs[_0xafac('0x3f')](_['pick'](_0x13609c[_0xafac('0x33')],_0x134932[_0xafac('0x3f')]),_0x14fd69);if(_0x13609c[_0xafac('0x33')]['filter']){_0x55d18a[_0xafac('0x3e')]=_[_0xafac('0x40')](_0x55d18a['where'],{'$or':_[_0xafac('0x2e')](_0x14fd69,function(_0x48d2cc){if(_0x48d2cc[_0xafac('0x31')]!==_0xafac('0x41')){var _0x8a411={};_0x8a411[_0x48d2cc[_0xafac('0x2c')]]={'$like':'%'+_0x13609c[_0xafac('0x33')][_0xafac('0x42')]+'%'};return _0x8a411;}})});}_0x55d18a=_['merge']({},_0x55d18a,_0x13609c[_0xafac('0x43')]);var _0x5f10c8={'where':_0x55d18a[_0xafac('0x3e')]};return db['ServicenowConfiguration'][_0xafac('0x21')](_0x5f10c8)[_0xafac('0x29')](function(_0x1a58d7){_0x293a2f[_0xafac('0x21')]=_0x1a58d7;if(_0x13609c[_0xafac('0x33')][_0xafac('0x44')]){_0x55d18a[_0xafac('0x45')]=[{'all':!![]}];}return db[_0xafac('0x2f')][_0xafac('0x46')](_0x55d18a);})[_0xafac('0x29')](function(_0x1dc7c2){_0x293a2f['rows']=_0x1dc7c2;return _0x293a2f;})['then'](respondWithFilteredResult(_0x4db0c9,_0x55d18a))[_0xafac('0x47')](handleError(_0x4db0c9,null));};exports[_0xafac('0x48')]=function(_0x282c8a,_0x265938){var _0x50eb68={'raw':![],'where':{'id':_0x282c8a['params']['id']}},_0x5656a8={};_0x5656a8[_0xafac('0x35')]=_[_0xafac('0x34')](db[_0xafac('0x2f')]['rawAttributes']);_0x5656a8['query']=_[_0xafac('0x34')](_0x282c8a[_0xafac('0x33')]);_0x5656a8[_0xafac('0x3f')]=_['intersection'](_0x5656a8['model'],_0x5656a8['query']);_0x50eb68['attributes']=_[_0xafac('0x37')](_0x5656a8[_0xafac('0x35')],qs[_0xafac('0x38')](_0x282c8a['query'][_0xafac('0x38')]));_0x50eb68[_0xafac('0x36')]=_0x50eb68[_0xafac('0x36')][_0xafac('0x39')]?_0x50eb68[_0xafac('0x36')]:_0x5656a8[_0xafac('0x35')];if(_0x282c8a['query'][_0xafac('0x44')]){_0x50eb68[_0xafac('0x45')]=[{'all':!![]}];}_0x50eb68=_[_0xafac('0x40')]({},_0x50eb68,_0x282c8a[_0xafac('0x43')]);return db[_0xafac('0x2f')]['find'](_0x50eb68)[_0xafac('0x29')](handleEntityNotFound(_0x265938,null))[_0xafac('0x29')](respondWithResult(_0x265938,null))[_0xafac('0x47')](handleError(_0x265938,null));};exports[_0xafac('0x49')]=function(_0x5711a7,_0x28a018){return db['ServicenowConfiguration'][_0xafac('0x49')](_0x5711a7[_0xafac('0x4a')],{})[_0xafac('0x29')](respondWithResult(_0x28a018,0xc9))[_0xafac('0x47')](handleError(_0x28a018,null));};exports[_0xafac('0x27')]=function(_0x463b2b,_0x4f1e5b){if(_0x463b2b['body']['id']){delete _0x463b2b[_0xafac('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xafac('0x4b')]({'where':{'id':_0x463b2b[_0xafac('0x4c')]['id']}})[_0xafac('0x29')](handleEntityNotFound(_0x4f1e5b,null))[_0xafac('0x29')](saveUpdates(_0x463b2b[_0xafac('0x4a')],null))[_0xafac('0x29')](respondWithResult(_0x4f1e5b,null))['catch'](handleError(_0x4f1e5b,null));};exports['destroy']=function(_0x5c4628,_0x36bf9c){return db['ServicenowConfiguration']['find']({'where':{'id':_0x5c4628['params']['id']}})[_0xafac('0x29')](handleEntityNotFound(_0x36bf9c,null))['then'](removeEntity(_0x36bf9c,null))['catch'](handleError(_0x36bf9c,null));};exports[_0xafac('0x4d')]=function(_0x388da2,_0x6c7ae,_0x296138){var _0x1b1a72={};var _0x4c8902={};var _0xbfe6b8;var _0x2d37c1;return db[_0xafac('0x2f')][_0xafac('0x4e')]({'where':{'id':_0x388da2[_0xafac('0x4c')]['id']}})[_0xafac('0x29')](handleEntityNotFound(_0x6c7ae,null))['then'](function(_0x499eb6){if(_0x499eb6){_0xbfe6b8=_0x499eb6;_0x4c8902['model']=_[_0xafac('0x34')](db[_0xafac('0x4f')][_0xafac('0x50')]);_0x4c8902[_0xafac('0x33')]=_['keys'](_0x388da2[_0xafac('0x33')]);_0x4c8902['filters']=_['intersection'](_0x4c8902[_0xafac('0x35')],_0x4c8902[_0xafac('0x33')]);_0x1b1a72[_0xafac('0x36')]=_[_0xafac('0x37')](_0x4c8902[_0xafac('0x35')],qs['fields'](_0x388da2[_0xafac('0x33')][_0xafac('0x38')]));_0x1b1a72[_0xafac('0x36')]=_0x1b1a72['attributes'][_0xafac('0x39')]?_0x1b1a72[_0xafac('0x36')]:_0x4c8902[_0xafac('0x35')];_0x1b1a72[_0xafac('0x3c')]=qs['sort'](_0x388da2['query']['sort']);_0x1b1a72['where']=qs['filters'](_['pick'](_0x388da2['query'],_0x4c8902[_0xafac('0x3f')]));if(_0x388da2[_0xafac('0x33')]['filter']){_0x1b1a72['where']=_[_0xafac('0x40')](_0x1b1a72['where'],{'$or':_[_0xafac('0x2e')](_0x1b1a72[_0xafac('0x36')],function(_0x110fa0){var _0x46cccd={};_0x46cccd[_0x110fa0]={'$like':'%'+_0x388da2[_0xafac('0x33')][_0xafac('0x42')]+'%'};return _0x46cccd;})});}_0x1b1a72=_[_0xafac('0x40')]({},_0x1b1a72,_0x388da2[_0xafac('0x43')]);return _0xbfe6b8[_0xafac('0x4d')](_0x1b1a72);}})[_0xafac('0x29')](function(_0x16f34c){if(_0x16f34c){_0x2d37c1=_0x16f34c['length'];if(!_0x388da2[_0xafac('0x33')]['hasOwnProperty'](_0xafac('0x3b'))){_0x1b1a72[_0xafac('0x20')]=qs[_0xafac('0x20')](_0x388da2[_0xafac('0x33')][_0xafac('0x20')]);_0x1b1a72[_0xafac('0x1e')]=qs[_0xafac('0x1e')](_0x388da2[_0xafac('0x33')]['offset']);}return _0xbfe6b8[_0xafac('0x4d')](_0x1b1a72);}})[_0xafac('0x29')](function(_0x171d73){if(_0x171d73){return _0x171d73?{'count':_0x2d37c1,'rows':_0x171d73}:null;}})[_0xafac('0x29')](respondWithResult(_0x6c7ae,null))[_0xafac('0x47')](handleError(_0x6c7ae,null));};exports['getSubjects']=function(_0x47fcd9,_0x2c8044,_0x433dd0){var _0x31063f={};var _0x4ff27c={};var _0x222bab;var _0x53756b;return db[_0xafac('0x2f')][_0xafac('0x4e')]({'where':{'id':_0x47fcd9[_0xafac('0x4c')]['id']}})[_0xafac('0x29')](handleEntityNotFound(_0x2c8044,null))[_0xafac('0x29')](function(_0x46c9ad){if(_0x46c9ad){_0x222bab=_0x46c9ad;_0x4ff27c['model']=_[_0xafac('0x34')](db['ServicenowField'][_0xafac('0x50')]);_0x4ff27c[_0xafac('0x33')]=_[_0xafac('0x34')](_0x47fcd9['query']);_0x4ff27c[_0xafac('0x3f')]=_[_0xafac('0x37')](_0x4ff27c['model'],_0x4ff27c[_0xafac('0x33')]);_0x31063f[_0xafac('0x36')]=_[_0xafac('0x37')](_0x4ff27c[_0xafac('0x35')],qs[_0xafac('0x38')](_0x47fcd9[_0xafac('0x33')][_0xafac('0x38')]));_0x31063f[_0xafac('0x36')]=_0x31063f['attributes'][_0xafac('0x39')]?_0x31063f[_0xafac('0x36')]:_0x4ff27c[_0xafac('0x35')];_0x31063f[_0xafac('0x3c')]=qs['sort'](_0x47fcd9['query'][_0xafac('0x3d')]);_0x31063f[_0xafac('0x3e')]=qs[_0xafac('0x3f')](_[_0xafac('0x51')](_0x47fcd9['query'],_0x4ff27c[_0xafac('0x3f')]));if(_0x47fcd9[_0xafac('0x33')][_0xafac('0x42')]){_0x31063f[_0xafac('0x3e')]=_[_0xafac('0x40')](_0x31063f[_0xafac('0x3e')],{'$or':_[_0xafac('0x2e')](_0x31063f[_0xafac('0x36')],function(_0xc4645d){var _0x1eac4b={};_0x1eac4b[_0xc4645d]={'$like':'%'+_0x47fcd9[_0xafac('0x33')]['filter']+'%'};return _0x1eac4b;})});}_0x31063f=_[_0xafac('0x40')]({},_0x31063f,_0x47fcd9[_0xafac('0x43')]);return _0x222bab[_0xafac('0x52')](_0x31063f);}})['then'](function(_0x5c38bf){if(_0x5c38bf){_0x53756b=_0x5c38bf[_0xafac('0x39')];if(!_0x47fcd9[_0xafac('0x33')][_0xafac('0x3a')]('nolimit')){_0x31063f[_0xafac('0x20')]=qs[_0xafac('0x20')](_0x47fcd9[_0xafac('0x33')][_0xafac('0x20')]);_0x31063f['offset']=qs[_0xafac('0x1e')](_0x47fcd9['query'][_0xafac('0x1e')]);}return _0x222bab[_0xafac('0x52')](_0x31063f);}})[_0xafac('0x29')](function(_0x49317f){if(_0x49317f){return _0x49317f?{'count':_0x53756b,'rows':_0x49317f}:null;}})[_0xafac('0x29')](respondWithResult(_0x2c8044,null))[_0xafac('0x47')](handleError(_0x2c8044,null));};exports['getDescriptions']=function(_0x426edc,_0x23551c,_0xd73731){var _0x144c63={};var _0x17e3f4={};var _0x40876b;var _0x167d00;return db['ServicenowConfiguration'][_0xafac('0x4e')]({'where':{'id':_0x426edc[_0xafac('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23551c,null))['then'](function(_0x7bb702){if(_0x7bb702){_0x40876b=_0x7bb702;_0x17e3f4[_0xafac('0x35')]=_[_0xafac('0x34')](db[_0xafac('0x4f')][_0xafac('0x50')]);_0x17e3f4['query']=_[_0xafac('0x34')](_0x426edc['query']);_0x17e3f4[_0xafac('0x3f')]=_[_0xafac('0x37')](_0x17e3f4[_0xafac('0x35')],_0x17e3f4['query']);_0x144c63['attributes']=_[_0xafac('0x37')](_0x17e3f4[_0xafac('0x35')],qs['fields'](_0x426edc[_0xafac('0x33')][_0xafac('0x38')]));_0x144c63[_0xafac('0x36')]=_0x144c63['attributes'][_0xafac('0x39')]?_0x144c63[_0xafac('0x36')]:_0x17e3f4['model'];_0x144c63[_0xafac('0x3c')]=qs[_0xafac('0x3d')](_0x426edc[_0xafac('0x33')][_0xafac('0x3d')]);_0x144c63[_0xafac('0x3e')]=qs['filters'](_[_0xafac('0x51')](_0x426edc['query'],_0x17e3f4[_0xafac('0x3f')]));if(_0x426edc[_0xafac('0x33')][_0xafac('0x42')]){_0x144c63[_0xafac('0x3e')]=_[_0xafac('0x40')](_0x144c63[_0xafac('0x3e')],{'$or':_[_0xafac('0x2e')](_0x144c63['attributes'],function(_0x257d69){var _0x12c6dc={};_0x12c6dc[_0x257d69]={'$like':'%'+_0x426edc[_0xafac('0x33')][_0xafac('0x42')]+'%'};return _0x12c6dc;})});}_0x144c63=_[_0xafac('0x40')]({},_0x144c63,_0x426edc['options']);return _0x40876b[_0xafac('0x53')](_0x144c63);}})[_0xafac('0x29')](function(_0x5dd2e5){if(_0x5dd2e5){_0x167d00=_0x5dd2e5[_0xafac('0x39')];if(!_0x426edc[_0xafac('0x33')][_0xafac('0x3a')](_0xafac('0x3b'))){_0x144c63[_0xafac('0x20')]=qs[_0xafac('0x20')](_0x426edc[_0xafac('0x33')][_0xafac('0x20')]);_0x144c63['offset']=qs['offset'](_0x426edc['query'][_0xafac('0x1e')]);}return _0x40876b[_0xafac('0x53')](_0x144c63);}})[_0xafac('0x29')](function(_0x411275){if(_0x411275){return _0x411275?{'count':_0x167d00,'rows':_0x411275}:null;}})[_0xafac('0x29')](respondWithResult(_0x23551c,null))[_0xafac('0x47')](handleError(_0x23551c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 599f704..d8225d4 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5242=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x152ed3,_0x97b6c0){var _0x46a928=function(_0x407bb4){while(--_0x407bb4){_0x152ed3['push'](_0x152ed3['shift']());}};_0x46a928(++_0x97b6c0);}(_0x5242,0x148));var _0x2524=function(_0x57ee6a,_0x4e7d00){_0x57ee6a=_0x57ee6a-0x0;var _0x5acb59=_0x5242[_0x57ee6a];return _0x5acb59;};'use strict';var _=require(_0x2524('0x0'));var util=require(_0x2524('0x1'));var logger=require(_0x2524('0x2'))(_0x2524('0x3'));var moment=require(_0x2524('0x4'));var BPromise=require('bluebird');var rp=require(_0x2524('0x5'));var fs=require('fs');var path=require(_0x2524('0x6'));var rimraf=require(_0x2524('0x7'));var config=require(_0x2524('0x8'));var attributes=require(_0x2524('0x9'));module[_0x2524('0xa')]=function(_0x9140b3,_0x5e0f80){return _0x9140b3[_0x2524('0xb')](_0x2524('0xc'),attributes,{'tableName':_0x2524('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x585e=['rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','path'];(function(_0x76c011,_0x7f8368){var _0x189bdf=function(_0x32c42b){while(--_0x32c42b){_0x76c011['push'](_0x76c011['shift']());}};_0x189bdf(++_0x7f8368);}(_0x585e,0x1c2));var _0xe585=function(_0x435b5f,_0x2e56df){_0x435b5f=_0x435b5f-0x0;var _0x3b6929=_0x585e[_0x435b5f];return _0x3b6929;};'use strict';var _=require(_0xe585('0x0'));var util=require(_0xe585('0x1'));var logger=require(_0xe585('0x2'))(_0xe585('0x3'));var moment=require(_0xe585('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe585('0x5'));var rimraf=require(_0xe585('0x6'));var config=require('../../config/environment');var attributes=require(_0xe585('0x7'));module[_0xe585('0x8')]=function(_0x14dcd7,_0x2301bc){return _0x14dcd7[_0xe585('0x9')](_0xe585('0xa'),attributes,{'tableName':_0xe585('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 79e9ebf..9870289 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf820=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x1f9bea,_0x228c0e){var _0xf0834f=function(_0x52478a){while(--_0x52478a){_0x1f9bea['push'](_0x1f9bea['shift']());}};_0xf0834f(++_0x228c0e);}(_0xf820,0x86));var _0x0f82=function(_0x2e9692,_0xdaf10e){_0x2e9692=_0x2e9692-0x0;var _0xa04511=_0xf820[_0x2e9692];return _0xa04511;};'use strict';var _=require(_0x0f82('0x0'));var util=require(_0x0f82('0x1'));var moment=require(_0x0f82('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f82('0x3'));var fs=require('fs');var Redis=require(_0x0f82('0x4'));var db=require(_0x0f82('0x5'))['db'];var utils=require(_0x0f82('0x6'));var logger=require(_0x0f82('0x7'))(_0x0f82('0x8'));var config=require(_0x0f82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0f82('0xa')][_0x0f82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28df65,_0x40f244,_0x552403){return new BPromise(function(_0x4be7cb,_0x41675f){return client['request'](_0x28df65,_0x552403)[_0x0f82('0xc')](function(_0x22a121){logger['info'](_0x0f82('0xd'),_0x40f244,_0x0f82('0xe'));logger[_0x0f82('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x40f244,_0x0f82('0xe'),JSON[_0x0f82('0x10')](_0x22a121));if(_0x22a121[_0x0f82('0x11')]){if(_0x22a121['error'][_0x0f82('0x12')]===0x1f4){logger[_0x0f82('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x40f244,_0x22a121[_0x0f82('0x11')]['message']);return _0x41675f(_0x22a121['error'][_0x0f82('0x13')]);}logger[_0x0f82('0x11')](_0x0f82('0xd'),_0x40f244,_0x22a121[_0x0f82('0x11')]['message']);return _0x4be7cb(_0x22a121[_0x0f82('0x11')][_0x0f82('0x13')]);}else{logger['info'](_0x0f82('0xd'),_0x40f244,'request\x20sent');_0x4be7cb(_0x22a121[_0x0f82('0x14')]['message']);}})['catch'](function(_0x3df176){logger['error'](_0x0f82('0xd'),_0x40f244,_0x3df176);_0x41675f(_0x3df176);});});} \ No newline at end of file +var _0xec79=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','moment','bluebird'];(function(_0x4772e0,_0x1072a2){var _0x8797f0=function(_0x24d04f){while(--_0x24d04f){_0x4772e0['push'](_0x4772e0['shift']());}};_0x8797f0(++_0x1072a2);}(_0xec79,0x1b7));var _0x9ec7=function(_0x42b0bd,_0x24eb2f){_0x42b0bd=_0x42b0bd-0x0;var _0x22a2cd=_0xec79[_0x42b0bd];return _0x22a2cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ec7('0x0'));var BPromise=require(_0x9ec7('0x1'));var rs=require(_0x9ec7('0x2'));var fs=require('fs');var Redis=require(_0x9ec7('0x3'));var db=require(_0x9ec7('0x4'))['db'];var utils=require(_0x9ec7('0x5'));var logger=require('../../config/logger')(_0x9ec7('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ec7('0x7'));var client=jayson[_0x9ec7('0x8')][_0x9ec7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87d68f,_0x2ae26a,_0x2b2c7b){return new BPromise(function(_0x3a42b2,_0x4987c3){return client[_0x9ec7('0xa')](_0x87d68f,_0x2b2c7b)['then'](function(_0x13acb1){logger[_0x9ec7('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2ae26a,_0x9ec7('0xc'));logger[_0x9ec7('0xd')](_0x9ec7('0xe'),_0x2ae26a,'request\x20sent',JSON[_0x9ec7('0xf')](_0x13acb1));if(_0x13acb1[_0x9ec7('0x10')]){if(_0x13acb1[_0x9ec7('0x10')][_0x9ec7('0x11')]===0x1f4){logger[_0x9ec7('0x10')](_0x9ec7('0x12'),_0x2ae26a,_0x13acb1[_0x9ec7('0x10')]['message']);return _0x4987c3(_0x13acb1[_0x9ec7('0x10')]['message']);}logger[_0x9ec7('0x10')](_0x9ec7('0x12'),_0x2ae26a,_0x13acb1[_0x9ec7('0x10')][_0x9ec7('0x13')]);return _0x3a42b2(_0x13acb1[_0x9ec7('0x10')][_0x9ec7('0x13')]);}else{logger[_0x9ec7('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2ae26a,_0x9ec7('0xc'));_0x3a42b2(_0x13acb1[_0x9ec7('0x14')][_0x9ec7('0x13')]);}})['catch'](function(_0x1d92db){logger[_0x9ec7('0x10')](_0x9ec7('0x12'),_0x2ae26a,_0x1d92db);_0x4987c3(_0x1d92db);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 76b42f4..83c9c17 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb37e=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','multer','util','connect-timeout'];(function(_0x1cd7ea,_0x226371){var _0x56e0c1=function(_0x5a966d){while(--_0x5a966d){_0x1cd7ea['push'](_0x1cd7ea['shift']());}};_0x56e0c1(++_0x226371);}(_0xb37e,0xb1));var _0xeb37=function(_0x564b96,_0x2b3e53){_0x564b96=_0x564b96-0x0;var _0xc4e439=_0xb37e[_0x564b96];return _0xc4e439;};'use strict';var multer=require(_0xeb37('0x0'));var util=require(_0xeb37('0x1'));var path=require('path');var timeout=require(_0xeb37('0x2'));var express=require(_0xeb37('0x3'));var router=express['Router']();var fs_extra=require(_0xeb37('0x4'));var auth=require(_0xeb37('0x5'));var interaction=require(_0xeb37('0x6'));var config=require('../../config/environment');var controller=require(_0xeb37('0x7'));router[_0xeb37('0x8')]('/',auth[_0xeb37('0x9')](),controller[_0xeb37('0xa')]);router[_0xeb37('0x8')]('/:id',auth[_0xeb37('0x9')](),controller[_0xeb37('0xb')]);router[_0xeb37('0xc')]('/',auth[_0xeb37('0x9')](),controller[_0xeb37('0xd')]);router[_0xeb37('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xeb37('0xf')]);router[_0xeb37('0x10')](_0xeb37('0x11'),auth[_0xeb37('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc8ed=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0x5490d9,_0x5dfd12){var _0x2ab392=function(_0x41943a){while(--_0x41943a){_0x5490d9['push'](_0x5490d9['shift']());}};_0x2ab392(++_0x5dfd12);}(_0xc8ed,0xfd));var _0xdc8e=function(_0x57858c,_0x45ba48){_0x57858c=_0x57858c-0x0;var _0x442e2d=_0xc8ed[_0x57858c];return _0x442e2d;};'use strict';var multer=require(_0xdc8e('0x0'));var util=require(_0xdc8e('0x1'));var path=require(_0xdc8e('0x2'));var timeout=require(_0xdc8e('0x3'));var express=require(_0xdc8e('0x4'));var router=express[_0xdc8e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdc8e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc8e('0x7'));var controller=require('./intServicenowField.controller');router[_0xdc8e('0x8')]('/',auth[_0xdc8e('0x9')](),controller['index']);router['get']('/:id',auth[_0xdc8e('0x9')](),controller[_0xdc8e('0xa')]);router[_0xdc8e('0xb')]('/',auth[_0xdc8e('0x9')](),controller[_0xdc8e('0xc')]);router[_0xdc8e('0xd')](_0xdc8e('0xe'),auth['isAuthenticated'](),controller[_0xdc8e('0xf')]);router[_0xdc8e('0x10')](_0xdc8e('0xe'),auth[_0xdc8e('0x9')](),controller[_0xdc8e('0x11')]);module[_0xdc8e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 481c1f7..0232f96 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fde=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x113856,_0x1f1b96){var _0x1f1366=function(_0x3c8de0){while(--_0x3c8de0){_0x113856['push'](_0x113856['shift']());}};_0x1f1366(++_0x1f1b96);}(_0x8fde,0xf9));var _0xe8fd=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x8fde[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xe8fd('0x0'));module[_0xe8fd('0x1')]={'type':{'type':Sequelize[_0xe8fd('0x2')](_0xe8fd('0x3'),_0xe8fd('0x4'),'customVariable',_0xe8fd('0x5'),'picklist'),'defaultValue':_0xe8fd('0x3')},'content':{'type':Sequelize[_0xe8fd('0x6')]},'key':{'type':Sequelize[_0xe8fd('0x6')]},'keyType':{'type':Sequelize[_0xe8fd('0x2')]('string',_0xe8fd('0x4'),_0xe8fd('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe8fd('0x6')]},'nameField':{'type':Sequelize[_0xe8fd('0x6')]},'customField':{'type':Sequelize[_0xe8fd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe8fd('0x6')]}}; \ No newline at end of file +var _0x8db0=['string','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','STRING'];(function(_0x5d60d1,_0x325ad0){var _0x5e94a7=function(_0x40fb9c){while(--_0x40fb9c){_0x5d60d1['push'](_0x5d60d1['shift']());}};_0x5e94a7(++_0x325ad0);}(_0x8db0,0x9b));var _0x08db=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x8db0[_0x3b96cf];return _0x2e315a;};'use strict';var Sequelize=require(_0x08db('0x0'));module[_0x08db('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x08db('0x2'),_0x08db('0x3'),_0x08db('0x4'),_0x08db('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x08db('0x6')]},'key':{'type':Sequelize[_0x08db('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x08db('0x7'),_0x08db('0x2'),_0x08db('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x08db('0x6')]},'nameField':{'type':Sequelize[_0x08db('0x6')]},'customField':{'type':Sequelize[_0x08db('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x08db('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index c847886..95e6fae 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6506=['hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','length','find','create','body','params','rimraf','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes'];(function(_0x4a6391,_0x1f9797){var _0x2aa3c0=function(_0x3082b3){while(--_0x3082b3){_0x4a6391['push'](_0x4a6391['shift']());}};_0x2aa3c0(++_0x1f9797);}(_0x6506,0x124));var _0x6650=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x6506[_0x476bf4];return _0x788ffe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6650('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6650('0x1'));var BPromise=require(_0x6650('0x2'));var Mustache=require('mustache');var util=require(_0x6650('0x3'));var path=require(_0x6650('0x4'));var sox=require(_0x6650('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6650('0x6'));var squel=require('squel');var crypto=require(_0x6650('0x7'));var jsforce=require(_0x6650('0x8'));var deskjs=require(_0x6650('0x9'));var toCsv=require(_0x6650('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6650('0xb'));var as=require(_0x6650('0xc'));var hardwareService=require(_0x6650('0xd'));var logger=require(_0x6650('0xe'))(_0x6650('0xf'));var utils=require(_0x6650('0x10'));var config=require(_0x6650('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6650('0x12'))['db'];function respondWithStatusCode(_0x289c8e,_0x281a94){_0x281a94=_0x281a94||0xcc;return function(_0x466ccd){if(_0x466ccd){return _0x289c8e[_0x6650('0x13')](_0x281a94);}return _0x289c8e[_0x6650('0x14')](_0x281a94)[_0x6650('0x15')]();};}function respondWithResult(_0x1e8cdd,_0x3680ba){_0x3680ba=_0x3680ba||0xc8;return function(_0x313371){if(_0x313371){return _0x1e8cdd['status'](_0x3680ba)['json'](_0x313371);}};}function respondWithFilteredResult(_0x155d6b,_0xc83b0e){return function(_0x344aed){if(_0x344aed){var _0x42c7c1=typeof _0xc83b0e[_0x6650('0x16')]===_0x6650('0x17')&&typeof _0xc83b0e[_0x6650('0x18')]==='undefined';var _0x4edf51=_0x344aed['count'];var _0x24532c=_0x42c7c1?0x0:_0xc83b0e['offset'];var _0x3f66ca=_0x42c7c1?_0x344aed[_0x6650('0x19')]:_0xc83b0e[_0x6650('0x16')]+_0xc83b0e[_0x6650('0x18')];var _0x80b406;if(_0x3f66ca>=_0x4edf51){_0x3f66ca=_0x4edf51;_0x80b406=0xc8;}else{_0x80b406=0xce;}_0x155d6b[_0x6650('0x14')](_0x80b406);return _0x155d6b[_0x6650('0x1a')]('Content-Range',_0x24532c+'-'+_0x3f66ca+'/'+_0x4edf51)['json'](_0x344aed);}return null;};}function patchUpdates(_0x54b32c){return function(_0x347b73){try{jsonpatch[_0x6650('0x1b')](_0x347b73,_0x54b32c,!![]);}catch(_0x4baa89){return BPromise[_0x6650('0x1c')](_0x4baa89);}return _0x347b73['save']();};}function saveUpdates(_0x272b62,_0x463298){return function(_0x33f65f){if(_0x33f65f){return _0x33f65f[_0x6650('0x1d')](_0x272b62)[_0x6650('0x1e')](function(_0x4d4d44){return _0x4d4d44;});}return null;};}function removeEntity(_0x561a91,_0x4d0253){return function(_0x2410bb){if(_0x2410bb){return _0x2410bb[_0x6650('0x1f')]()[_0x6650('0x1e')](function(){_0x561a91[_0x6650('0x14')](0xcc)[_0x6650('0x15')]();});}};}function handleEntityNotFound(_0x3480c6,_0x4838e1){return function(_0x599b7b){if(!_0x599b7b){_0x3480c6[_0x6650('0x13')](0x194);}return _0x599b7b;};}function handleError(_0x2b3357,_0x9fde46){_0x9fde46=_0x9fde46||0x1f4;return function(_0x32a467){logger[_0x6650('0x20')](_0x32a467['stack']);if(_0x32a467[_0x6650('0x21')]){delete _0x32a467['name'];}_0x2b3357[_0x6650('0x14')](_0x9fde46)[_0x6650('0x22')](_0x32a467);};}exports[_0x6650('0x23')]=function(_0xccaf28,_0x1958a3){var _0x288138={},_0x8e490d={},_0x460a49={'count':0x0,'rows':[]};var _0x6001a1=_['map'](db[_0x6650('0x24')][_0x6650('0x25')],function(_0x109e24){return{'name':_0x109e24[_0x6650('0x26')],'type':_0x109e24[_0x6650('0x27')][_0x6650('0x28')]};});_0x8e490d[_0x6650('0x29')]=_[_0x6650('0x2a')](_0x6001a1,_0x6650('0x21'));_0x8e490d[_0x6650('0x2b')]=_['keys'](_0xccaf28['query']);_0x8e490d[_0x6650('0x2c')]=_['intersection'](_0x8e490d[_0x6650('0x29')],_0x8e490d['query']);_0x288138['attributes']=_[_0x6650('0x2d')](_0x8e490d['model'],qs[_0x6650('0x2e')](_0xccaf28[_0x6650('0x2b')][_0x6650('0x2e')]));_0x288138[_0x6650('0x2f')]=_0x288138[_0x6650('0x2f')]['length']?_0x288138[_0x6650('0x2f')]:_0x8e490d[_0x6650('0x29')];if(!_0xccaf28[_0x6650('0x2b')][_0x6650('0x30')]('nolimit')){_0x288138['limit']=qs[_0x6650('0x18')](_0xccaf28[_0x6650('0x2b')][_0x6650('0x18')]);_0x288138['offset']=qs[_0x6650('0x16')](_0xccaf28[_0x6650('0x2b')][_0x6650('0x16')]);}_0x288138[_0x6650('0x31')]=qs[_0x6650('0x32')](_0xccaf28['query'][_0x6650('0x32')]);_0x288138[_0x6650('0x33')]=qs[_0x6650('0x2c')](_[_0x6650('0x34')](_0xccaf28['query'],_0x8e490d['filters']),_0x6001a1);if(_0xccaf28[_0x6650('0x2b')]['filter']){_0x288138[_0x6650('0x33')]=_[_0x6650('0x35')](_0x288138[_0x6650('0x33')],{'$or':_[_0x6650('0x2a')](_0x6001a1,function(_0xe7a60f){if(_0xe7a60f[_0x6650('0x27')]!==_0x6650('0x36')){var _0x465213={};_0x465213[_0xe7a60f[_0x6650('0x21')]]={'$like':'%'+_0xccaf28['query'][_0x6650('0x37')]+'%'};return _0x465213;}})});}_0x288138=_[_0x6650('0x35')]({},_0x288138,_0xccaf28[_0x6650('0x38')]);var _0x58084a={'where':_0x288138[_0x6650('0x33')]};return db[_0x6650('0x24')][_0x6650('0x19')](_0x58084a)[_0x6650('0x1e')](function(_0x595112){_0x460a49['count']=_0x595112;if(_0xccaf28[_0x6650('0x2b')][_0x6650('0x39')]){_0x288138[_0x6650('0x3a')]=[{'all':!![]}];}return db[_0x6650('0x24')]['findAll'](_0x288138);})[_0x6650('0x1e')](function(_0x364417){_0x460a49[_0x6650('0x3b')]=_0x364417;return _0x460a49;})[_0x6650('0x1e')](respondWithFilteredResult(_0x1958a3,_0x288138))[_0x6650('0x3c')](handleError(_0x1958a3,null));};exports[_0x6650('0x3d')]=function(_0x163374,_0x19c2e7){var _0x35b985={'raw':!![],'where':{'id':_0x163374['params']['id']}},_0x44b408={};_0x44b408['model']=_[_0x6650('0x3e')](db[_0x6650('0x24')][_0x6650('0x25')]);_0x44b408[_0x6650('0x2b')]=_[_0x6650('0x3e')](_0x163374[_0x6650('0x2b')]);_0x44b408[_0x6650('0x2c')]=_[_0x6650('0x2d')](_0x44b408['model'],_0x44b408[_0x6650('0x2b')]);_0x35b985[_0x6650('0x2f')]=_[_0x6650('0x2d')](_0x44b408[_0x6650('0x29')],qs[_0x6650('0x2e')](_0x163374[_0x6650('0x2b')][_0x6650('0x2e')]));_0x35b985[_0x6650('0x2f')]=_0x35b985['attributes'][_0x6650('0x3f')]?_0x35b985[_0x6650('0x2f')]:_0x44b408[_0x6650('0x29')];if(_0x163374[_0x6650('0x2b')]['includeAll']){_0x35b985[_0x6650('0x3a')]=[{'all':!![]}];}_0x35b985=_[_0x6650('0x35')]({},_0x35b985,_0x163374[_0x6650('0x38')]);return db[_0x6650('0x24')][_0x6650('0x40')](_0x35b985)[_0x6650('0x1e')](handleEntityNotFound(_0x19c2e7,null))[_0x6650('0x1e')](respondWithResult(_0x19c2e7,null))['catch'](handleError(_0x19c2e7,null));};exports[_0x6650('0x41')]=function(_0x4de516,_0x4a3287){return db[_0x6650('0x24')][_0x6650('0x41')](_0x4de516['body'],{})[_0x6650('0x1e')](respondWithResult(_0x4a3287,0xc9))['catch'](handleError(_0x4a3287,null));};exports[_0x6650('0x1d')]=function(_0x10fdf2,_0x4095a6){if(_0x10fdf2[_0x6650('0x42')]['id']){delete _0x10fdf2[_0x6650('0x42')]['id'];}return db[_0x6650('0x24')][_0x6650('0x40')]({'where':{'id':_0x10fdf2[_0x6650('0x43')]['id']}})[_0x6650('0x1e')](handleEntityNotFound(_0x4095a6,null))['then'](saveUpdates(_0x10fdf2[_0x6650('0x42')],null))[_0x6650('0x1e')](respondWithResult(_0x4095a6,null))[_0x6650('0x3c')](handleError(_0x4095a6,null));};exports[_0x6650('0x1f')]=function(_0xdef5b4,_0x4c60d2){return db[_0x6650('0x24')]['find']({'where':{'id':_0xdef5b4[_0x6650('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c60d2,null))[_0x6650('0x1e')](removeEntity(_0x4c60d2,null))[_0x6650('0x3c')](handleError(_0x4c60d2,null));}; \ No newline at end of file +var _0x2ecc=['offset','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','ServicenowField','findAll','rows','catch','show','rawAttributes','length','include','create','body','find','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2ecc,0x78));var _0xc2ec=function(_0x4e7557,_0x3e90c1){_0x4e7557=_0x4e7557-0x0;var _0xcf7b75=_0x2ecc[_0x4e7557];return _0xcf7b75;};'use strict';var emlformat=require(_0xc2ec('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc2ec('0x1'));var rp=require(_0xc2ec('0x2'));var moment=require(_0xc2ec('0x3'));var BPromise=require(_0xc2ec('0x4'));var Mustache=require(_0xc2ec('0x5'));var util=require(_0xc2ec('0x6'));var path=require('path');var sox=require(_0xc2ec('0x7'));var csv=require(_0xc2ec('0x8'));var ejs=require(_0xc2ec('0x9'));var fs=require('fs');var fs_extra=require(_0xc2ec('0xa'));var _=require(_0xc2ec('0xb'));var squel=require(_0xc2ec('0xc'));var crypto=require(_0xc2ec('0xd'));var jsforce=require(_0xc2ec('0xe'));var deskjs=require(_0xc2ec('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc2ec('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc2ec('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc2ec('0x12'));var hardwareService=require(_0xc2ec('0x13'));var logger=require(_0xc2ec('0x14'))(_0xc2ec('0x15'));var utils=require(_0xc2ec('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc2ec('0x17'));var db=require(_0xc2ec('0x18'))['db'];function respondWithStatusCode(_0x18bcd1,_0x4f344c){_0x4f344c=_0x4f344c||0xcc;return function(_0x2963a3){if(_0x2963a3){return _0x18bcd1[_0xc2ec('0x19')](_0x4f344c);}return _0x18bcd1[_0xc2ec('0x1a')](_0x4f344c)['end']();};}function respondWithResult(_0x51701b,_0x765da2){_0x765da2=_0x765da2||0xc8;return function(_0xe9f8b9){if(_0xe9f8b9){return _0x51701b[_0xc2ec('0x1a')](_0x765da2)[_0xc2ec('0x1b')](_0xe9f8b9);}};}function respondWithFilteredResult(_0x1a7ce,_0x201d5f){return function(_0x19c558){if(_0x19c558){var _0x4d4726=typeof _0x201d5f['offset']===_0xc2ec('0x1c')&&typeof _0x201d5f[_0xc2ec('0x1d')]===_0xc2ec('0x1c');var _0x2a9f62=_0x19c558['count'];var _0x2c089c=_0x4d4726?0x0:_0x201d5f[_0xc2ec('0x1e')];var _0x52a6c4=_0x4d4726?_0x19c558[_0xc2ec('0x1f')]:_0x201d5f[_0xc2ec('0x1e')]+_0x201d5f['limit'];var _0x29225b;if(_0x52a6c4>=_0x2a9f62){_0x52a6c4=_0x2a9f62;_0x29225b=0xc8;}else{_0x29225b=0xce;}_0x1a7ce[_0xc2ec('0x1a')](_0x29225b);return _0x1a7ce[_0xc2ec('0x20')]('Content-Range',_0x2c089c+'-'+_0x52a6c4+'/'+_0x2a9f62)[_0xc2ec('0x1b')](_0x19c558);}return null;};}function patchUpdates(_0x578338){return function(_0x3eac75){try{jsonpatch[_0xc2ec('0x21')](_0x3eac75,_0x578338,!![]);}catch(_0x52b273){return BPromise[_0xc2ec('0x22')](_0x52b273);}return _0x3eac75[_0xc2ec('0x23')]();};}function saveUpdates(_0x5a6b34,_0x57665e){return function(_0x15cd00){if(_0x15cd00){return _0x15cd00[_0xc2ec('0x24')](_0x5a6b34)[_0xc2ec('0x25')](function(_0x34e023){return _0x34e023;});}return null;};}function removeEntity(_0x438b7e,_0x115448){return function(_0x52e99f){if(_0x52e99f){return _0x52e99f[_0xc2ec('0x26')]()['then'](function(){_0x438b7e[_0xc2ec('0x1a')](0xcc)[_0xc2ec('0x27')]();});}};}function handleEntityNotFound(_0x47beda,_0x51f00c){return function(_0x5d5cb3){if(!_0x5d5cb3){_0x47beda[_0xc2ec('0x19')](0x194);}return _0x5d5cb3;};}function handleError(_0x50ed88,_0xa6f959){_0xa6f959=_0xa6f959||0x1f4;return function(_0x5cbb33){logger[_0xc2ec('0x28')](_0x5cbb33[_0xc2ec('0x29')]);if(_0x5cbb33[_0xc2ec('0x2a')]){delete _0x5cbb33[_0xc2ec('0x2a')];}_0x50ed88[_0xc2ec('0x1a')](_0xa6f959)[_0xc2ec('0x2b')](_0x5cbb33);};}exports[_0xc2ec('0x2c')]=function(_0x5e1f3f,_0x10503e){var _0x4a8821={},_0x435f38={},_0x17269b={'count':0x0,'rows':[]};var _0x352ab4=_['map'](db['ServicenowField']['rawAttributes'],function(_0x55070e){return{'name':_0x55070e['fieldName'],'type':_0x55070e[_0xc2ec('0x2d')][_0xc2ec('0x2e')]};});_0x435f38[_0xc2ec('0x2f')]=_['map'](_0x352ab4,_0xc2ec('0x2a'));_0x435f38[_0xc2ec('0x30')]=_[_0xc2ec('0x31')](_0x5e1f3f[_0xc2ec('0x30')]);_0x435f38[_0xc2ec('0x32')]=_[_0xc2ec('0x33')](_0x435f38['model'],_0x435f38[_0xc2ec('0x30')]);_0x4a8821[_0xc2ec('0x34')]=_[_0xc2ec('0x33')](_0x435f38[_0xc2ec('0x2f')],qs[_0xc2ec('0x35')](_0x5e1f3f['query'][_0xc2ec('0x35')]));_0x4a8821[_0xc2ec('0x34')]=_0x4a8821[_0xc2ec('0x34')]['length']?_0x4a8821['attributes']:_0x435f38[_0xc2ec('0x2f')];if(!_0x5e1f3f[_0xc2ec('0x30')][_0xc2ec('0x36')]('nolimit')){_0x4a8821['limit']=qs['limit'](_0x5e1f3f[_0xc2ec('0x30')][_0xc2ec('0x1d')]);_0x4a8821[_0xc2ec('0x1e')]=qs[_0xc2ec('0x1e')](_0x5e1f3f[_0xc2ec('0x30')]['offset']);}_0x4a8821[_0xc2ec('0x37')]=qs[_0xc2ec('0x38')](_0x5e1f3f[_0xc2ec('0x30')]['sort']);_0x4a8821[_0xc2ec('0x39')]=qs[_0xc2ec('0x32')](_[_0xc2ec('0x3a')](_0x5e1f3f['query'],_0x435f38[_0xc2ec('0x32')]),_0x352ab4);if(_0x5e1f3f[_0xc2ec('0x30')][_0xc2ec('0x3b')]){_0x4a8821['where']=_[_0xc2ec('0x3c')](_0x4a8821[_0xc2ec('0x39')],{'$or':_[_0xc2ec('0x3d')](_0x352ab4,function(_0x4300c5){if(_0x4300c5[_0xc2ec('0x2d')]!==_0xc2ec('0x3e')){var _0x6cf0e7={};_0x6cf0e7[_0x4300c5[_0xc2ec('0x2a')]]={'$like':'%'+_0x5e1f3f[_0xc2ec('0x30')][_0xc2ec('0x3b')]+'%'};return _0x6cf0e7;}})});}_0x4a8821=_['merge']({},_0x4a8821,_0x5e1f3f['options']);var _0x54ba01={'where':_0x4a8821['where']};return db[_0xc2ec('0x3f')][_0xc2ec('0x1f')](_0x54ba01)[_0xc2ec('0x25')](function(_0x4daa9e){_0x17269b[_0xc2ec('0x1f')]=_0x4daa9e;if(_0x5e1f3f['query']['includeAll']){_0x4a8821['include']=[{'all':!![]}];}return db[_0xc2ec('0x3f')][_0xc2ec('0x40')](_0x4a8821);})[_0xc2ec('0x25')](function(_0x331ac8){_0x17269b[_0xc2ec('0x41')]=_0x331ac8;return _0x17269b;})['then'](respondWithFilteredResult(_0x10503e,_0x4a8821))[_0xc2ec('0x42')](handleError(_0x10503e,null));};exports[_0xc2ec('0x43')]=function(_0x49a29f,_0x379ffe){var _0x5bdbdd={'raw':!![],'where':{'id':_0x49a29f['params']['id']}},_0x3e3791={};_0x3e3791[_0xc2ec('0x2f')]=_[_0xc2ec('0x31')](db[_0xc2ec('0x3f')][_0xc2ec('0x44')]);_0x3e3791[_0xc2ec('0x30')]=_['keys'](_0x49a29f['query']);_0x3e3791['filters']=_[_0xc2ec('0x33')](_0x3e3791[_0xc2ec('0x2f')],_0x3e3791[_0xc2ec('0x30')]);_0x5bdbdd[_0xc2ec('0x34')]=_[_0xc2ec('0x33')](_0x3e3791[_0xc2ec('0x2f')],qs[_0xc2ec('0x35')](_0x49a29f[_0xc2ec('0x30')][_0xc2ec('0x35')]));_0x5bdbdd['attributes']=_0x5bdbdd[_0xc2ec('0x34')][_0xc2ec('0x45')]?_0x5bdbdd[_0xc2ec('0x34')]:_0x3e3791[_0xc2ec('0x2f')];if(_0x49a29f['query']['includeAll']){_0x5bdbdd[_0xc2ec('0x46')]=[{'all':!![]}];}_0x5bdbdd=_[_0xc2ec('0x3c')]({},_0x5bdbdd,_0x49a29f['options']);return db['ServicenowField']['find'](_0x5bdbdd)['then'](handleEntityNotFound(_0x379ffe,null))[_0xc2ec('0x25')](respondWithResult(_0x379ffe,null))[_0xc2ec('0x42')](handleError(_0x379ffe,null));};exports[_0xc2ec('0x47')]=function(_0x5dbd01,_0x500315){return db[_0xc2ec('0x3f')][_0xc2ec('0x47')](_0x5dbd01[_0xc2ec('0x48')],{})['then'](respondWithResult(_0x500315,0xc9))[_0xc2ec('0x42')](handleError(_0x500315,null));};exports['update']=function(_0x23b109,_0x1fe0b5){if(_0x23b109['body']['id']){delete _0x23b109[_0xc2ec('0x48')]['id'];}return db[_0xc2ec('0x3f')][_0xc2ec('0x49')]({'where':{'id':_0x23b109[_0xc2ec('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1fe0b5,null))[_0xc2ec('0x25')](saveUpdates(_0x23b109[_0xc2ec('0x48')],null))[_0xc2ec('0x25')](respondWithResult(_0x1fe0b5,null))[_0xc2ec('0x42')](handleError(_0x1fe0b5,null));};exports[_0xc2ec('0x26')]=function(_0x39f2f6,_0x40c299){return db[_0xc2ec('0x3f')][_0xc2ec('0x49')]({'where':{'id':_0x39f2f6[_0xc2ec('0x4a')]['id']}})[_0xc2ec('0x25')](handleEntityNotFound(_0x40c299,null))[_0xc2ec('0x25')](removeEntity(_0x40c299,null))['catch'](handleError(_0x40c299,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 139daff..1e3b618 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3162=['exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ce188,_0x4d5899){var _0x43ce3a=function(_0x4db233){while(--_0x4db233){_0x4ce188['push'](_0x4ce188['shift']());}};_0x43ce3a(++_0x4d5899);}(_0x3162,0x18e));var _0x2316=function(_0x4d1cc5,_0x5cf765){_0x4d1cc5=_0x4d1cc5-0x0;var _0x5e3fe5=_0x3162[_0x4d1cc5];return _0x5e3fe5;};'use strict';var _=require(_0x2316('0x0'));var util=require(_0x2316('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2316('0x2'));var BPromise=require(_0x2316('0x3'));var rp=require(_0x2316('0x4'));var fs=require('fs');var path=require(_0x2316('0x5'));var rimraf=require(_0x2316('0x6'));var config=require(_0x2316('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x2316('0x8')]=function(_0xa08166,_0x1d87b4){return _0xa08166[_0x2316('0x9')]('ServicenowField',attributes,{'tableName':_0x2316('0xa'),'paranoid':![],'indexes':[{'name':_0x2316('0xb'),'fields':[_0x2316('0xc'),_0x2316('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe513=['FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','servicenow_unique_index','idField'];(function(_0x4cca4b,_0x3f0f3e){var _0x2e9e1a=function(_0x233ba7){while(--_0x233ba7){_0x4cca4b['push'](_0x4cca4b['shift']());}};_0x2e9e1a(++_0x3f0f3e);}(_0xe513,0x10b));var _0x3e51=function(_0x396f85,_0x452cf4){_0x396f85=_0x396f85-0x0;var _0x8eb3a9=_0xe513[_0x396f85];return _0x8eb3a9;};'use strict';var _=require(_0x3e51('0x0'));var util=require(_0x3e51('0x1'));var logger=require('../../config/logger')(_0x3e51('0x2'));var moment=require(_0x3e51('0x3'));var BPromise=require(_0x3e51('0x4'));var rp=require(_0x3e51('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e51('0x6'));var config=require(_0x3e51('0x7'));var attributes=require(_0x3e51('0x8'));module['exports']=function(_0x2c2698,_0x11ee26){return _0x2c2698[_0x3e51('0x9')](_0x3e51('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x3e51('0xb'),'fields':[_0x3e51('0xc'),_0x3e51('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 159d2a6..a55f1ba 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2c694d,_0x337a0f){var _0x50b045=function(_0x453a11){while(--_0x453a11){_0x2c694d['push'](_0x2c694d['shift']());}};_0x50b045(++_0x337a0f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3b896f,_0x147c80){_0x3b896f=_0x3b896f-0x0;var _0x28055d=_0xb43b[_0x3b896f];return _0x28055d;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x245505,_0x2cfe7b){var _0x424bcb=function(_0x10c8df){while(--_0x10c8df){_0x245505['push'](_0x245505['shift']());}};_0x424bcb(++_0x2cfe7b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 1dff347..7ac4d15 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2e65ec,_0x575a89){var _0x446163=function(_0x19d31b){while(--_0x19d31b){_0x2e65ec['push'](_0x2e65ec['shift']());}};_0x446163(++_0x575a89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x578b0c,_0x2ffef4){var _0x280ff4=function(_0x4577b4){while(--_0x4577b4){_0x578b0c['push'](_0x578b0c['shift']());}};_0x280ff4(++_0x2ffef4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 161b630..f719222 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5a92c0,_0x10cf3e){var _0x4412f4=function(_0x76eb01){while(--_0x76eb01){_0x5a92c0['push'](_0x5a92c0['shift']());}};_0x4412f4(++_0x10cf3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4b874b,_0x474403){var _0x5d852d=function(_0x204004){while(--_0x204004){_0x4b874b['push'](_0x4b874b['shift']());}};_0x5d852d(++_0x474403);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 8a7705f..1f2c3e7 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x822f=['fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','SugarcrmAccount','then','findAll','rows','catch','show','keys','includeAll','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','length','nolimit','params','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','username','password','remoteUri','slice','substring','POST','format','login','JSON','%s%s','/service/v4_1/rest.php','stringify','Calls','values','remove','includes','label','value','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','index','map','rawAttributes','query','filters','intersection','model'];(function(_0xf1c4c7,_0x3e598d){var _0x308f78=function(_0x1f1dbd){while(--_0x1f1dbd){_0xf1c4c7['push'](_0xf1c4c7['shift']());}};_0x308f78(++_0x3e598d);}(_0x822f,0xb8));var _0xf822=function(_0x492b16,_0x6ad909){_0x492b16=_0x492b16-0x0;var _0x30b7ad=_0x822f[_0x492b16];return _0x30b7ad;};'use strict';var emlformat=require(_0xf822('0x0'));var rimraf=require(_0xf822('0x1'));var zipdir=require(_0xf822('0x2'));var jsonpatch=require(_0xf822('0x3'));var rp=require(_0xf822('0x4'));var moment=require(_0xf822('0x5'));var BPromise=require(_0xf822('0x6'));var Mustache=require(_0xf822('0x7'));var util=require(_0xf822('0x8'));var path=require(_0xf822('0x9'));var sox=require(_0xf822('0xa'));var csv=require(_0xf822('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf822('0xc'));var _=require('lodash');var squel=require(_0xf822('0xd'));var crypto=require(_0xf822('0xe'));var jsforce=require(_0xf822('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf822('0xb'));var querystring=require(_0xf822('0x10'));var Papa=require(_0xf822('0x11'));var Redis=require(_0xf822('0x12'));var authService=require(_0xf822('0x13'));var qs=require(_0xf822('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf822('0x15'));var logger=require(_0xf822('0x16'))('api');var utils=require(_0xf822('0x17'));var config=require(_0xf822('0x18'));var licenseUtil=require(_0xf822('0x19'));var db=require(_0xf822('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3b477d,_0x5b3bba){_0x5b3bba=_0x5b3bba||0xcc;return function(_0x244c08){if(_0x244c08){return _0x3b477d[_0xf822('0x1b')](_0x5b3bba);}return _0x3b477d['status'](_0x5b3bba)[_0xf822('0x1c')]();};}function respondWithResult(_0xaf2f77,_0x2c8dbd){_0x2c8dbd=_0x2c8dbd||0xc8;return function(_0x4022e5){if(_0x4022e5){return _0xaf2f77[_0xf822('0x1d')](_0x2c8dbd)[_0xf822('0x1e')](_0x4022e5);}};}function respondWithFilteredResult(_0x553b84,_0x5401c3){return function(_0x588181){if(_0x588181){var _0x2d4c41=typeof _0x5401c3['offset']===_0xf822('0x1f')&&typeof _0x5401c3[_0xf822('0x20')]==='undefined';var _0x3a4944=_0x588181[_0xf822('0x21')];var _0x218849=_0x2d4c41?0x0:_0x5401c3[_0xf822('0x22')];var _0x166c6e=_0x2d4c41?_0x588181[_0xf822('0x21')]:_0x5401c3[_0xf822('0x22')]+_0x5401c3[_0xf822('0x20')];var _0x42753f;if(_0x166c6e>=_0x3a4944){_0x166c6e=_0x3a4944;_0x42753f=0xc8;}else{_0x42753f=0xce;}_0x553b84[_0xf822('0x1d')](_0x42753f);return _0x553b84['set'](_0xf822('0x23'),_0x218849+'-'+_0x166c6e+'/'+_0x3a4944)[_0xf822('0x1e')](_0x588181);}return null;};}function patchUpdates(_0xf1fc48){return function(_0x2a178d){try{jsonpatch[_0xf822('0x24')](_0x2a178d,_0xf1fc48,!![]);}catch(_0x46e476){return BPromise['reject'](_0x46e476);}return _0x2a178d[_0xf822('0x25')]();};}function saveUpdates(_0x31f509,_0x4e5a1e){return function(_0x14a85d){if(_0x14a85d){return _0x14a85d[_0xf822('0x26')](_0x31f509)['then'](function(_0x2422f5){return _0x2422f5;});}return null;};}function removeEntity(_0x1cc049,_0x1a7514){return function(_0x390fef){if(_0x390fef){return _0x390fef[_0xf822('0x27')]()['then'](function(){_0x1cc049[_0xf822('0x1d')](0xcc)[_0xf822('0x1c')]();});}};}function handleEntityNotFound(_0x14413f,_0x2791f4){return function(_0x1752a8){if(!_0x1752a8){_0x14413f['sendStatus'](0x194);}return _0x1752a8;};}function handleError(_0xef2c84,_0x516e58){_0x516e58=_0x516e58||0x1f4;return function(_0x5b41ba){logger[_0xf822('0x28')](_0x5b41ba[_0xf822('0x29')]);if(_0x5b41ba[_0xf822('0x2a')]){delete _0x5b41ba['name'];}_0xef2c84[_0xf822('0x1d')](_0x516e58)['send'](_0x5b41ba);};}exports[_0xf822('0x2b')]=function(_0x55776b,_0x14e4b8){var _0xc2d797={},_0x5254d4={},_0x38cf5e={'count':0x0,'rows':[]};var _0x38442d=_[_0xf822('0x2c')](db['SugarcrmAccount'][_0xf822('0x2d')],function(_0x170cef){return{'name':_0x170cef['fieldName'],'type':_0x170cef['type']['key']};});_0x5254d4['model']=_[_0xf822('0x2c')](_0x38442d,'name');_0x5254d4[_0xf822('0x2e')]=_['keys'](_0x55776b[_0xf822('0x2e')]);_0x5254d4[_0xf822('0x2f')]=_[_0xf822('0x30')](_0x5254d4[_0xf822('0x31')],_0x5254d4[_0xf822('0x2e')]);_0xc2d797['attributes']=_[_0xf822('0x30')](_0x5254d4[_0xf822('0x31')],qs['fields'](_0x55776b[_0xf822('0x2e')][_0xf822('0x32')]));_0xc2d797[_0xf822('0x33')]=_0xc2d797[_0xf822('0x33')]['length']?_0xc2d797[_0xf822('0x33')]:_0x5254d4['model'];if(!_0x55776b[_0xf822('0x2e')][_0xf822('0x34')]('nolimit')){_0xc2d797[_0xf822('0x20')]=qs['limit'](_0x55776b[_0xf822('0x2e')][_0xf822('0x20')]);_0xc2d797[_0xf822('0x22')]=qs[_0xf822('0x22')](_0x55776b[_0xf822('0x2e')]['offset']);}_0xc2d797[_0xf822('0x35')]=qs[_0xf822('0x36')](_0x55776b[_0xf822('0x2e')][_0xf822('0x36')]);_0xc2d797['where']=qs[_0xf822('0x2f')](_[_0xf822('0x37')](_0x55776b['query'],_0x5254d4['filters']),_0x38442d);if(_0x55776b[_0xf822('0x2e')][_0xf822('0x38')]){_0xc2d797[_0xf822('0x39')]=_[_0xf822('0x3a')](_0xc2d797[_0xf822('0x39')],{'$or':_['map'](_0x38442d,function(_0x46c335){if(_0x46c335[_0xf822('0x3b')]!=='VIRTUAL'){var _0xd31eb0={};_0xd31eb0[_0x46c335[_0xf822('0x2a')]]={'$like':'%'+_0x55776b[_0xf822('0x2e')][_0xf822('0x38')]+'%'};return _0xd31eb0;}})});}_0xc2d797=_[_0xf822('0x3a')]({},_0xc2d797,_0x55776b[_0xf822('0x3c')]);var _0x488d17={'where':_0xc2d797[_0xf822('0x39')]};return db[_0xf822('0x3d')][_0xf822('0x21')](_0x488d17)[_0xf822('0x3e')](function(_0x515159){_0x38cf5e[_0xf822('0x21')]=_0x515159;if(_0x55776b[_0xf822('0x2e')]['includeAll']){_0xc2d797['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0xf822('0x3f')](_0xc2d797);})[_0xf822('0x3e')](function(_0x1050fc){_0x38cf5e[_0xf822('0x40')]=_0x1050fc;return _0x38cf5e;})[_0xf822('0x3e')](respondWithFilteredResult(_0x14e4b8,_0xc2d797))[_0xf822('0x41')](handleError(_0x14e4b8,null));};exports[_0xf822('0x42')]=function(_0x50b1f3,_0x449a6b){var _0x4a1a4b={'raw':![],'where':{'id':_0x50b1f3['params']['id']}},_0x1f2199={};_0x1f2199[_0xf822('0x31')]=_[_0xf822('0x43')](db[_0xf822('0x3d')]['rawAttributes']);_0x1f2199[_0xf822('0x2e')]=_['keys'](_0x50b1f3[_0xf822('0x2e')]);_0x1f2199[_0xf822('0x2f')]=_[_0xf822('0x30')](_0x1f2199['model'],_0x1f2199[_0xf822('0x2e')]);_0x4a1a4b['attributes']=_[_0xf822('0x30')](_0x1f2199[_0xf822('0x31')],qs[_0xf822('0x32')](_0x50b1f3[_0xf822('0x2e')]['fields']));_0x4a1a4b[_0xf822('0x33')]=_0x4a1a4b[_0xf822('0x33')]['length']?_0x4a1a4b[_0xf822('0x33')]:_0x1f2199[_0xf822('0x31')];if(_0x50b1f3['query'][_0xf822('0x44')]){_0x4a1a4b[_0xf822('0x45')]=[{'all':!![]}];}_0x4a1a4b=_[_0xf822('0x3a')]({},_0x4a1a4b,_0x50b1f3[_0xf822('0x3c')]);return db[_0xf822('0x3d')][_0xf822('0x46')](_0x4a1a4b)[_0xf822('0x3e')](handleEntityNotFound(_0x449a6b,null))[_0xf822('0x3e')](respondWithResult(_0x449a6b,null))[_0xf822('0x41')](handleError(_0x449a6b,null));};exports[_0xf822('0x47')]=function(_0x19b85e,_0x46d85b){return db[_0xf822('0x3d')][_0xf822('0x47')](_0x19b85e[_0xf822('0x48')],{})['then'](respondWithResult(_0x46d85b,0xc9))[_0xf822('0x41')](handleError(_0x46d85b,null));};exports[_0xf822('0x26')]=function(_0x3a1653,_0x261f06){if(_0x3a1653[_0xf822('0x48')]['id']){delete _0x3a1653[_0xf822('0x48')]['id'];}return db['SugarcrmAccount'][_0xf822('0x46')]({'where':{'id':_0x3a1653['params']['id']}})[_0xf822('0x3e')](handleEntityNotFound(_0x261f06,null))[_0xf822('0x3e')](saveUpdates(_0x3a1653[_0xf822('0x48')],null))[_0xf822('0x3e')](respondWithResult(_0x261f06,null))[_0xf822('0x41')](handleError(_0x261f06,null));};exports[_0xf822('0x27')]=function(_0x2c3c7a,_0xf98973){return db[_0xf822('0x3d')][_0xf822('0x46')]({'where':{'id':_0x2c3c7a['params']['id']}})[_0xf822('0x3e')](handleEntityNotFound(_0xf98973,null))['then'](removeEntity(_0xf98973,null))[_0xf822('0x41')](handleError(_0xf98973,null));};exports[_0xf822('0x49')]=function(_0x225235,_0x5f57c1,_0x4ccfe7){var _0x24a893={};var _0xca5b94={};var _0x7efb4c;var _0x203639;return db[_0xf822('0x3d')][_0xf822('0x4a')]({'where':{'id':_0x225235['params']['id']}})[_0xf822('0x3e')](handleEntityNotFound(_0x5f57c1,null))['then'](function(_0x2178c6){if(_0x2178c6){_0x7efb4c=_0x2178c6;_0xca5b94[_0xf822('0x31')]=_[_0xf822('0x43')](db[_0xf822('0x4b')][_0xf822('0x2d')]);_0xca5b94[_0xf822('0x2e')]=_[_0xf822('0x43')](_0x225235['query']);_0xca5b94[_0xf822('0x2f')]=_[_0xf822('0x30')](_0xca5b94['model'],_0xca5b94[_0xf822('0x2e')]);_0x24a893[_0xf822('0x33')]=_['intersection'](_0xca5b94[_0xf822('0x31')],qs[_0xf822('0x32')](_0x225235['query'][_0xf822('0x32')]));_0x24a893[_0xf822('0x33')]=_0x24a893[_0xf822('0x33')][_0xf822('0x4c')]?_0x24a893['attributes']:_0xca5b94[_0xf822('0x31')];_0x24a893[_0xf822('0x35')]=qs[_0xf822('0x36')](_0x225235[_0xf822('0x2e')]['sort']);_0x24a893['where']=qs[_0xf822('0x2f')](_[_0xf822('0x37')](_0x225235[_0xf822('0x2e')],_0xca5b94['filters']));if(_0x225235[_0xf822('0x2e')][_0xf822('0x38')]){_0x24a893['where']=_[_0xf822('0x3a')](_0x24a893[_0xf822('0x39')],{'$or':_[_0xf822('0x2c')](_0x24a893[_0xf822('0x33')],function(_0x103794){var _0x34991={};_0x34991[_0x103794]={'$like':'%'+_0x225235['query']['filter']+'%'};return _0x34991;})});}_0x24a893=_[_0xf822('0x3a')]({},_0x24a893,_0x225235[_0xf822('0x3c')]);return _0x7efb4c[_0xf822('0x49')](_0x24a893);}})[_0xf822('0x3e')](function(_0x32886c){if(_0x32886c){_0x203639=_0x32886c[_0xf822('0x4c')];if(!_0x225235[_0xf822('0x2e')][_0xf822('0x34')](_0xf822('0x4d'))){_0x24a893[_0xf822('0x20')]=qs[_0xf822('0x20')](_0x225235[_0xf822('0x2e')][_0xf822('0x20')]);_0x24a893[_0xf822('0x22')]=qs[_0xf822('0x22')](_0x225235[_0xf822('0x2e')][_0xf822('0x22')]);}return _0x7efb4c[_0xf822('0x49')](_0x24a893);}})[_0xf822('0x3e')](function(_0xb8b497){if(_0xb8b497){return _0xb8b497?{'count':_0x203639,'rows':_0xb8b497}:null;}})[_0xf822('0x3e')](respondWithResult(_0x5f57c1,null))[_0xf822('0x41')](handleError(_0x5f57c1,null));};exports['addConfiguration']=function(_0xac99a3,_0x4bb67a,_0x2fe7e3){if(_0xac99a3[_0xf822('0x48')]['id']){delete _0xac99a3[_0xf822('0x48')]['id'];}return db[_0xf822('0x3d')][_0xf822('0x4a')]({'where':{'id':_0xac99a3[_0xf822('0x4e')]['id']}})[_0xf822('0x3e')](handleEntityNotFound(_0x4bb67a,null))[_0xf822('0x3e')](function(_0x2ecac3){if(_0x2ecac3){_0xac99a3[_0xf822('0x48')][_0xf822('0x4f')]=_0x2ecac3['id'];_0xac99a3[_0xf822('0x48')][_0xf822('0x50')]=integrations[_0xf822('0x51')](_0xac99a3['body'][_0xf822('0x52')],_0xac99a3[_0xf822('0x48')][_0xf822('0x3b')]);_0xac99a3[_0xf822('0x48')][_0xf822('0x53')]=integrations[_0xf822('0x54')](_0xac99a3[_0xf822('0x48')][_0xf822('0x52')],_0xac99a3[_0xf822('0x48')][_0xf822('0x3b')]);return db[_0xf822('0x4b')][_0xf822('0x47')](_0xac99a3[_0xf822('0x48')],{'include':[{'model':db[_0xf822('0x55')],'as':'Subjects'},{'model':db[_0xf822('0x55')],'as':'Descriptions'}]});}return null;})[_0xf822('0x3e')](respondWithResult(_0x4bb67a,null))[_0xf822('0x41')](handleError(_0x4bb67a,null));};exports[_0xf822('0x56')]=function(_0x5554e5,_0x827a02,_0xa50cd4){var _0x4d93d3='';var _0x25fffe=['id',_0xf822('0x2a'),_0xf822('0x57'),'created_by',_0xf822('0x58'),_0xf822('0x59'),_0xf822('0x5a'),_0xf822('0x5b'),_0xf822('0x5c'),_0xf822('0x5d'),'parent_name','direction'];return db[_0xf822('0x3d')]['findOne']({'where':{'id':_0x5554e5['params']['id']},'attributes':['id',_0xf822('0x5e'),_0xf822('0x5f'),_0xf822('0x60')]})[_0xf822('0x3e')](handleEntityNotFound(_0x827a02,null))[_0xf822('0x3e')](function(_0x59b9b1){if(_0x59b9b1){_0x4d93d3=_0x59b9b1[_0xf822('0x60')];var _0x565caf=_0x4d93d3[_0xf822('0x61')](-0x1);if(_0x565caf==='/'){_0x4d93d3=_0x4d93d3[_0xf822('0x62')](0x0,_0x4d93d3['lastIndexOf'](_0x565caf));}return rp({'method':_0xf822('0x63'),'uri':util[_0xf822('0x64')]('%s%s',_0x4d93d3,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf822('0x65'),'input_type':_0xf822('0x66'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x59b9b1[_0xf822('0x5e')],'password':_0x59b9b1[_0xf822('0x5f')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x46cff1){if(_0x46cff1&&_0x46cff1[_0xf822('0x2a')]!=='Invalid\x20Login'&&_0x46cff1[_0xf822('0x2a')]!=='Password\x20Expired'){return rp({'method':_0xf822('0x63'),'uri':util['format'](_0xf822('0x67'),_0x4d93d3,_0xf822('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xf822('0x66'),'response_type':'JSON','rest_data':JSON[_0xf822('0x69')]({'session':_0x46cff1['id'],'module_name':_0xf822('0x6a')})}})['then'](function(_0x1b3f6c){if(_0x1b3f6c){var _0xda8389=_[_0xf822('0x6b')](_0x1b3f6c['module_fields']);_[_0xf822('0x6c')](_0xda8389,function(_0x2fd595){return _0x25fffe[_0xf822('0x6d')](_0x2fd595[_0xf822('0x2a')]);});return{'count':_0xda8389['length'],'rows':_[_0xf822('0x2c')](_0xda8389,function(_0x18b728){return{'id':_0x18b728['name'],'name':_0x18b728[_0xf822('0x6e')],'custom':_['endsWith'](_0x18b728[_0xf822('0x2a')],'_c')?!![]:![],'options':_0x18b728[_0xf822('0x3c')]?_[_0xf822('0x2c')](_[_0xf822('0x6b')](_0x18b728[_0xf822('0x3c')]),function(_0x1c7076){return{'name':_0x1c7076[_0xf822('0x6f')],'value':_0x1c7076[_0xf822('0x2a')]};}):[]};})};}})[_0xf822('0x3e')](respondWithResult(_0x827a02,null))[_0xf822('0x41')](function(_0x3d7c0c){var _0x39fa95=_0x5554e5[_0xf822('0x2e')][_0xf822('0x70')]?0x1f4:_0x3d7c0c['statusCode']||0x1f4;logger[_0xf822('0x28')](_0xf822('0x71'),_0xf822('0x56'),_0x39fa95,JSON[_0xf822('0x69')](_0x3d7c0c));delete _0x3d7c0c[_0xf822('0x2a')];if(_0x39fa95===0x191){_0x39fa95=0x190;}_0x827a02[_0xf822('0x1d')](_0x39fa95)[_0xf822('0x72')](_0x5554e5[_0xf822('0x2e')]['test']?{'message':_0xf822('0x73'),'statusCode':_0x3d7c0c[_0xf822('0x74')]}:_0x3d7c0c);});}else{var _0x3a72fb=0x1f4;_0x827a02[_0xf822('0x1d')](_0x3a72fb)[_0xf822('0x72')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x1707=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','stack','name','send','index','map','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x43028e,_0x33a648){var _0x2fed6d=function(_0x3d2598){while(--_0x3d2598){_0x43028e['push'](_0x43028e['shift']());}};_0x2fed6d(++_0x33a648);}(_0x1707,0xe5));var _0x7170=function(_0x4e76cc,_0x3be85c){_0x4e76cc=_0x4e76cc-0x0;var _0x1128fa=_0x1707[_0x4e76cc];return _0x1128fa;};'use strict';var emlformat=require(_0x7170('0x0'));var rimraf=require(_0x7170('0x1'));var zipdir=require(_0x7170('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7170('0x3'));var moment=require(_0x7170('0x4'));var BPromise=require(_0x7170('0x5'));var Mustache=require(_0x7170('0x6'));var util=require(_0x7170('0x7'));var path=require(_0x7170('0x8'));var sox=require(_0x7170('0x9'));var csv=require(_0x7170('0xa'));var ejs=require(_0x7170('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7170('0xc'));var squel=require(_0x7170('0xd'));var crypto=require('crypto');var jsforce=require(_0x7170('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7170('0xf'));var Papa=require(_0x7170('0x10'));var Redis=require(_0x7170('0x11'));var authService=require(_0x7170('0x12'));var qs=require(_0x7170('0x13'));var as=require(_0x7170('0x14'));var hardwareService=require(_0x7170('0x15'));var logger=require(_0x7170('0x16'))('api');var utils=require(_0x7170('0x17'));var config=require(_0x7170('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7170('0x19'))['db'];var integrations=require(_0x7170('0x1a'));function respondWithStatusCode(_0x3c00ec,_0x274718){_0x274718=_0x274718||0xcc;return function(_0x4cf518){if(_0x4cf518){return _0x3c00ec[_0x7170('0x1b')](_0x274718);}return _0x3c00ec[_0x7170('0x1c')](_0x274718)[_0x7170('0x1d')]();};}function respondWithResult(_0x24c3a1,_0x5242cd){_0x5242cd=_0x5242cd||0xc8;return function(_0x1f6d88){if(_0x1f6d88){return _0x24c3a1['status'](_0x5242cd)[_0x7170('0x1e')](_0x1f6d88);}};}function respondWithFilteredResult(_0x22cb54,_0xe440b8){return function(_0x3ae527){if(_0x3ae527){var _0x867bc9=typeof _0xe440b8[_0x7170('0x1f')]==='undefined'&&typeof _0xe440b8[_0x7170('0x20')]===_0x7170('0x21');var _0x60ada7=_0x3ae527[_0x7170('0x22')];var _0x13ee0d=_0x867bc9?0x0:_0xe440b8[_0x7170('0x1f')];var _0x592634=_0x867bc9?_0x3ae527[_0x7170('0x22')]:_0xe440b8[_0x7170('0x1f')]+_0xe440b8['limit'];var _0x2c2fb3;if(_0x592634>=_0x60ada7){_0x592634=_0x60ada7;_0x2c2fb3=0xc8;}else{_0x2c2fb3=0xce;}_0x22cb54[_0x7170('0x1c')](_0x2c2fb3);return _0x22cb54[_0x7170('0x23')](_0x7170('0x24'),_0x13ee0d+'-'+_0x592634+'/'+_0x60ada7)[_0x7170('0x1e')](_0x3ae527);}return null;};}function patchUpdates(_0x50aef7){return function(_0x411e82){try{jsonpatch['apply'](_0x411e82,_0x50aef7,!![]);}catch(_0x34cf80){return BPromise[_0x7170('0x25')](_0x34cf80);}return _0x411e82[_0x7170('0x26')]();};}function saveUpdates(_0x16180e,_0xde4ed8){return function(_0x430945){if(_0x430945){return _0x430945[_0x7170('0x27')](_0x16180e)['then'](function(_0x158195){return _0x158195;});}return null;};}function removeEntity(_0x2af42a,_0x1262c7){return function(_0x58d554){if(_0x58d554){return _0x58d554['destroy']()[_0x7170('0x28')](function(){_0x2af42a[_0x7170('0x1c')](0xcc)[_0x7170('0x1d')]();});}};}function handleEntityNotFound(_0x41d00e,_0x52ec40){return function(_0x2bfa08){if(!_0x2bfa08){_0x41d00e[_0x7170('0x1b')](0x194);}return _0x2bfa08;};}function handleError(_0x23e5ae,_0x20c643){_0x20c643=_0x20c643||0x1f4;return function(_0x214023){logger['error'](_0x214023[_0x7170('0x29')]);if(_0x214023[_0x7170('0x2a')]){delete _0x214023[_0x7170('0x2a')];}_0x23e5ae[_0x7170('0x1c')](_0x20c643)[_0x7170('0x2b')](_0x214023);};}exports[_0x7170('0x2c')]=function(_0x3f5065,_0x43316f){var _0x2c8119={},_0x571fa5={},_0x27eb2a={'count':0x0,'rows':[]};var _0x4380f6=_[_0x7170('0x2d')](db['SugarcrmAccount']['rawAttributes'],function(_0x6c5b43){return{'name':_0x6c5b43['fieldName'],'type':_0x6c5b43[_0x7170('0x2e')][_0x7170('0x2f')]};});_0x571fa5['model']=_['map'](_0x4380f6,_0x7170('0x2a'));_0x571fa5[_0x7170('0x30')]=_['keys'](_0x3f5065[_0x7170('0x30')]);_0x571fa5[_0x7170('0x31')]=_[_0x7170('0x32')](_0x571fa5[_0x7170('0x33')],_0x571fa5[_0x7170('0x30')]);_0x2c8119['attributes']=_[_0x7170('0x32')](_0x571fa5['model'],qs[_0x7170('0x34')](_0x3f5065[_0x7170('0x30')][_0x7170('0x34')]));_0x2c8119[_0x7170('0x35')]=_0x2c8119[_0x7170('0x35')][_0x7170('0x36')]?_0x2c8119[_0x7170('0x35')]:_0x571fa5[_0x7170('0x33')];if(!_0x3f5065[_0x7170('0x30')][_0x7170('0x37')](_0x7170('0x38'))){_0x2c8119[_0x7170('0x20')]=qs[_0x7170('0x20')](_0x3f5065[_0x7170('0x30')][_0x7170('0x20')]);_0x2c8119[_0x7170('0x1f')]=qs[_0x7170('0x1f')](_0x3f5065[_0x7170('0x30')]['offset']);}_0x2c8119[_0x7170('0x39')]=qs[_0x7170('0x3a')](_0x3f5065[_0x7170('0x30')][_0x7170('0x3a')]);_0x2c8119['where']=qs[_0x7170('0x31')](_[_0x7170('0x3b')](_0x3f5065[_0x7170('0x30')],_0x571fa5[_0x7170('0x31')]),_0x4380f6);if(_0x3f5065[_0x7170('0x30')]['filter']){_0x2c8119[_0x7170('0x3c')]=_[_0x7170('0x3d')](_0x2c8119[_0x7170('0x3c')],{'$or':_[_0x7170('0x2d')](_0x4380f6,function(_0x416963){if(_0x416963['type']!=='VIRTUAL'){var _0x22cf7c={};_0x22cf7c[_0x416963['name']]={'$like':'%'+_0x3f5065[_0x7170('0x30')][_0x7170('0x3e')]+'%'};return _0x22cf7c;}})});}_0x2c8119=_['merge']({},_0x2c8119,_0x3f5065[_0x7170('0x3f')]);var _0x387b0f={'where':_0x2c8119[_0x7170('0x3c')]};return db[_0x7170('0x40')][_0x7170('0x22')](_0x387b0f)[_0x7170('0x28')](function(_0x5972fc){_0x27eb2a[_0x7170('0x22')]=_0x5972fc;if(_0x3f5065[_0x7170('0x30')][_0x7170('0x41')]){_0x2c8119[_0x7170('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x7170('0x43')](_0x2c8119);})[_0x7170('0x28')](function(_0x52d1b3){_0x27eb2a[_0x7170('0x44')]=_0x52d1b3;return _0x27eb2a;})['then'](respondWithFilteredResult(_0x43316f,_0x2c8119))[_0x7170('0x45')](handleError(_0x43316f,null));};exports[_0x7170('0x46')]=function(_0x2a9650,_0x2216f2){var _0x5c6fae={'raw':![],'where':{'id':_0x2a9650[_0x7170('0x47')]['id']}},_0x3de148={};_0x3de148['model']=_['keys'](db[_0x7170('0x40')][_0x7170('0x48')]);_0x3de148[_0x7170('0x30')]=_[_0x7170('0x49')](_0x2a9650[_0x7170('0x30')]);_0x3de148[_0x7170('0x31')]=_[_0x7170('0x32')](_0x3de148['model'],_0x3de148[_0x7170('0x30')]);_0x5c6fae[_0x7170('0x35')]=_['intersection'](_0x3de148[_0x7170('0x33')],qs[_0x7170('0x34')](_0x2a9650[_0x7170('0x30')][_0x7170('0x34')]));_0x5c6fae[_0x7170('0x35')]=_0x5c6fae[_0x7170('0x35')][_0x7170('0x36')]?_0x5c6fae['attributes']:_0x3de148[_0x7170('0x33')];if(_0x2a9650[_0x7170('0x30')]['includeAll']){_0x5c6fae[_0x7170('0x42')]=[{'all':!![]}];}_0x5c6fae=_[_0x7170('0x3d')]({},_0x5c6fae,_0x2a9650[_0x7170('0x3f')]);return db[_0x7170('0x40')][_0x7170('0x4a')](_0x5c6fae)[_0x7170('0x28')](handleEntityNotFound(_0x2216f2,null))[_0x7170('0x28')](respondWithResult(_0x2216f2,null))[_0x7170('0x45')](handleError(_0x2216f2,null));};exports[_0x7170('0x4b')]=function(_0xeaf4d8,_0x44b31c){return db[_0x7170('0x40')][_0x7170('0x4b')](_0xeaf4d8[_0x7170('0x4c')],{})['then'](respondWithResult(_0x44b31c,0xc9))[_0x7170('0x45')](handleError(_0x44b31c,null));};exports[_0x7170('0x27')]=function(_0x1c4997,_0x4ffe57){if(_0x1c4997[_0x7170('0x4c')]['id']){delete _0x1c4997[_0x7170('0x4c')]['id'];}return db[_0x7170('0x40')][_0x7170('0x4a')]({'where':{'id':_0x1c4997[_0x7170('0x47')]['id']}})[_0x7170('0x28')](handleEntityNotFound(_0x4ffe57,null))[_0x7170('0x28')](saveUpdates(_0x1c4997[_0x7170('0x4c')],null))[_0x7170('0x28')](respondWithResult(_0x4ffe57,null))[_0x7170('0x45')](handleError(_0x4ffe57,null));};exports[_0x7170('0x4d')]=function(_0x7db1cc,_0x1454a7){return db['SugarcrmAccount'][_0x7170('0x4a')]({'where':{'id':_0x7db1cc['params']['id']}})[_0x7170('0x28')](handleEntityNotFound(_0x1454a7,null))[_0x7170('0x28')](removeEntity(_0x1454a7,null))['catch'](handleError(_0x1454a7,null));};exports[_0x7170('0x4e')]=function(_0x270301,_0x25573b,_0x4ed796){var _0xefffd2={};var _0x16ab61={};var _0x33c11c;var _0x1faa3e;return db[_0x7170('0x40')][_0x7170('0x4f')]({'where':{'id':_0x270301[_0x7170('0x47')]['id']}})[_0x7170('0x28')](handleEntityNotFound(_0x25573b,null))['then'](function(_0x4b8e3a){if(_0x4b8e3a){_0x33c11c=_0x4b8e3a;_0x16ab61[_0x7170('0x33')]=_[_0x7170('0x49')](db[_0x7170('0x50')][_0x7170('0x48')]);_0x16ab61[_0x7170('0x30')]=_[_0x7170('0x49')](_0x270301['query']);_0x16ab61[_0x7170('0x31')]=_['intersection'](_0x16ab61[_0x7170('0x33')],_0x16ab61[_0x7170('0x30')]);_0xefffd2[_0x7170('0x35')]=_[_0x7170('0x32')](_0x16ab61[_0x7170('0x33')],qs[_0x7170('0x34')](_0x270301[_0x7170('0x30')]['fields']));_0xefffd2[_0x7170('0x35')]=_0xefffd2[_0x7170('0x35')][_0x7170('0x36')]?_0xefffd2[_0x7170('0x35')]:_0x16ab61[_0x7170('0x33')];_0xefffd2['order']=qs[_0x7170('0x3a')](_0x270301[_0x7170('0x30')]['sort']);_0xefffd2[_0x7170('0x3c')]=qs[_0x7170('0x31')](_[_0x7170('0x3b')](_0x270301['query'],_0x16ab61[_0x7170('0x31')]));if(_0x270301[_0x7170('0x30')][_0x7170('0x3e')]){_0xefffd2[_0x7170('0x3c')]=_[_0x7170('0x3d')](_0xefffd2[_0x7170('0x3c')],{'$or':_['map'](_0xefffd2[_0x7170('0x35')],function(_0x5090ba){var _0x428989={};_0x428989[_0x5090ba]={'$like':'%'+_0x270301[_0x7170('0x30')]['filter']+'%'};return _0x428989;})});}_0xefffd2=_[_0x7170('0x3d')]({},_0xefffd2,_0x270301[_0x7170('0x3f')]);return _0x33c11c['getConfigurations'](_0xefffd2);}})[_0x7170('0x28')](function(_0x2b1e60){if(_0x2b1e60){_0x1faa3e=_0x2b1e60[_0x7170('0x36')];if(!_0x270301[_0x7170('0x30')][_0x7170('0x37')](_0x7170('0x38'))){_0xefffd2[_0x7170('0x20')]=qs[_0x7170('0x20')](_0x270301[_0x7170('0x30')][_0x7170('0x20')]);_0xefffd2[_0x7170('0x1f')]=qs[_0x7170('0x1f')](_0x270301['query'][_0x7170('0x1f')]);}return _0x33c11c[_0x7170('0x4e')](_0xefffd2);}})[_0x7170('0x28')](function(_0xe1b04){if(_0xe1b04){return _0xe1b04?{'count':_0x1faa3e,'rows':_0xe1b04}:null;}})[_0x7170('0x28')](respondWithResult(_0x25573b,null))[_0x7170('0x45')](handleError(_0x25573b,null));};exports[_0x7170('0x51')]=function(_0x369610,_0x546e10,_0x491712){if(_0x369610['body']['id']){delete _0x369610[_0x7170('0x4c')]['id'];}return db['SugarcrmAccount'][_0x7170('0x4f')]({'where':{'id':_0x369610[_0x7170('0x47')]['id']}})['then'](handleEntityNotFound(_0x546e10,null))[_0x7170('0x28')](function(_0x436da3){if(_0x436da3){_0x369610[_0x7170('0x4c')]['AccountId']=_0x436da3['id'];_0x369610[_0x7170('0x4c')][_0x7170('0x52')]=integrations[_0x7170('0x53')](_0x369610[_0x7170('0x4c')]['channel'],_0x369610[_0x7170('0x4c')]['type']);_0x369610[_0x7170('0x4c')][_0x7170('0x54')]=integrations[_0x7170('0x55')](_0x369610[_0x7170('0x4c')]['channel'],_0x369610[_0x7170('0x4c')][_0x7170('0x2e')]);return db[_0x7170('0x50')]['create'](_0x369610[_0x7170('0x4c')],{'include':[{'model':db[_0x7170('0x56')],'as':'Subjects'},{'model':db[_0x7170('0x56')],'as':_0x7170('0x54')}]});}return null;})[_0x7170('0x28')](respondWithResult(_0x546e10,null))[_0x7170('0x45')](handleError(_0x546e10,null));};exports[_0x7170('0x57')]=function(_0x3284e1,_0x20adf6,_0x1813ed){var _0x5b9f5b='';var _0xcc12cb=['id',_0x7170('0x2a'),_0x7170('0x58'),_0x7170('0x59'),_0x7170('0x5a'),_0x7170('0x5b'),_0x7170('0x5c'),_0x7170('0x5d'),_0x7170('0x5e'),_0x7170('0x5f'),_0x7170('0x60'),'direction'];return db[_0x7170('0x40')][_0x7170('0x4f')]({'where':{'id':_0x3284e1[_0x7170('0x47')]['id']},'attributes':['id',_0x7170('0x61'),_0x7170('0x62'),'remoteUri']})[_0x7170('0x28')](handleEntityNotFound(_0x20adf6,null))[_0x7170('0x28')](function(_0x472f63){if(_0x472f63){_0x5b9f5b=_0x472f63['remoteUri'];var _0x5cfa0c=_0x5b9f5b[_0x7170('0x63')](-0x1);if(_0x5cfa0c==='/'){_0x5b9f5b=_0x5b9f5b[_0x7170('0x64')](0x0,_0x5b9f5b[_0x7170('0x65')](_0x5cfa0c));}return rp({'method':_0x7170('0x66'),'uri':util[_0x7170('0x67')](_0x7170('0x68'),_0x5b9f5b,_0x7170('0x69')),'json':!![],'form':{'method':_0x7170('0x6a'),'input_type':'JSON','response_type':_0x7170('0x6b'),'rest_data':JSON[_0x7170('0x6c')]({'user_auth':{'user_name':_0x472f63['username'],'password':_0x472f63[_0x7170('0x62')],'encryption':_0x7170('0x6d')},'application':_0x7170('0x6e')})}});}})[_0x7170('0x28')](function(_0x29311f){if(_0x29311f&&_0x29311f['name']!==_0x7170('0x6f')&&_0x29311f['name']!=='Password\x20Expired'){return rp({'method':_0x7170('0x66'),'uri':util[_0x7170('0x67')]('%s%s',_0x5b9f5b,_0x7170('0x69')),'json':!![],'form':{'method':_0x7170('0x70'),'input_type':_0x7170('0x6b'),'response_type':_0x7170('0x6b'),'rest_data':JSON[_0x7170('0x6c')]({'session':_0x29311f['id'],'module_name':_0x7170('0x71')})}})['then'](function(_0x236b26){if(_0x236b26){var _0x3881fa=_[_0x7170('0x72')](_0x236b26[_0x7170('0x73')]);_[_0x7170('0x74')](_0x3881fa,function(_0x59d24a){return _0xcc12cb[_0x7170('0x75')](_0x59d24a[_0x7170('0x2a')]);});return{'count':_0x3881fa[_0x7170('0x36')],'rows':_['map'](_0x3881fa,function(_0x2ef73d){return{'id':_0x2ef73d['name'],'name':_0x2ef73d[_0x7170('0x76')],'custom':_[_0x7170('0x77')](_0x2ef73d[_0x7170('0x2a')],'_c')?!![]:![],'options':_0x2ef73d[_0x7170('0x3f')]?_[_0x7170('0x2d')](_[_0x7170('0x72')](_0x2ef73d[_0x7170('0x3f')]),function(_0x450138){return{'name':_0x450138[_0x7170('0x78')],'value':_0x450138[_0x7170('0x2a')]};}):[]};})};}})['then'](respondWithResult(_0x20adf6,null))[_0x7170('0x45')](function(_0x11a225){var _0x16bdb3=_0x3284e1[_0x7170('0x30')][_0x7170('0x79')]?0x1f4:_0x11a225['statusCode']||0x1f4;logger[_0x7170('0x7a')](_0x7170('0x7b'),_0x7170('0x57'),_0x16bdb3,JSON[_0x7170('0x6c')](_0x11a225));delete _0x11a225[_0x7170('0x2a')];if(_0x16bdb3===0x191){_0x16bdb3=0x190;}_0x20adf6['status'](_0x16bdb3)['send'](_0x3284e1[_0x7170('0x30')]['test']?{'message':_0x7170('0x7c'),'statusCode':_0x11a225[_0x7170('0x7d')]}:_0x11a225);});}else{var _0x435052=0x1f4;_0x20adf6[_0x7170('0x1c')](_0x435052)[_0x7170('0x2b')]({'message':_0x7170('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 645fac7..e46d6e3 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58e4=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x58e4,0x157));var _0x458e=function(_0x54c068,_0x28a2a9){_0x54c068=_0x54c068-0x0;var _0x471875=_0x58e4[_0x54c068];return _0x471875;};'use strict';var _=require(_0x458e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x458e('0x1'));var moment=require(_0x458e('0x2'));var BPromise=require('bluebird');var rp=require(_0x458e('0x3'));var fs=require('fs');var path=require(_0x458e('0x4'));var rimraf=require(_0x458e('0x5'));var config=require(_0x458e('0x6'));var attributes=require(_0x458e('0x7'));var integrations=require(_0x458e('0x8'));module[_0x458e('0x9')]=function(_0x7a7231,_0x18698b){return _0x7a7231[_0x458e('0xa')](_0x458e('0xb'),attributes,{'tableName':_0x458e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc428=['SugarcrmAccount','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x1d2aa7,_0x11fadf){var _0x41377d=function(_0x57cd74){while(--_0x57cd74){_0x1d2aa7['push'](_0x1d2aa7['shift']());}};_0x41377d(++_0x11fadf);}(_0xc428,0x85));var _0x8c42=function(_0x15a068,_0x38c286){_0x15a068=_0x15a068-0x0;var _0x38a606=_0xc428[_0x15a068];return _0x38a606;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8c42('0x0'));var moment=require(_0x8c42('0x1'));var BPromise=require(_0x8c42('0x2'));var rp=require(_0x8c42('0x3'));var fs=require('fs');var path=require(_0x8c42('0x4'));var rimraf=require(_0x8c42('0x5'));var config=require(_0x8c42('0x6'));var attributes=require(_0x8c42('0x7'));var integrations=require(_0x8c42('0x8'));module[_0x8c42('0x9')]=function(_0x10d339,_0x342230){return _0x10d339[_0x8c42('0xa')](_0x8c42('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index ccac28c..64da055 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb25=['../../config/environment','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','include','model','attributes','map','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b2377,_0x1be5c4){var _0x4defd8=function(_0x1d21f0){while(--_0x1d21f0){_0x3b2377['push'](_0x3b2377['shift']());}};_0x4defd8(++_0x1be5c4);}(_0xeb25,0x1f0));var _0x5eb2=function(_0x28a384,_0x557287){_0x28a384=_0x28a384-0x0;var _0xe92a47=_0xeb25[_0x28a384];return _0xe92a47;};'use strict';var _=require(_0x5eb2('0x0'));var util=require(_0x5eb2('0x1'));var moment=require(_0x5eb2('0x2'));var BPromise=require('bluebird');var rs=require(_0x5eb2('0x3'));var fs=require('fs');var Redis=require(_0x5eb2('0x4'));var db=require(_0x5eb2('0x5'))['db'];var utils=require(_0x5eb2('0x6'));var logger=require(_0x5eb2('0x7'))('rpc');var config=require(_0x5eb2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5eb2('0x9')][_0x5eb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493f23,_0xc5e64c,_0x48e3a4){return new BPromise(function(_0x1e1827,_0x440f25){return client[_0x5eb2('0xb')](_0x493f23,_0x48e3a4)[_0x5eb2('0xc')](function(_0x266105){logger[_0x5eb2('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0xc5e64c,_0x5eb2('0xe'));logger[_0x5eb2('0xf')](_0x5eb2('0x10'),_0xc5e64c,'request\x20sent',JSON[_0x5eb2('0x11')](_0x266105));if(_0x266105['error']){if(_0x266105[_0x5eb2('0x12')][_0x5eb2('0x13')]===0x1f4){logger['error'](_0x5eb2('0x14'),_0xc5e64c,_0x266105['error']['message']);return _0x440f25(_0x266105['error'][_0x5eb2('0x15')]);}logger['error'](_0x5eb2('0x14'),_0xc5e64c,_0x266105[_0x5eb2('0x12')]['message']);return _0x1e1827(_0x266105[_0x5eb2('0x12')][_0x5eb2('0x15')]);}else{logger[_0x5eb2('0xd')](_0x5eb2('0x14'),_0xc5e64c,_0x5eb2('0xe'));_0x1e1827(_0x266105[_0x5eb2('0x16')][_0x5eb2('0x15')]);}})[_0x5eb2('0x17')](function(_0x39f86a){logger['error'](_0x5eb2('0x14'),_0xc5e64c,_0x39f86a);_0x440f25(_0x39f86a);});});}exports[_0x5eb2('0x18')]=function(_0x3a611e){var _0x47edb4=this;return new Promise(function(_0x5b0829,_0x3ccdb6){return db[_0x5eb2('0x19')][_0x5eb2('0x1a')]({'raw':_0x3a611e[_0x5eb2('0x1b')]?_0x3a611e[_0x5eb2('0x1b')][_0x5eb2('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a611e[_0x5eb2('0x1b')]?_0x3a611e[_0x5eb2('0x1b')][_0x5eb2('0x1d')]||null:null,'attributes':_0x3a611e[_0x5eb2('0x1b')]?_0x3a611e[_0x5eb2('0x1b')]['attributes']||null:null,'limit':_0x3a611e['options']?_0x3a611e[_0x5eb2('0x1b')]['limit']||null:null,'include':_0x3a611e['options']?_0x3a611e[_0x5eb2('0x1b')][_0x5eb2('0x1e')]?_['map'](_0x3a611e[_0x5eb2('0x1b')][_0x5eb2('0x1e')],function(_0x17f92c){return{'model':db[_0x17f92c['model']],'as':_0x17f92c['as'],'attributes':_0x17f92c['attributes'],'include':_0x17f92c[_0x5eb2('0x1e')]?_['map'](_0x17f92c[_0x5eb2('0x1e')],function(_0xd339ec){return{'model':db[_0xd339ec[_0x5eb2('0x1f')]],'as':_0xd339ec['as'],'attributes':_0xd339ec[_0x5eb2('0x20')],'include':_0xd339ec[_0x5eb2('0x1e')]?_[_0x5eb2('0x21')](_0xd339ec['include'],function(_0x220a35){return{'model':db[_0x220a35[_0x5eb2('0x1f')]],'as':_0x220a35['as'],'attributes':_0x220a35[_0x5eb2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5eb2('0xc')](function(_0xa8062a){logger[_0x5eb2('0xd')](_0x5eb2('0x18'),_0x3a611e);logger[_0x5eb2('0xf')](_0x5eb2('0x18'),_0x3a611e,JSON[_0x5eb2('0x11')](_0xa8062a));_0x5b0829(_0xa8062a);})[_0x5eb2('0x17')](function(_0x11034c){logger[_0x5eb2('0x12')](_0x5eb2('0x18'),_0x11034c[_0x5eb2('0x15')],_0x3a611e);_0x3ccdb6(_0x47edb4[_0x5eb2('0x12')](0x1f4,_0x11034c[_0x5eb2('0x15')]));});});};exports[_0x5eb2('0x22')]=function(_0x1b2753){var _0x1c3bdf=this;return new Promise(function(_0x40814b,_0x450bf8){return db[_0x5eb2('0x19')][_0x5eb2('0x23')]({'raw':_0x1b2753[_0x5eb2('0x1b')]?_0x1b2753[_0x5eb2('0x1b')][_0x5eb2('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b2753[_0x5eb2('0x1b')]?_0x1b2753[_0x5eb2('0x1b')]['where']||null:null,'attributes':_0x1b2753[_0x5eb2('0x1b')]?_0x1b2753[_0x5eb2('0x1b')][_0x5eb2('0x20')]||null:null,'include':_0x1b2753['options']?_0x1b2753[_0x5eb2('0x1b')][_0x5eb2('0x1e')]?_['map'](_0x1b2753[_0x5eb2('0x1b')][_0x5eb2('0x1e')],function(_0x4eacb0){return{'model':db[_0x4eacb0[_0x5eb2('0x1f')]],'as':_0x4eacb0['as'],'attributes':_0x4eacb0['attributes'],'include':_0x4eacb0[_0x5eb2('0x1e')]?_[_0x5eb2('0x21')](_0x4eacb0[_0x5eb2('0x1e')],function(_0x6ed481){return{'model':db[_0x6ed481['model']],'as':_0x6ed481['as'],'attributes':_0x6ed481[_0x5eb2('0x20')],'include':_0x6ed481[_0x5eb2('0x1e')]?_['map'](_0x6ed481[_0x5eb2('0x1e')],function(_0x3885f8){return{'model':db[_0x3885f8[_0x5eb2('0x1f')]],'as':_0x3885f8['as'],'attributes':_0x3885f8[_0x5eb2('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x252a41){logger[_0x5eb2('0xd')](_0x5eb2('0x22'),_0x1b2753);logger[_0x5eb2('0xf')](_0x5eb2('0x22'),_0x1b2753,JSON[_0x5eb2('0x11')](_0x252a41));_0x40814b(_0x252a41);})[_0x5eb2('0x17')](function(_0x195a16){logger[_0x5eb2('0x12')]('ShowSugarcrmAccount',_0x195a16[_0x5eb2('0x15')],_0x1b2753);_0x450bf8(_0x1c3bdf[_0x5eb2('0x12')](0x1f4,_0x195a16[_0x5eb2('0x15')]));});});}; \ No newline at end of file +var _0xb161=['request\x20sent','debug','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','limit','include','map','model','attributes','then','ShowSugarcrmAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x23b57c,_0xdc7f98){var _0x4c3b1d=function(_0x283147){while(--_0x283147){_0x23b57c['push'](_0x23b57c['shift']());}};_0x4c3b1d(++_0xdc7f98);}(_0xb161,0x146));var _0x1b16=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xb161[_0x3e8270];return _0x1ccde9;};'use strict';var _=require('lodash');var util=require(_0x1b16('0x0'));var moment=require(_0x1b16('0x1'));var BPromise=require(_0x1b16('0x2'));var rs=require(_0x1b16('0x3'));var fs=require('fs');var Redis=require(_0x1b16('0x4'));var db=require(_0x1b16('0x5'))['db'];var utils=require(_0x1b16('0x6'));var logger=require(_0x1b16('0x7'))(_0x1b16('0x8'));var config=require('../../config/environment');var jayson=require(_0x1b16('0x9'));var client=jayson[_0x1b16('0xa')][_0x1b16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a5141,_0x40e7e6,_0xd0a723){return new BPromise(function(_0x785c74,_0x1560f9){return client['request'](_0x1a5141,_0xd0a723)['then'](function(_0x47d01a){logger[_0x1b16('0xc')](_0x1b16('0xd'),_0x40e7e6,_0x1b16('0xe'));logger[_0x1b16('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x40e7e6,'request\x20sent',JSON[_0x1b16('0x10')](_0x47d01a));if(_0x47d01a[_0x1b16('0x11')]){if(_0x47d01a['error'][_0x1b16('0x12')]===0x1f4){logger[_0x1b16('0x11')](_0x1b16('0xd'),_0x40e7e6,_0x47d01a[_0x1b16('0x11')][_0x1b16('0x13')]);return _0x1560f9(_0x47d01a[_0x1b16('0x11')][_0x1b16('0x13')]);}logger[_0x1b16('0x11')](_0x1b16('0xd'),_0x40e7e6,_0x47d01a[_0x1b16('0x11')][_0x1b16('0x13')]);return _0x785c74(_0x47d01a['error']['message']);}else{logger[_0x1b16('0xc')](_0x1b16('0xd'),_0x40e7e6,_0x1b16('0xe'));_0x785c74(_0x47d01a['result'][_0x1b16('0x13')]);}})[_0x1b16('0x14')](function(_0x2f6ff0){logger[_0x1b16('0x11')](_0x1b16('0xd'),_0x40e7e6,_0x2f6ff0);_0x1560f9(_0x2f6ff0);});});}exports[_0x1b16('0x15')]=function(_0x2808b7){var _0x186695=this;return new Promise(function(_0x43ea67,_0xb9d8a1){return db[_0x1b16('0x16')]['findAll']({'raw':_0x2808b7['options']?_0x2808b7[_0x1b16('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2808b7[_0x1b16('0x17')]?_0x2808b7[_0x1b16('0x17')][_0x1b16('0x18')]||null:null,'attributes':_0x2808b7[_0x1b16('0x17')]?_0x2808b7['options']['attributes']||null:null,'limit':_0x2808b7[_0x1b16('0x17')]?_0x2808b7['options'][_0x1b16('0x19')]||null:null,'include':_0x2808b7[_0x1b16('0x17')]?_0x2808b7[_0x1b16('0x17')][_0x1b16('0x1a')]?_[_0x1b16('0x1b')](_0x2808b7[_0x1b16('0x17')][_0x1b16('0x1a')],function(_0x21f83f){return{'model':db[_0x21f83f[_0x1b16('0x1c')]],'as':_0x21f83f['as'],'attributes':_0x21f83f[_0x1b16('0x1d')],'include':_0x21f83f['include']?_['map'](_0x21f83f[_0x1b16('0x1a')],function(_0x450604){return{'model':db[_0x450604['model']],'as':_0x450604['as'],'attributes':_0x450604['attributes'],'include':_0x450604['include']?_[_0x1b16('0x1b')](_0x450604['include'],function(_0x32be3f){return{'model':db[_0x32be3f[_0x1b16('0x1c')]],'as':_0x32be3f['as'],'attributes':_0x32be3f[_0x1b16('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1b16('0x1e')](function(_0x1d0e75){logger[_0x1b16('0xc')](_0x1b16('0x15'),_0x2808b7);logger[_0x1b16('0xf')](_0x1b16('0x15'),_0x2808b7,JSON[_0x1b16('0x10')](_0x1d0e75));_0x43ea67(_0x1d0e75);})[_0x1b16('0x14')](function(_0x32f986){logger[_0x1b16('0x11')](_0x1b16('0x15'),_0x32f986['message'],_0x2808b7);_0xb9d8a1(_0x186695[_0x1b16('0x11')](0x1f4,_0x32f986[_0x1b16('0x13')]));});});};exports[_0x1b16('0x1f')]=function(_0x84402e){var _0x4c0f6a=this;return new Promise(function(_0x16a680,_0x5e9e61){return db[_0x1b16('0x16')][_0x1b16('0x20')]({'raw':_0x84402e[_0x1b16('0x17')]?_0x84402e['options'][_0x1b16('0x21')]===undefined?!![]:![]:!![],'where':_0x84402e[_0x1b16('0x17')]?_0x84402e[_0x1b16('0x17')][_0x1b16('0x18')]||null:null,'attributes':_0x84402e[_0x1b16('0x17')]?_0x84402e['options'][_0x1b16('0x1d')]||null:null,'include':_0x84402e['options']?_0x84402e[_0x1b16('0x17')][_0x1b16('0x1a')]?_[_0x1b16('0x1b')](_0x84402e['options'][_0x1b16('0x1a')],function(_0x231b51){return{'model':db[_0x231b51[_0x1b16('0x1c')]],'as':_0x231b51['as'],'attributes':_0x231b51[_0x1b16('0x1d')],'include':_0x231b51[_0x1b16('0x1a')]?_['map'](_0x231b51[_0x1b16('0x1a')],function(_0x2c90e5){return{'model':db[_0x2c90e5[_0x1b16('0x1c')]],'as':_0x2c90e5['as'],'attributes':_0x2c90e5[_0x1b16('0x1d')],'include':_0x2c90e5[_0x1b16('0x1a')]?_[_0x1b16('0x1b')](_0x2c90e5['include'],function(_0x5222f2){return{'model':db[_0x5222f2['model']],'as':_0x5222f2['as'],'attributes':_0x5222f2[_0x1b16('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1b16('0x1e')](function(_0x2ae3dc){logger['info'](_0x1b16('0x1f'),_0x84402e);logger[_0x1b16('0xf')](_0x1b16('0x1f'),_0x84402e,JSON[_0x1b16('0x10')](_0x2ae3dc));_0x16a680(_0x2ae3dc);})[_0x1b16('0x14')](function(_0x55bcd8){logger[_0x1b16('0x11')]('ShowSugarcrmAccount',_0x55bcd8[_0x1b16('0x13')],_0x84402e);_0x5e9e61(_0x4c0f6a[_0x1b16('0x11')](0x1f4,_0x55bcd8['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a8a9e93..fe28a9e 100644 --- a/server/api/intSugarcrmConfiguration/index.js +++ b/server/api/intSugarcrmConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1fa=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','destroy','multer'];(function(_0x5e8c0f,_0x1f20d9){var _0x568dbe=function(_0xdc6797){while(--_0xdc6797){_0x5e8c0f['push'](_0x5e8c0f['shift']());}};_0x568dbe(++_0x1f20d9);}(_0xa1fa,0x149));var _0xaa1f=function(_0x438491,_0x41aa11){_0x438491=_0x438491-0x0;var _0x5c1b1a=_0xa1fa[_0x438491];return _0x5c1b1a;};'use strict';var multer=require(_0xaa1f('0x0'));var util=require(_0xaa1f('0x1'));var path=require(_0xaa1f('0x2'));var timeout=require(_0xaa1f('0x3'));var express=require(_0xaa1f('0x4'));var router=express[_0xaa1f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaa1f('0x6'));var interaction=require(_0xaa1f('0x7'));var config=require(_0xaa1f('0x8'));var controller=require(_0xaa1f('0x9'));router[_0xaa1f('0xa')]('/',auth[_0xaa1f('0xb')](),controller[_0xaa1f('0xc')]);router['get']('/:id',auth[_0xaa1f('0xb')](),controller[_0xaa1f('0xd')]);router[_0xaa1f('0xa')](_0xaa1f('0xe'),auth[_0xaa1f('0xb')](),controller['getFields']);router['get'](_0xaa1f('0xf'),auth[_0xaa1f('0xb')](),controller['getSubjects']);router[_0xaa1f('0xa')](_0xaa1f('0x10'),auth[_0xaa1f('0xb')](),controller[_0xaa1f('0x11')]);router[_0xaa1f('0x12')]('/',auth[_0xaa1f('0xb')](),controller[_0xaa1f('0x13')]);router['put'](_0xaa1f('0x14'),auth[_0xaa1f('0xb')](),controller['update']);router['delete'](_0xaa1f('0x14'),auth[_0xaa1f('0xb')](),controller[_0xaa1f('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6688=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields'];(function(_0x19392f,_0x42723a){var _0x5d30fb=function(_0x44ee29){while(--_0x44ee29){_0x19392f['push'](_0x19392f['shift']());}};_0x5d30fb(++_0x42723a);}(_0x6688,0x81));var _0x8668=function(_0x4b1310,_0x406423){_0x4b1310=_0x4b1310-0x0;var _0xd92d54=_0x6688[_0x4b1310];return _0xd92d54;};'use strict';var multer=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var path=require(_0x8668('0x2'));var timeout=require('connect-timeout');var express=require(_0x8668('0x3'));var router=express[_0x8668('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8668('0x5'));var interaction=require(_0x8668('0x6'));var config=require(_0x8668('0x7'));var controller=require(_0x8668('0x8'));router[_0x8668('0x9')]('/',auth['isAuthenticated'](),controller[_0x8668('0xa')]);router['get'](_0x8668('0xb'),auth[_0x8668('0xc')](),controller[_0x8668('0xd')]);router[_0x8668('0x9')](_0x8668('0xe'),auth[_0x8668('0xc')](),controller[_0x8668('0xf')]);router[_0x8668('0x9')](_0x8668('0x10'),auth[_0x8668('0xc')](),controller['getSubjects']);router[_0x8668('0x9')](_0x8668('0x11'),auth['isAuthenticated'](),controller[_0x8668('0x12')]);router[_0x8668('0x13')]('/',auth[_0x8668('0xc')](),controller[_0x8668('0x14')]);router['put'](_0x8668('0xb'),auth[_0x8668('0xc')](),controller['update']);router[_0x8668('0x15')](_0x8668('0xb'),auth[_0x8668('0xc')](),controller[_0x8668('0x16')]);module[_0x8668('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 132acc7..8515494 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8cd=['sequelize','exports','STRING'];(function(_0x444a3d,_0xe49902){var _0x1838d7=function(_0x212365){while(--_0x212365){_0x444a3d['push'](_0x444a3d['shift']());}};_0x1838d7(++_0xe49902);}(_0xc8cd,0x81));var _0xdc8c=function(_0x406e3f,_0x52d3ef){_0x406e3f=_0x406e3f-0x0;var _0x4f4379=_0xc8cd[_0x406e3f];return _0x4f4379;};'use strict';var Sequelize=require(_0xdc8c('0x0'));module[_0xdc8c('0x1')]={'name':{'type':Sequelize[_0xdc8c('0x2')]},'description':{'type':Sequelize[_0xdc8c('0x2')]}}; \ No newline at end of file +var _0x0998=['STRING','sequelize','exports'];(function(_0x2d7d79,_0x1fb4c1){var _0x1ae372=function(_0x4b16ed){while(--_0x4b16ed){_0x2d7d79['push'](_0x2d7d79['shift']());}};_0x1ae372(++_0x1fb4c1);}(_0x0998,0x64));var _0x8099=function(_0x3a7768,_0x51d14e){_0x3a7768=_0x3a7768-0x0;var _0x48fe62=_0x0998[_0x3a7768];return _0x48fe62;};'use strict';var Sequelize=require(_0x8099('0x0'));module[_0x8099('0x1')]={'name':{'type':Sequelize[_0x8099('0x2')]},'description':{'type':Sequelize[_0x8099('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 10e99bf..ca3f294 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc91b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','update','body','getFields','SugarcrmField','rawAttributes','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse'];(function(_0x2278a8,_0x9b40d5){var _0x234902=function(_0x44c51c){while(--_0x44c51c){_0x2278a8['push'](_0x2278a8['shift']());}};_0x234902(++_0x9b40d5);}(_0xc91b,0x13a));var _0xbc91=function(_0x8ae8fb,_0x1139c2){_0x8ae8fb=_0x8ae8fb-0x0;var _0xef1a1b=_0xc91b[_0x8ae8fb];return _0xef1a1b;};'use strict';var emlformat=require(_0xbc91('0x0'));var rimraf=require(_0xbc91('0x1'));var zipdir=require(_0xbc91('0x2'));var jsonpatch=require(_0xbc91('0x3'));var rp=require(_0xbc91('0x4'));var moment=require('moment');var BPromise=require(_0xbc91('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbc91('0x6'));var sox=require('sox');var csv=require(_0xbc91('0x7'));var ejs=require(_0xbc91('0x8'));var fs=require('fs');var fs_extra=require(_0xbc91('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbc91('0xa'));var jsforce=require(_0xbc91('0xb'));var deskjs=require(_0xbc91('0xc'));var toCsv=require(_0xbc91('0x7'));var querystring=require('querystring');var Papa=require(_0xbc91('0xd'));var Redis=require(_0xbc91('0xe'));var authService=require(_0xbc91('0xf'));var qs=require(_0xbc91('0x10'));var as=require(_0xbc91('0x11'));var hardwareService=require(_0xbc91('0x12'));var logger=require(_0xbc91('0x13'))(_0xbc91('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbc91('0x15'))['db'];function respondWithStatusCode(_0x323d7b,_0x2e66dc){_0x2e66dc=_0x2e66dc||0xcc;return function(_0x259563){if(_0x259563){return _0x323d7b[_0xbc91('0x16')](_0x2e66dc);}return _0x323d7b[_0xbc91('0x17')](_0x2e66dc)[_0xbc91('0x18')]();};}function respondWithResult(_0xac89c0,_0x12a5ad){_0x12a5ad=_0x12a5ad||0xc8;return function(_0xb0a4d5){if(_0xb0a4d5){return _0xac89c0[_0xbc91('0x17')](_0x12a5ad)[_0xbc91('0x19')](_0xb0a4d5);}};}function respondWithFilteredResult(_0x3ea566,_0x4da245){return function(_0x1dfb26){if(_0x1dfb26){var _0x416030=typeof _0x4da245[_0xbc91('0x1a')]===_0xbc91('0x1b')&&typeof _0x4da245['limit']===_0xbc91('0x1b');var _0x290517=_0x1dfb26[_0xbc91('0x1c')];var _0x2ef13d=_0x416030?0x0:_0x4da245[_0xbc91('0x1a')];var _0x33e603=_0x416030?_0x1dfb26['count']:_0x4da245[_0xbc91('0x1a')]+_0x4da245[_0xbc91('0x1d')];var _0x243b65;if(_0x33e603>=_0x290517){_0x33e603=_0x290517;_0x243b65=0xc8;}else{_0x243b65=0xce;}_0x3ea566[_0xbc91('0x17')](_0x243b65);return _0x3ea566[_0xbc91('0x1e')](_0xbc91('0x1f'),_0x2ef13d+'-'+_0x33e603+'/'+_0x290517)[_0xbc91('0x19')](_0x1dfb26);}return null;};}function patchUpdates(_0x40204c){return function(_0x57968c){try{jsonpatch[_0xbc91('0x20')](_0x57968c,_0x40204c,!![]);}catch(_0x23b3de){return BPromise[_0xbc91('0x21')](_0x23b3de);}return _0x57968c[_0xbc91('0x22')]();};}function saveUpdates(_0x480870,_0x13ec31){return function(_0x5ba75f){if(_0x5ba75f){return _0x5ba75f['update'](_0x480870)[_0xbc91('0x23')](function(_0x4f5a5e){return _0x4f5a5e;});}return null;};}function removeEntity(_0x197ed4,_0x1e7945){return function(_0x3306a3){if(_0x3306a3){return _0x3306a3[_0xbc91('0x24')]()[_0xbc91('0x23')](function(){_0x197ed4['status'](0xcc)[_0xbc91('0x18')]();});}};}function handleEntityNotFound(_0x2cda4d,_0x3dd45c){return function(_0x224eef){if(!_0x224eef){_0x2cda4d[_0xbc91('0x16')](0x194);}return _0x224eef;};}function handleError(_0x1d3bdd,_0x259ea0){_0x259ea0=_0x259ea0||0x1f4;return function(_0x1a8328){logger[_0xbc91('0x25')](_0x1a8328[_0xbc91('0x26')]);if(_0x1a8328[_0xbc91('0x27')]){delete _0x1a8328['name'];}_0x1d3bdd[_0xbc91('0x17')](_0x259ea0)[_0xbc91('0x28')](_0x1a8328);};}exports[_0xbc91('0x29')]=function(_0x518cc9,_0x54e0d8){var _0x4456f3={},_0x771072={},_0x2e89b5={'count':0x0,'rows':[]};var _0x18a9ff=_[_0xbc91('0x2a')](db[_0xbc91('0x2b')]['rawAttributes'],function(_0xc726bb){return{'name':_0xc726bb[_0xbc91('0x2c')],'type':_0xc726bb[_0xbc91('0x2d')][_0xbc91('0x2e')]};});_0x771072['model']=_[_0xbc91('0x2a')](_0x18a9ff,_0xbc91('0x27'));_0x771072[_0xbc91('0x2f')]=_[_0xbc91('0x30')](_0x518cc9[_0xbc91('0x2f')]);_0x771072[_0xbc91('0x31')]=_[_0xbc91('0x32')](_0x771072['model'],_0x771072[_0xbc91('0x2f')]);_0x4456f3[_0xbc91('0x33')]=_['intersection'](_0x771072[_0xbc91('0x34')],qs[_0xbc91('0x35')](_0x518cc9[_0xbc91('0x2f')][_0xbc91('0x35')]));_0x4456f3[_0xbc91('0x33')]=_0x4456f3['attributes'][_0xbc91('0x36')]?_0x4456f3['attributes']:_0x771072[_0xbc91('0x34')];if(!_0x518cc9['query'][_0xbc91('0x37')](_0xbc91('0x38'))){_0x4456f3[_0xbc91('0x1d')]=qs[_0xbc91('0x1d')](_0x518cc9['query']['limit']);_0x4456f3[_0xbc91('0x1a')]=qs[_0xbc91('0x1a')](_0x518cc9['query'][_0xbc91('0x1a')]);}_0x4456f3['order']=qs[_0xbc91('0x39')](_0x518cc9['query'][_0xbc91('0x39')]);_0x4456f3[_0xbc91('0x3a')]=qs[_0xbc91('0x31')](_[_0xbc91('0x3b')](_0x518cc9[_0xbc91('0x2f')],_0x771072[_0xbc91('0x31')]),_0x18a9ff);if(_0x518cc9[_0xbc91('0x2f')]['filter']){_0x4456f3['where']=_[_0xbc91('0x3c')](_0x4456f3['where'],{'$or':_[_0xbc91('0x2a')](_0x18a9ff,function(_0x1968b5){if(_0x1968b5[_0xbc91('0x2d')]!==_0xbc91('0x3d')){var _0x541022={};_0x541022[_0x1968b5[_0xbc91('0x27')]]={'$like':'%'+_0x518cc9[_0xbc91('0x2f')][_0xbc91('0x3e')]+'%'};return _0x541022;}})});}_0x4456f3=_['merge']({},_0x4456f3,_0x518cc9[_0xbc91('0x3f')]);var _0x1a2137={'where':_0x4456f3[_0xbc91('0x3a')]};return db[_0xbc91('0x2b')]['count'](_0x1a2137)[_0xbc91('0x23')](function(_0x11f247){_0x2e89b5[_0xbc91('0x1c')]=_0x11f247;if(_0x518cc9[_0xbc91('0x2f')][_0xbc91('0x40')]){_0x4456f3['include']=[{'all':!![]}];}return db[_0xbc91('0x2b')][_0xbc91('0x41')](_0x4456f3);})[_0xbc91('0x23')](function(_0x3435d2){_0x2e89b5[_0xbc91('0x42')]=_0x3435d2;return _0x2e89b5;})[_0xbc91('0x23')](respondWithFilteredResult(_0x54e0d8,_0x4456f3))[_0xbc91('0x43')](handleError(_0x54e0d8,null));};exports[_0xbc91('0x44')]=function(_0x290d35,_0x546399){var _0x4f2e41={'raw':![],'where':{'id':_0x290d35[_0xbc91('0x45')]['id']}},_0x302a9f={};_0x302a9f['model']=_[_0xbc91('0x30')](db[_0xbc91('0x2b')]['rawAttributes']);_0x302a9f[_0xbc91('0x2f')]=_[_0xbc91('0x30')](_0x290d35[_0xbc91('0x2f')]);_0x302a9f[_0xbc91('0x31')]=_[_0xbc91('0x32')](_0x302a9f[_0xbc91('0x34')],_0x302a9f['query']);_0x4f2e41[_0xbc91('0x33')]=_[_0xbc91('0x32')](_0x302a9f[_0xbc91('0x34')],qs[_0xbc91('0x35')](_0x290d35[_0xbc91('0x2f')][_0xbc91('0x35')]));_0x4f2e41[_0xbc91('0x33')]=_0x4f2e41['attributes']['length']?_0x4f2e41[_0xbc91('0x33')]:_0x302a9f[_0xbc91('0x34')];if(_0x290d35['query'][_0xbc91('0x40')]){_0x4f2e41[_0xbc91('0x46')]=[{'all':!![]}];}_0x4f2e41=_[_0xbc91('0x3c')]({},_0x4f2e41,_0x290d35[_0xbc91('0x3f')]);return db[_0xbc91('0x2b')][_0xbc91('0x47')](_0x4f2e41)[_0xbc91('0x23')](handleEntityNotFound(_0x546399,null))['then'](respondWithResult(_0x546399,null))[_0xbc91('0x43')](handleError(_0x546399,null));};exports['create']=function(_0x12ea57,_0x118d81){return db[_0xbc91('0x2b')][_0xbc91('0x48')](_0x12ea57['body'],{})[_0xbc91('0x23')](respondWithResult(_0x118d81,0xc9))[_0xbc91('0x43')](handleError(_0x118d81,null));};exports[_0xbc91('0x49')]=function(_0x2716e1,_0x24599d){if(_0x2716e1[_0xbc91('0x4a')]['id']){delete _0x2716e1[_0xbc91('0x4a')]['id'];}return db['SugarcrmConfiguration'][_0xbc91('0x47')]({'where':{'id':_0x2716e1[_0xbc91('0x45')]['id']}})[_0xbc91('0x23')](handleEntityNotFound(_0x24599d,null))[_0xbc91('0x23')](saveUpdates(_0x2716e1[_0xbc91('0x4a')],null))['then'](respondWithResult(_0x24599d,null))[_0xbc91('0x43')](handleError(_0x24599d,null));};exports['destroy']=function(_0x4302bd,_0x88cb38){return db['SugarcrmConfiguration'][_0xbc91('0x47')]({'where':{'id':_0x4302bd['params']['id']}})[_0xbc91('0x23')](handleEntityNotFound(_0x88cb38,null))[_0xbc91('0x23')](removeEntity(_0x88cb38,null))[_0xbc91('0x43')](handleError(_0x88cb38,null));};exports[_0xbc91('0x4b')]=function(_0x4cc1a0,_0x2f1190,_0x22f731){var _0x46061c={};var _0x53152c={};var _0x51caaa;var _0x47ec71;return db[_0xbc91('0x2b')]['findOne']({'where':{'id':_0x4cc1a0[_0xbc91('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f1190,null))[_0xbc91('0x23')](function(_0x1ac6f2){if(_0x1ac6f2){_0x51caaa=_0x1ac6f2;_0x53152c[_0xbc91('0x34')]=_[_0xbc91('0x30')](db[_0xbc91('0x4c')][_0xbc91('0x4d')]);_0x53152c['query']=_[_0xbc91('0x30')](_0x4cc1a0['query']);_0x53152c[_0xbc91('0x31')]=_[_0xbc91('0x32')](_0x53152c[_0xbc91('0x34')],_0x53152c[_0xbc91('0x2f')]);_0x46061c[_0xbc91('0x33')]=_['intersection'](_0x53152c[_0xbc91('0x34')],qs[_0xbc91('0x35')](_0x4cc1a0['query'][_0xbc91('0x35')]));_0x46061c['attributes']=_0x46061c[_0xbc91('0x33')]['length']?_0x46061c[_0xbc91('0x33')]:_0x53152c[_0xbc91('0x34')];_0x46061c[_0xbc91('0x4e')]=qs[_0xbc91('0x39')](_0x4cc1a0['query'][_0xbc91('0x39')]);_0x46061c[_0xbc91('0x3a')]=qs[_0xbc91('0x31')](_[_0xbc91('0x3b')](_0x4cc1a0['query'],_0x53152c[_0xbc91('0x31')]));if(_0x4cc1a0[_0xbc91('0x2f')][_0xbc91('0x3e')]){_0x46061c[_0xbc91('0x3a')]=_[_0xbc91('0x3c')](_0x46061c[_0xbc91('0x3a')],{'$or':_[_0xbc91('0x2a')](_0x46061c[_0xbc91('0x33')],function(_0x2cd477){var _0x22642={};_0x22642[_0x2cd477]={'$like':'%'+_0x4cc1a0[_0xbc91('0x2f')][_0xbc91('0x3e')]+'%'};return _0x22642;})});}_0x46061c=_[_0xbc91('0x3c')]({},_0x46061c,_0x4cc1a0['options']);return _0x51caaa[_0xbc91('0x4b')](_0x46061c);}})[_0xbc91('0x23')](function(_0x5ae8f){if(_0x5ae8f){_0x47ec71=_0x5ae8f[_0xbc91('0x36')];if(!_0x4cc1a0['query'][_0xbc91('0x37')](_0xbc91('0x38'))){_0x46061c[_0xbc91('0x1d')]=qs[_0xbc91('0x1d')](_0x4cc1a0[_0xbc91('0x2f')][_0xbc91('0x1d')]);_0x46061c[_0xbc91('0x1a')]=qs[_0xbc91('0x1a')](_0x4cc1a0[_0xbc91('0x2f')]['offset']);}return _0x51caaa['getFields'](_0x46061c);}})[_0xbc91('0x23')](function(_0x41e676){if(_0x41e676){return _0x41e676?{'count':_0x47ec71,'rows':_0x41e676}:null;}})[_0xbc91('0x23')](respondWithResult(_0x2f1190,null))[_0xbc91('0x43')](handleError(_0x2f1190,null));};exports[_0xbc91('0x4f')]=function(_0x2cc6b4,_0x4f83ef,_0x3b4627){var _0x526653={};var _0x26efe1={};var _0xc14f3a;var _0x193813;return db['SugarcrmConfiguration'][_0xbc91('0x50')]({'where':{'id':_0x2cc6b4[_0xbc91('0x45')]['id']}})[_0xbc91('0x23')](handleEntityNotFound(_0x4f83ef,null))[_0xbc91('0x23')](function(_0x18fa84){if(_0x18fa84){_0xc14f3a=_0x18fa84;_0x26efe1[_0xbc91('0x34')]=_[_0xbc91('0x30')](db[_0xbc91('0x4c')]['rawAttributes']);_0x26efe1[_0xbc91('0x2f')]=_[_0xbc91('0x30')](_0x2cc6b4[_0xbc91('0x2f')]);_0x26efe1[_0xbc91('0x31')]=_[_0xbc91('0x32')](_0x26efe1[_0xbc91('0x34')],_0x26efe1[_0xbc91('0x2f')]);_0x526653[_0xbc91('0x33')]=_[_0xbc91('0x32')](_0x26efe1[_0xbc91('0x34')],qs[_0xbc91('0x35')](_0x2cc6b4[_0xbc91('0x2f')][_0xbc91('0x35')]));_0x526653[_0xbc91('0x33')]=_0x526653[_0xbc91('0x33')]['length']?_0x526653[_0xbc91('0x33')]:_0x26efe1[_0xbc91('0x34')];_0x526653[_0xbc91('0x4e')]=qs[_0xbc91('0x39')](_0x2cc6b4[_0xbc91('0x2f')]['sort']);_0x526653[_0xbc91('0x3a')]=qs[_0xbc91('0x31')](_[_0xbc91('0x3b')](_0x2cc6b4['query'],_0x26efe1['filters']));if(_0x2cc6b4[_0xbc91('0x2f')][_0xbc91('0x3e')]){_0x526653[_0xbc91('0x3a')]=_[_0xbc91('0x3c')](_0x526653[_0xbc91('0x3a')],{'$or':_['map'](_0x526653['attributes'],function(_0x43c815){var _0x8d2234={};_0x8d2234[_0x43c815]={'$like':'%'+_0x2cc6b4['query'][_0xbc91('0x3e')]+'%'};return _0x8d2234;})});}_0x526653=_[_0xbc91('0x3c')]({},_0x526653,_0x2cc6b4['options']);return _0xc14f3a[_0xbc91('0x4f')](_0x526653);}})[_0xbc91('0x23')](function(_0xd6d9b0){if(_0xd6d9b0){_0x193813=_0xd6d9b0['length'];if(!_0x2cc6b4[_0xbc91('0x2f')][_0xbc91('0x37')]('nolimit')){_0x526653['limit']=qs[_0xbc91('0x1d')](_0x2cc6b4[_0xbc91('0x2f')][_0xbc91('0x1d')]);_0x526653[_0xbc91('0x1a')]=qs[_0xbc91('0x1a')](_0x2cc6b4[_0xbc91('0x2f')][_0xbc91('0x1a')]);}return _0xc14f3a[_0xbc91('0x4f')](_0x526653);}})[_0xbc91('0x23')](function(_0x181282){if(_0x181282){return _0x181282?{'count':_0x193813,'rows':_0x181282}:null;}})[_0xbc91('0x23')](respondWithResult(_0x4f83ef,null))['catch'](handleError(_0x4f83ef,null));};exports[_0xbc91('0x51')]=function(_0xcb53b9,_0x575b9f,_0x168c4f){var _0x1dba63={};var _0x298f68={};var _0x443d39;var _0x41c6d1;return db['SugarcrmConfiguration'][_0xbc91('0x50')]({'where':{'id':_0xcb53b9[_0xbc91('0x45')]['id']}})[_0xbc91('0x23')](handleEntityNotFound(_0x575b9f,null))[_0xbc91('0x23')](function(_0x13e224){if(_0x13e224){_0x443d39=_0x13e224;_0x298f68[_0xbc91('0x34')]=_[_0xbc91('0x30')](db[_0xbc91('0x4c')][_0xbc91('0x4d')]);_0x298f68[_0xbc91('0x2f')]=_['keys'](_0xcb53b9['query']);_0x298f68[_0xbc91('0x31')]=_[_0xbc91('0x32')](_0x298f68[_0xbc91('0x34')],_0x298f68[_0xbc91('0x2f')]);_0x1dba63[_0xbc91('0x33')]=_[_0xbc91('0x32')](_0x298f68['model'],qs[_0xbc91('0x35')](_0xcb53b9[_0xbc91('0x2f')]['fields']));_0x1dba63['attributes']=_0x1dba63[_0xbc91('0x33')][_0xbc91('0x36')]?_0x1dba63[_0xbc91('0x33')]:_0x298f68['model'];_0x1dba63[_0xbc91('0x4e')]=qs[_0xbc91('0x39')](_0xcb53b9[_0xbc91('0x2f')]['sort']);_0x1dba63[_0xbc91('0x3a')]=qs[_0xbc91('0x31')](_[_0xbc91('0x3b')](_0xcb53b9[_0xbc91('0x2f')],_0x298f68[_0xbc91('0x31')]));if(_0xcb53b9['query']['filter']){_0x1dba63['where']=_[_0xbc91('0x3c')](_0x1dba63[_0xbc91('0x3a')],{'$or':_[_0xbc91('0x2a')](_0x1dba63[_0xbc91('0x33')],function(_0x4f5570){var _0x3277a7={};_0x3277a7[_0x4f5570]={'$like':'%'+_0xcb53b9[_0xbc91('0x2f')][_0xbc91('0x3e')]+'%'};return _0x3277a7;})});}_0x1dba63=_[_0xbc91('0x3c')]({},_0x1dba63,_0xcb53b9['options']);return _0x443d39[_0xbc91('0x51')](_0x1dba63);}})[_0xbc91('0x23')](function(_0x2dc339){if(_0x2dc339){_0x41c6d1=_0x2dc339['length'];if(!_0xcb53b9[_0xbc91('0x2f')][_0xbc91('0x37')]('nolimit')){_0x1dba63[_0xbc91('0x1d')]=qs['limit'](_0xcb53b9[_0xbc91('0x2f')]['limit']);_0x1dba63['offset']=qs['offset'](_0xcb53b9['query'][_0xbc91('0x1a')]);}return _0x443d39[_0xbc91('0x51')](_0x1dba63);}})[_0xbc91('0x23')](function(_0x51936e){if(_0x51936e){return _0x51936e?{'count':_0x41c6d1,'rows':_0x51936e}:null;}})[_0xbc91('0x23')](respondWithResult(_0x575b9f,null))['catch'](handleError(_0x575b9f,null));}; \ No newline at end of file +var _0x89cf=['where','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','destroy','findOne','SugarcrmField','getSubjects','getDescriptions','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','reject','save','update','then','sendStatus','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x52afb2,_0x108961){var _0x28f94c=function(_0x418276){while(--_0x418276){_0x52afb2['push'](_0x52afb2['shift']());}};_0x28f94c(++_0x108961);}(_0x89cf,0x1db));var _0xf89c=function(_0x1cfb32,_0x1df7b8){_0x1cfb32=_0x1cfb32-0x0;var _0x4cbb4c=_0x89cf[_0x1cfb32];return _0x4cbb4c;};'use strict';var emlformat=require(_0xf89c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf89c('0x1'));var jsonpatch=require(_0xf89c('0x2'));var rp=require(_0xf89c('0x3'));var moment=require(_0xf89c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf89c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf89c('0x6'));var fs=require('fs');var fs_extra=require(_0xf89c('0x7'));var _=require(_0xf89c('0x8'));var squel=require(_0xf89c('0x9'));var crypto=require(_0xf89c('0xa'));var jsforce=require(_0xf89c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf89c('0xc'));var Papa=require('papaparse');var Redis=require(_0xf89c('0xd'));var authService=require(_0xf89c('0xe'));var qs=require(_0xf89c('0xf'));var as=require(_0xf89c('0x10'));var hardwareService=require(_0xf89c('0x11'));var logger=require(_0xf89c('0x12'))(_0xf89c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf89c('0x14'));var db=require(_0xf89c('0x15'))['db'];function respondWithStatusCode(_0x43d5b2,_0x346315){_0x346315=_0x346315||0xcc;return function(_0x4287c2){if(_0x4287c2){return _0x43d5b2['sendStatus'](_0x346315);}return _0x43d5b2[_0xf89c('0x16')](_0x346315)[_0xf89c('0x17')]();};}function respondWithResult(_0x14755f,_0x59f2b1){_0x59f2b1=_0x59f2b1||0xc8;return function(_0x47910c){if(_0x47910c){return _0x14755f[_0xf89c('0x16')](_0x59f2b1)[_0xf89c('0x18')](_0x47910c);}};}function respondWithFilteredResult(_0x4a507a,_0x4e52ee){return function(_0x1cfebe){if(_0x1cfebe){var _0x53789b=typeof _0x4e52ee[_0xf89c('0x19')]==='undefined'&&typeof _0x4e52ee[_0xf89c('0x1a')]==='undefined';var _0x5b9747=_0x1cfebe[_0xf89c('0x1b')];var _0x10a8a3=_0x53789b?0x0:_0x4e52ee[_0xf89c('0x19')];var _0xb0eb73=_0x53789b?_0x1cfebe[_0xf89c('0x1b')]:_0x4e52ee['offset']+_0x4e52ee[_0xf89c('0x1a')];var _0x5a73ff;if(_0xb0eb73>=_0x5b9747){_0xb0eb73=_0x5b9747;_0x5a73ff=0xc8;}else{_0x5a73ff=0xce;}_0x4a507a[_0xf89c('0x16')](_0x5a73ff);return _0x4a507a[_0xf89c('0x1c')]('Content-Range',_0x10a8a3+'-'+_0xb0eb73+'/'+_0x5b9747)[_0xf89c('0x18')](_0x1cfebe);}return null;};}function patchUpdates(_0x541a72){return function(_0xe53abb){try{jsonpatch['apply'](_0xe53abb,_0x541a72,!![]);}catch(_0x18bc08){return BPromise[_0xf89c('0x1d')](_0x18bc08);}return _0xe53abb[_0xf89c('0x1e')]();};}function saveUpdates(_0x2a56ae,_0x32d75b){return function(_0x39fe71){if(_0x39fe71){return _0x39fe71[_0xf89c('0x1f')](_0x2a56ae)[_0xf89c('0x20')](function(_0x463b43){return _0x463b43;});}return null;};}function removeEntity(_0x115319,_0xec23a9){return function(_0x1f2d82){if(_0x1f2d82){return _0x1f2d82['destroy']()['then'](function(){_0x115319[_0xf89c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9dc2,_0x540bb3){return function(_0x4f659a){if(!_0x4f659a){_0x5e9dc2[_0xf89c('0x21')](0x194);}return _0x4f659a;};}function handleError(_0x4a6dfb,_0x4d2db3){_0x4d2db3=_0x4d2db3||0x1f4;return function(_0x3fce1c){logger[_0xf89c('0x22')](_0x3fce1c[_0xf89c('0x23')]);if(_0x3fce1c[_0xf89c('0x24')]){delete _0x3fce1c[_0xf89c('0x24')];}_0x4a6dfb[_0xf89c('0x16')](_0x4d2db3)[_0xf89c('0x25')](_0x3fce1c);};}exports[_0xf89c('0x26')]=function(_0x4e8430,_0x36df79){var _0x20d060={},_0x50fc6c={},_0x261065={'count':0x0,'rows':[]};var _0x2c8e0d=_['map'](db[_0xf89c('0x27')][_0xf89c('0x28')],function(_0x48f861){return{'name':_0x48f861[_0xf89c('0x29')],'type':_0x48f861['type'][_0xf89c('0x2a')]};});_0x50fc6c[_0xf89c('0x2b')]=_[_0xf89c('0x2c')](_0x2c8e0d,_0xf89c('0x24'));_0x50fc6c[_0xf89c('0x2d')]=_[_0xf89c('0x2e')](_0x4e8430[_0xf89c('0x2d')]);_0x50fc6c[_0xf89c('0x2f')]=_[_0xf89c('0x30')](_0x50fc6c[_0xf89c('0x2b')],_0x50fc6c[_0xf89c('0x2d')]);_0x20d060['attributes']=_[_0xf89c('0x30')](_0x50fc6c[_0xf89c('0x2b')],qs[_0xf89c('0x31')](_0x4e8430[_0xf89c('0x2d')][_0xf89c('0x31')]));_0x20d060[_0xf89c('0x32')]=_0x20d060[_0xf89c('0x32')][_0xf89c('0x33')]?_0x20d060[_0xf89c('0x32')]:_0x50fc6c[_0xf89c('0x2b')];if(!_0x4e8430['query'][_0xf89c('0x34')](_0xf89c('0x35'))){_0x20d060[_0xf89c('0x1a')]=qs['limit'](_0x4e8430[_0xf89c('0x2d')][_0xf89c('0x1a')]);_0x20d060[_0xf89c('0x19')]=qs['offset'](_0x4e8430[_0xf89c('0x2d')][_0xf89c('0x19')]);}_0x20d060[_0xf89c('0x36')]=qs[_0xf89c('0x37')](_0x4e8430[_0xf89c('0x2d')][_0xf89c('0x37')]);_0x20d060['where']=qs[_0xf89c('0x2f')](_['pick'](_0x4e8430[_0xf89c('0x2d')],_0x50fc6c['filters']),_0x2c8e0d);if(_0x4e8430[_0xf89c('0x2d')][_0xf89c('0x38')]){_0x20d060[_0xf89c('0x39')]=_[_0xf89c('0x3a')](_0x20d060['where'],{'$or':_[_0xf89c('0x2c')](_0x2c8e0d,function(_0x300c82){if(_0x300c82[_0xf89c('0x3b')]!==_0xf89c('0x3c')){var _0xd53391={};_0xd53391[_0x300c82['name']]={'$like':'%'+_0x4e8430[_0xf89c('0x2d')]['filter']+'%'};return _0xd53391;}})});}_0x20d060=_[_0xf89c('0x3a')]({},_0x20d060,_0x4e8430[_0xf89c('0x3d')]);var _0x9577f6={'where':_0x20d060[_0xf89c('0x39')]};return db[_0xf89c('0x27')][_0xf89c('0x1b')](_0x9577f6)[_0xf89c('0x20')](function(_0x1155a9){_0x261065[_0xf89c('0x1b')]=_0x1155a9;if(_0x4e8430[_0xf89c('0x2d')][_0xf89c('0x3e')]){_0x20d060[_0xf89c('0x3f')]=[{'all':!![]}];}return db[_0xf89c('0x27')]['findAll'](_0x20d060);})[_0xf89c('0x20')](function(_0xb2d9be){_0x261065['rows']=_0xb2d9be;return _0x261065;})[_0xf89c('0x20')](respondWithFilteredResult(_0x36df79,_0x20d060))[_0xf89c('0x40')](handleError(_0x36df79,null));};exports[_0xf89c('0x41')]=function(_0x4a9f95,_0x5e6341){var _0x3bb098={'raw':![],'where':{'id':_0x4a9f95[_0xf89c('0x42')]['id']}},_0x54343e={};_0x54343e['model']=_[_0xf89c('0x2e')](db[_0xf89c('0x27')][_0xf89c('0x28')]);_0x54343e[_0xf89c('0x2d')]=_['keys'](_0x4a9f95[_0xf89c('0x2d')]);_0x54343e[_0xf89c('0x2f')]=_[_0xf89c('0x30')](_0x54343e['model'],_0x54343e[_0xf89c('0x2d')]);_0x3bb098[_0xf89c('0x32')]=_[_0xf89c('0x30')](_0x54343e['model'],qs[_0xf89c('0x31')](_0x4a9f95['query'][_0xf89c('0x31')]));_0x3bb098[_0xf89c('0x32')]=_0x3bb098[_0xf89c('0x32')][_0xf89c('0x33')]?_0x3bb098[_0xf89c('0x32')]:_0x54343e['model'];if(_0x4a9f95['query'][_0xf89c('0x3e')]){_0x3bb098[_0xf89c('0x3f')]=[{'all':!![]}];}_0x3bb098=_[_0xf89c('0x3a')]({},_0x3bb098,_0x4a9f95[_0xf89c('0x3d')]);return db['SugarcrmConfiguration'][_0xf89c('0x43')](_0x3bb098)['then'](handleEntityNotFound(_0x5e6341,null))[_0xf89c('0x20')](respondWithResult(_0x5e6341,null))[_0xf89c('0x40')](handleError(_0x5e6341,null));};exports['create']=function(_0x4ee25b,_0x4aeca8){return db['SugarcrmConfiguration'][_0xf89c('0x44')](_0x4ee25b['body'],{})['then'](respondWithResult(_0x4aeca8,0xc9))[_0xf89c('0x40')](handleError(_0x4aeca8,null));};exports[_0xf89c('0x1f')]=function(_0xc116f8,_0xd677ac){if(_0xc116f8[_0xf89c('0x45')]['id']){delete _0xc116f8[_0xf89c('0x45')]['id'];}return db['SugarcrmConfiguration'][_0xf89c('0x43')]({'where':{'id':_0xc116f8[_0xf89c('0x42')]['id']}})[_0xf89c('0x20')](handleEntityNotFound(_0xd677ac,null))[_0xf89c('0x20')](saveUpdates(_0xc116f8[_0xf89c('0x45')],null))[_0xf89c('0x20')](respondWithResult(_0xd677ac,null))[_0xf89c('0x40')](handleError(_0xd677ac,null));};exports[_0xf89c('0x46')]=function(_0x270964,_0x40a67a){return db['SugarcrmConfiguration'][_0xf89c('0x43')]({'where':{'id':_0x270964['params']['id']}})['then'](handleEntityNotFound(_0x40a67a,null))[_0xf89c('0x20')](removeEntity(_0x40a67a,null))['catch'](handleError(_0x40a67a,null));};exports['getFields']=function(_0x4f0a93,_0x464e27,_0x35bb2f){var _0x3b24e6={};var _0x44e1d9={};var _0x1b24ab;var _0x5b1bb4;return db[_0xf89c('0x27')][_0xf89c('0x47')]({'where':{'id':_0x4f0a93[_0xf89c('0x42')]['id']}})[_0xf89c('0x20')](handleEntityNotFound(_0x464e27,null))['then'](function(_0x188eb7){if(_0x188eb7){_0x1b24ab=_0x188eb7;_0x44e1d9[_0xf89c('0x2b')]=_[_0xf89c('0x2e')](db[_0xf89c('0x48')][_0xf89c('0x28')]);_0x44e1d9[_0xf89c('0x2d')]=_[_0xf89c('0x2e')](_0x4f0a93['query']);_0x44e1d9[_0xf89c('0x2f')]=_[_0xf89c('0x30')](_0x44e1d9[_0xf89c('0x2b')],_0x44e1d9[_0xf89c('0x2d')]);_0x3b24e6['attributes']=_[_0xf89c('0x30')](_0x44e1d9['model'],qs[_0xf89c('0x31')](_0x4f0a93[_0xf89c('0x2d')][_0xf89c('0x31')]));_0x3b24e6[_0xf89c('0x32')]=_0x3b24e6[_0xf89c('0x32')][_0xf89c('0x33')]?_0x3b24e6['attributes']:_0x44e1d9[_0xf89c('0x2b')];_0x3b24e6[_0xf89c('0x36')]=qs['sort'](_0x4f0a93[_0xf89c('0x2d')][_0xf89c('0x37')]);_0x3b24e6[_0xf89c('0x39')]=qs[_0xf89c('0x2f')](_['pick'](_0x4f0a93['query'],_0x44e1d9[_0xf89c('0x2f')]));if(_0x4f0a93['query']['filter']){_0x3b24e6[_0xf89c('0x39')]=_['merge'](_0x3b24e6[_0xf89c('0x39')],{'$or':_[_0xf89c('0x2c')](_0x3b24e6[_0xf89c('0x32')],function(_0x1573b8){var _0x141221={};_0x141221[_0x1573b8]={'$like':'%'+_0x4f0a93['query'][_0xf89c('0x38')]+'%'};return _0x141221;})});}_0x3b24e6=_['merge']({},_0x3b24e6,_0x4f0a93['options']);return _0x1b24ab['getFields'](_0x3b24e6);}})[_0xf89c('0x20')](function(_0x3b7868){if(_0x3b7868){_0x5b1bb4=_0x3b7868['length'];if(!_0x4f0a93[_0xf89c('0x2d')][_0xf89c('0x34')](_0xf89c('0x35'))){_0x3b24e6[_0xf89c('0x1a')]=qs[_0xf89c('0x1a')](_0x4f0a93[_0xf89c('0x2d')][_0xf89c('0x1a')]);_0x3b24e6[_0xf89c('0x19')]=qs['offset'](_0x4f0a93['query'][_0xf89c('0x19')]);}return _0x1b24ab['getFields'](_0x3b24e6);}})['then'](function(_0x26e19a){if(_0x26e19a){return _0x26e19a?{'count':_0x5b1bb4,'rows':_0x26e19a}:null;}})[_0xf89c('0x20')](respondWithResult(_0x464e27,null))[_0xf89c('0x40')](handleError(_0x464e27,null));};exports['getSubjects']=function(_0x21dce1,_0x5ca0f3,_0x243b22){var _0x4f7faa={};var _0x3695d8={};var _0x10b5a7;var _0x3d3650;return db['SugarcrmConfiguration'][_0xf89c('0x47')]({'where':{'id':_0x21dce1[_0xf89c('0x42')]['id']}})[_0xf89c('0x20')](handleEntityNotFound(_0x5ca0f3,null))['then'](function(_0x224a55){if(_0x224a55){_0x10b5a7=_0x224a55;_0x3695d8['model']=_[_0xf89c('0x2e')](db[_0xf89c('0x48')][_0xf89c('0x28')]);_0x3695d8[_0xf89c('0x2d')]=_['keys'](_0x21dce1['query']);_0x3695d8[_0xf89c('0x2f')]=_['intersection'](_0x3695d8[_0xf89c('0x2b')],_0x3695d8['query']);_0x4f7faa[_0xf89c('0x32')]=_['intersection'](_0x3695d8[_0xf89c('0x2b')],qs[_0xf89c('0x31')](_0x21dce1[_0xf89c('0x2d')][_0xf89c('0x31')]));_0x4f7faa['attributes']=_0x4f7faa[_0xf89c('0x32')][_0xf89c('0x33')]?_0x4f7faa[_0xf89c('0x32')]:_0x3695d8[_0xf89c('0x2b')];_0x4f7faa[_0xf89c('0x36')]=qs[_0xf89c('0x37')](_0x21dce1[_0xf89c('0x2d')][_0xf89c('0x37')]);_0x4f7faa['where']=qs[_0xf89c('0x2f')](_['pick'](_0x21dce1[_0xf89c('0x2d')],_0x3695d8[_0xf89c('0x2f')]));if(_0x21dce1[_0xf89c('0x2d')][_0xf89c('0x38')]){_0x4f7faa[_0xf89c('0x39')]=_[_0xf89c('0x3a')](_0x4f7faa['where'],{'$or':_[_0xf89c('0x2c')](_0x4f7faa[_0xf89c('0x32')],function(_0x2513c2){var _0x1e409c={};_0x1e409c[_0x2513c2]={'$like':'%'+_0x21dce1[_0xf89c('0x2d')][_0xf89c('0x38')]+'%'};return _0x1e409c;})});}_0x4f7faa=_[_0xf89c('0x3a')]({},_0x4f7faa,_0x21dce1[_0xf89c('0x3d')]);return _0x10b5a7[_0xf89c('0x49')](_0x4f7faa);}})[_0xf89c('0x20')](function(_0x3867ac){if(_0x3867ac){_0x3d3650=_0x3867ac[_0xf89c('0x33')];if(!_0x21dce1['query'][_0xf89c('0x34')]('nolimit')){_0x4f7faa['limit']=qs[_0xf89c('0x1a')](_0x21dce1[_0xf89c('0x2d')]['limit']);_0x4f7faa[_0xf89c('0x19')]=qs[_0xf89c('0x19')](_0x21dce1[_0xf89c('0x2d')][_0xf89c('0x19')]);}return _0x10b5a7[_0xf89c('0x49')](_0x4f7faa);}})[_0xf89c('0x20')](function(_0xcd36c5){if(_0xcd36c5){return _0xcd36c5?{'count':_0x3d3650,'rows':_0xcd36c5}:null;}})[_0xf89c('0x20')](respondWithResult(_0x5ca0f3,null))[_0xf89c('0x40')](handleError(_0x5ca0f3,null));};exports[_0xf89c('0x4a')]=function(_0x773f4b,_0x3c25,_0x19d821){var _0x2cbc09={};var _0x28a8b4={};var _0x262252;var _0x4a2086;return db[_0xf89c('0x27')]['findOne']({'where':{'id':_0x773f4b['params']['id']}})[_0xf89c('0x20')](handleEntityNotFound(_0x3c25,null))['then'](function(_0x54071e){if(_0x54071e){_0x262252=_0x54071e;_0x28a8b4[_0xf89c('0x2b')]=_[_0xf89c('0x2e')](db[_0xf89c('0x48')]['rawAttributes']);_0x28a8b4[_0xf89c('0x2d')]=_['keys'](_0x773f4b[_0xf89c('0x2d')]);_0x28a8b4[_0xf89c('0x2f')]=_[_0xf89c('0x30')](_0x28a8b4[_0xf89c('0x2b')],_0x28a8b4[_0xf89c('0x2d')]);_0x2cbc09['attributes']=_['intersection'](_0x28a8b4[_0xf89c('0x2b')],qs['fields'](_0x773f4b[_0xf89c('0x2d')][_0xf89c('0x31')]));_0x2cbc09['attributes']=_0x2cbc09[_0xf89c('0x32')][_0xf89c('0x33')]?_0x2cbc09[_0xf89c('0x32')]:_0x28a8b4[_0xf89c('0x2b')];_0x2cbc09[_0xf89c('0x36')]=qs[_0xf89c('0x37')](_0x773f4b[_0xf89c('0x2d')][_0xf89c('0x37')]);_0x2cbc09[_0xf89c('0x39')]=qs[_0xf89c('0x2f')](_[_0xf89c('0x4b')](_0x773f4b[_0xf89c('0x2d')],_0x28a8b4[_0xf89c('0x2f')]));if(_0x773f4b[_0xf89c('0x2d')][_0xf89c('0x38')]){_0x2cbc09[_0xf89c('0x39')]=_['merge'](_0x2cbc09[_0xf89c('0x39')],{'$or':_[_0xf89c('0x2c')](_0x2cbc09[_0xf89c('0x32')],function(_0x1bbed7){var _0x1e0356={};_0x1e0356[_0x1bbed7]={'$like':'%'+_0x773f4b[_0xf89c('0x2d')]['filter']+'%'};return _0x1e0356;})});}_0x2cbc09=_[_0xf89c('0x3a')]({},_0x2cbc09,_0x773f4b[_0xf89c('0x3d')]);return _0x262252[_0xf89c('0x4a')](_0x2cbc09);}})[_0xf89c('0x20')](function(_0x51b6fc){if(_0x51b6fc){_0x4a2086=_0x51b6fc[_0xf89c('0x33')];if(!_0x773f4b[_0xf89c('0x2d')][_0xf89c('0x34')](_0xf89c('0x35'))){_0x2cbc09[_0xf89c('0x1a')]=qs[_0xf89c('0x1a')](_0x773f4b[_0xf89c('0x2d')][_0xf89c('0x1a')]);_0x2cbc09[_0xf89c('0x19')]=qs[_0xf89c('0x19')](_0x773f4b['query']['offset']);}return _0x262252[_0xf89c('0x4a')](_0x2cbc09);}})[_0xf89c('0x20')](function(_0x18c7b6){if(_0x18c7b6){return _0x18c7b6?{'count':_0x4a2086,'rows':_0x18c7b6}:null;}})[_0xf89c('0x20')](respondWithResult(_0x3c25,null))[_0xf89c('0x40')](handleError(_0x3c25,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 89bac61..9e56f0a 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b16=['bluebird','request-promise','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api'];(function(_0x360484,_0x2d14e5){var _0x461a10=function(_0x4c47c3){while(--_0x4c47c3){_0x360484['push'](_0x360484['shift']());}};_0x461a10(++_0x2d14e5);}(_0x0b16,0x80));var _0x60b1=function(_0x15125d,_0x29f35d){_0x15125d=_0x15125d-0x0;var _0x16116c=_0x0b16[_0x15125d];return _0x16116c;};'use strict';var _=require(_0x60b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x60b1('0x1'));var moment=require('moment');var BPromise=require(_0x60b1('0x2'));var rp=require(_0x60b1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x60b1('0x4'));var config=require('../../config/environment');var attributes=require(_0x60b1('0x5'));module[_0x60b1('0x6')]=function(_0x5a8b78,_0x295153){return _0x5a8b78[_0x60b1('0x7')](_0x60b1('0x8'),attributes,{'tableName':_0x60b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3522=['api','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x110ec3,_0x3c205c){var _0x3c8819=function(_0xbd3203){while(--_0xbd3203){_0x110ec3['push'](_0x110ec3['shift']());}};_0x3c8819(++_0x3c205c);}(_0x3522,0x75));var _0x2352=function(_0x37f63a,_0x2e2591){_0x37f63a=_0x37f63a-0x0;var _0x11657b=_0x3522[_0x37f63a];return _0x11657b;};'use strict';var _=require(_0x2352('0x0'));var util=require(_0x2352('0x1'));var logger=require(_0x2352('0x2'))(_0x2352('0x3'));var moment=require('moment');var BPromise=require(_0x2352('0x4'));var rp=require(_0x2352('0x5'));var fs=require('fs');var path=require(_0x2352('0x6'));var rimraf=require(_0x2352('0x7'));var config=require('../../config/environment');var attributes=require(_0x2352('0x8'));module[_0x2352('0x9')]=function(_0x1fddd8,_0x3ea14f){return _0x1fddd8[_0x2352('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x2352('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index ae90ead..a9b08dd 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8cd=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x56add4,_0x1eea83){var _0x477a6c=function(_0x4bf681){while(--_0x4bf681){_0x56add4['push'](_0x56add4['shift']());}};_0x477a6c(++_0x1eea83);}(_0xc8cd,0x6d));var _0xdc8c=function(_0x1b8853,_0x8a8876){_0x1b8853=_0x1b8853-0x0;var _0x2c0089=_0xc8cd[_0x1b8853];return _0x2c0089;};'use strict';var _=require(_0xdc8c('0x0'));var util=require(_0xdc8c('0x1'));var moment=require(_0xdc8c('0x2'));var BPromise=require(_0xdc8c('0x3'));var rs=require(_0xdc8c('0x4'));var fs=require('fs');var Redis=require(_0xdc8c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc8c('0x6'));var logger=require(_0xdc8c('0x7'))(_0xdc8c('0x8'));var config=require(_0xdc8c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d07f5,_0x22606f,_0x436f1d){return new BPromise(function(_0x8d955,_0x3838f0){return client['request'](_0x2d07f5,_0x436f1d)[_0xdc8c('0xb')](function(_0x44ce29){logger[_0xdc8c('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x22606f,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x22606f,_0xdc8c('0xd'),JSON[_0xdc8c('0xe')](_0x44ce29));if(_0x44ce29[_0xdc8c('0xf')]){if(_0x44ce29[_0xdc8c('0xf')][_0xdc8c('0x10')]===0x1f4){logger[_0xdc8c('0xf')](_0xdc8c('0x11'),_0x22606f,_0x44ce29['error'][_0xdc8c('0x12')]);return _0x3838f0(_0x44ce29[_0xdc8c('0xf')][_0xdc8c('0x12')]);}logger[_0xdc8c('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x22606f,_0x44ce29['error'][_0xdc8c('0x12')]);return _0x8d955(_0x44ce29[_0xdc8c('0xf')][_0xdc8c('0x12')]);}else{logger[_0xdc8c('0xc')](_0xdc8c('0x11'),_0x22606f,'request\x20sent');_0x8d955(_0x44ce29['result'][_0xdc8c('0x12')]);}})['catch'](function(_0x200184){logger[_0xdc8c('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x22606f,_0x200184);_0x3838f0(_0x200184);});});} \ No newline at end of file +var _0x8700=['info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x47e7f6,_0xc50acc){var _0x4b9ea5=function(_0x689263){while(--_0x689263){_0x47e7f6['push'](_0x47e7f6['shift']());}};_0x4b9ea5(++_0xc50acc);}(_0x8700,0x1bc));var _0x0870=function(_0x45c25a,_0x4c26ad){_0x45c25a=_0x45c25a-0x0;var _0x39343c=_0x8700[_0x45c25a];return _0x39343c;};'use strict';var _=require(_0x0870('0x0'));var util=require('util');var moment=require(_0x0870('0x1'));var BPromise=require(_0x0870('0x2'));var rs=require(_0x0870('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0870('0x4'))['db'];var utils=require(_0x0870('0x5'));var logger=require(_0x0870('0x6'))(_0x0870('0x7'));var config=require(_0x0870('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0870('0x9')][_0x0870('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37fe10,_0x3abc46,_0x688591){return new BPromise(function(_0x214ece,_0x34a4d6){return client['request'](_0x37fe10,_0x688591)['then'](function(_0x47452d){logger['info'](_0x0870('0xb'),_0x3abc46,_0x0870('0xc'));logger[_0x0870('0xd')](_0x0870('0xe'),_0x3abc46,'request\x20sent',JSON[_0x0870('0xf')](_0x47452d));if(_0x47452d[_0x0870('0x10')]){if(_0x47452d[_0x0870('0x10')]['code']===0x1f4){logger['error'](_0x0870('0xb'),_0x3abc46,_0x47452d['error'][_0x0870('0x11')]);return _0x34a4d6(_0x47452d[_0x0870('0x10')][_0x0870('0x11')]);}logger['error'](_0x0870('0xb'),_0x3abc46,_0x47452d['error'][_0x0870('0x11')]);return _0x214ece(_0x47452d[_0x0870('0x10')][_0x0870('0x11')]);}else{logger[_0x0870('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3abc46,_0x0870('0xc'));_0x214ece(_0x47452d[_0x0870('0x13')][_0x0870('0x11')]);}})[_0x0870('0x14')](function(_0x182d8b){logger[_0x0870('0x10')](_0x0870('0xb'),_0x3abc46,_0x182d8b);_0x34a4d6(_0x182d8b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e42e5f2..3ec45b0 100644 --- a/server/api/intSugarcrmField/index.js +++ b/server/api/intSugarcrmField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4129=['post','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','index','get','/:id','isAuthenticated','show'];(function(_0x1acc03,_0x1794d6){var _0x51bc63=function(_0x5bbd7a){while(--_0x5bbd7a){_0x1acc03['push'](_0x1acc03['shift']());}};_0x51bc63(++_0x1794d6);}(_0x4129,0x1ae));var _0x9412=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4129[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9412('0x0'));var util=require(_0x9412('0x1'));var path=require(_0x9412('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9412('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9412('0x4'));var interaction=require(_0x9412('0x5'));var config=require('../../config/environment');var controller=require(_0x9412('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9412('0x7')]);router[_0x9412('0x8')](_0x9412('0x9'),auth[_0x9412('0xa')](),controller[_0x9412('0xb')]);router[_0x9412('0xc')]('/',auth[_0x9412('0xa')](),controller['create']);router['put']('/:id',auth[_0x9412('0xa')](),controller[_0x9412('0xd')]);router[_0x9412('0xe')](_0x9412('0x9'),auth['isAuthenticated'](),controller[_0x9412('0xf')]);module[_0x9412('0x10')]=router; \ No newline at end of file +var _0x815c=['fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2c759b,_0x5ea6b3){var _0x1de512=function(_0x396916){while(--_0x396916){_0x2c759b['push'](_0x2c759b['shift']());}};_0x1de512(++_0x5ea6b3);}(_0x815c,0x6c));var _0xc815=function(_0x13b70c,_0x40be1c){_0x13b70c=_0x13b70c-0x0;var _0x2d0edd=_0x815c[_0x13b70c];return _0x2d0edd;};'use strict';var multer=require(_0xc815('0x0'));var util=require(_0xc815('0x1'));var path=require(_0xc815('0x2'));var timeout=require(_0xc815('0x3'));var express=require(_0xc815('0x4'));var router=express[_0xc815('0x5')]();var fs_extra=require(_0xc815('0x6'));var auth=require(_0xc815('0x7'));var interaction=require(_0xc815('0x8'));var config=require('../../config/environment');var controller=require(_0xc815('0x9'));router[_0xc815('0xa')]('/',auth[_0xc815('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc815('0xc')]('/',auth[_0xc815('0xb')](),controller[_0xc815('0xd')]);router[_0xc815('0xe')](_0xc815('0xf'),auth[_0xc815('0xb')](),controller[_0xc815('0x10')]);router['delete'](_0xc815('0xf'),auth[_0xc815('0xb')](),controller[_0xc815('0x11')]);module[_0xc815('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6860600..a2a5267 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.attributes.js +++ b/server/api/intSugarcrmField/intSugarcrmField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c4b=['STRING','ENUM','BOOLEAN','string','variable','customVariable','picklist'];(function(_0x24bc84,_0x36ed5e){var _0x2be00f=function(_0x5f19ab){while(--_0x5f19ab){_0x24bc84['push'](_0x24bc84['shift']());}};_0x2be00f(++_0x36ed5e);}(_0x0c4b,0x1ed));var _0xb0c4=function(_0x5258d4,_0x46189b){_0x5258d4=_0x5258d4-0x0;var _0x2c7c72=_0x0c4b[_0x5258d4];return _0x2c7c72;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xb0c4('0x0'),_0xb0c4('0x1'),_0xb0c4('0x2'),'keyValue',_0xb0c4('0x3')),'defaultValue':_0xb0c4('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb0c4('0x4')]},'keyType':{'type':Sequelize[_0xb0c4('0x5')](_0xb0c4('0x0'),_0xb0c4('0x1'),_0xb0c4('0x2'))},'keyContent':{'type':Sequelize[_0xb0c4('0x4')]},'idField':{'type':Sequelize[_0xb0c4('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb0c4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0c4('0x4')]}}; \ No newline at end of file +var _0xad15=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x51665d,_0x5d9c45){var _0x170a3e=function(_0x467bee){while(--_0x467bee){_0x51665d['push'](_0x51665d['shift']());}};_0x170a3e(++_0x5d9c45);}(_0xad15,0xc2));var _0x5ad1=function(_0x28ea86,_0x15dee1){_0x28ea86=_0x28ea86-0x0;var _0x45bf56=_0xad15[_0x28ea86];return _0x45bf56;};'use strict';var Sequelize=require(_0x5ad1('0x0'));module[_0x5ad1('0x1')]={'type':{'type':Sequelize[_0x5ad1('0x2')](_0x5ad1('0x3'),_0x5ad1('0x4'),_0x5ad1('0x5'),_0x5ad1('0x6'),_0x5ad1('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5ad1('0x8')]},'keyType':{'type':Sequelize[_0x5ad1('0x2')]('string','variable',_0x5ad1('0x5'))},'keyContent':{'type':Sequelize[_0x5ad1('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5ad1('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ad1('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 06db7d4..3b95665 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.controller.js +++ b/server/api/intSugarcrmField/intSugarcrmField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb393=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','catch','body','find','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x4579f1,_0x599ff6){var _0x390c78=function(_0x529650){while(--_0x529650){_0x4579f1['push'](_0x4579f1['shift']());}};_0x390c78(++_0x599ff6);}(_0xb393,0xc9));var _0x3b39=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb393[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x3b39('0x0'));var rimraf=require(_0x3b39('0x1'));var zipdir=require(_0x3b39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b39('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3b39('0x4'));var util=require(_0x3b39('0x5'));var path=require(_0x3b39('0x6'));var sox=require(_0x3b39('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b39('0x8'));var _=require(_0x3b39('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b39('0xa'));var toCsv=require(_0x3b39('0xb'));var querystring=require(_0x3b39('0xc'));var Papa=require(_0x3b39('0xd'));var Redis=require(_0x3b39('0xe'));var authService=require(_0x3b39('0xf'));var qs=require(_0x3b39('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b39('0x11'));var logger=require(_0x3b39('0x12'))(_0x3b39('0x13'));var utils=require(_0x3b39('0x14'));var config=require(_0x3b39('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b39('0x16'))['db'];function respondWithStatusCode(_0x552516,_0x5a672b){_0x5a672b=_0x5a672b||0xcc;return function(_0x349f5f){if(_0x349f5f){return _0x552516[_0x3b39('0x17')](_0x5a672b);}return _0x552516[_0x3b39('0x18')](_0x5a672b)[_0x3b39('0x19')]();};}function respondWithResult(_0xdb260f,_0x1846b4){_0x1846b4=_0x1846b4||0xc8;return function(_0x181ecf){if(_0x181ecf){return _0xdb260f[_0x3b39('0x18')](_0x1846b4)[_0x3b39('0x1a')](_0x181ecf);}};}function respondWithFilteredResult(_0x92d6f6,_0x131654){return function(_0x339943){if(_0x339943){var _0x49974b=typeof _0x131654[_0x3b39('0x1b')]==='undefined'&&typeof _0x131654['limit']===_0x3b39('0x1c');var _0x482b7a=_0x339943[_0x3b39('0x1d')];var _0x1c0614=_0x49974b?0x0:_0x131654[_0x3b39('0x1b')];var _0xb0372=_0x49974b?_0x339943[_0x3b39('0x1d')]:_0x131654['offset']+_0x131654[_0x3b39('0x1e')];var _0x7cb3b6;if(_0xb0372>=_0x482b7a){_0xb0372=_0x482b7a;_0x7cb3b6=0xc8;}else{_0x7cb3b6=0xce;}_0x92d6f6[_0x3b39('0x18')](_0x7cb3b6);return _0x92d6f6[_0x3b39('0x1f')](_0x3b39('0x20'),_0x1c0614+'-'+_0xb0372+'/'+_0x482b7a)['json'](_0x339943);}return null;};}function patchUpdates(_0x6897b5){return function(_0x2d4520){try{jsonpatch[_0x3b39('0x21')](_0x2d4520,_0x6897b5,!![]);}catch(_0x26c1f6){return BPromise[_0x3b39('0x22')](_0x26c1f6);}return _0x2d4520[_0x3b39('0x23')]();};}function saveUpdates(_0x1b115b,_0x3a7e74){return function(_0x2e7f90){if(_0x2e7f90){return _0x2e7f90[_0x3b39('0x24')](_0x1b115b)[_0x3b39('0x25')](function(_0x4ff193){return _0x4ff193;});}return null;};}function removeEntity(_0x5b4501,_0x43004c){return function(_0x1bc138){if(_0x1bc138){return _0x1bc138[_0x3b39('0x26')]()[_0x3b39('0x25')](function(){_0x5b4501['status'](0xcc)[_0x3b39('0x19')]();});}};}function handleEntityNotFound(_0x559924,_0x41337f){return function(_0x69751b){if(!_0x69751b){_0x559924[_0x3b39('0x17')](0x194);}return _0x69751b;};}function handleError(_0x437331,_0x289c4b){_0x289c4b=_0x289c4b||0x1f4;return function(_0x198bb7){logger['error'](_0x198bb7[_0x3b39('0x27')]);if(_0x198bb7[_0x3b39('0x28')]){delete _0x198bb7['name'];}_0x437331[_0x3b39('0x18')](_0x289c4b)['send'](_0x198bb7);};}exports[_0x3b39('0x29')]=function(_0x230d65,_0x13bf18){var _0x1b4c47={},_0x522070={},_0x2c7672={'count':0x0,'rows':[]};var _0x41755b=_[_0x3b39('0x2a')](db[_0x3b39('0x2b')][_0x3b39('0x2c')],function(_0x3cdaa9){return{'name':_0x3cdaa9[_0x3b39('0x2d')],'type':_0x3cdaa9[_0x3b39('0x2e')][_0x3b39('0x2f')]};});_0x522070[_0x3b39('0x30')]=_['map'](_0x41755b,_0x3b39('0x28'));_0x522070[_0x3b39('0x31')]=_['keys'](_0x230d65[_0x3b39('0x31')]);_0x522070['filters']=_[_0x3b39('0x32')](_0x522070[_0x3b39('0x30')],_0x522070['query']);_0x1b4c47[_0x3b39('0x33')]=_[_0x3b39('0x32')](_0x522070[_0x3b39('0x30')],qs[_0x3b39('0x34')](_0x230d65[_0x3b39('0x31')][_0x3b39('0x34')]));_0x1b4c47[_0x3b39('0x33')]=_0x1b4c47[_0x3b39('0x33')][_0x3b39('0x35')]?_0x1b4c47[_0x3b39('0x33')]:_0x522070[_0x3b39('0x30')];if(!_0x230d65['query'][_0x3b39('0x36')]('nolimit')){_0x1b4c47[_0x3b39('0x1e')]=qs[_0x3b39('0x1e')](_0x230d65[_0x3b39('0x31')][_0x3b39('0x1e')]);_0x1b4c47[_0x3b39('0x1b')]=qs[_0x3b39('0x1b')](_0x230d65['query'][_0x3b39('0x1b')]);}_0x1b4c47[_0x3b39('0x37')]=qs['sort'](_0x230d65[_0x3b39('0x31')][_0x3b39('0x38')]);_0x1b4c47[_0x3b39('0x39')]=qs[_0x3b39('0x3a')](_[_0x3b39('0x3b')](_0x230d65[_0x3b39('0x31')],_0x522070['filters']),_0x41755b);if(_0x230d65[_0x3b39('0x31')][_0x3b39('0x3c')]){_0x1b4c47[_0x3b39('0x39')]=_[_0x3b39('0x3d')](_0x1b4c47['where'],{'$or':_[_0x3b39('0x2a')](_0x41755b,function(_0x434c86){if(_0x434c86[_0x3b39('0x2e')]!==_0x3b39('0x3e')){var _0x1679c5={};_0x1679c5[_0x434c86[_0x3b39('0x28')]]={'$like':'%'+_0x230d65['query'][_0x3b39('0x3c')]+'%'};return _0x1679c5;}})});}_0x1b4c47=_['merge']({},_0x1b4c47,_0x230d65['options']);var _0x1a01ba={'where':_0x1b4c47[_0x3b39('0x39')]};return db[_0x3b39('0x2b')][_0x3b39('0x1d')](_0x1a01ba)['then'](function(_0x59c00e){_0x2c7672[_0x3b39('0x1d')]=_0x59c00e;if(_0x230d65[_0x3b39('0x31')][_0x3b39('0x3f')]){_0x1b4c47[_0x3b39('0x40')]=[{'all':!![]}];}return db[_0x3b39('0x2b')][_0x3b39('0x41')](_0x1b4c47);})[_0x3b39('0x25')](function(_0x582b5a){_0x2c7672[_0x3b39('0x42')]=_0x582b5a;return _0x2c7672;})[_0x3b39('0x25')](respondWithFilteredResult(_0x13bf18,_0x1b4c47))['catch'](handleError(_0x13bf18,null));};exports[_0x3b39('0x43')]=function(_0x29ad9f,_0x5b6e7e){var _0x2efbc3={'raw':!![],'where':{'id':_0x29ad9f[_0x3b39('0x44')]['id']}},_0x51c2ee={};_0x51c2ee[_0x3b39('0x30')]=_[_0x3b39('0x45')](db[_0x3b39('0x2b')][_0x3b39('0x2c')]);_0x51c2ee[_0x3b39('0x31')]=_[_0x3b39('0x45')](_0x29ad9f[_0x3b39('0x31')]);_0x51c2ee[_0x3b39('0x3a')]=_[_0x3b39('0x32')](_0x51c2ee[_0x3b39('0x30')],_0x51c2ee[_0x3b39('0x31')]);_0x2efbc3[_0x3b39('0x33')]=_[_0x3b39('0x32')](_0x51c2ee['model'],qs['fields'](_0x29ad9f[_0x3b39('0x31')][_0x3b39('0x34')]));_0x2efbc3[_0x3b39('0x33')]=_0x2efbc3[_0x3b39('0x33')][_0x3b39('0x35')]?_0x2efbc3[_0x3b39('0x33')]:_0x51c2ee[_0x3b39('0x30')];if(_0x29ad9f[_0x3b39('0x31')][_0x3b39('0x3f')]){_0x2efbc3[_0x3b39('0x40')]=[{'all':!![]}];}_0x2efbc3=_['merge']({},_0x2efbc3,_0x29ad9f['options']);return db[_0x3b39('0x2b')]['find'](_0x2efbc3)[_0x3b39('0x25')](handleEntityNotFound(_0x5b6e7e,null))['then'](respondWithResult(_0x5b6e7e,null))[_0x3b39('0x46')](handleError(_0x5b6e7e,null));};exports['create']=function(_0x23585b,_0x1b1610){return db[_0x3b39('0x2b')]['create'](_0x23585b[_0x3b39('0x47')],{})['then'](respondWithResult(_0x1b1610,0xc9))['catch'](handleError(_0x1b1610,null));};exports[_0x3b39('0x24')]=function(_0x2544ea,_0x5ae1d9){if(_0x2544ea['body']['id']){delete _0x2544ea[_0x3b39('0x47')]['id'];}return db[_0x3b39('0x2b')]['find']({'where':{'id':_0x2544ea[_0x3b39('0x44')]['id']}})[_0x3b39('0x25')](handleEntityNotFound(_0x5ae1d9,null))[_0x3b39('0x25')](saveUpdates(_0x2544ea[_0x3b39('0x47')],null))[_0x3b39('0x25')](respondWithResult(_0x5ae1d9,null))[_0x3b39('0x46')](handleError(_0x5ae1d9,null));};exports[_0x3b39('0x26')]=function(_0x331c4a,_0x3be4d5){return db['SugarcrmField'][_0x3b39('0x48')]({'where':{'id':_0x331c4a[_0x3b39('0x44')]['id']}})[_0x3b39('0x25')](handleEntityNotFound(_0x3be4d5,null))[_0x3b39('0x25')](removeEntity(_0x3be4d5,null))['catch'](handleError(_0x3be4d5,null));}; \ No newline at end of file +var _0x370b=['destroy','stack','name','send','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','create','body','catch','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0xcb6c7,_0x11c537){var _0x1ba34f=function(_0x4a1c8d){while(--_0x4a1c8d){_0xcb6c7['push'](_0xcb6c7['shift']());}};_0x1ba34f(++_0x11c537);}(_0x370b,0x1b7));var _0xb370=function(_0xc3b7ff,_0x49d114){_0xc3b7ff=_0xc3b7ff-0x0;var _0x5a991f=_0x370b[_0xc3b7ff];return _0x5a991f;};'use strict';var emlformat=require(_0xb370('0x0'));var rimraf=require(_0xb370('0x1'));var zipdir=require(_0xb370('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb370('0x3'));var Mustache=require(_0xb370('0x4'));var util=require(_0xb370('0x5'));var path=require('path');var sox=require(_0xb370('0x6'));var csv=require(_0xb370('0x7'));var ejs=require(_0xb370('0x8'));var fs=require('fs');var fs_extra=require(_0xb370('0x9'));var _=require('lodash');var squel=require(_0xb370('0xa'));var crypto=require('crypto');var jsforce=require(_0xb370('0xb'));var deskjs=require(_0xb370('0xc'));var toCsv=require(_0xb370('0x7'));var querystring=require(_0xb370('0xd'));var Papa=require(_0xb370('0xe'));var Redis=require('ioredis');var authService=require(_0xb370('0xf'));var qs=require(_0xb370('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb370('0x11'))(_0xb370('0x12'));var utils=require(_0xb370('0x13'));var config=require(_0xb370('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb370('0x15'))['db'];function respondWithStatusCode(_0x111008,_0x1b4f3d){_0x1b4f3d=_0x1b4f3d||0xcc;return function(_0xdef14e){if(_0xdef14e){return _0x111008[_0xb370('0x16')](_0x1b4f3d);}return _0x111008['status'](_0x1b4f3d)[_0xb370('0x17')]();};}function respondWithResult(_0x176ca5,_0x2fbd89){_0x2fbd89=_0x2fbd89||0xc8;return function(_0xdbc8ae){if(_0xdbc8ae){return _0x176ca5[_0xb370('0x18')](_0x2fbd89)[_0xb370('0x19')](_0xdbc8ae);}};}function respondWithFilteredResult(_0x3623ad,_0x5345c2){return function(_0x57a260){if(_0x57a260){var _0x110eec=typeof _0x5345c2[_0xb370('0x1a')]===_0xb370('0x1b')&&typeof _0x5345c2['limit']===_0xb370('0x1b');var _0x2fc166=_0x57a260[_0xb370('0x1c')];var _0x40c602=_0x110eec?0x0:_0x5345c2[_0xb370('0x1a')];var _0x217983=_0x110eec?_0x57a260['count']:_0x5345c2['offset']+_0x5345c2[_0xb370('0x1d')];var _0x18733f;if(_0x217983>=_0x2fc166){_0x217983=_0x2fc166;_0x18733f=0xc8;}else{_0x18733f=0xce;}_0x3623ad['status'](_0x18733f);return _0x3623ad[_0xb370('0x1e')](_0xb370('0x1f'),_0x40c602+'-'+_0x217983+'/'+_0x2fc166)['json'](_0x57a260);}return null;};}function patchUpdates(_0x453c38){return function(_0x8ab3d6){try{jsonpatch[_0xb370('0x20')](_0x8ab3d6,_0x453c38,!![]);}catch(_0x53fe5f){return BPromise[_0xb370('0x21')](_0x53fe5f);}return _0x8ab3d6[_0xb370('0x22')]();};}function saveUpdates(_0x3afc89,_0x122812){return function(_0x54bdd3){if(_0x54bdd3){return _0x54bdd3[_0xb370('0x23')](_0x3afc89)[_0xb370('0x24')](function(_0xc9b9c0){return _0xc9b9c0;});}return null;};}function removeEntity(_0x4c04d9,_0x4fbdc3){return function(_0x3b3ef4){if(_0x3b3ef4){return _0x3b3ef4[_0xb370('0x25')]()['then'](function(){_0x4c04d9[_0xb370('0x18')](0xcc)[_0xb370('0x17')]();});}};}function handleEntityNotFound(_0x3e3807,_0x1c5928){return function(_0x186078){if(!_0x186078){_0x3e3807[_0xb370('0x16')](0x194);}return _0x186078;};}function handleError(_0x26d5e3,_0x64cd6){_0x64cd6=_0x64cd6||0x1f4;return function(_0xe2177f){logger['error'](_0xe2177f[_0xb370('0x26')]);if(_0xe2177f[_0xb370('0x27')]){delete _0xe2177f[_0xb370('0x27')];}_0x26d5e3['status'](_0x64cd6)[_0xb370('0x28')](_0xe2177f);};}exports['index']=function(_0x198039,_0x9bcefa){var _0x54f4b3={},_0x44fcf6={},_0x55ee0c={'count':0x0,'rows':[]};var _0x5b1b82=_['map'](db[_0xb370('0x29')][_0xb370('0x2a')],function(_0x2bf7a2){return{'name':_0x2bf7a2[_0xb370('0x2b')],'type':_0x2bf7a2['type'][_0xb370('0x2c')]};});_0x44fcf6[_0xb370('0x2d')]=_['map'](_0x5b1b82,_0xb370('0x27'));_0x44fcf6[_0xb370('0x2e')]=_[_0xb370('0x2f')](_0x198039[_0xb370('0x2e')]);_0x44fcf6[_0xb370('0x30')]=_[_0xb370('0x31')](_0x44fcf6[_0xb370('0x2d')],_0x44fcf6[_0xb370('0x2e')]);_0x54f4b3['attributes']=_[_0xb370('0x31')](_0x44fcf6['model'],qs[_0xb370('0x32')](_0x198039[_0xb370('0x2e')]['fields']));_0x54f4b3[_0xb370('0x33')]=_0x54f4b3[_0xb370('0x33')]['length']?_0x54f4b3[_0xb370('0x33')]:_0x44fcf6[_0xb370('0x2d')];if(!_0x198039[_0xb370('0x2e')][_0xb370('0x34')]('nolimit')){_0x54f4b3[_0xb370('0x1d')]=qs[_0xb370('0x1d')](_0x198039[_0xb370('0x2e')]['limit']);_0x54f4b3['offset']=qs['offset'](_0x198039['query'][_0xb370('0x1a')]);}_0x54f4b3['order']=qs[_0xb370('0x35')](_0x198039[_0xb370('0x2e')][_0xb370('0x35')]);_0x54f4b3[_0xb370('0x36')]=qs[_0xb370('0x30')](_['pick'](_0x198039[_0xb370('0x2e')],_0x44fcf6[_0xb370('0x30')]),_0x5b1b82);if(_0x198039[_0xb370('0x2e')][_0xb370('0x37')]){_0x54f4b3['where']=_['merge'](_0x54f4b3[_0xb370('0x36')],{'$or':_['map'](_0x5b1b82,function(_0x1f35d9){if(_0x1f35d9['type']!==_0xb370('0x38')){var _0x139204={};_0x139204[_0x1f35d9[_0xb370('0x27')]]={'$like':'%'+_0x198039[_0xb370('0x2e')]['filter']+'%'};return _0x139204;}})});}_0x54f4b3=_[_0xb370('0x39')]({},_0x54f4b3,_0x198039[_0xb370('0x3a')]);var _0x2d692e={'where':_0x54f4b3[_0xb370('0x36')]};return db[_0xb370('0x29')]['count'](_0x2d692e)['then'](function(_0x452579){_0x55ee0c['count']=_0x452579;if(_0x198039[_0xb370('0x2e')][_0xb370('0x3b')]){_0x54f4b3['include']=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x54f4b3);})['then'](function(_0x997da4){_0x55ee0c[_0xb370('0x3c')]=_0x997da4;return _0x55ee0c;})[_0xb370('0x24')](respondWithFilteredResult(_0x9bcefa,_0x54f4b3))['catch'](handleError(_0x9bcefa,null));};exports[_0xb370('0x3d')]=function(_0x57ea30,_0xed4d34){var _0x27af4d={'raw':!![],'where':{'id':_0x57ea30[_0xb370('0x3e')]['id']}},_0x384df4={};_0x384df4[_0xb370('0x2d')]=_[_0xb370('0x2f')](db[_0xb370('0x29')]['rawAttributes']);_0x384df4[_0xb370('0x2e')]=_['keys'](_0x57ea30['query']);_0x384df4[_0xb370('0x30')]=_['intersection'](_0x384df4['model'],_0x384df4[_0xb370('0x2e')]);_0x27af4d[_0xb370('0x33')]=_['intersection'](_0x384df4[_0xb370('0x2d')],qs['fields'](_0x57ea30[_0xb370('0x2e')]['fields']));_0x27af4d[_0xb370('0x33')]=_0x27af4d[_0xb370('0x33')]['length']?_0x27af4d[_0xb370('0x33')]:_0x384df4['model'];if(_0x57ea30[_0xb370('0x2e')][_0xb370('0x3b')]){_0x27af4d[_0xb370('0x3f')]=[{'all':!![]}];}_0x27af4d=_['merge']({},_0x27af4d,_0x57ea30[_0xb370('0x3a')]);return db[_0xb370('0x29')][_0xb370('0x40')](_0x27af4d)['then'](handleEntityNotFound(_0xed4d34,null))[_0xb370('0x24')](respondWithResult(_0xed4d34,null))['catch'](handleError(_0xed4d34,null));};exports[_0xb370('0x41')]=function(_0xfde30c,_0x33312c){return db[_0xb370('0x29')][_0xb370('0x41')](_0xfde30c[_0xb370('0x42')],{})[_0xb370('0x24')](respondWithResult(_0x33312c,0xc9))[_0xb370('0x43')](handleError(_0x33312c,null));};exports[_0xb370('0x23')]=function(_0x28c1aa,_0x36e498){if(_0x28c1aa['body']['id']){delete _0x28c1aa[_0xb370('0x42')]['id'];}return db[_0xb370('0x29')][_0xb370('0x40')]({'where':{'id':_0x28c1aa[_0xb370('0x3e')]['id']}})[_0xb370('0x24')](handleEntityNotFound(_0x36e498,null))['then'](saveUpdates(_0x28c1aa[_0xb370('0x42')],null))[_0xb370('0x24')](respondWithResult(_0x36e498,null))['catch'](handleError(_0x36e498,null));};exports[_0xb370('0x25')]=function(_0x41350e,_0x3764ed){return db[_0xb370('0x29')]['find']({'where':{'id':_0x41350e[_0xb370('0x3e')]['id']}})[_0xb370('0x24')](handleEntityNotFound(_0x3764ed,null))[_0xb370('0x24')](removeEntity(_0x3764ed,null))['catch'](handleError(_0x3764ed,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index fd54c47..9277e59 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.model.js +++ b/server/api/intSugarcrmField/intSugarcrmField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e97=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e97,0xc4));var _0x78e9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e97[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x78e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x78e9('0x1'));var moment=require(_0x78e9('0x2'));var BPromise=require(_0x78e9('0x3'));var rp=require(_0x78e9('0x4'));var fs=require('fs');var path=require(_0x78e9('0x5'));var rimraf=require(_0x78e9('0x6'));var config=require(_0x78e9('0x7'));var attributes=require(_0x78e9('0x8'));module[_0x78e9('0x9')]=function(_0x23ba7c,_0x4482a0){return _0x23ba7c[_0x78e9('0xa')](_0x78e9('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x78e9('0xc'),'fields':['idField',_0x78e9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x869c=['lodash','util','api','moment','bluebird','path','../../config/environment','exports','SugarcrmField','sugarcrm_unique_index','idField','FieldId'];(function(_0x492b49,_0x396492){var _0x57b8c7=function(_0x546c8f){while(--_0x546c8f){_0x492b49['push'](_0x492b49['shift']());}};_0x57b8c7(++_0x396492);}(_0x869c,0x174));var _0xc869=function(_0x125b28,_0x568843){_0x125b28=_0x125b28-0x0;var _0x51d281=_0x869c[_0x125b28];return _0x51d281;};'use strict';var _=require(_0xc869('0x0'));var util=require(_0xc869('0x1'));var logger=require('../../config/logger')(_0xc869('0x2'));var moment=require(_0xc869('0x3'));var BPromise=require(_0xc869('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc869('0x5'));var rimraf=require('rimraf');var config=require(_0xc869('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0xc869('0x7')]=function(_0x11761f,_0x274a78){return _0x11761f['define'](_0xc869('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xc869('0x9'),'fields':[_0xc869('0xa'),_0xc869('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 4392e2b..4e2ac0f 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1da7=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2ff4b6,_0x51065e){var _0xe0679a=function(_0x5b7e11){while(--_0x5b7e11){_0x2ff4b6['push'](_0x2ff4b6['shift']());}};_0xe0679a(++_0x51065e);}(_0x1da7,0xe4));var _0x71da=function(_0x54206c,_0x5e1ea){_0x54206c=_0x54206c-0x0;var _0x46a89a=_0x1da7[_0x54206c];return _0x46a89a;};'use strict';var _=require(_0x71da('0x0'));var util=require(_0x71da('0x1'));var moment=require(_0x71da('0x2'));var BPromise=require(_0x71da('0x3'));var rs=require(_0x71da('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71da('0x5'))['db'];var utils=require(_0x71da('0x6'));var logger=require(_0x71da('0x7'))(_0x71da('0x8'));var config=require(_0x71da('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x71da('0xa')][_0x71da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x586a38,_0x45564a,_0x57363e){return new BPromise(function(_0x476c31,_0x5d9009){return client[_0x71da('0xc')](_0x586a38,_0x57363e)[_0x71da('0xd')](function(_0x50200a){logger[_0x71da('0xe')](_0x71da('0xf'),_0x45564a,'request\x20sent');logger[_0x71da('0x10')](_0x71da('0x11'),_0x45564a,_0x71da('0x12'),JSON[_0x71da('0x13')](_0x50200a));if(_0x50200a[_0x71da('0x14')]){if(_0x50200a[_0x71da('0x14')][_0x71da('0x15')]===0x1f4){logger[_0x71da('0x14')](_0x71da('0xf'),_0x45564a,_0x50200a['error'][_0x71da('0x16')]);return _0x5d9009(_0x50200a['error']['message']);}logger[_0x71da('0x14')](_0x71da('0xf'),_0x45564a,_0x50200a['error'][_0x71da('0x16')]);return _0x476c31(_0x50200a['error'][_0x71da('0x16')]);}else{logger[_0x71da('0xe')](_0x71da('0xf'),_0x45564a,'request\x20sent');_0x476c31(_0x50200a[_0x71da('0x17')][_0x71da('0x16')]);}})[_0x71da('0x18')](function(_0x21c565){logger['error'](_0x71da('0xf'),_0x45564a,_0x21c565);_0x5d9009(_0x21c565);});});} \ No newline at end of file +var _0x5218=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3652eb,_0xeda117){var _0x414f2e=function(_0x4f0cb4){while(--_0x4f0cb4){_0x3652eb['push'](_0x3652eb['shift']());}};_0x414f2e(++_0xeda117);}(_0x5218,0x165));var _0x8521=function(_0x5d21c1,_0x33c978){_0x5d21c1=_0x5d21c1-0x0;var _0x339eba=_0x5218[_0x5d21c1];return _0x339eba;};'use strict';var _=require(_0x8521('0x0'));var util=require(_0x8521('0x1'));var moment=require('moment');var BPromise=require(_0x8521('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8521('0x3'));var db=require(_0x8521('0x4'))['db'];var utils=require(_0x8521('0x5'));var logger=require(_0x8521('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8521('0x7'));var client=jayson[_0x8521('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5286fc,_0x3b9b09,_0x48de42){return new BPromise(function(_0x31a623,_0x8bcb88){return client[_0x8521('0x9')](_0x5286fc,_0x48de42)['then'](function(_0x55e8c5){logger[_0x8521('0xa')](_0x8521('0xb'),_0x3b9b09,_0x8521('0xc'));logger[_0x8521('0xd')](_0x8521('0xe'),_0x3b9b09,'request\x20sent',JSON[_0x8521('0xf')](_0x55e8c5));if(_0x55e8c5[_0x8521('0x10')]){if(_0x55e8c5[_0x8521('0x10')][_0x8521('0x11')]===0x1f4){logger['error'](_0x8521('0xb'),_0x3b9b09,_0x55e8c5[_0x8521('0x10')][_0x8521('0x12')]);return _0x8bcb88(_0x55e8c5[_0x8521('0x10')][_0x8521('0x12')]);}logger[_0x8521('0x10')](_0x8521('0xb'),_0x3b9b09,_0x55e8c5[_0x8521('0x10')][_0x8521('0x12')]);return _0x31a623(_0x55e8c5['error'][_0x8521('0x12')]);}else{logger[_0x8521('0xa')](_0x8521('0xb'),_0x3b9b09,_0x8521('0xc'));_0x31a623(_0x55e8c5[_0x8521('0x13')][_0x8521('0x12')]);}})[_0x8521('0x14')](function(_0x3bd266){logger[_0x8521('0x10')](_0x8521('0xb'),_0x3b9b09,_0x3bd266);_0x8bcb88(_0x3bd266);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b29591b..a3bb342 100644 --- a/server/api/intVtigerAccount/index.js +++ b/server/api/intVtigerAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe31=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x8a7078,_0x1443d7){var _0x3449f8=function(_0x54c004){while(--_0x54c004){_0x8a7078['push'](_0x8a7078['shift']());}};_0x3449f8(++_0x1443d7);}(_0xbe31,0x83));var _0x1be3=function(_0x21090f,_0x5b73cc){_0x21090f=_0x21090f-0x0;var _0x5cbfe7=_0xbe31[_0x21090f];return _0x5cbfe7;};'use strict';var multer=require('multer');var util=require(_0x1be3('0x0'));var path=require(_0x1be3('0x1'));var timeout=require(_0x1be3('0x2'));var express=require(_0x1be3('0x3'));var router=express[_0x1be3('0x4')]();var fs_extra=require(_0x1be3('0x5'));var auth=require(_0x1be3('0x6'));var interaction=require(_0x1be3('0x7'));var config=require(_0x1be3('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x1be3('0x9')]('/',auth['isAuthenticated'](),controller[_0x1be3('0xa')]);router[_0x1be3('0x9')](_0x1be3('0xb'),auth[_0x1be3('0xc')](),controller[_0x1be3('0xd')]);router[_0x1be3('0x9')](_0x1be3('0xe'),auth[_0x1be3('0xc')](),controller[_0x1be3('0xf')]);router[_0x1be3('0x9')]('/:id/fields',auth[_0x1be3('0xc')](),controller[_0x1be3('0x10')]);router[_0x1be3('0x11')]('/',auth[_0x1be3('0xc')](),controller[_0x1be3('0x12')]);router[_0x1be3('0x11')](_0x1be3('0xe'),auth[_0x1be3('0xc')](),controller[_0x1be3('0x13')]);router['put'](_0x1be3('0xb'),auth['isAuthenticated'](),controller[_0x1be3('0x14')]);router[_0x1be3('0x15')]('/:id',auth[_0x1be3('0xc')](),controller['destroy']);module[_0x1be3('0x16')]=router; \ No newline at end of file +var _0x89c3=['get','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x45e832,_0x139eb0){var _0xcd27cb=function(_0x3b2b5c){while(--_0x3b2b5c){_0x45e832['push'](_0x45e832['shift']());}};_0xcd27cb(++_0x139eb0);}(_0x89c3,0xff));var _0x389c=function(_0x11ad26,_0x372588){_0x11ad26=_0x11ad26-0x0;var _0x509e99=_0x89c3[_0x11ad26];return _0x509e99;};'use strict';var multer=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var path=require(_0x389c('0x2'));var timeout=require(_0x389c('0x3'));var express=require(_0x389c('0x4'));var router=express[_0x389c('0x5')]();var fs_extra=require(_0x389c('0x6'));var auth=require(_0x389c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x389c('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x389c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x389c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x389c('0xa')]);router[_0x389c('0x9')](_0x389c('0xb'),auth[_0x389c('0xc')](),controller[_0x389c('0xd')]);router[_0x389c('0x9')](_0x389c('0xe'),auth[_0x389c('0xc')](),controller[_0x389c('0xf')]);router['post']('/',auth[_0x389c('0xc')](),controller[_0x389c('0x10')]);router[_0x389c('0x11')](_0x389c('0xb'),auth[_0x389c('0xc')](),controller['addConfiguration']);router['put'](_0x389c('0x12'),auth[_0x389c('0xc')](),controller[_0x389c('0x13')]);router['delete'](_0x389c('0x12'),auth['isAuthenticated'](),controller[_0x389c('0x14')]);module[_0x389c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index ef2f8bc..1ce1ce4 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.attributes.js +++ b/server/api/intVtigerAccount/intVtigerAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a22=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a22,0x67));var _0x20a2=function(_0x5b614c,_0xd1581b){_0x5b614c=_0x5b614c-0x0;var _0x1391ef=_0x0a22[_0x5b614c];return _0x1391ef;};'use strict';var Sequelize=require(_0x20a2('0x0'));module[_0x20a2('0x1')]={'name':{'type':Sequelize[_0x20a2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x20a2('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x20a2('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xce48=['STRING','HelpDesk','sequelize','exports'];(function(_0x16d028,_0x38dc25){var _0x2dbdb3=function(_0x455f3d){while(--_0x455f3d){_0x16d028['push'](_0x16d028['shift']());}};_0x2dbdb3(++_0x38dc25);}(_0xce48,0x19e));var _0x8ce4=function(_0xa41df9,_0x20fed0){_0xa41df9=_0xa41df9-0x0;var _0x342a45=_0xce48[_0xa41df9];return _0x342a45;};'use strict';var Sequelize=require(_0x8ce4('0x0'));module[_0x8ce4('0x1')]={'name':{'type':Sequelize[_0x8ce4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ce4('0x2')]},'username':{'type':Sequelize[_0x8ce4('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8ce4('0x2')],'allowNull':![],'defaultValue':_0x8ce4('0x3')},'remoteUri':{'type':Sequelize[_0x8ce4('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8ce4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 32dfc8b..de99b42 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.controller.js +++ b/server/api/intVtigerAccount/intVtigerAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeed4=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','remoteUri','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','POST','login','result','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeed4,0x64));var _0x4eed=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0xeed4[_0x25a0b9];return _0x30b9ab;};'use strict';var emlformat=require(_0x4eed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4eed('0x1'));var jsonpatch=require(_0x4eed('0x2'));var rp=require(_0x4eed('0x3'));var moment=require(_0x4eed('0x4'));var BPromise=require(_0x4eed('0x5'));var Mustache=require(_0x4eed('0x6'));var util=require(_0x4eed('0x7'));var path=require('path');var sox=require(_0x4eed('0x8'));var csv=require(_0x4eed('0x9'));var ejs=require(_0x4eed('0xa'));var fs=require('fs');var fs_extra=require(_0x4eed('0xb'));var _=require(_0x4eed('0xc'));var squel=require(_0x4eed('0xd'));var crypto=require(_0x4eed('0xe'));var jsforce=require(_0x4eed('0xf'));var deskjs=require(_0x4eed('0x10'));var toCsv=require(_0x4eed('0x9'));var querystring=require(_0x4eed('0x11'));var Papa=require(_0x4eed('0x12'));var Redis=require(_0x4eed('0x13'));var authService=require(_0x4eed('0x14'));var qs=require(_0x4eed('0x15'));var as=require(_0x4eed('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4eed('0x17'))(_0x4eed('0x18'));var utils=require(_0x4eed('0x19'));var config=require(_0x4eed('0x1a'));var licenseUtil=require(_0x4eed('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4eed('0x1c'));function respondWithStatusCode(_0x19a152,_0x20ed07){_0x20ed07=_0x20ed07||0xcc;return function(_0x3de561){if(_0x3de561){return _0x19a152[_0x4eed('0x1d')](_0x20ed07);}return _0x19a152[_0x4eed('0x1e')](_0x20ed07)['end']();};}function respondWithResult(_0x44e222,_0x5ad2c4){_0x5ad2c4=_0x5ad2c4||0xc8;return function(_0x21d1ea){if(_0x21d1ea){return _0x44e222['status'](_0x5ad2c4)[_0x4eed('0x1f')](_0x21d1ea);}};}function respondWithFilteredResult(_0xdcec49,_0x131b72){return function(_0x218fc3){if(_0x218fc3){var _0xa7eb08=typeof _0x131b72[_0x4eed('0x20')]===_0x4eed('0x21')&&typeof _0x131b72[_0x4eed('0x22')]==='undefined';var _0x53e5f3=_0x218fc3[_0x4eed('0x23')];var _0x1d4bc0=_0xa7eb08?0x0:_0x131b72[_0x4eed('0x20')];var _0x4ce058=_0xa7eb08?_0x218fc3['count']:_0x131b72[_0x4eed('0x20')]+_0x131b72[_0x4eed('0x22')];var _0x4567de;if(_0x4ce058>=_0x53e5f3){_0x4ce058=_0x53e5f3;_0x4567de=0xc8;}else{_0x4567de=0xce;}_0xdcec49[_0x4eed('0x1e')](_0x4567de);return _0xdcec49[_0x4eed('0x24')](_0x4eed('0x25'),_0x1d4bc0+'-'+_0x4ce058+'/'+_0x53e5f3)[_0x4eed('0x1f')](_0x218fc3);}return null;};}function patchUpdates(_0x226e07){return function(_0x167b3a){try{jsonpatch['apply'](_0x167b3a,_0x226e07,!![]);}catch(_0x431372){return BPromise[_0x4eed('0x26')](_0x431372);}return _0x167b3a[_0x4eed('0x27')]();};}function saveUpdates(_0xa1131a,_0x1b4809){return function(_0x11f8bd){if(_0x11f8bd){return _0x11f8bd[_0x4eed('0x28')](_0xa1131a)['then'](function(_0x169d94){return _0x169d94;});}return null;};}function removeEntity(_0x5bac59,_0x527212){return function(_0xcb62e7){if(_0xcb62e7){return _0xcb62e7[_0x4eed('0x29')]()[_0x4eed('0x2a')](function(){_0x5bac59[_0x4eed('0x1e')](0xcc)[_0x4eed('0x2b')]();});}};}function handleEntityNotFound(_0xe0ebbb,_0xf00ba2){return function(_0x6ea9d7){if(!_0x6ea9d7){_0xe0ebbb[_0x4eed('0x1d')](0x194);}return _0x6ea9d7;};}function handleError(_0x764a5d,_0x13e044){_0x13e044=_0x13e044||0x1f4;return function(_0x3a2a6a){logger[_0x4eed('0x2c')](_0x3a2a6a[_0x4eed('0x2d')]);if(_0x3a2a6a[_0x4eed('0x2e')]){delete _0x3a2a6a[_0x4eed('0x2e')];}_0x764a5d[_0x4eed('0x1e')](_0x13e044)[_0x4eed('0x2f')](_0x3a2a6a);};}exports[_0x4eed('0x30')]=function(_0x22c3c3,_0x1698d7){var _0x28295b={},_0x11ad6f={},_0x1da87a={'count':0x0,'rows':[]};var _0x48075e=_[_0x4eed('0x31')](db[_0x4eed('0x32')][_0x4eed('0x33')],function(_0xe80cbb){return{'name':_0xe80cbb['fieldName'],'type':_0xe80cbb[_0x4eed('0x34')][_0x4eed('0x35')]};});_0x11ad6f['model']=_['map'](_0x48075e,_0x4eed('0x2e'));_0x11ad6f[_0x4eed('0x36')]=_[_0x4eed('0x37')](_0x22c3c3[_0x4eed('0x36')]);_0x11ad6f[_0x4eed('0x38')]=_['intersection'](_0x11ad6f[_0x4eed('0x39')],_0x11ad6f['query']);_0x28295b[_0x4eed('0x3a')]=_[_0x4eed('0x3b')](_0x11ad6f['model'],qs[_0x4eed('0x3c')](_0x22c3c3['query'][_0x4eed('0x3c')]));_0x28295b[_0x4eed('0x3a')]=_0x28295b[_0x4eed('0x3a')][_0x4eed('0x3d')]?_0x28295b[_0x4eed('0x3a')]:_0x11ad6f['model'];if(!_0x22c3c3['query'][_0x4eed('0x3e')](_0x4eed('0x3f'))){_0x28295b[_0x4eed('0x22')]=qs[_0x4eed('0x22')](_0x22c3c3[_0x4eed('0x36')]['limit']);_0x28295b[_0x4eed('0x20')]=qs[_0x4eed('0x20')](_0x22c3c3[_0x4eed('0x36')][_0x4eed('0x20')]);}_0x28295b[_0x4eed('0x40')]=qs['sort'](_0x22c3c3[_0x4eed('0x36')][_0x4eed('0x41')]);_0x28295b[_0x4eed('0x42')]=qs[_0x4eed('0x38')](_[_0x4eed('0x43')](_0x22c3c3['query'],_0x11ad6f['filters']),_0x48075e);if(_0x22c3c3[_0x4eed('0x36')][_0x4eed('0x44')]){_0x28295b[_0x4eed('0x42')]=_[_0x4eed('0x45')](_0x28295b['where'],{'$or':_['map'](_0x48075e,function(_0x1fe904){if(_0x1fe904[_0x4eed('0x34')]!=='VIRTUAL'){var _0x30ec48={};_0x30ec48[_0x1fe904[_0x4eed('0x2e')]]={'$like':'%'+_0x22c3c3[_0x4eed('0x36')][_0x4eed('0x44')]+'%'};return _0x30ec48;}})});}_0x28295b=_[_0x4eed('0x45')]({},_0x28295b,_0x22c3c3[_0x4eed('0x46')]);var _0x2ec570={'where':_0x28295b[_0x4eed('0x42')]};return db[_0x4eed('0x32')]['count'](_0x2ec570)['then'](function(_0x27743a){_0x1da87a[_0x4eed('0x23')]=_0x27743a;if(_0x22c3c3['query'][_0x4eed('0x47')]){_0x28295b[_0x4eed('0x48')]=[{'all':!![]}];}return db[_0x4eed('0x32')][_0x4eed('0x49')](_0x28295b);})[_0x4eed('0x2a')](function(_0x40c04c){_0x1da87a['rows']=_0x40c04c;return _0x1da87a;})[_0x4eed('0x2a')](respondWithFilteredResult(_0x1698d7,_0x28295b))[_0x4eed('0x4a')](handleError(_0x1698d7,null));};exports[_0x4eed('0x4b')]=function(_0x9957d,_0x4a13ed){var _0x4ca0bd={'raw':![],'where':{'id':_0x9957d[_0x4eed('0x4c')]['id']}},_0x5d8053={};_0x5d8053[_0x4eed('0x39')]=_['keys'](db['VtigerAccount'][_0x4eed('0x33')]);_0x5d8053[_0x4eed('0x36')]=_[_0x4eed('0x37')](_0x9957d[_0x4eed('0x36')]);_0x5d8053[_0x4eed('0x38')]=_['intersection'](_0x5d8053[_0x4eed('0x39')],_0x5d8053['query']);_0x4ca0bd['attributes']=_['intersection'](_0x5d8053[_0x4eed('0x39')],qs[_0x4eed('0x3c')](_0x9957d[_0x4eed('0x36')][_0x4eed('0x3c')]));_0x4ca0bd[_0x4eed('0x3a')]=_0x4ca0bd[_0x4eed('0x3a')][_0x4eed('0x3d')]?_0x4ca0bd[_0x4eed('0x3a')]:_0x5d8053[_0x4eed('0x39')];if(_0x9957d['query'][_0x4eed('0x47')]){_0x4ca0bd['include']=[{'all':!![]}];}_0x4ca0bd=_[_0x4eed('0x45')]({},_0x4ca0bd,_0x9957d['options']);return db[_0x4eed('0x32')][_0x4eed('0x4d')](_0x4ca0bd)[_0x4eed('0x2a')](handleEntityNotFound(_0x4a13ed,null))[_0x4eed('0x2a')](respondWithResult(_0x4a13ed,null))['catch'](handleError(_0x4a13ed,null));};exports[_0x4eed('0x4e')]=function(_0x28268b,_0x5b9393){return db[_0x4eed('0x32')][_0x4eed('0x4e')](_0x28268b[_0x4eed('0x4f')],{})[_0x4eed('0x2a')](respondWithResult(_0x5b9393,0xc9))[_0x4eed('0x4a')](handleError(_0x5b9393,null));};exports[_0x4eed('0x28')]=function(_0x304b60,_0x2e60ce){if(_0x304b60[_0x4eed('0x4f')]['id']){delete _0x304b60[_0x4eed('0x4f')]['id'];}return db[_0x4eed('0x32')][_0x4eed('0x4d')]({'where':{'id':_0x304b60['params']['id']}})[_0x4eed('0x2a')](handleEntityNotFound(_0x2e60ce,null))[_0x4eed('0x2a')](saveUpdates(_0x304b60['body'],null))[_0x4eed('0x2a')](respondWithResult(_0x2e60ce,null))[_0x4eed('0x4a')](handleError(_0x2e60ce,null));};exports[_0x4eed('0x29')]=function(_0x2e6f53,_0x3ae86c){return db[_0x4eed('0x32')]['find']({'where':{'id':_0x2e6f53[_0x4eed('0x4c')]['id']}})[_0x4eed('0x2a')](handleEntityNotFound(_0x3ae86c,null))[_0x4eed('0x2a')](removeEntity(_0x3ae86c,null))[_0x4eed('0x4a')](handleError(_0x3ae86c,null));};exports[_0x4eed('0x50')]=function(_0x1eb4a2,_0x122958,_0xc4aa98){var _0x47cc16={};var _0x12593d={};var _0x22d146;var _0x40717f;return db[_0x4eed('0x32')][_0x4eed('0x51')]({'where':{'id':_0x1eb4a2[_0x4eed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x122958,null))[_0x4eed('0x2a')](function(_0x44c978){if(_0x44c978){_0x22d146=_0x44c978;_0x12593d[_0x4eed('0x39')]=_['keys'](db[_0x4eed('0x52')][_0x4eed('0x33')]);_0x12593d[_0x4eed('0x36')]=_[_0x4eed('0x37')](_0x1eb4a2[_0x4eed('0x36')]);_0x12593d['filters']=_[_0x4eed('0x3b')](_0x12593d[_0x4eed('0x39')],_0x12593d[_0x4eed('0x36')]);_0x47cc16[_0x4eed('0x3a')]=_[_0x4eed('0x3b')](_0x12593d[_0x4eed('0x39')],qs['fields'](_0x1eb4a2[_0x4eed('0x36')][_0x4eed('0x3c')]));_0x47cc16['attributes']=_0x47cc16[_0x4eed('0x3a')][_0x4eed('0x3d')]?_0x47cc16[_0x4eed('0x3a')]:_0x12593d[_0x4eed('0x39')];_0x47cc16[_0x4eed('0x40')]=qs['sort'](_0x1eb4a2['query'][_0x4eed('0x41')]);_0x47cc16[_0x4eed('0x42')]=qs['filters'](_[_0x4eed('0x43')](_0x1eb4a2['query'],_0x12593d[_0x4eed('0x38')]));if(_0x1eb4a2['query'][_0x4eed('0x44')]){_0x47cc16[_0x4eed('0x42')]=_[_0x4eed('0x45')](_0x47cc16['where'],{'$or':_[_0x4eed('0x31')](_0x47cc16[_0x4eed('0x3a')],function(_0x3978c8){var _0x38d5a={};_0x38d5a[_0x3978c8]={'$like':'%'+_0x1eb4a2['query'][_0x4eed('0x44')]+'%'};return _0x38d5a;})});}_0x47cc16=_[_0x4eed('0x45')]({},_0x47cc16,_0x1eb4a2['options']);return _0x22d146[_0x4eed('0x50')](_0x47cc16);}})['then'](function(_0x24e8f1){if(_0x24e8f1){_0x40717f=_0x24e8f1[_0x4eed('0x3d')];if(!_0x1eb4a2[_0x4eed('0x36')][_0x4eed('0x3e')]('nolimit')){_0x47cc16[_0x4eed('0x22')]=qs[_0x4eed('0x22')](_0x1eb4a2[_0x4eed('0x36')][_0x4eed('0x22')]);_0x47cc16[_0x4eed('0x20')]=qs['offset'](_0x1eb4a2[_0x4eed('0x36')]['offset']);}return _0x22d146['getConfigurations'](_0x47cc16);}})['then'](function(_0x54e362){if(_0x54e362){return _0x54e362?{'count':_0x40717f,'rows':_0x54e362}:null;}})[_0x4eed('0x2a')](respondWithResult(_0x122958,null))['catch'](handleError(_0x122958,null));};exports['addConfiguration']=function(_0x594446,_0x5e3bd3,_0x35bbc6){if(_0x594446[_0x4eed('0x4f')]['id']){delete _0x594446[_0x4eed('0x4f')]['id'];}return db['VtigerAccount'][_0x4eed('0x51')]({'where':{'id':_0x594446[_0x4eed('0x4c')]['id']}})[_0x4eed('0x2a')](handleEntityNotFound(_0x5e3bd3,null))[_0x4eed('0x2a')](function(_0x3dc431){if(_0x3dc431){_0x594446[_0x4eed('0x4f')]['AccountId']=_0x3dc431['id'];_0x594446[_0x4eed('0x4f')][_0x4eed('0x53')]=integrations[_0x4eed('0x54')](_0x594446['body'][_0x4eed('0x55')],_0x594446[_0x4eed('0x4f')][_0x4eed('0x34')]);_0x594446['body']['Descriptions']=integrations[_0x4eed('0x56')](_0x594446['body'][_0x4eed('0x55')],_0x594446['body']['type']);return db['VtigerConfiguration'][_0x4eed('0x4e')](_0x594446['body'],{'include':[{'model':db[_0x4eed('0x57')],'as':_0x4eed('0x53')},{'model':db[_0x4eed('0x57')],'as':_0x4eed('0x58')}]});}return null;})[_0x4eed('0x2a')](respondWithResult(_0x5e3bd3,null))[_0x4eed('0x4a')](handleError(_0x5e3bd3,null));};var md5=require(_0x4eed('0x59'));exports[_0x4eed('0x5a')]=function(_0x43456b,_0x3d5ce9,_0xb404e4){var _0x2a2fe6=null;var _0x49a4da=null;var _0x5bfd=null;var _0x238723=null;var _0x576050='';return db[_0x4eed('0x32')][_0x4eed('0x51')]({'where':{'id':_0x43456b[_0x4eed('0x4c')]['id']},'attributes':['id',_0x4eed('0x2e'),_0x4eed('0x5b'),'description','moduleName',_0x4eed('0x5c'),'serverUrl',_0x4eed('0x5d')]})[_0x4eed('0x2a')](handleEntityNotFound(_0x3d5ce9,null))[_0x4eed('0x2a')](function(_0x3cda36){if(_0x3cda36){_0x2a2fe6=_0x3cda36[_0x4eed('0x5b')];_0x49a4da=_0x3cda36[_0x4eed('0x5d')];_0x5bfd=_0x3cda36[_0x4eed('0x5e')];_0x576050=_0x3cda36[_0x4eed('0x5c')];var _0x63a8a9=_0x576050[_0x4eed('0x5f')](-0x1);if(_0x63a8a9==='/'){_0x576050=_0x576050[_0x4eed('0x60')](0x0,_0x576050[_0x4eed('0x61')](_0x63a8a9));}_0x238723=util[_0x4eed('0x62')](_0x4eed('0x63'),_0x576050);var _0x397b59={'method':'GET','uri':_0x238723,'qs':{'operation':'getchallenge','username':_0x3cda36['username']},'json':!![]};return rp(_0x397b59);}})[_0x4eed('0x2a')](function(_0x5d02a3){if(_0x5d02a3['success']){var _0x301abf={'method':_0x4eed('0x64'),'uri':_0x238723,'form':{'operation':_0x4eed('0x65'),'username':_0x2a2fe6,'accessKey':md5(_0x5d02a3[_0x4eed('0x66')]['token']+_0x49a4da)},'json':!![]};return rp(_0x301abf);}})[_0x4eed('0x2a')](function(_0x49ec00){if(_0x49ec00['success']){var _0x5ae2f9={'method':'GET','uri':_0x238723,'qs':{'operation':_0x4eed('0x67'),'username':_0x2a2fe6,'sessionName':_0x49ec00[_0x4eed('0x66')][_0x4eed('0x68')],'elementType':_0x5bfd},'json':!![]};return rp(_0x5ae2f9);}})[_0x4eed('0x2a')](function(_0xc6d571){if(_0xc6d571['success']){var _0x433cd2=[_0x4eed('0x69'),_0x4eed('0x6a'),_0x4eed('0x6b')];_[_0x4eed('0x6c')](_0xc6d571[_0x4eed('0x66')][_0x4eed('0x3c')],function(_0x88dd8a){return _0x433cd2[_0x4eed('0x6d')](_0x88dd8a[_0x4eed('0x34')][_0x4eed('0x2e')]);});_[_0x4eed('0x6c')](_0xc6d571[_0x4eed('0x66')][_0x4eed('0x3c')],function(_0x505c9f){return _0x505c9f[_0x4eed('0x6e')]===_0x4eed('0x6f');});return{'count':_0xc6d571['result']['fields'][_0x4eed('0x3d')],'rows':_[_0x4eed('0x31')](_0xc6d571[_0x4eed('0x66')]['fields'],function(_0x249cf0){return{'id':_0x249cf0[_0x4eed('0x2e')],'name':_0x249cf0[_0x4eed('0x70')],'custom':_['startsWith'](_0x249cf0[_0x4eed('0x2e')],'cf_')?!![]:![],'options':_0x249cf0[_0x4eed('0x34')][_0x4eed('0x2e')]===_0x4eed('0x71')&&_0x249cf0[_0x4eed('0x34')]['picklistValues']['length']>0x0?_[_0x4eed('0x31')](_0x249cf0[_0x4eed('0x34')][_0x4eed('0x72')],function(_0x43c4f4){return{'name':_0x43c4f4[_0x4eed('0x70')],'value':_0x43c4f4['value']};}):[]};})};}})['then'](respondWithResult(_0x3d5ce9,null))[_0x4eed('0x4a')](function(_0x10dbb1){console[_0x4eed('0x73')](_0x4eed('0x74')+_0x10dbb1);var _0x2b9934=_0x43456b['query'][_0x4eed('0x75')]?0x1f4:_0x10dbb1[_0x4eed('0x76')]||0x1f4;logger[_0x4eed('0x2c')]('getFields,\x20%s,\x20%s,\x20%s',_0x4eed('0x5a'),_0x2b9934,JSON['stringify'](_0x10dbb1));delete _0x10dbb1[_0x4eed('0x2e')];if(_0x2b9934===0x191){_0x2b9934=0x190;}_0x3d5ce9[_0x4eed('0x1e')](_0x2b9934)[_0x4eed('0x2f')](_0x43456b[_0x4eed('0x36')][_0x4eed('0x75')]?{'message':_0x4eed('0x77'),'statusCode':_0x10dbb1['statusCode']}:_0x10dbb1);});}; \ No newline at end of file +var _0xd76f=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','count','includeAll','include','VtigerAccount','findAll','rows','catch','attributes','options','create','body','find','params','destroy','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','remoteUri','serverUrl','username','accessKey','moduleName','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','owner','includes','editable','false','cf_','picklist','picklistValues','label','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2e0f5c,_0x3771d1){var _0x1b6047=function(_0x538af3){while(--_0x538af3){_0x2e0f5c['push'](_0x2e0f5c['shift']());}};_0x1b6047(++_0x3771d1);}(_0xd76f,0x67));var _0xfd76=function(_0x1354c9,_0x475347){_0x1354c9=_0x1354c9-0x0;var _0x116916=_0xd76f[_0x1354c9];return _0x116916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd76('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd76('0x1'));var rp=require('request-promise');var moment=require(_0xfd76('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfd76('0x3'));var util=require(_0xfd76('0x4'));var path=require(_0xfd76('0x5'));var sox=require(_0xfd76('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd76('0x7'));var squel=require(_0xfd76('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfd76('0x9'));var querystring=require(_0xfd76('0xa'));var Papa=require(_0xfd76('0xb'));var Redis=require('ioredis');var authService=require(_0xfd76('0xc'));var qs=require(_0xfd76('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd76('0xe'));var logger=require(_0xfd76('0xf'))(_0xfd76('0x10'));var utils=require(_0xfd76('0x11'));var config=require(_0xfd76('0x12'));var licenseUtil=require(_0xfd76('0x13'));var db=require(_0xfd76('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3d6656,_0x7af37b){_0x7af37b=_0x7af37b||0xcc;return function(_0x1dfe46){if(_0x1dfe46){return _0x3d6656['sendStatus'](_0x7af37b);}return _0x3d6656[_0xfd76('0x15')](_0x7af37b)[_0xfd76('0x16')]();};}function respondWithResult(_0x533336,_0x101d63){_0x101d63=_0x101d63||0xc8;return function(_0x51dd42){if(_0x51dd42){return _0x533336[_0xfd76('0x15')](_0x101d63)[_0xfd76('0x17')](_0x51dd42);}};}function respondWithFilteredResult(_0x5224f0,_0x28975d){return function(_0x12a2f0){if(_0x12a2f0){var _0xae6a5d=typeof _0x28975d['offset']==='undefined'&&typeof _0x28975d[_0xfd76('0x18')]===_0xfd76('0x19');var _0x2a1d7a=_0x12a2f0['count'];var _0x19347b=_0xae6a5d?0x0:_0x28975d[_0xfd76('0x1a')];var _0x219bb7=_0xae6a5d?_0x12a2f0['count']:_0x28975d[_0xfd76('0x1a')]+_0x28975d[_0xfd76('0x18')];var _0x113931;if(_0x219bb7>=_0x2a1d7a){_0x219bb7=_0x2a1d7a;_0x113931=0xc8;}else{_0x113931=0xce;}_0x5224f0[_0xfd76('0x15')](_0x113931);return _0x5224f0[_0xfd76('0x1b')](_0xfd76('0x1c'),_0x19347b+'-'+_0x219bb7+'/'+_0x2a1d7a)[_0xfd76('0x17')](_0x12a2f0);}return null;};}function patchUpdates(_0x5bc866){return function(_0x4ef3eb){try{jsonpatch[_0xfd76('0x1d')](_0x4ef3eb,_0x5bc866,!![]);}catch(_0x14650d){return BPromise[_0xfd76('0x1e')](_0x14650d);}return _0x4ef3eb[_0xfd76('0x1f')]();};}function saveUpdates(_0x1ca286,_0x4bfbc8){return function(_0x30e0b5){if(_0x30e0b5){return _0x30e0b5[_0xfd76('0x20')](_0x1ca286)[_0xfd76('0x21')](function(_0x55f5bb){return _0x55f5bb;});}return null;};}function removeEntity(_0x29d195,_0x50946c){return function(_0x7bcb39){if(_0x7bcb39){return _0x7bcb39['destroy']()[_0xfd76('0x21')](function(){_0x29d195[_0xfd76('0x15')](0xcc)[_0xfd76('0x16')]();});}};}function handleEntityNotFound(_0x49f87a,_0x407d51){return function(_0x39ed9f){if(!_0x39ed9f){_0x49f87a[_0xfd76('0x22')](0x194);}return _0x39ed9f;};}function handleError(_0x53257e,_0x35ad69){_0x35ad69=_0x35ad69||0x1f4;return function(_0x294602){logger[_0xfd76('0x23')](_0x294602[_0xfd76('0x24')]);if(_0x294602[_0xfd76('0x25')]){delete _0x294602[_0xfd76('0x25')];}_0x53257e[_0xfd76('0x15')](_0x35ad69)['send'](_0x294602);};}exports[_0xfd76('0x26')]=function(_0x4e5815,_0x29be){var _0x374dee={},_0x417284={},_0x1ec578={'count':0x0,'rows':[]};var _0x4e4e52=_[_0xfd76('0x27')](db['VtigerAccount'][_0xfd76('0x28')],function(_0x4b060c){return{'name':_0x4b060c[_0xfd76('0x29')],'type':_0x4b060c['type'][_0xfd76('0x2a')]};});_0x417284[_0xfd76('0x2b')]=_[_0xfd76('0x27')](_0x4e4e52,_0xfd76('0x25'));_0x417284['query']=_[_0xfd76('0x2c')](_0x4e5815[_0xfd76('0x2d')]);_0x417284['filters']=_['intersection'](_0x417284[_0xfd76('0x2b')],_0x417284[_0xfd76('0x2d')]);_0x374dee['attributes']=_[_0xfd76('0x2e')](_0x417284[_0xfd76('0x2b')],qs[_0xfd76('0x2f')](_0x4e5815[_0xfd76('0x2d')][_0xfd76('0x2f')]));_0x374dee['attributes']=_0x374dee['attributes'][_0xfd76('0x30')]?_0x374dee['attributes']:_0x417284[_0xfd76('0x2b')];if(!_0x4e5815[_0xfd76('0x2d')][_0xfd76('0x31')](_0xfd76('0x32'))){_0x374dee[_0xfd76('0x18')]=qs[_0xfd76('0x18')](_0x4e5815[_0xfd76('0x2d')][_0xfd76('0x18')]);_0x374dee[_0xfd76('0x1a')]=qs[_0xfd76('0x1a')](_0x4e5815[_0xfd76('0x2d')][_0xfd76('0x1a')]);}_0x374dee[_0xfd76('0x33')]=qs['sort'](_0x4e5815[_0xfd76('0x2d')][_0xfd76('0x34')]);_0x374dee[_0xfd76('0x35')]=qs['filters'](_[_0xfd76('0x36')](_0x4e5815['query'],_0x417284[_0xfd76('0x37')]),_0x4e4e52);if(_0x4e5815[_0xfd76('0x2d')][_0xfd76('0x38')]){_0x374dee['where']=_[_0xfd76('0x39')](_0x374dee['where'],{'$or':_[_0xfd76('0x27')](_0x4e4e52,function(_0x338978){if(_0x338978[_0xfd76('0x3a')]!==_0xfd76('0x3b')){var _0x2cd2ed={};_0x2cd2ed[_0x338978[_0xfd76('0x25')]]={'$like':'%'+_0x4e5815[_0xfd76('0x2d')][_0xfd76('0x38')]+'%'};return _0x2cd2ed;}})});}_0x374dee=_[_0xfd76('0x39')]({},_0x374dee,_0x4e5815['options']);var _0x390aca={'where':_0x374dee[_0xfd76('0x35')]};return db['VtigerAccount']['count'](_0x390aca)[_0xfd76('0x21')](function(_0x10f0b7){_0x1ec578[_0xfd76('0x3c')]=_0x10f0b7;if(_0x4e5815[_0xfd76('0x2d')][_0xfd76('0x3d')]){_0x374dee[_0xfd76('0x3e')]=[{'all':!![]}];}return db[_0xfd76('0x3f')][_0xfd76('0x40')](_0x374dee);})[_0xfd76('0x21')](function(_0x21f288){_0x1ec578[_0xfd76('0x41')]=_0x21f288;return _0x1ec578;})[_0xfd76('0x21')](respondWithFilteredResult(_0x29be,_0x374dee))[_0xfd76('0x42')](handleError(_0x29be,null));};exports['show']=function(_0x5c4b75,_0x5257f2){var _0x2ba8a3={'raw':![],'where':{'id':_0x5c4b75['params']['id']}},_0x294f41={};_0x294f41[_0xfd76('0x2b')]=_[_0xfd76('0x2c')](db[_0xfd76('0x3f')][_0xfd76('0x28')]);_0x294f41['query']=_['keys'](_0x5c4b75[_0xfd76('0x2d')]);_0x294f41[_0xfd76('0x37')]=_[_0xfd76('0x2e')](_0x294f41[_0xfd76('0x2b')],_0x294f41[_0xfd76('0x2d')]);_0x2ba8a3['attributes']=_[_0xfd76('0x2e')](_0x294f41['model'],qs[_0xfd76('0x2f')](_0x5c4b75[_0xfd76('0x2d')][_0xfd76('0x2f')]));_0x2ba8a3['attributes']=_0x2ba8a3[_0xfd76('0x43')][_0xfd76('0x30')]?_0x2ba8a3[_0xfd76('0x43')]:_0x294f41['model'];if(_0x5c4b75[_0xfd76('0x2d')]['includeAll']){_0x2ba8a3[_0xfd76('0x3e')]=[{'all':!![]}];}_0x2ba8a3=_[_0xfd76('0x39')]({},_0x2ba8a3,_0x5c4b75[_0xfd76('0x44')]);return db['VtigerAccount']['find'](_0x2ba8a3)[_0xfd76('0x21')](handleEntityNotFound(_0x5257f2,null))['then'](respondWithResult(_0x5257f2,null))['catch'](handleError(_0x5257f2,null));};exports['create']=function(_0x5ac356,_0x1dd91c){return db['VtigerAccount'][_0xfd76('0x45')](_0x5ac356[_0xfd76('0x46')],{})[_0xfd76('0x21')](respondWithResult(_0x1dd91c,0xc9))[_0xfd76('0x42')](handleError(_0x1dd91c,null));};exports['update']=function(_0x6c9950,_0xb61c15){if(_0x6c9950[_0xfd76('0x46')]['id']){delete _0x6c9950[_0xfd76('0x46')]['id'];}return db[_0xfd76('0x3f')][_0xfd76('0x47')]({'where':{'id':_0x6c9950[_0xfd76('0x48')]['id']}})[_0xfd76('0x21')](handleEntityNotFound(_0xb61c15,null))[_0xfd76('0x21')](saveUpdates(_0x6c9950['body'],null))['then'](respondWithResult(_0xb61c15,null))['catch'](handleError(_0xb61c15,null));};exports[_0xfd76('0x49')]=function(_0x5c6f56,_0x2c808e){return db[_0xfd76('0x3f')][_0xfd76('0x47')]({'where':{'id':_0x5c6f56[_0xfd76('0x48')]['id']}})[_0xfd76('0x21')](handleEntityNotFound(_0x2c808e,null))[_0xfd76('0x21')](removeEntity(_0x2c808e,null))['catch'](handleError(_0x2c808e,null));};exports['getConfigurations']=function(_0x167798,_0x5b83eb,_0x5270c4){var _0x347771={};var _0x448103={};var _0x2c9c4d;var _0x59c3db;return db['VtigerAccount'][_0xfd76('0x4a')]({'where':{'id':_0x167798[_0xfd76('0x48')]['id']}})[_0xfd76('0x21')](handleEntityNotFound(_0x5b83eb,null))['then'](function(_0x5ccda8){if(_0x5ccda8){_0x2c9c4d=_0x5ccda8;_0x448103[_0xfd76('0x2b')]=_['keys'](db[_0xfd76('0x4b')][_0xfd76('0x28')]);_0x448103['query']=_[_0xfd76('0x2c')](_0x167798[_0xfd76('0x2d')]);_0x448103['filters']=_[_0xfd76('0x2e')](_0x448103[_0xfd76('0x2b')],_0x448103[_0xfd76('0x2d')]);_0x347771['attributes']=_[_0xfd76('0x2e')](_0x448103[_0xfd76('0x2b')],qs[_0xfd76('0x2f')](_0x167798[_0xfd76('0x2d')][_0xfd76('0x2f')]));_0x347771[_0xfd76('0x43')]=_0x347771[_0xfd76('0x43')][_0xfd76('0x30')]?_0x347771[_0xfd76('0x43')]:_0x448103[_0xfd76('0x2b')];_0x347771['order']=qs[_0xfd76('0x34')](_0x167798[_0xfd76('0x2d')][_0xfd76('0x34')]);_0x347771['where']=qs[_0xfd76('0x37')](_['pick'](_0x167798[_0xfd76('0x2d')],_0x448103[_0xfd76('0x37')]));if(_0x167798[_0xfd76('0x2d')]['filter']){_0x347771[_0xfd76('0x35')]=_[_0xfd76('0x39')](_0x347771['where'],{'$or':_[_0xfd76('0x27')](_0x347771[_0xfd76('0x43')],function(_0x4b430e){var _0x45f7a7={};_0x45f7a7[_0x4b430e]={'$like':'%'+_0x167798['query'][_0xfd76('0x38')]+'%'};return _0x45f7a7;})});}_0x347771=_['merge']({},_0x347771,_0x167798['options']);return _0x2c9c4d[_0xfd76('0x4c')](_0x347771);}})[_0xfd76('0x21')](function(_0x1b04d5){if(_0x1b04d5){_0x59c3db=_0x1b04d5[_0xfd76('0x30')];if(!_0x167798[_0xfd76('0x2d')][_0xfd76('0x31')](_0xfd76('0x32'))){_0x347771[_0xfd76('0x18')]=qs['limit'](_0x167798['query'][_0xfd76('0x18')]);_0x347771[_0xfd76('0x1a')]=qs['offset'](_0x167798['query']['offset']);}return _0x2c9c4d[_0xfd76('0x4c')](_0x347771);}})[_0xfd76('0x21')](function(_0x54d73b){if(_0x54d73b){return _0x54d73b?{'count':_0x59c3db,'rows':_0x54d73b}:null;}})[_0xfd76('0x21')](respondWithResult(_0x5b83eb,null))[_0xfd76('0x42')](handleError(_0x5b83eb,null));};exports[_0xfd76('0x4d')]=function(_0x3a0006,_0xcf2d3d,_0x5d321f){if(_0x3a0006[_0xfd76('0x46')]['id']){delete _0x3a0006['body']['id'];}return db[_0xfd76('0x3f')]['findOne']({'where':{'id':_0x3a0006['params']['id']}})[_0xfd76('0x21')](handleEntityNotFound(_0xcf2d3d,null))[_0xfd76('0x21')](function(_0x47c835){if(_0x47c835){_0x3a0006[_0xfd76('0x46')][_0xfd76('0x4e')]=_0x47c835['id'];_0x3a0006[_0xfd76('0x46')][_0xfd76('0x4f')]=integrations[_0xfd76('0x50')](_0x3a0006['body'][_0xfd76('0x51')],_0x3a0006[_0xfd76('0x46')][_0xfd76('0x3a')]);_0x3a0006[_0xfd76('0x46')][_0xfd76('0x52')]=integrations[_0xfd76('0x53')](_0x3a0006[_0xfd76('0x46')][_0xfd76('0x51')],_0x3a0006[_0xfd76('0x46')][_0xfd76('0x3a')]);return db[_0xfd76('0x4b')][_0xfd76('0x45')](_0x3a0006[_0xfd76('0x46')],{'include':[{'model':db[_0xfd76('0x54')],'as':_0xfd76('0x4f')},{'model':db['VtigerField'],'as':_0xfd76('0x52')}]});}return null;})[_0xfd76('0x21')](respondWithResult(_0xcf2d3d,null))[_0xfd76('0x42')](handleError(_0xcf2d3d,null));};var md5=require(_0xfd76('0x55'));exports[_0xfd76('0x56')]=function(_0x587b4a,_0x11193d,_0x1e4979){var _0x2f4f0a=null;var _0x1a443c=null;var _0x159423=null;var _0x5c249a=null;var _0x1778fc='';return db['VtigerAccount'][_0xfd76('0x4a')]({'where':{'id':_0x587b4a[_0xfd76('0x48')]['id']},'attributes':['id','name','username',_0xfd76('0x57'),'moduleName',_0xfd76('0x58'),_0xfd76('0x59'),'accessKey']})[_0xfd76('0x21')](handleEntityNotFound(_0x11193d,null))[_0xfd76('0x21')](function(_0x4e940c){if(_0x4e940c){_0x2f4f0a=_0x4e940c[_0xfd76('0x5a')];_0x1a443c=_0x4e940c[_0xfd76('0x5b')];_0x159423=_0x4e940c[_0xfd76('0x5c')];_0x1778fc=_0x4e940c[_0xfd76('0x58')];var _0x56c899=_0x1778fc['slice'](-0x1);if(_0x56c899==='/'){_0x1778fc=_0x1778fc[_0xfd76('0x5d')](0x0,_0x1778fc[_0xfd76('0x5e')](_0x56c899));}_0x5c249a=util[_0xfd76('0x5f')](_0xfd76('0x60'),_0x1778fc);var _0x284575={'method':_0xfd76('0x61'),'uri':_0x5c249a,'qs':{'operation':_0xfd76('0x62'),'username':_0x4e940c[_0xfd76('0x5a')]},'json':!![]};return rp(_0x284575);}})['then'](function(_0x184a76){if(_0x184a76[_0xfd76('0x63')]){var _0x51d9fc={'method':_0xfd76('0x64'),'uri':_0x5c249a,'form':{'operation':_0xfd76('0x65'),'username':_0x2f4f0a,'accessKey':md5(_0x184a76[_0xfd76('0x66')][_0xfd76('0x67')]+_0x1a443c)},'json':!![]};return rp(_0x51d9fc);}})['then'](function(_0xec6a50){if(_0xec6a50['success']){var _0x22e283={'method':_0xfd76('0x61'),'uri':_0x5c249a,'qs':{'operation':'describe','username':_0x2f4f0a,'sessionName':_0xec6a50[_0xfd76('0x66')][_0xfd76('0x68')],'elementType':_0x159423},'json':!![]};return rp(_0x22e283);}})[_0xfd76('0x21')](function(_0x4fb7d6){if(_0x4fb7d6[_0xfd76('0x63')]){var _0x2be427=['autogenerated','reference',_0xfd76('0x69')];_['remove'](_0x4fb7d6[_0xfd76('0x66')][_0xfd76('0x2f')],function(_0x2ac0c0){return _0x2be427[_0xfd76('0x6a')](_0x2ac0c0[_0xfd76('0x3a')][_0xfd76('0x25')]);});_['remove'](_0x4fb7d6['result'][_0xfd76('0x2f')],function(_0x34fb9e){return _0x34fb9e[_0xfd76('0x6b')]===_0xfd76('0x6c');});return{'count':_0x4fb7d6[_0xfd76('0x66')][_0xfd76('0x2f')]['length'],'rows':_[_0xfd76('0x27')](_0x4fb7d6['result'][_0xfd76('0x2f')],function(_0x398365){return{'id':_0x398365['name'],'name':_0x398365['label'],'custom':_['startsWith'](_0x398365[_0xfd76('0x25')],_0xfd76('0x6d'))?!![]:![],'options':_0x398365['type'][_0xfd76('0x25')]===_0xfd76('0x6e')&&_0x398365[_0xfd76('0x3a')]['picklistValues']['length']>0x0?_[_0xfd76('0x27')](_0x398365[_0xfd76('0x3a')][_0xfd76('0x6f')],function(_0x233c3e){return{'name':_0x233c3e[_0xfd76('0x70')],'value':_0x233c3e[_0xfd76('0x71')]};}):[]};})};}})[_0xfd76('0x21')](respondWithResult(_0x11193d,null))[_0xfd76('0x42')](function(_0x5ae83d){console['log'](_0xfd76('0x72')+_0x5ae83d);var _0x2f3d3e=_0x587b4a[_0xfd76('0x2d')][_0xfd76('0x73')]?0x1f4:_0x5ae83d[_0xfd76('0x74')]||0x1f4;logger[_0xfd76('0x23')](_0xfd76('0x75'),_0xfd76('0x56'),_0x2f3d3e,JSON[_0xfd76('0x76')](_0x5ae83d));delete _0x5ae83d['name'];if(_0x2f3d3e===0x191){_0x2f3d3e=0x190;}_0x11193d[_0xfd76('0x15')](_0x2f3d3e)[_0xfd76('0x77')](_0x587b4a['query'][_0xfd76('0x73')]?{'message':_0xfd76('0x78'),'statusCode':_0x5ae83d[_0xfd76('0x74')]}:_0x5ae83d);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 2e694b1..7c57301 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.model.js +++ b/server/api/intVtigerAccount/intVtigerAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbda8=['VtigerAccount','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x2dce27,_0x550c17){var _0x23a8ea=function(_0x5956c9){while(--_0x5956c9){_0x2dce27['push'](_0x2dce27['shift']());}};_0x23a8ea(++_0x550c17);}(_0xbda8,0xdd));var _0x8bda=function(_0x52cff7,_0x1d4b86){_0x52cff7=_0x52cff7-0x0;var _0x32645e=_0xbda8[_0x52cff7];return _0x32645e;};'use strict';var _=require(_0x8bda('0x0'));var util=require('util');var logger=require(_0x8bda('0x1'))('api');var moment=require(_0x8bda('0x2'));var BPromise=require(_0x8bda('0x3'));var rp=require(_0x8bda('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bda('0x5'));var config=require(_0x8bda('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x8bda('0x7'));module[_0x8bda('0x8')]=function(_0xa4d061,_0x552523){return _0xa4d061[_0x8bda('0x9')](_0x8bda('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23b0=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x55263c,_0x54584e){var _0x550020=function(_0x25e1c9){while(--_0x25e1c9){_0x55263c['push'](_0x55263c['shift']());}};_0x550020(++_0x54584e);}(_0x23b0,0xc5));var _0x023b=function(_0x32a3be,_0x17dd53){_0x32a3be=_0x32a3be-0x0;var _0x54787a=_0x23b0[_0x32a3be];return _0x54787a;};'use strict';var _=require('lodash');var util=require(_0x023b('0x0'));var logger=require('../../config/logger')(_0x023b('0x1'));var moment=require(_0x023b('0x2'));var BPromise=require('bluebird');var rp=require(_0x023b('0x3'));var fs=require('fs');var path=require(_0x023b('0x4'));var rimraf=require(_0x023b('0x5'));var config=require(_0x023b('0x6'));var attributes=require(_0x023b('0x7'));var integrations=require(_0x023b('0x8'));module[_0x023b('0x9')]=function(_0x48b3e1,_0x2da11f){return _0x48b3e1[_0x023b('0xa')](_0x023b('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index ec89185..a6419e9 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowVtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19ddd9,_0x4351de){var _0x13ab97=function(_0x4ca443){while(--_0x4ca443){_0x19ddd9['push'](_0x19ddd9['shift']());}};_0x13ab97(++_0x4351de);}(_0xb10b,0x12a));var _0xbb10=function(_0x44f280,_0x4a1dad){_0x44f280=_0x44f280-0x0;var _0x4ee19d=_0xb10b[_0x44f280];return _0x4ee19d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetVtigerAccount',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowVtigerAccount',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x69d3=['debug','stringify','error','code','message','result','catch','VtigerAccount','options','raw','attributes','limit','include','model','map','then','GetVtigerAccount','ShowVtigerAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4a47de,_0x36b1e3){var _0xfb9c3f=function(_0xc61787){while(--_0xc61787){_0x4a47de['push'](_0x4a47de['shift']());}};_0xfb9c3f(++_0x36b1e3);}(_0x69d3,0xda));var _0x369d=function(_0x5bdb22,_0x9948fa){_0x5bdb22=_0x5bdb22-0x0;var _0xf9efa7=_0x69d3[_0x5bdb22];return _0xf9efa7;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['GetVtigerAccount']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['findAll']({'raw':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x16')]===undefined?!![]:![]:!![],'where':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['where']||null:null,'attributes':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x17')]||null:null,'limit':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x18')]||null:null,'include':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['include']?_['map'](_0x572513[_0x369d('0x15')][_0x369d('0x19')],function(_0xf7bc3a){return{'model':db[_0xf7bc3a[_0x369d('0x1a')]],'as':_0xf7bc3a['as'],'attributes':_0xf7bc3a[_0x369d('0x17')],'include':_0xf7bc3a[_0x369d('0x19')]?_[_0x369d('0x1b')](_0xf7bc3a['include'],function(_0x4dfe83){return{'model':db[_0x4dfe83[_0x369d('0x1a')]],'as':_0x4dfe83['as'],'attributes':_0x4dfe83[_0x369d('0x17')],'include':_0x4dfe83[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x4dfe83[_0x369d('0x19')],function(_0x41e0cf){return{'model':db[_0x41e0cf[_0x369d('0x1a')]],'as':_0x41e0cf['as'],'attributes':_0x41e0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xe95742){logger[_0x369d('0xa')](_0x369d('0x1d'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x1d'),_0x572513,JSON[_0x369d('0xe')](_0xe95742));_0x2946be(_0xe95742);})['catch'](function(_0x157291){logger['error']('GetVtigerAccount',_0x157291[_0x369d('0x11')],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x157291['message']));});});};exports[_0x369d('0x1e')]=function(_0x5a14ce){var _0x37274f=this;return new Promise(function(_0x39d656,_0xe45219){return db[_0x369d('0x14')][_0x369d('0x1f')]({'raw':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x20')]||null:null,'attributes':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x17')]||null:null,'include':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['include']?_[_0x369d('0x1b')](_0x5a14ce[_0x369d('0x15')][_0x369d('0x19')],function(_0x1b4453){return{'model':db[_0x1b4453[_0x369d('0x1a')]],'as':_0x1b4453['as'],'attributes':_0x1b4453['attributes'],'include':_0x1b4453[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x1b4453[_0x369d('0x19')],function(_0x3a0277){return{'model':db[_0x3a0277[_0x369d('0x1a')]],'as':_0x3a0277['as'],'attributes':_0x3a0277[_0x369d('0x17')],'include':_0x3a0277['include']?_[_0x369d('0x1b')](_0x3a0277[_0x369d('0x19')],function(_0x40afb2){return{'model':db[_0x40afb2[_0x369d('0x1a')]],'as':_0x40afb2['as'],'attributes':_0x40afb2[_0x369d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xfa13da){logger[_0x369d('0xa')](_0x369d('0x1e'),_0x5a14ce);logger[_0x369d('0xd')](_0x369d('0x1e'),_0x5a14ce,JSON[_0x369d('0xe')](_0xfa13da));_0x39d656(_0xfa13da);})[_0x369d('0x13')](function(_0x43d734){logger[_0x369d('0xf')](_0x369d('0x1e'),_0x43d734[_0x369d('0x11')],_0x5a14ce);_0xe45219(_0x37274f[_0x369d('0xf')](0x1f4,_0x43d734[_0x369d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 98bf2eb..2b2b47e 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf25d=['Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout'];(function(_0x5ee2b7,_0x34790f){var _0x43842d=function(_0x544ff7){while(--_0x544ff7){_0x5ee2b7['push'](_0x5ee2b7['shift']());}};_0x43842d(++_0x34790f);}(_0xf25d,0x1de));var _0xdf25=function(_0x2e2495,_0x1a1ec4){_0x2e2495=_0x2e2495-0x0;var _0x2a907a=_0xf25d[_0x2e2495];return _0x2a907a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf25('0x0'));var timeout=require(_0xdf25('0x1'));var express=require('express');var router=express[_0xdf25('0x2')]();var fs_extra=require(_0xdf25('0x3'));var auth=require(_0xdf25('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdf25('0x5'));var controller=require(_0xdf25('0x6'));router[_0xdf25('0x7')]('/',auth['isAuthenticated'](),controller[_0xdf25('0x8')]);router[_0xdf25('0x7')]('/:id',auth[_0xdf25('0x9')](),controller[_0xdf25('0xa')]);router[_0xdf25('0x7')](_0xdf25('0xb'),auth[_0xdf25('0x9')](),controller[_0xdf25('0xc')]);router[_0xdf25('0x7')](_0xdf25('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xdf25('0xe'),auth[_0xdf25('0x9')](),controller[_0xdf25('0xf')]);router[_0xdf25('0x10')]('/',auth[_0xdf25('0x9')](),controller[_0xdf25('0x11')]);router[_0xdf25('0x12')](_0xdf25('0x13'),auth[_0xdf25('0x9')](),controller[_0xdf25('0x14')]);router[_0xdf25('0x15')](_0xdf25('0x13'),auth[_0xdf25('0x9')](),controller[_0xdf25('0x16')]);module[_0xdf25('0x17')]=router; \ No newline at end of file +var _0x722a=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','getSubjects','getDescriptions','post','create','put','delete','destroy'];(function(_0x362c5c,_0x5672f3){var _0x4dcc87=function(_0x1afb2b){while(--_0x1afb2b){_0x362c5c['push'](_0x362c5c['shift']());}};_0x4dcc87(++_0x5672f3);}(_0x722a,0x10a));var _0xa722=function(_0x5f49b0,_0x43b8bf){_0x5f49b0=_0x5f49b0-0x0;var _0xa8a57a=_0x722a[_0x5f49b0];return _0xa8a57a;};'use strict';var multer=require(_0xa722('0x0'));var util=require(_0xa722('0x1'));var path=require(_0xa722('0x2'));var timeout=require(_0xa722('0x3'));var express=require('express');var router=express[_0xa722('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa722('0x5'));var config=require(_0xa722('0x6'));var controller=require(_0xa722('0x7'));router['get']('/',auth[_0xa722('0x8')](),controller[_0xa722('0x9')]);router[_0xa722('0xa')](_0xa722('0xb'),auth[_0xa722('0x8')](),controller['show']);router[_0xa722('0xa')]('/:id/fields',auth[_0xa722('0x8')](),controller['getFields']);router[_0xa722('0xa')]('/:id/subjects',auth[_0xa722('0x8')](),controller[_0xa722('0xc')]);router[_0xa722('0xa')]('/:id/descriptions',auth[_0xa722('0x8')](),controller[_0xa722('0xd')]);router[_0xa722('0xe')]('/',auth[_0xa722('0x8')](),controller[_0xa722('0xf')]);router[_0xa722('0x10')](_0xa722('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa722('0x11')](_0xa722('0xb'),auth['isAuthenticated'](),controller[_0xa722('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5dfa22c..06c0221 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94b9=['STRING','sequelize','exports'];(function(_0x231829,_0x376ec3){var _0x5b6c7d=function(_0x20195a){while(--_0x20195a){_0x231829['push'](_0x231829['shift']());}};_0x5b6c7d(++_0x376ec3);}(_0x94b9,0x193));var _0x994b=function(_0x4dc8f8,_0x45f45e){_0x4dc8f8=_0x4dc8f8-0x0;var _0x5b2b2c=_0x94b9[_0x4dc8f8];return _0x5b2b2c;};'use strict';var Sequelize=require(_0x994b('0x0'));module[_0x994b('0x1')]={'name':{'type':Sequelize[_0x994b('0x2')]},'description':{'type':Sequelize[_0x994b('0x2')]}}; \ No newline at end of file +var _0xa7e8=['STRING','sequelize'];(function(_0x1abbf4,_0x2f199d){var _0x4c28d9=function(_0x1c5316){while(--_0x1c5316){_0x1abbf4['push'](_0x1abbf4['shift']());}};_0x4c28d9(++_0x2f199d);}(_0xa7e8,0x1ad));var _0x8a7e=function(_0x14b43b,_0x4c991e){_0x14b43b=_0x14b43b-0x0;var _0x20e595=_0xa7e8[_0x14b43b];return _0x20e595;};'use strict';var Sequelize=require(_0x8a7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a7e('0x1')]},'description':{'type':Sequelize[_0x8a7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 08c72aa..6bdb6d0 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d42=['attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','params','find','getFields','findOne','getSubjects','getDescriptions','VtigerField','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d42,0xb8));var _0x23d4=function(_0xe43e5d,_0x285cc7){_0xe43e5d=_0xe43e5d-0x0;var _0x399b79=_0x3d42[_0xe43e5d];return _0x399b79;};'use strict';var emlformat=require(_0x23d4('0x0'));var rimraf=require(_0x23d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23d4('0x2'));var rp=require(_0x23d4('0x3'));var moment=require(_0x23d4('0x4'));var BPromise=require(_0x23d4('0x5'));var Mustache=require(_0x23d4('0x6'));var util=require(_0x23d4('0x7'));var path=require('path');var sox=require(_0x23d4('0x8'));var csv=require(_0x23d4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23d4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x23d4('0xb'));var jsforce=require(_0x23d4('0xc'));var deskjs=require(_0x23d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x23d4('0xe'));var Papa=require('papaparse');var Redis=require(_0x23d4('0xf'));var authService=require(_0x23d4('0x10'));var qs=require(_0x23d4('0x11'));var as=require(_0x23d4('0x12'));var hardwareService=require(_0x23d4('0x13'));var logger=require('../../config/logger')(_0x23d4('0x14'));var utils=require('../../config/utils');var config=require(_0x23d4('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb8cba9,_0x522eee){_0x522eee=_0x522eee||0xcc;return function(_0x457ee5){if(_0x457ee5){return _0xb8cba9[_0x23d4('0x16')](_0x522eee);}return _0xb8cba9['status'](_0x522eee)[_0x23d4('0x17')]();};}function respondWithResult(_0x44fe28,_0x4fcd58){_0x4fcd58=_0x4fcd58||0xc8;return function(_0x502506){if(_0x502506){return _0x44fe28[_0x23d4('0x18')](_0x4fcd58)['json'](_0x502506);}};}function respondWithFilteredResult(_0x4c42a2,_0x54cb55){return function(_0x3e3997){if(_0x3e3997){var _0x5ab187=typeof _0x54cb55[_0x23d4('0x19')]===_0x23d4('0x1a')&&typeof _0x54cb55[_0x23d4('0x1b')]==='undefined';var _0x4cec52=_0x3e3997[_0x23d4('0x1c')];var _0x3c4ef2=_0x5ab187?0x0:_0x54cb55['offset'];var _0x5d2501=_0x5ab187?_0x3e3997[_0x23d4('0x1c')]:_0x54cb55[_0x23d4('0x19')]+_0x54cb55[_0x23d4('0x1b')];var _0x1ba44e;if(_0x5d2501>=_0x4cec52){_0x5d2501=_0x4cec52;_0x1ba44e=0xc8;}else{_0x1ba44e=0xce;}_0x4c42a2['status'](_0x1ba44e);return _0x4c42a2[_0x23d4('0x1d')](_0x23d4('0x1e'),_0x3c4ef2+'-'+_0x5d2501+'/'+_0x4cec52)[_0x23d4('0x1f')](_0x3e3997);}return null;};}function patchUpdates(_0xcfd4a6){return function(_0x1dd6a2){try{jsonpatch[_0x23d4('0x20')](_0x1dd6a2,_0xcfd4a6,!![]);}catch(_0x20355d){return BPromise[_0x23d4('0x21')](_0x20355d);}return _0x1dd6a2[_0x23d4('0x22')]();};}function saveUpdates(_0x1298c0,_0x4e3a08){return function(_0x27ab73){if(_0x27ab73){return _0x27ab73[_0x23d4('0x23')](_0x1298c0)[_0x23d4('0x24')](function(_0x56aeb5){return _0x56aeb5;});}return null;};}function removeEntity(_0x5137bb,_0x3e58d5){return function(_0x5664f7){if(_0x5664f7){return _0x5664f7[_0x23d4('0x25')]()[_0x23d4('0x24')](function(){_0x5137bb[_0x23d4('0x18')](0xcc)[_0x23d4('0x17')]();});}};}function handleEntityNotFound(_0x38dfd2,_0x577f6f){return function(_0x25c4a8){if(!_0x25c4a8){_0x38dfd2[_0x23d4('0x16')](0x194);}return _0x25c4a8;};}function handleError(_0x282f7f,_0x2dd1c8){_0x2dd1c8=_0x2dd1c8||0x1f4;return function(_0x308fef){logger['error'](_0x308fef[_0x23d4('0x26')]);if(_0x308fef[_0x23d4('0x27')]){delete _0x308fef['name'];}_0x282f7f[_0x23d4('0x18')](_0x2dd1c8)['send'](_0x308fef);};}exports[_0x23d4('0x28')]=function(_0x8ad855,_0x40cacb){var _0x22710d={},_0x4cb734={},_0x51677b={'count':0x0,'rows':[]};var _0xb12d=_[_0x23d4('0x29')](db[_0x23d4('0x2a')][_0x23d4('0x2b')],function(_0x85b7b9){return{'name':_0x85b7b9['fieldName'],'type':_0x85b7b9[_0x23d4('0x2c')][_0x23d4('0x2d')]};});_0x4cb734[_0x23d4('0x2e')]=_[_0x23d4('0x29')](_0xb12d,'name');_0x4cb734[_0x23d4('0x2f')]=_[_0x23d4('0x30')](_0x8ad855[_0x23d4('0x2f')]);_0x4cb734[_0x23d4('0x31')]=_['intersection'](_0x4cb734[_0x23d4('0x2e')],_0x4cb734[_0x23d4('0x2f')]);_0x22710d[_0x23d4('0x32')]=_[_0x23d4('0x33')](_0x4cb734[_0x23d4('0x2e')],qs[_0x23d4('0x34')](_0x8ad855[_0x23d4('0x2f')]['fields']));_0x22710d[_0x23d4('0x32')]=_0x22710d[_0x23d4('0x32')][_0x23d4('0x35')]?_0x22710d[_0x23d4('0x32')]:_0x4cb734[_0x23d4('0x2e')];if(!_0x8ad855[_0x23d4('0x2f')][_0x23d4('0x36')](_0x23d4('0x37'))){_0x22710d[_0x23d4('0x1b')]=qs[_0x23d4('0x1b')](_0x8ad855[_0x23d4('0x2f')][_0x23d4('0x1b')]);_0x22710d[_0x23d4('0x19')]=qs[_0x23d4('0x19')](_0x8ad855['query'][_0x23d4('0x19')]);}_0x22710d['order']=qs[_0x23d4('0x38')](_0x8ad855[_0x23d4('0x2f')][_0x23d4('0x38')]);_0x22710d[_0x23d4('0x39')]=qs[_0x23d4('0x31')](_[_0x23d4('0x3a')](_0x8ad855[_0x23d4('0x2f')],_0x4cb734[_0x23d4('0x31')]),_0xb12d);if(_0x8ad855[_0x23d4('0x2f')][_0x23d4('0x3b')]){_0x22710d['where']=_[_0x23d4('0x3c')](_0x22710d[_0x23d4('0x39')],{'$or':_[_0x23d4('0x29')](_0xb12d,function(_0x922336){if(_0x922336['type']!==_0x23d4('0x3d')){var _0x4fcea5={};_0x4fcea5[_0x922336[_0x23d4('0x27')]]={'$like':'%'+_0x8ad855[_0x23d4('0x2f')][_0x23d4('0x3b')]+'%'};return _0x4fcea5;}})});}_0x22710d=_[_0x23d4('0x3c')]({},_0x22710d,_0x8ad855['options']);var _0xa2c541={'where':_0x22710d['where']};return db[_0x23d4('0x2a')]['count'](_0xa2c541)['then'](function(_0x956004){_0x51677b[_0x23d4('0x1c')]=_0x956004;if(_0x8ad855[_0x23d4('0x2f')][_0x23d4('0x3e')]){_0x22710d[_0x23d4('0x3f')]=[{'all':!![]}];}return db[_0x23d4('0x2a')][_0x23d4('0x40')](_0x22710d);})[_0x23d4('0x24')](function(_0x4e8d36){_0x51677b[_0x23d4('0x41')]=_0x4e8d36;return _0x51677b;})[_0x23d4('0x24')](respondWithFilteredResult(_0x40cacb,_0x22710d))[_0x23d4('0x42')](handleError(_0x40cacb,null));};exports[_0x23d4('0x43')]=function(_0x470d45,_0x3a8003){var _0x3cca6f={'raw':![],'where':{'id':_0x470d45['params']['id']}},_0x2491c6={};_0x2491c6[_0x23d4('0x2e')]=_[_0x23d4('0x30')](db[_0x23d4('0x2a')][_0x23d4('0x2b')]);_0x2491c6['query']=_[_0x23d4('0x30')](_0x470d45[_0x23d4('0x2f')]);_0x2491c6['filters']=_[_0x23d4('0x33')](_0x2491c6[_0x23d4('0x2e')],_0x2491c6[_0x23d4('0x2f')]);_0x3cca6f[_0x23d4('0x32')]=_[_0x23d4('0x33')](_0x2491c6['model'],qs[_0x23d4('0x34')](_0x470d45[_0x23d4('0x2f')][_0x23d4('0x34')]));_0x3cca6f[_0x23d4('0x32')]=_0x3cca6f[_0x23d4('0x32')]['length']?_0x3cca6f[_0x23d4('0x32')]:_0x2491c6[_0x23d4('0x2e')];if(_0x470d45[_0x23d4('0x2f')][_0x23d4('0x3e')]){_0x3cca6f[_0x23d4('0x3f')]=[{'all':!![]}];}_0x3cca6f=_[_0x23d4('0x3c')]({},_0x3cca6f,_0x470d45[_0x23d4('0x44')]);return db[_0x23d4('0x2a')]['find'](_0x3cca6f)[_0x23d4('0x24')](handleEntityNotFound(_0x3a8003,null))[_0x23d4('0x24')](respondWithResult(_0x3a8003,null))[_0x23d4('0x42')](handleError(_0x3a8003,null));};exports[_0x23d4('0x45')]=function(_0x513e33,_0x1af2dc){return db['VtigerConfiguration'][_0x23d4('0x45')](_0x513e33['body'],{})[_0x23d4('0x24')](respondWithResult(_0x1af2dc,0xc9))['catch'](handleError(_0x1af2dc,null));};exports[_0x23d4('0x23')]=function(_0x18c8a6,_0x58cbbd){if(_0x18c8a6['body']['id']){delete _0x18c8a6[_0x23d4('0x46')]['id'];}return db[_0x23d4('0x2a')]['find']({'where':{'id':_0x18c8a6[_0x23d4('0x47')]['id']}})[_0x23d4('0x24')](handleEntityNotFound(_0x58cbbd,null))[_0x23d4('0x24')](saveUpdates(_0x18c8a6[_0x23d4('0x46')],null))['then'](respondWithResult(_0x58cbbd,null))[_0x23d4('0x42')](handleError(_0x58cbbd,null));};exports[_0x23d4('0x25')]=function(_0x4811e7,_0x59e72a){return db[_0x23d4('0x2a')][_0x23d4('0x48')]({'where':{'id':_0x4811e7[_0x23d4('0x47')]['id']}})[_0x23d4('0x24')](handleEntityNotFound(_0x59e72a,null))[_0x23d4('0x24')](removeEntity(_0x59e72a,null))['catch'](handleError(_0x59e72a,null));};exports[_0x23d4('0x49')]=function(_0x2ebc35,_0x1f4c75,_0x3a5661){var _0x22eaa8={};var _0x128b4c={};var _0x4f7c16;var _0x1d4fbc;return db['VtigerConfiguration'][_0x23d4('0x4a')]({'where':{'id':_0x2ebc35['params']['id']}})[_0x23d4('0x24')](handleEntityNotFound(_0x1f4c75,null))['then'](function(_0x2c3eb1){if(_0x2c3eb1){_0x4f7c16=_0x2c3eb1;_0x128b4c[_0x23d4('0x2e')]=_[_0x23d4('0x30')](db['VtigerField'][_0x23d4('0x2b')]);_0x128b4c['query']=_[_0x23d4('0x30')](_0x2ebc35[_0x23d4('0x2f')]);_0x128b4c[_0x23d4('0x31')]=_[_0x23d4('0x33')](_0x128b4c[_0x23d4('0x2e')],_0x128b4c[_0x23d4('0x2f')]);_0x22eaa8[_0x23d4('0x32')]=_[_0x23d4('0x33')](_0x128b4c[_0x23d4('0x2e')],qs[_0x23d4('0x34')](_0x2ebc35[_0x23d4('0x2f')][_0x23d4('0x34')]));_0x22eaa8['attributes']=_0x22eaa8[_0x23d4('0x32')][_0x23d4('0x35')]?_0x22eaa8[_0x23d4('0x32')]:_0x128b4c[_0x23d4('0x2e')];_0x22eaa8['order']=qs[_0x23d4('0x38')](_0x2ebc35['query'][_0x23d4('0x38')]);_0x22eaa8['where']=qs[_0x23d4('0x31')](_[_0x23d4('0x3a')](_0x2ebc35[_0x23d4('0x2f')],_0x128b4c[_0x23d4('0x31')]));if(_0x2ebc35[_0x23d4('0x2f')][_0x23d4('0x3b')]){_0x22eaa8[_0x23d4('0x39')]=_[_0x23d4('0x3c')](_0x22eaa8[_0x23d4('0x39')],{'$or':_[_0x23d4('0x29')](_0x22eaa8[_0x23d4('0x32')],function(_0x18c022){var _0x55c8a1={};_0x55c8a1[_0x18c022]={'$like':'%'+_0x2ebc35[_0x23d4('0x2f')][_0x23d4('0x3b')]+'%'};return _0x55c8a1;})});}_0x22eaa8=_['merge']({},_0x22eaa8,_0x2ebc35[_0x23d4('0x44')]);return _0x4f7c16[_0x23d4('0x49')](_0x22eaa8);}})[_0x23d4('0x24')](function(_0x32fbb3){if(_0x32fbb3){_0x1d4fbc=_0x32fbb3[_0x23d4('0x35')];if(!_0x2ebc35['query'][_0x23d4('0x36')]('nolimit')){_0x22eaa8['limit']=qs[_0x23d4('0x1b')](_0x2ebc35[_0x23d4('0x2f')][_0x23d4('0x1b')]);_0x22eaa8[_0x23d4('0x19')]=qs['offset'](_0x2ebc35[_0x23d4('0x2f')][_0x23d4('0x19')]);}return _0x4f7c16[_0x23d4('0x49')](_0x22eaa8);}})[_0x23d4('0x24')](function(_0x3c225d){if(_0x3c225d){return _0x3c225d?{'count':_0x1d4fbc,'rows':_0x3c225d}:null;}})[_0x23d4('0x24')](respondWithResult(_0x1f4c75,null))['catch'](handleError(_0x1f4c75,null));};exports[_0x23d4('0x4b')]=function(_0x32741f,_0x1142d5,_0x569f96){var _0x4c0ab3={};var _0x22b8fe={};var _0x47636f;var _0x72c3aa;return db[_0x23d4('0x2a')]['findOne']({'where':{'id':_0x32741f[_0x23d4('0x47')]['id']}})[_0x23d4('0x24')](handleEntityNotFound(_0x1142d5,null))['then'](function(_0x4f4b3f){if(_0x4f4b3f){_0x47636f=_0x4f4b3f;_0x22b8fe[_0x23d4('0x2e')]=_['keys'](db['VtigerField'][_0x23d4('0x2b')]);_0x22b8fe[_0x23d4('0x2f')]=_[_0x23d4('0x30')](_0x32741f['query']);_0x22b8fe['filters']=_[_0x23d4('0x33')](_0x22b8fe[_0x23d4('0x2e')],_0x22b8fe[_0x23d4('0x2f')]);_0x4c0ab3[_0x23d4('0x32')]=_[_0x23d4('0x33')](_0x22b8fe[_0x23d4('0x2e')],qs[_0x23d4('0x34')](_0x32741f[_0x23d4('0x2f')][_0x23d4('0x34')]));_0x4c0ab3['attributes']=_0x4c0ab3[_0x23d4('0x32')][_0x23d4('0x35')]?_0x4c0ab3[_0x23d4('0x32')]:_0x22b8fe[_0x23d4('0x2e')];_0x4c0ab3['order']=qs[_0x23d4('0x38')](_0x32741f[_0x23d4('0x2f')][_0x23d4('0x38')]);_0x4c0ab3['where']=qs[_0x23d4('0x31')](_[_0x23d4('0x3a')](_0x32741f[_0x23d4('0x2f')],_0x22b8fe[_0x23d4('0x31')]));if(_0x32741f[_0x23d4('0x2f')][_0x23d4('0x3b')]){_0x4c0ab3['where']=_[_0x23d4('0x3c')](_0x4c0ab3[_0x23d4('0x39')],{'$or':_[_0x23d4('0x29')](_0x4c0ab3['attributes'],function(_0x4df68f){var _0x3c4a79={};_0x3c4a79[_0x4df68f]={'$like':'%'+_0x32741f[_0x23d4('0x2f')][_0x23d4('0x3b')]+'%'};return _0x3c4a79;})});}_0x4c0ab3=_[_0x23d4('0x3c')]({},_0x4c0ab3,_0x32741f[_0x23d4('0x44')]);return _0x47636f['getSubjects'](_0x4c0ab3);}})[_0x23d4('0x24')](function(_0xbdefe1){if(_0xbdefe1){_0x72c3aa=_0xbdefe1[_0x23d4('0x35')];if(!_0x32741f[_0x23d4('0x2f')][_0x23d4('0x36')](_0x23d4('0x37'))){_0x4c0ab3[_0x23d4('0x1b')]=qs[_0x23d4('0x1b')](_0x32741f[_0x23d4('0x2f')][_0x23d4('0x1b')]);_0x4c0ab3[_0x23d4('0x19')]=qs['offset'](_0x32741f[_0x23d4('0x2f')]['offset']);}return _0x47636f[_0x23d4('0x4b')](_0x4c0ab3);}})[_0x23d4('0x24')](function(_0x52193b){if(_0x52193b){return _0x52193b?{'count':_0x72c3aa,'rows':_0x52193b}:null;}})['then'](respondWithResult(_0x1142d5,null))[_0x23d4('0x42')](handleError(_0x1142d5,null));};exports[_0x23d4('0x4c')]=function(_0xe49875,_0x1bf572,_0x405137){var _0x32e61b={};var _0x21e2ee={};var _0x2eb999;var _0x2dda1c;return db[_0x23d4('0x2a')][_0x23d4('0x4a')]({'where':{'id':_0xe49875['params']['id']}})['then'](handleEntityNotFound(_0x1bf572,null))[_0x23d4('0x24')](function(_0x1c320b){if(_0x1c320b){_0x2eb999=_0x1c320b;_0x21e2ee[_0x23d4('0x2e')]=_[_0x23d4('0x30')](db[_0x23d4('0x4d')][_0x23d4('0x2b')]);_0x21e2ee[_0x23d4('0x2f')]=_[_0x23d4('0x30')](_0xe49875[_0x23d4('0x2f')]);_0x21e2ee[_0x23d4('0x31')]=_['intersection'](_0x21e2ee[_0x23d4('0x2e')],_0x21e2ee['query']);_0x32e61b[_0x23d4('0x32')]=_[_0x23d4('0x33')](_0x21e2ee['model'],qs[_0x23d4('0x34')](_0xe49875[_0x23d4('0x2f')][_0x23d4('0x34')]));_0x32e61b[_0x23d4('0x32')]=_0x32e61b[_0x23d4('0x32')][_0x23d4('0x35')]?_0x32e61b['attributes']:_0x21e2ee['model'];_0x32e61b['order']=qs[_0x23d4('0x38')](_0xe49875['query']['sort']);_0x32e61b[_0x23d4('0x39')]=qs[_0x23d4('0x31')](_[_0x23d4('0x3a')](_0xe49875[_0x23d4('0x2f')],_0x21e2ee[_0x23d4('0x31')]));if(_0xe49875['query']['filter']){_0x32e61b[_0x23d4('0x39')]=_[_0x23d4('0x3c')](_0x32e61b[_0x23d4('0x39')],{'$or':_['map'](_0x32e61b['attributes'],function(_0x29d71c){var _0x2422f4={};_0x2422f4[_0x29d71c]={'$like':'%'+_0xe49875[_0x23d4('0x2f')][_0x23d4('0x3b')]+'%'};return _0x2422f4;})});}_0x32e61b=_[_0x23d4('0x3c')]({},_0x32e61b,_0xe49875[_0x23d4('0x44')]);return _0x2eb999[_0x23d4('0x4c')](_0x32e61b);}})[_0x23d4('0x24')](function(_0x308c24){if(_0x308c24){_0x2dda1c=_0x308c24[_0x23d4('0x35')];if(!_0xe49875['query'][_0x23d4('0x36')](_0x23d4('0x37'))){_0x32e61b[_0x23d4('0x1b')]=qs[_0x23d4('0x1b')](_0xe49875[_0x23d4('0x2f')][_0x23d4('0x1b')]);_0x32e61b[_0x23d4('0x19')]=qs[_0x23d4('0x19')](_0xe49875[_0x23d4('0x2f')][_0x23d4('0x19')]);}return _0x2eb999[_0x23d4('0x4c')](_0x32e61b);}})[_0x23d4('0x24')](function(_0x4b6dab){if(_0x4b6dab){return _0x4b6dab?{'count':_0x2dda1c,'rows':_0x4b6dab}:null;}})[_0x23d4('0x24')](respondWithResult(_0x1bf572,null))['catch'](handleError(_0x1bf572,null));}; \ No newline at end of file +var _0xb76c=['sendStatus','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','pick','merge','VIRTUAL','filter','options','include','catch','show','params','includeAll','find','create','body','getFields','findOne','VtigerField','sort','hasOwnProperty','getSubjects','order','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0xb76c,0x74));var _0xcb76=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xb76c[_0x2e5f9c];return _0x538b44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb76('0x0'));var zipdir=require(_0xcb76('0x1'));var jsonpatch=require(_0xcb76('0x2'));var rp=require(_0xcb76('0x3'));var moment=require(_0xcb76('0x4'));var BPromise=require(_0xcb76('0x5'));var Mustache=require(_0xcb76('0x6'));var util=require(_0xcb76('0x7'));var path=require('path');var sox=require(_0xcb76('0x8'));var csv=require(_0xcb76('0x9'));var ejs=require(_0xcb76('0xa'));var fs=require('fs');var fs_extra=require(_0xcb76('0xb'));var _=require(_0xcb76('0xc'));var squel=require(_0xcb76('0xd'));var crypto=require(_0xcb76('0xe'));var jsforce=require(_0xcb76('0xf'));var deskjs=require(_0xcb76('0x10'));var toCsv=require(_0xcb76('0x9'));var querystring=require('querystring');var Papa=require(_0xcb76('0x11'));var Redis=require(_0xcb76('0x12'));var authService=require(_0xcb76('0x13'));var qs=require(_0xcb76('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb76('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcb76('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1534a2,_0x20d300){_0x20d300=_0x20d300||0xcc;return function(_0x254504){if(_0x254504){return _0x1534a2['sendStatus'](_0x20d300);}return _0x1534a2[_0xcb76('0x17')](_0x20d300)[_0xcb76('0x18')]();};}function respondWithResult(_0x191333,_0x5b0278){_0x5b0278=_0x5b0278||0xc8;return function(_0x7d7fe6){if(_0x7d7fe6){return _0x191333[_0xcb76('0x17')](_0x5b0278)[_0xcb76('0x19')](_0x7d7fe6);}};}function respondWithFilteredResult(_0x3f9b22,_0x2e27a6){return function(_0x16ceb9){if(_0x16ceb9){var _0x1066c6=typeof _0x2e27a6['offset']==='undefined'&&typeof _0x2e27a6['limit']==='undefined';var _0x28a3e6=_0x16ceb9[_0xcb76('0x1a')];var _0x3e3d9d=_0x1066c6?0x0:_0x2e27a6['offset'];var _0x4f38e4=_0x1066c6?_0x16ceb9[_0xcb76('0x1a')]:_0x2e27a6[_0xcb76('0x1b')]+_0x2e27a6[_0xcb76('0x1c')];var _0x35626a;if(_0x4f38e4>=_0x28a3e6){_0x4f38e4=_0x28a3e6;_0x35626a=0xc8;}else{_0x35626a=0xce;}_0x3f9b22[_0xcb76('0x17')](_0x35626a);return _0x3f9b22[_0xcb76('0x1d')](_0xcb76('0x1e'),_0x3e3d9d+'-'+_0x4f38e4+'/'+_0x28a3e6)[_0xcb76('0x19')](_0x16ceb9);}return null;};}function patchUpdates(_0x41704c){return function(_0x35c922){try{jsonpatch['apply'](_0x35c922,_0x41704c,!![]);}catch(_0x9bf589){return BPromise[_0xcb76('0x1f')](_0x9bf589);}return _0x35c922[_0xcb76('0x20')]();};}function saveUpdates(_0x3193db,_0x174b8c){return function(_0x317f05){if(_0x317f05){return _0x317f05[_0xcb76('0x21')](_0x3193db)['then'](function(_0x4a44ad){return _0x4a44ad;});}return null;};}function removeEntity(_0x677479,_0x2e359d){return function(_0x197127){if(_0x197127){return _0x197127[_0xcb76('0x22')]()[_0xcb76('0x23')](function(){_0x677479[_0xcb76('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f5c01,_0x141ddb){return function(_0x4085e2){if(!_0x4085e2){_0x4f5c01[_0xcb76('0x24')](0x194);}return _0x4085e2;};}function handleError(_0x3fa809,_0x231c0d){_0x231c0d=_0x231c0d||0x1f4;return function(_0x5cbb10){logger[_0xcb76('0x25')](_0x5cbb10[_0xcb76('0x26')]);if(_0x5cbb10[_0xcb76('0x27')]){delete _0x5cbb10[_0xcb76('0x27')];}_0x3fa809[_0xcb76('0x17')](_0x231c0d)[_0xcb76('0x28')](_0x5cbb10);};}exports['index']=function(_0x662e26,_0x4b2a32){var _0x558fb2={},_0x1fee3f={},_0x363aab={'count':0x0,'rows':[]};var _0x108954=_[_0xcb76('0x29')](db[_0xcb76('0x2a')][_0xcb76('0x2b')],function(_0x1104fa){return{'name':_0x1104fa[_0xcb76('0x2c')],'type':_0x1104fa['type']['key']};});_0x1fee3f[_0xcb76('0x2d')]=_[_0xcb76('0x29')](_0x108954,_0xcb76('0x27'));_0x1fee3f[_0xcb76('0x2e')]=_[_0xcb76('0x2f')](_0x662e26[_0xcb76('0x2e')]);_0x1fee3f[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x1fee3f['model'],_0x1fee3f['query']);_0x558fb2['attributes']=_[_0xcb76('0x31')](_0x1fee3f[_0xcb76('0x2d')],qs[_0xcb76('0x32')](_0x662e26['query'][_0xcb76('0x32')]));_0x558fb2[_0xcb76('0x33')]=_0x558fb2[_0xcb76('0x33')][_0xcb76('0x34')]?_0x558fb2['attributes']:_0x1fee3f[_0xcb76('0x2d')];if(!_0x662e26[_0xcb76('0x2e')]['hasOwnProperty'](_0xcb76('0x35'))){_0x558fb2[_0xcb76('0x1c')]=qs['limit'](_0x662e26[_0xcb76('0x2e')][_0xcb76('0x1c')]);_0x558fb2[_0xcb76('0x1b')]=qs['offset'](_0x662e26['query'][_0xcb76('0x1b')]);}_0x558fb2['order']=qs['sort'](_0x662e26[_0xcb76('0x2e')]['sort']);_0x558fb2[_0xcb76('0x36')]=qs[_0xcb76('0x30')](_[_0xcb76('0x37')](_0x662e26['query'],_0x1fee3f['filters']),_0x108954);if(_0x662e26[_0xcb76('0x2e')]['filter']){_0x558fb2[_0xcb76('0x36')]=_[_0xcb76('0x38')](_0x558fb2[_0xcb76('0x36')],{'$or':_[_0xcb76('0x29')](_0x108954,function(_0x3a5b79){if(_0x3a5b79['type']!==_0xcb76('0x39')){var _0x159cbf={};_0x159cbf[_0x3a5b79[_0xcb76('0x27')]]={'$like':'%'+_0x662e26[_0xcb76('0x2e')][_0xcb76('0x3a')]+'%'};return _0x159cbf;}})});}_0x558fb2=_[_0xcb76('0x38')]({},_0x558fb2,_0x662e26[_0xcb76('0x3b')]);var _0x4ba7a8={'where':_0x558fb2['where']};return db[_0xcb76('0x2a')][_0xcb76('0x1a')](_0x4ba7a8)[_0xcb76('0x23')](function(_0x4364a9){_0x363aab['count']=_0x4364a9;if(_0x662e26[_0xcb76('0x2e')]['includeAll']){_0x558fb2[_0xcb76('0x3c')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x558fb2);})[_0xcb76('0x23')](function(_0x336bb6){_0x363aab['rows']=_0x336bb6;return _0x363aab;})[_0xcb76('0x23')](respondWithFilteredResult(_0x4b2a32,_0x558fb2))[_0xcb76('0x3d')](handleError(_0x4b2a32,null));};exports[_0xcb76('0x3e')]=function(_0x598801,_0x1f9a0f){var _0xd057ec={'raw':![],'where':{'id':_0x598801[_0xcb76('0x3f')]['id']}},_0x2bfdd0={};_0x2bfdd0[_0xcb76('0x2d')]=_[_0xcb76('0x2f')](db[_0xcb76('0x2a')]['rawAttributes']);_0x2bfdd0[_0xcb76('0x2e')]=_['keys'](_0x598801[_0xcb76('0x2e')]);_0x2bfdd0[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x2bfdd0[_0xcb76('0x2d')],_0x2bfdd0[_0xcb76('0x2e')]);_0xd057ec[_0xcb76('0x33')]=_[_0xcb76('0x31')](_0x2bfdd0['model'],qs[_0xcb76('0x32')](_0x598801[_0xcb76('0x2e')][_0xcb76('0x32')]));_0xd057ec['attributes']=_0xd057ec[_0xcb76('0x33')][_0xcb76('0x34')]?_0xd057ec['attributes']:_0x2bfdd0['model'];if(_0x598801[_0xcb76('0x2e')][_0xcb76('0x40')]){_0xd057ec[_0xcb76('0x3c')]=[{'all':!![]}];}_0xd057ec=_[_0xcb76('0x38')]({},_0xd057ec,_0x598801[_0xcb76('0x3b')]);return db[_0xcb76('0x2a')][_0xcb76('0x41')](_0xd057ec)['then'](handleEntityNotFound(_0x1f9a0f,null))[_0xcb76('0x23')](respondWithResult(_0x1f9a0f,null))[_0xcb76('0x3d')](handleError(_0x1f9a0f,null));};exports[_0xcb76('0x42')]=function(_0x4466fa,_0x35d26e){return db[_0xcb76('0x2a')][_0xcb76('0x42')](_0x4466fa['body'],{})[_0xcb76('0x23')](respondWithResult(_0x35d26e,0xc9))[_0xcb76('0x3d')](handleError(_0x35d26e,null));};exports['update']=function(_0x3d8d49,_0xc485b7){if(_0x3d8d49[_0xcb76('0x43')]['id']){delete _0x3d8d49['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x3d8d49[_0xcb76('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc485b7,null))['then'](saveUpdates(_0x3d8d49['body'],null))[_0xcb76('0x23')](respondWithResult(_0xc485b7,null))[_0xcb76('0x3d')](handleError(_0xc485b7,null));};exports[_0xcb76('0x22')]=function(_0x4a5acf,_0x36f67f){return db['VtigerConfiguration'][_0xcb76('0x41')]({'where':{'id':_0x4a5acf['params']['id']}})['then'](handleEntityNotFound(_0x36f67f,null))[_0xcb76('0x23')](removeEntity(_0x36f67f,null))[_0xcb76('0x3d')](handleError(_0x36f67f,null));};exports[_0xcb76('0x44')]=function(_0x56e106,_0x570191,_0x45b0a3){var _0x26af38={};var _0x371c6b={};var _0x314f43;var _0x3fa88;return db['VtigerConfiguration'][_0xcb76('0x45')]({'where':{'id':_0x56e106[_0xcb76('0x3f')]['id']}})[_0xcb76('0x23')](handleEntityNotFound(_0x570191,null))[_0xcb76('0x23')](function(_0xf380e0){if(_0xf380e0){_0x314f43=_0xf380e0;_0x371c6b['model']=_[_0xcb76('0x2f')](db[_0xcb76('0x46')][_0xcb76('0x2b')]);_0x371c6b['query']=_[_0xcb76('0x2f')](_0x56e106['query']);_0x371c6b[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x371c6b[_0xcb76('0x2d')],_0x371c6b[_0xcb76('0x2e')]);_0x26af38[_0xcb76('0x33')]=_[_0xcb76('0x31')](_0x371c6b[_0xcb76('0x2d')],qs[_0xcb76('0x32')](_0x56e106[_0xcb76('0x2e')]['fields']));_0x26af38[_0xcb76('0x33')]=_0x26af38['attributes'][_0xcb76('0x34')]?_0x26af38[_0xcb76('0x33')]:_0x371c6b[_0xcb76('0x2d')];_0x26af38['order']=qs[_0xcb76('0x47')](_0x56e106['query']['sort']);_0x26af38['where']=qs[_0xcb76('0x30')](_[_0xcb76('0x37')](_0x56e106[_0xcb76('0x2e')],_0x371c6b[_0xcb76('0x30')]));if(_0x56e106[_0xcb76('0x2e')][_0xcb76('0x3a')]){_0x26af38[_0xcb76('0x36')]=_[_0xcb76('0x38')](_0x26af38[_0xcb76('0x36')],{'$or':_[_0xcb76('0x29')](_0x26af38['attributes'],function(_0xf87b40){var _0x5a6b17={};_0x5a6b17[_0xf87b40]={'$like':'%'+_0x56e106[_0xcb76('0x2e')]['filter']+'%'};return _0x5a6b17;})});}_0x26af38=_['merge']({},_0x26af38,_0x56e106[_0xcb76('0x3b')]);return _0x314f43[_0xcb76('0x44')](_0x26af38);}})[_0xcb76('0x23')](function(_0x499d71){if(_0x499d71){_0x3fa88=_0x499d71[_0xcb76('0x34')];if(!_0x56e106[_0xcb76('0x2e')][_0xcb76('0x48')](_0xcb76('0x35'))){_0x26af38[_0xcb76('0x1c')]=qs[_0xcb76('0x1c')](_0x56e106[_0xcb76('0x2e')]['limit']);_0x26af38['offset']=qs[_0xcb76('0x1b')](_0x56e106[_0xcb76('0x2e')][_0xcb76('0x1b')]);}return _0x314f43[_0xcb76('0x44')](_0x26af38);}})['then'](function(_0x337a67){if(_0x337a67){return _0x337a67?{'count':_0x3fa88,'rows':_0x337a67}:null;}})[_0xcb76('0x23')](respondWithResult(_0x570191,null))['catch'](handleError(_0x570191,null));};exports[_0xcb76('0x49')]=function(_0x104ce9,_0x2ebebc,_0x13e567){var _0x22d223={};var _0x653c64={};var _0x5d1548;var _0xbafbeb;return db[_0xcb76('0x2a')][_0xcb76('0x45')]({'where':{'id':_0x104ce9[_0xcb76('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ebebc,null))['then'](function(_0x353bb5){if(_0x353bb5){_0x5d1548=_0x353bb5;_0x653c64['model']=_[_0xcb76('0x2f')](db[_0xcb76('0x46')][_0xcb76('0x2b')]);_0x653c64['query']=_[_0xcb76('0x2f')](_0x104ce9[_0xcb76('0x2e')]);_0x653c64[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x653c64[_0xcb76('0x2d')],_0x653c64[_0xcb76('0x2e')]);_0x22d223['attributes']=_[_0xcb76('0x31')](_0x653c64[_0xcb76('0x2d')],qs[_0xcb76('0x32')](_0x104ce9[_0xcb76('0x2e')]['fields']));_0x22d223[_0xcb76('0x33')]=_0x22d223['attributes'][_0xcb76('0x34')]?_0x22d223[_0xcb76('0x33')]:_0x653c64[_0xcb76('0x2d')];_0x22d223[_0xcb76('0x4a')]=qs[_0xcb76('0x47')](_0x104ce9[_0xcb76('0x2e')]['sort']);_0x22d223[_0xcb76('0x36')]=qs['filters'](_[_0xcb76('0x37')](_0x104ce9[_0xcb76('0x2e')],_0x653c64[_0xcb76('0x30')]));if(_0x104ce9[_0xcb76('0x2e')]['filter']){_0x22d223[_0xcb76('0x36')]=_[_0xcb76('0x38')](_0x22d223[_0xcb76('0x36')],{'$or':_['map'](_0x22d223[_0xcb76('0x33')],function(_0x277c23){var _0x1c0684={};_0x1c0684[_0x277c23]={'$like':'%'+_0x104ce9[_0xcb76('0x2e')][_0xcb76('0x3a')]+'%'};return _0x1c0684;})});}_0x22d223=_[_0xcb76('0x38')]({},_0x22d223,_0x104ce9[_0xcb76('0x3b')]);return _0x5d1548[_0xcb76('0x49')](_0x22d223);}})[_0xcb76('0x23')](function(_0x19d67a){if(_0x19d67a){_0xbafbeb=_0x19d67a[_0xcb76('0x34')];if(!_0x104ce9[_0xcb76('0x2e')]['hasOwnProperty'](_0xcb76('0x35'))){_0x22d223[_0xcb76('0x1c')]=qs[_0xcb76('0x1c')](_0x104ce9['query']['limit']);_0x22d223[_0xcb76('0x1b')]=qs['offset'](_0x104ce9[_0xcb76('0x2e')][_0xcb76('0x1b')]);}return _0x5d1548[_0xcb76('0x49')](_0x22d223);}})[_0xcb76('0x23')](function(_0x254229){if(_0x254229){return _0x254229?{'count':_0xbafbeb,'rows':_0x254229}:null;}})[_0xcb76('0x23')](respondWithResult(_0x2ebebc,null))['catch'](handleError(_0x2ebebc,null));};exports[_0xcb76('0x4b')]=function(_0x50d632,_0x808ddf,_0x50e2b8){var _0xeb11f6={};var _0x8b2c3b={};var _0x2a2b17;var _0x1d3702;return db[_0xcb76('0x2a')][_0xcb76('0x45')]({'where':{'id':_0x50d632[_0xcb76('0x3f')]['id']}})['then'](handleEntityNotFound(_0x808ddf,null))[_0xcb76('0x23')](function(_0x501b82){if(_0x501b82){_0x2a2b17=_0x501b82;_0x8b2c3b[_0xcb76('0x2d')]=_[_0xcb76('0x2f')](db['VtigerField'][_0xcb76('0x2b')]);_0x8b2c3b[_0xcb76('0x2e')]=_[_0xcb76('0x2f')](_0x50d632['query']);_0x8b2c3b[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x8b2c3b[_0xcb76('0x2d')],_0x8b2c3b[_0xcb76('0x2e')]);_0xeb11f6['attributes']=_['intersection'](_0x8b2c3b[_0xcb76('0x2d')],qs[_0xcb76('0x32')](_0x50d632[_0xcb76('0x2e')][_0xcb76('0x32')]));_0xeb11f6[_0xcb76('0x33')]=_0xeb11f6[_0xcb76('0x33')][_0xcb76('0x34')]?_0xeb11f6[_0xcb76('0x33')]:_0x8b2c3b['model'];_0xeb11f6[_0xcb76('0x4a')]=qs[_0xcb76('0x47')](_0x50d632[_0xcb76('0x2e')]['sort']);_0xeb11f6[_0xcb76('0x36')]=qs[_0xcb76('0x30')](_[_0xcb76('0x37')](_0x50d632[_0xcb76('0x2e')],_0x8b2c3b[_0xcb76('0x30')]));if(_0x50d632[_0xcb76('0x2e')]['filter']){_0xeb11f6['where']=_[_0xcb76('0x38')](_0xeb11f6[_0xcb76('0x36')],{'$or':_['map'](_0xeb11f6[_0xcb76('0x33')],function(_0x5a27f6){var _0x4cb040={};_0x4cb040[_0x5a27f6]={'$like':'%'+_0x50d632[_0xcb76('0x2e')]['filter']+'%'};return _0x4cb040;})});}_0xeb11f6=_[_0xcb76('0x38')]({},_0xeb11f6,_0x50d632[_0xcb76('0x3b')]);return _0x2a2b17[_0xcb76('0x4b')](_0xeb11f6);}})[_0xcb76('0x23')](function(_0x669495){if(_0x669495){_0x1d3702=_0x669495['length'];if(!_0x50d632[_0xcb76('0x2e')][_0xcb76('0x48')](_0xcb76('0x35'))){_0xeb11f6['limit']=qs['limit'](_0x50d632[_0xcb76('0x2e')][_0xcb76('0x1c')]);_0xeb11f6['offset']=qs[_0xcb76('0x1b')](_0x50d632[_0xcb76('0x2e')][_0xcb76('0x1b')]);}return _0x2a2b17[_0xcb76('0x4b')](_0xeb11f6);}})['then'](function(_0x220872){if(_0x220872){return _0x220872?{'count':_0x1d3702,'rows':_0x220872}:null;}})[_0xcb76('0x23')](respondWithResult(_0x808ddf,null))['catch'](handleError(_0x808ddf,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6801c59..323e67d 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0af4=['define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x38b8fe,_0xf92b91){var _0x3ff981=function(_0x149767){while(--_0x149767){_0x38b8fe['push'](_0x38b8fe['shift']());}};_0x3ff981(++_0xf92b91);}(_0x0af4,0x1bd));var _0x40af=function(_0x16302e,_0x46067f){_0x16302e=_0x16302e-0x0;var _0x153623=_0x0af4[_0x16302e];return _0x153623;};'use strict';var _=require(_0x40af('0x0'));var util=require(_0x40af('0x1'));var logger=require(_0x40af('0x2'))(_0x40af('0x3'));var moment=require(_0x40af('0x4'));var BPromise=require(_0x40af('0x5'));var rp=require(_0x40af('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x40af('0x7'));var attributes=require(_0x40af('0x8'));module[_0x40af('0x9')]=function(_0x3acc03,_0x40e1b4){return _0x3acc03[_0x40af('0xa')](_0x40af('0xb'),attributes,{'tableName':_0x40af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3797=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x528557,_0x522e3e){var _0x5620be=function(_0x1708c1){while(--_0x1708c1){_0x528557['push'](_0x528557['shift']());}};_0x5620be(++_0x522e3e);}(_0x3797,0x114));var _0x7379=function(_0x5ab305,_0x2ffb48){_0x5ab305=_0x5ab305-0x0;var _0x4af076=_0x3797[_0x5ab305];return _0x4af076;};'use strict';var _=require(_0x7379('0x0'));var util=require(_0x7379('0x1'));var logger=require(_0x7379('0x2'))(_0x7379('0x3'));var moment=require(_0x7379('0x4'));var BPromise=require(_0x7379('0x5'));var rp=require(_0x7379('0x6'));var fs=require('fs');var path=require(_0x7379('0x7'));var rimraf=require(_0x7379('0x8'));var config=require(_0x7379('0x9'));var attributes=require(_0x7379('0xa'));module[_0x7379('0xb')]=function(_0x2b98b8,_0x30c6d8){return _0x2b98b8[_0x7379('0xc')](_0x7379('0xd'),attributes,{'tableName':_0x7379('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 9f621b2..57b4cbd 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd07d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util'];(function(_0x3f792f,_0x4cd7a6){var _0x451b3f=function(_0x2e0a6f){while(--_0x2e0a6f){_0x3f792f['push'](_0x3f792f['shift']());}};_0x451b3f(++_0x4cd7a6);}(_0xd07d,0x136));var _0xdd07=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0xd07d[_0x1034bb];return _0x453fdb;};'use strict';var _=require(_0xdd07('0x0'));var util=require(_0xdd07('0x1'));var moment=require('moment');var BPromise=require(_0xdd07('0x2'));var rs=require(_0xdd07('0x3'));var fs=require('fs');var Redis=require(_0xdd07('0x4'));var db=require(_0xdd07('0x5'))['db'];var utils=require(_0xdd07('0x6'));var logger=require(_0xdd07('0x7'))(_0xdd07('0x8'));var config=require(_0xdd07('0x9'));var jayson=require(_0xdd07('0xa'));var client=jayson[_0xdd07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x380a33,_0x278aee,_0x1cef70){return new BPromise(function(_0x3bd929,_0x2fc1e3){return client[_0xdd07('0xc')](_0x380a33,_0x1cef70)[_0xdd07('0xd')](function(_0x1496a2){logger['info'](_0xdd07('0xe'),_0x278aee,_0xdd07('0xf'));logger[_0xdd07('0x10')](_0xdd07('0x11'),_0x278aee,_0xdd07('0xf'),JSON[_0xdd07('0x12')](_0x1496a2));if(_0x1496a2[_0xdd07('0x13')]){if(_0x1496a2[_0xdd07('0x13')][_0xdd07('0x14')]===0x1f4){logger[_0xdd07('0x13')](_0xdd07('0xe'),_0x278aee,_0x1496a2[_0xdd07('0x13')][_0xdd07('0x15')]);return _0x2fc1e3(_0x1496a2[_0xdd07('0x13')][_0xdd07('0x15')]);}logger[_0xdd07('0x13')](_0xdd07('0xe'),_0x278aee,_0x1496a2[_0xdd07('0x13')][_0xdd07('0x15')]);return _0x3bd929(_0x1496a2[_0xdd07('0x13')][_0xdd07('0x15')]);}else{logger[_0xdd07('0x16')]('VtigerConfiguration,\x20%s,\x20%s',_0x278aee,_0xdd07('0xf'));_0x3bd929(_0x1496a2[_0xdd07('0x17')][_0xdd07('0x15')]);}})['catch'](function(_0x4be8cb){logger[_0xdd07('0x13')](_0xdd07('0xe'),_0x278aee,_0x4be8cb);_0x2fc1e3(_0x4be8cb);});});} \ No newline at end of file +var _0xda8c=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xda8c,0x18c));var _0xcda8=function(_0xeba235,_0x145da4){_0xeba235=_0xeba235-0x0;var _0x1034c8=_0xda8c[_0xeba235];return _0x1034c8;};'use strict';var _=require(_0xcda8('0x0'));var util=require(_0xcda8('0x1'));var moment=require('moment');var BPromise=require(_0xcda8('0x2'));var rs=require(_0xcda8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcda8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcda8('0x5'))(_0xcda8('0x6'));var config=require('../../config/environment');var jayson=require(_0xcda8('0x7'));var client=jayson[_0xcda8('0x8')][_0xcda8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa1d282,_0x21fa64,_0x29a215){return new BPromise(function(_0x34885e,_0x56a4f8){return client[_0xcda8('0xa')](_0xa1d282,_0x29a215)[_0xcda8('0xb')](function(_0x1615d2){logger[_0xcda8('0xc')](_0xcda8('0xd'),_0x21fa64,_0xcda8('0xe'));logger[_0xcda8('0xf')](_0xcda8('0x10'),_0x21fa64,'request\x20sent',JSON[_0xcda8('0x11')](_0x1615d2));if(_0x1615d2[_0xcda8('0x12')]){if(_0x1615d2[_0xcda8('0x12')][_0xcda8('0x13')]===0x1f4){logger[_0xcda8('0x12')](_0xcda8('0xd'),_0x21fa64,_0x1615d2[_0xcda8('0x12')][_0xcda8('0x14')]);return _0x56a4f8(_0x1615d2[_0xcda8('0x12')][_0xcda8('0x14')]);}logger[_0xcda8('0x12')](_0xcda8('0xd'),_0x21fa64,_0x1615d2['error'][_0xcda8('0x14')]);return _0x34885e(_0x1615d2[_0xcda8('0x12')][_0xcda8('0x14')]);}else{logger['info'](_0xcda8('0xd'),_0x21fa64,'request\x20sent');_0x34885e(_0x1615d2['result'][_0xcda8('0x14')]);}})[_0xcda8('0x15')](function(_0x3b4724){logger[_0xcda8('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x21fa64,_0x3b4724);_0x56a4f8(_0x3b4724);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7ad1718..6f91518 100644 --- a/server/api/intVtigerField/index.js +++ b/server/api/intVtigerField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ac9=['Router','fs-extra','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0xb3a79a,_0x389002){var _0x33065e=function(_0x3c96b4){while(--_0x3c96b4){_0xb3a79a['push'](_0xb3a79a['shift']());}};_0x33065e(++_0x389002);}(_0x5ac9,0x155));var _0x95ac=function(_0x626422,_0x260656){_0x626422=_0x626422-0x0;var _0x150dda=_0x5ac9[_0x626422];return _0x150dda;};'use strict';var multer=require(_0x95ac('0x0'));var util=require('util');var path=require(_0x95ac('0x1'));var timeout=require(_0x95ac('0x2'));var express=require(_0x95ac('0x3'));var router=express[_0x95ac('0x4')]();var fs_extra=require(_0x95ac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x95ac('0x6'));var config=require('../../config/environment');var controller=require(_0x95ac('0x7'));router[_0x95ac('0x8')]('/',auth[_0x95ac('0x9')](),controller[_0x95ac('0xa')]);router[_0x95ac('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x95ac('0x9')](),controller['create']);router['put'](_0x95ac('0xb'),auth[_0x95ac('0x9')](),controller[_0x95ac('0xc')]);router[_0x95ac('0xd')]('/:id',auth[_0x95ac('0x9')](),controller[_0x95ac('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4ae8=['/:id','update','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','put'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x4ae8,0x113));var _0x84ae=function(_0x4b3a73,_0x1335f9){_0x4b3a73=_0x4b3a73-0x0;var _0xeb244f=_0x4ae8[_0x4b3a73];return _0xeb244f;};'use strict';var multer=require(_0x84ae('0x0'));var util=require(_0x84ae('0x1'));var path=require('path');var timeout=require(_0x84ae('0x2'));var express=require(_0x84ae('0x3'));var router=express['Router']();var fs_extra=require(_0x84ae('0x4'));var auth=require(_0x84ae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x84ae('0x6'));var controller=require('./intVtigerField.controller');router[_0x84ae('0x7')]('/',auth['isAuthenticated'](),controller[_0x84ae('0x8')]);router[_0x84ae('0x7')]('/:id',auth[_0x84ae('0x9')](),controller[_0x84ae('0xa')]);router[_0x84ae('0xb')]('/',auth[_0x84ae('0x9')](),controller[_0x84ae('0xc')]);router[_0x84ae('0xd')](_0x84ae('0xe'),auth[_0x84ae('0x9')](),controller[_0x84ae('0xf')]);router[_0x84ae('0x10')]('/:id',auth[_0x84ae('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 805d91a..1369338 100644 --- a/server/api/intVtigerField/intVtigerField.attributes.js +++ b/server/api/intVtigerField/intVtigerField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb397=['customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xb397,0x135));var _0x7b39=function(_0x3a01bd,_0x1a9e18){_0x3a01bd=_0x3a01bd-0x0;var _0x44eef9=_0xb397[_0x3a01bd];return _0x44eef9;};'use strict';var Sequelize=require(_0x7b39('0x0'));module[_0x7b39('0x1')]={'type':{'type':Sequelize[_0x7b39('0x2')]('string','variable',_0x7b39('0x3'),_0x7b39('0x4'),_0x7b39('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7b39('0x6')]},'keyType':{'type':Sequelize[_0x7b39('0x2')]('string',_0x7b39('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x7b39('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b39('0x6')]}}; \ No newline at end of file +var _0x011e=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x58f2d9,_0x224634){var _0x3271fc=function(_0x35b432){while(--_0x35b432){_0x58f2d9['push'](_0x58f2d9['shift']());}};_0x3271fc(++_0x224634);}(_0x011e,0x190));var _0xe011=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x011e[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xe011('0x0'));module[_0xe011('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe011('0x2'),_0xe011('0x3'),_0xe011('0x4'),_0xe011('0x5'),_0xe011('0x6')),'defaultValue':_0xe011('0x2')},'content':{'type':Sequelize[_0xe011('0x7')]},'key':{'type':Sequelize[_0xe011('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xe011('0x2'),_0xe011('0x3'),_0xe011('0x4'))},'keyContent':{'type':Sequelize[_0xe011('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe011('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe011('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 224b11b..74aac83 100644 --- a/server/api/intVtigerField/intVtigerField.controller.js +++ b/server/api/intVtigerField/intVtigerField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92c3=['offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','VtigerField','count','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0x92c3,0x1e8));var _0x392c=function(_0x4edcd9,_0x21dcc){_0x4edcd9=_0x4edcd9-0x0;var _0x3d58f5=_0x92c3[_0x4edcd9];return _0x3d58f5;};'use strict';var emlformat=require(_0x392c('0x0'));var rimraf=require(_0x392c('0x1'));var zipdir=require(_0x392c('0x2'));var jsonpatch=require(_0x392c('0x3'));var rp=require(_0x392c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x392c('0x5'));var util=require(_0x392c('0x6'));var path=require(_0x392c('0x7'));var sox=require(_0x392c('0x8'));var csv=require(_0x392c('0x9'));var ejs=require(_0x392c('0xa'));var fs=require('fs');var fs_extra=require(_0x392c('0xb'));var _=require(_0x392c('0xc'));var squel=require(_0x392c('0xd'));var crypto=require(_0x392c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x392c('0xf'));var toCsv=require(_0x392c('0x9'));var querystring=require('querystring');var Papa=require(_0x392c('0x10'));var Redis=require(_0x392c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x392c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x392c('0x13'));var logger=require(_0x392c('0x14'))('api');var utils=require(_0x392c('0x15'));var config=require(_0x392c('0x16'));var licenseUtil=require(_0x392c('0x17'));var db=require(_0x392c('0x18'))['db'];function respondWithStatusCode(_0x283dec,_0x1fcff8){_0x1fcff8=_0x1fcff8||0xcc;return function(_0x37483b){if(_0x37483b){return _0x283dec[_0x392c('0x19')](_0x1fcff8);}return _0x283dec['status'](_0x1fcff8)[_0x392c('0x1a')]();};}function respondWithResult(_0x2ad854,_0x4b6c89){_0x4b6c89=_0x4b6c89||0xc8;return function(_0x4675e9){if(_0x4675e9){return _0x2ad854[_0x392c('0x1b')](_0x4b6c89)[_0x392c('0x1c')](_0x4675e9);}};}function respondWithFilteredResult(_0x3674a2,_0x19f5bb){return function(_0xba30b9){if(_0xba30b9){var _0x3b9a0f=typeof _0x19f5bb['offset']===_0x392c('0x1d')&&typeof _0x19f5bb['limit']===_0x392c('0x1d');var _0x251a33=_0xba30b9['count'];var _0x2408a5=_0x3b9a0f?0x0:_0x19f5bb[_0x392c('0x1e')];var _0x5b588f=_0x3b9a0f?_0xba30b9['count']:_0x19f5bb[_0x392c('0x1e')]+_0x19f5bb[_0x392c('0x1f')];var _0xf8c1e5;if(_0x5b588f>=_0x251a33){_0x5b588f=_0x251a33;_0xf8c1e5=0xc8;}else{_0xf8c1e5=0xce;}_0x3674a2['status'](_0xf8c1e5);return _0x3674a2[_0x392c('0x20')](_0x392c('0x21'),_0x2408a5+'-'+_0x5b588f+'/'+_0x251a33)[_0x392c('0x1c')](_0xba30b9);}return null;};}function patchUpdates(_0x6341d5){return function(_0x25eeed){try{jsonpatch[_0x392c('0x22')](_0x25eeed,_0x6341d5,!![]);}catch(_0x3fd068){return BPromise['reject'](_0x3fd068);}return _0x25eeed[_0x392c('0x23')]();};}function saveUpdates(_0x4c74cc,_0x30e233){return function(_0x196999){if(_0x196999){return _0x196999['update'](_0x4c74cc)[_0x392c('0x24')](function(_0x30c9fc){return _0x30c9fc;});}return null;};}function removeEntity(_0x1b0c35,_0x1e5d22){return function(_0xb68974){if(_0xb68974){return _0xb68974[_0x392c('0x25')]()[_0x392c('0x24')](function(){_0x1b0c35['status'](0xcc)[_0x392c('0x1a')]();});}};}function handleEntityNotFound(_0x61b905,_0x350c7e){return function(_0x46b17b){if(!_0x46b17b){_0x61b905[_0x392c('0x19')](0x194);}return _0x46b17b;};}function handleError(_0x21d3ad,_0x333415){_0x333415=_0x333415||0x1f4;return function(_0x4c75b5){logger['error'](_0x4c75b5[_0x392c('0x26')]);if(_0x4c75b5[_0x392c('0x27')]){delete _0x4c75b5[_0x392c('0x27')];}_0x21d3ad[_0x392c('0x1b')](_0x333415)['send'](_0x4c75b5);};}exports['index']=function(_0x37cc0b,_0x1a227e){var _0x23a3cc={},_0x535341={},_0x8162d9={'count':0x0,'rows':[]};var _0x2db36a=_[_0x392c('0x28')](db['VtigerField'][_0x392c('0x29')],function(_0x3ff1df){return{'name':_0x3ff1df[_0x392c('0x2a')],'type':_0x3ff1df[_0x392c('0x2b')][_0x392c('0x2c')]};});_0x535341['model']=_['map'](_0x2db36a,_0x392c('0x27'));_0x535341[_0x392c('0x2d')]=_[_0x392c('0x2e')](_0x37cc0b[_0x392c('0x2d')]);_0x535341[_0x392c('0x2f')]=_['intersection'](_0x535341[_0x392c('0x30')],_0x535341[_0x392c('0x2d')]);_0x23a3cc['attributes']=_[_0x392c('0x31')](_0x535341[_0x392c('0x30')],qs[_0x392c('0x32')](_0x37cc0b[_0x392c('0x2d')]['fields']));_0x23a3cc[_0x392c('0x33')]=_0x23a3cc[_0x392c('0x33')][_0x392c('0x34')]?_0x23a3cc[_0x392c('0x33')]:_0x535341[_0x392c('0x30')];if(!_0x37cc0b['query']['hasOwnProperty'](_0x392c('0x35'))){_0x23a3cc[_0x392c('0x1f')]=qs['limit'](_0x37cc0b['query'][_0x392c('0x1f')]);_0x23a3cc[_0x392c('0x1e')]=qs[_0x392c('0x1e')](_0x37cc0b[_0x392c('0x2d')][_0x392c('0x1e')]);}_0x23a3cc[_0x392c('0x36')]=qs[_0x392c('0x37')](_0x37cc0b[_0x392c('0x2d')][_0x392c('0x37')]);_0x23a3cc[_0x392c('0x38')]=qs[_0x392c('0x2f')](_[_0x392c('0x39')](_0x37cc0b[_0x392c('0x2d')],_0x535341[_0x392c('0x2f')]),_0x2db36a);if(_0x37cc0b['query']['filter']){_0x23a3cc[_0x392c('0x38')]=_[_0x392c('0x3a')](_0x23a3cc[_0x392c('0x38')],{'$or':_['map'](_0x2db36a,function(_0x202c8d){if(_0x202c8d[_0x392c('0x2b')]!=='VIRTUAL'){var _0x424836={};_0x424836[_0x202c8d['name']]={'$like':'%'+_0x37cc0b[_0x392c('0x2d')][_0x392c('0x3b')]+'%'};return _0x424836;}})});}_0x23a3cc=_[_0x392c('0x3a')]({},_0x23a3cc,_0x37cc0b[_0x392c('0x3c')]);var _0x82ae4a={'where':_0x23a3cc[_0x392c('0x38')]};return db[_0x392c('0x3d')][_0x392c('0x3e')](_0x82ae4a)[_0x392c('0x24')](function(_0x35aed0){_0x8162d9[_0x392c('0x3e')]=_0x35aed0;if(_0x37cc0b[_0x392c('0x2d')][_0x392c('0x3f')]){_0x23a3cc[_0x392c('0x40')]=[{'all':!![]}];}return db[_0x392c('0x3d')][_0x392c('0x41')](_0x23a3cc);})[_0x392c('0x24')](function(_0x574f9e){_0x8162d9[_0x392c('0x42')]=_0x574f9e;return _0x8162d9;})[_0x392c('0x24')](respondWithFilteredResult(_0x1a227e,_0x23a3cc))[_0x392c('0x43')](handleError(_0x1a227e,null));};exports[_0x392c('0x44')]=function(_0x30c3e3,_0x2f5c3f){var _0x3d9bce={'raw':!![],'where':{'id':_0x30c3e3[_0x392c('0x45')]['id']}},_0x526867={};_0x526867[_0x392c('0x30')]=_['keys'](db['VtigerField'][_0x392c('0x29')]);_0x526867['query']=_[_0x392c('0x2e')](_0x30c3e3[_0x392c('0x2d')]);_0x526867[_0x392c('0x2f')]=_['intersection'](_0x526867['model'],_0x526867[_0x392c('0x2d')]);_0x3d9bce[_0x392c('0x33')]=_[_0x392c('0x31')](_0x526867[_0x392c('0x30')],qs[_0x392c('0x32')](_0x30c3e3[_0x392c('0x2d')][_0x392c('0x32')]));_0x3d9bce[_0x392c('0x33')]=_0x3d9bce['attributes']['length']?_0x3d9bce[_0x392c('0x33')]:_0x526867['model'];if(_0x30c3e3[_0x392c('0x2d')][_0x392c('0x3f')]){_0x3d9bce[_0x392c('0x40')]=[{'all':!![]}];}_0x3d9bce=_[_0x392c('0x3a')]({},_0x3d9bce,_0x30c3e3[_0x392c('0x3c')]);return db['VtigerField']['find'](_0x3d9bce)[_0x392c('0x24')](handleEntityNotFound(_0x2f5c3f,null))['then'](respondWithResult(_0x2f5c3f,null))[_0x392c('0x43')](handleError(_0x2f5c3f,null));};exports[_0x392c('0x46')]=function(_0x56c47c,_0x18b78a){return db[_0x392c('0x3d')][_0x392c('0x46')](_0x56c47c[_0x392c('0x47')],{})[_0x392c('0x24')](respondWithResult(_0x18b78a,0xc9))[_0x392c('0x43')](handleError(_0x18b78a,null));};exports[_0x392c('0x48')]=function(_0x49ea2c,_0x346bda){if(_0x49ea2c[_0x392c('0x47')]['id']){delete _0x49ea2c[_0x392c('0x47')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x49ea2c[_0x392c('0x45')]['id']}})[_0x392c('0x24')](handleEntityNotFound(_0x346bda,null))[_0x392c('0x24')](saveUpdates(_0x49ea2c['body'],null))[_0x392c('0x24')](respondWithResult(_0x346bda,null))[_0x392c('0x43')](handleError(_0x346bda,null));};exports['destroy']=function(_0x30dae0,_0x39328f){return db[_0x392c('0x3d')][_0x392c('0x49')]({'where':{'id':_0x30dae0['params']['id']}})[_0x392c('0x24')](handleEntityNotFound(_0x39328f,null))[_0x392c('0x24')](removeEntity(_0x39328f,null))[_0x392c('0x43')](handleError(_0x39328f,null));}; \ No newline at end of file +var _0x79d9=['save','update','then','destroy','error','map','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VtigerField','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x5a2518,_0xeef5c7){var _0x4c66de=function(_0xecb926){while(--_0xecb926){_0x5a2518['push'](_0x5a2518['shift']());}};_0x4c66de(++_0xeef5c7);}(_0x79d9,0x1c3));var _0x979d=function(_0x29a1c2,_0x285889){_0x29a1c2=_0x29a1c2-0x0;var _0x3f33dc=_0x79d9[_0x29a1c2];return _0x3f33dc;};'use strict';var emlformat=require(_0x979d('0x0'));var rimraf=require(_0x979d('0x1'));var zipdir=require(_0x979d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x979d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x979d('0x4'));var util=require(_0x979d('0x5'));var path=require(_0x979d('0x6'));var sox=require(_0x979d('0x7'));var csv=require(_0x979d('0x8'));var ejs=require(_0x979d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x979d('0xa'));var crypto=require(_0x979d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x979d('0x8'));var querystring=require('querystring');var Papa=require(_0x979d('0xc'));var Redis=require(_0x979d('0xd'));var authService=require(_0x979d('0xe'));var qs=require(_0x979d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x979d('0x10'))(_0x979d('0x11'));var utils=require('../../config/utils');var config=require(_0x979d('0x12'));var licenseUtil=require(_0x979d('0x13'));var db=require(_0x979d('0x14'))['db'];function respondWithStatusCode(_0x58e7db,_0x27c1b3){_0x27c1b3=_0x27c1b3||0xcc;return function(_0x2b46f1){if(_0x2b46f1){return _0x58e7db[_0x979d('0x15')](_0x27c1b3);}return _0x58e7db[_0x979d('0x16')](_0x27c1b3)[_0x979d('0x17')]();};}function respondWithResult(_0x34eb23,_0x549a07){_0x549a07=_0x549a07||0xc8;return function(_0x3d38cb){if(_0x3d38cb){return _0x34eb23[_0x979d('0x16')](_0x549a07)[_0x979d('0x18')](_0x3d38cb);}};}function respondWithFilteredResult(_0x5d51f7,_0x2e6e5c){return function(_0x49df15){if(_0x49df15){var _0x90d3b=typeof _0x2e6e5c[_0x979d('0x19')]===_0x979d('0x1a')&&typeof _0x2e6e5c[_0x979d('0x1b')]==='undefined';var _0x46c334=_0x49df15[_0x979d('0x1c')];var _0x15100c=_0x90d3b?0x0:_0x2e6e5c[_0x979d('0x19')];var _0x382f90=_0x90d3b?_0x49df15[_0x979d('0x1c')]:_0x2e6e5c['offset']+_0x2e6e5c[_0x979d('0x1b')];var _0x53cf58;if(_0x382f90>=_0x46c334){_0x382f90=_0x46c334;_0x53cf58=0xc8;}else{_0x53cf58=0xce;}_0x5d51f7[_0x979d('0x16')](_0x53cf58);return _0x5d51f7[_0x979d('0x1d')]('Content-Range',_0x15100c+'-'+_0x382f90+'/'+_0x46c334)[_0x979d('0x18')](_0x49df15);}return null;};}function patchUpdates(_0x14c945){return function(_0x232722){try{jsonpatch[_0x979d('0x1e')](_0x232722,_0x14c945,!![]);}catch(_0xb2c933){return BPromise[_0x979d('0x1f')](_0xb2c933);}return _0x232722[_0x979d('0x20')]();};}function saveUpdates(_0x21811a,_0xe5c294){return function(_0x309084){if(_0x309084){return _0x309084[_0x979d('0x21')](_0x21811a)[_0x979d('0x22')](function(_0x32973){return _0x32973;});}return null;};}function removeEntity(_0xe2b617,_0x314623){return function(_0x86c8f7){if(_0x86c8f7){return _0x86c8f7[_0x979d('0x23')]()[_0x979d('0x22')](function(){_0xe2b617[_0x979d('0x16')](0xcc)[_0x979d('0x17')]();});}};}function handleEntityNotFound(_0x4dcc9e,_0x4f7cf0){return function(_0x91921e){if(!_0x91921e){_0x4dcc9e[_0x979d('0x15')](0x194);}return _0x91921e;};}function handleError(_0x387d73,_0x58afb3){_0x58afb3=_0x58afb3||0x1f4;return function(_0x22a245){logger[_0x979d('0x24')](_0x22a245['stack']);if(_0x22a245['name']){delete _0x22a245['name'];}_0x387d73[_0x979d('0x16')](_0x58afb3)['send'](_0x22a245);};}exports['index']=function(_0x195b81,_0x4af348){var _0x50965e={},_0x1ff8fc={},_0x101b95={'count':0x0,'rows':[]};var _0x4e3d83=_[_0x979d('0x25')](db['VtigerField']['rawAttributes'],function(_0x1f1369){return{'name':_0x1f1369[_0x979d('0x26')],'type':_0x1f1369[_0x979d('0x27')][_0x979d('0x28')]};});_0x1ff8fc[_0x979d('0x29')]=_['map'](_0x4e3d83,_0x979d('0x2a'));_0x1ff8fc[_0x979d('0x2b')]=_['keys'](_0x195b81['query']);_0x1ff8fc[_0x979d('0x2c')]=_[_0x979d('0x2d')](_0x1ff8fc[_0x979d('0x29')],_0x1ff8fc[_0x979d('0x2b')]);_0x50965e['attributes']=_['intersection'](_0x1ff8fc[_0x979d('0x29')],qs['fields'](_0x195b81['query'][_0x979d('0x2e')]));_0x50965e[_0x979d('0x2f')]=_0x50965e['attributes']['length']?_0x50965e[_0x979d('0x2f')]:_0x1ff8fc[_0x979d('0x29')];if(!_0x195b81['query']['hasOwnProperty'](_0x979d('0x30'))){_0x50965e[_0x979d('0x1b')]=qs['limit'](_0x195b81[_0x979d('0x2b')]['limit']);_0x50965e[_0x979d('0x19')]=qs['offset'](_0x195b81[_0x979d('0x2b')]['offset']);}_0x50965e[_0x979d('0x31')]=qs[_0x979d('0x32')](_0x195b81[_0x979d('0x2b')]['sort']);_0x50965e[_0x979d('0x33')]=qs[_0x979d('0x2c')](_[_0x979d('0x34')](_0x195b81[_0x979d('0x2b')],_0x1ff8fc['filters']),_0x4e3d83);if(_0x195b81['query']['filter']){_0x50965e[_0x979d('0x33')]=_[_0x979d('0x35')](_0x50965e[_0x979d('0x33')],{'$or':_[_0x979d('0x25')](_0x4e3d83,function(_0x5dfe4d){if(_0x5dfe4d['type']!==_0x979d('0x36')){var _0x492288={};_0x492288[_0x5dfe4d[_0x979d('0x2a')]]={'$like':'%'+_0x195b81[_0x979d('0x2b')][_0x979d('0x37')]+'%'};return _0x492288;}})});}_0x50965e=_[_0x979d('0x35')]({},_0x50965e,_0x195b81[_0x979d('0x38')]);var _0x5c4520={'where':_0x50965e[_0x979d('0x33')]};return db[_0x979d('0x39')][_0x979d('0x1c')](_0x5c4520)[_0x979d('0x22')](function(_0x56345b){_0x101b95[_0x979d('0x1c')]=_0x56345b;if(_0x195b81[_0x979d('0x2b')][_0x979d('0x3a')]){_0x50965e[_0x979d('0x3b')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x50965e);})[_0x979d('0x22')](function(_0x55db1c){_0x101b95[_0x979d('0x3c')]=_0x55db1c;return _0x101b95;})['then'](respondWithFilteredResult(_0x4af348,_0x50965e))[_0x979d('0x3d')](handleError(_0x4af348,null));};exports[_0x979d('0x3e')]=function(_0x2f69d5,_0x4a18d9){var _0x533eef={'raw':!![],'where':{'id':_0x2f69d5[_0x979d('0x3f')]['id']}},_0x425b2f={};_0x425b2f[_0x979d('0x29')]=_['keys'](db['VtigerField'][_0x979d('0x40')]);_0x425b2f['query']=_['keys'](_0x2f69d5[_0x979d('0x2b')]);_0x425b2f['filters']=_[_0x979d('0x2d')](_0x425b2f[_0x979d('0x29')],_0x425b2f[_0x979d('0x2b')]);_0x533eef['attributes']=_[_0x979d('0x2d')](_0x425b2f[_0x979d('0x29')],qs[_0x979d('0x2e')](_0x2f69d5['query'][_0x979d('0x2e')]));_0x533eef[_0x979d('0x2f')]=_0x533eef['attributes'][_0x979d('0x41')]?_0x533eef[_0x979d('0x2f')]:_0x425b2f['model'];if(_0x2f69d5['query']['includeAll']){_0x533eef[_0x979d('0x3b')]=[{'all':!![]}];}_0x533eef=_[_0x979d('0x35')]({},_0x533eef,_0x2f69d5[_0x979d('0x38')]);return db[_0x979d('0x39')][_0x979d('0x42')](_0x533eef)[_0x979d('0x22')](handleEntityNotFound(_0x4a18d9,null))[_0x979d('0x22')](respondWithResult(_0x4a18d9,null))[_0x979d('0x3d')](handleError(_0x4a18d9,null));};exports[_0x979d('0x43')]=function(_0x2c4968,_0x17ff41){return db[_0x979d('0x39')][_0x979d('0x43')](_0x2c4968[_0x979d('0x44')],{})[_0x979d('0x22')](respondWithResult(_0x17ff41,0xc9))['catch'](handleError(_0x17ff41,null));};exports[_0x979d('0x21')]=function(_0x5e4cc9,_0x1dce6f){if(_0x5e4cc9[_0x979d('0x44')]['id']){delete _0x5e4cc9[_0x979d('0x44')]['id'];}return db[_0x979d('0x39')]['find']({'where':{'id':_0x5e4cc9['params']['id']}})[_0x979d('0x22')](handleEntityNotFound(_0x1dce6f,null))[_0x979d('0x22')](saveUpdates(_0x5e4cc9['body'],null))[_0x979d('0x22')](respondWithResult(_0x1dce6f,null))[_0x979d('0x3d')](handleError(_0x1dce6f,null));};exports['destroy']=function(_0xd9daaf,_0x2bfc5f){return db[_0x979d('0x39')][_0x979d('0x42')]({'where':{'id':_0xd9daaf['params']['id']}})[_0x979d('0x22')](handleEntityNotFound(_0x2bfc5f,null))[_0x979d('0x22')](removeEntity(_0x2bfc5f,null))[_0x979d('0x3d')](handleError(_0x2bfc5f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 24326a3..2bb5b95 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac22=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x35c57e,_0x524466){var _0x2efe10=function(_0x50d98f){while(--_0x50d98f){_0x35c57e['push'](_0x35c57e['shift']());}};_0x2efe10(++_0x524466);}(_0xac22,0x194));var _0x2ac2=function(_0x207309,_0x207a45){_0x207309=_0x207309-0x0;var _0xe87cf5=_0xac22[_0x207309];return _0xe87cf5;};'use strict';var _=require(_0x2ac2('0x0'));var util=require(_0x2ac2('0x1'));var logger=require('../../config/logger')(_0x2ac2('0x2'));var moment=require('moment');var BPromise=require(_0x2ac2('0x3'));var rp=require(_0x2ac2('0x4'));var fs=require('fs');var path=require(_0x2ac2('0x5'));var rimraf=require(_0x2ac2('0x6'));var config=require(_0x2ac2('0x7'));var attributes=require(_0x2ac2('0x8'));module[_0x2ac2('0x9')]=function(_0x594544,_0x3b4434){return _0x594544[_0x2ac2('0xa')]('VtigerField',attributes,{'tableName':_0x2ac2('0xb'),'paranoid':![],'indexes':[{'name':_0x2ac2('0xc'),'fields':[_0x2ac2('0xd'),_0x2ac2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6763=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','FieldId','lodash','../../config/logger','api','bluebird','path'];(function(_0x17def6,_0x3e9bd0){var _0x3d44e7=function(_0x151c27){while(--_0x151c27){_0x17def6['push'](_0x17def6['shift']());}};_0x3d44e7(++_0x3e9bd0);}(_0x6763,0xb1));var _0x3676=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x6763[_0x14a862];return _0x245eb5;};'use strict';var _=require(_0x3676('0x0'));var util=require('util');var logger=require(_0x3676('0x1'))(_0x3676('0x2'));var moment=require('moment');var BPromise=require(_0x3676('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3676('0x4'));var rimraf=require(_0x3676('0x5'));var config=require(_0x3676('0x6'));var attributes=require(_0x3676('0x7'));module[_0x3676('0x8')]=function(_0x7a4ec2,_0x2ee3b7){return _0x7a4ec2[_0x3676('0x9')](_0x3676('0xa'),attributes,{'tableName':_0x3676('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x3676('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 2c545b1..9eda6cd 100644 --- a/server/api/intVtigerField/intVtigerField.rpc.js +++ b/server/api/intVtigerField/intVtigerField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ce2=['../../config/utils','rpc','../../config/environment','client','http','request','then','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x21a060,_0x24b03a){var _0x284523=function(_0x49057c){while(--_0x49057c){_0x21a060['push'](_0x21a060['shift']());}};_0x284523(++_0x24b03a);}(_0x3ce2,0x192));var _0x23ce=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x3ce2[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x23ce('0x0'));var util=require(_0x23ce('0x1'));var moment=require('moment');var BPromise=require(_0x23ce('0x2'));var rs=require(_0x23ce('0x3'));var fs=require('fs');var Redis=require(_0x23ce('0x4'));var db=require(_0x23ce('0x5'))['db'];var utils=require(_0x23ce('0x6'));var logger=require('../../config/logger')(_0x23ce('0x7'));var config=require(_0x23ce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23ce('0x9')][_0x23ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cc37c,_0x310467,_0x21a757){return new BPromise(function(_0x443d5f,_0x5f03c6){return client[_0x23ce('0xb')](_0x3cc37c,_0x21a757)[_0x23ce('0xc')](function(_0x5cf7a9){logger['info']('VtigerField,\x20%s,\x20%s',_0x310467,'request\x20sent');logger[_0x23ce('0xd')](_0x23ce('0xe'),_0x310467,_0x23ce('0xf'),JSON[_0x23ce('0x10')](_0x5cf7a9));if(_0x5cf7a9[_0x23ce('0x11')]){if(_0x5cf7a9[_0x23ce('0x11')][_0x23ce('0x12')]===0x1f4){logger['error'](_0x23ce('0x13'),_0x310467,_0x5cf7a9[_0x23ce('0x11')][_0x23ce('0x14')]);return _0x5f03c6(_0x5cf7a9['error'][_0x23ce('0x14')]);}logger['error'](_0x23ce('0x13'),_0x310467,_0x5cf7a9['error']['message']);return _0x443d5f(_0x5cf7a9[_0x23ce('0x11')][_0x23ce('0x14')]);}else{logger[_0x23ce('0x15')](_0x23ce('0x13'),_0x310467,_0x23ce('0xf'));_0x443d5f(_0x5cf7a9[_0x23ce('0x16')][_0x23ce('0x14')]);}})[_0x23ce('0x17')](function(_0x25f787){logger[_0x23ce('0x11')](_0x23ce('0x13'),_0x310467,_0x25f787);_0x5f03c6(_0x25f787);});});} \ No newline at end of file +var _0xa2e5=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x33d0ed,_0x37b069){var _0x2933e3=function(_0x1779a9){while(--_0x1779a9){_0x33d0ed['push'](_0x33d0ed['shift']());}};_0x2933e3(++_0x37b069);}(_0xa2e5,0x10a));var _0x5a2e=function(_0x771d16,_0x54e1d7){_0x771d16=_0x771d16-0x0;var _0x4a0aea=_0xa2e5[_0x771d16];return _0x4a0aea;};'use strict';var _=require(_0x5a2e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5a2e('0x1'));var rs=require(_0x5a2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a2e('0x3'))['db'];var utils=require(_0x5a2e('0x4'));var logger=require(_0x5a2e('0x5'))(_0x5a2e('0x6'));var config=require('../../config/environment');var jayson=require(_0x5a2e('0x7'));var client=jayson[_0x5a2e('0x8')][_0x5a2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1119f8,_0x55d07c,_0x93707c){return new BPromise(function(_0x3553d6,_0x105fb7){return client['request'](_0x1119f8,_0x93707c)['then'](function(_0x10f714){logger[_0x5a2e('0xa')](_0x5a2e('0xb'),_0x55d07c,_0x5a2e('0xc'));logger[_0x5a2e('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x55d07c,_0x5a2e('0xc'),JSON[_0x5a2e('0xe')](_0x10f714));if(_0x10f714[_0x5a2e('0xf')]){if(_0x10f714[_0x5a2e('0xf')][_0x5a2e('0x10')]===0x1f4){logger[_0x5a2e('0xf')]('VtigerField,\x20%s,\x20%s',_0x55d07c,_0x10f714[_0x5a2e('0xf')][_0x5a2e('0x11')]);return _0x105fb7(_0x10f714[_0x5a2e('0xf')][_0x5a2e('0x11')]);}logger['error'](_0x5a2e('0xb'),_0x55d07c,_0x10f714[_0x5a2e('0xf')]['message']);return _0x3553d6(_0x10f714[_0x5a2e('0xf')][_0x5a2e('0x11')]);}else{logger[_0x5a2e('0xa')](_0x5a2e('0xb'),_0x55d07c,_0x5a2e('0xc'));_0x3553d6(_0x10f714[_0x5a2e('0x12')]['message']);}})['catch'](function(_0x3f4b15){logger[_0x5a2e('0xf')](_0x5a2e('0xb'),_0x55d07c,_0x3f4b15);_0x105fb7(_0x3f4b15);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 70dfd8f..8b307d6 100644 --- a/server/api/intZendeskAccount/index.js +++ b/server/api/intZendeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa03d=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations'];(function(_0x1bacac,_0x39d59d){var _0x5793ab=function(_0x36eca1){while(--_0x36eca1){_0x1bacac['push'](_0x1bacac['shift']());}};_0x5793ab(++_0x39d59d);}(_0xa03d,0x14e));var _0xda03=function(_0xc82ee2,_0x5e9b96){_0xc82ee2=_0xc82ee2-0x0;var _0x294bb8=_0xa03d[_0xc82ee2];return _0x294bb8;};'use strict';var multer=require(_0xda03('0x0'));var util=require(_0xda03('0x1'));var path=require(_0xda03('0x2'));var timeout=require('connect-timeout');var express=require(_0xda03('0x3'));var router=express[_0xda03('0x4')]();var fs_extra=require(_0xda03('0x5'));var auth=require(_0xda03('0x6'));var interaction=require(_0xda03('0x7'));var config=require(_0xda03('0x8'));var controller=require(_0xda03('0x9'));router[_0xda03('0xa')]('/',auth[_0xda03('0xb')](),controller[_0xda03('0xc')]);router[_0xda03('0xa')](_0xda03('0xd'),auth[_0xda03('0xb')](),controller[_0xda03('0xe')]);router['get']('/:id/configurations',auth[_0xda03('0xb')](),controller[_0xda03('0xf')]);router[_0xda03('0xa')](_0xda03('0x10'),auth[_0xda03('0xb')](),controller[_0xda03('0x11')]);router[_0xda03('0x12')]('/',auth[_0xda03('0xb')](),controller[_0xda03('0x13')]);router['post'](_0xda03('0x14'),auth[_0xda03('0xb')](),controller[_0xda03('0x15')]);router[_0xda03('0x16')](_0xda03('0xd'),auth['isAuthenticated'](),controller[_0xda03('0x17')]);router[_0xda03('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4ed4=['../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x46edb7,_0x1e53b0){var _0xc4ce02=function(_0x80e959){while(--_0x80e959){_0x46edb7['push'](_0x46edb7['shift']());}};_0xc4ce02(++_0x1e53b0);}(_0x4ed4,0x80));var _0x44ed=function(_0x132c8a,_0x40e69e){_0x132c8a=_0x132c8a-0x0;var _0x19e165=_0x4ed4[_0x132c8a];return _0x19e165;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x44ed('0x0'));var timeout=require(_0x44ed('0x1'));var express=require(_0x44ed('0x2'));var router=express['Router']();var fs_extra=require(_0x44ed('0x3'));var auth=require(_0x44ed('0x4'));var interaction=require(_0x44ed('0x5'));var config=require('../../config/environment');var controller=require(_0x44ed('0x6'));router[_0x44ed('0x7')]('/',auth[_0x44ed('0x8')](),controller[_0x44ed('0x9')]);router[_0x44ed('0x7')](_0x44ed('0xa'),auth[_0x44ed('0x8')](),controller[_0x44ed('0xb')]);router[_0x44ed('0x7')](_0x44ed('0xc'),auth[_0x44ed('0x8')](),controller[_0x44ed('0xd')]);router[_0x44ed('0x7')](_0x44ed('0xe'),auth[_0x44ed('0x8')](),controller[_0x44ed('0xf')]);router['post']('/',auth[_0x44ed('0x8')](),controller[_0x44ed('0x10')]);router[_0x44ed('0x11')](_0x44ed('0xc'),auth[_0x44ed('0x8')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x44ed('0x12')]);router[_0x44ed('0x13')](_0x44ed('0xa'),auth[_0x44ed('0x8')](),controller[_0x44ed('0x14')]);module[_0x44ed('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index abdb191..81f383c 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.attributes.js +++ b/server/api/intZendeskAccount/intZendeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3e8=['exports','STRING','username','token','password','integrationTab','newTab','sequelize'];(function(_0x22899b,_0x29900f){var _0x6506bc=function(_0x120071){while(--_0x120071){_0x22899b['push'](_0x22899b['shift']());}};_0x6506bc(++_0x29900f);}(_0xa3e8,0x127));var _0x8a3e=function(_0xb74806,_0x4ec2a0){_0xb74806=_0xb74806-0x0;var _0x418e52=_0xa3e8[_0xb74806];return _0x418e52;};'use strict';var Sequelize=require(_0x8a3e('0x0'));module[_0x8a3e('0x1')]={'name':{'type':Sequelize[_0x8a3e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8a3e('0x2')],'unique':_0x8a3e('0x3')},'password':{'type':Sequelize[_0x8a3e('0x2')]},'token':{'type':Sequelize[_0x8a3e('0x2')]},'remoteUri':{'type':Sequelize[_0x8a3e('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password',_0x8a3e('0x4')),'defaultValue':_0x8a3e('0x5')},'serverUrl':{'type':Sequelize[_0x8a3e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8a3e('0x6'),_0x8a3e('0x7')),'defaultValue':_0x8a3e('0x6')}}; \ No newline at end of file +var _0xf8af=['password','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0xd583d,_0x24e8f1){var _0x409e5a=function(_0xa08a3f){while(--_0xa08a3f){_0xd583d['push'](_0xd583d['shift']());}};_0x409e5a(++_0x24e8f1);}(_0xf8af,0x8b));var _0xff8a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf8af[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xff8a('0x0'));module['exports']={'name':{'type':Sequelize[_0xff8a('0x1')]},'description':{'type':Sequelize[_0xff8a('0x1')]},'username':{'type':Sequelize[_0xff8a('0x1')],'unique':_0xff8a('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xff8a('0x1')]},'remoteUri':{'type':Sequelize[_0xff8a('0x1')],'unique':_0xff8a('0x3')},'authType':{'type':Sequelize[_0xff8a('0x4')]('password','token'),'defaultValue':_0xff8a('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xff8a('0x4')](_0xff8a('0x6'),_0xff8a('0x7')),'defaultValue':_0xff8a('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 0b1edde..6660e3e 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd87e=['undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x465aa9,_0x1bf1c8){var _0x4104e4=function(_0x388bb8){while(--_0x388bb8){_0x465aa9['push'](_0x465aa9['shift']());}};_0x4104e4(++_0x1bf1c8);}(_0xd87e,0x1bf));var _0xed87=function(_0x20eb01,_0x59ae21){_0x20eb01=_0x20eb01-0x0;var _0x5c5e37=_0xd87e[_0x20eb01];return _0x5c5e37;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['ZendeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['ZendeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57'),_0xed87('0x58'),_0xed87('0x59'),'remoteUri']})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x3b6a9b){if(_0x3b6a9b){_0x5136c9=_0x3b6a9b[_0xed87('0x5a')];var _0xc35cab=_0x5136c9[_0xed87('0x5b')](-0x1);if(_0xc35cab==='/'){_0x5136c9=_0x5136c9[_0xed87('0x5c')](0x0,_0x5136c9[_0xed87('0x5d')](_0xc35cab));}var _0x116198={'method':_0xed87('0x5e'),'uri':util['format']('%s/%s',_0x5136c9,'ticket_fields'),'json':!![]};switch(_0x3b6a9b[_0xed87('0x59')]){case _0xed87('0x57'):_0x116198[_0xed87('0x5f')]={'Authorization':util[_0xed87('0x60')](_0xed87('0x61'),new Buffer(util['format'](_0xed87('0x62'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x57')]))[_0xed87('0x63')](_0xed87('0x64')))};break;case _0xed87('0x58'):_0x116198['headers']={'Authorization':util['format'](_0xed87('0x61'),new Buffer(util[_0xed87('0x60')](_0xed87('0x65'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x58')]))[_0xed87('0x63')](_0xed87('0x64')))};break;default:throw new db[(_0xed87('0x66'))][(_0xed87('0x67'))](_0xed87('0x68'));}return rp(_0x116198);}})[_0xed87('0x3f')](function(_0x1a1f95){if(_0x1a1f95){var _0x52af5c=[_0xed87('0x69'),_0xed87('0x6a'),_0xed87('0x6b'),_0xed87('0x6c')];_[_0xed87('0x6d')](_0x1a1f95[_0xed87('0x6e')],function(_0x4ae84c){return _0x52af5c[_0xed87('0x6f')](_0x4ae84c[_0xed87('0x2b')]);});return{'count':_0x1a1f95[_0xed87('0x6e')][_0xed87('0x35')],'rows':_['map'](_0x1a1f95['ticket_fields'],function(_0x4bfca0){return{'id':_0x4bfca0['id'],'name':_0x4bfca0['position']>0x7?_0x4bfca0['title']:_0x4bfca0[_0xed87('0x2b')],'custom':_0x4bfca0[_0xed87('0x70')]>0x7?!![]:![],'options':_0x4bfca0[_0xed87('0x71')]?_0x4bfca0[_0xed87('0x71')]:_0x4bfca0[_0xed87('0x72')]?_0x4bfca0[_0xed87('0x72')]:[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))[_0xed87('0x41')](function(_0x1b223b){var _0x510066=_0x2686cd['query'][_0xed87('0x73')]?0x1f4:_0x1b223b[_0xed87('0x74')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x75'),_0xed87('0x55'),_0x510066,JSON['stringify'](_0x1b223b));delete _0x1b223b['name'];if(_0x510066===0x191){_0x510066=0x190;}_0x566ace[_0xed87('0x19')](_0x510066)[_0xed87('0x76')](_0x2686cd['query'][_0xed87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1b223b[_0xed87('0x74')]}:_0x1b223b);});}; \ No newline at end of file +var _0xeb74=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','filter','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xeb74,0xe3));var _0x4eb7=function(_0x5e8914,_0x4ffe20){_0x5e8914=_0x5e8914-0x0;var _0x8a21c=_0xeb74[_0x5e8914];return _0x8a21c;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];var integrations=require(_0x4eb7('0x19'));function respondWithStatusCode(_0x4194e1,_0x3c9f45){_0x3c9f45=_0x3c9f45||0xcc;return function(_0x4c27a4){if(_0x4c27a4){return _0x4194e1['sendStatus'](_0x3c9f45);}return _0x4194e1['status'](_0x3c9f45)[_0x4eb7('0x1a')]();};}function respondWithResult(_0x51f09d,_0x84c68b){_0x84c68b=_0x84c68b||0xc8;return function(_0x119afa){if(_0x119afa){return _0x51f09d[_0x4eb7('0x1b')](_0x84c68b)[_0x4eb7('0x1c')](_0x119afa);}};}function respondWithFilteredResult(_0x5d6d5,_0x21433d){return function(_0x11674f){if(_0x11674f){var _0x76988=typeof _0x21433d[_0x4eb7('0x1d')]===_0x4eb7('0x1e')&&typeof _0x21433d['limit']===_0x4eb7('0x1e');var _0x11ac9f=_0x11674f[_0x4eb7('0x1f')];var _0xf14478=_0x76988?0x0:_0x21433d[_0x4eb7('0x1d')];var _0x44f1b9=_0x76988?_0x11674f[_0x4eb7('0x1f')]:_0x21433d[_0x4eb7('0x1d')]+_0x21433d['limit'];var _0x3cf53a;if(_0x44f1b9>=_0x11ac9f){_0x44f1b9=_0x11ac9f;_0x3cf53a=0xc8;}else{_0x3cf53a=0xce;}_0x5d6d5[_0x4eb7('0x1b')](_0x3cf53a);return _0x5d6d5[_0x4eb7('0x20')](_0x4eb7('0x21'),_0xf14478+'-'+_0x44f1b9+'/'+_0x11ac9f)[_0x4eb7('0x1c')](_0x11674f);}return null;};}function patchUpdates(_0x2efd67){return function(_0x11fb0a){try{jsonpatch['apply'](_0x11fb0a,_0x2efd67,!![]);}catch(_0x214a28){return BPromise[_0x4eb7('0x22')](_0x214a28);}return _0x11fb0a[_0x4eb7('0x23')]();};}function saveUpdates(_0x164515,_0x14a7be){return function(_0x1b4640){if(_0x1b4640){return _0x1b4640[_0x4eb7('0x24')](_0x164515)[_0x4eb7('0x25')](function(_0x1a2b8b){return _0x1a2b8b;});}return null;};}function removeEntity(_0x13e871,_0x4de2d9){return function(_0x3e72cd){if(_0x3e72cd){return _0x3e72cd[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x13e871[_0x4eb7('0x1b')](0xcc)[_0x4eb7('0x1a')]();});}};}function handleEntityNotFound(_0x25eb74,_0x365060){return function(_0xe9db8){if(!_0xe9db8){_0x25eb74[_0x4eb7('0x27')](0x194);}return _0xe9db8;};}function handleError(_0x248759,_0xf83c11){_0xf83c11=_0xf83c11||0x1f4;return function(_0x2984b2){logger[_0x4eb7('0x28')](_0x2984b2[_0x4eb7('0x29')]);if(_0x2984b2[_0x4eb7('0x2a')]){delete _0x2984b2[_0x4eb7('0x2a')];}_0x248759[_0x4eb7('0x1b')](_0xf83c11)[_0x4eb7('0x2b')](_0x2984b2);};}exports[_0x4eb7('0x2c')]=function(_0x28fda8,_0x114c68){var _0x17030a={},_0x3ed224={},_0x50209d={'count':0x0,'rows':[]};var _0x34515c=_['map'](db[_0x4eb7('0x2d')][_0x4eb7('0x2e')],function(_0xc5aa21){return{'name':_0xc5aa21[_0x4eb7('0x2f')],'type':_0xc5aa21[_0x4eb7('0x30')][_0x4eb7('0x31')]};});_0x3ed224[_0x4eb7('0x32')]=_[_0x4eb7('0x33')](_0x34515c,_0x4eb7('0x2a'));_0x3ed224['query']=_[_0x4eb7('0x34')](_0x28fda8['query']);_0x3ed224[_0x4eb7('0x35')]=_[_0x4eb7('0x36')](_0x3ed224['model'],_0x3ed224['query']);_0x17030a[_0x4eb7('0x37')]=_[_0x4eb7('0x36')](_0x3ed224[_0x4eb7('0x32')],qs[_0x4eb7('0x38')](_0x28fda8['query'][_0x4eb7('0x38')]));_0x17030a[_0x4eb7('0x37')]=_0x17030a[_0x4eb7('0x37')][_0x4eb7('0x39')]?_0x17030a[_0x4eb7('0x37')]:_0x3ed224['model'];if(!_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x3b')](_0x4eb7('0x3c'))){_0x17030a['limit']=qs[_0x4eb7('0x3d')](_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x3d')]);_0x17030a['offset']=qs[_0x4eb7('0x1d')](_0x28fda8['query'][_0x4eb7('0x1d')]);}_0x17030a[_0x4eb7('0x3e')]=qs[_0x4eb7('0x3f')](_0x28fda8[_0x4eb7('0x3a')]['sort']);_0x17030a[_0x4eb7('0x40')]=qs[_0x4eb7('0x35')](_[_0x4eb7('0x41')](_0x28fda8[_0x4eb7('0x3a')],_0x3ed224['filters']),_0x34515c);if(_0x28fda8['query']['filter']){_0x17030a[_0x4eb7('0x40')]=_[_0x4eb7('0x42')](_0x17030a[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x33')](_0x34515c,function(_0x210c20){if(_0x210c20[_0x4eb7('0x30')]!==_0x4eb7('0x43')){var _0x20d2bc={};_0x20d2bc[_0x210c20[_0x4eb7('0x2a')]]={'$like':'%'+_0x28fda8[_0x4eb7('0x3a')]['filter']+'%'};return _0x20d2bc;}})});}_0x17030a=_[_0x4eb7('0x42')]({},_0x17030a,_0x28fda8[_0x4eb7('0x44')]);var _0xe04d76={'where':_0x17030a[_0x4eb7('0x40')]};return db[_0x4eb7('0x2d')][_0x4eb7('0x1f')](_0xe04d76)[_0x4eb7('0x25')](function(_0xef998f){_0x50209d[_0x4eb7('0x1f')]=_0xef998f;if(_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x45')]){_0x17030a[_0x4eb7('0x46')]=[{'all':!![]}];}return db[_0x4eb7('0x2d')][_0x4eb7('0x47')](_0x17030a);})[_0x4eb7('0x25')](function(_0x5b819f){_0x50209d[_0x4eb7('0x48')]=_0x5b819f;return _0x50209d;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x114c68,_0x17030a))[_0x4eb7('0x49')](handleError(_0x114c68,null));};exports[_0x4eb7('0x4a')]=function(_0x5eff9e,_0x2fd5c2){var _0x2df542={'raw':![],'where':{'id':_0x5eff9e[_0x4eb7('0x4b')]['id']}},_0x482357={};_0x482357[_0x4eb7('0x32')]=_[_0x4eb7('0x34')](db[_0x4eb7('0x2d')][_0x4eb7('0x2e')]);_0x482357[_0x4eb7('0x3a')]=_['keys'](_0x5eff9e[_0x4eb7('0x3a')]);_0x482357['filters']=_[_0x4eb7('0x36')](_0x482357[_0x4eb7('0x32')],_0x482357[_0x4eb7('0x3a')]);_0x2df542['attributes']=_[_0x4eb7('0x36')](_0x482357[_0x4eb7('0x32')],qs[_0x4eb7('0x38')](_0x5eff9e[_0x4eb7('0x3a')]['fields']));_0x2df542[_0x4eb7('0x37')]=_0x2df542['attributes'][_0x4eb7('0x39')]?_0x2df542[_0x4eb7('0x37')]:_0x482357[_0x4eb7('0x32')];if(_0x5eff9e[_0x4eb7('0x3a')][_0x4eb7('0x45')]){_0x2df542['include']=[{'all':!![]}];}_0x2df542=_['merge']({},_0x2df542,_0x5eff9e[_0x4eb7('0x44')]);return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')](_0x2df542)[_0x4eb7('0x25')](handleEntityNotFound(_0x2fd5c2,null))[_0x4eb7('0x25')](respondWithResult(_0x2fd5c2,null))['catch'](handleError(_0x2fd5c2,null));};exports[_0x4eb7('0x4d')]=function(_0x104284,_0x56609e){return db[_0x4eb7('0x2d')][_0x4eb7('0x4d')](_0x104284['body'],{})[_0x4eb7('0x25')](respondWithResult(_0x56609e,0xc9))[_0x4eb7('0x49')](handleError(_0x56609e,null));};exports[_0x4eb7('0x24')]=function(_0x5774d5,_0x130113){if(_0x5774d5['body']['id']){delete _0x5774d5['body']['id'];}return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')]({'where':{'id':_0x5774d5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x130113,null))[_0x4eb7('0x25')](saveUpdates(_0x5774d5[_0x4eb7('0x4e')],null))[_0x4eb7('0x25')](respondWithResult(_0x130113,null))[_0x4eb7('0x49')](handleError(_0x130113,null));};exports[_0x4eb7('0x26')]=function(_0x23c0d5,_0x42a1d9){return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')]({'where':{'id':_0x23c0d5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x42a1d9,null))[_0x4eb7('0x25')](removeEntity(_0x42a1d9,null))[_0x4eb7('0x49')](handleError(_0x42a1d9,null));};exports[_0x4eb7('0x4f')]=function(_0x1411c9,_0x11cc3d,_0x4cfba8){var _0x3f3d41={};var _0x550888={};var _0x4db5f7;var _0x3f3a5f;return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x1411c9[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x11cc3d,null))['then'](function(_0x4e3163){if(_0x4e3163){_0x4db5f7=_0x4e3163;_0x550888[_0x4eb7('0x32')]=_['keys'](db[_0x4eb7('0x51')][_0x4eb7('0x2e')]);_0x550888[_0x4eb7('0x3a')]=_[_0x4eb7('0x34')](_0x1411c9['query']);_0x550888[_0x4eb7('0x35')]=_[_0x4eb7('0x36')](_0x550888[_0x4eb7('0x32')],_0x550888[_0x4eb7('0x3a')]);_0x3f3d41['attributes']=_[_0x4eb7('0x36')](_0x550888[_0x4eb7('0x32')],qs['fields'](_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x38')]));_0x3f3d41['attributes']=_0x3f3d41[_0x4eb7('0x37')]['length']?_0x3f3d41[_0x4eb7('0x37')]:_0x550888['model'];_0x3f3d41[_0x4eb7('0x3e')]=qs[_0x4eb7('0x3f')](_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x3f')]);_0x3f3d41[_0x4eb7('0x40')]=qs[_0x4eb7('0x35')](_['pick'](_0x1411c9['query'],_0x550888[_0x4eb7('0x35')]));if(_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x52')]){_0x3f3d41[_0x4eb7('0x40')]=_['merge'](_0x3f3d41[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x33')](_0x3f3d41['attributes'],function(_0x452f21){var _0xba9272={};_0xba9272[_0x452f21]={'$like':'%'+_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x52')]+'%'};return _0xba9272;})});}_0x3f3d41=_[_0x4eb7('0x42')]({},_0x3f3d41,_0x1411c9[_0x4eb7('0x44')]);return _0x4db5f7[_0x4eb7('0x4f')](_0x3f3d41);}})['then'](function(_0x5839f1){if(_0x5839f1){_0x3f3a5f=_0x5839f1[_0x4eb7('0x39')];if(!_0x1411c9['query'][_0x4eb7('0x3b')]('nolimit')){_0x3f3d41[_0x4eb7('0x3d')]=qs['limit'](_0x1411c9['query'][_0x4eb7('0x3d')]);_0x3f3d41[_0x4eb7('0x1d')]=qs['offset'](_0x1411c9[_0x4eb7('0x3a')]['offset']);}return _0x4db5f7[_0x4eb7('0x4f')](_0x3f3d41);}})[_0x4eb7('0x25')](function(_0x4ab8e8){if(_0x4ab8e8){return _0x4ab8e8?{'count':_0x3f3a5f,'rows':_0x4ab8e8}:null;}})[_0x4eb7('0x25')](respondWithResult(_0x11cc3d,null))[_0x4eb7('0x49')](handleError(_0x11cc3d,null));};exports['addConfiguration']=function(_0x4b492a,_0x5c8d45,_0x59e2f2){if(_0x4b492a[_0x4eb7('0x4e')]['id']){delete _0x4b492a['body']['id'];}return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x4b492a['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x5c8d45,null))[_0x4eb7('0x25')](function(_0x463ab6){if(_0x463ab6){_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x53')]=_0x463ab6['id'];_0x4b492a[_0x4eb7('0x4e')]['Subjects']=integrations['getSubjects'](_0x4b492a['body'][_0x4eb7('0x54')],_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x30')]);_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x55')]=integrations['getDescriptions'](_0x4b492a['body'][_0x4eb7('0x54')],_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x30')]);return db[_0x4eb7('0x51')][_0x4eb7('0x4d')](_0x4b492a['body'],{'include':[{'model':db[_0x4eb7('0x56')],'as':_0x4eb7('0x57')},{'model':db[_0x4eb7('0x56')],'as':_0x4eb7('0x55')}]});}return null;})['then'](respondWithResult(_0x5c8d45,null))['catch'](handleError(_0x5c8d45,null));};exports[_0x4eb7('0x58')]=function(_0x3883f3,_0x4e8125,_0x1911ad){var _0x4b698b='';return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x3883f3[_0x4eb7('0x4b')]['id']},'attributes':['id',_0x4eb7('0x59'),'password',_0x4eb7('0x5a'),_0x4eb7('0x5b'),_0x4eb7('0x5c')]})[_0x4eb7('0x25')](handleEntityNotFound(_0x4e8125,null))[_0x4eb7('0x25')](function(_0x3271d0){if(_0x3271d0){_0x4b698b=_0x3271d0[_0x4eb7('0x5c')];var _0x232242=_0x4b698b[_0x4eb7('0x5d')](-0x1);if(_0x232242==='/'){_0x4b698b=_0x4b698b[_0x4eb7('0x5e')](0x0,_0x4b698b[_0x4eb7('0x5f')](_0x232242));}var _0x713b0a={'method':_0x4eb7('0x60'),'uri':util[_0x4eb7('0x61')](_0x4eb7('0x62'),_0x4b698b,_0x4eb7('0x63')),'json':!![]};switch(_0x3271d0[_0x4eb7('0x5b')]){case _0x4eb7('0x64'):_0x713b0a[_0x4eb7('0x65')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x4eb7('0x61')](_0x4eb7('0x66'),_0x3271d0[_0x4eb7('0x59')],_0x3271d0[_0x4eb7('0x64')]))[_0x4eb7('0x67')](_0x4eb7('0x68')))};break;case _0x4eb7('0x5a'):_0x713b0a[_0x4eb7('0x65')]={'Authorization':util['format'](_0x4eb7('0x69'),new Buffer(util[_0x4eb7('0x61')](_0x4eb7('0x6a'),_0x3271d0['username'],_0x3271d0['token']))[_0x4eb7('0x67')](_0x4eb7('0x68')))};break;default:throw new db[(_0x4eb7('0x6b'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x713b0a);}})[_0x4eb7('0x25')](function(_0x1a1525){if(_0x1a1525){var _0x4778f9=[_0x4eb7('0x6c'),_0x4eb7('0x6d'),_0x4eb7('0x6e'),_0x4eb7('0x6f')];_[_0x4eb7('0x70')](_0x1a1525[_0x4eb7('0x63')],function(_0x2e531e){return _0x4778f9[_0x4eb7('0x71')](_0x2e531e[_0x4eb7('0x30')]);});return{'count':_0x1a1525['ticket_fields']['length'],'rows':_[_0x4eb7('0x33')](_0x1a1525[_0x4eb7('0x63')],function(_0x14648d){return{'id':_0x14648d['id'],'name':_0x14648d[_0x4eb7('0x72')]>0x7?_0x14648d[_0x4eb7('0x73')]:_0x14648d[_0x4eb7('0x30')],'custom':_0x14648d['position']>0x7?!![]:![],'options':_0x14648d['system_field_options']?_0x14648d[_0x4eb7('0x74')]:_0x14648d[_0x4eb7('0x75')]?_0x14648d[_0x4eb7('0x75')]:[]};})};}})[_0x4eb7('0x25')](respondWithResult(_0x4e8125,null))[_0x4eb7('0x49')](function(_0x2480ed){var _0x13f574=_0x3883f3[_0x4eb7('0x3a')][_0x4eb7('0x76')]?0x1f4:_0x2480ed[_0x4eb7('0x77')]||0x1f4;logger[_0x4eb7('0x28')](_0x4eb7('0x78'),_0x4eb7('0x58'),_0x13f574,JSON[_0x4eb7('0x79')](_0x2480ed));delete _0x2480ed['name'];if(_0x13f574===0x191){_0x13f574=0x190;}_0x4e8125[_0x4eb7('0x1b')](_0x13f574)[_0x4eb7('0x2b')](_0x3883f3[_0x4eb7('0x3a')][_0x4eb7('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x2480ed[_0x4eb7('0x77')]}:_0x2480ed);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e5deaa7..35c92f7 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.model.js +++ b/server/api/intZendeskAccount/intZendeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf606=['ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x499248,_0x40ed5e){var _0x583d48=function(_0x260a45){while(--_0x260a45){_0x499248['push'](_0x499248['shift']());}};_0x583d48(++_0x40ed5e);}(_0xf606,0x64));var _0x6f60=function(_0x400e9c,_0x10d832){_0x400e9c=_0x400e9c-0x0;var _0x975218=_0xf606[_0x400e9c];return _0x975218;};'use strict';var _=require(_0x6f60('0x0'));var util=require('util');var logger=require(_0x6f60('0x1'))(_0x6f60('0x2'));var moment=require(_0x6f60('0x3'));var BPromise=require(_0x6f60('0x4'));var rp=require(_0x6f60('0x5'));var fs=require('fs');var path=require(_0x6f60('0x6'));var rimraf=require(_0x6f60('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f60('0x8'));var integrations=require(_0x6f60('0x9'));module[_0x6f60('0xa')]=function(_0x25b1d7,_0x4e5723){return _0x25b1d7[_0x6f60('0xb')](_0x6f60('0xc'),attributes,{'tableName':_0x6f60('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefef=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','int_zendesk_accounts','lodash'];(function(_0x11e762,_0x3f7103){var _0x24c967=function(_0x4a3cf0){while(--_0x4a3cf0){_0x11e762['push'](_0x11e762['shift']());}};_0x24c967(++_0x3f7103);}(_0xefef,0xc5));var _0xfefe=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xefef[_0x454165];return _0x56db53;};'use strict';var _=require(_0xfefe('0x0'));var util=require('util');var logger=require(_0xfefe('0x1'))(_0xfefe('0x2'));var moment=require(_0xfefe('0x3'));var BPromise=require('bluebird');var rp=require(_0xfefe('0x4'));var fs=require('fs');var path=require(_0xfefe('0x5'));var rimraf=require(_0xfefe('0x6'));var config=require(_0xfefe('0x7'));var attributes=require(_0xfefe('0x8'));var integrations=require(_0xfefe('0x9'));module['exports']=function(_0xbcc146,_0x3c3644){return _0xbcc146['define']('ZendeskAccount',attributes,{'tableName':_0xfefe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index eef8ca9..f9e21aa 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x079f=['rpc','../../config/environment','jayson/promise','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','info','ShowZendeskAccount','find','lodash','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x107906,_0x3cc9e8){var _0x25286a=function(_0xa48aac){while(--_0xa48aac){_0x107906['push'](_0x107906['shift']());}};_0x25286a(++_0x3cc9e8);}(_0x079f,0x13b));var _0xf079=function(_0x1c9517,_0x3da8f3){_0x1c9517=_0x1c9517-0x0;var _0x3b8377=_0x079f[_0x1c9517];return _0x3b8377;};'use strict';var _=require(_0xf079('0x0'));var util=require('util');var moment=require(_0xf079('0x1'));var BPromise=require(_0xf079('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf079('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf079('0x4'))(_0xf079('0x5'));var config=require(_0xf079('0x6'));var jayson=require(_0xf079('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5701da,_0x2b5e82,_0x5a5cc3){return new BPromise(function(_0x17ecf9,_0x2d9f75){return client['request'](_0x5701da,_0x5a5cc3)[_0xf079('0x8')](function(_0x1ae979){logger['info'](_0xf079('0x9'),_0x2b5e82,_0xf079('0xa'));logger[_0xf079('0xb')](_0xf079('0xc'),_0x2b5e82,'request\x20sent',JSON[_0xf079('0xd')](_0x1ae979));if(_0x1ae979[_0xf079('0xe')]){if(_0x1ae979[_0xf079('0xe')]['code']===0x1f4){logger['error'](_0xf079('0x9'),_0x2b5e82,_0x1ae979[_0xf079('0xe')][_0xf079('0xf')]);return _0x2d9f75(_0x1ae979[_0xf079('0xe')][_0xf079('0xf')]);}logger[_0xf079('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x2b5e82,_0x1ae979[_0xf079('0xe')][_0xf079('0xf')]);return _0x17ecf9(_0x1ae979[_0xf079('0xe')][_0xf079('0xf')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2b5e82,_0xf079('0xa'));_0x17ecf9(_0x1ae979[_0xf079('0x10')][_0xf079('0xf')]);}})[_0xf079('0x11')](function(_0x3d7014){logger[_0xf079('0xe')](_0xf079('0x9'),_0x2b5e82,_0x3d7014);_0x2d9f75(_0x3d7014);});});}exports[_0xf079('0x12')]=function(_0x4dd2ce){var _0x1fd7e6=this;return new Promise(function(_0xd43aa8,_0x3b7f82){return db[_0xf079('0x13')][_0xf079('0x14')]({'raw':_0x4dd2ce[_0xf079('0x15')]?_0x4dd2ce[_0xf079('0x15')][_0xf079('0x16')]===undefined?!![]:![]:!![],'where':_0x4dd2ce[_0xf079('0x15')]?_0x4dd2ce[_0xf079('0x15')][_0xf079('0x17')]||null:null,'attributes':_0x4dd2ce['options']?_0x4dd2ce[_0xf079('0x15')][_0xf079('0x18')]||null:null,'limit':_0x4dd2ce[_0xf079('0x15')]?_0x4dd2ce[_0xf079('0x15')][_0xf079('0x19')]||null:null,'include':_0x4dd2ce[_0xf079('0x15')]?_0x4dd2ce[_0xf079('0x15')][_0xf079('0x1a')]?_['map'](_0x4dd2ce['options']['include'],function(_0x590b5c){return{'model':db[_0x590b5c[_0xf079('0x1b')]],'as':_0x590b5c['as'],'attributes':_0x590b5c[_0xf079('0x18')],'include':_0x590b5c['include']?_[_0xf079('0x1c')](_0x590b5c['include'],function(_0x2b4dd4){return{'model':db[_0x2b4dd4[_0xf079('0x1b')]],'as':_0x2b4dd4['as'],'attributes':_0x2b4dd4[_0xf079('0x18')],'include':_0x2b4dd4[_0xf079('0x1a')]?_[_0xf079('0x1c')](_0x2b4dd4[_0xf079('0x1a')],function(_0x33362e){return{'model':db[_0x33362e[_0xf079('0x1b')]],'as':_0x33362e['as'],'attributes':_0x33362e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c3a74){logger[_0xf079('0x1d')]('GetZendeskAccount',_0x4dd2ce);logger[_0xf079('0xb')](_0xf079('0x12'),_0x4dd2ce,JSON[_0xf079('0xd')](_0x2c3a74));_0xd43aa8(_0x2c3a74);})[_0xf079('0x11')](function(_0x99cf11){logger['error'](_0xf079('0x12'),_0x99cf11[_0xf079('0xf')],_0x4dd2ce);_0x3b7f82(_0x1fd7e6['error'](0x1f4,_0x99cf11[_0xf079('0xf')]));});});};exports[_0xf079('0x1e')]=function(_0x43dfda){var _0x32c69f=this;return new Promise(function(_0x3c5436,_0x57b287){return db[_0xf079('0x13')][_0xf079('0x1f')]({'raw':_0x43dfda['options']?_0x43dfda[_0xf079('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x43dfda['options']?_0x43dfda[_0xf079('0x15')][_0xf079('0x17')]||null:null,'attributes':_0x43dfda[_0xf079('0x15')]?_0x43dfda[_0xf079('0x15')][_0xf079('0x18')]||null:null,'include':_0x43dfda[_0xf079('0x15')]?_0x43dfda[_0xf079('0x15')][_0xf079('0x1a')]?_['map'](_0x43dfda[_0xf079('0x15')][_0xf079('0x1a')],function(_0x69fde6){return{'model':db[_0x69fde6[_0xf079('0x1b')]],'as':_0x69fde6['as'],'attributes':_0x69fde6['attributes'],'include':_0x69fde6[_0xf079('0x1a')]?_[_0xf079('0x1c')](_0x69fde6[_0xf079('0x1a')],function(_0xa2582f){return{'model':db[_0xa2582f['model']],'as':_0xa2582f['as'],'attributes':_0xa2582f[_0xf079('0x18')],'include':_0xa2582f[_0xf079('0x1a')]?_[_0xf079('0x1c')](_0xa2582f[_0xf079('0x1a')],function(_0x1a72ff){return{'model':db[_0x1a72ff[_0xf079('0x1b')]],'as':_0x1a72ff['as'],'attributes':_0x1a72ff['attributes']};}):[]};}):[]};}):[]:[]})[_0xf079('0x8')](function(_0x232e06){logger[_0xf079('0x1d')](_0xf079('0x1e'),_0x43dfda);logger['debug']('ShowZendeskAccount',_0x43dfda,JSON[_0xf079('0xd')](_0x232e06));_0x3c5436(_0x232e06);})[_0xf079('0x11')](function(_0x4c9c46){logger[_0xf079('0xe')](_0xf079('0x1e'),_0x4c9c46[_0xf079('0xf')],_0x43dfda);_0x57b287(_0x32c69f['error'](0x1f4,_0x4c9c46['message']));});});}; \ No newline at end of file +var _0x1b23=['catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','model','map','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x10884d,_0x3ec677){var _0x2d288a=function(_0x3959d8){while(--_0x3959d8){_0x10884d['push'](_0x10884d['shift']());}};_0x2d288a(++_0x3ec677);}(_0x1b23,0x1e1));var _0x31b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1b23[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x31b2('0x0'));var util=require(_0x31b2('0x1'));var moment=require(_0x31b2('0x2'));var BPromise=require(_0x31b2('0x3'));var rs=require(_0x31b2('0x4'));var fs=require('fs');var Redis=require(_0x31b2('0x5'));var db=require(_0x31b2('0x6'))['db'];var utils=require(_0x31b2('0x7'));var logger=require('../../config/logger')(_0x31b2('0x8'));var config=require(_0x31b2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x31b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x329698,_0x166221,_0x53de08){return new BPromise(function(_0x88d4b0,_0xb989b4){return client[_0x31b2('0xb')](_0x329698,_0x53de08)[_0x31b2('0xc')](function(_0x1d4f12){logger[_0x31b2('0xd')](_0x31b2('0xe'),_0x166221,_0x31b2('0xf'));logger[_0x31b2('0x10')](_0x31b2('0x11'),_0x166221,_0x31b2('0xf'),JSON[_0x31b2('0x12')](_0x1d4f12));if(_0x1d4f12[_0x31b2('0x13')]){if(_0x1d4f12[_0x31b2('0x13')][_0x31b2('0x14')]===0x1f4){logger[_0x31b2('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x166221,_0x1d4f12[_0x31b2('0x13')]['message']);return _0xb989b4(_0x1d4f12['error'][_0x31b2('0x15')]);}logger['error'](_0x31b2('0xe'),_0x166221,_0x1d4f12[_0x31b2('0x13')][_0x31b2('0x15')]);return _0x88d4b0(_0x1d4f12[_0x31b2('0x13')][_0x31b2('0x15')]);}else{logger[_0x31b2('0xd')](_0x31b2('0xe'),_0x166221,_0x31b2('0xf'));_0x88d4b0(_0x1d4f12[_0x31b2('0x16')][_0x31b2('0x15')]);}})[_0x31b2('0x17')](function(_0x11883f){logger[_0x31b2('0x13')](_0x31b2('0xe'),_0x166221,_0x11883f);_0xb989b4(_0x11883f);});});}exports[_0x31b2('0x18')]=function(_0x47ed67){var _0x4c9713=this;return new Promise(function(_0x2bc6b9,_0x2d14f9){return db[_0x31b2('0x19')][_0x31b2('0x1a')]({'raw':_0x47ed67[_0x31b2('0x1b')]?_0x47ed67[_0x31b2('0x1b')][_0x31b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x47ed67[_0x31b2('0x1b')]?_0x47ed67['options']['where']||null:null,'attributes':_0x47ed67[_0x31b2('0x1b')]?_0x47ed67[_0x31b2('0x1b')][_0x31b2('0x1d')]||null:null,'limit':_0x47ed67['options']?_0x47ed67['options'][_0x31b2('0x1e')]||null:null,'include':_0x47ed67[_0x31b2('0x1b')]?_0x47ed67['options'][_0x31b2('0x1f')]?_['map'](_0x47ed67['options'][_0x31b2('0x1f')],function(_0x18d346){return{'model':db[_0x18d346[_0x31b2('0x20')]],'as':_0x18d346['as'],'attributes':_0x18d346[_0x31b2('0x1d')],'include':_0x18d346[_0x31b2('0x1f')]?_[_0x31b2('0x21')](_0x18d346[_0x31b2('0x1f')],function(_0x1197a9){return{'model':db[_0x1197a9[_0x31b2('0x20')]],'as':_0x1197a9['as'],'attributes':_0x1197a9[_0x31b2('0x1d')],'include':_0x1197a9['include']?_[_0x31b2('0x21')](_0x1197a9[_0x31b2('0x1f')],function(_0x574e3d){return{'model':db[_0x574e3d[_0x31b2('0x20')]],'as':_0x574e3d['as'],'attributes':_0x574e3d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a70fa){logger[_0x31b2('0xd')](_0x31b2('0x18'),_0x47ed67);logger['debug'](_0x31b2('0x18'),_0x47ed67,JSON[_0x31b2('0x12')](_0x5a70fa));_0x2bc6b9(_0x5a70fa);})[_0x31b2('0x17')](function(_0x4266b1){logger[_0x31b2('0x13')](_0x31b2('0x18'),_0x4266b1[_0x31b2('0x15')],_0x47ed67);_0x2d14f9(_0x4c9713[_0x31b2('0x13')](0x1f4,_0x4266b1[_0x31b2('0x15')]));});});};exports[_0x31b2('0x22')]=function(_0x128619){var _0x165fa3=this;return new Promise(function(_0x2809c4,_0x1dfca7){return db[_0x31b2('0x19')][_0x31b2('0x23')]({'raw':_0x128619['options']?_0x128619[_0x31b2('0x1b')][_0x31b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x128619[_0x31b2('0x1b')]?_0x128619[_0x31b2('0x1b')]['where']||null:null,'attributes':_0x128619[_0x31b2('0x1b')]?_0x128619['options']['attributes']||null:null,'include':_0x128619[_0x31b2('0x1b')]?_0x128619[_0x31b2('0x1b')]['include']?_[_0x31b2('0x21')](_0x128619[_0x31b2('0x1b')]['include'],function(_0x449b6b){return{'model':db[_0x449b6b[_0x31b2('0x20')]],'as':_0x449b6b['as'],'attributes':_0x449b6b['attributes'],'include':_0x449b6b['include']?_[_0x31b2('0x21')](_0x449b6b[_0x31b2('0x1f')],function(_0xbfa1fb){return{'model':db[_0xbfa1fb[_0x31b2('0x20')]],'as':_0xbfa1fb['as'],'attributes':_0xbfa1fb[_0x31b2('0x1d')],'include':_0xbfa1fb[_0x31b2('0x1f')]?_[_0x31b2('0x21')](_0xbfa1fb[_0x31b2('0x1f')],function(_0xda8c9a){return{'model':db[_0xda8c9a[_0x31b2('0x20')]],'as':_0xda8c9a['as'],'attributes':_0xda8c9a[_0x31b2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x31b2('0xc')](function(_0x1e17a1){logger['info'](_0x31b2('0x22'),_0x128619);logger[_0x31b2('0x10')](_0x31b2('0x22'),_0x128619,JSON[_0x31b2('0x12')](_0x1e17a1));_0x2809c4(_0x1e17a1);})[_0x31b2('0x17')](function(_0x49b9ef){logger['error']('ShowZendeskAccount',_0x49b9ef[_0x31b2('0x15')],_0x128619);_0x1dfca7(_0x165fa3[_0x31b2('0x13')](0x1f4,_0x49b9ef['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 0faf11b..6c4e1cd 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file +var _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0xb688,0xcf));var _0x8b68=function(_0x41746e,_0x376cd3){_0x41746e=_0x41746e-0x0;var _0x353849=_0xb688[_0x41746e];return _0x353849;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 2bd2381..1bce76b 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54f9=['sequelize','exports','STRING'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x54f9,0x180));var _0x954f=function(_0x4e0540,_0x37d1c4){_0x4e0540=_0x4e0540-0x0;var _0x110d52=_0x54f9[_0x4e0540];return _0x110d52;};'use strict';var Sequelize=require(_0x954f('0x0'));module[_0x954f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x954f('0x2')]}}; \ No newline at end of file +var _0x7b6e=['STRING','sequelize'];(function(_0x46cff9,_0x23d782){var _0x524120=function(_0x38a2d8){while(--_0x38a2d8){_0x46cff9['push'](_0x46cff9['shift']());}};_0x524120(++_0x23d782);}(_0x7b6e,0x1bd));var _0xe7b6=function(_0x15da95,_0x2a6b25){_0x15da95=_0x15da95-0x0;var _0x5cfdc5=_0x7b6e[_0x15da95];return _0x5cfdc5;};'use strict';var Sequelize=require(_0xe7b6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe7b6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 1998d1d..efddbe8 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca1a=['getTags','setTags','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','Tag','order'];(function(_0x83ff12,_0x5a8247){var _0x3332d5=function(_0x3c69e6){while(--_0x3c69e6){_0x83ff12['push'](_0x83ff12['shift']());}};_0x3332d5(++_0x5a8247);}(_0xca1a,0x15a));var _0xaca1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca1a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaca1('0x0'));var rimraf=require(_0xaca1('0x1'));var zipdir=require(_0xaca1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaca1('0x3'));var BPromise=require(_0xaca1('0x4'));var Mustache=require(_0xaca1('0x5'));var util=require(_0xaca1('0x6'));var path=require('path');var sox=require(_0xaca1('0x7'));var csv=require(_0xaca1('0x8'));var ejs=require(_0xaca1('0x9'));var fs=require('fs');var fs_extra=require(_0xaca1('0xa'));var _=require(_0xaca1('0xb'));var squel=require(_0xaca1('0xc'));var crypto=require(_0xaca1('0xd'));var jsforce=require(_0xaca1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaca1('0x8'));var querystring=require(_0xaca1('0xf'));var Papa=require(_0xaca1('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaca1('0x11'));var as=require(_0xaca1('0x12'));var hardwareService=require(_0xaca1('0x13'));var logger=require(_0xaca1('0x14'))('api');var utils=require(_0xaca1('0x15'));var config=require(_0xaca1('0x16'));var licenseUtil=require(_0xaca1('0x17'));var db=require(_0xaca1('0x18'))['db'];function respondWithStatusCode(_0x4cdff4,_0x26f8b7){_0x26f8b7=_0x26f8b7||0xcc;return function(_0x10f187){if(_0x10f187){return _0x4cdff4[_0xaca1('0x19')](_0x26f8b7);}return _0x4cdff4[_0xaca1('0x1a')](_0x26f8b7)['end']();};}function respondWithResult(_0x5edfad,_0x5f52c0){_0x5f52c0=_0x5f52c0||0xc8;return function(_0x3ee163){if(_0x3ee163){return _0x5edfad[_0xaca1('0x1a')](_0x5f52c0)[_0xaca1('0x1b')](_0x3ee163);}};}function respondWithFilteredResult(_0x3a1d2f,_0x1a0465){return function(_0x252c11){if(_0x252c11){var _0x36e90d=typeof _0x1a0465[_0xaca1('0x1c')]===_0xaca1('0x1d')&&typeof _0x1a0465['limit']===_0xaca1('0x1d');var _0x5e4ad1=_0x252c11[_0xaca1('0x1e')];var _0x560e6c=_0x36e90d?0x0:_0x1a0465[_0xaca1('0x1c')];var _0x45f64b=_0x36e90d?_0x252c11[_0xaca1('0x1e')]:_0x1a0465[_0xaca1('0x1c')]+_0x1a0465['limit'];var _0x26a9d1;if(_0x45f64b>=_0x5e4ad1){_0x45f64b=_0x5e4ad1;_0x26a9d1=0xc8;}else{_0x26a9d1=0xce;}_0x3a1d2f[_0xaca1('0x1a')](_0x26a9d1);return _0x3a1d2f[_0xaca1('0x1f')](_0xaca1('0x20'),_0x560e6c+'-'+_0x45f64b+'/'+_0x5e4ad1)[_0xaca1('0x1b')](_0x252c11);}return null;};}function patchUpdates(_0xc301c8){return function(_0x2bf93c){try{jsonpatch['apply'](_0x2bf93c,_0xc301c8,!![]);}catch(_0x58b4fc){return BPromise[_0xaca1('0x21')](_0x58b4fc);}return _0x2bf93c[_0xaca1('0x22')]();};}function saveUpdates(_0x17c52d,_0x32a6e3){return function(_0x56c3c8){if(_0x56c3c8){return _0x56c3c8[_0xaca1('0x23')](_0x17c52d)[_0xaca1('0x24')](function(_0x2e6b82){return _0x2e6b82;});}return null;};}function removeEntity(_0x26142f,_0x2feab6){return function(_0x45ab0f){if(_0x45ab0f){return _0x45ab0f['destroy']()[_0xaca1('0x24')](function(){_0x26142f['status'](0xcc)[_0xaca1('0x25')]();});}};}function handleEntityNotFound(_0x428dc4,_0x41712f){return function(_0x43bcee){if(!_0x43bcee){_0x428dc4[_0xaca1('0x19')](0x194);}return _0x43bcee;};}function handleError(_0x163e37,_0x1adcdd){_0x1adcdd=_0x1adcdd||0x1f4;return function(_0x4dcfd7){logger[_0xaca1('0x26')](_0x4dcfd7[_0xaca1('0x27')]);if(_0x4dcfd7[_0xaca1('0x28')]){delete _0x4dcfd7[_0xaca1('0x28')];}_0x163e37[_0xaca1('0x1a')](_0x1adcdd)[_0xaca1('0x29')](_0x4dcfd7);};}exports[_0xaca1('0x2a')]=function(_0x2a0bec,_0x22db03){var _0x48ca24={},_0x2a9172={},_0x43eb08={'count':0x0,'rows':[]};var _0x1356be=_[_0xaca1('0x2b')](db[_0xaca1('0x2c')][_0xaca1('0x2d')],function(_0x474e69){return{'name':_0x474e69[_0xaca1('0x2e')],'type':_0x474e69[_0xaca1('0x2f')][_0xaca1('0x30')]};});_0x2a9172[_0xaca1('0x31')]=_[_0xaca1('0x2b')](_0x1356be,_0xaca1('0x28'));_0x2a9172['query']=_[_0xaca1('0x32')](_0x2a0bec['query']);_0x2a9172['filters']=_[_0xaca1('0x33')](_0x2a9172[_0xaca1('0x31')],_0x2a9172[_0xaca1('0x34')]);_0x48ca24[_0xaca1('0x35')]=_['intersection'](_0x2a9172[_0xaca1('0x31')],qs[_0xaca1('0x36')](_0x2a0bec[_0xaca1('0x34')][_0xaca1('0x36')]));_0x48ca24[_0xaca1('0x35')]=_0x48ca24[_0xaca1('0x35')][_0xaca1('0x37')]?_0x48ca24['attributes']:_0x2a9172[_0xaca1('0x31')];if(!_0x2a0bec[_0xaca1('0x34')][_0xaca1('0x38')](_0xaca1('0x39'))){_0x48ca24[_0xaca1('0x3a')]=qs[_0xaca1('0x3a')](_0x2a0bec[_0xaca1('0x34')][_0xaca1('0x3a')]);_0x48ca24[_0xaca1('0x1c')]=qs[_0xaca1('0x1c')](_0x2a0bec[_0xaca1('0x34')]['offset']);}_0x48ca24['order']=qs[_0xaca1('0x3b')](_0x2a0bec['query']['sort']);_0x48ca24[_0xaca1('0x3c')]=qs[_0xaca1('0x3d')](_['pick'](_0x2a0bec[_0xaca1('0x34')],_0x2a9172[_0xaca1('0x3d')]),_0x1356be);if(_0x2a0bec[_0xaca1('0x34')]['filter']){_0x48ca24['where']=_[_0xaca1('0x3e')](_0x48ca24[_0xaca1('0x3c')],{'$or':_[_0xaca1('0x2b')](_0x1356be,function(_0x53374a){if(_0x53374a[_0xaca1('0x2f')]!==_0xaca1('0x3f')){var _0x5b0243={};_0x5b0243[_0x53374a[_0xaca1('0x28')]]={'$like':'%'+_0x2a0bec[_0xaca1('0x34')][_0xaca1('0x40')]+'%'};return _0x5b0243;}})});}_0x48ca24=_[_0xaca1('0x3e')]({},_0x48ca24,_0x2a0bec[_0xaca1('0x41')]);var _0x392e0b={'where':_0x48ca24[_0xaca1('0x3c')]};return db[_0xaca1('0x2c')][_0xaca1('0x1e')](_0x392e0b)[_0xaca1('0x24')](function(_0x39f758){_0x43eb08[_0xaca1('0x1e')]=_0x39f758;if(_0x2a0bec[_0xaca1('0x34')][_0xaca1('0x42')]){_0x48ca24[_0xaca1('0x43')]=[{'all':!![]}];}return db[_0xaca1('0x2c')]['findAll'](_0x48ca24);})[_0xaca1('0x24')](function(_0x4055b6){_0x43eb08[_0xaca1('0x44')]=_0x4055b6;return _0x43eb08;})[_0xaca1('0x24')](respondWithFilteredResult(_0x22db03,_0x48ca24))[_0xaca1('0x45')](handleError(_0x22db03,null));};exports[_0xaca1('0x46')]=function(_0x4da5ac,_0x430d1b){var _0x13b781={'raw':![],'where':{'id':_0x4da5ac[_0xaca1('0x47')]['id']}},_0x97eb0d={};_0x97eb0d[_0xaca1('0x31')]=_['keys'](db['ZendeskConfiguration'][_0xaca1('0x2d')]);_0x97eb0d[_0xaca1('0x34')]=_[_0xaca1('0x32')](_0x4da5ac[_0xaca1('0x34')]);_0x97eb0d[_0xaca1('0x3d')]=_['intersection'](_0x97eb0d[_0xaca1('0x31')],_0x97eb0d[_0xaca1('0x34')]);_0x13b781[_0xaca1('0x35')]=_[_0xaca1('0x33')](_0x97eb0d[_0xaca1('0x31')],qs['fields'](_0x4da5ac['query'][_0xaca1('0x36')]));_0x13b781[_0xaca1('0x35')]=_0x13b781['attributes'][_0xaca1('0x37')]?_0x13b781[_0xaca1('0x35')]:_0x97eb0d[_0xaca1('0x31')];if(_0x4da5ac[_0xaca1('0x34')][_0xaca1('0x42')]){_0x13b781[_0xaca1('0x43')]=[{'all':!![]}];}_0x13b781=_[_0xaca1('0x3e')]({},_0x13b781,_0x4da5ac['options']);return db[_0xaca1('0x2c')][_0xaca1('0x48')](_0x13b781)[_0xaca1('0x24')](handleEntityNotFound(_0x430d1b,null))[_0xaca1('0x24')](respondWithResult(_0x430d1b,null))[_0xaca1('0x45')](handleError(_0x430d1b,null));};exports[_0xaca1('0x49')]=function(_0x3c9851,_0x40809d){return db[_0xaca1('0x2c')][_0xaca1('0x49')](_0x3c9851[_0xaca1('0x4a')],{})['then'](respondWithResult(_0x40809d,0xc9))[_0xaca1('0x45')](handleError(_0x40809d,null));};exports['update']=function(_0x47138d,_0x114d5f){if(_0x47138d[_0xaca1('0x4a')]['id']){delete _0x47138d['body']['id'];}return db[_0xaca1('0x2c')][_0xaca1('0x48')]({'where':{'id':_0x47138d[_0xaca1('0x47')]['id']}})[_0xaca1('0x24')](handleEntityNotFound(_0x114d5f,null))[_0xaca1('0x24')](saveUpdates(_0x47138d[_0xaca1('0x4a')],null))[_0xaca1('0x24')](respondWithResult(_0x114d5f,null))[_0xaca1('0x45')](handleError(_0x114d5f,null));};exports[_0xaca1('0x4b')]=function(_0x3878e3,_0x97a32e){return db[_0xaca1('0x2c')][_0xaca1('0x48')]({'where':{'id':_0x3878e3[_0xaca1('0x47')]['id']}})[_0xaca1('0x24')](handleEntityNotFound(_0x97a32e,null))[_0xaca1('0x24')](removeEntity(_0x97a32e,null))[_0xaca1('0x45')](handleError(_0x97a32e,null));};exports[_0xaca1('0x4c')]=function(_0x4485d3,_0x13c68c,_0x27183c){var _0x34ea54={};var _0x2c83b3={};var _0xba133b;var _0x3dfa9e;return db[_0xaca1('0x2c')][_0xaca1('0x4d')]({'where':{'id':_0x4485d3['params']['id']}})[_0xaca1('0x24')](handleEntityNotFound(_0x13c68c,null))[_0xaca1('0x24')](function(_0x2c0784){if(_0x2c0784){_0xba133b=_0x2c0784;_0x2c83b3[_0xaca1('0x31')]=_[_0xaca1('0x32')](db[_0xaca1('0x4e')][_0xaca1('0x2d')]);_0x2c83b3[_0xaca1('0x34')]=_[_0xaca1('0x32')](_0x4485d3[_0xaca1('0x34')]);_0x2c83b3['filters']=_[_0xaca1('0x33')](_0x2c83b3[_0xaca1('0x31')],_0x2c83b3[_0xaca1('0x34')]);_0x34ea54[_0xaca1('0x35')]=_[_0xaca1('0x33')](_0x2c83b3[_0xaca1('0x31')],qs[_0xaca1('0x36')](_0x4485d3[_0xaca1('0x34')][_0xaca1('0x36')]));_0x34ea54[_0xaca1('0x35')]=_0x34ea54['attributes'][_0xaca1('0x37')]?_0x34ea54[_0xaca1('0x35')]:_0x2c83b3['model'];_0x34ea54['order']=qs[_0xaca1('0x3b')](_0x4485d3[_0xaca1('0x34')][_0xaca1('0x3b')]);_0x34ea54[_0xaca1('0x3c')]=qs['filters'](_[_0xaca1('0x4f')](_0x4485d3['query'],_0x2c83b3[_0xaca1('0x3d')]));if(_0x4485d3['query'][_0xaca1('0x40')]){_0x34ea54[_0xaca1('0x3c')]=_[_0xaca1('0x3e')](_0x34ea54[_0xaca1('0x3c')],{'$or':_['map'](_0x34ea54[_0xaca1('0x35')],function(_0x19aef2){var _0x528e86={};_0x528e86[_0x19aef2]={'$like':'%'+_0x4485d3['query'][_0xaca1('0x40')]+'%'};return _0x528e86;})});}_0x34ea54=_[_0xaca1('0x3e')]({},_0x34ea54,_0x4485d3[_0xaca1('0x41')]);return _0xba133b[_0xaca1('0x4c')](_0x34ea54);}})[_0xaca1('0x24')](function(_0x5f0a9b){if(_0x5f0a9b){_0x3dfa9e=_0x5f0a9b[_0xaca1('0x37')];if(!_0x4485d3[_0xaca1('0x34')][_0xaca1('0x38')](_0xaca1('0x39'))){_0x34ea54['limit']=qs[_0xaca1('0x3a')](_0x4485d3[_0xaca1('0x34')][_0xaca1('0x3a')]);_0x34ea54[_0xaca1('0x1c')]=qs[_0xaca1('0x1c')](_0x4485d3['query'][_0xaca1('0x1c')]);}return _0xba133b[_0xaca1('0x4c')](_0x34ea54);}})[_0xaca1('0x24')](function(_0x2628a5){if(_0x2628a5){return _0x2628a5?{'count':_0x3dfa9e,'rows':_0x2628a5}:null;}})[_0xaca1('0x24')](respondWithResult(_0x13c68c,null))[_0xaca1('0x45')](handleError(_0x13c68c,null));};exports[_0xaca1('0x50')]=function(_0x2b83d9,_0x4c3929,_0x5702db){var _0x3f1b7d={};var _0x188ea4={};var _0x23ab3a;var _0x53f1f4;return db['ZendeskConfiguration'][_0xaca1('0x4d')]({'where':{'id':_0x2b83d9[_0xaca1('0x47')]['id']}})[_0xaca1('0x24')](handleEntityNotFound(_0x4c3929,null))['then'](function(_0x5e585e){if(_0x5e585e){_0x23ab3a=_0x5e585e;_0x188ea4[_0xaca1('0x31')]=_[_0xaca1('0x32')](db['ZendeskField'][_0xaca1('0x2d')]);_0x188ea4[_0xaca1('0x34')]=_['keys'](_0x2b83d9[_0xaca1('0x34')]);_0x188ea4[_0xaca1('0x3d')]=_['intersection'](_0x188ea4['model'],_0x188ea4[_0xaca1('0x34')]);_0x3f1b7d['attributes']=_[_0xaca1('0x33')](_0x188ea4[_0xaca1('0x31')],qs[_0xaca1('0x36')](_0x2b83d9[_0xaca1('0x34')]['fields']));_0x3f1b7d[_0xaca1('0x35')]=_0x3f1b7d[_0xaca1('0x35')][_0xaca1('0x37')]?_0x3f1b7d[_0xaca1('0x35')]:_0x188ea4[_0xaca1('0x31')];_0x3f1b7d['order']=qs[_0xaca1('0x3b')](_0x2b83d9[_0xaca1('0x34')][_0xaca1('0x3b')]);_0x3f1b7d[_0xaca1('0x3c')]=qs[_0xaca1('0x3d')](_[_0xaca1('0x4f')](_0x2b83d9[_0xaca1('0x34')],_0x188ea4[_0xaca1('0x3d')]));if(_0x2b83d9[_0xaca1('0x34')][_0xaca1('0x40')]){_0x3f1b7d['where']=_['merge'](_0x3f1b7d[_0xaca1('0x3c')],{'$or':_[_0xaca1('0x2b')](_0x3f1b7d['attributes'],function(_0x342a6f){var _0x4789b7={};_0x4789b7[_0x342a6f]={'$like':'%'+_0x2b83d9[_0xaca1('0x34')][_0xaca1('0x40')]+'%'};return _0x4789b7;})});}_0x3f1b7d=_[_0xaca1('0x3e')]({},_0x3f1b7d,_0x2b83d9[_0xaca1('0x41')]);return _0x23ab3a[_0xaca1('0x50')](_0x3f1b7d);}})[_0xaca1('0x24')](function(_0x52a08a){if(_0x52a08a){_0x53f1f4=_0x52a08a[_0xaca1('0x37')];if(!_0x2b83d9[_0xaca1('0x34')][_0xaca1('0x38')](_0xaca1('0x39'))){_0x3f1b7d[_0xaca1('0x3a')]=qs[_0xaca1('0x3a')](_0x2b83d9[_0xaca1('0x34')]['limit']);_0x3f1b7d[_0xaca1('0x1c')]=qs['offset'](_0x2b83d9['query'][_0xaca1('0x1c')]);}return _0x23ab3a[_0xaca1('0x50')](_0x3f1b7d);}})['then'](function(_0x225b16){if(_0x225b16){return _0x225b16?{'count':_0x53f1f4,'rows':_0x225b16}:null;}})['then'](respondWithResult(_0x4c3929,null))[_0xaca1('0x45')](handleError(_0x4c3929,null));};exports[_0xaca1('0x51')]=function(_0x1ecc7d,_0xc13bba,_0x2a069a){var _0x5b2f1f={};var _0x58881e={};var _0x216436;var _0xb055bd;return db[_0xaca1('0x2c')][_0xaca1('0x4d')]({'where':{'id':_0x1ecc7d[_0xaca1('0x47')]['id']}})[_0xaca1('0x24')](handleEntityNotFound(_0xc13bba,null))['then'](function(_0x39a73d){if(_0x39a73d){_0x216436=_0x39a73d;_0x58881e['model']=_[_0xaca1('0x32')](db[_0xaca1('0x4e')][_0xaca1('0x2d')]);_0x58881e[_0xaca1('0x34')]=_[_0xaca1('0x32')](_0x1ecc7d[_0xaca1('0x34')]);_0x58881e[_0xaca1('0x3d')]=_[_0xaca1('0x33')](_0x58881e[_0xaca1('0x31')],_0x58881e['query']);_0x5b2f1f[_0xaca1('0x35')]=_[_0xaca1('0x33')](_0x58881e[_0xaca1('0x31')],qs[_0xaca1('0x36')](_0x1ecc7d[_0xaca1('0x34')][_0xaca1('0x36')]));_0x5b2f1f[_0xaca1('0x35')]=_0x5b2f1f['attributes'][_0xaca1('0x37')]?_0x5b2f1f[_0xaca1('0x35')]:_0x58881e[_0xaca1('0x31')];_0x5b2f1f['order']=qs[_0xaca1('0x3b')](_0x1ecc7d[_0xaca1('0x34')]['sort']);_0x5b2f1f['where']=qs[_0xaca1('0x3d')](_[_0xaca1('0x4f')](_0x1ecc7d[_0xaca1('0x34')],_0x58881e[_0xaca1('0x3d')]));if(_0x1ecc7d['query'][_0xaca1('0x40')]){_0x5b2f1f[_0xaca1('0x3c')]=_[_0xaca1('0x3e')](_0x5b2f1f[_0xaca1('0x3c')],{'$or':_['map'](_0x5b2f1f[_0xaca1('0x35')],function(_0xbad0ad){var _0x8c6428={};_0x8c6428[_0xbad0ad]={'$like':'%'+_0x1ecc7d[_0xaca1('0x34')][_0xaca1('0x40')]+'%'};return _0x8c6428;})});}_0x5b2f1f=_[_0xaca1('0x3e')]({},_0x5b2f1f,_0x1ecc7d[_0xaca1('0x41')]);return _0x216436[_0xaca1('0x51')](_0x5b2f1f);}})[_0xaca1('0x24')](function(_0x55d659){if(_0x55d659){_0xb055bd=_0x55d659['length'];if(!_0x1ecc7d[_0xaca1('0x34')][_0xaca1('0x38')](_0xaca1('0x39'))){_0x5b2f1f[_0xaca1('0x3a')]=qs[_0xaca1('0x3a')](_0x1ecc7d[_0xaca1('0x34')][_0xaca1('0x3a')]);_0x5b2f1f[_0xaca1('0x1c')]=qs[_0xaca1('0x1c')](_0x1ecc7d[_0xaca1('0x34')][_0xaca1('0x1c')]);}return _0x216436[_0xaca1('0x51')](_0x5b2f1f);}})[_0xaca1('0x24')](function(_0x372d29){if(_0x372d29){return _0x372d29?{'count':_0xb055bd,'rows':_0x372d29}:null;}})[_0xaca1('0x24')](respondWithResult(_0xc13bba,null))[_0xaca1('0x45')](handleError(_0xc13bba,null));};exports['getTags']=function(_0xa9c43b,_0x486a57,_0x529f74){var _0x28bbe8={};var _0x3f1fa8={};var _0x4db883;var _0xaeeb1a;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xa9c43b[_0xaca1('0x47')]['id']}})[_0xaca1('0x24')](handleEntityNotFound(_0x486a57,null))['then'](function(_0x4b1dba){if(_0x4b1dba){_0x4db883=_0x4b1dba;_0x3f1fa8['model']=_[_0xaca1('0x32')](db[_0xaca1('0x52')][_0xaca1('0x2d')]);_0x3f1fa8[_0xaca1('0x34')]=_[_0xaca1('0x32')](_0xa9c43b['query']);_0x3f1fa8[_0xaca1('0x3d')]=_[_0xaca1('0x33')](_0x3f1fa8['model'],_0x3f1fa8[_0xaca1('0x34')]);_0x28bbe8[_0xaca1('0x35')]=_['intersection'](_0x3f1fa8[_0xaca1('0x31')],qs['fields'](_0xa9c43b[_0xaca1('0x34')][_0xaca1('0x36')]));_0x28bbe8[_0xaca1('0x35')]=_0x28bbe8[_0xaca1('0x35')][_0xaca1('0x37')]?_0x28bbe8[_0xaca1('0x35')]:_0x3f1fa8[_0xaca1('0x31')];_0x28bbe8[_0xaca1('0x53')]=qs[_0xaca1('0x3b')](_0xa9c43b[_0xaca1('0x34')][_0xaca1('0x3b')]);_0x28bbe8['where']=qs[_0xaca1('0x3d')](_[_0xaca1('0x4f')](_0xa9c43b[_0xaca1('0x34')],_0x3f1fa8[_0xaca1('0x3d')]));if(_0xa9c43b['query']['filter']){_0x28bbe8[_0xaca1('0x3c')]=_[_0xaca1('0x3e')](_0x28bbe8['where'],{'$or':_[_0xaca1('0x2b')](_0x28bbe8[_0xaca1('0x35')],function(_0x8f12b5){var _0x272b25={};_0x272b25[_0x8f12b5]={'$like':'%'+_0xa9c43b[_0xaca1('0x34')][_0xaca1('0x40')]+'%'};return _0x272b25;})});}_0x28bbe8=_['merge']({},_0x28bbe8,_0xa9c43b[_0xaca1('0x41')]);return _0x4db883[_0xaca1('0x54')](_0x28bbe8);}})['then'](function(_0x1a47c2){if(_0x1a47c2){_0xaeeb1a=_0x1a47c2['length'];if(!_0xa9c43b['query']['hasOwnProperty'](_0xaca1('0x39'))){_0x28bbe8[_0xaca1('0x3a')]=qs[_0xaca1('0x3a')](_0xa9c43b[_0xaca1('0x34')][_0xaca1('0x3a')]);_0x28bbe8[_0xaca1('0x1c')]=qs[_0xaca1('0x1c')](_0xa9c43b[_0xaca1('0x34')][_0xaca1('0x1c')]);}return _0x4db883[_0xaca1('0x54')](_0x28bbe8);}})['then'](function(_0x5b518e){if(_0x5b518e){return _0x5b518e?{'count':_0xaeeb1a,'rows':_0x5b518e}:null;}})[_0xaca1('0x24')](respondWithResult(_0x486a57,null))[_0xaca1('0x45')](handleError(_0x486a57,null));};exports[_0xaca1('0x55')]=function(_0x4c4a29,_0x20930c,_0x4301b7){if(_0x4c4a29[_0xaca1('0x4a')]['id']){delete _0x4c4a29['body']['id'];}return db[_0xaca1('0x2c')][_0xaca1('0x4d')]({'where':{'id':_0x4c4a29[_0xaca1('0x47')]['id']}})['then'](handleEntityNotFound(_0x20930c,null))[_0xaca1('0x24')](function(_0x54742f){if(_0x54742f){return _0x54742f['setTags'](_0x4c4a29['body']['ids']||[]);}return null;})[_0xaca1('0x24')](respondWithResult(_0x20930c,null))['catch'](handleError(_0x20930c,null));}; \ No newline at end of file +var _0x7007=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','create','body','find','params','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7007,0x146));var _0x7700=function(_0x7b615f,_0xa28bd8){_0x7b615f=_0x7b615f-0x0;var _0x5449ea=_0x7007[_0x7b615f];return _0x5449ea;};'use strict';var emlformat=require(_0x7700('0x0'));var rimraf=require(_0x7700('0x1'));var zipdir=require(_0x7700('0x2'));var jsonpatch=require(_0x7700('0x3'));var rp=require(_0x7700('0x4'));var moment=require(_0x7700('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7700('0x6'));var util=require(_0x7700('0x7'));var path=require(_0x7700('0x8'));var sox=require(_0x7700('0x9'));var csv=require(_0x7700('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7700('0xb'));var _=require(_0x7700('0xc'));var squel=require(_0x7700('0xd'));var crypto=require(_0x7700('0xe'));var jsforce=require(_0x7700('0xf'));var deskjs=require(_0x7700('0x10'));var toCsv=require(_0x7700('0xa'));var querystring=require(_0x7700('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7700('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7700('0x13'));var logger=require(_0x7700('0x14'))(_0x7700('0x15'));var utils=require('../../config/utils');var config=require(_0x7700('0x16'));var licenseUtil=require(_0x7700('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5016c4,_0x56ae59){_0x56ae59=_0x56ae59||0xcc;return function(_0x238dda){if(_0x238dda){return _0x5016c4['sendStatus'](_0x56ae59);}return _0x5016c4['status'](_0x56ae59)[_0x7700('0x18')]();};}function respondWithResult(_0x11c436,_0x4854b5){_0x4854b5=_0x4854b5||0xc8;return function(_0x28760c){if(_0x28760c){return _0x11c436[_0x7700('0x19')](_0x4854b5)[_0x7700('0x1a')](_0x28760c);}};}function respondWithFilteredResult(_0x57f6f6,_0x533dcb){return function(_0x38e6cd){if(_0x38e6cd){var _0x54226d=typeof _0x533dcb[_0x7700('0x1b')]===_0x7700('0x1c')&&typeof _0x533dcb[_0x7700('0x1d')]===_0x7700('0x1c');var _0x3b53bd=_0x38e6cd[_0x7700('0x1e')];var _0x183b84=_0x54226d?0x0:_0x533dcb[_0x7700('0x1b')];var _0x1f56e2=_0x54226d?_0x38e6cd[_0x7700('0x1e')]:_0x533dcb[_0x7700('0x1b')]+_0x533dcb[_0x7700('0x1d')];var _0x45dcba;if(_0x1f56e2>=_0x3b53bd){_0x1f56e2=_0x3b53bd;_0x45dcba=0xc8;}else{_0x45dcba=0xce;}_0x57f6f6['status'](_0x45dcba);return _0x57f6f6[_0x7700('0x1f')]('Content-Range',_0x183b84+'-'+_0x1f56e2+'/'+_0x3b53bd)['json'](_0x38e6cd);}return null;};}function patchUpdates(_0x362cce){return function(_0x3231b9){try{jsonpatch[_0x7700('0x20')](_0x3231b9,_0x362cce,!![]);}catch(_0x4b45c4){return BPromise[_0x7700('0x21')](_0x4b45c4);}return _0x3231b9['save']();};}function saveUpdates(_0x4d9566,_0x29a24a){return function(_0x1462d9){if(_0x1462d9){return _0x1462d9[_0x7700('0x22')](_0x4d9566)[_0x7700('0x23')](function(_0x3a8256){return _0x3a8256;});}return null;};}function removeEntity(_0x4aaaee,_0x4c007e){return function(_0x4669a6){if(_0x4669a6){return _0x4669a6[_0x7700('0x24')]()['then'](function(){_0x4aaaee[_0x7700('0x19')](0xcc)[_0x7700('0x18')]();});}};}function handleEntityNotFound(_0x2b0ceb,_0x12f59f){return function(_0x2a5a76){if(!_0x2a5a76){_0x2b0ceb['sendStatus'](0x194);}return _0x2a5a76;};}function handleError(_0x1e1cba,_0x46307f){_0x46307f=_0x46307f||0x1f4;return function(_0x589836){logger[_0x7700('0x25')](_0x589836[_0x7700('0x26')]);if(_0x589836[_0x7700('0x27')]){delete _0x589836[_0x7700('0x27')];}_0x1e1cba[_0x7700('0x19')](_0x46307f)[_0x7700('0x28')](_0x589836);};}exports[_0x7700('0x29')]=function(_0x1bdaf3,_0x5a5640){var _0x3c9c4b={},_0x2c7fa9={},_0x46f4b9={'count':0x0,'rows':[]};var _0x18247e=_[_0x7700('0x2a')](db[_0x7700('0x2b')]['rawAttributes'],function(_0x990710){return{'name':_0x990710[_0x7700('0x2c')],'type':_0x990710[_0x7700('0x2d')][_0x7700('0x2e')]};});_0x2c7fa9[_0x7700('0x2f')]=_['map'](_0x18247e,_0x7700('0x27'));_0x2c7fa9[_0x7700('0x30')]=_[_0x7700('0x31')](_0x1bdaf3['query']);_0x2c7fa9[_0x7700('0x32')]=_[_0x7700('0x33')](_0x2c7fa9['model'],_0x2c7fa9[_0x7700('0x30')]);_0x3c9c4b['attributes']=_[_0x7700('0x33')](_0x2c7fa9['model'],qs[_0x7700('0x34')](_0x1bdaf3[_0x7700('0x30')][_0x7700('0x34')]));_0x3c9c4b['attributes']=_0x3c9c4b[_0x7700('0x35')][_0x7700('0x36')]?_0x3c9c4b['attributes']:_0x2c7fa9[_0x7700('0x2f')];if(!_0x1bdaf3[_0x7700('0x30')]['hasOwnProperty'](_0x7700('0x37'))){_0x3c9c4b['limit']=qs[_0x7700('0x1d')](_0x1bdaf3['query'][_0x7700('0x1d')]);_0x3c9c4b[_0x7700('0x1b')]=qs[_0x7700('0x1b')](_0x1bdaf3[_0x7700('0x30')]['offset']);}_0x3c9c4b[_0x7700('0x38')]=qs[_0x7700('0x39')](_0x1bdaf3['query'][_0x7700('0x39')]);_0x3c9c4b['where']=qs[_0x7700('0x32')](_[_0x7700('0x3a')](_0x1bdaf3[_0x7700('0x30')],_0x2c7fa9[_0x7700('0x32')]),_0x18247e);if(_0x1bdaf3['query'][_0x7700('0x3b')]){_0x3c9c4b[_0x7700('0x3c')]=_[_0x7700('0x3d')](_0x3c9c4b['where'],{'$or':_[_0x7700('0x2a')](_0x18247e,function(_0x458929){if(_0x458929[_0x7700('0x2d')]!==_0x7700('0x3e')){var _0x2a5d7e={};_0x2a5d7e[_0x458929[_0x7700('0x27')]]={'$like':'%'+_0x1bdaf3['query'][_0x7700('0x3b')]+'%'};return _0x2a5d7e;}})});}_0x3c9c4b=_[_0x7700('0x3d')]({},_0x3c9c4b,_0x1bdaf3[_0x7700('0x3f')]);var _0x4e19b5={'where':_0x3c9c4b['where']};return db['ZendeskConfiguration']['count'](_0x4e19b5)[_0x7700('0x23')](function(_0xf32824){_0x46f4b9['count']=_0xf32824;if(_0x1bdaf3[_0x7700('0x30')][_0x7700('0x40')]){_0x3c9c4b[_0x7700('0x41')]=[{'all':!![]}];}return db[_0x7700('0x2b')][_0x7700('0x42')](_0x3c9c4b);})[_0x7700('0x23')](function(_0x5be517){_0x46f4b9['rows']=_0x5be517;return _0x46f4b9;})[_0x7700('0x23')](respondWithFilteredResult(_0x5a5640,_0x3c9c4b))[_0x7700('0x43')](handleError(_0x5a5640,null));};exports[_0x7700('0x44')]=function(_0x132a3e,_0xc8f5af){var _0xafdb23={'raw':![],'where':{'id':_0x132a3e['params']['id']}},_0xb5a2f5={};_0xb5a2f5[_0x7700('0x2f')]=_[_0x7700('0x31')](db[_0x7700('0x2b')][_0x7700('0x45')]);_0xb5a2f5[_0x7700('0x30')]=_['keys'](_0x132a3e[_0x7700('0x30')]);_0xb5a2f5[_0x7700('0x32')]=_[_0x7700('0x33')](_0xb5a2f5[_0x7700('0x2f')],_0xb5a2f5[_0x7700('0x30')]);_0xafdb23[_0x7700('0x35')]=_['intersection'](_0xb5a2f5[_0x7700('0x2f')],qs['fields'](_0x132a3e[_0x7700('0x30')][_0x7700('0x34')]));_0xafdb23[_0x7700('0x35')]=_0xafdb23['attributes']['length']?_0xafdb23[_0x7700('0x35')]:_0xb5a2f5[_0x7700('0x2f')];if(_0x132a3e[_0x7700('0x30')][_0x7700('0x40')]){_0xafdb23[_0x7700('0x41')]=[{'all':!![]}];}_0xafdb23=_[_0x7700('0x3d')]({},_0xafdb23,_0x132a3e[_0x7700('0x3f')]);return db[_0x7700('0x2b')]['find'](_0xafdb23)[_0x7700('0x23')](handleEntityNotFound(_0xc8f5af,null))[_0x7700('0x23')](respondWithResult(_0xc8f5af,null))[_0x7700('0x43')](handleError(_0xc8f5af,null));};exports[_0x7700('0x46')]=function(_0x50e82a,_0x1654c5){return db[_0x7700('0x2b')][_0x7700('0x46')](_0x50e82a[_0x7700('0x47')],{})[_0x7700('0x23')](respondWithResult(_0x1654c5,0xc9))[_0x7700('0x43')](handleError(_0x1654c5,null));};exports[_0x7700('0x22')]=function(_0xccfd81,_0x4b623c){if(_0xccfd81[_0x7700('0x47')]['id']){delete _0xccfd81[_0x7700('0x47')]['id'];}return db[_0x7700('0x2b')][_0x7700('0x48')]({'where':{'id':_0xccfd81[_0x7700('0x49')]['id']}})[_0x7700('0x23')](handleEntityNotFound(_0x4b623c,null))[_0x7700('0x23')](saveUpdates(_0xccfd81[_0x7700('0x47')],null))[_0x7700('0x23')](respondWithResult(_0x4b623c,null))[_0x7700('0x43')](handleError(_0x4b623c,null));};exports[_0x7700('0x24')]=function(_0x86f68f,_0x27a232){return db[_0x7700('0x2b')][_0x7700('0x48')]({'where':{'id':_0x86f68f[_0x7700('0x49')]['id']}})[_0x7700('0x23')](handleEntityNotFound(_0x27a232,null))[_0x7700('0x23')](removeEntity(_0x27a232,null))[_0x7700('0x43')](handleError(_0x27a232,null));};exports['getFields']=function(_0x44cba3,_0x88dd03,_0x37b0d5){var _0x2db207={};var _0x32605a={};var _0x440a36;var _0x28c382;return db[_0x7700('0x2b')][_0x7700('0x4a')]({'where':{'id':_0x44cba3[_0x7700('0x49')]['id']}})['then'](handleEntityNotFound(_0x88dd03,null))[_0x7700('0x23')](function(_0x2a4b03){if(_0x2a4b03){_0x440a36=_0x2a4b03;_0x32605a['model']=_[_0x7700('0x31')](db[_0x7700('0x4b')][_0x7700('0x45')]);_0x32605a[_0x7700('0x30')]=_[_0x7700('0x31')](_0x44cba3[_0x7700('0x30')]);_0x32605a['filters']=_[_0x7700('0x33')](_0x32605a[_0x7700('0x2f')],_0x32605a['query']);_0x2db207[_0x7700('0x35')]=_[_0x7700('0x33')](_0x32605a[_0x7700('0x2f')],qs['fields'](_0x44cba3['query'][_0x7700('0x34')]));_0x2db207[_0x7700('0x35')]=_0x2db207[_0x7700('0x35')][_0x7700('0x36')]?_0x2db207[_0x7700('0x35')]:_0x32605a[_0x7700('0x2f')];_0x2db207[_0x7700('0x38')]=qs[_0x7700('0x39')](_0x44cba3[_0x7700('0x30')][_0x7700('0x39')]);_0x2db207[_0x7700('0x3c')]=qs[_0x7700('0x32')](_[_0x7700('0x3a')](_0x44cba3[_0x7700('0x30')],_0x32605a[_0x7700('0x32')]));if(_0x44cba3[_0x7700('0x30')][_0x7700('0x3b')]){_0x2db207[_0x7700('0x3c')]=_[_0x7700('0x3d')](_0x2db207[_0x7700('0x3c')],{'$or':_[_0x7700('0x2a')](_0x2db207['attributes'],function(_0x195a65){var _0x5d4fb9={};_0x5d4fb9[_0x195a65]={'$like':'%'+_0x44cba3[_0x7700('0x30')][_0x7700('0x3b')]+'%'};return _0x5d4fb9;})});}_0x2db207=_['merge']({},_0x2db207,_0x44cba3[_0x7700('0x3f')]);return _0x440a36[_0x7700('0x4c')](_0x2db207);}})[_0x7700('0x23')](function(_0x4e66a3){if(_0x4e66a3){_0x28c382=_0x4e66a3[_0x7700('0x36')];if(!_0x44cba3[_0x7700('0x30')][_0x7700('0x4d')](_0x7700('0x37'))){_0x2db207[_0x7700('0x1d')]=qs['limit'](_0x44cba3[_0x7700('0x30')]['limit']);_0x2db207[_0x7700('0x1b')]=qs[_0x7700('0x1b')](_0x44cba3[_0x7700('0x30')][_0x7700('0x1b')]);}return _0x440a36[_0x7700('0x4c')](_0x2db207);}})[_0x7700('0x23')](function(_0x741434){if(_0x741434){return _0x741434?{'count':_0x28c382,'rows':_0x741434}:null;}})[_0x7700('0x23')](respondWithResult(_0x88dd03,null))[_0x7700('0x43')](handleError(_0x88dd03,null));};exports[_0x7700('0x4e')]=function(_0x27bb2b,_0x6bf44e,_0x510589){var _0xf68789={};var _0x2c3773={};var _0x3349b1;var _0x1c526a;return db[_0x7700('0x2b')]['findOne']({'where':{'id':_0x27bb2b['params']['id']}})[_0x7700('0x23')](handleEntityNotFound(_0x6bf44e,null))[_0x7700('0x23')](function(_0x42d6b1){if(_0x42d6b1){_0x3349b1=_0x42d6b1;_0x2c3773[_0x7700('0x2f')]=_[_0x7700('0x31')](db['ZendeskField']['rawAttributes']);_0x2c3773['query']=_[_0x7700('0x31')](_0x27bb2b[_0x7700('0x30')]);_0x2c3773[_0x7700('0x32')]=_[_0x7700('0x33')](_0x2c3773[_0x7700('0x2f')],_0x2c3773[_0x7700('0x30')]);_0xf68789['attributes']=_[_0x7700('0x33')](_0x2c3773[_0x7700('0x2f')],qs['fields'](_0x27bb2b['query']['fields']));_0xf68789[_0x7700('0x35')]=_0xf68789[_0x7700('0x35')][_0x7700('0x36')]?_0xf68789[_0x7700('0x35')]:_0x2c3773['model'];_0xf68789[_0x7700('0x38')]=qs['sort'](_0x27bb2b[_0x7700('0x30')][_0x7700('0x39')]);_0xf68789['where']=qs['filters'](_['pick'](_0x27bb2b[_0x7700('0x30')],_0x2c3773[_0x7700('0x32')]));if(_0x27bb2b[_0x7700('0x30')][_0x7700('0x3b')]){_0xf68789[_0x7700('0x3c')]=_['merge'](_0xf68789[_0x7700('0x3c')],{'$or':_[_0x7700('0x2a')](_0xf68789[_0x7700('0x35')],function(_0x3f89e7){var _0x35836e={};_0x35836e[_0x3f89e7]={'$like':'%'+_0x27bb2b[_0x7700('0x30')][_0x7700('0x3b')]+'%'};return _0x35836e;})});}_0xf68789=_[_0x7700('0x3d')]({},_0xf68789,_0x27bb2b[_0x7700('0x3f')]);return _0x3349b1[_0x7700('0x4e')](_0xf68789);}})[_0x7700('0x23')](function(_0x187d3d){if(_0x187d3d){_0x1c526a=_0x187d3d['length'];if(!_0x27bb2b[_0x7700('0x30')][_0x7700('0x4d')](_0x7700('0x37'))){_0xf68789[_0x7700('0x1d')]=qs[_0x7700('0x1d')](_0x27bb2b[_0x7700('0x30')]['limit']);_0xf68789[_0x7700('0x1b')]=qs[_0x7700('0x1b')](_0x27bb2b[_0x7700('0x30')]['offset']);}return _0x3349b1[_0x7700('0x4e')](_0xf68789);}})['then'](function(_0x446f42){if(_0x446f42){return _0x446f42?{'count':_0x1c526a,'rows':_0x446f42}:null;}})['then'](respondWithResult(_0x6bf44e,null))[_0x7700('0x43')](handleError(_0x6bf44e,null));};exports[_0x7700('0x4f')]=function(_0x987d79,_0x47cb9e,_0x3bcb39){var _0x1faf07={};var _0x1155ee={};var _0x1ed308;var _0x5bc795;return db['ZendeskConfiguration'][_0x7700('0x4a')]({'where':{'id':_0x987d79['params']['id']}})['then'](handleEntityNotFound(_0x47cb9e,null))[_0x7700('0x23')](function(_0xd642c){if(_0xd642c){_0x1ed308=_0xd642c;_0x1155ee['model']=_[_0x7700('0x31')](db[_0x7700('0x4b')][_0x7700('0x45')]);_0x1155ee[_0x7700('0x30')]=_['keys'](_0x987d79[_0x7700('0x30')]);_0x1155ee['filters']=_['intersection'](_0x1155ee[_0x7700('0x2f')],_0x1155ee[_0x7700('0x30')]);_0x1faf07[_0x7700('0x35')]=_[_0x7700('0x33')](_0x1155ee[_0x7700('0x2f')],qs[_0x7700('0x34')](_0x987d79[_0x7700('0x30')][_0x7700('0x34')]));_0x1faf07[_0x7700('0x35')]=_0x1faf07[_0x7700('0x35')]['length']?_0x1faf07[_0x7700('0x35')]:_0x1155ee[_0x7700('0x2f')];_0x1faf07[_0x7700('0x38')]=qs[_0x7700('0x39')](_0x987d79['query'][_0x7700('0x39')]);_0x1faf07[_0x7700('0x3c')]=qs[_0x7700('0x32')](_[_0x7700('0x3a')](_0x987d79[_0x7700('0x30')],_0x1155ee[_0x7700('0x32')]));if(_0x987d79[_0x7700('0x30')][_0x7700('0x3b')]){_0x1faf07[_0x7700('0x3c')]=_['merge'](_0x1faf07[_0x7700('0x3c')],{'$or':_[_0x7700('0x2a')](_0x1faf07[_0x7700('0x35')],function(_0xc9d780){var _0xdce379={};_0xdce379[_0xc9d780]={'$like':'%'+_0x987d79[_0x7700('0x30')]['filter']+'%'};return _0xdce379;})});}_0x1faf07=_[_0x7700('0x3d')]({},_0x1faf07,_0x987d79[_0x7700('0x3f')]);return _0x1ed308[_0x7700('0x4f')](_0x1faf07);}})[_0x7700('0x23')](function(_0x545801){if(_0x545801){_0x5bc795=_0x545801[_0x7700('0x36')];if(!_0x987d79['query'][_0x7700('0x4d')]('nolimit')){_0x1faf07[_0x7700('0x1d')]=qs[_0x7700('0x1d')](_0x987d79['query'][_0x7700('0x1d')]);_0x1faf07[_0x7700('0x1b')]=qs[_0x7700('0x1b')](_0x987d79[_0x7700('0x30')]['offset']);}return _0x1ed308[_0x7700('0x4f')](_0x1faf07);}})[_0x7700('0x23')](function(_0x1d87eb){if(_0x1d87eb){return _0x1d87eb?{'count':_0x5bc795,'rows':_0x1d87eb}:null;}})['then'](respondWithResult(_0x47cb9e,null))['catch'](handleError(_0x47cb9e,null));};exports[_0x7700('0x50')]=function(_0x1cb737,_0x200458,_0x1d968f){var _0x5da5f3={};var _0x5b3ef6={};var _0x42ec81;var _0x23bc0d;return db[_0x7700('0x2b')]['findOne']({'where':{'id':_0x1cb737[_0x7700('0x49')]['id']}})[_0x7700('0x23')](handleEntityNotFound(_0x200458,null))[_0x7700('0x23')](function(_0x4c0f59){if(_0x4c0f59){_0x42ec81=_0x4c0f59;_0x5b3ef6[_0x7700('0x2f')]=_[_0x7700('0x31')](db[_0x7700('0x51')][_0x7700('0x45')]);_0x5b3ef6[_0x7700('0x30')]=_['keys'](_0x1cb737[_0x7700('0x30')]);_0x5b3ef6[_0x7700('0x32')]=_[_0x7700('0x33')](_0x5b3ef6[_0x7700('0x2f')],_0x5b3ef6[_0x7700('0x30')]);_0x5da5f3['attributes']=_['intersection'](_0x5b3ef6[_0x7700('0x2f')],qs[_0x7700('0x34')](_0x1cb737['query'][_0x7700('0x34')]));_0x5da5f3[_0x7700('0x35')]=_0x5da5f3['attributes']['length']?_0x5da5f3[_0x7700('0x35')]:_0x5b3ef6[_0x7700('0x2f')];_0x5da5f3['order']=qs[_0x7700('0x39')](_0x1cb737['query']['sort']);_0x5da5f3[_0x7700('0x3c')]=qs[_0x7700('0x32')](_[_0x7700('0x3a')](_0x1cb737[_0x7700('0x30')],_0x5b3ef6[_0x7700('0x32')]));if(_0x1cb737[_0x7700('0x30')][_0x7700('0x3b')]){_0x5da5f3[_0x7700('0x3c')]=_[_0x7700('0x3d')](_0x5da5f3['where'],{'$or':_['map'](_0x5da5f3[_0x7700('0x35')],function(_0x4e6863){var _0x34ade2={};_0x34ade2[_0x4e6863]={'$like':'%'+_0x1cb737[_0x7700('0x30')]['filter']+'%'};return _0x34ade2;})});}_0x5da5f3=_[_0x7700('0x3d')]({},_0x5da5f3,_0x1cb737[_0x7700('0x3f')]);return _0x42ec81[_0x7700('0x50')](_0x5da5f3);}})[_0x7700('0x23')](function(_0x20e305){if(_0x20e305){_0x23bc0d=_0x20e305['length'];if(!_0x1cb737[_0x7700('0x30')][_0x7700('0x4d')](_0x7700('0x37'))){_0x5da5f3['limit']=qs['limit'](_0x1cb737['query'][_0x7700('0x1d')]);_0x5da5f3['offset']=qs['offset'](_0x1cb737[_0x7700('0x30')][_0x7700('0x1b')]);}return _0x42ec81[_0x7700('0x50')](_0x5da5f3);}})[_0x7700('0x23')](function(_0x58b38d){if(_0x58b38d){return _0x58b38d?{'count':_0x23bc0d,'rows':_0x58b38d}:null;}})['then'](respondWithResult(_0x200458,null))['catch'](handleError(_0x200458,null));};exports[_0x7700('0x52')]=function(_0x415c43,_0x4c98cd,_0x4c88ed){if(_0x415c43[_0x7700('0x47')]['id']){delete _0x415c43[_0x7700('0x47')]['id'];}return db[_0x7700('0x2b')]['findOne']({'where':{'id':_0x415c43[_0x7700('0x49')]['id']}})[_0x7700('0x23')](handleEntityNotFound(_0x4c98cd,null))['then'](function(_0x6b47fa){if(_0x6b47fa){return _0x6b47fa['setTags'](_0x415c43[_0x7700('0x47')][_0x7700('0x53')]||[]);}return null;})[_0x7700('0x23')](respondWithResult(_0x4c98cd,null))[_0x7700('0x43')](handleError(_0x4c98cd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 9413fa1..2cc10d1 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['moment','request-promise','path','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger'];(function(_0x49f49f,_0x4de1ec){var _0x3c2239=function(_0x3664cb){while(--_0x3664cb){_0x49f49f['push'](_0x49f49f['shift']());}};_0x3c2239(++_0x4de1ec);}(_0x5c00,0x17e));var _0x05c0=function(_0x2eb35d,_0x4a7a45){_0x2eb35d=_0x2eb35d-0x0;var _0x1f9854=_0x5c00[_0x2eb35d];return _0x1f9854;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0972=['util','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x0972,0x64));var _0x2097=function(_0x307ecb,_0x37799c){_0x307ecb=_0x307ecb-0x0;var _0x262709=_0x0972[_0x307ecb];return _0x262709;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x2097('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 272ccb3..15fb320 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b49=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x3f8ee1,_0xfb13de){var _0x5884fb=function(_0x4394b7){while(--_0x4394b7){_0x3f8ee1['push'](_0x3f8ee1['shift']());}};_0x5884fb(++_0xfb13de);}(_0x4b49,0x113));var _0x94b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b49[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x94b4('0x0'));var util=require(_0x94b4('0x1'));var moment=require(_0x94b4('0x2'));var BPromise=require(_0x94b4('0x3'));var rs=require(_0x94b4('0x4'));var fs=require('fs');var Redis=require(_0x94b4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x94b4('0x6'));var logger=require(_0x94b4('0x7'))(_0x94b4('0x8'));var config=require(_0x94b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x94b4('0xa')][_0x94b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4817a1,_0x1a5bad,_0x85559f){return new BPromise(function(_0x5084d6,_0x4c0304){return client[_0x94b4('0xc')](_0x4817a1,_0x85559f)[_0x94b4('0xd')](function(_0x153d6d){logger['info'](_0x94b4('0xe'),_0x1a5bad,_0x94b4('0xf'));logger[_0x94b4('0x10')](_0x94b4('0x11'),_0x1a5bad,_0x94b4('0xf'),JSON[_0x94b4('0x12')](_0x153d6d));if(_0x153d6d[_0x94b4('0x13')]){if(_0x153d6d[_0x94b4('0x13')][_0x94b4('0x14')]===0x1f4){logger[_0x94b4('0x13')](_0x94b4('0xe'),_0x1a5bad,_0x153d6d[_0x94b4('0x13')]['message']);return _0x4c0304(_0x153d6d[_0x94b4('0x13')][_0x94b4('0x15')]);}logger[_0x94b4('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1a5bad,_0x153d6d[_0x94b4('0x13')][_0x94b4('0x15')]);return _0x5084d6(_0x153d6d[_0x94b4('0x13')][_0x94b4('0x15')]);}else{logger[_0x94b4('0x16')](_0x94b4('0xe'),_0x1a5bad,_0x94b4('0xf'));_0x5084d6(_0x153d6d[_0x94b4('0x17')][_0x94b4('0x15')]);}})[_0x94b4('0x18')](function(_0x552aa0){logger['error'](_0x94b4('0xe'),_0x1a5bad,_0x552aa0);_0x4c0304(_0x552aa0);});});} \ No newline at end of file +var _0xb394=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring'];(function(_0x2a422e,_0x4bd4e2){var _0x2957dd=function(_0x407002){while(--_0x407002){_0x2a422e['push'](_0x2a422e['shift']());}};_0x2957dd(++_0x4bd4e2);}(_0xb394,0x12d));var _0x4b39=function(_0x201a09,_0x4aee19){_0x201a09=_0x201a09-0x0;var _0x295e3b=_0xb394[_0x201a09];return _0x295e3b;};'use strict';var _=require('lodash');var util=require(_0x4b39('0x0'));var moment=require(_0x4b39('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b39('0x2'));var fs=require('fs');var Redis=require(_0x4b39('0x3'));var db=require(_0x4b39('0x4'))['db'];var utils=require(_0x4b39('0x5'));var logger=require('../../config/logger')(_0x4b39('0x6'));var config=require(_0x4b39('0x7'));var jayson=require(_0x4b39('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x459f10,_0x36e384,_0x19984){return new BPromise(function(_0x1ac191,_0x557b30){return client['request'](_0x459f10,_0x19984)[_0x4b39('0x9')](function(_0x29d64b){logger[_0x4b39('0xa')](_0x4b39('0xb'),_0x36e384,_0x4b39('0xc'));logger['debug'](_0x4b39('0xd'),_0x36e384,'request\x20sent',JSON[_0x4b39('0xe')](_0x29d64b));if(_0x29d64b[_0x4b39('0xf')]){if(_0x29d64b['error'][_0x4b39('0x10')]===0x1f4){logger[_0x4b39('0xf')](_0x4b39('0xb'),_0x36e384,_0x29d64b[_0x4b39('0xf')]['message']);return _0x557b30(_0x29d64b[_0x4b39('0xf')]['message']);}logger[_0x4b39('0xf')](_0x4b39('0xb'),_0x36e384,_0x29d64b[_0x4b39('0xf')]['message']);return _0x1ac191(_0x29d64b['error'][_0x4b39('0x11')]);}else{logger['info'](_0x4b39('0xb'),_0x36e384,_0x4b39('0xc'));_0x1ac191(_0x29d64b[_0x4b39('0x12')][_0x4b39('0x11')]);}})['catch'](function(_0x347973){logger[_0x4b39('0xf')](_0x4b39('0xb'),_0x36e384,_0x347973);_0x557b30(_0x347973);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4686f18..b43946b 100644 --- a/server/api/intZendeskField/index.js +++ b/server/api/intZendeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x298c=['./intZendeskField.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd7433d,_0x487ecd){var _0x2456ad=function(_0x41d0ec){while(--_0x41d0ec){_0xd7433d['push'](_0xd7433d['shift']());}};_0x2456ad(++_0x487ecd);}(_0x298c,0x14c));var _0xc298=function(_0xeb7683,_0x10533a){_0xeb7683=_0xeb7683-0x0;var _0x3d795a=_0x298c[_0xeb7683];return _0x3d795a;};'use strict';var multer=require(_0xc298('0x0'));var util=require(_0xc298('0x1'));var path=require(_0xc298('0x2'));var timeout=require(_0xc298('0x3'));var express=require(_0xc298('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc298('0x5'));var interaction=require(_0xc298('0x6'));var config=require(_0xc298('0x7'));var controller=require(_0xc298('0x8'));router[_0xc298('0x9')]('/',auth[_0xc298('0xa')](),controller['index']);router[_0xc298('0x9')](_0xc298('0xb'),auth[_0xc298('0xa')](),controller[_0xc298('0xc')]);router['post']('/',auth[_0xc298('0xa')](),controller[_0xc298('0xd')]);router[_0xc298('0xe')](_0xc298('0xb'),auth[_0xc298('0xa')](),controller['update']);router[_0xc298('0xf')](_0xc298('0xb'),auth[_0xc298('0xa')](),controller[_0xc298('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa96e=['get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x279e26,_0x19eb82){var _0x549a6a=function(_0x563d1c){while(--_0x563d1c){_0x279e26['push'](_0x279e26['shift']());}};_0x549a6a(++_0x19eb82);}(_0xa96e,0x106));var _0xea96=function(_0x3e3a92,_0x5c5394){_0x3e3a92=_0x3e3a92-0x0;var _0x2b4f49=_0xa96e[_0x3e3a92];return _0x2b4f49;};'use strict';var multer=require(_0xea96('0x0'));var util=require(_0xea96('0x1'));var path=require(_0xea96('0x2'));var timeout=require(_0xea96('0x3'));var express=require(_0xea96('0x4'));var router=express[_0xea96('0x5')]();var fs_extra=require(_0xea96('0x6'));var auth=require(_0xea96('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xea96('0x8')]('/',auth[_0xea96('0x9')](),controller['index']);router[_0xea96('0x8')](_0xea96('0xa'),auth['isAuthenticated'](),controller[_0xea96('0xb')]);router['post']('/',auth[_0xea96('0x9')](),controller[_0xea96('0xc')]);router[_0xea96('0xd')](_0xea96('0xa'),auth[_0xea96('0x9')](),controller[_0xea96('0xe')]);router[_0xea96('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xea96('0x10')]);module[_0xea96('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index deb4f9e..eabf56e 100644 --- a/server/api/intZendeskField/intZendeskField.attributes.js +++ b/server/api/intZendeskField/intZendeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3431=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3431,0x1d0));var _0x1343=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x3431[_0x9c2427];return _0x51984f;};'use strict';var Sequelize=require(_0x1343('0x0'));module['exports']={'type':{'type':Sequelize[_0x1343('0x1')](_0x1343('0x2'),_0x1343('0x3'),_0x1343('0x4'),_0x1343('0x5'),_0x1343('0x6')),'defaultValue':_0x1343('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1343('0x7')]},'keyType':{'type':Sequelize[_0x1343('0x1')](_0x1343('0x2'),'variable',_0x1343('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1343('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1343('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1343('0x7')]}}; \ No newline at end of file +var _0x4a7d=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x2cdd14,_0x1f3c7c){var _0x180cf8=function(_0x1afe1f){while(--_0x1afe1f){_0x2cdd14['push'](_0x2cdd14['shift']());}};_0x180cf8(++_0x1f3c7c);}(_0x4a7d,0x64));var _0xd4a7=function(_0x2c947e,_0x251179){_0x2c947e=_0x2c947e-0x0;var _0x55f575=_0x4a7d[_0x2c947e];return _0x55f575;};'use strict';var Sequelize=require(_0xd4a7('0x0'));module[_0xd4a7('0x1')]={'type':{'type':Sequelize[_0xd4a7('0x2')](_0xd4a7('0x3'),_0xd4a7('0x4'),'customVariable',_0xd4a7('0x5'),_0xd4a7('0x6')),'defaultValue':_0xd4a7('0x3')},'content':{'type':Sequelize[_0xd4a7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xd4a7('0x4'),_0xd4a7('0x8'))},'keyContent':{'type':Sequelize[_0xd4a7('0x7')]},'idField':{'type':Sequelize[_0xd4a7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd4a7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd4a7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 156148d..aff3e7a 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a91=['../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','ZendeskField','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','include','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x19ae7a,_0x5d3b51){var _0x30d82e=function(_0x332ecc){while(--_0x332ecc){_0x19ae7a['push'](_0x19ae7a['shift']());}};_0x30d82e(++_0x5d3b51);}(_0x8a91,0x125));var _0x18a9=function(_0x172e18,_0x547708){_0x172e18=_0x172e18-0x0;var _0x56bfde=_0x8a91[_0x172e18];return _0x56bfde;};'use strict';var emlformat=require(_0x18a9('0x0'));var rimraf=require(_0x18a9('0x1'));var zipdir=require(_0x18a9('0x2'));var jsonpatch=require(_0x18a9('0x3'));var rp=require(_0x18a9('0x4'));var moment=require(_0x18a9('0x5'));var BPromise=require(_0x18a9('0x6'));var Mustache=require(_0x18a9('0x7'));var util=require(_0x18a9('0x8'));var path=require(_0x18a9('0x9'));var sox=require(_0x18a9('0xa'));var csv=require(_0x18a9('0xb'));var ejs=require(_0x18a9('0xc'));var fs=require('fs');var fs_extra=require(_0x18a9('0xd'));var _=require('lodash');var squel=require(_0x18a9('0xe'));var crypto=require('crypto');var jsforce=require(_0x18a9('0xf'));var deskjs=require(_0x18a9('0x10'));var toCsv=require(_0x18a9('0xb'));var querystring=require('querystring');var Papa=require(_0x18a9('0x11'));var Redis=require(_0x18a9('0x12'));var authService=require(_0x18a9('0x13'));var qs=require(_0x18a9('0x14'));var as=require(_0x18a9('0x15'));var hardwareService=require(_0x18a9('0x16'));var logger=require(_0x18a9('0x17'))(_0x18a9('0x18'));var utils=require(_0x18a9('0x19'));var config=require(_0x18a9('0x1a'));var licenseUtil=require(_0x18a9('0x1b'));var db=require(_0x18a9('0x1c'))['db'];function respondWithStatusCode(_0x2d29e4,_0x3c7fce){_0x3c7fce=_0x3c7fce||0xcc;return function(_0x2992a3){if(_0x2992a3){return _0x2d29e4['sendStatus'](_0x3c7fce);}return _0x2d29e4['status'](_0x3c7fce)['end']();};}function respondWithResult(_0x374cbe,_0xfc7083){_0xfc7083=_0xfc7083||0xc8;return function(_0x1f9281){if(_0x1f9281){return _0x374cbe[_0x18a9('0x1d')](_0xfc7083)[_0x18a9('0x1e')](_0x1f9281);}};}function respondWithFilteredResult(_0x2d0c62,_0x3c355e){return function(_0xe71734){if(_0xe71734){var _0x1ea861=typeof _0x3c355e[_0x18a9('0x1f')]==='undefined'&&typeof _0x3c355e[_0x18a9('0x20')]===_0x18a9('0x21');var _0x5dddd3=_0xe71734['count'];var _0x341359=_0x1ea861?0x0:_0x3c355e[_0x18a9('0x1f')];var _0x202900=_0x1ea861?_0xe71734[_0x18a9('0x22')]:_0x3c355e['offset']+_0x3c355e[_0x18a9('0x20')];var _0x35a145;if(_0x202900>=_0x5dddd3){_0x202900=_0x5dddd3;_0x35a145=0xc8;}else{_0x35a145=0xce;}_0x2d0c62[_0x18a9('0x1d')](_0x35a145);return _0x2d0c62[_0x18a9('0x23')](_0x18a9('0x24'),_0x341359+'-'+_0x202900+'/'+_0x5dddd3)[_0x18a9('0x1e')](_0xe71734);}return null;};}function patchUpdates(_0x13cd00){return function(_0x4df8d2){try{jsonpatch[_0x18a9('0x25')](_0x4df8d2,_0x13cd00,!![]);}catch(_0x2ce310){return BPromise[_0x18a9('0x26')](_0x2ce310);}return _0x4df8d2[_0x18a9('0x27')]();};}function saveUpdates(_0xd47ea9,_0x48d98c){return function(_0x43b39b){if(_0x43b39b){return _0x43b39b[_0x18a9('0x28')](_0xd47ea9)[_0x18a9('0x29')](function(_0x1cdb62){return _0x1cdb62;});}return null;};}function removeEntity(_0x3600fd,_0x27dc8f){return function(_0x30afe0){if(_0x30afe0){return _0x30afe0[_0x18a9('0x2a')]()[_0x18a9('0x29')](function(){_0x3600fd[_0x18a9('0x1d')](0xcc)[_0x18a9('0x2b')]();});}};}function handleEntityNotFound(_0x5a6df6,_0x3035ce){return function(_0x2a6aa0){if(!_0x2a6aa0){_0x5a6df6[_0x18a9('0x2c')](0x194);}return _0x2a6aa0;};}function handleError(_0x4f87c1,_0x486d3c){_0x486d3c=_0x486d3c||0x1f4;return function(_0x3c9f7d){logger[_0x18a9('0x2d')](_0x3c9f7d['stack']);if(_0x3c9f7d[_0x18a9('0x2e')]){delete _0x3c9f7d[_0x18a9('0x2e')];}_0x4f87c1[_0x18a9('0x1d')](_0x486d3c)[_0x18a9('0x2f')](_0x3c9f7d);};}exports[_0x18a9('0x30')]=function(_0x20d48b,_0x18ef3d){var _0x3e9e21={},_0x5888a7={},_0x10112c={'count':0x0,'rows':[]};var _0x399e62=_['map'](db[_0x18a9('0x31')][_0x18a9('0x32')],function(_0x553384){return{'name':_0x553384[_0x18a9('0x33')],'type':_0x553384['type'][_0x18a9('0x34')]};});_0x5888a7['model']=_[_0x18a9('0x35')](_0x399e62,'name');_0x5888a7[_0x18a9('0x36')]=_[_0x18a9('0x37')](_0x20d48b[_0x18a9('0x36')]);_0x5888a7['filters']=_['intersection'](_0x5888a7[_0x18a9('0x38')],_0x5888a7[_0x18a9('0x36')]);_0x3e9e21[_0x18a9('0x39')]=_[_0x18a9('0x3a')](_0x5888a7[_0x18a9('0x38')],qs[_0x18a9('0x3b')](_0x20d48b[_0x18a9('0x36')][_0x18a9('0x3b')]));_0x3e9e21[_0x18a9('0x39')]=_0x3e9e21[_0x18a9('0x39')][_0x18a9('0x3c')]?_0x3e9e21['attributes']:_0x5888a7['model'];if(!_0x20d48b[_0x18a9('0x36')][_0x18a9('0x3d')]('nolimit')){_0x3e9e21[_0x18a9('0x20')]=qs[_0x18a9('0x20')](_0x20d48b[_0x18a9('0x36')][_0x18a9('0x20')]);_0x3e9e21['offset']=qs[_0x18a9('0x1f')](_0x20d48b['query'][_0x18a9('0x1f')]);}_0x3e9e21[_0x18a9('0x3e')]=qs[_0x18a9('0x3f')](_0x20d48b[_0x18a9('0x36')]['sort']);_0x3e9e21[_0x18a9('0x40')]=qs[_0x18a9('0x41')](_[_0x18a9('0x42')](_0x20d48b['query'],_0x5888a7[_0x18a9('0x41')]),_0x399e62);if(_0x20d48b['query'][_0x18a9('0x43')]){_0x3e9e21[_0x18a9('0x40')]=_[_0x18a9('0x44')](_0x3e9e21[_0x18a9('0x40')],{'$or':_[_0x18a9('0x35')](_0x399e62,function(_0x1009d8){if(_0x1009d8[_0x18a9('0x45')]!=='VIRTUAL'){var _0x2a04fa={};_0x2a04fa[_0x1009d8[_0x18a9('0x2e')]]={'$like':'%'+_0x20d48b[_0x18a9('0x36')][_0x18a9('0x43')]+'%'};return _0x2a04fa;}})});}_0x3e9e21=_['merge']({},_0x3e9e21,_0x20d48b[_0x18a9('0x46')]);var _0x52b14e={'where':_0x3e9e21[_0x18a9('0x40')]};return db[_0x18a9('0x31')]['count'](_0x52b14e)[_0x18a9('0x29')](function(_0x4593b5){_0x10112c[_0x18a9('0x22')]=_0x4593b5;if(_0x20d48b[_0x18a9('0x36')]['includeAll']){_0x3e9e21[_0x18a9('0x47')]=[{'all':!![]}];}return db[_0x18a9('0x31')]['findAll'](_0x3e9e21);})[_0x18a9('0x29')](function(_0x28869e){_0x10112c[_0x18a9('0x48')]=_0x28869e;return _0x10112c;})[_0x18a9('0x29')](respondWithFilteredResult(_0x18ef3d,_0x3e9e21))[_0x18a9('0x49')](handleError(_0x18ef3d,null));};exports[_0x18a9('0x4a')]=function(_0xc99a16,_0x34f334){var _0x21e9c0={'raw':!![],'where':{'id':_0xc99a16[_0x18a9('0x4b')]['id']}},_0x5847bf={};_0x5847bf[_0x18a9('0x38')]=_[_0x18a9('0x37')](db[_0x18a9('0x31')][_0x18a9('0x32')]);_0x5847bf[_0x18a9('0x36')]=_[_0x18a9('0x37')](_0xc99a16['query']);_0x5847bf[_0x18a9('0x41')]=_[_0x18a9('0x3a')](_0x5847bf['model'],_0x5847bf[_0x18a9('0x36')]);_0x21e9c0['attributes']=_[_0x18a9('0x3a')](_0x5847bf['model'],qs['fields'](_0xc99a16[_0x18a9('0x36')][_0x18a9('0x3b')]));_0x21e9c0[_0x18a9('0x39')]=_0x21e9c0['attributes']['length']?_0x21e9c0[_0x18a9('0x39')]:_0x5847bf[_0x18a9('0x38')];if(_0xc99a16[_0x18a9('0x36')][_0x18a9('0x4c')]){_0x21e9c0['include']=[{'all':!![]}];}_0x21e9c0=_[_0x18a9('0x44')]({},_0x21e9c0,_0xc99a16[_0x18a9('0x46')]);return db[_0x18a9('0x31')]['find'](_0x21e9c0)[_0x18a9('0x29')](handleEntityNotFound(_0x34f334,null))['then'](respondWithResult(_0x34f334,null))['catch'](handleError(_0x34f334,null));};exports[_0x18a9('0x4d')]=function(_0x1b7b25,_0x205244){return db[_0x18a9('0x31')][_0x18a9('0x4d')](_0x1b7b25[_0x18a9('0x4e')],{})[_0x18a9('0x29')](respondWithResult(_0x205244,0xc9))[_0x18a9('0x49')](handleError(_0x205244,null));};exports[_0x18a9('0x28')]=function(_0x5413ba,_0x32fab1){if(_0x5413ba[_0x18a9('0x4e')]['id']){delete _0x5413ba[_0x18a9('0x4e')]['id'];}return db['ZendeskField'][_0x18a9('0x4f')]({'where':{'id':_0x5413ba[_0x18a9('0x4b')]['id']}})[_0x18a9('0x29')](handleEntityNotFound(_0x32fab1,null))['then'](saveUpdates(_0x5413ba[_0x18a9('0x4e')],null))[_0x18a9('0x29')](respondWithResult(_0x32fab1,null))[_0x18a9('0x49')](handleError(_0x32fab1,null));};exports[_0x18a9('0x2a')]=function(_0x4cb0f0,_0x5bb69d){return db[_0x18a9('0x31')][_0x18a9('0x4f')]({'where':{'id':_0x4cb0f0[_0x18a9('0x4b')]['id']}})[_0x18a9('0x29')](handleEntityNotFound(_0x5bb69d,null))[_0x18a9('0x29')](removeEntity(_0x5bb69d,null))['catch'](handleError(_0x5bb69d,null));}; \ No newline at end of file +var _0x0f10=['status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','ZendeskField','count','includeAll','findAll','rows','rawAttributes','include','find','body','catch','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x57ebed,_0xfac0ac){var _0x3a0874=function(_0x271491){while(--_0x271491){_0x57ebed['push'](_0x57ebed['shift']());}};_0x3a0874(++_0xfac0ac);}(_0x0f10,0xc3));var _0x00f1=function(_0x13ae83,_0xd33b76){_0x13ae83=_0x13ae83-0x0;var _0x5ca871=_0x0f10[_0x13ae83];return _0x5ca871;};'use strict';var emlformat=require(_0x00f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00f1('0x1'));var jsonpatch=require(_0x00f1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x00f1('0x3'));var Mustache=require(_0x00f1('0x4'));var util=require(_0x00f1('0x5'));var path=require('path');var sox=require(_0x00f1('0x6'));var csv=require(_0x00f1('0x7'));var ejs=require(_0x00f1('0x8'));var fs=require('fs');var fs_extra=require(_0x00f1('0x9'));var _=require(_0x00f1('0xa'));var squel=require(_0x00f1('0xb'));var crypto=require(_0x00f1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x00f1('0xd'));var toCsv=require(_0x00f1('0x7'));var querystring=require(_0x00f1('0xe'));var Papa=require(_0x00f1('0xf'));var Redis=require(_0x00f1('0x10'));var authService=require(_0x00f1('0x11'));var qs=require(_0x00f1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00f1('0x13'));var logger=require(_0x00f1('0x14'))(_0x00f1('0x15'));var utils=require(_0x00f1('0x16'));var config=require(_0x00f1('0x17'));var licenseUtil=require(_0x00f1('0x18'));var db=require(_0x00f1('0x19'))['db'];function respondWithStatusCode(_0x59f513,_0x47f8da){_0x47f8da=_0x47f8da||0xcc;return function(_0x64f5e8){if(_0x64f5e8){return _0x59f513[_0x00f1('0x1a')](_0x47f8da);}return _0x59f513[_0x00f1('0x1b')](_0x47f8da)['end']();};}function respondWithResult(_0x7064ec,_0x2bce47){_0x2bce47=_0x2bce47||0xc8;return function(_0x4ef4d8){if(_0x4ef4d8){return _0x7064ec[_0x00f1('0x1b')](_0x2bce47)[_0x00f1('0x1c')](_0x4ef4d8);}};}function respondWithFilteredResult(_0x5a51eb,_0x5ad501){return function(_0x4e974b){if(_0x4e974b){var _0x4fb779=typeof _0x5ad501[_0x00f1('0x1d')]===_0x00f1('0x1e')&&typeof _0x5ad501[_0x00f1('0x1f')]==='undefined';var _0xc93b51=_0x4e974b['count'];var _0xc7b7e2=_0x4fb779?0x0:_0x5ad501['offset'];var _0x65a262=_0x4fb779?_0x4e974b['count']:_0x5ad501[_0x00f1('0x1d')]+_0x5ad501['limit'];var _0x915a72;if(_0x65a262>=_0xc93b51){_0x65a262=_0xc93b51;_0x915a72=0xc8;}else{_0x915a72=0xce;}_0x5a51eb['status'](_0x915a72);return _0x5a51eb[_0x00f1('0x20')]('Content-Range',_0xc7b7e2+'-'+_0x65a262+'/'+_0xc93b51)[_0x00f1('0x1c')](_0x4e974b);}return null;};}function patchUpdates(_0x21f97e){return function(_0x1efc87){try{jsonpatch[_0x00f1('0x21')](_0x1efc87,_0x21f97e,!![]);}catch(_0x41a7ef){return BPromise[_0x00f1('0x22')](_0x41a7ef);}return _0x1efc87[_0x00f1('0x23')]();};}function saveUpdates(_0x59e1d5,_0x36d484){return function(_0x30e015){if(_0x30e015){return _0x30e015[_0x00f1('0x24')](_0x59e1d5)[_0x00f1('0x25')](function(_0x1604b7){return _0x1604b7;});}return null;};}function removeEntity(_0x5e8aa4,_0x558e44){return function(_0x1d90c4){if(_0x1d90c4){return _0x1d90c4[_0x00f1('0x26')]()[_0x00f1('0x25')](function(){_0x5e8aa4['status'](0xcc)[_0x00f1('0x27')]();});}};}function handleEntityNotFound(_0xff8b0e,_0x597f26){return function(_0x2adc2f){if(!_0x2adc2f){_0xff8b0e[_0x00f1('0x1a')](0x194);}return _0x2adc2f;};}function handleError(_0x5d85b9,_0x45bdb2){_0x45bdb2=_0x45bdb2||0x1f4;return function(_0x3318b4){logger[_0x00f1('0x28')](_0x3318b4[_0x00f1('0x29')]);if(_0x3318b4['name']){delete _0x3318b4[_0x00f1('0x2a')];}_0x5d85b9[_0x00f1('0x1b')](_0x45bdb2)[_0x00f1('0x2b')](_0x3318b4);};}exports['index']=function(_0x3687e9,_0x527f35){var _0x16d7c7={},_0x59b339={},_0x4648fd={'count':0x0,'rows':[]};var _0x1ef755=_[_0x00f1('0x2c')](db['ZendeskField']['rawAttributes'],function(_0x565992){return{'name':_0x565992['fieldName'],'type':_0x565992[_0x00f1('0x2d')][_0x00f1('0x2e')]};});_0x59b339['model']=_[_0x00f1('0x2c')](_0x1ef755,_0x00f1('0x2a'));_0x59b339[_0x00f1('0x2f')]=_[_0x00f1('0x30')](_0x3687e9[_0x00f1('0x2f')]);_0x59b339[_0x00f1('0x31')]=_['intersection'](_0x59b339['model'],_0x59b339[_0x00f1('0x2f')]);_0x16d7c7[_0x00f1('0x32')]=_[_0x00f1('0x33')](_0x59b339['model'],qs[_0x00f1('0x34')](_0x3687e9[_0x00f1('0x2f')][_0x00f1('0x34')]));_0x16d7c7[_0x00f1('0x32')]=_0x16d7c7[_0x00f1('0x32')][_0x00f1('0x35')]?_0x16d7c7[_0x00f1('0x32')]:_0x59b339[_0x00f1('0x36')];if(!_0x3687e9['query'][_0x00f1('0x37')](_0x00f1('0x38'))){_0x16d7c7[_0x00f1('0x1f')]=qs[_0x00f1('0x1f')](_0x3687e9[_0x00f1('0x2f')][_0x00f1('0x1f')]);_0x16d7c7['offset']=qs['offset'](_0x3687e9['query'][_0x00f1('0x1d')]);}_0x16d7c7[_0x00f1('0x39')]=qs[_0x00f1('0x3a')](_0x3687e9[_0x00f1('0x2f')][_0x00f1('0x3a')]);_0x16d7c7[_0x00f1('0x3b')]=qs[_0x00f1('0x31')](_['pick'](_0x3687e9[_0x00f1('0x2f')],_0x59b339[_0x00f1('0x31')]),_0x1ef755);if(_0x3687e9[_0x00f1('0x2f')][_0x00f1('0x3c')]){_0x16d7c7[_0x00f1('0x3b')]=_[_0x00f1('0x3d')](_0x16d7c7['where'],{'$or':_[_0x00f1('0x2c')](_0x1ef755,function(_0x3dbff0){if(_0x3dbff0[_0x00f1('0x2d')]!==_0x00f1('0x3e')){var _0x4634b8={};_0x4634b8[_0x3dbff0[_0x00f1('0x2a')]]={'$like':'%'+_0x3687e9[_0x00f1('0x2f')][_0x00f1('0x3c')]+'%'};return _0x4634b8;}})});}_0x16d7c7=_[_0x00f1('0x3d')]({},_0x16d7c7,_0x3687e9['options']);var _0x4ff9b7={'where':_0x16d7c7[_0x00f1('0x3b')]};return db[_0x00f1('0x3f')][_0x00f1('0x40')](_0x4ff9b7)[_0x00f1('0x25')](function(_0x6504f5){_0x4648fd[_0x00f1('0x40')]=_0x6504f5;if(_0x3687e9[_0x00f1('0x2f')][_0x00f1('0x41')]){_0x16d7c7['include']=[{'all':!![]}];}return db['ZendeskField'][_0x00f1('0x42')](_0x16d7c7);})[_0x00f1('0x25')](function(_0x9d46bd){_0x4648fd[_0x00f1('0x43')]=_0x9d46bd;return _0x4648fd;})[_0x00f1('0x25')](respondWithFilteredResult(_0x527f35,_0x16d7c7))['catch'](handleError(_0x527f35,null));};exports['show']=function(_0x50d72c,_0x5cb842){var _0x2691e6={'raw':!![],'where':{'id':_0x50d72c['params']['id']}},_0x4162c3={};_0x4162c3[_0x00f1('0x36')]=_['keys'](db[_0x00f1('0x3f')][_0x00f1('0x44')]);_0x4162c3[_0x00f1('0x2f')]=_[_0x00f1('0x30')](_0x50d72c['query']);_0x4162c3['filters']=_[_0x00f1('0x33')](_0x4162c3['model'],_0x4162c3[_0x00f1('0x2f')]);_0x2691e6[_0x00f1('0x32')]=_[_0x00f1('0x33')](_0x4162c3[_0x00f1('0x36')],qs[_0x00f1('0x34')](_0x50d72c[_0x00f1('0x2f')][_0x00f1('0x34')]));_0x2691e6['attributes']=_0x2691e6[_0x00f1('0x32')]['length']?_0x2691e6['attributes']:_0x4162c3[_0x00f1('0x36')];if(_0x50d72c[_0x00f1('0x2f')]['includeAll']){_0x2691e6[_0x00f1('0x45')]=[{'all':!![]}];}_0x2691e6=_[_0x00f1('0x3d')]({},_0x2691e6,_0x50d72c['options']);return db[_0x00f1('0x3f')][_0x00f1('0x46')](_0x2691e6)[_0x00f1('0x25')](handleEntityNotFound(_0x5cb842,null))['then'](respondWithResult(_0x5cb842,null))['catch'](handleError(_0x5cb842,null));};exports['create']=function(_0x2e67e4,_0x5df585){return db[_0x00f1('0x3f')]['create'](_0x2e67e4[_0x00f1('0x47')],{})['then'](respondWithResult(_0x5df585,0xc9))[_0x00f1('0x48')](handleError(_0x5df585,null));};exports[_0x00f1('0x24')]=function(_0x453860,_0x1076c0){if(_0x453860['body']['id']){delete _0x453860[_0x00f1('0x47')]['id'];}return db['ZendeskField'][_0x00f1('0x46')]({'where':{'id':_0x453860[_0x00f1('0x49')]['id']}})['then'](handleEntityNotFound(_0x1076c0,null))[_0x00f1('0x25')](saveUpdates(_0x453860['body'],null))[_0x00f1('0x25')](respondWithResult(_0x1076c0,null))['catch'](handleError(_0x1076c0,null));};exports[_0x00f1('0x26')]=function(_0x39dad4,_0x714028){return db['ZendeskField']['find']({'where':{'id':_0x39dad4[_0x00f1('0x49')]['id']}})[_0x00f1('0x25')](handleEntityNotFound(_0x714028,null))['then'](removeEntity(_0x714028,null))[_0x00f1('0x48')](handleError(_0x714028,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d9c81db..648181a 100644 --- a/server/api/intZendeskField/intZendeskField.model.js +++ b/server/api/intZendeskField/intZendeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf80d=['rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api','path'];(function(_0x32fa88,_0x28a2a1){var _0x28f14f=function(_0x2df26e){while(--_0x2df26e){_0x32fa88['push'](_0x32fa88['shift']());}};_0x28f14f(++_0x28a2a1);}(_0xf80d,0x133));var _0xdf80=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0xf80d[_0x260859];return _0x4b77f8;};'use strict';var _=require(_0xdf80('0x0'));var util=require(_0xdf80('0x1'));var logger=require(_0xdf80('0x2'))(_0xdf80('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf80('0x4'));var rimraf=require(_0xdf80('0x5'));var config=require(_0xdf80('0x6'));var attributes=require('./intZendeskField.attributes');module[_0xdf80('0x7')]=function(_0x3613ad,_0xc89503){return _0x3613ad[_0xdf80('0x8')](_0xdf80('0x9'),attributes,{'tableName':_0xdf80('0xa'),'paranoid':![],'indexes':[{'name':_0xdf80('0xb'),'fields':[_0xdf80('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc790=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports'];(function(_0x3e1c4c,_0x51737e){var _0x18f79b=function(_0x962abf){while(--_0x962abf){_0x3e1c4c['push'](_0x3e1c4c['shift']());}};_0x18f79b(++_0x51737e);}(_0xc790,0xe6));var _0x0c79=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xc790[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x0c79('0x0'));var util=require(_0x0c79('0x1'));var logger=require(_0x0c79('0x2'))(_0x0c79('0x3'));var moment=require('moment');var BPromise=require(_0x0c79('0x4'));var rp=require(_0x0c79('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c79('0x6'));var config=require(_0x0c79('0x7'));var attributes=require(_0x0c79('0x8'));module[_0x0c79('0x9')]=function(_0x2c1dce,_0x5a36bf){return _0x2c1dce[_0x0c79('0xa')](_0x0c79('0xb'),attributes,{'tableName':_0x0c79('0xc'),'paranoid':![],'indexes':[{'name':_0x0c79('0xd'),'fields':[_0x0c79('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 41b7ef8..5ab38cc 100644 --- a/server/api/intZendeskField/intZendeskField.rpc.js +++ b/server/api/intZendeskField/intZendeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffe7=['request','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4f998a,_0xfc05e){var _0x106d58=function(_0x37dee5){while(--_0x37dee5){_0x4f998a['push'](_0x4f998a['shift']());}};_0x106d58(++_0xfc05e);}(_0xffe7,0xda));var _0x7ffe=function(_0x2cc541,_0xbeecee){_0x2cc541=_0x2cc541-0x0;var _0x449a66=_0xffe7[_0x2cc541];return _0x449a66;};'use strict';var _=require(_0x7ffe('0x0'));var util=require('util');var moment=require(_0x7ffe('0x1'));var BPromise=require('bluebird');var rs=require(_0x7ffe('0x2'));var fs=require('fs');var Redis=require(_0x7ffe('0x3'));var db=require(_0x7ffe('0x4'))['db'];var utils=require(_0x7ffe('0x5'));var logger=require(_0x7ffe('0x6'))(_0x7ffe('0x7'));var config=require(_0x7ffe('0x8'));var jayson=require(_0x7ffe('0x9'));var client=jayson[_0x7ffe('0xa')][_0x7ffe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53c400,_0x5cc0d2,_0x488c77){return new BPromise(function(_0x4f2c38,_0x274123){return client[_0x7ffe('0xc')](_0x53c400,_0x488c77)['then'](function(_0x578f5f){logger[_0x7ffe('0xd')]('ZendeskField,\x20%s,\x20%s',_0x5cc0d2,_0x7ffe('0xe'));logger[_0x7ffe('0xf')](_0x7ffe('0x10'),_0x5cc0d2,_0x7ffe('0xe'),JSON[_0x7ffe('0x11')](_0x578f5f));if(_0x578f5f[_0x7ffe('0x12')]){if(_0x578f5f['error'][_0x7ffe('0x13')]===0x1f4){logger['error'](_0x7ffe('0x14'),_0x5cc0d2,_0x578f5f[_0x7ffe('0x12')][_0x7ffe('0x15')]);return _0x274123(_0x578f5f[_0x7ffe('0x12')][_0x7ffe('0x15')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x5cc0d2,_0x578f5f[_0x7ffe('0x12')][_0x7ffe('0x15')]);return _0x4f2c38(_0x578f5f['error']['message']);}else{logger[_0x7ffe('0xd')](_0x7ffe('0x14'),_0x5cc0d2,_0x7ffe('0xe'));_0x4f2c38(_0x578f5f['result'][_0x7ffe('0x15')]);}})[_0x7ffe('0x16')](function(_0x217432){logger[_0x7ffe('0x12')](_0x7ffe('0x14'),_0x5cc0d2,_0x217432);_0x274123(_0x217432);});});} \ No newline at end of file +var _0xc559=['http','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x38037e,_0x5c6006){var _0x1ff08d=function(_0x163941){while(--_0x163941){_0x38037e['push'](_0x38037e['shift']());}};_0x1ff08d(++_0x5c6006);}(_0xc559,0x96));var _0x9c55=function(_0x5a7547,_0x58c001){_0x5a7547=_0x5a7547-0x0;var _0x13b3e9=_0xc559[_0x5a7547];return _0x13b3e9;};'use strict';var _=require(_0x9c55('0x0'));var util=require(_0x9c55('0x1'));var moment=require(_0x9c55('0x2'));var BPromise=require(_0x9c55('0x3'));var rs=require(_0x9c55('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c55('0x5'))['db'];var utils=require(_0x9c55('0x6'));var logger=require(_0x9c55('0x7'))(_0x9c55('0x8'));var config=require('../../config/environment');var jayson=require(_0x9c55('0x9'));var client=jayson[_0x9c55('0xa')][_0x9c55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19ab62,_0x6d59c2,_0x433d72){return new BPromise(function(_0x48ea8d,_0x3e4cde){return client['request'](_0x19ab62,_0x433d72)['then'](function(_0x34f6a3){logger[_0x9c55('0xc')]('ZendeskField,\x20%s,\x20%s',_0x6d59c2,_0x9c55('0xd'));logger[_0x9c55('0xe')](_0x9c55('0xf'),_0x6d59c2,_0x9c55('0xd'),JSON[_0x9c55('0x10')](_0x34f6a3));if(_0x34f6a3[_0x9c55('0x11')]){if(_0x34f6a3[_0x9c55('0x11')][_0x9c55('0x12')]===0x1f4){logger[_0x9c55('0x11')](_0x9c55('0x13'),_0x6d59c2,_0x34f6a3[_0x9c55('0x11')]['message']);return _0x3e4cde(_0x34f6a3[_0x9c55('0x11')][_0x9c55('0x14')]);}logger['error'](_0x9c55('0x13'),_0x6d59c2,_0x34f6a3['error'][_0x9c55('0x14')]);return _0x48ea8d(_0x34f6a3[_0x9c55('0x11')][_0x9c55('0x14')]);}else{logger[_0x9c55('0xc')](_0x9c55('0x13'),_0x6d59c2,'request\x20sent');_0x48ea8d(_0x34f6a3[_0x9c55('0x15')][_0x9c55('0x14')]);}})[_0x9c55('0x16')](function(_0xf6021f){logger[_0x9c55('0x11')]('ZendeskField,\x20%s,\x20%s',_0x6d59c2,_0xf6021f);_0x3e4cde(_0xf6021f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 33d2bfa..e83b198 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cbd=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x1519c8,_0x4fc6a9){var _0xc209ae=function(_0x4b6d76){while(--_0x4b6d76){_0x1519c8['push'](_0x1519c8['shift']());}};_0xc209ae(++_0x4fc6a9);}(_0x9cbd,0x12c));var _0xd9cb=function(_0x492a76,_0x191af7){_0x492a76=_0x492a76-0x0;var _0x5005f3=_0x9cbd[_0x492a76];return _0x5005f3;};'use strict';var multer=require('multer');var util=require(_0xd9cb('0x0'));var path=require(_0xd9cb('0x1'));var timeout=require(_0xd9cb('0x2'));var express=require(_0xd9cb('0x3'));var router=express['Router']();var fs_extra=require(_0xd9cb('0x4'));var auth=require(_0xd9cb('0x5'));var interaction=require(_0xd9cb('0x6'));var config=require(_0xd9cb('0x7'));var controller=require(_0xd9cb('0x8'));router[_0xd9cb('0x9')]('/',auth['isAuthenticated'](),controller[_0xd9cb('0xa')]);router[_0xd9cb('0x9')]('/:id',auth[_0xd9cb('0xb')](),controller[_0xd9cb('0xc')]);router['get'](_0xd9cb('0xd'),auth['isAuthenticated'](),controller[_0xd9cb('0xe')]);router[_0xd9cb('0x9')](_0xd9cb('0xf'),auth[_0xd9cb('0xb')](),controller[_0xd9cb('0x10')]);router['post']('/',auth[_0xd9cb('0xb')](),controller[_0xd9cb('0x11')]);router['post'](_0xd9cb('0xd'),auth[_0xd9cb('0xb')](),controller[_0xd9cb('0x12')]);router[_0xd9cb('0x13')](_0xd9cb('0x14'),auth[_0xd9cb('0xb')](),controller[_0xd9cb('0x15')]);router[_0xd9cb('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xd9cb('0x17')]);module[_0xd9cb('0x18')]=router; \ No newline at end of file +var _0xfb2f=['getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','getConfigurations'];(function(_0x49c6f6,_0x4ddc08){var _0x5da755=function(_0x4cd5ff){while(--_0x4cd5ff){_0x49c6f6['push'](_0x49c6f6['shift']());}};_0x5da755(++_0x4ddc08);}(_0xfb2f,0x105));var _0xffb2=function(_0x2220ac,_0x182c05){_0x2220ac=_0x2220ac-0x0;var _0x3af802=_0xfb2f[_0x2220ac];return _0x3af802;};'use strict';var multer=require(_0xffb2('0x0'));var util=require(_0xffb2('0x1'));var path=require(_0xffb2('0x2'));var timeout=require(_0xffb2('0x3'));var express=require(_0xffb2('0x4'));var router=express[_0xffb2('0x5')]();var fs_extra=require(_0xffb2('0x6'));var auth=require(_0xffb2('0x7'));var interaction=require(_0xffb2('0x8'));var config=require(_0xffb2('0x9'));var controller=require('./intZohoAccount.controller');router[_0xffb2('0xa')]('/',auth[_0xffb2('0xb')](),controller['index']);router['get'](_0xffb2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xffb2('0xa')](_0xffb2('0xd'),auth[_0xffb2('0xb')](),controller[_0xffb2('0xe')]);router[_0xffb2('0xa')]('/:id/fields',auth[_0xffb2('0xb')](),controller[_0xffb2('0xf')]);router[_0xffb2('0x10')]('/',auth[_0xffb2('0xb')](),controller[_0xffb2('0x11')]);router[_0xffb2('0x10')](_0xffb2('0xd'),auth[_0xffb2('0xb')](),controller[_0xffb2('0x12')]);router[_0xffb2('0x13')](_0xffb2('0xc'),auth[_0xffb2('0xb')](),controller[_0xffb2('0x14')]);router[_0xffb2('0x15')](_0xffb2('0xc'),auth[_0xffb2('0xb')](),controller[_0xffb2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 8daad85..2f88dc6 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa75b=['sequelize','STRING'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa75b,0x170));var _0xba75=function(_0x494121,_0x239866){_0x494121=_0x494121-0x0;var _0x16191f=_0xa75b[_0x494121];return _0x16191f;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba75('0x1')]},'host':{'type':Sequelize[_0xba75('0x1')]},'zone':{'type':Sequelize[_0xba75('0x1')]},'clientId':{'type':Sequelize[_0xba75('0x1')]},'clientSecret':{'type':Sequelize[_0xba75('0x1')]},'serverUrl':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xba75('0x1')]},'refreshToken':{'type':Sequelize[_0xba75('0x1')]}}; \ No newline at end of file +var _0xda55=['STRING','sequelize','exports'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xda55,0x6d));var _0x5da5=function(_0x52e795,_0x49ffc4){_0x52e795=_0x52e795-0x0;var _0x4baca=_0xda55[_0x52e795];return _0x4baca;};'use strict';var Sequelize=require(_0x5da5('0x0'));module[_0x5da5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5da5('0x2')]},'zone':{'type':Sequelize[_0x5da5('0x2')]},'clientId':{'type':Sequelize[_0x5da5('0x2')]},'clientSecret':{'type':Sequelize[_0x5da5('0x2')]},'serverUrl':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x5da5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index e010bd0..4398511 100644 --- a/server/api/intZohoAccount/intZohoAccount.controller.js +++ b/server/api/intZohoAccount/intZohoAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x203a=['save','update','then','destroy','sendStatus','error','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','ZohoConfiguration','length','nolimit','findOne','channel','Descriptions','Subjects','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Result','Call_Start_Time','includes','api_name','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','offset','count','limit','set','apply','reject'];(function(_0x158417,_0x306ae6){var _0x50dd05=function(_0x305b47){while(--_0x305b47){_0x158417['push'](_0x158417['shift']());}};_0x50dd05(++_0x306ae6);}(_0x203a,0xdd));var _0xa203=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x203a[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xa203('0x0'));var rimraf=require(_0xa203('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa203('0x2'));var rp=require(_0xa203('0x3'));var moment=require(_0xa203('0x4'));var BPromise=require(_0xa203('0x5'));var Mustache=require(_0xa203('0x6'));var util=require(_0xa203('0x7'));var path=require(_0xa203('0x8'));var sox=require(_0xa203('0x9'));var csv=require(_0xa203('0xa'));var ejs=require(_0xa203('0xb'));var fs=require('fs');var fs_extra=require(_0xa203('0xc'));var _=require(_0xa203('0xd'));var squel=require(_0xa203('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa203('0xf'));var toCsv=require(_0xa203('0xa'));var querystring=require('querystring');var Papa=require(_0xa203('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa203('0x11'));var as=require(_0xa203('0x12'));var hardwareService=require(_0xa203('0x13'));var logger=require(_0xa203('0x14'))('api');var utils=require(_0xa203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa203('0x16'));var db=require(_0xa203('0x17'))['db'];var integrations=require(_0xa203('0x18'));function respondWithStatusCode(_0x4f7679,_0x46a3d9){_0x46a3d9=_0x46a3d9||0xcc;return function(_0x4eb7ad){if(_0x4eb7ad){return _0x4f7679['sendStatus'](_0x46a3d9);}return _0x4f7679[_0xa203('0x19')](_0x46a3d9)[_0xa203('0x1a')]();};}function respondWithResult(_0x3dfb0c,_0x1956cc){_0x1956cc=_0x1956cc||0xc8;return function(_0x10aebe){if(_0x10aebe){return _0x3dfb0c['status'](_0x1956cc)[_0xa203('0x1b')](_0x10aebe);}};}function respondWithFilteredResult(_0x15715d,_0x480f1a){return function(_0x4342e4){if(_0x4342e4){var _0x5df99e=typeof _0x480f1a['offset']===_0xa203('0x1c')&&typeof _0x480f1a['limit']===_0xa203('0x1c');var _0x167477=_0x4342e4['count'];var _0x5f599b=_0x5df99e?0x0:_0x480f1a[_0xa203('0x1d')];var _0x346ae9=_0x5df99e?_0x4342e4[_0xa203('0x1e')]:_0x480f1a[_0xa203('0x1d')]+_0x480f1a[_0xa203('0x1f')];var _0x57ee3b;if(_0x346ae9>=_0x167477){_0x346ae9=_0x167477;_0x57ee3b=0xc8;}else{_0x57ee3b=0xce;}_0x15715d[_0xa203('0x19')](_0x57ee3b);return _0x15715d[_0xa203('0x20')]('Content-Range',_0x5f599b+'-'+_0x346ae9+'/'+_0x167477)['json'](_0x4342e4);}return null;};}function patchUpdates(_0x5f0491){return function(_0x10daa4){try{jsonpatch[_0xa203('0x21')](_0x10daa4,_0x5f0491,!![]);}catch(_0x29b36e){return BPromise[_0xa203('0x22')](_0x29b36e);}return _0x10daa4[_0xa203('0x23')]();};}function saveUpdates(_0x3877b0,_0x57aab6){return function(_0x3902b5){if(_0x3902b5){return _0x3902b5[_0xa203('0x24')](_0x3877b0)[_0xa203('0x25')](function(_0x39b49f){return _0x39b49f;});}return null;};}function removeEntity(_0x35a7be,_0xee3a3a){return function(_0x3df9e0){if(_0x3df9e0){return _0x3df9e0[_0xa203('0x26')]()['then'](function(){_0x35a7be['status'](0xcc)[_0xa203('0x1a')]();});}};}function handleEntityNotFound(_0x5a2782,_0x3411c6){return function(_0x4db99b){if(!_0x4db99b){_0x5a2782[_0xa203('0x27')](0x194);}return _0x4db99b;};}function handleError(_0x5662df,_0x263510){_0x263510=_0x263510||0x1f4;return function(_0x426f5a){logger[_0xa203('0x28')](_0x426f5a['stack']);if(_0x426f5a[_0xa203('0x29')]){delete _0x426f5a[_0xa203('0x29')];}_0x5662df[_0xa203('0x19')](_0x263510)[_0xa203('0x2a')](_0x426f5a);};}exports[_0xa203('0x2b')]=function(_0xd3eea7,_0x3576c2){var _0x9edb89={},_0xd88bb2={},_0x574745={'count':0x0,'rows':[]};var _0x27a88a=_['map'](db[_0xa203('0x2c')][_0xa203('0x2d')],function(_0x28462f){return{'name':_0x28462f[_0xa203('0x2e')],'type':_0x28462f[_0xa203('0x2f')][_0xa203('0x30')]};});_0xd88bb2[_0xa203('0x31')]=_['map'](_0x27a88a,_0xa203('0x29'));_0xd88bb2[_0xa203('0x32')]=_[_0xa203('0x33')](_0xd3eea7['query']);_0xd88bb2[_0xa203('0x34')]=_['intersection'](_0xd88bb2['model'],_0xd88bb2[_0xa203('0x32')]);_0x9edb89[_0xa203('0x35')]=_[_0xa203('0x36')](_0xd88bb2[_0xa203('0x31')],qs[_0xa203('0x37')](_0xd3eea7['query'][_0xa203('0x37')]));_0x9edb89[_0xa203('0x35')]=_0x9edb89['attributes']['length']?_0x9edb89[_0xa203('0x35')]:_0xd88bb2[_0xa203('0x31')];if(!_0xd3eea7[_0xa203('0x32')][_0xa203('0x38')]('nolimit')){_0x9edb89[_0xa203('0x1f')]=qs['limit'](_0xd3eea7[_0xa203('0x32')][_0xa203('0x1f')]);_0x9edb89[_0xa203('0x1d')]=qs[_0xa203('0x1d')](_0xd3eea7[_0xa203('0x32')][_0xa203('0x1d')]);}_0x9edb89[_0xa203('0x39')]=qs[_0xa203('0x3a')](_0xd3eea7[_0xa203('0x32')][_0xa203('0x3a')]);_0x9edb89['where']=qs[_0xa203('0x34')](_[_0xa203('0x3b')](_0xd3eea7[_0xa203('0x32')],_0xd88bb2['filters']),_0x27a88a);if(_0xd3eea7[_0xa203('0x32')][_0xa203('0x3c')]){_0x9edb89[_0xa203('0x3d')]=_[_0xa203('0x3e')](_0x9edb89['where'],{'$or':_[_0xa203('0x3f')](_0x27a88a,function(_0x220ae1){if(_0x220ae1['type']!==_0xa203('0x40')){var _0x4a51b0={};_0x4a51b0[_0x220ae1['name']]={'$like':'%'+_0xd3eea7[_0xa203('0x32')][_0xa203('0x3c')]+'%'};return _0x4a51b0;}})});}_0x9edb89=_[_0xa203('0x3e')]({},_0x9edb89,_0xd3eea7[_0xa203('0x41')]);var _0xcba170={'where':_0x9edb89[_0xa203('0x3d')]};return db['ZohoAccount']['count'](_0xcba170)[_0xa203('0x25')](function(_0x477655){_0x574745['count']=_0x477655;if(_0xd3eea7['query'][_0xa203('0x42')]){_0x9edb89[_0xa203('0x43')]=[{'all':!![]}];}return db[_0xa203('0x2c')][_0xa203('0x44')](_0x9edb89);})['then'](function(_0xba155){_0x574745[_0xa203('0x45')]=_0xba155;return _0x574745;})[_0xa203('0x25')](respondWithFilteredResult(_0x3576c2,_0x9edb89))[_0xa203('0x46')](handleError(_0x3576c2,null));};exports['show']=function(_0x3445aa,_0x24809c){var _0x3587a2={'raw':![],'where':{'id':_0x3445aa[_0xa203('0x47')]['id']}},_0x208e23={};_0x208e23[_0xa203('0x31')]=_[_0xa203('0x33')](db[_0xa203('0x2c')][_0xa203('0x2d')]);_0x208e23[_0xa203('0x32')]=_[_0xa203('0x33')](_0x3445aa[_0xa203('0x32')]);_0x208e23[_0xa203('0x34')]=_[_0xa203('0x36')](_0x208e23[_0xa203('0x31')],_0x208e23[_0xa203('0x32')]);_0x3587a2[_0xa203('0x35')]=_['intersection'](_0x208e23[_0xa203('0x31')],qs[_0xa203('0x37')](_0x3445aa[_0xa203('0x32')][_0xa203('0x37')]));_0x3587a2[_0xa203('0x35')]=_0x3587a2[_0xa203('0x35')]['length']?_0x3587a2[_0xa203('0x35')]:_0x208e23[_0xa203('0x31')];if(_0x3445aa[_0xa203('0x32')][_0xa203('0x42')]){_0x3587a2[_0xa203('0x43')]=[{'all':!![]}];}_0x3587a2=_[_0xa203('0x3e')]({},_0x3587a2,_0x3445aa['options']);return db['ZohoAccount'][_0xa203('0x48')](_0x3587a2)[_0xa203('0x25')](handleEntityNotFound(_0x24809c,null))[_0xa203('0x25')](respondWithResult(_0x24809c,null))[_0xa203('0x46')](handleError(_0x24809c,null));};exports['create']=function(_0x3d6a9d,_0x4f52a1){return db[_0xa203('0x2c')][_0xa203('0x49')](_0x3d6a9d[_0xa203('0x4a')],{})[_0xa203('0x25')](respondWithResult(_0x4f52a1,0xc9))['catch'](handleError(_0x4f52a1,null));};exports[_0xa203('0x24')]=function(_0x1515d2,_0x5bd03c){if(_0x1515d2[_0xa203('0x4a')]['id']){delete _0x1515d2[_0xa203('0x4a')]['id'];}return db[_0xa203('0x2c')]['find']({'where':{'id':_0x1515d2[_0xa203('0x47')]['id']}})[_0xa203('0x25')](handleEntityNotFound(_0x5bd03c,null))['then'](saveUpdates(_0x1515d2['body'],null))[_0xa203('0x25')](respondWithResult(_0x5bd03c,null))[_0xa203('0x46')](handleError(_0x5bd03c,null));};exports[_0xa203('0x26')]=function(_0x54eec1,_0x44e5ce){return db[_0xa203('0x2c')][_0xa203('0x48')]({'where':{'id':_0x54eec1[_0xa203('0x47')]['id']}})['then'](handleEntityNotFound(_0x44e5ce,null))[_0xa203('0x25')](removeEntity(_0x44e5ce,null))[_0xa203('0x46')](handleError(_0x44e5ce,null));};exports[_0xa203('0x4b')]=function(_0x38d75c,_0x2877c0,_0x43333f){var _0x5ad859={};var _0xa37951={};var _0x307362;var _0x24ad41;return db['ZohoAccount']['findOne']({'where':{'id':_0x38d75c['params']['id']}})['then'](handleEntityNotFound(_0x2877c0,null))[_0xa203('0x25')](function(_0x510f92){if(_0x510f92){_0x307362=_0x510f92;_0xa37951[_0xa203('0x31')]=_[_0xa203('0x33')](db[_0xa203('0x4c')][_0xa203('0x2d')]);_0xa37951['query']=_[_0xa203('0x33')](_0x38d75c['query']);_0xa37951[_0xa203('0x34')]=_[_0xa203('0x36')](_0xa37951[_0xa203('0x31')],_0xa37951['query']);_0x5ad859[_0xa203('0x35')]=_['intersection'](_0xa37951[_0xa203('0x31')],qs['fields'](_0x38d75c[_0xa203('0x32')][_0xa203('0x37')]));_0x5ad859[_0xa203('0x35')]=_0x5ad859['attributes'][_0xa203('0x4d')]?_0x5ad859['attributes']:_0xa37951[_0xa203('0x31')];_0x5ad859[_0xa203('0x39')]=qs[_0xa203('0x3a')](_0x38d75c['query'][_0xa203('0x3a')]);_0x5ad859[_0xa203('0x3d')]=qs[_0xa203('0x34')](_[_0xa203('0x3b')](_0x38d75c[_0xa203('0x32')],_0xa37951['filters']));if(_0x38d75c[_0xa203('0x32')][_0xa203('0x3c')]){_0x5ad859[_0xa203('0x3d')]=_['merge'](_0x5ad859['where'],{'$or':_[_0xa203('0x3f')](_0x5ad859[_0xa203('0x35')],function(_0x3f503d){var _0x3c32d5={};_0x3c32d5[_0x3f503d]={'$like':'%'+_0x38d75c['query'][_0xa203('0x3c')]+'%'};return _0x3c32d5;})});}_0x5ad859=_[_0xa203('0x3e')]({},_0x5ad859,_0x38d75c['options']);return _0x307362[_0xa203('0x4b')](_0x5ad859);}})['then'](function(_0x1058de){if(_0x1058de){_0x24ad41=_0x1058de[_0xa203('0x4d')];if(!_0x38d75c[_0xa203('0x32')][_0xa203('0x38')](_0xa203('0x4e'))){_0x5ad859[_0xa203('0x1f')]=qs['limit'](_0x38d75c[_0xa203('0x32')][_0xa203('0x1f')]);_0x5ad859['offset']=qs[_0xa203('0x1d')](_0x38d75c[_0xa203('0x32')]['offset']);}return _0x307362[_0xa203('0x4b')](_0x5ad859);}})[_0xa203('0x25')](function(_0x374980){if(_0x374980){return _0x374980?{'count':_0x24ad41,'rows':_0x374980}:null;}})['then'](respondWithResult(_0x2877c0,null))[_0xa203('0x46')](handleError(_0x2877c0,null));};exports['addConfiguration']=function(_0x5911d4,_0x5c40a5,_0x120c62){if(_0x5911d4[_0xa203('0x4a')]['id']){delete _0x5911d4[_0xa203('0x4a')]['id'];}return db[_0xa203('0x2c')][_0xa203('0x4f')]({'where':{'id':_0x5911d4[_0xa203('0x47')]['id']}})[_0xa203('0x25')](handleEntityNotFound(_0x5c40a5,null))['then'](function(_0x490067){if(_0x490067){_0x5911d4[_0xa203('0x4a')]['AccountId']=_0x490067['id'];_0x5911d4[_0xa203('0x4a')]['Subjects']=integrations['getSubjects'](_0x5911d4[_0xa203('0x4a')][_0xa203('0x50')],_0x5911d4[_0xa203('0x4a')][_0xa203('0x2f')]);_0x5911d4[_0xa203('0x4a')][_0xa203('0x51')]=integrations['getDescriptions'](_0x5911d4[_0xa203('0x4a')][_0xa203('0x50')],_0x5911d4[_0xa203('0x4a')][_0xa203('0x2f')]);return db['ZohoConfiguration'][_0xa203('0x49')](_0x5911d4[_0xa203('0x4a')],{'include':[{'model':db['ZohoField'],'as':_0xa203('0x52')},{'model':db[_0xa203('0x53')],'as':_0xa203('0x51')}]});}return null;})[_0xa203('0x25')](respondWithResult(_0x5c40a5,null))[_0xa203('0x46')](handleError(_0x5c40a5,null));};function getAccessToken(_0x481fa3){return new Promise(function(_0x5289ee,_0x2c31cd){var _0x1cf2d1;switch(_0x481fa3[_0xa203('0x54')]){case'US':_0x1cf2d1=_0xa203('0x55');break;case'AU':_0x1cf2d1=_0xa203('0x56');break;case'EU':_0x1cf2d1=_0xa203('0x57');break;case'IN':_0x1cf2d1='https://accounts.zoho.in';break;case'CN':_0x1cf2d1='https://accounts.zoho.com.cn';break;default:_0x1cf2d1=_0xa203('0x57');break;}var _0x9e6ef2={'method':_0xa203('0x58'),'uri':_0x1cf2d1+_0xa203('0x59'),'qs':{'refresh_token':_0x481fa3[_0xa203('0x5a')],'client_id':_0x481fa3[_0xa203('0x5b')],'client_secret':_0x481fa3[_0xa203('0x5c')],'grant_type':_0xa203('0x5d')},'json':!![]};return rp(_0x9e6ef2)[_0xa203('0x25')](function(_0x2be8ac){if(_0x2be8ac['access_token']){_0x5289ee(_0x2be8ac[_0xa203('0x5e')]);}else{_0x2c31cd(_0xa203('0x5f'));}})[_0xa203('0x46')](function(_0x7eb02f){_0x2c31cd(_0x7eb02f);});});}exports[_0xa203('0x60')]=function(_0x5a2fe2,_0x8545c,_0x481f44){var _0x22798a,_0x5decac,_0x3800da,_0x22d82c,_0x4f37a0;return db[_0xa203('0x2c')]['findOne']({'where':{'id':_0x5a2fe2[_0xa203('0x47')]['id']},'attributes':['id',_0xa203('0x61'),_0xa203('0x54'),_0xa203('0x5b'),_0xa203('0x5c'),_0xa203('0x62'),_0xa203('0x63'),_0xa203('0x5a')]})[_0xa203('0x25')](handleEntityNotFound(_0x8545c,null))[_0xa203('0x25')](function(_0xb5c61e){_0x4f37a0=_0xb5c61e;_0x22798a=_0x4f37a0[_0xa203('0x61')];_0x5decac=_0x22798a===_0xa203('0x64')?'eu':_0xa203('0x65');_0x3800da=_0x4f37a0[_0xa203('0x62')];var _0xa76320=_0x3800da[_0xa203('0x66')](-0x1);if(_0xa76320==='/'||_0xa76320==='\x5c'||_0xa76320===':'){_0x3800da=_0x3800da[_0xa203('0x67')](0x0,_0x3800da['lastIndexOf'](_0xa76320));}if(!_0x4f37a0[_0xa203('0x5a')]){throw new Error(_0xa203('0x68'));}return getAccessToken(_0x4f37a0);})['then'](function(_0x47f9b4){if(_0x47f9b4){return rp({'method':'GET','uri':util[_0xa203('0x69')](_0xa203('0x6a'),_0x5decac),'qs':{'module':_0xa203('0x6b')},'headers':{'Authorization':_0xa203('0x6c')+_0x47f9b4},'json':!![]});}})['then'](function(_0x3059c7){if(_0x3059c7){if(_0x3059c7['response']&&_0x3059c7['response']['error']){throw new Error(_0x3059c7[_0xa203('0x6d')][_0xa203('0x28')][_0xa203('0x6e')]);}var _0x43db89=[];var _0x5b0f9e=[];var _0x14c982=[_0xa203('0x6f'),_0xa203('0x70'),'Description',_0xa203('0x71'),'Call_Duration',_0xa203('0x72'),_0xa203('0x73'),'Call_Type'];_0x5b0f9e=_['remove'](_0x3059c7[_0xa203('0x37')],function(_0x591048){return _0x14c982[_0xa203('0x74')](_0x591048[_0xa203('0x75')]);});for(var _0x5dca08=0x0;_0x5dca08<_0x5b0f9e[_0xa203('0x4d')];_0x5dca08++){if(_0x5b0f9e[_0x5dca08]['system_mandatory']===![]){_0x43db89[_0xa203('0x76')]({'id':_0x5b0f9e[_0x5dca08]['id'],'name':_0x5b0f9e[_0x5dca08]['display_label'],'custom':_0x5b0f9e[_0x5dca08][_0xa203('0x77')],'options':_0x5b0f9e[_0x5dca08][_0xa203('0x78')]===_0xa203('0x79')&&_0x5b0f9e[_0x5dca08]['pick_list_values']['length']>-0x1?_['map'](_0x5b0f9e[_0x5dca08][_0xa203('0x7a')],function(_0x20130f){return{'name':_0x20130f,'value':_0x20130f};}):[]});}}return{'count':_0x43db89[_0xa203('0x4d')],'rows':_0x43db89};}else{return{'count':0x0,'rows':[]};}})[_0xa203('0x25')](respondWithResult(_0x8545c,null))[_0xa203('0x46')](function(_0x3119a3){var _0x21de01=_0x5a2fe2[_0xa203('0x32')][_0xa203('0x7b')]?0x1f4:_0x3119a3[_0xa203('0x7c')]||0x1f4;logger['error'](_0xa203('0x7d'),_0xa203('0x60'),_0x21de01,JSON[_0xa203('0x7e')](_0x3119a3));delete _0x3119a3[_0xa203('0x29')];if(_0x21de01===0x191){_0x21de01=0x190;}_0x8545c[_0xa203('0x19')](_0x21de01)[_0xa203('0x2a')](_0x5a2fe2[_0xa203('0x32')][_0xa203('0x7b')]?{'message':_0xa203('0x7f'),'statusCode':_0x3119a3[_0xa203('0x7c')]}:_0x3119a3);});}; \ No newline at end of file +var _0xed80=['custom_field','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','then','includeAll','findAll','rows','show','params','include','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','getFields','host','clientSecret','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label'];(function(_0x2aa0ba,_0x33fcdc){var _0x49917a=function(_0x4a39c8){while(--_0x4a39c8){_0x2aa0ba['push'](_0x2aa0ba['shift']());}};_0x49917a(++_0x33fcdc);}(_0xed80,0x113));var _0x0ed8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xed80[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ed8('0x0'));var zipdir=require(_0x0ed8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ed8('0x2'));var moment=require(_0x0ed8('0x3'));var BPromise=require(_0x0ed8('0x4'));var Mustache=require(_0x0ed8('0x5'));var util=require(_0x0ed8('0x6'));var path=require(_0x0ed8('0x7'));var sox=require(_0x0ed8('0x8'));var csv=require('to-csv');var ejs=require(_0x0ed8('0x9'));var fs=require('fs');var fs_extra=require(_0x0ed8('0xa'));var _=require(_0x0ed8('0xb'));var squel=require(_0x0ed8('0xc'));var crypto=require(_0x0ed8('0xd'));var jsforce=require(_0x0ed8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ed8('0xf'));var querystring=require('querystring');var Papa=require(_0x0ed8('0x10'));var Redis=require(_0x0ed8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0ed8('0x12'));var as=require(_0x0ed8('0x13'));var hardwareService=require(_0x0ed8('0x14'));var logger=require(_0x0ed8('0x15'))(_0x0ed8('0x16'));var utils=require(_0x0ed8('0x17'));var config=require(_0x0ed8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ed8('0x19'))['db'];var integrations=require(_0x0ed8('0x1a'));function respondWithStatusCode(_0x55d704,_0x5ea93f){_0x5ea93f=_0x5ea93f||0xcc;return function(_0x464081){if(_0x464081){return _0x55d704['sendStatus'](_0x5ea93f);}return _0x55d704[_0x0ed8('0x1b')](_0x5ea93f)[_0x0ed8('0x1c')]();};}function respondWithResult(_0x28f8a6,_0x21be1e){_0x21be1e=_0x21be1e||0xc8;return function(_0x15cf57){if(_0x15cf57){return _0x28f8a6[_0x0ed8('0x1b')](_0x21be1e)[_0x0ed8('0x1d')](_0x15cf57);}};}function respondWithFilteredResult(_0x4a074a,_0x2c6241){return function(_0x587ffd){if(_0x587ffd){var _0x210186=typeof _0x2c6241['offset']==='undefined'&&typeof _0x2c6241[_0x0ed8('0x1e')]==='undefined';var _0x56dc1b=_0x587ffd[_0x0ed8('0x1f')];var _0x3419b7=_0x210186?0x0:_0x2c6241['offset'];var _0x507616=_0x210186?_0x587ffd['count']:_0x2c6241[_0x0ed8('0x20')]+_0x2c6241[_0x0ed8('0x1e')];var _0x8f9e1d;if(_0x507616>=_0x56dc1b){_0x507616=_0x56dc1b;_0x8f9e1d=0xc8;}else{_0x8f9e1d=0xce;}_0x4a074a[_0x0ed8('0x1b')](_0x8f9e1d);return _0x4a074a['set'](_0x0ed8('0x21'),_0x3419b7+'-'+_0x507616+'/'+_0x56dc1b)['json'](_0x587ffd);}return null;};}function patchUpdates(_0xd8d299){return function(_0x39cc29){try{jsonpatch[_0x0ed8('0x22')](_0x39cc29,_0xd8d299,!![]);}catch(_0x4fc379){return BPromise[_0x0ed8('0x23')](_0x4fc379);}return _0x39cc29[_0x0ed8('0x24')]();};}function saveUpdates(_0x2d81fc,_0x26cef4){return function(_0xc438e9){if(_0xc438e9){return _0xc438e9[_0x0ed8('0x25')](_0x2d81fc)['then'](function(_0x9d7c89){return _0x9d7c89;});}return null;};}function removeEntity(_0x20aca7,_0x452238){return function(_0x29a881){if(_0x29a881){return _0x29a881[_0x0ed8('0x26')]()['then'](function(){_0x20aca7[_0x0ed8('0x1b')](0xcc)[_0x0ed8('0x1c')]();});}};}function handleEntityNotFound(_0x4e1443,_0x3cf63f){return function(_0x2859ec){if(!_0x2859ec){_0x4e1443[_0x0ed8('0x27')](0x194);}return _0x2859ec;};}function handleError(_0x4f1563,_0x13925f){_0x13925f=_0x13925f||0x1f4;return function(_0x158cea){logger[_0x0ed8('0x28')](_0x158cea[_0x0ed8('0x29')]);if(_0x158cea[_0x0ed8('0x2a')]){delete _0x158cea[_0x0ed8('0x2a')];}_0x4f1563[_0x0ed8('0x1b')](_0x13925f)[_0x0ed8('0x2b')](_0x158cea);};}exports['index']=function(_0x527092,_0x785050){var _0x44ca8e={},_0xaa4399={},_0xfd5bfd={'count':0x0,'rows':[]};var _0x380c2c=_['map'](db[_0x0ed8('0x2c')][_0x0ed8('0x2d')],function(_0x60a44d){return{'name':_0x60a44d[_0x0ed8('0x2e')],'type':_0x60a44d[_0x0ed8('0x2f')][_0x0ed8('0x30')]};});_0xaa4399[_0x0ed8('0x31')]=_['map'](_0x380c2c,'name');_0xaa4399['query']=_[_0x0ed8('0x32')](_0x527092['query']);_0xaa4399[_0x0ed8('0x33')]=_[_0x0ed8('0x34')](_0xaa4399[_0x0ed8('0x31')],_0xaa4399[_0x0ed8('0x35')]);_0x44ca8e[_0x0ed8('0x36')]=_[_0x0ed8('0x34')](_0xaa4399[_0x0ed8('0x31')],qs[_0x0ed8('0x37')](_0x527092['query'][_0x0ed8('0x37')]));_0x44ca8e[_0x0ed8('0x36')]=_0x44ca8e['attributes'][_0x0ed8('0x38')]?_0x44ca8e[_0x0ed8('0x36')]:_0xaa4399['model'];if(!_0x527092[_0x0ed8('0x35')][_0x0ed8('0x39')](_0x0ed8('0x3a'))){_0x44ca8e[_0x0ed8('0x1e')]=qs['limit'](_0x527092[_0x0ed8('0x35')][_0x0ed8('0x1e')]);_0x44ca8e[_0x0ed8('0x20')]=qs[_0x0ed8('0x20')](_0x527092[_0x0ed8('0x35')][_0x0ed8('0x20')]);}_0x44ca8e['order']=qs[_0x0ed8('0x3b')](_0x527092['query']['sort']);_0x44ca8e[_0x0ed8('0x3c')]=qs[_0x0ed8('0x33')](_[_0x0ed8('0x3d')](_0x527092[_0x0ed8('0x35')],_0xaa4399[_0x0ed8('0x33')]),_0x380c2c);if(_0x527092[_0x0ed8('0x35')][_0x0ed8('0x3e')]){_0x44ca8e[_0x0ed8('0x3c')]=_['merge'](_0x44ca8e[_0x0ed8('0x3c')],{'$or':_[_0x0ed8('0x3f')](_0x380c2c,function(_0x42fcdc){if(_0x42fcdc[_0x0ed8('0x2f')]!==_0x0ed8('0x40')){var _0x2698f5={};_0x2698f5[_0x42fcdc[_0x0ed8('0x2a')]]={'$like':'%'+_0x527092[_0x0ed8('0x35')]['filter']+'%'};return _0x2698f5;}})});}_0x44ca8e=_[_0x0ed8('0x41')]({},_0x44ca8e,_0x527092[_0x0ed8('0x42')]);var _0x5649a6={'where':_0x44ca8e[_0x0ed8('0x3c')]};return db['ZohoAccount']['count'](_0x5649a6)[_0x0ed8('0x43')](function(_0x5c87d3){_0xfd5bfd[_0x0ed8('0x1f')]=_0x5c87d3;if(_0x527092[_0x0ed8('0x35')][_0x0ed8('0x44')]){_0x44ca8e['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x0ed8('0x45')](_0x44ca8e);})[_0x0ed8('0x43')](function(_0x53ff39){_0xfd5bfd[_0x0ed8('0x46')]=_0x53ff39;return _0xfd5bfd;})['then'](respondWithFilteredResult(_0x785050,_0x44ca8e))['catch'](handleError(_0x785050,null));};exports[_0x0ed8('0x47')]=function(_0x4ab384,_0x14c9eb){var _0x440c2a={'raw':![],'where':{'id':_0x4ab384[_0x0ed8('0x48')]['id']}},_0x5d2106={};_0x5d2106['model']=_[_0x0ed8('0x32')](db[_0x0ed8('0x2c')][_0x0ed8('0x2d')]);_0x5d2106[_0x0ed8('0x35')]=_['keys'](_0x4ab384['query']);_0x5d2106[_0x0ed8('0x33')]=_[_0x0ed8('0x34')](_0x5d2106[_0x0ed8('0x31')],_0x5d2106[_0x0ed8('0x35')]);_0x440c2a[_0x0ed8('0x36')]=_[_0x0ed8('0x34')](_0x5d2106[_0x0ed8('0x31')],qs[_0x0ed8('0x37')](_0x4ab384['query']['fields']));_0x440c2a['attributes']=_0x440c2a[_0x0ed8('0x36')][_0x0ed8('0x38')]?_0x440c2a[_0x0ed8('0x36')]:_0x5d2106['model'];if(_0x4ab384[_0x0ed8('0x35')][_0x0ed8('0x44')]){_0x440c2a[_0x0ed8('0x49')]=[{'all':!![]}];}_0x440c2a=_['merge']({},_0x440c2a,_0x4ab384[_0x0ed8('0x42')]);return db['ZohoAccount'][_0x0ed8('0x4a')](_0x440c2a)[_0x0ed8('0x43')](handleEntityNotFound(_0x14c9eb,null))['then'](respondWithResult(_0x14c9eb,null))[_0x0ed8('0x4b')](handleError(_0x14c9eb,null));};exports[_0x0ed8('0x4c')]=function(_0x5e455f,_0x1a85fc){return db[_0x0ed8('0x2c')]['create'](_0x5e455f[_0x0ed8('0x4d')],{})[_0x0ed8('0x43')](respondWithResult(_0x1a85fc,0xc9))[_0x0ed8('0x4b')](handleError(_0x1a85fc,null));};exports[_0x0ed8('0x25')]=function(_0x145932,_0x27c7ec){if(_0x145932[_0x0ed8('0x4d')]['id']){delete _0x145932['body']['id'];}return db[_0x0ed8('0x2c')][_0x0ed8('0x4a')]({'where':{'id':_0x145932[_0x0ed8('0x48')]['id']}})['then'](handleEntityNotFound(_0x27c7ec,null))['then'](saveUpdates(_0x145932[_0x0ed8('0x4d')],null))[_0x0ed8('0x43')](respondWithResult(_0x27c7ec,null))[_0x0ed8('0x4b')](handleError(_0x27c7ec,null));};exports[_0x0ed8('0x26')]=function(_0x83bc4b,_0x1a9f38){return db[_0x0ed8('0x2c')][_0x0ed8('0x4a')]({'where':{'id':_0x83bc4b[_0x0ed8('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a9f38,null))[_0x0ed8('0x43')](removeEntity(_0x1a9f38,null))[_0x0ed8('0x4b')](handleError(_0x1a9f38,null));};exports[_0x0ed8('0x4e')]=function(_0x532d9d,_0x5eba34,_0x1aebfc){var _0x553c29={};var _0x702932={};var _0x3aa753;var _0xb3eb95;return db[_0x0ed8('0x2c')][_0x0ed8('0x4f')]({'where':{'id':_0x532d9d['params']['id']}})[_0x0ed8('0x43')](handleEntityNotFound(_0x5eba34,null))['then'](function(_0x2102a8){if(_0x2102a8){_0x3aa753=_0x2102a8;_0x702932[_0x0ed8('0x31')]=_[_0x0ed8('0x32')](db[_0x0ed8('0x50')][_0x0ed8('0x2d')]);_0x702932[_0x0ed8('0x35')]=_[_0x0ed8('0x32')](_0x532d9d[_0x0ed8('0x35')]);_0x702932[_0x0ed8('0x33')]=_[_0x0ed8('0x34')](_0x702932['model'],_0x702932[_0x0ed8('0x35')]);_0x553c29['attributes']=_[_0x0ed8('0x34')](_0x702932[_0x0ed8('0x31')],qs[_0x0ed8('0x37')](_0x532d9d[_0x0ed8('0x35')][_0x0ed8('0x37')]));_0x553c29[_0x0ed8('0x36')]=_0x553c29[_0x0ed8('0x36')]['length']?_0x553c29[_0x0ed8('0x36')]:_0x702932[_0x0ed8('0x31')];_0x553c29['order']=qs[_0x0ed8('0x3b')](_0x532d9d[_0x0ed8('0x35')]['sort']);_0x553c29[_0x0ed8('0x3c')]=qs['filters'](_[_0x0ed8('0x3d')](_0x532d9d[_0x0ed8('0x35')],_0x702932[_0x0ed8('0x33')]));if(_0x532d9d[_0x0ed8('0x35')][_0x0ed8('0x3e')]){_0x553c29[_0x0ed8('0x3c')]=_[_0x0ed8('0x41')](_0x553c29['where'],{'$or':_[_0x0ed8('0x3f')](_0x553c29[_0x0ed8('0x36')],function(_0x2ac93c){var _0x3dd891={};_0x3dd891[_0x2ac93c]={'$like':'%'+_0x532d9d[_0x0ed8('0x35')][_0x0ed8('0x3e')]+'%'};return _0x3dd891;})});}_0x553c29=_[_0x0ed8('0x41')]({},_0x553c29,_0x532d9d['options']);return _0x3aa753[_0x0ed8('0x4e')](_0x553c29);}})['then'](function(_0x1c612f){if(_0x1c612f){_0xb3eb95=_0x1c612f[_0x0ed8('0x38')];if(!_0x532d9d[_0x0ed8('0x35')]['hasOwnProperty']('nolimit')){_0x553c29[_0x0ed8('0x1e')]=qs['limit'](_0x532d9d[_0x0ed8('0x35')][_0x0ed8('0x1e')]);_0x553c29['offset']=qs[_0x0ed8('0x20')](_0x532d9d[_0x0ed8('0x35')][_0x0ed8('0x20')]);}return _0x3aa753[_0x0ed8('0x4e')](_0x553c29);}})['then'](function(_0x3f625d){if(_0x3f625d){return _0x3f625d?{'count':_0xb3eb95,'rows':_0x3f625d}:null;}})['then'](respondWithResult(_0x5eba34,null))[_0x0ed8('0x4b')](handleError(_0x5eba34,null));};exports[_0x0ed8('0x51')]=function(_0x1125eb,_0xbdefa0,_0x23d79d){if(_0x1125eb[_0x0ed8('0x4d')]['id']){delete _0x1125eb[_0x0ed8('0x4d')]['id'];}return db['ZohoAccount'][_0x0ed8('0x4f')]({'where':{'id':_0x1125eb['params']['id']}})[_0x0ed8('0x43')](handleEntityNotFound(_0xbdefa0,null))[_0x0ed8('0x43')](function(_0xd0896d){if(_0xd0896d){_0x1125eb['body']['AccountId']=_0xd0896d['id'];_0x1125eb['body'][_0x0ed8('0x52')]=integrations[_0x0ed8('0x53')](_0x1125eb[_0x0ed8('0x4d')][_0x0ed8('0x54')],_0x1125eb[_0x0ed8('0x4d')][_0x0ed8('0x2f')]);_0x1125eb[_0x0ed8('0x4d')][_0x0ed8('0x55')]=integrations[_0x0ed8('0x56')](_0x1125eb['body'][_0x0ed8('0x54')],_0x1125eb[_0x0ed8('0x4d')][_0x0ed8('0x2f')]);return db[_0x0ed8('0x50')][_0x0ed8('0x4c')](_0x1125eb[_0x0ed8('0x4d')],{'include':[{'model':db[_0x0ed8('0x57')],'as':_0x0ed8('0x52')},{'model':db[_0x0ed8('0x57')],'as':_0x0ed8('0x55')}]});}return null;})[_0x0ed8('0x43')](respondWithResult(_0xbdefa0,null))['catch'](handleError(_0xbdefa0,null));};function getAccessToken(_0x180335){return new Promise(function(_0x43e5ea,_0x5ab330){var _0xd47d8b;switch(_0x180335[_0x0ed8('0x58')]){case'US':_0xd47d8b=_0x0ed8('0x59');break;case'AU':_0xd47d8b=_0x0ed8('0x5a');break;case'EU':_0xd47d8b=_0x0ed8('0x5b');break;case'IN':_0xd47d8b=_0x0ed8('0x5c');break;case'CN':_0xd47d8b=_0x0ed8('0x5d');break;default:_0xd47d8b=_0x0ed8('0x5b');break;}var _0x29ddea={'method':_0x0ed8('0x5e'),'uri':_0xd47d8b+_0x0ed8('0x5f'),'qs':{'refresh_token':_0x180335[_0x0ed8('0x60')],'client_id':_0x180335[_0x0ed8('0x61')],'client_secret':_0x180335['clientSecret'],'grant_type':_0x0ed8('0x62')},'json':!![]};return rp(_0x29ddea)['then'](function(_0x53ac20){if(_0x53ac20[_0x0ed8('0x63')]){_0x43e5ea(_0x53ac20[_0x0ed8('0x63')]);}else{_0x5ab330('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x0ed8('0x4b')](function(_0x1d6772){_0x5ab330(_0x1d6772);});});}exports[_0x0ed8('0x64')]=function(_0x50390f,_0x852b46,_0x3b7359){var _0x22ea75,_0x4aaf4b,_0x1cda0f,_0x487992,_0x1bb27f;return db['ZohoAccount'][_0x0ed8('0x4f')]({'where':{'id':_0x50390f[_0x0ed8('0x48')]['id']},'attributes':['id',_0x0ed8('0x65'),_0x0ed8('0x58'),_0x0ed8('0x61'),_0x0ed8('0x66'),_0x0ed8('0x67'),_0x0ed8('0x68'),_0x0ed8('0x60')]})[_0x0ed8('0x43')](handleEntityNotFound(_0x852b46,null))[_0x0ed8('0x43')](function(_0x4ae81c){_0x1bb27f=_0x4ae81c;_0x22ea75=_0x1bb27f[_0x0ed8('0x65')];_0x4aaf4b=_0x22ea75==='zoho.eu'?'eu':_0x0ed8('0x69');_0x1cda0f=_0x1bb27f['serverUrl'];var _0x14f8f5=_0x1cda0f[_0x0ed8('0x6a')](-0x1);if(_0x14f8f5==='/'||_0x14f8f5==='\x5c'||_0x14f8f5===':'){_0x1cda0f=_0x1cda0f[_0x0ed8('0x6b')](0x0,_0x1cda0f[_0x0ed8('0x6c')](_0x14f8f5));}if(!_0x1bb27f['refreshToken']){throw new Error(_0x0ed8('0x6d'));}return getAccessToken(_0x1bb27f);})['then'](function(_0x1a3758){if(_0x1a3758){return rp({'method':_0x0ed8('0x6e'),'uri':util['format'](_0x0ed8('0x6f'),_0x4aaf4b),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1a3758},'json':!![]});}})[_0x0ed8('0x43')](function(_0x8f8fc5){if(_0x8f8fc5){if(_0x8f8fc5[_0x0ed8('0x70')]&&_0x8f8fc5['response'][_0x0ed8('0x28')]){throw new Error(_0x8f8fc5[_0x0ed8('0x70')]['error']['message']);}var _0x56a081=[];var _0x2b9692=[];var _0x418990=[_0x0ed8('0x71'),_0x0ed8('0x72'),_0x0ed8('0x73'),_0x0ed8('0x74'),_0x0ed8('0x75'),_0x0ed8('0x76'),_0x0ed8('0x77'),_0x0ed8('0x78')];_0x2b9692=_[_0x0ed8('0x79')](_0x8f8fc5[_0x0ed8('0x37')],function(_0x49f0bd){return _0x418990[_0x0ed8('0x7a')](_0x49f0bd[_0x0ed8('0x7b')]);});for(var _0x1d4b71=0x0;_0x1d4b71<_0x2b9692['length'];_0x1d4b71++){if(_0x2b9692[_0x1d4b71][_0x0ed8('0x7c')]===![]){_0x56a081[_0x0ed8('0x7d')]({'id':_0x2b9692[_0x1d4b71]['id'],'name':_0x2b9692[_0x1d4b71][_0x0ed8('0x7e')],'custom':_0x2b9692[_0x1d4b71][_0x0ed8('0x7f')],'options':_0x2b9692[_0x1d4b71]['data_type']==='picklist'&&_0x2b9692[_0x1d4b71][_0x0ed8('0x80')][_0x0ed8('0x38')]>-0x1?_[_0x0ed8('0x3f')](_0x2b9692[_0x1d4b71][_0x0ed8('0x80')],function(_0x3fb4e8){return{'name':_0x3fb4e8,'value':_0x3fb4e8};}):[]});}}return{'count':_0x56a081['length'],'rows':_0x56a081};}else{return{'count':0x0,'rows':[]};}})[_0x0ed8('0x43')](respondWithResult(_0x852b46,null))[_0x0ed8('0x4b')](function(_0xf15b49){var _0x3d4213=_0x50390f[_0x0ed8('0x35')][_0x0ed8('0x81')]?0x1f4:_0xf15b49[_0x0ed8('0x82')]||0x1f4;logger['error'](_0x0ed8('0x83'),'getFields',_0x3d4213,JSON[_0x0ed8('0x84')](_0xf15b49));delete _0xf15b49[_0x0ed8('0x2a')];if(_0x3d4213===0x191){_0x3d4213=0x190;}_0x852b46[_0x0ed8('0x1b')](_0x3d4213)[_0x0ed8('0x2b')](_0x50390f['query'][_0x0ed8('0x81')]?{'message':_0x0ed8('0x85'),'statusCode':_0xf15b49['statusCode']}:_0xf15b49);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2f3acc0..65be4e9 100644 --- a/server/api/intZohoAccount/intZohoAccount.model.js +++ b/server/api/intZohoAccount/intZohoAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8555=['https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','authorization_code','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com'];(function(_0x3cf1ad,_0x5a153d){var _0x481ca3=function(_0x4db9e8){while(--_0x4db9e8){_0x3cf1ad['push'](_0x3cf1ad['shift']());}};_0x481ca3(++_0x5a153d);}(_0x8555,0xc1));var _0x5855=function(_0x3bd831,_0x53602a){_0x3bd831=_0x3bd831-0x0;var _0x41846d=_0x8555[_0x3bd831];return _0x41846d;};'use strict';var _=require(_0x5855('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5855('0x1'));var moment=require(_0x5855('0x2'));var BPromise=require(_0x5855('0x3'));var rp=require(_0x5855('0x4'));var fs=require('fs');var path=require(_0x5855('0x5'));var rimraf=require(_0x5855('0x6'));var config=require(_0x5855('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x5855('0x8'));module[_0x5855('0x9')]=function(_0x207894,_0x4e5b8e){return _0x207894[_0x5855('0xa')]('ZohoAccount',attributes,{'tableName':_0x5855('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x221dc4,_0x51abfe,_0x31a716){if(_0x221dc4[_0x5855('0xc')](_0x5855('0xd'))||_0x221dc4[_0x5855('0xc')](_0x5855('0xe'))||_0x221dc4[_0x5855('0xc')](_0x5855('0xf'))||_0x221dc4[_0x5855('0xc')](_0x5855('0x10'))||_0x221dc4[_0x5855('0xc')](_0x5855('0x11'))||_0x221dc4[_0x5855('0xc')](_0x5855('0x12'))){var _0x55c14d,_0x21ff05;_0x55c14d=_0x221dc4[_0x5855('0xe')];var _0x199c34=_0x55c14d[_0x5855('0x13')](-0x1);if(_0x199c34==='/'||_0x199c34==='\x5c'||_0x199c34===':'){_0x55c14d=_0x55c14d[_0x5855('0x14')](0x0,_0x55c14d['lastIndexOf'](_0x199c34));}switch(_0x221dc4['zone']){case'US':_0x21ff05=_0x5855('0x15');break;case'AU':_0x21ff05=_0x5855('0x16');break;case'IN':_0x21ff05=_0x5855('0x17');break;case'CN':_0x21ff05=_0x5855('0x18');break;default:_0x21ff05=_0x5855('0x19');break;}var _0x246f46={'method':_0x5855('0x1a'),'uri':_0x21ff05+_0x5855('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x221dc4[_0x5855('0xf')],'client_secret':_0x221dc4[_0x5855('0x10')],'redirect_uri':_0x221dc4[_0x5855('0xe')],'code':_0x221dc4[_0x5855('0x11')]},'headers':{'Content-Type':_0x5855('0x1c')}};return rp(_0x246f46)[_0x5855('0x1d')](function(_0x32639d){var _0x5b30f4=JSON[_0x5855('0x1e')](_0x32639d);if(_0x5b30f4[_0x5855('0x1f')]){_0x221dc4[_0x5855('0x20')]=_0x5b30f4[_0x5855('0x1f')];logger[_0x5855('0x21')](util['format'](_0x5855('0x22'),_0x221dc4[_0x5855('0x23')],_0x221dc4['id']));}else{logger[_0x5855('0x24')](util[_0x5855('0x25')](_0x5855('0x26'),_0x221dc4[_0x5855('0x23')],_0x221dc4['id']),util[_0x5855('0x27')](_0x5b30f4,{'showHidden':![],'depth':null}));}return _0x31a716(null,_0x51abfe);})[_0x5855('0x28')](function(_0x5ec811){logger[_0x5855('0x24')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x221dc4['name'],_0x221dc4['id']),util[_0x5855('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x31a716(_0x5ec811);});}else{return _0x31a716(null,_0x51abfe);}},'beforeUpdate':function(_0x4e2737,_0xf880d0,_0x422147){if(_0x4e2737['changed']('zone')||_0x4e2737[_0x5855('0xc')]('serverUrl')||_0x4e2737[_0x5855('0xc')]('clientId')||_0x4e2737[_0x5855('0xc')](_0x5855('0x10'))||_0x4e2737[_0x5855('0xc')](_0x5855('0x11'))||_0x4e2737[_0x5855('0xc')](_0x5855('0x12'))){var _0x15a730,_0x271f63;_0x15a730=_0x4e2737[_0x5855('0xe')];var _0x582735=_0x15a730['slice'](-0x1);if(_0x582735==='/'||_0x582735==='\x5c'||_0x582735===':'){_0x15a730=_0x15a730[_0x5855('0x14')](0x0,_0x15a730[_0x5855('0x29')](_0x582735));}switch(_0x4e2737[_0x5855('0xd')]){case'US':_0x271f63=_0x5855('0x15');break;case'AU':_0x271f63=_0x5855('0x16');break;case'IN':_0x271f63=_0x5855('0x17');break;case'CN':_0x271f63=_0x5855('0x18');break;default:_0x271f63=_0x5855('0x19');break;}var _0x457749={'method':'POST','uri':_0x271f63+_0x5855('0x1b'),'form':{'grant_type':_0x5855('0x2a'),'client_id':_0x4e2737[_0x5855('0xf')],'client_secret':_0x4e2737[_0x5855('0x10')],'redirect_uri':_0x4e2737[_0x5855('0xe')],'code':_0x4e2737[_0x5855('0x11')]},'headers':{'Content-Type':_0x5855('0x1c')}};return rp(_0x457749)[_0x5855('0x1d')](function(_0x39cdb5){var _0x4c1e20=JSON['parse'](_0x39cdb5);if(_0x4c1e20[_0x5855('0x1f')]){_0x4e2737['refreshToken']=_0x4c1e20[_0x5855('0x1f')];logger['info'](util['format'](_0x5855('0x22'),_0x4e2737[_0x5855('0x23')],_0x4e2737['id']));}else{logger[_0x5855('0x24')](util[_0x5855('0x25')](_0x5855('0x26'),_0x4e2737[_0x5855('0x23')],_0x4e2737['id']),util[_0x5855('0x27')](_0x4c1e20,{'showHidden':![],'depth':null}));}return _0x422147(null,_0xf880d0);})[_0x5855('0x28')](function(_0x3cc2a9){logger['error'](util[_0x5855('0x25')](_0x5855('0x26'),_0x4e2737[_0x5855('0x23')],_0x4e2737['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x422147(_0x3cc2a9);});}else{return _0x422147(null,_0xf880d0);}}}});}; \ No newline at end of file +var _0x345a=['slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','clientId','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','/oauth/v2/token','then','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','changed','clientSecret','code','host'];(function(_0x3020da,_0xcd9ba6){var _0x3cafa0=function(_0x1ebbac){while(--_0x1ebbac){_0x3020da['push'](_0x3020da['shift']());}};_0x3cafa0(++_0xcd9ba6);}(_0x345a,0xc0));var _0xa345=function(_0x55cad8,_0x23af6e){_0x55cad8=_0x55cad8-0x0;var _0x43bdfa=_0x345a[_0x55cad8];return _0x43bdfa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa345('0x0'))(_0xa345('0x1'));var moment=require('moment');var BPromise=require(_0xa345('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa345('0x3'));var rimraf=require(_0xa345('0x4'));var config=require(_0xa345('0x5'));var attributes=require(_0xa345('0x6'));var integrations=require(_0xa345('0x7'));module[_0xa345('0x8')]=function(_0x8b5ff9,_0x32a2b2){return _0x8b5ff9[_0xa345('0x9')](_0xa345('0xa'),attributes,{'tableName':_0xa345('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15c7ca,_0x2c65ee,_0x2db3f7){if(_0x15c7ca['changed'](_0xa345('0xc'))||_0x15c7ca['changed'](_0xa345('0xd'))||_0x15c7ca[_0xa345('0xe')]('clientId')||_0x15c7ca[_0xa345('0xe')](_0xa345('0xf'))||_0x15c7ca['changed'](_0xa345('0x10'))||_0x15c7ca[_0xa345('0xe')](_0xa345('0x11'))){var _0x7b4a77,_0x7b494c;_0x7b4a77=_0x15c7ca['serverUrl'];var _0x22d3ae=_0x7b4a77[_0xa345('0x12')](-0x1);if(_0x22d3ae==='/'||_0x22d3ae==='\x5c'||_0x22d3ae===':'){_0x7b4a77=_0x7b4a77[_0xa345('0x13')](0x0,_0x7b4a77[_0xa345('0x14')](_0x22d3ae));}switch(_0x15c7ca['zone']){case'US':_0x7b494c=_0xa345('0x15');break;case'AU':_0x7b494c=_0xa345('0x16');break;case'IN':_0x7b494c=_0xa345('0x17');break;case'CN':_0x7b494c=_0xa345('0x18');break;default:_0x7b494c=_0xa345('0x19');break;}var _0x514e0a={'method':'POST','uri':_0x7b494c+'/oauth/v2/token','form':{'grant_type':_0xa345('0x1a'),'client_id':_0x15c7ca[_0xa345('0x1b')],'client_secret':_0x15c7ca[_0xa345('0xf')],'redirect_uri':_0x15c7ca[_0xa345('0xd')],'code':_0x15c7ca['code']},'headers':{'Content-Type':_0xa345('0x1c')}};return rp(_0x514e0a)['then'](function(_0x2341f9){var _0x5af56e=JSON[_0xa345('0x1d')](_0x2341f9);if(_0x5af56e[_0xa345('0x1e')]){_0x15c7ca[_0xa345('0x1f')]=_0x5af56e['refresh_token'];logger[_0xa345('0x20')](util[_0xa345('0x21')](_0xa345('0x22'),_0x15c7ca['name'],_0x15c7ca['id']));}else{logger['error'](util[_0xa345('0x21')](_0xa345('0x23'),_0x15c7ca[_0xa345('0x24')],_0x15c7ca['id']),util[_0xa345('0x25')](_0x5af56e,{'showHidden':![],'depth':null}));}return _0x2db3f7(null,_0x2c65ee);})[_0xa345('0x26')](function(_0x32889e){logger[_0xa345('0x27')](util['format'](_0xa345('0x23'),_0x15c7ca['name'],_0x15c7ca['id']),util[_0xa345('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2db3f7(_0x32889e);});}else{return _0x2db3f7(null,_0x2c65ee);}},'beforeUpdate':function(_0xbeace7,_0x8ad4d8,_0x4fd9d3){if(_0xbeace7[_0xa345('0xe')](_0xa345('0xc'))||_0xbeace7[_0xa345('0xe')](_0xa345('0xd'))||_0xbeace7[_0xa345('0xe')]('clientId')||_0xbeace7['changed'](_0xa345('0xf'))||_0xbeace7[_0xa345('0xe')](_0xa345('0x10'))||_0xbeace7[_0xa345('0xe')](_0xa345('0x11'))){var _0xee4e84,_0x55a2c4;_0xee4e84=_0xbeace7[_0xa345('0xd')];var _0x397b93=_0xee4e84[_0xa345('0x12')](-0x1);if(_0x397b93==='/'||_0x397b93==='\x5c'||_0x397b93===':'){_0xee4e84=_0xee4e84[_0xa345('0x13')](0x0,_0xee4e84['lastIndexOf'](_0x397b93));}switch(_0xbeace7[_0xa345('0xc')]){case'US':_0x55a2c4=_0xa345('0x15');break;case'AU':_0x55a2c4='https://accounts.zoho.com.au';break;case'IN':_0x55a2c4=_0xa345('0x17');break;case'CN':_0x55a2c4=_0xa345('0x18');break;default:_0x55a2c4=_0xa345('0x19');break;}var _0x42da51={'method':'POST','uri':_0x55a2c4+_0xa345('0x28'),'form':{'grant_type':_0xa345('0x1a'),'client_id':_0xbeace7[_0xa345('0x1b')],'client_secret':_0xbeace7['clientSecret'],'redirect_uri':_0xbeace7[_0xa345('0xd')],'code':_0xbeace7[_0xa345('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x42da51)[_0xa345('0x29')](function(_0x343ac3){var _0x29457e=JSON[_0xa345('0x1d')](_0x343ac3);if(_0x29457e['refresh_token']){_0xbeace7['refreshToken']=_0x29457e[_0xa345('0x1e')];logger[_0xa345('0x20')](util[_0xa345('0x21')](_0xa345('0x22'),_0xbeace7[_0xa345('0x24')],_0xbeace7['id']));}else{logger[_0xa345('0x27')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xbeace7[_0xa345('0x24')],_0xbeace7['id']),util['inspect'](_0x29457e,{'showHidden':![],'depth':null}));}return _0x4fd9d3(null,_0x8ad4d8);})['catch'](function(_0x463215){logger[_0xa345('0x27')](util[_0xa345('0x21')](_0xa345('0x23'),_0xbeace7[_0xa345('0x24')],_0xbeace7['id']),util[_0xa345('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4fd9d3(_0x463215);});}else{return _0x4fd9d3(null,_0x8ad4d8);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2aa55c2..462b4b2 100644 --- a/server/api/intZohoAccount/intZohoAccount.rpc.js +++ b/server/api/intZohoAccount/intZohoAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5204=['catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','include','model','map','then','ShowZohoAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5204,0xdf));var _0x4520=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0x5204[_0x2baca1];return _0x9aa62a;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')]({'raw':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4['options'][_0x4520('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e00f4['options']?_0x2e00f4['options']['where']||null:null,'attributes':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'limit':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4[_0x4520('0x1a')]['limit']||null:null,'include':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4[_0x4520('0x1a')][_0x4520('0x1d')]?_['map'](_0x2e00f4[_0x4520('0x1a')][_0x4520('0x1d')],function(_0x24eacd){return{'model':db[_0x24eacd[_0x4520('0x1e')]],'as':_0x24eacd['as'],'attributes':_0x24eacd[_0x4520('0x1c')],'include':_0x24eacd['include']?_[_0x4520('0x1f')](_0x24eacd[_0x4520('0x1d')],function(_0x3532aa){return{'model':db[_0x3532aa[_0x4520('0x1e')]],'as':_0x3532aa['as'],'attributes':_0x3532aa['attributes'],'include':_0x3532aa[_0x4520('0x1d')]?_[_0x4520('0x1f')](_0x3532aa[_0x4520('0x1d')],function(_0x21e1f3){return{'model':db[_0x21e1f3[_0x4520('0x1e')]],'as':_0x21e1f3['as'],'attributes':_0x21e1f3[_0x4520('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4520('0x20')](function(_0x195c58){logger[_0x4520('0xc')](_0x4520('0x17'),_0x2e00f4);logger['debug'](_0x4520('0x17'),_0x2e00f4,JSON['stringify'](_0x195c58));_0x4ba69f(_0x195c58);})[_0x4520('0x16')](function(_0x14778a){logger[_0x4520('0x12')](_0x4520('0x17'),_0x14778a[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x14778a['message']));});});};exports[_0x4520('0x21')]=function(_0x508c05){var _0x2585eb=this;return new Promise(function(_0x4a6755,_0xf6caff){return db['ZohoAccount'][_0x4520('0x22')]({'raw':_0x508c05['options']?_0x508c05['options'][_0x4520('0x1b')]===undefined?!![]:![]:!![],'where':_0x508c05[_0x4520('0x1a')]?_0x508c05[_0x4520('0x1a')]['where']||null:null,'attributes':_0x508c05[_0x4520('0x1a')]?_0x508c05[_0x4520('0x1a')][_0x4520('0x1c')]||null:null,'include':_0x508c05[_0x4520('0x1a')]?_0x508c05['options']['include']?_[_0x4520('0x1f')](_0x508c05[_0x4520('0x1a')]['include'],function(_0x779e94){return{'model':db[_0x779e94[_0x4520('0x1e')]],'as':_0x779e94['as'],'attributes':_0x779e94[_0x4520('0x1c')],'include':_0x779e94[_0x4520('0x1d')]?_[_0x4520('0x1f')](_0x779e94[_0x4520('0x1d')],function(_0x550a0f){return{'model':db[_0x550a0f[_0x4520('0x1e')]],'as':_0x550a0f['as'],'attributes':_0x550a0f[_0x4520('0x1c')],'include':_0x550a0f['include']?_[_0x4520('0x1f')](_0x550a0f['include'],function(_0x8bf557){return{'model':db[_0x8bf557[_0x4520('0x1e')]],'as':_0x8bf557['as'],'attributes':_0x8bf557['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5527a6){logger[_0x4520('0xc')](_0x4520('0x21'),_0x508c05);logger[_0x4520('0xf')](_0x4520('0x21'),_0x508c05,JSON[_0x4520('0x11')](_0x5527a6));_0x4a6755(_0x5527a6);})[_0x4520('0x16')](function(_0x3bfc83){logger['error'](_0x4520('0x21'),_0x3bfc83[_0x4520('0x14')],_0x508c05);_0xf6caff(_0x2585eb[_0x4520('0x12')](0x1f4,_0x3bfc83['message']));});});}; \ No newline at end of file +var _0xbc87=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ZohoAccount','findAll','options','where','attributes','include','map','model','GetZohoAccount','ShowZohoAccount','find','stringify','lodash'];(function(_0xa853d0,_0x5ed78a){var _0xdec32=function(_0x1db7ce){while(--_0x1db7ce){_0xa853d0['push'](_0xa853d0['shift']());}};_0xdec32(++_0x5ed78a);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x3fd6e1,_0x25a3d0){_0x3fd6e1=_0x3fd6e1-0x0;var _0x2fdb48=_0xbc87[_0x3fd6e1];return _0x2fdb48;};'use strict';var _=require(_0x7bc8('0x0'));var util=require(_0x7bc8('0x1'));var moment=require('moment');var BPromise=require(_0x7bc8('0x2'));var rs=require(_0x7bc8('0x3'));var fs=require('fs');var Redis=require(_0x7bc8('0x4'));var db=require(_0x7bc8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bc8('0x6'))(_0x7bc8('0x7'));var config=require(_0x7bc8('0x8'));var jayson=require(_0x7bc8('0x9'));var client=jayson[_0x7bc8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b2bc9,_0x194a12,_0x3ad7ef){return new BPromise(function(_0x526792,_0x3e5196){return client['request'](_0x4b2bc9,_0x3ad7ef)[_0x7bc8('0xb')](function(_0x32e2b0){logger['info'](_0x7bc8('0xc'),_0x194a12,_0x7bc8('0xd'));logger[_0x7bc8('0xe')](_0x7bc8('0xf'),_0x194a12,_0x7bc8('0xd'),JSON['stringify'](_0x32e2b0));if(_0x32e2b0[_0x7bc8('0x10')]){if(_0x32e2b0[_0x7bc8('0x10')][_0x7bc8('0x11')]===0x1f4){logger[_0x7bc8('0x10')](_0x7bc8('0xc'),_0x194a12,_0x32e2b0[_0x7bc8('0x10')][_0x7bc8('0x12')]);return _0x3e5196(_0x32e2b0[_0x7bc8('0x10')][_0x7bc8('0x12')]);}logger[_0x7bc8('0x10')](_0x7bc8('0xc'),_0x194a12,_0x32e2b0['error'][_0x7bc8('0x12')]);return _0x526792(_0x32e2b0[_0x7bc8('0x10')][_0x7bc8('0x12')]);}else{logger[_0x7bc8('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x194a12,_0x7bc8('0xd'));_0x526792(_0x32e2b0['result'][_0x7bc8('0x12')]);}})[_0x7bc8('0x14')](function(_0x400e47){logger[_0x7bc8('0x10')](_0x7bc8('0xc'),_0x194a12,_0x400e47);_0x3e5196(_0x400e47);});});}exports['GetZohoAccount']=function(_0xcfb543){var _0x1f2fb9=this;return new Promise(function(_0x3f51ec,_0x1e398f){return db[_0x7bc8('0x15')][_0x7bc8('0x16')]({'raw':_0xcfb543[_0x7bc8('0x17')]?_0xcfb543[_0x7bc8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xcfb543[_0x7bc8('0x17')]?_0xcfb543['options'][_0x7bc8('0x18')]||null:null,'attributes':_0xcfb543[_0x7bc8('0x17')]?_0xcfb543[_0x7bc8('0x17')][_0x7bc8('0x19')]||null:null,'limit':_0xcfb543[_0x7bc8('0x17')]?_0xcfb543[_0x7bc8('0x17')]['limit']||null:null,'include':_0xcfb543[_0x7bc8('0x17')]?_0xcfb543[_0x7bc8('0x17')][_0x7bc8('0x1a')]?_[_0x7bc8('0x1b')](_0xcfb543[_0x7bc8('0x17')][_0x7bc8('0x1a')],function(_0x30c529){return{'model':db[_0x30c529[_0x7bc8('0x1c')]],'as':_0x30c529['as'],'attributes':_0x30c529[_0x7bc8('0x19')],'include':_0x30c529[_0x7bc8('0x1a')]?_[_0x7bc8('0x1b')](_0x30c529['include'],function(_0x3ef138){return{'model':db[_0x3ef138[_0x7bc8('0x1c')]],'as':_0x3ef138['as'],'attributes':_0x3ef138[_0x7bc8('0x19')],'include':_0x3ef138[_0x7bc8('0x1a')]?_['map'](_0x3ef138['include'],function(_0x4c8a74){return{'model':db[_0x4c8a74[_0x7bc8('0x1c')]],'as':_0x4c8a74['as'],'attributes':_0x4c8a74[_0x7bc8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bc8('0xb')](function(_0x2f519c){logger['info'](_0x7bc8('0x1d'),_0xcfb543);logger[_0x7bc8('0xe')](_0x7bc8('0x1d'),_0xcfb543,JSON['stringify'](_0x2f519c));_0x3f51ec(_0x2f519c);})[_0x7bc8('0x14')](function(_0x5a4c5c){logger[_0x7bc8('0x10')](_0x7bc8('0x1d'),_0x5a4c5c[_0x7bc8('0x12')],_0xcfb543);_0x1e398f(_0x1f2fb9[_0x7bc8('0x10')](0x1f4,_0x5a4c5c[_0x7bc8('0x12')]));});});};exports[_0x7bc8('0x1e')]=function(_0x1540b5){var _0xbe46e2=this;return new Promise(function(_0xd7d333,_0x44afe0){return db[_0x7bc8('0x15')][_0x7bc8('0x1f')]({'raw':_0x1540b5[_0x7bc8('0x17')]?_0x1540b5[_0x7bc8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1540b5[_0x7bc8('0x17')]?_0x1540b5[_0x7bc8('0x17')][_0x7bc8('0x18')]||null:null,'attributes':_0x1540b5['options']?_0x1540b5[_0x7bc8('0x17')]['attributes']||null:null,'include':_0x1540b5[_0x7bc8('0x17')]?_0x1540b5['options'][_0x7bc8('0x1a')]?_[_0x7bc8('0x1b')](_0x1540b5[_0x7bc8('0x17')][_0x7bc8('0x1a')],function(_0x1d837a){return{'model':db[_0x1d837a['model']],'as':_0x1d837a['as'],'attributes':_0x1d837a[_0x7bc8('0x19')],'include':_0x1d837a[_0x7bc8('0x1a')]?_[_0x7bc8('0x1b')](_0x1d837a[_0x7bc8('0x1a')],function(_0x185dd1){return{'model':db[_0x185dd1[_0x7bc8('0x1c')]],'as':_0x185dd1['as'],'attributes':_0x185dd1[_0x7bc8('0x19')],'include':_0x185dd1[_0x7bc8('0x1a')]?_[_0x7bc8('0x1b')](_0x185dd1[_0x7bc8('0x1a')],function(_0x12141b){return{'model':db[_0x12141b[_0x7bc8('0x1c')]],'as':_0x12141b['as'],'attributes':_0x12141b[_0x7bc8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bc8('0xb')](function(_0x51a0e7){logger[_0x7bc8('0x13')](_0x7bc8('0x1e'),_0x1540b5);logger[_0x7bc8('0xe')](_0x7bc8('0x1e'),_0x1540b5,JSON[_0x7bc8('0x20')](_0x51a0e7));_0xd7d333(_0x51a0e7);})[_0x7bc8('0x14')](function(_0x1ee56d){logger[_0x7bc8('0x10')](_0x7bc8('0x1e'),_0x1ee56d[_0x7bc8('0x12')],_0x1540b5);_0x44afe0(_0xbe46e2[_0x7bc8('0x10')](0x1f4,_0x1ee56d[_0x7bc8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9563680..4d91041 100644 --- a/server/api/intZohoConfiguration/index.js +++ b/server/api/intZohoConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33f7=['index','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','delete','/:id','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x2fe2c5,_0x26cd65){var _0x26e69b=function(_0x2c389e){while(--_0x2c389e){_0x2fe2c5['push'](_0x2fe2c5['shift']());}};_0x26e69b(++_0x26cd65);}(_0x33f7,0x122));var _0x733f=function(_0x1f4e10,_0x1db2a1){_0x1f4e10=_0x1f4e10-0x0;var _0x4c9c4d=_0x33f7[_0x1f4e10];return _0x4c9c4d;};'use strict';var multer=require(_0x733f('0x0'));var util=require(_0x733f('0x1'));var path=require(_0x733f('0x2'));var timeout=require(_0x733f('0x3'));var express=require('express');var router=express[_0x733f('0x4')]();var fs_extra=require(_0x733f('0x5'));var auth=require(_0x733f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x733f('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x733f('0x8')]('/',auth[_0x733f('0x9')](),controller[_0x733f('0xa')]);router['get']('/:id',auth[_0x733f('0x9')](),controller[_0x733f('0xb')]);router[_0x733f('0x8')](_0x733f('0xc'),auth[_0x733f('0x9')](),controller[_0x733f('0xd')]);router['get']('/:id/subjects',auth[_0x733f('0x9')](),controller[_0x733f('0xe')]);router[_0x733f('0x8')]('/:id/descriptions',auth[_0x733f('0x9')](),controller[_0x733f('0xf')]);router[_0x733f('0x10')]('/',auth['isAuthenticated'](),controller[_0x733f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x733f('0x12')](_0x733f('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa493=['/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects'];(function(_0x209603,_0x351b88){var _0x3e06d4=function(_0x4e9655){while(--_0x4e9655){_0x209603['push'](_0x209603['shift']());}};_0x3e06d4(++_0x351b88);}(_0xa493,0x1bd));var _0x3a49=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa493[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x3a49('0x0'));var util=require(_0x3a49('0x1'));var path=require(_0x3a49('0x2'));var timeout=require(_0x3a49('0x3'));var express=require(_0x3a49('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3a49('0x5'));var interaction=require(_0x3a49('0x6'));var config=require(_0x3a49('0x7'));var controller=require(_0x3a49('0x8'));router[_0x3a49('0x9')]('/',auth[_0x3a49('0xa')](),controller['index']);router[_0x3a49('0x9')]('/:id',auth[_0x3a49('0xa')](),controller[_0x3a49('0xb')]);router[_0x3a49('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3a49('0xc')]);router[_0x3a49('0x9')](_0x3a49('0xd'),auth[_0x3a49('0xa')](),controller[_0x3a49('0xe')]);router[_0x3a49('0x9')](_0x3a49('0xf'),auth['isAuthenticated'](),controller[_0x3a49('0x10')]);router[_0x3a49('0x11')]('/',auth['isAuthenticated'](),controller[_0x3a49('0x12')]);router[_0x3a49('0x13')](_0x3a49('0x14'),auth[_0x3a49('0xa')](),controller[_0x3a49('0x15')]);router[_0x3a49('0x16')](_0x3a49('0x14'),auth[_0x3a49('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 27db8c4..3895769 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbfd=['ENUM','lead','contact','contact_lead','exports','STRING'];(function(_0x1a8be3,_0xa1d303){var _0xac9769=function(_0x3e5ccb){while(--_0x3e5ccb){_0x1a8be3['push'](_0x1a8be3['shift']());}};_0xac9769(++_0xa1d303);}(_0xbbfd,0x1a8));var _0xdbbf=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xbbfd[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0xdbbf('0x0')]={'name':{'type':Sequelize[_0xdbbf('0x1')]},'moduleCreate':{'type':Sequelize[_0xdbbf('0x2')](_0xdbbf('0x3'),_0xdbbf('0x4'),'nothing'),'defaultValue':_0xdbbf('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xdbbf('0x5'),'contact',_0xdbbf('0x3')),'defaultValue':_0xdbbf('0x5')},'description':{'type':Sequelize[_0xdbbf('0x1')]}}; \ No newline at end of file +var _0xc485=['ENUM','lead','contact','nothing','contact_lead','sequelize','STRING'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xc485,0x1be));var _0x5c48=function(_0x3b7fb0,_0x553e21){_0x3b7fb0=_0x3b7fb0-0x0;var _0x3b7fc5=_0xc485[_0x3b7fb0];return _0x3b7fc5;};'use strict';var Sequelize=require(_0x5c48('0x0'));module['exports']={'name':{'type':Sequelize[_0x5c48('0x1')]},'moduleCreate':{'type':Sequelize[_0x5c48('0x2')](_0x5c48('0x3'),_0x5c48('0x4'),_0x5c48('0x5')),'defaultValue':_0x5c48('0x3')},'moduleSearch':{'type':Sequelize[_0x5c48('0x2')](_0x5c48('0x6'),'contact','lead'),'defaultValue':_0x5c48('0x6')},'description':{'type':Sequelize[_0x5c48('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9782ccc..786a015 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d57=['key','name','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','filters','fields','include','find','catch','create','body','params','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','send','index','map','ZohoConfiguration','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d57,0x1b3));var _0x73d5=function(_0x212da4,_0x48f5b3){_0x212da4=_0x212da4-0x0;var _0x2bbf64=_0x3d57[_0x212da4];return _0x2bbf64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x73d5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73d5('0x1'));var rp=require(_0x73d5('0x2'));var moment=require(_0x73d5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x73d5('0x4'));var util=require(_0x73d5('0x5'));var path=require('path');var sox=require(_0x73d5('0x6'));var csv=require('to-csv');var ejs=require(_0x73d5('0x7'));var fs=require('fs');var fs_extra=require(_0x73d5('0x8'));var _=require(_0x73d5('0x9'));var squel=require(_0x73d5('0xa'));var crypto=require('crypto');var jsforce=require(_0x73d5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x73d5('0xc'));var querystring=require(_0x73d5('0xd'));var Papa=require(_0x73d5('0xe'));var Redis=require('ioredis');var authService=require(_0x73d5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x73d5('0x10'));var hardwareService=require(_0x73d5('0x11'));var logger=require(_0x73d5('0x12'))(_0x73d5('0x13'));var utils=require(_0x73d5('0x14'));var config=require(_0x73d5('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1099a6,_0x37e105){_0x37e105=_0x37e105||0xcc;return function(_0x101e42){if(_0x101e42){return _0x1099a6[_0x73d5('0x16')](_0x37e105);}return _0x1099a6['status'](_0x37e105)[_0x73d5('0x17')]();};}function respondWithResult(_0x4a5ef9,_0x1328b6){_0x1328b6=_0x1328b6||0xc8;return function(_0x340f47){if(_0x340f47){return _0x4a5ef9[_0x73d5('0x18')](_0x1328b6)[_0x73d5('0x19')](_0x340f47);}};}function respondWithFilteredResult(_0x3fbf59,_0x456077){return function(_0x491da7){if(_0x491da7){var _0x54a581=typeof _0x456077['offset']==='undefined'&&typeof _0x456077[_0x73d5('0x1a')]===_0x73d5('0x1b');var _0x3e9a8e=_0x491da7[_0x73d5('0x1c')];var _0x15819=_0x54a581?0x0:_0x456077['offset'];var _0xa32711=_0x54a581?_0x491da7['count']:_0x456077[_0x73d5('0x1d')]+_0x456077[_0x73d5('0x1a')];var _0x54dc71;if(_0xa32711>=_0x3e9a8e){_0xa32711=_0x3e9a8e;_0x54dc71=0xc8;}else{_0x54dc71=0xce;}_0x3fbf59['status'](_0x54dc71);return _0x3fbf59[_0x73d5('0x1e')](_0x73d5('0x1f'),_0x15819+'-'+_0xa32711+'/'+_0x3e9a8e)[_0x73d5('0x19')](_0x491da7);}return null;};}function patchUpdates(_0x24cf5a){return function(_0x35c9a4){try{jsonpatch[_0x73d5('0x20')](_0x35c9a4,_0x24cf5a,!![]);}catch(_0x53ce2e){return BPromise['reject'](_0x53ce2e);}return _0x35c9a4[_0x73d5('0x21')]();};}function saveUpdates(_0x123be6,_0x55e9ca){return function(_0x5e78e1){if(_0x5e78e1){return _0x5e78e1[_0x73d5('0x22')](_0x123be6)['then'](function(_0x3d2a15){return _0x3d2a15;});}return null;};}function removeEntity(_0x41a674,_0x37db07){return function(_0x3ff769){if(_0x3ff769){return _0x3ff769[_0x73d5('0x23')]()[_0x73d5('0x24')](function(){_0x41a674[_0x73d5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6875,_0x307b91){return function(_0x5100d3){if(!_0x5100d3){_0x2b6875[_0x73d5('0x16')](0x194);}return _0x5100d3;};}function handleError(_0x5eb5f6,_0x4826df){_0x4826df=_0x4826df||0x1f4;return function(_0x29b277){logger[_0x73d5('0x25')](_0x29b277[_0x73d5('0x26')]);if(_0x29b277['name']){delete _0x29b277['name'];}_0x5eb5f6['status'](_0x4826df)[_0x73d5('0x27')](_0x29b277);};}exports[_0x73d5('0x28')]=function(_0x1de475,_0xf5e6ce){var _0x31031e={},_0x186744={},_0x4973f4={'count':0x0,'rows':[]};var _0x2acb48=_[_0x73d5('0x29')](db[_0x73d5('0x2a')][_0x73d5('0x2b')],function(_0x130c01){return{'name':_0x130c01[_0x73d5('0x2c')],'type':_0x130c01['type'][_0x73d5('0x2d')]};});_0x186744['model']=_[_0x73d5('0x29')](_0x2acb48,_0x73d5('0x2e'));_0x186744[_0x73d5('0x2f')]=_[_0x73d5('0x30')](_0x1de475['query']);_0x186744['filters']=_[_0x73d5('0x31')](_0x186744[_0x73d5('0x32')],_0x186744[_0x73d5('0x2f')]);_0x31031e[_0x73d5('0x33')]=_[_0x73d5('0x31')](_0x186744[_0x73d5('0x32')],qs['fields'](_0x1de475[_0x73d5('0x2f')]['fields']));_0x31031e['attributes']=_0x31031e[_0x73d5('0x33')][_0x73d5('0x34')]?_0x31031e['attributes']:_0x186744['model'];if(!_0x1de475[_0x73d5('0x2f')][_0x73d5('0x35')](_0x73d5('0x36'))){_0x31031e[_0x73d5('0x1a')]=qs[_0x73d5('0x1a')](_0x1de475[_0x73d5('0x2f')]['limit']);_0x31031e[_0x73d5('0x1d')]=qs[_0x73d5('0x1d')](_0x1de475[_0x73d5('0x2f')][_0x73d5('0x1d')]);}_0x31031e['order']=qs[_0x73d5('0x37')](_0x1de475[_0x73d5('0x2f')][_0x73d5('0x37')]);_0x31031e[_0x73d5('0x38')]=qs['filters'](_[_0x73d5('0x39')](_0x1de475[_0x73d5('0x2f')],_0x186744['filters']),_0x2acb48);if(_0x1de475[_0x73d5('0x2f')][_0x73d5('0x3a')]){_0x31031e[_0x73d5('0x38')]=_[_0x73d5('0x3b')](_0x31031e[_0x73d5('0x38')],{'$or':_[_0x73d5('0x29')](_0x2acb48,function(_0x52a0ef){if(_0x52a0ef['type']!==_0x73d5('0x3c')){var _0x136f46={};_0x136f46[_0x52a0ef[_0x73d5('0x2e')]]={'$like':'%'+_0x1de475['query'][_0x73d5('0x3a')]+'%'};return _0x136f46;}})});}_0x31031e=_[_0x73d5('0x3b')]({},_0x31031e,_0x1de475[_0x73d5('0x3d')]);var _0x5213d5={'where':_0x31031e[_0x73d5('0x38')]};return db[_0x73d5('0x2a')]['count'](_0x5213d5)['then'](function(_0x5727fa){_0x4973f4[_0x73d5('0x1c')]=_0x5727fa;if(_0x1de475[_0x73d5('0x2f')][_0x73d5('0x3e')]){_0x31031e['include']=[{'all':!![]}];}return db[_0x73d5('0x2a')][_0x73d5('0x3f')](_0x31031e);})['then'](function(_0x2fca7c){_0x4973f4[_0x73d5('0x40')]=_0x2fca7c;return _0x4973f4;})[_0x73d5('0x24')](respondWithFilteredResult(_0xf5e6ce,_0x31031e))['catch'](handleError(_0xf5e6ce,null));};exports[_0x73d5('0x41')]=function(_0x13574d,_0x581591){var _0x5123b1={'raw':![],'where':{'id':_0x13574d['params']['id']}},_0x374902={};_0x374902[_0x73d5('0x32')]=_[_0x73d5('0x30')](db[_0x73d5('0x2a')]['rawAttributes']);_0x374902[_0x73d5('0x2f')]=_[_0x73d5('0x30')](_0x13574d[_0x73d5('0x2f')]);_0x374902[_0x73d5('0x42')]=_['intersection'](_0x374902[_0x73d5('0x32')],_0x374902[_0x73d5('0x2f')]);_0x5123b1['attributes']=_[_0x73d5('0x31')](_0x374902['model'],qs['fields'](_0x13574d[_0x73d5('0x2f')][_0x73d5('0x43')]));_0x5123b1[_0x73d5('0x33')]=_0x5123b1['attributes']['length']?_0x5123b1['attributes']:_0x374902['model'];if(_0x13574d[_0x73d5('0x2f')][_0x73d5('0x3e')]){_0x5123b1[_0x73d5('0x44')]=[{'all':!![]}];}_0x5123b1=_[_0x73d5('0x3b')]({},_0x5123b1,_0x13574d[_0x73d5('0x3d')]);return db[_0x73d5('0x2a')][_0x73d5('0x45')](_0x5123b1)['then'](handleEntityNotFound(_0x581591,null))[_0x73d5('0x24')](respondWithResult(_0x581591,null))[_0x73d5('0x46')](handleError(_0x581591,null));};exports[_0x73d5('0x47')]=function(_0x455d9e,_0x2395a3){return db['ZohoConfiguration'][_0x73d5('0x47')](_0x455d9e[_0x73d5('0x48')],{})[_0x73d5('0x24')](respondWithResult(_0x2395a3,0xc9))[_0x73d5('0x46')](handleError(_0x2395a3,null));};exports['update']=function(_0x23dc2f,_0x3c913c){if(_0x23dc2f[_0x73d5('0x48')]['id']){delete _0x23dc2f[_0x73d5('0x48')]['id'];}return db[_0x73d5('0x2a')]['find']({'where':{'id':_0x23dc2f[_0x73d5('0x49')]['id']}})[_0x73d5('0x24')](handleEntityNotFound(_0x3c913c,null))['then'](saveUpdates(_0x23dc2f['body'],null))['then'](respondWithResult(_0x3c913c,null))[_0x73d5('0x46')](handleError(_0x3c913c,null));};exports[_0x73d5('0x23')]=function(_0x5a12a7,_0x4d8bec){return db[_0x73d5('0x2a')]['find']({'where':{'id':_0x5a12a7[_0x73d5('0x49')]['id']}})[_0x73d5('0x24')](handleEntityNotFound(_0x4d8bec,null))[_0x73d5('0x24')](removeEntity(_0x4d8bec,null))[_0x73d5('0x46')](handleError(_0x4d8bec,null));};exports[_0x73d5('0x4a')]=function(_0x4c557f,_0x961c52,_0x2d5c36){var _0x42ec96={};var _0x5d6eaf={};var _0x2dfd39;var _0x507333;return db['ZohoConfiguration'][_0x73d5('0x4b')]({'where':{'id':_0x4c557f[_0x73d5('0x49')]['id']}})[_0x73d5('0x24')](handleEntityNotFound(_0x961c52,null))['then'](function(_0x2fad96){if(_0x2fad96){_0x2dfd39=_0x2fad96;_0x5d6eaf[_0x73d5('0x32')]=_[_0x73d5('0x30')](db[_0x73d5('0x4c')][_0x73d5('0x2b')]);_0x5d6eaf[_0x73d5('0x2f')]=_['keys'](_0x4c557f[_0x73d5('0x2f')]);_0x5d6eaf[_0x73d5('0x42')]=_[_0x73d5('0x31')](_0x5d6eaf[_0x73d5('0x32')],_0x5d6eaf[_0x73d5('0x2f')]);_0x42ec96['attributes']=_[_0x73d5('0x31')](_0x5d6eaf[_0x73d5('0x32')],qs['fields'](_0x4c557f[_0x73d5('0x2f')][_0x73d5('0x43')]));_0x42ec96[_0x73d5('0x33')]=_0x42ec96[_0x73d5('0x33')][_0x73d5('0x34')]?_0x42ec96['attributes']:_0x5d6eaf[_0x73d5('0x32')];_0x42ec96[_0x73d5('0x4d')]=qs[_0x73d5('0x37')](_0x4c557f[_0x73d5('0x2f')][_0x73d5('0x37')]);_0x42ec96[_0x73d5('0x38')]=qs[_0x73d5('0x42')](_[_0x73d5('0x39')](_0x4c557f[_0x73d5('0x2f')],_0x5d6eaf[_0x73d5('0x42')]));if(_0x4c557f[_0x73d5('0x2f')][_0x73d5('0x3a')]){_0x42ec96['where']=_[_0x73d5('0x3b')](_0x42ec96[_0x73d5('0x38')],{'$or':_['map'](_0x42ec96['attributes'],function(_0x259e55){var _0x4e658b={};_0x4e658b[_0x259e55]={'$like':'%'+_0x4c557f[_0x73d5('0x2f')][_0x73d5('0x3a')]+'%'};return _0x4e658b;})});}_0x42ec96=_[_0x73d5('0x3b')]({},_0x42ec96,_0x4c557f[_0x73d5('0x3d')]);return _0x2dfd39[_0x73d5('0x4a')](_0x42ec96);}})[_0x73d5('0x24')](function(_0x25a047){if(_0x25a047){_0x507333=_0x25a047[_0x73d5('0x34')];if(!_0x4c557f[_0x73d5('0x2f')][_0x73d5('0x35')](_0x73d5('0x36'))){_0x42ec96[_0x73d5('0x1a')]=qs[_0x73d5('0x1a')](_0x4c557f[_0x73d5('0x2f')][_0x73d5('0x1a')]);_0x42ec96[_0x73d5('0x1d')]=qs[_0x73d5('0x1d')](_0x4c557f[_0x73d5('0x2f')][_0x73d5('0x1d')]);}return _0x2dfd39[_0x73d5('0x4a')](_0x42ec96);}})[_0x73d5('0x24')](function(_0x5412ae){if(_0x5412ae){return _0x5412ae?{'count':_0x507333,'rows':_0x5412ae}:null;}})[_0x73d5('0x24')](respondWithResult(_0x961c52,null))[_0x73d5('0x46')](handleError(_0x961c52,null));};exports['getSubjects']=function(_0x2992d3,_0xead144,_0x3177ca){var _0x54c323={};var _0x4e5db3={};var _0x5da45a;var _0x5d5d16;return db[_0x73d5('0x2a')][_0x73d5('0x4b')]({'where':{'id':_0x2992d3[_0x73d5('0x49')]['id']}})[_0x73d5('0x24')](handleEntityNotFound(_0xead144,null))['then'](function(_0x3a9826){if(_0x3a9826){_0x5da45a=_0x3a9826;_0x4e5db3['model']=_[_0x73d5('0x30')](db['ZohoField'][_0x73d5('0x2b')]);_0x4e5db3[_0x73d5('0x2f')]=_['keys'](_0x2992d3[_0x73d5('0x2f')]);_0x4e5db3['filters']=_[_0x73d5('0x31')](_0x4e5db3[_0x73d5('0x32')],_0x4e5db3[_0x73d5('0x2f')]);_0x54c323[_0x73d5('0x33')]=_[_0x73d5('0x31')](_0x4e5db3[_0x73d5('0x32')],qs[_0x73d5('0x43')](_0x2992d3[_0x73d5('0x2f')][_0x73d5('0x43')]));_0x54c323['attributes']=_0x54c323['attributes'][_0x73d5('0x34')]?_0x54c323[_0x73d5('0x33')]:_0x4e5db3[_0x73d5('0x32')];_0x54c323[_0x73d5('0x4d')]=qs[_0x73d5('0x37')](_0x2992d3['query'][_0x73d5('0x37')]);_0x54c323[_0x73d5('0x38')]=qs[_0x73d5('0x42')](_[_0x73d5('0x39')](_0x2992d3[_0x73d5('0x2f')],_0x4e5db3['filters']));if(_0x2992d3[_0x73d5('0x2f')][_0x73d5('0x3a')]){_0x54c323['where']=_[_0x73d5('0x3b')](_0x54c323['where'],{'$or':_[_0x73d5('0x29')](_0x54c323['attributes'],function(_0x17fdd9){var _0x2609e1={};_0x2609e1[_0x17fdd9]={'$like':'%'+_0x2992d3[_0x73d5('0x2f')]['filter']+'%'};return _0x2609e1;})});}_0x54c323=_[_0x73d5('0x3b')]({},_0x54c323,_0x2992d3['options']);return _0x5da45a[_0x73d5('0x4e')](_0x54c323);}})[_0x73d5('0x24')](function(_0x14ff81){if(_0x14ff81){_0x5d5d16=_0x14ff81[_0x73d5('0x34')];if(!_0x2992d3['query']['hasOwnProperty'](_0x73d5('0x36'))){_0x54c323['limit']=qs[_0x73d5('0x1a')](_0x2992d3[_0x73d5('0x2f')][_0x73d5('0x1a')]);_0x54c323[_0x73d5('0x1d')]=qs[_0x73d5('0x1d')](_0x2992d3['query'][_0x73d5('0x1d')]);}return _0x5da45a[_0x73d5('0x4e')](_0x54c323);}})[_0x73d5('0x24')](function(_0x5854df){if(_0x5854df){return _0x5854df?{'count':_0x5d5d16,'rows':_0x5854df}:null;}})[_0x73d5('0x24')](respondWithResult(_0xead144,null))['catch'](handleError(_0xead144,null));};exports[_0x73d5('0x4f')]=function(_0x46f9c0,_0x1c673c,_0x2cdf5a){var _0x5275b4={};var _0x2dd6c7={};var _0x409878;var _0x3ea10f;return db[_0x73d5('0x2a')][_0x73d5('0x4b')]({'where':{'id':_0x46f9c0['params']['id']}})[_0x73d5('0x24')](handleEntityNotFound(_0x1c673c,null))[_0x73d5('0x24')](function(_0x1ad132){if(_0x1ad132){_0x409878=_0x1ad132;_0x2dd6c7['model']=_[_0x73d5('0x30')](db[_0x73d5('0x4c')]['rawAttributes']);_0x2dd6c7[_0x73d5('0x2f')]=_[_0x73d5('0x30')](_0x46f9c0['query']);_0x2dd6c7[_0x73d5('0x42')]=_[_0x73d5('0x31')](_0x2dd6c7['model'],_0x2dd6c7[_0x73d5('0x2f')]);_0x5275b4[_0x73d5('0x33')]=_[_0x73d5('0x31')](_0x2dd6c7[_0x73d5('0x32')],qs[_0x73d5('0x43')](_0x46f9c0['query']['fields']));_0x5275b4[_0x73d5('0x33')]=_0x5275b4[_0x73d5('0x33')][_0x73d5('0x34')]?_0x5275b4[_0x73d5('0x33')]:_0x2dd6c7['model'];_0x5275b4[_0x73d5('0x4d')]=qs[_0x73d5('0x37')](_0x46f9c0[_0x73d5('0x2f')][_0x73d5('0x37')]);_0x5275b4[_0x73d5('0x38')]=qs['filters'](_[_0x73d5('0x39')](_0x46f9c0[_0x73d5('0x2f')],_0x2dd6c7[_0x73d5('0x42')]));if(_0x46f9c0[_0x73d5('0x2f')]['filter']){_0x5275b4[_0x73d5('0x38')]=_[_0x73d5('0x3b')](_0x5275b4[_0x73d5('0x38')],{'$or':_[_0x73d5('0x29')](_0x5275b4[_0x73d5('0x33')],function(_0x1e8417){var _0x49fec7={};_0x49fec7[_0x1e8417]={'$like':'%'+_0x46f9c0[_0x73d5('0x2f')][_0x73d5('0x3a')]+'%'};return _0x49fec7;})});}_0x5275b4=_[_0x73d5('0x3b')]({},_0x5275b4,_0x46f9c0[_0x73d5('0x3d')]);return _0x409878[_0x73d5('0x4f')](_0x5275b4);}})[_0x73d5('0x24')](function(_0x317415){if(_0x317415){_0x3ea10f=_0x317415['length'];if(!_0x46f9c0['query'][_0x73d5('0x35')](_0x73d5('0x36'))){_0x5275b4[_0x73d5('0x1a')]=qs['limit'](_0x46f9c0['query'][_0x73d5('0x1a')]);_0x5275b4[_0x73d5('0x1d')]=qs['offset'](_0x46f9c0[_0x73d5('0x2f')]['offset']);}return _0x409878[_0x73d5('0x4f')](_0x5275b4);}})['then'](function(_0x21a27c){if(_0x21a27c){return _0x21a27c?{'count':_0x3ea10f,'rows':_0x21a27c}:null;}})[_0x73d5('0x24')](respondWithResult(_0x1c673c,null))[_0x73d5('0x46')](handleError(_0x1c673c,null));}; \ No newline at end of file +var _0x1801=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','then','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','findOne','pick','getFields','getSubjects','ZohoField','getDescriptions','eml-format','rimraf'];(function(_0x59e3ab,_0x39ac73){var _0x136e74=function(_0x1bb3f3){while(--_0x1bb3f3){_0x59e3ab['push'](_0x59e3ab['shift']());}};_0x136e74(++_0x39ac73);}(_0x1801,0x1f0));var _0x1180=function(_0x1695ba,_0x41bac6){_0x1695ba=_0x1695ba-0x0;var _0x4502e5=_0x1801[_0x1695ba];return _0x4502e5;};'use strict';var emlformat=require(_0x1180('0x0'));var rimraf=require(_0x1180('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1180('0x2'));var moment=require('moment');var BPromise=require(_0x1180('0x3'));var Mustache=require(_0x1180('0x4'));var util=require(_0x1180('0x5'));var path=require(_0x1180('0x6'));var sox=require(_0x1180('0x7'));var csv=require(_0x1180('0x8'));var ejs=require(_0x1180('0x9'));var fs=require('fs');var fs_extra=require(_0x1180('0xa'));var _=require('lodash');var squel=require(_0x1180('0xb'));var crypto=require(_0x1180('0xc'));var jsforce=require(_0x1180('0xd'));var deskjs=require(_0x1180('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1180('0xf'));var Papa=require('papaparse');var Redis=require(_0x1180('0x10'));var authService=require(_0x1180('0x11'));var qs=require(_0x1180('0x12'));var as=require(_0x1180('0x13'));var hardwareService=require(_0x1180('0x14'));var logger=require('../../config/logger')(_0x1180('0x15'));var utils=require(_0x1180('0x16'));var config=require(_0x1180('0x17'));var licenseUtil=require(_0x1180('0x18'));var db=require(_0x1180('0x19'))['db'];function respondWithStatusCode(_0x2eb72a,_0x38fa2b){_0x38fa2b=_0x38fa2b||0xcc;return function(_0x485e35){if(_0x485e35){return _0x2eb72a['sendStatus'](_0x38fa2b);}return _0x2eb72a['status'](_0x38fa2b)[_0x1180('0x1a')]();};}function respondWithResult(_0x5d27c,_0x4c6aea){_0x4c6aea=_0x4c6aea||0xc8;return function(_0x179933){if(_0x179933){return _0x5d27c[_0x1180('0x1b')](_0x4c6aea)[_0x1180('0x1c')](_0x179933);}};}function respondWithFilteredResult(_0x387ab8,_0x5550d0){return function(_0x26bf37){if(_0x26bf37){var _0x15bdaa=typeof _0x5550d0[_0x1180('0x1d')]===_0x1180('0x1e')&&typeof _0x5550d0['limit']===_0x1180('0x1e');var _0x5e91a7=_0x26bf37[_0x1180('0x1f')];var _0x2edded=_0x15bdaa?0x0:_0x5550d0[_0x1180('0x1d')];var _0x5d2d4b=_0x15bdaa?_0x26bf37[_0x1180('0x1f')]:_0x5550d0[_0x1180('0x1d')]+_0x5550d0[_0x1180('0x20')];var _0x1679f4;if(_0x5d2d4b>=_0x5e91a7){_0x5d2d4b=_0x5e91a7;_0x1679f4=0xc8;}else{_0x1679f4=0xce;}_0x387ab8['status'](_0x1679f4);return _0x387ab8[_0x1180('0x21')](_0x1180('0x22'),_0x2edded+'-'+_0x5d2d4b+'/'+_0x5e91a7)[_0x1180('0x1c')](_0x26bf37);}return null;};}function patchUpdates(_0x45630a){return function(_0x5a4ac0){try{jsonpatch['apply'](_0x5a4ac0,_0x45630a,!![]);}catch(_0x4aa2e6){return BPromise[_0x1180('0x23')](_0x4aa2e6);}return _0x5a4ac0['save']();};}function saveUpdates(_0x3671be,_0x4a5f4b){return function(_0x1ca24f){if(_0x1ca24f){return _0x1ca24f['update'](_0x3671be)['then'](function(_0x172ea2){return _0x172ea2;});}return null;};}function removeEntity(_0xeb8de3,_0x299bbc){return function(_0x5ea3d3){if(_0x5ea3d3){return _0x5ea3d3[_0x1180('0x24')]()[_0x1180('0x25')](function(){_0xeb8de3[_0x1180('0x1b')](0xcc)[_0x1180('0x1a')]();});}};}function handleEntityNotFound(_0x36ecfb,_0x404a40){return function(_0x34d563){if(!_0x34d563){_0x36ecfb[_0x1180('0x26')](0x194);}return _0x34d563;};}function handleError(_0x3177b4,_0x268829){_0x268829=_0x268829||0x1f4;return function(_0xe08e6c){logger[_0x1180('0x27')](_0xe08e6c[_0x1180('0x28')]);if(_0xe08e6c['name']){delete _0xe08e6c[_0x1180('0x29')];}_0x3177b4['status'](_0x268829)[_0x1180('0x2a')](_0xe08e6c);};}exports[_0x1180('0x2b')]=function(_0x4dacb4,_0x50d2db){var _0x40ff04={},_0xa0fa0c={},_0x5b46fe={'count':0x0,'rows':[]};var _0x35c9d0=_[_0x1180('0x2c')](db[_0x1180('0x2d')]['rawAttributes'],function(_0x42a6c9){return{'name':_0x42a6c9[_0x1180('0x2e')],'type':_0x42a6c9['type'][_0x1180('0x2f')]};});_0xa0fa0c[_0x1180('0x30')]=_[_0x1180('0x2c')](_0x35c9d0,_0x1180('0x29'));_0xa0fa0c[_0x1180('0x31')]=_[_0x1180('0x32')](_0x4dacb4[_0x1180('0x31')]);_0xa0fa0c[_0x1180('0x33')]=_[_0x1180('0x34')](_0xa0fa0c[_0x1180('0x30')],_0xa0fa0c[_0x1180('0x31')]);_0x40ff04[_0x1180('0x35')]=_['intersection'](_0xa0fa0c[_0x1180('0x30')],qs[_0x1180('0x36')](_0x4dacb4[_0x1180('0x31')][_0x1180('0x36')]));_0x40ff04['attributes']=_0x40ff04['attributes'][_0x1180('0x37')]?_0x40ff04[_0x1180('0x35')]:_0xa0fa0c[_0x1180('0x30')];if(!_0x4dacb4[_0x1180('0x31')][_0x1180('0x38')](_0x1180('0x39'))){_0x40ff04[_0x1180('0x20')]=qs['limit'](_0x4dacb4[_0x1180('0x31')][_0x1180('0x20')]);_0x40ff04[_0x1180('0x1d')]=qs[_0x1180('0x1d')](_0x4dacb4['query'][_0x1180('0x1d')]);}_0x40ff04[_0x1180('0x3a')]=qs[_0x1180('0x3b')](_0x4dacb4[_0x1180('0x31')][_0x1180('0x3b')]);_0x40ff04[_0x1180('0x3c')]=qs[_0x1180('0x33')](_['pick'](_0x4dacb4[_0x1180('0x31')],_0xa0fa0c['filters']),_0x35c9d0);if(_0x4dacb4[_0x1180('0x31')][_0x1180('0x3d')]){_0x40ff04[_0x1180('0x3c')]=_['merge'](_0x40ff04[_0x1180('0x3c')],{'$or':_[_0x1180('0x2c')](_0x35c9d0,function(_0x55d451){if(_0x55d451[_0x1180('0x3e')]!=='VIRTUAL'){var _0x84ffdd={};_0x84ffdd[_0x55d451[_0x1180('0x29')]]={'$like':'%'+_0x4dacb4[_0x1180('0x31')]['filter']+'%'};return _0x84ffdd;}})});}_0x40ff04=_[_0x1180('0x3f')]({},_0x40ff04,_0x4dacb4[_0x1180('0x40')]);var _0x302bf1={'where':_0x40ff04[_0x1180('0x3c')]};return db[_0x1180('0x2d')]['count'](_0x302bf1)[_0x1180('0x25')](function(_0x51838a){_0x5b46fe[_0x1180('0x1f')]=_0x51838a;if(_0x4dacb4['query'][_0x1180('0x41')]){_0x40ff04[_0x1180('0x42')]=[{'all':!![]}];}return db[_0x1180('0x2d')][_0x1180('0x43')](_0x40ff04);})[_0x1180('0x25')](function(_0x463248){_0x5b46fe[_0x1180('0x44')]=_0x463248;return _0x5b46fe;})['then'](respondWithFilteredResult(_0x50d2db,_0x40ff04))[_0x1180('0x45')](handleError(_0x50d2db,null));};exports[_0x1180('0x46')]=function(_0x3ca25c,_0x160712){var _0x314ea3={'raw':![],'where':{'id':_0x3ca25c[_0x1180('0x47')]['id']}},_0x497327={};_0x497327['model']=_[_0x1180('0x32')](db[_0x1180('0x2d')][_0x1180('0x48')]);_0x497327[_0x1180('0x31')]=_['keys'](_0x3ca25c['query']);_0x497327[_0x1180('0x33')]=_['intersection'](_0x497327[_0x1180('0x30')],_0x497327['query']);_0x314ea3[_0x1180('0x35')]=_[_0x1180('0x34')](_0x497327[_0x1180('0x30')],qs[_0x1180('0x36')](_0x3ca25c[_0x1180('0x31')][_0x1180('0x36')]));_0x314ea3[_0x1180('0x35')]=_0x314ea3[_0x1180('0x35')][_0x1180('0x37')]?_0x314ea3[_0x1180('0x35')]:_0x497327[_0x1180('0x30')];if(_0x3ca25c[_0x1180('0x31')][_0x1180('0x41')]){_0x314ea3[_0x1180('0x42')]=[{'all':!![]}];}_0x314ea3=_[_0x1180('0x3f')]({},_0x314ea3,_0x3ca25c[_0x1180('0x40')]);return db[_0x1180('0x2d')][_0x1180('0x49')](_0x314ea3)[_0x1180('0x25')](handleEntityNotFound(_0x160712,null))[_0x1180('0x25')](respondWithResult(_0x160712,null))[_0x1180('0x45')](handleError(_0x160712,null));};exports[_0x1180('0x4a')]=function(_0x19b5af,_0x530c5e){return db[_0x1180('0x2d')]['create'](_0x19b5af[_0x1180('0x4b')],{})[_0x1180('0x25')](respondWithResult(_0x530c5e,0xc9))['catch'](handleError(_0x530c5e,null));};exports[_0x1180('0x4c')]=function(_0x4bb155,_0x1f7d56){if(_0x4bb155[_0x1180('0x4b')]['id']){delete _0x4bb155[_0x1180('0x4b')]['id'];}return db[_0x1180('0x2d')][_0x1180('0x49')]({'where':{'id':_0x4bb155[_0x1180('0x47')]['id']}})[_0x1180('0x25')](handleEntityNotFound(_0x1f7d56,null))[_0x1180('0x25')](saveUpdates(_0x4bb155[_0x1180('0x4b')],null))['then'](respondWithResult(_0x1f7d56,null))[_0x1180('0x45')](handleError(_0x1f7d56,null));};exports[_0x1180('0x24')]=function(_0x769d46,_0x211761){return db[_0x1180('0x2d')][_0x1180('0x49')]({'where':{'id':_0x769d46[_0x1180('0x47')]['id']}})['then'](handleEntityNotFound(_0x211761,null))[_0x1180('0x25')](removeEntity(_0x211761,null))[_0x1180('0x45')](handleError(_0x211761,null));};exports['getFields']=function(_0x1770cb,_0x1126c1,_0x59f574){var _0x1eb063={};var _0x2eef57={};var _0x2b445e;var _0x2deb62;return db['ZohoConfiguration'][_0x1180('0x4d')]({'where':{'id':_0x1770cb[_0x1180('0x47')]['id']}})[_0x1180('0x25')](handleEntityNotFound(_0x1126c1,null))[_0x1180('0x25')](function(_0x3eb1aa){if(_0x3eb1aa){_0x2b445e=_0x3eb1aa;_0x2eef57['model']=_[_0x1180('0x32')](db['ZohoField'][_0x1180('0x48')]);_0x2eef57[_0x1180('0x31')]=_[_0x1180('0x32')](_0x1770cb[_0x1180('0x31')]);_0x2eef57[_0x1180('0x33')]=_[_0x1180('0x34')](_0x2eef57[_0x1180('0x30')],_0x2eef57['query']);_0x1eb063['attributes']=_[_0x1180('0x34')](_0x2eef57[_0x1180('0x30')],qs[_0x1180('0x36')](_0x1770cb[_0x1180('0x31')]['fields']));_0x1eb063[_0x1180('0x35')]=_0x1eb063[_0x1180('0x35')][_0x1180('0x37')]?_0x1eb063['attributes']:_0x2eef57['model'];_0x1eb063['order']=qs[_0x1180('0x3b')](_0x1770cb[_0x1180('0x31')][_0x1180('0x3b')]);_0x1eb063[_0x1180('0x3c')]=qs[_0x1180('0x33')](_[_0x1180('0x4e')](_0x1770cb[_0x1180('0x31')],_0x2eef57[_0x1180('0x33')]));if(_0x1770cb[_0x1180('0x31')][_0x1180('0x3d')]){_0x1eb063[_0x1180('0x3c')]=_[_0x1180('0x3f')](_0x1eb063[_0x1180('0x3c')],{'$or':_['map'](_0x1eb063['attributes'],function(_0x303467){var _0x17b019={};_0x17b019[_0x303467]={'$like':'%'+_0x1770cb[_0x1180('0x31')][_0x1180('0x3d')]+'%'};return _0x17b019;})});}_0x1eb063=_[_0x1180('0x3f')]({},_0x1eb063,_0x1770cb['options']);return _0x2b445e[_0x1180('0x4f')](_0x1eb063);}})[_0x1180('0x25')](function(_0x472e91){if(_0x472e91){_0x2deb62=_0x472e91[_0x1180('0x37')];if(!_0x1770cb[_0x1180('0x31')][_0x1180('0x38')]('nolimit')){_0x1eb063[_0x1180('0x20')]=qs[_0x1180('0x20')](_0x1770cb['query'][_0x1180('0x20')]);_0x1eb063[_0x1180('0x1d')]=qs[_0x1180('0x1d')](_0x1770cb[_0x1180('0x31')][_0x1180('0x1d')]);}return _0x2b445e['getFields'](_0x1eb063);}})[_0x1180('0x25')](function(_0x16687b){if(_0x16687b){return _0x16687b?{'count':_0x2deb62,'rows':_0x16687b}:null;}})['then'](respondWithResult(_0x1126c1,null))[_0x1180('0x45')](handleError(_0x1126c1,null));};exports[_0x1180('0x50')]=function(_0x12dcfd,_0x47fbd8,_0xa2229c){var _0xc028be={};var _0xed656={};var _0x1a02ab;var _0x24a54c;return db[_0x1180('0x2d')]['findOne']({'where':{'id':_0x12dcfd[_0x1180('0x47')]['id']}})[_0x1180('0x25')](handleEntityNotFound(_0x47fbd8,null))[_0x1180('0x25')](function(_0x5d615a){if(_0x5d615a){_0x1a02ab=_0x5d615a;_0xed656[_0x1180('0x30')]=_[_0x1180('0x32')](db[_0x1180('0x51')]['rawAttributes']);_0xed656[_0x1180('0x31')]=_[_0x1180('0x32')](_0x12dcfd[_0x1180('0x31')]);_0xed656[_0x1180('0x33')]=_[_0x1180('0x34')](_0xed656['model'],_0xed656[_0x1180('0x31')]);_0xc028be[_0x1180('0x35')]=_[_0x1180('0x34')](_0xed656['model'],qs['fields'](_0x12dcfd[_0x1180('0x31')][_0x1180('0x36')]));_0xc028be[_0x1180('0x35')]=_0xc028be[_0x1180('0x35')]['length']?_0xc028be['attributes']:_0xed656[_0x1180('0x30')];_0xc028be[_0x1180('0x3a')]=qs[_0x1180('0x3b')](_0x12dcfd['query'][_0x1180('0x3b')]);_0xc028be[_0x1180('0x3c')]=qs[_0x1180('0x33')](_['pick'](_0x12dcfd[_0x1180('0x31')],_0xed656[_0x1180('0x33')]));if(_0x12dcfd[_0x1180('0x31')][_0x1180('0x3d')]){_0xc028be[_0x1180('0x3c')]=_[_0x1180('0x3f')](_0xc028be['where'],{'$or':_['map'](_0xc028be['attributes'],function(_0x21b2bc){var _0x26f18e={};_0x26f18e[_0x21b2bc]={'$like':'%'+_0x12dcfd[_0x1180('0x31')][_0x1180('0x3d')]+'%'};return _0x26f18e;})});}_0xc028be=_[_0x1180('0x3f')]({},_0xc028be,_0x12dcfd[_0x1180('0x40')]);return _0x1a02ab['getSubjects'](_0xc028be);}})['then'](function(_0x23bb5e){if(_0x23bb5e){_0x24a54c=_0x23bb5e[_0x1180('0x37')];if(!_0x12dcfd['query'][_0x1180('0x38')]('nolimit')){_0xc028be[_0x1180('0x20')]=qs['limit'](_0x12dcfd[_0x1180('0x31')][_0x1180('0x20')]);_0xc028be['offset']=qs[_0x1180('0x1d')](_0x12dcfd[_0x1180('0x31')]['offset']);}return _0x1a02ab[_0x1180('0x50')](_0xc028be);}})[_0x1180('0x25')](function(_0x98e0da){if(_0x98e0da){return _0x98e0da?{'count':_0x24a54c,'rows':_0x98e0da}:null;}})[_0x1180('0x25')](respondWithResult(_0x47fbd8,null))[_0x1180('0x45')](handleError(_0x47fbd8,null));};exports['getDescriptions']=function(_0x1e2f6c,_0x1d2983,_0x480212){var _0x5e649b={};var _0x3722cb={};var _0x5f0400;var _0x2e5b68;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x1e2f6c[_0x1180('0x47')]['id']}})[_0x1180('0x25')](handleEntityNotFound(_0x1d2983,null))[_0x1180('0x25')](function(_0x233d1c){if(_0x233d1c){_0x5f0400=_0x233d1c;_0x3722cb[_0x1180('0x30')]=_[_0x1180('0x32')](db[_0x1180('0x51')][_0x1180('0x48')]);_0x3722cb[_0x1180('0x31')]=_[_0x1180('0x32')](_0x1e2f6c[_0x1180('0x31')]);_0x3722cb[_0x1180('0x33')]=_[_0x1180('0x34')](_0x3722cb[_0x1180('0x30')],_0x3722cb[_0x1180('0x31')]);_0x5e649b[_0x1180('0x35')]=_[_0x1180('0x34')](_0x3722cb[_0x1180('0x30')],qs[_0x1180('0x36')](_0x1e2f6c[_0x1180('0x31')]['fields']));_0x5e649b[_0x1180('0x35')]=_0x5e649b[_0x1180('0x35')][_0x1180('0x37')]?_0x5e649b[_0x1180('0x35')]:_0x3722cb['model'];_0x5e649b[_0x1180('0x3a')]=qs[_0x1180('0x3b')](_0x1e2f6c[_0x1180('0x31')][_0x1180('0x3b')]);_0x5e649b['where']=qs[_0x1180('0x33')](_[_0x1180('0x4e')](_0x1e2f6c[_0x1180('0x31')],_0x3722cb[_0x1180('0x33')]));if(_0x1e2f6c[_0x1180('0x31')][_0x1180('0x3d')]){_0x5e649b[_0x1180('0x3c')]=_[_0x1180('0x3f')](_0x5e649b[_0x1180('0x3c')],{'$or':_[_0x1180('0x2c')](_0x5e649b[_0x1180('0x35')],function(_0x4a97ef){var _0x2cede4={};_0x2cede4[_0x4a97ef]={'$like':'%'+_0x1e2f6c[_0x1180('0x31')]['filter']+'%'};return _0x2cede4;})});}_0x5e649b=_['merge']({},_0x5e649b,_0x1e2f6c['options']);return _0x5f0400[_0x1180('0x52')](_0x5e649b);}})[_0x1180('0x25')](function(_0x831c46){if(_0x831c46){_0x2e5b68=_0x831c46[_0x1180('0x37')];if(!_0x1e2f6c[_0x1180('0x31')][_0x1180('0x38')](_0x1180('0x39'))){_0x5e649b[_0x1180('0x20')]=qs[_0x1180('0x20')](_0x1e2f6c[_0x1180('0x31')][_0x1180('0x20')]);_0x5e649b[_0x1180('0x1d')]=qs['offset'](_0x1e2f6c[_0x1180('0x31')]['offset']);}return _0x5f0400[_0x1180('0x52')](_0x5e649b);}})['then'](function(_0x21d4b9){if(_0x21d4b9){return _0x21d4b9?{'count':_0x2e5b68,'rows':_0x21d4b9}:null;}})['then'](respondWithResult(_0x1d2983,null))[_0x1180('0x45')](handleError(_0x1d2983,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 7f094f2..58e1df2 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.model.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecf4=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xecf4,0xe5));var _0x4ecf=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xecf4[_0xf26c2e];return _0x46ecb4;};'use strict';var _=require(_0x4ecf('0x0'));var util=require(_0x4ecf('0x1'));var logger=require(_0x4ecf('0x2'))(_0x4ecf('0x3'));var moment=require(_0x4ecf('0x4'));var BPromise=require('bluebird');var rp=require(_0x4ecf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ecf('0x6'));var config=require(_0x4ecf('0x7'));var attributes=require(_0x4ecf('0x8'));module['exports']=function(_0x1d0a8b,_0x453fa6){return _0x1d0a8b[_0x4ecf('0x9')](_0x4ecf('0xa'),attributes,{'tableName':_0x4ecf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3929=['int_zoho_configurations','util','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x3929,0xc1));var _0x9392=function(_0x3287c0,_0x24165a){_0x3287c0=_0x3287c0-0x0;var _0x5316e3=_0x3929[_0x3287c0];return _0x5316e3;};'use strict';var _=require('lodash');var util=require(_0x9392('0x0'));var logger=require('../../config/logger')(_0x9392('0x1'));var moment=require(_0x9392('0x2'));var BPromise=require(_0x9392('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9392('0x4'));var rimraf=require(_0x9392('0x5'));var config=require(_0x9392('0x6'));var attributes=require(_0x9392('0x7'));module[_0x9392('0x8')]=function(_0x44140d,_0x4d2900){return _0x44140d[_0x9392('0x9')](_0x9392('0xa'),attributes,{'tableName':_0x9392('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 2c9333c..d1174bf 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5df5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x5df5,0x12b));var _0x55df=function(_0x18ab71,_0x4a8b13){_0x18ab71=_0x18ab71-0x0;var _0x2d05a4=_0x5df5[_0x18ab71];return _0x2d05a4;};'use strict';var _=require(_0x55df('0x0'));var util=require(_0x55df('0x1'));var moment=require(_0x55df('0x2'));var BPromise=require('bluebird');var rs=require(_0x55df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55df('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x55df('0x5'))(_0x55df('0x6'));var config=require(_0x55df('0x7'));var jayson=require(_0x55df('0x8'));var client=jayson[_0x55df('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3338af,_0x2cc636,_0x609508){return new BPromise(function(_0x5da8d2,_0x961523){return client[_0x55df('0xa')](_0x3338af,_0x609508)[_0x55df('0xb')](function(_0x5783d){logger[_0x55df('0xc')](_0x55df('0xd'),_0x2cc636,_0x55df('0xe'));logger['debug'](_0x55df('0xf'),_0x2cc636,_0x55df('0xe'),JSON['stringify'](_0x5783d));if(_0x5783d['error']){if(_0x5783d['error']['code']===0x1f4){logger[_0x55df('0x10')](_0x55df('0xd'),_0x2cc636,_0x5783d[_0x55df('0x10')][_0x55df('0x11')]);return _0x961523(_0x5783d[_0x55df('0x10')][_0x55df('0x11')]);}logger[_0x55df('0x10')](_0x55df('0xd'),_0x2cc636,_0x5783d[_0x55df('0x10')]['message']);return _0x5da8d2(_0x5783d[_0x55df('0x10')][_0x55df('0x11')]);}else{logger[_0x55df('0xc')](_0x55df('0xd'),_0x2cc636,_0x55df('0xe'));_0x5da8d2(_0x5783d[_0x55df('0x12')][_0x55df('0x11')]);}})['catch'](function(_0xf3aa06){logger[_0x55df('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x2cc636,_0xf3aa06);_0x961523(_0xf3aa06);});});} \ No newline at end of file +var _0xed77=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cbd10,_0x4761ff){var _0x67dcd=function(_0x8cf6c4){while(--_0x8cf6c4){_0x3cbd10['push'](_0x3cbd10['shift']());}};_0x67dcd(++_0x4761ff);}(_0xed77,0x70));var _0x7ed7=function(_0x5a6cc8,_0x33a918){_0x5a6cc8=_0x5a6cc8-0x0;var _0x2628af=_0xed77[_0x5a6cc8];return _0x2628af;};'use strict';var _=require(_0x7ed7('0x0'));var util=require(_0x7ed7('0x1'));var moment=require(_0x7ed7('0x2'));var BPromise=require(_0x7ed7('0x3'));var rs=require(_0x7ed7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ed7('0x5'))['db'];var utils=require(_0x7ed7('0x6'));var logger=require(_0x7ed7('0x7'))(_0x7ed7('0x8'));var config=require(_0x7ed7('0x9'));var jayson=require(_0x7ed7('0xa'));var client=jayson['client'][_0x7ed7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x250cca,_0x484986,_0x171231){return new BPromise(function(_0x40aecf,_0x5132c1){return client['request'](_0x250cca,_0x171231)[_0x7ed7('0xc')](function(_0x4ea5ba){logger[_0x7ed7('0xd')](_0x7ed7('0xe'),_0x484986,_0x7ed7('0xf'));logger[_0x7ed7('0x10')](_0x7ed7('0x11'),_0x484986,_0x7ed7('0xf'),JSON[_0x7ed7('0x12')](_0x4ea5ba));if(_0x4ea5ba[_0x7ed7('0x13')]){if(_0x4ea5ba[_0x7ed7('0x13')]['code']===0x1f4){logger[_0x7ed7('0x13')](_0x7ed7('0xe'),_0x484986,_0x4ea5ba['error'][_0x7ed7('0x14')]);return _0x5132c1(_0x4ea5ba[_0x7ed7('0x13')]['message']);}logger[_0x7ed7('0x13')](_0x7ed7('0xe'),_0x484986,_0x4ea5ba[_0x7ed7('0x13')]['message']);return _0x40aecf(_0x4ea5ba[_0x7ed7('0x13')][_0x7ed7('0x14')]);}else{logger[_0x7ed7('0xd')](_0x7ed7('0xe'),_0x484986,'request\x20sent');_0x40aecf(_0x4ea5ba[_0x7ed7('0x15')][_0x7ed7('0x14')]);}})['catch'](function(_0x377bbd){logger['error'](_0x7ed7('0xe'),_0x484986,_0x377bbd);_0x5132c1(_0x377bbd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d22c778..e9f17a2 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2851=['connect-timeout','express','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x43a856,_0x46c6b1){var _0x32a559=function(_0x5db1db){while(--_0x5db1db){_0x43a856['push'](_0x43a856['shift']());}};_0x32a559(++_0x46c6b1);}(_0x2851,0x153));var _0x1285=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2851[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1285('0x0'));var util=require(_0x1285('0x1'));var path=require(_0x1285('0x2'));var timeout=require(_0x1285('0x3'));var express=require(_0x1285('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1285('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1285('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1285('0x7')]);router[_0x1285('0x8')](_0x1285('0x9'),auth[_0x1285('0xa')](),controller[_0x1285('0xb')]);router[_0x1285('0xc')]('/',auth['isAuthenticated'](),controller[_0x1285('0xd')]);router[_0x1285('0xe')](_0x1285('0x9'),auth[_0x1285('0xa')](),controller[_0x1285('0xf')]);router[_0x1285('0x10')](_0x1285('0x9'),auth[_0x1285('0xa')](),controller['destroy']);module[_0x1285('0x11')]=router; \ No newline at end of file +var _0xd4d1=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','post','create'];(function(_0x535dcf,_0x2b22d0){var _0x18fcae=function(_0x55cbba){while(--_0x55cbba){_0x535dcf['push'](_0x535dcf['shift']());}};_0x18fcae(++_0x2b22d0);}(_0xd4d1,0x123));var _0x1d4d=function(_0x4bdac1,_0x1545d4){_0x4bdac1=_0x4bdac1-0x0;var _0x1d19f5=_0xd4d1[_0x4bdac1];return _0x1d19f5;};'use strict';var multer=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var path=require(_0x1d4d('0x2'));var timeout=require(_0x1d4d('0x3'));var express=require(_0x1d4d('0x4'));var router=express['Router']();var fs_extra=require(_0x1d4d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1d4d('0x6'));var config=require('../../config/environment');var controller=require(_0x1d4d('0x7'));router['get']('/',auth[_0x1d4d('0x8')](),controller[_0x1d4d('0x9')]);router[_0x1d4d('0xa')]('/:id',auth[_0x1d4d('0x8')](),controller['show']);router[_0x1d4d('0xb')]('/',auth['isAuthenticated'](),controller[_0x1d4d('0xc')]);router[_0x1d4d('0xd')](_0x1d4d('0xe'),auth['isAuthenticated'](),controller[_0x1d4d('0xf')]);router[_0x1d4d('0x10')](_0x1d4d('0xe'),auth['isAuthenticated'](),controller[_0x1d4d('0x11')]);module[_0x1d4d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 0c4d0ca..6cc0703 100644 --- a/server/api/intZohoField/intZohoField.attributes.js +++ b/server/api/intZohoField/intZohoField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa825=['picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue'];(function(_0x199c3a,_0x4fa49f){var _0x2d50f0=function(_0x3c7442){while(--_0x3c7442){_0x199c3a['push'](_0x199c3a['shift']());}};_0x2d50f0(++_0x4fa49f);}(_0xa825,0x136));var _0x5a82=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa825[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x5a82('0x0'));module['exports']={'type':{'type':Sequelize[_0x5a82('0x1')](_0x5a82('0x2'),_0x5a82('0x3'),'customVariable',_0x5a82('0x4'),_0x5a82('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5a82('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5a82('0x2'),'variable',_0x5a82('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5a82('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5a82('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55e2=['STRING','ENUM','variable','customVariable','string'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x55e2,0x173));var _0x255e=function(_0x5714de,_0x336fb2){_0x5714de=_0x5714de-0x0;var _0x58d692=_0x55e2[_0x5714de];return _0x58d692;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x255e('0x0')]('string',_0x255e('0x1'),_0x255e('0x2'),'keyValue','picklist'),'defaultValue':_0x255e('0x3')},'content':{'type':Sequelize[_0x255e('0x4')]},'key':{'type':Sequelize[_0x255e('0x4')]},'keyType':{'type':Sequelize[_0x255e('0x0')](_0x255e('0x3'),_0x255e('0x1'),_0x255e('0x2'))},'keyContent':{'type':Sequelize[_0x255e('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x255e('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x255e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d64390a..5ad8b9e 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9fb=['merge','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x4f3b3c,_0x4257c4){var _0x25c181=function(_0x5de512){while(--_0x5de512){_0x4f3b3c['push'](_0x4f3b3c['shift']());}};_0x25c181(++_0x4257c4);}(_0xd9fb,0x9f));var _0xbd9f=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd9fb[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0xbd9f('0x0'));var rimraf=require(_0xbd9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd9f('0x2'));var rp=require(_0xbd9f('0x3'));var moment=require('moment');var BPromise=require(_0xbd9f('0x4'));var Mustache=require(_0xbd9f('0x5'));var util=require('util');var path=require(_0xbd9f('0x6'));var sox=require(_0xbd9f('0x7'));var csv=require(_0xbd9f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd9f('0x9'));var squel=require(_0xbd9f('0xa'));var crypto=require(_0xbd9f('0xb'));var jsforce=require(_0xbd9f('0xc'));var deskjs=require(_0xbd9f('0xd'));var toCsv=require(_0xbd9f('0x8'));var querystring=require(_0xbd9f('0xe'));var Papa=require(_0xbd9f('0xf'));var Redis=require(_0xbd9f('0x10'));var authService=require(_0xbd9f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbd9f('0x12'));var hardwareService=require(_0xbd9f('0x13'));var logger=require('../../config/logger')(_0xbd9f('0x14'));var utils=require(_0xbd9f('0x15'));var config=require(_0xbd9f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd9f('0x17'))['db'];function respondWithStatusCode(_0x2440bd,_0x585174){_0x585174=_0x585174||0xcc;return function(_0x2db2cb){if(_0x2db2cb){return _0x2440bd['sendStatus'](_0x585174);}return _0x2440bd['status'](_0x585174)[_0xbd9f('0x18')]();};}function respondWithResult(_0x177b0a,_0x1b0ac8){_0x1b0ac8=_0x1b0ac8||0xc8;return function(_0x23053a){if(_0x23053a){return _0x177b0a[_0xbd9f('0x19')](_0x1b0ac8)[_0xbd9f('0x1a')](_0x23053a);}};}function respondWithFilteredResult(_0x5e205b,_0x2ad94a){return function(_0x424aa6){if(_0x424aa6){var _0x68329=typeof _0x2ad94a[_0xbd9f('0x1b')]===_0xbd9f('0x1c')&&typeof _0x2ad94a[_0xbd9f('0x1d')]===_0xbd9f('0x1c');var _0x5450fc=_0x424aa6[_0xbd9f('0x1e')];var _0x2d1101=_0x68329?0x0:_0x2ad94a['offset'];var _0xcf7869=_0x68329?_0x424aa6[_0xbd9f('0x1e')]:_0x2ad94a[_0xbd9f('0x1b')]+_0x2ad94a[_0xbd9f('0x1d')];var _0x4cc9d8;if(_0xcf7869>=_0x5450fc){_0xcf7869=_0x5450fc;_0x4cc9d8=0xc8;}else{_0x4cc9d8=0xce;}_0x5e205b[_0xbd9f('0x19')](_0x4cc9d8);return _0x5e205b[_0xbd9f('0x1f')](_0xbd9f('0x20'),_0x2d1101+'-'+_0xcf7869+'/'+_0x5450fc)[_0xbd9f('0x1a')](_0x424aa6);}return null;};}function patchUpdates(_0x2a21be){return function(_0x28b01c){try{jsonpatch['apply'](_0x28b01c,_0x2a21be,!![]);}catch(_0x230ef7){return BPromise[_0xbd9f('0x21')](_0x230ef7);}return _0x28b01c[_0xbd9f('0x22')]();};}function saveUpdates(_0xf77227,_0x599262){return function(_0x330f7a){if(_0x330f7a){return _0x330f7a[_0xbd9f('0x23')](_0xf77227)[_0xbd9f('0x24')](function(_0x9ca44f){return _0x9ca44f;});}return null;};}function removeEntity(_0x5e8905,_0x46e8bc){return function(_0x25abc2){if(_0x25abc2){return _0x25abc2[_0xbd9f('0x25')]()['then'](function(){_0x5e8905[_0xbd9f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32db65,_0x26e47e){return function(_0xfef22b){if(!_0xfef22b){_0x32db65[_0xbd9f('0x26')](0x194);}return _0xfef22b;};}function handleError(_0x5ca49b,_0x4bc83b){_0x4bc83b=_0x4bc83b||0x1f4;return function(_0x4a818f){logger[_0xbd9f('0x27')](_0x4a818f[_0xbd9f('0x28')]);if(_0x4a818f[_0xbd9f('0x29')]){delete _0x4a818f[_0xbd9f('0x29')];}_0x5ca49b[_0xbd9f('0x19')](_0x4bc83b)[_0xbd9f('0x2a')](_0x4a818f);};}exports['index']=function(_0x1fe1b7,_0x2155b8){var _0x4770f7={},_0x37eb44={},_0x26f3cc={'count':0x0,'rows':[]};var _0x52807b=_[_0xbd9f('0x2b')](db[_0xbd9f('0x2c')][_0xbd9f('0x2d')],function(_0x4bcb19){return{'name':_0x4bcb19[_0xbd9f('0x2e')],'type':_0x4bcb19[_0xbd9f('0x2f')][_0xbd9f('0x30')]};});_0x37eb44[_0xbd9f('0x31')]=_['map'](_0x52807b,_0xbd9f('0x29'));_0x37eb44[_0xbd9f('0x32')]=_[_0xbd9f('0x33')](_0x1fe1b7['query']);_0x37eb44[_0xbd9f('0x34')]=_[_0xbd9f('0x35')](_0x37eb44[_0xbd9f('0x31')],_0x37eb44[_0xbd9f('0x32')]);_0x4770f7['attributes']=_[_0xbd9f('0x35')](_0x37eb44[_0xbd9f('0x31')],qs[_0xbd9f('0x36')](_0x1fe1b7[_0xbd9f('0x32')][_0xbd9f('0x36')]));_0x4770f7[_0xbd9f('0x37')]=_0x4770f7[_0xbd9f('0x37')][_0xbd9f('0x38')]?_0x4770f7[_0xbd9f('0x37')]:_0x37eb44[_0xbd9f('0x31')];if(!_0x1fe1b7[_0xbd9f('0x32')][_0xbd9f('0x39')](_0xbd9f('0x3a'))){_0x4770f7['limit']=qs[_0xbd9f('0x1d')](_0x1fe1b7[_0xbd9f('0x32')][_0xbd9f('0x1d')]);_0x4770f7['offset']=qs[_0xbd9f('0x1b')](_0x1fe1b7[_0xbd9f('0x32')][_0xbd9f('0x1b')]);}_0x4770f7[_0xbd9f('0x3b')]=qs[_0xbd9f('0x3c')](_0x1fe1b7[_0xbd9f('0x32')][_0xbd9f('0x3c')]);_0x4770f7[_0xbd9f('0x3d')]=qs['filters'](_['pick'](_0x1fe1b7[_0xbd9f('0x32')],_0x37eb44['filters']),_0x52807b);if(_0x1fe1b7['query'][_0xbd9f('0x3e')]){_0x4770f7[_0xbd9f('0x3d')]=_['merge'](_0x4770f7[_0xbd9f('0x3d')],{'$or':_[_0xbd9f('0x2b')](_0x52807b,function(_0x3974a1){if(_0x3974a1[_0xbd9f('0x2f')]!=='VIRTUAL'){var _0x4f12d3={};_0x4f12d3[_0x3974a1['name']]={'$like':'%'+_0x1fe1b7[_0xbd9f('0x32')][_0xbd9f('0x3e')]+'%'};return _0x4f12d3;}})});}_0x4770f7=_[_0xbd9f('0x3f')]({},_0x4770f7,_0x1fe1b7[_0xbd9f('0x40')]);var _0x884989={'where':_0x4770f7['where']};return db['ZohoField'][_0xbd9f('0x1e')](_0x884989)[_0xbd9f('0x24')](function(_0x189653){_0x26f3cc[_0xbd9f('0x1e')]=_0x189653;if(_0x1fe1b7[_0xbd9f('0x32')][_0xbd9f('0x41')]){_0x4770f7[_0xbd9f('0x42')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x4770f7);})[_0xbd9f('0x24')](function(_0x2dca6d){_0x26f3cc[_0xbd9f('0x43')]=_0x2dca6d;return _0x26f3cc;})[_0xbd9f('0x24')](respondWithFilteredResult(_0x2155b8,_0x4770f7))[_0xbd9f('0x44')](handleError(_0x2155b8,null));};exports[_0xbd9f('0x45')]=function(_0x37cab2,_0x1c447e){var _0x4b4f5c={'raw':!![],'where':{'id':_0x37cab2[_0xbd9f('0x46')]['id']}},_0x117fe0={};_0x117fe0[_0xbd9f('0x31')]=_[_0xbd9f('0x33')](db[_0xbd9f('0x2c')]['rawAttributes']);_0x117fe0[_0xbd9f('0x32')]=_[_0xbd9f('0x33')](_0x37cab2['query']);_0x117fe0[_0xbd9f('0x34')]=_[_0xbd9f('0x35')](_0x117fe0[_0xbd9f('0x31')],_0x117fe0[_0xbd9f('0x32')]);_0x4b4f5c['attributes']=_[_0xbd9f('0x35')](_0x117fe0[_0xbd9f('0x31')],qs[_0xbd9f('0x36')](_0x37cab2[_0xbd9f('0x32')][_0xbd9f('0x36')]));_0x4b4f5c['attributes']=_0x4b4f5c[_0xbd9f('0x37')][_0xbd9f('0x38')]?_0x4b4f5c[_0xbd9f('0x37')]:_0x117fe0[_0xbd9f('0x31')];if(_0x37cab2[_0xbd9f('0x32')][_0xbd9f('0x41')]){_0x4b4f5c[_0xbd9f('0x42')]=[{'all':!![]}];}_0x4b4f5c=_[_0xbd9f('0x3f')]({},_0x4b4f5c,_0x37cab2[_0xbd9f('0x40')]);return db[_0xbd9f('0x2c')][_0xbd9f('0x47')](_0x4b4f5c)[_0xbd9f('0x24')](handleEntityNotFound(_0x1c447e,null))[_0xbd9f('0x24')](respondWithResult(_0x1c447e,null))['catch'](handleError(_0x1c447e,null));};exports[_0xbd9f('0x48')]=function(_0x549c36,_0x724bb1){return db['ZohoField'][_0xbd9f('0x48')](_0x549c36[_0xbd9f('0x49')],{})['then'](respondWithResult(_0x724bb1,0xc9))[_0xbd9f('0x44')](handleError(_0x724bb1,null));};exports[_0xbd9f('0x23')]=function(_0xdb9888,_0xbe488c){if(_0xdb9888[_0xbd9f('0x49')]['id']){delete _0xdb9888[_0xbd9f('0x49')]['id'];}return db[_0xbd9f('0x2c')]['find']({'where':{'id':_0xdb9888[_0xbd9f('0x46')]['id']}})[_0xbd9f('0x24')](handleEntityNotFound(_0xbe488c,null))[_0xbd9f('0x24')](saveUpdates(_0xdb9888['body'],null))[_0xbd9f('0x24')](respondWithResult(_0xbe488c,null))[_0xbd9f('0x44')](handleError(_0xbe488c,null));};exports[_0xbd9f('0x25')]=function(_0x673f0a,_0x4763d5){return db[_0xbd9f('0x2c')][_0xbd9f('0x47')]({'where':{'id':_0x673f0a['params']['id']}})[_0xbd9f('0x24')](handleEntityNotFound(_0x4763d5,null))['then'](removeEntity(_0x4763d5,null))[_0xbd9f('0x44')](handleError(_0x4763d5,null));}; \ No newline at end of file +var _0x2d7b=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','Content-Range','apply','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','ZohoField','count','includeAll','findAll','catch','params','include','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x44daf1,_0x14874a){var _0x493ec0=function(_0x4b8603){while(--_0x4b8603){_0x44daf1['push'](_0x44daf1['shift']());}};_0x493ec0(++_0x14874a);}(_0x2d7b,0x1ee));var _0xb2d7=function(_0x321943,_0x5a95c5){_0x321943=_0x321943-0x0;var _0x4617a6=_0x2d7b[_0x321943];return _0x4617a6;};'use strict';var emlformat=require(_0xb2d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2d7('0x1'));var jsonpatch=require(_0xb2d7('0x2'));var rp=require(_0xb2d7('0x3'));var moment=require(_0xb2d7('0x4'));var BPromise=require(_0xb2d7('0x5'));var Mustache=require(_0xb2d7('0x6'));var util=require(_0xb2d7('0x7'));var path=require(_0xb2d7('0x8'));var sox=require(_0xb2d7('0x9'));var csv=require(_0xb2d7('0xa'));var ejs=require(_0xb2d7('0xb'));var fs=require('fs');var fs_extra=require(_0xb2d7('0xc'));var _=require(_0xb2d7('0xd'));var squel=require(_0xb2d7('0xe'));var crypto=require('crypto');var jsforce=require(_0xb2d7('0xf'));var deskjs=require(_0xb2d7('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb2d7('0x11'));var authService=require(_0xb2d7('0x12'));var qs=require(_0xb2d7('0x13'));var as=require(_0xb2d7('0x14'));var hardwareService=require(_0xb2d7('0x15'));var logger=require(_0xb2d7('0x16'))(_0xb2d7('0x17'));var utils=require('../../config/utils');var config=require(_0xb2d7('0x18'));var licenseUtil=require(_0xb2d7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b969f,_0x4358a1){_0x4358a1=_0x4358a1||0xcc;return function(_0x20018d){if(_0x20018d){return _0x1b969f['sendStatus'](_0x4358a1);}return _0x1b969f[_0xb2d7('0x1a')](_0x4358a1)[_0xb2d7('0x1b')]();};}function respondWithResult(_0x416588,_0x1e8a6a){_0x1e8a6a=_0x1e8a6a||0xc8;return function(_0x1ed9a5){if(_0x1ed9a5){return _0x416588[_0xb2d7('0x1a')](_0x1e8a6a)[_0xb2d7('0x1c')](_0x1ed9a5);}};}function respondWithFilteredResult(_0x49195d,_0x395d46){return function(_0x52c74e){if(_0x52c74e){var _0x39449d=typeof _0x395d46[_0xb2d7('0x1d')]==='undefined'&&typeof _0x395d46[_0xb2d7('0x1e')]===_0xb2d7('0x1f');var _0xa98ac9=_0x52c74e['count'];var _0x21712d=_0x39449d?0x0:_0x395d46[_0xb2d7('0x1d')];var _0x449ced=_0x39449d?_0x52c74e['count']:_0x395d46[_0xb2d7('0x1d')]+_0x395d46[_0xb2d7('0x1e')];var _0x27c626;if(_0x449ced>=_0xa98ac9){_0x449ced=_0xa98ac9;_0x27c626=0xc8;}else{_0x27c626=0xce;}_0x49195d['status'](_0x27c626);return _0x49195d['set'](_0xb2d7('0x20'),_0x21712d+'-'+_0x449ced+'/'+_0xa98ac9)[_0xb2d7('0x1c')](_0x52c74e);}return null;};}function patchUpdates(_0x393162){return function(_0x21a65d){try{jsonpatch[_0xb2d7('0x21')](_0x21a65d,_0x393162,!![]);}catch(_0x3b0a28){return BPromise['reject'](_0x3b0a28);}return _0x21a65d['save']();};}function saveUpdates(_0x5bd3f0,_0x430aba){return function(_0x593c7f){if(_0x593c7f){return _0x593c7f['update'](_0x5bd3f0)[_0xb2d7('0x22')](function(_0x3112b4){return _0x3112b4;});}return null;};}function removeEntity(_0x21d0c8,_0x1431e9){return function(_0x27dcaf){if(_0x27dcaf){return _0x27dcaf[_0xb2d7('0x23')]()['then'](function(){_0x21d0c8[_0xb2d7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2385f1,_0x4d0d01){return function(_0x3f1901){if(!_0x3f1901){_0x2385f1[_0xb2d7('0x24')](0x194);}return _0x3f1901;};}function handleError(_0x59ab10,_0x24a34c){_0x24a34c=_0x24a34c||0x1f4;return function(_0x55c0a5){logger[_0xb2d7('0x25')](_0x55c0a5['stack']);if(_0x55c0a5[_0xb2d7('0x26')]){delete _0x55c0a5[_0xb2d7('0x26')];}_0x59ab10[_0xb2d7('0x1a')](_0x24a34c)['send'](_0x55c0a5);};}exports[_0xb2d7('0x27')]=function(_0x4edc53,_0x2228a8){var _0x1d29a7={},_0x180508={},_0x279a88={'count':0x0,'rows':[]};var _0x36f0b1=_[_0xb2d7('0x28')](db['ZohoField'][_0xb2d7('0x29')],function(_0x1fb0f2){return{'name':_0x1fb0f2[_0xb2d7('0x2a')],'type':_0x1fb0f2[_0xb2d7('0x2b')][_0xb2d7('0x2c')]};});_0x180508['model']=_[_0xb2d7('0x28')](_0x36f0b1,_0xb2d7('0x26'));_0x180508[_0xb2d7('0x2d')]=_[_0xb2d7('0x2e')](_0x4edc53[_0xb2d7('0x2d')]);_0x180508[_0xb2d7('0x2f')]=_[_0xb2d7('0x30')](_0x180508[_0xb2d7('0x31')],_0x180508[_0xb2d7('0x2d')]);_0x1d29a7[_0xb2d7('0x32')]=_['intersection'](_0x180508[_0xb2d7('0x31')],qs[_0xb2d7('0x33')](_0x4edc53[_0xb2d7('0x2d')]['fields']));_0x1d29a7['attributes']=_0x1d29a7[_0xb2d7('0x32')]['length']?_0x1d29a7[_0xb2d7('0x32')]:_0x180508['model'];if(!_0x4edc53['query'][_0xb2d7('0x34')]('nolimit')){_0x1d29a7['limit']=qs[_0xb2d7('0x1e')](_0x4edc53[_0xb2d7('0x2d')][_0xb2d7('0x1e')]);_0x1d29a7[_0xb2d7('0x1d')]=qs[_0xb2d7('0x1d')](_0x4edc53[_0xb2d7('0x2d')]['offset']);}_0x1d29a7[_0xb2d7('0x35')]=qs[_0xb2d7('0x36')](_0x4edc53[_0xb2d7('0x2d')][_0xb2d7('0x36')]);_0x1d29a7['where']=qs['filters'](_[_0xb2d7('0x37')](_0x4edc53[_0xb2d7('0x2d')],_0x180508[_0xb2d7('0x2f')]),_0x36f0b1);if(_0x4edc53[_0xb2d7('0x2d')][_0xb2d7('0x38')]){_0x1d29a7['where']=_['merge'](_0x1d29a7[_0xb2d7('0x39')],{'$or':_['map'](_0x36f0b1,function(_0x19bdc1){if(_0x19bdc1['type']!==_0xb2d7('0x3a')){var _0x12fc5a={};_0x12fc5a[_0x19bdc1['name']]={'$like':'%'+_0x4edc53['query'][_0xb2d7('0x38')]+'%'};return _0x12fc5a;}})});}_0x1d29a7=_[_0xb2d7('0x3b')]({},_0x1d29a7,_0x4edc53[_0xb2d7('0x3c')]);var _0x3d1063={'where':_0x1d29a7[_0xb2d7('0x39')]};return db[_0xb2d7('0x3d')]['count'](_0x3d1063)['then'](function(_0x19fa85){_0x279a88[_0xb2d7('0x3e')]=_0x19fa85;if(_0x4edc53[_0xb2d7('0x2d')][_0xb2d7('0x3f')]){_0x1d29a7['include']=[{'all':!![]}];}return db['ZohoField'][_0xb2d7('0x40')](_0x1d29a7);})['then'](function(_0x233d10){_0x279a88['rows']=_0x233d10;return _0x279a88;})['then'](respondWithFilteredResult(_0x2228a8,_0x1d29a7))[_0xb2d7('0x41')](handleError(_0x2228a8,null));};exports['show']=function(_0x127f5b,_0x4e4bc0){var _0x217b1e={'raw':!![],'where':{'id':_0x127f5b[_0xb2d7('0x42')]['id']}},_0x3d0308={};_0x3d0308['model']=_[_0xb2d7('0x2e')](db['ZohoField']['rawAttributes']);_0x3d0308['query']=_[_0xb2d7('0x2e')](_0x127f5b['query']);_0x3d0308[_0xb2d7('0x2f')]=_['intersection'](_0x3d0308[_0xb2d7('0x31')],_0x3d0308['query']);_0x217b1e[_0xb2d7('0x32')]=_[_0xb2d7('0x30')](_0x3d0308[_0xb2d7('0x31')],qs[_0xb2d7('0x33')](_0x127f5b[_0xb2d7('0x2d')][_0xb2d7('0x33')]));_0x217b1e['attributes']=_0x217b1e[_0xb2d7('0x32')]['length']?_0x217b1e[_0xb2d7('0x32')]:_0x3d0308[_0xb2d7('0x31')];if(_0x127f5b[_0xb2d7('0x2d')][_0xb2d7('0x3f')]){_0x217b1e[_0xb2d7('0x43')]=[{'all':!![]}];}_0x217b1e=_[_0xb2d7('0x3b')]({},_0x217b1e,_0x127f5b[_0xb2d7('0x3c')]);return db['ZohoField'][_0xb2d7('0x44')](_0x217b1e)[_0xb2d7('0x22')](handleEntityNotFound(_0x4e4bc0,null))[_0xb2d7('0x22')](respondWithResult(_0x4e4bc0,null))[_0xb2d7('0x41')](handleError(_0x4e4bc0,null));};exports['create']=function(_0x2daddc,_0xcafa5f){return db[_0xb2d7('0x3d')][_0xb2d7('0x45')](_0x2daddc[_0xb2d7('0x46')],{})[_0xb2d7('0x22')](respondWithResult(_0xcafa5f,0xc9))['catch'](handleError(_0xcafa5f,null));};exports[_0xb2d7('0x47')]=function(_0x37670d,_0x19c330){if(_0x37670d[_0xb2d7('0x46')]['id']){delete _0x37670d['body']['id'];}return db[_0xb2d7('0x3d')][_0xb2d7('0x44')]({'where':{'id':_0x37670d['params']['id']}})[_0xb2d7('0x22')](handleEntityNotFound(_0x19c330,null))[_0xb2d7('0x22')](saveUpdates(_0x37670d[_0xb2d7('0x46')],null))[_0xb2d7('0x22')](respondWithResult(_0x19c330,null))[_0xb2d7('0x41')](handleError(_0x19c330,null));};exports['destroy']=function(_0x33c1a0,_0x42f041){return db[_0xb2d7('0x3d')][_0xb2d7('0x44')]({'where':{'id':_0x33c1a0[_0xb2d7('0x42')]['id']}})[_0xb2d7('0x22')](handleEntityNotFound(_0x42f041,null))[_0xb2d7('0x22')](removeEntity(_0x42f041,null))[_0xb2d7('0x41')](handleError(_0x42f041,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4b1f01b..6845d3f 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1883=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField'];(function(_0x3b55bb,_0x33f085){var _0x1d43b5=function(_0x484f5d){while(--_0x484f5d){_0x3b55bb['push'](_0x3b55bb['shift']());}};_0x1d43b5(++_0x33f085);}(_0x1883,0xab));var _0x3188=function(_0x1aabb7,_0x16a236){_0x1aabb7=_0x1aabb7-0x0;var _0x16b4dc=_0x1883[_0x1aabb7];return _0x16b4dc;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x3188('0xf'),_0x3188('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_zoho_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0x23689e,_0x38beac){var _0xdf0dc5=function(_0x467c58){while(--_0x467c58){_0x23689e['push'](_0x23689e['shift']());}};_0xdf0dc5(++_0x38beac);}(_0x7a54,0x106));var _0x47a5=function(_0x1451f6,_0x10111e){_0x1451f6=_0x1451f6-0x0;var _0x55bf34=_0x7a54[_0x1451f6];return _0x55bf34;};'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':'zoho_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 80b3d75..e677fdd 100644 --- a/server/api/intZohoField/intZohoField.rpc.js +++ b/server/api/intZohoField/intZohoField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87bc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x87bc,0x199));var _0xc87b=function(_0x771f4e,_0x1c7103){_0x771f4e=_0x771f4e-0x0;var _0x523f04=_0x87bc[_0x771f4e];return _0x523f04;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require('moment');var BPromise=require(_0xc87b('0x2'));var rs=require(_0xc87b('0x3'));var fs=require('fs');var Redis=require(_0xc87b('0x4'));var db=require(_0xc87b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc87b('0x6'))(_0xc87b('0x7'));var config=require(_0xc87b('0x8'));var jayson=require(_0xc87b('0x9'));var client=jayson[_0xc87b('0xa')][_0xc87b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x826da6,_0x130572,_0x1a6d01){return new BPromise(function(_0x182be3,_0x138119){return client[_0xc87b('0xc')](_0x826da6,_0x1a6d01)[_0xc87b('0xd')](function(_0x1c1303){logger[_0xc87b('0xe')](_0xc87b('0xf'),_0x130572,_0xc87b('0x10'));logger[_0xc87b('0x11')](_0xc87b('0x12'),_0x130572,_0xc87b('0x10'),JSON['stringify'](_0x1c1303));if(_0x1c1303[_0xc87b('0x13')]){if(_0x1c1303[_0xc87b('0x13')][_0xc87b('0x14')]===0x1f4){logger[_0xc87b('0x13')](_0xc87b('0xf'),_0x130572,_0x1c1303[_0xc87b('0x13')]['message']);return _0x138119(_0x1c1303[_0xc87b('0x13')][_0xc87b('0x15')]);}logger[_0xc87b('0x13')](_0xc87b('0xf'),_0x130572,_0x1c1303['error']['message']);return _0x182be3(_0x1c1303[_0xc87b('0x13')][_0xc87b('0x15')]);}else{logger[_0xc87b('0xe')](_0xc87b('0xf'),_0x130572,_0xc87b('0x10'));_0x182be3(_0x1c1303[_0xc87b('0x16')][_0xc87b('0x15')]);}})['catch'](function(_0x5e546d){logger['error'](_0xc87b('0xf'),_0x130572,_0x5e546d);_0x138119(_0x5e546d);});});} \ No newline at end of file +var _0x35ea=['client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x441694,_0x8863db){var _0x389d32=function(_0x41b9c5){while(--_0x41b9c5){_0x441694['push'](_0x441694['shift']());}};_0x389d32(++_0x8863db);}(_0x35ea,0x68));var _0xa35e=function(_0x389da3,_0x1208ed){_0x389da3=_0x389da3-0x0;var _0x5a8e6c=_0x35ea[_0x389da3];return _0x5a8e6c;};'use strict';var _=require(_0xa35e('0x0'));var util=require('util');var moment=require(_0xa35e('0x1'));var BPromise=require(_0xa35e('0x2'));var rs=require(_0xa35e('0x3'));var fs=require('fs');var Redis=require(_0xa35e('0x4'));var db=require(_0xa35e('0x5'))['db'];var utils=require(_0xa35e('0x6'));var logger=require(_0xa35e('0x7'))(_0xa35e('0x8'));var config=require(_0xa35e('0x9'));var jayson=require(_0xa35e('0xa'));var client=jayson[_0xa35e('0xb')][_0xa35e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f097a,_0x1a47b3,_0x183ca9){return new BPromise(function(_0x25a670,_0x3b22ae){return client[_0xa35e('0xd')](_0x4f097a,_0x183ca9)['then'](function(_0x239ac3){logger[_0xa35e('0xe')](_0xa35e('0xf'),_0x1a47b3,_0xa35e('0x10'));logger[_0xa35e('0x11')](_0xa35e('0x12'),_0x1a47b3,_0xa35e('0x10'),JSON['stringify'](_0x239ac3));if(_0x239ac3[_0xa35e('0x13')]){if(_0x239ac3[_0xa35e('0x13')][_0xa35e('0x14')]===0x1f4){logger['error'](_0xa35e('0xf'),_0x1a47b3,_0x239ac3[_0xa35e('0x13')][_0xa35e('0x15')]);return _0x3b22ae(_0x239ac3[_0xa35e('0x13')][_0xa35e('0x15')]);}logger[_0xa35e('0x13')]('ZohoField,\x20%s,\x20%s',_0x1a47b3,_0x239ac3[_0xa35e('0x13')][_0xa35e('0x15')]);return _0x25a670(_0x239ac3[_0xa35e('0x13')][_0xa35e('0x15')]);}else{logger[_0xa35e('0xe')]('ZohoField,\x20%s,\x20%s',_0x1a47b3,_0xa35e('0x10'));_0x25a670(_0x239ac3[_0xa35e('0x16')][_0xa35e('0x15')]);}})['catch'](function(_0x42482a){logger[_0xa35e('0x13')](_0xa35e('0xf'),_0x1a47b3,_0x42482a);_0x3b22ae(_0x42482a);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 6ae3414..fc3a712 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x257268,_0x1d0221){var _0x4812bf=function(_0x4d7ea6){while(--_0x4d7ea6){_0x257268['push'](_0x257268['shift']());}};_0x4812bf(++_0x1d0221);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x11fbaa,_0x52dc16){var _0x1831fd=function(_0x2bbced){while(--_0x2bbced){_0x11fbaa['push'](_0x11fbaa['shift']());}};_0x1831fd(++_0x52dc16);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5917138..af06390 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2868=['BOOLEAN','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x2959bd,_0x2f7c6d){var _0x5a762c=function(_0x497f79){while(--_0x497f79){_0x2959bd['push'](_0x2959bd['shift']());}};_0x5a762c(++_0x2f7c6d);}(_0x2868,0x191));var _0x8286=function(_0xa483b2,_0x31c0bf){_0xa483b2=_0xa483b2-0x0;var _0x3fc94d=_0x2868[_0xa483b2];return _0x3fc94d;};'use strict';var Sequelize=require(_0x8286('0x0'));module['exports']={'name':{'type':Sequelize[_0x8286('0x1')],'allowNull':![],'unique':_0x8286('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8286('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x8286('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x8286('0x1')]},'type':{'type':Sequelize[_0x8286('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x8286('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x8286('0x1')]},'logo':{'type':Sequelize[_0x8286('0x1')]},'state':{'type':Sequelize[_0x8286('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x8286('0x1')]},'title':{'type':Sequelize[_0x8286('0x1')]},'remoteUri':{'type':Sequelize[_0x8286('0x1')]},'link':{'type':Sequelize[_0x8286('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x84d1=['state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN'];(function(_0x5809dd,_0x2e959c){var _0x338953=function(_0xf043ec){while(--_0xf043ec){_0x5809dd['push'](_0x5809dd['shift']());}};_0x338953(++_0x2e959c);}(_0x84d1,0x119));var _0x184d=function(_0x1d2ca4,_0x469af6){_0x1d2ca4=_0x1d2ca4-0x0;var _0x35398a=_0x84d1[_0x1d2ca4];return _0x35398a;};'use strict';var Sequelize=require(_0x184d('0x0'));module[_0x184d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x184d('0x2')},'version':{'type':Sequelize[_0x184d('0x3')],'allowNull':![],'unique':_0x184d('0x2')},'main':{'type':Sequelize[_0x184d('0x3')],'defaultValue':_0x184d('0x4')},'filename':{'type':Sequelize[_0x184d('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x184d('0x3')]},'size':{'type':Sequelize[_0x184d('0x5')]},'active':{'type':Sequelize[_0x184d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x184d('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x184d('0x3')],'unique':_0x184d('0x7')},'description':{'type':Sequelize[_0x184d('0x3')]},'title':{'type':Sequelize[_0x184d('0x3')]},'remoteUri':{'type':Sequelize[_0x184d('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 22e74e5..95c6cbe 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x5fab,0x177));var _0xb5fa=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x5fab[_0x347399];return _0x24e7be;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['Integration'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['Integration'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));}; \ No newline at end of file +var _0x2a07=['name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2a07,0x74));var _0x72a0=function(_0x2a5042,_0x307d04){_0x2a5042=_0x2a5042-0x0;var _0x4bc22f=_0x2a07[_0x2a5042];return _0x4bc22f;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['Integration'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['Integration']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 58d8544..8d02135 100644 --- a/server/api/integration/integration.model.js +++ b/server/api/integration/integration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1686=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x3d6d05,_0x16c8b8){var _0x288baf=function(_0x2e0179){while(--_0x2e0179){_0x3d6d05['push'](_0x3d6d05['shift']());}};_0x288baf(++_0x16c8b8);}(_0x1686,0x120));var _0x6168=function(_0x2d97b3,_0x48344c){_0x2d97b3=_0x2d97b3-0x0;var _0x2bc5db=_0x1686[_0x2d97b3];return _0x2bc5db;};'use strict';var _=require(_0x6168('0x0'));var util=require('util');var logger=require(_0x6168('0x1'))(_0x6168('0x2'));var moment=require(_0x6168('0x3'));var BPromise=require(_0x6168('0x4'));var rp=require(_0x6168('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6168('0x6'));var config=require(_0x6168('0x7'));var attributes=require(_0x6168('0x8'));module[_0x6168('0x9')]=function(_0x509f14,_0x1f04fe){return _0x509f14[_0x6168('0xa')](_0x6168('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc649=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','integrations','lodash','util','../../config/logger'];(function(_0x147b1f,_0x290637){var _0x1e53cb=function(_0x43ff97){while(--_0x43ff97){_0x147b1f['push'](_0x147b1f['shift']());}};_0x1e53cb(++_0x290637);}(_0xc649,0xed));var _0x9c64=function(_0x44e25d,_0x4463e2){_0x44e25d=_0x44e25d-0x0;var _0x831b60=_0xc649[_0x44e25d];return _0x831b60;};'use strict';var _=require(_0x9c64('0x0'));var util=require(_0x9c64('0x1'));var logger=require(_0x9c64('0x2'))('api');var moment=require(_0x9c64('0x3'));var BPromise=require(_0x9c64('0x4'));var rp=require(_0x9c64('0x5'));var fs=require('fs');var path=require(_0x9c64('0x6'));var rimraf=require(_0x9c64('0x7'));var config=require(_0x9c64('0x8'));var attributes=require(_0x9c64('0x9'));module['exports']=function(_0x20ff4b,_0x3c017f){return _0x20ff4b[_0x9c64('0xa')]('Integration',attributes,{'tableName':_0x9c64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index d13f2f5..428e5b2 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x46cacc,_0x52bc1c){var _0x51da50=function(_0x11bb4f){while(--_0x11bb4f){_0x46cacc['push'](_0x46cacc['shift']());}};_0x51da50(++_0x52bc1c);}(_0x6d38,0x1ef));var _0x86d3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6d38[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x4cec21,_0x3d6fb4){var _0x30f1ef=function(_0x544e28){while(--_0x544e28){_0x4cec21['push'](_0x4cec21['shift']());}};_0x30f1ef(++_0x3d6fb4);}(_0xd943,0x15d));var _0x3d94=function(_0x3a9628,_0x5a15c5){_0x3a9628=_0x3a9628-0x0;var _0x2ffa7b=_0xd943[_0x3a9628];return _0x2ffa7b;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 75b850c..f4fa56a 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xda2d,0x102));var _0xdda2=function(_0x161083,_0x42778b){_0x161083=_0x161083-0x0;var _0x29af6e=_0xda2d[_0x161083];return _0x29af6e;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x0295,0x1f0));var _0x5029=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x0295[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 06c30f5..54cc44e 100644 --- a/server/api/integrationReport/integrationReport.attributes.js +++ b/server/api/integrationReport/integrationReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2916=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','sequelize'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0x2916,0x1cb));var _0x6291=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x2916[_0x2aefb6];return _0x202772;};'use strict';var Sequelize=require(_0x6291('0x0'));module[_0x6291('0x1')]={'integration':{'type':Sequelize[_0x6291('0x2')]},'eventChannel':{'type':Sequelize[_0x6291('0x2')]},'exitStatus':{'type':Sequelize[_0x6291('0x2')]},'ticketId':{'type':Sequelize[_0x6291('0x2')]},'integrationId':{'type':Sequelize[_0x6291('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6291('0x2')]},'calleridnum':{'type':Sequelize[_0x6291('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6291('0x2')]},'interface':{'type':Sequelize[_0x6291('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6291('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x6291('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6291('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x6291('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6291('0x3')]},'reason':{'type':Sequelize[_0x6291('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x6291('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6291('0x4')]},'agentdump':{'type':Sequelize[_0x6291('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6291('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6291('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6291('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6291('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6291('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6291('0x2')]},'destchannel':{'type':Sequelize[_0x6291('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x6291('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6291('0x2')]},'destcalleridname':{'type':Sequelize[_0x6291('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6291('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6291('0x2')]},'destlanguage':{'type':Sequelize[_0x6291('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6291('0x2')]},'destexten':{'type':Sequelize[_0x6291('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x6291('0x2')]},'inReplyTo':{'type':Sequelize[_0x6291('0x2')]},'subject':{'type':Sequelize[_0x6291('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x6291('0x2')]},'cc':{'type':Sequelize[_0x6291('0x2')]},'attachment':{'type':Sequelize[_0x6291('0x6')]},'html':{'type':Sequelize[_0x6291('0x6')]},'text':{'type':Sequelize[_0x6291('0x6')]},'status':{'type':Sequelize[_0x6291('0x7')]('SENT',_0x6291('0x8'),_0x6291('0x9'),'FAILED')},'url':{'type':Sequelize[_0x6291('0x2')]},'app':{'type':Sequelize[_0x6291('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x6291('0x3')]}}; \ No newline at end of file +var _0xd8fb=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','RECEIVED'];(function(_0x53758c,_0x5664af){var _0x425eff=function(_0x3d0c89){while(--_0x3d0c89){_0x53758c['push'](_0x53758c['shift']());}};_0x425eff(++_0x5664af);}(_0xd8fb,0x79));var _0xbd8f=function(_0x131875,_0x1b1a27){_0x131875=_0x131875-0x0;var _0x5f2292=_0xd8fb[_0x131875];return _0x5f2292;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xbd8f('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xbd8f('0x3')]},'contacts':{'type':Sequelize[_0xbd8f('0x2')]},'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridnum':{'type':Sequelize[_0xbd8f('0x2')]},'calleridname':{'type':Sequelize[_0xbd8f('0x2')]},'queue':{'type':Sequelize[_0xbd8f('0x2')]},'interface':{'type':Sequelize[_0xbd8f('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbd8f('0x4')]},'holdtime':{'type':Sequelize[_0xbd8f('0x3')]},'agentcomplete':{'type':Sequelize[_0xbd8f('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbd8f('0x4')]},'talktime':{'type':Sequelize[_0xbd8f('0x3')]},'agentacw':{'type':Sequelize[_0xbd8f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbd8f('0x3')]},'reason':{'type':Sequelize[_0xbd8f('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbd8f('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbd8f('0x4')]},'lastevent':{'type':Sequelize[_0xbd8f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xbd8f('0x3')]},'channelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'context':{'type':Sequelize[_0xbd8f('0x2')]},'exten':{'type':Sequelize[_0xbd8f('0x2')]},'priority':{'type':Sequelize[_0xbd8f('0x2')]},'destchannel':{'type':Sequelize[_0xbd8f('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridname':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xbd8f('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xbd8f('0x2')]},'destexten':{'type':Sequelize[_0xbd8f('0x2')]},'destpriority':{'type':Sequelize[_0xbd8f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xbd8f('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xbd8f('0x2')]},'from':{'type':Sequelize[_0xbd8f('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xbd8f('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xbd8f('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0xbd8f('0x7'),'SENDING',_0xbd8f('0x8'),_0xbd8f('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xbd8f('0x2')]},'projectId':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c580d57..53f122b 100644 --- a/server/api/integrationReport/integrationReport.controller.js +++ b/server/api/integrationReport/integrationReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50aa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','IntegrationReport','rows','show','params','keys','rawAttributes','find','catch','create','body','update','describe','eml-format','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4c81a8,_0x32cdb7){var _0x239bce=function(_0x1fb27e){while(--_0x1fb27e){_0x4c81a8['push'](_0x4c81a8['shift']());}};_0x239bce(++_0x32cdb7);}(_0x50aa,0x178));var _0xa50a=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0x50aa[_0x51c52b];return _0x581ce3;};'use strict';var emlformat=require(_0xa50a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa50a('0x1'));var rp=require('request-promise');var moment=require(_0xa50a('0x2'));var BPromise=require(_0xa50a('0x3'));var Mustache=require('mustache');var util=require(_0xa50a('0x4'));var path=require(_0xa50a('0x5'));var sox=require('sox');var csv=require(_0xa50a('0x6'));var ejs=require(_0xa50a('0x7'));var fs=require('fs');var fs_extra=require(_0xa50a('0x8'));var _=require('lodash');var squel=require(_0xa50a('0x9'));var crypto=require(_0xa50a('0xa'));var jsforce=require(_0xa50a('0xb'));var deskjs=require(_0xa50a('0xc'));var toCsv=require(_0xa50a('0x6'));var querystring=require(_0xa50a('0xd'));var Papa=require(_0xa50a('0xe'));var Redis=require(_0xa50a('0xf'));var authService=require(_0xa50a('0x10'));var qs=require(_0xa50a('0x11'));var as=require(_0xa50a('0x12'));var hardwareService=require(_0xa50a('0x13'));var logger=require(_0xa50a('0x14'))('api');var utils=require(_0xa50a('0x15'));var config=require(_0xa50a('0x16'));var licenseUtil=require(_0xa50a('0x17'));var db=require(_0xa50a('0x18'))['db'];function respondWithStatusCode(_0x1caac4,_0x252259){_0x252259=_0x252259||0xcc;return function(_0x57fd9e){if(_0x57fd9e){return _0x1caac4[_0xa50a('0x19')](_0x252259);}return _0x1caac4['status'](_0x252259)[_0xa50a('0x1a')]();};}function respondWithResult(_0x34da78,_0x334ddd){_0x334ddd=_0x334ddd||0xc8;return function(_0xac5527){if(_0xac5527){return _0x34da78[_0xa50a('0x1b')](_0x334ddd)['json'](_0xac5527);}};}function respondWithFilteredResult(_0x11b2b9,_0x52e4c4){return function(_0x423f63){if(_0x423f63){var _0x3e66db=typeof _0x52e4c4['offset']===_0xa50a('0x1c')&&typeof _0x52e4c4[_0xa50a('0x1d')]===_0xa50a('0x1c');var _0x4f2dab=_0x423f63[_0xa50a('0x1e')];var _0x121479=_0x3e66db?0x0:_0x52e4c4['offset'];var _0x5d4a30=_0x3e66db?_0x423f63['count']:_0x52e4c4[_0xa50a('0x1f')]+_0x52e4c4[_0xa50a('0x1d')];var _0x2bdb3d;if(_0x5d4a30>=_0x4f2dab){_0x5d4a30=_0x4f2dab;_0x2bdb3d=0xc8;}else{_0x2bdb3d=0xce;}_0x11b2b9['status'](_0x2bdb3d);return _0x11b2b9[_0xa50a('0x20')](_0xa50a('0x21'),_0x121479+'-'+_0x5d4a30+'/'+_0x4f2dab)[_0xa50a('0x22')](_0x423f63);}return null;};}function patchUpdates(_0x367485){return function(_0x4c964d){try{jsonpatch[_0xa50a('0x23')](_0x4c964d,_0x367485,!![]);}catch(_0x24283d){return BPromise[_0xa50a('0x24')](_0x24283d);}return _0x4c964d[_0xa50a('0x25')]();};}function saveUpdates(_0x2f4680,_0x21b76d){return function(_0x9b930e){if(_0x9b930e){return _0x9b930e['update'](_0x2f4680)[_0xa50a('0x26')](function(_0x5c3735){return _0x5c3735;});}return null;};}function removeEntity(_0x3b7a29,_0x518576){return function(_0x3b08ce){if(_0x3b08ce){return _0x3b08ce[_0xa50a('0x27')]()[_0xa50a('0x26')](function(){_0x3b7a29[_0xa50a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cf0a6,_0x6eebbd){return function(_0x4d65c0){if(!_0x4d65c0){_0x3cf0a6[_0xa50a('0x19')](0x194);}return _0x4d65c0;};}function handleError(_0x373881,_0x329c84){_0x329c84=_0x329c84||0x1f4;return function(_0x131a76){logger[_0xa50a('0x28')](_0x131a76[_0xa50a('0x29')]);if(_0x131a76[_0xa50a('0x2a')]){delete _0x131a76['name'];}_0x373881[_0xa50a('0x1b')](_0x329c84)[_0xa50a('0x2b')](_0x131a76);};}exports[_0xa50a('0x2c')]=function(_0x3b46bf,_0x1564c6){var _0x352801={},_0x5ceb9d={},_0x2f08a9={'count':0x0,'rows':[]};var _0x2ecccb=_[_0xa50a('0x2d')](db['IntegrationReport']['rawAttributes'],function(_0x1f2a52){return{'name':_0x1f2a52['fieldName'],'type':_0x1f2a52[_0xa50a('0x2e')][_0xa50a('0x2f')]};});_0x5ceb9d[_0xa50a('0x30')]=_[_0xa50a('0x2d')](_0x2ecccb,_0xa50a('0x2a'));_0x5ceb9d['query']=_['keys'](_0x3b46bf['query']);_0x5ceb9d[_0xa50a('0x31')]=_['intersection'](_0x5ceb9d[_0xa50a('0x30')],_0x5ceb9d[_0xa50a('0x32')]);_0x352801[_0xa50a('0x33')]=_[_0xa50a('0x34')](_0x5ceb9d[_0xa50a('0x30')],qs[_0xa50a('0x35')](_0x3b46bf['query'][_0xa50a('0x35')]));_0x352801['attributes']=_0x352801['attributes'][_0xa50a('0x36')]?_0x352801['attributes']:_0x5ceb9d[_0xa50a('0x30')];if(!_0x3b46bf[_0xa50a('0x32')][_0xa50a('0x37')](_0xa50a('0x38'))){_0x352801['limit']=qs[_0xa50a('0x1d')](_0x3b46bf[_0xa50a('0x32')][_0xa50a('0x1d')]);_0x352801[_0xa50a('0x1f')]=qs[_0xa50a('0x1f')](_0x3b46bf[_0xa50a('0x32')][_0xa50a('0x1f')]);}_0x352801[_0xa50a('0x39')]=qs[_0xa50a('0x3a')](_0x3b46bf[_0xa50a('0x32')][_0xa50a('0x3a')]);_0x352801[_0xa50a('0x3b')]=qs[_0xa50a('0x31')](_[_0xa50a('0x3c')](_0x3b46bf[_0xa50a('0x32')],_0x5ceb9d[_0xa50a('0x31')]),_0x2ecccb);if(_0x3b46bf[_0xa50a('0x32')][_0xa50a('0x3d')]){_0x352801[_0xa50a('0x3b')]=_[_0xa50a('0x3e')](_0x352801[_0xa50a('0x3b')],{'$or':_[_0xa50a('0x2d')](_0x2ecccb,function(_0x54df26){if(_0x54df26['type']!==_0xa50a('0x3f')){var _0x301d30={};_0x301d30[_0x54df26[_0xa50a('0x2a')]]={'$like':'%'+_0x3b46bf[_0xa50a('0x32')][_0xa50a('0x3d')]+'%'};return _0x301d30;}})});}_0x352801=_['merge']({},_0x352801,_0x3b46bf[_0xa50a('0x40')]);var _0x7da0c={'where':_0x352801[_0xa50a('0x3b')]};return db['IntegrationReport'][_0xa50a('0x1e')](_0x7da0c)['then'](function(_0x27831d){_0x2f08a9[_0xa50a('0x1e')]=_0x27831d;if(_0x3b46bf['query'][_0xa50a('0x41')]){_0x352801[_0xa50a('0x42')]=[{'all':!![]}];}return db[_0xa50a('0x43')]['findAll'](_0x352801);})[_0xa50a('0x26')](function(_0x5514c7){_0x2f08a9[_0xa50a('0x44')]=_0x5514c7;return _0x2f08a9;})[_0xa50a('0x26')](respondWithFilteredResult(_0x1564c6,_0x352801))['catch'](handleError(_0x1564c6,null));};exports[_0xa50a('0x45')]=function(_0x4bdf81,_0x3bce38){var _0x3bf6a2={'raw':![],'where':{'id':_0x4bdf81[_0xa50a('0x46')]['id']}},_0x21460e={};_0x21460e['model']=_[_0xa50a('0x47')](db[_0xa50a('0x43')][_0xa50a('0x48')]);_0x21460e['query']=_[_0xa50a('0x47')](_0x4bdf81[_0xa50a('0x32')]);_0x21460e['filters']=_[_0xa50a('0x34')](_0x21460e[_0xa50a('0x30')],_0x21460e[_0xa50a('0x32')]);_0x3bf6a2[_0xa50a('0x33')]=_[_0xa50a('0x34')](_0x21460e[_0xa50a('0x30')],qs[_0xa50a('0x35')](_0x4bdf81['query']['fields']));_0x3bf6a2[_0xa50a('0x33')]=_0x3bf6a2[_0xa50a('0x33')]['length']?_0x3bf6a2[_0xa50a('0x33')]:_0x21460e[_0xa50a('0x30')];if(_0x4bdf81[_0xa50a('0x32')][_0xa50a('0x41')]){_0x3bf6a2[_0xa50a('0x42')]=[{'all':!![]}];}_0x3bf6a2=_[_0xa50a('0x3e')]({},_0x3bf6a2,_0x4bdf81[_0xa50a('0x40')]);return db['IntegrationReport'][_0xa50a('0x49')](_0x3bf6a2)[_0xa50a('0x26')](handleEntityNotFound(_0x3bce38,null))[_0xa50a('0x26')](respondWithResult(_0x3bce38,null))[_0xa50a('0x4a')](handleError(_0x3bce38,null));};exports[_0xa50a('0x4b')]=function(_0x2cb868,_0x375374){return db[_0xa50a('0x43')][_0xa50a('0x4b')](_0x2cb868[_0xa50a('0x4c')],{})[_0xa50a('0x26')](respondWithResult(_0x375374,0xc9))['catch'](handleError(_0x375374,null));};exports[_0xa50a('0x4d')]=function(_0x2a509d,_0x4e6332){if(_0x2a509d[_0xa50a('0x4c')]['id']){delete _0x2a509d[_0xa50a('0x4c')]['id'];}return db[_0xa50a('0x43')][_0xa50a('0x49')]({'where':{'id':_0x2a509d[_0xa50a('0x46')]['id']}})[_0xa50a('0x26')](handleEntityNotFound(_0x4e6332,null))[_0xa50a('0x26')](saveUpdates(_0x2a509d['body'],null))[_0xa50a('0x26')](respondWithResult(_0x4e6332,null))['catch'](handleError(_0x4e6332,null));};exports['destroy']=function(_0x24e02e,_0x1dcd13){return db['IntegrationReport'][_0xa50a('0x49')]({'where':{'id':_0x24e02e[_0xa50a('0x46')]['id']}})[_0xa50a('0x26')](handleEntityNotFound(_0x1dcd13,null))[_0xa50a('0x26')](removeEntity(_0x1dcd13,null))[_0xa50a('0x4a')](handleError(_0x1dcd13,null));};exports[_0xa50a('0x4e')]=function(_0x42bad2,_0xddd40f){return db[_0xa50a('0x43')][_0xa50a('0x4e')]()[_0xa50a('0x26')](respondWithResult(_0xddd40f,null))[_0xa50a('0x4a')](handleError(_0xddd40f,null));}; \ No newline at end of file +var _0xb9c4=['fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','IntegrationReport'];(function(_0x3be8c6,_0x27e3be){var _0x280cd4=function(_0x37538e){while(--_0x37538e){_0x3be8c6['push'](_0x3be8c6['shift']());}};_0x280cd4(++_0x27e3be);}(_0xb9c4,0x1f4));var _0x4b9c=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0xb9c4[_0x9cfe28];return _0x54a1d0;};'use strict';var emlformat=require(_0x4b9c('0x0'));var rimraf=require(_0x4b9c('0x1'));var zipdir=require(_0x4b9c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b9c('0x3'));var moment=require(_0x4b9c('0x4'));var BPromise=require(_0x4b9c('0x5'));var Mustache=require(_0x4b9c('0x6'));var util=require(_0x4b9c('0x7'));var path=require(_0x4b9c('0x8'));var sox=require(_0x4b9c('0x9'));var csv=require(_0x4b9c('0xa'));var ejs=require(_0x4b9c('0xb'));var fs=require('fs');var fs_extra=require(_0x4b9c('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4b9c('0xd'));var deskjs=require(_0x4b9c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4b9c('0xf'));var Redis=require(_0x4b9c('0x10'));var authService=require(_0x4b9c('0x11'));var qs=require(_0x4b9c('0x12'));var as=require(_0x4b9c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b9c('0x14'))(_0x4b9c('0x15'));var utils=require('../../config/utils');var config=require(_0x4b9c('0x16'));var licenseUtil=require(_0x4b9c('0x17'));var db=require(_0x4b9c('0x18'))['db'];function respondWithStatusCode(_0xe92bc7,_0x16a65f){_0x16a65f=_0x16a65f||0xcc;return function(_0x2fde5a){if(_0x2fde5a){return _0xe92bc7[_0x4b9c('0x19')](_0x16a65f);}return _0xe92bc7[_0x4b9c('0x1a')](_0x16a65f)[_0x4b9c('0x1b')]();};}function respondWithResult(_0x471a6e,_0x2cf52a){_0x2cf52a=_0x2cf52a||0xc8;return function(_0x173d40){if(_0x173d40){return _0x471a6e[_0x4b9c('0x1a')](_0x2cf52a)[_0x4b9c('0x1c')](_0x173d40);}};}function respondWithFilteredResult(_0x1548e1,_0x32d71a){return function(_0x159109){if(_0x159109){var _0x56c5ea=typeof _0x32d71a[_0x4b9c('0x1d')]===_0x4b9c('0x1e')&&typeof _0x32d71a[_0x4b9c('0x1f')]===_0x4b9c('0x1e');var _0x1f43f1=_0x159109[_0x4b9c('0x20')];var _0x5f01e6=_0x56c5ea?0x0:_0x32d71a[_0x4b9c('0x1d')];var _0x50733c=_0x56c5ea?_0x159109[_0x4b9c('0x20')]:_0x32d71a[_0x4b9c('0x1d')]+_0x32d71a[_0x4b9c('0x1f')];var _0x1c4b11;if(_0x50733c>=_0x1f43f1){_0x50733c=_0x1f43f1;_0x1c4b11=0xc8;}else{_0x1c4b11=0xce;}_0x1548e1['status'](_0x1c4b11);return _0x1548e1[_0x4b9c('0x21')](_0x4b9c('0x22'),_0x5f01e6+'-'+_0x50733c+'/'+_0x1f43f1)['json'](_0x159109);}return null;};}function patchUpdates(_0x323c7d){return function(_0x122fe5){try{jsonpatch[_0x4b9c('0x23')](_0x122fe5,_0x323c7d,!![]);}catch(_0x3c13d6){return BPromise[_0x4b9c('0x24')](_0x3c13d6);}return _0x122fe5[_0x4b9c('0x25')]();};}function saveUpdates(_0x4ade98,_0x106c9a){return function(_0x4db500){if(_0x4db500){return _0x4db500[_0x4b9c('0x26')](_0x4ade98)[_0x4b9c('0x27')](function(_0x5efbe3){return _0x5efbe3;});}return null;};}function removeEntity(_0x277d6b,_0x36393e){return function(_0x4f7410){if(_0x4f7410){return _0x4f7410[_0x4b9c('0x28')]()[_0x4b9c('0x27')](function(){_0x277d6b['status'](0xcc)[_0x4b9c('0x1b')]();});}};}function handleEntityNotFound(_0x378c68,_0x3d3088){return function(_0x250363){if(!_0x250363){_0x378c68['sendStatus'](0x194);}return _0x250363;};}function handleError(_0x52f74b,_0x353847){_0x353847=_0x353847||0x1f4;return function(_0x48a998){logger[_0x4b9c('0x29')](_0x48a998[_0x4b9c('0x2a')]);if(_0x48a998[_0x4b9c('0x2b')]){delete _0x48a998[_0x4b9c('0x2b')];}_0x52f74b[_0x4b9c('0x1a')](_0x353847)[_0x4b9c('0x2c')](_0x48a998);};}exports['index']=function(_0x4a163e,_0x192bf6){var _0x104b01={},_0x3df005={},_0x216783={'count':0x0,'rows':[]};var _0x33cfd9=_['map'](db[_0x4b9c('0x2d')]['rawAttributes'],function(_0x1751cb){return{'name':_0x1751cb[_0x4b9c('0x2e')],'type':_0x1751cb[_0x4b9c('0x2f')][_0x4b9c('0x30')]};});_0x3df005[_0x4b9c('0x31')]=_[_0x4b9c('0x32')](_0x33cfd9,_0x4b9c('0x2b'));_0x3df005[_0x4b9c('0x33')]=_['keys'](_0x4a163e[_0x4b9c('0x33')]);_0x3df005[_0x4b9c('0x34')]=_['intersection'](_0x3df005[_0x4b9c('0x31')],_0x3df005[_0x4b9c('0x33')]);_0x104b01['attributes']=_[_0x4b9c('0x35')](_0x3df005[_0x4b9c('0x31')],qs['fields'](_0x4a163e[_0x4b9c('0x33')][_0x4b9c('0x36')]));_0x104b01[_0x4b9c('0x37')]=_0x104b01[_0x4b9c('0x37')][_0x4b9c('0x38')]?_0x104b01[_0x4b9c('0x37')]:_0x3df005[_0x4b9c('0x31')];if(!_0x4a163e[_0x4b9c('0x33')][_0x4b9c('0x39')](_0x4b9c('0x3a'))){_0x104b01[_0x4b9c('0x1f')]=qs[_0x4b9c('0x1f')](_0x4a163e[_0x4b9c('0x33')][_0x4b9c('0x1f')]);_0x104b01[_0x4b9c('0x1d')]=qs[_0x4b9c('0x1d')](_0x4a163e['query'][_0x4b9c('0x1d')]);}_0x104b01['order']=qs['sort'](_0x4a163e[_0x4b9c('0x33')][_0x4b9c('0x3b')]);_0x104b01[_0x4b9c('0x3c')]=qs[_0x4b9c('0x34')](_[_0x4b9c('0x3d')](_0x4a163e['query'],_0x3df005['filters']),_0x33cfd9);if(_0x4a163e[_0x4b9c('0x33')][_0x4b9c('0x3e')]){_0x104b01['where']=_[_0x4b9c('0x3f')](_0x104b01['where'],{'$or':_['map'](_0x33cfd9,function(_0x2053ab){if(_0x2053ab[_0x4b9c('0x2f')]!=='VIRTUAL'){var _0xfd3b8d={};_0xfd3b8d[_0x2053ab['name']]={'$like':'%'+_0x4a163e[_0x4b9c('0x33')][_0x4b9c('0x3e')]+'%'};return _0xfd3b8d;}})});}_0x104b01=_['merge']({},_0x104b01,_0x4a163e[_0x4b9c('0x40')]);var _0x3ba06e={'where':_0x104b01[_0x4b9c('0x3c')]};return db[_0x4b9c('0x2d')][_0x4b9c('0x20')](_0x3ba06e)[_0x4b9c('0x27')](function(_0x45e1d3){_0x216783[_0x4b9c('0x20')]=_0x45e1d3;if(_0x4a163e[_0x4b9c('0x33')]['includeAll']){_0x104b01[_0x4b9c('0x41')]=[{'all':!![]}];}return db[_0x4b9c('0x2d')][_0x4b9c('0x42')](_0x104b01);})[_0x4b9c('0x27')](function(_0x570b2f){_0x216783[_0x4b9c('0x43')]=_0x570b2f;return _0x216783;})['then'](respondWithFilteredResult(_0x192bf6,_0x104b01))[_0x4b9c('0x44')](handleError(_0x192bf6,null));};exports[_0x4b9c('0x45')]=function(_0x1d791a,_0x2e68ba){var _0x3f895a={'raw':![],'where':{'id':_0x1d791a[_0x4b9c('0x46')]['id']}},_0x251bbd={};_0x251bbd[_0x4b9c('0x31')]=_[_0x4b9c('0x47')](db['IntegrationReport'][_0x4b9c('0x48')]);_0x251bbd['query']=_[_0x4b9c('0x47')](_0x1d791a[_0x4b9c('0x33')]);_0x251bbd[_0x4b9c('0x34')]=_[_0x4b9c('0x35')](_0x251bbd[_0x4b9c('0x31')],_0x251bbd[_0x4b9c('0x33')]);_0x3f895a[_0x4b9c('0x37')]=_[_0x4b9c('0x35')](_0x251bbd[_0x4b9c('0x31')],qs[_0x4b9c('0x36')](_0x1d791a[_0x4b9c('0x33')][_0x4b9c('0x36')]));_0x3f895a[_0x4b9c('0x37')]=_0x3f895a[_0x4b9c('0x37')][_0x4b9c('0x38')]?_0x3f895a[_0x4b9c('0x37')]:_0x251bbd[_0x4b9c('0x31')];if(_0x1d791a[_0x4b9c('0x33')][_0x4b9c('0x49')]){_0x3f895a[_0x4b9c('0x41')]=[{'all':!![]}];}_0x3f895a=_[_0x4b9c('0x3f')]({},_0x3f895a,_0x1d791a[_0x4b9c('0x40')]);return db[_0x4b9c('0x2d')]['find'](_0x3f895a)[_0x4b9c('0x27')](handleEntityNotFound(_0x2e68ba,null))[_0x4b9c('0x27')](respondWithResult(_0x2e68ba,null))[_0x4b9c('0x44')](handleError(_0x2e68ba,null));};exports[_0x4b9c('0x4a')]=function(_0x136436,_0x33aae7){return db[_0x4b9c('0x2d')][_0x4b9c('0x4a')](_0x136436[_0x4b9c('0x4b')],{})[_0x4b9c('0x27')](respondWithResult(_0x33aae7,0xc9))[_0x4b9c('0x44')](handleError(_0x33aae7,null));};exports['update']=function(_0x37ea61,_0x15a63){if(_0x37ea61[_0x4b9c('0x4b')]['id']){delete _0x37ea61[_0x4b9c('0x4b')]['id'];}return db['IntegrationReport'][_0x4b9c('0x4c')]({'where':{'id':_0x37ea61[_0x4b9c('0x46')]['id']}})[_0x4b9c('0x27')](handleEntityNotFound(_0x15a63,null))['then'](saveUpdates(_0x37ea61[_0x4b9c('0x4b')],null))['then'](respondWithResult(_0x15a63,null))[_0x4b9c('0x44')](handleError(_0x15a63,null));};exports[_0x4b9c('0x28')]=function(_0x26a888,_0x5e12db){return db[_0x4b9c('0x2d')]['find']({'where':{'id':_0x26a888['params']['id']}})['then'](handleEntityNotFound(_0x5e12db,null))[_0x4b9c('0x27')](removeEntity(_0x5e12db,null))[_0x4b9c('0x44')](handleError(_0x5e12db,null));};exports[_0x4b9c('0x4d')]=function(_0x5a5c15,_0x259b54){return db['IntegrationReport'][_0x4b9c('0x4d')]()[_0x4b9c('0x27')](respondWithResult(_0x259b54,null))['catch'](handleError(_0x259b54,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7a0c46d..7c3f456 100644 --- a/server/api/integrationReport/integrationReport.model.js +++ b/server/api/integrationReport/integrationReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73fe=['request-promise','path','rimraf','../../config/environment','exports','define','report_integration','lodash','util','moment','bluebird'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0x73fe,0x13b));var _0xe73f=function(_0x15a43d,_0xd556a6){_0x15a43d=_0x15a43d-0x0;var _0x3d41ab=_0x73fe[_0x15a43d];return _0x3d41ab;};'use strict';var _=require(_0xe73f('0x0'));var util=require(_0xe73f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe73f('0x2'));var BPromise=require(_0xe73f('0x3'));var rp=require(_0xe73f('0x4'));var fs=require('fs');var path=require(_0xe73f('0x5'));var rimraf=require(_0xe73f('0x6'));var config=require(_0xe73f('0x7'));var attributes=require('./integrationReport.attributes');module[_0xe73f('0x8')]=function(_0x2c133d,_0x4c7055){return _0x2c133d[_0xe73f('0x9')]('IntegrationReport',attributes,{'tableName':_0xe73f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7386=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','lodash'];(function(_0x184e69,_0x39af04){var _0x57d8ad=function(_0x153dd9){while(--_0x153dd9){_0x184e69['push'](_0x184e69['shift']());}};_0x57d8ad(++_0x39af04);}(_0x7386,0xd7));var _0x6738=function(_0x1a4804,_0x190072){_0x1a4804=_0x1a4804-0x0;var _0x3f6366=_0x7386[_0x1a4804];return _0x3f6366;};'use strict';var _=require(_0x6738('0x0'));var util=require('util');var logger=require(_0x6738('0x1'))(_0x6738('0x2'));var moment=require(_0x6738('0x3'));var BPromise=require(_0x6738('0x4'));var rp=require(_0x6738('0x5'));var fs=require('fs');var path=require(_0x6738('0x6'));var rimraf=require(_0x6738('0x7'));var config=require(_0x6738('0x8'));var attributes=require(_0x6738('0x9'));module[_0x6738('0xa')]=function(_0x485837,_0xcf9638){return _0x485837['define'](_0x6738('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 3bb5aa7..c5ae489 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x431c26,_0x4b8f47){var _0x3092fd=function(_0x4dca59){while(--_0x4dca59){_0x431c26['push'](_0x431c26['shift']());}};_0x3092fd(++_0x4b8f47);}(_0x5fab,0x177));var _0xb5fa=function(_0xb02766,_0xa37d90){_0xb02766=_0xb02766-0x0;var _0x560e6c=_0x5fab[_0xb02766];return _0x560e6c;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x4975,0x86));var _0x5497=function(_0x4c6c91,_0x42e932){_0x4c6c91=_0x4c6c91-0x0;var _0x545d89=_0x4975[_0x4c6c91];return _0x545d89;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 0bdaec3..b367523 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f74=['post','create','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/sub_intervals'];(function(_0x2b8a4f,_0x20b15f){var _0x42a8cf=function(_0x580283){while(--_0x580283){_0x2b8a4f['push'](_0x2b8a4f['shift']());}};_0x42a8cf(++_0x20b15f);}(_0x2f74,0x7b));var _0x42f7=function(_0x3fe30d,_0x469e48){_0x3fe30d=_0x3fe30d-0x0;var _0x37b3e1=_0x2f74[_0x3fe30d];return _0x37b3e1;};'use strict';var multer=require(_0x42f7('0x0'));var util=require('util');var path=require(_0x42f7('0x1'));var timeout=require(_0x42f7('0x2'));var express=require(_0x42f7('0x3'));var router=express[_0x42f7('0x4')]();var fs_extra=require(_0x42f7('0x5'));var auth=require(_0x42f7('0x6'));var interaction=require(_0x42f7('0x7'));var config=require(_0x42f7('0x8'));var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x42f7('0x9')]);router[_0x42f7('0xa')](_0x42f7('0xb'),auth[_0x42f7('0xc')](),controller[_0x42f7('0xd')]);router[_0x42f7('0xa')](_0x42f7('0xe'),auth[_0x42f7('0xc')](),controller['getIntervals']);router[_0x42f7('0xf')]('/',auth[_0x42f7('0xc')](),controller[_0x42f7('0x10')]);router[_0x42f7('0xf')](_0x42f7('0xe'),auth[_0x42f7('0xc')](),controller['addInterval']);router[_0x42f7('0xf')](_0x42f7('0x11'),auth[_0x42f7('0xc')](),controller[_0x42f7('0x12')]);router[_0x42f7('0x13')](_0x42f7('0xb'),auth[_0x42f7('0xc')](),controller[_0x42f7('0x14')]);router['delete']('/:id',auth[_0x42f7('0xc')](),controller[_0x42f7('0x15')]);module[_0x42f7('0x16')]=router; \ No newline at end of file +var _0xca84=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x43cbce,_0x3f7302){var _0x17ea6a=function(_0x1c49dc){while(--_0x1c49dc){_0x43cbce['push'](_0x43cbce['shift']());}};_0x17ea6a(++_0x3f7302);}(_0xca84,0xf5));var _0x4ca8=function(_0x2e7044,_0x5409b8){_0x2e7044=_0x2e7044-0x0;var _0x26a3c2=_0xca84[_0x2e7044];return _0x26a3c2;};'use strict';var multer=require(_0x4ca8('0x0'));var util=require(_0x4ca8('0x1'));var path=require(_0x4ca8('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ca8('0x3'));var router=express[_0x4ca8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4ca8('0x5'));var interaction=require(_0x4ca8('0x6'));var config=require(_0x4ca8('0x7'));var controller=require(_0x4ca8('0x8'));router[_0x4ca8('0x9')]('/',auth[_0x4ca8('0xa')](),controller[_0x4ca8('0xb')]);router[_0x4ca8('0x9')](_0x4ca8('0xc'),auth[_0x4ca8('0xa')](),controller['show']);router[_0x4ca8('0x9')]('/:id/sub_intervals',auth[_0x4ca8('0xa')](),controller['getIntervals']);router[_0x4ca8('0xd')]('/',auth['isAuthenticated'](),controller[_0x4ca8('0xe')]);router[_0x4ca8('0xd')](_0x4ca8('0xf'),auth[_0x4ca8('0xa')](),controller[_0x4ca8('0x10')]);router[_0x4ca8('0xd')](_0x4ca8('0x11'),auth['isAuthenticated'](),controller['addIntervals']);router['put']('/:id',auth[_0x4ca8('0xa')](),controller['update']);router[_0x4ca8('0x12')](_0x4ca8('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4ca8('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 217b46d..75cee90 100644 --- a/server/api/interval/interval.attributes.js +++ b/server/api/interval/interval.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9972=['sequelize','exports','STRING'];(function(_0x5594f7,_0x1d9e07){var _0x3cb24b=function(_0x1d68aa){while(--_0x1d68aa){_0x5594f7['push'](_0x5594f7['shift']());}};_0x3cb24b(++_0x1d9e07);}(_0x9972,0x87));var _0x2997=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9972[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x2997('0x0'));module[_0x2997('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2997('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x6e7b=['exports','STRING','sequelize'];(function(_0x18c11a,_0x13a519){var _0x56aa0c=function(_0x25f7e9){while(--_0x25f7e9){_0x18c11a['push'](_0x18c11a['shift']());}};_0x56aa0c(++_0x13a519);}(_0x6e7b,0x83));var _0xb6e7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6e7b[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xb6e7('0x0'));module[_0xb6e7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb6e7('0x2')]},'interval':{'type':Sequelize[_0xb6e7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f66edcd..483e379 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8195=['send','map','Interval','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addInterval','IntervalId','getIntervals','addIntervals','findOne','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','get','Intervals','error','stack','name'];(function(_0xb56a21,_0x3093c7){var _0x121573=function(_0x4bb965){while(--_0x4bb965){_0xb56a21['push'](_0xb56a21['shift']());}};_0x121573(++_0x3093c7);}(_0x8195,0x157));var _0x5819=function(_0x142154,_0x236a4f){_0x142154=_0x142154-0x0;var _0x522601=_0x8195[_0x142154];return _0x522601;};'use strict';var emlformat=require(_0x5819('0x0'));var rimraf=require(_0x5819('0x1'));var zipdir=require(_0x5819('0x2'));var jsonpatch=require(_0x5819('0x3'));var rp=require(_0x5819('0x4'));var moment=require(_0x5819('0x5'));var BPromise=require(_0x5819('0x6'));var Mustache=require(_0x5819('0x7'));var util=require(_0x5819('0x8'));var path=require(_0x5819('0x9'));var sox=require(_0x5819('0xa'));var csv=require(_0x5819('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5819('0xc'));var _=require(_0x5819('0xd'));var squel=require(_0x5819('0xe'));var crypto=require(_0x5819('0xf'));var jsforce=require(_0x5819('0x10'));var deskjs=require(_0x5819('0x11'));var toCsv=require(_0x5819('0xb'));var querystring=require('querystring');var Papa=require(_0x5819('0x12'));var Redis=require(_0x5819('0x13'));var authService=require(_0x5819('0x14'));var qs=require(_0x5819('0x15'));var as=require(_0x5819('0x16'));var hardwareService=require(_0x5819('0x17'));var logger=require(_0x5819('0x18'))(_0x5819('0x19'));var utils=require(_0x5819('0x1a'));var config=require(_0x5819('0x1b'));var licenseUtil=require(_0x5819('0x1c'));var db=require(_0x5819('0x1d'))['db'];var extensions=require(_0x5819('0x1e'));function respondWithStatusCode(_0x11d9ab,_0x274c8a){_0x274c8a=_0x274c8a||0xcc;return function(_0x21b3d0){if(_0x21b3d0){return _0x11d9ab[_0x5819('0x1f')](_0x274c8a);}return _0x11d9ab[_0x5819('0x20')](_0x274c8a)[_0x5819('0x21')]();};}function respondWithResult(_0x10ef12,_0x2c3d85){_0x2c3d85=_0x2c3d85||0xc8;return function(_0x1a7817){if(_0x1a7817){return _0x10ef12[_0x5819('0x20')](_0x2c3d85)['json'](_0x1a7817);}};}function respondWithFilteredResult(_0xc15110,_0x275d03){return function(_0x137a53){if(_0x137a53){var _0x48f713=typeof _0x275d03[_0x5819('0x22')]===_0x5819('0x23')&&typeof _0x275d03[_0x5819('0x24')]===_0x5819('0x23');var _0x273306=_0x137a53['count'];var _0x3093f2=_0x48f713?0x0:_0x275d03['offset'];var _0x12486a=_0x48f713?_0x137a53[_0x5819('0x25')]:_0x275d03[_0x5819('0x22')]+_0x275d03[_0x5819('0x24')];var _0x2cb143;if(_0x12486a>=_0x273306){_0x12486a=_0x273306;_0x2cb143=0xc8;}else{_0x2cb143=0xce;}_0xc15110[_0x5819('0x20')](_0x2cb143);return _0xc15110['set'](_0x5819('0x26'),_0x3093f2+'-'+_0x12486a+'/'+_0x273306)[_0x5819('0x27')](_0x137a53);}return null;};}function patchUpdates(_0x1dfee7){return function(_0x905ade){try{jsonpatch[_0x5819('0x28')](_0x905ade,_0x1dfee7,!![]);}catch(_0x1f100f){return BPromise[_0x5819('0x29')](_0x1f100f);}return _0x905ade[_0x5819('0x2a')]();};}function saveUpdates(_0x33a3a6,_0x3090ea){return function(_0x22f942){if(_0x22f942){return _0x22f942['update'](_0x33a3a6)[_0x5819('0x2b')](function(_0x87a427){return _0x87a427;});}return null;};}function removeEntity(_0x57af6b,_0x45f81c){return function(_0x3530a6){if(_0x3530a6){return _0x3530a6['destroy']()[_0x5819('0x2b')](function(){var _0x470731=_0x3530a6[_0x5819('0x2c')]({'plain':!![]});var _0x2055d4=_0x5819('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x2055d4,'resourceId':_0x470731['id']}})['then'](function(){return _0x3530a6;});})[_0x5819('0x2b')](function(){_0x57af6b[_0x5819('0x20')](0xcc)[_0x5819('0x21')]();});}};}function handleEntityNotFound(_0x245941,_0xfa0a87){return function(_0x369fd4){if(!_0x369fd4){_0x245941[_0x5819('0x1f')](0x194);}return _0x369fd4;};}function handleError(_0x38d83b,_0x3995ef){_0x3995ef=_0x3995ef||0x1f4;return function(_0x237e51){logger[_0x5819('0x2e')](_0x237e51[_0x5819('0x2f')]);if(_0x237e51[_0x5819('0x30')]){delete _0x237e51['name'];}_0x38d83b['status'](_0x3995ef)[_0x5819('0x31')](_0x237e51);};}exports['index']=function(_0x2aeab6,_0x38fc65){var _0x51c4b5={},_0x29105c={},_0x49a218={'count':0x0,'rows':[]};var _0x545052=_[_0x5819('0x32')](db[_0x5819('0x33')][_0x5819('0x34')],function(_0x242345){return{'name':_0x242345[_0x5819('0x35')],'type':_0x242345[_0x5819('0x36')][_0x5819('0x37')]};});_0x29105c[_0x5819('0x38')]=_[_0x5819('0x32')](_0x545052,_0x5819('0x30'));_0x29105c['query']=_[_0x5819('0x39')](_0x2aeab6[_0x5819('0x3a')]);_0x29105c[_0x5819('0x3b')]=_[_0x5819('0x3c')](_0x29105c[_0x5819('0x38')],_0x29105c[_0x5819('0x3a')]);_0x51c4b5[_0x5819('0x3d')]=_['intersection'](_0x29105c[_0x5819('0x38')],qs[_0x5819('0x3e')](_0x2aeab6['query'][_0x5819('0x3e')]));_0x51c4b5[_0x5819('0x3d')]=_0x51c4b5[_0x5819('0x3d')][_0x5819('0x3f')]?_0x51c4b5[_0x5819('0x3d')]:_0x29105c[_0x5819('0x38')];if(!_0x2aeab6[_0x5819('0x3a')][_0x5819('0x40')](_0x5819('0x41'))){_0x51c4b5[_0x5819('0x24')]=qs[_0x5819('0x24')](_0x2aeab6['query'][_0x5819('0x24')]);_0x51c4b5[_0x5819('0x22')]=qs[_0x5819('0x22')](_0x2aeab6[_0x5819('0x3a')][_0x5819('0x22')]);}_0x51c4b5[_0x5819('0x42')]=qs['sort'](_0x2aeab6[_0x5819('0x3a')][_0x5819('0x43')]);_0x51c4b5[_0x5819('0x44')]=qs[_0x5819('0x3b')](_[_0x5819('0x45')](_0x2aeab6[_0x5819('0x3a')],_0x29105c[_0x5819('0x3b')]),_0x545052);if(_0x2aeab6['query'][_0x5819('0x46')]){_0x51c4b5[_0x5819('0x44')]=_[_0x5819('0x47')](_0x51c4b5[_0x5819('0x44')],{'$or':_[_0x5819('0x32')](_0x545052,function(_0x5d1a30){if(_0x5d1a30[_0x5819('0x36')]!==_0x5819('0x48')){var _0x1a0ae8={};_0x1a0ae8[_0x5d1a30[_0x5819('0x30')]]={'$like':'%'+_0x2aeab6[_0x5819('0x3a')][_0x5819('0x46')]+'%'};return _0x1a0ae8;}})});}_0x51c4b5=_[_0x5819('0x47')]({},_0x51c4b5,_0x2aeab6[_0x5819('0x49')]);var _0x1d30e1={'where':_0x51c4b5[_0x5819('0x44')]};return db[_0x5819('0x33')][_0x5819('0x25')](_0x1d30e1)['then'](function(_0x2ac946){_0x49a218['count']=_0x2ac946;if(_0x2aeab6['query']['includeAll']){_0x51c4b5[_0x5819('0x4a')]=[{'all':!![]}];}return db[_0x5819('0x33')][_0x5819('0x4b')](_0x51c4b5);})['then'](function(_0x15ea1c){_0x49a218['rows']=_0x15ea1c;return _0x49a218;})[_0x5819('0x2b')](respondWithFilteredResult(_0x38fc65,_0x51c4b5))[_0x5819('0x4c')](handleError(_0x38fc65,null));};exports['show']=function(_0x4c952b,_0x14dbf7){var _0x136904={'raw':!![],'where':{'id':_0x4c952b[_0x5819('0x4d')]['id']}},_0x5c13d9={};_0x5c13d9[_0x5819('0x38')]=_[_0x5819('0x39')](db['Interval'][_0x5819('0x34')]);_0x5c13d9[_0x5819('0x3a')]=_[_0x5819('0x39')](_0x4c952b[_0x5819('0x3a')]);_0x5c13d9[_0x5819('0x3b')]=_[_0x5819('0x3c')](_0x5c13d9[_0x5819('0x38')],_0x5c13d9[_0x5819('0x3a')]);_0x136904[_0x5819('0x3d')]=_[_0x5819('0x3c')](_0x5c13d9[_0x5819('0x38')],qs[_0x5819('0x3e')](_0x4c952b[_0x5819('0x3a')][_0x5819('0x3e')]));_0x136904['attributes']=_0x136904[_0x5819('0x3d')][_0x5819('0x3f')]?_0x136904[_0x5819('0x3d')]:_0x5c13d9['model'];if(_0x4c952b[_0x5819('0x3a')][_0x5819('0x4e')]){_0x136904[_0x5819('0x4a')]=[{'all':!![]}];}_0x136904=_[_0x5819('0x47')]({},_0x136904,_0x4c952b[_0x5819('0x49')]);return db['Interval'][_0x5819('0x4f')](_0x136904)[_0x5819('0x2b')](handleEntityNotFound(_0x14dbf7,null))[_0x5819('0x2b')](respondWithResult(_0x14dbf7,null))['catch'](handleError(_0x14dbf7,null));};exports[_0x5819('0x50')]=function(_0x1e99f5,_0x261783){return db[_0x5819('0x33')][_0x5819('0x50')](_0x1e99f5[_0x5819('0x51')],{})[_0x5819('0x2b')](function(_0x49d97f){var _0x3e993b=_0x1e99f5[_0x5819('0x52')][_0x5819('0x2c')]({'plain':!![]});if(!_0x3e993b)throw new Error(_0x5819('0x53'));if(_0x3e993b[_0x5819('0x54')]===_0x5819('0x52')){var _0x11779e=_0x49d97f[_0x5819('0x2c')]({'plain':!![]});var _0x109fcc=_0x5819('0x2d');return db[_0x5819('0x55')][_0x5819('0x4f')]({'where':{'name':_0x109fcc,'userProfileId':_0x3e993b[_0x5819('0x56')]},'raw':!![]})[_0x5819('0x2b')](function(_0x2cf74c){if(_0x2cf74c&&_0x2cf74c['autoAssociation']===0x0){return db[_0x5819('0x57')][_0x5819('0x50')]({'name':_0x11779e[_0x5819('0x30')],'resourceId':_0x11779e['id'],'type':_0x2cf74c[_0x5819('0x30')],'sectionId':_0x2cf74c['id']},{})[_0x5819('0x2b')](function(){return _0x49d97f;});}else{return _0x49d97f;}})[_0x5819('0x4c')](function(_0x121cce){logger['error'](_0x5819('0x58'),_0x121cce);throw _0x121cce;});}return _0x49d97f;})[_0x5819('0x2b')](respondWithResult(_0x261783,0xc9))['catch'](handleError(_0x261783,null));};exports[_0x5819('0x59')]=function(_0x118ecf,_0x3ba3f3){if(_0x118ecf[_0x5819('0x51')]['id']){delete _0x118ecf[_0x5819('0x51')]['id'];}return db[_0x5819('0x33')][_0x5819('0x4f')]({'where':{'id':_0x118ecf[_0x5819('0x4d')]['id']}})[_0x5819('0x2b')](handleEntityNotFound(_0x3ba3f3,null))[_0x5819('0x2b')](saveUpdates(_0x118ecf[_0x5819('0x51')],null))[_0x5819('0x2b')](respondWithResult(_0x3ba3f3,null))[_0x5819('0x4c')](handleError(_0x3ba3f3,null));};exports[_0x5819('0x5a')]=function(_0x57717c,_0x4ea436){return db[_0x5819('0x33')]['find']({'where':{'id':_0x57717c[_0x5819('0x4d')]['id']}})[_0x5819('0x2b')](handleEntityNotFound(_0x4ea436,null))[_0x5819('0x2b')](removeEntity(_0x4ea436,null))['catch'](handleError(_0x4ea436,null));};exports[_0x5819('0x5b')]=function(_0x5ed24f,_0x36b40d,_0x3f1d79){if(_0x5ed24f[_0x5819('0x51')]['id']){delete _0x5ed24f['body']['id'];}return db[_0x5819('0x33')][_0x5819('0x4f')]({'where':{'id':_0x5ed24f[_0x5819('0x4d')]['id']}})[_0x5819('0x2b')](handleEntityNotFound(_0x36b40d,null))[_0x5819('0x2b')](function(_0x304660){if(_0x304660){_0x5ed24f[_0x5819('0x51')][_0x5819('0x5c')]=_0x304660['id'];return db[_0x5819('0x33')][_0x5819('0x50')](_0x5ed24f[_0x5819('0x51')]);}})[_0x5819('0x2b')](respondWithResult(_0x36b40d,null))['catch'](handleError(_0x36b40d,null));};exports['getIntervals']=function(_0x118a84,_0x3600f9,_0x3d9cf0){var _0x29be17={};var _0x22aa8d={};var _0x24a1b7;var _0x5f03d2;return db['Interval']['findOne']({'where':{'id':_0x118a84[_0x5819('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3600f9,null))[_0x5819('0x2b')](function(_0x52d395){if(_0x52d395){_0x24a1b7=_0x52d395;_0x22aa8d[_0x5819('0x38')]=_[_0x5819('0x39')](db['Interval'][_0x5819('0x34')]);_0x22aa8d[_0x5819('0x3a')]=_['keys'](_0x118a84[_0x5819('0x3a')]);_0x22aa8d[_0x5819('0x3b')]=_[_0x5819('0x3c')](_0x22aa8d[_0x5819('0x38')],_0x22aa8d[_0x5819('0x3a')]);_0x29be17[_0x5819('0x3d')]=_[_0x5819('0x3c')](_0x22aa8d['model'],qs[_0x5819('0x3e')](_0x118a84[_0x5819('0x3a')][_0x5819('0x3e')]));_0x29be17[_0x5819('0x3d')]=_0x29be17['attributes']['length']?_0x29be17[_0x5819('0x3d')]:_0x22aa8d[_0x5819('0x38')];_0x29be17[_0x5819('0x42')]=qs[_0x5819('0x43')](_0x118a84[_0x5819('0x3a')][_0x5819('0x43')]);_0x29be17[_0x5819('0x44')]=qs[_0x5819('0x3b')](_[_0x5819('0x45')](_0x118a84[_0x5819('0x3a')],_0x22aa8d[_0x5819('0x3b')]));if(_0x118a84['query'][_0x5819('0x46')]){_0x29be17[_0x5819('0x44')]=_['merge'](_0x29be17['where'],{'$or':_[_0x5819('0x32')](_0x29be17[_0x5819('0x3d')],function(_0x3b9cae){var _0x2086f6={};_0x2086f6[_0x3b9cae]={'$like':'%'+_0x118a84[_0x5819('0x3a')][_0x5819('0x46')]+'%'};return _0x2086f6;})});}_0x29be17=_[_0x5819('0x47')]({},_0x29be17,_0x118a84['options']);return _0x24a1b7['getIntervals'](_0x29be17);}})[_0x5819('0x2b')](function(_0x328ed7){if(_0x328ed7){_0x5f03d2=_0x328ed7[_0x5819('0x3f')];if(!_0x118a84[_0x5819('0x3a')][_0x5819('0x40')](_0x5819('0x41'))){_0x29be17['limit']=qs[_0x5819('0x24')](_0x118a84[_0x5819('0x3a')][_0x5819('0x24')]);_0x29be17[_0x5819('0x22')]=qs[_0x5819('0x22')](_0x118a84['query']['offset']);}return _0x24a1b7[_0x5819('0x5d')](_0x29be17);}})['then'](function(_0x5cf552){if(_0x5cf552){return _0x5cf552?{'count':_0x5f03d2,'rows':_0x5cf552}:null;}})[_0x5819('0x2b')](respondWithResult(_0x3600f9,null))['catch'](handleError(_0x3600f9,null));};exports[_0x5819('0x5e')]=function(_0x59b63d,_0x36b7c3,_0x427c20){return db[_0x5819('0x33')][_0x5819('0x5f')]({'where':{'id':_0x59b63d[_0x5819('0x4d')]['id']}})['then'](handleEntityNotFound(_0x36b7c3,null))[_0x5819('0x2b')](function(_0x55f3e5){if(_0x55f3e5){return db['sequelize'][_0x5819('0x60')](function(_0x29c4c3){return db['Interval']['destroy']({'where':{'IntervalId':_0x59b63d['params']['id']},'transaction':_0x29c4c3})['then'](function(_0x36588f){var _0x36c266=_[_0x5819('0x32')](_0x59b63d['body'],function(_0x394817){delete _0x394817['id'];_0x394817['IntervalId']=_0x59b63d[_0x5819('0x4d')]['id'];return _0x394817;});return db[_0x5819('0x33')][_0x5819('0x61')](_0x36c266,{'transaction':_0x29c4c3});});})[_0x5819('0x2b')](function(){return db[_0x5819('0x33')][_0x5819('0x4b')]({'where':{'IntervalId':_0x59b63d['params']['id']}});});}})['then'](respondWithResult(_0x36b7c3,null))[_0x5819('0x4c')](handleError(_0x36b7c3,null));}; \ No newline at end of file +var _0xde35=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','then','destroy','get','error','name','send','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','getIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra'];(function(_0xa7242,_0x4e1f07){var _0x35e329=function(_0x4de89d){while(--_0x4de89d){_0xa7242['push'](_0xa7242['shift']());}};_0x35e329(++_0x4e1f07);}(_0xde35,0xad));var _0x5de3=function(_0x301c9a,_0x8b0129){_0x301c9a=_0x301c9a-0x0;var _0x47fe5e=_0xde35[_0x301c9a];return _0x47fe5e;};'use strict';var emlformat=require(_0x5de3('0x0'));var rimraf=require(_0x5de3('0x1'));var zipdir=require(_0x5de3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5de3('0x3'));var moment=require(_0x5de3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5de3('0x5'));var util=require(_0x5de3('0x6'));var path=require(_0x5de3('0x7'));var sox=require(_0x5de3('0x8'));var csv=require(_0x5de3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5de3('0xa'));var _=require(_0x5de3('0xb'));var squel=require(_0x5de3('0xc'));var crypto=require(_0x5de3('0xd'));var jsforce=require(_0x5de3('0xe'));var deskjs=require(_0x5de3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5de3('0x10'));var Papa=require(_0x5de3('0x11'));var Redis=require('ioredis');var authService=require(_0x5de3('0x12'));var qs=require(_0x5de3('0x13'));var as=require(_0x5de3('0x14'));var hardwareService=require(_0x5de3('0x15'));var logger=require(_0x5de3('0x16'))(_0x5de3('0x17'));var utils=require(_0x5de3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5de3('0x19'));var db=require(_0x5de3('0x1a'))['db'];var extensions=require(_0x5de3('0x1b'));function respondWithStatusCode(_0x38d9d6,_0x36f433){_0x36f433=_0x36f433||0xcc;return function(_0x4bd2ed){if(_0x4bd2ed){return _0x38d9d6[_0x5de3('0x1c')](_0x36f433);}return _0x38d9d6[_0x5de3('0x1d')](_0x36f433)[_0x5de3('0x1e')]();};}function respondWithResult(_0x89e729,_0x3b8fd3){_0x3b8fd3=_0x3b8fd3||0xc8;return function(_0x1ea5a0){if(_0x1ea5a0){return _0x89e729['status'](_0x3b8fd3)['json'](_0x1ea5a0);}};}function respondWithFilteredResult(_0x4b188d,_0x284d2f){return function(_0x4de81e){if(_0x4de81e){var _0x1c4bc5=typeof _0x284d2f['offset']===_0x5de3('0x1f')&&typeof _0x284d2f[_0x5de3('0x20')]===_0x5de3('0x1f');var _0x7b7139=_0x4de81e[_0x5de3('0x21')];var _0x142fa7=_0x1c4bc5?0x0:_0x284d2f['offset'];var _0x4837dc=_0x1c4bc5?_0x4de81e[_0x5de3('0x21')]:_0x284d2f[_0x5de3('0x22')]+_0x284d2f['limit'];var _0x3217b4;if(_0x4837dc>=_0x7b7139){_0x4837dc=_0x7b7139;_0x3217b4=0xc8;}else{_0x3217b4=0xce;}_0x4b188d[_0x5de3('0x1d')](_0x3217b4);return _0x4b188d[_0x5de3('0x23')](_0x5de3('0x24'),_0x142fa7+'-'+_0x4837dc+'/'+_0x7b7139)[_0x5de3('0x25')](_0x4de81e);}return null;};}function patchUpdates(_0x4c5aa8){return function(_0x55672b){try{jsonpatch['apply'](_0x55672b,_0x4c5aa8,!![]);}catch(_0x18d762){return BPromise['reject'](_0x18d762);}return _0x55672b[_0x5de3('0x26')]();};}function saveUpdates(_0x6f3a4e,_0x532a62){return function(_0x19cad2){if(_0x19cad2){return _0x19cad2['update'](_0x6f3a4e)[_0x5de3('0x27')](function(_0x2ce8b0){return _0x2ce8b0;});}return null;};}function removeEntity(_0x9098a4,_0x59143c){return function(_0x36f06f){if(_0x36f06f){return _0x36f06f[_0x5de3('0x28')]()[_0x5de3('0x27')](function(){var _0x2b3b54=_0x36f06f[_0x5de3('0x29')]({'plain':!![]});var _0xe388ae='Intervals';return db['UserProfileResource'][_0x5de3('0x28')]({'where':{'type':_0xe388ae,'resourceId':_0x2b3b54['id']}})[_0x5de3('0x27')](function(){return _0x36f06f;});})[_0x5de3('0x27')](function(){_0x9098a4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58aa3b,_0x4d4ff5){return function(_0x31436f){if(!_0x31436f){_0x58aa3b[_0x5de3('0x1c')](0x194);}return _0x31436f;};}function handleError(_0x19038d,_0x47148f){_0x47148f=_0x47148f||0x1f4;return function(_0x1ff226){logger[_0x5de3('0x2a')](_0x1ff226['stack']);if(_0x1ff226[_0x5de3('0x2b')]){delete _0x1ff226[_0x5de3('0x2b')];}_0x19038d['status'](_0x47148f)[_0x5de3('0x2c')](_0x1ff226);};}exports['index']=function(_0x18098f,_0x307b3d){var _0x2b574e={},_0x40d16d={},_0x2b7656={'count':0x0,'rows':[]};var _0x169372=_[_0x5de3('0x2d')](db[_0x5de3('0x2e')][_0x5de3('0x2f')],function(_0x1943f0){return{'name':_0x1943f0[_0x5de3('0x30')],'type':_0x1943f0[_0x5de3('0x31')][_0x5de3('0x32')]};});_0x40d16d['model']=_['map'](_0x169372,_0x5de3('0x2b'));_0x40d16d[_0x5de3('0x33')]=_[_0x5de3('0x34')](_0x18098f[_0x5de3('0x33')]);_0x40d16d[_0x5de3('0x35')]=_[_0x5de3('0x36')](_0x40d16d[_0x5de3('0x37')],_0x40d16d['query']);_0x2b574e['attributes']=_['intersection'](_0x40d16d['model'],qs[_0x5de3('0x38')](_0x18098f[_0x5de3('0x33')][_0x5de3('0x38')]));_0x2b574e[_0x5de3('0x39')]=_0x2b574e[_0x5de3('0x39')][_0x5de3('0x3a')]?_0x2b574e['attributes']:_0x40d16d[_0x5de3('0x37')];if(!_0x18098f[_0x5de3('0x33')][_0x5de3('0x3b')](_0x5de3('0x3c'))){_0x2b574e[_0x5de3('0x20')]=qs[_0x5de3('0x20')](_0x18098f[_0x5de3('0x33')][_0x5de3('0x20')]);_0x2b574e[_0x5de3('0x22')]=qs[_0x5de3('0x22')](_0x18098f[_0x5de3('0x33')]['offset']);}_0x2b574e[_0x5de3('0x3d')]=qs['sort'](_0x18098f[_0x5de3('0x33')][_0x5de3('0x3e')]);_0x2b574e['where']=qs[_0x5de3('0x35')](_[_0x5de3('0x3f')](_0x18098f[_0x5de3('0x33')],_0x40d16d[_0x5de3('0x35')]),_0x169372);if(_0x18098f['query'][_0x5de3('0x40')]){_0x2b574e[_0x5de3('0x41')]=_[_0x5de3('0x42')](_0x2b574e[_0x5de3('0x41')],{'$or':_[_0x5de3('0x2d')](_0x169372,function(_0x4d6d4e){if(_0x4d6d4e[_0x5de3('0x31')]!==_0x5de3('0x43')){var _0xda72c5={};_0xda72c5[_0x4d6d4e['name']]={'$like':'%'+_0x18098f[_0x5de3('0x33')][_0x5de3('0x40')]+'%'};return _0xda72c5;}})});}_0x2b574e=_['merge']({},_0x2b574e,_0x18098f[_0x5de3('0x44')]);var _0x61c588={'where':_0x2b574e[_0x5de3('0x41')]};return db[_0x5de3('0x2e')][_0x5de3('0x21')](_0x61c588)[_0x5de3('0x27')](function(_0x22667c){_0x2b7656[_0x5de3('0x21')]=_0x22667c;if(_0x18098f[_0x5de3('0x33')][_0x5de3('0x45')]){_0x2b574e[_0x5de3('0x46')]=[{'all':!![]}];}return db[_0x5de3('0x2e')][_0x5de3('0x47')](_0x2b574e);})[_0x5de3('0x27')](function(_0x7c3e63){_0x2b7656[_0x5de3('0x48')]=_0x7c3e63;return _0x2b7656;})[_0x5de3('0x27')](respondWithFilteredResult(_0x307b3d,_0x2b574e))['catch'](handleError(_0x307b3d,null));};exports['show']=function(_0x25263f,_0x402570){var _0x41b868={'raw':!![],'where':{'id':_0x25263f['params']['id']}},_0xdd6920={};_0xdd6920[_0x5de3('0x37')]=_[_0x5de3('0x34')](db[_0x5de3('0x2e')]['rawAttributes']);_0xdd6920[_0x5de3('0x33')]=_[_0x5de3('0x34')](_0x25263f[_0x5de3('0x33')]);_0xdd6920[_0x5de3('0x35')]=_[_0x5de3('0x36')](_0xdd6920[_0x5de3('0x37')],_0xdd6920[_0x5de3('0x33')]);_0x41b868[_0x5de3('0x39')]=_[_0x5de3('0x36')](_0xdd6920[_0x5de3('0x37')],qs['fields'](_0x25263f['query'][_0x5de3('0x38')]));_0x41b868[_0x5de3('0x39')]=_0x41b868[_0x5de3('0x39')][_0x5de3('0x3a')]?_0x41b868[_0x5de3('0x39')]:_0xdd6920['model'];if(_0x25263f[_0x5de3('0x33')][_0x5de3('0x45')]){_0x41b868['include']=[{'all':!![]}];}_0x41b868=_[_0x5de3('0x42')]({},_0x41b868,_0x25263f['options']);return db[_0x5de3('0x2e')][_0x5de3('0x49')](_0x41b868)[_0x5de3('0x27')](handleEntityNotFound(_0x402570,null))[_0x5de3('0x27')](respondWithResult(_0x402570,null))[_0x5de3('0x4a')](handleError(_0x402570,null));};exports[_0x5de3('0x4b')]=function(_0x45ef19,_0xfa16c9){return db[_0x5de3('0x2e')][_0x5de3('0x4b')](_0x45ef19[_0x5de3('0x4c')],{})['then'](function(_0x3cf688){var _0x8040c5=_0x45ef19[_0x5de3('0x4d')][_0x5de3('0x29')]({'plain':!![]});if(!_0x8040c5)throw new Error(_0x5de3('0x4e'));if(_0x8040c5[_0x5de3('0x4f')]==='user'){var _0x1b01b7=_0x3cf688[_0x5de3('0x29')]({'plain':!![]});var _0x286e88='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x286e88,'userProfileId':_0x8040c5[_0x5de3('0x50')]},'raw':!![]})[_0x5de3('0x27')](function(_0x4c9d91){if(_0x4c9d91&&_0x4c9d91['autoAssociation']===0x0){return db[_0x5de3('0x51')]['create']({'name':_0x1b01b7[_0x5de3('0x2b')],'resourceId':_0x1b01b7['id'],'type':_0x4c9d91[_0x5de3('0x2b')],'sectionId':_0x4c9d91['id']},{})[_0x5de3('0x27')](function(){return _0x3cf688;});}else{return _0x3cf688;}})[_0x5de3('0x4a')](function(_0x56b39c){logger[_0x5de3('0x2a')](_0x5de3('0x52'),_0x56b39c);throw _0x56b39c;});}return _0x3cf688;})[_0x5de3('0x27')](respondWithResult(_0xfa16c9,0xc9))[_0x5de3('0x4a')](handleError(_0xfa16c9,null));};exports[_0x5de3('0x53')]=function(_0xd7bd85,_0x5e02bb){if(_0xd7bd85[_0x5de3('0x4c')]['id']){delete _0xd7bd85[_0x5de3('0x4c')]['id'];}return db[_0x5de3('0x2e')][_0x5de3('0x49')]({'where':{'id':_0xd7bd85['params']['id']}})[_0x5de3('0x27')](handleEntityNotFound(_0x5e02bb,null))['then'](saveUpdates(_0xd7bd85[_0x5de3('0x4c')],null))['then'](respondWithResult(_0x5e02bb,null))[_0x5de3('0x4a')](handleError(_0x5e02bb,null));};exports[_0x5de3('0x28')]=function(_0x124a6e,_0x36e572){return db[_0x5de3('0x2e')][_0x5de3('0x49')]({'where':{'id':_0x124a6e[_0x5de3('0x54')]['id']}})['then'](handleEntityNotFound(_0x36e572,null))[_0x5de3('0x27')](removeEntity(_0x36e572,null))[_0x5de3('0x4a')](handleError(_0x36e572,null));};exports[_0x5de3('0x55')]=function(_0x5dbef1,_0x21099f,_0x3a627e){if(_0x5dbef1['body']['id']){delete _0x5dbef1[_0x5de3('0x4c')]['id'];}return db['Interval']['find']({'where':{'id':_0x5dbef1[_0x5de3('0x54')]['id']}})[_0x5de3('0x27')](handleEntityNotFound(_0x21099f,null))[_0x5de3('0x27')](function(_0x5d81de){if(_0x5d81de){_0x5dbef1[_0x5de3('0x4c')]['IntervalId']=_0x5d81de['id'];return db[_0x5de3('0x2e')]['create'](_0x5dbef1['body']);}})['then'](respondWithResult(_0x21099f,null))[_0x5de3('0x4a')](handleError(_0x21099f,null));};exports[_0x5de3('0x56')]=function(_0x5c997f,_0xfd602f,_0x115569){var _0x3bdf87={};var _0x102b91={};var _0x25cad5;var _0x3ee0d6;return db[_0x5de3('0x2e')]['findOne']({'where':{'id':_0x5c997f[_0x5de3('0x54')]['id']}})['then'](handleEntityNotFound(_0xfd602f,null))[_0x5de3('0x27')](function(_0x5ddb1e){if(_0x5ddb1e){_0x25cad5=_0x5ddb1e;_0x102b91[_0x5de3('0x37')]=_[_0x5de3('0x34')](db[_0x5de3('0x2e')][_0x5de3('0x2f')]);_0x102b91[_0x5de3('0x33')]=_[_0x5de3('0x34')](_0x5c997f['query']);_0x102b91[_0x5de3('0x35')]=_[_0x5de3('0x36')](_0x102b91['model'],_0x102b91['query']);_0x3bdf87[_0x5de3('0x39')]=_[_0x5de3('0x36')](_0x102b91[_0x5de3('0x37')],qs[_0x5de3('0x38')](_0x5c997f[_0x5de3('0x33')]['fields']));_0x3bdf87[_0x5de3('0x39')]=_0x3bdf87['attributes']['length']?_0x3bdf87[_0x5de3('0x39')]:_0x102b91['model'];_0x3bdf87['order']=qs[_0x5de3('0x3e')](_0x5c997f['query'][_0x5de3('0x3e')]);_0x3bdf87[_0x5de3('0x41')]=qs[_0x5de3('0x35')](_[_0x5de3('0x3f')](_0x5c997f[_0x5de3('0x33')],_0x102b91[_0x5de3('0x35')]));if(_0x5c997f[_0x5de3('0x33')][_0x5de3('0x40')]){_0x3bdf87[_0x5de3('0x41')]=_[_0x5de3('0x42')](_0x3bdf87['where'],{'$or':_[_0x5de3('0x2d')](_0x3bdf87[_0x5de3('0x39')],function(_0x172d9c){var _0x3cb2e0={};_0x3cb2e0[_0x172d9c]={'$like':'%'+_0x5c997f[_0x5de3('0x33')]['filter']+'%'};return _0x3cb2e0;})});}_0x3bdf87=_[_0x5de3('0x42')]({},_0x3bdf87,_0x5c997f['options']);return _0x25cad5['getIntervals'](_0x3bdf87);}})[_0x5de3('0x27')](function(_0x4523a7){if(_0x4523a7){_0x3ee0d6=_0x4523a7[_0x5de3('0x3a')];if(!_0x5c997f[_0x5de3('0x33')][_0x5de3('0x3b')](_0x5de3('0x3c'))){_0x3bdf87[_0x5de3('0x20')]=qs['limit'](_0x5c997f[_0x5de3('0x33')][_0x5de3('0x20')]);_0x3bdf87[_0x5de3('0x22')]=qs['offset'](_0x5c997f[_0x5de3('0x33')][_0x5de3('0x22')]);}return _0x25cad5['getIntervals'](_0x3bdf87);}})[_0x5de3('0x27')](function(_0x2f8b83){if(_0x2f8b83){return _0x2f8b83?{'count':_0x3ee0d6,'rows':_0x2f8b83}:null;}})[_0x5de3('0x27')](respondWithResult(_0xfd602f,null))[_0x5de3('0x4a')](handleError(_0xfd602f,null));};exports['addIntervals']=function(_0x864755,_0x40b0ac,_0xaab3ca){return db[_0x5de3('0x2e')][_0x5de3('0x57')]({'where':{'id':_0x864755['params']['id']}})['then'](handleEntityNotFound(_0x40b0ac,null))[_0x5de3('0x27')](function(_0x1e577d){if(_0x1e577d){return db[_0x5de3('0x58')][_0x5de3('0x59')](function(_0x2e8166){return db[_0x5de3('0x2e')][_0x5de3('0x28')]({'where':{'IntervalId':_0x864755[_0x5de3('0x54')]['id']},'transaction':_0x2e8166})[_0x5de3('0x27')](function(_0x41da6f){var _0xb566a4=_[_0x5de3('0x2d')](_0x864755[_0x5de3('0x4c')],function(_0x2444fb){delete _0x2444fb['id'];_0x2444fb[_0x5de3('0x5a')]=_0x864755['params']['id'];return _0x2444fb;});return db[_0x5de3('0x2e')][_0x5de3('0x5b')](_0xb566a4,{'transaction':_0x2e8166});});})['then'](function(){return db[_0x5de3('0x2e')][_0x5de3('0x47')]({'where':{'IntervalId':_0x864755[_0x5de3('0x54')]['id']}});});}})[_0x5de3('0x27')](respondWithResult(_0x40b0ac,null))[_0x5de3('0x4a')](handleError(_0x40b0ac,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index abec10b..cc247ac 100644 --- a/server/api/interval/interval.model.js +++ b/server/api/interval/interval.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6792=['string','getIntervals','then','all','ifTime','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','interval'];(function(_0x39b491,_0x597e2b){var _0x597fec=function(_0x22e28a){while(--_0x22e28a){_0x39b491['push'](_0x39b491['shift']());}};_0x597fec(++_0x597e2b);}(_0x6792,0x1d9));var _0x2679=function(_0x5439f1,_0x1605ee){_0x5439f1=_0x5439f1-0x0;var _0x4a1516=_0x6792[_0x5439f1];return _0x4a1516;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x2679('0x0'));var iftime=require(_0x2679('0x1'))[_0x2679('0x2')];module[_0x2679('0x3')]=function(_0x4f35b){return _0x4f35b['define'](_0x2679('0x4'),attributes,{'tableName':_0x2679('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f08ae){extensions[_0x2679('0x6')](_0x4f35b,_0x5f08ae);},'afterBulkCreate':function(_0x11f964,_0x56916c,_0x1adcc1){_0x1adcc1();extensions[_0x2679('0x6')](_0x4f35b,_0x11f964[0x0]);},'afterUpdate':function(_0x151ce7){extensions[_0x2679('0x6')](_0x4f35b,_0x151ce7);},'afterDestroy':function(_0x456376){extensions[_0x2679('0x6')](_0x4f35b,_0x456376);}},'instanceMethods':{'ifTime':function(_0xf1a83f=undefined,_0x27f1ff=new Date()){if(typeof this[_0x2679('0x7')]===_0x2679('0x8')){return iftime(this[_0x2679('0x7')],_0xf1a83f,_0x27f1ff);}else{return this[_0x2679('0x9')]()[_0x2679('0xa')](function(_0x1ca1fb){return Promise[_0x2679('0xb')](_0x1ca1fb['map'](function(_0x46aeef){return _0x46aeef[_0x2679('0xc')](_0xf1a83f,_0x27f1ff);}));})[_0x2679('0xa')](function(_0x4c457b){return _0x4c457b['reduce'](function(_0x4b410c,_0x195fe9){return _0x4b410c||_0x195fe9;},![]);});}}}});}; \ No newline at end of file +var _0xc722=['rewrite','interval','string','getIntervals','then','all','map','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','define','Interval','tools_intervals'];(function(_0x1b0fc0,_0x11a27e){var _0x3ec5e5=function(_0x24b541){while(--_0x24b541){_0x1b0fc0['push'](_0x1b0fc0['shift']());}};_0x3ec5e5(++_0x11a27e);}(_0xc722,0x1ba));var _0x2c72=function(_0x5cdf91,_0x4555cb){_0x5cdf91=_0x5cdf91-0x0;var _0x2b2c41=_0xc722[_0x5cdf91];return _0x2b2c41;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x2c72('0x0'));var iftime=require(_0x2c72('0x1'))[_0x2c72('0x2')];module['exports']=function(_0xef5175){return _0xef5175[_0x2c72('0x3')](_0x2c72('0x4'),attributes,{'tableName':_0x2c72('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c59d5){extensions[_0x2c72('0x6')](_0xef5175,_0x3c59d5);},'afterBulkCreate':function(_0x19483c,_0xefa53b,_0x337980){_0x337980();extensions[_0x2c72('0x6')](_0xef5175,_0x19483c[0x0]);},'afterUpdate':function(_0x7eac1f){extensions[_0x2c72('0x6')](_0xef5175,_0x7eac1f);},'afterDestroy':function(_0x2fe817){extensions[_0x2c72('0x6')](_0xef5175,_0x2fe817);}},'instanceMethods':{'ifTime':function(_0x5a0e76=undefined,_0x3c3d82=new Date()){if(typeof this[_0x2c72('0x7')]===_0x2c72('0x8')){return iftime(this[_0x2c72('0x7')],_0x5a0e76,_0x3c3d82);}else{return this[_0x2c72('0x9')]()[_0x2c72('0xa')](function(_0x222ef8){return Promise[_0x2c72('0xb')](_0x222ef8[_0x2c72('0xc')](function(_0x228d74){return _0x228d74['ifTime'](_0x5a0e76,_0x3c3d82);}));})[_0x2c72('0xa')](function(_0x49aa75){return _0x49aa75[_0x2c72('0xd')](function(_0x1009a7,_0x48d81c){return _0x1009a7||_0x48d81c;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ddc8165..e831a4a 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd7b=['IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','options','raw','where','include','map','attributes','model','then','info','debug','stringify','catch','message','error','ShowInterval','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length'];(function(_0x420aea,_0x52b7b0){var _0x5a0e72=function(_0x945e03){while(--_0x945e03){_0x420aea['push'](_0x420aea['shift']());}};_0x5a0e72(++_0x52b7b0);}(_0xdd7b,0xdc));var _0xbdd7=function(_0x1cf6ed,_0x40f415){_0x1cf6ed=_0x1cf6ed-0x0;var _0x29984a=_0xdd7b[_0x1cf6ed];return _0x29984a;};'use strict';var _=require(_0xbdd7('0x0'));var util=require(_0xbdd7('0x1'));var db=require(_0xbdd7('0x2'))['db'];var iftime=require(_0xbdd7('0x3'))[_0xbdd7('0x4')];var logger=require('../../config/logger')(_0xbdd7('0x5'));exports[_0xbdd7('0x6')]=function(_0x37f3f6){var _0xfa4343=this;return new Promise(function(_0x31f0a2,_0x4e2371){return db[_0xbdd7('0x7')][_0xbdd7('0x8')]({'raw':_0x37f3f6[_0xbdd7('0x9')]?_0x37f3f6[_0xbdd7('0x9')][_0xbdd7('0xa')]===undefined?!![]:![]:!![],'where':_0x37f3f6[_0xbdd7('0x9')]?_0x37f3f6[_0xbdd7('0x9')][_0xbdd7('0xb')]||null:null,'attributes':_0x37f3f6[_0xbdd7('0x9')]?_0x37f3f6[_0xbdd7('0x9')]['attributes']||null:null,'limit':_0x37f3f6[_0xbdd7('0x9')]?_0x37f3f6[_0xbdd7('0x9')]['limit']||null:null,'include':_0x37f3f6[_0xbdd7('0x9')]?_0x37f3f6[_0xbdd7('0x9')][_0xbdd7('0xc')]?_[_0xbdd7('0xd')](_0x37f3f6[_0xbdd7('0x9')][_0xbdd7('0xc')],function(_0x30bedd){return{'model':db[_0x30bedd['model']],'as':_0x30bedd['as'],'attributes':_0x30bedd[_0xbdd7('0xe')],'include':_0x30bedd[_0xbdd7('0xc')]?_[_0xbdd7('0xd')](_0x30bedd[_0xbdd7('0xc')],function(_0x5b6aee){return{'model':db[_0x5b6aee[_0xbdd7('0xf')]],'as':_0x5b6aee['as'],'attributes':_0x5b6aee[_0xbdd7('0xe')],'include':_0x5b6aee[_0xbdd7('0xc')]?_[_0xbdd7('0xd')](_0x5b6aee[_0xbdd7('0xc')],function(_0xf67db){return{'model':db[_0xf67db[_0xbdd7('0xf')]],'as':_0xf67db['as'],'attributes':_0xf67db[_0xbdd7('0xe')]};}):[]};}):[]};}):[]:[]})[_0xbdd7('0x10')](function(_0x1303a5){logger[_0xbdd7('0x11')](_0xbdd7('0x6'),_0x37f3f6);logger[_0xbdd7('0x12')]('GetInterval',_0x37f3f6,JSON[_0xbdd7('0x13')](_0x1303a5));_0x31f0a2(_0x1303a5);})[_0xbdd7('0x14')](function(_0x3753c2){logger['error'](_0xbdd7('0x6'),_0x3753c2[_0xbdd7('0x15')],_0x37f3f6);_0x4e2371(_0xfa4343[_0xbdd7('0x16')](0x1f4,_0x3753c2[_0xbdd7('0x15')]));});});};exports[_0xbdd7('0x17')]=function(_0x33c599){var _0x1d8391=this;return new Promise(function(_0x39aa2f,_0xa39a94){return db['Interval']['find']({'raw':_0x33c599[_0xbdd7('0x9')]?_0x33c599['options']['raw']===undefined?!![]:![]:!![],'where':_0x33c599[_0xbdd7('0x9')]?_0x33c599[_0xbdd7('0x9')][_0xbdd7('0xb')]||null:null,'attributes':_0x33c599[_0xbdd7('0x9')]?_0x33c599[_0xbdd7('0x9')][_0xbdd7('0xe')]||null:null,'include':_0x33c599[_0xbdd7('0x9')]?_0x33c599['options']['include']?_['map'](_0x33c599['options'][_0xbdd7('0xc')],function(_0x5759fd){return{'model':db[_0x5759fd['model']],'as':_0x5759fd['as'],'attributes':_0x5759fd['attributes'],'include':_0x5759fd[_0xbdd7('0xc')]?_[_0xbdd7('0xd')](_0x5759fd[_0xbdd7('0xc')],function(_0xd21ca5){return{'model':db[_0xd21ca5['model']],'as':_0xd21ca5['as'],'attributes':_0xd21ca5[_0xbdd7('0xe')],'include':_0xd21ca5['include']?_['map'](_0xd21ca5['include'],function(_0x381c8d){return{'model':db[_0x381c8d[_0xbdd7('0xf')]],'as':_0x381c8d['as'],'attributes':_0x381c8d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x514e60){logger['info']('ShowInterval',_0x33c599);logger['debug'](_0xbdd7('0x17'),_0x33c599,JSON['stringify'](_0x514e60));_0x39aa2f(_0x514e60);})['catch'](function(_0x1d7be7){logger['error'](_0xbdd7('0x17'),_0x1d7be7[_0xbdd7('0x15')],_0x33c599);_0xa39a94(_0x1d8391[_0xbdd7('0x16')](0x1f4,_0x1d7be7[_0xbdd7('0x15')]));});});};function checkArrayOfIntervals(_0x1c5207,_0x8fdab1){var _0x3308c0=[];return db[_0xbdd7('0x7')]['findAll']({'where':{'id':_0x1c5207}})[_0xbdd7('0x10')](function(_0x3b1efd){_0x3308c0=_0x3b1efd;return Promise[_0xbdd7('0x18')](_0x3308c0[_0xbdd7('0xd')](function(_0x4c7b04){return _0x4c7b04[_0xbdd7('0x19')](_0x8fdab1);}));})[_0xbdd7('0x10')](function(_0x436db2){var _0x317f9a=_0x436db2['reduce'](function(_0x19b9e4,_0x13d4ee){return _0x19b9e4||_0x13d4ee;},![]);logger[_0xbdd7('0x11')](util[_0xbdd7('0x1a')](_0xbdd7('0x1b'),_0x3308c0['map'](function(_0x39ce95){return _0x39ce95[_0xbdd7('0x1c')];})[_0xbdd7('0x1d')](',\x20'),_0x3308c0[_0xbdd7('0xd')](function(_0xc8d9c5){return _0xc8d9c5['id'];})[_0xbdd7('0x1d')](',\x20')));return _0x317f9a;});}function checkSingleInterval(_0x449a1e,_0xfe6b58){return db[_0xbdd7('0x7')]['findById'](_0x449a1e)['then'](function(_0x5bb64c){if(_0x5bb64c){logger[_0xbdd7('0x11')](util[_0xbdd7('0x1a')](_0xbdd7('0x1e'),_0x5bb64c[_0xbdd7('0x1c')],_0x5bb64c['id']));return _0x5bb64c[_0xbdd7('0x19')](_0xfe6b58);}});}exports[_0xbdd7('0x1f')]=function(_0x5177b9){var _0x2cb2af=_0x5177b9[_0xbdd7('0x20')];var _0x4992db=Array[_0xbdd7('0x21')](_0x5177b9[_0xbdd7('0x22')])?_0x5177b9[_0xbdd7('0x22')]:typeof _0x5177b9[_0xbdd7('0x22')]===_0xbdd7('0x23')?[_0x5177b9[_0xbdd7('0x22')]]:[];var _0x4dcd33=_0x5177b9[_0xbdd7('0x24')]||undefined;var _0x11261c=![];if(_0x4992db[_0xbdd7('0x25')]){logger['info'](util['format'](_0xbdd7('0x26'),_0x4992db[_0xbdd7('0x1d')](';\x20')));}if(_0x4dcd33){logger['info'](util[_0xbdd7('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x4dcd33));}logger[_0xbdd7('0x12')](_0xbdd7('0x27'),_0x11261c);logger[_0xbdd7('0x28')](_0xbdd7('0x1f'),_0x5177b9);return Promise[_0xbdd7('0x29')]()[_0xbdd7('0x10')](function(){if(Array[_0xbdd7('0x21')](_0x2cb2af)){return checkArrayOfIntervals(_0x2cb2af,_0x4dcd33);}else if(_0x2cb2af){return checkSingleInterval(_0x2cb2af,_0x4dcd33);}})[_0xbdd7('0x10')](function(_0x5a8471){var _0x49fe7a=_0x4992db[_0xbdd7('0x2a')](function(_0x3f776e,_0x5e806f){return _0x3f776e||iftime(_0x5e806f,_0x4dcd33);},![]);_0x11261c=_0x5a8471||_0x49fe7a;return _0x11261c;})[_0xbdd7('0x14')](function(_0x38ee97){logger[_0xbdd7('0x16')](_0xbdd7('0x1f'),_0x5177b9,_0x38ee97);throw this['error'](0x1f4,_0x38ee97[_0xbdd7('0x15')]);});}; \ No newline at end of file +var _0xf1ff=['timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','reduce','util','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','catch','error','message','Interval','ShowInterval','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string'];(function(_0x96883e,_0x2364dc){var _0x4a9ff0=function(_0x599b46){while(--_0x599b46){_0x96883e['push'](_0x96883e['shift']());}};_0x4a9ff0(++_0x2364dc);}(_0xf1ff,0x181));var _0xff1f=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0xf1ff[_0x50c492];return _0x3505a8;};'use strict';var _=require('lodash');var util=require(_0xff1f('0x0'));var db=require('../../mysqldb')['db'];var iftime=require(_0xff1f('0x1'))[_0xff1f('0x2')];var logger=require(_0xff1f('0x3'))(_0xff1f('0x4'));exports[_0xff1f('0x5')]=function(_0x2ef512){var _0x132c95=this;return new Promise(function(_0x3b73d9,_0x3ccd52){return db['Interval'][_0xff1f('0x6')]({'raw':_0x2ef512[_0xff1f('0x7')]?_0x2ef512['options'][_0xff1f('0x8')]===undefined?!![]:![]:!![],'where':_0x2ef512[_0xff1f('0x7')]?_0x2ef512[_0xff1f('0x7')][_0xff1f('0x9')]||null:null,'attributes':_0x2ef512[_0xff1f('0x7')]?_0x2ef512['options']['attributes']||null:null,'limit':_0x2ef512[_0xff1f('0x7')]?_0x2ef512[_0xff1f('0x7')][_0xff1f('0xa')]||null:null,'include':_0x2ef512[_0xff1f('0x7')]?_0x2ef512['options'][_0xff1f('0xb')]?_[_0xff1f('0xc')](_0x2ef512[_0xff1f('0x7')]['include'],function(_0x21d197){return{'model':db[_0x21d197[_0xff1f('0xd')]],'as':_0x21d197['as'],'attributes':_0x21d197[_0xff1f('0xe')],'include':_0x21d197[_0xff1f('0xb')]?_['map'](_0x21d197[_0xff1f('0xb')],function(_0x15d9b1){return{'model':db[_0x15d9b1[_0xff1f('0xd')]],'as':_0x15d9b1['as'],'attributes':_0x15d9b1[_0xff1f('0xe')],'include':_0x15d9b1[_0xff1f('0xb')]?_[_0xff1f('0xc')](_0x15d9b1[_0xff1f('0xb')],function(_0x476d4a){return{'model':db[_0x476d4a[_0xff1f('0xd')]],'as':_0x476d4a['as'],'attributes':_0x476d4a[_0xff1f('0xe')]};}):[]};}):[]};}):[]:[]})[_0xff1f('0xf')](function(_0x18fc09){logger[_0xff1f('0x10')]('GetInterval',_0x2ef512);logger[_0xff1f('0x11')](_0xff1f('0x5'),_0x2ef512,JSON[_0xff1f('0x12')](_0x18fc09));_0x3b73d9(_0x18fc09);})[_0xff1f('0x13')](function(_0x11e16b){logger[_0xff1f('0x14')](_0xff1f('0x5'),_0x11e16b['message'],_0x2ef512);_0x3ccd52(_0x132c95['error'](0x1f4,_0x11e16b[_0xff1f('0x15')]));});});};exports['ShowInterval']=function(_0x425693){var _0x4ebb6a=this;return new Promise(function(_0x189cb9,_0x58c313){return db[_0xff1f('0x16')]['find']({'raw':_0x425693[_0xff1f('0x7')]?_0x425693['options'][_0xff1f('0x8')]===undefined?!![]:![]:!![],'where':_0x425693[_0xff1f('0x7')]?_0x425693[_0xff1f('0x7')]['where']||null:null,'attributes':_0x425693[_0xff1f('0x7')]?_0x425693[_0xff1f('0x7')][_0xff1f('0xe')]||null:null,'include':_0x425693[_0xff1f('0x7')]?_0x425693['options'][_0xff1f('0xb')]?_[_0xff1f('0xc')](_0x425693[_0xff1f('0x7')][_0xff1f('0xb')],function(_0x258137){return{'model':db[_0x258137[_0xff1f('0xd')]],'as':_0x258137['as'],'attributes':_0x258137[_0xff1f('0xe')],'include':_0x258137[_0xff1f('0xb')]?_[_0xff1f('0xc')](_0x258137['include'],function(_0x1f857a){return{'model':db[_0x1f857a[_0xff1f('0xd')]],'as':_0x1f857a['as'],'attributes':_0x1f857a['attributes'],'include':_0x1f857a['include']?_['map'](_0x1f857a[_0xff1f('0xb')],function(_0xea1f2e){return{'model':db[_0xea1f2e[_0xff1f('0xd')]],'as':_0xea1f2e['as'],'attributes':_0xea1f2e[_0xff1f('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x377577){logger[_0xff1f('0x10')](_0xff1f('0x17'),_0x425693);logger['debug'](_0xff1f('0x17'),_0x425693,JSON[_0xff1f('0x12')](_0x377577));_0x189cb9(_0x377577);})['catch'](function(_0xc02f22){logger[_0xff1f('0x14')](_0xff1f('0x17'),_0xc02f22['message'],_0x425693);_0x58c313(_0x4ebb6a['error'](0x1f4,_0xc02f22[_0xff1f('0x15')]));});});};function checkArrayOfIntervals(_0x202bad,_0x4fc3c1){var _0x34b4cf=[];return db[_0xff1f('0x16')][_0xff1f('0x6')]({'where':{'id':_0x202bad}})[_0xff1f('0xf')](function(_0x2d6e15){_0x34b4cf=_0x2d6e15;return Promise[_0xff1f('0x18')](_0x34b4cf[_0xff1f('0xc')](function(_0x1442e6){return _0x1442e6[_0xff1f('0x19')](_0x4fc3c1);}));})[_0xff1f('0xf')](function(_0x499b4d){var _0x707002=_0x499b4d['reduce'](function(_0x430ef8,_0x17528f){return _0x430ef8||_0x17528f;},![]);logger[_0xff1f('0x10')](util[_0xff1f('0x1a')](_0xff1f('0x1b'),_0x34b4cf['map'](function(_0x31202f){return _0x31202f['name'];})['join'](',\x20'),_0x34b4cf[_0xff1f('0xc')](function(_0x251682){return _0x251682['id'];})[_0xff1f('0x1c')](',\x20')));return _0x707002;});}function checkSingleInterval(_0x461e94,_0x11b9e5){return db['Interval']['findById'](_0x461e94)[_0xff1f('0xf')](function(_0x1e52ca){if(_0x1e52ca){logger[_0xff1f('0x10')](util['format'](_0xff1f('0x1d'),_0x1e52ca['name'],_0x1e52ca['id']));return _0x1e52ca[_0xff1f('0x19')](_0x11b9e5);}});}exports[_0xff1f('0x1e')]=function(_0x5bdc0e){var _0x53bc52=_0x5bdc0e[_0xff1f('0x1f')];var _0x8397ab=Array[_0xff1f('0x20')](_0x5bdc0e['intervals'])?_0x5bdc0e[_0xff1f('0x21')]:typeof _0x5bdc0e[_0xff1f('0x21')]===_0xff1f('0x22')?[_0x5bdc0e[_0xff1f('0x21')]]:[];var _0x53641f=_0x5bdc0e[_0xff1f('0x23')]||undefined;var _0x4c5fea=![];if(_0x8397ab[_0xff1f('0x24')]){logger[_0xff1f('0x10')](util[_0xff1f('0x1a')](_0xff1f('0x25'),_0x8397ab['join'](';\x20')));}if(_0x53641f){logger[_0xff1f('0x10')](util[_0xff1f('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x53641f));}logger[_0xff1f('0x11')](_0xff1f('0x26'),_0x4c5fea);logger[_0xff1f('0x27')](_0xff1f('0x1e'),_0x5bdc0e);return Promise[_0xff1f('0x28')]()[_0xff1f('0xf')](function(){if(Array[_0xff1f('0x20')](_0x53bc52)){return checkArrayOfIntervals(_0x53bc52,_0x53641f);}else if(_0x53bc52){return checkSingleInterval(_0x53bc52,_0x53641f);}})[_0xff1f('0xf')](function(_0x56e123){var _0x34b776=_0x8397ab[_0xff1f('0x29')](function(_0x2212fe,_0x3c8325){return _0x2212fe||iftime(_0x3c8325,_0x53641f);},![]);_0x4c5fea=_0x56e123||_0x34b776;return _0x4c5fea;})[_0xff1f('0x13')](function(_0x39b7b4){logger[_0xff1f('0x14')](_0xff1f('0x1e'),_0x5bdc0e,_0x39b7b4);throw this[_0xff1f('0x14')](0x1f4,_0x39b7b4[_0xff1f('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e5e4a13..35d48ac 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0xe25f43,_0x5368c8){var _0x22d332=function(_0x147435){while(--_0x147435){_0xe25f43['push'](_0xe25f43['shift']());}};_0x22d332(++_0x5368c8);}(_0x2032,0xd9));var _0x2203=function(_0x3da0bd,_0x34e57d){_0x3da0bd=_0x3da0bd-0x0;var _0x49d7bd=_0x2032[_0x3da0bd];return _0x49d7bd;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb10b,0x12a));var _0xbb10=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0xb10b[_0x11e03f];return _0x5666fe;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 805db31..d434acf 100644 --- a/server/api/jira/jira.controller.js +++ b/server/api/jira/jira.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xface=['stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','body','headers','socket','remoteAddress','connection','bluebird','https','api','key','MOTGUI','summary','Report','\x20from\x20','description'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0xface,0xf9));var _0xefac=function(_0x5887eb,_0x501242){_0x5887eb=_0x5887eb-0x0;var _0x58c0eb=_0xface[_0x5887eb];return _0x58c0eb;};'use strict';var BPromise=require(_0xefac('0x0'));var https=require(_0xefac('0x1'));var logger=require('../../config/logger')(_0xefac('0x2'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x4d3456,_0xf7a2b7){var _0x3d5f60={'fields':{'project':{'key':_0x4d3456[_0xefac('0x3')]||_0xefac('0x4')},'summary':(_0x4d3456[_0xefac('0x5')]||_0xefac('0x6'))+_0xefac('0x7')+_0x4d3456['ip'],'description':_0x4d3456[_0xefac('0x8')]||JSON[_0xefac('0x9')](_0x4d3456),'issuetype':{'name':_0x4d3456[_0xefac('0xa')]||_0xefac('0xb')}}};_0x3d5f60[_0xefac('0xc')]['customfield_11500']=_0x4d3456[_0xefac('0xd')];_0x3d5f60[_0xefac('0xc')][_0xefac('0xe')]=_0x4d3456[_0xefac('0xf')];_0x3d5f60[_0xefac('0xc')][_0xefac('0x10')]=_0x4d3456[_0xefac('0x11')];_0x3d5f60[_0xefac('0xc')][_0xefac('0x12')]=_0x4d3456['name'];_0x3d5f60['fields'][_0xefac('0x13')]=_0x4d3456[_0xefac('0x14')];_0x3d5f60[_0xefac('0xc')]['customfield_10102']=_0x4d3456['ip'];var _0x3afc12={'host':_0xefac('0x15'),'port':0x1bb,'path':_0xefac('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xefac('0x17'),'Authorization':_0xefac('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xefac('0x19')](_0xefac('0x1a'))}};var _0x197d95=JSON[_0xefac('0x9')](_0x3d5f60);var _0x3aa791=https[_0xefac('0x1b')](_0x3afc12,function(_0xdce675){_0xdce675[_0xefac('0x1c')]('utf8');var _0x5e61f7='';_0xdce675['on'](_0xefac('0x1d'),function(_0x2f144a){_0x5e61f7+=_0x2f144a;});_0xdce675['on'](_0xefac('0x1e'),function(){if(_0xf7a2b7){return _0xf7a2b7[_0xefac('0x1f')](_0xdce675['statusCode'])[_0xefac('0x20')](JSON[_0xefac('0x21')](_0x5e61f7));}});});_0x3aa791['on'](_0xefac('0x22'),function(_0x40eee8){if(_0xf7a2b7){return _0xf7a2b7[_0xefac('0x1f')](0x1f4)[_0xefac('0x20')]({'errors':[{'message':_0xefac('0x23'),'type':'api.jira'}]});}});_0x3aa791[_0xefac('0x24')](_0x197d95);_0x3aa791[_0xefac('0x1e')]();}exports[_0xefac('0x25')]=openIssue;exports['send']=function(_0x3c7bb0,_0x592b6a){_0x3c7bb0[_0xefac('0x26')]['ip']=_0x3c7bb0[_0xefac('0x27')]['x-forwarded-for']||_0x3c7bb0['connection']['remoteAddress']||_0x3c7bb0[_0xefac('0x28')][_0xefac('0x29')]||_0x3c7bb0[_0xefac('0x2a')][_0xefac('0x28')][_0xefac('0x29')];return openIssue(_0x3c7bb0['body'],_0x592b6a);}; \ No newline at end of file +var _0xb8ab=['newToken','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','api.jira','write','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502'];(function(_0x433938,_0x3d24ae){var _0x1d0dc2=function(_0x46ef32){while(--_0x46ef32){_0x433938['push'](_0x433938['shift']());}};_0x1d0dc2(++_0x3d24ae);}(_0xb8ab,0xf2));var _0xbb8a=function(_0x1bdc84,_0x373a8e){_0x1bdc84=_0x1bdc84-0x0;var _0x3b468b=_0xb8ab[_0x1bdc84];return _0x3b468b;};'use strict';var BPromise=require(_0xbb8a('0x0'));var https=require(_0xbb8a('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x38c81f,_0x5e9d64){var _0x60d86a={'fields':{'project':{'key':_0x38c81f[_0xbb8a('0x2')]||_0xbb8a('0x3')},'summary':(_0x38c81f['summary']||_0xbb8a('0x4'))+_0xbb8a('0x5')+_0x38c81f['ip'],'description':_0x38c81f[_0xbb8a('0x6')]||JSON[_0xbb8a('0x7')](_0x38c81f),'issuetype':{'name':_0x38c81f[_0xbb8a('0x8')]||_0xbb8a('0x9')}}};_0x60d86a[_0xbb8a('0xa')][_0xbb8a('0xb')]=_0x38c81f[_0xbb8a('0xc')];_0x60d86a[_0xbb8a('0xa')][_0xbb8a('0xd')]=_0x38c81f[_0xbb8a('0xe')];_0x60d86a[_0xbb8a('0xa')][_0xbb8a('0xf')]=_0x38c81f[_0xbb8a('0x10')];_0x60d86a['fields']['customfield_11503']=_0x38c81f['name'];_0x60d86a[_0xbb8a('0xa')][_0xbb8a('0x11')]=_0x38c81f[_0xbb8a('0x12')];_0x60d86a[_0xbb8a('0xa')]['customfield_10102']=_0x38c81f['ip'];var _0x5be1bb={'host':_0xbb8a('0x13'),'port':0x1bb,'path':_0xbb8a('0x14'),'method':_0xbb8a('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xbb8a('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xbb8a('0x17')](_0xbb8a('0x18'))}};var _0x3761c8=JSON['stringify'](_0x60d86a);var _0x206604=https[_0xbb8a('0x19')](_0x5be1bb,function(_0x26a93d){_0x26a93d[_0xbb8a('0x1a')](_0xbb8a('0x1b'));var _0x142840='';_0x26a93d['on'](_0xbb8a('0x1c'),function(_0x38a634){_0x142840+=_0x38a634;});_0x26a93d['on'](_0xbb8a('0x1d'),function(){if(_0x5e9d64){return _0x5e9d64[_0xbb8a('0x1e')](_0x26a93d[_0xbb8a('0x1f')])[_0xbb8a('0x20')](JSON[_0xbb8a('0x21')](_0x142840));}});});_0x206604['on']('error',function(_0x4845d7){if(_0x5e9d64){return _0x5e9d64[_0xbb8a('0x1e')](0x1f4)[_0xbb8a('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xbb8a('0x22')}]});}});_0x206604[_0xbb8a('0x23')](_0x3761c8);_0x206604[_0xbb8a('0x1d')]();}exports['openIssue']=openIssue;exports[_0xbb8a('0x24')]=function(_0x68bfc7,_0x894c03){_0x68bfc7[_0xbb8a('0x25')]['ip']=_0x68bfc7[_0xbb8a('0x26')][_0xbb8a('0x27')]||_0x68bfc7[_0xbb8a('0x28')][_0xbb8a('0x29')]||_0x68bfc7[_0xbb8a('0x2a')][_0xbb8a('0x29')]||_0x68bfc7[_0xbb8a('0x28')][_0xbb8a('0x2a')][_0xbb8a('0x29')];return openIssue(_0x68bfc7[_0xbb8a('0x25')],_0x894c03);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3f74de9..6d73d4f 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x394338,_0x751fd7){var _0x1ecdb0=function(_0x44f244){while(--_0x44f244){_0x394338['push'](_0x394338['shift']());}};_0x1ecdb0(++_0x751fd7);}(_0x4522,0x1a0));var _0x2452=function(_0x32df1f,_0x228b18){_0x32df1f=_0x32df1f-0x0;var _0x41ef00=_0x4522[_0x32df1f];return _0x41ef00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2452('0xf')]);router['put']('/:id',auth[_0x2452('0x9')](),controller[_0x2452('0x10')]);router[_0x2452('0x11')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x12')]);module[_0x2452('0x13')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x469deb,_0x356348){var _0x8aa631=function(_0x511f77){while(--_0x511f77){_0x469deb['push'](_0x469deb['shift']());}};_0x8aa631(++_0x356348);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f4ec5,_0x106665){_0x4f4ec5=_0x4f4ec5-0x0;var _0x274cf4=_0xedd9[_0x4f4ec5];return _0x274cf4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2556114..d731c50 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x2e6eb8,_0x120ce9){_0x2e6eb8=_0x2e6eb8-0x0;var _0x31acac=_0x7a54[_0x2e6eb8];return _0x31acac;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x157c10,_0x50e9f9){_0x157c10=_0x157c10-0x0;var _0xa64cbe=_0x7a54[_0x157c10];return _0xa64cbe;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 1d01cb4..8cb903b 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc492=['findAll','rows','catch','params','includeAll','find','body','describe','eml-format','rimraf','zip-dir','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include'];(function(_0x1b1c05,_0xfde69a){var _0x3f3638=function(_0xc80036){while(--_0xc80036){_0x1b1c05['push'](_0x1b1c05['shift']());}};_0x3f3638(++_0xfde69a);}(_0xc492,0xd7));var _0x2c49=function(_0x187156,_0x4e9823){_0x187156=_0x187156-0x0;var _0x2ce10b=_0xc492[_0x187156];return _0x2ce10b;};'use strict';var emlformat=require(_0x2c49('0x0'));var rimraf=require(_0x2c49('0x1'));var zipdir=require(_0x2c49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2c49('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c49('0x4'));var path=require(_0x2c49('0x5'));var sox=require('sox');var csv=require(_0x2c49('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c49('0x7'));var _=require(_0x2c49('0x8'));var squel=require('squel');var crypto=require(_0x2c49('0x9'));var jsforce=require(_0x2c49('0xa'));var deskjs=require(_0x2c49('0xb'));var toCsv=require(_0x2c49('0x6'));var querystring=require(_0x2c49('0xc'));var Papa=require('papaparse');var Redis=require(_0x2c49('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c49('0xe'))('api');var utils=require(_0x2c49('0xf'));var config=require(_0x2c49('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c49('0x11'))['db'];function respondWithStatusCode(_0x1cc78b,_0x19f7d9){_0x19f7d9=_0x19f7d9||0xcc;return function(_0x1e2210){if(_0x1e2210){return _0x1cc78b[_0x2c49('0x12')](_0x19f7d9);}return _0x1cc78b[_0x2c49('0x13')](_0x19f7d9)['end']();};}function respondWithResult(_0x2006cf,_0x5af5e7){_0x5af5e7=_0x5af5e7||0xc8;return function(_0x2eeb10){if(_0x2eeb10){return _0x2006cf[_0x2c49('0x13')](_0x5af5e7)[_0x2c49('0x14')](_0x2eeb10);}};}function respondWithFilteredResult(_0x561d83,_0x19f59b){return function(_0x385724){if(_0x385724){var _0x30da01=typeof _0x19f59b[_0x2c49('0x15')]===_0x2c49('0x16')&&typeof _0x19f59b[_0x2c49('0x17')]===_0x2c49('0x16');var _0x2e2e07=_0x385724[_0x2c49('0x18')];var _0x89bcb=_0x30da01?0x0:_0x19f59b['offset'];var _0x3001af=_0x30da01?_0x385724[_0x2c49('0x18')]:_0x19f59b[_0x2c49('0x15')]+_0x19f59b[_0x2c49('0x17')];var _0x4793d5;if(_0x3001af>=_0x2e2e07){_0x3001af=_0x2e2e07;_0x4793d5=0xc8;}else{_0x4793d5=0xce;}_0x561d83[_0x2c49('0x13')](_0x4793d5);return _0x561d83['set'](_0x2c49('0x19'),_0x89bcb+'-'+_0x3001af+'/'+_0x2e2e07)[_0x2c49('0x14')](_0x385724);}return null;};}function patchUpdates(_0x573157){return function(_0x4b8f61){try{jsonpatch[_0x2c49('0x1a')](_0x4b8f61,_0x573157,!![]);}catch(_0x3bda90){return BPromise[_0x2c49('0x1b')](_0x3bda90);}return _0x4b8f61[_0x2c49('0x1c')]();};}function saveUpdates(_0x202205,_0x294c70){return function(_0x33c09f){if(_0x33c09f){return _0x33c09f[_0x2c49('0x1d')](_0x202205)[_0x2c49('0x1e')](function(_0x54fe21){return _0x54fe21;});}return null;};}function removeEntity(_0x14ca06,_0x20f3bf){return function(_0x4037b0){if(_0x4037b0){return _0x4037b0[_0x2c49('0x1f')]()['then'](function(){_0x14ca06[_0x2c49('0x13')](0xcc)[_0x2c49('0x20')]();});}};}function handleEntityNotFound(_0x3a35b4,_0x2a9109){return function(_0x59c061){if(!_0x59c061){_0x3a35b4[_0x2c49('0x12')](0x194);}return _0x59c061;};}function handleError(_0x18a41e,_0x25bf3d){_0x25bf3d=_0x25bf3d||0x1f4;return function(_0x50da06){logger[_0x2c49('0x21')](_0x50da06[_0x2c49('0x22')]);if(_0x50da06['name']){delete _0x50da06[_0x2c49('0x23')];}_0x18a41e['status'](_0x25bf3d)['send'](_0x50da06);};}exports[_0x2c49('0x24')]=function(_0x4d2564,_0x5c4fb1){var _0x4d9334={},_0x433503={},_0x7b8d75={'count':0x0,'rows':[]};var _0x2b2dd5=_[_0x2c49('0x25')](db[_0x2c49('0x26')][_0x2c49('0x27')],function(_0x131c06){return{'name':_0x131c06[_0x2c49('0x28')],'type':_0x131c06[_0x2c49('0x29')][_0x2c49('0x2a')]};});_0x433503['model']=_[_0x2c49('0x25')](_0x2b2dd5,'name');_0x433503[_0x2c49('0x2b')]=_[_0x2c49('0x2c')](_0x4d2564[_0x2c49('0x2b')]);_0x433503[_0x2c49('0x2d')]=_[_0x2c49('0x2e')](_0x433503[_0x2c49('0x2f')],_0x433503[_0x2c49('0x2b')]);_0x4d9334[_0x2c49('0x30')]=_[_0x2c49('0x2e')](_0x433503[_0x2c49('0x2f')],qs[_0x2c49('0x31')](_0x4d2564[_0x2c49('0x2b')][_0x2c49('0x31')]));_0x4d9334[_0x2c49('0x30')]=_0x4d9334['attributes']['length']?_0x4d9334[_0x2c49('0x30')]:_0x433503[_0x2c49('0x2f')];if(!_0x4d2564['query'][_0x2c49('0x32')](_0x2c49('0x33'))){_0x4d9334[_0x2c49('0x17')]=qs[_0x2c49('0x17')](_0x4d2564[_0x2c49('0x2b')][_0x2c49('0x17')]);_0x4d9334[_0x2c49('0x15')]=qs[_0x2c49('0x15')](_0x4d2564['query'][_0x2c49('0x15')]);}_0x4d9334[_0x2c49('0x34')]=qs['sort'](_0x4d2564[_0x2c49('0x2b')][_0x2c49('0x35')]);_0x4d9334[_0x2c49('0x36')]=qs['filters'](_[_0x2c49('0x37')](_0x4d2564[_0x2c49('0x2b')],_0x433503[_0x2c49('0x2d')]),_0x2b2dd5);if(_0x4d2564[_0x2c49('0x2b')][_0x2c49('0x38')]){_0x4d9334[_0x2c49('0x36')]=_['merge'](_0x4d9334[_0x2c49('0x36')],{'$or':_[_0x2c49('0x25')](_0x2b2dd5,function(_0x4cbfe4){if(_0x4cbfe4[_0x2c49('0x29')]!==_0x2c49('0x39')){var _0x52f123={};_0x52f123[_0x4cbfe4[_0x2c49('0x23')]]={'$like':'%'+_0x4d2564['query'][_0x2c49('0x38')]+'%'};return _0x52f123;}})});}_0x4d9334=_[_0x2c49('0x3a')]({},_0x4d9334,_0x4d2564[_0x2c49('0x3b')]);var _0x5a6822={'where':_0x4d9334[_0x2c49('0x36')]};return db['JscriptyAnswerReport'][_0x2c49('0x18')](_0x5a6822)[_0x2c49('0x1e')](function(_0x24e53a){_0x7b8d75[_0x2c49('0x18')]=_0x24e53a;if(_0x4d2564[_0x2c49('0x2b')]['includeAll']){_0x4d9334[_0x2c49('0x3c')]=[{'all':!![]}];}return db[_0x2c49('0x26')][_0x2c49('0x3d')](_0x4d9334);})[_0x2c49('0x1e')](function(_0x251c8d){_0x7b8d75[_0x2c49('0x3e')]=_0x251c8d;return _0x7b8d75;})[_0x2c49('0x1e')](respondWithFilteredResult(_0x5c4fb1,_0x4d9334))[_0x2c49('0x3f')](handleError(_0x5c4fb1,null));};exports['show']=function(_0xa912b8,_0x30e892){var _0x5b1ee0={'raw':!![],'where':{'id':_0xa912b8[_0x2c49('0x40')]['id']}},_0x2a21b9={};_0x2a21b9['model']=_[_0x2c49('0x2c')](db['JscriptyAnswerReport']['rawAttributes']);_0x2a21b9['query']=_['keys'](_0xa912b8[_0x2c49('0x2b')]);_0x2a21b9[_0x2c49('0x2d')]=_[_0x2c49('0x2e')](_0x2a21b9[_0x2c49('0x2f')],_0x2a21b9[_0x2c49('0x2b')]);_0x5b1ee0['attributes']=_['intersection'](_0x2a21b9['model'],qs['fields'](_0xa912b8[_0x2c49('0x2b')]['fields']));_0x5b1ee0[_0x2c49('0x30')]=_0x5b1ee0['attributes']['length']?_0x5b1ee0['attributes']:_0x2a21b9[_0x2c49('0x2f')];if(_0xa912b8['query'][_0x2c49('0x41')]){_0x5b1ee0[_0x2c49('0x3c')]=[{'all':!![]}];}_0x5b1ee0=_['merge']({},_0x5b1ee0,_0xa912b8['options']);return db[_0x2c49('0x26')][_0x2c49('0x42')](_0x5b1ee0)[_0x2c49('0x1e')](handleEntityNotFound(_0x30e892,null))[_0x2c49('0x1e')](respondWithResult(_0x30e892,null))[_0x2c49('0x3f')](handleError(_0x30e892,null));};exports['create']=function(_0x50dce4,_0x426c8a){return db[_0x2c49('0x26')]['create'](_0x50dce4['body'],{})['then'](respondWithResult(_0x426c8a,0xc9))[_0x2c49('0x3f')](handleError(_0x426c8a,null));};exports[_0x2c49('0x1d')]=function(_0x98fc90,_0x55e4cd){if(_0x98fc90[_0x2c49('0x43')]['id']){delete _0x98fc90[_0x2c49('0x43')]['id'];}return db[_0x2c49('0x26')][_0x2c49('0x42')]({'where':{'id':_0x98fc90[_0x2c49('0x40')]['id']}})[_0x2c49('0x1e')](handleEntityNotFound(_0x55e4cd,null))[_0x2c49('0x1e')](saveUpdates(_0x98fc90['body'],null))['then'](respondWithResult(_0x55e4cd,null))['catch'](handleError(_0x55e4cd,null));};exports[_0x2c49('0x1f')]=function(_0x1aa034,_0x5385e5){return db[_0x2c49('0x26')][_0x2c49('0x42')]({'where':{'id':_0x1aa034[_0x2c49('0x40')]['id']}})[_0x2c49('0x1e')](handleEntityNotFound(_0x5385e5,null))[_0x2c49('0x1e')](removeEntity(_0x5385e5,null))[_0x2c49('0x3f')](handleError(_0x5385e5,null));};exports[_0x2c49('0x44')]=function(_0x11878d,_0x331519){return db[_0x2c49('0x26')]['describe']()[_0x2c49('0x1e')](respondWithResult(_0x331519,null))[_0x2c49('0x3f')](handleError(_0x331519,null));}; \ No newline at end of file +var _0x5d58=['undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','JscriptyAnswerReport','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','create','update','find','catch','destroy','describe','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0x5d58,0x187));var _0x85d5=function(_0x58ef0e,_0x34ae81){_0x58ef0e=_0x58ef0e-0x0;var _0x157710=_0x5d58[_0x58ef0e];return _0x157710;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['JscriptyAnswerReport'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')](_0x13ab32['body'],{})[_0x85d5('0x1c')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x40')]=function(_0xd8db57,_0x219154){if(_0xd8db57['body']['id']){delete _0xd8db57['body']['id'];}return db['JscriptyAnswerReport'][_0x85d5('0x41')]({'where':{'id':_0xd8db57[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x219154,null))['then'](saveUpdates(_0xd8db57['body'],null))[_0x85d5('0x1c')](respondWithResult(_0x219154,null))[_0x85d5('0x42')](handleError(_0x219154,null));};exports[_0x85d5('0x43')]=function(_0x288b56,_0x4b2dce){return db[_0x85d5('0x34')][_0x85d5('0x41')]({'where':{'id':_0x288b56[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x4b2dce,null))[_0x85d5('0x1c')](removeEntity(_0x4b2dce,null))[_0x85d5('0x42')](handleError(_0x4b2dce,null));};exports[_0x85d5('0x44')]=function(_0x34b784,_0x185a70){return db[_0x85d5('0x34')][_0x85d5('0x44')]()[_0x85d5('0x1c')](respondWithResult(_0x185a70,null))[_0x85d5('0x42')](handleError(_0x185a70,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e52183c..2ebb386 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x630e=['bluebird','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger','api','moment'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x630e,0xa0));var _0xe630=function(_0x47d6d5,_0x3d18ba){_0x47d6d5=_0x47d6d5-0x0;var _0x6e8e17=_0x630e[_0x47d6d5];return _0x6e8e17;};'use strict';var _=require(_0xe630('0x0'));var util=require(_0xe630('0x1'));var logger=require(_0xe630('0x2'))(_0xe630('0x3'));var moment=require(_0xe630('0x4'));var BPromise=require(_0xe630('0x5'));var rp=require(_0xe630('0x6'));var fs=require('fs');var path=require(_0xe630('0x7'));var rimraf=require(_0xe630('0x8'));var config=require(_0xe630('0x9'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xe630('0xa')]=function(_0x36ad1d,_0x3c7955){return _0x36ad1d['define']('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ee6=['path','rimraf','exports','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x45df98,_0x45265b){var _0x3f74ab=function(_0x5a0c4a){while(--_0x5a0c4a){_0x45df98['push'](_0x45df98['shift']());}};_0x3f74ab(++_0x45265b);}(_0x2ee6,0xa5));var _0x62ee=function(_0x579e75,_0x40fe61){_0x579e75=_0x579e75-0x0;var _0x53a03f=_0x2ee6[_0x579e75];return _0x53a03f;};'use strict';var _=require('lodash');var util=require(_0x62ee('0x0'));var logger=require(_0x62ee('0x1'))('api');var moment=require(_0x62ee('0x2'));var BPromise=require(_0x62ee('0x3'));var rp=require(_0x62ee('0x4'));var fs=require('fs');var path=require(_0x62ee('0x5'));var rimraf=require(_0x62ee('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x62ee('0x7')]=function(_0x3b8483,_0x4355f9){return _0x3b8483['define'](_0x62ee('0x8'),attributes,{'tableName':_0x62ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ced0cdd..3ccd31d 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a01=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x1a01,0x194));var _0x11a0=function(_0x549953,_0x58b1aa){_0x549953=_0x549953-0x0;var _0x136cdb=_0x1a01[_0x549953];return _0x136cdb;};'use strict';var _=require(_0x11a0('0x0'));var util=require('util');var moment=require(_0x11a0('0x1'));var BPromise=require(_0x11a0('0x2'));var rs=require(_0x11a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11a0('0x4'))['db'];var utils=require(_0x11a0('0x5'));var logger=require('../../config/logger')(_0x11a0('0x6'));var config=require(_0x11a0('0x7'));var jayson=require(_0x11a0('0x8'));var client=jayson[_0x11a0('0x9')][_0x11a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48f0ba,_0x1e2514,_0x5be18c){return new BPromise(function(_0x11c1a3,_0x3b9bd1){return client[_0x11a0('0xb')](_0x48f0ba,_0x5be18c)[_0x11a0('0xc')](function(_0x1b4f12){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e2514,'request\x20sent');logger[_0x11a0('0xd')](_0x11a0('0xe'),_0x1e2514,_0x11a0('0xf'),JSON[_0x11a0('0x10')](_0x1b4f12));if(_0x1b4f12[_0x11a0('0x11')]){if(_0x1b4f12['error'][_0x11a0('0x12')]===0x1f4){logger[_0x11a0('0x11')](_0x11a0('0x13'),_0x1e2514,_0x1b4f12[_0x11a0('0x11')]['message']);return _0x3b9bd1(_0x1b4f12[_0x11a0('0x11')]['message']);}logger[_0x11a0('0x11')](_0x11a0('0x13'),_0x1e2514,_0x1b4f12['error'][_0x11a0('0x14')]);return _0x11c1a3(_0x1b4f12[_0x11a0('0x11')]['message']);}else{logger[_0x11a0('0x15')](_0x11a0('0x13'),_0x1e2514,_0x11a0('0xf'));_0x11c1a3(_0x1b4f12[_0x11a0('0x16')]['message']);}})[_0x11a0('0x17')](function(_0x5cd917){logger['error'](_0x11a0('0x13'),_0x1e2514,_0x5cd917);_0x3b9bd1(_0x5cd917);});});} \ No newline at end of file +var _0xbbd5=['http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x25da3f,_0x4e685e){var _0x5c2af6=function(_0x4e6812){while(--_0x4e6812){_0x25da3f['push'](_0x25da3f['shift']());}};_0x5c2af6(++_0x4e685e);}(_0xbbd5,0x17a));var _0x5bbd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbbd5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5bbd('0x0'));var util=require(_0x5bbd('0x1'));var moment=require(_0x5bbd('0x2'));var BPromise=require(_0x5bbd('0x3'));var rs=require(_0x5bbd('0x4'));var fs=require('fs');var Redis=require(_0x5bbd('0x5'));var db=require(_0x5bbd('0x6'))['db'];var utils=require(_0x5bbd('0x7'));var logger=require(_0x5bbd('0x8'))(_0x5bbd('0x9'));var config=require(_0x5bbd('0xa'));var jayson=require(_0x5bbd('0xb'));var client=jayson['client'][_0x5bbd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d8239,_0x412ae6,_0x182b7f){return new BPromise(function(_0x543103,_0x1e0984){return client[_0x5bbd('0xd')](_0x1d8239,_0x182b7f)[_0x5bbd('0xe')](function(_0x4c4269){logger[_0x5bbd('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x412ae6,_0x5bbd('0x10'));logger[_0x5bbd('0x11')](_0x5bbd('0x12'),_0x412ae6,_0x5bbd('0x10'),JSON[_0x5bbd('0x13')](_0x4c4269));if(_0x4c4269[_0x5bbd('0x14')]){if(_0x4c4269[_0x5bbd('0x14')][_0x5bbd('0x15')]===0x1f4){logger[_0x5bbd('0x14')](_0x5bbd('0x16'),_0x412ae6,_0x4c4269[_0x5bbd('0x14')][_0x5bbd('0x17')]);return _0x1e0984(_0x4c4269['error'][_0x5bbd('0x17')]);}logger[_0x5bbd('0x14')](_0x5bbd('0x16'),_0x412ae6,_0x4c4269[_0x5bbd('0x14')]['message']);return _0x543103(_0x4c4269[_0x5bbd('0x14')][_0x5bbd('0x17')]);}else{logger[_0x5bbd('0xf')](_0x5bbd('0x16'),_0x412ae6,_0x5bbd('0x10'));_0x543103(_0x4c4269[_0x5bbd('0x18')][_0x5bbd('0x17')]);}})[_0x5bbd('0x19')](function(_0x2096d7){logger[_0x5bbd('0x14')](_0x5bbd('0x16'),_0x412ae6,_0x2096d7);_0x1e0984(_0x2096d7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5a443af..d61ad59 100644 --- a/server/api/jscriptyProject/index.js +++ b/server/api/jscriptyProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7e8=['index','/:id','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','clone','put','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get'];(function(_0xddfca4,_0x547c9e){var _0x13e566=function(_0x5003a3){while(--_0x5003a3){_0xddfca4['push'](_0xddfca4['shift']());}};_0x13e566(++_0x547c9e);}(_0xd7e8,0x190));var _0x8d7e=function(_0x12d615,_0x1f7ac5){_0x12d615=_0x12d615-0x0;var _0x1c9377=_0xd7e8[_0x12d615];return _0x1c9377;};'use strict';var multer=require(_0x8d7e('0x0'));var util=require(_0x8d7e('0x1'));var path=require('path');var timeout=require(_0x8d7e('0x2'));var express=require(_0x8d7e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d7e('0x4'));var interaction=require(_0x8d7e('0x5'));var config=require('../../config/environment');var controller=require(_0x8d7e('0x6'));router[_0x8d7e('0x7')]('/',auth['isAuthenticated'](),controller[_0x8d7e('0x8')]);router['get'](_0x8d7e('0x9'),auth['isAuthenticated'](),controller[_0x8d7e('0xa')]);router['get'](_0x8d7e('0xb'),auth[_0x8d7e('0xc')](),controller[_0x8d7e('0xd')]);router['get'](_0x8d7e('0xe'),auth[_0x8d7e('0xc')](),controller[_0x8d7e('0xf')]);router[_0x8d7e('0x7')](_0x8d7e('0x10'),auth[_0x8d7e('0xc')](),timeout(_0x8d7e('0x11')),controller[_0x8d7e('0x12')]);router['post']('/',auth[_0x8d7e('0xc')](),controller[_0x8d7e('0x13')]);router['post']('/:id/clone',auth[_0x8d7e('0xc')](),controller[_0x8d7e('0x14')]);router[_0x8d7e('0x15')](_0x8d7e('0x9'),auth[_0x8d7e('0xc')](),controller['update']);router['delete'](_0x8d7e('0x9'),auth[_0x8d7e('0xc')](),controller[_0x8d7e('0x16')]);module[_0x8d7e('0x17')]=router; \ No newline at end of file +var _0x434c=['isAuthenticated','index','/:id','show','getSessions','/:id/summary','30s','getSummary','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x434c,0xc4));var _0xc434=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x434c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc434('0x0'));var util=require(_0xc434('0x1'));var path=require(_0xc434('0x2'));var timeout=require(_0xc434('0x3'));var express=require(_0xc434('0x4'));var router=express[_0xc434('0x5')]();var fs_extra=require(_0xc434('0x6'));var auth=require(_0xc434('0x7'));var interaction=require(_0xc434('0x8'));var config=require(_0xc434('0x9'));var controller=require(_0xc434('0xa'));router[_0xc434('0xb')]('/',auth[_0xc434('0xc')](),controller[_0xc434('0xd')]);router[_0xc434('0xb')](_0xc434('0xe'),auth['isAuthenticated'](),controller[_0xc434('0xf')]);router[_0xc434('0xb')]('/:id/sessions',auth[_0xc434('0xc')](),controller[_0xc434('0x10')]);router[_0xc434('0xb')]('/:id/answers',auth[_0xc434('0xc')](),controller['getAnswers']);router[_0xc434('0xb')](_0xc434('0x11'),auth[_0xc434('0xc')](),timeout(_0xc434('0x12')),controller[_0xc434('0x13')]);router[_0xc434('0x14')]('/',auth[_0xc434('0xc')](),controller['create']);router[_0xc434('0x14')]('/:id/clone',auth[_0xc434('0xc')](),controller['clone']);router[_0xc434('0x15')](_0xc434('0xe'),auth[_0xc434('0xc')](),controller[_0xc434('0x16')]);router[_0xc434('0x17')](_0xc434('0xe'),auth[_0xc434('0xc')](),controller[_0xc434('0x18')]);module[_0xc434('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6ddaa79..8084ae7 100644 --- a/server/api/jscriptyProject/jscriptyProject.attributes.js +++ b/server/api/jscriptyProject/jscriptyProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42f3=['TEXT','isObjectLike','setDataValue','formData','isString','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x42f3,0x1cb));var _0x342f=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x42f3[_0x1034ca];return _0x1a023a;};'use strict';var Sequelize=require(_0x342f('0x0'));var _=require(_0x342f('0x1'));var util=require(_0x342f('0x2'));module[_0x342f('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x342f('0x4')},'description':{'type':Sequelize[_0x342f('0x5')]},'formData':{'type':Sequelize[_0x342f('0x6')]('long'),'set':function(_0x2f3a78){if(_[_0x342f('0x7')](_0x2f3a78)){this[_0x342f('0x8')](_0x342f('0x9'),JSON['stringify'](_0x2f3a78));}else if(_[_0x342f('0xa')](_0x2f3a78)){this[_0x342f('0x8')](_0x342f('0x9'),_0x2f3a78);}else{this[_0x342f('0x8')](_0x342f('0x9'),util[_0x342f('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x342f('0xc')](_0x342f('0x4'))||'',this[_0x342f('0xc')](_0x342f('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x342f('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x342f('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x2649=['exports','STRING','name','TEXT','long','stringify','isString','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x101517,_0x938adb){var _0x5a5afb=function(_0xe62b7a){while(--_0xe62b7a){_0x101517['push'](_0x101517['shift']());}};_0x5a5afb(++_0x938adb);}(_0x2649,0x84));var _0x9264=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0x2649[_0x2e41e2];return _0x2844d6;};'use strict';var Sequelize=require(_0x9264('0x0'));var _=require(_0x9264('0x1'));var util=require(_0x9264('0x2'));module[_0x9264('0x3')]={'name':{'type':Sequelize[_0x9264('0x4')],'unique':_0x9264('0x5')},'description':{'type':Sequelize[_0x9264('0x4')]},'formData':{'type':Sequelize[_0x9264('0x6')](_0x9264('0x7')),'set':function(_0x45dd7f){if(_['isObjectLike'](_0x45dd7f)){this['setDataValue']('formData',JSON[_0x9264('0x8')](_0x45dd7f));}else if(_[_0x9264('0x9')](_0x45dd7f)){this[_0x9264('0xa')](_0x9264('0xb'),_0x45dd7f);}else{this[_0x9264('0xa')]('formData',util['format'](_0x9264('0xc'),this[_0x9264('0xd')](_0x9264('0x5'))||'',this[_0x9264('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9264('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9264('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 849576a..761be65 100644 --- a/server/api/jscriptyProject/jscriptyProject.controller.js +++ b/server/api/jscriptyProject/jscriptyProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x119c=['Content-disposition','Content-type','text/csv','download','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Projects','sendStatus','error','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','clone','params','omit','createdAt','updatedAt','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','hasOwnProperty','nolimit','pick','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x119c,0xea));var _0xc119=function(_0x564615,_0x51000c){_0x564615=_0x564615-0x0;var _0x3e5c3c=_0x119c[_0x564615];return _0x3e5c3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc119('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc119('0x1'));var rp=require(_0xc119('0x2'));var moment=require(_0xc119('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc119('0x4'));var util=require(_0xc119('0x5'));var path=require(_0xc119('0x6'));var sox=require('sox');var csv=require(_0xc119('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc119('0x8'));var _=require('lodash');var squel=require(_0xc119('0x9'));var crypto=require(_0xc119('0xa'));var jsforce=require(_0xc119('0xb'));var deskjs=require(_0xc119('0xc'));var toCsv=require(_0xc119('0x7'));var querystring=require(_0xc119('0xd'));var Papa=require(_0xc119('0xe'));var Redis=require(_0xc119('0xf'));var authService=require(_0xc119('0x10'));var qs=require(_0xc119('0x11'));var as=require(_0xc119('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc119('0x13'))('api');var utils=require(_0xc119('0x14'));var config=require(_0xc119('0x15'));var licenseUtil=require(_0xc119('0x16'));var db=require(_0xc119('0x17'))['db'];function respondWithStatusCode(_0x74df92,_0x3ac20c){_0x3ac20c=_0x3ac20c||0xcc;return function(_0x5903d5){if(_0x5903d5){return _0x74df92['sendStatus'](_0x3ac20c);}return _0x74df92[_0xc119('0x18')](_0x3ac20c)[_0xc119('0x19')]();};}function respondWithResult(_0x151e99,_0x11e6d0){_0x11e6d0=_0x11e6d0||0xc8;return function(_0x32704a){if(_0x32704a){return _0x151e99['status'](_0x11e6d0)[_0xc119('0x1a')](_0x32704a);}};}function respondWithFilteredResult(_0x4df6ae,_0x3c23d5){return function(_0x3b3d9c){if(_0x3b3d9c){var _0x4ebc72=typeof _0x3c23d5[_0xc119('0x1b')]===_0xc119('0x1c')&&typeof _0x3c23d5[_0xc119('0x1d')]===_0xc119('0x1c');var _0x1cb38b=_0x3b3d9c[_0xc119('0x1e')];var _0x47245c=_0x4ebc72?0x0:_0x3c23d5['offset'];var _0x849c9=_0x4ebc72?_0x3b3d9c['count']:_0x3c23d5[_0xc119('0x1b')]+_0x3c23d5[_0xc119('0x1d')];var _0x47ead7;if(_0x849c9>=_0x1cb38b){_0x849c9=_0x1cb38b;_0x47ead7=0xc8;}else{_0x47ead7=0xce;}_0x4df6ae[_0xc119('0x18')](_0x47ead7);return _0x4df6ae[_0xc119('0x1f')](_0xc119('0x20'),_0x47245c+'-'+_0x849c9+'/'+_0x1cb38b)[_0xc119('0x1a')](_0x3b3d9c);}return null;};}function patchUpdates(_0x2bf21d){return function(_0x6372db){try{jsonpatch[_0xc119('0x21')](_0x6372db,_0x2bf21d,!![]);}catch(_0x220452){return BPromise['reject'](_0x220452);}return _0x6372db[_0xc119('0x22')]();};}function saveUpdates(_0x50346a,_0x41f32b){return function(_0x15250a){if(_0x15250a){return _0x15250a[_0xc119('0x23')](_0x50346a)[_0xc119('0x24')](function(_0x4e1679){return _0x4e1679;});}return null;};}function removeEntity(_0x376a74,_0x13bad1){return function(_0x47769a){if(_0x47769a){return _0x47769a[_0xc119('0x25')]()[_0xc119('0x24')](function(){var _0x146629=_0x47769a[_0xc119('0x26')]({'plain':!![]});var _0x52faaa=_0xc119('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x52faaa,'resourceId':_0x146629['id']}})[_0xc119('0x24')](function(){return _0x47769a;});})['then'](function(){_0x376a74[_0xc119('0x18')](0xcc)[_0xc119('0x19')]();});}};}function handleEntityNotFound(_0x499d11,_0x4ffe42){return function(_0x331e09){if(!_0x331e09){_0x499d11[_0xc119('0x28')](0x194);}return _0x331e09;};}function handleError(_0x4030f8,_0x1272cd){_0x1272cd=_0x1272cd||0x1f4;return function(_0x1cca7a){logger[_0xc119('0x29')](_0x1cca7a['stack']);if(_0x1cca7a[_0xc119('0x2a')]){delete _0x1cca7a['name'];}_0x4030f8[_0xc119('0x18')](_0x1272cd)[_0xc119('0x2b')](_0x1cca7a);};}exports[_0xc119('0x2c')]=function(_0x4bcda7,_0x4c4a60){var _0x25ad10={},_0xec1e0e={},_0x3255f8={'count':0x0,'rows':[]};var _0x2a2bda=_['map'](db[_0xc119('0x2d')][_0xc119('0x2e')],function(_0x3749bd){return{'name':_0x3749bd[_0xc119('0x2f')],'type':_0x3749bd[_0xc119('0x30')][_0xc119('0x31')]};});_0xec1e0e[_0xc119('0x32')]=_['map'](_0x2a2bda,_0xc119('0x2a'));_0xec1e0e[_0xc119('0x33')]=_['keys'](_0x4bcda7[_0xc119('0x33')]);_0xec1e0e[_0xc119('0x34')]=_[_0xc119('0x35')](_0xec1e0e[_0xc119('0x32')],_0xec1e0e[_0xc119('0x33')]);_0x25ad10['attributes']=_[_0xc119('0x35')](_0xec1e0e['model'],qs[_0xc119('0x36')](_0x4bcda7[_0xc119('0x33')]['fields']));_0x25ad10[_0xc119('0x37')]=_0x25ad10['attributes'][_0xc119('0x38')]?_0x25ad10[_0xc119('0x37')]:_0xec1e0e[_0xc119('0x32')];if(!_0x4bcda7[_0xc119('0x33')]['hasOwnProperty']('nolimit')){_0x25ad10[_0xc119('0x1d')]=qs[_0xc119('0x1d')](_0x4bcda7[_0xc119('0x33')][_0xc119('0x1d')]);_0x25ad10[_0xc119('0x1b')]=qs[_0xc119('0x1b')](_0x4bcda7[_0xc119('0x33')][_0xc119('0x1b')]);}_0x25ad10[_0xc119('0x39')]=qs[_0xc119('0x3a')](_0x4bcda7['query'][_0xc119('0x3a')]);_0x25ad10[_0xc119('0x3b')]=qs['filters'](_['pick'](_0x4bcda7['query'],_0xec1e0e[_0xc119('0x34')]),_0x2a2bda);if(_0x4bcda7[_0xc119('0x33')][_0xc119('0x3c')]){_0x25ad10[_0xc119('0x3b')]=_['merge'](_0x25ad10[_0xc119('0x3b')],{'$or':_[_0xc119('0x3d')](_0x2a2bda,function(_0x2caa6e){if(_0x2caa6e[_0xc119('0x30')]!==_0xc119('0x3e')){var _0x2f8642={};_0x2f8642[_0x2caa6e[_0xc119('0x2a')]]={'$like':'%'+_0x4bcda7[_0xc119('0x33')][_0xc119('0x3c')]+'%'};return _0x2f8642;}})});}_0x25ad10=_[_0xc119('0x3f')]({},_0x25ad10,_0x4bcda7[_0xc119('0x40')]);var _0x26e834={'where':_0x25ad10[_0xc119('0x3b')]};return db[_0xc119('0x2d')][_0xc119('0x1e')](_0x26e834)[_0xc119('0x24')](function(_0x2491d8){_0x3255f8[_0xc119('0x1e')]=_0x2491d8;if(_0x4bcda7[_0xc119('0x33')][_0xc119('0x41')]){_0x25ad10[_0xc119('0x42')]=[{'all':!![]}];}return db['JscriptyProject'][_0xc119('0x43')](_0x25ad10);})[_0xc119('0x24')](function(_0x589c32){_0x3255f8[_0xc119('0x44')]=_0x589c32;return _0x3255f8;})['then'](respondWithFilteredResult(_0x4c4a60,_0x25ad10))[_0xc119('0x45')](handleError(_0x4c4a60,null));};exports[_0xc119('0x46')]=function(_0x275d81,_0x1bcf3c){var _0x295ecd={'raw':![],'where':{'id':_0x275d81['params']['id']}},_0x5bd1e6={};_0x5bd1e6['model']=_[_0xc119('0x47')](db[_0xc119('0x2d')]['rawAttributes']);_0x5bd1e6[_0xc119('0x33')]=_[_0xc119('0x47')](_0x275d81[_0xc119('0x33')]);_0x5bd1e6[_0xc119('0x34')]=_[_0xc119('0x35')](_0x5bd1e6['model'],_0x5bd1e6[_0xc119('0x33')]);_0x295ecd[_0xc119('0x37')]=_[_0xc119('0x35')](_0x5bd1e6[_0xc119('0x32')],qs[_0xc119('0x36')](_0x275d81['query'][_0xc119('0x36')]));_0x295ecd['attributes']=_0x295ecd[_0xc119('0x37')][_0xc119('0x38')]?_0x295ecd[_0xc119('0x37')]:_0x5bd1e6[_0xc119('0x32')];if(_0x275d81[_0xc119('0x33')][_0xc119('0x41')]){_0x295ecd[_0xc119('0x42')]=[{'all':!![]}];}_0x295ecd=_[_0xc119('0x3f')]({},_0x295ecd,_0x275d81[_0xc119('0x40')]);return db['JscriptyProject'][_0xc119('0x48')](_0x295ecd)['then'](handleEntityNotFound(_0x1bcf3c,null))[_0xc119('0x24')](respondWithResult(_0x1bcf3c,null))[_0xc119('0x45')](handleError(_0x1bcf3c,null));};exports['create']=function(_0x25cd55,_0x2df273){return db[_0xc119('0x2d')][_0xc119('0x49')](_0x25cd55[_0xc119('0x4a')],{})[_0xc119('0x24')](function(_0x405cb6){var _0x2d6c2c=_0x25cd55[_0xc119('0x4b')][_0xc119('0x26')]({'plain':!![]});if(!_0x2d6c2c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d6c2c['role']===_0xc119('0x4b')){var _0x6969f=_0x405cb6['get']({'plain':!![]});var _0x72baf6=_0xc119('0x27');return db[_0xc119('0x4c')][_0xc119('0x48')]({'where':{'name':_0x72baf6,'userProfileId':_0x2d6c2c[_0xc119('0x4d')]},'raw':!![]})[_0xc119('0x24')](function(_0x520783){if(_0x520783&&_0x520783[_0xc119('0x4e')]===0x0){return db['UserProfileResource'][_0xc119('0x49')]({'name':_0x6969f[_0xc119('0x2a')],'resourceId':_0x6969f['id'],'type':_0x520783[_0xc119('0x2a')],'sectionId':_0x520783['id']},{})[_0xc119('0x24')](function(){return _0x405cb6;});}else{return _0x405cb6;}})[_0xc119('0x45')](function(_0x19de39){logger[_0xc119('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19de39);throw _0x19de39;});}return _0x405cb6;})[_0xc119('0x24')](respondWithResult(_0x2df273,0xc9))[_0xc119('0x45')](handleError(_0x2df273,null));};exports[_0xc119('0x4f')]=function(_0xb3b9b6,_0xb06725){var _0x3b2f28={'where':{'id':_0xb3b9b6[_0xc119('0x50')]['id']}},_0x3e09ec={};_0x3e09ec[_0xc119('0x32')]=_[_0xc119('0x47')](db[_0xc119('0x2d')][_0xc119('0x2e')]);_0x3b2f28[_0xc119('0x37')]=_[_0xc119('0x35')](_0x3e09ec[_0xc119('0x32')],qs['fields'](_0xb3b9b6['query'][_0xc119('0x36')]));_0x3b2f28['attributes']=_0x3b2f28[_0xc119('0x37')][_0xc119('0x38')]?_0x3b2f28['attributes']:_0x3e09ec[_0xc119('0x32')];if(_0xb3b9b6[_0xc119('0x33')]['includeAll']){_0x3b2f28[_0xc119('0x42')]=[{'all':!![]}];}_0x3b2f28=_['merge']({},_0x3b2f28,_0xb3b9b6['options']);return db[_0xc119('0x2d')][_0xc119('0x48')](_0x3b2f28)['then'](handleEntityNotFound(_0xb06725,null))[_0xc119('0x24')](function(_0x4fff79){if(_0x4fff79){var _0x4f56c5=_0x4fff79[_0xc119('0x26')]({'plain':!![]});_0x4f56c5=qs[_0xc119('0x51')](_0x4f56c5,['id',_0xc119('0x52'),'updatedAt']);_0xb3b9b6[_0xc119('0x4a')]=_[_0xc119('0x51')](_0xb3b9b6['body'],['id',_0xc119('0x52'),_0xc119('0x53')]);return db[_0xc119('0x2d')][_0xc119('0x49')](_[_0xc119('0x3f')](_0x4f56c5,_0xb3b9b6['body']),{'include':_0xb3b9b6[_0xc119('0x33')][_0xc119('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0xeaaa36){var _0x18676b=_0xb3b9b6[_0xc119('0x4b')][_0xc119('0x26')]({'plain':!![]});if(!_0x18676b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18676b[_0xc119('0x54')]===_0xc119('0x4b')){var _0x81cef8=_0xeaaa36[_0xc119('0x26')]({'plain':!![]});var _0x54c8b4=_0xc119('0x27');return db[_0xc119('0x4c')][_0xc119('0x48')]({'where':{'name':_0x54c8b4,'userProfileId':_0x18676b['userProfileId']},'raw':!![]})[_0xc119('0x24')](function(_0xb12f77){if(_0xb12f77&&_0xb12f77['autoAssociation']===0x0){return db[_0xc119('0x55')][_0xc119('0x49')]({'name':_0x81cef8['name'],'resourceId':_0x81cef8['id'],'type':_0xb12f77[_0xc119('0x2a')],'sectionId':_0xb12f77['id']},{})[_0xc119('0x24')](function(){return _0xeaaa36;});}else{return _0xeaaa36;}})[_0xc119('0x45')](function(_0x5b0008){logger[_0xc119('0x29')](_0xc119('0x56'),_0x5b0008);throw _0x5b0008;});}return _0xeaaa36;});}})[_0xc119('0x24')](respondWithResult(_0xb06725,0xc9))[_0xc119('0x45')](handleError(_0xb06725,null));};exports[_0xc119('0x23')]=function(_0x1976a9,_0x4c07dd){if(_0x1976a9['body']['id']){delete _0x1976a9['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x1976a9[_0xc119('0x50')]['id']}})[_0xc119('0x24')](handleEntityNotFound(_0x4c07dd,null))['then'](saveUpdates(_0x1976a9[_0xc119('0x4a')],null))['then'](respondWithResult(_0x4c07dd,null))[_0xc119('0x45')](handleError(_0x4c07dd,null));};exports[_0xc119('0x25')]=function(_0x78599a,_0x576774){return db[_0xc119('0x2d')][_0xc119('0x48')]({'where':{'id':_0x78599a[_0xc119('0x50')]['id']}})[_0xc119('0x24')](handleEntityNotFound(_0x576774,null))[_0xc119('0x24')](removeEntity(_0x576774,null))[_0xc119('0x45')](handleError(_0x576774,null));};exports[_0xc119('0x57')]=function(_0xce231d,_0x4c5227,_0x379273){var _0x1bec61={'raw':!![],'where':{}};var _0x12166d={};var _0x445a51={'count':0x0,'rows':[]};return db[_0xc119('0x2d')][_0xc119('0x58')]({'where':{'id':_0xce231d[_0xc119('0x50')]['id']}})['then'](handleEntityNotFound(_0x4c5227,null))['then'](function(_0x93ab2d){if(_0x93ab2d){_0x12166d['model']=_[_0xc119('0x47')](db[_0xc119('0x59')]['rawAttributes']);_0x12166d['query']=_[_0xc119('0x47')](_0xce231d[_0xc119('0x33')]);_0x12166d[_0xc119('0x34')]=_['intersection'](_0x12166d[_0xc119('0x32')],_0x12166d['query']);_0x1bec61['attributes']=_[_0xc119('0x35')](_0x12166d[_0xc119('0x32')],qs[_0xc119('0x36')](_0xce231d[_0xc119('0x33')][_0xc119('0x36')]));_0x1bec61[_0xc119('0x37')]=_0x1bec61['attributes'][_0xc119('0x38')]?_0x1bec61[_0xc119('0x37')]:_0x12166d[_0xc119('0x32')];if(!_0xce231d[_0xc119('0x33')][_0xc119('0x5a')](_0xc119('0x5b'))){_0x1bec61[_0xc119('0x1d')]=qs['limit'](_0xce231d[_0xc119('0x33')][_0xc119('0x1d')]);_0x1bec61[_0xc119('0x1b')]=qs['offset'](_0xce231d[_0xc119('0x33')][_0xc119('0x1b')]);}_0x1bec61[_0xc119('0x39')]=qs[_0xc119('0x3a')](_0xce231d['query'][_0xc119('0x3a')]);_0x1bec61[_0xc119('0x3b')]=qs[_0xc119('0x34')](_[_0xc119('0x5c')](_0xce231d[_0xc119('0x33')],_0x12166d[_0xc119('0x34')]));_0x1bec61[_0xc119('0x3b')][_0xc119('0x5d')]=_0x93ab2d['id'];if(_0xce231d[_0xc119('0x33')][_0xc119('0x3c')]){_0x1bec61[_0xc119('0x3b')]=_['merge'](_0x1bec61[_0xc119('0x3b')],{'$or':_[_0xc119('0x3d')](_0x1bec61['attributes'],function(_0x4a3582){var _0x33834b={};_0x33834b[_0x4a3582]={'$like':'%'+_0xce231d[_0xc119('0x33')]['filter']+'%'};return _0x33834b;})});}_0x1bec61=_[_0xc119('0x3f')]({},_0x1bec61,_0xce231d['options']);return db[_0xc119('0x59')][_0xc119('0x1e')]({'where':_0x1bec61[_0xc119('0x3b')]})[_0xc119('0x24')](function(_0x34a8cd){_0x445a51[_0xc119('0x1e')]=_0x34a8cd;if(_0xce231d[_0xc119('0x33')][_0xc119('0x41')]){_0x1bec61[_0xc119('0x42')]=[{'all':!![]}];}return db[_0xc119('0x59')][_0xc119('0x43')](_0x1bec61);})['then'](function(_0x528098){_0x445a51['rows']=_0x528098;return _0x445a51;});}})[_0xc119('0x24')](respondWithFilteredResult(_0x4c5227,_0x1bec61))[_0xc119('0x45')](handleError(_0x4c5227,null));};exports[_0xc119('0x5e')]=function(_0x181479,_0x1d0add,_0x1c2d12){var _0x36aea8={'raw':!![],'where':{}};var _0xe00397={};var _0x41d235={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc119('0x58')]({'where':{'id':_0x181479[_0xc119('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d0add,null))['then'](function(_0x583ed5){if(_0x583ed5){_0xe00397[_0xc119('0x32')]=_[_0xc119('0x47')](db[_0xc119('0x5f')][_0xc119('0x2e')]);_0xe00397[_0xc119('0x33')]=_['keys'](_0x181479[_0xc119('0x33')]);_0xe00397[_0xc119('0x34')]=_['intersection'](_0xe00397[_0xc119('0x32')],_0xe00397[_0xc119('0x33')]);_0x36aea8[_0xc119('0x37')]=_[_0xc119('0x35')](_0xe00397[_0xc119('0x32')],qs['fields'](_0x181479[_0xc119('0x33')]['fields']));_0x36aea8['attributes']=_0x36aea8['attributes'][_0xc119('0x38')]?_0x36aea8['attributes']:_0xe00397[_0xc119('0x32')];if(!_0x181479[_0xc119('0x33')][_0xc119('0x5a')](_0xc119('0x5b'))){_0x36aea8[_0xc119('0x1d')]=qs['limit'](_0x181479[_0xc119('0x33')][_0xc119('0x1d')]);_0x36aea8[_0xc119('0x1b')]=qs[_0xc119('0x1b')](_0x181479[_0xc119('0x33')]['offset']);}_0x36aea8[_0xc119('0x39')]=qs['sort'](_0x181479['query'][_0xc119('0x3a')]);_0x36aea8[_0xc119('0x3b')]=qs[_0xc119('0x34')](_[_0xc119('0x5c')](_0x181479[_0xc119('0x33')],_0xe00397[_0xc119('0x34')]));_0x36aea8[_0xc119('0x3b')][_0xc119('0x5d')]=_0x583ed5['id'];if(_0x181479[_0xc119('0x33')][_0xc119('0x3c')]){_0x36aea8[_0xc119('0x3b')]=_['merge'](_0x36aea8[_0xc119('0x3b')],{'$or':_[_0xc119('0x3d')](_0x36aea8[_0xc119('0x37')],function(_0x42ce33){var _0x4ae9e8={};_0x4ae9e8[_0x42ce33]={'$like':'%'+_0x181479[_0xc119('0x33')][_0xc119('0x3c')]+'%'};return _0x4ae9e8;})});}_0x36aea8=_[_0xc119('0x3f')]({},_0x36aea8,_0x181479['options']);return db['JscriptyAnswerReport'][_0xc119('0x1e')]({'where':_0x36aea8[_0xc119('0x3b')]})[_0xc119('0x24')](function(_0x1dbd65){_0x41d235[_0xc119('0x1e')]=_0x1dbd65;if(_0x181479[_0xc119('0x33')][_0xc119('0x41')]){_0x36aea8['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc119('0x43')](_0x36aea8);})[_0xc119('0x24')](function(_0x3b2f18){_0x41d235['rows']=_0x3b2f18;return _0x41d235;});}})[_0xc119('0x24')](respondWithFilteredResult(_0x1d0add,_0x36aea8))[_0xc119('0x45')](handleError(_0x1d0add,null));};function char(_0x196858){return'number'===typeof _0x196858?String[_0xc119('0x60')][_0xc119('0x21')](null,arguments):_0x196858;}function needsEncapsulation(_0x2d8529){return!!_0x2d8529&&(_0x2d8529[_0xc119('0x61')]()[_0xc119('0x62')](char(0xd))>=0x0||_0x2d8529[_0xc119('0x61')]()[_0xc119('0x62')](char(0xa))>=0x0||_0x2d8529['toString']()[_0xc119('0x62')](char(0x2c))>=0x0||_0x2d8529[_0xc119('0x61')]()[_0xc119('0x62')](char(0x22))>=0x0);}function encapsulate(_0x4b338d){var _0x47fdb5=char(0x22),_0x1c6893='\x5c'+char(0x22),_0x9146e3=_0x4b338d['toString']()[_0xc119('0x63')](new RegExp(_0x47fdb5,'g'),_0x1c6893);return _0x47fdb5+_0x9146e3+_0x47fdb5;}exports[_0xc119('0x64')]=function(_0x5f5c6d,_0x5a451f,_0x4c6d2a){var _0x175a96,_0x299735;var _0x50cde9={'where':{'ProjectId':_0x5f5c6d[_0xc119('0x50')]['id']}};if(_0x5f5c6d[_0xc119('0x33')][_0xc119('0x65')]){_0x50cde9[_0xc119('0x3b')][_0xc119('0x66')]=JSON['parse'](_0x5f5c6d['query'][_0xc119('0x65')]);}return db['JscriptySessionReport'][_0xc119('0x43')](_0x50cde9)['then'](handleEntityNotFound(_0x5a451f,null))[_0xc119('0x24')](function(_0x20cc8d){if(_0x20cc8d){_0x175a96=_0x20cc8d;return db[_0xc119('0x67')][_0xc119('0x43')]({'where':{'SessionId':{'$in':_[_0xc119('0x3d')](_0x175a96,'id')},'ProjectId':_0x5f5c6d[_0xc119('0x50')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x5a451f,null))[_0xc119('0x24')](function(_0x56c513){if(_0x56c513){_0x299735=_0x56c513;var _0x1425b7={};for(var _0x128405=0x0,_0xc872fc=_0x299735['length'];_0x128405<_0xc872fc;_0x128405++){if(!_0x1425b7[_0xc119('0x5a')](_0x299735[_0x128405][_0xc119('0x68')])){_0x1425b7[_0x299735[_0x128405][_0xc119('0x68')]]=needsEncapsulation(_0x299735[_0x128405][_0xc119('0x69')])?encapsulate(_0x299735[_0x128405][_0xc119('0x69')]):_0x299735[_0x128405][_0xc119('0x69')];}}var _0x557697=[],_0x7727a8={};for(var _0x325a94=0x0,_0x2bdd72=_0x175a96[_0xc119('0x38')];_0x325a94<_0x2bdd72;_0x325a94++){_0x7727a8={'ProjectId':_0x5f5c6d[_0xc119('0x50')]['id'],'SessionId':_0x175a96[_0x325a94]['id'],'StartTime':moment(_0x175a96[_0x325a94]['starttime'])[_0xc119('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x47e54d=0x0,_0x2f05d2=_0x299735[_0xc119('0x38')];_0x47e54d<_0x2f05d2;_0x47e54d++){if(_0x299735[_0x47e54d]['SessionId']==_0x175a96[_0x325a94]['id']&&_0x1425b7[_0xc119('0x5a')](_0x299735[_0x47e54d][_0xc119('0x68')])){_0x7727a8[_0x1425b7[_0x299735[_0x47e54d][_0xc119('0x68')]]]=_0x299735[_0x47e54d]['answer'];}}for(var _0x2d9547 in _0x1425b7){if(!_0x7727a8['hasOwnProperty'](_0x1425b7[_0x2d9547])){_0x7727a8[_0x1425b7[_0x2d9547]]=null;}}_0x557697[_0xc119('0x6b')](_0x7727a8);}return _0x557697;}})[_0xc119('0x24')](function(_0x261bdc){if(!_['isEmpty'](_0x261bdc)){var _0x830bf4=toCsv(_0x261bdc);var _0xf0078c=Date['now']();fs[_0xc119('0x6c')](util[_0xc119('0x6a')](_0xc119('0x6d'),_0x5f5c6d[_0xc119('0x50')]['id'],_0xf0078c),_0x830bf4);_0x5a451f[_0xc119('0x6e')](_0xc119('0x6f'),'attachment;\x20filename='+util[_0xc119('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x5f5c6d['params']['id'],_0xf0078c));_0x5a451f[_0xc119('0x6e')](_0xc119('0x70'),_0xc119('0x71'));return _0x5a451f[_0xc119('0x72')](util[_0xc119('0x6a')](_0xc119('0x6d'),_0x5f5c6d[_0xc119('0x50')]['id'],_0xf0078c));}else{return _0x5a451f['sendStatus'](0xcc);}})['catch'](handleError(_0x5a451f,null));}; \ No newline at end of file +var _0xfd6f=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','clone','omit','createdAt','body','updatedAt','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','JscriptySessionReport','ProjectId','JscriptyAnswerReport','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','get','Projects','destroy','error','stack','name','index','map','JscriptyProject','rawAttributes'];(function(_0x832b53,_0x453d5c){var _0x59e0af=function(_0x58badf){while(--_0x58badf){_0x832b53['push'](_0x832b53['shift']());}};_0x59e0af(++_0x453d5c);}(_0xfd6f,0x19d));var _0xffd6=function(_0x371d44,_0xfeb3a6){_0x371d44=_0x371d44-0x0;var _0x850ffb=_0xfd6f[_0x371d44];return _0x850ffb;};'use strict';var emlformat=require(_0xffd6('0x0'));var rimraf=require(_0xffd6('0x1'));var zipdir=require(_0xffd6('0x2'));var jsonpatch=require(_0xffd6('0x3'));var rp=require(_0xffd6('0x4'));var moment=require('moment');var BPromise=require(_0xffd6('0x5'));var Mustache=require(_0xffd6('0x6'));var util=require(_0xffd6('0x7'));var path=require(_0xffd6('0x8'));var sox=require('sox');var csv=require(_0xffd6('0x9'));var ejs=require(_0xffd6('0xa'));var fs=require('fs');var fs_extra=require(_0xffd6('0xb'));var _=require(_0xffd6('0xc'));var squel=require('squel');var crypto=require(_0xffd6('0xd'));var jsforce=require(_0xffd6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xffd6('0xf'));var Papa=require(_0xffd6('0x10'));var Redis=require(_0xffd6('0x11'));var authService=require(_0xffd6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xffd6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffd6('0x14'));var utils=require(_0xffd6('0x15'));var config=require(_0xffd6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xffd6('0x17'))['db'];function respondWithStatusCode(_0x8c86c6,_0x59d2d8){_0x59d2d8=_0x59d2d8||0xcc;return function(_0x12cbe9){if(_0x12cbe9){return _0x8c86c6[_0xffd6('0x18')](_0x59d2d8);}return _0x8c86c6[_0xffd6('0x19')](_0x59d2d8)[_0xffd6('0x1a')]();};}function respondWithResult(_0x5f15f6,_0x5f4765){_0x5f4765=_0x5f4765||0xc8;return function(_0x26ef4){if(_0x26ef4){return _0x5f15f6[_0xffd6('0x19')](_0x5f4765)[_0xffd6('0x1b')](_0x26ef4);}};}function respondWithFilteredResult(_0x575120,_0x17114f){return function(_0x131661){if(_0x131661){var _0x57e34e=typeof _0x17114f[_0xffd6('0x1c')]==='undefined'&&typeof _0x17114f[_0xffd6('0x1d')]===_0xffd6('0x1e');var _0x2271c4=_0x131661[_0xffd6('0x1f')];var _0x1c96dc=_0x57e34e?0x0:_0x17114f['offset'];var _0xe2f572=_0x57e34e?_0x131661[_0xffd6('0x1f')]:_0x17114f[_0xffd6('0x1c')]+_0x17114f[_0xffd6('0x1d')];var _0x56dd04;if(_0xe2f572>=_0x2271c4){_0xe2f572=_0x2271c4;_0x56dd04=0xc8;}else{_0x56dd04=0xce;}_0x575120['status'](_0x56dd04);return _0x575120[_0xffd6('0x20')]('Content-Range',_0x1c96dc+'-'+_0xe2f572+'/'+_0x2271c4)['json'](_0x131661);}return null;};}function patchUpdates(_0x453e4e){return function(_0x1a7102){try{jsonpatch[_0xffd6('0x21')](_0x1a7102,_0x453e4e,!![]);}catch(_0x352974){return BPromise[_0xffd6('0x22')](_0x352974);}return _0x1a7102[_0xffd6('0x23')]();};}function saveUpdates(_0x528a4d,_0x44e5f5){return function(_0x26daf2){if(_0x26daf2){return _0x26daf2['update'](_0x528a4d)[_0xffd6('0x24')](function(_0x49f7d5){return _0x49f7d5;});}return null;};}function removeEntity(_0x270704,_0x207f18){return function(_0x18fd0f){if(_0x18fd0f){return _0x18fd0f['destroy']()['then'](function(){var _0x4b75c6=_0x18fd0f[_0xffd6('0x25')]({'plain':!![]});var _0x16f8bf=_0xffd6('0x26');return db['UserProfileResource'][_0xffd6('0x27')]({'where':{'type':_0x16f8bf,'resourceId':_0x4b75c6['id']}})[_0xffd6('0x24')](function(){return _0x18fd0f;});})[_0xffd6('0x24')](function(){_0x270704[_0xffd6('0x19')](0xcc)[_0xffd6('0x1a')]();});}};}function handleEntityNotFound(_0x499eae,_0x129b9f){return function(_0x216009){if(!_0x216009){_0x499eae[_0xffd6('0x18')](0x194);}return _0x216009;};}function handleError(_0xb11654,_0x1f6ce7){_0x1f6ce7=_0x1f6ce7||0x1f4;return function(_0x434ee0){logger[_0xffd6('0x28')](_0x434ee0[_0xffd6('0x29')]);if(_0x434ee0[_0xffd6('0x2a')]){delete _0x434ee0[_0xffd6('0x2a')];}_0xb11654[_0xffd6('0x19')](_0x1f6ce7)['send'](_0x434ee0);};}exports[_0xffd6('0x2b')]=function(_0x3eb1b3,_0x261266){var _0x35328a={},_0x428ae9={},_0x101291={'count':0x0,'rows':[]};var _0x4b2d96=_[_0xffd6('0x2c')](db[_0xffd6('0x2d')][_0xffd6('0x2e')],function(_0x38998e){return{'name':_0x38998e[_0xffd6('0x2f')],'type':_0x38998e[_0xffd6('0x30')][_0xffd6('0x31')]};});_0x428ae9[_0xffd6('0x32')]=_[_0xffd6('0x2c')](_0x4b2d96,_0xffd6('0x2a'));_0x428ae9[_0xffd6('0x33')]=_[_0xffd6('0x34')](_0x3eb1b3['query']);_0x428ae9[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x428ae9[_0xffd6('0x32')],_0x428ae9['query']);_0x35328a['attributes']=_['intersection'](_0x428ae9[_0xffd6('0x32')],qs[_0xffd6('0x37')](_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x37')]));_0x35328a[_0xffd6('0x38')]=_0x35328a[_0xffd6('0x38')][_0xffd6('0x39')]?_0x35328a['attributes']:_0x428ae9[_0xffd6('0x32')];if(!_0x3eb1b3['query'][_0xffd6('0x3a')](_0xffd6('0x3b'))){_0x35328a[_0xffd6('0x1d')]=qs['limit'](_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x1d')]);_0x35328a['offset']=qs[_0xffd6('0x1c')](_0x3eb1b3['query'][_0xffd6('0x1c')]);}_0x35328a[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x3d')]);_0x35328a[_0xffd6('0x3e')]=qs[_0xffd6('0x35')](_[_0xffd6('0x3f')](_0x3eb1b3[_0xffd6('0x33')],_0x428ae9['filters']),_0x4b2d96);if(_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x40')]){_0x35328a[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0x35328a[_0xffd6('0x3e')],{'$or':_[_0xffd6('0x2c')](_0x4b2d96,function(_0x90c982){if(_0x90c982[_0xffd6('0x30')]!==_0xffd6('0x42')){var _0x691334={};_0x691334[_0x90c982[_0xffd6('0x2a')]]={'$like':'%'+_0x3eb1b3['query']['filter']+'%'};return _0x691334;}})});}_0x35328a=_[_0xffd6('0x41')]({},_0x35328a,_0x3eb1b3[_0xffd6('0x43')]);var _0x4c8d26={'where':_0x35328a[_0xffd6('0x3e')]};return db[_0xffd6('0x2d')][_0xffd6('0x1f')](_0x4c8d26)[_0xffd6('0x24')](function(_0xef60c0){_0x101291[_0xffd6('0x1f')]=_0xef60c0;if(_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x44')]){_0x35328a[_0xffd6('0x45')]=[{'all':!![]}];}return db[_0xffd6('0x2d')][_0xffd6('0x46')](_0x35328a);})[_0xffd6('0x24')](function(_0x1b680a){_0x101291[_0xffd6('0x47')]=_0x1b680a;return _0x101291;})[_0xffd6('0x24')](respondWithFilteredResult(_0x261266,_0x35328a))[_0xffd6('0x48')](handleError(_0x261266,null));};exports['show']=function(_0x50b2cf,_0x5745b3){var _0x1f7205={'raw':![],'where':{'id':_0x50b2cf[_0xffd6('0x49')]['id']}},_0x5629ed={};_0x5629ed['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0x5629ed[_0xffd6('0x33')]=_[_0xffd6('0x34')](_0x50b2cf[_0xffd6('0x33')]);_0x5629ed[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x5629ed[_0xffd6('0x32')],_0x5629ed[_0xffd6('0x33')]);_0x1f7205[_0xffd6('0x38')]=_[_0xffd6('0x36')](_0x5629ed[_0xffd6('0x32')],qs[_0xffd6('0x37')](_0x50b2cf[_0xffd6('0x33')][_0xffd6('0x37')]));_0x1f7205[_0xffd6('0x38')]=_0x1f7205['attributes'][_0xffd6('0x39')]?_0x1f7205[_0xffd6('0x38')]:_0x5629ed[_0xffd6('0x32')];if(_0x50b2cf[_0xffd6('0x33')][_0xffd6('0x44')]){_0x1f7205['include']=[{'all':!![]}];}_0x1f7205=_[_0xffd6('0x41')]({},_0x1f7205,_0x50b2cf[_0xffd6('0x43')]);return db['JscriptyProject'][_0xffd6('0x4a')](_0x1f7205)[_0xffd6('0x24')](handleEntityNotFound(_0x5745b3,null))[_0xffd6('0x24')](respondWithResult(_0x5745b3,null))[_0xffd6('0x48')](handleError(_0x5745b3,null));};exports[_0xffd6('0x4b')]=function(_0x2cc194,_0x17e609){return db[_0xffd6('0x2d')][_0xffd6('0x4b')](_0x2cc194['body'],{})[_0xffd6('0x24')](function(_0x2fd1bb){var _0x5811d4=_0x2cc194[_0xffd6('0x4c')][_0xffd6('0x25')]({'plain':!![]});if(!_0x5811d4)throw new Error(_0xffd6('0x4d'));if(_0x5811d4['role']===_0xffd6('0x4c')){var _0x59f9e9=_0x2fd1bb['get']({'plain':!![]});var _0x5ebed3=_0xffd6('0x26');return db['UserProfileSection'][_0xffd6('0x4a')]({'where':{'name':_0x5ebed3,'userProfileId':_0x5811d4[_0xffd6('0x4e')]},'raw':!![]})[_0xffd6('0x24')](function(_0x4c05fa){if(_0x4c05fa&&_0x4c05fa[_0xffd6('0x4f')]===0x0){return db['UserProfileResource'][_0xffd6('0x4b')]({'name':_0x59f9e9[_0xffd6('0x2a')],'resourceId':_0x59f9e9['id'],'type':_0x4c05fa[_0xffd6('0x2a')],'sectionId':_0x4c05fa['id']},{})[_0xffd6('0x24')](function(){return _0x2fd1bb;});}else{return _0x2fd1bb;}})[_0xffd6('0x48')](function(_0x2a27d9){logger[_0xffd6('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a27d9);throw _0x2a27d9;});}return _0x2fd1bb;})[_0xffd6('0x24')](respondWithResult(_0x17e609,0xc9))[_0xffd6('0x48')](handleError(_0x17e609,null));};exports[_0xffd6('0x50')]=function(_0xa788ab,_0x459cbe){var _0x2c3544={'where':{'id':_0xa788ab['params']['id']}},_0x18e097={};_0x18e097[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x2d')][_0xffd6('0x2e')]);_0x2c3544['attributes']=_[_0xffd6('0x36')](_0x18e097[_0xffd6('0x32')],qs[_0xffd6('0x37')](_0xa788ab[_0xffd6('0x33')][_0xffd6('0x37')]));_0x2c3544[_0xffd6('0x38')]=_0x2c3544[_0xffd6('0x38')][_0xffd6('0x39')]?_0x2c3544[_0xffd6('0x38')]:_0x18e097['model'];if(_0xa788ab[_0xffd6('0x33')][_0xffd6('0x44')]){_0x2c3544[_0xffd6('0x45')]=[{'all':!![]}];}_0x2c3544=_[_0xffd6('0x41')]({},_0x2c3544,_0xa788ab[_0xffd6('0x43')]);return db[_0xffd6('0x2d')][_0xffd6('0x4a')](_0x2c3544)['then'](handleEntityNotFound(_0x459cbe,null))[_0xffd6('0x24')](function(_0x3c1f8c){if(_0x3c1f8c){var _0xa65d14=_0x3c1f8c[_0xffd6('0x25')]({'plain':!![]});_0xa65d14=qs[_0xffd6('0x51')](_0xa65d14,['id',_0xffd6('0x52'),'updatedAt']);_0xa788ab[_0xffd6('0x53')]=_[_0xffd6('0x51')](_0xa788ab[_0xffd6('0x53')],['id',_0xffd6('0x52'),_0xffd6('0x54')]);return db[_0xffd6('0x2d')][_0xffd6('0x4b')](_[_0xffd6('0x41')](_0xa65d14,_0xa788ab[_0xffd6('0x53')]),{'include':_0xa788ab[_0xffd6('0x33')][_0xffd6('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x461771){var _0x490439=_0xa788ab['user'][_0xffd6('0x25')]({'plain':!![]});if(!_0x490439)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x490439[_0xffd6('0x55')]==='user'){var _0x783db4=_0x461771['get']({'plain':!![]});var _0xe483d2='Projects';return db[_0xffd6('0x56')][_0xffd6('0x4a')]({'where':{'name':_0xe483d2,'userProfileId':_0x490439[_0xffd6('0x4e')]},'raw':!![]})[_0xffd6('0x24')](function(_0x4f0db0){if(_0x4f0db0&&_0x4f0db0[_0xffd6('0x4f')]===0x0){return db[_0xffd6('0x57')]['create']({'name':_0x783db4[_0xffd6('0x2a')],'resourceId':_0x783db4['id'],'type':_0x4f0db0[_0xffd6('0x2a')],'sectionId':_0x4f0db0['id']},{})[_0xffd6('0x24')](function(){return _0x461771;});}else{return _0x461771;}})['catch'](function(_0x4eba62){logger['error'](_0xffd6('0x58'),_0x4eba62);throw _0x4eba62;});}return _0x461771;});}})['then'](respondWithResult(_0x459cbe,0xc9))['catch'](handleError(_0x459cbe,null));};exports[_0xffd6('0x59')]=function(_0x8d5a9,_0x462e1a){if(_0x8d5a9[_0xffd6('0x53')]['id']){delete _0x8d5a9['body']['id'];}return db[_0xffd6('0x2d')][_0xffd6('0x4a')]({'where':{'id':_0x8d5a9['params']['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x462e1a,null))[_0xffd6('0x24')](saveUpdates(_0x8d5a9['body'],null))[_0xffd6('0x24')](respondWithResult(_0x462e1a,null))[_0xffd6('0x48')](handleError(_0x462e1a,null));};exports[_0xffd6('0x27')]=function(_0x218389,_0x4494c5){return db[_0xffd6('0x2d')]['find']({'where':{'id':_0x218389[_0xffd6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4494c5,null))[_0xffd6('0x24')](removeEntity(_0x4494c5,null))[_0xffd6('0x48')](handleError(_0x4494c5,null));};exports['getSessions']=function(_0x4358bf,_0x3d2de9,_0x310256){var _0x3695bd={'raw':!![],'where':{}};var _0x1a8cf1={};var _0x3e9b21={'count':0x0,'rows':[]};return db[_0xffd6('0x2d')]['findOne']({'where':{'id':_0x4358bf['params']['id']}})['then'](handleEntityNotFound(_0x3d2de9,null))[_0xffd6('0x24')](function(_0x19f954){if(_0x19f954){_0x1a8cf1[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x5a')][_0xffd6('0x2e')]);_0x1a8cf1[_0xffd6('0x33')]=_[_0xffd6('0x34')](_0x4358bf[_0xffd6('0x33')]);_0x1a8cf1[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x1a8cf1[_0xffd6('0x32')],_0x1a8cf1[_0xffd6('0x33')]);_0x3695bd[_0xffd6('0x38')]=_[_0xffd6('0x36')](_0x1a8cf1[_0xffd6('0x32')],qs[_0xffd6('0x37')](_0x4358bf[_0xffd6('0x33')][_0xffd6('0x37')]));_0x3695bd['attributes']=_0x3695bd[_0xffd6('0x38')][_0xffd6('0x39')]?_0x3695bd['attributes']:_0x1a8cf1[_0xffd6('0x32')];if(!_0x4358bf[_0xffd6('0x33')]['hasOwnProperty'](_0xffd6('0x3b'))){_0x3695bd[_0xffd6('0x1d')]=qs['limit'](_0x4358bf[_0xffd6('0x33')]['limit']);_0x3695bd[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x4358bf[_0xffd6('0x33')][_0xffd6('0x1c')]);}_0x3695bd[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x4358bf['query'][_0xffd6('0x3d')]);_0x3695bd[_0xffd6('0x3e')]=qs[_0xffd6('0x35')](_['pick'](_0x4358bf['query'],_0x1a8cf1[_0xffd6('0x35')]));_0x3695bd[_0xffd6('0x3e')][_0xffd6('0x5b')]=_0x19f954['id'];if(_0x4358bf[_0xffd6('0x33')]['filter']){_0x3695bd[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0x3695bd[_0xffd6('0x3e')],{'$or':_[_0xffd6('0x2c')](_0x3695bd[_0xffd6('0x38')],function(_0x121ec5){var _0x42758e={};_0x42758e[_0x121ec5]={'$like':'%'+_0x4358bf[_0xffd6('0x33')][_0xffd6('0x40')]+'%'};return _0x42758e;})});}_0x3695bd=_[_0xffd6('0x41')]({},_0x3695bd,_0x4358bf[_0xffd6('0x43')]);return db['JscriptySessionReport'][_0xffd6('0x1f')]({'where':_0x3695bd[_0xffd6('0x3e')]})[_0xffd6('0x24')](function(_0x1287d1){_0x3e9b21['count']=_0x1287d1;if(_0x4358bf['query'][_0xffd6('0x44')]){_0x3695bd[_0xffd6('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xffd6('0x46')](_0x3695bd);})[_0xffd6('0x24')](function(_0x2d094a){_0x3e9b21[_0xffd6('0x47')]=_0x2d094a;return _0x3e9b21;});}})[_0xffd6('0x24')](respondWithFilteredResult(_0x3d2de9,_0x3695bd))[_0xffd6('0x48')](handleError(_0x3d2de9,null));};exports['getAnswers']=function(_0x3e30bf,_0x22e3cf,_0x44b83b){var _0xf85516={'raw':!![],'where':{}};var _0xda9ba7={};var _0x1ecdac={'count':0x0,'rows':[]};return db[_0xffd6('0x2d')]['findOne']({'where':{'id':_0x3e30bf[_0xffd6('0x49')]['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x22e3cf,null))[_0xffd6('0x24')](function(_0x4856e5){if(_0x4856e5){_0xda9ba7[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x5c')]['rawAttributes']);_0xda9ba7[_0xffd6('0x33')]=_['keys'](_0x3e30bf[_0xffd6('0x33')]);_0xda9ba7[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0xda9ba7[_0xffd6('0x32')],_0xda9ba7[_0xffd6('0x33')]);_0xf85516[_0xffd6('0x38')]=_[_0xffd6('0x36')](_0xda9ba7['model'],qs[_0xffd6('0x37')](_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x37')]));_0xf85516[_0xffd6('0x38')]=_0xf85516[_0xffd6('0x38')][_0xffd6('0x39')]?_0xf85516[_0xffd6('0x38')]:_0xda9ba7[_0xffd6('0x32')];if(!_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x3a')](_0xffd6('0x3b'))){_0xf85516['limit']=qs[_0xffd6('0x1d')](_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x1d')]);_0xf85516[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x3e30bf['query'][_0xffd6('0x1c')]);}_0xf85516[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x3d')]);_0xf85516['where']=qs[_0xffd6('0x35')](_[_0xffd6('0x3f')](_0x3e30bf['query'],_0xda9ba7[_0xffd6('0x35')]));_0xf85516[_0xffd6('0x3e')][_0xffd6('0x5b')]=_0x4856e5['id'];if(_0x3e30bf['query'][_0xffd6('0x40')]){_0xf85516[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0xf85516['where'],{'$or':_[_0xffd6('0x2c')](_0xf85516['attributes'],function(_0x29a129){var _0x4f7459={};_0x4f7459[_0x29a129]={'$like':'%'+_0x3e30bf[_0xffd6('0x33')]['filter']+'%'};return _0x4f7459;})});}_0xf85516=_[_0xffd6('0x41')]({},_0xf85516,_0x3e30bf['options']);return db['JscriptyAnswerReport']['count']({'where':_0xf85516[_0xffd6('0x3e')]})[_0xffd6('0x24')](function(_0x4f00b5){_0x1ecdac['count']=_0x4f00b5;if(_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x44')]){_0xf85516[_0xffd6('0x45')]=[{'all':!![]}];}return db[_0xffd6('0x5c')][_0xffd6('0x46')](_0xf85516);})['then'](function(_0x11d206){_0x1ecdac['rows']=_0x11d206;return _0x1ecdac;});}})['then'](respondWithFilteredResult(_0x22e3cf,_0xf85516))[_0xffd6('0x48')](handleError(_0x22e3cf,null));};function char(_0x4966fe){return'number'===typeof _0x4966fe?String['fromCharCode'][_0xffd6('0x21')](null,arguments):_0x4966fe;}function needsEncapsulation(_0x323439){return!!_0x323439&&(_0x323439[_0xffd6('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x323439[_0xffd6('0x5d')]()[_0xffd6('0x5e')](char(0xa))>=0x0||_0x323439[_0xffd6('0x5d')]()[_0xffd6('0x5e')](char(0x2c))>=0x0||_0x323439[_0xffd6('0x5d')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x2ea61f){var _0x36cf85=char(0x22),_0x8a3bfc='\x5c'+char(0x22),_0x38f8ac=_0x2ea61f['toString']()[_0xffd6('0x5f')](new RegExp(_0x36cf85,'g'),_0x8a3bfc);return _0x36cf85+_0x38f8ac+_0x36cf85;}exports[_0xffd6('0x60')]=function(_0xd990a0,_0x19851d,_0x45a1c1){var _0x2d3e57,_0x5ddb7f;var _0x11d5ac={'where':{'ProjectId':_0xd990a0[_0xffd6('0x49')]['id']}};if(_0xd990a0['query'][_0xffd6('0x61')]){_0x11d5ac['where'][_0xffd6('0x62')]=JSON['parse'](_0xd990a0[_0xffd6('0x33')][_0xffd6('0x61')]);}return db['JscriptySessionReport'][_0xffd6('0x46')](_0x11d5ac)['then'](handleEntityNotFound(_0x19851d,null))[_0xffd6('0x24')](function(_0x57e749){if(_0x57e749){_0x2d3e57=_0x57e749;return db[_0xffd6('0x63')][_0xffd6('0x46')]({'where':{'SessionId':{'$in':_[_0xffd6('0x2c')](_0x2d3e57,'id')},'ProjectId':_0xd990a0[_0xffd6('0x49')]['id']},'order':_0xffd6('0x64')});}})['then'](handleEntityNotFound(_0x19851d,null))[_0xffd6('0x24')](function(_0x19fdcc){if(_0x19fdcc){_0x5ddb7f=_0x19fdcc;var _0x3c9e04={};for(var _0x1a2bb5=0x0,_0x225a8c=_0x5ddb7f[_0xffd6('0x39')];_0x1a2bb5<_0x225a8c;_0x1a2bb5++){if(!_0x3c9e04[_0xffd6('0x3a')](_0x5ddb7f[_0x1a2bb5][_0xffd6('0x65')])){_0x3c9e04[_0x5ddb7f[_0x1a2bb5][_0xffd6('0x65')]]=needsEncapsulation(_0x5ddb7f[_0x1a2bb5][_0xffd6('0x66')])?encapsulate(_0x5ddb7f[_0x1a2bb5]['question']):_0x5ddb7f[_0x1a2bb5]['question'];}}var _0x11e168=[],_0x3d6b5f={};for(var _0x3a606a=0x0,_0x321d19=_0x2d3e57[_0xffd6('0x39')];_0x3a606a<_0x321d19;_0x3a606a++){_0x3d6b5f={'ProjectId':_0xd990a0[_0xffd6('0x49')]['id'],'SessionId':_0x2d3e57[_0x3a606a]['id'],'StartTime':moment(_0x2d3e57[_0x3a606a]['starttime'])[_0xffd6('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1defe0=0x0,_0x424d4f=_0x5ddb7f['length'];_0x1defe0<_0x424d4f;_0x1defe0++){if(_0x5ddb7f[_0x1defe0]['SessionId']==_0x2d3e57[_0x3a606a]['id']&&_0x3c9e04[_0xffd6('0x3a')](_0x5ddb7f[_0x1defe0][_0xffd6('0x65')])){_0x3d6b5f[_0x3c9e04[_0x5ddb7f[_0x1defe0][_0xffd6('0x65')]]]=_0x5ddb7f[_0x1defe0][_0xffd6('0x68')];}}for(var _0x16ba74 in _0x3c9e04){if(!_0x3d6b5f[_0xffd6('0x3a')](_0x3c9e04[_0x16ba74])){_0x3d6b5f[_0x3c9e04[_0x16ba74]]=null;}}_0x11e168[_0xffd6('0x69')](_0x3d6b5f);}return _0x11e168;}})[_0xffd6('0x24')](function(_0x84c777){if(!_[_0xffd6('0x6a')](_0x84c777)){var _0xe2bce6=toCsv(_0x84c777);var _0x1d7c0f=Date[_0xffd6('0x6b')]();fs[_0xffd6('0x6c')](util['format'](_0xffd6('0x6d'),_0xd990a0[_0xffd6('0x49')]['id'],_0x1d7c0f),_0xe2bce6);_0x19851d[_0xffd6('0x6e')](_0xffd6('0x6f'),'attachment;\x20filename='+util[_0xffd6('0x67')](_0xffd6('0x70'),_0xd990a0[_0xffd6('0x49')]['id'],_0x1d7c0f));_0x19851d[_0xffd6('0x6e')]('Content-type',_0xffd6('0x71'));return _0x19851d[_0xffd6('0x72')](util[_0xffd6('0x67')](_0xffd6('0x6d'),_0xd990a0[_0xffd6('0x49')]['id'],_0x1d7c0f));}else{return _0x19851d[_0xffd6('0x18')](0xcc);}})[_0xffd6('0x48')](handleError(_0x19851d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 471a5d0..005846c 100644 --- a/server/api/jscriptyProject/jscriptyProject.model.js +++ b/server/api/jscriptyProject/jscriptyProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf4e=['moment','bluebird','path','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','api'];(function(_0x2509b2,_0x137fd3){var _0x1d4342=function(_0x2364e6){while(--_0x2364e6){_0x2509b2['push'](_0x2509b2['shift']());}};_0x1d4342(++_0x137fd3);}(_0xbf4e,0x172));var _0xebf4=function(_0x251f12,_0x2d9e4f){_0x251f12=_0x251f12-0x0;var _0x4d8889=_0xbf4e[_0x251f12];return _0x4d8889;};'use strict';var _=require(_0xebf4('0x0'));var util=require(_0xebf4('0x1'));var logger=require(_0xebf4('0x2'))(_0xebf4('0x3'));var moment=require(_0xebf4('0x4'));var BPromise=require(_0xebf4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebf4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xebf4('0x7'));module[_0xebf4('0x8')]=function(_0x5adea8,_0x412bbe){return _0x5adea8[_0xebf4('0x9')](_0xebf4('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf98=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','../../config/logger'];(function(_0x5cfb5e,_0x491176){var _0x387d0a=function(_0xaccf0b){while(--_0xaccf0b){_0x5cfb5e['push'](_0x5cfb5e['shift']());}};_0x387d0a(++_0x491176);}(_0xdf98,0xcf));var _0x8df9=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0xdf98[_0x28b0a4];return _0x105ce6;};'use strict';var _=require(_0x8df9('0x0'));var util=require('util');var logger=require(_0x8df9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8df9('0x2'));var rp=require(_0x8df9('0x3'));var fs=require('fs');var path=require(_0x8df9('0x4'));var rimraf=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var attributes=require(_0x8df9('0x7'));module[_0x8df9('0x8')]=function(_0x158424,_0x20b677){return _0x158424['define'](_0x8df9('0x9'),attributes,{'tableName':_0x8df9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index a0c348d..929ac3f 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x41362f,_0x2348fa){var _0xca54ea=function(_0x3c594e){while(--_0x3c594e){_0x41362f['push'](_0x41362f['shift']());}};_0xca54ea(++_0x2348fa);}(_0x70e0,0x17b));var _0x070e=function(_0x29f728,_0x2ebbba){_0x29f728=_0x29f728-0x0;var _0x3b4128=_0x70e0[_0x29f728];return _0x3b4128;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4edd07,_0x3bf7b7){var _0x166fa2=function(_0x23251e){while(--_0x23251e){_0x4edd07['push'](_0x4edd07['shift']());}};_0x166fa2(++_0x3bf7b7);}(_0xe706,0xa3));var _0x6e70=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xe706[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1e73af5..79ba687 100644 --- a/server/api/jscriptyQuestionReport/index.js +++ b/server/api/jscriptyQuestionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e67=['describe','show','create','put','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated'];(function(_0x35280f,_0x194c87){var _0xa0b464=function(_0x226589){while(--_0x226589){_0x35280f['push'](_0x35280f['shift']());}};_0xa0b464(++_0x194c87);}(_0x4e67,0x1c0));var _0x74e6=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0x4e67[_0x10bcc4];return _0x2da988;};'use strict';var multer=require(_0x74e6('0x0'));var util=require(_0x74e6('0x1'));var path=require(_0x74e6('0x2'));var timeout=require(_0x74e6('0x3'));var express=require(_0x74e6('0x4'));var router=express[_0x74e6('0x5')]();var fs_extra=require(_0x74e6('0x6'));var auth=require(_0x74e6('0x7'));var interaction=require(_0x74e6('0x8'));var config=require(_0x74e6('0x9'));var controller=require(_0x74e6('0xa'));router[_0x74e6('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x74e6('0xb')](_0x74e6('0xc'),auth[_0x74e6('0xd')](),controller[_0x74e6('0xe')]);router[_0x74e6('0xb')]('/:id',auth[_0x74e6('0xd')](),controller[_0x74e6('0xf')]);router['post']('/',auth[_0x74e6('0xd')](),controller[_0x74e6('0x10')]);router[_0x74e6('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x74e6('0x12')](_0x74e6('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x74e6('0x14')]=router; \ No newline at end of file +var _0x7d87=['get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0xaabd61,_0x1e1bf7){var _0x353bcd=function(_0xbcf4fb){while(--_0xbcf4fb){_0xaabd61['push'](_0xaabd61['shift']());}};_0x353bcd(++_0x1e1bf7);}(_0x7d87,0x117));var _0x77d8=function(_0x21a2da,_0x9f4c2b){_0x21a2da=_0x21a2da-0x0;var _0x3ff5da=_0x7d87[_0x21a2da];return _0x3ff5da;};'use strict';var multer=require(_0x77d8('0x0'));var util=require('util');var path=require(_0x77d8('0x1'));var timeout=require('connect-timeout');var express=require(_0x77d8('0x2'));var router=express[_0x77d8('0x3')]();var fs_extra=require(_0x77d8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77d8('0x5'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x77d8('0x6')]('/',auth[_0x77d8('0x7')](),controller[_0x77d8('0x8')]);router[_0x77d8('0x6')](_0x77d8('0x9'),auth[_0x77d8('0x7')](),controller[_0x77d8('0xa')]);router[_0x77d8('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x77d8('0xb')]('/',auth[_0x77d8('0x7')](),controller[_0x77d8('0xc')]);router[_0x77d8('0xd')](_0x77d8('0xe'),auth[_0x77d8('0x7')](),controller[_0x77d8('0xf')]);router[_0x77d8('0x10')](_0x77d8('0xe'),auth[_0x77d8('0x7')](),controller[_0x77d8('0x11')]);module[_0x77d8('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a95f49b..c7d8492 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x798147,_0x1565b1){_0x798147=_0x798147-0x0;var _0x3d4854=_0x7a54[_0x798147];return _0x3d4854;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0xd2135b,_0x45fb0c){_0xd2135b=_0xd2135b-0x0;var _0x1967ad=_0x7a54[_0xd2135b];return _0x1967ad;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 67368a5..070cd46 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8d4=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format'];(function(_0xb3cabe,_0x22e3d7){var _0x2e148c=function(_0x31f1cf){while(--_0x31f1cf){_0xb3cabe['push'](_0xb3cabe['shift']());}};_0x2e148c(++_0x22e3d7);}(_0xd8d4,0xe9));var _0x4d8d=function(_0x3c9880,_0x326d70){_0x3c9880=_0x3c9880-0x0;var _0x106ed8=_0xd8d4[_0x3c9880];return _0x106ed8;};'use strict';var emlformat=require(_0x4d8d('0x0'));var rimraf=require(_0x4d8d('0x1'));var zipdir=require(_0x4d8d('0x2'));var jsonpatch=require(_0x4d8d('0x3'));var rp=require(_0x4d8d('0x4'));var moment=require(_0x4d8d('0x5'));var BPromise=require(_0x4d8d('0x6'));var Mustache=require(_0x4d8d('0x7'));var util=require(_0x4d8d('0x8'));var path=require(_0x4d8d('0x9'));var sox=require(_0x4d8d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d8d('0xb'));var _=require(_0x4d8d('0xc'));var squel=require('squel');var crypto=require(_0x4d8d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4d8d('0xe'));var querystring=require('querystring');var Papa=require(_0x4d8d('0xf'));var Redis=require('ioredis');var authService=require(_0x4d8d('0x10'));var qs=require(_0x4d8d('0x11'));var as=require(_0x4d8d('0x12'));var hardwareService=require(_0x4d8d('0x13'));var logger=require(_0x4d8d('0x14'))(_0x4d8d('0x15'));var utils=require('../../config/utils');var config=require(_0x4d8d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d8d('0x17'))['db'];function respondWithStatusCode(_0x5a475f,_0x9ae5dd){_0x9ae5dd=_0x9ae5dd||0xcc;return function(_0x45ebca){if(_0x45ebca){return _0x5a475f[_0x4d8d('0x18')](_0x9ae5dd);}return _0x5a475f['status'](_0x9ae5dd)[_0x4d8d('0x19')]();};}function respondWithResult(_0x2a4b1e,_0x1ae7bb){_0x1ae7bb=_0x1ae7bb||0xc8;return function(_0xef6eb3){if(_0xef6eb3){return _0x2a4b1e[_0x4d8d('0x1a')](_0x1ae7bb)[_0x4d8d('0x1b')](_0xef6eb3);}};}function respondWithFilteredResult(_0x1e041f,_0xce2534){return function(_0x449687){if(_0x449687){var _0x151c2c=typeof _0xce2534[_0x4d8d('0x1c')]===_0x4d8d('0x1d')&&typeof _0xce2534['limit']===_0x4d8d('0x1d');var _0x8c51fe=_0x449687[_0x4d8d('0x1e')];var _0x1b3f1d=_0x151c2c?0x0:_0xce2534[_0x4d8d('0x1c')];var _0x14dde4=_0x151c2c?_0x449687[_0x4d8d('0x1e')]:_0xce2534['offset']+_0xce2534['limit'];var _0x18f1e4;if(_0x14dde4>=_0x8c51fe){_0x14dde4=_0x8c51fe;_0x18f1e4=0xc8;}else{_0x18f1e4=0xce;}_0x1e041f[_0x4d8d('0x1a')](_0x18f1e4);return _0x1e041f[_0x4d8d('0x1f')](_0x4d8d('0x20'),_0x1b3f1d+'-'+_0x14dde4+'/'+_0x8c51fe)['json'](_0x449687);}return null;};}function patchUpdates(_0x414ca0){return function(_0x54bc96){try{jsonpatch['apply'](_0x54bc96,_0x414ca0,!![]);}catch(_0x10c696){return BPromise[_0x4d8d('0x21')](_0x10c696);}return _0x54bc96[_0x4d8d('0x22')]();};}function saveUpdates(_0x6e5528,_0x10b781){return function(_0x4172a7){if(_0x4172a7){return _0x4172a7['update'](_0x6e5528)[_0x4d8d('0x23')](function(_0x288370){return _0x288370;});}return null;};}function removeEntity(_0x8de096,_0x4174d0){return function(_0x4da869){if(_0x4da869){return _0x4da869[_0x4d8d('0x24')]()[_0x4d8d('0x23')](function(){_0x8de096[_0x4d8d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5cc3,_0x204aa0){return function(_0xc21815){if(!_0xc21815){_0x2a5cc3[_0x4d8d('0x18')](0x194);}return _0xc21815;};}function handleError(_0x46995d,_0x5ebb32){_0x5ebb32=_0x5ebb32||0x1f4;return function(_0x24ff27){logger[_0x4d8d('0x25')](_0x24ff27[_0x4d8d('0x26')]);if(_0x24ff27[_0x4d8d('0x27')]){delete _0x24ff27[_0x4d8d('0x27')];}_0x46995d[_0x4d8d('0x1a')](_0x5ebb32)[_0x4d8d('0x28')](_0x24ff27);};}exports[_0x4d8d('0x29')]=function(_0x61357,_0x5be139){var _0x76af14={},_0x138a7f={},_0x5e21fa={'count':0x0,'rows':[]};var _0x48679b=_[_0x4d8d('0x2a')](db[_0x4d8d('0x2b')][_0x4d8d('0x2c')],function(_0x238c42){return{'name':_0x238c42[_0x4d8d('0x2d')],'type':_0x238c42['type'][_0x4d8d('0x2e')]};});_0x138a7f[_0x4d8d('0x2f')]=_[_0x4d8d('0x2a')](_0x48679b,_0x4d8d('0x27'));_0x138a7f[_0x4d8d('0x30')]=_[_0x4d8d('0x31')](_0x61357[_0x4d8d('0x30')]);_0x138a7f['filters']=_[_0x4d8d('0x32')](_0x138a7f['model'],_0x138a7f[_0x4d8d('0x30')]);_0x76af14[_0x4d8d('0x33')]=_[_0x4d8d('0x32')](_0x138a7f[_0x4d8d('0x2f')],qs[_0x4d8d('0x34')](_0x61357[_0x4d8d('0x30')][_0x4d8d('0x34')]));_0x76af14[_0x4d8d('0x33')]=_0x76af14[_0x4d8d('0x33')][_0x4d8d('0x35')]?_0x76af14['attributes']:_0x138a7f[_0x4d8d('0x2f')];if(!_0x61357[_0x4d8d('0x30')][_0x4d8d('0x36')](_0x4d8d('0x37'))){_0x76af14[_0x4d8d('0x38')]=qs[_0x4d8d('0x38')](_0x61357[_0x4d8d('0x30')]['limit']);_0x76af14[_0x4d8d('0x1c')]=qs[_0x4d8d('0x1c')](_0x61357[_0x4d8d('0x30')][_0x4d8d('0x1c')]);}_0x76af14[_0x4d8d('0x39')]=qs[_0x4d8d('0x3a')](_0x61357[_0x4d8d('0x30')][_0x4d8d('0x3a')]);_0x76af14[_0x4d8d('0x3b')]=qs[_0x4d8d('0x3c')](_[_0x4d8d('0x3d')](_0x61357['query'],_0x138a7f[_0x4d8d('0x3c')]),_0x48679b);if(_0x61357[_0x4d8d('0x30')]['filter']){_0x76af14[_0x4d8d('0x3b')]=_[_0x4d8d('0x3e')](_0x76af14[_0x4d8d('0x3b')],{'$or':_['map'](_0x48679b,function(_0x3caecb){if(_0x3caecb[_0x4d8d('0x3f')]!==_0x4d8d('0x40')){var _0x534b71={};_0x534b71[_0x3caecb['name']]={'$like':'%'+_0x61357[_0x4d8d('0x30')]['filter']+'%'};return _0x534b71;}})});}_0x76af14=_['merge']({},_0x76af14,_0x61357[_0x4d8d('0x41')]);var _0x2091f0={'where':_0x76af14[_0x4d8d('0x3b')]};return db['JscriptyQuestionReport']['count'](_0x2091f0)[_0x4d8d('0x23')](function(_0x29a22e){_0x5e21fa[_0x4d8d('0x1e')]=_0x29a22e;if(_0x61357[_0x4d8d('0x30')][_0x4d8d('0x42')]){_0x76af14[_0x4d8d('0x43')]=[{'all':!![]}];}return db[_0x4d8d('0x2b')][_0x4d8d('0x44')](_0x76af14);})[_0x4d8d('0x23')](function(_0x59c997){_0x5e21fa[_0x4d8d('0x45')]=_0x59c997;return _0x5e21fa;})[_0x4d8d('0x23')](respondWithFilteredResult(_0x5be139,_0x76af14))[_0x4d8d('0x46')](handleError(_0x5be139,null));};exports[_0x4d8d('0x47')]=function(_0x4312c6,_0x33a60f){var _0x46d715={'raw':!![],'where':{'id':_0x4312c6[_0x4d8d('0x48')]['id']}},_0x2260bd={};_0x2260bd[_0x4d8d('0x2f')]=_[_0x4d8d('0x31')](db[_0x4d8d('0x2b')]['rawAttributes']);_0x2260bd[_0x4d8d('0x30')]=_[_0x4d8d('0x31')](_0x4312c6[_0x4d8d('0x30')]);_0x2260bd[_0x4d8d('0x3c')]=_['intersection'](_0x2260bd[_0x4d8d('0x2f')],_0x2260bd[_0x4d8d('0x30')]);_0x46d715[_0x4d8d('0x33')]=_[_0x4d8d('0x32')](_0x2260bd[_0x4d8d('0x2f')],qs[_0x4d8d('0x34')](_0x4312c6['query'][_0x4d8d('0x34')]));_0x46d715[_0x4d8d('0x33')]=_0x46d715[_0x4d8d('0x33')]['length']?_0x46d715[_0x4d8d('0x33')]:_0x2260bd[_0x4d8d('0x2f')];if(_0x4312c6[_0x4d8d('0x30')][_0x4d8d('0x42')]){_0x46d715['include']=[{'all':!![]}];}_0x46d715=_[_0x4d8d('0x3e')]({},_0x46d715,_0x4312c6[_0x4d8d('0x41')]);return db[_0x4d8d('0x2b')][_0x4d8d('0x49')](_0x46d715)[_0x4d8d('0x23')](handleEntityNotFound(_0x33a60f,null))[_0x4d8d('0x23')](respondWithResult(_0x33a60f,null))['catch'](handleError(_0x33a60f,null));};exports[_0x4d8d('0x4a')]=function(_0x5d5573,_0xf288f9){return db[_0x4d8d('0x2b')][_0x4d8d('0x4a')](_0x5d5573[_0x4d8d('0x4b')],{})[_0x4d8d('0x23')](respondWithResult(_0xf288f9,0xc9))['catch'](handleError(_0xf288f9,null));};exports[_0x4d8d('0x4c')]=function(_0x5961ad,_0x106139){if(_0x5961ad[_0x4d8d('0x4b')]['id']){delete _0x5961ad[_0x4d8d('0x4b')]['id'];}return db[_0x4d8d('0x2b')]['find']({'where':{'id':_0x5961ad[_0x4d8d('0x48')]['id']}})[_0x4d8d('0x23')](handleEntityNotFound(_0x106139,null))[_0x4d8d('0x23')](saveUpdates(_0x5961ad['body'],null))[_0x4d8d('0x23')](respondWithResult(_0x106139,null))['catch'](handleError(_0x106139,null));};exports['destroy']=function(_0x8d3e65,_0x36e813){return db[_0x4d8d('0x2b')][_0x4d8d('0x49')]({'where':{'id':_0x8d3e65[_0x4d8d('0x48')]['id']}})[_0x4d8d('0x23')](handleEntityNotFound(_0x36e813,null))[_0x4d8d('0x23')](removeEntity(_0x36e813,null))[_0x4d8d('0x46')](handleError(_0x36e813,null));};exports[_0x4d8d('0x4d')]=function(_0x4f4735,_0xaff58d){return db['JscriptyQuestionReport'][_0x4d8d('0x4d')]()[_0x4d8d('0x23')](respondWithResult(_0xaff58d,null))[_0x4d8d('0x46')](handleError(_0xaff58d,null));}; \ No newline at end of file +var _0x9c7d=['path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','update','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','then','includeAll','include','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x11c7bc,_0x5a7b4c){var _0x1289df=function(_0x3d8c94){while(--_0x3d8c94){_0x11c7bc['push'](_0x11c7bc['shift']());}};_0x1289df(++_0x5a7b4c);}(_0x9c7d,0x1ba));var _0xd9c7=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x9c7d[_0x3598bb];return _0x13c837;};'use strict';var emlformat=require(_0xd9c7('0x0'));var rimraf=require(_0xd9c7('0x1'));var zipdir=require(_0xd9c7('0x2'));var jsonpatch=require(_0xd9c7('0x3'));var rp=require(_0xd9c7('0x4'));var moment=require(_0xd9c7('0x5'));var BPromise=require(_0xd9c7('0x6'));var Mustache=require(_0xd9c7('0x7'));var util=require('util');var path=require(_0xd9c7('0x8'));var sox=require(_0xd9c7('0x9'));var csv=require(_0xd9c7('0xa'));var ejs=require(_0xd9c7('0xb'));var fs=require('fs');var fs_extra=require(_0xd9c7('0xc'));var _=require('lodash');var squel=require(_0xd9c7('0xd'));var crypto=require('crypto');var jsforce=require(_0xd9c7('0xe'));var deskjs=require(_0xd9c7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9c7('0x10'));var Papa=require(_0xd9c7('0x11'));var Redis=require(_0xd9c7('0x12'));var authService=require(_0xd9c7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd9c7('0x14'));var hardwareService=require(_0xd9c7('0x15'));var logger=require(_0xd9c7('0x16'))(_0xd9c7('0x17'));var utils=require(_0xd9c7('0x18'));var config=require(_0xd9c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd9c7('0x1a'))['db'];function respondWithStatusCode(_0x223717,_0x377fd0){_0x377fd0=_0x377fd0||0xcc;return function(_0x1e4842){if(_0x1e4842){return _0x223717[_0xd9c7('0x1b')](_0x377fd0);}return _0x223717['status'](_0x377fd0)[_0xd9c7('0x1c')]();};}function respondWithResult(_0x3fc465,_0x5cff1f){_0x5cff1f=_0x5cff1f||0xc8;return function(_0x518b40){if(_0x518b40){return _0x3fc465[_0xd9c7('0x1d')](_0x5cff1f)['json'](_0x518b40);}};}function respondWithFilteredResult(_0x526889,_0x359241){return function(_0x169e91){if(_0x169e91){var _0x2a4650=typeof _0x359241[_0xd9c7('0x1e')]===_0xd9c7('0x1f')&&typeof _0x359241[_0xd9c7('0x20')]==='undefined';var _0x2a209a=_0x169e91[_0xd9c7('0x21')];var _0x490350=_0x2a4650?0x0:_0x359241[_0xd9c7('0x1e')];var _0x28700b=_0x2a4650?_0x169e91[_0xd9c7('0x21')]:_0x359241[_0xd9c7('0x1e')]+_0x359241['limit'];var _0x46cd84;if(_0x28700b>=_0x2a209a){_0x28700b=_0x2a209a;_0x46cd84=0xc8;}else{_0x46cd84=0xce;}_0x526889[_0xd9c7('0x1d')](_0x46cd84);return _0x526889[_0xd9c7('0x22')]('Content-Range',_0x490350+'-'+_0x28700b+'/'+_0x2a209a)['json'](_0x169e91);}return null;};}function patchUpdates(_0x1b773b){return function(_0xc45e89){try{jsonpatch['apply'](_0xc45e89,_0x1b773b,!![]);}catch(_0x38cd8d){return BPromise['reject'](_0x38cd8d);}return _0xc45e89['save']();};}function saveUpdates(_0x3ed0ba,_0x480759){return function(_0x7d4146){if(_0x7d4146){return _0x7d4146[_0xd9c7('0x23')](_0x3ed0ba)['then'](function(_0x511e77){return _0x511e77;});}return null;};}function removeEntity(_0xe6eba4,_0x12b7b3){return function(_0x34daa5){if(_0x34daa5){return _0x34daa5[_0xd9c7('0x24')]()['then'](function(){_0xe6eba4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x291a60,_0x45ebb8){return function(_0x116ba4){if(!_0x116ba4){_0x291a60[_0xd9c7('0x1b')](0x194);}return _0x116ba4;};}function handleError(_0x15886a,_0x4a3796){_0x4a3796=_0x4a3796||0x1f4;return function(_0x24c28a){logger[_0xd9c7('0x25')](_0x24c28a[_0xd9c7('0x26')]);if(_0x24c28a[_0xd9c7('0x27')]){delete _0x24c28a[_0xd9c7('0x27')];}_0x15886a[_0xd9c7('0x1d')](_0x4a3796)[_0xd9c7('0x28')](_0x24c28a);};}exports[_0xd9c7('0x29')]=function(_0x561d8d,_0x35d66a){var _0x2fe1b9={},_0x509764={},_0x4d6d94={'count':0x0,'rows':[]};var _0x286a54=_[_0xd9c7('0x2a')](db[_0xd9c7('0x2b')][_0xd9c7('0x2c')],function(_0x442322){return{'name':_0x442322['fieldName'],'type':_0x442322[_0xd9c7('0x2d')][_0xd9c7('0x2e')]};});_0x509764['model']=_[_0xd9c7('0x2a')](_0x286a54,_0xd9c7('0x27'));_0x509764[_0xd9c7('0x2f')]=_['keys'](_0x561d8d[_0xd9c7('0x2f')]);_0x509764['filters']=_[_0xd9c7('0x30')](_0x509764[_0xd9c7('0x31')],_0x509764[_0xd9c7('0x2f')]);_0x2fe1b9['attributes']=_[_0xd9c7('0x30')](_0x509764['model'],qs[_0xd9c7('0x32')](_0x561d8d['query'][_0xd9c7('0x32')]));_0x2fe1b9[_0xd9c7('0x33')]=_0x2fe1b9[_0xd9c7('0x33')][_0xd9c7('0x34')]?_0x2fe1b9[_0xd9c7('0x33')]:_0x509764[_0xd9c7('0x31')];if(!_0x561d8d[_0xd9c7('0x2f')][_0xd9c7('0x35')](_0xd9c7('0x36'))){_0x2fe1b9['limit']=qs[_0xd9c7('0x20')](_0x561d8d[_0xd9c7('0x2f')][_0xd9c7('0x20')]);_0x2fe1b9[_0xd9c7('0x1e')]=qs[_0xd9c7('0x1e')](_0x561d8d[_0xd9c7('0x2f')][_0xd9c7('0x1e')]);}_0x2fe1b9[_0xd9c7('0x37')]=qs[_0xd9c7('0x38')](_0x561d8d['query'][_0xd9c7('0x38')]);_0x2fe1b9[_0xd9c7('0x39')]=qs[_0xd9c7('0x3a')](_[_0xd9c7('0x3b')](_0x561d8d[_0xd9c7('0x2f')],_0x509764[_0xd9c7('0x3a')]),_0x286a54);if(_0x561d8d['query'][_0xd9c7('0x3c')]){_0x2fe1b9[_0xd9c7('0x39')]=_['merge'](_0x2fe1b9['where'],{'$or':_['map'](_0x286a54,function(_0x15445f){if(_0x15445f[_0xd9c7('0x2d')]!=='VIRTUAL'){var _0x7c9c06={};_0x7c9c06[_0x15445f[_0xd9c7('0x27')]]={'$like':'%'+_0x561d8d['query'][_0xd9c7('0x3c')]+'%'};return _0x7c9c06;}})});}_0x2fe1b9=_[_0xd9c7('0x3d')]({},_0x2fe1b9,_0x561d8d[_0xd9c7('0x3e')]);var _0x29a387={'where':_0x2fe1b9['where']};return db['JscriptyQuestionReport']['count'](_0x29a387)[_0xd9c7('0x3f')](function(_0xbdce5d){_0x4d6d94[_0xd9c7('0x21')]=_0xbdce5d;if(_0x561d8d[_0xd9c7('0x2f')][_0xd9c7('0x40')]){_0x2fe1b9[_0xd9c7('0x41')]=[{'all':!![]}];}return db[_0xd9c7('0x2b')]['findAll'](_0x2fe1b9);})[_0xd9c7('0x3f')](function(_0x46a344){_0x4d6d94[_0xd9c7('0x42')]=_0x46a344;return _0x4d6d94;})[_0xd9c7('0x3f')](respondWithFilteredResult(_0x35d66a,_0x2fe1b9))['catch'](handleError(_0x35d66a,null));};exports[_0xd9c7('0x43')]=function(_0x1ef233,_0x5a8e4f){var _0x82b642={'raw':!![],'where':{'id':_0x1ef233[_0xd9c7('0x44')]['id']}},_0x4406da={};_0x4406da[_0xd9c7('0x31')]=_[_0xd9c7('0x45')](db[_0xd9c7('0x2b')][_0xd9c7('0x2c')]);_0x4406da['query']=_[_0xd9c7('0x45')](_0x1ef233[_0xd9c7('0x2f')]);_0x4406da[_0xd9c7('0x3a')]=_[_0xd9c7('0x30')](_0x4406da[_0xd9c7('0x31')],_0x4406da[_0xd9c7('0x2f')]);_0x82b642['attributes']=_[_0xd9c7('0x30')](_0x4406da[_0xd9c7('0x31')],qs[_0xd9c7('0x32')](_0x1ef233[_0xd9c7('0x2f')][_0xd9c7('0x32')]));_0x82b642[_0xd9c7('0x33')]=_0x82b642[_0xd9c7('0x33')][_0xd9c7('0x34')]?_0x82b642[_0xd9c7('0x33')]:_0x4406da[_0xd9c7('0x31')];if(_0x1ef233['query'][_0xd9c7('0x40')]){_0x82b642['include']=[{'all':!![]}];}_0x82b642=_[_0xd9c7('0x3d')]({},_0x82b642,_0x1ef233[_0xd9c7('0x3e')]);return db[_0xd9c7('0x2b')]['find'](_0x82b642)['then'](handleEntityNotFound(_0x5a8e4f,null))[_0xd9c7('0x3f')](respondWithResult(_0x5a8e4f,null))[_0xd9c7('0x46')](handleError(_0x5a8e4f,null));};exports['create']=function(_0x4157f7,_0x108dc6){return db[_0xd9c7('0x2b')][_0xd9c7('0x47')](_0x4157f7[_0xd9c7('0x48')],{})[_0xd9c7('0x3f')](respondWithResult(_0x108dc6,0xc9))[_0xd9c7('0x46')](handleError(_0x108dc6,null));};exports[_0xd9c7('0x23')]=function(_0x1c6dec,_0xaaf519){if(_0x1c6dec[_0xd9c7('0x48')]['id']){delete _0x1c6dec[_0xd9c7('0x48')]['id'];}return db['JscriptyQuestionReport'][_0xd9c7('0x49')]({'where':{'id':_0x1c6dec[_0xd9c7('0x44')]['id']}})[_0xd9c7('0x3f')](handleEntityNotFound(_0xaaf519,null))[_0xd9c7('0x3f')](saveUpdates(_0x1c6dec[_0xd9c7('0x48')],null))['then'](respondWithResult(_0xaaf519,null))[_0xd9c7('0x46')](handleError(_0xaaf519,null));};exports[_0xd9c7('0x24')]=function(_0xd55bee,_0x3f9c17){return db[_0xd9c7('0x2b')]['find']({'where':{'id':_0xd55bee['params']['id']}})[_0xd9c7('0x3f')](handleEntityNotFound(_0x3f9c17,null))[_0xd9c7('0x3f')](removeEntity(_0x3f9c17,null))[_0xd9c7('0x46')](handleError(_0x3f9c17,null));};exports[_0xd9c7('0x4a')]=function(_0x47e5d5,_0x5c44b1){return db['JscriptyQuestionReport'][_0xd9c7('0x4a')]()[_0xd9c7('0x3f')](respondWithResult(_0x5c44b1,null))[_0xd9c7('0x46')](handleError(_0x5c44b1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 2fb7d63..0db7fc6 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacba=['rimraf','../../config/environment','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x382dad,_0x361da9){var _0x376264=function(_0x6bfb5c){while(--_0x6bfb5c){_0x382dad['push'](_0x382dad['shift']());}};_0x376264(++_0x361da9);}(_0xacba,0x108));var _0xaacb=function(_0x34ff8a,_0x3c83f7){_0x34ff8a=_0x34ff8a-0x0;var _0x2ffa0b=_0xacba[_0x34ff8a];return _0x2ffa0b;};'use strict';var _=require(_0xaacb('0x0'));var util=require(_0xaacb('0x1'));var logger=require(_0xaacb('0x2'))(_0xaacb('0x3'));var moment=require('moment');var BPromise=require(_0xaacb('0x4'));var rp=require(_0xaacb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaacb('0x6'));var config=require(_0xaacb('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x456950,_0x548f81){return _0x456950[_0xaacb('0x8')](_0xaacb('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4542=['../../config/logger','api','moment','bluebird','request-promise','define','JscriptyQuestionReport','lodash','util'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0x4542,0x1ed));var _0x2454=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4542[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x2454('0x0'));var util=require(_0x2454('0x1'));var logger=require(_0x2454('0x2'))(_0x2454('0x3'));var moment=require(_0x2454('0x4'));var BPromise=require(_0x2454('0x5'));var rp=require(_0x2454('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x11f79d,_0x2ace79){return _0x11f79d[_0x2454('0x7')](_0x2454('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 068640e..e78657a 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bf8=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug'];(function(_0x17838b,_0xf0ca50){var _0x3afe44=function(_0x8011e9){while(--_0x8011e9){_0x17838b['push'](_0x17838b['shift']());}};_0x3afe44(++_0xf0ca50);}(_0x1bf8,0x132));var _0x81bf=function(_0x10a5a3,_0x2c8d71){_0x10a5a3=_0x10a5a3-0x0;var _0x8425e3=_0x1bf8[_0x10a5a3];return _0x8425e3;};'use strict';var _=require(_0x81bf('0x0'));var util=require('util');var moment=require(_0x81bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x81bf('0x2'));var fs=require('fs');var Redis=require(_0x81bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x81bf('0x4'));var logger=require(_0x81bf('0x5'))(_0x81bf('0x6'));var config=require(_0x81bf('0x7'));var jayson=require(_0x81bf('0x8'));var client=jayson[_0x81bf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b9e1,_0x2b338b,_0x1ca5d9){return new BPromise(function(_0x585832,_0x3b60ae){return client[_0x81bf('0xa')](_0x22b9e1,_0x1ca5d9)['then'](function(_0x29905d){logger[_0x81bf('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2b338b,_0x81bf('0xc'));logger[_0x81bf('0xd')](_0x81bf('0xe'),_0x2b338b,_0x81bf('0xc'),JSON[_0x81bf('0xf')](_0x29905d));if(_0x29905d[_0x81bf('0x10')]){if(_0x29905d[_0x81bf('0x10')]['code']===0x1f4){logger['error'](_0x81bf('0x11'),_0x2b338b,_0x29905d[_0x81bf('0x10')][_0x81bf('0x12')]);return _0x3b60ae(_0x29905d['error'][_0x81bf('0x12')]);}logger[_0x81bf('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2b338b,_0x29905d[_0x81bf('0x10')]['message']);return _0x585832(_0x29905d[_0x81bf('0x10')][_0x81bf('0x12')]);}else{logger[_0x81bf('0xb')](_0x81bf('0x11'),_0x2b338b,_0x81bf('0xc'));_0x585832(_0x29905d[_0x81bf('0x13')][_0x81bf('0x12')]);}})['catch'](function(_0x5baf59){logger[_0x81bf('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2b338b,_0x5baf59);_0x3b60ae(_0x5baf59);});});} \ No newline at end of file +var _0x81a8=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x81a8,0xef));var _0x881a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x81a8[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x881a('0x0'));var util=require(_0x881a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x881a('0x2'));var fs=require('fs');var Redis=require(_0x881a('0x3'));var db=require(_0x881a('0x4'))['db'];var utils=require(_0x881a('0x5'));var logger=require(_0x881a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x881a('0x7'));var client=jayson[_0x881a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9505,_0x362e60,_0x1a8776){return new BPromise(function(_0x259202,_0x4257e6){return client[_0x881a('0x9')](_0x1b9505,_0x1a8776)[_0x881a('0xa')](function(_0x37ad08){logger[_0x881a('0xb')](_0x881a('0xc'),_0x362e60,_0x881a('0xd'));logger[_0x881a('0xe')](_0x881a('0xf'),_0x362e60,_0x881a('0xd'),JSON['stringify'](_0x37ad08));if(_0x37ad08[_0x881a('0x10')]){if(_0x37ad08[_0x881a('0x10')][_0x881a('0x11')]===0x1f4){logger['error'](_0x881a('0xc'),_0x362e60,_0x37ad08[_0x881a('0x10')][_0x881a('0x12')]);return _0x4257e6(_0x37ad08[_0x881a('0x10')][_0x881a('0x12')]);}logger[_0x881a('0x10')](_0x881a('0xc'),_0x362e60,_0x37ad08[_0x881a('0x10')][_0x881a('0x12')]);return _0x259202(_0x37ad08[_0x881a('0x10')][_0x881a('0x12')]);}else{logger[_0x881a('0xb')](_0x881a('0xc'),_0x362e60,'request\x20sent');_0x259202(_0x37ad08[_0x881a('0x13')][_0x881a('0x12')]);}})[_0x881a('0x14')](function(_0x49b7ae){logger[_0x881a('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x362e60,_0x49b7ae);_0x4257e6(_0x49b7ae);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1b6391f..67af195 100644 --- a/server/api/jscriptySessionReport/index.js +++ b/server/api/jscriptySessionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5369=['util','connect-timeout','express','./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','multer'];(function(_0x330a9e,_0x3eb7b4){var _0x43c7c4=function(_0x564bb3){while(--_0x564bb3){_0x330a9e['push'](_0x330a9e['shift']());}};_0x43c7c4(++_0x3eb7b4);}(_0x5369,0xc7));var _0x9536=function(_0x2a131f,_0x201e8f){_0x2a131f=_0x2a131f-0x0;var _0x1090e5=_0x5369[_0x2a131f];return _0x1090e5;};'use strict';var multer=require(_0x9536('0x0'));var util=require(_0x9536('0x1'));var path=require('path');var timeout=require(_0x9536('0x2'));var express=require(_0x9536('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9536('0x4'));router['get']('/',auth[_0x9536('0x5')](),controller[_0x9536('0x6')]);router['get'](_0x9536('0x7'),auth[_0x9536('0x5')](),controller[_0x9536('0x8')]);router[_0x9536('0x9')](_0x9536('0xa'),auth[_0x9536('0x5')](),controller[_0x9536('0xb')]);router['get'](_0x9536('0xc'),auth[_0x9536('0x5')](),controller[_0x9536('0xd')]);router[_0x9536('0xe')]('/',auth[_0x9536('0x5')](),controller[_0x9536('0xf')]);router[_0x9536('0x10')](_0x9536('0xa'),auth[_0x9536('0x5')](),controller[_0x9536('0x11')]);router[_0x9536('0x12')](_0x9536('0xa'),auth[_0x9536('0x5')](),controller[_0x9536('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3859=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','getQuestions','post','create','put'];(function(_0x536c27,_0x44ebc4){var _0x26159d=function(_0x3dd5c6){while(--_0x3dd5c6){_0x536c27['push'](_0x536c27['shift']());}};_0x26159d(++_0x44ebc4);}(_0x3859,0x149));var _0x9385=function(_0x164ba9,_0x1f6de0){_0x164ba9=_0x164ba9-0x0;var _0x866176=_0x3859[_0x164ba9];return _0x866176;};'use strict';var multer=require(_0x9385('0x0'));var util=require(_0x9385('0x1'));var path=require(_0x9385('0x2'));var timeout=require(_0x9385('0x3'));var express=require(_0x9385('0x4'));var router=express[_0x9385('0x5')]();var fs_extra=require(_0x9385('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9385('0x7'));var config=require(_0x9385('0x8'));var controller=require(_0x9385('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9385('0xa')]);router[_0x9385('0xb')](_0x9385('0xc'),auth['isAuthenticated'](),controller[_0x9385('0xd')]);router[_0x9385('0xb')](_0x9385('0xe'),auth[_0x9385('0xf')](),controller[_0x9385('0x10')]);router[_0x9385('0xb')]('/:id/questions',auth[_0x9385('0xf')](),controller[_0x9385('0x11')]);router[_0x9385('0x12')]('/',auth[_0x9385('0xf')](),controller[_0x9385('0x13')]);router[_0x9385('0x14')](_0x9385('0xe'),auth[_0x9385('0xf')](),controller[_0x9385('0x15')]);router[_0x9385('0x16')](_0x9385('0xe'),auth[_0x9385('0xf')](),controller[_0x9385('0x17')]);module[_0x9385('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 8883f6b..0e08a3a 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc18=['BOOLEAN','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x3fe1d2,_0x44b2ae){var _0x25ecd5=function(_0x6dae23){while(--_0x6dae23){_0x3fe1d2['push'](_0x3fe1d2['shift']());}};_0x25ecd5(++_0x44b2ae);}(_0xbc18,0x169));var _0x8bc1=function(_0x15ad3f,_0x1d6280){_0x15ad3f=_0x15ad3f-0x0;var _0xfb1d10=_0xbc18[_0x15ad3f];return _0xfb1d10;};'use strict';var moment=require('moment');var Sequelize=require(_0x8bc1('0x0'));module[_0x8bc1('0x1')]={'starttime':{'type':Sequelize[_0x8bc1('0x2')],'set':function(_0x403faa){this[_0x8bc1('0x3')](_0x8bc1('0x4'),_0x403faa);this['setDataValue'](_0x8bc1('0x5'),moment()[_0x8bc1('0x6')](_0x8bc1('0x7')));}},'endtime':{'type':Sequelize[_0x8bc1('0x2')]},'membername':{'type':Sequelize[_0x8bc1('0x8')]},'projectname':{'type':Sequelize[_0x8bc1('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8bc1('0x8')]},'calleridname':{'type':Sequelize[_0x8bc1('0x8')]},'calleridnum':{'type':Sequelize[_0x8bc1('0x8')]},'completed':{'type':Sequelize[_0x8bc1('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xe814=['endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','starttime','setDataValue'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0xe814,0x15c));var _0x4e81=function(_0x57a65a,_0x361678){_0x57a65a=_0x57a65a-0x0;var _0x58416f=_0xe814[_0x57a65a];return _0x58416f;};'use strict';var moment=require('moment');var Sequelize=require(_0x4e81('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x4e81('0x1')],'set':function(_0x4f7c52){this['setDataValue'](_0x4e81('0x2'),_0x4f7c52);this[_0x4e81('0x3')](_0x4e81('0x4'),moment()['format'](_0x4e81('0x5')));}},'endtime':{'type':Sequelize[_0x4e81('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4e81('0x6')]},'uniqueid':{'type':Sequelize[_0x4e81('0x6')]},'calleridname':{'type':Sequelize[_0x4e81('0x6')]},'calleridnum':{'type':Sequelize[_0x4e81('0x6')]},'completed':{'type':Sequelize[_0x4e81('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ae94531..2995582 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ac7=['limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','catch','length','find','create','body','params','describe','hasOwnProperty','SessionId','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x516770,_0xb9ffc8){var _0x5008f8=function(_0x1a5191){while(--_0x1a5191){_0x516770['push'](_0x516770['shift']());}};_0x5008f8(++_0xb9ffc8);}(_0x0ac7,0x11c));var _0x70ac=function(_0x5bd78c,_0x1a3756){_0x5bd78c=_0x5bd78c-0x0;var _0x56bcf4=_0x0ac7[_0x5bd78c];return _0x56bcf4;};'use strict';var emlformat=require(_0x70ac('0x0'));var rimraf=require(_0x70ac('0x1'));var zipdir=require(_0x70ac('0x2'));var jsonpatch=require(_0x70ac('0x3'));var rp=require(_0x70ac('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x70ac('0x5'));var util=require(_0x70ac('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x70ac('0x7'));var ejs=require(_0x70ac('0x8'));var fs=require('fs');var fs_extra=require(_0x70ac('0x9'));var _=require(_0x70ac('0xa'));var squel=require('squel');var crypto=require(_0x70ac('0xb'));var jsforce=require(_0x70ac('0xc'));var deskjs=require(_0x70ac('0xd'));var toCsv=require(_0x70ac('0x7'));var querystring=require(_0x70ac('0xe'));var Papa=require(_0x70ac('0xf'));var Redis=require(_0x70ac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x70ac('0x11'));var as=require(_0x70ac('0x12'));var hardwareService=require(_0x70ac('0x13'));var logger=require(_0x70ac('0x14'))(_0x70ac('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70ac('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a1498,_0x5e1dec){_0x5e1dec=_0x5e1dec||0xcc;return function(_0x9baecc){if(_0x9baecc){return _0x2a1498[_0x70ac('0x17')](_0x5e1dec);}return _0x2a1498[_0x70ac('0x18')](_0x5e1dec)['end']();};}function respondWithResult(_0x286b8b,_0x14569f){_0x14569f=_0x14569f||0xc8;return function(_0x51c8e9){if(_0x51c8e9){return _0x286b8b[_0x70ac('0x18')](_0x14569f)[_0x70ac('0x19')](_0x51c8e9);}};}function respondWithFilteredResult(_0x2a33b4,_0x4cdec7){return function(_0x1f7149){if(_0x1f7149){var _0x4290c1=typeof _0x4cdec7[_0x70ac('0x1a')]===_0x70ac('0x1b')&&typeof _0x4cdec7[_0x70ac('0x1c')]===_0x70ac('0x1b');var _0x3ab5a9=_0x1f7149[_0x70ac('0x1d')];var _0x1c8148=_0x4290c1?0x0:_0x4cdec7['offset'];var _0x3f0da3=_0x4290c1?_0x1f7149[_0x70ac('0x1d')]:_0x4cdec7['offset']+_0x4cdec7[_0x70ac('0x1c')];var _0x387bf2;if(_0x3f0da3>=_0x3ab5a9){_0x3f0da3=_0x3ab5a9;_0x387bf2=0xc8;}else{_0x387bf2=0xce;}_0x2a33b4['status'](_0x387bf2);return _0x2a33b4[_0x70ac('0x1e')](_0x70ac('0x1f'),_0x1c8148+'-'+_0x3f0da3+'/'+_0x3ab5a9)['json'](_0x1f7149);}return null;};}function patchUpdates(_0x494c6e){return function(_0x5a3ce8){try{jsonpatch[_0x70ac('0x20')](_0x5a3ce8,_0x494c6e,!![]);}catch(_0x39fd72){return BPromise[_0x70ac('0x21')](_0x39fd72);}return _0x5a3ce8[_0x70ac('0x22')]();};}function saveUpdates(_0x121573,_0x5b6011){return function(_0x2424de){if(_0x2424de){return _0x2424de[_0x70ac('0x23')](_0x121573)['then'](function(_0x3a5fdf){return _0x3a5fdf;});}return null;};}function removeEntity(_0x38b193,_0x2c9891){return function(_0x3153be){if(_0x3153be){return _0x3153be[_0x70ac('0x24')]()[_0x70ac('0x25')](function(){_0x38b193['status'](0xcc)[_0x70ac('0x26')]();});}};}function handleEntityNotFound(_0x288979,_0x84e2c3){return function(_0x24dfc2){if(!_0x24dfc2){_0x288979[_0x70ac('0x17')](0x194);}return _0x24dfc2;};}function handleError(_0x2a3d08,_0x55c13e){_0x55c13e=_0x55c13e||0x1f4;return function(_0x3e92cb){logger[_0x70ac('0x27')](_0x3e92cb[_0x70ac('0x28')]);if(_0x3e92cb[_0x70ac('0x29')]){delete _0x3e92cb['name'];}_0x2a3d08[_0x70ac('0x18')](_0x55c13e)[_0x70ac('0x2a')](_0x3e92cb);};}exports['index']=function(_0x2fde4a,_0x2e4fa2){var _0x29048c={},_0x7aea5b={},_0x56883b={'count':0x0,'rows':[]};var _0x262f47=_['map'](db[_0x70ac('0x2b')][_0x70ac('0x2c')],function(_0x2191a3){return{'name':_0x2191a3[_0x70ac('0x2d')],'type':_0x2191a3[_0x70ac('0x2e')][_0x70ac('0x2f')]};});_0x7aea5b[_0x70ac('0x30')]=_[_0x70ac('0x31')](_0x262f47,'name');_0x7aea5b[_0x70ac('0x32')]=_[_0x70ac('0x33')](_0x2fde4a['query']);_0x7aea5b[_0x70ac('0x34')]=_[_0x70ac('0x35')](_0x7aea5b[_0x70ac('0x30')],_0x7aea5b[_0x70ac('0x32')]);_0x29048c[_0x70ac('0x36')]=_['intersection'](_0x7aea5b[_0x70ac('0x30')],qs[_0x70ac('0x37')](_0x2fde4a['query']['fields']));_0x29048c['attributes']=_0x29048c['attributes']['length']?_0x29048c[_0x70ac('0x36')]:_0x7aea5b[_0x70ac('0x30')];if(!_0x2fde4a[_0x70ac('0x32')]['hasOwnProperty'](_0x70ac('0x38'))){_0x29048c[_0x70ac('0x1c')]=qs[_0x70ac('0x1c')](_0x2fde4a[_0x70ac('0x32')][_0x70ac('0x1c')]);_0x29048c[_0x70ac('0x1a')]=qs['offset'](_0x2fde4a[_0x70ac('0x32')][_0x70ac('0x1a')]);}_0x29048c[_0x70ac('0x39')]=qs[_0x70ac('0x3a')](_0x2fde4a['query'][_0x70ac('0x3a')]);_0x29048c['where']=qs[_0x70ac('0x34')](_[_0x70ac('0x3b')](_0x2fde4a['query'],_0x7aea5b[_0x70ac('0x34')]),_0x262f47);if(_0x2fde4a[_0x70ac('0x32')][_0x70ac('0x3c')]){_0x29048c[_0x70ac('0x3d')]=_['merge'](_0x29048c[_0x70ac('0x3d')],{'$or':_[_0x70ac('0x31')](_0x262f47,function(_0x1209f9){if(_0x1209f9[_0x70ac('0x2e')]!==_0x70ac('0x3e')){var _0x151c66={};_0x151c66[_0x1209f9['name']]={'$like':'%'+_0x2fde4a[_0x70ac('0x32')][_0x70ac('0x3c')]+'%'};return _0x151c66;}})});}_0x29048c=_[_0x70ac('0x3f')]({},_0x29048c,_0x2fde4a[_0x70ac('0x40')]);var _0x565aab={'where':_0x29048c[_0x70ac('0x3d')]};return db[_0x70ac('0x2b')]['count'](_0x565aab)[_0x70ac('0x25')](function(_0x259d9a){_0x56883b[_0x70ac('0x1d')]=_0x259d9a;if(_0x2fde4a[_0x70ac('0x32')][_0x70ac('0x41')]){_0x29048c[_0x70ac('0x42')]=[{'all':!![]}];}return db[_0x70ac('0x2b')]['findAll'](_0x29048c);})[_0x70ac('0x25')](function(_0x854512){_0x56883b['rows']=_0x854512;return _0x56883b;})[_0x70ac('0x25')](respondWithFilteredResult(_0x2e4fa2,_0x29048c))[_0x70ac('0x43')](handleError(_0x2e4fa2,null));};exports['show']=function(_0x369734,_0x38405e){var _0x4fada9={'raw':!![],'where':{'id':_0x369734['params']['id']}},_0x4aede2={};_0x4aede2[_0x70ac('0x30')]=_[_0x70ac('0x33')](db[_0x70ac('0x2b')][_0x70ac('0x2c')]);_0x4aede2[_0x70ac('0x32')]=_['keys'](_0x369734['query']);_0x4aede2[_0x70ac('0x34')]=_[_0x70ac('0x35')](_0x4aede2[_0x70ac('0x30')],_0x4aede2[_0x70ac('0x32')]);_0x4fada9['attributes']=_['intersection'](_0x4aede2[_0x70ac('0x30')],qs[_0x70ac('0x37')](_0x369734[_0x70ac('0x32')]['fields']));_0x4fada9[_0x70ac('0x36')]=_0x4fada9[_0x70ac('0x36')][_0x70ac('0x44')]?_0x4fada9[_0x70ac('0x36')]:_0x4aede2[_0x70ac('0x30')];if(_0x369734[_0x70ac('0x32')][_0x70ac('0x41')]){_0x4fada9[_0x70ac('0x42')]=[{'all':!![]}];}_0x4fada9=_[_0x70ac('0x3f')]({},_0x4fada9,_0x369734[_0x70ac('0x40')]);return db[_0x70ac('0x2b')][_0x70ac('0x45')](_0x4fada9)[_0x70ac('0x25')](handleEntityNotFound(_0x38405e,null))[_0x70ac('0x25')](respondWithResult(_0x38405e,null))['catch'](handleError(_0x38405e,null));};exports[_0x70ac('0x46')]=function(_0x59d668,_0x2c0f0a){return db['JscriptySessionReport'][_0x70ac('0x46')](_0x59d668[_0x70ac('0x47')],{})['then'](respondWithResult(_0x2c0f0a,0xc9))['catch'](handleError(_0x2c0f0a,null));};exports['update']=function(_0x40ac31,_0x3cc0a4){if(_0x40ac31[_0x70ac('0x47')]['id']){delete _0x40ac31[_0x70ac('0x47')]['id'];}return db['JscriptySessionReport'][_0x70ac('0x45')]({'where':{'id':_0x40ac31['params']['id']}})[_0x70ac('0x25')](handleEntityNotFound(_0x3cc0a4,null))[_0x70ac('0x25')](saveUpdates(_0x40ac31['body'],null))[_0x70ac('0x25')](respondWithResult(_0x3cc0a4,null))[_0x70ac('0x43')](handleError(_0x3cc0a4,null));};exports[_0x70ac('0x24')]=function(_0x30a7ad,_0x193f13){return db[_0x70ac('0x2b')]['find']({'where':{'id':_0x30a7ad[_0x70ac('0x48')]['id']}})[_0x70ac('0x25')](handleEntityNotFound(_0x193f13,null))['then'](removeEntity(_0x193f13,null))[_0x70ac('0x43')](handleError(_0x193f13,null));};exports['describe']=function(_0x1388a1,_0x6e21ce){return db['JscriptySessionReport'][_0x70ac('0x49')]()['then'](respondWithResult(_0x6e21ce,null))[_0x70ac('0x43')](handleError(_0x6e21ce,null));};exports['getQuestions']=function(_0x3826cd,_0x2c6fd8,_0x226300){var _0x408fc5={'raw':!![],'where':{}};var _0x36ed85={};var _0x5e80cd={'count':0x0,'rows':[]};return db[_0x70ac('0x2b')]['findOne']({'where':{'id':_0x3826cd[_0x70ac('0x48')]['id']}})[_0x70ac('0x25')](handleEntityNotFound(_0x2c6fd8,null))[_0x70ac('0x25')](function(_0xed8715){if(_0xed8715){_0x36ed85['model']=_[_0x70ac('0x33')](db['JscriptyQuestionReport']['rawAttributes']);_0x36ed85[_0x70ac('0x32')]=_[_0x70ac('0x33')](_0x3826cd[_0x70ac('0x32')]);_0x36ed85[_0x70ac('0x34')]=_['intersection'](_0x36ed85[_0x70ac('0x30')],_0x36ed85[_0x70ac('0x32')]);_0x408fc5['attributes']=_['intersection'](_0x36ed85[_0x70ac('0x30')],qs[_0x70ac('0x37')](_0x3826cd[_0x70ac('0x32')]['fields']));_0x408fc5['attributes']=_0x408fc5['attributes'][_0x70ac('0x44')]?_0x408fc5[_0x70ac('0x36')]:_0x36ed85[_0x70ac('0x30')];if(!_0x3826cd[_0x70ac('0x32')][_0x70ac('0x4a')]('nolimit')){_0x408fc5[_0x70ac('0x1c')]=qs[_0x70ac('0x1c')](_0x3826cd[_0x70ac('0x32')]['limit']);_0x408fc5[_0x70ac('0x1a')]=qs[_0x70ac('0x1a')](_0x3826cd[_0x70ac('0x32')][_0x70ac('0x1a')]);}_0x408fc5[_0x70ac('0x39')]=qs['sort'](_0x3826cd[_0x70ac('0x32')][_0x70ac('0x3a')]);_0x408fc5[_0x70ac('0x3d')]=qs[_0x70ac('0x34')](_[_0x70ac('0x3b')](_0x3826cd[_0x70ac('0x32')],_0x36ed85[_0x70ac('0x34')]));_0x408fc5[_0x70ac('0x3d')][_0x70ac('0x4b')]=_0xed8715['id'];if(_0x3826cd[_0x70ac('0x32')][_0x70ac('0x3c')]){_0x408fc5[_0x70ac('0x3d')]=_[_0x70ac('0x3f')](_0x408fc5[_0x70ac('0x3d')],{'$or':_[_0x70ac('0x31')](_0x408fc5[_0x70ac('0x36')],function(_0x116453){var _0x77367c={};_0x77367c[_0x116453]={'$like':'%'+_0x3826cd[_0x70ac('0x32')][_0x70ac('0x3c')]+'%'};return _0x77367c;})});}_0x408fc5=_[_0x70ac('0x3f')]({},_0x408fc5,_0x3826cd[_0x70ac('0x40')]);return db[_0x70ac('0x4c')][_0x70ac('0x1d')]({'where':_0x408fc5[_0x70ac('0x3d')]})[_0x70ac('0x25')](function(_0xbc1529){_0x5e80cd[_0x70ac('0x1d')]=_0xbc1529;if(_0x3826cd[_0x70ac('0x32')][_0x70ac('0x41')]){_0x408fc5['include']=[{'all':!![]}];}return db[_0x70ac('0x4c')][_0x70ac('0x4d')](_0x408fc5);})[_0x70ac('0x25')](function(_0x5a53a5){_0x5e80cd['rows']=_0x5a53a5;return _0x5e80cd;});}})[_0x70ac('0x25')](respondWithFilteredResult(_0x2c6fd8,_0x408fc5))[_0x70ac('0x43')](handleError(_0x2c6fd8,null));}; \ No newline at end of file +var _0x99a5=['merge','VIRTUAL','options','includeAll','include','findAll','show','length','find','catch','create','body','params','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','filter','rows','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x9aba7f,_0x4cc873){var _0x5d2ae1=function(_0x4f69a0){while(--_0x4f69a0){_0x9aba7f['push'](_0x9aba7f['shift']());}};_0x5d2ae1(++_0x4cc873);}(_0x99a5,0x1aa));var _0x599a=function(_0x6ec8d7,_0x3afaf9){_0x6ec8d7=_0x6ec8d7-0x0;var _0x2b67f2=_0x99a5[_0x6ec8d7];return _0x2b67f2;};'use strict';var emlformat=require(_0x599a('0x0'));var rimraf=require(_0x599a('0x1'));var zipdir=require(_0x599a('0x2'));var jsonpatch=require(_0x599a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x599a('0x4'));var util=require(_0x599a('0x5'));var path=require(_0x599a('0x6'));var sox=require('sox');var csv=require(_0x599a('0x7'));var ejs=require(_0x599a('0x8'));var fs=require('fs');var fs_extra=require(_0x599a('0x9'));var _=require(_0x599a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x599a('0xb'));var deskjs=require(_0x599a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x599a('0xd'));var Papa=require(_0x599a('0xe'));var Redis=require(_0x599a('0xf'));var authService=require(_0x599a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x599a('0x11'));var hardwareService=require(_0x599a('0x12'));var logger=require('../../config/logger')(_0x599a('0x13'));var utils=require('../../config/utils');var config=require(_0x599a('0x14'));var licenseUtil=require(_0x599a('0x15'));var db=require(_0x599a('0x16'))['db'];function respondWithStatusCode(_0xd9c789,_0x24069e){_0x24069e=_0x24069e||0xcc;return function(_0x4dce2c){if(_0x4dce2c){return _0xd9c789[_0x599a('0x17')](_0x24069e);}return _0xd9c789[_0x599a('0x18')](_0x24069e)[_0x599a('0x19')]();};}function respondWithResult(_0x10af18,_0x1fce42){_0x1fce42=_0x1fce42||0xc8;return function(_0xd05519){if(_0xd05519){return _0x10af18['status'](_0x1fce42)[_0x599a('0x1a')](_0xd05519);}};}function respondWithFilteredResult(_0x16b477,_0x5317f7){return function(_0x15b2ac){if(_0x15b2ac){var _0x351784=typeof _0x5317f7[_0x599a('0x1b')]===_0x599a('0x1c')&&typeof _0x5317f7[_0x599a('0x1d')]==='undefined';var _0x44aae0=_0x15b2ac[_0x599a('0x1e')];var _0x1dc534=_0x351784?0x0:_0x5317f7[_0x599a('0x1b')];var _0x3eec46=_0x351784?_0x15b2ac[_0x599a('0x1e')]:_0x5317f7[_0x599a('0x1b')]+_0x5317f7[_0x599a('0x1d')];var _0x2a4c30;if(_0x3eec46>=_0x44aae0){_0x3eec46=_0x44aae0;_0x2a4c30=0xc8;}else{_0x2a4c30=0xce;}_0x16b477['status'](_0x2a4c30);return _0x16b477[_0x599a('0x1f')](_0x599a('0x20'),_0x1dc534+'-'+_0x3eec46+'/'+_0x44aae0)[_0x599a('0x1a')](_0x15b2ac);}return null;};}function patchUpdates(_0x42046e){return function(_0x3cb5d0){try{jsonpatch[_0x599a('0x21')](_0x3cb5d0,_0x42046e,!![]);}catch(_0x13ec79){return BPromise[_0x599a('0x22')](_0x13ec79);}return _0x3cb5d0[_0x599a('0x23')]();};}function saveUpdates(_0x5944d3,_0x5af01d){return function(_0x12fc58){if(_0x12fc58){return _0x12fc58['update'](_0x5944d3)['then'](function(_0x2072df){return _0x2072df;});}return null;};}function removeEntity(_0x232d0c,_0x4fac6d){return function(_0x1bb36a){if(_0x1bb36a){return _0x1bb36a['destroy']()[_0x599a('0x24')](function(){_0x232d0c[_0x599a('0x18')](0xcc)[_0x599a('0x19')]();});}};}function handleEntityNotFound(_0x26bf36,_0x14fcde){return function(_0x1948c1){if(!_0x1948c1){_0x26bf36[_0x599a('0x17')](0x194);}return _0x1948c1;};}function handleError(_0x258a8c,_0x344ed5){_0x344ed5=_0x344ed5||0x1f4;return function(_0x4565e4){logger[_0x599a('0x25')](_0x4565e4[_0x599a('0x26')]);if(_0x4565e4[_0x599a('0x27')]){delete _0x4565e4[_0x599a('0x27')];}_0x258a8c[_0x599a('0x18')](_0x344ed5)[_0x599a('0x28')](_0x4565e4);};}exports[_0x599a('0x29')]=function(_0x4fce98,_0x58034e){var _0x4c8996={},_0x11293a={},_0x402b51={'count':0x0,'rows':[]};var _0x427032=_['map'](db[_0x599a('0x2a')][_0x599a('0x2b')],function(_0x7374aa){return{'name':_0x7374aa[_0x599a('0x2c')],'type':_0x7374aa[_0x599a('0x2d')]['key']};});_0x11293a[_0x599a('0x2e')]=_[_0x599a('0x2f')](_0x427032,_0x599a('0x27'));_0x11293a[_0x599a('0x30')]=_[_0x599a('0x31')](_0x4fce98['query']);_0x11293a[_0x599a('0x32')]=_[_0x599a('0x33')](_0x11293a['model'],_0x11293a['query']);_0x4c8996[_0x599a('0x34')]=_[_0x599a('0x33')](_0x11293a[_0x599a('0x2e')],qs[_0x599a('0x35')](_0x4fce98['query'][_0x599a('0x35')]));_0x4c8996[_0x599a('0x34')]=_0x4c8996[_0x599a('0x34')]['length']?_0x4c8996['attributes']:_0x11293a[_0x599a('0x2e')];if(!_0x4fce98[_0x599a('0x30')][_0x599a('0x36')](_0x599a('0x37'))){_0x4c8996[_0x599a('0x1d')]=qs['limit'](_0x4fce98[_0x599a('0x30')]['limit']);_0x4c8996[_0x599a('0x1b')]=qs[_0x599a('0x1b')](_0x4fce98[_0x599a('0x30')]['offset']);}_0x4c8996[_0x599a('0x38')]=qs[_0x599a('0x39')](_0x4fce98[_0x599a('0x30')][_0x599a('0x39')]);_0x4c8996[_0x599a('0x3a')]=qs[_0x599a('0x32')](_[_0x599a('0x3b')](_0x4fce98[_0x599a('0x30')],_0x11293a[_0x599a('0x32')]),_0x427032);if(_0x4fce98['query']['filter']){_0x4c8996['where']=_[_0x599a('0x3c')](_0x4c8996[_0x599a('0x3a')],{'$or':_[_0x599a('0x2f')](_0x427032,function(_0x3826e1){if(_0x3826e1[_0x599a('0x2d')]!==_0x599a('0x3d')){var _0x51928e={};_0x51928e[_0x3826e1[_0x599a('0x27')]]={'$like':'%'+_0x4fce98[_0x599a('0x30')]['filter']+'%'};return _0x51928e;}})});}_0x4c8996=_['merge']({},_0x4c8996,_0x4fce98[_0x599a('0x3e')]);var _0x73d96c={'where':_0x4c8996['where']};return db[_0x599a('0x2a')]['count'](_0x73d96c)[_0x599a('0x24')](function(_0x54fb2b){_0x402b51[_0x599a('0x1e')]=_0x54fb2b;if(_0x4fce98[_0x599a('0x30')][_0x599a('0x3f')]){_0x4c8996[_0x599a('0x40')]=[{'all':!![]}];}return db[_0x599a('0x2a')][_0x599a('0x41')](_0x4c8996);})['then'](function(_0x466ac2){_0x402b51['rows']=_0x466ac2;return _0x402b51;})[_0x599a('0x24')](respondWithFilteredResult(_0x58034e,_0x4c8996))['catch'](handleError(_0x58034e,null));};exports[_0x599a('0x42')]=function(_0x24ceb6,_0x5f3317){var _0x100d62={'raw':!![],'where':{'id':_0x24ceb6['params']['id']}},_0x29994d={};_0x29994d['model']=_[_0x599a('0x31')](db[_0x599a('0x2a')][_0x599a('0x2b')]);_0x29994d[_0x599a('0x30')]=_[_0x599a('0x31')](_0x24ceb6['query']);_0x29994d[_0x599a('0x32')]=_[_0x599a('0x33')](_0x29994d['model'],_0x29994d['query']);_0x100d62['attributes']=_[_0x599a('0x33')](_0x29994d['model'],qs['fields'](_0x24ceb6[_0x599a('0x30')][_0x599a('0x35')]));_0x100d62[_0x599a('0x34')]=_0x100d62[_0x599a('0x34')][_0x599a('0x43')]?_0x100d62[_0x599a('0x34')]:_0x29994d['model'];if(_0x24ceb6[_0x599a('0x30')]['includeAll']){_0x100d62[_0x599a('0x40')]=[{'all':!![]}];}_0x100d62=_[_0x599a('0x3c')]({},_0x100d62,_0x24ceb6['options']);return db[_0x599a('0x2a')][_0x599a('0x44')](_0x100d62)[_0x599a('0x24')](handleEntityNotFound(_0x5f3317,null))[_0x599a('0x24')](respondWithResult(_0x5f3317,null))[_0x599a('0x45')](handleError(_0x5f3317,null));};exports[_0x599a('0x46')]=function(_0x186c76,_0x3c962a){return db[_0x599a('0x2a')][_0x599a('0x46')](_0x186c76[_0x599a('0x47')],{})[_0x599a('0x24')](respondWithResult(_0x3c962a,0xc9))['catch'](handleError(_0x3c962a,null));};exports['update']=function(_0x5b84c3,_0x24b6f6){if(_0x5b84c3[_0x599a('0x47')]['id']){delete _0x5b84c3[_0x599a('0x47')]['id'];}return db[_0x599a('0x2a')]['find']({'where':{'id':_0x5b84c3[_0x599a('0x48')]['id']}})[_0x599a('0x24')](handleEntityNotFound(_0x24b6f6,null))[_0x599a('0x24')](saveUpdates(_0x5b84c3[_0x599a('0x47')],null))[_0x599a('0x24')](respondWithResult(_0x24b6f6,null))[_0x599a('0x45')](handleError(_0x24b6f6,null));};exports[_0x599a('0x49')]=function(_0xbc2961,_0x362fbc){return db[_0x599a('0x2a')]['find']({'where':{'id':_0xbc2961[_0x599a('0x48')]['id']}})[_0x599a('0x24')](handleEntityNotFound(_0x362fbc,null))['then'](removeEntity(_0x362fbc,null))['catch'](handleError(_0x362fbc,null));};exports[_0x599a('0x4a')]=function(_0x21e872,_0x57afb2){return db[_0x599a('0x2a')][_0x599a('0x4a')]()[_0x599a('0x24')](respondWithResult(_0x57afb2,null))['catch'](handleError(_0x57afb2,null));};exports[_0x599a('0x4b')]=function(_0xc2ef5c,_0x48fc43,_0x41d315){var _0x22da9e={'raw':!![],'where':{}};var _0x23caf1={};var _0x10e0b1={'count':0x0,'rows':[]};return db[_0x599a('0x2a')][_0x599a('0x4c')]({'where':{'id':_0xc2ef5c['params']['id']}})[_0x599a('0x24')](handleEntityNotFound(_0x48fc43,null))[_0x599a('0x24')](function(_0x5c70ce){if(_0x5c70ce){_0x23caf1[_0x599a('0x2e')]=_[_0x599a('0x31')](db[_0x599a('0x4d')][_0x599a('0x2b')]);_0x23caf1['query']=_[_0x599a('0x31')](_0xc2ef5c[_0x599a('0x30')]);_0x23caf1[_0x599a('0x32')]=_[_0x599a('0x33')](_0x23caf1[_0x599a('0x2e')],_0x23caf1[_0x599a('0x30')]);_0x22da9e[_0x599a('0x34')]=_['intersection'](_0x23caf1[_0x599a('0x2e')],qs[_0x599a('0x35')](_0xc2ef5c[_0x599a('0x30')]['fields']));_0x22da9e[_0x599a('0x34')]=_0x22da9e[_0x599a('0x34')][_0x599a('0x43')]?_0x22da9e[_0x599a('0x34')]:_0x23caf1[_0x599a('0x2e')];if(!_0xc2ef5c[_0x599a('0x30')][_0x599a('0x36')](_0x599a('0x37'))){_0x22da9e[_0x599a('0x1d')]=qs[_0x599a('0x1d')](_0xc2ef5c['query'][_0x599a('0x1d')]);_0x22da9e[_0x599a('0x1b')]=qs[_0x599a('0x1b')](_0xc2ef5c['query'][_0x599a('0x1b')]);}_0x22da9e[_0x599a('0x38')]=qs[_0x599a('0x39')](_0xc2ef5c[_0x599a('0x30')][_0x599a('0x39')]);_0x22da9e[_0x599a('0x3a')]=qs['filters'](_['pick'](_0xc2ef5c[_0x599a('0x30')],_0x23caf1[_0x599a('0x32')]));_0x22da9e[_0x599a('0x3a')][_0x599a('0x4e')]=_0x5c70ce['id'];if(_0xc2ef5c[_0x599a('0x30')]['filter']){_0x22da9e[_0x599a('0x3a')]=_[_0x599a('0x3c')](_0x22da9e[_0x599a('0x3a')],{'$or':_[_0x599a('0x2f')](_0x22da9e[_0x599a('0x34')],function(_0x595697){var _0x548af0={};_0x548af0[_0x595697]={'$like':'%'+_0xc2ef5c[_0x599a('0x30')][_0x599a('0x4f')]+'%'};return _0x548af0;})});}_0x22da9e=_[_0x599a('0x3c')]({},_0x22da9e,_0xc2ef5c[_0x599a('0x3e')]);return db[_0x599a('0x4d')][_0x599a('0x1e')]({'where':_0x22da9e[_0x599a('0x3a')]})[_0x599a('0x24')](function(_0x4c51e){_0x10e0b1[_0x599a('0x1e')]=_0x4c51e;if(_0xc2ef5c['query'][_0x599a('0x3f')]){_0x22da9e[_0x599a('0x40')]=[{'all':!![]}];}return db[_0x599a('0x4d')][_0x599a('0x41')](_0x22da9e);})[_0x599a('0x24')](function(_0x4d598a){_0x10e0b1[_0x599a('0x50')]=_0x4d598a;return _0x10e0b1;});}})[_0x599a('0x24')](respondWithFilteredResult(_0x48fc43,_0x22da9e))[_0x599a('0x45')](handleError(_0x48fc43,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 31b316b..21435e1 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['report_jscripty_sessions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x37c47c,_0x2a5a52){var _0x4af11e=function(_0x45860b){while(--_0x45860b){_0x37c47c['push'](_0x37c47c['shift']());}};_0x4af11e(++_0x2a5a52);}(_0x326f,0xd1));var _0xf326=function(_0x75880a,_0x190f91){_0x75880a=_0x75880a-0x0;var _0x18bd51=_0x326f[_0x75880a];return _0x18bd51;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x122cc1,_0x5c956e){_0x122cc1=_0x122cc1-0x0;var _0x1e33af=_0x7fbe[_0x122cc1];return _0x1e33af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index f551062..c3b3ae2 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd046=['ioredis','../../config/logger','../../config/environment','http','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xd046,0x129));var _0x6d04=function(_0x2bd799,_0x1a425d){_0x2bd799=_0x2bd799-0x0;var _0x427798=_0xd046[_0x2bd799];return _0x427798;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});} \ No newline at end of file +var _0xacf4=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xacf4,0xe7));var _0x4acf=function(_0x1c2313,_0x56bdf7){_0x1c2313=_0x1c2313-0x0;var _0x20f25f=_0xacf4[_0x1c2313];return _0x20f25f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 893387a..6a7dfa1 100644 --- a/server/api/license/index.js +++ b/server/api/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd715=['downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','put','/:id','update','isAuthenticated'];(function(_0x32dbcd,_0x463cd2){var _0x303818=function(_0x2a65ee){while(--_0x2a65ee){_0x32dbcd['push'](_0x32dbcd['shift']());}};_0x303818(++_0x463cd2);}(_0xd715,0x92));var _0x5d71=function(_0xa95a56,_0x280710){_0xa95a56=_0xa95a56-0x0;var _0x4e4204=_0xd715[_0xa95a56];return _0x4e4204;};'use strict';var multer=require(_0x5d71('0x0'));var util=require(_0x5d71('0x1'));var path=require(_0x5d71('0x2'));var timeout=require(_0x5d71('0x3'));var express=require(_0x5d71('0x4'));var router=express[_0x5d71('0x5')]();var fs_extra=require(_0x5d71('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5d71('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x5d71('0x8')]('/',controller[_0x5d71('0x9')]);router[_0x5d71('0xa')](_0x5d71('0xb'),auth['isAuthenticated'](),controller[_0x5d71('0xc')]);router[_0x5d71('0x8')]('/download_log_file',auth[_0x5d71('0xd')](),controller[_0x5d71('0xe')]);module[_0x5d71('0xf')]=router; \ No newline at end of file +var _0x1469=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put','/:id','isAuthenticated','update','get','downloadLogFile','exports','multer'];(function(_0x59b286,_0x3fb0fb){var _0x155cdd=function(_0x3ac64a){while(--_0x3ac64a){_0x59b286['push'](_0x59b286['shift']());}};_0x155cdd(++_0x3fb0fb);}(_0x1469,0x197));var _0x9146=function(_0x16b822,_0x1d293a){_0x16b822=_0x16b822-0x0;var _0x51987d=_0x1469[_0x16b822];return _0x51987d;};'use strict';var multer=require(_0x9146('0x0'));var util=require(_0x9146('0x1'));var path=require(_0x9146('0x2'));var timeout=require('connect-timeout');var express=require(_0x9146('0x3'));var router=express[_0x9146('0x4')]();var fs_extra=require(_0x9146('0x5'));var auth=require(_0x9146('0x6'));var interaction=require(_0x9146('0x7'));var config=require(_0x9146('0x8'));var controller=require(_0x9146('0x9'));router['get']('/',controller['index']);router[_0x9146('0xa')](_0x9146('0xb'),auth[_0x9146('0xc')](),controller[_0x9146('0xd')]);router[_0x9146('0xe')]('/download_log_file',auth[_0x9146('0xc')](),controller[_0x9146('0xf')]);module[_0x9146('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0d9676e..35238fa 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a76=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0x5a76,0x13b));var _0x65a7=function(_0x11d541,_0xc8fe9){_0x11d541=_0x11d541-0x0;var _0x3e612a=_0x5a76[_0x11d541];return _0x3e612a;};'use strict';var Sequelize=require(_0x65a7('0x0'));module[_0x65a7('0x1')]={'license':{'type':Sequelize[_0x65a7('0x2')]},'data1':{'type':Sequelize[_0x65a7('0x3')]},'data2':{'type':Sequelize[_0x65a7('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x65a7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1ab6=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x33278e,_0x1e4f6d){var _0x1415c7=function(_0x4d6207){while(--_0x4d6207){_0x33278e['push'](_0x33278e['shift']());}};_0x1415c7(++_0x1e4f6d);}(_0x1ab6,0x98));var _0x61ab=function(_0x561778,_0x5c8846){_0x561778=_0x561778-0x0;var _0x122790=_0x1ab6[_0x561778];return _0x122790;};'use strict';var Sequelize=require(_0x61ab('0x0'));module[_0x61ab('0x1')]={'license':{'type':Sequelize[_0x61ab('0x2')]},'data1':{'type':Sequelize[_0x61ab('0x3')]},'data2':{'type':Sequelize[_0x61ab('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x61ab('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index efb02c5..0641fe2 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f45=['squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','status','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','download','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','lodash'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x4f45,0x89));var _0x54f4=function(_0x3f2102,_0x35a5fd){_0x3f2102=_0x3f2102-0x0;var _0x5b6e0f=_0x4f45[_0x3f2102];return _0x5b6e0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54f4('0x0'));var zipdir=require(_0x54f4('0x1'));var jsonpatch=require(_0x54f4('0x2'));var rp=require('request-promise');var moment=require(_0x54f4('0x3'));var BPromise=require(_0x54f4('0x4'));var Mustache=require(_0x54f4('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x54f4('0x6'));var fs=require('fs');var fs_extra=require(_0x54f4('0x7'));var _=require(_0x54f4('0x8'));var squel=require(_0x54f4('0x9'));var crypto=require(_0x54f4('0xa'));var jsforce=require(_0x54f4('0xb'));var deskjs=require(_0x54f4('0xc'));var toCsv=require(_0x54f4('0xd'));var querystring=require(_0x54f4('0xe'));var Papa=require('papaparse');var Redis=require(_0x54f4('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x54f4('0x10'));var hardwareService=require(_0x54f4('0x11'));var logger=require(_0x54f4('0x12'))(_0x54f4('0x13'));var utils=require(_0x54f4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x54f4('0x15'));var db=require(_0x54f4('0x16'))['db'];function respondWithStatusCode(_0x1f4e1d,_0xdba73e){_0xdba73e=_0xdba73e||0xcc;return function(_0x156649){if(_0x156649){return _0x1f4e1d[_0x54f4('0x17')](_0xdba73e);}return _0x1f4e1d['status'](_0xdba73e)[_0x54f4('0x18')]();};}function respondWithResult(_0x445356,_0x5cf1a7){_0x5cf1a7=_0x5cf1a7||0xc8;return function(_0x5d6b78){if(_0x5d6b78){return _0x445356['status'](_0x5cf1a7)[_0x54f4('0x19')](_0x5d6b78);}};}function respondWithFilteredResult(_0x5cbcb8,_0x4aaf8e){return function(_0x5a91d1){if(_0x5a91d1){var _0x5f032b=typeof _0x4aaf8e[_0x54f4('0x1a')]==='undefined'&&typeof _0x4aaf8e[_0x54f4('0x1b')]===_0x54f4('0x1c');var _0x107c15=_0x5a91d1[_0x54f4('0x1d')];var _0x212410=_0x5f032b?0x0:_0x4aaf8e['offset'];var _0x3c02ed=_0x5f032b?_0x5a91d1[_0x54f4('0x1d')]:_0x4aaf8e[_0x54f4('0x1a')]+_0x4aaf8e[_0x54f4('0x1b')];var _0x343709;if(_0x3c02ed>=_0x107c15){_0x3c02ed=_0x107c15;_0x343709=0xc8;}else{_0x343709=0xce;}_0x5cbcb8['status'](_0x343709);return _0x5cbcb8[_0x54f4('0x1e')](_0x54f4('0x1f'),_0x212410+'-'+_0x3c02ed+'/'+_0x107c15)[_0x54f4('0x19')](_0x5a91d1);}return null;};}function patchUpdates(_0x452a75){return function(_0x39653b){try{jsonpatch[_0x54f4('0x20')](_0x39653b,_0x452a75,!![]);}catch(_0x4a0d0e){return BPromise[_0x54f4('0x21')](_0x4a0d0e);}return _0x39653b[_0x54f4('0x22')]();};}function saveUpdates(_0x4d3463,_0x272bde){return function(_0x30c087){if(_0x30c087){return _0x30c087[_0x54f4('0x23')](_0x4d3463)[_0x54f4('0x24')](function(_0x15f9aa){return _0x15f9aa;});}return null;};}function removeEntity(_0x5794ac,_0x2f5c08){return function(_0x5a3b3a){if(_0x5a3b3a){return _0x5a3b3a[_0x54f4('0x25')]()[_0x54f4('0x24')](function(){_0x5794ac[_0x54f4('0x26')](0xcc)[_0x54f4('0x18')]();});}};}function handleEntityNotFound(_0x3180e3,_0xfa998c){return function(_0x196a32){if(!_0x196a32){_0x3180e3[_0x54f4('0x17')](0x194);}return _0x196a32;};}function handleError(_0xad091f,_0x248fcb){_0x248fcb=_0x248fcb||0x1f4;return function(_0xe376b3){logger['error'](_0xe376b3[_0x54f4('0x27')]);if(_0xe376b3[_0x54f4('0x28')]){delete _0xe376b3[_0x54f4('0x28')];}_0xad091f[_0x54f4('0x26')](_0x248fcb)[_0x54f4('0x29')](_0xe376b3);};}var utilLicense=require(_0x54f4('0x15'));exports[_0x54f4('0x2a')]=function(_0x4f7d9e,_0x3f7d9a){var _0x12eabb={'raw':!![],'where':{'id':0x1}},_0x5ad91e={};_0x5ad91e[_0x54f4('0x2b')]=_[_0x54f4('0x2c')](db[_0x54f4('0x2d')][_0x54f4('0x2e')]);_0x5ad91e[_0x54f4('0x2f')]=_[_0x54f4('0x2c')](_0x4f7d9e[_0x54f4('0x2f')]);_0x5ad91e[_0x54f4('0x30')]=_[_0x54f4('0x31')](_0x5ad91e['model'],_0x5ad91e[_0x54f4('0x2f')]);_0x12eabb[_0x54f4('0x32')]=_[_0x54f4('0x31')](_0x5ad91e[_0x54f4('0x2b')],qs[_0x54f4('0x33')](_0x4f7d9e[_0x54f4('0x2f')][_0x54f4('0x33')]));_0x12eabb[_0x54f4('0x32')]=_0x12eabb['attributes'][_0x54f4('0x34')]?_0x12eabb[_0x54f4('0x32')]:_0x5ad91e[_0x54f4('0x2b')];_0x12eabb=_[_0x54f4('0x35')]({},_0x12eabb,_0x4f7d9e[_0x54f4('0x36')]);return utilLicense[_0x54f4('0x37')](_0x12eabb)[_0x54f4('0x24')](respondWithResult(_0x3f7d9a,null))[_0x54f4('0x38')](handleError(_0x3f7d9a,null));};exports['update']=function(_0x1f4133,_0x30848a){if(_0x1f4133[_0x54f4('0x39')]['id']){delete _0x1f4133[_0x54f4('0x39')]['id'];}return db[_0x54f4('0x2d')][_0x54f4('0x3a')]({'where':{'id':_0x1f4133[_0x54f4('0x3b')]['id']}})[_0x54f4('0x24')](handleEntityNotFound(_0x30848a,null))[_0x54f4('0x24')](function(_0x8871d2){var _0x362fbe=_0x8871d2[_0x54f4('0x3c')]({'plain':!![]});return utilLicense[_0x54f4('0x3d')](_0x362fbe,_0x1f4133[_0x54f4('0x39')][_0x54f4('0x3e')]);})[_0x54f4('0x24')](function(_0x44ffb3){if(!_0x44ffb3[_0x54f4('0x3f')]){return saveUpdates(_0x1f4133[_0x54f4('0x39')],null);}return _0x44ffb3;})['then'](respondWithResult(_0x30848a,null))[_0x54f4('0x38')](handleError(_0x30848a,null));};exports[_0x54f4('0x40')]=function(_0x3933d4,_0x60e40){var _0x1b1ea4=_0x54f4('0x41');var _0x392706=path[_0x54f4('0x42')](_0x54f4('0x43'),_0x54f4('0x44'),'xcally',_0x1b1ea4);_0x60e40[_0x54f4('0x45')](_0x54f4('0x46'),_0x54f4('0x47')+_0x1b1ea4);_0x60e40[_0x54f4('0x1e')]('Content-Type','text/plain');_0x60e40[_0x54f4('0x48')](_0x392706);}; \ No newline at end of file +var _0x628d=['Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','model','keys','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','body','License','find','params','get','checkLicense','key','downloadLogFile','join','setHeader','Content-disposition'];(function(_0x302f55,_0x31872f){var _0x55ca94=function(_0x477ac3){while(--_0x477ac3){_0x302f55['push'](_0x302f55['shift']());}};_0x55ca94(++_0x31872f);}(_0x628d,0x11b));var _0xd628=function(_0x1a52d7,_0x19584e){_0x1a52d7=_0x1a52d7-0x0;var _0x586557=_0x628d[_0x1a52d7];return _0x586557;};'use strict';var emlformat=require(_0xd628('0x0'));var rimraf=require(_0xd628('0x1'));var zipdir=require(_0xd628('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd628('0x3'));var moment=require(_0xd628('0x4'));var BPromise=require(_0xd628('0x5'));var Mustache=require('mustache');var util=require(_0xd628('0x6'));var path=require('path');var sox=require(_0xd628('0x7'));var csv=require(_0xd628('0x8'));var ejs=require(_0xd628('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd628('0xa'));var squel=require(_0xd628('0xb'));var crypto=require(_0xd628('0xc'));var jsforce=require(_0xd628('0xd'));var deskjs=require(_0xd628('0xe'));var toCsv=require(_0xd628('0x8'));var querystring=require(_0xd628('0xf'));var Papa=require(_0xd628('0x10'));var Redis=require(_0xd628('0x11'));var authService=require(_0xd628('0x12'));var qs=require(_0xd628('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd628('0x14'));var logger=require(_0xd628('0x15'))(_0xd628('0x16'));var utils=require(_0xd628('0x17'));var config=require(_0xd628('0x18'));var licenseUtil=require(_0xd628('0x19'));var db=require(_0xd628('0x1a'))['db'];function respondWithStatusCode(_0x421626,_0x591575){_0x591575=_0x591575||0xcc;return function(_0x10721b){if(_0x10721b){return _0x421626[_0xd628('0x1b')](_0x591575);}return _0x421626['status'](_0x591575)[_0xd628('0x1c')]();};}function respondWithResult(_0x293e98,_0x3fe340){_0x3fe340=_0x3fe340||0xc8;return function(_0x2e7ca7){if(_0x2e7ca7){return _0x293e98[_0xd628('0x1d')](_0x3fe340)['json'](_0x2e7ca7);}};}function respondWithFilteredResult(_0x412475,_0x7ec949){return function(_0x2a1b6e){if(_0x2a1b6e){var _0x40c2c0=typeof _0x7ec949[_0xd628('0x1e')]===_0xd628('0x1f')&&typeof _0x7ec949[_0xd628('0x20')]===_0xd628('0x1f');var _0x41718a=_0x2a1b6e['count'];var _0x2474ca=_0x40c2c0?0x0:_0x7ec949[_0xd628('0x1e')];var _0x5b0c22=_0x40c2c0?_0x2a1b6e[_0xd628('0x21')]:_0x7ec949[_0xd628('0x1e')]+_0x7ec949[_0xd628('0x20')];var _0x2b5600;if(_0x5b0c22>=_0x41718a){_0x5b0c22=_0x41718a;_0x2b5600=0xc8;}else{_0x2b5600=0xce;}_0x412475['status'](_0x2b5600);return _0x412475[_0xd628('0x22')](_0xd628('0x23'),_0x2474ca+'-'+_0x5b0c22+'/'+_0x41718a)[_0xd628('0x24')](_0x2a1b6e);}return null;};}function patchUpdates(_0x23e80f){return function(_0xed78a5){try{jsonpatch[_0xd628('0x25')](_0xed78a5,_0x23e80f,!![]);}catch(_0x214326){return BPromise['reject'](_0x214326);}return _0xed78a5[_0xd628('0x26')]();};}function saveUpdates(_0x4dc917,_0x3b9ef6){return function(_0xdf80cd){if(_0xdf80cd){return _0xdf80cd['update'](_0x4dc917)[_0xd628('0x27')](function(_0x4d4646){return _0x4d4646;});}return null;};}function removeEntity(_0x2a6a41,_0x13709a){return function(_0x45f1d4){if(_0x45f1d4){return _0x45f1d4[_0xd628('0x28')]()['then'](function(){_0x2a6a41[_0xd628('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23582a,_0x1aa82b){return function(_0x24b207){if(!_0x24b207){_0x23582a[_0xd628('0x1b')](0x194);}return _0x24b207;};}function handleError(_0x4fc7d7,_0x12bf9b){_0x12bf9b=_0x12bf9b||0x1f4;return function(_0x104b07){logger[_0xd628('0x29')](_0x104b07[_0xd628('0x2a')]);if(_0x104b07[_0xd628('0x2b')]){delete _0x104b07[_0xd628('0x2b')];}_0x4fc7d7[_0xd628('0x1d')](_0x12bf9b)[_0xd628('0x2c')](_0x104b07);};}var utilLicense=require('../../config/license/util');exports[_0xd628('0x2d')]=function(_0x422d35,_0x3ecf82){var _0x32632e={'raw':!![],'where':{'id':0x1}},_0x28597b={};_0x28597b[_0xd628('0x2e')]=_[_0xd628('0x2f')](db['License'][_0xd628('0x30')]);_0x28597b['query']=_[_0xd628('0x2f')](_0x422d35[_0xd628('0x31')]);_0x28597b['filters']=_[_0xd628('0x32')](_0x28597b['model'],_0x28597b[_0xd628('0x31')]);_0x32632e[_0xd628('0x33')]=_['intersection'](_0x28597b[_0xd628('0x2e')],qs[_0xd628('0x34')](_0x422d35['query'][_0xd628('0x34')]));_0x32632e[_0xd628('0x33')]=_0x32632e[_0xd628('0x33')]['length']?_0x32632e['attributes']:_0x28597b['model'];_0x32632e=_[_0xd628('0x35')]({},_0x32632e,_0x422d35['options']);return utilLicense[_0xd628('0x36')](_0x32632e)[_0xd628('0x27')](respondWithResult(_0x3ecf82,null))[_0xd628('0x37')](handleError(_0x3ecf82,null));};exports['update']=function(_0x1b321,_0x3d8f45){if(_0x1b321[_0xd628('0x38')]['id']){delete _0x1b321[_0xd628('0x38')]['id'];}return db[_0xd628('0x39')][_0xd628('0x3a')]({'where':{'id':_0x1b321[_0xd628('0x3b')]['id']}})[_0xd628('0x27')](handleEntityNotFound(_0x3d8f45,null))['then'](function(_0xe6e48e){var _0x13ba17=_0xe6e48e[_0xd628('0x3c')]({'plain':!![]});return utilLicense[_0xd628('0x3d')](_0x13ba17,_0x1b321[_0xd628('0x38')][_0xd628('0x3e')]);})[_0xd628('0x27')](function(_0x23715d){if(!_0x23715d['demo']){return saveUpdates(_0x1b321[_0xd628('0x38')],null);}return _0x23715d;})[_0xd628('0x27')](respondWithResult(_0x3d8f45,null))['catch'](handleError(_0x3d8f45,null));};exports[_0xd628('0x3f')]=function(_0x50c14a,_0x59b70d){var _0x4299a9='license-info.log';var _0x190eec=path[_0xd628('0x40')]('/var','log','xcally',_0x4299a9);_0x59b70d[_0xd628('0x41')](_0xd628('0x42'),'attachment;\x20filename='+_0x4299a9);_0x59b70d[_0xd628('0x22')](_0xd628('0x43'),_0xd628('0x44'));_0x59b70d[_0xd628('0x45')](_0x190eec);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6902231..e46ce49 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4414=['License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x4451bf,_0x4f044c){var _0x2bfbe9=function(_0x5ef1f7){while(--_0x5ef1f7){_0x4451bf['push'](_0x4451bf['shift']());}};_0x2bfbe9(++_0x4f044c);}(_0x4414,0x1b5));var _0x4441=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0x4414[_0x3eb450];return _0x2c4cfd;};'use strict';var _=require(_0x4441('0x0'));var util=require(_0x4441('0x1'));var logger=require(_0x4441('0x2'))(_0x4441('0x3'));var moment=require(_0x4441('0x4'));var BPromise=require(_0x4441('0x5'));var rp=require(_0x4441('0x6'));var fs=require('fs');var path=require(_0x4441('0x7'));var rimraf=require(_0x4441('0x8'));var config=require(_0x4441('0x9'));var attributes=require(_0x4441('0xa'));module[_0x4441('0xb')]=function(_0x139f70,_0x5a348a){return _0x139f70[_0x4441('0xc')](_0x4441('0xd'),attributes,{'tableName':_0x4441('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa47a=['../../config/logger','api','moment','request-promise','path','./license.attributes','exports','define','License','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa47a,0x8b));var _0xaa47=function(_0x2a6e39,_0x108e6f){_0x2a6e39=_0x2a6e39-0x0;var _0x583862=_0xa47a[_0x2a6e39];return _0x583862;};'use strict';var _=require(_0xaa47('0x0'));var util=require('util');var logger=require(_0xaa47('0x1'))(_0xaa47('0x2'));var moment=require(_0xaa47('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa47('0x4'));var fs=require('fs');var path=require(_0xaa47('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa47('0x6'));module[_0xaa47('0x7')]=function(_0x212fe4,_0x465c8b){return _0x212fe4[_0xaa47('0x8')](_0xaa47('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 2215da8..b9cf9f0 100644 --- a/server/api/license/license.rpc.js +++ b/server/api/license/license.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe664=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','request\x20sent','debug','stringify','error','code','License,\x20%s,\x20%s','message','lodash','util','moment','bluebird'];(function(_0x4a22ad,_0x542ae0){var _0x50787b=function(_0x34942c){while(--_0x34942c){_0x4a22ad['push'](_0x4a22ad['shift']());}};_0x50787b(++_0x542ae0);}(_0xe664,0x6e));var _0x4e66=function(_0x338995,_0x51cdec){_0x338995=_0x338995-0x0;var _0x379ab2=_0xe664[_0x338995];return _0x379ab2;};'use strict';var _=require(_0x4e66('0x0'));var util=require(_0x4e66('0x1'));var moment=require(_0x4e66('0x2'));var BPromise=require(_0x4e66('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e66('0x4'));var db=require(_0x4e66('0x5'))['db'];var utils=require(_0x4e66('0x6'));var logger=require('../../config/logger')(_0x4e66('0x7'));var config=require(_0x4e66('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d05eb,_0x393202,_0xd4ab23){return new BPromise(function(_0x3380d1,_0x34ba9a){return client[_0x4e66('0x9')](_0x1d05eb,_0xd4ab23)[_0x4e66('0xa')](function(_0x152442){logger[_0x4e66('0xb')]('License,\x20%s,\x20%s',_0x393202,_0x4e66('0xc'));logger[_0x4e66('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x393202,_0x4e66('0xc'),JSON[_0x4e66('0xe')](_0x152442));if(_0x152442['error']){if(_0x152442[_0x4e66('0xf')][_0x4e66('0x10')]===0x1f4){logger['error'](_0x4e66('0x11'),_0x393202,_0x152442[_0x4e66('0xf')][_0x4e66('0x12')]);return _0x34ba9a(_0x152442['error']['message']);}logger[_0x4e66('0xf')](_0x4e66('0x11'),_0x393202,_0x152442[_0x4e66('0xf')]['message']);return _0x3380d1(_0x152442['error'][_0x4e66('0x12')]);}else{logger[_0x4e66('0xb')]('License,\x20%s,\x20%s',_0x393202,_0x4e66('0xc'));_0x3380d1(_0x152442['result']['message']);}})['catch'](function(_0xd0b861){logger[_0x4e66('0xf')]('License,\x20%s,\x20%s',_0x393202,_0xd0b861);_0x34ba9a(_0xd0b861);});});} \ No newline at end of file +var _0x3e7e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x1b68a7,_0x532a4c){var _0xe9ae9e=function(_0x20c375){while(--_0x20c375){_0x1b68a7['push'](_0x1b68a7['shift']());}};_0xe9ae9e(++_0x532a4c);}(_0x3e7e,0x175));var _0xe3e7=function(_0x3eede0,_0x427663){_0x3eede0=_0x3eede0-0x0;var _0x19b4eb=_0x3e7e[_0x3eede0];return _0x19b4eb;};'use strict';var _=require('lodash');var util=require(_0xe3e7('0x0'));var moment=require(_0xe3e7('0x1'));var BPromise=require(_0xe3e7('0x2'));var rs=require(_0xe3e7('0x3'));var fs=require('fs');var Redis=require(_0xe3e7('0x4'));var db=require(_0xe3e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3e7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe3e7('0x7'));var client=jayson[_0xe3e7('0x8')][_0xe3e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x290608,_0x574dac,_0x514f9d){return new BPromise(function(_0xf2eced,_0x4d47f6){return client[_0xe3e7('0xa')](_0x290608,_0x514f9d)[_0xe3e7('0xb')](function(_0xb16d1e){logger[_0xe3e7('0xc')](_0xe3e7('0xd'),_0x574dac,_0xe3e7('0xe'));logger[_0xe3e7('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x574dac,'request\x20sent',JSON[_0xe3e7('0x10')](_0xb16d1e));if(_0xb16d1e[_0xe3e7('0x11')]){if(_0xb16d1e[_0xe3e7('0x11')][_0xe3e7('0x12')]===0x1f4){logger[_0xe3e7('0x11')]('License,\x20%s,\x20%s',_0x574dac,_0xb16d1e['error'][_0xe3e7('0x13')]);return _0x4d47f6(_0xb16d1e[_0xe3e7('0x11')]['message']);}logger[_0xe3e7('0x11')](_0xe3e7('0xd'),_0x574dac,_0xb16d1e['error'][_0xe3e7('0x13')]);return _0xf2eced(_0xb16d1e[_0xe3e7('0x11')]['message']);}else{logger['info'](_0xe3e7('0xd'),_0x574dac,_0xe3e7('0xe'));_0xf2eced(_0xb16d1e[_0xe3e7('0x14')][_0xe3e7('0x13')]);}})[_0xe3e7('0x15')](function(_0x14e65d){logger['error'](_0xe3e7('0xd'),_0x574dac,_0x14e65d);_0x4d47f6(_0x14e65d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ab9a66f..03b46f6 100644 --- a/server/api/mailAccount/index.js +++ b/server/api/mailAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe293=['getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','/:id/interactions','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/in_servers'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xe293,0x186));var _0x3e29=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0xe293[_0x230e39];return _0xa804e;};'use strict';var multer=require(_0x3e29('0x0'));var util=require(_0x3e29('0x1'));var path=require(_0x3e29('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e29('0x3'));var router=express[_0x3e29('0x4')]();var fs_extra=require(_0x3e29('0x5'));var auth=require(_0x3e29('0x6'));var interaction=require(_0x3e29('0x7'));var config=require(_0x3e29('0x8'));var controller=require(_0x3e29('0x9'));router[_0x3e29('0xa')]('/',auth[_0x3e29('0xb')](),controller[_0x3e29('0xc')]);router[_0x3e29('0xa')](_0x3e29('0xd'),auth[_0x3e29('0xb')](),controller[_0x3e29('0xe')]);router['get'](_0x3e29('0xf'),auth[_0x3e29('0xb')](),controller['show']);router['get'](_0x3e29('0x10'),auth[_0x3e29('0xb')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x3e29('0xb')](),controller['getAnswers']);router[_0x3e29('0xa')](_0x3e29('0x11'),auth[_0x3e29('0xb')](),controller[_0x3e29('0x12')]);router[_0x3e29('0xa')](_0x3e29('0x13'),auth[_0x3e29('0xb')](),controller[_0x3e29('0x14')]);router[_0x3e29('0xa')]('/:id/interactions',auth[_0x3e29('0xb')](),controller[_0x3e29('0x15')]);router['get'](_0x3e29('0x16'),auth['isAuthenticated'](),controller[_0x3e29('0x17')]);router[_0x3e29('0xa')](_0x3e29('0x18'),auth[_0x3e29('0xb')](),controller[_0x3e29('0x19')]);router[_0x3e29('0xa')](_0x3e29('0x1a'),auth['isAuthenticated'](),controller[_0x3e29('0x1b')]);router[_0x3e29('0xa')]('/:id/users',auth[_0x3e29('0xb')](),controller[_0x3e29('0x1c')]);router[_0x3e29('0x1d')]('/:id/dispositions',auth[_0x3e29('0xb')](),controller[_0x3e29('0x1e')]);router[_0x3e29('0x1d')](_0x3e29('0x1f'),auth[_0x3e29('0xb')](),controller[_0x3e29('0x20')]);router[_0x3e29('0x1d')]('/',auth[_0x3e29('0xb')](),controller[_0x3e29('0x21')]);router[_0x3e29('0x1d')]('/:id/in_servers',auth[_0x3e29('0xb')](),controller[_0x3e29('0x22')]);router['post'](_0x3e29('0x13'),auth[_0x3e29('0xb')](),controller[_0x3e29('0x23')]);router['post'](_0x3e29('0x24'),auth[_0x3e29('0xb')](),controller['addInteraction']);router[_0x3e29('0x1d')](_0x3e29('0x16'),auth[_0x3e29('0xb')](),controller[_0x3e29('0x25')]);router['post'](_0x3e29('0x26'),auth['isAuthenticated'](),controller[_0x3e29('0x27')]);router['post'](_0x3e29('0x28'),auth['isAuthenticated'](),controller[_0x3e29('0x29')]);router[_0x3e29('0x2a')](_0x3e29('0xf'),auth[_0x3e29('0xb')](),controller[_0x3e29('0x2b')]);router[_0x3e29('0x2c')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x3e29('0x1f'),auth['isAuthenticated'](),controller[_0x3e29('0x2d')]);router[_0x3e29('0x2c')](_0x3e29('0x11'),auth['isAuthenticated'](),controller[_0x3e29('0x2e')]);router['delete']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x3e29('0x2f')]);router[_0x3e29('0x2c')](_0x3e29('0xf'),auth[_0x3e29('0xb')](),controller[_0x3e29('0x30')]);router[_0x3e29('0x2c')]('/:id/users',auth[_0x3e29('0xb')](),controller[_0x3e29('0x31')]);module[_0x3e29('0x32')]=router; \ No newline at end of file +var _0x6037=['removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getApplications','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','delete','removeDispositions','/:id/canned_answers','removeAnswers','destroy'];(function(_0x59f67c,_0x4d6d3d){var _0x3adbea=function(_0x20cdd5){while(--_0x20cdd5){_0x59f67c['push'](_0x59f67c['shift']());}};_0x3adbea(++_0x4d6d3d);}(_0x6037,0x196));var _0x7603=function(_0x55623b,_0xe94c4){_0x55623b=_0x55623b-0x0;var _0xffbc02=_0x6037[_0x55623b];return _0xffbc02;};'use strict';var multer=require(_0x7603('0x0'));var util=require(_0x7603('0x1'));var path=require(_0x7603('0x2'));var timeout=require(_0x7603('0x3'));var express=require(_0x7603('0x4'));var router=express[_0x7603('0x5')]();var fs_extra=require(_0x7603('0x6'));var auth=require(_0x7603('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7603('0x8'));var controller=require(_0x7603('0x9'));router[_0x7603('0xa')]('/',auth[_0x7603('0xb')](),controller[_0x7603('0xc')]);router[_0x7603('0xa')](_0x7603('0xd'),auth[_0x7603('0xb')](),controller['describe']);router['get'](_0x7603('0xe'),auth[_0x7603('0xb')](),controller[_0x7603('0xf')]);router[_0x7603('0xa')](_0x7603('0x10'),auth[_0x7603('0xb')](),controller[_0x7603('0x11')]);router['get']('/:id/canned_answers',auth[_0x7603('0xb')](),controller[_0x7603('0x12')]);router[_0x7603('0xa')](_0x7603('0x13'),auth['isAuthenticated'](),controller[_0x7603('0x14')]);router[_0x7603('0xa')](_0x7603('0x15'),auth[_0x7603('0xb')](),controller[_0x7603('0x16')]);router['get'](_0x7603('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x7603('0xa')]('/:id/applications',auth[_0x7603('0xb')](),controller[_0x7603('0x18')]);router[_0x7603('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x7603('0x19')]);router[_0x7603('0xa')](_0x7603('0x1a'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x7603('0xa')](_0x7603('0x1b'),auth['isAuthenticated'](),controller[_0x7603('0x1c')]);router[_0x7603('0x1d')](_0x7603('0x10'),auth[_0x7603('0xb')](),controller[_0x7603('0x1e')]);router['post']('/:id/canned_answers',auth[_0x7603('0xb')](),controller[_0x7603('0x1f')]);router[_0x7603('0x1d')]('/',auth[_0x7603('0xb')](),controller['create']);router[_0x7603('0x1d')]('/:id/in_servers',auth[_0x7603('0xb')](),controller[_0x7603('0x20')]);router['post']('/:id/out_servers',auth['isAuthenticated'](),controller['addSmtp']);router[_0x7603('0x1d')](_0x7603('0x17'),auth['isAuthenticated'](),controller[_0x7603('0x21')]);router[_0x7603('0x1d')](_0x7603('0x22'),auth[_0x7603('0xb')](),controller[_0x7603('0x23')]);router[_0x7603('0x1d')](_0x7603('0x24'),auth['isAuthenticated'](),controller[_0x7603('0x25')]);router['post']('/:id/users',auth[_0x7603('0xb')](),controller[_0x7603('0x26')]);router['put'](_0x7603('0xe'),auth[_0x7603('0xb')](),controller['update']);router[_0x7603('0x27')]('/:id/dispositions',auth[_0x7603('0xb')](),controller[_0x7603('0x28')]);router[_0x7603('0x27')](_0x7603('0x29'),auth[_0x7603('0xb')](),controller[_0x7603('0x2a')]);router[_0x7603('0x27')](_0x7603('0x13'),auth['isAuthenticated'](),controller['removeImap']);router[_0x7603('0x27')](_0x7603('0x15'),auth[_0x7603('0xb')](),controller['removeSmtp']);router[_0x7603('0x27')]('/:id',auth[_0x7603('0xb')](),controller[_0x7603('0x2b')]);router[_0x7603('0x27')](_0x7603('0x1b'),auth[_0x7603('0xb')](),controller[_0x7603('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 87cffb9..8d5fd0b 100644 --- a/server/api/mailAccount/mailAccount.attributes.js +++ b/server/api/mailAccount/mailAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fb0=['exports','STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize'];(function(_0x2e356d,_0x17ddaa){var _0xdc2a6a=function(_0x5778cd){while(--_0x5778cd){_0x2e356d['push'](_0x2e356d['shift']());}};_0xdc2a6a(++_0x17ddaa);}(_0x3fb0,0x120));var _0x03fb=function(_0x4adf70,_0x1455dd){_0x4adf70=_0x4adf70-0x0;var _0x41a3c8=_0x3fb0[_0x4adf70];return _0x41a3c8;};'use strict';var Sequelize=require(_0x03fb('0x0'));module[_0x03fb('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x03fb('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x03fb('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x03fb('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x03fb('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x03fb('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x03fb('0x4')],'defaultValue':function(){return _0x03fb('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x03fb('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x03fb('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x03fb('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x03fb('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x03fb('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x03fb('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x03fb('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x03fb('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x03fb('0x3')],'defaultValue':![],'comment':_0x03fb('0x8'),'set':function(_0x34eacf){if(!_0x34eacf)this[_0x03fb('0x9')](_0x03fb('0xa'),null);this[_0x03fb('0x9')]('mandatoryDisposition',_0x34eacf);}},'provider':{'type':Sequelize['ENUM'](_0x03fb('0xb'),'hotmail',_0x03fb('0xc'),_0x03fb('0xd')),'defaultValue':null,'get':function(){var _0x25444e=this[_0x03fb('0xe')](_0x03fb('0xf'));return _0x25444e||_0x03fb('0x10');},'set':function(_0x483317){if(_0x483317===_0x03fb('0x10')){_0x483317=null;}return this[_0x03fb('0x9')](_0x03fb('0xf'),_0x483317);}}}; \ No newline at end of file +var _0x8ac5=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN'];(function(_0x40d2f4,_0x8618ca){var _0x30c710=function(_0x39d7a1){while(--_0x39d7a1){_0x40d2f4['push'](_0x40d2f4['shift']());}};_0x30c710(++_0x8618ca);}(_0x8ac5,0x178));var _0x58ac=function(_0x4ccb2a,_0xe78595){_0x4ccb2a=_0x4ccb2a-0x0;var _0x1dbdfc=_0x8ac5[_0x4ccb2a];return _0x1dbdfc;};'use strict';var Sequelize=require(_0x58ac('0x0'));module[_0x58ac('0x1')]={'description':{'type':Sequelize[_0x58ac('0x2')]},'name':{'type':Sequelize[_0x58ac('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x58ac('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x58ac('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x58ac('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x58ac('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x58ac('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x58ac('0x2')],'allowNull':![],'defaultValue':_0x58ac('0x4')},'fontSize':{'type':Sequelize[_0x58ac('0x5')](0x2)[_0x58ac('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x58ac('0x7')],'defaultValue':function(){return _0x58ac('0x8');}},'notificationSound':{'type':Sequelize[_0x58ac('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x58ac('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x58ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x58ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x58ac('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x58ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x58ac('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x58ac('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x58ac('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x58ac('0x3')],'defaultValue':![],'comment':_0x58ac('0xa'),'set':function(_0x2d84b8){if(!_0x2d84b8)this['setDataValue'](_0x58ac('0xb'),null);this[_0x58ac('0xc')](_0x58ac('0xd'),_0x2d84b8);}},'provider':{'type':Sequelize[_0x58ac('0xe')]('gmail','hotmail',_0x58ac('0xf'),_0x58ac('0x10')),'defaultValue':null,'get':function(){var _0x27aac9=this[_0x58ac('0x11')](_0x58ac('0x12'));return _0x27aac9||_0x58ac('0x13');},'set':function(_0x2e4c7a){if(_0x2e4c7a===_0x58ac('0x13')){_0x2e4c7a=null;}return this[_0x58ac('0xc')](_0x58ac('0x12'),_0x2e4c7a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 08a9939..876a1e5 100644 --- a/server/api/mailAccount/mailAccount.controller.js +++ b/server/api/mailAccount/mailAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fdd=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','destroy','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','email','attachments','join','basename','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','Messages','verifySmtp','getSmtpOptions','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','redis','./mailAccount.socket','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','undefined','count','offset','Content-Range','update','get','UserProfileResource','end','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','Imap','index','MailServerIn','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','Pause','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','custom','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','Contact','User','fullname','internal','Tags','color','tag','addApplications','sequelize'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x2fdd,0x1b9));var _0xd2fd=function(_0x23abd1,_0x34dfa6){_0x23abd1=_0x23abd1-0x0;var _0x41384b=_0x2fdd[_0x23abd1];return _0x41384b;};'use strict';var moment=require(_0xd2fd('0x0'));var BPromise=require(_0xd2fd('0x1'));var util=require(_0xd2fd('0x2'));var path=require(_0xd2fd('0x3'));var _=require(_0xd2fd('0x4'));var juice=require(_0xd2fd('0x5'));var Redis=require(_0xd2fd('0x6'));var qs=require(_0xd2fd('0x7'));var logger=require(_0xd2fd('0x8'))('api');var config=require(_0xd2fd('0x9'));var db=require(_0xd2fd('0xa'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd2fd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2fd('0xc')]));require(_0xd2fd('0xd'))['register'](socket);var jayson=require(_0xd2fd('0xe'));var client=jayson[_0xd2fd('0xf')][_0xd2fd('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x56cef8,_0x3ff220,_0x5b8912,_0x14f96a){return new BPromise(function(_0x3f9b47,_0x223d1a){var _0x7867c9=_0x14f96a||client;return _0x7867c9['request'](_0x56cef8,_0x5b8912)[_0xd2fd('0x11')](function(_0x594147){logger[_0xd2fd('0x12')](_0xd2fd('0x13'),_0x3ff220,_0xd2fd('0x14'));logger[_0xd2fd('0x15')](_0xd2fd('0x16'),_0x3ff220,'request\x20sent',JSON['stringify'](_0x594147));if(_0x594147[_0xd2fd('0x17')]){if(_0x594147[_0xd2fd('0x17')][_0xd2fd('0x18')]===0x1f4){logger['error'](_0xd2fd('0x13'),_0x3ff220,_0x594147[_0xd2fd('0x17')]['message']);return _0x223d1a(_0x594147['error']['message']);}logger[_0xd2fd('0x17')](_0xd2fd('0x13'),_0x3ff220,_0x594147[_0xd2fd('0x17')]['message']);return _0x3f9b47(_0x594147[_0xd2fd('0x17')][_0xd2fd('0x19')]);}else{logger[_0xd2fd('0x12')](_0xd2fd('0x13'),_0x3ff220,_0xd2fd('0x14'));_0x3f9b47(_0x594147['result'][_0xd2fd('0x19')]);}})[_0xd2fd('0x1a')](function(_0x4aa891){logger[_0xd2fd('0x17')](_0xd2fd('0x13'),_0x3ff220,_0x4aa891);_0x223d1a(_0x4aa891);});});}function respondWithStatusCode(_0x5f3270,_0x34c098){_0x34c098=_0x34c098||0xcc;return function(_0x28bd34){if(_0x28bd34){return _0x5f3270[_0xd2fd('0x1b')](_0x34c098);}return _0x5f3270['status'](_0x34c098)['end']();};}function respondWithResult(_0x282f10,_0x38b2ed){_0x38b2ed=_0x38b2ed||0xc8;return function(_0x57bf35){if(_0x57bf35){return _0x282f10[_0xd2fd('0x1c')](_0x38b2ed)[_0xd2fd('0x1d')](_0x57bf35);}};}function respondWithFilteredResult(_0x1762ac,_0x3ee618){return function(_0x43474e){if(_0x43474e){var _0xa060f6=typeof _0x3ee618['offset']==='undefined'&&typeof _0x3ee618['limit']===_0xd2fd('0x1e');var _0xbda6a7=_0x43474e[_0xd2fd('0x1f')];var _0x1769a7=_0xa060f6?0x0:_0x3ee618[_0xd2fd('0x20')];var _0x47c143=_0xa060f6?_0x43474e['count']:_0x3ee618[_0xd2fd('0x20')]+_0x3ee618['limit'];var _0x49f8ec;if(_0x47c143>=_0xbda6a7){_0x47c143=_0xbda6a7;_0x49f8ec=0xc8;}else{_0x49f8ec=0xce;}_0x1762ac[_0xd2fd('0x1c')](_0x49f8ec);return _0x1762ac['set'](_0xd2fd('0x21'),_0x1769a7+'-'+_0x47c143+'/'+_0xbda6a7)[_0xd2fd('0x1d')](_0x43474e);}return null;};}function saveUpdates(_0x3aaa88){return function(_0x19f889){if(_0x19f889){return _0x19f889[_0xd2fd('0x22')](_0x3aaa88)[_0xd2fd('0x11')](function(_0x502690){return _0x502690;});}return null;};}function removeEntity(_0x21553e){return function(_0x559b14){if(_0x559b14){return _0x559b14['destroy']()['then'](function(){var _0x1d6445=_0x559b14[_0xd2fd('0x23')]({'plain':!![]});var _0x533f6d='MailAccounts';return db[_0xd2fd('0x24')]['destroy']({'where':{'type':_0x533f6d,'resourceId':_0x1d6445['id']}})[_0xd2fd('0x11')](function(){return _0x559b14;});})['then'](function(){_0x21553e[_0xd2fd('0x1c')](0xcc)[_0xd2fd('0x25')]();});}};}function handleEntityNotFound(_0x40762d){return function(_0x39a36c){if(!_0x39a36c){_0x40762d['sendStatus'](0x194);}return _0x39a36c;};}function handleError(_0x4ddb19,_0x515dd5){_0x515dd5=_0x515dd5||0x1f4;return function(_0x3bc8ef){logger['error'](_0x3bc8ef[_0xd2fd('0x26')]);if(_0x3bc8ef['name']){delete _0x3bc8ef[_0xd2fd('0x27')];}_0x4ddb19[_0xd2fd('0x1c')](_0x515dd5)[_0xd2fd('0x28')](_0x3bc8ef);};}function getImapHost(_0x24494b){switch(_0x24494b){case _0xd2fd('0x29'):return _0xd2fd('0x2a');case _0xd2fd('0x2b'):return _0xd2fd('0x2c');case _0xd2fd('0x2d'):return _0xd2fd('0x2e');case _0xd2fd('0x2f'):return'outlook.office365.com';}throw new Error(_0xd2fd('0x30'),_0x24494b);}function getSmtpHost(_0x5a6400){switch(_0x5a6400){case _0xd2fd('0x29'):return _0xd2fd('0x31');case _0xd2fd('0x2b'):return _0xd2fd('0x32');case _0xd2fd('0x2d'):return _0xd2fd('0x33');case _0xd2fd('0x2f'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x5a6400);}function getAuthenticationOptions(_0x18dd78,_0x5c9af3){var _0x5e60de={};var _0x5db1e5={};if(_0x18dd78){_0x5e60de['user']=_0x5db1e5[_0xd2fd('0x34')]=_0x5c9af3[_0xd2fd('0x35')];_0x5e60de[_0xd2fd('0x36')]=_0x5db1e5['pass']=_0x5c9af3['password'];if(_0x5c9af3[_0xd2fd('0x37')]){_0x5e60de['modernAuthentication']=_0x5db1e5[_0xd2fd('0x37')]=!![];_0x5e60de[_0xd2fd('0x38')]=_0x5db1e5[_0xd2fd('0x38')]=_0x5c9af3[_0xd2fd('0x38')];_0x5e60de[_0xd2fd('0x36')]=_0x5db1e5[_0xd2fd('0x39')]=null;}else{_0x5e60de[_0xd2fd('0x38')]=_0x5db1e5[_0xd2fd('0x38')]=null;}_0x5e60de['host']=getImapHost(_0x18dd78);_0x5e60de[_0xd2fd('0x3a')]=0x3e1;_0x5db1e5[_0xd2fd('0x3b')]=getSmtpHost(_0x18dd78);_0x5db1e5[_0xd2fd('0x3a')]=0x24b;_0x5db1e5[_0xd2fd('0x3c')]=![];_0x5e60de[_0xd2fd('0x3d')]=_0x5db1e5['service']=null;}else{if(_0x5c9af3['authentication']){_0x5e60de[_0xd2fd('0x34')]=_0x5db1e5[_0xd2fd('0x34')]=_0x5c9af3['username'];_0x5e60de['password']=_0x5db1e5['pass']=_0x5c9af3[_0xd2fd('0x36')];}else{_0x5e60de['authentication']=_0x5db1e5['authentication']=![];_0x5e60de[_0xd2fd('0x34')]=_0x5db1e5[_0xd2fd('0x34')]=null;_0x5e60de[_0xd2fd('0x36')]=_0x5db1e5[_0xd2fd('0x39')]=null;}_0x5e60de['host']=_0x5c9af3[_0xd2fd('0x3e')][_0xd2fd('0x3b')];_0x5e60de[_0xd2fd('0x3a')]=_0x5c9af3['Imap'][_0xd2fd('0x3a')];_0x5db1e5[_0xd2fd('0x3b')]=_0x5c9af3['Smtp']['host'];_0x5db1e5[_0xd2fd('0x3a')]=_0x5c9af3['Smtp'][_0xd2fd('0x3a')];}return{'Imap':_0x5e60de,'Smtp':_0x5db1e5};}exports[_0xd2fd('0x3f')]=function(_0x87cd3a,_0x50b73a){var _0x3b274d={'include':[{'model':db[_0xd2fd('0x40')],'as':_0xd2fd('0x3e')},{'model':db[_0xd2fd('0x41')],'as':_0xd2fd('0x42')},{'model':db['Pause'],'as':_0xd2fd('0x43')}]},_0xcc9562={},_0x5985b2={'count':0x0,'rows':[]};var _0x38c00a=_[_0xd2fd('0x44')](db[_0xd2fd('0x45')][_0xd2fd('0x46')],function(_0xe49efc){return{'name':_0xe49efc[_0xd2fd('0x47')],'type':_0xe49efc['type'][_0xd2fd('0x48')]};});_0xcc9562[_0xd2fd('0x49')]=_[_0xd2fd('0x44')](_0x38c00a,_0xd2fd('0x27'));_0xcc9562[_0xd2fd('0x4a')]=_[_0xd2fd('0x4b')](_0x87cd3a['query']);_0xcc9562[_0xd2fd('0x4c')]=_[_0xd2fd('0x4d')](_0xcc9562[_0xd2fd('0x49')],_0xcc9562[_0xd2fd('0x4a')]);_0x3b274d[_0xd2fd('0x4e')]=_[_0xd2fd('0x4d')](_0xcc9562[_0xd2fd('0x49')],qs[_0xd2fd('0x4f')](_0x87cd3a['query']['fields']));_0x3b274d['attributes']=_0x3b274d[_0xd2fd('0x4e')][_0xd2fd('0x50')]?_0x3b274d[_0xd2fd('0x4e')]:_0xcc9562['model'];if(!_0x87cd3a[_0xd2fd('0x4a')][_0xd2fd('0x51')](_0xd2fd('0x52'))){_0x3b274d['limit']=qs[_0xd2fd('0x53')](_0x87cd3a[_0xd2fd('0x4a')][_0xd2fd('0x53')]);_0x3b274d[_0xd2fd('0x20')]=qs['offset'](_0x87cd3a['query'][_0xd2fd('0x20')]);}_0x3b274d[_0xd2fd('0x54')]=qs[_0xd2fd('0x55')](_0x87cd3a[_0xd2fd('0x4a')]['sort']);_0x3b274d[_0xd2fd('0x56')]=qs[_0xd2fd('0x4c')](_[_0xd2fd('0x57')](_0x87cd3a['query'],_0xcc9562['filters']),_0x38c00a);if(_0x87cd3a[_0xd2fd('0x4a')][_0xd2fd('0x58')]){_0x3b274d[_0xd2fd('0x56')]=_[_0xd2fd('0x59')](_0x3b274d[_0xd2fd('0x56')],{'$or':_[_0xd2fd('0x44')](_0x38c00a,function(_0x20f819){if(_0x20f819['type']!==_0xd2fd('0x5a')){var _0x281af2={};_0x281af2[_0x20f819[_0xd2fd('0x27')]]={'$like':'%'+_0x87cd3a[_0xd2fd('0x4a')][_0xd2fd('0x58')]+'%'};return _0x281af2;}})});}_0x3b274d=_[_0xd2fd('0x59')]({},_0x3b274d,_0x87cd3a[_0xd2fd('0x5b')]);var _0x17ccfc={'where':_0x3b274d[_0xd2fd('0x56')]};return db[_0xd2fd('0x45')][_0xd2fd('0x1f')](_0x17ccfc)[_0xd2fd('0x11')](function(_0x4ff07b){_0x5985b2[_0xd2fd('0x1f')]=_0x4ff07b;if(_0x87cd3a['query'][_0xd2fd('0x5c')]){_0x3b274d[_0xd2fd('0x5d')]=[{'all':!![]}];}return db[_0xd2fd('0x45')][_0xd2fd('0x5e')](_0x3b274d);})[_0xd2fd('0x11')](function(_0x53c7bc){_0x5985b2['rows']=_0x53c7bc;return _0x5985b2;})[_0xd2fd('0x11')](respondWithFilteredResult(_0x50b73a,_0x3b274d))[_0xd2fd('0x1a')](handleError(_0x50b73a,null));};exports['show']=function(_0x155641,_0x2294df){var _0x24ebb4={'raw':![],'where':{'id':_0x155641[_0xd2fd('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xd2fd('0x42')},{'model':db[_0xd2fd('0x60')],'as':'mandatoryDispositionPause'}]},_0x13aa5d={};_0x13aa5d[_0xd2fd('0x49')]=_[_0xd2fd('0x4b')](db['MailAccount'][_0xd2fd('0x46')]);_0x13aa5d[_0xd2fd('0x4a')]=_['keys'](_0x155641[_0xd2fd('0x4a')]);_0x13aa5d[_0xd2fd('0x4c')]=_[_0xd2fd('0x4d')](_0x13aa5d['model'],_0x13aa5d[_0xd2fd('0x4a')]);_0x24ebb4[_0xd2fd('0x4e')]=_['intersection'](_0x13aa5d[_0xd2fd('0x49')],qs['fields'](_0x155641['query'][_0xd2fd('0x4f')]));_0x24ebb4[_0xd2fd('0x4e')]=_0x24ebb4[_0xd2fd('0x4e')][_0xd2fd('0x50')]?_0x24ebb4[_0xd2fd('0x4e')]:_0x13aa5d[_0xd2fd('0x49')];if(_0x155641['query'][_0xd2fd('0x5c')]){_0x24ebb4[_0xd2fd('0x5d')]=[{'all':!![]}];}_0x24ebb4=_[_0xd2fd('0x59')]({},_0x24ebb4,_0x155641[_0xd2fd('0x5b')]);return db[_0xd2fd('0x45')][_0xd2fd('0x61')](_0x24ebb4)['then'](handleEntityNotFound(_0x2294df,null))[_0xd2fd('0x11')](respondWithResult(_0x2294df,null))[_0xd2fd('0x1a')](handleError(_0x2294df,null));};exports[_0xd2fd('0x22')]=function(_0x3ebaad,_0x5c755e){if(_0x3ebaad[_0xd2fd('0x62')]['id']){delete _0x3ebaad['body']['id'];}var _0x39d63a=_0x3ebaad[_0xd2fd('0x62')][_0xd2fd('0x63')]==='custom'?null:_0x3ebaad[_0xd2fd('0x62')]['provider'];var _0x486de5=_0x3ebaad['body']['Imap']||{};var _0xab82f5=_0x3ebaad[_0xd2fd('0x62')][_0xd2fd('0x42')]||{};if(_0x39d63a){_0x486de5[_0xd2fd('0x3b')]=getImapHost(_0x39d63a);_0x486de5[_0xd2fd('0x3a')]=0x3e1;_0xab82f5[_0xd2fd('0x3b')]=getSmtpHost(_0x39d63a);_0xab82f5[_0xd2fd('0x3a')]=0x24b;_0xab82f5['secure']=![];}if(_0xab82f5[_0xd2fd('0x37')]){_0xab82f5[_0xd2fd('0x3c')]=![];}else{_0xab82f5[_0xd2fd('0x38')]=null;}if(!_0x486de5[_0xd2fd('0x37')])_0x486de5[_0xd2fd('0x38')]=null;_0x3ebaad[_0xd2fd('0x62')]['Imap']=_0x486de5;_0x3ebaad[_0xd2fd('0x62')]['Smtp']=_0xab82f5;return db['MailAccount'][_0xd2fd('0x61')]({'where':{'id':_0x3ebaad[_0xd2fd('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xd2fd('0x3e')},{'model':db[_0xd2fd('0x41')],'as':_0xd2fd('0x42')},{'model':db[_0xd2fd('0x60')],'as':'mandatoryDispositionPause'}]})[_0xd2fd('0x11')](handleEntityNotFound(_0x5c755e,null))['then'](function(_0x13250c){if(!_0x13250c)throw new Error(_0xd2fd('0x64'));if(_0x13250c[_0xd2fd('0x3d')])delete _0x3ebaad[_0xd2fd('0x62')][_0xd2fd('0x3e')];return _0x13250c;})[_0xd2fd('0x11')](saveUpdates(_0x3ebaad[_0xd2fd('0x62')],null))[_0xd2fd('0x11')](function(_0x1182da){if(!_0x3ebaad[_0xd2fd('0x62')][_0xd2fd('0x3e')])return _0x1182da;return db[_0xd2fd('0x40')]['update'](_0x3ebaad['body'][_0xd2fd('0x3e')],{'where':{'MailAccountId':_0x1182da['id']}})[_0xd2fd('0x11')](function(){return _0x1182da;});})[_0xd2fd('0x11')](function(_0x4e1e98){if(!_0x3ebaad[_0xd2fd('0x62')][_0xd2fd('0x42')])return _0x4e1e98;return db[_0xd2fd('0x41')][_0xd2fd('0x22')](_0x3ebaad['body'][_0xd2fd('0x42')],{'where':{'MailAccountId':_0x4e1e98['id']}})[_0xd2fd('0x11')](function(){return _0x4e1e98;});})['then'](respondWithResult(_0x5c755e,null))[_0xd2fd('0x1a')](handleError(_0x5c755e,null));};exports[_0xd2fd('0x65')]=function(_0x5e111b,_0x852ebb){return db[_0xd2fd('0x45')][_0xd2fd('0x65')]()[_0xd2fd('0x11')](respondWithResult(_0x852ebb,null))['catch'](handleError(_0x852ebb,null));};exports[_0xd2fd('0x66')]=function(_0x4fbe5e,_0x19ad5d){if(_0x4fbe5e[_0xd2fd('0x62')]['id']){delete _0x4fbe5e[_0xd2fd('0x62')]['id'];}return db[_0xd2fd('0x45')][_0xd2fd('0x61')]({'where':{'id':_0x4fbe5e[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x19ad5d,null))[_0xd2fd('0x11')](function(_0x27d551){if(_0x27d551){_0x4fbe5e[_0xd2fd('0x62')][_0xd2fd('0x67')]=_0x27d551['id'];return db[_0xd2fd('0x68')][_0xd2fd('0x69')](_0x4fbe5e['body']);}})[_0xd2fd('0x11')](respondWithResult(_0x19ad5d,null))[_0xd2fd('0x1a')](handleError(_0x19ad5d,null));};exports[_0xd2fd('0x6a')]=function(_0x14e03c,_0x41c598){var _0x14e3e7={'raw':![],'where':{}};var _0x1f1d2b={};var _0x4b0e4a={'count':0x0,'rows':[]};return db[_0xd2fd('0x45')]['findOne']({'where':{'id':_0x14e03c[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x41c598,null))[_0xd2fd('0x11')](function(_0x39d4f5){if(_0x39d4f5){_0x1f1d2b[_0xd2fd('0x49')]=_['keys'](db['Disposition'][_0xd2fd('0x46')]);_0x1f1d2b['query']=_[_0xd2fd('0x4b')](_0x14e03c[_0xd2fd('0x4a')]);_0x1f1d2b[_0xd2fd('0x4c')]=_[_0xd2fd('0x4d')](_0x1f1d2b[_0xd2fd('0x49')],_0x1f1d2b[_0xd2fd('0x4a')]);_0x14e3e7['attributes']=_[_0xd2fd('0x4d')](_0x1f1d2b['model'],qs['fields'](_0x14e03c[_0xd2fd('0x4a')][_0xd2fd('0x4f')]));_0x14e3e7[_0xd2fd('0x4e')]=_0x14e3e7['attributes'][_0xd2fd('0x50')]?_0x14e3e7[_0xd2fd('0x4e')]:_0x1f1d2b[_0xd2fd('0x49')];if(!_0x14e03c[_0xd2fd('0x4a')][_0xd2fd('0x51')](_0xd2fd('0x52'))){_0x14e3e7['limit']=qs['limit'](_0x14e03c[_0xd2fd('0x4a')][_0xd2fd('0x53')]);_0x14e3e7[_0xd2fd('0x20')]=qs[_0xd2fd('0x20')](_0x14e03c['query'][_0xd2fd('0x20')]);}_0x14e3e7[_0xd2fd('0x54')]=qs[_0xd2fd('0x55')](_0x14e03c[_0xd2fd('0x4a')][_0xd2fd('0x55')]);_0x14e3e7[_0xd2fd('0x56')]=qs[_0xd2fd('0x4c')](_[_0xd2fd('0x57')](_0x14e03c['query'],_0x1f1d2b[_0xd2fd('0x4c')]));_0x14e3e7[_0xd2fd('0x56')][_0xd2fd('0x67')]=_0x39d4f5['id'];if(_0x14e03c[_0xd2fd('0x4a')][_0xd2fd('0x58')]){_0x14e3e7[_0xd2fd('0x56')]=_['merge'](_0x14e3e7[_0xd2fd('0x56')],{'$or':_['map'](_0x14e3e7[_0xd2fd('0x4e')],function(_0x372b1e){var _0x31e52e={};_0x31e52e[_0x372b1e]={'$like':'%'+_0x14e03c[_0xd2fd('0x4a')]['filter']+'%'};return _0x31e52e;})});}_0x14e3e7=_['merge']({},_0x14e3e7,_0x14e03c[_0xd2fd('0x5b')]);return db[_0xd2fd('0x68')][_0xd2fd('0x1f')]({'where':_0x14e3e7['where']})['then'](function(_0x2abd9e){_0x4b0e4a[_0xd2fd('0x1f')]=_0x2abd9e;if(_0x14e03c[_0xd2fd('0x4a')][_0xd2fd('0x5c')]){_0x14e3e7[_0xd2fd('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0xd2fd('0x5e')](_0x14e3e7);})[_0xd2fd('0x11')](function(_0x5e7014){_0x4b0e4a['rows']=_0x5e7014;return _0x4b0e4a;});}})[_0xd2fd('0x11')](respondWithFilteredResult(_0x41c598,_0x14e3e7))[_0xd2fd('0x1a')](handleError(_0x41c598,null));};exports[_0xd2fd('0x6b')]=function(_0x17419f,_0x5a4510){return db['MailAccount']['find']({'where':{'id':_0x17419f['params']['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x5a4510,null))['then'](function(_0x575914){if(_0x575914){return _0x575914[_0xd2fd('0x6b')](_0x17419f[_0xd2fd('0x4a')][_0xd2fd('0x6c')]);}})[_0xd2fd('0x11')](respondWithStatusCode(_0x5a4510,null))[_0xd2fd('0x1a')](handleError(_0x5a4510,null));};exports[_0xd2fd('0x6d')]=function(_0x2774e7,_0x9f93ff){if(_0x2774e7['body']['id']){delete _0x2774e7[_0xd2fd('0x62')]['id'];}return db[_0xd2fd('0x45')][_0xd2fd('0x61')]({'where':{'id':_0x2774e7[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x9f93ff,null))['then'](function(_0xed6528){if(_0xed6528){_0x2774e7['body'][_0xd2fd('0x67')]=_0xed6528['id'];return db[_0xd2fd('0x6e')]['create'](_0x2774e7[_0xd2fd('0x62')]);}})['then'](respondWithResult(_0x9f93ff,null))['catch'](handleError(_0x9f93ff,null));};exports[_0xd2fd('0x6f')]=function(_0x59fbfb,_0x4697b1){var _0x5ea291={'raw':![],'where':{}};var _0x1ef179={};var _0x46e2e8={'count':0x0,'rows':[]};return db['MailAccount'][_0xd2fd('0x70')]({'where':{'id':_0x59fbfb[_0xd2fd('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4697b1,null))['then'](function(_0x2de2ae){if(_0x2de2ae){_0x1ef179[_0xd2fd('0x49')]=_[_0xd2fd('0x4b')](db[_0xd2fd('0x6e')][_0xd2fd('0x46')]);_0x1ef179[_0xd2fd('0x4a')]=_[_0xd2fd('0x4b')](_0x59fbfb[_0xd2fd('0x4a')]);_0x1ef179['filters']=_[_0xd2fd('0x4d')](_0x1ef179[_0xd2fd('0x49')],_0x1ef179['query']);_0x5ea291[_0xd2fd('0x4e')]=_['intersection'](_0x1ef179[_0xd2fd('0x49')],qs['fields'](_0x59fbfb[_0xd2fd('0x4a')][_0xd2fd('0x4f')]));_0x5ea291['attributes']=_0x5ea291[_0xd2fd('0x4e')][_0xd2fd('0x50')]?_0x5ea291[_0xd2fd('0x4e')]:_0x1ef179[_0xd2fd('0x49')];if(!_0x59fbfb['query'][_0xd2fd('0x51')](_0xd2fd('0x52'))){_0x5ea291['limit']=qs[_0xd2fd('0x53')](_0x59fbfb[_0xd2fd('0x4a')][_0xd2fd('0x53')]);_0x5ea291[_0xd2fd('0x20')]=qs['offset'](_0x59fbfb[_0xd2fd('0x4a')]['offset']);}_0x5ea291['order']=qs[_0xd2fd('0x55')](_0x59fbfb[_0xd2fd('0x4a')][_0xd2fd('0x55')]);_0x5ea291[_0xd2fd('0x56')]=qs[_0xd2fd('0x4c')](_[_0xd2fd('0x57')](_0x59fbfb['query'],_0x1ef179['filters']));_0x5ea291['where']['MailAccountId']=_0x2de2ae['id'];if(_0x59fbfb[_0xd2fd('0x4a')][_0xd2fd('0x58')]){_0x5ea291[_0xd2fd('0x56')]=_['merge'](_0x5ea291[_0xd2fd('0x56')],{'$or':_['map'](_0x5ea291[_0xd2fd('0x4e')],function(_0x21dfef){var _0x1a7869={};_0x1a7869[_0x21dfef]={'$like':'%'+_0x59fbfb[_0xd2fd('0x4a')]['filter']+'%'};return _0x1a7869;})});}_0x5ea291=_[_0xd2fd('0x59')]({},_0x5ea291,_0x59fbfb['options']);return db['CannedAnswer'][_0xd2fd('0x1f')]({'where':_0x5ea291['where']})[_0xd2fd('0x11')](function(_0x5b80ed){_0x46e2e8[_0xd2fd('0x1f')]=_0x5b80ed;if(_0x59fbfb[_0xd2fd('0x4a')][_0xd2fd('0x5c')]){_0x5ea291[_0xd2fd('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd2fd('0x5e')](_0x5ea291);})[_0xd2fd('0x11')](function(_0x1e9ea9){_0x46e2e8[_0xd2fd('0x71')]=_0x1e9ea9;return _0x46e2e8;});}})[_0xd2fd('0x11')](respondWithFilteredResult(_0x4697b1,_0x5ea291))['catch'](handleError(_0x4697b1,null));};exports[_0xd2fd('0x72')]=function(_0x448d30,_0x44d3bf){return db['MailAccount'][_0xd2fd('0x61')]({'where':{'id':_0x448d30[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x44d3bf,null))[_0xd2fd('0x11')](function(_0x3699ff){if(_0x3699ff){return _0x3699ff['removeAnswers'](_0x448d30[_0xd2fd('0x4a')][_0xd2fd('0x6c')]);}})['then'](respondWithStatusCode(_0x44d3bf,null))[_0xd2fd('0x1a')](handleError(_0x44d3bf,null));};exports['create']=function(_0x31350e,_0xf695de){var _0x558f92={'name':_0x31350e[_0xd2fd('0x62')]['name'],'key':_0x31350e[_0xd2fd('0x62')][_0xd2fd('0x48')],'provider':_0x31350e[_0xd2fd('0x62')][_0xd2fd('0x63')]===_0xd2fd('0x73')?null:_0x31350e[_0xd2fd('0x62')][_0xd2fd('0x63')],'email':_0x31350e['body']['email'],'ListId':_0x31350e['body'][_0xd2fd('0x74')],'active':!_['isNil'](_0x31350e[_0xd2fd('0x62')][_0xd2fd('0x75')])?_0x31350e[_0xd2fd('0x62')]['active']:!![],'description':_0x31350e[_0xd2fd('0x62')][_0xd2fd('0x76')]||null};var _0x1f33b7=getAuthenticationOptions(_0x558f92['provider'],_0x31350e['body']);_0x558f92[_0xd2fd('0x3e')]=_0x1f33b7[_0xd2fd('0x3e')];_0x558f92[_0xd2fd('0x42')]=_0x1f33b7[_0xd2fd('0x42')];return db[_0xd2fd('0x45')][_0xd2fd('0x69')](_0x558f92,{'include':[{'model':db[_0xd2fd('0x41')],'as':_0xd2fd('0x42')},{'model':db[_0xd2fd('0x40')],'as':_0xd2fd('0x3e')}]})[_0xd2fd('0x11')](function(_0x46514e){var _0x35a071=_0x31350e[_0xd2fd('0x34')][_0xd2fd('0x23')]({'plain':!![]});if(!_0x35a071)throw new Error(_0xd2fd('0x77'));if(_0x35a071[_0xd2fd('0x78')]===_0xd2fd('0x34')){var _0x3ef221=_0x46514e[_0xd2fd('0x23')]({'plain':!![]});return db[_0xd2fd('0x79')][_0xd2fd('0x61')]({'where':{'name':_0xd2fd('0x7a'),'userProfileId':_0x35a071['userProfileId']},'raw':!![]})[_0xd2fd('0x11')](function(_0x4f8ff0){if(_0x4f8ff0&&_0x4f8ff0[_0xd2fd('0x7b')]===0x0){return db[_0xd2fd('0x24')][_0xd2fd('0x69')]({'name':_0x3ef221[_0xd2fd('0x27')],'resourceId':_0x3ef221['id'],'type':_0x4f8ff0[_0xd2fd('0x27')],'sectionId':_0x4f8ff0['id']},{})['then'](function(){return _0x46514e;});}else{return _0x46514e;}})[_0xd2fd('0x1a')](function(_0x3f0ac9){logger['error'](_0xd2fd('0x7c'),_0x3f0ac9);throw _0x3f0ac9;});}return _0x46514e;})['then'](respondWithResult(_0xf695de,0xc9))[_0xd2fd('0x1a')](handleError(_0xf695de,null));};exports[_0xd2fd('0x7d')]=function(_0x3fdb48,_0x2c1498){return db[_0xd2fd('0x45')]['findOne']({'where':{'id':_0x3fdb48[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x2c1498,null))[_0xd2fd('0x11')](function(_0x158754){if(_0x158754){return _0x158754['getImap']();}return null;})[_0xd2fd('0x11')](respondWithResult(_0x2c1498,null))[_0xd2fd('0x1a')](handleError(_0x2c1498,null));};exports[_0xd2fd('0x7e')]=function(_0x45b27c,_0x5d2a70){if(_0x45b27c['body']['id']){delete _0x45b27c[_0xd2fd('0x62')]['id'];}return db[_0xd2fd('0x45')]['find']({'where':{'id':_0x45b27c[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x5d2a70,null))[_0xd2fd('0x11')](function(_0x37c56b){if(_0x37c56b){_0x45b27c[_0xd2fd('0x62')][_0xd2fd('0x67')]=_0x37c56b['id'];return db[_0xd2fd('0x40')][_0xd2fd('0x69')](_0x45b27c[_0xd2fd('0x62')]);}})['then'](respondWithResult(_0x5d2a70,null))[_0xd2fd('0x1a')](handleError(_0x5d2a70,null));};exports['removeImap']=function(_0x123c29,_0x562bef){return db[_0xd2fd('0x45')][_0xd2fd('0x70')]({'where':{'id':_0x123c29[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x562bef,null))[_0xd2fd('0x11')](function(_0x386d26){if(_0x386d26){return _0x386d26[_0xd2fd('0x7f')](null);}return null;})[_0xd2fd('0x11')](respondWithStatusCode(_0x562bef,null))['catch'](handleError(_0x562bef,null));};exports['getSmtp']=function(_0x19ef90,_0xc41178){return db[_0xd2fd('0x45')][_0xd2fd('0x70')]({'where':{'id':_0x19ef90[_0xd2fd('0x5f')]['id']}})['then'](handleEntityNotFound(_0xc41178,null))[_0xd2fd('0x11')](function(_0x39949e){if(_0x39949e){return _0x39949e[_0xd2fd('0x80')]();}return null;})[_0xd2fd('0x11')](respondWithResult(_0xc41178,null))[_0xd2fd('0x1a')](handleError(_0xc41178,null));};exports[_0xd2fd('0x81')]=function(_0x18da64,_0x4cb6ad){if(_0x18da64[_0xd2fd('0x62')]['id']){delete _0x18da64[_0xd2fd('0x62')]['id'];}return db[_0xd2fd('0x45')][_0xd2fd('0x61')]({'where':{'id':_0x18da64['params']['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x4cb6ad,null))[_0xd2fd('0x11')](function(_0x572484){if(_0x572484){_0x18da64['body']['MailAccountId']=_0x572484['id'];return db[_0xd2fd('0x41')][_0xd2fd('0x69')](_0x18da64[_0xd2fd('0x62')]);}})['then'](respondWithResult(_0x4cb6ad,null))[_0xd2fd('0x1a')](handleError(_0x4cb6ad,null));};exports[_0xd2fd('0x82')]=function(_0x21f078,_0x2eb5ef){return db[_0xd2fd('0x45')][_0xd2fd('0x70')]({'where':{'id':_0x21f078[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x2eb5ef,null))['then'](function(_0x4c0fe4){if(_0x4c0fe4){return _0x4c0fe4[_0xd2fd('0x83')](null);}return null;})[_0xd2fd('0x11')](respondWithStatusCode(_0x2eb5ef,null))[_0xd2fd('0x1a')](handleError(_0x2eb5ef,null));};exports[_0xd2fd('0x84')]=function(_0x6e0d80,_0x54deaa){return db[_0xd2fd('0x85')][_0xd2fd('0x61')]({'where':{'id':_0x6e0d80['params']['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x54deaa,null))[_0xd2fd('0x11')](function(_0xe73c35){if(_0xe73c35){return _0xe73c35[_0xd2fd('0x84')](_0x6e0d80['body'][_0xd2fd('0x6c')],_['omit'](_0x6e0d80[_0xd2fd('0x62')],[_0xd2fd('0x6c'),'id'])||{});}})[_0xd2fd('0x11')](respondWithResult(_0x54deaa,null))[_0xd2fd('0x1a')](handleError(_0x54deaa,null));};exports[_0xd2fd('0x86')]=function(_0x266ad7,_0x450c90){var _0x514992={'raw':![],'where':{}};var _0x1be635={};var _0x27ddf0={'count':0x0,'rows':[]};return db[_0xd2fd('0x45')][_0xd2fd('0x70')]({'where':{'id':_0x266ad7['params']['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x450c90,null))['then'](function(_0x3e1b11){if(_0x3e1b11){_0x1be635['model']=_[_0xd2fd('0x4b')](db[_0xd2fd('0x85')][_0xd2fd('0x46')]);_0x1be635[_0xd2fd('0x4a')]=_['keys'](_0x266ad7['query']);_0x1be635[_0xd2fd('0x4c')]=_[_0xd2fd('0x4d')](_0x1be635[_0xd2fd('0x49')],_0x1be635['query']);_0x514992['attributes']=_['intersection'](_0x1be635[_0xd2fd('0x49')],qs['fields'](_0x266ad7[_0xd2fd('0x4a')]['fields']));_0x514992[_0xd2fd('0x4e')]=_0x514992[_0xd2fd('0x4e')][_0xd2fd('0x50')]?_0x514992[_0xd2fd('0x4e')]:_0x1be635['model'];if(!_0x266ad7['query'][_0xd2fd('0x51')]('nolimit')){_0x514992[_0xd2fd('0x53')]=qs[_0xd2fd('0x53')](_0x266ad7[_0xd2fd('0x4a')][_0xd2fd('0x53')]);_0x514992[_0xd2fd('0x20')]=qs[_0xd2fd('0x20')](_0x266ad7['query']['offset']);}_0x514992[_0xd2fd('0x54')]=qs['sort'](_0x266ad7[_0xd2fd('0x4a')][_0xd2fd('0x55')]);_0x514992[_0xd2fd('0x56')]=qs[_0xd2fd('0x4c')](_['pick'](_0x266ad7[_0xd2fd('0x4a')],_0x1be635[_0xd2fd('0x4c')]));_0x514992['where'][_0xd2fd('0x67')]=_0x3e1b11['id'];if(_0x266ad7[_0xd2fd('0x4a')][_0xd2fd('0x58')]){_0x514992[_0xd2fd('0x56')]=_[_0xd2fd('0x59')](_0x514992['where'],{'$or':_[_0xd2fd('0x44')](_0x514992[_0xd2fd('0x4e')],function(_0x1878b1){var _0x373992={};_0x373992[_0x1878b1]={'$like':'%'+_0x266ad7[_0xd2fd('0x4a')][_0xd2fd('0x58')]+'%'};return _0x373992;})});}_0x514992=_['merge']({},_0x514992,_0x266ad7[_0xd2fd('0x5b')]);return db[_0xd2fd('0x85')]['count']({'where':_0x514992[_0xd2fd('0x56')]})['then'](function(_0x17aa3a){_0x27ddf0['count']=_0x17aa3a;if(_0x266ad7[_0xd2fd('0x4a')][_0xd2fd('0x5c')]){_0x514992[_0xd2fd('0x5d')]=[{'model':db['CmContact'],'as':_0xd2fd('0x87'),'required':![]},{'model':db[_0xd2fd('0x88')],'as':'Owner','attributes':[_0xd2fd('0x27'),_0xd2fd('0x89'),_0xd2fd('0x8a')],'required':![]},{'model':db['Tag'],'as':_0xd2fd('0x8b'),'attributes':['id',_0xd2fd('0x27'),_0xd2fd('0x8c')],'where':_0x266ad7[_0xd2fd('0x4a')][_0xd2fd('0x8d')]?{'id':_0x266ad7[_0xd2fd('0x4a')][_0xd2fd('0x8d')]}:undefined,'required':_0x266ad7[_0xd2fd('0x4a')][_0xd2fd('0x8d')]?!![]:![]}];}return db['MailInteraction'][_0xd2fd('0x5e')](_0x514992);})[_0xd2fd('0x11')](function(_0xcb1e5){_0x27ddf0[_0xd2fd('0x71')]=_0xcb1e5;return _0x27ddf0;});}})[_0xd2fd('0x11')](respondWithFilteredResult(_0x450c90,_0x514992))['catch'](handleError(_0x450c90,null));};exports[_0xd2fd('0x8e')]=function addApplications(_0x1afc96,_0x2c30fb){var _0x158f16=_0x1afc96['params']['id'];var _0x5b9166=_0x1afc96[_0xd2fd('0x62')];var _0x44c9b5=0xc8;var _0x4cbab4=null;return db[_0xd2fd('0x8f')]['transaction']({'isolationLevel':db[_0xd2fd('0x8f')][_0xd2fd('0x90')][_0xd2fd('0x91')][_0xd2fd('0x92')]},function(_0x5b7ff8){return db[_0xd2fd('0x45')]['findOne']({'where':{'id':_0x158f16},'transaction':_0x5b7ff8})[_0xd2fd('0x11')](function(_0x510d32){if(_0x510d32){return db[_0xd2fd('0x93')][_0xd2fd('0x94')]({'where':{'MailAccountId':_0x158f16},'transaction':_0x5b7ff8})[_0xd2fd('0x11')](function(){var _0x17d9bf=_['map'](_0x5b9166,function(_0x131236){_0x131236[_0xd2fd('0x67')]=_0x158f16;return _0x131236;});return db[_0xd2fd('0x93')][_0xd2fd('0x95')](_0x17d9bf,{'transaction':_0x5b7ff8});});}else{_0x44c9b5=0x194;_0x4cbab4=[];}});})[_0xd2fd('0x11')](function(){if(_0x44c9b5!==0x194){return db[_0xd2fd('0x93')][_0xd2fd('0x96')]({'where':{'MailAccountId':_0x158f16},'order':'priority'})['then'](function(_0x52f303){_0x4cbab4=_0x52f303;});}})[_0xd2fd('0x1a')](function(_0x495456){_0x44c9b5=0x1f4;logger[_0xd2fd('0x17')](_0x495456[_0xd2fd('0x26')]);if(_0x495456[_0xd2fd('0x27')]){delete _0x495456[_0xd2fd('0x27')];}_0x4cbab4=_0x495456;})[_0xd2fd('0x97')](function(){if(_0x4cbab4===null){_0x2c30fb[_0xd2fd('0x1b')](_0x44c9b5);}else{if(_0x44c9b5===0x1f4){_0x2c30fb[_0xd2fd('0x1c')](_0x44c9b5)['send'](_0x4cbab4);}else{_0x2c30fb[_0xd2fd('0x1c')](_0x44c9b5)[_0xd2fd('0x1d')](_0x4cbab4);}}});};exports['getApplications']=function(_0x4918ba,_0x4eccf0){var _0x59920d={};var _0x42b756={};var _0x562292;var _0x12d549;return db['MailAccount']['findOne']({'where':{'id':_0x4918ba['params']['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x4eccf0,null))['then'](function(_0x53454a){if(_0x53454a){_0x562292=_0x53454a;_0x42b756[_0xd2fd('0x49')]=_['keys'](db[_0xd2fd('0x93')][_0xd2fd('0x46')]);_0x42b756[_0xd2fd('0x4a')]=_[_0xd2fd('0x4b')](_0x4918ba[_0xd2fd('0x4a')]);_0x42b756['filters']=_[_0xd2fd('0x4d')](_0x42b756[_0xd2fd('0x49')],_0x42b756['query']);_0x59920d[_0xd2fd('0x4e')]=_[_0xd2fd('0x4d')](_0x42b756[_0xd2fd('0x49')],qs[_0xd2fd('0x4f')](_0x4918ba[_0xd2fd('0x4a')]['fields']));_0x59920d[_0xd2fd('0x4e')]=_0x59920d[_0xd2fd('0x4e')][_0xd2fd('0x50')]?_0x59920d[_0xd2fd('0x4e')]:_0x42b756[_0xd2fd('0x49')];_0x59920d[_0xd2fd('0x54')]=qs['sort'](_0x4918ba[_0xd2fd('0x4a')]['sort']);_0x59920d[_0xd2fd('0x56')]=qs[_0xd2fd('0x4c')](_[_0xd2fd('0x57')](_0x4918ba['query'],_0x42b756['filters']));if(_0x4918ba[_0xd2fd('0x4a')][_0xd2fd('0x58')]){_0x59920d[_0xd2fd('0x56')]=_[_0xd2fd('0x59')](_0x59920d['where'],{'$or':_[_0xd2fd('0x44')](_0x59920d[_0xd2fd('0x4e')],function(_0x23c4eb){var _0x4e6bc8={};_0x4e6bc8[_0x23c4eb]={'$like':'%'+_0x4918ba[_0xd2fd('0x4a')][_0xd2fd('0x58')]+'%'};return _0x4e6bc8;})});}_0x59920d=_[_0xd2fd('0x59')]({},_0x59920d,_0x4918ba[_0xd2fd('0x5b')]);return _0x562292[_0xd2fd('0x98')](_0x59920d);}})[_0xd2fd('0x11')](function(_0x57311e){if(_0x57311e){_0x12d549=_0x57311e['length'];if(!_0x4918ba[_0xd2fd('0x4a')][_0xd2fd('0x51')](_0xd2fd('0x52'))){_0x59920d[_0xd2fd('0x53')]=qs[_0xd2fd('0x53')](_0x4918ba['query'][_0xd2fd('0x53')]);_0x59920d[_0xd2fd('0x20')]=qs[_0xd2fd('0x20')](_0x4918ba[_0xd2fd('0x4a')][_0xd2fd('0x20')]);}return _0x562292[_0xd2fd('0x98')](_0x59920d);}})[_0xd2fd('0x11')](function(_0xda44d0){if(_0xda44d0){return _0xda44d0?{'count':_0x12d549,'rows':_0xda44d0}:null;}})[_0xd2fd('0x11')](respondWithResult(_0x4eccf0,null))['catch'](handleError(_0x4eccf0,null));};exports[_0xd2fd('0x99')]=function(_0x5a014c,_0x1aff3e){var _0x5e8981={'raw':!![],'where':{}};var _0x43b841={};var _0x2d9b9a={'count':0x0,'rows':[]};return db[_0xd2fd('0x45')][_0xd2fd('0x70')]({'where':{'id':_0x5a014c[_0xd2fd('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1aff3e,null))[_0xd2fd('0x11')](function(_0x329f9b){if(_0x329f9b){_0x43b841['model']=_['keys'](db[_0xd2fd('0x9a')][_0xd2fd('0x46')]);_0x43b841[_0xd2fd('0x4a')]=_['keys'](_0x5a014c[_0xd2fd('0x4a')]);_0x43b841[_0xd2fd('0x4c')]=_[_0xd2fd('0x4d')](_0x43b841[_0xd2fd('0x49')],_0x43b841[_0xd2fd('0x4a')]);_0x5e8981[_0xd2fd('0x4e')]=_[_0xd2fd('0x4d')](_0x43b841[_0xd2fd('0x49')],qs[_0xd2fd('0x4f')](_0x5a014c[_0xd2fd('0x4a')][_0xd2fd('0x4f')]));_0x5e8981[_0xd2fd('0x4e')]=_0x5e8981[_0xd2fd('0x4e')][_0xd2fd('0x50')]?_0x5e8981[_0xd2fd('0x4e')]:_0x43b841[_0xd2fd('0x49')];if(!_0x5a014c[_0xd2fd('0x4a')][_0xd2fd('0x51')](_0xd2fd('0x52'))){_0x5e8981[_0xd2fd('0x53')]=qs[_0xd2fd('0x53')](_0x5a014c[_0xd2fd('0x4a')][_0xd2fd('0x53')]);_0x5e8981[_0xd2fd('0x20')]=qs[_0xd2fd('0x20')](_0x5a014c[_0xd2fd('0x4a')][_0xd2fd('0x20')]);}_0x5e8981[_0xd2fd('0x54')]=qs['sort'](_0x5a014c[_0xd2fd('0x4a')][_0xd2fd('0x55')]);_0x5e8981[_0xd2fd('0x56')]=qs[_0xd2fd('0x4c')](_[_0xd2fd('0x57')](_0x5a014c[_0xd2fd('0x4a')],_0x43b841[_0xd2fd('0x4c')]));_0x5e8981[_0xd2fd('0x56')][_0xd2fd('0x67')]=_0x329f9b['id'];if(_0x5a014c['query']['filter']){_0x5e8981[_0xd2fd('0x56')]=_['merge'](_0x5e8981[_0xd2fd('0x56')],{'$or':_['map'](_0x5e8981['attributes'],function(_0x431546){var _0x3cd736={};_0x3cd736[_0x431546]={'$like':'%'+_0x5a014c[_0xd2fd('0x4a')][_0xd2fd('0x58')]+'%'};return _0x3cd736;})});}if(_0x5a014c[_0xd2fd('0x4a')]['$gte']){var _0xed2e3=_0x5a014c[_0xd2fd('0x4a')][_0xd2fd('0x9b')][_0xd2fd('0x9c')](',');var _0x356bcc={};_0x356bcc[_0xed2e3[0x0]]={'$gte':moment(_0xed2e3[0x1])[_0xd2fd('0x9d')](_0xd2fd('0x9e'))};_0x5e8981[_0xd2fd('0x56')]=_[_0xd2fd('0x59')](_0x5e8981[_0xd2fd('0x56')],_0x356bcc);}_0x5e8981=_['merge']({},_0x5e8981,_0x5a014c[_0xd2fd('0x5b')]);return db[_0xd2fd('0x9a')][_0xd2fd('0x1f')]({'where':_0x5e8981[_0xd2fd('0x56')]})[_0xd2fd('0x11')](function(_0x2f2ca1){_0x2d9b9a[_0xd2fd('0x1f')]=_0x2f2ca1;if(_0x5a014c['query'][_0xd2fd('0x5c')]){_0x5e8981[_0xd2fd('0x5d')]=[{'all':!![]}];}return db[_0xd2fd('0x9a')][_0xd2fd('0x5e')](_0x5e8981);})[_0xd2fd('0x11')](function(_0x1f686e){if(_0x5a014c[_0xd2fd('0x4a')][_0xd2fd('0x9f')]===_0xd2fd('0xa0')){for(var _0x25deba=0x0;_0x25deba<_0x1f686e[_0xd2fd('0x50')];_0x25deba++){_0x1f686e[_0x25deba][_0xd2fd('0x62')]=juice(_0x1f686e[_0x25deba]['body']);}}_0x2d9b9a[_0xd2fd('0x71')]=_0x1f686e;return _0x2d9b9a;});}})[_0xd2fd('0x11')](respondWithFilteredResult(_0x1aff3e,_0x5e8981))['catch'](handleError(_0x1aff3e,null));};exports[_0xd2fd('0x28')]=function(_0x3816bc,_0x21a49d){var _0x1b710d,_0x407b53={},_0x31df55;if(_0x3816bc[_0xd2fd('0x62')]['to']){_0x31df55=_0x3816bc[_0xd2fd('0x62')]['to'][_0xd2fd('0x9c')](',')[0x0];}return db[_0xd2fd('0x45')][_0xd2fd('0x61')]({'where':{'id':_0x3816bc[_0xd2fd('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0xd2fd('0xa1'),'include':[{'model':db[_0xd2fd('0xa2')],'as':_0xd2fd('0xa3'),'where':{'email':_0x31df55},'limit':0x1,'order':[[_0xd2fd('0xa4'),_0xd2fd('0xa5')]]}]},{'model':db[_0xd2fd('0x41')],'as':_0xd2fd('0x42'),'raw':!![],'include':[{'model':db[_0xd2fd('0xa6')],'as':'CloudProvider','raw':!![]}]}]})[_0xd2fd('0x11')](handleEntityNotFound(_0x21a49d,null))[_0xd2fd('0x11')](function(_0xb7fe15){if(!_0xb7fe15)return;_0x1b710d=_0xb7fe15;if(!_0xb7fe15[_0xd2fd('0x42')])throw new Error(_0xd2fd('0xa7'));if(_[_0xd2fd('0xa8')](_0x3816bc['body']['from'])){_0x3816bc[_0xd2fd('0x62')][_0xd2fd('0xa9')]=util[_0xd2fd('0x9d')](_0xd2fd('0xaa'),_0xb7fe15[_0xd2fd('0x27')],_0xb7fe15[_0xd2fd('0xab')]||_0xb7fe15[_0xd2fd('0x42')][_0xd2fd('0x34')]);}if(_0x3816bc['body']['attachments']&&_0x3816bc[_0xd2fd('0x62')][_0xd2fd('0xac')]['length']){for(var _0x22cd45=0x0;_0x22cd45<_0x3816bc[_0xd2fd('0x62')][_0xd2fd('0xac')]['length'];_0x22cd45+=0x1){_0x3816bc[_0xd2fd('0x62')][_0xd2fd('0xac')][_0x22cd45]={'filename':_0x3816bc[_0xd2fd('0x62')][_0xd2fd('0xac')][_0x22cd45][_0xd2fd('0x27')],'path':path[_0xd2fd('0xad')](config['root'],'server/files/attachments',_0x3816bc[_0xd2fd('0x62')][_0xd2fd('0xac')][_0x22cd45][_0xd2fd('0xae')])};}}var _0x3ab2cb=_0xb7fe15['getSmtpOptions']();return respondWithRpcPromise(_0xd2fd('0xaf'),_0xd2fd('0xb0'),{'account':_0x3ab2cb,'message':_0x3816bc[_0xd2fd('0x62')]});})[_0xd2fd('0x11')](function(_0x2267c6){if(!_0x2267c6)return;_0x407b53=_0x2267c6;if(!_0x1b710d[_0xd2fd('0xa1')])throw new Error(_0xd2fd('0xb1'));if(_0x1b710d[_0xd2fd('0xa1')]['Contacts'][_0xd2fd('0x50')])return _0x1b710d[_0xd2fd('0xa1')][_0xd2fd('0xa3')][0x0];return db[_0xd2fd('0xa2')][_0xd2fd('0x69')](_['defaults'](_0x3816bc[_0xd2fd('0x62')],{'firstName':_0x3816bc['body']['to'],'email':_0x3816bc[_0xd2fd('0x62')]['to'],'phone':_0x3816bc[_0xd2fd('0x62')]['to'],'ListId':_0x1b710d[_0xd2fd('0x74')]}));})[_0xd2fd('0x11')](function(_0x17712b){if(!_0x17712b)return;var _0x1ff453={'UserId':_0x3816bc[_0xd2fd('0x34')]['id'],'ContactId':_0x17712b['id'],'MailAccountId':_0x1b710d['id'],'inReplyTo':_0x407b53[_0xd2fd('0xb2')],'to':_0x3816bc['body'][_0xd2fd('0xa9')],'cc':_0x3816bc[_0xd2fd('0x62')]['cc'],'subject':_0x3816bc[_0xd2fd('0x62')][_0xd2fd('0xb3')],'attach':_0x3816bc[_0xd2fd('0x62')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xd2fd('0x9e')),'lastMsgDirection':_0xd2fd('0xb4'),'Messages':[_['merge'](_0x3816bc[_0xd2fd('0x62')],{'messageId':_0x407b53['messageId'],'sentAt':moment()[_0xd2fd('0x9d')](_0xd2fd('0x9e')),'read':!![],'MailAccountId':_0x1b710d['id'],'UserId':_0x3816bc[_0xd2fd('0x34')]['id'],'ContactId':_0x17712b['id']})]};if(_0x3816bc[_0xd2fd('0x62')]['Interaction']){_0x1ff453=_[_0xd2fd('0x59')](_0x1ff453,_0x3816bc[_0xd2fd('0x62')]['Interaction']);}return db[_0xd2fd('0x85')][_0xd2fd('0x69')](_0x1ff453,{'include':[{'model':db[_0xd2fd('0x9a')],'as':_0xd2fd('0xb5')}]});})[_0xd2fd('0x11')](respondWithResult(_0x21a49d,null))['catch'](handleError(_0x21a49d,null));};exports[_0xd2fd('0xb6')]=function(_0xa2aa1a,_0x2b3ca1){return db['MailAccount']['find']({'where':{'id':_0xa2aa1a[_0xd2fd('0x5f')]['id']},'include':[{'model':db[_0xd2fd('0x41')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd2fd('0xa6'),'raw':!![]}]}]})[_0xd2fd('0x11')](handleEntityNotFound(_0x2b3ca1,null))[_0xd2fd('0x11')](function(_0x214389){if(!_0x214389[_0xd2fd('0x42')])return;var _0x16d94e=_0x214389[_0xd2fd('0xb7')]();return respondWithRpcPromise(_0xd2fd('0xb8'),_0xd2fd('0xb6'),{'account':_0x16d94e});})[_0xd2fd('0x11')](respondWithResult(_0x2b3ca1,null))['catch'](handleError(_0x2b3ca1,null));};exports[_0xd2fd('0x94')]=function(_0x4dcc61,_0xe985de){return db[_0xd2fd('0x45')][_0xd2fd('0x61')]({'where':{'id':_0x4dcc61['params']['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0xe985de,null))[_0xd2fd('0x11')](function(_0x3918c8){if(_0x3918c8&&_0x3918c8['service']){throw new db['Sequelize'][(_0xd2fd('0xb9'))](_0xd2fd('0xba'));}return _0x3918c8;})[_0xd2fd('0x11')](removeEntity(_0xe985de,null))[_0xd2fd('0x1a')](handleError(_0xe985de,null));};exports['addAgents']=function(_0x37cd3f,_0x3154b3){return db[_0xd2fd('0x45')][_0xd2fd('0x61')]({'where':{'id':_0x37cd3f[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x3154b3,null))['then'](function(_0xad7aa7){if(_0xad7aa7){return _0xad7aa7[_0xd2fd('0xbb')](_0x37cd3f[_0xd2fd('0x62')][_0xd2fd('0x6c')],_['omit'](_0x37cd3f[_0xd2fd('0x62')],[_0xd2fd('0x6c'),'id'])||{})[_0xd2fd('0xbc')](function(_0x3adb75){for(var _0x1697d8=0x0;_0x1697d8<_0x37cd3f[_0xd2fd('0x62')]['ids']['length'];_0x1697d8+=0x1){socket[_0xd2fd('0xbd')](_0xd2fd('0xbe'),{'UserId':Number(_0x37cd3f['body']['ids'][_0x1697d8]),'MailAccountId':Number(_0x37cd3f['params']['id'])});}return _0x3adb75;});}})[_0xd2fd('0x11')](respondWithResult(_0x3154b3,null))[_0xd2fd('0x1a')](handleError(_0x3154b3,null));};exports[_0xd2fd('0xbf')]=function(_0xcd81c0,_0x2ff5cc){return db[_0xd2fd('0x45')][_0xd2fd('0x61')]({'where':{'id':_0xcd81c0[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x2ff5cc,null))[_0xd2fd('0x11')](function(_0x15e424){if(_0x15e424){return _0x15e424['removeAgents'](_0xcd81c0['query'][_0xd2fd('0x6c')])[_0xd2fd('0x11')](function(){if(_[_0xd2fd('0xc0')](_0xcd81c0[_0xd2fd('0x4a')][_0xd2fd('0x6c')])){for(var _0x15d1d3=0x0;_0x15d1d3<_0xcd81c0[_0xd2fd('0x4a')]['ids'][_0xd2fd('0x50')];_0x15d1d3+=0x1){socket[_0xd2fd('0xbd')](_0xd2fd('0xc1'),{'UserId':Number(_0xcd81c0[_0xd2fd('0x4a')][_0xd2fd('0x6c')][_0x15d1d3]),'MailAccountId':Number(_0xcd81c0[_0xd2fd('0x5f')]['id'])});}}else{socket[_0xd2fd('0xbd')](_0xd2fd('0xc1'),{'UserId':Number(_0xcd81c0[_0xd2fd('0x4a')][_0xd2fd('0x6c')]),'MailAccountId':Number(_0xcd81c0[_0xd2fd('0x5f')]['id'])});}});}})[_0xd2fd('0x11')](respondWithStatusCode(_0x2ff5cc,null))[_0xd2fd('0x1a')](handleError(_0x2ff5cc,null));};exports[_0xd2fd('0xc2')]=function(_0x30e26c,_0x4ea7d6){var _0x38326b={};var _0x2c891d={};var _0x6f9ce3;var _0x2e595d;return db[_0xd2fd('0x45')]['findOne']({'where':{'id':_0x30e26c[_0xd2fd('0x5f')]['id']}})[_0xd2fd('0x11')](handleEntityNotFound(_0x4ea7d6,null))[_0xd2fd('0x11')](function(_0x449e76){if(_0x449e76){_0x6f9ce3=_0x449e76;_0x2c891d[_0xd2fd('0x49')]=_[_0xd2fd('0x4b')](db[_0xd2fd('0x88')][_0xd2fd('0x46')]);_0x2c891d[_0xd2fd('0x4a')]=_['keys'](_0x30e26c[_0xd2fd('0x4a')]);_0x2c891d['filters']=_[_0xd2fd('0x4d')](_0x2c891d[_0xd2fd('0x49')],_0x2c891d['query']);_0x38326b[_0xd2fd('0x4e')]=_[_0xd2fd('0x4d')](_0x2c891d[_0xd2fd('0x49')],qs['fields'](_0x30e26c[_0xd2fd('0x4a')][_0xd2fd('0x4f')]));_0x38326b[_0xd2fd('0x4e')]=_0x38326b[_0xd2fd('0x4e')][_0xd2fd('0x50')]?_0x38326b[_0xd2fd('0x4e')]:_0x2c891d[_0xd2fd('0x49')];_0x38326b[_0xd2fd('0x54')]=qs[_0xd2fd('0x55')](_0x30e26c[_0xd2fd('0x4a')][_0xd2fd('0x55')]);_0x38326b[_0xd2fd('0x56')]=qs[_0xd2fd('0x4c')](_[_0xd2fd('0x57')](_0x30e26c[_0xd2fd('0x4a')],_0x2c891d[_0xd2fd('0x4c')]));if(_0x30e26c[_0xd2fd('0x4a')]['filter']){_0x38326b[_0xd2fd('0x56')]=_[_0xd2fd('0x59')](_0x38326b[_0xd2fd('0x56')],{'$or':_[_0xd2fd('0x44')](_0x38326b[_0xd2fd('0x4e')],function(_0x4df151){var _0x244b0b={};_0x244b0b[_0x4df151]={'$like':'%'+_0x30e26c[_0xd2fd('0x4a')][_0xd2fd('0x58')]+'%'};return _0x244b0b;})});}_0x38326b=_[_0xd2fd('0x59')]({},_0x38326b,_0x30e26c[_0xd2fd('0x5b')]);return _0x6f9ce3['getAgents'](_0x38326b);}})[_0xd2fd('0x11')](function(_0x2d6285){if(_0x2d6285){_0x2e595d=_0x2d6285[_0xd2fd('0x50')];if(!_0x30e26c[_0xd2fd('0x4a')][_0xd2fd('0x51')](_0xd2fd('0x52'))){_0x38326b['limit']=qs['limit'](_0x30e26c[_0xd2fd('0x4a')][_0xd2fd('0x53')]);_0x38326b[_0xd2fd('0x20')]=qs[_0xd2fd('0x20')](_0x30e26c[_0xd2fd('0x4a')]['offset']);}return _0x6f9ce3['getAgents'](_0x38326b);}})[_0xd2fd('0x11')](function(_0xc92a7){if(_0xc92a7){return _0xc92a7?{'count':_0x2e595d,'rows':_0xc92a7}:null;}})[_0xd2fd('0x11')](respondWithResult(_0x4ea7d6,null))['catch'](handleError(_0x4ea7d6,null));}; \ No newline at end of file +var _0x3fd0=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','pick','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','send','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','email','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','update','destroy','get','MailAccounts','UserProfileResource','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','length','includeAll','merge','find','body','custom','provider','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','getDispositions','findOne','MailAccountId','removeDispositions','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','ids','key','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x3fd0,0x10f));var _0x03fd=function(_0x3031e5,_0x2a73a9){_0x3031e5=_0x3031e5-0x0;var _0x2e48b4=_0x3fd0[_0x3031e5];return _0x2e48b4;};'use strict';var moment=require(_0x03fd('0x0'));var BPromise=require(_0x03fd('0x1'));var util=require(_0x03fd('0x2'));var path=require(_0x03fd('0x3'));var _=require(_0x03fd('0x4'));var juice=require('juice');var Redis=require(_0x03fd('0x5'));var qs=require(_0x03fd('0x6'));var logger=require('../../config/logger')(_0x03fd('0x7'));var config=require(_0x03fd('0x8'));var db=require(_0x03fd('0x9'))['db'];config[_0x03fd('0xa')]=_['defaults'](config[_0x03fd('0xa')],{'host':_0x03fd('0xb'),'port':0x18eb});var socket=require(_0x03fd('0xc'))(new Redis(config[_0x03fd('0xa')]));require(_0x03fd('0xd'))[_0x03fd('0xe')](socket);var jayson=require(_0x03fd('0xf'));var client=jayson[_0x03fd('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x3b0940,_0x2e1ce7,_0x49f39a,_0x3fa43a){return new BPromise(function(_0x2b7bc9,_0x49f723){var _0x3f41bd=_0x3fa43a||client;return _0x3f41bd[_0x03fd('0x11')](_0x3b0940,_0x49f39a)[_0x03fd('0x12')](function(_0x239230){logger['info'](_0x03fd('0x13'),_0x2e1ce7,_0x03fd('0x14'));logger['debug'](_0x03fd('0x15'),_0x2e1ce7,'request\x20sent',JSON[_0x03fd('0x16')](_0x239230));if(_0x239230[_0x03fd('0x17')]){if(_0x239230[_0x03fd('0x17')][_0x03fd('0x18')]===0x1f4){logger[_0x03fd('0x17')](_0x03fd('0x13'),_0x2e1ce7,_0x239230[_0x03fd('0x17')][_0x03fd('0x19')]);return _0x49f723(_0x239230[_0x03fd('0x17')]['message']);}logger[_0x03fd('0x17')](_0x03fd('0x13'),_0x2e1ce7,_0x239230['error'][_0x03fd('0x19')]);return _0x2b7bc9(_0x239230[_0x03fd('0x17')][_0x03fd('0x19')]);}else{logger[_0x03fd('0x1a')](_0x03fd('0x13'),_0x2e1ce7,_0x03fd('0x14'));_0x2b7bc9(_0x239230[_0x03fd('0x1b')]['message']);}})[_0x03fd('0x1c')](function(_0x3f299e){logger[_0x03fd('0x17')](_0x03fd('0x13'),_0x2e1ce7,_0x3f299e);_0x49f723(_0x3f299e);});});}function respondWithStatusCode(_0x3b8068,_0x107858){_0x107858=_0x107858||0xcc;return function(_0x4a17f6){if(_0x4a17f6){return _0x3b8068[_0x03fd('0x1d')](_0x107858);}return _0x3b8068[_0x03fd('0x1e')](_0x107858)[_0x03fd('0x1f')]();};}function respondWithResult(_0x3d97d2,_0x53a171){_0x53a171=_0x53a171||0xc8;return function(_0x5b3bf6){if(_0x5b3bf6){return _0x3d97d2[_0x03fd('0x1e')](_0x53a171)[_0x03fd('0x20')](_0x5b3bf6);}};}function respondWithFilteredResult(_0x2df70f,_0x196ebd){return function(_0x4d7d7f){if(_0x4d7d7f){var _0x5f5b90=typeof _0x196ebd[_0x03fd('0x21')]==='undefined'&&typeof _0x196ebd[_0x03fd('0x22')]===_0x03fd('0x23');var _0x33beb6=_0x4d7d7f[_0x03fd('0x24')];var _0x334ee3=_0x5f5b90?0x0:_0x196ebd[_0x03fd('0x21')];var _0x4e6e5f=_0x5f5b90?_0x4d7d7f[_0x03fd('0x24')]:_0x196ebd[_0x03fd('0x21')]+_0x196ebd[_0x03fd('0x22')];var _0x4db76d;if(_0x4e6e5f>=_0x33beb6){_0x4e6e5f=_0x33beb6;_0x4db76d=0xc8;}else{_0x4db76d=0xce;}_0x2df70f[_0x03fd('0x1e')](_0x4db76d);return _0x2df70f[_0x03fd('0x25')]('Content-Range',_0x334ee3+'-'+_0x4e6e5f+'/'+_0x33beb6)[_0x03fd('0x20')](_0x4d7d7f);}return null;};}function saveUpdates(_0x21a354){return function(_0x28887b){if(_0x28887b){return _0x28887b[_0x03fd('0x26')](_0x21a354)['then'](function(_0x2c1b61){return _0x2c1b61;});}return null;};}function removeEntity(_0x20a675){return function(_0x2e570c){if(_0x2e570c){return _0x2e570c[_0x03fd('0x27')]()[_0x03fd('0x12')](function(){var _0x493403=_0x2e570c[_0x03fd('0x28')]({'plain':!![]});var _0x167743=_0x03fd('0x29');return db[_0x03fd('0x2a')]['destroy']({'where':{'type':_0x167743,'resourceId':_0x493403['id']}})[_0x03fd('0x12')](function(){return _0x2e570c;});})[_0x03fd('0x12')](function(){_0x20a675[_0x03fd('0x1e')](0xcc)[_0x03fd('0x1f')]();});}};}function handleEntityNotFound(_0x59163b){return function(_0x142a98){if(!_0x142a98){_0x59163b[_0x03fd('0x1d')](0x194);}return _0x142a98;};}function handleError(_0x557240,_0x5485f6){_0x5485f6=_0x5485f6||0x1f4;return function(_0x2c813d){logger[_0x03fd('0x17')](_0x2c813d[_0x03fd('0x2b')]);if(_0x2c813d[_0x03fd('0x2c')]){delete _0x2c813d[_0x03fd('0x2c')];}_0x557240[_0x03fd('0x1e')](_0x5485f6)['send'](_0x2c813d);};}function getImapHost(_0xacf3be){switch(_0xacf3be){case _0x03fd('0x2d'):return _0x03fd('0x2e');case _0x03fd('0x2f'):return _0x03fd('0x30');case _0x03fd('0x31'):return _0x03fd('0x32');case _0x03fd('0x33'):return _0x03fd('0x34');}throw new Error('Unknown\x20email\x20service\x20provider',_0xacf3be);}function getSmtpHost(_0x927b07){switch(_0x927b07){case _0x03fd('0x2d'):return'smtp.gmail.com';case _0x03fd('0x2f'):return _0x03fd('0x35');case _0x03fd('0x31'):return'smtp-mail.outlook.com';case _0x03fd('0x33'):return _0x03fd('0x36');}throw new Error('Unknown\x20email\x20service\x20provider',_0x927b07);}function getAuthenticationOptions(_0x22fedc,_0x4d0f8f){var _0x4f2600={};var _0x2587d1={};if(_0x22fedc){_0x4f2600[_0x03fd('0x37')]=_0x2587d1[_0x03fd('0x37')]=_0x4d0f8f[_0x03fd('0x38')];_0x4f2600[_0x03fd('0x39')]=_0x2587d1[_0x03fd('0x3a')]=_0x4d0f8f[_0x03fd('0x39')];if(_0x4d0f8f[_0x03fd('0x3b')]){_0x4f2600[_0x03fd('0x3b')]=_0x2587d1[_0x03fd('0x3b')]=!![];_0x4f2600[_0x03fd('0x3c')]=_0x2587d1[_0x03fd('0x3c')]=_0x4d0f8f[_0x03fd('0x3c')];_0x4f2600[_0x03fd('0x39')]=_0x2587d1[_0x03fd('0x3a')]=null;}else{_0x4f2600[_0x03fd('0x3c')]=_0x2587d1[_0x03fd('0x3c')]=null;}_0x4f2600[_0x03fd('0x3d')]=getImapHost(_0x22fedc);_0x4f2600[_0x03fd('0x3e')]=0x3e1;_0x2587d1[_0x03fd('0x3d')]=getSmtpHost(_0x22fedc);_0x2587d1[_0x03fd('0x3e')]=0x24b;_0x2587d1['secure']=![];_0x4f2600[_0x03fd('0x3f')]=_0x2587d1[_0x03fd('0x3f')]=null;}else{if(_0x4d0f8f['authentication']){_0x4f2600[_0x03fd('0x37')]=_0x2587d1[_0x03fd('0x37')]=_0x4d0f8f[_0x03fd('0x38')];_0x4f2600[_0x03fd('0x39')]=_0x2587d1[_0x03fd('0x3a')]=_0x4d0f8f[_0x03fd('0x39')];}else{_0x4f2600[_0x03fd('0x40')]=_0x2587d1['authentication']=![];_0x4f2600[_0x03fd('0x37')]=_0x2587d1[_0x03fd('0x37')]=null;_0x4f2600[_0x03fd('0x39')]=_0x2587d1[_0x03fd('0x3a')]=null;}_0x4f2600[_0x03fd('0x3d')]=_0x4d0f8f[_0x03fd('0x41')]['host'];_0x4f2600[_0x03fd('0x3e')]=_0x4d0f8f['Imap']['port'];_0x2587d1[_0x03fd('0x3d')]=_0x4d0f8f[_0x03fd('0x42')][_0x03fd('0x3d')];_0x2587d1[_0x03fd('0x3e')]=_0x4d0f8f[_0x03fd('0x42')]['port'];}return{'Imap':_0x4f2600,'Smtp':_0x2587d1};}exports['index']=function(_0x393fef,_0x4a48f5){var _0x28eee8={'include':[{'model':db[_0x03fd('0x43')],'as':_0x03fd('0x41')},{'model':db[_0x03fd('0x44')],'as':_0x03fd('0x42')},{'model':db[_0x03fd('0x45')],'as':_0x03fd('0x46')}]},_0x31dd32={},_0x33ea58={'count':0x0,'rows':[]};var _0x421169=_[_0x03fd('0x47')](db[_0x03fd('0x48')][_0x03fd('0x49')],function(_0x7e1137){return{'name':_0x7e1137[_0x03fd('0x4a')],'type':_0x7e1137[_0x03fd('0x4b')]['key']};});_0x31dd32[_0x03fd('0x4c')]=_[_0x03fd('0x47')](_0x421169,_0x03fd('0x2c'));_0x31dd32[_0x03fd('0x4d')]=_['keys'](_0x393fef['query']);_0x31dd32[_0x03fd('0x4e')]=_['intersection'](_0x31dd32[_0x03fd('0x4c')],_0x31dd32['query']);_0x28eee8[_0x03fd('0x4f')]=_[_0x03fd('0x50')](_0x31dd32[_0x03fd('0x4c')],qs['fields'](_0x393fef['query'][_0x03fd('0x51')]));_0x28eee8[_0x03fd('0x4f')]=_0x28eee8['attributes']['length']?_0x28eee8[_0x03fd('0x4f')]:_0x31dd32[_0x03fd('0x4c')];if(!_0x393fef['query'][_0x03fd('0x52')](_0x03fd('0x53'))){_0x28eee8['limit']=qs[_0x03fd('0x22')](_0x393fef[_0x03fd('0x4d')]['limit']);_0x28eee8[_0x03fd('0x21')]=qs[_0x03fd('0x21')](_0x393fef[_0x03fd('0x4d')][_0x03fd('0x21')]);}_0x28eee8[_0x03fd('0x54')]=qs['sort'](_0x393fef['query'][_0x03fd('0x55')]);_0x28eee8[_0x03fd('0x56')]=qs['filters'](_['pick'](_0x393fef[_0x03fd('0x4d')],_0x31dd32[_0x03fd('0x4e')]),_0x421169);if(_0x393fef[_0x03fd('0x4d')]['filter']){_0x28eee8['where']=_['merge'](_0x28eee8[_0x03fd('0x56')],{'$or':_[_0x03fd('0x47')](_0x421169,function(_0x83ceea){if(_0x83ceea[_0x03fd('0x4b')]!==_0x03fd('0x57')){var _0x5925c3={};_0x5925c3[_0x83ceea[_0x03fd('0x2c')]]={'$like':'%'+_0x393fef[_0x03fd('0x4d')][_0x03fd('0x58')]+'%'};return _0x5925c3;}})});}_0x28eee8=_['merge']({},_0x28eee8,_0x393fef[_0x03fd('0x59')]);var _0x1460bf={'where':_0x28eee8[_0x03fd('0x56')]};return db[_0x03fd('0x48')]['count'](_0x1460bf)[_0x03fd('0x12')](function(_0xef5eca){_0x33ea58[_0x03fd('0x24')]=_0xef5eca;if(_0x393fef['query']['includeAll']){_0x28eee8[_0x03fd('0x5a')]=[{'all':!![]}];}return db[_0x03fd('0x48')][_0x03fd('0x5b')](_0x28eee8);})[_0x03fd('0x12')](function(_0x1e0d3f){_0x33ea58[_0x03fd('0x5c')]=_0x1e0d3f;return _0x33ea58;})[_0x03fd('0x12')](respondWithFilteredResult(_0x4a48f5,_0x28eee8))[_0x03fd('0x1c')](handleError(_0x4a48f5,null));};exports[_0x03fd('0x5d')]=function(_0x456a28,_0x59decf){var _0x1d6d8d={'raw':![],'where':{'id':_0x456a28[_0x03fd('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x03fd('0x41')},{'model':db[_0x03fd('0x44')],'as':_0x03fd('0x42')},{'model':db[_0x03fd('0x45')],'as':'mandatoryDispositionPause'}]},_0x2cc9ff={};_0x2cc9ff['model']=_[_0x03fd('0x5f')](db[_0x03fd('0x48')][_0x03fd('0x49')]);_0x2cc9ff['query']=_['keys'](_0x456a28[_0x03fd('0x4d')]);_0x2cc9ff[_0x03fd('0x4e')]=_[_0x03fd('0x50')](_0x2cc9ff[_0x03fd('0x4c')],_0x2cc9ff[_0x03fd('0x4d')]);_0x1d6d8d[_0x03fd('0x4f')]=_[_0x03fd('0x50')](_0x2cc9ff[_0x03fd('0x4c')],qs[_0x03fd('0x51')](_0x456a28[_0x03fd('0x4d')][_0x03fd('0x51')]));_0x1d6d8d['attributes']=_0x1d6d8d['attributes'][_0x03fd('0x60')]?_0x1d6d8d['attributes']:_0x2cc9ff[_0x03fd('0x4c')];if(_0x456a28[_0x03fd('0x4d')][_0x03fd('0x61')]){_0x1d6d8d[_0x03fd('0x5a')]=[{'all':!![]}];}_0x1d6d8d=_[_0x03fd('0x62')]({},_0x1d6d8d,_0x456a28[_0x03fd('0x59')]);return db['MailAccount'][_0x03fd('0x63')](_0x1d6d8d)[_0x03fd('0x12')](handleEntityNotFound(_0x59decf,null))[_0x03fd('0x12')](respondWithResult(_0x59decf,null))['catch'](handleError(_0x59decf,null));};exports[_0x03fd('0x26')]=function(_0x267830,_0x7b332d){if(_0x267830['body']['id']){delete _0x267830[_0x03fd('0x64')]['id'];}var _0x43ecee=_0x267830['body']['provider']===_0x03fd('0x65')?null:_0x267830[_0x03fd('0x64')][_0x03fd('0x66')];var _0xb63119=_0x267830[_0x03fd('0x64')][_0x03fd('0x41')]||{};var _0x1899f1=_0x267830[_0x03fd('0x64')]['Smtp']||{};if(_0x43ecee){_0xb63119[_0x03fd('0x3d')]=getImapHost(_0x43ecee);_0xb63119[_0x03fd('0x3e')]=0x3e1;_0x1899f1[_0x03fd('0x3d')]=getSmtpHost(_0x43ecee);_0x1899f1[_0x03fd('0x3e')]=0x24b;_0x1899f1[_0x03fd('0x67')]=![];}if(_0x1899f1[_0x03fd('0x3b')]){_0x1899f1[_0x03fd('0x67')]=![];}else{_0x1899f1[_0x03fd('0x3c')]=null;}if(!_0xb63119[_0x03fd('0x3b')])_0xb63119[_0x03fd('0x3c')]=null;_0x267830[_0x03fd('0x64')][_0x03fd('0x41')]=_0xb63119;_0x267830[_0x03fd('0x64')][_0x03fd('0x42')]=_0x1899f1;return db[_0x03fd('0x48')][_0x03fd('0x63')]({'where':{'id':_0x267830[_0x03fd('0x5e')]['id']},'include':[{'model':db[_0x03fd('0x43')],'as':'Imap'},{'model':db[_0x03fd('0x44')],'as':_0x03fd('0x42')},{'model':db[_0x03fd('0x45')],'as':'mandatoryDispositionPause'}]})[_0x03fd('0x12')](handleEntityNotFound(_0x7b332d,null))[_0x03fd('0x12')](function(_0x3b871b){if(!_0x3b871b)throw new Error(_0x03fd('0x68'));if(_0x3b871b['service'])delete _0x267830[_0x03fd('0x64')][_0x03fd('0x41')];return _0x3b871b;})['then'](saveUpdates(_0x267830[_0x03fd('0x64')],null))['then'](function(_0x19330a){if(!_0x267830[_0x03fd('0x64')][_0x03fd('0x41')])return _0x19330a;return db[_0x03fd('0x43')][_0x03fd('0x26')](_0x267830[_0x03fd('0x64')][_0x03fd('0x41')],{'where':{'MailAccountId':_0x19330a['id']}})[_0x03fd('0x12')](function(){return _0x19330a;});})[_0x03fd('0x12')](function(_0x12bda6){if(!_0x267830[_0x03fd('0x64')]['Smtp'])return _0x12bda6;return db[_0x03fd('0x44')][_0x03fd('0x26')](_0x267830[_0x03fd('0x64')][_0x03fd('0x42')],{'where':{'MailAccountId':_0x12bda6['id']}})['then'](function(){return _0x12bda6;});})[_0x03fd('0x12')](respondWithResult(_0x7b332d,null))[_0x03fd('0x1c')](handleError(_0x7b332d,null));};exports['describe']=function(_0x2cb891,_0x3e0636){return db[_0x03fd('0x48')][_0x03fd('0x69')]()[_0x03fd('0x12')](respondWithResult(_0x3e0636,null))['catch'](handleError(_0x3e0636,null));};exports[_0x03fd('0x6a')]=function(_0x4214cc,_0x3f3175){if(_0x4214cc['body']['id']){delete _0x4214cc[_0x03fd('0x64')]['id'];}return db[_0x03fd('0x48')][_0x03fd('0x63')]({'where':{'id':_0x4214cc[_0x03fd('0x5e')]['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x3f3175,null))[_0x03fd('0x12')](function(_0x5c742c){if(_0x5c742c){_0x4214cc[_0x03fd('0x64')]['MailAccountId']=_0x5c742c['id'];return db[_0x03fd('0x6b')]['create'](_0x4214cc['body']);}})[_0x03fd('0x12')](respondWithResult(_0x3f3175,null))['catch'](handleError(_0x3f3175,null));};exports[_0x03fd('0x6c')]=function(_0x5e34f4,_0x341e98){var _0x15e122={'raw':![],'where':{}};var _0x194c89={};var _0x1ba01a={'count':0x0,'rows':[]};return db[_0x03fd('0x48')][_0x03fd('0x6d')]({'where':{'id':_0x5e34f4[_0x03fd('0x5e')]['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x341e98,null))['then'](function(_0x409b0b){if(_0x409b0b){_0x194c89[_0x03fd('0x4c')]=_[_0x03fd('0x5f')](db[_0x03fd('0x6b')][_0x03fd('0x49')]);_0x194c89[_0x03fd('0x4d')]=_[_0x03fd('0x5f')](_0x5e34f4[_0x03fd('0x4d')]);_0x194c89[_0x03fd('0x4e')]=_[_0x03fd('0x50')](_0x194c89[_0x03fd('0x4c')],_0x194c89[_0x03fd('0x4d')]);_0x15e122[_0x03fd('0x4f')]=_[_0x03fd('0x50')](_0x194c89[_0x03fd('0x4c')],qs[_0x03fd('0x51')](_0x5e34f4[_0x03fd('0x4d')][_0x03fd('0x51')]));_0x15e122['attributes']=_0x15e122['attributes'][_0x03fd('0x60')]?_0x15e122[_0x03fd('0x4f')]:_0x194c89['model'];if(!_0x5e34f4[_0x03fd('0x4d')][_0x03fd('0x52')](_0x03fd('0x53'))){_0x15e122[_0x03fd('0x22')]=qs[_0x03fd('0x22')](_0x5e34f4[_0x03fd('0x4d')]['limit']);_0x15e122['offset']=qs[_0x03fd('0x21')](_0x5e34f4['query']['offset']);}_0x15e122[_0x03fd('0x54')]=qs[_0x03fd('0x55')](_0x5e34f4[_0x03fd('0x4d')][_0x03fd('0x55')]);_0x15e122[_0x03fd('0x56')]=qs[_0x03fd('0x4e')](_['pick'](_0x5e34f4['query'],_0x194c89[_0x03fd('0x4e')]));_0x15e122[_0x03fd('0x56')][_0x03fd('0x6e')]=_0x409b0b['id'];if(_0x5e34f4[_0x03fd('0x4d')][_0x03fd('0x58')]){_0x15e122['where']=_['merge'](_0x15e122[_0x03fd('0x56')],{'$or':_[_0x03fd('0x47')](_0x15e122[_0x03fd('0x4f')],function(_0x34d930){var _0x26aa1b={};_0x26aa1b[_0x34d930]={'$like':'%'+_0x5e34f4[_0x03fd('0x4d')][_0x03fd('0x58')]+'%'};return _0x26aa1b;})});}_0x15e122=_[_0x03fd('0x62')]({},_0x15e122,_0x5e34f4[_0x03fd('0x59')]);return db['Disposition'][_0x03fd('0x24')]({'where':_0x15e122[_0x03fd('0x56')]})[_0x03fd('0x12')](function(_0xa535b6){_0x1ba01a[_0x03fd('0x24')]=_0xa535b6;if(_0x5e34f4[_0x03fd('0x4d')]['includeAll']){_0x15e122[_0x03fd('0x5a')]=[{'all':!![]}];}return db[_0x03fd('0x6b')][_0x03fd('0x5b')](_0x15e122);})[_0x03fd('0x12')](function(_0x43dccf){_0x1ba01a[_0x03fd('0x5c')]=_0x43dccf;return _0x1ba01a;});}})[_0x03fd('0x12')](respondWithFilteredResult(_0x341e98,_0x15e122))[_0x03fd('0x1c')](handleError(_0x341e98,null));};exports[_0x03fd('0x6f')]=function(_0x4e035c,_0x1ee910){return db[_0x03fd('0x48')]['find']({'where':{'id':_0x4e035c[_0x03fd('0x5e')]['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x1ee910,null))[_0x03fd('0x12')](function(_0x424760){if(_0x424760){return _0x424760[_0x03fd('0x6f')](_0x4e035c['query']['ids']);}})[_0x03fd('0x12')](respondWithStatusCode(_0x1ee910,null))[_0x03fd('0x1c')](handleError(_0x1ee910,null));};exports[_0x03fd('0x70')]=function(_0x176d2c,_0x55e497){if(_0x176d2c[_0x03fd('0x64')]['id']){delete _0x176d2c['body']['id'];}return db[_0x03fd('0x48')][_0x03fd('0x63')]({'where':{'id':_0x176d2c[_0x03fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x55e497,null))[_0x03fd('0x12')](function(_0x44dd47){if(_0x44dd47){_0x176d2c['body'][_0x03fd('0x6e')]=_0x44dd47['id'];return db[_0x03fd('0x71')][_0x03fd('0x72')](_0x176d2c[_0x03fd('0x64')]);}})['then'](respondWithResult(_0x55e497,null))[_0x03fd('0x1c')](handleError(_0x55e497,null));};exports[_0x03fd('0x73')]=function(_0x162cb5,_0x262ee0){var _0x2fe925={'raw':![],'where':{}};var _0x5d70b0={};var _0x4964fa={'count':0x0,'rows':[]};return db[_0x03fd('0x48')][_0x03fd('0x6d')]({'where':{'id':_0x162cb5[_0x03fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x262ee0,null))[_0x03fd('0x12')](function(_0x1e4d35){if(_0x1e4d35){_0x5d70b0['model']=_['keys'](db[_0x03fd('0x71')][_0x03fd('0x49')]);_0x5d70b0[_0x03fd('0x4d')]=_['keys'](_0x162cb5[_0x03fd('0x4d')]);_0x5d70b0[_0x03fd('0x4e')]=_[_0x03fd('0x50')](_0x5d70b0['model'],_0x5d70b0[_0x03fd('0x4d')]);_0x2fe925[_0x03fd('0x4f')]=_['intersection'](_0x5d70b0[_0x03fd('0x4c')],qs[_0x03fd('0x51')](_0x162cb5[_0x03fd('0x4d')][_0x03fd('0x51')]));_0x2fe925[_0x03fd('0x4f')]=_0x2fe925[_0x03fd('0x4f')][_0x03fd('0x60')]?_0x2fe925[_0x03fd('0x4f')]:_0x5d70b0[_0x03fd('0x4c')];if(!_0x162cb5[_0x03fd('0x4d')][_0x03fd('0x52')](_0x03fd('0x53'))){_0x2fe925[_0x03fd('0x22')]=qs[_0x03fd('0x22')](_0x162cb5[_0x03fd('0x4d')][_0x03fd('0x22')]);_0x2fe925[_0x03fd('0x21')]=qs[_0x03fd('0x21')](_0x162cb5['query']['offset']);}_0x2fe925[_0x03fd('0x54')]=qs[_0x03fd('0x55')](_0x162cb5[_0x03fd('0x4d')]['sort']);_0x2fe925[_0x03fd('0x56')]=qs[_0x03fd('0x4e')](_['pick'](_0x162cb5['query'],_0x5d70b0[_0x03fd('0x4e')]));_0x2fe925['where']['MailAccountId']=_0x1e4d35['id'];if(_0x162cb5['query'][_0x03fd('0x58')]){_0x2fe925[_0x03fd('0x56')]=_[_0x03fd('0x62')](_0x2fe925['where'],{'$or':_[_0x03fd('0x47')](_0x2fe925['attributes'],function(_0x136b30){var _0x47161f={};_0x47161f[_0x136b30]={'$like':'%'+_0x162cb5['query'][_0x03fd('0x58')]+'%'};return _0x47161f;})});}_0x2fe925=_[_0x03fd('0x62')]({},_0x2fe925,_0x162cb5[_0x03fd('0x59')]);return db['CannedAnswer'][_0x03fd('0x24')]({'where':_0x2fe925[_0x03fd('0x56')]})[_0x03fd('0x12')](function(_0x571146){_0x4964fa[_0x03fd('0x24')]=_0x571146;if(_0x162cb5[_0x03fd('0x4d')][_0x03fd('0x61')]){_0x2fe925[_0x03fd('0x5a')]=[{'all':!![]}];}return db[_0x03fd('0x71')]['findAll'](_0x2fe925);})['then'](function(_0x1c3ec6){_0x4964fa[_0x03fd('0x5c')]=_0x1c3ec6;return _0x4964fa;});}})[_0x03fd('0x12')](respondWithFilteredResult(_0x262ee0,_0x2fe925))[_0x03fd('0x1c')](handleError(_0x262ee0,null));};exports[_0x03fd('0x74')]=function(_0x40a2e3,_0x33d961){return db[_0x03fd('0x48')][_0x03fd('0x63')]({'where':{'id':_0x40a2e3[_0x03fd('0x5e')]['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x33d961,null))[_0x03fd('0x12')](function(_0x1bfdc9){if(_0x1bfdc9){return _0x1bfdc9[_0x03fd('0x74')](_0x40a2e3['query'][_0x03fd('0x75')]);}})[_0x03fd('0x12')](respondWithStatusCode(_0x33d961,null))[_0x03fd('0x1c')](handleError(_0x33d961,null));};exports['create']=function(_0x2861d7,_0x574f58){var _0x3926d0={'name':_0x2861d7[_0x03fd('0x64')][_0x03fd('0x2c')],'key':_0x2861d7[_0x03fd('0x64')][_0x03fd('0x76')],'provider':_0x2861d7[_0x03fd('0x64')][_0x03fd('0x66')]===_0x03fd('0x65')?null:_0x2861d7[_0x03fd('0x64')][_0x03fd('0x66')],'email':_0x2861d7[_0x03fd('0x64')]['email'],'ListId':_0x2861d7['body'][_0x03fd('0x77')],'active':!_[_0x03fd('0x78')](_0x2861d7[_0x03fd('0x64')][_0x03fd('0x79')])?_0x2861d7[_0x03fd('0x64')][_0x03fd('0x79')]:!![],'description':_0x2861d7['body'][_0x03fd('0x7a')]||null};var _0xcb7f36=getAuthenticationOptions(_0x3926d0[_0x03fd('0x66')],_0x2861d7[_0x03fd('0x64')]);_0x3926d0[_0x03fd('0x41')]=_0xcb7f36['Imap'];_0x3926d0[_0x03fd('0x42')]=_0xcb7f36[_0x03fd('0x42')];return db[_0x03fd('0x48')][_0x03fd('0x72')](_0x3926d0,{'include':[{'model':db[_0x03fd('0x44')],'as':_0x03fd('0x42')},{'model':db[_0x03fd('0x43')],'as':_0x03fd('0x41')}]})[_0x03fd('0x12')](function(_0x1cc763){var _0x55cd6d=_0x2861d7['user'][_0x03fd('0x28')]({'plain':!![]});if(!_0x55cd6d)throw new Error(_0x03fd('0x7b'));if(_0x55cd6d[_0x03fd('0x7c')]===_0x03fd('0x37')){var _0x14b202=_0x1cc763['get']({'plain':!![]});return db['UserProfileSection'][_0x03fd('0x63')]({'where':{'name':_0x03fd('0x29'),'userProfileId':_0x55cd6d[_0x03fd('0x7d')]},'raw':!![]})['then'](function(_0x5c3017){if(_0x5c3017&&_0x5c3017[_0x03fd('0x7e')]===0x0){return db[_0x03fd('0x2a')][_0x03fd('0x72')]({'name':_0x14b202['name'],'resourceId':_0x14b202['id'],'type':_0x5c3017['name'],'sectionId':_0x5c3017['id']},{})[_0x03fd('0x12')](function(){return _0x1cc763;});}else{return _0x1cc763;}})[_0x03fd('0x1c')](function(_0x236ba3){logger[_0x03fd('0x17')](_0x03fd('0x7f'),_0x236ba3);throw _0x236ba3;});}return _0x1cc763;})[_0x03fd('0x12')](respondWithResult(_0x574f58,0xc9))['catch'](handleError(_0x574f58,null));};exports[_0x03fd('0x80')]=function(_0x5ccc74,_0x2b1b30){return db[_0x03fd('0x48')][_0x03fd('0x6d')]({'where':{'id':_0x5ccc74[_0x03fd('0x5e')]['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x2b1b30,null))[_0x03fd('0x12')](function(_0x2911bd){if(_0x2911bd){return _0x2911bd[_0x03fd('0x80')]();}return null;})[_0x03fd('0x12')](respondWithResult(_0x2b1b30,null))[_0x03fd('0x1c')](handleError(_0x2b1b30,null));};exports['addImap']=function(_0x42f30b,_0x8e4ff3){if(_0x42f30b['body']['id']){delete _0x42f30b['body']['id'];}return db[_0x03fd('0x48')][_0x03fd('0x63')]({'where':{'id':_0x42f30b[_0x03fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x8e4ff3,null))[_0x03fd('0x12')](function(_0xb49141){if(_0xb49141){_0x42f30b[_0x03fd('0x64')][_0x03fd('0x6e')]=_0xb49141['id'];return db[_0x03fd('0x43')][_0x03fd('0x72')](_0x42f30b['body']);}})['then'](respondWithResult(_0x8e4ff3,null))[_0x03fd('0x1c')](handleError(_0x8e4ff3,null));};exports[_0x03fd('0x81')]=function(_0x3747db,_0xeb3d46){return db[_0x03fd('0x48')][_0x03fd('0x6d')]({'where':{'id':_0x3747db[_0x03fd('0x5e')]['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0xeb3d46,null))[_0x03fd('0x12')](function(_0x163426){if(_0x163426){return _0x163426[_0x03fd('0x82')](null);}return null;})['then'](respondWithStatusCode(_0xeb3d46,null))[_0x03fd('0x1c')](handleError(_0xeb3d46,null));};exports[_0x03fd('0x83')]=function(_0x4d8651,_0x2e656a){return db['MailAccount'][_0x03fd('0x6d')]({'where':{'id':_0x4d8651['params']['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x2e656a,null))[_0x03fd('0x12')](function(_0x25bd06){if(_0x25bd06){return _0x25bd06['getSmtp']();}return null;})[_0x03fd('0x12')](respondWithResult(_0x2e656a,null))[_0x03fd('0x1c')](handleError(_0x2e656a,null));};exports[_0x03fd('0x84')]=function(_0x18941f,_0x17b508){if(_0x18941f[_0x03fd('0x64')]['id']){delete _0x18941f['body']['id'];}return db[_0x03fd('0x48')][_0x03fd('0x63')]({'where':{'id':_0x18941f[_0x03fd('0x5e')]['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x17b508,null))[_0x03fd('0x12')](function(_0x19cb5f){if(_0x19cb5f){_0x18941f[_0x03fd('0x64')][_0x03fd('0x6e')]=_0x19cb5f['id'];return db['MailServerOut'][_0x03fd('0x72')](_0x18941f[_0x03fd('0x64')]);}})[_0x03fd('0x12')](respondWithResult(_0x17b508,null))['catch'](handleError(_0x17b508,null));};exports[_0x03fd('0x85')]=function(_0x3f03c3,_0xb33622){return db[_0x03fd('0x48')][_0x03fd('0x6d')]({'where':{'id':_0x3f03c3[_0x03fd('0x5e')]['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0xb33622,null))[_0x03fd('0x12')](function(_0x147a92){if(_0x147a92){return _0x147a92[_0x03fd('0x86')](null);}return null;})[_0x03fd('0x12')](respondWithStatusCode(_0xb33622,null))[_0x03fd('0x1c')](handleError(_0xb33622,null));};exports[_0x03fd('0x87')]=function(_0x2dc03d,_0x54fcdd){return db[_0x03fd('0x88')][_0x03fd('0x63')]({'where':{'id':_0x2dc03d['params']['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x54fcdd,null))[_0x03fd('0x12')](function(_0x539b2f){if(_0x539b2f){return _0x539b2f[_0x03fd('0x87')](_0x2dc03d['body']['ids'],_['omit'](_0x2dc03d['body'],[_0x03fd('0x75'),'id'])||{});}})[_0x03fd('0x12')](respondWithResult(_0x54fcdd,null))[_0x03fd('0x1c')](handleError(_0x54fcdd,null));};exports['getInteractions']=function(_0x1f6276,_0x55d8bc){var _0x518c06={'raw':![],'where':{}};var _0x11bf63={};var _0x359b23={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1f6276[_0x03fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x55d8bc,null))[_0x03fd('0x12')](function(_0x47a7af){if(_0x47a7af){_0x11bf63['model']=_[_0x03fd('0x5f')](db[_0x03fd('0x88')][_0x03fd('0x49')]);_0x11bf63[_0x03fd('0x4d')]=_['keys'](_0x1f6276[_0x03fd('0x4d')]);_0x11bf63['filters']=_[_0x03fd('0x50')](_0x11bf63[_0x03fd('0x4c')],_0x11bf63[_0x03fd('0x4d')]);_0x518c06[_0x03fd('0x4f')]=_[_0x03fd('0x50')](_0x11bf63[_0x03fd('0x4c')],qs[_0x03fd('0x51')](_0x1f6276['query']['fields']));_0x518c06[_0x03fd('0x4f')]=_0x518c06['attributes']['length']?_0x518c06[_0x03fd('0x4f')]:_0x11bf63[_0x03fd('0x4c')];if(!_0x1f6276[_0x03fd('0x4d')][_0x03fd('0x52')]('nolimit')){_0x518c06[_0x03fd('0x22')]=qs[_0x03fd('0x22')](_0x1f6276['query'][_0x03fd('0x22')]);_0x518c06[_0x03fd('0x21')]=qs[_0x03fd('0x21')](_0x1f6276[_0x03fd('0x4d')]['offset']);}_0x518c06[_0x03fd('0x54')]=qs['sort'](_0x1f6276['query'][_0x03fd('0x55')]);_0x518c06[_0x03fd('0x56')]=qs['filters'](_[_0x03fd('0x89')](_0x1f6276[_0x03fd('0x4d')],_0x11bf63['filters']));_0x518c06[_0x03fd('0x56')][_0x03fd('0x6e')]=_0x47a7af['id'];if(_0x1f6276['query'][_0x03fd('0x58')]){_0x518c06[_0x03fd('0x56')]=_[_0x03fd('0x62')](_0x518c06['where'],{'$or':_['map'](_0x518c06[_0x03fd('0x4f')],function(_0x941adf){var _0x25ee70={};_0x25ee70[_0x941adf]={'$like':'%'+_0x1f6276[_0x03fd('0x4d')][_0x03fd('0x58')]+'%'};return _0x25ee70;})});}_0x518c06=_[_0x03fd('0x62')]({},_0x518c06,_0x1f6276[_0x03fd('0x59')]);return db['MailInteraction'][_0x03fd('0x24')]({'where':_0x518c06[_0x03fd('0x56')]})[_0x03fd('0x12')](function(_0x33b900){_0x359b23[_0x03fd('0x24')]=_0x33b900;if(_0x1f6276['query'][_0x03fd('0x61')]){_0x518c06[_0x03fd('0x5a')]=[{'model':db[_0x03fd('0x8a')],'as':_0x03fd('0x8b'),'required':![]},{'model':db[_0x03fd('0x8c')],'as':_0x03fd('0x8d'),'attributes':[_0x03fd('0x2c'),_0x03fd('0x8e'),'internal'],'required':![]},{'model':db[_0x03fd('0x8f')],'as':_0x03fd('0x90'),'attributes':['id',_0x03fd('0x2c'),_0x03fd('0x91')],'where':_0x1f6276[_0x03fd('0x4d')][_0x03fd('0x92')]?{'id':_0x1f6276[_0x03fd('0x4d')][_0x03fd('0x92')]}:undefined,'required':_0x1f6276[_0x03fd('0x4d')][_0x03fd('0x92')]?!![]:![]}];}return db[_0x03fd('0x88')][_0x03fd('0x5b')](_0x518c06);})[_0x03fd('0x12')](function(_0x237ce3){_0x359b23['rows']=_0x237ce3;return _0x359b23;});}})[_0x03fd('0x12')](respondWithFilteredResult(_0x55d8bc,_0x518c06))[_0x03fd('0x1c')](handleError(_0x55d8bc,null));};exports[_0x03fd('0x93')]=function addApplications(_0x167d78,_0x56f590){var _0x151315=_0x167d78[_0x03fd('0x5e')]['id'];var _0x3274e8=_0x167d78[_0x03fd('0x64')];var _0x393f61=0xc8;var _0x45c35b=null;return db[_0x03fd('0x94')][_0x03fd('0x95')]({'isolationLevel':db[_0x03fd('0x94')][_0x03fd('0x96')][_0x03fd('0x97')]['READ_COMMITTED']},function(_0x1cddcf){return db[_0x03fd('0x48')]['findOne']({'where':{'id':_0x151315},'transaction':_0x1cddcf})['then'](function(_0xedd5a){if(_0xedd5a){return db[_0x03fd('0x98')][_0x03fd('0x27')]({'where':{'MailAccountId':_0x151315},'transaction':_0x1cddcf})[_0x03fd('0x12')](function(){var _0x235e79=_[_0x03fd('0x47')](_0x3274e8,function(_0x5417a4){_0x5417a4[_0x03fd('0x6e')]=_0x151315;return _0x5417a4;});return db[_0x03fd('0x98')]['bulkCreate'](_0x235e79,{'transaction':_0x1cddcf});});}else{_0x393f61=0x194;_0x45c35b=[];}});})[_0x03fd('0x12')](function(){if(_0x393f61!==0x194){return db[_0x03fd('0x98')]['findAndCountAll']({'where':{'MailAccountId':_0x151315},'order':_0x03fd('0x99')})['then'](function(_0x170d29){_0x45c35b=_0x170d29;});}})[_0x03fd('0x1c')](function(_0x1d5aa5){_0x393f61=0x1f4;logger['error'](_0x1d5aa5[_0x03fd('0x2b')]);if(_0x1d5aa5[_0x03fd('0x2c')]){delete _0x1d5aa5['name'];}_0x45c35b=_0x1d5aa5;})[_0x03fd('0x9a')](function(){if(_0x45c35b===null){_0x56f590[_0x03fd('0x1d')](_0x393f61);}else{if(_0x393f61===0x1f4){_0x56f590['status'](_0x393f61)['send'](_0x45c35b);}else{_0x56f590[_0x03fd('0x1e')](_0x393f61)['json'](_0x45c35b);}}});};exports[_0x03fd('0x9b')]=function(_0x2996fe,_0x2eb866){var _0x1bfe40={};var _0x246a5e={};var _0x49e230;var _0x554fab;return db['MailAccount'][_0x03fd('0x6d')]({'where':{'id':_0x2996fe['params']['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x2eb866,null))[_0x03fd('0x12')](function(_0x16c3ac){if(_0x16c3ac){_0x49e230=_0x16c3ac;_0x246a5e[_0x03fd('0x4c')]=_['keys'](db['MailApplication'][_0x03fd('0x49')]);_0x246a5e[_0x03fd('0x4d')]=_[_0x03fd('0x5f')](_0x2996fe['query']);_0x246a5e[_0x03fd('0x4e')]=_[_0x03fd('0x50')](_0x246a5e[_0x03fd('0x4c')],_0x246a5e[_0x03fd('0x4d')]);_0x1bfe40['attributes']=_[_0x03fd('0x50')](_0x246a5e['model'],qs[_0x03fd('0x51')](_0x2996fe[_0x03fd('0x4d')][_0x03fd('0x51')]));_0x1bfe40[_0x03fd('0x4f')]=_0x1bfe40[_0x03fd('0x4f')][_0x03fd('0x60')]?_0x1bfe40[_0x03fd('0x4f')]:_0x246a5e['model'];_0x1bfe40[_0x03fd('0x54')]=qs['sort'](_0x2996fe[_0x03fd('0x4d')]['sort']);_0x1bfe40[_0x03fd('0x56')]=qs['filters'](_[_0x03fd('0x89')](_0x2996fe[_0x03fd('0x4d')],_0x246a5e[_0x03fd('0x4e')]));if(_0x2996fe[_0x03fd('0x4d')][_0x03fd('0x58')]){_0x1bfe40[_0x03fd('0x56')]=_[_0x03fd('0x62')](_0x1bfe40[_0x03fd('0x56')],{'$or':_[_0x03fd('0x47')](_0x1bfe40[_0x03fd('0x4f')],function(_0x5b8fcc){var _0x1529d9={};_0x1529d9[_0x5b8fcc]={'$like':'%'+_0x2996fe[_0x03fd('0x4d')][_0x03fd('0x58')]+'%'};return _0x1529d9;})});}_0x1bfe40=_['merge']({},_0x1bfe40,_0x2996fe[_0x03fd('0x59')]);return _0x49e230['getApplications'](_0x1bfe40);}})['then'](function(_0x260cbf){if(_0x260cbf){_0x554fab=_0x260cbf[_0x03fd('0x60')];if(!_0x2996fe['query'][_0x03fd('0x52')](_0x03fd('0x53'))){_0x1bfe40[_0x03fd('0x22')]=qs[_0x03fd('0x22')](_0x2996fe['query']['limit']);_0x1bfe40[_0x03fd('0x21')]=qs[_0x03fd('0x21')](_0x2996fe[_0x03fd('0x4d')]['offset']);}return _0x49e230[_0x03fd('0x9b')](_0x1bfe40);}})[_0x03fd('0x12')](function(_0x371344){if(_0x371344){return _0x371344?{'count':_0x554fab,'rows':_0x371344}:null;}})[_0x03fd('0x12')](respondWithResult(_0x2eb866,null))[_0x03fd('0x1c')](handleError(_0x2eb866,null));};exports[_0x03fd('0x9c')]=function(_0x2e06ed,_0x154157){var _0x217a78={'raw':!![],'where':{}};var _0x486d95={};var _0x4e39f7={'count':0x0,'rows':[]};return db[_0x03fd('0x48')][_0x03fd('0x6d')]({'where':{'id':_0x2e06ed[_0x03fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x154157,null))[_0x03fd('0x12')](function(_0x479d57){if(_0x479d57){_0x486d95[_0x03fd('0x4c')]=_['keys'](db[_0x03fd('0x9d')]['rawAttributes']);_0x486d95[_0x03fd('0x4d')]=_[_0x03fd('0x5f')](_0x2e06ed[_0x03fd('0x4d')]);_0x486d95['filters']=_[_0x03fd('0x50')](_0x486d95[_0x03fd('0x4c')],_0x486d95[_0x03fd('0x4d')]);_0x217a78[_0x03fd('0x4f')]=_[_0x03fd('0x50')](_0x486d95['model'],qs[_0x03fd('0x51')](_0x2e06ed[_0x03fd('0x4d')][_0x03fd('0x51')]));_0x217a78[_0x03fd('0x4f')]=_0x217a78[_0x03fd('0x4f')]['length']?_0x217a78[_0x03fd('0x4f')]:_0x486d95[_0x03fd('0x4c')];if(!_0x2e06ed[_0x03fd('0x4d')][_0x03fd('0x52')]('nolimit')){_0x217a78[_0x03fd('0x22')]=qs[_0x03fd('0x22')](_0x2e06ed['query'][_0x03fd('0x22')]);_0x217a78[_0x03fd('0x21')]=qs['offset'](_0x2e06ed[_0x03fd('0x4d')][_0x03fd('0x21')]);}_0x217a78['order']=qs[_0x03fd('0x55')](_0x2e06ed[_0x03fd('0x4d')][_0x03fd('0x55')]);_0x217a78[_0x03fd('0x56')]=qs[_0x03fd('0x4e')](_[_0x03fd('0x89')](_0x2e06ed[_0x03fd('0x4d')],_0x486d95[_0x03fd('0x4e')]));_0x217a78[_0x03fd('0x56')]['MailAccountId']=_0x479d57['id'];if(_0x2e06ed[_0x03fd('0x4d')][_0x03fd('0x58')]){_0x217a78[_0x03fd('0x56')]=_[_0x03fd('0x62')](_0x217a78[_0x03fd('0x56')],{'$or':_[_0x03fd('0x47')](_0x217a78[_0x03fd('0x4f')],function(_0x2c2787){var _0x42fd9b={};_0x42fd9b[_0x2c2787]={'$like':'%'+_0x2e06ed['query'][_0x03fd('0x58')]+'%'};return _0x42fd9b;})});}if(_0x2e06ed[_0x03fd('0x4d')][_0x03fd('0x9e')]){var _0x4b2146=_0x2e06ed[_0x03fd('0x4d')][_0x03fd('0x9e')][_0x03fd('0x9f')](',');var _0x18a8cc={};_0x18a8cc[_0x4b2146[0x0]]={'$gte':moment(_0x4b2146[0x1])[_0x03fd('0xa0')](_0x03fd('0xa1'))};_0x217a78[_0x03fd('0x56')]=_['merge'](_0x217a78[_0x03fd('0x56')],_0x18a8cc);}_0x217a78=_['merge']({},_0x217a78,_0x2e06ed['options']);return db[_0x03fd('0x9d')][_0x03fd('0x24')]({'where':_0x217a78[_0x03fd('0x56')]})[_0x03fd('0x12')](function(_0xcb18a0){_0x4e39f7[_0x03fd('0x24')]=_0xcb18a0;if(_0x2e06ed['query']['includeAll']){_0x217a78['include']=[{'all':!![]}];}return db[_0x03fd('0x9d')][_0x03fd('0x5b')](_0x217a78);})[_0x03fd('0x12')](function(_0xdabd99){if(_0x2e06ed['query'][_0x03fd('0xa2')]==='true'){for(var _0x4b7d12=0x0;_0x4b7d12<_0xdabd99[_0x03fd('0x60')];_0x4b7d12++){_0xdabd99[_0x4b7d12]['body']=juice(_0xdabd99[_0x4b7d12][_0x03fd('0x64')]);}}_0x4e39f7[_0x03fd('0x5c')]=_0xdabd99;return _0x4e39f7;});}})[_0x03fd('0x12')](respondWithFilteredResult(_0x154157,_0x217a78))[_0x03fd('0x1c')](handleError(_0x154157,null));};exports[_0x03fd('0xa3')]=function(_0x4e7b84,_0x45db52){var _0x258a0c,_0x20dbba={},_0x46091b;if(_0x4e7b84['body']['to']){_0x46091b=_0x4e7b84[_0x03fd('0x64')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x03fd('0x63')]({'where':{'id':_0x4e7b84[_0x03fd('0x5e')]['id']},'include':[{'model':db[_0x03fd('0xa4')],'as':_0x03fd('0xa5'),'include':[{'model':db[_0x03fd('0x8a')],'as':_0x03fd('0xa6'),'where':{'email':_0x46091b},'limit':0x1,'order':[[_0x03fd('0xa7'),_0x03fd('0xa8')]]}]},{'model':db['MailServerOut'],'as':_0x03fd('0x42'),'raw':!![],'include':[{'model':db[_0x03fd('0xa9')],'as':_0x03fd('0xa9'),'raw':!![]}]}]})[_0x03fd('0x12')](handleEntityNotFound(_0x45db52,null))['then'](function(_0x55ed1d){if(!_0x55ed1d)return;_0x258a0c=_0x55ed1d;if(!_0x55ed1d[_0x03fd('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x03fd('0x78')](_0x4e7b84[_0x03fd('0x64')]['from'])){_0x4e7b84[_0x03fd('0x64')][_0x03fd('0xaa')]=util[_0x03fd('0xa0')]('%s\x20<%s>',_0x55ed1d[_0x03fd('0x2c')],_0x55ed1d[_0x03fd('0xab')]||_0x55ed1d['Smtp'][_0x03fd('0x37')]);}if(_0x4e7b84['body'][_0x03fd('0xac')]&&_0x4e7b84[_0x03fd('0x64')]['attachments'][_0x03fd('0x60')]){for(var _0x423c1d=0x0;_0x423c1d<_0x4e7b84[_0x03fd('0x64')][_0x03fd('0xac')][_0x03fd('0x60')];_0x423c1d+=0x1){_0x4e7b84['body'][_0x03fd('0xac')][_0x423c1d]={'filename':_0x4e7b84['body'][_0x03fd('0xac')][_0x423c1d][_0x03fd('0x2c')],'path':path['join'](config[_0x03fd('0xad')],_0x03fd('0xae'),_0x4e7b84[_0x03fd('0x64')][_0x03fd('0xac')][_0x423c1d][_0x03fd('0xaf')])};}}var _0x2ecfd5=_0x55ed1d[_0x03fd('0xb0')]();return respondWithRpcPromise(_0x03fd('0xb1'),_0x03fd('0xb2'),{'account':_0x2ecfd5,'message':_0x4e7b84[_0x03fd('0x64')]});})[_0x03fd('0x12')](function(_0x2e8158){if(!_0x2e8158)return;_0x20dbba=_0x2e8158;if(!_0x258a0c[_0x03fd('0xa5')])throw new Error(_0x03fd('0xb3'));if(_0x258a0c[_0x03fd('0xa5')]['Contacts'][_0x03fd('0x60')])return _0x258a0c[_0x03fd('0xa5')][_0x03fd('0xa6')][0x0];return db['CmContact']['create'](_[_0x03fd('0xb4')](_0x4e7b84[_0x03fd('0x64')],{'firstName':_0x4e7b84[_0x03fd('0x64')]['to'],'email':_0x4e7b84[_0x03fd('0x64')]['to'],'phone':_0x4e7b84['body']['to'],'ListId':_0x258a0c[_0x03fd('0x77')]}));})[_0x03fd('0x12')](function(_0x21c923){if(!_0x21c923)return;var _0x2468ad={'UserId':_0x4e7b84[_0x03fd('0x37')]['id'],'ContactId':_0x21c923['id'],'MailAccountId':_0x258a0c['id'],'inReplyTo':_0x20dbba[_0x03fd('0xb5')],'to':_0x4e7b84[_0x03fd('0x64')][_0x03fd('0xaa')],'cc':_0x4e7b84['body']['cc'],'subject':_0x4e7b84[_0x03fd('0x64')][_0x03fd('0xb6')],'attach':_0x4e7b84[_0x03fd('0x64')][_0x03fd('0xb7')],'firstMsgDirection':_0x03fd('0xb8'),'lastMsgAt':moment()[_0x03fd('0xa0')](_0x03fd('0xa1')),'lastMsgDirection':'out','Messages':[_[_0x03fd('0x62')](_0x4e7b84[_0x03fd('0x64')],{'messageId':_0x20dbba['messageId'],'sentAt':moment()[_0x03fd('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x258a0c['id'],'UserId':_0x4e7b84[_0x03fd('0x37')]['id'],'ContactId':_0x21c923['id']})]};if(_0x4e7b84[_0x03fd('0x64')][_0x03fd('0xb9')]){_0x2468ad=_[_0x03fd('0x62')](_0x2468ad,_0x4e7b84['body']['Interaction']);}return db[_0x03fd('0x88')][_0x03fd('0x72')](_0x2468ad,{'include':[{'model':db[_0x03fd('0x9d')],'as':_0x03fd('0xba')}]});})[_0x03fd('0x12')](respondWithResult(_0x45db52,null))[_0x03fd('0x1c')](handleError(_0x45db52,null));};exports[_0x03fd('0xbb')]=function(_0x5bd139,_0x261588){return db[_0x03fd('0x48')][_0x03fd('0x63')]({'where':{'id':_0x5bd139['params']['id']},'include':[{'model':db[_0x03fd('0x44')],'as':_0x03fd('0x42'),'raw':!![],'include':[{'model':db[_0x03fd('0xa9')],'as':_0x03fd('0xa9'),'raw':!![]}]}]})[_0x03fd('0x12')](handleEntityNotFound(_0x261588,null))[_0x03fd('0x12')](function(_0x403dc8){if(!_0x403dc8[_0x03fd('0x42')])return;var _0xf1a88d=_0x403dc8[_0x03fd('0xb0')]();return respondWithRpcPromise(_0x03fd('0xbc'),_0x03fd('0xbb'),{'account':_0xf1a88d});})[_0x03fd('0x12')](respondWithResult(_0x261588,null))[_0x03fd('0x1c')](handleError(_0x261588,null));};exports[_0x03fd('0x27')]=function(_0x5bdc05,_0x4eb8cb){return db[_0x03fd('0x48')]['find']({'where':{'id':_0x5bdc05['params']['id']}})['then'](handleEntityNotFound(_0x4eb8cb,null))[_0x03fd('0x12')](function(_0x1bd1bc){if(_0x1bd1bc&&_0x1bd1bc[_0x03fd('0x3f')]){throw new db[(_0x03fd('0xbd'))][(_0x03fd('0xbe'))](_0x03fd('0xbf'));}return _0x1bd1bc;})[_0x03fd('0x12')](removeEntity(_0x4eb8cb,null))[_0x03fd('0x1c')](handleError(_0x4eb8cb,null));};exports[_0x03fd('0xc0')]=function(_0x2695cb,_0x3b6f2e){return db[_0x03fd('0x48')][_0x03fd('0x63')]({'where':{'id':_0x2695cb['params']['id']}})[_0x03fd('0x12')](handleEntityNotFound(_0x3b6f2e,null))[_0x03fd('0x12')](function(_0x5d8450){if(_0x5d8450){return _0x5d8450[_0x03fd('0xc0')](_0x2695cb[_0x03fd('0x64')][_0x03fd('0x75')],_[_0x03fd('0xc1')](_0x2695cb[_0x03fd('0x64')],[_0x03fd('0x75'),'id'])||{})[_0x03fd('0xc2')](function(_0x21ba67){for(var _0x16cbba=0x0;_0x16cbba<_0x2695cb[_0x03fd('0x64')][_0x03fd('0x75')][_0x03fd('0x60')];_0x16cbba+=0x1){socket[_0x03fd('0xc3')]('userMailAccount:save',{'UserId':Number(_0x2695cb[_0x03fd('0x64')][_0x03fd('0x75')][_0x16cbba]),'MailAccountId':Number(_0x2695cb['params']['id'])});}return _0x21ba67;});}})[_0x03fd('0x12')](respondWithResult(_0x3b6f2e,null))['catch'](handleError(_0x3b6f2e,null));};exports['removeAgents']=function(_0x57d5fd,_0x23791b){return db[_0x03fd('0x48')]['find']({'where':{'id':_0x57d5fd[_0x03fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x23791b,null))[_0x03fd('0x12')](function(_0x24c402){if(_0x24c402){return _0x24c402['removeAgents'](_0x57d5fd['query'][_0x03fd('0x75')])[_0x03fd('0x12')](function(){if(_['isArray'](_0x57d5fd[_0x03fd('0x4d')]['ids'])){for(var _0x43c5e7=0x0;_0x43c5e7<_0x57d5fd[_0x03fd('0x4d')][_0x03fd('0x75')]['length'];_0x43c5e7+=0x1){socket[_0x03fd('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x57d5fd[_0x03fd('0x4d')]['ids'][_0x43c5e7]),'MailAccountId':Number(_0x57d5fd['params']['id'])});}}else{socket[_0x03fd('0xc3')](_0x03fd('0xc4'),{'UserId':Number(_0x57d5fd[_0x03fd('0x4d')]['ids']),'MailAccountId':Number(_0x57d5fd[_0x03fd('0x5e')]['id'])});}});}})[_0x03fd('0x12')](respondWithStatusCode(_0x23791b,null))[_0x03fd('0x1c')](handleError(_0x23791b,null));};exports[_0x03fd('0xc5')]=function(_0x3a0ac3,_0x148731){var _0x1aa485={};var _0x46cb53={};var _0x4cb373;var _0x3c1230;return db['MailAccount'][_0x03fd('0x6d')]({'where':{'id':_0x3a0ac3[_0x03fd('0x5e')]['id']}})['then'](handleEntityNotFound(_0x148731,null))['then'](function(_0x212247){if(_0x212247){_0x4cb373=_0x212247;_0x46cb53[_0x03fd('0x4c')]=_[_0x03fd('0x5f')](db[_0x03fd('0x8c')]['rawAttributes']);_0x46cb53['query']=_[_0x03fd('0x5f')](_0x3a0ac3[_0x03fd('0x4d')]);_0x46cb53[_0x03fd('0x4e')]=_[_0x03fd('0x50')](_0x46cb53[_0x03fd('0x4c')],_0x46cb53['query']);_0x1aa485[_0x03fd('0x4f')]=_['intersection'](_0x46cb53[_0x03fd('0x4c')],qs[_0x03fd('0x51')](_0x3a0ac3[_0x03fd('0x4d')][_0x03fd('0x51')]));_0x1aa485[_0x03fd('0x4f')]=_0x1aa485['attributes'][_0x03fd('0x60')]?_0x1aa485[_0x03fd('0x4f')]:_0x46cb53[_0x03fd('0x4c')];_0x1aa485[_0x03fd('0x54')]=qs[_0x03fd('0x55')](_0x3a0ac3[_0x03fd('0x4d')]['sort']);_0x1aa485['where']=qs[_0x03fd('0x4e')](_[_0x03fd('0x89')](_0x3a0ac3['query'],_0x46cb53[_0x03fd('0x4e')]));if(_0x3a0ac3[_0x03fd('0x4d')][_0x03fd('0x58')]){_0x1aa485['where']=_[_0x03fd('0x62')](_0x1aa485[_0x03fd('0x56')],{'$or':_[_0x03fd('0x47')](_0x1aa485[_0x03fd('0x4f')],function(_0x218a86){var _0x1cfd8f={};_0x1cfd8f[_0x218a86]={'$like':'%'+_0x3a0ac3[_0x03fd('0x4d')][_0x03fd('0x58')]+'%'};return _0x1cfd8f;})});}_0x1aa485=_[_0x03fd('0x62')]({},_0x1aa485,_0x3a0ac3[_0x03fd('0x59')]);return _0x4cb373[_0x03fd('0xc5')](_0x1aa485);}})[_0x03fd('0x12')](function(_0x2ac73a){if(_0x2ac73a){_0x3c1230=_0x2ac73a[_0x03fd('0x60')];if(!_0x3a0ac3[_0x03fd('0x4d')]['hasOwnProperty']('nolimit')){_0x1aa485[_0x03fd('0x22')]=qs['limit'](_0x3a0ac3['query'][_0x03fd('0x22')]);_0x1aa485[_0x03fd('0x21')]=qs[_0x03fd('0x21')](_0x3a0ac3[_0x03fd('0x4d')][_0x03fd('0x21')]);}return _0x4cb373[_0x03fd('0xc5')](_0x1aa485);}})['then'](function(_0x3db931){if(_0x3db931){return _0x3db931?{'count':_0x3c1230,'rows':_0x3db931}:null;}})[_0x03fd('0x12')](respondWithResult(_0x148731,null))['catch'](handleError(_0x148731,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b7bf63f..a5d02ff 100644 --- a/server/api/mailAccount/mailAccount.events.js +++ b/server/api/mailAccount/mailAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf722=['../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf722,0x18f));var _0x2f72=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf722[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x2f72('0x0'));var MailAccount=require(_0x2f72('0x1'))['db'][_0x2f72('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2f72('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f72('0x4'),'afterDestroy':_0x2f72('0x5')};function emitEvent(_0x1b3952){return function(_0x418aed,_0x47d759,_0x3235a5){MailAccountEvents[_0x2f72('0x6')](_0x1b3952+':'+_0x418aed['id'],_0x418aed);MailAccountEvents[_0x2f72('0x6')](_0x1b3952,_0x418aed);_0x3235a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x2f72('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xa267=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','save','update','remove','emit'];(function(_0x23a084,_0x1dc2b2){var _0x112dfa=function(_0x24213b){while(--_0x24213b){_0x23a084['push'](_0x23a084['shift']());}};_0x112dfa(++_0x1dc2b2);}(_0xa267,0xcb));var _0x7a26=function(_0x21c921,_0x1a8d76){_0x21c921=_0x21c921-0x0;var _0xe46728=_0xa267[_0x21c921];return _0xe46728;};'use strict';var EventEmitter=require(_0x7a26('0x0'));var MailAccount=require(_0x7a26('0x1'))['db'][_0x7a26('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a26('0x3'),'afterUpdate':_0x7a26('0x4'),'afterDestroy':_0x7a26('0x5')};function emitEvent(_0x4d52ba){return function(_0x420a8f,_0x9cb03b,_0x2c6851){MailAccountEvents[_0x7a26('0x6')](_0x4d52ba+':'+_0x420a8f['id'],_0x420a8f);MailAccountEvents['emit'](_0x4d52ba,_0x420a8f);_0x2c6851(null);};}for(var e in events){if(events[_0x7a26('0x7')](e)){var event=events[e];MailAccount[_0x7a26('0x8')](e,emitEvent(event));}}module[_0x7a26('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 28b4a33..abcb253 100644 --- a/server/api/mailAccount/mailAccount.model.js +++ b/server/api/mailAccount/mailAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfae3=['modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','./mailAccount.attributes','define','provider','custom','service','host','Smtp','port','secure','authentication'];(function(_0x17dd81,_0x5148d7){var _0x46da83=function(_0x42d9e2){while(--_0x42d9e2){_0x17dd81['push'](_0x17dd81['shift']());}};_0x46da83(++_0x5148d7);}(_0xfae3,0x128));var _0x3fae=function(_0x739b76,_0x2250f8){_0x739b76=_0x739b76-0x0;var _0x3b471f=_0xfae3[_0x739b76];return _0x3b471f;};'use strict';var attributes=require(_0x3fae('0x0'));module['exports']=function(_0x5d79ac){return _0x5d79ac[_0x3fae('0x1')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1804f1=this;var _0x3ba241={'id':_0x1804f1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1804f1[_0x3fae('0x2')]!==_0x3fae('0x3')){_0x3ba241[_0x3fae('0x4')]=_0x1804f1[_0x3fae('0x2')];}else{_0x3ba241[_0x3fae('0x5')]=_0x1804f1[_0x3fae('0x6')][_0x3fae('0x5')];_0x3ba241['port']=_0x1804f1[_0x3fae('0x6')][_0x3fae('0x7')];_0x3ba241['secure']=_0x1804f1[_0x3fae('0x6')][_0x3fae('0x8')];}if(_0x1804f1[_0x3fae('0x6')][_0x3fae('0x9')]){if(_0x1804f1[_0x3fae('0x6')][_0x3fae('0xa')]){if(!_0x1804f1[_0x3fae('0x6')][_0x3fae('0xb')])throw new Error(_0x3fae('0xc'));_0x3ba241[_0x3fae('0xd')]={'type':_0x3fae('0xe'),'user':_0x1804f1[_0x3fae('0x6')][_0x3fae('0xf')],'accessToken':_0x1804f1['Smtp']['CloudProvider'][_0x3fae('0x10')]};}else{_0x3ba241['auth']={'user':_0x1804f1[_0x3fae('0x6')]['user'],'pass':_0x1804f1[_0x3fae('0x6')]['pass']};}}return _0x3ba241;}}});}; \ No newline at end of file +var _0x1f18=['custom','service','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','data5','pass','exports','define','MailAccount','mail_accounts','provider'];(function(_0x431c32,_0x48327b){var _0x3daa4b=function(_0x1180cd){while(--_0x1180cd){_0x431c32['push'](_0x431c32['shift']());}};_0x3daa4b(++_0x48327b);}(_0x1f18,0x13e));var _0x81f1=function(_0x24d0a,_0x2771f9){_0x24d0a=_0x24d0a-0x0;var _0x4f94bc=_0x1f18[_0x24d0a];return _0x4f94bc;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x81f1('0x0')]=function(_0x31d1a9){return _0x31d1a9[_0x81f1('0x1')](_0x81f1('0x2'),attributes,{'tableName':_0x81f1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x59218f=this;var _0x2ded37={'id':_0x59218f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x59218f[_0x81f1('0x4')]!==_0x81f1('0x5')){_0x2ded37[_0x81f1('0x6')]=_0x59218f[_0x81f1('0x4')];}else{_0x2ded37['host']=_0x59218f[_0x81f1('0x7')]['host'];_0x2ded37[_0x81f1('0x8')]=_0x59218f[_0x81f1('0x7')][_0x81f1('0x8')];_0x2ded37[_0x81f1('0x9')]=_0x59218f[_0x81f1('0x7')]['secure'];}if(_0x59218f[_0x81f1('0x7')][_0x81f1('0xa')]){if(_0x59218f['Smtp'][_0x81f1('0xb')]){if(!_0x59218f[_0x81f1('0x7')]['CloudProvider'])throw new Error(_0x81f1('0xc'));_0x2ded37[_0x81f1('0xd')]={'type':_0x81f1('0xe'),'user':_0x59218f[_0x81f1('0x7')][_0x81f1('0xf')],'accessToken':_0x59218f[_0x81f1('0x7')][_0x81f1('0x10')][_0x81f1('0x11')]};}else{_0x2ded37[_0x81f1('0xd')]={'user':_0x59218f[_0x81f1('0x7')][_0x81f1('0xf')],'pass':_0x59218f[_0x81f1('0x7')][_0x81f1('0x12')]};}}return _0x2ded37;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 7d86d74..98118ad 100644 --- a/server/api/mailAccount/mailAccount.rpc.js +++ b/server/api/mailAccount/mailAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb138=['messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','created','create','subject','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','name','unshift','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetMailAccount','findAll','options','where','attributes','limit','include','model','map','ShowMailAccount','find','raw','setDataValue','getSmtpOptions','body','mail','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','smtpOptions','applications','Applications','list','orderBy','priority','asc','autoclose','push','close','length','List\x20not\x20found'];(function(_0x2de5f3,_0x25048c){var _0x460fb9=function(_0x4a9cce){while(--_0x4a9cce){_0x2de5f3['push'](_0x2de5f3['shift']());}};_0x460fb9(++_0x25048c);}(_0xb138,0x1dd));var _0x8b13=function(_0x2b93de,_0x3e50c0){_0x2b93de=_0x2b93de-0x0;var _0x4e910f=_0xb138[_0x2b93de];return _0x4e910f;};'use strict';var _=require(_0x8b13('0x0'));var moment=require(_0x8b13('0x1'));var BPromise=require(_0x8b13('0x2'));var rs=require(_0x8b13('0x3'));var Redis=require(_0x8b13('0x4'));var db=require(_0x8b13('0x5'))['db'];var logger=require(_0x8b13('0x6'))('rpc');var config=require(_0x8b13('0x7'));var jayson=require(_0x8b13('0x8'));var client=jayson[_0x8b13('0x9')]['http']({'port':0x232c});config[_0x8b13('0xa')]=_[_0x8b13('0xb')](config['redis'],{'host':_0x8b13('0xc'),'port':0x18eb});var socket=require(_0x8b13('0xd'))(new Redis(config[_0x8b13('0xa')]));require('./mailAccount.socket')[_0x8b13('0xe')](socket);function respondWithRpcPromise(_0x1aed6f,_0x58683a,_0x53ae50){return new BPromise(function(_0x1f2528,_0x21fcd9){return client[_0x8b13('0xf')](_0x1aed6f,_0x53ae50)[_0x8b13('0x10')](function(_0x3e8eca){logger['info'](_0x8b13('0x11'),_0x58683a,_0x8b13('0x12'));logger[_0x8b13('0x13')](_0x8b13('0x14'),_0x58683a,_0x8b13('0x12'),JSON[_0x8b13('0x15')](_0x3e8eca));if(_0x3e8eca['error']){if(_0x3e8eca['error'][_0x8b13('0x16')]===0x1f4){logger[_0x8b13('0x17')]('MailAccount,\x20%s,\x20%s',_0x58683a,_0x3e8eca['error']['message']);return _0x21fcd9(_0x3e8eca[_0x8b13('0x17')][_0x8b13('0x18')]);}logger[_0x8b13('0x17')](_0x8b13('0x11'),_0x58683a,_0x3e8eca[_0x8b13('0x17')]['message']);return _0x1f2528(_0x3e8eca[_0x8b13('0x17')][_0x8b13('0x18')]);}else{logger[_0x8b13('0x19')](_0x8b13('0x11'),_0x58683a,_0x8b13('0x12'));_0x1f2528(_0x3e8eca[_0x8b13('0x1a')][_0x8b13('0x18')]);}})[_0x8b13('0x1b')](function(_0x4989d3){logger['error'](_0x8b13('0x11'),_0x58683a,_0x4989d3);_0x21fcd9(_0x4989d3);});});}exports[_0x8b13('0x1c')]=function(_0x14a8ac){var _0x9c03b4=this;return new Promise(function(_0x1e0fe3,_0x3cc9a0){return db['MailAccount'][_0x8b13('0x1d')]({'raw':_0x14a8ac[_0x8b13('0x1e')]?_0x14a8ac[_0x8b13('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x14a8ac['options']?_0x14a8ac[_0x8b13('0x1e')][_0x8b13('0x1f')]||null:null,'attributes':_0x14a8ac['options']?_0x14a8ac[_0x8b13('0x1e')][_0x8b13('0x20')]||null:null,'limit':_0x14a8ac[_0x8b13('0x1e')]?_0x14a8ac[_0x8b13('0x1e')][_0x8b13('0x21')]||null:null,'include':_0x14a8ac['options']?_0x14a8ac[_0x8b13('0x1e')][_0x8b13('0x22')]?_['map'](_0x14a8ac[_0x8b13('0x1e')]['include'],function(_0x420772){return{'model':db[_0x420772[_0x8b13('0x23')]],'as':_0x420772['as'],'attributes':_0x420772['attributes'],'include':_0x420772[_0x8b13('0x22')]?_[_0x8b13('0x24')](_0x420772['include'],function(_0x134c5e){return{'model':db[_0x134c5e[_0x8b13('0x23')]],'as':_0x134c5e['as'],'attributes':_0x134c5e[_0x8b13('0x20')],'include':_0x134c5e[_0x8b13('0x22')]?_[_0x8b13('0x24')](_0x134c5e['include'],function(_0x6023f5){return{'model':db[_0x6023f5[_0x8b13('0x23')]],'as':_0x6023f5['as'],'attributes':_0x6023f5[_0x8b13('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b13('0x10')](function(_0x114b01){logger[_0x8b13('0x19')]('GetMailAccount',_0x14a8ac);logger[_0x8b13('0x13')](_0x8b13('0x1c'),_0x14a8ac,JSON[_0x8b13('0x15')](_0x114b01));_0x1e0fe3(_0x114b01);})[_0x8b13('0x1b')](function(_0x23fde7){logger[_0x8b13('0x17')](_0x8b13('0x1c'),_0x23fde7[_0x8b13('0x18')],_0x14a8ac);_0x3cc9a0(_0x9c03b4[_0x8b13('0x17')](0x1f4,_0x23fde7['message']));});});};exports[_0x8b13('0x25')]=function(_0x193965){var _0x288ff7=this;return new Promise(function(_0x2878a6,_0x51a334){return db['MailAccount'][_0x8b13('0x26')]({'raw':_0x193965['options']?_0x193965['options'][_0x8b13('0x27')]===undefined?!![]:![]:!![],'where':_0x193965['options']?_0x193965[_0x8b13('0x1e')][_0x8b13('0x1f')]||null:null,'attributes':_0x193965[_0x8b13('0x1e')]?_0x193965[_0x8b13('0x1e')][_0x8b13('0x20')]||null:null,'include':_0x193965[_0x8b13('0x1e')]?_0x193965[_0x8b13('0x1e')][_0x8b13('0x22')]?_[_0x8b13('0x24')](_0x193965[_0x8b13('0x1e')]['include'],function(_0xa07850){return{'model':db[_0xa07850[_0x8b13('0x23')]],'as':_0xa07850['as'],'attributes':_0xa07850[_0x8b13('0x20')],'include':_0xa07850[_0x8b13('0x22')]?_[_0x8b13('0x24')](_0xa07850[_0x8b13('0x22')],function(_0x6b4645){return{'model':db[_0x6b4645[_0x8b13('0x23')]],'as':_0x6b4645['as'],'attributes':_0x6b4645['attributes'],'include':_0x6b4645[_0x8b13('0x22')]?_['map'](_0x6b4645[_0x8b13('0x22')],function(_0x37732c){return{'model':db[_0x37732c[_0x8b13('0x23')]],'as':_0x37732c['as'],'attributes':_0x37732c[_0x8b13('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b13('0x10')](function(_0x327eb1){if(_0x193965['options']['smtp']===!![])_0x327eb1[_0x8b13('0x28')]('smtpOptions',_0x327eb1[_0x8b13('0x29')]());logger['info'](_0x8b13('0x25'),_0x193965);logger[_0x8b13('0x13')](_0x8b13('0x25'),_0x193965,JSON[_0x8b13('0x15')](_0x327eb1));_0x2878a6(_0x327eb1);})[_0x8b13('0x1b')](function(_0x4e16e7){logger['error'](_0x8b13('0x25'),_0x4e16e7['message'],_0x193965);_0x51a334(_0x288ff7[_0x8b13('0x17')](0x1f4,_0x4e16e7[_0x8b13('0x18')]));});});};exports['NotifyMailAccount']=function(_0x1012eb){var _0x41d710=this;return new Promise(function(_0x35c1d6,_0x81b931){var _0x2f4e7f={'body':_0x1012eb[_0x8b13('0x2a')],'channel':_0x8b13('0x2b')};var _0x516c70=_['difference'](_['keys'](db[_0x8b13('0x2c')][_0x8b13('0x2d')]),[_0x8b13('0x2e'),_0x8b13('0x2f'),_0x8b13('0x30'),_0x8b13('0x31')]);var _0x492f7d=![];if(_0x1012eb[_0x8b13('0x2a')]['id']){delete _0x1012eb['body']['id'];}if(_[_0x8b13('0x32')](_0x1012eb['body'][_0x8b13('0x33')])){return _0x81b931(_0x41d710[_0x8b13('0x17')](0x1f4,_0x8b13('0x34')));}if(_[_0x8b13('0x32')](_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x2a')])||_0x1012eb[_0x8b13('0x2a')]['body']===''){return _0x81b931(_0x41d710['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8b13('0x32')](_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x35')])){return _0x81b931(_0x41d710[_0x8b13('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x516c70));}if(!_['includes'](_0x516c70,_0x1012eb[_0x8b13('0x2a')]['mapKey'])){return _0x81b931(_0x41d710[_0x8b13('0x17')](0x1f4,_0x8b13('0x36')+_0x516c70));}var _0x20c363={};_0x20c363[_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x35')]]=_0x1012eb['body'][_0x8b13('0x33')];return db[_0x8b13('0x37')][_0x8b13('0x26')]({'where':{'id':_0x1012eb[_0x8b13('0x38')]['id']},'include':[{'model':db[_0x8b13('0x39')],'as':_0x8b13('0x3a'),'include':[{'model':db[_0x8b13('0x2c')],'as':_0x8b13('0x3b'),'where':_0x20c363,'limit':0x1,'order':[[_0x8b13('0x2f'),'DESC']]}]},{'model':db[_0x8b13('0x3c')],'as':'Applications'},{'model':db[_0x8b13('0x3d')],'as':_0x8b13('0x3e'),'include':[{'model':db[_0x8b13('0x3f')],'as':'CloudProvider'}]}]})[_0x8b13('0x10')](function(_0x35f612){if(_0x35f612&&_0x35f612[_0x8b13('0x3a')]){var _0x4129c0=_0x35f612[_0x8b13('0x40')]({'plain':!![]});_0x2f4e7f[_0x8b13('0x38')]=_[_0x8b13('0x41')](_0x4129c0,['Applications',_0x8b13('0x3a')]);_0x2f4e7f['account'][_0x8b13('0x42')]=_0x35f612[_0x8b13('0x29')]();_0x2f4e7f[_0x8b13('0x43')]=_0x4129c0[_0x8b13('0x44')];_0x2f4e7f[_0x8b13('0x45')]=_0x4129c0[_0x8b13('0x3a')];_0x2f4e7f[_0x8b13('0x43')]=_[_0x8b13('0x46')](_0x2f4e7f[_0x8b13('0x43')],[_0x8b13('0x47')],[_0x8b13('0x48')]);if(_0x2f4e7f[_0x8b13('0x38')]&&_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x49')]){_0x2f4e7f[_0x8b13('0x43')][_0x8b13('0x4a')]({'id':0x0,'priority':_0x2f4e7f[_0x8b13('0x43')]['length']+0x1,'app':_0x8b13('0x4b'),'appdata':_0x8b13('0x49'),'interval':'*,*,*,*'});}if(_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x44')]){delete _0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x44')];}if(_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x3a')]){delete _0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x3a')];}if(_0x4129c0[_0x8b13('0x3a')][_0x8b13('0x3b')][_0x8b13('0x4c')]){return _0x4129c0[_0x8b13('0x3a')][_0x8b13('0x3b')][0x0];}var _0x25ab1f=_[_0x8b13('0xb')](_0x1012eb['body'],{'firstName':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x33')],'ListId':_0x4129c0['ListId']});_0x25ab1f[_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x35')]]=_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x33')];return db[_0x8b13('0x2c')]['create'](_0x25ab1f);}else{throw new Error(_0x8b13('0x4d'));}})[_0x8b13('0x10')](function(_0x46850a){_0x2f4e7f['contact']=_0x46850a;if(_0x46850a){if(!_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['messageId']){_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x4e')]=rs[_0x8b13('0x4f')]()+'\x20'+_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x33')];}var _0x52e705={'ContactId':_0x46850a['id'],'MailAccountId':_0x1012eb[_0x8b13('0x38')]['id'],'inReplyTo':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x4e')],'to':_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x33')],'cc':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['cc'],'subject':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['subject'],'attach':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x50')],'lastMsgAt':moment()['format'](_0x8b13('0x51')),'lastMsgDirection':'in'};return db[_0x8b13('0x52')][_0x8b13('0x26')]({'where':{'closed':![],'MailAccountId':_0x1012eb[_0x8b13('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x1012eb['body']['message'][_0x8b13('0x53')]}}]})[_0x8b13('0x10')](function(_0x574f98){if(_0x574f98){return[_0x574f98,![]];}return db[_0x8b13('0x52')]['create'](_0x52e705)[_0x8b13('0x10')](function(_0x2d2fa3){return[_0x2d2fa3,!![]];});});}else{throw new Error(_0x8b13('0x54'));}})[_0x8b13('0x55')](function(_0x43f12a,_0x2ff9c3){if(_0x43f12a){_0x492f7d=_0x2ff9c3;if(!_0x2ff9c3){return _0x43f12a[_0x8b13('0x56')]({'inReplyTo':_0x1012eb['body'][_0x8b13('0x18')]['messageId'],'to':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x33')],'cc':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['cc'],'subject':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['subject'],'attach':_0x43f12a[_0x8b13('0x50')]?_0x43f12a['attach']:_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x50')],'substatus':null,'substatusAt':moment()[_0x8b13('0x57')](_0x8b13('0x51')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x43f12a;}}})[_0x8b13('0x10')](function(_0x37a243){_0x2f4e7f['interaction']=_0x37a243[_0x8b13('0x40')]({'plain':!![]});_0x2f4e7f[_0x8b13('0x58')][_0x8b13('0x59')]=_0x492f7d;return db['MailMessage'][_0x8b13('0x5a')]({'body':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x2a')],'MailAccountId':_0x1012eb[_0x8b13('0x38')]['id'],'MailInteractionId':_0x37a243['id'],'direction':'in','ContactId':_0x2f4e7f['contact']['id'],'messageId':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['messageId'],'from':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x33')],'to':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['to'],'cc':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['cc'],'subject':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x5b')],'attach':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x50')],'Attachments':_0x1012eb[_0x8b13('0x2a')]['message'][_0x8b13('0x5c')],'originTo':_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x5d')],'originCc':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['originCc'],'bcc':_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x5e')],'ChatWebsiteId':_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x5f')]||null,'originChannel':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x60')]||_0x8b13('0x61'),'ChatOfflineMessageId':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x62')]||null},{'include':[{'model':db[_0x8b13('0x63')],'as':'Attachments'}]});})[_0x8b13('0x10')](function(_0x2e7477){_0x2f4e7f['message']=_0x2e7477;if(!_0x2f4e7f[_0x8b13('0x58')][_0x8b13('0x64')]){return;}return db['User'][_0x8b13('0x26')]({'attributes':['id',_0x8b13('0x65')],'where':{'id':_0x2f4e7f[_0x8b13('0x58')][_0x8b13('0x64')]}});})[_0x8b13('0x10')](function(_0xe81c2e){if(_0xe81c2e){_0x2f4e7f[_0x8b13('0x43')][_0x8b13('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe81c2e[_0x8b13('0x65')]+','+(_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x67')]||0xa),'interval':'*,*,*,*'});}if(!_0x2f4e7f[_0x8b13('0x58')]['queueId']){return;}return db[_0x8b13('0x68')][_0x8b13('0x26')]({'attributes':['id',_0x8b13('0x65')],'where':{'id':_0x2f4e7f[_0x8b13('0x58')][_0x8b13('0x69')]}});})[_0x8b13('0x10')](function(_0x41cefe){if(_0x41cefe){_0x2f4e7f[_0x8b13('0x43')][_0x8b13('0x66')]({'id':0x0,'priority':0x1,'app':_0x8b13('0x6a'),'appdata':_0x41cefe['name']+','+(_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x6b')]||0x12c),'interval':_0x8b13('0x6c')});}return respondWithRpcPromise(_0x8b13('0x6d'),_0x8b13('0x6e'),_0x2f4e7f);})[_0x8b13('0x10')](function(_0x2c69f5){_0x35c1d6(_0x2c69f5);})[_0x8b13('0x1b')](function(_0x5cb836){_0x81b931(_0x41d710[_0x8b13('0x17')](0x1f4,_0x5cb836[_0x8b13('0x18')]));});});}; \ No newline at end of file +var _0xdfa0=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','options','raw','attributes','include','map','model','ShowMailAccount','MailAccount','where','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','rawAttributes','createdAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','List','get','smtpOptions','applications','orderBy','priority','asc','close','autoclose','*,*,*,*','length','defaults','ListId','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','create','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','lodash'];(function(_0x239b16,_0x32df06){var _0x340d7f=function(_0x27d7bc){while(--_0x27d7bc){_0x239b16['push'](_0x239b16['shift']());}};_0x340d7f(++_0x32df06);}(_0xdfa0,0x69));var _0x0dfa=function(_0x35ed66,_0x1564fd){_0x35ed66=_0x35ed66-0x0;var _0x154169=_0xdfa0[_0x35ed66];return _0x154169;};'use strict';var _=require(_0x0dfa('0x0'));var moment=require('moment');var BPromise=require(_0x0dfa('0x1'));var rs=require(_0x0dfa('0x2'));var Redis=require('ioredis');var db=require(_0x0dfa('0x3'))['db'];var logger=require(_0x0dfa('0x4'))(_0x0dfa('0x5'));var config=require('../../config/environment');var jayson=require(_0x0dfa('0x6'));var client=jayson['client'][_0x0dfa('0x7')]({'port':0x232c});config[_0x0dfa('0x8')]=_['defaults'](config[_0x0dfa('0x8')],{'host':_0x0dfa('0x9'),'port':0x18eb});var socket=require(_0x0dfa('0xa'))(new Redis(config[_0x0dfa('0x8')]));require(_0x0dfa('0xb'))['register'](socket);function respondWithRpcPromise(_0x2b85ed,_0x2f813e,_0x6c9373){return new BPromise(function(_0x5cddf5,_0x438b20){return client['request'](_0x2b85ed,_0x6c9373)[_0x0dfa('0xc')](function(_0x3a5384){logger[_0x0dfa('0xd')]('MailAccount,\x20%s,\x20%s',_0x2f813e,_0x0dfa('0xe'));logger[_0x0dfa('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2f813e,_0x0dfa('0xe'),JSON[_0x0dfa('0x10')](_0x3a5384));if(_0x3a5384['error']){if(_0x3a5384[_0x0dfa('0x11')][_0x0dfa('0x12')]===0x1f4){logger[_0x0dfa('0x11')](_0x0dfa('0x13'),_0x2f813e,_0x3a5384[_0x0dfa('0x11')][_0x0dfa('0x14')]);return _0x438b20(_0x3a5384['error'][_0x0dfa('0x14')]);}logger[_0x0dfa('0x11')](_0x0dfa('0x13'),_0x2f813e,_0x3a5384[_0x0dfa('0x11')][_0x0dfa('0x14')]);return _0x5cddf5(_0x3a5384[_0x0dfa('0x11')][_0x0dfa('0x14')]);}else{logger[_0x0dfa('0xd')](_0x0dfa('0x13'),_0x2f813e,_0x0dfa('0xe'));_0x5cddf5(_0x3a5384[_0x0dfa('0x15')][_0x0dfa('0x14')]);}})[_0x0dfa('0x16')](function(_0x208c0b){logger[_0x0dfa('0x11')]('MailAccount,\x20%s,\x20%s',_0x2f813e,_0x208c0b);_0x438b20(_0x208c0b);});});}exports[_0x0dfa('0x17')]=function(_0x22ff4e){var _0x263d6c=this;return new Promise(function(_0x1bb2a,_0x16a23d){return db['MailAccount']['findAll']({'raw':_0x22ff4e[_0x0dfa('0x18')]?_0x22ff4e[_0x0dfa('0x18')][_0x0dfa('0x19')]===undefined?!![]:![]:!![],'where':_0x22ff4e['options']?_0x22ff4e[_0x0dfa('0x18')]['where']||null:null,'attributes':_0x22ff4e[_0x0dfa('0x18')]?_0x22ff4e['options'][_0x0dfa('0x1a')]||null:null,'limit':_0x22ff4e[_0x0dfa('0x18')]?_0x22ff4e[_0x0dfa('0x18')]['limit']||null:null,'include':_0x22ff4e[_0x0dfa('0x18')]?_0x22ff4e[_0x0dfa('0x18')][_0x0dfa('0x1b')]?_[_0x0dfa('0x1c')](_0x22ff4e[_0x0dfa('0x18')][_0x0dfa('0x1b')],function(_0x13005a){return{'model':db[_0x13005a[_0x0dfa('0x1d')]],'as':_0x13005a['as'],'attributes':_0x13005a[_0x0dfa('0x1a')],'include':_0x13005a[_0x0dfa('0x1b')]?_['map'](_0x13005a['include'],function(_0x4084c6){return{'model':db[_0x4084c6[_0x0dfa('0x1d')]],'as':_0x4084c6['as'],'attributes':_0x4084c6['attributes'],'include':_0x4084c6[_0x0dfa('0x1b')]?_[_0x0dfa('0x1c')](_0x4084c6[_0x0dfa('0x1b')],function(_0x4e4172){return{'model':db[_0x4e4172[_0x0dfa('0x1d')]],'as':_0x4e4172['as'],'attributes':_0x4e4172[_0x0dfa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0dfa('0xc')](function(_0xcf3d88){logger[_0x0dfa('0xd')](_0x0dfa('0x17'),_0x22ff4e);logger['debug'](_0x0dfa('0x17'),_0x22ff4e,JSON[_0x0dfa('0x10')](_0xcf3d88));_0x1bb2a(_0xcf3d88);})['catch'](function(_0xa61647){logger[_0x0dfa('0x11')](_0x0dfa('0x17'),_0xa61647[_0x0dfa('0x14')],_0x22ff4e);_0x16a23d(_0x263d6c['error'](0x1f4,_0xa61647[_0x0dfa('0x14')]));});});};exports[_0x0dfa('0x1e')]=function(_0x2d60cc){var _0x560f2b=this;return new Promise(function(_0x4f927e,_0x267f22){return db[_0x0dfa('0x1f')]['find']({'raw':_0x2d60cc['options']?_0x2d60cc['options'][_0x0dfa('0x19')]===undefined?!![]:![]:!![],'where':_0x2d60cc[_0x0dfa('0x18')]?_0x2d60cc[_0x0dfa('0x18')][_0x0dfa('0x20')]||null:null,'attributes':_0x2d60cc['options']?_0x2d60cc[_0x0dfa('0x18')][_0x0dfa('0x1a')]||null:null,'include':_0x2d60cc[_0x0dfa('0x18')]?_0x2d60cc[_0x0dfa('0x18')][_0x0dfa('0x1b')]?_[_0x0dfa('0x1c')](_0x2d60cc[_0x0dfa('0x18')][_0x0dfa('0x1b')],function(_0x10b105){return{'model':db[_0x10b105[_0x0dfa('0x1d')]],'as':_0x10b105['as'],'attributes':_0x10b105['attributes'],'include':_0x10b105['include']?_[_0x0dfa('0x1c')](_0x10b105[_0x0dfa('0x1b')],function(_0xdb2edf){return{'model':db[_0xdb2edf[_0x0dfa('0x1d')]],'as':_0xdb2edf['as'],'attributes':_0xdb2edf[_0x0dfa('0x1a')],'include':_0xdb2edf['include']?_[_0x0dfa('0x1c')](_0xdb2edf['include'],function(_0x26aad2){return{'model':db[_0x26aad2[_0x0dfa('0x1d')]],'as':_0x26aad2['as'],'attributes':_0x26aad2[_0x0dfa('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x526ec0){if(_0x2d60cc[_0x0dfa('0x18')][_0x0dfa('0x21')]===!![])_0x526ec0[_0x0dfa('0x22')]('smtpOptions',_0x526ec0[_0x0dfa('0x23')]());logger['info'](_0x0dfa('0x1e'),_0x2d60cc);logger[_0x0dfa('0xf')]('ShowMailAccount',_0x2d60cc,JSON[_0x0dfa('0x10')](_0x526ec0));_0x4f927e(_0x526ec0);})[_0x0dfa('0x16')](function(_0x2c4864){logger[_0x0dfa('0x11')](_0x0dfa('0x1e'),_0x2c4864[_0x0dfa('0x14')],_0x2d60cc);_0x267f22(_0x560f2b['error'](0x1f4,_0x2c4864[_0x0dfa('0x14')]));});});};exports[_0x0dfa('0x24')]=function(_0x2715e8){var _0x32c9af=this;return new Promise(function(_0x42f2d9,_0x143aa2){var _0x3fc677={'body':_0x2715e8[_0x0dfa('0x25')],'channel':_0x0dfa('0x26')};var _0x4078d9=_[_0x0dfa('0x27')](_['keys'](db['CmContact'][_0x0dfa('0x28')]),[_0x0dfa('0x29'),'updatedAt','CompanyId','ListId']);var _0x28f867=![];if(_0x2715e8['body']['id']){delete _0x2715e8[_0x0dfa('0x25')]['id'];}if(_[_0x0dfa('0x2a')](_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x2b')])){return _0x143aa2(_0x32c9af[_0x0dfa('0x11')](0x1f4,_0x0dfa('0x2c')));}if(_[_0x0dfa('0x2a')](_0x2715e8[_0x0dfa('0x25')]['body'])||_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x25')]===''){return _0x143aa2(_0x32c9af['error'](0x1f4,_0x0dfa('0x2d')));}if(_[_0x0dfa('0x2a')](_0x2715e8['body'][_0x0dfa('0x2e')])){return _0x143aa2(_0x32c9af[_0x0dfa('0x11')](0x1f4,_0x0dfa('0x2f')+_0x4078d9));}if(!_[_0x0dfa('0x30')](_0x4078d9,_0x2715e8['body'][_0x0dfa('0x2e')])){return _0x143aa2(_0x32c9af[_0x0dfa('0x11')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4078d9));}var _0x3fc10d={};_0x3fc10d[_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x2e')]]=_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x2b')];return db[_0x0dfa('0x1f')][_0x0dfa('0x31')]({'where':{'id':_0x2715e8[_0x0dfa('0x32')]['id']},'include':[{'model':db[_0x0dfa('0x33')],'as':'List','include':[{'model':db[_0x0dfa('0x34')],'as':_0x0dfa('0x35'),'where':_0x3fc10d,'limit':0x1,'order':[['updatedAt',_0x0dfa('0x36')]]}]},{'model':db[_0x0dfa('0x37')],'as':_0x0dfa('0x38')},{'model':db[_0x0dfa('0x39')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x0dfa('0xc')](function(_0x40c3c6){if(_0x40c3c6&&_0x40c3c6[_0x0dfa('0x3a')]){var _0x3a1bf7=_0x40c3c6[_0x0dfa('0x3b')]({'plain':!![]});_0x3fc677[_0x0dfa('0x32')]=_['omit'](_0x3a1bf7,['Applications',_0x0dfa('0x3a')]);_0x3fc677[_0x0dfa('0x32')][_0x0dfa('0x3c')]=_0x40c3c6[_0x0dfa('0x23')]();_0x3fc677['applications']=_0x3a1bf7['Applications'];_0x3fc677['list']=_0x3a1bf7[_0x0dfa('0x3a')];_0x3fc677[_0x0dfa('0x3d')]=_[_0x0dfa('0x3e')](_0x3fc677[_0x0dfa('0x3d')],[_0x0dfa('0x3f')],[_0x0dfa('0x40')]);if(_0x3fc677[_0x0dfa('0x32')]&&_0x3fc677[_0x0dfa('0x32')]['autoclose']){_0x3fc677['applications']['push']({'id':0x0,'priority':_0x3fc677[_0x0dfa('0x3d')]['length']+0x1,'app':_0x0dfa('0x41'),'appdata':_0x0dfa('0x42'),'interval':_0x0dfa('0x43')});}if(_0x3fc677[_0x0dfa('0x32')][_0x0dfa('0x38')]){delete _0x3fc677[_0x0dfa('0x32')]['Applications'];}if(_0x3fc677['account'][_0x0dfa('0x3a')]){delete _0x3fc677[_0x0dfa('0x32')][_0x0dfa('0x3a')];}if(_0x3a1bf7['List'][_0x0dfa('0x35')][_0x0dfa('0x44')]){return _0x3a1bf7[_0x0dfa('0x3a')][_0x0dfa('0x35')][0x0];}var _0x308f49=_[_0x0dfa('0x45')](_0x2715e8[_0x0dfa('0x25')],{'firstName':_0x2715e8[_0x0dfa('0x25')]['from'],'ListId':_0x3a1bf7[_0x0dfa('0x46')]});_0x308f49[_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x2e')]]=_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x2b')];return db['CmContact']['create'](_0x308f49);}else{throw new Error(_0x0dfa('0x47'));}})['then'](function(_0x19e6ea){_0x3fc677[_0x0dfa('0x48')]=_0x19e6ea;if(_0x19e6ea){if(!_0x2715e8[_0x0dfa('0x25')]['message'][_0x0dfa('0x49')]){_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')][_0x0dfa('0x49')]=rs[_0x0dfa('0x4a')]()+'\x20'+_0x2715e8['body']['message']['from'];}var _0x3770aa={'ContactId':_0x19e6ea['id'],'MailAccountId':_0x2715e8[_0x0dfa('0x32')]['id'],'inReplyTo':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')][_0x0dfa('0x49')],'to':_0x2715e8[_0x0dfa('0x25')]['message'][_0x0dfa('0x2b')],'cc':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')]['cc'],'subject':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')][_0x0dfa('0x4b')],'attach':_0x2715e8['body'][_0x0dfa('0x14')][_0x0dfa('0x4c')],'lastMsgAt':moment()[_0x0dfa('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x0dfa('0x4e')][_0x0dfa('0x31')]({'where':{'closed':![],'MailAccountId':_0x2715e8[_0x0dfa('0x32')]['id']},'include':[{'model':db[_0x0dfa('0x4f')],'as':_0x0dfa('0x50'),'attributes':[_0x0dfa('0x49')],'where':{'messageId':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')]['inReplyTo']}}]})[_0x0dfa('0xc')](function(_0x4c4e01){if(_0x4c4e01){return[_0x4c4e01,![]];}return db['MailInteraction'][_0x0dfa('0x51')](_0x3770aa)['then'](function(_0x1c55ba){return[_0x1c55ba,!![]];});});}else{throw new Error(_0x0dfa('0x52'));}})[_0x0dfa('0x53')](function(_0x4bb645,_0x20217b){if(_0x4bb645){_0x28f867=_0x20217b;if(!_0x20217b){return _0x4bb645[_0x0dfa('0x54')]({'inReplyTo':_0x2715e8['body'][_0x0dfa('0x14')][_0x0dfa('0x49')],'to':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')][_0x0dfa('0x2b')],'cc':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')]['cc'],'subject':_0x2715e8['body'][_0x0dfa('0x14')]['subject'],'attach':_0x4bb645[_0x0dfa('0x4c')]?_0x4bb645[_0x0dfa('0x4c')]:_0x2715e8['body']['message']['attach'],'substatus':null,'substatusAt':moment()[_0x0dfa('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x0dfa('0x55')),'lastMsgDirection':'in'});}else{return _0x4bb645;}}})[_0x0dfa('0xc')](function(_0x45e908){_0x3fc677[_0x0dfa('0x56')]=_0x45e908[_0x0dfa('0x3b')]({'plain':!![]});_0x3fc677[_0x0dfa('0x56')][_0x0dfa('0x57')]=_0x28f867;return db[_0x0dfa('0x4f')][_0x0dfa('0x51')]({'body':_0x2715e8[_0x0dfa('0x25')]['body'],'MailAccountId':_0x2715e8[_0x0dfa('0x32')]['id'],'MailInteractionId':_0x45e908['id'],'direction':'in','ContactId':_0x3fc677[_0x0dfa('0x48')]['id'],'messageId':_0x2715e8[_0x0dfa('0x25')]['message'][_0x0dfa('0x49')],'from':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')][_0x0dfa('0x2b')],'to':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')]['to'],'cc':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')]['cc'],'subject':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')][_0x0dfa('0x4b')],'attach':_0x2715e8[_0x0dfa('0x25')]['message']['attach'],'Attachments':_0x2715e8[_0x0dfa('0x25')]['message'][_0x0dfa('0x58')],'originTo':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')]['originTo'],'originCc':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')]['originCc'],'bcc':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')][_0x0dfa('0x59')],'ChatWebsiteId':_0x2715e8[_0x0dfa('0x25')]['message'][_0x0dfa('0x5a')]||null,'originChannel':_0x2715e8[_0x0dfa('0x25')][_0x0dfa('0x14')][_0x0dfa('0x5b')]||_0x0dfa('0x5c'),'ChatOfflineMessageId':_0x2715e8[_0x0dfa('0x25')]['message'][_0x0dfa('0x5d')]||null},{'include':[{'model':db[_0x0dfa('0x5e')],'as':_0x0dfa('0x5f')}]});})[_0x0dfa('0xc')](function(_0x12af17){_0x3fc677[_0x0dfa('0x14')]=_0x12af17;if(!_0x3fc677[_0x0dfa('0x56')][_0x0dfa('0x60')]){return;}return db[_0x0dfa('0x61')][_0x0dfa('0x31')]({'attributes':['id',_0x0dfa('0x62')],'where':{'id':_0x3fc677[_0x0dfa('0x56')][_0x0dfa('0x60')]}});})[_0x0dfa('0xc')](function(_0x5e1a14){if(_0x5e1a14){_0x3fc677['applications'][_0x0dfa('0x63')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5e1a14[_0x0dfa('0x62')]+','+(_0x3fc677[_0x0dfa('0x32')][_0x0dfa('0x64')]||0xa),'interval':'*,*,*,*'});}if(!_0x3fc677[_0x0dfa('0x56')]['queueId']){return;}return db[_0x0dfa('0x65')][_0x0dfa('0x31')]({'attributes':['id',_0x0dfa('0x62')],'where':{'id':_0x3fc677[_0x0dfa('0x56')][_0x0dfa('0x66')]}});})[_0x0dfa('0xc')](function(_0x5df36c){if(_0x5df36c){_0x3fc677['applications'][_0x0dfa('0x63')]({'id':0x0,'priority':0x1,'app':_0x0dfa('0x67'),'appdata':_0x5df36c[_0x0dfa('0x62')]+','+(_0x3fc677[_0x0dfa('0x32')][_0x0dfa('0x68')]||0x12c),'interval':_0x0dfa('0x43')});}return respondWithRpcPromise(_0x0dfa('0x69'),'startRouting',_0x3fc677);})['then'](function(_0x1fc8d4){_0x42f2d9(_0x1fc8d4);})['catch'](function(_0xf11777){_0x143aa2(_0x32c9af[_0x0dfa('0x11')](0x1f4,_0xf11777[_0x0dfa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1b7ecee..26c7869 100644 --- a/server/api/mailAccount/mailAccount.socket.js +++ b/server/api/mailAccount/mailAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x370f=['remove','emit','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x5872e3,_0x4ec606){var _0x28a411=function(_0x4f9a8b){while(--_0x4f9a8b){_0x5872e3['push'](_0x5872e3['shift']());}};_0x28a411(++_0x4ec606);}(_0x370f,0x132));var _0xf370=function(_0x1d8c86,_0x35919a){_0x1d8c86=_0x1d8c86-0x0;var _0x47c8a5=_0x370f[_0x1d8c86];return _0x47c8a5;};'use strict';var MailAccountEvents=require(_0xf370('0x0'));var events=[_0xf370('0x1'),_0xf370('0x2'),'update'];function createListener(_0x59c7d7,_0xa963fd){return function(_0x237a7f){_0xa963fd[_0xf370('0x3')](_0x59c7d7,_0x237a7f);};}function removeListener(_0x21880b,_0xa0d8d3){return function(){MailAccountEvents['removeListener'](_0x21880b,_0xa0d8d3);};}exports[_0xf370('0x4')]=function(_0x592436){for(var _0x49969e=0x0,_0x2104dd=events[_0xf370('0x5')];_0x49969e<_0x2104dd;_0x49969e++){var _0x4b7826=events[_0x49969e];var _0x1e4814=createListener(_0xf370('0x6')+_0x4b7826,_0x592436);MailAccountEvents['on'](_0x4b7826,_0x1e4814);}}; \ No newline at end of file +var _0x0711=['register','length','mailAccount:','./mailAccount.events','save','remove','removeListener'];(function(_0x434410,_0x166544){var _0x3e78b5=function(_0x3abd90){while(--_0x3abd90){_0x434410['push'](_0x434410['shift']());}};_0x3e78b5(++_0x166544);}(_0x0711,0x161));var _0x1071=function(_0x275759,_0x1518d6){_0x275759=_0x275759-0x0;var _0x467f9e=_0x0711[_0x275759];return _0x467f9e;};'use strict';var MailAccountEvents=require(_0x1071('0x0'));var events=[_0x1071('0x1'),_0x1071('0x2'),'update'];function createListener(_0x8b763,_0x5a5f09){return function(_0x34338b){_0x5a5f09['emit'](_0x8b763,_0x34338b);};}function removeListener(_0x369f2a,_0x59ca5f){return function(){MailAccountEvents[_0x1071('0x3')](_0x369f2a,_0x59ca5f);};}exports[_0x1071('0x4')]=function(_0x3edaaf){for(var _0x4f4328=0x0,_0x2181e7=events[_0x1071('0x5')];_0x4f4328<_0x2181e7;_0x4f4328++){var _0x1363ba=events[_0x4f4328];var _0x12cf2d=createListener(_0x1071('0x6')+_0x1363ba,_0x3edaaf);MailAccountEvents['on'](_0x1363ba,_0x12cf2d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8455fc3..6fa8b8b 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffd2=['isAuthenticated','show','put','update','delete','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xffd2,0x114));var _0x2ffd=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xffd2[_0x11c573];return _0x6b72de;};'use strict';var multer=require('multer');var util=require(_0x2ffd('0x0'));var path=require(_0x2ffd('0x1'));var timeout=require(_0x2ffd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2ffd('0x3'));var interaction=require(_0x2ffd('0x4'));var config=require(_0x2ffd('0x5'));var controller=require(_0x2ffd('0x6'));router[_0x2ffd('0x7')](_0x2ffd('0x8'),auth[_0x2ffd('0x9')](),controller[_0x2ffd('0xa')]);router[_0x2ffd('0xb')]('/:id',auth[_0x2ffd('0x9')](),controller[_0x2ffd('0xc')]);router[_0x2ffd('0xd')](_0x2ffd('0x8'),auth[_0x2ffd('0x9')](),controller['destroy']);module[_0x2ffd('0xe')]=router; \ No newline at end of file +var _0x5507=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','show','isAuthenticated','destroy','exports','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5507,0x133));var _0x7550=function(_0x4ba392,_0x4602ee){_0x4ba392=_0x4ba392-0x0;var _0x46378a=_0x5507[_0x4ba392];return _0x46378a;};'use strict';var multer=require('multer');var util=require(_0x7550('0x0'));var path=require(_0x7550('0x1'));var timeout=require(_0x7550('0x2'));var express=require(_0x7550('0x3'));var router=express[_0x7550('0x4')]();var fs_extra=require(_0x7550('0x5'));var auth=require(_0x7550('0x6'));var interaction=require(_0x7550('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x7550('0x8')](_0x7550('0x9'),auth['isAuthenticated'](),controller[_0x7550('0xa')]);router['put']('/:id',auth[_0x7550('0xb')](),controller['update']);router['delete'](_0x7550('0x9'),auth[_0x7550('0xb')](),controller[_0x7550('0xc')]);module[_0x7550('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b8081ad..1a0e49b 100644 --- a/server/api/mailApplication/mailApplication.attributes.js +++ b/server/api/mailApplication/mailApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48f2=['sequelize','exports','STRING','noop'];(function(_0x2d55c,_0x316090){var _0x4ac2e9=function(_0x241d0c){while(--_0x241d0c){_0x2d55c['push'](_0x2d55c['shift']());}};_0x4ac2e9(++_0x316090);}(_0x48f2,0x1a0));var _0x248f=function(_0x32c61a,_0x1ae989){_0x32c61a=_0x32c61a-0x0;var _0x51d54c=_0x48f2[_0x32c61a];return _0x51d54c;};'use strict';var Sequelize=require(_0x248f('0x0'));module[_0x248f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x248f('0x2')],'allowNull':![],'defaultValue':_0x248f('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x248f('0x2')]},'interval':{'type':Sequelize[_0x248f('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc7c1=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x229a03,_0x36fefc){var _0x2d6e11=function(_0x592d00){while(--_0x592d00){_0x229a03['push'](_0x229a03['shift']());}};_0x2d6e11(++_0x36fefc);}(_0xc7c1,0x130));var _0x1c7c=function(_0x3d552a,_0x270d19){_0x3d552a=_0x3d552a-0x0;var _0x1af877=_0xc7c1[_0x3d552a];return _0x1af877;};'use strict';var Sequelize=require(_0x1c7c('0x0'));module[_0x1c7c('0x1')]={'priority':{'type':Sequelize[_0x1c7c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1c7c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1c7c('0x4')]()},'description':{'type':Sequelize[_0x1c7c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1c7c('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8d7df66..a89cb2c 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x3cf9b7,_0x1d5043){var _0x441f51=function(_0x56acd9){while(--_0x56acd9){_0x3cf9b7['push'](_0x3cf9b7['shift']());}};_0x441f51(++_0x1d5043);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3d3b5a,_0x5967b0){var _0x4a4412=function(_0xe9f9ff){while(--_0xe9f9ff){_0x3d3b5a['push'](_0x3d3b5a['shift']());}};_0x4a4412(++_0x5967b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 629986d..41fc242 100644 --- a/server/api/mailApplication/mailApplication.model.js +++ b/server/api/mailApplication/mailApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa750=['mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication'];(function(_0x2fff2a,_0x26ed4a){var _0x25b25d=function(_0x21eac8){while(--_0x21eac8){_0x2fff2a['push'](_0x2fff2a['shift']());}};_0x25b25d(++_0x26ed4a);}(_0xa750,0xb8));var _0x0a75=function(_0x26fc8a,_0x26f263){_0x26fc8a=_0x26fc8a-0x0;var _0x166ee8=_0xa750[_0x26fc8a];return _0x166ee8;};'use strict';var _=require(_0x0a75('0x0'));var util=require(_0x0a75('0x1'));var logger=require(_0x0a75('0x2'))('api');var moment=require(_0x0a75('0x3'));var BPromise=require('bluebird');var rp=require(_0x0a75('0x4'));var fs=require('fs');var path=require(_0x0a75('0x5'));var rimraf=require(_0x0a75('0x6'));var config=require(_0x0a75('0x7'));var attributes=require(_0x0a75('0x8'));module['exports']=function(_0xcda94c,_0x1ee93b){return _0xcda94c[_0x0a75('0x9')](_0x0a75('0xa'),attributes,{'tableName':_0x0a75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a75('0xc')});}; \ No newline at end of file +var _0xccb4=['MailApplication','mail_applications','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x505f51,_0x1a3e1d){var _0x5468b3=function(_0x371b35){while(--_0x371b35){_0x505f51['push'](_0x505f51['shift']());}};_0x5468b3(++_0x1a3e1d);}(_0xccb4,0x157));var _0x4ccb=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xccb4[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x4ccb('0x0'));var util=require(_0x4ccb('0x1'));var logger=require(_0x4ccb('0x2'))('api');var moment=require(_0x4ccb('0x3'));var BPromise=require('bluebird');var rp=require(_0x4ccb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ccb('0x5'));var config=require(_0x4ccb('0x6'));var attributes=require('./mailApplication.attributes');module[_0x4ccb('0x7')]=function(_0x301e0f,_0x478697){return _0x301e0f[_0x4ccb('0x8')](_0x4ccb('0x9'),attributes,{'tableName':_0x4ccb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 68ec379..c53fcb1 100644 --- a/server/api/mailApplication/mailApplication.rpc.js +++ b/server/api/mailApplication/mailApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x196d=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','then','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x30c23b,_0x3e802e){var _0xe8eec3=function(_0x2231da){while(--_0x2231da){_0x30c23b['push'](_0x30c23b['shift']());}};_0xe8eec3(++_0x3e802e);}(_0x196d,0x13f));var _0xd196=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x196d[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xd196('0x0'));var util=require(_0xd196('0x1'));var moment=require(_0xd196('0x2'));var BPromise=require(_0xd196('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd196('0x4'));var logger=require(_0xd196('0x5'))(_0xd196('0x6'));var config=require(_0xd196('0x7'));var jayson=require(_0xd196('0x8'));var client=jayson[_0xd196('0x9')][_0xd196('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d37b5,_0x31c7da,_0x26839b){return new BPromise(function(_0x58ded5,_0x1d3e6a){return client['request'](_0x1d37b5,_0x26839b)['then'](function(_0x2f8da0){logger[_0xd196('0xb')](_0xd196('0xc'),_0x31c7da,_0xd196('0xd'));logger[_0xd196('0xe')](_0xd196('0xf'),_0x31c7da,_0xd196('0xd'),JSON[_0xd196('0x10')](_0x2f8da0));if(_0x2f8da0['error']){if(_0x2f8da0[_0xd196('0x11')][_0xd196('0x12')]===0x1f4){logger[_0xd196('0x11')](_0xd196('0xc'),_0x31c7da,_0x2f8da0[_0xd196('0x11')][_0xd196('0x13')]);return _0x1d3e6a(_0x2f8da0[_0xd196('0x11')][_0xd196('0x13')]);}logger[_0xd196('0x11')](_0xd196('0xc'),_0x31c7da,_0x2f8da0[_0xd196('0x11')][_0xd196('0x13')]);return _0x58ded5(_0x2f8da0['error'][_0xd196('0x13')]);}else{logger[_0xd196('0xb')](_0xd196('0xc'),_0x31c7da,'request\x20sent');_0x58ded5(_0x2f8da0['result'][_0xd196('0x13')]);}})['catch'](function(_0x2eb0f6){logger[_0xd196('0x11')](_0xd196('0xc'),_0x31c7da,_0x2eb0f6);_0x1d3e6a(_0x2eb0f6);});});}exports[_0xd196('0x14')]=function(_0x39be92){var _0x43f398=this;return new Promise(function(_0x542568,_0x267156){return db[_0xd196('0x15')][_0xd196('0x16')](_0x39be92['body'],{'raw':_0x39be92[_0xd196('0x17')]?_0x39be92[_0xd196('0x17')][_0xd196('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39be92[_0xd196('0x17')]?_0x39be92[_0xd196('0x17')][_0xd196('0x19')]||null:null,'attributes':_0x39be92['options']?_0x39be92[_0xd196('0x17')][_0xd196('0x1a')]||null:null,'limit':_0x39be92[_0xd196('0x17')]?_0x39be92[_0xd196('0x17')][_0xd196('0x1b')]||null:null})[_0xd196('0x1c')](function(_0x22945e){logger['info']('UpdateMailApplication',_0x39be92);logger[_0xd196('0xe')](_0xd196('0x14'),_0x39be92,JSON[_0xd196('0x10')](_0x22945e));_0x542568(_0x22945e);})[_0xd196('0x1d')](function(_0x26c82e){logger[_0xd196('0x11')](_0xd196('0x14'),_0x26c82e[_0xd196('0x13')],_0x39be92);_0x267156(_0x43f398[_0xd196('0x11')](0x1f4,_0x26c82e[_0xd196('0x13')]));});});}; \ No newline at end of file +var _0xa317=['error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa317,0x13a));var _0x7a31=function(_0x3ab6c7,_0x585d4e){_0x3ab6c7=_0x3ab6c7-0x0;var _0x5166ac=_0xa317[_0x3ab6c7];return _0x5166ac;};'use strict';var _=require(_0x7a31('0x0'));var util=require(_0x7a31('0x1'));var moment=require(_0x7a31('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a31('0x3'));var fs=require('fs');var Redis=require(_0x7a31('0x4'));var db=require(_0x7a31('0x5'))['db'];var utils=require(_0x7a31('0x6'));var logger=require('../../config/logger')(_0x7a31('0x7'));var config=require(_0x7a31('0x8'));var jayson=require(_0x7a31('0x9'));var client=jayson['client'][_0x7a31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e733b,_0xc37685,_0x3a0187){return new BPromise(function(_0x3f6e95,_0x4ebc75){return client['request'](_0x4e733b,_0x3a0187)[_0x7a31('0xb')](function(_0x17d0aa){logger['info'](_0x7a31('0xc'),_0xc37685,'request\x20sent');logger['debug'](_0x7a31('0xd'),_0xc37685,_0x7a31('0xe'),JSON[_0x7a31('0xf')](_0x17d0aa));if(_0x17d0aa[_0x7a31('0x10')]){if(_0x17d0aa['error'][_0x7a31('0x11')]===0x1f4){logger[_0x7a31('0x10')](_0x7a31('0xc'),_0xc37685,_0x17d0aa['error'][_0x7a31('0x12')]);return _0x4ebc75(_0x17d0aa[_0x7a31('0x10')][_0x7a31('0x12')]);}logger[_0x7a31('0x10')](_0x7a31('0xc'),_0xc37685,_0x17d0aa[_0x7a31('0x10')][_0x7a31('0x12')]);return _0x3f6e95(_0x17d0aa['error']['message']);}else{logger[_0x7a31('0x13')](_0x7a31('0xc'),_0xc37685,'request\x20sent');_0x3f6e95(_0x17d0aa[_0x7a31('0x14')][_0x7a31('0x12')]);}})[_0x7a31('0x15')](function(_0x45b939){logger['error'](_0x7a31('0xc'),_0xc37685,_0x45b939);_0x4ebc75(_0x45b939);});});}exports[_0x7a31('0x16')]=function(_0x5a4970){var _0x5cc1eb=this;return new Promise(function(_0x5e5eed,_0x37ead9){return db[_0x7a31('0x17')][_0x7a31('0x18')](_0x5a4970[_0x7a31('0x19')],{'raw':_0x5a4970[_0x7a31('0x1a')]?_0x5a4970[_0x7a31('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a4970[_0x7a31('0x1a')]?_0x5a4970['options'][_0x7a31('0x1b')]||null:null,'attributes':_0x5a4970[_0x7a31('0x1a')]?_0x5a4970[_0x7a31('0x1a')][_0x7a31('0x1c')]||null:null,'limit':_0x5a4970[_0x7a31('0x1a')]?_0x5a4970[_0x7a31('0x1a')]['limit']||null:null})[_0x7a31('0xb')](function(_0x542862){logger[_0x7a31('0x13')](_0x7a31('0x16'),_0x5a4970);logger[_0x7a31('0x1d')]('UpdateMailApplication',_0x5a4970,JSON['stringify'](_0x542862));_0x5e5eed(_0x542862);})[_0x7a31('0x15')](function(_0xe4a7){logger['error']('UpdateMailApplication',_0xe4a7[_0x7a31('0x12')],_0x5a4970);_0x37ead9(_0x5cc1eb['error'](0x1f4,_0xe4a7[_0x7a31('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b336e06..e6baeff 100644 --- a/server/api/mailInteraction/index.js +++ b/server/api/mailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f7a=['./mailInteraction.controller','get','isAuthenticated','/:id','show','/:id/messages','/:id/download','download','create','addMessage','post','/:id/tags','mail','mailinteraction:addtags','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','Router','../../components/interaction/service'];(function(_0x284315,_0x3997c8){var _0x2e15ad=function(_0x7d665c){while(--_0x7d665c){_0x284315['push'](_0x284315['shift']());}};_0x2e15ad(++_0x3997c8);}(_0x7f7a,0x1e1));var _0xa7f7=function(_0x5bd337,_0x100b4a){_0x5bd337=_0x5bd337-0x0;var _0x7c8aff=_0x7f7a[_0x5bd337];return _0x7c8aff;};'use strict';var express=require('express');var router=express[_0xa7f7('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0xa7f7('0x1'));var controller=require(_0xa7f7('0x2'));router[_0xa7f7('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa7f7('0x3')]('/describe',auth[_0xa7f7('0x4')](),controller['describe']);router[_0xa7f7('0x3')](_0xa7f7('0x5'),auth['isAuthenticated'](),controller[_0xa7f7('0x6')]);router[_0xa7f7('0x3')](_0xa7f7('0x7'),auth[_0xa7f7('0x4')](),controller['getMessages']);router[_0xa7f7('0x3')](_0xa7f7('0x8'),auth[_0xa7f7('0x4')](),controller[_0xa7f7('0x9')]);router['post']('/',auth[_0xa7f7('0x4')](),controller[_0xa7f7('0xa')]);router['post']('/:id/messages',auth[_0xa7f7('0x4')](),controller[_0xa7f7('0xb')]);router[_0xa7f7('0xc')](_0xa7f7('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xa7f7('0xe'),_0xa7f7('0xf')),controller['addTags']);router['put'](_0xa7f7('0x5'),auth[_0xa7f7('0x4')](),interaction[_0xa7f7('0x10')](_0xa7f7('0xe'),_0xa7f7('0x11')),controller[_0xa7f7('0x12')]);router[_0xa7f7('0x13')]('/:id',auth[_0xa7f7('0x4')](),interaction['tracked']('mail',_0xa7f7('0x14')),controller['destroy']);router['delete'](_0xa7f7('0xd'),auth['isAuthenticated'](),controller[_0xa7f7('0x15')]);module[_0xa7f7('0x16')]=router; \ No newline at end of file +var _0x9974=['download','post','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x49c76a,_0xe57cef){var _0x154c79=function(_0x59fc43){while(--_0x59fc43){_0x49c76a['push'](_0x49c76a['shift']());}};_0x154c79(++_0xe57cef);}(_0x9974,0xb1));var _0x4997=function(_0x4d42c2,_0x5e8dc1){_0x4d42c2=_0x4d42c2-0x0;var _0x476ed1=_0x9974[_0x4d42c2];return _0x476ed1;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4997('0x0'));var interaction=require(_0x4997('0x1'));var controller=require(_0x4997('0x2'));router[_0x4997('0x3')]('/',auth[_0x4997('0x4')](),controller[_0x4997('0x5')]);router[_0x4997('0x3')](_0x4997('0x6'),auth['isAuthenticated'](),controller[_0x4997('0x7')]);router['get'](_0x4997('0x8'),auth[_0x4997('0x4')](),controller[_0x4997('0x9')]);router[_0x4997('0x3')](_0x4997('0xa'),auth[_0x4997('0x4')](),controller['getMessages']);router[_0x4997('0x3')](_0x4997('0xb'),auth[_0x4997('0x4')](),controller[_0x4997('0xc')]);router[_0x4997('0xd')]('/',auth[_0x4997('0x4')](),controller['create']);router[_0x4997('0xd')](_0x4997('0xa'),auth[_0x4997('0x4')](),controller[_0x4997('0xe')]);router[_0x4997('0xd')]('/:id/tags',auth[_0x4997('0x4')](),interaction[_0x4997('0xf')](_0x4997('0x10'),_0x4997('0x11')),controller[_0x4997('0x12')]);router[_0x4997('0x13')](_0x4997('0x8'),auth[_0x4997('0x4')](),interaction[_0x4997('0xf')](_0x4997('0x10'),_0x4997('0x14')),controller[_0x4997('0x15')]);router[_0x4997('0x16')](_0x4997('0x8'),auth[_0x4997('0x4')](),interaction[_0x4997('0xf')]('mail','mailinteraction:destroy'),controller[_0x4997('0x17')]);router[_0x4997('0x16')](_0x4997('0x18'),auth['isAuthenticated'](),controller[_0x4997('0x19')]);module[_0x4997('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d45213f..521aeba 100644 --- a/server/api/mailInteraction/mailInteraction.attributes.js +++ b/server/api/mailInteraction/mailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x101a=['out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x101a,0x136));var _0xa101=function(_0x2861a7,_0x40259a){_0x2861a7=_0x2861a7-0x0;var _0x5316ee=_0x101a[_0x2861a7];return _0x5316ee;};'use strict';var Sequelize=require(_0xa101('0x0'));var iconv=require(_0xa101('0x1'));module[_0xa101('0x2')]={'closed':{'type':Sequelize[_0xa101('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa101('0x4')]},'disposition':{'type':Sequelize[_0xa101('0x5')]},'secondDisposition':{'type':Sequelize[_0xa101('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa101('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xa101('0x5')](0x1fe)},'to':{'type':Sequelize[_0xa101('0x5')]},'cc':{'type':Sequelize[_0xa101('0x6')](_0xa101('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xa101('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xa101('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa101('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa101('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa101('0x8')]('in',_0xa101('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa101('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa101('0xa')]}}; \ No newline at end of file +var _0x91ab=['out','INTEGER','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM'];(function(_0x5a7a21,_0x3c40da){var _0x3acd97=function(_0x106191){while(--_0x106191){_0x5a7a21['push'](_0x5a7a21['shift']());}};_0x3acd97(++_0x3c40da);}(_0x91ab,0x146));var _0xb91a=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x91ab[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xb91a('0x0')]={'closed':{'type':Sequelize[_0xb91a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb91a('0x2')]},'disposition':{'type':Sequelize[_0xb91a('0x3')]},'secondDisposition':{'type':Sequelize[_0xb91a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb91a('0x3')]},'note':{'type':Sequelize[_0xb91a('0x3')]},'inReplyTo':{'type':Sequelize[_0xb91a('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0xb91a('0x4'))},'subject':{'type':Sequelize[_0xb91a('0x5')]()},'attach':{'type':Sequelize[_0xb91a('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb91a('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xb91a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb91a('0x6')]('in',_0xb91a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb91a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb91a('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb91a('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb91a('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index dc89b68..bb902c0 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7656=['find','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','inlineCss','true','rows','addTags','setTags','spread','Tag','findAll','color','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','attachments','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','build','rimraf','zip-dir','moment','path','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','include','merge'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x7656,0x190));var _0x6765=function(_0x4bd0aa,_0x3da92e){_0x4bd0aa=_0x4bd0aa-0x0;var _0x59aee6=_0x7656[_0x4bd0aa];return _0x59aee6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6765('0x0'));var zipdir=require(_0x6765('0x1'));var moment=require(_0x6765('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x6765('0x3'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0x6765('0x4'));var interaction=require(_0x6765('0x5'));var qs=require(_0x6765('0x6'));var logger=require('../../config/logger')(_0x6765('0x7'));var config=require('../../config/environment');var db=require(_0x6765('0x8'))['db'];var htmlEntities=require('html-entities');config[_0x6765('0x9')]=_[_0x6765('0xa')](config[_0x6765('0x9')],{'host':_0x6765('0xb'),'port':0x18eb});var socket=require(_0x6765('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x6765('0xd')](socket);function respondWithStatusCode(_0x4feda9,_0x789416){_0x789416=_0x789416||0xcc;return function(_0xcbb2ec){if(_0xcbb2ec){return _0x4feda9[_0x6765('0xe')](_0x789416);}return _0x4feda9[_0x6765('0xf')](_0x789416)[_0x6765('0x10')]();};}function respondWithResult(_0x5bc8ed,_0x2dfc76){_0x2dfc76=_0x2dfc76||0xc8;return function(_0x2a49c4){if(_0x2a49c4){return _0x5bc8ed[_0x6765('0xf')](_0x2dfc76)[_0x6765('0x11')](_0x2a49c4);}};}function respondWithFilteredResult(_0x5bf3c8,_0x17ede3){return function(_0x2c4b84){if(_0x2c4b84){var _0x5b0d2d=typeof _0x17ede3[_0x6765('0x12')]===_0x6765('0x13')&&typeof _0x17ede3[_0x6765('0x14')]===_0x6765('0x13');var _0x45b0fb=_0x2c4b84['count'];var _0x10ca07=_0x5b0d2d?0x0:_0x17ede3['offset'];var _0x1773f6=_0x5b0d2d?_0x2c4b84[_0x6765('0x15')]:_0x17ede3[_0x6765('0x12')]+_0x17ede3[_0x6765('0x14')];var _0x4d71fe;if(_0x1773f6>=_0x45b0fb){_0x1773f6=_0x45b0fb;_0x4d71fe=0xc8;}else{_0x4d71fe=0xce;}_0x5bf3c8['status'](_0x4d71fe);return _0x5bf3c8[_0x6765('0x16')](_0x6765('0x17'),_0x10ca07+'-'+_0x1773f6+'/'+_0x45b0fb)['json'](_0x2c4b84);}return null;};}function saveUpdates(_0x286cd0){return function(_0x3a301f){if(_0x3a301f){return _0x3a301f[_0x6765('0x18')](_0x286cd0)[_0x6765('0x19')](function(_0x5f0063){return _0x5f0063;});}return null;};}function removeEntity(_0x393375){return function(_0x29b1a5){if(_0x29b1a5){return _0x29b1a5['destroy']()[_0x6765('0x19')](function(){_0x393375['status'](0xcc)[_0x6765('0x10')]();});}};}function handleEntityNotFound(_0x1b8b5e){return function(_0x8d5581){if(!_0x8d5581){_0x1b8b5e[_0x6765('0xe')](0x194);}return _0x8d5581;};}function handleError(_0x44d410,_0x1b07c4){_0x1b07c4=_0x1b07c4||0x1f4;return function(_0x5c33ed){logger[_0x6765('0x1a')](_0x5c33ed[_0x6765('0x1b')]);if(_0x5c33ed['name']){delete _0x5c33ed[_0x6765('0x1c')];}_0x44d410['status'](_0x1b07c4)['send'](_0x5c33ed);};}exports[_0x6765('0x1d')]=function(_0x1620ec,_0x10c19d){var _0x5dfd84={};var _0x2e855a=_[_0x6765('0x1e')](db[_0x6765('0x1f')][_0x6765('0x20')],function(_0x2fe7d0){return{'name':_0x2fe7d0[_0x6765('0x21')],'type':_0x2fe7d0[_0x6765('0x22')][_0x6765('0x23')]};});_0x5dfd84=qs[_0x6765('0x24')](_0x2e855a,_0x1620ec);return interaction['findAll'](_0x6765('0x25'),_0x1620ec[_0x6765('0x26')],_0x1620ec[_0x6765('0x27')],_0x5dfd84,_0x2e855a)[_0x6765('0x19')](respondWithFilteredResult(_0x10c19d,_0x5dfd84))[_0x6765('0x28')](handleError(_0x10c19d,null));};exports[_0x6765('0x29')]=function(_0x19ffae,_0x5c405d){var _0x4fb91b={'raw':![],'where':{'id':_0x19ffae[_0x6765('0x2a')]['id']}},_0x50233a={};_0x50233a[_0x6765('0x2b')]=_[_0x6765('0x2c')](db[_0x6765('0x1f')][_0x6765('0x20')]);_0x50233a['query']=_[_0x6765('0x2c')](_0x19ffae[_0x6765('0x26')]);_0x50233a[_0x6765('0x2d')]=_[_0x6765('0x2e')](_0x50233a[_0x6765('0x2b')],_0x50233a[_0x6765('0x26')]);_0x4fb91b[_0x6765('0x2f')]=_[_0x6765('0x2e')](_0x50233a[_0x6765('0x2b')],qs[_0x6765('0x30')](_0x19ffae[_0x6765('0x26')][_0x6765('0x30')]));_0x4fb91b[_0x6765('0x2f')]=_0x4fb91b[_0x6765('0x2f')][_0x6765('0x31')]?_0x4fb91b[_0x6765('0x2f')]:_0x50233a[_0x6765('0x2b')];if(_0x19ffae[_0x6765('0x26')]['includeAll']){_0x4fb91b[_0x6765('0x32')]=[{'all':!![]}];}_0x4fb91b=_[_0x6765('0x33')]({},_0x4fb91b,_0x19ffae['options']);return db[_0x6765('0x1f')][_0x6765('0x34')](_0x4fb91b)[_0x6765('0x19')](handleEntityNotFound(_0x5c405d,null))['then'](respondWithResult(_0x5c405d,null))[_0x6765('0x28')](handleError(_0x5c405d,null));};exports['create']=function(_0x19223f,_0x5cff4d){return db[_0x6765('0x1f')]['create'](_0x19223f['body'],{})[_0x6765('0x19')](respondWithResult(_0x5cff4d,0xc9))[_0x6765('0x28')](handleError(_0x5cff4d,null));};exports[_0x6765('0x18')]=function(_0x5de07c,_0x55eb21){if(_0x5de07c[_0x6765('0x35')]['id']){delete _0x5de07c[_0x6765('0x35')]['id'];}return db[_0x6765('0x1f')][_0x6765('0x34')]({'where':{'id':_0x5de07c[_0x6765('0x2a')]['id']}})[_0x6765('0x19')](handleEntityNotFound(_0x55eb21,null))[_0x6765('0x19')](saveUpdates(_0x5de07c[_0x6765('0x35')],null))[_0x6765('0x19')](respondWithResult(_0x55eb21,null))[_0x6765('0x28')](handleError(_0x55eb21,null));};exports[_0x6765('0x36')]=function(_0x25b419,_0x3628ce){return db['MailInteraction']['find']({'where':{'id':_0x25b419[_0x6765('0x2a')]['id']}})[_0x6765('0x19')](handleEntityNotFound(_0x3628ce,null))[_0x6765('0x19')](removeEntity(_0x3628ce,null))[_0x6765('0x28')](handleError(_0x3628ce,null));};exports['describe']=function(_0xd41108,_0x5bdf61){return db[_0x6765('0x1f')][_0x6765('0x37')]()[_0x6765('0x19')](respondWithResult(_0x5bdf61,null))[_0x6765('0x28')](handleError(_0x5bdf61,null));};exports[_0x6765('0x38')]=function(_0x7250c9,_0x5e7ba1){return db[_0x6765('0x39')][_0x6765('0x34')]({'where':{'id':_0x7250c9[_0x6765('0x2a')]['id']}})[_0x6765('0x19')](handleEntityNotFound(_0x5e7ba1,null))['then'](function(_0xbee77a){if(_0xbee77a){return _0xbee77a[_0x6765('0x38')](_0x7250c9[_0x6765('0x35')][_0x6765('0x3a')],_[_0x6765('0x3b')](_0x7250c9[_0x6765('0x35')],['ids','id'])||{});}})['then'](respondWithResult(_0x5e7ba1,null))['catch'](handleError(_0x5e7ba1,null));};exports[_0x6765('0x3c')]=function(_0x296d66,_0x2b7ec2){var _0x4da746={'raw':![],'where':{}};var _0x2892d8={};var _0x8670ec={'count':0x0,'rows':[]};return db[_0x6765('0x1f')][_0x6765('0x3d')]({'where':{'id':_0x296d66[_0x6765('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2b7ec2,null))[_0x6765('0x19')](function(_0x22583e){if(_0x22583e){_0x2892d8[_0x6765('0x2b')]=_[_0x6765('0x2c')](db[_0x6765('0x39')][_0x6765('0x20')]);_0x2892d8[_0x6765('0x26')]=_[_0x6765('0x2c')](_0x296d66['query']);_0x2892d8[_0x6765('0x2d')]=_[_0x6765('0x2e')](_0x2892d8['model'],_0x2892d8[_0x6765('0x26')]);_0x4da746[_0x6765('0x2f')]=_[_0x6765('0x2e')](_0x2892d8[_0x6765('0x2b')],qs[_0x6765('0x30')](_0x296d66[_0x6765('0x26')]['fields']));_0x4da746[_0x6765('0x2f')]=_0x4da746[_0x6765('0x2f')][_0x6765('0x31')]?_0x4da746['attributes']:_0x2892d8[_0x6765('0x2b')];if(!_0x296d66[_0x6765('0x26')][_0x6765('0x3e')](_0x6765('0x3f'))){_0x4da746[_0x6765('0x14')]=qs[_0x6765('0x14')](_0x296d66['query'][_0x6765('0x14')]);_0x4da746[_0x6765('0x12')]=qs['offset'](_0x296d66[_0x6765('0x26')]['offset']);}_0x4da746[_0x6765('0x40')]=qs[_0x6765('0x41')](_0x296d66['query'][_0x6765('0x41')]);_0x4da746[_0x6765('0x42')]=qs[_0x6765('0x2d')](_[_0x6765('0x43')](_0x296d66[_0x6765('0x26')],_0x2892d8['filters']));_0x4da746[_0x6765('0x42')][_0x6765('0x44')]=_0x22583e['id'];if(_0x296d66[_0x6765('0x26')][_0x6765('0x45')]){_0x4da746['where']=_[_0x6765('0x33')](_0x4da746[_0x6765('0x42')],{'$or':_[_0x6765('0x1e')](_0x4da746[_0x6765('0x2f')],function(_0x2bebb1){var _0xd1e562={};_0xd1e562[_0x2bebb1]={'$like':'%'+_0x296d66[_0x6765('0x26')][_0x6765('0x45')]+'%'};return _0xd1e562;})});}if(_0x296d66[_0x6765('0x26')][_0x6765('0x46')]){var _0x27e899=_0x296d66[_0x6765('0x26')]['$gte'][_0x6765('0x47')](',');var _0x52891b={};_0x52891b[_0x27e899[0x0]]={'$gte':moment(_0x27e899[0x1])[_0x6765('0x48')](_0x6765('0x49'))};_0x4da746[_0x6765('0x42')]=_[_0x6765('0x33')](_0x4da746[_0x6765('0x42')],_0x52891b);}_0x4da746=_[_0x6765('0x33')]({},_0x4da746,_0x296d66[_0x6765('0x4a')]);return db[_0x6765('0x39')][_0x6765('0x15')]({'where':_0x4da746[_0x6765('0x42')]})[_0x6765('0x19')](function(_0x48cdec){_0x8670ec[_0x6765('0x15')]=_0x48cdec;if(_0x296d66[_0x6765('0x26')][_0x6765('0x4b')]){_0x4da746['include']=[{'all':!![]}];}return db[_0x6765('0x39')]['findAll'](_0x4da746);})[_0x6765('0x19')](function(_0x3e5da0){if(_0x296d66[_0x6765('0x26')][_0x6765('0x4c')]===_0x6765('0x4d')){for(var _0x523f97=0x0;_0x523f97<_0x3e5da0['length'];_0x523f97++){_0x3e5da0[_0x523f97][_0x6765('0x35')]=juice(_0x3e5da0[_0x523f97][_0x6765('0x35')]);}}_0x8670ec[_0x6765('0x4e')]=_0x3e5da0;return _0x8670ec;});}})[_0x6765('0x19')](respondWithFilteredResult(_0x2b7ec2,_0x4da746))[_0x6765('0x28')](handleError(_0x2b7ec2,null));};exports[_0x6765('0x4f')]=function(_0x603b90,_0x1944ae){return db['MailInteraction'][_0x6765('0x34')]({'where':{'id':_0x603b90[_0x6765('0x2a')]['id']}})[_0x6765('0x19')](handleEntityNotFound(_0x1944ae,null))[_0x6765('0x19')](function(_0x562ff3){if(_0x562ff3){return _0x562ff3[_0x6765('0x50')](_0x603b90['body'][_0x6765('0x3a')],_['omit'](_0x603b90[_0x6765('0x35')],[_0x6765('0x3a'),'id'])||{})[_0x6765('0x51')](function(){return db[_0x6765('0x52')][_0x6765('0x53')]({'attributes':['id',_0x6765('0x1c'),_0x6765('0x54')],'where':{'id':_0x603b90['body'][_0x6765('0x3a')]}});})[_0x6765('0x19')](function(_0x3ac6c2){socket[_0x6765('0x55')](_0x6765('0x56'),{'id':Number(_0x603b90[_0x6765('0x2a')]['id']),'tags':_0x3ac6c2||[]});return{'id':Number(_0x603b90[_0x6765('0x2a')]['id']),'tags':_0x3ac6c2||[]};});}})['then'](respondWithResult(_0x1944ae,null))['catch'](handleError(_0x1944ae,null));};exports[_0x6765('0x57')]=function(_0x3cd47f,_0x26913c){return db[_0x6765('0x1f')][_0x6765('0x34')]({'where':{'id':_0x3cd47f['params']['id']}})[_0x6765('0x19')](handleEntityNotFound(_0x26913c,null))[_0x6765('0x19')](function(_0x3c0a57){if(_0x3c0a57){return _0x3c0a57['removeTags'](_0x3cd47f['query'][_0x6765('0x3a')]);}})[_0x6765('0x19')](respondWithStatusCode(_0x26913c,null))[_0x6765('0x28')](handleError(_0x26913c,null));};exports[_0x6765('0x58')]=function(_0x4692c2,_0x69e890){var _0x19b3d0=moment()[_0x6765('0x59')]()['toString']();var _0x22a3f7=path[_0x6765('0x5a')](config['root'],_0x6765('0x5b'),_0x6765('0x5c'),_0x6765('0x5d'));var _0x3ed1bd=path['join'](config['root'],_0x6765('0x5b'),'files',_0x6765('0x5e'));var _0x4b90aa=path[_0x6765('0x5a')](_0x22a3f7,_0x19b3d0);var _0x3892bc=util[_0x6765('0x48')]('transcript-%d-%s.zip',_0x4692c2[_0x6765('0x2a')]['id'],_0x19b3d0);var _0x16ab19=path['join'](_0x22a3f7,_0x3892bc);var _0x5ab3bc=[];if(_0x4692c2[_0x6765('0x26')][_0x6765('0x5e')]){_0x5ab3bc[_0x6765('0x5f')]({'model':db[_0x6765('0x60')],'as':_0x6765('0x61'),'raw':!![]});}var _0x38a803=[{'model':db[_0x6765('0x39')],'as':'Messages','attributes':['id',_0x6765('0x35'),_0x6765('0x62'),'to','cc',_0x6765('0x63'),_0x6765('0x64'),_0x6765('0x65')],'where':{'secret':![]},'order':qs[_0x6765('0x41')]('id'),'include':_0x5ab3bc}];return db[_0x6765('0x1f')][_0x6765('0x34')]({'where':{'id':_0x4692c2[_0x6765('0x2a')]['id']},'include':_0x38a803})[_0x6765('0x19')](handleEntityNotFound(_0x69e890,null))[_0x6765('0x19')](function(_0x22d2e0){if(_0x22d2e0&&_0x22d2e0[_0x6765('0x66')]){var _0x14d4f4=_0x22d2e0[_0x6765('0x67')]({'plain':!![]});fs[_0x6765('0x68')](_0x4b90aa);return BPromise[_0x6765('0x69')](_0x14d4f4[_0x6765('0x66')],function(_0x41cdc3,_0x2df100){var _0x4a8e79={'from':_0x41cdc3[_0x6765('0x62')],'to':_0x41cdc3['to']||_0x6765('0x6a'),'subject':_0x41cdc3[_0x6765('0x64')],'html':htmlEntities[_0x6765('0x6b')](_0x41cdc3[_0x6765('0x35')]),'headers':{'Date':moment(_0x41cdc3[_0x6765('0x65')])['format'](_0x6765('0x6c'))},'attachments':[]};if(_0x41cdc3['cc']){_0x4a8e79['headers']['Cc']=_0x41cdc3['cc'];}if(_0x41cdc3['bcc']){_0x4a8e79[_0x6765('0x6d')][_0x6765('0x6e')]=_0x41cdc3['bcc'];}return new BPromise(function(_0x3e94d2,_0x139de7){if(_0x41cdc3[_0x6765('0x61')]){for(var _0x4da2e8=0x0;_0x4da2e8<_0x41cdc3[_0x6765('0x61')][_0x6765('0x31')];_0x4da2e8++){var _0xb3d845=_0x41cdc3[_0x6765('0x61')][_0x4da2e8];var _0x3e91e6=path[_0x6765('0x5a')](_0x3ed1bd,_0xb3d845['basename']);if(fs['existsSync'](_0x3e91e6)){_0x4a8e79[_0x6765('0x5e')][_0x6765('0x5f')]({'name':_0xb3d845['name'],'contentType':_0xb3d845[_0x6765('0x22')],'data':fs[_0x6765('0x6f')](_0x3e91e6)});}}}emlformat[_0x6765('0x70')](_0x4a8e79,function(_0x282d92,_0x4ff93f){if(_0x282d92)return _0x139de7(_0x282d92);fs['writeFileSync'](path[_0x6765('0x5a')](_0x4b90aa,util[_0x6765('0x48')]('message%d.eml',_0x2df100)),_0x4ff93f);return _0x3e94d2(_0x4ff93f);});});})[_0x6765('0x19')](function(){return new BPromise(function(_0x4c8eaa,_0xb46d87){zipdir(_0x4b90aa,{'saveTo':_0x16ab19},function(_0x37cfa0,_0x541656){if(_0x37cfa0)return _0xb46d87(_0x37cfa0);return _0x4c8eaa(_0x541656);});})[_0x6765('0x19')](function(){return new BPromise(function(_0x5680a3,_0x1d162c){rimraf(_0x4b90aa,function(_0x35c95e){if(_0x35c95e)_0x1d162c(_0x35c95e);return _0x5680a3();});});})['then'](function(){return _0x69e890[_0x6765('0x58')](_0x16ab19,_0x3892bc,function(_0x5d337c){if(!_0x5d337c)fs['unlinkSync'](_0x16ab19);});});});}else{return _0x69e890['sendStatus'](0xc8);}})['catch'](handleError(_0x69e890,null));}; \ No newline at end of file +var _0x71cd=['pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','length','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','type','build','unlinkSync','eml-format','rimraf','zip-dir','moment','util','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','mail','query','user','catch','show','params','keys','filters','intersection','attributes','fields','model','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','omit','hasOwnProperty','nolimit','order','sort','where'];(function(_0x340da7,_0x13d6fc){var _0x43b466=function(_0x59e11e){while(--_0x59e11e){_0x340da7['push'](_0x340da7['shift']());}};_0x43b466(++_0x13d6fc);}(_0x71cd,0x11b));var _0xd71c=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x71cd[_0x5834bc];return _0x3e183a;};'use strict';var emlformat=require(_0xd71c('0x0'));var rimraf=require(_0xd71c('0x1'));var zipdir=require(_0xd71c('0x2'));var moment=require(_0xd71c('0x3'));var BPromise=require('bluebird');var util=require(_0xd71c('0x4'));var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0xd71c('0x5'));var interaction=require(_0xd71c('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xd71c('0x7'))(_0xd71c('0x8'));var config=require(_0xd71c('0x9'));var db=require(_0xd71c('0xa'))['db'];var htmlEntities=require(_0xd71c('0xb'));config[_0xd71c('0xc')]=_[_0xd71c('0xd')](config[_0xd71c('0xc')],{'host':_0xd71c('0xe'),'port':0x18eb});var socket=require(_0xd71c('0xf'))(new Redis(config[_0xd71c('0xc')]));require('./mailInteraction.socket')[_0xd71c('0x10')](socket);function respondWithStatusCode(_0x405982,_0x35b045){_0x35b045=_0x35b045||0xcc;return function(_0x5329ad){if(_0x5329ad){return _0x405982[_0xd71c('0x11')](_0x35b045);}return _0x405982[_0xd71c('0x12')](_0x35b045)[_0xd71c('0x13')]();};}function respondWithResult(_0x3548e8,_0x4daf52){_0x4daf52=_0x4daf52||0xc8;return function(_0x2ff53d){if(_0x2ff53d){return _0x3548e8['status'](_0x4daf52)[_0xd71c('0x14')](_0x2ff53d);}};}function respondWithFilteredResult(_0x163c33,_0xba50ab){return function(_0x10983c){if(_0x10983c){var _0x181bc8=typeof _0xba50ab[_0xd71c('0x15')]===_0xd71c('0x16')&&typeof _0xba50ab['limit']==='undefined';var _0x48d581=_0x10983c[_0xd71c('0x17')];var _0x10c83b=_0x181bc8?0x0:_0xba50ab[_0xd71c('0x15')];var _0x5512e7=_0x181bc8?_0x10983c[_0xd71c('0x17')]:_0xba50ab[_0xd71c('0x15')]+_0xba50ab[_0xd71c('0x18')];var _0x4bf252;if(_0x5512e7>=_0x48d581){_0x5512e7=_0x48d581;_0x4bf252=0xc8;}else{_0x4bf252=0xce;}_0x163c33[_0xd71c('0x12')](_0x4bf252);return _0x163c33[_0xd71c('0x19')](_0xd71c('0x1a'),_0x10c83b+'-'+_0x5512e7+'/'+_0x48d581)[_0xd71c('0x14')](_0x10983c);}return null;};}function saveUpdates(_0x286dfd){return function(_0x4e7084){if(_0x4e7084){return _0x4e7084[_0xd71c('0x1b')](_0x286dfd)[_0xd71c('0x1c')](function(_0x50eb4c){return _0x50eb4c;});}return null;};}function removeEntity(_0x11a6be){return function(_0x5334a9){if(_0x5334a9){return _0x5334a9[_0xd71c('0x1d')]()[_0xd71c('0x1c')](function(){_0x11a6be[_0xd71c('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x527854){return function(_0x1079be){if(!_0x1079be){_0x527854[_0xd71c('0x11')](0x194);}return _0x1079be;};}function handleError(_0xd4de33,_0x13c4e0){_0x13c4e0=_0x13c4e0||0x1f4;return function(_0x355d0e){logger[_0xd71c('0x1e')](_0x355d0e[_0xd71c('0x1f')]);if(_0x355d0e[_0xd71c('0x20')]){delete _0x355d0e[_0xd71c('0x20')];}_0xd4de33[_0xd71c('0x12')](_0x13c4e0)[_0xd71c('0x21')](_0x355d0e);};}exports[_0xd71c('0x22')]=function(_0x1b01f7,_0xe4e4a5){var _0x2c5ce9={};var _0x138d13=_[_0xd71c('0x23')](db[_0xd71c('0x24')][_0xd71c('0x25')],function(_0x59eeb9){return{'name':_0x59eeb9[_0xd71c('0x26')],'type':_0x59eeb9['type'][_0xd71c('0x27')]};});_0x2c5ce9=qs[_0xd71c('0x28')](_0x138d13,_0x1b01f7);return interaction[_0xd71c('0x29')](_0xd71c('0x2a'),_0x1b01f7[_0xd71c('0x2b')],_0x1b01f7[_0xd71c('0x2c')],_0x2c5ce9,_0x138d13)['then'](respondWithFilteredResult(_0xe4e4a5,_0x2c5ce9))[_0xd71c('0x2d')](handleError(_0xe4e4a5,null));};exports[_0xd71c('0x2e')]=function(_0x2a7640,_0x44c500){var _0x41f62c={'raw':![],'where':{'id':_0x2a7640[_0xd71c('0x2f')]['id']}},_0x5289d7={};_0x5289d7['model']=_['keys'](db['MailInteraction']['rawAttributes']);_0x5289d7[_0xd71c('0x2b')]=_[_0xd71c('0x30')](_0x2a7640[_0xd71c('0x2b')]);_0x5289d7[_0xd71c('0x31')]=_[_0xd71c('0x32')](_0x5289d7['model'],_0x5289d7['query']);_0x41f62c[_0xd71c('0x33')]=_[_0xd71c('0x32')](_0x5289d7['model'],qs['fields'](_0x2a7640[_0xd71c('0x2b')][_0xd71c('0x34')]));_0x41f62c[_0xd71c('0x33')]=_0x41f62c[_0xd71c('0x33')]['length']?_0x41f62c['attributes']:_0x5289d7[_0xd71c('0x35')];if(_0x2a7640[_0xd71c('0x2b')][_0xd71c('0x36')]){_0x41f62c[_0xd71c('0x37')]=[{'all':!![]}];}_0x41f62c=_[_0xd71c('0x38')]({},_0x41f62c,_0x2a7640[_0xd71c('0x39')]);return db['MailInteraction'][_0xd71c('0x3a')](_0x41f62c)['then'](handleEntityNotFound(_0x44c500,null))['then'](respondWithResult(_0x44c500,null))[_0xd71c('0x2d')](handleError(_0x44c500,null));};exports[_0xd71c('0x3b')]=function(_0x23793d,_0x30760e){return db[_0xd71c('0x24')][_0xd71c('0x3b')](_0x23793d[_0xd71c('0x3c')],{})[_0xd71c('0x1c')](respondWithResult(_0x30760e,0xc9))['catch'](handleError(_0x30760e,null));};exports[_0xd71c('0x1b')]=function(_0x2b4906,_0x47add6){if(_0x2b4906[_0xd71c('0x3c')]['id']){delete _0x2b4906[_0xd71c('0x3c')]['id'];}return db[_0xd71c('0x24')][_0xd71c('0x3a')]({'where':{'id':_0x2b4906[_0xd71c('0x2f')]['id']}})[_0xd71c('0x1c')](handleEntityNotFound(_0x47add6,null))[_0xd71c('0x1c')](saveUpdates(_0x2b4906[_0xd71c('0x3c')],null))['then'](respondWithResult(_0x47add6,null))[_0xd71c('0x2d')](handleError(_0x47add6,null));};exports[_0xd71c('0x1d')]=function(_0x18ecf2,_0x47afbe){return db['MailInteraction'][_0xd71c('0x3a')]({'where':{'id':_0x18ecf2[_0xd71c('0x2f')]['id']}})[_0xd71c('0x1c')](handleEntityNotFound(_0x47afbe,null))[_0xd71c('0x1c')](removeEntity(_0x47afbe,null))[_0xd71c('0x2d')](handleError(_0x47afbe,null));};exports[_0xd71c('0x3d')]=function(_0x5633ed,_0x2512d5){return db[_0xd71c('0x24')]['describe']()[_0xd71c('0x1c')](respondWithResult(_0x2512d5,null))[_0xd71c('0x2d')](handleError(_0x2512d5,null));};exports[_0xd71c('0x3e')]=function(_0x155609,_0x2b52b3){return db[_0xd71c('0x3f')][_0xd71c('0x3a')]({'where':{'id':_0x155609[_0xd71c('0x2f')]['id']}})[_0xd71c('0x1c')](handleEntityNotFound(_0x2b52b3,null))[_0xd71c('0x1c')](function(_0x2cf761){if(_0x2cf761){return _0x2cf761[_0xd71c('0x3e')](_0x155609['body'][_0xd71c('0x40')],_[_0xd71c('0x41')](_0x155609['body'],['ids','id'])||{});}})[_0xd71c('0x1c')](respondWithResult(_0x2b52b3,null))['catch'](handleError(_0x2b52b3,null));};exports['getMessages']=function(_0x2721d0,_0x59f1cb){var _0xc7d1c5={'raw':![],'where':{}};var _0x73f60a={};var _0x314323={'count':0x0,'rows':[]};return db[_0xd71c('0x24')]['findOne']({'where':{'id':_0x2721d0['params']['id']}})[_0xd71c('0x1c')](handleEntityNotFound(_0x59f1cb,null))[_0xd71c('0x1c')](function(_0x225cf5){if(_0x225cf5){_0x73f60a[_0xd71c('0x35')]=_[_0xd71c('0x30')](db[_0xd71c('0x3f')][_0xd71c('0x25')]);_0x73f60a['query']=_[_0xd71c('0x30')](_0x2721d0['query']);_0x73f60a[_0xd71c('0x31')]=_[_0xd71c('0x32')](_0x73f60a[_0xd71c('0x35')],_0x73f60a['query']);_0xc7d1c5[_0xd71c('0x33')]=_['intersection'](_0x73f60a['model'],qs['fields'](_0x2721d0[_0xd71c('0x2b')][_0xd71c('0x34')]));_0xc7d1c5[_0xd71c('0x33')]=_0xc7d1c5['attributes']['length']?_0xc7d1c5[_0xd71c('0x33')]:_0x73f60a[_0xd71c('0x35')];if(!_0x2721d0['query'][_0xd71c('0x42')](_0xd71c('0x43'))){_0xc7d1c5[_0xd71c('0x18')]=qs[_0xd71c('0x18')](_0x2721d0['query'][_0xd71c('0x18')]);_0xc7d1c5[_0xd71c('0x15')]=qs[_0xd71c('0x15')](_0x2721d0['query'][_0xd71c('0x15')]);}_0xc7d1c5[_0xd71c('0x44')]=qs[_0xd71c('0x45')](_0x2721d0['query']['sort']);_0xc7d1c5[_0xd71c('0x46')]=qs['filters'](_[_0xd71c('0x47')](_0x2721d0[_0xd71c('0x2b')],_0x73f60a['filters']));_0xc7d1c5['where'][_0xd71c('0x48')]=_0x225cf5['id'];if(_0x2721d0[_0xd71c('0x2b')][_0xd71c('0x49')]){_0xc7d1c5[_0xd71c('0x46')]=_[_0xd71c('0x38')](_0xc7d1c5['where'],{'$or':_[_0xd71c('0x23')](_0xc7d1c5[_0xd71c('0x33')],function(_0x51b84c){var _0x263dc5={};_0x263dc5[_0x51b84c]={'$like':'%'+_0x2721d0['query']['filter']+'%'};return _0x263dc5;})});}if(_0x2721d0[_0xd71c('0x2b')][_0xd71c('0x4a')]){var _0x2108dd=_0x2721d0[_0xd71c('0x2b')][_0xd71c('0x4a')][_0xd71c('0x4b')](',');var _0x2a4731={};_0x2a4731[_0x2108dd[0x0]]={'$gte':moment(_0x2108dd[0x1])[_0xd71c('0x4c')](_0xd71c('0x4d'))};_0xc7d1c5[_0xd71c('0x46')]=_['merge'](_0xc7d1c5[_0xd71c('0x46')],_0x2a4731);}_0xc7d1c5=_['merge']({},_0xc7d1c5,_0x2721d0['options']);return db[_0xd71c('0x3f')][_0xd71c('0x17')]({'where':_0xc7d1c5[_0xd71c('0x46')]})['then'](function(_0x25d43b){_0x314323[_0xd71c('0x17')]=_0x25d43b;if(_0x2721d0['query'][_0xd71c('0x36')]){_0xc7d1c5[_0xd71c('0x37')]=[{'all':!![]}];}return db['MailMessage'][_0xd71c('0x29')](_0xc7d1c5);})['then'](function(_0x2604db){if(_0x2721d0['query'][_0xd71c('0x4e')]===_0xd71c('0x4f')){for(var _0x5a53f7=0x0;_0x5a53f7<_0x2604db[_0xd71c('0x50')];_0x5a53f7++){_0x2604db[_0x5a53f7]['body']=juice(_0x2604db[_0x5a53f7]['body']);}}_0x314323[_0xd71c('0x51')]=_0x2604db;return _0x314323;});}})[_0xd71c('0x1c')](respondWithFilteredResult(_0x59f1cb,_0xc7d1c5))[_0xd71c('0x2d')](handleError(_0x59f1cb,null));};exports[_0xd71c('0x52')]=function(_0x3f7ecd,_0x53430f){return db[_0xd71c('0x24')][_0xd71c('0x3a')]({'where':{'id':_0x3f7ecd['params']['id']}})[_0xd71c('0x1c')](handleEntityNotFound(_0x53430f,null))['then'](function(_0x5b92e3){if(_0x5b92e3){return _0x5b92e3[_0xd71c('0x53')](_0x3f7ecd[_0xd71c('0x3c')][_0xd71c('0x40')],_[_0xd71c('0x41')](_0x3f7ecd[_0xd71c('0x3c')],[_0xd71c('0x40'),'id'])||{})['spread'](function(){return db[_0xd71c('0x54')]['findAll']({'attributes':['id','name',_0xd71c('0x55')],'where':{'id':_0x3f7ecd[_0xd71c('0x3c')]['ids']}});})[_0xd71c('0x1c')](function(_0x4ceba8){socket[_0xd71c('0x56')](_0xd71c('0x57'),{'id':Number(_0x3f7ecd[_0xd71c('0x2f')]['id']),'tags':_0x4ceba8||[]});return{'id':Number(_0x3f7ecd[_0xd71c('0x2f')]['id']),'tags':_0x4ceba8||[]};});}})[_0xd71c('0x1c')](respondWithResult(_0x53430f,null))['catch'](handleError(_0x53430f,null));};exports[_0xd71c('0x58')]=function(_0x4e3de3,_0x86059f){return db[_0xd71c('0x24')][_0xd71c('0x3a')]({'where':{'id':_0x4e3de3['params']['id']}})['then'](handleEntityNotFound(_0x86059f,null))[_0xd71c('0x1c')](function(_0x1276b0){if(_0x1276b0){return _0x1276b0[_0xd71c('0x58')](_0x4e3de3[_0xd71c('0x2b')][_0xd71c('0x40')]);}})[_0xd71c('0x1c')](respondWithStatusCode(_0x86059f,null))[_0xd71c('0x2d')](handleError(_0x86059f,null));};exports[_0xd71c('0x59')]=function(_0x6c35dd,_0x5db6fe){var _0x46137b=moment()['unix']()[_0xd71c('0x5a')]();var _0x36dc5a=path[_0xd71c('0x5b')](config[_0xd71c('0x5c')],'server',_0xd71c('0x5d'),_0xd71c('0x5e'));var _0x5cf526=path['join'](config[_0xd71c('0x5c')],_0xd71c('0x5f'),'files',_0xd71c('0x60'));var _0x2609fc=path[_0xd71c('0x5b')](_0x36dc5a,_0x46137b);var _0xd1a91=util['format'](_0xd71c('0x61'),_0x6c35dd['params']['id'],_0x46137b);var _0x4be326=path[_0xd71c('0x5b')](_0x36dc5a,_0xd1a91);var _0x30b106=[];if(_0x6c35dd[_0xd71c('0x2b')][_0xd71c('0x60')]){_0x30b106['push']({'model':db[_0xd71c('0x62')],'as':_0xd71c('0x63'),'raw':!![]});}var _0x1402aa=[{'model':db['MailMessage'],'as':_0xd71c('0x64'),'attributes':['id','body',_0xd71c('0x65'),'to','cc',_0xd71c('0x66'),_0xd71c('0x67'),_0xd71c('0x68')],'where':{'secret':![]},'order':qs[_0xd71c('0x45')]('id'),'include':_0x30b106}];return db['MailInteraction'][_0xd71c('0x3a')]({'where':{'id':_0x6c35dd['params']['id']},'include':_0x1402aa})['then'](handleEntityNotFound(_0x5db6fe,null))[_0xd71c('0x1c')](function(_0x2a7987){if(_0x2a7987&&_0x2a7987['Messages']){var _0x40fc6e=_0x2a7987[_0xd71c('0x69')]({'plain':!![]});fs[_0xd71c('0x6a')](_0x2609fc);return BPromise['each'](_0x40fc6e['Messages'],function(_0x339b04,_0x1e71cd){var _0x3c4d7f={'from':_0x339b04['from'],'to':_0x339b04['to']||_0xd71c('0x6b'),'subject':_0x339b04[_0xd71c('0x67')],'html':htmlEntities[_0xd71c('0x6c')](_0x339b04['body']),'headers':{'Date':moment(_0x339b04[_0xd71c('0x68')])[_0xd71c('0x4c')](_0xd71c('0x6d'))},'attachments':[]};if(_0x339b04['cc']){_0x3c4d7f[_0xd71c('0x6e')]['Cc']=_0x339b04['cc'];}if(_0x339b04[_0xd71c('0x66')]){_0x3c4d7f[_0xd71c('0x6e')][_0xd71c('0x6f')]=_0x339b04['bcc'];}return new BPromise(function(_0x40a107,_0x4a44ca){if(_0x339b04[_0xd71c('0x63')]){for(var _0x478133=0x0;_0x478133<_0x339b04[_0xd71c('0x63')][_0xd71c('0x50')];_0x478133++){var _0x15dd89=_0x339b04[_0xd71c('0x63')][_0x478133];var _0x36c87d=path[_0xd71c('0x5b')](_0x5cf526,_0x15dd89[_0xd71c('0x70')]);if(fs[_0xd71c('0x71')](_0x36c87d)){_0x3c4d7f[_0xd71c('0x60')][_0xd71c('0x72')]({'name':_0x15dd89[_0xd71c('0x20')],'contentType':_0x15dd89[_0xd71c('0x73')],'data':fs['readFileSync'](_0x36c87d)});}}}emlformat[_0xd71c('0x74')](_0x3c4d7f,function(_0x4ba973,_0x4a9d07){if(_0x4ba973)return _0x4a44ca(_0x4ba973);fs['writeFileSync'](path[_0xd71c('0x5b')](_0x2609fc,util['format']('message%d.eml',_0x1e71cd)),_0x4a9d07);return _0x40a107(_0x4a9d07);});});})[_0xd71c('0x1c')](function(){return new BPromise(function(_0x19445f,_0x6b51f){zipdir(_0x2609fc,{'saveTo':_0x4be326},function(_0x56f067,_0x200372){if(_0x56f067)return _0x6b51f(_0x56f067);return _0x19445f(_0x200372);});})['then'](function(){return new BPromise(function(_0x12746a,_0x51ed75){rimraf(_0x2609fc,function(_0x27e8c5){if(_0x27e8c5)_0x51ed75(_0x27e8c5);return _0x12746a();});});})[_0xd71c('0x1c')](function(){return _0x5db6fe['download'](_0x4be326,_0xd1a91,function(_0xb74d12){if(!_0xb74d12)fs[_0xd71c('0x75')](_0x4be326);});});});}else{return _0x5db6fe[_0xd71c('0x11')](0xc8);}})[_0xd71c('0x2d')](handleError(_0x5db6fe,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f83d9d8..9a62c42 100644 --- a/server/api/mailInteraction/mailInteraction.events.js +++ b/server/api/mailInteraction/mailInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6898=['MailInteraction','MailMessage','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','exports','events','../../mysqldb'];(function(_0x581669,_0x41f406){var _0x544348=function(_0x1bd58f){while(--_0x1bd58f){_0x581669['push'](_0x581669['shift']());}};_0x544348(++_0x41f406);}(_0x6898,0x18e));var _0x8689=function(_0x5e4ed9,_0x49d180){_0x5e4ed9=_0x5e4ed9-0x0;var _0x37bf08=_0x6898[_0x5e4ed9];return _0x37bf08;};'use strict';var EventEmitter=require(_0x8689('0x0'));var MailInteraction=require(_0x8689('0x1'))['db'][_0x8689('0x2')];var MailMessage=require(_0x8689('0x1'))['db'][_0x8689('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8689('0x4'),'afterUpdate':_0x8689('0x5'),'afterDestroy':_0x8689('0x6')};function emitEvent(_0x198268){return function(_0x38ec6e,_0x297d7c,_0x1fc712){_0x38ec6e['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x805796){_0x38ec6e[_0x8689('0x7')](_0x8689('0x8'),_0x805796[_0x8689('0x9')](function(_0x50d51a){return{'id':_0x50d51a['id']};}));return MailMessage[_0x8689('0xa')]({'where':{'MailInteractionId':_0x38ec6e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8689('0xb')](function(_0x330129){_0x38ec6e[_0x8689('0x7')](_0x8689('0xc'),_0x330129[_0x8689('0xd')]);MailInteractionEvents[_0x8689('0xe')](_0x198268+':'+_0x38ec6e['id'],_0x38ec6e);MailInteractionEvents['emit'](_0x198268,_0x38ec6e);_0x1fc712(null);})['catch'](_0x1fc712(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x8689('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x835d=['then','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','map','findAll'];(function(_0x6464b6,_0x2f3d28){var _0x226200=function(_0x45e0cd){while(--_0x45e0cd){_0x6464b6['push'](_0x6464b6['shift']());}};_0x226200(++_0x2f3d28);}(_0x835d,0x156));var _0xd835=function(_0x48736d,_0x1877c7){_0x48736d=_0x48736d-0x0;var _0x54fa92=_0x835d[_0x48736d];return _0x54fa92;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xd835('0x0'))['db'][_0xd835('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd835('0x2')](0x0);var events={'afterCreate':_0xd835('0x3'),'afterUpdate':'update','afterDestroy':_0xd835('0x4')};function emitEvent(_0x405873){return function(_0x152352,_0x7eb6e6,_0x3ca17d){_0x152352[_0xd835('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x51d10d){_0x152352[_0xd835('0x6')](_0xd835('0x7'),_0x51d10d[_0xd835('0x8')](function(_0x3b07fa){return{'id':_0x3b07fa['id']};}));return MailMessage[_0xd835('0x9')]({'where':{'MailInteractionId':_0x152352['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd835('0xa')](function(_0xdb0220){_0x152352['setDataValue'](_0xd835('0xb'),_0xdb0220['length']);MailInteractionEvents[_0xd835('0xc')](_0x405873+':'+_0x152352['id'],_0x152352);MailInteractionEvents[_0xd835('0xc')](_0x405873,_0x152352);_0x3ca17d(null);})['catch'](_0x3ca17d(null));};}for(var e in events){if(events[_0xd835('0xd')](e)){var event=events[e];MailInteraction[_0xd835('0xe')](e,emitEvent(event));}}module[_0xd835('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index cde2919..eceff9b 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x965c=['define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes'];(function(_0x448608,_0x599a96){var _0x3999ae=function(_0x23b50e){while(--_0x23b50e){_0x448608['push'](_0x448608['shift']());}};_0x3999ae(++_0x599a96);}(_0x965c,0x18b));var _0xc965=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0x965c[_0x3877c1];return _0x59056a;};'use strict';var _=require(_0xc965('0x0'));var util=require(_0xc965('0x1'));var logger=require(_0xc965('0x2'))(_0xc965('0x3'));var moment=require(_0xc965('0x4'));var BPromise=require('bluebird');var rp=require(_0xc965('0x5'));var fs=require('fs');var path=require(_0xc965('0x6'));var rimraf=require(_0xc965('0x7'));var config=require(_0xc965('0x8'));var attributes=require(_0xc965('0x9'));module['exports']=function(_0x42de2b,_0x144e80){return _0x42de2b[_0xc965('0xa')](_0xc965('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xc965('0xc'),'fields':['subject','to'],'type':_0xc965('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x82083a,_0x7b49fd,_0x57198c){if(_0x82083a[_0xc965('0xe')]){_0x82083a[_0xc965('0xf')]=moment()[_0xc965('0x10')](_0xc965('0x11'));}if(_0x82083a[_0xc965('0x12')]){_0x82083a[_0xc965('0x13')]=moment()['format'](_0xc965('0x11'));}_0x57198c(null,_0x7b49fd);},'beforeUpdate':function(_0x4f3564,_0x1b58c7,_0x18df98){if(_0x4f3564[_0xc965('0x14')](_0xc965('0xe'))){_0x4f3564[_0xc965('0xf')]=_0x4f3564['substatus']?moment()[_0xc965('0x10')](_0xc965('0x11')):null;}if(_0x4f3564[_0xc965('0x14')](_0xc965('0x12'))){_0x4f3564['closedAt']=moment()[_0xc965('0x10')](_0xc965('0x11'));_0x4f3564[_0xc965('0xe')]=null;_0x4f3564[_0xc965('0xf')]=null;}_0x18df98(null,_0x4f3564);},'afterUpdate':function(_0x35cab2,_0x5c341b,_0x570c39){var _0x2a9312=_0x42de2b[_0xc965('0x15')];var _0x8733cd=_0x35cab2[_0xc965('0x16')]({'plain':!![]});if(_0x8733cd['closed']){return _0x2a9312['MailMessage'][_0xc965('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x8733cd['id']}})[_0xc965('0x18')](function(){_0x570c39();})['catch'](function(_0x39faf2){_0x570c39(_0x39faf2);});}else{_0x570c39();}}},'charset':_0xc965('0x19'),'collate':_0xc965('0x1a')});}; \ No newline at end of file +var _0x9baa=['format','changed','substatusAt','get','MailMessage','then','catch','utf8mb4','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x484afb,_0x8968bc){var _0x3b6dc4=function(_0x2933c3){while(--_0x2933c3){_0x484afb['push'](_0x484afb['shift']());}};_0x3b6dc4(++_0x8968bc);}(_0x9baa,0xf2));var _0xa9ba=function(_0x2ba4e3,_0x3c376c){_0x2ba4e3=_0x2ba4e3-0x0;var _0x79cdde=_0x9baa[_0x2ba4e3];return _0x79cdde;};'use strict';var _=require('lodash');var util=require(_0xa9ba('0x0'));var logger=require(_0xa9ba('0x1'))(_0xa9ba('0x2'));var moment=require(_0xa9ba('0x3'));var BPromise=require(_0xa9ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9ba('0x5'));var rimraf=require(_0xa9ba('0x6'));var config=require(_0xa9ba('0x7'));var attributes=require('./mailInteraction.attributes');module[_0xa9ba('0x8')]=function(_0xc96e77,_0x1e548a){return _0xc96e77[_0xa9ba('0x9')](_0xa9ba('0xa'),attributes,{'tableName':_0xa9ba('0xb'),'paranoid':![],'indexes':[{'name':_0xa9ba('0xc'),'fields':[_0xa9ba('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x33e4e1,_0x2601ce,_0x53f04b){if(_0x33e4e1[_0xa9ba('0xe')]){_0x33e4e1['substatusAt']=moment()['format'](_0xa9ba('0xf'));}if(_0x33e4e1[_0xa9ba('0x10')]){_0x33e4e1[_0xa9ba('0x11')]=moment()[_0xa9ba('0x12')](_0xa9ba('0xf'));}_0x53f04b(null,_0x2601ce);},'beforeUpdate':function(_0x3c345c,_0x9e6bc1,_0x26ca9c){if(_0x3c345c[_0xa9ba('0x13')]('substatus')){_0x3c345c[_0xa9ba('0x14')]=_0x3c345c['substatus']?moment()[_0xa9ba('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3c345c['changed'](_0xa9ba('0x10'))){_0x3c345c[_0xa9ba('0x11')]=moment()[_0xa9ba('0x12')](_0xa9ba('0xf'));_0x3c345c[_0xa9ba('0xe')]=null;_0x3c345c[_0xa9ba('0x14')]=null;}_0x26ca9c(null,_0x3c345c);},'afterUpdate':function(_0x44cf7d,_0x4e9698,_0x48717c){var _0x1fab74=_0xc96e77['models'];var _0x573105=_0x44cf7d[_0xa9ba('0x15')]({'plain':!![]});if(_0x573105[_0xa9ba('0x10')]){return _0x1fab74[_0xa9ba('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x573105['id']}})[_0xa9ba('0x17')](function(){_0x48717c();})[_0xa9ba('0x18')](function(_0x538f4d){_0x48717c(_0x538f4d);});}else{_0x48717c();}}},'charset':_0xa9ba('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4632a9c..f0f0e03 100644 --- a/server/api/mailInteraction/mailInteraction.rpc.js +++ b/server/api/mailInteraction/mailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f1c=['code','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','info','UpdateMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','redis','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4ad446,_0x328714){var _0x38f356=function(_0x20a11e){while(--_0x20a11e){_0x4ad446['push'](_0x4ad446['shift']());}};_0x38f356(++_0x328714);}(_0x2f1c,0x68));var _0xc2f1=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x2f1c[_0x2af160];return _0x439d67;};'use strict';var _=require(_0xc2f1('0x0'));var util=require(_0xc2f1('0x1'));var moment=require(_0xc2f1('0x2'));var BPromise=require(_0xc2f1('0x3'));var rs=require(_0xc2f1('0x4'));var fs=require('fs');var Redis=require(_0xc2f1('0x5'));var db=require(_0xc2f1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc2f1('0x7'));var config=require(_0xc2f1('0x8'));var jayson=require(_0xc2f1('0x9'));var client=jayson['client'][_0xc2f1('0xa')]({'port':0x232a});config['redis']=_[_0xc2f1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc2f1('0xc')]));require(_0xc2f1('0xd'))[_0xc2f1('0xe')](socket);function respondWithRpcPromise(_0x306499,_0x56d44,_0x3db705){return new BPromise(function(_0x318095,_0x6dd899){return client[_0xc2f1('0xf')](_0x306499,_0x3db705)[_0xc2f1('0x10')](function(_0x28a8be){logger['info'](_0xc2f1('0x11'),_0x56d44,_0xc2f1('0x12'));logger[_0xc2f1('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x56d44,_0xc2f1('0x12'),JSON[_0xc2f1('0x14')](_0x28a8be));if(_0x28a8be[_0xc2f1('0x15')]){if(_0x28a8be[_0xc2f1('0x15')][_0xc2f1('0x16')]===0x1f4){logger[_0xc2f1('0x15')](_0xc2f1('0x11'),_0x56d44,_0x28a8be[_0xc2f1('0x15')]['message']);return _0x6dd899(_0x28a8be[_0xc2f1('0x15')][_0xc2f1('0x17')]);}logger[_0xc2f1('0x15')](_0xc2f1('0x11'),_0x56d44,_0x28a8be[_0xc2f1('0x15')][_0xc2f1('0x17')]);return _0x318095(_0x28a8be[_0xc2f1('0x15')][_0xc2f1('0x17')]);}else{logger['info'](_0xc2f1('0x11'),_0x56d44,_0xc2f1('0x12'));_0x318095(_0x28a8be[_0xc2f1('0x18')][_0xc2f1('0x17')]);}})[_0xc2f1('0x19')](function(_0x4f6fe5){logger[_0xc2f1('0x15')](_0xc2f1('0x11'),_0x56d44,_0x4f6fe5);_0x6dd899(_0x4f6fe5);});});}exports['UpdateMailInteraction']=function(_0x1fd7e9){var _0x45e733=this;return new Promise(function(_0x1fc7a2,_0x332d10){return db[_0xc2f1('0x1a')][_0xc2f1('0x1b')](_0x1fd7e9[_0xc2f1('0x1c')],{'raw':_0x1fd7e9[_0xc2f1('0x1d')]?_0x1fd7e9[_0xc2f1('0x1d')][_0xc2f1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd7e9[_0xc2f1('0x1d')]?_0x1fd7e9[_0xc2f1('0x1d')][_0xc2f1('0x1f')]||null:null,'attributes':_0x1fd7e9[_0xc2f1('0x1d')]?_0x1fd7e9[_0xc2f1('0x1d')][_0xc2f1('0x20')]||null:null,'limit':_0x1fd7e9[_0xc2f1('0x1d')]?_0x1fd7e9[_0xc2f1('0x1d')][_0xc2f1('0x21')]||null:null})[_0xc2f1('0x10')](function(_0x4b06f3){logger[_0xc2f1('0x22')](_0xc2f1('0x23'),_0x1fd7e9);logger[_0xc2f1('0x13')](_0xc2f1('0x23'),_0x1fd7e9,JSON['stringify'](_0x4b06f3));_0x1fc7a2(_0x4b06f3);})['catch'](function(_0x26c2b0){logger[_0xc2f1('0x15')](_0xc2f1('0x23'),_0x26c2b0[_0xc2f1('0x17')],_0x1fd7e9);_0x332d10(_0x45e733[_0xc2f1('0x15')](0x1f4,_0x26c2b0[_0xc2f1('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x5953b2){return new Promise(function(_0x4f5922,_0x633edf){return db['MailInteraction'][_0xc2f1('0x24')]({'where':_0x5953b2[_0xc2f1('0x1d')]?_0x5953b2['options'][_0xc2f1('0x1f')]||null:null})[_0xc2f1('0x10')](function(_0x104566){if(_0x104566){return _0x104566[_0xc2f1('0x25')](_0x5953b2[_0xc2f1('0x1c')][_0xc2f1('0x26')],_[_0xc2f1('0x27')](_0x5953b2['body'],[_0xc2f1('0x26'),'id'])||{});}})[_0xc2f1('0x28')](function(_0x280e1d){logger['info'](_0xc2f1('0x29'),_0x5953b2);logger[_0xc2f1('0x13')]('AddTags',_0x5953b2,JSON[_0xc2f1('0x14')](_0x280e1d));_0x4f5922(_0x280e1d);})[_0xc2f1('0x19')](function(_0x3b15fa){logger[_0xc2f1('0x15')](_0xc2f1('0x29'),_0x3b15fa['message'],_0x5953b2);_0x633edf(_this[_0xc2f1('0x15')](0x1f4,_0x3b15fa[_0xc2f1('0x17')]));});});}; \ No newline at end of file +var _0xde74=['MailInteraction','update','body','options','where','limit','then','UpdateMailInteraction','find','addTags','ids','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x4a1488,_0x51f424){var _0x1cae6a=function(_0x349625){while(--_0x349625){_0x4a1488['push'](_0x4a1488['shift']());}};_0x1cae6a(++_0x51f424);}(_0xde74,0x1c8));var _0x4de7=function(_0x79db2,_0x8ab450){_0x79db2=_0x79db2-0x0;var _0x39c955=_0xde74[_0x79db2];return _0x39c955;};'use strict';var _=require(_0x4de7('0x0'));var util=require(_0x4de7('0x1'));var moment=require(_0x4de7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4de7('0x3'));var db=require(_0x4de7('0x4'))['db'];var utils=require(_0x4de7('0x5'));var logger=require('../../config/logger')(_0x4de7('0x6'));var config=require('../../config/environment');var jayson=require(_0x4de7('0x7'));var client=jayson[_0x4de7('0x8')][_0x4de7('0x9')]({'port':0x232a});config[_0x4de7('0xa')]=_['defaults'](config[_0x4de7('0xa')],{'host':_0x4de7('0xb'),'port':0x18eb});var socket=require(_0x4de7('0xc'))(new Redis(config[_0x4de7('0xa')]));require(_0x4de7('0xd'))[_0x4de7('0xe')](socket);function respondWithRpcPromise(_0x1346be,_0x4427d6,_0x3a3f64){return new BPromise(function(_0x5586d3,_0xcef530){return client['request'](_0x1346be,_0x3a3f64)['then'](function(_0x4b42c9){logger[_0x4de7('0xf')](_0x4de7('0x10'),_0x4427d6,'request\x20sent');logger[_0x4de7('0x11')](_0x4de7('0x12'),_0x4427d6,_0x4de7('0x13'),JSON[_0x4de7('0x14')](_0x4b42c9));if(_0x4b42c9['error']){if(_0x4b42c9[_0x4de7('0x15')]['code']===0x1f4){logger[_0x4de7('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4427d6,_0x4b42c9[_0x4de7('0x15')]['message']);return _0xcef530(_0x4b42c9['error']['message']);}logger[_0x4de7('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4427d6,_0x4b42c9[_0x4de7('0x15')][_0x4de7('0x16')]);return _0x5586d3(_0x4b42c9[_0x4de7('0x15')]['message']);}else{logger[_0x4de7('0xf')](_0x4de7('0x10'),_0x4427d6,_0x4de7('0x13'));_0x5586d3(_0x4b42c9[_0x4de7('0x17')]['message']);}})[_0x4de7('0x18')](function(_0x277b17){logger[_0x4de7('0x15')](_0x4de7('0x10'),_0x4427d6,_0x277b17);_0xcef530(_0x277b17);});});}exports['UpdateMailInteraction']=function(_0x97636e){var _0x1bb28d=this;return new Promise(function(_0x3bd987,_0x6973c5){return db[_0x4de7('0x19')][_0x4de7('0x1a')](_0x97636e[_0x4de7('0x1b')],{'raw':_0x97636e[_0x4de7('0x1c')]?_0x97636e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x97636e[_0x4de7('0x1c')]?_0x97636e[_0x4de7('0x1c')][_0x4de7('0x1d')]||null:null,'attributes':_0x97636e[_0x4de7('0x1c')]?_0x97636e[_0x4de7('0x1c')]['attributes']||null:null,'limit':_0x97636e[_0x4de7('0x1c')]?_0x97636e[_0x4de7('0x1c')][_0x4de7('0x1e')]||null:null})[_0x4de7('0x1f')](function(_0x35004d){logger[_0x4de7('0xf')](_0x4de7('0x20'),_0x97636e);logger['debug'](_0x4de7('0x20'),_0x97636e,JSON[_0x4de7('0x14')](_0x35004d));_0x3bd987(_0x35004d);})[_0x4de7('0x18')](function(_0x571dca){logger[_0x4de7('0x15')](_0x4de7('0x20'),_0x571dca[_0x4de7('0x16')],_0x97636e);_0x6973c5(_0x1bb28d['error'](0x1f4,_0x571dca[_0x4de7('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0x425665){return new Promise(function(_0x609b76,_0x57fc14){return db[_0x4de7('0x19')][_0x4de7('0x21')]({'where':_0x425665[_0x4de7('0x1c')]?_0x425665[_0x4de7('0x1c')][_0x4de7('0x1d')]||null:null})[_0x4de7('0x1f')](function(_0x17ab3d){if(_0x17ab3d){return _0x17ab3d[_0x4de7('0x22')](_0x425665[_0x4de7('0x1b')][_0x4de7('0x23')],_['omit'](_0x425665[_0x4de7('0x1b')],[_0x4de7('0x23'),'id'])||{});}})['spread'](function(_0x2c7ead){logger[_0x4de7('0xf')]('AddTags',_0x425665);logger[_0x4de7('0x11')]('AddTags',_0x425665,JSON[_0x4de7('0x14')](_0x2c7ead));_0x609b76(_0x2c7ead);})[_0x4de7('0x18')](function(_0x4c46de){logger['error'](_0x4de7('0x24'),_0x4c46de[_0x4de7('0x16')],_0x425665);_0x57fc14(_this['error'](0x1f4,_0x4c46de[_0x4de7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 77aa082..99797dc 100644 --- a/server/api/mailInteraction/mailInteraction.socket.js +++ b/server/api/mailInteraction/mailInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e39=['update','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x4d275c,_0x522396){var _0x55b75f=function(_0x47e6d3){while(--_0x47e6d3){_0x4d275c['push'](_0x4d275c['shift']());}};_0x55b75f(++_0x522396);}(_0x0e39,0xc2));var _0x90e3=function(_0x52f73a,_0x4418dd){_0x52f73a=_0x52f73a-0x0;var _0x4b5d40=_0x0e39[_0x52f73a];return _0x4b5d40;};'use strict';var MailInteractionEvents=require(_0x90e3('0x0'));var events=[_0x90e3('0x1'),'remove',_0x90e3('0x2')];function createListener(_0x1f78ce,_0x217c00){return function(_0x134346){_0x217c00['emit'](_0x1f78ce,_0x134346);};}function removeListener(_0x424550,_0x1ce118){return function(){MailInteractionEvents[_0x90e3('0x3')](_0x424550,_0x1ce118);};}exports[_0x90e3('0x4')]=function(_0xbee0){for(var _0x1fc5a2=0x0,_0x288266=events[_0x90e3('0x5')];_0x1fc5a2<_0x288266;_0x1fc5a2++){var _0x2250e5=events[_0x1fc5a2];var _0x5af878=createListener(_0x90e3('0x6')+_0x2250e5,_0xbee0);MailInteractionEvents['on'](_0x2250e5,_0x5af878);}}; \ No newline at end of file +var _0xea18=['length','mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener','register'];(function(_0x391127,_0x2b8c02){var _0x4a8338=function(_0x223d5c){while(--_0x223d5c){_0x391127['push'](_0x391127['shift']());}};_0x4a8338(++_0x2b8c02);}(_0xea18,0x132));var _0x8ea1=function(_0x7f0419,_0xe7743e){_0x7f0419=_0x7f0419-0x0;var _0x4ab013=_0xea18[_0x7f0419];return _0x4ab013;};'use strict';var MailInteractionEvents=require(_0x8ea1('0x0'));var events=[_0x8ea1('0x1'),_0x8ea1('0x2'),'update'];function createListener(_0x99568,_0x4eee8e){return function(_0x516f25){_0x4eee8e[_0x8ea1('0x3')](_0x99568,_0x516f25);};}function removeListener(_0xad3068,_0x2df1ed){return function(){MailInteractionEvents[_0x8ea1('0x4')](_0xad3068,_0x2df1ed);};}exports[_0x8ea1('0x5')]=function(_0x29d36b){for(var _0x14c74e=0x0,_0x126fed=events[_0x8ea1('0x6')];_0x14c74e<_0x126fed;_0x14c74e++){var _0x178f11=events[_0x14c74e];var _0x16cc7f=createListener(_0x8ea1('0x7')+_0x178f11,_0x29d36b);MailInteractionEvents['on'](_0x178f11,_0x16cc7f);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f44b3d6..4702416 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb264=['/:id/reject','reject','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','mail','mailmessage:create','create','put','update','accept'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4b26('0x0'));var util=require(_0x4b26('0x1'));var path=require('path');var timeout=require(_0x4b26('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4b26('0x3'));var auth=require(_0x4b26('0x4'));var interaction=require(_0x4b26('0x5'));var config=require(_0x4b26('0x6'));var controller=require(_0x4b26('0x7'));router[_0x4b26('0x8')]('/',auth[_0x4b26('0x9')](),controller['index']);router[_0x4b26('0x8')](_0x4b26('0xa'),auth['isAuthenticated'](),controller[_0x4b26('0xb')]);router[_0x4b26('0x8')](_0x4b26('0xc'),auth['isAuthenticated'](),controller[_0x4b26('0xd')]);router[_0x4b26('0x8')](_0x4b26('0xe'),auth[_0x4b26('0x9')](),controller[_0x4b26('0xf')]);router['post']('/',auth[_0x4b26('0x9')](),interaction['tracked'](_0x4b26('0x10'),_0x4b26('0x11')),controller[_0x4b26('0x12')]);router[_0x4b26('0x13')](_0x4b26('0xc'),auth['isAuthenticated'](),controller[_0x4b26('0x14')]);router[_0x4b26('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x4b26('0x15')]);router['put'](_0x4b26('0x16'),auth[_0x4b26('0x9')](),controller[_0x4b26('0x17')]);router['delete'](_0x4b26('0xc'),auth[_0x4b26('0x9')](),controller[_0x4b26('0x18')]);module[_0x4b26('0x19')]=router; \ No newline at end of file +var _0x8cf1=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','tracked','mail','create'];(function(_0x37286d,_0xa8ecb5){var _0xd27dac=function(_0x335903){while(--_0x335903){_0x37286d['push'](_0x37286d['shift']());}};_0xd27dac(++_0xa8ecb5);}(_0x8cf1,0x126));var _0x18cf=function(_0x291c87,_0xed3d67){_0x291c87=_0x291c87-0x0;var _0x5a0a46=_0x8cf1[_0x291c87];return _0x5a0a46;};'use strict';var multer=require(_0x18cf('0x0'));var util=require(_0x18cf('0x1'));var path=require('path');var timeout=require(_0x18cf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x18cf('0x3'));var interaction=require(_0x18cf('0x4'));var config=require(_0x18cf('0x5'));var controller=require(_0x18cf('0x6'));router[_0x18cf('0x7')]('/',auth[_0x18cf('0x8')](),controller[_0x18cf('0x9')]);router['get'](_0x18cf('0xa'),auth[_0x18cf('0x8')](),controller[_0x18cf('0xb')]);router[_0x18cf('0x7')](_0x18cf('0xc'),auth['isAuthenticated'](),controller[_0x18cf('0xd')]);router['get'](_0x18cf('0xe'),auth[_0x18cf('0x8')](),controller['download']);router['post']('/',auth[_0x18cf('0x8')](),interaction[_0x18cf('0xf')](_0x18cf('0x10'),'mailmessage:create'),controller[_0x18cf('0x11')]);router[_0x18cf('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x18cf('0x13')]);router[_0x18cf('0x12')](_0x18cf('0x14'),auth[_0x18cf('0x8')](),controller[_0x18cf('0x15')]);router['put'](_0x18cf('0x16'),auth[_0x18cf('0x8')](),controller[_0x18cf('0x17')]);router[_0x18cf('0x18')]('/:id',auth[_0x18cf('0x8')](),controller[_0x18cf('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 85a690b..b5e60d6 100644 --- a/server/api/mailMessage/mailMessage.attributes.js +++ b/server/api/mailMessage/mailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a52=['ENUM','Email','sequelize','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER'];(function(_0x5d29be,_0x1e2271){var _0x560598=function(_0x399451){while(--_0x399451){_0x5d29be['push'](_0x5d29be['shift']());}};_0x560598(++_0x1e2271);}(_0x3a52,0x182));var _0x23a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a52[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x23a5('0x0'));var _=require('lodash');module[_0x23a5('0x1')]={'body':{'type':Sequelize[_0x23a5('0x2')](_0x23a5('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x23a5('0x2')](_0x23a5('0x4'))},'read':{'type':Sequelize[_0x23a5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x23a5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x23a5('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x23a5('0x2')](_0x23a5('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x23a5('0x3'))},'bcc':{'type':Sequelize[_0x23a5('0x2')](_0x23a5('0x3'))},'subject':{'type':Sequelize[_0x23a5('0x2')]},'sentAt':{'type':Sequelize[_0x23a5('0x8')]},'attach':{'type':Sequelize[_0x23a5('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x23a5('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x23a5('0x2')](_0x23a5('0x3'))},'originCc':{'type':Sequelize[_0x23a5('0x2')](_0x23a5('0x3'))},'originChannel':{'type':Sequelize[_0x23a5('0xa')](_0x23a5('0xb'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x83c8=['long','INTEGER','DATE','Email','exports','TEXT','medium','ENUM','out','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x83c8,0x1c6));var _0x883c=function(_0x594867,_0x2ee5d3){_0x594867=_0x594867-0x0;var _0x9ac5b1=_0x83c8[_0x594867];return _0x9ac5b1;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x883c('0x0')]={'body':{'type':Sequelize[_0x883c('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x883c('0x1')](_0x883c('0x2'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x883c('0x3')]('in',_0x883c('0x4')),'defaultValue':_0x883c('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x883c('0x5')](0x1fe)},'from':{'type':Sequelize[_0x883c('0x5')]},'to':{'type':Sequelize[_0x883c('0x1')](_0x883c('0x6'))},'cc':{'type':Sequelize[_0x883c('0x1')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x883c('0x6'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x883c('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x883c('0x8')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x883c('0x1')](_0x883c('0x6'))},'originChannel':{'type':Sequelize[_0x883c('0x3')](_0x883c('0x9'),'Chat'),'defaultValue':_0x883c('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e4ae8b1..0055a44 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2390=['body','describe','create','direction','out','secret','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','fromString','reject','mail','MailInteraction','MailInteractionId','RejectMessage','rejectMessage','sequelize','fullname','motionChannel','event','EventManager','download','server','files','tmp','root','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','index','MailMessage','type','key','map','filters','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','show','params','rawAttributes','keys','include','find'];(function(_0x1a3ae4,_0x149505){var _0x389262=function(_0x598b66){while(--_0x598b66){_0x1a3ae4['push'](_0x1a3ae4['shift']());}};_0x389262(++_0x149505);}(_0x2390,0x18d));var _0x0239=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x2390[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require('eml-format');var moment=require(_0x0239('0x0'));var BPromise=require(_0x0239('0x1'));var util=require(_0x0239('0x2'));var path=require(_0x0239('0x3'));var fs=require('fs');var _=require(_0x0239('0x4'));var Redis=require(_0x0239('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x0239('0x6'));var logger=require(_0x0239('0x7'))(_0x0239('0x8'));var interaction_log=require(_0x0239('0x7'))('mail-interactions');var config=require(_0x0239('0x9'));var db=require(_0x0239('0xa'))['db'];config[_0x0239('0xb')]=_[_0x0239('0xc')](config[_0x0239('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0239('0xd'))(new Redis(config[_0x0239('0xb')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0239('0xe')]({'port':0x232c});var client9003=jayson[_0x0239('0xf')][_0x0239('0xe')]({'port':0x232b});var client9002=jayson['client'][_0x0239('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x2cbca0,_0x62a87f,_0xdac31c,_0x1c6739){return new BPromise(function(_0x34a823,_0x2fcb86){var _0x3b1c91=_0x1c6739||client;return _0x3b1c91[_0x0239('0x10')](_0x2cbca0,_0xdac31c)[_0x0239('0x11')](function(_0x202ef7){logger[_0x0239('0x12')](_0x0239('0x13'),_0x62a87f,_0x0239('0x14'));logger[_0x0239('0x15')](_0x0239('0x16'),_0x62a87f,_0x0239('0x14'),JSON[_0x0239('0x17')](_0x202ef7));if(_0x202ef7['error']){if(_0x202ef7[_0x0239('0x18')][_0x0239('0x19')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x62a87f,_0x202ef7['error'][_0x0239('0x1a')]);return _0x2fcb86(_0x202ef7[_0x0239('0x18')][_0x0239('0x1a')]);}logger['error'](_0x0239('0x13'),_0x62a87f,_0x202ef7[_0x0239('0x18')][_0x0239('0x1a')]);return _0x34a823(_0x202ef7[_0x0239('0x18')][_0x0239('0x1a')]);}else{logger[_0x0239('0x12')]('MailMessage,\x20%s,\x20%s',_0x62a87f,_0x0239('0x14'));_0x34a823(_0x202ef7[_0x0239('0x1b')]['message']);}})[_0x0239('0x1c')](function(_0x4af7c3){logger[_0x0239('0x18')](_0x0239('0x13'),_0x62a87f,_0x4af7c3);_0x2fcb86(_0x4af7c3);});});}function respondWithResult(_0x18ab4e,_0x38805a){_0x38805a=_0x38805a||0xc8;return function(_0x20d4fc){if(_0x20d4fc){return _0x18ab4e[_0x0239('0x1d')](_0x38805a)[_0x0239('0x1e')](_0x20d4fc);}};}function respondWithFilteredResult(_0x1d4aaa,_0x2c5676){return function(_0x1aa37b){if(_0x1aa37b){var _0xa6cec8=typeof _0x2c5676[_0x0239('0x1f')]===_0x0239('0x20')&&typeof _0x2c5676[_0x0239('0x21')]===_0x0239('0x20');var _0x21c6a1=_0x1aa37b[_0x0239('0x22')];var _0x8d1412=_0xa6cec8?0x0:_0x2c5676[_0x0239('0x1f')];var _0x32df36=_0xa6cec8?_0x1aa37b[_0x0239('0x22')]:_0x2c5676[_0x0239('0x1f')]+_0x2c5676[_0x0239('0x21')];var _0x5f2018;if(_0x32df36>=_0x21c6a1){_0x32df36=_0x21c6a1;_0x5f2018=0xc8;}else{_0x5f2018=0xce;}_0x1d4aaa[_0x0239('0x1d')](_0x5f2018);return _0x1d4aaa[_0x0239('0x23')](_0x0239('0x24'),_0x8d1412+'-'+_0x32df36+'/'+_0x21c6a1)[_0x0239('0x1e')](_0x1aa37b);}return null;};}function saveUpdates(_0x504fdb){return function(_0x9b2001){if(_0x9b2001){return _0x9b2001[_0x0239('0x25')](_0x504fdb)[_0x0239('0x11')](function(_0x2cfb70){return _0x2cfb70;});}return null;};}function removeEntity(_0x4018ba){return function(_0x5a194a){if(_0x5a194a){return _0x5a194a[_0x0239('0x26')]()[_0x0239('0x11')](function(){_0x4018ba[_0x0239('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x471a99){return function(_0x55d0ec){if(!_0x55d0ec){_0x471a99[_0x0239('0x27')](0x194);}return _0x55d0ec;};}function handleError(_0x550c47,_0x3b50ea){_0x3b50ea=_0x3b50ea||0x1f4;return function(_0x42e1fa){logger[_0x0239('0x18')](_0x42e1fa[_0x0239('0x28')]);if(_0x42e1fa[_0x0239('0x29')]){delete _0x42e1fa[_0x0239('0x29')];}_0x550c47['status'](_0x3b50ea)[_0x0239('0x2a')](_0x42e1fa);};}exports[_0x0239('0x2b')]=function(_0x4eb4cb,_0x53a7c2){var _0x518382={},_0x5f11ee={},_0x53519f={'count':0x0,'rows':[]};var _0x38c1e8=_['map'](db[_0x0239('0x2c')]['rawAttributes'],function(_0x48eff9){return{'name':_0x48eff9['fieldName'],'type':_0x48eff9[_0x0239('0x2d')][_0x0239('0x2e')]};});_0x5f11ee['model']=_[_0x0239('0x2f')](_0x38c1e8,_0x0239('0x29'));_0x5f11ee['query']=_['keys'](_0x4eb4cb['query']);_0x5f11ee[_0x0239('0x30')]=_['intersection'](_0x5f11ee[_0x0239('0x31')],_0x5f11ee[_0x0239('0x32')]);_0x518382['attributes']=_[_0x0239('0x33')](_0x5f11ee[_0x0239('0x31')],qs['fields'](_0x4eb4cb[_0x0239('0x32')]['fields']));_0x518382[_0x0239('0x34')]=_0x518382[_0x0239('0x34')][_0x0239('0x35')]?_0x518382[_0x0239('0x34')]:_0x5f11ee[_0x0239('0x31')];if(!_0x4eb4cb['query'][_0x0239('0x36')](_0x0239('0x37'))){_0x518382[_0x0239('0x21')]=qs[_0x0239('0x21')](_0x4eb4cb[_0x0239('0x32')][_0x0239('0x21')]);_0x518382['offset']=qs[_0x0239('0x1f')](_0x4eb4cb[_0x0239('0x32')][_0x0239('0x1f')]);}_0x518382[_0x0239('0x38')]=qs[_0x0239('0x39')](_0x4eb4cb['query'][_0x0239('0x39')]);_0x518382['where']=qs['filters'](_[_0x0239('0x3a')](_0x4eb4cb[_0x0239('0x32')],_0x5f11ee[_0x0239('0x30')]),_0x38c1e8);if(_0x4eb4cb[_0x0239('0x32')][_0x0239('0x3b')]){_0x518382[_0x0239('0x3c')]=_['merge'](_0x518382['where'],{'$or':_[_0x0239('0x2f')](_0x38c1e8,function(_0x481498){if(_0x481498[_0x0239('0x2d')]!==_0x0239('0x3d')){var _0x3bea55={};_0x3bea55[_0x481498['name']]={'$like':'%'+_0x4eb4cb[_0x0239('0x32')][_0x0239('0x3b')]+'%'};return _0x3bea55;}})});}_0x518382=_[_0x0239('0x3e')]({},_0x518382,_0x4eb4cb[_0x0239('0x3f')]);var _0x1ebe93={'where':_0x518382['where']};return db[_0x0239('0x2c')][_0x0239('0x22')](_0x1ebe93)['then'](function(_0x5836ed){_0x53519f[_0x0239('0x22')]=_0x5836ed;if(_0x4eb4cb[_0x0239('0x32')]['includeAll']){_0x518382['include']=[{'all':!![]}];}return db['MailMessage'][_0x0239('0x40')](_0x518382);})['then'](function(_0x404835){_0x53519f['rows']=_0x404835;return _0x53519f;})[_0x0239('0x11')](respondWithFilteredResult(_0x53a7c2,_0x518382))['catch'](handleError(_0x53a7c2,null));};exports[_0x0239('0x41')]=function(_0x3a7dd5,_0x225aed){var _0x78b149={'raw':!![],'where':{'id':_0x3a7dd5[_0x0239('0x42')]['id']}},_0x3e1268={};_0x3e1268[_0x0239('0x31')]=_['keys'](db[_0x0239('0x2c')][_0x0239('0x43')]);_0x3e1268[_0x0239('0x32')]=_[_0x0239('0x44')](_0x3a7dd5[_0x0239('0x32')]);_0x3e1268['filters']=_[_0x0239('0x33')](_0x3e1268['model'],_0x3e1268[_0x0239('0x32')]);_0x78b149[_0x0239('0x34')]=_[_0x0239('0x33')](_0x3e1268[_0x0239('0x31')],qs['fields'](_0x3a7dd5[_0x0239('0x32')]['fields']));_0x78b149['attributes']=_0x78b149[_0x0239('0x34')][_0x0239('0x35')]?_0x78b149[_0x0239('0x34')]:_0x3e1268['model'];if(_0x3a7dd5[_0x0239('0x32')]['includeAll']){_0x78b149[_0x0239('0x45')]=[{'all':!![]}];}_0x78b149=_['merge']({},_0x78b149,_0x3a7dd5['options']);return db['MailMessage'][_0x0239('0x46')](_0x78b149)[_0x0239('0x11')](handleEntityNotFound(_0x225aed,null))[_0x0239('0x11')](respondWithResult(_0x225aed,null))[_0x0239('0x1c')](handleError(_0x225aed,null));};exports[_0x0239('0x25')]=function(_0x6c8fc0,_0x1b88bd){if(_0x6c8fc0['body']['id']){delete _0x6c8fc0[_0x0239('0x47')]['id'];}return db[_0x0239('0x2c')][_0x0239('0x46')]({'where':{'id':_0x6c8fc0[_0x0239('0x42')]['id']}})[_0x0239('0x11')](handleEntityNotFound(_0x1b88bd,null))['then'](saveUpdates(_0x6c8fc0[_0x0239('0x47')],null))[_0x0239('0x11')](respondWithResult(_0x1b88bd,null))[_0x0239('0x1c')](handleError(_0x1b88bd,null));};exports[_0x0239('0x26')]=function(_0x34fcbb,_0x418df6){return db['MailMessage'][_0x0239('0x46')]({'where':{'id':_0x34fcbb['params']['id']}})[_0x0239('0x11')](handleEntityNotFound(_0x418df6,null))['then'](removeEntity(_0x418df6,null))['catch'](handleError(_0x418df6,null));};exports[_0x0239('0x48')]=function(_0x1bee70,_0x313ff6){return db['MailMessage'][_0x0239('0x48')]()[_0x0239('0x11')](respondWithResult(_0x313ff6,null))[_0x0239('0x1c')](handleError(_0x313ff6,null));};exports['create']=function(_0x2765f3,_0xd4520c){return db[_0x0239('0x2c')][_0x0239('0x49')](_0x2765f3[_0x0239('0x47')])[_0x0239('0x11')](function(_0x591e3d){if(_0x591e3d){if(_0x591e3d[_0x0239('0x4a')]===_0x0239('0x4b')&&!_0x591e3d[_0x0239('0x4c')]){var _0x199056,_0x48751,_0x1780d8;if(_0x2765f3[_0x0239('0x47')]['to']){_0x48751=_0x2765f3[_0x0239('0x47')]['to']['split'](',')[0x0];}return db[_0x0239('0x4d')]['findOne']({'where':{'id':_0x591e3d[_0x0239('0x4e')]},'include':[{'model':db[_0x0239('0x4f')],'as':_0x0239('0x50'),'include':[{'model':db[_0x0239('0x51')],'as':_0x0239('0x52'),'where':{'email':_0x48751},'limit':0x1,'order':[[_0x0239('0x53'),'DESC']]}]},{'model':db[_0x0239('0x54')],'as':_0x0239('0x55'),'raw':!![],'include':[{'model':db[_0x0239('0x56')],'as':_0x0239('0x56'),'raw':!![]}]}]})[_0x0239('0x11')](function(_0x1b83df){_0x199056=_0x1b83df;if(!_0x199056||!_0x199056[_0x0239('0x55')])return;var _0x214a8c=_0x199056[_0x0239('0x57')]();if(_0x2765f3['body'][_0x0239('0x58')]&&_0x2765f3[_0x0239('0x47')][_0x0239('0x58')][_0x0239('0x35')]){for(var _0x5d1bd2=0x0;_0x5d1bd2<_0x2765f3[_0x0239('0x47')][_0x0239('0x58')][_0x0239('0x35')];_0x5d1bd2+=0x1){_0x2765f3[_0x0239('0x47')][_0x0239('0x58')][_0x5d1bd2]={'filename':_0x2765f3[_0x0239('0x47')][_0x0239('0x58')][_0x5d1bd2][_0x0239('0x29')],'path':path[_0x0239('0x59')](config['root'],_0x0239('0x5a'),_0x2765f3[_0x0239('0x47')]['attachments'][_0x5d1bd2][_0x0239('0x5b')])};}}_0x1780d8={'account':_0x214a8c,'message':_0x2765f3[_0x0239('0x47')]};return;})[_0x0239('0x11')](function(){if(_0x199056[_0x0239('0x50')]){if(_0x199056[_0x0239('0x50')][_0x0239('0x52')][_0x0239('0x35')]){return _0x199056['List']['Contacts'][0x0];}else{return db[_0x0239('0x51')][_0x0239('0x49')](_[_0x0239('0xc')](_0x2765f3[_0x0239('0x47')],{'firstName':_0x2765f3['body']['to'],'email':_0x2765f3[_0x0239('0x47')]['to'],'phone':_0x2765f3[_0x0239('0x47')]['to'],'ListId':_0x199056[_0x0239('0x5c')]}));}}else{throw new Error(_0x0239('0x5d'));}})[_0x0239('0x11')](function(){if(_0x1780d8){return respondWithRpcPromise(_0x0239('0x5e'),_0x0239('0x5f'),_0x1780d8,client9003)['then'](function(_0x3ea3d2){return _0x591e3d[_0x0239('0x25')]({'read':!![],'messageId':_0x3ea3d2['messageId'],'sentAt':moment()[_0x0239('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x0239('0x1c')](function(_0x30616e){logger[_0x0239('0x18')]('%s',JSON[_0x0239('0x17')](_0x30616e));return _0x591e3d;});}return _0x591e3d;});}return _0x591e3d;}})[_0x0239('0x11')](respondWithResult(_0xd4520c,0xc9))[_0x0239('0x1c')](handleError(_0xd4520c,null));};exports[_0x0239('0x61')]=function(_0x4853ec,_0xfc2329){var _0x50dee8={'agent':{},'channel':'mail'};if(_0x4853ec[_0x0239('0x47')]['id']){delete _0x4853ec[_0x0239('0x47')]['id'];}_0x4853ec[_0x0239('0x47')][_0x0239('0x62')]=!![];_0x4853ec[_0x0239('0x47')][_0x0239('0x63')]=moment()[_0x0239('0x60')](_0x0239('0x64'));_0x4853ec['body']['UserId']=_0x4853ec['body']['UserId']||_0x4853ec['user']['id'];_0x50dee8[_0x0239('0x65')]['id']=_0x4853ec[_0x0239('0x47')][_0x0239('0x66')];return db[_0x0239('0x2c')][_0x0239('0x46')]({'where':{'id':_0x4853ec['params']['id'],'UserId':null}})[_0x0239('0x11')](handleEntityNotFound(_0xfc2329,null))[_0x0239('0x11')](saveUpdates(_0x4853ec[_0x0239('0x47')],null))[_0x0239('0x11')](function(_0x30c067){if(_0x30c067){_0x50dee8[_0x0239('0x1a')]=_0x30c067[_0x0239('0x67')]({'plain':!![]});return db['MailInteraction'][_0x0239('0x46')]({'where':{'id':_0x30c067['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xfc2329,null))[_0x0239('0x11')](function(_0x4b7b4a){if(_0x4b7b4a){return _0x4b7b4a[_0x0239('0x25')]({'UserId':_0x4853ec[_0x0239('0x47')]['UserId'],'read1stAt':_[_0x0239('0x68')](_0x4b7b4a[_0x0239('0x69')])?moment()['format'](_0x0239('0x64')):undefined});}return null;})[_0x0239('0x11')](function(_0x24522a){if(_0x24522a){_0x50dee8[_0x0239('0x6a')]=_0x24522a[_0x0239('0x67')]({'plain':!![]});interaction_log[_0x0239('0x12')](_0x0239('0x6b'),_0x4853ec[_0x0239('0x6c')]['id'],_0x4853ec[_0x0239('0x6c')][_0x0239('0x29')],_0x4853ec[_0x0239('0x6c')]['role'],_0x50dee8[_0x0239('0x6a')]['id'],_0x4853ec[_0x0239('0x47')]?JSON[_0x0239('0x17')](_0x4853ec['body']):_0x0239('0x6d'));return respondWithRpcPromise(_0x0239('0x6e'),_0x0239('0x6f'),_0x50dee8);}return null;})['then'](function(_0x54f706){var _0x35bf6e=_0x0239('0x70')+_0x54f706[_0x0239('0x1a')]['ContactId'];return db['sequelize'][_0x0239('0x32')](_0x35bf6e,{'type':db[_0x0239('0x71')][_0x0239('0x72')][_0x0239('0x73')],'raw':!![]})[_0x0239('0x11')](function(_0x43a0a5){return _0x43a0a5;});})[_0x0239('0x11')](function(_0xdbe1){if(_0xdbe1){_0x50dee8[_0x0239('0x1a')][_0x0239('0x74')]=_0xdbe1[0x0];if(!_0x4853ec[_0x0239('0x47')]['UserId'])return;return db[_0x0239('0x75')][_0x0239('0x46')]({'where':{'id':_0x4853ec['body'][_0x0239('0x66')],'role':_0x0239('0x65')},'attributes':['id',_0x0239('0x29'),'fullname',_0x0239('0x76'),'internal'],'raw':!![]});}return null;})[_0x0239('0x11')](function(_0x33a839){if(!_0x33a839)return null;_0x50dee8[_0x0239('0x1a')][_0x0239('0x65')]=_0x33a839;return _0x50dee8;})[_0x0239('0x11')](function(_0xf724ae){if(_0xf724ae){if(_0x4853ec[_0x0239('0x47')][_0x0239('0x77')]){_0x50dee8['message'][_0x0239('0x78')]=util['format'](_0x0239('0x79'),_0x4853ec[_0x0239('0x6c')][_0x0239('0x29')]);_0x50dee8[_0x0239('0x1a')][_0x0239('0x7a')]=_0x50dee8[_0x0239('0x7a')];_0x50dee8['message']['motionChannel']=_0x50dee8[_0x0239('0x7a')];_0x50dee8[_0x0239('0x1a')]['event']=_0x0239('0x61');_0x50dee8[_0x0239('0x1a')][_0x0239('0x47')]=htmlToText[_0x0239('0x7b')](_0x50dee8[_0x0239('0x1a')][_0x0239('0x47')]);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x50dee8[_0x0239('0x1a')]},client9002)[_0x0239('0x11')](function(){return _0x50dee8;});}return _0x50dee8;}return null;})[_0x0239('0x11')](respondWithResult(_0xfc2329,null))[_0x0239('0x1c')](handleError(_0xfc2329,null));};exports[_0x0239('0x7c')]=function(_0x32240b,_0x58c25a){var _0x229846={'agent':{},'channel':_0x0239('0x7d')};if(_0x32240b['body']['id']){delete _0x32240b['body']['id'];}_0x32240b['body'][_0x0239('0x66')]=_0x32240b[_0x0239('0x47')][_0x0239('0x66')]||_0x32240b['user']['id'];_0x229846[_0x0239('0x65')]['id']=_0x32240b['body'][_0x0239('0x66')];return db[_0x0239('0x2c')][_0x0239('0x46')]({'where':{'id':_0x32240b[_0x0239('0x42')]['id'],'UserId':null}})[_0x0239('0x11')](handleEntityNotFound(_0x58c25a,null))[_0x0239('0x11')](function(_0xac237e){if(_0xac237e){_0x229846[_0x0239('0x1a')]=_0xac237e[_0x0239('0x67')]({'plain':!![]});return db[_0x0239('0x7e')][_0x0239('0x46')]({'where':{'id':_0xac237e[_0x0239('0x7f')]}});}return null;})[_0x0239('0x11')](handleEntityNotFound(_0x58c25a,null))[_0x0239('0x11')](function(_0x526722){if(_0x526722){_0x229846[_0x0239('0x6a')]=_0x526722[_0x0239('0x67')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x32240b['user']['id'],_0x32240b[_0x0239('0x6c')][_0x0239('0x29')],_0x32240b['user']['role'],_0x229846[_0x0239('0x6a')]['id'],_0x32240b[_0x0239('0x47')]?JSON[_0x0239('0x17')](_0x32240b[_0x0239('0x47')]):_0x0239('0x6d'));return respondWithRpcPromise(_0x0239('0x80'),_0x0239('0x81'),_0x229846);}return null;})[_0x0239('0x11')](function(_0xa0b109){var _0x4b6f07='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa0b109[_0x0239('0x1a')]['ContactId'];return db[_0x0239('0x82')][_0x0239('0x32')](_0x4b6f07,{'type':db['Sequelize'][_0x0239('0x72')][_0x0239('0x73')],'raw':!![]})[_0x0239('0x11')](function(_0x3879e6){return _0x3879e6;});})[_0x0239('0x11')](function(_0x122213){if(_0x122213){_0x229846['message']['contact']=_0x122213[0x0];if(!_0x32240b[_0x0239('0x47')][_0x0239('0x66')])return;return db[_0x0239('0x75')][_0x0239('0x46')]({'where':{'id':_0x32240b[_0x0239('0x47')][_0x0239('0x66')],'role':_0x0239('0x65')},'attributes':['id','name',_0x0239('0x83'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x1c7e3a){if(!_0x1c7e3a)return null;_0x229846[_0x0239('0x1a')][_0x0239('0x65')]=_0x1c7e3a;return _0x229846;})[_0x0239('0x11')](function(_0x17a670){if(_0x17a670){_0x17a670[_0x0239('0x1a')][_0x0239('0x78')]=util[_0x0239('0x60')]('SIP/%s',_0x32240b[_0x0239('0x6c')][_0x0239('0x29')]);_0x17a670['message'][_0x0239('0x7a')]=_0x229846[_0x0239('0x7a')];_0x17a670['message'][_0x0239('0x84')]=_0x229846[_0x0239('0x7a')];_0x17a670['message'][_0x0239('0x85')]=_0x0239('0x7c');_0x17a670[_0x0239('0x1a')][_0x0239('0x47')]=htmlToText['fromString'](_0x229846[_0x0239('0x1a')][_0x0239('0x47')]);respondWithRpcPromise(_0x0239('0x86'),'EventManager',{'event':'rejectmessage','message':_0x17a670['message']},client9002);return _0x229846;}return null;})['then'](respondWithResult(_0x58c25a,null))['catch'](handleError(_0x58c25a,null));};exports[_0x0239('0x87')]=function(_0x4301a9,_0x2e5974){var _0x23dc2a=moment()['unix']()['toString']();var _0x416019=path[_0x0239('0x59')](config['root'],_0x0239('0x88'),_0x0239('0x89'),_0x0239('0x8a'));var _0x2317f=path[_0x0239('0x59')](config[_0x0239('0x8b')],_0x0239('0x88'),'files',_0x0239('0x58'));var _0x51e0f1=util['format'](_0x0239('0x8c'),_0x23dc2a);return db[_0x0239('0x2c')][_0x0239('0x46')]({'where':{'id':_0x4301a9[_0x0239('0x42')]['id']},'attributes':['id',_0x0239('0x47'),_0x0239('0x8d'),'to','cc',_0x0239('0x8e'),_0x0239('0x8f'),_0x0239('0x90')],'include':_0x4301a9[_0x0239('0x32')][_0x0239('0x58')]?[{'model':db[_0x0239('0x91')],'as':_0x0239('0x92')}]:undefined})[_0x0239('0x11')](handleEntityNotFound(_0x2e5974,null))[_0x0239('0x11')](function(_0x18e655){if(_0x18e655){var _0x3955f2=_0x18e655;var _0x4e422d={'from':_0x3955f2[_0x0239('0x8d')],'to':_0x3955f2['to'],'subject':_0x3955f2['subject'],'html':htmlEntities[_0x0239('0x93')](_0x3955f2[_0x0239('0x47')]),'headers':{'Date':moment(_0x3955f2['createdAt'])['format'](_0x0239('0x94'))},'attachments':[]};if(_0x18e655['cc']){_0x4e422d['headers']['Cc']=_0x18e655['cc'];}if(_0x18e655[_0x0239('0x8e')]){_0x4e422d[_0x0239('0x95')][_0x0239('0x96')]=_0x18e655[_0x0239('0x8e')];}return new BPromise(function(_0x4c608f,_0x28032d){if(_0x18e655['Attachments']){for(var _0x33889f=0x0;_0x33889f<_0x18e655['Attachments']['length'];_0x33889f++){var _0x35f6a3=_0x18e655[_0x0239('0x92')][_0x33889f];var _0x222c88=path[_0x0239('0x59')](_0x2317f,_0x35f6a3[_0x0239('0x5b')]);if(fs['existsSync'](_0x222c88)){_0x4e422d['attachments'][_0x0239('0x97')]({'name':_0x35f6a3[_0x0239('0x29')],'contentType':_0x35f6a3['type'],'data':fs[_0x0239('0x98')](_0x222c88)});}}}emlformat[_0x0239('0x99')](_0x4e422d,function(_0x1b70ba,_0x1aa217){if(_0x1b70ba)return _0x28032d(_0x1b70ba);fs[_0x0239('0x9a')](path[_0x0239('0x59')](_0x416019,_0x51e0f1),_0x1aa217);return _0x4c608f(_0x1aa217);});});}})[_0x0239('0x11')](function(_0xbba17f){if(_0xbba17f){return _0x2e5974[_0x0239('0x87')](path[_0x0239('0x59')](_0x416019,_0x51e0f1),_0x51e0f1,function(_0x3bda2b){if(!_0x3bda2b)fs[_0x0239('0x9b')](path[_0x0239('0x59')](_0x416019,_0x51e0f1));});}})[_0x0239('0x1c')](handleError(_0x2e5974,null));}; \ No newline at end of file +var _0xb560=['path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','socket.io-emitter','register','jayson/promise','http','client','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','status','json','limit','undefined','count','set','Content-Range','update','end','sendStatus','stack','name','index','MailMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','keys','find','body','params','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','Contacts','defaults','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','UserId','user','agent','get','isNil','interaction','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','QueryTypes','email','download','toString','files','tmp','from','bcc','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','push','build','writeFileSync','unlinkSync','moment','bluebird','util'];(function(_0x416488,_0x4635f5){var _0x39616d=function(_0x3e2849){while(--_0x3e2849){_0x416488['push'](_0x416488['shift']());}};_0x39616d(++_0x4635f5);}(_0xb560,0x92));var _0x0b56=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xb560[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require('eml-format');var moment=require(_0x0b56('0x0'));var BPromise=require(_0x0b56('0x1'));var util=require(_0x0b56('0x2'));var path=require(_0x0b56('0x3'));var fs=require('fs');var _=require(_0x0b56('0x4'));var Redis=require(_0x0b56('0x5'));var htmlToText=require(_0x0b56('0x6'));var qs=require(_0x0b56('0x7'));var logger=require(_0x0b56('0x8'))(_0x0b56('0x9'));var interaction_log=require(_0x0b56('0x8'))(_0x0b56('0xa'));var config=require(_0x0b56('0xb'));var db=require('../../mysqldb')['db'];config[_0x0b56('0xc')]=_['defaults'](config[_0x0b56('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b56('0xd'))(new Redis(config[_0x0b56('0xc')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x0b56('0xe')](socket);var jayson=require(_0x0b56('0xf'));var client=jayson['client'][_0x0b56('0x10')]({'port':0x232c});var client9003=jayson[_0x0b56('0x11')]['http']({'port':0x232b});var client9002=jayson[_0x0b56('0x11')][_0x0b56('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x12f233,_0x5d129c,_0x3eb09a,_0x172e97){return new BPromise(function(_0x135f18,_0x9bb7e9){var _0x1e2130=_0x172e97||client;return _0x1e2130['request'](_0x12f233,_0x3eb09a)[_0x0b56('0x12')](function(_0x2e08e4){logger['info'](_0x0b56('0x13'),_0x5d129c,_0x0b56('0x14'));logger['debug'](_0x0b56('0x15'),_0x5d129c,_0x0b56('0x14'),JSON[_0x0b56('0x16')](_0x2e08e4));if(_0x2e08e4['error']){if(_0x2e08e4['error'][_0x0b56('0x17')]===0x1f4){logger[_0x0b56('0x18')]('MailMessage,\x20%s,\x20%s',_0x5d129c,_0x2e08e4[_0x0b56('0x18')][_0x0b56('0x19')]);return _0x9bb7e9(_0x2e08e4['error']['message']);}logger[_0x0b56('0x18')](_0x0b56('0x13'),_0x5d129c,_0x2e08e4['error']['message']);return _0x135f18(_0x2e08e4[_0x0b56('0x18')][_0x0b56('0x19')]);}else{logger[_0x0b56('0x1a')]('MailMessage,\x20%s,\x20%s',_0x5d129c,_0x0b56('0x14'));_0x135f18(_0x2e08e4[_0x0b56('0x1b')][_0x0b56('0x19')]);}})[_0x0b56('0x1c')](function(_0x32b94b){logger[_0x0b56('0x18')](_0x0b56('0x13'),_0x5d129c,_0x32b94b);_0x9bb7e9(_0x32b94b);});});}function respondWithResult(_0x514528,_0x4a11a5){_0x4a11a5=_0x4a11a5||0xc8;return function(_0x5beead){if(_0x5beead){return _0x514528[_0x0b56('0x1d')](_0x4a11a5)[_0x0b56('0x1e')](_0x5beead);}};}function respondWithFilteredResult(_0x3a13de,_0x30d2a7){return function(_0x41da36){if(_0x41da36){var _0x5c37f1=typeof _0x30d2a7['offset']==='undefined'&&typeof _0x30d2a7[_0x0b56('0x1f')]===_0x0b56('0x20');var _0x1fa8ae=_0x41da36['count'];var _0x58028a=_0x5c37f1?0x0:_0x30d2a7['offset'];var _0x385668=_0x5c37f1?_0x41da36[_0x0b56('0x21')]:_0x30d2a7['offset']+_0x30d2a7[_0x0b56('0x1f')];var _0x4ffdf2;if(_0x385668>=_0x1fa8ae){_0x385668=_0x1fa8ae;_0x4ffdf2=0xc8;}else{_0x4ffdf2=0xce;}_0x3a13de['status'](_0x4ffdf2);return _0x3a13de[_0x0b56('0x22')](_0x0b56('0x23'),_0x58028a+'-'+_0x385668+'/'+_0x1fa8ae)[_0x0b56('0x1e')](_0x41da36);}return null;};}function saveUpdates(_0x5c11c2){return function(_0x4bed45){if(_0x4bed45){return _0x4bed45[_0x0b56('0x24')](_0x5c11c2)[_0x0b56('0x12')](function(_0x56e59f){return _0x56e59f;});}return null;};}function removeEntity(_0x3187b0){return function(_0x223cc4){if(_0x223cc4){return _0x223cc4['destroy']()[_0x0b56('0x12')](function(){_0x3187b0[_0x0b56('0x1d')](0xcc)[_0x0b56('0x25')]();});}};}function handleEntityNotFound(_0x25039e){return function(_0x59b82c){if(!_0x59b82c){_0x25039e[_0x0b56('0x26')](0x194);}return _0x59b82c;};}function handleError(_0x4974ed,_0x2e31ae){_0x2e31ae=_0x2e31ae||0x1f4;return function(_0x5f27b1){logger['error'](_0x5f27b1[_0x0b56('0x27')]);if(_0x5f27b1['name']){delete _0x5f27b1[_0x0b56('0x28')];}_0x4974ed[_0x0b56('0x1d')](_0x2e31ae)['send'](_0x5f27b1);};}exports[_0x0b56('0x29')]=function(_0x53322b,_0x7b86b2){var _0x33e2a2={},_0x1b3179={},_0xb89795={'count':0x0,'rows':[]};var _0x5acc8c=_['map'](db[_0x0b56('0x2a')][_0x0b56('0x2b')],function(_0x70bc06){return{'name':_0x70bc06[_0x0b56('0x2c')],'type':_0x70bc06[_0x0b56('0x2d')][_0x0b56('0x2e')]};});_0x1b3179[_0x0b56('0x2f')]=_['map'](_0x5acc8c,_0x0b56('0x28'));_0x1b3179['query']=_['keys'](_0x53322b[_0x0b56('0x30')]);_0x1b3179[_0x0b56('0x31')]=_[_0x0b56('0x32')](_0x1b3179[_0x0b56('0x2f')],_0x1b3179[_0x0b56('0x30')]);_0x33e2a2[_0x0b56('0x33')]=_['intersection'](_0x1b3179[_0x0b56('0x2f')],qs['fields'](_0x53322b[_0x0b56('0x30')][_0x0b56('0x34')]));_0x33e2a2[_0x0b56('0x33')]=_0x33e2a2[_0x0b56('0x33')][_0x0b56('0x35')]?_0x33e2a2[_0x0b56('0x33')]:_0x1b3179[_0x0b56('0x2f')];if(!_0x53322b[_0x0b56('0x30')][_0x0b56('0x36')](_0x0b56('0x37'))){_0x33e2a2[_0x0b56('0x1f')]=qs[_0x0b56('0x1f')](_0x53322b['query']['limit']);_0x33e2a2[_0x0b56('0x38')]=qs['offset'](_0x53322b['query']['offset']);}_0x33e2a2[_0x0b56('0x39')]=qs['sort'](_0x53322b[_0x0b56('0x30')]['sort']);_0x33e2a2[_0x0b56('0x3a')]=qs['filters'](_[_0x0b56('0x3b')](_0x53322b[_0x0b56('0x30')],_0x1b3179[_0x0b56('0x31')]),_0x5acc8c);if(_0x53322b['query'][_0x0b56('0x3c')]){_0x33e2a2[_0x0b56('0x3a')]=_[_0x0b56('0x3d')](_0x33e2a2[_0x0b56('0x3a')],{'$or':_[_0x0b56('0x3e')](_0x5acc8c,function(_0x451be0){if(_0x451be0[_0x0b56('0x2d')]!==_0x0b56('0x3f')){var _0x6aebd2={};_0x6aebd2[_0x451be0[_0x0b56('0x28')]]={'$like':'%'+_0x53322b[_0x0b56('0x30')][_0x0b56('0x3c')]+'%'};return _0x6aebd2;}})});}_0x33e2a2=_[_0x0b56('0x3d')]({},_0x33e2a2,_0x53322b[_0x0b56('0x40')]);var _0xae9afa={'where':_0x33e2a2['where']};return db['MailMessage'][_0x0b56('0x21')](_0xae9afa)[_0x0b56('0x12')](function(_0x5cc081){_0xb89795[_0x0b56('0x21')]=_0x5cc081;if(_0x53322b[_0x0b56('0x30')][_0x0b56('0x41')]){_0x33e2a2[_0x0b56('0x42')]=[{'all':!![]}];}return db[_0x0b56('0x2a')]['findAll'](_0x33e2a2);})[_0x0b56('0x12')](function(_0x44258a){_0xb89795[_0x0b56('0x43')]=_0x44258a;return _0xb89795;})[_0x0b56('0x12')](respondWithFilteredResult(_0x7b86b2,_0x33e2a2))[_0x0b56('0x1c')](handleError(_0x7b86b2,null));};exports[_0x0b56('0x44')]=function(_0x52325a,_0x554874){var _0x1015eb={'raw':!![],'where':{'id':_0x52325a['params']['id']}},_0x3227df={};_0x3227df[_0x0b56('0x2f')]=_[_0x0b56('0x45')](db['MailMessage'][_0x0b56('0x2b')]);_0x3227df['query']=_[_0x0b56('0x45')](_0x52325a[_0x0b56('0x30')]);_0x3227df[_0x0b56('0x31')]=_[_0x0b56('0x32')](_0x3227df[_0x0b56('0x2f')],_0x3227df[_0x0b56('0x30')]);_0x1015eb[_0x0b56('0x33')]=_[_0x0b56('0x32')](_0x3227df[_0x0b56('0x2f')],qs[_0x0b56('0x34')](_0x52325a[_0x0b56('0x30')][_0x0b56('0x34')]));_0x1015eb[_0x0b56('0x33')]=_0x1015eb[_0x0b56('0x33')][_0x0b56('0x35')]?_0x1015eb[_0x0b56('0x33')]:_0x3227df['model'];if(_0x52325a[_0x0b56('0x30')][_0x0b56('0x41')]){_0x1015eb[_0x0b56('0x42')]=[{'all':!![]}];}_0x1015eb=_[_0x0b56('0x3d')]({},_0x1015eb,_0x52325a[_0x0b56('0x40')]);return db['MailMessage'][_0x0b56('0x46')](_0x1015eb)[_0x0b56('0x12')](handleEntityNotFound(_0x554874,null))[_0x0b56('0x12')](respondWithResult(_0x554874,null))['catch'](handleError(_0x554874,null));};exports[_0x0b56('0x24')]=function(_0x156d8d,_0xd97d96){if(_0x156d8d[_0x0b56('0x47')]['id']){delete _0x156d8d['body']['id'];}return db[_0x0b56('0x2a')][_0x0b56('0x46')]({'where':{'id':_0x156d8d[_0x0b56('0x48')]['id']}})['then'](handleEntityNotFound(_0xd97d96,null))[_0x0b56('0x12')](saveUpdates(_0x156d8d[_0x0b56('0x47')],null))[_0x0b56('0x12')](respondWithResult(_0xd97d96,null))[_0x0b56('0x1c')](handleError(_0xd97d96,null));};exports['destroy']=function(_0x4d43ea,_0x9bf918){return db[_0x0b56('0x2a')]['find']({'where':{'id':_0x4d43ea[_0x0b56('0x48')]['id']}})[_0x0b56('0x12')](handleEntityNotFound(_0x9bf918,null))[_0x0b56('0x12')](removeEntity(_0x9bf918,null))[_0x0b56('0x1c')](handleError(_0x9bf918,null));};exports['describe']=function(_0x3db9c1,_0x6b8ba1){return db['MailMessage']['describe']()[_0x0b56('0x12')](respondWithResult(_0x6b8ba1,null))[_0x0b56('0x1c')](handleError(_0x6b8ba1,null));};exports[_0x0b56('0x49')]=function(_0x510bfe,_0x5ea05c){return db['MailMessage'][_0x0b56('0x49')](_0x510bfe['body'])[_0x0b56('0x12')](function(_0x5193f9){if(_0x5193f9){if(_0x5193f9[_0x0b56('0x4a')]==='out'&&!_0x5193f9[_0x0b56('0x4b')]){var _0x96dcef,_0x122f2c,_0x3747b3;if(_0x510bfe[_0x0b56('0x47')]['to']){_0x122f2c=_0x510bfe[_0x0b56('0x47')]['to']['split'](',')[0x0];}return db[_0x0b56('0x4c')][_0x0b56('0x4d')]({'where':{'id':_0x5193f9[_0x0b56('0x4e')]},'include':[{'model':db[_0x0b56('0x4f')],'as':_0x0b56('0x50'),'include':[{'model':db[_0x0b56('0x51')],'as':'Contacts','where':{'email':_0x122f2c},'limit':0x1,'order':[[_0x0b56('0x52'),_0x0b56('0x53')]]}]},{'model':db[_0x0b56('0x54')],'as':_0x0b56('0x55'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x1ba2a4){_0x96dcef=_0x1ba2a4;if(!_0x96dcef||!_0x96dcef['Smtp'])return;var _0x4d987d=_0x96dcef[_0x0b56('0x56')]();if(_0x510bfe[_0x0b56('0x47')]['attachments']&&_0x510bfe[_0x0b56('0x47')][_0x0b56('0x57')][_0x0b56('0x35')]){for(var _0x5a8bfc=0x0;_0x5a8bfc<_0x510bfe['body'][_0x0b56('0x57')][_0x0b56('0x35')];_0x5a8bfc+=0x1){_0x510bfe[_0x0b56('0x47')][_0x0b56('0x57')][_0x5a8bfc]={'filename':_0x510bfe['body'][_0x0b56('0x57')][_0x5a8bfc][_0x0b56('0x28')],'path':path[_0x0b56('0x58')](config[_0x0b56('0x59')],_0x0b56('0x5a'),_0x510bfe[_0x0b56('0x47')][_0x0b56('0x57')][_0x5a8bfc]['basename'])};}}_0x3747b3={'account':_0x4d987d,'message':_0x510bfe[_0x0b56('0x47')]};return;})[_0x0b56('0x12')](function(){if(_0x96dcef[_0x0b56('0x50')]){if(_0x96dcef[_0x0b56('0x50')]['Contacts']['length']){return _0x96dcef[_0x0b56('0x50')][_0x0b56('0x5b')][0x0];}else{return db[_0x0b56('0x51')][_0x0b56('0x49')](_[_0x0b56('0x5c')](_0x510bfe[_0x0b56('0x47')],{'firstName':_0x510bfe[_0x0b56('0x47')]['to'],'email':_0x510bfe['body']['to'],'phone':_0x510bfe[_0x0b56('0x47')]['to'],'ListId':_0x96dcef['ListId']}));}}else{throw new Error(_0x0b56('0x5d'));}})[_0x0b56('0x12')](function(){if(_0x3747b3){return respondWithRpcPromise(_0x0b56('0x5e'),'sendMail',_0x3747b3,client9003)[_0x0b56('0x12')](function(_0x4fb018){return _0x5193f9[_0x0b56('0x24')]({'read':!![],'messageId':_0x4fb018[_0x0b56('0x5f')],'sentAt':moment()[_0x0b56('0x60')](_0x0b56('0x61'))});})[_0x0b56('0x1c')](function(_0x553787){logger[_0x0b56('0x18')]('%s',JSON[_0x0b56('0x16')](_0x553787));return _0x5193f9;});}return _0x5193f9;});}return _0x5193f9;}})['then'](respondWithResult(_0x5ea05c,0xc9))[_0x0b56('0x1c')](handleError(_0x5ea05c,null));};exports['accept']=function(_0x801da3,_0x489845){var _0x4eb26a={'agent':{},'channel':_0x0b56('0x62')};if(_0x801da3[_0x0b56('0x47')]['id']){delete _0x801da3[_0x0b56('0x47')]['id'];}_0x801da3[_0x0b56('0x47')][_0x0b56('0x63')]=!![];_0x801da3[_0x0b56('0x47')]['readAt']=moment()[_0x0b56('0x60')](_0x0b56('0x61'));_0x801da3[_0x0b56('0x47')][_0x0b56('0x64')]=_0x801da3[_0x0b56('0x47')][_0x0b56('0x64')]||_0x801da3[_0x0b56('0x65')]['id'];_0x4eb26a[_0x0b56('0x66')]['id']=_0x801da3[_0x0b56('0x47')]['UserId'];return db[_0x0b56('0x2a')][_0x0b56('0x46')]({'where':{'id':_0x801da3[_0x0b56('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x489845,null))[_0x0b56('0x12')](saveUpdates(_0x801da3[_0x0b56('0x47')],null))[_0x0b56('0x12')](function(_0x45f398){if(_0x45f398){_0x4eb26a[_0x0b56('0x19')]=_0x45f398[_0x0b56('0x67')]({'plain':!![]});return db['MailInteraction'][_0x0b56('0x46')]({'where':{'id':_0x45f398['MailInteractionId']}});}return null;})[_0x0b56('0x12')](handleEntityNotFound(_0x489845,null))[_0x0b56('0x12')](function(_0x386c32){if(_0x386c32){return _0x386c32[_0x0b56('0x24')]({'UserId':_0x801da3['body']['UserId'],'read1stAt':_[_0x0b56('0x68')](_0x386c32['read1stAt'])?moment()['format'](_0x0b56('0x61')):undefined});}return null;})[_0x0b56('0x12')](function(_0x431662){if(_0x431662){_0x4eb26a[_0x0b56('0x69')]=_0x431662['get']({'plain':!![]});interaction_log[_0x0b56('0x1a')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x801da3['user']['id'],_0x801da3[_0x0b56('0x65')]['name'],_0x801da3['user'][_0x0b56('0x6a')],_0x4eb26a[_0x0b56('0x69')]['id'],_0x801da3['body']?JSON[_0x0b56('0x16')](_0x801da3[_0x0b56('0x47')]):'null');return respondWithRpcPromise('AcceptMessage',_0x0b56('0x6b'),_0x4eb26a);}return null;})[_0x0b56('0x12')](function(_0x21eb10){var _0x21455d=_0x0b56('0x6c')+_0x21eb10['message'][_0x0b56('0x6d')];return db[_0x0b56('0x6e')][_0x0b56('0x30')](_0x21455d,{'type':db[_0x0b56('0x6f')]['QueryTypes'][_0x0b56('0x70')],'raw':!![]})[_0x0b56('0x12')](function(_0x2f53f0){return _0x2f53f0;});})[_0x0b56('0x12')](function(_0x32c753){if(_0x32c753){_0x4eb26a[_0x0b56('0x19')][_0x0b56('0x71')]=_0x32c753[0x0];if(!_0x801da3['body']['UserId'])return;return db[_0x0b56('0x72')][_0x0b56('0x46')]({'where':{'id':_0x801da3[_0x0b56('0x47')][_0x0b56('0x64')],'role':'agent'},'attributes':['id',_0x0b56('0x28'),_0x0b56('0x73'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x301852){if(!_0x301852)return null;_0x4eb26a[_0x0b56('0x19')][_0x0b56('0x66')]=_0x301852;return _0x4eb26a;})['then'](function(_0x48e9cb){if(_0x48e9cb){if(_0x801da3[_0x0b56('0x47')][_0x0b56('0x74')]){_0x4eb26a[_0x0b56('0x19')][_0x0b56('0x75')]=util[_0x0b56('0x60')](_0x0b56('0x76'),_0x801da3[_0x0b56('0x65')]['name']);_0x4eb26a[_0x0b56('0x19')][_0x0b56('0x77')]=_0x4eb26a[_0x0b56('0x77')];_0x4eb26a['message'][_0x0b56('0x78')]=_0x4eb26a[_0x0b56('0x77')];_0x4eb26a['message'][_0x0b56('0x79')]='accept';_0x4eb26a['message']['body']=htmlToText[_0x0b56('0x7a')](_0x4eb26a[_0x0b56('0x19')][_0x0b56('0x47')]);return respondWithRpcPromise(_0x0b56('0x7b'),_0x0b56('0x7b'),{'event':_0x0b56('0x7c'),'message':_0x4eb26a[_0x0b56('0x19')]},client9002)[_0x0b56('0x12')](function(){return _0x4eb26a;});}return _0x4eb26a;}return null;})[_0x0b56('0x12')](respondWithResult(_0x489845,null))[_0x0b56('0x1c')](handleError(_0x489845,null));};exports[_0x0b56('0x7d')]=function(_0x11ec26,_0xdf84fd){var _0x41cb2f={'agent':{},'channel':'mail'};if(_0x11ec26[_0x0b56('0x47')]['id']){delete _0x11ec26[_0x0b56('0x47')]['id'];}_0x11ec26[_0x0b56('0x47')][_0x0b56('0x64')]=_0x11ec26[_0x0b56('0x47')][_0x0b56('0x64')]||_0x11ec26[_0x0b56('0x65')]['id'];_0x41cb2f['agent']['id']=_0x11ec26[_0x0b56('0x47')]['UserId'];return db[_0x0b56('0x2a')][_0x0b56('0x46')]({'where':{'id':_0x11ec26[_0x0b56('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xdf84fd,null))[_0x0b56('0x12')](function(_0x5567b7){if(_0x5567b7){_0x41cb2f[_0x0b56('0x19')]=_0x5567b7[_0x0b56('0x67')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x5567b7['MailInteractionId']}});}return null;})[_0x0b56('0x12')](handleEntityNotFound(_0xdf84fd,null))[_0x0b56('0x12')](function(_0xcae87){if(_0xcae87){_0x41cb2f[_0x0b56('0x69')]=_0xcae87['get']({'plain':!![]});interaction_log[_0x0b56('0x1a')](_0x0b56('0x7e'),_0x11ec26[_0x0b56('0x65')]['id'],_0x11ec26[_0x0b56('0x65')]['name'],_0x11ec26[_0x0b56('0x65')][_0x0b56('0x6a')],_0x41cb2f[_0x0b56('0x69')]['id'],_0x11ec26[_0x0b56('0x47')]?JSON[_0x0b56('0x16')](_0x11ec26[_0x0b56('0x47')]):_0x0b56('0x7f'));return respondWithRpcPromise(_0x0b56('0x80'),'rejectMessage',_0x41cb2f);}return null;})['then'](function(_0x490382){var _0x4387cd=_0x0b56('0x6c')+_0x490382['message'][_0x0b56('0x6d')];return db[_0x0b56('0x6e')]['query'](_0x4387cd,{'type':db['Sequelize'][_0x0b56('0x81')][_0x0b56('0x70')],'raw':!![]})[_0x0b56('0x12')](function(_0x441dcc){return _0x441dcc;});})['then'](function(_0x320f75){if(_0x320f75){_0x41cb2f[_0x0b56('0x19')]['contact']=_0x320f75[0x0];if(!_0x11ec26[_0x0b56('0x47')][_0x0b56('0x64')])return;return db[_0x0b56('0x72')][_0x0b56('0x46')]({'where':{'id':_0x11ec26[_0x0b56('0x47')]['UserId'],'role':_0x0b56('0x66')},'attributes':['id',_0x0b56('0x28'),_0x0b56('0x73'),_0x0b56('0x82'),'internal'],'raw':!![]});}return null;})[_0x0b56('0x12')](function(_0x1b5765){if(!_0x1b5765)return null;_0x41cb2f['message']['agent']=_0x1b5765;return _0x41cb2f;})['then'](function(_0x2fdda2){if(_0x2fdda2){_0x2fdda2[_0x0b56('0x19')][_0x0b56('0x75')]=util[_0x0b56('0x60')](_0x0b56('0x76'),_0x11ec26[_0x0b56('0x65')]['name']);_0x2fdda2['message'][_0x0b56('0x77')]=_0x41cb2f[_0x0b56('0x77')];_0x2fdda2[_0x0b56('0x19')][_0x0b56('0x78')]=_0x41cb2f['channel'];_0x2fdda2[_0x0b56('0x19')][_0x0b56('0x79')]=_0x0b56('0x7d');_0x2fdda2[_0x0b56('0x19')][_0x0b56('0x47')]=htmlToText['fromString'](_0x41cb2f[_0x0b56('0x19')][_0x0b56('0x47')]);respondWithRpcPromise(_0x0b56('0x7b'),_0x0b56('0x7b'),{'event':'rejectmessage','message':_0x2fdda2[_0x0b56('0x19')]},client9002);return _0x41cb2f;}return null;})[_0x0b56('0x12')](respondWithResult(_0xdf84fd,null))[_0x0b56('0x1c')](handleError(_0xdf84fd,null));};exports[_0x0b56('0x83')]=function(_0x5d92a9,_0x11f16c){var _0x4a9015=moment()['unix']()[_0x0b56('0x84')]();var _0x33c33f=path[_0x0b56('0x58')](config[_0x0b56('0x59')],'server',_0x0b56('0x85'),_0x0b56('0x86'));var _0x435c81=path['join'](config[_0x0b56('0x59')],'server',_0x0b56('0x85'),_0x0b56('0x57'));var _0x25fbf1=util['format']('message-%s.eml',_0x4a9015);return db['MailMessage']['find']({'where':{'id':_0x5d92a9[_0x0b56('0x48')]['id']},'attributes':['id',_0x0b56('0x47'),_0x0b56('0x87'),'to','cc',_0x0b56('0x88'),_0x0b56('0x89'),_0x0b56('0x8a')],'include':_0x5d92a9[_0x0b56('0x30')][_0x0b56('0x57')]?[{'model':db[_0x0b56('0x8b')],'as':'Attachments'}]:undefined})[_0x0b56('0x12')](handleEntityNotFound(_0x11f16c,null))[_0x0b56('0x12')](function(_0x54f138){if(_0x54f138){var _0x554027=_0x54f138;var _0x253a20={'from':_0x554027['from'],'to':_0x554027['to'],'subject':_0x554027[_0x0b56('0x89')],'html':htmlEntities[_0x0b56('0x8c')](_0x554027[_0x0b56('0x47')]),'headers':{'Date':moment(_0x554027['createdAt'])[_0x0b56('0x60')](_0x0b56('0x8d'))},'attachments':[]};if(_0x54f138['cc']){_0x253a20[_0x0b56('0x8e')]['Cc']=_0x54f138['cc'];}if(_0x54f138[_0x0b56('0x88')]){_0x253a20[_0x0b56('0x8e')]['Bcc']=_0x54f138[_0x0b56('0x88')];}return new BPromise(function(_0x40e49d,_0x564ad0){if(_0x54f138['Attachments']){for(var _0x2721f9=0x0;_0x2721f9<_0x54f138[_0x0b56('0x8f')][_0x0b56('0x35')];_0x2721f9++){var _0x21aa12=_0x54f138[_0x0b56('0x8f')][_0x2721f9];var _0x4e4ee4=path[_0x0b56('0x58')](_0x435c81,_0x21aa12[_0x0b56('0x90')]);if(fs['existsSync'](_0x4e4ee4)){_0x253a20[_0x0b56('0x57')][_0x0b56('0x91')]({'name':_0x21aa12[_0x0b56('0x28')],'contentType':_0x21aa12['type'],'data':fs['readFileSync'](_0x4e4ee4)});}}}emlformat[_0x0b56('0x92')](_0x253a20,function(_0x27c22c,_0x23950c){if(_0x27c22c)return _0x564ad0(_0x27c22c);fs[_0x0b56('0x93')](path['join'](_0x33c33f,_0x25fbf1),_0x23950c);return _0x40e49d(_0x23950c);});});}})[_0x0b56('0x12')](function(_0x3f1508){if(_0x3f1508){return _0x11f16c['download'](path[_0x0b56('0x58')](_0x33c33f,_0x25fbf1),_0x25fbf1,function(_0x4b0838){if(!_0x4b0838)fs[_0x0b56('0x94')](path[_0x0b56('0x58')](_0x33c33f,_0x25fbf1));});}})[_0x0b56('0x1c')](handleError(_0x11f16c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 432453b..c240c85 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc4d=['events','../../mysqldb','MailMessage','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x52d8a8,_0x5e5c43){var _0x4d9b63=function(_0x2f904b){while(--_0x2f904b){_0x52d8a8['push'](_0x52d8a8['shift']());}};_0x4d9b63(++_0x5e5c43);}(_0xcc4d,0xbd));var _0xdcc4=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xcc4d[_0x5c351c];return _0x26f3b3;};'use strict';var EventEmitter=require(_0xdcc4('0x0'));var MailMessage=require(_0xdcc4('0x1'))['db'][_0xdcc4('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdcc4('0x3'),'afterUpdate':_0xdcc4('0x4'),'afterDestroy':_0xdcc4('0x5')};function emitEvent(_0x5e3c9b){return function(_0x45286c,_0x14eaa6,_0x3bea4e){MailMessageEvents['emit'](_0x5e3c9b+':'+_0x45286c['id'],_0x45286c);MailMessageEvents['emit'](_0x5e3c9b,_0x45286c);_0x3bea4e(null);};}for(var e in events){if(events[_0xdcc4('0x6')](e)){var event=events[e];MailMessage[_0xdcc4('0x7')](e,emitEvent(event));}}module[_0xdcc4('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x728b=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x728b,0xc5));var _0xb728=function(_0x4c494f,_0x29f136){_0x4c494f=_0x4c494f-0x0;var _0x2b5806=_0x728b[_0x4c494f];return _0x2b5806;};'use strict';var EventEmitter=require(_0xb728('0x0'));var MailMessage=require(_0xb728('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb728('0x2')](0x0);var events={'afterCreate':_0xb728('0x3'),'afterUpdate':_0xb728('0x4'),'afterDestroy':_0xb728('0x5')};function emitEvent(_0x164cfe){return function(_0x3fe11c,_0x5bb0dc,_0x526f06){MailMessageEvents[_0xb728('0x6')](_0x164cfe+':'+_0x3fe11c['id'],_0x3fe11c);MailMessageEvents[_0xb728('0x6')](_0x164cfe,_0x3fe11c);_0x526f06(null);};}for(var e in events){if(events[_0xb728('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xb728('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index ea1b625..419f5ae 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2db6=['UserId','MailInteraction','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','fti_mail_messages','subject','body','plainBody','fromString','direction','toLowerCase','out','secret','isNil'];(function(_0x95975e,_0x51412c){var _0x5d4933=function(_0x1cb2da){while(--_0x1cb2da){_0x95975e['push'](_0x95975e['shift']());}};_0x5d4933(++_0x51412c);}(_0x2db6,0x1a8));var _0x62db=function(_0x2104d9,_0x331c13){_0x2104d9=_0x2104d9-0x0;var _0x485124=_0x2db6[_0x2104d9];return _0x485124;};'use strict';var _=require(_0x62db('0x0'));var util=require(_0x62db('0x1'));var logger=require(_0x62db('0x2'))(_0x62db('0x3'));var moment=require(_0x62db('0x4'));var BPromise=require(_0x62db('0x5'));var rp=require(_0x62db('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x62db('0x7'));var rimraf=require(_0x62db('0x8'));var config=require(_0x62db('0x9'));var attributes=require(_0x62db('0xa'));module['exports']=function(_0x2837ef,_0x35d473){return _0x2837ef[_0x62db('0xb')](_0x62db('0xc'),attributes,{'tableName':_0x62db('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x62db('0xe'),'fields':['plainBody',_0x62db('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x57391d,_0x27c00c,_0x5279a0){if(_0x57391d[_0x62db('0x10')]){_0x57391d[_0x62db('0x11')]=htmlToText[_0x62db('0x12')](_0x57391d[_0x62db('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5279a0(null,_0x27c00c);},'afterCreate':function(_0x10d443,_0x58517a,_0x5daa90){var _0x46ab10=_0x2837ef['models'];var _0x120af0=_0x10d443['get']({'plain':!![]});if(_0x120af0[_0x62db('0x13')]['toLowerCase']()==='in'||_0x120af0[_0x62db('0x13')][_0x62db('0x14')]()===_0x62db('0x15')&&!_0x120af0[_0x62db('0x16')]&&!_[_0x62db('0x17')](_0x120af0[_0x62db('0x18')])){_0x46ab10[_0x62db('0x19')]['findOne']({'where':{'id':_0x120af0['MailInteractionId']}})[_0x62db('0x1a')](function(_0x4035ce){if(_0x4035ce){_0x4035ce[_0x62db('0x1b')]({'lastMsgAt':_0x120af0[_0x62db('0x1c')],'lastMsgDirection':_0x120af0[_0x62db('0x13')][_0x62db('0x14')]()});}})[_0x62db('0x1d')](function(_0x321311){console[_0x62db('0x1e')](_0x321311);});}_0x5daa90();}},'charset':'utf8mb4','collate':_0x62db('0x1f')});}; \ No newline at end of file +var _0x9f71=['mail_messages','messageId','fti_mail_messages','FULLTEXT','body','fromString','models','toLowerCase','direction','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','define','MailMessage'];(function(_0x5d9f29,_0x472af0){var _0x244031=function(_0x20d8a9){while(--_0x20d8a9){_0x5d9f29['push'](_0x5d9f29['shift']());}};_0x244031(++_0x472af0);}(_0x9f71,0x1e4));var _0x19f7=function(_0x16984d,_0x40a4d9){_0x16984d=_0x16984d-0x0;var _0x567c12=_0x9f71[_0x16984d];return _0x567c12;};'use strict';var _=require('lodash');var util=require(_0x19f7('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x19f7('0x1'));var BPromise=require(_0x19f7('0x2'));var rp=require(_0x19f7('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x19f7('0x4'));var rimraf=require(_0x19f7('0x5'));var config=require('../../config/environment');var attributes=require(_0x19f7('0x6'));module['exports']=function(_0x39ab4b,_0x115753){return _0x39ab4b[_0x19f7('0x7')](_0x19f7('0x8'),attributes,{'tableName':_0x19f7('0x9'),'paranoid':![],'indexes':[{'name':_0x19f7('0xa'),'fields':[_0x19f7('0xa')]},{'name':_0x19f7('0xb'),'fields':['plainBody','subject'],'type':_0x19f7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x414104,_0x2ab189,_0x516dba){if(_0x414104[_0x19f7('0xd')]){_0x414104['plainBody']=htmlToText[_0x19f7('0xe')](_0x414104[_0x19f7('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x516dba(null,_0x2ab189);},'afterCreate':function(_0x1fb3fd,_0x2674a6,_0x163820){var _0x3599b7=_0x39ab4b[_0x19f7('0xf')];var _0x3ac3d0=_0x1fb3fd['get']({'plain':!![]});if(_0x3ac3d0['direction'][_0x19f7('0x10')]()==='in'||_0x3ac3d0[_0x19f7('0x11')][_0x19f7('0x10')]()==='out'&&!_0x3ac3d0[_0x19f7('0x12')]&&!_[_0x19f7('0x13')](_0x3ac3d0[_0x19f7('0x14')])){_0x3599b7[_0x19f7('0x15')][_0x19f7('0x16')]({'where':{'id':_0x3ac3d0[_0x19f7('0x17')]}})[_0x19f7('0x18')](function(_0x143ff6){if(_0x143ff6){_0x143ff6[_0x19f7('0x19')]({'lastMsgAt':_0x3ac3d0['createdAt'],'lastMsgDirection':_0x3ac3d0[_0x19f7('0x11')]['toLowerCase']()});}})[_0x19f7('0x1a')](function(_0x146270){console[_0x19f7('0x1b')](_0x146270);});}_0x163820();}},'charset':'utf8mb4','collate':_0x19f7('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 5212cc0..aed8720 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1399=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify'];(function(_0x3f4d55,_0x21aca6){var _0x3e9d17=function(_0x4ec309){while(--_0x4ec309){_0x3f4d55['push'](_0x3f4d55['shift']());}};_0x3e9d17(++_0x21aca6);}(_0x1399,0x16c));var _0x9139=function(_0x284c96,_0x3e1bec){_0x284c96=_0x284c96-0x0;var _0xbdbb1e=_0x1399[_0x284c96];return _0xbdbb1e;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});config[_0x9139('0xa')]=_[_0x9139('0xb')](config['redis'],{'host':_0x9139('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9139('0xd'))[_0x9139('0xe')](socket);function respondWithRpcPromise(_0x4830cd,_0x315de8,_0x1bfa6b){return new BPromise(function(_0x5c90eb,_0x4f7f3a){return client[_0x9139('0xf')](_0x4830cd,_0x1bfa6b)[_0x9139('0x10')](function(_0x23357c){logger[_0x9139('0x11')](_0x9139('0x12'),_0x315de8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'),JSON['stringify'](_0x23357c));if(_0x23357c[_0x9139('0x14')]){if(_0x23357c[_0x9139('0x14')][_0x9139('0x15')]===0x1f4){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x23357c[_0x9139('0x14')]['message']);return _0x4f7f3a(_0x23357c['error']['message']);}logger[_0x9139('0x14')](_0x9139('0x12'),_0x315de8,_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);return _0x5c90eb(_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'));_0x5c90eb(_0x23357c[_0x9139('0x17')]['message']);}})['catch'](function(_0x30a363){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x30a363);_0x4f7f3a(_0x30a363);});});}exports[_0x9139('0x18')]=function(_0x1ef57b){var _0x1a592e=this;return new Promise(function(_0x3c8296,_0xd2eb33){return db[_0x9139('0x19')][_0x9139('0x1a')](_0x1ef57b[_0x9139('0x1b')],{'raw':_0x1ef57b[_0x9139('0x1c')]?_0x1ef57b[_0x9139('0x1c')][_0x9139('0x1d')]===undefined?!![]:![]:!![]})[_0x9139('0x10')](function(_0x5a3e2e){logger[_0x9139('0x11')](_0x9139('0x18'),_0x1ef57b);logger[_0x9139('0x1e')](_0x9139('0x18'),_0x1ef57b,JSON[_0x9139('0x1f')](_0x5a3e2e));_0x3c8296(_0x5a3e2e);})[_0x9139('0x20')](function(_0x4b7fe0){logger[_0x9139('0x14')](_0x9139('0x18'),_0x4b7fe0['message'],_0x1ef57b);_0xd2eb33(_0x1a592e[_0x9139('0x14')](0x1f4,_0x4b7fe0[_0x9139('0x16')]));});});}; \ No newline at end of file +var _0x160f=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf160('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf160('0xd'))[_0xf160('0xe')](socket);function respondWithRpcPromise(_0x393f70,_0x2736b8,_0x5e09c6){return new BPromise(function(_0x4a0639,_0xf8ec3d){return client[_0xf160('0xf')](_0x393f70,_0x5e09c6)[_0xf160('0x10')](function(_0x56072f){logger[_0xf160('0x11')](_0xf160('0x12'),_0x2736b8,_0xf160('0x13'));logger[_0xf160('0x14')](_0xf160('0x15'),_0x2736b8,'request\x20sent',JSON[_0xf160('0x16')](_0x56072f));if(_0x56072f['error']){if(_0x56072f[_0xf160('0x17')][_0xf160('0x18')]===0x1f4){logger[_0xf160('0x17')](_0xf160('0x12'),_0x2736b8,_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);return _0xf8ec3d(_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);}logger[_0xf160('0x17')]('MailMessage,\x20%s,\x20%s',_0x2736b8,_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);return _0x4a0639(_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);}else{logger['info'](_0xf160('0x12'),_0x2736b8,'request\x20sent');_0x4a0639(_0x56072f[_0xf160('0x1a')][_0xf160('0x19')]);}})[_0xf160('0x1b')](function(_0x1e09f3){logger[_0xf160('0x17')](_0xf160('0x12'),_0x2736b8,_0x1e09f3);_0xf8ec3d(_0x1e09f3);});});}exports[_0xf160('0x1c')]=function(_0x2a8cb4){var _0x1fdb38=this;return new Promise(function(_0x4a58d9,_0x40ccf0){return db[_0xf160('0x1d')][_0xf160('0x1e')](_0x2a8cb4['body'],{'raw':_0x2a8cb4[_0xf160('0x1f')]?_0x2a8cb4[_0xf160('0x1f')][_0xf160('0x20')]===undefined?!![]:![]:!![]})[_0xf160('0x10')](function(_0x2e03c8){logger[_0xf160('0x11')](_0xf160('0x1c'),_0x2a8cb4);logger['debug'](_0xf160('0x1c'),_0x2a8cb4,JSON[_0xf160('0x16')](_0x2e03c8));_0x4a58d9(_0x2e03c8);})[_0xf160('0x1b')](function(_0x49bb5c){logger['error'](_0xf160('0x1c'),_0x49bb5c[_0xf160('0x19')],_0x2a8cb4);_0x40ccf0(_0x1fdb38['error'](0x1f4,_0x49bb5c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 4a8ed77..0c700c2 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4b2=['emit','register','mailMessage:','save','remove','update'];(function(_0x3f5cc4,_0xec68f7){var _0x456f4b=function(_0x4f9885){while(--_0x4f9885){_0x3f5cc4['push'](_0x3f5cc4['shift']());}};_0x456f4b(++_0xec68f7);}(_0xe4b2,0x81));var _0x2e4b=function(_0x248345,_0x43a98c){_0x248345=_0x248345-0x0;var _0x2a778f=_0xe4b2[_0x248345];return _0x2a778f;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x2e4b('0x0'),_0x2e4b('0x1'),_0x2e4b('0x2')];function createListener(_0x39d9f8,_0x2f7d38){return function(_0x243796){_0x2f7d38[_0x2e4b('0x3')](_0x39d9f8,_0x243796);};}function removeListener(_0xa50538,_0x56f175){return function(){MailMessageEvents['removeListener'](_0xa50538,_0x56f175);};}exports[_0x2e4b('0x4')]=function(_0x2808b0){for(var _0x13569a=0x0,_0x2c1125=events['length'];_0x13569a<_0x2c1125;_0x13569a++){var _0x48a92e=events[_0x13569a];var _0x21826d=createListener(_0x2e4b('0x5')+_0x48a92e,_0x2808b0);MailMessageEvents['on'](_0x48a92e,_0x21826d);}}; \ No newline at end of file +var _0x60cb=['save','remove','emit','register','length','mailMessage:'];(function(_0x52cbc6,_0x3a9e07){var _0x5b7ee5=function(_0x5caebb){while(--_0x5caebb){_0x52cbc6['push'](_0x52cbc6['shift']());}};_0x5b7ee5(++_0x3a9e07);}(_0x60cb,0xd8));var _0xb60c=function(_0x506fa9,_0x763326){_0x506fa9=_0x506fa9-0x0;var _0x49d785=_0x60cb[_0x506fa9];return _0x49d785;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xb60c('0x0'),_0xb60c('0x1'),'update'];function createListener(_0x157b19,_0x2539d3){return function(_0x315e62){_0x2539d3[_0xb60c('0x2')](_0x157b19,_0x315e62);};}function removeListener(_0x3c621c,_0x2eedc0){return function(){MailMessageEvents['removeListener'](_0x3c621c,_0x2eedc0);};}exports[_0xb60c('0x3')]=function(_0xb614ca){for(var _0xc28041=0x0,_0x4945af=events[_0xb60c('0x4')];_0xc28041<_0x4945af;_0xc28041++){var _0x51299a=events[_0xc28041];var _0x181ac1=createListener(_0xb60c('0x5')+_0x51299a,_0xb614ca);MailMessageEvents['on'](_0x51299a,_0x181ac1);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 5a16a26..4891527 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60d1=['get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3c8a4b,_0x23fc4f){var _0x143e30=function(_0x746a98){while(--_0x746a98){_0x3c8a4b['push'](_0x3c8a4b['shift']());}};_0x143e30(++_0x23fc4f);}(_0x60d1,0x6b));var _0x160d=function(_0x2fe863,_0x2c3160){_0x2fe863=_0x2fe863-0x0;var _0x22a25d=_0x60d1[_0x2fe863];return _0x22a25d;};'use strict';var multer=require(_0x160d('0x0'));var util=require(_0x160d('0x1'));var path=require(_0x160d('0x2'));var timeout=require(_0x160d('0x3'));var express=require(_0x160d('0x4'));var router=express[_0x160d('0x5')]();var fs_extra=require(_0x160d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x160d('0x7'));var config=require(_0x160d('0x8'));var controller=require('./mailQueue.controller');router[_0x160d('0x9')]('/',auth[_0x160d('0xa')](),controller[_0x160d('0xb')]);router[_0x160d('0x9')](_0x160d('0xc'),auth[_0x160d('0xa')](),controller[_0x160d('0xd')]);router[_0x160d('0x9')](_0x160d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x160d('0x9')](_0x160d('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0x160d('0x9')](_0x160d('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x160d('0x9')](_0x160d('0x11'),auth[_0x160d('0xa')](),controller[_0x160d('0x12')]);router[_0x160d('0x13')]('/',auth[_0x160d('0xa')](),controller[_0x160d('0x14')]);router[_0x160d('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x160d('0x15')]);router[_0x160d('0x13')](_0x160d('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x160d('0x16')]('/:id',auth[_0x160d('0xa')](),controller[_0x160d('0x17')]);router[_0x160d('0x18')](_0x160d('0xe'),auth[_0x160d('0xa')](),controller[_0x160d('0x19')]);router['delete'](_0x160d('0x10'),auth[_0x160d('0xa')](),controller[_0x160d('0x1a')]);router[_0x160d('0x18')](_0x160d('0x11'),auth[_0x160d('0xa')](),controller[_0x160d('0x1b')]);module[_0x160d('0x1c')]=router; \ No newline at end of file +var _0xe197=['get','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe'];(function(_0x300d01,_0x4f8056){var _0x42b096=function(_0xb21456){while(--_0xb21456){_0x300d01['push'](_0x300d01['shift']());}};_0x42b096(++_0x4f8056);}(_0xe197,0xa2));var _0x7e19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe197[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7e19('0x0'));var util=require(_0x7e19('0x1'));var path=require(_0x7e19('0x2'));var timeout=require(_0x7e19('0x3'));var express=require('express');var router=express[_0x7e19('0x4')]();var fs_extra=require(_0x7e19('0x5'));var auth=require(_0x7e19('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7e19('0x7'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0x7e19('0x8')](),controller[_0x7e19('0x9')]);router['get'](_0x7e19('0xa'),auth['isAuthenticated'](),controller[_0x7e19('0xb')]);router[_0x7e19('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x7e19('0xd')]);router[_0x7e19('0xc')](_0x7e19('0xe'),auth[_0x7e19('0x8')](),controller[_0x7e19('0xf')]);router[_0x7e19('0xc')](_0x7e19('0x10'),auth[_0x7e19('0x8')](),controller[_0x7e19('0x11')]);router[_0x7e19('0xc')](_0x7e19('0x12'),auth[_0x7e19('0x8')](),controller[_0x7e19('0x13')]);router[_0x7e19('0x14')]('/',auth[_0x7e19('0x8')](),controller[_0x7e19('0x15')]);router['post'](_0x7e19('0x10'),auth[_0x7e19('0x8')](),controller['addTeams']);router[_0x7e19('0x14')](_0x7e19('0x12'),auth[_0x7e19('0x8')](),controller['addAgents']);router[_0x7e19('0x16')]('/:id',auth[_0x7e19('0x8')](),controller['update']);router[_0x7e19('0x17')](_0x7e19('0x18'),auth[_0x7e19('0x8')](),controller[_0x7e19('0x19')]);router[_0x7e19('0x17')](_0x7e19('0x10'),auth['isAuthenticated'](),controller[_0x7e19('0x1a')]);router[_0x7e19('0x17')](_0x7e19('0x12'),auth['isAuthenticated'](),controller[_0x7e19('0x1b')]);module[_0x7e19('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5a1cc09..cfdd116 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7231=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x10d6f8,_0x3be6b4){var _0x3f8800=function(_0x200ed9){while(--_0x200ed9){_0x10d6f8['push'](_0x10d6f8['shift']());}};_0x3f8800(++_0x3be6b4);}(_0x7231,0xe4));var _0x1723=function(_0x3fc206,_0x26084a){_0x3fc206=_0x3fc206-0x0;var _0x433676=_0x7231[_0x3fc206];return _0x433676;};'use strict';var Sequelize=require(_0x1723('0x0'));module[_0x1723('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1723('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1723('0x3')]},'timeout':{'type':Sequelize[_0x1723('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1723('0x5'),_0x1723('0x6'),_0x1723('0x7'))}}; \ No newline at end of file +var _0xb647=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb647,0x18b));var _0x7b64=function(_0x1dab3d,_0x16f3ab){_0x1dab3d=_0x1dab3d-0x0;var _0x29094f=_0xb647[_0x1dab3d];return _0x29094f;};'use strict';var Sequelize=require(_0x7b64('0x0'));module[_0x7b64('0x1')]={'name':{'type':Sequelize[_0x7b64('0x2')],'unique':_0x7b64('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7b64('0x2')]},'timeout':{'type':Sequelize[_0x7b64('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b64('0x5')]('rrmemory',_0x7b64('0x6'),_0x7b64('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index d9600bf..3d16e5f 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26a8=['ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','isEmpty','removeAgents','addAgents','spread','userMailQueue:remove','getAgents','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','undefined','offset','limit','set','update','then','destroy','MailQueues','UserProfileResource','end','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','count','include','query','findAll','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','sort','where','MailQueueId','filter','options','User','findAndCountAll','UserId','mailPause','createdAt','format','updatedAt','Team','pick','getTeams','addTeams','ids','Agents','online','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','field','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0x26a8,0x1df));var _0x826a=function(_0xc0553b,_0xd43bce){_0xc0553b=_0xc0553b-0x0;var _0x58f54a=_0x26a8[_0xc0553b];return _0x58f54a;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x826a('0x0'));var squel=require(_0x826a('0x1'));var Redis=require('ioredis');var qs=require(_0x826a('0x2'));var logger=require(_0x826a('0x3'))(_0x826a('0x4'));var config=require(_0x826a('0x5'));var db=require(_0x826a('0x6'))['db'];config[_0x826a('0x7')]=_[_0x826a('0x8')](config['redis'],{'host':_0x826a('0x9'),'port':0x18eb});var socket=require(_0x826a('0xa'))(new Redis(config[_0x826a('0x7')]));require(_0x826a('0xb'))[_0x826a('0xc')](socket);function respondWithStatusCode(_0x1be765,_0x39e93d){_0x39e93d=_0x39e93d||0xcc;return function(_0x3c31e2){if(_0x3c31e2){return _0x1be765[_0x826a('0xd')](_0x39e93d);}return _0x1be765[_0x826a('0xe')](_0x39e93d)['end']();};}function respondWithResult(_0x203c0d,_0x36e8b9){_0x36e8b9=_0x36e8b9||0xc8;return function(_0x2fea61){if(_0x2fea61){return _0x203c0d[_0x826a('0xe')](_0x36e8b9)[_0x826a('0xf')](_0x2fea61);}};}function respondWithFilteredResult(_0x2ed605,_0x49b0c1){return function(_0x93dfad){if(_0x93dfad){var _0x522820=typeof _0x49b0c1['offset']===_0x826a('0x10')&&typeof _0x49b0c1['limit']===_0x826a('0x10');var _0x5e6e0c=_0x93dfad['count'];var _0x4fcafc=_0x522820?0x0:_0x49b0c1[_0x826a('0x11')];var _0x5f4b9a=_0x522820?_0x93dfad['count']:_0x49b0c1['offset']+_0x49b0c1[_0x826a('0x12')];var _0x1d4364;if(_0x5f4b9a>=_0x5e6e0c){_0x5f4b9a=_0x5e6e0c;_0x1d4364=0xc8;}else{_0x1d4364=0xce;}_0x2ed605[_0x826a('0xe')](_0x1d4364);return _0x2ed605[_0x826a('0x13')]('Content-Range',_0x4fcafc+'-'+_0x5f4b9a+'/'+_0x5e6e0c)[_0x826a('0xf')](_0x93dfad);}return null;};}function saveUpdates(_0x115245){return function(_0x42e08a){if(_0x42e08a){return _0x42e08a[_0x826a('0x14')](_0x115245)[_0x826a('0x15')](function(_0x669df5){return _0x669df5;});}return null;};}function removeEntity(_0x4d65af){return function(_0x2d6d21){if(_0x2d6d21){return _0x2d6d21[_0x826a('0x16')]()['then'](function(){var _0x515cba=_0x2d6d21['get']({'plain':!![]});var _0x4e5ea4=_0x826a('0x17');return db[_0x826a('0x18')][_0x826a('0x16')]({'where':{'type':_0x4e5ea4,'resourceId':_0x515cba['id']}})['then'](function(){return _0x2d6d21;});})['then'](function(){_0x4d65af['status'](0xcc)[_0x826a('0x19')]();});}};}function handleEntityNotFound(_0x4cbf04){return function(_0x51ef56){if(!_0x51ef56){_0x4cbf04[_0x826a('0xd')](0x194);}return _0x51ef56;};}function handleError(_0x1f6353,_0x45ba1c){_0x45ba1c=_0x45ba1c||0x1f4;return function(_0x2b5331){logger[_0x826a('0x1a')](_0x2b5331[_0x826a('0x1b')]);if(_0x2b5331['name']){delete _0x2b5331[_0x826a('0x1c')];}_0x1f6353[_0x826a('0xe')](_0x45ba1c)['send'](_0x2b5331);};}exports[_0x826a('0x1d')]=function(_0x400bdb,_0x23aa46){var _0x384b60={};var _0x35a4db={'count':0x0,'rows':[]};var _0x5d265f=_[_0x826a('0x1e')](db[_0x826a('0x1f')][_0x826a('0x20')],function(_0x4308fa){return{'name':_0x4308fa[_0x826a('0x21')],'type':_0x4308fa[_0x826a('0x22')][_0x826a('0x23')]};});_0x384b60=qs[_0x826a('0x24')](_0x5d265f,_0x400bdb);var _0x2b4ff3={'where':_0x384b60['where']};return db[_0x826a('0x1f')][_0x826a('0x25')](_0x2b4ff3)['then'](function(_0x4f19f7){_0x35a4db[_0x826a('0x25')]=_0x4f19f7;_0x384b60[_0x826a('0x26')]=qs[_0x826a('0x26')](_0x400bdb[_0x826a('0x27')]);return db[_0x826a('0x1f')][_0x826a('0x28')](_0x384b60);})[_0x826a('0x15')](function(_0x49bcb5){_0x35a4db['rows']=_0x49bcb5;return _0x35a4db;})[_0x826a('0x15')](respondWithFilteredResult(_0x23aa46,_0x384b60))['catch'](handleError(_0x23aa46,null));};exports[_0x826a('0x29')]=function(_0x5ead76,_0x21d9c7){var _0x6b1e26={'raw':!![],'where':{'id':_0x5ead76[_0x826a('0x2a')]['id']}},_0x3b0b90={};_0x3b0b90['model']=_[_0x826a('0x2b')](db[_0x826a('0x1f')][_0x826a('0x20')]);_0x3b0b90[_0x826a('0x27')]=_[_0x826a('0x2b')](_0x5ead76['query']);_0x3b0b90[_0x826a('0x2c')]=_[_0x826a('0x2d')](_0x3b0b90[_0x826a('0x2e')],_0x3b0b90['query']);_0x6b1e26[_0x826a('0x2f')]=_[_0x826a('0x2d')](_0x3b0b90['model'],qs[_0x826a('0x30')](_0x5ead76[_0x826a('0x27')][_0x826a('0x30')]));_0x6b1e26[_0x826a('0x2f')]=_0x6b1e26[_0x826a('0x2f')][_0x826a('0x31')]?_0x6b1e26[_0x826a('0x2f')]:_0x3b0b90['model'];if(_0x5ead76[_0x826a('0x27')][_0x826a('0x32')]){_0x6b1e26[_0x826a('0x26')]=[{'all':!![]}];}_0x6b1e26=_[_0x826a('0x33')]({},_0x6b1e26,_0x5ead76['options']);return db[_0x826a('0x1f')][_0x826a('0x34')](_0x6b1e26)[_0x826a('0x15')](handleEntityNotFound(_0x21d9c7,null))[_0x826a('0x15')](respondWithResult(_0x21d9c7,null))[_0x826a('0x35')](handleError(_0x21d9c7,null));};exports['create']=function(_0xe0876,_0x46a9b6){return db[_0x826a('0x1f')][_0x826a('0x36')](_0xe0876[_0x826a('0x37')],{})[_0x826a('0x15')](function(_0x2b9002){var _0x2cab55=_0xe0876['user'][_0x826a('0x38')]({'plain':!![]});if(!_0x2cab55)throw new Error(_0x826a('0x39'));if(_0x2cab55[_0x826a('0x3a')]===_0x826a('0x3b')){var _0xb0d3f6=_0x2b9002[_0x826a('0x38')]({'plain':!![]});var _0xfdd28d=_0x826a('0x17');return db['UserProfileSection'][_0x826a('0x34')]({'where':{'name':_0xfdd28d,'userProfileId':_0x2cab55[_0x826a('0x3c')]},'raw':!![]})['then'](function(_0x5b5652){if(_0x5b5652&&_0x5b5652[_0x826a('0x3d')]===0x0){return db['UserProfileResource'][_0x826a('0x36')]({'name':_0xb0d3f6[_0x826a('0x1c')],'resourceId':_0xb0d3f6['id'],'type':_0x5b5652[_0x826a('0x1c')],'sectionId':_0x5b5652['id']},{})[_0x826a('0x15')](function(){return _0x2b9002;});}else{return _0x2b9002;}})['catch'](function(_0x3a44d4){logger['error'](_0x826a('0x3e'),_0x3a44d4);throw _0x3a44d4;});}return _0x2b9002;})[_0x826a('0x15')](respondWithResult(_0x46a9b6,0xc9))[_0x826a('0x35')](handleError(_0x46a9b6,null));};exports[_0x826a('0x14')]=function(_0x48fa7f,_0x97ae9f){if(_0x48fa7f['body']['id']){delete _0x48fa7f['body']['id'];}return db[_0x826a('0x1f')]['find']({'where':{'id':_0x48fa7f[_0x826a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x97ae9f,null))['then'](saveUpdates(_0x48fa7f[_0x826a('0x37')],null))['then'](respondWithResult(_0x97ae9f,null))[_0x826a('0x35')](handleError(_0x97ae9f,null));};exports[_0x826a('0x16')]=function(_0x3a642a,_0x4ed2cd){return db[_0x826a('0x1f')][_0x826a('0x34')]({'where':{'id':_0x3a642a[_0x826a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4ed2cd,null))[_0x826a('0x15')](removeEntity(_0x4ed2cd,null))[_0x826a('0x35')](handleError(_0x4ed2cd,null));};exports[_0x826a('0x3f')]=function(_0x1b13c4,_0x1c2405){return db[_0x826a('0x1f')][_0x826a('0x3f')]()[_0x826a('0x15')](respondWithResult(_0x1c2405,null))[_0x826a('0x35')](handleError(_0x1c2405,null));};exports[_0x826a('0x40')]=function(_0x16f7d3,_0x22f14c){var _0x39db4f={'raw':!![],'where':{}},_0x2b0065={},_0x5616b3;return db[_0x826a('0x1f')][_0x826a('0x41')]({'where':{'id':_0x16f7d3['params']['id']}})[_0x826a('0x15')](handleEntityNotFound(_0x22f14c,null))[_0x826a('0x15')](function(_0x5e2229){if(_0x5e2229){_0x5616b3=_0x5e2229[_0x826a('0x38')]({'plain':!![]});_0x2b0065[_0x826a('0x2e')]=_[_0x826a('0x2b')](db[_0x826a('0x42')][_0x826a('0x20')]);_0x2b0065[_0x826a('0x27')]=_[_0x826a('0x2b')](_0x16f7d3[_0x826a('0x27')]);_0x2b0065[_0x826a('0x2c')]=_[_0x826a('0x2d')](_0x2b0065[_0x826a('0x2e')],_0x2b0065[_0x826a('0x27')]);_0x39db4f[_0x826a('0x2f')]=_['intersection'](_0x2b0065['model'],qs['fields'](_0x16f7d3[_0x826a('0x27')]['fields']));_0x39db4f[_0x826a('0x2f')]=_0x39db4f[_0x826a('0x2f')][_0x826a('0x31')]?_0x39db4f[_0x826a('0x2f')]:_0x2b0065[_0x826a('0x2e')];if(!_0x16f7d3['query'][_0x826a('0x43')](_0x826a('0x44'))){_0x39db4f[_0x826a('0x12')]=qs['limit'](_0x16f7d3['query']['limit']);_0x39db4f[_0x826a('0x11')]=qs[_0x826a('0x11')](_0x16f7d3[_0x826a('0x27')][_0x826a('0x11')]);}_0x39db4f['order']=qs[_0x826a('0x45')](_0x16f7d3['query'][_0x826a('0x45')]);_0x39db4f[_0x826a('0x46')]=qs['filters'](_['pick'](_0x16f7d3[_0x826a('0x27')],_0x2b0065['filters']));_0x39db4f['where'][_0x826a('0x47')]=_0x5e2229['id'];if(_0x16f7d3[_0x826a('0x27')]['filter']){_0x39db4f[_0x826a('0x46')]=_['merge'](_0x39db4f[_0x826a('0x46')],{'$or':_[_0x826a('0x1e')](_0x39db4f[_0x826a('0x2f')],function(_0x5d6da4){var _0x5d7098={};_0x5d7098[_0x5d6da4]={'$like':'%'+_0x16f7d3[_0x826a('0x27')][_0x826a('0x48')]+'%'};return _0x5d7098;})});}_0x39db4f=_[_0x826a('0x33')]({},_0x39db4f,_0x16f7d3[_0x826a('0x49')]);return db['UserMailQueue'][_0x826a('0x28')](_0x39db4f);}})[_0x826a('0x15')](function(_0x505d28){if(_0x505d28){return db[_0x826a('0x4a')][_0x826a('0x4b')]({'where':{'id':_['map'](_0x505d28,_0x826a('0x4c')),'role':'agent'},'attributes':['id',_0x826a('0x1c'),_0x826a('0x4d'),'updatedAt',_0x826a('0x4e')]});}})[_0x826a('0x15')](function(_0x4d1494){if(_0x4d1494){return{'count':_0x4d1494[_0x826a('0x25')],'rows':_[_0x826a('0x1e')](_0x4d1494['rows'],function(_0x5e95a2){return{'membername':_0x5e95a2[_0x826a('0x1c')],'UserId':_0x5e95a2['id'],'queue_name':_0x5616b3[_0x826a('0x1c')],'MailQueueId':_0x5616b3['id'],'interface':util[_0x826a('0x4f')]('%s/%s','SIP',_0x5e95a2[_0x826a('0x1c')]),'penalty':0x0,'paused':_0x5e95a2['mailPause'],'createdAt':_0x5e95a2[_0x826a('0x4e')],'updatedAt':_0x5e95a2[_0x826a('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x22f14c,_0x39db4f))['catch'](handleError(_0x22f14c,null));};exports['getTeams']=function(_0x3aff1e,_0x49d016){var _0x118b65={};var _0x44c277={};var _0x543c1b;var _0x58829d;return db['MailQueue'][_0x826a('0x41')]({'where':{'id':_0x3aff1e[_0x826a('0x2a')]['id']}})[_0x826a('0x15')](handleEntityNotFound(_0x49d016,null))['then'](function(_0xd62e95){if(_0xd62e95){_0x543c1b=_0xd62e95;_0x44c277['model']=_['keys'](db[_0x826a('0x51')][_0x826a('0x20')]);_0x44c277[_0x826a('0x27')]=_[_0x826a('0x2b')](_0x3aff1e[_0x826a('0x27')]);_0x44c277[_0x826a('0x2c')]=_[_0x826a('0x2d')](_0x44c277[_0x826a('0x2e')],_0x44c277['query']);_0x118b65[_0x826a('0x2f')]=_[_0x826a('0x2d')](_0x44c277['model'],qs[_0x826a('0x30')](_0x3aff1e[_0x826a('0x27')][_0x826a('0x30')]));_0x118b65['attributes']=_0x118b65[_0x826a('0x2f')][_0x826a('0x31')]?_0x118b65[_0x826a('0x2f')]:_0x44c277[_0x826a('0x2e')];_0x118b65['order']=qs['sort'](_0x3aff1e['query'][_0x826a('0x45')]);_0x118b65[_0x826a('0x46')]=qs[_0x826a('0x2c')](_[_0x826a('0x52')](_0x3aff1e['query'],_0x44c277[_0x826a('0x2c')]));if(_0x3aff1e[_0x826a('0x27')][_0x826a('0x48')]){_0x118b65[_0x826a('0x46')]=_[_0x826a('0x33')](_0x118b65[_0x826a('0x46')],{'$or':_[_0x826a('0x1e')](_0x118b65[_0x826a('0x2f')],function(_0xf5c150){var _0x379484={};_0x379484[_0xf5c150]={'$like':'%'+_0x3aff1e['query'][_0x826a('0x48')]+'%'};return _0x379484;})});}_0x118b65=_[_0x826a('0x33')]({},_0x118b65,_0x3aff1e[_0x826a('0x49')]);return _0x543c1b[_0x826a('0x53')](_0x118b65);}})['then'](function(_0x31652f){if(_0x31652f){_0x58829d=_0x31652f['length'];if(!_0x3aff1e[_0x826a('0x27')]['hasOwnProperty'](_0x826a('0x44'))){_0x118b65[_0x826a('0x12')]=qs[_0x826a('0x12')](_0x3aff1e[_0x826a('0x27')]['limit']);_0x118b65[_0x826a('0x11')]=qs[_0x826a('0x11')](_0x3aff1e['query']['offset']);}return _0x543c1b[_0x826a('0x53')](_0x118b65);}})[_0x826a('0x15')](function(_0x348e68){if(_0x348e68){return _0x348e68?{'count':_0x58829d,'rows':_0x348e68}:null;}})[_0x826a('0x15')](respondWithResult(_0x49d016,null))['catch'](handleError(_0x49d016,null));};exports[_0x826a('0x54')]=function(_0x2e24ce,_0x46a6c4){var _0x370a15=_0x2e24ce['body'][_0x826a('0x55')];return db[_0x826a('0x51')][_0x826a('0x28')]({'where':{'id':_0x370a15},'attributes':['id'],'include':[{'model':db[_0x826a('0x4a')],'as':_0x826a('0x56'),'attributes':['id',_0x826a('0x1c'),_0x826a('0x57'),'voicePause','interface'],'raw':!![]}]})[_0x826a('0x15')](function(_0x7786ae){if(_0x7786ae){var _0x7229ed=_['flatMap'](_0x7786ae,function(_0x5c4ad6){var _0x54487f=_0x5c4ad6[_0x826a('0x38')]({'plain':!![]});return _0x54487f[_0x826a('0x56')];});return db[_0x826a('0x1f')][_0x826a('0x34')]({'where':{'id':_0x2e24ce[_0x826a('0x2a')]['id']}})[_0x826a('0x15')](function(_0x4639ba){return db[_0x826a('0x58')][_0x826a('0x59')](function(_0x1f195a){return _0x4639ba[_0x826a('0x54')](_0x370a15,{'transaction':_0x1f195a})[_0x826a('0x15')](function(){return BPromise[_0x826a('0x5a')](_0x7229ed,function(_0x1257b2){return db[_0x826a('0x42')][_0x826a('0x5b')]({'where':{'UserId':_0x1257b2['id'],'MailQueueId':_0x2e24ce[_0x826a('0x2a')]['id']},'transaction':_0x1f195a});});})['then'](function(){_0x7229ed[_0x826a('0x5c')](function(_0x11a0f5){socket[_0x826a('0x5d')](_0x826a('0x5e'),{'UserId':_0x11a0f5['id'],'MailQueueId':_0x4639ba['id']});});});});});}})['then'](respondWithStatusCode(_0x46a6c4,null))[_0x826a('0x35')](handleError(_0x46a6c4,null));};exports['removeTeams']=function(_0x11acb6,_0x4f24d7){return db[_0x826a('0x51')][_0x826a('0x28')]({'where':{'id':_0x11acb6['query'][_0x826a('0x55')]},'attributes':['id'],'include':[{'model':db[_0x826a('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x826a('0x15')](handleEntityNotFound(_0x4f24d7,null))[_0x826a('0x15')](function(_0x39f281){var _0x300c25=_[_0x826a('0x1e')](_0x39f281,'id');var _0x1f198a=[];var _0x468e6f=[];var _0x2b601b=squel['select']();_0x2b601b[_0x826a('0x5f')](_0x826a('0x60'))['from'](_0x826a('0x61'),'tq')['join'](_0x826a('0x62'),'ut',_0x826a('0x63'))[_0x826a('0x46')]('MailQueueId\x20=\x20?',_0x11acb6[_0x826a('0x2a')]['id']);for(var _0x2c965e=0x0;_0x2c965e<_0x39f281['length'];_0x2c965e+=0x1){let _0x4be9ac=_0x39f281[_0x2c965e];for(var _0xc92537=0x0;_0xc92537<_0x4be9ac[_0x826a('0x56')]['length'];_0xc92537+=0x1){let _0x10793e=_0x4be9ac[_0x826a('0x56')][_0xc92537];var _0x59d91f=_0x2b601b[_0x826a('0x64')]();_0x59d91f[_0x826a('0x46')](_0x826a('0x65'),_0x10793e['id']);_0x468e6f[_0x826a('0x66')](db[_0x826a('0x58')]['query'](_0x59d91f[_0x826a('0x67')](),{'type':db[_0x826a('0x58')][_0x826a('0x68')]['SELECT']})[_0x826a('0x15')](function(_0xb95ac8){if(_0xb95ac8['length']===0x1){return _0x10793e['id'];}else{var _0x3a74fd=_['every'](_[_0x826a('0x1e')](_0xb95ac8,_0x826a('0x69')),function(_0xd5abed){return _[_0x826a('0x6a')](_0x300c25,_0xd5abed);});if(_0x3a74fd){return _0x10793e['id'];}}}));}}return BPromise[_0x826a('0x6b')](_0x468e6f)[_0x826a('0x15')](function(_0x493934){_0x1f198a=_(_0x1f198a)[_0x826a('0x6c')](_0x493934)[_0x826a('0x6d')]()['value']();return db['MailQueue'][_0x826a('0x34')]({'where':{'id':_0x11acb6[_0x826a('0x2a')]['id']}})[_0x826a('0x15')](function(_0x467495){return db['sequelize']['transaction'](function(_0x4a3b7e){return _0x467495['removeTeams'](_0x11acb6[_0x826a('0x27')][_0x826a('0x55')],{'transaction':_0x4a3b7e})[_0x826a('0x15')](function(){if(!_[_0x826a('0x6e')](_0x1f198a)){return _0x467495[_0x826a('0x6f')](_0x1f198a,{'transaction':_0x4a3b7e});}})['then'](function(){_0x1f198a['forEach'](function(_0x117509){socket[_0x826a('0x5d')]('userMailQueue:remove',{'UserId':_0x117509,'MailQueueId':_0x467495['id']});});});});});});})['then'](respondWithStatusCode(_0x4f24d7,null))[_0x826a('0x35')](handleError(_0x4f24d7,null));};exports[_0x826a('0x70')]=function(_0x54cb9e,_0x431bb2){return db[_0x826a('0x1f')][_0x826a('0x34')]({'where':{'id':_0x54cb9e['params']['id']}})[_0x826a('0x15')](handleEntityNotFound(_0x431bb2,null))[_0x826a('0x15')](function(_0x255e10){if(_0x255e10){return _0x255e10[_0x826a('0x70')](_0x54cb9e['body'][_0x826a('0x55')],_['omit'](_0x54cb9e[_0x826a('0x37')],['ids','id'])||{})[_0x826a('0x71')](function(_0x33163e){for(var _0x58f6c6=0x0;_0x58f6c6<_0x54cb9e[_0x826a('0x37')][_0x826a('0x55')][_0x826a('0x31')];_0x58f6c6+=0x1){socket['emit'](_0x826a('0x5e'),{'UserId':Number(_0x54cb9e[_0x826a('0x37')][_0x826a('0x55')][_0x58f6c6]),'MailQueueId':Number(_0x54cb9e['params']['id'])});}return _0x33163e;});}})[_0x826a('0x15')](respondWithResult(_0x431bb2,null))[_0x826a('0x35')](handleError(_0x431bb2,null));};exports['removeAgents']=function(_0x26dd1a,_0x5a1c49){return db['MailQueue'][_0x826a('0x34')]({'where':{'id':_0x26dd1a[_0x826a('0x2a')]['id']}})[_0x826a('0x15')](handleEntityNotFound(_0x5a1c49,null))[_0x826a('0x15')](function(_0x51ab62){if(_0x51ab62){return _0x51ab62[_0x826a('0x6f')](_0x26dd1a[_0x826a('0x27')]['ids'])[_0x826a('0x15')](function(){if(_['isArray'](_0x26dd1a[_0x826a('0x27')][_0x826a('0x55')])){for(var _0xac2512=0x0;_0xac2512<_0x26dd1a[_0x826a('0x27')][_0x826a('0x55')]['length'];_0xac2512+=0x1){socket[_0x826a('0x5d')](_0x826a('0x72'),{'UserId':Number(_0x26dd1a[_0x826a('0x27')][_0x826a('0x55')][_0xac2512]),'MailQueueId':Number(_0x26dd1a[_0x826a('0x2a')]['id'])});}}else{socket[_0x826a('0x5d')](_0x826a('0x72'),{'UserId':Number(_0x26dd1a[_0x826a('0x27')][_0x826a('0x55')]),'MailQueueId':Number(_0x26dd1a[_0x826a('0x2a')]['id'])});}});}})[_0x826a('0x15')](respondWithStatusCode(_0x5a1c49,null))[_0x826a('0x35')](handleError(_0x5a1c49,null));};exports[_0x826a('0x73')]=function(_0x30459b,_0x401946){var _0x576c23={};var _0x19bf11={};var _0x383a5e;var _0x4347df;return db[_0x826a('0x1f')]['findOne']({'where':{'id':_0x30459b[_0x826a('0x2a')]['id']}})[_0x826a('0x15')](handleEntityNotFound(_0x401946,null))[_0x826a('0x15')](function(_0x5050a9){if(_0x5050a9){_0x383a5e=_0x5050a9;_0x19bf11[_0x826a('0x2e')]=_[_0x826a('0x2b')](db[_0x826a('0x4a')][_0x826a('0x20')]);_0x19bf11[_0x826a('0x27')]=_['keys'](_0x30459b['query']);_0x19bf11[_0x826a('0x2c')]=_[_0x826a('0x2d')](_0x19bf11[_0x826a('0x2e')],_0x19bf11['query']);_0x576c23[_0x826a('0x2f')]=_[_0x826a('0x2d')](_0x19bf11[_0x826a('0x2e')],qs[_0x826a('0x30')](_0x30459b['query'][_0x826a('0x30')]));_0x576c23['attributes']=_0x576c23['attributes']['length']?_0x576c23[_0x826a('0x2f')]:_0x19bf11['model'];_0x576c23['order']=qs[_0x826a('0x45')](_0x30459b[_0x826a('0x27')]['sort']);_0x576c23[_0x826a('0x46')]=qs[_0x826a('0x2c')](_[_0x826a('0x52')](_0x30459b[_0x826a('0x27')],_0x19bf11[_0x826a('0x2c')]));if(_0x30459b[_0x826a('0x27')][_0x826a('0x48')]){_0x576c23[_0x826a('0x46')]=_[_0x826a('0x33')](_0x576c23[_0x826a('0x46')],{'$or':_[_0x826a('0x1e')](_0x576c23[_0x826a('0x2f')],function(_0x29dd7e){var _0x4d33e2={};_0x4d33e2[_0x29dd7e]={'$like':'%'+_0x30459b[_0x826a('0x27')][_0x826a('0x48')]+'%'};return _0x4d33e2;})});}_0x576c23=_[_0x826a('0x33')]({},_0x576c23,_0x30459b['options']);return _0x383a5e[_0x826a('0x73')](_0x576c23);}})[_0x826a('0x15')](function(_0x15ce48){if(_0x15ce48){_0x4347df=_0x15ce48[_0x826a('0x31')];if(!_0x30459b['query']['hasOwnProperty'](_0x826a('0x44'))){_0x576c23[_0x826a('0x12')]=qs[_0x826a('0x12')](_0x30459b[_0x826a('0x27')][_0x826a('0x12')]);_0x576c23[_0x826a('0x11')]=qs['offset'](_0x30459b['query']['offset']);}return _0x383a5e[_0x826a('0x73')](_0x576c23);}})[_0x826a('0x15')](function(_0x1a24b6){if(_0x1a24b6){return _0x1a24b6?{'count':_0x4347df,'rows':_0x1a24b6}:null;}})[_0x826a('0x15')](respondWithResult(_0x401946,null))['catch'](handleError(_0x401946,null));}; \ No newline at end of file +var _0x1ebd=['interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','UserProfileResource','error','name','send','index','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','catch','params','model','keys','query','filters','intersection','attributes','fields','merge','options','create','user','get','MailQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','findOne','UserMailQueue','length','hasOwnProperty','order','sort','pick','MailQueueId','filter','map','findAll','User','UserId','mailPause','updatedAt','createdAt','rows','format','SIP','Team','nolimit','getTeams','ids','Agents','online','voicePause'];(function(_0x334a30,_0x77e583){var _0x532364=function(_0x4e50e8){while(--_0x4e50e8){_0x334a30['push'](_0x334a30['shift']());}};_0x532364(++_0x77e583);}(_0x1ebd,0x183));var _0xd1eb=function(_0x39712f,_0x1265cb){_0x39712f=_0x39712f-0x0;var _0x413ce1=_0x1ebd[_0x39712f];return _0x413ce1;};'use strict';var BPromise=require('bluebird');var util=require(_0xd1eb('0x0'));var _=require(_0xd1eb('0x1'));var squel=require(_0xd1eb('0x2'));var Redis=require('ioredis');var qs=require(_0xd1eb('0x3'));var logger=require(_0xd1eb('0x4'))(_0xd1eb('0x5'));var config=require('../../config/environment');var db=require(_0xd1eb('0x6'))['db'];config[_0xd1eb('0x7')]=_[_0xd1eb('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd1eb('0x9'))(new Redis(config['redis']));require(_0xd1eb('0xa'))[_0xd1eb('0xb')](socket);function respondWithStatusCode(_0x148e61,_0x52fdf4){_0x52fdf4=_0x52fdf4||0xcc;return function(_0x6ba50a){if(_0x6ba50a){return _0x148e61[_0xd1eb('0xc')](_0x52fdf4);}return _0x148e61[_0xd1eb('0xd')](_0x52fdf4)[_0xd1eb('0xe')]();};}function respondWithResult(_0x27ccc1,_0x2173ed){_0x2173ed=_0x2173ed||0xc8;return function(_0x366ee0){if(_0x366ee0){return _0x27ccc1[_0xd1eb('0xd')](_0x2173ed)[_0xd1eb('0xf')](_0x366ee0);}};}function respondWithFilteredResult(_0x22933c,_0x530fb9){return function(_0x4d7426){if(_0x4d7426){var _0x20117f=typeof _0x530fb9[_0xd1eb('0x10')]===_0xd1eb('0x11')&&typeof _0x530fb9[_0xd1eb('0x12')]==='undefined';var _0x37df4c=_0x4d7426['count'];var _0x32cd42=_0x20117f?0x0:_0x530fb9[_0xd1eb('0x10')];var _0xa7d32a=_0x20117f?_0x4d7426[_0xd1eb('0x13')]:_0x530fb9[_0xd1eb('0x10')]+_0x530fb9[_0xd1eb('0x12')];var _0x14e3fd;if(_0xa7d32a>=_0x37df4c){_0xa7d32a=_0x37df4c;_0x14e3fd=0xc8;}else{_0x14e3fd=0xce;}_0x22933c['status'](_0x14e3fd);return _0x22933c[_0xd1eb('0x14')](_0xd1eb('0x15'),_0x32cd42+'-'+_0xa7d32a+'/'+_0x37df4c)['json'](_0x4d7426);}return null;};}function saveUpdates(_0x32267f){return function(_0x87bd7d){if(_0x87bd7d){return _0x87bd7d[_0xd1eb('0x16')](_0x32267f)[_0xd1eb('0x17')](function(_0x36face){return _0x36face;});}return null;};}function removeEntity(_0x570f46){return function(_0x3a71c4){if(_0x3a71c4){return _0x3a71c4[_0xd1eb('0x18')]()[_0xd1eb('0x17')](function(){var _0x194ffb=_0x3a71c4['get']({'plain':!![]});var _0x301b6e='MailQueues';return db[_0xd1eb('0x19')]['destroy']({'where':{'type':_0x301b6e,'resourceId':_0x194ffb['id']}})[_0xd1eb('0x17')](function(){return _0x3a71c4;});})[_0xd1eb('0x17')](function(){_0x570f46[_0xd1eb('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1020bb){return function(_0x5864d0){if(!_0x5864d0){_0x1020bb[_0xd1eb('0xc')](0x194);}return _0x5864d0;};}function handleError(_0x4aeaf9,_0x2d0ca2){_0x2d0ca2=_0x2d0ca2||0x1f4;return function(_0x2450ae){logger[_0xd1eb('0x1a')](_0x2450ae['stack']);if(_0x2450ae[_0xd1eb('0x1b')]){delete _0x2450ae[_0xd1eb('0x1b')];}_0x4aeaf9[_0xd1eb('0xd')](_0x2d0ca2)[_0xd1eb('0x1c')](_0x2450ae);};}exports[_0xd1eb('0x1d')]=function(_0x589848,_0x24cc58){var _0x61efff={};var _0x431fae={'count':0x0,'rows':[]};var _0x2a1ed9=_['map'](db[_0xd1eb('0x1e')][_0xd1eb('0x1f')],function(_0x1eca08){return{'name':_0x1eca08[_0xd1eb('0x20')],'type':_0x1eca08[_0xd1eb('0x21')][_0xd1eb('0x22')]};});_0x61efff=qs[_0xd1eb('0x23')](_0x2a1ed9,_0x589848);var _0x4c30e7={'where':_0x61efff[_0xd1eb('0x24')]};return db[_0xd1eb('0x1e')][_0xd1eb('0x13')](_0x4c30e7)[_0xd1eb('0x17')](function(_0x5a2f9f){_0x431fae['count']=_0x5a2f9f;_0x61efff[_0xd1eb('0x25')]=qs['include'](_0x589848['query']);return db[_0xd1eb('0x1e')]['findAll'](_0x61efff);})['then'](function(_0x20f4df){_0x431fae['rows']=_0x20f4df;return _0x431fae;})[_0xd1eb('0x17')](respondWithFilteredResult(_0x24cc58,_0x61efff))[_0xd1eb('0x26')](handleError(_0x24cc58,null));};exports['show']=function(_0x307d6b,_0x26a66c){var _0xe51597={'raw':!![],'where':{'id':_0x307d6b[_0xd1eb('0x27')]['id']}},_0x54e9c1={};_0x54e9c1[_0xd1eb('0x28')]=_[_0xd1eb('0x29')](db[_0xd1eb('0x1e')][_0xd1eb('0x1f')]);_0x54e9c1[_0xd1eb('0x2a')]=_[_0xd1eb('0x29')](_0x307d6b[_0xd1eb('0x2a')]);_0x54e9c1[_0xd1eb('0x2b')]=_[_0xd1eb('0x2c')](_0x54e9c1[_0xd1eb('0x28')],_0x54e9c1['query']);_0xe51597[_0xd1eb('0x2d')]=_['intersection'](_0x54e9c1[_0xd1eb('0x28')],qs[_0xd1eb('0x2e')](_0x307d6b['query'][_0xd1eb('0x2e')]));_0xe51597[_0xd1eb('0x2d')]=_0xe51597['attributes']['length']?_0xe51597[_0xd1eb('0x2d')]:_0x54e9c1[_0xd1eb('0x28')];if(_0x307d6b[_0xd1eb('0x2a')]['includeAll']){_0xe51597[_0xd1eb('0x25')]=[{'all':!![]}];}_0xe51597=_[_0xd1eb('0x2f')]({},_0xe51597,_0x307d6b[_0xd1eb('0x30')]);return db[_0xd1eb('0x1e')]['find'](_0xe51597)['then'](handleEntityNotFound(_0x26a66c,null))[_0xd1eb('0x17')](respondWithResult(_0x26a66c,null))[_0xd1eb('0x26')](handleError(_0x26a66c,null));};exports[_0xd1eb('0x31')]=function(_0x35c71a,_0x4eeb28){return db[_0xd1eb('0x1e')][_0xd1eb('0x31')](_0x35c71a['body'],{})[_0xd1eb('0x17')](function(_0x2a5b6c){var _0x368d4f=_0x35c71a[_0xd1eb('0x32')][_0xd1eb('0x33')]({'plain':!![]});if(!_0x368d4f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x368d4f['role']==='user'){var _0x123395=_0x2a5b6c['get']({'plain':!![]});var _0x151819=_0xd1eb('0x34');return db['UserProfileSection'][_0xd1eb('0x35')]({'where':{'name':_0x151819,'userProfileId':_0x368d4f[_0xd1eb('0x36')]},'raw':!![]})[_0xd1eb('0x17')](function(_0x56c651){if(_0x56c651&&_0x56c651[_0xd1eb('0x37')]===0x0){return db[_0xd1eb('0x19')][_0xd1eb('0x31')]({'name':_0x123395[_0xd1eb('0x1b')],'resourceId':_0x123395['id'],'type':_0x56c651['name'],'sectionId':_0x56c651['id']},{})[_0xd1eb('0x17')](function(){return _0x2a5b6c;});}else{return _0x2a5b6c;}})[_0xd1eb('0x26')](function(_0x3efccb){logger[_0xd1eb('0x1a')](_0xd1eb('0x38'),_0x3efccb);throw _0x3efccb;});}return _0x2a5b6c;})['then'](respondWithResult(_0x4eeb28,0xc9))[_0xd1eb('0x26')](handleError(_0x4eeb28,null));};exports[_0xd1eb('0x16')]=function(_0x36fcdc,_0x44e584){if(_0x36fcdc[_0xd1eb('0x39')]['id']){delete _0x36fcdc['body']['id'];}return db[_0xd1eb('0x1e')][_0xd1eb('0x35')]({'where':{'id':_0x36fcdc[_0xd1eb('0x27')]['id']}})[_0xd1eb('0x17')](handleEntityNotFound(_0x44e584,null))[_0xd1eb('0x17')](saveUpdates(_0x36fcdc[_0xd1eb('0x39')],null))['then'](respondWithResult(_0x44e584,null))[_0xd1eb('0x26')](handleError(_0x44e584,null));};exports[_0xd1eb('0x18')]=function(_0x556baa,_0x41a9e4){return db[_0xd1eb('0x1e')][_0xd1eb('0x35')]({'where':{'id':_0x556baa[_0xd1eb('0x27')]['id']}})[_0xd1eb('0x17')](handleEntityNotFound(_0x41a9e4,null))[_0xd1eb('0x17')](removeEntity(_0x41a9e4,null))[_0xd1eb('0x26')](handleError(_0x41a9e4,null));};exports['describe']=function(_0x504550,_0x3d49ae){return db[_0xd1eb('0x1e')]['describe']()[_0xd1eb('0x17')](respondWithResult(_0x3d49ae,null))[_0xd1eb('0x26')](handleError(_0x3d49ae,null));};exports[_0xd1eb('0x3a')]=function(_0x4923bc,_0x4c0538){var _0x5bdb5b={'raw':!![],'where':{}},_0xdc8b6f={},_0xffaf37;return db[_0xd1eb('0x1e')][_0xd1eb('0x3b')]({'where':{'id':_0x4923bc[_0xd1eb('0x27')]['id']}})['then'](handleEntityNotFound(_0x4c0538,null))[_0xd1eb('0x17')](function(_0x400434){if(_0x400434){_0xffaf37=_0x400434['get']({'plain':!![]});_0xdc8b6f[_0xd1eb('0x28')]=_[_0xd1eb('0x29')](db[_0xd1eb('0x3c')][_0xd1eb('0x1f')]);_0xdc8b6f['query']=_[_0xd1eb('0x29')](_0x4923bc[_0xd1eb('0x2a')]);_0xdc8b6f[_0xd1eb('0x2b')]=_['intersection'](_0xdc8b6f[_0xd1eb('0x28')],_0xdc8b6f['query']);_0x5bdb5b[_0xd1eb('0x2d')]=_[_0xd1eb('0x2c')](_0xdc8b6f[_0xd1eb('0x28')],qs['fields'](_0x4923bc['query']['fields']));_0x5bdb5b[_0xd1eb('0x2d')]=_0x5bdb5b[_0xd1eb('0x2d')][_0xd1eb('0x3d')]?_0x5bdb5b[_0xd1eb('0x2d')]:_0xdc8b6f[_0xd1eb('0x28')];if(!_0x4923bc['query'][_0xd1eb('0x3e')]('nolimit')){_0x5bdb5b[_0xd1eb('0x12')]=qs[_0xd1eb('0x12')](_0x4923bc['query'][_0xd1eb('0x12')]);_0x5bdb5b[_0xd1eb('0x10')]=qs[_0xd1eb('0x10')](_0x4923bc[_0xd1eb('0x2a')][_0xd1eb('0x10')]);}_0x5bdb5b[_0xd1eb('0x3f')]=qs[_0xd1eb('0x40')](_0x4923bc['query'][_0xd1eb('0x40')]);_0x5bdb5b[_0xd1eb('0x24')]=qs[_0xd1eb('0x2b')](_[_0xd1eb('0x41')](_0x4923bc['query'],_0xdc8b6f[_0xd1eb('0x2b')]));_0x5bdb5b['where'][_0xd1eb('0x42')]=_0x400434['id'];if(_0x4923bc[_0xd1eb('0x2a')][_0xd1eb('0x43')]){_0x5bdb5b[_0xd1eb('0x24')]=_[_0xd1eb('0x2f')](_0x5bdb5b[_0xd1eb('0x24')],{'$or':_[_0xd1eb('0x44')](_0x5bdb5b[_0xd1eb('0x2d')],function(_0x225417){var _0x3ac326={};_0x3ac326[_0x225417]={'$like':'%'+_0x4923bc['query'][_0xd1eb('0x43')]+'%'};return _0x3ac326;})});}_0x5bdb5b=_[_0xd1eb('0x2f')]({},_0x5bdb5b,_0x4923bc[_0xd1eb('0x30')]);return db[_0xd1eb('0x3c')][_0xd1eb('0x45')](_0x5bdb5b);}})[_0xd1eb('0x17')](function(_0x39c9a8){if(_0x39c9a8){return db[_0xd1eb('0x46')]['findAndCountAll']({'where':{'id':_[_0xd1eb('0x44')](_0x39c9a8,_0xd1eb('0x47')),'role':'agent'},'attributes':['id',_0xd1eb('0x1b'),_0xd1eb('0x48'),_0xd1eb('0x49'),_0xd1eb('0x4a')]});}})[_0xd1eb('0x17')](function(_0x44f63e){if(_0x44f63e){return{'count':_0x44f63e['count'],'rows':_['map'](_0x44f63e[_0xd1eb('0x4b')],function(_0x4c0c7b){return{'membername':_0x4c0c7b[_0xd1eb('0x1b')],'UserId':_0x4c0c7b['id'],'queue_name':_0xffaf37[_0xd1eb('0x1b')],'MailQueueId':_0xffaf37['id'],'interface':util[_0xd1eb('0x4c')]('%s/%s',_0xd1eb('0x4d'),_0x4c0c7b[_0xd1eb('0x1b')]),'penalty':0x0,'paused':_0x4c0c7b[_0xd1eb('0x48')],'createdAt':_0x4c0c7b[_0xd1eb('0x4a')],'updatedAt':_0x4c0c7b[_0xd1eb('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4c0538,_0x5bdb5b))[_0xd1eb('0x26')](handleError(_0x4c0538,null));};exports['getTeams']=function(_0x3bea84,_0x483c3c){var _0x5edfbc={};var _0x26375b={};var _0x1f9b18;var _0x422364;return db[_0xd1eb('0x1e')][_0xd1eb('0x3b')]({'where':{'id':_0x3bea84[_0xd1eb('0x27')]['id']}})[_0xd1eb('0x17')](handleEntityNotFound(_0x483c3c,null))['then'](function(_0x48a223){if(_0x48a223){_0x1f9b18=_0x48a223;_0x26375b[_0xd1eb('0x28')]=_[_0xd1eb('0x29')](db[_0xd1eb('0x4e')][_0xd1eb('0x1f')]);_0x26375b[_0xd1eb('0x2a')]=_[_0xd1eb('0x29')](_0x3bea84[_0xd1eb('0x2a')]);_0x26375b[_0xd1eb('0x2b')]=_[_0xd1eb('0x2c')](_0x26375b[_0xd1eb('0x28')],_0x26375b[_0xd1eb('0x2a')]);_0x5edfbc[_0xd1eb('0x2d')]=_[_0xd1eb('0x2c')](_0x26375b[_0xd1eb('0x28')],qs[_0xd1eb('0x2e')](_0x3bea84[_0xd1eb('0x2a')]['fields']));_0x5edfbc[_0xd1eb('0x2d')]=_0x5edfbc[_0xd1eb('0x2d')][_0xd1eb('0x3d')]?_0x5edfbc[_0xd1eb('0x2d')]:_0x26375b[_0xd1eb('0x28')];_0x5edfbc['order']=qs[_0xd1eb('0x40')](_0x3bea84[_0xd1eb('0x2a')][_0xd1eb('0x40')]);_0x5edfbc[_0xd1eb('0x24')]=qs[_0xd1eb('0x2b')](_[_0xd1eb('0x41')](_0x3bea84['query'],_0x26375b[_0xd1eb('0x2b')]));if(_0x3bea84[_0xd1eb('0x2a')][_0xd1eb('0x43')]){_0x5edfbc[_0xd1eb('0x24')]=_['merge'](_0x5edfbc[_0xd1eb('0x24')],{'$or':_[_0xd1eb('0x44')](_0x5edfbc[_0xd1eb('0x2d')],function(_0xc8cb53){var _0x3db2db={};_0x3db2db[_0xc8cb53]={'$like':'%'+_0x3bea84[_0xd1eb('0x2a')][_0xd1eb('0x43')]+'%'};return _0x3db2db;})});}_0x5edfbc=_[_0xd1eb('0x2f')]({},_0x5edfbc,_0x3bea84['options']);return _0x1f9b18['getTeams'](_0x5edfbc);}})[_0xd1eb('0x17')](function(_0x479058){if(_0x479058){_0x422364=_0x479058[_0xd1eb('0x3d')];if(!_0x3bea84[_0xd1eb('0x2a')]['hasOwnProperty'](_0xd1eb('0x4f'))){_0x5edfbc[_0xd1eb('0x12')]=qs[_0xd1eb('0x12')](_0x3bea84[_0xd1eb('0x2a')][_0xd1eb('0x12')]);_0x5edfbc[_0xd1eb('0x10')]=qs[_0xd1eb('0x10')](_0x3bea84[_0xd1eb('0x2a')][_0xd1eb('0x10')]);}return _0x1f9b18[_0xd1eb('0x50')](_0x5edfbc);}})[_0xd1eb('0x17')](function(_0x1b9384){if(_0x1b9384){return _0x1b9384?{'count':_0x422364,'rows':_0x1b9384}:null;}})[_0xd1eb('0x17')](respondWithResult(_0x483c3c,null))[_0xd1eb('0x26')](handleError(_0x483c3c,null));};exports['addTeams']=function(_0x4adda7,_0x18a351){var _0x52b9df=_0x4adda7[_0xd1eb('0x39')][_0xd1eb('0x51')];return db[_0xd1eb('0x4e')][_0xd1eb('0x45')]({'where':{'id':_0x52b9df},'attributes':['id'],'include':[{'model':db[_0xd1eb('0x46')],'as':_0xd1eb('0x52'),'attributes':['id','name',_0xd1eb('0x53'),_0xd1eb('0x54'),_0xd1eb('0x55')],'raw':!![]}]})['then'](function(_0x52df38){if(_0x52df38){var _0x3f0b19=_['flatMap'](_0x52df38,function(_0x41c526){var _0x4a6ef2=_0x41c526[_0xd1eb('0x33')]({'plain':!![]});return _0x4a6ef2['Agents'];});return db[_0xd1eb('0x1e')][_0xd1eb('0x35')]({'where':{'id':_0x4adda7[_0xd1eb('0x27')]['id']}})['then'](function(_0x191056){return db[_0xd1eb('0x56')][_0xd1eb('0x57')](function(_0x5cbeab){return _0x191056[_0xd1eb('0x58')](_0x52b9df,{'transaction':_0x5cbeab})[_0xd1eb('0x17')](function(){return BPromise[_0xd1eb('0x59')](_0x3f0b19,function(_0x1c6772){return db[_0xd1eb('0x3c')][_0xd1eb('0x5a')]({'where':{'UserId':_0x1c6772['id'],'MailQueueId':_0x4adda7['params']['id']},'transaction':_0x5cbeab});});})[_0xd1eb('0x17')](function(){_0x3f0b19[_0xd1eb('0x5b')](function(_0x473975){socket[_0xd1eb('0x5c')](_0xd1eb('0x5d'),{'UserId':_0x473975['id'],'MailQueueId':_0x191056['id']});});});});});}})[_0xd1eb('0x17')](respondWithStatusCode(_0x18a351,null))[_0xd1eb('0x26')](handleError(_0x18a351,null));};exports[_0xd1eb('0x5e')]=function(_0x469a19,_0x435ebd){return db[_0xd1eb('0x4e')][_0xd1eb('0x45')]({'where':{'id':_0x469a19[_0xd1eb('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd1eb('0x52'),'attributes':['id'],'raw':!![]}]})[_0xd1eb('0x17')](handleEntityNotFound(_0x435ebd,null))[_0xd1eb('0x17')](function(_0x1feb18){var _0x5ba28a=_[_0xd1eb('0x44')](_0x1feb18,'id');var _0x5cea58=[];var _0x1e1c64=[];var _0x4f212d=squel[_0xd1eb('0x5f')]();_0x4f212d['field'](_0xd1eb('0x60'))[_0xd1eb('0x61')](_0xd1eb('0x62'),'tq')[_0xd1eb('0x63')](_0xd1eb('0x64'),'ut',_0xd1eb('0x65'))['where']('MailQueueId\x20=\x20?',_0x469a19[_0xd1eb('0x27')]['id']);for(var _0x32a980=0x0;_0x32a980<_0x1feb18[_0xd1eb('0x3d')];_0x32a980+=0x1){let _0x212996=_0x1feb18[_0x32a980];for(var _0x261b76=0x0;_0x261b76<_0x212996['Agents'][_0xd1eb('0x3d')];_0x261b76+=0x1){let _0x55a9ef=_0x212996[_0xd1eb('0x52')][_0x261b76];var _0x307695=_0x4f212d['clone']();_0x307695[_0xd1eb('0x24')]('ut.UserId\x20=\x20?',_0x55a9ef['id']);_0x1e1c64[_0xd1eb('0x66')](db['sequelize'][_0xd1eb('0x2a')](_0x307695[_0xd1eb('0x67')](),{'type':db[_0xd1eb('0x56')]['QueryTypes'][_0xd1eb('0x68')]})[_0xd1eb('0x17')](function(_0x4d21c9){if(_0x4d21c9[_0xd1eb('0x3d')]===0x1){return _0x55a9ef['id'];}else{var _0x489c88=_[_0xd1eb('0x69')](_['map'](_0x4d21c9,_0xd1eb('0x6a')),function(_0x3b4a41){return _[_0xd1eb('0x6b')](_0x5ba28a,_0x3b4a41);});if(_0x489c88){return _0x55a9ef['id'];}}}));}}return BPromise[_0xd1eb('0x6c')](_0x1e1c64)['then'](function(_0x12840b){_0x5cea58=_(_0x5cea58)['union'](_0x12840b)['compact']()[_0xd1eb('0x6d')]();return db[_0xd1eb('0x1e')]['find']({'where':{'id':_0x469a19[_0xd1eb('0x27')]['id']}})[_0xd1eb('0x17')](function(_0x4587f3){return db[_0xd1eb('0x56')]['transaction'](function(_0x5a439c){return _0x4587f3['removeTeams'](_0x469a19[_0xd1eb('0x2a')][_0xd1eb('0x51')],{'transaction':_0x5a439c})[_0xd1eb('0x17')](function(){if(!_[_0xd1eb('0x6e')](_0x5cea58)){return _0x4587f3[_0xd1eb('0x6f')](_0x5cea58,{'transaction':_0x5a439c});}})[_0xd1eb('0x17')](function(){_0x5cea58[_0xd1eb('0x5b')](function(_0x35b626){socket[_0xd1eb('0x5c')](_0xd1eb('0x70'),{'UserId':_0x35b626,'MailQueueId':_0x4587f3['id']});});});});});});})[_0xd1eb('0x17')](respondWithStatusCode(_0x435ebd,null))['catch'](handleError(_0x435ebd,null));};exports[_0xd1eb('0x71')]=function(_0x5373e0,_0x39f9e9){return db[_0xd1eb('0x1e')][_0xd1eb('0x35')]({'where':{'id':_0x5373e0[_0xd1eb('0x27')]['id']}})[_0xd1eb('0x17')](handleEntityNotFound(_0x39f9e9,null))[_0xd1eb('0x17')](function(_0x13a72e){if(_0x13a72e){return _0x13a72e[_0xd1eb('0x71')](_0x5373e0[_0xd1eb('0x39')]['ids'],_[_0xd1eb('0x72')](_0x5373e0[_0xd1eb('0x39')],['ids','id'])||{})[_0xd1eb('0x73')](function(_0x2704ef){for(var _0x3239e7=0x0;_0x3239e7<_0x5373e0[_0xd1eb('0x39')][_0xd1eb('0x51')]['length'];_0x3239e7+=0x1){socket['emit'](_0xd1eb('0x5d'),{'UserId':Number(_0x5373e0['body'][_0xd1eb('0x51')][_0x3239e7]),'MailQueueId':Number(_0x5373e0[_0xd1eb('0x27')]['id'])});}return _0x2704ef;});}})[_0xd1eb('0x17')](respondWithResult(_0x39f9e9,null))[_0xd1eb('0x26')](handleError(_0x39f9e9,null));};exports[_0xd1eb('0x6f')]=function(_0x549521,_0x99cb71){return db[_0xd1eb('0x1e')][_0xd1eb('0x35')]({'where':{'id':_0x549521[_0xd1eb('0x27')]['id']}})['then'](handleEntityNotFound(_0x99cb71,null))[_0xd1eb('0x17')](function(_0x51d71b){if(_0x51d71b){return _0x51d71b['removeAgents'](_0x549521[_0xd1eb('0x2a')][_0xd1eb('0x51')])[_0xd1eb('0x17')](function(){if(_[_0xd1eb('0x74')](_0x549521[_0xd1eb('0x2a')][_0xd1eb('0x51')])){for(var _0x5f5e04=0x0;_0x5f5e04<_0x549521['query'][_0xd1eb('0x51')][_0xd1eb('0x3d')];_0x5f5e04+=0x1){socket[_0xd1eb('0x5c')]('userMailQueue:remove',{'UserId':Number(_0x549521[_0xd1eb('0x2a')][_0xd1eb('0x51')][_0x5f5e04]),'MailQueueId':Number(_0x549521[_0xd1eb('0x27')]['id'])});}}else{socket[_0xd1eb('0x5c')](_0xd1eb('0x70'),{'UserId':Number(_0x549521['query'][_0xd1eb('0x51')]),'MailQueueId':Number(_0x549521[_0xd1eb('0x27')]['id'])});}});}})['then'](respondWithStatusCode(_0x99cb71,null))[_0xd1eb('0x26')](handleError(_0x99cb71,null));};exports[_0xd1eb('0x75')]=function(_0x3a36c7,_0x2760dc){var _0x4b354c={};var _0xe7ffb6={};var _0x29e6eb;var _0x4fa075;return db['MailQueue']['findOne']({'where':{'id':_0x3a36c7[_0xd1eb('0x27')]['id']}})['then'](handleEntityNotFound(_0x2760dc,null))[_0xd1eb('0x17')](function(_0x3fa8eb){if(_0x3fa8eb){_0x29e6eb=_0x3fa8eb;_0xe7ffb6[_0xd1eb('0x28')]=_[_0xd1eb('0x29')](db[_0xd1eb('0x46')][_0xd1eb('0x1f')]);_0xe7ffb6['query']=_[_0xd1eb('0x29')](_0x3a36c7[_0xd1eb('0x2a')]);_0xe7ffb6['filters']=_[_0xd1eb('0x2c')](_0xe7ffb6[_0xd1eb('0x28')],_0xe7ffb6[_0xd1eb('0x2a')]);_0x4b354c['attributes']=_[_0xd1eb('0x2c')](_0xe7ffb6[_0xd1eb('0x28')],qs[_0xd1eb('0x2e')](_0x3a36c7[_0xd1eb('0x2a')][_0xd1eb('0x2e')]));_0x4b354c[_0xd1eb('0x2d')]=_0x4b354c['attributes'][_0xd1eb('0x3d')]?_0x4b354c[_0xd1eb('0x2d')]:_0xe7ffb6[_0xd1eb('0x28')];_0x4b354c[_0xd1eb('0x3f')]=qs[_0xd1eb('0x40')](_0x3a36c7[_0xd1eb('0x2a')][_0xd1eb('0x40')]);_0x4b354c['where']=qs[_0xd1eb('0x2b')](_[_0xd1eb('0x41')](_0x3a36c7[_0xd1eb('0x2a')],_0xe7ffb6[_0xd1eb('0x2b')]));if(_0x3a36c7[_0xd1eb('0x2a')][_0xd1eb('0x43')]){_0x4b354c[_0xd1eb('0x24')]=_[_0xd1eb('0x2f')](_0x4b354c[_0xd1eb('0x24')],{'$or':_[_0xd1eb('0x44')](_0x4b354c[_0xd1eb('0x2d')],function(_0x5aa64e){var _0x3a45c4={};_0x3a45c4[_0x5aa64e]={'$like':'%'+_0x3a36c7['query'][_0xd1eb('0x43')]+'%'};return _0x3a45c4;})});}_0x4b354c=_[_0xd1eb('0x2f')]({},_0x4b354c,_0x3a36c7[_0xd1eb('0x30')]);return _0x29e6eb['getAgents'](_0x4b354c);}})[_0xd1eb('0x17')](function(_0x5dddd7){if(_0x5dddd7){_0x4fa075=_0x5dddd7[_0xd1eb('0x3d')];if(!_0x3a36c7['query'][_0xd1eb('0x3e')](_0xd1eb('0x4f'))){_0x4b354c[_0xd1eb('0x12')]=qs['limit'](_0x3a36c7[_0xd1eb('0x2a')][_0xd1eb('0x12')]);_0x4b354c[_0xd1eb('0x10')]=qs[_0xd1eb('0x10')](_0x3a36c7['query'][_0xd1eb('0x10')]);}return _0x29e6eb[_0xd1eb('0x75')](_0x4b354c);}})[_0xd1eb('0x17')](function(_0x3485da){if(_0x3485da){return _0x3485da?{'count':_0x4fa075,'rows':_0x3485da}:null;}})[_0xd1eb('0x17')](respondWithResult(_0x2760dc,null))[_0xd1eb('0x26')](handleError(_0x2760dc,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d2744bc..fcf0e11 100644 --- a/server/api/mailQueue/mailQueue.events.js +++ b/server/api/mailQueue/mailQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fe1=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x4fe1,0x1c8));var _0x14fe=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4fe1[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0x14fe('0x0'));var MailQueue=require(_0x14fe('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x14fe('0x2'),'afterUpdate':_0x14fe('0x3'),'afterDestroy':_0x14fe('0x4')};function emitEvent(_0x541f97){return function(_0x4ba14a,_0x54bd6d,_0x548066){MailQueueEvents[_0x14fe('0x5')](_0x541f97+':'+_0x4ba14a['id'],_0x4ba14a);MailQueueEvents[_0x14fe('0x5')](_0x541f97,_0x4ba14a);_0x548066(null);};}for(var e in events){if(events[_0x14fe('0x6')](e)){var event=events[e];MailQueue[_0x14fe('0x7')](e,emitEvent(event));}}module[_0x14fe('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x54d6=['hook','events','../../mysqldb','MailQueue','remove','emit','hasOwnProperty'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x54d6,0x182));var _0x654d=function(_0x574e1a,_0x29cff0){_0x574e1a=_0x574e1a-0x0;var _0x58709d=_0x54d6[_0x574e1a];return _0x58709d;};'use strict';var EventEmitter=require(_0x654d('0x0'));var MailQueue=require(_0x654d('0x1'))['db'][_0x654d('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x654d('0x3')};function emitEvent(_0x2a1fc2){return function(_0x24a9c7,_0x25db47,_0x2ed6c3){MailQueueEvents[_0x654d('0x4')](_0x2a1fc2+':'+_0x24a9c7['id'],_0x24a9c7);MailQueueEvents[_0x654d('0x4')](_0x2a1fc2,_0x24a9c7);_0x2ed6c3(null);};}for(var e in events){if(events[_0x654d('0x5')](e)){var event=events[e];MailQueue[_0x654d('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 58d5600..537833c 100644 --- a/server/api/mailQueue/mailQueue.model.js +++ b/server/api/mailQueue/mailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0ed=['moment','bluebird','request-promise','path','rimraf','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x125261,_0x37cf3e){var _0x47e397=function(_0x560fec){while(--_0x560fec){_0x125261['push'](_0x125261['shift']());}};_0x47e397(++_0x37cf3e);}(_0xa0ed,0x10f));var _0xda0e=function(_0x342e71,_0xc68c70){_0x342e71=_0x342e71-0x0;var _0x4817f5=_0xa0ed[_0x342e71];return _0x4817f5;};'use strict';var _=require(_0xda0e('0x0'));var util=require(_0xda0e('0x1'));var logger=require(_0xda0e('0x2'))(_0xda0e('0x3'));var moment=require(_0xda0e('0x4'));var BPromise=require(_0xda0e('0x5'));var rp=require(_0xda0e('0x6'));var fs=require('fs');var path=require(_0xda0e('0x7'));var rimraf=require(_0xda0e('0x8'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module['exports']=function(_0x45994b,_0x58d9a3){return _0x45994b['define'](_0xda0e('0x9'),attributes,{'tableName':_0xda0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4daa=['api','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger'];(function(_0x3cfb93,_0x56feb0){var _0x2746e7=function(_0x558d6b){while(--_0x558d6b){_0x3cfb93['push'](_0x3cfb93['shift']());}};_0x2746e7(++_0x56feb0);}(_0x4daa,0x69));var _0xa4da=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x4daa[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0xa4da('0x0'));var util=require(_0xa4da('0x1'));var logger=require(_0xa4da('0x2'))(_0xa4da('0x3'));var moment=require('moment');var BPromise=require(_0xa4da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4da('0x5'));var rimraf=require(_0xa4da('0x6'));var config=require(_0xa4da('0x7'));var attributes=require(_0xa4da('0x8'));module[_0xa4da('0x9')]=function(_0x1d3d2b,_0x3b6ad2){return _0x1d3d2b[_0xa4da('0xa')]('MailQueue',attributes,{'tableName':_0xa4da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 111f45a..ec11a5e 100644 --- a/server/api/mailQueue/mailQueue.rpc.js +++ b/server/api/mailQueue/mailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6be=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','include','model','map','debug','ShowMailQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xd6be,0x1bd));var _0xed6b=function(_0x2e5b7e,_0x4b6d42){_0x2e5b7e=_0x2e5b7e-0x0;var _0x52e89b=_0xd6be[_0x2e5b7e];return _0x52e89b;};'use strict';var _=require(_0xed6b('0x0'));var util=require(_0xed6b('0x1'));var moment=require('moment');var BPromise=require(_0xed6b('0x2'));var rs=require(_0xed6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed6b('0x4'))['db'];var utils=require(_0xed6b('0x5'));var logger=require(_0xed6b('0x6'))(_0xed6b('0x7'));var config=require(_0xed6b('0x8'));var jayson=require(_0xed6b('0x9'));var client=jayson[_0xed6b('0xa')]['http']({'port':0x232a});config['redis']=_[_0xed6b('0xb')](config[_0xed6b('0xc')],{'host':_0xed6b('0xd'),'port':0x18eb});var socket=require(_0xed6b('0xe'))(new Redis(config[_0xed6b('0xc')]));require(_0xed6b('0xf'))[_0xed6b('0x10')](socket);function respondWithRpcPromise(_0xfee9b6,_0x56e11f,_0x43184f){return new BPromise(function(_0xaf6b0d,_0x49f42f){return client[_0xed6b('0x11')](_0xfee9b6,_0x43184f)[_0xed6b('0x12')](function(_0x2bfaeb){logger[_0xed6b('0x13')](_0xed6b('0x14'),_0x56e11f,_0xed6b('0x15'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x56e11f,'request\x20sent',JSON[_0xed6b('0x16')](_0x2bfaeb));if(_0x2bfaeb[_0xed6b('0x17')]){if(_0x2bfaeb[_0xed6b('0x17')][_0xed6b('0x18')]===0x1f4){logger[_0xed6b('0x17')](_0xed6b('0x14'),_0x56e11f,_0x2bfaeb['error'][_0xed6b('0x19')]);return _0x49f42f(_0x2bfaeb[_0xed6b('0x17')][_0xed6b('0x19')]);}logger[_0xed6b('0x17')]('MailQueue,\x20%s,\x20%s',_0x56e11f,_0x2bfaeb[_0xed6b('0x17')]['message']);return _0xaf6b0d(_0x2bfaeb[_0xed6b('0x17')][_0xed6b('0x19')]);}else{logger[_0xed6b('0x13')]('MailQueue,\x20%s,\x20%s',_0x56e11f,_0xed6b('0x15'));_0xaf6b0d(_0x2bfaeb[_0xed6b('0x1a')]['message']);}})[_0xed6b('0x1b')](function(_0x2aae6b){logger['error'](_0xed6b('0x14'),_0x56e11f,_0x2aae6b);_0x49f42f(_0x2aae6b);});});}exports[_0xed6b('0x1c')]=function(_0x3672b1){var _0x20e77e=this;return new Promise(function(_0x329d6d,_0x544a5f){return db[_0xed6b('0x1d')][_0xed6b('0x1e')]({'raw':_0x3672b1[_0xed6b('0x1f')]?_0x3672b1['options'][_0xed6b('0x20')]===undefined?!![]:![]:!![],'where':_0x3672b1['options']?_0x3672b1['options']['where']||null:null,'attributes':_0x3672b1[_0xed6b('0x1f')]?_0x3672b1[_0xed6b('0x1f')][_0xed6b('0x21')]||null:null,'limit':_0x3672b1[_0xed6b('0x1f')]?_0x3672b1[_0xed6b('0x1f')][_0xed6b('0x22')]||null:null,'include':_0x3672b1['options']?_0x3672b1[_0xed6b('0x1f')][_0xed6b('0x23')]?_['map'](_0x3672b1[_0xed6b('0x1f')]['include'],function(_0x4129a0){return{'model':db[_0x4129a0[_0xed6b('0x24')]],'as':_0x4129a0['as'],'attributes':_0x4129a0[_0xed6b('0x21')],'include':_0x4129a0['include']?_[_0xed6b('0x25')](_0x4129a0[_0xed6b('0x23')],function(_0x3933e0){return{'model':db[_0x3933e0['model']],'as':_0x3933e0['as'],'attributes':_0x3933e0[_0xed6b('0x21')],'include':_0x3933e0[_0xed6b('0x23')]?_['map'](_0x3933e0[_0xed6b('0x23')],function(_0x48dfff){return{'model':db[_0x48dfff[_0xed6b('0x24')]],'as':_0x48dfff['as'],'attributes':_0x48dfff[_0xed6b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xed6b('0x12')](function(_0x15a283){logger[_0xed6b('0x13')](_0xed6b('0x1c'),_0x3672b1);logger[_0xed6b('0x26')](_0xed6b('0x1c'),_0x3672b1,JSON[_0xed6b('0x16')](_0x15a283));_0x329d6d(_0x15a283);})[_0xed6b('0x1b')](function(_0x339b1f){logger['error'](_0xed6b('0x1c'),_0x339b1f[_0xed6b('0x19')],_0x3672b1);_0x544a5f(_0x20e77e[_0xed6b('0x17')](0x1f4,_0x339b1f['message']));});});};exports[_0xed6b('0x27')]=function(_0x58ed36){var _0x2a6362=this;return new Promise(function(_0x2dad21,_0x23596c){return db['MailQueue'][_0xed6b('0x28')]({'raw':_0x58ed36['options']?_0x58ed36[_0xed6b('0x1f')][_0xed6b('0x20')]===undefined?!![]:![]:!![],'where':_0x58ed36[_0xed6b('0x1f')]?_0x58ed36[_0xed6b('0x1f')]['where']||null:null,'attributes':_0x58ed36[_0xed6b('0x1f')]?_0x58ed36[_0xed6b('0x1f')][_0xed6b('0x21')]||null:null,'include':_0x58ed36[_0xed6b('0x1f')]?_0x58ed36['options'][_0xed6b('0x23')]?_['map'](_0x58ed36[_0xed6b('0x1f')][_0xed6b('0x23')],function(_0x278655){return{'model':db[_0x278655[_0xed6b('0x24')]],'as':_0x278655['as'],'attributes':_0x278655[_0xed6b('0x21')],'include':_0x278655[_0xed6b('0x23')]?_[_0xed6b('0x25')](_0x278655[_0xed6b('0x23')],function(_0x49614a){return{'model':db[_0x49614a[_0xed6b('0x24')]],'as':_0x49614a['as'],'attributes':_0x49614a[_0xed6b('0x21')],'include':_0x49614a[_0xed6b('0x23')]?_[_0xed6b('0x25')](_0x49614a['include'],function(_0x9022ba){return{'model':db[_0x9022ba[_0xed6b('0x24')]],'as':_0x9022ba['as'],'attributes':_0x9022ba[_0xed6b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xed6b('0x12')](function(_0x465fbb){logger[_0xed6b('0x13')](_0xed6b('0x27'),_0x58ed36);logger[_0xed6b('0x26')]('ShowMailQueue',_0x58ed36,JSON['stringify'](_0x465fbb));_0x2dad21(_0x465fbb);})[_0xed6b('0x1b')](function(_0x49f3c2){logger[_0xed6b('0x17')]('ShowMailQueue',_0x49f3c2[_0xed6b('0x19')],_0x58ed36);_0x23596c(_0x2a6362[_0xed6b('0x17')](0x1f4,_0x49f3c2[_0xed6b('0x19')]));});});}; \ No newline at end of file +var _0xf9b6=['../../config/utils','../../config/logger','rpc','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','map','include','model','ShowMailQueue','find','util','moment','randomstring','../../mysqldb'];(function(_0x45cc2f,_0x3483f6){var _0x355d77=function(_0x5d170b){while(--_0x5d170b){_0x45cc2f['push'](_0x45cc2f['shift']());}};_0x355d77(++_0x3483f6);}(_0xf9b6,0x114));var _0x6f9b=function(_0x1b6d49,_0x4f4d35){_0x1b6d49=_0x1b6d49-0x0;var _0xaeb1ec=_0xf9b6[_0x1b6d49];return _0xaeb1ec;};'use strict';var _=require('lodash');var util=require(_0x6f9b('0x0'));var moment=require(_0x6f9b('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f9b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f9b('0x3'))['db'];var utils=require(_0x6f9b('0x4'));var logger=require(_0x6f9b('0x5'))(_0x6f9b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6f9b('0x7')](config['redis'],{'host':_0x6f9b('0x8'),'port':0x18eb});var socket=require(_0x6f9b('0x9'))(new Redis(config[_0x6f9b('0xa')]));require(_0x6f9b('0xb'))['register'](socket);function respondWithRpcPromise(_0x511174,_0x237dd9,_0x337bba){return new BPromise(function(_0x1450ff,_0x38903e){return client['request'](_0x511174,_0x337bba)[_0x6f9b('0xc')](function(_0xd85e13){logger[_0x6f9b('0xd')]('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x6f9b('0xe'));logger[_0x6f9b('0xf')](_0x6f9b('0x10'),_0x237dd9,_0x6f9b('0xe'),JSON[_0x6f9b('0x11')](_0xd85e13));if(_0xd85e13['error']){if(_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x13')]===0x1f4){logger[_0x6f9b('0x12')](_0x6f9b('0x14'),_0x237dd9,_0xd85e13['error'][_0x6f9b('0x15')]);return _0x38903e(_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x15')]);}logger[_0x6f9b('0x12')](_0x6f9b('0x14'),_0x237dd9,_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x15')]);return _0x1450ff(_0xd85e13[_0x6f9b('0x12')]['message']);}else{logger[_0x6f9b('0xd')]('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x6f9b('0xe'));_0x1450ff(_0xd85e13[_0x6f9b('0x16')][_0x6f9b('0x15')]);}})[_0x6f9b('0x17')](function(_0x2d1bf3){logger['error']('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x2d1bf3);_0x38903e(_0x2d1bf3);});});}exports[_0x6f9b('0x18')]=function(_0x3ae9ea){var _0x3df88c=this;return new Promise(function(_0x3037d8,_0x323807){return db[_0x6f9b('0x19')][_0x6f9b('0x1a')]({'raw':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['where']||null:null,'attributes':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1d')]||null:null,'limit':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['limit']||null:null,'include':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['include']?_[_0x6f9b('0x1e')](_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1f')],function(_0x308a35){return{'model':db[_0x308a35[_0x6f9b('0x20')]],'as':_0x308a35['as'],'attributes':_0x308a35[_0x6f9b('0x1d')],'include':_0x308a35[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x308a35[_0x6f9b('0x1f')],function(_0x6e163a){return{'model':db[_0x6e163a[_0x6f9b('0x20')]],'as':_0x6e163a['as'],'attributes':_0x6e163a['attributes'],'include':_0x6e163a[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x6e163a[_0x6f9b('0x1f')],function(_0x51b667){return{'model':db[_0x51b667['model']],'as':_0x51b667['as'],'attributes':_0x51b667[_0x6f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f9b('0xc')](function(_0x22ddfc){logger['info'](_0x6f9b('0x18'),_0x3ae9ea);logger[_0x6f9b('0xf')]('GetMailQueue',_0x3ae9ea,JSON['stringify'](_0x22ddfc));_0x3037d8(_0x22ddfc);})[_0x6f9b('0x17')](function(_0x23df54){logger[_0x6f9b('0x12')]('GetMailQueue',_0x23df54[_0x6f9b('0x15')],_0x3ae9ea);_0x323807(_0x3df88c[_0x6f9b('0x12')](0x1f4,_0x23df54[_0x6f9b('0x15')]));});});};exports[_0x6f9b('0x21')]=function(_0x460227){var _0x2470e1=this;return new Promise(function(_0x3a8f17,_0x2c98fa){return db[_0x6f9b('0x19')][_0x6f9b('0x22')]({'raw':_0x460227['options']?_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x460227[_0x6f9b('0x1b')]?_0x460227[_0x6f9b('0x1b')]['where']||null:null,'attributes':_0x460227[_0x6f9b('0x1b')]?_0x460227[_0x6f9b('0x1b')]['attributes']||null:null,'include':_0x460227['options']?_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1f')]?_['map'](_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1f')],function(_0x1cb962){return{'model':db[_0x1cb962['model']],'as':_0x1cb962['as'],'attributes':_0x1cb962[_0x6f9b('0x1d')],'include':_0x1cb962['include']?_[_0x6f9b('0x1e')](_0x1cb962[_0x6f9b('0x1f')],function(_0x3d46e8){return{'model':db[_0x3d46e8[_0x6f9b('0x20')]],'as':_0x3d46e8['as'],'attributes':_0x3d46e8['attributes'],'include':_0x3d46e8[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x3d46e8['include'],function(_0x3b370f){return{'model':db[_0x3b370f[_0x6f9b('0x20')]],'as':_0x3b370f['as'],'attributes':_0x3b370f[_0x6f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f9b('0xc')](function(_0x23be72){logger['info']('ShowMailQueue',_0x460227);logger['debug']('ShowMailQueue',_0x460227,JSON[_0x6f9b('0x11')](_0x23be72));_0x3a8f17(_0x23be72);})[_0x6f9b('0x17')](function(_0x102961){logger[_0x6f9b('0x12')](_0x6f9b('0x21'),_0x102961[_0x6f9b('0x15')],_0x460227);_0x2c98fa(_0x2470e1[_0x6f9b('0x12')](0x1f4,_0x102961[_0x6f9b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6ad7e01..7eb878a 100644 --- a/server/api/mailQueue/mailQueue.socket.js +++ b/server/api/mailQueue/mailQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35ff=['remove','emit','removeListener','register','mailQueue:','save'];(function(_0x2f2dae,_0x5444b7){var _0xe1ab5f=function(_0x214ecd){while(--_0x214ecd){_0x2f2dae['push'](_0x2f2dae['shift']());}};_0xe1ab5f(++_0x5444b7);}(_0x35ff,0xb3));var _0xf35f=function(_0x4659f6,_0x37cb0b){_0x4659f6=_0x4659f6-0x0;var _0x4146ff=_0x35ff[_0x4659f6];return _0x4146ff;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xf35f('0x0'),_0xf35f('0x1'),'update'];function createListener(_0x256faa,_0x1c6b46){return function(_0x5f5d5f){_0x1c6b46[_0xf35f('0x2')](_0x256faa,_0x5f5d5f);};}function removeListener(_0x481b60,_0x3ce173){return function(){MailQueueEvents[_0xf35f('0x3')](_0x481b60,_0x3ce173);};}exports[_0xf35f('0x4')]=function(_0x1f9847){for(var _0x1821a6=0x0,_0x4321e9=events['length'];_0x1821a6<_0x4321e9;_0x1821a6++){var _0x3e3aaa=events[_0x1821a6];var _0x1922af=createListener(_0xf35f('0x5')+_0x3e3aaa,_0x1f9847);MailQueueEvents['on'](_0x3e3aaa,_0x1922af);}}; \ No newline at end of file +var _0xedd8=['removeListener','register','length','./mailQueue.events','save','remove','update'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xedd8,0xb2));var _0x8edd=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xedd8[_0xccf869];return _0x21a9db;};'use strict';var MailQueueEvents=require(_0x8edd('0x0'));var events=[_0x8edd('0x1'),_0x8edd('0x2'),_0x8edd('0x3')];function createListener(_0x1fdaf0,_0x54a8bc){return function(_0x136ea0){_0x54a8bc['emit'](_0x1fdaf0,_0x136ea0);};}function removeListener(_0x240a71,_0x25050e){return function(){MailQueueEvents[_0x8edd('0x4')](_0x240a71,_0x25050e);};}exports[_0x8edd('0x5')]=function(_0x752e5){for(var _0x2a921d=0x0,_0x47f073=events[_0x8edd('0x6')];_0x2a921d<_0x47f073;_0x2a921d++){var _0x2f6597=events[_0x2a921d];var _0x3dd377=createListener('mailQueue:'+_0x2f6597,_0x752e5);MailQueueEvents['on'](_0x2f6597,_0x3dd377);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 2fafc87..e9fc7f1 100644 --- a/server/api/mailQueueReport/index.js +++ b/server/api/mailQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11d4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','path','express','Router'];(function(_0x2a3bb5,_0x1199a0){var _0x6ec9fd=function(_0x360f9a){while(--_0x360f9a){_0x2a3bb5['push'](_0x2a3bb5['shift']());}};_0x6ec9fd(++_0x1199a0);}(_0x11d4,0xe1));var _0x411d=function(_0xd44053,_0x32a2e9){_0xd44053=_0xd44053-0x0;var _0x248e7a=_0x11d4[_0xd44053];return _0x248e7a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x411d('0x0'));var timeout=require('connect-timeout');var express=require(_0x411d('0x1'));var router=express[_0x411d('0x2')]();var fs_extra=require(_0x411d('0x3'));var auth=require(_0x411d('0x4'));var interaction=require(_0x411d('0x5'));var config=require(_0x411d('0x6'));var controller=require('./mailQueueReport.controller');router[_0x411d('0x7')]('/',auth[_0x411d('0x8')](),controller[_0x411d('0x9')]);router[_0x411d('0x7')](_0x411d('0xa'),auth[_0x411d('0x8')](),controller[_0x411d('0xb')]);router[_0x411d('0x7')](_0x411d('0xc'),auth[_0x411d('0x8')](),controller[_0x411d('0xd')]);router['post']('/',auth[_0x411d('0x8')](),controller[_0x411d('0xe')]);router[_0x411d('0xf')](_0x411d('0xc'),auth[_0x411d('0x8')](),controller[_0x411d('0x10')]);router[_0x411d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x411d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf862=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','put','update','delete','destroy','multer'];(function(_0xa4b8e1,_0x49d30b){var _0x507e42=function(_0xca2abc){while(--_0xca2abc){_0xa4b8e1['push'](_0xa4b8e1['shift']());}};_0x507e42(++_0x49d30b);}(_0xf862,0x10f));var _0x2f86=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0xf862[_0x671369];return _0x33f2b4;};'use strict';var multer=require(_0x2f86('0x0'));var util=require(_0x2f86('0x1'));var path=require(_0x2f86('0x2'));var timeout=require(_0x2f86('0x3'));var express=require('express');var router=express[_0x2f86('0x4')]();var fs_extra=require(_0x2f86('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2f86('0x6'));var config=require(_0x2f86('0x7'));var controller=require('./mailQueueReport.controller');router[_0x2f86('0x8')]('/',auth[_0x2f86('0x9')](),controller[_0x2f86('0xa')]);router['get']('/describe',auth[_0x2f86('0x9')](),controller['describe']);router['get'](_0x2f86('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2f86('0x9')](),controller['create']);router[_0x2f86('0xc')](_0x2f86('0xb'),auth['isAuthenticated'](),controller[_0x2f86('0xd')]);router[_0x2f86('0xe')](_0x2f86('0xb'),auth['isAuthenticated'](),controller[_0x2f86('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2bcfa55..1564711 100644 --- a/server/api/mailQueueReport/mailQueueReport.attributes.js +++ b/server/api/mailQueueReport/mailQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f54=['sequelize','exports','STRING','DATE'];(function(_0x543fb3,_0x2df21d){var _0x460e40=function(_0x3500dc){while(--_0x3500dc){_0x543fb3['push'](_0x543fb3['shift']());}};_0x460e40(++_0x2df21d);}(_0x3f54,0x68));var _0x43f5=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x3f54[_0x21f3bf];return _0x249d08;};'use strict';var moment=require('moment');var Sequelize=require(_0x43f5('0x0'));module[_0x43f5('0x1')]={'uniqueid':{'type':Sequelize[_0x43f5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x43f5('0x2')]},'joinAt':{'type':Sequelize[_0x43f5('0x3')]},'leaveAt':{'type':Sequelize[_0x43f5('0x3')]},'acceptAt':{'type':Sequelize[_0x43f5('0x3')]},'exitAt':{'type':Sequelize[_0x43f5('0x3')]},'reason':{'type':Sequelize[_0x43f5('0x2')]}}; \ No newline at end of file +var _0x35dc=['DATE','moment','exports','STRING'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x35dc,0x1cd));var _0xc35d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x35dc[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xc35d('0x0'));var Sequelize=require('sequelize');module[_0xc35d('0x1')]={'uniqueid':{'type':Sequelize[_0xc35d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc35d('0x3')]},'acceptAt':{'type':Sequelize[_0xc35d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index fba959a..6f09e77 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a6d=['keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','type','options','includeAll','rows','catch','params','rawAttributes','merge','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','then','error','stack','name','send','index','map','MailQueueReport','fieldName','key','query'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x3a6d[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a6('0x15'));var logger=require(_0xd3a6('0x16'))(_0xd3a6('0x17'));var utils=require(_0xd3a6('0x18'));var config=require(_0xd3a6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0467,_0x1c6ad7){_0x1c6ad7=_0x1c6ad7||0xcc;return function(_0x671004){if(_0x671004){return _0x4b0467[_0xd3a6('0x1a')](_0x1c6ad7);}return _0x4b0467[_0xd3a6('0x1b')](_0x1c6ad7)[_0xd3a6('0x1c')]();};}function respondWithResult(_0x2911a0,_0xa56452){_0xa56452=_0xa56452||0xc8;return function(_0x4e67fb){if(_0x4e67fb){return _0x2911a0[_0xd3a6('0x1b')](_0xa56452)[_0xd3a6('0x1d')](_0x4e67fb);}};}function respondWithFilteredResult(_0x171a8f,_0x500a37){return function(_0x3c2399){if(_0x3c2399){var _0x305b61=typeof _0x500a37[_0xd3a6('0x1e')]==='undefined'&&typeof _0x500a37[_0xd3a6('0x1f')]==='undefined';var _0x518b6d=_0x3c2399[_0xd3a6('0x20')];var _0x8d1286=_0x305b61?0x0:_0x500a37[_0xd3a6('0x1e')];var _0xbe58b4=_0x305b61?_0x3c2399[_0xd3a6('0x20')]:_0x500a37[_0xd3a6('0x1e')]+_0x500a37[_0xd3a6('0x1f')];var _0x4ec27c;if(_0xbe58b4>=_0x518b6d){_0xbe58b4=_0x518b6d;_0x4ec27c=0xc8;}else{_0x4ec27c=0xce;}_0x171a8f[_0xd3a6('0x1b')](_0x4ec27c);return _0x171a8f['set'](_0xd3a6('0x21'),_0x8d1286+'-'+_0xbe58b4+'/'+_0x518b6d)[_0xd3a6('0x1d')](_0x3c2399);}return null;};}function patchUpdates(_0x12f2c1){return function(_0x20a34e){try{jsonpatch[_0xd3a6('0x22')](_0x20a34e,_0x12f2c1,!![]);}catch(_0x6ecd88){return BPromise['reject'](_0x6ecd88);}return _0x20a34e[_0xd3a6('0x23')]();};}function saveUpdates(_0x422f5c,_0x57cf15){return function(_0x543a6a){if(_0x543a6a){return _0x543a6a['update'](_0x422f5c)['then'](function(_0x5c9075){return _0x5c9075;});}return null;};}function removeEntity(_0x98a12a,_0x400982){return function(_0x3d0b28){if(_0x3d0b28){return _0x3d0b28['destroy']()[_0xd3a6('0x24')](function(){_0x98a12a['status'](0xcc)[_0xd3a6('0x1c')]();});}};}function handleEntityNotFound(_0x16afc8,_0x429079){return function(_0x4f6130){if(!_0x4f6130){_0x16afc8[_0xd3a6('0x1a')](0x194);}return _0x4f6130;};}function handleError(_0x3bc8d1,_0x1b09ac){_0x1b09ac=_0x1b09ac||0x1f4;return function(_0x219e32){logger[_0xd3a6('0x25')](_0x219e32[_0xd3a6('0x26')]);if(_0x219e32['name']){delete _0x219e32[_0xd3a6('0x27')];}_0x3bc8d1[_0xd3a6('0x1b')](_0x1b09ac)[_0xd3a6('0x28')](_0x219e32);};}exports[_0xd3a6('0x29')]=function(_0x30abc2,_0x45c628){var _0x5c2186={},_0x535bd4={},_0x1f4859={'count':0x0,'rows':[]};var _0x210aa1=_[_0xd3a6('0x2a')](db[_0xd3a6('0x2b')]['rawAttributes'],function(_0x3de3bb){return{'name':_0x3de3bb[_0xd3a6('0x2c')],'type':_0x3de3bb['type'][_0xd3a6('0x2d')]};});_0x535bd4['model']=_[_0xd3a6('0x2a')](_0x210aa1,_0xd3a6('0x27'));_0x535bd4[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x30abc2[_0xd3a6('0x2e')]);_0x535bd4[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x535bd4['model'],_0x535bd4['query']);_0x5c2186[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x535bd4[_0xd3a6('0x33')],qs['fields'](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x5c2186[_0xd3a6('0x32')]=_0x5c2186[_0xd3a6('0x32')][_0xd3a6('0x35')]?_0x5c2186[_0xd3a6('0x32')]:_0x535bd4[_0xd3a6('0x33')];if(!_0x30abc2[_0xd3a6('0x2e')]['hasOwnProperty'](_0xd3a6('0x36'))){_0x5c2186[_0xd3a6('0x1f')]=qs[_0xd3a6('0x1f')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x1f')]);_0x5c2186[_0xd3a6('0x1e')]=qs['offset'](_0x30abc2[_0xd3a6('0x2e')]['offset']);}_0x5c2186[_0xd3a6('0x37')]=qs[_0xd3a6('0x38')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x38')]);_0x5c2186['where']=qs['filters'](_[_0xd3a6('0x39')](_0x30abc2[_0xd3a6('0x2e')],_0x535bd4[_0xd3a6('0x30')]),_0x210aa1);if(_0x30abc2['query'][_0xd3a6('0x3a')]){_0x5c2186[_0xd3a6('0x3b')]=_['merge'](_0x5c2186[_0xd3a6('0x3b')],{'$or':_['map'](_0x210aa1,function(_0x1e695a){if(_0x1e695a[_0xd3a6('0x3c')]!=='VIRTUAL'){var _0x219ba5={};_0x219ba5[_0x1e695a['name']]={'$like':'%'+_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3a')]+'%'};return _0x219ba5;}})});}_0x5c2186=_['merge']({},_0x5c2186,_0x30abc2[_0xd3a6('0x3d')]);var _0xfcef03={'where':_0x5c2186[_0xd3a6('0x3b')]};return db[_0xd3a6('0x2b')]['count'](_0xfcef03)[_0xd3a6('0x24')](function(_0x324dbd){_0x1f4859[_0xd3a6('0x20')]=_0x324dbd;if(_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x5c2186['include']=[{'all':!![]}];}return db[_0xd3a6('0x2b')]['findAll'](_0x5c2186);})[_0xd3a6('0x24')](function(_0x1bc18a){_0x1f4859[_0xd3a6('0x3f')]=_0x1bc18a;return _0x1f4859;})['then'](respondWithFilteredResult(_0x45c628,_0x5c2186))[_0xd3a6('0x40')](handleError(_0x45c628,null));};exports['show']=function(_0x23aa99,_0x4cbf76){var _0x448213={'raw':!![],'where':{'id':_0x23aa99[_0xd3a6('0x41')]['id']}},_0x629153={};_0x629153[_0xd3a6('0x33')]=_[_0xd3a6('0x2f')](db[_0xd3a6('0x2b')][_0xd3a6('0x42')]);_0x629153['query']=_[_0xd3a6('0x2f')](_0x23aa99[_0xd3a6('0x2e')]);_0x629153[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x629153['model'],_0x629153[_0xd3a6('0x2e')]);_0x448213[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x629153[_0xd3a6('0x33')],qs[_0xd3a6('0x34')](_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x448213[_0xd3a6('0x32')]=_0x448213['attributes'][_0xd3a6('0x35')]?_0x448213[_0xd3a6('0x32')]:_0x629153[_0xd3a6('0x33')];if(_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x448213['include']=[{'all':!![]}];}_0x448213=_[_0xd3a6('0x43')]({},_0x448213,_0x23aa99[_0xd3a6('0x3d')]);return db[_0xd3a6('0x2b')][_0xd3a6('0x44')](_0x448213)[_0xd3a6('0x24')](handleEntityNotFound(_0x4cbf76,null))[_0xd3a6('0x24')](respondWithResult(_0x4cbf76,null))[_0xd3a6('0x40')](handleError(_0x4cbf76,null));};exports[_0xd3a6('0x45')]=function(_0x4ac576,_0x7828c2){return db['MailQueueReport'][_0xd3a6('0x45')](_0x4ac576[_0xd3a6('0x46')],{})['then'](respondWithResult(_0x7828c2,0xc9))[_0xd3a6('0x40')](handleError(_0x7828c2,null));};exports[_0xd3a6('0x47')]=function(_0x3cf99a,_0x375067){if(_0x3cf99a[_0xd3a6('0x46')]['id']){delete _0x3cf99a[_0xd3a6('0x46')]['id'];}return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x3cf99a[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x375067,null))['then'](saveUpdates(_0x3cf99a[_0xd3a6('0x46')],null))[_0xd3a6('0x24')](respondWithResult(_0x375067,null))[_0xd3a6('0x40')](handleError(_0x375067,null));};exports[_0xd3a6('0x48')]=function(_0x26bd65,_0x225393){return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x26bd65[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x225393,null))['then'](removeEntity(_0x225393,null))[_0xd3a6('0x40')](handleError(_0x225393,null));};exports[_0xd3a6('0x49')]=function(_0x618b72,_0x4995b7){return db[_0xd3a6('0x2b')]['describe']()['then'](respondWithResult(_0x4995b7,null))['catch'](handleError(_0x4995b7,null));}; \ No newline at end of file +var _0x7bd0=['model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','MailQueueReport','findAll','rows','show','keys','length','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x127862,_0x5cb3d1){var _0x5a5207=function(_0x174e9b){while(--_0x174e9b){_0x127862['push'](_0x127862['shift']());}};_0x5a5207(++_0x5cb3d1);}(_0x7bd0,0x111));var _0x07bd=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x7bd0[_0x55a89e];return _0x3aa2bd;};'use strict';var emlformat=require(_0x07bd('0x0'));var rimraf=require(_0x07bd('0x1'));var zipdir=require(_0x07bd('0x2'));var jsonpatch=require(_0x07bd('0x3'));var rp=require(_0x07bd('0x4'));var moment=require(_0x07bd('0x5'));var BPromise=require(_0x07bd('0x6'));var Mustache=require(_0x07bd('0x7'));var util=require('util');var path=require(_0x07bd('0x8'));var sox=require(_0x07bd('0x9'));var csv=require(_0x07bd('0xa'));var ejs=require(_0x07bd('0xb'));var fs=require('fs');var fs_extra=require(_0x07bd('0xc'));var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xa'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var licenseUtil=require(_0x07bd('0x19'));var db=require(_0x07bd('0x1a'))['db'];function respondWithStatusCode(_0x1eff6c,_0x10aa2e){_0x10aa2e=_0x10aa2e||0xcc;return function(_0x2b8409){if(_0x2b8409){return _0x1eff6c['sendStatus'](_0x10aa2e);}return _0x1eff6c['status'](_0x10aa2e)[_0x07bd('0x1b')]();};}function respondWithResult(_0x3fe523,_0x1c59c2){_0x1c59c2=_0x1c59c2||0xc8;return function(_0x247f3f){if(_0x247f3f){return _0x3fe523[_0x07bd('0x1c')](_0x1c59c2)[_0x07bd('0x1d')](_0x247f3f);}};}function respondWithFilteredResult(_0x2c9166,_0x49d962){return function(_0x418444){if(_0x418444){var _0x505839=typeof _0x49d962[_0x07bd('0x1e')]===_0x07bd('0x1f')&&typeof _0x49d962[_0x07bd('0x20')]===_0x07bd('0x1f');var _0x8aa645=_0x418444['count'];var _0x3f9f0b=_0x505839?0x0:_0x49d962[_0x07bd('0x1e')];var _0x4948f4=_0x505839?_0x418444[_0x07bd('0x21')]:_0x49d962[_0x07bd('0x1e')]+_0x49d962[_0x07bd('0x20')];var _0x2fcc59;if(_0x4948f4>=_0x8aa645){_0x4948f4=_0x8aa645;_0x2fcc59=0xc8;}else{_0x2fcc59=0xce;}_0x2c9166[_0x07bd('0x1c')](_0x2fcc59);return _0x2c9166[_0x07bd('0x22')](_0x07bd('0x23'),_0x3f9f0b+'-'+_0x4948f4+'/'+_0x8aa645)[_0x07bd('0x1d')](_0x418444);}return null;};}function patchUpdates(_0x29a52e){return function(_0x50109f){try{jsonpatch[_0x07bd('0x24')](_0x50109f,_0x29a52e,!![]);}catch(_0x227807){return BPromise[_0x07bd('0x25')](_0x227807);}return _0x50109f[_0x07bd('0x26')]();};}function saveUpdates(_0x16d0e6,_0x47bd50){return function(_0x4c673a){if(_0x4c673a){return _0x4c673a[_0x07bd('0x27')](_0x16d0e6)['then'](function(_0x2b0dee){return _0x2b0dee;});}return null;};}function removeEntity(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(_0x4165bc){return _0x4165bc[_0x07bd('0x28')]()[_0x07bd('0x29')](function(){_0x480c9c[_0x07bd('0x1c')](0xcc)[_0x07bd('0x1b')]();});}};}function handleEntityNotFound(_0x43cbc8,_0x557042){return function(_0x180b43){if(!_0x180b43){_0x43cbc8[_0x07bd('0x2a')](0x194);}return _0x180b43;};}function handleError(_0x3db9d0,_0x2a7202){_0x2a7202=_0x2a7202||0x1f4;return function(_0x12ce26){logger[_0x07bd('0x2b')](_0x12ce26['stack']);if(_0x12ce26['name']){delete _0x12ce26['name'];}_0x3db9d0[_0x07bd('0x1c')](_0x2a7202)[_0x07bd('0x2c')](_0x12ce26);};}exports[_0x07bd('0x2d')]=function(_0x51efa8,_0x1a3aa9){var _0x400cc0={},_0x253dc0={},_0x46ed12={'count':0x0,'rows':[]};var _0x3f9424=_[_0x07bd('0x2e')](db['MailQueueReport'][_0x07bd('0x2f')],function(_0x20cc94){return{'name':_0x20cc94[_0x07bd('0x30')],'type':_0x20cc94[_0x07bd('0x31')][_0x07bd('0x32')]};});_0x253dc0[_0x07bd('0x33')]=_[_0x07bd('0x2e')](_0x3f9424,_0x07bd('0x34'));_0x253dc0['query']=_['keys'](_0x51efa8[_0x07bd('0x35')]);_0x253dc0[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x253dc0['model'],_0x253dc0[_0x07bd('0x35')]);_0x400cc0[_0x07bd('0x38')]=_[_0x07bd('0x37')](_0x253dc0['model'],qs['fields'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x39')]));_0x400cc0[_0x07bd('0x38')]=_0x400cc0[_0x07bd('0x38')]['length']?_0x400cc0[_0x07bd('0x38')]:_0x253dc0[_0x07bd('0x33')];if(!_0x51efa8[_0x07bd('0x35')]['hasOwnProperty'](_0x07bd('0x3a'))){_0x400cc0[_0x07bd('0x20')]=qs['limit'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x20')]);_0x400cc0[_0x07bd('0x1e')]=qs[_0x07bd('0x1e')](_0x51efa8['query']['offset']);}_0x400cc0[_0x07bd('0x3b')]=qs['sort'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3c')]);_0x400cc0[_0x07bd('0x3d')]=qs[_0x07bd('0x36')](_[_0x07bd('0x3e')](_0x51efa8[_0x07bd('0x35')],_0x253dc0[_0x07bd('0x36')]),_0x3f9424);if(_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3f')]){_0x400cc0[_0x07bd('0x3d')]=_[_0x07bd('0x40')](_0x400cc0[_0x07bd('0x3d')],{'$or':_[_0x07bd('0x2e')](_0x3f9424,function(_0x51e8e2){if(_0x51e8e2[_0x07bd('0x31')]!==_0x07bd('0x41')){var _0x220a8e={};_0x220a8e[_0x51e8e2[_0x07bd('0x34')]]={'$like':'%'+_0x51efa8['query'][_0x07bd('0x3f')]+'%'};return _0x220a8e;}})});}_0x400cc0=_[_0x07bd('0x40')]({},_0x400cc0,_0x51efa8[_0x07bd('0x42')]);var _0x408a0a={'where':_0x400cc0[_0x07bd('0x3d')]};return db['MailQueueReport']['count'](_0x408a0a)[_0x07bd('0x29')](function(_0x88e174){_0x46ed12[_0x07bd('0x21')]=_0x88e174;if(_0x51efa8[_0x07bd('0x35')]['includeAll']){_0x400cc0[_0x07bd('0x43')]=[{'all':!![]}];}return db[_0x07bd('0x44')][_0x07bd('0x45')](_0x400cc0);})[_0x07bd('0x29')](function(_0x318b7c){_0x46ed12[_0x07bd('0x46')]=_0x318b7c;return _0x46ed12;})[_0x07bd('0x29')](respondWithFilteredResult(_0x1a3aa9,_0x400cc0))['catch'](handleError(_0x1a3aa9,null));};exports[_0x07bd('0x47')]=function(_0x7b1042,_0x33389b){var _0x3a5827={'raw':!![],'where':{'id':_0x7b1042['params']['id']}},_0x418f26={};_0x418f26[_0x07bd('0x33')]=_[_0x07bd('0x48')](db[_0x07bd('0x44')][_0x07bd('0x2f')]);_0x418f26[_0x07bd('0x35')]=_['keys'](_0x7b1042[_0x07bd('0x35')]);_0x418f26[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],_0x418f26['query']);_0x3a5827['attributes']=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],qs[_0x07bd('0x39')](_0x7b1042[_0x07bd('0x35')][_0x07bd('0x39')]));_0x3a5827[_0x07bd('0x38')]=_0x3a5827[_0x07bd('0x38')][_0x07bd('0x49')]?_0x3a5827[_0x07bd('0x38')]:_0x418f26['model'];if(_0x7b1042['query'][_0x07bd('0x4a')]){_0x3a5827[_0x07bd('0x43')]=[{'all':!![]}];}_0x3a5827=_[_0x07bd('0x40')]({},_0x3a5827,_0x7b1042[_0x07bd('0x42')]);return db[_0x07bd('0x44')][_0x07bd('0x4b')](_0x3a5827)['then'](handleEntityNotFound(_0x33389b,null))[_0x07bd('0x29')](respondWithResult(_0x33389b,null))[_0x07bd('0x4c')](handleError(_0x33389b,null));};exports[_0x07bd('0x4d')]=function(_0x39823e,_0x7755e2){return db[_0x07bd('0x44')]['create'](_0x39823e[_0x07bd('0x4e')],{})[_0x07bd('0x29')](respondWithResult(_0x7755e2,0xc9))[_0x07bd('0x4c')](handleError(_0x7755e2,null));};exports[_0x07bd('0x27')]=function(_0x1d05ad,_0xc96a7d){if(_0x1d05ad[_0x07bd('0x4e')]['id']){delete _0x1d05ad[_0x07bd('0x4e')]['id'];}return db[_0x07bd('0x44')][_0x07bd('0x4b')]({'where':{'id':_0x1d05ad[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0xc96a7d,null))['then'](saveUpdates(_0x1d05ad[_0x07bd('0x4e')],null))[_0x07bd('0x29')](respondWithResult(_0xc96a7d,null))[_0x07bd('0x4c')](handleError(_0xc96a7d,null));};exports['destroy']=function(_0x51c9f4,_0x1e7a6e){return db['MailQueueReport'][_0x07bd('0x4b')]({'where':{'id':_0x51c9f4[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0x1e7a6e,null))[_0x07bd('0x29')](removeEntity(_0x1e7a6e,null))[_0x07bd('0x4c')](handleError(_0x1e7a6e,null));};exports[_0x07bd('0x50')]=function(_0x2cadbb,_0x157eb4){return db['MailQueueReport'][_0x07bd('0x50')]()[_0x07bd('0x29')](respondWithResult(_0x157eb4,null))[_0x07bd('0x4c')](handleError(_0x157eb4,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 639ab34..1ccc2b6 100644 --- a/server/api/mailQueueReport/mailQueueReport.model.js +++ b/server/api/mailQueueReport/mailQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0565=['bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment'];(function(_0x44b7c2,_0x34a783){var _0x46078b=function(_0x4b2a76){while(--_0x4b2a76){_0x44b7c2['push'](_0x44b7c2['shift']());}};_0x46078b(++_0x34a783);}(_0x0565,0x1e6));var _0x5056=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x0565[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x5056('0x0'));var logger=require(_0x5056('0x1'))(_0x5056('0x2'));var moment=require(_0x5056('0x3'));var BPromise=require(_0x5056('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5056('0x5'));var rimraf=require(_0x5056('0x6'));var config=require(_0x5056('0x7'));var attributes=require(_0x5056('0x8'));module[_0x5056('0x9')]=function(_0x3ec196,_0x56051c){return _0x3ec196[_0x5056('0xa')](_0x5056('0xb'),attributes,{'tableName':_0x5056('0xc'),'paranoid':![],'indexes':[{'name':_0x5056('0xd'),'fields':[_0x5056('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe26a=['api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe26a,0x185));var _0xae26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe26a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xae26('0x0'));var util=require(_0xae26('0x1'));var logger=require(_0xae26('0x2'))(_0xae26('0x3'));var moment=require(_0xae26('0x4'));var BPromise=require(_0xae26('0x5'));var rp=require(_0xae26('0x6'));var fs=require('fs');var path=require(_0xae26('0x7'));var rimraf=require('rimraf');var config=require(_0xae26('0x8'));var attributes=require(_0xae26('0x9'));module['exports']=function(_0x2d3fc1,_0x959798){return _0x2d3fc1[_0xae26('0xa')](_0xae26('0xb'),attributes,{'tableName':_0xae26('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xae26('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8b112f7..086a422 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2f78d4,_0x402766){var _0x48299d=function(_0x1938de){while(--_0x1938de){_0x2f78d4['push'](_0x2f78d4['shift']());}};_0x48299d(++_0x402766);}(_0xadb5,0xad));var _0x5adb=function(_0x391ed7,_0x2cd593){_0x391ed7=_0x391ed7-0x0;var _0x3040c8=_0xadb5[_0x391ed7];return _0x3040c8;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x51e7e7,_0x12e4e5){var _0x3ef3c0=function(_0x423c5f){while(--_0x423c5f){_0x51e7e7['push'](_0x51e7e7['shift']());}};_0x3ef3c0(++_0x12e4e5);}(_0x1261,0x144));var _0x1126=function(_0x46b8aa,_0x246d21){_0x46b8aa=_0x46b8aa-0x0;var _0x5a3d61=_0x1261[_0x46b8aa];return _0x5a3d61;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 562b7c5..a8202a1 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x35d4fa,_0x5ece58){var _0xece0ba=function(_0x59278c){while(--_0x59278c){_0x35d4fa['push'](_0x35d4fa['shift']());}};_0xece0ba(++_0x5ece58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 5b7b708..dafee86 100644 --- a/server/api/mailServerIn/mailServerIn.attributes.js +++ b/server/api/mailServerIn/mailServerIn.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d19=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x13b70f,_0x5c1116){var _0x51427c=function(_0x54bb0b){while(--_0x54bb0b){_0x13b70f['push'](_0x13b70f['shift']());}};_0x51427c(++_0x5c1116);}(_0x7d19,0xce));var _0x97d1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7d19[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x97d1('0x0'));module['exports']={'description':{'type':Sequelize[_0x97d1('0x1')]},'host':{'type':Sequelize[_0x97d1('0x1')]},'authentication':{'type':Sequelize[_0x97d1('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x97d1('0x1')]},'password':{'type':Sequelize[_0x97d1('0x1')]},'port':{'type':Sequelize[_0x97d1('0x3')]},'tls':{'type':Sequelize[_0x97d1('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x97d1('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x97d1('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x97d1('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x97d1('0x1')]},'modernAuthentication':{'type':Sequelize[_0x97d1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc5b9=['INTEGER','INBOX','STRING','BOOLEAN'];(function(_0x11c750,_0x474fb1){var _0x38e162=function(_0x2863af){while(--_0x2863af){_0x11c750['push'](_0x11c750['shift']());}};_0x38e162(++_0x474fb1);}(_0xc5b9,0x16a));var _0x9c5b=function(_0x317d4e,_0x3de942){_0x317d4e=_0x317d4e-0x0;var _0x56ce3d=_0xc5b9[_0x317d4e];return _0x56ce3d;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9c5b('0x0')]},'authentication':{'type':Sequelize[_0x9c5b('0x1')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9c5b('0x0')]},'port':{'type':Sequelize[_0x9c5b('0x2')]},'tls':{'type':Sequelize[_0x9c5b('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x9c5b('0x3')},'connTimeout':{'type':Sequelize[_0x9c5b('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9c5b('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9c5b('0x0')]},'modernAuthentication':{'type':Sequelize[_0x9c5b('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 48c7020..8f22ee5 100644 --- a/server/api/mailServerIn/mailServerIn.model.js +++ b/server/api/mailServerIn/mailServerIn.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5379=['./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x595a29,_0x4394a3){var _0x1d5ce7=function(_0x26d330){while(--_0x26d330){_0x595a29['push'](_0x595a29['shift']());}};_0x1d5ce7(++_0x4394a3);}(_0x5379,0x162));var _0x9537=function(_0x440e47,_0x50aa9d){_0x440e47=_0x440e47-0x0;var _0x2ecd45=_0x5379[_0x440e47];return _0x2ecd45;};'use strict';var _=require(_0x9537('0x0'));var util=require('util');var logger=require(_0x9537('0x1'))('api');var moment=require(_0x9537('0x2'));var BPromise=require(_0x9537('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9537('0x4'));var rimraf=require('rimraf');var config=require(_0x9537('0x5'));var attributes=require(_0x9537('0x6'));module[_0x9537('0x7')]=function(_0x20105b,_0x3362ed){return _0x20105b['define'](_0x9537('0x8'),attributes,{'tableName':_0x9537('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31b1=['exports','define','MailServerIn','mail_servers_in','util','api','moment','bluebird','path','rimraf','./mailServerIn.attributes'];(function(_0x182f05,_0x46cc14){var _0x2808d2=function(_0x5329ee){while(--_0x5329ee){_0x182f05['push'](_0x182f05['shift']());}};_0x2808d2(++_0x46cc14);}(_0x31b1,0x138));var _0x131b=function(_0x3d552a,_0x432a7b){_0x3d552a=_0x3d552a-0x0;var _0x527534=_0x31b1[_0x3d552a];return _0x527534;};'use strict';var _=require('lodash');var util=require(_0x131b('0x0'));var logger=require('../../config/logger')(_0x131b('0x1'));var moment=require(_0x131b('0x2'));var BPromise=require(_0x131b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x131b('0x4'));var rimraf=require(_0x131b('0x5'));var config=require('../../config/environment');var attributes=require(_0x131b('0x6'));module[_0x131b('0x7')]=function(_0x1482b4,_0x198c2b){return _0x1482b4[_0x131b('0x8')](_0x131b('0x9'),attributes,{'tableName':_0x131b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index caf59d0..042e9dd 100644 --- a/server/api/mailServerIn/mailServerIn.rpc.js +++ b/server/api/mailServerIn/mailServerIn.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4d3=['info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailServerIn','options','raw','where','limit','map','include','model','attributes','stringify','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb4d3,0x199));var _0x3b4d=function(_0x5a7cbc,_0x573d85){_0x5a7cbc=_0x5a7cbc-0x0;var _0x44d2cc=_0xb4d3[_0x5a7cbc];return _0x44d2cc;};'use strict';var _=require(_0x3b4d('0x0'));var util=require(_0x3b4d('0x1'));var moment=require('moment');var BPromise=require(_0x3b4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b4d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b4d('0x4'))(_0x3b4d('0x5'));var config=require(_0x3b4d('0x6'));var jayson=require(_0x3b4d('0x7'));var client=jayson[_0x3b4d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc75b22,_0x49159e,_0x46b6cf){return new BPromise(function(_0x2e9ec4,_0x3b64f6){return client[_0x3b4d('0x9')](_0xc75b22,_0x46b6cf)[_0x3b4d('0xa')](function(_0x36ab20){logger[_0x3b4d('0xb')](_0x3b4d('0xc'),_0x49159e,'request\x20sent');logger[_0x3b4d('0xd')](_0x3b4d('0xe'),_0x49159e,_0x3b4d('0xf'),JSON['stringify'](_0x36ab20));if(_0x36ab20[_0x3b4d('0x10')]){if(_0x36ab20[_0x3b4d('0x10')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x49159e,_0x36ab20[_0x3b4d('0x10')][_0x3b4d('0x11')]);return _0x3b64f6(_0x36ab20[_0x3b4d('0x10')][_0x3b4d('0x11')]);}logger['error'](_0x3b4d('0xc'),_0x49159e,_0x36ab20[_0x3b4d('0x10')][_0x3b4d('0x11')]);return _0x2e9ec4(_0x36ab20[_0x3b4d('0x10')][_0x3b4d('0x11')]);}else{logger[_0x3b4d('0xb')](_0x3b4d('0xc'),_0x49159e,_0x3b4d('0xf'));_0x2e9ec4(_0x36ab20[_0x3b4d('0x12')][_0x3b4d('0x11')]);}})[_0x3b4d('0x13')](function(_0x2f0bc5){logger[_0x3b4d('0x10')]('MailServerIn,\x20%s,\x20%s',_0x49159e,_0x2f0bc5);_0x3b64f6(_0x2f0bc5);});});}exports[_0x3b4d('0x14')]=function(_0x58767f){var _0x310205=this;return new Promise(function(_0x32457a,_0x4a79d0){return db['MailServerIn']['findAll']({'raw':_0x58767f[_0x3b4d('0x15')]?_0x58767f[_0x3b4d('0x15')][_0x3b4d('0x16')]===undefined?!![]:![]:!![],'where':_0x58767f[_0x3b4d('0x15')]?_0x58767f[_0x3b4d('0x15')][_0x3b4d('0x17')]||null:null,'attributes':_0x58767f[_0x3b4d('0x15')]?_0x58767f['options']['attributes']||null:null,'limit':_0x58767f[_0x3b4d('0x15')]?_0x58767f[_0x3b4d('0x15')][_0x3b4d('0x18')]||null:null,'include':_0x58767f[_0x3b4d('0x15')]?_0x58767f[_0x3b4d('0x15')]['include']?_[_0x3b4d('0x19')](_0x58767f[_0x3b4d('0x15')][_0x3b4d('0x1a')],function(_0x1d3446){return{'model':db[_0x1d3446[_0x3b4d('0x1b')]],'as':_0x1d3446['as'],'attributes':_0x1d3446[_0x3b4d('0x1c')],'include':_0x1d3446[_0x3b4d('0x1a')]?_[_0x3b4d('0x19')](_0x1d3446[_0x3b4d('0x1a')],function(_0x3d0c26){return{'model':db[_0x3d0c26['model']],'as':_0x3d0c26['as'],'attributes':_0x3d0c26['attributes'],'include':_0x3d0c26[_0x3b4d('0x1a')]?_[_0x3b4d('0x19')](_0x3d0c26['include'],function(_0xc3c852){return{'model':db[_0xc3c852[_0x3b4d('0x1b')]],'as':_0xc3c852['as'],'attributes':_0xc3c852[_0x3b4d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3b4d('0xa')](function(_0x3be7bb){logger['info'](_0x3b4d('0x14'),_0x58767f);logger[_0x3b4d('0xd')]('GetMailServerIn',_0x58767f,JSON[_0x3b4d('0x1d')](_0x3be7bb));_0x32457a(_0x3be7bb);})[_0x3b4d('0x13')](function(_0x56e1f9){logger[_0x3b4d('0x10')](_0x3b4d('0x14'),_0x56e1f9[_0x3b4d('0x11')],_0x58767f);_0x4a79d0(_0x310205[_0x3b4d('0x10')](0x1f4,_0x56e1f9[_0x3b4d('0x11')]));});});}; \ No newline at end of file +var _0x2379=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','request\x20sent','result','MailServerIn','findAll','raw','options','where','include','map','attributes','debug','catch','GetMailServerIn','bluebird','randomstring'];(function(_0x25a3ec,_0x219fc9){var _0x42020a=function(_0x17e82c){while(--_0x17e82c){_0x25a3ec['push'](_0x25a3ec['shift']());}};_0x42020a(++_0x219fc9);}(_0x2379,0x82));var _0x9237=function(_0x183a1e,_0x2501f8){_0x183a1e=_0x183a1e-0x0;var _0x43fc33=_0x2379[_0x183a1e];return _0x43fc33;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9237('0x0'));var rs=require(_0x9237('0x1'));var fs=require('fs');var Redis=require(_0x9237('0x2'));var db=require(_0x9237('0x3'))['db'];var utils=require(_0x9237('0x4'));var logger=require(_0x9237('0x5'))(_0x9237('0x6'));var config=require(_0x9237('0x7'));var jayson=require(_0x9237('0x8'));var client=jayson[_0x9237('0x9')][_0x9237('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f5692,_0x4c961a,_0x3895f9){return new BPromise(function(_0x14d42f,_0x460dff){return client[_0x9237('0xb')](_0x5f5692,_0x3895f9)[_0x9237('0xc')](function(_0x227265){logger[_0x9237('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4c961a,'request\x20sent');logger['debug'](_0x9237('0xe'),_0x4c961a,'request\x20sent',JSON[_0x9237('0xf')](_0x227265));if(_0x227265[_0x9237('0x10')]){if(_0x227265[_0x9237('0x10')][_0x9237('0x11')]===0x1f4){logger['error'](_0x9237('0x12'),_0x4c961a,_0x227265['error']['message']);return _0x460dff(_0x227265[_0x9237('0x10')][_0x9237('0x13')]);}logger[_0x9237('0x10')](_0x9237('0x12'),_0x4c961a,_0x227265['error'][_0x9237('0x13')]);return _0x14d42f(_0x227265[_0x9237('0x10')]['message']);}else{logger[_0x9237('0xd')](_0x9237('0x12'),_0x4c961a,_0x9237('0x14'));_0x14d42f(_0x227265[_0x9237('0x15')]['message']);}})['catch'](function(_0x36666f){logger['error']('MailServerIn,\x20%s,\x20%s',_0x4c961a,_0x36666f);_0x460dff(_0x36666f);});});}exports['GetMailServerIn']=function(_0x1ff34b){var _0x48fe14=this;return new Promise(function(_0x427404,_0x14128e){return db[_0x9237('0x16')][_0x9237('0x17')]({'raw':_0x1ff34b['options']?_0x1ff34b['options'][_0x9237('0x18')]===undefined?!![]:![]:!![],'where':_0x1ff34b[_0x9237('0x19')]?_0x1ff34b[_0x9237('0x19')][_0x9237('0x1a')]||null:null,'attributes':_0x1ff34b[_0x9237('0x19')]?_0x1ff34b[_0x9237('0x19')]['attributes']||null:null,'limit':_0x1ff34b[_0x9237('0x19')]?_0x1ff34b[_0x9237('0x19')]['limit']||null:null,'include':_0x1ff34b['options']?_0x1ff34b[_0x9237('0x19')][_0x9237('0x1b')]?_[_0x9237('0x1c')](_0x1ff34b['options'][_0x9237('0x1b')],function(_0x4007b5){return{'model':db[_0x4007b5['model']],'as':_0x4007b5['as'],'attributes':_0x4007b5[_0x9237('0x1d')],'include':_0x4007b5[_0x9237('0x1b')]?_[_0x9237('0x1c')](_0x4007b5[_0x9237('0x1b')],function(_0x21fcc9){return{'model':db[_0x21fcc9['model']],'as':_0x21fcc9['as'],'attributes':_0x21fcc9[_0x9237('0x1d')],'include':_0x21fcc9[_0x9237('0x1b')]?_[_0x9237('0x1c')](_0x21fcc9[_0x9237('0x1b')],function(_0x561be9){return{'model':db[_0x561be9['model']],'as':_0x561be9['as'],'attributes':_0x561be9[_0x9237('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9237('0xc')](function(_0x250dd4){logger[_0x9237('0xd')]('GetMailServerIn',_0x1ff34b);logger[_0x9237('0x1e')]('GetMailServerIn',_0x1ff34b,JSON[_0x9237('0xf')](_0x250dd4));_0x427404(_0x250dd4);})[_0x9237('0x1f')](function(_0x58025e){logger[_0x9237('0x10')](_0x9237('0x20'),_0x58025e[_0x9237('0x13')],_0x1ff34b);_0x14128e(_0x48fe14[_0x9237('0x10')](0x1f4,_0x58025e[_0x9237('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index e8161a8..8e9638b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index e54e23a..657fd0c 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfef3=['BOOLEAN','sequelize','STRING'];(function(_0x44cad0,_0x9bf58){var _0xda846c=function(_0x38c1d2){while(--_0x38c1d2){_0x44cad0['push'](_0x44cad0['shift']());}};_0xda846c(++_0x9bf58);}(_0xfef3,0x118));var _0x3fef=function(_0x53cc66,_0x5162fc){_0x53cc66=_0x53cc66-0x0;var _0x6effae=_0xfef3[_0x53cc66];return _0x6effae;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'description':{'type':Sequelize[_0x3fef('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x3fef('0x1')]},'pass':{'type':Sequelize[_0x3fef('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x3fef('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x3fef('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3fef('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4024=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x38522c,_0x4373f1){var _0x2249d8=function(_0x22eca8){while(--_0x22eca8){_0x38522c['push'](_0x38522c['shift']());}};_0x2249d8(++_0x4373f1);}(_0x4024,0x89));var _0x4402=function(_0x32d61e,_0x294ea1){_0x32d61e=_0x32d61e-0x0;var _0x23dcda=_0x4024[_0x32d61e];return _0x23dcda;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4402('0x2')]},'user':{'type':Sequelize[_0x4402('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4402('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x4402('0x2')]},'authentication':{'type':Sequelize[_0x4402('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index beae6d6..6463238 100644 --- a/server/api/mailServerOut/mailServerOut.controller.js +++ b/server/api/mailServerOut/mailServerOut.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc53d=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','find','eml-format','rimraf'];(function(_0x5c9e3e,_0xcb60fd){var _0x1e3b33=function(_0x2b2e24){while(--_0x2b2e24){_0x5c9e3e['push'](_0x5c9e3e['shift']());}};_0x1e3b33(++_0xcb60fd);}(_0xc53d,0x170));var _0xdc53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc53d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdc53('0x0'));var rimraf=require(_0xdc53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc53('0x2'));var rp=require(_0xdc53('0x3'));var moment=require(_0xdc53('0x4'));var BPromise=require(_0xdc53('0x5'));var Mustache=require(_0xdc53('0x6'));var util=require(_0xdc53('0x7'));var path=require(_0xdc53('0x8'));var sox=require(_0xdc53('0x9'));var csv=require('to-csv');var ejs=require(_0xdc53('0xa'));var fs=require('fs');var fs_extra=require(_0xdc53('0xb'));var _=require(_0xdc53('0xc'));var squel=require(_0xdc53('0xd'));var crypto=require(_0xdc53('0xe'));var jsforce=require(_0xdc53('0xf'));var deskjs=require(_0xdc53('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc53('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc53('0x12'));var logger=require(_0xdc53('0x13'))(_0xdc53('0x14'));var utils=require(_0xdc53('0x15'));var config=require(_0xdc53('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc53('0x17'))['db'];function respondWithStatusCode(_0x16e42e,_0x274721){_0x274721=_0x274721||0xcc;return function(_0x323383){if(_0x323383){return _0x16e42e[_0xdc53('0x18')](_0x274721);}return _0x16e42e[_0xdc53('0x19')](_0x274721)['end']();};}function respondWithResult(_0x3304f1,_0x185496){_0x185496=_0x185496||0xc8;return function(_0x2aadc8){if(_0x2aadc8){return _0x3304f1[_0xdc53('0x19')](_0x185496)[_0xdc53('0x1a')](_0x2aadc8);}};}function respondWithFilteredResult(_0x1d70dc,_0x4f1338){return function(_0x342228){if(_0x342228){var _0x167acb=typeof _0x4f1338['offset']===_0xdc53('0x1b')&&typeof _0x4f1338[_0xdc53('0x1c')]===_0xdc53('0x1b');var _0x3ddecf=_0x342228[_0xdc53('0x1d')];var _0x3b3cf3=_0x167acb?0x0:_0x4f1338[_0xdc53('0x1e')];var _0x251a4b=_0x167acb?_0x342228['count']:_0x4f1338['offset']+_0x4f1338[_0xdc53('0x1c')];var _0x105cb0;if(_0x251a4b>=_0x3ddecf){_0x251a4b=_0x3ddecf;_0x105cb0=0xc8;}else{_0x105cb0=0xce;}_0x1d70dc[_0xdc53('0x19')](_0x105cb0);return _0x1d70dc[_0xdc53('0x1f')](_0xdc53('0x20'),_0x3b3cf3+'-'+_0x251a4b+'/'+_0x3ddecf)[_0xdc53('0x1a')](_0x342228);}return null;};}function patchUpdates(_0x5b8873){return function(_0x2bcce9){try{jsonpatch[_0xdc53('0x21')](_0x2bcce9,_0x5b8873,!![]);}catch(_0x2a9c92){return BPromise[_0xdc53('0x22')](_0x2a9c92);}return _0x2bcce9[_0xdc53('0x23')]();};}function saveUpdates(_0x4e049b,_0x4f62d9){return function(_0x513687){if(_0x513687){return _0x513687[_0xdc53('0x24')](_0x4e049b)[_0xdc53('0x25')](function(_0x3e5e22){return _0x3e5e22;});}return null;};}function removeEntity(_0x57ed6f,_0x2295aa){return function(_0x5bcafe){if(_0x5bcafe){return _0x5bcafe[_0xdc53('0x26')]()[_0xdc53('0x25')](function(){_0x57ed6f[_0xdc53('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47be67,_0x2dbe27){return function(_0x237df9){if(!_0x237df9){_0x47be67[_0xdc53('0x18')](0x194);}return _0x237df9;};}function handleError(_0x1d8650,_0x20bb98){_0x20bb98=_0x20bb98||0x1f4;return function(_0x43221b){logger['error'](_0x43221b[_0xdc53('0x27')]);if(_0x43221b[_0xdc53('0x28')]){delete _0x43221b[_0xdc53('0x28')];}_0x1d8650[_0xdc53('0x19')](_0x20bb98)[_0xdc53('0x29')](_0x43221b);};}exports[_0xdc53('0x2a')]=function(_0x36d4f5,_0x3a5aac){var _0x3b49d6={},_0x37acc6={},_0x39cef1={'count':0x0,'rows':[]};var _0x531236=_['map'](db[_0xdc53('0x2b')][_0xdc53('0x2c')],function(_0x5b0e10){return{'name':_0x5b0e10[_0xdc53('0x2d')],'type':_0x5b0e10[_0xdc53('0x2e')][_0xdc53('0x2f')]};});_0x37acc6[_0xdc53('0x30')]=_[_0xdc53('0x31')](_0x531236,_0xdc53('0x28'));_0x37acc6[_0xdc53('0x32')]=_[_0xdc53('0x33')](_0x36d4f5[_0xdc53('0x32')]);_0x37acc6[_0xdc53('0x34')]=_[_0xdc53('0x35')](_0x37acc6[_0xdc53('0x30')],_0x37acc6[_0xdc53('0x32')]);_0x3b49d6[_0xdc53('0x36')]=_['intersection'](_0x37acc6[_0xdc53('0x30')],qs[_0xdc53('0x37')](_0x36d4f5[_0xdc53('0x32')][_0xdc53('0x37')]));_0x3b49d6['attributes']=_0x3b49d6[_0xdc53('0x36')][_0xdc53('0x38')]?_0x3b49d6[_0xdc53('0x36')]:_0x37acc6[_0xdc53('0x30')];if(!_0x36d4f5['query']['hasOwnProperty'](_0xdc53('0x39'))){_0x3b49d6[_0xdc53('0x1c')]=qs[_0xdc53('0x1c')](_0x36d4f5['query']['limit']);_0x3b49d6[_0xdc53('0x1e')]=qs[_0xdc53('0x1e')](_0x36d4f5['query']['offset']);}_0x3b49d6['order']=qs[_0xdc53('0x3a')](_0x36d4f5[_0xdc53('0x32')]['sort']);_0x3b49d6[_0xdc53('0x3b')]=qs[_0xdc53('0x34')](_[_0xdc53('0x3c')](_0x36d4f5[_0xdc53('0x32')],_0x37acc6['filters']),_0x531236);if(_0x36d4f5[_0xdc53('0x32')][_0xdc53('0x3d')]){_0x3b49d6[_0xdc53('0x3b')]=_[_0xdc53('0x3e')](_0x3b49d6[_0xdc53('0x3b')],{'$or':_[_0xdc53('0x31')](_0x531236,function(_0x3e251d){if(_0x3e251d[_0xdc53('0x2e')]!==_0xdc53('0x3f')){var _0xb92d4b={};_0xb92d4b[_0x3e251d[_0xdc53('0x28')]]={'$like':'%'+_0x36d4f5[_0xdc53('0x32')][_0xdc53('0x3d')]+'%'};return _0xb92d4b;}})});}_0x3b49d6=_[_0xdc53('0x3e')]({},_0x3b49d6,_0x36d4f5[_0xdc53('0x40')]);var _0x35aa3c={'where':_0x3b49d6[_0xdc53('0x3b')]};return db[_0xdc53('0x2b')][_0xdc53('0x1d')](_0x35aa3c)['then'](function(_0xb6a9d7){_0x39cef1[_0xdc53('0x1d')]=_0xb6a9d7;if(_0x36d4f5['query']['includeAll']){_0x3b49d6[_0xdc53('0x41')]=[{'all':!![]}];}return db[_0xdc53('0x2b')][_0xdc53('0x42')](_0x3b49d6);})['then'](function(_0x7c6b14){_0x39cef1[_0xdc53('0x43')]=_0x7c6b14;return _0x39cef1;})[_0xdc53('0x25')](respondWithFilteredResult(_0x3a5aac,_0x3b49d6))[_0xdc53('0x44')](handleError(_0x3a5aac,null));};exports['show']=function(_0x549ad2,_0x34022e){var _0x441187={'raw':!![],'where':{'id':_0x549ad2[_0xdc53('0x45')]['id']}},_0x12be0c={};_0x12be0c['model']=_['keys'](db[_0xdc53('0x2b')]['rawAttributes']);_0x12be0c[_0xdc53('0x32')]=_['keys'](_0x549ad2[_0xdc53('0x32')]);_0x12be0c['filters']=_[_0xdc53('0x35')](_0x12be0c['model'],_0x12be0c['query']);_0x441187[_0xdc53('0x36')]=_['intersection'](_0x12be0c['model'],qs[_0xdc53('0x37')](_0x549ad2[_0xdc53('0x32')][_0xdc53('0x37')]));_0x441187['attributes']=_0x441187['attributes'][_0xdc53('0x38')]?_0x441187[_0xdc53('0x36')]:_0x12be0c['model'];if(_0x549ad2[_0xdc53('0x32')][_0xdc53('0x46')]){_0x441187[_0xdc53('0x41')]=[{'all':!![]}];}_0x441187=_[_0xdc53('0x3e')]({},_0x441187,_0x549ad2['options']);return db[_0xdc53('0x2b')]['find'](_0x441187)[_0xdc53('0x25')](handleEntityNotFound(_0x34022e,null))[_0xdc53('0x25')](respondWithResult(_0x34022e,null))[_0xdc53('0x44')](handleError(_0x34022e,null));};exports['create']=function(_0x1b3bcd,_0xa52658){return db[_0xdc53('0x2b')][_0xdc53('0x47')](_0x1b3bcd[_0xdc53('0x48')],{})[_0xdc53('0x25')](respondWithResult(_0xa52658,0xc9))[_0xdc53('0x44')](handleError(_0xa52658,null));};exports[_0xdc53('0x24')]=function(_0x495a1c,_0x16f232){if(_0x495a1c[_0xdc53('0x48')]['id']){delete _0x495a1c[_0xdc53('0x48')]['id'];}return db[_0xdc53('0x2b')][_0xdc53('0x49')]({'where':{'id':_0x495a1c[_0xdc53('0x45')]['id']}})[_0xdc53('0x25')](handleEntityNotFound(_0x16f232,null))['then'](saveUpdates(_0x495a1c[_0xdc53('0x48')],null))[_0xdc53('0x25')](respondWithResult(_0x16f232,null))[_0xdc53('0x44')](handleError(_0x16f232,null));};exports[_0xdc53('0x26')]=function(_0x5d4416,_0x4ef5b2){return db[_0xdc53('0x2b')][_0xdc53('0x49')]({'where':{'id':_0x5d4416[_0xdc53('0x45')]['id']}})[_0xdc53('0x25')](handleEntityNotFound(_0x4ef5b2,null))['then'](removeEntity(_0x4ef5b2,null))[_0xdc53('0x44')](handleError(_0x4ef5b2,null));}; \ No newline at end of file +var _0xcc08=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','keys','length','find','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5afca9,_0x11d04a){var _0x13b066=function(_0x57bacc){while(--_0x57bacc){_0x5afca9['push'](_0x5afca9['shift']());}};_0x13b066(++_0x11d04a);}(_0xcc08,0x11d));var _0x8cc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc08[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8cc0('0x0'));var rimraf=require(_0x8cc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cc0('0x2'));var rp=require(_0x8cc0('0x3'));var moment=require(_0x8cc0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cc0('0x5'));var util=require(_0x8cc0('0x6'));var path=require(_0x8cc0('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8cc0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cc0('0x9'));var squel=require(_0x8cc0('0xa'));var crypto=require('crypto');var jsforce=require(_0x8cc0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8cc0('0xc'));var querystring=require(_0x8cc0('0xd'));var Papa=require(_0x8cc0('0xe'));var Redis=require('ioredis');var authService=require(_0x8cc0('0xf'));var qs=require(_0x8cc0('0x10'));var as=require(_0x8cc0('0x11'));var hardwareService=require(_0x8cc0('0x12'));var logger=require('../../config/logger')(_0x8cc0('0x13'));var utils=require(_0x8cc0('0x14'));var config=require(_0x8cc0('0x15'));var licenseUtil=require(_0x8cc0('0x16'));var db=require(_0x8cc0('0x17'))['db'];function respondWithStatusCode(_0x49a89e,_0x21ee9c){_0x21ee9c=_0x21ee9c||0xcc;return function(_0x5e6794){if(_0x5e6794){return _0x49a89e[_0x8cc0('0x18')](_0x21ee9c);}return _0x49a89e[_0x8cc0('0x19')](_0x21ee9c)['end']();};}function respondWithResult(_0x96272d,_0x153fda){_0x153fda=_0x153fda||0xc8;return function(_0x3092c6){if(_0x3092c6){return _0x96272d[_0x8cc0('0x19')](_0x153fda)[_0x8cc0('0x1a')](_0x3092c6);}};}function respondWithFilteredResult(_0x1da753,_0x28016c){return function(_0x3ea424){if(_0x3ea424){var _0x584c94=typeof _0x28016c[_0x8cc0('0x1b')]===_0x8cc0('0x1c')&&typeof _0x28016c[_0x8cc0('0x1d')]==='undefined';var _0x5d015e=_0x3ea424[_0x8cc0('0x1e')];var _0x56ab7c=_0x584c94?0x0:_0x28016c['offset'];var _0x1df7b2=_0x584c94?_0x3ea424[_0x8cc0('0x1e')]:_0x28016c[_0x8cc0('0x1b')]+_0x28016c['limit'];var _0x1381e0;if(_0x1df7b2>=_0x5d015e){_0x1df7b2=_0x5d015e;_0x1381e0=0xc8;}else{_0x1381e0=0xce;}_0x1da753['status'](_0x1381e0);return _0x1da753['set'](_0x8cc0('0x1f'),_0x56ab7c+'-'+_0x1df7b2+'/'+_0x5d015e)[_0x8cc0('0x1a')](_0x3ea424);}return null;};}function patchUpdates(_0x3f1fe5){return function(_0x239f88){try{jsonpatch[_0x8cc0('0x20')](_0x239f88,_0x3f1fe5,!![]);}catch(_0x87933e){return BPromise[_0x8cc0('0x21')](_0x87933e);}return _0x239f88[_0x8cc0('0x22')]();};}function saveUpdates(_0x3d2c7d,_0x997767){return function(_0x11ebc4){if(_0x11ebc4){return _0x11ebc4['update'](_0x3d2c7d)[_0x8cc0('0x23')](function(_0x3062a5){return _0x3062a5;});}return null;};}function removeEntity(_0x1dc510,_0x429d6b){return function(_0x3e87aa){if(_0x3e87aa){return _0x3e87aa[_0x8cc0('0x24')]()[_0x8cc0('0x23')](function(){_0x1dc510[_0x8cc0('0x19')](0xcc)[_0x8cc0('0x25')]();});}};}function handleEntityNotFound(_0x4016ee,_0x4dec62){return function(_0x590add){if(!_0x590add){_0x4016ee['sendStatus'](0x194);}return _0x590add;};}function handleError(_0x259af4,_0x1aae05){_0x1aae05=_0x1aae05||0x1f4;return function(_0x23ad97){logger[_0x8cc0('0x26')](_0x23ad97[_0x8cc0('0x27')]);if(_0x23ad97[_0x8cc0('0x28')]){delete _0x23ad97['name'];}_0x259af4[_0x8cc0('0x19')](_0x1aae05)[_0x8cc0('0x29')](_0x23ad97);};}exports[_0x8cc0('0x2a')]=function(_0x3a77b6,_0x3201d9){var _0x12ff4a={},_0xa442c7={},_0x233329={'count':0x0,'rows':[]};var _0xdf6b01=_[_0x8cc0('0x2b')](db['MailServerOut'][_0x8cc0('0x2c')],function(_0x4b14b8){return{'name':_0x4b14b8[_0x8cc0('0x2d')],'type':_0x4b14b8[_0x8cc0('0x2e')][_0x8cc0('0x2f')]};});_0xa442c7['model']=_[_0x8cc0('0x2b')](_0xdf6b01,_0x8cc0('0x28'));_0xa442c7[_0x8cc0('0x30')]=_['keys'](_0x3a77b6[_0x8cc0('0x30')]);_0xa442c7[_0x8cc0('0x31')]=_['intersection'](_0xa442c7[_0x8cc0('0x32')],_0xa442c7[_0x8cc0('0x30')]);_0x12ff4a[_0x8cc0('0x33')]=_[_0x8cc0('0x34')](_0xa442c7[_0x8cc0('0x32')],qs[_0x8cc0('0x35')](_0x3a77b6[_0x8cc0('0x30')][_0x8cc0('0x35')]));_0x12ff4a[_0x8cc0('0x33')]=_0x12ff4a[_0x8cc0('0x33')]['length']?_0x12ff4a[_0x8cc0('0x33')]:_0xa442c7[_0x8cc0('0x32')];if(!_0x3a77b6[_0x8cc0('0x30')][_0x8cc0('0x36')](_0x8cc0('0x37'))){_0x12ff4a[_0x8cc0('0x1d')]=qs[_0x8cc0('0x1d')](_0x3a77b6[_0x8cc0('0x30')]['limit']);_0x12ff4a[_0x8cc0('0x1b')]=qs['offset'](_0x3a77b6[_0x8cc0('0x30')][_0x8cc0('0x1b')]);}_0x12ff4a[_0x8cc0('0x38')]=qs[_0x8cc0('0x39')](_0x3a77b6[_0x8cc0('0x30')]['sort']);_0x12ff4a[_0x8cc0('0x3a')]=qs[_0x8cc0('0x31')](_[_0x8cc0('0x3b')](_0x3a77b6['query'],_0xa442c7[_0x8cc0('0x31')]),_0xdf6b01);if(_0x3a77b6[_0x8cc0('0x30')]['filter']){_0x12ff4a[_0x8cc0('0x3a')]=_['merge'](_0x12ff4a[_0x8cc0('0x3a')],{'$or':_[_0x8cc0('0x2b')](_0xdf6b01,function(_0x53aa47){if(_0x53aa47[_0x8cc0('0x2e')]!==_0x8cc0('0x3c')){var _0x546570={};_0x546570[_0x53aa47[_0x8cc0('0x28')]]={'$like':'%'+_0x3a77b6[_0x8cc0('0x30')][_0x8cc0('0x3d')]+'%'};return _0x546570;}})});}_0x12ff4a=_[_0x8cc0('0x3e')]({},_0x12ff4a,_0x3a77b6[_0x8cc0('0x3f')]);var _0x25466a={'where':_0x12ff4a['where']};return db[_0x8cc0('0x40')][_0x8cc0('0x1e')](_0x25466a)[_0x8cc0('0x23')](function(_0x539509){_0x233329['count']=_0x539509;if(_0x3a77b6[_0x8cc0('0x30')][_0x8cc0('0x41')]){_0x12ff4a[_0x8cc0('0x42')]=[{'all':!![]}];}return db[_0x8cc0('0x40')][_0x8cc0('0x43')](_0x12ff4a);})[_0x8cc0('0x23')](function(_0x191a23){_0x233329[_0x8cc0('0x44')]=_0x191a23;return _0x233329;})[_0x8cc0('0x23')](respondWithFilteredResult(_0x3201d9,_0x12ff4a))[_0x8cc0('0x45')](handleError(_0x3201d9,null));};exports[_0x8cc0('0x46')]=function(_0x451160,_0x1bd59c){var _0x54ac33={'raw':!![],'where':{'id':_0x451160[_0x8cc0('0x47')]['id']}},_0x185898={};_0x185898[_0x8cc0('0x32')]=_[_0x8cc0('0x48')](db[_0x8cc0('0x40')]['rawAttributes']);_0x185898['query']=_[_0x8cc0('0x48')](_0x451160['query']);_0x185898[_0x8cc0('0x31')]=_['intersection'](_0x185898[_0x8cc0('0x32')],_0x185898[_0x8cc0('0x30')]);_0x54ac33[_0x8cc0('0x33')]=_[_0x8cc0('0x34')](_0x185898[_0x8cc0('0x32')],qs['fields'](_0x451160[_0x8cc0('0x30')][_0x8cc0('0x35')]));_0x54ac33['attributes']=_0x54ac33[_0x8cc0('0x33')][_0x8cc0('0x49')]?_0x54ac33[_0x8cc0('0x33')]:_0x185898[_0x8cc0('0x32')];if(_0x451160[_0x8cc0('0x30')][_0x8cc0('0x41')]){_0x54ac33[_0x8cc0('0x42')]=[{'all':!![]}];}_0x54ac33=_[_0x8cc0('0x3e')]({},_0x54ac33,_0x451160[_0x8cc0('0x3f')]);return db[_0x8cc0('0x40')][_0x8cc0('0x4a')](_0x54ac33)[_0x8cc0('0x23')](handleEntityNotFound(_0x1bd59c,null))[_0x8cc0('0x23')](respondWithResult(_0x1bd59c,null))['catch'](handleError(_0x1bd59c,null));};exports['create']=function(_0x4c54c1,_0x476fd3){return db[_0x8cc0('0x40')]['create'](_0x4c54c1['body'],{})[_0x8cc0('0x23')](respondWithResult(_0x476fd3,0xc9))[_0x8cc0('0x45')](handleError(_0x476fd3,null));};exports[_0x8cc0('0x4b')]=function(_0x3145b9,_0x16d03b){if(_0x3145b9[_0x8cc0('0x4c')]['id']){delete _0x3145b9['body']['id'];}return db[_0x8cc0('0x40')][_0x8cc0('0x4a')]({'where':{'id':_0x3145b9[_0x8cc0('0x47')]['id']}})[_0x8cc0('0x23')](handleEntityNotFound(_0x16d03b,null))[_0x8cc0('0x23')](saveUpdates(_0x3145b9[_0x8cc0('0x4c')],null))[_0x8cc0('0x23')](respondWithResult(_0x16d03b,null))['catch'](handleError(_0x16d03b,null));};exports[_0x8cc0('0x24')]=function(_0x4aa9de,_0x350100){return db[_0x8cc0('0x40')]['find']({'where':{'id':_0x4aa9de[_0x8cc0('0x47')]['id']}})[_0x8cc0('0x23')](handleEntityNotFound(_0x350100,null))[_0x8cc0('0x23')](removeEntity(_0x350100,null))['catch'](handleError(_0x350100,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 2925ff3..4643cac 100644 --- a/server/api/mailServerOut/mailServerOut.model.js +++ b/server/api/mailServerOut/mailServerOut.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ba8=['MailServerOut','lodash','util','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x5d9c08,_0x68d66e){var _0x3d07ae=function(_0x1f6d8d){while(--_0x1f6d8d){_0x5d9c08['push'](_0x5d9c08['shift']());}};_0x3d07ae(++_0x68d66e);}(_0x1ba8,0x145));var _0x81ba=function(_0x2cd857,_0x2322f4){_0x2cd857=_0x2cd857-0x0;var _0x5ab774=_0x1ba8[_0x2cd857];return _0x5ab774;};'use strict';var _=require(_0x81ba('0x0'));var util=require(_0x81ba('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x81ba('0x2'));var rp=require(_0x81ba('0x3'));var fs=require('fs');var path=require(_0x81ba('0x4'));var rimraf=require(_0x81ba('0x5'));var config=require('../../config/environment');var attributes=require(_0x81ba('0x6'));module[_0x81ba('0x7')]=function(_0x394f25,_0x4f9c40){return _0x394f25['define'](_0x81ba('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63cc=['path','rimraf','../../config/environment','exports','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x3f7978,_0x23d4d9){var _0x4dd849=function(_0x2bdce4){while(--_0x2bdce4){_0x3f7978['push'](_0x3f7978['shift']());}};_0x4dd849(++_0x23d4d9);}(_0x63cc,0x1dc));var _0xc63c=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x63cc[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xc63c('0x0'));var util=require(_0xc63c('0x1'));var logger=require(_0xc63c('0x2'))(_0xc63c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc63c('0x4'));var rimraf=require(_0xc63c('0x5'));var config=require(_0xc63c('0x6'));var attributes=require('./mailServerOut.attributes');module[_0xc63c('0x7')]=function(_0x28c214,_0x4bec79){return _0x28c214['define'](_0xc63c('0x8'),attributes,{'tableName':_0xc63c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index b117a01..b7a4e36 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x482770,_0x4f71fe){var _0x566fe2=function(_0x4eb147){while(--_0x4eb147){_0x482770['push'](_0x482770['shift']());}};_0x566fe2(++_0x4f71fe);}(_0x1261,0x144));var _0x1126=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x1261[_0x2e9b5b];return _0x734c46;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ 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','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x11e86b,_0x52b907){var _0x2d81f8=function(_0x3b4832){while(--_0x3b4832){_0x11e86b['push'](_0x11e86b['shift']());}};_0x2d81f8(++_0x52b907);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3d33d6,_0x56b33a){_0x3d33d6=_0x3d33d6-0x0;var _0x5b3342=_0x5f2f[_0x3d33d6];return _0x5b3342;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f74aa8f..3442a2a 100644 --- a/server/api/mailSubstatus/index.js +++ b/server/api/mailSubstatus/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19b2=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','show','create','/:id','update','destroy'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x19b2,0xfd));var _0x219b=function(_0x4fedd4,_0x1dbf05){_0x4fedd4=_0x4fedd4-0x0;var _0x5dce0d=_0x19b2[_0x4fedd4];return _0x5dce0d;};'use strict';var multer=require(_0x219b('0x0'));var util=require(_0x219b('0x1'));var path=require('path');var timeout=require(_0x219b('0x2'));var express=require(_0x219b('0x3'));var router=express['Router']();var fs_extra=require(_0x219b('0x4'));var auth=require(_0x219b('0x5'));var interaction=require(_0x219b('0x6'));var config=require(_0x219b('0x7'));var controller=require(_0x219b('0x8'));router['get']('/',auth[_0x219b('0x9')](),controller[_0x219b('0xa')]);router[_0x219b('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x219b('0xb')]('/:id',auth[_0x219b('0x9')](),controller[_0x219b('0xc')]);router['post']('/',auth[_0x219b('0x9')](),controller[_0x219b('0xd')]);router['put'](_0x219b('0xe'),auth[_0x219b('0x9')](),controller[_0x219b('0xf')]);router['delete'](_0x219b('0xe'),auth['isAuthenticated'](),controller[_0x219b('0x10')]);module[_0x219b('0x11')]=router; \ No newline at end of file +var _0x1adb=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x5166ef,_0x2c4eec){var _0x193630=function(_0x461a46){while(--_0x461a46){_0x5166ef['push'](_0x5166ef['shift']());}};_0x193630(++_0x2c4eec);}(_0x1adb,0x1e2));var _0xb1ad=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1adb[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xb1ad('0x0'));var util=require(_0xb1ad('0x1'));var path=require('path');var timeout=require(_0xb1ad('0x2'));var express=require('express');var router=express[_0xb1ad('0x3')]();var fs_extra=require(_0xb1ad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb1ad('0x5'));var config=require(_0xb1ad('0x6'));var controller=require(_0xb1ad('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb1ad('0x8')]);router[_0xb1ad('0x9')](_0xb1ad('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb1ad('0xb')]);router[_0xb1ad('0xc')]('/',auth[_0xb1ad('0xd')](),controller[_0xb1ad('0xe')]);router[_0xb1ad('0xf')](_0xb1ad('0x10'),auth[_0xb1ad('0xd')](),controller[_0xb1ad('0x11')]);router[_0xb1ad('0x12')](_0xb1ad('0x10'),auth[_0xb1ad('0xd')](),controller[_0xb1ad('0x13')]);module[_0xb1ad('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e959d03..5ac652c 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f44=['name','STRING','sequelize','exports'];(function(_0x264eb1,_0x583653){var _0x3b29a5=function(_0x17f9e7){while(--_0x17f9e7){_0x264eb1['push'](_0x264eb1['shift']());}};_0x3b29a5(++_0x583653);}(_0x6f44,0x1ea));var _0x46f4=function(_0x575b29,_0x4c8101){_0x575b29=_0x575b29-0x0;var _0x4b100d=_0x6f44[_0x575b29];return _0x4b100d;};'use strict';var Sequelize=require(_0x46f4('0x0'));module[_0x46f4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x46f4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x46f4('0x3')]}}; \ No newline at end of file +var _0x2c8f=['exports'];(function(_0x3978af,_0x11ccd0){var _0x1ab8cf=function(_0x3d4b1c){while(--_0x3d4b1c){_0x3978af['push'](_0x3978af['shift']());}};_0x1ab8cf(++_0x11ccd0);}(_0x2c8f,0x192));var _0xf2c8=function(_0x35ee6a,_0x20c1c9){_0x35ee6a=_0x35ee6a-0x0;var _0x3314dc=_0x2c8f[_0x35ee6a];return _0x3314dc;};'use strict';var Sequelize=require('sequelize');module[_0xf2c8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8726348..7586da9 100644 --- a/server/api/mailSubstatus/mailSubstatus.controller.js +++ b/server/api/mailSubstatus/mailSubstatus.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99ec=['reject','save','update','destroy','then','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','MailSubstatus','includeAll','rows','catch','show','params','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','json'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x99ec,0x1ee));var _0xc99e=function(_0x4bdcdd,_0x5b0462){_0x4bdcdd=_0x4bdcdd-0x0;var _0x3c1555=_0x99ec[_0x4bdcdd];return _0x3c1555;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc99e('0x0'));var jsonpatch=require(_0xc99e('0x1'));var rp=require(_0xc99e('0x2'));var moment=require(_0xc99e('0x3'));var BPromise=require(_0xc99e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc99e('0x5'));var sox=require(_0xc99e('0x6'));var csv=require(_0xc99e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc99e('0x8'));var _=require(_0xc99e('0x9'));var squel=require(_0xc99e('0xa'));var crypto=require(_0xc99e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc99e('0x7'));var querystring=require(_0xc99e('0xc'));var Papa=require(_0xc99e('0xd'));var Redis=require(_0xc99e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc99e('0xf'));var hardwareService=require(_0xc99e('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc99e('0x11'))['db'];function respondWithStatusCode(_0x4eeabc,_0x1b366d){_0x1b366d=_0x1b366d||0xcc;return function(_0x249a89){if(_0x249a89){return _0x4eeabc[_0xc99e('0x12')](_0x1b366d);}return _0x4eeabc['status'](_0x1b366d)[_0xc99e('0x13')]();};}function respondWithResult(_0x51c657,_0x486be4){_0x486be4=_0x486be4||0xc8;return function(_0x143cba){if(_0x143cba){return _0x51c657[_0xc99e('0x14')](_0x486be4)['json'](_0x143cba);}};}function respondWithFilteredResult(_0x32d306,_0x5cd7ab){return function(_0x3d11af){if(_0x3d11af){var _0x1cf030=typeof _0x5cd7ab['offset']===_0xc99e('0x15')&&typeof _0x5cd7ab[_0xc99e('0x16')]===_0xc99e('0x15');var _0x5d0f79=_0x3d11af[_0xc99e('0x17')];var _0x40f5af=_0x1cf030?0x0:_0x5cd7ab['offset'];var _0x5ec5ea=_0x1cf030?_0x3d11af[_0xc99e('0x17')]:_0x5cd7ab[_0xc99e('0x18')]+_0x5cd7ab[_0xc99e('0x16')];var _0x5e7c51;if(_0x5ec5ea>=_0x5d0f79){_0x5ec5ea=_0x5d0f79;_0x5e7c51=0xc8;}else{_0x5e7c51=0xce;}_0x32d306[_0xc99e('0x14')](_0x5e7c51);return _0x32d306['set']('Content-Range',_0x40f5af+'-'+_0x5ec5ea+'/'+_0x5d0f79)[_0xc99e('0x19')](_0x3d11af);}return null;};}function patchUpdates(_0x45b18d){return function(_0x4d05bf){try{jsonpatch['apply'](_0x4d05bf,_0x45b18d,!![]);}catch(_0x40fd23){return BPromise[_0xc99e('0x1a')](_0x40fd23);}return _0x4d05bf[_0xc99e('0x1b')]();};}function saveUpdates(_0x3e7827,_0x465863){return function(_0x3845b4){if(_0x3845b4){return _0x3845b4[_0xc99e('0x1c')](_0x3e7827)['then'](function(_0x127b4d){return _0x127b4d;});}return null;};}function removeEntity(_0x2081df,_0x4d47c1){return function(_0x282c8a){if(_0x282c8a){return _0x282c8a[_0xc99e('0x1d')]()[_0xc99e('0x1e')](function(){_0x2081df[_0xc99e('0x14')](0xcc)[_0xc99e('0x13')]();});}};}function handleEntityNotFound(_0x168d07,_0x30bd9a){return function(_0x2ff317){if(!_0x2ff317){_0x168d07['sendStatus'](0x194);}return _0x2ff317;};}function handleError(_0x496927,_0x2a22a8){_0x2a22a8=_0x2a22a8||0x1f4;return function(_0x2da7ba){logger[_0xc99e('0x1f')](_0x2da7ba[_0xc99e('0x20')]);if(_0x2da7ba[_0xc99e('0x21')]){delete _0x2da7ba['name'];}_0x496927[_0xc99e('0x14')](_0x2a22a8)[_0xc99e('0x22')](_0x2da7ba);};}exports[_0xc99e('0x23')]=function(_0x3f48f3,_0x4a86a7){var _0x40bb4e={},_0x363597={},_0x44d551={'count':0x0,'rows':[]};var _0x3a837f=_[_0xc99e('0x24')](db['MailSubstatus']['rawAttributes'],function(_0x1490d2){return{'name':_0x1490d2[_0xc99e('0x25')],'type':_0x1490d2['type'][_0xc99e('0x26')]};});_0x363597[_0xc99e('0x27')]=_[_0xc99e('0x24')](_0x3a837f,_0xc99e('0x21'));_0x363597[_0xc99e('0x28')]=_[_0xc99e('0x29')](_0x3f48f3['query']);_0x363597[_0xc99e('0x2a')]=_[_0xc99e('0x2b')](_0x363597[_0xc99e('0x27')],_0x363597[_0xc99e('0x28')]);_0x40bb4e['attributes']=_['intersection'](_0x363597[_0xc99e('0x27')],qs[_0xc99e('0x2c')](_0x3f48f3[_0xc99e('0x28')][_0xc99e('0x2c')]));_0x40bb4e[_0xc99e('0x2d')]=_0x40bb4e[_0xc99e('0x2d')][_0xc99e('0x2e')]?_0x40bb4e[_0xc99e('0x2d')]:_0x363597[_0xc99e('0x27')];if(!_0x3f48f3[_0xc99e('0x28')][_0xc99e('0x2f')]('nolimit')){_0x40bb4e['limit']=qs[_0xc99e('0x16')](_0x3f48f3[_0xc99e('0x28')][_0xc99e('0x16')]);_0x40bb4e['offset']=qs[_0xc99e('0x18')](_0x3f48f3['query'][_0xc99e('0x18')]);}_0x40bb4e['order']=qs[_0xc99e('0x30')](_0x3f48f3[_0xc99e('0x28')][_0xc99e('0x30')]);_0x40bb4e[_0xc99e('0x31')]=qs['filters'](_[_0xc99e('0x32')](_0x3f48f3[_0xc99e('0x28')],_0x363597[_0xc99e('0x2a')]),_0x3a837f);if(_0x3f48f3[_0xc99e('0x28')][_0xc99e('0x33')]){_0x40bb4e[_0xc99e('0x31')]=_[_0xc99e('0x34')](_0x40bb4e['where'],{'$or':_[_0xc99e('0x24')](_0x3a837f,function(_0x4124cf){if(_0x4124cf['type']!=='VIRTUAL'){var _0x5d9c8a={};_0x5d9c8a[_0x4124cf[_0xc99e('0x21')]]={'$like':'%'+_0x3f48f3[_0xc99e('0x28')]['filter']+'%'};return _0x5d9c8a;}})});}_0x40bb4e=_[_0xc99e('0x34')]({},_0x40bb4e,_0x3f48f3[_0xc99e('0x35')]);var _0x3e7a09={'where':_0x40bb4e[_0xc99e('0x31')]};return db[_0xc99e('0x36')][_0xc99e('0x17')](_0x3e7a09)[_0xc99e('0x1e')](function(_0x2c4a0f){_0x44d551[_0xc99e('0x17')]=_0x2c4a0f;if(_0x3f48f3[_0xc99e('0x28')][_0xc99e('0x37')]){_0x40bb4e['include']=[{'all':!![]}];}return db[_0xc99e('0x36')]['findAll'](_0x40bb4e);})[_0xc99e('0x1e')](function(_0x374d70){_0x44d551[_0xc99e('0x38')]=_0x374d70;return _0x44d551;})[_0xc99e('0x1e')](respondWithFilteredResult(_0x4a86a7,_0x40bb4e))[_0xc99e('0x39')](handleError(_0x4a86a7,null));};exports[_0xc99e('0x3a')]=function(_0x44bb89,_0x214b9f){var _0x437143={'raw':!![],'where':{'id':_0x44bb89[_0xc99e('0x3b')]['id']}},_0x3ccd9b={};_0x3ccd9b[_0xc99e('0x27')]=_['keys'](db[_0xc99e('0x36')]['rawAttributes']);_0x3ccd9b[_0xc99e('0x28')]=_['keys'](_0x44bb89['query']);_0x3ccd9b[_0xc99e('0x2a')]=_[_0xc99e('0x2b')](_0x3ccd9b[_0xc99e('0x27')],_0x3ccd9b['query']);_0x437143[_0xc99e('0x2d')]=_[_0xc99e('0x2b')](_0x3ccd9b[_0xc99e('0x27')],qs[_0xc99e('0x2c')](_0x44bb89[_0xc99e('0x28')][_0xc99e('0x2c')]));_0x437143['attributes']=_0x437143[_0xc99e('0x2d')][_0xc99e('0x2e')]?_0x437143[_0xc99e('0x2d')]:_0x3ccd9b[_0xc99e('0x27')];if(_0x44bb89[_0xc99e('0x28')][_0xc99e('0x37')]){_0x437143[_0xc99e('0x3c')]=[{'all':!![]}];}_0x437143=_['merge']({},_0x437143,_0x44bb89['options']);return db[_0xc99e('0x36')][_0xc99e('0x3d')](_0x437143)[_0xc99e('0x1e')](handleEntityNotFound(_0x214b9f,null))[_0xc99e('0x1e')](respondWithResult(_0x214b9f,null))[_0xc99e('0x39')](handleError(_0x214b9f,null));};exports[_0xc99e('0x3e')]=function(_0x588c2c,_0x2e3d85){return db[_0xc99e('0x36')][_0xc99e('0x3e')](_0x588c2c[_0xc99e('0x3f')],{})['then'](respondWithResult(_0x2e3d85,0xc9))[_0xc99e('0x39')](handleError(_0x2e3d85,null));};exports[_0xc99e('0x1c')]=function(_0x5c0f10,_0x1c48d2){if(_0x5c0f10[_0xc99e('0x3f')]['id']){delete _0x5c0f10[_0xc99e('0x3f')]['id'];}return db[_0xc99e('0x36')][_0xc99e('0x3d')]({'where':{'id':_0x5c0f10[_0xc99e('0x3b')]['id']}})[_0xc99e('0x1e')](handleEntityNotFound(_0x1c48d2,null))[_0xc99e('0x1e')](saveUpdates(_0x5c0f10[_0xc99e('0x3f')],null))[_0xc99e('0x1e')](respondWithResult(_0x1c48d2,null))[_0xc99e('0x39')](handleError(_0x1c48d2,null));};exports['destroy']=function(_0x119fa2,_0x2fb6eb){return db['MailSubstatus'][_0xc99e('0x3d')]({'where':{'id':_0x119fa2[_0xc99e('0x3b')]['id']}})[_0xc99e('0x1e')](handleEntityNotFound(_0x2fb6eb,null))['then'](removeEntity(_0x2fb6eb,null))[_0xc99e('0x39')](handleError(_0x2fb6eb,null));};exports[_0xc99e('0x40')]=function(_0x33263a,_0x5692ef){return db[_0xc99e('0x36')][_0xc99e('0x40')]()[_0xc99e('0x1e')](respondWithResult(_0x5692ef,null))[_0xc99e('0x39')](handleError(_0x5692ef,null));}; \ No newline at end of file +var _0x8728=['destroy','error','stack','name','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','Content-Range','save','update','then'];(function(_0x59696f,_0x5a295e){var _0xbae51f=function(_0x4931d9){while(--_0x4931d9){_0x59696f['push'](_0x59696f['shift']());}};_0xbae51f(++_0x5a295e);}(_0x8728,0xfb));var _0x8872=function(_0x358c2f,_0x2ad4a1){_0x358c2f=_0x358c2f-0x0;var _0x14db17=_0x8728[_0x358c2f];return _0x14db17;};'use strict';var emlformat=require(_0x8872('0x0'));var rimraf=require(_0x8872('0x1'));var zipdir=require(_0x8872('0x2'));var jsonpatch=require(_0x8872('0x3'));var rp=require(_0x8872('0x4'));var moment=require('moment');var BPromise=require(_0x8872('0x5'));var Mustache=require(_0x8872('0x6'));var util=require(_0x8872('0x7'));var path=require(_0x8872('0x8'));var sox=require('sox');var csv=require(_0x8872('0x9'));var ejs=require(_0x8872('0xa'));var fs=require('fs');var fs_extra=require(_0x8872('0xb'));var _=require(_0x8872('0xc'));var squel=require('squel');var crypto=require(_0x8872('0xd'));var jsforce=require(_0x8872('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8872('0x9'));var querystring=require('querystring');var Papa=require(_0x8872('0xf'));var Redis=require(_0x8872('0x10'));var authService=require(_0x8872('0x11'));var qs=require(_0x8872('0x12'));var as=require(_0x8872('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8872('0x14'))(_0x8872('0x15'));var utils=require(_0x8872('0x16'));var config=require(_0x8872('0x17'));var licenseUtil=require(_0x8872('0x18'));var db=require(_0x8872('0x19'))['db'];function respondWithStatusCode(_0x1b8347,_0x3ec7ff){_0x3ec7ff=_0x3ec7ff||0xcc;return function(_0x2eaf59){if(_0x2eaf59){return _0x1b8347[_0x8872('0x1a')](_0x3ec7ff);}return _0x1b8347['status'](_0x3ec7ff)[_0x8872('0x1b')]();};}function respondWithResult(_0x12dc3b,_0x5774eb){_0x5774eb=_0x5774eb||0xc8;return function(_0x192f5d){if(_0x192f5d){return _0x12dc3b[_0x8872('0x1c')](_0x5774eb)[_0x8872('0x1d')](_0x192f5d);}};}function respondWithFilteredResult(_0x5eb6f9,_0x4e2ae9){return function(_0x535374){if(_0x535374){var _0x27189a=typeof _0x4e2ae9['offset']==='undefined'&&typeof _0x4e2ae9[_0x8872('0x1e')]==='undefined';var _0x6208d7=_0x535374[_0x8872('0x1f')];var _0x3b24e7=_0x27189a?0x0:_0x4e2ae9[_0x8872('0x20')];var _0x1c2b77=_0x27189a?_0x535374[_0x8872('0x1f')]:_0x4e2ae9[_0x8872('0x20')]+_0x4e2ae9[_0x8872('0x1e')];var _0x496f74;if(_0x1c2b77>=_0x6208d7){_0x1c2b77=_0x6208d7;_0x496f74=0xc8;}else{_0x496f74=0xce;}_0x5eb6f9[_0x8872('0x1c')](_0x496f74);return _0x5eb6f9['set'](_0x8872('0x21'),_0x3b24e7+'-'+_0x1c2b77+'/'+_0x6208d7)[_0x8872('0x1d')](_0x535374);}return null;};}function patchUpdates(_0x460bc9){return function(_0x580aef){try{jsonpatch['apply'](_0x580aef,_0x460bc9,!![]);}catch(_0x1bbe5c){return BPromise['reject'](_0x1bbe5c);}return _0x580aef[_0x8872('0x22')]();};}function saveUpdates(_0x25c45d,_0x53edce){return function(_0x227e56){if(_0x227e56){return _0x227e56[_0x8872('0x23')](_0x25c45d)[_0x8872('0x24')](function(_0x23dca0){return _0x23dca0;});}return null;};}function removeEntity(_0x5c0154,_0x522308){return function(_0x587b79){if(_0x587b79){return _0x587b79[_0x8872('0x25')]()['then'](function(){_0x5c0154[_0x8872('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x445b6e,_0x27fa15){return function(_0x391dcc){if(!_0x391dcc){_0x445b6e[_0x8872('0x1a')](0x194);}return _0x391dcc;};}function handleError(_0x3da8e4,_0x270e89){_0x270e89=_0x270e89||0x1f4;return function(_0x203b84){logger[_0x8872('0x26')](_0x203b84[_0x8872('0x27')]);if(_0x203b84['name']){delete _0x203b84[_0x8872('0x28')];}_0x3da8e4['status'](_0x270e89)['send'](_0x203b84);};}exports[_0x8872('0x29')]=function(_0x526982,_0x2c4d91){var _0x11e913={},_0x1d152a={},_0x3f69df={'count':0x0,'rows':[]};var _0x5164b6=_['map'](db[_0x8872('0x2a')][_0x8872('0x2b')],function(_0x28ac79){return{'name':_0x28ac79[_0x8872('0x2c')],'type':_0x28ac79[_0x8872('0x2d')][_0x8872('0x2e')]};});_0x1d152a[_0x8872('0x2f')]=_[_0x8872('0x30')](_0x5164b6,'name');_0x1d152a[_0x8872('0x31')]=_[_0x8872('0x32')](_0x526982['query']);_0x1d152a[_0x8872('0x33')]=_[_0x8872('0x34')](_0x1d152a[_0x8872('0x2f')],_0x1d152a['query']);_0x11e913[_0x8872('0x35')]=_[_0x8872('0x34')](_0x1d152a[_0x8872('0x2f')],qs[_0x8872('0x36')](_0x526982[_0x8872('0x31')][_0x8872('0x36')]));_0x11e913['attributes']=_0x11e913[_0x8872('0x35')]['length']?_0x11e913[_0x8872('0x35')]:_0x1d152a['model'];if(!_0x526982[_0x8872('0x31')]['hasOwnProperty']('nolimit')){_0x11e913[_0x8872('0x1e')]=qs[_0x8872('0x1e')](_0x526982[_0x8872('0x31')][_0x8872('0x1e')]);_0x11e913[_0x8872('0x20')]=qs[_0x8872('0x20')](_0x526982[_0x8872('0x31')]['offset']);}_0x11e913['order']=qs[_0x8872('0x37')](_0x526982[_0x8872('0x31')]['sort']);_0x11e913[_0x8872('0x38')]=qs[_0x8872('0x33')](_['pick'](_0x526982['query'],_0x1d152a[_0x8872('0x33')]),_0x5164b6);if(_0x526982[_0x8872('0x31')][_0x8872('0x39')]){_0x11e913[_0x8872('0x38')]=_[_0x8872('0x3a')](_0x11e913[_0x8872('0x38')],{'$or':_['map'](_0x5164b6,function(_0x3adc57){if(_0x3adc57[_0x8872('0x2d')]!==_0x8872('0x3b')){var _0x44970e={};_0x44970e[_0x3adc57[_0x8872('0x28')]]={'$like':'%'+_0x526982['query'][_0x8872('0x39')]+'%'};return _0x44970e;}})});}_0x11e913=_['merge']({},_0x11e913,_0x526982[_0x8872('0x3c')]);var _0x5c19ba={'where':_0x11e913[_0x8872('0x38')]};return db[_0x8872('0x2a')][_0x8872('0x1f')](_0x5c19ba)[_0x8872('0x24')](function(_0x3f06e0){_0x3f69df[_0x8872('0x1f')]=_0x3f06e0;if(_0x526982[_0x8872('0x31')]['includeAll']){_0x11e913[_0x8872('0x3d')]=[{'all':!![]}];}return db['MailSubstatus'][_0x8872('0x3e')](_0x11e913);})['then'](function(_0x481b8b){_0x3f69df[_0x8872('0x3f')]=_0x481b8b;return _0x3f69df;})['then'](respondWithFilteredResult(_0x2c4d91,_0x11e913))['catch'](handleError(_0x2c4d91,null));};exports[_0x8872('0x40')]=function(_0x2c1630,_0x1c4171){var _0x11fd06={'raw':!![],'where':{'id':_0x2c1630[_0x8872('0x41')]['id']}},_0x478acd={};_0x478acd[_0x8872('0x2f')]=_[_0x8872('0x32')](db[_0x8872('0x2a')][_0x8872('0x2b')]);_0x478acd['query']=_[_0x8872('0x32')](_0x2c1630[_0x8872('0x31')]);_0x478acd[_0x8872('0x33')]=_[_0x8872('0x34')](_0x478acd[_0x8872('0x2f')],_0x478acd[_0x8872('0x31')]);_0x11fd06['attributes']=_[_0x8872('0x34')](_0x478acd[_0x8872('0x2f')],qs[_0x8872('0x36')](_0x2c1630[_0x8872('0x31')][_0x8872('0x36')]));_0x11fd06[_0x8872('0x35')]=_0x11fd06['attributes']['length']?_0x11fd06[_0x8872('0x35')]:_0x478acd['model'];if(_0x2c1630['query'][_0x8872('0x42')]){_0x11fd06[_0x8872('0x3d')]=[{'all':!![]}];}_0x11fd06=_['merge']({},_0x11fd06,_0x2c1630['options']);return db['MailSubstatus'][_0x8872('0x43')](_0x11fd06)[_0x8872('0x24')](handleEntityNotFound(_0x1c4171,null))[_0x8872('0x24')](respondWithResult(_0x1c4171,null))['catch'](handleError(_0x1c4171,null));};exports[_0x8872('0x44')]=function(_0xa5f59f,_0x5baf11){return db['MailSubstatus'][_0x8872('0x44')](_0xa5f59f['body'],{})[_0x8872('0x24')](respondWithResult(_0x5baf11,0xc9))[_0x8872('0x45')](handleError(_0x5baf11,null));};exports[_0x8872('0x23')]=function(_0x5bb3bf,_0xa8149d){if(_0x5bb3bf[_0x8872('0x46')]['id']){delete _0x5bb3bf[_0x8872('0x46')]['id'];}return db[_0x8872('0x2a')][_0x8872('0x43')]({'where':{'id':_0x5bb3bf['params']['id']}})['then'](handleEntityNotFound(_0xa8149d,null))['then'](saveUpdates(_0x5bb3bf[_0x8872('0x46')],null))[_0x8872('0x24')](respondWithResult(_0xa8149d,null))[_0x8872('0x45')](handleError(_0xa8149d,null));};exports[_0x8872('0x25')]=function(_0x7659d6,_0x36dcdf){return db['MailSubstatus']['find']({'where':{'id':_0x7659d6['params']['id']}})[_0x8872('0x24')](handleEntityNotFound(_0x36dcdf,null))[_0x8872('0x24')](removeEntity(_0x36dcdf,null))[_0x8872('0x45')](handleError(_0x36dcdf,null));};exports[_0x8872('0x47')]=function(_0x2c623e,_0x55e09d){return db[_0x8872('0x2a')][_0x8872('0x47')]()[_0x8872('0x24')](respondWithResult(_0x55e09d,null))[_0x8872('0x45')](handleError(_0x55e09d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index d193daf..0346b82 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa502=['MailSubstatus','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x536c99,_0x2a7523){var _0x149418=function(_0x3096a3){while(--_0x3096a3){_0x536c99['push'](_0x536c99['shift']());}};_0x149418(++_0x2a7523);}(_0xa502,0x126));var _0x2a50=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa502[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x2a50('0x0'));var MailSubstatus=require(_0x2a50('0x1'))['db'][_0x2a50('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x2a50('0x3')};function emitEvent(_0x4fe557){return function(_0x4228c4,_0x2a0517,_0x128eed){MailSubstatusEvents[_0x2a50('0x4')](_0x4fe557+':'+_0x4228c4['id'],_0x4228c4);MailSubstatusEvents[_0x2a50('0x4')](_0x4fe557,_0x4228c4);_0x128eed(null);};}for(var e in events){if(events[_0x2a50('0x5')](e)){var event=events[e];MailSubstatus[_0x2a50('0x6')](e,emitEvent(event));}}module[_0x2a50('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xdf27=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x139e6a,_0x443ab7){var _0x19c2ba=function(_0x5be05b){while(--_0x5be05b){_0x139e6a['push'](_0x139e6a['shift']());}};_0x19c2ba(++_0x443ab7);}(_0xdf27,0x125));var _0x7df2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdf27[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x7df2('0x0'));var MailSubstatus=require(_0x7df2('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7df2('0x2')](0x0);var events={'afterUpdate':_0x7df2('0x3')};function emitEvent(_0xe90b01){return function(_0x2d744a,_0x5b9084,_0x20c273){MailSubstatusEvents[_0x7df2('0x4')](_0xe90b01+':'+_0x2d744a['id'],_0x2d744a);MailSubstatusEvents[_0x7df2('0x4')](_0xe90b01,_0x2d744a);_0x20c273(null);};}for(var e in events){if(events[_0x7df2('0x5')](e)){var event=events[e];MailSubstatus[_0x7df2('0x6')](e,emitEvent(event));}}module[_0x7df2('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 623128b..a2f4c18 100644 --- a/server/api/mailSubstatus/mailSubstatus.model.js +++ b/server/api/mailSubstatus/mailSubstatus.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29b1=['then','catch','./mailSubstatus.attributes','exports','models','MailSubstatus','mail_substatuses','Condition','update','name','_previousDataValues'];(function(_0x39981a,_0x5449df){var _0xb106fc=function(_0x39ebd1){while(--_0x39ebd1){_0x39981a['push'](_0x39981a['shift']());}};_0xb106fc(++_0x5449df);}(_0x29b1,0x16d));var _0x129b=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x29b1[_0x9aada2];return _0x196dff;};'use strict';var attributes=require(_0x129b('0x0'));module[_0x129b('0x1')]=function(_0x45619b){var _0x458ca2=_0x45619b[_0x129b('0x2')];return _0x45619b['define'](_0x129b('0x3'),attributes,{'tableName':_0x129b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x37c5ac,_0x195e18,_0x2fcccd){return _0x458ca2[_0x129b('0x5')][_0x129b('0x6')]({'value':_0x37c5ac[_0x129b('0x7')]},{'where':{'field':'mailSubstatus','value':_0x37c5ac[_0x129b('0x8')]['name']}})[_0x129b('0x9')](function(){_0x2fcccd();})[_0x129b('0xa')](function(_0x5f384b){_0x2fcccd(_0x5f384b);});}}});}; \ No newline at end of file +var _0x92b1=['mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','MailSubstatus','Condition','update','name'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x92b1,0x185));var _0x192b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x92b1[_0x501510];return _0x1e6ee5;};'use strict';var attributes=require(_0x192b('0x0'));module[_0x192b('0x1')]=function(_0x43d706){var _0x41ebe2=_0x43d706[_0x192b('0x2')];return _0x43d706['define'](_0x192b('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x179469,_0x5a501a,_0x1e0c6){return _0x41ebe2[_0x192b('0x4')][_0x192b('0x5')]({'value':_0x179469[_0x192b('0x6')]},{'where':{'field':_0x192b('0x7'),'value':_0x179469[_0x192b('0x8')][_0x192b('0x6')]}})[_0x192b('0x9')](function(){_0x1e0c6();})[_0x192b('0xa')](function(_0x5cec11){_0x1e0c6(_0x5cec11);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d696d62..5515f42 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed48=['error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xc6d606,_0x1fcc51){var _0x14cefb=function(_0x5e1f90){while(--_0x5e1f90){_0xc6d606['push'](_0xc6d606['shift']());}};_0x14cefb(++_0x1fcc51);}(_0xed48,0x1ce));var _0x8ed4=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0xed48[_0x6a0266];return _0x309e00;};'use strict';var _=require(_0x8ed4('0x0'));var util=require(_0x8ed4('0x1'));var moment=require('moment');var BPromise=require(_0x8ed4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ed4('0x3'));var db=require(_0x8ed4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8ed4('0x5'));var client=jayson['client'][_0x8ed4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd1f8bb,_0x26b4c4,_0x27151f){return new BPromise(function(_0xc6051c,_0x5237b0){return client[_0x8ed4('0x7')](_0xd1f8bb,_0x27151f)[_0x8ed4('0x8')](function(_0x3e0733){logger['info'](_0x8ed4('0x9'),_0x26b4c4,_0x8ed4('0xa'));logger['debug'](_0x8ed4('0xb'),_0x26b4c4,'request\x20sent',JSON[_0x8ed4('0xc')](_0x3e0733));if(_0x3e0733[_0x8ed4('0xd')]){if(_0x3e0733[_0x8ed4('0xd')][_0x8ed4('0xe')]===0x1f4){logger[_0x8ed4('0xd')](_0x8ed4('0x9'),_0x26b4c4,_0x3e0733[_0x8ed4('0xd')][_0x8ed4('0xf')]);return _0x5237b0(_0x3e0733[_0x8ed4('0xd')][_0x8ed4('0xf')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x26b4c4,_0x3e0733[_0x8ed4('0xd')]['message']);return _0xc6051c(_0x3e0733[_0x8ed4('0xd')][_0x8ed4('0xf')]);}else{logger[_0x8ed4('0x10')](_0x8ed4('0x9'),_0x26b4c4,'request\x20sent');_0xc6051c(_0x3e0733[_0x8ed4('0x11')][_0x8ed4('0xf')]);}})[_0x8ed4('0x12')](function(_0x3b53b8){logger[_0x8ed4('0xd')](_0x8ed4('0x9'),_0x26b4c4,_0x3b53b8);_0x5237b0(_0x3b53b8);});});} \ No newline at end of file +var _0x2ea9=['info','request\x20sent','debug','stringify','code','error','MailSubstatus,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x162a5d,_0x21e926){var _0x1e518f=function(_0x4778c4){while(--_0x4778c4){_0x162a5d['push'](_0x162a5d['shift']());}};_0x1e518f(++_0x21e926);}(_0x2ea9,0x162));var _0x92ea=function(_0x240588,_0x1211fc){_0x240588=_0x240588-0x0;var _0x1602d6=_0x2ea9[_0x240588];return _0x1602d6;};'use strict';var _=require('lodash');var util=require(_0x92ea('0x0'));var moment=require(_0x92ea('0x1'));var BPromise=require(_0x92ea('0x2'));var rs=require(_0x92ea('0x3'));var fs=require('fs');var Redis=require(_0x92ea('0x4'));var db=require(_0x92ea('0x5'))['db'];var utils=require(_0x92ea('0x6'));var logger=require(_0x92ea('0x7'))(_0x92ea('0x8'));var config=require(_0x92ea('0x9'));var jayson=require(_0x92ea('0xa'));var client=jayson[_0x92ea('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45efb9,_0x1a2807,_0x48ad09){return new BPromise(function(_0x3a7443,_0x11828d){return client[_0x92ea('0xc')](_0x45efb9,_0x48ad09)[_0x92ea('0xd')](function(_0x178e1f){logger[_0x92ea('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x1a2807,_0x92ea('0xf'));logger[_0x92ea('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1a2807,_0x92ea('0xf'),JSON[_0x92ea('0x11')](_0x178e1f));if(_0x178e1f['error']){if(_0x178e1f['error'][_0x92ea('0x12')]===0x1f4){logger[_0x92ea('0x13')](_0x92ea('0x14'),_0x1a2807,_0x178e1f['error'][_0x92ea('0x15')]);return _0x11828d(_0x178e1f[_0x92ea('0x13')][_0x92ea('0x15')]);}logger['error'](_0x92ea('0x14'),_0x1a2807,_0x178e1f[_0x92ea('0x13')]['message']);return _0x3a7443(_0x178e1f['error'][_0x92ea('0x15')]);}else{logger[_0x92ea('0xe')](_0x92ea('0x14'),_0x1a2807,'request\x20sent');_0x3a7443(_0x178e1f[_0x92ea('0x16')][_0x92ea('0x15')]);}})['catch'](function(_0xf68f38){logger[_0x92ea('0x13')](_0x92ea('0x14'),_0x1a2807,_0xf68f38);_0x11828d(_0xf68f38);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 19864a5..c7c70b4 100644 --- a/server/api/mailTransferReport/index.js +++ b/server/api/mailTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf2a=['util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xaf2a,0x98));var _0xaaf2=function(_0x416172,_0x4d795f){_0x416172=_0x416172-0x0;var _0x3ff49e=_0xaf2a[_0x416172];return _0x3ff49e;};'use strict';var multer=require(_0xaaf2('0x0'));var util=require(_0xaaf2('0x1'));var path=require('path');var timeout=require(_0xaaf2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaaf2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xaaf2('0x4'));var config=require(_0xaaf2('0x5'));var controller=require(_0xaaf2('0x6'));router[_0xaaf2('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xaaf2('0x8')](),controller['describe']);router['get'](_0xaaf2('0x9'),auth[_0xaaf2('0x8')](),controller[_0xaaf2('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaaf2('0xb')]);router[_0xaaf2('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xaaf2('0xd')]);router[_0xaaf2('0xe')](_0xaaf2('0x9'),auth[_0xaaf2('0x8')](),controller[_0xaaf2('0xf')]);module[_0xaaf2('0x10')]=router; \ No newline at end of file +var _0x9757=['index','/describe','post','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x330e61,_0xcaff5d){var _0x2401d1=function(_0x167834){while(--_0x167834){_0x330e61['push'](_0x330e61['shift']());}};_0x2401d1(++_0xcaff5d);}(_0x9757,0x170));var _0x7975=function(_0x2f7dce,_0x31d11e){_0x2f7dce=_0x2f7dce-0x0;var _0x1e22c0=_0x9757[_0x2f7dce];return _0x1e22c0;};'use strict';var multer=require(_0x7975('0x0'));var util=require(_0x7975('0x1'));var path=require(_0x7975('0x2'));var timeout=require(_0x7975('0x3'));var express=require(_0x7975('0x4'));var router=express[_0x7975('0x5')]();var fs_extra=require(_0x7975('0x6'));var auth=require(_0x7975('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7975('0x8'));var controller=require(_0x7975('0x9'));router[_0x7975('0xa')]('/',auth[_0x7975('0xb')](),controller[_0x7975('0xc')]);router[_0x7975('0xa')](_0x7975('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x7975('0xa')]('/:id',auth[_0x7975('0xb')](),controller['show']);router[_0x7975('0xe')]('/',auth[_0x7975('0xb')](),controller['create']);router['put']('/:id',auth[_0x7975('0xb')](),controller[_0x7975('0xf')]);router['delete'](_0x7975('0x10'),auth['isAuthenticated'](),controller[_0x7975('0x11')]);module[_0x7975('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 8812a1e..4831c0f 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0x9bde,0xe1));var _0xe9bd=function(_0x28d785,_0x33aad9){_0x28d785=_0x28d785-0x0;var _0x27d6bd=_0x9bde[_0x28d785];return _0x27d6bd;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x329b62,_0x45f020){var _0x4c66c2=function(_0xf7eb79){while(--_0xf7eb79){_0x329b62['push'](_0x329b62['shift']());}};_0x4c66c2(++_0x45f020);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5b9993e..35d035a 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b6f=['type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','MailTransferReport','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3b6f,0x1a1));var _0xf3b6=function(_0x5cd5d3,_0x6c5343){_0x5cd5d3=_0x5cd5d3-0x0;var _0x541dd9=_0x3b6f[_0x5cd5d3];return _0x541dd9;};'use strict';var emlformat=require(_0xf3b6('0x0'));var rimraf=require(_0xf3b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3b6('0x2'));var rp=require(_0xf3b6('0x3'));var moment=require(_0xf3b6('0x4'));var BPromise=require(_0xf3b6('0x5'));var Mustache=require(_0xf3b6('0x6'));var util=require('util');var path=require(_0xf3b6('0x7'));var sox=require(_0xf3b6('0x8'));var csv=require(_0xf3b6('0x9'));var ejs=require(_0xf3b6('0xa'));var fs=require('fs');var fs_extra=require(_0xf3b6('0xb'));var _=require(_0xf3b6('0xc'));var squel=require(_0xf3b6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3b6('0xe'));var toCsv=require(_0xf3b6('0x9'));var querystring=require(_0xf3b6('0xf'));var Papa=require(_0xf3b6('0x10'));var Redis=require(_0xf3b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf3b6('0x12'));var as=require(_0xf3b6('0x13'));var hardwareService=require(_0xf3b6('0x14'));var logger=require(_0xf3b6('0x15'))(_0xf3b6('0x16'));var utils=require(_0xf3b6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf3b6('0x18'));var db=require(_0xf3b6('0x19'))['db'];function respondWithStatusCode(_0x384693,_0x23c20b){_0x23c20b=_0x23c20b||0xcc;return function(_0x1b4522){if(_0x1b4522){return _0x384693['sendStatus'](_0x23c20b);}return _0x384693[_0xf3b6('0x1a')](_0x23c20b)['end']();};}function respondWithResult(_0x149394,_0x109d9c){_0x109d9c=_0x109d9c||0xc8;return function(_0x2ae9b7){if(_0x2ae9b7){return _0x149394[_0xf3b6('0x1a')](_0x109d9c)[_0xf3b6('0x1b')](_0x2ae9b7);}};}function respondWithFilteredResult(_0x20b2b1,_0x56844e){return function(_0x42bd77){if(_0x42bd77){var _0x5c30d7=typeof _0x56844e[_0xf3b6('0x1c')]===_0xf3b6('0x1d')&&typeof _0x56844e[_0xf3b6('0x1e')]===_0xf3b6('0x1d');var _0x5e2896=_0x42bd77[_0xf3b6('0x1f')];var _0x3b77b2=_0x5c30d7?0x0:_0x56844e['offset'];var _0x17ac35=_0x5c30d7?_0x42bd77[_0xf3b6('0x1f')]:_0x56844e[_0xf3b6('0x1c')]+_0x56844e['limit'];var _0x290149;if(_0x17ac35>=_0x5e2896){_0x17ac35=_0x5e2896;_0x290149=0xc8;}else{_0x290149=0xce;}_0x20b2b1[_0xf3b6('0x1a')](_0x290149);return _0x20b2b1[_0xf3b6('0x20')]('Content-Range',_0x3b77b2+'-'+_0x17ac35+'/'+_0x5e2896)[_0xf3b6('0x1b')](_0x42bd77);}return null;};}function patchUpdates(_0x2898e2){return function(_0xa43c97){try{jsonpatch[_0xf3b6('0x21')](_0xa43c97,_0x2898e2,!![]);}catch(_0x5c9de1){return BPromise[_0xf3b6('0x22')](_0x5c9de1);}return _0xa43c97[_0xf3b6('0x23')]();};}function saveUpdates(_0x46261f,_0x100970){return function(_0x4763df){if(_0x4763df){return _0x4763df[_0xf3b6('0x24')](_0x46261f)['then'](function(_0x1beea7){return _0x1beea7;});}return null;};}function removeEntity(_0x4a52da,_0x510b2a){return function(_0x44e067){if(_0x44e067){return _0x44e067['destroy']()[_0xf3b6('0x25')](function(){_0x4a52da[_0xf3b6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f945,_0xd56ed2){return function(_0x2dd3d0){if(!_0x2dd3d0){_0x21f945['sendStatus'](0x194);}return _0x2dd3d0;};}function handleError(_0x848ca9,_0x563c19){_0x563c19=_0x563c19||0x1f4;return function(_0x2c0b3d){logger[_0xf3b6('0x26')](_0x2c0b3d[_0xf3b6('0x27')]);if(_0x2c0b3d[_0xf3b6('0x28')]){delete _0x2c0b3d[_0xf3b6('0x28')];}_0x848ca9[_0xf3b6('0x1a')](_0x563c19)[_0xf3b6('0x29')](_0x2c0b3d);};}exports[_0xf3b6('0x2a')]=function(_0x41a62c,_0x502377){var _0x36b289={},_0x3187b2={},_0x3129fc={'count':0x0,'rows':[]};var _0x172215=_['map'](db['MailTransferReport'][_0xf3b6('0x2b')],function(_0x253aee){return{'name':_0x253aee[_0xf3b6('0x2c')],'type':_0x253aee[_0xf3b6('0x2d')]['key']};});_0x3187b2[_0xf3b6('0x2e')]=_['map'](_0x172215,_0xf3b6('0x28'));_0x3187b2[_0xf3b6('0x2f')]=_[_0xf3b6('0x30')](_0x41a62c[_0xf3b6('0x2f')]);_0x3187b2[_0xf3b6('0x31')]=_[_0xf3b6('0x32')](_0x3187b2[_0xf3b6('0x2e')],_0x3187b2[_0xf3b6('0x2f')]);_0x36b289['attributes']=_[_0xf3b6('0x32')](_0x3187b2[_0xf3b6('0x2e')],qs[_0xf3b6('0x33')](_0x41a62c[_0xf3b6('0x2f')]['fields']));_0x36b289[_0xf3b6('0x34')]=_0x36b289[_0xf3b6('0x34')][_0xf3b6('0x35')]?_0x36b289[_0xf3b6('0x34')]:_0x3187b2[_0xf3b6('0x2e')];if(!_0x41a62c[_0xf3b6('0x2f')][_0xf3b6('0x36')](_0xf3b6('0x37'))){_0x36b289[_0xf3b6('0x1e')]=qs['limit'](_0x41a62c[_0xf3b6('0x2f')][_0xf3b6('0x1e')]);_0x36b289[_0xf3b6('0x1c')]=qs[_0xf3b6('0x1c')](_0x41a62c[_0xf3b6('0x2f')][_0xf3b6('0x1c')]);}_0x36b289[_0xf3b6('0x38')]=qs[_0xf3b6('0x39')](_0x41a62c[_0xf3b6('0x2f')][_0xf3b6('0x39')]);_0x36b289[_0xf3b6('0x3a')]=qs[_0xf3b6('0x31')](_[_0xf3b6('0x3b')](_0x41a62c[_0xf3b6('0x2f')],_0x3187b2[_0xf3b6('0x31')]),_0x172215);if(_0x41a62c[_0xf3b6('0x2f')][_0xf3b6('0x3c')]){_0x36b289[_0xf3b6('0x3a')]=_['merge'](_0x36b289[_0xf3b6('0x3a')],{'$or':_[_0xf3b6('0x3d')](_0x172215,function(_0x1d3931){if(_0x1d3931[_0xf3b6('0x2d')]!==_0xf3b6('0x3e')){var _0x48d599={};_0x48d599[_0x1d3931['name']]={'$like':'%'+_0x41a62c[_0xf3b6('0x2f')][_0xf3b6('0x3c')]+'%'};return _0x48d599;}})});}_0x36b289=_[_0xf3b6('0x3f')]({},_0x36b289,_0x41a62c[_0xf3b6('0x40')]);var _0x1d8467={'where':_0x36b289[_0xf3b6('0x3a')]};return db[_0xf3b6('0x41')][_0xf3b6('0x1f')](_0x1d8467)[_0xf3b6('0x25')](function(_0x38987f){_0x3129fc[_0xf3b6('0x1f')]=_0x38987f;if(_0x41a62c[_0xf3b6('0x2f')][_0xf3b6('0x42')]){_0x36b289['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xf3b6('0x43')](_0x36b289);})[_0xf3b6('0x25')](function(_0x235dec){_0x3129fc[_0xf3b6('0x44')]=_0x235dec;return _0x3129fc;})[_0xf3b6('0x25')](respondWithFilteredResult(_0x502377,_0x36b289))[_0xf3b6('0x45')](handleError(_0x502377,null));};exports[_0xf3b6('0x46')]=function(_0x57392e,_0x2b7796){var _0x1c8a06={'raw':!![],'where':{'id':_0x57392e[_0xf3b6('0x47')]['id']}},_0x2a8805={};_0x2a8805['model']=_['keys'](db[_0xf3b6('0x41')]['rawAttributes']);_0x2a8805['query']=_[_0xf3b6('0x30')](_0x57392e[_0xf3b6('0x2f')]);_0x2a8805['filters']=_[_0xf3b6('0x32')](_0x2a8805[_0xf3b6('0x2e')],_0x2a8805[_0xf3b6('0x2f')]);_0x1c8a06[_0xf3b6('0x34')]=_['intersection'](_0x2a8805[_0xf3b6('0x2e')],qs['fields'](_0x57392e[_0xf3b6('0x2f')]['fields']));_0x1c8a06[_0xf3b6('0x34')]=_0x1c8a06['attributes'][_0xf3b6('0x35')]?_0x1c8a06[_0xf3b6('0x34')]:_0x2a8805[_0xf3b6('0x2e')];if(_0x57392e[_0xf3b6('0x2f')][_0xf3b6('0x42')]){_0x1c8a06['include']=[{'all':!![]}];}_0x1c8a06=_[_0xf3b6('0x3f')]({},_0x1c8a06,_0x57392e['options']);return db['MailTransferReport'][_0xf3b6('0x48')](_0x1c8a06)[_0xf3b6('0x25')](handleEntityNotFound(_0x2b7796,null))[_0xf3b6('0x25')](respondWithResult(_0x2b7796,null))['catch'](handleError(_0x2b7796,null));};exports['create']=function(_0xc996aa,_0x210d69){return db[_0xf3b6('0x41')][_0xf3b6('0x49')](_0xc996aa[_0xf3b6('0x4a')],{})[_0xf3b6('0x25')](respondWithResult(_0x210d69,0xc9))[_0xf3b6('0x45')](handleError(_0x210d69,null));};exports[_0xf3b6('0x24')]=function(_0x27402e,_0x265cab){if(_0x27402e[_0xf3b6('0x4a')]['id']){delete _0x27402e['body']['id'];}return db[_0xf3b6('0x41')][_0xf3b6('0x48')]({'where':{'id':_0x27402e[_0xf3b6('0x47')]['id']}})[_0xf3b6('0x25')](handleEntityNotFound(_0x265cab,null))[_0xf3b6('0x25')](saveUpdates(_0x27402e[_0xf3b6('0x4a')],null))[_0xf3b6('0x25')](respondWithResult(_0x265cab,null))[_0xf3b6('0x45')](handleError(_0x265cab,null));};exports[_0xf3b6('0x4b')]=function(_0x1adb6c,_0x2a414f){return db['MailTransferReport']['find']({'where':{'id':_0x1adb6c[_0xf3b6('0x47')]['id']}})[_0xf3b6('0x25')](handleEntityNotFound(_0x2a414f,null))[_0xf3b6('0x25')](removeEntity(_0x2a414f,null))[_0xf3b6('0x45')](handleError(_0x2a414f,null));};exports[_0xf3b6('0x4c')]=function(_0x49eddd,_0x5a73c5){return db[_0xf3b6('0x41')][_0xf3b6('0x4c')]()[_0xf3b6('0x25')](respondWithResult(_0x5a73c5,null))[_0xf3b6('0x45')](handleError(_0x5a73c5,null));}; \ No newline at end of file +var _0x048a=['status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','MailTransferReport','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x048a,0x1ac));var _0xa048=function(_0x3befb4,_0x45ebe8){_0x3befb4=_0x3befb4-0x0;var _0x3da2b6=_0x048a[_0x3befb4];return _0x3da2b6;};'use strict';var emlformat=require(_0xa048('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa048('0x1'));var jsonpatch=require(_0xa048('0x2'));var rp=require(_0xa048('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa048('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa048('0x5'));var csv=require('to-csv');var ejs=require(_0xa048('0x6'));var fs=require('fs');var fs_extra=require(_0xa048('0x7'));var _=require(_0xa048('0x8'));var squel=require('squel');var crypto=require(_0xa048('0x9'));var jsforce=require(_0xa048('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa048('0xb'));var Papa=require(_0xa048('0xc'));var Redis=require(_0xa048('0xd'));var authService=require(_0xa048('0xe'));var qs=require(_0xa048('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa048('0x10'));var logger=require('../../config/logger')(_0xa048('0x11'));var utils=require(_0xa048('0x12'));var config=require(_0xa048('0x13'));var licenseUtil=require(_0xa048('0x14'));var db=require(_0xa048('0x15'))['db'];function respondWithStatusCode(_0x3618d8,_0x778215){_0x778215=_0x778215||0xcc;return function(_0x58d219){if(_0x58d219){return _0x3618d8['sendStatus'](_0x778215);}return _0x3618d8[_0xa048('0x16')](_0x778215)[_0xa048('0x17')]();};}function respondWithResult(_0x4d52b7,_0x14e405){_0x14e405=_0x14e405||0xc8;return function(_0x7d6cb){if(_0x7d6cb){return _0x4d52b7['status'](_0x14e405)[_0xa048('0x18')](_0x7d6cb);}};}function respondWithFilteredResult(_0x291f9b,_0x54e107){return function(_0x1b0772){if(_0x1b0772){var _0x5bacda=typeof _0x54e107['offset']===_0xa048('0x19')&&typeof _0x54e107[_0xa048('0x1a')]===_0xa048('0x19');var _0x30b7cc=_0x1b0772[_0xa048('0x1b')];var _0x21fb1d=_0x5bacda?0x0:_0x54e107['offset'];var _0x26c7ba=_0x5bacda?_0x1b0772['count']:_0x54e107[_0xa048('0x1c')]+_0x54e107[_0xa048('0x1a')];var _0x470660;if(_0x26c7ba>=_0x30b7cc){_0x26c7ba=_0x30b7cc;_0x470660=0xc8;}else{_0x470660=0xce;}_0x291f9b[_0xa048('0x16')](_0x470660);return _0x291f9b[_0xa048('0x1d')](_0xa048('0x1e'),_0x21fb1d+'-'+_0x26c7ba+'/'+_0x30b7cc)[_0xa048('0x18')](_0x1b0772);}return null;};}function patchUpdates(_0x158e9f){return function(_0x58a2e0){try{jsonpatch['apply'](_0x58a2e0,_0x158e9f,!![]);}catch(_0x51a809){return BPromise[_0xa048('0x1f')](_0x51a809);}return _0x58a2e0[_0xa048('0x20')]();};}function saveUpdates(_0x4f0f25,_0x36f430){return function(_0x125207){if(_0x125207){return _0x125207['update'](_0x4f0f25)[_0xa048('0x21')](function(_0x3ec8b7){return _0x3ec8b7;});}return null;};}function removeEntity(_0x5e4b81,_0x1aa13e){return function(_0x4dbb1b){if(_0x4dbb1b){return _0x4dbb1b[_0xa048('0x22')]()[_0xa048('0x21')](function(){_0x5e4b81[_0xa048('0x16')](0xcc)[_0xa048('0x17')]();});}};}function handleEntityNotFound(_0x13eec9,_0x31d2d6){return function(_0x540cb4){if(!_0x540cb4){_0x13eec9['sendStatus'](0x194);}return _0x540cb4;};}function handleError(_0x44efcc,_0x188768){_0x188768=_0x188768||0x1f4;return function(_0x454126){logger[_0xa048('0x23')](_0x454126[_0xa048('0x24')]);if(_0x454126[_0xa048('0x25')]){delete _0x454126['name'];}_0x44efcc['status'](_0x188768)['send'](_0x454126);};}exports[_0xa048('0x26')]=function(_0x1af385,_0x438487){var _0x2697b9={},_0x4a6ff3={},_0x44acb0={'count':0x0,'rows':[]};var _0x232167=_[_0xa048('0x27')](db[_0xa048('0x28')]['rawAttributes'],function(_0xb271e4){return{'name':_0xb271e4[_0xa048('0x29')],'type':_0xb271e4[_0xa048('0x2a')][_0xa048('0x2b')]};});_0x4a6ff3[_0xa048('0x2c')]=_[_0xa048('0x27')](_0x232167,'name');_0x4a6ff3[_0xa048('0x2d')]=_[_0xa048('0x2e')](_0x1af385[_0xa048('0x2d')]);_0x4a6ff3['filters']=_['intersection'](_0x4a6ff3['model'],_0x4a6ff3['query']);_0x2697b9[_0xa048('0x2f')]=_[_0xa048('0x30')](_0x4a6ff3[_0xa048('0x2c')],qs['fields'](_0x1af385[_0xa048('0x2d')]['fields']));_0x2697b9[_0xa048('0x2f')]=_0x2697b9[_0xa048('0x2f')][_0xa048('0x31')]?_0x2697b9[_0xa048('0x2f')]:_0x4a6ff3[_0xa048('0x2c')];if(!_0x1af385[_0xa048('0x2d')][_0xa048('0x32')](_0xa048('0x33'))){_0x2697b9[_0xa048('0x1a')]=qs['limit'](_0x1af385[_0xa048('0x2d')][_0xa048('0x1a')]);_0x2697b9['offset']=qs[_0xa048('0x1c')](_0x1af385[_0xa048('0x2d')]['offset']);}_0x2697b9[_0xa048('0x34')]=qs[_0xa048('0x35')](_0x1af385[_0xa048('0x2d')][_0xa048('0x35')]);_0x2697b9['where']=qs[_0xa048('0x36')](_[_0xa048('0x37')](_0x1af385[_0xa048('0x2d')],_0x4a6ff3[_0xa048('0x36')]),_0x232167);if(_0x1af385[_0xa048('0x2d')][_0xa048('0x38')]){_0x2697b9[_0xa048('0x39')]=_[_0xa048('0x3a')](_0x2697b9[_0xa048('0x39')],{'$or':_[_0xa048('0x27')](_0x232167,function(_0x5bf243){if(_0x5bf243[_0xa048('0x2a')]!==_0xa048('0x3b')){var _0x1af820={};_0x1af820[_0x5bf243[_0xa048('0x25')]]={'$like':'%'+_0x1af385['query'][_0xa048('0x38')]+'%'};return _0x1af820;}})});}_0x2697b9=_[_0xa048('0x3a')]({},_0x2697b9,_0x1af385[_0xa048('0x3c')]);var _0x5d7af8={'where':_0x2697b9[_0xa048('0x39')]};return db[_0xa048('0x28')][_0xa048('0x1b')](_0x5d7af8)[_0xa048('0x21')](function(_0x1d37ae){_0x44acb0[_0xa048('0x1b')]=_0x1d37ae;if(_0x1af385['query'][_0xa048('0x3d')]){_0x2697b9[_0xa048('0x3e')]=[{'all':!![]}];}return db[_0xa048('0x28')][_0xa048('0x3f')](_0x2697b9);})[_0xa048('0x21')](function(_0x30a752){_0x44acb0[_0xa048('0x40')]=_0x30a752;return _0x44acb0;})[_0xa048('0x21')](respondWithFilteredResult(_0x438487,_0x2697b9))[_0xa048('0x41')](handleError(_0x438487,null));};exports[_0xa048('0x42')]=function(_0x2c7556,_0x2fab65){var _0x3b4056={'raw':!![],'where':{'id':_0x2c7556[_0xa048('0x43')]['id']}},_0x485e20={};_0x485e20[_0xa048('0x2c')]=_[_0xa048('0x2e')](db['MailTransferReport'][_0xa048('0x44')]);_0x485e20[_0xa048('0x2d')]=_[_0xa048('0x2e')](_0x2c7556['query']);_0x485e20[_0xa048('0x36')]=_[_0xa048('0x30')](_0x485e20[_0xa048('0x2c')],_0x485e20[_0xa048('0x2d')]);_0x3b4056['attributes']=_[_0xa048('0x30')](_0x485e20[_0xa048('0x2c')],qs[_0xa048('0x45')](_0x2c7556[_0xa048('0x2d')]['fields']));_0x3b4056['attributes']=_0x3b4056[_0xa048('0x2f')][_0xa048('0x31')]?_0x3b4056['attributes']:_0x485e20[_0xa048('0x2c')];if(_0x2c7556['query'][_0xa048('0x3d')]){_0x3b4056[_0xa048('0x3e')]=[{'all':!![]}];}_0x3b4056=_[_0xa048('0x3a')]({},_0x3b4056,_0x2c7556[_0xa048('0x3c')]);return db[_0xa048('0x28')]['find'](_0x3b4056)['then'](handleEntityNotFound(_0x2fab65,null))[_0xa048('0x21')](respondWithResult(_0x2fab65,null))['catch'](handleError(_0x2fab65,null));};exports[_0xa048('0x46')]=function(_0x4043e2,_0x445cae){return db['MailTransferReport'][_0xa048('0x46')](_0x4043e2[_0xa048('0x47')],{})[_0xa048('0x21')](respondWithResult(_0x445cae,0xc9))[_0xa048('0x41')](handleError(_0x445cae,null));};exports[_0xa048('0x48')]=function(_0x1c150d,_0x14f359){if(_0x1c150d[_0xa048('0x47')]['id']){delete _0x1c150d['body']['id'];}return db[_0xa048('0x28')][_0xa048('0x49')]({'where':{'id':_0x1c150d[_0xa048('0x43')]['id']}})[_0xa048('0x21')](handleEntityNotFound(_0x14f359,null))[_0xa048('0x21')](saveUpdates(_0x1c150d[_0xa048('0x47')],null))[_0xa048('0x21')](respondWithResult(_0x14f359,null))[_0xa048('0x41')](handleError(_0x14f359,null));};exports[_0xa048('0x22')]=function(_0x2260eb,_0x56ceb3){return db[_0xa048('0x28')]['find']({'where':{'id':_0x2260eb[_0xa048('0x43')]['id']}})[_0xa048('0x21')](handleEntityNotFound(_0x56ceb3,null))[_0xa048('0x21')](removeEntity(_0x56ceb3,null))[_0xa048('0x41')](handleError(_0x56ceb3,null));};exports[_0xa048('0x4a')]=function(_0x11370a,_0xbd90f8){return db[_0xa048('0x28')][_0xa048('0x4a')]()[_0xa048('0x21')](respondWithResult(_0xbd90f8,null))[_0xa048('0x41')](handleError(_0xbd90f8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 52806cf..10ee615 100644 --- a/server/api/mailTransferReport/mailTransferReport.model.js +++ b/server/api/mailTransferReport/mailTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x004c=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','report_mail_transfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x004c,0x85));var _0xc004=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x004c[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xc004('0x0'));var util=require(_0xc004('0x1'));var logger=require(_0xc004('0x2'))(_0xc004('0x3'));var moment=require('moment');var BPromise=require(_0xc004('0x4'));var rp=require(_0xc004('0x5'));var fs=require('fs');var path=require(_0xc004('0x6'));var rimraf=require(_0xc004('0x7'));var config=require('../../config/environment');var attributes=require(_0xc004('0x8'));module['exports']=function(_0x2c7142,_0x25a58b){return _0x2c7142[_0xc004('0x9')]('MailTransferReport',attributes,{'tableName':_0xc004('0xa'),'paranoid':![],'indexes':[{'name':_0xc004('0xb'),'fields':[_0xc004('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1fdc=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x43ee0a,_0x1acabe){var _0x45892a=function(_0x50c0b4){while(--_0x50c0b4){_0x43ee0a['push'](_0x43ee0a['shift']());}};_0x45892a(++_0x1acabe);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x1fdc[_0x5de532];return _0x4e9192;};'use strict';var _=require(_0xc1fd('0x0'));var util=require(_0xc1fd('0x1'));var logger=require('../../config/logger')(_0xc1fd('0x2'));var moment=require(_0xc1fd('0x3'));var BPromise=require(_0xc1fd('0x4'));var rp=require(_0xc1fd('0x5'));var fs=require('fs');var path=require(_0xc1fd('0x6'));var rimraf=require(_0xc1fd('0x7'));var config=require(_0xc1fd('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0xc1fd('0x9')]=function(_0x141dab,_0x43cd02){return _0x141dab[_0xc1fd('0xa')](_0xc1fd('0xb'),attributes,{'tableName':_0xc1fd('0xc'),'paranoid':![],'indexes':[{'name':_0xc1fd('0xd'),'fields':[_0xc1fd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7d2bdec..b81e26f 100644 --- a/server/api/mailTransferReport/mailTransferReport.rpc.js +++ b/server/api/mailTransferReport/mailTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x412f=['message','info','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xc74b23,_0x2e7efb){var _0x2f5e92=function(_0x4059cf){while(--_0x4059cf){_0xc74b23['push'](_0xc74b23['shift']());}};_0x2f5e92(++_0x2e7efb);}(_0x412f,0x133));var _0xf412=function(_0x463f3f,_0x43d78e){_0x463f3f=_0x463f3f-0x0;var _0x778ba1=_0x412f[_0x463f3f];return _0x778ba1;};'use strict';var _=require(_0xf412('0x0'));var util=require('util');var moment=require(_0xf412('0x1'));var BPromise=require(_0xf412('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf412('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf412('0x4'));var logger=require(_0xf412('0x5'))(_0xf412('0x6'));var config=require(_0xf412('0x7'));var jayson=require(_0xf412('0x8'));var client=jayson[_0xf412('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x537818,_0x3ca6c4,_0xda1868){return new BPromise(function(_0x5ddb38,_0x271832){return client['request'](_0x537818,_0xda1868)['then'](function(_0x1d948d){logger['info'](_0xf412('0xa'),_0x3ca6c4,_0xf412('0xb'));logger[_0xf412('0xc')](_0xf412('0xd'),_0x3ca6c4,_0xf412('0xb'),JSON['stringify'](_0x1d948d));if(_0x1d948d[_0xf412('0xe')]){if(_0x1d948d[_0xf412('0xe')][_0xf412('0xf')]===0x1f4){logger[_0xf412('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x3ca6c4,_0x1d948d[_0xf412('0xe')][_0xf412('0x10')]);return _0x271832(_0x1d948d[_0xf412('0xe')][_0xf412('0x10')]);}logger[_0xf412('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x3ca6c4,_0x1d948d[_0xf412('0xe')][_0xf412('0x10')]);return _0x5ddb38(_0x1d948d[_0xf412('0xe')][_0xf412('0x10')]);}else{logger[_0xf412('0x11')](_0xf412('0xa'),_0x3ca6c4,_0xf412('0xb'));_0x5ddb38(_0x1d948d[_0xf412('0x12')][_0xf412('0x10')]);}})['catch'](function(_0x26e375){logger[_0xf412('0xe')](_0xf412('0xa'),_0x3ca6c4,_0x26e375);_0x271832(_0x26e375);});});} \ No newline at end of file +var _0x8bc3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xcc9993,_0x4a89e4){var _0x3d75bc=function(_0x15334a){while(--_0x15334a){_0xcc9993['push'](_0xcc9993['shift']());}};_0x3d75bc(++_0x4a89e4);}(_0x8bc3,0x8a));var _0x38bc=function(_0x3366c5,_0x597f9a){_0x3366c5=_0x3366c5-0x0;var _0x18500d=_0x8bc3[_0x3366c5];return _0x18500d;};'use strict';var _=require(_0x38bc('0x0'));var util=require(_0x38bc('0x1'));var moment=require(_0x38bc('0x2'));var BPromise=require(_0x38bc('0x3'));var rs=require(_0x38bc('0x4'));var fs=require('fs');var Redis=require(_0x38bc('0x5'));var db=require(_0x38bc('0x6'))['db'];var utils=require(_0x38bc('0x7'));var logger=require(_0x38bc('0x8'))(_0x38bc('0x9'));var config=require('../../config/environment');var jayson=require(_0x38bc('0xa'));var client=jayson['client'][_0x38bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6117ad,_0x275645,_0x76f18){return new BPromise(function(_0x29e3a5,_0x5c8f15){return client['request'](_0x6117ad,_0x76f18)[_0x38bc('0xc')](function(_0x3c691a){logger[_0x38bc('0xd')](_0x38bc('0xe'),_0x275645,_0x38bc('0xf'));logger[_0x38bc('0x10')](_0x38bc('0x11'),_0x275645,_0x38bc('0xf'),JSON['stringify'](_0x3c691a));if(_0x3c691a[_0x38bc('0x12')]){if(_0x3c691a[_0x38bc('0x12')][_0x38bc('0x13')]===0x1f4){logger['error'](_0x38bc('0xe'),_0x275645,_0x3c691a[_0x38bc('0x12')]['message']);return _0x5c8f15(_0x3c691a[_0x38bc('0x12')][_0x38bc('0x14')]);}logger[_0x38bc('0x12')](_0x38bc('0xe'),_0x275645,_0x3c691a[_0x38bc('0x12')][_0x38bc('0x14')]);return _0x29e3a5(_0x3c691a['error'][_0x38bc('0x14')]);}else{logger[_0x38bc('0xd')](_0x38bc('0xe'),_0x275645,_0x38bc('0xf'));_0x29e3a5(_0x3c691a[_0x38bc('0x15')][_0x38bc('0x14')]);}})[_0x38bc('0x16')](function(_0x94ed1){logger[_0x38bc('0x12')](_0x38bc('0xe'),_0x275645,_0x94ed1);_0x5c8f15(_0x94ed1);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f92223b..594e3cb 100644 --- a/server/api/memberReport/index.js +++ b/server/api/memberReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95d0=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2aa25d,_0x49641c){var _0xe70e45=function(_0x45d9c7){while(--_0x45d9c7){_0x2aa25d['push'](_0x2aa25d['shift']());}};_0xe70e45(++_0x49641c);}(_0x95d0,0xd5));var _0x095d=function(_0x258c2e,_0x1f3f56){_0x258c2e=_0x258c2e-0x0;var _0x146403=_0x95d0[_0x258c2e];return _0x146403;};'use strict';var multer=require(_0x095d('0x0'));var util=require(_0x095d('0x1'));var path=require(_0x095d('0x2'));var timeout=require(_0x095d('0x3'));var express=require(_0x095d('0x4'));var router=express[_0x095d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x095d('0x6'));var interaction=require(_0x095d('0x7'));var config=require(_0x095d('0x8'));var controller=require(_0x095d('0x9'));router[_0x095d('0xa')]('/',auth[_0x095d('0xb')](),controller[_0x095d('0xc')]);router[_0x095d('0xa')](_0x095d('0xd'),auth[_0x095d('0xb')](),controller[_0x095d('0xe')]);router[_0x095d('0xa')](_0x095d('0xf'),auth['isAuthenticated'](),controller[_0x095d('0x10')]);router[_0x095d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x095d('0x12')]('/:id',auth[_0x095d('0xb')](),controller[_0x095d('0x13')]);router[_0x095d('0x14')]('/:id',auth[_0x095d('0xb')](),controller[_0x095d('0x15')]);module[_0x095d('0x16')]=router; \ No newline at end of file +var _0xd68c=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x70b273,_0x34c5a0){var _0x72ac98=function(_0xcc7e43){while(--_0xcc7e43){_0x70b273['push'](_0x70b273['shift']());}};_0x72ac98(++_0x34c5a0);}(_0xd68c,0x12b));var _0xcd68=function(_0x5d9a79,_0x5e7dbe){_0x5d9a79=_0x5d9a79-0x0;var _0x33b88f=_0xd68c[_0x5d9a79];return _0x33b88f;};'use strict';var multer=require(_0xcd68('0x0'));var util=require(_0xcd68('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd68('0x2'));var router=express[_0xcd68('0x3')]();var fs_extra=require(_0xcd68('0x4'));var auth=require(_0xcd68('0x5'));var interaction=require(_0xcd68('0x6'));var config=require(_0xcd68('0x7'));var controller=require(_0xcd68('0x8'));router[_0xcd68('0x9')]('/',auth[_0xcd68('0xa')](),controller[_0xcd68('0xb')]);router[_0xcd68('0x9')](_0xcd68('0xc'),auth[_0xcd68('0xa')](),controller[_0xcd68('0xd')]);router[_0xcd68('0x9')](_0xcd68('0xe'),auth[_0xcd68('0xa')](),controller[_0xcd68('0xf')]);router[_0xcd68('0x10')]('/',auth[_0xcd68('0xa')](),controller[_0xcd68('0x11')]);router[_0xcd68('0x12')](_0xcd68('0xe'),auth[_0xcd68('0xa')](),controller[_0xcd68('0x13')]);router[_0xcd68('0x14')](_0xcd68('0xe'),auth[_0xcd68('0xa')](),controller[_0xcd68('0x15')]);module[_0xcd68('0x16')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 6fc47f8..4e660c8 100644 --- a/server/api/memberReport/memberReport.attributes.js +++ b/server/api/memberReport/memberReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f27=['talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0x53e0f1,_0x3bbca3){var _0x332f2a=function(_0x52c61f){while(--_0x52c61f){_0x53e0f1['push'](_0x53e0f1['shift']());}};_0x332f2a(++_0x3bbca3);}(_0x2f27,0x168));var _0x72f2=function(_0x35637e,_0x561d08){_0x35637e=_0x35637e-0x0;var _0x4afdb0=_0x2f27[_0x35637e];return _0x4afdb0;};'use strict';var Sequelize=require(_0x72f2('0x0'));var moment=require(_0x72f2('0x1'));module[_0x72f2('0x2')]={'channel':{'type':Sequelize[_0x72f2('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x72f2('0x3')]},'type':{'type':Sequelize[_0x72f2('0x3')],'defaultValue':_0x72f2('0x4'),'comment':_0x72f2('0x5')},'duration':{'type':Sequelize[_0x72f2('0x6')]},'enterAt':{'type':Sequelize[_0x72f2('0x7')]},'exitAt':{'type':Sequelize[_0x72f2('0x7')],'set':function(_0x202d4c){var _0x5f1044=moment(_0x202d4c);var _0x48ee8f=moment(this[_0x72f2('0x8')](_0x72f2('0x9')));var _0x9dfb8b=_0x5f1044[_0x72f2('0xa')](_0x48ee8f,_0x72f2('0xb'));this[_0x72f2('0xc')](_0x72f2('0xd'),_0x202d4c);this[_0x72f2('0xc')]('duration',_0x9dfb8b>=0x0?_0x9dfb8b:null);}},'data1':{'type':Sequelize[_0x72f2('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x72f2('0x3')],'comment':_0x72f2('0xe')},'data3':{'type':Sequelize[_0x72f2('0x3')],'comment':_0x72f2('0xf')},'data4':{'type':Sequelize[_0x72f2('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x72f2('0x10')},'role':{'type':Sequelize[_0x72f2('0x3')]},'internal':{'type':Sequelize[_0x72f2('0x6')]},'uniqueid':{'type':Sequelize[_0x72f2('0x3')]}}; \ No newline at end of file +var _0xaba6=['getDataValue','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DATE'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xaba6,0xdc));var _0x6aba=function(_0x41ba7c,_0x21b2bb){_0x41ba7c=_0x41ba7c-0x0;var _0xb1bf6a=_0xaba6[_0x41ba7c];return _0xb1bf6a;};'use strict';var Sequelize=require(_0x6aba('0x0'));var moment=require(_0x6aba('0x1'));module[_0x6aba('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6aba('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6aba('0x4')],'set':function(_0x289268){var _0x3e2571=moment(_0x289268);var _0x33da57=moment(this[_0x6aba('0x5')]('enterAt'));var _0x3573e6=_0x3e2571[_0x6aba('0x6')](_0x33da57,_0x6aba('0x7'));this[_0x6aba('0x8')](_0x6aba('0x9'),_0x289268);this[_0x6aba('0x8')]('duration',_0x3573e6>=0x0?_0x3573e6:null);}},'data1':{'type':Sequelize[_0x6aba('0x3')],'comment':_0x6aba('0xa')},'data2':{'type':Sequelize['STRING'],'comment':_0x6aba('0xb')},'data3':{'type':Sequelize[_0x6aba('0x3')],'comment':_0x6aba('0xc')},'data4':{'type':Sequelize[_0x6aba('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x6aba('0x3')],'comment':_0x6aba('0xd')},'role':{'type':Sequelize[_0x6aba('0x3')]},'internal':{'type':Sequelize[_0x6aba('0xe')]},'uniqueid':{'type':Sequelize[_0x6aba('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 3e3ce88..043452e 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','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','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x365c7c,_0x2f02ba){var _0x76bb19=function(_0x4ee352){while(--_0x4ee352){_0x365c7c['push'](_0x365c7c['shift']());}};_0x76bb19(++_0x2f02ba);}(_0x3e74,0x175));var _0x43e7=function(_0x261477,_0x33ca74){_0x261477=_0x261477-0x0;var _0x3bf580=_0x3e74[_0x261477];return _0x3bf580;};'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(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0xf0abc0,_0x3d3cdc){var _0x29fd55=function(_0x7b1b82){while(--_0x7b1b82){_0xf0abc0['push'](_0xf0abc0['shift']());}};_0x29fd55(++_0x3d3cdc);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6ad16c1..2e532fd 100644 --- a/server/api/memberReport/memberReport.model.js +++ b/server/api/memberReport/memberReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11ea=['membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','define','report_member','membername_interface'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x11ea,0x16e));var _0xa11e=function(_0x5b0074,_0x19fe3f){_0x5b0074=_0x5b0074-0x0;var _0x5458d9=_0x11ea[_0x5b0074];return _0x5458d9;};'use strict';var _=require(_0xa11e('0x0'));var util=require('util');var logger=require(_0xa11e('0x1'))(_0xa11e('0x2'));var moment=require(_0xa11e('0x3'));var BPromise=require(_0xa11e('0x4'));var rp=require(_0xa11e('0x5'));var fs=require('fs');var path=require(_0xa11e('0x6'));var rimraf=require(_0xa11e('0x7'));var config=require('../../config/environment');var attributes=require(_0xa11e('0x8'));module['exports']=function(_0x1934d9,_0x56b03e){return _0x1934d9[_0xa11e('0x9')]('MemberReport',attributes,{'tableName':_0xa11e('0xa'),'paranoid':![],'indexes':[{'name':_0xa11e('0xb'),'fields':[_0xa11e('0xc'),_0xa11e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4011=['moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api'];(function(_0x43b725,_0x3b3b86){var _0x35a401=function(_0x59a274){while(--_0x59a274){_0x43b725['push'](_0x43b725['shift']());}};_0x35a401(++_0x3b3b86);}(_0x4011,0x138));var _0x1401=function(_0x3cb004,_0x25d5d1){_0x3cb004=_0x3cb004-0x0;var _0x343ec2=_0x4011[_0x3cb004];return _0x343ec2;};'use strict';var _=require(_0x1401('0x0'));var util=require('util');var logger=require(_0x1401('0x1'))(_0x1401('0x2'));var moment=require(_0x1401('0x3'));var BPromise=require(_0x1401('0x4'));var rp=require(_0x1401('0x5'));var fs=require('fs');var path=require(_0x1401('0x6'));var rimraf=require('rimraf');var config=require(_0x1401('0x7'));var attributes=require(_0x1401('0x8'));module[_0x1401('0x9')]=function(_0x3eca42,_0x4b4439){return _0x3eca42['define'](_0x1401('0xa'),attributes,{'tableName':_0x1401('0xb'),'paranoid':![],'indexes':[{'name':_0x1401('0xc'),'fields':[_0x1401('0xd'),_0x1401('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 92fa2d2..9e2d65c 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd3c=['findAll','options','raw','attributes','limit','map','include','model','stringify','CreateMemberReport','body','UpdateMemberReport','update','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport'];(function(_0x212fe7,_0x302599){var _0x2613da=function(_0x40311d){while(--_0x40311d){_0x212fe7['push'](_0x212fe7['shift']());}};_0x2613da(++_0x302599);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x3a1402,_0x522a8b){_0x3a1402=_0x3a1402-0x0;var _0x3bd96e=_0xbd3c[_0x3a1402];return _0x3bd96e;};'use strict';var _=require(_0xcbd3('0x0'));var util=require(_0xcbd3('0x1'));var moment=require(_0xcbd3('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbd3('0x3'));var fs=require('fs');var Redis=require(_0xcbd3('0x4'));var db=require(_0xcbd3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcbd3('0x6'));var config=require('../../config/environment');var jayson=require(_0xcbd3('0x7'));var client=jayson[_0xcbd3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x348468,_0x1c1483,_0x13b4aa){return new BPromise(function(_0x4b369b,_0x18fb60){return client[_0xcbd3('0x9')](_0x348468,_0x13b4aa)[_0xcbd3('0xa')](function(_0x64f732){logger[_0xcbd3('0xb')]('MemberReport,\x20%s,\x20%s',_0x1c1483,'request\x20sent');logger[_0xcbd3('0xc')](_0xcbd3('0xd'),_0x1c1483,'request\x20sent',JSON['stringify'](_0x64f732));if(_0x64f732['error']){if(_0x64f732[_0xcbd3('0xe')][_0xcbd3('0xf')]===0x1f4){logger[_0xcbd3('0xe')]('MemberReport,\x20%s,\x20%s',_0x1c1483,_0x64f732[_0xcbd3('0xe')][_0xcbd3('0x10')]);return _0x18fb60(_0x64f732[_0xcbd3('0xe')][_0xcbd3('0x10')]);}logger[_0xcbd3('0xe')](_0xcbd3('0x11'),_0x1c1483,_0x64f732['error'][_0xcbd3('0x10')]);return _0x4b369b(_0x64f732['error'][_0xcbd3('0x10')]);}else{logger[_0xcbd3('0xb')](_0xcbd3('0x11'),_0x1c1483,'request\x20sent');_0x4b369b(_0x64f732[_0xcbd3('0x12')]['message']);}})[_0xcbd3('0x13')](function(_0x5941a5){logger[_0xcbd3('0xe')](_0xcbd3('0x11'),_0x1c1483,_0x5941a5);_0x18fb60(_0x5941a5);});});}exports[_0xcbd3('0x14')]=function(_0x115336){var _0xb02b09=this;return new Promise(function(_0x4ee6a2,_0x4f0bd7){return db[_0xcbd3('0x15')][_0xcbd3('0x16')]({'raw':_0x115336[_0xcbd3('0x17')]?_0x115336['options'][_0xcbd3('0x18')]===undefined?!![]:![]:!![],'where':_0x115336['options']?_0x115336[_0xcbd3('0x17')]['where']||null:null,'attributes':_0x115336[_0xcbd3('0x17')]?_0x115336['options'][_0xcbd3('0x19')]||null:null,'limit':_0x115336['options']?_0x115336['options'][_0xcbd3('0x1a')]||null:null,'include':_0x115336[_0xcbd3('0x17')]?_0x115336[_0xcbd3('0x17')]['include']?_[_0xcbd3('0x1b')](_0x115336[_0xcbd3('0x17')][_0xcbd3('0x1c')],function(_0x334b34){return{'model':db[_0x334b34[_0xcbd3('0x1d')]],'as':_0x334b34['as'],'attributes':_0x334b34[_0xcbd3('0x19')],'include':_0x334b34[_0xcbd3('0x1c')]?_[_0xcbd3('0x1b')](_0x334b34['include'],function(_0x35fd76){return{'model':db[_0x35fd76['model']],'as':_0x35fd76['as'],'attributes':_0x35fd76[_0xcbd3('0x19')],'include':_0x35fd76['include']?_[_0xcbd3('0x1b')](_0x35fd76[_0xcbd3('0x1c')],function(_0x4fb411){return{'model':db[_0x4fb411[_0xcbd3('0x1d')]],'as':_0x4fb411['as'],'attributes':_0x4fb411['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbd3('0xa')](function(_0xb3ae68){logger[_0xcbd3('0xb')](_0xcbd3('0x14'),_0x115336);logger[_0xcbd3('0xc')](_0xcbd3('0x14'),_0x115336,JSON[_0xcbd3('0x1e')](_0xb3ae68));_0x4ee6a2(_0xb3ae68);})['catch'](function(_0x3b2186){logger[_0xcbd3('0xe')](_0xcbd3('0x14'),_0x3b2186[_0xcbd3('0x10')],_0x115336);_0x4f0bd7(_0xb02b09[_0xcbd3('0xe')](0x1f4,_0x3b2186[_0xcbd3('0x10')]));});});};exports[_0xcbd3('0x1f')]=function(_0x15ed47){var _0x2df328=this;return new Promise(function(_0x58ac9c,_0x1bb1f3){return db['MemberReport']['create'](_0x15ed47[_0xcbd3('0x20')],{'raw':_0x15ed47[_0xcbd3('0x17')]?_0x15ed47[_0xcbd3('0x17')][_0xcbd3('0x18')]===undefined?!![]:![]:!![]})[_0xcbd3('0xa')](function(_0x9a7873){logger[_0xcbd3('0xb')]('CreateMemberReport',_0x15ed47);logger[_0xcbd3('0xc')]('CreateMemberReport',_0x15ed47,JSON[_0xcbd3('0x1e')](_0x9a7873));_0x58ac9c(_0x9a7873);})[_0xcbd3('0x13')](function(_0x3c2b0e){logger[_0xcbd3('0xe')](_0xcbd3('0x1f'),_0x3c2b0e[_0xcbd3('0x10')],_0x15ed47);_0x1bb1f3(_0x2df328[_0xcbd3('0xe')](0x1f4,_0x3c2b0e[_0xcbd3('0x10')]));});});};exports[_0xcbd3('0x21')]=function(_0x53b1a8){var _0x546756=this;return new Promise(function(_0x13da4f,_0x5a5d74){return db[_0xcbd3('0x15')][_0xcbd3('0x22')](_0x53b1a8[_0xcbd3('0x20')],{'raw':_0x53b1a8[_0xcbd3('0x17')]?_0x53b1a8[_0xcbd3('0x17')][_0xcbd3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53b1a8['options']?_0x53b1a8[_0xcbd3('0x17')][_0xcbd3('0x23')]||null:null,'attributes':_0x53b1a8['options']?_0x53b1a8[_0xcbd3('0x17')]['attributes']||null:null,'limit':_0x53b1a8[_0xcbd3('0x17')]?_0x53b1a8[_0xcbd3('0x17')][_0xcbd3('0x1a')]||null:null})[_0xcbd3('0xa')](function(_0x55147f){logger['info'](_0xcbd3('0x21'),_0x53b1a8);logger['debug'](_0xcbd3('0x21'),_0x53b1a8,JSON[_0xcbd3('0x1e')](_0x55147f));_0x13da4f(_0x55147f);})[_0xcbd3('0x13')](function(_0x4a2449){logger[_0xcbd3('0xe')](_0xcbd3('0x21'),_0x4a2449['message'],_0x53b1a8);_0x5a5d74(_0x546756[_0xcbd3('0xe')](0x1f4,_0x4a2449[_0xcbd3('0x10')]));});});}; \ No newline at end of file +var _0xfc46=['raw','UpdateMemberReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','findAll','options','where','attributes','limit','map','include','model','CreateMemberReport','MemberReport','create','body'];(function(_0x3ca2e6,_0x130f0f){var _0x3f2909=function(_0x133112){while(--_0x133112){_0x3ca2e6['push'](_0x3ca2e6['shift']());}};_0x3f2909(++_0x130f0f);}(_0xfc46,0x9a));var _0x6fc4=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0xfc46[_0x8bb4c1];return _0x67a6e1;};'use strict';var _=require(_0x6fc4('0x0'));var util=require('util');var moment=require(_0x6fc4('0x1'));var BPromise=require(_0x6fc4('0x2'));var rs=require(_0x6fc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fc4('0x4'))['db'];var utils=require(_0x6fc4('0x5'));var logger=require(_0x6fc4('0x6'))(_0x6fc4('0x7'));var config=require('../../config/environment');var jayson=require(_0x6fc4('0x8'));var client=jayson[_0x6fc4('0x9')][_0x6fc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x454abb,_0x31e6c7,_0x241761){return new BPromise(function(_0x56cee3,_0x1fcd95){return client['request'](_0x454abb,_0x241761)[_0x6fc4('0xb')](function(_0x2fad80){logger['info'](_0x6fc4('0xc'),_0x31e6c7,_0x6fc4('0xd'));logger[_0x6fc4('0xe')](_0x6fc4('0xf'),_0x31e6c7,_0x6fc4('0xd'),JSON[_0x6fc4('0x10')](_0x2fad80));if(_0x2fad80[_0x6fc4('0x11')]){if(_0x2fad80[_0x6fc4('0x11')][_0x6fc4('0x12')]===0x1f4){logger[_0x6fc4('0x11')](_0x6fc4('0xc'),_0x31e6c7,_0x2fad80[_0x6fc4('0x11')][_0x6fc4('0x13')]);return _0x1fcd95(_0x2fad80[_0x6fc4('0x11')][_0x6fc4('0x13')]);}logger[_0x6fc4('0x11')](_0x6fc4('0xc'),_0x31e6c7,_0x2fad80['error']['message']);return _0x56cee3(_0x2fad80[_0x6fc4('0x11')][_0x6fc4('0x13')]);}else{logger[_0x6fc4('0x14')](_0x6fc4('0xc'),_0x31e6c7,_0x6fc4('0xd'));_0x56cee3(_0x2fad80[_0x6fc4('0x15')][_0x6fc4('0x13')]);}})[_0x6fc4('0x16')](function(_0x1d51b1){logger['error'](_0x6fc4('0xc'),_0x31e6c7,_0x1d51b1);_0x1fcd95(_0x1d51b1);});});}exports[_0x6fc4('0x17')]=function(_0x5d61c7){var _0x5b4b71=this;return new Promise(function(_0x2bc789,_0x21c901){return db['MemberReport'][_0x6fc4('0x18')]({'raw':_0x5d61c7[_0x6fc4('0x19')]?_0x5d61c7[_0x6fc4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5d61c7[_0x6fc4('0x19')]?_0x5d61c7[_0x6fc4('0x19')][_0x6fc4('0x1a')]||null:null,'attributes':_0x5d61c7['options']?_0x5d61c7[_0x6fc4('0x19')][_0x6fc4('0x1b')]||null:null,'limit':_0x5d61c7['options']?_0x5d61c7['options'][_0x6fc4('0x1c')]||null:null,'include':_0x5d61c7['options']?_0x5d61c7['options']['include']?_[_0x6fc4('0x1d')](_0x5d61c7[_0x6fc4('0x19')][_0x6fc4('0x1e')],function(_0x59d809){return{'model':db[_0x59d809[_0x6fc4('0x1f')]],'as':_0x59d809['as'],'attributes':_0x59d809[_0x6fc4('0x1b')],'include':_0x59d809['include']?_[_0x6fc4('0x1d')](_0x59d809[_0x6fc4('0x1e')],function(_0x2b9811){return{'model':db[_0x2b9811[_0x6fc4('0x1f')]],'as':_0x2b9811['as'],'attributes':_0x2b9811[_0x6fc4('0x1b')],'include':_0x2b9811[_0x6fc4('0x1e')]?_[_0x6fc4('0x1d')](_0x2b9811[_0x6fc4('0x1e')],function(_0x2e7fde){return{'model':db[_0x2e7fde[_0x6fc4('0x1f')]],'as':_0x2e7fde['as'],'attributes':_0x2e7fde[_0x6fc4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6fc4('0xb')](function(_0x37d90f){logger['info'](_0x6fc4('0x17'),_0x5d61c7);logger[_0x6fc4('0xe')](_0x6fc4('0x17'),_0x5d61c7,JSON[_0x6fc4('0x10')](_0x37d90f));_0x2bc789(_0x37d90f);})[_0x6fc4('0x16')](function(_0x21e2d7){logger[_0x6fc4('0x11')](_0x6fc4('0x17'),_0x21e2d7[_0x6fc4('0x13')],_0x5d61c7);_0x21c901(_0x5b4b71[_0x6fc4('0x11')](0x1f4,_0x21e2d7[_0x6fc4('0x13')]));});});};exports[_0x6fc4('0x20')]=function(_0x5d9b7c){var _0x23d762=this;return new Promise(function(_0x5d9a9d,_0x4952d5){return db[_0x6fc4('0x21')][_0x6fc4('0x22')](_0x5d9b7c[_0x6fc4('0x23')],{'raw':_0x5d9b7c[_0x6fc4('0x19')]?_0x5d9b7c[_0x6fc4('0x19')][_0x6fc4('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x3b33ca){logger[_0x6fc4('0x14')](_0x6fc4('0x20'),_0x5d9b7c);logger[_0x6fc4('0xe')](_0x6fc4('0x20'),_0x5d9b7c,JSON[_0x6fc4('0x10')](_0x3b33ca));_0x5d9a9d(_0x3b33ca);})[_0x6fc4('0x16')](function(_0x26a0c6){logger['error'](_0x6fc4('0x20'),_0x26a0c6[_0x6fc4('0x13')],_0x5d9b7c);_0x4952d5(_0x23d762[_0x6fc4('0x11')](0x1f4,_0x26a0c6[_0x6fc4('0x13')]));});});};exports[_0x6fc4('0x25')]=function(_0x16cdbd){var _0x22156f=this;return new Promise(function(_0x96efbe,_0x3a11cd){return db['MemberReport']['update'](_0x16cdbd[_0x6fc4('0x23')],{'raw':_0x16cdbd[_0x6fc4('0x19')]?_0x16cdbd[_0x6fc4('0x19')][_0x6fc4('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16cdbd[_0x6fc4('0x19')]?_0x16cdbd[_0x6fc4('0x19')]['where']||null:null,'attributes':_0x16cdbd[_0x6fc4('0x19')]?_0x16cdbd[_0x6fc4('0x19')][_0x6fc4('0x1b')]||null:null,'limit':_0x16cdbd[_0x6fc4('0x19')]?_0x16cdbd[_0x6fc4('0x19')][_0x6fc4('0x1c')]||null:null})[_0x6fc4('0xb')](function(_0x20c009){logger[_0x6fc4('0x14')](_0x6fc4('0x25'),_0x16cdbd);logger[_0x6fc4('0xe')](_0x6fc4('0x25'),_0x16cdbd,JSON[_0x6fc4('0x10')](_0x20c009));_0x96efbe(_0x20c009);})[_0x6fc4('0x16')](function(_0x5a4946){logger[_0x6fc4('0x11')](_0x6fc4('0x25'),_0x5a4946[_0x6fc4('0x13')],_0x16cdbd);_0x3a11cd(_0x22156f['error'](0x1f4,_0x5a4946[_0x6fc4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index cc8fa01..e48664a 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x369c=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x369c,0x151));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc369('0x0'));var util=require(_0xc369('0x1'));var path=require(_0xc369('0x2'));var timeout=require(_0xc369('0x3'));var express=require('express');var router=express[_0xc369('0x4')]();var fs_extra=require(_0xc369('0x5'));var auth=require(_0xc369('0x6'));var interaction=require(_0xc369('0x7'));var config=require(_0xc369('0x8'));var controller=require('./migration.controller');router[_0xc369('0x9')]('/',controller[_0xc369('0xa')]);module[_0xc369('0xb')]=router; \ No newline at end of file +var _0x161d=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x4e79b8,_0x4dea29){var _0x5849ea=function(_0x3668b1){while(--_0x3668b1){_0x4e79b8['push'](_0x4e79b8['shift']());}};_0x5849ea(++_0x4dea29);}(_0x161d,0x65));var _0xd161=function(_0x13df68,_0x24f19b){_0x13df68=_0x13df68-0x0;var _0x32de17=_0x161d[_0x13df68];return _0x32de17;};'use strict';var multer=require(_0xd161('0x0'));var util=require(_0xd161('0x1'));var path=require(_0xd161('0x2'));var timeout=require(_0xd161('0x3'));var express=require(_0xd161('0x4'));var router=express[_0xd161('0x5')]();var fs_extra=require(_0xd161('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd161('0x7'));var config=require(_0xd161('0x8'));var controller=require(_0xd161('0x9'));router[_0xd161('0xa')]('/',controller[_0xd161('0xb')]);module[_0xd161('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 8fb8503..06e36a2 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f1e=['exports','version'];(function(_0x28e30a,_0x385c22){var _0x714951=function(_0x119d8){while(--_0x119d8){_0x28e30a['push'](_0x28e30a['shift']());}};_0x714951(++_0x385c22);}(_0x0f1e,0x1f4));var _0xe0f1=function(_0x447725,_0x49753b){_0x447725=_0x447725-0x0;var _0x399167=_0x0f1e[_0x447725];return _0x399167;};'use strict';var Sequelize=require('sequelize');module[_0xe0f1('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xe0f1('0x1')}}; \ No newline at end of file +var _0x7394=['sequelize','exports'];(function(_0x15b563,_0x374cb8){var _0x435aba=function(_0x4ce880){while(--_0x4ce880){_0x15b563['push'](_0x15b563['shift']());}};_0x435aba(++_0x374cb8);}(_0x7394,0x168));var _0x4739=function(_0x3553d9,_0x7ddcd5){_0x3553d9=_0x3553d9-0x0;var _0x21de6c=_0x7394[_0x3553d9];return _0x21de6c;};'use strict';var Sequelize=require(_0x4739('0x0'));module[_0x4739('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2b57f2c..7292756 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22a6=['count','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','limit','set','Content-Range','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','Migration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options'];(function(_0xba4fdd,_0x5620b6){var _0x103499=function(_0x4534a4){while(--_0x4534a4){_0xba4fdd['push'](_0xba4fdd['shift']());}};_0x103499(++_0x5620b6);}(_0x22a6,0x1f0));var _0x622a=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x22a6[_0x576266];return _0x18234f;};'use strict';var emlformat=require(_0x622a('0x0'));var rimraf=require(_0x622a('0x1'));var zipdir=require(_0x622a('0x2'));var jsonpatch=require(_0x622a('0x3'));var rp=require(_0x622a('0x4'));var moment=require('moment');var BPromise=require(_0x622a('0x5'));var Mustache=require(_0x622a('0x6'));var util=require(_0x622a('0x7'));var path=require(_0x622a('0x8'));var sox=require(_0x622a('0x9'));var csv=require('to-csv');var ejs=require(_0x622a('0xa'));var fs=require('fs');var fs_extra=require(_0x622a('0xb'));var _=require(_0x622a('0xc'));var squel=require(_0x622a('0xd'));var crypto=require(_0x622a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x622a('0xf'));var toCsv=require(_0x622a('0x10'));var querystring=require(_0x622a('0x11'));var Papa=require(_0x622a('0x12'));var Redis=require(_0x622a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x622a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x622a('0x15'));var logger=require(_0x622a('0x16'))(_0x622a('0x17'));var utils=require('../../config/utils');var config=require(_0x622a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d4669,_0x180292){_0x180292=_0x180292||0xcc;return function(_0x118075){if(_0x118075){return _0x3d4669['sendStatus'](_0x180292);}return _0x3d4669[_0x622a('0x19')](_0x180292)['end']();};}function respondWithResult(_0x42a1f8,_0x59eb7d){_0x59eb7d=_0x59eb7d||0xc8;return function(_0x5c40f0){if(_0x5c40f0){return _0x42a1f8['status'](_0x59eb7d)[_0x622a('0x1a')](_0x5c40f0);}};}function respondWithFilteredResult(_0x163cb2,_0x18adb0){return function(_0x2ddeeb){if(_0x2ddeeb){var _0xed6f0e=typeof _0x18adb0[_0x622a('0x1b')]==='undefined'&&typeof _0x18adb0[_0x622a('0x1c')]==='undefined';var _0x1df9e2=_0x2ddeeb['count'];var _0x2200b2=_0xed6f0e?0x0:_0x18adb0[_0x622a('0x1b')];var _0x52cfb7=_0xed6f0e?_0x2ddeeb['count']:_0x18adb0[_0x622a('0x1b')]+_0x18adb0[_0x622a('0x1c')];var _0x334286;if(_0x52cfb7>=_0x1df9e2){_0x52cfb7=_0x1df9e2;_0x334286=0xc8;}else{_0x334286=0xce;}_0x163cb2[_0x622a('0x19')](_0x334286);return _0x163cb2[_0x622a('0x1d')](_0x622a('0x1e'),_0x2200b2+'-'+_0x52cfb7+'/'+_0x1df9e2)['json'](_0x2ddeeb);}return null;};}function patchUpdates(_0x19a92f){return function(_0x4a35db){try{jsonpatch['apply'](_0x4a35db,_0x19a92f,!![]);}catch(_0x20e38c){return BPromise['reject'](_0x20e38c);}return _0x4a35db[_0x622a('0x1f')]();};}function saveUpdates(_0x27076a,_0x4de5ad){return function(_0x1f9f97){if(_0x1f9f97){return _0x1f9f97[_0x622a('0x20')](_0x27076a)[_0x622a('0x21')](function(_0x4df30f){return _0x4df30f;});}return null;};}function removeEntity(_0x1368f2,_0xa32753){return function(_0xd3132c){if(_0xd3132c){return _0xd3132c[_0x622a('0x22')]()[_0x622a('0x21')](function(){_0x1368f2[_0x622a('0x19')](0xcc)[_0x622a('0x23')]();});}};}function handleEntityNotFound(_0x54d8e5,_0x2a8969){return function(_0x14ac6a){if(!_0x14ac6a){_0x54d8e5[_0x622a('0x24')](0x194);}return _0x14ac6a;};}function handleError(_0x381caf,_0x2ef880){_0x2ef880=_0x2ef880||0x1f4;return function(_0x3869bd){logger[_0x622a('0x25')](_0x3869bd[_0x622a('0x26')]);if(_0x3869bd[_0x622a('0x27')]){delete _0x3869bd[_0x622a('0x27')];}_0x381caf[_0x622a('0x19')](_0x2ef880)[_0x622a('0x28')](_0x3869bd);};}exports[_0x622a('0x29')]=function(_0x21eb53,_0x3fd4ab){var _0x329e3f={},_0x35b66e={},_0x5e8fab={'count':0x0,'rows':[]};var _0x300fb9=_['map'](db[_0x622a('0x2a')][_0x622a('0x2b')],function(_0x27a31c){return{'name':_0x27a31c['fieldName'],'type':_0x27a31c[_0x622a('0x2c')][_0x622a('0x2d')]};});_0x35b66e[_0x622a('0x2e')]=_['map'](_0x300fb9,'name');_0x35b66e[_0x622a('0x2f')]=_[_0x622a('0x30')](_0x21eb53[_0x622a('0x2f')]);_0x35b66e[_0x622a('0x31')]=_[_0x622a('0x32')](_0x35b66e['model'],_0x35b66e[_0x622a('0x2f')]);_0x329e3f[_0x622a('0x33')]=_[_0x622a('0x32')](_0x35b66e['model'],qs[_0x622a('0x34')](_0x21eb53['query'][_0x622a('0x34')]));_0x329e3f[_0x622a('0x33')]=_0x329e3f[_0x622a('0x33')][_0x622a('0x35')]?_0x329e3f[_0x622a('0x33')]:_0x35b66e[_0x622a('0x2e')];if(!_0x21eb53[_0x622a('0x2f')][_0x622a('0x36')]('nolimit')){_0x329e3f[_0x622a('0x1c')]=qs[_0x622a('0x1c')](_0x21eb53[_0x622a('0x2f')][_0x622a('0x1c')]);_0x329e3f['offset']=qs['offset'](_0x21eb53[_0x622a('0x2f')]['offset']);}_0x329e3f[_0x622a('0x37')]=qs[_0x622a('0x38')](_0x21eb53['query'][_0x622a('0x38')]);_0x329e3f[_0x622a('0x39')]=qs['filters'](_[_0x622a('0x3a')](_0x21eb53[_0x622a('0x2f')],_0x35b66e[_0x622a('0x31')]),_0x300fb9);if(_0x21eb53[_0x622a('0x2f')][_0x622a('0x3b')]){_0x329e3f[_0x622a('0x39')]=_[_0x622a('0x3c')](_0x329e3f[_0x622a('0x39')],{'$or':_[_0x622a('0x3d')](_0x300fb9,function(_0xe9c8b4){if(_0xe9c8b4[_0x622a('0x2c')]!==_0x622a('0x3e')){var _0x295d56={};_0x295d56[_0xe9c8b4['name']]={'$like':'%'+_0x21eb53[_0x622a('0x2f')][_0x622a('0x3b')]+'%'};return _0x295d56;}})});}_0x329e3f=_[_0x622a('0x3c')]({},_0x329e3f,_0x21eb53[_0x622a('0x3f')]);var _0x16b8f1={'where':_0x329e3f[_0x622a('0x39')]};return db[_0x622a('0x2a')][_0x622a('0x40')](_0x16b8f1)['then'](function(_0x259833){_0x5e8fab[_0x622a('0x40')]=_0x259833;if(_0x21eb53[_0x622a('0x2f')][_0x622a('0x41')]){_0x329e3f[_0x622a('0x42')]=[{'all':!![]}];}return db[_0x622a('0x2a')][_0x622a('0x43')](_0x329e3f);})['then'](function(_0x4a69d3){_0x5e8fab[_0x622a('0x44')]=_0x4a69d3;return _0x5e8fab;})[_0x622a('0x21')](respondWithFilteredResult(_0x3fd4ab,_0x329e3f))[_0x622a('0x45')](handleError(_0x3fd4ab,null));}; \ No newline at end of file +var _0x60f1=['model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Migration','findAll','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','apply','save','update','then','destroy','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x4cd546,_0x1fc60d){var _0xb5931e=function(_0x174700){while(--_0x174700){_0x4cd546['push'](_0x4cd546['shift']());}};_0xb5931e(++_0x1fc60d);}(_0x60f1,0x95));var _0x160f=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x60f1[_0x1064bc];return _0x5edc45;};'use strict';var emlformat=require(_0x160f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x160f('0x1'));var jsonpatch=require(_0x160f('0x2'));var rp=require(_0x160f('0x3'));var moment=require(_0x160f('0x4'));var BPromise=require(_0x160f('0x5'));var Mustache=require(_0x160f('0x6'));var util=require('util');var path=require(_0x160f('0x7'));var sox=require(_0x160f('0x8'));var csv=require('to-csv');var ejs=require(_0x160f('0x9'));var fs=require('fs');var fs_extra=require(_0x160f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x160f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x160f('0xc'));var querystring=require(_0x160f('0xd'));var Papa=require(_0x160f('0xe'));var Redis=require('ioredis');var authService=require(_0x160f('0xf'));var qs=require(_0x160f('0x10'));var as=require(_0x160f('0x11'));var hardwareService=require(_0x160f('0x12'));var logger=require('../../config/logger')(_0x160f('0x13'));var utils=require(_0x160f('0x14'));var config=require(_0x160f('0x15'));var licenseUtil=require(_0x160f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2945db,_0x3f6bdf){_0x3f6bdf=_0x3f6bdf||0xcc;return function(_0x251add){if(_0x251add){return _0x2945db['sendStatus'](_0x3f6bdf);}return _0x2945db[_0x160f('0x17')](_0x3f6bdf)['end']();};}function respondWithResult(_0x35a8c1,_0x2c7c2f){_0x2c7c2f=_0x2c7c2f||0xc8;return function(_0x5110f6){if(_0x5110f6){return _0x35a8c1['status'](_0x2c7c2f)[_0x160f('0x18')](_0x5110f6);}};}function respondWithFilteredResult(_0x11d29d,_0x1ae7e2){return function(_0x590947){if(_0x590947){var _0x465453=typeof _0x1ae7e2[_0x160f('0x19')]==='undefined'&&typeof _0x1ae7e2['limit']===_0x160f('0x1a');var _0x216b29=_0x590947[_0x160f('0x1b')];var _0x46966b=_0x465453?0x0:_0x1ae7e2[_0x160f('0x19')];var _0x386cae=_0x465453?_0x590947[_0x160f('0x1b')]:_0x1ae7e2['offset']+_0x1ae7e2[_0x160f('0x1c')];var _0x5d1395;if(_0x386cae>=_0x216b29){_0x386cae=_0x216b29;_0x5d1395=0xc8;}else{_0x5d1395=0xce;}_0x11d29d['status'](_0x5d1395);return _0x11d29d['set']('Content-Range',_0x46966b+'-'+_0x386cae+'/'+_0x216b29)[_0x160f('0x18')](_0x590947);}return null;};}function patchUpdates(_0x15b436){return function(_0x5736ea){try{jsonpatch[_0x160f('0x1d')](_0x5736ea,_0x15b436,!![]);}catch(_0x509b4d){return BPromise['reject'](_0x509b4d);}return _0x5736ea[_0x160f('0x1e')]();};}function saveUpdates(_0x225b8c,_0x553783){return function(_0x447a7e){if(_0x447a7e){return _0x447a7e[_0x160f('0x1f')](_0x225b8c)[_0x160f('0x20')](function(_0x1ec281){return _0x1ec281;});}return null;};}function removeEntity(_0x1f738d,_0x4eecc2){return function(_0x32c626){if(_0x32c626){return _0x32c626[_0x160f('0x21')]()[_0x160f('0x20')](function(){_0x1f738d['status'](0xcc)[_0x160f('0x22')]();});}};}function handleEntityNotFound(_0x3dbce4,_0x4ae0e2){return function(_0x2a3e97){if(!_0x2a3e97){_0x3dbce4[_0x160f('0x23')](0x194);}return _0x2a3e97;};}function handleError(_0x450d7a,_0x3b9d3d){_0x3b9d3d=_0x3b9d3d||0x1f4;return function(_0x272337){logger['error'](_0x272337[_0x160f('0x24')]);if(_0x272337[_0x160f('0x25')]){delete _0x272337[_0x160f('0x25')];}_0x450d7a[_0x160f('0x17')](_0x3b9d3d)['send'](_0x272337);};}exports[_0x160f('0x26')]=function(_0x38f2ff,_0x34cb4e){var _0x184caa={},_0x23db26={},_0x3372d0={'count':0x0,'rows':[]};var _0x25b1b7=_[_0x160f('0x27')](db['Migration'][_0x160f('0x28')],function(_0x1bdb59){return{'name':_0x1bdb59[_0x160f('0x29')],'type':_0x1bdb59[_0x160f('0x2a')]['key']};});_0x23db26[_0x160f('0x2b')]=_[_0x160f('0x27')](_0x25b1b7,_0x160f('0x25'));_0x23db26['query']=_[_0x160f('0x2c')](_0x38f2ff[_0x160f('0x2d')]);_0x23db26[_0x160f('0x2e')]=_['intersection'](_0x23db26[_0x160f('0x2b')],_0x23db26[_0x160f('0x2d')]);_0x184caa[_0x160f('0x2f')]=_[_0x160f('0x30')](_0x23db26[_0x160f('0x2b')],qs[_0x160f('0x31')](_0x38f2ff[_0x160f('0x2d')][_0x160f('0x31')]));_0x184caa[_0x160f('0x2f')]=_0x184caa['attributes'][_0x160f('0x32')]?_0x184caa['attributes']:_0x23db26[_0x160f('0x2b')];if(!_0x38f2ff[_0x160f('0x2d')][_0x160f('0x33')](_0x160f('0x34'))){_0x184caa[_0x160f('0x1c')]=qs['limit'](_0x38f2ff['query'][_0x160f('0x1c')]);_0x184caa[_0x160f('0x19')]=qs[_0x160f('0x19')](_0x38f2ff[_0x160f('0x2d')][_0x160f('0x19')]);}_0x184caa[_0x160f('0x35')]=qs[_0x160f('0x36')](_0x38f2ff[_0x160f('0x2d')]['sort']);_0x184caa[_0x160f('0x37')]=qs['filters'](_[_0x160f('0x38')](_0x38f2ff[_0x160f('0x2d')],_0x23db26['filters']),_0x25b1b7);if(_0x38f2ff['query'][_0x160f('0x39')]){_0x184caa['where']=_[_0x160f('0x3a')](_0x184caa[_0x160f('0x37')],{'$or':_[_0x160f('0x27')](_0x25b1b7,function(_0x580202){if(_0x580202[_0x160f('0x2a')]!==_0x160f('0x3b')){var _0x48b47a={};_0x48b47a[_0x580202[_0x160f('0x25')]]={'$like':'%'+_0x38f2ff[_0x160f('0x2d')]['filter']+'%'};return _0x48b47a;}})});}_0x184caa=_['merge']({},_0x184caa,_0x38f2ff[_0x160f('0x3c')]);var _0xce960={'where':_0x184caa[_0x160f('0x37')]};return db[_0x160f('0x3d')][_0x160f('0x1b')](_0xce960)[_0x160f('0x20')](function(_0x163252){_0x3372d0[_0x160f('0x1b')]=_0x163252;if(_0x38f2ff[_0x160f('0x2d')]['includeAll']){_0x184caa['include']=[{'all':!![]}];}return db[_0x160f('0x3d')][_0x160f('0x3e')](_0x184caa);})['then'](function(_0x3947b6){_0x3372d0[_0x160f('0x3f')]=_0x3947b6;return _0x3372d0;})[_0x160f('0x20')](respondWithFilteredResult(_0x34cb4e,_0x184caa))['catch'](handleError(_0x34cb4e,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3ad26c9..4878259 100644 --- a/server/api/migration/migration.model.js +++ b/server/api/migration/migration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0803=['bluebird','path','rimraf','../../config/environment','exports','Migration','migrations','lodash','../../config/logger','api'];(function(_0x53827b,_0x3f6391){var _0x5ebc93=function(_0x584a2){while(--_0x584a2){_0x53827b['push'](_0x53827b['shift']());}};_0x5ebc93(++_0x3f6391);}(_0x0803,0x101));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3080('0x0'));var util=require('util');var logger=require(_0x3080('0x1'))(_0x3080('0x2'));var moment=require('moment');var BPromise=require(_0x3080('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3080('0x4'));var rimraf=require(_0x3080('0x5'));var config=require(_0x3080('0x6'));var attributes=require('./migration.attributes');module[_0x3080('0x7')]=function(_0x5ec5db,_0x1ebf6e){return _0x5ec5db['define'](_0x3080('0x8'),attributes,{'tableName':_0x3080('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97d4=['migrations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./migration.attributes','define'];(function(_0x4265d7,_0x220424){var _0x3cda02=function(_0x4c46f8){while(--_0x4c46f8){_0x4265d7['push'](_0x4265d7['shift']());}};_0x3cda02(++_0x220424);}(_0x97d4,0x155));var _0x497d=function(_0x8fc9d1,_0x55be5e){_0x8fc9d1=_0x8fc9d1-0x0;var _0x445c72=_0x97d4[_0x8fc9d1];return _0x445c72;};'use strict';var _=require(_0x497d('0x0'));var util=require(_0x497d('0x1'));var logger=require(_0x497d('0x2'))(_0x497d('0x3'));var moment=require(_0x497d('0x4'));var BPromise=require(_0x497d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x497d('0x6'));var config=require('../../config/environment');var attributes=require(_0x497d('0x7'));module['exports']=function(_0x34d1d7,_0x583bdc){return _0x34d1d7[_0x497d('0x8')]('Migration',attributes,{'tableName':_0x497d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index a768244..f29c280 100644 --- a/server/api/migration/migration.rpc.js +++ b/server/api/migration/migration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa20a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa20a,0x74));var _0xaa20=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xa20a[_0x1589dd];return _0x1bddd1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa20('0x0'));var BPromise=require(_0xaa20('0x1'));var rs=require(_0xaa20('0x2'));var fs=require('fs');var Redis=require(_0xaa20('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa20('0x4'));var logger=require(_0xaa20('0x5'))(_0xaa20('0x6'));var config=require(_0xaa20('0x7'));var jayson=require(_0xaa20('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x413b88,_0x6d1518,_0x23a712){return new BPromise(function(_0x181df0,_0x271ed1){return client[_0xaa20('0x9')](_0x413b88,_0x23a712)[_0xaa20('0xa')](function(_0x12d403){logger[_0xaa20('0xb')](_0xaa20('0xc'),_0x6d1518,_0xaa20('0xd'));logger['debug'](_0xaa20('0xe'),_0x6d1518,_0xaa20('0xd'),JSON['stringify'](_0x12d403));if(_0x12d403[_0xaa20('0xf')]){if(_0x12d403[_0xaa20('0xf')][_0xaa20('0x10')]===0x1f4){logger[_0xaa20('0xf')](_0xaa20('0xc'),_0x6d1518,_0x12d403[_0xaa20('0xf')]['message']);return _0x271ed1(_0x12d403[_0xaa20('0xf')][_0xaa20('0x11')]);}logger[_0xaa20('0xf')](_0xaa20('0xc'),_0x6d1518,_0x12d403[_0xaa20('0xf')][_0xaa20('0x11')]);return _0x181df0(_0x12d403[_0xaa20('0xf')][_0xaa20('0x11')]);}else{logger[_0xaa20('0xb')](_0xaa20('0xc'),_0x6d1518,_0xaa20('0xd'));_0x181df0(_0x12d403[_0xaa20('0x12')][_0xaa20('0x11')]);}})[_0xaa20('0x13')](function(_0x34ddb9){logger[_0xaa20('0xf')](_0xaa20('0xc'),_0x6d1518,_0x34ddb9);_0x271ed1(_0x34ddb9);});});} \ No newline at end of file +var _0x1789=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x793e15,_0x5ce316){var _0xdf108c=function(_0x293d98){while(--_0x293d98){_0x793e15['push'](_0x793e15['shift']());}};_0xdf108c(++_0x5ce316);}(_0x1789,0x92));var _0x9178=function(_0x18fec8,_0x31d0cd){_0x18fec8=_0x18fec8-0x0;var _0x5e400c=_0x1789[_0x18fec8];return _0x5e400c;};'use strict';var _=require(_0x9178('0x0'));var util=require(_0x9178('0x1'));var moment=require(_0x9178('0x2'));var BPromise=require('bluebird');var rs=require(_0x9178('0x3'));var fs=require('fs');var Redis=require(_0x9178('0x4'));var db=require(_0x9178('0x5'))['db'];var utils=require(_0x9178('0x6'));var logger=require(_0x9178('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9178('0x8'));var client=jayson[_0x9178('0x9')][_0x9178('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f00a8,_0x502d21,_0x1001b0){return new BPromise(function(_0x333b8b,_0x3bcc1b){return client[_0x9178('0xb')](_0x1f00a8,_0x1001b0)['then'](function(_0x4bd20e){logger['info'](_0x9178('0xc'),_0x502d21,_0x9178('0xd'));logger[_0x9178('0xe')](_0x9178('0xf'),_0x502d21,'request\x20sent',JSON[_0x9178('0x10')](_0x4bd20e));if(_0x4bd20e[_0x9178('0x11')]){if(_0x4bd20e['error']['code']===0x1f4){logger['error'](_0x9178('0xc'),_0x502d21,_0x4bd20e[_0x9178('0x11')]['message']);return _0x3bcc1b(_0x4bd20e[_0x9178('0x11')][_0x9178('0x12')]);}logger[_0x9178('0x11')]('Migration,\x20%s,\x20%s',_0x502d21,_0x4bd20e[_0x9178('0x11')][_0x9178('0x12')]);return _0x333b8b(_0x4bd20e['error'][_0x9178('0x12')]);}else{logger['info'](_0x9178('0xc'),_0x502d21,_0x9178('0xd'));_0x333b8b(_0x4bd20e[_0x9178('0x13')][_0x9178('0x12')]);}})[_0x9178('0x14')](function(_0x31baa2){logger[_0x9178('0x11')](_0x9178('0xc'),_0x502d21,_0x31baa2);_0x3bcc1b(_0x31baa2);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2f528e9..9548ae6 100644 --- a/server/api/network/index.js +++ b/server/api/network/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86b8=['show','post','create','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','index','get','/:id','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x86b8,0x15d));var _0x886b=function(_0x11200d,_0x4656c5){_0x11200d=_0x11200d-0x0;var _0x356608=_0x86b8[_0x11200d];return _0x356608;};'use strict';var multer=require(_0x886b('0x0'));var util=require(_0x886b('0x1'));var path=require(_0x886b('0x2'));var timeout=require('connect-timeout');var express=require(_0x886b('0x3'));var router=express['Router']();var fs_extra=require(_0x886b('0x4'));var auth=require(_0x886b('0x5'));var interaction=require(_0x886b('0x6'));var config=require('../../config/environment');var controller=require(_0x886b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x886b('0x8')]);router[_0x886b('0x9')](_0x886b('0xa'),auth[_0x886b('0xb')](),controller[_0x886b('0xc')]);router[_0x886b('0xd')]('/',auth[_0x886b('0xb')](),controller[_0x886b('0xe')]);router['put'](_0x886b('0xa'),auth[_0x886b('0xb')](),controller[_0x886b('0xf')]);router[_0x886b('0x10')](_0x886b('0xa'),auth[_0x886b('0xb')](),controller[_0x886b('0x11')]);module[_0x886b('0x12')]=router; \ No newline at end of file +var _0x1241=['../../config/environment','./network.controller','isAuthenticated','index','get','/:id','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1518ae,_0x4ebcea){var _0x2fe15c=function(_0x41ea3b){while(--_0x41ea3b){_0x1518ae['push'](_0x1518ae['shift']());}};_0x2fe15c(++_0x4ebcea);}(_0x1241,0xb4));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1124('0x0'));var util=require('util');var path=require(_0x1124('0x1'));var timeout=require(_0x1124('0x2'));var express=require(_0x1124('0x3'));var router=express[_0x1124('0x4')]();var fs_extra=require(_0x1124('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1124('0x6'));var config=require(_0x1124('0x7'));var controller=require(_0x1124('0x8'));router['get']('/',auth[_0x1124('0x9')](),controller[_0x1124('0xa')]);router[_0x1124('0xb')](_0x1124('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1124('0x9')](),controller['create']);router[_0x1124('0xd')](_0x1124('0xc'),auth[_0x1124('0x9')](),controller[_0x1124('0xe')]);router[_0x1124('0xf')](_0x1124('0xc'),auth['isAuthenticated'](),controller[_0x1124('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 0f4e35d..4c0651b 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa519=['externip','stun','STRING','exports'];(function(_0x5a459d,_0x5ef5ab){var _0x5c8dc6=function(_0x46f1ef){while(--_0x46f1ef){_0x5a459d['push'](_0x5a459d['shift']());}};_0x5c8dc6(++_0x5ef5ab);}(_0xa519,0xfb));var _0x9a51=function(_0x55678e,_0x278682){_0x55678e=_0x55678e-0x0;var _0x55f079=_0xa519[_0x55678e];return _0x55f079;};'use strict';var Sequelize=require('sequelize');module[_0x9a51('0x0')]={'type':{'type':Sequelize['ENUM']('localnet',_0x9a51('0x1'),_0x9a51('0x2'),'turn')},'value':{'type':Sequelize[_0x9a51('0x3')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf30b=['sequelize','ENUM','localnet','stun','STRING'];(function(_0x18df92,_0x2156f1){var _0x4282f4=function(_0x2dd49f){while(--_0x2dd49f){_0x18df92['push'](_0x18df92['shift']());}};_0x4282f4(++_0x2156f1);}(_0xf30b,0x172));var _0xbf30=function(_0x3bb830,_0xa498c1){_0x3bb830=_0x3bb830-0x0;var _0x309778=_0xf30b[_0x3bb830];return _0x309778;};'use strict';var Sequelize=require(_0xbf30('0x0'));module['exports']={'type':{'type':Sequelize[_0xbf30('0x1')](_0xbf30('0x2'),'externip',_0xbf30('0x3'),'turn')},'value':{'type':Sequelize[_0xbf30('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbf30('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 428f750..1736fde 100644 --- a/server/api/network/network.controller.js +++ b/server/api/network/network.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaba7=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','options','includeAll','findAll','show','params','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','find','destroy','path','ejs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','intersection'];(function(_0x2ac716,_0x8d39fc){var _0x26ef5=function(_0xee8bdc){while(--_0xee8bdc){_0x2ac716['push'](_0x2ac716['shift']());}};_0x26ef5(++_0x8d39fc);}(_0xaba7,0x11a));var _0x7aba=function(_0x12f570,_0x2bdad1){_0x12f570=_0x12f570-0x0;var _0x820efc=_0xaba7[_0x12f570];return _0x820efc;};'use strict';var util=require('util');var path=require(_0x7aba('0x0'));var ejs=require(_0x7aba('0x1'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x7aba('0x2'))(_0x7aba('0x3'));var config=require('../../config/environment');var db=require(_0x7aba('0x4'))['db'];var jayson=require(_0x7aba('0x5'));var client=jayson[_0x7aba('0x6')][_0x7aba('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2afa46,_0xdd8b77,_0x11d712,_0x5458a6){return new Promise(function(_0xf32504,_0x4986d2){var _0x552aa4=_0x5458a6||client;return _0x552aa4['request'](_0x2afa46,_0x11d712)['then'](function(_0xbd419a){logger['info'](_0x7aba('0x8'),_0xdd8b77,_0x7aba('0x9'));logger[_0x7aba('0xa')](_0x7aba('0xb'),_0xdd8b77,_0x7aba('0x9'),JSON['stringify'](_0xbd419a));if(_0xbd419a[_0x7aba('0xc')]){if(_0xbd419a[_0x7aba('0xc')][_0x7aba('0xd')]===0x1f4){logger[_0x7aba('0xc')](_0x7aba('0x8'),_0xdd8b77,_0xbd419a[_0x7aba('0xc')][_0x7aba('0xe')]);return _0x4986d2(_0xbd419a['error']['message']);}logger[_0x7aba('0xc')]('Network,\x20%s,\x20%s',_0xdd8b77,_0xbd419a['error'][_0x7aba('0xe')]);return _0xf32504(_0xbd419a['error']['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0xdd8b77,_0x7aba('0x9'));_0xf32504(_0xbd419a['result'][_0x7aba('0xe')]);}})[_0x7aba('0xf')](function(_0x33d5bf){logger[_0x7aba('0xc')](_0x7aba('0x8'),_0xdd8b77,_0x33d5bf);_0x4986d2(_0x33d5bf);});});}function respondWithResult(_0x201080,_0x739c5d){_0x739c5d=_0x739c5d||0xc8;return function(_0x5abfdc){if(_0x5abfdc){return _0x201080[_0x7aba('0x10')](_0x739c5d)[_0x7aba('0x11')](_0x5abfdc);}};}function respondWithFilteredResult(_0xcbdead,_0x52b16c){return function(_0xf3a73){if(_0xf3a73){var _0x2f713f=typeof _0x52b16c[_0x7aba('0x12')]===_0x7aba('0x13')&&typeof _0x52b16c['limit']===_0x7aba('0x13');var _0x2db84a=_0xf3a73[_0x7aba('0x14')];var _0x43a72e=_0x2f713f?0x0:_0x52b16c[_0x7aba('0x12')];var _0x568fc2=_0x2f713f?_0xf3a73[_0x7aba('0x14')]:_0x52b16c[_0x7aba('0x12')]+_0x52b16c[_0x7aba('0x15')];var _0x562415;if(_0x568fc2>=_0x2db84a){_0x568fc2=_0x2db84a;_0x562415=0xc8;}else{_0x562415=0xce;}_0xcbdead[_0x7aba('0x10')](_0x562415);return _0xcbdead[_0x7aba('0x16')](_0x7aba('0x17'),_0x43a72e+'-'+_0x568fc2+'/'+_0x2db84a)['json'](_0xf3a73);}return null;};}function saveUpdates(_0x359ed9){return function(_0x4c49cb){if(_0x4c49cb){return _0x4c49cb[_0x7aba('0x18')](_0x359ed9)[_0x7aba('0x19')](function(_0x51749b){return _0x51749b;});}return null;};}function removeEntity(_0x4935c2){return function(_0x2dcab1){if(_0x2dcab1){return _0x2dcab1['destroy']()[_0x7aba('0x19')](function(){_0x4935c2['status'](0xcc)[_0x7aba('0x1a')]();});}};}function handleEntityNotFound(_0x5d01bb){return function(_0x57921d){if(!_0x57921d){_0x5d01bb[_0x7aba('0x1b')](0x194);}return _0x57921d;};}function handleError(_0x39fc96,_0x55bb47){_0x55bb47=_0x55bb47||0x1f4;return function(_0x202b6c){logger[_0x7aba('0xc')](_0x202b6c[_0x7aba('0x1c')]);if(_0x202b6c['name']){delete _0x202b6c[_0x7aba('0x1d')];}_0x39fc96[_0x7aba('0x10')](_0x55bb47)[_0x7aba('0x1e')](_0x202b6c);};}exports[_0x7aba('0x1f')]=function(_0x10c7f0,_0xf39966){var _0x470c6f={},_0xe133a7={},_0x243c96={'count':0x0,'rows':[]};var _0x28a1fb=_[_0x7aba('0x20')](db[_0x7aba('0x21')][_0x7aba('0x22')],function(_0x430578){return{'name':_0x430578[_0x7aba('0x23')],'type':_0x430578[_0x7aba('0x24')][_0x7aba('0x25')]};});_0xe133a7[_0x7aba('0x26')]=_['map'](_0x28a1fb,_0x7aba('0x1d'));_0xe133a7[_0x7aba('0x27')]=_[_0x7aba('0x28')](_0x10c7f0['query']);_0xe133a7['filters']=_[_0x7aba('0x29')](_0xe133a7[_0x7aba('0x26')],_0xe133a7['query']);_0x470c6f[_0x7aba('0x2a')]=_[_0x7aba('0x29')](_0xe133a7[_0x7aba('0x26')],qs[_0x7aba('0x2b')](_0x10c7f0['query'][_0x7aba('0x2b')]));_0x470c6f['attributes']=_0x470c6f[_0x7aba('0x2a')][_0x7aba('0x2c')]?_0x470c6f['attributes']:_0xe133a7[_0x7aba('0x26')];if(!_0x10c7f0['query'][_0x7aba('0x2d')](_0x7aba('0x2e'))){_0x470c6f[_0x7aba('0x15')]=qs[_0x7aba('0x15')](_0x10c7f0['query'][_0x7aba('0x15')]);_0x470c6f[_0x7aba('0x12')]=qs[_0x7aba('0x12')](_0x10c7f0[_0x7aba('0x27')][_0x7aba('0x12')]);}_0x470c6f[_0x7aba('0x2f')]=qs[_0x7aba('0x30')](_0x10c7f0[_0x7aba('0x27')]['sort']);_0x470c6f['where']=qs[_0x7aba('0x31')](_['pick'](_0x10c7f0[_0x7aba('0x27')],_0xe133a7['filters']),_0x28a1fb);if(_0x10c7f0[_0x7aba('0x27')][_0x7aba('0x32')]){_0x470c6f['where']=_[_0x7aba('0x33')](_0x470c6f[_0x7aba('0x34')],{'$or':_[_0x7aba('0x20')](_0x28a1fb,function(_0xaaee91){if(_0xaaee91[_0x7aba('0x24')]!=='VIRTUAL'){var _0x294a82={};_0x294a82[_0xaaee91[_0x7aba('0x1d')]]={'$like':'%'+_0x10c7f0[_0x7aba('0x27')][_0x7aba('0x32')]+'%'};return _0x294a82;}})});}_0x470c6f=_[_0x7aba('0x33')]({},_0x470c6f,_0x10c7f0[_0x7aba('0x35')]);var _0x418855={'where':_0x470c6f['where']};return db[_0x7aba('0x21')]['count'](_0x418855)[_0x7aba('0x19')](function(_0xa23003){_0x243c96['count']=_0xa23003;if(_0x10c7f0[_0x7aba('0x27')][_0x7aba('0x36')]){_0x470c6f['include']=[{'all':!![]}];}return db[_0x7aba('0x21')][_0x7aba('0x37')](_0x470c6f);})[_0x7aba('0x19')](function(_0x421557){_0x243c96['rows']=_0x421557;return _0x243c96;})[_0x7aba('0x19')](respondWithFilteredResult(_0xf39966,_0x470c6f))[_0x7aba('0xf')](handleError(_0xf39966,null));};exports[_0x7aba('0x38')]=function(_0xaab1e3,_0x342e76){var _0x5565e6={'raw':!![],'where':{'id':_0xaab1e3[_0x7aba('0x39')]['id']}},_0x46efe0={};_0x46efe0['model']=_[_0x7aba('0x28')](db[_0x7aba('0x21')]['rawAttributes']);_0x46efe0['query']=_[_0x7aba('0x28')](_0xaab1e3[_0x7aba('0x27')]);_0x46efe0[_0x7aba('0x31')]=_[_0x7aba('0x29')](_0x46efe0[_0x7aba('0x26')],_0x46efe0['query']);_0x5565e6[_0x7aba('0x2a')]=_[_0x7aba('0x29')](_0x46efe0[_0x7aba('0x26')],qs[_0x7aba('0x2b')](_0xaab1e3[_0x7aba('0x27')]['fields']));_0x5565e6['attributes']=_0x5565e6['attributes'][_0x7aba('0x2c')]?_0x5565e6['attributes']:_0x46efe0[_0x7aba('0x26')];if(_0xaab1e3[_0x7aba('0x27')]['includeAll']){_0x5565e6['include']=[{'all':!![]}];}_0x5565e6=_[_0x7aba('0x33')]({},_0x5565e6,_0xaab1e3[_0x7aba('0x35')]);return db[_0x7aba('0x21')]['find'](_0x5565e6)[_0x7aba('0x19')](handleEntityNotFound(_0x342e76,null))[_0x7aba('0x19')](respondWithResult(_0x342e76,null))[_0x7aba('0xf')](handleError(_0x342e76,null));};exports['create']=function(_0x105bae,_0x126a76){var _0xbc7bcd;return db[_0x7aba('0x21')][_0x7aba('0x3a')](_0x105bae['body'],{'raw':!![]})[_0x7aba('0x19')](function(_0x300754){_0xbc7bcd=_0x300754;return db['Network']['findAll']({'where':{'type':_0x105bae[_0x7aba('0x3b')][_0x7aba('0x24')]},'raw':!![]});})['then'](function(_0x4fccfe){if(_0xbc7bcd[_0x7aba('0x24')][_0x7aba('0x3c')]()==_0x7aba('0x3d')){var _0x1aea19=fs[_0x7aba('0x3e')](path[_0x7aba('0x3f')](config[_0x7aba('0x40')],_0x7aba('0x41')),_0x7aba('0x42'));var _0x347d54=ejs[_0x7aba('0x43')](_0x1aea19,{'networks':_0x4fccfe||[]});fs['writeFileSync'](_0x7aba('0x44'),_0x347d54);return respondWithRpcPromise(_0x7aba('0x45'),_0x7aba('0x3a'),{'module':_0x7aba('0x46')});}else if(_0xbc7bcd[_0x7aba('0x24')][_0x7aba('0x3c')]()==_0x7aba('0x47')){var _0x525c4d=fs[_0x7aba('0x3e')](path[_0x7aba('0x3f')](config[_0x7aba('0x40')],_0x7aba('0x48')),_0x7aba('0x42'));var _0x40f595=ejs[_0x7aba('0x43')](_0x525c4d,{'networks':_0x4fccfe||[]});fs[_0x7aba('0x49')](_0x7aba('0x4a'),_0x40f595);return respondWithRpcPromise('Reload','create',{'module':_0x7aba('0x46')});}else{var _0x550803=fs['readFileSync'](path['join'](config[_0x7aba('0x40')],_0x7aba('0x4b')),_0x7aba('0x42'));var _0x4aeef1=ejs['render'](_0x550803,{'networks':_0x4fccfe||[]});fs[_0x7aba('0x49')](util[_0x7aba('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x105bae[_0x7aba('0x3b')]['type'][_0x7aba('0x4d')]()),_0x4aeef1);return respondWithRpcPromise(_0x7aba('0x45'),_0x7aba('0x3a'),{'module':_0x7aba('0x4e')});}})[_0x7aba('0x19')](function(){return _0xbc7bcd;})[_0x7aba('0x19')](respondWithResult(_0x126a76,0xc9))['catch'](handleError(_0x126a76,null));};exports[_0x7aba('0x18')]=function(_0x133a7a,_0x225335){var _0x322fa6;return db[_0x7aba('0x21')][_0x7aba('0x4f')]({'where':{'id':_0x133a7a['params']['id']}})[_0x7aba('0x19')](handleEntityNotFound(_0x225335,null))[_0x7aba('0x19')](saveUpdates(_0x133a7a[_0x7aba('0x3b')],null))[_0x7aba('0x19')](function(_0x430786){if(_0x430786){_0x322fa6=_0x430786;return db['Network'][_0x7aba('0x37')]({'where':{'type':_0x322fa6[_0x7aba('0x24')]},'raw':!![]});}return null;})[_0x7aba('0x19')](function(_0x30ed5e){if(_0x322fa6['type'][_0x7aba('0x3c')]()==_0x7aba('0x3d')){var _0x184b5e=fs['readFileSync'](path['join'](config[_0x7aba('0x40')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x359be3=ejs['render'](_0x184b5e,{'networks':_0x30ed5e||[]});fs[_0x7aba('0x49')](_0x7aba('0x44'),_0x359be3);return respondWithRpcPromise(_0x7aba('0x45'),_0x7aba('0x18'),{'module':_0x7aba('0x46')});}else if(_0x322fa6[_0x7aba('0x24')]['toUpperCase']()==_0x7aba('0x47')){var _0x4ee036=fs[_0x7aba('0x3e')](path[_0x7aba('0x3f')](config[_0x7aba('0x40')],'server/files/templates/turn_multiple.ejs'),_0x7aba('0x42'));var _0x3a2076=ejs[_0x7aba('0x43')](_0x4ee036,{'networks':_0x30ed5e||[]});fs[_0x7aba('0x49')](_0x7aba('0x4a'),_0x3a2076);return respondWithRpcPromise(_0x7aba('0x45'),_0x7aba('0x18'),{'module':_0x7aba('0x46')});}else{var _0x19035b=fs[_0x7aba('0x3e')](path[_0x7aba('0x3f')](config[_0x7aba('0x40')],'server/files/templates/network.ejs'),_0x7aba('0x42'));var _0x2fc6ca=ejs[_0x7aba('0x43')](_0x19035b,{'networks':_0x30ed5e||[]});fs[_0x7aba('0x49')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x133a7a[_0x7aba('0x3b')][_0x7aba('0x24')][_0x7aba('0x4d')]()),_0x2fc6ca);return respondWithRpcPromise('Reload',_0x7aba('0x18'),{'module':'chan_sip.so'});}})[_0x7aba('0x19')](function(_0x21e6d6){if(_0x21e6d6){return _0x322fa6;}return null;})[_0x7aba('0x19')](respondWithResult(_0x225335,null))[_0x7aba('0xf')](handleError(_0x225335,null));};exports[_0x7aba('0x50')]=function(_0x2e0802,_0x1019ec){var _0x43c6cb;return db[_0x7aba('0x21')]['find']({'where':{'id':_0x2e0802[_0x7aba('0x39')]['id']}})[_0x7aba('0x19')](function(_0x3af582){_0x43c6cb=_0x3af582;return _0x3af582;})[_0x7aba('0x19')](handleEntityNotFound(_0x1019ec,null))[_0x7aba('0x19')](removeEntity(_0x1019ec,null))[_0x7aba('0x19')](function(){if(_0x43c6cb){return db[_0x7aba('0x21')][_0x7aba('0x37')]({'where':{'type':_0x43c6cb[_0x7aba('0x24')]},'raw':!![]});}})[_0x7aba('0x19')](function(_0x569dc6){if(_0x43c6cb[_0x7aba('0x24')][_0x7aba('0x3c')]()=='STUN'){var _0x5cdb60=fs[_0x7aba('0x3e')](path[_0x7aba('0x3f')](config[_0x7aba('0x40')],_0x7aba('0x41')),_0x7aba('0x42'));var _0x406efe=ejs[_0x7aba('0x43')](_0x5cdb60,{'networks':_0x569dc6||[]});fs[_0x7aba('0x49')](_0x7aba('0x44'),_0x406efe);return respondWithRpcPromise('Reload',_0x7aba('0x50'),{'module':_0x7aba('0x46')});}else if(_0x43c6cb[_0x7aba('0x24')][_0x7aba('0x3c')]()==_0x7aba('0x47')){var _0x5e6d98=fs['readFileSync'](path['join'](config['root'],_0x7aba('0x48')),_0x7aba('0x42'));var _0x29d06f=ejs['render'](_0x5e6d98,{'networks':_0x569dc6||[]});fs['writeFileSync'](_0x7aba('0x4a'),_0x29d06f);return respondWithRpcPromise('Reload',_0x7aba('0x50'),{'module':_0x7aba('0x46')});}else{var _0x3325ab=fs[_0x7aba('0x3e')](path['join'](config['root'],_0x7aba('0x4b')),'utf8');var _0x2e8204=ejs[_0x7aba('0x43')](_0x3325ab,{'networks':_0x569dc6||[]});fs[_0x7aba('0x49')](util[_0x7aba('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x43c6cb[_0x7aba('0x24')][_0x7aba('0x4d')]()),_0x2e8204);return respondWithRpcPromise(_0x7aba('0x45'),_0x7aba('0x50'),{'module':_0x7aba('0x4e')});}})['catch'](handleError(_0x1019ec,null));}; \ No newline at end of file +var _0xa17a=['Content-Range','update','destroy','end','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','map','query','attributes','model','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','Network','rows','params','keys','intersection','length','include','options','find','create','findAll','body','toUpperCase','STUN','readFileSync','join','root','utf8','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','writeFileSync','format','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','util','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','client','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count'];(function(_0x5e33dc,_0xc92144){var _0x2e1a91=function(_0x3fd5d2){while(--_0x3fd5d2){_0x5e33dc['push'](_0x5e33dc['shift']());}};_0x2e1a91(++_0xc92144);}(_0xa17a,0x17d));var _0xaa17=function(_0x5d75ff,_0x5bc7ac){_0x5d75ff=_0x5d75ff-0x0;var _0x1c1894=_0xa17a[_0x5d75ff];return _0x1c1894;};'use strict';var util=require(_0xaa17('0x0'));var path=require('path');var ejs=require(_0xaa17('0x1'));var fs=require('fs');var _=require(_0xaa17('0x2'));var qs=require(_0xaa17('0x3'));var logger=require(_0xaa17('0x4'))('api');var config=require(_0xaa17('0x5'));var db=require(_0xaa17('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xaa17('0x7')][_0xaa17('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40eeb4,_0x5f3007,_0x8c0386,_0x5d36ec){return new Promise(function(_0x197fc5,_0x21deb0){var _0x4fdf38=_0x5d36ec||client;return _0x4fdf38['request'](_0x40eeb4,_0x8c0386)[_0xaa17('0x9')](function(_0x5725ee){logger[_0xaa17('0xa')]('Network,\x20%s,\x20%s',_0x5f3007,_0xaa17('0xb'));logger['debug'](_0xaa17('0xc'),_0x5f3007,_0xaa17('0xb'),JSON['stringify'](_0x5725ee));if(_0x5725ee['error']){if(_0x5725ee[_0xaa17('0xd')]['code']===0x1f4){logger['error'](_0xaa17('0xe'),_0x5f3007,_0x5725ee[_0xaa17('0xd')][_0xaa17('0xf')]);return _0x21deb0(_0x5725ee[_0xaa17('0xd')][_0xaa17('0xf')]);}logger[_0xaa17('0xd')](_0xaa17('0xe'),_0x5f3007,_0x5725ee[_0xaa17('0xd')]['message']);return _0x197fc5(_0x5725ee[_0xaa17('0xd')][_0xaa17('0xf')]);}else{logger[_0xaa17('0xa')](_0xaa17('0xe'),_0x5f3007,_0xaa17('0xb'));_0x197fc5(_0x5725ee[_0xaa17('0x10')][_0xaa17('0xf')]);}})[_0xaa17('0x11')](function(_0x19380d){logger[_0xaa17('0xd')](_0xaa17('0xe'),_0x5f3007,_0x19380d);_0x21deb0(_0x19380d);});});}function respondWithResult(_0x25f49a,_0x52c35a){_0x52c35a=_0x52c35a||0xc8;return function(_0x498f8f){if(_0x498f8f){return _0x25f49a[_0xaa17('0x12')](_0x52c35a)[_0xaa17('0x13')](_0x498f8f);}};}function respondWithFilteredResult(_0x50c1e0,_0x49e8f3){return function(_0xef7517){if(_0xef7517){var _0x5d8ddb=typeof _0x49e8f3[_0xaa17('0x14')]===_0xaa17('0x15')&&typeof _0x49e8f3[_0xaa17('0x16')]===_0xaa17('0x15');var _0x2e38f7=_0xef7517[_0xaa17('0x17')];var _0x5ca382=_0x5d8ddb?0x0:_0x49e8f3['offset'];var _0x13a0b3=_0x5d8ddb?_0xef7517[_0xaa17('0x17')]:_0x49e8f3[_0xaa17('0x14')]+_0x49e8f3[_0xaa17('0x16')];var _0x42d35b;if(_0x13a0b3>=_0x2e38f7){_0x13a0b3=_0x2e38f7;_0x42d35b=0xc8;}else{_0x42d35b=0xce;}_0x50c1e0[_0xaa17('0x12')](_0x42d35b);return _0x50c1e0['set'](_0xaa17('0x18'),_0x5ca382+'-'+_0x13a0b3+'/'+_0x2e38f7)[_0xaa17('0x13')](_0xef7517);}return null;};}function saveUpdates(_0x454530){return function(_0x5e23d8){if(_0x5e23d8){return _0x5e23d8[_0xaa17('0x19')](_0x454530)[_0xaa17('0x9')](function(_0xd4975e){return _0xd4975e;});}return null;};}function removeEntity(_0x37bbd0){return function(_0x366630){if(_0x366630){return _0x366630[_0xaa17('0x1a')]()['then'](function(){_0x37bbd0[_0xaa17('0x12')](0xcc)[_0xaa17('0x1b')]();});}};}function handleEntityNotFound(_0x197434){return function(_0xfb6edf){if(!_0xfb6edf){_0x197434[_0xaa17('0x1c')](0x194);}return _0xfb6edf;};}function handleError(_0x449514,_0x1993bb){_0x1993bb=_0x1993bb||0x1f4;return function(_0x4db800){logger[_0xaa17('0xd')](_0x4db800[_0xaa17('0x1d')]);if(_0x4db800[_0xaa17('0x1e')]){delete _0x4db800[_0xaa17('0x1e')];}_0x449514['status'](_0x1993bb)['send'](_0x4db800);};}exports[_0xaa17('0x1f')]=function(_0xb10884,_0x36b56a){var _0x4051ac={},_0x56cf61={},_0x122b92={'count':0x0,'rows':[]};var _0x372ce8=_['map'](db['Network'][_0xaa17('0x20')],function(_0x97e490){return{'name':_0x97e490[_0xaa17('0x21')],'type':_0x97e490[_0xaa17('0x22')][_0xaa17('0x23')]};});_0x56cf61['model']=_[_0xaa17('0x24')](_0x372ce8,_0xaa17('0x1e'));_0x56cf61['query']=_['keys'](_0xb10884['query']);_0x56cf61['filters']=_['intersection'](_0x56cf61['model'],_0x56cf61[_0xaa17('0x25')]);_0x4051ac[_0xaa17('0x26')]=_['intersection'](_0x56cf61[_0xaa17('0x27')],qs[_0xaa17('0x28')](_0xb10884[_0xaa17('0x25')]['fields']));_0x4051ac['attributes']=_0x4051ac[_0xaa17('0x26')]['length']?_0x4051ac[_0xaa17('0x26')]:_0x56cf61[_0xaa17('0x27')];if(!_0xb10884[_0xaa17('0x25')][_0xaa17('0x29')]('nolimit')){_0x4051ac[_0xaa17('0x16')]=qs[_0xaa17('0x16')](_0xb10884[_0xaa17('0x25')][_0xaa17('0x16')]);_0x4051ac[_0xaa17('0x14')]=qs[_0xaa17('0x14')](_0xb10884[_0xaa17('0x25')]['offset']);}_0x4051ac[_0xaa17('0x2a')]=qs[_0xaa17('0x2b')](_0xb10884['query'][_0xaa17('0x2b')]);_0x4051ac[_0xaa17('0x2c')]=qs['filters'](_['pick'](_0xb10884[_0xaa17('0x25')],_0x56cf61[_0xaa17('0x2d')]),_0x372ce8);if(_0xb10884['query']['filter']){_0x4051ac['where']=_[_0xaa17('0x2e')](_0x4051ac[_0xaa17('0x2c')],{'$or':_['map'](_0x372ce8,function(_0x51b691){if(_0x51b691[_0xaa17('0x22')]!==_0xaa17('0x2f')){var _0x45db76={};_0x45db76[_0x51b691[_0xaa17('0x1e')]]={'$like':'%'+_0xb10884[_0xaa17('0x25')][_0xaa17('0x30')]+'%'};return _0x45db76;}})});}_0x4051ac=_[_0xaa17('0x2e')]({},_0x4051ac,_0xb10884['options']);var _0x99e03f={'where':_0x4051ac['where']};return db[_0xaa17('0x31')][_0xaa17('0x17')](_0x99e03f)['then'](function(_0x20ff6a){_0x122b92['count']=_0x20ff6a;if(_0xb10884['query']['includeAll']){_0x4051ac['include']=[{'all':!![]}];}return db['Network']['findAll'](_0x4051ac);})[_0xaa17('0x9')](function(_0x2f52af){_0x122b92[_0xaa17('0x32')]=_0x2f52af;return _0x122b92;})[_0xaa17('0x9')](respondWithFilteredResult(_0x36b56a,_0x4051ac))[_0xaa17('0x11')](handleError(_0x36b56a,null));};exports['show']=function(_0x1f3166,_0x22a1e0){var _0x119340={'raw':!![],'where':{'id':_0x1f3166[_0xaa17('0x33')]['id']}},_0x58f974={};_0x58f974['model']=_[_0xaa17('0x34')](db[_0xaa17('0x31')]['rawAttributes']);_0x58f974[_0xaa17('0x25')]=_[_0xaa17('0x34')](_0x1f3166[_0xaa17('0x25')]);_0x58f974[_0xaa17('0x2d')]=_['intersection'](_0x58f974[_0xaa17('0x27')],_0x58f974[_0xaa17('0x25')]);_0x119340[_0xaa17('0x26')]=_[_0xaa17('0x35')](_0x58f974['model'],qs[_0xaa17('0x28')](_0x1f3166[_0xaa17('0x25')][_0xaa17('0x28')]));_0x119340[_0xaa17('0x26')]=_0x119340['attributes'][_0xaa17('0x36')]?_0x119340['attributes']:_0x58f974['model'];if(_0x1f3166[_0xaa17('0x25')]['includeAll']){_0x119340[_0xaa17('0x37')]=[{'all':!![]}];}_0x119340=_['merge']({},_0x119340,_0x1f3166[_0xaa17('0x38')]);return db['Network'][_0xaa17('0x39')](_0x119340)[_0xaa17('0x9')](handleEntityNotFound(_0x22a1e0,null))[_0xaa17('0x9')](respondWithResult(_0x22a1e0,null))[_0xaa17('0x11')](handleError(_0x22a1e0,null));};exports[_0xaa17('0x3a')]=function(_0x524951,_0x2a1df1){var _0x2ee723;return db[_0xaa17('0x31')][_0xaa17('0x3a')](_0x524951['body'],{'raw':!![]})[_0xaa17('0x9')](function(_0x420990){_0x2ee723=_0x420990;return db['Network'][_0xaa17('0x3b')]({'where':{'type':_0x524951[_0xaa17('0x3c')][_0xaa17('0x22')]},'raw':!![]});})[_0xaa17('0x9')](function(_0x1e8bbf){if(_0x2ee723[_0xaa17('0x22')][_0xaa17('0x3d')]()==_0xaa17('0x3e')){var _0x29cade=fs[_0xaa17('0x3f')](path[_0xaa17('0x40')](config[_0xaa17('0x41')],'server/files/templates/stun_multiple.ejs'),_0xaa17('0x42'));var _0x372cf2=ejs['render'](_0x29cade,{'networks':_0x1e8bbf||[]});fs['writeFileSync'](_0xaa17('0x43'),_0x372cf2);return respondWithRpcPromise(_0xaa17('0x44'),_0xaa17('0x3a'),{'module':_0xaa17('0x45')});}else if(_0x2ee723[_0xaa17('0x22')]['toUpperCase']()==_0xaa17('0x46')){var _0x52bc12=fs[_0xaa17('0x3f')](path[_0xaa17('0x40')](config[_0xaa17('0x41')],_0xaa17('0x47')),_0xaa17('0x42'));var _0x437004=ejs['render'](_0x52bc12,{'networks':_0x1e8bbf||[]});fs['writeFileSync'](_0xaa17('0x48'),_0x437004);return respondWithRpcPromise('Reload',_0xaa17('0x3a'),{'module':_0xaa17('0x45')});}else{var _0x37f20d=fs[_0xaa17('0x3f')](path[_0xaa17('0x40')](config[_0xaa17('0x41')],_0xaa17('0x49')),_0xaa17('0x42'));var _0x16a319=ejs[_0xaa17('0x4a')](_0x37f20d,{'networks':_0x1e8bbf||[]});fs[_0xaa17('0x4b')](util[_0xaa17('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x524951[_0xaa17('0x3c')][_0xaa17('0x22')][_0xaa17('0x4d')]()),_0x16a319);return respondWithRpcPromise(_0xaa17('0x44'),_0xaa17('0x3a'),{'module':_0xaa17('0x4e')});}})[_0xaa17('0x9')](function(){return _0x2ee723;})[_0xaa17('0x9')](respondWithResult(_0x2a1df1,0xc9))[_0xaa17('0x11')](handleError(_0x2a1df1,null));};exports[_0xaa17('0x19')]=function(_0x14b526,_0x4fa86f){var _0x21216e;return db['Network']['find']({'where':{'id':_0x14b526[_0xaa17('0x33')]['id']}})[_0xaa17('0x9')](handleEntityNotFound(_0x4fa86f,null))[_0xaa17('0x9')](saveUpdates(_0x14b526['body'],null))[_0xaa17('0x9')](function(_0x3cd1f6){if(_0x3cd1f6){_0x21216e=_0x3cd1f6;return db['Network'][_0xaa17('0x3b')]({'where':{'type':_0x21216e[_0xaa17('0x22')]},'raw':!![]});}return null;})[_0xaa17('0x9')](function(_0x307f8c){if(_0x21216e['type'][_0xaa17('0x3d')]()==_0xaa17('0x3e')){var _0x2d1e89=fs[_0xaa17('0x3f')](path['join'](config['root'],_0xaa17('0x4f')),'utf8');var _0x1fb0b3=ejs['render'](_0x2d1e89,{'networks':_0x307f8c||[]});fs[_0xaa17('0x4b')](_0xaa17('0x43'),_0x1fb0b3);return respondWithRpcPromise('Reload','update',{'module':_0xaa17('0x45')});}else if(_0x21216e['type'][_0xaa17('0x3d')]()==_0xaa17('0x46')){var _0x4249d7=fs[_0xaa17('0x3f')](path['join'](config['root'],_0xaa17('0x47')),_0xaa17('0x42'));var _0x474854=ejs['render'](_0x4249d7,{'networks':_0x307f8c||[]});fs[_0xaa17('0x4b')](_0xaa17('0x48'),_0x474854);return respondWithRpcPromise(_0xaa17('0x44'),_0xaa17('0x19'),{'module':_0xaa17('0x45')});}else{var _0x5a8b6b=fs['readFileSync'](path[_0xaa17('0x40')](config['root'],_0xaa17('0x49')),_0xaa17('0x42'));var _0x4a07f7=ejs['render'](_0x5a8b6b,{'networks':_0x307f8c||[]});fs[_0xaa17('0x4b')](util[_0xaa17('0x4c')](_0xaa17('0x50'),_0x14b526[_0xaa17('0x3c')][_0xaa17('0x22')][_0xaa17('0x4d')]()),_0x4a07f7);return respondWithRpcPromise('Reload',_0xaa17('0x19'),{'module':_0xaa17('0x4e')});}})[_0xaa17('0x9')](function(_0x2864aa){if(_0x2864aa){return _0x21216e;}return null;})[_0xaa17('0x9')](respondWithResult(_0x4fa86f,null))[_0xaa17('0x11')](handleError(_0x4fa86f,null));};exports[_0xaa17('0x1a')]=function(_0x2bbceb,_0x591d05){var _0xbbba96;return db[_0xaa17('0x31')][_0xaa17('0x39')]({'where':{'id':_0x2bbceb['params']['id']}})['then'](function(_0x45fe14){_0xbbba96=_0x45fe14;return _0x45fe14;})['then'](handleEntityNotFound(_0x591d05,null))[_0xaa17('0x9')](removeEntity(_0x591d05,null))[_0xaa17('0x9')](function(){if(_0xbbba96){return db[_0xaa17('0x31')][_0xaa17('0x3b')]({'where':{'type':_0xbbba96[_0xaa17('0x22')]},'raw':!![]});}})[_0xaa17('0x9')](function(_0x45cf32){if(_0xbbba96[_0xaa17('0x22')][_0xaa17('0x3d')]()==_0xaa17('0x3e')){var _0x1fd194=fs['readFileSync'](path[_0xaa17('0x40')](config[_0xaa17('0x41')],'server/files/templates/stun_multiple.ejs'),_0xaa17('0x42'));var _0xae388c=ejs[_0xaa17('0x4a')](_0x1fd194,{'networks':_0x45cf32||[]});fs[_0xaa17('0x4b')](_0xaa17('0x43'),_0xae388c);return respondWithRpcPromise(_0xaa17('0x44'),_0xaa17('0x1a'),{'module':_0xaa17('0x45')});}else if(_0xbbba96[_0xaa17('0x22')]['toUpperCase']()=='TURN'){var _0x4dfa26=fs[_0xaa17('0x3f')](path['join'](config[_0xaa17('0x41')],_0xaa17('0x47')),_0xaa17('0x42'));var _0x1e6a21=ejs['render'](_0x4dfa26,{'networks':_0x45cf32||[]});fs[_0xaa17('0x4b')]('/etc/asterisk/turn_xcally.conf',_0x1e6a21);return respondWithRpcPromise(_0xaa17('0x44'),_0xaa17('0x1a'),{'module':_0xaa17('0x45')});}else{var _0x87c38a=fs[_0xaa17('0x3f')](path[_0xaa17('0x40')](config[_0xaa17('0x41')],_0xaa17('0x49')),_0xaa17('0x42'));var _0x1a9d27=ejs['render'](_0x87c38a,{'networks':_0x45cf32||[]});fs[_0xaa17('0x4b')](util['format'](_0xaa17('0x50'),_0xbbba96[_0xaa17('0x22')][_0xaa17('0x4d')]()),_0x1a9d27);return respondWithRpcPromise(_0xaa17('0x44'),_0xaa17('0x1a'),{'module':'chan_sip.so'});}})[_0xaa17('0x11')](handleError(_0x591d05,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ab65d5a..ab4a1fa 100644 --- a/server/api/network/network.model.js +++ b/server/api/network/network.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1306=['define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x402dfc,_0x250b8d){var _0x799045=function(_0x35b392){while(--_0x35b392){_0x402dfc['push'](_0x402dfc['shift']());}};_0x799045(++_0x250b8d);}(_0x1306,0x17a));var _0x6130=function(_0x227bfa,_0x3b6588){_0x227bfa=_0x227bfa-0x0;var _0x34ff69=_0x1306[_0x227bfa];return _0x34ff69;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var logger=require(_0x6130('0x2'))(_0x6130('0x3'));var moment=require(_0x6130('0x4'));var BPromise=require(_0x6130('0x5'));var rp=require(_0x6130('0x6'));var fs=require('fs');var path=require(_0x6130('0x7'));var rimraf=require(_0x6130('0x8'));var config=require(_0x6130('0x9'));var attributes=require(_0x6130('0xa'));module[_0x6130('0xb')]=function(_0x213e6a,_0x2b965d){return _0x213e6a[_0x6130('0xc')](_0x6130('0xd'),attributes,{'tableName':_0x6130('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad8a=['path','rimraf','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xad8a,0xb0));var _0xaad8=function(_0x39a5f5,_0x5dbbc3){_0x39a5f5=_0x39a5f5-0x0;var _0x458b62=_0xad8a[_0x39a5f5];return _0x458b62;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var logger=require(_0xaad8('0x2'))(_0xaad8('0x3'));var moment=require(_0xaad8('0x4'));var BPromise=require('bluebird');var rp=require(_0xaad8('0x5'));var fs=require('fs');var path=require(_0xaad8('0x6'));var rimraf=require(_0xaad8('0x7'));var config=require('../../config/environment');var attributes=require(_0xaad8('0x8'));module[_0xaad8('0x9')]=function(_0x22c799,_0xeb5d15){return _0x22c799[_0xaad8('0xa')](_0xaad8('0xb'),attributes,{'tableName':_0xaad8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index eab3b18..be489b6 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x377ef6,_0x198fd4){_0x377ef6=_0x377ef6-0x0;var _0x41555b=_0x7a54[_0x377ef6];return _0x41555b;};'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')]('Network,\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 +var _0x7a54=['info','Network,\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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x5ab292,_0x54fe6b){_0x5ab292=_0x5ab292-0x0;var _0x5bd1b4=_0x7a54[_0x5ab292];return _0x5bd1b4;};'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')]('Network,\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/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 183ab8d..528cb99 100644 --- a/server/api/openchannelAccount/index.js +++ b/server/api/openchannelAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x2928b2,_0x15be8a){_0x2928b2=_0x2928b2-0x0;var _0x487182=_0xdb28[_0x2928b2];return _0x487182;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./openchannelAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x9')](_0x8db2('0x15'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x17')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x18')]);router[_0x8db2('0x17')](_0x8db2('0xf'),auth['isAuthenticated'](),controller[_0x8db2('0x19')]);router[_0x8db2('0x17')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1a')]);router[_0x8db2('0x17')](_0x8db2('0x1b'),controller[_0x8db2('0x1c')]);router[_0x8db2('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x17')](_0x8db2('0x15'),auth[_0x8db2('0xa')](),controller['addAgents']);router[_0x8db2('0x17')](_0x8db2('0x1e'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x22')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x23')]);router[_0x8db2('0x22')]('/:id/dispositions',auth[_0x8db2('0xa')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8db2('0x24')]);router[_0x8db2('0x22')](_0x8db2('0x15'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x25')]);module[_0x8db2('0x26')]=router; \ No newline at end of file +var _0x3d04=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','addAnswer','/:id/notify','/:id/applications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x5772f2,_0x3258b6){var _0x58fedb=function(_0xc47035){while(--_0xc47035){_0x5772f2['push'](_0x5772f2['shift']());}};_0x58fedb(++_0x3258b6);}(_0x3d04,0xbe));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['get']('/:id/dispositions',auth[_0x43d0('0xb')](),controller['getDispositions']);router['get'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x10')]);router[_0x43d0('0xa')]('/:id/applications',auth[_0x43d0('0xb')](),controller[_0x43d0('0x11')]);router['get'](_0x43d0('0x12'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x13')]);router['get'](_0x43d0('0x14'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x15')]);router['post']('/',auth[_0x43d0('0xb')](),controller[_0x43d0('0x16')]);router[_0x43d0('0x17')](_0x43d0('0x18'),auth[_0x43d0('0xb')](),controller['addDisposition']);router['post'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x19')]);router['post'](_0x43d0('0x1a'),controller['notify']);router[_0x43d0('0x17')](_0x43d0('0x1b'),auth[_0x43d0('0xb')](),controller['addApplications']);router[_0x43d0('0x17')](_0x43d0('0x14'),auth['isAuthenticated'](),controller[_0x43d0('0x1c')]);router[_0x43d0('0x17')](_0x43d0('0x1d'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x1e')]);router[_0x43d0('0x1f')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x20')]);router[_0x43d0('0x21')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x22')]);router[_0x43d0('0x21')](_0x43d0('0x18'),auth['isAuthenticated'](),controller[_0x43d0('0x23')]);router[_0x43d0('0x21')]('/:id/canned_answers',auth[_0x43d0('0xb')](),controller['removeAnswers']);router[_0x43d0('0x21')](_0x43d0('0x14'),auth['isAuthenticated'](),controller[_0x43d0('0x24')]);module[_0x43d0('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 21d26c3..b9e8b03 100644 --- a/server/api/openchannelAccount/openchannelAccount.attributes.js +++ b/server/api/openchannelAccount/openchannelAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd99b=['mandatoryDisposition','sequelize','exports','STRING','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3457e7,_0x4ce035){var _0x216346=function(_0x28c221){while(--_0x28c221){_0x3457e7['push'](_0x3457e7['shift']());}};_0x216346(++_0x4ce035);}(_0xd99b,0x83));var _0xbd99=function(_0x3c41c8,_0xd46b3c){_0x3c41c8=_0x3c41c8-0x0;var _0x965ce=_0xd99b[_0x3c41c8];return _0x965ce;};'use strict';var Sequelize=require(_0xbd99('0x0'));var rs=require('randomstring');module[_0xbd99('0x1')]={'name':{'type':Sequelize[_0xbd99('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbd99('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xbd99('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbd99('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbd99('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbd99('0x2')]},'queueTransfer':{'type':Sequelize[_0xbd99('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbd99('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd99('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd99('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd99('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xbd99('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xbd99('0x4')],'defaultValue':![],'comment':_0xbd99('0x7'),'set':function(_0x1914e7){if(!_0x1914e7)this[_0xbd99('0x8')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xbd99('0x9'),_0x1914e7);}}}; \ No newline at end of file +var _0xff12=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x41a421,_0x5216d2){var _0x4a22a9=function(_0xacc210){while(--_0xacc210){_0x41a421['push'](_0x41a421['shift']());}};_0x4a22a9(++_0x5216d2);}(_0xff12,0x1de));var _0x2ff1=function(_0x407194,_0x2832be){_0x407194=_0x407194-0x0;var _0x2dd0dc=_0xff12[_0x407194];return _0x2dd0dc;};'use strict';var Sequelize=require(_0x2ff1('0x0'));var rs=require('randomstring');module[_0x2ff1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2ff1('0x2')]},'token':{'type':Sequelize[_0x2ff1('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2ff1('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2ff1('0x3')],'defaultValue':function(){return _0x2ff1('0x4');}},'notificationSound':{'type':Sequelize[_0x2ff1('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2ff1('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2ff1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2ff1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2ff1('0x2')]},'queueTransfer':{'type':Sequelize[_0x2ff1('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2ff1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2ff1('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2ff1('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2ff1('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2ff1('0x8'),'set':function(_0x149c3e){if(!_0x149c3e)this[_0x2ff1('0x9')]('mandatoryDispositionPauseId',null);this[_0x2ff1('0x9')](_0x2ff1('0xa'),_0x149c3e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 1ba5036..923332a 100644 --- a/server/api/openchannelAccount/openchannelAccount.controller.js +++ b/server/api/openchannelAccount/openchannelAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9080=['messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','getInteractions','Owner','Tag','Tags','color','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','Messages','dataValues','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','OpenchannelAccount','findAll','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread'];(function(_0x49e5a7,_0x341428){var _0xb485de=function(_0x5dd1b8){while(--_0x5dd1b8){_0x49e5a7['push'](_0x49e5a7['shift']());}};_0xb485de(++_0x341428);}(_0x9080,0xeb));var _0x0908=function(_0x25fd85,_0x2f31e8){_0x25fd85=_0x25fd85-0x0;var _0x53372=_0x9080[_0x25fd85];return _0x53372;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0908('0x0'));var jsonpatch=require(_0x0908('0x1'));var rp=require('request-promise');var moment=require(_0x0908('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0908('0x3'));var util=require('util');var path=require(_0x0908('0x4'));var sox=require(_0x0908('0x5'));var csv=require(_0x0908('0x6'));var ejs=require(_0x0908('0x7'));var fs=require('fs');var fs_extra=require(_0x0908('0x8'));var _=require(_0x0908('0x9'));var squel=require(_0x0908('0xa'));var crypto=require(_0x0908('0xb'));var jsforce=require(_0x0908('0xc'));var deskjs=require(_0x0908('0xd'));var toCsv=require(_0x0908('0x6'));var querystring=require('querystring');var Papa=require(_0x0908('0xe'));var Redis=require(_0x0908('0xf'));var authService=require(_0x0908('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0908('0x11'))(_0x0908('0x12'));var utils=require(_0x0908('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0908('0x14'));var db=require(_0x0908('0x15'))['db'];config['redis']=_[_0x0908('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0908('0x17'))(new Redis(config['redis']));require(_0x0908('0x18'))['register'](socket);var jayson=require(_0x0908('0x19'));var client=jayson[_0x0908('0x1a')][_0x0908('0x1b')]({'port':0x232c});var client9002=jayson[_0x0908('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfb4904,_0x506d21,_0x2673cf,_0x6edbaf){return new BPromise(function(_0x2db1da,_0xd86b8){var _0x4640f8=_0x6edbaf||client;return _0x4640f8[_0x0908('0x1c')](_0xfb4904,_0x2673cf)[_0x0908('0x1d')](function(_0x17ba86){logger['info'](_0x0908('0x1e'),_0x506d21,_0x0908('0x1f'));logger[_0x0908('0x20')](_0x0908('0x21'),_0x506d21,'request\x20sent',JSON[_0x0908('0x22')](_0x17ba86));if(_0x17ba86['error']){if(_0x17ba86[_0x0908('0x23')][_0x0908('0x24')]===0x1f4){logger[_0x0908('0x23')](_0x0908('0x1e'),_0x506d21,_0x17ba86['error'][_0x0908('0x25')]);return _0xd86b8(_0x17ba86['error']['message']);}logger[_0x0908('0x23')](_0x0908('0x1e'),_0x506d21,_0x17ba86['error'][_0x0908('0x25')]);return _0x2db1da(_0x17ba86['error'][_0x0908('0x25')]);}else{logger[_0x0908('0x26')](_0x0908('0x1e'),_0x506d21,_0x0908('0x1f'));_0x2db1da(_0x17ba86[_0x0908('0x27')]['message']);}})[_0x0908('0x28')](function(_0x20d7aa){logger[_0x0908('0x23')](_0x0908('0x1e'),_0x506d21,_0x20d7aa);_0xd86b8(_0x20d7aa);});});}function respondWithStatusCode(_0x20a092,_0x26538a){_0x26538a=_0x26538a||0xcc;return function(_0xca1927){if(_0xca1927){return _0x20a092[_0x0908('0x29')](_0x26538a);}return _0x20a092[_0x0908('0x2a')](_0x26538a)['end']();};}function respondWithResult(_0x28996b,_0x5958a1){_0x5958a1=_0x5958a1||0xc8;return function(_0x17e2e7){if(_0x17e2e7){return _0x28996b['status'](_0x5958a1)[_0x0908('0x2b')](_0x17e2e7);}};}function respondWithFilteredResult(_0x3ae151,_0x12336d){return function(_0x2fbb4b){if(_0x2fbb4b){var _0x3c3fe7=typeof _0x12336d[_0x0908('0x2c')]===_0x0908('0x2d')&&typeof _0x12336d[_0x0908('0x2e')]===_0x0908('0x2d');var _0x47e6ce=_0x2fbb4b[_0x0908('0x2f')];var _0x158d4d=_0x3c3fe7?0x0:_0x12336d[_0x0908('0x2c')];var _0x35f70d=_0x3c3fe7?_0x2fbb4b['count']:_0x12336d[_0x0908('0x2c')]+_0x12336d['limit'];var _0x322bc2;if(_0x35f70d>=_0x47e6ce){_0x35f70d=_0x47e6ce;_0x322bc2=0xc8;}else{_0x322bc2=0xce;}_0x3ae151[_0x0908('0x2a')](_0x322bc2);return _0x3ae151[_0x0908('0x30')](_0x0908('0x31'),_0x158d4d+'-'+_0x35f70d+'/'+_0x47e6ce)[_0x0908('0x2b')](_0x2fbb4b);}return null;};}function patchUpdates(_0x34af7f){return function(_0xa96f08){try{jsonpatch[_0x0908('0x32')](_0xa96f08,_0x34af7f,!![]);}catch(_0x2335d3){return BPromise[_0x0908('0x33')](_0x2335d3);}return _0xa96f08[_0x0908('0x34')]();};}function saveUpdates(_0x3c443b,_0x438097){return function(_0x385146){if(_0x385146){return _0x385146['update'](_0x3c443b)['then'](function(_0x58773b){return _0x58773b;});}return null;};}function removeEntity(_0x147687,_0x3deaab){return function(_0x183a41){if(_0x183a41){return _0x183a41[_0x0908('0x35')]()[_0x0908('0x1d')](function(){var _0x22f9c6=_0x183a41[_0x0908('0x36')]({'plain':!![]});var _0x58582b=_0x0908('0x37');return db['UserProfileResource'][_0x0908('0x35')]({'where':{'type':_0x58582b,'resourceId':_0x22f9c6['id']}})[_0x0908('0x1d')](function(){return _0x183a41;});})[_0x0908('0x1d')](function(){_0x147687['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56b847,_0x15fdea){return function(_0x527878){if(!_0x527878){_0x56b847['sendStatus'](0x194);}return _0x527878;};}function handleError(_0x2824b3,_0x45bace){_0x45bace=_0x45bace||0x1f4;return function(_0x54d67c){logger[_0x0908('0x23')](_0x54d67c['stack']);if(_0x54d67c['name']){delete _0x54d67c[_0x0908('0x38')];}_0x2824b3['status'](_0x45bace)[_0x0908('0x39')](_0x54d67c);};}exports[_0x0908('0x3a')]=function(_0x2d7801,_0x539dfe){var _0x44ce07={'include':[{'model':db[_0x0908('0x3b')],'as':_0x0908('0x3c')}]},_0x37503c={},_0x19d75c={'count':0x0,'rows':[]};var _0x4c338a=_[_0x0908('0x3d')](db['OpenchannelAccount'][_0x0908('0x3e')],function(_0x17d7ac){return{'name':_0x17d7ac['fieldName'],'type':_0x17d7ac[_0x0908('0x3f')]['key']};});_0x37503c['model']=_[_0x0908('0x3d')](_0x4c338a,'name');_0x37503c[_0x0908('0x40')]=_[_0x0908('0x41')](_0x2d7801[_0x0908('0x40')]);_0x37503c[_0x0908('0x42')]=_[_0x0908('0x43')](_0x37503c[_0x0908('0x44')],_0x37503c[_0x0908('0x40')]);_0x44ce07[_0x0908('0x45')]=_[_0x0908('0x43')](_0x37503c[_0x0908('0x44')],qs[_0x0908('0x46')](_0x2d7801[_0x0908('0x40')][_0x0908('0x46')]));_0x44ce07['attributes']=_0x44ce07['attributes'][_0x0908('0x47')]?_0x44ce07[_0x0908('0x45')]:_0x37503c['model'];if(!_0x2d7801[_0x0908('0x40')]['hasOwnProperty'](_0x0908('0x48'))){_0x44ce07[_0x0908('0x2e')]=qs[_0x0908('0x2e')](_0x2d7801[_0x0908('0x40')][_0x0908('0x2e')]);_0x44ce07[_0x0908('0x2c')]=qs['offset'](_0x2d7801[_0x0908('0x40')][_0x0908('0x2c')]);}_0x44ce07[_0x0908('0x49')]=qs[_0x0908('0x4a')](_0x2d7801[_0x0908('0x40')][_0x0908('0x4a')]);_0x44ce07[_0x0908('0x4b')]=qs[_0x0908('0x42')](_[_0x0908('0x4c')](_0x2d7801['query'],_0x37503c[_0x0908('0x42')]),_0x4c338a);if(_0x2d7801[_0x0908('0x40')]['filter']){_0x44ce07['where']=_['merge'](_0x44ce07[_0x0908('0x4b')],{'$or':_[_0x0908('0x3d')](_0x4c338a,function(_0x209212){if(_0x209212[_0x0908('0x3f')]!==_0x0908('0x4d')){var _0x84d255={};_0x84d255[_0x209212[_0x0908('0x38')]]={'$like':'%'+_0x2d7801[_0x0908('0x40')][_0x0908('0x4e')]+'%'};return _0x84d255;}})});}_0x44ce07=_[_0x0908('0x4f')]({},_0x44ce07,_0x2d7801[_0x0908('0x50')]);var _0x5e4f76={'where':_0x44ce07[_0x0908('0x4b')]};return db['OpenchannelAccount'][_0x0908('0x2f')](_0x5e4f76)[_0x0908('0x1d')](function(_0x440d1d){_0x19d75c[_0x0908('0x2f')]=_0x440d1d;if(_0x2d7801[_0x0908('0x40')][_0x0908('0x51')]){_0x44ce07[_0x0908('0x52')]=[{'all':!![]}];}return db[_0x0908('0x53')][_0x0908('0x54')](_0x44ce07);})[_0x0908('0x1d')](function(_0x6abb98){_0x19d75c[_0x0908('0x55')]=_0x6abb98;return _0x19d75c;})[_0x0908('0x1d')](respondWithFilteredResult(_0x539dfe,_0x44ce07))[_0x0908('0x28')](handleError(_0x539dfe,null));};exports[_0x0908('0x56')]=function(_0xd3298d,_0x3527a6){var _0x2c4397={'raw':![],'where':{'id':_0xd3298d[_0x0908('0x57')]['id']},'include':[{'model':db[_0x0908('0x3b')],'as':_0x0908('0x3c')}]},_0x551b96={};_0x551b96[_0x0908('0x44')]=_[_0x0908('0x41')](db[_0x0908('0x53')]['rawAttributes']);_0x551b96[_0x0908('0x40')]=_[_0x0908('0x41')](_0xd3298d[_0x0908('0x40')]);_0x551b96[_0x0908('0x42')]=_['intersection'](_0x551b96[_0x0908('0x44')],_0x551b96[_0x0908('0x40')]);_0x2c4397[_0x0908('0x45')]=_['intersection'](_0x551b96[_0x0908('0x44')],qs[_0x0908('0x46')](_0xd3298d[_0x0908('0x40')]['fields']));_0x2c4397[_0x0908('0x45')]=_0x2c4397['attributes'][_0x0908('0x47')]?_0x2c4397['attributes']:_0x551b96[_0x0908('0x44')];if(_0xd3298d[_0x0908('0x40')][_0x0908('0x51')]){_0x2c4397[_0x0908('0x52')]=[{'all':!![]}];}_0x2c4397=_['merge']({},_0x2c4397,_0xd3298d['options']);return db[_0x0908('0x53')]['find'](_0x2c4397)[_0x0908('0x1d')](handleEntityNotFound(_0x3527a6,null))[_0x0908('0x1d')](respondWithResult(_0x3527a6,null))[_0x0908('0x28')](handleError(_0x3527a6,null));};exports[_0x0908('0x58')]=function(_0x56f7de,_0x3efcbf){return db[_0x0908('0x53')]['create'](_0x56f7de[_0x0908('0x59')],{})['then'](function(_0x3633f7){var _0x19d688=_0x56f7de[_0x0908('0x5a')]['get']({'plain':!![]});if(!_0x19d688)throw new Error(_0x0908('0x5b'));if(_0x19d688[_0x0908('0x5c')]===_0x0908('0x5a')){var _0xcc8270=_0x3633f7['get']({'plain':!![]});var _0x6d753f='OpenchannelAccounts';return db[_0x0908('0x5d')][_0x0908('0x5e')]({'where':{'name':_0x6d753f,'userProfileId':_0x19d688[_0x0908('0x5f')]},'raw':!![]})[_0x0908('0x1d')](function(_0x4faac5){if(_0x4faac5&&_0x4faac5[_0x0908('0x60')]===0x0){return db[_0x0908('0x61')][_0x0908('0x58')]({'name':_0xcc8270[_0x0908('0x38')],'resourceId':_0xcc8270['id'],'type':_0x4faac5[_0x0908('0x38')],'sectionId':_0x4faac5['id']},{})[_0x0908('0x1d')](function(){return _0x3633f7;});}else{return _0x3633f7;}})['catch'](function(_0x5f26b4){logger[_0x0908('0x23')](_0x0908('0x62'),_0x5f26b4);throw _0x5f26b4;});}return _0x3633f7;})[_0x0908('0x1d')](respondWithResult(_0x3efcbf,0xc9))[_0x0908('0x28')](handleError(_0x3efcbf,null));};exports[_0x0908('0x63')]=function(_0x463702,_0x20c492){if(_0x463702[_0x0908('0x59')]['id']){delete _0x463702[_0x0908('0x59')]['id'];}return db[_0x0908('0x53')][_0x0908('0x5e')]({'where':{'id':_0x463702[_0x0908('0x57')]['id']},'include':[{'model':db[_0x0908('0x3b')],'as':_0x0908('0x3c')}]})[_0x0908('0x1d')](handleEntityNotFound(_0x20c492,null))['then'](saveUpdates(_0x463702[_0x0908('0x59')],null))[_0x0908('0x1d')](respondWithResult(_0x20c492,null))[_0x0908('0x28')](handleError(_0x20c492,null));};exports['destroy']=function(_0x4a45ae,_0x1e94f9){return db['OpenchannelAccount'][_0x0908('0x5e')]({'where':{'id':_0x4a45ae[_0x0908('0x57')]['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x1e94f9,null))[_0x0908('0x1d')](removeEntity(_0x1e94f9,null))[_0x0908('0x28')](handleError(_0x1e94f9,null));};exports[_0x0908('0x64')]=function(_0x422532,_0x2dae44){return db[_0x0908('0x53')]['describe']()[_0x0908('0x1d')](respondWithResult(_0x2dae44,null))[_0x0908('0x28')](handleError(_0x2dae44,null));};exports[_0x0908('0x65')]=function(_0x4444bd,_0x28880f,_0x514fd5){if(_0x4444bd[_0x0908('0x59')]['id']){delete _0x4444bd['body']['id'];}return db['OpenchannelAccount'][_0x0908('0x5e')]({'where':{'id':_0x4444bd[_0x0908('0x57')]['id']}})['then'](handleEntityNotFound(_0x28880f,null))[_0x0908('0x1d')](function(_0x1dac19){if(_0x1dac19){_0x4444bd[_0x0908('0x59')]['OpenchannelAccountId']=_0x1dac19['id'];return db[_0x0908('0x66')][_0x0908('0x58')](_0x4444bd[_0x0908('0x59')]);}})[_0x0908('0x1d')](respondWithResult(_0x28880f,null))['catch'](handleError(_0x28880f,null));};exports[_0x0908('0x67')]=function(_0x51a861,_0x45250b,_0x2956d1){var _0x207fae={'raw':![],'where':{}};var _0x475eed={};var _0x3e2c12={'count':0x0,'rows':[]};return db[_0x0908('0x53')]['findOne']({'where':{'id':_0x51a861[_0x0908('0x57')]['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x45250b,null))[_0x0908('0x1d')](function(_0x48e870){if(_0x48e870){_0x475eed['model']=_[_0x0908('0x41')](db['Disposition'][_0x0908('0x3e')]);_0x475eed[_0x0908('0x40')]=_[_0x0908('0x41')](_0x51a861[_0x0908('0x40')]);_0x475eed[_0x0908('0x42')]=_[_0x0908('0x43')](_0x475eed[_0x0908('0x44')],_0x475eed[_0x0908('0x40')]);_0x207fae[_0x0908('0x45')]=_[_0x0908('0x43')](_0x475eed[_0x0908('0x44')],qs[_0x0908('0x46')](_0x51a861['query'][_0x0908('0x46')]));_0x207fae[_0x0908('0x45')]=_0x207fae[_0x0908('0x45')]['length']?_0x207fae[_0x0908('0x45')]:_0x475eed[_0x0908('0x44')];if(!_0x51a861['query'][_0x0908('0x68')]('nolimit')){_0x207fae[_0x0908('0x2e')]=qs[_0x0908('0x2e')](_0x51a861[_0x0908('0x40')]['limit']);_0x207fae[_0x0908('0x2c')]=qs[_0x0908('0x2c')](_0x51a861['query'][_0x0908('0x2c')]);}_0x207fae['order']=qs[_0x0908('0x4a')](_0x51a861[_0x0908('0x40')][_0x0908('0x4a')]);_0x207fae[_0x0908('0x4b')]=qs[_0x0908('0x42')](_[_0x0908('0x4c')](_0x51a861['query'],_0x475eed[_0x0908('0x42')]));_0x207fae[_0x0908('0x4b')][_0x0908('0x69')]=_0x48e870['id'];if(_0x51a861[_0x0908('0x40')][_0x0908('0x4e')]){_0x207fae[_0x0908('0x4b')]=_['merge'](_0x207fae[_0x0908('0x4b')],{'$or':_[_0x0908('0x3d')](_0x207fae[_0x0908('0x45')],function(_0x1df2a1){var _0x11837c={};_0x11837c[_0x1df2a1]={'$like':'%'+_0x51a861[_0x0908('0x40')]['filter']+'%'};return _0x11837c;})});}_0x207fae=_['merge']({},_0x207fae,_0x51a861[_0x0908('0x50')]);return db[_0x0908('0x66')][_0x0908('0x2f')]({'where':_0x207fae['where']})[_0x0908('0x1d')](function(_0x37de83){_0x3e2c12['count']=_0x37de83;if(_0x51a861[_0x0908('0x40')]['includeAll']){_0x207fae[_0x0908('0x52')]=[{'all':!![]}];}return db[_0x0908('0x66')]['findAll'](_0x207fae);})['then'](function(_0x168e28){_0x3e2c12[_0x0908('0x55')]=_0x168e28;return _0x3e2c12;});}})[_0x0908('0x1d')](respondWithFilteredResult(_0x45250b,_0x207fae))[_0x0908('0x28')](handleError(_0x45250b,null));};exports[_0x0908('0x6a')]=function(_0x2dc7fa,_0x292e68,_0xd8bc72){return db[_0x0908('0x53')][_0x0908('0x5e')]({'where':{'id':_0x2dc7fa[_0x0908('0x57')]['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x292e68,null))['then'](function(_0x23279d){if(_0x23279d){return _0x23279d[_0x0908('0x6a')](_0x2dc7fa[_0x0908('0x40')]['ids']);}})[_0x0908('0x1d')](respondWithStatusCode(_0x292e68,null))[_0x0908('0x28')](handleError(_0x292e68,null));};exports[_0x0908('0x6b')]=function(_0x31db8f,_0x146b82,_0x8ac13b){if(_0x31db8f[_0x0908('0x59')]['id']){delete _0x31db8f[_0x0908('0x59')]['id'];}return db[_0x0908('0x53')][_0x0908('0x5e')]({'where':{'id':_0x31db8f[_0x0908('0x57')]['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x146b82,null))[_0x0908('0x1d')](function(_0x25240a){if(_0x25240a){_0x31db8f[_0x0908('0x59')][_0x0908('0x69')]=_0x25240a['id'];return db[_0x0908('0x6c')][_0x0908('0x58')](_0x31db8f[_0x0908('0x59')]);}})['then'](respondWithResult(_0x146b82,null))['catch'](handleError(_0x146b82,null));};exports[_0x0908('0x6d')]=function(_0x26fad3,_0x28f754,_0x25116c){var _0x3e39c1={'raw':![],'where':{}};var _0x3ddf10={};var _0x578b82={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0908('0x6e')]({'where':{'id':_0x26fad3[_0x0908('0x57')]['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x28f754,null))[_0x0908('0x1d')](function(_0x552c60){if(_0x552c60){_0x3ddf10[_0x0908('0x44')]=_[_0x0908('0x41')](db[_0x0908('0x6c')][_0x0908('0x3e')]);_0x3ddf10[_0x0908('0x40')]=_[_0x0908('0x41')](_0x26fad3[_0x0908('0x40')]);_0x3ddf10[_0x0908('0x42')]=_[_0x0908('0x43')](_0x3ddf10['model'],_0x3ddf10[_0x0908('0x40')]);_0x3e39c1[_0x0908('0x45')]=_[_0x0908('0x43')](_0x3ddf10[_0x0908('0x44')],qs['fields'](_0x26fad3['query'][_0x0908('0x46')]));_0x3e39c1['attributes']=_0x3e39c1[_0x0908('0x45')]['length']?_0x3e39c1[_0x0908('0x45')]:_0x3ddf10[_0x0908('0x44')];if(!_0x26fad3['query'][_0x0908('0x68')]('nolimit')){_0x3e39c1[_0x0908('0x2e')]=qs[_0x0908('0x2e')](_0x26fad3[_0x0908('0x40')][_0x0908('0x2e')]);_0x3e39c1['offset']=qs[_0x0908('0x2c')](_0x26fad3['query'][_0x0908('0x2c')]);}_0x3e39c1[_0x0908('0x49')]=qs[_0x0908('0x4a')](_0x26fad3['query']['sort']);_0x3e39c1[_0x0908('0x4b')]=qs[_0x0908('0x42')](_[_0x0908('0x4c')](_0x26fad3[_0x0908('0x40')],_0x3ddf10[_0x0908('0x42')]));_0x3e39c1[_0x0908('0x4b')][_0x0908('0x69')]=_0x552c60['id'];if(_0x26fad3[_0x0908('0x40')][_0x0908('0x4e')]){_0x3e39c1['where']=_[_0x0908('0x4f')](_0x3e39c1[_0x0908('0x4b')],{'$or':_[_0x0908('0x3d')](_0x3e39c1[_0x0908('0x45')],function(_0x215b26){var _0x2b8677={};_0x2b8677[_0x215b26]={'$like':'%'+_0x26fad3['query']['filter']+'%'};return _0x2b8677;})});}_0x3e39c1=_[_0x0908('0x4f')]({},_0x3e39c1,_0x26fad3[_0x0908('0x50')]);return db['CannedAnswer'][_0x0908('0x2f')]({'where':_0x3e39c1[_0x0908('0x4b')]})[_0x0908('0x1d')](function(_0xb4923a){_0x578b82[_0x0908('0x2f')]=_0xb4923a;if(_0x26fad3[_0x0908('0x40')][_0x0908('0x51')]){_0x3e39c1[_0x0908('0x52')]=[{'all':!![]}];}return db[_0x0908('0x6c')][_0x0908('0x54')](_0x3e39c1);})[_0x0908('0x1d')](function(_0x2e2df6){_0x578b82[_0x0908('0x55')]=_0x2e2df6;return _0x578b82;});}})[_0x0908('0x1d')](respondWithFilteredResult(_0x28f754,_0x3e39c1))[_0x0908('0x28')](handleError(_0x28f754,null));};exports['removeAnswers']=function(_0xe34c5f,_0x435350,_0x4c0cdd){return db['OpenchannelAccount']['find']({'where':{'id':_0xe34c5f[_0x0908('0x57')]['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x435350,null))[_0x0908('0x1d')](function(_0x12e136){if(_0x12e136){return _0x12e136[_0x0908('0x6f')](_0xe34c5f['query']['ids']);}})[_0x0908('0x1d')](respondWithStatusCode(_0x435350,null))[_0x0908('0x28')](handleError(_0x435350,null));};exports[_0x0908('0x70')]=function(_0x599b95,_0x324390,_0x2b036a){var _0x5a2f43={'body':_0x599b95[_0x0908('0x59')],'channel':_0x0908('0x71')};var _0x673b50=[];var _0x5003ac=[];var _0x3ff211={};var _0x1783ed=![];return db[_0x0908('0x72')][_0x0908('0x64')]()[_0x0908('0x1d')](function(_0x128f16){if(!_0x128f16){throw new db[(_0x0908('0x73'))]['ValidationError'](_0x0908('0x74'));}_0x673b50=_['difference'](_['keys'](_0x128f16),[_0x0908('0x75'),_0x0908('0x76')]);_0x5003ac=_[_0x0908('0x77')](_[_0x0908('0x41')](_0x128f16),[_0x0908('0x75'),_0x0908('0x76'),'CompanyId',_0x0908('0x78')]);if(_0x599b95[_0x0908('0x59')]['id']){delete _0x599b95[_0x0908('0x59')]['id'];}if(_['isNil'](_0x599b95[_0x0908('0x59')][_0x0908('0x79')])){throw new db[(_0x0908('0x73'))][(_0x0908('0x7a'))](_0x0908('0x7b'));}if(_[_0x0908('0x7c')](_0x599b95[_0x0908('0x59')][_0x0908('0x59')])||_0x599b95['body'][_0x0908('0x59')]===''){throw new db[(_0x0908('0x73'))][(_0x0908('0x7a'))](_0x0908('0x7d'));}if(_[_0x0908('0x7c')](_0x599b95[_0x0908('0x59')][_0x0908('0x7e')])){throw new db[(_0x0908('0x73'))][(_0x0908('0x7a'))](_0x0908('0x7f')+_0x5003ac);}if(!_[_0x0908('0x80')](_0x5003ac,_0x599b95[_0x0908('0x59')][_0x0908('0x7e')])){throw new db[(_0x0908('0x73'))][(_0x0908('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5003ac);}_0x3ff211[_0x599b95[_0x0908('0x59')][_0x0908('0x7e')]]=_0x599b95[_0x0908('0x59')][_0x0908('0x79')];})[_0x0908('0x1d')](function(){return db[_0x0908('0x53')][_0x0908('0x5e')]({'where':{'id':_0x599b95['params']['id']},'include':[{'model':db[_0x0908('0x81')],'as':_0x0908('0x82'),'include':[{'model':db[_0x0908('0x72')],'as':_0x0908('0x83'),'where':_0x3ff211,'limit':0x1,'order':[[_0x0908('0x76'),_0x0908('0x84')]]}]},{'model':db[_0x0908('0x85')],'as':_0x0908('0x86')}]});})[_0x0908('0x1d')](handleEntityNotFound(_0x324390,null))[_0x0908('0x1d')](function(_0x398b6d){if(_0x398b6d&&_0x398b6d[_0x0908('0x82')]){_0x5a2f43[_0x0908('0x87')]=_0x398b6d;_0x5a2f43['applications']=_0x398b6d[_0x0908('0x86')];_0x5a2f43['list']=_0x398b6d[_0x0908('0x82')];_0x5a2f43['applications']=_['orderBy'](_0x5a2f43[_0x0908('0x88')],[_0x0908('0x89')],[_0x0908('0x8a')]);if(_0x5a2f43[_0x0908('0x87')]['Applications']){delete _0x5a2f43[_0x0908('0x87')]['Applications'];}if(_0x5a2f43[_0x0908('0x87')]['List']&&_0x5a2f43[_0x0908('0x87')][_0x0908('0x82')][_0x0908('0x83')][_0x0908('0x47')]){return _0x5a2f43[_0x0908('0x87')][_0x0908('0x82')][_0x0908('0x83')][0x0];}var _0x385c39=_[_0x0908('0x16')](_0x599b95[_0x0908('0x59')],{'firstName':_0x599b95[_0x0908('0x59')][_0x0908('0x79')],'ListId':_0x398b6d['ListId']});_0x385c39[_0x599b95[_0x0908('0x59')][_0x0908('0x7e')]]=_0x599b95[_0x0908('0x59')][_0x0908('0x79')];return db[_0x0908('0x72')][_0x0908('0x58')](_0x385c39,{'fields':_0x673b50,'raw':!![]});}})[_0x0908('0x1d')](handleEntityNotFound(_0x324390,null))[_0x0908('0x1d')](function(_0x2822b9){_0x5a2f43[_0x0908('0x8b')]=_0x2822b9;if(_0x2822b9){var _0x332cee={'ContactId':_0x2822b9['id'],'OpenchannelAccountId':_0x599b95['params']['id'],'from':(_0x2822b9[_0x0908('0x8c')]||'')+'\x20'+(_0x2822b9[_0x0908('0x8d')]||'')};var _0x2e990d={'OpenchannelAccountId':_0x599b95[_0x0908('0x57')]['id'],'closed':![]};if(_0x599b95['body']['threadId']){_0x2e990d[_0x0908('0x8e')]=_0x599b95[_0x0908('0x59')]['threadId'];return db[_0x0908('0x8f')][_0x0908('0x5e')]({'where':_0x2e990d})['then'](function(_0x26c6cb){if(_0x26c6cb){return[_0x26c6cb,![]];}_0x332cee['threadId']=_0x599b95[_0x0908('0x59')][_0x0908('0x8e')];_0x332cee[_0x0908('0x90')]=_0x599b95[_0x0908('0x59')]['externalUrl'];return db['OpenchannelInteraction'][_0x0908('0x58')](_0x332cee)[_0x0908('0x1d')](function(_0x23a10e){return[_0x23a10e,!![]];});});}else{_0x2e990d[_0x0908('0x8e')]=null;}_0x2e990d[_0x0908('0x91')]=_0x2822b9['id'];return db['OpenchannelInteraction'][_0x0908('0x5e')]({'where':_0x2e990d})[_0x0908('0x1d')](function(_0x4df4c5){if(_0x4df4c5){return[_0x4df4c5,![]];}return db[_0x0908('0x8f')][_0x0908('0x58')](_0x332cee)[_0x0908('0x1d')](function(_0x46566b){return[_0x46566b,!![]];});});}})[_0x0908('0x92')](function(_0x106c5a,_0x4bfb73){if(_0x106c5a){_0x1783ed=_0x4bfb73;if(!_0x4bfb73){var _0x5ae8b8={'from':(_0x5a2f43[_0x0908('0x8b')][_0x0908('0x8c')]||'')+'\x20'+(_0x5a2f43[_0x0908('0x8b')][_0x0908('0x8d')]||'')};if(_0x599b95[_0x0908('0x59')][_0x0908('0x8e')]&&_0x599b95[_0x0908('0x59')][_0x0908('0x93')]&&_0x599b95[_0x0908('0x59')]['threadId']!=_0x599b95[_0x0908('0x59')][_0x0908('0x93')]){_0x5ae8b8[_0x0908('0x8e')]=_0x599b95[_0x0908('0x59')]['messageId'];}return _0x106c5a[_0x0908('0x63')](_0x5ae8b8);}else{return _0x106c5a;}}})[_0x0908('0x1d')](function(_0x55d418){_0x5a2f43['interaction']=_0x55d418['get']({'plain':!![]});_0x5a2f43[_0x0908('0x94')][_0x0908('0x95')]=_0x1783ed;if(_0x5a2f43[_0x0908('0x94')][_0x0908('0x95')]){if(_0x5a2f43[_0x0908('0x87')][_0x0908('0x96')]){_0x5a2f43[_0x0908('0x88')][_0x0908('0x97')]({'id':0x0,'priority':_0x5a2f43[_0x0908('0x88')][_0x0908('0x47')]+0x1,'app':_0x0908('0x98'),'appdata':_0x0908('0x99'),'interval':_0x0908('0x9a')});}}return db['OpenchannelMessage'][_0x0908('0x58')]({'body':_0x599b95[_0x0908('0x59')]['body'],'OpenchannelAccountId':_0x599b95[_0x0908('0x57')]['id'],'OpenchannelInteractionId':_0x55d418['id'],'direction':'in','ContactId':_0x5a2f43[_0x0908('0x8b')]['id'],'AttachmentId':_0x599b95[_0x0908('0x59')][_0x0908('0x9b')]});})['then'](function(_0x1078f4){_0x5a2f43[_0x0908('0x25')]=_0x1078f4;if(!_0x5a2f43[_0x0908('0x94')][_0x0908('0x9c')])return;return db['User'][_0x0908('0x5e')]({'attributes':['id',_0x0908('0x38')],'where':{'id':_0x5a2f43[_0x0908('0x94')]['UserId']}});})[_0x0908('0x1d')](function(_0x589135){if(_0x589135){_0x5a2f43[_0x0908('0x88')][_0x0908('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x589135['name']+','+(_0x5a2f43['account'][_0x0908('0x9e')]||0xa),'interval':_0x0908('0x9a')});}if(!_0x5a2f43[_0x0908('0x94')]['queueId'])return;return db[_0x0908('0x9f')][_0x0908('0x5e')]({'attributes':['id',_0x0908('0x38')],'where':{'id':_0x5a2f43[_0x0908('0x94')]['queueId']}});})[_0x0908('0x1d')](function(_0x3a8edc){if(_0x3a8edc){_0x5a2f43['applications'][_0x0908('0x9d')]({'id':0x0,'priority':0x1,'app':_0x0908('0xa0'),'appdata':_0x3a8edc[_0x0908('0x38')]+','+(_0x5a2f43[_0x0908('0x87')][_0x0908('0xa1')]||0x12c),'interval':_0x0908('0x9a')});}return respondWithRpcPromise(_0x0908('0xa2'),_0x0908('0xa3'),_0x5a2f43);})[_0x0908('0x1d')](function(_0x1ee664){respondWithRpcPromise(_0x0908('0xa4'),'EventManager',{'event':'notify','message':_0x1ee664},client9002);return _0x1ee664;})[_0x0908('0x1d')](respondWithResult(_0x324390,null))[_0x0908('0x28')](handleError(_0x324390,null));};exports[_0x0908('0xa5')]=function(_0x142978,_0x565d60){var _0x41cdb9=_0x142978[_0x0908('0x57')]['id'];var _0x50680f=_0x142978[_0x0908('0x59')];var _0x16c793=0xc8;var _0x5ced42=null;return db['sequelize'][_0x0908('0xa6')]({'isolationLevel':db[_0x0908('0xa7')][_0x0908('0xa8')][_0x0908('0xa9')][_0x0908('0xaa')]},function(_0x1adc6a){return db[_0x0908('0x53')][_0x0908('0x6e')]({'where':{'id':_0x41cdb9},'transaction':_0x1adc6a})[_0x0908('0x1d')](function(_0x1fb9b6){if(_0x1fb9b6){return db[_0x0908('0x85')][_0x0908('0x35')]({'where':{'OpenchannelAccountId':_0x41cdb9},'transaction':_0x1adc6a})['then'](function(){var _0x404b62=_['map'](_0x50680f,function(_0x2f0e82){_0x2f0e82[_0x0908('0x69')]=_0x41cdb9;return _0x2f0e82;});return db[_0x0908('0x85')][_0x0908('0xab')](_0x404b62,{'transaction':_0x1adc6a});});}else{_0x16c793=0x194;_0x5ced42=[];}});})[_0x0908('0x1d')](function(){if(_0x16c793!==0x194){return db[_0x0908('0x85')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x41cdb9},'order':_0x0908('0x89')})[_0x0908('0x1d')](function(_0xb86de7){_0x5ced42=_0xb86de7;});}})[_0x0908('0x28')](function(_0x52303b){_0x16c793=0x1f4;logger[_0x0908('0x23')](_0x52303b['stack']);if(_0x52303b[_0x0908('0x38')]){delete _0x52303b['name'];}_0x5ced42=_0x52303b;})['finally'](function(){if(_0x5ced42===null){_0x565d60['sendStatus'](_0x16c793);}else{if(_0x16c793===0x1f4){_0x565d60[_0x0908('0x2a')](_0x16c793)['send'](_0x5ced42);}else{_0x565d60[_0x0908('0x2a')](_0x16c793)[_0x0908('0x2b')](_0x5ced42);}}});};exports[_0x0908('0xac')]=function(_0x20d7f5,_0x4bb3fe,_0x51c0a5){var _0xc9f064={};var _0x2c51ed={};var _0x57eb92;var _0x38bb22;return db[_0x0908('0x53')][_0x0908('0x6e')]({'where':{'id':_0x20d7f5[_0x0908('0x57')]['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x4bb3fe,null))[_0x0908('0x1d')](function(_0x30194c){if(_0x30194c){_0x57eb92=_0x30194c;_0x2c51ed[_0x0908('0x44')]=_['keys'](db[_0x0908('0x85')][_0x0908('0x3e')]);_0x2c51ed[_0x0908('0x40')]=_[_0x0908('0x41')](_0x20d7f5[_0x0908('0x40')]);_0x2c51ed[_0x0908('0x42')]=_[_0x0908('0x43')](_0x2c51ed[_0x0908('0x44')],_0x2c51ed[_0x0908('0x40')]);_0xc9f064[_0x0908('0x45')]=_[_0x0908('0x43')](_0x2c51ed[_0x0908('0x44')],qs[_0x0908('0x46')](_0x20d7f5[_0x0908('0x40')][_0x0908('0x46')]));_0xc9f064[_0x0908('0x45')]=_0xc9f064[_0x0908('0x45')][_0x0908('0x47')]?_0xc9f064[_0x0908('0x45')]:_0x2c51ed[_0x0908('0x44')];_0xc9f064[_0x0908('0x49')]=qs[_0x0908('0x4a')](_0x20d7f5[_0x0908('0x40')]['sort']);_0xc9f064[_0x0908('0x4b')]=qs[_0x0908('0x42')](_['pick'](_0x20d7f5[_0x0908('0x40')],_0x2c51ed[_0x0908('0x42')]));if(_0x20d7f5[_0x0908('0x40')][_0x0908('0x4e')]){_0xc9f064[_0x0908('0x4b')]=_[_0x0908('0x4f')](_0xc9f064[_0x0908('0x4b')],{'$or':_['map'](_0xc9f064[_0x0908('0x45')],function(_0x223458){var _0x4897f7={};_0x4897f7[_0x223458]={'$like':'%'+_0x20d7f5[_0x0908('0x40')][_0x0908('0x4e')]+'%'};return _0x4897f7;})});}_0xc9f064=_[_0x0908('0x4f')]({},_0xc9f064,_0x20d7f5[_0x0908('0x50')]);return _0x57eb92[_0x0908('0xac')](_0xc9f064);}})['then'](function(_0x3f24c3){if(_0x3f24c3){_0x38bb22=_0x3f24c3['length'];if(!_0x20d7f5[_0x0908('0x40')]['hasOwnProperty'](_0x0908('0x48'))){_0xc9f064[_0x0908('0x2e')]=qs[_0x0908('0x2e')](_0x20d7f5[_0x0908('0x40')]['limit']);_0xc9f064[_0x0908('0x2c')]=qs['offset'](_0x20d7f5['query'][_0x0908('0x2c')]);}return _0x57eb92['getApplications'](_0xc9f064);}})[_0x0908('0x1d')](function(_0x204c24){if(_0x204c24){return _0x204c24?{'count':_0x38bb22,'rows':_0x204c24}:null;}})[_0x0908('0x1d')](respondWithResult(_0x4bb3fe,null))[_0x0908('0x28')](handleError(_0x4bb3fe,null));};exports[_0x0908('0xad')]=function(_0x255d7d,_0x5017cd,_0x3914e3){var _0x3a4f89={'raw':![],'where':{}};var _0x1c37ab={};var _0x504538={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0908('0x6e')]({'where':{'id':_0x255d7d[_0x0908('0x57')]['id']}})['then'](handleEntityNotFound(_0x5017cd,null))[_0x0908('0x1d')](function(_0x1162a5){if(_0x1162a5){_0x1c37ab['model']=_['keys'](db[_0x0908('0x8f')][_0x0908('0x3e')]);_0x1c37ab[_0x0908('0x40')]=_[_0x0908('0x41')](_0x255d7d['query']);_0x1c37ab[_0x0908('0x42')]=_[_0x0908('0x43')](_0x1c37ab[_0x0908('0x44')],_0x1c37ab[_0x0908('0x40')]);_0x3a4f89[_0x0908('0x45')]=_[_0x0908('0x43')](_0x1c37ab[_0x0908('0x44')],qs[_0x0908('0x46')](_0x255d7d['query'][_0x0908('0x46')]));_0x3a4f89[_0x0908('0x45')]=_0x3a4f89[_0x0908('0x45')][_0x0908('0x47')]?_0x3a4f89[_0x0908('0x45')]:_0x1c37ab[_0x0908('0x44')];if(!_0x255d7d[_0x0908('0x40')][_0x0908('0x68')](_0x0908('0x48'))){_0x3a4f89[_0x0908('0x2e')]=qs[_0x0908('0x2e')](_0x255d7d['query'][_0x0908('0x2e')]);_0x3a4f89['offset']=qs[_0x0908('0x2c')](_0x255d7d['query'][_0x0908('0x2c')]);}_0x3a4f89[_0x0908('0x49')]=qs[_0x0908('0x4a')](_0x255d7d['query'][_0x0908('0x4a')]);_0x3a4f89['where']=qs[_0x0908('0x42')](_['pick'](_0x255d7d['query'],_0x1c37ab[_0x0908('0x42')]));_0x3a4f89['where'][_0x0908('0x69')]=_0x1162a5['id'];if(_0x255d7d[_0x0908('0x40')][_0x0908('0x4e')]){_0x3a4f89['where']=_['merge'](_0x3a4f89[_0x0908('0x4b')],{'$or':_[_0x0908('0x3d')](_0x3a4f89[_0x0908('0x45')],function(_0x4d6a46){var _0x4f95f1={};_0x4f95f1[_0x4d6a46]={'$like':'%'+_0x255d7d[_0x0908('0x40')][_0x0908('0x4e')]+'%'};return _0x4f95f1;})});}_0x3a4f89=_[_0x0908('0x4f')]({},_0x3a4f89,_0x255d7d['options']);return db[_0x0908('0x8f')][_0x0908('0x2f')]({'where':_0x3a4f89[_0x0908('0x4b')]})[_0x0908('0x1d')](function(_0x1a369d){_0x504538['count']=_0x1a369d;if(_0x255d7d[_0x0908('0x40')][_0x0908('0x51')]){_0x3a4f89[_0x0908('0x52')]=[{'model':db[_0x0908('0x72')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x0908('0xae'),'attributes':[_0x0908('0x38'),'fullname','internal'],'required':![]},{'model':db[_0x0908('0xaf')],'as':_0x0908('0xb0'),'attributes':['id',_0x0908('0x38'),_0x0908('0xb1')],'where':_0x255d7d['query'][_0x0908('0xb2')]?{'id':_0x255d7d[_0x0908('0x40')][_0x0908('0xb2')]}:undefined,'required':_0x255d7d[_0x0908('0x40')]['tag']?!![]:![]}];}return db[_0x0908('0x8f')][_0x0908('0x54')](_0x3a4f89);})[_0x0908('0x1d')](function(_0x2262f8){_0x504538[_0x0908('0x55')]=_0x2262f8;return _0x504538;});}})[_0x0908('0x1d')](respondWithFilteredResult(_0x5017cd,_0x3a4f89))[_0x0908('0x28')](handleError(_0x5017cd,null));};exports['addAgents']=function(_0x3ed5fb,_0x292c70,_0x230c55){return db[_0x0908('0x53')][_0x0908('0x5e')]({'where':{'id':_0x3ed5fb['params']['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x292c70,null))[_0x0908('0x1d')](function(_0x4ef3a2){if(_0x4ef3a2){return _0x4ef3a2[_0x0908('0xb3')](_0x3ed5fb[_0x0908('0x59')][_0x0908('0xb4')],_[_0x0908('0xb5')](_0x3ed5fb[_0x0908('0x59')],[_0x0908('0xb4'),'id'])||{})[_0x0908('0x92')](function(_0x51554c){for(var _0x5068cc=0x0;_0x5068cc<_0x3ed5fb[_0x0908('0x59')][_0x0908('0xb4')][_0x0908('0x47')];_0x5068cc+=0x1){socket[_0x0908('0xb6')](_0x0908('0xb7'),{'UserId':Number(_0x3ed5fb['body']['ids'][_0x5068cc]),'OpenchannelAccountId':Number(_0x3ed5fb[_0x0908('0x57')]['id'])});}return _0x51554c;});}})[_0x0908('0x1d')](respondWithResult(_0x292c70,null))['catch'](handleError(_0x292c70,null));};exports[_0x0908('0xb8')]=function(_0x441add,_0x51a100,_0x36c6f7){return db['OpenchannelAccount'][_0x0908('0x5e')]({'where':{'id':_0x441add['params']['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x51a100,null))[_0x0908('0x1d')](function(_0x4c8136){if(_0x4c8136){return _0x4c8136['removeAgents'](_0x441add[_0x0908('0x40')][_0x0908('0xb4')])[_0x0908('0x1d')](function(){if(_[_0x0908('0xb9')](_0x441add[_0x0908('0x40')]['ids'])){for(var _0x112c2c=0x0;_0x112c2c<_0x441add[_0x0908('0x40')][_0x0908('0xb4')][_0x0908('0x47')];_0x112c2c+=0x1){socket[_0x0908('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x441add['query'][_0x0908('0xb4')][_0x112c2c]),'OpenchannelAccountId':Number(_0x441add[_0x0908('0x57')]['id'])});}}else{socket[_0x0908('0xb6')](_0x0908('0xba'),{'UserId':Number(_0x441add['query'][_0x0908('0xb4')]),'OpenchannelAccountId':Number(_0x441add['params']['id'])});}});}})[_0x0908('0x1d')](respondWithStatusCode(_0x51a100,null))['catch'](handleError(_0x51a100,null));};exports[_0x0908('0xbb')]=function(_0x29e40e,_0x25889d,_0x81dee8){var _0x5ac6bf={};var _0xe9d6ec={};var _0x40983f;var _0x500876;return db[_0x0908('0x53')][_0x0908('0x6e')]({'where':{'id':_0x29e40e[_0x0908('0x57')]['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x25889d,null))[_0x0908('0x1d')](function(_0x361f71){if(_0x361f71){_0x40983f=_0x361f71;_0xe9d6ec[_0x0908('0x44')]=_[_0x0908('0x41')](db[_0x0908('0xbc')]['rawAttributes']);_0xe9d6ec[_0x0908('0x40')]=_[_0x0908('0x41')](_0x29e40e['query']);_0xe9d6ec[_0x0908('0x42')]=_[_0x0908('0x43')](_0xe9d6ec['model'],_0xe9d6ec[_0x0908('0x40')]);_0x5ac6bf[_0x0908('0x45')]=_[_0x0908('0x43')](_0xe9d6ec[_0x0908('0x44')],qs[_0x0908('0x46')](_0x29e40e[_0x0908('0x40')][_0x0908('0x46')]));_0x5ac6bf['attributes']=_0x5ac6bf['attributes'][_0x0908('0x47')]?_0x5ac6bf[_0x0908('0x45')]:_0xe9d6ec[_0x0908('0x44')];_0x5ac6bf[_0x0908('0x49')]=qs[_0x0908('0x4a')](_0x29e40e[_0x0908('0x40')]['sort']);_0x5ac6bf[_0x0908('0x4b')]=qs['filters'](_[_0x0908('0x4c')](_0x29e40e[_0x0908('0x40')],_0xe9d6ec[_0x0908('0x42')]));if(_0x29e40e['query'][_0x0908('0x4e')]){_0x5ac6bf[_0x0908('0x4b')]=_[_0x0908('0x4f')](_0x5ac6bf['where'],{'$or':_[_0x0908('0x3d')](_0x5ac6bf[_0x0908('0x45')],function(_0xdbabe7){var _0x3b7746={};_0x3b7746[_0xdbabe7]={'$like':'%'+_0x29e40e[_0x0908('0x40')]['filter']+'%'};return _0x3b7746;})});}_0x5ac6bf=_[_0x0908('0x4f')]({},_0x5ac6bf,_0x29e40e[_0x0908('0x50')]);return _0x40983f[_0x0908('0xbb')](_0x5ac6bf);}})[_0x0908('0x1d')](function(_0xd85a61){if(_0xd85a61){_0x500876=_0xd85a61[_0x0908('0x47')];if(!_0x29e40e[_0x0908('0x40')]['hasOwnProperty']('nolimit')){_0x5ac6bf[_0x0908('0x2e')]=qs[_0x0908('0x2e')](_0x29e40e[_0x0908('0x40')]['limit']);_0x5ac6bf[_0x0908('0x2c')]=qs[_0x0908('0x2c')](_0x29e40e['query'][_0x0908('0x2c')]);}return _0x40983f[_0x0908('0xbb')](_0x5ac6bf);}})[_0x0908('0x1d')](function(_0x2311cc){if(_0x2311cc){return _0x2311cc?{'count':_0x500876,'rows':_0x2311cc}:null;}})[_0x0908('0x1d')](respondWithResult(_0x25889d,null))[_0x0908('0x28')](handleError(_0x25889d,null));};exports[_0x0908('0x39')]=function(_0x355f06,_0x467924,_0x4ef0fc){var _0x1d9404,_0x1de41c,_0x5d08d4;if(_[_0x0908('0x7c')](_0x355f06[_0x0908('0x59')][_0x0908('0x59')])||_0x355f06[_0x0908('0x59')][_0x0908('0x59')]===''){throw new db[(_0x0908('0x73'))]['ValidationError'](_0x0908('0x7d'));}if(_[_0x0908('0x7c')](_0x355f06[_0x0908('0x59')]['to'])){}_0x1d9404=_0x355f06['body']['to'];return db[_0x0908('0x53')][_0x0908('0x6e')]({'where':{'id':_0x355f06['params']['id']}})[_0x0908('0x1d')](handleEntityNotFound(_0x467924,null))['then'](function(_0x421a56){if(_0x421a56){return db[_0x0908('0x53')]['find']({'where':{'id':_0x421a56['id']},'include':[{'model':db[_0x0908('0x81')],'as':'List','include':[{'model':db[_0x0908('0x72')],'as':_0x0908('0x83'),'where':{[_0x421a56[_0x0908('0x7e')]]:_0x1d9404},'limit':0x1,'order':[['updatedAt',_0x0908('0x84')]]}]}]})[_0x0908('0x1d')](handleEntityNotFound(_0x467924,null))[_0x0908('0x1d')](function(_0x21bfda){if(_0x21bfda&&_0x21bfda[_0x0908('0x82')]){_0x1de41c=_0x21bfda[_0x0908('0x36')]({'plain':!![]});if(_0x1de41c[_0x0908('0x82')]&&_0x1de41c['List'][_0x0908('0x83')]['length']){return _0x1de41c['List'][_0x0908('0x83')][0x0];}return db[_0x0908('0x72')]['create'](_[_0x0908('0x16')](_0x355f06[_0x0908('0x59')],{'firstName':_0x1d9404,[_0x21bfda['mapKey']]:_0x1d9404,'phone':_0x1d9404,'ListId':_0x1de41c[_0x0908('0x78')]}));}})[_0x0908('0x1d')](handleEntityNotFound(_0x467924,null))['then'](function(_0x5c4014){if(_0x5c4014){_0x5d08d4=_0x5c4014;return db[_0x0908('0x8f')][_0x0908('0x5e')]({'where':{'ContactId':_0x5d08d4['id'],'closed':![],'OpenchannelAccountId':_0x1de41c['id']}})[_0x0908('0x1d')](function(_0x554aed){if(_0x554aed){return[_0x554aed,![]];}return db[_0x0908('0x8f')][_0x0908('0x58')]({'UserId':_0x355f06[_0x0908('0x5a')]['id'],'ContactId':_0x5d08d4['id'],'OpenchannelAccountId':_0x1de41c['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x0908('0x4f')](_0x355f06[_0x0908('0x59')],{'read':![],'body':_0x355f06[_0x0908('0x59')][_0x0908('0x59')],'OpenchannelAccountId':_0x1de41c['id'],'UserId':_0x355f06[_0x0908('0x5a')]['id'],'ContactId':_0x5d08d4['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x0908('0xbd')}]})['then'](function(_0x16087e){return[_0x16087e,!![]];});});}})[_0x0908('0x92')](function(_0x3b1bb6,_0x5a7085){if(_0x5a7085){return _0x3b1bb6;}return db['OpenchannelMessage']['create'](_['merge'](_0x355f06[_0x0908('0x59')],{'read':![],'body':_0x355f06[_0x0908('0x59')]['body'],'OpenchannelAccountId':_0x1de41c['id'],'OpenchannelInteractionId':_0x3b1bb6['id'],'UserId':_0x355f06[_0x0908('0x5a')]['id'],'ContactId':_0x5d08d4['id']}))[_0x0908('0x1d')](function(_0x22079f){_0x3b1bb6['dataValues'][_0x0908('0xbd')]=[];_0x3b1bb6[_0x0908('0xbe')][_0x0908('0xbd')]['push'](_0x22079f[_0x0908('0xbe')]);return _0x3b1bb6;});});}})[_0x0908('0x1d')](respondWithResult(_0x467924,null))[_0x0908('0x28')](handleError(_0x467924,null));}; \ No newline at end of file +var _0x3c72=['findAll','show','params','Pause','mandatoryDispositionPause','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','createdAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','updatedAt','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','send','getApplications','getInteractions','Owner','fullname','internal','Tags','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','OpenchannelAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0x3c72,0x1ee));var _0x23c7=function(_0x249d2e,_0x5c6327){_0x249d2e=_0x249d2e-0x0;var _0x4324a1=_0x3c72[_0x249d2e];return _0x4324a1;};'use strict';var emlformat=require(_0x23c7('0x0'));var rimraf=require(_0x23c7('0x1'));var zipdir=require(_0x23c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23c7('0x3'));var moment=require(_0x23c7('0x4'));var BPromise=require(_0x23c7('0x5'));var Mustache=require(_0x23c7('0x6'));var util=require(_0x23c7('0x7'));var path=require(_0x23c7('0x8'));var sox=require(_0x23c7('0x9'));var csv=require(_0x23c7('0xa'));var ejs=require(_0x23c7('0xb'));var fs=require('fs');var fs_extra=require(_0x23c7('0xc'));var _=require(_0x23c7('0xd'));var squel=require(_0x23c7('0xe'));var crypto=require(_0x23c7('0xf'));var jsforce=require(_0x23c7('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x23c7('0xa'));var querystring=require(_0x23c7('0x11'));var Papa=require(_0x23c7('0x12'));var Redis=require(_0x23c7('0x13'));var authService=require(_0x23c7('0x14'));var qs=require(_0x23c7('0x15'));var as=require(_0x23c7('0x16'));var hardwareService=require(_0x23c7('0x17'));var logger=require('../../config/logger')(_0x23c7('0x18'));var utils=require(_0x23c7('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x23c7('0x1a')](config[_0x23c7('0x1b')],{'host':_0x23c7('0x1c'),'port':0x18eb});var socket=require(_0x23c7('0x1d'))(new Redis(config[_0x23c7('0x1b')]));require('./openchannelAccount.socket')[_0x23c7('0x1e')](socket);var jayson=require(_0x23c7('0x1f'));var client=jayson[_0x23c7('0x20')][_0x23c7('0x21')]({'port':0x232c});var client9002=jayson[_0x23c7('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482a2e,_0x4a8ee3,_0x20090a,_0x3f92d2){return new BPromise(function(_0x2a2038,_0x47201a){var _0x177adc=_0x3f92d2||client;return _0x177adc[_0x23c7('0x22')](_0x482a2e,_0x20090a)['then'](function(_0x99adff){logger['info'](_0x23c7('0x23'),_0x4a8ee3,'request\x20sent');logger[_0x23c7('0x24')](_0x23c7('0x25'),_0x4a8ee3,'request\x20sent',JSON['stringify'](_0x99adff));if(_0x99adff[_0x23c7('0x26')]){if(_0x99adff[_0x23c7('0x26')][_0x23c7('0x27')]===0x1f4){logger['error'](_0x23c7('0x23'),_0x4a8ee3,_0x99adff[_0x23c7('0x26')][_0x23c7('0x28')]);return _0x47201a(_0x99adff[_0x23c7('0x26')]['message']);}logger[_0x23c7('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x4a8ee3,_0x99adff[_0x23c7('0x26')]['message']);return _0x2a2038(_0x99adff[_0x23c7('0x26')][_0x23c7('0x28')]);}else{logger['info'](_0x23c7('0x23'),_0x4a8ee3,'request\x20sent');_0x2a2038(_0x99adff['result']['message']);}})[_0x23c7('0x29')](function(_0x502ddf){logger[_0x23c7('0x26')](_0x23c7('0x23'),_0x4a8ee3,_0x502ddf);_0x47201a(_0x502ddf);});});}function respondWithStatusCode(_0x354fa2,_0x53b250){_0x53b250=_0x53b250||0xcc;return function(_0x258002){if(_0x258002){return _0x354fa2[_0x23c7('0x2a')](_0x53b250);}return _0x354fa2[_0x23c7('0x2b')](_0x53b250)[_0x23c7('0x2c')]();};}function respondWithResult(_0x1d1d49,_0x36ff4b){_0x36ff4b=_0x36ff4b||0xc8;return function(_0x451f1e){if(_0x451f1e){return _0x1d1d49['status'](_0x36ff4b)[_0x23c7('0x2d')](_0x451f1e);}};}function respondWithFilteredResult(_0x47b835,_0x320e68){return function(_0xb07bf7){if(_0xb07bf7){var _0x46f91c=typeof _0x320e68[_0x23c7('0x2e')]===_0x23c7('0x2f')&&typeof _0x320e68[_0x23c7('0x30')]===_0x23c7('0x2f');var _0x3820e3=_0xb07bf7[_0x23c7('0x31')];var _0x5ee2c5=_0x46f91c?0x0:_0x320e68['offset'];var _0x1b7e8d=_0x46f91c?_0xb07bf7['count']:_0x320e68[_0x23c7('0x2e')]+_0x320e68[_0x23c7('0x30')];var _0x100312;if(_0x1b7e8d>=_0x3820e3){_0x1b7e8d=_0x3820e3;_0x100312=0xc8;}else{_0x100312=0xce;}_0x47b835[_0x23c7('0x2b')](_0x100312);return _0x47b835[_0x23c7('0x32')](_0x23c7('0x33'),_0x5ee2c5+'-'+_0x1b7e8d+'/'+_0x3820e3)[_0x23c7('0x2d')](_0xb07bf7);}return null;};}function patchUpdates(_0x2a2130){return function(_0x2a4660){try{jsonpatch[_0x23c7('0x34')](_0x2a4660,_0x2a2130,!![]);}catch(_0x256e8a){return BPromise[_0x23c7('0x35')](_0x256e8a);}return _0x2a4660['save']();};}function saveUpdates(_0x110583,_0x4cbdf4){return function(_0x155e7a){if(_0x155e7a){return _0x155e7a[_0x23c7('0x36')](_0x110583)[_0x23c7('0x37')](function(_0x3de8ab){return _0x3de8ab;});}return null;};}function removeEntity(_0x48fa91,_0x31bd8b){return function(_0x2ab569){if(_0x2ab569){return _0x2ab569[_0x23c7('0x38')]()[_0x23c7('0x37')](function(){var _0x284ab7=_0x2ab569['get']({'plain':!![]});var _0x584d99='OpenchannelAccounts';return db['UserProfileResource'][_0x23c7('0x38')]({'where':{'type':_0x584d99,'resourceId':_0x284ab7['id']}})[_0x23c7('0x37')](function(){return _0x2ab569;});})[_0x23c7('0x37')](function(){_0x48fa91['status'](0xcc)[_0x23c7('0x2c')]();});}};}function handleEntityNotFound(_0x25735c,_0x32c56e){return function(_0x1725fe){if(!_0x1725fe){_0x25735c[_0x23c7('0x2a')](0x194);}return _0x1725fe;};}function handleError(_0x3f71f1,_0x4d7fa5){_0x4d7fa5=_0x4d7fa5||0x1f4;return function(_0x2ffcab){logger['error'](_0x2ffcab[_0x23c7('0x39')]);if(_0x2ffcab['name']){delete _0x2ffcab[_0x23c7('0x3a')];}_0x3f71f1[_0x23c7('0x2b')](_0x4d7fa5)['send'](_0x2ffcab);};}exports[_0x23c7('0x3b')]=function(_0x313da5,_0x3b8789){var _0x4e65f0={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x48a3f7={},_0x2f6eda={'count':0x0,'rows':[]};var _0x62c4d8=_[_0x23c7('0x3c')](db[_0x23c7('0x3d')]['rawAttributes'],function(_0x540280){return{'name':_0x540280[_0x23c7('0x3e')],'type':_0x540280[_0x23c7('0x3f')][_0x23c7('0x40')]};});_0x48a3f7[_0x23c7('0x41')]=_['map'](_0x62c4d8,_0x23c7('0x3a'));_0x48a3f7[_0x23c7('0x42')]=_[_0x23c7('0x43')](_0x313da5['query']);_0x48a3f7[_0x23c7('0x44')]=_[_0x23c7('0x45')](_0x48a3f7[_0x23c7('0x41')],_0x48a3f7[_0x23c7('0x42')]);_0x4e65f0['attributes']=_[_0x23c7('0x45')](_0x48a3f7[_0x23c7('0x41')],qs[_0x23c7('0x46')](_0x313da5[_0x23c7('0x42')]['fields']));_0x4e65f0['attributes']=_0x4e65f0[_0x23c7('0x47')][_0x23c7('0x48')]?_0x4e65f0[_0x23c7('0x47')]:_0x48a3f7[_0x23c7('0x41')];if(!_0x313da5[_0x23c7('0x42')][_0x23c7('0x49')](_0x23c7('0x4a'))){_0x4e65f0[_0x23c7('0x30')]=qs[_0x23c7('0x30')](_0x313da5[_0x23c7('0x42')]['limit']);_0x4e65f0[_0x23c7('0x2e')]=qs[_0x23c7('0x2e')](_0x313da5[_0x23c7('0x42')]['offset']);}_0x4e65f0[_0x23c7('0x4b')]=qs[_0x23c7('0x4c')](_0x313da5[_0x23c7('0x42')][_0x23c7('0x4c')]);_0x4e65f0['where']=qs['filters'](_[_0x23c7('0x4d')](_0x313da5[_0x23c7('0x42')],_0x48a3f7['filters']),_0x62c4d8);if(_0x313da5[_0x23c7('0x42')]['filter']){_0x4e65f0['where']=_[_0x23c7('0x4e')](_0x4e65f0[_0x23c7('0x4f')],{'$or':_[_0x23c7('0x3c')](_0x62c4d8,function(_0x17ef3e){if(_0x17ef3e[_0x23c7('0x3f')]!==_0x23c7('0x50')){var _0x42d988={};_0x42d988[_0x17ef3e['name']]={'$like':'%'+_0x313da5[_0x23c7('0x42')][_0x23c7('0x51')]+'%'};return _0x42d988;}})});}_0x4e65f0=_[_0x23c7('0x4e')]({},_0x4e65f0,_0x313da5[_0x23c7('0x52')]);var _0x4a09de={'where':_0x4e65f0[_0x23c7('0x4f')]};return db['OpenchannelAccount']['count'](_0x4a09de)[_0x23c7('0x37')](function(_0x301c40){_0x2f6eda[_0x23c7('0x31')]=_0x301c40;if(_0x313da5[_0x23c7('0x42')][_0x23c7('0x53')]){_0x4e65f0[_0x23c7('0x54')]=[{'all':!![]}];}return db[_0x23c7('0x3d')][_0x23c7('0x55')](_0x4e65f0);})[_0x23c7('0x37')](function(_0x174fa6){_0x2f6eda['rows']=_0x174fa6;return _0x2f6eda;})['then'](respondWithFilteredResult(_0x3b8789,_0x4e65f0))[_0x23c7('0x29')](handleError(_0x3b8789,null));};exports[_0x23c7('0x56')]=function(_0x493276,_0x6dceb5){var _0x184bf3={'raw':![],'where':{'id':_0x493276[_0x23c7('0x57')]['id']},'include':[{'model':db[_0x23c7('0x58')],'as':_0x23c7('0x59')}]},_0x53f821={};_0x53f821[_0x23c7('0x41')]=_[_0x23c7('0x43')](db[_0x23c7('0x3d')][_0x23c7('0x5a')]);_0x53f821['query']=_[_0x23c7('0x43')](_0x493276['query']);_0x53f821['filters']=_['intersection'](_0x53f821[_0x23c7('0x41')],_0x53f821[_0x23c7('0x42')]);_0x184bf3[_0x23c7('0x47')]=_['intersection'](_0x53f821[_0x23c7('0x41')],qs[_0x23c7('0x46')](_0x493276[_0x23c7('0x42')][_0x23c7('0x46')]));_0x184bf3[_0x23c7('0x47')]=_0x184bf3[_0x23c7('0x47')][_0x23c7('0x48')]?_0x184bf3['attributes']:_0x53f821['model'];if(_0x493276['query']['includeAll']){_0x184bf3[_0x23c7('0x54')]=[{'all':!![]}];}_0x184bf3=_[_0x23c7('0x4e')]({},_0x184bf3,_0x493276[_0x23c7('0x52')]);return db[_0x23c7('0x3d')][_0x23c7('0x5b')](_0x184bf3)[_0x23c7('0x37')](handleEntityNotFound(_0x6dceb5,null))[_0x23c7('0x37')](respondWithResult(_0x6dceb5,null))[_0x23c7('0x29')](handleError(_0x6dceb5,null));};exports[_0x23c7('0x5c')]=function(_0x2974aa,_0x49b722){return db[_0x23c7('0x3d')]['create'](_0x2974aa[_0x23c7('0x5d')],{})[_0x23c7('0x37')](function(_0x46e233){var _0x317dee=_0x2974aa[_0x23c7('0x5e')][_0x23c7('0x5f')]({'plain':!![]});if(!_0x317dee)throw new Error(_0x23c7('0x60'));if(_0x317dee[_0x23c7('0x61')]===_0x23c7('0x5e')){var _0x34c862=_0x46e233[_0x23c7('0x5f')]({'plain':!![]});var _0x1c85a9='OpenchannelAccounts';return db['UserProfileSection'][_0x23c7('0x5b')]({'where':{'name':_0x1c85a9,'userProfileId':_0x317dee['userProfileId']},'raw':!![]})[_0x23c7('0x37')](function(_0x44907d){if(_0x44907d&&_0x44907d['autoAssociation']===0x0){return db[_0x23c7('0x62')][_0x23c7('0x5c')]({'name':_0x34c862[_0x23c7('0x3a')],'resourceId':_0x34c862['id'],'type':_0x44907d[_0x23c7('0x3a')],'sectionId':_0x44907d['id']},{})[_0x23c7('0x37')](function(){return _0x46e233;});}else{return _0x46e233;}})[_0x23c7('0x29')](function(_0x59bafe){logger[_0x23c7('0x26')](_0x23c7('0x63'),_0x59bafe);throw _0x59bafe;});}return _0x46e233;})[_0x23c7('0x37')](respondWithResult(_0x49b722,0xc9))[_0x23c7('0x29')](handleError(_0x49b722,null));};exports[_0x23c7('0x36')]=function(_0x2792e8,_0x4bd94d){if(_0x2792e8[_0x23c7('0x5d')]['id']){delete _0x2792e8[_0x23c7('0x5d')]['id'];}return db[_0x23c7('0x3d')][_0x23c7('0x5b')]({'where':{'id':_0x2792e8[_0x23c7('0x57')]['id']},'include':[{'model':db[_0x23c7('0x58')],'as':_0x23c7('0x59')}]})['then'](handleEntityNotFound(_0x4bd94d,null))[_0x23c7('0x37')](saveUpdates(_0x2792e8[_0x23c7('0x5d')],null))[_0x23c7('0x37')](respondWithResult(_0x4bd94d,null))['catch'](handleError(_0x4bd94d,null));};exports[_0x23c7('0x38')]=function(_0x4e4e8f,_0x41980a){return db['OpenchannelAccount']['find']({'where':{'id':_0x4e4e8f['params']['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x41980a,null))[_0x23c7('0x37')](removeEntity(_0x41980a,null))[_0x23c7('0x29')](handleError(_0x41980a,null));};exports[_0x23c7('0x64')]=function(_0x3e6d70,_0x1bc9ad){return db['OpenchannelAccount'][_0x23c7('0x64')]()[_0x23c7('0x37')](respondWithResult(_0x1bc9ad,null))[_0x23c7('0x29')](handleError(_0x1bc9ad,null));};exports[_0x23c7('0x65')]=function(_0x1d0c4f,_0x2d64c7,_0x57d43f){if(_0x1d0c4f[_0x23c7('0x5d')]['id']){delete _0x1d0c4f[_0x23c7('0x5d')]['id'];}return db[_0x23c7('0x3d')][_0x23c7('0x5b')]({'where':{'id':_0x1d0c4f[_0x23c7('0x57')]['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x2d64c7,null))[_0x23c7('0x37')](function(_0x12eddc){if(_0x12eddc){_0x1d0c4f[_0x23c7('0x5d')][_0x23c7('0x66')]=_0x12eddc['id'];return db['Disposition'][_0x23c7('0x5c')](_0x1d0c4f[_0x23c7('0x5d')]);}})[_0x23c7('0x37')](respondWithResult(_0x2d64c7,null))[_0x23c7('0x29')](handleError(_0x2d64c7,null));};exports[_0x23c7('0x67')]=function(_0x50b416,_0x4181fa,_0x5e215f){var _0x4dceeb={'raw':![],'where':{}};var _0x7b170d={};var _0x12280a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x23c7('0x68')]({'where':{'id':_0x50b416['params']['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x4181fa,null))[_0x23c7('0x37')](function(_0x473f02){if(_0x473f02){_0x7b170d[_0x23c7('0x41')]=_['keys'](db[_0x23c7('0x69')][_0x23c7('0x5a')]);_0x7b170d[_0x23c7('0x42')]=_[_0x23c7('0x43')](_0x50b416[_0x23c7('0x42')]);_0x7b170d['filters']=_[_0x23c7('0x45')](_0x7b170d[_0x23c7('0x41')],_0x7b170d['query']);_0x4dceeb['attributes']=_[_0x23c7('0x45')](_0x7b170d[_0x23c7('0x41')],qs[_0x23c7('0x46')](_0x50b416['query'][_0x23c7('0x46')]));_0x4dceeb['attributes']=_0x4dceeb[_0x23c7('0x47')][_0x23c7('0x48')]?_0x4dceeb[_0x23c7('0x47')]:_0x7b170d[_0x23c7('0x41')];if(!_0x50b416['query'][_0x23c7('0x49')](_0x23c7('0x4a'))){_0x4dceeb[_0x23c7('0x30')]=qs['limit'](_0x50b416[_0x23c7('0x42')]['limit']);_0x4dceeb[_0x23c7('0x2e')]=qs[_0x23c7('0x2e')](_0x50b416[_0x23c7('0x42')][_0x23c7('0x2e')]);}_0x4dceeb['order']=qs[_0x23c7('0x4c')](_0x50b416[_0x23c7('0x42')][_0x23c7('0x4c')]);_0x4dceeb[_0x23c7('0x4f')]=qs[_0x23c7('0x44')](_['pick'](_0x50b416[_0x23c7('0x42')],_0x7b170d[_0x23c7('0x44')]));_0x4dceeb['where'][_0x23c7('0x66')]=_0x473f02['id'];if(_0x50b416[_0x23c7('0x42')][_0x23c7('0x51')]){_0x4dceeb[_0x23c7('0x4f')]=_['merge'](_0x4dceeb[_0x23c7('0x4f')],{'$or':_[_0x23c7('0x3c')](_0x4dceeb[_0x23c7('0x47')],function(_0x3c2bdc){var _0x2ed379={};_0x2ed379[_0x3c2bdc]={'$like':'%'+_0x50b416['query'][_0x23c7('0x51')]+'%'};return _0x2ed379;})});}_0x4dceeb=_['merge']({},_0x4dceeb,_0x50b416[_0x23c7('0x52')]);return db[_0x23c7('0x69')]['count']({'where':_0x4dceeb[_0x23c7('0x4f')]})[_0x23c7('0x37')](function(_0x2f250d){_0x12280a['count']=_0x2f250d;if(_0x50b416[_0x23c7('0x42')][_0x23c7('0x53')]){_0x4dceeb[_0x23c7('0x54')]=[{'all':!![]}];}return db[_0x23c7('0x69')][_0x23c7('0x55')](_0x4dceeb);})[_0x23c7('0x37')](function(_0x7ceaeb){_0x12280a[_0x23c7('0x6a')]=_0x7ceaeb;return _0x12280a;});}})[_0x23c7('0x37')](respondWithFilteredResult(_0x4181fa,_0x4dceeb))[_0x23c7('0x29')](handleError(_0x4181fa,null));};exports['removeDispositions']=function(_0x481922,_0x5298d7,_0x268c5c){return db['OpenchannelAccount'][_0x23c7('0x5b')]({'where':{'id':_0x481922[_0x23c7('0x57')]['id']}})['then'](handleEntityNotFound(_0x5298d7,null))[_0x23c7('0x37')](function(_0x388a60){if(_0x388a60){return _0x388a60[_0x23c7('0x6b')](_0x481922[_0x23c7('0x42')][_0x23c7('0x6c')]);}})[_0x23c7('0x37')](respondWithStatusCode(_0x5298d7,null))['catch'](handleError(_0x5298d7,null));};exports[_0x23c7('0x6d')]=function(_0xdad717,_0xac00dd,_0x39c167){if(_0xdad717['body']['id']){delete _0xdad717['body']['id'];}return db[_0x23c7('0x3d')][_0x23c7('0x5b')]({'where':{'id':_0xdad717[_0x23c7('0x57')]['id']}})['then'](handleEntityNotFound(_0xac00dd,null))[_0x23c7('0x37')](function(_0x24e6d5){if(_0x24e6d5){_0xdad717[_0x23c7('0x5d')][_0x23c7('0x66')]=_0x24e6d5['id'];return db[_0x23c7('0x6e')][_0x23c7('0x5c')](_0xdad717[_0x23c7('0x5d')]);}})[_0x23c7('0x37')](respondWithResult(_0xac00dd,null))[_0x23c7('0x29')](handleError(_0xac00dd,null));};exports[_0x23c7('0x6f')]=function(_0x55e4e2,_0x258c77,_0x2d0c17){var _0x34aa60={'raw':![],'where':{}};var _0x565eff={};var _0x3c9b17={'count':0x0,'rows':[]};return db[_0x23c7('0x3d')]['findOne']({'where':{'id':_0x55e4e2[_0x23c7('0x57')]['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x258c77,null))[_0x23c7('0x37')](function(_0x3b7a8a){if(_0x3b7a8a){_0x565eff['model']=_[_0x23c7('0x43')](db[_0x23c7('0x6e')][_0x23c7('0x5a')]);_0x565eff['query']=_['keys'](_0x55e4e2[_0x23c7('0x42')]);_0x565eff[_0x23c7('0x44')]=_[_0x23c7('0x45')](_0x565eff[_0x23c7('0x41')],_0x565eff[_0x23c7('0x42')]);_0x34aa60[_0x23c7('0x47')]=_[_0x23c7('0x45')](_0x565eff[_0x23c7('0x41')],qs[_0x23c7('0x46')](_0x55e4e2['query'][_0x23c7('0x46')]));_0x34aa60['attributes']=_0x34aa60[_0x23c7('0x47')]['length']?_0x34aa60[_0x23c7('0x47')]:_0x565eff[_0x23c7('0x41')];if(!_0x55e4e2[_0x23c7('0x42')][_0x23c7('0x49')]('nolimit')){_0x34aa60['limit']=qs[_0x23c7('0x30')](_0x55e4e2[_0x23c7('0x42')]['limit']);_0x34aa60[_0x23c7('0x2e')]=qs[_0x23c7('0x2e')](_0x55e4e2[_0x23c7('0x42')][_0x23c7('0x2e')]);}_0x34aa60[_0x23c7('0x4b')]=qs[_0x23c7('0x4c')](_0x55e4e2[_0x23c7('0x42')][_0x23c7('0x4c')]);_0x34aa60[_0x23c7('0x4f')]=qs['filters'](_[_0x23c7('0x4d')](_0x55e4e2['query'],_0x565eff[_0x23c7('0x44')]));_0x34aa60[_0x23c7('0x4f')]['OpenchannelAccountId']=_0x3b7a8a['id'];if(_0x55e4e2[_0x23c7('0x42')][_0x23c7('0x51')]){_0x34aa60[_0x23c7('0x4f')]=_[_0x23c7('0x4e')](_0x34aa60[_0x23c7('0x4f')],{'$or':_[_0x23c7('0x3c')](_0x34aa60[_0x23c7('0x47')],function(_0x58861c){var _0x142738={};_0x142738[_0x58861c]={'$like':'%'+_0x55e4e2[_0x23c7('0x42')][_0x23c7('0x51')]+'%'};return _0x142738;})});}_0x34aa60=_[_0x23c7('0x4e')]({},_0x34aa60,_0x55e4e2[_0x23c7('0x52')]);return db[_0x23c7('0x6e')][_0x23c7('0x31')]({'where':_0x34aa60['where']})['then'](function(_0x198d20){_0x3c9b17[_0x23c7('0x31')]=_0x198d20;if(_0x55e4e2[_0x23c7('0x42')][_0x23c7('0x53')]){_0x34aa60[_0x23c7('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x23c7('0x55')](_0x34aa60);})[_0x23c7('0x37')](function(_0x450efc){_0x3c9b17[_0x23c7('0x6a')]=_0x450efc;return _0x3c9b17;});}})[_0x23c7('0x37')](respondWithFilteredResult(_0x258c77,_0x34aa60))[_0x23c7('0x29')](handleError(_0x258c77,null));};exports[_0x23c7('0x70')]=function(_0x56101a,_0x557e7e,_0x2cbd1c){return db[_0x23c7('0x3d')][_0x23c7('0x5b')]({'where':{'id':_0x56101a['params']['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x557e7e,null))[_0x23c7('0x37')](function(_0x30f005){if(_0x30f005){return _0x30f005['removeAnswers'](_0x56101a[_0x23c7('0x42')]['ids']);}})[_0x23c7('0x37')](respondWithStatusCode(_0x557e7e,null))[_0x23c7('0x29')](handleError(_0x557e7e,null));};exports[_0x23c7('0x71')]=function(_0x357a01,_0x4f39d6,_0x1e2997){var _0x33ecf0={'body':_0x357a01[_0x23c7('0x5d')],'channel':_0x23c7('0x72')};var _0x1a4517=[];var _0x5b9c7d=[];var _0x396478={};var _0x55e2c7=![];return db[_0x23c7('0x73')][_0x23c7('0x64')]()[_0x23c7('0x37')](function(_0x4d1ac1){if(!_0x4d1ac1){throw new db['Sequelize'][(_0x23c7('0x74'))](_0x23c7('0x75'));}_0x1a4517=_['difference'](_[_0x23c7('0x43')](_0x4d1ac1),[_0x23c7('0x76'),'updatedAt']);_0x5b9c7d=_['difference'](_['keys'](_0x4d1ac1),[_0x23c7('0x76'),'updatedAt',_0x23c7('0x77'),_0x23c7('0x78')]);if(_0x357a01[_0x23c7('0x5d')]['id']){delete _0x357a01[_0x23c7('0x5d')]['id'];}if(_[_0x23c7('0x79')](_0x357a01[_0x23c7('0x5d')][_0x23c7('0x7a')])){throw new db[(_0x23c7('0x7b'))][(_0x23c7('0x74'))](_0x23c7('0x7c'));}if(_[_0x23c7('0x79')](_0x357a01[_0x23c7('0x5d')][_0x23c7('0x5d')])||_0x357a01[_0x23c7('0x5d')][_0x23c7('0x5d')]===''){throw new db[(_0x23c7('0x7b'))][(_0x23c7('0x74'))](_0x23c7('0x7d'));}if(_[_0x23c7('0x79')](_0x357a01['body'][_0x23c7('0x7e')])){throw new db['Sequelize'][(_0x23c7('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b9c7d);}if(!_[_0x23c7('0x7f')](_0x5b9c7d,_0x357a01[_0x23c7('0x5d')][_0x23c7('0x7e')])){throw new db[(_0x23c7('0x7b'))][(_0x23c7('0x74'))](_0x23c7('0x80')+_0x5b9c7d);}_0x396478[_0x357a01[_0x23c7('0x5d')][_0x23c7('0x7e')]]=_0x357a01[_0x23c7('0x5d')][_0x23c7('0x7a')];})[_0x23c7('0x37')](function(){return db[_0x23c7('0x3d')][_0x23c7('0x5b')]({'where':{'id':_0x357a01[_0x23c7('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x23c7('0x81'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x396478,'limit':0x1,'order':[[_0x23c7('0x82'),_0x23c7('0x83')]]}]},{'model':db[_0x23c7('0x84')],'as':_0x23c7('0x85')}]});})[_0x23c7('0x37')](handleEntityNotFound(_0x4f39d6,null))['then'](function(_0x36e612){if(_0x36e612&&_0x36e612[_0x23c7('0x81')]){_0x33ecf0[_0x23c7('0x86')]=_0x36e612;_0x33ecf0[_0x23c7('0x87')]=_0x36e612['Applications'];_0x33ecf0[_0x23c7('0x88')]=_0x36e612['List'];_0x33ecf0['applications']=_[_0x23c7('0x89')](_0x33ecf0[_0x23c7('0x87')],[_0x23c7('0x8a')],[_0x23c7('0x8b')]);if(_0x33ecf0['account']['Applications']){delete _0x33ecf0['account']['Applications'];}if(_0x33ecf0[_0x23c7('0x86')][_0x23c7('0x81')]&&_0x33ecf0[_0x23c7('0x86')][_0x23c7('0x81')][_0x23c7('0x8c')]['length']){return _0x33ecf0[_0x23c7('0x86')][_0x23c7('0x81')][_0x23c7('0x8c')][0x0];}var _0x4541c3=_[_0x23c7('0x1a')](_0x357a01[_0x23c7('0x5d')],{'firstName':_0x357a01[_0x23c7('0x5d')][_0x23c7('0x7a')],'ListId':_0x36e612['ListId']});_0x4541c3[_0x357a01[_0x23c7('0x5d')]['mapKey']]=_0x357a01[_0x23c7('0x5d')][_0x23c7('0x7a')];return db[_0x23c7('0x73')][_0x23c7('0x5c')](_0x4541c3,{'fields':_0x1a4517,'raw':!![]});}})[_0x23c7('0x37')](handleEntityNotFound(_0x4f39d6,null))[_0x23c7('0x37')](function(_0x23bbf9){_0x33ecf0[_0x23c7('0x8d')]=_0x23bbf9;if(_0x23bbf9){var _0x19fb1f={'ContactId':_0x23bbf9['id'],'OpenchannelAccountId':_0x357a01[_0x23c7('0x57')]['id'],'from':(_0x23bbf9[_0x23c7('0x8e')]||'')+'\x20'+(_0x23bbf9['lastName']||'')};var _0x476957={'OpenchannelAccountId':_0x357a01[_0x23c7('0x57')]['id'],'closed':![]};if(_0x357a01['body'][_0x23c7('0x8f')]){_0x476957[_0x23c7('0x8f')]=_0x357a01[_0x23c7('0x5d')][_0x23c7('0x8f')];return db[_0x23c7('0x90')][_0x23c7('0x5b')]({'where':_0x476957})[_0x23c7('0x37')](function(_0x13b58f){if(_0x13b58f){return[_0x13b58f,![]];}_0x19fb1f['threadId']=_0x357a01[_0x23c7('0x5d')][_0x23c7('0x8f')];_0x19fb1f[_0x23c7('0x91')]=_0x357a01[_0x23c7('0x5d')]['externalUrl'];return db[_0x23c7('0x90')][_0x23c7('0x5c')](_0x19fb1f)[_0x23c7('0x37')](function(_0x3d068e){return[_0x3d068e,!![]];});});}else{_0x476957['threadId']=null;}_0x476957[_0x23c7('0x92')]=_0x23bbf9['id'];return db[_0x23c7('0x90')][_0x23c7('0x5b')]({'where':_0x476957})['then'](function(_0x187fc4){if(_0x187fc4){return[_0x187fc4,![]];}return db[_0x23c7('0x90')]['create'](_0x19fb1f)[_0x23c7('0x37')](function(_0x295732){return[_0x295732,!![]];});});}})[_0x23c7('0x93')](function(_0x461e2a,_0x5ab92b){if(_0x461e2a){_0x55e2c7=_0x5ab92b;if(!_0x5ab92b){var _0x2490d9={'from':(_0x33ecf0[_0x23c7('0x8d')][_0x23c7('0x8e')]||'')+'\x20'+(_0x33ecf0[_0x23c7('0x8d')][_0x23c7('0x94')]||'')};if(_0x357a01[_0x23c7('0x5d')][_0x23c7('0x8f')]&&_0x357a01['body'][_0x23c7('0x95')]&&_0x357a01[_0x23c7('0x5d')][_0x23c7('0x8f')]!=_0x357a01[_0x23c7('0x5d')]['messageId']){_0x2490d9[_0x23c7('0x8f')]=_0x357a01[_0x23c7('0x5d')][_0x23c7('0x95')];}return _0x461e2a['update'](_0x2490d9);}else{return _0x461e2a;}}})['then'](function(_0x1f494b){_0x33ecf0[_0x23c7('0x96')]=_0x1f494b[_0x23c7('0x5f')]({'plain':!![]});_0x33ecf0[_0x23c7('0x96')][_0x23c7('0x97')]=_0x55e2c7;if(_0x33ecf0[_0x23c7('0x96')][_0x23c7('0x97')]){if(_0x33ecf0[_0x23c7('0x86')][_0x23c7('0x98')]){_0x33ecf0[_0x23c7('0x87')][_0x23c7('0x99')]({'id':0x0,'priority':_0x33ecf0['applications'][_0x23c7('0x48')]+0x1,'app':_0x23c7('0x9a'),'appdata':_0x23c7('0x9b'),'interval':_0x23c7('0x9c')});}}return db[_0x23c7('0x9d')][_0x23c7('0x5c')]({'body':_0x357a01[_0x23c7('0x5d')][_0x23c7('0x5d')],'OpenchannelAccountId':_0x357a01[_0x23c7('0x57')]['id'],'OpenchannelInteractionId':_0x1f494b['id'],'direction':'in','ContactId':_0x33ecf0[_0x23c7('0x8d')]['id'],'AttachmentId':_0x357a01['body']['AttachmentId']});})[_0x23c7('0x37')](function(_0x5683c6){_0x33ecf0[_0x23c7('0x28')]=_0x5683c6;if(!_0x33ecf0[_0x23c7('0x96')][_0x23c7('0x9e')])return;return db[_0x23c7('0x9f')][_0x23c7('0x5b')]({'attributes':['id',_0x23c7('0x3a')],'where':{'id':_0x33ecf0[_0x23c7('0x96')][_0x23c7('0x9e')]}});})[_0x23c7('0x37')](function(_0x497204){if(_0x497204){_0x33ecf0[_0x23c7('0x87')][_0x23c7('0xa0')]({'id':0x0,'priority':0x0,'app':_0x23c7('0xa1'),'appdata':_0x497204['name']+','+(_0x33ecf0[_0x23c7('0x86')][_0x23c7('0xa2')]||0xa),'interval':_0x23c7('0x9c')});}if(!_0x33ecf0[_0x23c7('0x96')][_0x23c7('0xa3')])return;return db['OpenchannelQueue']['find']({'attributes':['id','name'],'where':{'id':_0x33ecf0['interaction'][_0x23c7('0xa3')]}});})[_0x23c7('0x37')](function(_0x20197f){if(_0x20197f){_0x33ecf0['applications'][_0x23c7('0xa0')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x20197f[_0x23c7('0x3a')]+','+(_0x33ecf0[_0x23c7('0x86')][_0x23c7('0xa4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x23c7('0xa5'),_0x23c7('0xa6'),_0x33ecf0);})[_0x23c7('0x37')](function(_0x389d81){respondWithRpcPromise(_0x23c7('0xa7'),_0x23c7('0xa7'),{'event':_0x23c7('0x71'),'message':_0x389d81},client9002);return _0x389d81;})[_0x23c7('0x37')](respondWithResult(_0x4f39d6,null))[_0x23c7('0x29')](handleError(_0x4f39d6,null));};exports['addApplications']=function(_0x571ce4,_0x1cb453){var _0x53ff9c=_0x571ce4[_0x23c7('0x57')]['id'];var _0x27cf30=_0x571ce4[_0x23c7('0x5d')];var _0x287769=0xc8;var _0x5b98b2=null;return db[_0x23c7('0xa8')][_0x23c7('0xa9')]({'isolationLevel':db['sequelize'][_0x23c7('0xaa')][_0x23c7('0xab')][_0x23c7('0xac')]},function(_0x35dde9){return db[_0x23c7('0x3d')][_0x23c7('0x68')]({'where':{'id':_0x53ff9c},'transaction':_0x35dde9})[_0x23c7('0x37')](function(_0xe5ee33){if(_0xe5ee33){return db[_0x23c7('0x84')][_0x23c7('0x38')]({'where':{'OpenchannelAccountId':_0x53ff9c},'transaction':_0x35dde9})['then'](function(){var _0x17349a=_[_0x23c7('0x3c')](_0x27cf30,function(_0x1d5d9a){_0x1d5d9a[_0x23c7('0x66')]=_0x53ff9c;return _0x1d5d9a;});return db[_0x23c7('0x84')][_0x23c7('0xad')](_0x17349a,{'transaction':_0x35dde9});});}else{_0x287769=0x194;_0x5b98b2=[];}});})[_0x23c7('0x37')](function(){if(_0x287769!==0x194){return db['OpenchannelApplication'][_0x23c7('0xae')]({'where':{'OpenchannelAccountId':_0x53ff9c},'order':_0x23c7('0x8a')})['then'](function(_0x92c07b){_0x5b98b2=_0x92c07b;});}})[_0x23c7('0x29')](function(_0x4b96dc){_0x287769=0x1f4;logger['error'](_0x4b96dc[_0x23c7('0x39')]);if(_0x4b96dc[_0x23c7('0x3a')]){delete _0x4b96dc['name'];}_0x5b98b2=_0x4b96dc;})['finally'](function(){if(_0x5b98b2===null){_0x1cb453[_0x23c7('0x2a')](_0x287769);}else{if(_0x287769===0x1f4){_0x1cb453['status'](_0x287769)[_0x23c7('0xaf')](_0x5b98b2);}else{_0x1cb453['status'](_0x287769)[_0x23c7('0x2d')](_0x5b98b2);}}});};exports['getApplications']=function(_0x59809f,_0x267f27,_0x5f4196){var _0x381f0f={};var _0x1fc1ed={};var _0x12128b;var _0x100c83;return db[_0x23c7('0x3d')]['findOne']({'where':{'id':_0x59809f[_0x23c7('0x57')]['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x267f27,null))[_0x23c7('0x37')](function(_0x3ccdd9){if(_0x3ccdd9){_0x12128b=_0x3ccdd9;_0x1fc1ed[_0x23c7('0x41')]=_[_0x23c7('0x43')](db['OpenchannelApplication'][_0x23c7('0x5a')]);_0x1fc1ed[_0x23c7('0x42')]=_[_0x23c7('0x43')](_0x59809f[_0x23c7('0x42')]);_0x1fc1ed[_0x23c7('0x44')]=_[_0x23c7('0x45')](_0x1fc1ed[_0x23c7('0x41')],_0x1fc1ed[_0x23c7('0x42')]);_0x381f0f[_0x23c7('0x47')]=_[_0x23c7('0x45')](_0x1fc1ed[_0x23c7('0x41')],qs['fields'](_0x59809f[_0x23c7('0x42')][_0x23c7('0x46')]));_0x381f0f[_0x23c7('0x47')]=_0x381f0f['attributes'][_0x23c7('0x48')]?_0x381f0f[_0x23c7('0x47')]:_0x1fc1ed[_0x23c7('0x41')];_0x381f0f['order']=qs[_0x23c7('0x4c')](_0x59809f[_0x23c7('0x42')][_0x23c7('0x4c')]);_0x381f0f['where']=qs[_0x23c7('0x44')](_[_0x23c7('0x4d')](_0x59809f[_0x23c7('0x42')],_0x1fc1ed[_0x23c7('0x44')]));if(_0x59809f[_0x23c7('0x42')][_0x23c7('0x51')]){_0x381f0f[_0x23c7('0x4f')]=_['merge'](_0x381f0f['where'],{'$or':_['map'](_0x381f0f['attributes'],function(_0x16c28e){var _0xc5f4dc={};_0xc5f4dc[_0x16c28e]={'$like':'%'+_0x59809f[_0x23c7('0x42')][_0x23c7('0x51')]+'%'};return _0xc5f4dc;})});}_0x381f0f=_[_0x23c7('0x4e')]({},_0x381f0f,_0x59809f[_0x23c7('0x52')]);return _0x12128b[_0x23c7('0xb0')](_0x381f0f);}})[_0x23c7('0x37')](function(_0x39de8b){if(_0x39de8b){_0x100c83=_0x39de8b[_0x23c7('0x48')];if(!_0x59809f[_0x23c7('0x42')][_0x23c7('0x49')](_0x23c7('0x4a'))){_0x381f0f[_0x23c7('0x30')]=qs['limit'](_0x59809f[_0x23c7('0x42')]['limit']);_0x381f0f[_0x23c7('0x2e')]=qs[_0x23c7('0x2e')](_0x59809f['query'][_0x23c7('0x2e')]);}return _0x12128b[_0x23c7('0xb0')](_0x381f0f);}})[_0x23c7('0x37')](function(_0x6679a7){if(_0x6679a7){return _0x6679a7?{'count':_0x100c83,'rows':_0x6679a7}:null;}})['then'](respondWithResult(_0x267f27,null))[_0x23c7('0x29')](handleError(_0x267f27,null));};exports[_0x23c7('0xb1')]=function(_0x5390c3,_0xcf9b08,_0x53cbc6){var _0x1a7cff={'raw':![],'where':{}};var _0x1630f4={};var _0x3fabc1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x23c7('0x68')]({'where':{'id':_0x5390c3[_0x23c7('0x57')]['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0xcf9b08,null))[_0x23c7('0x37')](function(_0x45083e){if(_0x45083e){_0x1630f4[_0x23c7('0x41')]=_[_0x23c7('0x43')](db[_0x23c7('0x90')]['rawAttributes']);_0x1630f4[_0x23c7('0x42')]=_['keys'](_0x5390c3[_0x23c7('0x42')]);_0x1630f4[_0x23c7('0x44')]=_[_0x23c7('0x45')](_0x1630f4[_0x23c7('0x41')],_0x1630f4[_0x23c7('0x42')]);_0x1a7cff[_0x23c7('0x47')]=_[_0x23c7('0x45')](_0x1630f4[_0x23c7('0x41')],qs[_0x23c7('0x46')](_0x5390c3[_0x23c7('0x42')][_0x23c7('0x46')]));_0x1a7cff[_0x23c7('0x47')]=_0x1a7cff[_0x23c7('0x47')][_0x23c7('0x48')]?_0x1a7cff[_0x23c7('0x47')]:_0x1630f4[_0x23c7('0x41')];if(!_0x5390c3[_0x23c7('0x42')][_0x23c7('0x49')](_0x23c7('0x4a'))){_0x1a7cff['limit']=qs[_0x23c7('0x30')](_0x5390c3[_0x23c7('0x42')][_0x23c7('0x30')]);_0x1a7cff[_0x23c7('0x2e')]=qs['offset'](_0x5390c3[_0x23c7('0x42')][_0x23c7('0x2e')]);}_0x1a7cff['order']=qs['sort'](_0x5390c3[_0x23c7('0x42')][_0x23c7('0x4c')]);_0x1a7cff['where']=qs[_0x23c7('0x44')](_[_0x23c7('0x4d')](_0x5390c3['query'],_0x1630f4[_0x23c7('0x44')]));_0x1a7cff[_0x23c7('0x4f')][_0x23c7('0x66')]=_0x45083e['id'];if(_0x5390c3[_0x23c7('0x42')][_0x23c7('0x51')]){_0x1a7cff[_0x23c7('0x4f')]=_[_0x23c7('0x4e')](_0x1a7cff[_0x23c7('0x4f')],{'$or':_[_0x23c7('0x3c')](_0x1a7cff[_0x23c7('0x47')],function(_0x43d93a){var _0x52c59d={};_0x52c59d[_0x43d93a]={'$like':'%'+_0x5390c3[_0x23c7('0x42')][_0x23c7('0x51')]+'%'};return _0x52c59d;})});}_0x1a7cff=_[_0x23c7('0x4e')]({},_0x1a7cff,_0x5390c3[_0x23c7('0x52')]);return db[_0x23c7('0x90')][_0x23c7('0x31')]({'where':_0x1a7cff['where']})[_0x23c7('0x37')](function(_0xfb4cea){_0x3fabc1[_0x23c7('0x31')]=_0xfb4cea;if(_0x5390c3[_0x23c7('0x42')][_0x23c7('0x53')]){_0x1a7cff[_0x23c7('0x54')]=[{'model':db[_0x23c7('0x73')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x23c7('0xb2'),'attributes':['name',_0x23c7('0xb3'),_0x23c7('0xb4')],'required':![]},{'model':db['Tag'],'as':_0x23c7('0xb5'),'attributes':['id',_0x23c7('0x3a'),'color'],'where':_0x5390c3[_0x23c7('0x42')]['tag']?{'id':_0x5390c3[_0x23c7('0x42')][_0x23c7('0xb6')]}:undefined,'required':_0x5390c3[_0x23c7('0x42')][_0x23c7('0xb6')]?!![]:![]}];}return db[_0x23c7('0x90')]['findAll'](_0x1a7cff);})[_0x23c7('0x37')](function(_0x1c9336){_0x3fabc1['rows']=_0x1c9336;return _0x3fabc1;});}})['then'](respondWithFilteredResult(_0xcf9b08,_0x1a7cff))['catch'](handleError(_0xcf9b08,null));};exports['addAgents']=function(_0x187e04,_0x25ba49,_0x404144){return db[_0x23c7('0x3d')][_0x23c7('0x5b')]({'where':{'id':_0x187e04[_0x23c7('0x57')]['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x25ba49,null))[_0x23c7('0x37')](function(_0x5726fc){if(_0x5726fc){return _0x5726fc[_0x23c7('0xb7')](_0x187e04[_0x23c7('0x5d')][_0x23c7('0x6c')],_['omit'](_0x187e04['body'],[_0x23c7('0x6c'),'id'])||{})[_0x23c7('0x93')](function(_0x4df6cb){for(var _0x416ec3=0x0;_0x416ec3<_0x187e04[_0x23c7('0x5d')]['ids'][_0x23c7('0x48')];_0x416ec3+=0x1){socket[_0x23c7('0xb8')](_0x23c7('0xb9'),{'UserId':Number(_0x187e04[_0x23c7('0x5d')][_0x23c7('0x6c')][_0x416ec3]),'OpenchannelAccountId':Number(_0x187e04[_0x23c7('0x57')]['id'])});}return _0x4df6cb;});}})[_0x23c7('0x37')](respondWithResult(_0x25ba49,null))[_0x23c7('0x29')](handleError(_0x25ba49,null));};exports[_0x23c7('0xba')]=function(_0x4bde2f,_0x269fad,_0x464a9f){return db['OpenchannelAccount'][_0x23c7('0x5b')]({'where':{'id':_0x4bde2f['params']['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x269fad,null))[_0x23c7('0x37')](function(_0x493b7c){if(_0x493b7c){return _0x493b7c[_0x23c7('0xba')](_0x4bde2f[_0x23c7('0x42')]['ids'])[_0x23c7('0x37')](function(){if(_[_0x23c7('0xbb')](_0x4bde2f[_0x23c7('0x42')][_0x23c7('0x6c')])){for(var _0x45608c=0x0;_0x45608c<_0x4bde2f['query'][_0x23c7('0x6c')][_0x23c7('0x48')];_0x45608c+=0x1){socket[_0x23c7('0xb8')](_0x23c7('0xbc'),{'UserId':Number(_0x4bde2f[_0x23c7('0x42')][_0x23c7('0x6c')][_0x45608c]),'OpenchannelAccountId':Number(_0x4bde2f[_0x23c7('0x57')]['id'])});}}else{socket[_0x23c7('0xb8')](_0x23c7('0xbc'),{'UserId':Number(_0x4bde2f[_0x23c7('0x42')][_0x23c7('0x6c')]),'OpenchannelAccountId':Number(_0x4bde2f[_0x23c7('0x57')]['id'])});}});}})[_0x23c7('0x37')](respondWithStatusCode(_0x269fad,null))['catch'](handleError(_0x269fad,null));};exports[_0x23c7('0xbd')]=function(_0x253ba4,_0x317d8e,_0x2ff6e7){var _0x3f2fcd={};var _0xcf2a85={};var _0xc58671;var _0x449eba;return db['OpenchannelAccount'][_0x23c7('0x68')]({'where':{'id':_0x253ba4[_0x23c7('0x57')]['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x317d8e,null))['then'](function(_0x67260e){if(_0x67260e){_0xc58671=_0x67260e;_0xcf2a85['model']=_[_0x23c7('0x43')](db[_0x23c7('0x9f')][_0x23c7('0x5a')]);_0xcf2a85['query']=_[_0x23c7('0x43')](_0x253ba4[_0x23c7('0x42')]);_0xcf2a85[_0x23c7('0x44')]=_[_0x23c7('0x45')](_0xcf2a85[_0x23c7('0x41')],_0xcf2a85['query']);_0x3f2fcd[_0x23c7('0x47')]=_['intersection'](_0xcf2a85[_0x23c7('0x41')],qs['fields'](_0x253ba4[_0x23c7('0x42')]['fields']));_0x3f2fcd['attributes']=_0x3f2fcd[_0x23c7('0x47')]['length']?_0x3f2fcd[_0x23c7('0x47')]:_0xcf2a85['model'];_0x3f2fcd[_0x23c7('0x4b')]=qs['sort'](_0x253ba4['query'][_0x23c7('0x4c')]);_0x3f2fcd[_0x23c7('0x4f')]=qs[_0x23c7('0x44')](_['pick'](_0x253ba4[_0x23c7('0x42')],_0xcf2a85[_0x23c7('0x44')]));if(_0x253ba4[_0x23c7('0x42')][_0x23c7('0x51')]){_0x3f2fcd[_0x23c7('0x4f')]=_[_0x23c7('0x4e')](_0x3f2fcd[_0x23c7('0x4f')],{'$or':_[_0x23c7('0x3c')](_0x3f2fcd[_0x23c7('0x47')],function(_0x24a5a1){var _0x3ef343={};_0x3ef343[_0x24a5a1]={'$like':'%'+_0x253ba4[_0x23c7('0x42')][_0x23c7('0x51')]+'%'};return _0x3ef343;})});}_0x3f2fcd=_[_0x23c7('0x4e')]({},_0x3f2fcd,_0x253ba4[_0x23c7('0x52')]);return _0xc58671[_0x23c7('0xbd')](_0x3f2fcd);}})[_0x23c7('0x37')](function(_0x4f668f){if(_0x4f668f){_0x449eba=_0x4f668f[_0x23c7('0x48')];if(!_0x253ba4['query'][_0x23c7('0x49')]('nolimit')){_0x3f2fcd['limit']=qs[_0x23c7('0x30')](_0x253ba4['query'][_0x23c7('0x30')]);_0x3f2fcd[_0x23c7('0x2e')]=qs[_0x23c7('0x2e')](_0x253ba4[_0x23c7('0x42')][_0x23c7('0x2e')]);}return _0xc58671[_0x23c7('0xbd')](_0x3f2fcd);}})['then'](function(_0x86d0f4){if(_0x86d0f4){return _0x86d0f4?{'count':_0x449eba,'rows':_0x86d0f4}:null;}})[_0x23c7('0x37')](respondWithResult(_0x317d8e,null))[_0x23c7('0x29')](handleError(_0x317d8e,null));};exports[_0x23c7('0xaf')]=function(_0x3e33e5,_0x5c9f2b,_0x2360a3){var _0x2b5512,_0x3de3ca,_0x498ddf;if(_[_0x23c7('0x79')](_0x3e33e5[_0x23c7('0x5d')][_0x23c7('0x5d')])||_0x3e33e5[_0x23c7('0x5d')][_0x23c7('0x5d')]===''){throw new db[(_0x23c7('0x7b'))][(_0x23c7('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x23c7('0x79')](_0x3e33e5[_0x23c7('0x5d')]['to'])){}_0x2b5512=_0x3e33e5['body']['to'];return db[_0x23c7('0x3d')][_0x23c7('0x68')]({'where':{'id':_0x3e33e5[_0x23c7('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c9f2b,null))[_0x23c7('0x37')](function(_0x171f33){if(_0x171f33){return db[_0x23c7('0x3d')]['find']({'where':{'id':_0x171f33['id']},'include':[{'model':db['CmList'],'as':_0x23c7('0x81'),'include':[{'model':db['CmContact'],'as':_0x23c7('0x8c'),'where':{[_0x171f33[_0x23c7('0x7e')]]:_0x2b5512},'limit':0x1,'order':[[_0x23c7('0x82'),_0x23c7('0x83')]]}]}]})[_0x23c7('0x37')](handleEntityNotFound(_0x5c9f2b,null))[_0x23c7('0x37')](function(_0x3b0962){if(_0x3b0962&&_0x3b0962[_0x23c7('0x81')]){_0x3de3ca=_0x3b0962['get']({'plain':!![]});if(_0x3de3ca['List']&&_0x3de3ca[_0x23c7('0x81')][_0x23c7('0x8c')][_0x23c7('0x48')]){return _0x3de3ca[_0x23c7('0x81')][_0x23c7('0x8c')][0x0];}return db[_0x23c7('0x73')][_0x23c7('0x5c')](_[_0x23c7('0x1a')](_0x3e33e5['body'],{'firstName':_0x2b5512,[_0x3b0962[_0x23c7('0x7e')]]:_0x2b5512,'phone':_0x2b5512,'ListId':_0x3de3ca['ListId']}));}})[_0x23c7('0x37')](handleEntityNotFound(_0x5c9f2b,null))['then'](function(_0x22056a){if(_0x22056a){_0x498ddf=_0x22056a;return db['OpenchannelInteraction'][_0x23c7('0x5b')]({'where':{'ContactId':_0x498ddf['id'],'closed':![],'OpenchannelAccountId':_0x3de3ca['id']}})[_0x23c7('0x37')](function(_0x52835f){if(_0x52835f){return[_0x52835f,![]];}return db[_0x23c7('0x90')][_0x23c7('0x5c')]({'UserId':_0x3e33e5[_0x23c7('0x5e')]['id'],'ContactId':_0x498ddf['id'],'OpenchannelAccountId':_0x3de3ca['id'],'lastMsgDirection':'out','firstMsgDirection':_0x23c7('0xbe'),'Messages':[_[_0x23c7('0x4e')](_0x3e33e5[_0x23c7('0x5d')],{'read':![],'body':_0x3e33e5['body'][_0x23c7('0x5d')],'OpenchannelAccountId':_0x3de3ca['id'],'UserId':_0x3e33e5[_0x23c7('0x5e')]['id'],'ContactId':_0x498ddf['id']})]},{'include':[{'model':db[_0x23c7('0x9d')],'as':_0x23c7('0xbf')}]})[_0x23c7('0x37')](function(_0x2b4968){return[_0x2b4968,!![]];});});}})[_0x23c7('0x93')](function(_0x372733,_0x1c5019){if(_0x1c5019){return _0x372733;}return db['OpenchannelMessage'][_0x23c7('0x5c')](_[_0x23c7('0x4e')](_0x3e33e5[_0x23c7('0x5d')],{'read':![],'body':_0x3e33e5[_0x23c7('0x5d')]['body'],'OpenchannelAccountId':_0x3de3ca['id'],'OpenchannelInteractionId':_0x372733['id'],'UserId':_0x3e33e5[_0x23c7('0x5e')]['id'],'ContactId':_0x498ddf['id']}))['then'](function(_0xf59451){_0x372733[_0x23c7('0xc0')]['Messages']=[];_0x372733[_0x23c7('0xc0')][_0x23c7('0xbf')][_0x23c7('0x99')](_0xf59451[_0x23c7('0xc0')]);return _0x372733;});});}})['then'](respondWithResult(_0x5c9f2b,null))[_0x23c7('0x29')](handleError(_0x5c9f2b,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 9fdfd3e..ebe2803 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee5b=['remove','emit','hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0xee5b,0x1f4));var _0xbee5=function(_0x33d6c0,_0x5f558b){_0x33d6c0=_0x33d6c0-0x0;var _0x2410d7=_0xee5b[_0x33d6c0];return _0x2410d7;};'use strict';var EventEmitter=require(_0xbee5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbee5('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbee5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbee5('0x3'),'afterDestroy':_0xbee5('0x4')};function emitEvent(_0x2eb857){return function(_0x210159,_0x4bd202,_0x5200b1){OpenchannelAccountEvents[_0xbee5('0x5')](_0x2eb857+':'+_0x210159['id'],_0x210159);OpenchannelAccountEvents[_0xbee5('0x5')](_0x2eb857,_0x210159);_0x5200b1(null);};}for(var e in events){if(events[_0xbee5('0x6')](e)){var event=events[e];OpenchannelAccount[_0xbee5('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xa74f=['remove','hasOwnProperty','hook','exports','OpenchannelAccount','update'];(function(_0x456e0d,_0x5b09b6){var _0x142036=function(_0x262296){while(--_0x262296){_0x456e0d['push'](_0x456e0d['shift']());}};_0x142036(++_0x5b09b6);}(_0xa74f,0x9a));var _0xfa74=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0xa74f[_0x257a28];return _0x13bccc;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xfa74('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa74('0x1'),'afterDestroy':_0xfa74('0x2')};function emitEvent(_0x394a1e){return function(_0x25a9b7,_0x5b367b,_0x141625){OpenchannelAccountEvents['emit'](_0x394a1e+':'+_0x25a9b7['id'],_0x25a9b7);OpenchannelAccountEvents['emit'](_0x394a1e,_0x25a9b7);_0x141625(null);};}for(var e in events){if(events[_0xfa74('0x3')](e)){var event=events[e];OpenchannelAccount[_0xfa74('0x4')](e,emitEvent(event));}}module[_0xfa74('0x5')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 47a5f88..3556f30 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x31c507,_0x3df6d9){var _0x51f158=function(_0x2f0b81){while(--_0x2f0b81){_0x31c507['push'](_0x31c507['shift']());}};_0x51f158(++_0x3df6d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x176e47,_0x52f193){var _0x2c43b8=function(_0x2e8b41){while(--_0x2e8b41){_0x176e47['push'](_0x176e47['shift']());}};_0x2c43b8(++_0x52f193);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index d33924a..770d535 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e6b=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x17e8f8,_0x499576){var _0x1e7f34=function(_0x14351b){while(--_0x14351b){_0x17e8f8['push'](_0x17e8f8['shift']());}};_0x1e7f34(++_0x499576);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9e6b[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var moment=require('moment');var BPromise=require(_0xb9e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9e6('0x3'))['db'];var utils=require(_0xb9e6('0x4'));var logger=require(_0xb9e6('0x5'))(_0xb9e6('0x6'));var config=require('../../config/environment');var jayson=require(_0xb9e6('0x7'));var client=jayson[_0xb9e6('0x8')][_0xb9e6('0x9')]({'port':0x232a});config['redis']=_[_0xb9e6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9e6('0xb')]));require('./openchannelAccount.socket')[_0xb9e6('0xc')](socket);function respondWithRpcPromise(_0x216b1a,_0x477b52,_0x3e18bf){return new BPromise(function(_0x40d57b,_0x43e8c8){return client[_0xb9e6('0xd')](_0x216b1a,_0x3e18bf)[_0xb9e6('0xe')](function(_0x165903){logger[_0xb9e6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x477b52,_0xb9e6('0x10'));logger[_0xb9e6('0x11')](_0xb9e6('0x12'),_0x477b52,_0xb9e6('0x10'),JSON['stringify'](_0x165903));if(_0x165903[_0xb9e6('0x13')]){if(_0x165903[_0xb9e6('0x13')]['code']===0x1f4){logger['error'](_0xb9e6('0x14'),_0x477b52,_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);return _0x43e8c8(_0x165903[_0xb9e6('0x13')]['message']);}logger[_0xb9e6('0x13')](_0xb9e6('0x14'),_0x477b52,_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);return _0x40d57b(_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);}else{logger[_0xb9e6('0xf')](_0xb9e6('0x14'),_0x477b52,_0xb9e6('0x10'));_0x40d57b(_0x165903[_0xb9e6('0x16')]['message']);}})[_0xb9e6('0x17')](function(_0x53a357){logger[_0xb9e6('0x13')](_0xb9e6('0x14'),_0x477b52,_0x53a357);_0x43e8c8(_0x53a357);});});} \ No newline at end of file +var _0x2504=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x44b2ff,_0x356c72){var _0x2dc9f4=function(_0x2582fc){while(--_0x2582fc){_0x44b2ff['push'](_0x44b2ff['shift']());}};_0x2dc9f4(++_0x356c72);}(_0x2504,0xee));var _0x4250=function(_0x3f55e5,_0xcf16bf){_0x3f55e5=_0x3f55e5-0x0;var _0x1ccb22=_0x2504[_0x3f55e5];return _0x1ccb22;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rs=require(_0x4250('0x4'));var fs=require('fs');var Redis=require(_0x4250('0x5'));var db=require(_0x4250('0x6'))['db'];var utils=require(_0x4250('0x7'));var logger=require(_0x4250('0x8'))(_0x4250('0x9'));var config=require(_0x4250('0xa'));var jayson=require(_0x4250('0xb'));var client=jayson['client'][_0x4250('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4250('0xd')],{'host':_0x4250('0xe'),'port':0x18eb});var socket=require(_0x4250('0xf'))(new Redis(config[_0x4250('0xd')]));require(_0x4250('0x10'))['register'](socket);function respondWithRpcPromise(_0x1016b9,_0x49bf26,_0x2de8a7){return new BPromise(function(_0x2ff5ca,_0x55a792){return client[_0x4250('0x11')](_0x1016b9,_0x2de8a7)['then'](function(_0x535015){logger[_0x4250('0x12')](_0x4250('0x13'),_0x49bf26,_0x4250('0x14'));logger[_0x4250('0x15')](_0x4250('0x16'),_0x49bf26,'request\x20sent',JSON[_0x4250('0x17')](_0x535015));if(_0x535015[_0x4250('0x18')]){if(_0x535015[_0x4250('0x18')][_0x4250('0x19')]===0x1f4){logger[_0x4250('0x18')](_0x4250('0x13'),_0x49bf26,_0x535015['error'][_0x4250('0x1a')]);return _0x55a792(_0x535015[_0x4250('0x18')][_0x4250('0x1a')]);}logger[_0x4250('0x18')](_0x4250('0x13'),_0x49bf26,_0x535015[_0x4250('0x18')][_0x4250('0x1a')]);return _0x2ff5ca(_0x535015['error'][_0x4250('0x1a')]);}else{logger[_0x4250('0x12')](_0x4250('0x13'),_0x49bf26,_0x4250('0x14'));_0x2ff5ca(_0x535015[_0x4250('0x1b')][_0x4250('0x1a')]);}})[_0x4250('0x1c')](function(_0x508bc3){logger[_0x4250('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x49bf26,_0x508bc3);_0x55a792(_0x508bc3);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index bb8da76..fe2fb97 100644 --- a/server/api/openchannelAccount/openchannelAccount.socket.js +++ b/server/api/openchannelAccount/openchannelAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x433d65,_0x5d119b){_0x433d65=_0x433d65-0x0;var _0x24799c=_0xbdb7[_0x433d65];return _0x24799c;};'use strict';var OpenchannelAccountEvents=require(_0x7bdb('0x0'));var events=[_0x7bdb('0x1'),_0x7bdb('0x2'),_0x7bdb('0x3')];function createListener(_0x23c326,_0x433850){return function(_0x4496ac){_0x433850[_0x7bdb('0x4')](_0x23c326,_0x4496ac);};}function removeListener(_0x46c068,_0x47aec5){return function(){OpenchannelAccountEvents[_0x7bdb('0x5')](_0x46c068,_0x47aec5);};}exports['register']=function(_0x4b5fff){for(var _0xffdc86=0x0,_0x1e23a3=events['length'];_0xffdc86<_0x1e23a3;_0xffdc86++){var _0x513cba=events[_0xffdc86];var _0x468041=createListener(_0x7bdb('0x6')+_0x513cba,_0x4b5fff);OpenchannelAccountEvents['on'](_0x513cba,_0x468041);}}; \ No newline at end of file +var _0x37b4=['remove','update','emit','openchannelAccount:','./openchannelAccount.events'];(function(_0x64637b,_0x8d153e){var _0x34e743=function(_0x3b9c10){while(--_0x3b9c10){_0x64637b['push'](_0x64637b['shift']());}};_0x34e743(++_0x8d153e);}(_0x37b4,0xef));var _0x437b=function(_0xa7efd7,_0x45c885){_0xa7efd7=_0xa7efd7-0x0;var _0x572019=_0x37b4[_0xa7efd7];return _0x572019;};'use strict';var OpenchannelAccountEvents=require(_0x437b('0x0'));var events=['save',_0x437b('0x1'),_0x437b('0x2')];function createListener(_0xc42699,_0x5bc1e3){return function(_0x308d00){_0x5bc1e3[_0x437b('0x3')](_0xc42699,_0x308d00);};}function removeListener(_0x317df4,_0x3d353d){return function(){OpenchannelAccountEvents['removeListener'](_0x317df4,_0x3d353d);};}exports['register']=function(_0x1bab79){for(var _0x560099=0x0,_0x3c7dea=events['length'];_0x560099<_0x3c7dea;_0x560099++){var _0x226e3c=events[_0x560099];var _0x5df980=createListener(_0x437b('0x4')+_0x226e3c,_0x1bab79);OpenchannelAccountEvents['on'](_0x226e3c,_0x5df980);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9357eba..0f83190 100644 --- a/server/api/openchannelApplication/index.js +++ b/server/api/openchannelApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6f6=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x5b2e3f,_0x42141d){var _0x579b5e=function(_0x192751){while(--_0x192751){_0x5b2e3f['push'](_0x5b2e3f['shift']());}};_0x579b5e(++_0x42141d);}(_0xd6f6,0xbb));var _0x6d6f=function(_0x138c8e,_0x5ba262){_0x138c8e=_0x138c8e-0x0;var _0x53af20=_0xd6f6[_0x138c8e];return _0x53af20;};'use strict';var multer=require(_0x6d6f('0x0'));var util=require(_0x6d6f('0x1'));var path=require(_0x6d6f('0x2'));var timeout=require(_0x6d6f('0x3'));var express=require('express');var router=express[_0x6d6f('0x4')]();var fs_extra=require(_0x6d6f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6d6f('0x6'));var config=require(_0x6d6f('0x7'));var controller=require('./openchannelApplication.controller');router[_0x6d6f('0x8')]('/',auth[_0x6d6f('0x9')](),controller[_0x6d6f('0xa')]);router[_0x6d6f('0x8')](_0x6d6f('0xb'),auth[_0x6d6f('0x9')](),controller[_0x6d6f('0xc')]);router[_0x6d6f('0xd')]('/',auth[_0x6d6f('0x9')](),controller[_0x6d6f('0xe')]);router['put'](_0x6d6f('0xb'),auth[_0x6d6f('0x9')](),controller[_0x6d6f('0xf')]);router[_0x6d6f('0x10')](_0x6d6f('0xb'),auth[_0x6d6f('0x9')](),controller[_0x6d6f('0x11')]);module[_0x6d6f('0x12')]=router; \ No newline at end of file +var _0x9ca5=['Router','fs-extra','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0x9ca5,0x15e));var _0x59ca=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x9ca5[_0x5e4563];return _0x8d1bf5;};'use strict';var multer=require('multer');var util=require(_0x59ca('0x0'));var path=require(_0x59ca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59ca('0x2')]();var fs_extra=require(_0x59ca('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59ca('0x4'));var controller=require(_0x59ca('0x5'));router[_0x59ca('0x6')]('/',auth[_0x59ca('0x7')](),controller['index']);router[_0x59ca('0x6')](_0x59ca('0x8'),auth['isAuthenticated'](),controller[_0x59ca('0x9')]);router[_0x59ca('0xa')]('/',auth[_0x59ca('0x7')](),controller['create']);router[_0x59ca('0xb')](_0x59ca('0x8'),auth[_0x59ca('0x7')](),controller[_0x59ca('0xc')]);router[_0x59ca('0xd')](_0x59ca('0x8'),auth['isAuthenticated'](),controller[_0x59ca('0xe')]);module[_0x59ca('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 1757615..66f43e4 100644 --- a/server/api/openchannelApplication/openchannelApplication.attributes.js +++ b/server/api/openchannelApplication/openchannelApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70ae=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x386842,_0x3f9caf){var _0x59b24c=function(_0x192eb3){while(--_0x192eb3){_0x386842['push'](_0x386842['shift']());}};_0x59b24c(++_0x3f9caf);}(_0x70ae,0x145));var _0xe70a=function(_0x3ffd40,_0x4c65b8){_0x3ffd40=_0x3ffd40-0x0;var _0x14309d=_0x70ae[_0x3ffd40];return _0x14309d;};'use strict';var Sequelize=require('sequelize');module[_0xe70a('0x0')]={'priority':{'type':Sequelize[_0xe70a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe70a('0x2')],'allowNull':![],'defaultValue':_0xe70a('0x3')},'appdata':{'type':Sequelize[_0xe70a('0x4')]()},'description':{'type':Sequelize[_0xe70a('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe70a('0x5')}}; \ No newline at end of file +var _0xc394=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x11c8a7,_0x1e89fb){var _0x5e09c2=function(_0x2cf1e9){while(--_0x2cf1e9){_0x11c8a7['push'](_0x11c8a7['shift']());}};_0x5e09c2(++_0x1e89fb);}(_0xc394,0x80));var _0x4c39=function(_0x4a39bf,_0x33d488){_0x4a39bf=_0x4a39bf-0x0;var _0x146bda=_0xc394[_0x4a39bf];return _0x146bda;};'use strict';var Sequelize=require('sequelize');module[_0x4c39('0x0')]={'priority':{'type':Sequelize[_0x4c39('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4c39('0x2')],'allowNull':![],'defaultValue':_0x4c39('0x3')},'appdata':{'type':Sequelize[_0x4c39('0x4')]()},'description':{'type':Sequelize[_0x4c39('0x2')]},'interval':{'type':Sequelize[_0x4c39('0x2')],'defaultValue':_0x4c39('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 012c077..a29e63c 100644 --- a/server/api/openchannelApplication/openchannelApplication.controller.js +++ b/server/api/openchannelApplication/openchannelApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1042=['rows','catch','show','keys','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','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','limit','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x9be56e,_0x54a36b){var _0x182697=function(_0x3d3fd){while(--_0x3d3fd){_0x9be56e['push'](_0x9be56e['shift']());}};_0x182697(++_0x54a36b);}(_0x1042,0x145));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2104('0x0'));var rimraf=require(_0x2104('0x1'));var zipdir=require(_0x2104('0x2'));var jsonpatch=require(_0x2104('0x3'));var rp=require(_0x2104('0x4'));var moment=require(_0x2104('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2104('0x6'));var util=require(_0x2104('0x7'));var path=require(_0x2104('0x8'));var sox=require(_0x2104('0x9'));var csv=require(_0x2104('0xa'));var ejs=require(_0x2104('0xb'));var fs=require('fs');var fs_extra=require(_0x2104('0xc'));var _=require(_0x2104('0xd'));var squel=require('squel');var crypto=require(_0x2104('0xe'));var jsforce=require(_0x2104('0xf'));var deskjs=require(_0x2104('0x10'));var toCsv=require(_0x2104('0xa'));var querystring=require('querystring');var Papa=require(_0x2104('0x11'));var Redis=require(_0x2104('0x12'));var authService=require(_0x2104('0x13'));var qs=require(_0x2104('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2104('0x15'));var logger=require(_0x2104('0x16'))(_0x2104('0x17'));var utils=require(_0x2104('0x18'));var config=require(_0x2104('0x19'));var licenseUtil=require(_0x2104('0x1a'));var db=require(_0x2104('0x1b'))['db'];function respondWithStatusCode(_0x8be590,_0x651911){_0x651911=_0x651911||0xcc;return function(_0x4ac36a){if(_0x4ac36a){return _0x8be590[_0x2104('0x1c')](_0x651911);}return _0x8be590[_0x2104('0x1d')](_0x651911)[_0x2104('0x1e')]();};}function respondWithResult(_0x17b2ba,_0x52ebcc){_0x52ebcc=_0x52ebcc||0xc8;return function(_0x46fc77){if(_0x46fc77){return _0x17b2ba['status'](_0x52ebcc)[_0x2104('0x1f')](_0x46fc77);}};}function respondWithFilteredResult(_0x37b84d,_0x3c0bb6){return function(_0x147225){if(_0x147225){var _0x1b54d7=typeof _0x3c0bb6['offset']==='undefined'&&typeof _0x3c0bb6[_0x2104('0x20')]==='undefined';var _0x27d555=_0x147225['count'];var _0xdf5951=_0x1b54d7?0x0:_0x3c0bb6['offset'];var _0x451b0a=_0x1b54d7?_0x147225[_0x2104('0x21')]:_0x3c0bb6[_0x2104('0x22')]+_0x3c0bb6[_0x2104('0x20')];var _0x1ba685;if(_0x451b0a>=_0x27d555){_0x451b0a=_0x27d555;_0x1ba685=0xc8;}else{_0x1ba685=0xce;}_0x37b84d['status'](_0x1ba685);return _0x37b84d[_0x2104('0x23')]('Content-Range',_0xdf5951+'-'+_0x451b0a+'/'+_0x27d555)['json'](_0x147225);}return null;};}function patchUpdates(_0xea3cff){return function(_0x5ef31b){try{jsonpatch[_0x2104('0x24')](_0x5ef31b,_0xea3cff,!![]);}catch(_0x1aec3c){return BPromise[_0x2104('0x25')](_0x1aec3c);}return _0x5ef31b[_0x2104('0x26')]();};}function saveUpdates(_0x764cb1,_0x36fc35){return function(_0x5ed36e){if(_0x5ed36e){return _0x5ed36e[_0x2104('0x27')](_0x764cb1)['then'](function(_0x345c8a){return _0x345c8a;});}return null;};}function removeEntity(_0x3aaff5,_0x15ef3f){return function(_0x4e6efa){if(_0x4e6efa){return _0x4e6efa[_0x2104('0x28')]()[_0x2104('0x29')](function(){_0x3aaff5['status'](0xcc)[_0x2104('0x1e')]();});}};}function handleEntityNotFound(_0x18cffc,_0x2a4059){return function(_0x432fbf){if(!_0x432fbf){_0x18cffc['sendStatus'](0x194);}return _0x432fbf;};}function handleError(_0x2bd919,_0x2a348f){_0x2a348f=_0x2a348f||0x1f4;return function(_0x418b1b){logger[_0x2104('0x2a')](_0x418b1b[_0x2104('0x2b')]);if(_0x418b1b[_0x2104('0x2c')]){delete _0x418b1b[_0x2104('0x2c')];}_0x2bd919['status'](_0x2a348f)[_0x2104('0x2d')](_0x418b1b);};}exports['index']=function(_0x704fe5,_0xddbd8d){var _0x1fe409={},_0x461d28={},_0x4e9cea={'count':0x0,'rows':[]};var _0x3aee0a=_[_0x2104('0x2e')](db[_0x2104('0x2f')][_0x2104('0x30')],function(_0x40281b){return{'name':_0x40281b['fieldName'],'type':_0x40281b[_0x2104('0x31')][_0x2104('0x32')]};});_0x461d28['model']=_['map'](_0x3aee0a,_0x2104('0x2c'));_0x461d28[_0x2104('0x33')]=_['keys'](_0x704fe5[_0x2104('0x33')]);_0x461d28[_0x2104('0x34')]=_[_0x2104('0x35')](_0x461d28[_0x2104('0x36')],_0x461d28['query']);_0x1fe409['attributes']=_[_0x2104('0x35')](_0x461d28[_0x2104('0x36')],qs['fields'](_0x704fe5[_0x2104('0x33')][_0x2104('0x37')]));_0x1fe409['attributes']=_0x1fe409[_0x2104('0x38')][_0x2104('0x39')]?_0x1fe409['attributes']:_0x461d28['model'];if(!_0x704fe5[_0x2104('0x33')][_0x2104('0x3a')](_0x2104('0x3b'))){_0x1fe409[_0x2104('0x20')]=qs[_0x2104('0x20')](_0x704fe5[_0x2104('0x33')]['limit']);_0x1fe409[_0x2104('0x22')]=qs[_0x2104('0x22')](_0x704fe5[_0x2104('0x33')][_0x2104('0x22')]);}_0x1fe409[_0x2104('0x3c')]=qs[_0x2104('0x3d')](_0x704fe5[_0x2104('0x33')]['sort']);_0x1fe409[_0x2104('0x3e')]=qs['filters'](_[_0x2104('0x3f')](_0x704fe5['query'],_0x461d28['filters']),_0x3aee0a);if(_0x704fe5[_0x2104('0x33')][_0x2104('0x40')]){_0x1fe409[_0x2104('0x3e')]=_[_0x2104('0x41')](_0x1fe409[_0x2104('0x3e')],{'$or':_[_0x2104('0x2e')](_0x3aee0a,function(_0x4fdd52){if(_0x4fdd52[_0x2104('0x31')]!==_0x2104('0x42')){var _0x547d54={};_0x547d54[_0x4fdd52[_0x2104('0x2c')]]={'$like':'%'+_0x704fe5[_0x2104('0x33')][_0x2104('0x40')]+'%'};return _0x547d54;}})});}_0x1fe409=_['merge']({},_0x1fe409,_0x704fe5[_0x2104('0x43')]);var _0x14f09d={'where':_0x1fe409['where']};return db[_0x2104('0x2f')][_0x2104('0x21')](_0x14f09d)[_0x2104('0x29')](function(_0x59b776){_0x4e9cea['count']=_0x59b776;if(_0x704fe5[_0x2104('0x33')][_0x2104('0x44')]){_0x1fe409['include']=[{'all':!![]}];}return db[_0x2104('0x2f')][_0x2104('0x45')](_0x1fe409);})[_0x2104('0x29')](function(_0x1fd841){_0x4e9cea[_0x2104('0x46')]=_0x1fd841;return _0x4e9cea;})[_0x2104('0x29')](respondWithFilteredResult(_0xddbd8d,_0x1fe409))[_0x2104('0x47')](handleError(_0xddbd8d,null));};exports[_0x2104('0x48')]=function(_0x41f1a2,_0x59f90f){var _0x50cb2a={'raw':!![],'where':{'id':_0x41f1a2['params']['id']}},_0x504428={};_0x504428[_0x2104('0x36')]=_[_0x2104('0x49')](db[_0x2104('0x2f')][_0x2104('0x30')]);_0x504428['query']=_[_0x2104('0x49')](_0x41f1a2[_0x2104('0x33')]);_0x504428[_0x2104('0x34')]=_[_0x2104('0x35')](_0x504428[_0x2104('0x36')],_0x504428[_0x2104('0x33')]);_0x50cb2a['attributes']=_[_0x2104('0x35')](_0x504428['model'],qs['fields'](_0x41f1a2[_0x2104('0x33')][_0x2104('0x37')]));_0x50cb2a['attributes']=_0x50cb2a[_0x2104('0x38')][_0x2104('0x39')]?_0x50cb2a[_0x2104('0x38')]:_0x504428[_0x2104('0x36')];if(_0x41f1a2[_0x2104('0x33')]['includeAll']){_0x50cb2a[_0x2104('0x4a')]=[{'all':!![]}];}_0x50cb2a=_[_0x2104('0x41')]({},_0x50cb2a,_0x41f1a2[_0x2104('0x43')]);return db[_0x2104('0x2f')][_0x2104('0x4b')](_0x50cb2a)[_0x2104('0x29')](handleEntityNotFound(_0x59f90f,null))[_0x2104('0x29')](respondWithResult(_0x59f90f,null))[_0x2104('0x47')](handleError(_0x59f90f,null));};exports[_0x2104('0x4c')]=function(_0x46ab07,_0x4ba83a){return db['OpenchannelApplication'][_0x2104('0x4c')](_0x46ab07['body'],{})[_0x2104('0x29')](respondWithResult(_0x4ba83a,0xc9))[_0x2104('0x47')](handleError(_0x4ba83a,null));};exports[_0x2104('0x27')]=function(_0x342119,_0x5a20c7){if(_0x342119[_0x2104('0x4d')]['id']){delete _0x342119[_0x2104('0x4d')]['id'];}return db[_0x2104('0x2f')][_0x2104('0x4b')]({'where':{'id':_0x342119[_0x2104('0x4e')]['id']}})[_0x2104('0x29')](handleEntityNotFound(_0x5a20c7,null))[_0x2104('0x29')](saveUpdates(_0x342119[_0x2104('0x4d')],null))[_0x2104('0x29')](respondWithResult(_0x5a20c7,null))['catch'](handleError(_0x5a20c7,null));};exports[_0x2104('0x28')]=function(_0x2a3953,_0x3fe60d){return db[_0x2104('0x2f')][_0x2104('0x4b')]({'where':{'id':_0x2a3953[_0x2104('0x4e')]['id']}})[_0x2104('0x29')](handleEntityNotFound(_0x3fe60d,null))[_0x2104('0x29')](removeEntity(_0x3fe60d,null))[_0x2104('0x47')](handleError(_0x3fe60d,null));}; \ No newline at end of file +var _0x2ad3=['offset','set','apply','reject','update','then','destroy','end','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','sort','pick','where','merge','filter','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x449b5b,_0x34f764){var _0x18777d=function(_0xf7e3f4){while(--_0xf7e3f4){_0x449b5b['push'](_0x449b5b['shift']());}};_0x18777d(++_0x34f764);}(_0x2ad3,0x1d3));var _0x32ad=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2ad3[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x32ad('0x0'));var rimraf=require(_0x32ad('0x1'));var zipdir=require(_0x32ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x32ad('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x32ad('0x4'));var util=require('util');var path=require(_0x32ad('0x5'));var sox=require(_0x32ad('0x6'));var csv=require(_0x32ad('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32ad('0x8'));var _=require(_0x32ad('0x9'));var squel=require(_0x32ad('0xa'));var crypto=require(_0x32ad('0xb'));var jsforce=require(_0x32ad('0xc'));var deskjs=require(_0x32ad('0xd'));var toCsv=require(_0x32ad('0x7'));var querystring=require('querystring');var Papa=require(_0x32ad('0xe'));var Redis=require(_0x32ad('0xf'));var authService=require(_0x32ad('0x10'));var qs=require(_0x32ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ad('0x12'));var logger=require(_0x32ad('0x13'))(_0x32ad('0x14'));var utils=require(_0x32ad('0x15'));var config=require(_0x32ad('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x32ad('0x17'))['db'];function respondWithStatusCode(_0x2dd673,_0x19987f){_0x19987f=_0x19987f||0xcc;return function(_0x11b56e){if(_0x11b56e){return _0x2dd673[_0x32ad('0x18')](_0x19987f);}return _0x2dd673[_0x32ad('0x19')](_0x19987f)['end']();};}function respondWithResult(_0x5535ce,_0x392b69){_0x392b69=_0x392b69||0xc8;return function(_0x59720a){if(_0x59720a){return _0x5535ce[_0x32ad('0x19')](_0x392b69)[_0x32ad('0x1a')](_0x59720a);}};}function respondWithFilteredResult(_0x53b63b,_0x5d4ce2){return function(_0x3385e5){if(_0x3385e5){var _0x5b59ab=typeof _0x5d4ce2['offset']===_0x32ad('0x1b')&&typeof _0x5d4ce2[_0x32ad('0x1c')]==='undefined';var _0x37b859=_0x3385e5[_0x32ad('0x1d')];var _0x77d5f=_0x5b59ab?0x0:_0x5d4ce2['offset'];var _0x4f83c3=_0x5b59ab?_0x3385e5[_0x32ad('0x1d')]:_0x5d4ce2[_0x32ad('0x1e')]+_0x5d4ce2[_0x32ad('0x1c')];var _0x4629d1;if(_0x4f83c3>=_0x37b859){_0x4f83c3=_0x37b859;_0x4629d1=0xc8;}else{_0x4629d1=0xce;}_0x53b63b[_0x32ad('0x19')](_0x4629d1);return _0x53b63b[_0x32ad('0x1f')]('Content-Range',_0x77d5f+'-'+_0x4f83c3+'/'+_0x37b859)[_0x32ad('0x1a')](_0x3385e5);}return null;};}function patchUpdates(_0x11ba8a){return function(_0x1a1cf3){try{jsonpatch[_0x32ad('0x20')](_0x1a1cf3,_0x11ba8a,!![]);}catch(_0x5ea4c8){return BPromise[_0x32ad('0x21')](_0x5ea4c8);}return _0x1a1cf3['save']();};}function saveUpdates(_0x56dbb7,_0x3defe1){return function(_0x1c3c7d){if(_0x1c3c7d){return _0x1c3c7d[_0x32ad('0x22')](_0x56dbb7)[_0x32ad('0x23')](function(_0x5fedd2){return _0x5fedd2;});}return null;};}function removeEntity(_0x354e9c,_0x4811c7){return function(_0x41bb4f){if(_0x41bb4f){return _0x41bb4f[_0x32ad('0x24')]()[_0x32ad('0x23')](function(){_0x354e9c['status'](0xcc)[_0x32ad('0x25')]();});}};}function handleEntityNotFound(_0x4aef6a,_0x378504){return function(_0x7bf6af){if(!_0x7bf6af){_0x4aef6a[_0x32ad('0x18')](0x194);}return _0x7bf6af;};}function handleError(_0x293a49,_0x2a9267){_0x2a9267=_0x2a9267||0x1f4;return function(_0x2b4e2b){logger[_0x32ad('0x26')](_0x2b4e2b['stack']);if(_0x2b4e2b[_0x32ad('0x27')]){delete _0x2b4e2b[_0x32ad('0x27')];}_0x293a49[_0x32ad('0x19')](_0x2a9267)['send'](_0x2b4e2b);};}exports[_0x32ad('0x28')]=function(_0x57b50e,_0x2f2d13){var _0x2c7cdb={},_0x2f3e30={},_0x3e6a86={'count':0x0,'rows':[]};var _0x232c5d=_[_0x32ad('0x29')](db[_0x32ad('0x2a')][_0x32ad('0x2b')],function(_0x28b8ff){return{'name':_0x28b8ff[_0x32ad('0x2c')],'type':_0x28b8ff[_0x32ad('0x2d')][_0x32ad('0x2e')]};});_0x2f3e30[_0x32ad('0x2f')]=_[_0x32ad('0x29')](_0x232c5d,_0x32ad('0x27'));_0x2f3e30['query']=_[_0x32ad('0x30')](_0x57b50e['query']);_0x2f3e30[_0x32ad('0x31')]=_[_0x32ad('0x32')](_0x2f3e30[_0x32ad('0x2f')],_0x2f3e30[_0x32ad('0x33')]);_0x2c7cdb['attributes']=_['intersection'](_0x2f3e30[_0x32ad('0x2f')],qs[_0x32ad('0x34')](_0x57b50e[_0x32ad('0x33')][_0x32ad('0x34')]));_0x2c7cdb[_0x32ad('0x35')]=_0x2c7cdb['attributes'][_0x32ad('0x36')]?_0x2c7cdb[_0x32ad('0x35')]:_0x2f3e30[_0x32ad('0x2f')];if(!_0x57b50e[_0x32ad('0x33')][_0x32ad('0x37')]('nolimit')){_0x2c7cdb[_0x32ad('0x1c')]=qs['limit'](_0x57b50e[_0x32ad('0x33')]['limit']);_0x2c7cdb[_0x32ad('0x1e')]=qs[_0x32ad('0x1e')](_0x57b50e[_0x32ad('0x33')][_0x32ad('0x1e')]);}_0x2c7cdb['order']=qs[_0x32ad('0x38')](_0x57b50e[_0x32ad('0x33')]['sort']);_0x2c7cdb['where']=qs['filters'](_[_0x32ad('0x39')](_0x57b50e[_0x32ad('0x33')],_0x2f3e30['filters']),_0x232c5d);if(_0x57b50e[_0x32ad('0x33')]['filter']){_0x2c7cdb[_0x32ad('0x3a')]=_[_0x32ad('0x3b')](_0x2c7cdb['where'],{'$or':_[_0x32ad('0x29')](_0x232c5d,function(_0x224e71){if(_0x224e71['type']!=='VIRTUAL'){var _0x150207={};_0x150207[_0x224e71[_0x32ad('0x27')]]={'$like':'%'+_0x57b50e[_0x32ad('0x33')][_0x32ad('0x3c')]+'%'};return _0x150207;}})});}_0x2c7cdb=_[_0x32ad('0x3b')]({},_0x2c7cdb,_0x57b50e['options']);var _0x29c73e={'where':_0x2c7cdb['where']};return db[_0x32ad('0x2a')]['count'](_0x29c73e)['then'](function(_0x119030){_0x3e6a86[_0x32ad('0x1d')]=_0x119030;if(_0x57b50e[_0x32ad('0x33')][_0x32ad('0x3d')]){_0x2c7cdb[_0x32ad('0x3e')]=[{'all':!![]}];}return db[_0x32ad('0x2a')][_0x32ad('0x3f')](_0x2c7cdb);})['then'](function(_0x35e516){_0x3e6a86['rows']=_0x35e516;return _0x3e6a86;})['then'](respondWithFilteredResult(_0x2f2d13,_0x2c7cdb))[_0x32ad('0x40')](handleError(_0x2f2d13,null));};exports[_0x32ad('0x41')]=function(_0x37a6b4,_0x3d5be9){var _0x42d490={'raw':!![],'where':{'id':_0x37a6b4[_0x32ad('0x42')]['id']}},_0x1febc4={};_0x1febc4[_0x32ad('0x2f')]=_[_0x32ad('0x30')](db[_0x32ad('0x2a')][_0x32ad('0x2b')]);_0x1febc4[_0x32ad('0x33')]=_[_0x32ad('0x30')](_0x37a6b4[_0x32ad('0x33')]);_0x1febc4[_0x32ad('0x31')]=_['intersection'](_0x1febc4[_0x32ad('0x2f')],_0x1febc4[_0x32ad('0x33')]);_0x42d490['attributes']=_[_0x32ad('0x32')](_0x1febc4['model'],qs[_0x32ad('0x34')](_0x37a6b4[_0x32ad('0x33')][_0x32ad('0x34')]));_0x42d490[_0x32ad('0x35')]=_0x42d490[_0x32ad('0x35')][_0x32ad('0x36')]?_0x42d490[_0x32ad('0x35')]:_0x1febc4[_0x32ad('0x2f')];if(_0x37a6b4[_0x32ad('0x33')][_0x32ad('0x3d')]){_0x42d490['include']=[{'all':!![]}];}_0x42d490=_[_0x32ad('0x3b')]({},_0x42d490,_0x37a6b4[_0x32ad('0x43')]);return db[_0x32ad('0x2a')][_0x32ad('0x44')](_0x42d490)[_0x32ad('0x23')](handleEntityNotFound(_0x3d5be9,null))[_0x32ad('0x23')](respondWithResult(_0x3d5be9,null))['catch'](handleError(_0x3d5be9,null));};exports[_0x32ad('0x45')]=function(_0x4d7901,_0x561dfc){return db['OpenchannelApplication'][_0x32ad('0x45')](_0x4d7901[_0x32ad('0x46')],{})[_0x32ad('0x23')](respondWithResult(_0x561dfc,0xc9))[_0x32ad('0x40')](handleError(_0x561dfc,null));};exports[_0x32ad('0x22')]=function(_0x2d7bae,_0x2a29d6){if(_0x2d7bae['body']['id']){delete _0x2d7bae[_0x32ad('0x46')]['id'];}return db[_0x32ad('0x2a')][_0x32ad('0x44')]({'where':{'id':_0x2d7bae[_0x32ad('0x42')]['id']}})[_0x32ad('0x23')](handleEntityNotFound(_0x2a29d6,null))[_0x32ad('0x23')](saveUpdates(_0x2d7bae[_0x32ad('0x46')],null))[_0x32ad('0x23')](respondWithResult(_0x2a29d6,null))[_0x32ad('0x40')](handleError(_0x2a29d6,null));};exports[_0x32ad('0x24')]=function(_0x337f06,_0x485cfe){return db[_0x32ad('0x2a')][_0x32ad('0x44')]({'where':{'id':_0x337f06[_0x32ad('0x42')]['id']}})[_0x32ad('0x23')](handleEntityNotFound(_0x485cfe,null))[_0x32ad('0x23')](removeEntity(_0x485cfe,null))[_0x32ad('0x40')](handleError(_0x485cfe,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 878a660..b7decf9 100644 --- a/server/api/openchannelApplication/openchannelApplication.model.js +++ b/server/api/openchannelApplication/openchannelApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedb9=['rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x867c03,_0x5f532d){var _0x760969=function(_0xd23675){while(--_0xd23675){_0x867c03['push'](_0x867c03['shift']());}};_0x760969(++_0x5f532d);}(_0xedb9,0xe3));var _0x9edb=function(_0x454f18,_0x2819a2){_0x454f18=_0x454f18-0x0;var _0x4a51eb=_0xedb9[_0x454f18];return _0x4a51eb;};'use strict';var _=require(_0x9edb('0x0'));var util=require(_0x9edb('0x1'));var logger=require('../../config/logger')(_0x9edb('0x2'));var moment=require(_0x9edb('0x3'));var BPromise=require(_0x9edb('0x4'));var rp=require(_0x9edb('0x5'));var fs=require('fs');var path=require(_0x9edb('0x6'));var rimraf=require(_0x9edb('0x7'));var config=require(_0x9edb('0x8'));var attributes=require(_0x9edb('0x9'));module['exports']=function(_0x527fc8,_0x4a73db){return _0x527fc8[_0x9edb('0xa')](_0x9edb('0xb'),attributes,{'tableName':_0x9edb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x16d6=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelApplication'];(function(_0x578a25,_0x368f7a){var _0x2a6ec0=function(_0x40bde6){while(--_0x40bde6){_0x578a25['push'](_0x578a25['shift']());}};_0x2a6ec0(++_0x368f7a);}(_0x16d6,0xe3));var _0x616d=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0x16d6[_0x374ccf];return _0x443cde;};'use strict';var _=require('lodash');var util=require(_0x616d('0x0'));var logger=require(_0x616d('0x1'))(_0x616d('0x2'));var moment=require(_0x616d('0x3'));var BPromise=require(_0x616d('0x4'));var rp=require(_0x616d('0x5'));var fs=require('fs');var path=require(_0x616d('0x6'));var rimraf=require(_0x616d('0x7'));var config=require(_0x616d('0x8'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x5a8bef,_0x3e9ce5){return _0x5a8bef[_0x616d('0x9')](_0x616d('0xa'),attributes,{'tableName':_0x616d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x616d('0xc'),'collate':_0x616d('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 121b156..62c1b62 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x898c=['body','options','where','then','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelApplication','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x898c,0x139));var _0xc898=function(_0x300385,_0x31b65){_0x300385=_0x300385-0x0;var _0x442f17=_0x898c[_0x300385];return _0x442f17;};'use strict';var _=require(_0xc898('0x0'));var util=require(_0xc898('0x1'));var moment=require(_0xc898('0x2'));var BPromise=require(_0xc898('0x3'));var rs=require(_0xc898('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc898('0x5'))['db'];var utils=require(_0xc898('0x6'));var logger=require(_0xc898('0x7'))('rpc');var config=require(_0xc898('0x8'));var jayson=require(_0xc898('0x9'));var client=jayson[_0xc898('0xa')][_0xc898('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10bb70,_0x5ee318,_0x376a4a){return new BPromise(function(_0xba9924,_0x229b9a){return client[_0xc898('0xc')](_0x10bb70,_0x376a4a)['then'](function(_0x1310a3){logger[_0xc898('0xd')](_0xc898('0xe'),_0x5ee318,_0xc898('0xf'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x5ee318,'request\x20sent',JSON[_0xc898('0x10')](_0x1310a3));if(_0x1310a3[_0xc898('0x11')]){if(_0x1310a3[_0xc898('0x11')][_0xc898('0x12')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x5ee318,_0x1310a3['error'][_0xc898('0x13')]);return _0x229b9a(_0x1310a3['error'][_0xc898('0x13')]);}logger[_0xc898('0x11')](_0xc898('0xe'),_0x5ee318,_0x1310a3[_0xc898('0x11')]['message']);return _0xba9924(_0x1310a3[_0xc898('0x11')]['message']);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x5ee318,_0xc898('0xf'));_0xba9924(_0x1310a3[_0xc898('0x14')]['message']);}})['catch'](function(_0x733cba){logger['error'](_0xc898('0xe'),_0x5ee318,_0x733cba);_0x229b9a(_0x733cba);});});}exports[_0xc898('0x15')]=function(_0x5d7d11){var _0x10adf3=this;return new Promise(function(_0x239080,_0x1db78e){return db['OpenchannelApplication'][_0xc898('0x16')](_0x5d7d11[_0xc898('0x17')],{'raw':_0x5d7d11['options']?_0x5d7d11[_0xc898('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d7d11[_0xc898('0x18')]?_0x5d7d11['options'][_0xc898('0x19')]||null:null,'attributes':_0x5d7d11[_0xc898('0x18')]?_0x5d7d11[_0xc898('0x18')]['attributes']||null:null,'limit':_0x5d7d11['options']?_0x5d7d11[_0xc898('0x18')]['limit']||null:null})[_0xc898('0x1a')](function(_0x4f8d03){logger[_0xc898('0xd')](_0xc898('0x15'),_0x5d7d11);logger['debug'](_0xc898('0x15'),_0x5d7d11,JSON[_0xc898('0x10')](_0x4f8d03));_0x239080(_0x4f8d03);})[_0xc898('0x1b')](function(_0x551dc2){logger[_0xc898('0x11')](_0xc898('0x15'),_0x551dc2[_0xc898('0x13')],_0x5d7d11);_0x1db78e(_0x10adf3[_0xc898('0x11')](0x1f4,_0x551dc2[_0xc898('0x13')]));});});}; \ No newline at end of file +var _0x3726=['stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','raw','options','where','attributes','limit','debug'];(function(_0x407041,_0x2571be){var _0x107d8c=function(_0x5c8ef9){while(--_0x5c8ef9){_0x407041['push'](_0x407041['shift']());}};_0x107d8c(++_0x2571be);}(_0x3726,0x1e1));var _0x6372=function(_0x24051f,_0x1af244){_0x24051f=_0x24051f-0x0;var _0x207719=_0x3726[_0x24051f];return _0x207719;};'use strict';var _=require('lodash');var util=require(_0x6372('0x0'));var moment=require(_0x6372('0x1'));var BPromise=require(_0x6372('0x2'));var rs=require(_0x6372('0x3'));var fs=require('fs');var Redis=require(_0x6372('0x4'));var db=require(_0x6372('0x5'))['db'];var utils=require(_0x6372('0x6'));var logger=require(_0x6372('0x7'))('rpc');var config=require(_0x6372('0x8'));var jayson=require(_0x6372('0x9'));var client=jayson[_0x6372('0xa')][_0x6372('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27ce02,_0x3a2f7a,_0x1096b5){return new BPromise(function(_0x22fd6c,_0x5ab56){return client['request'](_0x27ce02,_0x1096b5)[_0x6372('0xc')](function(_0x3db3a1){logger['info'](_0x6372('0xd'),_0x3a2f7a,'request\x20sent');logger['debug'](_0x6372('0xe'),_0x3a2f7a,_0x6372('0xf'),JSON['stringify'](_0x3db3a1));if(_0x3db3a1[_0x6372('0x10')]){if(_0x3db3a1[_0x6372('0x10')][_0x6372('0x11')]===0x1f4){logger['error'](_0x6372('0xd'),_0x3a2f7a,_0x3db3a1[_0x6372('0x10')][_0x6372('0x12')]);return _0x5ab56(_0x3db3a1[_0x6372('0x10')]['message']);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3a2f7a,_0x3db3a1[_0x6372('0x10')][_0x6372('0x12')]);return _0x22fd6c(_0x3db3a1['error']['message']);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x3a2f7a,_0x6372('0xf'));_0x22fd6c(_0x3db3a1['result']['message']);}})[_0x6372('0x13')](function(_0x25ea89){logger[_0x6372('0x10')](_0x6372('0xd'),_0x3a2f7a,_0x25ea89);_0x5ab56(_0x25ea89);});});}exports[_0x6372('0x14')]=function(_0x12cc56){var _0x395cee=this;return new Promise(function(_0x81a70c,_0x3f45d8){return db[_0x6372('0x15')]['update'](_0x12cc56[_0x6372('0x16')],{'raw':_0x12cc56['options']?_0x12cc56['options'][_0x6372('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12cc56[_0x6372('0x18')]?_0x12cc56[_0x6372('0x18')][_0x6372('0x19')]||null:null,'attributes':_0x12cc56[_0x6372('0x18')]?_0x12cc56[_0x6372('0x18')][_0x6372('0x1a')]||null:null,'limit':_0x12cc56[_0x6372('0x18')]?_0x12cc56[_0x6372('0x18')][_0x6372('0x1b')]||null:null})[_0x6372('0xc')](function(_0x2c1ab0){logger['info'](_0x6372('0x14'),_0x12cc56);logger[_0x6372('0x1c')](_0x6372('0x14'),_0x12cc56,JSON[_0x6372('0x1d')](_0x2c1ab0));_0x81a70c(_0x2c1ab0);})['catch'](function(_0x3638e3){logger[_0x6372('0x10')](_0x6372('0x14'),_0x3638e3[_0x6372('0x12')],_0x12cc56);_0x3f45d8(_0x395cee[_0x6372('0x10')](0x1f4,_0x3638e3[_0x6372('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c85f153..3c059a8 100644 --- a/server/api/openchannelInteraction/index.js +++ b/server/api/openchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9d5=['getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4cd846,_0x4a0f50){var _0x2f2a7d=function(_0x106507){while(--_0x106507){_0x4cd846['push'](_0x4cd846['shift']());}};_0x2f2a7d(++_0x4a0f50);}(_0xc9d5,0x13b));var _0x5c9d=function(_0x9c754a,_0x580d50){_0x9c754a=_0x9c754a-0x0;var _0x1720e8=_0xc9d5[_0x9c754a];return _0x1720e8;};'use strict';var multer=require(_0x5c9d('0x0'));var util=require(_0x5c9d('0x1'));var path=require(_0x5c9d('0x2'));var timeout=require(_0x5c9d('0x3'));var express=require('express');var router=express[_0x5c9d('0x4')]();var fs_extra=require(_0x5c9d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5c9d('0x6'));var config=require(_0x5c9d('0x7'));var controller=require(_0x5c9d('0x8'));router[_0x5c9d('0x9')]('/',auth[_0x5c9d('0xa')](),controller[_0x5c9d('0xb')]);router[_0x5c9d('0x9')](_0x5c9d('0xc'),auth[_0x5c9d('0xa')](),controller[_0x5c9d('0xd')]);router[_0x5c9d('0x9')](_0x5c9d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5c9d('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5c9d('0xf')]);router[_0x5c9d('0x9')](_0x5c9d('0x10'),auth[_0x5c9d('0xa')](),controller[_0x5c9d('0x11')]);router[_0x5c9d('0x12')]('/',auth[_0x5c9d('0xa')](),controller[_0x5c9d('0x13')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x5c9d('0x14')]);router[_0x5c9d('0x12')](_0x5c9d('0x15'),auth[_0x5c9d('0xa')](),interaction[_0x5c9d('0x16')]('openchannel',_0x5c9d('0x17')),controller[_0x5c9d('0x18')]);router[_0x5c9d('0x19')]('/:id',auth[_0x5c9d('0xa')](),interaction['tracked'](_0x5c9d('0x1a'),_0x5c9d('0x1b')),controller[_0x5c9d('0x1c')]);router['delete']('/:id',auth[_0x5c9d('0xa')](),interaction[_0x5c9d('0x16')]('openchannel','openchannelinteraction:destroy'),controller[_0x5c9d('0x1d')]);router[_0x5c9d('0x1e')](_0x5c9d('0x15'),auth[_0x5c9d('0xa')](),controller[_0x5c9d('0x1f')]);module[_0x5c9d('0x20')]=router; \ No newline at end of file +var _0x797e=['openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0x797e,0x17e));var _0xe797=function(_0x26a05d,_0x29896f){_0x26a05d=_0x26a05d-0x0;var _0x51e5d3=_0x797e[_0x26a05d];return _0x51e5d3;};'use strict';var multer=require(_0xe797('0x0'));var util=require(_0xe797('0x1'));var path=require(_0xe797('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe797('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe797('0x4'));var interaction=require(_0xe797('0x5'));var config=require(_0xe797('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xe797('0x7')]('/',auth[_0xe797('0x8')](),controller[_0xe797('0x9')]);router[_0xe797('0x7')](_0xe797('0xa'),auth[_0xe797('0x8')](),controller[_0xe797('0xb')]);router[_0xe797('0x7')](_0xe797('0xc'),auth[_0xe797('0x8')](),controller[_0xe797('0xd')]);router[_0xe797('0x7')](_0xe797('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0xe797('0x7')]('/:id/download',auth[_0xe797('0x8')](),controller[_0xe797('0xf')]);router[_0xe797('0x10')]('/',auth[_0xe797('0x8')](),controller[_0xe797('0x11')]);router[_0xe797('0x10')](_0xe797('0xe'),auth[_0xe797('0x8')](),controller[_0xe797('0x12')]);router[_0xe797('0x10')](_0xe797('0x13'),auth[_0xe797('0x8')](),interaction[_0xe797('0x14')](_0xe797('0x15'),_0xe797('0x16')),controller[_0xe797('0x17')]);router[_0xe797('0x18')]('/:id',auth[_0xe797('0x8')](),interaction['tracked'](_0xe797('0x15'),_0xe797('0x19')),controller[_0xe797('0x1a')]);router['delete'](_0xe797('0xc'),auth[_0xe797('0x8')](),interaction['tracked'](_0xe797('0x15'),_0xe797('0x1b')),controller[_0xe797('0x1c')]);router[_0xe797('0x1d')](_0xe797('0x13'),auth['isAuthenticated'](),controller[_0xe797('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 96f1641..6f1b699 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.attributes.js +++ b/server/api/openchannelInteraction/openchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa508=['exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize'];(function(_0x5f9032,_0x2dd161){var _0x5d3a8f=function(_0x226e17){while(--_0x226e17){_0x5f9032['push'](_0x5f9032['shift']());}};_0x5d3a8f(++_0x2dd161);}(_0xa508,0x187));var _0x8a50=function(_0x46cc80,_0x38e451){_0x46cc80=_0x46cc80-0x0;var _0x24fa5e=_0xa508[_0x46cc80];return _0x24fa5e;};'use strict';var Sequelize=require(_0x8a50('0x0'));module[_0x8a50('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a50('0x2')]},'disposition':{'type':Sequelize[_0x8a50('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8a50('0x3')]},'read1stAt':{'type':Sequelize[_0x8a50('0x2')]},'threadId':{'type':Sequelize[_0x8a50('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x8a50('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8a50('0x4')]('in',_0x8a50('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8a50('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8a50('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x8a50('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5862=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x264375,_0x2525d9){var _0x40fdca=function(_0x29d434){while(--_0x29d434){_0x264375['push'](_0x264375['shift']());}};_0x40fdca(++_0x2525d9);}(_0x5862,0x17f));var _0x2586=function(_0x12399a,_0x2462c2){_0x12399a=_0x12399a-0x0;var _0x590db3=_0x5862[_0x12399a];return _0x590db3;};'use strict';var Sequelize=require(_0x2586('0x0'));module[_0x2586('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2586('0x2')]},'disposition':{'type':Sequelize[_0x2586('0x3')]},'secondDisposition':{'type':Sequelize[_0x2586('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2586('0x3')]},'note':{'type':Sequelize[_0x2586('0x3')]},'read1stAt':{'type':Sequelize[_0x2586('0x2')]},'threadId':{'type':Sequelize[_0x2586('0x3')]},'externalUrl':{'type':Sequelize[_0x2586('0x3')]},'lastMsgAt':{'type':Sequelize[_0x2586('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x2586('0x4')]('in',_0x2586('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2586('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2586('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index c97b532..f5ae218 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.controller.js +++ b/server/api/openchannelInteraction/openchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x866e=['user','catch','show','from','params','model','keys','filters','fields','attributes','length','includeAll','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','split','format','YYYY-MM-DD\x20HH:mm:ss','include','omit','Tag','name','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','Openchannel','toString','closed','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','basename','out','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','sendStatus','zip-dir','moment','path','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query'];(function(_0x35fc03,_0x159f45){var _0x17f6f7=function(_0x233caf){while(--_0x233caf){_0x35fc03['push'](_0x35fc03['shift']());}};_0x17f6f7(++_0x159f45);}(_0x866e,0x14b));var _0xe866=function(_0x4b0230,_0x568530){_0x4b0230=_0x4b0230-0x0;var _0x43e44d=_0x866e[_0x4b0230];return _0x43e44d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe866('0x0'));var moment=require(_0xe866('0x1'));var util=require('util');var path=require(_0xe866('0x2'));var ejs=require(_0xe866('0x3'));var fs=require('fs');var _=require(_0xe866('0x4'));var Redis=require(_0xe866('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xe866('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0xe866('0x7'))(_0xe866('0x8'));var config=require('../../config/environment');var db=require(_0xe866('0x9'))['db'];config[_0xe866('0xa')]=_[_0xe866('0xb')](config[_0xe866('0xa')],{'host':_0xe866('0xc'),'port':0x18eb});var socket=require(_0xe866('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4e8f84,_0x534127){_0x534127=_0x534127||0xcc;return function(_0x5c308e){if(_0x5c308e){return _0x4e8f84['sendStatus'](_0x534127);}return _0x4e8f84['status'](_0x534127)[_0xe866('0xe')]();};}function respondWithResult(_0x5ca674,_0x2e9ab1){_0x2e9ab1=_0x2e9ab1||0xc8;return function(_0x1e5987){if(_0x1e5987){return _0x5ca674[_0xe866('0xf')](_0x2e9ab1)[_0xe866('0x10')](_0x1e5987);}};}function respondWithFilteredResult(_0x3372ca,_0x3a3820){return function(_0x31b33b){if(_0x31b33b){var _0x1b48ac=typeof _0x3a3820[_0xe866('0x11')]===_0xe866('0x12')&&typeof _0x3a3820[_0xe866('0x13')]===_0xe866('0x12');var _0x36fe0d=_0x31b33b[_0xe866('0x14')];var _0x33ed20=_0x1b48ac?0x0:_0x3a3820[_0xe866('0x11')];var _0x3275c8=_0x1b48ac?_0x31b33b[_0xe866('0x14')]:_0x3a3820['offset']+_0x3a3820['limit'];var _0x3df6a5;if(_0x3275c8>=_0x36fe0d){_0x3275c8=_0x36fe0d;_0x3df6a5=0xc8;}else{_0x3df6a5=0xce;}_0x3372ca[_0xe866('0xf')](_0x3df6a5);return _0x3372ca['set'](_0xe866('0x15'),_0x33ed20+'-'+_0x3275c8+'/'+_0x36fe0d)[_0xe866('0x10')](_0x31b33b);}return null;};}function saveUpdates(_0x2d4a30){return function(_0xd650a9){if(_0xd650a9){return _0xd650a9[_0xe866('0x16')](_0x2d4a30)[_0xe866('0x17')](function(_0x44b4bd){return _0x44b4bd;});}return null;};}function removeEntity(_0x382a6e){return function(_0x3d6752){if(_0x3d6752){return _0x3d6752[_0xe866('0x18')]()['then'](function(){_0x382a6e[_0xe866('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd936c6){return function(_0xe81856){if(!_0xe81856){_0xd936c6['sendStatus'](0x194);}return _0xe81856;};}function handleError(_0x380110,_0x36ca1f){_0x36ca1f=_0x36ca1f||0x1f4;return function(_0x47e67e){logger[_0xe866('0x19')](_0x47e67e[_0xe866('0x1a')]);if(_0x47e67e['name']){delete _0x47e67e['name'];}_0x380110[_0xe866('0xf')](_0x36ca1f)[_0xe866('0x1b')](_0x47e67e);};}exports['index']=function(_0x3b7726,_0x300cb1){var _0x2b5eb3={};var _0x4e40ab=_[_0xe866('0x1c')](db[_0xe866('0x1d')][_0xe866('0x1e')],function(_0xf163){return{'name':_0xf163[_0xe866('0x1f')],'type':_0xf163[_0xe866('0x20')][_0xe866('0x21')]};});_0x2b5eb3=qs[_0xe866('0x22')](_0x4e40ab,_0x3b7726);return interaction[_0xe866('0x23')](_0xe866('0x24'),_0x3b7726[_0xe866('0x25')],_0x3b7726[_0xe866('0x26')],_0x2b5eb3,_0x4e40ab)[_0xe866('0x17')](respondWithFilteredResult(_0x300cb1,_0x2b5eb3))[_0xe866('0x27')](handleError(_0x300cb1,null));};exports[_0xe866('0x28')]=function(_0x23c02c,_0x542e18){var _0xba886a={};if(_0x23c02c['query'][_0xe866('0x20')]&&_0x23c02c[_0xe866('0x25')][_0xe866('0x20')]==='from'){_0xba886a[_0xe866('0x29')]=_0x23c02c[_0xe866('0x2a')]['id'];}else{_0xba886a['id']=_0x23c02c[_0xe866('0x2a')]['id'];}var _0x49ab76={'raw':![],'where':_0xba886a},_0x1fbaa8={};_0x1fbaa8[_0xe866('0x2b')]=_[_0xe866('0x2c')](db[_0xe866('0x1d')][_0xe866('0x1e')]);_0x1fbaa8[_0xe866('0x25')]=_[_0xe866('0x2c')](_0x23c02c['query']);_0x1fbaa8[_0xe866('0x2d')]=_['intersection'](_0x1fbaa8[_0xe866('0x2b')],_0x1fbaa8[_0xe866('0x25')]);_0x49ab76['attributes']=_['intersection'](_0x1fbaa8['model'],qs[_0xe866('0x2e')](_0x23c02c['query'][_0xe866('0x2e')]));_0x49ab76[_0xe866('0x2f')]=_0x49ab76['attributes'][_0xe866('0x30')]?_0x49ab76['attributes']:_0x1fbaa8[_0xe866('0x2b')];if(_0x23c02c[_0xe866('0x25')][_0xe866('0x31')]){_0x49ab76['include']=[{'all':!![]}];}_0x49ab76=_['merge']({},_0x49ab76,_0x23c02c[_0xe866('0x32')]);return db[_0xe866('0x1d')][_0xe866('0x33')](_0x49ab76)[_0xe866('0x17')](handleEntityNotFound(_0x542e18,null))[_0xe866('0x17')](respondWithResult(_0x542e18,null))[_0xe866('0x27')](handleError(_0x542e18,null));};exports[_0xe866('0x34')]=function(_0x4c69fb,_0x4298a5){return db[_0xe866('0x1d')][_0xe866('0x34')](_0x4c69fb[_0xe866('0x35')],{})[_0xe866('0x17')](respondWithResult(_0x4298a5,0xc9))['catch'](handleError(_0x4298a5,null));};exports[_0xe866('0x16')]=function(_0x36af60,_0x241adb){if(_0x36af60[_0xe866('0x35')]['id']){delete _0x36af60[_0xe866('0x35')]['id'];}return db[_0xe866('0x1d')][_0xe866('0x33')]({'where':{'id':_0x36af60[_0xe866('0x2a')]['id']}})[_0xe866('0x17')](handleEntityNotFound(_0x241adb,null))[_0xe866('0x17')](saveUpdates(_0x36af60[_0xe866('0x35')],null))['then'](respondWithResult(_0x241adb,null))[_0xe866('0x27')](handleError(_0x241adb,null));};exports[_0xe866('0x18')]=function(_0x4f00ae,_0x102de9){return db[_0xe866('0x1d')]['find']({'where':{'id':_0x4f00ae[_0xe866('0x2a')]['id']}})[_0xe866('0x17')](handleEntityNotFound(_0x102de9,null))[_0xe866('0x17')](removeEntity(_0x102de9,null))[_0xe866('0x27')](handleError(_0x102de9,null));};exports[_0xe866('0x36')]=function(_0x3f3d7e,_0x12bbcc){return db['OpenchannelInteraction'][_0xe866('0x36')]()[_0xe866('0x17')](respondWithResult(_0x12bbcc,null))[_0xe866('0x27')](handleError(_0x12bbcc,null));};exports[_0xe866('0x37')]=function(_0x158939,_0x3389c6){return db[_0xe866('0x38')][_0xe866('0x33')]({'where':{'id':_0x158939[_0xe866('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3389c6,null))[_0xe866('0x17')](function(_0x22a3b6){if(_0x22a3b6){return _0x22a3b6[_0xe866('0x37')](_0x158939[_0xe866('0x35')][_0xe866('0x39')],_['omit'](_0x158939[_0xe866('0x35')],[_0xe866('0x39'),'id'])||{});}})[_0xe866('0x17')](respondWithResult(_0x3389c6,null))[_0xe866('0x27')](handleError(_0x3389c6,null));};exports[_0xe866('0x3a')]=function(_0x1087fd,_0x147c6a){var _0x373864={'raw':![],'where':{}};var _0x4c6ad3={};var _0x596280={'count':0x0,'rows':[]};return db[_0xe866('0x1d')]['findOne']({'where':{'id':_0x1087fd[_0xe866('0x2a')]['id']}})[_0xe866('0x17')](handleEntityNotFound(_0x147c6a,null))[_0xe866('0x17')](function(_0x1e7585){if(_0x1e7585){_0x4c6ad3[_0xe866('0x2b')]=_['keys'](db[_0xe866('0x38')]['rawAttributes']);_0x4c6ad3[_0xe866('0x25')]=_['keys'](_0x1087fd[_0xe866('0x25')]);_0x4c6ad3[_0xe866('0x2d')]=_['intersection'](_0x4c6ad3['model'],_0x4c6ad3[_0xe866('0x25')]);_0x373864['attributes']=_['intersection'](_0x4c6ad3[_0xe866('0x2b')],qs[_0xe866('0x2e')](_0x1087fd[_0xe866('0x25')][_0xe866('0x2e')]));_0x373864[_0xe866('0x2f')]=_0x373864[_0xe866('0x2f')][_0xe866('0x30')]?_0x373864[_0xe866('0x2f')]:_0x4c6ad3[_0xe866('0x2b')];if(!_0x1087fd[_0xe866('0x25')][_0xe866('0x3b')](_0xe866('0x3c'))){_0x373864['limit']=qs['limit'](_0x1087fd[_0xe866('0x25')][_0xe866('0x13')]);_0x373864['offset']=qs['offset'](_0x1087fd[_0xe866('0x25')][_0xe866('0x11')]);}_0x373864[_0xe866('0x3d')]=qs[_0xe866('0x3e')](_0x1087fd[_0xe866('0x25')][_0xe866('0x3e')]);_0x373864[_0xe866('0x3f')]=qs[_0xe866('0x2d')](_[_0xe866('0x40')](_0x1087fd[_0xe866('0x25')],_0x4c6ad3[_0xe866('0x2d')]));_0x373864[_0xe866('0x3f')]['OpenchannelInteractionId']=_0x1e7585['id'];if(_0x1087fd[_0xe866('0x25')][_0xe866('0x41')]){_0x373864[_0xe866('0x3f')]=_[_0xe866('0x42')](_0x373864[_0xe866('0x3f')],{'$or':_[_0xe866('0x1c')](_0x373864[_0xe866('0x2f')],function(_0x588c57){var _0x25c5e7={};_0x25c5e7[_0x588c57]={'$like':'%'+_0x1087fd['query'][_0xe866('0x41')]+'%'};return _0x25c5e7;})});}if(_0x1087fd[_0xe866('0x25')]['$gte']){var _0x1a56c0=_0x1087fd[_0xe866('0x25')]['$gte'][_0xe866('0x43')](',');var _0x166470={};_0x166470[_0x1a56c0[0x0]]={'$gte':moment(_0x1a56c0[0x1])[_0xe866('0x44')](_0xe866('0x45'))};_0x373864[_0xe866('0x3f')]=_['merge'](_0x373864['where'],_0x166470);}_0x373864=_['merge']({},_0x373864,_0x1087fd['options']);return db[_0xe866('0x38')][_0xe866('0x14')]({'where':_0x373864['where']})['then'](function(_0x49dc1d){_0x596280[_0xe866('0x14')]=_0x49dc1d;if(_0x1087fd[_0xe866('0x25')][_0xe866('0x31')]){_0x373864[_0xe866('0x46')]=[{'all':!![]}];}return db[_0xe866('0x38')][_0xe866('0x23')](_0x373864);})[_0xe866('0x17')](function(_0x39edac){_0x596280['rows']=_0x39edac;return _0x596280;});}})['then'](respondWithFilteredResult(_0x147c6a,_0x373864))['catch'](handleError(_0x147c6a,null));};exports['addTags']=function(_0x267e19,_0x418d77){return db[_0xe866('0x1d')][_0xe866('0x33')]({'where':{'id':_0x267e19['params']['id']}})['then'](handleEntityNotFound(_0x418d77,null))[_0xe866('0x17')](function(_0x1ddacd){if(_0x1ddacd){return _0x1ddacd['setTags'](_0x267e19[_0xe866('0x35')][_0xe866('0x39')],_[_0xe866('0x47')](_0x267e19[_0xe866('0x35')],[_0xe866('0x39'),'id'])||{})['spread'](function(){return db[_0xe866('0x48')][_0xe866('0x23')]({'attributes':['id',_0xe866('0x49'),_0xe866('0x4a')],'where':{'id':_0x267e19[_0xe866('0x35')][_0xe866('0x39')]}});})[_0xe866('0x17')](function(_0x5c9999){socket[_0xe866('0x4b')](_0xe866('0x4c'),{'id':Number(_0x267e19[_0xe866('0x2a')]['id']),'tags':_0x5c9999||[]});return{'id':Number(_0x267e19[_0xe866('0x2a')]['id']),'tags':_0x5c9999||[]};});}})[_0xe866('0x17')](respondWithResult(_0x418d77,null))['catch'](handleError(_0x418d77,null));};exports[_0xe866('0x4d')]=function(_0x3daa67,_0x1fd6bf){return db[_0xe866('0x1d')][_0xe866('0x33')]({'where':{'id':_0x3daa67[_0xe866('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1fd6bf,null))[_0xe866('0x17')](function(_0x26bbf6){if(_0x26bbf6){return _0x26bbf6[_0xe866('0x4d')](_0x3daa67[_0xe866('0x25')]['ids']);}})[_0xe866('0x17')](respondWithStatusCode(_0x1fd6bf,null))[_0xe866('0x27')](handleError(_0x1fd6bf,null));};exports[_0xe866('0x4e')]=function(_0x28916b,_0x53aac2){var _0x2ce4e0=moment()[_0xe866('0x4f')]()['toString']();var _0x3b6914=path[_0xe866('0x50')](config[_0xe866('0x51')],_0xe866('0x52'),_0xe866('0x53'),_0xe866('0x54'));var _0x1f9f3c=path[_0xe866('0x50')](config['root'],_0xe866('0x52'),'files',_0xe866('0x55'));var _0x5e2bf4=path[_0xe866('0x50')](_0x3b6914,_0x2ce4e0);var _0x57771c=util[_0xe866('0x44')]('transcript-%d-%s.zip',_0x28916b[_0xe866('0x2a')]['id'],_0x2ce4e0);var _0x360727=path['join'](_0x3b6914,_0x57771c);var _0xf722bd=[];_0xf722bd[_0xe866('0x56')]({'model':db[_0xe866('0x57')],'as':_0xe866('0x57'),'attributes':['id','fullname'],'raw':!![]});_0xf722bd[_0xe866('0x56')]({'model':db[_0xe866('0x58')],'as':_0xe866('0x59'),'attributes':['id',_0xe866('0x5a'),_0xe866('0x5b')],'raw':!![]});if(_0x28916b[_0xe866('0x25')][_0xe866('0x55')]){_0xf722bd[_0xe866('0x56')]({'model':db[_0xe866('0x5c')],'as':_0xe866('0x5c'),'raw':!![]});}var _0x12b4fd=[{'model':db[_0xe866('0x38')],'as':_0xe866('0x5d'),'attributes':['id',_0xe866('0x35'),_0xe866('0x5e'),_0xe866('0x5f'),_0xe866('0x60'),'read'],'include':_0xf722bd}];_0x12b4fd['push']({'model':db[_0xe866('0x61')],'as':_0xe866('0x62'),'attributes':['id','name']});_0x12b4fd[_0xe866('0x56')]({'model':db[_0xe866('0x57')],'as':_0xe866('0x63'),'attributes':['id',_0xe866('0x64')]});return db[_0xe866('0x1d')][_0xe866('0x33')]({'where':{'id':_0x28916b[_0xe866('0x2a')]['id']},'include':_0x12b4fd})[_0xe866('0x17')](handleEntityNotFound(_0x53aac2,null))[_0xe866('0x17')](function(_0x3598ed){if(_0x3598ed){var _0x12a8f7=_0x3598ed[_0xe866('0x65')]({'plain':!![]});fs[_0xe866('0x66')](_0x5e2bf4);var _0x6b2189={'channel':_0xe866('0x67'),'account':_0x12a8f7[_0xe866('0x62')][_0xe866('0x49')],'agent':_0x12a8f7[_0xe866('0x63')]?_0x12a8f7[_0xe866('0x63')][_0xe866('0x64')]:'N.A.','createdAt':moment(_0x12a8f7[_0xe866('0x5e')])['format'](_0xe866('0x45'))[_0xe866('0x68')](),'closedAt':_0x12a8f7[_0xe866('0x69')]?moment(_0x12a8f7['closedAt'])[_0xe866('0x44')](_0xe866('0x45'))[_0xe866('0x68')]():'','disposition':_0x12a8f7[_0xe866('0x6a')],'visibility':_0x12a8f7[_0xe866('0x6b')]?_0xe866('0x6c'):_0xe866('0x6d'),'messages':_(_0x12a8f7[_0xe866('0x5d')])[_0xe866('0x41')]({'secret':![]})[_0xe866('0x1c')](function(_0x1dd7ab){if(_0x1dd7ab[_0xe866('0x5c')]){var _0x122cd1=path['join'](_0x1f9f3c,_0x1dd7ab[_0xe866('0x5c')]['basename']);if(fs[_0xe866('0x6e')](_0x122cd1)){fs[_0xe866('0x6f')](_0x122cd1)[_0xe866('0x70')](fs['createWriteStream'](path['join'](_0x5e2bf4,_0x1dd7ab[_0xe866('0x5c')][_0xe866('0x71')])));}}return{'date':moment(_0x1dd7ab[_0xe866('0x5e')])['format'](_0xe866('0x45'))[_0xe866('0x68')](),'sender':_0x1dd7ab[_0xe866('0x5f')]===_0xe866('0x72')?_0x1dd7ab[_0xe866('0x57')]?_0x1dd7ab[_0xe866('0x57')][_0xe866('0x64')]:'System':_0x1dd7ab[_0xe866('0x59')][_0xe866('0x5a')]+(_0x1dd7ab['Contact'][_0xe866('0x5b')]?'\x20'+_0x1dd7ab['Contact'][_0xe866('0x5b')]:''),'body':_0x1dd7ab[_0xe866('0x5c')]?_0x1dd7ab[_0xe866('0x5c')]['basename']:_0x1dd7ab['body'],'direction':_0x1dd7ab['direction']===_0xe866('0x72')?'A':'C','secret':_0x1dd7ab['secret'],'read':_0x1dd7ab['read'],'attachment':_0x1dd7ab[_0xe866('0x5c')]};})[_0xe866('0x73')]()};return ejs['renderFile'](path[_0xe866('0x50')](config[_0xe866('0x51')],'server',_0xe866('0x74'),_0xe866('0x75')),{'interaction':_0x6b2189})[_0xe866('0x17')](function(_0x163382){var _0x28592b=path['join'](_0x5e2bf4,_0xe866('0x76')+_0x12a8f7['id']+'-'+_0x2ce4e0+'.pdf');var _0x41559a={'path':_0x28592b,'channel':'Openchannel','interactionId':_0x12a8f7['id']};return pdf[_0xe866('0x77')](_0x163382,_0x41559a);})[_0xe866('0x17')](function(){return new Promise(function(_0x95d32f,_0x346ede){zipdir(_0x5e2bf4,{'saveTo':_0x360727},function(_0x3e63ec,_0x3d2bae){if(_0x3e63ec)return _0x346ede(_0x3e63ec);return _0x95d32f(_0x3d2bae);});})[_0xe866('0x17')](function(){return new Promise(function(_0x40c219,_0x58e22c){rimraf(_0x5e2bf4,function(_0xfa739d){if(_0xfa739d)_0x58e22c(_0xfa739d);return _0x40c219();});});})[_0xe866('0x17')](function(){return _0x53aac2['download'](_0x360727,_0x57771c,function(_0x4a2780){if(_0x4a2780){logger['error'](_0xe866('0x78'),_0x4a2780);}else{fs[_0xe866('0x79')](_0x360727);}});});});}else{return _0x53aac2[_0xe866('0x7a')](0xc8);}})['catch'](handleError(_0x53aac2,null));}; \ No newline at end of file +var _0xa604=['lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','User','Owner','mkdirSync','Account','closed','closedAt','disposition','threadId','basename','existsSync','pipe','createWriteStream','out','System','firstName','value','views','downloadInteraction.ejs','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','error','name','send','index','fieldName','key','getOptions','findAll','openchannel','user','catch','show','query','type','from','params','model','OpenchannelInteraction','attributes','intersection','fields','length','includeAll','include','options','find','body','describe','addMessage','OpenchannelMessage','ids','getMessages','keys','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','color','emit','removeTags','download','toString','join','root','server','files','transcript-%d-%s.zip','fullname','push','CmContact','Contact'];(function(_0x39f0dc,_0x63dc35){var _0x41cb16=function(_0x4c07b0){while(--_0x4c07b0){_0x39f0dc['push'](_0x39f0dc['shift']());}};_0x41cb16(++_0x63dc35);}(_0xa604,0x9d));var _0x4a60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa604[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x4a60('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var util=require(_0x4a60('0x1'));var path=require(_0x4a60('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a60('0x3'));var Redis=require(_0x4a60('0x4'));var interaction=require(_0x4a60('0x5'));var qs=require(_0x4a60('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x4a60('0x7'));var config=require(_0x4a60('0x8'));var db=require(_0x4a60('0x9'))['db'];config[_0x4a60('0xa')]=_[_0x4a60('0xb')](config[_0x4a60('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a60('0xa')]));require('./openchannelInteraction.socket')[_0x4a60('0xc')](socket);function respondWithStatusCode(_0x31269a,_0xc8942d){_0xc8942d=_0xc8942d||0xcc;return function(_0x56ac04){if(_0x56ac04){return _0x31269a[_0x4a60('0xd')](_0xc8942d);}return _0x31269a[_0x4a60('0xe')](_0xc8942d)[_0x4a60('0xf')]();};}function respondWithResult(_0x30f882,_0x2294e8){_0x2294e8=_0x2294e8||0xc8;return function(_0x4afee0){if(_0x4afee0){return _0x30f882['status'](_0x2294e8)[_0x4a60('0x10')](_0x4afee0);}};}function respondWithFilteredResult(_0x257c8a,_0x572ead){return function(_0x3fee0c){if(_0x3fee0c){var _0x1a02f3=typeof _0x572ead[_0x4a60('0x11')]===_0x4a60('0x12')&&typeof _0x572ead['limit']===_0x4a60('0x12');var _0x24cb0d=_0x3fee0c[_0x4a60('0x13')];var _0x47c75f=_0x1a02f3?0x0:_0x572ead[_0x4a60('0x11')];var _0xbc8453=_0x1a02f3?_0x3fee0c[_0x4a60('0x13')]:_0x572ead['offset']+_0x572ead[_0x4a60('0x14')];var _0x1f6d86;if(_0xbc8453>=_0x24cb0d){_0xbc8453=_0x24cb0d;_0x1f6d86=0xc8;}else{_0x1f6d86=0xce;}_0x257c8a[_0x4a60('0xe')](_0x1f6d86);return _0x257c8a['set'](_0x4a60('0x15'),_0x47c75f+'-'+_0xbc8453+'/'+_0x24cb0d)[_0x4a60('0x10')](_0x3fee0c);}return null;};}function saveUpdates(_0x10e985){return function(_0x591281){if(_0x591281){return _0x591281[_0x4a60('0x16')](_0x10e985)[_0x4a60('0x17')](function(_0x53f5af){return _0x53f5af;});}return null;};}function removeEntity(_0x269a3b){return function(_0x23b44a){if(_0x23b44a){return _0x23b44a[_0x4a60('0x18')]()[_0x4a60('0x17')](function(){_0x269a3b[_0x4a60('0xe')](0xcc)[_0x4a60('0xf')]();});}};}function handleEntityNotFound(_0x5b8e91){return function(_0xefdca){if(!_0xefdca){_0x5b8e91[_0x4a60('0xd')](0x194);}return _0xefdca;};}function handleError(_0x2f0a94,_0x302add){_0x302add=_0x302add||0x1f4;return function(_0xe2f20){logger[_0x4a60('0x19')](_0xe2f20['stack']);if(_0xe2f20['name']){delete _0xe2f20[_0x4a60('0x1a')];}_0x2f0a94[_0x4a60('0xe')](_0x302add)[_0x4a60('0x1b')](_0xe2f20);};}exports[_0x4a60('0x1c')]=function(_0x36435d,_0x79cb94){var _0x5cce69={};var _0x3d5b77=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0xc059ea){return{'name':_0xc059ea[_0x4a60('0x1d')],'type':_0xc059ea['type'][_0x4a60('0x1e')]};});_0x5cce69=qs[_0x4a60('0x1f')](_0x3d5b77,_0x36435d);return interaction[_0x4a60('0x20')](_0x4a60('0x21'),_0x36435d['query'],_0x36435d[_0x4a60('0x22')],_0x5cce69,_0x3d5b77)[_0x4a60('0x17')](respondWithFilteredResult(_0x79cb94,_0x5cce69))[_0x4a60('0x23')](handleError(_0x79cb94,null));};exports[_0x4a60('0x24')]=function(_0x10a9bb,_0x3b24aa){var _0x32741e={};if(_0x10a9bb[_0x4a60('0x25')][_0x4a60('0x26')]&&_0x10a9bb[_0x4a60('0x25')][_0x4a60('0x26')]==='from'){_0x32741e[_0x4a60('0x27')]=_0x10a9bb['params']['id'];}else{_0x32741e['id']=_0x10a9bb[_0x4a60('0x28')]['id'];}var _0x438661={'raw':![],'where':_0x32741e},_0x39c103={};_0x39c103[_0x4a60('0x29')]=_['keys'](db[_0x4a60('0x2a')]['rawAttributes']);_0x39c103['query']=_['keys'](_0x10a9bb[_0x4a60('0x25')]);_0x39c103['filters']=_['intersection'](_0x39c103[_0x4a60('0x29')],_0x39c103[_0x4a60('0x25')]);_0x438661[_0x4a60('0x2b')]=_[_0x4a60('0x2c')](_0x39c103[_0x4a60('0x29')],qs[_0x4a60('0x2d')](_0x10a9bb['query'][_0x4a60('0x2d')]));_0x438661[_0x4a60('0x2b')]=_0x438661[_0x4a60('0x2b')][_0x4a60('0x2e')]?_0x438661[_0x4a60('0x2b')]:_0x39c103['model'];if(_0x10a9bb[_0x4a60('0x25')][_0x4a60('0x2f')]){_0x438661[_0x4a60('0x30')]=[{'all':!![]}];}_0x438661=_['merge']({},_0x438661,_0x10a9bb[_0x4a60('0x31')]);return db['OpenchannelInteraction'][_0x4a60('0x32')](_0x438661)[_0x4a60('0x17')](handleEntityNotFound(_0x3b24aa,null))[_0x4a60('0x17')](respondWithResult(_0x3b24aa,null))[_0x4a60('0x23')](handleError(_0x3b24aa,null));};exports['create']=function(_0x3cfdea,_0x129b3e){return db[_0x4a60('0x2a')]['create'](_0x3cfdea[_0x4a60('0x33')],{})[_0x4a60('0x17')](respondWithResult(_0x129b3e,0xc9))[_0x4a60('0x23')](handleError(_0x129b3e,null));};exports[_0x4a60('0x16')]=function(_0x5e8292,_0x3e38c2){if(_0x5e8292[_0x4a60('0x33')]['id']){delete _0x5e8292['body']['id'];}return db['OpenchannelInteraction'][_0x4a60('0x32')]({'where':{'id':_0x5e8292[_0x4a60('0x28')]['id']}})[_0x4a60('0x17')](handleEntityNotFound(_0x3e38c2,null))[_0x4a60('0x17')](saveUpdates(_0x5e8292[_0x4a60('0x33')],null))[_0x4a60('0x17')](respondWithResult(_0x3e38c2,null))[_0x4a60('0x23')](handleError(_0x3e38c2,null));};exports[_0x4a60('0x18')]=function(_0x43be5b,_0x511160){return db[_0x4a60('0x2a')][_0x4a60('0x32')]({'where':{'id':_0x43be5b[_0x4a60('0x28')]['id']}})[_0x4a60('0x17')](handleEntityNotFound(_0x511160,null))[_0x4a60('0x17')](removeEntity(_0x511160,null))['catch'](handleError(_0x511160,null));};exports['describe']=function(_0x43e4a3,_0x22953e){return db[_0x4a60('0x2a')][_0x4a60('0x34')]()[_0x4a60('0x17')](respondWithResult(_0x22953e,null))[_0x4a60('0x23')](handleError(_0x22953e,null));};exports[_0x4a60('0x35')]=function(_0x38f228,_0x15dfa3){return db[_0x4a60('0x36')]['find']({'where':{'id':_0x38f228[_0x4a60('0x28')]['id']}})[_0x4a60('0x17')](handleEntityNotFound(_0x15dfa3,null))[_0x4a60('0x17')](function(_0x46a6b6){if(_0x46a6b6){return _0x46a6b6[_0x4a60('0x35')](_0x38f228[_0x4a60('0x33')][_0x4a60('0x37')],_['omit'](_0x38f228[_0x4a60('0x33')],[_0x4a60('0x37'),'id'])||{});}})['then'](respondWithResult(_0x15dfa3,null))[_0x4a60('0x23')](handleError(_0x15dfa3,null));};exports[_0x4a60('0x38')]=function(_0x46ca20,_0x177bc3){var _0x119bf1={'raw':![],'where':{}};var _0x4cd0f3={};var _0x4a30bb={'count':0x0,'rows':[]};return db[_0x4a60('0x2a')]['findOne']({'where':{'id':_0x46ca20['params']['id']}})[_0x4a60('0x17')](handleEntityNotFound(_0x177bc3,null))[_0x4a60('0x17')](function(_0x1b02e2){if(_0x1b02e2){_0x4cd0f3['model']=_[_0x4a60('0x39')](db[_0x4a60('0x36')][_0x4a60('0x3a')]);_0x4cd0f3[_0x4a60('0x25')]=_[_0x4a60('0x39')](_0x46ca20[_0x4a60('0x25')]);_0x4cd0f3[_0x4a60('0x3b')]=_[_0x4a60('0x2c')](_0x4cd0f3[_0x4a60('0x29')],_0x4cd0f3[_0x4a60('0x25')]);_0x119bf1[_0x4a60('0x2b')]=_[_0x4a60('0x2c')](_0x4cd0f3[_0x4a60('0x29')],qs[_0x4a60('0x2d')](_0x46ca20[_0x4a60('0x25')][_0x4a60('0x2d')]));_0x119bf1[_0x4a60('0x2b')]=_0x119bf1[_0x4a60('0x2b')][_0x4a60('0x2e')]?_0x119bf1[_0x4a60('0x2b')]:_0x4cd0f3[_0x4a60('0x29')];if(!_0x46ca20['query'][_0x4a60('0x3c')](_0x4a60('0x3d'))){_0x119bf1[_0x4a60('0x14')]=qs[_0x4a60('0x14')](_0x46ca20[_0x4a60('0x25')][_0x4a60('0x14')]);_0x119bf1[_0x4a60('0x11')]=qs[_0x4a60('0x11')](_0x46ca20['query'][_0x4a60('0x11')]);}_0x119bf1[_0x4a60('0x3e')]=qs[_0x4a60('0x3f')](_0x46ca20[_0x4a60('0x25')][_0x4a60('0x3f')]);_0x119bf1[_0x4a60('0x40')]=qs[_0x4a60('0x3b')](_[_0x4a60('0x41')](_0x46ca20[_0x4a60('0x25')],_0x4cd0f3['filters']));_0x119bf1[_0x4a60('0x40')][_0x4a60('0x42')]=_0x1b02e2['id'];if(_0x46ca20['query'][_0x4a60('0x43')]){_0x119bf1[_0x4a60('0x40')]=_[_0x4a60('0x44')](_0x119bf1['where'],{'$or':_[_0x4a60('0x45')](_0x119bf1['attributes'],function(_0x575d54){var _0x229f32={};_0x229f32[_0x575d54]={'$like':'%'+_0x46ca20[_0x4a60('0x25')][_0x4a60('0x43')]+'%'};return _0x229f32;})});}if(_0x46ca20[_0x4a60('0x25')][_0x4a60('0x46')]){var _0x2420ec=_0x46ca20[_0x4a60('0x25')]['$gte']['split'](',');var _0x5e3820={};_0x5e3820[_0x2420ec[0x0]]={'$gte':moment(_0x2420ec[0x1])[_0x4a60('0x47')](_0x4a60('0x48'))};_0x119bf1[_0x4a60('0x40')]=_[_0x4a60('0x44')](_0x119bf1[_0x4a60('0x40')],_0x5e3820);}_0x119bf1=_['merge']({},_0x119bf1,_0x46ca20[_0x4a60('0x31')]);return db['OpenchannelMessage'][_0x4a60('0x13')]({'where':_0x119bf1[_0x4a60('0x40')]})[_0x4a60('0x17')](function(_0x43ddda){_0x4a30bb[_0x4a60('0x13')]=_0x43ddda;if(_0x46ca20[_0x4a60('0x25')]['includeAll']){_0x119bf1['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x4a60('0x20')](_0x119bf1);})[_0x4a60('0x17')](function(_0x2d35df){_0x4a30bb[_0x4a60('0x49')]=_0x2d35df;return _0x4a30bb;});}})[_0x4a60('0x17')](respondWithFilteredResult(_0x177bc3,_0x119bf1))[_0x4a60('0x23')](handleError(_0x177bc3,null));};exports[_0x4a60('0x4a')]=function(_0x350f6c,_0x1398ce){return db[_0x4a60('0x2a')][_0x4a60('0x32')]({'where':{'id':_0x350f6c[_0x4a60('0x28')]['id']}})[_0x4a60('0x17')](handleEntityNotFound(_0x1398ce,null))[_0x4a60('0x17')](function(_0x25c3ed){if(_0x25c3ed){return _0x25c3ed[_0x4a60('0x4b')](_0x350f6c[_0x4a60('0x33')]['ids'],_[_0x4a60('0x4c')](_0x350f6c[_0x4a60('0x33')],[_0x4a60('0x37'),'id'])||{})[_0x4a60('0x4d')](function(){return db[_0x4a60('0x4e')][_0x4a60('0x20')]({'attributes':['id',_0x4a60('0x1a'),_0x4a60('0x4f')],'where':{'id':_0x350f6c[_0x4a60('0x33')][_0x4a60('0x37')]}});})['then'](function(_0x41d0e6){socket[_0x4a60('0x50')]('openchannelInteractionTags:save',{'id':Number(_0x350f6c[_0x4a60('0x28')]['id']),'tags':_0x41d0e6||[]});return{'id':Number(_0x350f6c[_0x4a60('0x28')]['id']),'tags':_0x41d0e6||[]};});}})['then'](respondWithResult(_0x1398ce,null))[_0x4a60('0x23')](handleError(_0x1398ce,null));};exports[_0x4a60('0x51')]=function(_0x51beef,_0x2444af){return db['OpenchannelInteraction'][_0x4a60('0x32')]({'where':{'id':_0x51beef[_0x4a60('0x28')]['id']}})[_0x4a60('0x17')](handleEntityNotFound(_0x2444af,null))[_0x4a60('0x17')](function(_0x910288){if(_0x910288){return _0x910288['removeTags'](_0x51beef[_0x4a60('0x25')]['ids']);}})[_0x4a60('0x17')](respondWithStatusCode(_0x2444af,null))[_0x4a60('0x23')](handleError(_0x2444af,null));};exports[_0x4a60('0x52')]=function(_0x2944df,_0x372edc){var _0x4e2736=moment()['unix']()[_0x4a60('0x53')]();var _0x4d1ca2=path[_0x4a60('0x54')](config[_0x4a60('0x55')],_0x4a60('0x56'),_0x4a60('0x57'),'tmp');var _0x3db938=path[_0x4a60('0x54')](config[_0x4a60('0x55')],'server',_0x4a60('0x57'),'attachments');var _0x5d2374=path[_0x4a60('0x54')](_0x4d1ca2,_0x4e2736);var _0x304e19=util[_0x4a60('0x47')](_0x4a60('0x58'),_0x2944df[_0x4a60('0x28')]['id'],_0x4e2736);var _0x512873=path[_0x4a60('0x54')](_0x4d1ca2,_0x304e19);var _0x2b7996=[];_0x2b7996['push']({'model':db['User'],'as':'User','attributes':['id',_0x4a60('0x59')],'raw':!![]});_0x2b7996[_0x4a60('0x5a')]({'model':db[_0x4a60('0x5b')],'as':_0x4a60('0x5c'),'attributes':['id','firstName',_0x4a60('0x5d')],'raw':!![]});if(_0x2944df[_0x4a60('0x25')][_0x4a60('0x5e')]){_0x2b7996['push']({'model':db[_0x4a60('0x5f')],'as':_0x4a60('0x5f'),'raw':!![]});}var _0x1f24e9=[{'model':db[_0x4a60('0x36')],'as':_0x4a60('0x60'),'attributes':['id','body',_0x4a60('0x61'),_0x4a60('0x62'),_0x4a60('0x63'),_0x4a60('0x64')],'include':_0x2b7996}];_0x1f24e9['push']({'model':db[_0x4a60('0x65')],'as':'Account','attributes':['id','name']});_0x1f24e9[_0x4a60('0x5a')]({'model':db[_0x4a60('0x66')],'as':_0x4a60('0x67'),'attributes':['id',_0x4a60('0x59')]});return db['OpenchannelInteraction'][_0x4a60('0x32')]({'where':{'id':_0x2944df[_0x4a60('0x28')]['id']},'include':_0x1f24e9})[_0x4a60('0x17')](handleEntityNotFound(_0x372edc,null))['then'](function(_0x261009){if(_0x261009){var _0x1c6a4a=_0x261009['get']({'plain':!![]});fs[_0x4a60('0x68')](_0x5d2374);var _0x265273={'channel':'Openchannel','account':_0x1c6a4a[_0x4a60('0x69')][_0x4a60('0x1a')],'agent':_0x1c6a4a[_0x4a60('0x67')]?_0x1c6a4a[_0x4a60('0x67')]['fullname']:'N.A.','createdAt':moment(_0x1c6a4a[_0x4a60('0x61')])[_0x4a60('0x47')](_0x4a60('0x48'))['toString'](),'closedAt':_0x1c6a4a[_0x4a60('0x6a')]?moment(_0x1c6a4a[_0x4a60('0x6b')])[_0x4a60('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4a60('0x53')]():'','disposition':_0x1c6a4a[_0x4a60('0x6c')],'visibility':_0x1c6a4a[_0x4a60('0x6d')]?'Public':'Private','messages':_(_0x1c6a4a[_0x4a60('0x60')])[_0x4a60('0x43')]({'secret':![]})['map'](function(_0x1acfae){if(_0x1acfae['Attachment']){var _0x44722d=path[_0x4a60('0x54')](_0x3db938,_0x1acfae['Attachment'][_0x4a60('0x6e')]);if(fs[_0x4a60('0x6f')](_0x44722d)){fs['createReadStream'](_0x44722d)[_0x4a60('0x70')](fs[_0x4a60('0x71')](path[_0x4a60('0x54')](_0x5d2374,_0x1acfae[_0x4a60('0x5f')]['basename'])));}}return{'date':moment(_0x1acfae[_0x4a60('0x61')])['format'](_0x4a60('0x48'))[_0x4a60('0x53')](),'sender':_0x1acfae[_0x4a60('0x62')]===_0x4a60('0x72')?_0x1acfae[_0x4a60('0x66')]?_0x1acfae['User'][_0x4a60('0x59')]:_0x4a60('0x73'):_0x1acfae[_0x4a60('0x5c')][_0x4a60('0x74')]+(_0x1acfae['Contact'][_0x4a60('0x5d')]?'\x20'+_0x1acfae[_0x4a60('0x5c')]['lastName']:''),'body':_0x1acfae[_0x4a60('0x5f')]?_0x1acfae[_0x4a60('0x5f')][_0x4a60('0x6e')]:_0x1acfae[_0x4a60('0x33')],'direction':_0x1acfae[_0x4a60('0x62')]===_0x4a60('0x72')?'A':'C','secret':_0x1acfae[_0x4a60('0x63')],'read':_0x1acfae[_0x4a60('0x64')],'attachment':_0x1acfae['Attachment']};})[_0x4a60('0x75')]()};return ejs['renderFile'](path[_0x4a60('0x54')](config['root'],_0x4a60('0x56'),_0x4a60('0x76'),_0x4a60('0x77')),{'interaction':_0x265273})[_0x4a60('0x17')](function(_0x24af57){var _0x16fddf=path[_0x4a60('0x54')](_0x5d2374,'transcript-'+_0x1c6a4a['id']+'-'+_0x4e2736+_0x4a60('0x78'));var _0x140e66={'path':_0x16fddf,'channel':_0x4a60('0x79'),'interactionId':_0x1c6a4a['id']};return pdf[_0x4a60('0x7a')](_0x24af57,_0x140e66);})['then'](function(){return new Promise(function(_0x5312fa,_0x2477a3){zipdir(_0x5d2374,{'saveTo':_0x512873},function(_0x46bb01,_0x1fa2ce){if(_0x46bb01)return _0x2477a3(_0x46bb01);return _0x5312fa(_0x1fa2ce);});})[_0x4a60('0x17')](function(){return new Promise(function(_0x35155f,_0x23c259){rimraf(_0x5d2374,function(_0x4fa3b1){if(_0x4fa3b1)_0x23c259(_0x4fa3b1);return _0x35155f();});});})['then'](function(){return _0x372edc[_0x4a60('0x52')](_0x512873,_0x304e19,function(_0x36c6fc){if(_0x36c6fc){logger[_0x4a60('0x19')](_0x4a60('0x7b'),_0x36c6fc);}else{fs[_0x4a60('0x7c')](_0x512873);}});});});}else{return _0x372edc[_0x4a60('0xd')](0xc8);}})[_0x4a60('0x23')](handleError(_0x372edc,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index d255533..ac65a18 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.events.js +++ b/server/api/openchannelInteraction/openchannelInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8251=['events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8251,0x19e));var _0x1825=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8251[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require(_0x1825('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x1825('0x1')];var OpenchannelMessage=require(_0x1825('0x2'))['db'][_0x1825('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1825('0x4'),'afterUpdate':_0x1825('0x5'),'afterDestroy':_0x1825('0x6')};function emitEvent(_0x45400f){return function(_0x45fbd9,_0x195664,_0x31c2bb){_0x45fbd9[_0x1825('0x7')]({'attributes':['id'],'raw':!![]})[_0x1825('0x8')](function(_0x25cb69){_0x45fbd9['setDataValue'](_0x1825('0x9'),_0x25cb69[_0x1825('0xa')](function(_0x462e57){return{'id':_0x462e57['id']};}));return OpenchannelMessage[_0x1825('0xb')]({'where':{'OpenchannelInteractionId':_0x45fbd9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1825('0x8')](function(_0x1f2194){_0x45fbd9[_0x1825('0xc')](_0x1825('0xd'),_0x1f2194['length']);OpenchannelInteractionEvents[_0x1825('0xe')](_0x45400f+':'+_0x45fbd9['id'],_0x45fbd9);OpenchannelInteractionEvents[_0x1825('0xe')](_0x45400f,_0x45fbd9);_0x31c2bb(null);})[_0x1825('0xf')](_0x31c2bb(null));};}for(var e in events){if(events[_0x1825('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x1825('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5724=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','length','emit'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x5724,0x6a));var _0x4572=function(_0x4a0db0,_0x45d3e1){_0x4a0db0=_0x4a0db0-0x0;var _0x5260c9=_0x5724[_0x4a0db0];return _0x5260c9;};'use strict';var EventEmitter=require(_0x4572('0x0'));var OpenchannelInteraction=require(_0x4572('0x1'))['db'][_0x4572('0x2')];var OpenchannelMessage=require(_0x4572('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4572('0x3')](0x0);var events={'afterCreate':_0x4572('0x4'),'afterUpdate':_0x4572('0x5'),'afterDestroy':_0x4572('0x6')};function emitEvent(_0x2e5e81){return function(_0x2c03f3,_0x2a2b26,_0x5b7686){_0x2c03f3[_0x4572('0x7')]({'attributes':['id'],'raw':!![]})[_0x4572('0x8')](function(_0x1efc01){_0x2c03f3[_0x4572('0x9')]('Users',_0x1efc01['map'](function(_0x529aa7){return{'id':_0x529aa7['id']};}));return OpenchannelMessage[_0x4572('0xa')]({'where':{'OpenchannelInteractionId':_0x2c03f3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4572('0x8')](function(_0x1b4a2a){_0x2c03f3[_0x4572('0x9')]('unreadMessages',_0x1b4a2a[_0x4572('0xb')]);OpenchannelInteractionEvents[_0x4572('0xc')](_0x2e5e81+':'+_0x2c03f3['id'],_0x2c03f3);OpenchannelInteractionEvents[_0x4572('0xc')](_0x2e5e81,_0x2c03f3);_0x5b7686(null);})[_0x4572('0xd')](_0x5b7686(null));};}for(var e in events){if(events[_0x4572('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x4572('0xf')](e,emitEvent(event));}}module[_0x4572('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 208ad95..48b6f36 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.model.js +++ b/server/api/openchannelInteraction/openchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fbd=['OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x0fbd,0x1ef));var _0xd0fb=function(_0x2ef014,_0xdd40cf){_0x2ef014=_0x2ef014-0x0;var _0x44df4e=_0x0fbd[_0x2ef014];return _0x44df4e;};'use strict';var _=require(_0xd0fb('0x0'));var util=require(_0xd0fb('0x1'));var logger=require(_0xd0fb('0x2'))(_0xd0fb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd0fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd0fb('0x5'));var attributes=require(_0xd0fb('0x6'));module[_0xd0fb('0x7')]=function(_0x319c37,_0x31bd78){return _0x319c37[_0xd0fb('0x8')](_0xd0fb('0x9'),attributes,{'tableName':_0xd0fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd0fb('0xb'),'collate':_0xd0fb('0xc'),'hooks':{'beforeUpdate':function(_0x3f6eca,_0x28eec9,_0x35bcbb){if(_0x3f6eca[_0xd0fb('0xd')](_0xd0fb('0xe'))){_0x3f6eca[_0xd0fb('0xf')]=moment()[_0xd0fb('0x10')](_0xd0fb('0x11'));}_0x35bcbb(null,_0x3f6eca);}}});}; \ No newline at end of file +var _0xa8db=['../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4e084e,_0x45e961){var _0x1b71ab=function(_0x1ed06b){while(--_0x1ed06b){_0x4e084e['push'](_0x4e084e['shift']());}};_0x1b71ab(++_0x45e961);}(_0xa8db,0x12a));var _0xba8d=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xa8db[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0xba8d('0x0'));var util=require(_0xba8d('0x1'));var logger=require(_0xba8d('0x2'))(_0xba8d('0x3'));var moment=require(_0xba8d('0x4'));var BPromise=require('bluebird');var rp=require(_0xba8d('0x5'));var fs=require('fs');var path=require(_0xba8d('0x6'));var rimraf=require(_0xba8d('0x7'));var config=require(_0xba8d('0x8'));var attributes=require(_0xba8d('0x9'));module['exports']=function(_0x5dd30,_0x51f070){return _0x5dd30['define'](_0xba8d('0xa'),attributes,{'tableName':_0xba8d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xba8d('0xc'),'hooks':{'beforeUpdate':function(_0x41e707,_0x4a8d25,_0x51ac6a){if(_0x41e707['changed'](_0xba8d('0xd'))){_0x41e707[_0xba8d('0xe')]=moment()[_0xba8d('0xf')](_0xba8d('0x10'));}_0x51ac6a(null,_0x41e707);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index f4055ca..053016c 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.rpc.js +++ b/server/api/openchannelInteraction/openchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02fc=['find','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','http','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','OpenchannelInteraction','options','where','attributes','limit','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x02fc,0x182));var _0xc02f=function(_0x2d5420,_0x293a30){_0x2d5420=_0x2d5420-0x0;var _0x55a362=_0x02fc[_0x2d5420];return _0x55a362;};'use strict';var _=require(_0xc02f('0x0'));var util=require(_0xc02f('0x1'));var moment=require(_0xc02f('0x2'));var BPromise=require(_0xc02f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc02f('0x4'))['db'];var utils=require(_0xc02f('0x5'));var logger=require('../../config/logger')(_0xc02f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc02f('0x7')]({'port':0x232a});config[_0xc02f('0x8')]=_['defaults'](config[_0xc02f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc02f('0x9'))(new Redis(config['redis']));require(_0xc02f('0xa'))[_0xc02f('0xb')](socket);function respondWithRpcPromise(_0x2c6c24,_0x50fcc3,_0x484473){return new BPromise(function(_0x4b3eed,_0x29f0f5){return client[_0xc02f('0xc')](_0x2c6c24,_0x484473)[_0xc02f('0xd')](function(_0x2bd2d6){logger[_0xc02f('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x50fcc3,_0xc02f('0xf'));logger['debug'](_0xc02f('0x10'),_0x50fcc3,_0xc02f('0xf'),JSON[_0xc02f('0x11')](_0x2bd2d6));if(_0x2bd2d6[_0xc02f('0x12')]){if(_0x2bd2d6[_0xc02f('0x12')][_0xc02f('0x13')]===0x1f4){logger['error'](_0xc02f('0x14'),_0x50fcc3,_0x2bd2d6['error'][_0xc02f('0x15')]);return _0x29f0f5(_0x2bd2d6[_0xc02f('0x12')][_0xc02f('0x15')]);}logger['error'](_0xc02f('0x14'),_0x50fcc3,_0x2bd2d6[_0xc02f('0x12')][_0xc02f('0x15')]);return _0x4b3eed(_0x2bd2d6[_0xc02f('0x12')][_0xc02f('0x15')]);}else{logger[_0xc02f('0xe')](_0xc02f('0x14'),_0x50fcc3,_0xc02f('0xf'));_0x4b3eed(_0x2bd2d6[_0xc02f('0x16')][_0xc02f('0x15')]);}})[_0xc02f('0x17')](function(_0x46756){logger[_0xc02f('0x12')](_0xc02f('0x14'),_0x50fcc3,_0x46756);_0x29f0f5(_0x46756);});});}exports['UpdateOpenchannelInteraction']=function(_0x33837d){var _0x203e7b=this;return new Promise(function(_0x1fb69a,_0x22a144){return db[_0xc02f('0x18')]['update'](_0x33837d['body'],{'raw':_0x33837d[_0xc02f('0x19')]?_0x33837d[_0xc02f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33837d[_0xc02f('0x19')]?_0x33837d[_0xc02f('0x19')][_0xc02f('0x1a')]||null:null,'attributes':_0x33837d['options']?_0x33837d[_0xc02f('0x19')][_0xc02f('0x1b')]||null:null,'limit':_0x33837d[_0xc02f('0x19')]?_0x33837d[_0xc02f('0x19')][_0xc02f('0x1c')]||null:null})['then'](function(_0x50f6d6){logger[_0xc02f('0xe')](_0xc02f('0x1d'),_0x33837d);logger[_0xc02f('0x1e')]('UpdateOpenchannelInteraction',_0x33837d,JSON[_0xc02f('0x11')](_0x50f6d6));_0x1fb69a(_0x50f6d6);})[_0xc02f('0x17')](function(_0x3b64c3){logger[_0xc02f('0x12')](_0xc02f('0x1d'),_0x3b64c3['message'],_0x33837d);_0x22a144(_0x203e7b['error'](0x1f4,_0x3b64c3[_0xc02f('0x15')]));});});};exports[_0xc02f('0x1f')]=function(_0x2d910d){return new Promise(function(_0x15dd36,_0x449b64){return db[_0xc02f('0x18')][_0xc02f('0x20')]({'where':_0x2d910d[_0xc02f('0x19')]?_0x2d910d[_0xc02f('0x19')][_0xc02f('0x1a')]||null:null})[_0xc02f('0xd')](function(_0x11ca04){if(_0x11ca04){return _0x11ca04['addTags'](_0x2d910d[_0xc02f('0x21')][_0xc02f('0x22')],_[_0xc02f('0x23')](_0x2d910d[_0xc02f('0x21')],[_0xc02f('0x22'),'id'])||{});}})[_0xc02f('0x24')](function(_0x5bf90a){logger[_0xc02f('0xe')]('AddTags',_0x2d910d);logger[_0xc02f('0x1e')](_0xc02f('0x25'),_0x2d910d,JSON[_0xc02f('0x11')](_0x5bf90a));_0x15dd36(_0x5bf90a);})['catch'](function(_0x321e75){logger[_0xc02f('0x12')](_0xc02f('0x25'),_0x321e75['message'],_0x2d910d);_0x449b64(_this[_0xc02f('0x12')](0x1f4,_0x321e75[_0xc02f('0x15')]));});});}; \ No newline at end of file +var _0xb1b9=['limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes'];(function(_0x21d0e6,_0x5a7aa6){var _0x1cc2d1=function(_0x25ded8){while(--_0x25ded8){_0x21d0e6['push'](_0x21d0e6['shift']());}};_0x1cc2d1(++_0x5a7aa6);}(_0xb1b9,0x170));var _0x9b1b=function(_0x4975ce,_0x3b03af){_0x4975ce=_0x4975ce-0x0;var _0x3672cd=_0xb1b9[_0x4975ce];return _0x3672cd;};'use strict';var _=require(_0x9b1b('0x0'));var util=require(_0x9b1b('0x1'));var moment=require(_0x9b1b('0x2'));var BPromise=require(_0x9b1b('0x3'));var rs=require(_0x9b1b('0x4'));var fs=require('fs');var Redis=require(_0x9b1b('0x5'));var db=require(_0x9b1b('0x6'))['db'];var utils=require(_0x9b1b('0x7'));var logger=require(_0x9b1b('0x8'))('rpc');var config=require(_0x9b1b('0x9'));var jayson=require(_0x9b1b('0xa'));var client=jayson['client'][_0x9b1b('0xb')]({'port':0x232a});config['redis']=_[_0x9b1b('0xc')](config[_0x9b1b('0xd')],{'host':_0x9b1b('0xe'),'port':0x18eb});var socket=require(_0x9b1b('0xf'))(new Redis(config[_0x9b1b('0xd')]));require(_0x9b1b('0x10'))[_0x9b1b('0x11')](socket);function respondWithRpcPromise(_0x4118bd,_0x42faa1,_0x49bf12){return new BPromise(function(_0xd89e42,_0x4646f1){return client[_0x9b1b('0x12')](_0x4118bd,_0x49bf12)[_0x9b1b('0x13')](function(_0x27f5b1){logger[_0x9b1b('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x42faa1,_0x9b1b('0x15'));logger[_0x9b1b('0x16')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x42faa1,_0x9b1b('0x15'),JSON[_0x9b1b('0x17')](_0x27f5b1));if(_0x27f5b1[_0x9b1b('0x18')]){if(_0x27f5b1['error'][_0x9b1b('0x19')]===0x1f4){logger[_0x9b1b('0x18')](_0x9b1b('0x1a'),_0x42faa1,_0x27f5b1[_0x9b1b('0x18')][_0x9b1b('0x1b')]);return _0x4646f1(_0x27f5b1[_0x9b1b('0x18')][_0x9b1b('0x1b')]);}logger['error'](_0x9b1b('0x1a'),_0x42faa1,_0x27f5b1[_0x9b1b('0x18')][_0x9b1b('0x1b')]);return _0xd89e42(_0x27f5b1[_0x9b1b('0x18')]['message']);}else{logger[_0x9b1b('0x14')](_0x9b1b('0x1a'),_0x42faa1,_0x9b1b('0x15'));_0xd89e42(_0x27f5b1['result'][_0x9b1b('0x1b')]);}})[_0x9b1b('0x1c')](function(_0x24b9ef){logger[_0x9b1b('0x18')](_0x9b1b('0x1a'),_0x42faa1,_0x24b9ef);_0x4646f1(_0x24b9ef);});});}exports[_0x9b1b('0x1d')]=function(_0x5a824c){var _0x7c1616=this;return new Promise(function(_0x108561,_0x3dd73b){return db[_0x9b1b('0x1e')][_0x9b1b('0x1f')](_0x5a824c[_0x9b1b('0x20')],{'raw':_0x5a824c[_0x9b1b('0x21')]?_0x5a824c['options'][_0x9b1b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a824c['options']?_0x5a824c['options'][_0x9b1b('0x23')]||null:null,'attributes':_0x5a824c[_0x9b1b('0x21')]?_0x5a824c['options'][_0x9b1b('0x24')]||null:null,'limit':_0x5a824c[_0x9b1b('0x21')]?_0x5a824c[_0x9b1b('0x21')][_0x9b1b('0x25')]||null:null})['then'](function(_0x3c6863){logger[_0x9b1b('0x14')](_0x9b1b('0x1d'),_0x5a824c);logger[_0x9b1b('0x16')](_0x9b1b('0x1d'),_0x5a824c,JSON[_0x9b1b('0x17')](_0x3c6863));_0x108561(_0x3c6863);})[_0x9b1b('0x1c')](function(_0x376187){logger[_0x9b1b('0x18')](_0x9b1b('0x1d'),_0x376187[_0x9b1b('0x1b')],_0x5a824c);_0x3dd73b(_0x7c1616['error'](0x1f4,_0x376187[_0x9b1b('0x1b')]));});});};exports[_0x9b1b('0x26')]=function(_0x4277fa){return new Promise(function(_0x2f6f8e,_0x1cf8ba){return db['OpenchannelInteraction'][_0x9b1b('0x27')]({'where':_0x4277fa['options']?_0x4277fa['options'][_0x9b1b('0x23')]||null:null})[_0x9b1b('0x13')](function(_0x5ee788){if(_0x5ee788){return _0x5ee788[_0x9b1b('0x28')](_0x4277fa[_0x9b1b('0x20')][_0x9b1b('0x29')],_[_0x9b1b('0x2a')](_0x4277fa[_0x9b1b('0x20')],[_0x9b1b('0x29'),'id'])||{});}})[_0x9b1b('0x2b')](function(_0x516785){logger['info'](_0x9b1b('0x2c'),_0x4277fa);logger[_0x9b1b('0x16')]('AddTags',_0x4277fa,JSON[_0x9b1b('0x17')](_0x516785));_0x2f6f8e(_0x516785);})[_0x9b1b('0x1c')](function(_0x24e693){logger['error'](_0x9b1b('0x2c'),_0x24e693[_0x9b1b('0x1b')],_0x4277fa);_0x1cf8ba(_this[_0x9b1b('0x18')](0x1f4,_0x24e693[_0x9b1b('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 41e9516..253b8fa 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.socket.js +++ b/server/api/openchannelInteraction/openchannelInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa58=['length','openchannelInteraction:','./openchannelInteraction.events','save','emit','removeListener'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xaa58,0x194));var _0x8aa5=function(_0x298383,_0x4df889){_0x298383=_0x298383-0x0;var _0x2f01db=_0xaa58[_0x298383];return _0x2f01db;};'use strict';var OpenchannelInteractionEvents=require(_0x8aa5('0x0'));var events=[_0x8aa5('0x1'),'remove','update'];function createListener(_0x76034f,_0x313bc0){return function(_0x1c4f7e){_0x313bc0[_0x8aa5('0x2')](_0x76034f,_0x1c4f7e);};}function removeListener(_0x1dc305,_0x2bb342){return function(){OpenchannelInteractionEvents[_0x8aa5('0x3')](_0x1dc305,_0x2bb342);};}exports['register']=function(_0x5b4f45){for(var _0x252ff0=0x0,_0x11df2e=events[_0x8aa5('0x4')];_0x252ff0<_0x11df2e;_0x252ff0++){var _0x3386e1=events[_0x252ff0];var _0x507acd=createListener(_0x8aa5('0x5')+_0x3386e1,_0x5b4f45);OpenchannelInteractionEvents['on'](_0x3386e1,_0x507acd);}}; \ No newline at end of file +var _0xf6e0=['update','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0xf6e0,0x17d));var _0x0f6e=function(_0x3a24a1,_0x16c752){_0x3a24a1=_0x3a24a1-0x0;var _0x5caedd=_0xf6e0[_0x3a24a1];return _0x5caedd;};'use strict';var OpenchannelInteractionEvents=require(_0x0f6e('0x0'));var events=[_0x0f6e('0x1'),_0x0f6e('0x2'),_0x0f6e('0x3')];function createListener(_0x58510d,_0x2bae0e){return function(_0x313c3d){_0x2bae0e['emit'](_0x58510d,_0x313c3d);};}function removeListener(_0x9cf13f,_0x391eff){return function(){OpenchannelInteractionEvents[_0x0f6e('0x4')](_0x9cf13f,_0x391eff);};}exports[_0x0f6e('0x5')]=function(_0x53009f){for(var _0x201675=0x0,_0x1a6772=events[_0x0f6e('0x6')];_0x201675<_0x1a6772;_0x201675++){var _0x1dfd00=events[_0x201675];var _0x7914ce=createListener(_0x0f6e('0x7')+_0x1dfd00,_0x53009f);OpenchannelInteractionEvents['on'](_0x1dfd00,_0x7914ce);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 4840303..d247e3e 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x46b290,_0x253f21){var _0x12bc05=function(_0x1f217d){while(--_0x1f217d){_0x46b290['push'](_0x46b290['shift']());}};_0x12bc05(++_0x253f21);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x205c83,_0x49c57a){var _0x116554=function(_0x1cf4ef){while(--_0x1cf4ef){_0x205c83['push'](_0x205c83['shift']());}};_0x116554(++_0x49c57a);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a6df187..b463f50 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0447=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x0447,0x8b));var _0x7044=function(_0x1ddd0,_0x15f9f4){_0x1ddd0=_0x1ddd0-0x0;var _0x4d86d0=_0x0447[_0x1ddd0];return _0x4d86d0;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'body':{'type':Sequelize[_0x7044('0x2')](_0x7044('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7044('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7044('0x5')]('in',_0x7044('0x6')),'defaultValue':_0x7044('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7044('0x7')]},'providerName':{'type':Sequelize[_0x7044('0x8')]},'providerResponse':{'type':Sequelize[_0x7044('0x2')]}}; \ No newline at end of file +var _0x6f3e=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f3e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe6f3('0x0'));module[_0xe6f3('0x1')]={'body':{'type':Sequelize[_0xe6f3('0x2')](_0xe6f3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe6f3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe6f3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe6f3('0x5')]('in','out'),'defaultValue':_0xe6f3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe6f3('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe6f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d26b1df..7f1fc46 100644 --- a/server/api/openchannelMessage/openchannelMessage.controller.js +++ b/server/api/openchannelMessage/openchannelMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa595=['Sequelize','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','json','offset','undefined','limit','count','status','set','apply','update','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','reject','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x438478,_0x184986){var _0x1b77d2=function(_0x3dd081){while(--_0x3dd081){_0x438478['push'](_0x438478['shift']());}};_0x1b77d2(++_0x184986);}(_0xa595,0x198));var _0x5a59=function(_0x2e44fc,_0xb6a29c){_0x2e44fc=_0x2e44fc-0x0;var _0x23f835=_0xa595[_0x2e44fc];return _0x23f835;};'use strict';var emlformat=require(_0x5a59('0x0'));var rimraf=require(_0x5a59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a59('0x2'));var rp=require(_0x5a59('0x3'));var moment=require(_0x5a59('0x4'));var BPromise=require(_0x5a59('0x5'));var Mustache=require(_0x5a59('0x6'));var util=require(_0x5a59('0x7'));var path=require(_0x5a59('0x8'));var sox=require(_0x5a59('0x9'));var csv=require(_0x5a59('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a59('0xb'));var _=require(_0x5a59('0xc'));var squel=require(_0x5a59('0xd'));var crypto=require(_0x5a59('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5a59('0xf'));var toCsv=require(_0x5a59('0xa'));var querystring=require(_0x5a59('0x10'));var Papa=require(_0x5a59('0x11'));var Redis=require(_0x5a59('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5a59('0x13'));var as=require(_0x5a59('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a59('0x15'))(_0x5a59('0x16'));var utils=require(_0x5a59('0x17'));var config=require(_0x5a59('0x18'));var licenseUtil=require(_0x5a59('0x19'));var db=require('../../mysqldb')['db'];config[_0x5a59('0x1a')]=_[_0x5a59('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5a59('0x1c'))(new Redis(config[_0x5a59('0x1a')]));require('./openchannelMessage.socket')[_0x5a59('0x1d')](socket);var jayson=require(_0x5a59('0x1e'));var client=jayson[_0x5a59('0x1f')][_0x5a59('0x20')]({'port':0x232c});var client9002=jayson[_0x5a59('0x1f')][_0x5a59('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x141115,_0x1ea2a7,_0x48d22f,_0x5a2755){return new BPromise(function(_0x432725,_0x194b02){var _0x5c749e=_0x5a2755||client;return _0x5c749e[_0x5a59('0x21')](_0x141115,_0x48d22f)[_0x5a59('0x22')](function(_0x5af77d){logger[_0x5a59('0x23')](_0x5a59('0x24'),_0x1ea2a7,_0x5a59('0x25'));logger[_0x5a59('0x26')](_0x5a59('0x27'),_0x1ea2a7,_0x5a59('0x25'),JSON[_0x5a59('0x28')](_0x5af77d));if(_0x5af77d['error']){if(_0x5af77d[_0x5a59('0x29')][_0x5a59('0x2a')]===0x1f4){logger[_0x5a59('0x29')](_0x5a59('0x24'),_0x1ea2a7,_0x5af77d[_0x5a59('0x29')][_0x5a59('0x2b')]);return _0x194b02(_0x5af77d[_0x5a59('0x29')][_0x5a59('0x2b')]);}logger[_0x5a59('0x29')](_0x5a59('0x24'),_0x1ea2a7,_0x5af77d[_0x5a59('0x29')][_0x5a59('0x2b')]);return _0x432725(_0x5af77d[_0x5a59('0x29')][_0x5a59('0x2b')]);}else{logger[_0x5a59('0x23')](_0x5a59('0x24'),_0x1ea2a7,_0x5a59('0x25'));_0x432725(_0x5af77d[_0x5a59('0x2c')][_0x5a59('0x2b')]);}})['catch'](function(_0xa97da9){logger[_0x5a59('0x29')](_0x5a59('0x24'),_0x1ea2a7,_0xa97da9);_0x194b02(_0xa97da9);});});}function respondWithStatusCode(_0x1d4f65,_0xe29c78){_0xe29c78=_0xe29c78||0xcc;return function(_0x3dbcbe){if(_0x3dbcbe){return _0x1d4f65['sendStatus'](_0xe29c78);}return _0x1d4f65['status'](_0xe29c78)[_0x5a59('0x2d')]();};}function respondWithResult(_0x36765d,_0x1a8e1b){_0x1a8e1b=_0x1a8e1b||0xc8;return function(_0x367fff){if(_0x367fff){return _0x36765d['status'](_0x1a8e1b)[_0x5a59('0x2e')](_0x367fff);}};}function respondWithFilteredResult(_0x4f73ab,_0x3248c1){return function(_0x3ff246){if(_0x3ff246){var _0x250f6e=typeof _0x3248c1[_0x5a59('0x2f')]===_0x5a59('0x30')&&typeof _0x3248c1[_0x5a59('0x31')]===_0x5a59('0x30');var _0x171f3a=_0x3ff246[_0x5a59('0x32')];var _0x26a12a=_0x250f6e?0x0:_0x3248c1[_0x5a59('0x2f')];var _0x3f4ac3=_0x250f6e?_0x3ff246[_0x5a59('0x32')]:_0x3248c1[_0x5a59('0x2f')]+_0x3248c1['limit'];var _0x5898bf;if(_0x3f4ac3>=_0x171f3a){_0x3f4ac3=_0x171f3a;_0x5898bf=0xc8;}else{_0x5898bf=0xce;}_0x4f73ab[_0x5a59('0x33')](_0x5898bf);return _0x4f73ab[_0x5a59('0x34')]('Content-Range',_0x26a12a+'-'+_0x3f4ac3+'/'+_0x171f3a)['json'](_0x3ff246);}return null;};}function patchUpdates(_0x54a066){return function(_0x2c26db){try{jsonpatch[_0x5a59('0x35')](_0x2c26db,_0x54a066,!![]);}catch(_0x401c90){return BPromise['reject'](_0x401c90);}return _0x2c26db['save']();};}function saveUpdates(_0x221c09,_0x5c0338){return function(_0x331e43){if(_0x331e43){return _0x331e43[_0x5a59('0x36')](_0x221c09)[_0x5a59('0x22')](function(_0x5ca6d3){return _0x5ca6d3;});}return null;};}function removeEntity(_0x53ae3d,_0x4d2860){return function(_0x13a179){if(_0x13a179){return _0x13a179[_0x5a59('0x37')]()['then'](function(){_0x53ae3d[_0x5a59('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e64e,_0x17e807){return function(_0x4ee40e){if(!_0x4ee40e){_0x13e64e[_0x5a59('0x38')](0x194);}return _0x4ee40e;};}function handleError(_0x3cf1e3,_0x813377){_0x813377=_0x813377||0x1f4;return function(_0x434dff){logger[_0x5a59('0x29')](_0x434dff[_0x5a59('0x39')]);if(_0x434dff['name']){delete _0x434dff[_0x5a59('0x3a')];}_0x3cf1e3[_0x5a59('0x33')](_0x813377)[_0x5a59('0x3b')](_0x434dff);};}exports[_0x5a59('0x3c')]=function(_0x2c8493,_0x42043e){var _0x34e28a={},_0x5864a3={},_0x2fc04f={'count':0x0,'rows':[]};var _0x6dacd9=_[_0x5a59('0x3d')](db[_0x5a59('0x3e')][_0x5a59('0x3f')],function(_0x2d19e6){return{'name':_0x2d19e6[_0x5a59('0x40')],'type':_0x2d19e6[_0x5a59('0x41')][_0x5a59('0x42')]};});_0x5864a3[_0x5a59('0x43')]=_[_0x5a59('0x3d')](_0x6dacd9,'name');_0x5864a3[_0x5a59('0x44')]=_[_0x5a59('0x45')](_0x2c8493[_0x5a59('0x44')]);_0x5864a3[_0x5a59('0x46')]=_['intersection'](_0x5864a3[_0x5a59('0x43')],_0x5864a3[_0x5a59('0x44')]);_0x34e28a[_0x5a59('0x47')]=_[_0x5a59('0x48')](_0x5864a3[_0x5a59('0x43')],qs[_0x5a59('0x49')](_0x2c8493['query']['fields']));_0x34e28a[_0x5a59('0x47')]=_0x34e28a[_0x5a59('0x47')][_0x5a59('0x4a')]?_0x34e28a[_0x5a59('0x47')]:_0x5864a3[_0x5a59('0x43')];if(!_0x2c8493[_0x5a59('0x44')][_0x5a59('0x4b')]('nolimit')){_0x34e28a[_0x5a59('0x31')]=qs[_0x5a59('0x31')](_0x2c8493[_0x5a59('0x44')][_0x5a59('0x31')]);_0x34e28a[_0x5a59('0x2f')]=qs[_0x5a59('0x2f')](_0x2c8493[_0x5a59('0x44')][_0x5a59('0x2f')]);}_0x34e28a['order']=qs['sort'](_0x2c8493[_0x5a59('0x44')][_0x5a59('0x4c')]);_0x34e28a[_0x5a59('0x4d')]=qs[_0x5a59('0x46')](_[_0x5a59('0x4e')](_0x2c8493[_0x5a59('0x44')],_0x5864a3['filters']),_0x6dacd9);if(_0x2c8493['query'][_0x5a59('0x4f')]){_0x34e28a[_0x5a59('0x4d')]=_[_0x5a59('0x50')](_0x34e28a[_0x5a59('0x4d')],{'$or':_[_0x5a59('0x3d')](_0x6dacd9,function(_0x10db30){if(_0x10db30['type']!==_0x5a59('0x51')){var _0x13b0e7={};_0x13b0e7[_0x10db30[_0x5a59('0x3a')]]={'$like':'%'+_0x2c8493[_0x5a59('0x44')]['filter']+'%'};return _0x13b0e7;}})});}_0x34e28a=_[_0x5a59('0x50')]({},_0x34e28a,_0x2c8493['options']);var _0x3340d1={'where':_0x34e28a[_0x5a59('0x4d')]};return db[_0x5a59('0x3e')][_0x5a59('0x32')](_0x3340d1)[_0x5a59('0x22')](function(_0x342d23){_0x2fc04f[_0x5a59('0x32')]=_0x342d23;if(_0x2c8493[_0x5a59('0x44')][_0x5a59('0x52')]){_0x34e28a[_0x5a59('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x5a59('0x54')](_0x34e28a);})[_0x5a59('0x22')](function(_0x449818){_0x2fc04f[_0x5a59('0x55')]=_0x449818;return _0x2fc04f;})[_0x5a59('0x22')](respondWithFilteredResult(_0x42043e,_0x34e28a))[_0x5a59('0x56')](handleError(_0x42043e,null));};exports[_0x5a59('0x57')]=function(_0x54cd2f,_0x43e67){var _0x4177d7={'raw':!![],'where':{'id':_0x54cd2f['params']['id']}},_0x568a95={};_0x568a95[_0x5a59('0x43')]=_[_0x5a59('0x45')](db[_0x5a59('0x3e')]['rawAttributes']);_0x568a95[_0x5a59('0x44')]=_[_0x5a59('0x45')](_0x54cd2f['query']);_0x568a95[_0x5a59('0x46')]=_[_0x5a59('0x48')](_0x568a95[_0x5a59('0x43')],_0x568a95[_0x5a59('0x44')]);_0x4177d7[_0x5a59('0x47')]=_[_0x5a59('0x48')](_0x568a95[_0x5a59('0x43')],qs['fields'](_0x54cd2f['query'][_0x5a59('0x49')]));_0x4177d7[_0x5a59('0x47')]=_0x4177d7[_0x5a59('0x47')][_0x5a59('0x4a')]?_0x4177d7[_0x5a59('0x47')]:_0x568a95[_0x5a59('0x43')];if(_0x54cd2f[_0x5a59('0x44')][_0x5a59('0x52')]){_0x4177d7[_0x5a59('0x53')]=[{'all':!![]}];}_0x4177d7=_['merge']({},_0x4177d7,_0x54cd2f[_0x5a59('0x58')]);return db[_0x5a59('0x3e')][_0x5a59('0x59')](_0x4177d7)[_0x5a59('0x22')](handleEntityNotFound(_0x43e67,null))['then'](respondWithResult(_0x43e67,null))[_0x5a59('0x56')](handleError(_0x43e67,null));};exports['create']=function(_0x30c9a0,_0x454149){return db[_0x5a59('0x3e')][_0x5a59('0x5a')](_0x30c9a0['body'],{})['then'](respondWithResult(_0x454149,0xc9))['catch'](handleError(_0x454149,null));};exports[_0x5a59('0x36')]=function(_0x4b3b24,_0xbeeffc){if(_0x4b3b24[_0x5a59('0x5b')]['id']){delete _0x4b3b24[_0x5a59('0x5b')]['id'];}return db[_0x5a59('0x3e')][_0x5a59('0x59')]({'where':{'id':_0x4b3b24[_0x5a59('0x5c')]['id']}})[_0x5a59('0x22')](handleEntityNotFound(_0xbeeffc,null))[_0x5a59('0x22')](saveUpdates(_0x4b3b24[_0x5a59('0x5b')],null))[_0x5a59('0x22')](respondWithResult(_0xbeeffc,null))[_0x5a59('0x56')](handleError(_0xbeeffc,null));};exports[_0x5a59('0x37')]=function(_0x1676a8,_0x4352e4){return db[_0x5a59('0x3e')][_0x5a59('0x59')]({'where':{'id':_0x1676a8[_0x5a59('0x5c')]['id']}})[_0x5a59('0x22')](handleEntityNotFound(_0x4352e4,null))[_0x5a59('0x22')](removeEntity(_0x4352e4,null))[_0x5a59('0x56')](handleError(_0x4352e4,null));};exports[_0x5a59('0x5d')]=function(_0x49838e,_0xb96353){return db[_0x5a59('0x3e')][_0x5a59('0x5d')]()[_0x5a59('0x22')](respondWithResult(_0xb96353,null))[_0x5a59('0x56')](handleError(_0xb96353,null));};var interaction_log=require(_0x5a59('0x15'))(_0x5a59('0x5e'));exports[_0x5a59('0x5f')]=function(_0x3024ff,_0x439e46,_0x24f6e7){var _0x102ff2={'agent':{},'channel':_0x5a59('0x60')};if(_0x3024ff[_0x5a59('0x5b')]['id']){delete _0x3024ff[_0x5a59('0x5b')]['id'];}_0x3024ff[_0x5a59('0x5b')][_0x5a59('0x61')]=!![];_0x3024ff[_0x5a59('0x5b')][_0x5a59('0x62')]=moment()[_0x5a59('0x63')](_0x5a59('0x64'));_0x3024ff['body'][_0x5a59('0x65')]=_0x3024ff[_0x5a59('0x5b')][_0x5a59('0x65')]||_0x3024ff[_0x5a59('0x66')]['id'];_0x102ff2[_0x5a59('0x67')]['id']=_0x3024ff[_0x5a59('0x5b')][_0x5a59('0x65')];return db[_0x5a59('0x3e')][_0x5a59('0x59')]({'where':{'id':_0x3024ff[_0x5a59('0x5c')]['id'],'UserId':null}})[_0x5a59('0x22')](handleEntityNotFound(_0x439e46,null))[_0x5a59('0x22')](saveUpdates(_0x3024ff[_0x5a59('0x5b')],null))[_0x5a59('0x22')](function(_0x20590a){if(_0x20590a){_0x102ff2['message']=_0x20590a[_0x5a59('0x68')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x20590a[_0x5a59('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x439e46,null))[_0x5a59('0x22')](function(_0x465f62){if(_0x465f62){return _0x465f62[_0x5a59('0x36')]({'UserId':_0x3024ff[_0x5a59('0x5b')][_0x5a59('0x65')],'read1stAt':_[_0x5a59('0x6a')](_0x465f62['read1stAt'])?moment()[_0x5a59('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5a59('0x22')](function(_0x1b841d){if(_0x1b841d){_0x102ff2[_0x5a59('0x6b')]=_0x1b841d[_0x5a59('0x68')]({'plain':!![]});interaction_log[_0x5a59('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3024ff['user']['id'],_0x3024ff[_0x5a59('0x66')][_0x5a59('0x3a')],_0x3024ff[_0x5a59('0x66')][_0x5a59('0x6c')],_0x102ff2[_0x5a59('0x6b')]['id'],_0x3024ff[_0x5a59('0x5b')]?JSON[_0x5a59('0x28')](_0x3024ff[_0x5a59('0x5b')]):_0x5a59('0x6d'));return respondWithRpcPromise(_0x5a59('0x6e'),_0x5a59('0x6f'),_0x102ff2);}return null;})[_0x5a59('0x22')](function(_0x41f53c){var _0x36fcc7=_0x5a59('0x70')+_0x41f53c['message'][_0x5a59('0x71')];return db[_0x5a59('0x72')][_0x5a59('0x44')](_0x36fcc7,{'type':db['Sequelize'][_0x5a59('0x73')][_0x5a59('0x74')],'raw':!![]})[_0x5a59('0x22')](function(_0x57950c){return _0x57950c;});})[_0x5a59('0x22')](function(_0x3914ff){if(_0x3914ff){_0x102ff2[_0x5a59('0x2b')][_0x5a59('0x75')]=_0x3914ff[0x0];if(!_0x3024ff[_0x5a59('0x5b')][_0x5a59('0x65')])return;return db['User'][_0x5a59('0x59')]({'where':{'id':_0x3024ff[_0x5a59('0x5b')]['UserId'],'role':'agent'},'attributes':['id',_0x5a59('0x3a'),_0x5a59('0x76'),_0x5a59('0x77'),_0x5a59('0x78')],'raw':!![]});}return null;})['then'](function(_0xc3d02a){if(!_0xc3d02a)return null;_0x102ff2[_0x5a59('0x2b')][_0x5a59('0x67')]=_0xc3d02a;return _0x102ff2;})[_0x5a59('0x22')](function(_0x149d62){if(_0x149d62){if(_0x3024ff['body'][_0x5a59('0x79')]){_0x102ff2[_0x5a59('0x2b')]['interface']=util[_0x5a59('0x63')]('SIP/%s',_0x3024ff[_0x5a59('0x66')]['name']);_0x102ff2[_0x5a59('0x2b')][_0x5a59('0x7a')]=_0x102ff2['channel'];_0x102ff2[_0x5a59('0x2b')][_0x5a59('0x7b')]=_0x102ff2['channel'];_0x102ff2[_0x5a59('0x2b')][_0x5a59('0x7c')]=_0x5a59('0x5f');return respondWithRpcPromise(_0x5a59('0x7d'),_0x5a59('0x7d'),{'event':_0x5a59('0x7e'),'message':_0x102ff2[_0x5a59('0x2b')]},client9002)[_0x5a59('0x22')](function(){return _0x102ff2;});}return _0x102ff2;}return null;})[_0x5a59('0x22')](respondWithResult(_0x439e46,null))[_0x5a59('0x56')](handleError(_0x439e46,null));};var interaction_log=require(_0x5a59('0x15'))(_0x5a59('0x5e'));exports[_0x5a59('0x7f')]=function(_0x2d99c1,_0xdde965,_0x5ac435){var _0x42594c={'agent':{},'channel':_0x5a59('0x60')};if(_0x2d99c1[_0x5a59('0x5b')]['id']){delete _0x2d99c1[_0x5a59('0x5b')]['id'];}_0x2d99c1[_0x5a59('0x5b')][_0x5a59('0x65')]=_0x2d99c1[_0x5a59('0x5b')]['UserId']||_0x2d99c1[_0x5a59('0x66')]['id'];_0x42594c[_0x5a59('0x67')]['id']=_0x2d99c1[_0x5a59('0x5b')]['UserId'];return db['OpenchannelMessage'][_0x5a59('0x59')]({'where':{'id':_0x2d99c1[_0x5a59('0x5c')]['id'],'UserId':null}})[_0x5a59('0x22')](handleEntityNotFound(_0xdde965,null))[_0x5a59('0x22')](function(_0x5e722c){if(_0x5e722c){_0x42594c[_0x5a59('0x2b')]=_0x5e722c['get']({'plain':!![]});return db[_0x5a59('0x80')][_0x5a59('0x59')]({'where':{'id':_0x5e722c[_0x5a59('0x69')]}});}return null;})[_0x5a59('0x22')](handleEntityNotFound(_0xdde965,null))['then'](function(_0x2cee04){if(_0x2cee04){_0x42594c['interaction']=_0x2cee04['get']({'plain':!![]});interaction_log[_0x5a59('0x23')](_0x5a59('0x81'),_0x2d99c1[_0x5a59('0x66')]['id'],_0x2d99c1[_0x5a59('0x66')][_0x5a59('0x3a')],_0x2d99c1[_0x5a59('0x66')][_0x5a59('0x6c')],_0x42594c['interaction']['id'],_0x2d99c1[_0x5a59('0x5b')]?JSON[_0x5a59('0x28')](_0x2d99c1[_0x5a59('0x5b')]):'null');return respondWithRpcPromise(_0x5a59('0x82'),_0x5a59('0x83'),_0x42594c);}return null;})[_0x5a59('0x22')](function(_0x1a9743){var _0x52cad3=_0x5a59('0x70')+_0x1a9743[_0x5a59('0x2b')][_0x5a59('0x71')];return db['sequelize'][_0x5a59('0x44')](_0x52cad3,{'type':db[_0x5a59('0x84')][_0x5a59('0x73')][_0x5a59('0x74')],'raw':!![]})['then'](function(_0x3ec774){return _0x3ec774;});})['then'](function(_0x47de08){if(_0x47de08){_0x42594c['message'][_0x5a59('0x75')]=_0x47de08[0x0];if(!_0x2d99c1[_0x5a59('0x5b')]['UserId'])return;return db['User'][_0x5a59('0x59')]({'where':{'id':_0x2d99c1['body'][_0x5a59('0x65')],'role':'agent'},'attributes':['id',_0x5a59('0x3a'),'fullname',_0x5a59('0x77'),_0x5a59('0x78')],'raw':!![]});}return null;})['then'](function(_0x4ccbef){if(!_0x4ccbef)return null;_0x42594c[_0x5a59('0x2b')][_0x5a59('0x67')]=_0x4ccbef;return _0x42594c;})[_0x5a59('0x22')](function(_0x5a4836){if(_0x5a4836){_0x5a4836[_0x5a59('0x2b')]['interface']=util['format'](_0x5a59('0x85'),_0x2d99c1[_0x5a59('0x66')][_0x5a59('0x3a')]);_0x5a4836[_0x5a59('0x2b')][_0x5a59('0x7a')]=_0x42594c[_0x5a59('0x7a')];_0x5a4836[_0x5a59('0x2b')][_0x5a59('0x7b')]=_0x42594c[_0x5a59('0x7a')];_0x5a4836['message'][_0x5a59('0x7c')]=_0x5a59('0x7f');respondWithRpcPromise(_0x5a59('0x7d'),_0x5a59('0x7d'),{'event':_0x5a59('0x86'),'message':_0x5a4836[_0x5a59('0x2b')]},client9002);return _0x42594c;}return null;})[_0x5a59('0x22')](respondWithResult(_0xdde965,null))[_0x5a59('0x56')](handleError(_0xdde965,null));}; \ No newline at end of file +var _0x74c7=['ContactId','QueryTypes','email','event','rejectmessage','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','stack','name','index','map','OpenchannelMessage','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','fields','merge','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0x74c7,0x194));var _0x774c=function(_0x125218,_0x15483d){_0x125218=_0x125218-0x0;var _0x23f6e=_0x74c7[_0x125218];return _0x23f6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x774c('0x0'));var zipdir=require(_0x774c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x774c('0x2'));var moment=require(_0x774c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x774c('0x4'));var util=require(_0x774c('0x5'));var path=require(_0x774c('0x6'));var sox=require('sox');var csv=require(_0x774c('0x7'));var ejs=require(_0x774c('0x8'));var fs=require('fs');var fs_extra=require(_0x774c('0x9'));var _=require('lodash');var squel=require(_0x774c('0xa'));var crypto=require(_0x774c('0xb'));var jsforce=require(_0x774c('0xc'));var deskjs=require(_0x774c('0xd'));var toCsv=require(_0x774c('0x7'));var querystring=require(_0x774c('0xe'));var Papa=require(_0x774c('0xf'));var Redis=require(_0x774c('0x10'));var authService=require(_0x774c('0x11'));var qs=require(_0x774c('0x12'));var as=require(_0x774c('0x13'));var hardwareService=require(_0x774c('0x14'));var logger=require(_0x774c('0x15'))(_0x774c('0x16'));var utils=require(_0x774c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x774c('0x18'));var db=require('../../mysqldb')['db'];config[_0x774c('0x19')]=_[_0x774c('0x1a')](config[_0x774c('0x19')],{'host':_0x774c('0x1b'),'port':0x18eb});var socket=require(_0x774c('0x1c'))(new Redis(config[_0x774c('0x19')]));require(_0x774c('0x1d'))['register'](socket);var jayson=require(_0x774c('0x1e'));var client=jayson['client'][_0x774c('0x1f')]({'port':0x232c});var client9002=jayson[_0x774c('0x20')][_0x774c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4aa48d,_0x3ae704,_0x9c4659,_0x13b287){return new BPromise(function(_0x164e46,_0x251c44){var _0x45b42b=_0x13b287||client;return _0x45b42b[_0x774c('0x21')](_0x4aa48d,_0x9c4659)[_0x774c('0x22')](function(_0x41bbbe){logger[_0x774c('0x23')](_0x774c('0x24'),_0x3ae704,_0x774c('0x25'));logger[_0x774c('0x26')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3ae704,_0x774c('0x25'),JSON[_0x774c('0x27')](_0x41bbbe));if(_0x41bbbe['error']){if(_0x41bbbe[_0x774c('0x28')][_0x774c('0x29')]===0x1f4){logger['error'](_0x774c('0x24'),_0x3ae704,_0x41bbbe[_0x774c('0x28')][_0x774c('0x2a')]);return _0x251c44(_0x41bbbe[_0x774c('0x28')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3ae704,_0x41bbbe['error'][_0x774c('0x2a')]);return _0x164e46(_0x41bbbe['error'][_0x774c('0x2a')]);}else{logger[_0x774c('0x23')](_0x774c('0x24'),_0x3ae704,_0x774c('0x25'));_0x164e46(_0x41bbbe[_0x774c('0x2b')][_0x774c('0x2a')]);}})[_0x774c('0x2c')](function(_0x21ef49){logger['error'](_0x774c('0x24'),_0x3ae704,_0x21ef49);_0x251c44(_0x21ef49);});});}function respondWithStatusCode(_0x592ef3,_0x2b470c){_0x2b470c=_0x2b470c||0xcc;return function(_0x2d853a){if(_0x2d853a){return _0x592ef3[_0x774c('0x2d')](_0x2b470c);}return _0x592ef3[_0x774c('0x2e')](_0x2b470c)[_0x774c('0x2f')]();};}function respondWithResult(_0x521ef5,_0x53b0de){_0x53b0de=_0x53b0de||0xc8;return function(_0x58eed8){if(_0x58eed8){return _0x521ef5[_0x774c('0x2e')](_0x53b0de)['json'](_0x58eed8);}};}function respondWithFilteredResult(_0x5cd8a9,_0xa17989){return function(_0x290fc8){if(_0x290fc8){var _0x4b4e5a=typeof _0xa17989[_0x774c('0x30')]===_0x774c('0x31')&&typeof _0xa17989['limit']===_0x774c('0x31');var _0x1331c4=_0x290fc8[_0x774c('0x32')];var _0x3ce800=_0x4b4e5a?0x0:_0xa17989[_0x774c('0x30')];var _0x5838da=_0x4b4e5a?_0x290fc8[_0x774c('0x32')]:_0xa17989[_0x774c('0x30')]+_0xa17989[_0x774c('0x33')];var _0x5ea01c;if(_0x5838da>=_0x1331c4){_0x5838da=_0x1331c4;_0x5ea01c=0xc8;}else{_0x5ea01c=0xce;}_0x5cd8a9[_0x774c('0x2e')](_0x5ea01c);return _0x5cd8a9[_0x774c('0x34')](_0x774c('0x35'),_0x3ce800+'-'+_0x5838da+'/'+_0x1331c4)['json'](_0x290fc8);}return null;};}function patchUpdates(_0x4045c1){return function(_0xf9e4a6){try{jsonpatch['apply'](_0xf9e4a6,_0x4045c1,!![]);}catch(_0x56d6ee){return BPromise[_0x774c('0x36')](_0x56d6ee);}return _0xf9e4a6['save']();};}function saveUpdates(_0x315319,_0x25fd41){return function(_0x21eda6){if(_0x21eda6){return _0x21eda6[_0x774c('0x37')](_0x315319)['then'](function(_0x314347){return _0x314347;});}return null;};}function removeEntity(_0x56c305,_0x3bd587){return function(_0x574ce7){if(_0x574ce7){return _0x574ce7[_0x774c('0x38')]()['then'](function(){_0x56c305[_0x774c('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a85b1,_0xdd90e6){return function(_0x41ccdd){if(!_0x41ccdd){_0x1a85b1['sendStatus'](0x194);}return _0x41ccdd;};}function handleError(_0x4433f4,_0x355c5c){_0x355c5c=_0x355c5c||0x1f4;return function(_0x34bc91){logger[_0x774c('0x28')](_0x34bc91[_0x774c('0x39')]);if(_0x34bc91[_0x774c('0x3a')]){delete _0x34bc91['name'];}_0x4433f4[_0x774c('0x2e')](_0x355c5c)['send'](_0x34bc91);};}exports[_0x774c('0x3b')]=function(_0x29a8c9,_0x32b583){var _0x3c47be={},_0x12e11b={},_0x55f17b={'count':0x0,'rows':[]};var _0x15cd3d=_[_0x774c('0x3c')](db[_0x774c('0x3d')]['rawAttributes'],function(_0x31750b){return{'name':_0x31750b[_0x774c('0x3e')],'type':_0x31750b['type'][_0x774c('0x3f')]};});_0x12e11b[_0x774c('0x40')]=_[_0x774c('0x3c')](_0x15cd3d,_0x774c('0x3a'));_0x12e11b[_0x774c('0x41')]=_['keys'](_0x29a8c9['query']);_0x12e11b[_0x774c('0x42')]=_['intersection'](_0x12e11b[_0x774c('0x40')],_0x12e11b[_0x774c('0x41')]);_0x3c47be['attributes']=_[_0x774c('0x43')](_0x12e11b[_0x774c('0x40')],qs['fields'](_0x29a8c9[_0x774c('0x41')]['fields']));_0x3c47be[_0x774c('0x44')]=_0x3c47be[_0x774c('0x44')]['length']?_0x3c47be['attributes']:_0x12e11b[_0x774c('0x40')];if(!_0x29a8c9[_0x774c('0x41')][_0x774c('0x45')]('nolimit')){_0x3c47be[_0x774c('0x33')]=qs[_0x774c('0x33')](_0x29a8c9[_0x774c('0x41')]['limit']);_0x3c47be[_0x774c('0x30')]=qs['offset'](_0x29a8c9[_0x774c('0x41')][_0x774c('0x30')]);}_0x3c47be['order']=qs[_0x774c('0x46')](_0x29a8c9[_0x774c('0x41')][_0x774c('0x46')]);_0x3c47be[_0x774c('0x47')]=qs[_0x774c('0x42')](_[_0x774c('0x48')](_0x29a8c9[_0x774c('0x41')],_0x12e11b[_0x774c('0x42')]),_0x15cd3d);if(_0x29a8c9['query'][_0x774c('0x49')]){_0x3c47be['where']=_['merge'](_0x3c47be[_0x774c('0x47')],{'$or':_[_0x774c('0x3c')](_0x15cd3d,function(_0x49880f){if(_0x49880f[_0x774c('0x4a')]!==_0x774c('0x4b')){var _0x3c7363={};_0x3c7363[_0x49880f[_0x774c('0x3a')]]={'$like':'%'+_0x29a8c9[_0x774c('0x41')][_0x774c('0x49')]+'%'};return _0x3c7363;}})});}_0x3c47be=_['merge']({},_0x3c47be,_0x29a8c9[_0x774c('0x4c')]);var _0x3df317={'where':_0x3c47be[_0x774c('0x47')]};return db[_0x774c('0x3d')]['count'](_0x3df317)[_0x774c('0x22')](function(_0x305492){_0x55f17b[_0x774c('0x32')]=_0x305492;if(_0x29a8c9[_0x774c('0x41')][_0x774c('0x4d')]){_0x3c47be[_0x774c('0x4e')]=[{'all':!![]}];}return db[_0x774c('0x3d')][_0x774c('0x4f')](_0x3c47be);})[_0x774c('0x22')](function(_0x51a7e4){_0x55f17b[_0x774c('0x50')]=_0x51a7e4;return _0x55f17b;})[_0x774c('0x22')](respondWithFilteredResult(_0x32b583,_0x3c47be))['catch'](handleError(_0x32b583,null));};exports[_0x774c('0x51')]=function(_0x22f957,_0x3122e7){var _0x1bac06={'raw':!![],'where':{'id':_0x22f957[_0x774c('0x52')]['id']}},_0x4bb440={};_0x4bb440[_0x774c('0x40')]=_[_0x774c('0x53')](db['OpenchannelMessage'][_0x774c('0x54')]);_0x4bb440['query']=_[_0x774c('0x53')](_0x22f957[_0x774c('0x41')]);_0x4bb440[_0x774c('0x42')]=_[_0x774c('0x43')](_0x4bb440[_0x774c('0x40')],_0x4bb440[_0x774c('0x41')]);_0x1bac06[_0x774c('0x44')]=_[_0x774c('0x43')](_0x4bb440['model'],qs['fields'](_0x22f957[_0x774c('0x41')][_0x774c('0x55')]));_0x1bac06[_0x774c('0x44')]=_0x1bac06[_0x774c('0x44')]['length']?_0x1bac06['attributes']:_0x4bb440[_0x774c('0x40')];if(_0x22f957[_0x774c('0x41')][_0x774c('0x4d')]){_0x1bac06['include']=[{'all':!![]}];}_0x1bac06=_[_0x774c('0x56')]({},_0x1bac06,_0x22f957[_0x774c('0x4c')]);return db[_0x774c('0x3d')][_0x774c('0x57')](_0x1bac06)[_0x774c('0x22')](handleEntityNotFound(_0x3122e7,null))[_0x774c('0x22')](respondWithResult(_0x3122e7,null))[_0x774c('0x2c')](handleError(_0x3122e7,null));};exports['create']=function(_0x5e6bb7,_0x489e1d){return db[_0x774c('0x3d')][_0x774c('0x58')](_0x5e6bb7[_0x774c('0x59')],{})['then'](respondWithResult(_0x489e1d,0xc9))[_0x774c('0x2c')](handleError(_0x489e1d,null));};exports['update']=function(_0x56cc06,_0x15f956){if(_0x56cc06[_0x774c('0x59')]['id']){delete _0x56cc06[_0x774c('0x59')]['id'];}return db[_0x774c('0x3d')]['find']({'where':{'id':_0x56cc06[_0x774c('0x52')]['id']}})[_0x774c('0x22')](handleEntityNotFound(_0x15f956,null))[_0x774c('0x22')](saveUpdates(_0x56cc06[_0x774c('0x59')],null))[_0x774c('0x22')](respondWithResult(_0x15f956,null))[_0x774c('0x2c')](handleError(_0x15f956,null));};exports[_0x774c('0x38')]=function(_0x24a7ae,_0x2ca1a0){return db['OpenchannelMessage']['find']({'where':{'id':_0x24a7ae[_0x774c('0x52')]['id']}})['then'](handleEntityNotFound(_0x2ca1a0,null))['then'](removeEntity(_0x2ca1a0,null))['catch'](handleError(_0x2ca1a0,null));};exports['describe']=function(_0x28a2fe,_0x35eec9){return db[_0x774c('0x3d')][_0x774c('0x5a')]()[_0x774c('0x22')](respondWithResult(_0x35eec9,null))[_0x774c('0x2c')](handleError(_0x35eec9,null));};var interaction_log=require(_0x774c('0x15'))(_0x774c('0x5b'));exports[_0x774c('0x5c')]=function(_0x5b2fc1,_0x2fc44e,_0x25a28a){var _0x16f19e={'agent':{},'channel':_0x774c('0x5d')};if(_0x5b2fc1[_0x774c('0x59')]['id']){delete _0x5b2fc1[_0x774c('0x59')]['id'];}_0x5b2fc1['body'][_0x774c('0x5e')]=!![];_0x5b2fc1['body'][_0x774c('0x5f')]=moment()[_0x774c('0x60')](_0x774c('0x61'));_0x5b2fc1[_0x774c('0x59')][_0x774c('0x62')]=_0x5b2fc1[_0x774c('0x59')]['UserId']||_0x5b2fc1[_0x774c('0x63')]['id'];_0x16f19e[_0x774c('0x64')]['id']=_0x5b2fc1[_0x774c('0x59')][_0x774c('0x62')];return db[_0x774c('0x3d')][_0x774c('0x57')]({'where':{'id':_0x5b2fc1['params']['id'],'UserId':null}})[_0x774c('0x22')](handleEntityNotFound(_0x2fc44e,null))['then'](saveUpdates(_0x5b2fc1[_0x774c('0x59')],null))[_0x774c('0x22')](function(_0xa1e605){if(_0xa1e605){_0x16f19e[_0x774c('0x2a')]=_0xa1e605[_0x774c('0x65')]({'plain':!![]});return db[_0x774c('0x66')][_0x774c('0x57')]({'where':{'id':_0xa1e605[_0x774c('0x67')]}});}return null;})[_0x774c('0x22')](handleEntityNotFound(_0x2fc44e,null))[_0x774c('0x22')](function(_0x4e806c){if(_0x4e806c){return _0x4e806c[_0x774c('0x37')]({'UserId':_0x5b2fc1[_0x774c('0x59')][_0x774c('0x62')],'read1stAt':_[_0x774c('0x68')](_0x4e806c[_0x774c('0x69')])?moment()['format'](_0x774c('0x61')):undefined});}return null;})[_0x774c('0x22')](function(_0x5696a0){if(_0x5696a0){_0x16f19e[_0x774c('0x6a')]=_0x5696a0[_0x774c('0x65')]({'plain':!![]});interaction_log[_0x774c('0x23')](_0x774c('0x6b'),_0x5b2fc1[_0x774c('0x63')]['id'],_0x5b2fc1[_0x774c('0x63')][_0x774c('0x3a')],_0x5b2fc1['user'][_0x774c('0x6c')],_0x16f19e[_0x774c('0x6a')]['id'],_0x5b2fc1['body']?JSON[_0x774c('0x27')](_0x5b2fc1[_0x774c('0x59')]):_0x774c('0x6d'));return respondWithRpcPromise(_0x774c('0x6e'),_0x774c('0x6f'),_0x16f19e);}return null;})[_0x774c('0x22')](function(_0xf7f5cb){var _0x1d2132='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xf7f5cb[_0x774c('0x2a')]['ContactId'];return db[_0x774c('0x70')]['query'](_0x1d2132,{'type':db[_0x774c('0x71')]['QueryTypes'][_0x774c('0x72')],'raw':!![]})[_0x774c('0x22')](function(_0x5645c2){return _0x5645c2;});})[_0x774c('0x22')](function(_0x5b379a){if(_0x5b379a){_0x16f19e[_0x774c('0x2a')][_0x774c('0x73')]=_0x5b379a[0x0];if(!_0x5b2fc1[_0x774c('0x59')][_0x774c('0x62')])return;return db[_0x774c('0x74')][_0x774c('0x57')]({'where':{'id':_0x5b2fc1[_0x774c('0x59')]['UserId'],'role':_0x774c('0x64')},'attributes':['id','name',_0x774c('0x75'),'email',_0x774c('0x76')],'raw':!![]});}return null;})[_0x774c('0x22')](function(_0x341e92){if(!_0x341e92)return null;_0x16f19e[_0x774c('0x2a')][_0x774c('0x64')]=_0x341e92;return _0x16f19e;})['then'](function(_0x3f2408){if(_0x3f2408){if(_0x5b2fc1[_0x774c('0x59')][_0x774c('0x77')]){_0x16f19e[_0x774c('0x2a')][_0x774c('0x78')]=util[_0x774c('0x60')](_0x774c('0x79'),_0x5b2fc1[_0x774c('0x63')][_0x774c('0x3a')]);_0x16f19e['message'][_0x774c('0x7a')]=_0x16f19e['channel'];_0x16f19e[_0x774c('0x2a')][_0x774c('0x7b')]=_0x16f19e['channel'];_0x16f19e[_0x774c('0x2a')]['event']='accept';return respondWithRpcPromise(_0x774c('0x7c'),_0x774c('0x7c'),{'event':_0x774c('0x7d'),'message':_0x16f19e[_0x774c('0x2a')]},client9002)[_0x774c('0x22')](function(){return _0x16f19e;});}return _0x16f19e;}return null;})[_0x774c('0x22')](respondWithResult(_0x2fc44e,null))['catch'](handleError(_0x2fc44e,null));};var interaction_log=require(_0x774c('0x15'))(_0x774c('0x5b'));exports[_0x774c('0x36')]=function(_0x57d5d3,_0x15bf47,_0xe8c5ac){var _0x369703={'agent':{},'channel':_0x774c('0x5d')};if(_0x57d5d3['body']['id']){delete _0x57d5d3['body']['id'];}_0x57d5d3[_0x774c('0x59')][_0x774c('0x62')]=_0x57d5d3['body'][_0x774c('0x62')]||_0x57d5d3[_0x774c('0x63')]['id'];_0x369703[_0x774c('0x64')]['id']=_0x57d5d3['body'][_0x774c('0x62')];return db[_0x774c('0x3d')][_0x774c('0x57')]({'where':{'id':_0x57d5d3[_0x774c('0x52')]['id'],'UserId':null}})[_0x774c('0x22')](handleEntityNotFound(_0x15bf47,null))['then'](function(_0x2af9f9){if(_0x2af9f9){_0x369703[_0x774c('0x2a')]=_0x2af9f9[_0x774c('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0x774c('0x57')]({'where':{'id':_0x2af9f9['OpenchannelInteractionId']}});}return null;})[_0x774c('0x22')](handleEntityNotFound(_0x15bf47,null))['then'](function(_0x1a329f){if(_0x1a329f){_0x369703[_0x774c('0x6a')]=_0x1a329f[_0x774c('0x65')]({'plain':!![]});interaction_log['info'](_0x774c('0x7e'),_0x57d5d3['user']['id'],_0x57d5d3[_0x774c('0x63')]['name'],_0x57d5d3[_0x774c('0x63')][_0x774c('0x6c')],_0x369703[_0x774c('0x6a')]['id'],_0x57d5d3[_0x774c('0x59')]?JSON[_0x774c('0x27')](_0x57d5d3[_0x774c('0x59')]):_0x774c('0x6d'));return respondWithRpcPromise(_0x774c('0x7f'),'rejectMessage',_0x369703);}return null;})[_0x774c('0x22')](function(_0x12ab81){var _0x1a66a8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x12ab81[_0x774c('0x2a')][_0x774c('0x80')];return db[_0x774c('0x70')][_0x774c('0x41')](_0x1a66a8,{'type':db[_0x774c('0x71')][_0x774c('0x81')][_0x774c('0x72')],'raw':!![]})[_0x774c('0x22')](function(_0x323c26){return _0x323c26;});})['then'](function(_0x4aa8c2){if(_0x4aa8c2){_0x369703[_0x774c('0x2a')][_0x774c('0x73')]=_0x4aa8c2[0x0];if(!_0x57d5d3['body'][_0x774c('0x62')])return;return db[_0x774c('0x74')]['find']({'where':{'id':_0x57d5d3[_0x774c('0x59')][_0x774c('0x62')],'role':_0x774c('0x64')},'attributes':['id','name',_0x774c('0x75'),_0x774c('0x82'),_0x774c('0x76')],'raw':!![]});}return null;})[_0x774c('0x22')](function(_0x4e9e22){if(!_0x4e9e22)return null;_0x369703['message'][_0x774c('0x64')]=_0x4e9e22;return _0x369703;})[_0x774c('0x22')](function(_0xe697aa){if(_0xe697aa){_0xe697aa[_0x774c('0x2a')][_0x774c('0x78')]=util[_0x774c('0x60')](_0x774c('0x79'),_0x57d5d3[_0x774c('0x63')][_0x774c('0x3a')]);_0xe697aa[_0x774c('0x2a')][_0x774c('0x7a')]=_0x369703[_0x774c('0x7a')];_0xe697aa['message'][_0x774c('0x7b')]=_0x369703[_0x774c('0x7a')];_0xe697aa['message'][_0x774c('0x83')]=_0x774c('0x36');respondWithRpcPromise('EventManager',_0x774c('0x7c'),{'event':_0x774c('0x84'),'message':_0xe697aa[_0x774c('0x2a')]},client9002);return _0x369703;}return null;})[_0x774c('0x22')](respondWithResult(_0x15bf47,null))[_0x774c('0x2c')](handleError(_0x15bf47,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b2801ea..5dcd57d 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc7a=['update','emit','hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','save'];(function(_0x585cc3,_0x2362ed){var _0x5c59e8=function(_0x5c57d2){while(--_0x5c57d2){_0x585cc3['push'](_0x585cc3['shift']());}};_0x5c59e8(++_0x2362ed);}(_0xcc7a,0x7c));var _0xacc7=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0xcc7a[_0xf26d40];return _0x50b68c;};'use strict';var EventEmitter=require(_0xacc7('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xacc7('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xacc7('0x2')](0x0);var events={'afterCreate':_0xacc7('0x3'),'afterUpdate':_0xacc7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x10dc1e){return function(_0x39570b,_0x4d9e32,_0x945453){OpenchannelMessageEvents[_0xacc7('0x5')](_0x10dc1e+':'+_0x39570b['id'],_0x39570b);OpenchannelMessageEvents[_0xacc7('0x5')](_0x10dc1e,_0x39570b);_0x945453(null);};}for(var e in events){if(events[_0xacc7('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xacc7('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xa158=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x52e201,_0x5842e0){var _0x4f3b2e=function(_0x3d2af5){while(--_0x3d2af5){_0x52e201['push'](_0x52e201['shift']());}};_0x4f3b2e(++_0x5842e0);}(_0xa158,0x115));var _0x8a15=function(_0x5b8902,_0x28bf9b){_0x5b8902=_0x5b8902-0x0;var _0x553ad2=_0xa158[_0x5b8902];return _0x553ad2;};'use strict';var EventEmitter=require(_0x8a15('0x0'));var OpenchannelMessage=require(_0x8a15('0x1'))['db'][_0x8a15('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8a15('0x3')](0x0);var events={'afterCreate':_0x8a15('0x4'),'afterUpdate':'update','afterDestroy':_0x8a15('0x5')};function emitEvent(_0x44aa71){return function(_0x8cfb4e,_0x45a8d8,_0x22d0de){OpenchannelMessageEvents[_0x8a15('0x6')](_0x44aa71+':'+_0x8cfb4e['id'],_0x8cfb4e);OpenchannelMessageEvents[_0x8a15('0x6')](_0x44aa71,_0x8cfb4e);_0x22d0de(null);};}for(var e in events){if(events[_0x8a15('0x7')](e)){var event=events[e];OpenchannelMessage[_0x8a15('0x8')](e,emitEvent(event));}}module[_0x8a15('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index aa9f03a..b13b50d 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f43=['fti_openchannel_messages','body','models','get','direction','toLowerCase','out','isNil','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','exports','define','openchannel_messages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f43,0x1ca));var _0x35f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35f4('0x0'));var util=require(_0x35f4('0x1'));var logger=require(_0x35f4('0x2'))('api');var moment=require(_0x35f4('0x3'));var BPromise=require(_0x35f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35f4('0x5'));var rimraf=require(_0x35f4('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x35f4('0x7')]=function(_0x17eae7,_0x4dc6c7){return _0x17eae7[_0x35f4('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x35f4('0x9'),'paranoid':![],'indexes':[{'name':_0x35f4('0xa'),'fields':[_0x35f4('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47b0a7,_0x55813e,_0x1bc54d){var _0xb5ce1b=_0x17eae7[_0x35f4('0xc')];var _0x47c263=_0x47b0a7[_0x35f4('0xd')]({'plain':!![]});if(_0x47c263[_0x35f4('0xe')][_0x35f4('0xf')]()==='in'||_0x47c263[_0x35f4('0xe')][_0x35f4('0xf')]()===_0x35f4('0x10')&&!_0x47c263['secret']&&!_[_0x35f4('0x11')](_0x47c263['UserId'])){_0xb5ce1b['OpenchannelInteraction'][_0x35f4('0x12')]({'where':{'id':_0x47c263[_0x35f4('0x13')]}})[_0x35f4('0x14')](function(_0x281c7e){if(_0x281c7e){_0x281c7e[_0x35f4('0x15')]({'lastMsgAt':_0x47c263[_0x35f4('0x16')],'lastMsgDirection':_0x47c263[_0x35f4('0xe')][_0x35f4('0xf')]()});}})[_0x35f4('0x17')](function(_0x4eba3a){console[_0x35f4('0x18')](_0x4eba3a);});}if(_0x47c263[_0x35f4('0xe')]===_0x35f4('0x10')&&!_0x47c263[_0x35f4('0x19')]){var _0x7ca811;_0xb5ce1b[_0x35f4('0x1a')][_0x35f4('0x1b')]()['then'](function(_0x5051d7){return _0xb5ce1b[_0x35f4('0x1c')][_0x35f4('0x1d')]({'where':{'id':_0x47c263[_0x35f4('0x1e')]},'include':[{'model':_0xb5ce1b[_0x35f4('0x1f')],'as':_0x35f4('0x20'),'where':{'id':_0x47c263['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xb5ce1b[_0x35f4('0x1a')],'as':_0x35f4('0x21'),'attributes':_[_0x35f4('0x22')](_0x5051d7)}]}]});})['then'](function(_0x12cafd){_0x7ca811=_0x12cafd[_0x35f4('0xd')]({'plain':!![]});if(_0x7ca811&&_0x7ca811[_0x35f4('0x23')]){logger[_0x35f4('0x24')](_0x35f4('0x25'),_0x35f4('0x26'),util['format'](_0x35f4('0x27'),_0x47c263['id'],_0x7ca811[_0x35f4('0x23')]));if(_0x7ca811['Interactions']&&_0x7ca811['Interactions'][_0x35f4('0x28')]){_0x47c263[_0x35f4('0x29')]=_[_0x35f4('0x2a')](_0x7ca811[_0x35f4('0x20')][0x0],_0x35f4('0x21'));_0x47c263[_0x35f4('0x21')]=_0x7ca811[_0x35f4('0x20')][0x0][_0x35f4('0x21')];}var _0x55813e={'method':_0x35f4('0x2b'),'uri':encodeURI(_0x7ca811['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x55813e[_0x35f4('0x2c')]){case'GET':_0x55813e['qs']=_0x47c263;break;case _0x35f4('0x2b'):_0x55813e[_0x35f4('0xb')]=_0x47c263;break;}return rp(_0x55813e)[_0x35f4('0x14')](function(_0x5257a7){logger[_0x35f4('0x24')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x35f4('0x2d')](_0x35f4('0x2e'),_0x47c263['id'],_0x7ca811['replyUri']));if(_0x5257a7[_0x35f4('0xb')][_0x35f4('0x2f')]&&_0x5257a7[_0x35f4('0xb')][_0x35f4('0x2f')]!=_0x47c263['Interaction'][_0x35f4('0x2f')]){return _0xb5ce1b[_0x35f4('0x1f')][_0x35f4('0x15')]({'threadId':_0x5257a7['body']['threadId']},{'where':{'id':_0x47c263[_0x35f4('0x29')]['id']}});}else{return;}})[_0x35f4('0x14')](function(){return _0x47b0a7[_0x35f4('0x15')]({'read':!![]});})[_0x35f4('0x17')](function(_0x560142){logger[_0x35f4('0x18')](_0x35f4('0x25'),_0x35f4('0x26'),util[_0x35f4('0x30')](_0x560142,{'showHidden':![],'depth':null}));_0x1bc54d();});}else{_0x1bc54d();}})[_0x35f4('0x31')](function(){_0x1bc54d();});}else{_0x1bc54d();}}},'charset':_0x35f4('0x32'),'collate':_0x35f4('0x33')});}; \ No newline at end of file +var _0x8677=['rimraf','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','method','POST','body','format','threadId','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x8677,0xc9));var _0x7867=function(_0x26606f,_0x4a17a0){_0x26606f=_0x26606f-0x0;var _0x3ff4a0=_0x8677[_0x26606f];return _0x3ff4a0;};'use strict';var _=require(_0x7867('0x0'));var util=require(_0x7867('0x1'));var logger=require(_0x7867('0x2'))(_0x7867('0x3'));var moment=require(_0x7867('0x4'));var BPromise=require('bluebird');var rp=require(_0x7867('0x5'));var fs=require('fs');var path=require(_0x7867('0x6'));var rimraf=require(_0x7867('0x7'));var config=require('../../config/environment');var attributes=require(_0x7867('0x8'));module['exports']=function(_0x2ac2a1,_0x12cf48){return _0x2ac2a1[_0x7867('0x9')](_0x7867('0xa'),attributes,{'tableName':_0x7867('0xb'),'paranoid':![],'indexes':[{'name':_0x7867('0xc'),'fields':['body'],'type':_0x7867('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54f67a,_0x454b37,_0x1d779b){var _0x1103e3=_0x2ac2a1[_0x7867('0xe')];var _0x10477a=_0x54f67a[_0x7867('0xf')]({'plain':!![]});if(_0x10477a[_0x7867('0x10')]['toLowerCase']()==='in'||_0x10477a[_0x7867('0x10')][_0x7867('0x11')]()===_0x7867('0x12')&&!_0x10477a[_0x7867('0x13')]&&!_[_0x7867('0x14')](_0x10477a['UserId'])){_0x1103e3[_0x7867('0x15')][_0x7867('0x16')]({'where':{'id':_0x10477a[_0x7867('0x17')]}})[_0x7867('0x18')](function(_0x1fcfe6){if(_0x1fcfe6){_0x1fcfe6[_0x7867('0x19')]({'lastMsgAt':_0x10477a[_0x7867('0x1a')],'lastMsgDirection':_0x10477a[_0x7867('0x10')][_0x7867('0x11')]()});}})[_0x7867('0x1b')](function(_0x57e668){console[_0x7867('0x1c')](_0x57e668);});}if(_0x10477a[_0x7867('0x10')]===_0x7867('0x12')&&!_0x10477a['secret']){var _0x40ca9d;_0x1103e3[_0x7867('0x1d')][_0x7867('0x1e')]()[_0x7867('0x18')](function(_0x13d963){return _0x1103e3[_0x7867('0x1f')][_0x7867('0x20')]({'where':{'id':_0x10477a['OpenchannelAccountId']},'include':[{'model':_0x1103e3[_0x7867('0x15')],'as':_0x7867('0x21'),'where':{'id':_0x10477a[_0x7867('0x17')]},'limit':0x1,'include':[{'model':_0x1103e3[_0x7867('0x1d')],'as':_0x7867('0x22'),'attributes':_[_0x7867('0x23')](_0x13d963)}]}]});})[_0x7867('0x18')](function(_0x36caf6){_0x40ca9d=_0x36caf6[_0x7867('0xf')]({'plain':!![]});if(_0x40ca9d&&_0x40ca9d['replyUri']){logger[_0x7867('0x24')](_0x7867('0x25'),_0x7867('0x26'),util['format'](_0x7867('0x27'),_0x10477a['id'],_0x40ca9d[_0x7867('0x28')]));if(_0x40ca9d[_0x7867('0x21')]&&_0x40ca9d[_0x7867('0x21')][_0x7867('0x29')]){_0x10477a[_0x7867('0x2a')]=_[_0x7867('0x2b')](_0x40ca9d[_0x7867('0x21')][0x0],_0x7867('0x22'));_0x10477a['Contact']=_0x40ca9d['Interactions'][0x0][_0x7867('0x22')];}var _0x454b37={'method':'POST','uri':encodeURI(_0x40ca9d['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x454b37[_0x7867('0x2c')]){case'GET':_0x454b37['qs']=_0x10477a;break;case _0x7867('0x2d'):_0x454b37[_0x7867('0x2e')]=_0x10477a;break;}return rp(_0x454b37)['then'](function(_0x351d92){logger['info'](_0x7867('0x25'),_0x7867('0x26'),util[_0x7867('0x2f')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x10477a['id'],_0x40ca9d['replyUri']));if(_0x351d92[_0x7867('0x2e')][_0x7867('0x30')]&&_0x351d92['body'][_0x7867('0x30')]!=_0x10477a[_0x7867('0x2a')][_0x7867('0x30')]){return _0x1103e3[_0x7867('0x15')][_0x7867('0x19')]({'threadId':_0x351d92[_0x7867('0x2e')]['threadId']},{'where':{'id':_0x10477a['Interaction']['id']}});}else{return;}})[_0x7867('0x18')](function(){return _0x54f67a[_0x7867('0x19')]({'read':!![]});})[_0x7867('0x1b')](function(_0x1c8c40){logger[_0x7867('0x1c')](_0x7867('0x25'),_0x7867('0x26'),util['inspect'](_0x1c8c40,{'showHidden':![],'depth':null}));_0x1d779b();});}else{_0x1d779b();}})[_0x7867('0x31')](function(){_0x1d779b();});}else{_0x1d779b();}}},'charset':_0x7867('0x32'),'collate':_0x7867('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 164fd0f..9362fad 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1047c4,_0x237308){var _0x2d6517=function(_0x30a8cf){while(--_0x30a8cf){_0x1047c4['push'](_0x1047c4['shift']());}};_0x2d6517(++_0x237308);}(_0x7a54,0x106));var _0x47a5=function(_0xf47445,_0x28817a){_0xf47445=_0xf47445-0x0;var _0x3ec72e=_0x7a54[_0xf47445];return _0x3ec72e;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x21c195,_0x1e7d81){var _0x42f7c0=function(_0x465365){while(--_0x465365){_0x21c195['push'](_0x21c195['shift']());}};_0x42f7c0(++_0x1e7d81);}(_0xadb5,0xad));var _0x5adb=function(_0x19b98f,_0x36fffa){_0x19b98f=_0x19b98f-0x0;var _0x219f03=_0xadb5[_0x19b98f];return _0x219f03;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 24d1f64..2a3bb46 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca93=['removeListener','length','openchannelMessage:','./openchannelMessage.events','save','emit'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xca93,0x123));var _0x3ca9=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xca93[_0x2f5ac5];return _0x37c9a8;};'use strict';var OpenchannelMessageEvents=require(_0x3ca9('0x0'));var events=[_0x3ca9('0x1'),'remove','update'];function createListener(_0x33139a,_0x2a4cb4){return function(_0x32bf44){_0x2a4cb4[_0x3ca9('0x2')](_0x33139a,_0x32bf44);};}function removeListener(_0x20c6ee,_0x33f6c8){return function(){OpenchannelMessageEvents[_0x3ca9('0x3')](_0x20c6ee,_0x33f6c8);};}exports['register']=function(_0x1f2398){for(var _0x427b42=0x0,_0x2925dd=events[_0x3ca9('0x4')];_0x427b42<_0x2925dd;_0x427b42++){var _0x373930=events[_0x427b42];var _0x4cb4c3=createListener(_0x3ca9('0x5')+_0x373930,_0x1f2398);OpenchannelMessageEvents['on'](_0x373930,_0x4cb4c3);}}; \ No newline at end of file +var _0x4504=['length','openchannelMessage:','./openchannelMessage.events','save','update','emit','register'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4504,0xd4));var _0x4450=function(_0x581fcb,_0x40d45a){_0x581fcb=_0x581fcb-0x0;var _0x216aa4=_0x4504[_0x581fcb];return _0x216aa4;};'use strict';var OpenchannelMessageEvents=require(_0x4450('0x0'));var events=[_0x4450('0x1'),'remove',_0x4450('0x2')];function createListener(_0x11d833,_0xce64ea){return function(_0xf3c1e0){_0xce64ea[_0x4450('0x3')](_0x11d833,_0xf3c1e0);};}function removeListener(_0x576ac2,_0x558f50){return function(){OpenchannelMessageEvents['removeListener'](_0x576ac2,_0x558f50);};}exports[_0x4450('0x4')]=function(_0x368730){for(var _0x5be3c5=0x0,_0x2ba484=events[_0x4450('0x5')];_0x5be3c5<_0x2ba484;_0x5be3c5++){var _0xa9671=events[_0x5be3c5];var _0x4767b8=createListener(_0x4450('0x6')+_0xa9671,_0x368730);OpenchannelMessageEvents['on'](_0xa9671,_0x4767b8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 7a0da05..504aa1b 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4169=['index','get','/describe','isAuthenticated','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','delete','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller'];(function(_0x4de79d,_0x582d1a){var _0x5931a5=function(_0x27af7d){while(--_0x27af7d){_0x4de79d['push'](_0x4de79d['shift']());}};_0x5931a5(++_0x582d1a);}(_0x4169,0x64));var _0x9416=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4169[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x9416('0x0'));var path=require('path');var timeout=require(_0x9416('0x1'));var express=require(_0x9416('0x2'));var router=express[_0x9416('0x3')]();var fs_extra=require(_0x9416('0x4'));var auth=require(_0x9416('0x5'));var interaction=require(_0x9416('0x6'));var config=require('../../config/environment');var controller=require(_0x9416('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9416('0x8')]);router[_0x9416('0x9')](_0x9416('0xa'),auth[_0x9416('0xb')](),controller[_0x9416('0xc')]);router[_0x9416('0x9')](_0x9416('0xd'),auth[_0x9416('0xb')](),controller['show']);router[_0x9416('0x9')](_0x9416('0xe'),auth[_0x9416('0xb')](),controller['getMembers']);router[_0x9416('0x9')](_0x9416('0xf'),auth['isAuthenticated'](),controller[_0x9416('0x10')]);router['get'](_0x9416('0x11'),auth['isAuthenticated'](),controller[_0x9416('0x12')]);router['post']('/',auth[_0x9416('0xb')](),controller[_0x9416('0x13')]);router[_0x9416('0x14')](_0x9416('0xf'),auth[_0x9416('0xb')](),controller[_0x9416('0x15')]);router[_0x9416('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x9416('0x16')]);router['put'](_0x9416('0xd'),auth[_0x9416('0xb')](),controller['update']);router[_0x9416('0x17')](_0x9416('0xd'),auth[_0x9416('0xb')](),controller['destroy']);router['delete'](_0x9416('0xf'),auth[_0x9416('0xb')](),controller[_0x9416('0x18')]);router['delete'](_0x9416('0x11'),auth[_0x9416('0xb')](),controller[_0x9416('0x19')]);module[_0x9416('0x1a')]=router; \ No newline at end of file +var _0x4837=['./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','/:id/teams','addTeams','addAgents','update','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x912920,_0x2fd6ac){var _0x2a4659=function(_0x1f0e7c){while(--_0x1f0e7c){_0x912920['push'](_0x912920['shift']());}};_0x2a4659(++_0x2fd6ac);}(_0x4837,0x1f1));var _0x7483=function(_0x23ff1a,_0x8e5982){_0x23ff1a=_0x23ff1a-0x0;var _0x5e5267=_0x4837[_0x23ff1a];return _0x5e5267;};'use strict';var multer=require(_0x7483('0x0'));var util=require(_0x7483('0x1'));var path=require(_0x7483('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7483('0x3')]();var fs_extra=require(_0x7483('0x4'));var auth=require(_0x7483('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7483('0x6'));var controller=require(_0x7483('0x7'));router[_0x7483('0x8')]('/',auth[_0x7483('0x9')](),controller[_0x7483('0xa')]);router['get'](_0x7483('0xb'),auth[_0x7483('0x9')](),controller[_0x7483('0xc')]);router['get'](_0x7483('0xd'),auth[_0x7483('0x9')](),controller[_0x7483('0xe')]);router[_0x7483('0x8')](_0x7483('0xf'),auth[_0x7483('0x9')](),controller[_0x7483('0x10')]);router[_0x7483('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7483('0x11')]);router[_0x7483('0x8')](_0x7483('0x12'),auth[_0x7483('0x9')](),controller['getAgents']);router[_0x7483('0x13')]('/',auth[_0x7483('0x9')](),controller['create']);router[_0x7483('0x13')](_0x7483('0x14'),auth[_0x7483('0x9')](),controller[_0x7483('0x15')]);router[_0x7483('0x13')](_0x7483('0x12'),auth['isAuthenticated'](),controller[_0x7483('0x16')]);router['put'](_0x7483('0xd'),auth[_0x7483('0x9')](),controller[_0x7483('0x17')]);router['delete']('/:id',auth[_0x7483('0x9')](),controller[_0x7483('0x18')]);router['delete'](_0x7483('0x14'),auth['isAuthenticated'](),controller[_0x7483('0x19')]);router['delete'](_0x7483('0x12'),auth['isAuthenticated'](),controller[_0x7483('0x1a')]);module[_0x7483('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 25f9318..930f29b 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fcf=['rrmemory','beepall','roundrobin','sequelize','exports','name','ENUM'];(function(_0x555c4d,_0x577e5a){var _0x7dadaa=function(_0x1785cd){while(--_0x1785cd){_0x555c4d['push'](_0x555c4d['shift']());}};_0x7dadaa(++_0x577e5a);}(_0x8fcf,0x6c));var _0xf8fc=function(_0x456db2,_0x3f684c){_0x456db2=_0x456db2-0x0;var _0xb235bf=_0x8fcf[_0x456db2];return _0xb235bf;};'use strict';var Sequelize=require(_0xf8fc('0x0'));module[_0xf8fc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf8fc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf8fc('0x3')](_0xf8fc('0x4'),_0xf8fc('0x5'),_0xf8fc('0x6'))}}; \ No newline at end of file +var _0x15c9=['sequelize','exports','name','INTEGER','ENUM'];(function(_0x39c24c,_0x310765){var _0x2d2a0f=function(_0x57fbf5){while(--_0x57fbf5){_0x39c24c['push'](_0x39c24c['shift']());}};_0x2d2a0f(++_0x310765);}(_0x15c9,0xd7));var _0x915c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x15c9[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x915c('0x0'));module[_0x915c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x915c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x915c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x915c('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 85c3ed0..11fa1d4 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83f1=['limit','count','set','Content-Range','json','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','params','keys','query','intersection','model','attributes','fields','length','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','body','find','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','sort','filters','pick','OpenchannelQueueId','filter','merge','map','User','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','nolimit','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined'];(function(_0x36bd53,_0x36fb02){var _0x28c5df=function(_0x21d3e9){while(--_0x21d3e9){_0x36bd53['push'](_0x36bd53['shift']());}};_0x28c5df(++_0x36fb02);}(_0x83f1,0x171));var _0x183f=function(_0x4f5924,_0x5f1b22){_0x4f5924=_0x4f5924-0x0;var _0x467d77=_0x83f1[_0x4f5924];return _0x467d77;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x183f('0x0'));var squel=require(_0x183f('0x1'));var Redis=require(_0x183f('0x2'));var qs=require(_0x183f('0x3'));var logger=require(_0x183f('0x4'))(_0x183f('0x5'));var config=require(_0x183f('0x6'));var db=require(_0x183f('0x7'))['db'];config[_0x183f('0x8')]=_['defaults'](config['redis'],{'host':_0x183f('0x9'),'port':0x18eb});var socket=require(_0x183f('0xa'))(new Redis(config[_0x183f('0x8')]));require(_0x183f('0xb'))[_0x183f('0xc')](socket);function respondWithStatusCode(_0x4e9303,_0x38b49b){_0x38b49b=_0x38b49b||0xcc;return function(_0x1d0908){if(_0x1d0908){return _0x4e9303[_0x183f('0xd')](_0x38b49b);}return _0x4e9303[_0x183f('0xe')](_0x38b49b)[_0x183f('0xf')]();};}function respondWithResult(_0x54fbfa,_0xc2f384){_0xc2f384=_0xc2f384||0xc8;return function(_0x1cbfc8){if(_0x1cbfc8){return _0x54fbfa[_0x183f('0xe')](_0xc2f384)['json'](_0x1cbfc8);}};}function respondWithFilteredResult(_0x43fd52,_0x3eddb8){return function(_0x3525ec){if(_0x3525ec){var _0x2b79f0=typeof _0x3eddb8[_0x183f('0x10')]===_0x183f('0x11')&&typeof _0x3eddb8[_0x183f('0x12')]===_0x183f('0x11');var _0x404474=_0x3525ec[_0x183f('0x13')];var _0x517eea=_0x2b79f0?0x0:_0x3eddb8[_0x183f('0x10')];var _0x30e017=_0x2b79f0?_0x3525ec[_0x183f('0x13')]:_0x3eddb8[_0x183f('0x10')]+_0x3eddb8[_0x183f('0x12')];var _0x22d53e;if(_0x30e017>=_0x404474){_0x30e017=_0x404474;_0x22d53e=0xc8;}else{_0x22d53e=0xce;}_0x43fd52['status'](_0x22d53e);return _0x43fd52[_0x183f('0x14')](_0x183f('0x15'),_0x517eea+'-'+_0x30e017+'/'+_0x404474)[_0x183f('0x16')](_0x3525ec);}return null;};}function saveUpdates(_0x59ea80){return function(_0x23a62e){if(_0x23a62e){return _0x23a62e['update'](_0x59ea80)[_0x183f('0x17')](function(_0x8ee7c5){return _0x8ee7c5;});}return null;};}function removeEntity(_0x348861){return function(_0xe3381d){if(_0xe3381d){return _0xe3381d[_0x183f('0x18')]()['then'](function(){var _0x5edb2c=_0xe3381d[_0x183f('0x19')]({'plain':!![]});var _0x40d922=_0x183f('0x1a');return db[_0x183f('0x1b')][_0x183f('0x18')]({'where':{'type':_0x40d922,'resourceId':_0x5edb2c['id']}})[_0x183f('0x17')](function(){return _0xe3381d;});})[_0x183f('0x17')](function(){_0x348861['status'](0xcc)[_0x183f('0xf')]();});}};}function handleEntityNotFound(_0xb66b7a){return function(_0x10ef8c){if(!_0x10ef8c){_0xb66b7a[_0x183f('0xd')](0x194);}return _0x10ef8c;};}function handleError(_0x444af1,_0x11dc4a){_0x11dc4a=_0x11dc4a||0x1f4;return function(_0x575757){logger[_0x183f('0x1c')](_0x575757[_0x183f('0x1d')]);if(_0x575757[_0x183f('0x1e')]){delete _0x575757['name'];}_0x444af1[_0x183f('0xe')](_0x11dc4a)[_0x183f('0x1f')](_0x575757);};}exports[_0x183f('0x20')]=function(_0x5ca40b,_0x1e37b2){var _0x4cf87c={};var _0x303c67={'count':0x0,'rows':[]};var _0x426525=_['map'](db[_0x183f('0x21')][_0x183f('0x22')],function(_0x485229){return{'name':_0x485229[_0x183f('0x23')],'type':_0x485229[_0x183f('0x24')][_0x183f('0x25')]};});_0x4cf87c=qs[_0x183f('0x26')](_0x426525,_0x5ca40b);var _0x1465f4={'where':_0x4cf87c[_0x183f('0x27')]};return db['OpenchannelQueue'][_0x183f('0x13')](_0x1465f4)[_0x183f('0x17')](function(_0x17573d){_0x303c67[_0x183f('0x13')]=_0x17573d;_0x4cf87c[_0x183f('0x28')]=qs[_0x183f('0x28')](_0x5ca40b['query']);return db[_0x183f('0x21')][_0x183f('0x29')](_0x4cf87c);})[_0x183f('0x17')](function(_0x56bbfe){_0x303c67[_0x183f('0x2a')]=_0x56bbfe;return _0x303c67;})[_0x183f('0x17')](respondWithFilteredResult(_0x1e37b2,_0x4cf87c))[_0x183f('0x2b')](handleError(_0x1e37b2,null));};exports[_0x183f('0x2c')]=function(_0x575c35,_0x454eea){var _0x1c0bb0={'raw':!![],'where':{'id':_0x575c35[_0x183f('0x2d')]['id']}},_0x5f2ad7={};_0x5f2ad7['model']=_[_0x183f('0x2e')](db['OpenchannelQueue']['rawAttributes']);_0x5f2ad7[_0x183f('0x2f')]=_[_0x183f('0x2e')](_0x575c35[_0x183f('0x2f')]);_0x5f2ad7['filters']=_[_0x183f('0x30')](_0x5f2ad7[_0x183f('0x31')],_0x5f2ad7[_0x183f('0x2f')]);_0x1c0bb0[_0x183f('0x32')]=_[_0x183f('0x30')](_0x5f2ad7[_0x183f('0x31')],qs[_0x183f('0x33')](_0x575c35['query'][_0x183f('0x33')]));_0x1c0bb0[_0x183f('0x32')]=_0x1c0bb0['attributes'][_0x183f('0x34')]?_0x1c0bb0[_0x183f('0x32')]:_0x5f2ad7['model'];if(_0x575c35[_0x183f('0x2f')][_0x183f('0x35')]){_0x1c0bb0[_0x183f('0x28')]=[{'all':!![]}];}_0x1c0bb0=_['merge']({},_0x1c0bb0,_0x575c35[_0x183f('0x36')]);return db[_0x183f('0x21')]['find'](_0x1c0bb0)['then'](handleEntityNotFound(_0x454eea,null))[_0x183f('0x17')](respondWithResult(_0x454eea,null))[_0x183f('0x2b')](handleError(_0x454eea,null));};exports[_0x183f('0x37')]=function(_0x331435,_0x363127){return db[_0x183f('0x21')][_0x183f('0x37')](_0x331435['body'],{})[_0x183f('0x17')](function(_0x5d1afd){var _0x581fa6=_0x331435[_0x183f('0x38')][_0x183f('0x19')]({'plain':!![]});if(!_0x581fa6)throw new Error(_0x183f('0x39'));if(_0x581fa6[_0x183f('0x3a')]===_0x183f('0x38')){var _0xbbab1d=_0x5d1afd['get']({'plain':!![]});var _0x11057b='OpenchannelQueues';return db['UserProfileSection']['find']({'where':{'name':_0x11057b,'userProfileId':_0x581fa6[_0x183f('0x3b')]},'raw':!![]})['then'](function(_0x5d3647){if(_0x5d3647&&_0x5d3647[_0x183f('0x3c')]===0x0){return db[_0x183f('0x1b')][_0x183f('0x37')]({'name':_0xbbab1d['name'],'resourceId':_0xbbab1d['id'],'type':_0x5d3647['name'],'sectionId':_0x5d3647['id']},{})[_0x183f('0x17')](function(){return _0x5d1afd;});}else{return _0x5d1afd;}})[_0x183f('0x2b')](function(_0x11d5a6){logger[_0x183f('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11d5a6);throw _0x11d5a6;});}return _0x5d1afd;})['then'](respondWithResult(_0x363127,0xc9))[_0x183f('0x2b')](handleError(_0x363127,null));};exports[_0x183f('0x3d')]=function(_0x303ffe,_0x582755){if(_0x303ffe['body']['id']){delete _0x303ffe[_0x183f('0x3e')]['id'];}return db['OpenchannelQueue'][_0x183f('0x3f')]({'where':{'id':_0x303ffe[_0x183f('0x2d')]['id']}})[_0x183f('0x17')](handleEntityNotFound(_0x582755,null))['then'](saveUpdates(_0x303ffe[_0x183f('0x3e')],null))[_0x183f('0x17')](respondWithResult(_0x582755,null))[_0x183f('0x2b')](handleError(_0x582755,null));};exports['destroy']=function(_0x4f9271,_0x3345a9){return db[_0x183f('0x21')][_0x183f('0x3f')]({'where':{'id':_0x4f9271[_0x183f('0x2d')]['id']}})[_0x183f('0x17')](handleEntityNotFound(_0x3345a9,null))[_0x183f('0x17')](removeEntity(_0x3345a9,null))['catch'](handleError(_0x3345a9,null));};exports[_0x183f('0x40')]=function(_0x58571d,_0x42ca25){return db[_0x183f('0x21')][_0x183f('0x40')]()[_0x183f('0x17')](respondWithResult(_0x42ca25,null))[_0x183f('0x2b')](handleError(_0x42ca25,null));};exports[_0x183f('0x41')]=function(_0x3fc935,_0x2895eb){var _0x63f5d4={'raw':!![],'where':{}},_0x274c56={},_0x5353ec;return db['OpenchannelQueue'][_0x183f('0x42')]({'where':{'id':_0x3fc935[_0x183f('0x2d')]['id']}})[_0x183f('0x17')](handleEntityNotFound(_0x2895eb,null))[_0x183f('0x17')](function(_0x51f2f0){if(_0x51f2f0){_0x5353ec=_0x51f2f0[_0x183f('0x19')]({'plain':!![]});_0x274c56[_0x183f('0x31')]=_['keys'](db[_0x183f('0x43')][_0x183f('0x22')]);_0x274c56[_0x183f('0x2f')]=_[_0x183f('0x2e')](_0x3fc935[_0x183f('0x2f')]);_0x274c56['filters']=_[_0x183f('0x30')](_0x274c56['model'],_0x274c56[_0x183f('0x2f')]);_0x63f5d4[_0x183f('0x32')]=_['intersection'](_0x274c56['model'],qs[_0x183f('0x33')](_0x3fc935['query'][_0x183f('0x33')]));_0x63f5d4['attributes']=_0x63f5d4[_0x183f('0x32')][_0x183f('0x34')]?_0x63f5d4['attributes']:_0x274c56[_0x183f('0x31')];if(!_0x3fc935['query'][_0x183f('0x44')]('nolimit')){_0x63f5d4[_0x183f('0x12')]=qs[_0x183f('0x12')](_0x3fc935['query'][_0x183f('0x12')]);_0x63f5d4[_0x183f('0x10')]=qs['offset'](_0x3fc935['query'][_0x183f('0x10')]);}_0x63f5d4[_0x183f('0x45')]=qs[_0x183f('0x46')](_0x3fc935[_0x183f('0x2f')][_0x183f('0x46')]);_0x63f5d4[_0x183f('0x27')]=qs[_0x183f('0x47')](_[_0x183f('0x48')](_0x3fc935['query'],_0x274c56[_0x183f('0x47')]));_0x63f5d4[_0x183f('0x27')][_0x183f('0x49')]=_0x51f2f0['id'];if(_0x3fc935[_0x183f('0x2f')][_0x183f('0x4a')]){_0x63f5d4['where']=_[_0x183f('0x4b')](_0x63f5d4['where'],{'$or':_[_0x183f('0x4c')](_0x63f5d4['attributes'],function(_0x5836c7){var _0x2c0902={};_0x2c0902[_0x5836c7]={'$like':'%'+_0x3fc935[_0x183f('0x2f')][_0x183f('0x4a')]+'%'};return _0x2c0902;})});}_0x63f5d4=_[_0x183f('0x4b')]({},_0x63f5d4,_0x3fc935['options']);return db[_0x183f('0x43')][_0x183f('0x29')](_0x63f5d4);}})[_0x183f('0x17')](function(_0x1bfc0b){if(_0x1bfc0b){return db[_0x183f('0x4d')]['findAndCountAll']({'where':{'id':_[_0x183f('0x4c')](_0x1bfc0b,'UserId'),'role':_0x183f('0x4e')},'attributes':['id','name',_0x183f('0x4f'),_0x183f('0x50'),_0x183f('0x51')]});}})['then'](function(_0x47c119){if(_0x47c119){return{'count':_0x47c119['count'],'rows':_[_0x183f('0x4c')](_0x47c119['rows'],function(_0x4a5d15){return{'membername':_0x4a5d15['name'],'UserId':_0x4a5d15['id'],'queue_name':_0x5353ec[_0x183f('0x1e')],'OpenchannelQueueId':_0x5353ec['id'],'interface':util[_0x183f('0x52')](_0x183f('0x53'),_0x183f('0x54'),_0x4a5d15[_0x183f('0x1e')]),'penalty':0x0,'paused':_0x4a5d15[_0x183f('0x4f')],'createdAt':_0x4a5d15[_0x183f('0x51')],'updatedAt':_0x4a5d15['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2895eb,_0x63f5d4))['catch'](handleError(_0x2895eb,null));};exports[_0x183f('0x55')]=function(_0x33c315,_0x22055d){var _0x11f9ad={};var _0x57f663={};var _0x3172e0;var _0x4745f9;return db[_0x183f('0x21')][_0x183f('0x42')]({'where':{'id':_0x33c315[_0x183f('0x2d')]['id']}})[_0x183f('0x17')](handleEntityNotFound(_0x22055d,null))[_0x183f('0x17')](function(_0x4745a0){if(_0x4745a0){_0x3172e0=_0x4745a0;_0x57f663[_0x183f('0x31')]=_[_0x183f('0x2e')](db[_0x183f('0x56')][_0x183f('0x22')]);_0x57f663['query']=_[_0x183f('0x2e')](_0x33c315['query']);_0x57f663[_0x183f('0x47')]=_[_0x183f('0x30')](_0x57f663[_0x183f('0x31')],_0x57f663['query']);_0x11f9ad[_0x183f('0x32')]=_[_0x183f('0x30')](_0x57f663['model'],qs[_0x183f('0x33')](_0x33c315['query'][_0x183f('0x33')]));_0x11f9ad[_0x183f('0x32')]=_0x11f9ad['attributes'][_0x183f('0x34')]?_0x11f9ad[_0x183f('0x32')]:_0x57f663['model'];_0x11f9ad[_0x183f('0x45')]=qs['sort'](_0x33c315['query'][_0x183f('0x46')]);_0x11f9ad[_0x183f('0x27')]=qs[_0x183f('0x47')](_['pick'](_0x33c315[_0x183f('0x2f')],_0x57f663[_0x183f('0x47')]));if(_0x33c315['query'][_0x183f('0x4a')]){_0x11f9ad[_0x183f('0x27')]=_['merge'](_0x11f9ad['where'],{'$or':_[_0x183f('0x4c')](_0x11f9ad[_0x183f('0x32')],function(_0x27873e){var _0x67cad3={};_0x67cad3[_0x27873e]={'$like':'%'+_0x33c315[_0x183f('0x2f')][_0x183f('0x4a')]+'%'};return _0x67cad3;})});}_0x11f9ad=_[_0x183f('0x4b')]({},_0x11f9ad,_0x33c315[_0x183f('0x36')]);return _0x3172e0[_0x183f('0x55')](_0x11f9ad);}})[_0x183f('0x17')](function(_0x438841){if(_0x438841){_0x4745f9=_0x438841['length'];if(!_0x33c315[_0x183f('0x2f')][_0x183f('0x44')](_0x183f('0x57'))){_0x11f9ad[_0x183f('0x12')]=qs[_0x183f('0x12')](_0x33c315[_0x183f('0x2f')][_0x183f('0x12')]);_0x11f9ad[_0x183f('0x10')]=qs['offset'](_0x33c315[_0x183f('0x2f')][_0x183f('0x10')]);}return _0x3172e0['getTeams'](_0x11f9ad);}})[_0x183f('0x17')](function(_0x10ebc5){if(_0x10ebc5){return _0x10ebc5?{'count':_0x4745f9,'rows':_0x10ebc5}:null;}})[_0x183f('0x17')](respondWithResult(_0x22055d,null))[_0x183f('0x2b')](handleError(_0x22055d,null));};exports[_0x183f('0x58')]=function(_0xf055fd,_0x3fd4dd){var _0x1a88a6=_0xf055fd['body'][_0x183f('0x59')];return db['Team'][_0x183f('0x29')]({'where':{'id':_0x1a88a6},'attributes':['id'],'include':[{'model':db[_0x183f('0x4d')],'as':_0x183f('0x5a'),'attributes':['id',_0x183f('0x1e'),'online',_0x183f('0x5b'),_0x183f('0x5c')],'raw':!![]}]})['then'](function(_0x37466e){if(_0x37466e){var _0x1f1a38=_[_0x183f('0x5d')](_0x37466e,function(_0x1ec59a){var _0x4862b9=_0x1ec59a['get']({'plain':!![]});return _0x4862b9[_0x183f('0x5a')];});return db[_0x183f('0x21')][_0x183f('0x3f')]({'where':{'id':_0xf055fd[_0x183f('0x2d')]['id']}})[_0x183f('0x17')](function(_0x200c6b){return db[_0x183f('0x5e')][_0x183f('0x5f')](function(_0x34143c){return _0x200c6b[_0x183f('0x58')](_0x1a88a6,{'transaction':_0x34143c})[_0x183f('0x17')](function(){return BPromise[_0x183f('0x60')](_0x1f1a38,function(_0x373457){return db[_0x183f('0x43')]['findOrCreate']({'where':{'UserId':_0x373457['id'],'OpenchannelQueueId':_0xf055fd[_0x183f('0x2d')]['id']},'transaction':_0x34143c});});})[_0x183f('0x17')](function(){_0x1f1a38[_0x183f('0x61')](function(_0x4aadf4){socket[_0x183f('0x62')](_0x183f('0x63'),{'UserId':_0x4aadf4['id'],'OpenchannelQueueId':_0x200c6b['id']});});});});});}})[_0x183f('0x17')](respondWithStatusCode(_0x3fd4dd,null))[_0x183f('0x2b')](handleError(_0x3fd4dd,null));};exports[_0x183f('0x64')]=function(_0xcc1e68,_0x1a46eb){return db[_0x183f('0x56')]['findAll']({'where':{'id':_0xcc1e68['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x183f('0x4d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x183f('0x17')](handleEntityNotFound(_0x1a46eb,null))[_0x183f('0x17')](function(_0x2a76c1){var _0x4aaa1d=_[_0x183f('0x4c')](_0x2a76c1,'id');var _0xcc3e78=[];var _0x1eba77=[];var _0x3d99b6=squel[_0x183f('0x65')]();_0x3d99b6[_0x183f('0x66')](_0x183f('0x67'))[_0x183f('0x68')](_0x183f('0x69'),'tq')[_0x183f('0x6a')](_0x183f('0x6b'),'ut',_0x183f('0x6c'))[_0x183f('0x27')](_0x183f('0x6d'),_0xcc1e68[_0x183f('0x2d')]['id']);for(var _0x2181fa=0x0;_0x2181fa<_0x2a76c1[_0x183f('0x34')];_0x2181fa+=0x1){let _0x1a1d3a=_0x2a76c1[_0x2181fa];for(var _0x42edea=0x0;_0x42edea<_0x1a1d3a[_0x183f('0x5a')][_0x183f('0x34')];_0x42edea+=0x1){let _0x401595=_0x1a1d3a[_0x183f('0x5a')][_0x42edea];var _0x4ed0d4=_0x3d99b6[_0x183f('0x6e')]();_0x4ed0d4[_0x183f('0x27')](_0x183f('0x6f'),_0x401595['id']);_0x1eba77[_0x183f('0x70')](db[_0x183f('0x5e')][_0x183f('0x2f')](_0x4ed0d4[_0x183f('0x71')](),{'type':db[_0x183f('0x5e')]['QueryTypes'][_0x183f('0x72')]})[_0x183f('0x17')](function(_0x2cbc2a){if(_0x2cbc2a['length']===0x1){return _0x401595['id'];}else{var _0x1689d6=_[_0x183f('0x73')](_[_0x183f('0x4c')](_0x2cbc2a,_0x183f('0x74')),function(_0x237220){return _[_0x183f('0x75')](_0x4aaa1d,_0x237220);});if(_0x1689d6){return _0x401595['id'];}}}));}}return BPromise[_0x183f('0x76')](_0x1eba77)[_0x183f('0x17')](function(_0x3e09bf){_0xcc3e78=_(_0xcc3e78)[_0x183f('0x77')](_0x3e09bf)[_0x183f('0x78')]()['value']();return db[_0x183f('0x21')][_0x183f('0x3f')]({'where':{'id':_0xcc1e68[_0x183f('0x2d')]['id']}})[_0x183f('0x17')](function(_0x43b4a4){return db[_0x183f('0x5e')][_0x183f('0x5f')](function(_0x2b8737){return _0x43b4a4[_0x183f('0x64')](_0xcc1e68[_0x183f('0x2f')][_0x183f('0x59')],{'transaction':_0x2b8737})[_0x183f('0x17')](function(){if(!_[_0x183f('0x79')](_0xcc3e78)){return _0x43b4a4[_0x183f('0x7a')](_0xcc3e78,{'transaction':_0x2b8737});}})[_0x183f('0x17')](function(){_0xcc3e78[_0x183f('0x61')](function(_0x830d5f){socket[_0x183f('0x62')]('userOpenchannelQueue:remove',{'UserId':_0x830d5f,'OpenchannelQueueId':_0x43b4a4['id']});});});});});});})['then'](respondWithStatusCode(_0x1a46eb,null))[_0x183f('0x2b')](handleError(_0x1a46eb,null));};exports[_0x183f('0x7b')]=function(_0x17bde9,_0x514b67){return db[_0x183f('0x21')][_0x183f('0x3f')]({'where':{'id':_0x17bde9[_0x183f('0x2d')]['id']}})[_0x183f('0x17')](handleEntityNotFound(_0x514b67,null))[_0x183f('0x17')](function(_0x4b4138){if(_0x4b4138){return _0x4b4138['addAgents'](_0x17bde9[_0x183f('0x3e')][_0x183f('0x59')],_[_0x183f('0x7c')](_0x17bde9[_0x183f('0x3e')],[_0x183f('0x59'),'id'])||{})[_0x183f('0x7d')](function(_0x2ac2d0){for(var _0x35f826=0x0;_0x35f826<_0x17bde9[_0x183f('0x3e')][_0x183f('0x59')][_0x183f('0x34')];_0x35f826+=0x1){socket[_0x183f('0x62')](_0x183f('0x63'),{'UserId':Number(_0x17bde9[_0x183f('0x3e')]['ids'][_0x35f826]),'OpenchannelQueueId':Number(_0x17bde9[_0x183f('0x2d')]['id'])});}return _0x2ac2d0;});}})[_0x183f('0x17')](respondWithResult(_0x514b67,null))[_0x183f('0x2b')](handleError(_0x514b67,null));};exports['removeAgents']=function(_0x5d8d8c,_0x12eff1){return db[_0x183f('0x21')][_0x183f('0x3f')]({'where':{'id':_0x5d8d8c['params']['id']}})[_0x183f('0x17')](handleEntityNotFound(_0x12eff1,null))['then'](function(_0x12944f){if(_0x12944f){return _0x12944f[_0x183f('0x7a')](_0x5d8d8c[_0x183f('0x2f')]['ids'])[_0x183f('0x17')](function(){if(_[_0x183f('0x7e')](_0x5d8d8c[_0x183f('0x2f')][_0x183f('0x59')])){for(var _0x115dcb=0x0;_0x115dcb<_0x5d8d8c[_0x183f('0x2f')]['ids']['length'];_0x115dcb+=0x1){socket[_0x183f('0x62')](_0x183f('0x7f'),{'UserId':Number(_0x5d8d8c[_0x183f('0x2f')][_0x183f('0x59')][_0x115dcb]),'OpenchannelQueueId':Number(_0x5d8d8c[_0x183f('0x2d')]['id'])});}}else{socket[_0x183f('0x62')](_0x183f('0x7f'),{'UserId':Number(_0x5d8d8c[_0x183f('0x2f')][_0x183f('0x59')]),'OpenchannelQueueId':Number(_0x5d8d8c[_0x183f('0x2d')]['id'])});}});}})['then'](respondWithStatusCode(_0x12eff1,null))[_0x183f('0x2b')](handleError(_0x12eff1,null));};exports['getAgents']=function(_0x4cb3f0,_0x4fd092){var _0x5b120a={};var _0x57c112={};var _0xcd999e;var _0x38b733;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x4cb3f0['params']['id']}})[_0x183f('0x17')](handleEntityNotFound(_0x4fd092,null))[_0x183f('0x17')](function(_0x47c4d1){if(_0x47c4d1){_0xcd999e=_0x47c4d1;_0x57c112[_0x183f('0x31')]=_[_0x183f('0x2e')](db[_0x183f('0x4d')][_0x183f('0x22')]);_0x57c112[_0x183f('0x2f')]=_[_0x183f('0x2e')](_0x4cb3f0[_0x183f('0x2f')]);_0x57c112[_0x183f('0x47')]=_[_0x183f('0x30')](_0x57c112[_0x183f('0x31')],_0x57c112[_0x183f('0x2f')]);_0x5b120a['attributes']=_[_0x183f('0x30')](_0x57c112['model'],qs[_0x183f('0x33')](_0x4cb3f0['query'][_0x183f('0x33')]));_0x5b120a[_0x183f('0x32')]=_0x5b120a[_0x183f('0x32')]['length']?_0x5b120a[_0x183f('0x32')]:_0x57c112[_0x183f('0x31')];_0x5b120a[_0x183f('0x45')]=qs[_0x183f('0x46')](_0x4cb3f0[_0x183f('0x2f')][_0x183f('0x46')]);_0x5b120a[_0x183f('0x27')]=qs['filters'](_[_0x183f('0x48')](_0x4cb3f0[_0x183f('0x2f')],_0x57c112[_0x183f('0x47')]));if(_0x4cb3f0[_0x183f('0x2f')]['filter']){_0x5b120a['where']=_[_0x183f('0x4b')](_0x5b120a['where'],{'$or':_['map'](_0x5b120a[_0x183f('0x32')],function(_0x31d6a7){var _0x4a4df4={};_0x4a4df4[_0x31d6a7]={'$like':'%'+_0x4cb3f0['query'][_0x183f('0x4a')]+'%'};return _0x4a4df4;})});}_0x5b120a=_[_0x183f('0x4b')]({},_0x5b120a,_0x4cb3f0[_0x183f('0x36')]);return _0xcd999e[_0x183f('0x80')](_0x5b120a);}})[_0x183f('0x17')](function(_0x1bc68a){if(_0x1bc68a){_0x38b733=_0x1bc68a[_0x183f('0x34')];if(!_0x4cb3f0[_0x183f('0x2f')][_0x183f('0x44')](_0x183f('0x57'))){_0x5b120a[_0x183f('0x12')]=qs['limit'](_0x4cb3f0[_0x183f('0x2f')][_0x183f('0x12')]);_0x5b120a[_0x183f('0x10')]=qs[_0x183f('0x10')](_0x4cb3f0['query'][_0x183f('0x10')]);}return _0xcd999e[_0x183f('0x80')](_0x5b120a);}})[_0x183f('0x17')](function(_0x5c0dbe){if(_0x5c0dbe){return _0x5c0dbe?{'count':_0x38b733,'rows':_0x5c0dbe}:null;}})['then'](respondWithResult(_0x4fd092,null))['catch'](handleError(_0x4fd092,null));}; \ No newline at end of file +var _0xa467=['keys','filters','intersection','attributes','includeAll','merge','options','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','fields','length','nolimit','sort','pick','filter','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','getTeams','Team','order','hasOwnProperty','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','every','includes','union','value','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','then','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','show','params','model'];(function(_0xf3232a,_0x559323){var _0x25aeaa=function(_0x4ea65c){while(--_0x4ea65c){_0xf3232a['push'](_0xf3232a['shift']());}};_0x25aeaa(++_0x559323);}(_0xa467,0x1b2));var _0x7a46=function(_0x3ab360,_0x45417b){_0x3ab360=_0x3ab360-0x0;var _0x434580=_0xa467[_0x3ab360];return _0x434580;};'use strict';var BPromise=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var _=require(_0x7a46('0x2'));var squel=require(_0x7a46('0x3'));var Redis=require(_0x7a46('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x7a46('0x5'))(_0x7a46('0x6'));var config=require(_0x7a46('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x7a46('0x8')],{'host':_0x7a46('0x9'),'port':0x18eb});var socket=require(_0x7a46('0xa'))(new Redis(config[_0x7a46('0x8')]));require(_0x7a46('0xb'))[_0x7a46('0xc')](socket);function respondWithStatusCode(_0x54bd0a,_0xa14a90){_0xa14a90=_0xa14a90||0xcc;return function(_0x498a9f){if(_0x498a9f){return _0x54bd0a[_0x7a46('0xd')](_0xa14a90);}return _0x54bd0a['status'](_0xa14a90)[_0x7a46('0xe')]();};}function respondWithResult(_0x61046a,_0xd68f37){_0xd68f37=_0xd68f37||0xc8;return function(_0x20ea34){if(_0x20ea34){return _0x61046a[_0x7a46('0xf')](_0xd68f37)[_0x7a46('0x10')](_0x20ea34);}};}function respondWithFilteredResult(_0x42b766,_0x29326f){return function(_0x508249){if(_0x508249){var _0x6bf9c0=typeof _0x29326f['offset']===_0x7a46('0x11')&&typeof _0x29326f[_0x7a46('0x12')]===_0x7a46('0x11');var _0x3cfce4=_0x508249[_0x7a46('0x13')];var _0x325ad4=_0x6bf9c0?0x0:_0x29326f[_0x7a46('0x14')];var _0x2d18b8=_0x6bf9c0?_0x508249['count']:_0x29326f['offset']+_0x29326f[_0x7a46('0x12')];var _0x3560c7;if(_0x2d18b8>=_0x3cfce4){_0x2d18b8=_0x3cfce4;_0x3560c7=0xc8;}else{_0x3560c7=0xce;}_0x42b766[_0x7a46('0xf')](_0x3560c7);return _0x42b766[_0x7a46('0x15')](_0x7a46('0x16'),_0x325ad4+'-'+_0x2d18b8+'/'+_0x3cfce4)[_0x7a46('0x10')](_0x508249);}return null;};}function saveUpdates(_0xe7833c){return function(_0x136ae9){if(_0x136ae9){return _0x136ae9['update'](_0xe7833c)['then'](function(_0x96bf58){return _0x96bf58;});}return null;};}function removeEntity(_0x281cef){return function(_0x5c3053){if(_0x5c3053){return _0x5c3053['destroy']()[_0x7a46('0x17')](function(){var _0x158d1b=_0x5c3053['get']({'plain':!![]});var _0x1c25b3=_0x7a46('0x18');return db[_0x7a46('0x19')][_0x7a46('0x1a')]({'where':{'type':_0x1c25b3,'resourceId':_0x158d1b['id']}})[_0x7a46('0x17')](function(){return _0x5c3053;});})[_0x7a46('0x17')](function(){_0x281cef['status'](0xcc)[_0x7a46('0xe')]();});}};}function handleEntityNotFound(_0x321c2e){return function(_0xea1423){if(!_0xea1423){_0x321c2e['sendStatus'](0x194);}return _0xea1423;};}function handleError(_0xe61961,_0x558f1b){_0x558f1b=_0x558f1b||0x1f4;return function(_0x4cc266){logger[_0x7a46('0x1b')](_0x4cc266[_0x7a46('0x1c')]);if(_0x4cc266[_0x7a46('0x1d')]){delete _0x4cc266['name'];}_0xe61961[_0x7a46('0xf')](_0x558f1b)['send'](_0x4cc266);};}exports[_0x7a46('0x1e')]=function(_0x553de5,_0x16dac9){var _0x14a81c={};var _0x17f2a8={'count':0x0,'rows':[]};var _0x5cd7b4=_[_0x7a46('0x1f')](db[_0x7a46('0x20')][_0x7a46('0x21')],function(_0x2c0f8e){return{'name':_0x2c0f8e[_0x7a46('0x22')],'type':_0x2c0f8e[_0x7a46('0x23')][_0x7a46('0x24')]};});_0x14a81c=qs[_0x7a46('0x25')](_0x5cd7b4,_0x553de5);var _0xb42613={'where':_0x14a81c[_0x7a46('0x26')]};return db['OpenchannelQueue'][_0x7a46('0x13')](_0xb42613)['then'](function(_0x1e1fb7){_0x17f2a8[_0x7a46('0x13')]=_0x1e1fb7;_0x14a81c[_0x7a46('0x27')]=qs[_0x7a46('0x27')](_0x553de5[_0x7a46('0x28')]);return db['OpenchannelQueue'][_0x7a46('0x29')](_0x14a81c);})[_0x7a46('0x17')](function(_0x345bec){_0x17f2a8[_0x7a46('0x2a')]=_0x345bec;return _0x17f2a8;})[_0x7a46('0x17')](respondWithFilteredResult(_0x16dac9,_0x14a81c))['catch'](handleError(_0x16dac9,null));};exports[_0x7a46('0x2b')]=function(_0x49fe12,_0x103c41){var _0x55079b={'raw':!![],'where':{'id':_0x49fe12[_0x7a46('0x2c')]['id']}},_0xcda7b={};_0xcda7b[_0x7a46('0x2d')]=_['keys'](db[_0x7a46('0x20')][_0x7a46('0x21')]);_0xcda7b['query']=_[_0x7a46('0x2e')](_0x49fe12[_0x7a46('0x28')]);_0xcda7b[_0x7a46('0x2f')]=_[_0x7a46('0x30')](_0xcda7b['model'],_0xcda7b[_0x7a46('0x28')]);_0x55079b['attributes']=_[_0x7a46('0x30')](_0xcda7b[_0x7a46('0x2d')],qs['fields'](_0x49fe12[_0x7a46('0x28')]['fields']));_0x55079b['attributes']=_0x55079b[_0x7a46('0x31')]['length']?_0x55079b[_0x7a46('0x31')]:_0xcda7b['model'];if(_0x49fe12['query'][_0x7a46('0x32')]){_0x55079b[_0x7a46('0x27')]=[{'all':!![]}];}_0x55079b=_[_0x7a46('0x33')]({},_0x55079b,_0x49fe12[_0x7a46('0x34')]);return db['OpenchannelQueue'][_0x7a46('0x35')](_0x55079b)[_0x7a46('0x17')](handleEntityNotFound(_0x103c41,null))[_0x7a46('0x17')](respondWithResult(_0x103c41,null))['catch'](handleError(_0x103c41,null));};exports[_0x7a46('0x36')]=function(_0xcf97c6,_0x507c7d){return db['OpenchannelQueue'][_0x7a46('0x36')](_0xcf97c6['body'],{})['then'](function(_0x2dec3f){var _0x3020cf=_0xcf97c6[_0x7a46('0x37')][_0x7a46('0x38')]({'plain':!![]});if(!_0x3020cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3020cf[_0x7a46('0x39')]==='user'){var _0x4d15ca=_0x2dec3f[_0x7a46('0x38')]({'plain':!![]});var _0x47dcb0=_0x7a46('0x18');return db[_0x7a46('0x3a')][_0x7a46('0x35')]({'where':{'name':_0x47dcb0,'userProfileId':_0x3020cf[_0x7a46('0x3b')]},'raw':!![]})[_0x7a46('0x17')](function(_0x32bc04){if(_0x32bc04&&_0x32bc04[_0x7a46('0x3c')]===0x0){return db[_0x7a46('0x19')][_0x7a46('0x36')]({'name':_0x4d15ca[_0x7a46('0x1d')],'resourceId':_0x4d15ca['id'],'type':_0x32bc04[_0x7a46('0x1d')],'sectionId':_0x32bc04['id']},{})[_0x7a46('0x17')](function(){return _0x2dec3f;});}else{return _0x2dec3f;}})[_0x7a46('0x3d')](function(_0x126095){logger[_0x7a46('0x1b')](_0x7a46('0x3e'),_0x126095);throw _0x126095;});}return _0x2dec3f;})[_0x7a46('0x17')](respondWithResult(_0x507c7d,0xc9))['catch'](handleError(_0x507c7d,null));};exports['update']=function(_0x660a51,_0x1e0b0e){if(_0x660a51[_0x7a46('0x3f')]['id']){delete _0x660a51['body']['id'];}return db[_0x7a46('0x20')][_0x7a46('0x35')]({'where':{'id':_0x660a51[_0x7a46('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1e0b0e,null))[_0x7a46('0x17')](saveUpdates(_0x660a51[_0x7a46('0x3f')],null))[_0x7a46('0x17')](respondWithResult(_0x1e0b0e,null))['catch'](handleError(_0x1e0b0e,null));};exports[_0x7a46('0x1a')]=function(_0x4406c9,_0x4237d2){return db[_0x7a46('0x20')][_0x7a46('0x35')]({'where':{'id':_0x4406c9['params']['id']}})[_0x7a46('0x17')](handleEntityNotFound(_0x4237d2,null))[_0x7a46('0x17')](removeEntity(_0x4237d2,null))[_0x7a46('0x3d')](handleError(_0x4237d2,null));};exports[_0x7a46('0x40')]=function(_0x53984d,_0xe2ec80){return db[_0x7a46('0x20')][_0x7a46('0x40')]()[_0x7a46('0x17')](respondWithResult(_0xe2ec80,null))[_0x7a46('0x3d')](handleError(_0xe2ec80,null));};exports['getMembers']=function(_0x79ef50,_0x294319){var _0x2db5b4={'raw':!![],'where':{}},_0x31dd51={},_0x5696e3;return db[_0x7a46('0x20')][_0x7a46('0x41')]({'where':{'id':_0x79ef50[_0x7a46('0x2c')]['id']}})[_0x7a46('0x17')](handleEntityNotFound(_0x294319,null))[_0x7a46('0x17')](function(_0x4e48ad){if(_0x4e48ad){_0x5696e3=_0x4e48ad['get']({'plain':!![]});_0x31dd51[_0x7a46('0x2d')]=_[_0x7a46('0x2e')](db[_0x7a46('0x42')][_0x7a46('0x21')]);_0x31dd51[_0x7a46('0x28')]=_[_0x7a46('0x2e')](_0x79ef50[_0x7a46('0x28')]);_0x31dd51[_0x7a46('0x2f')]=_['intersection'](_0x31dd51[_0x7a46('0x2d')],_0x31dd51[_0x7a46('0x28')]);_0x2db5b4[_0x7a46('0x31')]=_[_0x7a46('0x30')](_0x31dd51['model'],qs[_0x7a46('0x43')](_0x79ef50[_0x7a46('0x28')][_0x7a46('0x43')]));_0x2db5b4[_0x7a46('0x31')]=_0x2db5b4[_0x7a46('0x31')][_0x7a46('0x44')]?_0x2db5b4['attributes']:_0x31dd51[_0x7a46('0x2d')];if(!_0x79ef50[_0x7a46('0x28')]['hasOwnProperty'](_0x7a46('0x45'))){_0x2db5b4[_0x7a46('0x12')]=qs[_0x7a46('0x12')](_0x79ef50[_0x7a46('0x28')][_0x7a46('0x12')]);_0x2db5b4[_0x7a46('0x14')]=qs[_0x7a46('0x14')](_0x79ef50[_0x7a46('0x28')][_0x7a46('0x14')]);}_0x2db5b4['order']=qs['sort'](_0x79ef50[_0x7a46('0x28')][_0x7a46('0x46')]);_0x2db5b4[_0x7a46('0x26')]=qs[_0x7a46('0x2f')](_[_0x7a46('0x47')](_0x79ef50[_0x7a46('0x28')],_0x31dd51[_0x7a46('0x2f')]));_0x2db5b4[_0x7a46('0x26')]['OpenchannelQueueId']=_0x4e48ad['id'];if(_0x79ef50[_0x7a46('0x28')][_0x7a46('0x48')]){_0x2db5b4[_0x7a46('0x26')]=_[_0x7a46('0x33')](_0x2db5b4['where'],{'$or':_[_0x7a46('0x1f')](_0x2db5b4[_0x7a46('0x31')],function(_0x5e3ab4){var _0x3e39e1={};_0x3e39e1[_0x5e3ab4]={'$like':'%'+_0x79ef50[_0x7a46('0x28')][_0x7a46('0x48')]+'%'};return _0x3e39e1;})});}_0x2db5b4=_[_0x7a46('0x33')]({},_0x2db5b4,_0x79ef50[_0x7a46('0x34')]);return db[_0x7a46('0x42')][_0x7a46('0x29')](_0x2db5b4);}})['then'](function(_0x1e197f){if(_0x1e197f){return db['User'][_0x7a46('0x49')]({'where':{'id':_['map'](_0x1e197f,_0x7a46('0x4a')),'role':_0x7a46('0x4b')},'attributes':['id','name',_0x7a46('0x4c'),_0x7a46('0x4d'),_0x7a46('0x4e')]});}})[_0x7a46('0x17')](function(_0x32459c){if(_0x32459c){return{'count':_0x32459c[_0x7a46('0x13')],'rows':_[_0x7a46('0x1f')](_0x32459c[_0x7a46('0x2a')],function(_0x3f72d6){return{'membername':_0x3f72d6[_0x7a46('0x1d')],'UserId':_0x3f72d6['id'],'queue_name':_0x5696e3[_0x7a46('0x1d')],'OpenchannelQueueId':_0x5696e3['id'],'interface':util['format']('%s/%s','SIP',_0x3f72d6['name']),'penalty':0x0,'paused':_0x3f72d6['openchannelPause'],'createdAt':_0x3f72d6[_0x7a46('0x4e')],'updatedAt':_0x3f72d6[_0x7a46('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7a46('0x17')](respondWithFilteredResult(_0x294319,_0x2db5b4))[_0x7a46('0x3d')](handleError(_0x294319,null));};exports[_0x7a46('0x4f')]=function(_0x185ef1,_0xb9c7e8){var _0x37520f={};var _0xe5a54a={};var _0x3cb4f7;var _0x3221b1;return db[_0x7a46('0x20')][_0x7a46('0x41')]({'where':{'id':_0x185ef1[_0x7a46('0x2c')]['id']}})[_0x7a46('0x17')](handleEntityNotFound(_0xb9c7e8,null))[_0x7a46('0x17')](function(_0x5eeba9){if(_0x5eeba9){_0x3cb4f7=_0x5eeba9;_0xe5a54a['model']=_['keys'](db[_0x7a46('0x50')][_0x7a46('0x21')]);_0xe5a54a[_0x7a46('0x28')]=_[_0x7a46('0x2e')](_0x185ef1['query']);_0xe5a54a['filters']=_[_0x7a46('0x30')](_0xe5a54a[_0x7a46('0x2d')],_0xe5a54a['query']);_0x37520f['attributes']=_[_0x7a46('0x30')](_0xe5a54a['model'],qs['fields'](_0x185ef1['query'][_0x7a46('0x43')]));_0x37520f[_0x7a46('0x31')]=_0x37520f['attributes'][_0x7a46('0x44')]?_0x37520f[_0x7a46('0x31')]:_0xe5a54a[_0x7a46('0x2d')];_0x37520f[_0x7a46('0x51')]=qs[_0x7a46('0x46')](_0x185ef1[_0x7a46('0x28')][_0x7a46('0x46')]);_0x37520f[_0x7a46('0x26')]=qs['filters'](_[_0x7a46('0x47')](_0x185ef1[_0x7a46('0x28')],_0xe5a54a['filters']));if(_0x185ef1['query'][_0x7a46('0x48')]){_0x37520f['where']=_[_0x7a46('0x33')](_0x37520f[_0x7a46('0x26')],{'$or':_[_0x7a46('0x1f')](_0x37520f[_0x7a46('0x31')],function(_0x542555){var _0x4d8981={};_0x4d8981[_0x542555]={'$like':'%'+_0x185ef1[_0x7a46('0x28')][_0x7a46('0x48')]+'%'};return _0x4d8981;})});}_0x37520f=_[_0x7a46('0x33')]({},_0x37520f,_0x185ef1[_0x7a46('0x34')]);return _0x3cb4f7['getTeams'](_0x37520f);}})['then'](function(_0x5568d1){if(_0x5568d1){_0x3221b1=_0x5568d1['length'];if(!_0x185ef1['query'][_0x7a46('0x52')](_0x7a46('0x45'))){_0x37520f['limit']=qs[_0x7a46('0x12')](_0x185ef1[_0x7a46('0x28')][_0x7a46('0x12')]);_0x37520f[_0x7a46('0x14')]=qs[_0x7a46('0x14')](_0x185ef1[_0x7a46('0x28')][_0x7a46('0x14')]);}return _0x3cb4f7[_0x7a46('0x4f')](_0x37520f);}})[_0x7a46('0x17')](function(_0x299300){if(_0x299300){return _0x299300?{'count':_0x3221b1,'rows':_0x299300}:null;}})[_0x7a46('0x17')](respondWithResult(_0xb9c7e8,null))[_0x7a46('0x3d')](handleError(_0xb9c7e8,null));};exports[_0x7a46('0x53')]=function(_0x13bde8,_0x3cd5ec){var _0x4c4e8b=_0x13bde8[_0x7a46('0x3f')][_0x7a46('0x54')];return db[_0x7a46('0x50')][_0x7a46('0x29')]({'where':{'id':_0x4c4e8b},'attributes':['id'],'include':[{'model':db[_0x7a46('0x55')],'as':_0x7a46('0x56'),'attributes':['id',_0x7a46('0x1d'),'online',_0x7a46('0x57'),_0x7a46('0x58')],'raw':!![]}]})[_0x7a46('0x17')](function(_0x24b1a7){if(_0x24b1a7){var _0x35529e=_[_0x7a46('0x59')](_0x24b1a7,function(_0x2803cb){var _0x2d758d=_0x2803cb[_0x7a46('0x38')]({'plain':!![]});return _0x2d758d[_0x7a46('0x56')];});return db['OpenchannelQueue'][_0x7a46('0x35')]({'where':{'id':_0x13bde8['params']['id']}})['then'](function(_0x4497ef){return db[_0x7a46('0x5a')][_0x7a46('0x5b')](function(_0x37b54e){return _0x4497ef[_0x7a46('0x53')](_0x4c4e8b,{'transaction':_0x37b54e})[_0x7a46('0x17')](function(){return BPromise[_0x7a46('0x5c')](_0x35529e,function(_0xa56d93){return db[_0x7a46('0x42')][_0x7a46('0x5d')]({'where':{'UserId':_0xa56d93['id'],'OpenchannelQueueId':_0x13bde8[_0x7a46('0x2c')]['id']},'transaction':_0x37b54e});});})[_0x7a46('0x17')](function(){_0x35529e['forEach'](function(_0x4582b4){socket[_0x7a46('0x5e')](_0x7a46('0x5f'),{'UserId':_0x4582b4['id'],'OpenchannelQueueId':_0x4497ef['id']});});});});});}})[_0x7a46('0x17')](respondWithStatusCode(_0x3cd5ec,null))[_0x7a46('0x3d')](handleError(_0x3cd5ec,null));};exports[_0x7a46('0x60')]=function(_0xab6a18,_0x33485d){return db[_0x7a46('0x50')]['findAll']({'where':{'id':_0xab6a18['query'][_0x7a46('0x54')]},'attributes':['id'],'include':[{'model':db[_0x7a46('0x55')],'as':_0x7a46('0x56'),'attributes':['id'],'raw':!![]}]})[_0x7a46('0x17')](handleEntityNotFound(_0x33485d,null))[_0x7a46('0x17')](function(_0x29d2a2){var _0x3f50a1=_['map'](_0x29d2a2,'id');var _0x1cbc6d=[];var _0x814911=[];var _0x101b06=squel[_0x7a46('0x61')]();_0x101b06['field'](_0x7a46('0x62'))[_0x7a46('0x63')](_0x7a46('0x64'),'tq')[_0x7a46('0x65')]('user_has_teams','ut',_0x7a46('0x66'))[_0x7a46('0x26')]('OpenchannelQueueId\x20=\x20?',_0xab6a18[_0x7a46('0x2c')]['id']);for(var _0x1ecc93=0x0;_0x1ecc93<_0x29d2a2[_0x7a46('0x44')];_0x1ecc93+=0x1){let _0xe1168a=_0x29d2a2[_0x1ecc93];for(var _0x403693=0x0;_0x403693<_0xe1168a[_0x7a46('0x56')][_0x7a46('0x44')];_0x403693+=0x1){let _0x5f2645=_0xe1168a[_0x7a46('0x56')][_0x403693];var _0x1924df=_0x101b06[_0x7a46('0x67')]();_0x1924df['where']('ut.UserId\x20=\x20?',_0x5f2645['id']);_0x814911[_0x7a46('0x68')](db['sequelize'][_0x7a46('0x28')](_0x1924df['toString'](),{'type':db[_0x7a46('0x5a')][_0x7a46('0x69')][_0x7a46('0x6a')]})['then'](function(_0xfb543b){if(_0xfb543b[_0x7a46('0x44')]===0x1){return _0x5f2645['id'];}else{var _0xfabac4=_[_0x7a46('0x6b')](_[_0x7a46('0x1f')](_0xfb543b,'TeamId'),function(_0x9dfcfb){return _[_0x7a46('0x6c')](_0x3f50a1,_0x9dfcfb);});if(_0xfabac4){return _0x5f2645['id'];}}}));}}return BPromise['all'](_0x814911)[_0x7a46('0x17')](function(_0x575dd6){_0x1cbc6d=_(_0x1cbc6d)[_0x7a46('0x6d')](_0x575dd6)['compact']()[_0x7a46('0x6e')]();return db[_0x7a46('0x20')][_0x7a46('0x35')]({'where':{'id':_0xab6a18['params']['id']}})['then'](function(_0x3a40aa){return db[_0x7a46('0x5a')][_0x7a46('0x5b')](function(_0x14a8be){return _0x3a40aa[_0x7a46('0x60')](_0xab6a18[_0x7a46('0x28')][_0x7a46('0x54')],{'transaction':_0x14a8be})[_0x7a46('0x17')](function(){if(!_[_0x7a46('0x6f')](_0x1cbc6d)){return _0x3a40aa['removeAgents'](_0x1cbc6d,{'transaction':_0x14a8be});}})[_0x7a46('0x17')](function(){_0x1cbc6d[_0x7a46('0x70')](function(_0x3c0232){socket[_0x7a46('0x5e')](_0x7a46('0x71'),{'UserId':_0x3c0232,'OpenchannelQueueId':_0x3a40aa['id']});});});});});});})['then'](respondWithStatusCode(_0x33485d,null))[_0x7a46('0x3d')](handleError(_0x33485d,null));};exports[_0x7a46('0x72')]=function(_0x5b1686,_0x27b9e6){return db[_0x7a46('0x20')][_0x7a46('0x35')]({'where':{'id':_0x5b1686[_0x7a46('0x2c')]['id']}})['then'](handleEntityNotFound(_0x27b9e6,null))[_0x7a46('0x17')](function(_0x2e869e){if(_0x2e869e){return _0x2e869e['addAgents'](_0x5b1686[_0x7a46('0x3f')]['ids'],_[_0x7a46('0x73')](_0x5b1686[_0x7a46('0x3f')],[_0x7a46('0x54'),'id'])||{})[_0x7a46('0x74')](function(_0x10314e){for(var _0xf7c17c=0x0;_0xf7c17c<_0x5b1686['body'][_0x7a46('0x54')][_0x7a46('0x44')];_0xf7c17c+=0x1){socket[_0x7a46('0x5e')]('userOpenchannelQueue:save',{'UserId':Number(_0x5b1686[_0x7a46('0x3f')][_0x7a46('0x54')][_0xf7c17c]),'OpenchannelQueueId':Number(_0x5b1686['params']['id'])});}return _0x10314e;});}})[_0x7a46('0x17')](respondWithResult(_0x27b9e6,null))[_0x7a46('0x3d')](handleError(_0x27b9e6,null));};exports[_0x7a46('0x75')]=function(_0x13027c,_0xa7bad9){return db[_0x7a46('0x20')][_0x7a46('0x35')]({'where':{'id':_0x13027c[_0x7a46('0x2c')]['id']}})[_0x7a46('0x17')](handleEntityNotFound(_0xa7bad9,null))['then'](function(_0x4f0464){if(_0x4f0464){return _0x4f0464[_0x7a46('0x75')](_0x13027c[_0x7a46('0x28')][_0x7a46('0x54')])['then'](function(){if(_[_0x7a46('0x76')](_0x13027c[_0x7a46('0x28')][_0x7a46('0x54')])){for(var _0x9318e9=0x0;_0x9318e9<_0x13027c[_0x7a46('0x28')][_0x7a46('0x54')][_0x7a46('0x44')];_0x9318e9+=0x1){socket[_0x7a46('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x13027c['query'][_0x7a46('0x54')][_0x9318e9]),'OpenchannelQueueId':Number(_0x13027c[_0x7a46('0x2c')]['id'])});}}else{socket[_0x7a46('0x5e')](_0x7a46('0x71'),{'UserId':Number(_0x13027c['query'][_0x7a46('0x54')]),'OpenchannelQueueId':Number(_0x13027c[_0x7a46('0x2c')]['id'])});}});}})[_0x7a46('0x17')](respondWithStatusCode(_0xa7bad9,null))[_0x7a46('0x3d')](handleError(_0xa7bad9,null));};exports['getAgents']=function(_0x42c88d,_0x2169dd){var _0x47dac3={};var _0x4de5ec={};var _0x5bbd64;var _0xf64c0d;return db[_0x7a46('0x20')][_0x7a46('0x41')]({'where':{'id':_0x42c88d[_0x7a46('0x2c')]['id']}})[_0x7a46('0x17')](handleEntityNotFound(_0x2169dd,null))['then'](function(_0x3f816c){if(_0x3f816c){_0x5bbd64=_0x3f816c;_0x4de5ec[_0x7a46('0x2d')]=_[_0x7a46('0x2e')](db[_0x7a46('0x55')][_0x7a46('0x21')]);_0x4de5ec['query']=_['keys'](_0x42c88d[_0x7a46('0x28')]);_0x4de5ec[_0x7a46('0x2f')]=_[_0x7a46('0x30')](_0x4de5ec['model'],_0x4de5ec[_0x7a46('0x28')]);_0x47dac3['attributes']=_['intersection'](_0x4de5ec[_0x7a46('0x2d')],qs['fields'](_0x42c88d[_0x7a46('0x28')][_0x7a46('0x43')]));_0x47dac3[_0x7a46('0x31')]=_0x47dac3[_0x7a46('0x31')][_0x7a46('0x44')]?_0x47dac3[_0x7a46('0x31')]:_0x4de5ec[_0x7a46('0x2d')];_0x47dac3['order']=qs[_0x7a46('0x46')](_0x42c88d[_0x7a46('0x28')][_0x7a46('0x46')]);_0x47dac3[_0x7a46('0x26')]=qs['filters'](_[_0x7a46('0x47')](_0x42c88d[_0x7a46('0x28')],_0x4de5ec[_0x7a46('0x2f')]));if(_0x42c88d[_0x7a46('0x28')][_0x7a46('0x48')]){_0x47dac3['where']=_['merge'](_0x47dac3['where'],{'$or':_[_0x7a46('0x1f')](_0x47dac3[_0x7a46('0x31')],function(_0x12a754){var _0x44d348={};_0x44d348[_0x12a754]={'$like':'%'+_0x42c88d[_0x7a46('0x28')][_0x7a46('0x48')]+'%'};return _0x44d348;})});}_0x47dac3=_[_0x7a46('0x33')]({},_0x47dac3,_0x42c88d['options']);return _0x5bbd64[_0x7a46('0x77')](_0x47dac3);}})[_0x7a46('0x17')](function(_0x5ecf5d){if(_0x5ecf5d){_0xf64c0d=_0x5ecf5d['length'];if(!_0x42c88d[_0x7a46('0x28')][_0x7a46('0x52')](_0x7a46('0x45'))){_0x47dac3['limit']=qs[_0x7a46('0x12')](_0x42c88d['query']['limit']);_0x47dac3[_0x7a46('0x14')]=qs[_0x7a46('0x14')](_0x42c88d[_0x7a46('0x28')][_0x7a46('0x14')]);}return _0x5bbd64[_0x7a46('0x77')](_0x47dac3);}})['then'](function(_0x304e8e){if(_0x304e8e){return _0x304e8e?{'count':_0xf64c0d,'rows':_0x304e8e}:null;}})[_0x7a46('0x17')](respondWithResult(_0x2169dd,null))['catch'](handleError(_0x2169dd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8a1590e..dd5f3cf 100644 --- a/server/api/openchannelQueue/openchannelQueue.events.js +++ b/server/api/openchannelQueue/openchannelQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c6b=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x528b6e,_0x1e2cce){var _0x2e04b5=function(_0x437c00){while(--_0x437c00){_0x528b6e['push'](_0x528b6e['shift']());}};_0x2e04b5(++_0x1e2cce);}(_0x3c6b,0x156));var _0xb3c6=function(_0x3defff,_0x1fd23d){_0x3defff=_0x3defff-0x0;var _0x42c62a=_0x3c6b[_0x3defff];return _0x42c62a;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0xb3c6('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb3c6('0x1')](0x0);var events={'afterCreate':_0xb3c6('0x2'),'afterUpdate':_0xb3c6('0x3'),'afterDestroy':_0xb3c6('0x4')};function emitEvent(_0x425152){return function(_0x157c66,_0x161924,_0x421b79){OpenchannelQueueEvents[_0xb3c6('0x5')](_0x425152+':'+_0x157c66['id'],_0x157c66);OpenchannelQueueEvents[_0xb3c6('0x5')](_0x425152,_0x157c66);_0x421b79(null);};}for(var e in events){if(events[_0xb3c6('0x6')](e)){var event=events[e];OpenchannelQueue[_0xb3c6('0x7')](e,emitEvent(event));}}module[_0xb3c6('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xf1e6=['update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue'];(function(_0x36868e,_0x59e0d1){var _0x203aa0=function(_0xe24a30){while(--_0xe24a30){_0x36868e['push'](_0x36868e['shift']());}};_0x203aa0(++_0x59e0d1);}(_0xf1e6,0x166));var _0x6f1e=function(_0x2f2d88,_0x32815c){_0x2f2d88=_0x2f2d88-0x0;var _0x4742ee=_0xf1e6[_0x2f2d88];return _0x4742ee;};'use strict';var EventEmitter=require(_0x6f1e('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x6f1e('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f1e('0x2'),'afterDestroy':_0x6f1e('0x3')};function emitEvent(_0x4093bc){return function(_0x26f3d2,_0x9f2400,_0xc0d6bf){OpenchannelQueueEvents[_0x6f1e('0x4')](_0x4093bc+':'+_0x26f3d2['id'],_0x26f3d2);OpenchannelQueueEvents['emit'](_0x4093bc,_0x26f3d2);_0xc0d6bf(null);};}for(var e in events){if(events[_0x6f1e('0x5')](e)){var event=events[e];OpenchannelQueue[_0x6f1e('0x6')](e,emitEvent(event));}}module[_0x6f1e('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9a19903..a2fc476 100644 --- a/server/api/openchannelQueue/openchannelQueue.model.js +++ b/server/api/openchannelQueue/openchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e8c=['./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x41d2ad,_0x3126e0){var _0x50f082=function(_0x1565a1){while(--_0x1565a1){_0x41d2ad['push'](_0x41d2ad['shift']());}};_0x50f082(++_0x3126e0);}(_0x7e8c,0xea));var _0xc7e8=function(_0x47a3b1,_0x492f7b){_0x47a3b1=_0x47a3b1-0x0;var _0xac41a7=_0x7e8c[_0x47a3b1];return _0xac41a7;};'use strict';var _=require(_0xc7e8('0x0'));var util=require(_0xc7e8('0x1'));var logger=require(_0xc7e8('0x2'))('api');var moment=require(_0xc7e8('0x3'));var BPromise=require(_0xc7e8('0x4'));var rp=require(_0xc7e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7e8('0x6'));var config=require(_0xc7e8('0x7'));var attributes=require(_0xc7e8('0x8'));module['exports']=function(_0x1db1a3,_0x5b3cff){return _0x1db1a3['define'](_0xc7e8('0x9'),attributes,{'tableName':_0xc7e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe49c=['request-promise','path','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x269060,_0x397d2b){var _0x9c43b1=function(_0x24e5e9){while(--_0x24e5e9){_0x269060['push'](_0x269060['shift']());}};_0x9c43b1(++_0x397d2b);}(_0xe49c,0x1c2));var _0xce49=function(_0x5e5c7b,_0x2495a3){_0x5e5c7b=_0x5e5c7b-0x0;var _0x3f947f=_0xe49c[_0x5e5c7b];return _0x3f947f;};'use strict';var _=require(_0xce49('0x0'));var util=require(_0xce49('0x1'));var logger=require(_0xce49('0x2'))(_0xce49('0x3'));var moment=require(_0xce49('0x4'));var BPromise=require(_0xce49('0x5'));var rp=require(_0xce49('0x6'));var fs=require('fs');var path=require(_0xce49('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xce49('0x8'));module[_0xce49('0x9')]=function(_0x5214c4,_0x48e1b9){return _0x5214c4[_0xce49('0xa')]('OpenchannelQueue',attributes,{'tableName':_0xce49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 9a896ec..ae6e00d 100644 --- a/server/api/openchannelQueue/openchannelQueue.rpc.js +++ b/server/api/openchannelQueue/openchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d4c=['options','raw','limit','include','map','model','attributes','then','ShowOpenchannelQueue','find','where','util','moment','bluebird','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x0d4c,0x10e));var _0xc0d4=function(_0x35c575,_0x3b57a7){_0x35c575=_0x35c575-0x0;var _0x1dee06=_0x0d4c[_0x35c575];return _0x1dee06;};'use strict';var _=require('lodash');var util=require(_0xc0d4('0x0'));var moment=require(_0xc0d4('0x1'));var BPromise=require(_0xc0d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc0d4('0x3'));var config=require(_0xc0d4('0x4'));var jayson=require(_0xc0d4('0x5'));var client=jayson[_0xc0d4('0x6')]['http']({'port':0x232a});config[_0xc0d4('0x7')]=_[_0xc0d4('0x8')](config[_0xc0d4('0x7')],{'host':_0xc0d4('0x9'),'port':0x18eb});var socket=require(_0xc0d4('0xa'))(new Redis(config['redis']));require(_0xc0d4('0xb'))[_0xc0d4('0xc')](socket);function respondWithRpcPromise(_0x36c416,_0x32bdc3,_0x2574cb){return new BPromise(function(_0x20bae7,_0xc9fda4){return client[_0xc0d4('0xd')](_0x36c416,_0x2574cb)['then'](function(_0x411e28){logger[_0xc0d4('0xe')](_0xc0d4('0xf'),_0x32bdc3,_0xc0d4('0x10'));logger[_0xc0d4('0x11')](_0xc0d4('0x12'),_0x32bdc3,_0xc0d4('0x10'),JSON[_0xc0d4('0x13')](_0x411e28));if(_0x411e28[_0xc0d4('0x14')]){if(_0x411e28[_0xc0d4('0x14')]['code']===0x1f4){logger[_0xc0d4('0x14')](_0xc0d4('0xf'),_0x32bdc3,_0x411e28[_0xc0d4('0x14')][_0xc0d4('0x15')]);return _0xc9fda4(_0x411e28[_0xc0d4('0x14')][_0xc0d4('0x15')]);}logger[_0xc0d4('0x14')](_0xc0d4('0xf'),_0x32bdc3,_0x411e28[_0xc0d4('0x14')][_0xc0d4('0x15')]);return _0x20bae7(_0x411e28[_0xc0d4('0x14')][_0xc0d4('0x15')]);}else{logger[_0xc0d4('0xe')](_0xc0d4('0xf'),_0x32bdc3,_0xc0d4('0x10'));_0x20bae7(_0x411e28['result']['message']);}})[_0xc0d4('0x16')](function(_0x16f845){logger[_0xc0d4('0x14')](_0xc0d4('0xf'),_0x32bdc3,_0x16f845);_0xc9fda4(_0x16f845);});});}exports[_0xc0d4('0x17')]=function(_0x4b6c41){var _0xe750c0=this;return new Promise(function(_0x4bd88c,_0x29116d){return db[_0xc0d4('0x18')][_0xc0d4('0x19')]({'raw':_0x4b6c41[_0xc0d4('0x1a')]?_0x4b6c41[_0xc0d4('0x1a')][_0xc0d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b6c41[_0xc0d4('0x1a')]?_0x4b6c41['options']['where']||null:null,'attributes':_0x4b6c41[_0xc0d4('0x1a')]?_0x4b6c41[_0xc0d4('0x1a')]['attributes']||null:null,'limit':_0x4b6c41['options']?_0x4b6c41[_0xc0d4('0x1a')][_0xc0d4('0x1c')]||null:null,'include':_0x4b6c41[_0xc0d4('0x1a')]?_0x4b6c41['options'][_0xc0d4('0x1d')]?_[_0xc0d4('0x1e')](_0x4b6c41[_0xc0d4('0x1a')]['include'],function(_0x1d9a8a){return{'model':db[_0x1d9a8a[_0xc0d4('0x1f')]],'as':_0x1d9a8a['as'],'attributes':_0x1d9a8a[_0xc0d4('0x20')],'include':_0x1d9a8a['include']?_[_0xc0d4('0x1e')](_0x1d9a8a[_0xc0d4('0x1d')],function(_0x29711a){return{'model':db[_0x29711a['model']],'as':_0x29711a['as'],'attributes':_0x29711a['attributes'],'include':_0x29711a[_0xc0d4('0x1d')]?_[_0xc0d4('0x1e')](_0x29711a['include'],function(_0x5d0997){return{'model':db[_0x5d0997['model']],'as':_0x5d0997['as'],'attributes':_0x5d0997[_0xc0d4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc0d4('0x21')](function(_0x8c9e34){logger[_0xc0d4('0xe')]('GetOpenchannelQueue',_0x4b6c41);logger[_0xc0d4('0x11')](_0xc0d4('0x17'),_0x4b6c41,JSON['stringify'](_0x8c9e34));_0x4bd88c(_0x8c9e34);})[_0xc0d4('0x16')](function(_0x4f0348){logger[_0xc0d4('0x14')](_0xc0d4('0x17'),_0x4f0348['message'],_0x4b6c41);_0x29116d(_0xe750c0[_0xc0d4('0x14')](0x1f4,_0x4f0348[_0xc0d4('0x15')]));});});};exports[_0xc0d4('0x22')]=function(_0x28e104){var _0x34e028=this;return new Promise(function(_0x30b4de,_0x49fd58){return db['OpenchannelQueue'][_0xc0d4('0x23')]({'raw':_0x28e104[_0xc0d4('0x1a')]?_0x28e104[_0xc0d4('0x1a')][_0xc0d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x28e104[_0xc0d4('0x1a')]?_0x28e104[_0xc0d4('0x1a')][_0xc0d4('0x24')]||null:null,'attributes':_0x28e104[_0xc0d4('0x1a')]?_0x28e104[_0xc0d4('0x1a')][_0xc0d4('0x20')]||null:null,'include':_0x28e104[_0xc0d4('0x1a')]?_0x28e104['options'][_0xc0d4('0x1d')]?_[_0xc0d4('0x1e')](_0x28e104['options'][_0xc0d4('0x1d')],function(_0x1be8e9){return{'model':db[_0x1be8e9[_0xc0d4('0x1f')]],'as':_0x1be8e9['as'],'attributes':_0x1be8e9[_0xc0d4('0x20')],'include':_0x1be8e9['include']?_[_0xc0d4('0x1e')](_0x1be8e9[_0xc0d4('0x1d')],function(_0x2bda5f){return{'model':db[_0x2bda5f[_0xc0d4('0x1f')]],'as':_0x2bda5f['as'],'attributes':_0x2bda5f[_0xc0d4('0x20')],'include':_0x2bda5f[_0xc0d4('0x1d')]?_[_0xc0d4('0x1e')](_0x2bda5f['include'],function(_0x217159){return{'model':db[_0x217159[_0xc0d4('0x1f')]],'as':_0x217159['as'],'attributes':_0x217159[_0xc0d4('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x955f6){logger[_0xc0d4('0xe')](_0xc0d4('0x22'),_0x28e104);logger['debug'](_0xc0d4('0x22'),_0x28e104,JSON[_0xc0d4('0x13')](_0x955f6));_0x30b4de(_0x955f6);})[_0xc0d4('0x16')](function(_0x49274){logger[_0xc0d4('0x14')](_0xc0d4('0x22'),_0x49274[_0xc0d4('0x15')],_0x28e104);_0x49fd58(_0x34e028[_0xc0d4('0x14')](0x1f4,_0x49274[_0xc0d4('0x15')]));});});}; \ No newline at end of file +var _0x3358=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','info','request\x20sent','stringify','error','message','OpenchannelQueue,\x20%s,\x20%s','result','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','debug','catch','ShowOpenchannelQueue','find'];(function(_0x409b55,_0x200536){var _0x35449f=function(_0xf8888d){while(--_0xf8888d){_0x409b55['push'](_0x409b55['shift']());}};_0x35449f(++_0x200536);}(_0x3358,0xc3));var _0x8335=function(_0x2ae612,_0x1c0ceb){_0x2ae612=_0x2ae612-0x0;var _0xfaabb9=_0x3358[_0x2ae612];return _0xfaabb9;};'use strict';var _=require(_0x8335('0x0'));var util=require(_0x8335('0x1'));var moment=require(_0x8335('0x2'));var BPromise=require(_0x8335('0x3'));var rs=require(_0x8335('0x4'));var fs=require('fs');var Redis=require(_0x8335('0x5'));var db=require(_0x8335('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8335('0x7'))(_0x8335('0x8'));var config=require(_0x8335('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x8335('0xa')]=_[_0x8335('0xb')](config['redis'],{'host':_0x8335('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8335('0xa')]));require(_0x8335('0xd'))[_0x8335('0xe')](socket);function respondWithRpcPromise(_0x496ec1,_0x44d038,_0x5278b8){return new BPromise(function(_0x37dc0f,_0x3bca04){return client[_0x8335('0xf')](_0x496ec1,_0x5278b8)[_0x8335('0x10')](function(_0x388769){logger[_0x8335('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x44d038,_0x8335('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x44d038,_0x8335('0x12'),JSON[_0x8335('0x13')](_0x388769));if(_0x388769['error']){if(_0x388769[_0x8335('0x14')]['code']===0x1f4){logger[_0x8335('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x44d038,_0x388769['error']['message']);return _0x3bca04(_0x388769[_0x8335('0x14')][_0x8335('0x15')]);}logger[_0x8335('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x44d038,_0x388769[_0x8335('0x14')][_0x8335('0x15')]);return _0x37dc0f(_0x388769[_0x8335('0x14')]['message']);}else{logger[_0x8335('0x11')](_0x8335('0x16'),_0x44d038,'request\x20sent');_0x37dc0f(_0x388769[_0x8335('0x17')][_0x8335('0x15')]);}})['catch'](function(_0x342ad7){logger['error'](_0x8335('0x16'),_0x44d038,_0x342ad7);_0x3bca04(_0x342ad7);});});}exports['GetOpenchannelQueue']=function(_0x5811f1){var _0x2a6511=this;return new Promise(function(_0x1f046d,_0x50d5a7){return db[_0x8335('0x18')][_0x8335('0x19')]({'raw':_0x5811f1[_0x8335('0x1a')]?_0x5811f1['options'][_0x8335('0x1b')]===undefined?!![]:![]:!![],'where':_0x5811f1['options']?_0x5811f1[_0x8335('0x1a')][_0x8335('0x1c')]||null:null,'attributes':_0x5811f1[_0x8335('0x1a')]?_0x5811f1[_0x8335('0x1a')][_0x8335('0x1d')]||null:null,'limit':_0x5811f1[_0x8335('0x1a')]?_0x5811f1['options'][_0x8335('0x1e')]||null:null,'include':_0x5811f1[_0x8335('0x1a')]?_0x5811f1['options'][_0x8335('0x1f')]?_[_0x8335('0x20')](_0x5811f1[_0x8335('0x1a')][_0x8335('0x1f')],function(_0xa17690){return{'model':db[_0xa17690['model']],'as':_0xa17690['as'],'attributes':_0xa17690[_0x8335('0x1d')],'include':_0xa17690[_0x8335('0x1f')]?_[_0x8335('0x20')](_0xa17690[_0x8335('0x1f')],function(_0x69345e){return{'model':db[_0x69345e[_0x8335('0x21')]],'as':_0x69345e['as'],'attributes':_0x69345e[_0x8335('0x1d')],'include':_0x69345e[_0x8335('0x1f')]?_[_0x8335('0x20')](_0x69345e['include'],function(_0x49c1b7){return{'model':db[_0x49c1b7[_0x8335('0x21')]],'as':_0x49c1b7['as'],'attributes':_0x49c1b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8335('0x10')](function(_0xdf5776){logger[_0x8335('0x11')](_0x8335('0x22'),_0x5811f1);logger[_0x8335('0x23')](_0x8335('0x22'),_0x5811f1,JSON['stringify'](_0xdf5776));_0x1f046d(_0xdf5776);})[_0x8335('0x24')](function(_0x3af910){logger[_0x8335('0x14')](_0x8335('0x22'),_0x3af910[_0x8335('0x15')],_0x5811f1);_0x50d5a7(_0x2a6511[_0x8335('0x14')](0x1f4,_0x3af910[_0x8335('0x15')]));});});};exports[_0x8335('0x25')]=function(_0x359114){var _0x524b10=this;return new Promise(function(_0x5b7c2d,_0x58f7e7){return db[_0x8335('0x18')][_0x8335('0x26')]({'raw':_0x359114[_0x8335('0x1a')]?_0x359114[_0x8335('0x1a')][_0x8335('0x1b')]===undefined?!![]:![]:!![],'where':_0x359114[_0x8335('0x1a')]?_0x359114[_0x8335('0x1a')][_0x8335('0x1c')]||null:null,'attributes':_0x359114[_0x8335('0x1a')]?_0x359114[_0x8335('0x1a')][_0x8335('0x1d')]||null:null,'include':_0x359114['options']?_0x359114[_0x8335('0x1a')][_0x8335('0x1f')]?_[_0x8335('0x20')](_0x359114[_0x8335('0x1a')][_0x8335('0x1f')],function(_0x3f4f4f){return{'model':db[_0x3f4f4f[_0x8335('0x21')]],'as':_0x3f4f4f['as'],'attributes':_0x3f4f4f[_0x8335('0x1d')],'include':_0x3f4f4f[_0x8335('0x1f')]?_[_0x8335('0x20')](_0x3f4f4f['include'],function(_0x282d33){return{'model':db[_0x282d33[_0x8335('0x21')]],'as':_0x282d33['as'],'attributes':_0x282d33[_0x8335('0x1d')],'include':_0x282d33['include']?_[_0x8335('0x20')](_0x282d33[_0x8335('0x1f')],function(_0x18536e){return{'model':db[_0x18536e['model']],'as':_0x18536e['as'],'attributes':_0x18536e['attributes']};}):[]};}):[]};}):[]:[]})[_0x8335('0x10')](function(_0x243bb4){logger[_0x8335('0x11')](_0x8335('0x25'),_0x359114);logger[_0x8335('0x23')]('ShowOpenchannelQueue',_0x359114,JSON[_0x8335('0x13')](_0x243bb4));_0x5b7c2d(_0x243bb4);})[_0x8335('0x24')](function(_0x380884){logger[_0x8335('0x14')](_0x8335('0x25'),_0x380884['message'],_0x359114);_0x58f7e7(_0x524b10[_0x8335('0x14')](0x1f4,_0x380884[_0x8335('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b8fcb64..44ade6c 100644 --- a/server/api/openchannelQueue/openchannelQueue.socket.js +++ b/server/api/openchannelQueue/openchannelQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf590=['openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','length'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xf590,0xcc));var _0x0f59=function(_0xdd6f7f,_0x3f6265){_0xdd6f7f=_0xdd6f7f-0x0;var _0xa10222=_0xf590[_0xdd6f7f];return _0xa10222;};'use strict';var OpenchannelQueueEvents=require(_0x0f59('0x0'));var events=[_0x0f59('0x1'),'remove',_0x0f59('0x2')];function createListener(_0x14eff6,_0x52107b){return function(_0x288eac){_0x52107b[_0x0f59('0x3')](_0x14eff6,_0x288eac);};}function removeListener(_0x36bbf0,_0xbff722){return function(){OpenchannelQueueEvents[_0x0f59('0x4')](_0x36bbf0,_0xbff722);};}exports['register']=function(_0x45e25f){for(var _0x48d992=0x0,_0x4bf238=events[_0x0f59('0x5')];_0x48d992<_0x4bf238;_0x48d992++){var _0x423614=events[_0x48d992];var _0x5b0c00=createListener(_0x0f59('0x6')+_0x423614,_0x45e25f);OpenchannelQueueEvents['on'](_0x423614,_0x5b0c00);}}; \ No newline at end of file +var _0xc3bf=['update','emit','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x5d15d5,_0x549591){var _0x47bb06=function(_0x1d16f9){while(--_0x1d16f9){_0x5d15d5['push'](_0x5d15d5['shift']());}};_0x47bb06(++_0x549591);}(_0xc3bf,0x19d));var _0xfc3b=function(_0x46becf,_0x14443c){_0x46becf=_0x46becf-0x0;var _0x315605=_0xc3bf[_0x46becf];return _0x315605;};'use strict';var OpenchannelQueueEvents=require(_0xfc3b('0x0'));var events=[_0xfc3b('0x1'),_0xfc3b('0x2'),_0xfc3b('0x3')];function createListener(_0x50c287,_0x38d060){return function(_0x4975c4){_0x38d060[_0xfc3b('0x4')](_0x50c287,_0x4975c4);};}function removeListener(_0x10b531,_0x22155f){return function(){OpenchannelQueueEvents['removeListener'](_0x10b531,_0x22155f);};}exports[_0xfc3b('0x5')]=function(_0x15d381){for(var _0x444edb=0x0,_0xf38d8f=events[_0xfc3b('0x6')];_0x444edb<_0xf38d8f;_0x444edb++){var _0x17043d=events[_0x444edb];var _0x3dc26f=createListener(_0xfc3b('0x7')+_0x17043d,_0x15d381);OpenchannelQueueEvents['on'](_0x17043d,_0x3dc26f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7f6b6e9..4cc2ae8 100644 --- a/server/api/openchannelQueueReport/index.js +++ b/server/api/openchannelQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18d8=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x18d8,0x1c3));var _0x818d=function(_0x423eba,_0x275383){_0x423eba=_0x423eba-0x0;var _0x4adb55=_0x18d8[_0x423eba];return _0x4adb55;};'use strict';var multer=require(_0x818d('0x0'));var util=require(_0x818d('0x1'));var path=require(_0x818d('0x2'));var timeout=require(_0x818d('0x3'));var express=require(_0x818d('0x4'));var router=express[_0x818d('0x5')]();var fs_extra=require(_0x818d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x818d('0x7'));var config=require(_0x818d('0x8'));var controller=require(_0x818d('0x9'));router[_0x818d('0xa')]('/',auth[_0x818d('0xb')](),controller[_0x818d('0xc')]);router[_0x818d('0xa')](_0x818d('0xd'),auth[_0x818d('0xb')](),controller[_0x818d('0xe')]);router[_0x818d('0xa')](_0x818d('0xf'),auth['isAuthenticated'](),controller[_0x818d('0x10')]);router[_0x818d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x818d('0x12')](_0x818d('0xf'),auth[_0x818d('0xb')](),controller[_0x818d('0x13')]);router[_0x818d('0x14')](_0x818d('0xf'),auth['isAuthenticated'](),controller[_0x818d('0x15')]);module[_0x818d('0x16')]=router; \ No newline at end of file +var _0x0141=['connect-timeout','express','fs-extra','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','describe','/:id','post','create','put','update','delete','destroy','exports','util'];(function(_0x1a06c4,_0x17d0e0){var _0x1bf57b=function(_0x2c11fa){while(--_0x2c11fa){_0x1a06c4['push'](_0x1a06c4['shift']());}};_0x1bf57b(++_0x17d0e0);}(_0x0141,0x186));var _0x1014=function(_0x1c50fa,_0x1f68da){_0x1c50fa=_0x1c50fa-0x0;var _0x5ae043=_0x0141[_0x1c50fa];return _0x5ae043;};'use strict';var multer=require('multer');var util=require(_0x1014('0x0'));var path=require('path');var timeout=require(_0x1014('0x1'));var express=require(_0x1014('0x2'));var router=express['Router']();var fs_extra=require(_0x1014('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1014('0x4'));var controller=require(_0x1014('0x5'));router['get']('/',auth[_0x1014('0x6')](),controller['index']);router[_0x1014('0x7')]('/describe',auth[_0x1014('0x6')](),controller[_0x1014('0x8')]);router['get'](_0x1014('0x9'),auth[_0x1014('0x6')](),controller['show']);router[_0x1014('0xa')]('/',auth[_0x1014('0x6')](),controller[_0x1014('0xb')]);router[_0x1014('0xc')](_0x1014('0x9'),auth[_0x1014('0x6')](),controller[_0x1014('0xd')]);router[_0x1014('0xe')]('/:id',auth[_0x1014('0x6')](),controller[_0x1014('0xf')]);module[_0x1014('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1738f39..b5fca0b 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9f4=['DATE','moment','sequelize','exports','STRING'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf9f4,0x1be));var _0x4f9f=function(_0x44ec0c,_0x4d8830){_0x44ec0c=_0x44ec0c-0x0;var _0x2d92f4=_0xf9f4[_0x44ec0c];return _0x2d92f4;};'use strict';var moment=require(_0x4f9f('0x0'));var Sequelize=require(_0x4f9f('0x1'));module[_0x4f9f('0x2')]={'uniqueid':{'type':Sequelize[_0x4f9f('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4f9f('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4f9f('0x4')]},'exitAt':{'type':Sequelize[_0x4f9f('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd70b=['sequelize','exports','STRING','DATE','moment'];(function(_0x3a03d8,_0x540967){var _0x18d25b=function(_0x94bad0){while(--_0x94bad0){_0x3a03d8['push'](_0x3a03d8['shift']());}};_0x18d25b(++_0x540967);}(_0xd70b,0x17b));var _0xbd70=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xd70b[_0x11a220];return _0x20d8fe;};'use strict';var moment=require(_0xbd70('0x0'));var Sequelize=require(_0xbd70('0x1'));module[_0xbd70('0x2')]={'uniqueid':{'type':Sequelize[_0xbd70('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbd70('0x3')]},'joinAt':{'type':Sequelize[_0xbd70('0x4')]},'leaveAt':{'type':Sequelize[_0xbd70('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbd70('0x4')]},'reason':{'type':Sequelize[_0xbd70('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f1e0dc1..a033792 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa83e=['rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','OpenchannelQueueReport','includeAll','findAll','rows','catch','show','params','length','include','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index'];(function(_0x336df4,_0x52c1dc){var _0x580d8c=function(_0x2febf1){while(--_0x2febf1){_0x336df4['push'](_0x336df4['shift']());}};_0x580d8c(++_0x52c1dc);}(_0xa83e,0xb3));var _0xea83=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xa83e[_0x29e3b6];return _0x55d4b0;};'use strict';var emlformat=require(_0xea83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea83('0x1'));var jsonpatch=require(_0xea83('0x2'));var rp=require(_0xea83('0x3'));var moment=require(_0xea83('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea83('0x5'));var util=require('util');var path=require(_0xea83('0x6'));var sox=require(_0xea83('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea83('0x8'));var _=require('lodash');var squel=require(_0xea83('0x9'));var crypto=require('crypto');var jsforce=require(_0xea83('0xa'));var deskjs=require(_0xea83('0xb'));var toCsv=require(_0xea83('0xc'));var querystring=require(_0xea83('0xd'));var Papa=require(_0xea83('0xe'));var Redis=require('ioredis');var authService=require(_0xea83('0xf'));var qs=require(_0xea83('0x10'));var as=require(_0xea83('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xea83('0x12'));var config=require(_0xea83('0x13'));var licenseUtil=require(_0xea83('0x14'));var db=require(_0xea83('0x15'))['db'];function respondWithStatusCode(_0x1da7b2,_0x243534){_0x243534=_0x243534||0xcc;return function(_0x52b034){if(_0x52b034){return _0x1da7b2['sendStatus'](_0x243534);}return _0x1da7b2['status'](_0x243534)['end']();};}function respondWithResult(_0x1922de,_0x293299){_0x293299=_0x293299||0xc8;return function(_0x4b639f){if(_0x4b639f){return _0x1922de[_0xea83('0x16')](_0x293299)[_0xea83('0x17')](_0x4b639f);}};}function respondWithFilteredResult(_0x1668b6,_0x38bc98){return function(_0x5886c1){if(_0x5886c1){var _0x25d948=typeof _0x38bc98[_0xea83('0x18')]==='undefined'&&typeof _0x38bc98[_0xea83('0x19')]===_0xea83('0x1a');var _0x1b154e=_0x5886c1[_0xea83('0x1b')];var _0x4ae65a=_0x25d948?0x0:_0x38bc98[_0xea83('0x18')];var _0xad861a=_0x25d948?_0x5886c1[_0xea83('0x1b')]:_0x38bc98[_0xea83('0x18')]+_0x38bc98[_0xea83('0x19')];var _0x3fcdb7;if(_0xad861a>=_0x1b154e){_0xad861a=_0x1b154e;_0x3fcdb7=0xc8;}else{_0x3fcdb7=0xce;}_0x1668b6[_0xea83('0x16')](_0x3fcdb7);return _0x1668b6[_0xea83('0x1c')](_0xea83('0x1d'),_0x4ae65a+'-'+_0xad861a+'/'+_0x1b154e)[_0xea83('0x17')](_0x5886c1);}return null;};}function patchUpdates(_0x12a0b0){return function(_0x355f6d){try{jsonpatch[_0xea83('0x1e')](_0x355f6d,_0x12a0b0,!![]);}catch(_0x118514){return BPromise[_0xea83('0x1f')](_0x118514);}return _0x355f6d[_0xea83('0x20')]();};}function saveUpdates(_0x432754,_0x1891fb){return function(_0x42e843){if(_0x42e843){return _0x42e843[_0xea83('0x21')](_0x432754)[_0xea83('0x22')](function(_0x1700be){return _0x1700be;});}return null;};}function removeEntity(_0x136bcd,_0x49fe09){return function(_0x4d3105){if(_0x4d3105){return _0x4d3105[_0xea83('0x23')]()[_0xea83('0x22')](function(){_0x136bcd['status'](0xcc)[_0xea83('0x24')]();});}};}function handleEntityNotFound(_0x385f1a,_0x389b16){return function(_0x545c9b){if(!_0x545c9b){_0x385f1a[_0xea83('0x25')](0x194);}return _0x545c9b;};}function handleError(_0x3c42a0,_0x3df2e2){_0x3df2e2=_0x3df2e2||0x1f4;return function(_0x4d62a8){logger[_0xea83('0x26')](_0x4d62a8[_0xea83('0x27')]);if(_0x4d62a8[_0xea83('0x28')]){delete _0x4d62a8[_0xea83('0x28')];}_0x3c42a0[_0xea83('0x16')](_0x3df2e2)[_0xea83('0x29')](_0x4d62a8);};}exports[_0xea83('0x2a')]=function(_0x1b0a68,_0x5c328f){var _0x302b1a={},_0x545220={},_0xf38150={'count':0x0,'rows':[]};var _0x53c68=_['map'](db['OpenchannelQueueReport'][_0xea83('0x2b')],function(_0x4b4f68){return{'name':_0x4b4f68[_0xea83('0x2c')],'type':_0x4b4f68['type']['key']};});_0x545220[_0xea83('0x2d')]=_[_0xea83('0x2e')](_0x53c68,_0xea83('0x28'));_0x545220[_0xea83('0x2f')]=_[_0xea83('0x30')](_0x1b0a68[_0xea83('0x2f')]);_0x545220[_0xea83('0x31')]=_[_0xea83('0x32')](_0x545220['model'],_0x545220[_0xea83('0x2f')]);_0x302b1a['attributes']=_[_0xea83('0x32')](_0x545220[_0xea83('0x2d')],qs[_0xea83('0x33')](_0x1b0a68[_0xea83('0x2f')][_0xea83('0x33')]));_0x302b1a['attributes']=_0x302b1a[_0xea83('0x34')]['length']?_0x302b1a[_0xea83('0x34')]:_0x545220[_0xea83('0x2d')];if(!_0x1b0a68['query'][_0xea83('0x35')]('nolimit')){_0x302b1a[_0xea83('0x19')]=qs[_0xea83('0x19')](_0x1b0a68[_0xea83('0x2f')][_0xea83('0x19')]);_0x302b1a[_0xea83('0x18')]=qs[_0xea83('0x18')](_0x1b0a68[_0xea83('0x2f')][_0xea83('0x18')]);}_0x302b1a[_0xea83('0x36')]=qs[_0xea83('0x37')](_0x1b0a68[_0xea83('0x2f')][_0xea83('0x37')]);_0x302b1a[_0xea83('0x38')]=qs[_0xea83('0x31')](_['pick'](_0x1b0a68[_0xea83('0x2f')],_0x545220['filters']),_0x53c68);if(_0x1b0a68['query'][_0xea83('0x39')]){_0x302b1a[_0xea83('0x38')]=_[_0xea83('0x3a')](_0x302b1a['where'],{'$or':_['map'](_0x53c68,function(_0x393d32){if(_0x393d32['type']!==_0xea83('0x3b')){var _0x45a64c={};_0x45a64c[_0x393d32['name']]={'$like':'%'+_0x1b0a68[_0xea83('0x2f')][_0xea83('0x39')]+'%'};return _0x45a64c;}})});}_0x302b1a=_[_0xea83('0x3a')]({},_0x302b1a,_0x1b0a68['options']);var _0x4c400d={'where':_0x302b1a[_0xea83('0x38')]};return db[_0xea83('0x3c')][_0xea83('0x1b')](_0x4c400d)[_0xea83('0x22')](function(_0x2a1d46){_0xf38150['count']=_0x2a1d46;if(_0x1b0a68[_0xea83('0x2f')][_0xea83('0x3d')]){_0x302b1a['include']=[{'all':!![]}];}return db[_0xea83('0x3c')][_0xea83('0x3e')](_0x302b1a);})['then'](function(_0x49b9ee){_0xf38150[_0xea83('0x3f')]=_0x49b9ee;return _0xf38150;})[_0xea83('0x22')](respondWithFilteredResult(_0x5c328f,_0x302b1a))[_0xea83('0x40')](handleError(_0x5c328f,null));};exports[_0xea83('0x41')]=function(_0x5729fb,_0x214adb){var _0x1639d2={'raw':!![],'where':{'id':_0x5729fb[_0xea83('0x42')]['id']}},_0x1bc69b={};_0x1bc69b[_0xea83('0x2d')]=_[_0xea83('0x30')](db[_0xea83('0x3c')][_0xea83('0x2b')]);_0x1bc69b[_0xea83('0x2f')]=_[_0xea83('0x30')](_0x5729fb[_0xea83('0x2f')]);_0x1bc69b[_0xea83('0x31')]=_[_0xea83('0x32')](_0x1bc69b[_0xea83('0x2d')],_0x1bc69b[_0xea83('0x2f')]);_0x1639d2[_0xea83('0x34')]=_[_0xea83('0x32')](_0x1bc69b[_0xea83('0x2d')],qs[_0xea83('0x33')](_0x5729fb[_0xea83('0x2f')][_0xea83('0x33')]));_0x1639d2[_0xea83('0x34')]=_0x1639d2[_0xea83('0x34')][_0xea83('0x43')]?_0x1639d2[_0xea83('0x34')]:_0x1bc69b[_0xea83('0x2d')];if(_0x5729fb[_0xea83('0x2f')]['includeAll']){_0x1639d2[_0xea83('0x44')]=[{'all':!![]}];}_0x1639d2=_[_0xea83('0x3a')]({},_0x1639d2,_0x5729fb[_0xea83('0x45')]);return db['OpenchannelQueueReport']['find'](_0x1639d2)[_0xea83('0x22')](handleEntityNotFound(_0x214adb,null))[_0xea83('0x22')](respondWithResult(_0x214adb,null))[_0xea83('0x40')](handleError(_0x214adb,null));};exports[_0xea83('0x46')]=function(_0x2cd17e,_0x4333cf){return db[_0xea83('0x3c')][_0xea83('0x46')](_0x2cd17e[_0xea83('0x47')],{})[_0xea83('0x22')](respondWithResult(_0x4333cf,0xc9))[_0xea83('0x40')](handleError(_0x4333cf,null));};exports[_0xea83('0x21')]=function(_0x5e0559,_0x4d9c25){if(_0x5e0559[_0xea83('0x47')]['id']){delete _0x5e0559['body']['id'];}return db[_0xea83('0x3c')]['find']({'where':{'id':_0x5e0559[_0xea83('0x42')]['id']}})[_0xea83('0x22')](handleEntityNotFound(_0x4d9c25,null))[_0xea83('0x22')](saveUpdates(_0x5e0559['body'],null))[_0xea83('0x22')](respondWithResult(_0x4d9c25,null))[_0xea83('0x40')](handleError(_0x4d9c25,null));};exports[_0xea83('0x23')]=function(_0x28c541,_0x335d88){return db['OpenchannelQueueReport'][_0xea83('0x48')]({'where':{'id':_0x28c541[_0xea83('0x42')]['id']}})[_0xea83('0x22')](handleEntityNotFound(_0x335d88,null))[_0xea83('0x22')](removeEntity(_0x335d88,null))[_0xea83('0x40')](handleError(_0x335d88,null));};exports[_0xea83('0x49')]=function(_0xd19826,_0x3905c2){return db[_0xea83('0x3c')][_0xea83('0x49')]()[_0xea83('0x22')](respondWithResult(_0x3905c2,null))['catch'](handleError(_0x3905c2,null));}; \ No newline at end of file +var _0x94fd=['nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','query','keys','filters','attributes','fields','length','model','hasOwnProperty'];(function(_0x3ef9dc,_0x1ea8cd){var _0x32bb5d=function(_0x3d2c00){while(--_0x3d2c00){_0x3ef9dc['push'](_0x3ef9dc['shift']());}};_0x32bb5d(++_0x1ea8cd);}(_0x94fd,0x13b));var _0xd94f=function(_0x26cf93,_0x163602){_0x26cf93=_0x26cf93-0x0;var _0x519af1=_0x94fd[_0x26cf93];return _0x519af1;};'use strict';var emlformat=require(_0xd94f('0x0'));var rimraf=require(_0xd94f('0x1'));var zipdir=require(_0xd94f('0x2'));var jsonpatch=require(_0xd94f('0x3'));var rp=require(_0xd94f('0x4'));var moment=require(_0xd94f('0x5'));var BPromise=require(_0xd94f('0x6'));var Mustache=require('mustache');var util=require(_0xd94f('0x7'));var path=require('path');var sox=require(_0xd94f('0x8'));var csv=require(_0xd94f('0x9'));var ejs=require(_0xd94f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd94f('0xb'));var squel=require(_0xd94f('0xc'));var crypto=require(_0xd94f('0xd'));var jsforce=require(_0xd94f('0xe'));var deskjs=require(_0xd94f('0xf'));var toCsv=require(_0xd94f('0x9'));var querystring=require(_0xd94f('0x10'));var Papa=require(_0xd94f('0x11'));var Redis=require(_0xd94f('0x12'));var authService=require(_0xd94f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd94f('0x14'));var hardwareService=require(_0xd94f('0x15'));var logger=require('../../config/logger')(_0xd94f('0x16'));var utils=require(_0xd94f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd94f('0x18'));var db=require(_0xd94f('0x19'))['db'];function respondWithStatusCode(_0x452d86,_0x505979){_0x505979=_0x505979||0xcc;return function(_0x444ff6){if(_0x444ff6){return _0x452d86[_0xd94f('0x1a')](_0x505979);}return _0x452d86['status'](_0x505979)[_0xd94f('0x1b')]();};}function respondWithResult(_0x46c46b,_0x49c53c){_0x49c53c=_0x49c53c||0xc8;return function(_0x1cb4ab){if(_0x1cb4ab){return _0x46c46b['status'](_0x49c53c)[_0xd94f('0x1c')](_0x1cb4ab);}};}function respondWithFilteredResult(_0x10a6f7,_0x1918e8){return function(_0x359be2){if(_0x359be2){var _0x1e7e3d=typeof _0x1918e8[_0xd94f('0x1d')]==='undefined'&&typeof _0x1918e8[_0xd94f('0x1e')]==='undefined';var _0xa01799=_0x359be2[_0xd94f('0x1f')];var _0x47e6a5=_0x1e7e3d?0x0:_0x1918e8[_0xd94f('0x1d')];var _0x9af864=_0x1e7e3d?_0x359be2[_0xd94f('0x1f')]:_0x1918e8[_0xd94f('0x1d')]+_0x1918e8['limit'];var _0x528bbc;if(_0x9af864>=_0xa01799){_0x9af864=_0xa01799;_0x528bbc=0xc8;}else{_0x528bbc=0xce;}_0x10a6f7['status'](_0x528bbc);return _0x10a6f7['set'](_0xd94f('0x20'),_0x47e6a5+'-'+_0x9af864+'/'+_0xa01799)[_0xd94f('0x1c')](_0x359be2);}return null;};}function patchUpdates(_0xaf2d2f){return function(_0x193c1d){try{jsonpatch['apply'](_0x193c1d,_0xaf2d2f,!![]);}catch(_0x51b6a7){return BPromise[_0xd94f('0x21')](_0x51b6a7);}return _0x193c1d['save']();};}function saveUpdates(_0x566a64,_0x22b751){return function(_0x5294ba){if(_0x5294ba){return _0x5294ba[_0xd94f('0x22')](_0x566a64)['then'](function(_0x27394d){return _0x27394d;});}return null;};}function removeEntity(_0x2bbf6b,_0x36b8a8){return function(_0x5c0248){if(_0x5c0248){return _0x5c0248[_0xd94f('0x23')]()[_0xd94f('0x24')](function(){_0x2bbf6b['status'](0xcc)[_0xd94f('0x1b')]();});}};}function handleEntityNotFound(_0x2ea0d5,_0x1b634c){return function(_0x15fcd5){if(!_0x15fcd5){_0x2ea0d5[_0xd94f('0x1a')](0x194);}return _0x15fcd5;};}function handleError(_0x11c663,_0xdb1825){_0xdb1825=_0xdb1825||0x1f4;return function(_0x3e7de1){logger[_0xd94f('0x25')](_0x3e7de1[_0xd94f('0x26')]);if(_0x3e7de1[_0xd94f('0x27')]){delete _0x3e7de1[_0xd94f('0x27')];}_0x11c663['status'](_0xdb1825)[_0xd94f('0x28')](_0x3e7de1);};}exports[_0xd94f('0x29')]=function(_0x62a488,_0x103fbc){var _0x1043c7={},_0x4283b6={},_0x3f833e={'count':0x0,'rows':[]};var _0x1bc710=_[_0xd94f('0x2a')](db[_0xd94f('0x2b')][_0xd94f('0x2c')],function(_0x4d9a48){return{'name':_0x4d9a48['fieldName'],'type':_0x4d9a48[_0xd94f('0x2d')][_0xd94f('0x2e')]};});_0x4283b6['model']=_[_0xd94f('0x2a')](_0x1bc710,'name');_0x4283b6[_0xd94f('0x2f')]=_[_0xd94f('0x30')](_0x62a488[_0xd94f('0x2f')]);_0x4283b6[_0xd94f('0x31')]=_['intersection'](_0x4283b6['model'],_0x4283b6[_0xd94f('0x2f')]);_0x1043c7[_0xd94f('0x32')]=_['intersection'](_0x4283b6['model'],qs[_0xd94f('0x33')](_0x62a488[_0xd94f('0x2f')][_0xd94f('0x33')]));_0x1043c7[_0xd94f('0x32')]=_0x1043c7[_0xd94f('0x32')][_0xd94f('0x34')]?_0x1043c7[_0xd94f('0x32')]:_0x4283b6[_0xd94f('0x35')];if(!_0x62a488['query'][_0xd94f('0x36')](_0xd94f('0x37'))){_0x1043c7[_0xd94f('0x1e')]=qs[_0xd94f('0x1e')](_0x62a488[_0xd94f('0x2f')][_0xd94f('0x1e')]);_0x1043c7[_0xd94f('0x1d')]=qs['offset'](_0x62a488[_0xd94f('0x2f')]['offset']);}_0x1043c7['order']=qs[_0xd94f('0x38')](_0x62a488[_0xd94f('0x2f')][_0xd94f('0x38')]);_0x1043c7[_0xd94f('0x39')]=qs[_0xd94f('0x31')](_[_0xd94f('0x3a')](_0x62a488['query'],_0x4283b6['filters']),_0x1bc710);if(_0x62a488['query'][_0xd94f('0x3b')]){_0x1043c7[_0xd94f('0x39')]=_[_0xd94f('0x3c')](_0x1043c7[_0xd94f('0x39')],{'$or':_['map'](_0x1bc710,function(_0x333a37){if(_0x333a37[_0xd94f('0x2d')]!=='VIRTUAL'){var _0x4c0aca={};_0x4c0aca[_0x333a37['name']]={'$like':'%'+_0x62a488[_0xd94f('0x2f')][_0xd94f('0x3b')]+'%'};return _0x4c0aca;}})});}_0x1043c7=_['merge']({},_0x1043c7,_0x62a488[_0xd94f('0x3d')]);var _0x1bbf82={'where':_0x1043c7[_0xd94f('0x39')]};return db['OpenchannelQueueReport'][_0xd94f('0x1f')](_0x1bbf82)[_0xd94f('0x24')](function(_0x39b802){_0x3f833e[_0xd94f('0x1f')]=_0x39b802;if(_0x62a488[_0xd94f('0x2f')]['includeAll']){_0x1043c7[_0xd94f('0x3e')]=[{'all':!![]}];}return db[_0xd94f('0x2b')][_0xd94f('0x3f')](_0x1043c7);})[_0xd94f('0x24')](function(_0x3fb8a0){_0x3f833e[_0xd94f('0x40')]=_0x3fb8a0;return _0x3f833e;})[_0xd94f('0x24')](respondWithFilteredResult(_0x103fbc,_0x1043c7))['catch'](handleError(_0x103fbc,null));};exports[_0xd94f('0x41')]=function(_0x49fb37,_0x4da891){var _0x44169b={'raw':!![],'where':{'id':_0x49fb37[_0xd94f('0x42')]['id']}},_0x3f6f25={};_0x3f6f25[_0xd94f('0x35')]=_[_0xd94f('0x30')](db[_0xd94f('0x2b')][_0xd94f('0x2c')]);_0x3f6f25[_0xd94f('0x2f')]=_[_0xd94f('0x30')](_0x49fb37[_0xd94f('0x2f')]);_0x3f6f25['filters']=_[_0xd94f('0x43')](_0x3f6f25['model'],_0x3f6f25[_0xd94f('0x2f')]);_0x44169b[_0xd94f('0x32')]=_['intersection'](_0x3f6f25[_0xd94f('0x35')],qs['fields'](_0x49fb37['query'][_0xd94f('0x33')]));_0x44169b[_0xd94f('0x32')]=_0x44169b[_0xd94f('0x32')][_0xd94f('0x34')]?_0x44169b[_0xd94f('0x32')]:_0x3f6f25['model'];if(_0x49fb37[_0xd94f('0x2f')][_0xd94f('0x44')]){_0x44169b[_0xd94f('0x3e')]=[{'all':!![]}];}_0x44169b=_[_0xd94f('0x3c')]({},_0x44169b,_0x49fb37[_0xd94f('0x3d')]);return db[_0xd94f('0x2b')][_0xd94f('0x45')](_0x44169b)[_0xd94f('0x24')](handleEntityNotFound(_0x4da891,null))['then'](respondWithResult(_0x4da891,null))[_0xd94f('0x46')](handleError(_0x4da891,null));};exports[_0xd94f('0x47')]=function(_0x41c894,_0x1a3f43){return db[_0xd94f('0x2b')]['create'](_0x41c894['body'],{})[_0xd94f('0x24')](respondWithResult(_0x1a3f43,0xc9))[_0xd94f('0x46')](handleError(_0x1a3f43,null));};exports[_0xd94f('0x22')]=function(_0x5dbcad,_0x6e9e58){if(_0x5dbcad['body']['id']){delete _0x5dbcad[_0xd94f('0x48')]['id'];}return db['OpenchannelQueueReport'][_0xd94f('0x45')]({'where':{'id':_0x5dbcad['params']['id']}})[_0xd94f('0x24')](handleEntityNotFound(_0x6e9e58,null))[_0xd94f('0x24')](saveUpdates(_0x5dbcad[_0xd94f('0x48')],null))[_0xd94f('0x24')](respondWithResult(_0x6e9e58,null))['catch'](handleError(_0x6e9e58,null));};exports[_0xd94f('0x23')]=function(_0x5d5516,_0x472d8d){return db['OpenchannelQueueReport'][_0xd94f('0x45')]({'where':{'id':_0x5d5516[_0xd94f('0x42')]['id']}})[_0xd94f('0x24')](handleEntityNotFound(_0x472d8d,null))['then'](removeEntity(_0x472d8d,null))[_0xd94f('0x46')](handleError(_0x472d8d,null));};exports[_0xd94f('0x49')]=function(_0x466647,_0x3a4229){return db[_0xd94f('0x2b')][_0xd94f('0x49')]()[_0xd94f('0x24')](respondWithResult(_0x3a4229,null))[_0xd94f('0x46')](handleError(_0x3a4229,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 5a2a9a6..af66a9e 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x53d340,_0x406f4f){var _0x49641e=function(_0x2d3c6c){while(--_0x2d3c6c){_0x53d340['push'](_0x53d340['shift']());}};_0x49641e(++_0x406f4f);}(_0x7a54,0x106));var _0x47a5=function(_0x186014,_0x481e8f){_0x186014=_0x186014-0x0;var _0x46a51a=_0x7a54[_0x186014];return _0x46a51a;};'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':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x2f1402,_0x2cbf98){var _0x360cbe=function(_0x58dc7b){while(--_0x58dc7b){_0x2f1402['push'](_0x2f1402['shift']());}};_0x360cbe(++_0x2cbf98);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x5fc3[_0x2defb5];return _0x229c53;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index b2c1327..961b511 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x536f=['../../config/logger','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','debug','catch','update','body','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x39c61f,_0x1ff78d){var _0x4ca85d=function(_0x16f7b1){while(--_0x16f7b1){_0x39c61f['push'](_0x39c61f['shift']());}};_0x4ca85d(++_0x1ff78d);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1df79c){var _0xddf70e=this;return new Promise(function(_0x2d9dfb,_0x252cae){return db[_0xf536('0x12')][_0xf536('0x17')](_0x1df79c[_0xf536('0x18')],{'raw':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')][_0xf536('0x1a')]||null:null,'attributes':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x1b')]||null:null,'limit':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')]['limit']||null:null})[_0xf536('0x9')](function(_0x485da0){logger[_0xf536('0x10')](_0xf536('0x1c'),_0x1df79c);logger[_0xf536('0x15')](_0xf536('0x1c'),_0x1df79c,JSON[_0xf536('0xc')](_0x485da0));_0x2d9dfb(_0x485da0);})[_0xf536('0x16')](function(_0x330c47){logger[_0xf536('0xd')](_0xf536('0x1c'),_0x330c47[_0xf536('0xf')],_0x1df79c);_0x252cae(_0xddf70e[_0xf536('0xd')](0x1f4,_0x330c47[_0xf536('0xf')]));});});}; \ No newline at end of file +var _0xbb59=['then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateOpenchannelQueueReport','body','options','catch','UpdateOpenchannelQueueReport','update','where','attributes','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xbb59,0xec));var _0x9bb5=function(_0x449672,_0x102459){_0x449672=_0x449672-0x0;var _0x184939=_0xbb59[_0x449672];return _0x184939;};'use strict';var _=require(_0x9bb5('0x0'));var util=require(_0x9bb5('0x1'));var moment=require(_0x9bb5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bb5('0x3'));var db=require(_0x9bb5('0x4'))['db'];var utils=require(_0x9bb5('0x5'));var logger=require(_0x9bb5('0x6'))(_0x9bb5('0x7'));var config=require('../../config/environment');var jayson=require(_0x9bb5('0x8'));var client=jayson[_0x9bb5('0x9')][_0x9bb5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df722,_0xe362e0,_0x83fd10){return new BPromise(function(_0x2d6cce,_0x4e3857){return client[_0x9bb5('0xb')](_0x2df722,_0x83fd10)[_0x9bb5('0xc')](function(_0x2fdbcb){logger[_0x9bb5('0xd')](_0x9bb5('0xe'),_0xe362e0,'request\x20sent');logger[_0x9bb5('0xf')](_0x9bb5('0x10'),_0xe362e0,_0x9bb5('0x11'),JSON[_0x9bb5('0x12')](_0x2fdbcb));if(_0x2fdbcb[_0x9bb5('0x13')]){if(_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x14')]===0x1f4){logger[_0x9bb5('0x13')](_0x9bb5('0xe'),_0xe362e0,_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x15')]);return _0x4e3857(_0x2fdbcb[_0x9bb5('0x13')][_0x9bb5('0x15')]);}logger[_0x9bb5('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe362e0,_0x2fdbcb['error'][_0x9bb5('0x15')]);return _0x2d6cce(_0x2fdbcb['error']['message']);}else{logger[_0x9bb5('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe362e0,_0x9bb5('0x11'));_0x2d6cce(_0x2fdbcb[_0x9bb5('0x16')][_0x9bb5('0x15')]);}})['catch'](function(_0xb471e){logger[_0x9bb5('0x13')](_0x9bb5('0xe'),_0xe362e0,_0xb471e);_0x4e3857(_0xb471e);});});}exports[_0x9bb5('0x17')]=function(_0xba8392){var _0x19d1e9=this;return new Promise(function(_0x162815,_0xe44bdd){return db['OpenchannelQueueReport']['create'](_0xba8392[_0x9bb5('0x18')],{'raw':_0xba8392[_0x9bb5('0x19')]?_0xba8392['options']['raw']===undefined?!![]:![]:!![]})[_0x9bb5('0xc')](function(_0x182966){logger[_0x9bb5('0xd')]('CreateOpenchannelQueueReport',_0xba8392);logger[_0x9bb5('0xf')](_0x9bb5('0x17'),_0xba8392,JSON[_0x9bb5('0x12')](_0x182966));_0x162815(_0x182966);})[_0x9bb5('0x1a')](function(_0x51fa34){logger[_0x9bb5('0x13')](_0x9bb5('0x17'),_0x51fa34['message'],_0xba8392);_0xe44bdd(_0x19d1e9[_0x9bb5('0x13')](0x1f4,_0x51fa34['message']));});});};exports[_0x9bb5('0x1b')]=function(_0x5357e9){var _0x4be52b=this;return new Promise(function(_0x1d7195,_0x16db23){return db['OpenchannelQueueReport'][_0x9bb5('0x1c')](_0x5357e9[_0x9bb5('0x18')],{'raw':_0x5357e9[_0x9bb5('0x19')]?_0x5357e9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5357e9[_0x9bb5('0x19')]?_0x5357e9[_0x9bb5('0x19')][_0x9bb5('0x1d')]||null:null,'attributes':_0x5357e9['options']?_0x5357e9[_0x9bb5('0x19')][_0x9bb5('0x1e')]||null:null,'limit':_0x5357e9[_0x9bb5('0x19')]?_0x5357e9['options']['limit']||null:null})['then'](function(_0x1ad67b){logger[_0x9bb5('0xd')](_0x9bb5('0x1b'),_0x5357e9);logger[_0x9bb5('0xf')](_0x9bb5('0x1b'),_0x5357e9,JSON['stringify'](_0x1ad67b));_0x1d7195(_0x1ad67b);})['catch'](function(_0x59ef00){logger[_0x9bb5('0x13')](_0x9bb5('0x1b'),_0x59ef00[_0x9bb5('0x15')],_0x5357e9);_0x16db23(_0x4be52b['error'](0x1f4,_0x59ef00['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ef600e0..760f1fd 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e97=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./openchannelTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','create'];(function(_0x43d798,_0x17e3a5){var _0x4cba1f=function(_0x1797fc){while(--_0x1797fc){_0x43d798['push'](_0x43d798['shift']());}};_0x4cba1f(++_0x17e3a5);}(_0x5e97,0x192));var _0x75e9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5e97[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x75e9('0x0'));var path=require(_0x75e9('0x1'));var timeout=require(_0x75e9('0x2'));var express=require(_0x75e9('0x3'));var router=express[_0x75e9('0x4')]();var fs_extra=require(_0x75e9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x75e9('0x6'));router['get']('/',auth[_0x75e9('0x7')](),controller[_0x75e9('0x8')]);router[_0x75e9('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x75e9('0xa')]);router[_0x75e9('0x9')](_0x75e9('0xb'),auth[_0x75e9('0x7')](),controller[_0x75e9('0xc')]);router['post']('/',auth[_0x75e9('0x7')](),controller[_0x75e9('0xd')]);router['put'](_0x75e9('0xb'),auth[_0x75e9('0x7')](),controller['update']);router['delete']('/:id',auth[_0x75e9('0x7')](),controller[_0x75e9('0xe')]);module[_0x75e9('0xf')]=router; \ No newline at end of file +var _0xd74b=['show','post','create','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x375007,_0x531e85){var _0x1c562a=function(_0x4aa416){while(--_0x4aa416){_0x375007['push'](_0x375007['shift']());}};_0x1c562a(++_0x531e85);}(_0xd74b,0x197));var _0xbd74=function(_0x38afb5,_0x2f155b){_0x38afb5=_0x38afb5-0x0;var _0x573cd9=_0xd74b[_0x38afb5];return _0x573cd9;};'use strict';var multer=require('multer');var util=require(_0xbd74('0x0'));var path=require(_0xbd74('0x1'));var timeout=require(_0xbd74('0x2'));var express=require(_0xbd74('0x3'));var router=express[_0xbd74('0x4')]();var fs_extra=require(_0xbd74('0x5'));var auth=require(_0xbd74('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd74('0x7'));var controller=require(_0xbd74('0x8'));router[_0xbd74('0x9')]('/',auth[_0xbd74('0xa')](),controller['index']);router['get'](_0xbd74('0xb'),auth[_0xbd74('0xa')](),controller[_0xbd74('0xc')]);router[_0xbd74('0x9')]('/:id',auth[_0xbd74('0xa')](),controller[_0xbd74('0xd')]);router[_0xbd74('0xe')]('/',auth[_0xbd74('0xa')](),controller[_0xbd74('0xf')]);router[_0xbd74('0x10')]('/:id',auth[_0xbd74('0xa')](),controller['update']);router[_0xbd74('0x11')](_0xbd74('0x12'),auth['isAuthenticated'](),controller[_0xbd74('0x13')]);module[_0xbd74('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 12726ec..c043a28 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x46261b,_0xd68542){var _0x31e36f=function(_0xf5ed2b){while(--_0xf5ed2b){_0x46261b['push'](_0x46261b['shift']());}};_0x31e36f(++_0xd68542);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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 +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x20022a,_0x305a77){_0x20022a=_0x20022a-0x0;var _0x471bac=_0x9bde[_0x20022a];return _0x471bac;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index a8a6440..8b2dea2 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09b1=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','describe','zip-dir','request-promise','moment','bluebird','sox'];(function(_0xda652b,_0x5120db){var _0x25e81d=function(_0x5d36ca){while(--_0x5d36ca){_0xda652b['push'](_0xda652b['shift']());}};_0x25e81d(++_0x5120db);}(_0x09b1,0x1ab));var _0x109b=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x09b1[_0x2112d4];return _0x434972;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x109b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x109b('0x1'));var moment=require(_0x109b('0x2'));var BPromise=require(_0x109b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x109b('0x4'));var csv=require(_0x109b('0x5'));var ejs=require(_0x109b('0x6'));var fs=require('fs');var fs_extra=require(_0x109b('0x7'));var _=require(_0x109b('0x8'));var squel=require(_0x109b('0x9'));var crypto=require(_0x109b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x109b('0xb'));var toCsv=require(_0x109b('0x5'));var querystring=require(_0x109b('0xc'));var Papa=require(_0x109b('0xd'));var Redis=require(_0x109b('0xe'));var authService=require(_0x109b('0xf'));var qs=require(_0x109b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x109b('0x11'))(_0x109b('0x12'));var utils=require(_0x109b('0x13'));var config=require(_0x109b('0x14'));var licenseUtil=require(_0x109b('0x15'));var db=require(_0x109b('0x16'))['db'];function respondWithStatusCode(_0x5f1c3f,_0x54e8c5){_0x54e8c5=_0x54e8c5||0xcc;return function(_0x43effb){if(_0x43effb){return _0x5f1c3f[_0x109b('0x17')](_0x54e8c5);}return _0x5f1c3f[_0x109b('0x18')](_0x54e8c5)['end']();};}function respondWithResult(_0x39c9da,_0x89a8e3){_0x89a8e3=_0x89a8e3||0xc8;return function(_0x21e2d8){if(_0x21e2d8){return _0x39c9da[_0x109b('0x18')](_0x89a8e3)[_0x109b('0x19')](_0x21e2d8);}};}function respondWithFilteredResult(_0x194a69,_0x5a99df){return function(_0x16d86a){if(_0x16d86a){var _0x3045be=typeof _0x5a99df[_0x109b('0x1a')]===_0x109b('0x1b')&&typeof _0x5a99df['limit']===_0x109b('0x1b');var _0x39321b=_0x16d86a[_0x109b('0x1c')];var _0x594a95=_0x3045be?0x0:_0x5a99df[_0x109b('0x1a')];var _0x4837e1=_0x3045be?_0x16d86a[_0x109b('0x1c')]:_0x5a99df['offset']+_0x5a99df[_0x109b('0x1d')];var _0x4d7714;if(_0x4837e1>=_0x39321b){_0x4837e1=_0x39321b;_0x4d7714=0xc8;}else{_0x4d7714=0xce;}_0x194a69[_0x109b('0x18')](_0x4d7714);return _0x194a69[_0x109b('0x1e')](_0x109b('0x1f'),_0x594a95+'-'+_0x4837e1+'/'+_0x39321b)[_0x109b('0x19')](_0x16d86a);}return null;};}function patchUpdates(_0x3f5ec8){return function(_0x50a411){try{jsonpatch[_0x109b('0x20')](_0x50a411,_0x3f5ec8,!![]);}catch(_0x3c8198){return BPromise[_0x109b('0x21')](_0x3c8198);}return _0x50a411[_0x109b('0x22')]();};}function saveUpdates(_0x2a2b64,_0x268dff){return function(_0x56562c){if(_0x56562c){return _0x56562c[_0x109b('0x23')](_0x2a2b64)[_0x109b('0x24')](function(_0x4942d6){return _0x4942d6;});}return null;};}function removeEntity(_0x58f877,_0x5bd91d){return function(_0x365ea0){if(_0x365ea0){return _0x365ea0[_0x109b('0x25')]()['then'](function(){_0x58f877[_0x109b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8856,_0x51f74c){return function(_0x2aebf7){if(!_0x2aebf7){_0x3c8856[_0x109b('0x17')](0x194);}return _0x2aebf7;};}function handleError(_0x3c2c64,_0x5a4288){_0x5a4288=_0x5a4288||0x1f4;return function(_0x51288d){logger['error'](_0x51288d[_0x109b('0x26')]);if(_0x51288d[_0x109b('0x27')]){delete _0x51288d[_0x109b('0x27')];}_0x3c2c64['status'](_0x5a4288)[_0x109b('0x28')](_0x51288d);};}exports[_0x109b('0x29')]=function(_0x5e2f04,_0x49564f){var _0x24e66d={},_0x22edee={},_0x53f232={'count':0x0,'rows':[]};var _0x2af8c0=_[_0x109b('0x2a')](db[_0x109b('0x2b')][_0x109b('0x2c')],function(_0x430fe7){return{'name':_0x430fe7['fieldName'],'type':_0x430fe7[_0x109b('0x2d')][_0x109b('0x2e')]};});_0x22edee[_0x109b('0x2f')]=_[_0x109b('0x2a')](_0x2af8c0,_0x109b('0x27'));_0x22edee['query']=_['keys'](_0x5e2f04[_0x109b('0x30')]);_0x22edee[_0x109b('0x31')]=_[_0x109b('0x32')](_0x22edee[_0x109b('0x2f')],_0x22edee['query']);_0x24e66d[_0x109b('0x33')]=_[_0x109b('0x32')](_0x22edee['model'],qs['fields'](_0x5e2f04['query'][_0x109b('0x34')]));_0x24e66d['attributes']=_0x24e66d[_0x109b('0x33')][_0x109b('0x35')]?_0x24e66d[_0x109b('0x33')]:_0x22edee[_0x109b('0x2f')];if(!_0x5e2f04[_0x109b('0x30')][_0x109b('0x36')]('nolimit')){_0x24e66d['limit']=qs[_0x109b('0x1d')](_0x5e2f04[_0x109b('0x30')]['limit']);_0x24e66d[_0x109b('0x1a')]=qs[_0x109b('0x1a')](_0x5e2f04[_0x109b('0x30')][_0x109b('0x1a')]);}_0x24e66d['order']=qs[_0x109b('0x37')](_0x5e2f04['query'][_0x109b('0x37')]);_0x24e66d['where']=qs[_0x109b('0x31')](_[_0x109b('0x38')](_0x5e2f04['query'],_0x22edee[_0x109b('0x31')]),_0x2af8c0);if(_0x5e2f04['query']['filter']){_0x24e66d[_0x109b('0x39')]=_[_0x109b('0x3a')](_0x24e66d[_0x109b('0x39')],{'$or':_[_0x109b('0x2a')](_0x2af8c0,function(_0x4ff524){if(_0x4ff524[_0x109b('0x2d')]!=='VIRTUAL'){var _0xc91913={};_0xc91913[_0x4ff524[_0x109b('0x27')]]={'$like':'%'+_0x5e2f04[_0x109b('0x30')][_0x109b('0x3b')]+'%'};return _0xc91913;}})});}_0x24e66d=_[_0x109b('0x3a')]({},_0x24e66d,_0x5e2f04[_0x109b('0x3c')]);var _0x591f7b={'where':_0x24e66d['where']};return db['OpenchannelTransferReport'][_0x109b('0x1c')](_0x591f7b)[_0x109b('0x24')](function(_0x31bbfd){_0x53f232[_0x109b('0x1c')]=_0x31bbfd;if(_0x5e2f04[_0x109b('0x30')][_0x109b('0x3d')]){_0x24e66d[_0x109b('0x3e')]=[{'all':!![]}];}return db[_0x109b('0x2b')][_0x109b('0x3f')](_0x24e66d);})[_0x109b('0x24')](function(_0x5dcdb6){_0x53f232[_0x109b('0x40')]=_0x5dcdb6;return _0x53f232;})[_0x109b('0x24')](respondWithFilteredResult(_0x49564f,_0x24e66d))[_0x109b('0x41')](handleError(_0x49564f,null));};exports['show']=function(_0x2241b5,_0x44523b){var _0x531878={'raw':!![],'where':{'id':_0x2241b5['params']['id']}},_0x550d31={};_0x550d31[_0x109b('0x2f')]=_['keys'](db[_0x109b('0x2b')][_0x109b('0x2c')]);_0x550d31[_0x109b('0x30')]=_[_0x109b('0x42')](_0x2241b5[_0x109b('0x30')]);_0x550d31['filters']=_['intersection'](_0x550d31['model'],_0x550d31[_0x109b('0x30')]);_0x531878[_0x109b('0x33')]=_[_0x109b('0x32')](_0x550d31[_0x109b('0x2f')],qs[_0x109b('0x34')](_0x2241b5[_0x109b('0x30')][_0x109b('0x34')]));_0x531878[_0x109b('0x33')]=_0x531878['attributes'][_0x109b('0x35')]?_0x531878[_0x109b('0x33')]:_0x550d31[_0x109b('0x2f')];if(_0x2241b5[_0x109b('0x30')][_0x109b('0x3d')]){_0x531878[_0x109b('0x3e')]=[{'all':!![]}];}_0x531878=_[_0x109b('0x3a')]({},_0x531878,_0x2241b5[_0x109b('0x3c')]);return db[_0x109b('0x2b')][_0x109b('0x43')](_0x531878)['then'](handleEntityNotFound(_0x44523b,null))[_0x109b('0x24')](respondWithResult(_0x44523b,null))[_0x109b('0x41')](handleError(_0x44523b,null));};exports[_0x109b('0x44')]=function(_0x2e554d,_0x2d5f61){return db[_0x109b('0x2b')][_0x109b('0x44')](_0x2e554d[_0x109b('0x45')],{})[_0x109b('0x24')](respondWithResult(_0x2d5f61,0xc9))[_0x109b('0x41')](handleError(_0x2d5f61,null));};exports['update']=function(_0x58d945,_0x13656d){if(_0x58d945[_0x109b('0x45')]['id']){delete _0x58d945['body']['id'];}return db[_0x109b('0x2b')]['find']({'where':{'id':_0x58d945[_0x109b('0x46')]['id']}})[_0x109b('0x24')](handleEntityNotFound(_0x13656d,null))[_0x109b('0x24')](saveUpdates(_0x58d945[_0x109b('0x45')],null))['then'](respondWithResult(_0x13656d,null))[_0x109b('0x41')](handleError(_0x13656d,null));};exports[_0x109b('0x25')]=function(_0x4d2bbc,_0x1dc8e2){return db['OpenchannelTransferReport'][_0x109b('0x43')]({'where':{'id':_0x4d2bbc[_0x109b('0x46')]['id']}})[_0x109b('0x24')](handleEntityNotFound(_0x1dc8e2,null))[_0x109b('0x24')](removeEntity(_0x1dc8e2,null))[_0x109b('0x41')](handleError(_0x1dc8e2,null));};exports['describe']=function(_0x5e5a81,_0x17c3c8){return db[_0x109b('0x2b')][_0x109b('0x47')]()['then'](respondWithResult(_0x17c3c8,null))[_0x109b('0x41')](handleError(_0x17c3c8,null));}; \ No newline at end of file +var _0x7592=['sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','fieldName','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','intersection','length','includeAll','create','body','find','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x516a5c,_0x165a3b){var _0x43aa11=function(_0x362f62){while(--_0x362f62){_0x516a5c['push'](_0x516a5c['shift']());}};_0x43aa11(++_0x165a3b);}(_0x7592,0x85));var _0x2759=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x7592[_0x3e3bee];return _0x3ae14c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2759('0x0'));var zipdir=require(_0x2759('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2759('0x2'));var moment=require(_0x2759('0x3'));var BPromise=require(_0x2759('0x4'));var Mustache=require('mustache');var util=require(_0x2759('0x5'));var path=require(_0x2759('0x6'));var sox=require(_0x2759('0x7'));var csv=require(_0x2759('0x8'));var ejs=require(_0x2759('0x9'));var fs=require('fs');var fs_extra=require(_0x2759('0xa'));var _=require(_0x2759('0xb'));var squel=require(_0x2759('0xc'));var crypto=require(_0x2759('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2759('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2759('0xf'));var Papa=require(_0x2759('0x10'));var Redis=require(_0x2759('0x11'));var authService=require(_0x2759('0x12'));var qs=require(_0x2759('0x13'));var as=require(_0x2759('0x14'));var hardwareService=require(_0x2759('0x15'));var logger=require(_0x2759('0x16'))(_0x2759('0x17'));var utils=require('../../config/utils');var config=require(_0x2759('0x18'));var licenseUtil=require(_0x2759('0x19'));var db=require(_0x2759('0x1a'))['db'];function respondWithStatusCode(_0x490f8c,_0x12a854){_0x12a854=_0x12a854||0xcc;return function(_0x1f71c1){if(_0x1f71c1){return _0x490f8c[_0x2759('0x1b')](_0x12a854);}return _0x490f8c[_0x2759('0x1c')](_0x12a854)[_0x2759('0x1d')]();};}function respondWithResult(_0x38a82c,_0x2e7595){_0x2e7595=_0x2e7595||0xc8;return function(_0xd8d90f){if(_0xd8d90f){return _0x38a82c[_0x2759('0x1c')](_0x2e7595)[_0x2759('0x1e')](_0xd8d90f);}};}function respondWithFilteredResult(_0xe9b148,_0x51e752){return function(_0x1e5b0b){if(_0x1e5b0b){var _0x9fdc59=typeof _0x51e752['offset']===_0x2759('0x1f')&&typeof _0x51e752[_0x2759('0x20')]==='undefined';var _0x3f4041=_0x1e5b0b[_0x2759('0x21')];var _0x1a4648=_0x9fdc59?0x0:_0x51e752[_0x2759('0x22')];var _0x4fd3ee=_0x9fdc59?_0x1e5b0b[_0x2759('0x21')]:_0x51e752[_0x2759('0x22')]+_0x51e752[_0x2759('0x20')];var _0x439006;if(_0x4fd3ee>=_0x3f4041){_0x4fd3ee=_0x3f4041;_0x439006=0xc8;}else{_0x439006=0xce;}_0xe9b148['status'](_0x439006);return _0xe9b148[_0x2759('0x23')](_0x2759('0x24'),_0x1a4648+'-'+_0x4fd3ee+'/'+_0x3f4041)[_0x2759('0x1e')](_0x1e5b0b);}return null;};}function patchUpdates(_0x16e252){return function(_0x41e92d){try{jsonpatch[_0x2759('0x25')](_0x41e92d,_0x16e252,!![]);}catch(_0xa9f204){return BPromise[_0x2759('0x26')](_0xa9f204);}return _0x41e92d[_0x2759('0x27')]();};}function saveUpdates(_0x439f43,_0x44cae0){return function(_0x66a19f){if(_0x66a19f){return _0x66a19f[_0x2759('0x28')](_0x439f43)[_0x2759('0x29')](function(_0x1dcab1){return _0x1dcab1;});}return null;};}function removeEntity(_0xfb601a,_0x3ab7b5){return function(_0x3bf40e){if(_0x3bf40e){return _0x3bf40e[_0x2759('0x2a')]()[_0x2759('0x29')](function(){_0xfb601a[_0x2759('0x1c')](0xcc)[_0x2759('0x1d')]();});}};}function handleEntityNotFound(_0x4dc22e,_0x56da5f){return function(_0x369265){if(!_0x369265){_0x4dc22e[_0x2759('0x1b')](0x194);}return _0x369265;};}function handleError(_0x511a48,_0x24942f){_0x24942f=_0x24942f||0x1f4;return function(_0x45325d){logger['error'](_0x45325d[_0x2759('0x2b')]);if(_0x45325d[_0x2759('0x2c')]){delete _0x45325d[_0x2759('0x2c')];}_0x511a48[_0x2759('0x1c')](_0x24942f)[_0x2759('0x2d')](_0x45325d);};}exports[_0x2759('0x2e')]=function(_0x56c62a,_0x193d39){var _0x453b81={},_0x20d69f={},_0x4b9032={'count':0x0,'rows':[]};var _0x2afe9c=_[_0x2759('0x2f')](db[_0x2759('0x30')]['rawAttributes'],function(_0x3c6118){return{'name':_0x3c6118[_0x2759('0x31')],'type':_0x3c6118['type'][_0x2759('0x32')]};});_0x20d69f[_0x2759('0x33')]=_[_0x2759('0x2f')](_0x2afe9c,_0x2759('0x2c'));_0x20d69f[_0x2759('0x34')]=_[_0x2759('0x35')](_0x56c62a[_0x2759('0x34')]);_0x20d69f[_0x2759('0x36')]=_['intersection'](_0x20d69f[_0x2759('0x33')],_0x20d69f[_0x2759('0x34')]);_0x453b81['attributes']=_['intersection'](_0x20d69f[_0x2759('0x33')],qs['fields'](_0x56c62a[_0x2759('0x34')][_0x2759('0x37')]));_0x453b81[_0x2759('0x38')]=_0x453b81[_0x2759('0x38')]['length']?_0x453b81[_0x2759('0x38')]:_0x20d69f[_0x2759('0x33')];if(!_0x56c62a[_0x2759('0x34')][_0x2759('0x39')](_0x2759('0x3a'))){_0x453b81[_0x2759('0x20')]=qs[_0x2759('0x20')](_0x56c62a[_0x2759('0x34')]['limit']);_0x453b81[_0x2759('0x22')]=qs[_0x2759('0x22')](_0x56c62a[_0x2759('0x34')][_0x2759('0x22')]);}_0x453b81[_0x2759('0x3b')]=qs['sort'](_0x56c62a[_0x2759('0x34')]['sort']);_0x453b81[_0x2759('0x3c')]=qs[_0x2759('0x36')](_[_0x2759('0x3d')](_0x56c62a[_0x2759('0x34')],_0x20d69f[_0x2759('0x36')]),_0x2afe9c);if(_0x56c62a[_0x2759('0x34')][_0x2759('0x3e')]){_0x453b81[_0x2759('0x3c')]=_[_0x2759('0x3f')](_0x453b81[_0x2759('0x3c')],{'$or':_[_0x2759('0x2f')](_0x2afe9c,function(_0x4c3068){if(_0x4c3068[_0x2759('0x40')]!==_0x2759('0x41')){var _0x1f4e40={};_0x1f4e40[_0x4c3068[_0x2759('0x2c')]]={'$like':'%'+_0x56c62a[_0x2759('0x34')]['filter']+'%'};return _0x1f4e40;}})});}_0x453b81=_['merge']({},_0x453b81,_0x56c62a[_0x2759('0x42')]);var _0x2b9acb={'where':_0x453b81['where']};return db[_0x2759('0x30')][_0x2759('0x21')](_0x2b9acb)[_0x2759('0x29')](function(_0x3424cf){_0x4b9032[_0x2759('0x21')]=_0x3424cf;if(_0x56c62a[_0x2759('0x34')]['includeAll']){_0x453b81[_0x2759('0x43')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x2759('0x44')](_0x453b81);})[_0x2759('0x29')](function(_0x31fdb5){_0x4b9032[_0x2759('0x45')]=_0x31fdb5;return _0x4b9032;})['then'](respondWithFilteredResult(_0x193d39,_0x453b81))[_0x2759('0x46')](handleError(_0x193d39,null));};exports[_0x2759('0x47')]=function(_0x578487,_0x5a7d86){var _0x996d21={'raw':!![],'where':{'id':_0x578487['params']['id']}},_0x14ec2d={};_0x14ec2d['model']=_[_0x2759('0x35')](db[_0x2759('0x30')]['rawAttributes']);_0x14ec2d[_0x2759('0x34')]=_[_0x2759('0x35')](_0x578487[_0x2759('0x34')]);_0x14ec2d['filters']=_[_0x2759('0x48')](_0x14ec2d[_0x2759('0x33')],_0x14ec2d[_0x2759('0x34')]);_0x996d21[_0x2759('0x38')]=_[_0x2759('0x48')](_0x14ec2d['model'],qs['fields'](_0x578487[_0x2759('0x34')]['fields']));_0x996d21['attributes']=_0x996d21['attributes'][_0x2759('0x49')]?_0x996d21[_0x2759('0x38')]:_0x14ec2d[_0x2759('0x33')];if(_0x578487[_0x2759('0x34')][_0x2759('0x4a')]){_0x996d21[_0x2759('0x43')]=[{'all':!![]}];}_0x996d21=_[_0x2759('0x3f')]({},_0x996d21,_0x578487[_0x2759('0x42')]);return db[_0x2759('0x30')]['find'](_0x996d21)[_0x2759('0x29')](handleEntityNotFound(_0x5a7d86,null))[_0x2759('0x29')](respondWithResult(_0x5a7d86,null))[_0x2759('0x46')](handleError(_0x5a7d86,null));};exports[_0x2759('0x4b')]=function(_0x48dbd4,_0x34d027){return db[_0x2759('0x30')]['create'](_0x48dbd4[_0x2759('0x4c')],{})[_0x2759('0x29')](respondWithResult(_0x34d027,0xc9))['catch'](handleError(_0x34d027,null));};exports[_0x2759('0x28')]=function(_0x150134,_0x31728e){if(_0x150134['body']['id']){delete _0x150134[_0x2759('0x4c')]['id'];}return db['OpenchannelTransferReport'][_0x2759('0x4d')]({'where':{'id':_0x150134[_0x2759('0x4e')]['id']}})[_0x2759('0x29')](handleEntityNotFound(_0x31728e,null))[_0x2759('0x29')](saveUpdates(_0x150134[_0x2759('0x4c')],null))[_0x2759('0x29')](respondWithResult(_0x31728e,null))[_0x2759('0x46')](handleError(_0x31728e,null));};exports[_0x2759('0x2a')]=function(_0x532f02,_0x9e1c0d){return db[_0x2759('0x30')][_0x2759('0x4d')]({'where':{'id':_0x532f02[_0x2759('0x4e')]['id']}})['then'](handleEntityNotFound(_0x9e1c0d,null))[_0x2759('0x29')](removeEntity(_0x9e1c0d,null))[_0x2759('0x46')](handleError(_0x9e1c0d,null));};exports[_0x2759('0x4f')]=function(_0x5a1de0,_0x3f1014){return db['OpenchannelTransferReport'][_0x2759('0x4f')]()[_0x2759('0x29')](respondWithResult(_0x3f1014,null))[_0x2759('0x46')](handleError(_0x3f1014,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 440adbf..b7be4f2 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.model.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa667=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelTransferReport','uniqueid','lodash','util'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0xa667,0x1df));var _0x7a66=function(_0x293d99,_0x3b568e){_0x293d99=_0x293d99-0x0;var _0x17edb6=_0xa667[_0x293d99];return _0x17edb6;};'use strict';var _=require(_0x7a66('0x0'));var util=require(_0x7a66('0x1'));var logger=require(_0x7a66('0x2'))(_0x7a66('0x3'));var moment=require(_0x7a66('0x4'));var BPromise=require(_0x7a66('0x5'));var rp=require(_0x7a66('0x6'));var fs=require('fs');var path=require(_0x7a66('0x7'));var rimraf=require(_0x7a66('0x8'));var config=require(_0x7a66('0x9'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x55a98d,_0x59d0e1){return _0x55a98d[_0x7a66('0xa')](_0x7a66('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x7a66('0xc'),'fields':[_0x7a66('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc74=['../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x50b486,_0x9f474d){var _0x3fc726=function(_0x546927){while(--_0x546927){_0x50b486['push'](_0x50b486['shift']());}};_0x3fc726(++_0x9f474d);}(_0xfc74,0x1b3));var _0x4fc7=function(_0x5153f9,_0x532fd5){_0x5153f9=_0x5153f9-0x0;var _0x349e0c=_0xfc74[_0x5153f9];return _0x349e0c;};'use strict';var _=require(_0x4fc7('0x0'));var util=require(_0x4fc7('0x1'));var logger=require(_0x4fc7('0x2'))('api');var moment=require(_0x4fc7('0x3'));var BPromise=require('bluebird');var rp=require(_0x4fc7('0x4'));var fs=require('fs');var path=require(_0x4fc7('0x5'));var rimraf=require(_0x4fc7('0x6'));var config=require(_0x4fc7('0x7'));var attributes=require(_0x4fc7('0x8'));module['exports']=function(_0x5672d4,_0x369698){return _0x5672d4[_0x4fc7('0x9')](_0x4fc7('0xa'),attributes,{'tableName':_0x4fc7('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4fc7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 444a275..f7c2d0c 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcbd=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x36eb2d,_0x550c15){var _0x8e136e=function(_0x41931d){while(--_0x41931d){_0x36eb2d['push'](_0x36eb2d['shift']());}};_0x8e136e(++_0x550c15);}(_0xfcbd,0x160));var _0xdfcb=function(_0x57f451,_0xc68923){_0x57f451=_0x57f451-0x0;var _0x4f1e17=_0xfcbd[_0x57f451];return _0x4f1e17;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdfcb('0x1'));var rs=require(_0xdfcb('0x2'));var fs=require('fs');var Redis=require(_0xdfcb('0x3'));var db=require(_0xdfcb('0x4'))['db'];var utils=require(_0xdfcb('0x5'));var logger=require(_0xdfcb('0x6'))(_0xdfcb('0x7'));var config=require(_0xdfcb('0x8'));var jayson=require(_0xdfcb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46956c,_0x183ea8,_0xb8de95){return new BPromise(function(_0x3c5431,_0xbe50d6){return client[_0xdfcb('0xa')](_0x46956c,_0xb8de95)[_0xdfcb('0xb')](function(_0x5e650d){logger[_0xdfcb('0xc')](_0xdfcb('0xd'),_0x183ea8,_0xdfcb('0xe'));logger[_0xdfcb('0xf')](_0xdfcb('0x10'),_0x183ea8,_0xdfcb('0xe'),JSON[_0xdfcb('0x11')](_0x5e650d));if(_0x5e650d[_0xdfcb('0x12')]){if(_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x13')]===0x1f4){logger[_0xdfcb('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x183ea8,_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x14')]);return _0xbe50d6(_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x14')]);}logger[_0xdfcb('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x183ea8,_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x14')]);return _0x3c5431(_0x5e650d[_0xdfcb('0x12')][_0xdfcb('0x14')]);}else{logger[_0xdfcb('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x183ea8,_0xdfcb('0xe'));_0x3c5431(_0x5e650d[_0xdfcb('0x15')][_0xdfcb('0x14')]);}})[_0xdfcb('0x16')](function(_0x11437d){logger[_0xdfcb('0x12')](_0xdfcb('0xd'),_0x183ea8,_0x11437d);_0xbe50d6(_0x11437d);});});} \ No newline at end of file +var _0x9829=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x23b29f,_0x44c18f){var _0x59c379=function(_0x26b35f){while(--_0x26b35f){_0x23b29f['push'](_0x23b29f['shift']());}};_0x59c379(++_0x44c18f);}(_0x9829,0xc4));var _0x9982=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x9829[_0x454018];return _0x24697d;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var moment=require(_0x9982('0x2'));var BPromise=require(_0x9982('0x3'));var rs=require(_0x9982('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9982('0x5'))['db'];var utils=require(_0x9982('0x6'));var logger=require(_0x9982('0x7'))('rpc');var config=require(_0x9982('0x8'));var jayson=require(_0x9982('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340d62,_0x35a93f,_0x5d0824){return new BPromise(function(_0x25f30a,_0x1a3931){return client[_0x9982('0xa')](_0x340d62,_0x5d0824)[_0x9982('0xb')](function(_0x1e7881){logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));logger[_0x9982('0xf')](_0x9982('0x10'),_0x35a93f,_0x9982('0xe'),JSON[_0x9982('0x11')](_0x1e7881));if(_0x1e7881[_0x9982('0x12')]){if(_0x1e7881[_0x9982('0x12')][_0x9982('0x13')]===0x1f4){logger[_0x9982('0x12')](_0x9982('0xd'),_0x35a93f,_0x1e7881[_0x9982('0x12')]['message']);return _0x1a3931(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}logger['error'](_0x9982('0xd'),_0x35a93f,_0x1e7881['error'][_0x9982('0x14')]);return _0x25f30a(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}else{logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));_0x25f30a(_0x1e7881[_0x9982('0x15')][_0x9982('0x14')]);}})[_0x9982('0x16')](function(_0x50ca89){logger[_0x9982('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x35a93f,_0x50ca89);_0x1a3931(_0x50ca89);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8c55c45..27dd3c7 100644 --- a/server/api/pause/index.js +++ b/server/api/pause/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93cc=['./pause.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x45473f,_0xc95cf7){var _0x2a0cc1=function(_0x499adb){while(--_0x499adb){_0x45473f['push'](_0x45473f['shift']());}};_0x2a0cc1(++_0xc95cf7);}(_0x93cc,0xc9));var _0xc93c=function(_0x117289,_0xde5c14){_0x117289=_0x117289-0x0;var _0x5dff52=_0x93cc[_0x117289];return _0x5dff52;};'use strict';var multer=require(_0xc93c('0x0'));var util=require(_0xc93c('0x1'));var path=require(_0xc93c('0x2'));var timeout=require(_0xc93c('0x3'));var express=require(_0xc93c('0x4'));var router=express[_0xc93c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc93c('0x6'));var interaction=require(_0xc93c('0x7'));var config=require('../../config/environment');var controller=require(_0xc93c('0x8'));router[_0xc93c('0x9')]('/',auth[_0xc93c('0xa')](),controller[_0xc93c('0xb')]);router[_0xc93c('0x9')](_0xc93c('0xc'),auth['isAuthenticated'](),controller[_0xc93c('0xd')]);router[_0xc93c('0xe')]('/',auth[_0xc93c('0xa')](),controller['create']);router[_0xc93c('0xf')]('/:id',auth[_0xc93c('0xa')](),controller[_0xc93c('0x10')]);router[_0xc93c('0x11')](_0xc93c('0xc'),auth[_0xc93c('0xa')](),controller[_0xc93c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xabd7=['../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xba7644,_0x6fede8){var _0x189e81=function(_0x1c9eb6){while(--_0x1c9eb6){_0xba7644['push'](_0xba7644['shift']());}};_0x189e81(++_0x6fede8);}(_0xabd7,0x189));var _0x7abd=function(_0x31e0c8,_0x446833){_0x31e0c8=_0x31e0c8-0x0;var _0x3967c3=_0xabd7[_0x31e0c8];return _0x3967c3;};'use strict';var multer=require(_0x7abd('0x0'));var util=require('util');var path=require(_0x7abd('0x1'));var timeout=require(_0x7abd('0x2'));var express=require(_0x7abd('0x3'));var router=express[_0x7abd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7abd('0x5'));var interaction=require(_0x7abd('0x6'));var config=require(_0x7abd('0x7'));var controller=require(_0x7abd('0x8'));router['get']('/',auth[_0x7abd('0x9')](),controller[_0x7abd('0xa')]);router[_0x7abd('0xb')](_0x7abd('0xc'),auth[_0x7abd('0x9')](),controller[_0x7abd('0xd')]);router[_0x7abd('0xe')]('/',auth[_0x7abd('0x9')](),controller[_0x7abd('0xf')]);router['put'](_0x7abd('0xc'),auth[_0x7abd('0x9')](),controller[_0x7abd('0x10')]);router[_0x7abd('0x11')]('/:id',auth[_0x7abd('0x9')](),controller[_0x7abd('0x12')]);module[_0x7abd('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index b775d43..4477175 100644 --- a/server/api/pause/pause.attributes.js +++ b/server/api/pause/pause.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc970=['exports','STRING','name','sequelize'];(function(_0x50aca8,_0x2cfd21){var _0x28e8f6=function(_0x1157ce){while(--_0x1157ce){_0x50aca8['push'](_0x50aca8['shift']());}};_0x28e8f6(++_0x2cfd21);}(_0xc970,0x1b7));var _0x0c97=function(_0x1eb92c,_0x1419fe){_0x1eb92c=_0x1eb92c-0x0;var _0x59a67d=_0xc970[_0x1eb92c];return _0x59a67d;};'use strict';var Sequelize=require(_0x0c97('0x0'));module[_0x0c97('0x1')]={'name':{'type':Sequelize[_0x0c97('0x2')],'unique':_0x0c97('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x0c97('0x2')]}}; \ No newline at end of file +var _0x4666=['exports','STRING','sequelize'];(function(_0x3243ca,_0x47c495){var _0x3b74e7=function(_0x3f147b){while(--_0x3f147b){_0x3243ca['push'](_0x3243ca['shift']());}};_0x3b74e7(++_0x47c495);}(_0x4666,0xce));var _0x6466=function(_0x4e2e5a,_0x49a6c8){_0x4e2e5a=_0x4e2e5a-0x0;var _0x3bf248=_0x4666[_0x4e2e5a];return _0x3bf248;};'use strict';var Sequelize=require(_0x6466('0x0'));module[_0x6466('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6466('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e507ca9..b964f28 100644 --- a/server/api/pause/pause.controller.js +++ b/server/api/pause/pause.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff3a=['mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','Pause','include','findAll','rows','show','params','includeAll','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','create','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xff3a,0x1d5));var _0xaff3=function(_0xf02eb2,_0xb82ece){_0xf02eb2=_0xf02eb2-0x0;var _0xf98232=_0xff3a[_0xf02eb2];return _0xf98232;};'use strict';var emlformat=require(_0xaff3('0x0'));var rimraf=require(_0xaff3('0x1'));var zipdir=require(_0xaff3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaff3('0x3'));var moment=require('moment');var BPromise=require(_0xaff3('0x4'));var Mustache=require(_0xaff3('0x5'));var util=require(_0xaff3('0x6'));var path=require(_0xaff3('0x7'));var sox=require('sox');var csv=require(_0xaff3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaff3('0x9'));var _=require('lodash');var squel=require(_0xaff3('0xa'));var crypto=require(_0xaff3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaff3('0xc'));var toCsv=require(_0xaff3('0x8'));var querystring=require(_0xaff3('0xd'));var Papa=require(_0xaff3('0xe'));var Redis=require(_0xaff3('0xf'));var authService=require(_0xaff3('0x10'));var qs=require(_0xaff3('0x11'));var as=require(_0xaff3('0x12'));var hardwareService=require(_0xaff3('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xaff3('0x14'));var licenseUtil=require(_0xaff3('0x15'));var db=require(_0xaff3('0x16'))['db'];function respondWithStatusCode(_0x4506b3,_0x4b4eb9){_0x4b4eb9=_0x4b4eb9||0xcc;return function(_0x34d373){if(_0x34d373){return _0x4506b3[_0xaff3('0x17')](_0x4b4eb9);}return _0x4506b3[_0xaff3('0x18')](_0x4b4eb9)[_0xaff3('0x19')]();};}function respondWithResult(_0x903e9a,_0x1d01fa){_0x1d01fa=_0x1d01fa||0xc8;return function(_0x540a34){if(_0x540a34){return _0x903e9a[_0xaff3('0x18')](_0x1d01fa)[_0xaff3('0x1a')](_0x540a34);}};}function respondWithFilteredResult(_0x2ca6d3,_0x1b3515){return function(_0x1267d6){if(_0x1267d6){var _0x399a29=typeof _0x1b3515[_0xaff3('0x1b')]===_0xaff3('0x1c')&&typeof _0x1b3515[_0xaff3('0x1d')]===_0xaff3('0x1c');var _0x270e43=_0x1267d6[_0xaff3('0x1e')];var _0x3aa364=_0x399a29?0x0:_0x1b3515['offset'];var _0x3e94c0=_0x399a29?_0x1267d6[_0xaff3('0x1e')]:_0x1b3515[_0xaff3('0x1b')]+_0x1b3515[_0xaff3('0x1d')];var _0x463648;if(_0x3e94c0>=_0x270e43){_0x3e94c0=_0x270e43;_0x463648=0xc8;}else{_0x463648=0xce;}_0x2ca6d3['status'](_0x463648);return _0x2ca6d3[_0xaff3('0x1f')](_0xaff3('0x20'),_0x3aa364+'-'+_0x3e94c0+'/'+_0x270e43)['json'](_0x1267d6);}return null;};}function patchUpdates(_0x4351cb){return function(_0x49eb53){try{jsonpatch[_0xaff3('0x21')](_0x49eb53,_0x4351cb,!![]);}catch(_0x292bd5){return BPromise['reject'](_0x292bd5);}return _0x49eb53[_0xaff3('0x22')]();};}function saveUpdates(_0x205f9a,_0x2f699b){return function(_0x5f2aa9){if(_0x5f2aa9){return _0x5f2aa9[_0xaff3('0x23')](_0x205f9a)[_0xaff3('0x24')](function(_0x443fc7){return _0x443fc7;});}return null;};}function removeEntity(_0x85b2b7,_0xe5472a){return function(_0x17076c){if(_0x17076c){return _0x17076c[_0xaff3('0x25')]()[_0xaff3('0x24')](function(){var _0x2aee6a=_0x17076c[_0xaff3('0x26')]({'plain':!![]});var _0x38617e='Pauses';return db[_0xaff3('0x27')][_0xaff3('0x25')]({'where':{'type':_0x38617e,'resourceId':_0x2aee6a['id']}})[_0xaff3('0x24')](function(){return _0x17076c;});})[_0xaff3('0x24')](function(){_0x85b2b7[_0xaff3('0x18')](0xcc)[_0xaff3('0x19')]();});}};}function handleEntityNotFound(_0x3a00cc,_0xf78533){return function(_0x2f6681){if(!_0x2f6681){_0x3a00cc[_0xaff3('0x17')](0x194);}return _0x2f6681;};}function handleError(_0x4a5b21,_0x215dcf){_0x215dcf=_0x215dcf||0x1f4;return function(_0x3c85ce){logger['error'](_0x3c85ce['stack']);if(_0x3c85ce[_0xaff3('0x28')]){delete _0x3c85ce[_0xaff3('0x28')];}_0x4a5b21[_0xaff3('0x18')](_0x215dcf)[_0xaff3('0x29')](_0x3c85ce);};}exports[_0xaff3('0x2a')]=function(_0x43e700,_0x354639){var _0xa5a486={},_0x12a17d={},_0x420e5f={'count':0x0,'rows':[]};var _0x294e06=_['map'](db['Pause'][_0xaff3('0x2b')],function(_0x4186e3){return{'name':_0x4186e3[_0xaff3('0x2c')],'type':_0x4186e3['type']['key']};});_0x12a17d[_0xaff3('0x2d')]=_[_0xaff3('0x2e')](_0x294e06,_0xaff3('0x28'));_0x12a17d[_0xaff3('0x2f')]=_[_0xaff3('0x30')](_0x43e700[_0xaff3('0x2f')]);_0x12a17d[_0xaff3('0x31')]=_[_0xaff3('0x32')](_0x12a17d['model'],_0x12a17d[_0xaff3('0x2f')]);_0xa5a486[_0xaff3('0x33')]=_[_0xaff3('0x32')](_0x12a17d[_0xaff3('0x2d')],qs[_0xaff3('0x34')](_0x43e700[_0xaff3('0x2f')]['fields']));_0xa5a486[_0xaff3('0x33')]=_0xa5a486[_0xaff3('0x33')][_0xaff3('0x35')]?_0xa5a486['attributes']:_0x12a17d[_0xaff3('0x2d')];if(!_0x43e700[_0xaff3('0x2f')][_0xaff3('0x36')](_0xaff3('0x37'))){_0xa5a486[_0xaff3('0x1d')]=qs[_0xaff3('0x1d')](_0x43e700['query'][_0xaff3('0x1d')]);_0xa5a486[_0xaff3('0x1b')]=qs[_0xaff3('0x1b')](_0x43e700[_0xaff3('0x2f')][_0xaff3('0x1b')]);}_0xa5a486['order']=qs[_0xaff3('0x38')](_0x43e700[_0xaff3('0x2f')]['sort']);_0xa5a486[_0xaff3('0x39')]=qs[_0xaff3('0x31')](_[_0xaff3('0x3a')](_0x43e700[_0xaff3('0x2f')],_0x12a17d['filters']),_0x294e06);if(_0x43e700['query'][_0xaff3('0x3b')]){_0xa5a486[_0xaff3('0x39')]=_['merge'](_0xa5a486[_0xaff3('0x39')],{'$or':_[_0xaff3('0x2e')](_0x294e06,function(_0x25d622){if(_0x25d622[_0xaff3('0x3c')]!==_0xaff3('0x3d')){var _0x23350c={};_0x23350c[_0x25d622['name']]={'$like':'%'+_0x43e700['query'][_0xaff3('0x3b')]+'%'};return _0x23350c;}})});}_0xa5a486=_[_0xaff3('0x3e')]({},_0xa5a486,_0x43e700[_0xaff3('0x3f')]);var _0x2c6570={'where':_0xa5a486[_0xaff3('0x39')]};return db[_0xaff3('0x40')][_0xaff3('0x1e')](_0x2c6570)[_0xaff3('0x24')](function(_0x10cca1){_0x420e5f['count']=_0x10cca1;if(_0x43e700[_0xaff3('0x2f')]['includeAll']){_0xa5a486[_0xaff3('0x41')]=[{'all':!![]}];}return db['Pause'][_0xaff3('0x42')](_0xa5a486);})[_0xaff3('0x24')](function(_0x203481){_0x420e5f[_0xaff3('0x43')]=_0x203481;return _0x420e5f;})[_0xaff3('0x24')](respondWithFilteredResult(_0x354639,_0xa5a486))['catch'](handleError(_0x354639,null));};exports[_0xaff3('0x44')]=function(_0x29b471,_0x1974f5){var _0x4adff4={'raw':!![],'where':{'id':_0x29b471[_0xaff3('0x45')]['id']}},_0x4de4ae={};_0x4de4ae['model']=_[_0xaff3('0x30')](db[_0xaff3('0x40')][_0xaff3('0x2b')]);_0x4de4ae['query']=_['keys'](_0x29b471[_0xaff3('0x2f')]);_0x4de4ae[_0xaff3('0x31')]=_['intersection'](_0x4de4ae[_0xaff3('0x2d')],_0x4de4ae[_0xaff3('0x2f')]);_0x4adff4[_0xaff3('0x33')]=_['intersection'](_0x4de4ae[_0xaff3('0x2d')],qs[_0xaff3('0x34')](_0x29b471['query'][_0xaff3('0x34')]));_0x4adff4['attributes']=_0x4adff4[_0xaff3('0x33')][_0xaff3('0x35')]?_0x4adff4[_0xaff3('0x33')]:_0x4de4ae[_0xaff3('0x2d')];if(_0x29b471[_0xaff3('0x2f')][_0xaff3('0x46')]){_0x4adff4[_0xaff3('0x41')]=[{'all':!![]}];}_0x4adff4=_[_0xaff3('0x3e')]({},_0x4adff4,_0x29b471[_0xaff3('0x3f')]);return db[_0xaff3('0x40')]['find'](_0x4adff4)[_0xaff3('0x24')](handleEntityNotFound(_0x1974f5,null))['then'](respondWithResult(_0x1974f5,null))[_0xaff3('0x47')](handleError(_0x1974f5,null));};exports['create']=function(_0x4b3c98,_0x50cc72){return db[_0xaff3('0x40')]['create'](_0x4b3c98['body'],{})[_0xaff3('0x24')](function(_0x144d6a){var _0x19b91e=_0x4b3c98['user'][_0xaff3('0x26')]({'plain':!![]});if(!_0x19b91e)throw new Error(_0xaff3('0x48'));if(_0x19b91e[_0xaff3('0x49')]==='user'){var _0x56491b=_0x144d6a[_0xaff3('0x26')]({'plain':!![]});var _0x209abb='Pauses';return db['UserProfileSection'][_0xaff3('0x4a')]({'where':{'name':_0x209abb,'userProfileId':_0x19b91e[_0xaff3('0x4b')]},'raw':!![]})[_0xaff3('0x24')](function(_0x278ed5){if(_0x278ed5&&_0x278ed5['autoAssociation']===0x0){return db[_0xaff3('0x27')][_0xaff3('0x4c')]({'name':_0x56491b[_0xaff3('0x28')],'resourceId':_0x56491b['id'],'type':_0x278ed5[_0xaff3('0x28')],'sectionId':_0x278ed5['id']},{})[_0xaff3('0x24')](function(){return _0x144d6a;});}else{return _0x144d6a;}})[_0xaff3('0x47')](function(_0x2af910){logger[_0xaff3('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2af910);throw _0x2af910;});}return _0x144d6a;})[_0xaff3('0x24')](respondWithResult(_0x50cc72,0xc9))[_0xaff3('0x47')](handleError(_0x50cc72,null));};exports[_0xaff3('0x23')]=function(_0x4e5ae6,_0x4bb149){if(_0x4e5ae6[_0xaff3('0x4e')]['id']){delete _0x4e5ae6[_0xaff3('0x4e')]['id'];}return db[_0xaff3('0x40')][_0xaff3('0x4a')]({'where':{'id':_0x4e5ae6[_0xaff3('0x45')]['id']}})[_0xaff3('0x24')](handleEntityNotFound(_0x4bb149,null))[_0xaff3('0x24')](saveUpdates(_0x4e5ae6['body'],null))[_0xaff3('0x24')](respondWithResult(_0x4bb149,null))[_0xaff3('0x47')](handleError(_0x4bb149,null));};exports[_0xaff3('0x25')]=function(_0x1650e1,_0x677759){return db[_0xaff3('0x40')][_0xaff3('0x4a')]({'where':{'id':_0x1650e1[_0xaff3('0x45')]['id']}})['then'](handleEntityNotFound(_0x677759,null))[_0xaff3('0x24')](removeEntity(_0x677759,null))[_0xaff3('0x47')](handleError(_0x677759,null));}; \ No newline at end of file +var _0x7a4f=['catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','get','Pauses','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Pause','includeAll','include','findAll','rows'];(function(_0x216567,_0x3d1bae){var _0x226cb1=function(_0x5ee2c8){while(--_0x5ee2c8){_0x216567['push'](_0x216567['shift']());}};_0x226cb1(++_0x3d1bae);}(_0x7a4f,0xac));var _0xf7a4=function(_0x18baf4,_0x33086b){_0x18baf4=_0x18baf4-0x0;var _0x278ed1=_0x7a4f[_0x18baf4];return _0x278ed1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf7a4('0x0'));var jsonpatch=require(_0xf7a4('0x1'));var rp=require(_0xf7a4('0x2'));var moment=require('moment');var BPromise=require(_0xf7a4('0x3'));var Mustache=require('mustache');var util=require(_0xf7a4('0x4'));var path=require(_0xf7a4('0x5'));var sox=require(_0xf7a4('0x6'));var csv=require('to-csv');var ejs=require(_0xf7a4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7a4('0x8'));var squel=require('squel');var crypto=require(_0xf7a4('0x9'));var jsforce=require(_0xf7a4('0xa'));var deskjs=require(_0xf7a4('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf7a4('0xc'));var qs=require(_0xf7a4('0xd'));var as=require(_0xf7a4('0xe'));var hardwareService=require(_0xf7a4('0xf'));var logger=require('../../config/logger')(_0xf7a4('0x10'));var utils=require('../../config/utils');var config=require(_0xf7a4('0x11'));var licenseUtil=require(_0xf7a4('0x12'));var db=require(_0xf7a4('0x13'))['db'];function respondWithStatusCode(_0x459f9b,_0x38049d){_0x38049d=_0x38049d||0xcc;return function(_0x2da992){if(_0x2da992){return _0x459f9b[_0xf7a4('0x14')](_0x38049d);}return _0x459f9b[_0xf7a4('0x15')](_0x38049d)[_0xf7a4('0x16')]();};}function respondWithResult(_0x1893ac,_0x357911){_0x357911=_0x357911||0xc8;return function(_0x1b7590){if(_0x1b7590){return _0x1893ac[_0xf7a4('0x15')](_0x357911)[_0xf7a4('0x17')](_0x1b7590);}};}function respondWithFilteredResult(_0x1fda23,_0x5b86f0){return function(_0x1d1216){if(_0x1d1216){var _0x3b3081=typeof _0x5b86f0['offset']===_0xf7a4('0x18')&&typeof _0x5b86f0[_0xf7a4('0x19')]===_0xf7a4('0x18');var _0x3d7888=_0x1d1216[_0xf7a4('0x1a')];var _0x19ec79=_0x3b3081?0x0:_0x5b86f0[_0xf7a4('0x1b')];var _0x3a7b02=_0x3b3081?_0x1d1216[_0xf7a4('0x1a')]:_0x5b86f0[_0xf7a4('0x1b')]+_0x5b86f0[_0xf7a4('0x19')];var _0x4c36f7;if(_0x3a7b02>=_0x3d7888){_0x3a7b02=_0x3d7888;_0x4c36f7=0xc8;}else{_0x4c36f7=0xce;}_0x1fda23[_0xf7a4('0x15')](_0x4c36f7);return _0x1fda23[_0xf7a4('0x1c')](_0xf7a4('0x1d'),_0x19ec79+'-'+_0x3a7b02+'/'+_0x3d7888)[_0xf7a4('0x17')](_0x1d1216);}return null;};}function patchUpdates(_0x2ccfdf){return function(_0x30d198){try{jsonpatch[_0xf7a4('0x1e')](_0x30d198,_0x2ccfdf,!![]);}catch(_0x48b276){return BPromise[_0xf7a4('0x1f')](_0x48b276);}return _0x30d198['save']();};}function saveUpdates(_0x183a9e,_0x54082f){return function(_0x15ff66){if(_0x15ff66){return _0x15ff66[_0xf7a4('0x20')](_0x183a9e)[_0xf7a4('0x21')](function(_0x5674cc){return _0x5674cc;});}return null;};}function removeEntity(_0x43f7b7,_0x327841){return function(_0x407b2a){if(_0x407b2a){return _0x407b2a['destroy']()[_0xf7a4('0x21')](function(){var _0x1ee96c=_0x407b2a[_0xf7a4('0x22')]({'plain':!![]});var _0xa59d08=_0xf7a4('0x23');return db['UserProfileResource'][_0xf7a4('0x24')]({'where':{'type':_0xa59d08,'resourceId':_0x1ee96c['id']}})[_0xf7a4('0x21')](function(){return _0x407b2a;});})['then'](function(){_0x43f7b7[_0xf7a4('0x15')](0xcc)[_0xf7a4('0x16')]();});}};}function handleEntityNotFound(_0x35fff0,_0x262f84){return function(_0x5fb1ee){if(!_0x5fb1ee){_0x35fff0[_0xf7a4('0x14')](0x194);}return _0x5fb1ee;};}function handleError(_0x93d2af,_0x131a6e){_0x131a6e=_0x131a6e||0x1f4;return function(_0x1fadad){logger[_0xf7a4('0x25')](_0x1fadad[_0xf7a4('0x26')]);if(_0x1fadad[_0xf7a4('0x27')]){delete _0x1fadad[_0xf7a4('0x27')];}_0x93d2af[_0xf7a4('0x15')](_0x131a6e)[_0xf7a4('0x28')](_0x1fadad);};}exports[_0xf7a4('0x29')]=function(_0x5091bf,_0x45f98f){var _0x1faeab={},_0x4a56c9={},_0x5b710b={'count':0x0,'rows':[]};var _0xda5de3=_[_0xf7a4('0x2a')](db['Pause'][_0xf7a4('0x2b')],function(_0xd8002c){return{'name':_0xd8002c['fieldName'],'type':_0xd8002c[_0xf7a4('0x2c')][_0xf7a4('0x2d')]};});_0x4a56c9[_0xf7a4('0x2e')]=_['map'](_0xda5de3,_0xf7a4('0x27'));_0x4a56c9[_0xf7a4('0x2f')]=_[_0xf7a4('0x30')](_0x5091bf[_0xf7a4('0x2f')]);_0x4a56c9[_0xf7a4('0x31')]=_['intersection'](_0x4a56c9[_0xf7a4('0x2e')],_0x4a56c9[_0xf7a4('0x2f')]);_0x1faeab[_0xf7a4('0x32')]=_[_0xf7a4('0x33')](_0x4a56c9[_0xf7a4('0x2e')],qs[_0xf7a4('0x34')](_0x5091bf[_0xf7a4('0x2f')][_0xf7a4('0x34')]));_0x1faeab[_0xf7a4('0x32')]=_0x1faeab['attributes'][_0xf7a4('0x35')]?_0x1faeab[_0xf7a4('0x32')]:_0x4a56c9[_0xf7a4('0x2e')];if(!_0x5091bf[_0xf7a4('0x2f')][_0xf7a4('0x36')](_0xf7a4('0x37'))){_0x1faeab['limit']=qs['limit'](_0x5091bf[_0xf7a4('0x2f')][_0xf7a4('0x19')]);_0x1faeab[_0xf7a4('0x1b')]=qs[_0xf7a4('0x1b')](_0x5091bf[_0xf7a4('0x2f')][_0xf7a4('0x1b')]);}_0x1faeab[_0xf7a4('0x38')]=qs[_0xf7a4('0x39')](_0x5091bf[_0xf7a4('0x2f')][_0xf7a4('0x39')]);_0x1faeab[_0xf7a4('0x3a')]=qs[_0xf7a4('0x31')](_[_0xf7a4('0x3b')](_0x5091bf[_0xf7a4('0x2f')],_0x4a56c9[_0xf7a4('0x31')]),_0xda5de3);if(_0x5091bf[_0xf7a4('0x2f')][_0xf7a4('0x3c')]){_0x1faeab[_0xf7a4('0x3a')]=_['merge'](_0x1faeab[_0xf7a4('0x3a')],{'$or':_[_0xf7a4('0x2a')](_0xda5de3,function(_0x16c972){if(_0x16c972[_0xf7a4('0x2c')]!=='VIRTUAL'){var _0x577356={};_0x577356[_0x16c972[_0xf7a4('0x27')]]={'$like':'%'+_0x5091bf[_0xf7a4('0x2f')][_0xf7a4('0x3c')]+'%'};return _0x577356;}})});}_0x1faeab=_[_0xf7a4('0x3d')]({},_0x1faeab,_0x5091bf[_0xf7a4('0x3e')]);var _0xd2c176={'where':_0x1faeab[_0xf7a4('0x3a')]};return db[_0xf7a4('0x3f')][_0xf7a4('0x1a')](_0xd2c176)[_0xf7a4('0x21')](function(_0x4af434){_0x5b710b[_0xf7a4('0x1a')]=_0x4af434;if(_0x5091bf[_0xf7a4('0x2f')][_0xf7a4('0x40')]){_0x1faeab[_0xf7a4('0x41')]=[{'all':!![]}];}return db[_0xf7a4('0x3f')][_0xf7a4('0x42')](_0x1faeab);})['then'](function(_0x1751a8){_0x5b710b[_0xf7a4('0x43')]=_0x1751a8;return _0x5b710b;})[_0xf7a4('0x21')](respondWithFilteredResult(_0x45f98f,_0x1faeab))[_0xf7a4('0x44')](handleError(_0x45f98f,null));};exports[_0xf7a4('0x45')]=function(_0x42c150,_0xc51814){var _0xfc30bc={'raw':!![],'where':{'id':_0x42c150[_0xf7a4('0x46')]['id']}},_0x1df3de={};_0x1df3de[_0xf7a4('0x2e')]=_[_0xf7a4('0x30')](db[_0xf7a4('0x3f')][_0xf7a4('0x2b')]);_0x1df3de[_0xf7a4('0x2f')]=_[_0xf7a4('0x30')](_0x42c150[_0xf7a4('0x2f')]);_0x1df3de[_0xf7a4('0x31')]=_[_0xf7a4('0x33')](_0x1df3de[_0xf7a4('0x2e')],_0x1df3de[_0xf7a4('0x2f')]);_0xfc30bc[_0xf7a4('0x32')]=_[_0xf7a4('0x33')](_0x1df3de[_0xf7a4('0x2e')],qs[_0xf7a4('0x34')](_0x42c150[_0xf7a4('0x2f')][_0xf7a4('0x34')]));_0xfc30bc[_0xf7a4('0x32')]=_0xfc30bc[_0xf7a4('0x32')][_0xf7a4('0x35')]?_0xfc30bc[_0xf7a4('0x32')]:_0x1df3de[_0xf7a4('0x2e')];if(_0x42c150['query'][_0xf7a4('0x40')]){_0xfc30bc[_0xf7a4('0x41')]=[{'all':!![]}];}_0xfc30bc=_[_0xf7a4('0x3d')]({},_0xfc30bc,_0x42c150['options']);return db['Pause'][_0xf7a4('0x47')](_0xfc30bc)[_0xf7a4('0x21')](handleEntityNotFound(_0xc51814,null))['then'](respondWithResult(_0xc51814,null))[_0xf7a4('0x44')](handleError(_0xc51814,null));};exports[_0xf7a4('0x48')]=function(_0x278a7a,_0x25f804){return db['Pause'][_0xf7a4('0x48')](_0x278a7a['body'],{})[_0xf7a4('0x21')](function(_0x46f7b3){var _0x4f0d15=_0x278a7a['user'][_0xf7a4('0x22')]({'plain':!![]});if(!_0x4f0d15)throw new Error(_0xf7a4('0x49'));if(_0x4f0d15['role']===_0xf7a4('0x4a')){var _0x2d762c=_0x46f7b3[_0xf7a4('0x22')]({'plain':!![]});var _0x2e17f6=_0xf7a4('0x23');return db[_0xf7a4('0x4b')][_0xf7a4('0x47')]({'where':{'name':_0x2e17f6,'userProfileId':_0x4f0d15[_0xf7a4('0x4c')]},'raw':!![]})[_0xf7a4('0x21')](function(_0x31d806){if(_0x31d806&&_0x31d806[_0xf7a4('0x4d')]===0x0){return db[_0xf7a4('0x4e')][_0xf7a4('0x48')]({'name':_0x2d762c[_0xf7a4('0x27')],'resourceId':_0x2d762c['id'],'type':_0x31d806[_0xf7a4('0x27')],'sectionId':_0x31d806['id']},{})[_0xf7a4('0x21')](function(){return _0x46f7b3;});}else{return _0x46f7b3;}})[_0xf7a4('0x44')](function(_0x161a69){logger[_0xf7a4('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x161a69);throw _0x161a69;});}return _0x46f7b3;})[_0xf7a4('0x21')](respondWithResult(_0x25f804,0xc9))[_0xf7a4('0x44')](handleError(_0x25f804,null));};exports['update']=function(_0x3754c7,_0x4b2026){if(_0x3754c7[_0xf7a4('0x4f')]['id']){delete _0x3754c7[_0xf7a4('0x4f')]['id'];}return db['Pause'][_0xf7a4('0x47')]({'where':{'id':_0x3754c7[_0xf7a4('0x46')]['id']}})[_0xf7a4('0x21')](handleEntityNotFound(_0x4b2026,null))[_0xf7a4('0x21')](saveUpdates(_0x3754c7[_0xf7a4('0x4f')],null))[_0xf7a4('0x21')](respondWithResult(_0x4b2026,null))[_0xf7a4('0x44')](handleError(_0x4b2026,null));};exports[_0xf7a4('0x24')]=function(_0x58dcb7,_0x417385){return db['Pause'][_0xf7a4('0x47')]({'where':{'id':_0x58dcb7[_0xf7a4('0x46')]['id']}})[_0xf7a4('0x21')](handleEntityNotFound(_0x417385,null))[_0xf7a4('0x21')](removeEntity(_0x417385,null))['catch'](handleError(_0x417385,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 08e5cbd..d08fa2a 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1157bb,_0x549e23){var _0x2a6249=function(_0x28a2fe){while(--_0x28a2fe){_0x1157bb['push'](_0x1157bb['shift']());}};_0x2a6249(++_0x549e23);}(_0x1cb9,0x14e));var _0x91cb=function(_0x97cf58,_0x2df2c2){_0x97cf58=_0x97cf58-0x0;var _0x24c252=_0x1cb9[_0x97cf58];return _0x24c252;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4dca4b,_0x17b898){var _0x2bc393=function(_0x5dbb7b){while(--_0x5dbb7b){_0x4dca4b['push'](_0x4dca4b['shift']());}};_0x2bc393(++_0x17b898);}(_0x326f,0xd1));var _0xf326=function(_0x42dd25,_0x5a4bd2){_0x42dd25=_0x42dd25-0x0;var _0x1bf563=_0x326f[_0x42dd25];return _0x1bf563;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index af358d3..3de366d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3f58ba,_0x2c94a4){var _0x3a608f=function(_0xc92b83){while(--_0xc92b83){_0x3f58ba['push'](_0x3f58ba['shift']());}};_0x3a608f(++_0x2c94a4);}(_0x7a54,0x106));var _0x47a5=function(_0xaeb6a0,_0x5a1ea4){_0xaeb6a0=_0xaeb6a0-0x0;var _0x2e57f3=_0x7a54[_0xaeb6a0];return _0x2e57f3;};'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')]('Pause,\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);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x2be274,_0x37c7b8){var _0x5a114d=function(_0x4f2f08){while(--_0x4f2f08){_0x2be274['push'](_0x2be274['shift']());}};_0x5a114d(++_0x37c7b8);}(_0xb10b,0x12a));var _0xbb10=function(_0x2df864,_0x1e1504){_0x2df864=_0x2df864-0x0;var _0x17a34b=_0xb10b[_0x2df864];return _0x17a34b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 2c84621..61a5f1b 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3b5=['server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','show','/:id/download','download','diskStorage','root'];(function(_0x1dcbcc,_0x31a0fc){var _0x38590e=function(_0xd1a9aa){while(--_0xd1a9aa){_0x1dcbcc['push'](_0x1dcbcc['shift']());}};_0x38590e(++_0x31a0fc);}(_0xc3b5,0x6f));var _0x5c3b=function(_0xe32f15,_0x21d7b2){_0xe32f15=_0xe32f15-0x0;var _0x1ff190=_0xc3b5[_0xe32f15];return _0x1ff190;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./plugin.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),controller[_0x5c3b('0xb')]);router[_0x5c3b('0x8')]('/:id',auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xc')]);router[_0x5c3b('0x8')](_0x5c3b('0xd'),auth['isAuthenticated'](),controller[_0x5c3b('0xe')]);var upload=multer({'storage':multer[_0x5c3b('0xf')]({'destination':function(_0x30ceca,_0x2e894a,_0x363c3d){_0x363c3d(null,path['join'](config[_0x5c3b('0x10')],_0x5c3b('0x11')));},'filename':function(_0x589c36,_0x1b2815,_0x3b953d){_0x1b2815['originalname']=_0x1b2815[_0x5c3b('0x12')][_0x5c3b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b953d(null,util[_0x5c3b('0x14')](_0x5c3b('0x15'),path[_0x5c3b('0x16')](_0x1b2815[_0x5c3b('0x12')],path[_0x5c3b('0x17')](_0x1b2815['originalname'])),Date[_0x5c3b('0x18')](),path['extname'](_0x1b2815['originalname'])));}})});router[_0x5c3b('0x19')]('/',upload[_0x5c3b('0x1a')](_0x5c3b('0x1b')),controller['upload']);router[_0x5c3b('0x19')](_0x5c3b('0xa'),controller[_0x5c3b('0x1c')]);router['put'](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller['update']);router[_0x5c3b('0x1e')](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x1e')]);module[_0x5c3b('0x1f')]=router; \ No newline at end of file +var _0x81bd=['diskStorage','join','root','server/files/plugins','originalname','format','basename','extname','now','post','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','show','/:id/download','download'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x81bd,0x7c));var _0xd81b=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x81bd[_0xa3463d];return _0x50fd67;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/webhook',controller['webhookGet']);router[_0xd81b('0xc')]('/:id',auth[_0xd81b('0xa')](),controller[_0xd81b('0xd')]);router[_0xd81b('0xc')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0xf')]);var upload=multer({'storage':multer[_0xd81b('0x10')]({'destination':function(_0x17e09f,_0x2090e1,_0x23c789){_0x23c789(null,path[_0xd81b('0x11')](config[_0xd81b('0x12')],_0xd81b('0x13')));},'filename':function(_0x560530,_0x21dfff,_0x57f71d){_0x21dfff[_0xd81b('0x14')]=_0x21dfff[_0xd81b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57f71d(null,util[_0xd81b('0x15')]('%s-%s%s',path[_0xd81b('0x16')](_0x21dfff[_0xd81b('0x14')],path[_0xd81b('0x17')](_0x21dfff[_0xd81b('0x14')])),Date[_0xd81b('0x18')](),path['extname'](_0x21dfff[_0xd81b('0x14')])));}})});router[_0xd81b('0x19')]('/',upload['single'](_0xd81b('0x1a')),controller[_0xd81b('0x1b')]);router[_0xd81b('0x19')](_0xd81b('0x1c'),controller[_0xd81b('0x1d')]);router[_0xd81b('0x1e')](_0xd81b('0x1f'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x20')]);router[_0xd81b('0x21')](_0xd81b('0x1f'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x21')]);module[_0xd81b('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c5757dc..73cf9a9 100644 --- a/server/api/plugin/plugin.attributes.js +++ b/server/api/plugin/plugin.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0709=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x0709,0x164));var _0x9070=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x0709[_0x5f1cf8];return _0x27d0fa;};'use strict';var Sequelize=require(_0x9070('0x0'));module[_0x9070('0x1')]={'name':{'type':Sequelize[_0x9070('0x2')]},'type':{'type':Sequelize['ENUM'](_0x9070('0x3'),'script')},'description':{'type':Sequelize[_0x9070('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x9070('0x5')},'active':{'type':Sequelize[_0x9070('0x6')],'defaultValue':0x0,'comment':_0x9070('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly','agentOnly','always','never'),'defaultValue':'always','comment':_0x9070('0x8')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x9070('0x2')]},'agentUrl':{'type':Sequelize[_0x9070('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x9070('0x2')]}}; \ No newline at end of file +var _0x5a76=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','html','script','TEXT','STRING','BOOLEAN'];(function(_0x265a24,_0x78b978){var _0x55d3da=function(_0x99060e){while(--_0x99060e){_0x265a24['push'](_0x265a24['shift']());}};_0x55d3da(++_0x78b978);}(_0x5a76,0xb0));var _0x65a7=function(_0xd97b73,_0xce94b1){_0xd97b73=_0xd97b73-0x0;var _0xefe357=_0x5a76[_0xd97b73];return _0xefe357;};'use strict';var Sequelize=require('sequelize');module[_0x65a7('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x65a7('0x1'),_0x65a7('0x2'))},'description':{'type':Sequelize[_0x65a7('0x3')]},'version':{'type':Sequelize[_0x65a7('0x3')]},'path':{'type':Sequelize[_0x65a7('0x4')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x65a7('0x5')],'defaultValue':0x0,'comment':_0x65a7('0x6')},'sidebar':{'type':Sequelize[_0x65a7('0x7')](_0x65a7('0x8'),_0x65a7('0x9'),_0x65a7('0xa'),_0x65a7('0xb')),'defaultValue':_0x65a7('0xa'),'comment':_0x65a7('0xc')},'icon':{'type':Sequelize[_0x65a7('0x4')]},'adminUrl':{'type':Sequelize[_0x65a7('0x4')]},'agentUrl':{'type':Sequelize[_0x65a7('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x65a7('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4c45c0b..b90c8d8 100644 --- a/server/api/plugin/plugin.controller.js +++ b/server/api/plugin/plugin.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2b8=['defaults','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','get','Plugins','UserProfileResource','destroy','error','name','send','index','map','Plugin','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','find','download','params','join','root','server/files/plugins','format','%s.zip','path','createWriteStream','warning','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','basename','node_modules/**/*','existsSync','Plugin\x20not\x20found','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','info','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2373c6,_0x4218c9){var _0xf2aaa9=function(_0x26eb3b){while(--_0x26eb3b){_0x2373c6['push'](_0x2373c6['shift']());}};_0xf2aaa9(++_0x4218c9);}(_0xf2b8,0x88));var _0x8f2b=function(_0x5dac53,_0x3d9600){_0x5dac53=_0x5dac53-0x0;var _0x3ee84d=_0xf2b8[_0x5dac53];return _0x3ee84d;};'use strict';var emlformat=require(_0x8f2b('0x0'));var rimraf=require(_0x8f2b('0x1'));var zipdir=require(_0x8f2b('0x2'));var jsonpatch=require(_0x8f2b('0x3'));var rp=require(_0x8f2b('0x4'));var moment=require(_0x8f2b('0x5'));var BPromise=require(_0x8f2b('0x6'));var Mustache=require(_0x8f2b('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8f2b('0x8'));var ejs=require(_0x8f2b('0x9'));var fs=require('fs');var fs_extra=require(_0x8f2b('0xa'));var _=require(_0x8f2b('0xb'));var squel=require(_0x8f2b('0xc'));var crypto=require(_0x8f2b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8f2b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8f2b('0xf'));var Papa=require(_0x8f2b('0x10'));var extract=require(_0x8f2b('0x11'));var rimraf=require(_0x8f2b('0x1'));var archiver=require(_0x8f2b('0x12'));var Redis=require('ioredis');var authService=require(_0x8f2b('0x13'));var qs=require(_0x8f2b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f2b('0x15'));var logger=require('../../config/logger')(_0x8f2b('0x16'));var utils=require('../../config/utils');var config=require(_0x8f2b('0x17'));var licenseUtil=require(_0x8f2b('0x18'));var db=require(_0x8f2b('0x19'))['db'];config['redis']=_[_0x8f2b('0x1a')](config[_0x8f2b('0x1b')],{'host':_0x8f2b('0x1c'),'port':0x18eb});var socket=require(_0x8f2b('0x1d'))(new Redis(config[_0x8f2b('0x1b')]));require(_0x8f2b('0x1e'))['register'](socket);function respondWithStatusCode(_0x477d09,_0x1955fe){_0x1955fe=_0x1955fe||0xcc;return function(_0x3afe4f){if(_0x3afe4f){return _0x477d09[_0x8f2b('0x1f')](_0x1955fe);}return _0x477d09[_0x8f2b('0x20')](_0x1955fe)[_0x8f2b('0x21')]();};}function respondWithResult(_0x523fd3,_0x3a27b9){_0x3a27b9=_0x3a27b9||0xc8;return function(_0x52b56b){if(_0x52b56b){return _0x523fd3['status'](_0x3a27b9)[_0x8f2b('0x22')](_0x52b56b);}};}function respondWithFilteredResult(_0x3b3465,_0x55c0fa){return function(_0x1d86b2){if(_0x1d86b2){var _0x38ce87=typeof _0x55c0fa[_0x8f2b('0x23')]==='undefined'&&typeof _0x55c0fa[_0x8f2b('0x24')]===_0x8f2b('0x25');var _0x2b029e=_0x1d86b2[_0x8f2b('0x26')];var _0x5c6d53=_0x38ce87?0x0:_0x55c0fa[_0x8f2b('0x23')];var _0x1a54b9=_0x38ce87?_0x1d86b2['count']:_0x55c0fa[_0x8f2b('0x23')]+_0x55c0fa['limit'];var _0x143dbf;if(_0x1a54b9>=_0x2b029e){_0x1a54b9=_0x2b029e;_0x143dbf=0xc8;}else{_0x143dbf=0xce;}_0x3b3465['status'](_0x143dbf);return _0x3b3465[_0x8f2b('0x27')](_0x8f2b('0x28'),_0x5c6d53+'-'+_0x1a54b9+'/'+_0x2b029e)['json'](_0x1d86b2);}return null;};}function patchUpdates(_0x4a05d3){return function(_0x1f87aa){try{jsonpatch[_0x8f2b('0x29')](_0x1f87aa,_0x4a05d3,!![]);}catch(_0x1e614d){return BPromise['reject'](_0x1e614d);}return _0x1f87aa[_0x8f2b('0x2a')]();};}function saveUpdates(_0x646474,_0x4c45e4){return function(_0x1d26da){if(_0x1d26da){return _0x1d26da[_0x8f2b('0x2b')](_0x646474)[_0x8f2b('0x2c')](function(_0x3c267f){return _0x3c267f;});}return null;};}function removeEntity(_0x2fc31f,_0x2cbe66){return function(_0x577085){if(_0x577085){return _0x577085['destroy']()[_0x8f2b('0x2c')](function(){var _0x13e695=_0x577085[_0x8f2b('0x2d')]({'plain':!![]});var _0xf58a06=_0x8f2b('0x2e');return db[_0x8f2b('0x2f')][_0x8f2b('0x30')]({'where':{'type':_0xf58a06,'resourceId':_0x13e695['id']}})[_0x8f2b('0x2c')](function(){return _0x577085;});})[_0x8f2b('0x2c')](function(){_0x2fc31f[_0x8f2b('0x20')](0xcc)[_0x8f2b('0x21')]();});}};}function handleEntityNotFound(_0x4a7714,_0x1d199f){return function(_0x4c1031){if(!_0x4c1031){_0x4a7714['sendStatus'](0x194);}return _0x4c1031;};}function handleError(_0x125b32,_0xfaf71c){_0xfaf71c=_0xfaf71c||0x1f4;return function(_0x20f484){logger[_0x8f2b('0x31')](_0x20f484['stack']);if(_0x20f484[_0x8f2b('0x32')]){delete _0x20f484[_0x8f2b('0x32')];}_0x125b32[_0x8f2b('0x20')](_0xfaf71c)[_0x8f2b('0x33')](_0x20f484);};}exports[_0x8f2b('0x34')]=function(_0x40f965,_0x897d37){var _0x4be8c1={},_0x52b27a={},_0x351192={'count':0x0,'rows':[]};var _0xe0799d=_[_0x8f2b('0x35')](db[_0x8f2b('0x36')][_0x8f2b('0x37')],function(_0x19334f){return{'name':_0x19334f['fieldName'],'type':_0x19334f[_0x8f2b('0x38')]['key']};});_0x52b27a['model']=_['map'](_0xe0799d,_0x8f2b('0x32'));_0x52b27a[_0x8f2b('0x39')]=_[_0x8f2b('0x3a')](_0x40f965[_0x8f2b('0x39')]);_0x52b27a[_0x8f2b('0x3b')]=_[_0x8f2b('0x3c')](_0x52b27a[_0x8f2b('0x3d')],_0x52b27a[_0x8f2b('0x39')]);_0x4be8c1[_0x8f2b('0x3e')]=_['intersection'](_0x52b27a[_0x8f2b('0x3d')],qs[_0x8f2b('0x3f')](_0x40f965['query'][_0x8f2b('0x3f')]));_0x4be8c1[_0x8f2b('0x3e')]=_0x4be8c1[_0x8f2b('0x3e')][_0x8f2b('0x40')]?_0x4be8c1[_0x8f2b('0x3e')]:_0x52b27a[_0x8f2b('0x3d')];if(!_0x40f965['query']['hasOwnProperty']('nolimit')){_0x4be8c1[_0x8f2b('0x24')]=qs[_0x8f2b('0x24')](_0x40f965[_0x8f2b('0x39')][_0x8f2b('0x24')]);_0x4be8c1[_0x8f2b('0x23')]=qs[_0x8f2b('0x23')](_0x40f965[_0x8f2b('0x39')]['offset']);}_0x4be8c1[_0x8f2b('0x41')]=qs[_0x8f2b('0x42')](_0x40f965[_0x8f2b('0x39')][_0x8f2b('0x42')]);_0x4be8c1['where']=qs[_0x8f2b('0x3b')](_['pick'](_0x40f965[_0x8f2b('0x39')],_0x52b27a[_0x8f2b('0x3b')]),_0xe0799d);if(_0x40f965[_0x8f2b('0x39')]['filter']){_0x4be8c1[_0x8f2b('0x43')]=_[_0x8f2b('0x44')](_0x4be8c1[_0x8f2b('0x43')],{'$or':_[_0x8f2b('0x35')](_0xe0799d,function(_0x374810){if(_0x374810[_0x8f2b('0x38')]!==_0x8f2b('0x45')){var _0x36d2ea={};_0x36d2ea[_0x374810[_0x8f2b('0x32')]]={'$like':'%'+_0x40f965[_0x8f2b('0x39')][_0x8f2b('0x46')]+'%'};return _0x36d2ea;}})});}_0x4be8c1=_['merge']({},_0x4be8c1,_0x40f965[_0x8f2b('0x47')]);var _0x790aa={'where':_0x4be8c1[_0x8f2b('0x43')]};return db[_0x8f2b('0x36')][_0x8f2b('0x26')](_0x790aa)['then'](function(_0x1e57f3){_0x351192[_0x8f2b('0x26')]=_0x1e57f3;if(_0x40f965[_0x8f2b('0x39')]['includeAll']){_0x4be8c1[_0x8f2b('0x48')]=[{'all':!![]}];}return db['Plugin'][_0x8f2b('0x49')](_0x4be8c1);})[_0x8f2b('0x2c')](function(_0x20d2b7){_0x351192[_0x8f2b('0x4a')]=_0x20d2b7;return _0x351192;})[_0x8f2b('0x2c')](respondWithFilteredResult(_0x897d37,_0x4be8c1))[_0x8f2b('0x4b')](handleError(_0x897d37,null));};exports[_0x8f2b('0x4c')]=function(_0x50ae9c,_0xb88c0c){var _0xa3c0c5={'raw':!![],'where':{'id':_0x50ae9c['params']['id']}},_0x41fa0e={};_0x41fa0e[_0x8f2b('0x3d')]=_[_0x8f2b('0x3a')](db[_0x8f2b('0x36')][_0x8f2b('0x37')]);_0x41fa0e[_0x8f2b('0x39')]=_[_0x8f2b('0x3a')](_0x50ae9c[_0x8f2b('0x39')]);_0x41fa0e['filters']=_['intersection'](_0x41fa0e['model'],_0x41fa0e[_0x8f2b('0x39')]);_0xa3c0c5[_0x8f2b('0x3e')]=_[_0x8f2b('0x3c')](_0x41fa0e[_0x8f2b('0x3d')],qs[_0x8f2b('0x3f')](_0x50ae9c[_0x8f2b('0x39')][_0x8f2b('0x3f')]));_0xa3c0c5['attributes']=_0xa3c0c5['attributes'][_0x8f2b('0x40')]?_0xa3c0c5['attributes']:_0x41fa0e[_0x8f2b('0x3d')];if(_0x50ae9c[_0x8f2b('0x39')]['includeAll']){_0xa3c0c5[_0x8f2b('0x48')]=[{'all':!![]}];}_0xa3c0c5=_[_0x8f2b('0x44')]({},_0xa3c0c5,_0x50ae9c[_0x8f2b('0x47')]);return db[_0x8f2b('0x36')][_0x8f2b('0x4d')](_0xa3c0c5)[_0x8f2b('0x2c')](handleEntityNotFound(_0xb88c0c,null))[_0x8f2b('0x2c')](respondWithResult(_0xb88c0c,null))[_0x8f2b('0x4b')](handleError(_0xb88c0c,null));};exports[_0x8f2b('0x4e')]=function(_0x1ab8e9,_0x47aeb7,_0x5cc3ab){return db['Plugin']['find']({'where':{'id':_0x1ab8e9[_0x8f2b('0x4f')]['id']},'attributes':[_0x8f2b('0x32'),'path'],'raw':!![]})[_0x8f2b('0x2c')](handleEntityNotFound(_0x47aeb7,null))[_0x8f2b('0x2c')](function(_0x33eae2){if(_0x33eae2){var _0x2bf6cc=path[_0x8f2b('0x50')](config[_0x8f2b('0x51')],_0x8f2b('0x52'),util[_0x8f2b('0x53')](_0x8f2b('0x54'),path['basename'](_0x33eae2[_0x8f2b('0x55')])));var _0x47bb65=fs[_0x8f2b('0x56')](_0x2bf6cc);var _0x448161=archiver('zip',{'zlib':{'level':0x9}});_0x448161['on'](_0x8f2b('0x57'),function(_0x27b190){if(_0x27b190['code']==='ENOENT'){logger[_0x8f2b('0x31')](_0x27b190);}else{throw new db['Sequelize'][(_0x8f2b('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x448161['on']('error',function(_0x478dd1){throw new db[(_0x8f2b('0x59'))][(_0x8f2b('0x58'))](_0x8f2b('0x5a'));});_0x448161['pipe'](_0x47bb65);_0x448161[_0x8f2b('0x5b')](_0x8f2b('0x5c'),{'cwd':path[_0x8f2b('0x50')](config[_0x8f2b('0x51')],_0x8f2b('0x52'),path['dirname'](_0x33eae2[_0x8f2b('0x55')])),'ignore':[path[_0x8f2b('0x50')](path[_0x8f2b('0x5d')](_0x33eae2[_0x8f2b('0x55')]),_0x8f2b('0x5e')),path[_0x8f2b('0x50')](path[_0x8f2b('0x5d')](_0x33eae2[_0x8f2b('0x55')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x47bb65['on']('close',function(){if(!fs[_0x8f2b('0x5f')](_0x2bf6cc)){throw new db[(_0x8f2b('0x59'))][(_0x8f2b('0x58'))](_0x8f2b('0x60'));}return _0x47aeb7[_0x8f2b('0x4e')](_0x2bf6cc,util[_0x8f2b('0x53')](_0x8f2b('0x54'),path[_0x8f2b('0x5d')](_0x33eae2[_0x8f2b('0x55')])),function(_0x4b88b5){if(_0x4b88b5){throw new db[(_0x8f2b('0x59'))][(_0x8f2b('0x58'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x8f2b('0x61')](_0x2bf6cc);logger['info'](_0x8f2b('0x62'));logger['info'](_0x8f2b('0x63'));});});}return null;})['catch'](handleError(_0x47aeb7,null));};exports[_0x8f2b('0x64')]=function(_0x4bb8b0,_0x51a386,_0x1e57bf){var _0x7939a2=path[_0x8f2b('0x5d')](_0x4bb8b0[_0x8f2b('0x65')][_0x8f2b('0x66')],path[_0x8f2b('0x67')](_0x4bb8b0[_0x8f2b('0x65')][_0x8f2b('0x66')]));var _0x398cbb=path[_0x8f2b('0x50')](config[_0x8f2b('0x51')],'server/files/plugins',_0x4bb8b0[_0x8f2b('0x65')]['filename']);var _0x3399f5=path[_0x8f2b('0x50')](config[_0x8f2b('0x51')],_0x8f2b('0x52'),_0x7939a2);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x398cbb);logger[_0x8f2b('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x3399f5);try{fs[_0x8f2b('0x69')](_0x398cbb,parseInt(_0x8f2b('0x6a'),0x8));extract(_0x398cbb,{'dir':_0x3399f5},function(_0x96f6f6){if(_0x96f6f6){logger['error'](_0x96f6f6);handleError(_0x96f6f6,!![]);};var _0x2fba41=fs['readdirSync'](_0x3399f5);if(_0x2fba41[_0x8f2b('0x40')]>0x1){removeReferences(_0x398cbb,_0x3399f5);logger[_0x8f2b('0x31')](_0x8f2b('0x6b'));return _0x1e57bf(new Error(_0x8f2b('0x6b')));}var _0x291352=fs['lstatSync'](path['join'](_0x3399f5,_0x2fba41[0x0]));if(_0x291352[_0x8f2b('0x6c')]()){removeReferences(_0x398cbb,_0x3399f5);logger[_0x8f2b('0x31')](_0x8f2b('0x6b'));return _0x1e57bf(new Error(_0x8f2b('0x6b')));}if(_0x291352[_0x8f2b('0x6d')]()){var _0x579a13=fs[_0x8f2b('0x6e')](path[_0x8f2b('0x50')](_0x3399f5,_0x2fba41[0x0]));if(_0x579a13[_0x8f2b('0x40')]===0x0){removeReferences(_0x398cbb,_0x3399f5);logger[_0x8f2b('0x31')](_0x8f2b('0x6b'));return _0x1e57bf(new Error(_0x8f2b('0x6b')));}var _0x33c653=_0x579a13['some'](function(_0x1f0791){return _0x1f0791==='manifest.json';});if(!_0x33c653){return _0x1e57bf(new Error(_0x8f2b('0x6f')));}var _0xc59aa4=fs[_0x8f2b('0x70')](path[_0x8f2b('0x50')](_0x3399f5,_0x2fba41[0x0],'manifest.json'));var _0x3a2cca=JSON[_0x8f2b('0x71')](_0xc59aa4);if(_0x8f2b('0x25')==typeof _0x3a2cca[_0x8f2b('0x32')]){return _0x1e57bf(new Error(_0x8f2b('0x72')));}if(_0x8f2b('0x25')==typeof _0x3a2cca['type']){return _0x1e57bf(new Error(_0x8f2b('0x73')));}if(_0x8f2b('0x25')==typeof _0x3a2cca[_0x8f2b('0x74')]){return _0x1e57bf(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x8f2b('0x25')==typeof _0x3a2cca['parameters']){return _0x1e57bf(new Error(_0x8f2b('0x75')));}if(_0x3a2cca['type']===_0x8f2b('0x76')){if('undefined'==typeof _0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x78')]){return _0x1e57bf(new Error(_0x8f2b('0x79')));}if(_0x8f2b('0x25')==typeof _0x3a2cca['parameters']['views'][_0x8f2b('0x7a')]&&_0x8f2b('0x25')==typeof _0x3a2cca['parameters'][_0x8f2b('0x78')][_0x8f2b('0x7b')]){return _0x1e57bf(new Error(_0x8f2b('0x7c')));}}else if(_0x3a2cca[_0x8f2b('0x38')]===_0x8f2b('0x7d')){if(_0x8f2b('0x25')==typeof _0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x7e')]){return _0x1e57bf(new Error(_0x8f2b('0x7f')));}if('undefined'==typeof _0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x80')]){return _0x1e57bf(new Error(_0x8f2b('0x81')));}}else{return _0x1e57bf(new Error(_0x8f2b('0x82')));}var _0x371682=_0x3a2cca['name'];var _0x54e363=_0x3a2cca['description'];var _0xe7305a=_0x3a2cca[_0x8f2b('0x38')];var _0x8906a3=_0x3a2cca['sidebar']?_0x3a2cca[_0x8f2b('0x83')]:'always';var _0x5cf113=_0x3a2cca[_0x8f2b('0x84')]?_0x3a2cca[_0x8f2b('0x84')]:'icon-apps';var _0x1b2872='';var _0x1b3dda='';var _0x4b2ccc='';var _0x5965a8='';var _0xeecce4=_0x3a2cca[_0x8f2b('0x74')];if(_0xe7305a===_0x8f2b('0x76')){if(_0x8f2b('0x25')!=typeof _0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x78')][_0x8f2b('0x7a')]){var _0x352ebb=_0x3a2cca['parameters'][_0x8f2b('0x78')][_0x8f2b('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x8f2b('0x85')](_0x352ebb)){_0x1b2872=path[_0x8f2b('0x50')](_0x8f2b('0x86'),_0x7939a2,_0x2fba41[0x0],_0x352ebb);}else{_0x1b2872=_0x352ebb;}}else{logger[_0x8f2b('0x68')](_0x8f2b('0x87'));}if('undefined'!=typeof _0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x78')]['agent']){var _0x25c252=_0x3a2cca[_0x8f2b('0x77')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x25c252)){_0x1b3dda=path[_0x8f2b('0x50')](_0x8f2b('0x86'),_0x7939a2,_0x2fba41[0x0],_0x25c252);}else{_0x1b3dda=_0x25c252;}}else{logger[_0x8f2b('0x68')](_0x8f2b('0x88'));}}else if(_0xe7305a===_0x8f2b('0x7d')){_0x4b2ccc=_0x3a2cca['parameters'][_0x8f2b('0x7e')];_0x5965a8=_0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x80')];if(_0x8f2b('0x25')!=typeof _0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x78')]){if(_0x8f2b('0x25')!=typeof _0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x78')]['admin']){var _0x352ebb=_0x3a2cca[_0x8f2b('0x77')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x8f2b('0x85')](_0x352ebb)){_0x1b2872=path[_0x8f2b('0x50')](_0x8f2b('0x86'),_0x7939a2,_0x2fba41[0x0],_0x352ebb);}else{_0x1b2872=_0x352ebb;}}if('undefined'!=typeof _0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x78')][_0x8f2b('0x7b')]){var _0x25c252=_0x3a2cca[_0x8f2b('0x77')][_0x8f2b('0x78')][_0x8f2b('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x8f2b('0x85')](_0x25c252)){_0x1b3dda=path['join'](_0x8f2b('0x86'),_0x7939a2,_0x2fba41[0x0],_0x25c252);}else{_0x1b3dda=_0x25c252;}}}}var _0x3e106b={'name':_0x371682,'description':_0x54e363,'path':path[_0x8f2b('0x50')](_0x7939a2,_0x2fba41[0x0]),'type':_0xe7305a,'sidebar':_0x8906a3,'icon':_0x5cf113,'adminUrl':_0x1b2872,'agentUrl':_0x1b3dda,'scriptName':_0x4b2ccc,'scriptPath':_0x5965a8,'version':_0xeecce4};removeReferences(_0x398cbb,null);return db[_0x8f2b('0x36')]['create'](_0x3e106b)[_0x8f2b('0x2c')](function(_0x19358b){var _0x1b18d8={'role':_0x4bb8b0[_0x8f2b('0x89')][_0x8f2b('0x8a')],'userProfileId':_0x4bb8b0[_0x8f2b('0x89')][_0x8f2b('0x8b')]};if(!_0x1b18d8)throw new Error(_0x8f2b('0x8c'));if(_0x1b18d8[_0x8f2b('0x8a')]==='user'){var _0x3fb47c=_0x19358b[_0x8f2b('0x2d')]({'plain':!![]});return db[_0x8f2b('0x8d')]['find']({'where':{'name':_0x8f2b('0x2e'),'userProfileId':_0x1b18d8[_0x8f2b('0x8b')]},'raw':!![]})[_0x8f2b('0x2c')](function(_0xe4c3f3){if(_0xe4c3f3&&_0xe4c3f3[_0x8f2b('0x8e')]===0x0){return db[_0x8f2b('0x2f')][_0x8f2b('0x8f')]({'name':_0x3fb47c[_0x8f2b('0x32')],'resourceId':_0x3fb47c['id'],'type':_0xe4c3f3[_0x8f2b('0x32')],'sectionId':_0xe4c3f3['id']},{})[_0x8f2b('0x2c')](function(){return _0x19358b;});}else{return _0x19358b;}})[_0x8f2b('0x4b')](function(_0x130dfa){logger[_0x8f2b('0x31')](_0x8f2b('0x90'),_0x130dfa);throw _0x130dfa;});}return _0x19358b;})[_0x8f2b('0x2c')](respondWithResult(_0x51a386,null))[_0x8f2b('0x4b')](handleError(_0x51a386,null));}});}catch(_0x4e7e4a){_0x51a386[_0x8f2b('0x20')](0x1f4)[_0x8f2b('0x33')](_0x4e7e4a);}};function removeReferences(_0x3cdc37,_0x226058){try{if(_0x3cdc37){fs[_0x8f2b('0x61')](_0x3cdc37);logger[_0x8f2b('0x68')](_0x8f2b('0x91'));}if(_0x226058){rimraf(_0x226058,function(){});logger[_0x8f2b('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x36be36){logger[_0x8f2b('0x31')](_0x36be36);}}exports[_0x8f2b('0x2b')]=function(_0x23c480,_0x1371b8,_0x2b6f90){return db[_0x8f2b('0x36')][_0x8f2b('0x4d')]({'where':{'id':_0x23c480[_0x8f2b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1371b8,null))['then'](saveUpdates(_0x23c480[_0x8f2b('0x89')],null))['then'](respondWithResult(_0x1371b8,null))[_0x8f2b('0x4b')](handleError(_0x1371b8,null));};exports[_0x8f2b('0x92')]=function(_0x27dd80,_0x44df08,_0xbcda8c){return db[_0x8f2b('0x36')]['find']({'where':{'id':_0x27dd80[_0x8f2b('0x4f')]['id']}})[_0x8f2b('0x2c')](function(_0x1556ce){if(_0x1556ce){return _0x1556ce[_0x8f2b('0x30')]();}})[_0x8f2b('0x2c')](function(_0x42610d){rimraf(path['join'](config[_0x8f2b('0x51')],_0x8f2b('0x52'),path[_0x8f2b('0x93')](_0x42610d['path'])),function(){});return _0x42610d;})['then'](handleEntityNotFound(_0x44df08,null))['then'](respondWithStatusCode(_0x44df08,null))[_0x8f2b('0x4b')](handleError(_0x44df08,null));};exports[_0x8f2b('0x94')]=function(_0x34faf9,_0x4682ef,_0x2c17ce){return BPromise[_0x8f2b('0x95')]()[_0x8f2b('0x2c')](function(){if(!_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x55')]){throw new Error(_0x8f2b('0x96'));}if(!_0x34faf9[_0x8f2b('0x39')]['port']){throw new Error(_0x8f2b('0x97'));}var _0x2e2b53=_0x34faf9['query'][_0x8f2b('0x98')]?_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x98')]+':'+_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x99')]:_0x8f2b('0x9a')+_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x99')];var _0xe0e010=_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x22')]?_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x22')]:!![];var _0x200002=_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x9b')]?_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x9b')]:null;var _0x33da40={'method':_0x34faf9['method'],'uri':util[_0x8f2b('0x53')](_0x8f2b('0x9c'),_0x2e2b53,_0x34faf9[_0x8f2b('0x39')][_0x8f2b('0x55')]),'json':_0xe0e010,'resolveWithFullResponse':!![],'encoding':_0x200002,'qs':_0x34faf9[_0x8f2b('0x39')]};if(_0x34faf9[_0x8f2b('0x9d')]){_0x33da40['headers']=_0x34faf9[_0x8f2b('0x9d')];if(_0x33da40[_0x8f2b('0x9d')]['content-length']){delete _0x33da40['headers'][_0x8f2b('0x9e')];}}if(_0x33da40['headers']['content-type']){delete _0x33da40['headers'][_0x8f2b('0x9f')];}return rp(_0x33da40);})[_0x8f2b('0x2c')](function(_0x48bdab){if(_0x48bdab){_0x4682ef[_0x8f2b('0x27')](_0x48bdab[_0x8f2b('0x9d')]);logger[_0x8f2b('0x68')](_0x48bdab['body']);if(_['endsWith'](_0x34faf9[_0x8f2b('0x39')]['path'],_0x8f2b('0x4e'))&&_0x48bdab[_0x8f2b('0xa0')]==0x1f4){return _0x4682ef[_0x8f2b('0x1f')](_0x48bdab[_0x8f2b('0xa0')]);}else{return _0x4682ef['status'](_0x48bdab['statusCode'])['send'](_0x48bdab['body']);}}else{return _0x4682ef[_0x8f2b('0x1f')](0xc8);}})[_0x8f2b('0x4b')](handleError(_0x4682ef,null));};exports[_0x8f2b('0xa1')]=function(_0x3fd180,_0x418a9a,_0x40a492){return BPromise[_0x8f2b('0x95')]()[_0x8f2b('0x2c')](function(){if(!_0x3fd180[_0x8f2b('0x39')]['path']){throw new Error(_0x8f2b('0x96'));}if(!_0x3fd180[_0x8f2b('0x39')][_0x8f2b('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x36188c=_0x3fd180['query']['hostname']?_0x3fd180['query']['hostname']+':'+_0x3fd180['query'][_0x8f2b('0x99')]:_0x8f2b('0x9a')+_0x3fd180[_0x8f2b('0x39')][_0x8f2b('0x99')];var _0x257932=_0x3fd180[_0x8f2b('0x39')][_0x8f2b('0x22')]?_0x3fd180[_0x8f2b('0x39')][_0x8f2b('0x22')]:!![];var _0x129d7e=_0x3fd180[_0x8f2b('0x39')]['encoding']?_0x3fd180['query']['encoding']:null;var _0x4d5966={'method':_0x3fd180['method'],'uri':util[_0x8f2b('0x53')](_0x8f2b('0x9c'),_0x36188c,_0x3fd180['query']['path']),'json':_0x257932,'resolveWithFullResponse':!![],'encoding':_0x129d7e,'body':_0x3fd180['body']};if(_0x3fd180[_0x8f2b('0x9d')]){_0x4d5966[_0x8f2b('0x9d')]=_0x3fd180[_0x8f2b('0x9d')];if(_0x4d5966[_0x8f2b('0x9d')][_0x8f2b('0x9e')]){delete _0x4d5966[_0x8f2b('0x9d')][_0x8f2b('0x9e')];}}if(_0x4d5966['headers'][_0x8f2b('0x9f')]){delete _0x4d5966[_0x8f2b('0x9d')]['content-type'];}return rp(_0x4d5966);})['then'](function(_0x3d4791){if(_0x3d4791){_0x418a9a['set'](_0x3d4791['headers']);logger[_0x8f2b('0x68')](_0x3d4791[_0x8f2b('0x89')]);return _0x418a9a[_0x8f2b('0x20')](_0x3d4791[_0x8f2b('0xa0')])[_0x8f2b('0x33')](_0x3d4791['body']);}else{return _0x418a9a['sendStatus'](0xc8);}})['catch'](handleError(_0x418a9a,null));}; \ No newline at end of file +var _0xd932=['scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Plugin','includeAll','include','rows','catch','params','keys','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','views','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script'];(function(_0x44b4cf,_0x4d717f){var _0x5d21fa=function(_0x2b1caa){while(--_0x2b1caa){_0x44b4cf['push'](_0x44b4cf['shift']());}};_0x5d21fa(++_0x4d717f);}(_0xd932,0xcb));var _0x2d93=function(_0x2b4ac9,_0x4d229b){_0x2b4ac9=_0x2b4ac9-0x0;var _0x157c6c=_0xd932[_0x2b4ac9];return _0x157c6c;};'use strict';var emlformat=require(_0x2d93('0x0'));var rimraf=require(_0x2d93('0x1'));var zipdir=require(_0x2d93('0x2'));var jsonpatch=require(_0x2d93('0x3'));var rp=require(_0x2d93('0x4'));var moment=require(_0x2d93('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2d93('0x6'));var util=require('util');var path=require(_0x2d93('0x7'));var sox=require(_0x2d93('0x8'));var csv=require(_0x2d93('0x9'));var ejs=require(_0x2d93('0xa'));var fs=require('fs');var fs_extra=require(_0x2d93('0xb'));var _=require(_0x2d93('0xc'));var squel=require('squel');var crypto=require(_0x2d93('0xd'));var jsforce=require(_0x2d93('0xe'));var deskjs=require(_0x2d93('0xf'));var toCsv=require(_0x2d93('0x9'));var querystring=require(_0x2d93('0x10'));var Papa=require(_0x2d93('0x11'));var extract=require(_0x2d93('0x12'));var rimraf=require(_0x2d93('0x1'));var archiver=require(_0x2d93('0x13'));var Redis=require(_0x2d93('0x14'));var authService=require(_0x2d93('0x15'));var qs=require(_0x2d93('0x16'));var as=require(_0x2d93('0x17'));var hardwareService=require(_0x2d93('0x18'));var logger=require(_0x2d93('0x19'))(_0x2d93('0x1a'));var utils=require(_0x2d93('0x1b'));var config=require(_0x2d93('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d93('0x1d'))['db'];config['redis']=_['defaults'](config[_0x2d93('0x1e')],{'host':_0x2d93('0x1f'),'port':0x18eb});var socket=require(_0x2d93('0x20'))(new Redis(config[_0x2d93('0x1e')]));require(_0x2d93('0x21'))[_0x2d93('0x22')](socket);function respondWithStatusCode(_0x17d5af,_0x5abf52){_0x5abf52=_0x5abf52||0xcc;return function(_0x47136c){if(_0x47136c){return _0x17d5af['sendStatus'](_0x5abf52);}return _0x17d5af[_0x2d93('0x23')](_0x5abf52)[_0x2d93('0x24')]();};}function respondWithResult(_0xb5f6f5,_0x547f5e){_0x547f5e=_0x547f5e||0xc8;return function(_0x5ec896){if(_0x5ec896){return _0xb5f6f5[_0x2d93('0x23')](_0x547f5e)[_0x2d93('0x25')](_0x5ec896);}};}function respondWithFilteredResult(_0x4bd83e,_0x171c09){return function(_0x298cf5){if(_0x298cf5){var _0x52fea0=typeof _0x171c09[_0x2d93('0x26')]===_0x2d93('0x27')&&typeof _0x171c09[_0x2d93('0x28')]===_0x2d93('0x27');var _0x5e2854=_0x298cf5['count'];var _0x4b74c8=_0x52fea0?0x0:_0x171c09[_0x2d93('0x26')];var _0x466fd4=_0x52fea0?_0x298cf5[_0x2d93('0x29')]:_0x171c09['offset']+_0x171c09['limit'];var _0xb8b77a;if(_0x466fd4>=_0x5e2854){_0x466fd4=_0x5e2854;_0xb8b77a=0xc8;}else{_0xb8b77a=0xce;}_0x4bd83e['status'](_0xb8b77a);return _0x4bd83e['set']('Content-Range',_0x4b74c8+'-'+_0x466fd4+'/'+_0x5e2854)[_0x2d93('0x25')](_0x298cf5);}return null;};}function patchUpdates(_0x552c53){return function(_0x3edf5b){try{jsonpatch['apply'](_0x3edf5b,_0x552c53,!![]);}catch(_0x1d7381){return BPromise[_0x2d93('0x2a')](_0x1d7381);}return _0x3edf5b[_0x2d93('0x2b')]();};}function saveUpdates(_0x471044,_0x3e9d8f){return function(_0x81d4c8){if(_0x81d4c8){return _0x81d4c8[_0x2d93('0x2c')](_0x471044)['then'](function(_0x2c51f1){return _0x2c51f1;});}return null;};}function removeEntity(_0x2115bb,_0x53dc5d){return function(_0x2fc2a2){if(_0x2fc2a2){return _0x2fc2a2[_0x2d93('0x2d')]()[_0x2d93('0x2e')](function(){var _0x4656d2=_0x2fc2a2[_0x2d93('0x2f')]({'plain':!![]});var _0x4591d5='Plugins';return db[_0x2d93('0x30')][_0x2d93('0x2d')]({'where':{'type':_0x4591d5,'resourceId':_0x4656d2['id']}})['then'](function(){return _0x2fc2a2;});})[_0x2d93('0x2e')](function(){_0x2115bb[_0x2d93('0x23')](0xcc)[_0x2d93('0x24')]();});}};}function handleEntityNotFound(_0x4565f4,_0x2bcd6c){return function(_0x1036f0){if(!_0x1036f0){_0x4565f4[_0x2d93('0x31')](0x194);}return _0x1036f0;};}function handleError(_0x3551c1,_0x297589){_0x297589=_0x297589||0x1f4;return function(_0x30fb3e){logger[_0x2d93('0x32')](_0x30fb3e['stack']);if(_0x30fb3e[_0x2d93('0x33')]){delete _0x30fb3e[_0x2d93('0x33')];}_0x3551c1[_0x2d93('0x23')](_0x297589)[_0x2d93('0x34')](_0x30fb3e);};}exports[_0x2d93('0x35')]=function(_0x5485e5,_0x41dcf4){var _0x4a2192={},_0x34d1ca={},_0x57c5b3={'count':0x0,'rows':[]};var _0x5e6001=_['map'](db['Plugin'][_0x2d93('0x36')],function(_0x3d400f){return{'name':_0x3d400f[_0x2d93('0x37')],'type':_0x3d400f[_0x2d93('0x38')][_0x2d93('0x39')]};});_0x34d1ca['model']=_[_0x2d93('0x3a')](_0x5e6001,_0x2d93('0x33'));_0x34d1ca[_0x2d93('0x3b')]=_['keys'](_0x5485e5['query']);_0x34d1ca[_0x2d93('0x3c')]=_[_0x2d93('0x3d')](_0x34d1ca[_0x2d93('0x3e')],_0x34d1ca['query']);_0x4a2192[_0x2d93('0x3f')]=_['intersection'](_0x34d1ca[_0x2d93('0x3e')],qs['fields'](_0x5485e5[_0x2d93('0x3b')][_0x2d93('0x40')]));_0x4a2192[_0x2d93('0x3f')]=_0x4a2192['attributes'][_0x2d93('0x41')]?_0x4a2192[_0x2d93('0x3f')]:_0x34d1ca[_0x2d93('0x3e')];if(!_0x5485e5['query'][_0x2d93('0x42')](_0x2d93('0x43'))){_0x4a2192[_0x2d93('0x28')]=qs[_0x2d93('0x28')](_0x5485e5[_0x2d93('0x3b')][_0x2d93('0x28')]);_0x4a2192[_0x2d93('0x26')]=qs[_0x2d93('0x26')](_0x5485e5[_0x2d93('0x3b')][_0x2d93('0x26')]);}_0x4a2192['order']=qs['sort'](_0x5485e5[_0x2d93('0x3b')][_0x2d93('0x44')]);_0x4a2192['where']=qs[_0x2d93('0x3c')](_[_0x2d93('0x45')](_0x5485e5[_0x2d93('0x3b')],_0x34d1ca['filters']),_0x5e6001);if(_0x5485e5[_0x2d93('0x3b')][_0x2d93('0x46')]){_0x4a2192[_0x2d93('0x47')]=_[_0x2d93('0x48')](_0x4a2192[_0x2d93('0x47')],{'$or':_[_0x2d93('0x3a')](_0x5e6001,function(_0x53e542){if(_0x53e542[_0x2d93('0x38')]!==_0x2d93('0x49')){var _0x2e4cee={};_0x2e4cee[_0x53e542[_0x2d93('0x33')]]={'$like':'%'+_0x5485e5[_0x2d93('0x3b')][_0x2d93('0x46')]+'%'};return _0x2e4cee;}})});}_0x4a2192=_[_0x2d93('0x48')]({},_0x4a2192,_0x5485e5[_0x2d93('0x4a')]);var _0x59c83e={'where':_0x4a2192[_0x2d93('0x47')]};return db[_0x2d93('0x4b')]['count'](_0x59c83e)[_0x2d93('0x2e')](function(_0x3f6dcf){_0x57c5b3[_0x2d93('0x29')]=_0x3f6dcf;if(_0x5485e5[_0x2d93('0x3b')][_0x2d93('0x4c')]){_0x4a2192[_0x2d93('0x4d')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x4a2192);})[_0x2d93('0x2e')](function(_0x29bb36){_0x57c5b3[_0x2d93('0x4e')]=_0x29bb36;return _0x57c5b3;})[_0x2d93('0x2e')](respondWithFilteredResult(_0x41dcf4,_0x4a2192))[_0x2d93('0x4f')](handleError(_0x41dcf4,null));};exports['show']=function(_0x17bf54,_0x46b01c){var _0x598bf6={'raw':!![],'where':{'id':_0x17bf54[_0x2d93('0x50')]['id']}},_0x4d4a89={};_0x4d4a89[_0x2d93('0x3e')]=_[_0x2d93('0x51')](db[_0x2d93('0x4b')][_0x2d93('0x36')]);_0x4d4a89[_0x2d93('0x3b')]=_['keys'](_0x17bf54[_0x2d93('0x3b')]);_0x4d4a89['filters']=_[_0x2d93('0x3d')](_0x4d4a89['model'],_0x4d4a89[_0x2d93('0x3b')]);_0x598bf6[_0x2d93('0x3f')]=_[_0x2d93('0x3d')](_0x4d4a89[_0x2d93('0x3e')],qs['fields'](_0x17bf54[_0x2d93('0x3b')][_0x2d93('0x40')]));_0x598bf6[_0x2d93('0x3f')]=_0x598bf6['attributes'][_0x2d93('0x41')]?_0x598bf6['attributes']:_0x4d4a89['model'];if(_0x17bf54[_0x2d93('0x3b')][_0x2d93('0x4c')]){_0x598bf6[_0x2d93('0x4d')]=[{'all':!![]}];}_0x598bf6=_[_0x2d93('0x48')]({},_0x598bf6,_0x17bf54[_0x2d93('0x4a')]);return db['Plugin'][_0x2d93('0x52')](_0x598bf6)[_0x2d93('0x2e')](handleEntityNotFound(_0x46b01c,null))['then'](respondWithResult(_0x46b01c,null))[_0x2d93('0x4f')](handleError(_0x46b01c,null));};exports[_0x2d93('0x53')]=function(_0x55bd77,_0x300fb4,_0x382d8a){return db[_0x2d93('0x4b')][_0x2d93('0x52')]({'where':{'id':_0x55bd77[_0x2d93('0x50')]['id']},'attributes':['name','path'],'raw':!![]})[_0x2d93('0x2e')](handleEntityNotFound(_0x300fb4,null))[_0x2d93('0x2e')](function(_0x16c046){if(_0x16c046){var _0x311cad=path[_0x2d93('0x54')](config[_0x2d93('0x55')],_0x2d93('0x56'),util['format'](_0x2d93('0x57'),path[_0x2d93('0x58')](_0x16c046[_0x2d93('0x7')])));var _0x5eeb52=fs[_0x2d93('0x59')](_0x311cad);var _0x104c1a=archiver('zip',{'zlib':{'level':0x9}});_0x104c1a['on'](_0x2d93('0x5a'),function(_0x2ec7a5){if(_0x2ec7a5[_0x2d93('0x5b')]===_0x2d93('0x5c')){logger[_0x2d93('0x32')](_0x2ec7a5);}else{throw new db[(_0x2d93('0x5d'))][(_0x2d93('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x104c1a['on'](_0x2d93('0x32'),function(_0x31b097){throw new db['Sequelize']['Error'](_0x2d93('0x5f'));});_0x104c1a[_0x2d93('0x60')](_0x5eeb52);_0x104c1a[_0x2d93('0x61')]('**/*',{'cwd':path[_0x2d93('0x54')](config[_0x2d93('0x55')],_0x2d93('0x56'),path[_0x2d93('0x62')](_0x16c046[_0x2d93('0x7')])),'ignore':[path[_0x2d93('0x54')](path[_0x2d93('0x58')](_0x16c046[_0x2d93('0x7')]),_0x2d93('0x63')),path[_0x2d93('0x54')](path[_0x2d93('0x58')](_0x16c046['path']),_0x2d93('0x64'))],'nodir':!![]})['finalize']();_0x5eeb52['on'](_0x2d93('0x65'),function(){if(!fs['existsSync'](_0x311cad)){throw new db[(_0x2d93('0x5d'))][(_0x2d93('0x5e'))](_0x2d93('0x66'));}return _0x300fb4[_0x2d93('0x53')](_0x311cad,util[_0x2d93('0x67')](_0x2d93('0x57'),path[_0x2d93('0x58')](_0x16c046['path'])),function(_0x31bf88){if(_0x31bf88){throw new db[(_0x2d93('0x5d'))][(_0x2d93('0x5e'))](_0x2d93('0x68'));}fs[_0x2d93('0x69')](_0x311cad);logger[_0x2d93('0x6a')](_0x2d93('0x6b'));logger['info'](_0x2d93('0x6c'));});});}return null;})[_0x2d93('0x4f')](handleError(_0x300fb4,null));};exports[_0x2d93('0x6d')]=function(_0x43bf1d,_0x466a6d,_0x5d7510){var _0x1d4cf8=path[_0x2d93('0x58')](_0x43bf1d[_0x2d93('0x6e')]['filename'],path[_0x2d93('0x6f')](_0x43bf1d[_0x2d93('0x6e')]['filename']));var _0x258595=path[_0x2d93('0x54')](config[_0x2d93('0x55')],_0x2d93('0x56'),_0x43bf1d[_0x2d93('0x6e')]['filename']);var _0x3de719=path[_0x2d93('0x54')](config[_0x2d93('0x55')],_0x2d93('0x56'),_0x1d4cf8);logger[_0x2d93('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x258595);logger[_0x2d93('0x6a')](_0x2d93('0x70'),_0x3de719);try{fs[_0x2d93('0x71')](_0x258595,parseInt(_0x2d93('0x72'),0x8));extract(_0x258595,{'dir':_0x3de719},function(_0x25bc9f){if(_0x25bc9f){logger[_0x2d93('0x32')](_0x25bc9f);handleError(_0x25bc9f,!![]);};var _0x47e6b1=fs[_0x2d93('0x73')](_0x3de719);if(_0x47e6b1[_0x2d93('0x41')]>0x1){removeReferences(_0x258595,_0x3de719);logger[_0x2d93('0x32')](_0x2d93('0x74'));return _0x5d7510(new Error(_0x2d93('0x74')));}var _0x50e1e5=fs[_0x2d93('0x75')](path[_0x2d93('0x54')](_0x3de719,_0x47e6b1[0x0]));if(_0x50e1e5['isFile']()){removeReferences(_0x258595,_0x3de719);logger[_0x2d93('0x32')](_0x2d93('0x74'));return _0x5d7510(new Error(_0x2d93('0x74')));}if(_0x50e1e5[_0x2d93('0x76')]()){var _0x1af207=fs['readdirSync'](path['join'](_0x3de719,_0x47e6b1[0x0]));if(_0x1af207['length']===0x0){removeReferences(_0x258595,_0x3de719);logger[_0x2d93('0x32')](_0x2d93('0x74'));return _0x5d7510(new Error('Invalid\x20plugin\x20structure'));}var _0x3a3eed=_0x1af207[_0x2d93('0x77')](function(_0x202a44){return _0x202a44===_0x2d93('0x78');});if(!_0x3a3eed){return _0x5d7510(new Error(_0x2d93('0x79')));}var _0x3f62f3=fs['readFileSync'](path[_0x2d93('0x54')](_0x3de719,_0x47e6b1[0x0],_0x2d93('0x78')));var _0x3ca447=JSON[_0x2d93('0x7a')](_0x3f62f3);if(_0x2d93('0x27')==typeof _0x3ca447[_0x2d93('0x33')]){return _0x5d7510(new Error(_0x2d93('0x7b')));}if(_0x2d93('0x27')==typeof _0x3ca447[_0x2d93('0x38')]){return _0x5d7510(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x2d93('0x27')==typeof _0x3ca447[_0x2d93('0x7c')]){return _0x5d7510(new Error(_0x2d93('0x7d')));}if(_0x2d93('0x27')==typeof _0x3ca447[_0x2d93('0x7e')]){return _0x5d7510(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3ca447['type']==='html'){if(_0x2d93('0x27')==typeof _0x3ca447['parameters']['views']){return _0x5d7510(new Error(_0x2d93('0x7f')));}if(_0x2d93('0x27')==typeof _0x3ca447[_0x2d93('0x7e')]['views']['admin']&&_0x2d93('0x27')==typeof _0x3ca447['parameters']['views'][_0x2d93('0x80')]){return _0x5d7510(new Error(_0x2d93('0x81')));}}else if(_0x3ca447[_0x2d93('0x38')]==='script'){if(_0x2d93('0x27')==typeof _0x3ca447[_0x2d93('0x7e')][_0x2d93('0x82')]){return _0x5d7510(new Error(_0x2d93('0x83')));}if('undefined'==typeof _0x3ca447[_0x2d93('0x7e')]['scriptPath']){return _0x5d7510(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x5d7510(new Error(_0x2d93('0x84')));}var _0x10ff48=_0x3ca447[_0x2d93('0x33')];var _0x3927cf=_0x3ca447[_0x2d93('0x85')];var _0x940490=_0x3ca447[_0x2d93('0x38')];var _0x4f9df2=_0x3ca447[_0x2d93('0x86')]?_0x3ca447[_0x2d93('0x86')]:_0x2d93('0x87');var _0x4398e4=_0x3ca447[_0x2d93('0x88')]?_0x3ca447['icon']:_0x2d93('0x89');var _0x4e0e71='';var _0x30dd00='';var _0x4dc3dc='';var _0x3a46ad='';var _0x51d13b=_0x3ca447[_0x2d93('0x7c')];if(_0x940490==='html'){if(_0x2d93('0x27')!=typeof _0x3ca447['parameters'][_0x2d93('0x8a')][_0x2d93('0x8b')]){var _0x422cba=_0x3ca447[_0x2d93('0x7e')]['views'][_0x2d93('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x2d93('0x8c')](_0x422cba)){_0x4e0e71=path[_0x2d93('0x54')](_0x2d93('0x8d'),_0x1d4cf8,_0x47e6b1[0x0],_0x422cba);}else{_0x4e0e71=_0x422cba;}}else{logger[_0x2d93('0x6a')](_0x2d93('0x8e'));}if('undefined'!=typeof _0x3ca447[_0x2d93('0x7e')]['views'][_0x2d93('0x80')]){var _0x2093a7=_0x3ca447[_0x2d93('0x7e')][_0x2d93('0x8a')][_0x2d93('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x2d93('0x8c')](_0x2093a7)){_0x30dd00=path[_0x2d93('0x54')](_0x2d93('0x8d'),_0x1d4cf8,_0x47e6b1[0x0],_0x2093a7);}else{_0x30dd00=_0x2093a7;}}else{logger[_0x2d93('0x6a')](_0x2d93('0x8f'));}}else if(_0x940490===_0x2d93('0x90')){_0x4dc3dc=_0x3ca447[_0x2d93('0x7e')][_0x2d93('0x82')];_0x3a46ad=_0x3ca447['parameters'][_0x2d93('0x91')];if('undefined'!=typeof _0x3ca447[_0x2d93('0x7e')]['views']){if(_0x2d93('0x27')!=typeof _0x3ca447[_0x2d93('0x7e')][_0x2d93('0x8a')][_0x2d93('0x8b')]){var _0x422cba=_0x3ca447[_0x2d93('0x7e')][_0x2d93('0x8a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x2d93('0x8c')](_0x422cba)){_0x4e0e71=path[_0x2d93('0x54')](_0x2d93('0x8d'),_0x1d4cf8,_0x47e6b1[0x0],_0x422cba);}else{_0x4e0e71=_0x422cba;}}if('undefined'!=typeof _0x3ca447[_0x2d93('0x7e')][_0x2d93('0x8a')][_0x2d93('0x80')]){var _0x2093a7=_0x3ca447[_0x2d93('0x7e')][_0x2d93('0x8a')][_0x2d93('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x2d93('0x8c')](_0x2093a7)){_0x30dd00=path[_0x2d93('0x54')](_0x2d93('0x8d'),_0x1d4cf8,_0x47e6b1[0x0],_0x2093a7);}else{_0x30dd00=_0x2093a7;}}}}var _0x417789={'name':_0x10ff48,'description':_0x3927cf,'path':path[_0x2d93('0x54')](_0x1d4cf8,_0x47e6b1[0x0]),'type':_0x940490,'sidebar':_0x4f9df2,'icon':_0x4398e4,'adminUrl':_0x4e0e71,'agentUrl':_0x30dd00,'scriptName':_0x4dc3dc,'scriptPath':_0x3a46ad,'version':_0x51d13b};removeReferences(_0x258595,null);return db[_0x2d93('0x4b')][_0x2d93('0x92')](_0x417789)[_0x2d93('0x2e')](function(_0x4e6d37){var _0x8038a8={'role':_0x43bf1d[_0x2d93('0x93')][_0x2d93('0x94')],'userProfileId':_0x43bf1d[_0x2d93('0x93')][_0x2d93('0x95')]};if(!_0x8038a8)throw new Error(_0x2d93('0x96'));if(_0x8038a8[_0x2d93('0x94')]===_0x2d93('0x97')){var _0x39d9e2=_0x4e6d37[_0x2d93('0x2f')]({'plain':!![]});return db[_0x2d93('0x98')][_0x2d93('0x52')]({'where':{'name':_0x2d93('0x99'),'userProfileId':_0x8038a8[_0x2d93('0x95')]},'raw':!![]})[_0x2d93('0x2e')](function(_0x3ca765){if(_0x3ca765&&_0x3ca765[_0x2d93('0x9a')]===0x0){return db[_0x2d93('0x30')][_0x2d93('0x92')]({'name':_0x39d9e2['name'],'resourceId':_0x39d9e2['id'],'type':_0x3ca765[_0x2d93('0x33')],'sectionId':_0x3ca765['id']},{})[_0x2d93('0x2e')](function(){return _0x4e6d37;});}else{return _0x4e6d37;}})[_0x2d93('0x4f')](function(_0x4785ec){logger['error'](_0x2d93('0x9b'),_0x4785ec);throw _0x4785ec;});}return _0x4e6d37;})[_0x2d93('0x2e')](respondWithResult(_0x466a6d,null))[_0x2d93('0x4f')](handleError(_0x466a6d,null));}});}catch(_0xe4295){_0x466a6d['status'](0x1f4)[_0x2d93('0x34')](_0xe4295);}};function removeReferences(_0x159beb,_0x46763c){try{if(_0x159beb){fs[_0x2d93('0x69')](_0x159beb);logger[_0x2d93('0x6a')](_0x2d93('0x9c'));}if(_0x46763c){rimraf(_0x46763c,function(){});logger[_0x2d93('0x6a')](_0x2d93('0x9d'));}}catch(_0x46bbe6){logger['error'](_0x46bbe6);}}exports[_0x2d93('0x2c')]=function(_0x258b47,_0x5dc17a,_0x2908a2){return db[_0x2d93('0x4b')]['find']({'where':{'id':_0x258b47['params']['id']}})[_0x2d93('0x2e')](handleEntityNotFound(_0x5dc17a,null))[_0x2d93('0x2e')](saveUpdates(_0x258b47[_0x2d93('0x93')],null))[_0x2d93('0x2e')](respondWithResult(_0x5dc17a,null))[_0x2d93('0x4f')](handleError(_0x5dc17a,null));};exports['delete']=function(_0x3321e9,_0x1924c7,_0x2bf866){return db[_0x2d93('0x4b')][_0x2d93('0x52')]({'where':{'id':_0x3321e9[_0x2d93('0x50')]['id']}})[_0x2d93('0x2e')](function(_0x3b20d1){if(_0x3b20d1){return _0x3b20d1[_0x2d93('0x2d')]();}})['then'](function(_0x4be0fb){rimraf(path[_0x2d93('0x54')](config[_0x2d93('0x55')],_0x2d93('0x56'),path['dirname'](_0x4be0fb[_0x2d93('0x7')])),function(){});return _0x4be0fb;})['then'](handleEntityNotFound(_0x1924c7,null))[_0x2d93('0x2e')](respondWithStatusCode(_0x1924c7,null))['catch'](handleError(_0x1924c7,null));};exports['webhookGet']=function(_0x577e1e,_0x570768,_0x3ffb70){return BPromise[_0x2d93('0x9e')]()['then'](function(){if(!_0x577e1e[_0x2d93('0x3b')]['path']){throw new Error(_0x2d93('0x9f'));}if(!_0x577e1e[_0x2d93('0x3b')][_0x2d93('0xa0')]){throw new Error(_0x2d93('0xa1'));}var _0x2be1a5=_0x577e1e['query'][_0x2d93('0xa2')]?_0x577e1e['query'][_0x2d93('0xa2')]+':'+_0x577e1e[_0x2d93('0x3b')][_0x2d93('0xa0')]:_0x2d93('0xa3')+_0x577e1e[_0x2d93('0x3b')]['port'];var _0x412b21=_0x577e1e[_0x2d93('0x3b')][_0x2d93('0x25')]?_0x577e1e[_0x2d93('0x3b')][_0x2d93('0x25')]:!![];var _0x59ed80=_0x577e1e[_0x2d93('0x3b')]['encoding']?_0x577e1e[_0x2d93('0x3b')][_0x2d93('0xa4')]:null;var _0x428b80={'method':_0x577e1e[_0x2d93('0xa5')],'uri':util[_0x2d93('0x67')](_0x2d93('0xa6'),_0x2be1a5,_0x577e1e[_0x2d93('0x3b')][_0x2d93('0x7')]),'json':_0x412b21,'resolveWithFullResponse':!![],'encoding':_0x59ed80,'qs':_0x577e1e['query']};if(_0x577e1e[_0x2d93('0xa7')]){_0x428b80[_0x2d93('0xa7')]=_0x577e1e['headers'];if(_0x428b80[_0x2d93('0xa7')][_0x2d93('0xa8')]){delete _0x428b80[_0x2d93('0xa7')][_0x2d93('0xa8')];}}if(_0x428b80[_0x2d93('0xa7')]['content-type']){delete _0x428b80[_0x2d93('0xa7')][_0x2d93('0xa9')];}return rp(_0x428b80);})['then'](function(_0x533bc1){if(_0x533bc1){_0x570768[_0x2d93('0xaa')](_0x533bc1[_0x2d93('0xa7')]);logger[_0x2d93('0x6a')](_0x533bc1[_0x2d93('0x93')]);if(_[_0x2d93('0xab')](_0x577e1e['query'][_0x2d93('0x7')],_0x2d93('0x53'))&&_0x533bc1[_0x2d93('0xac')]==0x1f4){return _0x570768[_0x2d93('0x31')](_0x533bc1[_0x2d93('0xac')]);}else{return _0x570768['status'](_0x533bc1['statusCode'])['send'](_0x533bc1[_0x2d93('0x93')]);}}else{return _0x570768[_0x2d93('0x31')](0xc8);}})[_0x2d93('0x4f')](handleError(_0x570768,null));};exports[_0x2d93('0xad')]=function(_0x1b58ee,_0x552a46,_0x7d0741){return BPromise['resolve']()[_0x2d93('0x2e')](function(){if(!_0x1b58ee[_0x2d93('0x3b')][_0x2d93('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1b58ee[_0x2d93('0x3b')][_0x2d93('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2c6325=_0x1b58ee['query']['hostname']?_0x1b58ee['query']['hostname']+':'+_0x1b58ee[_0x2d93('0x3b')][_0x2d93('0xa0')]:_0x2d93('0xa3')+_0x1b58ee['query'][_0x2d93('0xa0')];var _0x26357d=_0x1b58ee['query'][_0x2d93('0x25')]?_0x1b58ee[_0x2d93('0x3b')][_0x2d93('0x25')]:!![];var _0x2de8ed=_0x1b58ee[_0x2d93('0x3b')][_0x2d93('0xa4')]?_0x1b58ee[_0x2d93('0x3b')]['encoding']:null;var _0x214f8a={'method':_0x1b58ee[_0x2d93('0xa5')],'uri':util[_0x2d93('0x67')](_0x2d93('0xa6'),_0x2c6325,_0x1b58ee['query'][_0x2d93('0x7')]),'json':_0x26357d,'resolveWithFullResponse':!![],'encoding':_0x2de8ed,'body':_0x1b58ee[_0x2d93('0x93')]};if(_0x1b58ee['headers']){_0x214f8a[_0x2d93('0xa7')]=_0x1b58ee[_0x2d93('0xa7')];if(_0x214f8a[_0x2d93('0xa7')][_0x2d93('0xa8')]){delete _0x214f8a['headers']['content-length'];}}if(_0x214f8a[_0x2d93('0xa7')][_0x2d93('0xa9')]){delete _0x214f8a[_0x2d93('0xa7')][_0x2d93('0xa9')];}return rp(_0x214f8a);})[_0x2d93('0x2e')](function(_0x5d252a){if(_0x5d252a){_0x552a46[_0x2d93('0xaa')](_0x5d252a[_0x2d93('0xa7')]);logger['info'](_0x5d252a[_0x2d93('0x93')]);return _0x552a46[_0x2d93('0x23')](_0x5d252a[_0x2d93('0xac')])[_0x2d93('0x34')](_0x5d252a['body']);}else{return _0x552a46[_0x2d93('0x31')](0xc8);}})[_0x2d93('0x4f')](handleError(_0x552a46,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2fe893f..d7afb35 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b97=['setMaxListeners','save','update','remove','emit','hook','exports','events','Plugin'];(function(_0xf61d62,_0x5e1ce1){var _0x1b8b00=function(_0x21dbba){while(--_0x21dbba){_0xf61d62['push'](_0xf61d62['shift']());}};_0x1b8b00(++_0x5e1ce1);}(_0x9b97,0x11e));var _0x79b9=function(_0x5b0438,_0x49fab8){_0x5b0438=_0x5b0438-0x0;var _0x293536=_0x9b97[_0x5b0438];return _0x293536;};'use strict';var EventEmitter=require(_0x79b9('0x0'));var Plugin=require('../../mysqldb')['db'][_0x79b9('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x79b9('0x2')](0x0);var events={'afterCreate':_0x79b9('0x3'),'afterUpdate':_0x79b9('0x4'),'afterDestroy':_0x79b9('0x5')};function emitEvent(_0x10c823){return function(_0x4edfcf,_0x5194ab,_0x1e0ed2){PluginEvents[_0x79b9('0x6')](_0x10c823+':'+_0x4edfcf['id'],_0x4edfcf);PluginEvents[_0x79b9('0x6')](_0x10c823,_0x4edfcf);_0x1e0ed2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x79b9('0x7')](e,emitEvent(event));}}module[_0x79b9('0x8')]=PluginEvents; \ No newline at end of file +var _0x2f2e=['remove','hasOwnProperty','hook','exports','../../mysqldb','Plugin','save'];(function(_0x168289,_0xd1e311){var _0x4a169d=function(_0x5aa12e){while(--_0x5aa12e){_0x168289['push'](_0x168289['shift']());}};_0x4a169d(++_0xd1e311);}(_0x2f2e,0x146));var _0xe2f2=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x2f2e[_0x3635ce];return _0x97ecd0;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xe2f2('0x0'))['db'][_0xe2f2('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe2f2('0x2'),'afterUpdate':'update','afterDestroy':_0xe2f2('0x3')};function emitEvent(_0x2e8cbe){return function(_0x2da048,_0x14543c,_0x57f858){PluginEvents['emit'](_0x2e8cbe+':'+_0x2da048['id'],_0x2da048);PluginEvents['emit'](_0x2e8cbe,_0x2da048);_0x57f858(null);};}for(var e in events){if(events[_0xe2f2('0x4')](e)){var event=events[e];Plugin[_0xe2f2('0x5')](e,emitEvent(event));}}module[_0xe2f2('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 24050a3..ac67440 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77a2=['api','bluebird','request-promise','../../config/environment','exports','define','Plugin','plugins','util'];(function(_0x70e5eb,_0x20e3a8){var _0x400d9c=function(_0x2e1841){while(--_0x2e1841){_0x70e5eb['push'](_0x70e5eb['shift']());}};_0x400d9c(++_0x20e3a8);}(_0x77a2,0x15e));var _0x277a=function(_0x5e924f,_0x108751){_0x5e924f=_0x5e924f-0x0;var _0x46df22=_0x77a2[_0x5e924f];return _0x46df22;};'use strict';var _=require('lodash');var util=require(_0x277a('0x0'));var logger=require('../../config/logger')(_0x277a('0x1'));var moment=require('moment');var BPromise=require(_0x277a('0x2'));var rp=require(_0x277a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x277a('0x4'));var attributes=require('./plugin.attributes');module[_0x277a('0x5')]=function(_0x1c1e17,_0x44d9dd){return _0x1c1e17[_0x277a('0x6')](_0x277a('0x7'),attributes,{'tableName':_0x277a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5b6=['../../config/logger','api','bluebird','request-promise','../../config/environment','./plugin.attributes','Plugin','plugins','util'];(function(_0x529527,_0x1908ee){var _0xc8db99=function(_0x12d2bf){while(--_0x12d2bf){_0x529527['push'](_0x529527['shift']());}};_0xc8db99(++_0x1908ee);}(_0xf5b6,0xe9));var _0x6f5b=function(_0x17fc29,_0x536f6b){_0x17fc29=_0x17fc29-0x0;var _0x19899d=_0xf5b6[_0x17fc29];return _0x19899d;};'use strict';var _=require('lodash');var util=require(_0x6f5b('0x0'));var logger=require(_0x6f5b('0x1'))(_0x6f5b('0x2'));var moment=require('moment');var BPromise=require(_0x6f5b('0x3'));var rp=require(_0x6f5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f5b('0x5'));var attributes=require(_0x6f5b('0x6'));module['exports']=function(_0x183df3,_0x5b6326){return _0x183df3['define'](_0x6f5b('0x7'),attributes,{'tableName':_0x6f5b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 397d300..2eff06f 100644 --- a/server/api/plugin/plugin.rpc.js +++ b/server/api/plugin/plugin.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe84d=['socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xe84d,0xe6));var _0xde84=function(_0x349342,_0x506731){_0x349342=_0x349342-0x0;var _0x2dbb6b=_0xe84d[_0x349342];return _0x2dbb6b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde84('0x0'));var BPromise=require('bluebird');var rs=require(_0xde84('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde84('0x2'))['db'];var utils=require(_0xde84('0x3'));var logger=require(_0xde84('0x4'))(_0xde84('0x5'));var config=require(_0xde84('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xde84('0x7')][_0xde84('0x8')]({'port':0x232a});config[_0xde84('0x9')]=_['defaults'](config[_0xde84('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xde84('0xa'))(new Redis(config['redis']));require(_0xde84('0xb'))[_0xde84('0xc')](socket);function respondWithRpcPromise(_0x2c7b94,_0x24bacf,_0x3ab15c){return new BPromise(function(_0x36cd5d,_0x2820f3){return client[_0xde84('0xd')](_0x2c7b94,_0x3ab15c)['then'](function(_0x3444d5){logger[_0xde84('0xe')](_0xde84('0xf'),_0x24bacf,_0xde84('0x10'));logger[_0xde84('0x11')](_0xde84('0x12'),_0x24bacf,'request\x20sent',JSON[_0xde84('0x13')](_0x3444d5));if(_0x3444d5['error']){if(_0x3444d5[_0xde84('0x14')][_0xde84('0x15')]===0x1f4){logger['error'](_0xde84('0xf'),_0x24bacf,_0x3444d5[_0xde84('0x14')]['message']);return _0x2820f3(_0x3444d5[_0xde84('0x14')][_0xde84('0x16')]);}logger[_0xde84('0x14')]('Plugin,\x20%s,\x20%s',_0x24bacf,_0x3444d5[_0xde84('0x14')][_0xde84('0x16')]);return _0x36cd5d(_0x3444d5[_0xde84('0x14')][_0xde84('0x16')]);}else{logger[_0xde84('0xe')](_0xde84('0xf'),_0x24bacf,'request\x20sent');_0x36cd5d(_0x3444d5[_0xde84('0x17')][_0xde84('0x16')]);}})[_0xde84('0x18')](function(_0x18d91f){logger[_0xde84('0x14')](_0xde84('0xf'),_0x24bacf,_0x18d91f);_0x2820f3(_0x18d91f);});});}exports[_0xde84('0x19')]=function(_0x1b5622){var _0x288370=this;return new Promise(function(_0x4175ce,_0x29da66){return db[_0xde84('0x1a')][_0xde84('0x1b')](_0x1b5622['body'],{'raw':_0x1b5622[_0xde84('0x1c')]?_0x1b5622['options'][_0xde84('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4c7fd6){logger[_0xde84('0xe')]('CreatePlugin',_0x1b5622);logger['debug'](_0xde84('0x19'),_0x1b5622,JSON[_0xde84('0x13')](_0x4c7fd6));_0x4175ce(_0x4c7fd6);})[_0xde84('0x18')](function(_0x6bb666){logger[_0xde84('0x14')]('CreatePlugin',_0x6bb666[_0xde84('0x16')],_0x1b5622);_0x29da66(_0x288370[_0xde84('0x14')](0x1f4,_0x6bb666[_0xde84('0x16')]));});});}; \ No newline at end of file +var _0x1bd0=['socket.io-emitter','./plugin.socket','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','Plugin','create','body','options','raw','info','CreatePlugin','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x54779b,_0x264b69){var _0x82dd8c=function(_0x18467f){while(--_0x18467f){_0x54779b['push'](_0x54779b['shift']());}};_0x82dd8c(++_0x264b69);}(_0x1bd0,0x1d4));var _0x01bd=function(_0x461b58,_0x1ca82a){_0x461b58=_0x461b58-0x0;var _0xac815f=_0x1bd0[_0x461b58];return _0xac815f;};'use strict';var _=require('lodash');var util=require(_0x01bd('0x0'));var moment=require(_0x01bd('0x1'));var BPromise=require(_0x01bd('0x2'));var rs=require(_0x01bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x01bd('0x5'))('rpc');var config=require(_0x01bd('0x6'));var jayson=require(_0x01bd('0x7'));var client=jayson[_0x01bd('0x8')]['http']({'port':0x232a});config[_0x01bd('0x9')]=_[_0x01bd('0xa')](config[_0x01bd('0x9')],{'host':_0x01bd('0xb'),'port':0x18eb});var socket=require(_0x01bd('0xc'))(new Redis(config['redis']));require(_0x01bd('0xd'))['register'](socket);function respondWithRpcPromise(_0x54dbe7,_0x1a5ac0,_0x206244){return new BPromise(function(_0x1983ad,_0x3b1e03){return client[_0x01bd('0xe')](_0x54dbe7,_0x206244)['then'](function(_0x2cc6a9){logger['info'](_0x01bd('0xf'),_0x1a5ac0,_0x01bd('0x10'));logger[_0x01bd('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1a5ac0,_0x01bd('0x10'),JSON['stringify'](_0x2cc6a9));if(_0x2cc6a9[_0x01bd('0x12')]){if(_0x2cc6a9['error'][_0x01bd('0x13')]===0x1f4){logger[_0x01bd('0x12')](_0x01bd('0xf'),_0x1a5ac0,_0x2cc6a9['error'][_0x01bd('0x14')]);return _0x3b1e03(_0x2cc6a9[_0x01bd('0x12')]['message']);}logger[_0x01bd('0x12')](_0x01bd('0xf'),_0x1a5ac0,_0x2cc6a9[_0x01bd('0x12')][_0x01bd('0x14')]);return _0x1983ad(_0x2cc6a9[_0x01bd('0x12')][_0x01bd('0x14')]);}else{logger['info'](_0x01bd('0xf'),_0x1a5ac0,'request\x20sent');_0x1983ad(_0x2cc6a9[_0x01bd('0x15')][_0x01bd('0x14')]);}})[_0x01bd('0x16')](function(_0x10b2e2){logger[_0x01bd('0x12')](_0x01bd('0xf'),_0x1a5ac0,_0x10b2e2);_0x3b1e03(_0x10b2e2);});});}exports['CreatePlugin']=function(_0x28925d){var _0xc35cd4=this;return new Promise(function(_0x7347bc,_0x4a6ba1){return db[_0x01bd('0x17')][_0x01bd('0x18')](_0x28925d[_0x01bd('0x19')],{'raw':_0x28925d[_0x01bd('0x1a')]?_0x28925d[_0x01bd('0x1a')][_0x01bd('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3175b1){logger[_0x01bd('0x1c')]('CreatePlugin',_0x28925d);logger['debug'](_0x01bd('0x1d'),_0x28925d,JSON['stringify'](_0x3175b1));_0x7347bc(_0x3175b1);})['catch'](function(_0x1817db){logger['error']('CreatePlugin',_0x1817db[_0x01bd('0x14')],_0x28925d);_0x4a6ba1(_0xc35cd4['error'](0x1f4,_0x1817db[_0x01bd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 11e63e8..9865ce1 100644 --- a/server/api/plugin/plugin.socket.js +++ b/server/api/plugin/plugin.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82d5=['removeListener','register','./plugin.events','save','remove','update'];(function(_0x2bcd9a,_0x2128e4){var _0x59d88c=function(_0x5cddaa){while(--_0x5cddaa){_0x2bcd9a['push'](_0x2bcd9a['shift']());}};_0x59d88c(++_0x2128e4);}(_0x82d5,0x1d6));var _0x582d=function(_0x170d16,_0x443724){_0x170d16=_0x170d16-0x0;var _0x1bf864=_0x82d5[_0x170d16];return _0x1bf864;};'use strict';var PluginEvents=require(_0x582d('0x0'));var events=[_0x582d('0x1'),_0x582d('0x2'),_0x582d('0x3')];function createListener(_0xd35aec,_0x30830f){return function(_0x1a6cbd){_0x30830f['emit'](_0xd35aec,_0x1a6cbd);};}function removeListener(_0x4459bd,_0x4084c1){return function(){PluginEvents[_0x582d('0x4')](_0x4459bd,_0x4084c1);};}exports[_0x582d('0x5')]=function(_0xaae78a){for(var _0x818d9a=0x0,_0x3a477e=events['length'];_0x818d9a<_0x3a477e;_0x818d9a++){var _0x4995d6=events[_0x818d9a];var _0x274a92=createListener('plugin:'+_0x4995d6,_0xaae78a);PluginEvents['on'](_0x4995d6,_0x274a92);}}; \ No newline at end of file +var _0x508f=['register','length','plugin:','save','remove','update','emit','removeListener'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x508f,0x1cb));var _0xf508=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x508f[_0x2641f9];return _0x585741;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xf508('0x0'),_0xf508('0x1'),_0xf508('0x2')];function createListener(_0x3d86c7,_0x151146){return function(_0x552fc0){_0x151146[_0xf508('0x3')](_0x3d86c7,_0x552fc0);};}function removeListener(_0x4c333b,_0x59f5d4){return function(){PluginEvents[_0xf508('0x4')](_0x4c333b,_0x59f5d4);};}exports[_0xf508('0x5')]=function(_0x4a72f0){for(var _0x188152=0x0,_0x158f76=events[_0xf508('0x6')];_0x188152<_0x158f76;_0x188152++){var _0x48c33b=events[_0x188152];var _0x14c623=createListener(_0xf508('0x7')+_0x48c33b,_0x4a72f0);PluginEvents['on'](_0x48c33b,_0x14c623);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 1de6a6a..71a2aa5 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x416950,_0x97f68){var _0x2923a9=function(_0x9c3751){while(--_0x9c3751){_0x416950['push'](_0x416950['shift']());}};_0x2923a9(++_0x97f68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x54b49a,_0x5f2751){var _0x4b39b0=function(_0x29c2c1){while(--_0x29c2c1){_0x54b49a['push'](_0x54b49a['shift']());}};_0x4b39b0(++_0x5f2751);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 64c76e1..5300b7c 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb58b=['Unknown\x20status','destroy','params','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','status','json','error','stack','name','npm\x20install','info','list','then','reject','motion2','length','describe','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x31355b,_0x22f8d3){var _0x2c831d=function(_0x9c7286){while(--_0x9c7286){_0x31355b['push'](_0x31355b['shift']());}};_0x2c831d(++_0x22f8d3);}(_0xb58b,0x1f1));var _0xbb58=function(_0x5100cb,_0x30ff06){_0x5100cb=_0x5100cb-0x0;var _0xf9a19f=_0xb58b[_0x5100cb];return _0xf9a19f;};'use strict';var _=require('lodash');var pm2=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var path=require('path');var exec=require(_0xbb58('0x3'))[_0xbb58('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x226363,_0x546510){return function(_0x2edb10){if(!_0x2edb10){_0x226363[_0xbb58('0x5')](0x194);;}return _0x2edb10;};}function respondWithResult(_0x33fe85,_0x5cf8b1){_0x5cf8b1=_0x5cf8b1||0xc8;return function(_0x27cbda){if(_0x27cbda){return _0x33fe85[_0xbb58('0x6')](_0x5cf8b1)[_0xbb58('0x7')](_0x27cbda);}return null;};}function handleError(_0x5d7fe8,_0xd94f1){_0xd94f1=_0xd94f1||0x1f4;return function(_0x3e3144){logger[_0xbb58('0x8')](_0x3e3144[_0xbb58('0x9')]);if(_0x3e3144[_0xbb58('0xa')]){delete _0x3e3144[_0xbb58('0xa')];}_0x5d7fe8[_0xbb58('0x6')](_0xd94f1)['send'](_0x3e3144);};}function execChildProcess(){return new BPromise(function(_0x80ab3a,_0x5c3bf7){exec(_0xbb58('0xb'),function(_0x440392,_0x26d8e6,_0x19d185){logger['info'](_0x26d8e6);logger[_0xbb58('0xc')](_0x19d185);if(_0x440392){logger[_0xbb58('0x8')](_0x440392);return _0x5c3bf7(_0x440392);}return _0x80ab3a(_0x26d8e6);});});}exports['index']=function(_0x132511,_0xdc68b9){return pm2[_0xbb58('0xd')]()[_0xbb58('0xe')](function(_0x19ceda){if(_0x19ceda){var _0x58245f=_[_0xbb58('0xf')](_0x19ceda,function(_0x23fd15){return _0x23fd15['name']==='express'||_0x23fd15[_0xbb58('0xa')]===_0xbb58('0x10');});return{'rows':_0x58245f,'count':_0x58245f[_0xbb58('0x11')]};}return null;})['then'](respondWithResult(_0xdc68b9,null))['catch'](handleError(_0xdc68b9,null));};exports['show']=function(_0x55156e,_0x28637b){return pm2[_0xbb58('0x12')](_0x55156e['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x28637b,null))['then'](handleEntityNotFound(_0x28637b,null))[_0xbb58('0x13')](handleError(_0x28637b,null));};exports[_0xbb58('0x14')]=function(_0x3c33d9,_0xb8f982){if(_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')]&&_0x3c33d9[_0xbb58('0x15')]['script']){var _0x84f34=path[_0xbb58('0x16')](__dirname,_0xbb58('0x17'),_0x3c33d9[_0xbb58('0x15')][_0xbb58('0x18')]);var _0x5d4a91=process[_0xbb58('0x19')]();process[_0xbb58('0x1a')](path[_0xbb58('0x1b')](_0x84f34));return execChildProcess()['then'](function(_0x27806d){process['chdir'](_0x5d4a91);return pm2[_0xbb58('0x1c')]({'name':_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')],'script':_0x84f34});})[_0xbb58('0xe')](function(_0x2d111c){pm2[_0xbb58('0x1d')]();return _0x2d111c[0x0];})[_0xbb58('0xe')](respondWithResult(_0xb8f982,0xc9))[_0xbb58('0x13')](handleError(_0xb8f982,null));}else{return _0xb8f982['status'](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x1f')});}};exports[_0xbb58('0x20')]=function(_0x129094,_0x8e9ed9){if(_0x129094[_0xbb58('0x15')]['id']){delete _0x129094[_0xbb58('0x15')]['id'];}var _0x2ce7c3={'online':_0xbb58('0x21'),'stopped':_0xbb58('0x22')};if(_0x2ce7c3[_0xbb58('0x23')](_0x129094[_0xbb58('0x15')][_0xbb58('0x6')])){return pm2[_0x2ce7c3[_0x129094[_0xbb58('0x15')][_0xbb58('0x6')]]](_0x129094['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x8e9ed9,0xc8))[_0xbb58('0x13')](handleError(_0x8e9ed9,null));}else{return _0x8e9ed9[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x24')});}};exports[_0xbb58('0x25')]=function(_0x1ba526,_0x643e0e){if(_0x1ba526[_0xbb58('0x15')]['id']){delete _0x1ba526['body']['id'];}if(_0x1ba526[_0xbb58('0x26')]['id']){return pm2[_0xbb58('0x27')](_0x1ba526[_0xbb58('0x26')]['id'])[_0xbb58('0xe')](function(_0xdbbe7b){pm2[_0xbb58('0x1d')]();return _0xdbbe7b[0x0];})[_0xbb58('0xe')](respondWithResult(_0x643e0e,null))[_0xbb58('0x13')](handleError(_0x643e0e,null));}else{return _0x643e0e[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x28')});}}; \ No newline at end of file +var _0x2dae=['stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','sendStatus','status','json','error'];(function(_0x45c957,_0x1762a2){var _0x455a3b=function(_0x56a531){while(--_0x56a531){_0x45c957['push'](_0x45c957['shift']());}};_0x455a3b(++_0x1762a2);}(_0x2dae,0xc3));var _0xe2da=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0x2dae[_0x3a3b9e];return _0x148103;};'use strict';var _=require(_0xe2da('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var path=require(_0xe2da('0x3'));var exec=require(_0xe2da('0x4'))[_0xe2da('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x25b9f2,_0x439b5d){return function(_0x77e45e){if(!_0x77e45e){_0x25b9f2[_0xe2da('0x6')](0x194);;}return _0x77e45e;};}function respondWithResult(_0x523c60,_0x3e3e25){_0x3e3e25=_0x3e3e25||0xc8;return function(_0x89c70b){if(_0x89c70b){return _0x523c60[_0xe2da('0x7')](_0x3e3e25)[_0xe2da('0x8')](_0x89c70b);}return null;};}function handleError(_0x238da3,_0x1c71ea){_0x1c71ea=_0x1c71ea||0x1f4;return function(_0x29960a){logger[_0xe2da('0x9')](_0x29960a[_0xe2da('0xa')]);if(_0x29960a['name']){delete _0x29960a[_0xe2da('0xb')];}_0x238da3[_0xe2da('0x7')](_0x1c71ea)[_0xe2da('0xc')](_0x29960a);};}function execChildProcess(){return new BPromise(function(_0x17086c,_0x3c1309){exec(_0xe2da('0xd'),function(_0x1a29b9,_0x173244,_0x5aab71){logger[_0xe2da('0xe')](_0x173244);logger['info'](_0x5aab71);if(_0x1a29b9){logger[_0xe2da('0x9')](_0x1a29b9);return _0x3c1309(_0x1a29b9);}return _0x17086c(_0x173244);});});}exports[_0xe2da('0xf')]=function(_0x37064e,_0x411b9f){return pm2[_0xe2da('0x10')]()[_0xe2da('0x11')](function(_0x295a86){if(_0x295a86){var _0x48584b=_[_0xe2da('0x12')](_0x295a86,function(_0x5e1702){return _0x5e1702['name']===_0xe2da('0x13')||_0x5e1702[_0xe2da('0xb')]===_0xe2da('0x14');});return{'rows':_0x48584b,'count':_0x48584b['length']};}return null;})[_0xe2da('0x11')](respondWithResult(_0x411b9f,null))[_0xe2da('0x15')](handleError(_0x411b9f,null));};exports[_0xe2da('0x16')]=function(_0x33568f,_0x4e1623){return pm2[_0xe2da('0x17')](_0x33568f[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x4e1623,null))[_0xe2da('0x11')](handleEntityNotFound(_0x4e1623,null))[_0xe2da('0x15')](handleError(_0x4e1623,null));};exports['create']=function(_0x56eeb1,_0x2e16b2){if(_0x56eeb1['body'][_0xe2da('0xb')]&&_0x56eeb1[_0xe2da('0x19')][_0xe2da('0x1a')]){var _0x203d36=path[_0xe2da('0x1b')](__dirname,_0xe2da('0x1c'),_0x56eeb1['body'][_0xe2da('0x1a')]);var _0x53cc4e=process[_0xe2da('0x1d')]();process[_0xe2da('0x1e')](path[_0xe2da('0x1f')](_0x203d36));return execChildProcess()[_0xe2da('0x11')](function(_0x30dea4){process[_0xe2da('0x1e')](_0x53cc4e);return pm2[_0xe2da('0x20')]({'name':_0x56eeb1[_0xe2da('0x19')]['name'],'script':_0x203d36});})[_0xe2da('0x11')](function(_0x357bff){pm2[_0xe2da('0x21')]();return _0x357bff[0x0];})[_0xe2da('0x11')](respondWithResult(_0x2e16b2,0xc9))[_0xe2da('0x15')](handleError(_0x2e16b2,null));}else{return _0x2e16b2[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xe2da('0x22')]=function(_0x3e23d7,_0x1dc228){if(_0x3e23d7[_0xe2da('0x19')]['id']){delete _0x3e23d7[_0xe2da('0x19')]['id'];}var _0x2b6c9e={'online':_0xe2da('0x23'),'stopped':_0xe2da('0x24')};if(_0x2b6c9e['hasOwnProperty'](_0x3e23d7['body']['status'])){return pm2[_0x2b6c9e[_0x3e23d7[_0xe2da('0x19')][_0xe2da('0x7')]]](_0x3e23d7[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x1dc228,0xc8))['catch'](handleError(_0x1dc228,null));}else{return _0x1dc228['status'](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x25')});}};exports[_0xe2da('0x26')]=function(_0x39f983,_0x7ab5ee){if(_0x39f983[_0xe2da('0x19')]['id']){delete _0x39f983[_0xe2da('0x19')]['id'];}if(_0x39f983[_0xe2da('0x18')]['id']){return pm2[_0xe2da('0x27')](_0x39f983['params']['id'])['then'](function(_0x672767){pm2[_0xe2da('0x21')]();return _0x672767[0x0];})[_0xe2da('0x11')](respondWithResult(_0x7ab5ee,null))[_0xe2da('0x15')](handleError(_0x7ab5ee,null));}else{return _0x7ab5ee[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 91728bc..83eba9c 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce86=['Router','../../components/auth/service','isAuthenticated','getAgents','get','/queues','getQueues','express'];(function(_0x48de98,_0x261d7b){var _0x23c5e7=function(_0x3e2f75){while(--_0x3e2f75){_0x48de98['push'](_0x48de98['shift']());}};_0x23c5e7(++_0x261d7b);}(_0xce86,0x1b7));var _0x6ce8=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xce86[_0x492af5];return _0x59f529;};'use strict';var express=require(_0x6ce8('0x0'));var router=express[_0x6ce8('0x1')]();var auth=require(_0x6ce8('0x2'));var controller=require('./realtime.controller');router['get']('/agents',auth[_0x6ce8('0x3')](),controller[_0x6ce8('0x4')]);router[_0x6ce8('0x5')](_0x6ce8('0x6'),auth['isAuthenticated'](),controller[_0x6ce8('0x7')]);module['exports']=router; \ No newline at end of file +var _0x913d=['./realtime.controller','get','/agents','isAuthenticated','/queues','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x913d,0x84));var _0xd913=function(_0x1c2d80,_0xe9b773){_0x1c2d80=_0x1c2d80-0x0;var _0x5cc58c=_0x913d[_0x1c2d80];return _0x5cc58c;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xd913('0x0'));router[_0xd913('0x1')](_0xd913('0x2'),auth[_0xd913('0x3')](),controller['getAgents']);router[_0xd913('0x1')](_0xd913('0x4'),auth['isAuthenticated'](),controller['getQueues']);module[_0xd913('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 469ff04..806881d 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47e3=['globalStatus','getAgentStatus','pause','talking','voiceStatus','sortAgentsByStatus','catch','getQueues','isValidChannel','startCase','Queue','name','voice','outbound','dialActive','dialMethod','userProfileId','QueueCampaigns','Queues','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','handleError','undefined','limit','count','offset','status','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','*pause','then','format','Channel\x20parameter\x20%s\x20is\x20invalid','channel','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName','type','key','role','getOptions','raw','push','literal','FIELD(id,','forEach','Pause','where','user','Agents','agent','online','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find'];(function(_0x10bdff,_0x29474b){var _0x27d020=function(_0x3eb2d1){while(--_0x3eb2d1){_0x10bdff['push'](_0x10bdff['shift']());}};_0x27d020(++_0x29474b);}(_0x47e3,0xb9));var _0x347e=function(_0x3777a2,_0x48a1cc){_0x3777a2=_0x3777a2-0x0;var _0xf91723=_0x47e3[_0x3777a2];return _0xf91723;};'use strict';var _=require(_0x347e('0x0'));var util=require('util');var rta=require(_0x347e('0x1'));var rtq=require(_0x347e('0x2'));var qs=require(_0x347e('0x3'));var utils=require(_0x347e('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x347e('0x5'))['APIBadRequestError'];var APIHandleError=require(_0x347e('0x5'))[_0x347e('0x6')];function respondWithFilteredResult(_0x2827f5,_0x2f7ed4){return function(_0x339394){if(_0x339394){var _0x7a1d2f=typeof _0x2f7ed4['offset']===_0x347e('0x7')&&typeof _0x2f7ed4[_0x347e('0x8')]==='undefined';var _0x21dd7e=_0x339394[_0x347e('0x9')];var _0x3bd339=_0x7a1d2f?0x0:_0x2f7ed4['offset'];var _0x2d2a8c=_0x7a1d2f?_0x339394[_0x347e('0x9')]:_0x2f7ed4[_0x347e('0xa')]+_0x2f7ed4['limit'];var _0x1a1a3a;if(_0x2d2a8c>=_0x21dd7e){_0x2d2a8c=_0x21dd7e;_0x1a1a3a=0xc8;}else{_0x1a1a3a=0xce;}_0x2827f5[_0x347e('0xb')](_0x1a1a3a);return _0x2827f5['set'](_0x347e('0xc'),_0x3bd339+'-'+_0x2d2a8c+'/'+_0x21dd7e)[_0x347e('0xd')](_0x339394);}return null;};}exports[_0x347e('0xe')]=function(_0x22d5a9,_0x4b0a37){var _0x5a28a3={'count':0x0,'rows':[]};var _0x1cfd97={};var _0x573f83;var _0x558989=utils[_0x347e('0xf')]();var _0x5e41b3;var _0x4c2c71;var _0x44591e=_0x22d5a9['query']['globalQueueFilter'];var _0x13096e=_0x22d5a9[_0x347e('0x10')][_0x347e('0x11')];var _0x2daa39=_0x22d5a9['query'][_0x347e('0x12')];var _0x6e6249=_0x13096e==='pause'||_0x13096e===_0x347e('0x13')?!![]:![];var _0x48bc3d=[];var _0x2aaab4;var _0x1e28d2;Promise['resolve']()[_0x347e('0x14')](function(){if(_0x22d5a9[_0x347e('0x10')]['channel']){if(!utils['isValidChannel'](_0x22d5a9[_0x347e('0x10')]['channel'])){throw new APIBadRequestError(util[_0x347e('0x15')](_0x347e('0x16'),_0x22d5a9[_0x347e('0x10')][_0x347e('0x17')]));}_0x573f83=_0x22d5a9[_0x347e('0x10')]['channel'][_0x347e('0x18')]();}if(!_0x22d5a9[_0x347e('0x10')][_0x347e('0x19')]||!_0x22d5a9[_0x347e('0x10')]['sort'][_0x347e('0x1a')]('globalStatus')){_0x22d5a9['query'][_0x347e('0x19')]=rta[_0x347e('0x1b')](_0x22d5a9['query'][_0x347e('0x19')]);return;}var _0x1c90dd=rta[_0x347e('0x1c')](_0x22d5a9[_0x347e('0x10')][_0x347e('0x19')]);_0x22d5a9['query'][_0x347e('0x19')]=_0x1c90dd[_0x347e('0x1d')][_0x347e('0x1e')](',');_0x2aaab4=_0x1c90dd[_0x347e('0x1f')];})['then'](function(){if(!_0x44591e){return[];}return rta['getAgentIdsByQueues'](_0x44591e,_0x573f83);})[_0x347e('0x14')](function(_0x688b34){_0x48bc3d=_0x688b34;return rta[_0x347e('0x20')]();})[_0x347e('0x14')](function(_0x34981e){_0x4c2c71=_0x34981e[_0x347e('0x21')];if((!_0x13096e||_0x6e6249)&&!_0x2aaab4){return _0x48bc3d;}if(_0x2aaab4&&!_0x13096e){return rta[_0x347e('0x22')](_0x4c2c71,_0x48bc3d,_0x2aaab4);}else{return rta[_0x347e('0x23')](_0x4c2c71,_0x48bc3d,_0x13096e);}})[_0x347e('0x14')](function(_0x2c3460){_0x48bc3d=_0x2c3460;var _0x1a79b1=![];if(_0x48bc3d[_0x347e('0x24')]===0x0){if(_0x44591e||_0x13096e){_0x1a79b1=!![];}if(_0x6e6249){_0x1a79b1=![];}}if(_0x1a79b1){return _0x5a28a3;}var _0x51526b=_[_0x347e('0x25')](db['User'][_0x347e('0x26')],function(_0x4d714c){return{'name':_0x4d714c[_0x347e('0x27')],'type':_0x4d714c[_0x347e('0x28')][_0x347e('0x29')]};});_0x22d5a9[_0x347e('0x10')][_0x347e('0x2a')]='agent';_0x1cfd97=qs[_0x347e('0x2b')](_0x51526b,_0x22d5a9);_0x1cfd97[_0x347e('0x2c')]=!![];var _0x57b3a2=[];if(_0x48bc3d[_0x347e('0x24')]>0x0){_0x57b3a2[_0x347e('0x2d')]({'id':{'$in':_0x48bc3d}});if(_0x2aaab4&&!_0x13096e){_0x1e28d2=[db['sequelize'][_0x347e('0x2e')](_0x347e('0x2f')+_0x48bc3d+')')];_0x1cfd97[_0x347e('0x1f')]=_0x1e28d2;}}if(_0x6e6249){_0x558989['forEach'](function(_0x368ea0){var _0x10e787=!![];if(_0x13096e===_0x347e('0x13')&&_0x573f83!==_0x368ea0){_0x10e787=![];}_0x57b3a2['push']({[_0x368ea0+'Pause']:_0x10e787});});if(_0x2daa39){_0x57b3a2['push']({'pauseType':_0x2daa39});}}else if(_0x13096e){_0x558989[_0x347e('0x30')](function(_0x5596e8){_0x57b3a2[_0x347e('0x2d')]({[_0x5596e8+_0x347e('0x31')]:![]});});}_0x1cfd97[_0x347e('0x32')]=_['merge'](_0x1cfd97[_0x347e('0x32')],{'$and':_0x57b3a2});if(_0x22d5a9[_0x347e('0x33')][_0x347e('0x2a')]===_0x347e('0x33')){var _0x242b0e={'params':{'id':_0x22d5a9['user']['userProfileId']},'query':{'section':_0x347e('0x34'),'role':_0x347e('0x35'),'raw':!![],'ids':_0x48bc3d,'customSorting':_0x1e28d2}};if(_0x22d5a9[_0x347e('0x10')][_0x347e('0x36')]){_0x242b0e[_0x347e('0x10')][_0x347e('0x36')]=!![];}if(_0x6e6249){_0x242b0e[_0x347e('0x10')][_0x347e('0x37')]=_0x57b3a2;}_0x242b0e['query']=Object[_0x347e('0x38')](_0x242b0e[_0x347e('0x10')],_0x22d5a9[_0x347e('0x10')]);return db[_0x347e('0x39')][_0x347e('0x3a')](_0x242b0e);}return db['User'][_0x347e('0x3b')](_0x1cfd97);})[_0x347e('0x14')](function(_0x43ff2f){_0x5a28a3[_0x347e('0x9')]=_0x43ff2f[_0x347e('0x9')];_0x5e41b3=_0x43ff2f['rows'];return _0x5e41b3['map'](function(_0x2b3a69){var _0x1f6972=_[_0x347e('0x3c')](_0x4c2c71,['id',_0x2b3a69['id']]);if(_0x1f6972){var _0x3078a1=rta['filterAgentAttributes'](_0x1f6972);_['merge'](_0x2b3a69,_0x3078a1);}_0x2b3a69[_0x347e('0x3d')]=rta[_0x347e('0x3e')](_0x2b3a69);if(_0x2b3a69['globalStatus'][_0x347e('0x1a')](_0x347e('0x3f'))){_0x558989[_0x347e('0x30')](function(_0x1dcad2){if(_0x2b3a69[_0x1dcad2+_0x347e('0x31')]){if(_0x1dcad2==='voice'){if(_0x2b3a69['voiceStatus']!==_0x347e('0x40')){_0x2b3a69[_0x347e('0x41')]=_0x347e('0x3f');}}else{_0x2b3a69[_0x1dcad2+'Status']='pause';}}});}return _0x2b3a69;});})[_0x347e('0x14')](function(_0x5158df){if(!_0x2aaab4||_0x1e28d2){return _0x5158df;}return rta[_0x347e('0x42')](_0x5158df,_0x2aaab4);})[_0x347e('0x14')](function(_0x259357){var _0x53e5c2=rta['getRealtimeAgentsQueryFields']();_0x5a28a3[_0x347e('0x21')]=_0x259357[_0x347e('0x25')](function(_0x1fdd89){return _['pick'](_0x1fdd89,_0x53e5c2);});return _0x5a28a3;})['then'](respondWithFilteredResult(_0x4b0a37,_0x1cfd97))[_0x347e('0x43')](APIHandleError(_0x4b0a37));};exports[_0x347e('0x44')]=function(_0x10742e,_0x2ac093){var _0x34e44a={'count':0x0,'rows':[]};var _0x2bb487={};var _0x543c6e;var _0x4f8315;var _0x1cbcfe;Promise['resolve']()['then'](function(){if(_0x10742e[_0x347e('0x10')][_0x347e('0x17')]){if(!utils[_0x347e('0x45')](_0x10742e[_0x347e('0x10')]['channel'])){throw new APIBadRequestError(util[_0x347e('0x15')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x10742e[_0x347e('0x10')][_0x347e('0x17')]));}_0x543c6e=_0x10742e[_0x347e('0x10')][_0x347e('0x17')][_0x347e('0x18')]();}var _0x3bf3ce=_[_0x347e('0x46')](_0x543c6e)+_0x347e('0x47');var _0x19d971=_[_0x347e('0x25')](db[_0x3bf3ce]['rawAttributes'],function(_0xc6fbed){return{'name':_0xc6fbed['fieldName'],'type':_0xc6fbed[_0x347e('0x28')][_0x347e('0x29')]};});if(!_0x10742e[_0x347e('0x10')][_0x347e('0x1d')]){var _0x1e35cd=['id',_0x347e('0x48')];if(_0x543c6e===_0x347e('0x49')){_0x1e35cd[_0x347e('0x2d')](_0x347e('0x28'));if(_0x10742e[_0x347e('0x10')]['type']===_0x347e('0x4a')){_0x1e35cd[_0x347e('0x2d')]([_0x347e('0x4b'),_0x347e('0x4c')]);}}_0x10742e['query'][_0x347e('0x1d')]=_0x1e35cd[_0x347e('0x1e')](',');}_0x2bb487=qs['getOptions'](_0x19d971,_0x10742e);if(_0x10742e['user'][_0x347e('0x2a')]==='user'){var _0x1f2d9b={'params':{'id':_0x10742e[_0x347e('0x33')][_0x347e('0x4d')]},'query':{'section':_0x543c6e===_0x347e('0x49')&&_0x10742e[_0x347e('0x10')][_0x347e('0x28')]==='outbound'?_0x347e('0x4e'):_['startCase'](_0x543c6e)+_0x347e('0x4f'),'type':_0x10742e[_0x347e('0x10')][_0x347e('0x28')],'nolimit':!![],'sort':_0x347e('0x48'),'filter':_0x10742e['query']['filter']}};_0x1f2d9b[_0x347e('0x10')]=Object['assign'](_0x1f2d9b[_0x347e('0x10')],_0x10742e[_0x347e('0x10')]);delete _0x1f2d9b[_0x347e('0x10')]['id'];return db[_0x347e('0x39')][_0x347e('0x3a')](_0x1f2d9b);}return db[_0x3bf3ce]['findAndCountAll'](_0x2bb487);})['then'](function(_0x5a9d99){_0x34e44a[_0x347e('0x9')]=_0x5a9d99['count'];_0x4f8315=_0x5a9d99[_0x347e('0x21')];return rtq[_0x347e('0x50')](_0x10742e,_0x543c6e);})['then'](function(_0x121778){_0x1cbcfe=_0x121778['rows'];return rtq[_0x347e('0x51')](_0x4f8315,_0x1cbcfe,_0x543c6e,_0x10742e[_0x347e('0x10')][_0x347e('0x28')]);})[_0x347e('0x14')](function(_0xd9af4b){_0x34e44a['rows']=_0xd9af4b;return _0x34e44a;})['then'](respondWithFilteredResult(_0x2ac093,_0x2bb487))[_0x347e('0x43')](APIHandleError(_0x2ac093));}; \ No newline at end of file +var _0xe94f=['getAgentStatus','voiceStatus','pick','catch','getQueues','Queue','name','voice','dialActive','dialMethod','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','handleError','offset','undefined','limit','count','status','Content-Range','json','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','forEach','push','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','omit','UserProfile','find','filterAgentAttributes'];(function(_0x5e8c7c,_0x3429c6){var _0x48f7bd=function(_0x2b8a0f){while(--_0x2b8a0f){_0x5e8c7c['push'](_0x5e8c7c['shift']());}};_0x48f7bd(++_0x3429c6);}(_0xe94f,0x1ef));var _0xfe94=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xe94f[_0x484c03];return _0x294127;};'use strict';var _=require(_0xfe94('0x0'));var util=require('util');var rta=require(_0xfe94('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0xfe94('0x2'));var utils=require(_0xfe94('0x3'));var db=require(_0xfe94('0x4'))['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require('../../errors/api')[_0xfe94('0x5')];function respondWithFilteredResult(_0x2cf89c,_0x57f742){return function(_0x3444df){if(_0x3444df){var _0xd14123=typeof _0x57f742[_0xfe94('0x6')]===_0xfe94('0x7')&&typeof _0x57f742[_0xfe94('0x8')]===_0xfe94('0x7');var _0x1e86d2=_0x3444df[_0xfe94('0x9')];var _0x325326=_0xd14123?0x0:_0x57f742[_0xfe94('0x6')];var _0x47ad95=_0xd14123?_0x3444df['count']:_0x57f742[_0xfe94('0x6')]+_0x57f742[_0xfe94('0x8')];var _0x35f981;if(_0x47ad95>=_0x1e86d2){_0x47ad95=_0x1e86d2;_0x35f981=0xc8;}else{_0x35f981=0xce;}_0x2cf89c[_0xfe94('0xa')](_0x35f981);return _0x2cf89c['set'](_0xfe94('0xb'),_0x325326+'-'+_0x47ad95+'/'+_0x1e86d2)[_0xfe94('0xc')](_0x3444df);}return null;};}exports['getAgents']=function(_0x2beea9,_0x3b2734){var _0x265f18={'count':0x0,'rows':[]};var _0x2958ab={};var _0xcbfd56;var _0x4b2cb4=utils['getChannels']();var _0x1e53a2;var _0x55ecae;var _0x3c3b10=_0x2beea9['query'][_0xfe94('0xd')];var _0x5769cb=_0x2beea9[_0xfe94('0xe')][_0xfe94('0xf')];var _0x6d8807=_0x2beea9[_0xfe94('0xe')][_0xfe94('0x10')];var _0x3f261e=_0x5769cb===_0xfe94('0x11')||_0x5769cb===_0xfe94('0x12')?!![]:![];var _0x475a32=[];var _0x33271c;var _0x3f34e6;Promise[_0xfe94('0x13')]()[_0xfe94('0x14')](function(){if(_0x2beea9['query']['channel']){if(!utils[_0xfe94('0x15')](_0x2beea9[_0xfe94('0xe')]['channel'])){throw new APIBadRequestError(util[_0xfe94('0x16')](_0xfe94('0x17'),_0x2beea9[_0xfe94('0xe')]['channel']));}_0xcbfd56=_0x2beea9[_0xfe94('0xe')][_0xfe94('0x18')][_0xfe94('0x19')]();}if(!_0x2beea9[_0xfe94('0xe')][_0xfe94('0x1a')]||!_0x2beea9[_0xfe94('0xe')][_0xfe94('0x1a')][_0xfe94('0x1b')](_0xfe94('0x1c'))){_0x2beea9[_0xfe94('0xe')]['sort']=rta[_0xfe94('0x1d')](_0x2beea9[_0xfe94('0xe')][_0xfe94('0x1a')]);return;}var _0x533b39=rta[_0xfe94('0x1e')](_0x2beea9[_0xfe94('0xe')][_0xfe94('0x1a')]);_0x2beea9[_0xfe94('0xe')]['sort']=_0x533b39[_0xfe94('0x1f')][_0xfe94('0x20')](',');_0x33271c=_0x533b39[_0xfe94('0x21')];})[_0xfe94('0x14')](function(){if(!_0x3c3b10){return[];}return rta[_0xfe94('0x22')](_0x3c3b10,_0xcbfd56);})['then'](function(_0x32bc75){_0x475a32=_0x32bc75;return rta[_0xfe94('0x23')]();})[_0xfe94('0x14')](function(_0x544343){_0x55ecae=_0x544343[_0xfe94('0x24')];if((!_0x5769cb||_0x3f261e)&&!_0x33271c){return _0x475a32;}if(_0x33271c&&!_0x5769cb){return rta['getSortedAgentsIdsByStatus'](_0x55ecae,_0x475a32,_0x33271c);}else{return rta['getAgentIdsByStatus'](_0x55ecae,_0x475a32,_0x5769cb);}})[_0xfe94('0x14')](function(_0x1891d2){_0x475a32=_0x1891d2;var _0x10df97=![];if(_0x475a32[_0xfe94('0x25')]===0x0){if(_0x3c3b10||_0x5769cb){_0x10df97=!![];}if(_0x3f261e){_0x10df97=![];}}if(_0x10df97){return _0x265f18;}var _0x1eb0d7=_[_0xfe94('0x26')](db[_0xfe94('0x27')][_0xfe94('0x28')],function(_0x3b7f00){return{'name':_0x3b7f00[_0xfe94('0x29')],'type':_0x3b7f00[_0xfe94('0x2a')][_0xfe94('0x2b')]};});_0x2beea9[_0xfe94('0xe')][_0xfe94('0x2c')]=_0xfe94('0x2d');_0x2958ab=qs[_0xfe94('0x2e')](_0x1eb0d7,_0x2beea9);_0x2958ab[_0xfe94('0x2f')]=!![];var _0x403ede=[];if(_0x475a32[_0xfe94('0x25')]>0x0){_0x403ede['push']({'id':{'$in':_0x475a32}});if(_0x33271c&&!_0x5769cb){_0x3f34e6=[db[_0xfe94('0x30')][_0xfe94('0x31')]('FIELD(id,'+_0x475a32+')')];_0x2958ab['order']=_0x3f34e6;}}if(_0x3f261e){_0x4b2cb4[_0xfe94('0x32')](function(_0x2a8034){var _0x14dda9=!![];if(_0x5769cb===_0xfe94('0x12')&&_0xcbfd56!==_0x2a8034){_0x14dda9=![];}_0x403ede[_0xfe94('0x33')]({[_0x2a8034+_0xfe94('0x34')]:_0x14dda9});});if(_0x6d8807){_0x403ede[_0xfe94('0x33')]({'pauseType':_0x6d8807});}}else if(_0x5769cb){_0x4b2cb4['forEach'](function(_0x2f2162){_0x403ede[_0xfe94('0x33')]({[_0x2f2162+'Pause']:![]});});}_0x2958ab[_0xfe94('0x35')]=_[_0xfe94('0x36')](_0x2958ab[_0xfe94('0x35')],{'$and':_0x403ede});if(_0x2beea9[_0xfe94('0x37')][_0xfe94('0x2c')]===_0xfe94('0x37')){var _0x20b966={'params':{'id':_0x2beea9['user'][_0xfe94('0x38')]},'query':{'section':_0xfe94('0x39'),'role':_0xfe94('0x2d'),'raw':!![],'ids':_0x475a32,'customSorting':_0x3f34e6}};if(_0x2beea9['query'][_0xfe94('0x3a')]){_0x20b966[_0xfe94('0xe')]['online']=!![];}if(_0x3f261e){_0x20b966[_0xfe94('0xe')][_0xfe94('0x3b')]=_0x403ede;}_0x20b966[_0xfe94('0xe')]=Object[_0xfe94('0x3c')](_0x20b966[_0xfe94('0xe')],_[_0xfe94('0x3d')](_0x2beea9[_0xfe94('0xe')],'id'));return db[_0xfe94('0x3e')]['getResources'](_0x20b966);}return db[_0xfe94('0x27')]['findAndCountAll'](_0x2958ab);})[_0xfe94('0x14')](function(_0x57b8bf){_0x265f18[_0xfe94('0x9')]=_0x57b8bf['count'];_0x1e53a2=_0x57b8bf[_0xfe94('0x24')];return _0x1e53a2[_0xfe94('0x26')](function(_0xb48b8a){var _0x4533da=_[_0xfe94('0x3f')](_0x55ecae,['id',_0xb48b8a['id']]);if(_0x4533da){var _0x533c3f=rta[_0xfe94('0x40')](_0x4533da);_[_0xfe94('0x36')](_0xb48b8a,_0x533c3f);}_0xb48b8a[_0xfe94('0x1c')]=rta[_0xfe94('0x41')](_0xb48b8a);if(_0xb48b8a[_0xfe94('0x1c')][_0xfe94('0x1b')](_0xfe94('0x11'))){_0x4b2cb4[_0xfe94('0x32')](function(_0x11922b){if(_0xb48b8a[_0x11922b+_0xfe94('0x34')]){if(_0x11922b==='voice'){if(_0xb48b8a[_0xfe94('0x42')]!=='talking'){_0xb48b8a[_0xfe94('0x42')]=_0xfe94('0x11');}}else{_0xb48b8a[_0x11922b+'Status']=_0xfe94('0x11');}}});}return _0xb48b8a;});})[_0xfe94('0x14')](function(_0x50f37a){if(!_0x33271c||_0x3f34e6){return _0x50f37a;}return rta['sortAgentsByStatus'](_0x50f37a,_0x33271c);})['then'](function(_0xd2d1e2){var _0x38137f=rta['getRealtimeAgentsQueryFields']();_0x265f18[_0xfe94('0x24')]=_0xd2d1e2['map'](function(_0x8b6ec9){return _[_0xfe94('0x43')](_0x8b6ec9,_0x38137f);});return _0x265f18;})['then'](respondWithFilteredResult(_0x3b2734,_0x2958ab))[_0xfe94('0x44')](APIHandleError(_0x3b2734));};exports[_0xfe94('0x45')]=function(_0x16afee,_0x1b55d3){var _0x43f278={'count':0x0,'rows':[]};var _0x1235f1={};var _0x4ecb0f;var _0x3ac04c;var _0x48e0f5;Promise[_0xfe94('0x13')]()[_0xfe94('0x14')](function(){if(_0x16afee['query'][_0xfe94('0x18')]){if(!utils[_0xfe94('0x15')](_0x16afee[_0xfe94('0xe')]['channel'])){throw new APIBadRequestError(util[_0xfe94('0x16')](_0xfe94('0x17'),_0x16afee[_0xfe94('0xe')]['channel']));}_0x4ecb0f=_0x16afee['query'][_0xfe94('0x18')][_0xfe94('0x19')]();}var _0x129495=_['startCase'](_0x4ecb0f)+_0xfe94('0x46');var _0xe3d18=_[_0xfe94('0x26')](db[_0x129495][_0xfe94('0x28')],function(_0x5b1ab6){return{'name':_0x5b1ab6[_0xfe94('0x29')],'type':_0x5b1ab6[_0xfe94('0x2a')]['key']};});if(!_0x16afee[_0xfe94('0xe')]['fields']){var _0x57929b=['id',_0xfe94('0x47')];if(_0x4ecb0f===_0xfe94('0x48')){_0x57929b[_0xfe94('0x33')](_0xfe94('0x2a'));if(_0x16afee['query'][_0xfe94('0x2a')]==='outbound'){_0x57929b[_0xfe94('0x33')]([_0xfe94('0x49'),_0xfe94('0x4a')]);}}_0x16afee['query'][_0xfe94('0x1f')]=_0x57929b['join'](',');}_0x1235f1=qs[_0xfe94('0x2e')](_0xe3d18,_0x16afee);if(_0x16afee[_0xfe94('0x37')]['role']===_0xfe94('0x37')){var _0x407539={'params':{'id':_0x16afee[_0xfe94('0x37')]['userProfileId']},'query':{'section':_0x4ecb0f===_0xfe94('0x48')&&_0x16afee[_0xfe94('0xe')]['type']==='outbound'?_0xfe94('0x4b'):_['startCase'](_0x4ecb0f)+_0xfe94('0x4c'),'type':_0x16afee[_0xfe94('0xe')]['type'],'nolimit':!![],'sort':'name','filter':_0x16afee['query'][_0xfe94('0x4d')]}};_0x407539[_0xfe94('0xe')]=Object[_0xfe94('0x3c')](_0x407539[_0xfe94('0xe')],_0x16afee[_0xfe94('0xe')]);delete _0x407539[_0xfe94('0xe')]['id'];return db[_0xfe94('0x3e')]['getResources'](_0x407539);}return db[_0x129495]['findAndCountAll'](_0x1235f1);})[_0xfe94('0x14')](function(_0xa72e3e){_0x43f278[_0xfe94('0x9')]=_0xa72e3e['count'];_0x3ac04c=_0xa72e3e['rows'];return rtq[_0xfe94('0x4e')](_0x16afee,_0x4ecb0f);})[_0xfe94('0x14')](function(_0x534ed4){_0x48e0f5=_0x534ed4[_0xfe94('0x24')];return rtq[_0xfe94('0x4f')](_0x3ac04c,_0x48e0f5,_0x4ecb0f,_0x16afee[_0xfe94('0xe')][_0xfe94('0x2a')]);})[_0xfe94('0x14')](function(_0x7aa7b1){_0x43f278[_0xfe94('0x24')]=_0x7aa7b1;return _0x43f278;})['then'](respondWithFilteredResult(_0x1b55d3,_0x1235f1))[_0xfe94('0x44')](APIHandleError(_0x1b55d3));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 60673e2..7a1e404 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f3790,_0x4ea2f6){var _0x16ac33=function(_0x1bed48){while(--_0x1bed48){_0x2f3790['push'](_0x2f3790['shift']());}};_0x16ac33(++_0x4ea2f6);}(_0x70e0,0x17b));var _0x070e=function(_0x1ea31f,_0x439fc3){_0x1ea31f=_0x1ea31f-0x0;var _0x367318=_0x70e0[_0x1ea31f];return _0x367318;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5aa72d,_0x29c2f3){var _0x1c6dca=function(_0x1ec66c){while(--_0x1ec66c){_0x5aa72d['push'](_0x5aa72d['shift']());}};_0x1c6dca(++_0x29c2f3);}(_0xe706,0xa3));var _0x6e70=function(_0x48cac8,_0x150d03){_0x48cac8=_0x48cac8-0x0;var _0x539232=_0xe706[_0x48cac8];return _0x539232;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index eb53440..e349eb6 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x7da7,0x10d));var _0x77da=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x7da7[_0x15b380];return _0x232c5c;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'state':{'type':Sequelize[_0x77da('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x77da('0x3')]},'starttime':{'type':Sequelize[_0x77da('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x77da('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x77da('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x77da('0x3')]}}; \ No newline at end of file +var _0x9134=['INTEGER','STRING','DATE','exports'];(function(_0x56e8d1,_0x55e742){var _0x1421bc=function(_0x1f865f){while(--_0x1f865f){_0x56e8d1['push'](_0x56e8d1['shift']());}};_0x1421bc(++_0x55e742);}(_0x9134,0x87));var _0x4913=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9134[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x4913('0x0')]={'state':{'type':Sequelize[_0x4913('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4913('0x2')]},'scheduledat':{'type':Sequelize[_0x4913('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4913('0x3')]},'ringtime':{'type':Sequelize[_0x4913('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4913('0x2')]},'campaigntype':{'type':Sequelize[_0x4913('0x2')]},'membername':{'type':Sequelize[_0x4913('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c6b9766..c31ff73 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.model.js +++ b/server/api/reportAgentPreview/reportAgentPreview.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdff3=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xdff3,0x1b9));var _0x3dff=function(_0x367578,_0x2afa02){_0x367578=_0x367578-0x0;var _0x3e441c=_0xdff3[_0x367578];return _0x3e441c;};'use strict';var _=require(_0x3dff('0x0'));var util=require(_0x3dff('0x1'));var logger=require(_0x3dff('0x2'))(_0x3dff('0x3'));var moment=require(_0x3dff('0x4'));var BPromise=require(_0x3dff('0x5'));var rp=require(_0x3dff('0x6'));var fs=require('fs');var path=require(_0x3dff('0x7'));var rimraf=require(_0x3dff('0x8'));var config=require(_0x3dff('0x9'));var attributes=require(_0x3dff('0xa'));module[_0x3dff('0xb')]=function(_0x5edde7,_0x17dcac){return _0x5edde7[_0x3dff('0xc')](_0x3dff('0xd'),attributes,{'tableName':_0x3dff('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd527=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','api','moment','bluebird','request-promise'];(function(_0x344b19,_0x429bfc){var _0x4a0d5c=function(_0x43a459){while(--_0x43a459){_0x344b19['push'](_0x344b19['shift']());}};_0x4a0d5c(++_0x429bfc);}(_0xd527,0x140));var _0x7d52=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0xd527[_0x50b1c5];return _0x344f99;};'use strict';var _=require('lodash');var util=require(_0x7d52('0x0'));var logger=require('../../config/logger')(_0x7d52('0x1'));var moment=require(_0x7d52('0x2'));var BPromise=require(_0x7d52('0x3'));var rp=require(_0x7d52('0x4'));var fs=require('fs');var path=require(_0x7d52('0x5'));var rimraf=require(_0x7d52('0x6'));var config=require(_0x7d52('0x7'));var attributes=require(_0x7d52('0x8'));module[_0x7d52('0x9')]=function(_0x12a2e7,_0xbe6e83){return _0x12a2e7[_0x7d52('0xa')](_0x7d52('0xb'),attributes,{'tableName':_0x7d52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 633483a..6efcc21 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.rpc.js +++ b/server/api/reportAgentPreview/reportAgentPreview.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4548=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','options','lodash','util','moment','bluebird'];(function(_0x5c0217,_0x52a020){var _0x5a16dd=function(_0x29d549){while(--_0x29d549){_0x5c0217['push'](_0x5c0217['shift']());}};_0x5a16dd(++_0x52a020);}(_0x4548,0x88));var _0x8454=function(_0x127232,_0x211cf4){_0x127232=_0x127232-0x0;var _0x3564dc=_0x4548[_0x127232];return _0x3564dc;};'use strict';var _=require(_0x8454('0x0'));var util=require(_0x8454('0x1'));var moment=require(_0x8454('0x2'));var BPromise=require(_0x8454('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8454('0x4'));var db=require(_0x8454('0x5'))['db'];var utils=require(_0x8454('0x6'));var logger=require(_0x8454('0x7'))(_0x8454('0x8'));var config=require(_0x8454('0x9'));var jayson=require(_0x8454('0xa'));var client=jayson['client'][_0x8454('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3afda3,_0x492455,_0x17f768){return new BPromise(function(_0x5dc9ec,_0x526903){return client[_0x8454('0xc')](_0x3afda3,_0x17f768)[_0x8454('0xd')](function(_0x9eb89){logger[_0x8454('0xe')](_0x8454('0xf'),_0x492455,_0x8454('0x10'));logger[_0x8454('0x11')](_0x8454('0x12'),_0x492455,_0x8454('0x10'),JSON[_0x8454('0x13')](_0x9eb89));if(_0x9eb89['error']){if(_0x9eb89[_0x8454('0x14')][_0x8454('0x15')]===0x1f4){logger[_0x8454('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x492455,_0x9eb89[_0x8454('0x14')]['message']);return _0x526903(_0x9eb89[_0x8454('0x14')][_0x8454('0x16')]);}logger[_0x8454('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x492455,_0x9eb89[_0x8454('0x14')][_0x8454('0x16')]);return _0x5dc9ec(_0x9eb89[_0x8454('0x14')][_0x8454('0x16')]);}else{logger[_0x8454('0xe')](_0x8454('0xf'),_0x492455,_0x8454('0x10'));_0x5dc9ec(_0x9eb89[_0x8454('0x17')][_0x8454('0x16')]);}})[_0x8454('0x18')](function(_0x22a860){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x492455,_0x22a860);_0x526903(_0x22a860);});});}exports[_0x8454('0x19')]=function(_0x545ebd){var _0x574e05=this;return new Promise(function(_0xca5cf3,_0x5542fc){return db[_0x8454('0x1a')]['create'](_0x545ebd['body'],{'raw':_0x545ebd[_0x8454('0x1b')]?_0x545ebd[_0x8454('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8454('0xd')](function(_0x1488aa){logger[_0x8454('0xe')](_0x8454('0x19'),_0x545ebd);logger[_0x8454('0x11')](_0x8454('0x19'),_0x545ebd,JSON[_0x8454('0x13')](_0x1488aa));_0xca5cf3(_0x1488aa);})[_0x8454('0x18')](function(_0x49a98e){logger['error'](_0x8454('0x19'),_0x49a98e[_0x8454('0x16')],_0x545ebd);_0x5542fc(_0x574e05[_0x8454('0x14')](0x1f4,_0x49a98e[_0x8454('0x16')]));});});}; \ No newline at end of file +var _0xd417=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent'];(function(_0xd9acd0,_0x14d798){var _0x7ff0aa=function(_0x3d2a40){while(--_0x3d2a40){_0xd9acd0['push'](_0xd9acd0['shift']());}};_0x7ff0aa(++_0x14d798);}(_0xd417,0x1e7));var _0x7d41=function(_0x503bde,_0x50adcb){_0x503bde=_0x503bde-0x0;var _0x2e52c3=_0xd417[_0x503bde];return _0x2e52c3;};'use strict';var _=require('lodash');var util=require(_0x7d41('0x0'));var moment=require(_0x7d41('0x1'));var BPromise=require(_0x7d41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d41('0x3'));var db=require(_0x7d41('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d41('0x5'))('rpc');var config=require(_0x7d41('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7d41('0x7')][_0x7d41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfe9e7b,_0x578bb0,_0x4953cc){return new BPromise(function(_0x1e8efa,_0x398d3e){return client['request'](_0xfe9e7b,_0x4953cc)[_0x7d41('0x9')](function(_0x3ecc0e){logger[_0x7d41('0xa')](_0x7d41('0xb'),_0x578bb0,_0x7d41('0xc'));logger[_0x7d41('0xd')](_0x7d41('0xe'),_0x578bb0,'request\x20sent',JSON[_0x7d41('0xf')](_0x3ecc0e));if(_0x3ecc0e['error']){if(_0x3ecc0e['error'][_0x7d41('0x10')]===0x1f4){logger['error'](_0x7d41('0xb'),_0x578bb0,_0x3ecc0e[_0x7d41('0x11')][_0x7d41('0x12')]);return _0x398d3e(_0x3ecc0e['error'][_0x7d41('0x12')]);}logger[_0x7d41('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x578bb0,_0x3ecc0e[_0x7d41('0x11')][_0x7d41('0x12')]);return _0x1e8efa(_0x3ecc0e[_0x7d41('0x11')]['message']);}else{logger[_0x7d41('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x578bb0,_0x7d41('0xc'));_0x1e8efa(_0x3ecc0e['result'][_0x7d41('0x12')]);}})[_0x7d41('0x13')](function(_0x319e61){logger[_0x7d41('0x11')](_0x7d41('0xb'),_0x578bb0,_0x319e61);_0x398d3e(_0x319e61);});});}exports[_0x7d41('0x14')]=function(_0x16faf3){var _0x2b3e6d=this;return new Promise(function(_0x5899d1,_0x4a48da){return db[_0x7d41('0x15')][_0x7d41('0x16')](_0x16faf3['body'],{'raw':_0x16faf3['options']?_0x16faf3[_0x7d41('0x17')][_0x7d41('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2bdf44){logger[_0x7d41('0xa')](_0x7d41('0x14'),_0x16faf3);logger[_0x7d41('0xd')](_0x7d41('0x14'),_0x16faf3,JSON[_0x7d41('0xf')](_0x2bdf44));_0x5899d1(_0x2bdf44);})[_0x7d41('0x13')](function(_0x36c21e){logger['error']('CreateReportAgentPreview',_0x36c21e[_0x7d41('0x12')],_0x16faf3);_0x4a48da(_0x2b3e6d[_0x7d41('0x11')](0x1f4,_0x36c21e['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1c058d5..f0a1c0f 100644 --- a/server/api/rpc/index.js +++ b/server/api/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35e7=['campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns'];(function(_0x12a87c,_0x150aa5){var _0x4c9563=function(_0x27b0db){while(--_0x27b0db){_0x12a87c['push'](_0x12a87c['shift']());}};_0x4c9563(++_0x150aa5);}(_0x35e7,0xbd));var _0x735e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x35e7[_0x1e3c16];return _0x47a0c9;};'use strict';var multer=require(_0x735e('0x0'));var util=require(_0x735e('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x735e('0x2'));var controller=require('./rpc.controller');router[_0x735e('0x3')](_0x735e('0x4'),auth[_0x735e('0x5')](),controller[_0x735e('0x6')]);router[_0x735e('0x3')](_0x735e('0x7'),auth[_0x735e('0x5')](),controller[_0x735e('0x8')]);router[_0x735e('0x3')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x735e('0x5')](),controller[_0x735e('0x9')]);router[_0x735e('0x3')]('/voice/queues',auth[_0x735e('0x5')](),controller['voiceQueues']);router[_0x735e('0x3')](_0x735e('0xa'),auth['isAuthenticated'](),controller[_0x735e('0xb')]);router[_0x735e('0x3')]('/mail/queues',auth[_0x735e('0x5')](),controller[_0x735e('0xc')]);router[_0x735e('0x3')](_0x735e('0xd'),auth[_0x735e('0x5')](),controller['mailAccounts']);router['get'](_0x735e('0xe'),auth['isAuthenticated'](),controller[_0x735e('0xf')]);router[_0x735e('0x3')](_0x735e('0x10'),auth[_0x735e('0x5')](),controller[_0x735e('0x11')]);router[_0x735e('0x3')](_0x735e('0x12'),auth['isAuthenticated'](),controller[_0x735e('0x13')]);router[_0x735e('0x3')](_0x735e('0x14'),auth[_0x735e('0x5')](),controller[_0x735e('0x15')]);router[_0x735e('0x3')](_0x735e('0x16'),auth[_0x735e('0x5')](),controller['voiceQueuesPreview']);router[_0x735e('0x3')]('/voice/queues/channels',auth[_0x735e('0x5')](),controller[_0x735e('0x17')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x735e('0x5')](),controller[_0x735e('0x18')]);router[_0x735e('0x3')](_0x735e('0x19'),auth[_0x735e('0x5')](),controller[_0x735e('0x1a')]);router[_0x735e('0x3')](_0x735e('0x1b'),auth[_0x735e('0x5')](),controller[_0x735e('0x1c')]);router[_0x735e('0x3')](_0x735e('0x1d'),auth[_0x735e('0x5')](),controller[_0x735e('0x1e')]);router[_0x735e('0x1f')](_0x735e('0x1d'),auth[_0x735e('0x5')](),controller[_0x735e('0x20')]);router[_0x735e('0x3')](_0x735e('0x21'),auth['isAuthenticated'](),controller[_0x735e('0x22')]);router[_0x735e('0x3')](_0x735e('0x23'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x735e('0x3')](_0x735e('0x24'),auth[_0x735e('0x5')](),controller[_0x735e('0x25')]);router[_0x735e('0x1f')](_0x735e('0x26'),auth['isAuthenticated'](),controller[_0x735e('0x27')]);router[_0x735e('0x3')](_0x735e('0x28'),auth[_0x735e('0x5')](),controller[_0x735e('0x29')]);router[_0x735e('0x3')](_0x735e('0x2a'),auth[_0x735e('0x5')](),controller[_0x735e('0x2b')]);router['get'](_0x735e('0x2c'),auth['isAuthenticated'](),controller[_0x735e('0x2d')]);router[_0x735e('0x3')]('/fax/accounts',auth[_0x735e('0x5')](),controller[_0x735e('0x2e')]);router[_0x735e('0x3')](_0x735e('0x2f'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x735e('0x3')](_0x735e('0x30'),auth[_0x735e('0x5')](),controller[_0x735e('0x31')]);router[_0x735e('0x3')]('/openchannel/queues/waitinginteractions',auth[_0x735e('0x5')](),controller[_0x735e('0x32')]);router[_0x735e('0x3')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x735e('0x33')]);router[_0x735e('0x3')](_0x735e('0x34'),auth[_0x735e('0x5')](),controller['smsQueuesWaitingInteractions']);router[_0x735e('0x3')]('/whatsapp/queues/waitinginteractions',auth[_0x735e('0x5')](),controller[_0x735e('0x35')]);router[_0x735e('0x3')](_0x735e('0x36'),auth[_0x735e('0x5')](),controller['faxQueuesWaitingInteractions']);router[_0x735e('0x37')](_0x735e('0x38'),auth[_0x735e('0x5')](),controller[_0x735e('0x39')](_0x735e('0x3a')));router['get'](_0x735e('0x3b'),auth[_0x735e('0x5')](),controller['showMailQueues']);router[_0x735e('0x37')](_0x735e('0x3c'),auth[_0x735e('0x5')](),controller[_0x735e('0x39')](_0x735e('0x3d')));router[_0x735e('0x3')](_0x735e('0x3e'),auth[_0x735e('0x5')](),controller[_0x735e('0x3f')]);router[_0x735e('0x37')](_0x735e('0x40'),auth['isAuthenticated'](),controller[_0x735e('0x39')]('fax'));router[_0x735e('0x3')](_0x735e('0x41'),auth[_0x735e('0x5')](),controller['showFaxQueues']);router[_0x735e('0x37')](_0x735e('0x42'),auth[_0x735e('0x5')](),controller[_0x735e('0x39')](_0x735e('0x43')));router[_0x735e('0x3')]('/openchannel/queues/:id',auth[_0x735e('0x5')](),controller[_0x735e('0x44')]);router[_0x735e('0x37')](_0x735e('0x45'),auth[_0x735e('0x5')](),controller[_0x735e('0x39')](_0x735e('0x46')));router['post'](_0x735e('0x47'),auth[_0x735e('0x5')](),controller['queueNotify'](_0x735e('0x48')));router['get']('/sms/queues/:id',auth[_0x735e('0x5')](),controller['showSmsQueues']);router[_0x735e('0x3')](_0x735e('0x49'),auth[_0x735e('0x5')](),controller[_0x735e('0x4a')]);router[_0x735e('0x37')](_0x735e('0x4b'),auth[_0x735e('0x5')](),controller[_0x735e('0x4c')]);module[_0x735e('0x4d')]=router; \ No newline at end of file +var _0xf739=['smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','path','Router','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions'];(function(_0x3769c1,_0x4a05b5){var _0x5838f3=function(_0x104926){while(--_0x104926){_0x3769c1['push'](_0x3769c1['shift']());}};_0x5838f3(++_0x4a05b5);}(_0xf739,0xaf));var _0x9f73=function(_0x1ba3f0,_0x3b220d){_0x1ba3f0=_0x1ba3f0-0x0;var _0x53064d=_0xf739[_0x1ba3f0];return _0x53064d;};'use strict';var multer=require(_0x9f73('0x0'));var util=require('util');var path=require(_0x9f73('0x1'));var express=require('express');var router=express[_0x9f73('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0x9f73('0x3'));router[_0x9f73('0x4')](_0x9f73('0x5'),auth[_0x9f73('0x6')](),controller['voiceChannels']);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x9f73('0x6')](),controller['voiceChannelMixMonitor']);router['get'](_0x9f73('0x7'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x8')]);router['get']('/voice/queues',auth['isAuthenticated'](),controller[_0x9f73('0x9')]);router[_0x9f73('0x4')]('/chat/queues',auth[_0x9f73('0x6')](),controller['chatQueues']);router['get'](_0x9f73('0xa'),auth[_0x9f73('0x6')](),controller[_0x9f73('0xb')]);router[_0x9f73('0x4')](_0x9f73('0xc'),auth[_0x9f73('0x6')](),controller[_0x9f73('0xd')]);router['get'](_0x9f73('0xe'),auth['isAuthenticated'](),controller[_0x9f73('0xf')]);router['get'](_0x9f73('0x10'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x11')]);router[_0x9f73('0x4')](_0x9f73('0x12'),auth['isAuthenticated'](),controller[_0x9f73('0x13')]);router[_0x9f73('0x4')](_0x9f73('0x14'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x15')]);router[_0x9f73('0x4')](_0x9f73('0x16'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x17')]);router[_0x9f73('0x4')]('/voice/queues/channels',auth[_0x9f73('0x6')](),controller[_0x9f73('0x18')]);router[_0x9f73('0x4')](_0x9f73('0x19'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x1a')]);router[_0x9f73('0x4')](_0x9f73('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x9f73('0x4')](_0x9f73('0x1c'),auth[_0x9f73('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x9f73('0x4')](_0x9f73('0x1d'),auth[_0x9f73('0x6')](),controller['showVoiceQueues']);router[_0x9f73('0x1e')]('/voice/queues/:id',auth[_0x9f73('0x6')](),controller[_0x9f73('0x1f')]);router[_0x9f73('0x4')](_0x9f73('0x20'),auth[_0x9f73('0x6')](),controller['outbound']);router[_0x9f73('0x4')](_0x9f73('0x21'),auth[_0x9f73('0x6')](),controller['outboundChannels']);router[_0x9f73('0x4')](_0x9f73('0x22'),auth['isAuthenticated'](),controller[_0x9f73('0x23')]);router[_0x9f73('0x1e')]('/agents/:id/capacity',auth[_0x9f73('0x6')](),controller['agentCapacity']);router[_0x9f73('0x4')]('/telephones',auth['isAuthenticated'](),controller[_0x9f73('0x24')]);router[_0x9f73('0x4')]('/trunks',auth[_0x9f73('0x6')](),controller[_0x9f73('0x25')]);router[_0x9f73('0x4')]('/campaigns',auth[_0x9f73('0x6')](),controller[_0x9f73('0x26')]);router['get'](_0x9f73('0x27'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x28')]);router[_0x9f73('0x4')](_0x9f73('0x29'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x2a')]);router[_0x9f73('0x4')](_0x9f73('0x2b'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x2c')]);router['get'](_0x9f73('0x2d'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x2e')]);router[_0x9f73('0x4')](_0x9f73('0x2f'),auth['isAuthenticated'](),controller[_0x9f73('0x30')]);router[_0x9f73('0x4')](_0x9f73('0x31'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x32')]);router['get'](_0x9f73('0x33'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x34')]);router[_0x9f73('0x4')](_0x9f73('0x35'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x36')]);router['post']('/mail/queues/:id/notify',auth[_0x9f73('0x6')](),controller[_0x9f73('0x37')]('mail'));router[_0x9f73('0x4')](_0x9f73('0x38'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x39')]);router[_0x9f73('0x3a')](_0x9f73('0x3b'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x37')]('chat'));router[_0x9f73('0x4')]('/chat/queues/:id',auth[_0x9f73('0x6')](),controller[_0x9f73('0x3c')]);router[_0x9f73('0x3a')]('/fax/queues/:id/notify',auth[_0x9f73('0x6')](),controller[_0x9f73('0x37')](_0x9f73('0x3d')));router['get'](_0x9f73('0x3e'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x3f')]);router[_0x9f73('0x3a')](_0x9f73('0x40'),auth['isAuthenticated'](),controller[_0x9f73('0x37')](_0x9f73('0x41')));router['get'](_0x9f73('0x42'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post']('/sms/queues/:id/notify',auth[_0x9f73('0x6')](),controller['queueNotify'](_0x9f73('0x43')));router[_0x9f73('0x3a')](_0x9f73('0x44'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x37')](_0x9f73('0x45')));router['get'](_0x9f73('0x46'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x47')]);router[_0x9f73('0x4')](_0x9f73('0x48'),auth[_0x9f73('0x6')](),controller[_0x9f73('0x49')]);router['post'](_0x9f73('0x4a'),auth[_0x9f73('0x6')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 56b4a62..f5d58de 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x4c39ce,_0x2572a0){var _0x13a071=function(_0x1433b2){while(--_0x1433b2){_0x4c39ce['push'](_0x4c39ce['shift']());}};_0x13a071(++_0x2572a0);}(_0xe706,0xa3));var _0x6e70=function(_0x39187b,_0x2a6214){_0x39187b=_0x39187b-0x0;var _0x2cf25f=_0xe706[_0x39187b];return _0x2cf25f;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x4ae6fe,_0x4999af){var _0x2ee386=function(_0x5237a0){while(--_0x5237a0){_0x4ae6fe['push'](_0x4ae6fe['shift']());}};_0x2ee386(++_0x4999af);}(_0xe706,0xa3));var _0x6e70=function(_0x1b1ce5,_0x508743){_0x1b1ce5=_0x1b1ce5-0x0;var _0x432ff6=_0xe706[_0x1b1ce5];return _0x432ff6;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index eddbb4d..9336d9c 100644 --- a/server/api/schedule/index.js +++ b/server/api/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc275=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','show','run','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout'];(function(_0x418775,_0x13cd3d){var _0x1a57ca=function(_0x498361){while(--_0x498361){_0x418775['push'](_0x418775['shift']());}};_0x1a57ca(++_0x13cd3d);}(_0xc275,0xd8));var _0x5c27=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc275[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x5c27('0x0'));var util=require(_0x5c27('0x1'));var path=require(_0x5c27('0x2'));var timeout=require(_0x5c27('0x3'));var express=require(_0x5c27('0x4'));var router=express[_0x5c27('0x5')]();var fs_extra=require(_0x5c27('0x6'));var auth=require(_0x5c27('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5c27('0x8'));var controller=require(_0x5c27('0x9'));router[_0x5c27('0xa')]('/',auth[_0x5c27('0xb')](),controller['index']);router[_0x5c27('0xa')]('/:id',auth[_0x5c27('0xb')](),controller[_0x5c27('0xc')]);router['get']('/:id/run',auth[_0x5c27('0xb')](),controller[_0x5c27('0xd')]);router[_0x5c27('0xe')]('/',auth[_0x5c27('0xb')](),controller[_0x5c27('0xf')]);router[_0x5c27('0x10')](_0x5c27('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x5c27('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5c27('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbc7c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','isAuthenticated','show','get','/:id/run','run','create','put','update','/:id','destroy','exports','multer','util'];(function(_0x4610cc,_0x46e9bd){var _0x38ba7e=function(_0x2a40d3){while(--_0x2a40d3){_0x4610cc['push'](_0x4610cc['shift']());}};_0x38ba7e(++_0x46e9bd);}(_0xbc7c,0x17a));var _0xcbc7=function(_0x81fc31,_0x151260){_0x81fc31=_0x81fc31-0x0;var _0x3c1234=_0xbc7c[_0x81fc31];return _0x3c1234;};'use strict';var multer=require(_0xcbc7('0x0'));var util=require(_0xcbc7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbc7('0x2'));var router=express[_0xcbc7('0x3')]();var fs_extra=require(_0xcbc7('0x4'));var auth=require(_0xcbc7('0x5'));var interaction=require(_0xcbc7('0x6'));var config=require('../../config/environment');var controller=require(_0xcbc7('0x7'));router['get']('/',auth[_0xcbc7('0x8')](),controller['index']);router['get']('/:id',auth[_0xcbc7('0x8')](),controller[_0xcbc7('0x9')]);router[_0xcbc7('0xa')](_0xcbc7('0xb'),auth[_0xcbc7('0x8')](),controller[_0xcbc7('0xc')]);router['post']('/',auth[_0xcbc7('0x8')](),controller[_0xcbc7('0xd')]);router[_0xcbc7('0xe')]('/:id',auth[_0xcbc7('0x8')](),controller[_0xcbc7('0xf')]);router['delete'](_0xcbc7('0x10'),auth['isAuthenticated'](),controller[_0xcbc7('0x11')]);module[_0xcbc7('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 244686d..6714ef1 100644 --- a/server/api/schedule/schedule.attributes.js +++ b/server/api/schedule/schedule.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd23a=['STRING','BOOLEAN','DATE','INTEGER','quarters','months','minutes','days','ENUM','csv','custom','TEXT','exports'];(function(_0x29dfbf,_0x825956){var _0x53ca95=function(_0x47423f){while(--_0x47423f){_0x29dfbf['push'](_0x29dfbf['shift']());}};_0x53ca95(++_0x825956);}(_0xd23a,0x74));var _0xad23=function(_0x587680,_0x2291e9){_0x587680=_0x587680-0x0;var _0x2659da=_0xd23a[_0x587680];return _0x2659da;};'use strict';var Sequelize=require('sequelize');module[_0xad23('0x0')]={'name':{'type':Sequelize[_0xad23('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xad23('0x1')]},'active':{'type':Sequelize[_0xad23('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xad23('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xad23('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xad23('0x5'),_0xad23('0x6'),'weeks','days','hours',_0xad23('0x7')),'allowNull':![],'defaultValue':_0xad23('0x8')},'output':{'type':Sequelize[_0xad23('0x9')]('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0xad23('0xa')},'type':{'type':Sequelize[_0xad23('0x9')](_0xad23('0xb'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xad23('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xad23('0x1')]},'cc':{'type':Sequelize[_0xad23('0xc')]},'bcc':{'type':Sequelize[_0xad23('0xc')]},'sendIfEmpty':{'type':Sequelize[_0xad23('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe6e7=['csv','pdf','xlsx','default','custom','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','days'];(function(_0x3fc1fc,_0x1507c7){var _0x251543=function(_0x37326a){while(--_0x37326a){_0x3fc1fc['push'](_0x3fc1fc['shift']());}};_0x251543(++_0x1507c7);}(_0xe6e7,0x195));var _0x7e6e=function(_0x34f856,_0x549a30){_0x34f856=_0x34f856-0x0;var _0x3e2869=_0xe6e7[_0x34f856];return _0x3e2869;};'use strict';var Sequelize=require(_0x7e6e('0x0'));module[_0x7e6e('0x1')]={'name':{'type':Sequelize[_0x7e6e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7e6e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7e6e('0x2')],'allowNull':![],'defaultValue':_0x7e6e('0x4')},'startAt':{'type':Sequelize[_0x7e6e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7e6e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7e6e('0x6')](_0x7e6e('0x7'),_0x7e6e('0x8'),_0x7e6e('0x9'),'weeks',_0x7e6e('0xa'),'hours','minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x7e6e('0xb'),_0x7e6e('0xc'),_0x7e6e('0xd')),'allowNull':![],'defaultValue':_0x7e6e('0xb')},'type':{'type':Sequelize['ENUM']('custom',_0x7e6e('0xe')),'allowNull':![],'defaultValue':_0x7e6e('0xf')},'sendMail':{'type':Sequelize[_0x7e6e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7e6e('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x7e6e('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f1ab298..99520d7 100644 --- a/server/api/schedule/schedule.controller.js +++ b/server/api/schedule/schedule.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec08=['include','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x548649,_0x3c1a27){var _0x1112ea=function(_0x2c463f){while(--_0x2c463f){_0x548649['push'](_0x548649['shift']());}};_0x1112ea(++_0x3c1a27);}(_0xec08,0x11a));var _0x8ec0=function(_0x11e9ea,_0x5be9fc){_0x11e9ea=_0x11e9ea-0x0;var _0x3bb6dc=_0xec08[_0x11e9ea];return _0x3bb6dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ec0('0x0'));var zipdir=require(_0x8ec0('0x1'));var jsonpatch=require(_0x8ec0('0x2'));var rp=require(_0x8ec0('0x3'));var moment=require(_0x8ec0('0x4'));var BPromise=require(_0x8ec0('0x5'));var Mustache=require(_0x8ec0('0x6'));var util=require(_0x8ec0('0x7'));var path=require(_0x8ec0('0x8'));var sox=require(_0x8ec0('0x9'));var csv=require(_0x8ec0('0xa'));var ejs=require(_0x8ec0('0xb'));var fs=require('fs');var fs_extra=require(_0x8ec0('0xc'));var _=require('lodash');var squel=require(_0x8ec0('0xd'));var crypto=require(_0x8ec0('0xe'));var jsforce=require(_0x8ec0('0xf'));var deskjs=require(_0x8ec0('0x10'));var toCsv=require(_0x8ec0('0xa'));var querystring=require(_0x8ec0('0x11'));var Papa=require(_0x8ec0('0x12'));var Redis=require(_0x8ec0('0x13'));var authService=require(_0x8ec0('0x14'));var qs=require(_0x8ec0('0x15'));var as=require(_0x8ec0('0x16'));var hardwareService=require(_0x8ec0('0x17'));var logger=require('../../config/logger')(_0x8ec0('0x18'));var utils=require(_0x8ec0('0x19'));var config=require(_0x8ec0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ec0('0x1b'))['db'];function respondWithStatusCode(_0x5f1fb5,_0x2294fd){_0x2294fd=_0x2294fd||0xcc;return function(_0x234008){if(_0x234008){return _0x5f1fb5[_0x8ec0('0x1c')](_0x2294fd);}return _0x5f1fb5[_0x8ec0('0x1d')](_0x2294fd)['end']();};}function respondWithResult(_0xb5daec,_0x219412){_0x219412=_0x219412||0xc8;return function(_0xd1a50b){if(_0xd1a50b){return _0xb5daec['status'](_0x219412)[_0x8ec0('0x1e')](_0xd1a50b);}};}function respondWithFilteredResult(_0x48826f,_0x3ce85a){return function(_0xa6b060){if(_0xa6b060){var _0x2c7fe1=typeof _0x3ce85a[_0x8ec0('0x1f')]===_0x8ec0('0x20')&&typeof _0x3ce85a['limit']===_0x8ec0('0x20');var _0x3dd2b6=_0xa6b060[_0x8ec0('0x21')];var _0x5ea429=_0x2c7fe1?0x0:_0x3ce85a[_0x8ec0('0x1f')];var _0x5b773e=_0x2c7fe1?_0xa6b060[_0x8ec0('0x21')]:_0x3ce85a[_0x8ec0('0x1f')]+_0x3ce85a[_0x8ec0('0x22')];var _0x4ef55f;if(_0x5b773e>=_0x3dd2b6){_0x5b773e=_0x3dd2b6;_0x4ef55f=0xc8;}else{_0x4ef55f=0xce;}_0x48826f[_0x8ec0('0x1d')](_0x4ef55f);return _0x48826f['set'](_0x8ec0('0x23'),_0x5ea429+'-'+_0x5b773e+'/'+_0x3dd2b6)[_0x8ec0('0x1e')](_0xa6b060);}return null;};}function patchUpdates(_0x178fa4){return function(_0x17889e){try{jsonpatch[_0x8ec0('0x24')](_0x17889e,_0x178fa4,!![]);}catch(_0x10c85b){return BPromise[_0x8ec0('0x25')](_0x10c85b);}return _0x17889e[_0x8ec0('0x26')]();};}function saveUpdates(_0x1163ab,_0x4015ea){return function(_0x163a04){if(_0x163a04){return _0x163a04[_0x8ec0('0x27')](_0x1163ab)[_0x8ec0('0x28')](function(_0x136f59){return _0x136f59;});}return null;};}function removeEntity(_0x404cb7,_0x57dae0){return function(_0x4f5849){if(_0x4f5849){return _0x4f5849[_0x8ec0('0x29')]()['then'](function(){var _0xdc5546=_0x4f5849[_0x8ec0('0x2a')]({'plain':!![]});var _0x544f72=_0x8ec0('0x2b');return db[_0x8ec0('0x2c')]['destroy']({'where':{'type':_0x544f72,'resourceId':_0xdc5546['id']}})['then'](function(){return _0x4f5849;});})['then'](function(){_0x404cb7[_0x8ec0('0x1d')](0xcc)[_0x8ec0('0x2d')]();});}};}function handleEntityNotFound(_0x30140a,_0x462888){return function(_0x2eb5c7){if(!_0x2eb5c7){_0x30140a[_0x8ec0('0x1c')](0x194);}return _0x2eb5c7;};}function handleError(_0x15efc0,_0x208546){_0x208546=_0x208546||0x1f4;return function(_0x5f4ac4){logger[_0x8ec0('0x2e')](_0x5f4ac4[_0x8ec0('0x2f')]);if(_0x5f4ac4[_0x8ec0('0x30')]){delete _0x5f4ac4[_0x8ec0('0x30')];}_0x15efc0['status'](_0x208546)[_0x8ec0('0x31')](_0x5f4ac4);};}exports['index']=function(_0x3e33d9,_0x4eed65){var _0x23c72d={},_0x1be444={},_0x5498b0={'count':0x0,'rows':[]};var _0x23494b=_[_0x8ec0('0x32')](db[_0x8ec0('0x33')][_0x8ec0('0x34')],function(_0x131903){return{'name':_0x131903[_0x8ec0('0x35')],'type':_0x131903[_0x8ec0('0x36')][_0x8ec0('0x37')]};});_0x1be444[_0x8ec0('0x38')]=_[_0x8ec0('0x32')](_0x23494b,_0x8ec0('0x30'));_0x1be444[_0x8ec0('0x39')]=_['keys'](_0x3e33d9['query']);_0x1be444[_0x8ec0('0x3a')]=_[_0x8ec0('0x3b')](_0x1be444[_0x8ec0('0x38')],_0x1be444[_0x8ec0('0x39')]);_0x23c72d['attributes']=_[_0x8ec0('0x3b')](_0x1be444[_0x8ec0('0x38')],qs['fields'](_0x3e33d9['query'][_0x8ec0('0x3c')]));_0x23c72d[_0x8ec0('0x3d')]=_0x23c72d[_0x8ec0('0x3d')][_0x8ec0('0x3e')]?_0x23c72d[_0x8ec0('0x3d')]:_0x1be444[_0x8ec0('0x38')];if(!_0x3e33d9[_0x8ec0('0x39')][_0x8ec0('0x3f')](_0x8ec0('0x40'))){_0x23c72d[_0x8ec0('0x22')]=qs[_0x8ec0('0x22')](_0x3e33d9[_0x8ec0('0x39')][_0x8ec0('0x22')]);_0x23c72d[_0x8ec0('0x1f')]=qs[_0x8ec0('0x1f')](_0x3e33d9['query'][_0x8ec0('0x1f')]);}_0x23c72d[_0x8ec0('0x41')]=qs[_0x8ec0('0x42')](_0x3e33d9[_0x8ec0('0x39')]['sort']);_0x23c72d[_0x8ec0('0x43')]=qs['filters'](_[_0x8ec0('0x44')](_0x3e33d9[_0x8ec0('0x39')],_0x1be444['filters']),_0x23494b);if(_0x3e33d9[_0x8ec0('0x39')][_0x8ec0('0x45')]){_0x23c72d[_0x8ec0('0x43')]=_[_0x8ec0('0x46')](_0x23c72d['where'],{'$or':_[_0x8ec0('0x32')](_0x23494b,function(_0x2a565d){if(_0x2a565d[_0x8ec0('0x36')]!==_0x8ec0('0x47')){var _0x54fc5f={};_0x54fc5f[_0x2a565d[_0x8ec0('0x30')]]={'$like':'%'+_0x3e33d9['query'][_0x8ec0('0x45')]+'%'};return _0x54fc5f;}})});}_0x23c72d=_[_0x8ec0('0x46')]({},_0x23c72d,_0x3e33d9[_0x8ec0('0x48')]);var _0xb19e3={'where':_0x23c72d['where']};return db[_0x8ec0('0x33')][_0x8ec0('0x21')](_0xb19e3)[_0x8ec0('0x28')](function(_0x2964ff){_0x5498b0[_0x8ec0('0x21')]=_0x2964ff;if(_0x3e33d9[_0x8ec0('0x39')][_0x8ec0('0x49')]){_0x23c72d[_0x8ec0('0x4a')]=[{'all':!![]}];}return db[_0x8ec0('0x33')]['findAll'](_0x23c72d);})[_0x8ec0('0x28')](function(_0x14fe67){_0x5498b0[_0x8ec0('0x4b')]=_0x14fe67;return _0x5498b0;})['then'](respondWithFilteredResult(_0x4eed65,_0x23c72d))[_0x8ec0('0x4c')](handleError(_0x4eed65,null));};exports[_0x8ec0('0x4d')]=function(_0x351c2e,_0x4ee9b3){var _0x147287={'raw':![],'where':{'id':_0x351c2e[_0x8ec0('0x4e')]['id']}},_0x3bc5e5={};_0x3bc5e5[_0x8ec0('0x38')]=_[_0x8ec0('0x4f')](db[_0x8ec0('0x33')][_0x8ec0('0x34')]);_0x3bc5e5[_0x8ec0('0x39')]=_['keys'](_0x351c2e[_0x8ec0('0x39')]);_0x3bc5e5[_0x8ec0('0x3a')]=_[_0x8ec0('0x3b')](_0x3bc5e5[_0x8ec0('0x38')],_0x3bc5e5['query']);_0x147287[_0x8ec0('0x3d')]=_[_0x8ec0('0x3b')](_0x3bc5e5['model'],qs[_0x8ec0('0x3c')](_0x351c2e[_0x8ec0('0x39')][_0x8ec0('0x3c')]));_0x147287['attributes']=_0x147287['attributes'][_0x8ec0('0x3e')]?_0x147287[_0x8ec0('0x3d')]:_0x3bc5e5[_0x8ec0('0x38')];if(_0x351c2e[_0x8ec0('0x39')]['includeAll']){_0x147287[_0x8ec0('0x4a')]=[{'all':!![]}];}_0x147287=_['merge']({},_0x147287,_0x351c2e[_0x8ec0('0x48')]);return db['Schedule'][_0x8ec0('0x50')](_0x147287)[_0x8ec0('0x28')](handleEntityNotFound(_0x4ee9b3,null))[_0x8ec0('0x28')](respondWithResult(_0x4ee9b3,null))[_0x8ec0('0x4c')](handleError(_0x4ee9b3,null));};exports[_0x8ec0('0x51')]=function(_0x3b8bb1,_0x389454){return db[_0x8ec0('0x33')][_0x8ec0('0x51')](_0x3b8bb1[_0x8ec0('0x52')],{})['then'](function(_0x5cbf75){var _0x58172b=_0x3b8bb1['user'][_0x8ec0('0x2a')]({'plain':!![]});if(!_0x58172b)throw new Error(_0x8ec0('0x53'));if(_0x58172b[_0x8ec0('0x54')]==='user'){var _0x5e9209=_0x5cbf75[_0x8ec0('0x2a')]({'plain':!![]});var _0x16509b=_0x8ec0('0x2b');return db[_0x8ec0('0x55')][_0x8ec0('0x50')]({'where':{'name':_0x16509b,'userProfileId':_0x58172b['userProfileId']},'raw':!![]})['then'](function(_0x30e1ef){if(_0x30e1ef&&_0x30e1ef[_0x8ec0('0x56')]===0x0){return db['UserProfileResource'][_0x8ec0('0x51')]({'name':_0x5e9209[_0x8ec0('0x30')],'resourceId':_0x5e9209['id'],'type':_0x30e1ef['name'],'sectionId':_0x30e1ef['id']},{})[_0x8ec0('0x28')](function(){return _0x5cbf75;});}else{return _0x5cbf75;}})[_0x8ec0('0x4c')](function(_0x54bdd9){logger[_0x8ec0('0x2e')](_0x8ec0('0x57'),_0x54bdd9);throw _0x54bdd9;});}return _0x5cbf75;})[_0x8ec0('0x28')](respondWithResult(_0x389454,0xc9))[_0x8ec0('0x4c')](handleError(_0x389454,null));};exports[_0x8ec0('0x27')]=function(_0x2f5f0e,_0x1df798){if(_0x2f5f0e['body']['id']){delete _0x2f5f0e[_0x8ec0('0x52')]['id'];}return db[_0x8ec0('0x33')][_0x8ec0('0x50')]({'where':{'id':_0x2f5f0e['params']['id']}})[_0x8ec0('0x28')](handleEntityNotFound(_0x1df798,null))['then'](saveUpdates(_0x2f5f0e[_0x8ec0('0x52')],null))[_0x8ec0('0x28')](respondWithResult(_0x1df798,null))['catch'](handleError(_0x1df798,null));};exports['destroy']=function(_0x884adf,_0x1a3b49){return db[_0x8ec0('0x33')][_0x8ec0('0x50')]({'where':{'id':_0x884adf[_0x8ec0('0x4e')]['id']}})[_0x8ec0('0x28')](handleEntityNotFound(_0x1a3b49,null))[_0x8ec0('0x28')](removeEntity(_0x1a3b49,null))[_0x8ec0('0x4c')](handleError(_0x1a3b49,null));};exports[_0x8ec0('0x58')]=function(_0x4b5f36,_0x3ddca3,_0x1192f8){var _0x5a7bf4=require('../../config/schedule');return db[_0x8ec0('0x33')]['find']({'where':{'id':_0x4b5f36['params']['id']},'raw':!![]})[_0x8ec0('0x28')](handleEntityNotFound(_0x3ddca3,null))[_0x8ec0('0x28')](function(){_0x5a7bf4[_0x8ec0('0x58')](_0x4b5f36['params']['id']);})[_0x8ec0('0x28')](respondWithStatusCode(_0x3ddca3,null))[_0x8ec0('0x4c')](handleError(_0x3ddca3,null));}; \ No newline at end of file +var _0x7db4=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','update','then','get','Scheduler','UserProfileResource','destroy','stack','name','send','index','map','Schedule','rawAttributes','fieldName','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','findAll','rows','show','params','fields','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs'];(function(_0x4072c8,_0x2e02a2){var _0x31a18a=function(_0x5762f2){while(--_0x5762f2){_0x4072c8['push'](_0x4072c8['shift']());}};_0x31a18a(++_0x2e02a2);}(_0x7db4,0x18c));var _0x47db=function(_0x4c2537,_0x20afdf){_0x4c2537=_0x4c2537-0x0;var _0x94fb5c=_0x7db4[_0x4c2537];return _0x94fb5c;};'use strict';var emlformat=require(_0x47db('0x0'));var rimraf=require(_0x47db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47db('0x2'));var rp=require(_0x47db('0x3'));var moment=require(_0x47db('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x47db('0x5'));var path=require(_0x47db('0x6'));var sox=require('sox');var csv=require(_0x47db('0x7'));var ejs=require(_0x47db('0x8'));var fs=require('fs');var fs_extra=require(_0x47db('0x9'));var _=require(_0x47db('0xa'));var squel=require(_0x47db('0xb'));var crypto=require(_0x47db('0xc'));var jsforce=require(_0x47db('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x47db('0x7'));var querystring=require(_0x47db('0xe'));var Papa=require(_0x47db('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x47db('0x10'));var as=require(_0x47db('0x11'));var hardwareService=require(_0x47db('0x12'));var logger=require(_0x47db('0x13'))(_0x47db('0x14'));var utils=require(_0x47db('0x15'));var config=require(_0x47db('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x47db('0x17'))['db'];function respondWithStatusCode(_0x83541f,_0x7c2d30){_0x7c2d30=_0x7c2d30||0xcc;return function(_0x4befe2){if(_0x4befe2){return _0x83541f[_0x47db('0x18')](_0x7c2d30);}return _0x83541f[_0x47db('0x19')](_0x7c2d30)[_0x47db('0x1a')]();};}function respondWithResult(_0x4799db,_0x4289fd){_0x4289fd=_0x4289fd||0xc8;return function(_0x54e161){if(_0x54e161){return _0x4799db['status'](_0x4289fd)['json'](_0x54e161);}};}function respondWithFilteredResult(_0x1d3b55,_0x1f4b82){return function(_0x4e9cef){if(_0x4e9cef){var _0x4f9b14=typeof _0x1f4b82[_0x47db('0x1b')]==='undefined'&&typeof _0x1f4b82[_0x47db('0x1c')]===_0x47db('0x1d');var _0x2a68e5=_0x4e9cef[_0x47db('0x1e')];var _0x2a351b=_0x4f9b14?0x0:_0x1f4b82['offset'];var _0x3276b7=_0x4f9b14?_0x4e9cef[_0x47db('0x1e')]:_0x1f4b82[_0x47db('0x1b')]+_0x1f4b82['limit'];var _0x34ec36;if(_0x3276b7>=_0x2a68e5){_0x3276b7=_0x2a68e5;_0x34ec36=0xc8;}else{_0x34ec36=0xce;}_0x1d3b55['status'](_0x34ec36);return _0x1d3b55[_0x47db('0x1f')]('Content-Range',_0x2a351b+'-'+_0x3276b7+'/'+_0x2a68e5)['json'](_0x4e9cef);}return null;};}function patchUpdates(_0x4bb768){return function(_0x315ca2){try{jsonpatch[_0x47db('0x20')](_0x315ca2,_0x4bb768,!![]);}catch(_0x4d66a5){return BPromise[_0x47db('0x21')](_0x4d66a5);}return _0x315ca2['save']();};}function saveUpdates(_0x425245,_0x144fbf){return function(_0x181303){if(_0x181303){return _0x181303[_0x47db('0x22')](_0x425245)[_0x47db('0x23')](function(_0x4b678f){return _0x4b678f;});}return null;};}function removeEntity(_0x42ce43,_0x29ea13){return function(_0x2b6658){if(_0x2b6658){return _0x2b6658['destroy']()[_0x47db('0x23')](function(){var _0x26c528=_0x2b6658[_0x47db('0x24')]({'plain':!![]});var _0x33bb9c=_0x47db('0x25');return db[_0x47db('0x26')][_0x47db('0x27')]({'where':{'type':_0x33bb9c,'resourceId':_0x26c528['id']}})[_0x47db('0x23')](function(){return _0x2b6658;});})['then'](function(){_0x42ce43[_0x47db('0x19')](0xcc)[_0x47db('0x1a')]();});}};}function handleEntityNotFound(_0x2ae70b,_0x2e98c4){return function(_0x1990df){if(!_0x1990df){_0x2ae70b['sendStatus'](0x194);}return _0x1990df;};}function handleError(_0x3a96d5,_0x1116e6){_0x1116e6=_0x1116e6||0x1f4;return function(_0x57c9c5){logger['error'](_0x57c9c5[_0x47db('0x28')]);if(_0x57c9c5[_0x47db('0x29')]){delete _0x57c9c5[_0x47db('0x29')];}_0x3a96d5[_0x47db('0x19')](_0x1116e6)[_0x47db('0x2a')](_0x57c9c5);};}exports[_0x47db('0x2b')]=function(_0x26f8a2,_0x283b82){var _0x5bc92f={},_0x1d2d41={},_0x2eb0a0={'count':0x0,'rows':[]};var _0x31c694=_[_0x47db('0x2c')](db[_0x47db('0x2d')][_0x47db('0x2e')],function(_0x535888){return{'name':_0x535888[_0x47db('0x2f')],'type':_0x535888['type']['key']};});_0x1d2d41['model']=_[_0x47db('0x2c')](_0x31c694,'name');_0x1d2d41['query']=_[_0x47db('0x30')](_0x26f8a2['query']);_0x1d2d41[_0x47db('0x31')]=_[_0x47db('0x32')](_0x1d2d41[_0x47db('0x33')],_0x1d2d41[_0x47db('0x34')]);_0x5bc92f[_0x47db('0x35')]=_[_0x47db('0x32')](_0x1d2d41['model'],qs['fields'](_0x26f8a2['query']['fields']));_0x5bc92f['attributes']=_0x5bc92f['attributes'][_0x47db('0x36')]?_0x5bc92f[_0x47db('0x35')]:_0x1d2d41['model'];if(!_0x26f8a2[_0x47db('0x34')][_0x47db('0x37')](_0x47db('0x38'))){_0x5bc92f[_0x47db('0x1c')]=qs['limit'](_0x26f8a2['query'][_0x47db('0x1c')]);_0x5bc92f[_0x47db('0x1b')]=qs['offset'](_0x26f8a2[_0x47db('0x34')][_0x47db('0x1b')]);}_0x5bc92f[_0x47db('0x39')]=qs[_0x47db('0x3a')](_0x26f8a2[_0x47db('0x34')]['sort']);_0x5bc92f[_0x47db('0x3b')]=qs[_0x47db('0x31')](_[_0x47db('0x3c')](_0x26f8a2[_0x47db('0x34')],_0x1d2d41['filters']),_0x31c694);if(_0x26f8a2[_0x47db('0x34')]['filter']){_0x5bc92f['where']=_[_0x47db('0x3d')](_0x5bc92f['where'],{'$or':_[_0x47db('0x2c')](_0x31c694,function(_0x19a965){if(_0x19a965['type']!==_0x47db('0x3e')){var _0xd30710={};_0xd30710[_0x19a965['name']]={'$like':'%'+_0x26f8a2[_0x47db('0x34')]['filter']+'%'};return _0xd30710;}})});}_0x5bc92f=_[_0x47db('0x3d')]({},_0x5bc92f,_0x26f8a2[_0x47db('0x3f')]);var _0x445108={'where':_0x5bc92f[_0x47db('0x3b')]};return db[_0x47db('0x2d')][_0x47db('0x1e')](_0x445108)[_0x47db('0x23')](function(_0x3aa1ac){_0x2eb0a0[_0x47db('0x1e')]=_0x3aa1ac;if(_0x26f8a2['query']['includeAll']){_0x5bc92f['include']=[{'all':!![]}];}return db[_0x47db('0x2d')][_0x47db('0x40')](_0x5bc92f);})[_0x47db('0x23')](function(_0x238404){_0x2eb0a0[_0x47db('0x41')]=_0x238404;return _0x2eb0a0;})[_0x47db('0x23')](respondWithFilteredResult(_0x283b82,_0x5bc92f))['catch'](handleError(_0x283b82,null));};exports[_0x47db('0x42')]=function(_0x1e1e63,_0x1cfc0a){var _0x34ccdc={'raw':![],'where':{'id':_0x1e1e63[_0x47db('0x43')]['id']}},_0x12b025={};_0x12b025[_0x47db('0x33')]=_['keys'](db[_0x47db('0x2d')][_0x47db('0x2e')]);_0x12b025[_0x47db('0x34')]=_[_0x47db('0x30')](_0x1e1e63[_0x47db('0x34')]);_0x12b025['filters']=_[_0x47db('0x32')](_0x12b025[_0x47db('0x33')],_0x12b025[_0x47db('0x34')]);_0x34ccdc[_0x47db('0x35')]=_[_0x47db('0x32')](_0x12b025[_0x47db('0x33')],qs[_0x47db('0x44')](_0x1e1e63['query']['fields']));_0x34ccdc[_0x47db('0x35')]=_0x34ccdc['attributes'][_0x47db('0x36')]?_0x34ccdc[_0x47db('0x35')]:_0x12b025['model'];if(_0x1e1e63[_0x47db('0x34')][_0x47db('0x45')]){_0x34ccdc['include']=[{'all':!![]}];}_0x34ccdc=_[_0x47db('0x3d')]({},_0x34ccdc,_0x1e1e63[_0x47db('0x3f')]);return db['Schedule'][_0x47db('0x46')](_0x34ccdc)['then'](handleEntityNotFound(_0x1cfc0a,null))[_0x47db('0x23')](respondWithResult(_0x1cfc0a,null))['catch'](handleError(_0x1cfc0a,null));};exports['create']=function(_0x896b58,_0x518ca6){return db[_0x47db('0x2d')][_0x47db('0x47')](_0x896b58[_0x47db('0x48')],{})['then'](function(_0x5b1744){var _0x53dcd5=_0x896b58[_0x47db('0x49')][_0x47db('0x24')]({'plain':!![]});if(!_0x53dcd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53dcd5[_0x47db('0x4a')]===_0x47db('0x49')){var _0x1ea230=_0x5b1744[_0x47db('0x24')]({'plain':!![]});var _0x49ece2=_0x47db('0x25');return db[_0x47db('0x4b')]['find']({'where':{'name':_0x49ece2,'userProfileId':_0x53dcd5[_0x47db('0x4c')]},'raw':!![]})[_0x47db('0x23')](function(_0x2951cc){if(_0x2951cc&&_0x2951cc['autoAssociation']===0x0){return db[_0x47db('0x26')][_0x47db('0x47')]({'name':_0x1ea230[_0x47db('0x29')],'resourceId':_0x1ea230['id'],'type':_0x2951cc['name'],'sectionId':_0x2951cc['id']},{})[_0x47db('0x23')](function(){return _0x5b1744;});}else{return _0x5b1744;}})['catch'](function(_0x4ccfb0){logger['error'](_0x47db('0x4d'),_0x4ccfb0);throw _0x4ccfb0;});}return _0x5b1744;})[_0x47db('0x23')](respondWithResult(_0x518ca6,0xc9))['catch'](handleError(_0x518ca6,null));};exports[_0x47db('0x22')]=function(_0x1ac175,_0x1e0233){if(_0x1ac175[_0x47db('0x48')]['id']){delete _0x1ac175[_0x47db('0x48')]['id'];}return db[_0x47db('0x2d')][_0x47db('0x46')]({'where':{'id':_0x1ac175['params']['id']}})[_0x47db('0x23')](handleEntityNotFound(_0x1e0233,null))[_0x47db('0x23')](saveUpdates(_0x1ac175[_0x47db('0x48')],null))['then'](respondWithResult(_0x1e0233,null))['catch'](handleError(_0x1e0233,null));};exports[_0x47db('0x27')]=function(_0x22d27c,_0x10af9b){return db[_0x47db('0x2d')][_0x47db('0x46')]({'where':{'id':_0x22d27c[_0x47db('0x43')]['id']}})[_0x47db('0x23')](handleEntityNotFound(_0x10af9b,null))[_0x47db('0x23')](removeEntity(_0x10af9b,null))[_0x47db('0x4e')](handleError(_0x10af9b,null));};exports[_0x47db('0x4f')]=function(_0x2b2d36,_0x49ea21,_0x58e1b9){var _0x59d8a4=require(_0x47db('0x50'));return db[_0x47db('0x2d')][_0x47db('0x46')]({'where':{'id':_0x2b2d36[_0x47db('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x49ea21,null))[_0x47db('0x23')](function(){_0x59d8a4['run'](_0x2b2d36[_0x47db('0x43')]['id']);})['then'](respondWithStatusCode(_0x49ea21,null))['catch'](handleError(_0x49ea21,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1d65be9..e65c1c4 100644 --- a/server/api/schedule/schedule.model.js +++ b/server/api/schedule/schedule.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24b3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x24b3,0x1c8));var _0x324b=function(_0xce6727,_0x26bc76){_0xce6727=_0xce6727-0x0;var _0x446350=_0x24b3[_0xce6727];return _0x446350;};'use strict';var _=require(_0x324b('0x0'));var util=require(_0x324b('0x1'));var logger=require(_0x324b('0x2'))(_0x324b('0x3'));var moment=require(_0x324b('0x4'));var BPromise=require(_0x324b('0x5'));var rp=require(_0x324b('0x6'));var fs=require('fs');var path=require(_0x324b('0x7'));var rimraf=require(_0x324b('0x8'));var config=require(_0x324b('0x9'));var attributes=require(_0x324b('0xa'));module['exports']=function(_0x30963d,_0x25b5f){return _0x30963d[_0x324b('0xb')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8b0=['./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x21efa4,_0x5280cf){var _0x3c6e3b=function(_0x1d1d8f){while(--_0x1d1d8f){_0x21efa4['push'](_0x21efa4['shift']());}};_0x3c6e3b(++_0x5280cf);}(_0xc8b0,0x17b));var _0x0c8b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc8b0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0c8b('0x0'));var util=require('util');var logger=require(_0x0c8b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0c8b('0x2'));var fs=require('fs');var path=require(_0x0c8b('0x3'));var rimraf=require(_0x0c8b('0x4'));var config=require(_0x0c8b('0x5'));var attributes=require(_0x0c8b('0x6'));module[_0x0c8b('0x7')]=function(_0x55aa65,_0x4a78d7){return _0x55aa65[_0x0c8b('0x8')](_0x0c8b('0x9'),attributes,{'tableName':_0x0c8b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b1f6752..5a628a2 100644 --- a/server/api/schedule/schedule.rpc.js +++ b/server/api/schedule/schedule.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2e7=['rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1dd45b,_0xf8ee04){var _0x6a5b0a=function(_0x1f7809){while(--_0x1f7809){_0x1dd45b['push'](_0x1dd45b['shift']());}};_0x6a5b0a(++_0xf8ee04);}(_0xc2e7,0x188));var _0x7c2e=function(_0xd53286,_0x2fe866){_0xd53286=_0xd53286-0x0;var _0x45fbd5=_0xc2e7[_0xd53286];return _0x45fbd5;};'use strict';var _=require(_0x7c2e('0x0'));var util=require(_0x7c2e('0x1'));var moment=require(_0x7c2e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c2e('0x3'));var db=require(_0x7c2e('0x4'))['db'];var utils=require(_0x7c2e('0x5'));var logger=require(_0x7c2e('0x6'))(_0x7c2e('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c2e('0x8'));var client=jayson[_0x7c2e('0x9')][_0x7c2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b60a9,_0x28a478,_0x2e62f3){return new BPromise(function(_0xc82229,_0x5691b8){return client[_0x7c2e('0xb')](_0x5b60a9,_0x2e62f3)[_0x7c2e('0xc')](function(_0x5abc63){logger[_0x7c2e('0xd')](_0x7c2e('0xe'),_0x28a478,_0x7c2e('0xf'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x28a478,'request\x20sent',JSON[_0x7c2e('0x10')](_0x5abc63));if(_0x5abc63[_0x7c2e('0x11')]){if(_0x5abc63[_0x7c2e('0x11')][_0x7c2e('0x12')]===0x1f4){logger[_0x7c2e('0x11')]('Schedule,\x20%s,\x20%s',_0x28a478,_0x5abc63['error'][_0x7c2e('0x13')]);return _0x5691b8(_0x5abc63['error'][_0x7c2e('0x13')]);}logger[_0x7c2e('0x11')](_0x7c2e('0xe'),_0x28a478,_0x5abc63['error'][_0x7c2e('0x13')]);return _0xc82229(_0x5abc63[_0x7c2e('0x11')][_0x7c2e('0x13')]);}else{logger['info'](_0x7c2e('0xe'),_0x28a478,_0x7c2e('0xf'));_0xc82229(_0x5abc63[_0x7c2e('0x14')][_0x7c2e('0x13')]);}})['catch'](function(_0x3e003a){logger[_0x7c2e('0x11')]('Schedule,\x20%s,\x20%s',_0x28a478,_0x3e003a);_0x5691b8(_0x3e003a);});});} \ No newline at end of file +var _0x2a2e=['Schedule,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14d90b,_0x349393){var _0x563c9f=function(_0x309b34){while(--_0x309b34){_0x14d90b['push'](_0x14d90b['shift']());}};_0x563c9f(++_0x349393);}(_0x2a2e,0xeb));var _0xe2a2=function(_0x1d848e,_0x3cb976){_0x1d848e=_0x1d848e-0x0;var _0x3b7ceb=_0x2a2e[_0x1d848e];return _0x3b7ceb;};'use strict';var _=require(_0xe2a2('0x0'));var util=require('util');var moment=require(_0xe2a2('0x1'));var BPromise=require(_0xe2a2('0x2'));var rs=require(_0xe2a2('0x3'));var fs=require('fs');var Redis=require(_0xe2a2('0x4'));var db=require(_0xe2a2('0x5'))['db'];var utils=require(_0xe2a2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe2a2('0x7'));var jayson=require(_0xe2a2('0x8'));var client=jayson[_0xe2a2('0x9')][_0xe2a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4784,_0x438108,_0x4a5254){return new BPromise(function(_0x38f4ad,_0x48f80){return client['request'](_0x4c4784,_0x4a5254)[_0xe2a2('0xb')](function(_0x557cac){logger[_0xe2a2('0xc')]('Schedule,\x20%s,\x20%s',_0x438108,'request\x20sent');logger[_0xe2a2('0xd')](_0xe2a2('0xe'),_0x438108,'request\x20sent',JSON[_0xe2a2('0xf')](_0x557cac));if(_0x557cac[_0xe2a2('0x10')]){if(_0x557cac[_0xe2a2('0x10')][_0xe2a2('0x11')]===0x1f4){logger[_0xe2a2('0x10')](_0xe2a2('0x12'),_0x438108,_0x557cac[_0xe2a2('0x10')][_0xe2a2('0x13')]);return _0x48f80(_0x557cac[_0xe2a2('0x10')][_0xe2a2('0x13')]);}logger[_0xe2a2('0x10')](_0xe2a2('0x12'),_0x438108,_0x557cac[_0xe2a2('0x10')][_0xe2a2('0x13')]);return _0x38f4ad(_0x557cac[_0xe2a2('0x10')][_0xe2a2('0x13')]);}else{logger[_0xe2a2('0xc')]('Schedule,\x20%s,\x20%s',_0x438108,_0xe2a2('0x14'));_0x38f4ad(_0x557cac[_0xe2a2('0x15')][_0xe2a2('0x13')]);}})[_0xe2a2('0x16')](function(_0x3c8fee){logger[_0xe2a2('0x10')](_0xe2a2('0x12'),_0x438108,_0x3c8fee);_0x48f80(_0x3c8fee);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 9f0bd37..7607245 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc076=['index','get','isAuthenticated','/:id','show','post','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x1529fe,_0x1c27bf){var _0x4495d8=function(_0x3aa96a){while(--_0x3aa96a){_0x1529fe['push'](_0x1529fe['shift']());}};_0x4495d8(++_0x1c27bf);}(_0xc076,0xab));var _0x6c07=function(_0x5da36f,_0x3654d2){_0x5da36f=_0x5da36f-0x0;var _0x281616=_0xc076[_0x5da36f];return _0x281616;};'use strict';var multer=require(_0x6c07('0x0'));var util=require('util');var path=require(_0x6c07('0x1'));var timeout=require(_0x6c07('0x2'));var express=require('express');var router=express[_0x6c07('0x3')]();var fs_extra=require(_0x6c07('0x4'));var auth=require(_0x6c07('0x5'));var interaction=require(_0x6c07('0x6'));var config=require(_0x6c07('0x7'));var controller=require(_0x6c07('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6c07('0x9')]);router[_0x6c07('0xa')]('/describe',auth[_0x6c07('0xb')](),controller['describe']);router['get'](_0x6c07('0xc'),auth['isAuthenticated'](),controller[_0x6c07('0xd')]);router['get']('/:id/download',auth[_0x6c07('0xb')](),controller['download']);router[_0x6c07('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6c07('0xc'),auth[_0x6c07('0xb')](),controller[_0x6c07('0xf')]);router[_0x6c07('0x10')](_0x6c07('0xc'),auth[_0x6c07('0xb')](),controller[_0x6c07('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3ffd=['index','get','/:id','show','download','create','put','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x3ffd,0xb4));var _0xd3ff=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x3ffd[_0x1044e5];return _0x5ad0dd;};'use strict';var multer=require(_0xd3ff('0x0'));var util=require(_0xd3ff('0x1'));var path=require(_0xd3ff('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd3ff('0x3'));var interaction=require(_0xd3ff('0x4'));var config=require(_0xd3ff('0x5'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xd3ff('0x6')](),controller[_0xd3ff('0x7')]);router[_0xd3ff('0x8')]('/describe',auth[_0xd3ff('0x6')](),controller['describe']);router[_0xd3ff('0x8')](_0xd3ff('0x9'),auth['isAuthenticated'](),controller[_0xd3ff('0xa')]);router['get']('/:id/download',auth[_0xd3ff('0x6')](),controller[_0xd3ff('0xb')]);router['post']('/',auth[_0xd3ff('0x6')](),controller[_0xd3ff('0xc')]);router[_0xd3ff('0xd')](_0xd3ff('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xd3ff('0xe')](_0xd3ff('0x9'),auth[_0xd3ff('0x6')](),controller[_0xd3ff('0xf')]);module[_0xd3ff('0x10')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 791ecd8..f561a9f 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5360=['closedAt','createdAt','updatedAt','sequelize','moment','path','../../config/environment','getDataValue','extname','STRING','replace','value','INTEGER','setDataValue','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x2f2470,_0x510c7b){var _0x5b05cc=function(_0x5c10ef){while(--_0x5c10ef){_0x2f2470['push'](_0x2f2470['shift']());}};_0x5b05cc(++_0x510c7b);}(_0x5360,0x157));var _0x0536=function(_0x3e58d4,_0x3fe994){_0x3e58d4=_0x3e58d4-0x0;var _0x5992d6=_0x5360[_0x3e58d4];return _0x5992d6;};'use strict';var Sequelize=require(_0x0536('0x0'));var moment=require(_0x0536('0x1'));var path=require(_0x0536('0x2'));var config=require(_0x0536('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0536('0x4')]('value')?path[_0x0536('0x5')](this[_0x0536('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x0536('0x6')],'set':function(_0x19c89e){var _0x1122a2=_0x19c89e[_0x0536('0x7')](/\\/g,'/');this['setDataValue'](_0x0536('0x8'),_0x1122a2);}},'rating':{'type':Sequelize[_0x0536('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0536('0x9')],'set':function(_0x5b78e2){this[_0x0536('0xa')]('startedAt',moment()['subtract'](_0x5b78e2,'ms'));this['setDataValue']('closedAt',moment());this[_0x0536('0xa')](_0x0536('0xb'),_0x5b78e2);}},'startedAt':{'type':Sequelize[_0x0536('0xc')],'get':function(){return moment(this[_0x0536('0x4')](_0x0536('0xd')))[_0x0536('0xe')](_0x0536('0xf'))[_0x0536('0x10')]();}},'closedAt':{'type':Sequelize[_0x0536('0xc')],'get':function(){return moment(this[_0x0536('0x4')](_0x0536('0x11')))[_0x0536('0xe')](_0x0536('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x0536('0xc')],'get':function(){return moment(this[_0x0536('0x4')](_0x0536('0x12')))[_0x0536('0xe')](_0x0536('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0536('0xc')],'get':function(){return moment(this[_0x0536('0x4')](_0x0536('0x13')))[_0x0536('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x19e1=['STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','getDataValue','value'];(function(_0xdad6da,_0x5d52c3){var _0x25968e=function(_0x2444dd){while(--_0x2444dd){_0xdad6da['push'](_0xdad6da['shift']());}};_0x25968e(++_0x5d52c3);}(_0x19e1,0x163));var _0x119e=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0x19e1[_0x3522c8];return _0x22f498;};'use strict';var Sequelize=require(_0x119e('0x0'));var moment=require(_0x119e('0x1'));var path=require(_0x119e('0x2'));var config=require(_0x119e('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x119e('0x4')](_0x119e('0x5'))?path['extname'](this[_0x119e('0x4')](_0x119e('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x119e('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x1b5306){var _0x25e166=_0x1b5306[_0x119e('0x7')](/\\/g,'/');this[_0x119e('0x8')]('value',_0x25e166);}},'rating':{'type':Sequelize[_0x119e('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x119e('0x9')],'set':function(_0x1a6747){this['setDataValue']('startedAt',moment()[_0x119e('0xa')](_0x1a6747,'ms'));this[_0x119e('0x8')](_0x119e('0xb'),moment());this[_0x119e('0x8')](_0x119e('0xc'),_0x1a6747);}},'startedAt':{'type':Sequelize[_0x119e('0xd')],'get':function(){return moment(this[_0x119e('0x4')]('startedAt'))[_0x119e('0xe')](_0x119e('0xf'))[_0x119e('0x10')]();}},'closedAt':{'type':Sequelize[_0x119e('0xd')],'get':function(){return moment(this[_0x119e('0x4')](_0x119e('0xb')))['format'](_0x119e('0xf'))[_0x119e('0x10')]();}},'createdAt':{'type':Sequelize[_0x119e('0xd')],'get':function(){return moment(this[_0x119e('0x4')](_0x119e('0x11')))[_0x119e('0xe')](_0x119e('0xf'))[_0x119e('0x10')]();}},'updatedAt':{'type':Sequelize[_0x119e('0xd')],'get':function(){return moment(this[_0x119e('0x4')](_0x119e('0x12')))['format'](_0x119e('0xf'))[_0x119e('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9372b1c..0484d89 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x202e86,_0x5d695e){var _0x4c05ad=function(_0x3c62cf){while(--_0x3c62cf){_0x202e86['push'](_0x202e86['shift']());}};_0x4c05ad(++_0x5d695e);}(_0xe14b,0x93));var _0xbe14=function(_0x1cf811,_0x5e7e38){_0x1cf811=_0x1cf811-0x0;var _0x2f9868=_0xe14b[_0x1cf811];return _0x2f9868;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file +var _0x2eb2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf'];(function(_0x3554bb,_0x3dd729){var _0x391784=function(_0x1662ea){while(--_0x1662ea){_0x3554bb['push'](_0x3554bb['shift']());}};_0x391784(++_0x3dd729);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2eb2[_0x4ae625];return _0x31accf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x2c')](_['map'](_0x1599c7,_0x22eb('0x24')),[_0x22eb('0x2d')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x49dd59[_0x22eb('0x2e')]);_0x44cf91[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x44cf91[_0x22eb('0x32')],_0x44cf91[_0x22eb('0x2e')]);_0x25e5bc[_0x22eb('0x33')]=_['intersection'](_0x44cf91['model'],qs[_0x22eb('0x34')](_0x49dd59['query']['fields']));_0x25e5bc[_0x22eb('0x33')]=_0x25e5bc[_0x22eb('0x33')][_0x22eb('0x35')]?_0x25e5bc[_0x22eb('0x33')]:_0x44cf91[_0x22eb('0x32')];if(!_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x36')](_0x22eb('0x37'))){_0x25e5bc[_0x22eb('0x38')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc['offset']=qs['offset'](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x19')]);}_0x25e5bc['order']=qs[_0x22eb('0x39')](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x39')]);_0x25e5bc[_0x22eb('0x3a')]=qs[_0x22eb('0x30')](_['pick'](_0x49dd59[_0x22eb('0x2e')],_0x44cf91[_0x22eb('0x30')]),_0x1599c7);if(_0x49dd59['query'][_0x22eb('0x3b')]){_0x25e5bc[_0x22eb('0x3a')]=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x3a')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x5382eb){if(_0x5382eb['type']!==_0x22eb('0x3d')){var _0x6cd651={};_0x6cd651[_0x5382eb['name']]={'$like':'%'+_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3b')]+'%'};return _0x6cd651;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59['options']);var _0x1d977c={'where':_0x25e5bc[_0x22eb('0x3a')]};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x1d977c)[_0x22eb('0x20')](function(_0x39778e){_0x7c0119['count']=_0x39778e;if(_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x25e5bc['include']=[{'all':!![]}];}return db[_0x22eb('0x27')][_0x22eb('0x3f')](_0x25e5bc);})[_0x22eb('0x20')](function(_0x30cb10){_0x7c0119[_0x22eb('0x40')]=_0x30cb10;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x41')](handleError(_0x2a950e,null));};exports[_0x22eb('0x42')]=function(_0x1bafa3,_0x82ace8){var _0x3e1826={'raw':![],'where':{'id':_0x1bafa3[_0x22eb('0x43')]['id']}},_0x1cf1e0={};_0x1cf1e0[_0x22eb('0x32')]=_[_0x22eb('0x2f')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x1cf1e0[_0x22eb('0x2e')]=_['keys'](_0x1bafa3[_0x22eb('0x2e')]);_0x1cf1e0[_0x22eb('0x30')]=_['intersection'](_0x1cf1e0[_0x22eb('0x32')],_0x1cf1e0[_0x22eb('0x2e')]);_0x3e1826['attributes']=_['intersection'](_0x1cf1e0['model'],qs[_0x22eb('0x34')](_0x1bafa3[_0x22eb('0x2e')]['fields']));_0x3e1826['attributes']=_0x3e1826[_0x22eb('0x33')][_0x22eb('0x35')]?_0x3e1826[_0x22eb('0x33')]:_0x1cf1e0[_0x22eb('0x32')];if(_0x1bafa3[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x3e1826[_0x22eb('0x44')]=[{'all':!![]}];}_0x3e1826=_[_0x22eb('0x3c')]({},_0x3e1826,_0x1bafa3['options']);return db['ScreenRecording'][_0x22eb('0x45')](_0x3e1826)['then'](handleEntityNotFound(_0x82ace8,null))[_0x22eb('0x20')](respondWithResult(_0x82ace8,null))['catch'](handleError(_0x82ace8,null));};exports[_0x22eb('0x46')]=function(_0x5c41c0,_0x4b2f86){return db['ScreenRecording']['create'](_0x5c41c0[_0x22eb('0x47')],{})['then'](respondWithResult(_0x4b2f86,0xc9))[_0x22eb('0x41')](handleError(_0x4b2f86,null));};exports[_0x22eb('0x1f')]=function(_0x490bef,_0x24e6ba){if(_0x490bef['body']['id']){delete _0x490bef[_0x22eb('0x47')]['id'];}delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x48')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x49')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4a')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4b')];return db['ScreenRecording'][_0x22eb('0x45')]({'where':{'id':_0x490bef[_0x22eb('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e6ba,null))[_0x22eb('0x20')](saveUpdates(_0x490bef[_0x22eb('0x47')],null))[_0x22eb('0x20')](respondWithResult(_0x24e6ba,null))[_0x22eb('0x41')](handleError(_0x24e6ba,null));};exports['describe']=function(_0x6c0600,_0x169ae1){return db[_0x22eb('0x27')][_0x22eb('0x4c')]()[_0x22eb('0x20')](respondWithResult(_0x169ae1,null))[_0x22eb('0x41')](handleError(_0x169ae1,null));};exports['download']=function(_0x29d7ca,_0x4e5b9f,_0x3ff406){var _0x5eecef=require(_0x22eb('0x4d'));var _0x254b53=![];var _0x4028ef={};if(_0x29d7ca[_0x22eb('0x2e')][_0x22eb('0x2a')]&&_0x29d7ca['query']['type']===_0x22eb('0x4e')){_0x4028ef[_0x22eb('0x4e')]=_0x29d7ca['params']['id'];}else{_0x4028ef['id']=_0x29d7ca[_0x22eb('0x43')]['id'];}return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':_0x4028ef,'attributes':['id',_0x22eb('0x4b')],'raw':!![]})[_0x22eb('0x20')](handleEntityNotFound(_0x4e5b9f,null))[_0x22eb('0x20')](function(_0x3a8588){if(_0x3a8588){var _0x35c997=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x3a8588['value']);var _0x19cadf=util[_0x22eb('0x2d')](_0x22eb('0x52'),_0x35c997);if(fs[_0x22eb('0x53')](_0x19cadf)){_0x254b53=!![];return _0x5eecef[_0x22eb('0x54')](_0x19cadf,_0x35c997,config[_0x22eb('0x55')][_0x22eb('0x56')])[_0x22eb('0x20')](function(){return _0x3a8588;});}return _0x3a8588;}})[_0x22eb('0x20')](function(_0x9f8465){if(_0x9f8465){var _0x3e9ab5=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x9f8465['value']);if(!fs['existsSync'](_0x3e9ab5)){throw new db[(_0x22eb('0x57'))][(_0x22eb('0x58'))](_0x22eb('0x59'));}if(_0x9f8465[_0x22eb('0x5a')]){return _0x4e5b9f[_0x22eb('0x5b')](_0x3e9ab5,_0x9f8465['filename']+path[_0x22eb('0x5c')](_0x3e9ab5),function(){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}else{return _0x4e5b9f['download'](_0x3e9ab5,function(_0x485408){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}}})[_0x22eb('0x41')](function(_0xb5c8ae){if(_0xb5c8ae[_0x22eb('0x5e')]===_0x22eb('0x59')){_0x4e5b9f[_0x22eb('0x17')](0x194)[_0x22eb('0x25')](_0x22eb('0x5f'));}else{return handleError(_0x4e5b9f,null);}});};exports[_0x22eb('0x21')]=function(_0x19b579,_0x164645){return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':{'id':_0x19b579[_0x22eb('0x43')]['id']}})['then'](function(_0x29dd8b){if(_[_0x22eb('0x60')](_0x29dd8b)){throw new ReferenceError(_0x22eb('0x61'));}return _0x29dd8b;})['then'](function(_0x1787ec){var _0x5ac4c5=path[_0x22eb('0x4f')](config['root'],_0x22eb('0x51'),_0x1787ec[_0x22eb('0x4b')]);logger['info'](_0x22eb('0x62'),_0x5ac4c5);if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs['existsSync'](_0x5ac4c5)){logger[_0x22eb('0x63')](_0x22eb('0x64')+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}_0x5ac4c5=_0x5ac4c5+_0x22eb('0x67');if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs[_0x22eb('0x53')](_0x5ac4c5)){logger['info']('File:\x20\x22'+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}return _0x1787ec;})[_0x22eb('0x20')](function(_0x22b5c6){if(!_0x22b5c6)throw new InternalError();return _0x22b5c6[_0x22eb('0x21')]();})[_0x22eb('0x20')](function(){_0x164645[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();})['catch'](handleError(_0x164645,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 651c8f8..f48ffe0 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0b3=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xd1b786,_0x256e08){var _0x1b9a1b=function(_0x5c7be5){while(--_0x5c7be5){_0xd1b786['push'](_0xd1b786['shift']());}};_0x1b9a1b(++_0x256e08);}(_0xe0b3,0x157));var _0x3e0b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0b3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3e0b('0x0'));var util=require(_0x3e0b('0x1'));var logger=require(_0x3e0b('0x2'))(_0x3e0b('0x3'));var moment=require('moment');var BPromise=require(_0x3e0b('0x4'));var rp=require(_0x3e0b('0x5'));var fs=require('fs');var path=require(_0x3e0b('0x6'));var rimraf=require('rimraf');var config=require(_0x3e0b('0x7'));var attributes=require(_0x3e0b('0x8'));module[_0x3e0b('0x9')]=function(_0x45c4e9,_0x559d40){return _0x45c4e9[_0x3e0b('0xa')](_0x3e0b('0xb'),attributes,{'tableName':_0x3e0b('0xc'),'paranoid':![],'indexes':[{'name':_0x3e0b('0xd'),'fields':[_0x3e0b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x688f=['define','screen_recordings','interactionid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./screenRecording.attributes','exports'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x688f,0x153));var _0xf688=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x688f[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xf688('0x0'));var util=require(_0xf688('0x1'));var logger=require(_0xf688('0x2'))('api');var moment=require(_0xf688('0x3'));var BPromise=require('bluebird');var rp=require(_0xf688('0x4'));var fs=require('fs');var path=require(_0xf688('0x5'));var rimraf=require(_0xf688('0x6'));var config=require('../../config/environment');var attributes=require(_0xf688('0x7'));module[_0xf688('0x8')]=function(_0x387433,_0x4bae1f){return _0x387433[_0xf688('0x9')]('ScreenRecording',attributes,{'tableName':_0xf688('0xa'),'paranoid':![],'indexes':[{'name':_0xf688('0xb'),'fields':[_0xf688('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b9d61a3..9528b2d 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3625=['then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request'];(function(_0x495f29,_0x14ae3f){var _0x5ec0e1=function(_0x2217d3){while(--_0x2217d3){_0x495f29['push'](_0x495f29['shift']());}};_0x5ec0e1(++_0x14ae3f);}(_0x3625,0x19b));var _0x5362=function(_0x5eb1a1,_0x4ff124){_0x5eb1a1=_0x5eb1a1-0x0;var _0x28534a=_0x3625[_0x5eb1a1];return _0x28534a;};'use strict';var _=require(_0x5362('0x0'));var util=require(_0x5362('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5362('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5362('0x3'))['db'];var utils=require(_0x5362('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5362('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5362('0x6')][_0x5362('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35228e,_0x845e04,_0x494b5b){return new BPromise(function(_0x47c994,_0x2ca9d8){return client[_0x5362('0x8')](_0x35228e,_0x494b5b)[_0x5362('0x9')](function(_0x583763){logger[_0x5362('0xa')](_0x5362('0xb'),_0x845e04,'request\x20sent');logger[_0x5362('0xc')](_0x5362('0xd'),_0x845e04,_0x5362('0xe'),JSON[_0x5362('0xf')](_0x583763));if(_0x583763[_0x5362('0x10')]){if(_0x583763[_0x5362('0x10')][_0x5362('0x11')]===0x1f4){logger[_0x5362('0x10')](_0x5362('0xb'),_0x845e04,_0x583763[_0x5362('0x10')]['message']);return _0x2ca9d8(_0x583763[_0x5362('0x10')]['message']);}logger[_0x5362('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x845e04,_0x583763[_0x5362('0x10')]['message']);return _0x47c994(_0x583763[_0x5362('0x10')][_0x5362('0x12')]);}else{logger[_0x5362('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x845e04,_0x5362('0xe'));_0x47c994(_0x583763[_0x5362('0x13')][_0x5362('0x12')]);}})[_0x5362('0x14')](function(_0x1134e7){logger[_0x5362('0x10')](_0x5362('0xb'),_0x845e04,_0x1134e7);_0x2ca9d8(_0x1134e7);});});} \ No newline at end of file +var _0x6eeb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','randomstring'];(function(_0x2e8c7e,_0x28648a){var _0x48fded=function(_0x55b9c5){while(--_0x55b9c5){_0x2e8c7e['push'](_0x2e8c7e['shift']());}};_0x48fded(++_0x28648a);}(_0x6eeb,0x1cb));var _0xb6ee=function(_0x406ae7,_0x12181b){_0x406ae7=_0x406ae7-0x0;var _0x5a5b9d=_0x6eeb[_0x406ae7];return _0x5a5b9d;};'use strict';var _=require(_0xb6ee('0x0'));var util=require('util');var moment=require(_0xb6ee('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6ee('0x2'));var fs=require('fs');var Redis=require(_0xb6ee('0x3'));var db=require(_0xb6ee('0x4'))['db'];var utils=require(_0xb6ee('0x5'));var logger=require(_0xb6ee('0x6'))(_0xb6ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xb6ee('0x8'));var client=jayson['client'][_0xb6ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x323990,_0x55a0d5,_0x527e2d){return new BPromise(function(_0xefb083,_0x1cbcf6){return client[_0xb6ee('0xa')](_0x323990,_0x527e2d)[_0xb6ee('0xb')](function(_0x3b0b09){logger[_0xb6ee('0xc')](_0xb6ee('0xd'),_0x55a0d5,'request\x20sent');logger[_0xb6ee('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x55a0d5,_0xb6ee('0xf'),JSON[_0xb6ee('0x10')](_0x3b0b09));if(_0x3b0b09['error']){if(_0x3b0b09[_0xb6ee('0x11')][_0xb6ee('0x12')]===0x1f4){logger[_0xb6ee('0x11')](_0xb6ee('0xd'),_0x55a0d5,_0x3b0b09[_0xb6ee('0x11')][_0xb6ee('0x13')]);return _0x1cbcf6(_0x3b0b09['error'][_0xb6ee('0x13')]);}logger[_0xb6ee('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x55a0d5,_0x3b0b09['error'][_0xb6ee('0x13')]);return _0xefb083(_0x3b0b09[_0xb6ee('0x11')][_0xb6ee('0x13')]);}else{logger[_0xb6ee('0xc')](_0xb6ee('0xd'),_0x55a0d5,'request\x20sent');_0xefb083(_0x3b0b09[_0xb6ee('0x14')][_0xb6ee('0x13')]);}})['catch'](function(_0x4ecd79){logger[_0xb6ee('0x11')](_0xb6ee('0xd'),_0x55a0d5,_0x4ecd79);_0x1cbcf6(_0x4ecd79);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1f6c36a..7dc0fba 100644 --- a/server/api/setting/index.js +++ b/server/api/setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d0c=['getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','diskStorage','single','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0x3d0c,0x13d));var _0xc3d0=function(_0xd73d53,_0x598443){_0xd73d53=_0xd73d53-0x0;var _0x560148=_0x3d0c[_0xd73d53];return _0x560148;};'use strict';var multer=require(_0xc3d0('0x0'));var util=require(_0xc3d0('0x1'));var path=require(_0xc3d0('0x2'));var timeout=require(_0xc3d0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc3d0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc3d0('0x5'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xc3d0('0x6')]('/',auth[_0xc3d0('0x7')](),controller[_0xc3d0('0x8')]);router['get'](_0xc3d0('0x9'),controller[_0xc3d0('0xa')]);router['get'](_0xc3d0('0xb'),controller[_0xc3d0('0xc')]);router[_0xc3d0('0x6')](_0xc3d0('0xd'),controller[_0xc3d0('0xe')]);router['get'](_0xc3d0('0xf'),controller['getLogoLogin']);router['get']('/:id/gdpr',controller['gdpr']);router[_0xc3d0('0x6')]('/:id/preferred',controller['getPreferred']);router[_0xc3d0('0x6')]('/:id/favicon',controller[_0xc3d0('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29453d,_0x581811,_0x578488){_0x578488(null,path[_0xc3d0('0x11')](config[_0xc3d0('0x12')],_0xc3d0('0x13')));},'filename':function(_0xba659e,_0x58c1ab,_0x58bdd0){_0x58bdd0(null,util[_0xc3d0('0x14')](_0xc3d0('0x15'),_0xc3d0('0x16'),path[_0xc3d0('0x17')](_0x58c1ab[_0xc3d0('0x18')])));}})});router[_0xc3d0('0x19')]('/:id/logo',upload['single'](_0xc3d0('0x1a')),controller[_0xc3d0('0x1b')]);var upload=multer({'storage':multer[_0xc3d0('0x1c')]({'destination':function(_0x2649ec,_0x4dc5f7,_0x4a5906){_0x4a5906(null,path['join'](config[_0xc3d0('0x12')],_0xc3d0('0x13')));},'filename':function(_0x1a0868,_0x37e227,_0x4ce23f){_0x4ce23f(null,util['format'](_0xc3d0('0x15'),'logologin',path[_0xc3d0('0x17')](_0x37e227[_0xc3d0('0x18')])));}})});router[_0xc3d0('0x19')](_0xc3d0('0xf'),upload[_0xc3d0('0x1d')](_0xc3d0('0x1a')),controller[_0xc3d0('0x1e')]);var upload=multer({'storage':multer[_0xc3d0('0x1c')]({'destination':function(_0x109657,_0x22ac5d,_0x50a168){_0x50a168(null,path['join'](config[_0xc3d0('0x12')],_0xc3d0('0x13')));},'filename':function(_0x5b0c2e,_0x5effdf,_0x483db9){_0x483db9(null,util['format'](_0xc3d0('0x15'),_0xc3d0('0x1f'),path['extname'](_0x5effdf['originalname'])));}})});router['post'](_0xc3d0('0x20'),upload[_0xc3d0('0x1d')](_0xc3d0('0x1a')),controller[_0xc3d0('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39348c,_0x3923ba,_0xc01eba){_0xc01eba(null,path[_0xc3d0('0x11')](config['root'],_0xc3d0('0x13')));},'filename':function(_0x21923c,_0xeaa9a2,_0x8b9e23){_0x8b9e23(null,util[_0xc3d0('0x14')]('%s%s',_0xc3d0('0x22'),path[_0xc3d0('0x17')](_0xeaa9a2[_0xc3d0('0x18')])));}})});router[_0xc3d0('0x19')]('/:id/favicon',upload[_0xc3d0('0x1d')](_0xc3d0('0x1a')),controller[_0xc3d0('0x23')]);router[_0xc3d0('0x24')](_0xc3d0('0xb'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xd0e8=['diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','file','server/files/images/logos/','logologin','addLogoLogin','addPreferred','favicon','addFavicon','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon'];(function(_0x388aa4,_0x286b55){var _0x445af6=function(_0x407a76){while(--_0x407a76){_0x388aa4['push'](_0x388aa4['shift']());}};_0x445af6(++_0x286b55);}(_0xd0e8,0xf6));var _0x8d0e=function(_0x492d7c,_0x39a9c8){_0x492d7c=_0x492d7c-0x0;var _0x397359=_0xd0e8[_0x492d7c];return _0x397359;};'use strict';var multer=require(_0x8d0e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8d0e('0x1'));var express=require(_0x8d0e('0x2'));var router=express[_0x8d0e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8d0e('0x4'));var interaction=require(_0x8d0e('0x5'));var config=require('../../config/environment');var controller=require(_0x8d0e('0x6'));router[_0x8d0e('0x7')]('/',auth[_0x8d0e('0x8')](),controller[_0x8d0e('0x9')]);router['get'](_0x8d0e('0xa'),controller['getDate']);router[_0x8d0e('0x7')](_0x8d0e('0xb'),controller['show']);router['get'](_0x8d0e('0xc'),controller[_0x8d0e('0xd')]);router['get'](_0x8d0e('0xe'),controller['getLogoLogin']);router[_0x8d0e('0x7')](_0x8d0e('0xf'),controller[_0x8d0e('0x10')]);router[_0x8d0e('0x7')](_0x8d0e('0x11'),controller['getPreferred']);router[_0x8d0e('0x7')](_0x8d0e('0x12'),controller[_0x8d0e('0x13')]);var upload=multer({'storage':multer[_0x8d0e('0x14')]({'destination':function(_0x11742e,_0x4da5c6,_0x492309){_0x492309(null,path[_0x8d0e('0x15')](config[_0x8d0e('0x16')],'server/files/images/logos/'));},'filename':function(_0x5ad646,_0x41da93,_0x1b1766){_0x1b1766(null,util[_0x8d0e('0x17')](_0x8d0e('0x18'),_0x8d0e('0x19'),path[_0x8d0e('0x1a')](_0x41da93[_0x8d0e('0x1b')])));}})});router[_0x8d0e('0x1c')](_0x8d0e('0xc'),upload[_0x8d0e('0x1d')](_0x8d0e('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0x8d0e('0x14')]({'destination':function(_0x570d1d,_0x48d3ce,_0x255776){_0x255776(null,path[_0x8d0e('0x15')](config['root'],_0x8d0e('0x1f')));},'filename':function(_0x3bca28,_0x5aef55,_0x1e45dc){_0x1e45dc(null,util['format']('%s%s',_0x8d0e('0x20'),path['extname'](_0x5aef55[_0x8d0e('0x1b')])));}})});router[_0x8d0e('0x1c')](_0x8d0e('0xe'),upload[_0x8d0e('0x1d')](_0x8d0e('0x1e')),controller[_0x8d0e('0x21')]);var upload=multer({'storage':multer[_0x8d0e('0x14')]({'destination':function(_0x284f29,_0x5c9c2e,_0x4a55d0){_0x4a55d0(null,path[_0x8d0e('0x15')](config[_0x8d0e('0x16')],'server/files/images/logos/'));},'filename':function(_0x460721,_0x4f8772,_0x49bcac){_0x49bcac(null,util[_0x8d0e('0x17')]('%s%s','preferred',path[_0x8d0e('0x1a')](_0x4f8772[_0x8d0e('0x1b')])));}})});router[_0x8d0e('0x1c')](_0x8d0e('0x11'),upload[_0x8d0e('0x1d')](_0x8d0e('0x1e')),controller[_0x8d0e('0x22')]);var upload=multer({'storage':multer[_0x8d0e('0x14')]({'destination':function(_0x20ecdb,_0x4a5d11,_0x24518d){_0x24518d(null,path['join'](config[_0x8d0e('0x16')],_0x8d0e('0x1f')));},'filename':function(_0x339d52,_0x53bcf5,_0x1df713){_0x1df713(null,util['format']('%s%s',_0x8d0e('0x23'),path['extname'](_0x53bcf5[_0x8d0e('0x1b')])));}})});router[_0x8d0e('0x1c')](_0x8d0e('0x12'),upload['single']('file'),controller[_0x8d0e('0x24')]);router['put'](_0x8d0e('0xb'),auth[_0x8d0e('0x8')](),controller['update']);module[_0x8d0e('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3e28af8..60e6b54 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a56=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1a56,0x1ef));var _0x61a5=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x1a56[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require(_0x61a5('0x0'));module[_0x61a5('0x1')]={'min_internal':{'type':Sequelize[_0x61a5('0x2')](0xb),'unique':_0x61a5('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x61a5('0x2')](0xb),'unique':_0x61a5('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x61a5('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x61a5('0x5')],'defaultValue':_0x61a5('0x6')},'logo':{'type':Sequelize[_0x61a5('0x5')]},'defaultLogo':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x61a5('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x61a5('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x61a5('0x5')]},'turnaddr':{'type':Sequelize[_0x61a5('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x61a5('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x61a5('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x61a5('0x5')],'defaultValue':_0x61a5('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x61a5('0x5')],'defaultValue':_0x61a5('0x9')},'chatTimeout':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x61a5('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x61a5('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x61a5('0x5')]},'defaultFavicon':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x61a5('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x61a5('0x2')]},'sentimentRegion':{'type':Sequelize[_0x61a5('0x5')]},'language':{'type':Sequelize[_0x61a5('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x61a5('0x2')](0x2)[_0x61a5('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x61a5('0x2')](0x2)[_0x61a5('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x61a5('0x2')](0x2)[_0x61a5('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x61a5('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x61a5('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x61a5('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe3f1=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','INTEGER','min_internal'];(function(_0x528add,_0x4458cf){var _0x3777ce=function(_0x21ca5a){while(--_0x21ca5a){_0x528add['push'](_0x528add['shift']());}};_0x3777ce(++_0x4458cf);}(_0xe3f1,0x1c8));var _0x1e3f=function(_0x41a584,_0x239146){_0x41a584=_0x41a584-0x0;var _0x2da11c=_0xe3f1[_0x41a584];return _0x2da11c;};'use strict';var Sequelize=require('sequelize');module[_0x1e3f('0x0')]={'min_internal':{'type':Sequelize[_0x1e3f('0x1')](0xb),'unique':_0x1e3f('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1e3f('0x1')](0xb),'unique':_0x1e3f('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1e3f('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1e3f('0x4')],'defaultValue':_0x1e3f('0x5')},'logo':{'type':Sequelize[_0x1e3f('0x4')]},'defaultLogo':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1e3f('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1e3f('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1e3f('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x1e3f('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x1e3f('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1e3f('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x1e3f('0x7')},'enableEmailPreview':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1e3f('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1e3f('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1e3f('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1e3f('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1e3f('0x4')]},'sentiment':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1e3f('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1e3f('0x4')]},'language':{'type':Sequelize[_0x1e3f('0x4')]},'bucket':{'type':Sequelize[_0x1e3f('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x1e3f('0x1')](0x2)[_0x1e3f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1e3f('0x1')](0x2)[_0x1e3f('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1e3f('0x1')](0x2)[_0x1e3f('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1e3f('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x1e3f('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x1e3f('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 282a865..9116dd5 100644 --- a/server/api/setting/setting.controller.js +++ b/server/api/setting/setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc737=['debug','request\x20sent','stringify','code','error','message','result','catch','status','json','offset','undefined','count','set','apply','reject','save','update','end','sendStatus','stack','name','send','index','map','Setting','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','show','include','find','body','addLogo','file','filename','logo','params','addLogoLogin','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default','custom','default_logo.svg','Sequelize','ValidationError','download','getLogoLogin','preferred','defaultPreferred','default_loginLogo.svg','upperFirst','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc737,0x154));var _0x7c73=function(_0x5b3d49,_0x388f37){_0x5b3d49=_0x5b3d49-0x0;var _0x555cff=_0xc737[_0x5b3d49];return _0x555cff;};'use strict';var emlformat=require(_0x7c73('0x0'));var rimraf=require(_0x7c73('0x1'));var zipdir=require(_0x7c73('0x2'));var jsonpatch=require(_0x7c73('0x3'));var rp=require('request-promise');var moment=require(_0x7c73('0x4'));var BPromise=require(_0x7c73('0x5'));var Mustache=require(_0x7c73('0x6'));var util=require('util');var path=require(_0x7c73('0x7'));var sox=require(_0x7c73('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c73('0x9'));var _=require(_0x7c73('0xa'));var squel=require('squel');var crypto=require(_0x7c73('0xb'));var jsforce=require(_0x7c73('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c73('0xd'));var Papa=require(_0x7c73('0xe'));var Redis=require(_0x7c73('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7c73('0x10'));var as=require(_0x7c73('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c73('0x12'))('api');var utils=require(_0x7c73('0x13'));var config=require(_0x7c73('0x14'));var licenseUtil=require(_0x7c73('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7c73('0x16'));var client=jayson[_0x7c73('0x17')][_0x7c73('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x39a2d4,_0x4e81c3,_0x1e0657,_0x5207f0){return new BPromise(function(_0x41864b,_0x3afd48){var _0x1bf68e=_0x5207f0||client;return _0x1bf68e[_0x7c73('0x19')](_0x39a2d4,_0x1e0657)[_0x7c73('0x1a')](function(_0x8d1a6b){logger[_0x7c73('0x1b')](_0x7c73('0x1c'),_0x4e81c3,'request\x20sent');logger[_0x7c73('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x4e81c3,_0x7c73('0x1e'),JSON[_0x7c73('0x1f')](_0x8d1a6b));if(_0x8d1a6b['error']){if(_0x8d1a6b['error'][_0x7c73('0x20')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x4e81c3,_0x8d1a6b[_0x7c73('0x21')][_0x7c73('0x22')]);return _0x3afd48(_0x8d1a6b[_0x7c73('0x21')][_0x7c73('0x22')]);}logger['error'](_0x7c73('0x1c'),_0x4e81c3,_0x8d1a6b[_0x7c73('0x21')][_0x7c73('0x22')]);return _0x41864b(_0x8d1a6b[_0x7c73('0x21')][_0x7c73('0x22')]);}else{logger['info'](_0x7c73('0x1c'),_0x4e81c3,_0x7c73('0x1e'));_0x41864b(_0x8d1a6b[_0x7c73('0x23')][_0x7c73('0x22')]);}})[_0x7c73('0x24')](function(_0x14b12c){logger[_0x7c73('0x21')](_0x7c73('0x1c'),_0x4e81c3,_0x14b12c);_0x3afd48(_0x14b12c);});});}function respondWithStatusCode(_0x12650f,_0x4c8933){_0x4c8933=_0x4c8933||0xcc;return function(_0x427b12){if(_0x427b12){return _0x12650f['sendStatus'](_0x4c8933);}return _0x12650f[_0x7c73('0x25')](_0x4c8933)['end']();};}function respondWithResult(_0x296be5,_0x57dd84){_0x57dd84=_0x57dd84||0xc8;return function(_0x1abfc5){if(_0x1abfc5){return _0x296be5['status'](_0x57dd84)[_0x7c73('0x26')](_0x1abfc5);}};}function respondWithFilteredResult(_0x21a4a3,_0xb758d3){return function(_0x5b8bc9){if(_0x5b8bc9){var _0x546ae0=typeof _0xb758d3[_0x7c73('0x27')]===_0x7c73('0x28')&&typeof _0xb758d3['limit']===_0x7c73('0x28');var _0x14c5a0=_0x5b8bc9[_0x7c73('0x29')];var _0x3c9a44=_0x546ae0?0x0:_0xb758d3[_0x7c73('0x27')];var _0x23af7e=_0x546ae0?_0x5b8bc9['count']:_0xb758d3['offset']+_0xb758d3['limit'];var _0x30fa4f;if(_0x23af7e>=_0x14c5a0){_0x23af7e=_0x14c5a0;_0x30fa4f=0xc8;}else{_0x30fa4f=0xce;}_0x21a4a3[_0x7c73('0x25')](_0x30fa4f);return _0x21a4a3[_0x7c73('0x2a')]('Content-Range',_0x3c9a44+'-'+_0x23af7e+'/'+_0x14c5a0)['json'](_0x5b8bc9);}return null;};}function patchUpdates(_0x240869){return function(_0xe7fb54){try{jsonpatch[_0x7c73('0x2b')](_0xe7fb54,_0x240869,!![]);}catch(_0x334cf1){return BPromise[_0x7c73('0x2c')](_0x334cf1);}return _0xe7fb54[_0x7c73('0x2d')]();};}function saveUpdates(_0x353dd0,_0x211007){return function(_0x435f20){if(_0x435f20){return _0x435f20[_0x7c73('0x2e')](_0x353dd0)['then'](function(_0x510ae7){return _0x510ae7;});}return null;};}function removeEntity(_0xb997ca,_0x346294){return function(_0x380354){if(_0x380354){return _0x380354['destroy']()[_0x7c73('0x1a')](function(){_0xb997ca[_0x7c73('0x25')](0xcc)[_0x7c73('0x2f')]();});}};}function handleEntityNotFound(_0xdab0d8,_0x475ac3){return function(_0x5a4db0){if(!_0x5a4db0){_0xdab0d8[_0x7c73('0x30')](0x194);}return _0x5a4db0;};}function handleError(_0x1fb7ed,_0x528ad8){_0x528ad8=_0x528ad8||0x1f4;return function(_0x34c9e3){logger[_0x7c73('0x21')](_0x34c9e3[_0x7c73('0x31')]);if(_0x34c9e3[_0x7c73('0x32')]){delete _0x34c9e3[_0x7c73('0x32')];}_0x1fb7ed[_0x7c73('0x25')](_0x528ad8)[_0x7c73('0x33')](_0x34c9e3);};}exports[_0x7c73('0x34')]=function(_0x32af21,_0x430dc6){var _0x2915c9={},_0xf0cb9f={},_0x96cd91={'count':0x0,'rows':[]};var _0x3c780d=_[_0x7c73('0x35')](db[_0x7c73('0x36')]['rawAttributes'],function(_0x30690b){return{'name':_0x30690b[_0x7c73('0x37')],'type':_0x30690b['type'][_0x7c73('0x38')]};});_0xf0cb9f[_0x7c73('0x39')]=_['map'](_0x3c780d,_0x7c73('0x32'));_0xf0cb9f['query']=_[_0x7c73('0x3a')](_0x32af21[_0x7c73('0x3b')]);_0xf0cb9f[_0x7c73('0x3c')]=_[_0x7c73('0x3d')](_0xf0cb9f[_0x7c73('0x39')],_0xf0cb9f[_0x7c73('0x3b')]);_0x2915c9[_0x7c73('0x3e')]=_[_0x7c73('0x3d')](_0xf0cb9f[_0x7c73('0x39')],qs['fields'](_0x32af21[_0x7c73('0x3b')][_0x7c73('0x3f')]));_0x2915c9[_0x7c73('0x3e')]=_0x2915c9[_0x7c73('0x3e')][_0x7c73('0x40')]?_0x2915c9['attributes']:_0xf0cb9f['model'];if(!_0x32af21[_0x7c73('0x3b')][_0x7c73('0x41')](_0x7c73('0x42'))){_0x2915c9[_0x7c73('0x43')]=qs[_0x7c73('0x43')](_0x32af21[_0x7c73('0x3b')][_0x7c73('0x43')]);_0x2915c9[_0x7c73('0x27')]=qs['offset'](_0x32af21[_0x7c73('0x3b')][_0x7c73('0x27')]);}_0x2915c9[_0x7c73('0x44')]=qs[_0x7c73('0x45')](_0x32af21[_0x7c73('0x3b')][_0x7c73('0x45')]);_0x2915c9['where']=qs[_0x7c73('0x3c')](_[_0x7c73('0x46')](_0x32af21[_0x7c73('0x3b')],_0xf0cb9f[_0x7c73('0x3c')]),_0x3c780d);if(_0x32af21['query']['filter']){_0x2915c9['where']=_[_0x7c73('0x47')](_0x2915c9[_0x7c73('0x48')],{'$or':_[_0x7c73('0x35')](_0x3c780d,function(_0x2f6140){if(_0x2f6140['type']!==_0x7c73('0x49')){var _0x16f98d={};_0x16f98d[_0x2f6140[_0x7c73('0x32')]]={'$like':'%'+_0x32af21[_0x7c73('0x3b')][_0x7c73('0x4a')]+'%'};return _0x16f98d;}})});}_0x2915c9=_[_0x7c73('0x47')]({},_0x2915c9,_0x32af21[_0x7c73('0x4b')]);var _0x32751a={'where':_0x2915c9['where']};return db[_0x7c73('0x36')]['count'](_0x32751a)['then'](function(_0x301271){_0x96cd91[_0x7c73('0x29')]=_0x301271;if(_0x32af21[_0x7c73('0x3b')][_0x7c73('0x4c')]){_0x2915c9['include']=[{'all':!![]}];}return db[_0x7c73('0x36')]['findAll'](_0x2915c9);})[_0x7c73('0x1a')](function(_0x51425d){_0x96cd91['rows']=_0x51425d;return _0x96cd91;})[_0x7c73('0x1a')](respondWithFilteredResult(_0x430dc6,_0x2915c9))[_0x7c73('0x24')](handleError(_0x430dc6,null));};exports[_0x7c73('0x4d')]=function(_0x154c1d,_0x4bb9cc){var _0x291c15={'raw':![],'where':{'id':_0x154c1d['params']['id']}},_0x2866bb={};_0x2866bb[_0x7c73('0x39')]=_['keys'](db[_0x7c73('0x36')]['rawAttributes']);_0x2866bb['query']=_[_0x7c73('0x3a')](_0x154c1d['query']);_0x2866bb['filters']=_[_0x7c73('0x3d')](_0x2866bb[_0x7c73('0x39')],_0x2866bb[_0x7c73('0x3b')]);_0x291c15['attributes']=_['intersection'](_0x2866bb[_0x7c73('0x39')],qs[_0x7c73('0x3f')](_0x154c1d[_0x7c73('0x3b')][_0x7c73('0x3f')]));_0x291c15[_0x7c73('0x3e')]=_0x291c15['attributes']['length']?_0x291c15[_0x7c73('0x3e')]:_0x2866bb[_0x7c73('0x39')];if(_0x154c1d[_0x7c73('0x3b')][_0x7c73('0x4c')]){_0x291c15[_0x7c73('0x4e')]=[{'all':!![]}];}_0x291c15=_[_0x7c73('0x47')]({},_0x291c15,_0x154c1d['options']);return db['Setting'][_0x7c73('0x4f')](_0x291c15)[_0x7c73('0x1a')](handleEntityNotFound(_0x4bb9cc,null))[_0x7c73('0x1a')](respondWithResult(_0x4bb9cc,null))['catch'](handleError(_0x4bb9cc,null));};exports['update']=function(_0x8cacc2,_0x294abb){if(_0x8cacc2[_0x7c73('0x50')]['id']){delete _0x8cacc2[_0x7c73('0x50')]['id'];}return db[_0x7c73('0x36')][_0x7c73('0x4f')]({'where':{'id':_0x8cacc2['params']['id']}})['then'](handleEntityNotFound(_0x294abb,null))[_0x7c73('0x1a')](saveUpdates(_0x8cacc2[_0x7c73('0x50')],null))[_0x7c73('0x1a')](respondWithResult(_0x294abb,null))[_0x7c73('0x24')](handleError(_0x294abb,null));};exports[_0x7c73('0x51')]=function(_0x2d8461,_0x3a4d4e,_0x807be7){if(_0x2d8461[_0x7c73('0x52')]&&_0x2d8461['file'][_0x7c73('0x53')]){_0x2d8461[_0x7c73('0x50')][_0x7c73('0x54')]=_0x2d8461[_0x7c73('0x52')][_0x7c73('0x53')];}return db['Setting'][_0x7c73('0x4f')]({'where':{'id':_0x2d8461[_0x7c73('0x55')]['id']}})[_0x7c73('0x1a')](handleEntityNotFound(_0x3a4d4e,null))[_0x7c73('0x1a')](saveUpdates(_0x2d8461[_0x7c73('0x50')],null))['then'](respondWithResult(_0x3a4d4e,null))[_0x7c73('0x24')](handleError(_0x3a4d4e,null));};exports[_0x7c73('0x56')]=function(_0x50c416,_0x29c8b1,_0x39914f){if(_0x50c416['file']&&_0x50c416['file'][_0x7c73('0x53')]){_0x50c416[_0x7c73('0x50')][_0x7c73('0x57')]=_0x50c416[_0x7c73('0x52')]['filename'];}return db[_0x7c73('0x36')][_0x7c73('0x4f')]({'where':{'id':_0x50c416[_0x7c73('0x55')]['id']}})['then'](handleEntityNotFound(_0x29c8b1,null))[_0x7c73('0x1a')](saveUpdates(_0x50c416[_0x7c73('0x50')],null))[_0x7c73('0x1a')](respondWithResult(_0x29c8b1,null))[_0x7c73('0x24')](handleError(_0x29c8b1,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x10d9c4,_0x58785f,_0x51ecf6){var _0x5f3ec7=_0x7c73('0x58');var _0x306097={'custom':![]};return utilLicense[_0x7c73('0x59')]()[_0x7c73('0x1a')](function(_0x2b775b){if(_0x2b775b){_0x306097=_0x2b775b;}return db[_0x7c73('0x36')][_0x7c73('0x4f')]({'where':{'id':_0x10d9c4[_0x7c73('0x55')]['id']},'attributes':[_0x7c73('0x54'),_0x7c73('0x57'),'preferred',_0x7c73('0x5a'),_0x7c73('0x5b'),_0x7c73('0x5c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x7c73('0x1a')](handleEntityNotFound(_0x58785f,null))[_0x7c73('0x1a')](function(_0x508058){if(_0x508058){var _0x4a33b5=_0x508058[_0x7c73('0x54')]&&fs[_0x7c73('0x5d')](path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x5f3ec7,_[_0x7c73('0x60')](_0x508058[_0x7c73('0x54')])))?path[_0x7c73('0x5e')](config['root'],_0x5f3ec7,_[_0x7c73('0x60')](_0x508058[_0x7c73('0x54')])):path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x5f3ec7,_['toLower']('default_logo.svg'));var _0x12fc02=_0x7c73('0x61')+_['upperFirst'](_0x7c73('0x54'));if(_0x508058[_0x12fc02]||!_0x306097[_0x7c73('0x62')]){_0x4a33b5=path[_0x7c73('0x5e')](config['root'],_0x5f3ec7,_[_0x7c73('0x60')](_0x7c73('0x63')));}if(!fs[_0x7c73('0x5d')](_0x4a33b5)){throw new db[(_0x7c73('0x64'))][(_0x7c73('0x65'))](_['upperFirst'](_0x7c73('0x54'))+'\x20not\x20found');}return _0x58785f[_0x7c73('0x66')](_0x4a33b5);}})['catch'](handleError(_0x58785f,null));};var utilLicense=require('../../config/license/util');exports[_0x7c73('0x67')]=function(_0x140c98,_0x387592,_0x4b5c09){var _0x2ea4b7=_0x7c73('0x58');var _0x5ea1e1={'custom':![]};return utilLicense[_0x7c73('0x59')]()['then'](function(_0x2c21c8){if(_0x2c21c8){_0x5ea1e1=_0x2c21c8;}return db[_0x7c73('0x36')]['find']({'where':{'id':_0x140c98[_0x7c73('0x55')]['id']},'attributes':[_0x7c73('0x54'),_0x7c73('0x57'),_0x7c73('0x68'),'favicon',_0x7c73('0x5b'),_0x7c73('0x5c'),_0x7c73('0x69'),'defaultFavicon'],'raw':!![]});})[_0x7c73('0x1a')](handleEntityNotFound(_0x387592,null))[_0x7c73('0x1a')](function(_0x45294f){if(_0x45294f){var _0x45c7b2=_0x45294f[_0x7c73('0x57')]&&fs[_0x7c73('0x5d')](path[_0x7c73('0x5e')](config['root'],_0x2ea4b7,_[_0x7c73('0x60')](_0x45294f[_0x7c73('0x57')])))?path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x2ea4b7,_[_0x7c73('0x60')](_0x45294f[_0x7c73('0x57')])):path[_0x7c73('0x5e')](config['root'],_0x2ea4b7,_[_0x7c73('0x60')](_0x7c73('0x6a')));var _0xd28dab=_0x7c73('0x61')+_[_0x7c73('0x6b')](_0x7c73('0x57'));if(_0x45294f[_0xd28dab]||!_0x5ea1e1[_0x7c73('0x62')]){_0x45c7b2=path['join'](config['root'],_0x2ea4b7,_['toLower'](_0x7c73('0x6a')));}if(!fs['existsSync'](_0x45c7b2)){throw new db['Sequelize'][(_0x7c73('0x65'))](_[_0x7c73('0x6b')](_0x7c73('0x57'))+_0x7c73('0x6c'));}return _0x387592[_0x7c73('0x66')](_0x45c7b2);}})['catch'](handleError(_0x387592,null));};exports[_0x7c73('0x6d')]=function(_0x506ca1,_0x2e376e){return db['Setting']['find']({'where':{'id':_0x506ca1[_0x7c73('0x55')]['id']},'attributes':[_0x7c73('0x6e')]})[_0x7c73('0x1a')](respondWithResult(_0x2e376e,null))[_0x7c73('0x24')](handleError(_0x2e376e,null));};exports[_0x7c73('0x6f')]=function(_0x234584,_0x13b17c,_0x1f1838){if(_0x234584['file']&&_0x234584[_0x7c73('0x52')][_0x7c73('0x53')]){_0x234584[_0x7c73('0x50')]['preferred']=_0x234584['file'][_0x7c73('0x53')];}return db[_0x7c73('0x36')]['find']({'where':{'id':_0x234584[_0x7c73('0x55')]['id']}})['then'](handleEntityNotFound(_0x13b17c,null))[_0x7c73('0x1a')](saveUpdates(_0x234584['body'],null))[_0x7c73('0x1a')](respondWithResult(_0x13b17c,null))[_0x7c73('0x24')](handleError(_0x13b17c,null));};var utilLicense=require(_0x7c73('0x15'));exports[_0x7c73('0x70')]=function(_0x26fa06,_0x227499,_0xd9b1c9){var _0x51c2a7=_0x7c73('0x58');var _0x3de291={'custom':![]};return utilLicense[_0x7c73('0x59')]()[_0x7c73('0x1a')](function(_0x5dd59a){if(_0x5dd59a){_0x3de291=_0x5dd59a;}return db[_0x7c73('0x36')][_0x7c73('0x4f')]({'where':{'id':_0x26fa06['params']['id']},'attributes':['logo',_0x7c73('0x57'),_0x7c73('0x68'),_0x7c73('0x5a'),_0x7c73('0x5b'),_0x7c73('0x5c'),'defaultPreferred',_0x7c73('0x71')],'raw':!![]});})[_0x7c73('0x1a')](handleEntityNotFound(_0x227499,null))['then'](function(_0x232cca){if(_0x232cca){var _0x122576=_0x232cca[_0x7c73('0x68')]&&fs[_0x7c73('0x5d')](path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x51c2a7,_['toLower'](_0x232cca[_0x7c73('0x68')])))?path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x51c2a7,_[_0x7c73('0x60')](_0x232cca[_0x7c73('0x68')])):path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x51c2a7,_['toLower']('default_preferred.png'));var _0x4439f3='default'+_[_0x7c73('0x6b')](_0x7c73('0x68'));if(_0x232cca[_0x4439f3]||!_0x3de291['custom']||!_0x3de291[_0x7c73('0x68')]){_0x122576=path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x51c2a7,_['toLower'](_0x7c73('0x72')));}if(!fs['existsSync'](_0x122576)){throw new db[(_0x7c73('0x64'))][(_0x7c73('0x65'))](_[_0x7c73('0x6b')](_0x7c73('0x68'))+'\x20not\x20found');}return _0x227499[_0x7c73('0x66')](_0x122576);}})['catch'](handleError(_0x227499,null));};exports[_0x7c73('0x73')]=function(_0x5431fa,_0x504143,_0x336da6){if(_0x5431fa[_0x7c73('0x52')]&&_0x5431fa[_0x7c73('0x52')][_0x7c73('0x53')]){_0x5431fa[_0x7c73('0x50')]['favicon']=_0x5431fa['file'][_0x7c73('0x53')];}return db[_0x7c73('0x36')][_0x7c73('0x4f')]({'where':{'id':_0x5431fa[_0x7c73('0x55')]['id']}})[_0x7c73('0x1a')](handleEntityNotFound(_0x504143,null))[_0x7c73('0x1a')](saveUpdates(_0x5431fa[_0x7c73('0x50')],null))['then'](respondWithResult(_0x504143,null))['catch'](handleError(_0x504143,null));};var utilLicense=require(_0x7c73('0x15'));exports[_0x7c73('0x74')]=function(_0x187c62,_0x2e1111,_0x2ef40f){var _0x3e6548=_0x7c73('0x58');var _0x35a6bb={'custom':![]};return utilLicense[_0x7c73('0x59')]()[_0x7c73('0x1a')](function(_0x14f7dc){if(_0x14f7dc){_0x35a6bb=_0x14f7dc;}return db[_0x7c73('0x36')]['find']({'where':{'id':_0x187c62['params']['id']},'attributes':['logo','loginLogo',_0x7c73('0x68'),_0x7c73('0x5a'),_0x7c73('0x5b'),_0x7c73('0x5c'),_0x7c73('0x69'),_0x7c73('0x71')],'raw':!![]});})[_0x7c73('0x1a')](handleEntityNotFound(_0x2e1111,null))['then'](function(_0x1e9677){if(_0x1e9677){var _0x18ea32=_0x1e9677['favicon']&&fs[_0x7c73('0x5d')](path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x3e6548,_[_0x7c73('0x60')](_0x1e9677[_0x7c73('0x5a')])))?path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x3e6548,_['toLower'](_0x1e9677[_0x7c73('0x5a')])):path[_0x7c73('0x5e')](config[_0x7c73('0x5f')],_0x3e6548,_['toLower'](_0x7c73('0x75')));var _0x263a72=_0x7c73('0x61')+_[_0x7c73('0x6b')](_0x7c73('0x5a'));if(_0x1e9677[_0x263a72]||!_0x35a6bb[_0x7c73('0x62')]){_0x18ea32=path[_0x7c73('0x5e')](config['root'],_0x3e6548,_[_0x7c73('0x60')]('default_favicon.ico'));}if(!fs[_0x7c73('0x5d')](_0x18ea32)){throw new db[(_0x7c73('0x64'))][(_0x7c73('0x65'))](_[_0x7c73('0x6b')](_0x7c73('0x5a'))+_0x7c73('0x6c'));}return _0x2e1111[_0x7c73('0x66')](_0x18ea32);}})[_0x7c73('0x24')](handleError(_0x2e1111,null));};exports[_0x7c73('0x76')]=function(_0x50a9c8,_0x5553ed){var _0x452d52={'offset':moment()['utcOffset']()};_0x452d52[_0x7c73('0x77')]=moment()[_0x7c73('0x78')](_0x452d52[_0x7c73('0x27')])[_0x7c73('0x79')](_0x7c73('0x7a'));return _0x5553ed[_0x7c73('0x25')](0xc8)[_0x7c73('0x33')](_0x452d52);}; \ No newline at end of file +var _0xcb97=['info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','includeAll','include','rows','show','params','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','default_logo.svg','custom','join','existsSync','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','getLicense','default_loginLogo.svg','default','download','securePassword','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request'];(function(_0x547957,_0x1abdfb){var _0x41a4c2=function(_0xe4588e){while(--_0xe4588e){_0x547957['push'](_0x547957['shift']());}};_0x41a4c2(++_0x1abdfb);}(_0xcb97,0x14f));var _0x7cb9=function(_0x2d2498,_0x26426d){_0x2d2498=_0x2d2498-0x0;var _0x447a5b=_0xcb97[_0x2d2498];return _0x447a5b;};'use strict';var emlformat=require(_0x7cb9('0x0'));var rimraf=require(_0x7cb9('0x1'));var zipdir=require(_0x7cb9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7cb9('0x3'));var Mustache=require(_0x7cb9('0x4'));var util=require(_0x7cb9('0x5'));var path=require(_0x7cb9('0x6'));var sox=require(_0x7cb9('0x7'));var csv=require(_0x7cb9('0x8'));var ejs=require(_0x7cb9('0x9'));var fs=require('fs');var fs_extra=require(_0x7cb9('0xa'));var _=require(_0x7cb9('0xb'));var squel=require(_0x7cb9('0xc'));var crypto=require(_0x7cb9('0xd'));var jsforce=require(_0x7cb9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7cb9('0x8'));var querystring=require(_0x7cb9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7cb9('0x10'));var qs=require(_0x7cb9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7cb9('0x12'));var logger=require(_0x7cb9('0x13'))(_0x7cb9('0x14'));var utils=require(_0x7cb9('0x15'));var config=require(_0x7cb9('0x16'));var licenseUtil=require(_0x7cb9('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7cb9('0x18'));var client=jayson[_0x7cb9('0x19')][_0x7cb9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x319630,_0x262742,_0x12c135,_0x35bcfc){return new BPromise(function(_0x2328c5,_0x2c3b57){var _0x2eaf6d=_0x35bcfc||client;return _0x2eaf6d[_0x7cb9('0x1b')](_0x319630,_0x12c135)['then'](function(_0x515f5d){logger[_0x7cb9('0x1c')](_0x7cb9('0x1d'),_0x262742,'request\x20sent');logger[_0x7cb9('0x1e')](_0x7cb9('0x1f'),_0x262742,_0x7cb9('0x20'),JSON[_0x7cb9('0x21')](_0x515f5d));if(_0x515f5d['error']){if(_0x515f5d['error']['code']===0x1f4){logger[_0x7cb9('0x22')](_0x7cb9('0x1d'),_0x262742,_0x515f5d[_0x7cb9('0x22')][_0x7cb9('0x23')]);return _0x2c3b57(_0x515f5d[_0x7cb9('0x22')][_0x7cb9('0x23')]);}logger['error'](_0x7cb9('0x1d'),_0x262742,_0x515f5d[_0x7cb9('0x22')][_0x7cb9('0x23')]);return _0x2328c5(_0x515f5d[_0x7cb9('0x22')]['message']);}else{logger[_0x7cb9('0x1c')](_0x7cb9('0x1d'),_0x262742,'request\x20sent');_0x2328c5(_0x515f5d[_0x7cb9('0x24')][_0x7cb9('0x23')]);}})[_0x7cb9('0x25')](function(_0x55ba4e){logger[_0x7cb9('0x22')](_0x7cb9('0x1d'),_0x262742,_0x55ba4e);_0x2c3b57(_0x55ba4e);});});}function respondWithStatusCode(_0x472c82,_0x3ac750){_0x3ac750=_0x3ac750||0xcc;return function(_0x253e5d){if(_0x253e5d){return _0x472c82[_0x7cb9('0x26')](_0x3ac750);}return _0x472c82[_0x7cb9('0x27')](_0x3ac750)[_0x7cb9('0x28')]();};}function respondWithResult(_0x3a1336,_0x54fd1a){_0x54fd1a=_0x54fd1a||0xc8;return function(_0x349f26){if(_0x349f26){return _0x3a1336[_0x7cb9('0x27')](_0x54fd1a)[_0x7cb9('0x29')](_0x349f26);}};}function respondWithFilteredResult(_0x162d88,_0x4cf9df){return function(_0xc8f49a){if(_0xc8f49a){var _0x20d48e=typeof _0x4cf9df[_0x7cb9('0x2a')]==='undefined'&&typeof _0x4cf9df[_0x7cb9('0x2b')]==='undefined';var _0x17a105=_0xc8f49a[_0x7cb9('0x2c')];var _0x4e65ee=_0x20d48e?0x0:_0x4cf9df[_0x7cb9('0x2a')];var _0x2c1330=_0x20d48e?_0xc8f49a[_0x7cb9('0x2c')]:_0x4cf9df[_0x7cb9('0x2a')]+_0x4cf9df[_0x7cb9('0x2b')];var _0x5c09e1;if(_0x2c1330>=_0x17a105){_0x2c1330=_0x17a105;_0x5c09e1=0xc8;}else{_0x5c09e1=0xce;}_0x162d88[_0x7cb9('0x27')](_0x5c09e1);return _0x162d88['set'](_0x7cb9('0x2d'),_0x4e65ee+'-'+_0x2c1330+'/'+_0x17a105)[_0x7cb9('0x29')](_0xc8f49a);}return null;};}function patchUpdates(_0x1cb2a4){return function(_0x4b91eb){try{jsonpatch['apply'](_0x4b91eb,_0x1cb2a4,!![]);}catch(_0x427d44){return BPromise[_0x7cb9('0x2e')](_0x427d44);}return _0x4b91eb[_0x7cb9('0x2f')]();};}function saveUpdates(_0x3aad53,_0x1659bf){return function(_0x369646){if(_0x369646){return _0x369646[_0x7cb9('0x30')](_0x3aad53)[_0x7cb9('0x31')](function(_0x801c9b){return _0x801c9b;});}return null;};}function removeEntity(_0x4ca877,_0x3879fb){return function(_0x28b96e){if(_0x28b96e){return _0x28b96e['destroy']()['then'](function(){_0x4ca877[_0x7cb9('0x27')](0xcc)[_0x7cb9('0x28')]();});}};}function handleEntityNotFound(_0x361afa,_0x301ebd){return function(_0x232279){if(!_0x232279){_0x361afa['sendStatus'](0x194);}return _0x232279;};}function handleError(_0x2ef55e,_0x3a264c){_0x3a264c=_0x3a264c||0x1f4;return function(_0x42a6da){logger[_0x7cb9('0x22')](_0x42a6da[_0x7cb9('0x32')]);if(_0x42a6da[_0x7cb9('0x33')]){delete _0x42a6da[_0x7cb9('0x33')];}_0x2ef55e[_0x7cb9('0x27')](_0x3a264c)[_0x7cb9('0x34')](_0x42a6da);};}exports[_0x7cb9('0x35')]=function(_0x5a77bd,_0x4e86ef){var _0x2869b9={},_0x6955c8={},_0x2e741c={'count':0x0,'rows':[]};var _0x1bea9e=_[_0x7cb9('0x36')](db[_0x7cb9('0x37')]['rawAttributes'],function(_0x17f16d){return{'name':_0x17f16d[_0x7cb9('0x38')],'type':_0x17f16d[_0x7cb9('0x39')][_0x7cb9('0x3a')]};});_0x6955c8[_0x7cb9('0x3b')]=_[_0x7cb9('0x36')](_0x1bea9e,_0x7cb9('0x33'));_0x6955c8[_0x7cb9('0x3c')]=_[_0x7cb9('0x3d')](_0x5a77bd['query']);_0x6955c8[_0x7cb9('0x3e')]=_[_0x7cb9('0x3f')](_0x6955c8[_0x7cb9('0x3b')],_0x6955c8[_0x7cb9('0x3c')]);_0x2869b9[_0x7cb9('0x40')]=_['intersection'](_0x6955c8[_0x7cb9('0x3b')],qs[_0x7cb9('0x41')](_0x5a77bd['query'][_0x7cb9('0x41')]));_0x2869b9[_0x7cb9('0x40')]=_0x2869b9['attributes'][_0x7cb9('0x42')]?_0x2869b9[_0x7cb9('0x40')]:_0x6955c8['model'];if(!_0x5a77bd[_0x7cb9('0x3c')][_0x7cb9('0x43')](_0x7cb9('0x44'))){_0x2869b9['limit']=qs['limit'](_0x5a77bd[_0x7cb9('0x3c')]['limit']);_0x2869b9[_0x7cb9('0x2a')]=qs[_0x7cb9('0x2a')](_0x5a77bd['query']['offset']);}_0x2869b9[_0x7cb9('0x45')]=qs[_0x7cb9('0x46')](_0x5a77bd[_0x7cb9('0x3c')][_0x7cb9('0x46')]);_0x2869b9['where']=qs[_0x7cb9('0x3e')](_[_0x7cb9('0x47')](_0x5a77bd[_0x7cb9('0x3c')],_0x6955c8[_0x7cb9('0x3e')]),_0x1bea9e);if(_0x5a77bd[_0x7cb9('0x3c')]['filter']){_0x2869b9[_0x7cb9('0x48')]=_['merge'](_0x2869b9[_0x7cb9('0x48')],{'$or':_[_0x7cb9('0x36')](_0x1bea9e,function(_0x30176b){if(_0x30176b['type']!==_0x7cb9('0x49')){var _0x534d44={};_0x534d44[_0x30176b[_0x7cb9('0x33')]]={'$like':'%'+_0x5a77bd[_0x7cb9('0x3c')]['filter']+'%'};return _0x534d44;}})});}_0x2869b9=_[_0x7cb9('0x4a')]({},_0x2869b9,_0x5a77bd['options']);var _0xa99a90={'where':_0x2869b9['where']};return db[_0x7cb9('0x37')][_0x7cb9('0x2c')](_0xa99a90)[_0x7cb9('0x31')](function(_0x56b3ae){_0x2e741c[_0x7cb9('0x2c')]=_0x56b3ae;if(_0x5a77bd[_0x7cb9('0x3c')][_0x7cb9('0x4b')]){_0x2869b9[_0x7cb9('0x4c')]=[{'all':!![]}];}return db[_0x7cb9('0x37')]['findAll'](_0x2869b9);})[_0x7cb9('0x31')](function(_0x1435dc){_0x2e741c[_0x7cb9('0x4d')]=_0x1435dc;return _0x2e741c;})[_0x7cb9('0x31')](respondWithFilteredResult(_0x4e86ef,_0x2869b9))[_0x7cb9('0x25')](handleError(_0x4e86ef,null));};exports[_0x7cb9('0x4e')]=function(_0x3ee933,_0x4f568f){var _0x40e6d7={'raw':![],'where':{'id':_0x3ee933[_0x7cb9('0x4f')]['id']}},_0x25e1eb={};_0x25e1eb[_0x7cb9('0x3b')]=_['keys'](db[_0x7cb9('0x37')]['rawAttributes']);_0x25e1eb[_0x7cb9('0x3c')]=_['keys'](_0x3ee933[_0x7cb9('0x3c')]);_0x25e1eb['filters']=_['intersection'](_0x25e1eb[_0x7cb9('0x3b')],_0x25e1eb['query']);_0x40e6d7[_0x7cb9('0x40')]=_['intersection'](_0x25e1eb[_0x7cb9('0x3b')],qs['fields'](_0x3ee933[_0x7cb9('0x3c')][_0x7cb9('0x41')]));_0x40e6d7[_0x7cb9('0x40')]=_0x40e6d7[_0x7cb9('0x40')][_0x7cb9('0x42')]?_0x40e6d7[_0x7cb9('0x40')]:_0x25e1eb[_0x7cb9('0x3b')];if(_0x3ee933[_0x7cb9('0x3c')][_0x7cb9('0x4b')]){_0x40e6d7[_0x7cb9('0x4c')]=[{'all':!![]}];}_0x40e6d7=_[_0x7cb9('0x4a')]({},_0x40e6d7,_0x3ee933[_0x7cb9('0x50')]);return db['Setting'][_0x7cb9('0x51')](_0x40e6d7)[_0x7cb9('0x31')](handleEntityNotFound(_0x4f568f,null))['then'](respondWithResult(_0x4f568f,null))[_0x7cb9('0x25')](handleError(_0x4f568f,null));};exports[_0x7cb9('0x30')]=function(_0x447e34,_0x5e3845){if(_0x447e34[_0x7cb9('0x52')]['id']){delete _0x447e34[_0x7cb9('0x52')]['id'];}return db[_0x7cb9('0x37')][_0x7cb9('0x51')]({'where':{'id':_0x447e34[_0x7cb9('0x4f')]['id']}})[_0x7cb9('0x31')](handleEntityNotFound(_0x5e3845,null))[_0x7cb9('0x31')](saveUpdates(_0x447e34[_0x7cb9('0x52')],null))['then'](respondWithResult(_0x5e3845,null))[_0x7cb9('0x25')](handleError(_0x5e3845,null));};exports[_0x7cb9('0x53')]=function(_0x5233ea,_0x2067f9,_0x4c5a79){if(_0x5233ea['file']&&_0x5233ea[_0x7cb9('0x54')][_0x7cb9('0x55')]){_0x5233ea[_0x7cb9('0x52')][_0x7cb9('0x56')]=_0x5233ea[_0x7cb9('0x54')][_0x7cb9('0x55')];}return db[_0x7cb9('0x37')][_0x7cb9('0x51')]({'where':{'id':_0x5233ea[_0x7cb9('0x4f')]['id']}})[_0x7cb9('0x31')](handleEntityNotFound(_0x2067f9,null))['then'](saveUpdates(_0x5233ea['body'],null))[_0x7cb9('0x31')](respondWithResult(_0x2067f9,null))[_0x7cb9('0x25')](handleError(_0x2067f9,null));};exports[_0x7cb9('0x57')]=function(_0x3ad2c1,_0x13e8bc,_0x13f2cd){if(_0x3ad2c1[_0x7cb9('0x54')]&&_0x3ad2c1[_0x7cb9('0x54')][_0x7cb9('0x55')]){_0x3ad2c1['body'][_0x7cb9('0x58')]=_0x3ad2c1[_0x7cb9('0x54')]['filename'];}return db['Setting'][_0x7cb9('0x51')]({'where':{'id':_0x3ad2c1[_0x7cb9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x13e8bc,null))['then'](saveUpdates(_0x3ad2c1['body'],null))[_0x7cb9('0x31')](respondWithResult(_0x13e8bc,null))['catch'](handleError(_0x13e8bc,null));};var utilLicense=require(_0x7cb9('0x17'));exports[_0x7cb9('0x59')]=function(_0xdf6225,_0x5cd4c1,_0x946215){var _0x301244=_0x7cb9('0x5a');var _0x5e00d7={'custom':![]};return utilLicense['getLicense']()[_0x7cb9('0x31')](function(_0x256727){if(_0x256727){_0x5e00d7=_0x256727;}return db[_0x7cb9('0x37')][_0x7cb9('0x51')]({'where':{'id':_0xdf6225[_0x7cb9('0x4f')]['id']},'attributes':[_0x7cb9('0x56'),'loginLogo',_0x7cb9('0x5b'),_0x7cb9('0x5c'),_0x7cb9('0x5d'),_0x7cb9('0x5e'),_0x7cb9('0x5f'),_0x7cb9('0x60')],'raw':!![]});})[_0x7cb9('0x31')](handleEntityNotFound(_0x5cd4c1,null))[_0x7cb9('0x31')](function(_0x4467b9){if(_0x4467b9){var _0x48a562=_0x4467b9[_0x7cb9('0x56')]&&fs['existsSync'](path['join'](config[_0x7cb9('0x61')],_0x301244,_[_0x7cb9('0x62')](_0x4467b9[_0x7cb9('0x56')])))?path['join'](config[_0x7cb9('0x61')],_0x301244,_[_0x7cb9('0x62')](_0x4467b9[_0x7cb9('0x56')])):path['join'](config[_0x7cb9('0x61')],_0x301244,_[_0x7cb9('0x62')](_0x7cb9('0x63')));var _0x57f7f6='default'+_['upperFirst'](_0x7cb9('0x56'));if(_0x4467b9[_0x57f7f6]||!_0x5e00d7[_0x7cb9('0x64')]){_0x48a562=path[_0x7cb9('0x65')](config[_0x7cb9('0x61')],_0x301244,_[_0x7cb9('0x62')]('default_logo.svg'));}if(!fs[_0x7cb9('0x66')](_0x48a562)){throw new db[(_0x7cb9('0x67'))][(_0x7cb9('0x68'))](_[_0x7cb9('0x69')]('logo')+_0x7cb9('0x6a'));}return _0x5cd4c1['download'](_0x48a562);}})[_0x7cb9('0x25')](handleError(_0x5cd4c1,null));};var utilLicense=require(_0x7cb9('0x17'));exports[_0x7cb9('0x6b')]=function(_0x27fdf4,_0x5f08fe,_0x169f08){var _0x35d631='server/files/images/logos';var _0x184ca2={'custom':![]};return utilLicense[_0x7cb9('0x6c')]()[_0x7cb9('0x31')](function(_0x16e111){if(_0x16e111){_0x184ca2=_0x16e111;}return db[_0x7cb9('0x37')][_0x7cb9('0x51')]({'where':{'id':_0x27fdf4[_0x7cb9('0x4f')]['id']},'attributes':[_0x7cb9('0x56'),_0x7cb9('0x58'),'preferred','favicon',_0x7cb9('0x5d'),_0x7cb9('0x5e'),_0x7cb9('0x5f'),_0x7cb9('0x60')],'raw':!![]});})[_0x7cb9('0x31')](handleEntityNotFound(_0x5f08fe,null))['then'](function(_0x1a3368){if(_0x1a3368){var _0x48cff6=_0x1a3368[_0x7cb9('0x58')]&&fs[_0x7cb9('0x66')](path[_0x7cb9('0x65')](config[_0x7cb9('0x61')],_0x35d631,_[_0x7cb9('0x62')](_0x1a3368[_0x7cb9('0x58')])))?path[_0x7cb9('0x65')](config[_0x7cb9('0x61')],_0x35d631,_[_0x7cb9('0x62')](_0x1a3368[_0x7cb9('0x58')])):path[_0x7cb9('0x65')](config['root'],_0x35d631,_[_0x7cb9('0x62')](_0x7cb9('0x6d')));var _0x48d69d=_0x7cb9('0x6e')+_['upperFirst'](_0x7cb9('0x58'));if(_0x1a3368[_0x48d69d]||!_0x184ca2[_0x7cb9('0x64')]){_0x48cff6=path['join'](config[_0x7cb9('0x61')],_0x35d631,_[_0x7cb9('0x62')]('default_loginLogo.svg'));}if(!fs[_0x7cb9('0x66')](_0x48cff6)){throw new db['Sequelize'][(_0x7cb9('0x68'))](_[_0x7cb9('0x69')]('loginLogo')+_0x7cb9('0x6a'));}return _0x5f08fe[_0x7cb9('0x6f')](_0x48cff6);}})[_0x7cb9('0x25')](handleError(_0x5f08fe,null));};exports['gdpr']=function(_0x3b98e7,_0x177bdb){return db[_0x7cb9('0x37')]['find']({'where':{'id':_0x3b98e7[_0x7cb9('0x4f')]['id']},'attributes':[_0x7cb9('0x70')]})[_0x7cb9('0x31')](respondWithResult(_0x177bdb,null))[_0x7cb9('0x25')](handleError(_0x177bdb,null));};exports['addPreferred']=function(_0x1bffb9,_0x19f0f6,_0xd0eec7){if(_0x1bffb9[_0x7cb9('0x54')]&&_0x1bffb9[_0x7cb9('0x54')][_0x7cb9('0x55')]){_0x1bffb9[_0x7cb9('0x52')]['preferred']=_0x1bffb9[_0x7cb9('0x54')][_0x7cb9('0x55')];}return db[_0x7cb9('0x37')][_0x7cb9('0x51')]({'where':{'id':_0x1bffb9['params']['id']}})[_0x7cb9('0x31')](handleEntityNotFound(_0x19f0f6,null))[_0x7cb9('0x31')](saveUpdates(_0x1bffb9[_0x7cb9('0x52')],null))[_0x7cb9('0x31')](respondWithResult(_0x19f0f6,null))[_0x7cb9('0x25')](handleError(_0x19f0f6,null));};var utilLicense=require(_0x7cb9('0x17'));exports[_0x7cb9('0x71')]=function(_0x398052,_0x70ce9e,_0x566940){var _0x4203b5=_0x7cb9('0x5a');var _0x6c0dcf={'custom':![]};return utilLicense[_0x7cb9('0x6c')]()[_0x7cb9('0x31')](function(_0x5f3842){if(_0x5f3842){_0x6c0dcf=_0x5f3842;}return db[_0x7cb9('0x37')][_0x7cb9('0x51')]({'where':{'id':_0x398052[_0x7cb9('0x4f')]['id']},'attributes':['logo',_0x7cb9('0x58'),'preferred',_0x7cb9('0x5c'),'defaultLogo',_0x7cb9('0x5e'),'defaultPreferred',_0x7cb9('0x60')],'raw':!![]});})[_0x7cb9('0x31')](handleEntityNotFound(_0x70ce9e,null))[_0x7cb9('0x31')](function(_0x1e9fb7){if(_0x1e9fb7){var _0x291f74=_0x1e9fb7[_0x7cb9('0x5b')]&&fs['existsSync'](path[_0x7cb9('0x65')](config[_0x7cb9('0x61')],_0x4203b5,_['toLower'](_0x1e9fb7[_0x7cb9('0x5b')])))?path[_0x7cb9('0x65')](config[_0x7cb9('0x61')],_0x4203b5,_[_0x7cb9('0x62')](_0x1e9fb7['preferred'])):path[_0x7cb9('0x65')](config[_0x7cb9('0x61')],_0x4203b5,_['toLower'](_0x7cb9('0x72')));var _0x2bea9c=_0x7cb9('0x6e')+_[_0x7cb9('0x69')](_0x7cb9('0x5b'));if(_0x1e9fb7[_0x2bea9c]||!_0x6c0dcf[_0x7cb9('0x64')]||!_0x6c0dcf['preferred']){_0x291f74=path['join'](config[_0x7cb9('0x61')],_0x4203b5,_[_0x7cb9('0x62')](_0x7cb9('0x72')));}if(!fs[_0x7cb9('0x66')](_0x291f74)){throw new db[(_0x7cb9('0x67'))][(_0x7cb9('0x68'))](_[_0x7cb9('0x69')]('preferred')+_0x7cb9('0x6a'));}return _0x70ce9e[_0x7cb9('0x6f')](_0x291f74);}})[_0x7cb9('0x25')](handleError(_0x70ce9e,null));};exports['addFavicon']=function(_0x40e00b,_0x514324,_0x209428){if(_0x40e00b[_0x7cb9('0x54')]&&_0x40e00b[_0x7cb9('0x54')][_0x7cb9('0x55')]){_0x40e00b[_0x7cb9('0x52')][_0x7cb9('0x5c')]=_0x40e00b[_0x7cb9('0x54')]['filename'];}return db[_0x7cb9('0x37')]['find']({'where':{'id':_0x40e00b['params']['id']}})[_0x7cb9('0x31')](handleEntityNotFound(_0x514324,null))[_0x7cb9('0x31')](saveUpdates(_0x40e00b['body'],null))[_0x7cb9('0x31')](respondWithResult(_0x514324,null))['catch'](handleError(_0x514324,null));};var utilLicense=require('../../config/license/util');exports[_0x7cb9('0x73')]=function(_0x1dcd73,_0x391599,_0xa6061b){var _0x43313a=_0x7cb9('0x5a');var _0x2b5150={'custom':![]};return utilLicense[_0x7cb9('0x6c')]()[_0x7cb9('0x31')](function(_0x232445){if(_0x232445){_0x2b5150=_0x232445;}return db[_0x7cb9('0x37')]['find']({'where':{'id':_0x1dcd73[_0x7cb9('0x4f')]['id']},'attributes':[_0x7cb9('0x56'),_0x7cb9('0x58'),_0x7cb9('0x5b'),_0x7cb9('0x5c'),_0x7cb9('0x5d'),_0x7cb9('0x5e'),'defaultPreferred',_0x7cb9('0x60')],'raw':!![]});})[_0x7cb9('0x31')](handleEntityNotFound(_0x391599,null))['then'](function(_0x5b9035){if(_0x5b9035){var _0x64ac87=_0x5b9035[_0x7cb9('0x5c')]&&fs[_0x7cb9('0x66')](path[_0x7cb9('0x65')](config[_0x7cb9('0x61')],_0x43313a,_['toLower'](_0x5b9035[_0x7cb9('0x5c')])))?path[_0x7cb9('0x65')](config['root'],_0x43313a,_['toLower'](_0x5b9035['favicon'])):path[_0x7cb9('0x65')](config[_0x7cb9('0x61')],_0x43313a,_[_0x7cb9('0x62')](_0x7cb9('0x74')));var _0xaf4b4b=_0x7cb9('0x6e')+_[_0x7cb9('0x69')](_0x7cb9('0x5c'));if(_0x5b9035[_0xaf4b4b]||!_0x2b5150[_0x7cb9('0x64')]){_0x64ac87=path[_0x7cb9('0x65')](config['root'],_0x43313a,_[_0x7cb9('0x62')]('default_favicon.ico'));}if(!fs[_0x7cb9('0x66')](_0x64ac87)){throw new db['Sequelize'][(_0x7cb9('0x68'))](_[_0x7cb9('0x69')]('favicon')+'\x20not\x20found');}return _0x391599['download'](_0x64ac87);}})[_0x7cb9('0x25')](handleError(_0x391599,null));};exports['getDate']=function(_0x1587d5,_0x210799){var _0x3e90e7={'offset':moment()[_0x7cb9('0x75')]()};_0x3e90e7[_0x7cb9('0x76')]=moment()[_0x7cb9('0x75')](_0x3e90e7[_0x7cb9('0x2a')])[_0x7cb9('0x77')](_0x7cb9('0x78'));return _0x210799['status'](0xc8)[_0x7cb9('0x34')](_0x3e90e7);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e516d2f..c9619c1 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x168d93,_0x1e2c69){var _0x2bf994=function(_0x180b58){while(--_0x180b58){_0x168d93['push'](_0x168d93['shift']());}};_0x2bf994(++_0x1e2c69);}(_0xedd9,0xfc));var _0x9edd=function(_0x141930,_0x227d8b){_0x141930=_0x141930-0x0;var _0x7ab51=_0xedd9[_0x141930];return _0x7ab51;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x55ca,0x126));var _0xa55c=function(_0x1f69bc,_0xaffd71){_0x1f69bc=_0x1f69bc-0x0;var _0x1ac3c5=_0x55ca[_0x1f69bc];return _0x1ac3c5;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 7d088b1..c34141c 100644 --- a/server/api/setting/setting.rpc.js +++ b/server/api/setting/setting.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66b2=['error','code','message','info','result','catch','ShowSetting','Setting','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4479e7,_0x3778f1){var _0x4b83f6=function(_0x376370){while(--_0x376370){_0x4479e7['push'](_0x4479e7['shift']());}};_0x4b83f6(++_0x3778f1);}(_0x66b2,0xc9));var _0x266b=function(_0x3a6685,_0x4c6316){_0x3a6685=_0x3a6685-0x0;var _0x9ed413=_0x66b2[_0x3a6685];return _0x9ed413;};'use strict';var _=require(_0x266b('0x0'));var util=require(_0x266b('0x1'));var moment=require('moment');var BPromise=require(_0x266b('0x2'));var rs=require(_0x266b('0x3'));var fs=require('fs');var Redis=require(_0x266b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x266b('0x5'))(_0x266b('0x6'));var config=require(_0x266b('0x7'));var jayson=require(_0x266b('0x8'));var client=jayson[_0x266b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c40ac,_0x39ea35,_0x1358f5){return new BPromise(function(_0x186826,_0x2088f9){return client['request'](_0x5c40ac,_0x1358f5)[_0x266b('0xa')](function(_0x545d55){logger['info'](_0x266b('0xb'),_0x39ea35,_0x266b('0xc'));logger[_0x266b('0xd')](_0x266b('0xe'),_0x39ea35,_0x266b('0xc'),JSON[_0x266b('0xf')](_0x545d55));if(_0x545d55[_0x266b('0x10')]){if(_0x545d55[_0x266b('0x10')][_0x266b('0x11')]===0x1f4){logger[_0x266b('0x10')]('Setting,\x20%s,\x20%s',_0x39ea35,_0x545d55['error'][_0x266b('0x12')]);return _0x2088f9(_0x545d55[_0x266b('0x10')][_0x266b('0x12')]);}logger[_0x266b('0x10')]('Setting,\x20%s,\x20%s',_0x39ea35,_0x545d55['error'][_0x266b('0x12')]);return _0x186826(_0x545d55[_0x266b('0x10')]['message']);}else{logger[_0x266b('0x13')](_0x266b('0xb'),_0x39ea35,_0x266b('0xc'));_0x186826(_0x545d55[_0x266b('0x14')][_0x266b('0x12')]);}})[_0x266b('0x15')](function(_0x1101ef){logger['error'](_0x266b('0xb'),_0x39ea35,_0x1101ef);_0x2088f9(_0x1101ef);});});}exports[_0x266b('0x16')]=function(_0x4a3928){var _0x316c1d=this;return new Promise(function(_0x12c600,_0x3a1566){return db[_0x266b('0x17')][_0x266b('0x18')]({'raw':_0x4a3928[_0x266b('0x19')]?_0x4a3928[_0x266b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4a3928[_0x266b('0x19')]?_0x4a3928[_0x266b('0x19')][_0x266b('0x1a')]||null:null,'attributes':_0x4a3928[_0x266b('0x19')]?_0x4a3928[_0x266b('0x19')][_0x266b('0x1b')]||null:null,'include':_0x4a3928['options']?_0x4a3928['options'][_0x266b('0x1c')]?_[_0x266b('0x1d')](_0x4a3928[_0x266b('0x19')][_0x266b('0x1c')],function(_0x131cb2){return{'model':db[_0x131cb2[_0x266b('0x1e')]],'as':_0x131cb2['as'],'attributes':_0x131cb2[_0x266b('0x1b')],'include':_0x131cb2[_0x266b('0x1c')]?_[_0x266b('0x1d')](_0x131cb2[_0x266b('0x1c')],function(_0x198d88){return{'model':db[_0x198d88[_0x266b('0x1e')]],'as':_0x198d88['as'],'attributes':_0x198d88['attributes'],'include':_0x198d88[_0x266b('0x1c')]?_['map'](_0x198d88[_0x266b('0x1c')],function(_0x5d392e){return{'model':db[_0x5d392e['model']],'as':_0x5d392e['as'],'attributes':_0x5d392e[_0x266b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x266b('0xa')](function(_0x361f6a){logger[_0x266b('0x13')](_0x266b('0x16'),_0x4a3928);logger[_0x266b('0xd')](_0x266b('0x16'),_0x4a3928,JSON[_0x266b('0xf')](_0x361f6a));_0x12c600(_0x361f6a);})[_0x266b('0x15')](function(_0x162fba){logger[_0x266b('0x10')](_0x266b('0x16'),_0x162fba[_0x266b('0x12')],_0x4a3928);_0x3a1566(_0x316c1d[_0x266b('0x10')](0x1f4,_0x162fba['message']));});});}; \ No newline at end of file +var _0xd9f3=['options','raw','where','map','include','attributes','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','ShowSetting'];(function(_0x504454,_0x59cc6f){var _0x2c4860=function(_0xfdee1a){while(--_0xfdee1a){_0x504454['push'](_0x504454['shift']());}};_0x2c4860(++_0x59cc6f);}(_0xd9f3,0x166));var _0x3d9f=function(_0x2c1e8f,_0x20b183){_0x2c1e8f=_0x2c1e8f-0x0;var _0x1796d6=_0xd9f3[_0x2c1e8f];return _0x1796d6;};'use strict';var _=require(_0x3d9f('0x0'));var util=require(_0x3d9f('0x1'));var moment=require(_0x3d9f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d9f('0x3'));var logger=require(_0x3d9f('0x4'))(_0x3d9f('0x5'));var config=require('../../config/environment');var jayson=require(_0x3d9f('0x6'));var client=jayson['client'][_0x3d9f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd80df4,_0x5cfdd3,_0xdd95bb){return new BPromise(function(_0x46cafa,_0x4a0750){return client[_0x3d9f('0x8')](_0xd80df4,_0xdd95bb)[_0x3d9f('0x9')](function(_0x4de9e2){logger[_0x3d9f('0xa')]('Setting,\x20%s,\x20%s',_0x5cfdd3,_0x3d9f('0xb'));logger[_0x3d9f('0xc')](_0x3d9f('0xd'),_0x5cfdd3,'request\x20sent',JSON[_0x3d9f('0xe')](_0x4de9e2));if(_0x4de9e2[_0x3d9f('0xf')]){if(_0x4de9e2[_0x3d9f('0xf')][_0x3d9f('0x10')]===0x1f4){logger[_0x3d9f('0xf')]('Setting,\x20%s,\x20%s',_0x5cfdd3,_0x4de9e2[_0x3d9f('0xf')][_0x3d9f('0x11')]);return _0x4a0750(_0x4de9e2[_0x3d9f('0xf')][_0x3d9f('0x11')]);}logger[_0x3d9f('0xf')](_0x3d9f('0x12'),_0x5cfdd3,_0x4de9e2['error'][_0x3d9f('0x11')]);return _0x46cafa(_0x4de9e2['error'][_0x3d9f('0x11')]);}else{logger[_0x3d9f('0xa')](_0x3d9f('0x12'),_0x5cfdd3,_0x3d9f('0xb'));_0x46cafa(_0x4de9e2['result'][_0x3d9f('0x11')]);}})['catch'](function(_0x470288){logger[_0x3d9f('0xf')](_0x3d9f('0x12'),_0x5cfdd3,_0x470288);_0x4a0750(_0x470288);});});}exports[_0x3d9f('0x13')]=function(_0x5d06c6){var _0x376102=this;return new Promise(function(_0x2c6356,_0x1461aa){return db['Setting']['find']({'raw':_0x5d06c6[_0x3d9f('0x14')]?_0x5d06c6['options'][_0x3d9f('0x15')]===undefined?!![]:![]:!![],'where':_0x5d06c6[_0x3d9f('0x14')]?_0x5d06c6[_0x3d9f('0x14')][_0x3d9f('0x16')]||null:null,'attributes':_0x5d06c6[_0x3d9f('0x14')]?_0x5d06c6[_0x3d9f('0x14')]['attributes']||null:null,'include':_0x5d06c6[_0x3d9f('0x14')]?_0x5d06c6[_0x3d9f('0x14')]['include']?_[_0x3d9f('0x17')](_0x5d06c6[_0x3d9f('0x14')][_0x3d9f('0x18')],function(_0x3a726e){return{'model':db[_0x3a726e['model']],'as':_0x3a726e['as'],'attributes':_0x3a726e[_0x3d9f('0x19')],'include':_0x3a726e[_0x3d9f('0x18')]?_[_0x3d9f('0x17')](_0x3a726e['include'],function(_0x4c7586){return{'model':db[_0x4c7586['model']],'as':_0x4c7586['as'],'attributes':_0x4c7586[_0x3d9f('0x19')],'include':_0x4c7586[_0x3d9f('0x18')]?_['map'](_0x4c7586[_0x3d9f('0x18')],function(_0x4270f2){return{'model':db[_0x4270f2['model']],'as':_0x4270f2['as'],'attributes':_0x4270f2[_0x3d9f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3d9f('0x9')](function(_0x36d3eb){logger['info']('ShowSetting',_0x5d06c6);logger[_0x3d9f('0xc')](_0x3d9f('0x13'),_0x5d06c6,JSON['stringify'](_0x36d3eb));_0x2c6356(_0x36d3eb);})[_0x3d9f('0x1a')](function(_0x229fad){logger[_0x3d9f('0xf')](_0x3d9f('0x13'),_0x229fad[_0x3d9f('0x11')],_0x5d06c6);_0x1461aa(_0x376102[_0x3d9f('0xf')](0x1f4,_0x229fad['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 978e54e..77de2ca 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x17fa64,_0x3c49c7){var _0x40ce75=function(_0x717a30){while(--_0x717a30){_0x17fa64['push'](_0x17fa64['shift']());}};_0x40ce75(++_0x3c49c7);}(_0x7a54,0x106));var _0x47a5=function(_0x182b62,_0x24f529){_0x182b62=_0x182b62-0x0;var _0x4b7429=_0x7a54[_0x182b62];return _0x4b7429;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x5dec1b,_0x315c8f){var _0x3558ab=function(_0x317227){while(--_0x317227){_0x5dec1b['push'](_0x5dec1b['shift']());}};_0x3558ab(++_0x315c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x30e14d,_0x55178b){_0x30e14d=_0x30e14d-0x0;var _0x2733b6=_0x7a54[_0x30e14d];return _0x2733b6;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3921029..0adbaad 100644 --- a/server/api/smsAccount/smsAccount.attributes.js +++ b/server/api/smsAccount/smsAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ab4=['sequelize','exports','STRING','name','generate','twilio','skebby','connectel','clickatell','bandwidth','csc','infobip','intelepeer','ENUM','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x6ab4,0xbd));var _0x46ab=function(_0x1d64e9,_0x312968){_0x1d64e9=_0x1d64e9-0x0;var _0x197892=_0x6ab4[_0x1d64e9];return _0x197892;};'use strict';var Sequelize=require(_0x46ab('0x0'));var rs=require('randomstring');module[_0x46ab('0x1')]={'name':{'type':Sequelize[_0x46ab('0x2')],'unique':_0x46ab('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x46ab('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x46ab('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x46ab('0x2')],'defaultValue':function(){return rs[_0x46ab('0x4')]();}},'phone':{'type':Sequelize[_0x46ab('0x2')]},'type':{'type':Sequelize['ENUM'](_0x46ab('0x5'),_0x46ab('0x6'),_0x46ab('0x7'),'clicksend','plivo',_0x46ab('0x8'),_0x46ab('0x9'),_0x46ab('0xa'),_0x46ab('0xb'),_0x46ab('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x46ab('0x2')]},'smsMethod':{'type':Sequelize[_0x46ab('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x46ab('0x2')]},'password':{'type':Sequelize[_0x46ab('0x2')]},'apiKey':{'type':Sequelize[_0x46ab('0x2')]},'applicationId':{'type':Sequelize[_0x46ab('0x2')]},'accountId':{'type':Sequelize[_0x46ab('0x2')]},'senderString':{'type':Sequelize[_0x46ab('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x46ab('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x46ab('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x46ab('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x46ab('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x46ab('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x46ab('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x46ab('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x46ab('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x46ab('0xf')],'comment':_0x46ab('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x46ab('0xe')],'defaultValue':![],'comment':_0x46ab('0x11'),'set':function(_0x347f01){if(!_0x347f01)this[_0x46ab('0x12')](_0x46ab('0x13'),null);this['setDataValue'](_0x46ab('0x14'),_0x347f01);}}}; \ No newline at end of file +var _0xf364=['mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x24218e,_0x4a4ab){var _0x1fc3d2=function(_0x5c10af){while(--_0x5c10af){_0x24218e['push'](_0x24218e['shift']());}};_0x1fc3d2(++_0x4a4ab);}(_0xf364,0x1e7));var _0x4f36=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xf364[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4f36('0x0'));module[_0x4f36('0x1')]={'name':{'type':Sequelize[_0x4f36('0x2')],'unique':_0x4f36('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4f36('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4f36('0x4')](_0x4f36('0x5'),'skebby','connectel','clicksend',_0x4f36('0x6'),_0x4f36('0x7'),_0x4f36('0x8'),_0x4f36('0x9'),'infobip',_0x4f36('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x4f36('0x2')]},'authToken':{'type':Sequelize[_0x4f36('0x2')]},'smsMethod':{'type':Sequelize[_0x4f36('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4f36('0x2')]},'apiKey':{'type':Sequelize[_0x4f36('0x2')]},'applicationId':{'type':Sequelize[_0x4f36('0x2')]},'accountId':{'type':Sequelize[_0x4f36('0x2')]},'senderString':{'type':Sequelize[_0x4f36('0x2')]},'deliveryReport':{'type':Sequelize[_0x4f36('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4f36('0xc');}},'notificationSound':{'type':Sequelize[_0x4f36('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4f36('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f36('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4f36('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f36('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4f36('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4f36('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4f36('0xb')],'defaultValue':![],'comment':_0x4f36('0xe'),'set':function(_0x55f107){if(!_0x55f107)this[_0x4f36('0xf')](_0x4f36('0x10'),null);this[_0x4f36('0xf')](_0x4f36('0x11'),_0x55f107);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 04227df..0541662 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8722=['rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','update','describe','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','refid','Sequelize','from\x20is\x20mandatory','isNil','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','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','User','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','Messages','dataValues','push','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','infobip','groupName','intelepeer','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','destroy','then','SmsAccounts','UserProfileResource','stack','index','Pause','mandatoryDispositionPause','map','SmsAccount'];(function(_0x9ee8b0,_0x46fd45){var _0x4925dc=function(_0x45ffe7){while(--_0x45ffe7){_0x9ee8b0['push'](_0x9ee8b0['shift']());}};_0x4925dc(++_0x46fd45);}(_0x8722,0x199));var _0x2872=function(_0x24afd1,_0x161fee){_0x24afd1=_0x24afd1-0x0;var _0xbb83=_0x8722[_0x24afd1];return _0xbb83;};'use strict';var emlformat=require(_0x2872('0x0'));var rimraf=require(_0x2872('0x1'));var zipdir=require(_0x2872('0x2'));var jsonpatch=require(_0x2872('0x3'));var rp=require('request-promise');var moment=require(_0x2872('0x4'));var BPromise=require(_0x2872('0x5'));var Mustache=require(_0x2872('0x6'));var util=require(_0x2872('0x7'));var path=require(_0x2872('0x8'));var sox=require(_0x2872('0x9'));var csv=require(_0x2872('0xa'));var ejs=require(_0x2872('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2872('0xc'));var crypto=require(_0x2872('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2872('0xe'));var toCsv=require(_0x2872('0xa'));var querystring=require(_0x2872('0xf'));var Papa=require(_0x2872('0x10'));var Redis=require(_0x2872('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2872('0x12'));var as=require(_0x2872('0x13'));var hardwareService=require(_0x2872('0x14'));var logger=require('../../config/logger')(_0x2872('0x15'));var utils=require(_0x2872('0x16'));var config=require(_0x2872('0x17'));var licenseUtil=require(_0x2872('0x18'));var db=require(_0x2872('0x19'))['db'];config[_0x2872('0x1a')]=_['defaults'](config[_0x2872('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2872('0x1b'))(new Redis(config[_0x2872('0x1a')]));require(_0x2872('0x1c'))[_0x2872('0x1d')](socket);var jayson=require(_0x2872('0x1e'));var client=jayson['client'][_0x2872('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3c635a,_0x3f2d0c,_0x26ff59,_0x4b8f41){return new BPromise(function(_0x278f69,_0x2d3a5c){var _0x1e4a2b=_0x4b8f41||client;return _0x1e4a2b[_0x2872('0x20')](_0x3c635a,_0x26ff59)['then'](function(_0x50282a){logger[_0x2872('0x21')](_0x2872('0x22'),_0x3f2d0c,_0x2872('0x23'));logger['debug'](_0x2872('0x24'),_0x3f2d0c,'request\x20sent',JSON['stringify'](_0x50282a));if(_0x50282a[_0x2872('0x25')]){if(_0x50282a[_0x2872('0x25')][_0x2872('0x26')]===0x1f4){logger[_0x2872('0x25')](_0x2872('0x22'),_0x3f2d0c,_0x50282a['error'][_0x2872('0x27')]);return _0x2d3a5c(_0x50282a['error'][_0x2872('0x27')]);}logger[_0x2872('0x25')]('SmsAccount,\x20%s,\x20%s',_0x3f2d0c,_0x50282a[_0x2872('0x25')][_0x2872('0x27')]);return _0x278f69(_0x50282a['error'][_0x2872('0x27')]);}else{logger[_0x2872('0x21')](_0x2872('0x22'),_0x3f2d0c,_0x2872('0x23'));_0x278f69(_0x50282a[_0x2872('0x28')][_0x2872('0x27')]);}})[_0x2872('0x29')](function(_0x2a8aa4){logger[_0x2872('0x25')]('SmsAccount,\x20%s,\x20%s',_0x3f2d0c,_0x2a8aa4);_0x2d3a5c(_0x2a8aa4);});});}function respondWithStatusCode(_0x4fd7fc,_0x3a182e){_0x3a182e=_0x3a182e||0xcc;return function(_0x20644c){if(_0x20644c){return _0x4fd7fc[_0x2872('0x2a')](_0x3a182e);}return _0x4fd7fc[_0x2872('0x2b')](_0x3a182e)[_0x2872('0x2c')]();};}function respondWithResult(_0x295e8e,_0x39237e){_0x39237e=_0x39237e||0xc8;return function(_0x3042cd){if(_0x3042cd){return _0x295e8e[_0x2872('0x2b')](_0x39237e)['json'](_0x3042cd);}};}function respondWithFilteredResult(_0xb3efdc,_0x56a64f){return function(_0x4b7d57){if(_0x4b7d57){var _0x5d7c1a=typeof _0x56a64f[_0x2872('0x2d')]==='undefined'&&typeof _0x56a64f[_0x2872('0x2e')]===_0x2872('0x2f');var _0xc01a59=_0x4b7d57[_0x2872('0x30')];var _0x591394=_0x5d7c1a?0x0:_0x56a64f[_0x2872('0x2d')];var _0x50592f=_0x5d7c1a?_0x4b7d57[_0x2872('0x30')]:_0x56a64f[_0x2872('0x2d')]+_0x56a64f[_0x2872('0x2e')];var _0x48f119;if(_0x50592f>=_0xc01a59){_0x50592f=_0xc01a59;_0x48f119=0xc8;}else{_0x48f119=0xce;}_0xb3efdc['status'](_0x48f119);return _0xb3efdc[_0x2872('0x31')](_0x2872('0x32'),_0x591394+'-'+_0x50592f+'/'+_0xc01a59)[_0x2872('0x33')](_0x4b7d57);}return null;};}function patchUpdates(_0x343ca0){return function(_0x19aa47){try{jsonpatch[_0x2872('0x34')](_0x19aa47,_0x343ca0,!![]);}catch(_0x19af71){return BPromise[_0x2872('0x35')](_0x19af71);}return _0x19aa47[_0x2872('0x36')]();};}function saveUpdates(_0x204b40,_0x4c0692){return function(_0x187feb){if(_0x187feb){return _0x187feb['update'](_0x204b40)['then'](function(_0x23c34d){return _0x23c34d;});}return null;};}function removeEntity(_0x424e63,_0x2d8c6b){return function(_0x212691){if(_0x212691){return _0x212691[_0x2872('0x37')]()[_0x2872('0x38')](function(){var _0x2b5df7=_0x212691['get']({'plain':!![]});var _0x43eece=_0x2872('0x39');return db[_0x2872('0x3a')][_0x2872('0x37')]({'where':{'type':_0x43eece,'resourceId':_0x2b5df7['id']}})[_0x2872('0x38')](function(){return _0x212691;});})[_0x2872('0x38')](function(){_0x424e63[_0x2872('0x2b')](0xcc)[_0x2872('0x2c')]();});}};}function handleEntityNotFound(_0x5257a9,_0x341b1a){return function(_0x39f33a){if(!_0x39f33a){_0x5257a9[_0x2872('0x2a')](0x194);}return _0x39f33a;};}function handleError(_0x14b7e9,_0x474b28){_0x474b28=_0x474b28||0x1f4;return function(_0x4158f8){logger[_0x2872('0x25')](_0x4158f8[_0x2872('0x3b')]);if(_0x4158f8['name']){delete _0x4158f8['name'];}_0x14b7e9[_0x2872('0x2b')](_0x474b28)['send'](_0x4158f8);};}exports[_0x2872('0x3c')]=function(_0x2b86d8,_0x56cdd6){var _0x467fce={'include':[{'model':db[_0x2872('0x3d')],'as':_0x2872('0x3e')}]},_0x4f364c={},_0x3ddf5d={'count':0x0,'rows':[]};var _0x88b5bc=_[_0x2872('0x3f')](db[_0x2872('0x40')][_0x2872('0x41')],function(_0x434f9d){return{'name':_0x434f9d[_0x2872('0x42')],'type':_0x434f9d[_0x2872('0x43')]['key']};});_0x4f364c[_0x2872('0x44')]=_[_0x2872('0x3f')](_0x88b5bc,_0x2872('0x45'));_0x4f364c['query']=_[_0x2872('0x46')](_0x2b86d8[_0x2872('0x47')]);_0x4f364c[_0x2872('0x48')]=_[_0x2872('0x49')](_0x4f364c[_0x2872('0x44')],_0x4f364c[_0x2872('0x47')]);_0x467fce[_0x2872('0x4a')]=_[_0x2872('0x49')](_0x4f364c[_0x2872('0x44')],qs[_0x2872('0x4b')](_0x2b86d8[_0x2872('0x47')][_0x2872('0x4b')]));_0x467fce[_0x2872('0x4a')]=_0x467fce['attributes'][_0x2872('0x4c')]?_0x467fce[_0x2872('0x4a')]:_0x4f364c[_0x2872('0x44')];if(!_0x2b86d8[_0x2872('0x47')]['hasOwnProperty'](_0x2872('0x4d'))){_0x467fce['limit']=qs[_0x2872('0x2e')](_0x2b86d8['query'][_0x2872('0x2e')]);_0x467fce['offset']=qs[_0x2872('0x2d')](_0x2b86d8[_0x2872('0x47')]['offset']);}_0x467fce[_0x2872('0x4e')]=qs[_0x2872('0x4f')](_0x2b86d8[_0x2872('0x47')][_0x2872('0x4f')]);_0x467fce[_0x2872('0x50')]=qs[_0x2872('0x48')](_['pick'](_0x2b86d8['query'],_0x4f364c[_0x2872('0x48')]),_0x88b5bc);if(_0x2b86d8[_0x2872('0x47')][_0x2872('0x51')]){_0x467fce['where']=_[_0x2872('0x52')](_0x467fce[_0x2872('0x50')],{'$or':_[_0x2872('0x3f')](_0x88b5bc,function(_0x1146cf){if(_0x1146cf[_0x2872('0x43')]!=='VIRTUAL'){var _0x56ae98={};_0x56ae98[_0x1146cf[_0x2872('0x45')]]={'$like':'%'+_0x2b86d8['query']['filter']+'%'};return _0x56ae98;}})});}_0x467fce=_[_0x2872('0x52')]({},_0x467fce,_0x2b86d8[_0x2872('0x53')]);var _0x280981={'where':_0x467fce['where']};return db[_0x2872('0x40')][_0x2872('0x30')](_0x280981)[_0x2872('0x38')](function(_0x3fbac0){_0x3ddf5d[_0x2872('0x30')]=_0x3fbac0;if(_0x2b86d8['query'][_0x2872('0x54')]){_0x467fce[_0x2872('0x55')]=[{'all':!![]}];}return db[_0x2872('0x40')][_0x2872('0x56')](_0x467fce);})['then'](function(_0x321aac){_0x3ddf5d['rows']=_0x321aac;return _0x3ddf5d;})[_0x2872('0x38')](respondWithFilteredResult(_0x56cdd6,_0x467fce))['catch'](handleError(_0x56cdd6,null));};exports['show']=function(_0x43a96c,_0x2cb068){var _0x4942a8={'raw':![],'where':{'id':_0x43a96c[_0x2872('0x57')]['id']},'include':[{'model':db[_0x2872('0x3d')],'as':_0x2872('0x3e')}]},_0x4b5b0f={};_0x4b5b0f[_0x2872('0x44')]=_[_0x2872('0x46')](db['SmsAccount'][_0x2872('0x41')]);_0x4b5b0f[_0x2872('0x47')]=_[_0x2872('0x46')](_0x43a96c['query']);_0x4b5b0f[_0x2872('0x48')]=_[_0x2872('0x49')](_0x4b5b0f[_0x2872('0x44')],_0x4b5b0f[_0x2872('0x47')]);_0x4942a8[_0x2872('0x4a')]=_[_0x2872('0x49')](_0x4b5b0f['model'],qs[_0x2872('0x4b')](_0x43a96c[_0x2872('0x47')][_0x2872('0x4b')]));_0x4942a8['attributes']=_0x4942a8[_0x2872('0x4a')][_0x2872('0x4c')]?_0x4942a8[_0x2872('0x4a')]:_0x4b5b0f['model'];if(_0x43a96c[_0x2872('0x47')][_0x2872('0x54')]){_0x4942a8[_0x2872('0x55')]=[{'all':!![]}];}_0x4942a8=_[_0x2872('0x52')]({},_0x4942a8,_0x43a96c[_0x2872('0x53')]);return db['SmsAccount'][_0x2872('0x58')](_0x4942a8)['then'](handleEntityNotFound(_0x2cb068,null))[_0x2872('0x38')](respondWithResult(_0x2cb068,null))['catch'](handleError(_0x2cb068,null));};exports['create']=function(_0x5cf308,_0x2b9853){return db['SmsAccount'][_0x2872('0x59')](_0x5cf308[_0x2872('0x5a')],{})[_0x2872('0x38')](function(_0xfc4680){var _0xecd02a=_0x5cf308[_0x2872('0x5b')][_0x2872('0x5c')]({'plain':!![]});if(!_0xecd02a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xecd02a[_0x2872('0x5d')]==='user'){var _0x2a4d7e=_0xfc4680[_0x2872('0x5c')]({'plain':!![]});var _0x38e1f8=_0x2872('0x39');return db[_0x2872('0x5e')]['find']({'where':{'name':_0x38e1f8,'userProfileId':_0xecd02a[_0x2872('0x5f')]},'raw':!![]})[_0x2872('0x38')](function(_0xb360ed){if(_0xb360ed&&_0xb360ed[_0x2872('0x60')]===0x0){return db[_0x2872('0x3a')][_0x2872('0x59')]({'name':_0x2a4d7e['name'],'resourceId':_0x2a4d7e['id'],'type':_0xb360ed[_0x2872('0x45')],'sectionId':_0xb360ed['id']},{})[_0x2872('0x38')](function(){return _0xfc4680;});}else{return _0xfc4680;}})[_0x2872('0x29')](function(_0x568c8c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x568c8c);throw _0x568c8c;});}return _0xfc4680;})[_0x2872('0x38')](respondWithResult(_0x2b9853,0xc9))[_0x2872('0x29')](handleError(_0x2b9853,null));};exports[_0x2872('0x61')]=function(_0x471ce8,_0x1f9d21){if(_0x471ce8[_0x2872('0x5a')]['id']){delete _0x471ce8[_0x2872('0x5a')]['id'];}return db[_0x2872('0x40')][_0x2872('0x58')]({'where':{'id':_0x471ce8[_0x2872('0x57')]['id']},'include':[{'model':db[_0x2872('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x2872('0x38')](handleEntityNotFound(_0x1f9d21,null))['then'](saveUpdates(_0x471ce8[_0x2872('0x5a')],null))[_0x2872('0x38')](respondWithResult(_0x1f9d21,null))['catch'](handleError(_0x1f9d21,null));};exports[_0x2872('0x37')]=function(_0x3ff1a6,_0x1a472d){return db[_0x2872('0x40')][_0x2872('0x58')]({'where':{'id':_0x3ff1a6[_0x2872('0x57')]['id']}})['then'](handleEntityNotFound(_0x1a472d,null))[_0x2872('0x38')](removeEntity(_0x1a472d,null))['catch'](handleError(_0x1a472d,null));};exports[_0x2872('0x62')]=function(_0x3fe96c,_0x99911f){return db['SmsAccount'][_0x2872('0x62')]()['then'](respondWithResult(_0x99911f,null))['catch'](handleError(_0x99911f,null));};exports['addDisposition']=function(_0x656267,_0x3dd18a,_0x565362){if(_0x656267[_0x2872('0x5a')]['id']){delete _0x656267[_0x2872('0x5a')]['id'];}return db[_0x2872('0x40')][_0x2872('0x58')]({'where':{'id':_0x656267[_0x2872('0x57')]['id']}})[_0x2872('0x38')](handleEntityNotFound(_0x3dd18a,null))[_0x2872('0x38')](function(_0x688a6d){if(_0x688a6d){_0x656267[_0x2872('0x5a')][_0x2872('0x63')]=_0x688a6d['id'];return db[_0x2872('0x64')][_0x2872('0x59')](_0x656267[_0x2872('0x5a')]);}})[_0x2872('0x38')](respondWithResult(_0x3dd18a,null))[_0x2872('0x29')](handleError(_0x3dd18a,null));};exports[_0x2872('0x65')]=function(_0x523199,_0x32eff4,_0x2ac6e6){var _0x4acf33={'raw':![],'where':{}};var _0xd7d997={};var _0x34f293={'count':0x0,'rows':[]};return db['SmsAccount'][_0x2872('0x66')]({'where':{'id':_0x523199[_0x2872('0x57')]['id']}})[_0x2872('0x38')](handleEntityNotFound(_0x32eff4,null))[_0x2872('0x38')](function(_0x4e8576){if(_0x4e8576){_0xd7d997['model']=_[_0x2872('0x46')](db[_0x2872('0x64')][_0x2872('0x41')]);_0xd7d997[_0x2872('0x47')]=_[_0x2872('0x46')](_0x523199['query']);_0xd7d997['filters']=_[_0x2872('0x49')](_0xd7d997['model'],_0xd7d997[_0x2872('0x47')]);_0x4acf33['attributes']=_[_0x2872('0x49')](_0xd7d997[_0x2872('0x44')],qs[_0x2872('0x4b')](_0x523199['query']['fields']));_0x4acf33['attributes']=_0x4acf33[_0x2872('0x4a')][_0x2872('0x4c')]?_0x4acf33[_0x2872('0x4a')]:_0xd7d997[_0x2872('0x44')];if(!_0x523199['query'][_0x2872('0x67')](_0x2872('0x4d'))){_0x4acf33[_0x2872('0x2e')]=qs[_0x2872('0x2e')](_0x523199[_0x2872('0x47')]['limit']);_0x4acf33[_0x2872('0x2d')]=qs['offset'](_0x523199[_0x2872('0x47')]['offset']);}_0x4acf33[_0x2872('0x4e')]=qs[_0x2872('0x4f')](_0x523199[_0x2872('0x47')][_0x2872('0x4f')]);_0x4acf33[_0x2872('0x50')]=qs[_0x2872('0x48')](_['pick'](_0x523199[_0x2872('0x47')],_0xd7d997[_0x2872('0x48')]));_0x4acf33['where'][_0x2872('0x63')]=_0x4e8576['id'];if(_0x523199[_0x2872('0x47')][_0x2872('0x51')]){_0x4acf33[_0x2872('0x50')]=_[_0x2872('0x52')](_0x4acf33['where'],{'$or':_[_0x2872('0x3f')](_0x4acf33[_0x2872('0x4a')],function(_0x3aaa71){var _0x2af02d={};_0x2af02d[_0x3aaa71]={'$like':'%'+_0x523199['query'][_0x2872('0x51')]+'%'};return _0x2af02d;})});}_0x4acf33=_[_0x2872('0x52')]({},_0x4acf33,_0x523199[_0x2872('0x53')]);return db[_0x2872('0x64')][_0x2872('0x30')]({'where':_0x4acf33[_0x2872('0x50')]})[_0x2872('0x38')](function(_0x1347af){_0x34f293[_0x2872('0x30')]=_0x1347af;if(_0x523199[_0x2872('0x47')][_0x2872('0x54')]){_0x4acf33['include']=[{'all':!![]}];}return db[_0x2872('0x64')][_0x2872('0x56')](_0x4acf33);})['then'](function(_0x2745c8){_0x34f293[_0x2872('0x68')]=_0x2745c8;return _0x34f293;});}})['then'](respondWithFilteredResult(_0x32eff4,_0x4acf33))[_0x2872('0x29')](handleError(_0x32eff4,null));};exports[_0x2872('0x69')]=function(_0x41cd5e,_0x10da8f,_0x43926c){return db['SmsAccount'][_0x2872('0x58')]({'where':{'id':_0x41cd5e[_0x2872('0x57')]['id']}})[_0x2872('0x38')](handleEntityNotFound(_0x10da8f,null))[_0x2872('0x38')](function(_0x35e82f){if(_0x35e82f){return _0x35e82f[_0x2872('0x69')](_0x41cd5e[_0x2872('0x47')][_0x2872('0x6a')]);}})['then'](respondWithStatusCode(_0x10da8f,null))[_0x2872('0x29')](handleError(_0x10da8f,null));};exports[_0x2872('0x6b')]=function(_0xdf47e2,_0x437700,_0xcbbbec){if(_0xdf47e2['body']['id']){delete _0xdf47e2['body']['id'];}return db[_0x2872('0x40')][_0x2872('0x58')]({'where':{'id':_0xdf47e2['params']['id']}})[_0x2872('0x38')](handleEntityNotFound(_0x437700,null))[_0x2872('0x38')](function(_0x5b717a){if(_0x5b717a){_0xdf47e2[_0x2872('0x5a')]['SmsAccountId']=_0x5b717a['id'];return db[_0x2872('0x6c')]['create'](_0xdf47e2[_0x2872('0x5a')]);}})[_0x2872('0x38')](respondWithResult(_0x437700,null))[_0x2872('0x29')](handleError(_0x437700,null));};exports[_0x2872('0x6d')]=function(_0x5ac298,_0x1e9e48,_0x425143){var _0x500e86={'raw':![],'where':{}};var _0x20f9ed={};var _0x2bfe37={'count':0x0,'rows':[]};return db[_0x2872('0x40')][_0x2872('0x66')]({'where':{'id':_0x5ac298[_0x2872('0x57')]['id']}})['then'](handleEntityNotFound(_0x1e9e48,null))[_0x2872('0x38')](function(_0x2f839d){if(_0x2f839d){_0x20f9ed[_0x2872('0x44')]=_['keys'](db['CannedAnswer'][_0x2872('0x41')]);_0x20f9ed[_0x2872('0x47')]=_[_0x2872('0x46')](_0x5ac298[_0x2872('0x47')]);_0x20f9ed[_0x2872('0x48')]=_[_0x2872('0x49')](_0x20f9ed[_0x2872('0x44')],_0x20f9ed['query']);_0x500e86[_0x2872('0x4a')]=_['intersection'](_0x20f9ed[_0x2872('0x44')],qs[_0x2872('0x4b')](_0x5ac298[_0x2872('0x47')][_0x2872('0x4b')]));_0x500e86[_0x2872('0x4a')]=_0x500e86[_0x2872('0x4a')][_0x2872('0x4c')]?_0x500e86[_0x2872('0x4a')]:_0x20f9ed[_0x2872('0x44')];if(!_0x5ac298[_0x2872('0x47')][_0x2872('0x67')](_0x2872('0x4d'))){_0x500e86[_0x2872('0x2e')]=qs[_0x2872('0x2e')](_0x5ac298['query'][_0x2872('0x2e')]);_0x500e86[_0x2872('0x2d')]=qs['offset'](_0x5ac298[_0x2872('0x47')][_0x2872('0x2d')]);}_0x500e86[_0x2872('0x4e')]=qs['sort'](_0x5ac298[_0x2872('0x47')][_0x2872('0x4f')]);_0x500e86[_0x2872('0x50')]=qs[_0x2872('0x48')](_[_0x2872('0x6e')](_0x5ac298[_0x2872('0x47')],_0x20f9ed[_0x2872('0x48')]));_0x500e86[_0x2872('0x50')][_0x2872('0x63')]=_0x2f839d['id'];if(_0x5ac298[_0x2872('0x47')][_0x2872('0x51')]){_0x500e86['where']=_[_0x2872('0x52')](_0x500e86[_0x2872('0x50')],{'$or':_[_0x2872('0x3f')](_0x500e86['attributes'],function(_0xd68f6c){var _0xa2339b={};_0xa2339b[_0xd68f6c]={'$like':'%'+_0x5ac298[_0x2872('0x47')][_0x2872('0x51')]+'%'};return _0xa2339b;})});}_0x500e86=_[_0x2872('0x52')]({},_0x500e86,_0x5ac298[_0x2872('0x53')]);return db['CannedAnswer']['count']({'where':_0x500e86[_0x2872('0x50')]})[_0x2872('0x38')](function(_0xfbd9ea){_0x2bfe37[_0x2872('0x30')]=_0xfbd9ea;if(_0x5ac298[_0x2872('0x47')][_0x2872('0x54')]){_0x500e86['include']=[{'all':!![]}];}return db[_0x2872('0x6c')][_0x2872('0x56')](_0x500e86);})[_0x2872('0x38')](function(_0x4fbc89){_0x2bfe37[_0x2872('0x68')]=_0x4fbc89;return _0x2bfe37;});}})[_0x2872('0x38')](respondWithFilteredResult(_0x1e9e48,_0x500e86))[_0x2872('0x29')](handleError(_0x1e9e48,null));};exports['removeAnswers']=function(_0x293aaa,_0x1f4033,_0x5c0985){return db['SmsAccount'][_0x2872('0x58')]({'where':{'id':_0x293aaa['params']['id']}})['then'](handleEntityNotFound(_0x1f4033,null))[_0x2872('0x38')](function(_0xf9801a){if(_0xf9801a){return _0xf9801a[_0x2872('0x6f')](_0x293aaa['query'][_0x2872('0x6a')]);}})['then'](respondWithStatusCode(_0x1f4033,null))[_0x2872('0x29')](handleError(_0x1f4033,null));};exports[_0x2872('0x70')]=function(_0x1d08eb,_0x3c7e58,_0x5ccbe5){var _0xe0914d={'channel':_0x2872('0x71')};var _0x138f38=[];var _0x1d88f5=[];var _0x2d566d={};return db[_0x2872('0x40')]['find']({'where':{'id':_0x1d08eb['params']['id']},'include':[{'model':db[_0x2872('0x72')],'as':_0x2872('0x73')}]})[_0x2872('0x38')](handleEntityNotFound(_0x3c7e58,null))[_0x2872('0x38')](function(_0x60df9f){_0xe0914d[_0x2872('0x74')]=_0x60df9f;_0xe0914d[_0x2872('0x75')]=_[_0x2872('0x76')](_0x60df9f[_0x2872('0x73')],[_0x2872('0x77')],['asc']);if(_0xe0914d['account'][_0x2872('0x73')]){delete _0xe0914d['account'][_0x2872('0x73')];}return db[_0x2872('0x78')][_0x2872('0x62')]();})[_0x2872('0x38')](function(_0xbb00fe){if(!_0xbb00fe){throw new db['Sequelize'][(_0x2872('0x79'))](_0x2872('0x7a'));}_0x138f38=_[_0x2872('0x7b')](_[_0x2872('0x46')](_0xbb00fe),[_0x2872('0x7c'),'updatedAt']);_0x1d88f5=_[_0x2872('0x7b')](_[_0x2872('0x46')](_0xbb00fe),[_0x2872('0x7c'),_0x2872('0x7d'),_0x2872('0x7e'),_0x2872('0x7f')]);_0xe0914d[_0x2872('0x5a')]={'mapKey':_0x2872('0x80')};if(_0xe0914d[_0x2872('0x74')]['type']){switch(_0xe0914d['account']['type']){case _0x2872('0x81'):_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x83')];_0xe0914d[_0x2872('0x5a')][_0x2872('0x5a')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x84')];_0xe0914d[_0x2872('0x5a')][_0x2872('0x85')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x86')];break;case _0x2872('0x87'):_0xe0914d[_0x2872('0x5a')]['from']='+'+_0x1d08eb[_0x2872('0x5a')][_0x2872('0x88')];_0xe0914d[_0x2872('0x5a')]['body']=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x89')];break;case _0x2872('0x8a'):_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x82')];_0xe0914d['body'][_0x2872('0x5a')]=_0x1d08eb[_0x2872('0x5a')]['message'];break;case _0x2872('0x8b'):_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')]=_0x1d08eb['body']['from'];_0xe0914d[_0x2872('0x5a')][_0x2872('0x5a')]=_0x1d08eb['body'][_0x2872('0x5a')];_0xe0914d[_0x2872('0x5a')][_0x2872('0x85')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x8c')];break;case _0x2872('0x8d'):_0xe0914d['body'][_0x2872('0x82')]=_0x1d08eb[_0x2872('0x5a')]['From'];_0xe0914d[_0x2872('0x5a')][_0x2872('0x5a')]=_0x1d08eb[_0x2872('0x5a')]['Text'];_0xe0914d[_0x2872('0x5a')][_0x2872('0x85')]=_0x1d08eb['body'][_0x2872('0x8e')];break;case'infobip':_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')]='+'+_0x1d08eb[_0x2872('0x5a')][_0x2872('0x8f')][0x0][_0x2872('0x82')];_0xe0914d[_0x2872('0x5a')][_0x2872('0x5a')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x8f')][0x0]['text'];_0xe0914d[_0x2872('0x5a')][_0x2872('0x85')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x8f')][0x0][_0x2872('0x85')];break;case _0x2872('0x90'):_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x91')];_0xe0914d['body']['body']=_0x1d08eb[_0x2872('0x5a')]['segmentedMessage'][_0x2872('0x27')];break;case _0x2872('0x92'):_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x93')];_0xe0914d[_0x2872('0x5a')][_0x2872('0x5a')]=_0x1d08eb['body'][_0x2872('0x89')];_0xe0914d[_0x2872('0x5a')][_0x2872('0x85')]=_0x1d08eb['body'][_0x2872('0x94')];break;case _0x2872('0x95'):_0xe0914d[_0x2872('0x5a')][_0x2872('0x85')]=_0x1d08eb[_0x2872('0x5a')][0x0][_0x2872('0x27')]['id'];_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')]=_0x1d08eb[_0x2872('0x5a')][0x0][_0x2872('0x27')]['from'];_0xe0914d[_0x2872('0x5a')][_0x2872('0x5a')]=_0x1d08eb['body'][0x0]['message']['text'];break;case'intelepeer':_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x82')];_0xe0914d['body'][_0x2872('0x5a')]=_0x1d08eb[_0x2872('0x5a')]['message'];_0xe0914d['body'][_0x2872('0x85')]=_0x1d08eb[_0x2872('0x5a')][_0x2872('0x96')];break;}}if(_0xe0914d['body']['id']){delete _0xe0914d[_0x2872('0x5a')]['id'];}if(_['isNil'](_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')])){throw new db[(_0x2872('0x97'))]['ValidationError'](_0x2872('0x98'));}if(_[_0x2872('0x99')](_0xe0914d[_0x2872('0x5a')]['body'])||_0xe0914d['body'][_0x2872('0x5a')]===''){throw new db[(_0x2872('0x97'))][(_0x2872('0x79'))](_0x2872('0x9a'));}if(_[_0x2872('0x99')](_0xe0914d[_0x2872('0x5a')][_0x2872('0x9b')])){throw new db[(_0x2872('0x97'))]['ValidationError'](_0x2872('0x9c')+_0x1d88f5);}if(!_[_0x2872('0x9d')](_0x1d88f5,_0xe0914d[_0x2872('0x5a')][_0x2872('0x9b')])){throw new db[(_0x2872('0x97'))][(_0x2872('0x79'))](_0x2872('0x9e')+_0x1d88f5);}_0x2d566d[_0xe0914d[_0x2872('0x5a')][_0x2872('0x9b')]]=_0xe0914d['body'][_0x2872('0x82')];return db[_0x2872('0x9f')][_0x2872('0x58')]({'where':{'id':_0xe0914d['account'][_0x2872('0x7f')]},'include':[{'model':db[_0x2872('0x78')],'as':_0x2872('0xa0'),'where':_0x2d566d,'limit':0x1,'order':[[_0x2872('0x7d'),_0x2872('0xa1')]]}]});})[_0x2872('0x38')](handleEntityNotFound(_0x3c7e58,null))[_0x2872('0x38')](function(_0x45198a){if(_0x45198a){_0xe0914d[_0x2872('0xa2')]=_[_0x2872('0xa3')](_0x45198a,[_0x2872('0xa0')]);if(_0x45198a[_0x2872('0xa0')][_0x2872('0x4c')]){return _0x45198a[_0x2872('0xa0')][0x0];}var _0x135b1a=_[_0x2872('0xa4')](_0xe0914d['body'],{'firstName':_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')],'ListId':_0x45198a['id']});_0x135b1a[_0xe0914d[_0x2872('0x5a')]['mapKey']]=_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')];return db[_0x2872('0x78')]['create'](_0x135b1a,{'fields':_0x138f38,'raw':!![]});}})['then'](handleEntityNotFound(_0x3c7e58,null))[_0x2872('0x38')](function(_0x56df4b){if(_0x56df4b){_0xe0914d[_0x2872('0xa5')]=_0x56df4b;var _0x1712ba={'ContactId':_0x56df4b['id'],'phone':_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')],'SmsAccountId':_0x1d08eb[_0x2872('0x57')]['id']};var _0x428da7={'ContactId':_0x56df4b['id'],'SmsAccountId':_0x1d08eb[_0x2872('0x57')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x428da7})[_0x2872('0x38')](function(_0xf40a74){if(_0xf40a74){return[_0xf40a74,![]];}return db[_0x2872('0xa6')]['create'](_0x1712ba)[_0x2872('0x38')](function(_0x3bea9f){return[_0x3bea9f,!![]];});});}})[_0x2872('0xa7')](function(_0x54c129,_0x4df953){_0xe0914d[_0x2872('0xa8')]=_0x54c129[_0x2872('0x5c')]({'plain':!![]});_0xe0914d['interaction'][_0x2872('0xa9')]=![];if(_0x4df953){if(_0xe0914d[_0x2872('0x74')]['autoclose']){_0xe0914d[_0x2872('0x75')]['push']({'id':0x0,'priority':_0xe0914d[_0x2872('0x75')][_0x2872('0x4c')]+0x1,'app':_0x2872('0xaa'),'appdata':_0x2872('0xab'),'interval':_0x2872('0xac')});}_0xe0914d[_0x2872('0xa8')]['created']=!![];}return db[_0x2872('0xad')][_0x2872('0x59')]({'phone':_0xe0914d[_0x2872('0x5a')][_0x2872('0x82')],'messageId':_0xe0914d[_0x2872('0x5a')][_0x2872('0x85')],'body':_0xe0914d[_0x2872('0x5a')]['body'],'SmsAccountId':_0x1d08eb['params']['id'],'SmsInteractionId':_0x54c129['id'],'direction':'in','ContactId':_0x54c129[_0x2872('0xae')],'AttachmentId':_0xe0914d[_0x2872('0x5a')][_0x2872('0xaf')]});})['then'](function(_0x132b2e){_0xe0914d['message']=_0x132b2e;if(!_0xe0914d[_0x2872('0xa8')]['UserId'])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0xe0914d['interaction'][_0x2872('0xb0')]}});})[_0x2872('0x38')](function(_0x2d9df1){if(_0x2d9df1){_0xe0914d['applications'][_0x2872('0xb1')]({'id':0x0,'priority':0x0,'app':_0x2872('0xb2'),'appdata':_0x2d9df1[_0x2872('0x45')]+','+(_0xe0914d[_0x2872('0x74')][_0x2872('0xb3')]||0xa),'interval':_0x2872('0xac')});}if(!_0xe0914d['interaction'][_0x2872('0xb4')])return;return db[_0x2872('0xb5')]['find']({'attributes':['id',_0x2872('0x45')],'where':{'id':_0xe0914d[_0x2872('0xa8')][_0x2872('0xb4')]}});})['then'](function(_0x1f6d78){if(_0x1f6d78){_0xe0914d[_0x2872('0x75')][_0x2872('0xb1')]({'id':0x0,'priority':0x1,'app':_0x2872('0xb6'),'appdata':_0x1f6d78[_0x2872('0x45')]+','+(_0xe0914d['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x2872('0xac')});}return respondWithRpcPromise('Start',_0x2872('0xb7'),_0xe0914d);})['then'](function(_0x5fff5c){if(_0x5fff5c){var _0x48aa45=0xc8;var _0x5b6df0='receiveMessage';logger[_0x2872('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b6df0,_0x48aa45,_0x2872('0xb8'));logger['debug'](_0x2872('0xb9'),_0x5b6df0,_0x48aa45,_0x2872('0xb8'),JSON[_0x2872('0xba')](_0x5fff5c));if(_0xe0914d['account']['type']===_0x2872('0x81')){return _0x3c7e58[_0x2872('0x2b')](_0x48aa45)[_0x2872('0x31')](_0x2872('0xbb'),_0x2872('0xbc'))[_0x2872('0xbd')]('\x0a');}else{return _0x3c7e58[_0x2872('0x2b')](_0x48aa45)[_0x2872('0x33')](_0x5fff5c);}}})['catch'](handleError(_0x3c7e58,null));};exports[_0x2872('0xbe')]=function(_0x3a4d64,_0x2f9f17){var _0x9c2e37=_0x3a4d64[_0x2872('0x57')]['id'];var _0xeb9296=_0x3a4d64[_0x2872('0x5a')];var _0x12a9c6=0xc8;var _0x51d9e3=null;return db[_0x2872('0xbf')][_0x2872('0xc0')]({'isolationLevel':db[_0x2872('0xbf')][_0x2872('0xc1')][_0x2872('0xc2')][_0x2872('0xc3')]},function(_0x32b097){return db[_0x2872('0x40')][_0x2872('0x66')]({'where':{'id':_0x9c2e37},'transaction':_0x32b097})[_0x2872('0x38')](function(_0x501502){if(_0x501502){return db[_0x2872('0x72')][_0x2872('0x37')]({'where':{'SmsAccountId':_0x9c2e37},'transaction':_0x32b097})[_0x2872('0x38')](function(){var _0x230d17=_[_0x2872('0x3f')](_0xeb9296,function(_0x238aa8){_0x238aa8['SmsAccountId']=_0x9c2e37;return _0x238aa8;});return db[_0x2872('0x72')][_0x2872('0xc4')](_0x230d17,{'transaction':_0x32b097});});}else{_0x12a9c6=0x194;_0x51d9e3=[];}});})[_0x2872('0x38')](function(){if(_0x12a9c6!==0x194){return db['SmsApplication'][_0x2872('0xc5')]({'where':{'SmsAccountId':_0x9c2e37},'order':_0x2872('0x77')})['then'](function(_0x2b223d){_0x51d9e3=_0x2b223d;});}})[_0x2872('0x29')](function(_0x4b00b8){_0x12a9c6=0x1f4;logger[_0x2872('0x25')](_0x4b00b8[_0x2872('0x3b')]);if(_0x4b00b8[_0x2872('0x45')]){delete _0x4b00b8[_0x2872('0x45')];}_0x51d9e3=_0x4b00b8;})[_0x2872('0xc6')](function(){if(_0x51d9e3===null){_0x2f9f17[_0x2872('0x2a')](_0x12a9c6);}else{if(_0x12a9c6===0x1f4){_0x2f9f17[_0x2872('0x2b')](_0x12a9c6)[_0x2872('0xbd')](_0x51d9e3);}else{_0x2f9f17[_0x2872('0x2b')](_0x12a9c6)[_0x2872('0x33')](_0x51d9e3);}}});};exports['getApplications']=function(_0x55f726,_0x204f5d,_0x266aa1){var _0x5c84e2={};var _0x13c1bf={};var _0x2e655b;var _0x7f54e6;return db[_0x2872('0x40')]['findOne']({'where':{'id':_0x55f726[_0x2872('0x57')]['id']}})[_0x2872('0x38')](handleEntityNotFound(_0x204f5d,null))[_0x2872('0x38')](function(_0xb5cbd7){if(_0xb5cbd7){_0x2e655b=_0xb5cbd7;_0x13c1bf[_0x2872('0x44')]=_[_0x2872('0x46')](db['SmsApplication'][_0x2872('0x41')]);_0x13c1bf['query']=_['keys'](_0x55f726[_0x2872('0x47')]);_0x13c1bf[_0x2872('0x48')]=_[_0x2872('0x49')](_0x13c1bf['model'],_0x13c1bf[_0x2872('0x47')]);_0x5c84e2[_0x2872('0x4a')]=_[_0x2872('0x49')](_0x13c1bf[_0x2872('0x44')],qs[_0x2872('0x4b')](_0x55f726['query'][_0x2872('0x4b')]));_0x5c84e2[_0x2872('0x4a')]=_0x5c84e2[_0x2872('0x4a')][_0x2872('0x4c')]?_0x5c84e2[_0x2872('0x4a')]:_0x13c1bf['model'];_0x5c84e2['order']=qs['sort'](_0x55f726[_0x2872('0x47')]['sort']);_0x5c84e2['where']=qs['filters'](_[_0x2872('0x6e')](_0x55f726[_0x2872('0x47')],_0x13c1bf[_0x2872('0x48')]));if(_0x55f726[_0x2872('0x47')][_0x2872('0x51')]){_0x5c84e2['where']=_[_0x2872('0x52')](_0x5c84e2[_0x2872('0x50')],{'$or':_[_0x2872('0x3f')](_0x5c84e2[_0x2872('0x4a')],function(_0x3df205){var _0x5b6e54={};_0x5b6e54[_0x3df205]={'$like':'%'+_0x55f726[_0x2872('0x47')][_0x2872('0x51')]+'%'};return _0x5b6e54;})});}_0x5c84e2=_[_0x2872('0x52')]({},_0x5c84e2,_0x55f726['options']);return _0x2e655b[_0x2872('0xc7')](_0x5c84e2);}})['then'](function(_0x42b75b){if(_0x42b75b){_0x7f54e6=_0x42b75b['length'];if(!_0x55f726[_0x2872('0x47')][_0x2872('0x67')](_0x2872('0x4d'))){_0x5c84e2[_0x2872('0x2e')]=qs[_0x2872('0x2e')](_0x55f726[_0x2872('0x47')]['limit']);_0x5c84e2[_0x2872('0x2d')]=qs['offset'](_0x55f726[_0x2872('0x47')][_0x2872('0x2d')]);}return _0x2e655b[_0x2872('0xc7')](_0x5c84e2);}})['then'](function(_0x117d94){if(_0x117d94){return _0x117d94?{'count':_0x7f54e6,'rows':_0x117d94}:null;}})[_0x2872('0x38')](respondWithResult(_0x204f5d,null))['catch'](handleError(_0x204f5d,null));};exports['getInteractions']=function(_0x4bc7f8,_0x530c42,_0x594a38){var _0x543777={'raw':![],'where':{}};var _0xb7c065={};var _0x31053e={'count':0x0,'rows':[]};return db[_0x2872('0x40')][_0x2872('0x66')]({'where':{'id':_0x4bc7f8[_0x2872('0x57')]['id']}})[_0x2872('0x38')](handleEntityNotFound(_0x530c42,null))['then'](function(_0xb7a33f){if(_0xb7a33f){_0xb7c065['model']=_[_0x2872('0x46')](db[_0x2872('0xa6')][_0x2872('0x41')]);_0xb7c065[_0x2872('0x47')]=_['keys'](_0x4bc7f8['query']);_0xb7c065[_0x2872('0x48')]=_[_0x2872('0x49')](_0xb7c065[_0x2872('0x44')],_0xb7c065[_0x2872('0x47')]);_0x543777['attributes']=_[_0x2872('0x49')](_0xb7c065[_0x2872('0x44')],qs[_0x2872('0x4b')](_0x4bc7f8[_0x2872('0x47')][_0x2872('0x4b')]));_0x543777[_0x2872('0x4a')]=_0x543777[_0x2872('0x4a')][_0x2872('0x4c')]?_0x543777[_0x2872('0x4a')]:_0xb7c065[_0x2872('0x44')];if(!_0x4bc7f8['query'][_0x2872('0x67')](_0x2872('0x4d'))){_0x543777[_0x2872('0x2e')]=qs[_0x2872('0x2e')](_0x4bc7f8[_0x2872('0x47')]['limit']);_0x543777[_0x2872('0x2d')]=qs[_0x2872('0x2d')](_0x4bc7f8[_0x2872('0x47')][_0x2872('0x2d')]);}_0x543777[_0x2872('0x4e')]=qs['sort'](_0x4bc7f8[_0x2872('0x47')][_0x2872('0x4f')]);_0x543777['where']=qs[_0x2872('0x48')](_[_0x2872('0x6e')](_0x4bc7f8['query'],_0xb7c065[_0x2872('0x48')]));_0x543777['where'][_0x2872('0x63')]=_0xb7a33f['id'];if(_0x4bc7f8[_0x2872('0x47')][_0x2872('0x51')]){_0x543777['where']=_['merge'](_0x543777[_0x2872('0x50')],{'$or':_['map'](_0x543777[_0x2872('0x4a')],function(_0xac2b04){var _0x3cc450={};_0x3cc450[_0xac2b04]={'$like':'%'+_0x4bc7f8['query'][_0x2872('0x51')]+'%'};return _0x3cc450;})});}_0x543777=_[_0x2872('0x52')]({},_0x543777,_0x4bc7f8['options']);return db[_0x2872('0xa6')][_0x2872('0x30')]({'where':_0x543777[_0x2872('0x50')]})[_0x2872('0x38')](function(_0x4ec941){_0x31053e[_0x2872('0x30')]=_0x4ec941;if(_0x4bc7f8[_0x2872('0x47')][_0x2872('0x54')]){_0x543777[_0x2872('0x55')]=[{'model':db[_0x2872('0x78')],'as':'Contact','required':![]},{'model':db[_0x2872('0xc8')],'as':_0x2872('0xc9'),'attributes':[_0x2872('0x45'),_0x2872('0xca'),_0x2872('0xcb')],'required':![]},{'model':db['Tag'],'as':_0x2872('0xcc'),'attributes':['id',_0x2872('0x45'),'color'],'where':_0x4bc7f8[_0x2872('0x47')][_0x2872('0xcd')]?{'id':_0x4bc7f8[_0x2872('0x47')][_0x2872('0xcd')]}:undefined,'required':_0x4bc7f8[_0x2872('0x47')][_0x2872('0xcd')]?!![]:![]}];}return db[_0x2872('0xa6')]['findAll'](_0x543777);})['then'](function(_0x2ed98d){_0x31053e[_0x2872('0x68')]=_0x2ed98d;return _0x31053e;});}})['then'](respondWithFilteredResult(_0x530c42,_0x543777))['catch'](handleError(_0x530c42,null));};exports['send']=function(_0x430b73,_0x3d4e4b,_0x70ba5a){var _0x20e080,_0x1c1a7b,_0x4aabbd;if(_[_0x2872('0x99')](_0x430b73[_0x2872('0x5a')][_0x2872('0x5a')])||_0x430b73[_0x2872('0x5a')][_0x2872('0x5a')]===''){throw new db[(_0x2872('0x97'))][(_0x2872('0x79'))](_0x2872('0x9a'));}if(_[_0x2872('0x99')](_0x430b73[_0x2872('0x5a')]['to'])){throw new db[(_0x2872('0x97'))][(_0x2872('0x79'))](_0x2872('0xce'));}_0x20e080=_0x430b73[_0x2872('0x5a')]['to'];return db['SmsAccount'][_0x2872('0x58')]({'where':{'id':_0x430b73[_0x2872('0x57')]['id']},'include':[{'model':db[_0x2872('0x9f')],'as':_0x2872('0xcf'),'include':[{'model':db[_0x2872('0x78')],'as':_0x2872('0xa0'),'where':{'mobile':_0x20e080},'limit':0x1,'order':[[_0x2872('0x7d'),_0x2872('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x3d4e4b,null))['then'](function(_0x1bee9e){if(_0x1bee9e&&_0x1bee9e[_0x2872('0xcf')]){_0x1c1a7b=_0x1bee9e['get']({'plain':!![]});if(_0x1c1a7b[_0x2872('0xcf')]&&_0x1c1a7b[_0x2872('0xcf')]['Contacts']['length']){return _0x1c1a7b[_0x2872('0xcf')][_0x2872('0xa0')][0x0];}return db[_0x2872('0x78')][_0x2872('0x59')](_[_0x2872('0xa4')](_0x430b73[_0x2872('0x5a')],{'firstName':_0x20e080,'mobile':_0x20e080,'phone':_0x20e080,'ListId':_0x1c1a7b[_0x2872('0x7f')]}));}})[_0x2872('0x38')](handleEntityNotFound(_0x3d4e4b,null))[_0x2872('0x38')](function(_0x5b3324){if(_0x5b3324){_0x4aabbd=_0x5b3324;return db[_0x2872('0xa6')]['find']({'where':{'ContactId':_0x4aabbd['id'],'closed':![],'SmsAccountId':_0x1c1a7b['id']}})['then'](function(_0x391f03){if(_0x391f03){return[_0x391f03,![]];}return db[_0x2872('0xa6')][_0x2872('0x59')]({'UserId':_0x430b73[_0x2872('0x5b')]['id'],'ContactId':_0x4aabbd['id'],'SmsAccountId':_0x1c1a7b['id'],'phone':_0x20e080,'firstMsgDirection':'out','Messages':[_[_0x2872('0x52')](_0x430b73['body'],{'read':![],'body':_0x430b73[_0x2872('0x5a')][_0x2872('0x5a')],'phone':_0x20e080,'SmsAccountId':_0x1c1a7b['id'],'UserId':_0x430b73[_0x2872('0x5b')]['id'],'ContactId':_0x4aabbd['id']})]},{'include':[{'model':db[_0x2872('0xad')],'as':_0x2872('0xd0')}]})[_0x2872('0x38')](function(_0x3fb5ee){return[_0x3fb5ee,!![]];});});}})['spread'](function(_0x25a99b,_0x391024){if(_0x391024){return _0x25a99b;}return db[_0x2872('0xad')][_0x2872('0x59')](_[_0x2872('0x52')](_0x430b73[_0x2872('0x5a')],{'read':![],'body':_0x430b73[_0x2872('0x5a')][_0x2872('0x5a')],'phone':_0x20e080,'SmsAccountId':_0x1c1a7b['id'],'SmsInteractionId':_0x25a99b['id'],'UserId':_0x430b73[_0x2872('0x5b')]['id'],'ContactId':_0x4aabbd['id']}))[_0x2872('0x38')](function(_0x158c86){_0x25a99b['dataValues'][_0x2872('0xd0')]=[];_0x25a99b[_0x2872('0xd1')][_0x2872('0xd0')][_0x2872('0xd2')](_0x158c86[_0x2872('0xd1')]);return _0x25a99b;});})['then'](respondWithResult(_0x3d4e4b,null))[_0x2872('0x29')](handleError(_0x3d4e4b,null));};exports['status']=function(_0x587bf7,_0x51626e,_0x486f3a){if(_0x587bf7['body']['id']){delete _0x587bf7[_0x2872('0x5a')]['id'];}var _0x15a139,_0xe27061,_0xa54acd;return db[_0x2872('0x40')][_0x2872('0x58')]({'where':{'id':_0x587bf7[_0x2872('0x57')]['id']}})[_0x2872('0x38')](handleEntityNotFound(_0x51626e,null))[_0x2872('0x38')](function(_0x42cbcc){if(_0x42cbcc){_0xa54acd=_0x42cbcc;logger[_0x2872('0xd3')](_0x2872('0x24'),'status',_0x2872('0xd4'),_0x42cbcc[_0x2872('0x43')],util[_0x2872('0xd5')](_0x587bf7['body'],{'showHidden':![],'depth':null}));switch(_0x42cbcc[_0x2872('0x43')]){case _0x2872('0x87'):if(_0x587bf7['body'][_0x2872('0xd6')]&&_0x587bf7[_0x2872('0x5a')][_0x2872('0x2b')]){_0xe27061=_0x587bf7[_0x2872('0x5a')][_0x2872('0x2b')];return db[_0x2872('0xad')]['find']({'where':{'messageId':_0x587bf7[_0x2872('0x5a')]['skebby_dispatch_id']}});}break;case _0x2872('0x8a'):if(_0x587bf7[_0x2872('0x5a')]['requestid']&&_0x587bf7[_0x2872('0x5a')][_0x2872('0xd7')]){_0xe27061=_0x587bf7[_0x2872('0x5a')][_0x2872('0xd7')];return db[_0x2872('0xad')][_0x2872('0x58')]({'where':{'messageId':_0x587bf7['body'][_0x2872('0xd8')]}});}break;case _0x2872('0x8b'):if(_0x587bf7[_0x2872('0x5a')]['message_id']&&_0x587bf7[_0x2872('0x5a')]['status_code']){_0xe27061=_0x587bf7['body'][_0x2872('0xd9')];return db['SmsMessage'][_0x2872('0x58')]({'where':{'messageId':_0x587bf7[_0x2872('0x5a')][_0x2872('0x8c')]}});}break;case _0x2872('0xda'):var _0x4dd341=_0x587bf7[_0x2872('0x5a')][_0x2872('0x8f')][0x0];if(_0x4dd341[_0x2872('0x85')]&&_0x4dd341['status'][_0x2872('0xdb')]==='DELIVERED'){_0xe27061=_0x4dd341[_0x2872('0x2b')][_0x2872('0xdb')];return db[_0x2872('0xad')]['find']({'where':{'messageId':_0x4dd341[_0x2872('0x85')]}});}break;case _0x2872('0x92'):if(_0x587bf7['body']['messageId']&&_0x587bf7['body'][_0x2872('0x2b')]){_0xe27061=_0x587bf7[_0x2872('0x5a')][_0x2872('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x587bf7[_0x2872('0x5a')][_0x2872('0x85')]}});}break;case _0x2872('0x95'):if(_0x587bf7[_0x2872('0x5a')][0x0][_0x2872('0x27')]['id']){_0xe27061=_0x587bf7[_0x2872('0x5a')][0x0][_0x2872('0x43')];return db['SmsMessage'][_0x2872('0x58')]({'where':{'messageId':_0x587bf7[_0x2872('0x5a')][0x0][_0x2872('0x27')]['id']}});}break;case _0x2872('0xdc'):if(_0x587bf7['body'][_0x2872('0xdd')]&&_0x587bf7[_0x2872('0x5a')]['status']){_0xe27061=_0x587bf7[_0x2872('0x5a')][_0x2872('0x2b')];return db[_0x2872('0xad')][_0x2872('0x58')]({'where':{'messageId':_0x587bf7[_0x2872('0x5a')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x51626e,null))[_0x2872('0x38')](function(_0x19b5e3){if(_0x19b5e3){_0x15a139=_0x19b5e3;switch(_0xa54acd['type']){case _0x2872('0x87'):if(_0xe27061===_0x2872('0xde')){return _0x15a139[_0x2872('0x61')]({'read':!![]});}else{logger['error'](_0x2872('0x24'),'status',_0x2872('0x87'),util[_0x2872('0xd5')](_0x587bf7[_0x2872('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2872('0x8a'):if(_0xe27061==='1'){return _0x15a139[_0x2872('0x61')]({'read':!![]});}else{logger[_0x2872('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x2872('0x87'),util['inspect'](_0x587bf7[_0x2872('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2872('0x8b'):if(!_0x587bf7[_0x2872('0x5a')]['error_code']&&_0xe27061>=0xc8&&_0xe27061<=0xce){return _0x15a139['update']({'read':!![]});}else{logger['error'](_0x2872('0x24'),_0x2872('0x2b'),_0x2872('0x8b'),util[_0x2872('0xd5')](_0x587bf7[_0x2872('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2872('0xda'):var _0x3f4077=_0x587bf7[_0x2872('0x5a')][_0x2872('0x8f')][0x0];if(_0x3f4077[_0x2872('0x2b')][_0x2872('0xdb')]===_0x2872('0xde')){return _0x15a139[_0x2872('0x61')]({'read':!![]});}else{logger[_0x2872('0x25')](_0x2872('0x24'),_0x2872('0x2b'),_0x2872('0xda'),util[_0x2872('0xd5')](_0x587bf7[_0x2872('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xe27061==_0x2872('0xdf')||_0xe27061==_0x2872('0xe0')){return _0x15a139[_0x2872('0x61')]({'read':!![]});}else{logger[_0x2872('0x25')](_0x2872('0x24'),_0x2872('0x2b'),_0x2872('0x92'),util[_0x2872('0xd5')](_0x587bf7['body'],{'showHidden':![],'depth':null}));}break;case _0x2872('0x95'):if(_0xe27061==_0x2872('0xe1')){return _0x15a139[_0x2872('0x61')]({'read':!![]});}else{logger[_0x2872('0x25')](_0x2872('0x24'),_0x2872('0x2b'),_0x2872('0x95'),util['inspect'](_0x587bf7[_0x2872('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2872('0xdc'):if(_0xe27061==='DELIVRD'||_0xe27061===_0x2872('0xe2')){return _0x15a139[_0x2872('0x61')]({'read':!![]});}else{logger[_0x2872('0x25')](_0x2872('0x24'),'status',_0x2872('0xdc'),util[_0x2872('0xd5')](_0x587bf7[_0x2872('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x15a139;}})[_0x2872('0x38')](respondWithResult(_0x51626e,null))[_0x2872('0x29')](handleError(_0x51626e,null));};exports[_0x2872('0xe3')]=function(_0x8f62de,_0x2c1466,_0x19050c){var _0x523960,_0x32cde0,_0x5ab6ac;return db[_0x2872('0x40')]['find']({'where':{'id':_0x8f62de['params']['id']}})['then'](handleEntityNotFound(_0x2c1466,null))[_0x2872('0x38')](function(_0x2cedd2){if(_0x2cedd2){_0x5ab6ac=_0x2cedd2;logger['debug'](_0x2872('0x24'),_0x2872('0x2b'),'received\x20delivery\x20report\x20from',_0x2cedd2[_0x2872('0x43')],util[_0x2872('0xd5')](_0x8f62de['query'],{'showHidden':![],'depth':null}));switch(_0x2cedd2[_0x2872('0x43')]){case _0x2872('0x90'):if(_0x8f62de['query'][_0x2872('0xe4')]&&_0x8f62de[_0x2872('0x47')][_0x2872('0xe5')]){_0x32cde0=_0x8f62de[_0x2872('0x47')][_0x2872('0xe5')];return db[_0x2872('0xad')][_0x2872('0x58')]({'where':{'messageId':_0x8f62de[_0x2872('0x47')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x2c1466,null))[_0x2872('0x38')](function(_0x2b5624){if(_0x2b5624){_0x523960=_0x2b5624;switch(_0x5ab6ac[_0x2872('0x43')]){case _0x2872('0x90'):if(_0x32cde0==='2'||_0x32cde0==='6'){return _0x523960['update']({'read':!![]});}else{logger['error'](_0x2872('0x24'),_0x2872('0x2b'),_0x2872('0x90'),util[_0x2872('0xd5')](_0x8f62de[_0x2872('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x523960;}})['then'](respondWithResult(_0x2c1466,null))[_0x2872('0x29')](handleError(_0x2c1466,null));};exports[_0x2872('0xe6')]=function(_0x1f7a0e,_0x7e1fbb,_0x25f8b0){return db[_0x2872('0x40')][_0x2872('0x58')]({'where':{'id':_0x1f7a0e[_0x2872('0x57')]['id']}})['then'](handleEntityNotFound(_0x7e1fbb,null))['then'](function(_0xa30526){if(_0xa30526){return _0xa30526[_0x2872('0xe6')](_0x1f7a0e[_0x2872('0x5a')][_0x2872('0x6a')],_['omit'](_0x1f7a0e['body'],[_0x2872('0x6a'),'id'])||{})['spread'](function(_0x3acef4){for(var _0x42c4b9=0x0;_0x42c4b9<_0x1f7a0e[_0x2872('0x5a')][_0x2872('0x6a')][_0x2872('0x4c')];_0x42c4b9+=0x1){socket[_0x2872('0xe7')](_0x2872('0xe8'),{'UserId':Number(_0x1f7a0e['body'][_0x2872('0x6a')][_0x42c4b9]),'SmsAccountId':Number(_0x1f7a0e['params']['id'])});}return _0x3acef4;});}})[_0x2872('0x38')](respondWithResult(_0x7e1fbb,null))['catch'](handleError(_0x7e1fbb,null));};exports['removeAgents']=function(_0x366bc0,_0xe5e89d,_0x22332c){return db['SmsAccount']['find']({'where':{'id':_0x366bc0[_0x2872('0x57')]['id']}})[_0x2872('0x38')](handleEntityNotFound(_0xe5e89d,null))[_0x2872('0x38')](function(_0x1317d6){if(_0x1317d6){return _0x1317d6[_0x2872('0xe9')](_0x366bc0[_0x2872('0x47')][_0x2872('0x6a')])['then'](function(){if(_[_0x2872('0xea')](_0x366bc0[_0x2872('0x47')][_0x2872('0x6a')])){for(var _0x59f213=0x0;_0x59f213<_0x366bc0[_0x2872('0x47')][_0x2872('0x6a')][_0x2872('0x4c')];_0x59f213+=0x1){socket[_0x2872('0xe7')]('userSmsAccount:remove',{'UserId':Number(_0x366bc0[_0x2872('0x47')][_0x2872('0x6a')][_0x59f213]),'SmsAccountId':Number(_0x366bc0[_0x2872('0x57')]['id'])});}}else{socket[_0x2872('0xe7')](_0x2872('0xeb'),{'UserId':Number(_0x366bc0[_0x2872('0x47')][_0x2872('0x6a')]),'SmsAccountId':Number(_0x366bc0[_0x2872('0x57')]['id'])});}});}})[_0x2872('0x38')](respondWithStatusCode(_0xe5e89d,null))['catch'](handleError(_0xe5e89d,null));};exports[_0x2872('0xec')]=function(_0xc5c59f,_0x271e7b,_0x377f22){var _0x59e974={};var _0x44e4d7={};var _0xde6420;var _0x23fef1;return db[_0x2872('0x40')][_0x2872('0x66')]({'where':{'id':_0xc5c59f[_0x2872('0x57')]['id']}})[_0x2872('0x38')](handleEntityNotFound(_0x271e7b,null))[_0x2872('0x38')](function(_0x5853b9){if(_0x5853b9){_0xde6420=_0x5853b9;_0x44e4d7['model']=_['keys'](db[_0x2872('0xc8')][_0x2872('0x41')]);_0x44e4d7[_0x2872('0x47')]=_[_0x2872('0x46')](_0xc5c59f[_0x2872('0x47')]);_0x44e4d7[_0x2872('0x48')]=_[_0x2872('0x49')](_0x44e4d7[_0x2872('0x44')],_0x44e4d7[_0x2872('0x47')]);_0x59e974[_0x2872('0x4a')]=_[_0x2872('0x49')](_0x44e4d7['model'],qs[_0x2872('0x4b')](_0xc5c59f[_0x2872('0x47')][_0x2872('0x4b')]));_0x59e974[_0x2872('0x4a')]=_0x59e974[_0x2872('0x4a')][_0x2872('0x4c')]?_0x59e974[_0x2872('0x4a')]:_0x44e4d7[_0x2872('0x44')];_0x59e974[_0x2872('0x4e')]=qs[_0x2872('0x4f')](_0xc5c59f[_0x2872('0x47')][_0x2872('0x4f')]);_0x59e974[_0x2872('0x50')]=qs[_0x2872('0x48')](_[_0x2872('0x6e')](_0xc5c59f[_0x2872('0x47')],_0x44e4d7[_0x2872('0x48')]));if(_0xc5c59f[_0x2872('0x47')][_0x2872('0x51')]){_0x59e974[_0x2872('0x50')]=_['merge'](_0x59e974['where'],{'$or':_[_0x2872('0x3f')](_0x59e974[_0x2872('0x4a')],function(_0x1fceba){var _0x441adf={};_0x441adf[_0x1fceba]={'$like':'%'+_0xc5c59f['query'][_0x2872('0x51')]+'%'};return _0x441adf;})});}_0x59e974=_[_0x2872('0x52')]({},_0x59e974,_0xc5c59f[_0x2872('0x53')]);return _0xde6420['getAgents'](_0x59e974);}})[_0x2872('0x38')](function(_0x14308a){if(_0x14308a){_0x23fef1=_0x14308a['length'];if(!_0xc5c59f[_0x2872('0x47')][_0x2872('0x67')](_0x2872('0x4d'))){_0x59e974[_0x2872('0x2e')]=qs['limit'](_0xc5c59f[_0x2872('0x47')][_0x2872('0x2e')]);_0x59e974['offset']=qs[_0x2872('0x2d')](_0xc5c59f['query'][_0x2872('0x2d')]);}return _0xde6420[_0x2872('0xec')](_0x59e974);}})['then'](function(_0x4b07e4){if(_0x4b07e4){return _0x4b07e4?{'count':_0x23fef1,'rows':_0x4b07e4}:null;}})[_0x2872('0x38')](respondWithResult(_0x271e7b,null))[_0x2872('0x29')](handleError(_0x271e7b,null));}; \ No newline at end of file +var _0xd530=['length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','Pause','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','account','applications','Applications','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','messageId','MessageSid','sender','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','info','entity\x20found','twilio','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','bulkCreate','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsAccount.socket','register','jayson/promise','client','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x308375,_0x3a93cc){var _0x18d40c=function(_0x21bbbf){while(--_0x21bbbf){_0x308375['push'](_0x308375['shift']());}};_0x18d40c(++_0x3a93cc);}(_0xd530,0x9b));var _0x0d53=function(_0x23acaf,_0x5de00a){_0x23acaf=_0x23acaf-0x0;var _0x2a774f=_0xd530[_0x23acaf];return _0x2a774f;};'use strict';var emlformat=require(_0x0d53('0x0'));var rimraf=require(_0x0d53('0x1'));var zipdir=require(_0x0d53('0x2'));var jsonpatch=require(_0x0d53('0x3'));var rp=require(_0x0d53('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0d53('0x5'));var sox=require(_0x0d53('0x6'));var csv=require(_0x0d53('0x7'));var ejs=require(_0x0d53('0x8'));var fs=require('fs');var fs_extra=require(_0x0d53('0x9'));var _=require(_0x0d53('0xa'));var squel=require('squel');var crypto=require(_0x0d53('0xb'));var jsforce=require(_0x0d53('0xc'));var deskjs=require(_0x0d53('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0d53('0xe'));var Papa=require(_0x0d53('0xf'));var Redis=require(_0x0d53('0x10'));var authService=require(_0x0d53('0x11'));var qs=require(_0x0d53('0x12'));var as=require(_0x0d53('0x13'));var hardwareService=require(_0x0d53('0x14'));var logger=require('../../config/logger')(_0x0d53('0x15'));var utils=require(_0x0d53('0x16'));var config=require(_0x0d53('0x17'));var licenseUtil=require(_0x0d53('0x18'));var db=require(_0x0d53('0x19'))['db'];config[_0x0d53('0x1a')]=_[_0x0d53('0x1b')](config[_0x0d53('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d53('0x1a')]));require(_0x0d53('0x1c'))[_0x0d53('0x1d')](socket);var jayson=require(_0x0d53('0x1e'));var client=jayson[_0x0d53('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3a2112,_0x25c058,_0x9e18f,_0x151a81){return new BPromise(function(_0x46e894,_0x83eeef){var _0x4c2824=_0x151a81||client;return _0x4c2824['request'](_0x3a2112,_0x9e18f)[_0x0d53('0x20')](function(_0x2072cb){logger['info'](_0x0d53('0x21'),_0x25c058,_0x0d53('0x22'));logger[_0x0d53('0x23')](_0x0d53('0x24'),_0x25c058,_0x0d53('0x22'),JSON['stringify'](_0x2072cb));if(_0x2072cb[_0x0d53('0x25')]){if(_0x2072cb[_0x0d53('0x25')]['code']===0x1f4){logger[_0x0d53('0x25')]('SmsAccount,\x20%s,\x20%s',_0x25c058,_0x2072cb[_0x0d53('0x25')][_0x0d53('0x26')]);return _0x83eeef(_0x2072cb[_0x0d53('0x25')]['message']);}logger['error'](_0x0d53('0x21'),_0x25c058,_0x2072cb['error'][_0x0d53('0x26')]);return _0x46e894(_0x2072cb[_0x0d53('0x25')][_0x0d53('0x26')]);}else{logger['info'](_0x0d53('0x21'),_0x25c058,_0x0d53('0x22'));_0x46e894(_0x2072cb['result'][_0x0d53('0x26')]);}})['catch'](function(_0x47f089){logger[_0x0d53('0x25')](_0x0d53('0x21'),_0x25c058,_0x47f089);_0x83eeef(_0x47f089);});});}function respondWithStatusCode(_0x5d8b24,_0x49abee){_0x49abee=_0x49abee||0xcc;return function(_0x29c391){if(_0x29c391){return _0x5d8b24[_0x0d53('0x27')](_0x49abee);}return _0x5d8b24[_0x0d53('0x28')](_0x49abee)[_0x0d53('0x29')]();};}function respondWithResult(_0x5ea858,_0x1fad07){_0x1fad07=_0x1fad07||0xc8;return function(_0x46e4ae){if(_0x46e4ae){return _0x5ea858[_0x0d53('0x28')](_0x1fad07)[_0x0d53('0x2a')](_0x46e4ae);}};}function respondWithFilteredResult(_0x273e6e,_0x13097f){return function(_0x487da9){if(_0x487da9){var _0x5e0e72=typeof _0x13097f['offset']===_0x0d53('0x2b')&&typeof _0x13097f[_0x0d53('0x2c')]===_0x0d53('0x2b');var _0x9d6695=_0x487da9[_0x0d53('0x2d')];var _0x32440d=_0x5e0e72?0x0:_0x13097f[_0x0d53('0x2e')];var _0x238153=_0x5e0e72?_0x487da9['count']:_0x13097f[_0x0d53('0x2e')]+_0x13097f[_0x0d53('0x2c')];var _0x112b34;if(_0x238153>=_0x9d6695){_0x238153=_0x9d6695;_0x112b34=0xc8;}else{_0x112b34=0xce;}_0x273e6e[_0x0d53('0x28')](_0x112b34);return _0x273e6e[_0x0d53('0x2f')](_0x0d53('0x30'),_0x32440d+'-'+_0x238153+'/'+_0x9d6695)['json'](_0x487da9);}return null;};}function patchUpdates(_0x4480fe){return function(_0x3e20af){try{jsonpatch['apply'](_0x3e20af,_0x4480fe,!![]);}catch(_0xaebc09){return BPromise[_0x0d53('0x31')](_0xaebc09);}return _0x3e20af[_0x0d53('0x32')]();};}function saveUpdates(_0x3da01e,_0x4cb7ff){return function(_0x4f94d1){if(_0x4f94d1){return _0x4f94d1['update'](_0x3da01e)[_0x0d53('0x20')](function(_0x135b51){return _0x135b51;});}return null;};}function removeEntity(_0x326ccd,_0x4912c8){return function(_0x167e7f){if(_0x167e7f){return _0x167e7f[_0x0d53('0x33')]()[_0x0d53('0x20')](function(){var _0x18fc8b=_0x167e7f[_0x0d53('0x34')]({'plain':!![]});var _0x11600=_0x0d53('0x35');return db[_0x0d53('0x36')][_0x0d53('0x33')]({'where':{'type':_0x11600,'resourceId':_0x18fc8b['id']}})['then'](function(){return _0x167e7f;});})[_0x0d53('0x20')](function(){_0x326ccd[_0x0d53('0x28')](0xcc)[_0x0d53('0x29')]();});}};}function handleEntityNotFound(_0x368717,_0x2220f8){return function(_0x43b7a0){if(!_0x43b7a0){_0x368717['sendStatus'](0x194);}return _0x43b7a0;};}function handleError(_0x223629,_0x207fb5){_0x207fb5=_0x207fb5||0x1f4;return function(_0x1283a4){logger[_0x0d53('0x25')](_0x1283a4[_0x0d53('0x37')]);if(_0x1283a4[_0x0d53('0x38')]){delete _0x1283a4[_0x0d53('0x38')];}_0x223629[_0x0d53('0x28')](_0x207fb5)[_0x0d53('0x39')](_0x1283a4);};}exports[_0x0d53('0x3a')]=function(_0x397ef2,_0x1de502){var _0x37a88e={'include':[{'model':db['Pause'],'as':_0x0d53('0x3b')}]},_0x576b91={},_0x143b14={'count':0x0,'rows':[]};var _0x8e4596=_[_0x0d53('0x3c')](db[_0x0d53('0x3d')][_0x0d53('0x3e')],function(_0x101a99){return{'name':_0x101a99[_0x0d53('0x3f')],'type':_0x101a99[_0x0d53('0x40')][_0x0d53('0x41')]};});_0x576b91[_0x0d53('0x42')]=_['map'](_0x8e4596,_0x0d53('0x38'));_0x576b91[_0x0d53('0x43')]=_[_0x0d53('0x44')](_0x397ef2[_0x0d53('0x43')]);_0x576b91['filters']=_[_0x0d53('0x45')](_0x576b91[_0x0d53('0x42')],_0x576b91['query']);_0x37a88e['attributes']=_[_0x0d53('0x45')](_0x576b91[_0x0d53('0x42')],qs[_0x0d53('0x46')](_0x397ef2['query'][_0x0d53('0x46')]));_0x37a88e[_0x0d53('0x47')]=_0x37a88e[_0x0d53('0x47')][_0x0d53('0x48')]?_0x37a88e[_0x0d53('0x47')]:_0x576b91[_0x0d53('0x42')];if(!_0x397ef2[_0x0d53('0x43')][_0x0d53('0x49')](_0x0d53('0x4a'))){_0x37a88e[_0x0d53('0x2c')]=qs[_0x0d53('0x2c')](_0x397ef2[_0x0d53('0x43')]['limit']);_0x37a88e[_0x0d53('0x2e')]=qs['offset'](_0x397ef2[_0x0d53('0x43')][_0x0d53('0x2e')]);}_0x37a88e[_0x0d53('0x4b')]=qs[_0x0d53('0x4c')](_0x397ef2[_0x0d53('0x43')]['sort']);_0x37a88e[_0x0d53('0x4d')]=qs['filters'](_[_0x0d53('0x4e')](_0x397ef2[_0x0d53('0x43')],_0x576b91[_0x0d53('0x4f')]),_0x8e4596);if(_0x397ef2[_0x0d53('0x43')][_0x0d53('0x50')]){_0x37a88e['where']=_[_0x0d53('0x51')](_0x37a88e[_0x0d53('0x4d')],{'$or':_[_0x0d53('0x3c')](_0x8e4596,function(_0x1d137c){if(_0x1d137c['type']!==_0x0d53('0x52')){var _0x23d05e={};_0x23d05e[_0x1d137c[_0x0d53('0x38')]]={'$like':'%'+_0x397ef2[_0x0d53('0x43')][_0x0d53('0x50')]+'%'};return _0x23d05e;}})});}_0x37a88e=_['merge']({},_0x37a88e,_0x397ef2[_0x0d53('0x53')]);var _0x112c6a={'where':_0x37a88e['where']};return db[_0x0d53('0x3d')]['count'](_0x112c6a)['then'](function(_0x34cf97){_0x143b14[_0x0d53('0x2d')]=_0x34cf97;if(_0x397ef2[_0x0d53('0x43')][_0x0d53('0x54')]){_0x37a88e[_0x0d53('0x55')]=[{'all':!![]}];}return db[_0x0d53('0x3d')][_0x0d53('0x56')](_0x37a88e);})[_0x0d53('0x20')](function(_0x52fa96){_0x143b14[_0x0d53('0x57')]=_0x52fa96;return _0x143b14;})[_0x0d53('0x20')](respondWithFilteredResult(_0x1de502,_0x37a88e))[_0x0d53('0x58')](handleError(_0x1de502,null));};exports['show']=function(_0x13250c,_0x5d3aa7){var _0x211b0f={'raw':![],'where':{'id':_0x13250c[_0x0d53('0x59')]['id']},'include':[{'model':db[_0x0d53('0x5a')],'as':_0x0d53('0x3b')}]},_0x22b137={};_0x22b137[_0x0d53('0x42')]=_[_0x0d53('0x44')](db[_0x0d53('0x3d')]['rawAttributes']);_0x22b137[_0x0d53('0x43')]=_[_0x0d53('0x44')](_0x13250c[_0x0d53('0x43')]);_0x22b137['filters']=_['intersection'](_0x22b137['model'],_0x22b137[_0x0d53('0x43')]);_0x211b0f['attributes']=_['intersection'](_0x22b137[_0x0d53('0x42')],qs[_0x0d53('0x46')](_0x13250c[_0x0d53('0x43')][_0x0d53('0x46')]));_0x211b0f[_0x0d53('0x47')]=_0x211b0f[_0x0d53('0x47')][_0x0d53('0x48')]?_0x211b0f[_0x0d53('0x47')]:_0x22b137['model'];if(_0x13250c['query'][_0x0d53('0x54')]){_0x211b0f['include']=[{'all':!![]}];}_0x211b0f=_['merge']({},_0x211b0f,_0x13250c[_0x0d53('0x53')]);return db[_0x0d53('0x3d')][_0x0d53('0x5b')](_0x211b0f)['then'](handleEntityNotFound(_0x5d3aa7,null))[_0x0d53('0x20')](respondWithResult(_0x5d3aa7,null))[_0x0d53('0x58')](handleError(_0x5d3aa7,null));};exports[_0x0d53('0x5c')]=function(_0x36b1c4,_0x4b141b){return db[_0x0d53('0x3d')][_0x0d53('0x5c')](_0x36b1c4['body'],{})[_0x0d53('0x20')](function(_0x2fc302){var _0x733cab=_0x36b1c4['user'][_0x0d53('0x34')]({'plain':!![]});if(!_0x733cab)throw new Error(_0x0d53('0x5d'));if(_0x733cab[_0x0d53('0x5e')]===_0x0d53('0x5f')){var _0x30bcf4=_0x2fc302['get']({'plain':!![]});var _0x1ee517='SmsAccounts';return db[_0x0d53('0x60')][_0x0d53('0x5b')]({'where':{'name':_0x1ee517,'userProfileId':_0x733cab[_0x0d53('0x61')]},'raw':!![]})[_0x0d53('0x20')](function(_0x330284){if(_0x330284&&_0x330284[_0x0d53('0x62')]===0x0){return db[_0x0d53('0x36')][_0x0d53('0x5c')]({'name':_0x30bcf4['name'],'resourceId':_0x30bcf4['id'],'type':_0x330284[_0x0d53('0x38')],'sectionId':_0x330284['id']},{})[_0x0d53('0x20')](function(){return _0x2fc302;});}else{return _0x2fc302;}})['catch'](function(_0x36056f){logger[_0x0d53('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36056f);throw _0x36056f;});}return _0x2fc302;})[_0x0d53('0x20')](respondWithResult(_0x4b141b,0xc9))[_0x0d53('0x58')](handleError(_0x4b141b,null));};exports[_0x0d53('0x63')]=function(_0x14b797,_0xb7624c){if(_0x14b797[_0x0d53('0x64')]['id']){delete _0x14b797['body']['id'];}return db[_0x0d53('0x3d')][_0x0d53('0x5b')]({'where':{'id':_0x14b797[_0x0d53('0x59')]['id']},'include':[{'model':db[_0x0d53('0x5a')],'as':_0x0d53('0x3b')}]})['then'](handleEntityNotFound(_0xb7624c,null))[_0x0d53('0x20')](saveUpdates(_0x14b797['body'],null))[_0x0d53('0x20')](respondWithResult(_0xb7624c,null))[_0x0d53('0x58')](handleError(_0xb7624c,null));};exports[_0x0d53('0x33')]=function(_0x591479,_0x776371){return db[_0x0d53('0x3d')][_0x0d53('0x5b')]({'where':{'id':_0x591479[_0x0d53('0x59')]['id']}})['then'](handleEntityNotFound(_0x776371,null))[_0x0d53('0x20')](removeEntity(_0x776371,null))[_0x0d53('0x58')](handleError(_0x776371,null));};exports[_0x0d53('0x65')]=function(_0x170c9b,_0x576bb6){return db['SmsAccount']['describe']()[_0x0d53('0x20')](respondWithResult(_0x576bb6,null))[_0x0d53('0x58')](handleError(_0x576bb6,null));};exports[_0x0d53('0x66')]=function(_0x51312b,_0x28a62d,_0x3c061b){if(_0x51312b['body']['id']){delete _0x51312b[_0x0d53('0x64')]['id'];}return db[_0x0d53('0x3d')][_0x0d53('0x5b')]({'where':{'id':_0x51312b[_0x0d53('0x59')]['id']}})['then'](handleEntityNotFound(_0x28a62d,null))[_0x0d53('0x20')](function(_0x599b21){if(_0x599b21){_0x51312b['body'][_0x0d53('0x67')]=_0x599b21['id'];return db['Disposition'][_0x0d53('0x5c')](_0x51312b[_0x0d53('0x64')]);}})[_0x0d53('0x20')](respondWithResult(_0x28a62d,null))['catch'](handleError(_0x28a62d,null));};exports[_0x0d53('0x68')]=function(_0x5e1245,_0x2e95bc,_0x344941){var _0x28f64f={'raw':![],'where':{}};var _0x36bf58={};var _0x4dd9f6={'count':0x0,'rows':[]};return db[_0x0d53('0x3d')][_0x0d53('0x69')]({'where':{'id':_0x5e1245[_0x0d53('0x59')]['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0x2e95bc,null))[_0x0d53('0x20')](function(_0x2ea612){if(_0x2ea612){_0x36bf58[_0x0d53('0x42')]=_['keys'](db[_0x0d53('0x6a')][_0x0d53('0x3e')]);_0x36bf58['query']=_[_0x0d53('0x44')](_0x5e1245[_0x0d53('0x43')]);_0x36bf58[_0x0d53('0x4f')]=_[_0x0d53('0x45')](_0x36bf58['model'],_0x36bf58[_0x0d53('0x43')]);_0x28f64f[_0x0d53('0x47')]=_[_0x0d53('0x45')](_0x36bf58[_0x0d53('0x42')],qs['fields'](_0x5e1245[_0x0d53('0x43')][_0x0d53('0x46')]));_0x28f64f[_0x0d53('0x47')]=_0x28f64f[_0x0d53('0x47')]['length']?_0x28f64f[_0x0d53('0x47')]:_0x36bf58[_0x0d53('0x42')];if(!_0x5e1245[_0x0d53('0x43')][_0x0d53('0x49')]('nolimit')){_0x28f64f[_0x0d53('0x2c')]=qs[_0x0d53('0x2c')](_0x5e1245['query'][_0x0d53('0x2c')]);_0x28f64f['offset']=qs[_0x0d53('0x2e')](_0x5e1245[_0x0d53('0x43')][_0x0d53('0x2e')]);}_0x28f64f[_0x0d53('0x4b')]=qs[_0x0d53('0x4c')](_0x5e1245['query'][_0x0d53('0x4c')]);_0x28f64f[_0x0d53('0x4d')]=qs['filters'](_[_0x0d53('0x4e')](_0x5e1245['query'],_0x36bf58[_0x0d53('0x4f')]));_0x28f64f[_0x0d53('0x4d')][_0x0d53('0x67')]=_0x2ea612['id'];if(_0x5e1245[_0x0d53('0x43')][_0x0d53('0x50')]){_0x28f64f[_0x0d53('0x4d')]=_['merge'](_0x28f64f[_0x0d53('0x4d')],{'$or':_['map'](_0x28f64f[_0x0d53('0x47')],function(_0x2f9cd7){var _0x597cd1={};_0x597cd1[_0x2f9cd7]={'$like':'%'+_0x5e1245[_0x0d53('0x43')]['filter']+'%'};return _0x597cd1;})});}_0x28f64f=_[_0x0d53('0x51')]({},_0x28f64f,_0x5e1245[_0x0d53('0x53')]);return db[_0x0d53('0x6a')][_0x0d53('0x2d')]({'where':_0x28f64f[_0x0d53('0x4d')]})[_0x0d53('0x20')](function(_0x3bd1f4){_0x4dd9f6[_0x0d53('0x2d')]=_0x3bd1f4;if(_0x5e1245[_0x0d53('0x43')][_0x0d53('0x54')]){_0x28f64f[_0x0d53('0x55')]=[{'all':!![]}];}return db[_0x0d53('0x6a')]['findAll'](_0x28f64f);})[_0x0d53('0x20')](function(_0xd001f3){_0x4dd9f6[_0x0d53('0x57')]=_0xd001f3;return _0x4dd9f6;});}})['then'](respondWithFilteredResult(_0x2e95bc,_0x28f64f))['catch'](handleError(_0x2e95bc,null));};exports[_0x0d53('0x6b')]=function(_0x596ba,_0x116747,_0x872f73){return db[_0x0d53('0x3d')][_0x0d53('0x5b')]({'where':{'id':_0x596ba['params']['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0x116747,null))[_0x0d53('0x20')](function(_0x16c26e){if(_0x16c26e){return _0x16c26e[_0x0d53('0x6b')](_0x596ba[_0x0d53('0x43')][_0x0d53('0x6c')]);}})[_0x0d53('0x20')](respondWithStatusCode(_0x116747,null))[_0x0d53('0x58')](handleError(_0x116747,null));};exports['addAnswer']=function(_0x5bfa65,_0x32ca59,_0xc17783){if(_0x5bfa65[_0x0d53('0x64')]['id']){delete _0x5bfa65[_0x0d53('0x64')]['id'];}return db[_0x0d53('0x3d')]['find']({'where':{'id':_0x5bfa65[_0x0d53('0x59')]['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0x32ca59,null))[_0x0d53('0x20')](function(_0x4b74b9){if(_0x4b74b9){_0x5bfa65[_0x0d53('0x64')][_0x0d53('0x67')]=_0x4b74b9['id'];return db['CannedAnswer'][_0x0d53('0x5c')](_0x5bfa65[_0x0d53('0x64')]);}})[_0x0d53('0x20')](respondWithResult(_0x32ca59,null))[_0x0d53('0x58')](handleError(_0x32ca59,null));};exports[_0x0d53('0x6d')]=function(_0x440dd2,_0xa3db06,_0x5631d4){var _0x33f87f={'raw':![],'where':{}};var _0x532472={};var _0x1d16d1={'count':0x0,'rows':[]};return db[_0x0d53('0x3d')][_0x0d53('0x69')]({'where':{'id':_0x440dd2[_0x0d53('0x59')]['id']}})['then'](handleEntityNotFound(_0xa3db06,null))[_0x0d53('0x20')](function(_0x516e57){if(_0x516e57){_0x532472[_0x0d53('0x42')]=_['keys'](db[_0x0d53('0x6e')][_0x0d53('0x3e')]);_0x532472[_0x0d53('0x43')]=_[_0x0d53('0x44')](_0x440dd2[_0x0d53('0x43')]);_0x532472[_0x0d53('0x4f')]=_[_0x0d53('0x45')](_0x532472[_0x0d53('0x42')],_0x532472['query']);_0x33f87f[_0x0d53('0x47')]=_[_0x0d53('0x45')](_0x532472[_0x0d53('0x42')],qs[_0x0d53('0x46')](_0x440dd2['query']['fields']));_0x33f87f[_0x0d53('0x47')]=_0x33f87f[_0x0d53('0x47')][_0x0d53('0x48')]?_0x33f87f[_0x0d53('0x47')]:_0x532472[_0x0d53('0x42')];if(!_0x440dd2[_0x0d53('0x43')]['hasOwnProperty'](_0x0d53('0x4a'))){_0x33f87f[_0x0d53('0x2c')]=qs['limit'](_0x440dd2['query'][_0x0d53('0x2c')]);_0x33f87f[_0x0d53('0x2e')]=qs[_0x0d53('0x2e')](_0x440dd2[_0x0d53('0x43')]['offset']);}_0x33f87f[_0x0d53('0x4b')]=qs[_0x0d53('0x4c')](_0x440dd2[_0x0d53('0x43')][_0x0d53('0x4c')]);_0x33f87f[_0x0d53('0x4d')]=qs[_0x0d53('0x4f')](_['pick'](_0x440dd2[_0x0d53('0x43')],_0x532472[_0x0d53('0x4f')]));_0x33f87f[_0x0d53('0x4d')][_0x0d53('0x67')]=_0x516e57['id'];if(_0x440dd2[_0x0d53('0x43')][_0x0d53('0x50')]){_0x33f87f[_0x0d53('0x4d')]=_[_0x0d53('0x51')](_0x33f87f[_0x0d53('0x4d')],{'$or':_[_0x0d53('0x3c')](_0x33f87f[_0x0d53('0x47')],function(_0x486752){var _0xaa158={};_0xaa158[_0x486752]={'$like':'%'+_0x440dd2[_0x0d53('0x43')][_0x0d53('0x50')]+'%'};return _0xaa158;})});}_0x33f87f=_[_0x0d53('0x51')]({},_0x33f87f,_0x440dd2[_0x0d53('0x53')]);return db[_0x0d53('0x6e')][_0x0d53('0x2d')]({'where':_0x33f87f[_0x0d53('0x4d')]})[_0x0d53('0x20')](function(_0x524a35){_0x1d16d1[_0x0d53('0x2d')]=_0x524a35;if(_0x440dd2[_0x0d53('0x43')][_0x0d53('0x54')]){_0x33f87f[_0x0d53('0x55')]=[{'all':!![]}];}return db[_0x0d53('0x6e')][_0x0d53('0x56')](_0x33f87f);})[_0x0d53('0x20')](function(_0x3a46d3){_0x1d16d1[_0x0d53('0x57')]=_0x3a46d3;return _0x1d16d1;});}})['then'](respondWithFilteredResult(_0xa3db06,_0x33f87f))['catch'](handleError(_0xa3db06,null));};exports[_0x0d53('0x6f')]=function(_0x5eb622,_0x48a2ad,_0x41e3aa){return db[_0x0d53('0x3d')][_0x0d53('0x5b')]({'where':{'id':_0x5eb622[_0x0d53('0x59')]['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0x48a2ad,null))[_0x0d53('0x20')](function(_0x4ef57b){if(_0x4ef57b){return _0x4ef57b[_0x0d53('0x6f')](_0x5eb622[_0x0d53('0x43')][_0x0d53('0x6c')]);}})[_0x0d53('0x20')](respondWithStatusCode(_0x48a2ad,null))[_0x0d53('0x58')](handleError(_0x48a2ad,null));};exports[_0x0d53('0x70')]=function(_0x4d0913,_0x4ef295,_0x11e179){var _0x3c3dba={'channel':'sms'};var _0x23e472=[];var _0x12d73d=[];var _0x2dcf17={};return db['SmsAccount'][_0x0d53('0x5b')]({'where':{'id':_0x4d0913[_0x0d53('0x59')]['id']},'include':[{'model':db[_0x0d53('0x71')],'as':'Applications'}]})[_0x0d53('0x20')](handleEntityNotFound(_0x4ef295,null))[_0x0d53('0x20')](function(_0x27921d){_0x3c3dba[_0x0d53('0x72')]=_0x27921d;_0x3c3dba[_0x0d53('0x73')]=_['orderBy'](_0x27921d[_0x0d53('0x74')],[_0x0d53('0x75')],[_0x0d53('0x76')]);if(_0x3c3dba[_0x0d53('0x72')][_0x0d53('0x74')]){delete _0x3c3dba[_0x0d53('0x72')][_0x0d53('0x74')];}return db[_0x0d53('0x77')][_0x0d53('0x65')]();})[_0x0d53('0x20')](function(_0x4f6870){if(!_0x4f6870){throw new db[(_0x0d53('0x78'))][(_0x0d53('0x79'))]('no\x20available\x20attributes');}_0x23e472=_[_0x0d53('0x7a')](_[_0x0d53('0x44')](_0x4f6870),[_0x0d53('0x7b'),_0x0d53('0x7c')]);_0x12d73d=_['difference'](_[_0x0d53('0x44')](_0x4f6870),['createdAt',_0x0d53('0x7c'),_0x0d53('0x7d'),_0x0d53('0x7e')]);_0x3c3dba['body']={'mapKey':_0x0d53('0x7f')};if(_0x3c3dba[_0x0d53('0x72')][_0x0d53('0x40')]){switch(_0x3c3dba[_0x0d53('0x72')][_0x0d53('0x40')]){case'twilio':_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')]=_0x4d0913['body'][_0x0d53('0x81')];_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x64')]=_0x4d0913[_0x0d53('0x64')]['Body'];_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x82')]=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x83')];break;case'skebby':_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')]='+'+_0x4d0913['body'][_0x0d53('0x84')];_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x64')]=_0x4d0913[_0x0d53('0x64')]['text'];break;case _0x0d53('0x85'):_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')]=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x80')];_0x3c3dba['body'][_0x0d53('0x64')]=_0x4d0913['body'][_0x0d53('0x26')];break;case _0x0d53('0x86'):_0x3c3dba['body'][_0x0d53('0x80')]=_0x4d0913[_0x0d53('0x64')]['from'];_0x3c3dba[_0x0d53('0x64')]['body']=_0x4d0913['body'][_0x0d53('0x64')];_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x82')]=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x87')];break;case _0x0d53('0x88'):_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')]=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x81')];_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x64')]=_0x4d0913[_0x0d53('0x64')]['Text'];_0x3c3dba['body'][_0x0d53('0x82')]=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x89')];break;case _0x0d53('0x8a'):_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')]='+'+_0x4d0913['body'][_0x0d53('0x8b')][0x0]['from'];_0x3c3dba['body']['body']=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x8b')][0x0]['text'];_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x82')]=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x8b')][0x0][_0x0d53('0x82')];break;case _0x0d53('0x8c'):_0x3c3dba['body'][_0x0d53('0x80')]=_0x4d0913['body'][_0x0d53('0x8d')];_0x3c3dba[_0x0d53('0x64')]['body']=_0x4d0913['body']['segmentedMessage']['message'];break;case _0x0d53('0x8e'):_0x3c3dba['body'][_0x0d53('0x80')]=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x8f')];_0x3c3dba[_0x0d53('0x64')]['body']=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x90')];_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x82')]=_0x4d0913['body'][_0x0d53('0x91')];break;case _0x0d53('0x92'):_0x3c3dba['body']['messageId']=_0x4d0913[_0x0d53('0x64')][0x0]['message']['id'];_0x3c3dba[_0x0d53('0x64')]['from']=_0x4d0913[_0x0d53('0x64')][0x0][_0x0d53('0x26')][_0x0d53('0x80')];_0x3c3dba['body'][_0x0d53('0x64')]=_0x4d0913['body'][0x0]['message'][_0x0d53('0x90')];break;case _0x0d53('0x93'):_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')]=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x80')];_0x3c3dba[_0x0d53('0x64')]['body']=_0x4d0913[_0x0d53('0x64')][_0x0d53('0x26')];_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x82')]=_0x4d0913[_0x0d53('0x64')]['refid'];break;}}if(_0x3c3dba[_0x0d53('0x64')]['id']){delete _0x3c3dba[_0x0d53('0x64')]['id'];}if(_[_0x0d53('0x94')](_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')])){throw new db['Sequelize'][(_0x0d53('0x79'))](_0x0d53('0x95'));}if(_[_0x0d53('0x94')](_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x64')])||_0x3c3dba[_0x0d53('0x64')]['body']===''){throw new db['Sequelize'][(_0x0d53('0x79'))](_0x0d53('0x96'));}if(_[_0x0d53('0x94')](_0x3c3dba[_0x0d53('0x64')]['mapKey'])){throw new db[(_0x0d53('0x78'))][(_0x0d53('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12d73d);}if(!_[_0x0d53('0x97')](_0x12d73d,_0x3c3dba['body'][_0x0d53('0x98')])){throw new db['Sequelize'][(_0x0d53('0x79'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12d73d);}_0x2dcf17[_0x3c3dba[_0x0d53('0x64')]['mapKey']]=_0x3c3dba['body'][_0x0d53('0x80')];return db[_0x0d53('0x99')][_0x0d53('0x5b')]({'where':{'id':_0x3c3dba[_0x0d53('0x72')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x0d53('0x9a'),'where':_0x2dcf17,'limit':0x1,'order':[[_0x0d53('0x7c'),_0x0d53('0x9b')]]}]});})['then'](handleEntityNotFound(_0x4ef295,null))[_0x0d53('0x20')](function(_0x590269){if(_0x590269){_0x3c3dba[_0x0d53('0x9c')]=_['omit'](_0x590269,[_0x0d53('0x9a')]);if(_0x590269[_0x0d53('0x9a')][_0x0d53('0x48')]){return _0x590269[_0x0d53('0x9a')][0x0];}var _0x336c2d=_[_0x0d53('0x1b')](_0x3c3dba[_0x0d53('0x64')],{'firstName':_0x3c3dba['body']['from'],'ListId':_0x590269['id']});_0x336c2d[_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x98')]]=_0x3c3dba[_0x0d53('0x64')]['from'];return db['CmContact'][_0x0d53('0x5c')](_0x336c2d,{'fields':_0x23e472,'raw':!![]});}})['then'](handleEntityNotFound(_0x4ef295,null))[_0x0d53('0x20')](function(_0x330bde){if(_0x330bde){_0x3c3dba[_0x0d53('0x9d')]=_0x330bde;var _0x32a4f7={'ContactId':_0x330bde['id'],'phone':_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')],'SmsAccountId':_0x4d0913[_0x0d53('0x59')]['id']};var _0x8afe61={'ContactId':_0x330bde['id'],'SmsAccountId':_0x4d0913[_0x0d53('0x59')]['id'],'closed':![]};return db[_0x0d53('0x9e')][_0x0d53('0x5b')]({'where':_0x8afe61})[_0x0d53('0x20')](function(_0x46da64){if(_0x46da64){return[_0x46da64,![]];}return db[_0x0d53('0x9e')][_0x0d53('0x5c')](_0x32a4f7)[_0x0d53('0x20')](function(_0x4c8697){return[_0x4c8697,!![]];});});}})[_0x0d53('0x9f')](function(_0x440ee6,_0x23fdb0){_0x3c3dba['interaction']=_0x440ee6[_0x0d53('0x34')]({'plain':!![]});_0x3c3dba[_0x0d53('0xa0')][_0x0d53('0xa1')]=![];if(_0x23fdb0){if(_0x3c3dba[_0x0d53('0x72')]['autoclose']){_0x3c3dba['applications'][_0x0d53('0xa2')]({'id':0x0,'priority':_0x3c3dba[_0x0d53('0x73')]['length']+0x1,'app':_0x0d53('0xa3'),'appdata':_0x0d53('0xa4'),'interval':_0x0d53('0xa5')});}_0x3c3dba[_0x0d53('0xa0')][_0x0d53('0xa1')]=!![];}return db[_0x0d53('0xa6')]['create']({'phone':_0x3c3dba[_0x0d53('0x64')][_0x0d53('0x80')],'messageId':_0x3c3dba['body'][_0x0d53('0x82')],'body':_0x3c3dba[_0x0d53('0x64')]['body'],'SmsAccountId':_0x4d0913[_0x0d53('0x59')]['id'],'SmsInteractionId':_0x440ee6['id'],'direction':'in','ContactId':_0x440ee6[_0x0d53('0xa7')],'AttachmentId':_0x3c3dba[_0x0d53('0x64')][_0x0d53('0xa8')]});})[_0x0d53('0x20')](function(_0x5ab2b2){_0x3c3dba[_0x0d53('0x26')]=_0x5ab2b2;if(!_0x3c3dba[_0x0d53('0xa0')]['UserId'])return;return db[_0x0d53('0xa9')][_0x0d53('0x5b')]({'attributes':['id',_0x0d53('0x38')],'where':{'id':_0x3c3dba[_0x0d53('0xa0')]['UserId']}});})[_0x0d53('0x20')](function(_0x53dc2f){if(_0x53dc2f){_0x3c3dba[_0x0d53('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x53dc2f[_0x0d53('0x38')]+','+(_0x3c3dba[_0x0d53('0x72')][_0x0d53('0xaa')]||0xa),'interval':_0x0d53('0xa5')});}if(!_0x3c3dba[_0x0d53('0xa0')][_0x0d53('0xab')])return;return db[_0x0d53('0xac')][_0x0d53('0x5b')]({'attributes':['id','name'],'where':{'id':_0x3c3dba[_0x0d53('0xa0')][_0x0d53('0xab')]}});})[_0x0d53('0x20')](function(_0x31c4e1){if(_0x31c4e1){_0x3c3dba['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x0d53('0xad'),'appdata':_0x31c4e1[_0x0d53('0x38')]+','+(_0x3c3dba[_0x0d53('0x72')][_0x0d53('0xae')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0d53('0xaf'),_0x0d53('0xb0'),_0x3c3dba);})[_0x0d53('0x20')](function(_0x4947ef){if(_0x4947ef){var _0xece665=0xc8;var _0xd8dd9b='receiveMessage';logger[_0x0d53('0xb1')](_0x0d53('0x24'),_0xd8dd9b,_0xece665,_0x0d53('0xb2'));logger[_0x0d53('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xd8dd9b,_0xece665,_0x0d53('0xb2'),JSON['stringify'](_0x4947ef));if(_0x3c3dba[_0x0d53('0x72')][_0x0d53('0x40')]===_0x0d53('0xb3')){return _0x4ef295[_0x0d53('0x28')](_0xece665)[_0x0d53('0x2f')]('Content-Type',_0x0d53('0xb4'))[_0x0d53('0x39')](_0x0d53('0xb5'));}else{return _0x4ef295[_0x0d53('0x28')](_0xece665)[_0x0d53('0x2a')](_0x4947ef);}}})[_0x0d53('0x58')](handleError(_0x4ef295,null));};exports[_0x0d53('0xb6')]=function(_0x2da4dc,_0x3c88e2){var _0x2dc2ea=_0x2da4dc[_0x0d53('0x59')]['id'];var _0x14fb0f=_0x2da4dc['body'];var _0x206e84=0xc8;var _0x8bce81=null;return db[_0x0d53('0xb7')][_0x0d53('0xb8')]({'isolationLevel':db[_0x0d53('0xb7')][_0x0d53('0xb9')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xa3f01b){return db[_0x0d53('0x3d')][_0x0d53('0x69')]({'where':{'id':_0x2dc2ea},'transaction':_0xa3f01b})[_0x0d53('0x20')](function(_0x262ff0){if(_0x262ff0){return db['SmsApplication'][_0x0d53('0x33')]({'where':{'SmsAccountId':_0x2dc2ea},'transaction':_0xa3f01b})[_0x0d53('0x20')](function(){var _0x1f20d2=_['map'](_0x14fb0f,function(_0x2d2fc4){_0x2d2fc4['SmsAccountId']=_0x2dc2ea;return _0x2d2fc4;});return db['SmsApplication'][_0x0d53('0xba')](_0x1f20d2,{'transaction':_0xa3f01b});});}else{_0x206e84=0x194;_0x8bce81=[];}});})[_0x0d53('0x20')](function(){if(_0x206e84!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x2dc2ea},'order':'priority'})[_0x0d53('0x20')](function(_0x52e05e){_0x8bce81=_0x52e05e;});}})[_0x0d53('0x58')](function(_0x224d25){_0x206e84=0x1f4;logger['error'](_0x224d25[_0x0d53('0x37')]);if(_0x224d25['name']){delete _0x224d25[_0x0d53('0x38')];}_0x8bce81=_0x224d25;})[_0x0d53('0xbb')](function(){if(_0x8bce81===null){_0x3c88e2[_0x0d53('0x27')](_0x206e84);}else{if(_0x206e84===0x1f4){_0x3c88e2['status'](_0x206e84)[_0x0d53('0x39')](_0x8bce81);}else{_0x3c88e2[_0x0d53('0x28')](_0x206e84)['json'](_0x8bce81);}}});};exports['getApplications']=function(_0x2f9c92,_0x39bb7c,_0x513351){var _0x436eca={};var _0x2c836e={};var _0x1ac652;var _0x1a946b;return db[_0x0d53('0x3d')][_0x0d53('0x69')]({'where':{'id':_0x2f9c92[_0x0d53('0x59')]['id']}})['then'](handleEntityNotFound(_0x39bb7c,null))[_0x0d53('0x20')](function(_0x38ccf6){if(_0x38ccf6){_0x1ac652=_0x38ccf6;_0x2c836e[_0x0d53('0x42')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x2c836e[_0x0d53('0x43')]=_['keys'](_0x2f9c92['query']);_0x2c836e[_0x0d53('0x4f')]=_['intersection'](_0x2c836e[_0x0d53('0x42')],_0x2c836e[_0x0d53('0x43')]);_0x436eca[_0x0d53('0x47')]=_['intersection'](_0x2c836e['model'],qs[_0x0d53('0x46')](_0x2f9c92[_0x0d53('0x43')]['fields']));_0x436eca[_0x0d53('0x47')]=_0x436eca[_0x0d53('0x47')][_0x0d53('0x48')]?_0x436eca[_0x0d53('0x47')]:_0x2c836e['model'];_0x436eca[_0x0d53('0x4b')]=qs[_0x0d53('0x4c')](_0x2f9c92[_0x0d53('0x43')]['sort']);_0x436eca['where']=qs[_0x0d53('0x4f')](_[_0x0d53('0x4e')](_0x2f9c92[_0x0d53('0x43')],_0x2c836e[_0x0d53('0x4f')]));if(_0x2f9c92[_0x0d53('0x43')][_0x0d53('0x50')]){_0x436eca[_0x0d53('0x4d')]=_[_0x0d53('0x51')](_0x436eca['where'],{'$or':_[_0x0d53('0x3c')](_0x436eca[_0x0d53('0x47')],function(_0xde093d){var _0x1c85e2={};_0x1c85e2[_0xde093d]={'$like':'%'+_0x2f9c92[_0x0d53('0x43')][_0x0d53('0x50')]+'%'};return _0x1c85e2;})});}_0x436eca=_[_0x0d53('0x51')]({},_0x436eca,_0x2f9c92[_0x0d53('0x53')]);return _0x1ac652[_0x0d53('0xbc')](_0x436eca);}})[_0x0d53('0x20')](function(_0x1cc275){if(_0x1cc275){_0x1a946b=_0x1cc275[_0x0d53('0x48')];if(!_0x2f9c92[_0x0d53('0x43')][_0x0d53('0x49')]('nolimit')){_0x436eca[_0x0d53('0x2c')]=qs[_0x0d53('0x2c')](_0x2f9c92[_0x0d53('0x43')][_0x0d53('0x2c')]);_0x436eca[_0x0d53('0x2e')]=qs[_0x0d53('0x2e')](_0x2f9c92['query'][_0x0d53('0x2e')]);}return _0x1ac652[_0x0d53('0xbc')](_0x436eca);}})['then'](function(_0x19cce7){if(_0x19cce7){return _0x19cce7?{'count':_0x1a946b,'rows':_0x19cce7}:null;}})['then'](respondWithResult(_0x39bb7c,null))[_0x0d53('0x58')](handleError(_0x39bb7c,null));};exports[_0x0d53('0xbd')]=function(_0x5d5f57,_0x59438d,_0x49a28e){var _0x367140={'raw':![],'where':{}};var _0x4d0862={};var _0x2cde0a={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0d53('0x69')]({'where':{'id':_0x5d5f57[_0x0d53('0x59')]['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0x59438d,null))['then'](function(_0x4df755){if(_0x4df755){_0x4d0862[_0x0d53('0x42')]=_[_0x0d53('0x44')](db[_0x0d53('0x9e')][_0x0d53('0x3e')]);_0x4d0862['query']=_[_0x0d53('0x44')](_0x5d5f57['query']);_0x4d0862[_0x0d53('0x4f')]=_['intersection'](_0x4d0862[_0x0d53('0x42')],_0x4d0862[_0x0d53('0x43')]);_0x367140[_0x0d53('0x47')]=_[_0x0d53('0x45')](_0x4d0862[_0x0d53('0x42')],qs[_0x0d53('0x46')](_0x5d5f57[_0x0d53('0x43')]['fields']));_0x367140[_0x0d53('0x47')]=_0x367140[_0x0d53('0x47')][_0x0d53('0x48')]?_0x367140[_0x0d53('0x47')]:_0x4d0862['model'];if(!_0x5d5f57[_0x0d53('0x43')][_0x0d53('0x49')](_0x0d53('0x4a'))){_0x367140[_0x0d53('0x2c')]=qs[_0x0d53('0x2c')](_0x5d5f57[_0x0d53('0x43')]['limit']);_0x367140['offset']=qs[_0x0d53('0x2e')](_0x5d5f57[_0x0d53('0x43')]['offset']);}_0x367140['order']=qs[_0x0d53('0x4c')](_0x5d5f57[_0x0d53('0x43')][_0x0d53('0x4c')]);_0x367140[_0x0d53('0x4d')]=qs[_0x0d53('0x4f')](_[_0x0d53('0x4e')](_0x5d5f57[_0x0d53('0x43')],_0x4d0862[_0x0d53('0x4f')]));_0x367140[_0x0d53('0x4d')][_0x0d53('0x67')]=_0x4df755['id'];if(_0x5d5f57[_0x0d53('0x43')][_0x0d53('0x50')]){_0x367140['where']=_['merge'](_0x367140[_0x0d53('0x4d')],{'$or':_[_0x0d53('0x3c')](_0x367140[_0x0d53('0x47')],function(_0x1a2d5f){var _0xd3728a={};_0xd3728a[_0x1a2d5f]={'$like':'%'+_0x5d5f57['query'][_0x0d53('0x50')]+'%'};return _0xd3728a;})});}_0x367140=_[_0x0d53('0x51')]({},_0x367140,_0x5d5f57['options']);return db[_0x0d53('0x9e')]['count']({'where':_0x367140[_0x0d53('0x4d')]})[_0x0d53('0x20')](function(_0x24765a){_0x2cde0a[_0x0d53('0x2d')]=_0x24765a;if(_0x5d5f57['query'][_0x0d53('0x54')]){_0x367140[_0x0d53('0x55')]=[{'model':db[_0x0d53('0x77')],'as':'Contact','required':![]},{'model':db[_0x0d53('0xa9')],'as':_0x0d53('0xbe'),'attributes':[_0x0d53('0x38'),_0x0d53('0xbf'),_0x0d53('0xc0')],'required':![]},{'model':db[_0x0d53('0xc1')],'as':_0x0d53('0xc2'),'attributes':['id','name',_0x0d53('0xc3')],'where':_0x5d5f57['query'][_0x0d53('0xc4')]?{'id':_0x5d5f57[_0x0d53('0x43')][_0x0d53('0xc4')]}:undefined,'required':_0x5d5f57[_0x0d53('0x43')][_0x0d53('0xc4')]?!![]:![]}];}return db[_0x0d53('0x9e')][_0x0d53('0x56')](_0x367140);})[_0x0d53('0x20')](function(_0x271999){_0x2cde0a[_0x0d53('0x57')]=_0x271999;return _0x2cde0a;});}})[_0x0d53('0x20')](respondWithFilteredResult(_0x59438d,_0x367140))[_0x0d53('0x58')](handleError(_0x59438d,null));};exports[_0x0d53('0x39')]=function(_0x50e8dd,_0x250bc3,_0xd97113){var _0x4b7d70,_0xd58592,_0x10c42a;if(_[_0x0d53('0x94')](_0x50e8dd[_0x0d53('0x64')][_0x0d53('0x64')])||_0x50e8dd[_0x0d53('0x64')]['body']===''){throw new db[(_0x0d53('0x78'))][(_0x0d53('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0d53('0x94')](_0x50e8dd[_0x0d53('0x64')]['to'])){throw new db[(_0x0d53('0x78'))]['ValidationError']('to\x20is\x20mandatory');}_0x4b7d70=_0x50e8dd[_0x0d53('0x64')]['to'];return db[_0x0d53('0x3d')]['find']({'where':{'id':_0x50e8dd[_0x0d53('0x59')]['id']},'include':[{'model':db[_0x0d53('0x99')],'as':_0x0d53('0xc5'),'include':[{'model':db['CmContact'],'as':_0x0d53('0x9a'),'where':{'mobile':_0x4b7d70},'limit':0x1,'order':[[_0x0d53('0x7c'),'DESC']]}]}]})[_0x0d53('0x20')](handleEntityNotFound(_0x250bc3,null))[_0x0d53('0x20')](function(_0x36b9b4){if(_0x36b9b4&&_0x36b9b4[_0x0d53('0xc5')]){_0xd58592=_0x36b9b4[_0x0d53('0x34')]({'plain':!![]});if(_0xd58592[_0x0d53('0xc5')]&&_0xd58592['List'][_0x0d53('0x9a')][_0x0d53('0x48')]){return _0xd58592[_0x0d53('0xc5')]['Contacts'][0x0];}return db['CmContact'][_0x0d53('0x5c')](_[_0x0d53('0x1b')](_0x50e8dd[_0x0d53('0x64')],{'firstName':_0x4b7d70,'mobile':_0x4b7d70,'phone':_0x4b7d70,'ListId':_0xd58592[_0x0d53('0x7e')]}));}})[_0x0d53('0x20')](handleEntityNotFound(_0x250bc3,null))[_0x0d53('0x20')](function(_0x5972b1){if(_0x5972b1){_0x10c42a=_0x5972b1;return db['SmsInteraction'][_0x0d53('0x5b')]({'where':{'ContactId':_0x10c42a['id'],'closed':![],'SmsAccountId':_0xd58592['id']}})['then'](function(_0x52574b){if(_0x52574b){return[_0x52574b,![]];}return db[_0x0d53('0x9e')][_0x0d53('0x5c')]({'UserId':_0x50e8dd[_0x0d53('0x5f')]['id'],'ContactId':_0x10c42a['id'],'SmsAccountId':_0xd58592['id'],'phone':_0x4b7d70,'firstMsgDirection':_0x0d53('0xc6'),'Messages':[_[_0x0d53('0x51')](_0x50e8dd['body'],{'read':![],'body':_0x50e8dd[_0x0d53('0x64')][_0x0d53('0x64')],'phone':_0x4b7d70,'SmsAccountId':_0xd58592['id'],'UserId':_0x50e8dd['user']['id'],'ContactId':_0x10c42a['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x0d53('0xc7')}]})[_0x0d53('0x20')](function(_0x4b7f4e){return[_0x4b7f4e,!![]];});});}})[_0x0d53('0x9f')](function(_0x49e8ed,_0x221bb2){if(_0x221bb2){return _0x49e8ed;}return db[_0x0d53('0xa6')]['create'](_[_0x0d53('0x51')](_0x50e8dd[_0x0d53('0x64')],{'read':![],'body':_0x50e8dd[_0x0d53('0x64')][_0x0d53('0x64')],'phone':_0x4b7d70,'SmsAccountId':_0xd58592['id'],'SmsInteractionId':_0x49e8ed['id'],'UserId':_0x50e8dd[_0x0d53('0x5f')]['id'],'ContactId':_0x10c42a['id']}))[_0x0d53('0x20')](function(_0x41d4d8){_0x49e8ed[_0x0d53('0xc8')][_0x0d53('0xc7')]=[];_0x49e8ed['dataValues'][_0x0d53('0xc7')]['push'](_0x41d4d8[_0x0d53('0xc8')]);return _0x49e8ed;});})[_0x0d53('0x20')](respondWithResult(_0x250bc3,null))['catch'](handleError(_0x250bc3,null));};exports[_0x0d53('0x28')]=function(_0x208ef6,_0xbed15f,_0x23ec6c){if(_0x208ef6[_0x0d53('0x64')]['id']){delete _0x208ef6[_0x0d53('0x64')]['id'];}var _0x259855,_0x4276de,_0x66deed;return db['SmsAccount'][_0x0d53('0x5b')]({'where':{'id':_0x208ef6[_0x0d53('0x59')]['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0xbed15f,null))[_0x0d53('0x20')](function(_0x44543a){if(_0x44543a){_0x66deed=_0x44543a;logger[_0x0d53('0x23')](_0x0d53('0x24'),'status',_0x0d53('0xc9'),_0x44543a[_0x0d53('0x40')],util[_0x0d53('0xca')](_0x208ef6['body'],{'showHidden':![],'depth':null}));switch(_0x44543a[_0x0d53('0x40')]){case _0x0d53('0xcb'):if(_0x208ef6[_0x0d53('0x64')][_0x0d53('0xcc')]&&_0x208ef6[_0x0d53('0x64')]['status']){_0x4276de=_0x208ef6['body'][_0x0d53('0x28')];return db[_0x0d53('0xa6')][_0x0d53('0x5b')]({'where':{'messageId':_0x208ef6['body']['skebby_dispatch_id']}});}break;case _0x0d53('0x85'):if(_0x208ef6[_0x0d53('0x64')][_0x0d53('0xcd')]&&_0x208ef6[_0x0d53('0x64')][_0x0d53('0xce')]){_0x4276de=_0x208ef6[_0x0d53('0x64')][_0x0d53('0xce')];return db[_0x0d53('0xa6')][_0x0d53('0x5b')]({'where':{'messageId':_0x208ef6[_0x0d53('0x64')][_0x0d53('0xcd')]}});}break;case _0x0d53('0x86'):if(_0x208ef6['body'][_0x0d53('0x87')]&&_0x208ef6[_0x0d53('0x64')][_0x0d53('0xcf')]){_0x4276de=_0x208ef6['body']['status_code'];return db[_0x0d53('0xa6')]['find']({'where':{'messageId':_0x208ef6[_0x0d53('0x64')][_0x0d53('0x87')]}});}break;case _0x0d53('0x8a'):var _0x5d0e16=_0x208ef6[_0x0d53('0x64')][_0x0d53('0x8b')][0x0];if(_0x5d0e16['messageId']&&_0x5d0e16['status'][_0x0d53('0xd0')]==='DELIVERED'){_0x4276de=_0x5d0e16[_0x0d53('0x28')]['groupName'];return db[_0x0d53('0xa6')]['find']({'where':{'messageId':_0x5d0e16[_0x0d53('0x82')]}});}break;case _0x0d53('0x8e'):if(_0x208ef6[_0x0d53('0x64')][_0x0d53('0x82')]&&_0x208ef6['body'][_0x0d53('0x28')]){_0x4276de=_0x208ef6[_0x0d53('0x64')][_0x0d53('0x28')];return db[_0x0d53('0xa6')][_0x0d53('0x5b')]({'where':{'messageId':_0x208ef6['body'][_0x0d53('0x82')]}});}break;case'bandwidth':if(_0x208ef6[_0x0d53('0x64')][0x0][_0x0d53('0x26')]['id']){_0x4276de=_0x208ef6[_0x0d53('0x64')][0x0][_0x0d53('0x40')];return db[_0x0d53('0xa6')]['find']({'where':{'messageId':_0x208ef6[_0x0d53('0x64')][0x0][_0x0d53('0x26')]['id']}});}break;case _0x0d53('0x93'):if(_0x208ef6[_0x0d53('0x64')][_0x0d53('0xd1')]&&_0x208ef6[_0x0d53('0x64')][_0x0d53('0x28')]){_0x4276de=_0x208ef6[_0x0d53('0x64')][_0x0d53('0x28')];return db[_0x0d53('0xa6')][_0x0d53('0x5b')]({'where':{'messageId':_0x208ef6[_0x0d53('0x64')][_0x0d53('0xd1')]}});}break;}}})[_0x0d53('0x20')](handleEntityNotFound(_0xbed15f,null))[_0x0d53('0x20')](function(_0x4bc5a1){if(_0x4bc5a1){_0x259855=_0x4bc5a1;switch(_0x66deed[_0x0d53('0x40')]){case _0x0d53('0xcb'):if(_0x4276de==='DELIVERED'){return _0x259855['update']({'read':!![]});}else{logger[_0x0d53('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0d53('0x28'),_0x0d53('0xcb'),util[_0x0d53('0xca')](_0x208ef6['body'],{'showHidden':![],'depth':null}));}break;case _0x0d53('0x85'):if(_0x4276de==='1'){return _0x259855[_0x0d53('0x63')]({'read':!![]});}else{logger[_0x0d53('0x25')](_0x0d53('0x24'),_0x0d53('0x28'),_0x0d53('0xcb'),util[_0x0d53('0xca')](_0x208ef6[_0x0d53('0x64')],{'showHidden':![],'depth':null}));}break;case _0x0d53('0x86'):if(!_0x208ef6[_0x0d53('0x64')][_0x0d53('0xd2')]&&_0x4276de>=0xc8&&_0x4276de<=0xce){return _0x259855[_0x0d53('0x63')]({'read':!![]});}else{logger[_0x0d53('0x25')](_0x0d53('0x24'),_0x0d53('0x28'),_0x0d53('0x86'),util[_0x0d53('0xca')](_0x208ef6[_0x0d53('0x64')],{'showHidden':![],'depth':null}));}break;case _0x0d53('0x8a'):var _0x17b696=_0x208ef6[_0x0d53('0x64')][_0x0d53('0x8b')][0x0];if(_0x17b696[_0x0d53('0x28')][_0x0d53('0xd0')]===_0x0d53('0xd3')){return _0x259855['update']({'read':!![]});}else{logger[_0x0d53('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0d53('0x28'),_0x0d53('0x8a'),util[_0x0d53('0xca')](_0x208ef6['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4276de==_0x0d53('0xd4')||_0x4276de==_0x0d53('0xd5')){return _0x259855['update']({'read':!![]});}else{logger[_0x0d53('0x25')](_0x0d53('0x24'),_0x0d53('0x28'),_0x0d53('0x8e'),util[_0x0d53('0xca')](_0x208ef6[_0x0d53('0x64')],{'showHidden':![],'depth':null}));}break;case _0x0d53('0x92'):if(_0x4276de=='message-delivered'){return _0x259855[_0x0d53('0x63')]({'read':!![]});}else{logger['error'](_0x0d53('0x24'),_0x0d53('0x28'),_0x0d53('0x92'),util[_0x0d53('0xca')](_0x208ef6['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4276de===_0x0d53('0xd6')||_0x4276de===_0x0d53('0xd7')){return _0x259855[_0x0d53('0x63')]({'read':!![]});}else{logger[_0x0d53('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util[_0x0d53('0xca')](_0x208ef6[_0x0d53('0x64')],{'showHidden':![],'depth':null}));}break;}return _0x259855;}})[_0x0d53('0x20')](respondWithResult(_0xbed15f,null))[_0x0d53('0x58')](handleError(_0xbed15f,null));};exports[_0x0d53('0xd8')]=function(_0x56ed3e,_0x5de8be,_0x3d048b){var _0x397f93,_0x419269,_0x2bd07c;return db[_0x0d53('0x3d')][_0x0d53('0x5b')]({'where':{'id':_0x56ed3e['params']['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0x5de8be,null))[_0x0d53('0x20')](function(_0x39d3c2){if(_0x39d3c2){_0x2bd07c=_0x39d3c2;logger['debug'](_0x0d53('0x24'),_0x0d53('0x28'),_0x0d53('0xc9'),_0x39d3c2[_0x0d53('0x40')],util[_0x0d53('0xca')](_0x56ed3e[_0x0d53('0x43')],{'showHidden':![],'depth':null}));switch(_0x39d3c2[_0x0d53('0x40')]){case _0x0d53('0x8c'):if(_0x56ed3e[_0x0d53('0x43')][_0x0d53('0xd9')]&&_0x56ed3e[_0x0d53('0x43')][_0x0d53('0xda')]){_0x419269=_0x56ed3e['query']['state'];return db['SmsMessage'][_0x0d53('0x5b')]({'where':{'messageId':_0x56ed3e[_0x0d53('0x43')][_0x0d53('0xd9')]}});}break;}}})[_0x0d53('0x20')](handleEntityNotFound(_0x5de8be,null))[_0x0d53('0x20')](function(_0x29c16e){if(_0x29c16e){_0x397f93=_0x29c16e;switch(_0x2bd07c[_0x0d53('0x40')]){case'csc':if(_0x419269==='2'||_0x419269==='6'){return _0x397f93['update']({'read':!![]});}else{logger[_0x0d53('0x25')](_0x0d53('0x24'),_0x0d53('0x28'),'csc',util[_0x0d53('0xca')](_0x56ed3e[_0x0d53('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x397f93;}})[_0x0d53('0x20')](respondWithResult(_0x5de8be,null))[_0x0d53('0x58')](handleError(_0x5de8be,null));};exports[_0x0d53('0xdb')]=function(_0x32cf5b,_0x533976,_0x463a6d){return db[_0x0d53('0x3d')][_0x0d53('0x5b')]({'where':{'id':_0x32cf5b[_0x0d53('0x59')]['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0x533976,null))[_0x0d53('0x20')](function(_0x86b429){if(_0x86b429){return _0x86b429[_0x0d53('0xdb')](_0x32cf5b[_0x0d53('0x64')][_0x0d53('0x6c')],_[_0x0d53('0xdc')](_0x32cf5b[_0x0d53('0x64')],[_0x0d53('0x6c'),'id'])||{})[_0x0d53('0x9f')](function(_0x3b323b){for(var _0x109fb5=0x0;_0x109fb5<_0x32cf5b[_0x0d53('0x64')][_0x0d53('0x6c')][_0x0d53('0x48')];_0x109fb5+=0x1){socket[_0x0d53('0xdd')](_0x0d53('0xde'),{'UserId':Number(_0x32cf5b[_0x0d53('0x64')][_0x0d53('0x6c')][_0x109fb5]),'SmsAccountId':Number(_0x32cf5b['params']['id'])});}return _0x3b323b;});}})['then'](respondWithResult(_0x533976,null))[_0x0d53('0x58')](handleError(_0x533976,null));};exports[_0x0d53('0xdf')]=function(_0x5d93f3,_0x291479,_0x5dcb10){return db['SmsAccount']['find']({'where':{'id':_0x5d93f3[_0x0d53('0x59')]['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0x291479,null))[_0x0d53('0x20')](function(_0x587e49){if(_0x587e49){return _0x587e49[_0x0d53('0xdf')](_0x5d93f3[_0x0d53('0x43')]['ids'])[_0x0d53('0x20')](function(){if(_[_0x0d53('0xe0')](_0x5d93f3[_0x0d53('0x43')][_0x0d53('0x6c')])){for(var _0x235409=0x0;_0x235409<_0x5d93f3[_0x0d53('0x43')][_0x0d53('0x6c')][_0x0d53('0x48')];_0x235409+=0x1){socket['emit'](_0x0d53('0xe1'),{'UserId':Number(_0x5d93f3['query'][_0x0d53('0x6c')][_0x235409]),'SmsAccountId':Number(_0x5d93f3[_0x0d53('0x59')]['id'])});}}else{socket[_0x0d53('0xdd')](_0x0d53('0xe1'),{'UserId':Number(_0x5d93f3['query'][_0x0d53('0x6c')]),'SmsAccountId':Number(_0x5d93f3[_0x0d53('0x59')]['id'])});}});}})[_0x0d53('0x20')](respondWithStatusCode(_0x291479,null))['catch'](handleError(_0x291479,null));};exports[_0x0d53('0xe2')]=function(_0x19f7d6,_0xe1384f,_0xe082ae){var _0x18f40f={};var _0x4fc61b={};var _0x504062;var _0x4e543e;return db[_0x0d53('0x3d')][_0x0d53('0x69')]({'where':{'id':_0x19f7d6['params']['id']}})[_0x0d53('0x20')](handleEntityNotFound(_0xe1384f,null))[_0x0d53('0x20')](function(_0x20d7c2){if(_0x20d7c2){_0x504062=_0x20d7c2;_0x4fc61b[_0x0d53('0x42')]=_[_0x0d53('0x44')](db[_0x0d53('0xa9')][_0x0d53('0x3e')]);_0x4fc61b['query']=_[_0x0d53('0x44')](_0x19f7d6[_0x0d53('0x43')]);_0x4fc61b[_0x0d53('0x4f')]=_[_0x0d53('0x45')](_0x4fc61b[_0x0d53('0x42')],_0x4fc61b['query']);_0x18f40f[_0x0d53('0x47')]=_[_0x0d53('0x45')](_0x4fc61b[_0x0d53('0x42')],qs[_0x0d53('0x46')](_0x19f7d6[_0x0d53('0x43')][_0x0d53('0x46')]));_0x18f40f[_0x0d53('0x47')]=_0x18f40f[_0x0d53('0x47')][_0x0d53('0x48')]?_0x18f40f[_0x0d53('0x47')]:_0x4fc61b[_0x0d53('0x42')];_0x18f40f['order']=qs['sort'](_0x19f7d6['query'][_0x0d53('0x4c')]);_0x18f40f[_0x0d53('0x4d')]=qs[_0x0d53('0x4f')](_[_0x0d53('0x4e')](_0x19f7d6['query'],_0x4fc61b[_0x0d53('0x4f')]));if(_0x19f7d6[_0x0d53('0x43')][_0x0d53('0x50')]){_0x18f40f[_0x0d53('0x4d')]=_[_0x0d53('0x51')](_0x18f40f['where'],{'$or':_[_0x0d53('0x3c')](_0x18f40f[_0x0d53('0x47')],function(_0xf48878){var _0x404f07={};_0x404f07[_0xf48878]={'$like':'%'+_0x19f7d6[_0x0d53('0x43')][_0x0d53('0x50')]+'%'};return _0x404f07;})});}_0x18f40f=_[_0x0d53('0x51')]({},_0x18f40f,_0x19f7d6['options']);return _0x504062[_0x0d53('0xe2')](_0x18f40f);}})['then'](function(_0x116f70){if(_0x116f70){_0x4e543e=_0x116f70[_0x0d53('0x48')];if(!_0x19f7d6['query']['hasOwnProperty'](_0x0d53('0x4a'))){_0x18f40f[_0x0d53('0x2c')]=qs[_0x0d53('0x2c')](_0x19f7d6[_0x0d53('0x43')][_0x0d53('0x2c')]);_0x18f40f[_0x0d53('0x2e')]=qs[_0x0d53('0x2e')](_0x19f7d6[_0x0d53('0x43')]['offset']);}return _0x504062[_0x0d53('0xe2')](_0x18f40f);}})[_0x0d53('0x20')](function(_0x1d4f66){if(_0x1d4f66){return _0x1d4f66?{'count':_0x4e543e,'rows':_0x1d4f66}:null;}})[_0x0d53('0x20')](respondWithResult(_0xe1384f,null))[_0x0d53('0x58')](handleError(_0xe1384f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 53b8feb..780fb96 100644 --- a/server/api/smsAccount/smsAccount.events.js +++ b/server/api/smsAccount/smsAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6926=['hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4482cf,_0x205252){var _0x47d14f=function(_0x224a46){while(--_0x224a46){_0x4482cf['push'](_0x4482cf['shift']());}};_0x47d14f(++_0x205252);}(_0x6926,0x1d8));var _0x6692=function(_0x53e473,_0x1751e2){_0x53e473=_0x53e473-0x0;var _0x35014c=_0x6926[_0x53e473];return _0x35014c;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x6692('0x0'))['db'][_0x6692('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6692('0x2')](0x0);var events={'afterCreate':_0x6692('0x3'),'afterUpdate':_0x6692('0x4'),'afterDestroy':_0x6692('0x5')};function emitEvent(_0x103a54){return function(_0x2e032b,_0x47fc31,_0x20a3d6){SmsAccountEvents[_0x6692('0x6')](_0x103a54+':'+_0x2e032b['id'],_0x2e032b);SmsAccountEvents[_0x6692('0x6')](_0x103a54,_0x2e032b);_0x20a3d6(null);};}for(var e in events){if(events[_0x6692('0x7')](e)){var event=events[e];SmsAccount[_0x6692('0x8')](e,emitEvent(event));}}module[_0x6692('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xf199=['remove','emit','hasOwnProperty','hook','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xf199,0x1d8));var _0x9f19=function(_0x4121cc,_0x3b5a38){_0x4121cc=_0x4121cc-0x0;var _0x25ec50=_0xf199[_0x4121cc];return _0x25ec50;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x9f19('0x0'))['db'][_0x9f19('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9f19('0x2')](0x0);var events={'afterCreate':_0x9f19('0x3'),'afterUpdate':_0x9f19('0x4'),'afterDestroy':_0x9f19('0x5')};function emitEvent(_0xc91d3c){return function(_0x198a65,_0x2a2a83,_0x554bbd){SmsAccountEvents[_0x9f19('0x6')](_0xc91d3c+':'+_0x198a65['id'],_0x198a65);SmsAccountEvents[_0x9f19('0x6')](_0xc91d3c,_0x198a65);_0x554bbd(null);};}for(var e in events){if(events[_0x9f19('0x7')](e)){var event=events[e];SmsAccount[_0x9f19('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d8aa171..75cd558 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35b2=['./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4e6615,_0x809588){var _0x3a0d23=function(_0x533c87){while(--_0x533c87){_0x4e6615['push'](_0x4e6615['shift']());}};_0x3a0d23(++_0x809588);}(_0x35b2,0x116));var _0x235b=function(_0x1fa589,_0x3236b2){_0x1fa589=_0x1fa589-0x0;var _0x3f9651=_0x35b2[_0x1fa589];return _0x3f9651;};'use strict';var _=require(_0x235b('0x0'));var util=require(_0x235b('0x1'));var logger=require('../../config/logger')(_0x235b('0x2'));var moment=require(_0x235b('0x3'));var BPromise=require(_0x235b('0x4'));var rp=require(_0x235b('0x5'));var fs=require('fs');var path=require(_0x235b('0x6'));var rimraf=require('rimraf');var config=require(_0x235b('0x7'));var attributes=require(_0x235b('0x8'));module[_0x235b('0x9')]=function(_0x49b7d6,_0x45707a){return _0x49b7d6[_0x235b('0xa')](_0x235b('0xb'),attributes,{'tableName':_0x235b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85c1=['api','moment','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes','lodash','util','../../config/logger'];(function(_0x58fa5b,_0x93f1c8){var _0x2edf3f=function(_0x46ee8f){while(--_0x46ee8f){_0x58fa5b['push'](_0x58fa5b['shift']());}};_0x2edf3f(++_0x93f1c8);}(_0x85c1,0x1ab));var _0x185c=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x85c1[_0x2459fd];return _0x364cd2;};'use strict';var _=require(_0x185c('0x0'));var util=require(_0x185c('0x1'));var logger=require(_0x185c('0x2'))(_0x185c('0x3'));var moment=require(_0x185c('0x4'));var BPromise=require(_0x185c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x185c('0x6'));var rimraf=require(_0x185c('0x7'));var config=require(_0x185c('0x8'));var attributes=require(_0x185c('0x9'));module['exports']=function(_0x3e0020,_0x3fc08f){return _0x3e0020['define']('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 90def44..48ed77e 100644 --- a/server/api/smsAccount/smsAccount.rpc.js +++ b/server/api/smsAccount/smsAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0ca=['jayson/promise','client','http','redis','defaults','localhost','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x25e6ce,_0x358361){var _0x5bd38e=function(_0x378dd9){while(--_0x378dd9){_0x25e6ce['push'](_0x25e6ce['shift']());}};_0x5bd38e(++_0x358361);}(_0xe0ca,0x8a));var _0xae0c=function(_0x156d1b,_0x756c49){_0x156d1b=_0x156d1b-0x0;var _0x4b20ad=_0xe0ca[_0x156d1b];return _0x4b20ad;};'use strict';var _=require(_0xae0c('0x0'));var util=require(_0xae0c('0x1'));var moment=require('moment');var BPromise=require(_0xae0c('0x2'));var rs=require(_0xae0c('0x3'));var fs=require('fs');var Redis=require(_0xae0c('0x4'));var db=require(_0xae0c('0x5'))['db'];var utils=require(_0xae0c('0x6'));var logger=require(_0xae0c('0x7'))(_0xae0c('0x8'));var config=require(_0xae0c('0x9'));var jayson=require(_0xae0c('0xa'));var client=jayson[_0xae0c('0xb')][_0xae0c('0xc')]({'port':0x232a});config[_0xae0c('0xd')]=_[_0xae0c('0xe')](config[_0xae0c('0xd')],{'host':_0xae0c('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x21182a,_0x72d8cd,_0x57a4d2){return new BPromise(function(_0x481d71,_0x145fd7){return client[_0xae0c('0x10')](_0x21182a,_0x57a4d2)[_0xae0c('0x11')](function(_0x533fc9){logger[_0xae0c('0x12')](_0xae0c('0x13'),_0x72d8cd,_0xae0c('0x14'));logger[_0xae0c('0x15')](_0xae0c('0x16'),_0x72d8cd,_0xae0c('0x14'),JSON['stringify'](_0x533fc9));if(_0x533fc9[_0xae0c('0x17')]){if(_0x533fc9[_0xae0c('0x17')][_0xae0c('0x18')]===0x1f4){logger[_0xae0c('0x17')](_0xae0c('0x13'),_0x72d8cd,_0x533fc9['error'][_0xae0c('0x19')]);return _0x145fd7(_0x533fc9[_0xae0c('0x17')]['message']);}logger[_0xae0c('0x17')]('SmsAccount,\x20%s,\x20%s',_0x72d8cd,_0x533fc9['error'][_0xae0c('0x19')]);return _0x481d71(_0x533fc9['error'][_0xae0c('0x19')]);}else{logger[_0xae0c('0x12')](_0xae0c('0x13'),_0x72d8cd,'request\x20sent');_0x481d71(_0x533fc9[_0xae0c('0x1a')][_0xae0c('0x19')]);}})[_0xae0c('0x1b')](function(_0x45f253){logger['error']('SmsAccount,\x20%s,\x20%s',_0x72d8cd,_0x45f253);_0x145fd7(_0x45f253);});});}exports['ShowSmsAccount']=function(_0x4a3ff6){var _0x55625c=this;return new Promise(function(_0x5e7e47,_0x45ee7a){return db['SmsAccount'][_0xae0c('0x1c')]({'raw':_0x4a3ff6[_0xae0c('0x1d')]?_0x4a3ff6[_0xae0c('0x1d')][_0xae0c('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a3ff6[_0xae0c('0x1d')]?_0x4a3ff6[_0xae0c('0x1d')][_0xae0c('0x1f')]||null:null,'attributes':_0x4a3ff6['options']?_0x4a3ff6[_0xae0c('0x1d')][_0xae0c('0x20')]||null:null,'include':_0x4a3ff6[_0xae0c('0x1d')]?_0x4a3ff6[_0xae0c('0x1d')][_0xae0c('0x21')]?_[_0xae0c('0x22')](_0x4a3ff6[_0xae0c('0x1d')][_0xae0c('0x21')],function(_0x4b1c83){return{'model':db[_0x4b1c83[_0xae0c('0x23')]],'as':_0x4b1c83['as'],'attributes':_0x4b1c83[_0xae0c('0x20')],'include':_0x4b1c83['include']?_[_0xae0c('0x22')](_0x4b1c83[_0xae0c('0x21')],function(_0x475897){return{'model':db[_0x475897[_0xae0c('0x23')]],'as':_0x475897['as'],'attributes':_0x475897[_0xae0c('0x20')],'include':_0x475897['include']?_['map'](_0x475897[_0xae0c('0x21')],function(_0x4ffde2){return{'model':db[_0x4ffde2[_0xae0c('0x23')]],'as':_0x4ffde2['as'],'attributes':_0x4ffde2[_0xae0c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2216f2){logger[_0xae0c('0x12')](_0xae0c('0x24'),_0x4a3ff6);logger[_0xae0c('0x15')](_0xae0c('0x24'),_0x4a3ff6,JSON['stringify'](_0x2216f2));_0x5e7e47(_0x2216f2);})[_0xae0c('0x1b')](function(_0x4ac768){logger['error'](_0xae0c('0x24'),_0x4ac768['message'],_0x4a3ff6);_0x45ee7a(_0x55625c[_0xae0c('0x17')](0x1f4,_0x4ac768[_0xae0c('0x19')]));});});}; \ No newline at end of file +var _0x53eb=['result','catch','ShowSmsAccount','SmsAccount','options','raw','attributes','map','include','model','stringify','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3060bd,_0x565bc2){var _0x5c5427=function(_0x3331fd){while(--_0x3331fd){_0x3060bd['push'](_0x3060bd['shift']());}};_0x5c5427(++_0x565bc2);}(_0x53eb,0x100));var _0xb53e=function(_0x4d925,_0x3c9cf9){_0x4d925=_0x4d925-0x0;var _0x534fb6=_0x53eb[_0x4d925];return _0x534fb6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb53e('0x0'));var rs=require(_0xb53e('0x1'));var fs=require('fs');var Redis=require(_0xb53e('0x2'));var db=require(_0xb53e('0x3'))['db'];var utils=require(_0xb53e('0x4'));var logger=require(_0xb53e('0x5'))(_0xb53e('0x6'));var config=require(_0xb53e('0x7'));var jayson=require(_0xb53e('0x8'));var client=jayson['client'][_0xb53e('0x9')]({'port':0x232a});config[_0xb53e('0xa')]=_[_0xb53e('0xb')](config[_0xb53e('0xa')],{'host':_0xb53e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb53e('0xa')]));require(_0xb53e('0xd'))['register'](socket);function respondWithRpcPromise(_0x33efeb,_0x15701c,_0x159fc8){return new BPromise(function(_0x595155,_0x239271){return client[_0xb53e('0xe')](_0x33efeb,_0x159fc8)[_0xb53e('0xf')](function(_0x499dce){logger[_0xb53e('0x10')](_0xb53e('0x11'),_0x15701c,_0xb53e('0x12'));logger[_0xb53e('0x13')](_0xb53e('0x14'),_0x15701c,_0xb53e('0x12'),JSON['stringify'](_0x499dce));if(_0x499dce[_0xb53e('0x15')]){if(_0x499dce[_0xb53e('0x15')][_0xb53e('0x16')]===0x1f4){logger[_0xb53e('0x15')](_0xb53e('0x11'),_0x15701c,_0x499dce['error'][_0xb53e('0x17')]);return _0x239271(_0x499dce['error'][_0xb53e('0x17')]);}logger['error'](_0xb53e('0x11'),_0x15701c,_0x499dce[_0xb53e('0x15')]['message']);return _0x595155(_0x499dce['error'][_0xb53e('0x17')]);}else{logger[_0xb53e('0x10')](_0xb53e('0x11'),_0x15701c,_0xb53e('0x12'));_0x595155(_0x499dce[_0xb53e('0x18')][_0xb53e('0x17')]);}})[_0xb53e('0x19')](function(_0x1e4c99){logger[_0xb53e('0x15')](_0xb53e('0x11'),_0x15701c,_0x1e4c99);_0x239271(_0x1e4c99);});});}exports[_0xb53e('0x1a')]=function(_0x237ab0){var _0x38f5cb=this;return new Promise(function(_0x50711e,_0x2d503b){return db[_0xb53e('0x1b')]['find']({'raw':_0x237ab0[_0xb53e('0x1c')]?_0x237ab0[_0xb53e('0x1c')][_0xb53e('0x1d')]===undefined?!![]:![]:!![],'where':_0x237ab0[_0xb53e('0x1c')]?_0x237ab0[_0xb53e('0x1c')]['where']||null:null,'attributes':_0x237ab0[_0xb53e('0x1c')]?_0x237ab0[_0xb53e('0x1c')][_0xb53e('0x1e')]||null:null,'include':_0x237ab0[_0xb53e('0x1c')]?_0x237ab0[_0xb53e('0x1c')]['include']?_[_0xb53e('0x1f')](_0x237ab0[_0xb53e('0x1c')][_0xb53e('0x20')],function(_0x3d3d08){return{'model':db[_0x3d3d08[_0xb53e('0x21')]],'as':_0x3d3d08['as'],'attributes':_0x3d3d08[_0xb53e('0x1e')],'include':_0x3d3d08[_0xb53e('0x20')]?_[_0xb53e('0x1f')](_0x3d3d08[_0xb53e('0x20')],function(_0x104a98){return{'model':db[_0x104a98[_0xb53e('0x21')]],'as':_0x104a98['as'],'attributes':_0x104a98[_0xb53e('0x1e')],'include':_0x104a98[_0xb53e('0x20')]?_[_0xb53e('0x1f')](_0x104a98[_0xb53e('0x20')],function(_0x396c7f){return{'model':db[_0x396c7f[_0xb53e('0x21')]],'as':_0x396c7f['as'],'attributes':_0x396c7f[_0xb53e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb53e('0xf')](function(_0x2be59d){logger[_0xb53e('0x10')]('ShowSmsAccount',_0x237ab0);logger[_0xb53e('0x13')](_0xb53e('0x1a'),_0x237ab0,JSON[_0xb53e('0x22')](_0x2be59d));_0x50711e(_0x2be59d);})[_0xb53e('0x19')](function(_0x15aa09){logger[_0xb53e('0x15')](_0xb53e('0x1a'),_0x15aa09[_0xb53e('0x17')],_0x237ab0);_0x2d503b(_0x38f5cb['error'](0x1f4,_0x15aa09[_0xb53e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ef695f6..9c4c5b9 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 92d8a4e..017d752 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x268f1d,_0xc18117){var _0x47c752=function(_0x51102b){while(--_0x51102b){_0x268f1d['push'](_0x268f1d['shift']());}};_0x47c752(++_0xc18117);}(_0x3e74,0x175));var _0x43e7=function(_0x2b5e18,_0x4e8ed2){_0x2b5e18=_0x2b5e18-0x0;var _0x4ff3f6=_0x3e74[_0x2b5e18];return _0x4ff3f6;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x2bc075,_0x2460be){var _0x3117f8=function(_0x2baac5){while(--_0x2baac5){_0x2bc075['push'](_0x2bc075['shift']());}};_0x3117f8(++_0x2460be);}(_0x55ca,0x126));var _0xa55c=function(_0x386cef,_0x112e10){_0x386cef=_0x386cef-0x0;var _0x2f866f=_0x55ca[_0x386cef];return _0x2f866f;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index a9c9e08..292d4be 100644 --- a/server/api/smsApplication/smsApplication.attributes.js +++ b/server/api/smsApplication/smsApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x934e=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4f95df,_0x587353){var _0x594870=function(_0x58fa63){while(--_0x58fa63){_0x4f95df['push'](_0x4f95df['shift']());}};_0x594870(++_0x587353);}(_0x934e,0x10b));var _0xe934=function(_0x1e547f,_0x2f675f){_0x1e547f=_0x1e547f-0x0;var _0x28a78f=_0x934e[_0x1e547f];return _0x28a78f;};'use strict';var Sequelize=require(_0xe934('0x0'));module[_0xe934('0x1')]={'priority':{'type':Sequelize[_0xe934('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe934('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe934('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe934('0x3')],'defaultValue':_0xe934('0x5')}}; \ No newline at end of file +var _0xda4e=['sequelize','STRING','TEXT'];(function(_0x4aa582,_0xfdee75){var _0x3f820b=function(_0x272bca){while(--_0x272bca){_0x4aa582['push'](_0x4aa582['shift']());}};_0x3f820b(++_0xfdee75);}(_0xda4e,0x15c));var _0xeda4=function(_0x407b5f,_0x498a47){_0x407b5f=_0x407b5f-0x0;var _0x350bba=_0xda4e[_0x407b5f];return _0x350bba;};'use strict';var Sequelize=require(_0xeda4('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xeda4('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xeda4('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xeda4('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 8a925ad..1907491 100644 --- a/server/api/smsApplication/smsApplication.controller.js +++ b/server/api/smsApplication/smsApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fb5=['status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','rawAttributes','fieldName','key','model','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SmsApplication','findAll','rows','show','params','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x247bf7,_0x3a8946){var _0x3b0098=function(_0x5ce22c){while(--_0x5ce22c){_0x247bf7['push'](_0x247bf7['shift']());}};_0x3b0098(++_0x3a8946);}(_0x0fb5,0x14c));var _0x50fb=function(_0x583443,_0x476777){_0x583443=_0x583443-0x0;var _0x5064c1=_0x0fb5[_0x583443];return _0x5064c1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x50fb('0x0'));var jsonpatch=require(_0x50fb('0x1'));var rp=require(_0x50fb('0x2'));var moment=require(_0x50fb('0x3'));var BPromise=require(_0x50fb('0x4'));var Mustache=require('mustache');var util=require(_0x50fb('0x5'));var path=require(_0x50fb('0x6'));var sox=require(_0x50fb('0x7'));var csv=require(_0x50fb('0x8'));var ejs=require(_0x50fb('0x9'));var fs=require('fs');var fs_extra=require(_0x50fb('0xa'));var _=require(_0x50fb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x50fb('0xc'));var deskjs=require(_0x50fb('0xd'));var toCsv=require(_0x50fb('0x8'));var querystring=require(_0x50fb('0xe'));var Papa=require(_0x50fb('0xf'));var Redis=require(_0x50fb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x50fb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50fb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x50fb('0x13'));var config=require(_0x50fb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x50fb('0x15'))['db'];function respondWithStatusCode(_0x2c4a9a,_0x1d94e8){_0x1d94e8=_0x1d94e8||0xcc;return function(_0x23c6f9){if(_0x23c6f9){return _0x2c4a9a[_0x50fb('0x16')](_0x1d94e8);}return _0x2c4a9a['status'](_0x1d94e8)['end']();};}function respondWithResult(_0x449f04,_0x45f07b){_0x45f07b=_0x45f07b||0xc8;return function(_0x3e5fb9){if(_0x3e5fb9){return _0x449f04[_0x50fb('0x17')](_0x45f07b)[_0x50fb('0x18')](_0x3e5fb9);}};}function respondWithFilteredResult(_0x3d6c32,_0xfc2cb8){return function(_0x13abaf){if(_0x13abaf){var _0xf510a2=typeof _0xfc2cb8[_0x50fb('0x19')]===_0x50fb('0x1a')&&typeof _0xfc2cb8['limit']===_0x50fb('0x1a');var _0x552cf2=_0x13abaf[_0x50fb('0x1b')];var _0x2f3b58=_0xf510a2?0x0:_0xfc2cb8[_0x50fb('0x19')];var _0x6a781b=_0xf510a2?_0x13abaf[_0x50fb('0x1b')]:_0xfc2cb8[_0x50fb('0x19')]+_0xfc2cb8[_0x50fb('0x1c')];var _0x4af1c0;if(_0x6a781b>=_0x552cf2){_0x6a781b=_0x552cf2;_0x4af1c0=0xc8;}else{_0x4af1c0=0xce;}_0x3d6c32[_0x50fb('0x17')](_0x4af1c0);return _0x3d6c32['set'](_0x50fb('0x1d'),_0x2f3b58+'-'+_0x6a781b+'/'+_0x552cf2)[_0x50fb('0x18')](_0x13abaf);}return null;};}function patchUpdates(_0x11ccaf){return function(_0x45ef0e){try{jsonpatch[_0x50fb('0x1e')](_0x45ef0e,_0x11ccaf,!![]);}catch(_0x1cd11e){return BPromise[_0x50fb('0x1f')](_0x1cd11e);}return _0x45ef0e['save']();};}function saveUpdates(_0xb9e2f1,_0x212072){return function(_0x44c251){if(_0x44c251){return _0x44c251[_0x50fb('0x20')](_0xb9e2f1)[_0x50fb('0x21')](function(_0x44d055){return _0x44d055;});}return null;};}function removeEntity(_0x3a5e04,_0x4ba6e7){return function(_0x524dad){if(_0x524dad){return _0x524dad[_0x50fb('0x22')]()[_0x50fb('0x21')](function(){_0x3a5e04[_0x50fb('0x17')](0xcc)[_0x50fb('0x23')]();});}};}function handleEntityNotFound(_0x485305,_0x488f77){return function(_0x411c9a){if(!_0x411c9a){_0x485305[_0x50fb('0x16')](0x194);}return _0x411c9a;};}function handleError(_0x566c40,_0x42f5cd){_0x42f5cd=_0x42f5cd||0x1f4;return function(_0x3454e7){logger[_0x50fb('0x24')](_0x3454e7[_0x50fb('0x25')]);if(_0x3454e7[_0x50fb('0x26')]){delete _0x3454e7[_0x50fb('0x26')];}_0x566c40[_0x50fb('0x17')](_0x42f5cd)[_0x50fb('0x27')](_0x3454e7);};}exports['index']=function(_0x496962,_0x758c41){var _0x141870={},_0x22b4a3={},_0x579232={'count':0x0,'rows':[]};var _0x58e551=_['map'](db['SmsApplication'][_0x50fb('0x28')],function(_0x396f21){return{'name':_0x396f21[_0x50fb('0x29')],'type':_0x396f21['type'][_0x50fb('0x2a')]};});_0x22b4a3[_0x50fb('0x2b')]=_['map'](_0x58e551,'name');_0x22b4a3['query']=_[_0x50fb('0x2c')](_0x496962['query']);_0x22b4a3[_0x50fb('0x2d')]=_['intersection'](_0x22b4a3[_0x50fb('0x2b')],_0x22b4a3['query']);_0x141870['attributes']=_[_0x50fb('0x2e')](_0x22b4a3['model'],qs['fields'](_0x496962['query'][_0x50fb('0x2f')]));_0x141870[_0x50fb('0x30')]=_0x141870[_0x50fb('0x30')][_0x50fb('0x31')]?_0x141870[_0x50fb('0x30')]:_0x22b4a3[_0x50fb('0x2b')];if(!_0x496962[_0x50fb('0x32')][_0x50fb('0x33')](_0x50fb('0x34'))){_0x141870['limit']=qs[_0x50fb('0x1c')](_0x496962[_0x50fb('0x32')][_0x50fb('0x1c')]);_0x141870[_0x50fb('0x19')]=qs['offset'](_0x496962[_0x50fb('0x32')][_0x50fb('0x19')]);}_0x141870['order']=qs[_0x50fb('0x35')](_0x496962[_0x50fb('0x32')][_0x50fb('0x35')]);_0x141870[_0x50fb('0x36')]=qs[_0x50fb('0x2d')](_[_0x50fb('0x37')](_0x496962[_0x50fb('0x32')],_0x22b4a3[_0x50fb('0x2d')]),_0x58e551);if(_0x496962[_0x50fb('0x32')][_0x50fb('0x38')]){_0x141870[_0x50fb('0x36')]=_[_0x50fb('0x39')](_0x141870[_0x50fb('0x36')],{'$or':_['map'](_0x58e551,function(_0x50b593){if(_0x50b593['type']!==_0x50fb('0x3a')){var _0x35603e={};_0x35603e[_0x50b593['name']]={'$like':'%'+_0x496962[_0x50fb('0x32')][_0x50fb('0x38')]+'%'};return _0x35603e;}})});}_0x141870=_[_0x50fb('0x39')]({},_0x141870,_0x496962[_0x50fb('0x3b')]);var _0x209738={'where':_0x141870[_0x50fb('0x36')]};return db['SmsApplication'][_0x50fb('0x1b')](_0x209738)[_0x50fb('0x21')](function(_0x4211e0){_0x579232[_0x50fb('0x1b')]=_0x4211e0;if(_0x496962['query'][_0x50fb('0x3c')]){_0x141870[_0x50fb('0x3d')]=[{'all':!![]}];}return db[_0x50fb('0x3e')][_0x50fb('0x3f')](_0x141870);})[_0x50fb('0x21')](function(_0x355cad){_0x579232[_0x50fb('0x40')]=_0x355cad;return _0x579232;})[_0x50fb('0x21')](respondWithFilteredResult(_0x758c41,_0x141870))['catch'](handleError(_0x758c41,null));};exports[_0x50fb('0x41')]=function(_0x5827c5,_0x32bf65){var _0x4c836c={'raw':!![],'where':{'id':_0x5827c5[_0x50fb('0x42')]['id']}},_0x49be80={};_0x49be80[_0x50fb('0x2b')]=_[_0x50fb('0x2c')](db[_0x50fb('0x3e')]['rawAttributes']);_0x49be80[_0x50fb('0x32')]=_[_0x50fb('0x2c')](_0x5827c5[_0x50fb('0x32')]);_0x49be80[_0x50fb('0x2d')]=_[_0x50fb('0x2e')](_0x49be80['model'],_0x49be80['query']);_0x4c836c[_0x50fb('0x30')]=_['intersection'](_0x49be80[_0x50fb('0x2b')],qs[_0x50fb('0x2f')](_0x5827c5[_0x50fb('0x32')][_0x50fb('0x2f')]));_0x4c836c['attributes']=_0x4c836c[_0x50fb('0x30')][_0x50fb('0x31')]?_0x4c836c[_0x50fb('0x30')]:_0x49be80[_0x50fb('0x2b')];if(_0x5827c5['query']['includeAll']){_0x4c836c['include']=[{'all':!![]}];}_0x4c836c=_[_0x50fb('0x39')]({},_0x4c836c,_0x5827c5[_0x50fb('0x3b')]);return db[_0x50fb('0x3e')][_0x50fb('0x43')](_0x4c836c)[_0x50fb('0x21')](handleEntityNotFound(_0x32bf65,null))['then'](respondWithResult(_0x32bf65,null))[_0x50fb('0x44')](handleError(_0x32bf65,null));};exports[_0x50fb('0x45')]=function(_0x102cd7,_0x41335e){return db[_0x50fb('0x3e')]['create'](_0x102cd7[_0x50fb('0x46')],{})[_0x50fb('0x21')](respondWithResult(_0x41335e,0xc9))['catch'](handleError(_0x41335e,null));};exports['update']=function(_0xfa8641,_0x2f8c81){if(_0xfa8641[_0x50fb('0x46')]['id']){delete _0xfa8641[_0x50fb('0x46')]['id'];}return db['SmsApplication'][_0x50fb('0x43')]({'where':{'id':_0xfa8641[_0x50fb('0x42')]['id']}})[_0x50fb('0x21')](handleEntityNotFound(_0x2f8c81,null))['then'](saveUpdates(_0xfa8641[_0x50fb('0x46')],null))['then'](respondWithResult(_0x2f8c81,null))[_0x50fb('0x44')](handleError(_0x2f8c81,null));};exports[_0x50fb('0x22')]=function(_0x4e1928,_0x4546e2){return db[_0x50fb('0x3e')][_0x50fb('0x43')]({'where':{'id':_0x4e1928[_0x50fb('0x42')]['id']}})[_0x50fb('0x21')](handleEntityNotFound(_0x4546e2,null))['then'](removeEntity(_0x4546e2,null))[_0x50fb('0x44')](handleError(_0x4546e2,null));}; \ No newline at end of file +var _0x6007=['limit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x20d168,_0x4206ea){var _0x1ad6f6=function(_0x28da91){while(--_0x28da91){_0x20d168['push'](_0x20d168['shift']());}};_0x1ad6f6(++_0x4206ea);}(_0x6007,0xf4));var _0x7600=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x6007[_0x1b64dd];return _0xeb464c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7600('0x0'));var zipdir=require(_0x7600('0x1'));var jsonpatch=require(_0x7600('0x2'));var rp=require(_0x7600('0x3'));var moment=require(_0x7600('0x4'));var BPromise=require(_0x7600('0x5'));var Mustache=require('mustache');var util=require(_0x7600('0x6'));var path=require(_0x7600('0x7'));var sox=require(_0x7600('0x8'));var csv=require(_0x7600('0x9'));var ejs=require(_0x7600('0xa'));var fs=require('fs');var fs_extra=require(_0x7600('0xb'));var _=require(_0x7600('0xc'));var squel=require(_0x7600('0xd'));var crypto=require(_0x7600('0xe'));var jsforce=require(_0x7600('0xf'));var deskjs=require(_0x7600('0x10'));var toCsv=require(_0x7600('0x9'));var querystring=require(_0x7600('0x11'));var Papa=require('papaparse');var Redis=require(_0x7600('0x12'));var authService=require(_0x7600('0x13'));var qs=require(_0x7600('0x14'));var as=require(_0x7600('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7600('0x16'))(_0x7600('0x17'));var utils=require(_0x7600('0x18'));var config=require(_0x7600('0x19'));var licenseUtil=require(_0x7600('0x1a'));var db=require(_0x7600('0x1b'))['db'];function respondWithStatusCode(_0x3a0866,_0x3a8c60){_0x3a8c60=_0x3a8c60||0xcc;return function(_0x16ef98){if(_0x16ef98){return _0x3a0866[_0x7600('0x1c')](_0x3a8c60);}return _0x3a0866[_0x7600('0x1d')](_0x3a8c60)[_0x7600('0x1e')]();};}function respondWithResult(_0x107c2a,_0x11d7ff){_0x11d7ff=_0x11d7ff||0xc8;return function(_0x31d70c){if(_0x31d70c){return _0x107c2a['status'](_0x11d7ff)[_0x7600('0x1f')](_0x31d70c);}};}function respondWithFilteredResult(_0x5f5595,_0x2287d8){return function(_0x5c3aa8){if(_0x5c3aa8){var _0x176acf=typeof _0x2287d8['offset']===_0x7600('0x20')&&typeof _0x2287d8['limit']===_0x7600('0x20');var _0x457eae=_0x5c3aa8[_0x7600('0x21')];var _0x2d3413=_0x176acf?0x0:_0x2287d8['offset'];var _0x5e2c49=_0x176acf?_0x5c3aa8[_0x7600('0x21')]:_0x2287d8['offset']+_0x2287d8['limit'];var _0x4fd3b7;if(_0x5e2c49>=_0x457eae){_0x5e2c49=_0x457eae;_0x4fd3b7=0xc8;}else{_0x4fd3b7=0xce;}_0x5f5595[_0x7600('0x1d')](_0x4fd3b7);return _0x5f5595[_0x7600('0x22')](_0x7600('0x23'),_0x2d3413+'-'+_0x5e2c49+'/'+_0x457eae)['json'](_0x5c3aa8);}return null;};}function patchUpdates(_0x97ceb){return function(_0x3f5742){try{jsonpatch['apply'](_0x3f5742,_0x97ceb,!![]);}catch(_0x2e28bf){return BPromise['reject'](_0x2e28bf);}return _0x3f5742[_0x7600('0x24')]();};}function saveUpdates(_0x275eea,_0xb246b4){return function(_0x4e6289){if(_0x4e6289){return _0x4e6289[_0x7600('0x25')](_0x275eea)[_0x7600('0x26')](function(_0x690ca9){return _0x690ca9;});}return null;};}function removeEntity(_0x4f009e,_0x54543c){return function(_0x44b89a){if(_0x44b89a){return _0x44b89a[_0x7600('0x27')]()[_0x7600('0x26')](function(){_0x4f009e[_0x7600('0x1d')](0xcc)[_0x7600('0x1e')]();});}};}function handleEntityNotFound(_0x1ce3cd,_0xd88ded){return function(_0x250519){if(!_0x250519){_0x1ce3cd[_0x7600('0x1c')](0x194);}return _0x250519;};}function handleError(_0x2659ec,_0x28335a){_0x28335a=_0x28335a||0x1f4;return function(_0x50ec68){logger[_0x7600('0x28')](_0x50ec68[_0x7600('0x29')]);if(_0x50ec68[_0x7600('0x2a')]){delete _0x50ec68['name'];}_0x2659ec['status'](_0x28335a)[_0x7600('0x2b')](_0x50ec68);};}exports[_0x7600('0x2c')]=function(_0x140078,_0x11b8ff){var _0x50cd1c={},_0x25ec96={},_0x3cdd04={'count':0x0,'rows':[]};var _0x4fd812=_[_0x7600('0x2d')](db[_0x7600('0x2e')][_0x7600('0x2f')],function(_0x3ab69f){return{'name':_0x3ab69f[_0x7600('0x30')],'type':_0x3ab69f[_0x7600('0x31')]['key']};});_0x25ec96[_0x7600('0x32')]=_[_0x7600('0x2d')](_0x4fd812,'name');_0x25ec96[_0x7600('0x33')]=_[_0x7600('0x34')](_0x140078[_0x7600('0x33')]);_0x25ec96[_0x7600('0x35')]=_[_0x7600('0x36')](_0x25ec96[_0x7600('0x32')],_0x25ec96[_0x7600('0x33')]);_0x50cd1c[_0x7600('0x37')]=_[_0x7600('0x36')](_0x25ec96[_0x7600('0x32')],qs[_0x7600('0x38')](_0x140078[_0x7600('0x33')][_0x7600('0x38')]));_0x50cd1c[_0x7600('0x37')]=_0x50cd1c['attributes'][_0x7600('0x39')]?_0x50cd1c[_0x7600('0x37')]:_0x25ec96[_0x7600('0x32')];if(!_0x140078[_0x7600('0x33')][_0x7600('0x3a')](_0x7600('0x3b'))){_0x50cd1c['limit']=qs[_0x7600('0x3c')](_0x140078['query'][_0x7600('0x3c')]);_0x50cd1c[_0x7600('0x3d')]=qs[_0x7600('0x3d')](_0x140078[_0x7600('0x33')][_0x7600('0x3d')]);}_0x50cd1c[_0x7600('0x3e')]=qs[_0x7600('0x3f')](_0x140078[_0x7600('0x33')][_0x7600('0x3f')]);_0x50cd1c[_0x7600('0x40')]=qs[_0x7600('0x35')](_['pick'](_0x140078[_0x7600('0x33')],_0x25ec96[_0x7600('0x35')]),_0x4fd812);if(_0x140078[_0x7600('0x33')][_0x7600('0x41')]){_0x50cd1c[_0x7600('0x40')]=_[_0x7600('0x42')](_0x50cd1c[_0x7600('0x40')],{'$or':_[_0x7600('0x2d')](_0x4fd812,function(_0x5ba0ec){if(_0x5ba0ec[_0x7600('0x31')]!==_0x7600('0x43')){var _0x1acf7b={};_0x1acf7b[_0x5ba0ec[_0x7600('0x2a')]]={'$like':'%'+_0x140078['query'][_0x7600('0x41')]+'%'};return _0x1acf7b;}})});}_0x50cd1c=_[_0x7600('0x42')]({},_0x50cd1c,_0x140078[_0x7600('0x44')]);var _0x1e655a={'where':_0x50cd1c[_0x7600('0x40')]};return db[_0x7600('0x2e')][_0x7600('0x21')](_0x1e655a)[_0x7600('0x26')](function(_0x2d851c){_0x3cdd04[_0x7600('0x21')]=_0x2d851c;if(_0x140078[_0x7600('0x33')][_0x7600('0x45')]){_0x50cd1c[_0x7600('0x46')]=[{'all':!![]}];}return db[_0x7600('0x2e')][_0x7600('0x47')](_0x50cd1c);})[_0x7600('0x26')](function(_0x2c4afb){_0x3cdd04['rows']=_0x2c4afb;return _0x3cdd04;})[_0x7600('0x26')](respondWithFilteredResult(_0x11b8ff,_0x50cd1c))[_0x7600('0x48')](handleError(_0x11b8ff,null));};exports['show']=function(_0x2c43f5,_0x10e99a){var _0x4b5174={'raw':!![],'where':{'id':_0x2c43f5['params']['id']}},_0x370e6f={};_0x370e6f['model']=_[_0x7600('0x34')](db[_0x7600('0x2e')][_0x7600('0x2f')]);_0x370e6f[_0x7600('0x33')]=_[_0x7600('0x34')](_0x2c43f5['query']);_0x370e6f['filters']=_[_0x7600('0x36')](_0x370e6f[_0x7600('0x32')],_0x370e6f['query']);_0x4b5174['attributes']=_['intersection'](_0x370e6f[_0x7600('0x32')],qs[_0x7600('0x38')](_0x2c43f5[_0x7600('0x33')][_0x7600('0x38')]));_0x4b5174[_0x7600('0x37')]=_0x4b5174[_0x7600('0x37')][_0x7600('0x39')]?_0x4b5174[_0x7600('0x37')]:_0x370e6f['model'];if(_0x2c43f5[_0x7600('0x33')][_0x7600('0x45')]){_0x4b5174[_0x7600('0x46')]=[{'all':!![]}];}_0x4b5174=_[_0x7600('0x42')]({},_0x4b5174,_0x2c43f5[_0x7600('0x44')]);return db[_0x7600('0x2e')][_0x7600('0x49')](_0x4b5174)[_0x7600('0x26')](handleEntityNotFound(_0x10e99a,null))[_0x7600('0x26')](respondWithResult(_0x10e99a,null))[_0x7600('0x48')](handleError(_0x10e99a,null));};exports['create']=function(_0x546512,_0x4609dc){return db[_0x7600('0x2e')]['create'](_0x546512['body'],{})['then'](respondWithResult(_0x4609dc,0xc9))['catch'](handleError(_0x4609dc,null));};exports[_0x7600('0x25')]=function(_0x2a11ad,_0x5a21f9){if(_0x2a11ad[_0x7600('0x4a')]['id']){delete _0x2a11ad[_0x7600('0x4a')]['id'];}return db[_0x7600('0x2e')][_0x7600('0x49')]({'where':{'id':_0x2a11ad[_0x7600('0x4b')]['id']}})[_0x7600('0x26')](handleEntityNotFound(_0x5a21f9,null))['then'](saveUpdates(_0x2a11ad['body'],null))[_0x7600('0x26')](respondWithResult(_0x5a21f9,null))['catch'](handleError(_0x5a21f9,null));};exports[_0x7600('0x27')]=function(_0x5eeb84,_0x10b502){return db[_0x7600('0x2e')][_0x7600('0x49')]({'where':{'id':_0x5eeb84['params']['id']}})[_0x7600('0x26')](handleEntityNotFound(_0x10b502,null))[_0x7600('0x26')](removeEntity(_0x10b502,null))[_0x7600('0x48')](handleError(_0x10b502,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0a8ad07..6f00dc1 100644 --- a/server/api/smsApplication/smsApplication.model.js +++ b/server/api/smsApplication/smsApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cff=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','sms_applications','utf8mb4'];(function(_0x3e3fe4,_0x219f91){var _0x222a8d=function(_0x381495){while(--_0x381495){_0x3e3fe4['push'](_0x3e3fe4['shift']());}};_0x222a8d(++_0x219f91);}(_0x5cff,0x129));var _0xf5cf=function(_0x5bdd12,_0xb8ea61){_0x5bdd12=_0x5bdd12-0x0;var _0x17721b=_0x5cff[_0x5bdd12];return _0x17721b;};'use strict';var _=require(_0xf5cf('0x0'));var util=require(_0xf5cf('0x1'));var logger=require(_0xf5cf('0x2'))(_0xf5cf('0x3'));var moment=require(_0xf5cf('0x4'));var BPromise=require(_0xf5cf('0x5'));var rp=require(_0xf5cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf5cf('0x7'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x2ba2f6,_0x39a369){return _0x2ba2f6[_0xf5cf('0x8')]('SmsApplication',attributes,{'tableName':_0xf5cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf5cf('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb9cf=['path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','lodash','util','moment','request-promise'];(function(_0x40151a,_0x11b93a){var _0x42f05f=function(_0x49838e){while(--_0x49838e){_0x40151a['push'](_0x40151a['shift']());}};_0x42f05f(++_0x11b93a);}(_0xb9cf,0xa4));var _0xfb9c=function(_0xc5fe88,_0x419476){_0xc5fe88=_0xc5fe88-0x0;var _0x4c7def=_0xb9cf[_0xc5fe88];return _0x4c7def;};'use strict';var _=require(_0xfb9c('0x0'));var util=require(_0xfb9c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfb9c('0x2'));var BPromise=require('bluebird');var rp=require(_0xfb9c('0x3'));var fs=require('fs');var path=require(_0xfb9c('0x4'));var rimraf=require(_0xfb9c('0x5'));var config=require(_0xfb9c('0x6'));var attributes=require(_0xfb9c('0x7'));module['exports']=function(_0x2dd64c,_0x507d8b){return _0x2dd64c[_0xfb9c('0x8')](_0xfb9c('0x9'),attributes,{'tableName':_0xfb9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb9c('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index b884aad..64c0ab3 100644 --- a/server/api/smsApplication/smsApplication.rpc.js +++ b/server/api/smsApplication/smsApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3b3=['info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x31dd4d,_0x5d0152){var _0x342c1f=function(_0x29d1bf){while(--_0x29d1bf){_0x31dd4d['push'](_0x31dd4d['shift']());}};_0x342c1f(++_0x5d0152);}(_0xe3b3,0x1b3));var _0x3e3b=function(_0x2b3d7e,_0x270c26){_0x2b3d7e=_0x2b3d7e-0x0;var _0x2a74cf=_0xe3b3[_0x2b3d7e];return _0x2a74cf;};'use strict';var _=require(_0x3e3b('0x0'));var util=require(_0x3e3b('0x1'));var moment=require(_0x3e3b('0x2'));var BPromise=require(_0x3e3b('0x3'));var rs=require(_0x3e3b('0x4'));var fs=require('fs');var Redis=require(_0x3e3b('0x5'));var db=require(_0x3e3b('0x6'))['db'];var utils=require(_0x3e3b('0x7'));var logger=require(_0x3e3b('0x8'))(_0x3e3b('0x9'));var config=require('../../config/environment');var jayson=require(_0x3e3b('0xa'));var client=jayson[_0x3e3b('0xb')][_0x3e3b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57c8f9,_0x11ed30,_0x46c928){return new BPromise(function(_0x3d7821,_0x3491a7){return client[_0x3e3b('0xd')](_0x57c8f9,_0x46c928)[_0x3e3b('0xe')](function(_0x214205){logger[_0x3e3b('0xf')](_0x3e3b('0x10'),_0x11ed30,'request\x20sent');logger[_0x3e3b('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x11ed30,_0x3e3b('0x12'),JSON[_0x3e3b('0x13')](_0x214205));if(_0x214205[_0x3e3b('0x14')]){if(_0x214205[_0x3e3b('0x14')][_0x3e3b('0x15')]===0x1f4){logger[_0x3e3b('0x14')](_0x3e3b('0x10'),_0x11ed30,_0x214205[_0x3e3b('0x14')][_0x3e3b('0x16')]);return _0x3491a7(_0x214205[_0x3e3b('0x14')][_0x3e3b('0x16')]);}logger[_0x3e3b('0x14')](_0x3e3b('0x10'),_0x11ed30,_0x214205[_0x3e3b('0x14')][_0x3e3b('0x16')]);return _0x3d7821(_0x214205[_0x3e3b('0x14')][_0x3e3b('0x16')]);}else{logger['info'](_0x3e3b('0x10'),_0x11ed30,'request\x20sent');_0x3d7821(_0x214205[_0x3e3b('0x17')][_0x3e3b('0x16')]);}})[_0x3e3b('0x18')](function(_0x5a36e3){logger['error']('SmsApplication,\x20%s,\x20%s',_0x11ed30,_0x5a36e3);_0x3491a7(_0x5a36e3);});});} \ No newline at end of file +var _0x7b77=['debug','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent'];(function(_0x5390b3,_0x207725){var _0x42d5be=function(_0x2fb24a){while(--_0x2fb24a){_0x5390b3['push'](_0x5390b3['shift']());}};_0x42d5be(++_0x207725);}(_0x7b77,0x179));var _0x77b7=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x7b77[_0x2e04ef];return _0x5722b0;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var moment=require(_0x77b7('0x2'));var BPromise=require(_0x77b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77b7('0x4'));var db=require(_0x77b7('0x5'))['db'];var utils=require(_0x77b7('0x6'));var logger=require('../../config/logger')(_0x77b7('0x7'));var config=require(_0x77b7('0x8'));var jayson=require(_0x77b7('0x9'));var client=jayson[_0x77b7('0xa')][_0x77b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe3c16b,_0x5c9387,_0x39d8e4){return new BPromise(function(_0x32b8ab,_0x33d439){return client['request'](_0xe3c16b,_0x39d8e4)[_0x77b7('0xc')](function(_0x4cfd3f){logger['info']('SmsApplication,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'));logger[_0x77b7('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'),JSON[_0x77b7('0xf')](_0x4cfd3f));if(_0x4cfd3f[_0x77b7('0x10')]){if(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x11')]===0x1f4){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x4cfd3f['error'][_0x77b7('0x13')]);return _0x33d439(_0x4cfd3f[_0x77b7('0x10')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x5c9387,_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);return _0x32b8ab(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);}else{logger[_0x77b7('0x14')](_0x77b7('0x12'),_0x5c9387,'request\x20sent');_0x32b8ab(_0x4cfd3f[_0x77b7('0x15')][_0x77b7('0x13')]);}})[_0x77b7('0x16')](function(_0x2060df){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x2060df);_0x33d439(_0x2060df);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a1103bb..a9585e3 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x5ec21d,_0x5d0772){var _0x43bde8=function(_0x1bfc7c){while(--_0x1bfc7c){_0x5ec21d['push'](_0x5ec21d['shift']());}};_0x43bde8(++_0x5d0772);}(_0x7708,0x188));var _0x8770=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x7708[_0x12aaee];return _0x37c350;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file +var _0xb62e=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x2d304d,_0x462fb5){var _0x16be9a=function(_0x2f8575){while(--_0x2f8575){_0x2d304d['push'](_0x2d304d['shift']());}};_0x16be9a(++_0x462fb5);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/describe',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0xc')](_0xeb62('0x11'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x13')]('/',auth[_0xeb62('0xa')](),controller['create']);router[_0xeb62('0x13')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x14')]);router['post'](_0xeb62('0x15'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')]('sms',_0xeb62('0x17')),controller[_0xeb62('0x18')]);router[_0xeb62('0x19')]('/:id',auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1b')),controller[_0xeb62('0x1c')]);router[_0xeb62('0x1d')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1e')),controller[_0xeb62('0x1f')]);router[_0xeb62('0x1d')]('/:id/tags',auth[_0xeb62('0xa')](),controller[_0xeb62('0x20')]);module[_0xeb62('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 4e1c76c..acc20b9 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7b5=['BOOLEAN','INTEGER','sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x3d1c0b,_0x4ffd7f){var _0xcbfbf6=function(_0x3e7875){while(--_0x3e7875){_0x3d1c0b['push'](_0x3d1c0b['shift']());}};_0xcbfbf6(++_0x4ffd7f);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x409f83,_0x4be9c9){_0x409f83=_0x409f83-0x0;var _0x4dfbf7=_0xa7b5[_0x409f83];return _0x4dfbf7;};'use strict';var Sequelize=require(_0x5a7b('0x0'));var moment=require('moment');module[_0x5a7b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5a7b('0x2')]},'disposition':{'type':Sequelize[_0x5a7b('0x3')]},'secondDisposition':{'type':Sequelize[_0x5a7b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5a7b('0x3')]},'note':{'type':Sequelize[_0x5a7b('0x3')]},'phone':{'type':Sequelize[_0x5a7b('0x3')]},'read1stAt':{'type':Sequelize[_0x5a7b('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5a7b('0x4')]('in',_0x5a7b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5a7b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x5a7b('0x4')]('in',_0x5a7b('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5a7b('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5a7b('0x7')]}}; \ No newline at end of file +var _0x0936=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x3d0b6d,_0x5bb123){var _0x2726f5=function(_0x7a4d08){while(--_0x7a4d08){_0x3d0b6d['push'](_0x3d0b6d['shift']());}};_0x2726f5(++_0x5bb123);}(_0x0936,0xde));var _0x6093=function(_0x234f93,_0x5d757e){_0x234f93=_0x234f93-0x0;var _0x2b37c0=_0x0936[_0x234f93];return _0x2b37c0;};'use strict';var Sequelize=require(_0x6093('0x0'));var moment=require(_0x6093('0x1'));module[_0x6093('0x2')]={'closed':{'type':Sequelize[_0x6093('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6093('0x4')]},'disposition':{'type':Sequelize[_0x6093('0x5')]},'secondDisposition':{'type':Sequelize[_0x6093('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6093('0x5')]},'read1stAt':{'type':Sequelize[_0x6093('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6093('0x6')]('in',_0x6093('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6093('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x6093('0x6')]('in',_0x6093('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a1d8410..3534d78 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfbe=['order','sort','where','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','spread','Tag','color','emit','smsInteractionTags:save','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','direction','secret','read','Account','Owner','get','mkdirSync','N.A.','createdAt','closed','closedAt','Messages','filter','System','lastName','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','then','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','key','findAll','sms','query','user','catch','show','params','keys','filters','intersection','model','attributes','fields','includeAll','include','merge','create','body','find','destroy','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','length','hasOwnProperty','nolimit'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xdfbe,0xb0));var _0xedfb=function(_0xdc2aad,_0x40c65d){_0xdc2aad=_0xdc2aad-0x0;var _0x4c1e47=_0xdfbe[_0xdc2aad];return _0x4c1e47;};'use strict';var rimraf=require(_0xedfb('0x0'));var zipdir=require(_0xedfb('0x1'));var moment=require(_0xedfb('0x2'));var BPromise=require(_0xedfb('0x3'));var util=require('util');var path=require(_0xedfb('0x4'));var ejs=require(_0xedfb('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xedfb('0x6'));var interaction=require(_0xedfb('0x7'));var qs=require(_0xedfb('0x8'));var pdf=require(_0xedfb('0x9'));var logger=require('../../config/logger')(_0xedfb('0xa'));var config=require('../../config/environment');var db=require(_0xedfb('0xb'))['db'];config[_0xedfb('0xc')]=_[_0xedfb('0xd')](config[_0xedfb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xedfb('0xe'))(new Redis(config[_0xedfb('0xc')]));require(_0xedfb('0xf'))['register'](socket);function respondWithStatusCode(_0x351323,_0x25553a){_0x25553a=_0x25553a||0xcc;return function(_0x47d1f7){if(_0x47d1f7){return _0x351323[_0xedfb('0x10')](_0x25553a);}return _0x351323['status'](_0x25553a)[_0xedfb('0x11')]();};}function respondWithResult(_0x58229c,_0x3e2287){_0x3e2287=_0x3e2287||0xc8;return function(_0x1dcace){if(_0x1dcace){return _0x58229c['status'](_0x3e2287)[_0xedfb('0x12')](_0x1dcace);}};}function respondWithFilteredResult(_0x3e6322,_0x49eb2f){return function(_0x18222){if(_0x18222){var _0x296d71=typeof _0x49eb2f[_0xedfb('0x13')]===_0xedfb('0x14')&&typeof _0x49eb2f[_0xedfb('0x15')]===_0xedfb('0x14');var _0x35cdb9=_0x18222[_0xedfb('0x16')];var _0x1263f5=_0x296d71?0x0:_0x49eb2f[_0xedfb('0x13')];var _0x5c1fce=_0x296d71?_0x18222[_0xedfb('0x16')]:_0x49eb2f[_0xedfb('0x13')]+_0x49eb2f['limit'];var _0x2b1bb2;if(_0x5c1fce>=_0x35cdb9){_0x5c1fce=_0x35cdb9;_0x2b1bb2=0xc8;}else{_0x2b1bb2=0xce;}_0x3e6322[_0xedfb('0x17')](_0x2b1bb2);return _0x3e6322['set'](_0xedfb('0x18'),_0x1263f5+'-'+_0x5c1fce+'/'+_0x35cdb9)[_0xedfb('0x12')](_0x18222);}return null;};}function saveUpdates(_0x3a9bfc){return function(_0x303def){if(_0x303def){return _0x303def[_0xedfb('0x19')](_0x3a9bfc)[_0xedfb('0x1a')](function(_0x5a6585){return _0x5a6585;});}return null;};}function removeEntity(_0x526f9b){return function(_0x3f40df){if(_0x3f40df){return _0x3f40df['destroy']()[_0xedfb('0x1a')](function(){_0x526f9b[_0xedfb('0x17')](0xcc)[_0xedfb('0x11')]();});}};}function handleEntityNotFound(_0x32692d){return function(_0x3f03d7){if(!_0x3f03d7){_0x32692d['sendStatus'](0x194);}return _0x3f03d7;};}function handleError(_0xf186b3,_0x146105){_0x146105=_0x146105||0x1f4;return function(_0x5b33db){logger[_0xedfb('0x1b')](_0x5b33db[_0xedfb('0x1c')]);if(_0x5b33db[_0xedfb('0x1d')]){delete _0x5b33db[_0xedfb('0x1d')];}_0xf186b3[_0xedfb('0x17')](_0x146105)[_0xedfb('0x1e')](_0x5b33db);};}exports[_0xedfb('0x1f')]=function(_0x58cc36,_0x710e38){var _0x20e045={};var _0x4baed3=_['map'](db[_0xedfb('0x20')][_0xedfb('0x21')],function(_0x562551){return{'name':_0x562551[_0xedfb('0x22')],'type':_0x562551['type'][_0xedfb('0x23')]};});_0x20e045=qs['getOptions'](_0x4baed3,_0x58cc36);return interaction[_0xedfb('0x24')](_0xedfb('0x25'),_0x58cc36[_0xedfb('0x26')],_0x58cc36[_0xedfb('0x27')],_0x20e045,_0x4baed3)[_0xedfb('0x1a')](respondWithFilteredResult(_0x710e38,_0x20e045))[_0xedfb('0x28')](handleError(_0x710e38,null));};exports[_0xedfb('0x29')]=function(_0x2ff95e,_0x3968d5){var _0x4f05aa={'raw':![],'where':{'id':_0x2ff95e[_0xedfb('0x2a')]['id']}},_0x2fa9be={};_0x2fa9be['model']=_[_0xedfb('0x2b')](db[_0xedfb('0x20')][_0xedfb('0x21')]);_0x2fa9be[_0xedfb('0x26')]=_[_0xedfb('0x2b')](_0x2ff95e[_0xedfb('0x26')]);_0x2fa9be[_0xedfb('0x2c')]=_[_0xedfb('0x2d')](_0x2fa9be[_0xedfb('0x2e')],_0x2fa9be['query']);_0x4f05aa[_0xedfb('0x2f')]=_['intersection'](_0x2fa9be['model'],qs[_0xedfb('0x30')](_0x2ff95e[_0xedfb('0x26')][_0xedfb('0x30')]));_0x4f05aa['attributes']=_0x4f05aa['attributes']['length']?_0x4f05aa[_0xedfb('0x2f')]:_0x2fa9be['model'];if(_0x2ff95e[_0xedfb('0x26')][_0xedfb('0x31')]){_0x4f05aa[_0xedfb('0x32')]=[{'all':!![]}];}_0x4f05aa=_[_0xedfb('0x33')]({},_0x4f05aa,_0x2ff95e['options']);return db[_0xedfb('0x20')]['find'](_0x4f05aa)[_0xedfb('0x1a')](handleEntityNotFound(_0x3968d5,null))[_0xedfb('0x1a')](respondWithResult(_0x3968d5,null))[_0xedfb('0x28')](handleError(_0x3968d5,null));};exports[_0xedfb('0x34')]=function(_0x11fb56,_0x4fe416){return db['SmsInteraction'][_0xedfb('0x34')](_0x11fb56[_0xedfb('0x35')],{})[_0xedfb('0x1a')](respondWithResult(_0x4fe416,0xc9))[_0xedfb('0x28')](handleError(_0x4fe416,null));};exports['update']=function(_0x2ad1dc,_0x4e05db){if(_0x2ad1dc[_0xedfb('0x35')]['id']){delete _0x2ad1dc[_0xedfb('0x35')]['id'];}return db[_0xedfb('0x20')][_0xedfb('0x36')]({'where':{'id':_0x2ad1dc['params']['id']}})['then'](handleEntityNotFound(_0x4e05db,null))['then'](saveUpdates(_0x2ad1dc['body'],null))[_0xedfb('0x1a')](respondWithResult(_0x4e05db,null))[_0xedfb('0x28')](handleError(_0x4e05db,null));};exports[_0xedfb('0x37')]=function(_0x2337ce,_0x4e585d){return db[_0xedfb('0x20')][_0xedfb('0x36')]({'where':{'id':_0x2337ce['params']['id']}})[_0xedfb('0x1a')](handleEntityNotFound(_0x4e585d,null))['then'](removeEntity(_0x4e585d,null))['catch'](handleError(_0x4e585d,null));};exports['describe']=function(_0x2f6ec9,_0x566e31){return db['SmsInteraction'][_0xedfb('0x38')]()[_0xedfb('0x1a')](respondWithResult(_0x566e31,null))[_0xedfb('0x28')](handleError(_0x566e31,null));};exports[_0xedfb('0x39')]=function(_0x58c522,_0x78a8e3){return db['SmsMessage']['find']({'where':{'id':_0x58c522['params']['id']}})['then'](handleEntityNotFound(_0x78a8e3,null))['then'](function(_0x2431c0){if(_0x2431c0){return _0x2431c0['addMessage'](_0x58c522['body'][_0xedfb('0x3a')],_[_0xedfb('0x3b')](_0x58c522['body'],[_0xedfb('0x3a'),'id'])||{});}})[_0xedfb('0x1a')](respondWithResult(_0x78a8e3,null))[_0xedfb('0x28')](handleError(_0x78a8e3,null));};exports[_0xedfb('0x3c')]=function(_0x48c548,_0x5b4e64){var _0x2135a7={'raw':![],'where':{}};var _0x2b3895={};var _0x11851d={'count':0x0,'rows':[]};return db[_0xedfb('0x20')][_0xedfb('0x3d')]({'where':{'id':_0x48c548[_0xedfb('0x2a')]['id']}})[_0xedfb('0x1a')](handleEntityNotFound(_0x5b4e64,null))['then'](function(_0x195626){if(_0x195626){_0x2b3895[_0xedfb('0x2e')]=_[_0xedfb('0x2b')](db[_0xedfb('0x3e')]['rawAttributes']);_0x2b3895[_0xedfb('0x26')]=_['keys'](_0x48c548['query']);_0x2b3895[_0xedfb('0x2c')]=_['intersection'](_0x2b3895[_0xedfb('0x2e')],_0x2b3895[_0xedfb('0x26')]);_0x2135a7[_0xedfb('0x2f')]=_[_0xedfb('0x2d')](_0x2b3895['model'],qs[_0xedfb('0x30')](_0x48c548[_0xedfb('0x26')]['fields']));_0x2135a7[_0xedfb('0x2f')]=_0x2135a7[_0xedfb('0x2f')][_0xedfb('0x3f')]?_0x2135a7['attributes']:_0x2b3895[_0xedfb('0x2e')];if(!_0x48c548[_0xedfb('0x26')][_0xedfb('0x40')](_0xedfb('0x41'))){_0x2135a7[_0xedfb('0x15')]=qs[_0xedfb('0x15')](_0x48c548['query'][_0xedfb('0x15')]);_0x2135a7[_0xedfb('0x13')]=qs[_0xedfb('0x13')](_0x48c548[_0xedfb('0x26')][_0xedfb('0x13')]);}_0x2135a7[_0xedfb('0x42')]=qs[_0xedfb('0x43')](_0x48c548[_0xedfb('0x26')][_0xedfb('0x43')]);_0x2135a7[_0xedfb('0x44')]=qs[_0xedfb('0x2c')](_['pick'](_0x48c548[_0xedfb('0x26')],_0x2b3895[_0xedfb('0x2c')]));_0x2135a7[_0xedfb('0x44')]['SmsInteractionId']=_0x195626['id'];if(_0x48c548[_0xedfb('0x26')]['filter']){_0x2135a7[_0xedfb('0x44')]=_[_0xedfb('0x33')](_0x2135a7[_0xedfb('0x44')],{'$or':_[_0xedfb('0x45')](_0x2135a7[_0xedfb('0x2f')],function(_0x1082c8){var _0x529862={};_0x529862[_0x1082c8]={'$like':'%'+_0x48c548[_0xedfb('0x26')]['filter']+'%'};return _0x529862;})});}if(_0x48c548[_0xedfb('0x26')][_0xedfb('0x46')]){var _0xb11573=_0x48c548[_0xedfb('0x26')][_0xedfb('0x46')][_0xedfb('0x47')](',');var _0xe6b63a={};_0xe6b63a[_0xb11573[0x0]]={'$gte':moment(_0xb11573[0x1])[_0xedfb('0x48')](_0xedfb('0x49'))};_0x2135a7[_0xedfb('0x44')]=_['merge'](_0x2135a7[_0xedfb('0x44')],_0xe6b63a);}_0x2135a7=_[_0xedfb('0x33')]({},_0x2135a7,_0x48c548[_0xedfb('0x4a')]);return db[_0xedfb('0x3e')]['count']({'where':_0x2135a7[_0xedfb('0x44')]})['then'](function(_0x53f052){_0x11851d['count']=_0x53f052;if(_0x48c548[_0xedfb('0x26')][_0xedfb('0x31')]){_0x2135a7[_0xedfb('0x32')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2135a7);})['then'](function(_0x75a468){_0x11851d[_0xedfb('0x4b')]=_0x75a468;return _0x11851d;});}})['then'](respondWithFilteredResult(_0x5b4e64,_0x2135a7))[_0xedfb('0x28')](handleError(_0x5b4e64,null));};exports['addTags']=function(_0x358c79,_0x1f19a6){return db['SmsInteraction'][_0xedfb('0x36')]({'where':{'id':_0x358c79['params']['id']}})[_0xedfb('0x1a')](handleEntityNotFound(_0x1f19a6,null))['then'](function(_0x4e7afa){if(_0x4e7afa){return _0x4e7afa[_0xedfb('0x4c')](_0x358c79['body'][_0xedfb('0x3a')],_[_0xedfb('0x3b')](_0x358c79[_0xedfb('0x35')],[_0xedfb('0x3a'),'id'])||{})[_0xedfb('0x4d')](function(){return db[_0xedfb('0x4e')]['findAll']({'attributes':['id',_0xedfb('0x1d'),_0xedfb('0x4f')],'where':{'id':_0x358c79['body']['ids']}});})[_0xedfb('0x1a')](function(_0x33209d){socket[_0xedfb('0x50')](_0xedfb('0x51'),{'id':Number(_0x358c79[_0xedfb('0x2a')]['id']),'tags':_0x33209d||[]});return{'id':Number(_0x358c79[_0xedfb('0x2a')]['id']),'tags':_0x33209d||[]};});}})['then'](respondWithResult(_0x1f19a6,null))[_0xedfb('0x28')](handleError(_0x1f19a6,null));};exports['removeTags']=function(_0x2fdec1,_0x10743d){return db[_0xedfb('0x20')][_0xedfb('0x36')]({'where':{'id':_0x2fdec1[_0xedfb('0x2a')]['id']}})[_0xedfb('0x1a')](handleEntityNotFound(_0x10743d,null))[_0xedfb('0x1a')](function(_0xfe69c0){if(_0xfe69c0){return _0xfe69c0['removeTags'](_0x2fdec1[_0xedfb('0x26')][_0xedfb('0x3a')]);}})[_0xedfb('0x1a')](respondWithStatusCode(_0x10743d,null))[_0xedfb('0x28')](handleError(_0x10743d,null));};exports[_0xedfb('0x52')]=function(_0x5d039d,_0x10c950){var _0x469192=moment()[_0xedfb('0x53')]()[_0xedfb('0x54')]();var _0xeb2c93=path[_0xedfb('0x55')](config[_0xedfb('0x56')],_0xedfb('0x57'),_0xedfb('0x58'),_0xedfb('0x59'));var _0x37212e=path[_0xedfb('0x55')](_0xeb2c93,_0x469192);var _0x19921c=util[_0xedfb('0x48')](_0xedfb('0x5a'),_0x5d039d[_0xedfb('0x2a')]['id'],_0x469192);var _0x549a83=path[_0xedfb('0x55')](_0xeb2c93,_0x19921c);var _0x193913=[];_0x193913[_0xedfb('0x5b')]({'model':db[_0xedfb('0x5c')],'as':_0xedfb('0x5c'),'attributes':['id',_0xedfb('0x5d')],'raw':!![]});_0x193913[_0xedfb('0x5b')]({'model':db[_0xedfb('0x5e')],'as':_0xedfb('0x5f'),'attributes':['id',_0xedfb('0x60'),'lastName'],'raw':!![]});var _0x12ff1b=[{'model':db[_0xedfb('0x3e')],'as':'Messages','attributes':['id',_0xedfb('0x35'),'createdAt',_0xedfb('0x61'),_0xedfb('0x62'),_0xedfb('0x63')],'include':_0x193913}];_0x12ff1b[_0xedfb('0x5b')]({'model':db['SmsAccount'],'as':_0xedfb('0x64'),'attributes':['id',_0xedfb('0x1d')]});_0x12ff1b[_0xedfb('0x5b')]({'model':db[_0xedfb('0x5c')],'as':_0xedfb('0x65'),'attributes':['id',_0xedfb('0x5d')]});return db[_0xedfb('0x20')][_0xedfb('0x36')]({'where':{'id':_0x5d039d[_0xedfb('0x2a')]['id']},'include':_0x12ff1b})['then'](handleEntityNotFound(_0x10c950,null))[_0xedfb('0x1a')](function(_0x2104b9){if(_0x2104b9){var _0x4363f8=_0x2104b9[_0xedfb('0x66')]({'plain':!![]});fs[_0xedfb('0x67')](_0x37212e);var _0x332826={'channel':'Sms','account':_0x4363f8[_0xedfb('0x64')][_0xedfb('0x1d')],'agent':_0x4363f8[_0xedfb('0x65')]?_0x4363f8[_0xedfb('0x65')][_0xedfb('0x5d')]:_0xedfb('0x68'),'createdAt':moment(_0x4363f8[_0xedfb('0x69')])[_0xedfb('0x48')](_0xedfb('0x49'))[_0xedfb('0x54')](),'closedAt':_0x4363f8[_0xedfb('0x6a')]?moment(_0x4363f8[_0xedfb('0x6b')])[_0xedfb('0x48')](_0xedfb('0x49'))[_0xedfb('0x54')]():'','disposition':_0x4363f8['disposition'],'messages':_(_0x4363f8[_0xedfb('0x6c')])[_0xedfb('0x6d')]({'secret':![]})[_0xedfb('0x45')](function(_0x46349a){return{'date':moment(_0x46349a[_0xedfb('0x69')])[_0xedfb('0x48')](_0xedfb('0x49'))[_0xedfb('0x54')](),'sender':_0x46349a[_0xedfb('0x61')]==='out'?_0x46349a['User']?_0x46349a[_0xedfb('0x5c')]['fullname']:_0xedfb('0x6e'):_0x46349a[_0xedfb('0x5f')][_0xedfb('0x60')]+(_0x46349a['Contact'][_0xedfb('0x6f')]?'\x20'+_0x46349a[_0xedfb('0x5f')][_0xedfb('0x6f')]:''),'body':_0x46349a['body'],'direction':_0x46349a[_0xedfb('0x61')]===_0xedfb('0x70')?'A':'C','secret':_0x46349a[_0xedfb('0x62')],'read':_0x46349a[_0xedfb('0x63')]};})['value']()};return ejs[_0xedfb('0x71')](path[_0xedfb('0x55')](config[_0xedfb('0x56')],_0xedfb('0x57'),_0xedfb('0x72'),_0xedfb('0x73')),{'interaction':_0x332826})[_0xedfb('0x1a')](function(_0x5a2175){var _0x1dd675=path[_0xedfb('0x55')](_0x37212e,_0xedfb('0x74')+_0x4363f8['id']+'-'+_0x469192+_0xedfb('0x75'));var _0x1ab1e6={'path':_0x1dd675,'channel':'Sms','interactionId':_0x4363f8['id']};return pdf[_0xedfb('0x76')](_0x5a2175,_0x1ab1e6);})[_0xedfb('0x1a')](function(){return new BPromise(function(_0x48a614,_0x287dc4){zipdir(_0x37212e,{'saveTo':_0x549a83},function(_0x3ff21b,_0x1fa4f6){if(_0x3ff21b)return _0x287dc4(_0x3ff21b);return _0x48a614(_0x1fa4f6);});})[_0xedfb('0x1a')](function(){return new BPromise(function(_0x2195a4,_0x3923a0){rimraf(_0x37212e,function(_0x2e6603){if(_0x2e6603)_0x3923a0(_0x2e6603);return _0x2195a4();});});})[_0xedfb('0x1a')](function(){return _0x10c950[_0xedfb('0x52')](_0x549a83,_0x19921c,function(_0x572767){if(_0x572767){console[_0xedfb('0x77')]('err',_0x572767);}else{fs[_0xedfb('0x78')](_0x549a83);}});});});}else{return _0x10c950[_0xedfb('0x10')](0xc8);}})['catch'](handleError(_0x10c950,null));}; \ No newline at end of file +var _0x572e=['index','SmsInteraction','rawAttributes','fieldName','key','getOptions','findAll','sms','query','user','catch','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','include','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','SmsInteractionId','merge','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','emit','smsInteractionTags:save','removeTags','download','unix','root','join','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Messages','createdAt','direction','secret','read','Account','Owner','get','Sms','N.A.','closedAt','toString','disposition','out','fullname','lastName','server','downloadInteraction.ejs','transcript-','.pdf','log','unlinkSync','zip-dir','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','stack','name'];(function(_0x46d751,_0x52d766){var _0x4ec9c6=function(_0x36ecb0){while(--_0x36ecb0){_0x46d751['push'](_0x46d751['shift']());}};_0x4ec9c6(++_0x52d766);}(_0x572e,0x137));var _0xe572=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x572e[_0x2160a9];return _0xa88cf7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe572('0x0'));var moment=require('moment');var BPromise=require(_0xe572('0x1'));var util=require(_0xe572('0x2'));var path=require(_0xe572('0x3'));var ejs=require(_0xe572('0x4'));var fs=require('fs');var _=require(_0xe572('0x5'));var Redis=require('ioredis');var interaction=require(_0xe572('0x6'));var qs=require(_0xe572('0x7'));var pdf=require(_0xe572('0x8'));var logger=require(_0xe572('0x9'))(_0xe572('0xa'));var config=require(_0xe572('0xb'));var db=require(_0xe572('0xc'))['db'];config[_0xe572('0xd')]=_[_0xe572('0xe')](config[_0xe572('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe572('0xd')]));require(_0xe572('0xf'))[_0xe572('0x10')](socket);function respondWithStatusCode(_0x3164fe,_0x12d60d){_0x12d60d=_0x12d60d||0xcc;return function(_0x1b1ba7){if(_0x1b1ba7){return _0x3164fe[_0xe572('0x11')](_0x12d60d);}return _0x3164fe[_0xe572('0x12')](_0x12d60d)[_0xe572('0x13')]();};}function respondWithResult(_0x46e845,_0x5990ea){_0x5990ea=_0x5990ea||0xc8;return function(_0x2d3323){if(_0x2d3323){return _0x46e845[_0xe572('0x12')](_0x5990ea)[_0xe572('0x14')](_0x2d3323);}};}function respondWithFilteredResult(_0x26c8ec,_0x397312){return function(_0x36aa5c){if(_0x36aa5c){var _0x352260=typeof _0x397312[_0xe572('0x15')]===_0xe572('0x16')&&typeof _0x397312[_0xe572('0x17')]===_0xe572('0x16');var _0x56285a=_0x36aa5c[_0xe572('0x18')];var _0x419d7e=_0x352260?0x0:_0x397312[_0xe572('0x15')];var _0x7e205=_0x352260?_0x36aa5c[_0xe572('0x18')]:_0x397312['offset']+_0x397312[_0xe572('0x17')];var _0x48b112;if(_0x7e205>=_0x56285a){_0x7e205=_0x56285a;_0x48b112=0xc8;}else{_0x48b112=0xce;}_0x26c8ec[_0xe572('0x12')](_0x48b112);return _0x26c8ec['set'](_0xe572('0x19'),_0x419d7e+'-'+_0x7e205+'/'+_0x56285a)[_0xe572('0x14')](_0x36aa5c);}return null;};}function saveUpdates(_0x8fba60){return function(_0x42415e){if(_0x42415e){return _0x42415e[_0xe572('0x1a')](_0x8fba60)[_0xe572('0x1b')](function(_0x11e6e5){return _0x11e6e5;});}return null;};}function removeEntity(_0x577dce){return function(_0x559e22){if(_0x559e22){return _0x559e22[_0xe572('0x1c')]()[_0xe572('0x1b')](function(){_0x577dce[_0xe572('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1899f7){return function(_0x45b6c1){if(!_0x45b6c1){_0x1899f7[_0xe572('0x11')](0x194);}return _0x45b6c1;};}function handleError(_0x26b920,_0x449a53){_0x449a53=_0x449a53||0x1f4;return function(_0x31ea94){logger['error'](_0x31ea94[_0xe572('0x1d')]);if(_0x31ea94['name']){delete _0x31ea94[_0xe572('0x1e')];}_0x26b920[_0xe572('0x12')](_0x449a53)['send'](_0x31ea94);};}exports[_0xe572('0x1f')]=function(_0x3dccc5,_0x48ed68){var _0x133b69={};var _0x5b3f6a=_['map'](db[_0xe572('0x20')][_0xe572('0x21')],function(_0x2b72c7){return{'name':_0x2b72c7[_0xe572('0x22')],'type':_0x2b72c7['type'][_0xe572('0x23')]};});_0x133b69=qs[_0xe572('0x24')](_0x5b3f6a,_0x3dccc5);return interaction[_0xe572('0x25')](_0xe572('0x26'),_0x3dccc5[_0xe572('0x27')],_0x3dccc5[_0xe572('0x28')],_0x133b69,_0x5b3f6a)[_0xe572('0x1b')](respondWithFilteredResult(_0x48ed68,_0x133b69))[_0xe572('0x29')](handleError(_0x48ed68,null));};exports[_0xe572('0x2a')]=function(_0x15e088,_0x1f27ab){var _0x4dae84={'raw':![],'where':{'id':_0x15e088[_0xe572('0x2b')]['id']}},_0x58e480={};_0x58e480['model']=_[_0xe572('0x2c')](db[_0xe572('0x20')][_0xe572('0x21')]);_0x58e480[_0xe572('0x27')]=_[_0xe572('0x2c')](_0x15e088['query']);_0x58e480[_0xe572('0x2d')]=_[_0xe572('0x2e')](_0x58e480['model'],_0x58e480[_0xe572('0x27')]);_0x4dae84[_0xe572('0x2f')]=_[_0xe572('0x2e')](_0x58e480[_0xe572('0x30')],qs[_0xe572('0x31')](_0x15e088[_0xe572('0x27')][_0xe572('0x31')]));_0x4dae84['attributes']=_0x4dae84[_0xe572('0x2f')][_0xe572('0x32')]?_0x4dae84[_0xe572('0x2f')]:_0x58e480[_0xe572('0x30')];if(_0x15e088['query'][_0xe572('0x33')]){_0x4dae84[_0xe572('0x34')]=[{'all':!![]}];}_0x4dae84=_['merge']({},_0x4dae84,_0x15e088['options']);return db[_0xe572('0x20')][_0xe572('0x35')](_0x4dae84)[_0xe572('0x1b')](handleEntityNotFound(_0x1f27ab,null))['then'](respondWithResult(_0x1f27ab,null))[_0xe572('0x29')](handleError(_0x1f27ab,null));};exports[_0xe572('0x36')]=function(_0x3caff3,_0x148acc){return db[_0xe572('0x20')][_0xe572('0x36')](_0x3caff3['body'],{})[_0xe572('0x1b')](respondWithResult(_0x148acc,0xc9))[_0xe572('0x29')](handleError(_0x148acc,null));};exports[_0xe572('0x1a')]=function(_0x4d4fbc,_0x4790f6){if(_0x4d4fbc[_0xe572('0x37')]['id']){delete _0x4d4fbc['body']['id'];}return db[_0xe572('0x20')]['find']({'where':{'id':_0x4d4fbc[_0xe572('0x2b')]['id']}})[_0xe572('0x1b')](handleEntityNotFound(_0x4790f6,null))[_0xe572('0x1b')](saveUpdates(_0x4d4fbc['body'],null))[_0xe572('0x1b')](respondWithResult(_0x4790f6,null))[_0xe572('0x29')](handleError(_0x4790f6,null));};exports['destroy']=function(_0x50f6fe,_0x3c0d52){return db[_0xe572('0x20')][_0xe572('0x35')]({'where':{'id':_0x50f6fe['params']['id']}})[_0xe572('0x1b')](handleEntityNotFound(_0x3c0d52,null))[_0xe572('0x1b')](removeEntity(_0x3c0d52,null))['catch'](handleError(_0x3c0d52,null));};exports[_0xe572('0x38')]=function(_0x1150c3,_0x385b07){return db[_0xe572('0x20')][_0xe572('0x38')]()[_0xe572('0x1b')](respondWithResult(_0x385b07,null))[_0xe572('0x29')](handleError(_0x385b07,null));};exports[_0xe572('0x39')]=function(_0x1af098,_0x2d2243){return db[_0xe572('0x3a')][_0xe572('0x35')]({'where':{'id':_0x1af098[_0xe572('0x2b')]['id']}})[_0xe572('0x1b')](handleEntityNotFound(_0x2d2243,null))[_0xe572('0x1b')](function(_0x479076){if(_0x479076){return _0x479076['addMessage'](_0x1af098['body'][_0xe572('0x3b')],_[_0xe572('0x3c')](_0x1af098[_0xe572('0x37')],[_0xe572('0x3b'),'id'])||{});}})[_0xe572('0x1b')](respondWithResult(_0x2d2243,null))['catch'](handleError(_0x2d2243,null));};exports[_0xe572('0x3d')]=function(_0x5ed519,_0xb65e80){var _0x2cce6e={'raw':![],'where':{}};var _0x434bff={};var _0x195cde={'count':0x0,'rows':[]};return db[_0xe572('0x20')][_0xe572('0x3e')]({'where':{'id':_0x5ed519[_0xe572('0x2b')]['id']}})[_0xe572('0x1b')](handleEntityNotFound(_0xb65e80,null))[_0xe572('0x1b')](function(_0x34ffe5){if(_0x34ffe5){_0x434bff[_0xe572('0x30')]=_[_0xe572('0x2c')](db[_0xe572('0x3a')][_0xe572('0x21')]);_0x434bff[_0xe572('0x27')]=_['keys'](_0x5ed519[_0xe572('0x27')]);_0x434bff['filters']=_[_0xe572('0x2e')](_0x434bff[_0xe572('0x30')],_0x434bff[_0xe572('0x27')]);_0x2cce6e['attributes']=_[_0xe572('0x2e')](_0x434bff[_0xe572('0x30')],qs['fields'](_0x5ed519[_0xe572('0x27')][_0xe572('0x31')]));_0x2cce6e[_0xe572('0x2f')]=_0x2cce6e[_0xe572('0x2f')][_0xe572('0x32')]?_0x2cce6e[_0xe572('0x2f')]:_0x434bff['model'];if(!_0x5ed519[_0xe572('0x27')][_0xe572('0x3f')](_0xe572('0x40'))){_0x2cce6e['limit']=qs[_0xe572('0x17')](_0x5ed519[_0xe572('0x27')][_0xe572('0x17')]);_0x2cce6e[_0xe572('0x15')]=qs[_0xe572('0x15')](_0x5ed519['query'][_0xe572('0x15')]);}_0x2cce6e['order']=qs[_0xe572('0x41')](_0x5ed519[_0xe572('0x27')][_0xe572('0x41')]);_0x2cce6e[_0xe572('0x42')]=qs[_0xe572('0x2d')](_[_0xe572('0x43')](_0x5ed519[_0xe572('0x27')],_0x434bff['filters']));_0x2cce6e['where'][_0xe572('0x44')]=_0x34ffe5['id'];if(_0x5ed519[_0xe572('0x27')]['filter']){_0x2cce6e[_0xe572('0x42')]=_[_0xe572('0x45')](_0x2cce6e['where'],{'$or':_[_0xe572('0x46')](_0x2cce6e[_0xe572('0x2f')],function(_0x2aa05e){var _0x3843d3={};_0x3843d3[_0x2aa05e]={'$like':'%'+_0x5ed519[_0xe572('0x27')][_0xe572('0x47')]+'%'};return _0x3843d3;})});}if(_0x5ed519[_0xe572('0x27')][_0xe572('0x48')]){var _0x262fe2=_0x5ed519['query'][_0xe572('0x48')][_0xe572('0x49')](',');var _0x2982bb={};_0x2982bb[_0x262fe2[0x0]]={'$gte':moment(_0x262fe2[0x1])['format'](_0xe572('0x4a'))};_0x2cce6e[_0xe572('0x42')]=_[_0xe572('0x45')](_0x2cce6e[_0xe572('0x42')],_0x2982bb);}_0x2cce6e=_[_0xe572('0x45')]({},_0x2cce6e,_0x5ed519[_0xe572('0x4b')]);return db[_0xe572('0x3a')][_0xe572('0x18')]({'where':_0x2cce6e[_0xe572('0x42')]})[_0xe572('0x1b')](function(_0xdee3db){_0x195cde[_0xe572('0x18')]=_0xdee3db;if(_0x5ed519['query']['includeAll']){_0x2cce6e[_0xe572('0x34')]=[{'all':!![]}];}return db[_0xe572('0x3a')][_0xe572('0x25')](_0x2cce6e);})['then'](function(_0x3b9ef1){_0x195cde[_0xe572('0x4c')]=_0x3b9ef1;return _0x195cde;});}})['then'](respondWithFilteredResult(_0xb65e80,_0x2cce6e))[_0xe572('0x29')](handleError(_0xb65e80,null));};exports[_0xe572('0x4d')]=function(_0x34ab92,_0x43fdba){return db[_0xe572('0x20')][_0xe572('0x35')]({'where':{'id':_0x34ab92[_0xe572('0x2b')]['id']}})[_0xe572('0x1b')](handleEntityNotFound(_0x43fdba,null))['then'](function(_0x5b5290){if(_0x5b5290){return _0x5b5290['setTags'](_0x34ab92['body'][_0xe572('0x3b')],_['omit'](_0x34ab92[_0xe572('0x37')],[_0xe572('0x3b'),'id'])||{})['spread'](function(){return db['Tag'][_0xe572('0x25')]({'attributes':['id',_0xe572('0x1e'),'color'],'where':{'id':_0x34ab92[_0xe572('0x37')][_0xe572('0x3b')]}});})[_0xe572('0x1b')](function(_0x3dfc32){socket[_0xe572('0x4e')](_0xe572('0x4f'),{'id':Number(_0x34ab92[_0xe572('0x2b')]['id']),'tags':_0x3dfc32||[]});return{'id':Number(_0x34ab92[_0xe572('0x2b')]['id']),'tags':_0x3dfc32||[]};});}})[_0xe572('0x1b')](respondWithResult(_0x43fdba,null))['catch'](handleError(_0x43fdba,null));};exports[_0xe572('0x50')]=function(_0x1afe22,_0x4fc67d){return db[_0xe572('0x20')][_0xe572('0x35')]({'where':{'id':_0x1afe22['params']['id']}})['then'](handleEntityNotFound(_0x4fc67d,null))['then'](function(_0x57dac7){if(_0x57dac7){return _0x57dac7[_0xe572('0x50')](_0x1afe22[_0xe572('0x27')][_0xe572('0x3b')]);}})[_0xe572('0x1b')](respondWithStatusCode(_0x4fc67d,null))[_0xe572('0x29')](handleError(_0x4fc67d,null));};exports[_0xe572('0x51')]=function(_0x3f1441,_0x2a8cec){var _0x28a6b2=moment()[_0xe572('0x52')]()['toString']();var _0x2ac117=path['join'](config[_0xe572('0x53')],'server','files','tmp');var _0x26a15d=path[_0xe572('0x54')](_0x2ac117,_0x28a6b2);var _0xea7083=util[_0xe572('0x55')](_0xe572('0x56'),_0x3f1441[_0xe572('0x2b')]['id'],_0x28a6b2);var _0x1edc03=path['join'](_0x2ac117,_0xea7083);var _0x5463e2=[];_0x5463e2[_0xe572('0x57')]({'model':db[_0xe572('0x58')],'as':_0xe572('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x5463e2[_0xe572('0x57')]({'model':db[_0xe572('0x59')],'as':_0xe572('0x5a'),'attributes':['id',_0xe572('0x5b'),'lastName'],'raw':!![]});var _0x2b942f=[{'model':db['SmsMessage'],'as':_0xe572('0x5c'),'attributes':['id','body',_0xe572('0x5d'),_0xe572('0x5e'),_0xe572('0x5f'),_0xe572('0x60')],'include':_0x5463e2}];_0x2b942f[_0xe572('0x57')]({'model':db['SmsAccount'],'as':_0xe572('0x61'),'attributes':['id','name']});_0x2b942f[_0xe572('0x57')]({'model':db[_0xe572('0x58')],'as':_0xe572('0x62'),'attributes':['id','fullname']});return db[_0xe572('0x20')][_0xe572('0x35')]({'where':{'id':_0x3f1441['params']['id']},'include':_0x2b942f})['then'](handleEntityNotFound(_0x2a8cec,null))[_0xe572('0x1b')](function(_0x52084c){if(_0x52084c){var _0x3d4529=_0x52084c[_0xe572('0x63')]({'plain':!![]});fs['mkdirSync'](_0x26a15d);var _0x451b8b={'channel':_0xe572('0x64'),'account':_0x3d4529[_0xe572('0x61')]['name'],'agent':_0x3d4529['Owner']?_0x3d4529[_0xe572('0x62')]['fullname']:_0xe572('0x65'),'createdAt':moment(_0x3d4529[_0xe572('0x5d')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x3d4529['closed']?moment(_0x3d4529[_0xe572('0x66')])[_0xe572('0x55')](_0xe572('0x4a'))[_0xe572('0x67')]():'','disposition':_0x3d4529[_0xe572('0x68')],'messages':_(_0x3d4529['Messages'])[_0xe572('0x47')]({'secret':![]})[_0xe572('0x46')](function(_0x2c80ea){return{'date':moment(_0x2c80ea['createdAt'])['format'](_0xe572('0x4a'))[_0xe572('0x67')](),'sender':_0x2c80ea['direction']===_0xe572('0x69')?_0x2c80ea[_0xe572('0x58')]?_0x2c80ea[_0xe572('0x58')][_0xe572('0x6a')]:'System':_0x2c80ea[_0xe572('0x5a')][_0xe572('0x5b')]+(_0x2c80ea[_0xe572('0x5a')][_0xe572('0x6b')]?'\x20'+_0x2c80ea['Contact'][_0xe572('0x6b')]:''),'body':_0x2c80ea[_0xe572('0x37')],'direction':_0x2c80ea[_0xe572('0x5e')]===_0xe572('0x69')?'A':'C','secret':_0x2c80ea[_0xe572('0x5f')],'read':_0x2c80ea['read']};})['value']()};return ejs['renderFile'](path[_0xe572('0x54')](config[_0xe572('0x53')],_0xe572('0x6c'),'views',_0xe572('0x6d')),{'interaction':_0x451b8b})['then'](function(_0x4910f4){var _0x1ea91f=path['join'](_0x26a15d,_0xe572('0x6e')+_0x3d4529['id']+'-'+_0x28a6b2+_0xe572('0x6f'));var _0x18c417={'path':_0x1ea91f,'channel':'Sms','interactionId':_0x3d4529['id']};return pdf['createPdfFromHTML'](_0x4910f4,_0x18c417);})[_0xe572('0x1b')](function(){return new BPromise(function(_0x33901c,_0x2d8930){zipdir(_0x26a15d,{'saveTo':_0x1edc03},function(_0x576804,_0x57888c){if(_0x576804)return _0x2d8930(_0x576804);return _0x33901c(_0x57888c);});})[_0xe572('0x1b')](function(){return new BPromise(function(_0x1181d9,_0x573faa){rimraf(_0x26a15d,function(_0x156548){if(_0x156548)_0x573faa(_0x156548);return _0x1181d9();});});})[_0xe572('0x1b')](function(){return _0x2a8cec[_0xe572('0x51')](_0x1edc03,_0xea7083,function(_0x54a12a){if(_0x54a12a){console[_0xe572('0x70')]('err',_0x54a12a);}else{fs[_0xe572('0x71')](_0x1edc03);}});});});}else{return _0x2a8cec[_0xe572('0x11')](0xc8);}})[_0xe572('0x29')](handleError(_0x2a8cec,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 72e9500..a490818 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','../../mysqldb','SmsMessage','update','remove','getUsers','setDataValue','map'];(function(_0x22d9e3,_0x141b47){var _0x2c9eac=function(_0x42f464){while(--_0x42f464){_0x22d9e3['push'](_0x22d9e3['shift']());}};_0x2c9eac(++_0x141b47);}(_0x1a85,0x178));var _0x51a8=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0x1a85[_0x687ce7];return _0x8bb835;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x51a8('0x0')];var SmsMessage=require(_0x51a8('0x1'))['db'][_0x51a8('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x51a8('0x3'),'afterDestroy':_0x51a8('0x4')};function emitEvent(_0x99e371){return function(_0x48a21b,_0xaac0bf,_0x4b76a8){_0x48a21b[_0x51a8('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x331117){_0x48a21b[_0x51a8('0x6')]('Users',_0x331117[_0x51a8('0x7')](function(_0x513685){return{'id':_0x513685['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x48a21b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x51a8('0x8')](function(_0x2f276b){_0x48a21b[_0x51a8('0x6')](_0x51a8('0x9'),_0x2f276b[_0x51a8('0xa')]);SmsInteractionEvents[_0x51a8('0xb')](_0x99e371+':'+_0x48a21b['id'],_0x48a21b);SmsInteractionEvents[_0x51a8('0xb')](_0x99e371,_0x48a21b);_0x4b76a8(null);})[_0x51a8('0xc')](_0x4b76a8(null));};}for(var e in events){if(events[_0x51a8('0xd')](e)){var event=events[e];SmsInteraction[_0x51a8('0xe')](e,emitEvent(event));}}module[_0x51a8('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x02ce=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x3008ca,_0x195c8e){var _0xd81bdf=function(_0x14d15a){while(--_0x14d15a){_0x3008ca['push'](_0x3008ca['shift']());}};_0xd81bdf(++_0x195c8e);}(_0x02ce,0x1ac));var _0xe02c=function(_0xc78bac,_0x534522){_0xc78bac=_0xc78bac-0x0;var _0x285245=_0x02ce[_0xc78bac];return _0x285245;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var SmsInteraction=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xe02c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x4'),'afterUpdate':_0xe02c('0x5'),'afterDestroy':_0xe02c('0x6')};function emitEvent(_0xf4b764){return function(_0x41b41c,_0x229653,_0x3f7436){_0x41b41c[_0xe02c('0x7')]({'attributes':['id'],'raw':!![]})[_0xe02c('0x8')](function(_0x4fecb3){_0x41b41c['setDataValue'](_0xe02c('0x9'),_0x4fecb3[_0xe02c('0xa')](function(_0x469932){return{'id':_0x469932['id']};}));return SmsMessage[_0xe02c('0xb')]({'where':{'SmsInteractionId':_0x41b41c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe02c('0x8')](function(_0x18a398){_0x41b41c[_0xe02c('0xc')](_0xe02c('0xd'),_0x18a398[_0xe02c('0xe')]);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764+':'+_0x41b41c['id'],_0x41b41c);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764,_0x41b41c);_0x3f7436(null);})[_0xe02c('0x10')](_0x3f7436(null));};}for(var e in events){if(events[_0xe02c('0x11')](e)){var event=events[e];SmsInteraction[_0xe02c('0x12')](e,emitEvent(event));}}module[_0xe02c('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 90f3630..ba45497 100644 --- a/server/api/smsInteraction/smsInteraction.model.js +++ b/server/api/smsInteraction/smsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd49f=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions'];(function(_0x37e468,_0x272d3b){var _0xde5aef=function(_0x414a62){while(--_0x414a62){_0x37e468['push'](_0x37e468['shift']());}};_0xde5aef(++_0x272d3b);}(_0xd49f,0x188));var _0xfd49=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xd49f[_0x26da89];return _0xc95b7b;};'use strict';var _=require(_0xfd49('0x0'));var util=require('util');var logger=require(_0xfd49('0x1'))(_0xfd49('0x2'));var moment=require(_0xfd49('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd49('0x4'));var rimraf=require(_0xfd49('0x5'));var config=require(_0xfd49('0x6'));var attributes=require(_0xfd49('0x7'));module[_0xfd49('0x8')]=function(_0x4361e2,_0x3bf915){return _0x4361e2[_0xfd49('0x9')]('SmsInteraction',attributes,{'tableName':_0xfd49('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ae925,_0x2924ee,_0x131786){if(_0x2ae925['changed']('closed')){_0x2ae925[_0xfd49('0xb')]=moment()['format'](_0xfd49('0xc'));}_0x131786(null,_0x2ae925);}}});}; \ No newline at end of file +var _0x88ec=['./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x88ec,0x16e));var _0xc88e=function(_0x2ab967,_0x3d5a27){_0x2ab967=_0x2ab967-0x0;var _0x1a0198=_0x88ec[_0x2ab967];return _0x1a0198;};'use strict';var _=require(_0xc88e('0x0'));var util=require(_0xc88e('0x1'));var logger=require(_0xc88e('0x2'))(_0xc88e('0x3'));var moment=require(_0xc88e('0x4'));var BPromise=require('bluebird');var rp=require(_0xc88e('0x5'));var fs=require('fs');var path=require(_0xc88e('0x6'));var rimraf=require('rimraf');var config=require(_0xc88e('0x7'));var attributes=require(_0xc88e('0x8'));module[_0xc88e('0x9')]=function(_0x1d115e,_0x95d34b){return _0x1d115e[_0xc88e('0xa')]('SmsInteraction',attributes,{'tableName':_0xc88e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x322a31,_0x1b5b5e,_0xd831be){if(_0x322a31[_0xc88e('0xc')](_0xc88e('0xd'))){_0x322a31[_0xc88e('0xe')]=moment()[_0xc88e('0xf')](_0xc88e('0x10'));}_0xd831be(null,_0x322a31);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c61efa8..f6d7bac 100644 --- a/server/api/smsInteraction/smsInteraction.rpc.js +++ b/server/api/smsInteraction/smsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3ae=['../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','where','attributes','limit','find','addTags','body','ids','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x32f8c9,_0x2e3695){var _0x47fc89=function(_0x3a4867){while(--_0x3a4867){_0x32f8c9['push'](_0x32f8c9['shift']());}};_0x47fc89(++_0x2e3695);}(_0xf3ae,0xc3));var _0xef3a=function(_0x4f42c6,_0x3e3e05){_0x4f42c6=_0x4f42c6-0x0;var _0x1a1b1f=_0xf3ae[_0x4f42c6];return _0x1a1b1f;};'use strict';var _=require('lodash');var util=require(_0xef3a('0x0'));var moment=require(_0xef3a('0x1'));var BPromise=require('bluebird');var rs=require(_0xef3a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef3a('0x3'))['db'];var utils=require(_0xef3a('0x4'));var logger=require(_0xef3a('0x5'))(_0xef3a('0x6'));var config=require('../../config/environment');var jayson=require(_0xef3a('0x7'));var client=jayson[_0xef3a('0x8')]['http']({'port':0x232a});config['redis']=_[_0xef3a('0x9')](config['redis'],{'host':_0xef3a('0xa'),'port':0x18eb});var socket=require(_0xef3a('0xb'))(new Redis(config[_0xef3a('0xc')]));require(_0xef3a('0xd'))[_0xef3a('0xe')](socket);function respondWithRpcPromise(_0x4cfb0b,_0x2e1e61,_0xacaab5){return new BPromise(function(_0x1ec6b4,_0x2662ae){return client[_0xef3a('0xf')](_0x4cfb0b,_0xacaab5)[_0xef3a('0x10')](function(_0x35e0e4){logger[_0xef3a('0x11')](_0xef3a('0x12'),_0x2e1e61,'request\x20sent');logger[_0xef3a('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2e1e61,_0xef3a('0x14'),JSON[_0xef3a('0x15')](_0x35e0e4));if(_0x35e0e4[_0xef3a('0x16')]){if(_0x35e0e4[_0xef3a('0x16')][_0xef3a('0x17')]===0x1f4){logger['error'](_0xef3a('0x12'),_0x2e1e61,_0x35e0e4['error'][_0xef3a('0x18')]);return _0x2662ae(_0x35e0e4[_0xef3a('0x16')][_0xef3a('0x18')]);}logger['error'](_0xef3a('0x12'),_0x2e1e61,_0x35e0e4[_0xef3a('0x16')][_0xef3a('0x18')]);return _0x1ec6b4(_0x35e0e4[_0xef3a('0x16')][_0xef3a('0x18')]);}else{logger[_0xef3a('0x11')](_0xef3a('0x12'),_0x2e1e61,'request\x20sent');_0x1ec6b4(_0x35e0e4[_0xef3a('0x19')][_0xef3a('0x18')]);}})[_0xef3a('0x1a')](function(_0x290d99){logger['error'](_0xef3a('0x12'),_0x2e1e61,_0x290d99);_0x2662ae(_0x290d99);});});}exports[_0xef3a('0x1b')]=function(_0x3030af){var _0x2672db=this;return new Promise(function(_0x5500c8,_0x9ac452){return db[_0xef3a('0x1c')][_0xef3a('0x1d')](_0x3030af['body'],{'raw':_0x3030af['options']?_0x3030af[_0xef3a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3030af[_0xef3a('0x1e')]?_0x3030af[_0xef3a('0x1e')][_0xef3a('0x1f')]||null:null,'attributes':_0x3030af['options']?_0x3030af[_0xef3a('0x1e')][_0xef3a('0x20')]||null:null,'limit':_0x3030af[_0xef3a('0x1e')]?_0x3030af[_0xef3a('0x1e')][_0xef3a('0x21')]||null:null})[_0xef3a('0x10')](function(_0x48af3b){logger[_0xef3a('0x11')]('UpdateSmsInteraction',_0x3030af);logger[_0xef3a('0x13')]('UpdateSmsInteraction',_0x3030af,JSON['stringify'](_0x48af3b));_0x5500c8(_0x48af3b);})['catch'](function(_0x5752bb){logger['error'](_0xef3a('0x1b'),_0x5752bb[_0xef3a('0x18')],_0x3030af);_0x9ac452(_0x2672db[_0xef3a('0x16')](0x1f4,_0x5752bb[_0xef3a('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x256562){return new Promise(function(_0x168d84,_0x2d0d5e){return db[_0xef3a('0x1c')][_0xef3a('0x22')]({'where':_0x256562[_0xef3a('0x1e')]?_0x256562[_0xef3a('0x1e')][_0xef3a('0x1f')]||null:null})[_0xef3a('0x10')](function(_0x44707d){if(_0x44707d){return _0x44707d[_0xef3a('0x23')](_0x256562[_0xef3a('0x24')][_0xef3a('0x25')],_['omit'](_0x256562[_0xef3a('0x24')],['ids','id'])||{});}})[_0xef3a('0x26')](function(_0x2ecb50){logger[_0xef3a('0x11')](_0xef3a('0x27'),_0x256562);logger['debug'](_0xef3a('0x27'),_0x256562,JSON[_0xef3a('0x15')](_0x2ecb50));_0x168d84(_0x2ecb50);})[_0xef3a('0x1a')](function(_0x55639e){logger[_0xef3a('0x16')](_0xef3a('0x27'),_0x55639e[_0xef3a('0x18')],_0x256562);_0x2d0d5e(_this['error'](0x1f4,_0x55639e[_0xef3a('0x18')]));});});}; \ No newline at end of file +var _0x714b=['defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','find','addTags','ids','omit','spread','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis'];(function(_0x5aacb9,_0x27dd07){var _0x3f804a=function(_0x85a58c){while(--_0x85a58c){_0x5aacb9['push'](_0x5aacb9['shift']());}};_0x3f804a(++_0x27dd07);}(_0x714b,0x72));var _0xb714=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x714b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb714('0x0'));var util=require(_0xb714('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb714('0x2'));var db=require(_0xb714('0x3'))['db'];var utils=require(_0xb714('0x4'));var logger=require(_0xb714('0x5'))(_0xb714('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb714('0x7')]({'port':0x232a});config[_0xb714('0x8')]=_[_0xb714('0x9')](config[_0xb714('0x8')],{'host':_0xb714('0xa'),'port':0x18eb});var socket=require(_0xb714('0xb'))(new Redis(config['redis']));require(_0xb714('0xc'))[_0xb714('0xd')](socket);function respondWithRpcPromise(_0x46517a,_0x140745,_0x116718){return new BPromise(function(_0x1af77a,_0x4511e7){return client[_0xb714('0xe')](_0x46517a,_0x116718)[_0xb714('0xf')](function(_0x188c44){logger[_0xb714('0x10')](_0xb714('0x11'),_0x140745,_0xb714('0x12'));logger[_0xb714('0x13')](_0xb714('0x14'),_0x140745,_0xb714('0x12'),JSON[_0xb714('0x15')](_0x188c44));if(_0x188c44[_0xb714('0x16')]){if(_0x188c44[_0xb714('0x16')][_0xb714('0x17')]===0x1f4){logger[_0xb714('0x16')](_0xb714('0x11'),_0x140745,_0x188c44[_0xb714('0x16')][_0xb714('0x18')]);return _0x4511e7(_0x188c44[_0xb714('0x16')][_0xb714('0x18')]);}logger[_0xb714('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x140745,_0x188c44['error'][_0xb714('0x18')]);return _0x1af77a(_0x188c44[_0xb714('0x16')][_0xb714('0x18')]);}else{logger[_0xb714('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x140745,_0xb714('0x12'));_0x1af77a(_0x188c44[_0xb714('0x19')][_0xb714('0x18')]);}})[_0xb714('0x1a')](function(_0x3fce58){logger['error'](_0xb714('0x11'),_0x140745,_0x3fce58);_0x4511e7(_0x3fce58);});});}exports[_0xb714('0x1b')]=function(_0x19f621){var _0x134825=this;return new Promise(function(_0x53e59c,_0x32860c){return db[_0xb714('0x1c')][_0xb714('0x1d')](_0x19f621[_0xb714('0x1e')],{'raw':_0x19f621['options']?_0x19f621[_0xb714('0x1f')][_0xb714('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19f621['options']?_0x19f621[_0xb714('0x1f')][_0xb714('0x21')]||null:null,'attributes':_0x19f621[_0xb714('0x1f')]?_0x19f621['options'][_0xb714('0x22')]||null:null,'limit':_0x19f621[_0xb714('0x1f')]?_0x19f621['options']['limit']||null:null})[_0xb714('0xf')](function(_0x36a374){logger[_0xb714('0x10')](_0xb714('0x1b'),_0x19f621);logger[_0xb714('0x13')](_0xb714('0x1b'),_0x19f621,JSON['stringify'](_0x36a374));_0x53e59c(_0x36a374);})[_0xb714('0x1a')](function(_0x5ec0fd){logger[_0xb714('0x16')](_0xb714('0x1b'),_0x5ec0fd['message'],_0x19f621);_0x32860c(_0x134825[_0xb714('0x16')](0x1f4,_0x5ec0fd[_0xb714('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x13ac97){return new Promise(function(_0x3963bc,_0x2a4437){return db[_0xb714('0x1c')][_0xb714('0x23')]({'where':_0x13ac97[_0xb714('0x1f')]?_0x13ac97['options']['where']||null:null})[_0xb714('0xf')](function(_0x11fcdb){if(_0x11fcdb){return _0x11fcdb[_0xb714('0x24')](_0x13ac97['body'][_0xb714('0x25')],_[_0xb714('0x26')](_0x13ac97[_0xb714('0x1e')],[_0xb714('0x25'),'id'])||{});}})[_0xb714('0x27')](function(_0xd45542){logger[_0xb714('0x10')]('AddTags',_0x13ac97);logger[_0xb714('0x13')](_0xb714('0x28'),_0x13ac97,JSON[_0xb714('0x15')](_0xd45542));_0x3963bc(_0xd45542);})[_0xb714('0x1a')](function(_0x1e9c3f){logger[_0xb714('0x16')](_0xb714('0x28'),_0x1e9c3f[_0xb714('0x18')],_0x13ac97);_0x2a4437(_this[_0xb714('0x16')](0x1f4,_0x1e9c3f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5b91d0b..8ff8c82 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e04=['emit','removeListener','length','./smsInteraction.events','save','remove','update'];(function(_0x55f025,_0x575719){var _0x58fd29=function(_0x714ed3){while(--_0x714ed3){_0x55f025['push'](_0x55f025['shift']());}};_0x58fd29(++_0x575719);}(_0x5e04,0x65));var _0x45e0=function(_0x232c13,_0x2103e6){_0x232c13=_0x232c13-0x0;var _0x31227d=_0x5e04[_0x232c13];return _0x31227d;};'use strict';var SmsInteractionEvents=require(_0x45e0('0x0'));var events=[_0x45e0('0x1'),_0x45e0('0x2'),_0x45e0('0x3')];function createListener(_0x346645,_0xfc1f97){return function(_0x27fd05){_0xfc1f97[_0x45e0('0x4')](_0x346645,_0x27fd05);};}function removeListener(_0x20cbc6,_0x1a85ee){return function(){SmsInteractionEvents[_0x45e0('0x5')](_0x20cbc6,_0x1a85ee);};}exports['register']=function(_0x161e7e){for(var _0x40df4c=0x0,_0x1fc306=events[_0x45e0('0x6')];_0x40df4c<_0x1fc306;_0x40df4c++){var _0x7dd0cc=events[_0x40df4c];var _0x3bf815=createListener('smsInteraction:'+_0x7dd0cc,_0x161e7e);SmsInteractionEvents['on'](_0x7dd0cc,_0x3bf815);}}; \ No newline at end of file +var _0x335a=['register','length','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0x564070,_0x5acd30){var _0x39f4e0=function(_0x29cf73){while(--_0x29cf73){_0x564070['push'](_0x564070['shift']());}};_0x39f4e0(++_0x5acd30);}(_0x335a,0x162));var _0xa335=function(_0x4dcc01,_0x593895){_0x4dcc01=_0x4dcc01-0x0;var _0x4242f2=_0x335a[_0x4dcc01];return _0x4242f2;};'use strict';var SmsInteractionEvents=require(_0xa335('0x0'));var events=[_0xa335('0x1'),_0xa335('0x2'),_0xa335('0x3')];function createListener(_0x16f4c0,_0x3f0cd4){return function(_0x19031c){_0x3f0cd4[_0xa335('0x4')](_0x16f4c0,_0x19031c);};}function removeListener(_0x52a086,_0x3862b8){return function(){SmsInteractionEvents[_0xa335('0x5')](_0x52a086,_0x3862b8);};}exports[_0xa335('0x6')]=function(_0x5991f9){for(var _0x2f2f56=0x0,_0x25e1f1=events[_0xa335('0x7')];_0x2f2f56<_0x25e1f1;_0x2f2f56++){var _0x111dc0=events[_0x2f2f56];var _0x10637e=createListener('smsInteraction:'+_0x111dc0,_0x5991f9);SmsInteractionEvents['on'](_0x111dc0,_0x10637e);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c462594..d7c8cfb 100644 --- a/server/api/smsMessage/index.js +++ b/server/api/smsMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe61a=['status','update','put','accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','tracked','sms','smsmessage:create','post','/:id/status'];(function(_0x5352aa,_0x13fbee){var _0x19b8ad=function(_0x482514){while(--_0x482514){_0x5352aa['push'](_0x5352aa['shift']());}};_0x19b8ad(++_0x13fbee);}(_0xe61a,0x120));var _0xae61=function(_0x15aad6,_0x3802d2){_0x15aad6=_0x15aad6-0x0;var _0x49de20=_0xe61a[_0x15aad6];return _0x49de20;};'use strict';var multer=require(_0xae61('0x0'));var util=require(_0xae61('0x1'));var path=require('path');var timeout=require(_0xae61('0x2'));var express=require('express');var router=express[_0xae61('0x3')]();var fs_extra=require(_0xae61('0x4'));var auth=require(_0xae61('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xae61('0x6'));var controller=require(_0xae61('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xae61('0x8')]);router[_0xae61('0x9')](_0xae61('0xa'),auth[_0xae61('0xb')](),controller[_0xae61('0xc')]);router['get'](_0xae61('0xd'),auth[_0xae61('0xb')](),controller[_0xae61('0xe')]);router['post']('/',auth[_0xae61('0xb')](),interaction[_0xae61('0xf')](_0xae61('0x10'),_0xae61('0x11')),controller['create']);router[_0xae61('0x12')](_0xae61('0x13'),controller[_0xae61('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xae61('0x15')]);router[_0xae61('0x16')]('/:id/accept',auth[_0xae61('0xb')](),controller[_0xae61('0x17')]);router[_0xae61('0x16')](_0xae61('0x18'),auth[_0xae61('0xb')](),controller['reject']);router[_0xae61('0x19')](_0xae61('0xd'),auth['isAuthenticated'](),controller[_0xae61('0x1a')]);module[_0xae61('0x1b')]=router; \ No newline at end of file +var _0x8ef3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x57cfaa,_0xaf9910){var _0x3258e8=function(_0x170bde){while(--_0x170bde){_0x57cfaa['push'](_0x57cfaa['shift']());}};_0x3258e8(++_0xaf9910);}(_0x8ef3,0xcb));var _0x38ef=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8ef3[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x38ef('0x0'));var util=require(_0x38ef('0x1'));var path=require(_0x38ef('0x2'));var timeout=require(_0x38ef('0x3'));var express=require(_0x38ef('0x4'));var router=express[_0x38ef('0x5')]();var fs_extra=require(_0x38ef('0x6'));var auth=require(_0x38ef('0x7'));var interaction=require(_0x38ef('0x8'));var config=require(_0x38ef('0x9'));var controller=require('./smsMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x38ef('0xa')](_0x38ef('0xb'),auth[_0x38ef('0xc')](),controller[_0x38ef('0xd')]);router[_0x38ef('0xa')](_0x38ef('0xe'),auth[_0x38ef('0xc')](),controller[_0x38ef('0xf')]);router[_0x38ef('0x10')]('/',auth['isAuthenticated'](),interaction[_0x38ef('0x11')](_0x38ef('0x12'),_0x38ef('0x13')),controller[_0x38ef('0x14')]);router[_0x38ef('0x10')](_0x38ef('0x15'),controller[_0x38ef('0x16')]);router['put'](_0x38ef('0xe'),auth[_0x38ef('0xc')](),controller[_0x38ef('0x17')]);router[_0x38ef('0x18')]('/:id/accept',auth[_0x38ef('0xc')](),controller['accept']);router[_0x38ef('0x18')](_0x38ef('0x19'),auth[_0x38ef('0xc')](),controller[_0x38ef('0x1a')]);router[_0x38ef('0x1b')](_0x38ef('0xe'),auth[_0x38ef('0xc')](),controller[_0x38ef('0x1c')]);module[_0x38ef('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 750a33a..48bea1e 100644 --- a/server/api/smsMessage/smsMessage.attributes.js +++ b/server/api/smsMessage/smsMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd881=['DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd881,0x182));var _0x1d88=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd881[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x1d88('0x0'));module['exports']={'body':{'type':Sequelize[_0x1d88('0x1')](_0x1d88('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1d88('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1d88('0x4')]('in',_0x1d88('0x5')),'defaultValue':_0x1d88('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1d88('0x6')]},'secret':{'type':Sequelize[_0x1d88('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1d88('0x7')]},'providerResponse':{'type':Sequelize[_0x1d88('0x1')]}}; \ No newline at end of file +var _0x9f4b=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x9f4b,0xfc));var _0xb9f4=function(_0x35ca14,_0x4bfa3){_0x35ca14=_0x35ca14-0x0;var _0x472770=_0x9f4b[_0x35ca14];return _0x472770;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xb9f4('0x0')](_0xb9f4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xb9f4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb9f4('0x3')]('in','out'),'defaultValue':_0xb9f4('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb9f4('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb9f4('0x5')]},'readAt':{'type':Sequelize[_0xb9f4('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb9f4('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 8c78df6..cbaf534 100644 --- a/server/api/smsMessage/smsMessage.controller.js +++ b/server/api/smsMessage/smsMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c30=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','filter','where','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','catch','show','params','keys','merge','create','body','find','destroy','describe','sms-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','SmsInteractionId','isNil','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','RejectMessage','rejectMessage','email','internal','interface','motionChannel','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4c7472,_0x3571b8){var _0x584784=function(_0x249f58){while(--_0x249f58){_0x4c7472['push'](_0x4c7472['shift']());}};_0x584784(++_0x3571b8);}(_0x9c30,0x11a));var _0x09c3=function(_0x5ebc7e,_0x259ce2){_0x5ebc7e=_0x5ebc7e-0x0;var _0x2e6876=_0x9c30[_0x5ebc7e];return _0x2e6876;};'use strict';var emlformat=require(_0x09c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09c3('0x1'));var jsonpatch=require(_0x09c3('0x2'));var rp=require(_0x09c3('0x3'));var moment=require(_0x09c3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09c3('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x09c3('0x6'));var ejs=require(_0x09c3('0x7'));var fs=require('fs');var fs_extra=require(_0x09c3('0x8'));var _=require(_0x09c3('0x9'));var squel=require(_0x09c3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x09c3('0xb'));var toCsv=require(_0x09c3('0x6'));var querystring=require(_0x09c3('0xc'));var Papa=require(_0x09c3('0xd'));var Redis=require(_0x09c3('0xe'));var authService=require(_0x09c3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x09c3('0x10'));var hardwareService=require(_0x09c3('0x11'));var logger=require(_0x09c3('0x12'))('api');var utils=require(_0x09c3('0x13'));var config=require(_0x09c3('0x14'));var licenseUtil=require(_0x09c3('0x15'));var db=require(_0x09c3('0x16'))['db'];config[_0x09c3('0x17')]=_[_0x09c3('0x18')](config[_0x09c3('0x17')],{'host':_0x09c3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x09c3('0x17')]));require(_0x09c3('0x1a'))[_0x09c3('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x09c3('0x1c')][_0x09c3('0x1d')]({'port':0x232c});var client9002=jayson[_0x09c3('0x1c')][_0x09c3('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3dc9fd,_0x14259b,_0xbdbd6c,_0x51975b){return new BPromise(function(_0x243a98,_0x350bb3){var _0x1bd4a0=_0x51975b||client;return _0x1bd4a0[_0x09c3('0x1e')](_0x3dc9fd,_0xbdbd6c)[_0x09c3('0x1f')](function(_0x477aa9){logger[_0x09c3('0x20')](_0x09c3('0x21'),_0x14259b,_0x09c3('0x22'));logger[_0x09c3('0x23')](_0x09c3('0x24'),_0x14259b,_0x09c3('0x22'),JSON[_0x09c3('0x25')](_0x477aa9));if(_0x477aa9[_0x09c3('0x26')]){if(_0x477aa9[_0x09c3('0x26')][_0x09c3('0x27')]===0x1f4){logger[_0x09c3('0x26')](_0x09c3('0x21'),_0x14259b,_0x477aa9[_0x09c3('0x26')][_0x09c3('0x28')]);return _0x350bb3(_0x477aa9[_0x09c3('0x26')][_0x09c3('0x28')]);}logger[_0x09c3('0x26')](_0x09c3('0x21'),_0x14259b,_0x477aa9[_0x09c3('0x26')][_0x09c3('0x28')]);return _0x243a98(_0x477aa9[_0x09c3('0x26')][_0x09c3('0x28')]);}else{logger[_0x09c3('0x20')](_0x09c3('0x21'),_0x14259b,_0x09c3('0x22'));_0x243a98(_0x477aa9[_0x09c3('0x29')][_0x09c3('0x28')]);}})['catch'](function(_0x3a30f2){logger['error'](_0x09c3('0x21'),_0x14259b,_0x3a30f2);_0x350bb3(_0x3a30f2);});});}function respondWithStatusCode(_0x2551cc,_0x1590d2){_0x1590d2=_0x1590d2||0xcc;return function(_0x5ee8d4){if(_0x5ee8d4){return _0x2551cc[_0x09c3('0x2a')](_0x1590d2);}return _0x2551cc[_0x09c3('0x2b')](_0x1590d2)[_0x09c3('0x2c')]();};}function respondWithResult(_0x14d803,_0x7bbeeb){_0x7bbeeb=_0x7bbeeb||0xc8;return function(_0x1157d5){if(_0x1157d5){return _0x14d803[_0x09c3('0x2b')](_0x7bbeeb)[_0x09c3('0x2d')](_0x1157d5);}};}function respondWithFilteredResult(_0x1cb705,_0xbaba46){return function(_0x5a2dfa){if(_0x5a2dfa){var _0x533683=typeof _0xbaba46[_0x09c3('0x2e')]===_0x09c3('0x2f')&&typeof _0xbaba46[_0x09c3('0x30')]==='undefined';var _0x4adc75=_0x5a2dfa[_0x09c3('0x31')];var _0x1cfe10=_0x533683?0x0:_0xbaba46['offset'];var _0x220d15=_0x533683?_0x5a2dfa[_0x09c3('0x31')]:_0xbaba46[_0x09c3('0x2e')]+_0xbaba46[_0x09c3('0x30')];var _0x4cad09;if(_0x220d15>=_0x4adc75){_0x220d15=_0x4adc75;_0x4cad09=0xc8;}else{_0x4cad09=0xce;}_0x1cb705[_0x09c3('0x2b')](_0x4cad09);return _0x1cb705['set'](_0x09c3('0x32'),_0x1cfe10+'-'+_0x220d15+'/'+_0x4adc75)[_0x09c3('0x2d')](_0x5a2dfa);}return null;};}function patchUpdates(_0x5cdabd){return function(_0x39d787){try{jsonpatch[_0x09c3('0x33')](_0x39d787,_0x5cdabd,!![]);}catch(_0x238b02){return BPromise[_0x09c3('0x34')](_0x238b02);}return _0x39d787[_0x09c3('0x35')]();};}function saveUpdates(_0x4fad9e,_0x24f225){return function(_0x6ab4a2){if(_0x6ab4a2){return _0x6ab4a2[_0x09c3('0x36')](_0x4fad9e)[_0x09c3('0x1f')](function(_0x46276d){return _0x46276d;});}return null;};}function removeEntity(_0x94cbf,_0x1ebf45){return function(_0x1ad8ab){if(_0x1ad8ab){return _0x1ad8ab['destroy']()[_0x09c3('0x1f')](function(){_0x94cbf[_0x09c3('0x2b')](0xcc)[_0x09c3('0x2c')]();});}};}function handleEntityNotFound(_0x1dbd3a,_0x393b73){return function(_0x548455){if(!_0x548455){_0x1dbd3a['sendStatus'](0x194);}return _0x548455;};}function handleError(_0x232473,_0x5b1787){_0x5b1787=_0x5b1787||0x1f4;return function(_0x8fddd2){logger[_0x09c3('0x26')](_0x8fddd2[_0x09c3('0x37')]);if(_0x8fddd2[_0x09c3('0x38')]){delete _0x8fddd2['name'];}_0x232473[_0x09c3('0x2b')](_0x5b1787)['send'](_0x8fddd2);};}exports[_0x09c3('0x39')]=function(_0x90e0fe,_0x1482fa){var _0x2b7ce7={},_0x20fd6e={},_0x4eb3ba={'count':0x0,'rows':[]};var _0x2b4e10=_[_0x09c3('0x3a')](db['SmsMessage'][_0x09c3('0x3b')],function(_0x4a3616){return{'name':_0x4a3616[_0x09c3('0x3c')],'type':_0x4a3616[_0x09c3('0x3d')][_0x09c3('0x3e')]};});_0x20fd6e[_0x09c3('0x3f')]=_['map'](_0x2b4e10,_0x09c3('0x38'));_0x20fd6e[_0x09c3('0x40')]=_['keys'](_0x90e0fe[_0x09c3('0x40')]);_0x20fd6e[_0x09c3('0x41')]=_[_0x09c3('0x42')](_0x20fd6e[_0x09c3('0x3f')],_0x20fd6e[_0x09c3('0x40')]);_0x2b7ce7['attributes']=_[_0x09c3('0x42')](_0x20fd6e['model'],qs[_0x09c3('0x43')](_0x90e0fe[_0x09c3('0x40')][_0x09c3('0x43')]));_0x2b7ce7[_0x09c3('0x44')]=_0x2b7ce7[_0x09c3('0x44')][_0x09c3('0x45')]?_0x2b7ce7[_0x09c3('0x44')]:_0x20fd6e['model'];if(!_0x90e0fe[_0x09c3('0x40')]['hasOwnProperty']('nolimit')){_0x2b7ce7['limit']=qs[_0x09c3('0x30')](_0x90e0fe[_0x09c3('0x40')][_0x09c3('0x30')]);_0x2b7ce7[_0x09c3('0x2e')]=qs[_0x09c3('0x2e')](_0x90e0fe[_0x09c3('0x40')][_0x09c3('0x2e')]);}_0x2b7ce7[_0x09c3('0x46')]=qs[_0x09c3('0x47')](_0x90e0fe[_0x09c3('0x40')][_0x09c3('0x47')]);_0x2b7ce7['where']=qs[_0x09c3('0x41')](_['pick'](_0x90e0fe[_0x09c3('0x40')],_0x20fd6e[_0x09c3('0x41')]),_0x2b4e10);if(_0x90e0fe['query'][_0x09c3('0x48')]){_0x2b7ce7[_0x09c3('0x49')]=_['merge'](_0x2b7ce7[_0x09c3('0x49')],{'$or':_[_0x09c3('0x3a')](_0x2b4e10,function(_0x41b770){if(_0x41b770[_0x09c3('0x3d')]!==_0x09c3('0x4a')){var _0x5a6895={};_0x5a6895[_0x41b770['name']]={'$like':'%'+_0x90e0fe['query'][_0x09c3('0x48')]+'%'};return _0x5a6895;}})});}_0x2b7ce7=_['merge']({},_0x2b7ce7,_0x90e0fe[_0x09c3('0x4b')]);var _0x42e64d={'where':_0x2b7ce7[_0x09c3('0x49')]};return db[_0x09c3('0x4c')][_0x09c3('0x31')](_0x42e64d)['then'](function(_0x3fb83a){_0x4eb3ba['count']=_0x3fb83a;if(_0x90e0fe[_0x09c3('0x40')][_0x09c3('0x4d')]){_0x2b7ce7[_0x09c3('0x4e')]=[{'all':!![]}];}return db[_0x09c3('0x4c')][_0x09c3('0x4f')](_0x2b7ce7);})[_0x09c3('0x1f')](function(_0x2bd8fd){_0x4eb3ba[_0x09c3('0x50')]=_0x2bd8fd;return _0x4eb3ba;})[_0x09c3('0x1f')](respondWithFilteredResult(_0x1482fa,_0x2b7ce7))[_0x09c3('0x51')](handleError(_0x1482fa,null));};exports[_0x09c3('0x52')]=function(_0x3434ea,_0x70a7ed){var _0x5de9cf={'raw':!![],'where':{'id':_0x3434ea[_0x09c3('0x53')]['id']}},_0x11b8f6={};_0x11b8f6[_0x09c3('0x3f')]=_[_0x09c3('0x54')](db[_0x09c3('0x4c')]['rawAttributes']);_0x11b8f6['query']=_[_0x09c3('0x54')](_0x3434ea['query']);_0x11b8f6[_0x09c3('0x41')]=_[_0x09c3('0x42')](_0x11b8f6['model'],_0x11b8f6[_0x09c3('0x40')]);_0x5de9cf[_0x09c3('0x44')]=_[_0x09c3('0x42')](_0x11b8f6['model'],qs[_0x09c3('0x43')](_0x3434ea[_0x09c3('0x40')][_0x09c3('0x43')]));_0x5de9cf[_0x09c3('0x44')]=_0x5de9cf[_0x09c3('0x44')]['length']?_0x5de9cf['attributes']:_0x11b8f6['model'];if(_0x3434ea[_0x09c3('0x40')][_0x09c3('0x4d')]){_0x5de9cf[_0x09c3('0x4e')]=[{'all':!![]}];}_0x5de9cf=_[_0x09c3('0x55')]({},_0x5de9cf,_0x3434ea['options']);return db[_0x09c3('0x4c')]['find'](_0x5de9cf)[_0x09c3('0x1f')](handleEntityNotFound(_0x70a7ed,null))[_0x09c3('0x1f')](respondWithResult(_0x70a7ed,null))[_0x09c3('0x51')](handleError(_0x70a7ed,null));};exports[_0x09c3('0x56')]=function(_0x39bf9c,_0x425a8e){return db[_0x09c3('0x4c')][_0x09c3('0x56')](_0x39bf9c[_0x09c3('0x57')],{})['then'](respondWithResult(_0x425a8e,0xc9))[_0x09c3('0x51')](handleError(_0x425a8e,null));};exports[_0x09c3('0x36')]=function(_0x57569d,_0x55e7fb){if(_0x57569d[_0x09c3('0x57')]['id']){delete _0x57569d['body']['id'];}return db[_0x09c3('0x4c')][_0x09c3('0x58')]({'where':{'id':_0x57569d[_0x09c3('0x53')]['id']}})[_0x09c3('0x1f')](handleEntityNotFound(_0x55e7fb,null))[_0x09c3('0x1f')](saveUpdates(_0x57569d[_0x09c3('0x57')],null))[_0x09c3('0x1f')](respondWithResult(_0x55e7fb,null))[_0x09c3('0x51')](handleError(_0x55e7fb,null));};exports[_0x09c3('0x59')]=function(_0x273a52,_0x511311){return db[_0x09c3('0x4c')]['find']({'where':{'id':_0x273a52[_0x09c3('0x53')]['id']}})[_0x09c3('0x1f')](handleEntityNotFound(_0x511311,null))[_0x09c3('0x1f')](removeEntity(_0x511311,null))[_0x09c3('0x51')](handleError(_0x511311,null));};exports[_0x09c3('0x5a')]=function(_0x2aafcf,_0x2eb892){return db[_0x09c3('0x4c')]['describe']()['then'](respondWithResult(_0x2eb892,null))[_0x09c3('0x51')](handleError(_0x2eb892,null));};var interaction_log=require('../../config/logger')(_0x09c3('0x5b'));exports[_0x09c3('0x5c')]=function(_0x2a0485,_0x2f76d7,_0x258831){var _0x1b6deb={'agent':{},'channel':'sms'};if(_0x2a0485[_0x09c3('0x57')]['id']){delete _0x2a0485[_0x09c3('0x57')]['id'];}_0x2a0485[_0x09c3('0x57')][_0x09c3('0x5d')]=!![];_0x2a0485[_0x09c3('0x57')]['readAt']=moment()[_0x09c3('0x5e')](_0x09c3('0x5f'));_0x2a0485[_0x09c3('0x57')][_0x09c3('0x60')]=_0x2a0485[_0x09c3('0x57')][_0x09c3('0x60')]||_0x2a0485['user']['id'];_0x1b6deb[_0x09c3('0x61')]['id']=_0x2a0485['body'][_0x09c3('0x60')];return db['SmsMessage'][_0x09c3('0x58')]({'where':{'id':_0x2a0485[_0x09c3('0x53')]['id'],'UserId':null}})[_0x09c3('0x1f')](handleEntityNotFound(_0x2f76d7,null))[_0x09c3('0x1f')](saveUpdates(_0x2a0485['body'],null))['then'](function(_0x2ab606){if(_0x2ab606){_0x1b6deb['message']=_0x2ab606['get']({'plain':!![]});return db[_0x09c3('0x62')][_0x09c3('0x58')]({'where':{'id':_0x2ab606[_0x09c3('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2f76d7,null))[_0x09c3('0x1f')](function(_0xb44d12){if(_0xb44d12){return _0xb44d12['update']({'UserId':_0x2a0485['body'][_0x09c3('0x60')],'read1stAt':_[_0x09c3('0x64')](_0xb44d12['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x09c3('0x1f')](function(_0x2246f0){if(_0x2246f0){_0x1b6deb['interaction']=_0x2246f0[_0x09c3('0x65')]({'plain':!![]});interaction_log[_0x09c3('0x20')](_0x09c3('0x66'),_0x2a0485[_0x09c3('0x67')]['id'],_0x2a0485[_0x09c3('0x67')][_0x09c3('0x38')],_0x2a0485[_0x09c3('0x67')]['role'],_0x1b6deb['interaction']['id'],_0x2a0485[_0x09c3('0x57')]?JSON[_0x09c3('0x25')](_0x2a0485[_0x09c3('0x57')]):_0x09c3('0x68'));return respondWithRpcPromise(_0x09c3('0x69'),_0x09c3('0x6a'),_0x1b6deb);}return null;})['then'](function(_0x18e2f4){var _0x160351=_0x09c3('0x6b')+_0x18e2f4[_0x09c3('0x28')][_0x09c3('0x6c')];return db[_0x09c3('0x6d')]['query'](_0x160351,{'type':db[_0x09c3('0x6e')][_0x09c3('0x6f')][_0x09c3('0x70')],'raw':!![]})[_0x09c3('0x1f')](function(_0x5b292d){return _0x5b292d;});})[_0x09c3('0x1f')](function(_0x37a6a7){if(_0x37a6a7){_0x1b6deb[_0x09c3('0x28')][_0x09c3('0x71')]=_0x37a6a7[0x0];if(!_0x2a0485[_0x09c3('0x57')][_0x09c3('0x60')])return;return db[_0x09c3('0x72')][_0x09c3('0x58')]({'where':{'id':_0x2a0485['body'][_0x09c3('0x60')],'role':_0x09c3('0x61')},'attributes':['id',_0x09c3('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x09c3('0x1f')](function(_0x3d0d7a){if(!_0x3d0d7a)return null;_0x1b6deb['message'][_0x09c3('0x61')]=_0x3d0d7a;return _0x1b6deb;})[_0x09c3('0x1f')](function(_0x192b15){if(_0x192b15){if(_0x2a0485['body'][_0x09c3('0x73')]){_0x1b6deb[_0x09c3('0x28')]['interface']=util[_0x09c3('0x5e')](_0x09c3('0x74'),_0x2a0485[_0x09c3('0x67')][_0x09c3('0x38')]);_0x1b6deb['message'][_0x09c3('0x75')]=_0x1b6deb[_0x09c3('0x75')];_0x1b6deb[_0x09c3('0x28')]['motionChannel']=_0x1b6deb[_0x09c3('0x75')];_0x1b6deb[_0x09c3('0x28')][_0x09c3('0x76')]=_0x09c3('0x5c');return respondWithRpcPromise(_0x09c3('0x77'),_0x09c3('0x77'),{'event':_0x09c3('0x78'),'message':_0x1b6deb[_0x09c3('0x28')]},client9002)[_0x09c3('0x1f')](function(){return _0x1b6deb;});}return _0x1b6deb;}return null;})['then'](respondWithResult(_0x2f76d7,null))[_0x09c3('0x51')](handleError(_0x2f76d7,null));};var interaction_log=require(_0x09c3('0x12'))(_0x09c3('0x5b'));exports['reject']=function(_0x5176aa,_0x3a370d,_0x9b0ae4){var _0x2a5831={'agent':{},'channel':_0x09c3('0x79')};if(_0x5176aa[_0x09c3('0x57')]['id']){delete _0x5176aa['body']['id'];}_0x5176aa[_0x09c3('0x57')][_0x09c3('0x60')]=_0x5176aa[_0x09c3('0x57')][_0x09c3('0x60')]||_0x5176aa[_0x09c3('0x67')]['id'];_0x2a5831[_0x09c3('0x61')]['id']=_0x5176aa['body'][_0x09c3('0x60')];return db[_0x09c3('0x4c')]['find']({'where':{'id':_0x5176aa[_0x09c3('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3a370d,null))['then'](function(_0x186e4b){if(_0x186e4b){_0x2a5831[_0x09c3('0x28')]=_0x186e4b[_0x09c3('0x65')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x186e4b[_0x09c3('0x63')]}});}return null;})[_0x09c3('0x1f')](handleEntityNotFound(_0x3a370d,null))[_0x09c3('0x1f')](function(_0x40c8b9){if(_0x40c8b9){_0x2a5831['interaction']=_0x40c8b9['get']({'plain':!![]});interaction_log[_0x09c3('0x20')](_0x09c3('0x7a'),_0x5176aa[_0x09c3('0x67')]['id'],_0x5176aa[_0x09c3('0x67')][_0x09c3('0x38')],_0x5176aa[_0x09c3('0x67')][_0x09c3('0x7b')],_0x2a5831[_0x09c3('0x7c')]['id'],_0x5176aa[_0x09c3('0x57')]?JSON[_0x09c3('0x25')](_0x5176aa['body']):_0x09c3('0x68'));return respondWithRpcPromise(_0x09c3('0x7d'),_0x09c3('0x7e'),_0x2a5831);}return null;})[_0x09c3('0x1f')](function(_0x25af51){var _0x2fc7d5=_0x09c3('0x6b')+_0x25af51[_0x09c3('0x28')][_0x09c3('0x6c')];return db[_0x09c3('0x6d')][_0x09c3('0x40')](_0x2fc7d5,{'type':db[_0x09c3('0x6e')]['QueryTypes'][_0x09c3('0x70')],'raw':!![]})[_0x09c3('0x1f')](function(_0x136c3c){return _0x136c3c;});})[_0x09c3('0x1f')](function(_0x52056e){if(_0x52056e){_0x2a5831[_0x09c3('0x28')][_0x09c3('0x71')]=_0x52056e[0x0];if(!_0x5176aa['body'][_0x09c3('0x60')])return;return db[_0x09c3('0x72')][_0x09c3('0x58')]({'where':{'id':_0x5176aa[_0x09c3('0x57')][_0x09c3('0x60')],'role':_0x09c3('0x61')},'attributes':['id','name','fullname',_0x09c3('0x7f'),_0x09c3('0x80')],'raw':!![]});}return null;})[_0x09c3('0x1f')](function(_0x483456){if(!_0x483456)return null;_0x2a5831[_0x09c3('0x28')][_0x09c3('0x61')]=_0x483456;return _0x2a5831;})['then'](function(_0x939d7e){if(_0x939d7e){_0x939d7e['message'][_0x09c3('0x81')]=util[_0x09c3('0x5e')]('SIP/%s',_0x5176aa[_0x09c3('0x67')][_0x09c3('0x38')]);_0x939d7e[_0x09c3('0x28')][_0x09c3('0x75')]=_0x2a5831[_0x09c3('0x75')];_0x939d7e[_0x09c3('0x28')][_0x09c3('0x82')]=_0x2a5831[_0x09c3('0x75')];_0x939d7e[_0x09c3('0x28')][_0x09c3('0x76')]=_0x09c3('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0x09c3('0x83'),'message':_0x939d7e[_0x09c3('0x28')]},client9002);return _0x2a5831;}return null;})[_0x09c3('0x1f')](respondWithResult(_0x3a370d,null))[_0x09c3('0x51')](handleError(_0x3a370d,null));};exports[_0x09c3('0x2b')]=function(_0x159439,_0x43daa7,_0x19cc9e){if(_0x159439[_0x09c3('0x57')]['id']){delete _0x159439[_0x09c3('0x57')]['id'];}var _0xb91f11;return db[_0x09c3('0x4c')][_0x09c3('0x58')]({'where':{'id':_0x159439[_0x09c3('0x53')]['id']}})[_0x09c3('0x1f')](handleEntityNotFound(_0x43daa7,null))['then'](function(_0x311d52){if(_0x311d52){_0xb91f11=_0x311d52;return db['SmsAccount']['find']({'where':{'id':_0x311d52[_0x09c3('0x84')]}});}})[_0x09c3('0x1f')](handleEntityNotFound(_0x43daa7,null))[_0x09c3('0x1f')](function(_0x496ba9){if(_0x496ba9){logger[_0x09c3('0x23')](_0x09c3('0x24'),'status',_0x09c3('0x85'),_0x496ba9[_0x09c3('0x3d')],util['inspect'](_0x159439[_0x09c3('0x57')],{'showHidden':![],'depth':null}));switch(_0x496ba9[_0x09c3('0x3d')]){case _0x09c3('0x86'):if(_0x159439[_0x09c3('0x57')][_0x09c3('0x87')]&&_0x159439[_0x09c3('0x57')][_0x09c3('0x87')]===_0xb91f11[_0x09c3('0x88')]){return _0xb91f11[_0x09c3('0x36')]({'read':!![]});}else{logger[_0x09c3('0x26')](_0x09c3('0x89'),_0x09c3('0x2b'),_0x09c3('0x86'),util[_0x09c3('0x8a')](_0x159439[_0x09c3('0x57')],{'showHidden':![],'depth':null}));}break;case _0x09c3('0x8b'):if(_0x159439[_0x09c3('0x57')][_0x09c3('0x8c')]&&_0x159439[_0x09c3('0x57')][_0x09c3('0x8c')]===_0xb91f11[_0x09c3('0x88')]&&_[_0x09c3('0x8d')]([_0x09c3('0x8e'),_0x09c3('0x8f')],_0x159439[_0x09c3('0x57')][_0x09c3('0x90')])>=0x0){return _0xb91f11[_0x09c3('0x36')]({'read':!![]});}else{logger[_0x09c3('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x09c3('0x91'),util[_0x09c3('0x8a')](_0x159439[_0x09c3('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x199001=_0x159439[_0x09c3('0x57')][_0x09c3('0x92')][0x0];if(_0x199001['status'][_0x09c3('0x93')]===_0x09c3('0x94')){return _0xb91f11[_0x09c3('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x09c3('0x95'),util[_0x09c3('0x8a')](_0x159439[_0x09c3('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xb91f11;}})['then'](respondWithResult(_0x43daa7,null))[_0x09c3('0x51')](handleError(_0x43daa7,null));}; \ No newline at end of file +var _0x7c7f=['type','VIRTUAL','includeAll','show','params','length','include','find','create','body','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','email','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','request-promise','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','client','http','request','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1ff6f3,_0xaf9382){var _0x3bde18=function(_0x43ba04){while(--_0x43ba04){_0x1ff6f3['push'](_0x1ff6f3['shift']());}};_0x3bde18(++_0xaf9382);}(_0x7c7f,0x163));var _0xf7c7=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x7c7f[_0x1b6186];return _0x186121;};'use strict';var emlformat=require(_0xf7c7('0x0'));var rimraf=require(_0xf7c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7c7('0x2'));var moment=require(_0xf7c7('0x3'));var BPromise=require(_0xf7c7('0x4'));var Mustache=require('mustache');var util=require(_0xf7c7('0x5'));var path=require(_0xf7c7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7c7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7c7('0x8'));var crypto=require(_0xf7c7('0x9'));var jsforce=require(_0xf7c7('0xa'));var deskjs=require(_0xf7c7('0xb'));var toCsv=require(_0xf7c7('0xc'));var querystring=require('querystring');var Papa=require(_0xf7c7('0xd'));var Redis=require('ioredis');var authService=require(_0xf7c7('0xe'));var qs=require(_0xf7c7('0xf'));var as=require(_0xf7c7('0x10'));var hardwareService=require(_0xf7c7('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf7c7('0x12'));var licenseUtil=require(_0xf7c7('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf7c7('0x14')](config[_0xf7c7('0x15')],{'host':_0xf7c7('0x16'),'port':0x18eb});var socket=require(_0xf7c7('0x17'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xf7c7('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf7c7('0x19')][_0xf7c7('0x1a')]({'port':0x232c});var client9002=jayson[_0xf7c7('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9cd3d2,_0x75f675,_0x8b893f,_0x57d69f){return new BPromise(function(_0x20193e,_0x4a783e){var _0x36de35=_0x57d69f||client;return _0x36de35[_0xf7c7('0x1b')](_0x9cd3d2,_0x8b893f)['then'](function(_0x446146){logger['info']('SmsMessage,\x20%s,\x20%s',_0x75f675,_0xf7c7('0x1c'));logger[_0xf7c7('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x75f675,_0xf7c7('0x1c'),JSON[_0xf7c7('0x1e')](_0x446146));if(_0x446146[_0xf7c7('0x1f')]){if(_0x446146[_0xf7c7('0x1f')][_0xf7c7('0x20')]===0x1f4){logger[_0xf7c7('0x1f')](_0xf7c7('0x21'),_0x75f675,_0x446146[_0xf7c7('0x1f')][_0xf7c7('0x22')]);return _0x4a783e(_0x446146[_0xf7c7('0x1f')][_0xf7c7('0x22')]);}logger[_0xf7c7('0x1f')](_0xf7c7('0x21'),_0x75f675,_0x446146[_0xf7c7('0x1f')][_0xf7c7('0x22')]);return _0x20193e(_0x446146[_0xf7c7('0x1f')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x75f675,'request\x20sent');_0x20193e(_0x446146[_0xf7c7('0x23')]['message']);}})[_0xf7c7('0x24')](function(_0x46fff5){logger[_0xf7c7('0x1f')](_0xf7c7('0x21'),_0x75f675,_0x46fff5);_0x4a783e(_0x46fff5);});});}function respondWithStatusCode(_0x31f849,_0x5e5d87){_0x5e5d87=_0x5e5d87||0xcc;return function(_0x28adcd){if(_0x28adcd){return _0x31f849[_0xf7c7('0x25')](_0x5e5d87);}return _0x31f849[_0xf7c7('0x26')](_0x5e5d87)[_0xf7c7('0x27')]();};}function respondWithResult(_0x520b7a,_0x492799){_0x492799=_0x492799||0xc8;return function(_0x136833){if(_0x136833){return _0x520b7a[_0xf7c7('0x26')](_0x492799)['json'](_0x136833);}};}function respondWithFilteredResult(_0x212fae,_0x446350){return function(_0x21d90f){if(_0x21d90f){var _0x32fcef=typeof _0x446350[_0xf7c7('0x28')]===_0xf7c7('0x29')&&typeof _0x446350[_0xf7c7('0x2a')]===_0xf7c7('0x29');var _0x1106a1=_0x21d90f['count'];var _0x33b863=_0x32fcef?0x0:_0x446350[_0xf7c7('0x28')];var _0x5020b0=_0x32fcef?_0x21d90f[_0xf7c7('0x2b')]:_0x446350[_0xf7c7('0x28')]+_0x446350['limit'];var _0x20a12a;if(_0x5020b0>=_0x1106a1){_0x5020b0=_0x1106a1;_0x20a12a=0xc8;}else{_0x20a12a=0xce;}_0x212fae[_0xf7c7('0x26')](_0x20a12a);return _0x212fae[_0xf7c7('0x2c')]('Content-Range',_0x33b863+'-'+_0x5020b0+'/'+_0x1106a1)[_0xf7c7('0x2d')](_0x21d90f);}return null;};}function patchUpdates(_0x2a83a8){return function(_0x28e0c4){try{jsonpatch[_0xf7c7('0x2e')](_0x28e0c4,_0x2a83a8,!![]);}catch(_0x35d3ab){return BPromise['reject'](_0x35d3ab);}return _0x28e0c4[_0xf7c7('0x2f')]();};}function saveUpdates(_0x225923,_0x3a0b30){return function(_0x2e1d06){if(_0x2e1d06){return _0x2e1d06[_0xf7c7('0x30')](_0x225923)[_0xf7c7('0x31')](function(_0x5f220c){return _0x5f220c;});}return null;};}function removeEntity(_0xc329e4,_0x8c6b27){return function(_0xab8007){if(_0xab8007){return _0xab8007[_0xf7c7('0x32')]()[_0xf7c7('0x31')](function(){_0xc329e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5082a3,_0x43c95e){return function(_0x9dc9d0){if(!_0x9dc9d0){_0x5082a3[_0xf7c7('0x25')](0x194);}return _0x9dc9d0;};}function handleError(_0x2e68fc,_0x2dcc1d){_0x2dcc1d=_0x2dcc1d||0x1f4;return function(_0x311d3f){logger['error'](_0x311d3f[_0xf7c7('0x33')]);if(_0x311d3f[_0xf7c7('0x34')]){delete _0x311d3f[_0xf7c7('0x34')];}_0x2e68fc[_0xf7c7('0x26')](_0x2dcc1d)[_0xf7c7('0x35')](_0x311d3f);};}exports[_0xf7c7('0x36')]=function(_0x50f397,_0x350a8f){var _0x26a404={},_0x2effc1={},_0x502e74={'count':0x0,'rows':[]};var _0x326381=_[_0xf7c7('0x37')](db[_0xf7c7('0x38')][_0xf7c7('0x39')],function(_0x183b1c){return{'name':_0x183b1c[_0xf7c7('0x3a')],'type':_0x183b1c['type']['key']};});_0x2effc1['model']=_[_0xf7c7('0x37')](_0x326381,'name');_0x2effc1[_0xf7c7('0x3b')]=_[_0xf7c7('0x3c')](_0x50f397[_0xf7c7('0x3b')]);_0x2effc1[_0xf7c7('0x3d')]=_[_0xf7c7('0x3e')](_0x2effc1[_0xf7c7('0x3f')],_0x2effc1[_0xf7c7('0x3b')]);_0x26a404['attributes']=_[_0xf7c7('0x3e')](_0x2effc1[_0xf7c7('0x3f')],qs['fields'](_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x40')]));_0x26a404[_0xf7c7('0x41')]=_0x26a404[_0xf7c7('0x41')]['length']?_0x26a404[_0xf7c7('0x41')]:_0x2effc1['model'];if(!_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x42')](_0xf7c7('0x43'))){_0x26a404['limit']=qs['limit'](_0x50f397[_0xf7c7('0x3b')]['limit']);_0x26a404[_0xf7c7('0x28')]=qs[_0xf7c7('0x28')](_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x28')]);}_0x26a404[_0xf7c7('0x44')]=qs['sort'](_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x45')]);_0x26a404[_0xf7c7('0x46')]=qs[_0xf7c7('0x3d')](_[_0xf7c7('0x47')](_0x50f397['query'],_0x2effc1[_0xf7c7('0x3d')]),_0x326381);if(_0x50f397['query'][_0xf7c7('0x48')]){_0x26a404['where']=_[_0xf7c7('0x49')](_0x26a404[_0xf7c7('0x46')],{'$or':_[_0xf7c7('0x37')](_0x326381,function(_0x1f03bd){if(_0x1f03bd[_0xf7c7('0x4a')]!==_0xf7c7('0x4b')){var _0x4104cf={};_0x4104cf[_0x1f03bd[_0xf7c7('0x34')]]={'$like':'%'+_0x50f397[_0xf7c7('0x3b')]['filter']+'%'};return _0x4104cf;}})});}_0x26a404=_[_0xf7c7('0x49')]({},_0x26a404,_0x50f397['options']);var _0x4dd523={'where':_0x26a404[_0xf7c7('0x46')]};return db[_0xf7c7('0x38')][_0xf7c7('0x2b')](_0x4dd523)[_0xf7c7('0x31')](function(_0x41d2c5){_0x502e74['count']=_0x41d2c5;if(_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x4c')]){_0x26a404['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x26a404);})[_0xf7c7('0x31')](function(_0x29e1b9){_0x502e74['rows']=_0x29e1b9;return _0x502e74;})[_0xf7c7('0x31')](respondWithFilteredResult(_0x350a8f,_0x26a404))[_0xf7c7('0x24')](handleError(_0x350a8f,null));};exports[_0xf7c7('0x4d')]=function(_0x5c46d3,_0x245fd3){var _0x509ab4={'raw':!![],'where':{'id':_0x5c46d3[_0xf7c7('0x4e')]['id']}},_0x6bcc8f={};_0x6bcc8f[_0xf7c7('0x3f')]=_[_0xf7c7('0x3c')](db['SmsMessage'][_0xf7c7('0x39')]);_0x6bcc8f[_0xf7c7('0x3b')]=_[_0xf7c7('0x3c')](_0x5c46d3[_0xf7c7('0x3b')]);_0x6bcc8f[_0xf7c7('0x3d')]=_[_0xf7c7('0x3e')](_0x6bcc8f[_0xf7c7('0x3f')],_0x6bcc8f['query']);_0x509ab4['attributes']=_[_0xf7c7('0x3e')](_0x6bcc8f['model'],qs['fields'](_0x5c46d3[_0xf7c7('0x3b')][_0xf7c7('0x40')]));_0x509ab4[_0xf7c7('0x41')]=_0x509ab4[_0xf7c7('0x41')][_0xf7c7('0x4f')]?_0x509ab4[_0xf7c7('0x41')]:_0x6bcc8f[_0xf7c7('0x3f')];if(_0x5c46d3[_0xf7c7('0x3b')][_0xf7c7('0x4c')]){_0x509ab4[_0xf7c7('0x50')]=[{'all':!![]}];}_0x509ab4=_[_0xf7c7('0x49')]({},_0x509ab4,_0x5c46d3['options']);return db[_0xf7c7('0x38')][_0xf7c7('0x51')](_0x509ab4)['then'](handleEntityNotFound(_0x245fd3,null))[_0xf7c7('0x31')](respondWithResult(_0x245fd3,null))[_0xf7c7('0x24')](handleError(_0x245fd3,null));};exports[_0xf7c7('0x52')]=function(_0x409b12,_0x1f9935){return db[_0xf7c7('0x38')][_0xf7c7('0x52')](_0x409b12[_0xf7c7('0x53')],{})['then'](respondWithResult(_0x1f9935,0xc9))[_0xf7c7('0x24')](handleError(_0x1f9935,null));};exports['update']=function(_0x139ea3,_0xe05a24){if(_0x139ea3[_0xf7c7('0x53')]['id']){delete _0x139ea3[_0xf7c7('0x53')]['id'];}return db['SmsMessage'][_0xf7c7('0x51')]({'where':{'id':_0x139ea3['params']['id']}})['then'](handleEntityNotFound(_0xe05a24,null))[_0xf7c7('0x31')](saveUpdates(_0x139ea3[_0xf7c7('0x53')],null))[_0xf7c7('0x31')](respondWithResult(_0xe05a24,null))[_0xf7c7('0x24')](handleError(_0xe05a24,null));};exports[_0xf7c7('0x32')]=function(_0x461952,_0x3f2911){return db[_0xf7c7('0x38')][_0xf7c7('0x51')]({'where':{'id':_0x461952[_0xf7c7('0x4e')]['id']}})[_0xf7c7('0x31')](handleEntityNotFound(_0x3f2911,null))[_0xf7c7('0x31')](removeEntity(_0x3f2911,null))['catch'](handleError(_0x3f2911,null));};exports[_0xf7c7('0x54')]=function(_0x4b4f37,_0x5b1e47){return db[_0xf7c7('0x38')][_0xf7c7('0x54')]()[_0xf7c7('0x31')](respondWithResult(_0x5b1e47,null))[_0xf7c7('0x24')](handleError(_0x5b1e47,null));};var interaction_log=require('../../config/logger')(_0xf7c7('0x55'));exports[_0xf7c7('0x56')]=function(_0x171e2d,_0x8ffa91,_0x234773){var _0x45e56c={'agent':{},'channel':'sms'};if(_0x171e2d[_0xf7c7('0x53')]['id']){delete _0x171e2d[_0xf7c7('0x53')]['id'];}_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x57')]=!![];_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x58')]=moment()[_0xf7c7('0x59')](_0xf7c7('0x5a'));_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x5b')]=_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x5b')]||_0x171e2d[_0xf7c7('0x5c')]['id'];_0x45e56c[_0xf7c7('0x5d')]['id']=_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x5b')];return db[_0xf7c7('0x38')][_0xf7c7('0x51')]({'where':{'id':_0x171e2d[_0xf7c7('0x4e')]['id'],'UserId':null}})[_0xf7c7('0x31')](handleEntityNotFound(_0x8ffa91,null))[_0xf7c7('0x31')](saveUpdates(_0x171e2d[_0xf7c7('0x53')],null))[_0xf7c7('0x31')](function(_0x4ec823){if(_0x4ec823){_0x45e56c['message']=_0x4ec823[_0xf7c7('0x5e')]({'plain':!![]});return db[_0xf7c7('0x5f')]['find']({'where':{'id':_0x4ec823[_0xf7c7('0x60')]}});}return null;})[_0xf7c7('0x31')](handleEntityNotFound(_0x8ffa91,null))[_0xf7c7('0x31')](function(_0x4b7b2f){if(_0x4b7b2f){return _0x4b7b2f['update']({'UserId':_0x171e2d['body'][_0xf7c7('0x5b')],'read1stAt':_[_0xf7c7('0x61')](_0x4b7b2f['read1stAt'])?moment()[_0xf7c7('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf7c7('0x31')](function(_0x342f8c){if(_0x342f8c){_0x45e56c[_0xf7c7('0x62')]=_0x342f8c['get']({'plain':!![]});interaction_log[_0xf7c7('0x63')](_0xf7c7('0x64'),_0x171e2d[_0xf7c7('0x5c')]['id'],_0x171e2d[_0xf7c7('0x5c')][_0xf7c7('0x34')],_0x171e2d['user'][_0xf7c7('0x65')],_0x45e56c[_0xf7c7('0x62')]['id'],_0x171e2d[_0xf7c7('0x53')]?JSON[_0xf7c7('0x1e')](_0x171e2d[_0xf7c7('0x53')]):_0xf7c7('0x66'));return respondWithRpcPromise(_0xf7c7('0x67'),_0xf7c7('0x68'),_0x45e56c);}return null;})[_0xf7c7('0x31')](function(_0x343b12){var _0x2a7da5=_0xf7c7('0x69')+_0x343b12[_0xf7c7('0x22')][_0xf7c7('0x6a')];return db[_0xf7c7('0x6b')][_0xf7c7('0x3b')](_0x2a7da5,{'type':db[_0xf7c7('0x6c')][_0xf7c7('0x6d')][_0xf7c7('0x6e')],'raw':!![]})[_0xf7c7('0x31')](function(_0x387004){return _0x387004;});})[_0xf7c7('0x31')](function(_0x3100f4){if(_0x3100f4){_0x45e56c['message'][_0xf7c7('0x6f')]=_0x3100f4[0x0];if(!_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x5b')])return;return db[_0xf7c7('0x70')]['find']({'where':{'id':_0x171e2d[_0xf7c7('0x53')]['UserId'],'role':_0xf7c7('0x5d')},'attributes':['id',_0xf7c7('0x34'),_0xf7c7('0x71'),'email',_0xf7c7('0x72')],'raw':!![]});}return null;})[_0xf7c7('0x31')](function(_0x65acc9){if(!_0x65acc9)return null;_0x45e56c[_0xf7c7('0x22')][_0xf7c7('0x5d')]=_0x65acc9;return _0x45e56c;})[_0xf7c7('0x31')](function(_0x57241f){if(_0x57241f){if(_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x73')]){_0x45e56c[_0xf7c7('0x22')][_0xf7c7('0x74')]=util[_0xf7c7('0x59')]('SIP/%s',_0x171e2d['user'][_0xf7c7('0x34')]);_0x45e56c['message'][_0xf7c7('0x75')]=_0x45e56c[_0xf7c7('0x75')];_0x45e56c[_0xf7c7('0x22')][_0xf7c7('0x76')]=_0x45e56c[_0xf7c7('0x75')];_0x45e56c[_0xf7c7('0x22')][_0xf7c7('0x77')]=_0xf7c7('0x56');return respondWithRpcPromise(_0xf7c7('0x78'),_0xf7c7('0x78'),{'event':_0xf7c7('0x79'),'message':_0x45e56c[_0xf7c7('0x22')]},client9002)['then'](function(){return _0x45e56c;});}return _0x45e56c;}return null;})['then'](respondWithResult(_0x8ffa91,null))[_0xf7c7('0x24')](handleError(_0x8ffa91,null));};var interaction_log=require(_0xf7c7('0x7a'))(_0xf7c7('0x55'));exports[_0xf7c7('0x7b')]=function(_0x489b6a,_0xa6591a,_0x5d9cb6){var _0x6d3b74={'agent':{},'channel':_0xf7c7('0x7c')};if(_0x489b6a[_0xf7c7('0x53')]['id']){delete _0x489b6a[_0xf7c7('0x53')]['id'];}_0x489b6a[_0xf7c7('0x53')][_0xf7c7('0x5b')]=_0x489b6a['body']['UserId']||_0x489b6a['user']['id'];_0x6d3b74[_0xf7c7('0x5d')]['id']=_0x489b6a[_0xf7c7('0x53')][_0xf7c7('0x5b')];return db[_0xf7c7('0x38')][_0xf7c7('0x51')]({'where':{'id':_0x489b6a[_0xf7c7('0x4e')]['id'],'UserId':null}})[_0xf7c7('0x31')](handleEntityNotFound(_0xa6591a,null))[_0xf7c7('0x31')](function(_0x4f3f00){if(_0x4f3f00){_0x6d3b74['message']=_0x4f3f00['get']({'plain':!![]});return db[_0xf7c7('0x5f')][_0xf7c7('0x51')]({'where':{'id':_0x4f3f00[_0xf7c7('0x60')]}});}return null;})[_0xf7c7('0x31')](handleEntityNotFound(_0xa6591a,null))[_0xf7c7('0x31')](function(_0x379d37){if(_0x379d37){_0x6d3b74[_0xf7c7('0x62')]=_0x379d37[_0xf7c7('0x5e')]({'plain':!![]});interaction_log[_0xf7c7('0x63')](_0xf7c7('0x7d'),_0x489b6a[_0xf7c7('0x5c')]['id'],_0x489b6a[_0xf7c7('0x5c')][_0xf7c7('0x34')],_0x489b6a['user'][_0xf7c7('0x65')],_0x6d3b74[_0xf7c7('0x62')]['id'],_0x489b6a[_0xf7c7('0x53')]?JSON[_0xf7c7('0x1e')](_0x489b6a[_0xf7c7('0x53')]):'null');return respondWithRpcPromise(_0xf7c7('0x7e'),'rejectMessage',_0x6d3b74);}return null;})[_0xf7c7('0x31')](function(_0x4bcfec){var _0x211568=_0xf7c7('0x69')+_0x4bcfec[_0xf7c7('0x22')][_0xf7c7('0x6a')];return db['sequelize'][_0xf7c7('0x3b')](_0x211568,{'type':db[_0xf7c7('0x6c')][_0xf7c7('0x6d')][_0xf7c7('0x6e')],'raw':!![]})['then'](function(_0x41f1c5){return _0x41f1c5;});})['then'](function(_0x37ef4c){if(_0x37ef4c){_0x6d3b74[_0xf7c7('0x22')]['contact']=_0x37ef4c[0x0];if(!_0x489b6a[_0xf7c7('0x53')][_0xf7c7('0x5b')])return;return db['User'][_0xf7c7('0x51')]({'where':{'id':_0x489b6a['body'][_0xf7c7('0x5b')],'role':_0xf7c7('0x5d')},'attributes':['id',_0xf7c7('0x34'),_0xf7c7('0x71'),_0xf7c7('0x7f'),'internal'],'raw':!![]});}return null;})[_0xf7c7('0x31')](function(_0x5212ef){if(!_0x5212ef)return null;_0x6d3b74['message'][_0xf7c7('0x5d')]=_0x5212ef;return _0x6d3b74;})[_0xf7c7('0x31')](function(_0x128183){if(_0x128183){_0x128183[_0xf7c7('0x22')][_0xf7c7('0x74')]=util[_0xf7c7('0x59')]('SIP/%s',_0x489b6a[_0xf7c7('0x5c')][_0xf7c7('0x34')]);_0x128183[_0xf7c7('0x22')][_0xf7c7('0x75')]=_0x6d3b74['channel'];_0x128183[_0xf7c7('0x22')][_0xf7c7('0x76')]=_0x6d3b74['channel'];_0x128183[_0xf7c7('0x22')][_0xf7c7('0x77')]=_0xf7c7('0x7b');respondWithRpcPromise('EventManager',_0xf7c7('0x78'),{'event':_0xf7c7('0x80'),'message':_0x128183['message']},client9002);return _0x6d3b74;}return null;})[_0xf7c7('0x31')](respondWithResult(_0xa6591a,null))[_0xf7c7('0x24')](handleError(_0xa6591a,null));};exports['status']=function(_0x5f17cd,_0x1f016c,_0xc0aa4b){if(_0x5f17cd[_0xf7c7('0x53')]['id']){delete _0x5f17cd[_0xf7c7('0x53')]['id'];}var _0x2245b3;return db['SmsMessage'][_0xf7c7('0x51')]({'where':{'id':_0x5f17cd[_0xf7c7('0x4e')]['id']}})[_0xf7c7('0x31')](handleEntityNotFound(_0x1f016c,null))[_0xf7c7('0x31')](function(_0x4da167){if(_0x4da167){_0x2245b3=_0x4da167;return db['SmsAccount'][_0xf7c7('0x51')]({'where':{'id':_0x4da167[_0xf7c7('0x81')]}});}})['then'](handleEntityNotFound(_0x1f016c,null))['then'](function(_0xf266f4){if(_0xf266f4){logger[_0xf7c7('0x1d')](_0xf7c7('0x82'),_0xf7c7('0x26'),_0xf7c7('0x83'),_0xf266f4['type'],util[_0xf7c7('0x84')](_0x5f17cd['body'],{'showHidden':![],'depth':null}));switch(_0xf266f4[_0xf7c7('0x4a')]){case _0xf7c7('0x85'):if(_0x5f17cd[_0xf7c7('0x53')]['MessageSid']&&_0x5f17cd[_0xf7c7('0x53')]['MessageSid']===_0x2245b3[_0xf7c7('0x86')]){return _0x2245b3['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xf7c7('0x85'),util[_0xf7c7('0x84')](_0x5f17cd[_0xf7c7('0x53')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5f17cd[_0xf7c7('0x53')]['MessageUUID']&&_0x5f17cd['body']['MessageUUID']===_0x2245b3[_0xf7c7('0x86')]&&_['indexOf']([_0xf7c7('0x87'),_0xf7c7('0x88')],_0x5f17cd['body']['Status'])>=0x0){return _0x2245b3[_0xf7c7('0x30')]({'read':!![]});}else{logger[_0xf7c7('0x1f')](_0xf7c7('0x89'),_0xf7c7('0x26'),_0xf7c7('0x8a'),util[_0xf7c7('0x84')](_0x5f17cd[_0xf7c7('0x53')],{'showHidden':![],'depth':null}));}break;case _0xf7c7('0x8b'):var _0x37318c=_0x5f17cd[_0xf7c7('0x53')][_0xf7c7('0x8c')][0x0];if(_0x37318c[_0xf7c7('0x26')][_0xf7c7('0x8d')]===_0xf7c7('0x8e')){return _0x2245b3[_0xf7c7('0x30')]({'read':!![]});}else{logger[_0xf7c7('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf7c7('0x26'),'infobip',util[_0xf7c7('0x84')](_0x5f17cd[_0xf7c7('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x2245b3;}})[_0xf7c7('0x31')](respondWithResult(_0x1f016c,null))[_0xf7c7('0x24')](handleError(_0x1f016c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 37d86e8..aa8b271 100644 --- a/server/api/smsMessage/smsMessage.events.js +++ b/server/api/smsMessage/smsMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a54=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1448a0,_0x5e0d04){var _0x2580a2=function(_0x360448){while(--_0x360448){_0x1448a0['push'](_0x1448a0['shift']());}};_0x2580a2(++_0x5e0d04);}(_0x0a54,0xbb));var _0x40a5=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x0a54[_0x4ee9cd];return _0x328a5b;};'use strict';var EventEmitter=require(_0x40a5('0x0'));var SmsMessage=require(_0x40a5('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x40a5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x40a5('0x3'),'afterDestroy':_0x40a5('0x4')};function emitEvent(_0x3802ef){return function(_0x2827cb,_0x5ee022,_0xd3a3d7){SmsMessageEvents['emit'](_0x3802ef+':'+_0x2827cb['id'],_0x2827cb);SmsMessageEvents[_0x40a5('0x5')](_0x3802ef,_0x2827cb);_0xd3a3d7(null);};}for(var e in events){if(events[_0x40a5('0x6')](e)){var event=events[e];SmsMessage[_0x40a5('0x7')](e,emitEvent(event));}}module[_0x40a5('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x3a7c=['hasOwnProperty','exports','events','../../mysqldb','SmsMessage','update','emit'];(function(_0x3730a5,_0x5ab261){var _0x3a8812=function(_0x5b9e1e){while(--_0x5b9e1e){_0x3730a5['push'](_0x3730a5['shift']());}};_0x3a8812(++_0x5ab261);}(_0x3a7c,0x16e));var _0xc3a7=function(_0x1440ce,_0x136aee){_0x1440ce=_0x1440ce-0x0;var _0x389c35=_0x3a7c[_0x1440ce];return _0x389c35;};'use strict';var EventEmitter=require(_0xc3a7('0x0'));var SmsMessage=require(_0xc3a7('0x1'))['db'][_0xc3a7('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc3a7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x151926){return function(_0x7a686d,_0x55ab22,_0x16614a){SmsMessageEvents[_0xc3a7('0x4')](_0x151926+':'+_0x7a686d['id'],_0x7a686d);SmsMessageEvents[_0xc3a7('0x4')](_0x151926,_0x7a686d);_0x16614a(null);};}for(var e in events){if(events[_0xc3a7('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xc3a7('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 896dbfe..cbf2181 100644 --- a/server/api/smsMessage/smsMessage.model.js +++ b/server/api/smsMessage/smsMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa14=['infobip','baseUrl','/auth/1/session','application/json','csc','crypto','apiKey','timestamp','keys','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','SmsInteractionId','update','createdAt','error','out','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','login?username=','username','&password=','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','base64','http_code','data','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken'];(function(_0xd9e171,_0x1bae23){var _0x304c10=function(_0x3f300f){while(--_0x3f300f){_0xd9e171['push'](_0xd9e171['shift']());}};_0x304c10(++_0x1bae23);}(_0xfa14,0x9d));var _0x4fa1=function(_0x4befae,_0x55b079){_0x4befae=_0x4befae-0x0;var _0x76c573=_0xfa14[_0x4befae];return _0x76c573;};'use strict';var _=require(_0x4fa1('0x0'));var util=require(_0x4fa1('0x1'));var logger=require(_0x4fa1('0x2'))('api');var moment=require(_0x4fa1('0x3'));var BPromise=require(_0x4fa1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fa1('0x5'));var rimraf=require(_0x4fa1('0x6'));var config=require(_0x4fa1('0x7'));var attributes=require(_0x4fa1('0x8'));module[_0x4fa1('0x9')]=function(_0x1152af,_0x4ba58b){return _0x1152af['define'](_0x4fa1('0xa'),attributes,{'tableName':_0x4fa1('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x4fa1('0xc')]},{'name':_0x4fa1('0xd'),'fields':['body'],'type':_0x4fa1('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f8802,_0x1f5221,_0x47c805){var _0x5db655=_0x1152af[_0x4fa1('0xf')];var _0x42901b=_0x3f8802[_0x4fa1('0x10')]({'plain':!![]});if(_0x42901b[_0x4fa1('0x11')][_0x4fa1('0x12')]()==='in'||_0x42901b[_0x4fa1('0x11')]['toLowerCase']()==='out'&&!_0x42901b[_0x4fa1('0x13')]&&!_[_0x4fa1('0x14')](_0x42901b[_0x4fa1('0x15')])&&!_[_0x4fa1('0x14')](_0x42901b['SmsInteractionId'])){_0x5db655['SmsInteraction'][_0x4fa1('0x16')]({'where':{'id':_0x42901b[_0x4fa1('0x17')]}})['then'](function(_0x4b4dec){if(_0x4b4dec){_0x4b4dec[_0x4fa1('0x18')]({'lastMsgAt':_0x42901b[_0x4fa1('0x19')],'lastMsgDirection':_0x42901b['direction'][_0x4fa1('0x12')]()});}})['catch'](function(_0x18033b){console[_0x4fa1('0x1a')](_0x18033b);});}if(_0x42901b[_0x4fa1('0x11')]===_0x4fa1('0x1b')&&!_0x42901b['secret']){var _0x5ca8bc;_0x5db655[_0x4fa1('0x1c')][_0x4fa1('0x1d')]({'where':{'id':_0x42901b[_0x4fa1('0x1e')]},'raw':!![]})[_0x4fa1('0x1f')](function(_0x5397d2){_0x5ca8bc=_0x5397d2;if(_0x5ca8bc&&_0x5ca8bc[_0x4fa1('0x20')]){switch(_0x5ca8bc[_0x4fa1('0x20')]){case'twilio':var _0x54093a=require(_0x4fa1('0x21'));if(_0x5ca8bc[_0x4fa1('0x22')]&&_0x5ca8bc[_0x4fa1('0x23')]&&_0x5ca8bc[_0x4fa1('0x24')]){var _0x5b2d62=new _0x54093a(_0x5ca8bc['accountSid'],_0x5ca8bc[_0x4fa1('0x23')]);_0x5b2d62[_0x4fa1('0x25')][_0x4fa1('0x26')]({'body':_0x42901b[_0x4fa1('0x27')],'to':_0x42901b[_0x4fa1('0x24')],'from':_0x5ca8bc[_0x4fa1('0x24')],'statusCallback':_0x5ca8bc[_0x4fa1('0x28')]+_0x4fa1('0x29')+_0x42901b['id']+_0x4fa1('0x2a')+_0x5ca8bc[_0x4fa1('0x2b')]})['then'](function(_0x5c616e){if(_0x5c616e[_0x4fa1('0x2c')]){return _0x3f8802[_0x4fa1('0x18')]({'messageId':_0x5c616e[_0x4fa1('0x2c')]});}})[_0x4fa1('0x2d')](function(_0x27da14){logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x21'),util['inspect'](_0x27da14,{'showHidden':![],'depth':null}));});}else{logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),'afterCreate',_0x4fa1('0x21'),_0x4fa1('0x30'));}break;case _0x4fa1('0x31'):var _0x1bebc9=_0x4fa1('0x32');if(_0x5ca8bc['username']&&_0x5ca8bc[_0x4fa1('0x33')]){var _0x120f45={'recipient':[_0x42901b[_0x4fa1('0x24')]],'message':_0x42901b['body'],'message_type':_0x5ca8bc[_0x4fa1('0x34')]};if(_0x5ca8bc['smsMethod']&&_0x5ca8bc['smsMethod']!=='SI'){_0x120f45['sender']=_0x5ca8bc[_0x4fa1('0x24')];}var _0x3aa336={'url':_0x1bebc9+_0x4fa1('0x35')+_0x5ca8bc[_0x4fa1('0x36')]+_0x4fa1('0x37')+_0x5ca8bc[_0x4fa1('0x33')],'method':'GET'};rp(_0x3aa336)[_0x4fa1('0x1f')](function(_0x2d5d80){var _0x1ee59e=_0x2d5d80[_0x4fa1('0x38')](';');var _0x85b75={'user_key':_0x1ee59e[0x0],'session_key':_0x1ee59e[0x1]};_0x3aa336={'url':_0x1bebc9+_0x4fa1('0x39'),'method':_0x4fa1('0x3a'),'headers':{'user_key':_0x85b75['user_key'],'Session_key':_0x85b75[_0x4fa1('0x3b')]},'json':!![],'body':_0x120f45};return rp(_0x3aa336);})['then'](function(_0x5e7ddf){if(_0x5e7ddf[_0x4fa1('0x3c')]>=0x1){var _0x3ce404={'messageId':_0x5e7ddf[_0x4fa1('0x3d')]};if(_0x5ca8bc[_0x4fa1('0x34')]!=='GP'||!_0x5ca8bc[_0x4fa1('0x3e')]){_0x3ce404[_0x4fa1('0x3f')]=!![];}return _0x3f8802[_0x4fa1('0x18')](_0x3ce404);}else{return logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),_0x4fa1('0x2f'),'skebby',util[_0x4fa1('0x40')](_0x5e7ddf,{'showHidden':![],'depth':null}));}})[_0x4fa1('0x2d')](function(_0x25b9cf){return logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),'afterCreate','skebby',util['inspect'](_0x25b9cf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x31'),_0x4fa1('0x41'));}break;case _0x4fa1('0x42'):if(_0x5ca8bc[_0x4fa1('0x23')]){var _0x132ac3={'recipient':_0x42901b[_0x4fa1('0x24')],'message':_0x42901b[_0x4fa1('0x27')],'sender':_0x5ca8bc[_0x4fa1('0x43')]||_0x5ca8bc[_0x4fa1('0x24')],'authorization':_0x5ca8bc[_0x4fa1('0x23')]};var _0x1f5221={'method':_0x4fa1('0x3a'),'uri':_0x4fa1('0x44'),'body':_0x132ac3,'json':!![]};rp(_0x1f5221)[_0x4fa1('0x1f')](function(_0xa4effe){var _0x5c1588={'messageId':_0xa4effe['requestid']};if(!_0x5ca8bc[_0x4fa1('0x3e')]){_0x5c1588['read']=!![];}return _0x3f8802[_0x4fa1('0x18')](_0x5c1588);})[_0x4fa1('0x2d')](function(_0x4643d7){logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),_0x4fa1('0x2f'),'connectel',util['inspect'](_0x4643d7,{'showHidden':![],'depth':null}));});}else{logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x42'),_0x4fa1('0x45'));}break;case'clicksend':if(_0x5ca8bc['username']&&_0x5ca8bc['password']){var _0x132ac3={'messages':[{'source':_0x4fa1('0x46'),'to':_0x42901b[_0x4fa1('0x24')],'body':_0x42901b[_0x4fa1('0x27')],'from':_0x5ca8bc[_0x4fa1('0x43')]||_0x5ca8bc['phone']}]};var _0x39939e=util['format'](_0x4fa1('0x47'),_0x5ca8bc['username'],_0x5ca8bc['password']);var _0x1f5221={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x132ac3,'headers':{'Authorization':util[_0x4fa1('0x48')](_0x4fa1('0x49'),new Buffer(_0x39939e)[_0x4fa1('0x4a')](_0x4fa1('0x4b')))},'json':!![]};rp(_0x1f5221)[_0x4fa1('0x1f')](function(_0x4ad1e0){if(_0x4ad1e0[_0x4fa1('0x4c')]>=0xc8&&_0x4ad1e0[_0x4fa1('0x4c')]<=0xce){if(_0x4ad1e0[_0x4fa1('0x4d')]&&_0x4ad1e0[_0x4fa1('0x4d')]['queued_count']>0x0){var _0xed445d=_['head'](_0x4ad1e0['data']['messages']);var _0x4fd1e7={'messageId':_0xed445d[_0x4fa1('0x4e')]};if(!_0x5ca8bc['deliveryReport']){_0x4fd1e7[_0x4fa1('0x3f')]=!![];}return _0x3f8802[_0x4fa1('0x18')](_0x4fd1e7);}else{logger[_0x4fa1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fa1('0x2f'),'clickSend',util[_0x4fa1('0x40')](_0x4ad1e0,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x4f'),util[_0x4fa1('0x40')](_0x4ad1e0,{'showHidden':![],'depth':null}));}})[_0x4fa1('0x2d')](function(_0x310c5c){logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x4f'),util[_0x4fa1('0x40')](_0x310c5c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x4fa1('0x50'):if(_0x5ca8bc[_0x4fa1('0x51')]&&_0x5ca8bc['authToken']){var _0x132ac3={'dst':_0x42901b[_0x4fa1('0x24')],'text':_0x42901b[_0x4fa1('0x27')],'src':_0x5ca8bc[_0x4fa1('0x43')]||_0x5ca8bc['phone'],'url':_0x5ca8bc[_0x4fa1('0x28')]+_0x4fa1('0x29')+_0x42901b['id']+_0x4fa1('0x2a')+_0x5ca8bc[_0x4fa1('0x2b')]};var _0x39939e=util[_0x4fa1('0x48')]('%s:%s',_0x5ca8bc[_0x4fa1('0x51')],_0x5ca8bc[_0x4fa1('0x23')]);var _0x1f5221={'method':'POST','uri':util[_0x4fa1('0x48')](_0x4fa1('0x52'),_0x5ca8bc[_0x4fa1('0x51')]),'body':_0x132ac3,'headers':{'Authorization':util[_0x4fa1('0x48')](_0x4fa1('0x49'),new Buffer(_0x39939e)[_0x4fa1('0x4a')](_0x4fa1('0x4b')))},'json':!![]};rp(_0x1f5221)[_0x4fa1('0x1f')](function(_0x2dde73){var _0x5ce171={'messageId':_0x2dde73[_0x4fa1('0x53')][0x0]};return _0x3f8802[_0x4fa1('0x18')](_0x5ce171);})[_0x4fa1('0x2d')](function(_0x392c2b){logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),'afterCreate',_0x4fa1('0x50'),util['inspect'](_0x392c2b,{'showHidden':![],'depth':null}));});}else{logger[_0x4fa1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',_0x4fa1('0x54'));}break;case _0x4fa1('0x55'):if(_0x5ca8bc['username']&&_0x5ca8bc[_0x4fa1('0x33')]){if(_0x5ca8bc[_0x4fa1('0x56')]){var _0x51b654={'method':_0x4fa1('0x3a'),'uri':_0x5ca8bc[_0x4fa1('0x56')]+_0x4fa1('0x57'),'body':{'username':_0x5ca8bc[_0x4fa1('0x36')],'password':_0x5ca8bc['password']},'json':!![]};return rp(_0x51b654)[_0x4fa1('0x1f')](function(_0x501e00){var _0x52ec84={'method':_0x4fa1('0x3a'),'uri':_0x5ca8bc[_0x4fa1('0x56')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5ca8bc[_0x4fa1('0x24')],'destinations':[{'to':_0x42901b[_0x4fa1('0x24')]}],'text':_0x42901b[_0x4fa1('0x27')],'notifyUrl':_0x5ca8bc[_0x4fa1('0x28')]+_0x4fa1('0x29')+_0x42901b['id']+'/status?token='+_0x5ca8bc[_0x4fa1('0x2b')],'notifyContentType':_0x4fa1('0x58'),'callbackData':_0x5ca8bc[_0x4fa1('0x24')]+';'+_0x42901b[_0x4fa1('0x27')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x501e00['token']},'json':!![]};return rp(_0x52ec84)['then'](function(_0x30b2a2){if(_0x30b2a2[_0x4fa1('0x25')]){var _0x40dc38={'messageId':_0x30b2a2[_0x4fa1('0x25')][0x0]['messageId']};if(!_0x5ca8bc[_0x4fa1('0x3e')]){_0x40dc38[_0x4fa1('0x3f')]=!![];}return _0x3f8802[_0x4fa1('0x18')](_0x40dc38);}else{return logger[_0x4fa1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4fa1('0x55'),util[_0x4fa1('0x40')](_0x30b2a2,{'showHidden':![],'depth':null}));}});})[_0x4fa1('0x2d')](function(_0xc14eed){return logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x55'),util['inspect'](_0xc14eed,{'showHidden':![],'depth':null}));});}else{logger[_0x4fa1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4fa1('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x4fa1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fa1('0x2f'),'infobip',_0x4fa1('0x41'));}break;case _0x4fa1('0x59'):var _0xe3c719=require(_0x4fa1('0x5a'));if(_0x5ca8bc[_0x4fa1('0x5b')]){var _0x73f444={};_0x73f444['login']=_0x5ca8bc[_0x4fa1('0x36')];_0x73f444[_0x4fa1('0x24')]=_0x42901b['phone'];_0x73f444['sender']=_0x5ca8bc[_0x4fa1('0x24')];_0x73f444['text']=_0x42901b[_0x4fa1('0x27')];_0x73f444[_0x4fa1('0x5c')]=+new Date();var _0x158d56='';var _0xb73d1f='';var _0x32953f=Object[_0x4fa1('0x5d')](_0x73f444);_0x32953f[_0x4fa1('0x5e')]();for(var _0x10190f=0x0;_0x10190f<_0x32953f['length'];_0x10190f++){if(_0x158d56!=''){_0x158d56+='&';}_0x158d56+=_0x32953f[_0x10190f]+'='+encodeURIComponent(_0x73f444[_0x32953f[_0x10190f]]);_0xb73d1f+=_0x73f444[_0x32953f[_0x10190f]];}_0xb73d1f+=_0x5ca8bc[_0x4fa1('0x5b')];_0xb73d1f=_0xe3c719[_0x4fa1('0x5f')](_0x4fa1('0x60'))['update'](_0xb73d1f)[_0x4fa1('0x61')](_0x4fa1('0x62'));if(_0x158d56!==''){_0x158d56+='&';}_0x158d56+=_0x4fa1('0x63')+_0xb73d1f;var _0x3aa336={'method':'GET','uri':_0x5ca8bc[_0x4fa1('0x56')]+_0x4fa1('0x64')+_0x158d56,'json':!![]};return rp(_0x3aa336)['then'](function(_0x1cc3d7){var _0x14b59d=Object[_0x4fa1('0x5d')](_0x1cc3d7);if(_0x1cc3d7[_0x14b59d[0x0]]['error']&&parseInt(_0x1cc3d7[_0x14b59d[0x0]][_0x4fa1('0x1a')])===0x0){var _0x49c15f={'messageId':_0x1cc3d7[_0x14b59d[0x0]][_0x4fa1('0x65')]};if(!_0x5ca8bc['deliveryReport']){_0x49c15f[_0x4fa1('0x3f')]=!![];}return _0x3f8802['update'](_0x49c15f);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fa1('0x2f'),_0x4fa1('0x59'),util[_0x4fa1('0x40')](_0x1cc3d7[_0x4fa1('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x517446){return logger[_0x4fa1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util['inspect'](_0x517446,{'showHidden':![],'depth':null}));});}else{logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x59'),_0x4fa1('0x66'));}break;case _0x4fa1('0x67'):if(_0x5ca8bc[_0x4fa1('0x5b')]){var _0x3252e3={'method':_0x4fa1('0x3a'),'uri':_0x4fa1('0x68'),'headers':{'Authorization':_0x5ca8bc['apiKey']},'body':{'content':_0x42901b[_0x4fa1('0x27')],'to':[_0x42901b[_0x4fa1('0x24')]],'from':_0x5ca8bc[_0x4fa1('0x24')],'binary':![],'clientMessageId':_0x4fa1('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x3252e3)[_0x4fa1('0x1f')](function(_0x2d7f5c){if(!_0x2d7f5c[_0x4fa1('0x1a')]){var _0x56065e={'messageId':_0x2d7f5c['messages'][0x0][_0x4fa1('0x6a')]};if(!_0x5ca8bc[_0x4fa1('0x3e')]){_0x56065e[_0x4fa1('0x3f')]=!![];}return _0x3f8802[_0x4fa1('0x18')](_0x56065e);}else{return logger['error'](_0x4fa1('0x2e'),'afterCreate',_0x4fa1('0x67'),util[_0x4fa1('0x40')](_0x2d7f5c['error'],{'showHidden':![],'depth':null}));}})[_0x4fa1('0x2d')](function(_0x4d95e8){return logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),'afterCreate',_0x4fa1('0x67'),util['inspect'](_0x4d95e8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x67'),_0x4fa1('0x66'));}break;case _0x4fa1('0x6b'):if(_0x5ca8bc[_0x4fa1('0x36')]&&_0x5ca8bc[_0x4fa1('0x33')]){var _0x39939e=util[_0x4fa1('0x48')](_0x4fa1('0x47'),_0x5ca8bc[_0x4fa1('0x36')],_0x5ca8bc[_0x4fa1('0x33')]);var _0x1f5221={'method':_0x4fa1('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5ca8bc[_0x4fa1('0x6c')]+_0x4fa1('0x6d'),'body':{'to':[_0x42901b['phone']],'text':_0x42901b[_0x4fa1('0x27')],'from':_0x5ca8bc[_0x4fa1('0x24')],'applicationId':_0x5ca8bc[_0x4fa1('0x6e')]},'headers':{'Authorization':util['format'](_0x4fa1('0x49'),new Buffer(_0x39939e)[_0x4fa1('0x4a')](_0x4fa1('0x4b')))},'json':!![]};rp(_0x1f5221)[_0x4fa1('0x1f')](function(_0x100824){if(_0x100824['id']){var _0x402065={'messageId':_0x100824['id']};return _0x3f8802[_0x4fa1('0x18')](_0x402065);}else{logger['error'](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x6b'),util[_0x4fa1('0x40')](_0x100824,{'showHidden':![],'depth':null}));}})[_0x4fa1('0x2d')](function(_0x521b5a){logger[_0x4fa1('0x1a')](_0x4fa1('0x2e'),_0x4fa1('0x2f'),'bandwidth',util[_0x4fa1('0x40')](_0x521b5a,{'showHidden':![],'depth':null}));});}else{logger[_0x4fa1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fa1('0x2f'),'bandwidth',_0x4fa1('0x41'));}break;case _0x4fa1('0x6f'):if(_0x5ca8bc[_0x4fa1('0x5b')]){var _0x53fee6={};var _0x3aa336={'method':_0x4fa1('0x3a'),'uri':_0x4fa1('0x70'),'headers':{'Authorization':_0x4fa1('0x71')+_0x5ca8bc[_0x4fa1('0x5b')],'Content-Type':_0x4fa1('0x58')},'body':{'from':_0x5ca8bc['phone'],'to':_0x42901b[_0x4fa1('0x24')],'text':_0x42901b[_0x4fa1('0x27')]},'json':!![]};return rp(_0x3aa336)[_0x4fa1('0x1f')](function(_0x224897){if(_0x224897[_0x4fa1('0x72')]==0xca){_0x53fee6['message']=_0x224897;var _0x28ca7d={'method':_0x4fa1('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x4fa1('0x71')+_0x5ca8bc['apiKey'],'Content-Type':_0x4fa1('0x58')},'body':{'refid':_0x53fee6[_0x4fa1('0x73')][_0x4fa1('0x74')]},'json':!![]};return rp(_0x28ca7d)[_0x4fa1('0x1f')](function(_0x1ca88d){_0x53fee6[_0x4fa1('0x75')]=_0x1ca88d;var _0x4de274={'messageId':_0x53fee6[_0x4fa1('0x73')][_0x4fa1('0x74')],'read':!![]};return _0x3f8802[_0x4fa1('0x18')](_0x4de274);});}else{return logger['error'](_0x4fa1('0x2e'),_0x4fa1('0x2f'),_0x4fa1('0x6f'),util[_0x4fa1('0x40')](_0x224897,{'showHidden':![],'depth':null}));}})[_0x4fa1('0x2d')](function(_0x266c7c){return logger['error'](_0x4fa1('0x2e'),'afterCreate',_0x4fa1('0x6f'),util[_0x4fa1('0x40')](_0x266c7c,{'showHidden':![],'depth':null}));});}else{return logger[_0x4fa1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fa1('0x2f'),_0x4fa1('0x6f'),'Token\x20not\x20received');}break;}}})[_0x4fa1('0x76')](function(){_0x47c805();});}else{_0x47c805();}}},'charset':_0x4fa1('0x77'),'collate':_0x4fa1('0x78')});}; \ No newline at end of file +var _0xfe63=['token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','GET','POST','user_key','session_key','total_sent','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','password','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','remote','/api/sms/messages/','format','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','apiKey','login','timestamp','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','isNil','SmsInteractionId','findOne','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','/status?token='];(function(_0x1214f4,_0x426ac3){var _0x401119=function(_0xc16552){while(--_0xc16552){_0x1214f4['push'](_0x1214f4['shift']());}};_0x401119(++_0x426ac3);}(_0xfe63,0xca));var _0x3fe6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xfe63[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x3fe6('0x0'));var util=require(_0x3fe6('0x1'));var logger=require(_0x3fe6('0x2'))(_0x3fe6('0x3'));var moment=require(_0x3fe6('0x4'));var BPromise=require(_0x3fe6('0x5'));var rp=require(_0x3fe6('0x6'));var fs=require('fs');var path=require(_0x3fe6('0x7'));var rimraf=require(_0x3fe6('0x8'));var config=require(_0x3fe6('0x9'));var attributes=require(_0x3fe6('0xa'));module['exports']=function(_0x41dd74,_0x23e73c){return _0x41dd74[_0x3fe6('0xb')](_0x3fe6('0xc'),attributes,{'tableName':_0x3fe6('0xd'),'paranoid':![],'indexes':[{'name':_0x3fe6('0xe'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x3fe6('0xf')],'type':_0x3fe6('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x93697e,_0x3ceec8,_0x47c7b8){var _0x9cebb=_0x41dd74[_0x3fe6('0x11')];var _0x111e35=_0x93697e[_0x3fe6('0x12')]({'plain':!![]});if(_0x111e35[_0x3fe6('0x13')][_0x3fe6('0x14')]()==='in'||_0x111e35[_0x3fe6('0x13')][_0x3fe6('0x14')]()==='out'&&!_0x111e35[_0x3fe6('0x15')]&&!_['isNil'](_0x111e35[_0x3fe6('0x16')])&&!_[_0x3fe6('0x17')](_0x111e35[_0x3fe6('0x18')])){_0x9cebb['SmsInteraction'][_0x3fe6('0x19')]({'where':{'id':_0x111e35['SmsInteractionId']}})[_0x3fe6('0x1a')](function(_0x254a93){if(_0x254a93){_0x254a93[_0x3fe6('0x1b')]({'lastMsgAt':_0x111e35['createdAt'],'lastMsgDirection':_0x111e35[_0x3fe6('0x13')]['toLowerCase']()});}})[_0x3fe6('0x1c')](function(_0x32dc9c){console[_0x3fe6('0x1d')](_0x32dc9c);});}if(_0x111e35[_0x3fe6('0x13')]==='out'&&!_0x111e35[_0x3fe6('0x15')]){var _0x2ee628;_0x9cebb[_0x3fe6('0x1e')][_0x3fe6('0x1f')]({'where':{'id':_0x111e35[_0x3fe6('0x20')]},'raw':!![]})[_0x3fe6('0x1a')](function(_0x2be08a){_0x2ee628=_0x2be08a;if(_0x2ee628&&_0x2ee628[_0x3fe6('0x21')]){switch(_0x2ee628[_0x3fe6('0x21')]){case _0x3fe6('0x22'):var _0x556035=require(_0x3fe6('0x22'));if(_0x2ee628[_0x3fe6('0x23')]&&_0x2ee628[_0x3fe6('0x24')]&&_0x2ee628[_0x3fe6('0x25')]){var _0x31adee=new _0x556035(_0x2ee628[_0x3fe6('0x23')],_0x2ee628['authToken']);_0x31adee[_0x3fe6('0x26')]['create']({'body':_0x111e35[_0x3fe6('0xf')],'to':_0x111e35['phone'],'from':_0x2ee628[_0x3fe6('0x25')],'statusCallback':_0x2ee628['remote']+'/api/sms/messages/'+_0x111e35['id']+_0x3fe6('0x27')+_0x2ee628[_0x3fe6('0x28')]})[_0x3fe6('0x1a')](function(_0x22c6d7){if(_0x22c6d7[_0x3fe6('0x29')]){return _0x93697e[_0x3fe6('0x1b')]({'messageId':_0x22c6d7['sid']});}})['catch'](function(_0x19c444){logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x22'),util[_0x3fe6('0x2c')](_0x19c444,{'showHidden':![],'depth':null}));});}else{logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x22'),_0x3fe6('0x2d'));}break;case _0x3fe6('0x2e'):var _0x1d7b52=_0x3fe6('0x2f');if(_0x2ee628[_0x3fe6('0x30')]&&_0x2ee628['password']){var _0x554728={'recipient':[_0x111e35[_0x3fe6('0x25')]],'message':_0x111e35['body'],'message_type':_0x2ee628[_0x3fe6('0x31')]};if(_0x2ee628[_0x3fe6('0x31')]&&_0x2ee628[_0x3fe6('0x31')]!=='SI'){_0x554728[_0x3fe6('0x32')]=_0x2ee628[_0x3fe6('0x25')];}var _0x41b5e5={'url':_0x1d7b52+'login?username='+_0x2ee628[_0x3fe6('0x30')]+'&password='+_0x2ee628['password'],'method':_0x3fe6('0x33')};rp(_0x41b5e5)[_0x3fe6('0x1a')](function(_0x274fad){var _0x5b9045=_0x274fad['split'](';');var _0x5e98ac={'user_key':_0x5b9045[0x0],'session_key':_0x5b9045[0x1]};_0x41b5e5={'url':_0x1d7b52+'sms','method':_0x3fe6('0x34'),'headers':{'user_key':_0x5e98ac[_0x3fe6('0x35')],'Session_key':_0x5e98ac[_0x3fe6('0x36')]},'json':!![],'body':_0x554728};return rp(_0x41b5e5);})[_0x3fe6('0x1a')](function(_0x11b309){if(_0x11b309[_0x3fe6('0x37')]>=0x1){var _0x1b17cb={'messageId':_0x11b309['internal_order_id']};if(_0x2ee628[_0x3fe6('0x31')]!=='GP'||!_0x2ee628[_0x3fe6('0x38')]){_0x1b17cb[_0x3fe6('0x39')]=!![];}return _0x93697e['update'](_0x1b17cb);}else{return logger['error'](_0x3fe6('0x2a'),'afterCreate','skebby',util['inspect'](_0x11b309,{'showHidden':![],'depth':null}));}})[_0x3fe6('0x1c')](function(_0x6218b1){return logger['error'](_0x3fe6('0x2a'),_0x3fe6('0x2b'),'skebby',util[_0x3fe6('0x2c')](_0x6218b1,{'showHidden':![],'depth':null}));});}else{logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3fe6('0x3a'):if(_0x2ee628[_0x3fe6('0x24')]){var _0xbd37d8={'recipient':_0x111e35[_0x3fe6('0x25')],'message':_0x111e35[_0x3fe6('0xf')],'sender':_0x2ee628[_0x3fe6('0x3b')]||_0x2ee628[_0x3fe6('0x25')],'authorization':_0x2ee628['authToken']};var _0x3ceec8={'method':_0x3fe6('0x34'),'uri':_0x3fe6('0x3c'),'body':_0xbd37d8,'json':!![]};rp(_0x3ceec8)[_0x3fe6('0x1a')](function(_0x164d2b){var _0x593278={'messageId':_0x164d2b[_0x3fe6('0x3d')]};if(!_0x2ee628['deliveryReport']){_0x593278[_0x3fe6('0x39')]=!![];}return _0x93697e[_0x3fe6('0x1b')](_0x593278);})[_0x3fe6('0x1c')](function(_0x2693b1){logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x3a'),util[_0x3fe6('0x2c')](_0x2693b1,{'showHidden':![],'depth':null}));});}else{logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x3a'),_0x3fe6('0x3e'));}break;case _0x3fe6('0x3f'):if(_0x2ee628['username']&&_0x2ee628[_0x3fe6('0x40')]){var _0xbd37d8={'messages':[{'source':'xCALLY\x20Motion','to':_0x111e35[_0x3fe6('0x25')],'body':_0x111e35[_0x3fe6('0xf')],'from':_0x2ee628[_0x3fe6('0x3b')]||_0x2ee628[_0x3fe6('0x25')]}]};var _0x488d17=util['format'](_0x3fe6('0x41'),_0x2ee628[_0x3fe6('0x30')],_0x2ee628[_0x3fe6('0x40')]);var _0x3ceec8={'method':_0x3fe6('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xbd37d8,'headers':{'Authorization':util['format'](_0x3fe6('0x42'),new Buffer(_0x488d17)[_0x3fe6('0x43')](_0x3fe6('0x44')))},'json':!![]};rp(_0x3ceec8)[_0x3fe6('0x1a')](function(_0x5cbba6){if(_0x5cbba6[_0x3fe6('0x45')]>=0xc8&&_0x5cbba6['http_code']<=0xce){if(_0x5cbba6[_0x3fe6('0x46')]&&_0x5cbba6[_0x3fe6('0x46')][_0x3fe6('0x47')]>0x0){var _0x5dd45a=_[_0x3fe6('0x48')](_0x5cbba6[_0x3fe6('0x46')][_0x3fe6('0x26')]);var _0x58758f={'messageId':_0x5dd45a[_0x3fe6('0x49')]};if(!_0x2ee628[_0x3fe6('0x38')]){_0x58758f[_0x3fe6('0x39')]=!![];}return _0x93697e[_0x3fe6('0x1b')](_0x58758f);}else{logger['error'](_0x3fe6('0x2a'),_0x3fe6('0x2b'),'clickSend',util[_0x3fe6('0x2c')](_0x5cbba6,{'showHidden':![],'depth':null}));}}else{logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),'clickSend',util['inspect'](_0x5cbba6,{'showHidden':![],'depth':null}));}})[_0x3fe6('0x1c')](function(_0x114537){logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x4a'),util[_0x3fe6('0x2c')](_0x114537,{'showHidden':![],'depth':null}));});}else{logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),'clickSend',_0x3fe6('0x4b'));}break;case'plivo':if(_0x2ee628[_0x3fe6('0x4c')]&&_0x2ee628[_0x3fe6('0x24')]){var _0xbd37d8={'dst':_0x111e35[_0x3fe6('0x25')],'text':_0x111e35['body'],'src':_0x2ee628['senderString']||_0x2ee628[_0x3fe6('0x25')],'url':_0x2ee628[_0x3fe6('0x4d')]+_0x3fe6('0x4e')+_0x111e35['id']+_0x3fe6('0x27')+_0x2ee628['token']};var _0x488d17=util[_0x3fe6('0x4f')]('%s:%s',_0x2ee628[_0x3fe6('0x4c')],_0x2ee628[_0x3fe6('0x24')]);var _0x3ceec8={'method':_0x3fe6('0x34'),'uri':util[_0x3fe6('0x4f')](_0x3fe6('0x50'),_0x2ee628[_0x3fe6('0x4c')]),'body':_0xbd37d8,'headers':{'Authorization':util[_0x3fe6('0x4f')](_0x3fe6('0x42'),new Buffer(_0x488d17)[_0x3fe6('0x43')](_0x3fe6('0x44')))},'json':!![]};rp(_0x3ceec8)[_0x3fe6('0x1a')](function(_0x524a21){var _0x4a14ac={'messageId':_0x524a21[_0x3fe6('0x51')][0x0]};return _0x93697e[_0x3fe6('0x1b')](_0x4a14ac);})[_0x3fe6('0x1c')](function(_0x11ce4a){logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),'afterCreate',_0x3fe6('0x52'),util[_0x3fe6('0x2c')](_0x11ce4a,{'showHidden':![],'depth':null}));});}else{logger[_0x3fe6('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3fe6('0x2b'),_0x3fe6('0x52'),_0x3fe6('0x53'));}break;case _0x3fe6('0x54'):if(_0x2ee628[_0x3fe6('0x30')]&&_0x2ee628[_0x3fe6('0x40')]){if(_0x2ee628[_0x3fe6('0x55')]){var _0x136c0e={'method':'POST','uri':_0x2ee628[_0x3fe6('0x55')]+_0x3fe6('0x56'),'body':{'username':_0x2ee628['username'],'password':_0x2ee628[_0x3fe6('0x40')]},'json':!![]};return rp(_0x136c0e)[_0x3fe6('0x1a')](function(_0xb5a0f1){var _0x229db5={'method':_0x3fe6('0x34'),'uri':_0x2ee628[_0x3fe6('0x55')]+_0x3fe6('0x57'),'body':{'messages':[{'from':_0x2ee628[_0x3fe6('0x25')],'destinations':[{'to':_0x111e35['phone']}],'text':_0x111e35[_0x3fe6('0xf')],'notifyUrl':_0x2ee628[_0x3fe6('0x4d')]+_0x3fe6('0x4e')+_0x111e35['id']+'/status?token='+_0x2ee628['token'],'notifyContentType':_0x3fe6('0x58'),'callbackData':_0x2ee628[_0x3fe6('0x25')]+';'+_0x111e35[_0x3fe6('0xf')]}]},'headers':{'Authorization':_0x3fe6('0x59')+_0xb5a0f1[_0x3fe6('0x28')]},'json':!![]};return rp(_0x229db5)[_0x3fe6('0x1a')](function(_0x4cbffa){if(_0x4cbffa[_0x3fe6('0x26')]){var _0x2a2ba8={'messageId':_0x4cbffa['messages'][0x0][_0x3fe6('0xe')]};if(!_0x2ee628['deliveryReport']){_0x2a2ba8[_0x3fe6('0x39')]=!![];}return _0x93697e['update'](_0x2a2ba8);}else{return logger[_0x3fe6('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3fe6('0x2b'),_0x3fe6('0x54'),util[_0x3fe6('0x2c')](_0x4cbffa,{'showHidden':![],'depth':null}));}});})[_0x3fe6('0x1c')](function(_0x16f817){return logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x54'),util['inspect'](_0x16f817,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3fe6('0x2b'),_0x3fe6('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x3fe6('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3fe6('0x2b'),_0x3fe6('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3fe6('0x5a'):var _0x48d510=require('crypto');if(_0x2ee628[_0x3fe6('0x5b')]){var _0xd37027={};_0xd37027[_0x3fe6('0x5c')]=_0x2ee628[_0x3fe6('0x30')];_0xd37027[_0x3fe6('0x25')]=_0x111e35[_0x3fe6('0x25')];_0xd37027['sender']=_0x2ee628[_0x3fe6('0x25')];_0xd37027['text']=_0x111e35[_0x3fe6('0xf')];_0xd37027[_0x3fe6('0x5d')]=+new Date();var _0x24eba9='';var _0x504687='';var _0x52ed62=Object['keys'](_0xd37027);_0x52ed62[_0x3fe6('0x5e')]();for(var _0x6967ac=0x0;_0x6967ac<_0x52ed62[_0x3fe6('0x5f')];_0x6967ac++){if(_0x24eba9!=''){_0x24eba9+='&';}_0x24eba9+=_0x52ed62[_0x6967ac]+'='+encodeURIComponent(_0xd37027[_0x52ed62[_0x6967ac]]);_0x504687+=_0xd37027[_0x52ed62[_0x6967ac]];}_0x504687+=_0x2ee628[_0x3fe6('0x5b')];_0x504687=_0x48d510[_0x3fe6('0x60')](_0x3fe6('0x61'))[_0x3fe6('0x1b')](_0x504687)['digest'](_0x3fe6('0x62'));if(_0x24eba9!==''){_0x24eba9+='&';}_0x24eba9+=_0x3fe6('0x63')+_0x504687;var _0x41b5e5={'method':_0x3fe6('0x33'),'uri':_0x2ee628['baseUrl']+_0x3fe6('0x64')+_0x24eba9,'json':!![]};return rp(_0x41b5e5)[_0x3fe6('0x1a')](function(_0x92f435){var _0x2aaa2a=Object[_0x3fe6('0x65')](_0x92f435);if(_0x92f435[_0x2aaa2a[0x0]][_0x3fe6('0x1d')]&&parseInt(_0x92f435[_0x2aaa2a[0x0]][_0x3fe6('0x1d')])===0x0){var _0x21259b={'messageId':_0x92f435[_0x2aaa2a[0x0]][_0x3fe6('0x66')]};if(!_0x2ee628[_0x3fe6('0x38')]){_0x21259b[_0x3fe6('0x39')]=!![];}return _0x93697e[_0x3fe6('0x1b')](_0x21259b);}else{return logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x5a'),util[_0x3fe6('0x2c')](_0x92f435[_0x3fe6('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x379fea){return logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x5a'),util[_0x3fe6('0x2c')](_0x379fea,{'showHidden':![],'depth':null}));});}else{logger[_0x3fe6('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',_0x3fe6('0x67'));}break;case _0x3fe6('0x68'):if(_0x2ee628[_0x3fe6('0x5b')]){var _0x42cbe7={'method':_0x3fe6('0x34'),'uri':_0x3fe6('0x69'),'headers':{'Authorization':_0x2ee628[_0x3fe6('0x5b')]},'body':{'content':_0x111e35[_0x3fe6('0xf')],'to':[_0x111e35['phone']],'from':_0x2ee628['phone'],'binary':![],'clientMessageId':_0x3fe6('0x6a'),'charset':_0x3fe6('0x6b')},'json':!![]};rp(_0x42cbe7)[_0x3fe6('0x1a')](function(_0x265bbe){if(!_0x265bbe[_0x3fe6('0x1d')]){var _0x2f3383={'messageId':_0x265bbe[_0x3fe6('0x26')][0x0][_0x3fe6('0x6c')]};if(!_0x2ee628[_0x3fe6('0x38')]){_0x2f3383['read']=!![];}return _0x93697e[_0x3fe6('0x1b')](_0x2f3383);}else{return logger[_0x3fe6('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3fe6('0x2b'),_0x3fe6('0x68'),util['inspect'](_0x265bbe[_0x3fe6('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4ba59d){return logger['error'](_0x3fe6('0x2a'),'afterCreate',_0x3fe6('0x68'),util[_0x3fe6('0x2c')](_0x4ba59d,{'showHidden':![],'depth':null}));});}else{logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x3fe6('0x6d'):if(_0x2ee628[_0x3fe6('0x30')]&&_0x2ee628[_0x3fe6('0x40')]){var _0x488d17=util[_0x3fe6('0x4f')](_0x3fe6('0x41'),_0x2ee628[_0x3fe6('0x30')],_0x2ee628['password']);var _0x3ceec8={'method':_0x3fe6('0x34'),'uri':_0x3fe6('0x6e')+_0x2ee628['accountId']+_0x3fe6('0x6f'),'body':{'to':[_0x111e35[_0x3fe6('0x25')]],'text':_0x111e35[_0x3fe6('0xf')],'from':_0x2ee628[_0x3fe6('0x25')],'applicationId':_0x2ee628['applicationId']},'headers':{'Authorization':util[_0x3fe6('0x4f')](_0x3fe6('0x42'),new Buffer(_0x488d17)[_0x3fe6('0x43')](_0x3fe6('0x44')))},'json':!![]};rp(_0x3ceec8)[_0x3fe6('0x1a')](function(_0x3d68fc){if(_0x3d68fc['id']){var _0x17f35f={'messageId':_0x3d68fc['id']};return _0x93697e[_0x3fe6('0x1b')](_0x17f35f);}else{logger['error'](_0x3fe6('0x2a'),'afterCreate',_0x3fe6('0x6d'),util[_0x3fe6('0x2c')](_0x3d68fc,{'showHidden':![],'depth':null}));}})['catch'](function(_0x79e048){logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),'afterCreate',_0x3fe6('0x6d'),util[_0x3fe6('0x2c')](_0x79e048,{'showHidden':![],'depth':null}));});}else{logger[_0x3fe6('0x1d')](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x6d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3fe6('0x70'):if(_0x2ee628['apiKey']){var _0x3c6a91={};var _0x41b5e5={'method':_0x3fe6('0x34'),'uri':_0x3fe6('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x2ee628['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x2ee628[_0x3fe6('0x25')],'to':_0x111e35[_0x3fe6('0x25')],'text':_0x111e35['body']},'json':!![]};return rp(_0x41b5e5)[_0x3fe6('0x1a')](function(_0x19c1eb){if(_0x19c1eb['code']==0xca){_0x3c6a91[_0x3fe6('0x72')]=_0x19c1eb;var _0xa7d4a9={'method':'POST','uri':_0x3fe6('0x73'),'headers':{'Authorization':_0x3fe6('0x74')+_0x2ee628['apiKey'],'Content-Type':_0x3fe6('0x58')},'body':{'refid':_0x3c6a91[_0x3fe6('0x72')][_0x3fe6('0x75')]},'json':!![]};return rp(_0xa7d4a9)['then'](function(_0x54e62c){_0x3c6a91['status']=_0x54e62c;var _0x36b34a={'messageId':_0x3c6a91[_0x3fe6('0x72')][_0x3fe6('0x75')],'read':!![]};return _0x93697e[_0x3fe6('0x1b')](_0x36b34a);});}else{return logger['error'](_0x3fe6('0x2a'),_0x3fe6('0x2b'),_0x3fe6('0x70'),util[_0x3fe6('0x2c')](_0x19c1eb,{'showHidden':![],'depth':null}));}})[_0x3fe6('0x1c')](function(_0x266f38){return logger['error'](_0x3fe6('0x2a'),'afterCreate',_0x3fe6('0x70'),util[_0x3fe6('0x2c')](_0x266f38,{'showHidden':![],'depth':null}));});}else{return logger[_0x3fe6('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3fe6('0x70'),_0x3fe6('0x76'));}break;}}})[_0x3fe6('0x77')](function(){_0x47c7b8();});}else{_0x47c7b8();}}},'charset':_0x3fe6('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b6a891e..0a5c2ec 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x401e=['./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsMessage','create','body','options','raw','debug','CreateSmsMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0x401e,0xf3));var _0xe401=function(_0x32bc16,_0x542550){_0x32bc16=_0x32bc16-0x0;var _0xd8beb1=_0x401e[_0x32bc16];return _0xd8beb1;};'use strict';var _=require('lodash');var util=require(_0xe401('0x0'));var moment=require(_0xe401('0x1'));var BPromise=require(_0xe401('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe401('0x3'));var db=require(_0xe401('0x4'))['db'];var utils=require(_0xe401('0x5'));var logger=require(_0xe401('0x6'))(_0xe401('0x7'));var config=require(_0xe401('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe401('0x9')]['http']({'port':0x232a});config[_0xe401('0xa')]=_[_0xe401('0xb')](config[_0xe401('0xa')],{'host':_0xe401('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe401('0xa')]));require(_0xe401('0xd'))[_0xe401('0xe')](socket);function respondWithRpcPromise(_0x206ddc,_0x3028ac,_0x5d83e1){return new BPromise(function(_0x1de08e,_0x32e639){return client['request'](_0x206ddc,_0x5d83e1)[_0xe401('0xf')](function(_0x15f91e){logger[_0xe401('0x10')](_0xe401('0x11'),_0x3028ac,_0xe401('0x12'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3028ac,'request\x20sent',JSON[_0xe401('0x13')](_0x15f91e));if(_0x15f91e[_0xe401('0x14')]){if(_0x15f91e[_0xe401('0x14')][_0xe401('0x15')]===0x1f4){logger[_0xe401('0x14')]('SmsMessage,\x20%s,\x20%s',_0x3028ac,_0x15f91e[_0xe401('0x14')]['message']);return _0x32e639(_0x15f91e['error'][_0xe401('0x16')]);}logger[_0xe401('0x14')](_0xe401('0x11'),_0x3028ac,_0x15f91e[_0xe401('0x14')][_0xe401('0x16')]);return _0x1de08e(_0x15f91e[_0xe401('0x14')][_0xe401('0x16')]);}else{logger['info'](_0xe401('0x11'),_0x3028ac,_0xe401('0x12'));_0x1de08e(_0x15f91e[_0xe401('0x17')][_0xe401('0x16')]);}})[_0xe401('0x18')](function(_0x3c034a){logger[_0xe401('0x14')](_0xe401('0x11'),_0x3028ac,_0x3c034a);_0x32e639(_0x3c034a);});});}exports['CreateSmsMessage']=function(_0x582146){var _0x2462c0=this;return new Promise(function(_0x1a4363,_0x2f2a05){return db[_0xe401('0x19')][_0xe401('0x1a')](_0x582146[_0xe401('0x1b')],{'raw':_0x582146[_0xe401('0x1c')]?_0x582146[_0xe401('0x1c')][_0xe401('0x1d')]===undefined?!![]:![]:!![]})[_0xe401('0xf')](function(_0x33f56f){logger[_0xe401('0x10')]('CreateSmsMessage',_0x582146);logger[_0xe401('0x1e')](_0xe401('0x1f'),_0x582146,JSON['stringify'](_0x33f56f));_0x1a4363(_0x33f56f);})['catch'](function(_0x44dcc6){logger[_0xe401('0x14')](_0xe401('0x1f'),_0x44dcc6[_0xe401('0x16')],_0x582146);_0x2f2a05(_0x2462c0[_0xe401('0x14')](0x1f4,_0x44dcc6[_0xe401('0x16')]));});});}; \ No newline at end of file +var _0x7f5d=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','SmsMessage','create','body','options','raw','then','debug','CreateSmsMessage','stringify','lodash','moment'];(function(_0x4c0155,_0x5b20db){var _0x1276db=function(_0x3ff813){while(--_0x3ff813){_0x4c0155['push'](_0x4c0155['shift']());}};_0x1276db(++_0x5b20db);}(_0x7f5d,0x16a));var _0xd7f5=function(_0x1554fd,_0x1dc946){_0x1554fd=_0x1554fd-0x0;var _0x214847=_0x7f5d[_0x1554fd];return _0x214847;};'use strict';var _=require(_0xd7f5('0x0'));var util=require('util');var moment=require(_0xd7f5('0x1'));var BPromise=require('bluebird');var rs=require(_0xd7f5('0x2'));var fs=require('fs');var Redis=require(_0xd7f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7f5('0x4'));var logger=require('../../config/logger')(_0xd7f5('0x5'));var config=require(_0xd7f5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd7f5('0x7')][_0xd7f5('0x8')]({'port':0x232a});config[_0xd7f5('0x9')]=_['defaults'](config[_0xd7f5('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7f5('0x9')]));require('./smsMessage.socket')[_0xd7f5('0xa')](socket);function respondWithRpcPromise(_0x37cc90,_0x32be1d,_0x5406ef){return new BPromise(function(_0x2d41ac,_0x3d1df3){return client[_0xd7f5('0xb')](_0x37cc90,_0x5406ef)['then'](function(_0x5ba4e2){logger[_0xd7f5('0xc')](_0xd7f5('0xd'),_0x32be1d,_0xd7f5('0xe'));logger['debug'](_0xd7f5('0xf'),_0x32be1d,_0xd7f5('0xe'),JSON['stringify'](_0x5ba4e2));if(_0x5ba4e2[_0xd7f5('0x10')]){if(_0x5ba4e2[_0xd7f5('0x10')][_0xd7f5('0x11')]===0x1f4){logger[_0xd7f5('0x10')](_0xd7f5('0xd'),_0x32be1d,_0x5ba4e2[_0xd7f5('0x10')][_0xd7f5('0x12')]);return _0x3d1df3(_0x5ba4e2[_0xd7f5('0x10')][_0xd7f5('0x12')]);}logger[_0xd7f5('0x10')]('SmsMessage,\x20%s,\x20%s',_0x32be1d,_0x5ba4e2[_0xd7f5('0x10')][_0xd7f5('0x12')]);return _0x2d41ac(_0x5ba4e2[_0xd7f5('0x10')]['message']);}else{logger[_0xd7f5('0xc')](_0xd7f5('0xd'),_0x32be1d,_0xd7f5('0xe'));_0x2d41ac(_0x5ba4e2['result'][_0xd7f5('0x12')]);}})['catch'](function(_0x4a02ed){logger['error'](_0xd7f5('0xd'),_0x32be1d,_0x4a02ed);_0x3d1df3(_0x4a02ed);});});}exports['CreateSmsMessage']=function(_0x3e7b2c){var _0x3c3b68=this;return new Promise(function(_0x310281,_0xe91b3a){return db[_0xd7f5('0x13')][_0xd7f5('0x14')](_0x3e7b2c[_0xd7f5('0x15')],{'raw':_0x3e7b2c['options']?_0x3e7b2c[_0xd7f5('0x16')][_0xd7f5('0x17')]===undefined?!![]:![]:!![]})[_0xd7f5('0x18')](function(_0x5d1ded){logger[_0xd7f5('0xc')]('CreateSmsMessage',_0x3e7b2c);logger[_0xd7f5('0x19')](_0xd7f5('0x1a'),_0x3e7b2c,JSON[_0xd7f5('0x1b')](_0x5d1ded));_0x310281(_0x5d1ded);})['catch'](function(_0x30af32){logger[_0xd7f5('0x10')](_0xd7f5('0x1a'),_0x30af32[_0xd7f5('0x12')],_0x3e7b2c);_0xe91b3a(_0x3c3b68[_0xd7f5('0x10')](0x1f4,_0x30af32[_0xd7f5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b696321..6947f2d 100644 --- a/server/api/smsMessage/smsMessage.socket.js +++ b/server/api/smsMessage/smsMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccbb=['remove','update','emit','removeListener','register','smsMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xccbb,0x1e0));var _0xbccb=function(_0x16fbfa,_0x34cdfc){_0x16fbfa=_0x16fbfa-0x0;var _0x47887e=_0xccbb[_0x16fbfa];return _0x47887e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xbccb('0x0'),_0xbccb('0x1')];function createListener(_0x3d7c6b,_0x563d28){return function(_0x111e45){_0x563d28[_0xbccb('0x2')](_0x3d7c6b,_0x111e45);};}function removeListener(_0x5da599,_0x1693be){return function(){SmsMessageEvents[_0xbccb('0x3')](_0x5da599,_0x1693be);};}exports[_0xbccb('0x4')]=function(_0x3a7223){for(var _0x9338dc=0x0,_0x1d7e3f=events['length'];_0x9338dc<_0x1d7e3f;_0x9338dc++){var _0x314e35=events[_0x9338dc];var _0x1f3573=createListener(_0xbccb('0x5')+_0x314e35,_0x3a7223);SmsMessageEvents['on'](_0x314e35,_0x1f3573);}}; \ No newline at end of file +var _0xd022=['remove','update','register','smsMessage:','./smsMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd022,0x18a));var _0x2d02=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd022[_0x465a0c];return _0x1e202e;};'use strict';var SmsMessageEvents=require(_0x2d02('0x0'));var events=[_0x2d02('0x1'),_0x2d02('0x2'),_0x2d02('0x3')];function createListener(_0x3d0b6b,_0x57b561){return function(_0x590757){_0x57b561['emit'](_0x3d0b6b,_0x590757);};}function removeListener(_0x437f59,_0x3dbf3e){return function(){SmsMessageEvents['removeListener'](_0x437f59,_0x3dbf3e);};}exports[_0x2d02('0x4')]=function(_0x250af4){for(var _0x17b365=0x0,_0x47bda3=events['length'];_0x17b365<_0x47bda3;_0x17b365++){var _0x41d4fe=events[_0x17b365];var _0x14e560=createListener(_0x2d02('0x5')+_0x41d4fe,_0x250af4);SmsMessageEvents['on'](_0x41d4fe,_0x14e560);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d9bacfa..0673c30 100644 --- a/server/api/smsQueue/index.js +++ b/server/api/smsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09ad=['addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post'];(function(_0x304a70,_0x2e569c){var _0x15ce6d=function(_0x1b255d){while(--_0x1b255d){_0x304a70['push'](_0x304a70['shift']());}};_0x15ce6d(++_0x2e569c);}(_0x09ad,0xd3));var _0xd09a=function(_0x152654,_0x20899a){_0x152654=_0x152654-0x0;var _0x159c3e=_0x09ad[_0x152654];return _0x159c3e;};'use strict';var multer=require('multer');var util=require(_0xd09a('0x0'));var path=require(_0xd09a('0x1'));var timeout=require(_0xd09a('0x2'));var express=require(_0xd09a('0x3'));var router=express[_0xd09a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd09a('0x5'));var interaction=require(_0xd09a('0x6'));var config=require('../../config/environment');var controller=require(_0xd09a('0x7'));router[_0xd09a('0x8')]('/',auth['isAuthenticated'](),controller[_0xd09a('0x9')]);router[_0xd09a('0x8')](_0xd09a('0xa'),auth[_0xd09a('0xb')](),controller[_0xd09a('0xc')]);router[_0xd09a('0x8')]('/:id',auth[_0xd09a('0xb')](),controller[_0xd09a('0xd')]);router[_0xd09a('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xd09a('0xe')]);router[_0xd09a('0x8')](_0xd09a('0xf'),auth[_0xd09a('0xb')](),controller[_0xd09a('0x10')]);router[_0xd09a('0x8')](_0xd09a('0x11'),auth[_0xd09a('0xb')](),controller[_0xd09a('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd09a('0x13')]);router[_0xd09a('0x14')]('/:id/teams',auth[_0xd09a('0xb')](),controller['addTeams']);router[_0xd09a('0x14')](_0xd09a('0x11'),auth['isAuthenticated'](),controller[_0xd09a('0x15')]);router[_0xd09a('0x16')](_0xd09a('0x17'),auth[_0xd09a('0xb')](),controller[_0xd09a('0x18')]);router['delete'](_0xd09a('0x17'),auth[_0xd09a('0xb')](),controller[_0xd09a('0x19')]);router[_0xd09a('0x1a')]('/:id/teams',auth[_0xd09a('0xb')](),controller[_0xd09a('0x1b')]);router[_0xd09a('0x1a')](_0xd09a('0x11'),auth[_0xd09a('0xb')](),controller[_0xd09a('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xfe13=['./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','update','delete','removeTeams','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4aa197,_0x2c0821){var _0x2e119e=function(_0x82627c){while(--_0x82627c){_0x4aa197['push'](_0x4aa197['shift']());}};_0x2e119e(++_0x2c0821);}(_0xfe13,0x155));var _0x3fe1=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0xfe13[_0x49ad79];return _0xa4e38a;};'use strict';var multer=require(_0x3fe1('0x0'));var util=require(_0x3fe1('0x1'));var path=require('path');var timeout=require(_0x3fe1('0x2'));var express=require('express');var router=express[_0x3fe1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fe1('0x4'));var interaction=require(_0x3fe1('0x5'));var config=require(_0x3fe1('0x6'));var controller=require(_0x3fe1('0x7'));router[_0x3fe1('0x8')]('/',auth[_0x3fe1('0x9')](),controller[_0x3fe1('0xa')]);router[_0x3fe1('0x8')](_0x3fe1('0xb'),auth['isAuthenticated'](),controller[_0x3fe1('0xc')]);router[_0x3fe1('0x8')](_0x3fe1('0xd'),auth[_0x3fe1('0x9')](),controller[_0x3fe1('0xe')]);router[_0x3fe1('0x8')](_0x3fe1('0xf'),auth[_0x3fe1('0x9')](),controller['getMembers']);router[_0x3fe1('0x8')](_0x3fe1('0x10'),auth[_0x3fe1('0x9')](),controller[_0x3fe1('0x11')]);router[_0x3fe1('0x8')](_0x3fe1('0x12'),auth[_0x3fe1('0x9')](),controller[_0x3fe1('0x13')]);router['post']('/',auth[_0x3fe1('0x9')](),controller[_0x3fe1('0x14')]);router['post']('/:id/teams',auth[_0x3fe1('0x9')](),controller[_0x3fe1('0x15')]);router[_0x3fe1('0x16')](_0x3fe1('0x12'),auth['isAuthenticated'](),controller[_0x3fe1('0x17')]);router[_0x3fe1('0x18')](_0x3fe1('0xd'),auth[_0x3fe1('0x9')](),controller[_0x3fe1('0x19')]);router[_0x3fe1('0x1a')]('/:id',auth[_0x3fe1('0x9')](),controller['destroy']);router[_0x3fe1('0x1a')](_0x3fe1('0x10'),auth[_0x3fe1('0x9')](),controller[_0x3fe1('0x1b')]);router['delete'](_0x3fe1('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3fe1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index a217c6f..d16eb5a 100644 --- a/server/api/smsQueue/smsQueue.attributes.js +++ b/server/api/smsQueue/smsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb699=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x36976d,_0x8b0ddc){var _0x2ad159=function(_0x513c04){while(--_0x513c04){_0x36976d['push'](_0x36976d['shift']());}};_0x2ad159(++_0x8b0ddc);}(_0xb699,0x134));var _0x9b69=function(_0x211cc4,_0x1ea1e8){_0x211cc4=_0x211cc4-0x0;var _0x1a7989=_0xb699[_0x211cc4];return _0x1a7989;};'use strict';var Sequelize=require(_0x9b69('0x0'));module[_0x9b69('0x1')]={'name':{'type':Sequelize[_0x9b69('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9b69('0x2')]},'timeout':{'type':Sequelize[_0x9b69('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b69('0x4')](_0x9b69('0x5'),_0x9b69('0x6'),_0x9b69('0x7'))}}; \ No newline at end of file +var _0x81b6=['exports','STRING','name','ENUM','beepall','roundrobin','sequelize'];(function(_0x355ea1,_0x259b2a){var _0x164066=function(_0x4d6866){while(--_0x4d6866){_0x355ea1['push'](_0x355ea1['shift']());}};_0x164066(++_0x259b2a);}(_0x81b6,0x1b8));var _0x681b=function(_0x3aac3a,_0x331bb7){_0x3aac3a=_0x3aac3a-0x0;var _0x146900=_0x81b6[_0x3aac3a];return _0x146900;};'use strict';var Sequelize=require(_0x681b('0x0'));module[_0x681b('0x1')]={'name':{'type':Sequelize[_0x681b('0x2')],'unique':_0x681b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x681b('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x681b('0x4')]('rrmemory',_0x681b('0x5'),_0x681b('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5ba7a9e..e713e28 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x452985,_0x1ca4af){var _0x115294=function(_0x38a74d){while(--_0x38a74d){_0x452985['push'](_0x452985['shift']());}};_0x115294(++_0x1ca4af);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x0b0e[_0x4b91c4];return _0x25cb80;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 09dfbc6..1a7bd34 100644 --- a/server/api/smsQueue/smsQueue.events.js +++ b/server/api/smsQueue/smsQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef05=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x522f84,_0x16c823){var _0x2cb3e7=function(_0x102ea2){while(--_0x102ea2){_0x522f84['push'](_0x522f84['shift']());}};_0x2cb3e7(++_0x16c823);}(_0xef05,0x126));var _0x5ef0=function(_0x2ab7c0,_0x3fe302){_0x2ab7c0=_0x2ab7c0-0x0;var _0x1a49e3=_0xef05[_0x2ab7c0];return _0x1a49e3;};'use strict';var EventEmitter=require(_0x5ef0('0x0'));var SmsQueue=require(_0x5ef0('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5ef0('0x2')](0x0);var events={'afterCreate':_0x5ef0('0x3'),'afterUpdate':'update','afterDestroy':_0x5ef0('0x4')};function emitEvent(_0x4e7cf1){return function(_0x46403e,_0x16e47c,_0x530649){SmsQueueEvents[_0x5ef0('0x5')](_0x4e7cf1+':'+_0x46403e['id'],_0x46403e);SmsQueueEvents[_0x5ef0('0x5')](_0x4e7cf1,_0x46403e);_0x530649(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x5ef0('0x6')](e,emitEvent(event));}}module[_0x5ef0('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xba96=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x9cbc18,_0x2cfdf8){var _0x2c6f1b=function(_0x421e24){while(--_0x421e24){_0x9cbc18['push'](_0x9cbc18['shift']());}};_0x2c6f1b(++_0x2cfdf8);}(_0xba96,0x129));var _0x6ba9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xba96[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x6ba9('0x0'))['db'][_0x6ba9('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6ba9('0x2')](0x0);var events={'afterCreate':_0x6ba9('0x3'),'afterUpdate':_0x6ba9('0x4'),'afterDestroy':_0x6ba9('0x5')};function emitEvent(_0x3d80b4){return function(_0x36bd11,_0x165bb4,_0x750948){SmsQueueEvents[_0x6ba9('0x6')](_0x3d80b4+':'+_0x36bd11['id'],_0x36bd11);SmsQueueEvents[_0x6ba9('0x6')](_0x3d80b4,_0x36bd11);_0x750948(null);};}for(var e in events){if(events[_0x6ba9('0x7')](e)){var event=events[e];SmsQueue[_0x6ba9('0x8')](e,emitEvent(event));}}module[_0x6ba9('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 35f6bdb..d0ecbd8 100644 --- a/server/api/smsQueue/smsQueue.model.js +++ b/server/api/smsQueue/smsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a61=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','SmsQueue','lodash','util','../../config/logger','api','moment'];(function(_0x253e0a,_0x3cef8e){var _0x24b388=function(_0x37f3ac){while(--_0x37f3ac){_0x253e0a['push'](_0x253e0a['shift']());}};_0x24b388(++_0x3cef8e);}(_0x5a61,0x103));var _0x15a6=function(_0x88e3bf,_0x4d8151){_0x88e3bf=_0x88e3bf-0x0;var _0x1d2416=_0x5a61[_0x88e3bf];return _0x1d2416;};'use strict';var _=require(_0x15a6('0x0'));var util=require(_0x15a6('0x1'));var logger=require(_0x15a6('0x2'))(_0x15a6('0x3'));var moment=require(_0x15a6('0x4'));var BPromise=require(_0x15a6('0x5'));var rp=require(_0x15a6('0x6'));var fs=require('fs');var path=require(_0x15a6('0x7'));var rimraf=require(_0x15a6('0x8'));var config=require(_0x15a6('0x9'));var attributes=require(_0x15a6('0xa'));module['exports']=function(_0x1fb930,_0x3cf401){return _0x1fb930['define'](_0x15a6('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2810=['request-promise','rimraf','../../config/environment','./smsQueue.attributes','define','sms_queues','lodash','../../config/logger'];(function(_0x4e2dbd,_0x4d53bd){var _0x2a2e9a=function(_0xc8d76f){while(--_0xc8d76f){_0x4e2dbd['push'](_0x4e2dbd['shift']());}};_0x2a2e9a(++_0x4d53bd);}(_0x2810,0xb6));var _0x0281=function(_0x5aef34,_0x1e3b7a){_0x5aef34=_0x5aef34-0x0;var _0x377343=_0x2810[_0x5aef34];return _0x377343;};'use strict';var _=require(_0x0281('0x0'));var util=require('util');var logger=require(_0x0281('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0281('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0281('0x3'));var config=require(_0x0281('0x4'));var attributes=require(_0x0281('0x5'));module['exports']=function(_0x261d67,_0x380989){return _0x261d67[_0x0281('0x6')]('SmsQueue',attributes,{'tableName':_0x0281('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 76e91fd..c1b1ff5 100644 --- a/server/api/smsQueue/smsQueue.rpc.js +++ b/server/api/smsQueue/smsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7c7=['ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','message','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','model','map','debug','stringify'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc7c7,0x71));var _0x7c7c=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xc7c7[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x7c7c('0x0'));var util=require(_0x7c7c('0x1'));var moment=require(_0x7c7c('0x2'));var BPromise=require(_0x7c7c('0x3'));var rs=require(_0x7c7c('0x4'));var fs=require('fs');var Redis=require(_0x7c7c('0x5'));var db=require(_0x7c7c('0x6'))['db'];var utils=require(_0x7c7c('0x7'));var logger=require(_0x7c7c('0x8'))(_0x7c7c('0x9'));var config=require('../../config/environment');var jayson=require(_0x7c7c('0xa'));var client=jayson['client'][_0x7c7c('0xb')]({'port':0x232a});config[_0x7c7c('0xc')]=_[_0x7c7c('0xd')](config[_0x7c7c('0xc')],{'host':_0x7c7c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x7c7c('0xf')](socket);function respondWithRpcPromise(_0x24b33f,_0x4459ba,_0x3c6929){return new BPromise(function(_0x688f73,_0x242fda){return client['request'](_0x24b33f,_0x3c6929)[_0x7c7c('0x10')](function(_0x378737){logger[_0x7c7c('0x11')](_0x7c7c('0x12'),_0x4459ba,_0x7c7c('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4459ba,_0x7c7c('0x13'),JSON['stringify'](_0x378737));if(_0x378737[_0x7c7c('0x14')]){if(_0x378737[_0x7c7c('0x14')]['code']===0x1f4){logger['error'](_0x7c7c('0x12'),_0x4459ba,_0x378737[_0x7c7c('0x14')][_0x7c7c('0x15')]);return _0x242fda(_0x378737[_0x7c7c('0x14')][_0x7c7c('0x15')]);}logger[_0x7c7c('0x14')](_0x7c7c('0x12'),_0x4459ba,_0x378737[_0x7c7c('0x14')][_0x7c7c('0x15')]);return _0x688f73(_0x378737['error'][_0x7c7c('0x15')]);}else{logger[_0x7c7c('0x11')](_0x7c7c('0x12'),_0x4459ba,_0x7c7c('0x13'));_0x688f73(_0x378737['result'][_0x7c7c('0x15')]);}})[_0x7c7c('0x16')](function(_0x5c9c73){logger['error'](_0x7c7c('0x12'),_0x4459ba,_0x5c9c73);_0x242fda(_0x5c9c73);});});}exports[_0x7c7c('0x17')]=function(_0x3eb5ba){var _0x3aaa00=this;return new Promise(function(_0x34806d,_0x7a8835){return db[_0x7c7c('0x18')]['findAll']({'raw':_0x3eb5ba[_0x7c7c('0x19')]?_0x3eb5ba['options'][_0x7c7c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3eb5ba[_0x7c7c('0x19')]?_0x3eb5ba[_0x7c7c('0x19')][_0x7c7c('0x1b')]||null:null,'attributes':_0x3eb5ba[_0x7c7c('0x19')]?_0x3eb5ba[_0x7c7c('0x19')][_0x7c7c('0x1c')]||null:null,'limit':_0x3eb5ba['options']?_0x3eb5ba[_0x7c7c('0x19')][_0x7c7c('0x1d')]||null:null,'include':_0x3eb5ba[_0x7c7c('0x19')]?_0x3eb5ba[_0x7c7c('0x19')]['include']?_['map'](_0x3eb5ba['options'][_0x7c7c('0x1e')],function(_0x24835a){return{'model':db[_0x24835a[_0x7c7c('0x1f')]],'as':_0x24835a['as'],'attributes':_0x24835a[_0x7c7c('0x1c')],'include':_0x24835a[_0x7c7c('0x1e')]?_[_0x7c7c('0x20')](_0x24835a['include'],function(_0x9c172){return{'model':db[_0x9c172[_0x7c7c('0x1f')]],'as':_0x9c172['as'],'attributes':_0x9c172[_0x7c7c('0x1c')],'include':_0x9c172[_0x7c7c('0x1e')]?_[_0x7c7c('0x20')](_0x9c172[_0x7c7c('0x1e')],function(_0x3dc715){return{'model':db[_0x3dc715[_0x7c7c('0x1f')]],'as':_0x3dc715['as'],'attributes':_0x3dc715['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c7c('0x10')](function(_0x23d85c){logger['info']('GetSmsQueue',_0x3eb5ba);logger[_0x7c7c('0x21')](_0x7c7c('0x17'),_0x3eb5ba,JSON[_0x7c7c('0x22')](_0x23d85c));_0x34806d(_0x23d85c);})[_0x7c7c('0x16')](function(_0x4e224e){logger['error']('GetSmsQueue',_0x4e224e[_0x7c7c('0x15')],_0x3eb5ba);_0x7a8835(_0x3aaa00[_0x7c7c('0x14')](0x1f4,_0x4e224e['message']));});});};exports[_0x7c7c('0x23')]=function(_0x36ddec){var _0x5a987c=this;return new Promise(function(_0x582fa1,_0xc6a6c9){return db[_0x7c7c('0x18')][_0x7c7c('0x24')]({'raw':_0x36ddec[_0x7c7c('0x19')]?_0x36ddec[_0x7c7c('0x19')][_0x7c7c('0x1a')]===undefined?!![]:![]:!![],'where':_0x36ddec[_0x7c7c('0x19')]?_0x36ddec[_0x7c7c('0x19')][_0x7c7c('0x1b')]||null:null,'attributes':_0x36ddec[_0x7c7c('0x19')]?_0x36ddec['options']['attributes']||null:null,'include':_0x36ddec[_0x7c7c('0x19')]?_0x36ddec[_0x7c7c('0x19')]['include']?_[_0x7c7c('0x20')](_0x36ddec[_0x7c7c('0x19')][_0x7c7c('0x1e')],function(_0x1f2b66){return{'model':db[_0x1f2b66['model']],'as':_0x1f2b66['as'],'attributes':_0x1f2b66[_0x7c7c('0x1c')],'include':_0x1f2b66[_0x7c7c('0x1e')]?_[_0x7c7c('0x20')](_0x1f2b66[_0x7c7c('0x1e')],function(_0x274b67){return{'model':db[_0x274b67['model']],'as':_0x274b67['as'],'attributes':_0x274b67[_0x7c7c('0x1c')],'include':_0x274b67['include']?_[_0x7c7c('0x20')](_0x274b67['include'],function(_0x3b45a6){return{'model':db[_0x3b45a6[_0x7c7c('0x1f')]],'as':_0x3b45a6['as'],'attributes':_0x3b45a6[_0x7c7c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7c7c('0x10')](function(_0x22fc9b){logger[_0x7c7c('0x11')](_0x7c7c('0x23'),_0x36ddec);logger[_0x7c7c('0x21')](_0x7c7c('0x23'),_0x36ddec,JSON[_0x7c7c('0x22')](_0x22fc9b));_0x582fa1(_0x22fc9b);})[_0x7c7c('0x16')](function(_0x5809a5){logger['error'](_0x7c7c('0x23'),_0x5809a5[_0x7c7c('0x15')],_0x36ddec);_0xc6a6c9(_0x5a987c[_0x7c7c('0x14')](0x1f4,_0x5809a5[_0x7c7c('0x15')]));});});}; \ No newline at end of file +var _0x0f48=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','findAll','options','raw','where','limit','map','include','model','attributes','GetSmsQueue','catch','ShowSmsQueue','SmsQueue'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x0f48,0x138));var _0x80f4=function(_0x1104f9,_0x91c85b){_0x1104f9=_0x1104f9-0x0;var _0x3c9587=_0x0f48[_0x1104f9];return _0x3c9587;};'use strict';var _=require('lodash');var util=require(_0x80f4('0x0'));var moment=require(_0x80f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x80f4('0x2'));var fs=require('fs');var Redis=require(_0x80f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80f4('0x4'));var logger=require(_0x80f4('0x5'))(_0x80f4('0x6'));var config=require(_0x80f4('0x7'));var jayson=require(_0x80f4('0x8'));var client=jayson[_0x80f4('0x9')]['http']({'port':0x232a});config[_0x80f4('0xa')]=_[_0x80f4('0xb')](config[_0x80f4('0xa')],{'host':_0x80f4('0xc'),'port':0x18eb});var socket=require(_0x80f4('0xd'))(new Redis(config[_0x80f4('0xa')]));require(_0x80f4('0xe'))['register'](socket);function respondWithRpcPromise(_0x4793f7,_0x258701,_0x584f13){return new BPromise(function(_0x3e57a2,_0x30bbe7){return client[_0x80f4('0xf')](_0x4793f7,_0x584f13)[_0x80f4('0x10')](function(_0x3809c0){logger[_0x80f4('0x11')](_0x80f4('0x12'),_0x258701,_0x80f4('0x13'));logger[_0x80f4('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x258701,_0x80f4('0x13'),JSON[_0x80f4('0x15')](_0x3809c0));if(_0x3809c0[_0x80f4('0x16')]){if(_0x3809c0[_0x80f4('0x16')][_0x80f4('0x17')]===0x1f4){logger[_0x80f4('0x16')]('SmsQueue,\x20%s,\x20%s',_0x258701,_0x3809c0[_0x80f4('0x16')]['message']);return _0x30bbe7(_0x3809c0[_0x80f4('0x16')]['message']);}logger[_0x80f4('0x16')](_0x80f4('0x12'),_0x258701,_0x3809c0[_0x80f4('0x16')][_0x80f4('0x18')]);return _0x3e57a2(_0x3809c0[_0x80f4('0x16')]['message']);}else{logger[_0x80f4('0x11')](_0x80f4('0x12'),_0x258701,_0x80f4('0x13'));_0x3e57a2(_0x3809c0[_0x80f4('0x19')][_0x80f4('0x18')]);}})['catch'](function(_0x205f54){logger[_0x80f4('0x16')](_0x80f4('0x12'),_0x258701,_0x205f54);_0x30bbe7(_0x205f54);});});}exports['GetSmsQueue']=function(_0x5ddeb5){var _0x400b4e=this;return new Promise(function(_0x450a81,_0x49b02d){return db['SmsQueue'][_0x80f4('0x1a')]({'raw':_0x5ddeb5[_0x80f4('0x1b')]?_0x5ddeb5[_0x80f4('0x1b')][_0x80f4('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ddeb5[_0x80f4('0x1b')]?_0x5ddeb5['options'][_0x80f4('0x1d')]||null:null,'attributes':_0x5ddeb5[_0x80f4('0x1b')]?_0x5ddeb5[_0x80f4('0x1b')]['attributes']||null:null,'limit':_0x5ddeb5[_0x80f4('0x1b')]?_0x5ddeb5[_0x80f4('0x1b')][_0x80f4('0x1e')]||null:null,'include':_0x5ddeb5[_0x80f4('0x1b')]?_0x5ddeb5['options']['include']?_[_0x80f4('0x1f')](_0x5ddeb5[_0x80f4('0x1b')][_0x80f4('0x20')],function(_0x20667e){return{'model':db[_0x20667e[_0x80f4('0x21')]],'as':_0x20667e['as'],'attributes':_0x20667e['attributes'],'include':_0x20667e[_0x80f4('0x20')]?_[_0x80f4('0x1f')](_0x20667e[_0x80f4('0x20')],function(_0x361288){return{'model':db[_0x361288[_0x80f4('0x21')]],'as':_0x361288['as'],'attributes':_0x361288[_0x80f4('0x22')],'include':_0x361288[_0x80f4('0x20')]?_[_0x80f4('0x1f')](_0x361288[_0x80f4('0x20')],function(_0x36ed4a){return{'model':db[_0x36ed4a['model']],'as':_0x36ed4a['as'],'attributes':_0x36ed4a[_0x80f4('0x22')]};}):[]};}):[]};}):[]:[]})[_0x80f4('0x10')](function(_0x1b58cc){logger['info'](_0x80f4('0x23'),_0x5ddeb5);logger[_0x80f4('0x14')](_0x80f4('0x23'),_0x5ddeb5,JSON[_0x80f4('0x15')](_0x1b58cc));_0x450a81(_0x1b58cc);})[_0x80f4('0x24')](function(_0x17c235){logger[_0x80f4('0x16')]('GetSmsQueue',_0x17c235['message'],_0x5ddeb5);_0x49b02d(_0x400b4e['error'](0x1f4,_0x17c235['message']));});});};exports[_0x80f4('0x25')]=function(_0x305659){var _0x364ce9=this;return new Promise(function(_0x5e94c5,_0x28371e){return db[_0x80f4('0x26')]['find']({'raw':_0x305659[_0x80f4('0x1b')]?_0x305659[_0x80f4('0x1b')][_0x80f4('0x1c')]===undefined?!![]:![]:!![],'where':_0x305659[_0x80f4('0x1b')]?_0x305659['options'][_0x80f4('0x1d')]||null:null,'attributes':_0x305659[_0x80f4('0x1b')]?_0x305659[_0x80f4('0x1b')]['attributes']||null:null,'include':_0x305659[_0x80f4('0x1b')]?_0x305659[_0x80f4('0x1b')][_0x80f4('0x20')]?_[_0x80f4('0x1f')](_0x305659['options'][_0x80f4('0x20')],function(_0x57a33f){return{'model':db[_0x57a33f[_0x80f4('0x21')]],'as':_0x57a33f['as'],'attributes':_0x57a33f[_0x80f4('0x22')],'include':_0x57a33f['include']?_[_0x80f4('0x1f')](_0x57a33f[_0x80f4('0x20')],function(_0x46be70){return{'model':db[_0x46be70['model']],'as':_0x46be70['as'],'attributes':_0x46be70[_0x80f4('0x22')],'include':_0x46be70['include']?_['map'](_0x46be70[_0x80f4('0x20')],function(_0x703f99){return{'model':db[_0x703f99[_0x80f4('0x21')]],'as':_0x703f99['as'],'attributes':_0x703f99[_0x80f4('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14cfed){logger[_0x80f4('0x11')]('ShowSmsQueue',_0x305659);logger[_0x80f4('0x14')]('ShowSmsQueue',_0x305659,JSON[_0x80f4('0x15')](_0x14cfed));_0x5e94c5(_0x14cfed);})[_0x80f4('0x24')](function(_0x52fb68){logger[_0x80f4('0x16')]('ShowSmsQueue',_0x52fb68[_0x80f4('0x18')],_0x305659);_0x28371e(_0x364ce9[_0x80f4('0x16')](0x1f4,_0x52fb68[_0x80f4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 90b9e6d..dc13a31 100644 --- a/server/api/smsQueue/smsQueue.socket.js +++ b/server/api/smsQueue/smsQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23c5=['register','smsQueue:','./smsQueue.events','save','update','emit','removeListener'];(function(_0x15718e,_0x2f5096){var _0xf3b1d2=function(_0x718af1){while(--_0x718af1){_0x15718e['push'](_0x15718e['shift']());}};_0xf3b1d2(++_0x2f5096);}(_0x23c5,0xcd));var _0x523c=function(_0x490080,_0x4b4cee){_0x490080=_0x490080-0x0;var _0x4ef12e=_0x23c5[_0x490080];return _0x4ef12e;};'use strict';var SmsQueueEvents=require(_0x523c('0x0'));var events=[_0x523c('0x1'),'remove',_0x523c('0x2')];function createListener(_0x261cf0,_0x5420fc){return function(_0x38277d){_0x5420fc[_0x523c('0x3')](_0x261cf0,_0x38277d);};}function removeListener(_0x7a9501,_0x555203){return function(){SmsQueueEvents[_0x523c('0x4')](_0x7a9501,_0x555203);};}exports[_0x523c('0x5')]=function(_0x1ef586){for(var _0x521259=0x0,_0x45a71a=events['length'];_0x521259<_0x45a71a;_0x521259++){var _0x40c57b=events[_0x521259];var _0x10a1b8=createListener(_0x523c('0x6')+_0x40c57b,_0x1ef586);SmsQueueEvents['on'](_0x40c57b,_0x10a1b8);}}; \ No newline at end of file +var _0x9157=['./smsQueue.events','remove','removeListener','length','smsQueue:'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x9157,0x1c7));var _0x7915=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x9157[_0x2cde0a];return _0x260610;};'use strict';var SmsQueueEvents=require(_0x7915('0x0'));var events=['save',_0x7915('0x1'),'update'];function createListener(_0x11c75a,_0xb9d684){return function(_0x31c0dd){_0xb9d684['emit'](_0x11c75a,_0x31c0dd);};}function removeListener(_0x48bf37,_0x14b4fa){return function(){SmsQueueEvents[_0x7915('0x2')](_0x48bf37,_0x14b4fa);};}exports['register']=function(_0x525c7f){for(var _0x67fe90=0x0,_0x4f7766=events[_0x7915('0x3')];_0x67fe90<_0x4f7766;_0x67fe90++){var _0xe0b3e8=events[_0x67fe90];var _0x320fa0=createListener(_0x7915('0x4')+_0xe0b3e8,_0x525c7f);SmsQueueEvents['on'](_0xe0b3e8,_0x320fa0);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 22813fb..c5a52fd 100644 --- a/server/api/smsQueueReport/index.js +++ b/server/api/smsQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1dc=['show','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/:id'];(function(_0x377cbc,_0x2202b9){var _0x58dc2d=function(_0x5e12c4){while(--_0x5e12c4){_0x377cbc['push'](_0x377cbc['shift']());}};_0x58dc2d(++_0x2202b9);}(_0xb1dc,0x133));var _0xcb1d=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xb1dc[_0x2f48cd];return _0x193ae2;};'use strict';var multer=require('multer');var util=require(_0xcb1d('0x0'));var path=require('path');var timeout=require(_0xcb1d('0x1'));var express=require(_0xcb1d('0x2'));var router=express[_0xcb1d('0x3')]();var fs_extra=require(_0xcb1d('0x4'));var auth=require(_0xcb1d('0x5'));var interaction=require(_0xcb1d('0x6'));var config=require(_0xcb1d('0x7'));var controller=require(_0xcb1d('0x8'));router[_0xcb1d('0x9')]('/',auth[_0xcb1d('0xa')](),controller[_0xcb1d('0xb')]);router[_0xcb1d('0x9')]('/describe',auth[_0xcb1d('0xa')](),controller['describe']);router[_0xcb1d('0x9')](_0xcb1d('0xc'),auth[_0xcb1d('0xa')](),controller[_0xcb1d('0xd')]);router[_0xcb1d('0xe')]('/',auth[_0xcb1d('0xa')](),controller[_0xcb1d('0xf')]);router[_0xcb1d('0x10')](_0xcb1d('0xc'),auth['isAuthenticated'](),controller[_0xcb1d('0x11')]);router[_0xcb1d('0x12')](_0xcb1d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcb1d('0x13')]=router; \ No newline at end of file +var _0x4f67=['../../config/environment','./smsQueueReport.controller','get','index','describe','/:id','isAuthenticated','show','put','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4f67,0x82));var _0x74f6=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x4f67[_0x1d9163];return _0xb42197;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x74f6('0x0'));var express=require(_0x74f6('0x1'));var router=express[_0x74f6('0x2')]();var fs_extra=require(_0x74f6('0x3'));var auth=require(_0x74f6('0x4'));var interaction=require(_0x74f6('0x5'));var config=require(_0x74f6('0x6'));var controller=require(_0x74f6('0x7'));router[_0x74f6('0x8')]('/',auth['isAuthenticated'](),controller[_0x74f6('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x74f6('0xa')]);router['get'](_0x74f6('0xb'),auth[_0x74f6('0xc')](),controller[_0x74f6('0xd')]);router['post']('/',auth[_0x74f6('0xc')](),controller['create']);router[_0x74f6('0xe')](_0x74f6('0xb'),auth[_0x74f6('0xc')](),controller['update']);router['delete']('/:id',auth[_0x74f6('0xc')](),controller[_0x74f6('0xf')]);module[_0x74f6('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 076db1c..a05462a 100644 --- a/server/api/smsQueueReport/smsQueueReport.attributes.js +++ b/server/api/smsQueueReport/smsQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cfc=['sequelize','exports','STRING','DATE'];(function(_0x1943d9,_0x245bb8){var _0x4b4f3f=function(_0x3bba90){while(--_0x3bba90){_0x1943d9['push'](_0x1943d9['shift']());}};_0x4b4f3f(++_0x245bb8);}(_0x7cfc,0x1a0));var _0xc7cf=function(_0x20e03f,_0x182c26){_0x20e03f=_0x20e03f-0x0;var _0x1e8ca1=_0x7cfc[_0x20e03f];return _0x1e8ca1;};'use strict';var moment=require('moment');var Sequelize=require(_0xc7cf('0x0'));module[_0xc7cf('0x1')]={'uniqueid':{'type':Sequelize[_0xc7cf('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc7cf('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc7cf('0x3')]},'reason':{'type':Sequelize[_0xc7cf('0x2')]}}; \ No newline at end of file +var _0xc44c=['sequelize','STRING','DATE','moment'];(function(_0x291f5a,_0x2215e5){var _0x3aef1c=function(_0x525339){while(--_0x525339){_0x291f5a['push'](_0x291f5a['shift']());}};_0x3aef1c(++_0x2215e5);}(_0xc44c,0x107));var _0xcc44=function(_0x55d014,_0x496e01){_0x55d014=_0x55d014-0x0;var _0x95230=_0xc44c[_0x55d014];return _0x95230;};'use strict';var moment=require(_0xcc44('0x0'));var Sequelize=require(_0xcc44('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcc44('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcc44('0x2')]},'joinAt':{'type':Sequelize[_0xcc44('0x3')]},'leaveAt':{'type':Sequelize[_0xcc44('0x3')]},'acceptAt':{'type':Sequelize[_0xcc44('0x3')]},'exitAt':{'type':Sequelize[_0xcc44('0x3')]},'reason':{'type':Sequelize[_0xcc44('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 62c84af..62eb132 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbb5=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','keys','create','body','update','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xfbb5,0x80));var _0x5fbb=function(_0x1079fb,_0x3053ce){_0x1079fb=_0x1079fb-0x0;var _0x82dec7=_0xfbb5[_0x1079fb];return _0x82dec7;};'use strict';var emlformat=require(_0x5fbb('0x0'));var rimraf=require(_0x5fbb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fbb('0x2'));var rp=require(_0x5fbb('0x3'));var moment=require('moment');var BPromise=require(_0x5fbb('0x4'));var Mustache=require(_0x5fbb('0x5'));var util=require(_0x5fbb('0x6'));var path=require(_0x5fbb('0x7'));var sox=require(_0x5fbb('0x8'));var csv=require(_0x5fbb('0x9'));var ejs=require(_0x5fbb('0xa'));var fs=require('fs');var fs_extra=require(_0x5fbb('0xb'));var _=require(_0x5fbb('0xc'));var squel=require(_0x5fbb('0xd'));var crypto=require(_0x5fbb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5fbb('0xf'));var toCsv=require(_0x5fbb('0x9'));var querystring=require(_0x5fbb('0x10'));var Papa=require('papaparse');var Redis=require(_0x5fbb('0x11'));var authService=require(_0x5fbb('0x12'));var qs=require(_0x5fbb('0x13'));var as=require(_0x5fbb('0x14'));var hardwareService=require(_0x5fbb('0x15'));var logger=require('../../config/logger')(_0x5fbb('0x16'));var utils=require(_0x5fbb('0x17'));var config=require(_0x5fbb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fbb('0x19'))['db'];function respondWithStatusCode(_0x888fd1,_0xe81b8a){_0xe81b8a=_0xe81b8a||0xcc;return function(_0x30ba9a){if(_0x30ba9a){return _0x888fd1[_0x5fbb('0x1a')](_0xe81b8a);}return _0x888fd1[_0x5fbb('0x1b')](_0xe81b8a)[_0x5fbb('0x1c')]();};}function respondWithResult(_0x5d946e,_0x29dfac){_0x29dfac=_0x29dfac||0xc8;return function(_0x31f4ec){if(_0x31f4ec){return _0x5d946e[_0x5fbb('0x1b')](_0x29dfac)[_0x5fbb('0x1d')](_0x31f4ec);}};}function respondWithFilteredResult(_0x778fcf,_0x54bf13){return function(_0x1e68c9){if(_0x1e68c9){var _0x2c6fea=typeof _0x54bf13[_0x5fbb('0x1e')]===_0x5fbb('0x1f')&&typeof _0x54bf13['limit']==='undefined';var _0x2bcb76=_0x1e68c9[_0x5fbb('0x20')];var _0x4e5361=_0x2c6fea?0x0:_0x54bf13[_0x5fbb('0x1e')];var _0x14ab03=_0x2c6fea?_0x1e68c9[_0x5fbb('0x20')]:_0x54bf13[_0x5fbb('0x1e')]+_0x54bf13['limit'];var _0x38f9d6;if(_0x14ab03>=_0x2bcb76){_0x14ab03=_0x2bcb76;_0x38f9d6=0xc8;}else{_0x38f9d6=0xce;}_0x778fcf[_0x5fbb('0x1b')](_0x38f9d6);return _0x778fcf['set'](_0x5fbb('0x21'),_0x4e5361+'-'+_0x14ab03+'/'+_0x2bcb76)[_0x5fbb('0x1d')](_0x1e68c9);}return null;};}function patchUpdates(_0x486494){return function(_0x1fb642){try{jsonpatch['apply'](_0x1fb642,_0x486494,!![]);}catch(_0x123fa5){return BPromise[_0x5fbb('0x22')](_0x123fa5);}return _0x1fb642[_0x5fbb('0x23')]();};}function saveUpdates(_0x3be300,_0x3c5b8a){return function(_0x245b4e){if(_0x245b4e){return _0x245b4e['update'](_0x3be300)[_0x5fbb('0x24')](function(_0x3da881){return _0x3da881;});}return null;};}function removeEntity(_0x3f0524,_0x1c857f){return function(_0x38c696){if(_0x38c696){return _0x38c696[_0x5fbb('0x25')]()['then'](function(){_0x3f0524['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d4dc,_0x163697){return function(_0x40e6d9){if(!_0x40e6d9){_0x23d4dc[_0x5fbb('0x1a')](0x194);}return _0x40e6d9;};}function handleError(_0x4e00fd,_0xac9516){_0xac9516=_0xac9516||0x1f4;return function(_0x426ae3){logger['error'](_0x426ae3[_0x5fbb('0x26')]);if(_0x426ae3[_0x5fbb('0x27')]){delete _0x426ae3[_0x5fbb('0x27')];}_0x4e00fd['status'](_0xac9516)['send'](_0x426ae3);};}exports[_0x5fbb('0x28')]=function(_0x51b9cc,_0x1600a7){var _0x654023={},_0x3881fc={},_0x430fb7={'count':0x0,'rows':[]};var _0x331207=_[_0x5fbb('0x29')](db[_0x5fbb('0x2a')][_0x5fbb('0x2b')],function(_0x4e7628){return{'name':_0x4e7628[_0x5fbb('0x2c')],'type':_0x4e7628[_0x5fbb('0x2d')][_0x5fbb('0x2e')]};});_0x3881fc[_0x5fbb('0x2f')]=_[_0x5fbb('0x29')](_0x331207,_0x5fbb('0x27'));_0x3881fc['query']=_['keys'](_0x51b9cc['query']);_0x3881fc[_0x5fbb('0x30')]=_[_0x5fbb('0x31')](_0x3881fc[_0x5fbb('0x2f')],_0x3881fc[_0x5fbb('0x32')]);_0x654023[_0x5fbb('0x33')]=_['intersection'](_0x3881fc[_0x5fbb('0x2f')],qs['fields'](_0x51b9cc[_0x5fbb('0x32')][_0x5fbb('0x34')]));_0x654023[_0x5fbb('0x33')]=_0x654023['attributes']['length']?_0x654023[_0x5fbb('0x33')]:_0x3881fc[_0x5fbb('0x2f')];if(!_0x51b9cc[_0x5fbb('0x32')]['hasOwnProperty'](_0x5fbb('0x35'))){_0x654023[_0x5fbb('0x36')]=qs[_0x5fbb('0x36')](_0x51b9cc[_0x5fbb('0x32')][_0x5fbb('0x36')]);_0x654023['offset']=qs['offset'](_0x51b9cc[_0x5fbb('0x32')][_0x5fbb('0x1e')]);}_0x654023[_0x5fbb('0x37')]=qs[_0x5fbb('0x38')](_0x51b9cc[_0x5fbb('0x32')][_0x5fbb('0x38')]);_0x654023['where']=qs[_0x5fbb('0x30')](_['pick'](_0x51b9cc[_0x5fbb('0x32')],_0x3881fc['filters']),_0x331207);if(_0x51b9cc[_0x5fbb('0x32')]['filter']){_0x654023[_0x5fbb('0x39')]=_[_0x5fbb('0x3a')](_0x654023[_0x5fbb('0x39')],{'$or':_[_0x5fbb('0x29')](_0x331207,function(_0x31ab6f){if(_0x31ab6f[_0x5fbb('0x2d')]!==_0x5fbb('0x3b')){var _0x47a801={};_0x47a801[_0x31ab6f[_0x5fbb('0x27')]]={'$like':'%'+_0x51b9cc[_0x5fbb('0x32')][_0x5fbb('0x3c')]+'%'};return _0x47a801;}})});}_0x654023=_['merge']({},_0x654023,_0x51b9cc[_0x5fbb('0x3d')]);var _0x1395ad={'where':_0x654023['where']};return db[_0x5fbb('0x2a')][_0x5fbb('0x20')](_0x1395ad)[_0x5fbb('0x24')](function(_0x5453a8){_0x430fb7[_0x5fbb('0x20')]=_0x5453a8;if(_0x51b9cc[_0x5fbb('0x32')][_0x5fbb('0x3e')]){_0x654023[_0x5fbb('0x3f')]=[{'all':!![]}];}return db[_0x5fbb('0x2a')]['findAll'](_0x654023);})[_0x5fbb('0x24')](function(_0x1f96c0){_0x430fb7['rows']=_0x1f96c0;return _0x430fb7;})[_0x5fbb('0x24')](respondWithFilteredResult(_0x1600a7,_0x654023))[_0x5fbb('0x40')](handleError(_0x1600a7,null));};exports[_0x5fbb('0x41')]=function(_0x3d1d45,_0x4fda6c){var _0x38a354={'raw':!![],'where':{'id':_0x3d1d45['params']['id']}},_0x14a10f={};_0x14a10f[_0x5fbb('0x2f')]=_[_0x5fbb('0x42')](db['SmsQueueReport']['rawAttributes']);_0x14a10f[_0x5fbb('0x32')]=_['keys'](_0x3d1d45[_0x5fbb('0x32')]);_0x14a10f['filters']=_[_0x5fbb('0x31')](_0x14a10f[_0x5fbb('0x2f')],_0x14a10f[_0x5fbb('0x32')]);_0x38a354[_0x5fbb('0x33')]=_[_0x5fbb('0x31')](_0x14a10f[_0x5fbb('0x2f')],qs[_0x5fbb('0x34')](_0x3d1d45[_0x5fbb('0x32')]['fields']));_0x38a354[_0x5fbb('0x33')]=_0x38a354[_0x5fbb('0x33')]['length']?_0x38a354['attributes']:_0x14a10f[_0x5fbb('0x2f')];if(_0x3d1d45[_0x5fbb('0x32')][_0x5fbb('0x3e')]){_0x38a354[_0x5fbb('0x3f')]=[{'all':!![]}];}_0x38a354=_['merge']({},_0x38a354,_0x3d1d45['options']);return db[_0x5fbb('0x2a')]['find'](_0x38a354)[_0x5fbb('0x24')](handleEntityNotFound(_0x4fda6c,null))[_0x5fbb('0x24')](respondWithResult(_0x4fda6c,null))[_0x5fbb('0x40')](handleError(_0x4fda6c,null));};exports[_0x5fbb('0x43')]=function(_0x546465,_0x469a87){return db[_0x5fbb('0x2a')]['create'](_0x546465[_0x5fbb('0x44')],{})[_0x5fbb('0x24')](respondWithResult(_0x469a87,0xc9))['catch'](handleError(_0x469a87,null));};exports[_0x5fbb('0x45')]=function(_0x5fba97,_0x3f23c8){if(_0x5fba97[_0x5fbb('0x44')]['id']){delete _0x5fba97[_0x5fbb('0x44')]['id'];}return db[_0x5fbb('0x2a')][_0x5fbb('0x46')]({'where':{'id':_0x5fba97[_0x5fbb('0x47')]['id']}})[_0x5fbb('0x24')](handleEntityNotFound(_0x3f23c8,null))[_0x5fbb('0x24')](saveUpdates(_0x5fba97[_0x5fbb('0x44')],null))[_0x5fbb('0x24')](respondWithResult(_0x3f23c8,null))[_0x5fbb('0x40')](handleError(_0x3f23c8,null));};exports[_0x5fbb('0x25')]=function(_0x2b07bb,_0xb2fb2){return db[_0x5fbb('0x2a')][_0x5fbb('0x46')]({'where':{'id':_0x2b07bb[_0x5fbb('0x47')]['id']}})[_0x5fbb('0x24')](handleEntityNotFound(_0xb2fb2,null))[_0x5fbb('0x24')](removeEntity(_0xb2fb2,null))[_0x5fbb('0x40')](handleError(_0xb2fb2,null));};exports[_0x5fbb('0x48')]=function(_0x35200f,_0x412ba3){return db[_0x5fbb('0x2a')]['describe']()[_0x5fbb('0x24')](respondWithResult(_0x412ba3,null))['catch'](handleError(_0x412ba3,null));}; \ No newline at end of file +var _0x0f44=['status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','query','keys','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','SmsQueueReport','findAll','rows','catch','show','params','fields','length','find','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4ca5a9,_0x116be3){var _0x24e3ae=function(_0x23b3fa){while(--_0x23b3fa){_0x4ca5a9['push'](_0x4ca5a9['shift']());}};_0x24e3ae(++_0x116be3);}(_0x0f44,0x7d));var _0x40f4=function(_0x2d2b3f,_0x486229){_0x2d2b3f=_0x2d2b3f-0x0;var _0x188068=_0x0f44[_0x2d2b3f];return _0x188068;};'use strict';var emlformat=require(_0x40f4('0x0'));var rimraf=require(_0x40f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40f4('0x2'));var moment=require(_0x40f4('0x3'));var BPromise=require(_0x40f4('0x4'));var Mustache=require(_0x40f4('0x5'));var util=require(_0x40f4('0x6'));var path=require(_0x40f4('0x7'));var sox=require(_0x40f4('0x8'));var csv=require('to-csv');var ejs=require(_0x40f4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x40f4('0xa'));var jsforce=require(_0x40f4('0xb'));var deskjs=require(_0x40f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x40f4('0xd'));var Papa=require(_0x40f4('0xe'));var Redis=require(_0x40f4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x40f4('0x10'));var as=require(_0x40f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40f4('0x12'))(_0x40f4('0x13'));var utils=require(_0x40f4('0x14'));var config=require(_0x40f4('0x15'));var licenseUtil=require(_0x40f4('0x16'));var db=require(_0x40f4('0x17'))['db'];function respondWithStatusCode(_0x24035d,_0x5e85c2){_0x5e85c2=_0x5e85c2||0xcc;return function(_0x1a6bb3){if(_0x1a6bb3){return _0x24035d[_0x40f4('0x18')](_0x5e85c2);}return _0x24035d[_0x40f4('0x19')](_0x5e85c2)[_0x40f4('0x1a')]();};}function respondWithResult(_0x805ba7,_0x5bd13a){_0x5bd13a=_0x5bd13a||0xc8;return function(_0x453546){if(_0x453546){return _0x805ba7['status'](_0x5bd13a)[_0x40f4('0x1b')](_0x453546);}};}function respondWithFilteredResult(_0x1d2b27,_0x37a46c){return function(_0x156438){if(_0x156438){var _0x6469f9=typeof _0x37a46c[_0x40f4('0x1c')]==='undefined'&&typeof _0x37a46c[_0x40f4('0x1d')]===_0x40f4('0x1e');var _0x95801c=_0x156438['count'];var _0x9ebc1c=_0x6469f9?0x0:_0x37a46c['offset'];var _0x353dbd=_0x6469f9?_0x156438[_0x40f4('0x1f')]:_0x37a46c[_0x40f4('0x1c')]+_0x37a46c[_0x40f4('0x1d')];var _0x36ce64;if(_0x353dbd>=_0x95801c){_0x353dbd=_0x95801c;_0x36ce64=0xc8;}else{_0x36ce64=0xce;}_0x1d2b27[_0x40f4('0x19')](_0x36ce64);return _0x1d2b27['set'](_0x40f4('0x20'),_0x9ebc1c+'-'+_0x353dbd+'/'+_0x95801c)[_0x40f4('0x1b')](_0x156438);}return null;};}function patchUpdates(_0x375d55){return function(_0x38e043){try{jsonpatch[_0x40f4('0x21')](_0x38e043,_0x375d55,!![]);}catch(_0x36f73f){return BPromise[_0x40f4('0x22')](_0x36f73f);}return _0x38e043[_0x40f4('0x23')]();};}function saveUpdates(_0x17e333,_0xa0e949){return function(_0x16ee76){if(_0x16ee76){return _0x16ee76[_0x40f4('0x24')](_0x17e333)[_0x40f4('0x25')](function(_0x58905e){return _0x58905e;});}return null;};}function removeEntity(_0xf7a2aa,_0xa6f4d){return function(_0x3f02ce){if(_0x3f02ce){return _0x3f02ce[_0x40f4('0x26')]()[_0x40f4('0x25')](function(){_0xf7a2aa[_0x40f4('0x19')](0xcc)[_0x40f4('0x1a')]();});}};}function handleEntityNotFound(_0x8e0a6e,_0x73f81){return function(_0x346287){if(!_0x346287){_0x8e0a6e['sendStatus'](0x194);}return _0x346287;};}function handleError(_0x10ab0d,_0x569fcf){_0x569fcf=_0x569fcf||0x1f4;return function(_0x51c786){logger[_0x40f4('0x27')](_0x51c786['stack']);if(_0x51c786[_0x40f4('0x28')]){delete _0x51c786[_0x40f4('0x28')];}_0x10ab0d['status'](_0x569fcf)[_0x40f4('0x29')](_0x51c786);};}exports[_0x40f4('0x2a')]=function(_0x757453,_0x1a7768){var _0x2cd115={},_0x30757d={},_0x5eebcf={'count':0x0,'rows':[]};var _0x7085c5=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x429d17){return{'name':_0x429d17[_0x40f4('0x2b')],'type':_0x429d17[_0x40f4('0x2c')][_0x40f4('0x2d')]};});_0x30757d[_0x40f4('0x2e')]=_[_0x40f4('0x2f')](_0x7085c5,_0x40f4('0x28'));_0x30757d[_0x40f4('0x30')]=_[_0x40f4('0x31')](_0x757453['query']);_0x30757d['filters']=_['intersection'](_0x30757d[_0x40f4('0x2e')],_0x30757d[_0x40f4('0x30')]);_0x2cd115[_0x40f4('0x32')]=_[_0x40f4('0x33')](_0x30757d[_0x40f4('0x2e')],qs['fields'](_0x757453[_0x40f4('0x30')]['fields']));_0x2cd115[_0x40f4('0x32')]=_0x2cd115[_0x40f4('0x32')]['length']?_0x2cd115[_0x40f4('0x32')]:_0x30757d[_0x40f4('0x2e')];if(!_0x757453[_0x40f4('0x30')][_0x40f4('0x34')](_0x40f4('0x35'))){_0x2cd115['limit']=qs[_0x40f4('0x1d')](_0x757453[_0x40f4('0x30')]['limit']);_0x2cd115[_0x40f4('0x1c')]=qs[_0x40f4('0x1c')](_0x757453[_0x40f4('0x30')][_0x40f4('0x1c')]);}_0x2cd115[_0x40f4('0x36')]=qs[_0x40f4('0x37')](_0x757453['query'][_0x40f4('0x37')]);_0x2cd115[_0x40f4('0x38')]=qs[_0x40f4('0x39')](_['pick'](_0x757453[_0x40f4('0x30')],_0x30757d[_0x40f4('0x39')]),_0x7085c5);if(_0x757453['query'][_0x40f4('0x3a')]){_0x2cd115[_0x40f4('0x38')]=_[_0x40f4('0x3b')](_0x2cd115[_0x40f4('0x38')],{'$or':_[_0x40f4('0x2f')](_0x7085c5,function(_0x49d9fa){if(_0x49d9fa['type']!==_0x40f4('0x3c')){var _0x11092f={};_0x11092f[_0x49d9fa[_0x40f4('0x28')]]={'$like':'%'+_0x757453[_0x40f4('0x30')][_0x40f4('0x3a')]+'%'};return _0x11092f;}})});}_0x2cd115=_[_0x40f4('0x3b')]({},_0x2cd115,_0x757453[_0x40f4('0x3d')]);var _0x518847={'where':_0x2cd115[_0x40f4('0x38')]};return db['SmsQueueReport'][_0x40f4('0x1f')](_0x518847)[_0x40f4('0x25')](function(_0x4be9f8){_0x5eebcf['count']=_0x4be9f8;if(_0x757453['query'][_0x40f4('0x3e')]){_0x2cd115[_0x40f4('0x3f')]=[{'all':!![]}];}return db[_0x40f4('0x40')][_0x40f4('0x41')](_0x2cd115);})['then'](function(_0xa11afc){_0x5eebcf[_0x40f4('0x42')]=_0xa11afc;return _0x5eebcf;})[_0x40f4('0x25')](respondWithFilteredResult(_0x1a7768,_0x2cd115))[_0x40f4('0x43')](handleError(_0x1a7768,null));};exports[_0x40f4('0x44')]=function(_0x2154b4,_0xf06a8){var _0x5ead9c={'raw':!![],'where':{'id':_0x2154b4[_0x40f4('0x45')]['id']}},_0x25842b={};_0x25842b['model']=_[_0x40f4('0x31')](db[_0x40f4('0x40')]['rawAttributes']);_0x25842b[_0x40f4('0x30')]=_[_0x40f4('0x31')](_0x2154b4[_0x40f4('0x30')]);_0x25842b['filters']=_[_0x40f4('0x33')](_0x25842b['model'],_0x25842b[_0x40f4('0x30')]);_0x5ead9c[_0x40f4('0x32')]=_[_0x40f4('0x33')](_0x25842b[_0x40f4('0x2e')],qs[_0x40f4('0x46')](_0x2154b4[_0x40f4('0x30')][_0x40f4('0x46')]));_0x5ead9c['attributes']=_0x5ead9c[_0x40f4('0x32')][_0x40f4('0x47')]?_0x5ead9c[_0x40f4('0x32')]:_0x25842b[_0x40f4('0x2e')];if(_0x2154b4[_0x40f4('0x30')]['includeAll']){_0x5ead9c[_0x40f4('0x3f')]=[{'all':!![]}];}_0x5ead9c=_[_0x40f4('0x3b')]({},_0x5ead9c,_0x2154b4[_0x40f4('0x3d')]);return db[_0x40f4('0x40')][_0x40f4('0x48')](_0x5ead9c)['then'](handleEntityNotFound(_0xf06a8,null))['then'](respondWithResult(_0xf06a8,null))[_0x40f4('0x43')](handleError(_0xf06a8,null));};exports['create']=function(_0x27e84c,_0x4cfe33){return db['SmsQueueReport']['create'](_0x27e84c[_0x40f4('0x49')],{})[_0x40f4('0x25')](respondWithResult(_0x4cfe33,0xc9))[_0x40f4('0x43')](handleError(_0x4cfe33,null));};exports[_0x40f4('0x24')]=function(_0x43dff5,_0x4599ff){if(_0x43dff5[_0x40f4('0x49')]['id']){delete _0x43dff5[_0x40f4('0x49')]['id'];}return db[_0x40f4('0x40')][_0x40f4('0x48')]({'where':{'id':_0x43dff5[_0x40f4('0x45')]['id']}})[_0x40f4('0x25')](handleEntityNotFound(_0x4599ff,null))['then'](saveUpdates(_0x43dff5[_0x40f4('0x49')],null))['then'](respondWithResult(_0x4599ff,null))[_0x40f4('0x43')](handleError(_0x4599ff,null));};exports[_0x40f4('0x26')]=function(_0x5d26f8,_0x361b76){return db[_0x40f4('0x40')]['find']({'where':{'id':_0x5d26f8[_0x40f4('0x45')]['id']}})['then'](handleEntityNotFound(_0x361b76,null))[_0x40f4('0x25')](removeEntity(_0x361b76,null))[_0x40f4('0x43')](handleError(_0x361b76,null));};exports[_0x40f4('0x4a')]=function(_0x2c93ff,_0x3a40bb){return db[_0x40f4('0x40')][_0x40f4('0x4a')]()[_0x40f4('0x25')](respondWithResult(_0x3a40bb,null))[_0x40f4('0x43')](handleError(_0x3a40bb,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0d3ed73..9fbc67a 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x14a602,_0x1ca786){var _0x267fe0=function(_0x3f3b6f){while(--_0x3f3b6f){_0x14a602['push'](_0x14a602['shift']());}};_0x267fe0(++_0x1ca786);}(_0x70e0,0x17b));var _0x070e=function(_0x5c32b3,_0xf05569){_0x5c32b3=_0x5c32b3-0x0;var _0x30c69a=_0x70e0[_0x5c32b3];return _0x30c69a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index b11224c..8b69821 100644 --- a/server/api/smsQueueReport/smsQueueReport.rpc.js +++ b/server/api/smsQueueReport/smsQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60e2=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','raw','UpdateSmsQueueReport','update','body','options','attributes','limit','stringify'];(function(_0x588706,_0x3fe85e){var _0x3e57ee=function(_0x35140f){while(--_0x35140f){_0x588706['push'](_0x588706['shift']());}};_0x3e57ee(++_0x3fe85e);}(_0x60e2,0x100));var _0x260e=function(_0x2e7b94,_0x1ac81f){_0x2e7b94=_0x2e7b94-0x0;var _0x11833b=_0x60e2[_0x2e7b94];return _0x11833b;};'use strict';var _=require('lodash');var util=require(_0x260e('0x0'));var moment=require(_0x260e('0x1'));var BPromise=require(_0x260e('0x2'));var rs=require(_0x260e('0x3'));var fs=require('fs');var Redis=require(_0x260e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x260e('0x5'))(_0x260e('0x6'));var config=require('../../config/environment');var jayson=require(_0x260e('0x7'));var client=jayson[_0x260e('0x8')][_0x260e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb7f140,_0x4e8d4e,_0x2e783a){return new BPromise(function(_0x1261f4,_0x3e7cf7){return client[_0x260e('0xa')](_0xb7f140,_0x2e783a)[_0x260e('0xb')](function(_0xf78b0f){logger[_0x260e('0xc')](_0x260e('0xd'),_0x4e8d4e,_0x260e('0xe'));logger[_0x260e('0xf')](_0x260e('0x10'),_0x4e8d4e,_0x260e('0xe'),JSON['stringify'](_0xf78b0f));if(_0xf78b0f['error']){if(_0xf78b0f[_0x260e('0x11')][_0x260e('0x12')]===0x1f4){logger[_0x260e('0x11')](_0x260e('0xd'),_0x4e8d4e,_0xf78b0f['error']['message']);return _0x3e7cf7(_0xf78b0f[_0x260e('0x11')][_0x260e('0x13')]);}logger[_0x260e('0x11')](_0x260e('0xd'),_0x4e8d4e,_0xf78b0f[_0x260e('0x11')]['message']);return _0x1261f4(_0xf78b0f['error'][_0x260e('0x13')]);}else{logger[_0x260e('0xc')](_0x260e('0xd'),_0x4e8d4e,_0x260e('0xe'));_0x1261f4(_0xf78b0f[_0x260e('0x14')][_0x260e('0x13')]);}})[_0x260e('0x15')](function(_0x305561){logger[_0x260e('0x11')](_0x260e('0xd'),_0x4e8d4e,_0x305561);_0x3e7cf7(_0x305561);});});}exports[_0x260e('0x16')]=function(_0x2dbf67){var _0x12c71d=this;return new Promise(function(_0x11d67f,_0x5db429){return db[_0x260e('0x17')]['create'](_0x2dbf67['body'],{'raw':_0x2dbf67['options']?_0x2dbf67['options'][_0x260e('0x18')]===undefined?!![]:![]:!![]})[_0x260e('0xb')](function(_0x1bb0da){logger[_0x260e('0xc')]('CreateSmsQueueReport',_0x2dbf67);logger['debug'](_0x260e('0x16'),_0x2dbf67,JSON['stringify'](_0x1bb0da));_0x11d67f(_0x1bb0da);})[_0x260e('0x15')](function(_0x3b0de6){logger[_0x260e('0x11')](_0x260e('0x16'),_0x3b0de6[_0x260e('0x13')],_0x2dbf67);_0x5db429(_0x12c71d['error'](0x1f4,_0x3b0de6[_0x260e('0x13')]));});});};exports[_0x260e('0x19')]=function(_0x57eae9){var _0x518ef7=this;return new Promise(function(_0x39e46f,_0x5d33a4){return db[_0x260e('0x17')][_0x260e('0x1a')](_0x57eae9[_0x260e('0x1b')],{'raw':_0x57eae9[_0x260e('0x1c')]?_0x57eae9[_0x260e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57eae9[_0x260e('0x1c')]?_0x57eae9[_0x260e('0x1c')]['where']||null:null,'attributes':_0x57eae9[_0x260e('0x1c')]?_0x57eae9[_0x260e('0x1c')][_0x260e('0x1d')]||null:null,'limit':_0x57eae9[_0x260e('0x1c')]?_0x57eae9[_0x260e('0x1c')][_0x260e('0x1e')]||null:null})[_0x260e('0xb')](function(_0x51dca0){logger[_0x260e('0xc')](_0x260e('0x19'),_0x57eae9);logger['debug'](_0x260e('0x19'),_0x57eae9,JSON[_0x260e('0x1f')](_0x51dca0));_0x39e46f(_0x51dca0);})['catch'](function(_0x147e91){logger[_0x260e('0x11')](_0x260e('0x19'),_0x147e91[_0x260e('0x13')],_0x57eae9);_0x5d33a4(_0x518ef7[_0x260e('0x11')](0x1f4,_0x147e91[_0x260e('0x13')]));});});}; \ No newline at end of file +var _0x5543=['jayson/promise','client','http','request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','debug','UpdateSmsQueueReport','attributes','limit','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x15718e,_0x2f5096){var _0xf3b1d2=function(_0x718af1){while(--_0x718af1){_0x15718e['push'](_0x15718e['shift']());}};_0xf3b1d2(++_0x2f5096);}(_0x5543,0xcd));var _0x3554=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x5543[_0x1ff575];return _0x48fc9e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3554('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3554('0x1'))['db'];var utils=require(_0x3554('0x2'));var logger=require('../../config/logger')(_0x3554('0x3'));var config=require(_0x3554('0x4'));var jayson=require(_0x3554('0x5'));var client=jayson[_0x3554('0x6')][_0x3554('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3662e,_0x519dd7,_0x186d17){return new BPromise(function(_0x1df2a3,_0x44565e){return client[_0x3554('0x8')](_0x3662e,_0x186d17)[_0x3554('0x9')](function(_0x141d1){logger[_0x3554('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x519dd7,_0x3554('0xb'));logger['debug'](_0x3554('0xc'),_0x519dd7,_0x3554('0xb'),JSON[_0x3554('0xd')](_0x141d1));if(_0x141d1[_0x3554('0xe')]){if(_0x141d1['error'][_0x3554('0xf')]===0x1f4){logger[_0x3554('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x519dd7,_0x141d1[_0x3554('0xe')][_0x3554('0x10')]);return _0x44565e(_0x141d1[_0x3554('0xe')][_0x3554('0x10')]);}logger['error'](_0x3554('0x11'),_0x519dd7,_0x141d1[_0x3554('0xe')][_0x3554('0x10')]);return _0x1df2a3(_0x141d1['error'][_0x3554('0x10')]);}else{logger[_0x3554('0xa')](_0x3554('0x11'),_0x519dd7,_0x3554('0xb'));_0x1df2a3(_0x141d1[_0x3554('0x12')]['message']);}})[_0x3554('0x13')](function(_0x444c54){logger[_0x3554('0xe')](_0x3554('0x11'),_0x519dd7,_0x444c54);_0x44565e(_0x444c54);});});}exports['CreateSmsQueueReport']=function(_0x11dccd){var _0x1d072d=this;return new Promise(function(_0x144738,_0x37f7fb){return db[_0x3554('0x14')][_0x3554('0x15')](_0x11dccd[_0x3554('0x16')],{'raw':_0x11dccd[_0x3554('0x17')]?_0x11dccd[_0x3554('0x17')][_0x3554('0x18')]===undefined?!![]:![]:!![]})[_0x3554('0x9')](function(_0x402099){logger[_0x3554('0xa')](_0x3554('0x19'),_0x11dccd);logger[_0x3554('0x1a')](_0x3554('0x19'),_0x11dccd,JSON[_0x3554('0xd')](_0x402099));_0x144738(_0x402099);})[_0x3554('0x13')](function(_0x4f8cc6){logger['error'](_0x3554('0x19'),_0x4f8cc6[_0x3554('0x10')],_0x11dccd);_0x37f7fb(_0x1d072d[_0x3554('0xe')](0x1f4,_0x4f8cc6['message']));});});};exports[_0x3554('0x1b')]=function(_0x5552de){var _0x68ad34=this;return new Promise(function(_0x5e73cd,_0x3d729c){return db[_0x3554('0x14')]['update'](_0x5552de['body'],{'raw':_0x5552de[_0x3554('0x17')]?_0x5552de[_0x3554('0x17')][_0x3554('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5552de[_0x3554('0x17')]?_0x5552de[_0x3554('0x17')]['where']||null:null,'attributes':_0x5552de[_0x3554('0x17')]?_0x5552de[_0x3554('0x17')][_0x3554('0x1c')]||null:null,'limit':_0x5552de[_0x3554('0x17')]?_0x5552de[_0x3554('0x17')][_0x3554('0x1d')]||null:null})[_0x3554('0x9')](function(_0x4fdbe5){logger['info'](_0x3554('0x1b'),_0x5552de);logger[_0x3554('0x1a')]('UpdateSmsQueueReport',_0x5552de,JSON[_0x3554('0xd')](_0x4fdbe5));_0x5e73cd(_0x4fdbe5);})['catch'](function(_0x4fe2de){logger[_0x3554('0xe')]('UpdateSmsQueueReport',_0x4fe2de[_0x3554('0x10')],_0x5552de);_0x3d729c(_0x68ad34[_0x3554('0xe')](0x1f4,_0x4fe2de['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 821f95b..93acd4a 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4873=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55bd16,_0x55a438){var _0x523452=function(_0x37afba){while(--_0x37afba){_0x55bd16['push'](_0x55bd16['shift']());}};_0x523452(++_0x55a438);}(_0x4873,0x1df));var _0x3487=function(_0x71fc71,_0x64b222){_0x71fc71=_0x71fc71-0x0;var _0x3d0ce2=_0x4873[_0x71fc71];return _0x3d0ce2;};'use strict';var multer=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var path=require(_0x3487('0x2'));var timeout=require('connect-timeout');var express=require(_0x3487('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3487('0x4'));var interaction=require(_0x3487('0x5'));var config=require(_0x3487('0x6'));var controller=require(_0x3487('0x7'));router[_0x3487('0x8')]('/',auth[_0x3487('0x9')](),controller[_0x3487('0xa')]);router[_0x3487('0x8')]('/describe',auth[_0x3487('0x9')](),controller[_0x3487('0xb')]);router[_0x3487('0x8')](_0x3487('0xc'),auth[_0x3487('0x9')](),controller['show']);router[_0x3487('0xd')]('/',auth['isAuthenticated'](),controller[_0x3487('0xe')]);router[_0x3487('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3487('0x10')]);router[_0x3487('0x11')]('/:id',auth[_0x3487('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf767=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','put','update','delete','destroy','exports','util','path'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf767,0x76));var _0x7f76=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0xf767[_0x49c68e];return _0x33032b;};'use strict';var multer=require('multer');var util=require(_0x7f76('0x0'));var path=require(_0x7f76('0x1'));var timeout=require(_0x7f76('0x2'));var express=require(_0x7f76('0x3'));var router=express[_0x7f76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f76('0x5'));var interaction=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var controller=require(_0x7f76('0x8'));router['get']('/',auth[_0x7f76('0x9')](),controller[_0x7f76('0xa')]);router[_0x7f76('0xb')](_0x7f76('0xc'),auth[_0x7f76('0x9')](),controller['describe']);router[_0x7f76('0xb')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0xe')]);router['post']('/',auth[_0x7f76('0x9')](),controller['create']);router[_0x7f76('0xf')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x10')]);router[_0x7f76('0x11')](_0x7f76('0xd'),auth['isAuthenticated'](),controller[_0x7f76('0x12')]);module[_0x7f76('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7915c89..4e96ae0 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2db0f5,_0x2c7d65){var _0x4e0314=function(_0x5cc942){while(--_0x5cc942){_0x2db0f5['push'](_0x2db0f5['shift']());}};_0x4e0314(++_0x2c7d65);}(_0x00bb,0x1d8));var _0xb00b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00bb[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1df66b,_0x146179){var _0x2967e0=function(_0x1ee2d8){while(--_0x1ee2d8){_0x1df66b['push'](_0x1df66b['shift']());}};_0x2967e0(++_0x146179);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x20714a,_0x7de591){_0x20714a=_0x20714a-0x0;var _0x15e877=_0xf3cd[_0x20714a];return _0x15e877;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c125720..f3c1611 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47d4=['save','update','then','error','stack','name','map','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','type','VIRTUAL','options','SmsTransferReport','includeAll','include','rows','show','params','rawAttributes','intersection','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x1e168e,_0x32c9f2){var _0xaf9b6f=function(_0x26d7f3){while(--_0x26d7f3){_0x1e168e['push'](_0x1e168e['shift']());}};_0xaf9b6f(++_0x32c9f2);}(_0x47d4,0x152));var _0x447d=function(_0x2343fd,_0x2d1ffd){_0x2343fd=_0x2343fd-0x0;var _0x5ec2a0=_0x47d4[_0x2343fd];return _0x5ec2a0;};'use strict';var emlformat=require(_0x447d('0x0'));var rimraf=require(_0x447d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x447d('0x2'));var rp=require('request-promise');var moment=require(_0x447d('0x3'));var BPromise=require(_0x447d('0x4'));var Mustache=require('mustache');var util=require(_0x447d('0x5'));var path=require(_0x447d('0x6'));var sox=require(_0x447d('0x7'));var csv=require(_0x447d('0x8'));var ejs=require(_0x447d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x447d('0xa'));var squel=require(_0x447d('0xb'));var crypto=require(_0x447d('0xc'));var jsforce=require(_0x447d('0xd'));var deskjs=require(_0x447d('0xe'));var toCsv=require(_0x447d('0x8'));var querystring=require(_0x447d('0xf'));var Papa=require(_0x447d('0x10'));var Redis=require(_0x447d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x447d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x447d('0x13'));var logger=require(_0x447d('0x14'))('api');var utils=require(_0x447d('0x15'));var config=require(_0x447d('0x16'));var licenseUtil=require(_0x447d('0x17'));var db=require(_0x447d('0x18'))['db'];function respondWithStatusCode(_0x50f0f7,_0x15d1e8){_0x15d1e8=_0x15d1e8||0xcc;return function(_0x3295c6){if(_0x3295c6){return _0x50f0f7[_0x447d('0x19')](_0x15d1e8);}return _0x50f0f7[_0x447d('0x1a')](_0x15d1e8)[_0x447d('0x1b')]();};}function respondWithResult(_0x1e20c8,_0x279ed1){_0x279ed1=_0x279ed1||0xc8;return function(_0x16f31a){if(_0x16f31a){return _0x1e20c8[_0x447d('0x1a')](_0x279ed1)[_0x447d('0x1c')](_0x16f31a);}};}function respondWithFilteredResult(_0x5d9c4b,_0x75cdde){return function(_0x303df3){if(_0x303df3){var _0x143b08=typeof _0x75cdde[_0x447d('0x1d')]==='undefined'&&typeof _0x75cdde[_0x447d('0x1e')]===_0x447d('0x1f');var _0x330852=_0x303df3['count'];var _0x42b8c9=_0x143b08?0x0:_0x75cdde[_0x447d('0x1d')];var _0x36a3f9=_0x143b08?_0x303df3[_0x447d('0x20')]:_0x75cdde[_0x447d('0x1d')]+_0x75cdde[_0x447d('0x1e')];var _0x470618;if(_0x36a3f9>=_0x330852){_0x36a3f9=_0x330852;_0x470618=0xc8;}else{_0x470618=0xce;}_0x5d9c4b[_0x447d('0x1a')](_0x470618);return _0x5d9c4b[_0x447d('0x21')](_0x447d('0x22'),_0x42b8c9+'-'+_0x36a3f9+'/'+_0x330852)[_0x447d('0x1c')](_0x303df3);}return null;};}function patchUpdates(_0x103836){return function(_0x499a68){try{jsonpatch[_0x447d('0x23')](_0x499a68,_0x103836,!![]);}catch(_0x424f33){return BPromise[_0x447d('0x24')](_0x424f33);}return _0x499a68[_0x447d('0x25')]();};}function saveUpdates(_0x2c58bc,_0x34b8b3){return function(_0x464fbe){if(_0x464fbe){return _0x464fbe[_0x447d('0x26')](_0x2c58bc)['then'](function(_0x4979ed){return _0x4979ed;});}return null;};}function removeEntity(_0x924f17,_0x3b9f6a){return function(_0x3495a1){if(_0x3495a1){return _0x3495a1['destroy']()[_0x447d('0x27')](function(){_0x924f17[_0x447d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1059,_0x423294){return function(_0x55d01c){if(!_0x55d01c){_0x5f1059[_0x447d('0x19')](0x194);}return _0x55d01c;};}function handleError(_0x16b100,_0x2b91de){_0x2b91de=_0x2b91de||0x1f4;return function(_0x7fb2e1){logger[_0x447d('0x28')](_0x7fb2e1[_0x447d('0x29')]);if(_0x7fb2e1[_0x447d('0x2a')]){delete _0x7fb2e1['name'];}_0x16b100[_0x447d('0x1a')](_0x2b91de)['send'](_0x7fb2e1);};}exports['index']=function(_0x22f423,_0x5a82ca){var _0x5028cb={},_0x4ee4a8={},_0x2de1fa={'count':0x0,'rows':[]};var _0x51d7a5=_[_0x447d('0x2b')](db['SmsTransferReport']['rawAttributes'],function(_0x414900){return{'name':_0x414900[_0x447d('0x2c')],'type':_0x414900['type'][_0x447d('0x2d')]};});_0x4ee4a8[_0x447d('0x2e')]=_[_0x447d('0x2b')](_0x51d7a5,_0x447d('0x2a'));_0x4ee4a8[_0x447d('0x2f')]=_[_0x447d('0x30')](_0x22f423['query']);_0x4ee4a8['filters']=_['intersection'](_0x4ee4a8[_0x447d('0x2e')],_0x4ee4a8[_0x447d('0x2f')]);_0x5028cb[_0x447d('0x31')]=_['intersection'](_0x4ee4a8['model'],qs[_0x447d('0x32')](_0x22f423[_0x447d('0x2f')][_0x447d('0x32')]));_0x5028cb[_0x447d('0x31')]=_0x5028cb[_0x447d('0x31')][_0x447d('0x33')]?_0x5028cb[_0x447d('0x31')]:_0x4ee4a8[_0x447d('0x2e')];if(!_0x22f423[_0x447d('0x2f')][_0x447d('0x34')]('nolimit')){_0x5028cb[_0x447d('0x1e')]=qs[_0x447d('0x1e')](_0x22f423[_0x447d('0x2f')][_0x447d('0x1e')]);_0x5028cb[_0x447d('0x1d')]=qs['offset'](_0x22f423['query'][_0x447d('0x1d')]);}_0x5028cb[_0x447d('0x35')]=qs['sort'](_0x22f423[_0x447d('0x2f')]['sort']);_0x5028cb[_0x447d('0x36')]=qs[_0x447d('0x37')](_[_0x447d('0x38')](_0x22f423[_0x447d('0x2f')],_0x4ee4a8[_0x447d('0x37')]),_0x51d7a5);if(_0x22f423[_0x447d('0x2f')][_0x447d('0x39')]){_0x5028cb[_0x447d('0x36')]=_[_0x447d('0x3a')](_0x5028cb['where'],{'$or':_[_0x447d('0x2b')](_0x51d7a5,function(_0x200d9c){if(_0x200d9c[_0x447d('0x3b')]!==_0x447d('0x3c')){var _0x575732={};_0x575732[_0x200d9c[_0x447d('0x2a')]]={'$like':'%'+_0x22f423[_0x447d('0x2f')][_0x447d('0x39')]+'%'};return _0x575732;}})});}_0x5028cb=_[_0x447d('0x3a')]({},_0x5028cb,_0x22f423[_0x447d('0x3d')]);var _0x3d9df1={'where':_0x5028cb[_0x447d('0x36')]};return db[_0x447d('0x3e')]['count'](_0x3d9df1)[_0x447d('0x27')](function(_0x16479e){_0x2de1fa['count']=_0x16479e;if(_0x22f423[_0x447d('0x2f')][_0x447d('0x3f')]){_0x5028cb[_0x447d('0x40')]=[{'all':!![]}];}return db[_0x447d('0x3e')]['findAll'](_0x5028cb);})[_0x447d('0x27')](function(_0x134800){_0x2de1fa[_0x447d('0x41')]=_0x134800;return _0x2de1fa;})[_0x447d('0x27')](respondWithFilteredResult(_0x5a82ca,_0x5028cb))['catch'](handleError(_0x5a82ca,null));};exports[_0x447d('0x42')]=function(_0x5f2e16,_0x1d1f1a){var _0x1bf91e={'raw':!![],'where':{'id':_0x5f2e16[_0x447d('0x43')]['id']}},_0x7efad9={};_0x7efad9[_0x447d('0x2e')]=_['keys'](db[_0x447d('0x3e')][_0x447d('0x44')]);_0x7efad9[_0x447d('0x2f')]=_['keys'](_0x5f2e16[_0x447d('0x2f')]);_0x7efad9[_0x447d('0x37')]=_[_0x447d('0x45')](_0x7efad9[_0x447d('0x2e')],_0x7efad9['query']);_0x1bf91e[_0x447d('0x31')]=_[_0x447d('0x45')](_0x7efad9[_0x447d('0x2e')],qs['fields'](_0x5f2e16[_0x447d('0x2f')][_0x447d('0x32')]));_0x1bf91e[_0x447d('0x31')]=_0x1bf91e[_0x447d('0x31')][_0x447d('0x33')]?_0x1bf91e[_0x447d('0x31')]:_0x7efad9[_0x447d('0x2e')];if(_0x5f2e16[_0x447d('0x2f')][_0x447d('0x3f')]){_0x1bf91e[_0x447d('0x40')]=[{'all':!![]}];}_0x1bf91e=_[_0x447d('0x3a')]({},_0x1bf91e,_0x5f2e16[_0x447d('0x3d')]);return db[_0x447d('0x3e')][_0x447d('0x46')](_0x1bf91e)[_0x447d('0x27')](handleEntityNotFound(_0x1d1f1a,null))['then'](respondWithResult(_0x1d1f1a,null))[_0x447d('0x47')](handleError(_0x1d1f1a,null));};exports[_0x447d('0x48')]=function(_0x1cedeb,_0x445702){return db[_0x447d('0x3e')][_0x447d('0x48')](_0x1cedeb['body'],{})[_0x447d('0x27')](respondWithResult(_0x445702,0xc9))[_0x447d('0x47')](handleError(_0x445702,null));};exports[_0x447d('0x26')]=function(_0x24e5dd,_0x4412d4){if(_0x24e5dd[_0x447d('0x49')]['id']){delete _0x24e5dd['body']['id'];}return db[_0x447d('0x3e')][_0x447d('0x46')]({'where':{'id':_0x24e5dd[_0x447d('0x43')]['id']}})['then'](handleEntityNotFound(_0x4412d4,null))[_0x447d('0x27')](saveUpdates(_0x24e5dd[_0x447d('0x49')],null))[_0x447d('0x27')](respondWithResult(_0x4412d4,null))[_0x447d('0x47')](handleError(_0x4412d4,null));};exports[_0x447d('0x4a')]=function(_0x4f4bca,_0x46431c){return db[_0x447d('0x3e')]['find']({'where':{'id':_0x4f4bca[_0x447d('0x43')]['id']}})[_0x447d('0x27')](handleEntityNotFound(_0x46431c,null))[_0x447d('0x27')](removeEntity(_0x46431c,null))[_0x447d('0x47')](handleError(_0x46431c,null));};exports['describe']=function(_0x202b8c,_0x400cf3){return db[_0x447d('0x3e')]['describe']()[_0x447d('0x27')](respondWithResult(_0x400cf3,null))[_0x447d('0x47')](handleError(_0x400cf3,null));}; \ No newline at end of file +var _0x1018=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','VIRTUAL','merge'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1018,0xd5));var _0x8101=function(_0xac1429,_0x286f08){_0xac1429=_0xac1429-0x0;var _0x4e185d=_0x1018[_0xac1429];return _0x4e185d;};'use strict';var emlformat=require(_0x8101('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8101('0x1'));var jsonpatch=require(_0x8101('0x2'));var rp=require(_0x8101('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8101('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8101('0x5'));var csv=require(_0x8101('0x6'));var ejs=require(_0x8101('0x7'));var fs=require('fs');var fs_extra=require(_0x8101('0x8'));var _=require('lodash');var squel=require(_0x8101('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8101('0xa'));var toCsv=require(_0x8101('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8101('0xb'));var authService=require(_0x8101('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8101('0xd'));var logger=require(_0x8101('0xe'))(_0x8101('0xf'));var utils=require('../../config/utils');var config=require(_0x8101('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x8101('0x11'))['db'];function respondWithStatusCode(_0x4ec34a,_0x3f224b){_0x3f224b=_0x3f224b||0xcc;return function(_0x4344f2){if(_0x4344f2){return _0x4ec34a[_0x8101('0x12')](_0x3f224b);}return _0x4ec34a[_0x8101('0x13')](_0x3f224b)[_0x8101('0x14')]();};}function respondWithResult(_0x17c6d7,_0x752c3a){_0x752c3a=_0x752c3a||0xc8;return function(_0xbc8b38){if(_0xbc8b38){return _0x17c6d7[_0x8101('0x13')](_0x752c3a)[_0x8101('0x15')](_0xbc8b38);}};}function respondWithFilteredResult(_0x5952e7,_0x1fa5d7){return function(_0x54cf50){if(_0x54cf50){var _0x3ce3d6=typeof _0x1fa5d7[_0x8101('0x16')]===_0x8101('0x17')&&typeof _0x1fa5d7['limit']==='undefined';var _0x5ab092=_0x54cf50[_0x8101('0x18')];var _0x5d8e0d=_0x3ce3d6?0x0:_0x1fa5d7[_0x8101('0x16')];var _0x421ba3=_0x3ce3d6?_0x54cf50[_0x8101('0x18')]:_0x1fa5d7[_0x8101('0x16')]+_0x1fa5d7['limit'];var _0x2dde19;if(_0x421ba3>=_0x5ab092){_0x421ba3=_0x5ab092;_0x2dde19=0xc8;}else{_0x2dde19=0xce;}_0x5952e7[_0x8101('0x13')](_0x2dde19);return _0x5952e7['set'](_0x8101('0x19'),_0x5d8e0d+'-'+_0x421ba3+'/'+_0x5ab092)['json'](_0x54cf50);}return null;};}function patchUpdates(_0x5cffb5){return function(_0x358acb){try{jsonpatch[_0x8101('0x1a')](_0x358acb,_0x5cffb5,!![]);}catch(_0x4c086c){return BPromise[_0x8101('0x1b')](_0x4c086c);}return _0x358acb[_0x8101('0x1c')]();};}function saveUpdates(_0x187e24,_0x3596b1){return function(_0x1e8c49){if(_0x1e8c49){return _0x1e8c49[_0x8101('0x1d')](_0x187e24)[_0x8101('0x1e')](function(_0x582373){return _0x582373;});}return null;};}function removeEntity(_0x3fdebf,_0x56a0e2){return function(_0x7205fe){if(_0x7205fe){return _0x7205fe[_0x8101('0x1f')]()[_0x8101('0x1e')](function(){_0x3fdebf[_0x8101('0x13')](0xcc)[_0x8101('0x14')]();});}};}function handleEntityNotFound(_0x6995eb,_0x3ac7b1){return function(_0x365c8a){if(!_0x365c8a){_0x6995eb[_0x8101('0x12')](0x194);}return _0x365c8a;};}function handleError(_0x52dbe2,_0x212b78){_0x212b78=_0x212b78||0x1f4;return function(_0x1c3eb2){logger['error'](_0x1c3eb2[_0x8101('0x20')]);if(_0x1c3eb2[_0x8101('0x21')]){delete _0x1c3eb2[_0x8101('0x21')];}_0x52dbe2['status'](_0x212b78)[_0x8101('0x22')](_0x1c3eb2);};}exports[_0x8101('0x23')]=function(_0x42c8a1,_0x566aec){var _0x9b9e8e={},_0x5c39f6={},_0x287d58={'count':0x0,'rows':[]};var _0x3bf03d=_[_0x8101('0x24')](db[_0x8101('0x25')][_0x8101('0x26')],function(_0xa3222d){return{'name':_0xa3222d['fieldName'],'type':_0xa3222d[_0x8101('0x27')][_0x8101('0x28')]};});_0x5c39f6[_0x8101('0x29')]=_[_0x8101('0x24')](_0x3bf03d,_0x8101('0x21'));_0x5c39f6[_0x8101('0x2a')]=_[_0x8101('0x2b')](_0x42c8a1[_0x8101('0x2a')]);_0x5c39f6[_0x8101('0x2c')]=_[_0x8101('0x2d')](_0x5c39f6['model'],_0x5c39f6[_0x8101('0x2a')]);_0x9b9e8e[_0x8101('0x2e')]=_[_0x8101('0x2d')](_0x5c39f6[_0x8101('0x29')],qs[_0x8101('0x2f')](_0x42c8a1[_0x8101('0x2a')][_0x8101('0x2f')]));_0x9b9e8e[_0x8101('0x2e')]=_0x9b9e8e[_0x8101('0x2e')]['length']?_0x9b9e8e['attributes']:_0x5c39f6['model'];if(!_0x42c8a1[_0x8101('0x2a')][_0x8101('0x30')]('nolimit')){_0x9b9e8e[_0x8101('0x31')]=qs[_0x8101('0x31')](_0x42c8a1[_0x8101('0x2a')][_0x8101('0x31')]);_0x9b9e8e[_0x8101('0x16')]=qs[_0x8101('0x16')](_0x42c8a1['query']['offset']);}_0x9b9e8e['order']=qs[_0x8101('0x32')](_0x42c8a1[_0x8101('0x2a')]['sort']);_0x9b9e8e['where']=qs[_0x8101('0x2c')](_['pick'](_0x42c8a1['query'],_0x5c39f6[_0x8101('0x2c')]),_0x3bf03d);if(_0x42c8a1[_0x8101('0x2a')][_0x8101('0x33')]){_0x9b9e8e[_0x8101('0x34')]=_['merge'](_0x9b9e8e['where'],{'$or':_['map'](_0x3bf03d,function(_0x19709e){if(_0x19709e[_0x8101('0x27')]!==_0x8101('0x35')){var _0x16805d={};_0x16805d[_0x19709e[_0x8101('0x21')]]={'$like':'%'+_0x42c8a1[_0x8101('0x2a')][_0x8101('0x33')]+'%'};return _0x16805d;}})});}_0x9b9e8e=_[_0x8101('0x36')]({},_0x9b9e8e,_0x42c8a1[_0x8101('0x37')]);var _0x33077f={'where':_0x9b9e8e[_0x8101('0x34')]};return db['SmsTransferReport'][_0x8101('0x18')](_0x33077f)[_0x8101('0x1e')](function(_0x4043c2){_0x287d58['count']=_0x4043c2;if(_0x42c8a1[_0x8101('0x2a')][_0x8101('0x38')]){_0x9b9e8e[_0x8101('0x39')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x8101('0x3a')](_0x9b9e8e);})[_0x8101('0x1e')](function(_0x1ed78a){_0x287d58[_0x8101('0x3b')]=_0x1ed78a;return _0x287d58;})[_0x8101('0x1e')](respondWithFilteredResult(_0x566aec,_0x9b9e8e))[_0x8101('0x3c')](handleError(_0x566aec,null));};exports[_0x8101('0x3d')]=function(_0x49e7aa,_0x43ab63){var _0x2da252={'raw':!![],'where':{'id':_0x49e7aa[_0x8101('0x3e')]['id']}},_0x3249b3={};_0x3249b3['model']=_[_0x8101('0x2b')](db[_0x8101('0x25')][_0x8101('0x26')]);_0x3249b3[_0x8101('0x2a')]=_[_0x8101('0x2b')](_0x49e7aa[_0x8101('0x2a')]);_0x3249b3[_0x8101('0x2c')]=_['intersection'](_0x3249b3[_0x8101('0x29')],_0x3249b3[_0x8101('0x2a')]);_0x2da252[_0x8101('0x2e')]=_[_0x8101('0x2d')](_0x3249b3['model'],qs['fields'](_0x49e7aa[_0x8101('0x2a')]['fields']));_0x2da252['attributes']=_0x2da252[_0x8101('0x2e')]['length']?_0x2da252[_0x8101('0x2e')]:_0x3249b3[_0x8101('0x29')];if(_0x49e7aa[_0x8101('0x2a')][_0x8101('0x38')]){_0x2da252[_0x8101('0x39')]=[{'all':!![]}];}_0x2da252=_[_0x8101('0x36')]({},_0x2da252,_0x49e7aa[_0x8101('0x37')]);return db[_0x8101('0x25')][_0x8101('0x3f')](_0x2da252)[_0x8101('0x1e')](handleEntityNotFound(_0x43ab63,null))['then'](respondWithResult(_0x43ab63,null))[_0x8101('0x3c')](handleError(_0x43ab63,null));};exports['create']=function(_0x2a3076,_0x2a93b8){return db[_0x8101('0x25')][_0x8101('0x40')](_0x2a3076[_0x8101('0x41')],{})[_0x8101('0x1e')](respondWithResult(_0x2a93b8,0xc9))[_0x8101('0x3c')](handleError(_0x2a93b8,null));};exports[_0x8101('0x1d')]=function(_0x5725ec,_0x2ab285){if(_0x5725ec['body']['id']){delete _0x5725ec[_0x8101('0x41')]['id'];}return db[_0x8101('0x25')][_0x8101('0x3f')]({'where':{'id':_0x5725ec['params']['id']}})[_0x8101('0x1e')](handleEntityNotFound(_0x2ab285,null))[_0x8101('0x1e')](saveUpdates(_0x5725ec[_0x8101('0x41')],null))[_0x8101('0x1e')](respondWithResult(_0x2ab285,null))[_0x8101('0x3c')](handleError(_0x2ab285,null));};exports['destroy']=function(_0xf4a3e6,_0x3f8e5e){return db[_0x8101('0x25')][_0x8101('0x3f')]({'where':{'id':_0xf4a3e6['params']['id']}})[_0x8101('0x1e')](handleEntityNotFound(_0x3f8e5e,null))[_0x8101('0x1e')](removeEntity(_0x3f8e5e,null))[_0x8101('0x3c')](handleError(_0x3f8e5e,null));};exports[_0x8101('0x42')]=function(_0x5c6213,_0x777c28){return db[_0x8101('0x25')][_0x8101('0x42')]()[_0x8101('0x1e')](respondWithResult(_0x777c28,null))[_0x8101('0x3c')](handleError(_0x777c28,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 98c0aef..da72c28 100644 --- a/server/api/smsTransferReport/smsTransferReport.model.js +++ b/server/api/smsTransferReport/smsTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x453e=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x18bd96,_0x503e7d){var _0x396780=function(_0x3a78db){while(--_0x3a78db){_0x18bd96['push'](_0x18bd96['shift']());}};_0x396780(++_0x503e7d);}(_0x453e,0xdd));var _0xe453=function(_0xe406bc,_0x45e9af){_0xe406bc=_0xe406bc-0x0;var _0x56cbd4=_0x453e[_0xe406bc];return _0x56cbd4;};'use strict';var _=require(_0xe453('0x0'));var util=require('util');var logger=require(_0xe453('0x1'))(_0xe453('0x2'));var moment=require(_0xe453('0x3'));var BPromise=require('bluebird');var rp=require(_0xe453('0x4'));var fs=require('fs');var path=require(_0xe453('0x5'));var rimraf=require(_0xe453('0x6'));var config=require(_0xe453('0x7'));var attributes=require(_0xe453('0x8'));module[_0xe453('0x9')]=function(_0x4bce74,_0x23f399){return _0x4bce74['define'](_0xe453('0xa'),attributes,{'tableName':_0xe453('0xb'),'paranoid':![],'indexes':[{'name':_0xe453('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x996b=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash'];(function(_0x521f52,_0x1df6cc){var _0x48f2f3=function(_0x1e71be){while(--_0x1e71be){_0x521f52['push'](_0x521f52['shift']());}};_0x48f2f3(++_0x1df6cc);}(_0x996b,0x9b));var _0xb996=function(_0x254d9a,_0x57a418){_0x254d9a=_0x254d9a-0x0;var _0x152183=_0x996b[_0x254d9a];return _0x152183;};'use strict';var _=require(_0xb996('0x0'));var util=require(_0xb996('0x1'));var logger=require(_0xb996('0x2'))(_0xb996('0x3'));var moment=require(_0xb996('0x4'));var BPromise=require(_0xb996('0x5'));var rp=require(_0xb996('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb996('0x7'));var attributes=require(_0xb996('0x8'));module[_0xb996('0x9')]=function(_0x26fc01,_0x4552da){return _0x26fc01[_0xb996('0xa')](_0xb996('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xb996('0xc'),'fields':[_0xb996('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3989fd1..9679920 100644 --- a/server/api/smsTransferReport/smsTransferReport.rpc.js +++ b/server/api/smsTransferReport/smsTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8819=['request\x20sent','debug','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SmsTransferReport,\x20%s,\x20%s'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0x8819,0x94));var _0x9881=function(_0x985b87,_0x7f7c07){_0x985b87=_0x985b87-0x0;var _0x47499e=_0x8819[_0x985b87];return _0x47499e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9881('0x0'));var BPromise=require(_0x9881('0x1'));var rs=require(_0x9881('0x2'));var fs=require('fs');var Redis=require(_0x9881('0x3'));var db=require(_0x9881('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9881('0x5'))(_0x9881('0x6'));var config=require(_0x9881('0x7'));var jayson=require(_0x9881('0x8'));var client=jayson[_0x9881('0x9')][_0x9881('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f1d45,_0x353966,_0x4a6471){return new BPromise(function(_0x530547,_0x15c0f8){return client['request'](_0x5f1d45,_0x4a6471)['then'](function(_0x4034f5){logger['info'](_0x9881('0xb'),_0x353966,_0x9881('0xc'));logger[_0x9881('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x353966,_0x9881('0xc'),JSON[_0x9881('0xe')](_0x4034f5));if(_0x4034f5[_0x9881('0xf')]){if(_0x4034f5[_0x9881('0xf')]['code']===0x1f4){logger[_0x9881('0xf')](_0x9881('0xb'),_0x353966,_0x4034f5['error'][_0x9881('0x10')]);return _0x15c0f8(_0x4034f5['error']['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x353966,_0x4034f5[_0x9881('0xf')][_0x9881('0x10')]);return _0x530547(_0x4034f5[_0x9881('0xf')][_0x9881('0x10')]);}else{logger[_0x9881('0x11')](_0x9881('0xb'),_0x353966,'request\x20sent');_0x530547(_0x4034f5[_0x9881('0x12')][_0x9881('0x10')]);}})[_0x9881('0x13')](function(_0x47975d){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x353966,_0x47975d);_0x15c0f8(_0x47975d);});});} \ No newline at end of file +var _0x5c1f=['code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4f3f0f,_0x4bc3a3){var _0x1dda5d=function(_0xf3a346){while(--_0xf3a346){_0x4f3f0f['push'](_0x4f3f0f['shift']());}};_0x1dda5d(++_0x4bc3a3);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x5c1f[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var moment=require(_0xf5c1('0x1'));var BPromise=require(_0xf5c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5c1('0x3'));var db=require(_0xf5c1('0x4'))['db'];var utils=require(_0xf5c1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf5c1('0x6'));var client=jayson[_0xf5c1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a073,_0x21bb02,_0x12128b){return new BPromise(function(_0x40cad7,_0x5e3ef8){return client['request'](_0x34a073,_0x12128b)['then'](function(_0x4bd3a9){logger[_0xf5c1('0x8')](_0xf5c1('0x9'),_0x21bb02,_0xf5c1('0xa'));logger[_0xf5c1('0xb')](_0xf5c1('0xc'),_0x21bb02,_0xf5c1('0xa'),JSON[_0xf5c1('0xd')](_0x4bd3a9));if(_0x4bd3a9[_0xf5c1('0xe')]){if(_0x4bd3a9['error'][_0xf5c1('0xf')]===0x1f4){logger[_0xf5c1('0xe')](_0xf5c1('0x9'),_0x21bb02,_0x4bd3a9[_0xf5c1('0xe')][_0xf5c1('0x10')]);return _0x5e3ef8(_0x4bd3a9['error'][_0xf5c1('0x10')]);}logger['error'](_0xf5c1('0x9'),_0x21bb02,_0x4bd3a9[_0xf5c1('0xe')][_0xf5c1('0x10')]);return _0x40cad7(_0x4bd3a9['error'][_0xf5c1('0x10')]);}else{logger[_0xf5c1('0x8')](_0xf5c1('0x9'),_0x21bb02,_0xf5c1('0xa'));_0x40cad7(_0x4bd3a9['result'][_0xf5c1('0x10')]);}})[_0xf5c1('0x11')](function(_0x312d6b){logger[_0xf5c1('0xe')](_0xf5c1('0x9'),_0x21bb02,_0x312d6b);_0x5e3ef8(_0x312d6b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 693a8ba..e9f3e4a 100644 --- a/server/api/sound/index.js +++ b/server/api/sound/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe81=['file','put','/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','join','root','originalname','format','%s-%s%s','basename','extname','post','single'];(function(_0x3ae89c,_0x4bc1d3){var _0x54df34=function(_0x196622){while(--_0x196622){_0x3ae89c['push'](_0x3ae89c['shift']());}};_0x54df34(++_0x4bc1d3);}(_0xfe81,0x172));var _0x1fe8=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xfe81[_0x3e25c1];return _0x52e7f2;};'use strict';var multer=require(_0x1fe8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1fe8('0x1'));var express=require(_0x1fe8('0x2'));var router=express[_0x1fe8('0x3')]();var fs_extra=require(_0x1fe8('0x4'));var auth=require(_0x1fe8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1fe8('0x6'));router[_0x1fe8('0x7')]('/',auth[_0x1fe8('0x8')](),controller[_0x1fe8('0x9')]);router[_0x1fe8('0x7')]('/:id',auth[_0x1fe8('0x8')](),controller[_0x1fe8('0xa')]);router[_0x1fe8('0x7')](_0x1fe8('0xb'),auth[_0x1fe8('0x8')](),controller[_0x1fe8('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbd387,_0x3b970b,_0x6d9af1){_0x6d9af1(null,path[_0x1fe8('0xd')](config[_0x1fe8('0xe')],'server/files/sounds/original/'));},'filename':function(_0x15a2d7,_0x51b8fd,_0x1bb5af){_0x51b8fd[_0x1fe8('0xf')]=_0x51b8fd['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1bb5af(null,util[_0x1fe8('0x10')](_0x1fe8('0x11'),path[_0x1fe8('0x12')](_0x51b8fd['originalname'],path[_0x1fe8('0x13')](_0x51b8fd[_0x1fe8('0xf')])),Date['now'](),path[_0x1fe8('0x13')](_0x51b8fd[_0x1fe8('0xf')])));}})});router[_0x1fe8('0x14')]('/',upload[_0x1fe8('0x15')](_0x1fe8('0x16')),controller['create']);router[_0x1fe8('0x17')](_0x1fe8('0x18'),auth[_0x1fe8('0x8')](),controller[_0x1fe8('0x19')]);router[_0x1fe8('0x1a')](_0x1fe8('0x18'),auth[_0x1fe8('0x8')](),controller['delete']);module[_0x1fe8('0x1b')]=router; \ No newline at end of file +var _0x4df9=['../../config/environment','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','replace','format','%s-%s%s','originalname','extname','single','file','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0xd1ce83,_0x4199ec){var _0x51aabb=function(_0xa05538){while(--_0xa05538){_0xd1ce83['push'](_0xd1ce83['shift']());}};_0x51aabb(++_0x4199ec);}(_0x4df9,0x1da));var _0x94df=function(_0x37bfc7,_0x332660){_0x37bfc7=_0x37bfc7-0x0;var _0xf0a288=_0x4df9[_0x37bfc7];return _0xf0a288;};'use strict';var multer=require(_0x94df('0x0'));var util=require(_0x94df('0x1'));var path=require(_0x94df('0x2'));var timeout=require(_0x94df('0x3'));var express=require('express');var router=express[_0x94df('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x94df('0x5'));var config=require(_0x94df('0x6'));var controller=require(_0x94df('0x7'));router[_0x94df('0x8')]('/',auth[_0x94df('0x9')](),controller[_0x94df('0xa')]);router[_0x94df('0x8')]('/:id',auth[_0x94df('0x9')](),controller[_0x94df('0xb')]);router[_0x94df('0x8')](_0x94df('0xc'),auth[_0x94df('0x9')](),controller[_0x94df('0xd')]);var upload=multer({'storage':multer[_0x94df('0xe')]({'destination':function(_0x1927ba,_0x2f3ad4,_0xae81ce){_0xae81ce(null,path[_0x94df('0xf')](config['root'],_0x94df('0x10')));},'filename':function(_0x322205,_0x3859a2,_0x47f8a0){_0x3859a2['originalname']=_0x3859a2['originalname'][_0x94df('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47f8a0(null,util[_0x94df('0x12')](_0x94df('0x13'),path['basename'](_0x3859a2[_0x94df('0x14')],path[_0x94df('0x15')](_0x3859a2[_0x94df('0x14')])),Date['now'](),path[_0x94df('0x15')](_0x3859a2[_0x94df('0x14')])));}})});router['post']('/',upload[_0x94df('0x16')](_0x94df('0x17')),controller[_0x94df('0x18')]);router[_0x94df('0x19')](_0x94df('0x1a'),auth[_0x94df('0x9')](),controller[_0x94df('0x1b')]);router[_0x94df('0x1c')](_0x94df('0x1a'),auth[_0x94df('0x9')](),controller[_0x94df('0x1c')]);module[_0x94df('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a32e297..5674f04 100644 --- a/server/api/sound/sound.attributes.js +++ b/server/api/sound/sound.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01e0=['FLOAT','INTEGER','BIGINT','sequelize','exports','STRING','name'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x01e0,0x16f));var _0x001e=function(_0x5ea60d,_0xf1b6f3){_0x5ea60d=_0x5ea60d-0x0;var _0x1d14eb=_0x01e0[_0x5ea60d];return _0x1d14eb;};'use strict';var Sequelize=require(_0x001e('0x0'));module[_0x001e('0x1')]={'name':{'type':Sequelize[_0x001e('0x2')],'unique':_0x001e('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x001e('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x001e('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x001e('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x001e('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x001e('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x001e('0x6')]},'converted_channelCount':{'type':Sequelize[_0x001e('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x001e('0x5')]}}; \ No newline at end of file +var _0x268f=['INTEGER','FLOAT','name','STRING','BIGINT'];(function(_0x4b073d,_0x7cfbe2){var _0x5009cc=function(_0x5d19c7){while(--_0x5d19c7){_0x4b073d['push'](_0x4b073d['shift']());}};_0x5009cc(++_0x7cfbe2);}(_0x268f,0x89));var _0xf268=function(_0x46b46d,_0x3758ff){_0x46b46d=_0x46b46d-0x0;var _0x49b2d6=_0x268f[_0x46b46d];return _0x49b2d6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf268('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf268('0x1')]},'display_name':{'type':Sequelize[_0xf268('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xf268('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xf268('0x2')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xf268('0x2')]},'original_sampleRate':{'type':Sequelize[_0xf268('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xf268('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xf268('0x3')]},'converted_bitRate':{'type':Sequelize[_0xf268('0x2')]},'converted_sampleRate':{'type':Sequelize[_0xf268('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 725c46e..615602e 100644 --- a/server/api/sound/sound.controller.js +++ b/server/api/sound/sound.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3205=['delete','original_format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','Sounds','UserProfileResource','then','end','sendStatus','error','stack','name','index','Sound','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','save_name','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','converted_format','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','0777','create','body','role','userProfileId','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x3205,0x10e));var _0x5320=function(_0x497707,_0x56ab82){_0x497707=_0x497707-0x0;var _0x383b06=_0x3205[_0x497707];return _0x383b06;};'use strict';var emlformat=require(_0x5320('0x0'));var rimraf=require(_0x5320('0x1'));var zipdir=require(_0x5320('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5320('0x3'));var moment=require(_0x5320('0x4'));var BPromise=require(_0x5320('0x5'));var Mustache=require(_0x5320('0x6'));var util=require(_0x5320('0x7'));var path=require(_0x5320('0x8'));var sox=require(_0x5320('0x9'));var csv=require('to-csv');var ejs=require(_0x5320('0xa'));var fs=require('fs');var fs_extra=require(_0x5320('0xb'));var _=require(_0x5320('0xc'));var squel=require('squel');var crypto=require(_0x5320('0xd'));var jsforce=require(_0x5320('0xe'));var deskjs=require(_0x5320('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5320('0x10'));var Papa=require(_0x5320('0x11'));var Redis=require(_0x5320('0x12'));var authService=require(_0x5320('0x13'));var qs=require(_0x5320('0x14'));var as=require(_0x5320('0x15'));var hardwareService=require(_0x5320('0x16'));var logger=require(_0x5320('0x17'))(_0x5320('0x18'));var utils=require('../../config/utils');var config=require(_0x5320('0x19'));var licenseUtil=require(_0x5320('0x1a'));var db=require(_0x5320('0x1b'))['db'];function respondWithStatusCode(_0x1bc5e0,_0xe17f1e){_0xe17f1e=_0xe17f1e||0xcc;return function(_0x497cd4){if(_0x497cd4){return _0x1bc5e0['sendStatus'](_0xe17f1e);}return _0x1bc5e0[_0x5320('0x1c')](_0xe17f1e)['end']();};}function respondWithResult(_0x1207f9,_0x527b76){_0x527b76=_0x527b76||0xc8;return function(_0x439f97){if(_0x439f97){return _0x1207f9['status'](_0x527b76)[_0x5320('0x1d')](_0x439f97);}};}function respondWithFilteredResult(_0x340a10,_0x25739f){return function(_0x5dbb12){if(_0x5dbb12){var _0x2397f2=typeof _0x25739f['offset']===_0x5320('0x1e')&&typeof _0x25739f['limit']===_0x5320('0x1e');var _0xc68538=_0x5dbb12[_0x5320('0x1f')];var _0x43c60d=_0x2397f2?0x0:_0x25739f[_0x5320('0x20')];var _0x4317c3=_0x2397f2?_0x5dbb12[_0x5320('0x1f')]:_0x25739f[_0x5320('0x20')]+_0x25739f[_0x5320('0x21')];var _0x28dbca;if(_0x4317c3>=_0xc68538){_0x4317c3=_0xc68538;_0x28dbca=0xc8;}else{_0x28dbca=0xce;}_0x340a10[_0x5320('0x1c')](_0x28dbca);return _0x340a10[_0x5320('0x22')](_0x5320('0x23'),_0x43c60d+'-'+_0x4317c3+'/'+_0xc68538)[_0x5320('0x1d')](_0x5dbb12);}return null;};}function patchUpdates(_0x3c5463){return function(_0x249e05){try{jsonpatch['apply'](_0x249e05,_0x3c5463,!![]);}catch(_0x1b984b){return BPromise[_0x5320('0x24')](_0x1b984b);}return _0x249e05[_0x5320('0x25')]();};}function saveUpdates(_0xae555c,_0x18be4b){return function(_0x59fcf3){if(_0x59fcf3){return _0x59fcf3[_0x5320('0x26')](_0xae555c)['then'](function(_0x671093){return _0x671093;});}return null;};}function removeEntity(_0x3c52a0,_0x50a7e9){return function(_0x3a2719){if(_0x3a2719){return _0x3a2719[_0x5320('0x27')]()['then'](function(){var _0xbf7691=_0x3a2719['get']({'plain':!![]});var _0x63a1be=_0x5320('0x28');return db[_0x5320('0x29')][_0x5320('0x27')]({'where':{'type':_0x63a1be,'resourceId':_0xbf7691['id']}})[_0x5320('0x2a')](function(){return _0x3a2719;});})[_0x5320('0x2a')](function(){_0x3c52a0[_0x5320('0x1c')](0xcc)[_0x5320('0x2b')]();});}};}function handleEntityNotFound(_0x278b06,_0x43fcea){return function(_0x43be5b){if(!_0x43be5b){_0x278b06[_0x5320('0x2c')](0x194);}return _0x43be5b;};}function handleError(_0x11e5ab,_0x9d09f8){_0x9d09f8=_0x9d09f8||0x1f4;return function(_0x2cab28){logger[_0x5320('0x2d')](_0x2cab28[_0x5320('0x2e')]);if(_0x2cab28[_0x5320('0x2f')]){delete _0x2cab28[_0x5320('0x2f')];}_0x11e5ab['status'](_0x9d09f8)['send'](_0x2cab28);};}exports[_0x5320('0x30')]=function(_0x42187a,_0x371b0e){var _0x356b5e={},_0x44ff68={},_0x4e3425={'count':0x0,'rows':[]};var _0x1455d1=_['map'](db[_0x5320('0x31')][_0x5320('0x32')],function(_0x142929){return{'name':_0x142929[_0x5320('0x33')],'type':_0x142929[_0x5320('0x34')][_0x5320('0x35')]};});_0x44ff68[_0x5320('0x36')]=_[_0x5320('0x37')](_0x1455d1,'name');_0x44ff68[_0x5320('0x38')]=_[_0x5320('0x39')](_0x42187a['query']);_0x44ff68[_0x5320('0x3a')]=_[_0x5320('0x3b')](_0x44ff68['model'],_0x44ff68['query']);_0x356b5e[_0x5320('0x3c')]=_[_0x5320('0x3b')](_0x44ff68['model'],qs[_0x5320('0x3d')](_0x42187a[_0x5320('0x38')][_0x5320('0x3d')]));_0x356b5e[_0x5320('0x3c')]=_0x356b5e[_0x5320('0x3c')][_0x5320('0x3e')]?_0x356b5e['attributes']:_0x44ff68[_0x5320('0x36')];if(!_0x42187a[_0x5320('0x38')][_0x5320('0x3f')](_0x5320('0x40'))){_0x356b5e[_0x5320('0x21')]=qs['limit'](_0x42187a[_0x5320('0x38')][_0x5320('0x21')]);_0x356b5e[_0x5320('0x20')]=qs['offset'](_0x42187a[_0x5320('0x38')][_0x5320('0x20')]);}_0x356b5e['order']=qs[_0x5320('0x41')](_0x42187a[_0x5320('0x38')][_0x5320('0x41')]);_0x356b5e[_0x5320('0x42')]=qs[_0x5320('0x3a')](_[_0x5320('0x43')](_0x42187a[_0x5320('0x38')],_0x44ff68[_0x5320('0x3a')]),_0x1455d1);if(_0x42187a[_0x5320('0x38')][_0x5320('0x44')]){_0x356b5e[_0x5320('0x42')]=_[_0x5320('0x45')](_0x356b5e['where'],{'$or':_[_0x5320('0x37')](_0x1455d1,function(_0x353ad3){if(_0x353ad3[_0x5320('0x34')]!=='VIRTUAL'){var _0x107d3f={};_0x107d3f[_0x353ad3[_0x5320('0x2f')]]={'$like':'%'+_0x42187a[_0x5320('0x38')][_0x5320('0x44')]+'%'};return _0x107d3f;}})});}_0x356b5e=_['merge']({},_0x356b5e,_0x42187a[_0x5320('0x46')]);var _0x332f81={'where':_0x356b5e[_0x5320('0x42')]};return db[_0x5320('0x31')][_0x5320('0x1f')](_0x332f81)[_0x5320('0x2a')](function(_0x39247f){_0x4e3425['count']=_0x39247f;if(_0x42187a[_0x5320('0x38')][_0x5320('0x47')]){_0x356b5e[_0x5320('0x48')]=[{'all':!![]}];}return db['Sound'][_0x5320('0x49')](_0x356b5e);})['then'](function(_0x69560){_0x4e3425[_0x5320('0x4a')]=_0x69560;return _0x4e3425;})['then'](respondWithFilteredResult(_0x371b0e,_0x356b5e))[_0x5320('0x4b')](handleError(_0x371b0e,null));};exports[_0x5320('0x4c')]=function(_0x2a6fb7,_0x57a2ef){var _0x5702c8={'raw':!![],'where':{'id':_0x2a6fb7[_0x5320('0x4d')]['id']}},_0x172d06={};_0x172d06[_0x5320('0x36')]=_['keys'](db[_0x5320('0x31')][_0x5320('0x32')]);_0x172d06[_0x5320('0x38')]=_['keys'](_0x2a6fb7[_0x5320('0x38')]);_0x172d06[_0x5320('0x3a')]=_[_0x5320('0x3b')](_0x172d06[_0x5320('0x36')],_0x172d06[_0x5320('0x38')]);_0x5702c8[_0x5320('0x3c')]=_[_0x5320('0x3b')](_0x172d06['model'],qs[_0x5320('0x3d')](_0x2a6fb7[_0x5320('0x38')][_0x5320('0x3d')]));_0x5702c8['attributes']=_0x5702c8['attributes'][_0x5320('0x3e')]?_0x5702c8['attributes']:_0x172d06[_0x5320('0x36')];if(_0x2a6fb7['query'][_0x5320('0x47')]){_0x5702c8['include']=[{'all':!![]}];}_0x5702c8=_[_0x5320('0x45')]({},_0x5702c8,_0x2a6fb7[_0x5320('0x46')]);return db[_0x5320('0x31')][_0x5320('0x4e')](_0x5702c8)[_0x5320('0x2a')](handleEntityNotFound(_0x57a2ef,null))['then'](respondWithResult(_0x57a2ef,null))['catch'](handleError(_0x57a2ef,null));};exports['download']=function(_0x411b01,_0xaabbc3,_0x269460){return db[_0x5320('0x31')][_0x5320('0x4e')]({'where':{'id':_0x411b01[_0x5320('0x4d')]['id']},'attributes':[_0x5320('0x2f'),_0x5320('0x4f'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0xaabbc3,null))[_0x5320('0x2a')](function(_0x238b90){if(_0x238b90){if(!fs[_0x5320('0x50')](path[_0x5320('0x51')](config[_0x5320('0x52')],_0x5320('0x53'),_0x238b90[_0x5320('0x4f')]+'.'+_0x238b90['converted_format']))){throw new db[(_0x5320('0x54'))][(_0x5320('0x55'))](_0x5320('0x56'));}return _0xaabbc3[_0x5320('0x57')](path[_0x5320('0x51')](config[_0x5320('0x52')],'server/files/sounds/converted',util[_0x5320('0x58')](_0x5320('0x59'),_0x238b90[_0x5320('0x4f')],_0x238b90[_0x5320('0x5a')])),util[_0x5320('0x58')](_0x5320('0x59'),_0x238b90[_0x5320('0x2f')],_0x238b90[_0x5320('0x5a')]));}return null;})[_0x5320('0x4b')](handleError(_0xaabbc3,null));};exports['create']=function(_0x43652d,_0x1667cb,_0x1a263e){var _0x499dd0={'name':path[_0x5320('0x5b')](_0x43652d[_0x5320('0x5c')][_0x5320('0x5d')],path[_0x5320('0x5e')](_0x43652d['file'][_0x5320('0x5d')])),'save_name':path['basename'](_0x43652d[_0x5320('0x5c')][_0x5320('0x5f')],path[_0x5320('0x5e')](_0x43652d[_0x5320('0x5c')][_0x5320('0x5f')])),'original_format':path[_0x5320('0x5e')](_0x43652d[_0x5320('0x5c')][_0x5320('0x5d')])[_0x5320('0x60')](0x1),'converted_format':_0x5320('0x61')};var _0x2ef6de=path['join'](config['root'],_0x5320('0x62'),_0x43652d[_0x5320('0x5c')][_0x5320('0x5f')]);var _0x4c1c39=path['join'](config[_0x5320('0x52')],'server/files/sounds/converted',util[_0x5320('0x58')](_0x5320('0x59'),path[_0x5320('0x5b')](_0x43652d[_0x5320('0x5c')][_0x5320('0x5f')],path[_0x5320('0x5e')](_0x43652d[_0x5320('0x5c')][_0x5320('0x5f')])),_0x499dd0[_0x5320('0x5a')]));logger[_0x5320('0x63')](_0x5320('0x64'),_0x2ef6de);logger[_0x5320('0x63')]('Sound\x20upload\x20destination:\x20%s',_0x4c1c39);try{fs[_0x5320('0x65')](_0x2ef6de,parseInt('0777',0x8));var _0x94c3c4=sox[_0x5320('0x66')](_0x2ef6de,_0x4c1c39,{'sampleRate':0x1f40,'format':_0x5320('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x94c3c4['on'](_0x5320('0x2d'),function(_0x5ce324){fs[_0x5320('0x67')](_0x2ef6de);_0x1667cb[_0x5320('0x1c')](0x1f4)['send'](_0x5ce324);});_0x94c3c4['on']('src',function(_0xd059ec){_0x499dd0['original_duration']=isNaN(_0xd059ec[_0x5320('0x68')])?null:_0xd059ec[_0x5320('0x68')]*0x3e8;_0x499dd0[_0x5320('0x69')]=isNaN(_0xd059ec[_0x5320('0x6a')])?null:_0xd059ec[_0x5320('0x6a')];_0x499dd0[_0x5320('0x6b')]=isNaN(_0xd059ec['channelCount'])?null:_0xd059ec['channelCount'];_0x499dd0[_0x5320('0x6c')]=isNaN(_0xd059ec[_0x5320('0x6d')])?null:_0xd059ec[_0x5320('0x6d')];_0x499dd0[_0x5320('0x6e')]=isNaN(_0xd059ec['sampleRate'])?null:_0xd059ec[_0x5320('0x6f')];});_0x94c3c4['on'](_0x5320('0x70'),function(_0x4305e7){_0x499dd0[_0x5320('0x71')]=isNaN(_0x4305e7[_0x5320('0x68')])?null:_0x4305e7[_0x5320('0x68')]*0x3e8;_0x499dd0[_0x5320('0x72')]=isNaN(_0x4305e7[_0x5320('0x6a')])?null:_0x4305e7['sampleCount'];_0x499dd0[_0x5320('0x73')]=isNaN(_0x4305e7[_0x5320('0x74')])?null:_0x4305e7[_0x5320('0x74')];_0x499dd0[_0x5320('0x75')]=isNaN(_0x4305e7[_0x5320('0x6d')])?null:_0x4305e7[_0x5320('0x6d')];_0x499dd0[_0x5320('0x76')]=isNaN(_0x4305e7[_0x5320('0x6f')])?null:_0x4305e7[_0x5320('0x6f')];});_0x94c3c4['on'](_0x5320('0x2b'),function(){fs['chmodSync'](_0x4c1c39,parseInt(_0x5320('0x77'),0x8));return db[_0x5320('0x31')][_0x5320('0x78')](_0x499dd0)[_0x5320('0x2a')](function(_0xaab8ba){var _0x557a32={'role':_0x43652d[_0x5320('0x79')][_0x5320('0x7a')],'userProfileId':_0x43652d[_0x5320('0x79')][_0x5320('0x7b')]};if(!_0x557a32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x557a32[_0x5320('0x7a')]===_0x5320('0x7c')){var _0x342b77=_0xaab8ba[_0x5320('0x7d')]({'plain':!![]});return db[_0x5320('0x7e')]['find']({'where':{'name':_0x5320('0x28'),'userProfileId':_0x557a32[_0x5320('0x7b')]},'raw':!![]})[_0x5320('0x2a')](function(_0x35ad32){if(_0x35ad32&&_0x35ad32[_0x5320('0x7f')]===0x0){return db[_0x5320('0x29')][_0x5320('0x78')]({'name':_0x342b77[_0x5320('0x2f')],'resourceId':_0x342b77['id'],'type':_0x35ad32['name'],'sectionId':_0x35ad32['id']},{})[_0x5320('0x2a')](function(){return _0xaab8ba;});}else{return _0xaab8ba;}})[_0x5320('0x4b')](function(_0x50c546){logger[_0x5320('0x2d')](_0x5320('0x80'),_0x50c546);throw _0x50c546;});}return _0xaab8ba;})[_0x5320('0x2a')](respondWithResult(_0x1667cb,null))[_0x5320('0x4b')](handleError(_0x1667cb,null));});_0x94c3c4[_0x5320('0x81')]();}catch(_0x5ec220){_0x1667cb['status'](0x1f4)[_0x5320('0x82')](_0x5ec220);}};exports[_0x5320('0x26')]=function(_0x3c1763,_0x34c434,_0x413591){return db[_0x5320('0x31')][_0x5320('0x4e')]({'where':{'id':_0x3c1763[_0x5320('0x4d')]['id']}})[_0x5320('0x2a')](handleEntityNotFound(_0x34c434,null))['then'](saveUpdates(_['pick'](_0x3c1763[_0x5320('0x79')],[_0x5320('0x2f'),_0x5320('0x83')]),null))[_0x5320('0x2a')](respondWithResult(_0x34c434,null))[_0x5320('0x4b')](handleError(_0x34c434,null));};exports[_0x5320('0x84')]=function(_0x10a589,_0x59b88f,_0x6dc8ae){return db['Sound'][_0x5320('0x4e')]({'where':{'id':_0x10a589['params']['id']}})[_0x5320('0x2a')](function(_0x48b8e9){if(_0x48b8e9){return _0x48b8e9[_0x5320('0x27')]();}})[_0x5320('0x2a')](function(_0x19ba09){var _0x184027=path[_0x5320('0x51')](config[_0x5320('0x52')],'server/files/sounds/original',util[_0x5320('0x58')]('%s.%s',_0x19ba09[_0x5320('0x4f')],_0x19ba09[_0x5320('0x85')]));var _0x2cac83=path[_0x5320('0x51')](config[_0x5320('0x52')],_0x5320('0x53'),util[_0x5320('0x58')](_0x5320('0x59'),_0x19ba09[_0x5320('0x4f')],_0x19ba09['converted_format']));fs[_0x5320('0x67')](_0x184027);fs[_0x5320('0x67')](_0x2cac83);return _0x19ba09;})[_0x5320('0x2a')](function(_0x523c08){if(_0x523c08){return _0x59b88f['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x59b88f,null))['catch'](handleError(_0x59b88f,null));}; \ No newline at end of file +var _0x2b85=['converted_sampleCount','converted_channelCount','converted_sampleRate','chmodSync','0777','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','userProfileId','autoAssociation','description','delete','original_format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','Sound','include','findAll','rows','catch','params','includeAll','find','download','existsSync','join','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','file','originalname','extname','filename','substring','wav','server/files/sounds/original','basename','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration'];(function(_0x3e10c0,_0x385bdc){var _0x2fb415=function(_0x2bfb7b){while(--_0x2bfb7b){_0x3e10c0['push'](_0x3e10c0['shift']());}};_0x2fb415(++_0x385bdc);}(_0x2b85,0x110));var _0x52b8=function(_0x4d0e6e,_0x38b6bd){_0x4d0e6e=_0x4d0e6e-0x0;var _0x4c4007=_0x2b85[_0x4d0e6e];return _0x4c4007;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52b8('0x0'));var zipdir=require(_0x52b8('0x1'));var jsonpatch=require(_0x52b8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x52b8('0x3'));var Mustache=require(_0x52b8('0x4'));var util=require(_0x52b8('0x5'));var path=require(_0x52b8('0x6'));var sox=require('sox');var csv=require(_0x52b8('0x7'));var ejs=require(_0x52b8('0x8'));var fs=require('fs');var fs_extra=require(_0x52b8('0x9'));var _=require(_0x52b8('0xa'));var squel=require(_0x52b8('0xb'));var crypto=require(_0x52b8('0xc'));var jsforce=require(_0x52b8('0xd'));var deskjs=require(_0x52b8('0xe'));var toCsv=require(_0x52b8('0x7'));var querystring=require(_0x52b8('0xf'));var Papa=require(_0x52b8('0x10'));var Redis=require(_0x52b8('0x11'));var authService=require(_0x52b8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52b8('0x13'));var logger=require(_0x52b8('0x14'))(_0x52b8('0x15'));var utils=require(_0x52b8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x52b8('0x17'));var db=require(_0x52b8('0x18'))['db'];function respondWithStatusCode(_0x421e10,_0x4c97d0){_0x4c97d0=_0x4c97d0||0xcc;return function(_0x51de15){if(_0x51de15){return _0x421e10[_0x52b8('0x19')](_0x4c97d0);}return _0x421e10[_0x52b8('0x1a')](_0x4c97d0)[_0x52b8('0x1b')]();};}function respondWithResult(_0x1ddcb9,_0x5661f0){_0x5661f0=_0x5661f0||0xc8;return function(_0x120dd1){if(_0x120dd1){return _0x1ddcb9['status'](_0x5661f0)['json'](_0x120dd1);}};}function respondWithFilteredResult(_0x11a803,_0x22ce6c){return function(_0x1fd1c3){if(_0x1fd1c3){var _0x325476=typeof _0x22ce6c['offset']===_0x52b8('0x1c')&&typeof _0x22ce6c[_0x52b8('0x1d')]===_0x52b8('0x1c');var _0x1858ca=_0x1fd1c3[_0x52b8('0x1e')];var _0x202281=_0x325476?0x0:_0x22ce6c[_0x52b8('0x1f')];var _0x5056ea=_0x325476?_0x1fd1c3['count']:_0x22ce6c[_0x52b8('0x1f')]+_0x22ce6c[_0x52b8('0x1d')];var _0x353edf;if(_0x5056ea>=_0x1858ca){_0x5056ea=_0x1858ca;_0x353edf=0xc8;}else{_0x353edf=0xce;}_0x11a803[_0x52b8('0x1a')](_0x353edf);return _0x11a803[_0x52b8('0x20')](_0x52b8('0x21'),_0x202281+'-'+_0x5056ea+'/'+_0x1858ca)['json'](_0x1fd1c3);}return null;};}function patchUpdates(_0x5226c7){return function(_0x4d60b8){try{jsonpatch[_0x52b8('0x22')](_0x4d60b8,_0x5226c7,!![]);}catch(_0x1f045a){return BPromise[_0x52b8('0x23')](_0x1f045a);}return _0x4d60b8[_0x52b8('0x24')]();};}function saveUpdates(_0x569935,_0x448a4e){return function(_0x40fa65){if(_0x40fa65){return _0x40fa65[_0x52b8('0x25')](_0x569935)[_0x52b8('0x26')](function(_0x5c913a){return _0x5c913a;});}return null;};}function removeEntity(_0x25c782,_0x547463){return function(_0x44a935){if(_0x44a935){return _0x44a935[_0x52b8('0x27')]()[_0x52b8('0x26')](function(){var _0x490fb3=_0x44a935[_0x52b8('0x28')]({'plain':!![]});var _0x4a4f72='Sounds';return db[_0x52b8('0x29')]['destroy']({'where':{'type':_0x4a4f72,'resourceId':_0x490fb3['id']}})[_0x52b8('0x26')](function(){return _0x44a935;});})[_0x52b8('0x26')](function(){_0x25c782[_0x52b8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0ab1,_0x217683){return function(_0x1fc00a){if(!_0x1fc00a){_0x5a0ab1[_0x52b8('0x19')](0x194);}return _0x1fc00a;};}function handleError(_0x5ecfad,_0x56f3ff){_0x56f3ff=_0x56f3ff||0x1f4;return function(_0x13a21c){logger[_0x52b8('0x2a')](_0x13a21c[_0x52b8('0x2b')]);if(_0x13a21c[_0x52b8('0x2c')]){delete _0x13a21c[_0x52b8('0x2c')];}_0x5ecfad['status'](_0x56f3ff)[_0x52b8('0x2d')](_0x13a21c);};}exports['index']=function(_0x2a079a,_0x4bdc42){var _0x299620={},_0x57ec4b={},_0x4f83b5={'count':0x0,'rows':[]};var _0x2efed8=_[_0x52b8('0x2e')](db['Sound'][_0x52b8('0x2f')],function(_0x292e48){return{'name':_0x292e48[_0x52b8('0x30')],'type':_0x292e48[_0x52b8('0x31')][_0x52b8('0x32')]};});_0x57ec4b[_0x52b8('0x33')]=_['map'](_0x2efed8,_0x52b8('0x2c'));_0x57ec4b[_0x52b8('0x34')]=_[_0x52b8('0x35')](_0x2a079a['query']);_0x57ec4b['filters']=_[_0x52b8('0x36')](_0x57ec4b[_0x52b8('0x33')],_0x57ec4b[_0x52b8('0x34')]);_0x299620['attributes']=_[_0x52b8('0x36')](_0x57ec4b[_0x52b8('0x33')],qs[_0x52b8('0x37')](_0x2a079a[_0x52b8('0x34')][_0x52b8('0x37')]));_0x299620[_0x52b8('0x38')]=_0x299620[_0x52b8('0x38')][_0x52b8('0x39')]?_0x299620['attributes']:_0x57ec4b['model'];if(!_0x2a079a[_0x52b8('0x34')]['hasOwnProperty'](_0x52b8('0x3a'))){_0x299620[_0x52b8('0x1d')]=qs[_0x52b8('0x1d')](_0x2a079a[_0x52b8('0x34')][_0x52b8('0x1d')]);_0x299620[_0x52b8('0x1f')]=qs[_0x52b8('0x1f')](_0x2a079a[_0x52b8('0x34')][_0x52b8('0x1f')]);}_0x299620[_0x52b8('0x3b')]=qs['sort'](_0x2a079a[_0x52b8('0x34')]['sort']);_0x299620[_0x52b8('0x3c')]=qs[_0x52b8('0x3d')](_[_0x52b8('0x3e')](_0x2a079a['query'],_0x57ec4b[_0x52b8('0x3d')]),_0x2efed8);if(_0x2a079a['query'][_0x52b8('0x3f')]){_0x299620[_0x52b8('0x3c')]=_[_0x52b8('0x40')](_0x299620['where'],{'$or':_[_0x52b8('0x2e')](_0x2efed8,function(_0x43bc10){if(_0x43bc10[_0x52b8('0x31')]!==_0x52b8('0x41')){var _0x277783={};_0x277783[_0x43bc10[_0x52b8('0x2c')]]={'$like':'%'+_0x2a079a[_0x52b8('0x34')][_0x52b8('0x3f')]+'%'};return _0x277783;}})});}_0x299620=_[_0x52b8('0x40')]({},_0x299620,_0x2a079a[_0x52b8('0x42')]);var _0x49af8f={'where':_0x299620[_0x52b8('0x3c')]};return db[_0x52b8('0x43')][_0x52b8('0x1e')](_0x49af8f)[_0x52b8('0x26')](function(_0x331ce4){_0x4f83b5['count']=_0x331ce4;if(_0x2a079a[_0x52b8('0x34')]['includeAll']){_0x299620[_0x52b8('0x44')]=[{'all':!![]}];}return db[_0x52b8('0x43')][_0x52b8('0x45')](_0x299620);})['then'](function(_0x15e8c7){_0x4f83b5[_0x52b8('0x46')]=_0x15e8c7;return _0x4f83b5;})[_0x52b8('0x26')](respondWithFilteredResult(_0x4bdc42,_0x299620))[_0x52b8('0x47')](handleError(_0x4bdc42,null));};exports['show']=function(_0x384c96,_0x47bae7){var _0x1225b6={'raw':!![],'where':{'id':_0x384c96[_0x52b8('0x48')]['id']}},_0x3da85c={};_0x3da85c['model']=_[_0x52b8('0x35')](db['Sound'][_0x52b8('0x2f')]);_0x3da85c[_0x52b8('0x34')]=_[_0x52b8('0x35')](_0x384c96[_0x52b8('0x34')]);_0x3da85c['filters']=_[_0x52b8('0x36')](_0x3da85c[_0x52b8('0x33')],_0x3da85c[_0x52b8('0x34')]);_0x1225b6[_0x52b8('0x38')]=_[_0x52b8('0x36')](_0x3da85c[_0x52b8('0x33')],qs[_0x52b8('0x37')](_0x384c96[_0x52b8('0x34')][_0x52b8('0x37')]));_0x1225b6[_0x52b8('0x38')]=_0x1225b6[_0x52b8('0x38')][_0x52b8('0x39')]?_0x1225b6[_0x52b8('0x38')]:_0x3da85c[_0x52b8('0x33')];if(_0x384c96['query'][_0x52b8('0x49')]){_0x1225b6[_0x52b8('0x44')]=[{'all':!![]}];}_0x1225b6=_[_0x52b8('0x40')]({},_0x1225b6,_0x384c96[_0x52b8('0x42')]);return db[_0x52b8('0x43')][_0x52b8('0x4a')](_0x1225b6)['then'](handleEntityNotFound(_0x47bae7,null))[_0x52b8('0x26')](respondWithResult(_0x47bae7,null))['catch'](handleError(_0x47bae7,null));};exports[_0x52b8('0x4b')]=function(_0x5b3fb0,_0x1fb2b8,_0x3f644a){return db[_0x52b8('0x43')][_0x52b8('0x4a')]({'where':{'id':_0x5b3fb0[_0x52b8('0x48')]['id']},'attributes':[_0x52b8('0x2c'),'save_name','converted_format'],'raw':!![]})[_0x52b8('0x26')](handleEntityNotFound(_0x1fb2b8,null))['then'](function(_0x1259a7){if(_0x1259a7){if(!fs[_0x52b8('0x4c')](path[_0x52b8('0x4d')](config[_0x52b8('0x4e')],_0x52b8('0x4f'),_0x1259a7[_0x52b8('0x50')]+'.'+_0x1259a7[_0x52b8('0x51')]))){throw new db[(_0x52b8('0x52'))][(_0x52b8('0x53'))](_0x52b8('0x54'));}return _0x1fb2b8[_0x52b8('0x4b')](path['join'](config['root'],_0x52b8('0x4f'),util[_0x52b8('0x55')](_0x52b8('0x56'),_0x1259a7['save_name'],_0x1259a7[_0x52b8('0x51')])),util[_0x52b8('0x55')](_0x52b8('0x56'),_0x1259a7[_0x52b8('0x2c')],_0x1259a7[_0x52b8('0x51')]));}return null;})[_0x52b8('0x47')](handleError(_0x1fb2b8,null));};exports['create']=function(_0x33f221,_0x5157c6,_0x447755){var _0x16d194={'name':path['basename'](_0x33f221[_0x52b8('0x57')][_0x52b8('0x58')],path[_0x52b8('0x59')](_0x33f221[_0x52b8('0x57')][_0x52b8('0x58')])),'save_name':path['basename'](_0x33f221[_0x52b8('0x57')][_0x52b8('0x5a')],path['extname'](_0x33f221['file'][_0x52b8('0x5a')])),'original_format':path[_0x52b8('0x59')](_0x33f221[_0x52b8('0x57')]['originalname'])[_0x52b8('0x5b')](0x1),'converted_format':_0x52b8('0x5c')};var _0x193984=path['join'](config['root'],_0x52b8('0x5d'),_0x33f221['file']['filename']);var _0x5bcf12=path[_0x52b8('0x4d')](config[_0x52b8('0x4e')],_0x52b8('0x4f'),util[_0x52b8('0x55')](_0x52b8('0x56'),path[_0x52b8('0x5e')](_0x33f221[_0x52b8('0x57')][_0x52b8('0x5a')],path[_0x52b8('0x59')](_0x33f221['file'][_0x52b8('0x5a')])),_0x16d194['converted_format']));logger['info'](_0x52b8('0x5f'),_0x193984);logger[_0x52b8('0x60')](_0x52b8('0x61'),_0x5bcf12);try{fs['chmodSync'](_0x193984,parseInt('0777',0x8));var _0x12e3f3=sox[_0x52b8('0x62')](_0x193984,_0x5bcf12,{'sampleRate':0x1f40,'format':_0x52b8('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12e3f3['on'](_0x52b8('0x2a'),function(_0x5d95d1){fs[_0x52b8('0x63')](_0x193984);_0x5157c6['status'](0x1f4)['send'](_0x5d95d1);});_0x12e3f3['on'](_0x52b8('0x64'),function(_0x44cb04){_0x16d194[_0x52b8('0x65')]=isNaN(_0x44cb04[_0x52b8('0x66')])?null:_0x44cb04[_0x52b8('0x66')]*0x3e8;_0x16d194[_0x52b8('0x67')]=isNaN(_0x44cb04[_0x52b8('0x68')])?null:_0x44cb04[_0x52b8('0x68')];_0x16d194[_0x52b8('0x69')]=isNaN(_0x44cb04['channelCount'])?null:_0x44cb04[_0x52b8('0x6a')];_0x16d194[_0x52b8('0x6b')]=isNaN(_0x44cb04['bitRate'])?null:_0x44cb04[_0x52b8('0x6c')];_0x16d194['original_sampleRate']=isNaN(_0x44cb04[_0x52b8('0x6d')])?null:_0x44cb04[_0x52b8('0x6d')];});_0x12e3f3['on'](_0x52b8('0x6e'),function(_0x247d9c){_0x16d194[_0x52b8('0x6f')]=isNaN(_0x247d9c[_0x52b8('0x66')])?null:_0x247d9c['duration']*0x3e8;_0x16d194[_0x52b8('0x70')]=isNaN(_0x247d9c[_0x52b8('0x68')])?null:_0x247d9c[_0x52b8('0x68')];_0x16d194[_0x52b8('0x71')]=isNaN(_0x247d9c[_0x52b8('0x6a')])?null:_0x247d9c[_0x52b8('0x6a')];_0x16d194['converted_bitRate']=isNaN(_0x247d9c[_0x52b8('0x6c')])?null:_0x247d9c[_0x52b8('0x6c')];_0x16d194[_0x52b8('0x72')]=isNaN(_0x247d9c['sampleRate'])?null:_0x247d9c['sampleRate'];});_0x12e3f3['on'](_0x52b8('0x1b'),function(){fs[_0x52b8('0x73')](_0x5bcf12,parseInt(_0x52b8('0x74'),0x8));return db[_0x52b8('0x43')][_0x52b8('0x75')](_0x16d194)['then'](function(_0x2d967f){var _0x48f6b2={'role':_0x33f221[_0x52b8('0x76')][_0x52b8('0x77')],'userProfileId':_0x33f221[_0x52b8('0x76')]['userProfileId']};if(!_0x48f6b2)throw new Error(_0x52b8('0x78'));if(_0x48f6b2[_0x52b8('0x77')]==='user'){var _0x3001f2=_0x2d967f['get']({'plain':!![]});return db[_0x52b8('0x79')]['find']({'where':{'name':_0x52b8('0x7a'),'userProfileId':_0x48f6b2[_0x52b8('0x7b')]},'raw':!![]})['then'](function(_0x3550ff){if(_0x3550ff&&_0x3550ff[_0x52b8('0x7c')]===0x0){return db['UserProfileResource'][_0x52b8('0x75')]({'name':_0x3001f2[_0x52b8('0x2c')],'resourceId':_0x3001f2['id'],'type':_0x3550ff[_0x52b8('0x2c')],'sectionId':_0x3550ff['id']},{})[_0x52b8('0x26')](function(){return _0x2d967f;});}else{return _0x2d967f;}})['catch'](function(_0x4fbf62){logger[_0x52b8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fbf62);throw _0x4fbf62;});}return _0x2d967f;})['then'](respondWithResult(_0x5157c6,null))[_0x52b8('0x47')](handleError(_0x5157c6,null));});_0x12e3f3['start']();}catch(_0x4fc004){_0x5157c6[_0x52b8('0x1a')](0x1f4)[_0x52b8('0x2d')](_0x4fc004);}};exports[_0x52b8('0x25')]=function(_0x2e478e,_0x52625e,_0x20647b){return db[_0x52b8('0x43')][_0x52b8('0x4a')]({'where':{'id':_0x2e478e[_0x52b8('0x48')]['id']}})[_0x52b8('0x26')](handleEntityNotFound(_0x52625e,null))[_0x52b8('0x26')](saveUpdates(_[_0x52b8('0x3e')](_0x2e478e[_0x52b8('0x76')],[_0x52b8('0x2c'),_0x52b8('0x7d')]),null))[_0x52b8('0x26')](respondWithResult(_0x52625e,null))[_0x52b8('0x47')](handleError(_0x52625e,null));};exports[_0x52b8('0x7e')]=function(_0xe29322,_0x39de44,_0x270592){return db[_0x52b8('0x43')][_0x52b8('0x4a')]({'where':{'id':_0xe29322[_0x52b8('0x48')]['id']}})['then'](function(_0x22a35b){if(_0x22a35b){return _0x22a35b[_0x52b8('0x27')]();}})['then'](function(_0x13b4e4){var _0x25ee0d=path[_0x52b8('0x4d')](config[_0x52b8('0x4e')],_0x52b8('0x5d'),util['format'](_0x52b8('0x56'),_0x13b4e4[_0x52b8('0x50')],_0x13b4e4[_0x52b8('0x7f')]));var _0x1fd485=path[_0x52b8('0x4d')](config[_0x52b8('0x4e')],_0x52b8('0x4f'),util[_0x52b8('0x55')](_0x52b8('0x56'),_0x13b4e4[_0x52b8('0x50')],_0x13b4e4['converted_format']));fs[_0x52b8('0x63')](_0x25ee0d);fs[_0x52b8('0x63')](_0x1fd485);return _0x13b4e4;})[_0x52b8('0x26')](function(_0x20d5a2){if(_0x20d5a2){return _0x39de44[_0x52b8('0x1a')](0xcc)[_0x52b8('0x1b')]();}})[_0x52b8('0x26')](handleEntityNotFound(_0x39de44,null))[_0x52b8('0x47')](handleError(_0x39de44,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b87d2c5..67b325e 100644 --- a/server/api/sound/sound.model.js +++ b/server/api/sound/sound.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d9a=['util','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash'];(function(_0x2daeb8,_0x480629){var _0x397d29=function(_0x5c0cba){while(--_0x5c0cba){_0x2daeb8['push'](_0x2daeb8['shift']());}};_0x397d29(++_0x480629);}(_0x7d9a,0x1d8));var _0xa7d9=function(_0x32e320,_0x5da58d){_0x32e320=_0x32e320-0x0;var _0x43ae56=_0x7d9a[_0x32e320];return _0x43ae56;};'use strict';var _=require(_0xa7d9('0x0'));var util=require(_0xa7d9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa7d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xa7d9('0x3'));var fs=require('fs');var path=require(_0xa7d9('0x4'));var rimraf=require(_0xa7d9('0x5'));var config=require(_0xa7d9('0x6'));var attributes=require(_0xa7d9('0x7'));module[_0xa7d9('0x8')]=function(_0x30401d,_0xa17b60){return _0x30401d[_0xa7d9('0x9')](_0xa7d9('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9690=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api'];(function(_0xd094df,_0x4c06ca){var _0x270fb5=function(_0x25ff39){while(--_0x25ff39){_0xd094df['push'](_0xd094df['shift']());}};_0x270fb5(++_0x4c06ca);}(_0x9690,0x137));var _0x0969=function(_0x4a47fc,_0x452c81){_0x4a47fc=_0x4a47fc-0x0;var _0x35551a=_0x9690[_0x4a47fc];return _0x35551a;};'use strict';var _=require(_0x0969('0x0'));var util=require(_0x0969('0x1'));var logger=require(_0x0969('0x2'))(_0x0969('0x3'));var moment=require(_0x0969('0x4'));var BPromise=require(_0x0969('0x5'));var rp=require(_0x0969('0x6'));var fs=require('fs');var path=require(_0x0969('0x7'));var rimraf=require(_0x0969('0x8'));var config=require(_0x0969('0x9'));var attributes=require(_0x0969('0xa'));module[_0x0969('0xb')]=function(_0x4e7fd3,_0x3c8e13){return _0x4e7fd3[_0x0969('0xc')](_0x0969('0xd'),attributes,{'tableName':_0x0969('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index c186c05..8ad5184 100644 --- a/server/api/sound/sound.rpc.js +++ b/server/api/sound/sound.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19df=['code','Sound,\x20%s,\x20%s','message','ShowSound','find','options','where','attributes','map','include','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error'];(function(_0x492619,_0x5e8109){var _0x4d14ea=function(_0xee6579){while(--_0xee6579){_0x492619['push'](_0x492619['shift']());}};_0x4d14ea(++_0x5e8109);}(_0x19df,0x185));var _0xf19d=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0x19df[_0x136a0d];return _0x212ea5;};'use strict';var _=require(_0xf19d('0x0'));var util=require(_0xf19d('0x1'));var moment=require(_0xf19d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf19d('0x3'));var db=require(_0xf19d('0x4'))['db'];var utils=require(_0xf19d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf19d('0x6'));var jayson=require(_0xf19d('0x7'));var client=jayson[_0xf19d('0x8')][_0xf19d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3aa9fa,_0x5e2de2,_0x2fba1a){return new BPromise(function(_0x4ee991,_0x2f3d74){return client['request'](_0x3aa9fa,_0x2fba1a)[_0xf19d('0xa')](function(_0x21b87f){logger[_0xf19d('0xb')]('Sound,\x20%s,\x20%s',_0x5e2de2,_0xf19d('0xc'));logger[_0xf19d('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x5e2de2,'request\x20sent',JSON[_0xf19d('0xe')](_0x21b87f));if(_0x21b87f[_0xf19d('0xf')]){if(_0x21b87f['error'][_0xf19d('0x10')]===0x1f4){logger[_0xf19d('0xf')](_0xf19d('0x11'),_0x5e2de2,_0x21b87f[_0xf19d('0xf')][_0xf19d('0x12')]);return _0x2f3d74(_0x21b87f[_0xf19d('0xf')][_0xf19d('0x12')]);}logger['error'](_0xf19d('0x11'),_0x5e2de2,_0x21b87f['error'][_0xf19d('0x12')]);return _0x4ee991(_0x21b87f[_0xf19d('0xf')][_0xf19d('0x12')]);}else{logger[_0xf19d('0xb')]('Sound,\x20%s,\x20%s',_0x5e2de2,_0xf19d('0xc'));_0x4ee991(_0x21b87f['result'][_0xf19d('0x12')]);}})['catch'](function(_0x36b49d){logger[_0xf19d('0xf')]('Sound,\x20%s,\x20%s',_0x5e2de2,_0x36b49d);_0x2f3d74(_0x36b49d);});});}exports[_0xf19d('0x13')]=function(_0x257b95){var _0x1baee5=this;return new Promise(function(_0x4f4bad,_0x4e62cb){return db['Sound'][_0xf19d('0x14')]({'raw':_0x257b95[_0xf19d('0x15')]?_0x257b95[_0xf19d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x257b95[_0xf19d('0x15')]?_0x257b95[_0xf19d('0x15')][_0xf19d('0x16')]||null:null,'attributes':_0x257b95[_0xf19d('0x15')]?_0x257b95[_0xf19d('0x15')][_0xf19d('0x17')]||null:null,'include':_0x257b95[_0xf19d('0x15')]?_0x257b95['options']['include']?_[_0xf19d('0x18')](_0x257b95[_0xf19d('0x15')][_0xf19d('0x19')],function(_0x17cb52){return{'model':db[_0x17cb52['model']],'as':_0x17cb52['as'],'attributes':_0x17cb52[_0xf19d('0x17')],'include':_0x17cb52[_0xf19d('0x19')]?_['map'](_0x17cb52[_0xf19d('0x19')],function(_0x57955d){return{'model':db[_0x57955d[_0xf19d('0x1a')]],'as':_0x57955d['as'],'attributes':_0x57955d[_0xf19d('0x17')],'include':_0x57955d[_0xf19d('0x19')]?_[_0xf19d('0x18')](_0x57955d[_0xf19d('0x19')],function(_0x5b84a5){return{'model':db[_0x5b84a5[_0xf19d('0x1a')]],'as':_0x5b84a5['as'],'attributes':_0x5b84a5[_0xf19d('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf19d('0xa')](function(_0x388bc9){logger[_0xf19d('0xb')](_0xf19d('0x13'),_0x257b95);logger[_0xf19d('0xd')](_0xf19d('0x13'),_0x257b95,JSON[_0xf19d('0xe')](_0x388bc9));_0x4f4bad(_0x388bc9);})['catch'](function(_0x50d547){logger[_0xf19d('0xf')](_0xf19d('0x13'),_0x50d547[_0xf19d('0x12')],_0x257b95);_0x4e62cb(_0x1baee5[_0xf19d('0xf')](0x1f4,_0x50d547[_0xf19d('0x12')]));});});}; \ No newline at end of file +var _0x9c0a=['options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSound','Sound'];(function(_0x4927dc,_0x54b3f6){var _0x45e1c3=function(_0x45f4f7){while(--_0x45f4f7){_0x4927dc['push'](_0x4927dc['shift']());}};_0x45e1c3(++_0x54b3f6);}(_0x9c0a,0xa2));var _0xa9c0=function(_0x3c3f72,_0x3426fa){_0x3c3f72=_0x3c3f72-0x0;var _0x33551f=_0x9c0a[_0x3c3f72];return _0x33551f;};'use strict';var _=require(_0xa9c0('0x0'));var util=require('util');var moment=require(_0xa9c0('0x1'));var BPromise=require(_0xa9c0('0x2'));var rs=require(_0xa9c0('0x3'));var fs=require('fs');var Redis=require(_0xa9c0('0x4'));var db=require(_0xa9c0('0x5'))['db'];var utils=require(_0xa9c0('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa9c0('0x7'));var client=jayson[_0xa9c0('0x8')][_0xa9c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51d08f,_0x131065,_0x5c52dd){return new BPromise(function(_0x5eb691,_0x53eda1){return client[_0xa9c0('0xa')](_0x51d08f,_0x5c52dd)[_0xa9c0('0xb')](function(_0x4d115f){logger[_0xa9c0('0xc')](_0xa9c0('0xd'),_0x131065,_0xa9c0('0xe'));logger[_0xa9c0('0xf')](_0xa9c0('0x10'),_0x131065,'request\x20sent',JSON[_0xa9c0('0x11')](_0x4d115f));if(_0x4d115f['error']){if(_0x4d115f[_0xa9c0('0x12')][_0xa9c0('0x13')]===0x1f4){logger[_0xa9c0('0x12')](_0xa9c0('0xd'),_0x131065,_0x4d115f[_0xa9c0('0x12')][_0xa9c0('0x14')]);return _0x53eda1(_0x4d115f['error']['message']);}logger[_0xa9c0('0x12')](_0xa9c0('0xd'),_0x131065,_0x4d115f[_0xa9c0('0x12')][_0xa9c0('0x14')]);return _0x5eb691(_0x4d115f[_0xa9c0('0x12')][_0xa9c0('0x14')]);}else{logger[_0xa9c0('0xc')](_0xa9c0('0xd'),_0x131065,_0xa9c0('0xe'));_0x5eb691(_0x4d115f['result'][_0xa9c0('0x14')]);}})[_0xa9c0('0x15')](function(_0x1ac5e4){logger['error'](_0xa9c0('0xd'),_0x131065,_0x1ac5e4);_0x53eda1(_0x1ac5e4);});});}exports[_0xa9c0('0x16')]=function(_0x2e08bf){var _0xfd2c15=this;return new Promise(function(_0x4e5f0e,_0x46923a){return db[_0xa9c0('0x17')]['find']({'raw':_0x2e08bf[_0xa9c0('0x18')]?_0x2e08bf[_0xa9c0('0x18')][_0xa9c0('0x19')]===undefined?!![]:![]:!![],'where':_0x2e08bf[_0xa9c0('0x18')]?_0x2e08bf[_0xa9c0('0x18')][_0xa9c0('0x1a')]||null:null,'attributes':_0x2e08bf[_0xa9c0('0x18')]?_0x2e08bf['options'][_0xa9c0('0x1b')]||null:null,'include':_0x2e08bf[_0xa9c0('0x18')]?_0x2e08bf[_0xa9c0('0x18')][_0xa9c0('0x1c')]?_[_0xa9c0('0x1d')](_0x2e08bf[_0xa9c0('0x18')][_0xa9c0('0x1c')],function(_0x3d867c){return{'model':db[_0x3d867c[_0xa9c0('0x1e')]],'as':_0x3d867c['as'],'attributes':_0x3d867c[_0xa9c0('0x1b')],'include':_0x3d867c['include']?_[_0xa9c0('0x1d')](_0x3d867c[_0xa9c0('0x1c')],function(_0x15fa21){return{'model':db[_0x15fa21[_0xa9c0('0x1e')]],'as':_0x15fa21['as'],'attributes':_0x15fa21[_0xa9c0('0x1b')],'include':_0x15fa21[_0xa9c0('0x1c')]?_[_0xa9c0('0x1d')](_0x15fa21[_0xa9c0('0x1c')],function(_0xbded84){return{'model':db[_0xbded84['model']],'as':_0xbded84['as'],'attributes':_0xbded84[_0xa9c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa9c0('0xb')](function(_0x2562ed){logger[_0xa9c0('0xc')](_0xa9c0('0x16'),_0x2e08bf);logger[_0xa9c0('0xf')](_0xa9c0('0x16'),_0x2e08bf,JSON[_0xa9c0('0x11')](_0x2562ed));_0x4e5f0e(_0x2562ed);})[_0xa9c0('0x15')](function(_0x4468e1){logger[_0xa9c0('0x12')](_0xa9c0('0x16'),_0x4468e1[_0xa9c0('0x14')],_0x2e08bf);_0x46923a(_0xfd2c15[_0xa9c0('0x12')](0x1f4,_0x4468e1[_0xa9c0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 8adcc82..7880294 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x313cda,_0x2f99d5){var _0x2044d2=function(_0x712dfc){while(--_0x712dfc){_0x313cda['push'](_0x313cda['shift']());}};_0x2044d2(++_0x2f99d5);}(_0x757a,0xde));var _0xa757=function(_0x2532db,_0x4daf24){_0x2532db=_0x2532db-0x0;var _0x54d153=_0x757a[_0x2532db];return _0x54d153;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0x8603,0x190));var _0x3860=function(_0x115036,_0x2deb8b){_0x115036=_0x115036-0x0;var _0x2d7446=_0x8603[_0x115036];return _0x2d7446;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 3b33a8a..cf9a5d5 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ded=['TEXT','sequelize','exports','STRING','medium','out'];(function(_0x4e3e1b,_0x5e5a73){var _0x13dd55=function(_0x18367a){while(--_0x18367a){_0x4e3e1b['push'](_0x4e3e1b['shift']());}};_0x13dd55(++_0x5e5a73);}(_0x1ded,0x1db));var _0xd1de=function(_0x3eb637,_0x5ce141){_0x3eb637=_0x3eb637-0x0;var _0x4e3f12=_0x1ded[_0x3eb637];return _0x4e3f12;};'use strict';var Sequelize=require(_0xd1de('0x0'));module[_0xd1de('0x1')]={'uniqueid':{'type':Sequelize[_0xd1de('0x2')]},'body':{'type':Sequelize['TEXT'](_0xd1de('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd1de('0x4')),'defaultValue':_0xd1de('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd1de('0x2')]},'providerResponse':{'type':Sequelize[_0xd1de('0x5')]}}; \ No newline at end of file +var _0xe84c=['out','TEXT','sequelize','exports','STRING','medium','ENUM'];(function(_0x5a4674,_0x349aa5){var _0x1cfdba=function(_0x369b49){while(--_0x369b49){_0x5a4674['push'](_0x5a4674['shift']());}};_0x1cfdba(++_0x349aa5);}(_0xe84c,0x1ec));var _0xce84=function(_0x4ef086,_0x245456){_0x4ef086=_0x4ef086-0x0;var _0x58dfa6=_0xe84c[_0x4ef086];return _0x58dfa6;};'use strict';var Sequelize=require(_0xce84('0x0'));module[_0xce84('0x1')]={'uniqueid':{'type':Sequelize[_0xce84('0x2')]},'body':{'type':Sequelize['TEXT'](_0xce84('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xce84('0x4')]('in','out'),'defaultValue':_0xce84('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xce84('0x2')]},'providerResponse':{'type':Sequelize[_0xce84('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 075c13f..3a21ded 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6737=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','params','fields','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4bb496,_0x5a39ac){var _0x56ac5e=function(_0x5d9c){while(--_0x5d9c){_0x4bb496['push'](_0x4bb496['shift']());}};_0x56ac5e(++_0x5a39ac);}(_0x6737,0x11b));var _0x7673=function(_0x6baa0b,_0x53b3a8){_0x6baa0b=_0x6baa0b-0x0;var _0x2e7202=_0x6737[_0x6baa0b];return _0x2e7202;};'use strict';var emlformat=require(_0x7673('0x0'));var rimraf=require(_0x7673('0x1'));var zipdir=require(_0x7673('0x2'));var jsonpatch=require(_0x7673('0x3'));var rp=require('request-promise');var moment=require(_0x7673('0x4'));var BPromise=require(_0x7673('0x5'));var Mustache=require(_0x7673('0x6'));var util=require(_0x7673('0x7'));var path=require('path');var sox=require(_0x7673('0x8'));var csv=require(_0x7673('0x9'));var ejs=require(_0x7673('0xa'));var fs=require('fs');var fs_extra=require(_0x7673('0xb'));var _=require(_0x7673('0xc'));var squel=require(_0x7673('0xd'));var crypto=require(_0x7673('0xe'));var jsforce=require(_0x7673('0xf'));var deskjs=require(_0x7673('0x10'));var toCsv=require(_0x7673('0x9'));var querystring=require(_0x7673('0x11'));var Papa=require(_0x7673('0x12'));var Redis=require('ioredis');var authService=require(_0x7673('0x13'));var qs=require(_0x7673('0x14'));var as=require(_0x7673('0x15'));var hardwareService=require(_0x7673('0x16'));var logger=require(_0x7673('0x17'))(_0x7673('0x18'));var utils=require(_0x7673('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7673('0x1a'));var db=require(_0x7673('0x1b'))['db'];function respondWithStatusCode(_0x555b72,_0x475568){_0x475568=_0x475568||0xcc;return function(_0x434d89){if(_0x434d89){return _0x555b72[_0x7673('0x1c')](_0x475568);}return _0x555b72[_0x7673('0x1d')](_0x475568)['end']();};}function respondWithResult(_0x228527,_0x23dbc0){_0x23dbc0=_0x23dbc0||0xc8;return function(_0xc22a2b){if(_0xc22a2b){return _0x228527['status'](_0x23dbc0)['json'](_0xc22a2b);}};}function respondWithFilteredResult(_0x49080d,_0x3bb944){return function(_0x3b679c){if(_0x3b679c){var _0x470005=typeof _0x3bb944[_0x7673('0x1e')]===_0x7673('0x1f')&&typeof _0x3bb944['limit']==='undefined';var _0x388b4d=_0x3b679c[_0x7673('0x20')];var _0x14b029=_0x470005?0x0:_0x3bb944[_0x7673('0x1e')];var _0x5f3fa3=_0x470005?_0x3b679c[_0x7673('0x20')]:_0x3bb944[_0x7673('0x1e')]+_0x3bb944[_0x7673('0x21')];var _0x756450;if(_0x5f3fa3>=_0x388b4d){_0x5f3fa3=_0x388b4d;_0x756450=0xc8;}else{_0x756450=0xce;}_0x49080d[_0x7673('0x1d')](_0x756450);return _0x49080d[_0x7673('0x22')](_0x7673('0x23'),_0x14b029+'-'+_0x5f3fa3+'/'+_0x388b4d)['json'](_0x3b679c);}return null;};}function patchUpdates(_0x4ae790){return function(_0x3a45ea){try{jsonpatch['apply'](_0x3a45ea,_0x4ae790,!![]);}catch(_0x48d079){return BPromise['reject'](_0x48d079);}return _0x3a45ea[_0x7673('0x24')]();};}function saveUpdates(_0x3931b0,_0x3391f1){return function(_0x401b2e){if(_0x401b2e){return _0x401b2e[_0x7673('0x25')](_0x3931b0)[_0x7673('0x26')](function(_0x1057f2){return _0x1057f2;});}return null;};}function removeEntity(_0x5c4aa6,_0x386368){return function(_0x40331f){if(_0x40331f){return _0x40331f[_0x7673('0x27')]()[_0x7673('0x26')](function(){_0x5c4aa6[_0x7673('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2efb0d,_0x2e1f87){return function(_0x2114eb){if(!_0x2114eb){_0x2efb0d[_0x7673('0x1c')](0x194);}return _0x2114eb;};}function handleError(_0x2131e4,_0x37dab9){_0x37dab9=_0x37dab9||0x1f4;return function(_0x391f9c){logger[_0x7673('0x28')](_0x391f9c[_0x7673('0x29')]);if(_0x391f9c[_0x7673('0x2a')]){delete _0x391f9c[_0x7673('0x2a')];}_0x2131e4[_0x7673('0x1d')](_0x37dab9)['send'](_0x391f9c);};}exports[_0x7673('0x2b')]=function(_0xd3951e,_0x581ce2){var _0x1fb686={},_0x1598ea={},_0x31e55c={'count':0x0,'rows':[]};var _0x524bef=_[_0x7673('0x2c')](db[_0x7673('0x2d')][_0x7673('0x2e')],function(_0x43bbf4){return{'name':_0x43bbf4[_0x7673('0x2f')],'type':_0x43bbf4[_0x7673('0x30')][_0x7673('0x31')]};});_0x1598ea[_0x7673('0x32')]=_['map'](_0x524bef,_0x7673('0x2a'));_0x1598ea[_0x7673('0x33')]=_[_0x7673('0x34')](_0xd3951e[_0x7673('0x33')]);_0x1598ea[_0x7673('0x35')]=_[_0x7673('0x36')](_0x1598ea[_0x7673('0x32')],_0x1598ea['query']);_0x1fb686[_0x7673('0x37')]=_[_0x7673('0x36')](_0x1598ea[_0x7673('0x32')],qs['fields'](_0xd3951e[_0x7673('0x33')]['fields']));_0x1fb686[_0x7673('0x37')]=_0x1fb686[_0x7673('0x37')]['length']?_0x1fb686[_0x7673('0x37')]:_0x1598ea[_0x7673('0x32')];if(!_0xd3951e[_0x7673('0x33')]['hasOwnProperty'](_0x7673('0x38'))){_0x1fb686[_0x7673('0x21')]=qs[_0x7673('0x21')](_0xd3951e[_0x7673('0x33')][_0x7673('0x21')]);_0x1fb686[_0x7673('0x1e')]=qs[_0x7673('0x1e')](_0xd3951e['query']['offset']);}_0x1fb686['order']=qs['sort'](_0xd3951e[_0x7673('0x33')][_0x7673('0x39')]);_0x1fb686['where']=qs[_0x7673('0x35')](_[_0x7673('0x3a')](_0xd3951e[_0x7673('0x33')],_0x1598ea[_0x7673('0x35')]),_0x524bef);if(_0xd3951e[_0x7673('0x33')][_0x7673('0x3b')]){_0x1fb686['where']=_[_0x7673('0x3c')](_0x1fb686[_0x7673('0x3d')],{'$or':_['map'](_0x524bef,function(_0x2e7aa1){if(_0x2e7aa1['type']!=='VIRTUAL'){var _0xf26b4d={};_0xf26b4d[_0x2e7aa1[_0x7673('0x2a')]]={'$like':'%'+_0xd3951e[_0x7673('0x33')][_0x7673('0x3b')]+'%'};return _0xf26b4d;}})});}_0x1fb686=_[_0x7673('0x3c')]({},_0x1fb686,_0xd3951e[_0x7673('0x3e')]);var _0x2ad65a={'where':_0x1fb686[_0x7673('0x3d')]};return db[_0x7673('0x2d')][_0x7673('0x20')](_0x2ad65a)[_0x7673('0x26')](function(_0x30cb30){_0x31e55c[_0x7673('0x20')]=_0x30cb30;if(_0xd3951e[_0x7673('0x33')][_0x7673('0x3f')]){_0x1fb686[_0x7673('0x40')]=[{'all':!![]}];}return db[_0x7673('0x2d')][_0x7673('0x41')](_0x1fb686);})['then'](function(_0x9b6536){_0x31e55c[_0x7673('0x42')]=_0x9b6536;return _0x31e55c;})[_0x7673('0x26')](respondWithFilteredResult(_0x581ce2,_0x1fb686))['catch'](handleError(_0x581ce2,null));};exports['show']=function(_0x4627c1,_0x18e2ee){var _0x511419={'raw':!![],'where':{'id':_0x4627c1[_0x7673('0x43')]['id']}},_0x46d362={};_0x46d362[_0x7673('0x32')]=_[_0x7673('0x34')](db['SquareMessage'][_0x7673('0x2e')]);_0x46d362[_0x7673('0x33')]=_[_0x7673('0x34')](_0x4627c1[_0x7673('0x33')]);_0x46d362[_0x7673('0x35')]=_[_0x7673('0x36')](_0x46d362[_0x7673('0x32')],_0x46d362['query']);_0x511419['attributes']=_[_0x7673('0x36')](_0x46d362[_0x7673('0x32')],qs[_0x7673('0x44')](_0x4627c1[_0x7673('0x33')]['fields']));_0x511419[_0x7673('0x37')]=_0x511419[_0x7673('0x37')][_0x7673('0x45')]?_0x511419[_0x7673('0x37')]:_0x46d362[_0x7673('0x32')];if(_0x4627c1['query']['includeAll']){_0x511419[_0x7673('0x40')]=[{'all':!![]}];}_0x511419=_[_0x7673('0x3c')]({},_0x511419,_0x4627c1['options']);return db[_0x7673('0x2d')][_0x7673('0x46')](_0x511419)[_0x7673('0x26')](handleEntityNotFound(_0x18e2ee,null))[_0x7673('0x26')](respondWithResult(_0x18e2ee,null))[_0x7673('0x47')](handleError(_0x18e2ee,null));};exports[_0x7673('0x48')]=function(_0x3fa8ec,_0x573c57){return db[_0x7673('0x2d')]['create'](_0x3fa8ec[_0x7673('0x49')],{})[_0x7673('0x26')](respondWithResult(_0x573c57,0xc9))['catch'](handleError(_0x573c57,null));};exports['update']=function(_0x79b50a,_0x43a355){if(_0x79b50a[_0x7673('0x49')]['id']){delete _0x79b50a[_0x7673('0x49')]['id'];}return db[_0x7673('0x2d')][_0x7673('0x46')]({'where':{'id':_0x79b50a[_0x7673('0x43')]['id']}})['then'](handleEntityNotFound(_0x43a355,null))[_0x7673('0x26')](saveUpdates(_0x79b50a[_0x7673('0x49')],null))[_0x7673('0x26')](respondWithResult(_0x43a355,null))[_0x7673('0x47')](handleError(_0x43a355,null));};exports['destroy']=function(_0x2fc899,_0x1cd428){return db['SquareMessage'][_0x7673('0x46')]({'where':{'id':_0x2fc899[_0x7673('0x43')]['id']}})[_0x7673('0x26')](handleEntityNotFound(_0x1cd428,null))[_0x7673('0x26')](removeEntity(_0x1cd428,null))[_0x7673('0x47')](handleError(_0x1cd428,null));}; \ No newline at end of file +var _0x6e9b=['include','findAll','rows','show','find','catch','create','params','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll'];(function(_0x3cdbcd,_0x1f8930){var _0x12b687=function(_0xfc9063){while(--_0xfc9063){_0x3cdbcd['push'](_0x3cdbcd['shift']());}};_0x12b687(++_0x1f8930);}(_0x6e9b,0xea));var _0xb6e9=function(_0x45a784,_0x4443e2){_0x45a784=_0x45a784-0x0;var _0x32a138=_0x6e9b[_0x45a784];return _0x32a138;};'use strict';var emlformat=require(_0xb6e9('0x0'));var rimraf=require(_0xb6e9('0x1'));var zipdir=require(_0xb6e9('0x2'));var jsonpatch=require(_0xb6e9('0x3'));var rp=require(_0xb6e9('0x4'));var moment=require('moment');var BPromise=require(_0xb6e9('0x5'));var Mustache=require(_0xb6e9('0x6'));var util=require(_0xb6e9('0x7'));var path=require('path');var sox=require(_0xb6e9('0x8'));var csv=require(_0xb6e9('0x9'));var ejs=require(_0xb6e9('0xa'));var fs=require('fs');var fs_extra=require(_0xb6e9('0xb'));var _=require(_0xb6e9('0xc'));var squel=require(_0xb6e9('0xd'));var crypto=require(_0xb6e9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb6e9('0xf'));var toCsv=require(_0xb6e9('0x9'));var querystring=require(_0xb6e9('0x10'));var Papa=require(_0xb6e9('0x11'));var Redis=require(_0xb6e9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb6e9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb6e9('0x14'));var utils=require(_0xb6e9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb6e9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2209df,_0xe6c44a){_0xe6c44a=_0xe6c44a||0xcc;return function(_0x3bd4e2){if(_0x3bd4e2){return _0x2209df[_0xb6e9('0x17')](_0xe6c44a);}return _0x2209df['status'](_0xe6c44a)[_0xb6e9('0x18')]();};}function respondWithResult(_0x4e0abc,_0x92e54c){_0x92e54c=_0x92e54c||0xc8;return function(_0xb14b72){if(_0xb14b72){return _0x4e0abc[_0xb6e9('0x19')](_0x92e54c)[_0xb6e9('0x1a')](_0xb14b72);}};}function respondWithFilteredResult(_0x3c5b8e,_0x348be6){return function(_0x1cf84d){if(_0x1cf84d){var _0x2777b8=typeof _0x348be6[_0xb6e9('0x1b')]===_0xb6e9('0x1c')&&typeof _0x348be6[_0xb6e9('0x1d')]===_0xb6e9('0x1c');var _0x2c1f07=_0x1cf84d['count'];var _0xca2aaa=_0x2777b8?0x0:_0x348be6[_0xb6e9('0x1b')];var _0xc4c632=_0x2777b8?_0x1cf84d[_0xb6e9('0x1e')]:_0x348be6[_0xb6e9('0x1b')]+_0x348be6['limit'];var _0xb59de7;if(_0xc4c632>=_0x2c1f07){_0xc4c632=_0x2c1f07;_0xb59de7=0xc8;}else{_0xb59de7=0xce;}_0x3c5b8e['status'](_0xb59de7);return _0x3c5b8e['set'](_0xb6e9('0x1f'),_0xca2aaa+'-'+_0xc4c632+'/'+_0x2c1f07)[_0xb6e9('0x1a')](_0x1cf84d);}return null;};}function patchUpdates(_0x4ba58e){return function(_0x4b35e7){try{jsonpatch[_0xb6e9('0x20')](_0x4b35e7,_0x4ba58e,!![]);}catch(_0x32736f){return BPromise[_0xb6e9('0x21')](_0x32736f);}return _0x4b35e7[_0xb6e9('0x22')]();};}function saveUpdates(_0x2888d7,_0x4f1252){return function(_0x449567){if(_0x449567){return _0x449567[_0xb6e9('0x23')](_0x2888d7)[_0xb6e9('0x24')](function(_0x2f28e0){return _0x2f28e0;});}return null;};}function removeEntity(_0x4e0c16,_0x494914){return function(_0x535531){if(_0x535531){return _0x535531[_0xb6e9('0x25')]()[_0xb6e9('0x24')](function(){_0x4e0c16[_0xb6e9('0x19')](0xcc)[_0xb6e9('0x18')]();});}};}function handleEntityNotFound(_0x63f7b9,_0x39bdf0){return function(_0x1d3e56){if(!_0x1d3e56){_0x63f7b9[_0xb6e9('0x17')](0x194);}return _0x1d3e56;};}function handleError(_0x5083df,_0x3b0cc){_0x3b0cc=_0x3b0cc||0x1f4;return function(_0x4d20f9){logger[_0xb6e9('0x26')](_0x4d20f9[_0xb6e9('0x27')]);if(_0x4d20f9[_0xb6e9('0x28')]){delete _0x4d20f9['name'];}_0x5083df['status'](_0x3b0cc)[_0xb6e9('0x29')](_0x4d20f9);};}exports[_0xb6e9('0x2a')]=function(_0x343af5,_0x4b054d){var _0x9da66c={},_0x2abb3b={},_0x548b6c={'count':0x0,'rows':[]};var _0x311d30=_[_0xb6e9('0x2b')](db[_0xb6e9('0x2c')][_0xb6e9('0x2d')],function(_0x5dd6a2){return{'name':_0x5dd6a2['fieldName'],'type':_0x5dd6a2[_0xb6e9('0x2e')][_0xb6e9('0x2f')]};});_0x2abb3b[_0xb6e9('0x30')]=_[_0xb6e9('0x2b')](_0x311d30,_0xb6e9('0x28'));_0x2abb3b[_0xb6e9('0x31')]=_[_0xb6e9('0x32')](_0x343af5['query']);_0x2abb3b[_0xb6e9('0x33')]=_[_0xb6e9('0x34')](_0x2abb3b['model'],_0x2abb3b[_0xb6e9('0x31')]);_0x9da66c[_0xb6e9('0x35')]=_[_0xb6e9('0x34')](_0x2abb3b[_0xb6e9('0x30')],qs['fields'](_0x343af5[_0xb6e9('0x31')][_0xb6e9('0x36')]));_0x9da66c[_0xb6e9('0x35')]=_0x9da66c[_0xb6e9('0x35')][_0xb6e9('0x37')]?_0x9da66c[_0xb6e9('0x35')]:_0x2abb3b[_0xb6e9('0x30')];if(!_0x343af5[_0xb6e9('0x31')][_0xb6e9('0x38')](_0xb6e9('0x39'))){_0x9da66c[_0xb6e9('0x1d')]=qs[_0xb6e9('0x1d')](_0x343af5[_0xb6e9('0x31')][_0xb6e9('0x1d')]);_0x9da66c['offset']=qs[_0xb6e9('0x1b')](_0x343af5[_0xb6e9('0x31')][_0xb6e9('0x1b')]);}_0x9da66c[_0xb6e9('0x3a')]=qs[_0xb6e9('0x3b')](_0x343af5[_0xb6e9('0x31')][_0xb6e9('0x3b')]);_0x9da66c[_0xb6e9('0x3c')]=qs['filters'](_['pick'](_0x343af5['query'],_0x2abb3b['filters']),_0x311d30);if(_0x343af5[_0xb6e9('0x31')][_0xb6e9('0x3d')]){_0x9da66c['where']=_[_0xb6e9('0x3e')](_0x9da66c['where'],{'$or':_[_0xb6e9('0x2b')](_0x311d30,function(_0x56501c){if(_0x56501c['type']!==_0xb6e9('0x3f')){var _0x3e3d7f={};_0x3e3d7f[_0x56501c[_0xb6e9('0x28')]]={'$like':'%'+_0x343af5[_0xb6e9('0x31')][_0xb6e9('0x3d')]+'%'};return _0x3e3d7f;}})});}_0x9da66c=_[_0xb6e9('0x3e')]({},_0x9da66c,_0x343af5[_0xb6e9('0x40')]);var _0x176432={'where':_0x9da66c[_0xb6e9('0x3c')]};return db[_0xb6e9('0x2c')]['count'](_0x176432)['then'](function(_0x2f3fb3){_0x548b6c[_0xb6e9('0x1e')]=_0x2f3fb3;if(_0x343af5[_0xb6e9('0x31')][_0xb6e9('0x41')]){_0x9da66c[_0xb6e9('0x42')]=[{'all':!![]}];}return db[_0xb6e9('0x2c')][_0xb6e9('0x43')](_0x9da66c);})[_0xb6e9('0x24')](function(_0x453edf){_0x548b6c[_0xb6e9('0x44')]=_0x453edf;return _0x548b6c;})[_0xb6e9('0x24')](respondWithFilteredResult(_0x4b054d,_0x9da66c))['catch'](handleError(_0x4b054d,null));};exports[_0xb6e9('0x45')]=function(_0x140723,_0x13115a){var _0x3db397={'raw':!![],'where':{'id':_0x140723['params']['id']}},_0x5e0bb4={};_0x5e0bb4[_0xb6e9('0x30')]=_[_0xb6e9('0x32')](db[_0xb6e9('0x2c')][_0xb6e9('0x2d')]);_0x5e0bb4['query']=_[_0xb6e9('0x32')](_0x140723[_0xb6e9('0x31')]);_0x5e0bb4[_0xb6e9('0x33')]=_['intersection'](_0x5e0bb4[_0xb6e9('0x30')],_0x5e0bb4[_0xb6e9('0x31')]);_0x3db397[_0xb6e9('0x35')]=_['intersection'](_0x5e0bb4['model'],qs['fields'](_0x140723[_0xb6e9('0x31')]['fields']));_0x3db397[_0xb6e9('0x35')]=_0x3db397[_0xb6e9('0x35')][_0xb6e9('0x37')]?_0x3db397['attributes']:_0x5e0bb4[_0xb6e9('0x30')];if(_0x140723['query']['includeAll']){_0x3db397[_0xb6e9('0x42')]=[{'all':!![]}];}_0x3db397=_[_0xb6e9('0x3e')]({},_0x3db397,_0x140723['options']);return db[_0xb6e9('0x2c')][_0xb6e9('0x46')](_0x3db397)[_0xb6e9('0x24')](handleEntityNotFound(_0x13115a,null))[_0xb6e9('0x24')](respondWithResult(_0x13115a,null))[_0xb6e9('0x47')](handleError(_0x13115a,null));};exports[_0xb6e9('0x48')]=function(_0x375bde,_0x2dea57){return db[_0xb6e9('0x2c')][_0xb6e9('0x48')](_0x375bde['body'],{})[_0xb6e9('0x24')](respondWithResult(_0x2dea57,0xc9))[_0xb6e9('0x47')](handleError(_0x2dea57,null));};exports[_0xb6e9('0x23')]=function(_0x45b4cf,_0x397e19){if(_0x45b4cf['body']['id']){delete _0x45b4cf['body']['id'];}return db['SquareMessage'][_0xb6e9('0x46')]({'where':{'id':_0x45b4cf[_0xb6e9('0x49')]['id']}})[_0xb6e9('0x24')](handleEntityNotFound(_0x397e19,null))[_0xb6e9('0x24')](saveUpdates(_0x45b4cf[_0xb6e9('0x4a')],null))[_0xb6e9('0x24')](respondWithResult(_0x397e19,null))[_0xb6e9('0x47')](handleError(_0x397e19,null));};exports[_0xb6e9('0x25')]=function(_0x48a22b,_0x318608){return db['SquareMessage'][_0xb6e9('0x46')]({'where':{'id':_0x48a22b[_0xb6e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x318608,null))[_0xb6e9('0x24')](removeEntity(_0x318608,null))['catch'](handleError(_0x318608,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index a4e2b85..aadfcd5 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0659=['request-promise','path','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x0659,0x1de));var _0x9065=function(_0x46199b,_0x1158b8){_0x46199b=_0x46199b-0x0;var _0x14ce2a=_0x0659[_0x46199b];return _0x14ce2a;};'use strict';var _=require(_0x9065('0x0'));var util=require(_0x9065('0x1'));var logger=require(_0x9065('0x2'))(_0x9065('0x3'));var moment=require(_0x9065('0x4'));var BPromise=require(_0x9065('0x5'));var rp=require(_0x9065('0x6'));var fs=require('fs');var path=require(_0x9065('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9065('0x8'));module[_0x9065('0x9')]=function(_0x507d24,_0x44fbf3){return _0x507d24[_0x9065('0xa')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcba8=['moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util','../../config/logger','api'];(function(_0x598ee8,_0x9b6e82){var _0x472748=function(_0x1a1e3f){while(--_0x1a1e3f){_0x598ee8['push'](_0x598ee8['shift']());}};_0x472748(++_0x9b6e82);}(_0xcba8,0x169));var _0x8cba=function(_0x57a540,_0x352832){_0x57a540=_0x57a540-0x0;var _0x31eac0=_0xcba8[_0x57a540];return _0x31eac0;};'use strict';var _=require('lodash');var util=require(_0x8cba('0x0'));var logger=require(_0x8cba('0x1'))(_0x8cba('0x2'));var moment=require(_0x8cba('0x3'));var BPromise=require(_0x8cba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cba('0x5'));var rimraf=require(_0x8cba('0x6'));var config=require(_0x8cba('0x7'));var attributes=require(_0x8cba('0x8'));module[_0x8cba('0x9')]=function(_0x2f1566,_0x2474b9){return _0x2f1566[_0x8cba('0xa')](_0x8cba('0xb'),attributes,{'tableName':_0x8cba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index eb75833..c74d091 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36e8=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36684d,_0x1feb17){var _0x2f4d3e=function(_0x2b761f){while(--_0x2b761f){_0x36684d['push'](_0x36684d['shift']());}};_0x2f4d3e(++_0x1feb17);}(_0x36e8,0x1c9));var _0x836e=function(_0x191c40,_0x274ed9){_0x191c40=_0x191c40-0x0;var _0x5c9b70=_0x36e8[_0x191c40];return _0x5c9b70;};'use strict';var _=require(_0x836e('0x0'));var util=require(_0x836e('0x1'));var moment=require(_0x836e('0x2'));var BPromise=require(_0x836e('0x3'));var rs=require(_0x836e('0x4'));var fs=require('fs');var Redis=require(_0x836e('0x5'));var db=require(_0x836e('0x6'))['db'];var utils=require(_0x836e('0x7'));var logger=require(_0x836e('0x8'))(_0x836e('0x9'));var config=require('../../config/environment');var jayson=require(_0x836e('0xa'));var client=jayson['client'][_0x836e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ce962,_0x37d867,_0x14104f){return new BPromise(function(_0x46afd7,_0xeda92b){return client[_0x836e('0xc')](_0x4ce962,_0x14104f)[_0x836e('0xd')](function(_0x11ee0e){logger[_0x836e('0xe')](_0x836e('0xf'),_0x37d867,_0x836e('0x10'));logger[_0x836e('0x11')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x37d867,_0x836e('0x10'),JSON['stringify'](_0x11ee0e));if(_0x11ee0e[_0x836e('0x12')]){if(_0x11ee0e['error'][_0x836e('0x13')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x37d867,_0x11ee0e[_0x836e('0x12')]['message']);return _0xeda92b(_0x11ee0e[_0x836e('0x12')][_0x836e('0x14')]);}logger[_0x836e('0x12')](_0x836e('0xf'),_0x37d867,_0x11ee0e[_0x836e('0x12')][_0x836e('0x14')]);return _0x46afd7(_0x11ee0e[_0x836e('0x12')]['message']);}else{logger['info'](_0x836e('0xf'),_0x37d867,'request\x20sent');_0x46afd7(_0x11ee0e['result'][_0x836e('0x14')]);}})[_0x836e('0x15')](function(_0xd9e6ad){logger[_0x836e('0x12')](_0x836e('0xf'),_0x37d867,_0xd9e6ad);_0xeda92b(_0xd9e6ad);});});}exports[_0x836e('0x16')]=function(_0xecccd9){var _0x504dd8=this;return new Promise(function(_0x1fb489,_0x5a700a){return db[_0x836e('0x17')][_0x836e('0x18')](_0xecccd9[_0x836e('0x19')],{'raw':_0xecccd9[_0x836e('0x1a')]?_0xecccd9[_0x836e('0x1a')][_0x836e('0x1b')]===undefined?!![]:![]:!![]})[_0x836e('0xd')](function(_0x4d8a4a){logger[_0x836e('0xe')]('CreateSquareMessage',_0xecccd9);logger[_0x836e('0x11')]('CreateSquareMessage',_0xecccd9,JSON[_0x836e('0x1c')](_0x4d8a4a));_0x1fb489(_0x4d8a4a);})[_0x836e('0x15')](function(_0x33a9e8){logger[_0x836e('0x12')](_0x836e('0x16'),_0x33a9e8[_0x836e('0x14')],_0xecccd9);_0x5a700a(_0x504dd8['error'](0x1f4,_0x33a9e8['message']));});});}; \ No newline at end of file +var _0x67c9=['create','body','options','debug','lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x4b56ba,_0x4108ab){var _0x509a8f=function(_0x1d662b){while(--_0x1d662b){_0x4b56ba['push'](_0x4b56ba['shift']());}};_0x509a8f(++_0x4108ab);}(_0x67c9,0xa6));var _0x967c=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x67c9[_0x3b7b8a];return _0x441206;};'use strict';var _=require(_0x967c('0x0'));var util=require(_0x967c('0x1'));var moment=require('moment');var BPromise=require(_0x967c('0x2'));var rs=require(_0x967c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x967c('0x4'))(_0x967c('0x5'));var config=require('../../config/environment');var jayson=require(_0x967c('0x6'));var client=jayson[_0x967c('0x7')][_0x967c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f3847,_0x4ad333,_0x345b00){return new BPromise(function(_0x194ebf,_0x2468c0){return client[_0x967c('0x9')](_0x4f3847,_0x345b00)[_0x967c('0xa')](function(_0xbbbf53){logger[_0x967c('0xb')](_0x967c('0xc'),_0x4ad333,_0x967c('0xd'));logger['debug'](_0x967c('0xe'),_0x4ad333,_0x967c('0xd'),JSON[_0x967c('0xf')](_0xbbbf53));if(_0xbbbf53[_0x967c('0x10')]){if(_0xbbbf53[_0x967c('0x10')][_0x967c('0x11')]===0x1f4){logger[_0x967c('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4ad333,_0xbbbf53[_0x967c('0x10')][_0x967c('0x12')]);return _0x2468c0(_0xbbbf53[_0x967c('0x10')][_0x967c('0x12')]);}logger[_0x967c('0x10')](_0x967c('0xc'),_0x4ad333,_0xbbbf53[_0x967c('0x10')][_0x967c('0x12')]);return _0x194ebf(_0xbbbf53[_0x967c('0x10')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x4ad333,_0x967c('0xd'));_0x194ebf(_0xbbbf53[_0x967c('0x13')][_0x967c('0x12')]);}})[_0x967c('0x14')](function(_0x306151){logger[_0x967c('0x10')](_0x967c('0xc'),_0x4ad333,_0x306151);_0x2468c0(_0x306151);});});}exports[_0x967c('0x15')]=function(_0x293465){var _0x45d114=this;return new Promise(function(_0x4dfd3d,_0x697348){return db[_0x967c('0x16')][_0x967c('0x17')](_0x293465[_0x967c('0x18')],{'raw':_0x293465[_0x967c('0x19')]?_0x293465[_0x967c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x967c('0xa')](function(_0x1fe2b6){logger['info'](_0x967c('0x15'),_0x293465);logger[_0x967c('0x1a')](_0x967c('0x15'),_0x293465,JSON[_0x967c('0xf')](_0x1fe2b6));_0x4dfd3d(_0x1fe2b6);})[_0x967c('0x14')](function(_0x2a4b0c){logger[_0x967c('0x10')](_0x967c('0x15'),_0x2a4b0c['message'],_0x293465);_0x697348(_0x45d114[_0x967c('0x10')](0x1f4,_0x2a4b0c[_0x967c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index acb0ab8..23cf07b 100644 --- a/server/api/squareOdbc/index.js +++ b/server/api/squareOdbc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x708f=['index','get','isAuthenticated','show','/:id/test','15s','test','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller'];(function(_0x42bda0,_0x3018f0){var _0x4022d6=function(_0x2472ae){while(--_0x2472ae){_0x42bda0['push'](_0x42bda0['shift']());}};_0x4022d6(++_0x3018f0);}(_0x708f,0x17e));var _0xf708=function(_0x2543f7,_0x5ec1e0){_0x2543f7=_0x2543f7-0x0;var _0x2fde5d=_0x708f[_0x2543f7];return _0x2fde5d;};'use strict';var multer=require(_0xf708('0x0'));var util=require(_0xf708('0x1'));var path=require('path');var timeout=require(_0xf708('0x2'));var express=require(_0xf708('0x3'));var router=express[_0xf708('0x4')]();var fs_extra=require(_0xf708('0x5'));var auth=require(_0xf708('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf708('0x7'));var controller=require(_0xf708('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf708('0x9')]);router[_0xf708('0xa')]('/:id',auth[_0xf708('0xb')](),controller[_0xf708('0xc')]);router[_0xf708('0xa')](_0xf708('0xd'),auth[_0xf708('0xb')](),timeout(_0xf708('0xe')),controller[_0xf708('0xf')]);router[_0xf708('0x10')]('/',auth['isAuthenticated'](),controller[_0xf708('0x11')]);router[_0xf708('0x12')]('/:id',auth[_0xf708('0xb')](),controller[_0xf708('0x13')]);router['delete'](_0xf708('0x14'),auth[_0xf708('0xb')](),controller[_0xf708('0x15')]);module[_0xf708('0x16')]=router; \ No newline at end of file +var _0x58f0=['fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','delete','util','connect-timeout','express','Router'];(function(_0x2709fb,_0x54aeb0){var _0x216f0b=function(_0x2b0cc3){while(--_0x2b0cc3){_0x2709fb['push'](_0x2709fb['shift']());}};_0x216f0b(++_0x54aeb0);}(_0x58f0,0xbc));var _0x058f=function(_0x1b05b9,_0x131f04){_0x1b05b9=_0x1b05b9-0x0;var _0x53109d=_0x58f0[_0x1b05b9];return _0x53109d;};'use strict';var multer=require('multer');var util=require(_0x058f('0x0'));var path=require('path');var timeout=require(_0x058f('0x1'));var express=require(_0x058f('0x2'));var router=express[_0x058f('0x3')]();var fs_extra=require(_0x058f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x058f('0x5'));var config=require(_0x058f('0x6'));var controller=require(_0x058f('0x7'));router[_0x058f('0x8')]('/',auth[_0x058f('0x9')](),controller[_0x058f('0xa')]);router[_0x058f('0x8')](_0x058f('0xb'),auth[_0x058f('0x9')](),controller['show']);router[_0x058f('0x8')](_0x058f('0xc'),auth[_0x058f('0x9')](),timeout(_0x058f('0xd')),controller[_0x058f('0xe')]);router['post']('/',auth[_0x058f('0x9')](),controller['create']);router['put'](_0x058f('0xb'),auth[_0x058f('0x9')](),controller['update']);router[_0x058f('0xf')](_0x058f('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5425767..530ef19 100644 --- a/server/api/squareOdbc/squareOdbc.attributes.js +++ b/server/api/squareOdbc/squareOdbc.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae08=['name','sequelize','STRING'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xae08,0x175));var _0x8ae0=function(_0x581b93,_0xfc0d17){_0x581b93=_0x581b93-0x0;var _0xc43db7=_0xae08[_0x581b93];return _0xc43db7;};'use strict';var Sequelize=require(_0x8ae0('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ae0('0x1')],'unique':_0x8ae0('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8ae0('0x1')]},'description':{'type':Sequelize[_0x8ae0('0x1')]}}; \ No newline at end of file +var _0xc6dc=['STRING','name','exports'];(function(_0x733026,_0x5ea206){var _0x2db566=function(_0x203acf){while(--_0x203acf){_0x733026['push'](_0x733026['shift']());}};_0x2db566(++_0x5ea206);}(_0xc6dc,0xd7));var _0xcc6d=function(_0x12a30d,_0x4fad45){_0x12a30d=_0x12a30d-0x0;var _0xa4aba1=_0xc6dc[_0x12a30d];return _0xa4aba1;};'use strict';var Sequelize=require('sequelize');module[_0xcc6d('0x0')]={'name':{'type':Sequelize[_0xcc6d('0x1')],'unique':_0xcc6d('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xcc6d('0x1')]},'description':{'type':Sequelize[_0xcc6d('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0dc2073..0d82749 100644 --- a/server/api/squareOdbc/squareOdbc.controller.js +++ b/server/api/squareOdbc/squareOdbc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c56=['openSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','then','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc'];(function(_0x239b5a,_0x56199a){var _0x5a701c=function(_0x3cdf2d){while(--_0x3cdf2d){_0x239b5a['push'](_0x239b5a['shift']());}};_0x5a701c(++_0x56199a);}(_0x7c56,0xb1));var _0x67c5=function(_0xf831bc,_0x5e1e9a){_0xf831bc=_0xf831bc-0x0;var _0x24e3f2=_0x7c56[_0xf831bc];return _0x24e3f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x67c5('0x0'));var jsonpatch=require(_0x67c5('0x1'));var rp=require(_0x67c5('0x2'));var moment=require(_0x67c5('0x3'));var BPromise=require(_0x67c5('0x4'));var Mustache=require(_0x67c5('0x5'));var util=require(_0x67c5('0x6'));var path=require(_0x67c5('0x7'));var sox=require(_0x67c5('0x8'));var csv=require('to-csv');var ejs=require(_0x67c5('0x9'));var fs=require('fs');var fs_extra=require(_0x67c5('0xa'));var _=require(_0x67c5('0xb'));var squel=require(_0x67c5('0xc'));var crypto=require(_0x67c5('0xd'));var jsforce=require(_0x67c5('0xe'));var deskjs=require(_0x67c5('0xf'));var toCsv=require(_0x67c5('0x10'));var querystring=require(_0x67c5('0x11'));var Papa=require('papaparse');var Redis=require(_0x67c5('0x12'));var authService=require(_0x67c5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x67c5('0x14'));var hardwareService=require(_0x67c5('0x15'));var logger=require(_0x67c5('0x16'))(_0x67c5('0x17'));var utils=require(_0x67c5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x67c5('0x19'));var db=require(_0x67c5('0x1a'))['db'];function respondWithStatusCode(_0x1b2d7a,_0x572541){_0x572541=_0x572541||0xcc;return function(_0x255580){if(_0x255580){return _0x1b2d7a[_0x67c5('0x1b')](_0x572541);}return _0x1b2d7a[_0x67c5('0x1c')](_0x572541)[_0x67c5('0x1d')]();};}function respondWithResult(_0x28d2e4,_0x2109cb){_0x2109cb=_0x2109cb||0xc8;return function(_0x36bdb0){if(_0x36bdb0){return _0x28d2e4[_0x67c5('0x1c')](_0x2109cb)[_0x67c5('0x1e')](_0x36bdb0);}};}function respondWithFilteredResult(_0x18d291,_0x19e3fc){return function(_0x57d606){if(_0x57d606){var _0x42ae41=typeof _0x19e3fc[_0x67c5('0x1f')]==='undefined'&&typeof _0x19e3fc[_0x67c5('0x20')]===_0x67c5('0x21');var _0x23c439=_0x57d606[_0x67c5('0x22')];var _0x333d94=_0x42ae41?0x0:_0x19e3fc[_0x67c5('0x1f')];var _0x4e45bb=_0x42ae41?_0x57d606[_0x67c5('0x22')]:_0x19e3fc['offset']+_0x19e3fc[_0x67c5('0x20')];var _0x2835e7;if(_0x4e45bb>=_0x23c439){_0x4e45bb=_0x23c439;_0x2835e7=0xc8;}else{_0x2835e7=0xce;}_0x18d291[_0x67c5('0x1c')](_0x2835e7);return _0x18d291[_0x67c5('0x23')]('Content-Range',_0x333d94+'-'+_0x4e45bb+'/'+_0x23c439)[_0x67c5('0x1e')](_0x57d606);}return null;};}function patchUpdates(_0x3ce60a){return function(_0x3502d3){try{jsonpatch['apply'](_0x3502d3,_0x3ce60a,!![]);}catch(_0xe11fc4){return BPromise[_0x67c5('0x24')](_0xe11fc4);}return _0x3502d3[_0x67c5('0x25')]();};}function saveUpdates(_0x45ccb1,_0x4c5404){return function(_0x3bf349){if(_0x3bf349){return _0x3bf349['update'](_0x45ccb1)[_0x67c5('0x26')](function(_0x26eb20){return _0x26eb20;});}return null;};}function removeEntity(_0x28ae5b,_0x4f9588){return function(_0x3aeedc){if(_0x3aeedc){return _0x3aeedc['destroy']()[_0x67c5('0x26')](function(){var _0x277d2f=_0x3aeedc['get']({'plain':!![]});var _0x1d3566=_0x67c5('0x27');return db[_0x67c5('0x28')][_0x67c5('0x29')]({'where':{'type':_0x1d3566,'resourceId':_0x277d2f['id']}})[_0x67c5('0x26')](function(){return _0x3aeedc;});})[_0x67c5('0x26')](function(){_0x28ae5b['status'](0xcc)[_0x67c5('0x1d')]();});}};}function handleEntityNotFound(_0x51fee3,_0x5e7608){return function(_0x6e5967){if(!_0x6e5967){_0x51fee3['sendStatus'](0x194);}return _0x6e5967;};}function handleError(_0x2d5aa1,_0x711f36){_0x711f36=_0x711f36||0x1f4;return function(_0x4a667a){logger[_0x67c5('0x2a')](_0x4a667a[_0x67c5('0x2b')]);if(_0x4a667a[_0x67c5('0x2c')]){delete _0x4a667a[_0x67c5('0x2c')];}_0x2d5aa1[_0x67c5('0x1c')](_0x711f36)[_0x67c5('0x2d')](_0x4a667a);};}exports[_0x67c5('0x2e')]=function(_0x1d8488,_0x2806ad){var _0x97e7a5={},_0x332ecd={},_0x3cc83c={'count':0x0,'rows':[]};var _0x5748ce=_[_0x67c5('0x2f')](db['SquareOdbc'][_0x67c5('0x30')],function(_0x575a81){return{'name':_0x575a81[_0x67c5('0x31')],'type':_0x575a81[_0x67c5('0x32')][_0x67c5('0x33')]};});_0x332ecd[_0x67c5('0x34')]=_[_0x67c5('0x2f')](_0x5748ce,'name');_0x332ecd[_0x67c5('0x35')]=_['keys'](_0x1d8488[_0x67c5('0x35')]);_0x332ecd[_0x67c5('0x36')]=_[_0x67c5('0x37')](_0x332ecd['model'],_0x332ecd['query']);_0x97e7a5[_0x67c5('0x38')]=_[_0x67c5('0x37')](_0x332ecd[_0x67c5('0x34')],qs[_0x67c5('0x39')](_0x1d8488[_0x67c5('0x35')][_0x67c5('0x39')]));_0x97e7a5[_0x67c5('0x38')]=_0x97e7a5[_0x67c5('0x38')][_0x67c5('0x3a')]?_0x97e7a5[_0x67c5('0x38')]:_0x332ecd['model'];if(!_0x1d8488['query'][_0x67c5('0x3b')]('nolimit')){_0x97e7a5[_0x67c5('0x20')]=qs[_0x67c5('0x20')](_0x1d8488['query'][_0x67c5('0x20')]);_0x97e7a5['offset']=qs['offset'](_0x1d8488[_0x67c5('0x35')][_0x67c5('0x1f')]);}_0x97e7a5[_0x67c5('0x3c')]=qs[_0x67c5('0x3d')](_0x1d8488[_0x67c5('0x35')][_0x67c5('0x3d')]);_0x97e7a5[_0x67c5('0x3e')]=qs['filters'](_[_0x67c5('0x3f')](_0x1d8488['query'],_0x332ecd[_0x67c5('0x36')]),_0x5748ce);if(_0x1d8488[_0x67c5('0x35')]['filter']){_0x97e7a5['where']=_['merge'](_0x97e7a5[_0x67c5('0x3e')],{'$or':_['map'](_0x5748ce,function(_0x4b547e){if(_0x4b547e['type']!=='VIRTUAL'){var _0x4b3048={};_0x4b3048[_0x4b547e[_0x67c5('0x2c')]]={'$like':'%'+_0x1d8488[_0x67c5('0x35')]['filter']+'%'};return _0x4b3048;}})});}_0x97e7a5=_[_0x67c5('0x40')]({},_0x97e7a5,_0x1d8488[_0x67c5('0x41')]);var _0x14a568={'where':_0x97e7a5[_0x67c5('0x3e')]};return db[_0x67c5('0x42')][_0x67c5('0x22')](_0x14a568)[_0x67c5('0x26')](function(_0x30e692){_0x3cc83c[_0x67c5('0x22')]=_0x30e692;if(_0x1d8488[_0x67c5('0x35')][_0x67c5('0x43')]){_0x97e7a5[_0x67c5('0x44')]=[{'all':!![]}];}return db[_0x67c5('0x42')][_0x67c5('0x45')](_0x97e7a5);})[_0x67c5('0x26')](function(_0x57a6b0){_0x3cc83c[_0x67c5('0x46')]=_0x57a6b0;return _0x3cc83c;})[_0x67c5('0x26')](respondWithFilteredResult(_0x2806ad,_0x97e7a5))[_0x67c5('0x47')](handleError(_0x2806ad,null));};exports[_0x67c5('0x48')]=function(_0x294c64,_0x479b18){var _0x3adb9b={'raw':!![],'where':{'id':_0x294c64[_0x67c5('0x49')]['id']}},_0x44ef8d={};_0x44ef8d[_0x67c5('0x34')]=_[_0x67c5('0x4a')](db[_0x67c5('0x42')][_0x67c5('0x30')]);_0x44ef8d[_0x67c5('0x35')]=_[_0x67c5('0x4a')](_0x294c64[_0x67c5('0x35')]);_0x44ef8d[_0x67c5('0x36')]=_[_0x67c5('0x37')](_0x44ef8d[_0x67c5('0x34')],_0x44ef8d[_0x67c5('0x35')]);_0x3adb9b[_0x67c5('0x38')]=_[_0x67c5('0x37')](_0x44ef8d[_0x67c5('0x34')],qs[_0x67c5('0x39')](_0x294c64[_0x67c5('0x35')][_0x67c5('0x39')]));_0x3adb9b['attributes']=_0x3adb9b[_0x67c5('0x38')]['length']?_0x3adb9b[_0x67c5('0x38')]:_0x44ef8d[_0x67c5('0x34')];if(_0x294c64[_0x67c5('0x35')][_0x67c5('0x43')]){_0x3adb9b[_0x67c5('0x44')]=[{'all':!![]}];}_0x3adb9b=_['merge']({},_0x3adb9b,_0x294c64['options']);return db['SquareOdbc'][_0x67c5('0x4b')](_0x3adb9b)[_0x67c5('0x26')](handleEntityNotFound(_0x479b18,null))[_0x67c5('0x26')](respondWithResult(_0x479b18,null))['catch'](handleError(_0x479b18,null));};exports[_0x67c5('0x4c')]=function(_0x339290,_0xa6d4b9){return db['SquareOdbc'][_0x67c5('0x4c')](_0x339290[_0x67c5('0x4d')],{})['then'](function(_0x76c1ef){var _0x46bff1=_0x339290['user'][_0x67c5('0x4e')]({'plain':!![]});if(!_0x46bff1)throw new Error(_0x67c5('0x4f'));if(_0x46bff1[_0x67c5('0x50')]==='user'){var _0x467921=_0x76c1ef['get']({'plain':!![]});var _0x39a10e=_0x67c5('0x27');return db[_0x67c5('0x51')][_0x67c5('0x4b')]({'where':{'name':_0x39a10e,'userProfileId':_0x46bff1['userProfileId']},'raw':!![]})[_0x67c5('0x26')](function(_0x436b35){if(_0x436b35&&_0x436b35[_0x67c5('0x52')]===0x0){return db['UserProfileResource'][_0x67c5('0x4c')]({'name':_0x467921[_0x67c5('0x2c')],'resourceId':_0x467921['id'],'type':_0x436b35[_0x67c5('0x2c')],'sectionId':_0x436b35['id']},{})[_0x67c5('0x26')](function(){return _0x76c1ef;});}else{return _0x76c1ef;}})[_0x67c5('0x47')](function(_0x4e0049){logger['error'](_0x67c5('0x53'),_0x4e0049);throw _0x4e0049;});}return _0x76c1ef;})[_0x67c5('0x26')](respondWithResult(_0xa6d4b9,0xc9))['catch'](handleError(_0xa6d4b9,null));};exports['update']=function(_0x31d6d5,_0x3a7d10){if(_0x31d6d5[_0x67c5('0x4d')]['id']){delete _0x31d6d5[_0x67c5('0x4d')]['id'];}return db[_0x67c5('0x42')][_0x67c5('0x4b')]({'where':{'id':_0x31d6d5[_0x67c5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a7d10,null))[_0x67c5('0x26')](saveUpdates(_0x31d6d5['body'],null))[_0x67c5('0x26')](respondWithResult(_0x3a7d10,null))['catch'](handleError(_0x3a7d10,null));};exports[_0x67c5('0x29')]=function(_0x367a4f,_0x461eab){return db['SquareOdbc'][_0x67c5('0x4b')]({'where':{'id':_0x367a4f[_0x67c5('0x49')]['id']}})[_0x67c5('0x26')](handleEntityNotFound(_0x461eab,null))[_0x67c5('0x26')](removeEntity(_0x461eab,null))[_0x67c5('0x47')](handleError(_0x461eab,null));};exports[_0x67c5('0x54')]=function(_0x38c13f,_0xe91508,_0x5a1e8c){var _0x94bfb;return db[_0x67c5('0x42')]['find']({'where':{'id':_0x38c13f[_0x67c5('0x49')]['id']},'attributes':['id',_0x67c5('0x55')]})['then'](handleEntityNotFound(_0xe91508,null))[_0x67c5('0x26')](function(_0x2ca1b7){if(_0x2ca1b7){var _0x329790=require(_0x67c5('0x56'))();_0x329790[_0x67c5('0x57')](_0x2ca1b7[_0x67c5('0x55')]);_0x329790['closeSync']();return _0x2ca1b7;}})[_0x67c5('0x26')](respondWithResult(_0xe91508,null))[_0x67c5('0x47')](handleError(_0xe91508,null));}; \ No newline at end of file +var _0x9e24=['ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x9e24,0xbf));var _0x49e2=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x9e24[_0x1fd675];return _0x16b554;};'use strict';var emlformat=require(_0x49e2('0x0'));var rimraf=require(_0x49e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49e2('0x2'));var rp=require(_0x49e2('0x3'));var moment=require(_0x49e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x49e2('0x5'));var util=require(_0x49e2('0x6'));var path=require(_0x49e2('0x7'));var sox=require(_0x49e2('0x8'));var csv=require(_0x49e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49e2('0xa'));var _=require(_0x49e2('0xb'));var squel=require(_0x49e2('0xc'));var crypto=require(_0x49e2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49e2('0xe'));var Papa=require(_0x49e2('0xf'));var Redis=require(_0x49e2('0x10'));var authService=require(_0x49e2('0x11'));var qs=require(_0x49e2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49e2('0x13'));var logger=require(_0x49e2('0x14'))(_0x49e2('0x15'));var utils=require(_0x49e2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x49e2('0x17'));var db=require(_0x49e2('0x18'))['db'];function respondWithStatusCode(_0x4d19ce,_0x512138){_0x512138=_0x512138||0xcc;return function(_0x417e15){if(_0x417e15){return _0x4d19ce[_0x49e2('0x19')](_0x512138);}return _0x4d19ce[_0x49e2('0x1a')](_0x512138)[_0x49e2('0x1b')]();};}function respondWithResult(_0x3649ec,_0x59c86c){_0x59c86c=_0x59c86c||0xc8;return function(_0x12f245){if(_0x12f245){return _0x3649ec[_0x49e2('0x1a')](_0x59c86c)[_0x49e2('0x1c')](_0x12f245);}};}function respondWithFilteredResult(_0x1dc6d1,_0x4ec4a6){return function(_0x304d04){if(_0x304d04){var _0x132e72=typeof _0x4ec4a6[_0x49e2('0x1d')]===_0x49e2('0x1e')&&typeof _0x4ec4a6[_0x49e2('0x1f')]===_0x49e2('0x1e');var _0x1247f6=_0x304d04[_0x49e2('0x20')];var _0x4bb8df=_0x132e72?0x0:_0x4ec4a6['offset'];var _0x311dd8=_0x132e72?_0x304d04[_0x49e2('0x20')]:_0x4ec4a6[_0x49e2('0x1d')]+_0x4ec4a6[_0x49e2('0x1f')];var _0xeb3cc6;if(_0x311dd8>=_0x1247f6){_0x311dd8=_0x1247f6;_0xeb3cc6=0xc8;}else{_0xeb3cc6=0xce;}_0x1dc6d1['status'](_0xeb3cc6);return _0x1dc6d1[_0x49e2('0x21')](_0x49e2('0x22'),_0x4bb8df+'-'+_0x311dd8+'/'+_0x1247f6)[_0x49e2('0x1c')](_0x304d04);}return null;};}function patchUpdates(_0x1019e1){return function(_0x724e87){try{jsonpatch[_0x49e2('0x23')](_0x724e87,_0x1019e1,!![]);}catch(_0x4c2fe0){return BPromise[_0x49e2('0x24')](_0x4c2fe0);}return _0x724e87[_0x49e2('0x25')]();};}function saveUpdates(_0x20c2c9,_0x51c736){return function(_0x40038e){if(_0x40038e){return _0x40038e[_0x49e2('0x26')](_0x20c2c9)['then'](function(_0x41acfb){return _0x41acfb;});}return null;};}function removeEntity(_0x2db469,_0x3d3e51){return function(_0x187132){if(_0x187132){return _0x187132['destroy']()[_0x49e2('0x27')](function(){var _0x391ebe=_0x187132['get']({'plain':!![]});var _0x5f4e77='ODBC';return db[_0x49e2('0x28')]['destroy']({'where':{'type':_0x5f4e77,'resourceId':_0x391ebe['id']}})['then'](function(){return _0x187132;});})[_0x49e2('0x27')](function(){_0x2db469[_0x49e2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x168400,_0x246219){return function(_0xd9f04a){if(!_0xd9f04a){_0x168400[_0x49e2('0x19')](0x194);}return _0xd9f04a;};}function handleError(_0x5ad22b,_0x308811){_0x308811=_0x308811||0x1f4;return function(_0x18b73b){logger[_0x49e2('0x29')](_0x18b73b[_0x49e2('0x2a')]);if(_0x18b73b[_0x49e2('0x2b')]){delete _0x18b73b[_0x49e2('0x2b')];}_0x5ad22b['status'](_0x308811)[_0x49e2('0x2c')](_0x18b73b);};}exports[_0x49e2('0x2d')]=function(_0x59633b,_0x2d852b){var _0x2c60a4={},_0x33d147={},_0x1584ac={'count':0x0,'rows':[]};var _0x10a1d4=_[_0x49e2('0x2e')](db[_0x49e2('0x2f')]['rawAttributes'],function(_0x2144bd){return{'name':_0x2144bd[_0x49e2('0x30')],'type':_0x2144bd[_0x49e2('0x31')]['key']};});_0x33d147[_0x49e2('0x32')]=_[_0x49e2('0x2e')](_0x10a1d4,_0x49e2('0x2b'));_0x33d147[_0x49e2('0x33')]=_[_0x49e2('0x34')](_0x59633b[_0x49e2('0x33')]);_0x33d147[_0x49e2('0x35')]=_[_0x49e2('0x36')](_0x33d147[_0x49e2('0x32')],_0x33d147['query']);_0x2c60a4[_0x49e2('0x37')]=_['intersection'](_0x33d147[_0x49e2('0x32')],qs['fields'](_0x59633b[_0x49e2('0x33')]['fields']));_0x2c60a4[_0x49e2('0x37')]=_0x2c60a4['attributes'][_0x49e2('0x38')]?_0x2c60a4[_0x49e2('0x37')]:_0x33d147[_0x49e2('0x32')];if(!_0x59633b[_0x49e2('0x33')]['hasOwnProperty'](_0x49e2('0x39'))){_0x2c60a4[_0x49e2('0x1f')]=qs[_0x49e2('0x1f')](_0x59633b[_0x49e2('0x33')][_0x49e2('0x1f')]);_0x2c60a4[_0x49e2('0x1d')]=qs[_0x49e2('0x1d')](_0x59633b[_0x49e2('0x33')][_0x49e2('0x1d')]);}_0x2c60a4['order']=qs[_0x49e2('0x3a')](_0x59633b[_0x49e2('0x33')][_0x49e2('0x3a')]);_0x2c60a4[_0x49e2('0x3b')]=qs['filters'](_[_0x49e2('0x3c')](_0x59633b[_0x49e2('0x33')],_0x33d147['filters']),_0x10a1d4);if(_0x59633b[_0x49e2('0x33')][_0x49e2('0x3d')]){_0x2c60a4[_0x49e2('0x3b')]=_[_0x49e2('0x3e')](_0x2c60a4['where'],{'$or':_[_0x49e2('0x2e')](_0x10a1d4,function(_0x1d2283){if(_0x1d2283[_0x49e2('0x31')]!==_0x49e2('0x3f')){var _0x5b5c01={};_0x5b5c01[_0x1d2283['name']]={'$like':'%'+_0x59633b[_0x49e2('0x33')][_0x49e2('0x3d')]+'%'};return _0x5b5c01;}})});}_0x2c60a4=_[_0x49e2('0x3e')]({},_0x2c60a4,_0x59633b[_0x49e2('0x40')]);var _0x2607fd={'where':_0x2c60a4[_0x49e2('0x3b')]};return db[_0x49e2('0x2f')][_0x49e2('0x20')](_0x2607fd)[_0x49e2('0x27')](function(_0x119809){_0x1584ac[_0x49e2('0x20')]=_0x119809;if(_0x59633b[_0x49e2('0x33')][_0x49e2('0x41')]){_0x2c60a4['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x2c60a4);})[_0x49e2('0x27')](function(_0x2aa9b6){_0x1584ac[_0x49e2('0x42')]=_0x2aa9b6;return _0x1584ac;})[_0x49e2('0x27')](respondWithFilteredResult(_0x2d852b,_0x2c60a4))[_0x49e2('0x43')](handleError(_0x2d852b,null));};exports[_0x49e2('0x44')]=function(_0x1ed6a0,_0x149cf3){var _0x257f49={'raw':!![],'where':{'id':_0x1ed6a0['params']['id']}},_0x383f6d={};_0x383f6d[_0x49e2('0x32')]=_['keys'](db['SquareOdbc'][_0x49e2('0x45')]);_0x383f6d['query']=_[_0x49e2('0x34')](_0x1ed6a0[_0x49e2('0x33')]);_0x383f6d[_0x49e2('0x35')]=_[_0x49e2('0x36')](_0x383f6d[_0x49e2('0x32')],_0x383f6d[_0x49e2('0x33')]);_0x257f49[_0x49e2('0x37')]=_[_0x49e2('0x36')](_0x383f6d[_0x49e2('0x32')],qs['fields'](_0x1ed6a0[_0x49e2('0x33')][_0x49e2('0x46')]));_0x257f49[_0x49e2('0x37')]=_0x257f49['attributes'][_0x49e2('0x38')]?_0x257f49['attributes']:_0x383f6d['model'];if(_0x1ed6a0[_0x49e2('0x33')][_0x49e2('0x41')]){_0x257f49[_0x49e2('0x47')]=[{'all':!![]}];}_0x257f49=_[_0x49e2('0x3e')]({},_0x257f49,_0x1ed6a0[_0x49e2('0x40')]);return db[_0x49e2('0x2f')][_0x49e2('0x48')](_0x257f49)[_0x49e2('0x27')](handleEntityNotFound(_0x149cf3,null))[_0x49e2('0x27')](respondWithResult(_0x149cf3,null))[_0x49e2('0x43')](handleError(_0x149cf3,null));};exports[_0x49e2('0x49')]=function(_0x4f2e6f,_0x11952b){return db['SquareOdbc'][_0x49e2('0x49')](_0x4f2e6f['body'],{})['then'](function(_0x3e567b){var _0x4cc3d1=_0x4f2e6f[_0x49e2('0x4a')]['get']({'plain':!![]});if(!_0x4cc3d1)throw new Error(_0x49e2('0x4b'));if(_0x4cc3d1['role']==='user'){var _0x5498fc=_0x3e567b['get']({'plain':!![]});var _0xa1106=_0x49e2('0x4c');return db[_0x49e2('0x4d')][_0x49e2('0x48')]({'where':{'name':_0xa1106,'userProfileId':_0x4cc3d1[_0x49e2('0x4e')]},'raw':!![]})[_0x49e2('0x27')](function(_0x30525e){if(_0x30525e&&_0x30525e[_0x49e2('0x4f')]===0x0){return db[_0x49e2('0x28')]['create']({'name':_0x5498fc['name'],'resourceId':_0x5498fc['id'],'type':_0x30525e[_0x49e2('0x2b')],'sectionId':_0x30525e['id']},{})['then'](function(){return _0x3e567b;});}else{return _0x3e567b;}})[_0x49e2('0x43')](function(_0x325d85){logger[_0x49e2('0x29')](_0x49e2('0x50'),_0x325d85);throw _0x325d85;});}return _0x3e567b;})['then'](respondWithResult(_0x11952b,0xc9))[_0x49e2('0x43')](handleError(_0x11952b,null));};exports[_0x49e2('0x26')]=function(_0x3c62ac,_0x21776d){if(_0x3c62ac['body']['id']){delete _0x3c62ac[_0x49e2('0x51')]['id'];}return db[_0x49e2('0x2f')][_0x49e2('0x48')]({'where':{'id':_0x3c62ac['params']['id']}})[_0x49e2('0x27')](handleEntityNotFound(_0x21776d,null))[_0x49e2('0x27')](saveUpdates(_0x3c62ac[_0x49e2('0x51')],null))[_0x49e2('0x27')](respondWithResult(_0x21776d,null))[_0x49e2('0x43')](handleError(_0x21776d,null));};exports[_0x49e2('0x52')]=function(_0xef5a38,_0x3612bc){return db[_0x49e2('0x2f')][_0x49e2('0x48')]({'where':{'id':_0xef5a38[_0x49e2('0x53')]['id']}})['then'](handleEntityNotFound(_0x3612bc,null))[_0x49e2('0x27')](removeEntity(_0x3612bc,null))[_0x49e2('0x43')](handleError(_0x3612bc,null));};exports[_0x49e2('0x54')]=function(_0x326a32,_0xf6684,_0x1a3ca3){var _0x15d632;return db[_0x49e2('0x2f')]['find']({'where':{'id':_0x326a32[_0x49e2('0x53')]['id']},'attributes':['id',_0x49e2('0x55')]})[_0x49e2('0x27')](handleEntityNotFound(_0xf6684,null))[_0x49e2('0x27')](function(_0x42eec5){if(_0x42eec5){var _0x135c63=require(_0x49e2('0x56'))();_0x135c63[_0x49e2('0x57')](_0x42eec5[_0x49e2('0x55')]);_0x135c63[_0x49e2('0x58')]();return _0x42eec5;}})[_0x49e2('0x27')](respondWithResult(_0xf6684,null))[_0x49e2('0x43')](handleError(_0xf6684,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 79cc8c2..310b0f3 100644 --- a/server/api/squareOdbc/squareOdbc.model.js +++ b/server/api/squareOdbc/squareOdbc.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc06c=['square_odbc','util','api','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x2e53b3,_0x4c9664){var _0x3966f7=function(_0x58a9ed){while(--_0x58a9ed){_0x2e53b3['push'](_0x2e53b3['shift']());}};_0x3966f7(++_0x4c9664);}(_0xc06c,0x1a5));var _0xcc06=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc06c[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0xcc06('0x0'));var logger=require('../../config/logger')(_0xcc06('0x1'));var moment=require(_0xcc06('0x2'));var BPromise=require(_0xcc06('0x3'));var rp=require(_0xcc06('0x4'));var fs=require('fs');var path=require(_0xcc06('0x5'));var rimraf=require(_0xcc06('0x6'));var config=require('../../config/environment');var attributes=require(_0xcc06('0x7'));module[_0xcc06('0x8')]=function(_0x3129b2,_0x2c9d05){return _0x3129b2[_0xcc06('0x9')](_0xcc06('0xa'),attributes,{'tableName':_0xcc06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce92=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x39fb61,_0x87794f){var _0x4ee89b=function(_0x4db5a7){while(--_0x4db5a7){_0x39fb61['push'](_0x39fb61['shift']());}};_0x4ee89b(++_0x87794f);}(_0xce92,0x1b9));var _0x2ce9=function(_0x13a4bf,_0x56cb27){_0x13a4bf=_0x13a4bf-0x0;var _0x2933d6=_0xce92[_0x13a4bf];return _0x2933d6;};'use strict';var _=require(_0x2ce9('0x0'));var util=require(_0x2ce9('0x1'));var logger=require(_0x2ce9('0x2'))(_0x2ce9('0x3'));var moment=require(_0x2ce9('0x4'));var BPromise=require(_0x2ce9('0x5'));var rp=require(_0x2ce9('0x6'));var fs=require('fs');var path=require(_0x2ce9('0x7'));var rimraf=require(_0x2ce9('0x8'));var config=require(_0x2ce9('0x9'));var attributes=require(_0x2ce9('0xa'));module[_0x2ce9('0xb')]=function(_0xa9bf21,_0x5e71f4){return _0xa9bf21[_0x2ce9('0xc')](_0x2ce9('0xd'),attributes,{'tableName':_0x2ce9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index b7659e6..853eb3c 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe6a=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify'];(function(_0x4b6850,_0x1b9f46){var _0x4e631c=function(_0x5033be){while(--_0x5033be){_0x4b6850['push'](_0x4b6850['shift']());}};_0x4e631c(++_0x1b9f46);}(_0xfe6a,0xe7));var _0xafe6=function(_0x413c64,_0x495abb){_0x413c64=_0x413c64-0x0;var _0x18f7c9=_0xfe6a[_0x413c64];return _0x18f7c9;};'use strict';var _=require(_0xafe6('0x0'));var util=require(_0xafe6('0x1'));var moment=require(_0xafe6('0x2'));var BPromise=require(_0xafe6('0x3'));var rs=require(_0xafe6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafe6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xafe6('0x6'))(_0xafe6('0x7'));var config=require(_0xafe6('0x8'));var jayson=require(_0xafe6('0x9'));var client=jayson['client'][_0xafe6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcaab14,_0x5d46b9,_0x97e014){return new BPromise(function(_0x50f917,_0x5341f8){return client[_0xafe6('0xb')](_0xcaab14,_0x97e014)[_0xafe6('0xc')](function(_0x32a3f5){logger[_0xafe6('0xd')](_0xafe6('0xe'),_0x5d46b9,_0xafe6('0xf'));logger[_0xafe6('0x10')](_0xafe6('0x11'),_0x5d46b9,_0xafe6('0xf'),JSON['stringify'](_0x32a3f5));if(_0x32a3f5[_0xafe6('0x12')]){if(_0x32a3f5[_0xafe6('0x12')][_0xafe6('0x13')]===0x1f4){logger[_0xafe6('0x12')](_0xafe6('0xe'),_0x5d46b9,_0x32a3f5[_0xafe6('0x12')]['message']);return _0x5341f8(_0x32a3f5[_0xafe6('0x12')][_0xafe6('0x14')]);}logger[_0xafe6('0x12')](_0xafe6('0xe'),_0x5d46b9,_0x32a3f5['error'][_0xafe6('0x14')]);return _0x50f917(_0x32a3f5[_0xafe6('0x12')][_0xafe6('0x14')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x5d46b9,_0xafe6('0xf'));_0x50f917(_0x32a3f5['result']['message']);}})[_0xafe6('0x15')](function(_0x270368){logger[_0xafe6('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x5d46b9,_0x270368);_0x5341f8(_0x270368);});});}exports[_0xafe6('0x16')]=function(_0x3fb9a6){var _0xef09be=this;return new Promise(function(_0x1ea56d,_0xedf2a6){return db[_0xafe6('0x17')][_0xafe6('0x18')]({'raw':_0x3fb9a6[_0xafe6('0x19')]?_0x3fb9a6[_0xafe6('0x19')][_0xafe6('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fb9a6[_0xafe6('0x19')]?_0x3fb9a6[_0xafe6('0x19')][_0xafe6('0x1b')]||null:null,'attributes':_0x3fb9a6[_0xafe6('0x19')]?_0x3fb9a6[_0xafe6('0x19')][_0xafe6('0x1c')]||null:null,'include':_0x3fb9a6[_0xafe6('0x19')]?_0x3fb9a6[_0xafe6('0x19')]['include']?_[_0xafe6('0x1d')](_0x3fb9a6[_0xafe6('0x19')][_0xafe6('0x1e')],function(_0x3c0784){return{'model':db[_0x3c0784[_0xafe6('0x1f')]],'as':_0x3c0784['as'],'attributes':_0x3c0784[_0xafe6('0x1c')],'include':_0x3c0784[_0xafe6('0x1e')]?_[_0xafe6('0x1d')](_0x3c0784[_0xafe6('0x1e')],function(_0x5a1362){return{'model':db[_0x5a1362[_0xafe6('0x1f')]],'as':_0x5a1362['as'],'attributes':_0x5a1362[_0xafe6('0x1c')],'include':_0x5a1362[_0xafe6('0x1e')]?_[_0xafe6('0x1d')](_0x5a1362[_0xafe6('0x1e')],function(_0x19a5e6){return{'model':db[_0x19a5e6[_0xafe6('0x1f')]],'as':_0x19a5e6['as'],'attributes':_0x19a5e6['attributes']};}):[]};}):[]};}):[]:[]})[_0xafe6('0xc')](function(_0x1aa9fb){logger['info'](_0xafe6('0x16'),_0x3fb9a6);logger[_0xafe6('0x10')](_0xafe6('0x16'),_0x3fb9a6,JSON[_0xafe6('0x20')](_0x1aa9fb));_0x1ea56d(_0x1aa9fb);})[_0xafe6('0x15')](function(_0x34e2bf){logger[_0xafe6('0x12')]('ShowSquareOdbc',_0x34e2bf[_0xafe6('0x14')],_0x3fb9a6);_0xedf2a6(_0xef09be[_0xafe6('0x12')](0x1f4,_0x34e2bf[_0xafe6('0x14')]));});});}; \ No newline at end of file +var _0xdd8c=['then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x295af6,_0x20daab){var _0x4f9fe4=function(_0xbd383d){while(--_0xbd383d){_0x295af6['push'](_0x295af6['shift']());}};_0x4f9fe4(++_0x20daab);}(_0xdd8c,0x16a));var _0xcdd8=function(_0x5b193a,_0x30811b){_0x5b193a=_0x5b193a-0x0;var _0x343a93=_0xdd8c[_0x5b193a];return _0x343a93;};'use strict';var _=require('lodash');var util=require(_0xcdd8('0x0'));var moment=require(_0xcdd8('0x1'));var BPromise=require(_0xcdd8('0x2'));var rs=require(_0xcdd8('0x3'));var fs=require('fs');var Redis=require(_0xcdd8('0x4'));var db=require(_0xcdd8('0x5'))['db'];var utils=require(_0xcdd8('0x6'));var logger=require(_0xcdd8('0x7'))(_0xcdd8('0x8'));var config=require(_0xcdd8('0x9'));var jayson=require(_0xcdd8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x419782,_0x105484,_0x2ab85a){return new BPromise(function(_0x15ba04,_0x1a4da6){return client[_0xcdd8('0xb')](_0x419782,_0x2ab85a)[_0xcdd8('0xc')](function(_0x1de1e3){logger['info'](_0xcdd8('0xd'),_0x105484,_0xcdd8('0xe'));logger[_0xcdd8('0xf')](_0xcdd8('0x10'),_0x105484,_0xcdd8('0xe'),JSON[_0xcdd8('0x11')](_0x1de1e3));if(_0x1de1e3['error']){if(_0x1de1e3[_0xcdd8('0x12')][_0xcdd8('0x13')]===0x1f4){logger[_0xcdd8('0x12')](_0xcdd8('0xd'),_0x105484,_0x1de1e3[_0xcdd8('0x12')][_0xcdd8('0x14')]);return _0x1a4da6(_0x1de1e3[_0xcdd8('0x12')][_0xcdd8('0x14')]);}logger[_0xcdd8('0x12')](_0xcdd8('0xd'),_0x105484,_0x1de1e3[_0xcdd8('0x12')]['message']);return _0x15ba04(_0x1de1e3[_0xcdd8('0x12')][_0xcdd8('0x14')]);}else{logger[_0xcdd8('0x15')](_0xcdd8('0xd'),_0x105484,_0xcdd8('0xe'));_0x15ba04(_0x1de1e3[_0xcdd8('0x16')][_0xcdd8('0x14')]);}})[_0xcdd8('0x17')](function(_0x492477){logger['error'](_0xcdd8('0xd'),_0x105484,_0x492477);_0x1a4da6(_0x492477);});});}exports[_0xcdd8('0x18')]=function(_0x4e2caa){var _0x4273e6=this;return new Promise(function(_0x1b0bfb,_0x5b0ee7){return db[_0xcdd8('0x19')][_0xcdd8('0x1a')]({'raw':_0x4e2caa[_0xcdd8('0x1b')]?_0x4e2caa[_0xcdd8('0x1b')][_0xcdd8('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e2caa[_0xcdd8('0x1b')]?_0x4e2caa[_0xcdd8('0x1b')][_0xcdd8('0x1d')]||null:null,'attributes':_0x4e2caa[_0xcdd8('0x1b')]?_0x4e2caa[_0xcdd8('0x1b')][_0xcdd8('0x1e')]||null:null,'include':_0x4e2caa[_0xcdd8('0x1b')]?_0x4e2caa[_0xcdd8('0x1b')]['include']?_['map'](_0x4e2caa['options'][_0xcdd8('0x1f')],function(_0x396b05){return{'model':db[_0x396b05[_0xcdd8('0x20')]],'as':_0x396b05['as'],'attributes':_0x396b05[_0xcdd8('0x1e')],'include':_0x396b05['include']?_[_0xcdd8('0x21')](_0x396b05[_0xcdd8('0x1f')],function(_0x3e9b92){return{'model':db[_0x3e9b92[_0xcdd8('0x20')]],'as':_0x3e9b92['as'],'attributes':_0x3e9b92[_0xcdd8('0x1e')],'include':_0x3e9b92[_0xcdd8('0x1f')]?_[_0xcdd8('0x21')](_0x3e9b92[_0xcdd8('0x1f')],function(_0x5e0a2a){return{'model':db[_0x5e0a2a[_0xcdd8('0x20')]],'as':_0x5e0a2a['as'],'attributes':_0x5e0a2a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcdd8('0xc')](function(_0x544505){logger[_0xcdd8('0x15')]('ShowSquareOdbc',_0x4e2caa);logger['debug'](_0xcdd8('0x18'),_0x4e2caa,JSON[_0xcdd8('0x11')](_0x544505));_0x1b0bfb(_0x544505);})[_0xcdd8('0x17')](function(_0x119831){logger[_0xcdd8('0x12')]('ShowSquareOdbc',_0x119831['message'],_0x4e2caa);_0x5b0ee7(_0x4273e6[_0xcdd8('0x12')](0x1f4,_0x119831[_0xcdd8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9aecc0a..925b625 100644 --- a/server/api/squareProject/index.js +++ b/server/api/squareProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9caf=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x2f4af2,_0x2f7025){var _0x4ea2c2=function(_0x41f3b3){while(--_0x41f3b3){_0x2f4af2['push'](_0x2f4af2['shift']());}};_0x4ea2c2(++_0x2f7025);}(_0x9caf,0x155));var _0xf9ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9caf[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf9ca('0x0'));var util=require(_0xf9ca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf9ca('0x2'));var router=express[_0xf9ca('0x3')]();var fs_extra=require(_0xf9ca('0x4'));var auth=require(_0xf9ca('0x5'));var interaction=require(_0xf9ca('0x6'));var config=require('../../config/environment');var controller=require(_0xf9ca('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf9ca('0x8')]);router[_0xf9ca('0x9')](_0xf9ca('0xa'),auth[_0xf9ca('0xb')](),controller[_0xf9ca('0xc')]);router[_0xf9ca('0xd')]('/',auth[_0xf9ca('0xb')](),controller[_0xf9ca('0xe')]);router[_0xf9ca('0xf')]('/:id',auth[_0xf9ca('0xb')](),controller[_0xf9ca('0x10')]);router[_0xf9ca('0x11')](_0xf9ca('0xa'),auth[_0xf9ca('0xb')](),controller[_0xf9ca('0x12')]);module[_0xf9ca('0x13')]=router; \ No newline at end of file +var _0x45e1=['../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','fs-extra'];(function(_0x14b898,_0x467e3e){var _0x551a64=function(_0x556703){while(--_0x556703){_0x14b898['push'](_0x14b898['shift']());}};_0x551a64(++_0x467e3e);}(_0x45e1,0x1eb));var _0x145e=function(_0xf7a357,_0x1b9a26){_0xf7a357=_0xf7a357-0x0;var _0x57c8b=_0x45e1[_0xf7a357];return _0x57c8b;};'use strict';var multer=require(_0x145e('0x0'));var util=require(_0x145e('0x1'));var path=require(_0x145e('0x2'));var timeout=require(_0x145e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x145e('0x4'));var auth=require(_0x145e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x145e('0x6'));var controller=require(_0x145e('0x7'));router[_0x145e('0x8')]('/',auth[_0x145e('0x9')](),controller['index']);router[_0x145e('0x8')](_0x145e('0xa'),auth[_0x145e('0x9')](),controller['show']);router[_0x145e('0xb')]('/',auth[_0x145e('0x9')](),controller[_0x145e('0xc')]);router[_0x145e('0xd')](_0x145e('0xa'),auth['isAuthenticated'](),controller[_0x145e('0xe')]);router['delete'](_0x145e('0xa'),auth['isAuthenticated'](),controller[_0x145e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 56f3ac4..8704024 100644 --- a/server/api/squareProject/squareProject.attributes.js +++ b/server/api/squareProject/squareProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf796=['utf8','BLOB','production','sequelize','exports','name','STRING','TEXT','long','preproduction','getDataValue','toString'];(function(_0x2a1dc3,_0x2bcbcc){var _0x4f0d17=function(_0x4f44a7){while(--_0x4f44a7){_0x2a1dc3['push'](_0x2a1dc3['shift']());}};_0x4f0d17(++_0x2bcbcc);}(_0xf796,0x19b));var _0x6f79=function(_0x3e43ea,_0x2f574e){_0x3e43ea=_0x3e43ea-0x0;var _0x46e02e=_0xf796[_0x3e43ea];return _0x46e02e;};'use strict';var Sequelize=require(_0x6f79('0x0'));module[_0x6f79('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6f79('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6f79('0x3')]},'notes':{'type':Sequelize[_0x6f79('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x6f79('0x5')),'get':function(){if(this['getDataValue'](_0x6f79('0x6'))){return this[_0x6f79('0x7')](_0x6f79('0x6'))[_0x6f79('0x8')](_0x6f79('0x9'));}}},'production':{'type':Sequelize[_0x6f79('0xa')](_0x6f79('0x5')),'get':function(){if(this[_0x6f79('0x7')](_0x6f79('0xb'))){return this[_0x6f79('0x7')](_0x6f79('0xb'))[_0x6f79('0x8')](_0x6f79('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x65d1=['sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE'];(function(_0x3a6010,_0x3789ff){var _0x18edbc=function(_0x5c28b7){while(--_0x5c28b7){_0x3a6010['push'](_0x3a6010['shift']());}};_0x18edbc(++_0x3789ff);}(_0x65d1,0xd0));var _0x165d=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0x65d1[_0x5c18ef];return _0x33789d;};'use strict';var Sequelize=require(_0x165d('0x0'));module[_0x165d('0x1')]={'name':{'type':Sequelize[_0x165d('0x2')],'unique':_0x165d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x165d('0x2')]},'notes':{'type':Sequelize[_0x165d('0x4')]},'preproduction':{'type':Sequelize[_0x165d('0x5')]('long'),'get':function(){if(this[_0x165d('0x6')](_0x165d('0x7'))){return this[_0x165d('0x6')](_0x165d('0x7'))[_0x165d('0x8')](_0x165d('0x9'));}}},'production':{'type':Sequelize[_0x165d('0x5')](_0x165d('0xa')),'get':function(){if(this[_0x165d('0x6')](_0x165d('0xb'))){return this[_0x165d('0x6')]('production')['toString'](_0x165d('0x9'));}}},'savedAt':{'type':Sequelize[_0x165d('0xc')]},'publishedAt':{'type':Sequelize[_0x165d('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 882f1cb..20ded77 100644 --- a/server/api/squareProject/squareProject.controller.js +++ b/server/api/squareProject/squareProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9bb=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','ioredis','../../config/logger','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','get','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','send','index','SquareProject','rawAttributes','type','query','keys','filters','intersection'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xc9bb,0xa8));var _0xbc9b=function(_0x569718,_0x44bed3){_0x569718=_0x569718-0x0;var _0x476b3d=_0xc9bb[_0x569718];return _0x476b3d;};'use strict';var _=require('lodash');var Redis=require(_0xbc9b('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xbc9b('0x1'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbc9b('0x2')](config['redis'],{'host':_0xbc9b('0x3'),'port':0x18eb});var socket=require(_0xbc9b('0x4'))(new Redis(config[_0xbc9b('0x5')]));require(_0xbc9b('0x6'))[_0xbc9b('0x7')](socket);function respondWithResult(_0x2f932d,_0x5174e4){_0x5174e4=_0x5174e4||0xc8;return function(_0x43992a){if(_0x43992a){return _0x2f932d[_0xbc9b('0x8')](_0x5174e4)[_0xbc9b('0x9')](_0x43992a);}};}function respondWithFilteredResult(_0x46cbd6,_0x2020dc){return function(_0x1db08d){if(_0x1db08d){var _0x231d8c=typeof _0x2020dc[_0xbc9b('0xa')]===_0xbc9b('0xb')&&typeof _0x2020dc[_0xbc9b('0xc')]===_0xbc9b('0xb');var _0x2b4f4e=_0x1db08d['count'];var _0x25c119=_0x231d8c?0x0:_0x2020dc[_0xbc9b('0xa')];var _0x254b4e=_0x231d8c?_0x1db08d['count']:_0x2020dc[_0xbc9b('0xa')]+_0x2020dc[_0xbc9b('0xc')];var _0x8d2f82;if(_0x254b4e>=_0x2b4f4e){_0x254b4e=_0x2b4f4e;_0x8d2f82=0xc8;}else{_0x8d2f82=0xce;}_0x46cbd6[_0xbc9b('0x8')](_0x8d2f82);return _0x46cbd6[_0xbc9b('0xd')](_0xbc9b('0xe'),_0x25c119+'-'+_0x254b4e+'/'+_0x2b4f4e)[_0xbc9b('0x9')](_0x1db08d);}return null;};}function saveUpdates(_0x59f47b){return function(_0x1fba5d){if(_0x1fba5d){return _0x1fba5d[_0xbc9b('0xf')](_0x59f47b)[_0xbc9b('0x10')](function(_0x3f984d){return _0x3f984d;});}return null;};}function removeEntity(_0x5e6b22){return function(_0x5a07de){if(_0x5a07de){return _0x5a07de[_0xbc9b('0x11')]()[_0xbc9b('0x10')](function(){var _0x10558f=_0x5a07de[_0xbc9b('0x12')]({'plain':!![]});var _0x33f02d='SquareProjects';return db[_0xbc9b('0x13')]['destroy']({'where':{'type':_0x33f02d,'resourceId':_0x10558f['id']}})['then'](function(){return _0x5a07de;});})[_0xbc9b('0x10')](function(){var _0x1375b9=new Redis(config['redis']);_0x1375b9[_0xbc9b('0x14')](_0xbc9b('0x15'),JSON[_0xbc9b('0x16')]({'id':_0x5a07de['id'],'deleted':!![]}));})[_0xbc9b('0x10')](function(){_0x5e6b22[_0xbc9b('0x8')](0xcc)[_0xbc9b('0x17')]();});}};}function handleEntityNotFound(_0x33e2bd){return function(_0x439d4a){if(!_0x439d4a){_0x33e2bd[_0xbc9b('0x18')](0x194);}return _0x439d4a;};}function handleError(_0x148dbb,_0x4fbab4){_0x4fbab4=_0x4fbab4||0x1f4;return function(_0x4aba68){logger[_0xbc9b('0x19')](_0x4aba68['stack']);if(_0x4aba68[_0xbc9b('0x1a')]){delete _0x4aba68['name'];}_0x148dbb['status'](_0x4fbab4)[_0xbc9b('0x1b')](_0x4aba68);};}exports[_0xbc9b('0x1c')]=function(_0x2c3f07,_0x82fe0b){var _0x1154a5={},_0xbcf56={},_0x2c30c7={'count':0x0,'rows':[]};var _0x38312e=_['map'](db[_0xbc9b('0x1d')][_0xbc9b('0x1e')],function(_0x28654d){return{'name':_0x28654d['fieldName'],'type':_0x28654d[_0xbc9b('0x1f')]['key']};});_0xbcf56['model']=_['map'](_0x38312e,_0xbc9b('0x1a'));_0xbcf56[_0xbc9b('0x20')]=_[_0xbc9b('0x21')](_0x2c3f07[_0xbc9b('0x20')]);_0xbcf56[_0xbc9b('0x22')]=_[_0xbc9b('0x23')](_0xbcf56[_0xbc9b('0x24')],_0xbcf56['query']);_0x1154a5[_0xbc9b('0x25')]=_[_0xbc9b('0x23')](_0xbcf56[_0xbc9b('0x24')],qs['fields'](_0x2c3f07[_0xbc9b('0x20')][_0xbc9b('0x26')]));_0x1154a5[_0xbc9b('0x25')]=_0x1154a5[_0xbc9b('0x25')][_0xbc9b('0x27')]?_0x1154a5[_0xbc9b('0x25')]:_0xbcf56[_0xbc9b('0x24')];if(!_0x2c3f07[_0xbc9b('0x20')][_0xbc9b('0x28')](_0xbc9b('0x29'))){_0x1154a5[_0xbc9b('0xc')]=qs[_0xbc9b('0xc')](_0x2c3f07[_0xbc9b('0x20')][_0xbc9b('0xc')]);_0x1154a5[_0xbc9b('0xa')]=qs[_0xbc9b('0xa')](_0x2c3f07['query'][_0xbc9b('0xa')]);}_0x1154a5[_0xbc9b('0x2a')]=qs[_0xbc9b('0x2b')](_0x2c3f07[_0xbc9b('0x20')][_0xbc9b('0x2b')]);_0x1154a5[_0xbc9b('0x2c')]=qs[_0xbc9b('0x22')](_[_0xbc9b('0x2d')](_0x2c3f07[_0xbc9b('0x20')],_0xbcf56[_0xbc9b('0x22')]),_0x38312e);if(_0x2c3f07[_0xbc9b('0x20')][_0xbc9b('0x2e')]){_0x1154a5[_0xbc9b('0x2c')]=_['merge'](_0x1154a5[_0xbc9b('0x2c')],{'$or':_[_0xbc9b('0x2f')](_0x38312e,function(_0x2a9c80){if(_0x2a9c80[_0xbc9b('0x1f')]!==_0xbc9b('0x30')){var _0x3c6b86={};_0x3c6b86[_0x2a9c80[_0xbc9b('0x1a')]]={'$like':'%'+_0x2c3f07[_0xbc9b('0x20')][_0xbc9b('0x2e')]+'%'};return _0x3c6b86;}})});}_0x1154a5=_[_0xbc9b('0x31')]({},_0x1154a5,_0x2c3f07[_0xbc9b('0x32')]);var _0x5718ce={'where':_0x1154a5['where']};return db[_0xbc9b('0x1d')]['count'](_0x5718ce)[_0xbc9b('0x10')](function(_0x275c6a){_0x2c30c7[_0xbc9b('0x33')]=_0x275c6a;if(_0x2c3f07[_0xbc9b('0x20')]['includeAll']){_0x1154a5[_0xbc9b('0x34')]=[{'all':!![]}];}return db[_0xbc9b('0x1d')][_0xbc9b('0x35')](_0x1154a5);})[_0xbc9b('0x10')](function(_0x3d182e){_0x2c30c7[_0xbc9b('0x36')]=_0x3d182e;return _0x2c30c7;})['then'](respondWithFilteredResult(_0x82fe0b,_0x1154a5))[_0xbc9b('0x37')](handleError(_0x82fe0b,null));};exports['show']=function(_0x3dd698,_0x5ff82c){var _0x41792f={'raw':![],'where':{'id':_0x3dd698[_0xbc9b('0x38')]['id']}},_0x2c4018={};_0x2c4018[_0xbc9b('0x24')]=_['keys'](db[_0xbc9b('0x1d')][_0xbc9b('0x1e')]);_0x2c4018[_0xbc9b('0x20')]=_['keys'](_0x3dd698['query']);_0x2c4018[_0xbc9b('0x22')]=_[_0xbc9b('0x23')](_0x2c4018[_0xbc9b('0x24')],_0x2c4018[_0xbc9b('0x20')]);_0x41792f[_0xbc9b('0x25')]=_[_0xbc9b('0x23')](_0x2c4018[_0xbc9b('0x24')],qs[_0xbc9b('0x26')](_0x3dd698[_0xbc9b('0x20')][_0xbc9b('0x26')]));_0x41792f[_0xbc9b('0x25')]=_0x41792f['attributes'][_0xbc9b('0x27')]?_0x41792f[_0xbc9b('0x25')]:_0x2c4018[_0xbc9b('0x24')];if(_0x3dd698[_0xbc9b('0x20')][_0xbc9b('0x39')]){_0x41792f[_0xbc9b('0x34')]=[{'all':!![]}];}_0x41792f=_[_0xbc9b('0x31')]({},_0x41792f,_0x3dd698['options']);return db['SquareProject'][_0xbc9b('0x3a')](_0x41792f)[_0xbc9b('0x10')](handleEntityNotFound(_0x5ff82c,null))[_0xbc9b('0x10')](respondWithResult(_0x5ff82c,null))['catch'](handleError(_0x5ff82c,null));};exports[_0xbc9b('0x3b')]=function(_0x782633,_0x438d13){return db[_0xbc9b('0x1d')][_0xbc9b('0x3b')](_0x782633[_0xbc9b('0x3c')],{})[_0xbc9b('0x10')](function(_0x1df51c){var _0x2d9b19=_0x782633[_0xbc9b('0x3d')][_0xbc9b('0x12')]({'plain':!![]});if(!_0x2d9b19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d9b19['role']===_0xbc9b('0x3d')){var _0x5a3e7f=_0x1df51c['get']({'plain':!![]});var _0x1d446a=_0xbc9b('0x3e');return db[_0xbc9b('0x3f')][_0xbc9b('0x3a')]({'where':{'name':_0x1d446a,'userProfileId':_0x2d9b19[_0xbc9b('0x40')]},'raw':!![]})[_0xbc9b('0x10')](function(_0x4044fa){if(_0x4044fa&&_0x4044fa[_0xbc9b('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a3e7f['name'],'resourceId':_0x5a3e7f['id'],'type':_0x4044fa['name'],'sectionId':_0x4044fa['id']},{})[_0xbc9b('0x10')](function(){return _0x1df51c;});}else{return _0x1df51c;}})[_0xbc9b('0x37')](function(_0x52d5a4){logger['error'](_0xbc9b('0x42'),_0x52d5a4);throw _0x52d5a4;});}return _0x1df51c;})[_0xbc9b('0x10')](respondWithResult(_0x438d13,0xc9))[_0xbc9b('0x37')](handleError(_0x438d13,null));};exports[_0xbc9b('0xf')]=function(_0x35e3b6,_0x528df0){if(_0x35e3b6[_0xbc9b('0x3c')]['id']){delete _0x35e3b6[_0xbc9b('0x3c')]['id'];}return db[_0xbc9b('0x1d')][_0xbc9b('0x3a')]({'where':{'id':_0x35e3b6[_0xbc9b('0x38')]['id']}})[_0xbc9b('0x10')](handleEntityNotFound(_0x528df0,null))[_0xbc9b('0x10')](saveUpdates(_0x35e3b6[_0xbc9b('0x3c')],null))['then'](function(_0x4a1558){if(!_0x4a1558)return;var _0x1e65aa=_0x4a1558[_0xbc9b('0x12')]({'plain':!![]});return _0x1e65aa;})[_0xbc9b('0x10')](function(_0x460af4){var _0xca60fb=new Redis(config[_0xbc9b('0x5')]);_0xca60fb['publish'](_0xbc9b('0x15'),JSON['stringify'](_[_0xbc9b('0x2d')](_0x460af4,['id',_0xbc9b('0x1a'),_0xbc9b('0x43')])));return _0x460af4;})['then'](respondWithResult(_0x528df0,null))[_0xbc9b('0x37')](handleError(_0x528df0,null));};exports['destroy']=function(_0x522761,_0x5a5c5d){return db[_0xbc9b('0x1d')][_0xbc9b('0x3a')]({'where':{'id':_0x522761[_0xbc9b('0x38')]['id']}})[_0xbc9b('0x10')](handleEntityNotFound(_0x5a5c5d,null))[_0xbc9b('0x10')](removeEntity(_0x5a5c5d,null))[_0xbc9b('0x37')](handleError(_0x5a5c5d,null));}; \ No newline at end of file +var _0xd6d1=['agi','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','show','include','options','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','params'];(function(_0x4b8d5c,_0x21a495){var _0x568bba=function(_0x5ee637){while(--_0x5ee637){_0x4b8d5c['push'](_0x4b8d5c['shift']());}};_0x568bba(++_0x21a495);}(_0xd6d1,0x10e));var _0x1d6d=function(_0x2c56a2,_0x31f94e){_0x2c56a2=_0x2c56a2-0x0;var _0x49a1eb=_0xd6d1[_0x2c56a2];return _0x49a1eb;};'use strict';var _=require(_0x1d6d('0x0'));var Redis=require(_0x1d6d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x1d6d('0x2'))(_0x1d6d('0x3'));var config=require(_0x1d6d('0x4'));var db=require(_0x1d6d('0x5'))['db'];config['redis']=_[_0x1d6d('0x6')](config[_0x1d6d('0x7')],{'host':_0x1d6d('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')[_0x1d6d('0x9')](socket);function respondWithResult(_0x4c2eb6,_0x2ed467){_0x2ed467=_0x2ed467||0xc8;return function(_0x33ff69){if(_0x33ff69){return _0x4c2eb6[_0x1d6d('0xa')](_0x2ed467)[_0x1d6d('0xb')](_0x33ff69);}};}function respondWithFilteredResult(_0x599e85,_0x153345){return function(_0x10cd9d){if(_0x10cd9d){var _0xc96427=typeof _0x153345[_0x1d6d('0xc')]===_0x1d6d('0xd')&&typeof _0x153345[_0x1d6d('0xe')]===_0x1d6d('0xd');var _0x3c17bf=_0x10cd9d[_0x1d6d('0xf')];var _0xc36f41=_0xc96427?0x0:_0x153345[_0x1d6d('0xc')];var _0x818c2a=_0xc96427?_0x10cd9d[_0x1d6d('0xf')]:_0x153345['offset']+_0x153345[_0x1d6d('0xe')];var _0x5ae21c;if(_0x818c2a>=_0x3c17bf){_0x818c2a=_0x3c17bf;_0x5ae21c=0xc8;}else{_0x5ae21c=0xce;}_0x599e85[_0x1d6d('0xa')](_0x5ae21c);return _0x599e85[_0x1d6d('0x10')]('Content-Range',_0xc36f41+'-'+_0x818c2a+'/'+_0x3c17bf)[_0x1d6d('0xb')](_0x10cd9d);}return null;};}function saveUpdates(_0x48b877){return function(_0xc509a1){if(_0xc509a1){return _0xc509a1[_0x1d6d('0x11')](_0x48b877)[_0x1d6d('0x12')](function(_0x408236){return _0x408236;});}return null;};}function removeEntity(_0x137f33){return function(_0x1a3bfd){if(_0x1a3bfd){return _0x1a3bfd[_0x1d6d('0x13')]()[_0x1d6d('0x12')](function(){var _0x475322=_0x1a3bfd[_0x1d6d('0x14')]({'plain':!![]});var _0x53b665='SquareProjects';return db[_0x1d6d('0x15')]['destroy']({'where':{'type':_0x53b665,'resourceId':_0x475322['id']}})['then'](function(){return _0x1a3bfd;});})[_0x1d6d('0x12')](function(){var _0x49d80d=new Redis(config['redis']);_0x49d80d['publish']('agi',JSON['stringify']({'id':_0x1a3bfd['id'],'deleted':!![]}));})['then'](function(){_0x137f33[_0x1d6d('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e8c28){return function(_0x41af87){if(!_0x41af87){_0x3e8c28[_0x1d6d('0x16')](0x194);}return _0x41af87;};}function handleError(_0x4d6ed7,_0x1ccf8c){_0x1ccf8c=_0x1ccf8c||0x1f4;return function(_0x8065f6){logger[_0x1d6d('0x17')](_0x8065f6[_0x1d6d('0x18')]);if(_0x8065f6['name']){delete _0x8065f6[_0x1d6d('0x19')];}_0x4d6ed7[_0x1d6d('0xa')](_0x1ccf8c)[_0x1d6d('0x1a')](_0x8065f6);};}exports[_0x1d6d('0x1b')]=function(_0x334015,_0x3bb617){var _0x2bd59d={},_0x13b217={},_0x4ec070={'count':0x0,'rows':[]};var _0x942c61=_[_0x1d6d('0x1c')](db[_0x1d6d('0x1d')][_0x1d6d('0x1e')],function(_0x19bc90){return{'name':_0x19bc90[_0x1d6d('0x1f')],'type':_0x19bc90[_0x1d6d('0x20')]['key']};});_0x13b217['model']=_[_0x1d6d('0x1c')](_0x942c61,'name');_0x13b217[_0x1d6d('0x21')]=_[_0x1d6d('0x22')](_0x334015[_0x1d6d('0x21')]);_0x13b217[_0x1d6d('0x23')]=_[_0x1d6d('0x24')](_0x13b217['model'],_0x13b217[_0x1d6d('0x21')]);_0x2bd59d['attributes']=_[_0x1d6d('0x24')](_0x13b217[_0x1d6d('0x25')],qs[_0x1d6d('0x26')](_0x334015[_0x1d6d('0x21')][_0x1d6d('0x26')]));_0x2bd59d['attributes']=_0x2bd59d[_0x1d6d('0x27')]['length']?_0x2bd59d[_0x1d6d('0x27')]:_0x13b217[_0x1d6d('0x25')];if(!_0x334015[_0x1d6d('0x21')][_0x1d6d('0x28')]('nolimit')){_0x2bd59d[_0x1d6d('0xe')]=qs['limit'](_0x334015[_0x1d6d('0x21')][_0x1d6d('0xe')]);_0x2bd59d[_0x1d6d('0xc')]=qs[_0x1d6d('0xc')](_0x334015[_0x1d6d('0x21')][_0x1d6d('0xc')]);}_0x2bd59d['order']=qs[_0x1d6d('0x29')](_0x334015['query'][_0x1d6d('0x29')]);_0x2bd59d['where']=qs[_0x1d6d('0x23')](_[_0x1d6d('0x2a')](_0x334015[_0x1d6d('0x21')],_0x13b217[_0x1d6d('0x23')]),_0x942c61);if(_0x334015[_0x1d6d('0x21')][_0x1d6d('0x2b')]){_0x2bd59d[_0x1d6d('0x2c')]=_['merge'](_0x2bd59d[_0x1d6d('0x2c')],{'$or':_[_0x1d6d('0x1c')](_0x942c61,function(_0x3f93ad){if(_0x3f93ad[_0x1d6d('0x20')]!==_0x1d6d('0x2d')){var _0x2096f0={};_0x2096f0[_0x3f93ad['name']]={'$like':'%'+_0x334015[_0x1d6d('0x21')][_0x1d6d('0x2b')]+'%'};return _0x2096f0;}})});}_0x2bd59d=_[_0x1d6d('0x2e')]({},_0x2bd59d,_0x334015['options']);var _0x569640={'where':_0x2bd59d['where']};return db[_0x1d6d('0x1d')][_0x1d6d('0xf')](_0x569640)[_0x1d6d('0x12')](function(_0x24066e){_0x4ec070['count']=_0x24066e;if(_0x334015[_0x1d6d('0x21')][_0x1d6d('0x2f')]){_0x2bd59d['include']=[{'all':!![]}];}return db[_0x1d6d('0x1d')][_0x1d6d('0x30')](_0x2bd59d);})['then'](function(_0x223bbe){_0x4ec070[_0x1d6d('0x31')]=_0x223bbe;return _0x4ec070;})[_0x1d6d('0x12')](respondWithFilteredResult(_0x3bb617,_0x2bd59d))[_0x1d6d('0x32')](handleError(_0x3bb617,null));};exports[_0x1d6d('0x33')]=function(_0x3795b7,_0x106ba8){var _0x204833={'raw':![],'where':{'id':_0x3795b7['params']['id']}},_0xb8845f={};_0xb8845f[_0x1d6d('0x25')]=_[_0x1d6d('0x22')](db[_0x1d6d('0x1d')][_0x1d6d('0x1e')]);_0xb8845f['query']=_[_0x1d6d('0x22')](_0x3795b7[_0x1d6d('0x21')]);_0xb8845f['filters']=_['intersection'](_0xb8845f['model'],_0xb8845f[_0x1d6d('0x21')]);_0x204833[_0x1d6d('0x27')]=_['intersection'](_0xb8845f['model'],qs[_0x1d6d('0x26')](_0x3795b7[_0x1d6d('0x21')][_0x1d6d('0x26')]));_0x204833[_0x1d6d('0x27')]=_0x204833[_0x1d6d('0x27')]['length']?_0x204833[_0x1d6d('0x27')]:_0xb8845f[_0x1d6d('0x25')];if(_0x3795b7['query'][_0x1d6d('0x2f')]){_0x204833[_0x1d6d('0x34')]=[{'all':!![]}];}_0x204833=_[_0x1d6d('0x2e')]({},_0x204833,_0x3795b7[_0x1d6d('0x35')]);return db[_0x1d6d('0x1d')][_0x1d6d('0x36')](_0x204833)[_0x1d6d('0x12')](handleEntityNotFound(_0x106ba8,null))['then'](respondWithResult(_0x106ba8,null))[_0x1d6d('0x32')](handleError(_0x106ba8,null));};exports['create']=function(_0xcfe7b0,_0x8d6f5){return db[_0x1d6d('0x1d')][_0x1d6d('0x37')](_0xcfe7b0['body'],{})[_0x1d6d('0x12')](function(_0xae308f){var _0xe32440=_0xcfe7b0[_0x1d6d('0x38')][_0x1d6d('0x14')]({'plain':!![]});if(!_0xe32440)throw new Error(_0x1d6d('0x39'));if(_0xe32440[_0x1d6d('0x3a')]===_0x1d6d('0x38')){var _0x333dd1=_0xae308f['get']({'plain':!![]});var _0x2dd978='SquareProjects';return db[_0x1d6d('0x3b')][_0x1d6d('0x36')]({'where':{'name':_0x2dd978,'userProfileId':_0xe32440[_0x1d6d('0x3c')]},'raw':!![]})[_0x1d6d('0x12')](function(_0x8c7678){if(_0x8c7678&&_0x8c7678[_0x1d6d('0x3d')]===0x0){return db[_0x1d6d('0x15')]['create']({'name':_0x333dd1[_0x1d6d('0x19')],'resourceId':_0x333dd1['id'],'type':_0x8c7678[_0x1d6d('0x19')],'sectionId':_0x8c7678['id']},{})[_0x1d6d('0x12')](function(){return _0xae308f;});}else{return _0xae308f;}})['catch'](function(_0x51b932){logger[_0x1d6d('0x17')](_0x1d6d('0x3e'),_0x51b932);throw _0x51b932;});}return _0xae308f;})[_0x1d6d('0x12')](respondWithResult(_0x8d6f5,0xc9))[_0x1d6d('0x32')](handleError(_0x8d6f5,null));};exports[_0x1d6d('0x11')]=function(_0x281b69,_0x123709){if(_0x281b69[_0x1d6d('0x3f')]['id']){delete _0x281b69['body']['id'];}return db[_0x1d6d('0x1d')][_0x1d6d('0x36')]({'where':{'id':_0x281b69[_0x1d6d('0x40')]['id']}})[_0x1d6d('0x12')](handleEntityNotFound(_0x123709,null))[_0x1d6d('0x12')](saveUpdates(_0x281b69['body'],null))['then'](function(_0xf85964){if(!_0xf85964)return;var _0x15da87=_0xf85964['get']({'plain':!![]});return _0x15da87;})[_0x1d6d('0x12')](function(_0x4e818a){var _0x5828b7=new Redis(config[_0x1d6d('0x7')]);_0x5828b7['publish'](_0x1d6d('0x41'),JSON['stringify'](_[_0x1d6d('0x2a')](_0x4e818a,['id',_0x1d6d('0x19'),_0x1d6d('0x42')])));return _0x4e818a;})[_0x1d6d('0x12')](respondWithResult(_0x123709,null))[_0x1d6d('0x32')](handleError(_0x123709,null));};exports[_0x1d6d('0x13')]=function(_0x581d95,_0x23bfd0){return db[_0x1d6d('0x1d')][_0x1d6d('0x36')]({'where':{'id':_0x581d95['params']['id']}})[_0x1d6d('0x12')](handleEntityNotFound(_0x23bfd0,null))[_0x1d6d('0x12')](removeEntity(_0x23bfd0,null))[_0x1d6d('0x32')](handleError(_0x23bfd0,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8bdf415..a84257d 100644 --- a/server/api/squareProject/squareProject.events.js +++ b/server/api/squareProject/squareProject.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef31=['SquareProject','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x444ac9,_0x57981c){var _0x51d12d=function(_0x52dda7){while(--_0x52dda7){_0x444ac9['push'](_0x444ac9['shift']());}};_0x51d12d(++_0x57981c);}(_0xef31,0x194));var _0x1ef3=function(_0x49ff48,_0x413d68){_0x49ff48=_0x49ff48-0x0;var _0x8ed443=_0xef31[_0x49ff48];return _0x8ed443;};'use strict';var EventEmitter=require(_0x1ef3('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x1ef3('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1ef3('0x2')](0x0);var events={'afterCreate':_0x1ef3('0x3'),'afterUpdate':_0x1ef3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a5b24){return function(_0x212540,_0x506edf,_0x54a69c){SquareProjectEvents['emit'](_0x2a5b24+':'+_0x212540['id'],_0x212540);SquareProjectEvents[_0x1ef3('0x5')](_0x2a5b24,_0x212540);_0x54a69c(null);};}for(var e in events){if(events[_0x1ef3('0x6')](e)){var event=events[e];SquareProject[_0x1ef3('0x7')](e,emitEvent(event));}}module[_0x1ef3('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xcc54=['emit','hook','exports','events','SquareProject','setMaxListeners','update','remove'];(function(_0x43e051,_0x442a8b){var _0x289561=function(_0x3af375){while(--_0x3af375){_0x43e051['push'](_0x43e051['shift']());}};_0x289561(++_0x442a8b);}(_0xcc54,0x193));var _0x4cc5=function(_0x1e478c,_0x358e3a){_0x1e478c=_0x1e478c-0x0;var _0x460206=_0xcc54[_0x1e478c];return _0x460206;};'use strict';var EventEmitter=require(_0x4cc5('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x4cc5('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4cc5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4cc5('0x3'),'afterDestroy':_0x4cc5('0x4')};function emitEvent(_0x27f0c9){return function(_0x11a1d0,_0x231ec2,_0x35d32a){SquareProjectEvents[_0x4cc5('0x5')](_0x27f0c9+':'+_0x11a1d0['id'],_0x11a1d0);SquareProjectEvents[_0x4cc5('0x5')](_0x27f0c9,_0x11a1d0);_0x35d32a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x4cc5('0x6')](e,emitEvent(event));}}module[_0x4cc5('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7c25a29..5bec32e 100644 --- a/server/api/squareProject/squareProject.model.js +++ b/server/api/squareProject/squareProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76e3=['path','rimraf','../../config/environment','./squareProject.attributes','SquareProject','square_projects','changed','preproduction','savedAt','production','publishedAt','format','lodash','util','api','moment','bluebird'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x76e3,0x14f));var _0x376e=function(_0x18dd7a,_0x109bed){_0x18dd7a=_0x18dd7a-0x0;var _0x553b51=_0x76e3[_0x18dd7a];return _0x553b51;};'use strict';var _=require(_0x376e('0x0'));var util=require(_0x376e('0x1'));var logger=require('../../config/logger')(_0x376e('0x2'));var moment=require(_0x376e('0x3'));var BPromise=require(_0x376e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x376e('0x5'));var rimraf=require(_0x376e('0x6'));var config=require(_0x376e('0x7'));var attributes=require(_0x376e('0x8'));module['exports']=function(_0x17053d,_0x3271a5){return _0x17053d['define'](_0x376e('0x9'),attributes,{'tableName':_0x376e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52f633,_0xc56e01,_0x136a33){if(_0x52f633[_0x376e('0xb')](_0x376e('0xc'))){_0x52f633[_0x376e('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x52f633[_0x376e('0xb')](_0x376e('0xe'))){_0x52f633[_0x376e('0xf')]=moment()[_0x376e('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x136a33(null,_0x52f633);}}});}; \ No newline at end of file +var _0xe79d=['exports','define','SquareProject','changed','savedAt','format','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareProject.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe79d,0x1b1));var _0xde79=function(_0x4b0c6,_0x119783){_0x4b0c6=_0x4b0c6-0x0;var _0x3648c7=_0xe79d[_0x4b0c6];return _0x3648c7;};'use strict';var _=require(_0xde79('0x0'));var util=require(_0xde79('0x1'));var logger=require(_0xde79('0x2'))(_0xde79('0x3'));var moment=require('moment');var BPromise=require(_0xde79('0x4'));var rp=require(_0xde79('0x5'));var fs=require('fs');var path=require(_0xde79('0x6'));var rimraf=require('rimraf');var config=require(_0xde79('0x7'));var attributes=require(_0xde79('0x8'));module[_0xde79('0x9')]=function(_0x47ab3f,_0xf7c675){return _0x47ab3f[_0xde79('0xa')](_0xde79('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f7b9d,_0x32e59a,_0x5e42fe){if(_0x3f7b9d[_0xde79('0xc')]('preproduction')){_0x3f7b9d[_0xde79('0xd')]=moment()[_0xde79('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3f7b9d[_0xde79('0xc')]('production')){_0x3f7b9d[_0xde79('0xf')]=moment()[_0xde79('0xe')](_0xde79('0x10'));}_0x5e42fe(null,_0x3f7b9d);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 45ce0ab..4743680 100644 --- a/server/api/squareProject/squareProject.rpc.js +++ b/server/api/squareProject/squareProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d34=['../../mysqldb','rpc','redis','localhost','./squareProject.socket','register','SquareProject','findAll','options','raw','where','include','map','model','attributes','then','info','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','ioredis'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0x7d34,0x15d));var _0x47d3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7d34[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x47d3('0x0'));var Redis=require(_0x47d3('0x1'));var db=require(_0x47d3('0x2'))['db'];var logger=require('../../config/logger')(_0x47d3('0x3'));var config=require('../../config/environment');config[_0x47d3('0x4')]=_['defaults'](config[_0x47d3('0x4')],{'host':_0x47d3('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47d3('0x4')]));require(_0x47d3('0x6'))[_0x47d3('0x7')](socket);exports['GetSquareProjects']=function(_0x1edbe1){var _0x22a7e8=this;return new Promise(function(_0x47b547,_0x1d3cf7){return db[_0x47d3('0x8')][_0x47d3('0x9')]({'raw':_0x1edbe1[_0x47d3('0xa')]?_0x1edbe1[_0x47d3('0xa')][_0x47d3('0xb')]===undefined?!![]:![]:!![],'where':_0x1edbe1[_0x47d3('0xa')]?_0x1edbe1[_0x47d3('0xa')][_0x47d3('0xc')]||null:null,'attributes':_0x1edbe1['options']?_0x1edbe1[_0x47d3('0xa')]['attributes']||null:null,'limit':_0x1edbe1['options']?_0x1edbe1[_0x47d3('0xa')]['limit']||null:null,'include':_0x1edbe1['options']?_0x1edbe1[_0x47d3('0xa')][_0x47d3('0xd')]?_[_0x47d3('0xe')](_0x1edbe1['options'][_0x47d3('0xd')],function(_0x2fc4bb){return{'model':db[_0x2fc4bb[_0x47d3('0xf')]],'as':_0x2fc4bb['as'],'attributes':_0x2fc4bb['attributes'],'include':_0x2fc4bb[_0x47d3('0xd')]?_[_0x47d3('0xe')](_0x2fc4bb[_0x47d3('0xd')],function(_0x9b894d){return{'model':db[_0x9b894d[_0x47d3('0xf')]],'as':_0x9b894d['as'],'attributes':_0x9b894d[_0x47d3('0x10')],'include':_0x9b894d['include']?_['map'](_0x9b894d[_0x47d3('0xd')],function(_0x335a28){return{'model':db[_0x335a28[_0x47d3('0xf')]],'as':_0x335a28['as'],'attributes':_0x335a28[_0x47d3('0x10')]};}):[]};}):[]};}):[]:[]})[_0x47d3('0x11')](function(_0x41e92a){logger[_0x47d3('0x12')](_0x47d3('0x13'),_0x1edbe1);logger[_0x47d3('0x14')]('GetSquareProjects',_0x1edbe1,JSON[_0x47d3('0x15')](_0x41e92a));_0x47b547(_0x41e92a);})[_0x47d3('0x16')](function(_0x6f5af1){logger[_0x47d3('0x17')](_0x47d3('0x13'),_0x6f5af1[_0x47d3('0x18')],_0x1edbe1);_0x1d3cf7(_0x22a7e8['error'](0x1f4,_0x6f5af1[_0x47d3('0x18')]));});});};exports[_0x47d3('0x19')]=function(_0x43ab89){var _0x5db0d3=this;return new Promise(function(_0x2aaf5a,_0x8975cc){return db[_0x47d3('0x8')][_0x47d3('0x1a')]({'raw':_0x43ab89['options']?_0x43ab89[_0x47d3('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x43ab89['options']?_0x43ab89[_0x47d3('0xa')]['where']||null:null,'attributes':_0x43ab89[_0x47d3('0xa')]?_0x43ab89[_0x47d3('0xa')][_0x47d3('0x10')]||null:null,'include':_0x43ab89[_0x47d3('0xa')]?_0x43ab89[_0x47d3('0xa')][_0x47d3('0xd')]?_[_0x47d3('0xe')](_0x43ab89[_0x47d3('0xa')][_0x47d3('0xd')],function(_0x548fe0){return{'model':db[_0x548fe0[_0x47d3('0xf')]],'as':_0x548fe0['as'],'attributes':_0x548fe0[_0x47d3('0x10')],'include':_0x548fe0[_0x47d3('0xd')]?_[_0x47d3('0xe')](_0x548fe0[_0x47d3('0xd')],function(_0x309a4b){return{'model':db[_0x309a4b[_0x47d3('0xf')]],'as':_0x309a4b['as'],'attributes':_0x309a4b['attributes'],'include':_0x309a4b[_0x47d3('0xd')]?_[_0x47d3('0xe')](_0x309a4b['include'],function(_0x5ed894){return{'model':db[_0x5ed894[_0x47d3('0xf')]],'as':_0x5ed894['as'],'attributes':_0x5ed894[_0x47d3('0x10')]};}):[]};}):[]};}):[]:[]})[_0x47d3('0x11')](function(_0x461bb2){logger[_0x47d3('0x12')](_0x47d3('0x19'),_0x43ab89);logger[_0x47d3('0x14')](_0x47d3('0x19'),_0x43ab89,JSON[_0x47d3('0x15')](_0x461bb2));_0x2aaf5a(_0x461bb2);})[_0x47d3('0x16')](function(_0x21e522){logger[_0x47d3('0x17')](_0x47d3('0x19'),_0x21e522[_0x47d3('0x18')],_0x43ab89);_0x8975cc(_0x5db0d3[_0x47d3('0x17')](0x1f4,_0x21e522['message']));});});}; \ No newline at end of file +var _0xe103=['GetSquareProjects','debug','message','ShowSquareProject','find','stringify','catch','error','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','./squareProject.socket','SquareProject','findAll','raw','options','where','attributes','limit','include','map','model','then','info'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0xe103,0xe8));var _0x3e10=function(_0x20d057,_0x1f77a9){_0x20d057=_0x20d057-0x0;var _0x1694df=_0xe103[_0x20d057];return _0x1694df;};'use strict';var _=require(_0x3e10('0x0'));var Redis=require('ioredis');var db=require(_0x3e10('0x1'))['db'];var logger=require(_0x3e10('0x2'))(_0x3e10('0x3'));var config=require(_0x3e10('0x4'));config[_0x3e10('0x5')]=_['defaults'](config[_0x3e10('0x5')],{'host':_0x3e10('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e10('0x5')]));require(_0x3e10('0x7'))['register'](socket);exports['GetSquareProjects']=function(_0x4accb3){var _0x73b72a=this;return new Promise(function(_0x548bdd,_0x167229){return db[_0x3e10('0x8')][_0x3e10('0x9')]({'raw':_0x4accb3['options']?_0x4accb3['options'][_0x3e10('0xa')]===undefined?!![]:![]:!![],'where':_0x4accb3[_0x3e10('0xb')]?_0x4accb3[_0x3e10('0xb')][_0x3e10('0xc')]||null:null,'attributes':_0x4accb3[_0x3e10('0xb')]?_0x4accb3[_0x3e10('0xb')][_0x3e10('0xd')]||null:null,'limit':_0x4accb3['options']?_0x4accb3['options'][_0x3e10('0xe')]||null:null,'include':_0x4accb3[_0x3e10('0xb')]?_0x4accb3[_0x3e10('0xb')][_0x3e10('0xf')]?_[_0x3e10('0x10')](_0x4accb3[_0x3e10('0xb')]['include'],function(_0x42443){return{'model':db[_0x42443[_0x3e10('0x11')]],'as':_0x42443['as'],'attributes':_0x42443['attributes'],'include':_0x42443[_0x3e10('0xf')]?_[_0x3e10('0x10')](_0x42443[_0x3e10('0xf')],function(_0x3298f2){return{'model':db[_0x3298f2['model']],'as':_0x3298f2['as'],'attributes':_0x3298f2[_0x3e10('0xd')],'include':_0x3298f2[_0x3e10('0xf')]?_['map'](_0x3298f2['include'],function(_0x40ee49){return{'model':db[_0x40ee49[_0x3e10('0x11')]],'as':_0x40ee49['as'],'attributes':_0x40ee49[_0x3e10('0xd')]};}):[]};}):[]};}):[]:[]})[_0x3e10('0x12')](function(_0x5ca773){logger[_0x3e10('0x13')](_0x3e10('0x14'),_0x4accb3);logger[_0x3e10('0x15')]('GetSquareProjects',_0x4accb3,JSON['stringify'](_0x5ca773));_0x548bdd(_0x5ca773);})['catch'](function(_0x32dce6){logger['error'](_0x3e10('0x14'),_0x32dce6[_0x3e10('0x16')],_0x4accb3);_0x167229(_0x73b72a['error'](0x1f4,_0x32dce6['message']));});});};exports[_0x3e10('0x17')]=function(_0xe998e5){var _0x39a304=this;return new Promise(function(_0x913944,_0x567599){return db['SquareProject'][_0x3e10('0x18')]({'raw':_0xe998e5[_0x3e10('0xb')]?_0xe998e5[_0x3e10('0xb')][_0x3e10('0xa')]===undefined?!![]:![]:!![],'where':_0xe998e5['options']?_0xe998e5[_0x3e10('0xb')]['where']||null:null,'attributes':_0xe998e5[_0x3e10('0xb')]?_0xe998e5[_0x3e10('0xb')][_0x3e10('0xd')]||null:null,'include':_0xe998e5[_0x3e10('0xb')]?_0xe998e5[_0x3e10('0xb')][_0x3e10('0xf')]?_['map'](_0xe998e5['options'][_0x3e10('0xf')],function(_0x440697){return{'model':db[_0x440697[_0x3e10('0x11')]],'as':_0x440697['as'],'attributes':_0x440697[_0x3e10('0xd')],'include':_0x440697['include']?_['map'](_0x440697[_0x3e10('0xf')],function(_0x455d51){return{'model':db[_0x455d51[_0x3e10('0x11')]],'as':_0x455d51['as'],'attributes':_0x455d51[_0x3e10('0xd')],'include':_0x455d51['include']?_[_0x3e10('0x10')](_0x455d51['include'],function(_0x49d9e8){return{'model':db[_0x49d9e8['model']],'as':_0x49d9e8['as'],'attributes':_0x49d9e8[_0x3e10('0xd')]};}):[]};}):[]};}):[]:[]})[_0x3e10('0x12')](function(_0x3ecf09){logger['info'](_0x3e10('0x17'),_0xe998e5);logger[_0x3e10('0x15')](_0x3e10('0x17'),_0xe998e5,JSON[_0x3e10('0x19')](_0x3ecf09));_0x913944(_0x3ecf09);})[_0x3e10('0x1a')](function(_0x356ee4){logger[_0x3e10('0x1b')]('ShowSquareProject',_0x356ee4[_0x3e10('0x16')],_0xe998e5);_0x567599(_0x39a304['error'](0x1f4,_0x356ee4[_0x3e10('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 14ecd22..c54b8d9 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7610=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x2902cc,_0x30f317){var _0xf5a218=function(_0x2a3466){while(--_0x2a3466){_0x2902cc['push'](_0x2902cc['shift']());}};_0xf5a218(++_0x30f317);}(_0x7610,0xb1));var _0x0761=function(_0x3dfe61,_0x276323){_0x3dfe61=_0x3dfe61-0x0;var _0x5e59e7=_0x7610[_0x3dfe61];return _0x5e59e7;};'use strict';var SquareProjectEvents=require(_0x0761('0x0'));var events=[_0x0761('0x1'),_0x0761('0x2'),_0x0761('0x3')];function createListener(_0x34d349,_0x1d43eb){return function(_0x3df3f7){_0x1d43eb[_0x0761('0x4')](_0x34d349,_0x3df3f7);};}function removeListener(_0x3a73c5,_0x1d46e0){return function(){SquareProjectEvents[_0x0761('0x5')](_0x3a73c5,_0x1d46e0);};}exports[_0x0761('0x6')]=function(_0x5cf2d3){for(var _0x5daaa4=0x0,_0x3236ac=events[_0x0761('0x7')];_0x5daaa4<_0x3236ac;_0x5daaa4++){var _0x545e0d=events[_0x5daaa4];var _0x5bbf68=createListener(_0x0761('0x8')+_0x545e0d,_0x5cf2d3);SquareProjectEvents['on'](_0x545e0d,_0x5bbf68);}}; \ No newline at end of file +var _0x9b38=['emit','register','length','squareProject:','./squareProject.events','remove'];(function(_0x528434,_0x4b332c){var _0x428050=function(_0x471f40){while(--_0x471f40){_0x528434['push'](_0x528434['shift']());}};_0x428050(++_0x4b332c);}(_0x9b38,0x148));var _0x89b3=function(_0x1deabe,_0x2837d6){_0x1deabe=_0x1deabe-0x0;var _0x2b57b2=_0x9b38[_0x1deabe];return _0x2b57b2;};'use strict';var SquareProjectEvents=require(_0x89b3('0x0'));var events=['save',_0x89b3('0x1'),'update'];function createListener(_0x44e48f,_0x3eb48b){return function(_0x4574fd){_0x3eb48b[_0x89b3('0x2')](_0x44e48f,_0x4574fd);};}function removeListener(_0x214305,_0x4108a7){return function(){SquareProjectEvents['removeListener'](_0x214305,_0x4108a7);};}exports[_0x89b3('0x3')]=function(_0x5a14fe){for(var _0xe09210=0x0,_0x2de294=events[_0x89b3('0x4')];_0xe09210<_0x2de294;_0xe09210++){var _0x548b1b=events[_0xe09210];var _0x1a4c07=createListener(_0x89b3('0x5')+_0x548b1b,_0x5a14fe);SquareProjectEvents['on'](_0x548b1b,_0x1a4c07);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8773c02..ec79817 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x2b1d0a,_0x126693){var _0x2e5ab2=function(_0x1e7a4d){while(--_0x1e7a4d){_0x2b1d0a['push'](_0x2b1d0a['shift']());}};_0x2e5ab2(++_0x126693);}(_0x814b,0x1a2));var _0xb814=function(_0x26cd05,_0x1f7d74){_0x26cd05=_0x26cd05-0x0;var _0x3e13b9=_0x814b[_0x26cd05];return _0x3e13b9;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x44c553,_0x56edfa){var _0x207c14=function(_0x201a5d){while(--_0x201a5d){_0x44c553['push'](_0x44c553['shift']());}};_0x207c14(++_0x56edfa);}(_0xf494,0x1c6));var _0x4f49=function(_0x408c3d,_0x5e7b7d){_0x408c3d=_0x408c3d-0x0;var _0x388c3a=_0xf494[_0x408c3d];return _0x388c3a;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index fcf8f48..73ad6ea 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x8fb7a4,_0x607700){var _0x1fdca2=function(_0x300754){while(--_0x300754){_0x8fb7a4['push'](_0x8fb7a4['shift']());}};_0x1fdca2(++_0x607700);}(_0x6aa7,0x178));var _0x76aa=function(_0x253f8e,_0x1e268b){_0x253f8e=_0x253f8e-0x0;var _0x18e07d=_0x6aa7[_0x253f8e];return _0x18e07d;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file +var _0x7dfd=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x298849,_0x410ef6){var _0x429fed=function(_0x3f9f07){while(--_0x3f9f07){_0x298849['push'](_0x298849['shift']());}};_0x429fed(++_0x410ef6);}(_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')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'extension':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'dnid':{'type':Sequelize[_0xd7df('0x2')]},'projectName':{'type':Sequelize[_0xd7df('0x2')]},'saveName':{'type':Sequelize[_0xd7df('0x2')]},'filename':{'type':Sequelize[_0xd7df('0x2')]},'savePath':{'type':Sequelize[_0xd7df('0x2')]},'format':{'type':Sequelize[_0xd7df('0x3')],'get':function(){var _0x16e50='';var _0x2c48a4=this['getDataValue'](_0xd7df('0x4'));if(_0x2c48a4){_0x16e50=_0x2c48a4[_0xd7df('0x5')](_0x2c48a4[_0xd7df('0x6')]('.'));}return _0x16e50;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 00826ff..65bd262 100644 --- a/server/api/squareRecording/squareRecording.controller.js +++ b/server/api/squareRecording/squareRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7755=['.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','options','create','body','find','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','download','unlink','message','Not\x20found','isNil','info','File:\x20\x22','unlinkSync'];(function(_0x3d5a69,_0x444748){var _0x3dd468=function(_0x31bae8){while(--_0x31bae8){_0x3d5a69['push'](_0x3d5a69['shift']());}};_0x3dd468(++_0x444748);}(_0x7755,0x18a));var _0x5775=function(_0xb1496a,_0x190543){_0xb1496a=_0xb1496a-0x0;var _0x301916=_0x7755[_0xb1496a];return _0x301916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5775('0x0'));var zipdir=require(_0x5775('0x1'));var jsonpatch=require(_0x5775('0x2'));var rp=require(_0x5775('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5775('0x4'));var util=require(_0x5775('0x5'));var path=require(_0x5775('0x6'));var sox=require(_0x5775('0x7'));var csv=require(_0x5775('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5775('0x9'));var _=require(_0x5775('0xa'));var squel=require('squel');var crypto=require(_0x5775('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5775('0xc'));var toCsv=require(_0x5775('0x8'));var querystring=require(_0x5775('0xd'));var Papa=require(_0x5775('0xe'));var Redis=require(_0x5775('0xf'));var authService=require(_0x5775('0x10'));var qs=require(_0x5775('0x11'));var as=require(_0x5775('0x12'));var hardwareService=require(_0x5775('0x13'));var logger=require(_0x5775('0x14'))(_0x5775('0x15'));var utils=require(_0x5775('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5775('0x17'));var db=require(_0x5775('0x18'))['db'];function respondWithStatusCode(_0x557f4a,_0x4255ba){_0x4255ba=_0x4255ba||0xcc;return function(_0x281c55){if(_0x281c55){return _0x557f4a[_0x5775('0x19')](_0x4255ba);}return _0x557f4a['status'](_0x4255ba)['end']();};}function respondWithResult(_0x2b9c93,_0x1a9bc2){_0x1a9bc2=_0x1a9bc2||0xc8;return function(_0x25782a){if(_0x25782a){return _0x2b9c93[_0x5775('0x1a')](_0x1a9bc2)[_0x5775('0x1b')](_0x25782a);}};}function respondWithFilteredResult(_0xfce9fb,_0x4d6f66){return function(_0x4ee89b){if(_0x4ee89b){var _0x56895d=typeof _0x4d6f66[_0x5775('0x1c')]===_0x5775('0x1d')&&typeof _0x4d6f66[_0x5775('0x1e')]===_0x5775('0x1d');var _0x1b5055=_0x4ee89b['count'];var _0x3ed377=_0x56895d?0x0:_0x4d6f66[_0x5775('0x1c')];var _0x4921b7=_0x56895d?_0x4ee89b[_0x5775('0x1f')]:_0x4d6f66[_0x5775('0x1c')]+_0x4d6f66[_0x5775('0x1e')];var _0x5d9fce;if(_0x4921b7>=_0x1b5055){_0x4921b7=_0x1b5055;_0x5d9fce=0xc8;}else{_0x5d9fce=0xce;}_0xfce9fb[_0x5775('0x1a')](_0x5d9fce);return _0xfce9fb[_0x5775('0x20')](_0x5775('0x21'),_0x3ed377+'-'+_0x4921b7+'/'+_0x1b5055)['json'](_0x4ee89b);}return null;};}function patchUpdates(_0x496e63){return function(_0x188cb0){try{jsonpatch[_0x5775('0x22')](_0x188cb0,_0x496e63,!![]);}catch(_0x4ace9c){return BPromise[_0x5775('0x23')](_0x4ace9c);}return _0x188cb0[_0x5775('0x24')]();};}function saveUpdates(_0x1c4bc8,_0x48d2f4){return function(_0x35cb18){if(_0x35cb18){return _0x35cb18[_0x5775('0x25')](_0x1c4bc8)['then'](function(_0x5af09d){return _0x5af09d;});}return null;};}function removeEntity(_0xdc29e2,_0x3bb634){return function(_0x4cd58b){if(_0x4cd58b){return _0x4cd58b[_0x5775('0x26')]()['then'](function(){_0xdc29e2[_0x5775('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1adee5,_0x36467b){return function(_0x333682){if(!_0x333682){_0x1adee5[_0x5775('0x19')](0x194);}return _0x333682;};}function handleError(_0x40fcaa,_0x254f0b){_0x254f0b=_0x254f0b||0x1f4;return function(_0x6aa3ae){logger[_0x5775('0x27')](_0x6aa3ae[_0x5775('0x28')]);if(_0x6aa3ae[_0x5775('0x29')]){delete _0x6aa3ae[_0x5775('0x29')];}_0x40fcaa[_0x5775('0x1a')](_0x254f0b)[_0x5775('0x2a')](_0x6aa3ae);};}exports[_0x5775('0x2b')]=function(_0x38a337,_0x1ceb40){var _0x5f49a8={},_0x377dbc={},_0x528bf1={'count':0x0,'rows':[]};var _0x399efc=_[_0x5775('0x2c')](db[_0x5775('0x2d')][_0x5775('0x2e')],function(_0x133980){return{'name':_0x133980[_0x5775('0x2f')],'type':_0x133980[_0x5775('0x30')][_0x5775('0x31')]};});_0x377dbc[_0x5775('0x32')]=_['map'](_0x399efc,_0x5775('0x29'));_0x377dbc['query']=_[_0x5775('0x33')](_0x38a337['query']);_0x377dbc[_0x5775('0x34')]=_[_0x5775('0x35')](_0x377dbc[_0x5775('0x32')],_0x377dbc[_0x5775('0x36')]);_0x5f49a8[_0x5775('0x37')]=_[_0x5775('0x35')](_0x377dbc[_0x5775('0x32')],qs[_0x5775('0x38')](_0x38a337[_0x5775('0x36')][_0x5775('0x38')]));_0x5f49a8['attributes']=_0x5f49a8[_0x5775('0x37')][_0x5775('0x39')]?_0x5f49a8['attributes']:_0x377dbc[_0x5775('0x32')];if(!_0x38a337[_0x5775('0x36')]['hasOwnProperty'](_0x5775('0x3a'))){_0x5f49a8[_0x5775('0x1e')]=qs[_0x5775('0x1e')](_0x38a337[_0x5775('0x36')]['limit']);_0x5f49a8[_0x5775('0x1c')]=qs[_0x5775('0x1c')](_0x38a337[_0x5775('0x36')][_0x5775('0x1c')]);}_0x5f49a8['order']=qs[_0x5775('0x3b')](_0x38a337[_0x5775('0x36')]['sort']);_0x5f49a8[_0x5775('0x3c')]=qs[_0x5775('0x34')](_[_0x5775('0x3d')](_0x38a337[_0x5775('0x36')],_0x377dbc[_0x5775('0x34')]),_0x399efc);if(_0x38a337['query'][_0x5775('0x3e')]){_0x5f49a8['where']=_[_0x5775('0x3f')](_0x5f49a8[_0x5775('0x3c')],{'$or':_[_0x5775('0x2c')](_0x399efc,function(_0x57933c){if(_0x57933c[_0x5775('0x30')]!==_0x5775('0x40')){var _0x33cf8c={};_0x33cf8c[_0x57933c[_0x5775('0x29')]]={'$like':'%'+_0x38a337[_0x5775('0x36')][_0x5775('0x3e')]+'%'};return _0x33cf8c;}})});}_0x5f49a8=_[_0x5775('0x3f')]({},_0x5f49a8,_0x38a337['options']);var _0x5871e2={'where':_0x5f49a8['where']};return db[_0x5775('0x2d')][_0x5775('0x1f')](_0x5871e2)[_0x5775('0x41')](function(_0x46f367){_0x528bf1[_0x5775('0x1f')]=_0x46f367;if(_0x38a337[_0x5775('0x36')][_0x5775('0x42')]){_0x5f49a8[_0x5775('0x43')]=[{'all':!![]}];}return db[_0x5775('0x2d')][_0x5775('0x44')](_0x5f49a8);})[_0x5775('0x41')](function(_0x4652d3){_0x528bf1[_0x5775('0x45')]=_0x4652d3;return _0x528bf1;})[_0x5775('0x41')](respondWithFilteredResult(_0x1ceb40,_0x5f49a8))[_0x5775('0x46')](handleError(_0x1ceb40,null));};exports['show']=function(_0x17f6f0,_0x4770d9){var _0x4880ad={'raw':!![],'where':{'id':_0x17f6f0[_0x5775('0x47')]['id']}},_0x229cd5={};_0x229cd5[_0x5775('0x32')]=_['keys'](db[_0x5775('0x2d')][_0x5775('0x2e')]);_0x229cd5['query']=_[_0x5775('0x33')](_0x17f6f0[_0x5775('0x36')]);_0x229cd5[_0x5775('0x34')]=_['intersection'](_0x229cd5['model'],_0x229cd5['query']);_0x4880ad[_0x5775('0x37')]=_[_0x5775('0x35')](_0x229cd5['model'],qs[_0x5775('0x38')](_0x17f6f0[_0x5775('0x36')][_0x5775('0x38')]));_0x4880ad[_0x5775('0x37')]=_0x4880ad[_0x5775('0x37')][_0x5775('0x39')]?_0x4880ad[_0x5775('0x37')]:_0x229cd5[_0x5775('0x32')];if(_0x17f6f0[_0x5775('0x36')]['includeAll']){_0x4880ad[_0x5775('0x43')]=[{'all':!![]}];}_0x4880ad=_[_0x5775('0x3f')]({},_0x4880ad,_0x17f6f0[_0x5775('0x48')]);return db[_0x5775('0x2d')]['find'](_0x4880ad)[_0x5775('0x41')](handleEntityNotFound(_0x4770d9,null))[_0x5775('0x41')](respondWithResult(_0x4770d9,null))[_0x5775('0x46')](handleError(_0x4770d9,null));};exports[_0x5775('0x49')]=function(_0x2c9ff4,_0x3aaf21){return db['SquareRecording'][_0x5775('0x49')](_0x2c9ff4[_0x5775('0x4a')],{})['then'](respondWithResult(_0x3aaf21,0xc9))[_0x5775('0x46')](handleError(_0x3aaf21,null));};exports[_0x5775('0x25')]=function(_0x1e8d6d,_0x161fa9){if(_0x1e8d6d[_0x5775('0x4a')]['id']){delete _0x1e8d6d[_0x5775('0x4a')]['id'];}return db['SquareRecording'][_0x5775('0x4b')]({'where':{'id':_0x1e8d6d[_0x5775('0x47')]['id']}})['then'](handleEntityNotFound(_0x161fa9,null))['then'](saveUpdates(_0x1e8d6d[_0x5775('0x4a')],null))['then'](respondWithResult(_0x161fa9,null))[_0x5775('0x46')](handleError(_0x161fa9,null));};exports['download']=function(_0x44240f,_0x5ee59b,_0x475f88){var _0x381cd6=require(_0x5775('0x4c'));var _0x3d8c6f=![];var _0x3acb89={};if(_0x44240f[_0x5775('0x36')][_0x5775('0x30')]&&_0x44240f['query'][_0x5775('0x30')]===_0x5775('0x4d')){_0x3acb89[_0x5775('0x4d')]=_0x44240f[_0x5775('0x47')]['id'];}else{_0x3acb89['id']=_0x44240f[_0x5775('0x47')]['id'];}return db['SquareRecording']['find']({'where':_0x3acb89,'attributes':['id','savePath',_0x5775('0x4e')],'raw':!![]})[_0x5775('0x41')](handleEntityNotFound(_0x5ee59b,null))[_0x5775('0x41')](function(_0x4965b2){if(_0x4965b2){var _0x12ae0f=_0x4965b2[_0x5775('0x4f')];var _0x552132=util[_0x5775('0x50')](_0x5775('0x51'),_0x12ae0f);if(fs[_0x5775('0x52')](_0x552132)){_0x3d8c6f=!![];return _0x381cd6[_0x5775('0x53')](_0x552132,_0x12ae0f,config[_0x5775('0x54')][_0x5775('0x55')])['then'](function(){return _0x4965b2;});}return _0x4965b2;}})[_0x5775('0x41')](function(_0x598bbd){if(_0x598bbd){var _0x5690ab=_0x598bbd[_0x5775('0x4f')];if(!fs['existsSync'](_0x5690ab)){throw new db['Sequelize'][(_0x5775('0x56'))](_0x5775('0x57'));}if(_0x598bbd[_0x5775('0x4e')]){return _0x5ee59b[_0x5775('0x58')](_0x5690ab,_0x598bbd[_0x5775('0x4e')]+path['extname'](_0x5690ab),function(){if(_0x3d8c6f){fs['unlink'](_0x5690ab);}});}else{return _0x5ee59b[_0x5775('0x58')](_0x5690ab,function(_0x4ba7c1){if(_0x3d8c6f){fs[_0x5775('0x59')](_0x5690ab);}});}}})[_0x5775('0x46')](function(_0x37f19c){if(_0x37f19c[_0x5775('0x5a')]===_0x5775('0x57')){_0x5ee59b['status'](0x194)[_0x5775('0x2a')](_0x5775('0x5b'));}else{return handleError(_0x5ee59b,null);}});};exports[_0x5775('0x26')]=function(_0x48f812,_0x4dc7af){return db['SquareRecording']['find']({'where':{'id':_0x48f812[_0x5775('0x47')]['id']}})[_0x5775('0x41')](function(_0x348b6d){if(_[_0x5775('0x5c')](_0x348b6d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x348b6d;})[_0x5775('0x41')](function(_0x3febd5){var _0x345959=_0x3febd5[_0x5775('0x4f')];logger[_0x5775('0x5d')]('cancellazione\x20fisica\x20documento\x20%s',_0x345959);if(!_[_0x5775('0x5c')](_0x3febd5['savePath'])&&fs[_0x5775('0x52')](_0x345959)){logger[_0x5775('0x5d')](_0x5775('0x5e')+_0x345959+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5775('0x5f')](_0x345959);}_0x345959=_0x345959+_0x5775('0x60');if(!_[_0x5775('0x5c')](_0x3febd5[_0x5775('0x4f')])&&fs[_0x5775('0x52')](_0x345959)){logger[_0x5775('0x5d')](_0x5775('0x5e')+_0x345959+_0x5775('0x61'));fs[_0x5775('0x5f')](_0x345959);}return _0x3febd5;})['then'](function(_0x2381b0){if(!_0x2381b0)throw new InternalError();return _0x2381b0[_0x5775('0x26')]();})[_0x5775('0x41')](function(){_0x4dc7af[_0x5775('0x1a')](0xcc)['end']();})[_0x5775('0x46')](handleError(_0x4dc7af,null));}; \ No newline at end of file +var _0x10a5=['save','update','then','destroy','sendStatus','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','reject'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x10a5,0x154));var _0x510a=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x10a5[_0x35c5a8];return _0x34782c;};'use strict';var emlformat=require(_0x510a('0x0'));var rimraf=require(_0x510a('0x1'));var zipdir=require(_0x510a('0x2'));var jsonpatch=require(_0x510a('0x3'));var rp=require('request-promise');var moment=require(_0x510a('0x4'));var BPromise=require(_0x510a('0x5'));var Mustache=require('mustache');var util=require(_0x510a('0x6'));var path=require(_0x510a('0x7'));var sox=require(_0x510a('0x8'));var csv=require(_0x510a('0x9'));var ejs=require(_0x510a('0xa'));var fs=require('fs');var fs_extra=require(_0x510a('0xb'));var _=require('lodash');var squel=require(_0x510a('0xc'));var crypto=require(_0x510a('0xd'));var jsforce=require(_0x510a('0xe'));var deskjs=require(_0x510a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x510a('0x10'));var Papa=require(_0x510a('0x11'));var Redis=require('ioredis');var authService=require(_0x510a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x510a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x510a('0x14'));var utils=require(_0x510a('0x15'));var config=require(_0x510a('0x16'));var licenseUtil=require(_0x510a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d6c8b,_0x53daee){_0x53daee=_0x53daee||0xcc;return function(_0x5c2e7a){if(_0x5c2e7a){return _0x1d6c8b['sendStatus'](_0x53daee);}return _0x1d6c8b[_0x510a('0x18')](_0x53daee)[_0x510a('0x19')]();};}function respondWithResult(_0x300817,_0x46e19a){_0x46e19a=_0x46e19a||0xc8;return function(_0xa424cd){if(_0xa424cd){return _0x300817[_0x510a('0x18')](_0x46e19a)[_0x510a('0x1a')](_0xa424cd);}};}function respondWithFilteredResult(_0x47a8a2,_0x305040){return function(_0x4a55f5){if(_0x4a55f5){var _0x3916b7=typeof _0x305040[_0x510a('0x1b')]===_0x510a('0x1c')&&typeof _0x305040[_0x510a('0x1d')]===_0x510a('0x1c');var _0x31f05c=_0x4a55f5[_0x510a('0x1e')];var _0x1f2ce5=_0x3916b7?0x0:_0x305040['offset'];var _0x100c6b=_0x3916b7?_0x4a55f5[_0x510a('0x1e')]:_0x305040[_0x510a('0x1b')]+_0x305040[_0x510a('0x1d')];var _0x511478;if(_0x100c6b>=_0x31f05c){_0x100c6b=_0x31f05c;_0x511478=0xc8;}else{_0x511478=0xce;}_0x47a8a2[_0x510a('0x18')](_0x511478);return _0x47a8a2['set']('Content-Range',_0x1f2ce5+'-'+_0x100c6b+'/'+_0x31f05c)[_0x510a('0x1a')](_0x4a55f5);}return null;};}function patchUpdates(_0x42e1bd){return function(_0x54e6c5){try{jsonpatch['apply'](_0x54e6c5,_0x42e1bd,!![]);}catch(_0x3258de){return BPromise[_0x510a('0x1f')](_0x3258de);}return _0x54e6c5[_0x510a('0x20')]();};}function saveUpdates(_0x170dae,_0x50f0c9){return function(_0x3a1dde){if(_0x3a1dde){return _0x3a1dde[_0x510a('0x21')](_0x170dae)[_0x510a('0x22')](function(_0x4e267c){return _0x4e267c;});}return null;};}function removeEntity(_0x43d77d,_0x2ae1be){return function(_0x431b0e){if(_0x431b0e){return _0x431b0e[_0x510a('0x23')]()[_0x510a('0x22')](function(){_0x43d77d[_0x510a('0x18')](0xcc)[_0x510a('0x19')]();});}};}function handleEntityNotFound(_0x4cbb20,_0x3e568f){return function(_0x2cda30){if(!_0x2cda30){_0x4cbb20[_0x510a('0x24')](0x194);}return _0x2cda30;};}function handleError(_0x973a94,_0x1eabbc){_0x1eabbc=_0x1eabbc||0x1f4;return function(_0xef1e5f){logger[_0x510a('0x25')](_0xef1e5f[_0x510a('0x26')]);if(_0xef1e5f[_0x510a('0x27')]){delete _0xef1e5f[_0x510a('0x27')];}_0x973a94[_0x510a('0x18')](_0x1eabbc)[_0x510a('0x28')](_0xef1e5f);};}exports['index']=function(_0x470e5b,_0xe42e9d){var _0x537138={},_0x535db3={},_0x169436={'count':0x0,'rows':[]};var _0xd39d0e=_[_0x510a('0x29')](db[_0x510a('0x2a')][_0x510a('0x2b')],function(_0x19471c){return{'name':_0x19471c[_0x510a('0x2c')],'type':_0x19471c[_0x510a('0x2d')][_0x510a('0x2e')]};});_0x535db3[_0x510a('0x2f')]=_[_0x510a('0x29')](_0xd39d0e,_0x510a('0x27'));_0x535db3['query']=_[_0x510a('0x30')](_0x470e5b[_0x510a('0x31')]);_0x535db3[_0x510a('0x32')]=_[_0x510a('0x33')](_0x535db3['model'],_0x535db3[_0x510a('0x31')]);_0x537138['attributes']=_[_0x510a('0x33')](_0x535db3[_0x510a('0x2f')],qs[_0x510a('0x34')](_0x470e5b[_0x510a('0x31')][_0x510a('0x34')]));_0x537138[_0x510a('0x35')]=_0x537138[_0x510a('0x35')][_0x510a('0x36')]?_0x537138[_0x510a('0x35')]:_0x535db3[_0x510a('0x2f')];if(!_0x470e5b[_0x510a('0x31')]['hasOwnProperty']('nolimit')){_0x537138['limit']=qs[_0x510a('0x1d')](_0x470e5b[_0x510a('0x31')]['limit']);_0x537138[_0x510a('0x1b')]=qs[_0x510a('0x1b')](_0x470e5b[_0x510a('0x31')][_0x510a('0x1b')]);}_0x537138[_0x510a('0x37')]=qs[_0x510a('0x38')](_0x470e5b[_0x510a('0x31')][_0x510a('0x38')]);_0x537138[_0x510a('0x39')]=qs['filters'](_['pick'](_0x470e5b[_0x510a('0x31')],_0x535db3['filters']),_0xd39d0e);if(_0x470e5b[_0x510a('0x31')]['filter']){_0x537138[_0x510a('0x39')]=_[_0x510a('0x3a')](_0x537138[_0x510a('0x39')],{'$or':_[_0x510a('0x29')](_0xd39d0e,function(_0x3041fc){if(_0x3041fc[_0x510a('0x2d')]!==_0x510a('0x3b')){var _0x724465={};_0x724465[_0x3041fc[_0x510a('0x27')]]={'$like':'%'+_0x470e5b[_0x510a('0x31')][_0x510a('0x3c')]+'%'};return _0x724465;}})});}_0x537138=_[_0x510a('0x3a')]({},_0x537138,_0x470e5b[_0x510a('0x3d')]);var _0x4088d0={'where':_0x537138[_0x510a('0x39')]};return db[_0x510a('0x2a')][_0x510a('0x1e')](_0x4088d0)[_0x510a('0x22')](function(_0x36714a){_0x169436[_0x510a('0x1e')]=_0x36714a;if(_0x470e5b[_0x510a('0x31')][_0x510a('0x3e')]){_0x537138[_0x510a('0x3f')]=[{'all':!![]}];}return db[_0x510a('0x2a')][_0x510a('0x40')](_0x537138);})[_0x510a('0x22')](function(_0x1a48d9){_0x169436[_0x510a('0x41')]=_0x1a48d9;return _0x169436;})['then'](respondWithFilteredResult(_0xe42e9d,_0x537138))[_0x510a('0x42')](handleError(_0xe42e9d,null));};exports[_0x510a('0x43')]=function(_0x7fa33a,_0x44f343){var _0x271cf3={'raw':!![],'where':{'id':_0x7fa33a[_0x510a('0x44')]['id']}},_0xd25252={};_0xd25252[_0x510a('0x2f')]=_[_0x510a('0x30')](db[_0x510a('0x2a')][_0x510a('0x2b')]);_0xd25252[_0x510a('0x31')]=_['keys'](_0x7fa33a['query']);_0xd25252['filters']=_[_0x510a('0x33')](_0xd25252[_0x510a('0x2f')],_0xd25252['query']);_0x271cf3['attributes']=_[_0x510a('0x33')](_0xd25252['model'],qs['fields'](_0x7fa33a[_0x510a('0x31')][_0x510a('0x34')]));_0x271cf3[_0x510a('0x35')]=_0x271cf3[_0x510a('0x35')][_0x510a('0x36')]?_0x271cf3[_0x510a('0x35')]:_0xd25252[_0x510a('0x2f')];if(_0x7fa33a[_0x510a('0x31')]['includeAll']){_0x271cf3['include']=[{'all':!![]}];}_0x271cf3=_[_0x510a('0x3a')]({},_0x271cf3,_0x7fa33a[_0x510a('0x3d')]);return db[_0x510a('0x2a')][_0x510a('0x45')](_0x271cf3)[_0x510a('0x22')](handleEntityNotFound(_0x44f343,null))[_0x510a('0x22')](respondWithResult(_0x44f343,null))[_0x510a('0x42')](handleError(_0x44f343,null));};exports['create']=function(_0x547803,_0x39fbf7){return db[_0x510a('0x2a')][_0x510a('0x46')](_0x547803[_0x510a('0x47')],{})[_0x510a('0x22')](respondWithResult(_0x39fbf7,0xc9))[_0x510a('0x42')](handleError(_0x39fbf7,null));};exports['update']=function(_0x27230e,_0x23e79e){if(_0x27230e[_0x510a('0x47')]['id']){delete _0x27230e[_0x510a('0x47')]['id'];}return db[_0x510a('0x2a')][_0x510a('0x45')]({'where':{'id':_0x27230e['params']['id']}})[_0x510a('0x22')](handleEntityNotFound(_0x23e79e,null))[_0x510a('0x22')](saveUpdates(_0x27230e[_0x510a('0x47')],null))[_0x510a('0x22')](respondWithResult(_0x23e79e,null))[_0x510a('0x42')](handleError(_0x23e79e,null));};exports[_0x510a('0x48')]=function(_0x3d9c58,_0x1dbe5e,_0x3e8844){var _0x16dbc8=require(_0x510a('0x49'));var _0x49008b=![];var _0x1f7aa0={};if(_0x3d9c58['query']['type']&&_0x3d9c58[_0x510a('0x31')][_0x510a('0x2d')]==='uniqueid'){_0x1f7aa0[_0x510a('0x4a')]=_0x3d9c58[_0x510a('0x44')]['id'];}else{_0x1f7aa0['id']=_0x3d9c58[_0x510a('0x44')]['id'];}return db['SquareRecording'][_0x510a('0x45')]({'where':_0x1f7aa0,'attributes':['id',_0x510a('0x4b'),_0x510a('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x1dbe5e,null))['then'](function(_0x589809){if(_0x589809){var _0x3570b3=_0x589809['savePath'];var _0x447ce3=util[_0x510a('0x4d')](_0x510a('0x4e'),_0x3570b3);if(fs[_0x510a('0x4f')](_0x447ce3)){_0x49008b=!![];return _0x16dbc8[_0x510a('0x50')](_0x447ce3,_0x3570b3,config[_0x510a('0x51')][_0x510a('0x52')])[_0x510a('0x22')](function(){return _0x589809;});}return _0x589809;}})[_0x510a('0x22')](function(_0x56bda5){if(_0x56bda5){var _0x3e7fb2=_0x56bda5[_0x510a('0x4b')];if(!fs['existsSync'](_0x3e7fb2)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x56bda5[_0x510a('0x4c')]){return _0x1dbe5e[_0x510a('0x48')](_0x3e7fb2,_0x56bda5[_0x510a('0x4c')]+path[_0x510a('0x53')](_0x3e7fb2),function(){if(_0x49008b){fs[_0x510a('0x54')](_0x3e7fb2);}});}else{return _0x1dbe5e[_0x510a('0x48')](_0x3e7fb2,function(_0x31d15e){if(_0x49008b){fs[_0x510a('0x54')](_0x3e7fb2);}});}}})[_0x510a('0x42')](function(_0x138bf1){if(_0x138bf1[_0x510a('0x55')]==='SquareRecording\x20not\x20found'){_0x1dbe5e['status'](0x194)[_0x510a('0x28')](_0x510a('0x56'));}else{return handleError(_0x1dbe5e,null);}});};exports[_0x510a('0x23')]=function(_0x2b763c,_0x33ca31){return db[_0x510a('0x2a')][_0x510a('0x45')]({'where':{'id':_0x2b763c[_0x510a('0x44')]['id']}})[_0x510a('0x22')](function(_0x4da850){if(_['isNil'](_0x4da850)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4da850;})['then'](function(_0x55685a){var _0x21b9c2=_0x55685a['savePath'];logger[_0x510a('0x57')](_0x510a('0x58'),_0x21b9c2);if(!_['isNil'](_0x55685a[_0x510a('0x4b')])&&fs[_0x510a('0x4f')](_0x21b9c2)){logger[_0x510a('0x57')](_0x510a('0x59')+_0x21b9c2+_0x510a('0x5a'));fs[_0x510a('0x5b')](_0x21b9c2);}_0x21b9c2=_0x21b9c2+_0x510a('0x5c');if(!_['isNil'](_0x55685a[_0x510a('0x4b')])&&fs[_0x510a('0x4f')](_0x21b9c2)){logger[_0x510a('0x57')](_0x510a('0x59')+_0x21b9c2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x21b9c2);}return _0x55685a;})[_0x510a('0x22')](function(_0x4323b4){if(!_0x4323b4)throw new InternalError();return _0x4323b4['destroy']();})[_0x510a('0x22')](function(){_0x33ca31[_0x510a('0x18')](0xcc)[_0x510a('0x19')]();})[_0x510a('0x42')](handleError(_0x33ca31,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e215ae0..4b534e3 100644 --- a/server/api/squareRecording/squareRecording.model.js +++ b/server/api/squareRecording/squareRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x160c=['SquareRecording','util','../../config/logger','api','path','../../config/environment','./squareRecording.attributes','exports'];(function(_0x46087e,_0x1bd842){var _0x22553b=function(_0x315422){while(--_0x315422){_0x46087e['push'](_0x46087e['shift']());}};_0x22553b(++_0x1bd842);}(_0x160c,0x181));var _0xc160=function(_0x18a9be,_0x2ad6b2){_0x18a9be=_0x18a9be-0x0;var _0x78a52f=_0x160c[_0x18a9be];return _0x78a52f;};'use strict';var _=require('lodash');var util=require(_0xc160('0x0'));var logger=require(_0xc160('0x1'))(_0xc160('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc160('0x3'));var rimraf=require('rimraf');var config=require(_0xc160('0x4'));var attributes=require(_0xc160('0x5'));module[_0xc160('0x6')]=function(_0x5e6340,_0x46df17){return _0x5e6340['define'](_0xc160('0x7'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f37=['lodash','util','api','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x3a60fb,_0x4003cd){var _0x37c1fb=function(_0x17fdf2){while(--_0x17fdf2){_0x3a60fb['push'](_0x3a60fb['shift']());}};_0x37c1fb(++_0x4003cd);}(_0x9f37,0xd1));var _0x79f3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9f37[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var logger=require('../../config/logger')(_0x79f3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79f3('0x3'));var fs=require('fs');var path=require(_0x79f3('0x4'));var rimraf=require(_0x79f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x79f3('0x6'));module[_0x79f3('0x7')]=function(_0x594d87,_0x5db84b){return _0x594d87[_0x79f3('0x8')](_0x79f3('0x9'),attributes,{'tableName':_0x79f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index ccd9134..ba82693 100644 --- a/server/api/squareRecording/squareRecording.rpc.js +++ b/server/api/squareRecording/squareRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb57=['debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareRecording','create','body','options','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xbb57,0x1cd));var _0x7bb5=function(_0x539a5c,_0x3fdc47){_0x539a5c=_0x539a5c-0x0;var _0x2bb284=_0xbb57[_0x539a5c];return _0x2bb284;};'use strict';var _=require(_0x7bb5('0x0'));var util=require(_0x7bb5('0x1'));var moment=require(_0x7bb5('0x2'));var BPromise=require(_0x7bb5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bb5('0x4'));var db=require(_0x7bb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7bb5('0x6'));var config=require(_0x7bb5('0x7'));var jayson=require(_0x7bb5('0x8'));var client=jayson[_0x7bb5('0x9')][_0x7bb5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf325ea,_0x7d25a7,_0xf251de){return new BPromise(function(_0x2c5b86,_0x552440){return client[_0x7bb5('0xb')](_0xf325ea,_0xf251de)[_0x7bb5('0xc')](function(_0x5388cc){logger['info'](_0x7bb5('0xd'),_0x7d25a7,_0x7bb5('0xe'));logger[_0x7bb5('0xf')](_0x7bb5('0x10'),_0x7d25a7,'request\x20sent',JSON[_0x7bb5('0x11')](_0x5388cc));if(_0x5388cc['error']){if(_0x5388cc[_0x7bb5('0x12')][_0x7bb5('0x13')]===0x1f4){logger['error'](_0x7bb5('0xd'),_0x7d25a7,_0x5388cc[_0x7bb5('0x12')][_0x7bb5('0x14')]);return _0x552440(_0x5388cc[_0x7bb5('0x12')][_0x7bb5('0x14')]);}logger[_0x7bb5('0x12')](_0x7bb5('0xd'),_0x7d25a7,_0x5388cc[_0x7bb5('0x12')][_0x7bb5('0x14')]);return _0x2c5b86(_0x5388cc['error'][_0x7bb5('0x14')]);}else{logger[_0x7bb5('0x15')]('SquareRecording,\x20%s,\x20%s',_0x7d25a7,_0x7bb5('0xe'));_0x2c5b86(_0x5388cc[_0x7bb5('0x16')][_0x7bb5('0x14')]);}})['catch'](function(_0x40b46f){logger[_0x7bb5('0x12')]('SquareRecording,\x20%s,\x20%s',_0x7d25a7,_0x40b46f);_0x552440(_0x40b46f);});});}exports[_0x7bb5('0x17')]=function(_0x2e34de){var _0x28d470=this;return new Promise(function(_0x7b9ab8,_0x35d300){return db['SquareRecording'][_0x7bb5('0x18')](_0x2e34de[_0x7bb5('0x19')],{'raw':_0x2e34de[_0x7bb5('0x1a')]?_0x2e34de['options']['raw']===undefined?!![]:![]:!![]})[_0x7bb5('0xc')](function(_0x3168d8){logger[_0x7bb5('0x15')](_0x7bb5('0x17'),_0x2e34de);logger[_0x7bb5('0xf')]('CreateSquareRecording',_0x2e34de,JSON[_0x7bb5('0x11')](_0x3168d8));_0x7b9ab8(_0x3168d8);})[_0x7bb5('0x1b')](function(_0x4e1b83){logger[_0x7bb5('0x12')](_0x7bb5('0x17'),_0x4e1b83[_0x7bb5('0x14')],_0x2e34de);_0x35d300(_0x28d470[_0x7bb5('0x12')](0x1f4,_0x4e1b83[_0x7bb5('0x14')]));});});}; \ No newline at end of file +var _0x991d=['create','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording'];(function(_0x4d92ea,_0x5bac95){var _0x579ef3=function(_0x18a343){while(--_0x18a343){_0x4d92ea['push'](_0x4d92ea['shift']());}};_0x579ef3(++_0x5bac95);}(_0x991d,0x1f3));var _0xd991=function(_0x4624db,_0x5373fd){_0x4624db=_0x4624db-0x0;var _0x4ee6fc=_0x991d[_0x4624db];return _0x4ee6fc;};'use strict';var _=require(_0xd991('0x0'));var util=require(_0xd991('0x1'));var moment=require('moment');var BPromise=require(_0xd991('0x2'));var rs=require(_0xd991('0x3'));var fs=require('fs');var Redis=require(_0xd991('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd991('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd991('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x442614,_0x545aeb,_0x56cdf5){return new BPromise(function(_0xa72e43,_0x34e609){return client[_0xd991('0x7')](_0x442614,_0x56cdf5)[_0xd991('0x8')](function(_0x445e83){logger[_0xd991('0x9')](_0xd991('0xa'),_0x545aeb,_0xd991('0xb'));logger['debug'](_0xd991('0xc'),_0x545aeb,_0xd991('0xb'),JSON[_0xd991('0xd')](_0x445e83));if(_0x445e83['error']){if(_0x445e83[_0xd991('0xe')][_0xd991('0xf')]===0x1f4){logger[_0xd991('0xe')](_0xd991('0xa'),_0x545aeb,_0x445e83['error'][_0xd991('0x10')]);return _0x34e609(_0x445e83[_0xd991('0xe')][_0xd991('0x10')]);}logger[_0xd991('0xe')](_0xd991('0xa'),_0x545aeb,_0x445e83[_0xd991('0xe')][_0xd991('0x10')]);return _0xa72e43(_0x445e83[_0xd991('0xe')]['message']);}else{logger[_0xd991('0x9')](_0xd991('0xa'),_0x545aeb,_0xd991('0xb'));_0xa72e43(_0x445e83[_0xd991('0x11')][_0xd991('0x10')]);}})[_0xd991('0x12')](function(_0x339cda){logger[_0xd991('0xe')]('SquareRecording,\x20%s,\x20%s',_0x545aeb,_0x339cda);_0x34e609(_0x339cda);});});}exports[_0xd991('0x13')]=function(_0x1a9ea5){var _0x4b59e8=this;return new Promise(function(_0x440fce,_0x4dedb5){return db[_0xd991('0x14')][_0xd991('0x15')](_0x1a9ea5[_0xd991('0x16')],{'raw':_0x1a9ea5[_0xd991('0x17')]?_0x1a9ea5[_0xd991('0x17')][_0xd991('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4d51aa){logger['info'](_0xd991('0x13'),_0x1a9ea5);logger[_0xd991('0x19')](_0xd991('0x13'),_0x1a9ea5,JSON[_0xd991('0xd')](_0x4d51aa));_0x440fce(_0x4d51aa);})[_0xd991('0x12')](function(_0x428d6d){logger['error'](_0xd991('0x13'),_0x428d6d[_0xd991('0x10')],_0x1a9ea5);_0x4dedb5(_0x4b59e8[_0xd991('0xe')](0x1f4,_0x428d6d[_0xd991('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 24a2a4f..04a7bbf 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x29c537,_0x2a4059){var _0xca2b5e=function(_0x12061a){while(--_0x12061a){_0x29c537['push'](_0x29c537['shift']());}};_0xca2b5e(++_0x2a4059);}(_0xe706,0xa3));var _0x6e70=function(_0x442214,_0x3a869f){_0x442214=_0x442214-0x0;var _0x2bddf9=_0xe706[_0x442214];return _0x2bddf9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x5cb8db,_0x436b89){var _0x15907e=function(_0x43cc09){while(--_0x43cc09){_0x5cb8db['push'](_0x5cb8db['shift']());}};_0x15907e(++_0x436b89);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 51dce01..d729c54 100644 --- a/server/api/squareReport/squareReport.attributes.js +++ b/server/api/squareReport/squareReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd23=['STRING','DATE','BOOLEAN','sequelize'];(function(_0xf3c64,_0x39569d){var _0xfdcc57=function(_0x58c246){while(--_0x58c246){_0xf3c64['push'](_0xf3c64['shift']());}};_0xfdcc57(++_0x39569d);}(_0xbd23,0x143));var _0x3bd2=function(_0x2da3ff,_0x534fd4){_0x2da3ff=_0x2da3ff-0x0;var _0x482ff2=_0xbd23[_0x2da3ff];return _0x482ff2;};'use strict';var Sequelize=require(_0x3bd2('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3bd2('0x1')]},'request':{'type':Sequelize[_0x3bd2('0x1')]},'channel':{'type':Sequelize[_0x3bd2('0x1')]},'language':{'type':Sequelize[_0x3bd2('0x1')]},'type':{'type':Sequelize[_0x3bd2('0x1')]},'uniqueid':{'type':Sequelize[_0x3bd2('0x1')]},'version':{'type':Sequelize[_0x3bd2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3bd2('0x1')]},'callingpres':{'type':Sequelize[_0x3bd2('0x1')]},'callingani2':{'type':Sequelize[_0x3bd2('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x3bd2('0x1')]},'rdnis':{'type':Sequelize[_0x3bd2('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3bd2('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x3bd2('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x3bd2('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3bd2('0x2')]},'leaveAt':{'type':Sequelize[_0x3bd2('0x2')]},'bot':{'type':Sequelize[_0x3bd2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x90fa=['sequelize','exports','STRING','DATE'];(function(_0x4f9c2b,_0x2f362c){var _0x10c3bc=function(_0x55a576){while(--_0x55a576){_0x4f9c2b['push'](_0x4f9c2b['shift']());}};_0x10c3bc(++_0x2f362c);}(_0x90fa,0x1a8));var _0xa90f=function(_0x4bbe9d,_0x5b906a){_0x4bbe9d=_0x4bbe9d-0x0;var _0x3b2ea6=_0x90fa[_0x4bbe9d];return _0x3b2ea6;};'use strict';var Sequelize=require(_0xa90f('0x0'));module[_0xa90f('0x1')]={'network':{'type':Sequelize[_0xa90f('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa90f('0x2')]},'channel':{'type':Sequelize[_0xa90f('0x2')]},'language':{'type':Sequelize[_0xa90f('0x2')]},'type':{'type':Sequelize[_0xa90f('0x2')]},'uniqueid':{'type':Sequelize[_0xa90f('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa90f('0x2')]},'callingpres':{'type':Sequelize[_0xa90f('0x2')]},'callingani2':{'type':Sequelize[_0xa90f('0x2')]},'callington':{'type':Sequelize[_0xa90f('0x2')]},'callingtns':{'type':Sequelize[_0xa90f('0x2')]},'dnid':{'type':Sequelize[_0xa90f('0x2')]},'rdnis':{'type':Sequelize[_0xa90f('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa90f('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xa90f('0x2')]},'accountcode':{'type':Sequelize[_0xa90f('0x2')]},'threadid':{'type':Sequelize[_0xa90f('0x2')]},'project_name':{'type':Sequelize[_0xa90f('0x2')]},'joinAt':{'type':Sequelize[_0xa90f('0x3')]},'leaveAt':{'type':Sequelize[_0xa90f('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 9e5e999..3cfd8e0 100644 --- a/server/api/squareReport/squareReport.controller.js +++ b/server/api/squareReport/squareReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff61=['Content-Range','reject','save','update','then','destroy','error','stack','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','VIRTUAL','name','where','SquareReport','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set'];(function(_0x5a2bf6,_0x18c856){var _0x455989=function(_0x399fd9){while(--_0x399fd9){_0x5a2bf6['push'](_0x5a2bf6['shift']());}};_0x455989(++_0x18c856);}(_0xff61,0x1f1));var _0x1ff6=function(_0x22b62c,_0x519627){_0x22b62c=_0x22b62c-0x0;var _0xe5d80d=_0xff61[_0x22b62c];return _0xe5d80d;};'use strict';var emlformat=require(_0x1ff6('0x0'));var rimraf=require(_0x1ff6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ff6('0x2'));var rp=require(_0x1ff6('0x3'));var moment=require(_0x1ff6('0x4'));var BPromise=require(_0x1ff6('0x5'));var Mustache=require(_0x1ff6('0x6'));var util=require(_0x1ff6('0x7'));var path=require(_0x1ff6('0x8'));var sox=require(_0x1ff6('0x9'));var csv=require('to-csv');var ejs=require(_0x1ff6('0xa'));var fs=require('fs');var fs_extra=require(_0x1ff6('0xb'));var _=require(_0x1ff6('0xc'));var squel=require('squel');var crypto=require(_0x1ff6('0xd'));var jsforce=require(_0x1ff6('0xe'));var deskjs=require(_0x1ff6('0xf'));var toCsv=require(_0x1ff6('0x10'));var querystring=require(_0x1ff6('0x11'));var Papa=require(_0x1ff6('0x12'));var Redis=require(_0x1ff6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1ff6('0x14'));var as=require(_0x1ff6('0x15'));var hardwareService=require(_0x1ff6('0x16'));var logger=require(_0x1ff6('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1ff6('0x18'));var db=require(_0x1ff6('0x19'))['db'];function respondWithStatusCode(_0x84168f,_0x34c986){_0x34c986=_0x34c986||0xcc;return function(_0x14b5d0){if(_0x14b5d0){return _0x84168f[_0x1ff6('0x1a')](_0x34c986);}return _0x84168f['status'](_0x34c986)[_0x1ff6('0x1b')]();};}function respondWithResult(_0x1bd839,_0x3e5db1){_0x3e5db1=_0x3e5db1||0xc8;return function(_0x38c8b2){if(_0x38c8b2){return _0x1bd839[_0x1ff6('0x1c')](_0x3e5db1)[_0x1ff6('0x1d')](_0x38c8b2);}};}function respondWithFilteredResult(_0x564fae,_0x16eb2d){return function(_0x170fbf){if(_0x170fbf){var _0x4d88e3=typeof _0x16eb2d['offset']===_0x1ff6('0x1e')&&typeof _0x16eb2d['limit']===_0x1ff6('0x1e');var _0x3ea460=_0x170fbf[_0x1ff6('0x1f')];var _0x39f266=_0x4d88e3?0x0:_0x16eb2d[_0x1ff6('0x20')];var _0x14a0a7=_0x4d88e3?_0x170fbf['count']:_0x16eb2d['offset']+_0x16eb2d[_0x1ff6('0x21')];var _0x34a2b9;if(_0x14a0a7>=_0x3ea460){_0x14a0a7=_0x3ea460;_0x34a2b9=0xc8;}else{_0x34a2b9=0xce;}_0x564fae['status'](_0x34a2b9);return _0x564fae[_0x1ff6('0x22')](_0x1ff6('0x23'),_0x39f266+'-'+_0x14a0a7+'/'+_0x3ea460)[_0x1ff6('0x1d')](_0x170fbf);}return null;};}function patchUpdates(_0x4c5099){return function(_0x4490a0){try{jsonpatch['apply'](_0x4490a0,_0x4c5099,!![]);}catch(_0x453f98){return BPromise[_0x1ff6('0x24')](_0x453f98);}return _0x4490a0[_0x1ff6('0x25')]();};}function saveUpdates(_0x1e3471,_0x3de356){return function(_0xcccc4){if(_0xcccc4){return _0xcccc4[_0x1ff6('0x26')](_0x1e3471)[_0x1ff6('0x27')](function(_0x13d214){return _0x13d214;});}return null;};}function removeEntity(_0x503c8a,_0x52bc5e){return function(_0x10e1f0){if(_0x10e1f0){return _0x10e1f0[_0x1ff6('0x28')]()[_0x1ff6('0x27')](function(){_0x503c8a[_0x1ff6('0x1c')](0xcc)[_0x1ff6('0x1b')]();});}};}function handleEntityNotFound(_0x2aea6f,_0x17192f){return function(_0x4823ec){if(!_0x4823ec){_0x2aea6f[_0x1ff6('0x1a')](0x194);}return _0x4823ec;};}function handleError(_0xf445d0,_0x3a95a8){_0x3a95a8=_0x3a95a8||0x1f4;return function(_0x3f187c){logger[_0x1ff6('0x29')](_0x3f187c[_0x1ff6('0x2a')]);if(_0x3f187c['name']){delete _0x3f187c['name'];}_0xf445d0['status'](_0x3a95a8)['send'](_0x3f187c);};}exports[_0x1ff6('0x2b')]=function(_0x3efd28,_0x5443cf){var _0x479d63={},_0x433e85={},_0x4b346d={'count':0x0,'rows':[]};var _0x113ae6=_['map'](db['SquareReport'][_0x1ff6('0x2c')],function(_0x48d50c){return{'name':_0x48d50c['fieldName'],'type':_0x48d50c[_0x1ff6('0x2d')]['key']};});_0x433e85[_0x1ff6('0x2e')]=_[_0x1ff6('0x2f')](_0x113ae6,'name');_0x433e85[_0x1ff6('0x30')]=_[_0x1ff6('0x31')](_0x3efd28[_0x1ff6('0x30')]);_0x433e85[_0x1ff6('0x32')]=_[_0x1ff6('0x33')](_0x433e85['model'],_0x433e85['query']);_0x479d63[_0x1ff6('0x34')]=_[_0x1ff6('0x33')](_0x433e85[_0x1ff6('0x2e')],qs[_0x1ff6('0x35')](_0x3efd28['query']['fields']));_0x479d63[_0x1ff6('0x34')]=_0x479d63[_0x1ff6('0x34')][_0x1ff6('0x36')]?_0x479d63[_0x1ff6('0x34')]:_0x433e85[_0x1ff6('0x2e')];if(!_0x3efd28['query']['hasOwnProperty'](_0x1ff6('0x37'))){_0x479d63[_0x1ff6('0x21')]=qs['limit'](_0x3efd28['query'][_0x1ff6('0x21')]);_0x479d63[_0x1ff6('0x20')]=qs[_0x1ff6('0x20')](_0x3efd28[_0x1ff6('0x30')][_0x1ff6('0x20')]);}_0x479d63['order']=qs[_0x1ff6('0x38')](_0x3efd28[_0x1ff6('0x30')]['sort']);_0x479d63['where']=qs['filters'](_[_0x1ff6('0x39')](_0x3efd28[_0x1ff6('0x30')],_0x433e85[_0x1ff6('0x32')]),_0x113ae6);if(_0x3efd28[_0x1ff6('0x30')][_0x1ff6('0x3a')]){_0x479d63['where']=_[_0x1ff6('0x3b')](_0x479d63['where'],{'$or':_['map'](_0x113ae6,function(_0x188480){if(_0x188480[_0x1ff6('0x2d')]!==_0x1ff6('0x3c')){var _0x454cfc={};_0x454cfc[_0x188480[_0x1ff6('0x3d')]]={'$like':'%'+_0x3efd28['query'][_0x1ff6('0x3a')]+'%'};return _0x454cfc;}})});}_0x479d63=_['merge']({},_0x479d63,_0x3efd28['options']);var _0xd52b74={'where':_0x479d63[_0x1ff6('0x3e')]};return db[_0x1ff6('0x3f')]['count'](_0xd52b74)['then'](function(_0x3b0217){_0x4b346d[_0x1ff6('0x1f')]=_0x3b0217;if(_0x3efd28['query'][_0x1ff6('0x40')]){_0x479d63[_0x1ff6('0x41')]=[{'all':!![]}];}return db[_0x1ff6('0x3f')][_0x1ff6('0x42')](_0x479d63);})[_0x1ff6('0x27')](function(_0x594329){_0x4b346d[_0x1ff6('0x43')]=_0x594329;return _0x4b346d;})[_0x1ff6('0x27')](respondWithFilteredResult(_0x5443cf,_0x479d63))[_0x1ff6('0x44')](handleError(_0x5443cf,null));};exports[_0x1ff6('0x45')]=function(_0x47f2dd,_0x197aea){var _0x3f67b5={'raw':!![],'where':{'id':_0x47f2dd['params']['id']}},_0x559eca={};_0x559eca[_0x1ff6('0x2e')]=_[_0x1ff6('0x31')](db['SquareReport'][_0x1ff6('0x2c')]);_0x559eca[_0x1ff6('0x30')]=_[_0x1ff6('0x31')](_0x47f2dd['query']);_0x559eca[_0x1ff6('0x32')]=_[_0x1ff6('0x33')](_0x559eca[_0x1ff6('0x2e')],_0x559eca[_0x1ff6('0x30')]);_0x3f67b5[_0x1ff6('0x34')]=_[_0x1ff6('0x33')](_0x559eca['model'],qs[_0x1ff6('0x35')](_0x47f2dd[_0x1ff6('0x30')][_0x1ff6('0x35')]));_0x3f67b5[_0x1ff6('0x34')]=_0x3f67b5['attributes'][_0x1ff6('0x36')]?_0x3f67b5[_0x1ff6('0x34')]:_0x559eca['model'];if(_0x47f2dd[_0x1ff6('0x30')][_0x1ff6('0x40')]){_0x3f67b5[_0x1ff6('0x41')]=[{'all':!![]}];}_0x3f67b5=_[_0x1ff6('0x3b')]({},_0x3f67b5,_0x47f2dd[_0x1ff6('0x46')]);return db[_0x1ff6('0x3f')]['find'](_0x3f67b5)['then'](handleEntityNotFound(_0x197aea,null))[_0x1ff6('0x27')](respondWithResult(_0x197aea,null))['catch'](handleError(_0x197aea,null));};exports[_0x1ff6('0x47')]=function(_0x59e375,_0x1f81e2){return db['SquareReport'][_0x1ff6('0x47')](_0x59e375[_0x1ff6('0x48')],{})[_0x1ff6('0x27')](respondWithResult(_0x1f81e2,0xc9))[_0x1ff6('0x44')](handleError(_0x1f81e2,null));};exports[_0x1ff6('0x26')]=function(_0xfbecc9,_0x46de3a){if(_0xfbecc9['body']['id']){delete _0xfbecc9[_0x1ff6('0x48')]['id'];}return db[_0x1ff6('0x3f')][_0x1ff6('0x49')]({'where':{'id':_0xfbecc9[_0x1ff6('0x4a')]['id']}})[_0x1ff6('0x27')](handleEntityNotFound(_0x46de3a,null))[_0x1ff6('0x27')](saveUpdates(_0xfbecc9[_0x1ff6('0x48')],null))[_0x1ff6('0x27')](respondWithResult(_0x46de3a,null))[_0x1ff6('0x44')](handleError(_0x46de3a,null));};exports['destroy']=function(_0xa793f7,_0x2248f9){return db[_0x1ff6('0x3f')]['find']({'where':{'id':_0xa793f7['params']['id']}})['then'](handleEntityNotFound(_0x2248f9,null))[_0x1ff6('0x27')](removeEntity(_0x2248f9,null))[_0x1ff6('0x44')](handleError(_0x2248f9,null));};exports[_0x1ff6('0x4b')]=function(_0x2e5054,_0x370a4a){return db['SquareReport']['describe']()[_0x1ff6('0x27')](respondWithResult(_0x370a4a,null))[_0x1ff6('0x44')](handleError(_0x370a4a,null));}; \ No newline at end of file +var _0xca73=['stack','name','index','map','SquareReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','catch','params','keys','options','find','create','body','update','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','limit','undefined','count','offset','status','json','apply','save','then','error'];(function(_0x5c0ade,_0x1eaf8e){var _0x76633b=function(_0x9c7a70){while(--_0x9c7a70){_0x5c0ade['push'](_0x5c0ade['shift']());}};_0x76633b(++_0x1eaf8e);}(_0xca73,0xf9));var _0x3ca7=function(_0x2fd157,_0x2f5ea1){_0x2fd157=_0x2fd157-0x0;var _0x1377cb=_0xca73[_0x2fd157];return _0x1377cb;};'use strict';var emlformat=require(_0x3ca7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ca7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ca7('0x2'));var moment=require(_0x3ca7('0x3'));var BPromise=require(_0x3ca7('0x4'));var Mustache=require('mustache');var util=require(_0x3ca7('0x5'));var path=require(_0x3ca7('0x6'));var sox=require(_0x3ca7('0x7'));var csv=require(_0x3ca7('0x8'));var ejs=require(_0x3ca7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ca7('0xa'));var squel=require(_0x3ca7('0xb'));var crypto=require(_0x3ca7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3ca7('0xd'));var toCsv=require(_0x3ca7('0x8'));var querystring=require(_0x3ca7('0xe'));var Papa=require('papaparse');var Redis=require(_0x3ca7('0xf'));var authService=require(_0x3ca7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3ca7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ca7('0x12'))(_0x3ca7('0x13'));var utils=require(_0x3ca7('0x14'));var config=require(_0x3ca7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ca7('0x16'))['db'];function respondWithStatusCode(_0xf1d368,_0x5a0a08){_0x5a0a08=_0x5a0a08||0xcc;return function(_0x355756){if(_0x355756){return _0xf1d368[_0x3ca7('0x17')](_0x5a0a08);}return _0xf1d368['status'](_0x5a0a08)[_0x3ca7('0x18')]();};}function respondWithResult(_0x43a678,_0x421211){_0x421211=_0x421211||0xc8;return function(_0x425647){if(_0x425647){return _0x43a678['status'](_0x421211)['json'](_0x425647);}};}function respondWithFilteredResult(_0x224e29,_0x2baad3){return function(_0x16afa1){if(_0x16afa1){var _0x26e027=typeof _0x2baad3['offset']==='undefined'&&typeof _0x2baad3[_0x3ca7('0x19')]===_0x3ca7('0x1a');var _0x5af9a4=_0x16afa1[_0x3ca7('0x1b')];var _0x503e8d=_0x26e027?0x0:_0x2baad3[_0x3ca7('0x1c')];var _0x444433=_0x26e027?_0x16afa1['count']:_0x2baad3[_0x3ca7('0x1c')]+_0x2baad3[_0x3ca7('0x19')];var _0x20968c;if(_0x444433>=_0x5af9a4){_0x444433=_0x5af9a4;_0x20968c=0xc8;}else{_0x20968c=0xce;}_0x224e29[_0x3ca7('0x1d')](_0x20968c);return _0x224e29['set']('Content-Range',_0x503e8d+'-'+_0x444433+'/'+_0x5af9a4)[_0x3ca7('0x1e')](_0x16afa1);}return null;};}function patchUpdates(_0x55bdd3){return function(_0x24ff79){try{jsonpatch[_0x3ca7('0x1f')](_0x24ff79,_0x55bdd3,!![]);}catch(_0x3b2821){return BPromise['reject'](_0x3b2821);}return _0x24ff79[_0x3ca7('0x20')]();};}function saveUpdates(_0x47b275,_0x3f5313){return function(_0x43600f){if(_0x43600f){return _0x43600f['update'](_0x47b275)['then'](function(_0x5863fa){return _0x5863fa;});}return null;};}function removeEntity(_0x204114,_0x580fc6){return function(_0x404a50){if(_0x404a50){return _0x404a50['destroy']()[_0x3ca7('0x21')](function(){_0x204114[_0x3ca7('0x1d')](0xcc)[_0x3ca7('0x18')]();});}};}function handleEntityNotFound(_0x35b015,_0x32c3e9){return function(_0x1be1fc){if(!_0x1be1fc){_0x35b015[_0x3ca7('0x17')](0x194);}return _0x1be1fc;};}function handleError(_0x39054a,_0x583d70){_0x583d70=_0x583d70||0x1f4;return function(_0x264779){logger[_0x3ca7('0x22')](_0x264779[_0x3ca7('0x23')]);if(_0x264779[_0x3ca7('0x24')]){delete _0x264779[_0x3ca7('0x24')];}_0x39054a[_0x3ca7('0x1d')](_0x583d70)['send'](_0x264779);};}exports[_0x3ca7('0x25')]=function(_0x53e0df,_0x502394){var _0x1acb9d={},_0x5bf52d={},_0xb580={'count':0x0,'rows':[]};var _0x2b358c=_[_0x3ca7('0x26')](db[_0x3ca7('0x27')][_0x3ca7('0x28')],function(_0x2e94f8){return{'name':_0x2e94f8[_0x3ca7('0x29')],'type':_0x2e94f8[_0x3ca7('0x2a')]['key']};});_0x5bf52d[_0x3ca7('0x2b')]=_['map'](_0x2b358c,'name');_0x5bf52d[_0x3ca7('0x2c')]=_['keys'](_0x53e0df[_0x3ca7('0x2c')]);_0x5bf52d['filters']=_[_0x3ca7('0x2d')](_0x5bf52d[_0x3ca7('0x2b')],_0x5bf52d[_0x3ca7('0x2c')]);_0x1acb9d[_0x3ca7('0x2e')]=_[_0x3ca7('0x2d')](_0x5bf52d[_0x3ca7('0x2b')],qs['fields'](_0x53e0df[_0x3ca7('0x2c')][_0x3ca7('0x2f')]));_0x1acb9d[_0x3ca7('0x2e')]=_0x1acb9d[_0x3ca7('0x2e')][_0x3ca7('0x30')]?_0x1acb9d['attributes']:_0x5bf52d['model'];if(!_0x53e0df[_0x3ca7('0x2c')][_0x3ca7('0x31')](_0x3ca7('0x32'))){_0x1acb9d[_0x3ca7('0x19')]=qs[_0x3ca7('0x19')](_0x53e0df[_0x3ca7('0x2c')][_0x3ca7('0x19')]);_0x1acb9d['offset']=qs[_0x3ca7('0x1c')](_0x53e0df['query']['offset']);}_0x1acb9d[_0x3ca7('0x33')]=qs['sort'](_0x53e0df[_0x3ca7('0x2c')][_0x3ca7('0x34')]);_0x1acb9d[_0x3ca7('0x35')]=qs[_0x3ca7('0x36')](_[_0x3ca7('0x37')](_0x53e0df['query'],_0x5bf52d[_0x3ca7('0x36')]),_0x2b358c);if(_0x53e0df[_0x3ca7('0x2c')][_0x3ca7('0x38')]){_0x1acb9d[_0x3ca7('0x35')]=_['merge'](_0x1acb9d['where'],{'$or':_['map'](_0x2b358c,function(_0x41bba3){if(_0x41bba3[_0x3ca7('0x2a')]!==_0x3ca7('0x39')){var _0x4f37ad={};_0x4f37ad[_0x41bba3[_0x3ca7('0x24')]]={'$like':'%'+_0x53e0df[_0x3ca7('0x2c')][_0x3ca7('0x38')]+'%'};return _0x4f37ad;}})});}_0x1acb9d=_['merge']({},_0x1acb9d,_0x53e0df['options']);var _0x271d61={'where':_0x1acb9d['where']};return db['SquareReport']['count'](_0x271d61)[_0x3ca7('0x21')](function(_0x5de508){_0xb580[_0x3ca7('0x1b')]=_0x5de508;if(_0x53e0df[_0x3ca7('0x2c')][_0x3ca7('0x3a')]){_0x1acb9d[_0x3ca7('0x3b')]=[{'all':!![]}];}return db[_0x3ca7('0x27')][_0x3ca7('0x3c')](_0x1acb9d);})[_0x3ca7('0x21')](function(_0xb950fa){_0xb580['rows']=_0xb950fa;return _0xb580;})['then'](respondWithFilteredResult(_0x502394,_0x1acb9d))[_0x3ca7('0x3d')](handleError(_0x502394,null));};exports['show']=function(_0x25d77f,_0x348f94){var _0x45b8c3={'raw':!![],'where':{'id':_0x25d77f[_0x3ca7('0x3e')]['id']}},_0x58a115={};_0x58a115[_0x3ca7('0x2b')]=_[_0x3ca7('0x3f')](db[_0x3ca7('0x27')][_0x3ca7('0x28')]);_0x58a115[_0x3ca7('0x2c')]=_[_0x3ca7('0x3f')](_0x25d77f[_0x3ca7('0x2c')]);_0x58a115[_0x3ca7('0x36')]=_[_0x3ca7('0x2d')](_0x58a115[_0x3ca7('0x2b')],_0x58a115[_0x3ca7('0x2c')]);_0x45b8c3[_0x3ca7('0x2e')]=_[_0x3ca7('0x2d')](_0x58a115[_0x3ca7('0x2b')],qs[_0x3ca7('0x2f')](_0x25d77f[_0x3ca7('0x2c')][_0x3ca7('0x2f')]));_0x45b8c3[_0x3ca7('0x2e')]=_0x45b8c3[_0x3ca7('0x2e')][_0x3ca7('0x30')]?_0x45b8c3[_0x3ca7('0x2e')]:_0x58a115[_0x3ca7('0x2b')];if(_0x25d77f['query'][_0x3ca7('0x3a')]){_0x45b8c3['include']=[{'all':!![]}];}_0x45b8c3=_['merge']({},_0x45b8c3,_0x25d77f[_0x3ca7('0x40')]);return db['SquareReport'][_0x3ca7('0x41')](_0x45b8c3)[_0x3ca7('0x21')](handleEntityNotFound(_0x348f94,null))[_0x3ca7('0x21')](respondWithResult(_0x348f94,null))['catch'](handleError(_0x348f94,null));};exports[_0x3ca7('0x42')]=function(_0x187ccb,_0x21508d){return db[_0x3ca7('0x27')]['create'](_0x187ccb[_0x3ca7('0x43')],{})[_0x3ca7('0x21')](respondWithResult(_0x21508d,0xc9))['catch'](handleError(_0x21508d,null));};exports[_0x3ca7('0x44')]=function(_0x2aef05,_0x4d60f7){if(_0x2aef05[_0x3ca7('0x43')]['id']){delete _0x2aef05[_0x3ca7('0x43')]['id'];}return db[_0x3ca7('0x27')][_0x3ca7('0x41')]({'where':{'id':_0x2aef05[_0x3ca7('0x3e')]['id']}})[_0x3ca7('0x21')](handleEntityNotFound(_0x4d60f7,null))[_0x3ca7('0x21')](saveUpdates(_0x2aef05[_0x3ca7('0x43')],null))[_0x3ca7('0x21')](respondWithResult(_0x4d60f7,null))['catch'](handleError(_0x4d60f7,null));};exports[_0x3ca7('0x45')]=function(_0x5a5ac1,_0xba442b){return db[_0x3ca7('0x27')]['find']({'where':{'id':_0x5a5ac1[_0x3ca7('0x3e')]['id']}})[_0x3ca7('0x21')](handleEntityNotFound(_0xba442b,null))['then'](removeEntity(_0xba442b,null))[_0x3ca7('0x3d')](handleError(_0xba442b,null));};exports[_0x3ca7('0x46')]=function(_0x13e470,_0x427bf5){return db['SquareReport'][_0x3ca7('0x46')]()[_0x3ca7('0x21')](respondWithResult(_0x427bf5,null))[_0x3ca7('0x3d')](handleError(_0x427bf5,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0b3b492..1c06537 100644 --- a/server/api/squareReport/squareReport.model.js +++ b/server/api/squareReport/squareReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0b9=['../../config/environment','./squareReport.attributes','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xa0b9,0x178));var _0x9a0b=function(_0x3c5955,_0x48bbbc){_0x3c5955=_0x3c5955-0x0;var _0x1e902f=_0xa0b9[_0x3c5955];return _0x1e902f;};'use strict';var _=require(_0x9a0b('0x0'));var util=require(_0x9a0b('0x1'));var logger=require(_0x9a0b('0x2'))(_0x9a0b('0x3'));var moment=require(_0x9a0b('0x4'));var BPromise=require('bluebird');var rp=require(_0x9a0b('0x5'));var fs=require('fs');var path=require(_0x9a0b('0x6'));var rimraf=require(_0x9a0b('0x7'));var config=require(_0x9a0b('0x8'));var attributes=require(_0x9a0b('0x9'));module['exports']=function(_0x39670a,_0x51ed2b){return _0x39670a['define'](_0x9a0b('0xa'),attributes,{'tableName':_0x9a0b('0xb'),'paranoid':![],'indexes':[{'name':_0x9a0b('0xc'),'fields':[_0x9a0b('0xd'),_0x9a0b('0xe')]},{'name':_0x9a0b('0xf'),'fields':[_0x9a0b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bcb=['../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0x2bcb,0x1a8));var _0xb2bc=function(_0x4dd289,_0x267fa6){_0x4dd289=_0x4dd289-0x0;var _0x4ba13d=_0x2bcb[_0x4dd289];return _0x4ba13d;};'use strict';var _=require(_0xb2bc('0x0'));var util=require(_0xb2bc('0x1'));var logger=require(_0xb2bc('0x2'))(_0xb2bc('0x3'));var moment=require(_0xb2bc('0x4'));var BPromise=require(_0xb2bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2bc('0x6'));var rimraf=require(_0xb2bc('0x7'));var config=require(_0xb2bc('0x8'));var attributes=require(_0xb2bc('0x9'));module[_0xb2bc('0xa')]=function(_0x5e79e3,_0x5869da){return _0x5e79e3['define'](_0xb2bc('0xb'),attributes,{'tableName':_0xb2bc('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xb2bc('0xd'),_0xb2bc('0xe')]},{'name':'leaveAt','fields':[_0xb2bc('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index e609d18..3fe9233 100644 --- a/server/api/squareReport/squareReport.rpc.js +++ b/server/api/squareReport/squareReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x884a=['limit','debug','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','where','attributes'];(function(_0x579119,_0x1404b3){var _0x4d2c5f=function(_0xa41026){while(--_0xa41026){_0x579119['push'](_0x579119['shift']());}};_0x4d2c5f(++_0x1404b3);}(_0x884a,0x1f2));var _0xa884=function(_0x2d259d,_0x173c65){_0x2d259d=_0x2d259d-0x0;var _0x184539=_0x884a[_0x2d259d];return _0x184539;};'use strict';var _=require(_0xa884('0x0'));var util=require(_0xa884('0x1'));var moment=require('moment');var BPromise=require(_0xa884('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa884('0x3'));var db=require(_0xa884('0x4'))['db'];var utils=require(_0xa884('0x5'));var logger=require(_0xa884('0x6'))(_0xa884('0x7'));var config=require(_0xa884('0x8'));var jayson=require(_0xa884('0x9'));var client=jayson[_0xa884('0xa')][_0xa884('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x355994,_0x326893,_0x40ab9c){return new BPromise(function(_0x10742b,_0x5cf0b9){return client['request'](_0x355994,_0x40ab9c)[_0xa884('0xc')](function(_0x5032d8){logger[_0xa884('0xd')]('SquareReport,\x20%s,\x20%s',_0x326893,_0xa884('0xe'));logger['debug'](_0xa884('0xf'),_0x326893,_0xa884('0xe'),JSON['stringify'](_0x5032d8));if(_0x5032d8[_0xa884('0x10')]){if(_0x5032d8[_0xa884('0x10')]['code']===0x1f4){logger[_0xa884('0x10')](_0xa884('0x11'),_0x326893,_0x5032d8['error'][_0xa884('0x12')]);return _0x5cf0b9(_0x5032d8[_0xa884('0x10')]['message']);}logger[_0xa884('0x10')](_0xa884('0x11'),_0x326893,_0x5032d8[_0xa884('0x10')][_0xa884('0x12')]);return _0x10742b(_0x5032d8[_0xa884('0x10')]['message']);}else{logger['info'](_0xa884('0x11'),_0x326893,_0xa884('0xe'));_0x10742b(_0x5032d8[_0xa884('0x13')][_0xa884('0x12')]);}})[_0xa884('0x14')](function(_0xb678fe){logger[_0xa884('0x10')]('SquareReport,\x20%s,\x20%s',_0x326893,_0xb678fe);_0x5cf0b9(_0xb678fe);});});}exports[_0xa884('0x15')]=function(_0x1cc6dc){var _0x3fc33d=this;return new Promise(function(_0x419477,_0x11695b){return db[_0xa884('0x16')][_0xa884('0x17')](_0x1cc6dc[_0xa884('0x18')],{'raw':_0x1cc6dc['options']?_0x1cc6dc[_0xa884('0x19')][_0xa884('0x1a')]===undefined?!![]:![]:!![]})[_0xa884('0xc')](function(_0x263916){logger['info']('CreateSquareReport',_0x1cc6dc);logger['debug'](_0xa884('0x15'),_0x1cc6dc,JSON['stringify'](_0x263916));_0x419477(_0x263916);})[_0xa884('0x14')](function(_0x1d76d2){logger[_0xa884('0x10')](_0xa884('0x15'),_0x1d76d2['message'],_0x1cc6dc);_0x11695b(_0x3fc33d[_0xa884('0x10')](0x1f4,_0x1d76d2['message']));});});};exports[_0xa884('0x1b')]=function(_0xf81a0f){var _0x3bd04c=this;return new Promise(function(_0x3beb91,_0x32b792){return db['SquareReport']['update'](_0xf81a0f[_0xa884('0x18')],{'raw':_0xf81a0f[_0xa884('0x19')]?_0xf81a0f[_0xa884('0x19')][_0xa884('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf81a0f[_0xa884('0x19')]?_0xf81a0f[_0xa884('0x19')][_0xa884('0x1c')]||null:null,'attributes':_0xf81a0f[_0xa884('0x19')]?_0xf81a0f[_0xa884('0x19')][_0xa884('0x1d')]||null:null,'limit':_0xf81a0f[_0xa884('0x19')]?_0xf81a0f[_0xa884('0x19')][_0xa884('0x1e')]||null:null})[_0xa884('0xc')](function(_0x232b0f){logger['info']('UpdateSquareReport',_0xf81a0f);logger[_0xa884('0x1f')](_0xa884('0x1b'),_0xf81a0f,JSON[_0xa884('0x20')](_0x232b0f));_0x3beb91(_0x232b0f);})['catch'](function(_0x63750b){logger['error']('UpdateSquareReport',_0x63750b['message'],_0xf81a0f);_0x32b792(_0x3bd04c['error'](0x1f4,_0x63750b[_0xa884('0x12')]));});});}; \ No newline at end of file +var _0xee96=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SquareReport','create','options','then','CreateSquareReport','UpdateSquareReport','update','body','raw','where','attributes','limit','util'];(function(_0x1e028c,_0x2bd5b0){var _0x336831=function(_0x506de1){while(--_0x506de1){_0x1e028c['push'](_0x1e028c['shift']());}};_0x336831(++_0x2bd5b0);}(_0xee96,0x1cd));var _0x6ee9=function(_0x11adea,_0x4f20c7){_0x11adea=_0x11adea-0x0;var _0x4395f7=_0xee96[_0x11adea];return _0x4395f7;};'use strict';var _=require('lodash');var util=require(_0x6ee9('0x0'));var moment=require('moment');var BPromise=require(_0x6ee9('0x1'));var rs=require(_0x6ee9('0x2'));var fs=require('fs');var Redis=require(_0x6ee9('0x3'));var db=require(_0x6ee9('0x4'))['db'];var utils=require(_0x6ee9('0x5'));var logger=require(_0x6ee9('0x6'))(_0x6ee9('0x7'));var config=require(_0x6ee9('0x8'));var jayson=require(_0x6ee9('0x9'));var client=jayson[_0x6ee9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50db47,_0x10a216,_0x141228){return new BPromise(function(_0x195e37,_0x516b62){return client[_0x6ee9('0xb')](_0x50db47,_0x141228)['then'](function(_0x1311d2){logger[_0x6ee9('0xc')](_0x6ee9('0xd'),_0x10a216,_0x6ee9('0xe'));logger[_0x6ee9('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x10a216,_0x6ee9('0xe'),JSON[_0x6ee9('0x10')](_0x1311d2));if(_0x1311d2[_0x6ee9('0x11')]){if(_0x1311d2[_0x6ee9('0x11')]['code']===0x1f4){logger[_0x6ee9('0x11')](_0x6ee9('0xd'),_0x10a216,_0x1311d2['error'][_0x6ee9('0x12')]);return _0x516b62(_0x1311d2[_0x6ee9('0x11')][_0x6ee9('0x12')]);}logger[_0x6ee9('0x11')](_0x6ee9('0xd'),_0x10a216,_0x1311d2[_0x6ee9('0x11')][_0x6ee9('0x12')]);return _0x195e37(_0x1311d2[_0x6ee9('0x11')][_0x6ee9('0x12')]);}else{logger['info'](_0x6ee9('0xd'),_0x10a216,_0x6ee9('0xe'));_0x195e37(_0x1311d2[_0x6ee9('0x13')][_0x6ee9('0x12')]);}})[_0x6ee9('0x14')](function(_0x24695c){logger[_0x6ee9('0x11')](_0x6ee9('0xd'),_0x10a216,_0x24695c);_0x516b62(_0x24695c);});});}exports['CreateSquareReport']=function(_0x3bb52d){var _0x220fcc=this;return new Promise(function(_0x417097,_0x58332d){return db[_0x6ee9('0x15')][_0x6ee9('0x16')](_0x3bb52d['body'],{'raw':_0x3bb52d[_0x6ee9('0x17')]?_0x3bb52d[_0x6ee9('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x6ee9('0x18')](function(_0x4056b9){logger[_0x6ee9('0xc')](_0x6ee9('0x19'),_0x3bb52d);logger[_0x6ee9('0xf')](_0x6ee9('0x19'),_0x3bb52d,JSON['stringify'](_0x4056b9));_0x417097(_0x4056b9);})[_0x6ee9('0x14')](function(_0x345372){logger['error'](_0x6ee9('0x19'),_0x345372[_0x6ee9('0x12')],_0x3bb52d);_0x58332d(_0x220fcc[_0x6ee9('0x11')](0x1f4,_0x345372['message']));});});};exports[_0x6ee9('0x1a')]=function(_0x58fed9){var _0x157180=this;return new Promise(function(_0x295211,_0x5f1b1b){return db[_0x6ee9('0x15')][_0x6ee9('0x1b')](_0x58fed9[_0x6ee9('0x1c')],{'raw':_0x58fed9[_0x6ee9('0x17')]?_0x58fed9[_0x6ee9('0x17')][_0x6ee9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58fed9[_0x6ee9('0x17')]?_0x58fed9['options'][_0x6ee9('0x1e')]||null:null,'attributes':_0x58fed9[_0x6ee9('0x17')]?_0x58fed9[_0x6ee9('0x17')][_0x6ee9('0x1f')]||null:null,'limit':_0x58fed9[_0x6ee9('0x17')]?_0x58fed9['options'][_0x6ee9('0x20')]||null:null})['then'](function(_0xdbee80){logger[_0x6ee9('0xc')](_0x6ee9('0x1a'),_0x58fed9);logger[_0x6ee9('0xf')](_0x6ee9('0x1a'),_0x58fed9,JSON[_0x6ee9('0x10')](_0xdbee80));_0x295211(_0xdbee80);})[_0x6ee9('0x14')](function(_0x4f5587){logger[_0x6ee9('0x11')](_0x6ee9('0x1a'),_0x4f5587['message'],_0x58fed9);_0x5f1b1b(_0x157180[_0x6ee9('0x11')](0x1f4,_0x4f5587[_0x6ee9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a38bbaf..d1aebd7 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a9a=['./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x170fb0,_0x1e3166){var _0x5f23c2=function(_0x4c8a2f){while(--_0x4c8a2f){_0x170fb0['push'](_0x170fb0['shift']());}};_0x5f23c2(++_0x1e3166);}(_0x9a9a,0xe9));var _0xa9a9=function(_0x12f9f7,_0x17aac7){_0x12f9f7=_0x12f9f7-0x0;var _0x22f3bd=_0x9a9a[_0x12f9f7];return _0x22f3bd;};'use strict';var multer=require(_0xa9a9('0x0'));var util=require('util');var path=require(_0xa9a9('0x1'));var timeout=require(_0xa9a9('0x2'));var express=require(_0xa9a9('0x3'));var router=express['Router']();var fs_extra=require(_0xa9a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa9a9('0x5'));var config=require(_0xa9a9('0x6'));var controller=require(_0xa9a9('0x7'));router[_0xa9a9('0x8')]('/',auth[_0xa9a9('0x9')](),controller[_0xa9a9('0xa')]);router[_0xa9a9('0x8')](_0xa9a9('0xb'),auth[_0xa9a9('0x9')](),controller[_0xa9a9('0xc')]);router[_0xa9a9('0x8')]('/:id',auth[_0xa9a9('0x9')](),controller[_0xa9a9('0xd')]);router['post']('/',auth[_0xa9a9('0x9')](),controller[_0xa9a9('0xe')]);router[_0xa9a9('0xf')](_0xa9a9('0x10'),auth[_0xa9a9('0x9')](),controller['update']);router[_0xa9a9('0x11')](_0xa9a9('0x10'),auth[_0xa9a9('0x9')](),controller[_0xa9a9('0x12')]);module[_0xa9a9('0x13')]=router; \ No newline at end of file +var _0x009d=['delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x2bfbf8,_0xf5adf7){var _0x3ec22e=function(_0xbb194d){while(--_0xbb194d){_0x2bfbf8['push'](_0x2bfbf8['shift']());}};_0x3ec22e(++_0xf5adf7);}(_0x009d,0x143));var _0xd009=function(_0x30b601,_0x9c2f1a){_0x30b601=_0x30b601-0x0;var _0x1186ee=_0x009d[_0x30b601];return _0x1186ee;};'use strict';var multer=require('multer');var util=require(_0xd009('0x0'));var path=require(_0xd009('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd009('0x2')]();var fs_extra=require(_0xd009('0x3'));var auth=require(_0xd009('0x4'));var interaction=require(_0xd009('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xd009('0x6')]('/',auth['isAuthenticated'](),controller[_0xd009('0x7')]);router['get'](_0xd009('0x8'),auth[_0xd009('0x9')](),controller[_0xd009('0xa')]);router['get'](_0xd009('0xb'),auth[_0xd009('0x9')](),controller[_0xd009('0xc')]);router[_0xd009('0xd')]('/',auth[_0xd009('0x9')](),controller[_0xd009('0xe')]);router[_0xd009('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd009('0x10')]);router[_0xd009('0x11')](_0xd009('0xb'),auth['isAuthenticated'](),controller[_0xd009('0x12')]);module[_0xd009('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f68af83..807913f 100644 --- a/server/api/squareReportDetail/squareReportDetail.attributes.js +++ b/server/api/squareReportDetail/squareReportDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb42c=['exports','STRING','TEXT','sequelize'];(function(_0x2d77c2,_0x40808e){var _0x85c573=function(_0x30d999){while(--_0x30d999){_0x2d77c2['push'](_0x2d77c2['shift']());}};_0x85c573(++_0x40808e);}(_0xb42c,0xf3));var _0xcb42=function(_0x4770aa,_0x587d4a){_0x4770aa=_0x4770aa-0x0;var _0x4d5727=_0xb42c[_0x4770aa];return _0x4d5727;};'use strict';var Sequelize=require(_0xcb42('0x0'));module[_0xcb42('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xcb42('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xcb42('0x3')]},'project_name':{'type':Sequelize[_0xcb42('0x2')]},'callerid':{'type':Sequelize[_0xcb42('0x2')]}}; \ No newline at end of file +var _0x51a1=['exports','STRING','sequelize'];(function(_0x2b2132,_0xe12f63){var _0x5d00c7=function(_0x35cd48){while(--_0x35cd48){_0x2b2132['push'](_0x2b2132['shift']());}};_0x5d00c7(++_0xe12f63);}(_0x51a1,0x1d6));var _0x151a=function(_0x59535b,_0x4490b0){_0x59535b=_0x59535b-0x0;var _0x53108a=_0x51a1[_0x59535b];return _0x53108a;};'use strict';var Sequelize=require(_0x151a('0x0'));module[_0x151a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x151a('0x2')]},'application':{'type':Sequelize[_0x151a('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x151a('0x2')]},'callerid':{'type':Sequelize[_0x151a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 01f87bc..18e70e3 100644 --- a/server/api/squareReportDetail/squareReportDetail.controller.js +++ b/server/api/squareReportDetail/squareReportDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53a4=['ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x53a4,0x173));var _0x453a=function(_0x2f82b3,_0x5a2d05){_0x2f82b3=_0x2f82b3-0x0;var _0x3a98d9=_0x53a4[_0x2f82b3];return _0x3a98d9;};'use strict';var emlformat=require(_0x453a('0x0'));var rimraf=require(_0x453a('0x1'));var zipdir=require(_0x453a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x453a('0x3'));var moment=require('moment');var BPromise=require(_0x453a('0x4'));var Mustache=require(_0x453a('0x5'));var util=require(_0x453a('0x6'));var path=require(_0x453a('0x7'));var sox=require('sox');var csv=require(_0x453a('0x8'));var ejs=require(_0x453a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x453a('0xa'));var squel=require(_0x453a('0xb'));var crypto=require('crypto');var jsforce=require(_0x453a('0xc'));var deskjs=require(_0x453a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x453a('0xe'));var Papa=require(_0x453a('0xf'));var Redis=require(_0x453a('0x10'));var authService=require(_0x453a('0x11'));var qs=require(_0x453a('0x12'));var as=require(_0x453a('0x13'));var hardwareService=require(_0x453a('0x14'));var logger=require(_0x453a('0x15'))('api');var utils=require(_0x453a('0x16'));var config=require(_0x453a('0x17'));var licenseUtil=require(_0x453a('0x18'));var db=require(_0x453a('0x19'))['db'];function respondWithStatusCode(_0x453be8,_0x58098a){_0x58098a=_0x58098a||0xcc;return function(_0x3ae55e){if(_0x3ae55e){return _0x453be8['sendStatus'](_0x58098a);}return _0x453be8['status'](_0x58098a)['end']();};}function respondWithResult(_0x2e8c25,_0x584f25){_0x584f25=_0x584f25||0xc8;return function(_0x6d0d47){if(_0x6d0d47){return _0x2e8c25[_0x453a('0x1a')](_0x584f25)[_0x453a('0x1b')](_0x6d0d47);}};}function respondWithFilteredResult(_0x857b8,_0x378ded){return function(_0x1fbc05){if(_0x1fbc05){var _0x4038d7=typeof _0x378ded['offset']===_0x453a('0x1c')&&typeof _0x378ded['limit']===_0x453a('0x1c');var _0x23ede5=_0x1fbc05['count'];var _0x38853a=_0x4038d7?0x0:_0x378ded[_0x453a('0x1d')];var _0x5a8630=_0x4038d7?_0x1fbc05[_0x453a('0x1e')]:_0x378ded['offset']+_0x378ded['limit'];var _0x33a418;if(_0x5a8630>=_0x23ede5){_0x5a8630=_0x23ede5;_0x33a418=0xc8;}else{_0x33a418=0xce;}_0x857b8[_0x453a('0x1a')](_0x33a418);return _0x857b8[_0x453a('0x1f')](_0x453a('0x20'),_0x38853a+'-'+_0x5a8630+'/'+_0x23ede5)['json'](_0x1fbc05);}return null;};}function patchUpdates(_0x1457b7){return function(_0x1bcea1){try{jsonpatch['apply'](_0x1bcea1,_0x1457b7,!![]);}catch(_0x487e23){return BPromise[_0x453a('0x21')](_0x487e23);}return _0x1bcea1[_0x453a('0x22')]();};}function saveUpdates(_0x55d038,_0x463ced){return function(_0x1f6f76){if(_0x1f6f76){return _0x1f6f76[_0x453a('0x23')](_0x55d038)[_0x453a('0x24')](function(_0x6f7563){return _0x6f7563;});}return null;};}function removeEntity(_0x5ccf3f,_0x99f9cd){return function(_0x5dd56f){if(_0x5dd56f){return _0x5dd56f[_0x453a('0x25')]()['then'](function(){_0x5ccf3f[_0x453a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25cc2e,_0x1334da){return function(_0x5d8c05){if(!_0x5d8c05){_0x25cc2e['sendStatus'](0x194);}return _0x5d8c05;};}function handleError(_0x1535f2,_0x74de9e){_0x74de9e=_0x74de9e||0x1f4;return function(_0x58e218){logger[_0x453a('0x26')](_0x58e218[_0x453a('0x27')]);if(_0x58e218[_0x453a('0x28')]){delete _0x58e218['name'];}_0x1535f2['status'](_0x74de9e)['send'](_0x58e218);};}exports[_0x453a('0x29')]=function(_0x1561fe,_0x5143ba){var _0x11da1f={},_0x399603={},_0x54345a={'count':0x0,'rows':[]};var _0x57a261=_[_0x453a('0x2a')](db[_0x453a('0x2b')]['rawAttributes'],function(_0xdab0b6){return{'name':_0xdab0b6[_0x453a('0x2c')],'type':_0xdab0b6[_0x453a('0x2d')][_0x453a('0x2e')]};});_0x399603[_0x453a('0x2f')]=_['map'](_0x57a261,_0x453a('0x28'));_0x399603[_0x453a('0x30')]=_[_0x453a('0x31')](_0x1561fe[_0x453a('0x30')]);_0x399603[_0x453a('0x32')]=_[_0x453a('0x33')](_0x399603[_0x453a('0x2f')],_0x399603[_0x453a('0x30')]);_0x11da1f[_0x453a('0x34')]=_['intersection'](_0x399603[_0x453a('0x2f')],qs['fields'](_0x1561fe[_0x453a('0x30')]['fields']));_0x11da1f[_0x453a('0x34')]=_0x11da1f[_0x453a('0x34')]['length']?_0x11da1f[_0x453a('0x34')]:_0x399603[_0x453a('0x2f')];if(!_0x1561fe[_0x453a('0x30')]['hasOwnProperty'](_0x453a('0x35'))){_0x11da1f[_0x453a('0x36')]=qs[_0x453a('0x36')](_0x1561fe[_0x453a('0x30')][_0x453a('0x36')]);_0x11da1f[_0x453a('0x1d')]=qs['offset'](_0x1561fe[_0x453a('0x30')][_0x453a('0x1d')]);}_0x11da1f[_0x453a('0x37')]=qs[_0x453a('0x38')](_0x1561fe[_0x453a('0x30')][_0x453a('0x38')]);_0x11da1f['where']=qs[_0x453a('0x32')](_[_0x453a('0x39')](_0x1561fe[_0x453a('0x30')],_0x399603[_0x453a('0x32')]),_0x57a261);if(_0x1561fe[_0x453a('0x30')]['filter']){_0x11da1f[_0x453a('0x3a')]=_['merge'](_0x11da1f[_0x453a('0x3a')],{'$or':_['map'](_0x57a261,function(_0x44d462){if(_0x44d462[_0x453a('0x2d')]!==_0x453a('0x3b')){var _0xd86cd7={};_0xd86cd7[_0x44d462[_0x453a('0x28')]]={'$like':'%'+_0x1561fe[_0x453a('0x30')][_0x453a('0x3c')]+'%'};return _0xd86cd7;}})});}_0x11da1f=_[_0x453a('0x3d')]({},_0x11da1f,_0x1561fe[_0x453a('0x3e')]);var _0x4b7161={'where':_0x11da1f[_0x453a('0x3a')]};return db[_0x453a('0x2b')][_0x453a('0x1e')](_0x4b7161)['then'](function(_0x503f77){_0x54345a[_0x453a('0x1e')]=_0x503f77;if(_0x1561fe['query'][_0x453a('0x3f')]){_0x11da1f[_0x453a('0x40')]=[{'all':!![]}];}return db[_0x453a('0x2b')][_0x453a('0x41')](_0x11da1f);})[_0x453a('0x24')](function(_0x176f9e){_0x54345a[_0x453a('0x42')]=_0x176f9e;return _0x54345a;})[_0x453a('0x24')](respondWithFilteredResult(_0x5143ba,_0x11da1f))['catch'](handleError(_0x5143ba,null));};exports[_0x453a('0x43')]=function(_0x537d14,_0xf43603){var _0x5a7c14={'raw':!![],'where':{'id':_0x537d14[_0x453a('0x44')]['id']}},_0x284b57={};_0x284b57[_0x453a('0x2f')]=_[_0x453a('0x31')](db['SquareDetailsReport'][_0x453a('0x45')]);_0x284b57[_0x453a('0x30')]=_['keys'](_0x537d14[_0x453a('0x30')]);_0x284b57['filters']=_[_0x453a('0x33')](_0x284b57[_0x453a('0x2f')],_0x284b57['query']);_0x5a7c14['attributes']=_['intersection'](_0x284b57['model'],qs[_0x453a('0x46')](_0x537d14[_0x453a('0x30')][_0x453a('0x46')]));_0x5a7c14[_0x453a('0x34')]=_0x5a7c14[_0x453a('0x34')]['length']?_0x5a7c14[_0x453a('0x34')]:_0x284b57[_0x453a('0x2f')];if(_0x537d14[_0x453a('0x30')][_0x453a('0x3f')]){_0x5a7c14[_0x453a('0x40')]=[{'all':!![]}];}_0x5a7c14=_[_0x453a('0x3d')]({},_0x5a7c14,_0x537d14[_0x453a('0x3e')]);return db['SquareDetailsReport'][_0x453a('0x47')](_0x5a7c14)['then'](handleEntityNotFound(_0xf43603,null))['then'](respondWithResult(_0xf43603,null))[_0x453a('0x48')](handleError(_0xf43603,null));};exports['create']=function(_0x3ea5e3,_0x3305ab){return db['SquareDetailsReport'][_0x453a('0x49')](_0x3ea5e3['body'],{})['then'](respondWithResult(_0x3305ab,0xc9))['catch'](handleError(_0x3305ab,null));};exports['update']=function(_0x5178d0,_0x57aa26){if(_0x5178d0[_0x453a('0x4a')]['id']){delete _0x5178d0[_0x453a('0x4a')]['id'];}return db[_0x453a('0x2b')][_0x453a('0x47')]({'where':{'id':_0x5178d0[_0x453a('0x44')]['id']}})['then'](handleEntityNotFound(_0x57aa26,null))[_0x453a('0x24')](saveUpdates(_0x5178d0[_0x453a('0x4a')],null))[_0x453a('0x24')](respondWithResult(_0x57aa26,null))['catch'](handleError(_0x57aa26,null));};exports[_0x453a('0x25')]=function(_0x1210f2,_0x375bd9){return db[_0x453a('0x2b')][_0x453a('0x47')]({'where':{'id':_0x1210f2['params']['id']}})[_0x453a('0x24')](handleEntityNotFound(_0x375bd9,null))[_0x453a('0x24')](removeEntity(_0x375bd9,null))[_0x453a('0x48')](handleError(_0x375bd9,null));};exports[_0x453a('0x4b')]=function(_0x3b782d,_0x3459be){return db[_0x453a('0x2b')][_0x453a('0x4b')]()[_0x453a('0x24')](respondWithResult(_0x3459be,null))['catch'](handleError(_0x3459be,null));}; \ No newline at end of file +var _0x8e2e=['apply','reject','save','update','destroy','then','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x581182,_0x4d140b){var _0x27eed2=function(_0x221e8f){while(--_0x221e8f){_0x581182['push'](_0x581182['shift']());}};_0x27eed2(++_0x4d140b);}(_0x8e2e,0x10b));var _0xe8e2=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0x8e2e[_0x5426e2];return _0x920dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8e2('0x0'));var zipdir=require(_0xe8e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe8e2('0x2'));var Mustache=require(_0xe8e2('0x3'));var util=require(_0xe8e2('0x4'));var path=require(_0xe8e2('0x5'));var sox=require(_0xe8e2('0x6'));var csv=require(_0xe8e2('0x7'));var ejs=require(_0xe8e2('0x8'));var fs=require('fs');var fs_extra=require(_0xe8e2('0x9'));var _=require(_0xe8e2('0xa'));var squel=require(_0xe8e2('0xb'));var crypto=require('crypto');var jsforce=require(_0xe8e2('0xc'));var deskjs=require(_0xe8e2('0xd'));var toCsv=require(_0xe8e2('0x7'));var querystring=require('querystring');var Papa=require(_0xe8e2('0xe'));var Redis=require(_0xe8e2('0xf'));var authService=require(_0xe8e2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8e2('0x11'))(_0xe8e2('0x12'));var utils=require(_0xe8e2('0x13'));var config=require(_0xe8e2('0x14'));var licenseUtil=require(_0xe8e2('0x15'));var db=require(_0xe8e2('0x16'))['db'];function respondWithStatusCode(_0x2d3767,_0xc11a5c){_0xc11a5c=_0xc11a5c||0xcc;return function(_0x1ad243){if(_0x1ad243){return _0x2d3767[_0xe8e2('0x17')](_0xc11a5c);}return _0x2d3767['status'](_0xc11a5c)[_0xe8e2('0x18')]();};}function respondWithResult(_0x49b89e,_0x2d2547){_0x2d2547=_0x2d2547||0xc8;return function(_0x3caa8a){if(_0x3caa8a){return _0x49b89e[_0xe8e2('0x19')](_0x2d2547)[_0xe8e2('0x1a')](_0x3caa8a);}};}function respondWithFilteredResult(_0x5e9b9c,_0x2e4835){return function(_0x3962b9){if(_0x3962b9){var _0x1563cb=typeof _0x2e4835[_0xe8e2('0x1b')]==='undefined'&&typeof _0x2e4835[_0xe8e2('0x1c')]===_0xe8e2('0x1d');var _0x27b479=_0x3962b9[_0xe8e2('0x1e')];var _0x99ed04=_0x1563cb?0x0:_0x2e4835[_0xe8e2('0x1b')];var _0x5067a1=_0x1563cb?_0x3962b9[_0xe8e2('0x1e')]:_0x2e4835[_0xe8e2('0x1b')]+_0x2e4835[_0xe8e2('0x1c')];var _0xb3aa84;if(_0x5067a1>=_0x27b479){_0x5067a1=_0x27b479;_0xb3aa84=0xc8;}else{_0xb3aa84=0xce;}_0x5e9b9c[_0xe8e2('0x19')](_0xb3aa84);return _0x5e9b9c[_0xe8e2('0x1f')](_0xe8e2('0x20'),_0x99ed04+'-'+_0x5067a1+'/'+_0x27b479)[_0xe8e2('0x1a')](_0x3962b9);}return null;};}function patchUpdates(_0xb8fac5){return function(_0x3684a8){try{jsonpatch[_0xe8e2('0x21')](_0x3684a8,_0xb8fac5,!![]);}catch(_0x3927c1){return BPromise[_0xe8e2('0x22')](_0x3927c1);}return _0x3684a8[_0xe8e2('0x23')]();};}function saveUpdates(_0x2e8f05,_0x4a7dc2){return function(_0x5e946c){if(_0x5e946c){return _0x5e946c[_0xe8e2('0x24')](_0x2e8f05)['then'](function(_0x489df8){return _0x489df8;});}return null;};}function removeEntity(_0x2ebeae,_0x583355){return function(_0x8bffd7){if(_0x8bffd7){return _0x8bffd7[_0xe8e2('0x25')]()[_0xe8e2('0x26')](function(){_0x2ebeae[_0xe8e2('0x19')](0xcc)[_0xe8e2('0x18')]();});}};}function handleEntityNotFound(_0x5a9a46,_0x449de6){return function(_0xcc4ed8){if(!_0xcc4ed8){_0x5a9a46[_0xe8e2('0x17')](0x194);}return _0xcc4ed8;};}function handleError(_0x461812,_0x5a00f6){_0x5a00f6=_0x5a00f6||0x1f4;return function(_0x53fd95){logger['error'](_0x53fd95['stack']);if(_0x53fd95[_0xe8e2('0x27')]){delete _0x53fd95[_0xe8e2('0x27')];}_0x461812[_0xe8e2('0x19')](_0x5a00f6)[_0xe8e2('0x28')](_0x53fd95);};}exports['index']=function(_0x30bbb9,_0x50bb56){var _0x29b76b={},_0x39623a={},_0xd8595e={'count':0x0,'rows':[]};var _0x1bf984=_[_0xe8e2('0x29')](db['SquareDetailsReport'][_0xe8e2('0x2a')],function(_0x30a6fa){return{'name':_0x30a6fa[_0xe8e2('0x2b')],'type':_0x30a6fa[_0xe8e2('0x2c')][_0xe8e2('0x2d')]};});_0x39623a[_0xe8e2('0x2e')]=_[_0xe8e2('0x29')](_0x1bf984,_0xe8e2('0x27'));_0x39623a[_0xe8e2('0x2f')]=_['keys'](_0x30bbb9[_0xe8e2('0x2f')]);_0x39623a[_0xe8e2('0x30')]=_[_0xe8e2('0x31')](_0x39623a[_0xe8e2('0x2e')],_0x39623a['query']);_0x29b76b['attributes']=_[_0xe8e2('0x31')](_0x39623a[_0xe8e2('0x2e')],qs[_0xe8e2('0x32')](_0x30bbb9[_0xe8e2('0x2f')][_0xe8e2('0x32')]));_0x29b76b[_0xe8e2('0x33')]=_0x29b76b[_0xe8e2('0x33')][_0xe8e2('0x34')]?_0x29b76b['attributes']:_0x39623a['model'];if(!_0x30bbb9[_0xe8e2('0x2f')][_0xe8e2('0x35')](_0xe8e2('0x36'))){_0x29b76b[_0xe8e2('0x1c')]=qs[_0xe8e2('0x1c')](_0x30bbb9[_0xe8e2('0x2f')][_0xe8e2('0x1c')]);_0x29b76b[_0xe8e2('0x1b')]=qs[_0xe8e2('0x1b')](_0x30bbb9[_0xe8e2('0x2f')][_0xe8e2('0x1b')]);}_0x29b76b['order']=qs['sort'](_0x30bbb9['query'][_0xe8e2('0x37')]);_0x29b76b[_0xe8e2('0x38')]=qs['filters'](_[_0xe8e2('0x39')](_0x30bbb9[_0xe8e2('0x2f')],_0x39623a['filters']),_0x1bf984);if(_0x30bbb9['query'][_0xe8e2('0x3a')]){_0x29b76b['where']=_[_0xe8e2('0x3b')](_0x29b76b[_0xe8e2('0x38')],{'$or':_[_0xe8e2('0x29')](_0x1bf984,function(_0x2510f3){if(_0x2510f3[_0xe8e2('0x2c')]!==_0xe8e2('0x3c')){var _0x2248ac={};_0x2248ac[_0x2510f3[_0xe8e2('0x27')]]={'$like':'%'+_0x30bbb9[_0xe8e2('0x2f')][_0xe8e2('0x3a')]+'%'};return _0x2248ac;}})});}_0x29b76b=_['merge']({},_0x29b76b,_0x30bbb9[_0xe8e2('0x3d')]);var _0x563374={'where':_0x29b76b[_0xe8e2('0x38')]};return db[_0xe8e2('0x3e')]['count'](_0x563374)[_0xe8e2('0x26')](function(_0x4835ac){_0xd8595e[_0xe8e2('0x1e')]=_0x4835ac;if(_0x30bbb9[_0xe8e2('0x2f')][_0xe8e2('0x3f')]){_0x29b76b[_0xe8e2('0x40')]=[{'all':!![]}];}return db[_0xe8e2('0x3e')][_0xe8e2('0x41')](_0x29b76b);})[_0xe8e2('0x26')](function(_0x43dd31){_0xd8595e[_0xe8e2('0x42')]=_0x43dd31;return _0xd8595e;})['then'](respondWithFilteredResult(_0x50bb56,_0x29b76b))[_0xe8e2('0x43')](handleError(_0x50bb56,null));};exports[_0xe8e2('0x44')]=function(_0x47cd14,_0x6c81a9){var _0x47a007={'raw':!![],'where':{'id':_0x47cd14[_0xe8e2('0x45')]['id']}},_0x57ddc9={};_0x57ddc9['model']=_[_0xe8e2('0x46')](db[_0xe8e2('0x3e')][_0xe8e2('0x2a')]);_0x57ddc9['query']=_[_0xe8e2('0x46')](_0x47cd14['query']);_0x57ddc9[_0xe8e2('0x30')]=_['intersection'](_0x57ddc9[_0xe8e2('0x2e')],_0x57ddc9['query']);_0x47a007[_0xe8e2('0x33')]=_[_0xe8e2('0x31')](_0x57ddc9[_0xe8e2('0x2e')],qs['fields'](_0x47cd14['query'][_0xe8e2('0x32')]));_0x47a007[_0xe8e2('0x33')]=_0x47a007[_0xe8e2('0x33')][_0xe8e2('0x34')]?_0x47a007['attributes']:_0x57ddc9['model'];if(_0x47cd14[_0xe8e2('0x2f')]['includeAll']){_0x47a007[_0xe8e2('0x40')]=[{'all':!![]}];}_0x47a007=_[_0xe8e2('0x3b')]({},_0x47a007,_0x47cd14[_0xe8e2('0x3d')]);return db[_0xe8e2('0x3e')][_0xe8e2('0x47')](_0x47a007)['then'](handleEntityNotFound(_0x6c81a9,null))[_0xe8e2('0x26')](respondWithResult(_0x6c81a9,null))[_0xe8e2('0x43')](handleError(_0x6c81a9,null));};exports[_0xe8e2('0x48')]=function(_0xd6212e,_0xa1b4d6){return db['SquareDetailsReport']['create'](_0xd6212e[_0xe8e2('0x49')],{})['then'](respondWithResult(_0xa1b4d6,0xc9))[_0xe8e2('0x43')](handleError(_0xa1b4d6,null));};exports['update']=function(_0x3012a0,_0x3525df){if(_0x3012a0[_0xe8e2('0x49')]['id']){delete _0x3012a0['body']['id'];}return db[_0xe8e2('0x3e')][_0xe8e2('0x47')]({'where':{'id':_0x3012a0[_0xe8e2('0x45')]['id']}})[_0xe8e2('0x26')](handleEntityNotFound(_0x3525df,null))[_0xe8e2('0x26')](saveUpdates(_0x3012a0[_0xe8e2('0x49')],null))[_0xe8e2('0x26')](respondWithResult(_0x3525df,null))[_0xe8e2('0x43')](handleError(_0x3525df,null));};exports[_0xe8e2('0x25')]=function(_0x3e6df8,_0x5aaba9){return db[_0xe8e2('0x3e')][_0xe8e2('0x47')]({'where':{'id':_0x3e6df8['params']['id']}})[_0xe8e2('0x26')](handleEntityNotFound(_0x5aaba9,null))[_0xe8e2('0x26')](removeEntity(_0x5aaba9,null))[_0xe8e2('0x43')](handleError(_0x5aaba9,null));};exports[_0xe8e2('0x4a')]=function(_0x8b9a71,_0xa2ae86){return db[_0xe8e2('0x3e')][_0xe8e2('0x4a')]()[_0xe8e2('0x26')](respondWithResult(_0xa2ae86,null))[_0xe8e2('0x43')](handleError(_0xa2ae86,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b850a2f..cab85b6 100644 --- a/server/api/squareReportDetail/squareReportDetail.model.js +++ b/server/api/squareReportDetail/squareReportDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb34d=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details'];(function(_0x1abb24,_0x5070c3){var _0x4a546c=function(_0x9817d3){while(--_0x9817d3){_0x1abb24['push'](_0x1abb24['shift']());}};_0x4a546c(++_0x5070c3);}(_0xb34d,0x1ec));var _0xdb34=function(_0x13bdd1,_0x480491){_0x13bdd1=_0x13bdd1-0x0;var _0x3d3a65=_0xb34d[_0x13bdd1];return _0x3d3a65;};'use strict';var _=require(_0xdb34('0x0'));var util=require(_0xdb34('0x1'));var logger=require(_0xdb34('0x2'))(_0xdb34('0x3'));var moment=require(_0xdb34('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb34('0x6'));var config=require(_0xdb34('0x7'));var attributes=require(_0xdb34('0x8'));module[_0xdb34('0x9')]=function(_0xde42,_0x4496bd){return _0xde42['define'](_0xdb34('0xa'),attributes,{'tableName':_0xdb34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37c1=['SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x293f3e,_0x40aa1f){var _0x327a03=function(_0x287c8c){while(--_0x287c8c){_0x293f3e['push'](_0x293f3e['shift']());}};_0x327a03(++_0x40aa1f);}(_0x37c1,0x72));var _0x137c=function(_0x48ebe8,_0x300832){_0x48ebe8=_0x48ebe8-0x0;var _0x5c65fb=_0x37c1[_0x48ebe8];return _0x5c65fb;};'use strict';var _=require('lodash');var util=require(_0x137c('0x0'));var logger=require(_0x137c('0x1'))(_0x137c('0x2'));var moment=require(_0x137c('0x3'));var BPromise=require(_0x137c('0x4'));var rp=require(_0x137c('0x5'));var fs=require('fs');var path=require(_0x137c('0x6'));var rimraf=require(_0x137c('0x7'));var config=require(_0x137c('0x8'));var attributes=require(_0x137c('0x9'));module[_0x137c('0xa')]=function(_0x3c5e48,_0x115694){return _0x3c5e48[_0x137c('0xb')](_0x137c('0xc'),attributes,{'tableName':_0x137c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 064c411..46f3270 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c7c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x1c7c,0x164));var _0xc1c7=function(_0x1db43,_0x255eae){_0x1db43=_0x1db43-0x0;var _0x284675=_0x1c7c[_0x1db43];return _0x284675;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));var BPromise=require(_0xc1c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c7('0x5'));var logger=require(_0xc1c7('0x6'))(_0xc1c7('0x7'));var config=require(_0xc1c7('0x8'));var jayson=require(_0xc1c7('0x9'));var client=jayson[_0xc1c7('0xa')][_0xc1c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x419138,_0xce5bcd,_0x3b3e9c){return new BPromise(function(_0x434a35,_0x11c7ef){return client[_0xc1c7('0xc')](_0x419138,_0x3b3e9c)[_0xc1c7('0xd')](function(_0x339649){logger[_0xc1c7('0xe')](_0xc1c7('0xf'),_0xce5bcd,'request\x20sent');logger[_0xc1c7('0x10')](_0xc1c7('0x11'),_0xce5bcd,'request\x20sent',JSON[_0xc1c7('0x12')](_0x339649));if(_0x339649[_0xc1c7('0x13')]){if(_0x339649[_0xc1c7('0x13')]['code']===0x1f4){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x11c7ef(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x434a35(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}else{logger['info'](_0xc1c7('0xf'),_0xce5bcd,_0xc1c7('0x15'));_0x434a35(_0x339649[_0xc1c7('0x16')]['message']);}})[_0xc1c7('0x17')](function(_0x3939c1){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x3939c1);_0x11c7ef(_0x3939c1);});});}exports[_0xc1c7('0x18')]=function(_0xb42702){var _0x21758a=this;return new Promise(function(_0x2e93e5,_0x5d44e9){return db[_0xc1c7('0x19')][_0xc1c7('0x1a')](_0xb42702[_0xc1c7('0x1b')],{'raw':_0xb42702[_0xc1c7('0x1c')]?_0xb42702['options'][_0xc1c7('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5e7e4a){logger[_0xc1c7('0xe')]('CreateSquareDetailsReport',_0xb42702);logger['debug'](_0xc1c7('0x18'),_0xb42702,JSON[_0xc1c7('0x12')](_0x5e7e4a));_0x2e93e5(_0x5e7e4a);})[_0xc1c7('0x17')](function(_0x4c6b34){logger[_0xc1c7('0x13')](_0xc1c7('0x18'),_0x4c6b34[_0xc1c7('0x14')],_0xb42702);_0x5d44e9(_0x21758a[_0xc1c7('0x13')](0x1f4,_0x4c6b34[_0xc1c7('0x14')]));});});}; \ No newline at end of file +var _0xa149=['result','catch','CreateSquareDetailsReport','create','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x40c596,_0x723936){var _0x3ab17d=function(_0x5425fd){while(--_0x5425fd){_0x40c596['push'](_0x40c596['shift']());}};_0x3ab17d(++_0x723936);}(_0xa149,0x18c));var _0x9a14=function(_0x5f5743,_0x19a04d){_0x5f5743=_0x5f5743-0x0;var _0x1ee8da=_0xa149[_0x5f5743];return _0x1ee8da;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require(_0x9a14('0x5'));var db=require(_0x9a14('0x6'))['db'];var utils=require(_0x9a14('0x7'));var logger=require(_0x9a14('0x8'))('rpc');var config=require(_0x9a14('0x9'));var jayson=require(_0x9a14('0xa'));var client=jayson['client'][_0x9a14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3beb93,_0x286760,_0x17d2e5){return new BPromise(function(_0x109f69,_0x26efc5){return client['request'](_0x3beb93,_0x17d2e5)[_0x9a14('0xc')](function(_0x4bdd6c){logger[_0x9a14('0xd')](_0x9a14('0xe'),_0x286760,_0x9a14('0xf'));logger[_0x9a14('0x10')](_0x9a14('0x11'),_0x286760,_0x9a14('0xf'),JSON['stringify'](_0x4bdd6c));if(_0x4bdd6c['error']){if(_0x4bdd6c['error']['code']===0x1f4){logger[_0x9a14('0x12')](_0x9a14('0xe'),_0x286760,_0x4bdd6c['error'][_0x9a14('0x13')]);return _0x26efc5(_0x4bdd6c['error'][_0x9a14('0x13')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x286760,_0x4bdd6c[_0x9a14('0x12')][_0x9a14('0x13')]);return _0x109f69(_0x4bdd6c[_0x9a14('0x12')][_0x9a14('0x13')]);}else{logger['info'](_0x9a14('0xe'),_0x286760,_0x9a14('0xf'));_0x109f69(_0x4bdd6c[_0x9a14('0x14')][_0x9a14('0x13')]);}})[_0x9a14('0x15')](function(_0x5b3a7a){logger[_0x9a14('0x12')](_0x9a14('0xe'),_0x286760,_0x5b3a7a);_0x26efc5(_0x5b3a7a);});});}exports[_0x9a14('0x16')]=function(_0x3aa654){var _0x38be44=this;return new Promise(function(_0x55a283,_0x5287e6){return db['SquareDetailsReport'][_0x9a14('0x17')](_0x3aa654['body'],{'raw':_0x3aa654[_0x9a14('0x18')]?_0x3aa654[_0x9a14('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53e151){logger['info'](_0x9a14('0x16'),_0x3aa654);logger[_0x9a14('0x10')](_0x9a14('0x16'),_0x3aa654,JSON[_0x9a14('0x19')](_0x53e151));_0x55a283(_0x53e151);})[_0x9a14('0x15')](function(_0xc78dd7){logger[_0x9a14('0x12')]('CreateSquareDetailsReport',_0xc78dd7['message'],_0x3aa654);_0x5287e6(_0x38be44[_0x9a14('0x12')](0x1f4,_0xc78dd7[_0x9a14('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3dcf1e6..c8dc821 100644 --- a/server/api/system/index.js +++ b/server/api/system/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12b4=['index','/process/:pid/kill','isAuthenticated','exports','express','Router','../../components/auth/service','get'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x12b4,0x13c));var _0x412b=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x12b4[_0x9cd4c3];return _0x4c9025;};'use strict';var express=require(_0x412b('0x0'));var router=express[_0x412b('0x1')]();var auth=require(_0x412b('0x2'));var controller=require('./system.controller');router[_0x412b('0x3')]('/',auth['isAuthenticated'](),controller[_0x412b('0x4')]);router[_0x412b('0x3')](_0x412b('0x5'),auth[_0x412b('0x6')](),controller['killProcess']);module[_0x412b('0x7')]=router; \ No newline at end of file +var _0x581d=['index','killProcess','exports','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x59729d,_0x213dd6){var _0x4deb8d=function(_0xb4f0cf){while(--_0xb4f0cf){_0x59729d['push'](_0x59729d['shift']());}};_0x4deb8d(++_0x213dd6);}(_0x581d,0xce));var _0xd581=function(_0x36c28a,_0x276b60){_0x36c28a=_0x36c28a-0x0;var _0x46f79=_0x581d[_0x36c28a];return _0x46f79;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xd581('0x0'));var controller=require(_0xd581('0x1'));router[_0xd581('0x2')]('/',auth[_0xd581('0x3')](),controller[_0xd581('0x4')]);router[_0xd581('0x2')]('/process/:pid/kill',auth[_0xd581('0x3')](),controller[_0xd581('0x5')]);module[_0xd581('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 02757ab..0442c58 100644 --- a/server/api/system/system.controller.js +++ b/server/api/system/system.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1716=['kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','api','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','status','json','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x5660b0,_0x43b1f8){var _0x1a35ff=function(_0x44152d){while(--_0x44152d){_0x5660b0['push'](_0x5660b0['shift']());}};_0x1a35ff(++_0x43b1f8);}(_0x1716,0x122));var _0x6171=function(_0x2c40fa,_0x4246c2){_0x2c40fa=_0x2c40fa-0x0;var _0x3dccff=_0x1716[_0x2c40fa];return _0x3dccff;};'use strict';var info=require(_0x6171('0x0'));var exec=require('child_process')[_0x6171('0x1')];var logger=require('../../config/logger')(_0x6171('0x2'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x34cfc8,_0x9f0401,_0x29bff9){_0x9f0401=_0x9f0401||0x1f4;return function(_0x3a3ac1){logger['error'](_0x6171('0x3'),_0x29bff9,_0x9f0401,util[_0x6171('0x4')](_0x3a3ac1,{'showHidden':![],'depth':null}));delete _0x3a3ac1[_0x6171('0x5')];_0x34cfc8['status'](_0x9f0401)[_0x6171('0x6')](_0x3a3ac1);};}exports[_0x6171('0x7')]=function(_0x312e48,_0x3b2880){return info[_0x6171('0x8')]()['then'](function(_0x3bf17c){return _0x3b2880[_0x6171('0x9')](0xc8)[_0x6171('0xa')](_0x3bf17c);})['catch'](function(_0x52ff59){return _0x3b2880[_0x6171('0x9')](0x1f4)[_0x6171('0xa')](_0x52ff59);});};exports['killProcess']=function(_0xb758ee,_0x596714){var _0x4025bc=[_0x6171('0xb')];return new BPromise(function(_0x39dec7,_0xb938b9){return exec(util['format'](_0x6171('0xc'),_0xb758ee[_0x6171('0xd')][_0x6171('0xe')]),function(_0x3c2447,_0x500517,_0xf6ca28){if(_0x3c2447){return _0xb938b9(_0x3c2447);}return _0x39dec7(_0x500517);});})[_0x6171('0xf')](function(_0x187ef4){var _0x1dc82f=![];var _0x58ddff=_0x187ef4['split'](/\n/);for(var _0x14174b=0x0,_0x5e5d0b=_0x4025bc['length'];_0x14174b<_0x5e5d0b,_0x1dc82f===![];_0x14174b+=0x1){if(_0x187ef4[_0x6171('0x10')](_0x4025bc[_0x14174b])>=0x0){_0x1dc82f=!![];}}if(!_0x1dc82f){throw new Error(util['format'](_0x6171('0x11'),_0xb758ee[_0x6171('0xd')][_0x6171('0xe')]));}process[_0x6171('0x12')](_0xb758ee[_0x6171('0xd')][_0x6171('0xe')],_0x6171('0x13'));return _0x596714[_0x6171('0x9')](0xc8)[_0x6171('0xa')]({'message':util['format'](_0x6171('0x14'),_0xb758ee['params'][_0x6171('0xe')])});})['catch'](handleError(_0x596714,null,_0x6171('0x15')));}; \ No newline at end of file +var _0xb714=['exec','../../config/logger','api','util','bluebird','lodash','error','inspect','name','status','send','index','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process'];(function(_0x29a3bc,_0xae78b7){var _0x598f88=function(_0x4e3615){while(--_0x4e3615){_0x29a3bc['push'](_0x29a3bc['shift']());}};_0x598f88(++_0xae78b7);}(_0xb714,0x116));var _0x4b71=function(_0x1413b6,_0x46a66d){_0x1413b6=_0x1413b6-0x0;var _0x133fd9=_0xb714[_0x1413b6];return _0x133fd9;};'use strict';var info=require(_0x4b71('0x0'));var exec=require(_0x4b71('0x1'))[_0x4b71('0x2')];var logger=require(_0x4b71('0x3'))(_0x4b71('0x4'));var util=require(_0x4b71('0x5'));var BPromise=require(_0x4b71('0x6'));var _=require(_0x4b71('0x7'));function handleError(_0x1e1b2f,_0x38b173,_0x53b909){_0x38b173=_0x38b173||0x1f4;return function(_0x5d7bb7){logger[_0x4b71('0x8')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x53b909,_0x38b173,util[_0x4b71('0x9')](_0x5d7bb7,{'showHidden':![],'depth':null}));delete _0x5d7bb7[_0x4b71('0xa')];_0x1e1b2f[_0x4b71('0xb')](_0x38b173)[_0x4b71('0xc')](_0x5d7bb7);};}exports[_0x4b71('0xd')]=function(_0x33cca7,_0x1755c0){return info['getAllData']()[_0x4b71('0xe')](function(_0x3a294c){return _0x1755c0[_0x4b71('0xb')](0xc8)[_0x4b71('0xf')](_0x3a294c);})['catch'](function(_0x4e1812){return _0x1755c0[_0x4b71('0xb')](0x1f4)[_0x4b71('0xf')](_0x4e1812);});};exports[_0x4b71('0x10')]=function(_0x15a179,_0x436687){var _0x53efde=['components/import/cm'];return new BPromise(function(_0x512636,_0x1af3b2){return exec(util[_0x4b71('0x11')](_0x4b71('0x12'),_0x15a179['params'][_0x4b71('0x13')]),function(_0x30d361,_0x125e7b,_0x17b5c9){if(_0x30d361){return _0x1af3b2(_0x30d361);}return _0x512636(_0x125e7b);});})[_0x4b71('0xe')](function(_0x4b591b){var _0x5b088f=![];var _0x41419a=_0x4b591b[_0x4b71('0x14')](/\n/);for(var _0x23583a=0x0,_0x1e3b0b=_0x53efde[_0x4b71('0x15')];_0x23583a<_0x1e3b0b,_0x5b088f===![];_0x23583a+=0x1){if(_0x4b591b[_0x4b71('0x16')](_0x53efde[_0x23583a])>=0x0){_0x5b088f=!![];}}if(!_0x5b088f){throw new Error(util[_0x4b71('0x11')](_0x4b71('0x17'),_0x15a179[_0x4b71('0x18')][_0x4b71('0x13')]));}process['kill'](_0x15a179[_0x4b71('0x18')][_0x4b71('0x13')],_0x4b71('0x19'));return _0x436687[_0x4b71('0xb')](0xc8)[_0x4b71('0xf')]({'message':util[_0x4b71('0x11')](_0x4b71('0x1a'),_0x15a179[_0x4b71('0x18')][_0x4b71('0x13')])});})[_0x4b71('0x1b')](handleError(_0x436687,null,_0x4b71('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d5873cc..709314e 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x986b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x5ae0f9,_0x20169b){var _0x27f188=function(_0x503233){while(--_0x503233){_0x5ae0f9['push'](_0x5ae0f9['shift']());}};_0x27f188(++_0x20169b);}(_0x986b,0x156));var _0xb986=function(_0xc960b3,_0x13542e){_0xc960b3=_0xc960b3-0x0;var _0x5de298=_0x986b[_0xc960b3];return _0x5de298;};'use strict';var multer=require(_0xb986('0x0'));var util=require(_0xb986('0x1'));var path=require(_0xb986('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb986('0x3'));var auth=require(_0xb986('0x4'));var interaction=require(_0xb986('0x5'));var config=require(_0xb986('0x6'));var controller=require('./tag.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb986('0x7')](_0xb986('0x8'),auth['isAuthenticated'](),controller[_0xb986('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb986('0xa')](_0xb986('0x8'),auth[_0xb986('0xb')](),controller[_0xb986('0xc')]);router[_0xb986('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb986('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7bd5=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util','path','Router','../../config/environment','./tag.controller','get'];(function(_0x5cf51a,_0x49147f){var _0x1be846=function(_0x475e7b){while(--_0x475e7b){_0x5cf51a['push'](_0x5cf51a['shift']());}};_0x1be846(++_0x49147f);}(_0x7bd5,0x72));var _0x57bd=function(_0x3ca2d5,_0x249ec7){_0x3ca2d5=_0x3ca2d5-0x0;var _0x10f961=_0x7bd5[_0x3ca2d5];return _0x10f961;};'use strict';var multer=require('multer');var util=require(_0x57bd('0x0'));var path=require(_0x57bd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x57bd('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57bd('0x3'));var controller=require(_0x57bd('0x4'));router[_0x57bd('0x5')]('/',auth[_0x57bd('0x6')](),controller[_0x57bd('0x7')]);router[_0x57bd('0x5')](_0x57bd('0x8'),auth[_0x57bd('0x6')](),controller['show']);router[_0x57bd('0x9')]('/',auth[_0x57bd('0x6')](),controller[_0x57bd('0xa')]);router[_0x57bd('0xb')](_0x57bd('0x8'),auth[_0x57bd('0x6')](),controller[_0x57bd('0xc')]);router[_0x57bd('0xd')](_0x57bd('0x8'),auth[_0x57bd('0x6')](),controller[_0x57bd('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ecbd912..96b6ad9 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65c9=['#0091EA','sequelize','exports','name','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x65c9,0x182));var _0x965c=function(_0x2b27c4,_0x1cadd4){_0x2b27c4=_0x2b27c4-0x0;var _0x2fdc9c=_0x65c9[_0x2b27c4];return _0x2fdc9c;};'use strict';var Sequelize=require(_0x965c('0x0'));module[_0x965c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x965c('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x965c('0x3')],'defaultValue':_0x965c('0x4')},'description':{'type':Sequelize[_0x965c('0x3')]}}; \ No newline at end of file +var _0x9efc=['sequelize','exports','STRING','name'];(function(_0x1bcfff,_0x3ccb9b){var _0x5e74f5=function(_0x289945){while(--_0x289945){_0x1bcfff['push'](_0x1bcfff['shift']());}};_0x5e74f5(++_0x3ccb9b);}(_0x9efc,0x19c));var _0xc9ef=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0x9efc[_0x189d3c];return _0x485959;};'use strict';var Sequelize=require(_0xc9ef('0x0'));module[_0xc9ef('0x1')]={'name':{'type':Sequelize[_0xc9ef('0x2')],'unique':_0xc9ef('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc9ef('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 11f3579..89fef74 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd52a=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Tags','UserProfileResource','then','stack','name','send','index','map','Tag','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','find','body','user','role','UserProfileSection','autoAssociation','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json'];(function(_0x45a938,_0x38d31f){var _0x3c9fc2=function(_0x2d00fe){while(--_0x2d00fe){_0x45a938['push'](_0x45a938['shift']());}};_0x3c9fc2(++_0x38d31f);}(_0xd52a,0xca));var _0xad52=function(_0x363324,_0x297639){_0x363324=_0x363324-0x0;var _0x392bd2=_0xd52a[_0x363324];return _0x392bd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad52('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad52('0x1'));var rp=require(_0xad52('0x2'));var moment=require(_0xad52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xad52('0x4'));var util=require(_0xad52('0x5'));var path=require(_0xad52('0x6'));var sox=require(_0xad52('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad52('0x8'));var squel=require('squel');var crypto=require(_0xad52('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad52('0xa'));var toCsv=require(_0xad52('0xb'));var querystring=require('querystring');var Papa=require(_0xad52('0xc'));var Redis=require('ioredis');var authService=require(_0xad52('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xad52('0xe'));var hardwareService=require(_0xad52('0xf'));var logger=require(_0xad52('0x10'))(_0xad52('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad52('0x12'))['db'];function respondWithStatusCode(_0x79b1e7,_0x378b0c){_0x378b0c=_0x378b0c||0xcc;return function(_0x41331e){if(_0x41331e){return _0x79b1e7[_0xad52('0x13')](_0x378b0c);}return _0x79b1e7[_0xad52('0x14')](_0x378b0c)[_0xad52('0x15')]();};}function respondWithResult(_0xd04cde,_0x3d2df6){_0x3d2df6=_0x3d2df6||0xc8;return function(_0x5727a2){if(_0x5727a2){return _0xd04cde[_0xad52('0x14')](_0x3d2df6)[_0xad52('0x16')](_0x5727a2);}};}function respondWithFilteredResult(_0x3bc8f6,_0x42eb20){return function(_0x38be7e){if(_0x38be7e){var _0xcb6cd5=typeof _0x42eb20[_0xad52('0x17')]===_0xad52('0x18')&&typeof _0x42eb20[_0xad52('0x19')]==='undefined';var _0x4abd73=_0x38be7e[_0xad52('0x1a')];var _0x39128c=_0xcb6cd5?0x0:_0x42eb20[_0xad52('0x17')];var _0x1c19e9=_0xcb6cd5?_0x38be7e[_0xad52('0x1a')]:_0x42eb20['offset']+_0x42eb20[_0xad52('0x19')];var _0x5a71c4;if(_0x1c19e9>=_0x4abd73){_0x1c19e9=_0x4abd73;_0x5a71c4=0xc8;}else{_0x5a71c4=0xce;}_0x3bc8f6[_0xad52('0x14')](_0x5a71c4);return _0x3bc8f6[_0xad52('0x1b')](_0xad52('0x1c'),_0x39128c+'-'+_0x1c19e9+'/'+_0x4abd73)['json'](_0x38be7e);}return null;};}function patchUpdates(_0x24fb52){return function(_0x593dfd){try{jsonpatch[_0xad52('0x1d')](_0x593dfd,_0x24fb52,!![]);}catch(_0x179a64){return BPromise[_0xad52('0x1e')](_0x179a64);}return _0x593dfd[_0xad52('0x1f')]();};}function saveUpdates(_0x2c182f,_0x2f1526){return function(_0x4b5f2f){if(_0x4b5f2f){return _0x4b5f2f[_0xad52('0x20')](_0x2c182f)['then'](function(_0x1aac2e){return _0x1aac2e;});}return null;};}function removeEntity(_0x2acbb4,_0x2fa90c){return function(_0x5bce67){if(_0x5bce67){return _0x5bce67[_0xad52('0x21')]()['then'](function(){var _0x5437e3=_0x5bce67[_0xad52('0x22')]({'plain':!![]});var _0x583999=_0xad52('0x23');return db[_0xad52('0x24')]['destroy']({'where':{'type':_0x583999,'resourceId':_0x5437e3['id']}})['then'](function(){return _0x5bce67;});})[_0xad52('0x25')](function(){_0x2acbb4[_0xad52('0x14')](0xcc)[_0xad52('0x15')]();});}};}function handleEntityNotFound(_0x50431e,_0x132e94){return function(_0x5771ce){if(!_0x5771ce){_0x50431e[_0xad52('0x13')](0x194);}return _0x5771ce;};}function handleError(_0x3b5613,_0x25fd54){_0x25fd54=_0x25fd54||0x1f4;return function(_0x231bbe){logger['error'](_0x231bbe[_0xad52('0x26')]);if(_0x231bbe[_0xad52('0x27')]){delete _0x231bbe['name'];}_0x3b5613[_0xad52('0x14')](_0x25fd54)[_0xad52('0x28')](_0x231bbe);};}exports[_0xad52('0x29')]=function(_0x75dfb6,_0x32f4fe){var _0x558f90={},_0x5ccd33={},_0x4c389e={'count':0x0,'rows':[]};var _0xc2553d=_[_0xad52('0x2a')](db[_0xad52('0x2b')]['rawAttributes'],function(_0x52e3cc){return{'name':_0x52e3cc[_0xad52('0x2c')],'type':_0x52e3cc[_0xad52('0x2d')][_0xad52('0x2e')]};});_0x5ccd33[_0xad52('0x2f')]=_[_0xad52('0x2a')](_0xc2553d,_0xad52('0x27'));_0x5ccd33['query']=_[_0xad52('0x30')](_0x75dfb6[_0xad52('0x31')]);_0x5ccd33[_0xad52('0x32')]=_[_0xad52('0x33')](_0x5ccd33[_0xad52('0x2f')],_0x5ccd33[_0xad52('0x31')]);_0x558f90[_0xad52('0x34')]=_[_0xad52('0x33')](_0x5ccd33[_0xad52('0x2f')],qs[_0xad52('0x35')](_0x75dfb6[_0xad52('0x31')]['fields']));_0x558f90[_0xad52('0x34')]=_0x558f90[_0xad52('0x34')][_0xad52('0x36')]?_0x558f90[_0xad52('0x34')]:_0x5ccd33[_0xad52('0x2f')];if(!_0x75dfb6[_0xad52('0x31')]['hasOwnProperty'](_0xad52('0x37'))){_0x558f90[_0xad52('0x19')]=qs[_0xad52('0x19')](_0x75dfb6['query'][_0xad52('0x19')]);_0x558f90[_0xad52('0x17')]=qs[_0xad52('0x17')](_0x75dfb6['query'][_0xad52('0x17')]);}_0x558f90[_0xad52('0x38')]=qs[_0xad52('0x39')](_0x75dfb6['query'][_0xad52('0x39')]);_0x558f90[_0xad52('0x3a')]=qs[_0xad52('0x32')](_[_0xad52('0x3b')](_0x75dfb6[_0xad52('0x31')],_0x5ccd33[_0xad52('0x32')]),_0xc2553d);if(_0x75dfb6['query'][_0xad52('0x3c')]){_0x558f90['where']=_[_0xad52('0x3d')](_0x558f90[_0xad52('0x3a')],{'$or':_[_0xad52('0x2a')](_0xc2553d,function(_0xac8fbe){if(_0xac8fbe[_0xad52('0x2d')]!=='VIRTUAL'){var _0x12c7d8={};_0x12c7d8[_0xac8fbe[_0xad52('0x27')]]={'$like':'%'+_0x75dfb6[_0xad52('0x31')]['filter']+'%'};return _0x12c7d8;}})});}_0x558f90=_[_0xad52('0x3d')]({},_0x558f90,_0x75dfb6[_0xad52('0x3e')]);var _0x17ef03={'where':_0x558f90['where']};return db[_0xad52('0x2b')]['count'](_0x17ef03)[_0xad52('0x25')](function(_0x355381){_0x4c389e[_0xad52('0x1a')]=_0x355381;if(_0x75dfb6[_0xad52('0x31')]['includeAll']){_0x558f90[_0xad52('0x3f')]=[{'all':!![]}];}return db[_0xad52('0x2b')][_0xad52('0x40')](_0x558f90);})[_0xad52('0x25')](function(_0x3886ec){_0x4c389e[_0xad52('0x41')]=_0x3886ec;return _0x4c389e;})[_0xad52('0x25')](respondWithFilteredResult(_0x32f4fe,_0x558f90))[_0xad52('0x42')](handleError(_0x32f4fe,null));};exports['show']=function(_0x70e058,_0x52f4a2){var _0x452382={'raw':!![],'where':{'id':_0x70e058[_0xad52('0x43')]['id']}},_0x38c473={};_0x38c473[_0xad52('0x2f')]=_[_0xad52('0x30')](db[_0xad52('0x2b')][_0xad52('0x44')]);_0x38c473[_0xad52('0x31')]=_[_0xad52('0x30')](_0x70e058[_0xad52('0x31')]);_0x38c473[_0xad52('0x32')]=_[_0xad52('0x33')](_0x38c473[_0xad52('0x2f')],_0x38c473[_0xad52('0x31')]);_0x452382[_0xad52('0x34')]=_[_0xad52('0x33')](_0x38c473[_0xad52('0x2f')],qs[_0xad52('0x35')](_0x70e058[_0xad52('0x31')][_0xad52('0x35')]));_0x452382['attributes']=_0x452382[_0xad52('0x34')][_0xad52('0x36')]?_0x452382[_0xad52('0x34')]:_0x38c473['model'];if(_0x70e058[_0xad52('0x31')]['includeAll']){_0x452382[_0xad52('0x3f')]=[{'all':!![]}];}_0x452382=_['merge']({},_0x452382,_0x70e058['options']);return db[_0xad52('0x2b')][_0xad52('0x45')](_0x452382)[_0xad52('0x25')](handleEntityNotFound(_0x52f4a2,null))[_0xad52('0x25')](respondWithResult(_0x52f4a2,null))['catch'](handleError(_0x52f4a2,null));};exports['create']=function(_0x254416,_0x5dede4){return db[_0xad52('0x2b')]['create'](_0x254416[_0xad52('0x46')],{})[_0xad52('0x25')](function(_0x8168f7){var _0x15d989=_0x254416[_0xad52('0x47')][_0xad52('0x22')]({'plain':!![]});if(!_0x15d989)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15d989[_0xad52('0x48')]===_0xad52('0x47')){var _0x44c401=_0x8168f7[_0xad52('0x22')]({'plain':!![]});var _0x4ab950=_0xad52('0x23');return db[_0xad52('0x49')][_0xad52('0x45')]({'where':{'name':_0x4ab950,'userProfileId':_0x15d989['userProfileId']},'raw':!![]})[_0xad52('0x25')](function(_0x354442){if(_0x354442&&_0x354442[_0xad52('0x4a')]===0x0){return db[_0xad52('0x24')]['create']({'name':_0x44c401[_0xad52('0x27')],'resourceId':_0x44c401['id'],'type':_0x354442[_0xad52('0x27')],'sectionId':_0x354442['id']},{})[_0xad52('0x25')](function(){return _0x8168f7;});}else{return _0x8168f7;}})[_0xad52('0x42')](function(_0x197fac){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x197fac);throw _0x197fac;});}return _0x8168f7;})[_0xad52('0x25')](respondWithResult(_0x5dede4,0xc9))[_0xad52('0x42')](handleError(_0x5dede4,null));};exports[_0xad52('0x20')]=function(_0x93114f,_0x2df920){if(_0x93114f['body']['id']){delete _0x93114f[_0xad52('0x46')]['id'];}return db['Tag'][_0xad52('0x45')]({'where':{'id':_0x93114f[_0xad52('0x43')]['id']}})[_0xad52('0x25')](handleEntityNotFound(_0x2df920,null))['then'](saveUpdates(_0x93114f[_0xad52('0x46')],null))['then'](respondWithResult(_0x2df920,null))[_0xad52('0x42')](handleError(_0x2df920,null));};exports[_0xad52('0x21')]=function(_0xc95e44,_0x506889){return db['Tag'][_0xad52('0x45')]({'where':{'id':_0xc95e44['params']['id']}})[_0xad52('0x25')](handleEntityNotFound(_0x506889,null))[_0xad52('0x25')](removeEntity(_0x506889,null))['catch'](handleError(_0x506889,null));}; \ No newline at end of file +var _0xfa2b=['model','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','update','destroy','Tags','UserProfileResource','then','stack','name','index','map','Tag','type','key','query','keys','filters','intersection','attributes'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x4c0e2f,_0x55f3f0){_0x4c0e2f=_0x4c0e2f-0x0;var _0x41e104=_0xfa2b[_0x4c0e2f];return _0x41e104;};'use strict';var emlformat=require(_0xbfa2('0x0'));var rimraf=require(_0xbfa2('0x1'));var zipdir=require(_0xbfa2('0x2'));var jsonpatch=require(_0xbfa2('0x3'));var rp=require(_0xbfa2('0x4'));var moment=require(_0xbfa2('0x5'));var BPromise=require(_0xbfa2('0x6'));var Mustache=require(_0xbfa2('0x7'));var util=require(_0xbfa2('0x8'));var path=require(_0xbfa2('0x9'));var sox=require(_0xbfa2('0xa'));var csv=require(_0xbfa2('0xb'));var ejs=require(_0xbfa2('0xc'));var fs=require('fs');var fs_extra=require(_0xbfa2('0xd'));var _=require(_0xbfa2('0xe'));var squel=require(_0xbfa2('0xf'));var crypto=require('crypto');var jsforce=require(_0xbfa2('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbfa2('0xb'));var querystring=require(_0xbfa2('0x11'));var Papa=require(_0xbfa2('0x12'));var Redis=require(_0xbfa2('0x13'));var authService=require(_0xbfa2('0x14'));var qs=require(_0xbfa2('0x15'));var as=require(_0xbfa2('0x16'));var hardwareService=require(_0xbfa2('0x17'));var logger=require(_0xbfa2('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbfa2('0x19'));var db=require(_0xbfa2('0x1a'))['db'];function respondWithStatusCode(_0x62b1e9,_0x829a72){_0x829a72=_0x829a72||0xcc;return function(_0x137e0d){if(_0x137e0d){return _0x62b1e9[_0xbfa2('0x1b')](_0x829a72);}return _0x62b1e9['status'](_0x829a72)[_0xbfa2('0x1c')]();};}function respondWithResult(_0xaf815f,_0x458653){_0x458653=_0x458653||0xc8;return function(_0x445598){if(_0x445598){return _0xaf815f[_0xbfa2('0x1d')](_0x458653)['json'](_0x445598);}};}function respondWithFilteredResult(_0xa988cc,_0x47db68){return function(_0x5d3aa2){if(_0x5d3aa2){var _0xee34b8=typeof _0x47db68['offset']==='undefined'&&typeof _0x47db68[_0xbfa2('0x1e')]===_0xbfa2('0x1f');var _0x54cdb2=_0x5d3aa2[_0xbfa2('0x20')];var _0x12627a=_0xee34b8?0x0:_0x47db68[_0xbfa2('0x21')];var _0x4088c5=_0xee34b8?_0x5d3aa2[_0xbfa2('0x20')]:_0x47db68[_0xbfa2('0x21')]+_0x47db68[_0xbfa2('0x1e')];var _0x5c3123;if(_0x4088c5>=_0x54cdb2){_0x4088c5=_0x54cdb2;_0x5c3123=0xc8;}else{_0x5c3123=0xce;}_0xa988cc[_0xbfa2('0x1d')](_0x5c3123);return _0xa988cc[_0xbfa2('0x22')](_0xbfa2('0x23'),_0x12627a+'-'+_0x4088c5+'/'+_0x54cdb2)['json'](_0x5d3aa2);}return null;};}function patchUpdates(_0x2ac6c3){return function(_0x3073ae){try{jsonpatch['apply'](_0x3073ae,_0x2ac6c3,!![]);}catch(_0xd5760d){return BPromise['reject'](_0xd5760d);}return _0x3073ae['save']();};}function saveUpdates(_0xc42b51,_0xdb059b){return function(_0x1ec19f){if(_0x1ec19f){return _0x1ec19f[_0xbfa2('0x24')](_0xc42b51)['then'](function(_0x5bb514){return _0x5bb514;});}return null;};}function removeEntity(_0x599df2,_0x13db3e){return function(_0x5e6e80){if(_0x5e6e80){return _0x5e6e80[_0xbfa2('0x25')]()['then'](function(){var _0xeb88ab=_0x5e6e80['get']({'plain':!![]});var _0x289c04=_0xbfa2('0x26');return db[_0xbfa2('0x27')][_0xbfa2('0x25')]({'where':{'type':_0x289c04,'resourceId':_0xeb88ab['id']}})[_0xbfa2('0x28')](function(){return _0x5e6e80;});})['then'](function(){_0x599df2[_0xbfa2('0x1d')](0xcc)[_0xbfa2('0x1c')]();});}};}function handleEntityNotFound(_0x4f782b,_0x37ec27){return function(_0x14f142){if(!_0x14f142){_0x4f782b['sendStatus'](0x194);}return _0x14f142;};}function handleError(_0x2cbc51,_0x5ecd55){_0x5ecd55=_0x5ecd55||0x1f4;return function(_0x16bc84){logger['error'](_0x16bc84[_0xbfa2('0x29')]);if(_0x16bc84[_0xbfa2('0x2a')]){delete _0x16bc84[_0xbfa2('0x2a')];}_0x2cbc51[_0xbfa2('0x1d')](_0x5ecd55)['send'](_0x16bc84);};}exports[_0xbfa2('0x2b')]=function(_0x4aac4e,_0xb95429){var _0x36a30d={},_0x3860b4={},_0x5e3831={'count':0x0,'rows':[]};var _0x1b8fe6=_[_0xbfa2('0x2c')](db[_0xbfa2('0x2d')]['rawAttributes'],function(_0x47fd5a){return{'name':_0x47fd5a['fieldName'],'type':_0x47fd5a[_0xbfa2('0x2e')][_0xbfa2('0x2f')]};});_0x3860b4['model']=_[_0xbfa2('0x2c')](_0x1b8fe6,_0xbfa2('0x2a'));_0x3860b4[_0xbfa2('0x30')]=_[_0xbfa2('0x31')](_0x4aac4e['query']);_0x3860b4[_0xbfa2('0x32')]=_[_0xbfa2('0x33')](_0x3860b4['model'],_0x3860b4[_0xbfa2('0x30')]);_0x36a30d[_0xbfa2('0x34')]=_[_0xbfa2('0x33')](_0x3860b4[_0xbfa2('0x35')],qs[_0xbfa2('0x36')](_0x4aac4e[_0xbfa2('0x30')][_0xbfa2('0x36')]));_0x36a30d[_0xbfa2('0x34')]=_0x36a30d[_0xbfa2('0x34')]['length']?_0x36a30d[_0xbfa2('0x34')]:_0x3860b4['model'];if(!_0x4aac4e[_0xbfa2('0x30')]['hasOwnProperty'](_0xbfa2('0x37'))){_0x36a30d[_0xbfa2('0x1e')]=qs[_0xbfa2('0x1e')](_0x4aac4e[_0xbfa2('0x30')][_0xbfa2('0x1e')]);_0x36a30d['offset']=qs[_0xbfa2('0x21')](_0x4aac4e[_0xbfa2('0x30')][_0xbfa2('0x21')]);}_0x36a30d[_0xbfa2('0x38')]=qs[_0xbfa2('0x39')](_0x4aac4e['query']['sort']);_0x36a30d[_0xbfa2('0x3a')]=qs[_0xbfa2('0x32')](_[_0xbfa2('0x3b')](_0x4aac4e['query'],_0x3860b4['filters']),_0x1b8fe6);if(_0x4aac4e[_0xbfa2('0x30')][_0xbfa2('0x3c')]){_0x36a30d['where']=_['merge'](_0x36a30d[_0xbfa2('0x3a')],{'$or':_[_0xbfa2('0x2c')](_0x1b8fe6,function(_0x5af87e){if(_0x5af87e[_0xbfa2('0x2e')]!==_0xbfa2('0x3d')){var _0x2a541a={};_0x2a541a[_0x5af87e[_0xbfa2('0x2a')]]={'$like':'%'+_0x4aac4e[_0xbfa2('0x30')][_0xbfa2('0x3c')]+'%'};return _0x2a541a;}})});}_0x36a30d=_[_0xbfa2('0x3e')]({},_0x36a30d,_0x4aac4e[_0xbfa2('0x3f')]);var _0xd6752f={'where':_0x36a30d[_0xbfa2('0x3a')]};return db[_0xbfa2('0x2d')][_0xbfa2('0x20')](_0xd6752f)[_0xbfa2('0x28')](function(_0x44a884){_0x5e3831[_0xbfa2('0x20')]=_0x44a884;if(_0x4aac4e[_0xbfa2('0x30')][_0xbfa2('0x40')]){_0x36a30d['include']=[{'all':!![]}];}return db[_0xbfa2('0x2d')][_0xbfa2('0x41')](_0x36a30d);})[_0xbfa2('0x28')](function(_0x35c23a){_0x5e3831[_0xbfa2('0x42')]=_0x35c23a;return _0x5e3831;})[_0xbfa2('0x28')](respondWithFilteredResult(_0xb95429,_0x36a30d))['catch'](handleError(_0xb95429,null));};exports[_0xbfa2('0x43')]=function(_0x49c967,_0x2efbb9){var _0x1d293e={'raw':!![],'where':{'id':_0x49c967[_0xbfa2('0x44')]['id']}},_0x56a917={};_0x56a917[_0xbfa2('0x35')]=_[_0xbfa2('0x31')](db[_0xbfa2('0x2d')][_0xbfa2('0x45')]);_0x56a917['query']=_[_0xbfa2('0x31')](_0x49c967[_0xbfa2('0x30')]);_0x56a917[_0xbfa2('0x32')]=_[_0xbfa2('0x33')](_0x56a917[_0xbfa2('0x35')],_0x56a917[_0xbfa2('0x30')]);_0x1d293e[_0xbfa2('0x34')]=_[_0xbfa2('0x33')](_0x56a917['model'],qs[_0xbfa2('0x36')](_0x49c967[_0xbfa2('0x30')]['fields']));_0x1d293e[_0xbfa2('0x34')]=_0x1d293e[_0xbfa2('0x34')][_0xbfa2('0x46')]?_0x1d293e[_0xbfa2('0x34')]:_0x56a917[_0xbfa2('0x35')];if(_0x49c967[_0xbfa2('0x30')][_0xbfa2('0x40')]){_0x1d293e[_0xbfa2('0x47')]=[{'all':!![]}];}_0x1d293e=_[_0xbfa2('0x3e')]({},_0x1d293e,_0x49c967['options']);return db[_0xbfa2('0x2d')][_0xbfa2('0x48')](_0x1d293e)[_0xbfa2('0x28')](handleEntityNotFound(_0x2efbb9,null))['then'](respondWithResult(_0x2efbb9,null))['catch'](handleError(_0x2efbb9,null));};exports[_0xbfa2('0x49')]=function(_0x51fd07,_0x457a15){return db[_0xbfa2('0x2d')]['create'](_0x51fd07[_0xbfa2('0x4a')],{})[_0xbfa2('0x28')](function(_0x1462f3){var _0x5cd6b7=_0x51fd07[_0xbfa2('0x4b')]['get']({'plain':!![]});if(!_0x5cd6b7)throw new Error(_0xbfa2('0x4c'));if(_0x5cd6b7[_0xbfa2('0x4d')]==='user'){var _0x3f8e7c=_0x1462f3['get']({'plain':!![]});var _0x40eba9='Tags';return db[_0xbfa2('0x4e')][_0xbfa2('0x48')]({'where':{'name':_0x40eba9,'userProfileId':_0x5cd6b7[_0xbfa2('0x4f')]},'raw':!![]})[_0xbfa2('0x28')](function(_0x313da6){if(_0x313da6&&_0x313da6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3f8e7c[_0xbfa2('0x2a')],'resourceId':_0x3f8e7c['id'],'type':_0x313da6[_0xbfa2('0x2a')],'sectionId':_0x313da6['id']},{})[_0xbfa2('0x28')](function(){return _0x1462f3;});}else{return _0x1462f3;}})['catch'](function(_0x32f966){logger[_0xbfa2('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32f966);throw _0x32f966;});}return _0x1462f3;})[_0xbfa2('0x28')](respondWithResult(_0x457a15,0xc9))[_0xbfa2('0x51')](handleError(_0x457a15,null));};exports['update']=function(_0x2f0a8a,_0x326caf){if(_0x2f0a8a['body']['id']){delete _0x2f0a8a['body']['id'];}return db[_0xbfa2('0x2d')]['find']({'where':{'id':_0x2f0a8a[_0xbfa2('0x44')]['id']}})[_0xbfa2('0x28')](handleEntityNotFound(_0x326caf,null))['then'](saveUpdates(_0x2f0a8a[_0xbfa2('0x4a')],null))[_0xbfa2('0x28')](respondWithResult(_0x326caf,null))[_0xbfa2('0x51')](handleError(_0x326caf,null));};exports[_0xbfa2('0x25')]=function(_0x1183fa,_0x28d7c5){return db[_0xbfa2('0x2d')][_0xbfa2('0x48')]({'where':{'id':_0x1183fa[_0xbfa2('0x44')]['id']}})[_0xbfa2('0x28')](handleEntityNotFound(_0x28d7c5,null))[_0xbfa2('0x28')](removeEntity(_0x28d7c5,null))[_0xbfa2('0x51')](handleError(_0x28d7c5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index a834cca..f112ef0 100644 --- a/server/api/tag/tag.model.js +++ b/server/api/tag/tag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe770=['bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','moment'];(function(_0x3cde2e,_0x1d3514){var _0x39cae4=function(_0x405ff2){while(--_0x405ff2){_0x3cde2e['push'](_0x3cde2e['shift']());}};_0x39cae4(++_0x1d3514);}(_0xe770,0x110));var _0x0e77=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe770[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0e77('0x0'));var util=require(_0x0e77('0x1'));var logger=require(_0x0e77('0x2'))('api');var moment=require(_0x0e77('0x3'));var BPromise=require(_0x0e77('0x4'));var rp=require(_0x0e77('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e77('0x6'));var config=require(_0x0e77('0x7'));var attributes=require(_0x0e77('0x8'));module[_0x0e77('0x9')]=function(_0x4893ed,_0x533d14){return _0x4893ed[_0x0e77('0xa')]('Tag',attributes,{'tableName':_0x0e77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5212=['path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird'];(function(_0xda7022,_0x31be5c){var _0x3802ce=function(_0x4e0670){while(--_0x4e0670){_0xda7022['push'](_0xda7022['shift']());}};_0x3802ce(++_0x31be5c);}(_0x5212,0x187));var _0x2521=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x5212[_0x367e5b];return _0x4b909e;};'use strict';var _=require(_0x2521('0x0'));var util=require('util');var logger=require(_0x2521('0x1'))(_0x2521('0x2'));var moment=require(_0x2521('0x3'));var BPromise=require(_0x2521('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2521('0x5'));var rimraf=require(_0x2521('0x6'));var config=require(_0x2521('0x7'));var attributes=require(_0x2521('0x8'));module[_0x2521('0x9')]=function(_0x2639ec,_0x3c8c78){return _0x2639ec['define'](_0x2521('0xa'),attributes,{'tableName':_0x2521('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 46fd280..a284017 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0ba=['rpc','jayson/promise','then','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var moment=require(_0xaf0b('0x2'));var BPromise=require(_0xaf0b('0x3'));var rs=require(_0xaf0b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf0b('0x5'))['db'];var utils=require(_0xaf0b('0x6'));var logger=require('../../config/logger')(_0xaf0b('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf0b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53b32d,_0x1d260e,_0x17b6d5){return new BPromise(function(_0x3439d5,_0xd67a9){return client['request'](_0x53b32d,_0x17b6d5)[_0xaf0b('0x9')](function(_0x4242b1){logger[_0xaf0b('0xa')]('Tag,\x20%s,\x20%s',_0x1d260e,_0xaf0b('0xb'));logger['debug'](_0xaf0b('0xc'),_0x1d260e,_0xaf0b('0xb'),JSON[_0xaf0b('0xd')](_0x4242b1));if(_0x4242b1['error']){if(_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0xf')]===0x1f4){logger[_0xaf0b('0xe')](_0xaf0b('0x10'),_0x1d260e,_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0x11')]);return _0xd67a9(_0x4242b1['error'][_0xaf0b('0x11')]);}logger[_0xaf0b('0xe')](_0xaf0b('0x10'),_0x1d260e,_0x4242b1[_0xaf0b('0xe')]['message']);return _0x3439d5(_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0x11')]);}else{logger[_0xaf0b('0xa')](_0xaf0b('0x10'),_0x1d260e,_0xaf0b('0xb'));_0x3439d5(_0x4242b1[_0xaf0b('0x12')][_0xaf0b('0x11')]);}})[_0xaf0b('0x13')](function(_0x4885da){logger[_0xaf0b('0xe')]('Tag,\x20%s,\x20%s',_0x1d260e,_0x4885da);_0xd67a9(_0x4885da);});});} \ No newline at end of file +var _0x0eaa=['http','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x310223,_0x1fd62d){var _0x4d2dc2=function(_0x1a7263){while(--_0x1a7263){_0x310223['push'](_0x310223['shift']());}};_0x4d2dc2(++_0x1fd62d);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0xe69bf1,_0x487cbc){_0xe69bf1=_0xe69bf1-0x0;var _0x1259d1=_0x0eaa[_0xe69bf1];return _0x1259d1;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0ea('0x2'));var fs=require('fs');var Redis=require(_0xa0ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0ea('0x4'));var logger=require(_0xa0ea('0x5'))(_0xa0ea('0x6'));var config=require(_0xa0ea('0x7'));var jayson=require(_0xa0ea('0x8'));var client=jayson['client'][_0xa0ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521881,_0x4b8856,_0x361178){return new BPromise(function(_0x8632a1,_0x5b2adc){return client['request'](_0x521881,_0x361178)[_0xa0ea('0xa')](function(_0x2746f2){logger[_0xa0ea('0xb')](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));logger['debug'](_0xa0ea('0xe'),_0x4b8856,_0xa0ea('0xd'),JSON[_0xa0ea('0xf')](_0x2746f2));if(_0x2746f2[_0xa0ea('0x10')]){if(_0x2746f2['error'][_0xa0ea('0x11')]===0x1f4){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x5b2adc(_0x2746f2['error'][_0xa0ea('0x12')]);}logger[_0xa0ea('0x10')]('Tag,\x20%s,\x20%s',_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x8632a1(_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);}else{logger['info'](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));_0x8632a1(_0x2746f2[_0xa0ea('0x13')][_0xa0ea('0x12')]);}})[_0xa0ea('0x14')](function(_0x34b94c){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x34b94c);_0x5b2adc(_0x34b94c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index c6095ac..8e51bf5 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index b4eec27..02a772d 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x2448e7,_0x57b541){var _0x4c1a1f=function(_0x4d7806){while(--_0x4d7806){_0x2448e7['push'](_0x2448e7['shift']());}};_0x4c1a1f(++_0x57b541);}(_0x2032,0xd9));var _0x2203=function(_0x38ff71,_0x2b5783){_0x38ff71=_0x38ff71-0x0;var _0x252b9c=_0x2032[_0x38ff71];return _0x252b9c;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 620971b..40cd30a 100644 --- a/server/api/team/team.controller.js +++ b/server/api/team/team.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8be1=['Queues','Unknown\x20channel','add','ids','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','TeamVoiceQueue','penalty','findOrCreate','emit','Queue:save','QueueId','User','online','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','voicePause','all','spread','removeAgents','Sms','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Team','then','includeAll','include','findAll','rows','catch','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','send','getQueues','findOne','channel','ValidationError','capitalize','toLowerCase','Queue','pick'];(function(_0x528374,_0x3ca244){var _0x47a75c=function(_0x6c63ee){while(--_0x6c63ee){_0x528374['push'](_0x528374['shift']());}};_0x47a75c(++_0x3ca244);}(_0x8be1,0x160));var _0x18be=function(_0x43050c,_0xbf537a){_0x43050c=_0x43050c-0x0;var _0x2d4e38=_0x8be1[_0x43050c];return _0x2d4e38;};'use strict';var emlformat=require(_0x18be('0x0'));var rimraf=require(_0x18be('0x1'));var zipdir=require(_0x18be('0x2'));var jsonpatch=require(_0x18be('0x3'));var rp=require(_0x18be('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x18be('0x5'));var util=require(_0x18be('0x6'));var path=require(_0x18be('0x7'));var sox=require(_0x18be('0x8'));var csv=require(_0x18be('0x9'));var ejs=require(_0x18be('0xa'));var fs=require('fs');var fs_extra=require(_0x18be('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x18be('0xc'));var deskjs=require(_0x18be('0xd'));var toCsv=require(_0x18be('0x9'));var querystring=require(_0x18be('0xe'));var Papa=require(_0x18be('0xf'));var Redis=require('ioredis');var authService=require(_0x18be('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x18be('0x11'));var hardwareService=require(_0x18be('0x12'));var logger=require('../../config/logger')(_0x18be('0x13'));var utils=require(_0x18be('0x14'));var config=require(_0x18be('0x15'));var licenseUtil=require(_0x18be('0x16'));var db=require(_0x18be('0x17'))['db'];config[_0x18be('0x18')]=_[_0x18be('0x19')](config['redis'],{'host':_0x18be('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18be('0x18')]));require(_0x18be('0x1b'))[_0x18be('0x1c')](socket);function respondWithStatusCode(_0x52a746,_0x51f6ef){_0x51f6ef=_0x51f6ef||0xcc;return function(_0x1c3226){if(_0x1c3226){return _0x52a746['sendStatus'](_0x51f6ef);}return _0x52a746[_0x18be('0x1d')](_0x51f6ef)[_0x18be('0x1e')]();};}function respondWithResult(_0x44205d,_0x578db6){_0x578db6=_0x578db6||0xc8;return function(_0xcd9fd2){if(_0xcd9fd2){return _0x44205d[_0x18be('0x1d')](_0x578db6)[_0x18be('0x1f')](_0xcd9fd2);}};}function respondWithFilteredResult(_0x3b1322,_0x5f1877){return function(_0x2f9ea9){if(_0x2f9ea9){var _0x1761bd=typeof _0x5f1877[_0x18be('0x20')]===_0x18be('0x21')&&typeof _0x5f1877[_0x18be('0x22')]===_0x18be('0x21');var _0x11ba83=_0x2f9ea9[_0x18be('0x23')];var _0x47926c=_0x1761bd?0x0:_0x5f1877[_0x18be('0x20')];var _0x3c56c8=_0x1761bd?_0x2f9ea9['count']:_0x5f1877[_0x18be('0x20')]+_0x5f1877['limit'];var _0x11e320;if(_0x3c56c8>=_0x11ba83){_0x3c56c8=_0x11ba83;_0x11e320=0xc8;}else{_0x11e320=0xce;}_0x3b1322[_0x18be('0x1d')](_0x11e320);return _0x3b1322['set'](_0x18be('0x24'),_0x47926c+'-'+_0x3c56c8+'/'+_0x11ba83)[_0x18be('0x1f')](_0x2f9ea9);}return null;};}function patchUpdates(_0x459333){return function(_0x149d7c){try{jsonpatch[_0x18be('0x25')](_0x149d7c,_0x459333,!![]);}catch(_0x5dbda7){return BPromise['reject'](_0x5dbda7);}return _0x149d7c[_0x18be('0x26')]();};}function saveUpdates(_0x40b6c8,_0x335e3b){return function(_0x3b6f19){if(_0x3b6f19){return _0x3b6f19[_0x18be('0x27')](_0x40b6c8)['then'](function(_0x415bbc){return _0x415bbc;});}return null;};}function handleEntityNotFound(_0x312057,_0x307a5f){return function(_0x1047e5){if(!_0x1047e5){_0x312057[_0x18be('0x28')](0x194);}return _0x1047e5;};}function handleError(_0x487b07,_0x261cf2){_0x261cf2=_0x261cf2||0x1f4;return function(_0x756519){logger[_0x18be('0x29')](_0x756519[_0x18be('0x2a')]);if(_0x756519[_0x18be('0x2b')]){delete _0x756519[_0x18be('0x2b')];}_0x487b07['status'](_0x261cf2)['send'](_0x756519);};}exports[_0x18be('0x2c')]=function(_0x4c3ee4,_0x3ff37d){var _0x112766={},_0x1c2468={},_0x58a852={'count':0x0,'rows':[]};var _0x20fb59=_[_0x18be('0x2d')](db['Team'][_0x18be('0x2e')],function(_0x3d7fd5){return{'name':_0x3d7fd5[_0x18be('0x2f')],'type':_0x3d7fd5[_0x18be('0x30')][_0x18be('0x31')]};});_0x1c2468['model']=_[_0x18be('0x2d')](_0x20fb59,'name');_0x1c2468[_0x18be('0x32')]=_[_0x18be('0x33')](_0x4c3ee4[_0x18be('0x32')]);_0x1c2468[_0x18be('0x34')]=_[_0x18be('0x35')](_0x1c2468[_0x18be('0x36')],_0x1c2468[_0x18be('0x32')]);_0x112766[_0x18be('0x37')]=_['intersection'](_0x1c2468[_0x18be('0x36')],qs[_0x18be('0x38')](_0x4c3ee4[_0x18be('0x32')][_0x18be('0x38')]));_0x112766[_0x18be('0x37')]=_0x112766['attributes'][_0x18be('0x39')]?_0x112766['attributes']:_0x1c2468['model'];if(!_0x4c3ee4[_0x18be('0x32')][_0x18be('0x3a')](_0x18be('0x3b'))){_0x112766[_0x18be('0x22')]=qs[_0x18be('0x22')](_0x4c3ee4[_0x18be('0x32')][_0x18be('0x22')]);_0x112766[_0x18be('0x20')]=qs[_0x18be('0x20')](_0x4c3ee4[_0x18be('0x32')][_0x18be('0x20')]);}_0x112766[_0x18be('0x3c')]=qs[_0x18be('0x3d')](_0x4c3ee4[_0x18be('0x32')][_0x18be('0x3d')]);_0x112766[_0x18be('0x3e')]=qs[_0x18be('0x34')](_['pick'](_0x4c3ee4[_0x18be('0x32')],_0x1c2468['filters']),_0x20fb59);if(_0x4c3ee4['query']['filter']){_0x112766[_0x18be('0x3e')]=_[_0x18be('0x3f')](_0x112766[_0x18be('0x3e')],{'$or':_[_0x18be('0x2d')](_0x20fb59,function(_0x2135ef){if(_0x2135ef[_0x18be('0x30')]!==_0x18be('0x40')){var _0x25aa0c={};_0x25aa0c[_0x2135ef[_0x18be('0x2b')]]={'$like':'%'+_0x4c3ee4[_0x18be('0x32')][_0x18be('0x41')]+'%'};return _0x25aa0c;}})});}_0x112766=_[_0x18be('0x3f')]({},_0x112766,_0x4c3ee4[_0x18be('0x42')]);var _0x22a715={'where':_0x112766[_0x18be('0x3e')]};return db[_0x18be('0x43')]['count'](_0x22a715)[_0x18be('0x44')](function(_0x3150b3){_0x58a852['count']=_0x3150b3;if(_0x4c3ee4[_0x18be('0x32')][_0x18be('0x45')]){_0x112766[_0x18be('0x46')]=[{'all':!![]}];}return db[_0x18be('0x43')][_0x18be('0x47')](_0x112766);})[_0x18be('0x44')](function(_0x5063c2){_0x58a852[_0x18be('0x48')]=_0x5063c2;return _0x58a852;})[_0x18be('0x44')](respondWithFilteredResult(_0x3ff37d,_0x112766))[_0x18be('0x49')](handleError(_0x3ff37d,null));};exports['show']=function(_0x287e9e,_0x356862){var _0x150cfb={'raw':![],'where':{'id':_0x287e9e['params']['id']}},_0x200f0f={};_0x200f0f[_0x18be('0x36')]=_['keys'](db['Team'][_0x18be('0x2e')]);_0x200f0f[_0x18be('0x32')]=_[_0x18be('0x33')](_0x287e9e[_0x18be('0x32')]);_0x200f0f[_0x18be('0x34')]=_[_0x18be('0x35')](_0x200f0f[_0x18be('0x36')],_0x200f0f[_0x18be('0x32')]);_0x150cfb[_0x18be('0x37')]=_['intersection'](_0x200f0f[_0x18be('0x36')],qs[_0x18be('0x38')](_0x287e9e[_0x18be('0x32')][_0x18be('0x38')]));_0x150cfb[_0x18be('0x37')]=_0x150cfb[_0x18be('0x37')]['length']?_0x150cfb[_0x18be('0x37')]:_0x200f0f[_0x18be('0x36')];if(_0x287e9e[_0x18be('0x32')][_0x18be('0x45')]){_0x150cfb[_0x18be('0x46')]=[{'all':!![]}];}_0x150cfb=_[_0x18be('0x3f')]({},_0x150cfb,_0x287e9e[_0x18be('0x42')]);return db[_0x18be('0x43')][_0x18be('0x4a')](_0x150cfb)['then'](handleEntityNotFound(_0x356862,null))[_0x18be('0x44')](respondWithResult(_0x356862,null))['catch'](handleError(_0x356862,null));};exports['create']=function(_0x4bdc7a,_0x45c9b7){return db['Team'][_0x18be('0x4b')](_0x4bdc7a[_0x18be('0x4c')],{})[_0x18be('0x44')](function(_0x28fb5f){var _0x92d61d=_0x4bdc7a['user'][_0x18be('0x4d')]({'plain':!![]});if(!_0x92d61d)throw new Error(_0x18be('0x4e'));if(_0x92d61d[_0x18be('0x4f')]===_0x18be('0x50')){var _0x2a2df9=_0x28fb5f[_0x18be('0x4d')]({'plain':!![]});var _0x47aba6='Teams';return db[_0x18be('0x51')][_0x18be('0x4a')]({'where':{'name':_0x47aba6,'userProfileId':_0x92d61d[_0x18be('0x52')]},'raw':!![]})[_0x18be('0x44')](function(_0x51b2fb){if(_0x51b2fb&&_0x51b2fb[_0x18be('0x53')]===0x0){return db[_0x18be('0x54')]['create']({'name':_0x2a2df9[_0x18be('0x2b')],'resourceId':_0x2a2df9['id'],'type':_0x51b2fb['name'],'sectionId':_0x51b2fb['id']},{})[_0x18be('0x44')](function(){return _0x28fb5f;});}else{return _0x28fb5f;}})[_0x18be('0x49')](function(_0x5b9efd){logger[_0x18be('0x29')](_0x18be('0x55'),_0x5b9efd);throw _0x5b9efd;});}return _0x28fb5f;})[_0x18be('0x44')](respondWithResult(_0x45c9b7,0xc9))[_0x18be('0x49')](handleError(_0x45c9b7,null));};exports[_0x18be('0x27')]=function(_0x32c8b2,_0x43f301){if(_0x32c8b2[_0x18be('0x4c')]['id']){delete _0x32c8b2[_0x18be('0x4c')]['id'];}return db[_0x18be('0x43')][_0x18be('0x4a')]({'where':{'id':_0x32c8b2[_0x18be('0x56')]['id']}})[_0x18be('0x44')](handleEntityNotFound(_0x43f301,null))[_0x18be('0x44')](saveUpdates(_0x32c8b2[_0x18be('0x4c')],null))[_0x18be('0x44')](respondWithResult(_0x43f301,null))[_0x18be('0x49')](handleError(_0x43f301,null));};exports[_0x18be('0x57')]=function(_0x196542,_0x22500e){var _0x1b990e=_0x196542[_0x18be('0x56')]['id'];var _0x29b3e5=[];return db[_0x18be('0x58')][_0x18be('0x59')](function(_0x46ec14){var _0x8b5c29=_0x18be('0x5a')+_0x1b990e;return db[_0x18be('0x58')][_0x18be('0x32')](_0x8b5c29,{'type':db[_0x18be('0x5b')][_0x18be('0x5c')][_0x18be('0x5d')],'raw':!![],'transaction':_0x46ec14})['then'](function(_0x173ca7){_0x29b3e5=_[_0x18be('0x2d')](_0x173ca7,function(_0x482edc){return Number(_0x482edc[_0x18be('0x5e')]);});})['then'](function(){var _0x181c17=_0x18be('0x5f')+_0x1b990e;return db[_0x18be('0x58')][_0x18be('0x32')](_0x181c17,{'type':db['Sequelize'][_0x18be('0x5c')][_0x18be('0x5d')],'raw':!![],'transaction':_0x46ec14});})[_0x18be('0x44')](function(_0xae0f53){var _0x3952f3=_[_0x18be('0x2d')](_0xae0f53,function(_0x23ae7e){return Number(_0x23ae7e['VoiceQueueId']);});return db[_0x18be('0x60')][_0x18be('0x57')]({'where':{'UserId':{'$in':_0x29b3e5},'VoiceQueueId':{'$in':_0x3952f3}},'transaction':_0x46ec14});})['then'](function(){var _0x24f7a8=_0x18be('0x61')+_0x1b990e;return db[_0x18be('0x58')]['query'](_0x24f7a8,{'type':db['Sequelize'][_0x18be('0x5c')]['SELECT'],'raw':!![],'transaction':_0x46ec14});})[_0x18be('0x44')](function(_0x562d4d){var _0x40ad34=_[_0x18be('0x2d')](_0x562d4d,function(_0x2740f3){return Number(_0x2740f3[_0x18be('0x62')]);});return db['UserMailQueue'][_0x18be('0x57')]({'where':{'UserId':{'$in':_0x29b3e5},'MailQueueId':{'$in':_0x40ad34}},'transaction':_0x46ec14});})[_0x18be('0x44')](function(){var _0x35db98=_0x18be('0x63')+_0x1b990e;return db[_0x18be('0x58')][_0x18be('0x32')](_0x35db98,{'type':db['Sequelize'][_0x18be('0x5c')][_0x18be('0x5d')],'raw':!![],'transaction':_0x46ec14});})[_0x18be('0x44')](function(_0x593c50){var _0x30e491=_[_0x18be('0x2d')](_0x593c50,function(_0x3d9e05){return Number(_0x3d9e05[_0x18be('0x64')]);});return db[_0x18be('0x65')][_0x18be('0x57')]({'where':{'UserId':{'$in':_0x29b3e5},'SmsQueueId':{'$in':_0x30e491}},'transaction':_0x46ec14});})['then'](function(){var _0x26a8f9=_0x18be('0x66')+_0x1b990e;return db[_0x18be('0x58')][_0x18be('0x32')](_0x26a8f9,{'type':db[_0x18be('0x5b')][_0x18be('0x5c')][_0x18be('0x5d')],'raw':!![],'transaction':_0x46ec14});})[_0x18be('0x44')](function(_0x558d91){var _0x18848d=_[_0x18be('0x2d')](_0x558d91,function(_0x33bd6e){return Number(_0x33bd6e[_0x18be('0x67')]);});return db[_0x18be('0x68')][_0x18be('0x57')]({'where':{'UserId':{'$in':_0x29b3e5},'ChatQueueId':{'$in':_0x18848d}},'transaction':_0x46ec14});})[_0x18be('0x44')](function(){var _0x5ef117=_0x18be('0x69')+_0x1b990e;return db['sequelize'][_0x18be('0x32')](_0x5ef117,{'type':db[_0x18be('0x5b')][_0x18be('0x5c')][_0x18be('0x5d')],'raw':!![],'transaction':_0x46ec14});})[_0x18be('0x44')](function(_0x551614){var _0x1aa663=_[_0x18be('0x2d')](_0x551614,function(_0x34362c){return Number(_0x34362c[_0x18be('0x6a')]);});return db[_0x18be('0x6b')][_0x18be('0x57')]({'where':{'UserId':{'$in':_0x29b3e5},'FaxQueueId':{'$in':_0x1aa663}},'transaction':_0x46ec14});})[_0x18be('0x44')](function(){var _0x8f45a0=_0x18be('0x6c')+_0x1b990e;return db[_0x18be('0x58')][_0x18be('0x32')](_0x8f45a0,{'type':db[_0x18be('0x5b')][_0x18be('0x5c')][_0x18be('0x5d')],'raw':!![],'transaction':_0x46ec14});})[_0x18be('0x44')](function(_0x5324f9){var _0x4611e3=_[_0x18be('0x2d')](_0x5324f9,function(_0x5eb775){return Number(_0x5eb775['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x18be('0x57')]({'where':{'UserId':{'$in':_0x29b3e5},'OpenchannelQueueId':{'$in':_0x4611e3}},'transaction':_0x46ec14});})[_0x18be('0x44')](function(){var _0x4a1032=_0x18be('0x6d')+_0x1b990e;return db[_0x18be('0x58')][_0x18be('0x32')](_0x4a1032,{'type':db[_0x18be('0x5b')][_0x18be('0x5c')][_0x18be('0x5d')],'raw':!![],'transaction':_0x46ec14});})[_0x18be('0x44')](function(_0x48a736){var _0x3efe57=_[_0x18be('0x2d')](_0x48a736,function(_0xa9725c){return Number(_0xa9725c[_0x18be('0x6e')]);});return db[_0x18be('0x6f')][_0x18be('0x57')]({'where':{'UserId':{'$in':_0x29b3e5},'WhatsappQueueId':{'$in':_0x3efe57}},'transaction':_0x46ec14});})[_0x18be('0x44')](function(){return db[_0x18be('0x70')][_0x18be('0x4a')]({'where':{'TeamId':_0x1b990e}});})[_0x18be('0x44')](function(_0xafa159){if(_0xafa159===null){return;}return db[_0x18be('0x71')][_0x18be('0x57')]({'where':{'UserId':{'$in':_0x29b3e5},'VoicePrefixId':_0xafa159[_0x18be('0x72')]},'transaction':_0x46ec14});})[_0x18be('0x44')](function(){return db['Team'][_0x18be('0x57')]({'where':{'id':_0x1b990e},'cascade':!![],'transaction':_0x46ec14});})[_0x18be('0x44')](function(_0xcee716){if(_0xcee716===0x0){_0x22500e[_0x18be('0x28')](0x194);}else{return db[_0x18be('0x54')]['destroy']({'where':{'type':_0x18be('0x73'),'resourceId':_0x1b990e},'cascade':!![],'transaction':_0x46ec14})[_0x18be('0x44')](function(){_0x22500e['status'](0xcc)[_0x18be('0x1e')]();});}})[_0x18be('0x49')](function(_0x1d5c78){_0x22500e[_0x18be('0x1d')](0x1f4)[_0x18be('0x74')](_0x1d5c78);});});};exports[_0x18be('0x75')]=function(_0x33c6dc,_0x247cc5,_0x57e08e){return db['Team'][_0x18be('0x76')]({'where':{'id':_0x33c6dc[_0x18be('0x56')]['id']}})[_0x18be('0x44')](handleEntityNotFound(_0x247cc5,null))['then'](function(_0x86fee3){if(!_0x33c6dc[_0x18be('0x32')][_0x18be('0x77')]||!utils['isValidChannel'](_0x33c6dc[_0x18be('0x32')][_0x18be('0x77')])){throw new db[(_0x18be('0x5b'))][(_0x18be('0x78'))]('Unknown\x20channel');}var _0x30feb4={};var _0x52c923={};_0x52c923[_0x18be('0x36')]=_[_0x18be('0x33')](db[_[_0x18be('0x79')](_0x33c6dc[_0x18be('0x32')]['channel'][_0x18be('0x7a')]())+_0x18be('0x7b')]['rawAttributes']);_0x52c923['query']=_[_0x18be('0x33')](_0x33c6dc['query']);_0x52c923[_0x18be('0x34')]=_[_0x18be('0x35')](_0x52c923['model'],_0x52c923['query']);_0x30feb4[_0x18be('0x37')]=_[_0x18be('0x35')](_0x52c923[_0x18be('0x36')],qs[_0x18be('0x38')](_0x33c6dc[_0x18be('0x32')]['fields']));_0x30feb4[_0x18be('0x37')]=_0x30feb4[_0x18be('0x37')][_0x18be('0x39')]?_0x30feb4['attributes']:_0x52c923[_0x18be('0x36')];_0x30feb4[_0x18be('0x22')]=qs[_0x18be('0x22')](_0x33c6dc[_0x18be('0x32')][_0x18be('0x22')]);_0x30feb4[_0x18be('0x20')]=qs[_0x18be('0x20')](_0x33c6dc[_0x18be('0x32')][_0x18be('0x20')]);_0x30feb4[_0x18be('0x3c')]=qs[_0x18be('0x3d')](_0x33c6dc[_0x18be('0x32')][_0x18be('0x3d')]);_0x30feb4[_0x18be('0x3e')]=qs[_0x18be('0x34')](_[_0x18be('0x7c')](_0x33c6dc['query'],_0x52c923[_0x18be('0x34')]));_0x30feb4=_[_0x18be('0x3f')]({},_0x30feb4,_0x33c6dc[_0x18be('0x42')]);return _0x86fee3['get'+_['capitalize'](_0x33c6dc['query'][_0x18be('0x77')][_0x18be('0x7a')]())+_0x18be('0x7d')](_0x30feb4);})['then'](respondWithResult(_0x247cc5,null))[_0x18be('0x49')](handleError(_0x247cc5,null));};exports['addQueues']=function(_0x2170cd,_0x708ab9,_0x44c74f){return db[_0x18be('0x43')]['findOne']({'where':{'id':_0x2170cd[_0x18be('0x56')]['id']}})['then'](function(_0x492889){if(_0x492889){if(!_0x2170cd[_0x18be('0x4c')][_0x18be('0x77')]||!utils['isValidChannel'](_0x2170cd['body'][_0x18be('0x77')])){throw new db['Sequelize']['ValidationError'](_0x18be('0x7e'));}return _0x492889[_0x18be('0x7f')+_[_0x18be('0x79')](_0x2170cd['body']['channel'][_0x18be('0x7a')]())+_0x18be('0x7d')](_0x2170cd[_0x18be('0x4c')][_0x18be('0x80')]);}return null;})[_0x18be('0x44')](handleEntityNotFound(_0x708ab9,null))[_0x18be('0x44')](respondWithStatusCode(_0x708ab9,null))['catch'](handleError(_0x708ab9,null));};exports['removeQueues']=function(_0x3bd459,_0x470a10,_0x1c9b67){return db[_0x18be('0x43')]['findOne']({'where':{'id':_0x3bd459[_0x18be('0x56')]['id']}})[_0x18be('0x44')](function(_0x22c2e9){if(_0x22c2e9){if(!_0x3bd459[_0x18be('0x32')][_0x18be('0x77')]||!utils['isValidChannel'](_0x3bd459[_0x18be('0x32')][_0x18be('0x77')])){throw new db[(_0x18be('0x5b'))]['ValidationError'](_0x18be('0x7e'));}return _0x22c2e9['remove'+_[_0x18be('0x79')](_0x3bd459[_0x18be('0x32')][_0x18be('0x77')][_0x18be('0x7a')]())+'Queues'](_0x3bd459[_0x18be('0x32')][_0x18be('0x80')]);}return null;})[_0x18be('0x44')](handleEntityNotFound(_0x470a10,null))[_0x18be('0x44')](respondWithStatusCode(_0x470a10,null))['catch'](handleError(_0x470a10,null));};exports[_0x18be('0x81')]=function(_0x476342,_0x517300){var _0x747195=_[_0x18be('0x82')](_0x476342[_0x18be('0x4c')]['ids'])?_0x476342[_0x18be('0x4c')][_0x18be('0x80')]:[_0x476342['body'][_0x18be('0x80')]];var _0x347010=_0x476342[_0x18be('0x56')]['id'];return db[_0x18be('0x43')][_0x18be('0x4a')]({'where':{'id':_0x347010}})[_0x18be('0x44')](handleEntityNotFound(_0x517300,null))[_0x18be('0x44')](function(_0x5dd858){if(_0x5dd858){var _0x4cb643=[_0x18be('0x83'),_0x18be('0x84'),_0x18be('0x85'),'Sms',_0x18be('0x86'),_0x18be('0x87'),_0x18be('0x88')];return db[_0x18be('0x58')][_0x18be('0x59')](function(_0xa6105b){var _0x23f6da=_[_0x18be('0x2d')](_0x4cb643,function(_0x137ee6){var _0x336464={'attributes':['id',_0x18be('0x2b')]};if(_0x137ee6===_0x18be('0x83')){_0x336464[_0x18be('0x89')]={'attributes':['penalty']};}return _0x5dd858[_0x18be('0x4d')+_0x137ee6+_0x18be('0x7d')](_0x336464)[_0x18be('0x44')](function(_0x67956c){var _0x1a71b3=_[_0x18be('0x2d')](_0x67956c,function(_0x21e0e8){var _0x232dea=_['map'](_0x747195,function(_0x3c9a69){var _0x50d7f2={'where':{'UserId':_0x3c9a69,[_0x137ee6+'QueueId']:_0x21e0e8['id']},'transaction':_0xa6105b};if(_0x137ee6===_0x18be('0x83')){_0x50d7f2[_0x18be('0x19')]={'penalty':_0x21e0e8[_0x18be('0x8a')][_0x18be('0x8b')]};}return db['User'+_0x137ee6+_0x18be('0x7b')][_0x18be('0x8c')](_0x50d7f2)[_0x18be('0x44')](function(){socket[_0x18be('0x8d')]('user'+_0x137ee6+_0x18be('0x8e'),{'UserId':_0x3c9a69,[_0x137ee6+_0x18be('0x8f')]:_0x21e0e8['id']});if(_0x137ee6!==_0x18be('0x83')){return;}return db[_0x18be('0x90')][_0x18be('0x47')]({'where':{'id':_0x747195,'online':0x1},'attributes':['id',_0x18be('0x2b'),_0x18be('0x91'),'voicePause','interface'],'raw':!![]})[_0x18be('0x44')](function(_0x18253f){var _0x5cdffd=_['map'](_0x18253f,function(_0x314c12){return db[_0x18be('0x92')][_0x18be('0x93')]({'membername':_0x314c12[_0x18be('0x2b')],'UserId':_0x314c12['id'],'queue_name':_0x21e0e8['name'],'VoiceQueueId':_0x21e0e8['id'],'interface':_[_0x18be('0x94')](_0x314c12[_0x18be('0x95')])?util[_0x18be('0x96')](_0x18be('0x97'),_0x314c12['name']):_0x314c12[_0x18be('0x95')],'paused':_0x314c12[_0x18be('0x98')]||![],'penalty':_0x21e0e8[_0x18be('0x8a')][_0x18be('0x8b')]},{'transaction':_0xa6105b});});return Promise[_0x18be('0x99')](_0x5cdffd);});});});return Promise[_0x18be('0x99')](_0x232dea);});return Promise[_0x18be('0x99')](_0x1a71b3);})[_0x18be('0x44')](function(){return db[_0x18be('0x70')]['findOne']({'where':{'teamId':_0x347010}})['then'](function(_0xf62df2){if(_0xf62df2){var _0x271090=_[_0x18be('0x2d')](_0x747195,function(_0x5167a6){db[_0x18be('0x71')]['upsert']({'UserId':_0x5167a6,'VoicePrefixId':_0xf62df2['VoicePrefixId']});});return Promise[_0x18be('0x99')](_0x271090);}});});});return Promise[_0x18be('0x99')](_0x23f6da)[_0x18be('0x44')](function(){return _0x5dd858[_0x18be('0x81')](_0x747195,{'transaction':_0xa6105b})[_0x18be('0x9a')](function(_0x3664d4){return _0x3664d4;});});});}})[_0x18be('0x44')](respondWithResult(_0x517300,null))[_0x18be('0x49')](handleError(_0x517300,null));};exports[_0x18be('0x9b')]=function(_0x3dcf96,_0x1b1da7){var _0x306fd5=_['isArray'](_0x3dcf96[_0x18be('0x32')][_0x18be('0x80')])?_0x3dcf96[_0x18be('0x32')][_0x18be('0x80')]:[_0x3dcf96['query'][_0x18be('0x80')]];var _0x29210b=_0x3dcf96[_0x18be('0x56')]['id'];return db['Team'][_0x18be('0x4a')]({'where':{'id':_0x29210b}})[_0x18be('0x44')](handleEntityNotFound(_0x1b1da7,null))[_0x18be('0x44')](function(_0x5c0fa1){if(_0x5c0fa1){var _0x26a19a=['Voice','Chat',_0x18be('0x85'),_0x18be('0x9c'),_0x18be('0x86'),'Openchannel',_0x18be('0x88')];return db[_0x18be('0x58')][_0x18be('0x59')](function(_0x18fffd){var _0x17faaf=_['map'](_0x26a19a,function(_0x4ebb3c){var _0x4280a5={'attributes':['id',_0x18be('0x2b')]};return _0x5c0fa1[_0x18be('0x4d')+_0x4ebb3c+_0x18be('0x7d')](_0x4280a5)[_0x18be('0x44')](function(_0x17b687){var _0x267746=_[_0x18be('0x2d')](_0x17b687,function(_0x54710d){return _0x54710d[_0x18be('0x9b')](_0x306fd5,{'transaction':_0x18fffd})[_0x18be('0x44')](function(){var _0x29cfc7=_[_0x18be('0x2d')](_0x306fd5,function(_0x883c){socket[_0x18be('0x8d')](_0x18be('0x50')+_0x4ebb3c+_0x18be('0x9d'),{'UserId':Number(_0x883c),[_0x4ebb3c+'QueueId']:_0x54710d['id']});if(_0x4ebb3c!=='Voice'){return;}return db[_0x18be('0x92')]['destroy']({'where':{'VoiceQueueId':_0x54710d['id'],'UserId':_0x883c},'transaction':_0x18fffd});});return Promise[_0x18be('0x99')](_0x29cfc7);});});return Promise[_0x18be('0x99')](_0x267746);});});return Promise['all'](_0x17faaf)['then'](function(){return _0x5c0fa1[_0x18be('0x9b')](_0x306fd5,{'transaction':_0x18fffd});})[_0x18be('0x44')](function(){return db[_0x18be('0x70')]['findOne']({'where':{'teamId':_0x29210b}})[_0x18be('0x44')](function(_0x279184){if(_0x279184){var _0x13f098=_[_0x18be('0x2d')](_0x306fd5,function(_0x306642){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x306642,'VoicePrefixId':_0x279184[_0x18be('0x72')]}});});return Promise[_0x18be('0x99')](_0x13f098);}});});});}})[_0x18be('0x44')](respondWithStatusCode(_0x1b1da7,null))[_0x18be('0x49')](handleError(_0x1b1da7,null));};exports[_0x18be('0x9e')]=function(_0x388a2f,_0x2cee2a,_0x18627e){var _0x498ecf={};var _0xf1490d={};var _0x51472b;var _0x46f801;return db[_0x18be('0x43')][_0x18be('0x76')]({'where':{'id':_0x388a2f[_0x18be('0x56')]['id']}})[_0x18be('0x44')](handleEntityNotFound(_0x2cee2a,null))['then'](function(_0x4c920c){if(_0x4c920c){_0x51472b=_0x4c920c;_0xf1490d[_0x18be('0x36')]=_['keys'](db[_0x18be('0x90')][_0x18be('0x2e')]);_0xf1490d[_0x18be('0x32')]=_['keys'](_0x388a2f[_0x18be('0x32')]);_0xf1490d[_0x18be('0x34')]=_[_0x18be('0x35')](_0xf1490d[_0x18be('0x36')],_0xf1490d[_0x18be('0x32')]);_0x498ecf['attributes']=_[_0x18be('0x35')](_0xf1490d[_0x18be('0x36')],qs['fields'](_0x388a2f['query'][_0x18be('0x38')]));_0x498ecf[_0x18be('0x37')]=_0x498ecf[_0x18be('0x37')]['length']?_0x498ecf[_0x18be('0x37')]:_0xf1490d[_0x18be('0x36')];_0x498ecf[_0x18be('0x3c')]=qs['sort'](_0x388a2f[_0x18be('0x32')][_0x18be('0x3d')]);_0x498ecf[_0x18be('0x3e')]=qs[_0x18be('0x34')](_['pick'](_0x388a2f[_0x18be('0x32')],_0xf1490d['filters']));if(_0x388a2f[_0x18be('0x32')][_0x18be('0x41')]){_0x498ecf[_0x18be('0x3e')]=_[_0x18be('0x3f')](_0x498ecf[_0x18be('0x3e')],{'$or':_[_0x18be('0x2d')](_0x498ecf[_0x18be('0x37')],function(_0x406b99){var _0x366b9e={};_0x366b9e[_0x406b99]={'$like':'%'+_0x388a2f['query']['filter']+'%'};return _0x366b9e;})});}_0x498ecf=_['merge']({},_0x498ecf,_0x388a2f['options']);return _0x51472b[_0x18be('0x9e')](_0x498ecf);}})[_0x18be('0x44')](function(_0x14a8e1){if(_0x14a8e1){_0x46f801=_0x14a8e1['length'];if(!_0x388a2f[_0x18be('0x32')][_0x18be('0x3a')](_0x18be('0x3b'))){_0x498ecf[_0x18be('0x22')]=qs[_0x18be('0x22')](_0x388a2f['query'][_0x18be('0x22')]);_0x498ecf[_0x18be('0x20')]=qs[_0x18be('0x20')](_0x388a2f[_0x18be('0x32')][_0x18be('0x20')]);}return _0x51472b[_0x18be('0x9e')](_0x498ecf);}})['then'](function(_0x334fe1){if(_0x334fe1){return _0x334fe1?{'count':_0x46f801,'rows':_0x334fe1}:null;}})[_0x18be('0x44')](respondWithResult(_0x2cee2a,null))['catch'](handleError(_0x2cee2a,null));}; \ No newline at end of file +var _0x8f64=['../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','Teams','channel','isValidChannel','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','findOne','ValidationError','ids','removeQueues','remove','addAgents','isArray','Chat','Mail','Sms','Openchannel','Whatsapp','Voice','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','spread','removeAgents','Fax','Queue:remove','getAgents','eml-format','rimraf','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x5272b2,_0x59f060){var _0x2ca6c5=function(_0x53aebe){while(--_0x53aebe){_0x5272b2['push'](_0x5272b2['shift']());}};_0x2ca6c5(++_0x59f060);}(_0x8f64,0x1be));var _0x48f6=function(_0x44024c,_0x2b02f4){_0x44024c=_0x44024c-0x0;var _0x46d869=_0x8f64[_0x44024c];return _0x46d869;};'use strict';var emlformat=require(_0x48f6('0x0'));var rimraf=require(_0x48f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48f6('0x2'));var BPromise=require(_0x48f6('0x3'));var Mustache=require(_0x48f6('0x4'));var util=require(_0x48f6('0x5'));var path=require('path');var sox=require(_0x48f6('0x6'));var csv=require('to-csv');var ejs=require(_0x48f6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48f6('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x48f6('0x9'));var deskjs=require(_0x48f6('0xa'));var toCsv=require(_0x48f6('0xb'));var querystring=require(_0x48f6('0xc'));var Papa=require(_0x48f6('0xd'));var Redis=require(_0x48f6('0xe'));var authService=require(_0x48f6('0xf'));var qs=require(_0x48f6('0x10'));var as=require(_0x48f6('0x11'));var hardwareService=require(_0x48f6('0x12'));var logger=require(_0x48f6('0x13'))('api');var utils=require(_0x48f6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x48f6('0x15'));var db=require(_0x48f6('0x16'))['db'];config['redis']=_['defaults'](config[_0x48f6('0x17')],{'host':_0x48f6('0x18'),'port':0x18eb});var socket=require(_0x48f6('0x19'))(new Redis(config[_0x48f6('0x17')]));require(_0x48f6('0x1a'))['register'](socket);function respondWithStatusCode(_0x3ff587,_0x184564){_0x184564=_0x184564||0xcc;return function(_0x65a60d){if(_0x65a60d){return _0x3ff587[_0x48f6('0x1b')](_0x184564);}return _0x3ff587[_0x48f6('0x1c')](_0x184564)[_0x48f6('0x1d')]();};}function respondWithResult(_0x3abf5f,_0x1fcef2){_0x1fcef2=_0x1fcef2||0xc8;return function(_0x434f68){if(_0x434f68){return _0x3abf5f['status'](_0x1fcef2)['json'](_0x434f68);}};}function respondWithFilteredResult(_0xeaa733,_0x4052f5){return function(_0x442fd6){if(_0x442fd6){var _0x45aa3d=typeof _0x4052f5[_0x48f6('0x1e')]==='undefined'&&typeof _0x4052f5[_0x48f6('0x1f')]===_0x48f6('0x20');var _0x86cd03=_0x442fd6[_0x48f6('0x21')];var _0x1668ec=_0x45aa3d?0x0:_0x4052f5[_0x48f6('0x1e')];var _0x5e518f=_0x45aa3d?_0x442fd6['count']:_0x4052f5['offset']+_0x4052f5[_0x48f6('0x1f')];var _0x30c044;if(_0x5e518f>=_0x86cd03){_0x5e518f=_0x86cd03;_0x30c044=0xc8;}else{_0x30c044=0xce;}_0xeaa733['status'](_0x30c044);return _0xeaa733[_0x48f6('0x22')](_0x48f6('0x23'),_0x1668ec+'-'+_0x5e518f+'/'+_0x86cd03)[_0x48f6('0x24')](_0x442fd6);}return null;};}function patchUpdates(_0x554614){return function(_0x470c50){try{jsonpatch[_0x48f6('0x25')](_0x470c50,_0x554614,!![]);}catch(_0x30ba85){return BPromise[_0x48f6('0x26')](_0x30ba85);}return _0x470c50[_0x48f6('0x27')]();};}function saveUpdates(_0x5cc4da,_0x2d51fa){return function(_0xb8004c){if(_0xb8004c){return _0xb8004c[_0x48f6('0x28')](_0x5cc4da)[_0x48f6('0x29')](function(_0x4439da){return _0x4439da;});}return null;};}function handleEntityNotFound(_0x1f60d8,_0x30d425){return function(_0x5bef22){if(!_0x5bef22){_0x1f60d8[_0x48f6('0x1b')](0x194);}return _0x5bef22;};}function handleError(_0x4db584,_0x538807){_0x538807=_0x538807||0x1f4;return function(_0x35fb47){logger[_0x48f6('0x2a')](_0x35fb47[_0x48f6('0x2b')]);if(_0x35fb47[_0x48f6('0x2c')]){delete _0x35fb47[_0x48f6('0x2c')];}_0x4db584[_0x48f6('0x1c')](_0x538807)[_0x48f6('0x2d')](_0x35fb47);};}exports[_0x48f6('0x2e')]=function(_0x87ac6d,_0x38f8ba){var _0x30454c={},_0x168a2a={},_0x287571={'count':0x0,'rows':[]};var _0x4d8336=_[_0x48f6('0x2f')](db[_0x48f6('0x30')][_0x48f6('0x31')],function(_0xa2a37c){return{'name':_0xa2a37c[_0x48f6('0x32')],'type':_0xa2a37c[_0x48f6('0x33')]['key']};});_0x168a2a[_0x48f6('0x34')]=_[_0x48f6('0x2f')](_0x4d8336,_0x48f6('0x2c'));_0x168a2a[_0x48f6('0x35')]=_['keys'](_0x87ac6d[_0x48f6('0x35')]);_0x168a2a[_0x48f6('0x36')]=_[_0x48f6('0x37')](_0x168a2a[_0x48f6('0x34')],_0x168a2a['query']);_0x30454c[_0x48f6('0x38')]=_[_0x48f6('0x37')](_0x168a2a[_0x48f6('0x34')],qs[_0x48f6('0x39')](_0x87ac6d['query'][_0x48f6('0x39')]));_0x30454c[_0x48f6('0x38')]=_0x30454c[_0x48f6('0x38')][_0x48f6('0x3a')]?_0x30454c['attributes']:_0x168a2a[_0x48f6('0x34')];if(!_0x87ac6d['query']['hasOwnProperty'](_0x48f6('0x3b'))){_0x30454c['limit']=qs['limit'](_0x87ac6d['query'][_0x48f6('0x1f')]);_0x30454c[_0x48f6('0x1e')]=qs[_0x48f6('0x1e')](_0x87ac6d[_0x48f6('0x35')][_0x48f6('0x1e')]);}_0x30454c[_0x48f6('0x3c')]=qs[_0x48f6('0x3d')](_0x87ac6d['query'][_0x48f6('0x3d')]);_0x30454c['where']=qs['filters'](_[_0x48f6('0x3e')](_0x87ac6d[_0x48f6('0x35')],_0x168a2a['filters']),_0x4d8336);if(_0x87ac6d[_0x48f6('0x35')][_0x48f6('0x3f')]){_0x30454c[_0x48f6('0x40')]=_[_0x48f6('0x41')](_0x30454c[_0x48f6('0x40')],{'$or':_['map'](_0x4d8336,function(_0x37f25f){if(_0x37f25f['type']!==_0x48f6('0x42')){var _0x5fcd4a={};_0x5fcd4a[_0x37f25f[_0x48f6('0x2c')]]={'$like':'%'+_0x87ac6d[_0x48f6('0x35')][_0x48f6('0x3f')]+'%'};return _0x5fcd4a;}})});}_0x30454c=_['merge']({},_0x30454c,_0x87ac6d[_0x48f6('0x43')]);var _0x2aff35={'where':_0x30454c[_0x48f6('0x40')]};return db[_0x48f6('0x30')][_0x48f6('0x21')](_0x2aff35)[_0x48f6('0x29')](function(_0x33e9c4){_0x287571[_0x48f6('0x21')]=_0x33e9c4;if(_0x87ac6d[_0x48f6('0x35')][_0x48f6('0x44')]){_0x30454c[_0x48f6('0x45')]=[{'all':!![]}];}return db[_0x48f6('0x30')][_0x48f6('0x46')](_0x30454c);})[_0x48f6('0x29')](function(_0x29743c){_0x287571['rows']=_0x29743c;return _0x287571;})['then'](respondWithFilteredResult(_0x38f8ba,_0x30454c))[_0x48f6('0x47')](handleError(_0x38f8ba,null));};exports[_0x48f6('0x48')]=function(_0x2cbfb0,_0x44abdf){var _0x58e8a0={'raw':![],'where':{'id':_0x2cbfb0[_0x48f6('0x49')]['id']}},_0x2d3698={};_0x2d3698[_0x48f6('0x34')]=_[_0x48f6('0x4a')](db[_0x48f6('0x30')][_0x48f6('0x31')]);_0x2d3698[_0x48f6('0x35')]=_[_0x48f6('0x4a')](_0x2cbfb0[_0x48f6('0x35')]);_0x2d3698[_0x48f6('0x36')]=_[_0x48f6('0x37')](_0x2d3698['model'],_0x2d3698['query']);_0x58e8a0[_0x48f6('0x38')]=_[_0x48f6('0x37')](_0x2d3698[_0x48f6('0x34')],qs[_0x48f6('0x39')](_0x2cbfb0[_0x48f6('0x35')]['fields']));_0x58e8a0[_0x48f6('0x38')]=_0x58e8a0[_0x48f6('0x38')]['length']?_0x58e8a0[_0x48f6('0x38')]:_0x2d3698[_0x48f6('0x34')];if(_0x2cbfb0[_0x48f6('0x35')]['includeAll']){_0x58e8a0['include']=[{'all':!![]}];}_0x58e8a0=_[_0x48f6('0x41')]({},_0x58e8a0,_0x2cbfb0['options']);return db[_0x48f6('0x30')][_0x48f6('0x4b')](_0x58e8a0)[_0x48f6('0x29')](handleEntityNotFound(_0x44abdf,null))['then'](respondWithResult(_0x44abdf,null))[_0x48f6('0x47')](handleError(_0x44abdf,null));};exports[_0x48f6('0x4c')]=function(_0x36d784,_0x26b2a3){return db[_0x48f6('0x30')]['create'](_0x36d784[_0x48f6('0x4d')],{})['then'](function(_0x2ed234){var _0x5925fe=_0x36d784[_0x48f6('0x4e')][_0x48f6('0x4f')]({'plain':!![]});if(!_0x5925fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5925fe[_0x48f6('0x50')]===_0x48f6('0x4e')){var _0x1d3853=_0x2ed234[_0x48f6('0x4f')]({'plain':!![]});var _0x2051f4='Teams';return db[_0x48f6('0x51')][_0x48f6('0x4b')]({'where':{'name':_0x2051f4,'userProfileId':_0x5925fe[_0x48f6('0x52')]},'raw':!![]})[_0x48f6('0x29')](function(_0x1efef2){if(_0x1efef2&&_0x1efef2[_0x48f6('0x53')]===0x0){return db['UserProfileResource'][_0x48f6('0x4c')]({'name':_0x1d3853[_0x48f6('0x2c')],'resourceId':_0x1d3853['id'],'type':_0x1efef2[_0x48f6('0x2c')],'sectionId':_0x1efef2['id']},{})[_0x48f6('0x29')](function(){return _0x2ed234;});}else{return _0x2ed234;}})[_0x48f6('0x47')](function(_0x319dd0){logger[_0x48f6('0x2a')](_0x48f6('0x54'),_0x319dd0);throw _0x319dd0;});}return _0x2ed234;})[_0x48f6('0x29')](respondWithResult(_0x26b2a3,0xc9))[_0x48f6('0x47')](handleError(_0x26b2a3,null));};exports[_0x48f6('0x28')]=function(_0x319a59,_0x378efb){if(_0x319a59['body']['id']){delete _0x319a59['body']['id'];}return db[_0x48f6('0x30')][_0x48f6('0x4b')]({'where':{'id':_0x319a59[_0x48f6('0x49')]['id']}})[_0x48f6('0x29')](handleEntityNotFound(_0x378efb,null))['then'](saveUpdates(_0x319a59[_0x48f6('0x4d')],null))[_0x48f6('0x29')](respondWithResult(_0x378efb,null))[_0x48f6('0x47')](handleError(_0x378efb,null));};exports[_0x48f6('0x55')]=function(_0x2f7f14,_0x464c97){var _0x45c146=_0x2f7f14[_0x48f6('0x49')]['id'];var _0xf394af=[];return db[_0x48f6('0x56')][_0x48f6('0x57')](function(_0x247f1c){var _0x1b59b9=_0x48f6('0x58')+_0x45c146;return db['sequelize'][_0x48f6('0x35')](_0x1b59b9,{'type':db[_0x48f6('0x59')]['QueryTypes'][_0x48f6('0x5a')],'raw':!![],'transaction':_0x247f1c})[_0x48f6('0x29')](function(_0x2be9f9){_0xf394af=_['map'](_0x2be9f9,function(_0x4f61d6){return Number(_0x4f61d6[_0x48f6('0x5b')]);});})[_0x48f6('0x29')](function(){var _0x27cffe=_0x48f6('0x5c')+_0x45c146;return db[_0x48f6('0x56')]['query'](_0x27cffe,{'type':db[_0x48f6('0x59')][_0x48f6('0x5d')][_0x48f6('0x5a')],'raw':!![],'transaction':_0x247f1c});})['then'](function(_0x118b3e){var _0x4b227a=_[_0x48f6('0x2f')](_0x118b3e,function(_0x3ce253){return Number(_0x3ce253[_0x48f6('0x5e')]);});return db[_0x48f6('0x5f')][_0x48f6('0x55')]({'where':{'UserId':{'$in':_0xf394af},'VoiceQueueId':{'$in':_0x4b227a}},'transaction':_0x247f1c});})['then'](function(){var _0x4fc8fb=_0x48f6('0x60')+_0x45c146;return db[_0x48f6('0x56')][_0x48f6('0x35')](_0x4fc8fb,{'type':db['Sequelize'][_0x48f6('0x5d')][_0x48f6('0x5a')],'raw':!![],'transaction':_0x247f1c});})[_0x48f6('0x29')](function(_0x4ed761){var _0x47d9c6=_[_0x48f6('0x2f')](_0x4ed761,function(_0x284517){return Number(_0x284517[_0x48f6('0x61')]);});return db[_0x48f6('0x62')][_0x48f6('0x55')]({'where':{'UserId':{'$in':_0xf394af},'MailQueueId':{'$in':_0x47d9c6}},'transaction':_0x247f1c});})[_0x48f6('0x29')](function(){var _0x39bd34=_0x48f6('0x63')+_0x45c146;return db[_0x48f6('0x56')]['query'](_0x39bd34,{'type':db[_0x48f6('0x59')][_0x48f6('0x5d')][_0x48f6('0x5a')],'raw':!![],'transaction':_0x247f1c});})[_0x48f6('0x29')](function(_0x53961b){var _0x49c5c1=_[_0x48f6('0x2f')](_0x53961b,function(_0x162c22){return Number(_0x162c22['SmsQueueId']);});return db[_0x48f6('0x64')][_0x48f6('0x55')]({'where':{'UserId':{'$in':_0xf394af},'SmsQueueId':{'$in':_0x49c5c1}},'transaction':_0x247f1c});})[_0x48f6('0x29')](function(){var _0x478797=_0x48f6('0x65')+_0x45c146;return db['sequelize'][_0x48f6('0x35')](_0x478797,{'type':db[_0x48f6('0x59')]['QueryTypes'][_0x48f6('0x5a')],'raw':!![],'transaction':_0x247f1c});})[_0x48f6('0x29')](function(_0x403c59){var _0x29574c=_[_0x48f6('0x2f')](_0x403c59,function(_0x385a89){return Number(_0x385a89[_0x48f6('0x66')]);});return db[_0x48f6('0x67')][_0x48f6('0x55')]({'where':{'UserId':{'$in':_0xf394af},'ChatQueueId':{'$in':_0x29574c}},'transaction':_0x247f1c});})[_0x48f6('0x29')](function(){var _0x4a5471=_0x48f6('0x68')+_0x45c146;return db['sequelize'][_0x48f6('0x35')](_0x4a5471,{'type':db[_0x48f6('0x59')][_0x48f6('0x5d')][_0x48f6('0x5a')],'raw':!![],'transaction':_0x247f1c});})[_0x48f6('0x29')](function(_0x1a00b7){var _0x3ae23d=_[_0x48f6('0x2f')](_0x1a00b7,function(_0x476e38){return Number(_0x476e38[_0x48f6('0x69')]);});return db['UserFaxQueue'][_0x48f6('0x55')]({'where':{'UserId':{'$in':_0xf394af},'FaxQueueId':{'$in':_0x3ae23d}},'transaction':_0x247f1c});})['then'](function(){var _0x522c03='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x45c146;return db[_0x48f6('0x56')]['query'](_0x522c03,{'type':db['Sequelize'][_0x48f6('0x5d')]['SELECT'],'raw':!![],'transaction':_0x247f1c});})[_0x48f6('0x29')](function(_0x4e174e){var _0x46c180=_[_0x48f6('0x2f')](_0x4e174e,function(_0x559a43){return Number(_0x559a43[_0x48f6('0x6a')]);});return db[_0x48f6('0x6b')][_0x48f6('0x55')]({'where':{'UserId':{'$in':_0xf394af},'OpenchannelQueueId':{'$in':_0x46c180}},'transaction':_0x247f1c});})[_0x48f6('0x29')](function(){var _0x350578=_0x48f6('0x6c')+_0x45c146;return db[_0x48f6('0x56')][_0x48f6('0x35')](_0x350578,{'type':db[_0x48f6('0x59')][_0x48f6('0x5d')][_0x48f6('0x5a')],'raw':!![],'transaction':_0x247f1c});})[_0x48f6('0x29')](function(_0x178736){var _0x3b81ac=_['map'](_0x178736,function(_0x3b0331){return Number(_0x3b0331[_0x48f6('0x6d')]);});return db[_0x48f6('0x6e')][_0x48f6('0x55')]({'where':{'UserId':{'$in':_0xf394af},'WhatsappQueueId':{'$in':_0x3b81ac}},'transaction':_0x247f1c});})[_0x48f6('0x29')](function(){return db[_0x48f6('0x6f')][_0x48f6('0x4b')]({'where':{'TeamId':_0x45c146}});})[_0x48f6('0x29')](function(_0x10661a){if(_0x10661a===null){return;}return db[_0x48f6('0x70')][_0x48f6('0x55')]({'where':{'UserId':{'$in':_0xf394af},'VoicePrefixId':_0x10661a[_0x48f6('0x71')]},'transaction':_0x247f1c});})['then'](function(){return db['Team']['destroy']({'where':{'id':_0x45c146},'cascade':!![],'transaction':_0x247f1c});})['then'](function(_0x5c4b0d){if(_0x5c4b0d===0x0){_0x464c97[_0x48f6('0x1b')](0x194);}else{return db[_0x48f6('0x72')]['destroy']({'where':{'type':_0x48f6('0x73'),'resourceId':_0x45c146},'cascade':!![],'transaction':_0x247f1c})['then'](function(){_0x464c97[_0x48f6('0x1c')](0xcc)[_0x48f6('0x1d')]();});}})[_0x48f6('0x47')](function(_0x2788ad){_0x464c97[_0x48f6('0x1c')](0x1f4)[_0x48f6('0x2d')](_0x2788ad);});});};exports['getQueues']=function(_0x30d99b,_0x2a0309,_0x54e684){return db[_0x48f6('0x30')]['findOne']({'where':{'id':_0x30d99b[_0x48f6('0x49')]['id']}})[_0x48f6('0x29')](handleEntityNotFound(_0x2a0309,null))['then'](function(_0x33e1e3){if(!_0x30d99b['query'][_0x48f6('0x74')]||!utils[_0x48f6('0x75')](_0x30d99b['query'][_0x48f6('0x74')])){throw new db[(_0x48f6('0x59'))]['ValidationError'](_0x48f6('0x76'));}var _0x3f8769={};var _0x476cda={};_0x476cda['model']=_[_0x48f6('0x4a')](db[_[_0x48f6('0x77')](_0x30d99b[_0x48f6('0x35')][_0x48f6('0x74')]['toLowerCase']())+_0x48f6('0x78')]['rawAttributes']);_0x476cda['query']=_[_0x48f6('0x4a')](_0x30d99b[_0x48f6('0x35')]);_0x476cda[_0x48f6('0x36')]=_[_0x48f6('0x37')](_0x476cda['model'],_0x476cda[_0x48f6('0x35')]);_0x3f8769[_0x48f6('0x38')]=_[_0x48f6('0x37')](_0x476cda[_0x48f6('0x34')],qs[_0x48f6('0x39')](_0x30d99b[_0x48f6('0x35')][_0x48f6('0x39')]));_0x3f8769['attributes']=_0x3f8769[_0x48f6('0x38')][_0x48f6('0x3a')]?_0x3f8769['attributes']:_0x476cda['model'];_0x3f8769[_0x48f6('0x1f')]=qs[_0x48f6('0x1f')](_0x30d99b[_0x48f6('0x35')]['limit']);_0x3f8769[_0x48f6('0x1e')]=qs['offset'](_0x30d99b[_0x48f6('0x35')][_0x48f6('0x1e')]);_0x3f8769[_0x48f6('0x3c')]=qs[_0x48f6('0x3d')](_0x30d99b[_0x48f6('0x35')][_0x48f6('0x3d')]);_0x3f8769['where']=qs[_0x48f6('0x36')](_[_0x48f6('0x3e')](_0x30d99b[_0x48f6('0x35')],_0x476cda[_0x48f6('0x36')]));_0x3f8769=_[_0x48f6('0x41')]({},_0x3f8769,_0x30d99b[_0x48f6('0x43')]);return _0x33e1e3[_0x48f6('0x4f')+_['capitalize'](_0x30d99b[_0x48f6('0x35')][_0x48f6('0x74')][_0x48f6('0x79')]())+_0x48f6('0x7a')](_0x3f8769);})[_0x48f6('0x29')](respondWithResult(_0x2a0309,null))[_0x48f6('0x47')](handleError(_0x2a0309,null));};exports[_0x48f6('0x7b')]=function(_0x565e32,_0x8fb842,_0x29265f){return db[_0x48f6('0x30')][_0x48f6('0x7c')]({'where':{'id':_0x565e32[_0x48f6('0x49')]['id']}})['then'](function(_0x1bb3ef){if(_0x1bb3ef){if(!_0x565e32[_0x48f6('0x4d')][_0x48f6('0x74')]||!utils[_0x48f6('0x75')](_0x565e32['body']['channel'])){throw new db[(_0x48f6('0x59'))][(_0x48f6('0x7d'))](_0x48f6('0x76'));}return _0x1bb3ef['add'+_[_0x48f6('0x77')](_0x565e32[_0x48f6('0x4d')][_0x48f6('0x74')][_0x48f6('0x79')]())+_0x48f6('0x7a')](_0x565e32[_0x48f6('0x4d')][_0x48f6('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x8fb842,null))[_0x48f6('0x29')](respondWithStatusCode(_0x8fb842,null))['catch'](handleError(_0x8fb842,null));};exports[_0x48f6('0x7f')]=function(_0x41e7be,_0x22e3e6,_0x37864e){return db[_0x48f6('0x30')][_0x48f6('0x7c')]({'where':{'id':_0x41e7be[_0x48f6('0x49')]['id']}})[_0x48f6('0x29')](function(_0x4d7433){if(_0x4d7433){if(!_0x41e7be['query'][_0x48f6('0x74')]||!utils['isValidChannel'](_0x41e7be[_0x48f6('0x35')][_0x48f6('0x74')])){throw new db[(_0x48f6('0x59'))][(_0x48f6('0x7d'))](_0x48f6('0x76'));}return _0x4d7433[_0x48f6('0x80')+_[_0x48f6('0x77')](_0x41e7be[_0x48f6('0x35')][_0x48f6('0x74')][_0x48f6('0x79')]())+_0x48f6('0x7a')](_0x41e7be['query']['ids']);}return null;})[_0x48f6('0x29')](handleEntityNotFound(_0x22e3e6,null))[_0x48f6('0x29')](respondWithStatusCode(_0x22e3e6,null))[_0x48f6('0x47')](handleError(_0x22e3e6,null));};exports[_0x48f6('0x81')]=function(_0x5a2c77,_0x521626){var _0x1e73cc=_[_0x48f6('0x82')](_0x5a2c77[_0x48f6('0x4d')][_0x48f6('0x7e')])?_0x5a2c77['body'][_0x48f6('0x7e')]:[_0x5a2c77[_0x48f6('0x4d')]['ids']];var _0xd2f5cf=_0x5a2c77['params']['id'];return db[_0x48f6('0x30')]['find']({'where':{'id':_0xd2f5cf}})['then'](handleEntityNotFound(_0x521626,null))[_0x48f6('0x29')](function(_0x548253){if(_0x548253){var _0x58e3b6=['Voice',_0x48f6('0x83'),_0x48f6('0x84'),_0x48f6('0x85'),'Fax',_0x48f6('0x86'),_0x48f6('0x87')];return db[_0x48f6('0x56')][_0x48f6('0x57')](function(_0x388df7){var _0x116d5f=_[_0x48f6('0x2f')](_0x58e3b6,function(_0x309fb7){var _0x16eef6={'attributes':['id',_0x48f6('0x2c')]};if(_0x309fb7===_0x48f6('0x88')){_0x16eef6['through']={'attributes':[_0x48f6('0x89')]};}return _0x548253[_0x48f6('0x4f')+_0x309fb7+_0x48f6('0x7a')](_0x16eef6)[_0x48f6('0x29')](function(_0x3b87cb){var _0x3a27d6=_[_0x48f6('0x2f')](_0x3b87cb,function(_0x5e4c94){var _0xd84a12=_[_0x48f6('0x2f')](_0x1e73cc,function(_0x4a31ee){var _0x4236d5={'where':{'UserId':_0x4a31ee,[_0x309fb7+_0x48f6('0x8a')]:_0x5e4c94['id']},'transaction':_0x388df7};if(_0x309fb7==='Voice'){_0x4236d5['defaults']={'penalty':_0x5e4c94[_0x48f6('0x8b')][_0x48f6('0x89')]};}return db['User'+_0x309fb7+_0x48f6('0x78')][_0x48f6('0x8c')](_0x4236d5)[_0x48f6('0x29')](function(){socket[_0x48f6('0x8d')]('user'+_0x309fb7+_0x48f6('0x8e'),{'UserId':_0x4a31ee,[_0x309fb7+_0x48f6('0x8a')]:_0x5e4c94['id']});if(_0x309fb7!=='Voice'){return;}return db[_0x48f6('0x8f')]['findAll']({'where':{'id':_0x1e73cc,'online':0x1},'attributes':['id',_0x48f6('0x2c'),'online',_0x48f6('0x90'),_0x48f6('0x91')],'raw':!![]})['then'](function(_0x533c01){var _0x19e0f8=_[_0x48f6('0x2f')](_0x533c01,function(_0x4ce448){return db[_0x48f6('0x92')][_0x48f6('0x93')]({'membername':_0x4ce448['name'],'UserId':_0x4ce448['id'],'queue_name':_0x5e4c94[_0x48f6('0x2c')],'VoiceQueueId':_0x5e4c94['id'],'interface':_[_0x48f6('0x94')](_0x4ce448[_0x48f6('0x91')])?util[_0x48f6('0x95')]('SIP/%s',_0x4ce448[_0x48f6('0x2c')]):_0x4ce448['interface'],'paused':_0x4ce448[_0x48f6('0x90')]||![],'penalty':_0x5e4c94[_0x48f6('0x8b')]['penalty']},{'transaction':_0x388df7});});return Promise[_0x48f6('0x96')](_0x19e0f8);});});});return Promise[_0x48f6('0x96')](_0xd84a12);});return Promise[_0x48f6('0x96')](_0x3a27d6);})[_0x48f6('0x29')](function(){return db[_0x48f6('0x6f')][_0x48f6('0x7c')]({'where':{'teamId':_0xd2f5cf}})[_0x48f6('0x29')](function(_0x4624b6){if(_0x4624b6){var _0x5a842e=_[_0x48f6('0x2f')](_0x1e73cc,function(_0x11f448){db['UserVoicePrefix'][_0x48f6('0x93')]({'UserId':_0x11f448,'VoicePrefixId':_0x4624b6[_0x48f6('0x71')]});});return Promise[_0x48f6('0x96')](_0x5a842e);}});});});return Promise[_0x48f6('0x96')](_0x116d5f)['then'](function(){return _0x548253[_0x48f6('0x81')](_0x1e73cc,{'transaction':_0x388df7})[_0x48f6('0x97')](function(_0x3c4760){return _0x3c4760;});});});}})['then'](respondWithResult(_0x521626,null))[_0x48f6('0x47')](handleError(_0x521626,null));};exports[_0x48f6('0x98')]=function(_0x49f6cc,_0x4b0844){var _0x48b5ab=_[_0x48f6('0x82')](_0x49f6cc[_0x48f6('0x35')][_0x48f6('0x7e')])?_0x49f6cc[_0x48f6('0x35')][_0x48f6('0x7e')]:[_0x49f6cc[_0x48f6('0x35')]['ids']];var _0x1a2291=_0x49f6cc[_0x48f6('0x49')]['id'];return db['Team']['find']({'where':{'id':_0x1a2291}})['then'](handleEntityNotFound(_0x4b0844,null))[_0x48f6('0x29')](function(_0x1a86f4){if(_0x1a86f4){var _0x275354=[_0x48f6('0x88'),_0x48f6('0x83'),_0x48f6('0x84'),_0x48f6('0x85'),_0x48f6('0x99'),'Openchannel',_0x48f6('0x87')];return db[_0x48f6('0x56')]['transaction'](function(_0x52201f){var _0x294746=_[_0x48f6('0x2f')](_0x275354,function(_0x362e58){var _0x3f3f5d={'attributes':['id',_0x48f6('0x2c')]};return _0x1a86f4['get'+_0x362e58+_0x48f6('0x7a')](_0x3f3f5d)[_0x48f6('0x29')](function(_0x4dc37d){var _0x33e7d5=_[_0x48f6('0x2f')](_0x4dc37d,function(_0xddb9db){return _0xddb9db[_0x48f6('0x98')](_0x48b5ab,{'transaction':_0x52201f})['then'](function(){var _0x24aba6=_['map'](_0x48b5ab,function(_0x1754f9){socket[_0x48f6('0x8d')](_0x48f6('0x4e')+_0x362e58+_0x48f6('0x9a'),{'UserId':Number(_0x1754f9),[_0x362e58+_0x48f6('0x8a')]:_0xddb9db['id']});if(_0x362e58!==_0x48f6('0x88')){return;}return db['UserVoiceQueueRt'][_0x48f6('0x55')]({'where':{'VoiceQueueId':_0xddb9db['id'],'UserId':_0x1754f9},'transaction':_0x52201f});});return Promise[_0x48f6('0x96')](_0x24aba6);});});return Promise['all'](_0x33e7d5);});});return Promise[_0x48f6('0x96')](_0x294746)['then'](function(){return _0x1a86f4[_0x48f6('0x98')](_0x48b5ab,{'transaction':_0x52201f});})['then'](function(){return db['TeamVoicePrefix'][_0x48f6('0x7c')]({'where':{'teamId':_0x1a2291}})[_0x48f6('0x29')](function(_0xd6b1aa){if(_0xd6b1aa){var _0x43d0f4=_[_0x48f6('0x2f')](_0x48b5ab,function(_0x4918a3){db[_0x48f6('0x70')][_0x48f6('0x55')]({'where':{'UserId':_0x4918a3,'VoicePrefixId':_0xd6b1aa[_0x48f6('0x71')]}});});return Promise[_0x48f6('0x96')](_0x43d0f4);}});});});}})[_0x48f6('0x29')](respondWithStatusCode(_0x4b0844,null))['catch'](handleError(_0x4b0844,null));};exports[_0x48f6('0x9b')]=function(_0x1bb681,_0x282260,_0x30bcc3){var _0x58b156={};var _0x194c7c={};var _0x3e507f;var _0x23b33c;return db[_0x48f6('0x30')][_0x48f6('0x7c')]({'where':{'id':_0x1bb681['params']['id']}})[_0x48f6('0x29')](handleEntityNotFound(_0x282260,null))['then'](function(_0x2ba981){if(_0x2ba981){_0x3e507f=_0x2ba981;_0x194c7c[_0x48f6('0x34')]=_[_0x48f6('0x4a')](db[_0x48f6('0x8f')]['rawAttributes']);_0x194c7c[_0x48f6('0x35')]=_[_0x48f6('0x4a')](_0x1bb681[_0x48f6('0x35')]);_0x194c7c[_0x48f6('0x36')]=_[_0x48f6('0x37')](_0x194c7c[_0x48f6('0x34')],_0x194c7c['query']);_0x58b156[_0x48f6('0x38')]=_[_0x48f6('0x37')](_0x194c7c[_0x48f6('0x34')],qs[_0x48f6('0x39')](_0x1bb681[_0x48f6('0x35')][_0x48f6('0x39')]));_0x58b156[_0x48f6('0x38')]=_0x58b156[_0x48f6('0x38')][_0x48f6('0x3a')]?_0x58b156[_0x48f6('0x38')]:_0x194c7c[_0x48f6('0x34')];_0x58b156[_0x48f6('0x3c')]=qs[_0x48f6('0x3d')](_0x1bb681[_0x48f6('0x35')]['sort']);_0x58b156['where']=qs[_0x48f6('0x36')](_[_0x48f6('0x3e')](_0x1bb681['query'],_0x194c7c[_0x48f6('0x36')]));if(_0x1bb681[_0x48f6('0x35')]['filter']){_0x58b156[_0x48f6('0x40')]=_[_0x48f6('0x41')](_0x58b156[_0x48f6('0x40')],{'$or':_['map'](_0x58b156[_0x48f6('0x38')],function(_0x2847a9){var _0x28cbd7={};_0x28cbd7[_0x2847a9]={'$like':'%'+_0x1bb681[_0x48f6('0x35')]['filter']+'%'};return _0x28cbd7;})});}_0x58b156=_[_0x48f6('0x41')]({},_0x58b156,_0x1bb681[_0x48f6('0x43')]);return _0x3e507f[_0x48f6('0x9b')](_0x58b156);}})[_0x48f6('0x29')](function(_0x476cc5){if(_0x476cc5){_0x23b33c=_0x476cc5[_0x48f6('0x3a')];if(!_0x1bb681['query']['hasOwnProperty'](_0x48f6('0x3b'))){_0x58b156['limit']=qs['limit'](_0x1bb681['query'][_0x48f6('0x1f')]);_0x58b156[_0x48f6('0x1e')]=qs[_0x48f6('0x1e')](_0x1bb681[_0x48f6('0x35')][_0x48f6('0x1e')]);}return _0x3e507f[_0x48f6('0x9b')](_0x58b156);}})['then'](function(_0x3d8a3c){if(_0x3d8a3c){return _0x3d8a3c?{'count':_0x23b33c,'rows':_0x3d8a3c}:null;}})[_0x48f6('0x29')](respondWithResult(_0x282260,null))[_0x48f6('0x47')](handleError(_0x282260,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 0fe420c..796fb97 100644 --- a/server/api/team/team.events.js +++ b/server/api/team/team.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0db=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xf0db,0xb0));var _0xbf0d=function(_0x7a0171,_0x212e3d){_0x7a0171=_0x7a0171-0x0;var _0x25be71=_0xf0db[_0x7a0171];return _0x25be71;};'use strict';var EventEmitter=require(_0xbf0d('0x0'));var Team=require(_0xbf0d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbf0d('0x2'),'afterUpdate':_0xbf0d('0x3'),'afterDestroy':_0xbf0d('0x4')};function emitEvent(_0x557637){return function(_0x2ab51f,_0x486938,_0x4b1b18){TeamEvents[_0xbf0d('0x5')](_0x557637+':'+_0x2ab51f['id'],_0x2ab51f);TeamEvents[_0xbf0d('0x5')](_0x557637,_0x2ab51f);_0x4b1b18(null);};}for(var e in events){if(events[_0xbf0d('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xbf0d('0x7')]=TeamEvents; \ No newline at end of file +var _0x9932=['../../mysqldb','Team','save','update','remove','emit','hook','events'];(function(_0x20c809,_0x26b566){var _0x1064a1=function(_0x39c6db){while(--_0x39c6db){_0x20c809['push'](_0x20c809['shift']());}};_0x1064a1(++_0x26b566);}(_0x9932,0x11f));var _0x2993=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x9932[_0x2ff238];return _0x204a56;};'use strict';var EventEmitter=require(_0x2993('0x0'));var Team=require(_0x2993('0x1'))['db'][_0x2993('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2993('0x3'),'afterUpdate':_0x2993('0x4'),'afterDestroy':_0x2993('0x5')};function emitEvent(_0x5499a8){return function(_0x1c4160,_0x166fcb,_0xb840a8){TeamEvents[_0x2993('0x6')](_0x5499a8+':'+_0x1c4160['id'],_0x1c4160);TeamEvents[_0x2993('0x6')](_0x5499a8,_0x1c4160);_0xb840a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x2993('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 894945f..c741776 100644 --- a/server/api/team/team.model.js +++ b/server/api/team/team.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d67=['Whatsapp','resolve','./team.attributes','then','map','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Mail','Openchannel'];(function(_0x37d76d,_0x14ab7e){var _0x486c89=function(_0xb25ab6){while(--_0xb25ab6){_0x37d76d['push'](_0x37d76d['shift']());}};_0x486c89(++_0x14ab7e);}(_0x5d67,0x101));var _0x75d6=function(_0x5048e2,_0x143271){_0x5048e2=_0x5048e2-0x0;var _0x2d1534=_0x5d67[_0x5048e2];return _0x2d1534;};'use strict';var _=require('lodash');var attributes=require(_0x75d6('0x0'));function getQueuesByChannel(_0x532897,_0x453b45){var _0x1081c0='get'+_0x453b45+'Queues';return _0x532897[_0x1081c0]()[_0x75d6('0x1')](function(_0x2f23e3){return _[_0x75d6('0x2')](_0x2f23e3,function(_0x56d9bc){_0x56d9bc[_0x75d6('0x3')](_0x75d6('0x4'),_0x453b45);return _0x56d9bc;});})['catch'](function(_0xe41664){throw _0xe41664;});}module[_0x75d6('0x5')]=function(_0x3b100d){return _0x3b100d[_0x75d6('0x6')](_0x75d6('0x7'),attributes,{'tableName':_0x75d6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4d5b73=this;var _0x237a29=[_0x75d6('0x9'),_0x75d6('0xa'),_0x75d6('0xb'),_0x75d6('0xc'),'Sms','Voice',_0x75d6('0xd')];return Promise[_0x75d6('0xe')]()[_0x75d6('0x1')](function(){var _0x3d9015=_[_0x75d6('0x2')](_0x237a29,function(_0x52ef3f){return getQueuesByChannel(_0x4d5b73,_0x52ef3f);});return Promise['all'](_0x3d9015);})['catch'](function(_0x2a5c19){throw _0x2a5c19;});}}});}; \ No newline at end of file +var _0xcbba=['catch','exports','define','Team','teams','Chat','Fax','Mail','Sms','Voice','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0xcbba,0x106));var _0xacbb=function(_0x2cd8f1,_0x32e5ea){_0x2cd8f1=_0x2cd8f1-0x0;var _0x2c793c=_0xcbba[_0x2cd8f1];return _0x2c793c;};'use strict';var _=require(_0xacbb('0x0'));var attributes=require(_0xacbb('0x1'));function getQueuesByChannel(_0x3c88de,_0x75819){var _0x19b6d5=_0xacbb('0x2')+_0x75819+_0xacbb('0x3');return _0x3c88de[_0x19b6d5]()[_0xacbb('0x4')](function(_0x3c9ced){return _[_0xacbb('0x5')](_0x3c9ced,function(_0xbb715e){_0xbb715e[_0xacbb('0x6')](_0xacbb('0x7'),_0x75819);return _0xbb715e;});})[_0xacbb('0x8')](function(_0x3c5c59){throw _0x3c5c59;});}module[_0xacbb('0x9')]=function(_0x48ae64){return _0x48ae64[_0xacbb('0xa')](_0xacbb('0xb'),attributes,{'tableName':_0xacbb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4a6997=this;var _0x5cd4b6=[_0xacbb('0xd'),_0xacbb('0xe'),_0xacbb('0xf'),'Openchannel',_0xacbb('0x10'),_0xacbb('0x11'),'Whatsapp'];return Promise['resolve']()[_0xacbb('0x4')](function(){var _0x26ed33=_[_0xacbb('0x5')](_0x5cd4b6,function(_0x3a9774){return getQueuesByChannel(_0x4a6997,_0x3a9774);});return Promise['all'](_0x26ed33);})[_0xacbb('0x8')](function(_0x751cea){throw _0x751cea;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b42a7b8..6d9c521 100644 --- a/server/api/team/team.rpc.js +++ b/server/api/team/team.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd7b=['message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','request','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s'];(function(_0xfba8b6,_0x154c72){var _0x386330=function(_0x2eb89c){while(--_0x2eb89c){_0xfba8b6['push'](_0xfba8b6['shift']());}};_0x386330(++_0x154c72);}(_0xbd7b,0x1f0));var _0xbbd7=function(_0x581c2b,_0xa6d0cb){_0x581c2b=_0x581c2b-0x0;var _0x403750=_0xbd7b[_0x581c2b];return _0x403750;};'use strict';var _=require(_0xbbd7('0x0'));var util=require(_0xbbd7('0x1'));var moment=require('moment');var BPromise=require(_0xbbd7('0x2'));var rs=require(_0xbbd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbd7('0x4'))['db'];var utils=require(_0xbbd7('0x5'));var logger=require(_0xbbd7('0x6'))('rpc');var config=require(_0xbbd7('0x7'));var jayson=require(_0xbbd7('0x8'));var client=jayson[_0xbbd7('0x9')][_0xbbd7('0xa')]({'port':0x232a});config[_0xbbd7('0xb')]=_[_0xbbd7('0xc')](config[_0xbbd7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbd7('0xd'))(new Redis(config[_0xbbd7('0xb')]));require(_0xbbd7('0xe'))['register'](socket);function respondWithRpcPromise(_0x3983f8,_0x38bb29,_0x88a84a){return new BPromise(function(_0x2f6f54,_0x2052a1){return client[_0xbbd7('0xf')](_0x3983f8,_0x88a84a)['then'](function(_0x1fd59c){logger[_0xbbd7('0x10')]('Team,\x20%s,\x20%s',_0x38bb29,_0xbbd7('0x11'));logger[_0xbbd7('0x12')](_0xbbd7('0x13'),_0x38bb29,_0xbbd7('0x11'),JSON[_0xbbd7('0x14')](_0x1fd59c));if(_0x1fd59c[_0xbbd7('0x15')]){if(_0x1fd59c[_0xbbd7('0x15')][_0xbbd7('0x16')]===0x1f4){logger['error'](_0xbbd7('0x17'),_0x38bb29,_0x1fd59c['error'][_0xbbd7('0x18')]);return _0x2052a1(_0x1fd59c[_0xbbd7('0x15')][_0xbbd7('0x18')]);}logger[_0xbbd7('0x15')]('Team,\x20%s,\x20%s',_0x38bb29,_0x1fd59c[_0xbbd7('0x15')][_0xbbd7('0x18')]);return _0x2f6f54(_0x1fd59c[_0xbbd7('0x15')]['message']);}else{logger[_0xbbd7('0x10')]('Team,\x20%s,\x20%s',_0x38bb29,_0xbbd7('0x11'));_0x2f6f54(_0x1fd59c['result']['message']);}})[_0xbbd7('0x19')](function(_0x57b023){logger['error'](_0xbbd7('0x17'),_0x38bb29,_0x57b023);_0x2052a1(_0x57b023);});});} \ No newline at end of file +var _0xfcc0=['defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis'];(function(_0x5005a5,_0x15164e){var _0x4790c1=function(_0x52ff06){while(--_0x52ff06){_0x5005a5['push'](_0x5005a5['shift']());}};_0x4790c1(++_0x15164e);}(_0xfcc0,0x1ec));var _0x0fcc=function(_0x5c9f8b,_0x348375){_0x5c9f8b=_0x5c9f8b-0x0;var _0x5a7832=_0xfcc0[_0x5c9f8b];return _0x5a7832;};'use strict';var _=require(_0x0fcc('0x0'));var util=require(_0x0fcc('0x1'));var moment=require(_0x0fcc('0x2'));var BPromise=require(_0x0fcc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fcc('0x4'));var db=require(_0x0fcc('0x5'))['db'];var utils=require(_0x0fcc('0x6'));var logger=require('../../config/logger')(_0x0fcc('0x7'));var config=require('../../config/environment');var jayson=require(_0x0fcc('0x8'));var client=jayson[_0x0fcc('0x9')][_0x0fcc('0xa')]({'port':0x232a});config[_0x0fcc('0xb')]=_[_0x0fcc('0xc')](config[_0x0fcc('0xb')],{'host':_0x0fcc('0xd'),'port':0x18eb});var socket=require(_0x0fcc('0xe'))(new Redis(config[_0x0fcc('0xb')]));require('./team.socket')[_0x0fcc('0xf')](socket);function respondWithRpcPromise(_0x380a16,_0x56e14c,_0x586951){return new BPromise(function(_0x53eca1,_0xbb28c0){return client[_0x0fcc('0x10')](_0x380a16,_0x586951)[_0x0fcc('0x11')](function(_0x3b9971){logger[_0x0fcc('0x12')](_0x0fcc('0x13'),_0x56e14c,_0x0fcc('0x14'));logger[_0x0fcc('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x56e14c,_0x0fcc('0x14'),JSON[_0x0fcc('0x16')](_0x3b9971));if(_0x3b9971[_0x0fcc('0x17')]){if(_0x3b9971['error'][_0x0fcc('0x18')]===0x1f4){logger[_0x0fcc('0x17')](_0x0fcc('0x13'),_0x56e14c,_0x3b9971[_0x0fcc('0x17')][_0x0fcc('0x19')]);return _0xbb28c0(_0x3b9971[_0x0fcc('0x17')]['message']);}logger[_0x0fcc('0x17')]('Team,\x20%s,\x20%s',_0x56e14c,_0x3b9971[_0x0fcc('0x17')][_0x0fcc('0x19')]);return _0x53eca1(_0x3b9971[_0x0fcc('0x17')][_0x0fcc('0x19')]);}else{logger[_0x0fcc('0x12')]('Team,\x20%s,\x20%s',_0x56e14c,_0x0fcc('0x14'));_0x53eca1(_0x3b9971[_0x0fcc('0x1a')][_0x0fcc('0x19')]);}})[_0x0fcc('0x1b')](function(_0x2d8d7f){logger[_0x0fcc('0x17')]('Team,\x20%s,\x20%s',_0x56e14c,_0x2d8d7f);_0xbb28c0(_0x2d8d7f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4e99f76..44289d8 100644 --- a/server/api/team/team.socket.js +++ b/server/api/team/team.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa321=['team:','./team.events','save','remove','update','length'];(function(_0x232715,_0x4bd63e){var _0x1e6090=function(_0x1baae7){while(--_0x1baae7){_0x232715['push'](_0x232715['shift']());}};_0x1e6090(++_0x4bd63e);}(_0xa321,0x9d));var _0x1a32=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0xa321[_0x3ef2d5];return _0x2fefb2;};'use strict';var TeamEvents=require(_0x1a32('0x0'));var events=[_0x1a32('0x1'),_0x1a32('0x2'),_0x1a32('0x3')];function createListener(_0x5cf559,_0xc755ca){return function(_0x362f50){_0xc755ca['emit'](_0x5cf559,_0x362f50);};}function removeListener(_0x471356,_0x1dd9bc){return function(){TeamEvents['removeListener'](_0x471356,_0x1dd9bc);};}exports['register']=function(_0x549fea){for(var _0x363af7=0x0,_0x4859d6=events[_0x1a32('0x4')];_0x363af7<_0x4859d6;_0x363af7++){var _0x1fa204=events[_0x363af7];var _0xdfa9fe=createListener(_0x1a32('0x5')+_0x1fa204,_0x549fea);TeamEvents['on'](_0x1fa204,_0xdfa9fe);}}; \ No newline at end of file +var _0xcb30=['./team.events','remove','update','emit','register','length','team:'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xcb30,0xaf));var _0x0cb3=function(_0x27d72e,_0xb3d410){_0x27d72e=_0x27d72e-0x0;var _0x1cd188=_0xcb30[_0x27d72e];return _0x1cd188;};'use strict';var TeamEvents=require(_0x0cb3('0x0'));var events=['save',_0x0cb3('0x1'),_0x0cb3('0x2')];function createListener(_0x2f09c9,_0xfe1b9c){return function(_0x5b22be){_0xfe1b9c[_0x0cb3('0x3')](_0x2f09c9,_0x5b22be);};}function removeListener(_0x2cf0ca,_0x3d8829){return function(){TeamEvents['removeListener'](_0x2cf0ca,_0x3d8829);};}exports[_0x0cb3('0x4')]=function(_0x59cdcc){for(var _0x338ee1=0x0,_0x1bac8d=events[_0x0cb3('0x5')];_0x338ee1<_0x1bac8d;_0x338ee1++){var _0x134454=events[_0x338ee1];var _0x15fdbf=createListener(_0x0cb3('0x6')+_0x134454,_0x59cdcc);TeamEvents['on'](_0x134454,_0x15fdbf);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 06dc2b8..4b197fe 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153f=['exports','INTEGER','sequelize'];(function(_0x39cad6,_0x1edf41){var _0x5a82f2=function(_0x416563){while(--_0x416563){_0x39cad6['push'](_0x39cad6['shift']());}};_0x5a82f2(++_0x1edf41);}(_0x153f,0x15b));var _0xf153=function(_0xe4f4d1,_0x563844){_0xe4f4d1=_0xe4f4d1-0x0;var _0x536f18=_0x153f[_0xe4f4d1];return _0x536f18;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'TeamId':{'type':Sequelize[_0xf153('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file +var _0xdae9=['exports','INTEGER'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xdae9,0x15e));var _0x9dae=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xdae9[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require('sequelize');module[_0x9dae('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x9dae('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 230a5d5..485a4f5 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e6b=['path','rimraf','../../config/environment','exports','TeamVoicePrefix','lodash','util','api','request-promise'];(function(_0x2803dc,_0x1cdaf1){var _0x552ae4=function(_0x15f1ef){while(--_0x15f1ef){_0x2803dc['push'](_0x2803dc['shift']());}};_0x552ae4(++_0x1cdaf1);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x9e6b[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var logger=require('../../config/logger')(_0xb9e6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9e6('0x3'));var fs=require('fs');var path=require(_0xb9e6('0x4'));var rimraf=require(_0xb9e6('0x5'));var config=require(_0xb9e6('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xb9e6('0x7')]=function(_0x1a6a4f,_0x1b9eed){return _0x1a6a4f['define'](_0xb9e6('0x8'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9173=['./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment','bluebird','path','../../config/environment'];(function(_0x49b742,_0x562f73){var _0x1e945d=function(_0x51f259){while(--_0x51f259){_0x49b742['push'](_0x49b742['shift']());}};_0x1e945d(++_0x562f73);}(_0x9173,0xb4));var _0x3917=function(_0x5b269f,_0x4d4919){_0x5b269f=_0x5b269f-0x0;var _0x1fd0fc=_0x9173[_0x5b269f];return _0x1fd0fc;};'use strict';var _=require(_0x3917('0x0'));var util=require(_0x3917('0x1'));var logger=require('../../config/logger')(_0x3917('0x2'));var moment=require(_0x3917('0x3'));var BPromise=require(_0x3917('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3917('0x5'));var rimraf=require('rimraf');var config=require(_0x3917('0x6'));var attributes=require(_0x3917('0x7'));module[_0x3917('0x8')]=function(_0x403e03,_0x2dace9){return _0x403e03['define'](_0x3917('0x9'),attributes,{'tableName':_0x3917('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 893c9aa..a4396ac 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x31aaeb,_0x1a0397){var _0x3ee9fc=function(_0x49d4ea){while(--_0x49d4ea){_0x31aaeb['push'](_0x31aaeb['shift']());}};_0x3ee9fc(++_0x1a0397);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xcb91[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x388542,_0x5d09b2){var _0x1bc23b=function(_0x418d23){while(--_0x418d23){_0x388542['push'](_0x388542['shift']());}};_0x1bc23b(++_0x5d09b2);}(_0xedd9,0xfc));var _0x9edd=function(_0x64f178,_0x3a21f7){_0x64f178=_0x64f178-0x0;var _0x326771=_0xedd9[_0x64f178];return _0x326771;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1acea6b..35b95ea 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae90=['exports','sequelize'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xae90,0x1e5));var _0x0ae9=function(_0x9489bf,_0x543b9a){_0x9489bf=_0x9489bf-0x0;var _0x587fc0=_0xae90[_0x9489bf];return _0x587fc0;};'use strict';var Sequelize=require(_0x0ae9('0x0'));module[_0x0ae9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa452=['INTEGER','sequelize'];(function(_0x14b7a1,_0x1659ac){var _0x33f637=function(_0x4278f3){while(--_0x4278f3){_0x14b7a1['push'](_0x14b7a1['shift']());}};_0x33f637(++_0x1659ac);}(_0xa452,0xe7));var _0x2a45=function(_0x228e01,_0x3aa754){_0x228e01=_0x228e01-0x0;var _0x1ec4bb=_0xa452[_0x228e01];return _0x1ec4bb;};'use strict';var Sequelize=require(_0x2a45('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2a45('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 26cef67..980bc29 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4ba=['../../config/logger','api','moment','request-promise','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','util'];(function(_0x337949,_0x5f4ee6){var _0x33f3d9=function(_0x50a335){while(--_0x50a335){_0x337949['push'](_0x337949['shift']());}};_0x33f3d9(++_0x5f4ee6);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa4ba[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var moment=require(_0xaa4b('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa4b('0x5'));var attributes=require(_0xaa4b('0x6'));module[_0xaa4b('0x7')]=function(_0x146035,_0x4809a9){return _0x146035[_0xaa4b('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0xaa4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9649=['request-promise','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x9649,0x19f));var _0x9964=function(_0x1bb49d,_0x2b1a14){_0x1bb49d=_0x1bb49d-0x0;var _0x331edf=_0x9649[_0x1bb49d];return _0x331edf;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index a93194f..25f29f9 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe7c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0xbe7c,0x108));var _0xcbe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe7c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcbe7('0x0'));var util=require(_0xcbe7('0x1'));var moment=require(_0xcbe7('0x2'));var BPromise=require(_0xcbe7('0x3'));var rs=require(_0xcbe7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbe7('0x5'))['db'];var utils=require(_0xcbe7('0x6'));var logger=require('../../config/logger')(_0xcbe7('0x7'));var config=require(_0xcbe7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcbe7('0x9')][_0xcbe7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x466b19,_0x4b7021,_0x673d55){return new BPromise(function(_0x1e1bff,_0x246aad){return client['request'](_0x466b19,_0x673d55)[_0xcbe7('0xb')](function(_0x47820a){logger[_0xcbe7('0xc')](_0xcbe7('0xd'),_0x4b7021,_0xcbe7('0xe'));logger[_0xcbe7('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4b7021,_0xcbe7('0xe'),JSON['stringify'](_0x47820a));if(_0x47820a['error']){if(_0x47820a[_0xcbe7('0x10')][_0xcbe7('0x11')]===0x1f4){logger[_0xcbe7('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4b7021,_0x47820a[_0xcbe7('0x10')]['message']);return _0x246aad(_0x47820a[_0xcbe7('0x10')][_0xcbe7('0x12')]);}logger[_0xcbe7('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4b7021,_0x47820a[_0xcbe7('0x10')][_0xcbe7('0x12')]);return _0x1e1bff(_0x47820a['error'][_0xcbe7('0x12')]);}else{logger[_0xcbe7('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4b7021,_0xcbe7('0xe'));_0x1e1bff(_0x47820a['result'][_0xcbe7('0x12')]);}})['catch'](function(_0x391d35){logger['error'](_0xcbe7('0xd'),_0x4b7021,_0x391d35);_0x246aad(_0x391d35);});});} \ No newline at end of file +var _0x4d46=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3ddefb,_0x2641f9){var _0x206cfc=function(_0x5832e2){while(--_0x5832e2){_0x3ddefb['push'](_0x3ddefb['shift']());}};_0x206cfc(++_0x2641f9);}(_0x4d46,0x197));var _0x64d4=function(_0xcd001d,_0x4529e0){_0xcd001d=_0xcd001d-0x0;var _0x4a79a1=_0x4d46[_0xcd001d];return _0x4a79a1;};'use strict';var _=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var moment=require(_0x64d4('0x2'));var BPromise=require(_0x64d4('0x3'));var rs=require(_0x64d4('0x4'));var fs=require('fs');var Redis=require(_0x64d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x64d4('0x6'));var logger=require(_0x64d4('0x7'))(_0x64d4('0x8'));var config=require(_0x64d4('0x9'));var jayson=require(_0x64d4('0xa'));var client=jayson[_0x64d4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321a51,_0x33b72d,_0x51faf7){return new BPromise(function(_0x45158d,_0x34d00a){return client['request'](_0x321a51,_0x51faf7)['then'](function(_0x4d9e23){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x33b72d,_0x64d4('0xc'));logger[_0x64d4('0xd')](_0x64d4('0xe'),_0x33b72d,_0x64d4('0xc'),JSON[_0x64d4('0xf')](_0x4d9e23));if(_0x4d9e23[_0x64d4('0x10')]){if(_0x4d9e23[_0x64d4('0x10')][_0x64d4('0x11')]===0x1f4){logger[_0x64d4('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33b72d,_0x4d9e23[_0x64d4('0x10')]['message']);return _0x34d00a(_0x4d9e23[_0x64d4('0x10')][_0x64d4('0x12')]);}logger[_0x64d4('0x10')](_0x64d4('0x13'),_0x33b72d,_0x4d9e23[_0x64d4('0x10')][_0x64d4('0x12')]);return _0x45158d(_0x4d9e23['error'][_0x64d4('0x12')]);}else{logger[_0x64d4('0x14')](_0x64d4('0x13'),_0x33b72d,_0x64d4('0xc'));_0x45158d(_0x4d9e23[_0x64d4('0x15')][_0x64d4('0x12')]);}})[_0x64d4('0x16')](function(_0x4b3335){logger[_0x64d4('0x10')](_0x64d4('0x13'),_0x33b72d,_0x4b3335);_0x34d00a(_0x4b3335);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 283a280..7ef1597 100644 --- a/server/api/template/index.js +++ b/server/api/template/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x937d=['/:id','post','create','put','update','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x78864e,_0xe18d2e){var _0x199971=function(_0x38abdd){while(--_0x38abdd){_0x78864e['push'](_0x78864e['shift']());}};_0x199971(++_0xe18d2e);}(_0x937d,0x1f4));var _0xd937=function(_0x1bb45c,_0x234961){_0x1bb45c=_0x1bb45c-0x0;var _0x435435=_0x937d[_0x1bb45c];return _0x435435;};'use strict';var multer=require(_0xd937('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd937('0x1'));var router=express[_0xd937('0x2')]();var fs_extra=require(_0xd937('0x3'));var auth=require(_0xd937('0x4'));var interaction=require(_0xd937('0x5'));var config=require(_0xd937('0x6'));var controller=require('./template.controller');router[_0xd937('0x7')]('/',auth[_0xd937('0x8')](),controller[_0xd937('0x9')]);router['get'](_0xd937('0xa'),auth[_0xd937('0x8')](),controller['show']);router[_0xd937('0xb')]('/',auth[_0xd937('0x8')](),controller[_0xd937('0xc')]);router[_0xd937('0xd')](_0xd937('0xa'),auth['isAuthenticated'](),controller[_0xd937('0xe')]);router['delete'](_0xd937('0xa'),auth['isAuthenticated'](),controller[_0xd937('0xf')]);module[_0xd937('0x10')]=router; \ No newline at end of file +var _0x4b74=['post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','show'];(function(_0x5eec87,_0x274c43){var _0x9b9761=function(_0x22798a){while(--_0x22798a){_0x5eec87['push'](_0x5eec87['shift']());}};_0x9b9761(++_0x274c43);}(_0x4b74,0x103));var _0x44b7=function(_0x1395fa,_0xbae218){_0x1395fa=_0x1395fa-0x0;var _0xe8205a=_0x4b74[_0x1395fa];return _0xe8205a;};'use strict';var multer=require(_0x44b7('0x0'));var util=require(_0x44b7('0x1'));var path=require(_0x44b7('0x2'));var timeout=require('connect-timeout');var express=require(_0x44b7('0x3'));var router=express[_0x44b7('0x4')]();var fs_extra=require(_0x44b7('0x5'));var auth=require(_0x44b7('0x6'));var interaction=require(_0x44b7('0x7'));var config=require(_0x44b7('0x8'));var controller=require(_0x44b7('0x9'));router[_0x44b7('0xa')]('/',auth['isAuthenticated'](),controller[_0x44b7('0xb')]);router[_0x44b7('0xa')](_0x44b7('0xc'),auth['isAuthenticated'](),controller[_0x44b7('0xd')]);router[_0x44b7('0xe')]('/',auth[_0x44b7('0xf')](),controller['create']);router[_0x44b7('0x10')](_0x44b7('0xc'),auth['isAuthenticated'](),controller[_0x44b7('0x11')]);router[_0x44b7('0x12')]('/:id',auth[_0x44b7('0xf')](),controller[_0x44b7('0x13')]);module[_0x44b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 9ad438a..b023439 100644 --- a/server/api/template/template.attributes.js +++ b/server/api/template/template.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8f8=['STRING','exports'];(function(_0x497948,_0x4ca60c){var _0x39bb36=function(_0x2ec88e){while(--_0x2ec88e){_0x497948['push'](_0x497948['shift']());}};_0x39bb36(++_0x4ca60c);}(_0xf8f8,0x175));var _0x8f8f=function(_0x30ea35,_0x24874f){_0x30ea35=_0x30ea35-0x0;var _0xab87a4=_0xf8f8[_0x30ea35];return _0xab87a4;};'use strict';var Sequelize=require('sequelize');module[_0x8f8f('0x0')]={'name':{'type':Sequelize[_0x8f8f('0x1')]},'description':{'type':Sequelize[_0x8f8f('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x392f=['STRING','TEXT','exports'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0x392f,0xdd));var _0xf392=function(_0x5a7513,_0xa2742f){_0x5a7513=_0x5a7513-0x0;var _0x41af54=_0x392f[_0x5a7513];return _0x41af54;};'use strict';var Sequelize=require('sequelize');module[_0xf392('0x0')]={'name':{'type':Sequelize[_0xf392('0x1')]},'description':{'type':Sequelize[_0xf392('0x1')]},'html':{'type':Sequelize[_0xf392('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1d594b3..e81f37f 100644 --- a/server/api/template/template.controller.js +++ b/server/api/template/template.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6714=['rawAttributes','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','intersection','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','apply','reject','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name','index','map','Template'];(function(_0x3a68d6,_0x761439){var _0x3eacbd=function(_0x28e53e){while(--_0x28e53e){_0x3a68d6['push'](_0x3a68d6['shift']());}};_0x3eacbd(++_0x761439);}(_0x6714,0x174));var _0x4671=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x6714[_0x31172e];return _0x414ada;};'use strict';var emlformat=require(_0x4671('0x0'));var rimraf=require(_0x4671('0x1'));var zipdir=require(_0x4671('0x2'));var jsonpatch=require(_0x4671('0x3'));var rp=require(_0x4671('0x4'));var moment=require(_0x4671('0x5'));var BPromise=require(_0x4671('0x6'));var Mustache=require(_0x4671('0x7'));var util=require('util');var path=require(_0x4671('0x8'));var sox=require(_0x4671('0x9'));var csv=require('to-csv');var ejs=require(_0x4671('0xa'));var fs=require('fs');var fs_extra=require(_0x4671('0xb'));var _=require(_0x4671('0xc'));var squel=require(_0x4671('0xd'));var crypto=require('crypto');var jsforce=require(_0x4671('0xe'));var deskjs=require(_0x4671('0xf'));var toCsv=require(_0x4671('0x10'));var querystring=require(_0x4671('0x11'));var Papa=require(_0x4671('0x12'));var Redis=require(_0x4671('0x13'));var authService=require(_0x4671('0x14'));var qs=require(_0x4671('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4671('0x16'));var logger=require(_0x4671('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4671('0x18'));var db=require(_0x4671('0x19'))['db'];function respondWithStatusCode(_0x29e4ef,_0x30c333){_0x30c333=_0x30c333||0xcc;return function(_0x13ff9b){if(_0x13ff9b){return _0x29e4ef['sendStatus'](_0x30c333);}return _0x29e4ef[_0x4671('0x1a')](_0x30c333)[_0x4671('0x1b')]();};}function respondWithResult(_0x5af602,_0x1cfb59){_0x1cfb59=_0x1cfb59||0xc8;return function(_0x50eb8){if(_0x50eb8){return _0x5af602['status'](_0x1cfb59)[_0x4671('0x1c')](_0x50eb8);}};}function respondWithFilteredResult(_0x4dcce0,_0x465af1){return function(_0x4ca895){if(_0x4ca895){var _0x257384=typeof _0x465af1['offset']===_0x4671('0x1d')&&typeof _0x465af1[_0x4671('0x1e')]===_0x4671('0x1d');var _0x24c5ac=_0x4ca895['count'];var _0x44b20e=_0x257384?0x0:_0x465af1[_0x4671('0x1f')];var _0x55ce9f=_0x257384?_0x4ca895['count']:_0x465af1[_0x4671('0x1f')]+_0x465af1[_0x4671('0x1e')];var _0x755375;if(_0x55ce9f>=_0x24c5ac){_0x55ce9f=_0x24c5ac;_0x755375=0xc8;}else{_0x755375=0xce;}_0x4dcce0[_0x4671('0x1a')](_0x755375);return _0x4dcce0[_0x4671('0x20')]('Content-Range',_0x44b20e+'-'+_0x55ce9f+'/'+_0x24c5ac)['json'](_0x4ca895);}return null;};}function patchUpdates(_0x42eae7){return function(_0x511d40){try{jsonpatch[_0x4671('0x21')](_0x511d40,_0x42eae7,!![]);}catch(_0x13fd01){return BPromise[_0x4671('0x22')](_0x13fd01);}return _0x511d40['save']();};}function saveUpdates(_0x2c2068,_0x537b87){return function(_0x4cc142){if(_0x4cc142){return _0x4cc142[_0x4671('0x23')](_0x2c2068)[_0x4671('0x24')](function(_0x76e683){return _0x76e683;});}return null;};}function removeEntity(_0x54e22a,_0x4aa030){return function(_0x3046a6){if(_0x3046a6){return _0x3046a6[_0x4671('0x25')]()[_0x4671('0x24')](function(){var _0x27d863=_0x3046a6[_0x4671('0x26')]({'plain':!![]});var _0x4b2f5f=_0x4671('0x27');return db[_0x4671('0x28')][_0x4671('0x25')]({'where':{'type':_0x4b2f5f,'resourceId':_0x27d863['id']}})[_0x4671('0x24')](function(){return _0x3046a6;});})[_0x4671('0x24')](function(){_0x54e22a[_0x4671('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22dcf2,_0xec6c38){return function(_0x2997ef){if(!_0x2997ef){_0x22dcf2[_0x4671('0x29')](0x194);}return _0x2997ef;};}function handleError(_0x5692a6,_0x4da457){_0x4da457=_0x4da457||0x1f4;return function(_0x383479){logger[_0x4671('0x2a')](_0x383479[_0x4671('0x2b')]);if(_0x383479[_0x4671('0x2c')]){delete _0x383479[_0x4671('0x2c')];}_0x5692a6[_0x4671('0x1a')](_0x4da457)['send'](_0x383479);};}exports[_0x4671('0x2d')]=function(_0x2991f0,_0x5e5726){var _0x55253f={},_0x4c948f={},_0x12fa32={'count':0x0,'rows':[]};var _0x4ae850=_[_0x4671('0x2e')](db[_0x4671('0x2f')][_0x4671('0x30')],function(_0x268a75){return{'name':_0x268a75[_0x4671('0x31')],'type':_0x268a75['type'][_0x4671('0x32')]};});_0x4c948f[_0x4671('0x33')]=_['map'](_0x4ae850,_0x4671('0x2c'));_0x4c948f['query']=_['keys'](_0x2991f0[_0x4671('0x34')]);_0x4c948f[_0x4671('0x35')]=_['intersection'](_0x4c948f[_0x4671('0x33')],_0x4c948f[_0x4671('0x34')]);_0x55253f[_0x4671('0x36')]=_['intersection'](_0x4c948f[_0x4671('0x33')],qs[_0x4671('0x37')](_0x2991f0['query'][_0x4671('0x37')]));_0x55253f[_0x4671('0x36')]=_0x55253f['attributes']['length']?_0x55253f[_0x4671('0x36')]:_0x4c948f[_0x4671('0x33')];if(!_0x2991f0[_0x4671('0x34')][_0x4671('0x38')]('nolimit')){_0x55253f[_0x4671('0x1e')]=qs[_0x4671('0x1e')](_0x2991f0[_0x4671('0x34')][_0x4671('0x1e')]);_0x55253f[_0x4671('0x1f')]=qs[_0x4671('0x1f')](_0x2991f0[_0x4671('0x34')]['offset']);}_0x55253f['order']=qs[_0x4671('0x39')](_0x2991f0['query']['sort']);_0x55253f[_0x4671('0x3a')]=qs[_0x4671('0x35')](_[_0x4671('0x3b')](_0x2991f0['query'],_0x4c948f['filters']),_0x4ae850);if(_0x2991f0['query'][_0x4671('0x3c')]){_0x55253f['where']=_[_0x4671('0x3d')](_0x55253f[_0x4671('0x3a')],{'$or':_[_0x4671('0x2e')](_0x4ae850,function(_0x54c549){if(_0x54c549[_0x4671('0x3e')]!==_0x4671('0x3f')){var _0x4195a9={};_0x4195a9[_0x54c549['name']]={'$like':'%'+_0x2991f0[_0x4671('0x34')][_0x4671('0x3c')]+'%'};return _0x4195a9;}})});}_0x55253f=_[_0x4671('0x3d')]({},_0x55253f,_0x2991f0[_0x4671('0x40')]);var _0x57042e={'where':_0x55253f[_0x4671('0x3a')]};return db[_0x4671('0x2f')][_0x4671('0x41')](_0x57042e)[_0x4671('0x24')](function(_0x158f75){_0x12fa32['count']=_0x158f75;if(_0x2991f0[_0x4671('0x34')][_0x4671('0x42')]){_0x55253f[_0x4671('0x43')]=[{'all':!![]}];}return db['Template'][_0x4671('0x44')](_0x55253f);})[_0x4671('0x24')](function(_0x3c04ab){_0x12fa32[_0x4671('0x45')]=_0x3c04ab;return _0x12fa32;})[_0x4671('0x24')](respondWithFilteredResult(_0x5e5726,_0x55253f))[_0x4671('0x46')](handleError(_0x5e5726,null));};exports['show']=function(_0x1cb506,_0x55ed6f){var _0xf2bc74={'raw':!![],'where':{'id':_0x1cb506[_0x4671('0x47')]['id']}},_0x18948c={};_0x18948c['model']=_[_0x4671('0x48')](db['Template'][_0x4671('0x30')]);_0x18948c['query']=_[_0x4671('0x48')](_0x1cb506[_0x4671('0x34')]);_0x18948c[_0x4671('0x35')]=_['intersection'](_0x18948c[_0x4671('0x33')],_0x18948c['query']);_0xf2bc74[_0x4671('0x36')]=_[_0x4671('0x49')](_0x18948c[_0x4671('0x33')],qs[_0x4671('0x37')](_0x1cb506[_0x4671('0x34')][_0x4671('0x37')]));_0xf2bc74[_0x4671('0x36')]=_0xf2bc74[_0x4671('0x36')][_0x4671('0x4a')]?_0xf2bc74[_0x4671('0x36')]:_0x18948c[_0x4671('0x33')];if(_0x1cb506[_0x4671('0x34')][_0x4671('0x42')]){_0xf2bc74[_0x4671('0x43')]=[{'all':!![]}];}_0xf2bc74=_[_0x4671('0x3d')]({},_0xf2bc74,_0x1cb506[_0x4671('0x40')]);return db['Template']['find'](_0xf2bc74)['then'](handleEntityNotFound(_0x55ed6f,null))[_0x4671('0x24')](respondWithResult(_0x55ed6f,null))[_0x4671('0x46')](handleError(_0x55ed6f,null));};exports[_0x4671('0x4b')]=function(_0x4bc80d,_0x4e3e41){return db[_0x4671('0x2f')][_0x4671('0x4b')](_0x4bc80d['body'],{})[_0x4671('0x24')](function(_0xf14d0){var _0x317f86=_0x4bc80d['user'][_0x4671('0x26')]({'plain':!![]});if(!_0x317f86)throw new Error(_0x4671('0x4c'));if(_0x317f86[_0x4671('0x4d')]===_0x4671('0x4e')){var _0x35491c=_0xf14d0['get']({'plain':!![]});var _0x577c91='Templates';return db['UserProfileSection'][_0x4671('0x4f')]({'where':{'name':_0x577c91,'userProfileId':_0x317f86[_0x4671('0x50')]},'raw':!![]})['then'](function(_0x391a8b){if(_0x391a8b&&_0x391a8b[_0x4671('0x51')]===0x0){return db[_0x4671('0x28')][_0x4671('0x4b')]({'name':_0x35491c['name'],'resourceId':_0x35491c['id'],'type':_0x391a8b[_0x4671('0x2c')],'sectionId':_0x391a8b['id']},{})[_0x4671('0x24')](function(){return _0xf14d0;});}else{return _0xf14d0;}})[_0x4671('0x46')](function(_0x16fd6f){logger[_0x4671('0x2a')](_0x4671('0x52'),_0x16fd6f);throw _0x16fd6f;});}return _0xf14d0;})['then'](respondWithResult(_0x4e3e41,0xc9))[_0x4671('0x46')](handleError(_0x4e3e41,null));};exports[_0x4671('0x23')]=function(_0x5d235f,_0x3cd69a){if(_0x5d235f[_0x4671('0x53')]['id']){delete _0x5d235f[_0x4671('0x53')]['id'];}return db[_0x4671('0x2f')][_0x4671('0x4f')]({'where':{'id':_0x5d235f[_0x4671('0x47')]['id']}})[_0x4671('0x24')](handleEntityNotFound(_0x3cd69a,null))['then'](saveUpdates(_0x5d235f['body'],null))[_0x4671('0x24')](respondWithResult(_0x3cd69a,null))[_0x4671('0x46')](handleError(_0x3cd69a,null));};exports[_0x4671('0x25')]=function(_0x6ba59f,_0x27cae1){return db[_0x4671('0x2f')][_0x4671('0x4f')]({'where':{'id':_0x6ba59f[_0x4671('0x47')]['id']}})[_0x4671('0x24')](handleEntityNotFound(_0x27cae1,null))[_0x4671('0x24')](removeEntity(_0x27cae1,null))[_0x4671('0x46')](handleError(_0x27cae1,null));}; \ No newline at end of file +var _0xb926=['limit','undefined','count','offset','set','Content-Range','apply','reject','then','get','Templates','UserProfileResource','error','index','map','Template','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','name','options','findAll','rows','catch','show','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x39ee06,_0x35cb0e){var _0x3ae144=function(_0x5703d7){while(--_0x5703d7){_0x39ee06['push'](_0x39ee06['shift']());}};_0x3ae144(++_0x35cb0e);}(_0xb926,0x1bc));var _0x6b92=function(_0x8ebeef,_0x19fa18){_0x8ebeef=_0x8ebeef-0x0;var _0x2a856d=_0xb926[_0x8ebeef];return _0x2a856d;};'use strict';var emlformat=require(_0x6b92('0x0'));var rimraf=require(_0x6b92('0x1'));var zipdir=require(_0x6b92('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b92('0x3'));var BPromise=require(_0x6b92('0x4'));var Mustache=require(_0x6b92('0x5'));var util=require(_0x6b92('0x6'));var path=require(_0x6b92('0x7'));var sox=require(_0x6b92('0x8'));var csv=require('to-csv');var ejs=require(_0x6b92('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b92('0xa'));var squel=require(_0x6b92('0xb'));var crypto=require(_0x6b92('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6b92('0xd'));var toCsv=require(_0x6b92('0xe'));var querystring=require(_0x6b92('0xf'));var Papa=require(_0x6b92('0x10'));var Redis=require('ioredis');var authService=require(_0x6b92('0x11'));var qs=require(_0x6b92('0x12'));var as=require(_0x6b92('0x13'));var hardwareService=require(_0x6b92('0x14'));var logger=require(_0x6b92('0x15'))('api');var utils=require(_0x6b92('0x16'));var config=require(_0x6b92('0x17'));var licenseUtil=require(_0x6b92('0x18'));var db=require(_0x6b92('0x19'))['db'];function respondWithStatusCode(_0x526b63,_0xb0a955){_0xb0a955=_0xb0a955||0xcc;return function(_0x33df25){if(_0x33df25){return _0x526b63[_0x6b92('0x1a')](_0xb0a955);}return _0x526b63[_0x6b92('0x1b')](_0xb0a955)[_0x6b92('0x1c')]();};}function respondWithResult(_0x162ec7,_0x2a20ba){_0x2a20ba=_0x2a20ba||0xc8;return function(_0x1e1a5a){if(_0x1e1a5a){return _0x162ec7[_0x6b92('0x1b')](_0x2a20ba)[_0x6b92('0x1d')](_0x1e1a5a);}};}function respondWithFilteredResult(_0x2972f4,_0x3a9b16){return function(_0x54f4e9){if(_0x54f4e9){var _0x26d467=typeof _0x3a9b16['offset']==='undefined'&&typeof _0x3a9b16[_0x6b92('0x1e')]===_0x6b92('0x1f');var _0x364628=_0x54f4e9['count'];var _0x4f6cdb=_0x26d467?0x0:_0x3a9b16['offset'];var _0x42e04a=_0x26d467?_0x54f4e9[_0x6b92('0x20')]:_0x3a9b16[_0x6b92('0x21')]+_0x3a9b16[_0x6b92('0x1e')];var _0x251080;if(_0x42e04a>=_0x364628){_0x42e04a=_0x364628;_0x251080=0xc8;}else{_0x251080=0xce;}_0x2972f4[_0x6b92('0x1b')](_0x251080);return _0x2972f4[_0x6b92('0x22')](_0x6b92('0x23'),_0x4f6cdb+'-'+_0x42e04a+'/'+_0x364628)[_0x6b92('0x1d')](_0x54f4e9);}return null;};}function patchUpdates(_0x19058d){return function(_0x246c0b){try{jsonpatch[_0x6b92('0x24')](_0x246c0b,_0x19058d,!![]);}catch(_0x2aae29){return BPromise[_0x6b92('0x25')](_0x2aae29);}return _0x246c0b['save']();};}function saveUpdates(_0x1cfac3,_0x4d8815){return function(_0x28f067){if(_0x28f067){return _0x28f067['update'](_0x1cfac3)[_0x6b92('0x26')](function(_0x2ae533){return _0x2ae533;});}return null;};}function removeEntity(_0x507a78,_0x53383e){return function(_0x4d427d){if(_0x4d427d){return _0x4d427d['destroy']()[_0x6b92('0x26')](function(){var _0x6540e0=_0x4d427d[_0x6b92('0x27')]({'plain':!![]});var _0xcff0ec=_0x6b92('0x28');return db[_0x6b92('0x29')]['destroy']({'where':{'type':_0xcff0ec,'resourceId':_0x6540e0['id']}})[_0x6b92('0x26')](function(){return _0x4d427d;});})[_0x6b92('0x26')](function(){_0x507a78[_0x6b92('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f6bc,_0x316417){return function(_0x5917cf){if(!_0x5917cf){_0x45f6bc[_0x6b92('0x1a')](0x194);}return _0x5917cf;};}function handleError(_0x5081f9,_0x88e7a1){_0x88e7a1=_0x88e7a1||0x1f4;return function(_0x23ff73){logger[_0x6b92('0x2a')](_0x23ff73['stack']);if(_0x23ff73['name']){delete _0x23ff73['name'];}_0x5081f9[_0x6b92('0x1b')](_0x88e7a1)['send'](_0x23ff73);};}exports[_0x6b92('0x2b')]=function(_0x484d68,_0x5e0b52){var _0xa9611={},_0x461d8b={},_0x3c83fe={'count':0x0,'rows':[]};var _0x2bc309=_[_0x6b92('0x2c')](db[_0x6b92('0x2d')][_0x6b92('0x2e')],function(_0x33e5bb){return{'name':_0x33e5bb['fieldName'],'type':_0x33e5bb[_0x6b92('0x2f')][_0x6b92('0x30')]};});_0x461d8b['model']=_[_0x6b92('0x2c')](_0x2bc309,'name');_0x461d8b[_0x6b92('0x31')]=_['keys'](_0x484d68['query']);_0x461d8b[_0x6b92('0x32')]=_[_0x6b92('0x33')](_0x461d8b[_0x6b92('0x34')],_0x461d8b[_0x6b92('0x31')]);_0xa9611[_0x6b92('0x35')]=_[_0x6b92('0x33')](_0x461d8b[_0x6b92('0x34')],qs[_0x6b92('0x36')](_0x484d68[_0x6b92('0x31')][_0x6b92('0x36')]));_0xa9611['attributes']=_0xa9611[_0x6b92('0x35')]['length']?_0xa9611[_0x6b92('0x35')]:_0x461d8b[_0x6b92('0x34')];if(!_0x484d68['query']['hasOwnProperty'](_0x6b92('0x37'))){_0xa9611[_0x6b92('0x1e')]=qs[_0x6b92('0x1e')](_0x484d68['query'][_0x6b92('0x1e')]);_0xa9611[_0x6b92('0x21')]=qs['offset'](_0x484d68[_0x6b92('0x31')]['offset']);}_0xa9611[_0x6b92('0x38')]=qs[_0x6b92('0x39')](_0x484d68[_0x6b92('0x31')][_0x6b92('0x39')]);_0xa9611[_0x6b92('0x3a')]=qs['filters'](_['pick'](_0x484d68[_0x6b92('0x31')],_0x461d8b[_0x6b92('0x32')]),_0x2bc309);if(_0x484d68[_0x6b92('0x31')][_0x6b92('0x3b')]){_0xa9611['where']=_[_0x6b92('0x3c')](_0xa9611[_0x6b92('0x3a')],{'$or':_[_0x6b92('0x2c')](_0x2bc309,function(_0x55953e){if(_0x55953e[_0x6b92('0x2f')]!=='VIRTUAL'){var _0xf4e3c0={};_0xf4e3c0[_0x55953e[_0x6b92('0x3d')]]={'$like':'%'+_0x484d68[_0x6b92('0x31')][_0x6b92('0x3b')]+'%'};return _0xf4e3c0;}})});}_0xa9611=_['merge']({},_0xa9611,_0x484d68[_0x6b92('0x3e')]);var _0x24feb4={'where':_0xa9611[_0x6b92('0x3a')]};return db['Template'][_0x6b92('0x20')](_0x24feb4)['then'](function(_0x303b48){_0x3c83fe[_0x6b92('0x20')]=_0x303b48;if(_0x484d68[_0x6b92('0x31')]['includeAll']){_0xa9611['include']=[{'all':!![]}];}return db[_0x6b92('0x2d')][_0x6b92('0x3f')](_0xa9611);})[_0x6b92('0x26')](function(_0xa8c25){_0x3c83fe[_0x6b92('0x40')]=_0xa8c25;return _0x3c83fe;})['then'](respondWithFilteredResult(_0x5e0b52,_0xa9611))[_0x6b92('0x41')](handleError(_0x5e0b52,null));};exports[_0x6b92('0x42')]=function(_0x323052,_0xd40091){var _0xedecb8={'raw':!![],'where':{'id':_0x323052['params']['id']}},_0x2c6ee3={};_0x2c6ee3[_0x6b92('0x34')]=_['keys'](db[_0x6b92('0x2d')][_0x6b92('0x2e')]);_0x2c6ee3[_0x6b92('0x31')]=_['keys'](_0x323052[_0x6b92('0x31')]);_0x2c6ee3[_0x6b92('0x32')]=_['intersection'](_0x2c6ee3[_0x6b92('0x34')],_0x2c6ee3['query']);_0xedecb8[_0x6b92('0x35')]=_[_0x6b92('0x33')](_0x2c6ee3[_0x6b92('0x34')],qs[_0x6b92('0x36')](_0x323052[_0x6b92('0x31')][_0x6b92('0x36')]));_0xedecb8['attributes']=_0xedecb8[_0x6b92('0x35')][_0x6b92('0x43')]?_0xedecb8[_0x6b92('0x35')]:_0x2c6ee3[_0x6b92('0x34')];if(_0x323052[_0x6b92('0x31')][_0x6b92('0x44')]){_0xedecb8[_0x6b92('0x45')]=[{'all':!![]}];}_0xedecb8=_[_0x6b92('0x3c')]({},_0xedecb8,_0x323052['options']);return db[_0x6b92('0x2d')][_0x6b92('0x46')](_0xedecb8)[_0x6b92('0x26')](handleEntityNotFound(_0xd40091,null))[_0x6b92('0x26')](respondWithResult(_0xd40091,null))[_0x6b92('0x41')](handleError(_0xd40091,null));};exports[_0x6b92('0x47')]=function(_0xc981f4,_0x27c0b8){return db[_0x6b92('0x2d')]['create'](_0xc981f4[_0x6b92('0x48')],{})[_0x6b92('0x26')](function(_0x1dd40e){var _0x19935a=_0xc981f4[_0x6b92('0x49')][_0x6b92('0x27')]({'plain':!![]});if(!_0x19935a)throw new Error(_0x6b92('0x4a'));if(_0x19935a['role']==='user'){var _0x1df2b6=_0x1dd40e[_0x6b92('0x27')]({'plain':!![]});var _0x2d4180='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x2d4180,'userProfileId':_0x19935a[_0x6b92('0x4b')]},'raw':!![]})[_0x6b92('0x26')](function(_0x2606a5){if(_0x2606a5&&_0x2606a5[_0x6b92('0x4c')]===0x0){return db[_0x6b92('0x29')][_0x6b92('0x47')]({'name':_0x1df2b6[_0x6b92('0x3d')],'resourceId':_0x1df2b6['id'],'type':_0x2606a5[_0x6b92('0x3d')],'sectionId':_0x2606a5['id']},{})[_0x6b92('0x26')](function(){return _0x1dd40e;});}else{return _0x1dd40e;}})[_0x6b92('0x41')](function(_0x597116){logger[_0x6b92('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x597116);throw _0x597116;});}return _0x1dd40e;})[_0x6b92('0x26')](respondWithResult(_0x27c0b8,0xc9))['catch'](handleError(_0x27c0b8,null));};exports[_0x6b92('0x4d')]=function(_0x42621f,_0x3a88de){if(_0x42621f[_0x6b92('0x48')]['id']){delete _0x42621f[_0x6b92('0x48')]['id'];}return db[_0x6b92('0x2d')]['find']({'where':{'id':_0x42621f['params']['id']}})[_0x6b92('0x26')](handleEntityNotFound(_0x3a88de,null))[_0x6b92('0x26')](saveUpdates(_0x42621f[_0x6b92('0x48')],null))[_0x6b92('0x26')](respondWithResult(_0x3a88de,null))[_0x6b92('0x41')](handleError(_0x3a88de,null));};exports['destroy']=function(_0x16e325,_0x3f3d1c){return db[_0x6b92('0x2d')][_0x6b92('0x46')]({'where':{'id':_0x16e325[_0x6b92('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f3d1c,null))[_0x6b92('0x26')](removeEntity(_0x3f3d1c,null))[_0x6b92('0x41')](handleError(_0x3f3d1c,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 72e1434..4cd09ee 100644 --- a/server/api/template/template.model.js +++ b/server/api/template/template.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84f0=['rimraf','exports','Template','util','../../config/logger','api','moment','request-promise','path'];(function(_0x9a1c65,_0x452418){var _0x3c6ae5=function(_0xb1694a){while(--_0xb1694a){_0x9a1c65['push'](_0x9a1c65['shift']());}};_0x3c6ae5(++_0x452418);}(_0x84f0,0x16b));var _0x084f=function(_0x4905a2,_0x53c4f9){_0x4905a2=_0x4905a2-0x0;var _0x4432b6=_0x84f0[_0x4905a2];return _0x4432b6;};'use strict';var _=require('lodash');var util=require(_0x084f('0x0'));var logger=require(_0x084f('0x1'))(_0x084f('0x2'));var moment=require(_0x084f('0x3'));var BPromise=require('bluebird');var rp=require(_0x084f('0x4'));var fs=require('fs');var path=require(_0x084f('0x5'));var rimraf=require(_0x084f('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x084f('0x7')]=function(_0x1b667f,_0x3d190c){return _0x1b667f['define'](_0x084f('0x8'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x743a=['request-promise','path','rimraf','../../config/environment','./template.attributes','Template','lodash','../../config/logger','api','moment','bluebird'];(function(_0x138c62,_0xad1c81){var _0x43f5ea=function(_0xc67314){while(--_0xc67314){_0x138c62['push'](_0x138c62['shift']());}};_0x43f5ea(++_0xad1c81);}(_0x743a,0x1c9));var _0xa743=function(_0x274285,_0x35309d){_0x274285=_0x274285-0x0;var _0x597a77=_0x743a[_0x274285];return _0x597a77;};'use strict';var _=require(_0xa743('0x0'));var util=require('util');var logger=require(_0xa743('0x1'))(_0xa743('0x2'));var moment=require(_0xa743('0x3'));var BPromise=require(_0xa743('0x4'));var rp=require(_0xa743('0x5'));var fs=require('fs');var path=require(_0xa743('0x6'));var rimraf=require(_0xa743('0x7'));var config=require(_0xa743('0x8'));var attributes=require(_0xa743('0x9'));module['exports']=function(_0x22051b,_0x17c77c){return _0x22051b['define'](_0xa743('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index ff0de73..b5602ac 100644 --- a/server/api/template/template.rpc.js +++ b/server/api/template/template.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b29=['GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','result'];(function(_0x18dcca,_0x2b2db6){var _0x303936=function(_0x4b0322){while(--_0x4b0322){_0x18dcca['push'](_0x18dcca['shift']());}};_0x303936(++_0x2b2db6);}(_0x2b29,0x135));var _0x92b2=function(_0x31ef1a,_0x3fa96f){_0x31ef1a=_0x31ef1a-0x0;var _0x2586ae=_0x2b29[_0x31ef1a];return _0x2586ae;};'use strict';var _=require(_0x92b2('0x0'));var util=require('util');var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92b2('0x3'));var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))('rpc');var config=require(_0x92b2('0x7'));var jayson=require(_0x92b2('0x8'));var client=jayson['client'][_0x92b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542994,_0x54874e,_0x18b8c1){return new BPromise(function(_0x40375b,_0x5d23f3){return client[_0x92b2('0xa')](_0x542994,_0x18b8c1)[_0x92b2('0xb')](function(_0x1bbb38){logger[_0x92b2('0xc')]('Template,\x20%s,\x20%s',_0x54874e,_0x92b2('0xd'));logger[_0x92b2('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x54874e,_0x92b2('0xd'),JSON[_0x92b2('0xf')](_0x1bbb38));if(_0x1bbb38[_0x92b2('0x10')]){if(_0x1bbb38['error'][_0x92b2('0x11')]===0x1f4){logger[_0x92b2('0x10')](_0x92b2('0x12'),_0x54874e,_0x1bbb38[_0x92b2('0x10')][_0x92b2('0x13')]);return _0x5d23f3(_0x1bbb38[_0x92b2('0x10')][_0x92b2('0x13')]);}logger['error']('Template,\x20%s,\x20%s',_0x54874e,_0x1bbb38['error']['message']);return _0x40375b(_0x1bbb38[_0x92b2('0x10')][_0x92b2('0x13')]);}else{logger[_0x92b2('0xc')](_0x92b2('0x12'),_0x54874e,_0x92b2('0xd'));_0x40375b(_0x1bbb38[_0x92b2('0x14')][_0x92b2('0x13')]);}})['catch'](function(_0x5cf4db){logger['error'](_0x92b2('0x12'),_0x54874e,_0x5cf4db);_0x5d23f3(_0x5cf4db);});});}exports[_0x92b2('0x15')]=function(_0xca7ba0){var _0x1d5d76=this;return new Promise(function(_0x177ad2,_0x539d73){return db[_0x92b2('0x16')][_0x92b2('0x17')]({'raw':_0xca7ba0[_0x92b2('0x18')]?_0xca7ba0[_0x92b2('0x18')][_0x92b2('0x19')]===undefined?!![]:![]:!![],'where':_0xca7ba0['options']?_0xca7ba0[_0x92b2('0x18')][_0x92b2('0x1a')]||null:null,'attributes':_0xca7ba0[_0x92b2('0x18')]?_0xca7ba0[_0x92b2('0x18')][_0x92b2('0x1b')]||null:null,'limit':_0xca7ba0[_0x92b2('0x18')]?_0xca7ba0[_0x92b2('0x18')][_0x92b2('0x1c')]||null:null,'include':_0xca7ba0[_0x92b2('0x18')]?_0xca7ba0[_0x92b2('0x18')][_0x92b2('0x1d')]?_[_0x92b2('0x1e')](_0xca7ba0[_0x92b2('0x18')]['include'],function(_0xfa13bb){return{'model':db[_0xfa13bb[_0x92b2('0x1f')]],'as':_0xfa13bb['as'],'attributes':_0xfa13bb[_0x92b2('0x1b')],'include':_0xfa13bb[_0x92b2('0x1d')]?_[_0x92b2('0x1e')](_0xfa13bb['include'],function(_0x5421b2){return{'model':db[_0x5421b2[_0x92b2('0x1f')]],'as':_0x5421b2['as'],'attributes':_0x5421b2[_0x92b2('0x1b')],'include':_0x5421b2[_0x92b2('0x1d')]?_[_0x92b2('0x1e')](_0x5421b2['include'],function(_0x23534c){return{'model':db[_0x23534c['model']],'as':_0x23534c['as'],'attributes':_0x23534c[_0x92b2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x92b2('0xb')](function(_0x3430e6){logger[_0x92b2('0xc')](_0x92b2('0x15'),_0xca7ba0);logger[_0x92b2('0xe')]('GetTemplate',_0xca7ba0,JSON[_0x92b2('0xf')](_0x3430e6));_0x177ad2(_0x3430e6);})[_0x92b2('0x20')](function(_0x846102){logger[_0x92b2('0x10')](_0x92b2('0x15'),_0x846102[_0x92b2('0x13')],_0xca7ba0);_0x539d73(_0x1d5d76[_0x92b2('0x10')](0x1f4,_0x846102['message']));});});}; \ No newline at end of file +var _0x036d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Template','options','raw','where','attributes','limit','include','map','model','then','GetTemplate','util'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x036d,0xf7));var _0xd036=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x036d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd036('0x0'));var moment=require(_0xd036('0x1'));var BPromise=require(_0xd036('0x2'));var rs=require(_0xd036('0x3'));var fs=require('fs');var Redis=require(_0xd036('0x4'));var db=require(_0xd036('0x5'))['db'];var utils=require(_0xd036('0x6'));var logger=require('../../config/logger')(_0xd036('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd036('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16a258,_0x4c2b7c,_0x438ea3){return new BPromise(function(_0x32481f,_0x30c431){return client[_0xd036('0x9')](_0x16a258,_0x438ea3)['then'](function(_0x453f07){logger[_0xd036('0xa')](_0xd036('0xb'),_0x4c2b7c,_0xd036('0xc'));logger[_0xd036('0xd')]('Template,\x20%s,\x20%s,\x20%s',_0x4c2b7c,_0xd036('0xc'),JSON[_0xd036('0xe')](_0x453f07));if(_0x453f07[_0xd036('0xf')]){if(_0x453f07['error'][_0xd036('0x10')]===0x1f4){logger[_0xd036('0xf')](_0xd036('0xb'),_0x4c2b7c,_0x453f07['error'][_0xd036('0x11')]);return _0x30c431(_0x453f07['error']['message']);}logger[_0xd036('0xf')](_0xd036('0xb'),_0x4c2b7c,_0x453f07[_0xd036('0xf')][_0xd036('0x11')]);return _0x32481f(_0x453f07[_0xd036('0xf')][_0xd036('0x11')]);}else{logger[_0xd036('0xa')]('Template,\x20%s,\x20%s',_0x4c2b7c,_0xd036('0xc'));_0x32481f(_0x453f07[_0xd036('0x12')]['message']);}})[_0xd036('0x13')](function(_0x51f7f3){logger['error'](_0xd036('0xb'),_0x4c2b7c,_0x51f7f3);_0x30c431(_0x51f7f3);});});}exports['GetTemplate']=function(_0x104cf7){var _0x3debe6=this;return new Promise(function(_0xe663b9,_0x5b048e){return db[_0xd036('0x14')]['findAll']({'raw':_0x104cf7['options']?_0x104cf7[_0xd036('0x15')][_0xd036('0x16')]===undefined?!![]:![]:!![],'where':_0x104cf7[_0xd036('0x15')]?_0x104cf7[_0xd036('0x15')][_0xd036('0x17')]||null:null,'attributes':_0x104cf7[_0xd036('0x15')]?_0x104cf7['options'][_0xd036('0x18')]||null:null,'limit':_0x104cf7[_0xd036('0x15')]?_0x104cf7[_0xd036('0x15')][_0xd036('0x19')]||null:null,'include':_0x104cf7[_0xd036('0x15')]?_0x104cf7[_0xd036('0x15')][_0xd036('0x1a')]?_[_0xd036('0x1b')](_0x104cf7[_0xd036('0x15')]['include'],function(_0x5ac1c4){return{'model':db[_0x5ac1c4[_0xd036('0x1c')]],'as':_0x5ac1c4['as'],'attributes':_0x5ac1c4[_0xd036('0x18')],'include':_0x5ac1c4[_0xd036('0x1a')]?_[_0xd036('0x1b')](_0x5ac1c4[_0xd036('0x1a')],function(_0x4422b4){return{'model':db[_0x4422b4['model']],'as':_0x4422b4['as'],'attributes':_0x4422b4[_0xd036('0x18')],'include':_0x4422b4[_0xd036('0x1a')]?_[_0xd036('0x1b')](_0x4422b4[_0xd036('0x1a')],function(_0x2fb94c){return{'model':db[_0x2fb94c[_0xd036('0x1c')]],'as':_0x2fb94c['as'],'attributes':_0x2fb94c[_0xd036('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd036('0x1d')](function(_0xf5d2cd){logger[_0xd036('0xa')](_0xd036('0x1e'),_0x104cf7);logger[_0xd036('0xd')](_0xd036('0x1e'),_0x104cf7,JSON[_0xd036('0xe')](_0xf5d2cd));_0xe663b9(_0xf5d2cd);})[_0xd036('0x13')](function(_0x58cc12){logger[_0xd036('0xf')](_0xd036('0x1e'),_0x58cc12['message'],_0x104cf7);_0x5b048e(_0x3debe6[_0xd036('0xf')](0x1f4,_0x58cc12[_0xd036('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8169dfb..dc069c8 100644 --- a/server/api/trigger/index.js +++ b/server/api/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1aa=['get','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAction','put','/:id','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','isAuthenticated','index','show','/:id/all_conditions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1aa,0xfc));var _0xae1a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe1aa[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xae1a('0x2'));var router=express[_0xae1a('0x3')]();var fs_extra=require(_0xae1a('0x4'));var auth=require(_0xae1a('0x5'));var interaction=require(_0xae1a('0x6'));var config=require('../../config/environment');var controller=require(_0xae1a('0x7'));router['get']('/',auth[_0xae1a('0x8')](),controller[_0xae1a('0x9')]);router['get']('/:id',auth[_0xae1a('0x8')](),controller[_0xae1a('0xa')]);router['get'](_0xae1a('0xb'),auth[_0xae1a('0x8')](),controller['getAllConditions']);router[_0xae1a('0xc')](_0xae1a('0xd'),auth[_0xae1a('0x8')](),controller[_0xae1a('0xe')]);router['get'](_0xae1a('0xf'),auth[_0xae1a('0x8')](),controller['getActions']);router[_0xae1a('0x10')]('/',auth[_0xae1a('0x8')](),controller[_0xae1a('0x11')]);router[_0xae1a('0x10')](_0xae1a('0xb'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x12')]);router[_0xae1a('0x10')](_0xae1a('0xd'),auth[_0xae1a('0x8')](),controller['addAnyCondition']);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0xae1a('0x13')]);router[_0xae1a('0x14')](_0xae1a('0x15'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x16')]);router['delete'](_0xae1a('0x15'),auth[_0xae1a('0x8')](),controller['destroy']);module[_0xae1a('0x17')]=router; \ No newline at end of file +var _0xed3c=['connect-timeout','Router','fs-extra','../../components/auth/service','./trigger.controller','get','isAuthenticated','index','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','/:id/all_conditions','addAllCondition','addAction','/:id','delete','destroy','multer','util','path'];(function(_0x32825e,_0x5981c1){var _0x119578=function(_0x40ce3d){while(--_0x40ce3d){_0x32825e['push'](_0x32825e['shift']());}};_0x119578(++_0x5981c1);}(_0xed3c,0x1a6));var _0xced3=function(_0xdbec0a,_0xc83316){_0xdbec0a=_0xdbec0a-0x0;var _0x45175d=_0xed3c[_0xdbec0a];return _0x45175d;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xced3('0xc')]);router[_0xced3('0x8')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router['get'](_0xced3('0xf'),auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);router['post']('/',auth[_0xced3('0x9')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')](_0xced3('0x13'),auth[_0xced3('0x9')](),controller[_0xced3('0x14')]);router[_0xced3('0x12')]('/:id/any_conditions',auth[_0xced3('0x9')](),controller['addAnyCondition']);router[_0xced3('0x12')](_0xced3('0xf'),auth[_0xced3('0x9')](),controller[_0xced3('0x15')]);router['put'](_0xced3('0x16'),auth[_0xced3('0x9')](),controller['update']);router[_0xced3('0x17')](_0xced3('0x16'),auth[_0xced3('0x9')](),controller[_0xced3('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6d55574..803a81e 100644 --- a/server/api/trigger/trigger.attributes.js +++ b/server/api/trigger/trigger.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fb1=['sequelize','exports'];(function(_0x46677b,_0x2d8dd8){var _0x1dca18=function(_0x1e491f){while(--_0x1e491f){_0x46677b['push'](_0x46677b['shift']());}};_0x1dca18(++_0x2d8dd8);}(_0x7fb1,0x1ce));var _0x17fb=function(_0x42b89a,_0x5842f4){_0x42b89a=_0x42b89a-0x0;var _0x33e70d=_0x7fb1[_0x42b89a];return _0x33e70d;};'use strict';var Sequelize=require(_0x17fb('0x0'));module[_0x17fb('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb5fc=['sequelize','exports','STRING'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0xb5fc,0x165));var _0xcb5f=function(_0x390c61,_0x10b447){_0x390c61=_0x390c61-0x0;var _0x2118e3=_0xb5fc[_0x390c61];return _0x2118e3;};'use strict';var Sequelize=require(_0xcb5f('0x0'));module[_0xcb5f('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcb5f('0x2')]},'description':{'type':Sequelize[_0xcb5f('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index dc68540..dc20e8c 100644 --- a/server/api/trigger/trigger.controller.js +++ b/server/api/trigger/trigger.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd10=['findOne','order','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId'];(function(_0x5c883f,_0x4a6f92){var _0x1d7c68=function(_0xa54ac4){while(--_0xa54ac4){_0x5c883f['push'](_0x5c883f['shift']());}};_0x1d7c68(++_0x4a6f92);}(_0xbd10,0x12b));var _0x0bd1=function(_0xda5e35,_0x32c96b){_0xda5e35=_0xda5e35-0x0;var _0xed90c7=_0xbd10[_0xda5e35];return _0xed90c7;};'use strict';var emlformat=require(_0x0bd1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0bd1('0x1'));var jsonpatch=require(_0x0bd1('0x2'));var rp=require(_0x0bd1('0x3'));var moment=require(_0x0bd1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0bd1('0x5'));var util=require('util');var path=require(_0x0bd1('0x6'));var sox=require(_0x0bd1('0x7'));var csv=require('to-csv');var ejs=require(_0x0bd1('0x8'));var fs=require('fs');var fs_extra=require(_0x0bd1('0x9'));var _=require(_0x0bd1('0xa'));var squel=require('squel');var crypto=require(_0x0bd1('0xb'));var jsforce=require(_0x0bd1('0xc'));var deskjs=require(_0x0bd1('0xd'));var toCsv=require(_0x0bd1('0xe'));var querystring=require('querystring');var Papa=require(_0x0bd1('0xf'));var Redis=require(_0x0bd1('0x10'));var authService=require(_0x0bd1('0x11'));var qs=require(_0x0bd1('0x12'));var as=require(_0x0bd1('0x13'));var hardwareService=require(_0x0bd1('0x14'));var logger=require(_0x0bd1('0x15'))(_0x0bd1('0x16'));var utils=require(_0x0bd1('0x17'));var config=require(_0x0bd1('0x18'));var licenseUtil=require(_0x0bd1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11984b,_0x1924f3){_0x1924f3=_0x1924f3||0xcc;return function(_0x5a3fba){if(_0x5a3fba){return _0x11984b[_0x0bd1('0x1a')](_0x1924f3);}return _0x11984b[_0x0bd1('0x1b')](_0x1924f3)['end']();};}function respondWithResult(_0x302d53,_0xa2933e){_0xa2933e=_0xa2933e||0xc8;return function(_0x468d33){if(_0x468d33){return _0x302d53[_0x0bd1('0x1b')](_0xa2933e)[_0x0bd1('0x1c')](_0x468d33);}};}function respondWithFilteredResult(_0x2bc750,_0x55a2cc){return function(_0x2f9e2a){if(_0x2f9e2a){var _0x24abb6=typeof _0x55a2cc[_0x0bd1('0x1d')]===_0x0bd1('0x1e')&&typeof _0x55a2cc[_0x0bd1('0x1f')]===_0x0bd1('0x1e');var _0x5782a5=_0x2f9e2a[_0x0bd1('0x20')];var _0x528715=_0x24abb6?0x0:_0x55a2cc['offset'];var _0x282bb6=_0x24abb6?_0x2f9e2a['count']:_0x55a2cc['offset']+_0x55a2cc[_0x0bd1('0x1f')];var _0x4a8dc0;if(_0x282bb6>=_0x5782a5){_0x282bb6=_0x5782a5;_0x4a8dc0=0xc8;}else{_0x4a8dc0=0xce;}_0x2bc750[_0x0bd1('0x1b')](_0x4a8dc0);return _0x2bc750[_0x0bd1('0x21')]('Content-Range',_0x528715+'-'+_0x282bb6+'/'+_0x5782a5)[_0x0bd1('0x1c')](_0x2f9e2a);}return null;};}function patchUpdates(_0x49b2e6){return function(_0x522c3b){try{jsonpatch['apply'](_0x522c3b,_0x49b2e6,!![]);}catch(_0x275e96){return BPromise[_0x0bd1('0x22')](_0x275e96);}return _0x522c3b[_0x0bd1('0x23')]();};}function saveUpdates(_0x1f900e,_0x4e796c){return function(_0xf7995){if(_0xf7995){return _0xf7995[_0x0bd1('0x24')](_0x1f900e)[_0x0bd1('0x25')](function(_0x5b86fd){return _0x5b86fd;});}return null;};}function removeEntity(_0xfeec6b,_0x3b4896){return function(_0x229014){if(_0x229014){return _0x229014[_0x0bd1('0x26')]()['then'](function(){var _0x48c0cb=_0x229014[_0x0bd1('0x27')]({'plain':!![]});var _0x494d67=_0x0bd1('0x28');return db[_0x0bd1('0x29')][_0x0bd1('0x26')]({'where':{'type':_0x494d67,'resourceId':_0x48c0cb['id']}})['then'](function(){return _0x229014;});})[_0x0bd1('0x25')](function(){_0xfeec6b[_0x0bd1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530d70,_0x5f02ff){return function(_0x4afa5d){if(!_0x4afa5d){_0x530d70[_0x0bd1('0x1a')](0x194);}return _0x4afa5d;};}function handleError(_0x1e2126,_0x23bcce){_0x23bcce=_0x23bcce||0x1f4;return function(_0x10a6f2){logger[_0x0bd1('0x2a')](_0x10a6f2[_0x0bd1('0x2b')]);if(_0x10a6f2[_0x0bd1('0x2c')]){delete _0x10a6f2[_0x0bd1('0x2c')];}_0x1e2126[_0x0bd1('0x1b')](_0x23bcce)[_0x0bd1('0x2d')](_0x10a6f2);};}exports[_0x0bd1('0x2e')]=function(_0x3c76aa,_0x360473){var _0x2f924b={},_0xa9ced2={},_0x1f97b0={'count':0x0,'rows':[]};var _0x395b89=_[_0x0bd1('0x2f')](db[_0x0bd1('0x30')][_0x0bd1('0x31')],function(_0x328048){return{'name':_0x328048[_0x0bd1('0x32')],'type':_0x328048[_0x0bd1('0x33')][_0x0bd1('0x34')]};});_0xa9ced2[_0x0bd1('0x35')]=_[_0x0bd1('0x2f')](_0x395b89,'name');_0xa9ced2[_0x0bd1('0x36')]=_[_0x0bd1('0x37')](_0x3c76aa[_0x0bd1('0x36')]);_0xa9ced2[_0x0bd1('0x38')]=_[_0x0bd1('0x39')](_0xa9ced2[_0x0bd1('0x35')],_0xa9ced2[_0x0bd1('0x36')]);_0x2f924b['attributes']=_[_0x0bd1('0x39')](_0xa9ced2['model'],qs[_0x0bd1('0x3a')](_0x3c76aa[_0x0bd1('0x36')][_0x0bd1('0x3a')]));_0x2f924b[_0x0bd1('0x3b')]=_0x2f924b[_0x0bd1('0x3b')][_0x0bd1('0x3c')]?_0x2f924b[_0x0bd1('0x3b')]:_0xa9ced2[_0x0bd1('0x35')];if(!_0x3c76aa['query'][_0x0bd1('0x3d')](_0x0bd1('0x3e'))){_0x2f924b['limit']=qs[_0x0bd1('0x1f')](_0x3c76aa[_0x0bd1('0x36')][_0x0bd1('0x1f')]);_0x2f924b[_0x0bd1('0x1d')]=qs[_0x0bd1('0x1d')](_0x3c76aa[_0x0bd1('0x36')][_0x0bd1('0x1d')]);}_0x2f924b['order']=qs[_0x0bd1('0x3f')](_0x3c76aa[_0x0bd1('0x36')]['sort']);_0x2f924b[_0x0bd1('0x40')]=qs['filters'](_[_0x0bd1('0x41')](_0x3c76aa[_0x0bd1('0x36')],_0xa9ced2['filters']),_0x395b89);if(_0x3c76aa[_0x0bd1('0x36')][_0x0bd1('0x42')]){_0x2f924b['where']=_[_0x0bd1('0x43')](_0x2f924b[_0x0bd1('0x40')],{'$or':_[_0x0bd1('0x2f')](_0x395b89,function(_0x532465){if(_0x532465['type']!==_0x0bd1('0x44')){var _0x21207c={};_0x21207c[_0x532465[_0x0bd1('0x2c')]]={'$like':'%'+_0x3c76aa[_0x0bd1('0x36')][_0x0bd1('0x42')]+'%'};return _0x21207c;}})});}_0x2f924b=_[_0x0bd1('0x43')]({},_0x2f924b,_0x3c76aa['options']);var _0x2588d3={'where':_0x2f924b[_0x0bd1('0x40')]};return db[_0x0bd1('0x30')]['count'](_0x2588d3)[_0x0bd1('0x25')](function(_0x5b6829){_0x1f97b0[_0x0bd1('0x20')]=_0x5b6829;if(_0x3c76aa[_0x0bd1('0x36')]['includeAll']){_0x2f924b[_0x0bd1('0x45')]=[{'all':!![]}];}return db['Trigger'][_0x0bd1('0x46')](_0x2f924b);})['then'](function(_0x37d67c){_0x1f97b0[_0x0bd1('0x47')]=_0x37d67c;return _0x1f97b0;})[_0x0bd1('0x25')](respondWithFilteredResult(_0x360473,_0x2f924b))[_0x0bd1('0x48')](handleError(_0x360473,null));};exports[_0x0bd1('0x49')]=function(_0x1841cc,_0x3523be){var _0x13762c={'raw':![],'where':{'id':_0x1841cc[_0x0bd1('0x4a')]['id']}},_0x4daba7={};_0x4daba7[_0x0bd1('0x35')]=_[_0x0bd1('0x37')](db[_0x0bd1('0x30')][_0x0bd1('0x31')]);_0x4daba7[_0x0bd1('0x36')]=_[_0x0bd1('0x37')](_0x1841cc[_0x0bd1('0x36')]);_0x4daba7['filters']=_[_0x0bd1('0x39')](_0x4daba7[_0x0bd1('0x35')],_0x4daba7[_0x0bd1('0x36')]);_0x13762c[_0x0bd1('0x3b')]=_[_0x0bd1('0x39')](_0x4daba7[_0x0bd1('0x35')],qs['fields'](_0x1841cc[_0x0bd1('0x36')][_0x0bd1('0x3a')]));_0x13762c[_0x0bd1('0x3b')]=_0x13762c[_0x0bd1('0x3b')][_0x0bd1('0x3c')]?_0x13762c[_0x0bd1('0x3b')]:_0x4daba7['model'];if(_0x1841cc[_0x0bd1('0x36')][_0x0bd1('0x4b')]){_0x13762c[_0x0bd1('0x45')]=[{'all':!![]}];}_0x13762c=_[_0x0bd1('0x43')]({},_0x13762c,_0x1841cc[_0x0bd1('0x4c')]);return db[_0x0bd1('0x30')][_0x0bd1('0x4d')](_0x13762c)[_0x0bd1('0x25')](handleEntityNotFound(_0x3523be,null))[_0x0bd1('0x25')](respondWithResult(_0x3523be,null))['catch'](handleError(_0x3523be,null));};exports['create']=function(_0x4bf8e0,_0x42bbf4){return db[_0x0bd1('0x30')][_0x0bd1('0x4e')](_0x4bf8e0[_0x0bd1('0x4f')],{})[_0x0bd1('0x25')](function(_0x54c4a1){var _0x316bac=_0x4bf8e0[_0x0bd1('0x50')]['get']({'plain':!![]});if(!_0x316bac)throw new Error(_0x0bd1('0x51'));if(_0x316bac['role']===_0x0bd1('0x50')){var _0x421489=_0x54c4a1[_0x0bd1('0x27')]({'plain':!![]});var _0x2967cd=_0x0bd1('0x28');return db[_0x0bd1('0x52')]['find']({'where':{'name':_0x2967cd,'userProfileId':_0x316bac[_0x0bd1('0x53')]},'raw':!![]})[_0x0bd1('0x25')](function(_0x4a9bfe){if(_0x4a9bfe&&_0x4a9bfe['autoAssociation']===0x0){return db['UserProfileResource'][_0x0bd1('0x4e')]({'name':_0x421489[_0x0bd1('0x2c')],'resourceId':_0x421489['id'],'type':_0x4a9bfe['name'],'sectionId':_0x4a9bfe['id']},{})[_0x0bd1('0x25')](function(){return _0x54c4a1;});}else{return _0x54c4a1;}})[_0x0bd1('0x48')](function(_0x206d82){logger[_0x0bd1('0x2a')](_0x0bd1('0x54'),_0x206d82);throw _0x206d82;});}return _0x54c4a1;})[_0x0bd1('0x25')](respondWithResult(_0x42bbf4,0xc9))[_0x0bd1('0x48')](handleError(_0x42bbf4,null));};exports[_0x0bd1('0x24')]=function(_0xf0822c,_0xe5e112){if(_0xf0822c[_0x0bd1('0x4f')]['id']){delete _0xf0822c[_0x0bd1('0x4f')]['id'];}return db[_0x0bd1('0x30')]['find']({'where':{'id':_0xf0822c[_0x0bd1('0x4a')]['id']}})[_0x0bd1('0x25')](handleEntityNotFound(_0xe5e112,null))[_0x0bd1('0x25')](saveUpdates(_0xf0822c[_0x0bd1('0x4f')],null))[_0x0bd1('0x25')](respondWithResult(_0xe5e112,null))[_0x0bd1('0x48')](handleError(_0xe5e112,null));};exports[_0x0bd1('0x26')]=function(_0x502c7d,_0xcf5fb4){return db[_0x0bd1('0x30')]['find']({'where':{'id':_0x502c7d['params']['id']}})[_0x0bd1('0x25')](handleEntityNotFound(_0xcf5fb4,null))[_0x0bd1('0x25')](removeEntity(_0xcf5fb4,null))[_0x0bd1('0x48')](handleError(_0xcf5fb4,null));};exports[_0x0bd1('0x55')]=function(_0x5ebe99,_0xb7e698,_0x1d4d57){if(_0x5ebe99[_0x0bd1('0x4f')]['id']){delete _0x5ebe99[_0x0bd1('0x4f')]['id'];}return db[_0x0bd1('0x30')][_0x0bd1('0x4d')]({'where':{'id':_0x5ebe99['params']['id']}})[_0x0bd1('0x25')](handleEntityNotFound(_0xb7e698,null))[_0x0bd1('0x25')](function(_0x5a1f5d){if(_0x5a1f5d){_0x5ebe99['body']['TriggerAllId']=_0x5a1f5d['id'];return db[_0x0bd1('0x56')]['create'](_0x5ebe99[_0x0bd1('0x4f')]);}})[_0x0bd1('0x25')](respondWithResult(_0xb7e698,null))[_0x0bd1('0x48')](handleError(_0xb7e698,null));};exports[_0x0bd1('0x57')]=function(_0x2c7b60,_0x1ef25b,_0xc37427){if(_0x2c7b60[_0x0bd1('0x4f')]['id']){delete _0x2c7b60[_0x0bd1('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x2c7b60[_0x0bd1('0x4a')]['id']}})[_0x0bd1('0x25')](handleEntityNotFound(_0x1ef25b,null))[_0x0bd1('0x25')](function(_0x354a3a){if(_0x354a3a){_0x2c7b60[_0x0bd1('0x4f')][_0x0bd1('0x58')]=_0x354a3a['id'];return db[_0x0bd1('0x56')]['create'](_0x2c7b60[_0x0bd1('0x4f')]);}})[_0x0bd1('0x25')](respondWithResult(_0x1ef25b,null))['catch'](handleError(_0x1ef25b,null));};exports['getAllConditions']=function(_0x519331,_0x531420,_0x2bbd57){var _0x9117e={};var _0x1e8809={};var _0x925299;var _0x5cb202;return db[_0x0bd1('0x30')][_0x0bd1('0x59')]({'where':{'id':_0x519331[_0x0bd1('0x4a')]['id']}})[_0x0bd1('0x25')](handleEntityNotFound(_0x531420,null))['then'](function(_0x13fd9c){if(_0x13fd9c){_0x925299=_0x13fd9c;_0x1e8809[_0x0bd1('0x35')]=_['keys'](db[_0x0bd1('0x56')][_0x0bd1('0x31')]);_0x1e8809[_0x0bd1('0x36')]=_[_0x0bd1('0x37')](_0x519331[_0x0bd1('0x36')]);_0x1e8809[_0x0bd1('0x38')]=_[_0x0bd1('0x39')](_0x1e8809[_0x0bd1('0x35')],_0x1e8809[_0x0bd1('0x36')]);_0x9117e[_0x0bd1('0x3b')]=_[_0x0bd1('0x39')](_0x1e8809['model'],qs[_0x0bd1('0x3a')](_0x519331[_0x0bd1('0x36')][_0x0bd1('0x3a')]));_0x9117e['attributes']=_0x9117e[_0x0bd1('0x3b')][_0x0bd1('0x3c')]?_0x9117e[_0x0bd1('0x3b')]:_0x1e8809['model'];_0x9117e[_0x0bd1('0x5a')]=qs[_0x0bd1('0x3f')](_0x519331[_0x0bd1('0x36')]['sort']);_0x9117e[_0x0bd1('0x40')]=qs['filters'](_[_0x0bd1('0x41')](_0x519331[_0x0bd1('0x36')],_0x1e8809[_0x0bd1('0x38')]));if(_0x519331[_0x0bd1('0x36')][_0x0bd1('0x42')]){_0x9117e['where']=_[_0x0bd1('0x43')](_0x9117e[_0x0bd1('0x40')],{'$or':_[_0x0bd1('0x2f')](_0x9117e[_0x0bd1('0x3b')],function(_0x37c7a1){var _0x1c59b8={};_0x1c59b8[_0x37c7a1]={'$like':'%'+_0x519331[_0x0bd1('0x36')][_0x0bd1('0x42')]+'%'};return _0x1c59b8;})});}_0x9117e=_[_0x0bd1('0x43')]({},_0x9117e,_0x519331[_0x0bd1('0x4c')]);return _0x925299['getAllConditions'](_0x9117e);}})[_0x0bd1('0x25')](function(_0x2749e5){if(_0x2749e5){_0x5cb202=_0x2749e5['length'];if(!_0x519331[_0x0bd1('0x36')]['hasOwnProperty']('nolimit')){_0x9117e[_0x0bd1('0x1f')]=qs[_0x0bd1('0x1f')](_0x519331[_0x0bd1('0x36')]['limit']);_0x9117e['offset']=qs['offset'](_0x519331[_0x0bd1('0x36')][_0x0bd1('0x1d')]);}return _0x925299[_0x0bd1('0x5b')](_0x9117e);}})[_0x0bd1('0x25')](function(_0x14fff1){if(_0x14fff1){return _0x14fff1?{'count':_0x5cb202,'rows':_0x14fff1}:null;}})[_0x0bd1('0x25')](respondWithResult(_0x531420,null))[_0x0bd1('0x48')](handleError(_0x531420,null));};exports[_0x0bd1('0x5c')]=function(_0x4417d2,_0x179ac3,_0x335979){var _0x2bc2cd={};var _0x389aae={};var _0x579ec6;var _0x16a0bf;return db[_0x0bd1('0x30')][_0x0bd1('0x59')]({'where':{'id':_0x4417d2[_0x0bd1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x179ac3,null))[_0x0bd1('0x25')](function(_0x22e07b){if(_0x22e07b){_0x579ec6=_0x22e07b;_0x389aae[_0x0bd1('0x35')]=_[_0x0bd1('0x37')](db[_0x0bd1('0x56')]['rawAttributes']);_0x389aae[_0x0bd1('0x36')]=_[_0x0bd1('0x37')](_0x4417d2['query']);_0x389aae['filters']=_[_0x0bd1('0x39')](_0x389aae[_0x0bd1('0x35')],_0x389aae[_0x0bd1('0x36')]);_0x2bc2cd[_0x0bd1('0x3b')]=_[_0x0bd1('0x39')](_0x389aae[_0x0bd1('0x35')],qs[_0x0bd1('0x3a')](_0x4417d2[_0x0bd1('0x36')]['fields']));_0x2bc2cd['attributes']=_0x2bc2cd[_0x0bd1('0x3b')][_0x0bd1('0x3c')]?_0x2bc2cd['attributes']:_0x389aae[_0x0bd1('0x35')];_0x2bc2cd[_0x0bd1('0x5a')]=qs['sort'](_0x4417d2[_0x0bd1('0x36')][_0x0bd1('0x3f')]);_0x2bc2cd[_0x0bd1('0x40')]=qs[_0x0bd1('0x38')](_[_0x0bd1('0x41')](_0x4417d2[_0x0bd1('0x36')],_0x389aae['filters']));if(_0x4417d2[_0x0bd1('0x36')][_0x0bd1('0x42')]){_0x2bc2cd[_0x0bd1('0x40')]=_[_0x0bd1('0x43')](_0x2bc2cd[_0x0bd1('0x40')],{'$or':_[_0x0bd1('0x2f')](_0x2bc2cd['attributes'],function(_0x134a46){var _0x3f2e9a={};_0x3f2e9a[_0x134a46]={'$like':'%'+_0x4417d2[_0x0bd1('0x36')][_0x0bd1('0x42')]+'%'};return _0x3f2e9a;})});}_0x2bc2cd=_[_0x0bd1('0x43')]({},_0x2bc2cd,_0x4417d2[_0x0bd1('0x4c')]);return _0x579ec6[_0x0bd1('0x5c')](_0x2bc2cd);}})['then'](function(_0x464b9d){if(_0x464b9d){_0x16a0bf=_0x464b9d['length'];if(!_0x4417d2['query']['hasOwnProperty']('nolimit')){_0x2bc2cd['limit']=qs[_0x0bd1('0x1f')](_0x4417d2[_0x0bd1('0x36')][_0x0bd1('0x1f')]);_0x2bc2cd[_0x0bd1('0x1d')]=qs[_0x0bd1('0x1d')](_0x4417d2['query'][_0x0bd1('0x1d')]);}return _0x579ec6[_0x0bd1('0x5c')](_0x2bc2cd);}})[_0x0bd1('0x25')](function(_0xf85411){if(_0xf85411){return _0xf85411?{'count':_0x16a0bf,'rows':_0xf85411}:null;}})[_0x0bd1('0x25')](respondWithResult(_0x179ac3,null))['catch'](handleError(_0x179ac3,null));};exports[_0x0bd1('0x5d')]=function(_0x58e490,_0x1a3ae8,_0x38bff8){if(_0x58e490[_0x0bd1('0x4f')]['id']){delete _0x58e490[_0x0bd1('0x4f')]['id'];}return db['Trigger'][_0x0bd1('0x4d')]({'where':{'id':_0x58e490[_0x0bd1('0x4a')]['id']}})[_0x0bd1('0x25')](handleEntityNotFound(_0x1a3ae8,null))[_0x0bd1('0x25')](function(_0x33c3de){if(_0x33c3de){_0x58e490[_0x0bd1('0x4f')][_0x0bd1('0x5e')]=_0x33c3de['id'];return db['Action'][_0x0bd1('0x4e')](_0x58e490[_0x0bd1('0x4f')]);}})[_0x0bd1('0x25')](respondWithResult(_0x1a3ae8,null))[_0x0bd1('0x48')](handleError(_0x1a3ae8,null));};exports[_0x0bd1('0x5f')]=function(_0x19594c,_0x1068ed,_0x47891e){var _0x3f3b3e={};var _0x397273={};var _0x1dc4d9;var _0x388d0f;return db[_0x0bd1('0x30')][_0x0bd1('0x59')]({'where':{'id':_0x19594c[_0x0bd1('0x4a')]['id']}})[_0x0bd1('0x25')](handleEntityNotFound(_0x1068ed,null))[_0x0bd1('0x25')](function(_0x3e8a24){if(_0x3e8a24){_0x1dc4d9=_0x3e8a24;_0x397273[_0x0bd1('0x35')]=_[_0x0bd1('0x37')](db[_0x0bd1('0x60')][_0x0bd1('0x31')]);_0x397273[_0x0bd1('0x36')]=_[_0x0bd1('0x37')](_0x19594c[_0x0bd1('0x36')]);_0x397273[_0x0bd1('0x38')]=_[_0x0bd1('0x39')](_0x397273['model'],_0x397273[_0x0bd1('0x36')]);_0x3f3b3e[_0x0bd1('0x3b')]=_[_0x0bd1('0x39')](_0x397273[_0x0bd1('0x35')],qs[_0x0bd1('0x3a')](_0x19594c[_0x0bd1('0x36')]['fields']));_0x3f3b3e[_0x0bd1('0x3b')]=_0x3f3b3e['attributes'][_0x0bd1('0x3c')]?_0x3f3b3e[_0x0bd1('0x3b')]:_0x397273[_0x0bd1('0x35')];_0x3f3b3e[_0x0bd1('0x5a')]=qs[_0x0bd1('0x3f')](_0x19594c[_0x0bd1('0x36')][_0x0bd1('0x3f')]);_0x3f3b3e[_0x0bd1('0x40')]=qs[_0x0bd1('0x38')](_['pick'](_0x19594c['query'],_0x397273[_0x0bd1('0x38')]));if(_0x19594c[_0x0bd1('0x36')][_0x0bd1('0x42')]){_0x3f3b3e[_0x0bd1('0x40')]=_['merge'](_0x3f3b3e[_0x0bd1('0x40')],{'$or':_['map'](_0x3f3b3e['attributes'],function(_0x3cefb8){var _0x4589fc={};_0x4589fc[_0x3cefb8]={'$like':'%'+_0x19594c['query'][_0x0bd1('0x42')]+'%'};return _0x4589fc;})});}_0x3f3b3e=_[_0x0bd1('0x43')]({},_0x3f3b3e,_0x19594c['options']);return _0x1dc4d9[_0x0bd1('0x5f')](_0x3f3b3e);}})[_0x0bd1('0x25')](function(_0x226c7a){if(_0x226c7a){_0x388d0f=_0x226c7a[_0x0bd1('0x3c')];if(!_0x19594c[_0x0bd1('0x36')][_0x0bd1('0x3d')](_0x0bd1('0x3e'))){_0x3f3b3e['limit']=qs['limit'](_0x19594c[_0x0bd1('0x36')][_0x0bd1('0x1f')]);_0x3f3b3e[_0x0bd1('0x1d')]=qs[_0x0bd1('0x1d')](_0x19594c[_0x0bd1('0x36')]['offset']);}return _0x1dc4d9[_0x0bd1('0x5f')](_0x3f3b3e);}})[_0x0bd1('0x25')](function(_0x34abae){if(_0x34abae){return _0x34abae?{'count':_0x388d0f,'rows':_0x34abae}:null;}})['then'](respondWithResult(_0x1068ed,null))['catch'](handleError(_0x1068ed,null));}; \ No newline at end of file +var _0x7dcd=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','status','set','Content-Range','reject','destroy','then','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7dcd,0x86));var _0xd7dc=function(_0xa5e821,_0x4dd2f6){_0xa5e821=_0xa5e821-0x0;var _0x62d0cd=_0x7dcd[_0xa5e821];return _0x62d0cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7dc('0x0'));var zipdir=require(_0xd7dc('0x1'));var jsonpatch=require(_0xd7dc('0x2'));var rp=require('request-promise');var moment=require(_0xd7dc('0x3'));var BPromise=require(_0xd7dc('0x4'));var Mustache=require(_0xd7dc('0x5'));var util=require(_0xd7dc('0x6'));var path=require(_0xd7dc('0x7'));var sox=require(_0xd7dc('0x8'));var csv=require('to-csv');var ejs=require(_0xd7dc('0x9'));var fs=require('fs');var fs_extra=require(_0xd7dc('0xa'));var _=require(_0xd7dc('0xb'));var squel=require('squel');var crypto=require(_0xd7dc('0xc'));var jsforce=require(_0xd7dc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd7dc('0xe'));var querystring=require(_0xd7dc('0xf'));var Papa=require(_0xd7dc('0x10'));var Redis=require(_0xd7dc('0x11'));var authService=require(_0xd7dc('0x12'));var qs=require(_0xd7dc('0x13'));var as=require(_0xd7dc('0x14'));var hardwareService=require(_0xd7dc('0x15'));var logger=require('../../config/logger')(_0xd7dc('0x16'));var utils=require(_0xd7dc('0x17'));var config=require(_0xd7dc('0x18'));var licenseUtil=require(_0xd7dc('0x19'));var db=require(_0xd7dc('0x1a'))['db'];function respondWithStatusCode(_0x19bd63,_0x48cb3f){_0x48cb3f=_0x48cb3f||0xcc;return function(_0x4f21e5){if(_0x4f21e5){return _0x19bd63[_0xd7dc('0x1b')](_0x48cb3f);}return _0x19bd63['status'](_0x48cb3f)[_0xd7dc('0x1c')]();};}function respondWithResult(_0x26b8da,_0x3fd7ab){_0x3fd7ab=_0x3fd7ab||0xc8;return function(_0x468f8c){if(_0x468f8c){return _0x26b8da['status'](_0x3fd7ab)['json'](_0x468f8c);}};}function respondWithFilteredResult(_0x3c36e2,_0x46e7ad){return function(_0x1fcfef){if(_0x1fcfef){var _0x21aa77=typeof _0x46e7ad[_0xd7dc('0x1d')]===_0xd7dc('0x1e')&&typeof _0x46e7ad['limit']==='undefined';var _0x290f07=_0x1fcfef[_0xd7dc('0x1f')];var _0x3f7492=_0x21aa77?0x0:_0x46e7ad[_0xd7dc('0x1d')];var _0x1f84e2=_0x21aa77?_0x1fcfef[_0xd7dc('0x1f')]:_0x46e7ad[_0xd7dc('0x1d')]+_0x46e7ad['limit'];var _0x598ca4;if(_0x1f84e2>=_0x290f07){_0x1f84e2=_0x290f07;_0x598ca4=0xc8;}else{_0x598ca4=0xce;}_0x3c36e2[_0xd7dc('0x20')](_0x598ca4);return _0x3c36e2[_0xd7dc('0x21')](_0xd7dc('0x22'),_0x3f7492+'-'+_0x1f84e2+'/'+_0x290f07)['json'](_0x1fcfef);}return null;};}function patchUpdates(_0x32cf37){return function(_0x3067f3){try{jsonpatch['apply'](_0x3067f3,_0x32cf37,!![]);}catch(_0x36de89){return BPromise[_0xd7dc('0x23')](_0x36de89);}return _0x3067f3['save']();};}function saveUpdates(_0x1a7ce2,_0x5c8da7){return function(_0x54b899){if(_0x54b899){return _0x54b899['update'](_0x1a7ce2)['then'](function(_0x4019db){return _0x4019db;});}return null;};}function removeEntity(_0x259b5b,_0x38270e){return function(_0x2298a8){if(_0x2298a8){return _0x2298a8[_0xd7dc('0x24')]()[_0xd7dc('0x25')](function(){var _0x271557=_0x2298a8[_0xd7dc('0x26')]({'plain':!![]});var _0x3e159b=_0xd7dc('0x27');return db[_0xd7dc('0x28')][_0xd7dc('0x24')]({'where':{'type':_0x3e159b,'resourceId':_0x271557['id']}})['then'](function(){return _0x2298a8;});})[_0xd7dc('0x25')](function(){_0x259b5b[_0xd7dc('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec71e,_0x3afd3f){return function(_0x44c255){if(!_0x44c255){_0x5ec71e['sendStatus'](0x194);}return _0x44c255;};}function handleError(_0x5791b5,_0x4e2a67){_0x4e2a67=_0x4e2a67||0x1f4;return function(_0x117fdf){logger[_0xd7dc('0x29')](_0x117fdf[_0xd7dc('0x2a')]);if(_0x117fdf[_0xd7dc('0x2b')]){delete _0x117fdf[_0xd7dc('0x2b')];}_0x5791b5[_0xd7dc('0x20')](_0x4e2a67)[_0xd7dc('0x2c')](_0x117fdf);};}exports[_0xd7dc('0x2d')]=function(_0x44687f,_0x1bd28f){var _0x496d71={},_0x19e2a8={},_0x17d5e4={'count':0x0,'rows':[]};var _0x4eeed6=_[_0xd7dc('0x2e')](db[_0xd7dc('0x2f')][_0xd7dc('0x30')],function(_0x21f5cc){return{'name':_0x21f5cc[_0xd7dc('0x31')],'type':_0x21f5cc[_0xd7dc('0x32')][_0xd7dc('0x33')]};});_0x19e2a8[_0xd7dc('0x34')]=_[_0xd7dc('0x2e')](_0x4eeed6,'name');_0x19e2a8[_0xd7dc('0x35')]=_['keys'](_0x44687f['query']);_0x19e2a8[_0xd7dc('0x36')]=_['intersection'](_0x19e2a8['model'],_0x19e2a8[_0xd7dc('0x35')]);_0x496d71[_0xd7dc('0x37')]=_[_0xd7dc('0x38')](_0x19e2a8[_0xd7dc('0x34')],qs[_0xd7dc('0x39')](_0x44687f[_0xd7dc('0x35')][_0xd7dc('0x39')]));_0x496d71['attributes']=_0x496d71[_0xd7dc('0x37')][_0xd7dc('0x3a')]?_0x496d71['attributes']:_0x19e2a8[_0xd7dc('0x34')];if(!_0x44687f[_0xd7dc('0x35')][_0xd7dc('0x3b')](_0xd7dc('0x3c'))){_0x496d71[_0xd7dc('0x3d')]=qs[_0xd7dc('0x3d')](_0x44687f[_0xd7dc('0x35')]['limit']);_0x496d71['offset']=qs[_0xd7dc('0x1d')](_0x44687f[_0xd7dc('0x35')][_0xd7dc('0x1d')]);}_0x496d71[_0xd7dc('0x3e')]=qs[_0xd7dc('0x3f')](_0x44687f[_0xd7dc('0x35')][_0xd7dc('0x3f')]);_0x496d71[_0xd7dc('0x40')]=qs['filters'](_[_0xd7dc('0x41')](_0x44687f[_0xd7dc('0x35')],_0x19e2a8[_0xd7dc('0x36')]),_0x4eeed6);if(_0x44687f[_0xd7dc('0x35')][_0xd7dc('0x42')]){_0x496d71['where']=_[_0xd7dc('0x43')](_0x496d71[_0xd7dc('0x40')],{'$or':_[_0xd7dc('0x2e')](_0x4eeed6,function(_0x302c8e){if(_0x302c8e[_0xd7dc('0x32')]!==_0xd7dc('0x44')){var _0x2ca60c={};_0x2ca60c[_0x302c8e[_0xd7dc('0x2b')]]={'$like':'%'+_0x44687f['query'][_0xd7dc('0x42')]+'%'};return _0x2ca60c;}})});}_0x496d71=_['merge']({},_0x496d71,_0x44687f['options']);var _0x552973={'where':_0x496d71['where']};return db[_0xd7dc('0x2f')][_0xd7dc('0x1f')](_0x552973)[_0xd7dc('0x25')](function(_0x53dd57){_0x17d5e4[_0xd7dc('0x1f')]=_0x53dd57;if(_0x44687f[_0xd7dc('0x35')][_0xd7dc('0x45')]){_0x496d71[_0xd7dc('0x46')]=[{'all':!![]}];}return db[_0xd7dc('0x2f')][_0xd7dc('0x47')](_0x496d71);})[_0xd7dc('0x25')](function(_0x4da517){_0x17d5e4[_0xd7dc('0x48')]=_0x4da517;return _0x17d5e4;})[_0xd7dc('0x25')](respondWithFilteredResult(_0x1bd28f,_0x496d71))[_0xd7dc('0x49')](handleError(_0x1bd28f,null));};exports[_0xd7dc('0x4a')]=function(_0x287bb2,_0x1a5174){var _0x4550c9={'raw':![],'where':{'id':_0x287bb2[_0xd7dc('0x4b')]['id']}},_0x3e571e={};_0x3e571e[_0xd7dc('0x34')]=_[_0xd7dc('0x4c')](db['Trigger']['rawAttributes']);_0x3e571e[_0xd7dc('0x35')]=_[_0xd7dc('0x4c')](_0x287bb2[_0xd7dc('0x35')]);_0x3e571e[_0xd7dc('0x36')]=_[_0xd7dc('0x38')](_0x3e571e[_0xd7dc('0x34')],_0x3e571e[_0xd7dc('0x35')]);_0x4550c9[_0xd7dc('0x37')]=_[_0xd7dc('0x38')](_0x3e571e[_0xd7dc('0x34')],qs[_0xd7dc('0x39')](_0x287bb2[_0xd7dc('0x35')]['fields']));_0x4550c9[_0xd7dc('0x37')]=_0x4550c9[_0xd7dc('0x37')][_0xd7dc('0x3a')]?_0x4550c9[_0xd7dc('0x37')]:_0x3e571e[_0xd7dc('0x34')];if(_0x287bb2[_0xd7dc('0x35')][_0xd7dc('0x45')]){_0x4550c9[_0xd7dc('0x46')]=[{'all':!![]}];}_0x4550c9=_[_0xd7dc('0x43')]({},_0x4550c9,_0x287bb2[_0xd7dc('0x4d')]);return db[_0xd7dc('0x2f')][_0xd7dc('0x4e')](_0x4550c9)[_0xd7dc('0x25')](handleEntityNotFound(_0x1a5174,null))[_0xd7dc('0x25')](respondWithResult(_0x1a5174,null))[_0xd7dc('0x49')](handleError(_0x1a5174,null));};exports[_0xd7dc('0x4f')]=function(_0x65665c,_0x145d5c){return db[_0xd7dc('0x2f')][_0xd7dc('0x4f')](_0x65665c[_0xd7dc('0x50')],{})[_0xd7dc('0x25')](function(_0x47ad4d){var _0x274612=_0x65665c[_0xd7dc('0x51')]['get']({'plain':!![]});if(!_0x274612)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x274612[_0xd7dc('0x52')]===_0xd7dc('0x51')){var _0x255671=_0x47ad4d[_0xd7dc('0x26')]({'plain':!![]});var _0x8e554c='Triggers';return db[_0xd7dc('0x53')][_0xd7dc('0x4e')]({'where':{'name':_0x8e554c,'userProfileId':_0x274612['userProfileId']},'raw':!![]})[_0xd7dc('0x25')](function(_0x435d49){if(_0x435d49&&_0x435d49[_0xd7dc('0x54')]===0x0){return db['UserProfileResource'][_0xd7dc('0x4f')]({'name':_0x255671[_0xd7dc('0x2b')],'resourceId':_0x255671['id'],'type':_0x435d49['name'],'sectionId':_0x435d49['id']},{})['then'](function(){return _0x47ad4d;});}else{return _0x47ad4d;}})[_0xd7dc('0x49')](function(_0x4ff86c){logger[_0xd7dc('0x29')](_0xd7dc('0x55'),_0x4ff86c);throw _0x4ff86c;});}return _0x47ad4d;})[_0xd7dc('0x25')](respondWithResult(_0x145d5c,0xc9))['catch'](handleError(_0x145d5c,null));};exports['update']=function(_0x231eee,_0x14ae59){if(_0x231eee[_0xd7dc('0x50')]['id']){delete _0x231eee['body']['id'];}return db[_0xd7dc('0x2f')][_0xd7dc('0x4e')]({'where':{'id':_0x231eee[_0xd7dc('0x4b')]['id']}})[_0xd7dc('0x25')](handleEntityNotFound(_0x14ae59,null))['then'](saveUpdates(_0x231eee[_0xd7dc('0x50')],null))[_0xd7dc('0x25')](respondWithResult(_0x14ae59,null))[_0xd7dc('0x49')](handleError(_0x14ae59,null));};exports[_0xd7dc('0x24')]=function(_0x5674b0,_0x5b484e){return db[_0xd7dc('0x2f')]['find']({'where':{'id':_0x5674b0['params']['id']}})[_0xd7dc('0x25')](handleEntityNotFound(_0x5b484e,null))[_0xd7dc('0x25')](removeEntity(_0x5b484e,null))[_0xd7dc('0x49')](handleError(_0x5b484e,null));};exports[_0xd7dc('0x56')]=function(_0x56bb74,_0x5ddd79,_0x2e5c03){if(_0x56bb74[_0xd7dc('0x50')]['id']){delete _0x56bb74[_0xd7dc('0x50')]['id'];}return db[_0xd7dc('0x2f')]['find']({'where':{'id':_0x56bb74['params']['id']}})[_0xd7dc('0x25')](handleEntityNotFound(_0x5ddd79,null))[_0xd7dc('0x25')](function(_0x244695){if(_0x244695){_0x56bb74['body']['TriggerAllId']=_0x244695['id'];return db[_0xd7dc('0x57')][_0xd7dc('0x4f')](_0x56bb74['body']);}})[_0xd7dc('0x25')](respondWithResult(_0x5ddd79,null))[_0xd7dc('0x49')](handleError(_0x5ddd79,null));};exports[_0xd7dc('0x58')]=function(_0x24b7ab,_0x23cdf7,_0xe38093){if(_0x24b7ab[_0xd7dc('0x50')]['id']){delete _0x24b7ab['body']['id'];}return db[_0xd7dc('0x2f')][_0xd7dc('0x4e')]({'where':{'id':_0x24b7ab[_0xd7dc('0x4b')]['id']}})[_0xd7dc('0x25')](handleEntityNotFound(_0x23cdf7,null))['then'](function(_0x40bcab){if(_0x40bcab){_0x24b7ab['body'][_0xd7dc('0x59')]=_0x40bcab['id'];return db['Condition'][_0xd7dc('0x4f')](_0x24b7ab[_0xd7dc('0x50')]);}})['then'](respondWithResult(_0x23cdf7,null))[_0xd7dc('0x49')](handleError(_0x23cdf7,null));};exports[_0xd7dc('0x5a')]=function(_0x5bf8e7,_0x1fc6aa,_0x31f7fd){var _0x2f22d3={};var _0x223752={};var _0x4c7677;var _0xcacf45;return db[_0xd7dc('0x2f')][_0xd7dc('0x5b')]({'where':{'id':_0x5bf8e7[_0xd7dc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1fc6aa,null))['then'](function(_0x4c6061){if(_0x4c6061){_0x4c7677=_0x4c6061;_0x223752[_0xd7dc('0x34')]=_[_0xd7dc('0x4c')](db['Condition']['rawAttributes']);_0x223752[_0xd7dc('0x35')]=_[_0xd7dc('0x4c')](_0x5bf8e7[_0xd7dc('0x35')]);_0x223752[_0xd7dc('0x36')]=_[_0xd7dc('0x38')](_0x223752[_0xd7dc('0x34')],_0x223752[_0xd7dc('0x35')]);_0x2f22d3[_0xd7dc('0x37')]=_['intersection'](_0x223752['model'],qs[_0xd7dc('0x39')](_0x5bf8e7['query'][_0xd7dc('0x39')]));_0x2f22d3[_0xd7dc('0x37')]=_0x2f22d3[_0xd7dc('0x37')][_0xd7dc('0x3a')]?_0x2f22d3['attributes']:_0x223752[_0xd7dc('0x34')];_0x2f22d3[_0xd7dc('0x3e')]=qs[_0xd7dc('0x3f')](_0x5bf8e7[_0xd7dc('0x35')][_0xd7dc('0x3f')]);_0x2f22d3[_0xd7dc('0x40')]=qs[_0xd7dc('0x36')](_[_0xd7dc('0x41')](_0x5bf8e7['query'],_0x223752[_0xd7dc('0x36')]));if(_0x5bf8e7['query'][_0xd7dc('0x42')]){_0x2f22d3[_0xd7dc('0x40')]=_['merge'](_0x2f22d3[_0xd7dc('0x40')],{'$or':_[_0xd7dc('0x2e')](_0x2f22d3[_0xd7dc('0x37')],function(_0x28dd09){var _0x3d044d={};_0x3d044d[_0x28dd09]={'$like':'%'+_0x5bf8e7[_0xd7dc('0x35')]['filter']+'%'};return _0x3d044d;})});}_0x2f22d3=_['merge']({},_0x2f22d3,_0x5bf8e7[_0xd7dc('0x4d')]);return _0x4c7677[_0xd7dc('0x5a')](_0x2f22d3);}})[_0xd7dc('0x25')](function(_0xc18c91){if(_0xc18c91){_0xcacf45=_0xc18c91[_0xd7dc('0x3a')];if(!_0x5bf8e7[_0xd7dc('0x35')][_0xd7dc('0x3b')](_0xd7dc('0x3c'))){_0x2f22d3[_0xd7dc('0x3d')]=qs['limit'](_0x5bf8e7['query'][_0xd7dc('0x3d')]);_0x2f22d3[_0xd7dc('0x1d')]=qs['offset'](_0x5bf8e7[_0xd7dc('0x35')][_0xd7dc('0x1d')]);}return _0x4c7677[_0xd7dc('0x5a')](_0x2f22d3);}})[_0xd7dc('0x25')](function(_0x37b030){if(_0x37b030){return _0x37b030?{'count':_0xcacf45,'rows':_0x37b030}:null;}})[_0xd7dc('0x25')](respondWithResult(_0x1fc6aa,null))[_0xd7dc('0x49')](handleError(_0x1fc6aa,null));};exports[_0xd7dc('0x5c')]=function(_0x386e34,_0x1137fc,_0x2f171d){var _0x13defa={};var _0x73164b={};var _0xf9b5fa;var _0x421e17;return db[_0xd7dc('0x2f')][_0xd7dc('0x5b')]({'where':{'id':_0x386e34[_0xd7dc('0x4b')]['id']}})[_0xd7dc('0x25')](handleEntityNotFound(_0x1137fc,null))[_0xd7dc('0x25')](function(_0x235a55){if(_0x235a55){_0xf9b5fa=_0x235a55;_0x73164b[_0xd7dc('0x34')]=_[_0xd7dc('0x4c')](db[_0xd7dc('0x57')][_0xd7dc('0x30')]);_0x73164b[_0xd7dc('0x35')]=_['keys'](_0x386e34[_0xd7dc('0x35')]);_0x73164b[_0xd7dc('0x36')]=_[_0xd7dc('0x38')](_0x73164b[_0xd7dc('0x34')],_0x73164b[_0xd7dc('0x35')]);_0x13defa['attributes']=_[_0xd7dc('0x38')](_0x73164b['model'],qs[_0xd7dc('0x39')](_0x386e34[_0xd7dc('0x35')][_0xd7dc('0x39')]));_0x13defa[_0xd7dc('0x37')]=_0x13defa[_0xd7dc('0x37')][_0xd7dc('0x3a')]?_0x13defa[_0xd7dc('0x37')]:_0x73164b[_0xd7dc('0x34')];_0x13defa['order']=qs[_0xd7dc('0x3f')](_0x386e34[_0xd7dc('0x35')][_0xd7dc('0x3f')]);_0x13defa[_0xd7dc('0x40')]=qs[_0xd7dc('0x36')](_[_0xd7dc('0x41')](_0x386e34[_0xd7dc('0x35')],_0x73164b[_0xd7dc('0x36')]));if(_0x386e34[_0xd7dc('0x35')][_0xd7dc('0x42')]){_0x13defa[_0xd7dc('0x40')]=_['merge'](_0x13defa[_0xd7dc('0x40')],{'$or':_['map'](_0x13defa[_0xd7dc('0x37')],function(_0x327807){var _0x2da27d={};_0x2da27d[_0x327807]={'$like':'%'+_0x386e34['query']['filter']+'%'};return _0x2da27d;})});}_0x13defa=_['merge']({},_0x13defa,_0x386e34[_0xd7dc('0x4d')]);return _0xf9b5fa[_0xd7dc('0x5c')](_0x13defa);}})['then'](function(_0x4cd28c){if(_0x4cd28c){_0x421e17=_0x4cd28c[_0xd7dc('0x3a')];if(!_0x386e34[_0xd7dc('0x35')][_0xd7dc('0x3b')](_0xd7dc('0x3c'))){_0x13defa[_0xd7dc('0x3d')]=qs[_0xd7dc('0x3d')](_0x386e34[_0xd7dc('0x35')][_0xd7dc('0x3d')]);_0x13defa[_0xd7dc('0x1d')]=qs[_0xd7dc('0x1d')](_0x386e34[_0xd7dc('0x35')]['offset']);}return _0xf9b5fa[_0xd7dc('0x5c')](_0x13defa);}})['then'](function(_0xf2af97){if(_0xf2af97){return _0xf2af97?{'count':_0x421e17,'rows':_0xf2af97}:null;}})[_0xd7dc('0x25')](respondWithResult(_0x1137fc,null))['catch'](handleError(_0x1137fc,null));};exports[_0xd7dc('0x5d')]=function(_0x172941,_0xbeb959,_0x4a92ee){if(_0x172941['body']['id']){delete _0x172941[_0xd7dc('0x50')]['id'];}return db[_0xd7dc('0x2f')][_0xd7dc('0x4e')]({'where':{'id':_0x172941[_0xd7dc('0x4b')]['id']}})[_0xd7dc('0x25')](handleEntityNotFound(_0xbeb959,null))[_0xd7dc('0x25')](function(_0x5bea59){if(_0x5bea59){_0x172941[_0xd7dc('0x50')][_0xd7dc('0x5e')]=_0x5bea59['id'];return db[_0xd7dc('0x5f')][_0xd7dc('0x4f')](_0x172941[_0xd7dc('0x50')]);}})[_0xd7dc('0x25')](respondWithResult(_0xbeb959,null))[_0xd7dc('0x49')](handleError(_0xbeb959,null));};exports['getActions']=function(_0x27057c,_0x4272cc,_0x1509cb){var _0x361371={};var _0x5d1449={};var _0xa28b5f;var _0x36c3bb;return db[_0xd7dc('0x2f')][_0xd7dc('0x5b')]({'where':{'id':_0x27057c[_0xd7dc('0x4b')]['id']}})[_0xd7dc('0x25')](handleEntityNotFound(_0x4272cc,null))['then'](function(_0x222a7f){if(_0x222a7f){_0xa28b5f=_0x222a7f;_0x5d1449[_0xd7dc('0x34')]=_['keys'](db['Action'][_0xd7dc('0x30')]);_0x5d1449[_0xd7dc('0x35')]=_['keys'](_0x27057c[_0xd7dc('0x35')]);_0x5d1449[_0xd7dc('0x36')]=_[_0xd7dc('0x38')](_0x5d1449[_0xd7dc('0x34')],_0x5d1449[_0xd7dc('0x35')]);_0x361371['attributes']=_[_0xd7dc('0x38')](_0x5d1449[_0xd7dc('0x34')],qs[_0xd7dc('0x39')](_0x27057c[_0xd7dc('0x35')][_0xd7dc('0x39')]));_0x361371[_0xd7dc('0x37')]=_0x361371['attributes'][_0xd7dc('0x3a')]?_0x361371[_0xd7dc('0x37')]:_0x5d1449['model'];_0x361371[_0xd7dc('0x3e')]=qs['sort'](_0x27057c[_0xd7dc('0x35')][_0xd7dc('0x3f')]);_0x361371[_0xd7dc('0x40')]=qs[_0xd7dc('0x36')](_['pick'](_0x27057c['query'],_0x5d1449[_0xd7dc('0x36')]));if(_0x27057c[_0xd7dc('0x35')][_0xd7dc('0x42')]){_0x361371[_0xd7dc('0x40')]=_['merge'](_0x361371['where'],{'$or':_['map'](_0x361371[_0xd7dc('0x37')],function(_0x283a54){var _0x127595={};_0x127595[_0x283a54]={'$like':'%'+_0x27057c[_0xd7dc('0x35')][_0xd7dc('0x42')]+'%'};return _0x127595;})});}_0x361371=_[_0xd7dc('0x43')]({},_0x361371,_0x27057c[_0xd7dc('0x4d')]);return _0xa28b5f['getActions'](_0x361371);}})['then'](function(_0x6c5034){if(_0x6c5034){_0x36c3bb=_0x6c5034[_0xd7dc('0x3a')];if(!_0x27057c['query'][_0xd7dc('0x3b')]('nolimit')){_0x361371[_0xd7dc('0x3d')]=qs['limit'](_0x27057c['query']['limit']);_0x361371['offset']=qs['offset'](_0x27057c[_0xd7dc('0x35')][_0xd7dc('0x1d')]);}return _0xa28b5f['getActions'](_0x361371);}})['then'](function(_0x14839c){if(_0x14839c){return _0x14839c?{'count':_0x36c3bb,'rows':_0x14839c}:null;}})[_0xd7dc('0x25')](respondWithResult(_0x4272cc,null))['catch'](handleError(_0x4272cc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 60d5d04..a2d5dc2 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0d9=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x49d51d,_0x543c02){var _0x325a07=function(_0x3d8b9e){while(--_0x3d8b9e){_0x49d51d['push'](_0x49d51d['shift']());}};_0x325a07(++_0x543c02);}(_0xb0d9,0x10c));var _0x9b0d=function(_0xf1834c,_0x3d1ed5){_0xf1834c=_0xf1834c-0x0;var _0x1e98d0=_0xb0d9[_0xf1834c];return _0x1e98d0;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var logger=require(_0x9b0d('0x2'))(_0x9b0d('0x3'));var moment=require(_0x9b0d('0x4'));var BPromise=require(_0x9b0d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b0d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x9b0d('0x7')]=function(_0x3994a1,_0x584dde){return _0x3994a1[_0x9b0d('0x8')](_0x9b0d('0x9'),attributes,{'tableName':_0x9b0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x867f=['define','Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x420639,_0x2fd6da){var _0x503917=function(_0x471dcf){while(--_0x471dcf){_0x420639['push'](_0x420639['shift']());}};_0x503917(++_0x2fd6da);}(_0x867f,0xe6));var _0xf867=function(_0x17d82f,_0x5d9172){_0x17d82f=_0x17d82f-0x0;var _0x58137b=_0x867f[_0x17d82f];return _0x58137b;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var logger=require(_0xf867('0x2'))(_0xf867('0x3'));var moment=require(_0xf867('0x4'));var BPromise=require(_0xf867('0x5'));var rp=require(_0xf867('0x6'));var fs=require('fs');var path=require(_0xf867('0x7'));var rimraf=require(_0xf867('0x8'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xf867('0x9')]=function(_0x2e0691,_0x2c09b1){return _0x2e0691[_0xf867('0xa')](_0xf867('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 1eacd95..dcff493 100644 --- a/server/api/trigger/trigger.rpc.js +++ b/server/api/trigger/trigger.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab40=['Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19eaa9,_0x1fbf6b){var _0x25fa51=function(_0xe48acd){while(--_0xe48acd){_0x19eaa9['push'](_0x19eaa9['shift']());}};_0x25fa51(++_0x1fbf6b);}(_0xab40,0x193));var _0x0ab4=function(_0x4f0198,_0x51cf56){_0x4f0198=_0x4f0198-0x0;var _0x4ac00b=_0xab40[_0x4f0198];return _0x4ac00b;};'use strict';var _=require('lodash');var util=require(_0x0ab4('0x0'));var moment=require(_0x0ab4('0x1'));var BPromise=require(_0x0ab4('0x2'));var rs=require(_0x0ab4('0x3'));var fs=require('fs');var Redis=require(_0x0ab4('0x4'));var db=require(_0x0ab4('0x5'))['db'];var utils=require(_0x0ab4('0x6'));var logger=require(_0x0ab4('0x7'))('rpc');var config=require(_0x0ab4('0x8'));var jayson=require(_0x0ab4('0x9'));var client=jayson['client'][_0x0ab4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x477445,_0x5e88f5,_0x2debb9){return new BPromise(function(_0x52984b,_0x5b9f78){return client[_0x0ab4('0xb')](_0x477445,_0x2debb9)[_0x0ab4('0xc')](function(_0x31d042){logger[_0x0ab4('0xd')](_0x0ab4('0xe'),_0x5e88f5,_0x0ab4('0xf'));logger[_0x0ab4('0x10')](_0x0ab4('0x11'),_0x5e88f5,_0x0ab4('0xf'),JSON[_0x0ab4('0x12')](_0x31d042));if(_0x31d042[_0x0ab4('0x13')]){if(_0x31d042['error'][_0x0ab4('0x14')]===0x1f4){logger[_0x0ab4('0x13')]('Trigger,\x20%s,\x20%s',_0x5e88f5,_0x31d042['error']['message']);return _0x5b9f78(_0x31d042[_0x0ab4('0x13')][_0x0ab4('0x15')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x5e88f5,_0x31d042[_0x0ab4('0x13')]['message']);return _0x52984b(_0x31d042['error']['message']);}else{logger[_0x0ab4('0xd')]('Trigger,\x20%s,\x20%s',_0x5e88f5,'request\x20sent');_0x52984b(_0x31d042['result']['message']);}})[_0x0ab4('0x16')](function(_0xa397e2){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x5e88f5,_0xa397e2);_0x5b9f78(_0xa397e2);});});}exports[_0x0ab4('0x17')]=function(_0x247a73){var _0x1e90d4=this;return new Promise(function(_0x56204d,_0xe17480){return db[_0x0ab4('0x18')][_0x0ab4('0x19')]({'raw':_0x247a73[_0x0ab4('0x1a')]?_0x247a73[_0x0ab4('0x1a')][_0x0ab4('0x1b')]===undefined?!![]:![]:!![],'where':_0x247a73[_0x0ab4('0x1a')]?_0x247a73[_0x0ab4('0x1a')][_0x0ab4('0x1c')]||null:null,'attributes':_0x247a73[_0x0ab4('0x1a')]?_0x247a73[_0x0ab4('0x1a')][_0x0ab4('0x1d')]||null:null,'limit':_0x247a73[_0x0ab4('0x1a')]?_0x247a73[_0x0ab4('0x1a')][_0x0ab4('0x1e')]||null:null,'include':_0x247a73[_0x0ab4('0x1a')]?_0x247a73[_0x0ab4('0x1a')][_0x0ab4('0x1f')]?_['map'](_0x247a73[_0x0ab4('0x1a')][_0x0ab4('0x1f')],function(_0x571a16){return{'model':db[_0x571a16[_0x0ab4('0x20')]],'as':_0x571a16['as'],'attributes':_0x571a16[_0x0ab4('0x1d')],'include':_0x571a16[_0x0ab4('0x1f')]?_[_0x0ab4('0x21')](_0x571a16['include'],function(_0x31062e){return{'model':db[_0x31062e[_0x0ab4('0x20')]],'as':_0x31062e['as'],'attributes':_0x31062e[_0x0ab4('0x1d')],'include':_0x31062e[_0x0ab4('0x1f')]?_['map'](_0x31062e[_0x0ab4('0x1f')],function(_0x4cb661){return{'model':db[_0x4cb661[_0x0ab4('0x20')]],'as':_0x4cb661['as'],'attributes':_0x4cb661['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ab4('0xc')](function(_0x1e5dad){logger[_0x0ab4('0xd')]('GetTrigger',_0x247a73);logger[_0x0ab4('0x10')](_0x0ab4('0x17'),_0x247a73,JSON[_0x0ab4('0x12')](_0x1e5dad));_0x56204d(_0x1e5dad);})[_0x0ab4('0x16')](function(_0x3723c2){logger['error'](_0x0ab4('0x17'),_0x3723c2[_0x0ab4('0x15')],_0x247a73);_0xe17480(_0x1e90d4[_0x0ab4('0x13')](0x1f4,_0x3723c2[_0x0ab4('0x15')]));});});};exports[_0x0ab4('0x22')]=function(_0x3c7528){var _0x33d4c5=this;return new Promise(function(_0x26779e,_0x5cd540){return db[_0x0ab4('0x18')]['find']({'raw':_0x3c7528[_0x0ab4('0x1a')]?_0x3c7528['options'][_0x0ab4('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c7528[_0x0ab4('0x1a')]?_0x3c7528[_0x0ab4('0x1a')]['where']||null:null,'attributes':_0x3c7528[_0x0ab4('0x1a')]?_0x3c7528[_0x0ab4('0x1a')][_0x0ab4('0x1d')]||null:null,'include':_0x3c7528[_0x0ab4('0x1a')]?_0x3c7528[_0x0ab4('0x1a')][_0x0ab4('0x1f')]?_['map'](_0x3c7528[_0x0ab4('0x1a')][_0x0ab4('0x1f')],function(_0x563b8b){return{'model':db[_0x563b8b['model']],'as':_0x563b8b['as'],'attributes':_0x563b8b[_0x0ab4('0x1d')],'include':_0x563b8b[_0x0ab4('0x1f')]?_['map'](_0x563b8b[_0x0ab4('0x1f')],function(_0xffcd2c){return{'model':db[_0xffcd2c[_0x0ab4('0x20')]],'as':_0xffcd2c['as'],'attributes':_0xffcd2c['attributes'],'include':_0xffcd2c['include']?_[_0x0ab4('0x21')](_0xffcd2c[_0x0ab4('0x1f')],function(_0x2c7c22){return{'model':db[_0x2c7c22['model']],'as':_0x2c7c22['as'],'attributes':_0x2c7c22['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ab4('0xc')](function(_0x3b63da){logger['info'](_0x0ab4('0x22'),_0x3c7528);logger[_0x0ab4('0x10')](_0x0ab4('0x22'),_0x3c7528,JSON[_0x0ab4('0x12')](_0x3b63da));_0x26779e(_0x3b63da);})[_0x0ab4('0x16')](function(_0x39785c){logger['error'](_0x0ab4('0x22'),_0x39785c[_0x0ab4('0x15')],_0x3c7528);_0x5cd540(_0x33d4c5[_0x0ab4('0x13')](0x1f4,_0x39785c[_0x0ab4('0x15')]));});});}; \ No newline at end of file +var _0x6eeb=['model','map','GetTrigger','stringify','ShowTrigger','Trigger','find','where','then','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','findAll','options','raw','attributes','limit','include'];(function(_0x53d4f7,_0x1e0f8c){var _0x339e61=function(_0x5b9f1f){while(--_0x5b9f1f){_0x53d4f7['push'](_0x53d4f7['shift']());}};_0x339e61(++_0x1e0f8c);}(_0x6eeb,0x85));var _0xb6ee=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0x6eeb[_0x273f88];return _0x177ca1;};'use strict';var _=require(_0xb6ee('0x0'));var util=require(_0xb6ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6ee('0x2'));var db=require(_0xb6ee('0x3'))['db'];var utils=require(_0xb6ee('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb6ee('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb6ee('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x8c3a8c,_0x191c6d,_0xdba94c){return new BPromise(function(_0x36c9e3,_0x28d9c8){return client[_0xb6ee('0x7')](_0x8c3a8c,_0xdba94c)['then'](function(_0xd6ce5f){logger[_0xb6ee('0x8')](_0xb6ee('0x9'),_0x191c6d,_0xb6ee('0xa'));logger[_0xb6ee('0xb')]('Trigger,\x20%s,\x20%s,\x20%s',_0x191c6d,_0xb6ee('0xa'),JSON['stringify'](_0xd6ce5f));if(_0xd6ce5f['error']){if(_0xd6ce5f['error'][_0xb6ee('0xc')]===0x1f4){logger[_0xb6ee('0xd')](_0xb6ee('0x9'),_0x191c6d,_0xd6ce5f[_0xb6ee('0xd')][_0xb6ee('0xe')]);return _0x28d9c8(_0xd6ce5f[_0xb6ee('0xd')][_0xb6ee('0xe')]);}logger['error'](_0xb6ee('0x9'),_0x191c6d,_0xd6ce5f[_0xb6ee('0xd')][_0xb6ee('0xe')]);return _0x36c9e3(_0xd6ce5f[_0xb6ee('0xd')]['message']);}else{logger[_0xb6ee('0x8')](_0xb6ee('0x9'),_0x191c6d,_0xb6ee('0xa'));_0x36c9e3(_0xd6ce5f['result'][_0xb6ee('0xe')]);}})[_0xb6ee('0xf')](function(_0x112fcc){logger[_0xb6ee('0xd')](_0xb6ee('0x9'),_0x191c6d,_0x112fcc);_0x28d9c8(_0x112fcc);});});}exports['GetTrigger']=function(_0xc4aa6){var _0x396d93=this;return new Promise(function(_0x424a49,_0x45bbc6){return db['Trigger'][_0xb6ee('0x10')]({'raw':_0xc4aa6[_0xb6ee('0x11')]?_0xc4aa6[_0xb6ee('0x11')][_0xb6ee('0x12')]===undefined?!![]:![]:!![],'where':_0xc4aa6['options']?_0xc4aa6[_0xb6ee('0x11')]['where']||null:null,'attributes':_0xc4aa6[_0xb6ee('0x11')]?_0xc4aa6[_0xb6ee('0x11')][_0xb6ee('0x13')]||null:null,'limit':_0xc4aa6[_0xb6ee('0x11')]?_0xc4aa6[_0xb6ee('0x11')][_0xb6ee('0x14')]||null:null,'include':_0xc4aa6[_0xb6ee('0x11')]?_0xc4aa6['options'][_0xb6ee('0x15')]?_['map'](_0xc4aa6['options'][_0xb6ee('0x15')],function(_0x4353cd){return{'model':db[_0x4353cd[_0xb6ee('0x16')]],'as':_0x4353cd['as'],'attributes':_0x4353cd[_0xb6ee('0x13')],'include':_0x4353cd[_0xb6ee('0x15')]?_[_0xb6ee('0x17')](_0x4353cd['include'],function(_0x26a29a){return{'model':db[_0x26a29a[_0xb6ee('0x16')]],'as':_0x26a29a['as'],'attributes':_0x26a29a[_0xb6ee('0x13')],'include':_0x26a29a[_0xb6ee('0x15')]?_[_0xb6ee('0x17')](_0x26a29a['include'],function(_0x11c061){return{'model':db[_0x11c061[_0xb6ee('0x16')]],'as':_0x11c061['as'],'attributes':_0x11c061['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3579ba){logger[_0xb6ee('0x8')](_0xb6ee('0x18'),_0xc4aa6);logger[_0xb6ee('0xb')](_0xb6ee('0x18'),_0xc4aa6,JSON[_0xb6ee('0x19')](_0x3579ba));_0x424a49(_0x3579ba);})[_0xb6ee('0xf')](function(_0x274a31){logger[_0xb6ee('0xd')](_0xb6ee('0x18'),_0x274a31[_0xb6ee('0xe')],_0xc4aa6);_0x45bbc6(_0x396d93[_0xb6ee('0xd')](0x1f4,_0x274a31[_0xb6ee('0xe')]));});});};exports[_0xb6ee('0x1a')]=function(_0x567208){var _0xc51613=this;return new Promise(function(_0x49e242,_0x2ac884){return db[_0xb6ee('0x1b')][_0xb6ee('0x1c')]({'raw':_0x567208[_0xb6ee('0x11')]?_0x567208['options'][_0xb6ee('0x12')]===undefined?!![]:![]:!![],'where':_0x567208['options']?_0x567208[_0xb6ee('0x11')][_0xb6ee('0x1d')]||null:null,'attributes':_0x567208[_0xb6ee('0x11')]?_0x567208[_0xb6ee('0x11')]['attributes']||null:null,'include':_0x567208[_0xb6ee('0x11')]?_0x567208[_0xb6ee('0x11')]['include']?_[_0xb6ee('0x17')](_0x567208[_0xb6ee('0x11')][_0xb6ee('0x15')],function(_0x4ce8f0){return{'model':db[_0x4ce8f0[_0xb6ee('0x16')]],'as':_0x4ce8f0['as'],'attributes':_0x4ce8f0[_0xb6ee('0x13')],'include':_0x4ce8f0[_0xb6ee('0x15')]?_[_0xb6ee('0x17')](_0x4ce8f0[_0xb6ee('0x15')],function(_0x176324){return{'model':db[_0x176324[_0xb6ee('0x16')]],'as':_0x176324['as'],'attributes':_0x176324[_0xb6ee('0x13')],'include':_0x176324[_0xb6ee('0x15')]?_[_0xb6ee('0x17')](_0x176324[_0xb6ee('0x15')],function(_0xcd9b6a){return{'model':db[_0xcd9b6a['model']],'as':_0xcd9b6a['as'],'attributes':_0xcd9b6a[_0xb6ee('0x13')]};}):[]};}):[]};}):[]:[]})[_0xb6ee('0x1e')](function(_0x4e2821){logger['info'](_0xb6ee('0x1a'),_0x567208);logger[_0xb6ee('0xb')](_0xb6ee('0x1a'),_0x567208,JSON['stringify'](_0x4e2821));_0x49e242(_0x4e2821);})[_0xb6ee('0xf')](function(_0x5034c9){logger['error']('ShowTrigger',_0x5034c9[_0xb6ee('0xe')],_0x567208);_0x2ac884(_0xc51613['error'](0x1f4,_0x5034c9[_0xb6ee('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 10631eb..6c0d551 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2422=['../../components/interaction/service','./trunk.controller','get','index','/:id','show','post','/:id/clone','isAuthenticated','create','put','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x2422,0x12a));var _0x2242=function(_0x2a771c,_0x42a1ef){_0x2a771c=_0x2a771c-0x0;var _0x205d97=_0x2422[_0x2a771c];return _0x205d97;};'use strict';var multer=require(_0x2242('0x0'));var util=require(_0x2242('0x1'));var path=require(_0x2242('0x2'));var timeout=require('connect-timeout');var express=require(_0x2242('0x3'));var router=express[_0x2242('0x4')]();var fs_extra=require(_0x2242('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2242('0x6'));var config=require('../../config/environment');var controller=require(_0x2242('0x7'));router[_0x2242('0x8')]('/',auth['isAuthenticated'](),controller[_0x2242('0x9')]);router['get'](_0x2242('0xa'),auth['isAuthenticated'](),controller[_0x2242('0xb')]);router[_0x2242('0xc')](_0x2242('0xd'),auth['isAuthenticated'](),controller['clone']);router['post']('/',auth[_0x2242('0xe')](),controller[_0x2242('0xf')]);router[_0x2242('0x10')](_0x2242('0xa'),auth[_0x2242('0xe')](),controller['update']);router[_0x2242('0x11')](_0x2242('0xa'),auth[_0x2242('0xe')](),controller[_0x2242('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7f20=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','/:id','show','post','/:id/clone','clone'];(function(_0x194576,_0x543558){var _0x67603e=function(_0x2f2a4a){while(--_0x2f2a4a){_0x194576['push'](_0x194576['shift']());}};_0x67603e(++_0x543558);}(_0x7f20,0x156));var _0x07f2=function(_0x184011,_0x23cf30){_0x184011=_0x184011-0x0;var _0x224e86=_0x7f20[_0x184011];return _0x224e86;};'use strict';var multer=require(_0x07f2('0x0'));var util=require(_0x07f2('0x1'));var path=require(_0x07f2('0x2'));var timeout=require(_0x07f2('0x3'));var express=require(_0x07f2('0x4'));var router=express[_0x07f2('0x5')]();var fs_extra=require(_0x07f2('0x6'));var auth=require(_0x07f2('0x7'));var interaction=require(_0x07f2('0x8'));var config=require(_0x07f2('0x9'));var controller=require(_0x07f2('0xa'));router['get']('/',auth[_0x07f2('0xb')](),controller[_0x07f2('0xc')]);router['get'](_0x07f2('0xd'),auth[_0x07f2('0xb')](),controller[_0x07f2('0xe')]);router[_0x07f2('0xf')](_0x07f2('0x10'),auth[_0x07f2('0xb')](),controller[_0x07f2('0x11')]);router[_0x07f2('0xf')]('/',auth[_0x07f2('0xb')](),controller[_0x07f2('0x12')]);router[_0x07f2('0x13')](_0x07f2('0xd'),auth[_0x07f2('0xb')](),controller[_0x07f2('0x14')]);router[_0x07f2('0x15')](_0x07f2('0xd'),auth[_0x07f2('0xb')](),controller[_0x07f2('0x16')]);module[_0x07f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 945fafe..d873712 100644 --- a/server/api/trunk/trunk.attributes.js +++ b/server/api/trunk/trunk.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e9c=['dynamic','update,nonat','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','join','getDataValue','split','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0x1e9c,0x98));var _0xc1e9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1e9c[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc1e9('0x0')],'allowNull':![],'unique':_0xc1e9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x3'),'user',_0xc1e9('0x4')),'allowNull':![],'defaultValue':_0xc1e9('0x3')},'context':{'type':Sequelize[_0xc1e9('0x0')],'allowNull':![],'defaultValue':_0xc1e9('0x5')},'callingpres':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x6'),_0xc1e9('0x7'),_0xc1e9('0x8'),_0xc1e9('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xc1e9('0xa'),_0xc1e9('0xb'))},'deny':{'type':Sequelize[_0xc1e9('0x0')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xc1e9('0x0')]},'md5secret':{'type':Sequelize[_0xc1e9('0x0')]},'remotesecret':{'type':Sequelize[_0xc1e9('0x0')]},'transport':{'type':Sequelize[_0xc1e9('0x0')],'defaultValue':'udp','set':function(_0x570693){this[_0xc1e9('0xc')]('transport',_0x570693?_0x570693[_0xc1e9('0xd')](','):null);},'get':function(){return this[_0xc1e9('0xe')]('transport')?this[_0xc1e9('0xe')]('transport')[_0xc1e9('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x10'),_0xc1e9('0x11'),'shortinfo',_0xc1e9('0x12'),_0xc1e9('0x13')),'defaultValue':_0xc1e9('0x10')},'directmedia':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no',_0xc1e9('0x15'),_0xc1e9('0x16'),_0xc1e9('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xc1e9('0x18'),'set':function(_0x61ff3a){this[_0xc1e9('0xc')](_0xc1e9('0x19'),_0x61ff3a?_0x61ff3a[_0xc1e9('0xd')](','):null);},'get':function(){return this[_0xc1e9('0xe')](_0xc1e9('0x19'))?this[_0xc1e9('0xe')](_0xc1e9('0x19'))[_0xc1e9('0xf')](','):null;},'comment':_0xc1e9('0x1a')},'callgroup':{'type':Sequelize[_0xc1e9('0x0')]},'namedcallgroup':{'type':Sequelize[_0xc1e9('0x0')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc1e9('0x0')]},'language':{'type':Sequelize[_0xc1e9('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc1e9('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc1e9('0x0')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xc1e9('0x0')],'allowNull':![],'defaultValue':_0xc1e9('0x1b'),'set':function(_0x8064dc){this['setDataValue'](_0xc1e9('0x1c'),_0x8064dc?_0x8064dc[_0xc1e9('0xd')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc1e9('0xe')](_0xc1e9('0x1c'))?this[_0xc1e9('0xe')]('allow')[_0xc1e9('0xf')](';'):null;},'comment':_0xc1e9('0x1d')},'autoframing':{'type':Sequelize[_0xc1e9('0x2')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xc1e9('0x1e'),'set':function(_0x1d3db5){this[_0xc1e9('0xc')]('insecure',_0x1d3db5?_0x1d3db5['join'](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue'](_0xc1e9('0x1f'))['split'](','):null;},'comment':_0xc1e9('0x20')},'trustrpid':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xc1e9('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no',_0xc1e9('0x21'))},'promiscredir':{'type':Sequelize[_0xc1e9('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xc1e9('0x14'),'no')},'accountcode':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'setvar':{'type':Sequelize[_0xc1e9('0x0')]},'callerid':{'type':Sequelize[_0xc1e9('0x0')],'defaultValue':_0xc1e9('0x23')},'amaflags':{'type':Sequelize[_0xc1e9('0x0')]},'callcounter':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no'),'defaultValue':_0xc1e9('0x14')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xc1e9('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0xc1e9('0x0')]},'template':{'type':Sequelize[_0xc1e9('0x0')]},'videosupport':{'type':Sequelize[_0xc1e9('0x2')]('yes','no',_0xc1e9('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no')},'mailbox':{'type':Sequelize[_0xc1e9('0x0')]},'session_timers':{'type':Sequelize['ENUM'](_0xc1e9('0x25'),_0xc1e9('0x26'),_0xc1e9('0x27'))},'session_expires':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'session_minse':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x28'),_0xc1e9('0x29')),'defaultValue':_0xc1e9('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xc1e9('0x0')]},'fromdomain':{'type':Sequelize[_0xc1e9('0x0')]},'fromuser':{'type':Sequelize[_0xc1e9('0x0')]},'port':{'type':Sequelize[_0xc1e9('0x22')](0x5)},'qualify':{'type':Sequelize[_0xc1e9('0x2')]('yes','no'),'defaultValue':_0xc1e9('0x14')},'keepalive':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no',_0xc1e9('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc1e9('0x0')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'timerb':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xc1e9('0x0')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xc1e9('0x0')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xc1e9('0x0')]},'maxforwards':{'type':Sequelize[_0xc1e9('0x22')](0xb)},'encryption':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xc1e9('0x14'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xc1e9('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no',_0xc1e9('0x2b'),_0xc1e9('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xc1e9('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0xc1e9('0x0')]},'dtlscipher':{'type':Sequelize[_0xc1e9('0x0')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xc1e9('0x0')]},'dtlssetup':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x2d'),_0xc1e9('0x2e'),_0xc1e9('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc1e9('0x0')]},'usereqphone':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc1e9('0x0')]},'recordofffeature':{'type':Sequelize[_0xc1e9('0x0')]},'call_limit':{'type':Sequelize[_0xc1e9('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc1e9('0x2')](_0xc1e9('0x14'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xc1e9('0x14'),'no')},'vmexten':{'type':Sequelize[_0xc1e9('0x0')]},'mohinterpret':{'type':Sequelize[_0xc1e9('0x0')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xc1e9('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc1e9('0x0')],'defaultValue':_0xc1e9('0x30')},'canreinvite':{'type':Sequelize[_0xc1e9('0x2')]('yes','no',_0xc1e9('0x15'),'update',_0xc1e9('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xc1e9('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc1e9('0x0')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4be0=['originate','uas','pai','fingerprint','certificate','active','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','peer','friend','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept'];(function(_0x53f518,_0x160dcb){var _0x34d374=function(_0x12506c){while(--_0x12506c){_0x53f518['push'](_0x53f518['shift']());}};_0x34d374(++_0x160dcb);}(_0x4be0,0x1cb));var _0x04be=function(_0x4764b1,_0x4206de){_0x4764b1=_0x4764b1-0x0;var _0x1f52a6=_0x4be0[_0x4764b1];return _0x1f52a6;};'use strict';var Sequelize=require(_0x04be('0x0'));module[_0x04be('0x1')]={'name':{'type':Sequelize[_0x04be('0x2')],'allowNull':![],'unique':_0x04be('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend','user',_0x04be('0x4')),'allowNull':![],'defaultValue':_0x04be('0x5')},'context':{'type':Sequelize[_0x04be('0x2')],'allowNull':![],'defaultValue':_0x04be('0x6')},'callingpres':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x8'),_0x04be('0x9'),'ALLOWED_FAILED_SCREEN',_0x04be('0xa'),_0x04be('0xb'),'PROHIB_PASSED_SCREEN',_0x04be('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x04be('0x2')]},'secret':{'type':Sequelize[_0x04be('0x2')]},'md5secret':{'type':Sequelize[_0x04be('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x04be('0x2')],'defaultValue':_0x04be('0xd'),'set':function(_0xf92d0c){this['setDataValue'](_0x04be('0xe'),_0xf92d0c?_0xf92d0c[_0x04be('0xf')](','):null);},'get':function(){return this[_0x04be('0x10')]('transport')?this[_0x04be('0x10')](_0x04be('0xe'))[_0x04be('0x11')](','):null;},'comment':_0x04be('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0x04be('0x13'),'info',_0x04be('0x14'),_0x04be('0x15'),_0x04be('0x16')),'defaultValue':_0x04be('0x13')},'directmedia':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no',_0x04be('0x18'),_0x04be('0x19'),_0x04be('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x04be('0x2')]},'directmediadeny':{'type':Sequelize[_0x04be('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x214327){this['setDataValue']('nat',_0x214327?_0x214327[_0x04be('0xf')](','):null);},'get':function(){return this[_0x04be('0x10')](_0x04be('0x1b'))?this[_0x04be('0x10')]('nat')[_0x04be('0x11')](','):null;},'comment':_0x04be('0x1c')},'callgroup':{'type':Sequelize[_0x04be('0x2')]},'namedcallgroup':{'type':Sequelize[_0x04be('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x04be('0x2')]},'language':{'type':Sequelize[_0x04be('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x04be('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04be('0x1d'),'set':function(_0x5ed1b8){this[_0x04be('0x1e')](_0x04be('0x1f'),_0x5ed1b8?_0x5ed1b8['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x04be('0x10')](_0x04be('0x1f'))?this[_0x04be('0x10')](_0x04be('0x1f'))[_0x04be('0x11')](';'):null;},'comment':_0x04be('0x20')},'autoframing':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'insecure':{'type':Sequelize[_0x04be('0x2')],'defaultValue':_0x04be('0x21'),'set':function(_0x587ff7){this['setDataValue'](_0x04be('0x22'),_0x587ff7?_0x587ff7[_0x04be('0xf')](','):null);},'get':function(){return this[_0x04be('0x10')]('insecure')?this[_0x04be('0x10')](_0x04be('0x22'))[_0x04be('0x11')](','):null;},'comment':_0x04be('0x23')},'trustrpid':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x04be('0x7')]('yes','no',_0x04be('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x04be('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'accountcode':{'type':Sequelize[_0x04be('0x25')](0xb)},'setvar':{'type':Sequelize[_0x04be('0x2')]},'callerid':{'type':Sequelize[_0x04be('0x2')],'defaultValue':_0x04be('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x04be('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x04be('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x04be('0x7')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x04be('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x04be('0x17'),'no',_0x04be('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x04be('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x04be('0x17'),'no')},'mailbox':{'type':Sequelize[_0x04be('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x04be('0x28'),'refuse',_0x04be('0x29'))},'session_expires':{'type':Sequelize[_0x04be('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x04be('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x04be('0x7')]('uac','uas'),'defaultValue':_0x04be('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x04be('0x2')]},'regexten':{'type':Sequelize[_0x04be('0x2')]},'fromdomain':{'type':Sequelize[_0x04be('0x2')]},'fromuser':{'type':Sequelize[_0x04be('0x2')]},'port':{'type':Sequelize[_0x04be('0x25')](0x5)},'qualify':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x04be('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x04be('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x04be('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x04be('0x17'),'no',_0x04be('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x04be('0x2')]},'callbackextension':{'type':Sequelize[_0x04be('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x04be('0x2')]},'contactacl':{'type':Sequelize[_0x04be('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x04be('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x04be('0x25')](0xb)},'encryption':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x04be('0x17'),'no')},'icesupport':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no',_0x04be('0x2c'),_0x04be('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x04be('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x04be('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x04be('0x2')]},'dtlscipher':{'type':Sequelize[_0x04be('0x2')]},'dtlscafile':{'type':Sequelize[_0x04be('0x2')]},'dtlscapath':{'type':Sequelize[_0x04be('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x04be('0x2e'),'passive',_0x04be('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x04be('0x2')]},'usereqphone':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x04be('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x04be('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x04be('0x2')]},'mohsuggest':{'type':Sequelize[_0x04be('0x2')]},'parkinglot':{'type':Sequelize[_0x04be('0x2')]},'description':{'type':Sequelize[_0x04be('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x04be('0x7')](_0x04be('0x17'),'no','nonat',_0x04be('0x19'),_0x04be('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x04be('0x2')]},'otherFields':{'type':Sequelize[_0x04be('0x2')]},'active':{'type':Sequelize[_0x04be('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 9cd982c..9deef43 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1a2db1,_0x41dd3e){var _0x4f36a4=function(_0x3d8983){while(--_0x3d8983){_0x1a2db1['push'](_0x1a2db1['shift']());}};_0x4f36a4(++_0x41dd3e);}(_0x55ca,0x126));var _0xa55c=function(_0x1c08f6,_0x14c077){_0x1c08f6=_0x1c08f6-0x0;var _0xbc156a=_0x55ca[_0x1c08f6];return _0xbc156a;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file +var _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','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','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x3c5d31,_0x1b6ce7){var _0x250c19=function(_0x25af67){while(--_0x25af67){_0x3c5d31['push'](_0x3c5d31['shift']());}};_0x250c19(++_0x1b6ce7);}(_0x3e74,0x175));var _0x43e7=function(_0x53622b,_0x14493b){_0x53622b=_0x53622b-0x0;var _0x5aaa96=_0x3e74[_0x53622b];return _0x5aaa96;};'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'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 0dffefa..0591b66 100644 --- a/server/api/trunk/trunk.model.js +++ b/server/api/trunk/trunk.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x456f=['Trunk','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x456f,0x1bb));var _0xf456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x456f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf456('0x0'));var util=require(_0xf456('0x1'));var logger=require(_0xf456('0x2'))('api');var moment=require(_0xf456('0x3'));var BPromise=require(_0xf456('0x4'));var rp=require(_0xf456('0x5'));var fs=require('fs');var path=require(_0xf456('0x6'));var rimraf=require(_0xf456('0x7'));var config=require(_0xf456('0x8'));var attributes=require(_0xf456('0x9'));module[_0xf456('0xa')]=function(_0x3e130e,_0x367adf){return _0x3e130e[_0xf456('0xb')](_0xf456('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85f7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks'];(function(_0x273d31,_0x367127){var _0x43b876=function(_0xdbb7e4){while(--_0xdbb7e4){_0x273d31['push'](_0x273d31['shift']());}};_0x43b876(++_0x367127);}(_0x85f7,0x1c7));var _0x785f=function(_0x16cf3,_0xd3f42e){_0x16cf3=_0x16cf3-0x0;var _0x593ba7=_0x85f7[_0x16cf3];return _0x593ba7;};'use strict';var _=require(_0x785f('0x0'));var util=require(_0x785f('0x1'));var logger=require(_0x785f('0x2'))(_0x785f('0x3'));var moment=require(_0x785f('0x4'));var BPromise=require(_0x785f('0x5'));var rp=require(_0x785f('0x6'));var fs=require('fs');var path=require(_0x785f('0x7'));var rimraf=require('rimraf');var config=require(_0x785f('0x8'));var attributes=require(_0x785f('0x9'));module['exports']=function(_0x101613,_0x278087){return _0x101613[_0x785f('0xa')](_0x785f('0xb'),attributes,{'tableName':_0x785f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 6d972d6..c2f90db 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28f5=['model','then','debug','ShowTrunk','find','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','map','include'];(function(_0xefb4e,_0xe56689){var _0x36c78c=function(_0x158fe3){while(--_0x158fe3){_0xefb4e['push'](_0xefb4e['shift']());}};_0x36c78c(++_0xe56689);}(_0x28f5,0x141));var _0x528f=function(_0x1f2961,_0xc132c7){_0x1f2961=_0x1f2961-0x0;var _0x26dc4f=_0x28f5[_0x1f2961];return _0x26dc4f;};'use strict';var _=require('lodash');var util=require(_0x528f('0x0'));var moment=require('moment');var BPromise=require(_0x528f('0x1'));var rs=require(_0x528f('0x2'));var fs=require('fs');var Redis=require(_0x528f('0x3'));var db=require(_0x528f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x528f('0x5'))(_0x528f('0x6'));var config=require(_0x528f('0x7'));var jayson=require(_0x528f('0x8'));var client=jayson[_0x528f('0x9')][_0x528f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aa17c,_0x4313a2,_0x33065a){return new BPromise(function(_0x11e019,_0x5599f4){return client['request'](_0x4aa17c,_0x33065a)['then'](function(_0x1f8dd2){logger[_0x528f('0xb')](_0x528f('0xc'),_0x4313a2,'request\x20sent');logger['debug'](_0x528f('0xd'),_0x4313a2,_0x528f('0xe'),JSON[_0x528f('0xf')](_0x1f8dd2));if(_0x1f8dd2[_0x528f('0x10')]){if(_0x1f8dd2[_0x528f('0x10')][_0x528f('0x11')]===0x1f4){logger['error'](_0x528f('0xc'),_0x4313a2,_0x1f8dd2[_0x528f('0x10')]['message']);return _0x5599f4(_0x1f8dd2[_0x528f('0x10')][_0x528f('0x12')]);}logger[_0x528f('0x10')]('Trunk,\x20%s,\x20%s',_0x4313a2,_0x1f8dd2['error'][_0x528f('0x12')]);return _0x11e019(_0x1f8dd2['error']['message']);}else{logger[_0x528f('0xb')](_0x528f('0xc'),_0x4313a2,_0x528f('0xe'));_0x11e019(_0x1f8dd2[_0x528f('0x13')][_0x528f('0x12')]);}})['catch'](function(_0x5dfd8f){logger[_0x528f('0x10')]('Trunk,\x20%s,\x20%s',_0x4313a2,_0x5dfd8f);_0x5599f4(_0x5dfd8f);});});}exports[_0x528f('0x14')]=function(_0x142ed2){var _0x87b484=this;return new Promise(function(_0x55855b,_0x1252ff){return db[_0x528f('0x15')][_0x528f('0x16')]({'raw':_0x142ed2[_0x528f('0x17')]?_0x142ed2[_0x528f('0x17')][_0x528f('0x18')]===undefined?!![]:![]:!![],'where':_0x142ed2[_0x528f('0x17')]?_0x142ed2[_0x528f('0x17')][_0x528f('0x19')]||null:null,'attributes':_0x142ed2['options']?_0x142ed2['options'][_0x528f('0x1a')]||null:null,'limit':_0x142ed2[_0x528f('0x17')]?_0x142ed2[_0x528f('0x17')]['limit']||null:null,'include':_0x142ed2[_0x528f('0x17')]?_0x142ed2[_0x528f('0x17')]['include']?_[_0x528f('0x1b')](_0x142ed2[_0x528f('0x17')][_0x528f('0x1c')],function(_0x5ecf3b){return{'model':db[_0x5ecf3b[_0x528f('0x1d')]],'as':_0x5ecf3b['as'],'attributes':_0x5ecf3b[_0x528f('0x1a')],'include':_0x5ecf3b['include']?_[_0x528f('0x1b')](_0x5ecf3b[_0x528f('0x1c')],function(_0x53ed6a){return{'model':db[_0x53ed6a[_0x528f('0x1d')]],'as':_0x53ed6a['as'],'attributes':_0x53ed6a['attributes'],'include':_0x53ed6a[_0x528f('0x1c')]?_[_0x528f('0x1b')](_0x53ed6a[_0x528f('0x1c')],function(_0x1d3cd5){return{'model':db[_0x1d3cd5['model']],'as':_0x1d3cd5['as'],'attributes':_0x1d3cd5[_0x528f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x528f('0x1e')](function(_0x1dd92e){logger[_0x528f('0xb')]('GetTrunk',_0x142ed2);logger[_0x528f('0x1f')](_0x528f('0x14'),_0x142ed2,JSON[_0x528f('0xf')](_0x1dd92e));_0x55855b(_0x1dd92e);})['catch'](function(_0x2e29e0){logger[_0x528f('0x10')](_0x528f('0x14'),_0x2e29e0['message'],_0x142ed2);_0x1252ff(_0x87b484[_0x528f('0x10')](0x1f4,_0x2e29e0[_0x528f('0x12')]));});});};exports[_0x528f('0x20')]=function(_0x36c7d7){var _0xa3528b=this;return new Promise(function(_0x4aba9a,_0x16b480){return db[_0x528f('0x15')][_0x528f('0x21')]({'raw':_0x36c7d7[_0x528f('0x17')]?_0x36c7d7['options'][_0x528f('0x18')]===undefined?!![]:![]:!![],'where':_0x36c7d7[_0x528f('0x17')]?_0x36c7d7['options'][_0x528f('0x19')]||null:null,'attributes':_0x36c7d7[_0x528f('0x17')]?_0x36c7d7[_0x528f('0x17')][_0x528f('0x1a')]||null:null,'include':_0x36c7d7['options']?_0x36c7d7[_0x528f('0x17')][_0x528f('0x1c')]?_[_0x528f('0x1b')](_0x36c7d7[_0x528f('0x17')][_0x528f('0x1c')],function(_0x1feb43){return{'model':db[_0x1feb43['model']],'as':_0x1feb43['as'],'attributes':_0x1feb43['attributes'],'include':_0x1feb43['include']?_[_0x528f('0x1b')](_0x1feb43['include'],function(_0xe24d65){return{'model':db[_0xe24d65[_0x528f('0x1d')]],'as':_0xe24d65['as'],'attributes':_0xe24d65[_0x528f('0x1a')],'include':_0xe24d65[_0x528f('0x1c')]?_[_0x528f('0x1b')](_0xe24d65[_0x528f('0x1c')],function(_0x163b5f){return{'model':db[_0x163b5f[_0x528f('0x1d')]],'as':_0x163b5f['as'],'attributes':_0x163b5f[_0x528f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x528f('0x1e')](function(_0x4d3076){logger[_0x528f('0xb')]('ShowTrunk',_0x36c7d7);logger[_0x528f('0x1f')]('ShowTrunk',_0x36c7d7,JSON['stringify'](_0x4d3076));_0x4aba9a(_0x4d3076);})[_0x528f('0x22')](function(_0x3f62d2){logger[_0x528f('0x10')](_0x528f('0x20'),_0x3f62d2[_0x528f('0x12')],_0x36c7d7);_0x16b480(_0xa3528b[_0x528f('0x10')](0x1f4,_0x3f62d2[_0x528f('0x12')]));});});}; \ No newline at end of file +var _0x4583=['include','map','attributes','model','GetTrunk','debug','ShowTrunk','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','Trunk','findAll','options','raw','where'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4583,0x17a));var _0x3458=function(_0xb68b6f,_0x49134a){_0xb68b6f=_0xb68b6f-0x0;var _0x1d174c=_0x4583[_0xb68b6f];return _0x1d174c;};'use strict';var _=require('lodash');var util=require(_0x3458('0x0'));var moment=require(_0x3458('0x1'));var BPromise=require(_0x3458('0x2'));var rs=require(_0x3458('0x3'));var fs=require('fs');var Redis=require(_0x3458('0x4'));var db=require(_0x3458('0x5'))['db'];var utils=require(_0x3458('0x6'));var logger=require(_0x3458('0x7'))(_0x3458('0x8'));var config=require(_0x3458('0x9'));var jayson=require(_0x3458('0xa'));var client=jayson[_0x3458('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17e73d,_0x4b24dc,_0x3fc401){return new BPromise(function(_0x3001ce,_0x300eea){return client[_0x3458('0xc')](_0x17e73d,_0x3fc401)[_0x3458('0xd')](function(_0x3bbcef){logger[_0x3458('0xe')]('Trunk,\x20%s,\x20%s',_0x4b24dc,_0x3458('0xf'));logger['debug'](_0x3458('0x10'),_0x4b24dc,_0x3458('0xf'),JSON[_0x3458('0x11')](_0x3bbcef));if(_0x3bbcef['error']){if(_0x3bbcef[_0x3458('0x12')][_0x3458('0x13')]===0x1f4){logger[_0x3458('0x12')](_0x3458('0x14'),_0x4b24dc,_0x3bbcef[_0x3458('0x12')][_0x3458('0x15')]);return _0x300eea(_0x3bbcef[_0x3458('0x12')][_0x3458('0x15')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x4b24dc,_0x3bbcef['error']['message']);return _0x3001ce(_0x3bbcef[_0x3458('0x12')]['message']);}else{logger[_0x3458('0xe')](_0x3458('0x14'),_0x4b24dc,_0x3458('0xf'));_0x3001ce(_0x3bbcef[_0x3458('0x16')][_0x3458('0x15')]);}})[_0x3458('0x17')](function(_0x5aede6){logger[_0x3458('0x12')](_0x3458('0x14'),_0x4b24dc,_0x5aede6);_0x300eea(_0x5aede6);});});}exports['GetTrunk']=function(_0x40fb8e){var _0x5cd2c8=this;return new Promise(function(_0x4dda61,_0x204626){return db[_0x3458('0x18')][_0x3458('0x19')]({'raw':_0x40fb8e[_0x3458('0x1a')]?_0x40fb8e[_0x3458('0x1a')][_0x3458('0x1b')]===undefined?!![]:![]:!![],'where':_0x40fb8e['options']?_0x40fb8e['options'][_0x3458('0x1c')]||null:null,'attributes':_0x40fb8e[_0x3458('0x1a')]?_0x40fb8e['options']['attributes']||null:null,'limit':_0x40fb8e['options']?_0x40fb8e['options']['limit']||null:null,'include':_0x40fb8e[_0x3458('0x1a')]?_0x40fb8e[_0x3458('0x1a')][_0x3458('0x1d')]?_[_0x3458('0x1e')](_0x40fb8e['options'][_0x3458('0x1d')],function(_0x2fb964){return{'model':db[_0x2fb964['model']],'as':_0x2fb964['as'],'attributes':_0x2fb964[_0x3458('0x1f')],'include':_0x2fb964['include']?_[_0x3458('0x1e')](_0x2fb964[_0x3458('0x1d')],function(_0x2f5d73){return{'model':db[_0x2f5d73[_0x3458('0x20')]],'as':_0x2f5d73['as'],'attributes':_0x2f5d73['attributes'],'include':_0x2f5d73[_0x3458('0x1d')]?_[_0x3458('0x1e')](_0x2f5d73[_0x3458('0x1d')],function(_0x29ab1b){return{'model':db[_0x29ab1b['model']],'as':_0x29ab1b['as'],'attributes':_0x29ab1b[_0x3458('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3458('0xd')](function(_0x7df0d){logger[_0x3458('0xe')](_0x3458('0x21'),_0x40fb8e);logger[_0x3458('0x22')](_0x3458('0x21'),_0x40fb8e,JSON['stringify'](_0x7df0d));_0x4dda61(_0x7df0d);})[_0x3458('0x17')](function(_0x529d0b){logger[_0x3458('0x12')]('GetTrunk',_0x529d0b[_0x3458('0x15')],_0x40fb8e);_0x204626(_0x5cd2c8['error'](0x1f4,_0x529d0b[_0x3458('0x15')]));});});};exports[_0x3458('0x23')]=function(_0x4944c3){var _0x162752=this;return new Promise(function(_0x128a8d,_0x46c1ae){return db[_0x3458('0x18')][_0x3458('0x24')]({'raw':_0x4944c3[_0x3458('0x1a')]?_0x4944c3[_0x3458('0x1a')][_0x3458('0x1b')]===undefined?!![]:![]:!![],'where':_0x4944c3[_0x3458('0x1a')]?_0x4944c3[_0x3458('0x1a')][_0x3458('0x1c')]||null:null,'attributes':_0x4944c3[_0x3458('0x1a')]?_0x4944c3['options'][_0x3458('0x1f')]||null:null,'include':_0x4944c3[_0x3458('0x1a')]?_0x4944c3['options'][_0x3458('0x1d')]?_['map'](_0x4944c3[_0x3458('0x1a')]['include'],function(_0xc1852c){return{'model':db[_0xc1852c[_0x3458('0x20')]],'as':_0xc1852c['as'],'attributes':_0xc1852c[_0x3458('0x1f')],'include':_0xc1852c['include']?_[_0x3458('0x1e')](_0xc1852c[_0x3458('0x1d')],function(_0x539103){return{'model':db[_0x539103[_0x3458('0x20')]],'as':_0x539103['as'],'attributes':_0x539103[_0x3458('0x1f')],'include':_0x539103['include']?_[_0x3458('0x1e')](_0x539103[_0x3458('0x1d')],function(_0x55a9ba){return{'model':db[_0x55a9ba[_0x3458('0x20')]],'as':_0x55a9ba['as'],'attributes':_0x55a9ba[_0x3458('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3458('0xd')](function(_0x4faae4){logger[_0x3458('0xe')](_0x3458('0x23'),_0x4944c3);logger[_0x3458('0x22')]('ShowTrunk',_0x4944c3,JSON[_0x3458('0x11')](_0x4faae4));_0x128a8d(_0x4faae4);})[_0x3458('0x17')](function(_0x213da3){logger[_0x3458('0x12')]('ShowTrunk',_0x213da3['message'],_0x4944c3);_0x46c1ae(_0x162752[_0x3458('0x12')](0x1f4,_0x213da3[_0x3458('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 78ddf59..3755d85 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90e0=['../../components/auth/service','put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x90e0,0xc6));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x090e('0x0'));var router=express[_0x090e('0x1')]();var auth=require(_0x090e('0x2'));var controller=require('./user-setting.controller');router[_0x090e('0x3')](_0x090e('0x4'),auth[_0x090e('0x5')](),controller[_0x090e('0x6')]);module[_0x090e('0x7')]=router; \ No newline at end of file +var _0x738a=['update','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x52dc7f,_0x1bdb9d){var _0x32f57a=function(_0x207cca){while(--_0x207cca){_0x52dc7f['push'](_0x52dc7f['shift']());}};_0x32f57a(++_0x1bdb9d);}(_0x738a,0x6a));var _0xa738=function(_0x9119f3,_0x5364d3){_0x9119f3=_0x9119f3-0x0;var _0x336cc3=_0x738a[_0x9119f3];return _0x336cc3;};'use strict';var express=require('express');var router=express[_0xa738('0x0')]();var auth=require(_0xa738('0x1'));var controller=require(_0xa738('0x2'));router[_0xa738('0x3')](_0xa738('0x4'),auth[_0xa738('0x5')](),controller[_0xa738('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index d8dae88..9f83d5f 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa31d=['ENUM','error','TEXT','DATE','sequelize','warning','info','debug','exports'];(function(_0xcb37df,_0x167e90){var _0x5d3122=function(_0x14e707){while(--_0x14e707){_0xcb37df['push'](_0xcb37df['shift']());}};_0x5d3122(++_0x167e90);}(_0xa31d,0xb8));var _0xda31=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xa31d[_0x2080a3];return _0x8d7d17;};'use strict';var Sequelize=require(_0xda31('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xda31('0x1'),_0xda31('0x2'),_0xda31('0x3')];module[_0xda31('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xda31('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xda31('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xda31('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xda31('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0xed2b=['BOOLEAN','TEXT','DATE','INTEGER','sequelize','error','warning','info','debug','ENUM'];(function(_0x14d5b9,_0x2e7b12){var _0xc298d5=function(_0x2ac815){while(--_0x2ac815){_0x14d5b9['push'](_0x14d5b9['shift']());}};_0xc298d5(++_0x2e7b12);}(_0xed2b,0x130));var _0xbed2=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xed2b[_0x42020e];return _0x561551;};'use strict';var Sequelize=require(_0xbed2('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xbed2('0x1'),_0xbed2('0x2'),_0xbed2('0x3'),_0xbed2('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xbed2('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xbed2('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xbed2('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xbed2('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xbed2('0x9')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index f8f4b4c..4f238b2 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb99=['catch','lodash','../../config/logger','../../mysqldb','socket.io-emitter','redis','register','status','json','update','sendStatus','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xcb99,0x8b));var _0x9cb9=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0xcb99[_0x1b95a1];return _0x57aef1;};'use strict';var _=require(_0x9cb9('0x0'));var Redis=require('ioredis');var logger=require(_0x9cb9('0x1'))('api');var config=require('../../config/environment');var db=require(_0x9cb9('0x2'))['db'];var socket=require(_0x9cb9('0x3'))(new Redis(config[_0x9cb9('0x4')]));require('./user-setting.socket')[_0x9cb9('0x5')](socket);config[_0x9cb9('0x4')]=_['defaults'](config[_0x9cb9('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x2ed26a,_0xa84493){_0xa84493=_0xa84493||0xc8;return function(_0x1bf9b7){if(_0x1bf9b7){return _0x2ed26a[_0x9cb9('0x6')](_0xa84493)[_0x9cb9('0x7')](_0x1bf9b7);}};}function saveUpdates(_0x124bd0){return function(_0x106f17){if(_0x106f17){return _0x106f17[_0x9cb9('0x8')](_0x124bd0)['then'](function(_0x5264c9){return _0x5264c9;});}return null;};}function handleEntityNotFound(_0xe6d275){return function(_0x392f93){if(!_0x392f93){_0xe6d275[_0x9cb9('0x9')](0x194);}return _0x392f93;};}function handleError(_0x5a0ac7,_0x3be02c){_0x3be02c=_0x3be02c||0x1f4;return function(_0x3d38f1){logger['error'](_0x3d38f1['stack']);if(_0x3d38f1[_0x9cb9('0xa')]){delete _0x3d38f1[_0x9cb9('0xa')];}_0x5a0ac7[_0x9cb9('0x6')](_0x3be02c)[_0x9cb9('0xb')](_0x3d38f1);};}exports['update']=function(_0x255f8e,_0x37dc98){if(_0x255f8e[_0x9cb9('0xc')][_0x9cb9('0xd')]!==_0x9cb9('0xe'))throw new Error(_0x9cb9('0xf'));if(isNaN(Number(_0x255f8e[_0x9cb9('0x10')]['id'])))throw new Error(_0x9cb9('0x11'));return db[_0x9cb9('0x12')][_0x9cb9('0x13')]({'where':{'id':_0x255f8e[_0x9cb9('0x10')]['id']}})[_0x9cb9('0x14')](handleEntityNotFound(_0x37dc98,null))[_0x9cb9('0x14')](saveUpdates(_0x255f8e[_0x9cb9('0x15')],null))[_0x9cb9('0x14')](respondWithResult(_0x37dc98,null))[_0x9cb9('0x16')](handleError(_0x37dc98,null));}; \ No newline at end of file +var _0x1c42=['then','sendStatus','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','update'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x1c42,0x13a));var _0x21c4=function(_0x1130ee,_0x42c47e){_0x1130ee=_0x1130ee-0x0;var _0x5c1f51=_0x1c42[_0x1130ee];return _0x5c1f51;};'use strict';var _=require('lodash');var Redis=require(_0x21c4('0x0'));var logger=require(_0x21c4('0x1'))(_0x21c4('0x2'));var config=require('../../config/environment');var db=require(_0x21c4('0x3'))['db'];var socket=require(_0x21c4('0x4'))(new Redis(config[_0x21c4('0x5')]));require(_0x21c4('0x6'))[_0x21c4('0x7')](socket);config[_0x21c4('0x5')]=_[_0x21c4('0x8')](config[_0x21c4('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x247ec9,_0x472df1){_0x472df1=_0x472df1||0xc8;return function(_0x54b2ea){if(_0x54b2ea){return _0x247ec9[_0x21c4('0x9')](_0x472df1)['json'](_0x54b2ea);}};}function saveUpdates(_0x3e298a){return function(_0x9c5e56){if(_0x9c5e56){return _0x9c5e56[_0x21c4('0xa')](_0x3e298a)[_0x21c4('0xb')](function(_0x135282){return _0x135282;});}return null;};}function handleEntityNotFound(_0x2367f1){return function(_0x315c30){if(!_0x315c30){_0x2367f1[_0x21c4('0xc')](0x194);}return _0x315c30;};}function handleError(_0x25e5bf,_0x50fc66){_0x50fc66=_0x50fc66||0x1f4;return function(_0xa58fa5){logger['error'](_0xa58fa5[_0x21c4('0xd')]);if(_0xa58fa5['name']){delete _0xa58fa5[_0x21c4('0xe')];}_0x25e5bf[_0x21c4('0x9')](_0x50fc66)[_0x21c4('0xf')](_0xa58fa5);};}exports[_0x21c4('0xa')]=function(_0x2201b0,_0x12f3dc){if(_0x2201b0[_0x21c4('0x10')][_0x21c4('0x11')]!==_0x21c4('0x12'))throw new Error(_0x21c4('0x13'));if(isNaN(Number(_0x2201b0[_0x21c4('0x14')]['id'])))throw new Error(_0x21c4('0x15'));return db[_0x21c4('0x16')]['find']({'where':{'id':_0x2201b0['params']['id']}})[_0x21c4('0xb')](handleEntityNotFound(_0x12f3dc,null))[_0x21c4('0xb')](saveUpdates(_0x2201b0[_0x21c4('0x17')],null))[_0x21c4('0xb')](respondWithResult(_0x12f3dc,null))[_0x21c4('0x18')](handleError(_0x12f3dc,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 13ca6bc..6929ad2 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb97=['save','update','emit','exports','../../mysqldb','setMaxListeners'];(function(_0x2952a1,_0x444ab9){var _0x174973=function(_0x12433b){while(--_0x12433b){_0x2952a1['push'](_0x2952a1['shift']());}};_0x174973(++_0x444ab9);}(_0xcb97,0x16c));var _0x7cb9=function(_0x3d46a7,_0x179fdc){_0x3d46a7=_0x3d46a7-0x0;var _0x4f5251=_0xcb97[_0x3d46a7];return _0x4f5251;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x7cb9('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7cb9('0x1')](0x0);var events={'afterCreate':_0x7cb9('0x2'),'afterUpdate':_0x7cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d1b55){return function(_0x3e3e8a,_0x13028f,_0x18c74f){UserSettingEvents[_0x7cb9('0x4')](_0x3d1b55+':'+_0x3e3e8a['id'],_0x3e3e8a);UserSettingEvents[_0x7cb9('0x4')](_0x3d1b55,_0x3e3e8a);_0x18c74f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x7cb9('0x5')]=UserSettingEvents; \ No newline at end of file +var _0x5a1b=['hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','update','emit'];(function(_0x1fa08b,_0x55dff4){var _0x5cc7ba=function(_0x3c315f){while(--_0x3c315f){_0x1fa08b['push'](_0x1fa08b['shift']());}};_0x5cc7ba(++_0x55dff4);}(_0x5a1b,0xff));var _0xb5a1=function(_0x1cc563,_0x36df13){_0x1cc563=_0x1cc563-0x0;var _0x11a8a7=_0x5a1b[_0x1cc563];return _0x11a8a7;};'use strict';var EventEmitter=require(_0xb5a1('0x0'));var UserSetting=require(_0xb5a1('0x1'))['db'][_0xb5a1('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb5a1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb5a1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x330846){return function(_0x21f3f8,_0x288143,_0x4e9fdb){UserSettingEvents[_0xb5a1('0x5')](_0x330846+':'+_0x21f3f8['id'],_0x21f3f8);UserSettingEvents[_0xb5a1('0x5')](_0x330846,_0x21f3f8);_0x4e9fdb(null);};}for(var e in events){if(events[_0xb5a1('0x6')](e)){var event=events[e];UserSetting[_0xb5a1('0x7')](e,emitEvent(event));}}module[_0xb5a1('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index a3032fb..e18f36d 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0db9=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting'];(function(_0x4eb4ad,_0x183488){var _0x1312b2=function(_0x19aabe){while(--_0x19aabe){_0x4eb4ad['push'](_0x4eb4ad['shift']());}};_0x1312b2(++_0x183488);}(_0x0db9,0xa3));var _0x90db=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x0db9[_0x1deb03];return _0x189fe7;};'use strict';var attributes=require(_0x90db('0x0'));module['exports']=function(_0x48d572){return _0x48d572['define'](_0x90db('0x1'),attributes,{'tableName':_0x90db('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x553431){if(!_0x553431[_0x90db('0x3')])_0x553431['clientSideLoggingEnabledSince']=null;else if(_0x553431[_0x90db('0x4')]===null)_0x553431[_0x90db('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x4dd3=['./user-setting.attributes','exports','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4d1481,_0x5a22de){var _0x13575d=function(_0x40ddd8){while(--_0x40ddd8){_0x4d1481['push'](_0x4d1481['shift']());}};_0x13575d(++_0x5a22de);}(_0x4dd3,0xf5));var _0x34dd=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x4dd3[_0x3ccdf8];return _0x243dab;};'use strict';var attributes=require(_0x34dd('0x0'));module[_0x34dd('0x1')]=function(_0x3be607){return _0x3be607['define']('UserSetting',attributes,{'tableName':_0x34dd('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cdb5f){if(!_0x4cdb5f[_0x34dd('0x3')])_0x4cdb5f[_0x34dd('0x4')]=null;else if(_0x4cdb5f[_0x34dd('0x4')]===null)_0x4cdb5f['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 6f5d063..cba73fd 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x810d=['update','emit','user-setting:update','user-setting:update:user-','UserId','./user-setting.events','save','remove'];(function(_0x4e5c8e,_0x5ef14d){var _0x25be5a=function(_0x4bc886){while(--_0x4bc886){_0x4e5c8e['push'](_0x4e5c8e['shift']());}};_0x25be5a(++_0x5ef14d);}(_0x810d,0xdd));var _0xd810=function(_0x4a7304,_0xa63e39){_0x4a7304=_0x4a7304-0x0;var _0x1ca905=_0x810d[_0x4a7304];return _0x1ca905;};'use strict';var UserSettingEvents=require(_0xd810('0x0'));var events=[_0xd810('0x1'),_0xd810('0x2'),_0xd810('0x3')];function createListener(_0x1f2067,_0x18ca44){return function(_0x4c638b){_0x18ca44[_0xd810('0x4')](_0x1f2067,_0x4c638b);if(_0x1f2067===_0xd810('0x5')){_0x18ca44[_0xd810('0x4')](_0xd810('0x6')+_0x4c638b[_0xd810('0x7')],_0x4c638b);}};}exports['register']=function(_0xaadefe){for(var _0x5b7c8e=0x0,_0x1016d2=events['length'];_0x5b7c8e<_0x1016d2;_0x5b7c8e++){var _0x31e218=events[_0x5b7c8e];var _0xcb79bf=createListener('user-setting:'+_0x31e218,_0xaadefe);UserSettingEvents['on'](_0x31e218,_0xcb79bf);}}; \ No newline at end of file +var _0xad49=['register','length','user-setting:','./user-setting.events','remove','emit','user-setting:update'];(function(_0x1cb9bd,_0x37af34){var _0x7065c7=function(_0xbc1ba3){while(--_0xbc1ba3){_0x1cb9bd['push'](_0x1cb9bd['shift']());}};_0x7065c7(++_0x37af34);}(_0xad49,0x88));var _0x9ad4=function(_0x5c5195,_0xdb9d76){_0x5c5195=_0x5c5195-0x0;var _0x2e936d=_0xad49[_0x5c5195];return _0x2e936d;};'use strict';var UserSettingEvents=require(_0x9ad4('0x0'));var events=['save',_0x9ad4('0x1'),'update'];function createListener(_0x332d03,_0x1d6aa4){return function(_0x464d01){_0x1d6aa4[_0x9ad4('0x2')](_0x332d03,_0x464d01);if(_0x332d03===_0x9ad4('0x3')){_0x1d6aa4[_0x9ad4('0x2')]('user-setting:update:user-'+_0x464d01['UserId'],_0x464d01);}};}exports[_0x9ad4('0x4')]=function(_0x58984a){for(var _0xd6edec=0x0,_0x190335=events[_0x9ad4('0x5')];_0xd6edec<_0x190335;_0xd6edec++){var _0x3ef7af=events[_0xd6edec];var _0x296e81=createListener(_0x9ad4('0x6')+_0x3ef7af,_0x58984a);UserSettingEvents['on'](_0x3ef7af,_0x296e81);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d54de6b..bd2d83f 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bd3=['addQueues','diskStorage','join','root','server/files/images/','%s-%s','originalname','single','addAvatar','/:id/logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x3bd3,0x110));var _0x33bd=function(_0x2e0979,_0x1d6067){_0x2e0979=_0x2e0979-0x0;var _0x486780=_0x3bd3[_0x2e0979];return _0x486780;};'use strict';var multer=require(_0x33bd('0x0'));var util=require(_0x33bd('0x1'));var path=require(_0x33bd('0x2'));var timeout=require(_0x33bd('0x3'));var express=require(_0x33bd('0x4'));var router=express[_0x33bd('0x5')]();var fs_extra=require(_0x33bd('0x6'));var auth=require(_0x33bd('0x7'));var interaction=require(_0x33bd('0x8'));var config=require('../../config/environment');var controller=require(_0x33bd('0x9'));router[_0x33bd('0xa')]('/',auth[_0x33bd('0xb')](),controller[_0x33bd('0xc')]);router['get']('/describe',auth[_0x33bd('0xb')](),controller[_0x33bd('0xd')]);router[_0x33bd('0xa')](_0x33bd('0xe'),auth[_0x33bd('0xb')](),controller[_0x33bd('0xf')]);router[_0x33bd('0xa')]('/presence',auth[_0x33bd('0xb')](),controller[_0x33bd('0x10')]);router['get'](_0x33bd('0x11'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x12')]);router[_0x33bd('0xa')](_0x33bd('0x13'),controller[_0x33bd('0x14')]);router[_0x33bd('0xa')](_0x33bd('0x15'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x16')]);router[_0x33bd('0xa')](_0x33bd('0x17'),auth['isAuthenticated'](),controller[_0x33bd('0x18')]);router['get'](_0x33bd('0x19'),auth[_0x33bd('0xb')](),controller['getQueues']);router[_0x33bd('0xa')](_0x33bd('0x1a'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x1b')]);router[_0x33bd('0xa')](_0x33bd('0x1c'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x1d')]);router['get'](_0x33bd('0x1e'),auth[_0x33bd('0xb')](),controller['getRecordings']);router[_0x33bd('0xa')](_0x33bd('0x1f'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x20')]);router[_0x33bd('0xa')]('/:id/chat/interactions',auth[_0x33bd('0xb')](),controller['getChatInteractions']);router[_0x33bd('0xa')](_0x33bd('0x21'),auth[_0x33bd('0xb')](),controller['getOpenchannelInteractions']);router[_0x33bd('0xa')](_0x33bd('0x22'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x23')]);router['get']('/:id/sms/interactions',auth[_0x33bd('0xb')](),controller[_0x33bd('0x24')]);router[_0x33bd('0xa')](_0x33bd('0x25'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x26')]);router[_0x33bd('0xa')]('/:id/whatsapp/interactions',auth[_0x33bd('0xb')](),controller[_0x33bd('0x27')]);router[_0x33bd('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x33bd('0x28')]);router[_0x33bd('0xa')](_0x33bd('0x29'),auth[_0x33bd('0xb')](),controller['getLists']);router[_0x33bd('0xa')](_0x33bd('0x2a'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x2b')]);router['get'](_0x33bd('0x2c'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x2d')]);router[_0x33bd('0xa')](_0x33bd('0x2e'),auth['isAuthenticated'](),controller[_0x33bd('0x2f')]);router['get']('/:id/mail_accounts',auth[_0x33bd('0xb')](),controller[_0x33bd('0x30')]);router[_0x33bd('0xa')](_0x33bd('0x31'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x33bd('0x32'),auth['isAuthenticated'](),controller[_0x33bd('0x33')]);router[_0x33bd('0xa')](_0x33bd('0x34'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x35')]);router['get'](_0x33bd('0x36'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x37')]);router[_0x33bd('0xa')]('/:id/scheduled_calls',auth[_0x33bd('0xb')](),controller[_0x33bd('0x38')]);router[_0x33bd('0xa')](_0x33bd('0x39'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x3a')]);router[_0x33bd('0x3b')](_0x33bd('0x17'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x3c')]);router[_0x33bd('0x3b')]('/',auth['isAuthenticated'](),controller[_0x33bd('0x3d')]);router['post'](_0x33bd('0x3e'),auth['isAuthenticated'](),controller[_0x33bd('0x3f')]);router[_0x33bd('0x3b')]('/:id/queues',auth[_0x33bd('0xb')](),controller[_0x33bd('0x40')]);var upload=multer({'storage':multer[_0x33bd('0x41')]({'destination':function(_0x1ead0b,_0x3ba76b,_0x2494bf){_0x2494bf(null,path[_0x33bd('0x42')](config[_0x33bd('0x43')],_0x33bd('0x44')));},'filename':function(_0x59b6e3,_0x1a929b,_0x748b8c){_0x748b8c(null,util['format'](_0x33bd('0x45'),Date['now'](),_0x1a929b[_0x33bd('0x46')]));}})});router['post'](_0x33bd('0x13'),upload[_0x33bd('0x47')]('file'),controller[_0x33bd('0x48')]);router[_0x33bd('0x3b')]('/:id/login',auth[_0x33bd('0xb')](),controller['login']);router[_0x33bd('0x3b')](_0x33bd('0x49'),auth[_0x33bd('0xb')](),controller['logout']);router[_0x33bd('0x3b')](_0x33bd('0x4a'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x4b')]);router[_0x33bd('0x3b')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x33bd('0x4c')]);router['post'](_0x33bd('0x4d'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x4e')]);router[_0x33bd('0x3b')]('/:id/chat_interactions',auth[_0x33bd('0xb')](),controller['addChatInteractions']);router['post'](_0x33bd('0x4f'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x50')]);router[_0x33bd('0x3b')](_0x33bd('0x51'),auth[_0x33bd('0xb')](),controller['addFaxInteractions']);router[_0x33bd('0x3b')](_0x33bd('0x52'),auth['isAuthenticated'](),controller[_0x33bd('0x53')]);router[_0x33bd('0x3b')](_0x33bd('0x54'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x55')]);router[_0x33bd('0x3b')](_0x33bd('0x56'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x33bd('0x3b')](_0x33bd('0x2e'),auth[_0x33bd('0xb')](),controller['addFaxAccounts']);router[_0x33bd('0x3b')]('/:id/mail_accounts',auth[_0x33bd('0xb')](),controller['addMailAccounts']);router[_0x33bd('0x3b')](_0x33bd('0x31'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x57')]);router[_0x33bd('0x3b')](_0x33bd('0x32'),auth['isAuthenticated'](),controller[_0x33bd('0x58')]);router['post']('/:id/chat_websites',auth[_0x33bd('0xb')](),controller[_0x33bd('0x59')]);router['post'](_0x33bd('0x36'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x5a')]);router[_0x33bd('0x3b')](_0x33bd('0x39'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x5b')]);router[_0x33bd('0x5c')](_0x33bd('0x11'),auth[_0x33bd('0xb')](),controller['update']);router[_0x33bd('0x5c')]('/:id/password',auth[_0x33bd('0xb')](),controller[_0x33bd('0x5d')]);router[_0x33bd('0x5e')](_0x33bd('0x19'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x5f')]);router[_0x33bd('0x5e')](_0x33bd('0x4d'),auth[_0x33bd('0xb')](),controller['removeTeams']);router[_0x33bd('0x5e')](_0x33bd('0x11'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x60')]);router[_0x33bd('0x5e')](_0x33bd('0x61'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x62')]);router[_0x33bd('0x5e')]('/:id/mail_interactions',auth[_0x33bd('0xb')](),controller[_0x33bd('0x63')]);router[_0x33bd('0x5e')](_0x33bd('0x51'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x64')]);router[_0x33bd('0x5e')]('/:id/sms_interactions',auth[_0x33bd('0xb')](),controller[_0x33bd('0x65')]);router[_0x33bd('0x5e')](_0x33bd('0x54'),auth['isAuthenticated'](),controller[_0x33bd('0x66')]);router[_0x33bd('0x5e')](_0x33bd('0x56'),auth['isAuthenticated'](),controller[_0x33bd('0x67')]);router[_0x33bd('0x5e')]('/:id/fax_accounts',auth[_0x33bd('0xb')](),controller[_0x33bd('0x68')]);router[_0x33bd('0x5e')](_0x33bd('0x69'),auth['isAuthenticated'](),controller[_0x33bd('0x6a')]);router[_0x33bd('0x5e')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete'](_0x33bd('0x32'),auth[_0x33bd('0xb')](),controller['removeSmsAccounts']);router['delete'](_0x33bd('0x34'),auth['isAuthenticated'](),controller[_0x33bd('0x6b')]);router[_0x33bd('0x5e')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x33bd('0x6c')]);router[_0x33bd('0x5e')](_0x33bd('0x39'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x6d')]);router[_0x33bd('0x3b')](_0x33bd('0x6e'),auth[_0x33bd('0xb')](),controller[_0x33bd('0x6f')]);module['exports']=router; \ No newline at end of file +var _0x7019=['removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','file','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts'];(function(_0x91e49e,_0x43579c){var _0x5ea213=function(_0x36d737){while(--_0x36d737){_0x91e49e['push'](_0x91e49e['shift']());}};_0x5ea213(++_0x43579c);}(_0x7019,0x16d));var _0x9701=function(_0x5b4370,_0x71cf60){_0x5b4370=_0x5b4370-0x0;var _0x6a9e50=_0x7019[_0x5b4370];return _0x6a9e50;};'use strict';var multer=require(_0x9701('0x0'));var util=require('util');var path=require(_0x9701('0x1'));var timeout=require(_0x9701('0x2'));var express=require('express');var router=express[_0x9701('0x3')]();var fs_extra=require(_0x9701('0x4'));var auth=require(_0x9701('0x5'));var interaction=require(_0x9701('0x6'));var config=require(_0x9701('0x7'));var controller=require('./user.controller');router['get']('/',auth[_0x9701('0x8')](),controller[_0x9701('0x9')]);router[_0x9701('0xa')](_0x9701('0xb'),auth[_0x9701('0x8')](),controller[_0x9701('0xc')]);router[_0x9701('0xa')](_0x9701('0xd'),auth[_0x9701('0x8')](),controller['whoami']);router[_0x9701('0xa')](_0x9701('0xe'),auth['isAuthenticated'](),controller[_0x9701('0xf')]);router['get'](_0x9701('0x10'),auth[_0x9701('0x8')](),controller[_0x9701('0x11')]);router[_0x9701('0xa')](_0x9701('0x12'),controller[_0x9701('0x13')]);router['get'](_0x9701('0x14'),auth[_0x9701('0x8')](),controller[_0x9701('0x15')]);router[_0x9701('0xa')](_0x9701('0x16'),auth[_0x9701('0x8')](),controller[_0x9701('0x17')]);router[_0x9701('0xa')](_0x9701('0x18'),auth['isAuthenticated'](),controller[_0x9701('0x19')]);router[_0x9701('0xa')](_0x9701('0x1a'),auth[_0x9701('0x8')](),controller['getVoiceQueuesRt']);router[_0x9701('0xa')]('/:id/groups',auth[_0x9701('0x8')](),controller[_0x9701('0x1b')]);router[_0x9701('0xa')](_0x9701('0x1c'),auth[_0x9701('0x8')](),controller[_0x9701('0x1d')]);router[_0x9701('0xa')](_0x9701('0x1e'),auth['isAuthenticated'](),controller[_0x9701('0x1f')]);router[_0x9701('0xa')](_0x9701('0x20'),auth[_0x9701('0x8')](),controller[_0x9701('0x21')]);router[_0x9701('0xa')](_0x9701('0x22'),auth[_0x9701('0x8')](),controller[_0x9701('0x23')]);router[_0x9701('0xa')](_0x9701('0x24'),auth['isAuthenticated'](),controller[_0x9701('0x25')]);router['get'](_0x9701('0x26'),auth[_0x9701('0x8')](),controller[_0x9701('0x27')]);router[_0x9701('0xa')](_0x9701('0x28'),auth[_0x9701('0x8')](),controller[_0x9701('0x29')]);router[_0x9701('0xa')](_0x9701('0x2a'),auth['isAuthenticated'](),controller[_0x9701('0x2b')]);router[_0x9701('0xa')](_0x9701('0x2c'),auth[_0x9701('0x8')](),controller[_0x9701('0x2d')]);router[_0x9701('0xa')](_0x9701('0x2e'),auth[_0x9701('0x8')](),controller[_0x9701('0x2f')]);router[_0x9701('0xa')]('/:id/agents',auth[_0x9701('0x8')](),controller['getAgents']);router['get'](_0x9701('0x30'),auth['isAuthenticated'](),controller[_0x9701('0x31')]);router['get'](_0x9701('0x32'),auth[_0x9701('0x8')](),controller[_0x9701('0x33')]);router[_0x9701('0xa')]('/:id/mail_accounts',auth[_0x9701('0x8')](),controller[_0x9701('0x34')]);router[_0x9701('0xa')]('/:id/openchannel_accounts',auth[_0x9701('0x8')](),controller[_0x9701('0x35')]);router['get'](_0x9701('0x36'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x9701('0xa')](_0x9701('0x37'),auth[_0x9701('0x8')](),controller[_0x9701('0x38')]);router['get'](_0x9701('0x39'),auth[_0x9701('0x8')](),controller['getWhatsappAccounts']);router[_0x9701('0xa')](_0x9701('0x3a'),auth[_0x9701('0x8')](),controller['getScheduledCalls']);router['get'](_0x9701('0x3b'),auth[_0x9701('0x8')](),controller[_0x9701('0x3c')]);router['post'](_0x9701('0x16'),auth[_0x9701('0x8')](),controller[_0x9701('0x3d')]);router[_0x9701('0x3e')]('/',auth[_0x9701('0x8')](),controller[_0x9701('0x3f')]);router['post'](_0x9701('0x40'),auth[_0x9701('0x8')](),controller[_0x9701('0x41')]);router['post'](_0x9701('0x18'),auth[_0x9701('0x8')](),controller[_0x9701('0x42')]);var upload=multer({'storage':multer[_0x9701('0x43')]({'destination':function(_0x8f745b,_0x3a9bf9,_0x469919){_0x469919(null,path[_0x9701('0x44')](config[_0x9701('0x45')],_0x9701('0x46')));},'filename':function(_0x98a47f,_0x383c7f,_0x180a2){_0x180a2(null,util[_0x9701('0x47')]('%s-%s',Date[_0x9701('0x48')](),_0x383c7f[_0x9701('0x49')]));}})});router[_0x9701('0x3e')]('/:id/avatar',upload['single'](_0x9701('0x4a')),controller['addAvatar']);router[_0x9701('0x3e')](_0x9701('0x4b'),auth[_0x9701('0x8')](),controller[_0x9701('0x4c')]);router['post']('/:id/logout',auth[_0x9701('0x8')](),controller[_0x9701('0x4d')]);router[_0x9701('0x3e')](_0x9701('0x4e'),auth[_0x9701('0x8')](),controller[_0x9701('0x4f')]);router['post'](_0x9701('0x50'),auth[_0x9701('0x8')](),controller[_0x9701('0x51')]);router['post'](_0x9701('0x2c'),auth['isAuthenticated'](),controller[_0x9701('0x52')]);router[_0x9701('0x3e')](_0x9701('0x53'),auth['isAuthenticated'](),controller[_0x9701('0x54')]);router[_0x9701('0x3e')](_0x9701('0x55'),auth['isAuthenticated'](),controller[_0x9701('0x56')]);router['post'](_0x9701('0x57'),auth[_0x9701('0x8')](),controller['addFaxInteractions']);router['post'](_0x9701('0x58'),auth['isAuthenticated'](),controller[_0x9701('0x59')]);router[_0x9701('0x3e')](_0x9701('0x5a'),auth[_0x9701('0x8')](),controller['addOpenchannelInteractions']);router[_0x9701('0x3e')](_0x9701('0x5b'),auth[_0x9701('0x8')](),controller[_0x9701('0x5c')]);router[_0x9701('0x3e')]('/:id/fax_accounts',auth[_0x9701('0x8')](),controller['addFaxAccounts']);router[_0x9701('0x3e')](_0x9701('0x5d'),auth[_0x9701('0x8')](),controller[_0x9701('0x5e')]);router['post'](_0x9701('0x5f'),auth[_0x9701('0x8')](),controller[_0x9701('0x60')]);router[_0x9701('0x3e')](_0x9701('0x36'),auth[_0x9701('0x8')](),controller[_0x9701('0x61')]);router[_0x9701('0x3e')](_0x9701('0x37'),auth[_0x9701('0x8')](),controller[_0x9701('0x62')]);router['post'](_0x9701('0x39'),auth['isAuthenticated'](),controller[_0x9701('0x63')]);router[_0x9701('0x3e')]('/:id/api_key',auth[_0x9701('0x8')](),controller[_0x9701('0x64')]);router[_0x9701('0x65')](_0x9701('0x10'),auth[_0x9701('0x8')](),controller[_0x9701('0x66')]);router[_0x9701('0x65')](_0x9701('0x67'),auth[_0x9701('0x8')](),controller[_0x9701('0x68')]);router[_0x9701('0x69')](_0x9701('0x18'),auth[_0x9701('0x8')](),controller[_0x9701('0x6a')]);router[_0x9701('0x69')](_0x9701('0x2c'),auth[_0x9701('0x8')](),controller[_0x9701('0x6b')]);router[_0x9701('0x69')](_0x9701('0x10'),auth[_0x9701('0x8')](),controller['destroy']);router[_0x9701('0x69')](_0x9701('0x53'),auth[_0x9701('0x8')](),controller['removeChatInteractions']);router[_0x9701('0x69')](_0x9701('0x55'),auth[_0x9701('0x8')](),controller['removeMailInteractions']);router['delete'](_0x9701('0x57'),auth[_0x9701('0x8')](),controller[_0x9701('0x6c')]);router[_0x9701('0x69')]('/:id/sms_interactions',auth[_0x9701('0x8')](),controller['removeSmsInteractions']);router[_0x9701('0x69')](_0x9701('0x5a'),auth[_0x9701('0x8')](),controller[_0x9701('0x6d')]);router[_0x9701('0x69')](_0x9701('0x5b'),auth[_0x9701('0x8')](),controller[_0x9701('0x6e')]);router[_0x9701('0x69')]('/:id/fax_accounts',auth[_0x9701('0x8')](),controller[_0x9701('0x6f')]);router[_0x9701('0x69')]('/:id/mail_accounts',auth[_0x9701('0x8')](),controller[_0x9701('0x70')]);router[_0x9701('0x69')](_0x9701('0x5f'),auth['isAuthenticated'](),controller[_0x9701('0x71')]);router[_0x9701('0x69')]('/:id/sms_accounts',auth[_0x9701('0x8')](),controller[_0x9701('0x72')]);router['delete'](_0x9701('0x37'),auth[_0x9701('0x8')](),controller[_0x9701('0x73')]);router['delete']('/:id/whatsapp_accounts',auth[_0x9701('0x8')](),controller[_0x9701('0x74')]);router[_0x9701('0x69')](_0x9701('0x3b'),auth[_0x9701('0x8')](),controller['removeApiKey']);router[_0x9701('0x3e')](_0x9701('0x75'),auth[_0x9701('0x8')](),controller[_0x9701('0x76')]);module[_0x9701('0x77')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 25fb6f7..34a727d 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc898=['isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlscertfile','rtcp_mux','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','exports','STRING','name','defaultuser','The\x20name\x20of\x20the\x20user','setDataValue','format','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','ENUM','admin','agent','local','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','user','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','yes','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','update','update,nonat','TEXT','showWebBar'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc898,0x185));var _0x8c89=function(_0x5008a9,_0x2feb07){_0x5008a9=_0x5008a9-0x0;var _0x2e160b=_0xc898[_0x5008a9];return _0x2e160b;};'use strict';var Sequelize=require(_0x8c89('0x0'));var moment=require('moment');var util=require(_0x8c89('0x1'));var _=require('lodash');module[_0x8c89('0x2')]={'name':{'type':Sequelize[_0x8c89('0x3')],'allowNull':![],'unique':_0x8c89('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4624e9){this['setDataValue'](_0x8c89('0x4'),_0x4624e9);this['setDataValue'](_0x8c89('0x5'),_0x4624e9);},'comment':_0x8c89('0x6')},'fullname':{'type':Sequelize[_0x8c89('0x3')],'allowNull':![],'set':function(_0x138ee2){this[_0x8c89('0x7')]('fullname',_0x138ee2);this[_0x8c89('0x7')]('callerid',util[_0x8c89('0x8')](_0x8c89('0x9'),_0x138ee2,this[_0x8c89('0xa')](_0x8c89('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x4aa6f6){if(_0x4aa6f6){this[_0x8c89('0x7')]('email',_0x4aa6f6[_0x8c89('0xc')]());}}},'role':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0xe'),'user',_0x8c89('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x8c89('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x8c89('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x27195f){this[_0x8c89('0x7')](_0x8c89('0xb'),_0x27195f);this[_0x8c89('0x7')](_0x8c89('0x11'),_0x27195f);this[_0x8c89('0x7')](_0x8c89('0x12'),util[_0x8c89('0x8')](_0x8c89('0x9'),this[_0x8c89('0xa')]('fullname'),_0x27195f));}},'salt':{'type':Sequelize[_0x8c89('0x3')]},'phone':{'type':Sequelize[_0x8c89('0x3')]},'mobile':{'type':Sequelize[_0x8c89('0x3')]},'address':{'type':Sequelize[_0x8c89('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x8c89('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8c89('0x3')]},'online':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x8c89('0x14')]},'voicePause':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8c89('0x3')],'defaultValue':_0x8c89('0x15')},'lastPauseAt':{'type':Sequelize[_0x8c89('0x14')]},'chatCapacity':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x8c89('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![],'defaultValue':_0x8c89('0x17')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x8c89('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x18'),_0x8c89('0x19'),_0x8c89('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8c89('0x1b')},'callingpres':{'type':Sequelize[_0x8c89('0xd')]('ALLOWED_NOT_SCREENED',_0x8c89('0x1c'),_0x8c89('0x1d'),'ALLOWED',_0x8c89('0x1e'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x338782){this['setDataValue'](_0x8c89('0x1f'),_0x338782?_0x338782[_0x8c89('0x20')](','):null);},'get':function(){return this[_0x8c89('0xa')](_0x8c89('0x1f'))?this[_0x8c89('0xa')]('transport')[_0x8c89('0x21')](','):null;},'comment':_0x8c89('0x22')},'dtmfmode':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x23'),_0x8c89('0x24'),_0x8c89('0x25'),_0x8c89('0x26'),_0x8c89('0x27')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8c89('0xd')]('yes','no',_0x8c89('0x28'),'update',_0x8c89('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8c89('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![],'defaultValue':_0x8c89('0x2a'),'set':function(_0x2bbeb8){this[_0x8c89('0x7')](_0x8c89('0x2b'),_0x2bbeb8?_0x2bbeb8[_0x8c89('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x8c89('0x2b'))?this[_0x8c89('0xa')](_0x8c89('0x2b'))['split'](','):null;},'comment':_0x8c89('0x2c')},'callgroup':{'type':Sequelize[_0x8c89('0x3')]},'namedcallgroup':{'type':Sequelize[_0x8c89('0x3')]},'pickupgroup':{'type':Sequelize[_0x8c89('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x8c89('0x3')]},'language':{'type':Sequelize[_0x8c89('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8c89('0x3')]},'disallow':{'type':Sequelize[_0x8c89('0x3')],'allowNull':![],'defaultValue':_0x8c89('0x2d')},'allow':{'type':Sequelize[_0x8c89('0x3')],'allowNull':![],'defaultValue':_0x8c89('0x2e'),'set':function(_0x26f339){this[_0x8c89('0x7')](_0x8c89('0x2f'),_0x26f339?_0x26f339[_0x8c89('0x20')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x8c89('0xa')](_0x8c89('0x2f'))?this['getDataValue']('allow')[_0x8c89('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x8c89('0x30'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![],'set':function(_0x16f567){this[_0x8c89('0x7')]('insecure',_0x16f567?_0x16f567[_0x8c89('0x20')](','):null);},'get':function(){return this[_0x8c89('0xa')](_0x8c89('0x31'))?this[_0x8c89('0xa')](_0x8c89('0x31'))[_0x8c89('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8c89('0xd')]('yes','no',_0x8c89('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8c89('0x33')},'amaflags':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8c89('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x8c89('0x30')},'busylevel':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x8c89('0x30'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x8c89('0x30'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x8c89('0x30'),'no',_0x8c89('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x8c89('0x35'),_0x8c89('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x8c89('0x37'),_0x8c89('0x38')),'allowNull':!![],'defaultValue':_0x8c89('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8c89('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x8c89('0x30')},'keepalive':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8c89('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8c89('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x8c89('0x30'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x8c89('0x30'),'no',_0x8c89('0x39'),_0x8c89('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x3b'),_0x8c89('0x3c'),_0x8c89('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x8c89('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8c89('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no','nonat',_0x8c89('0x3e'),_0x8c89('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8c89('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x8c89('0x14')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x8c89('0x40')]},'showWebBar':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0,'set':function(_0x16a9ec){this[_0x8c89('0x7')](_0x8c89('0x41'),_0x16a9ec);var _0x402049=this['get']({'plain':!![]});switch(_0x16a9ec){case 0x0:case 0x1:var _0x418f95=_0x402049[_0x8c89('0x1f')]?_[_0x8c89('0x42')](_0x402049[_0x8c89('0x1f')])?_0x402049['transport'][_0x8c89('0x20')]():_0x402049[_0x8c89('0x1f')]:_0x8c89('0x43');if(_0x418f95===_0x8c89('0x44')){_0x418f95=_0x8c89('0x43');}this[_0x8c89('0x7')](_0x8c89('0x1f'),_0x418f95);this['setDataValue'](_0x8c89('0x45'),'no');this[_0x8c89('0x7')](_0x8c89('0x46'),null);this[_0x8c89('0x7')](_0x8c89('0x47'),null);this[_0x8c89('0x7')](_0x8c89('0x48'),null);this[_0x8c89('0x7')]('dtlsenable',null);this['setDataValue']('dtlsverify',null);this[_0x8c89('0x7')]('dtlssetup',null);this[_0x8c89('0x7')](_0x8c89('0x49'),null);this['setDataValue']('dtlsprivatekey',null);this[_0x8c89('0x7')](_0x8c89('0x4a'),'no');break;case 0x2:this[_0x8c89('0x7')](_0x8c89('0x1f'),_0x8c89('0x44'));this[_0x8c89('0x7')]('encryption',_0x8c89('0x30'));this['setDataValue'](_0x8c89('0x46'),_0x8c89('0x30'));this[_0x8c89('0x7')](_0x8c89('0x47'),'yes');this[_0x8c89('0x7')](_0x8c89('0x48'),_0x8c89('0x30'));this['setDataValue'](_0x8c89('0x4b'),'yes');this[_0x8c89('0x7')](_0x8c89('0x4c'),'no');this[_0x8c89('0x7')](_0x8c89('0x4d'),_0x8c89('0x3d'));this[_0x8c89('0x7')](_0x8c89('0x49'),_0x402049[_0x8c89('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0x8c89('0x7')](_0x8c89('0x4e'),_0x402049[_0x8c89('0x4e')]||_0x8c89('0x4f'));this[_0x8c89('0x7')]('rtcp_mux',_0x8c89('0x30'));break;default:}}},'permissions':{'type':Sequelize[_0x8c89('0x40')],'set':function(_0x34233c){this[_0x8c89('0x7')](_0x8c89('0x50'),_0x34233c?_0x34233c[_0x8c89('0x20')](','):[]);},'get':function(){return this['getDataValue'](_0x8c89('0x50'))?_[_0x8c89('0x51')](this[_0x8c89('0xa')](_0x8c89('0x50'))[_0x8c89('0x21')](','),function(_0x56acbd){return parseInt(_0x56acbd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8c89('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8c89('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8c89('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8c89('0xd')](_0x8c89('0x30'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8c89('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8c89('0x52')],'get':function(){return this[_0x8c89('0xa')]('phoneBarEnableScreenRecordingByAgent')?this[_0x8c89('0xa')](_0x8c89('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x8c89('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x8c89('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![],'set':function(_0x5557c6){if(typeof _0x5557c6===_0x8c89('0x54')){var _0x1add77=_0x5557c6==='1'?!![]:_0x5557c6==='0'?![]:_0x5557c6===_0x8c89('0x55')?!![]:_0x5557c6==='false'?![]:![];this['setDataValue'](_0x8c89('0x56'),_0x1add77);}else{this['setDataValue']('screenrecording',_0x5557c6);}}},'blocked':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![],'set':function(_0x1e83ec){this[_0x8c89('0x7')](_0x8c89('0x57'),_0x1e83ec);if(_0x1e83ec===!![]){this['setDataValue'](_0x8c89('0x58'),moment());this['setDataValue'](_0x8c89('0x59'),0x0);}else{this['setDataValue'](_0x8c89('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x8c89('0x16')](0x5)[_0x8c89('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x8c89('0x16')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x8c89('0x13')],'defaultValue':![]}}; \ No newline at end of file +var _0x86c6=['fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','agent','local','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uas','certificate','passive','actpass','TEXT','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser'];(function(_0x40a4ee,_0x515400){var _0x57c3cc=function(_0x4ba215){while(--_0x4ba215){_0x40a4ee['push'](_0x40a4ee['shift']());}};_0x57c3cc(++_0x515400);}(_0x86c6,0x101));var _0x686c=function(_0x1bafd4,_0xbea212){_0x1bafd4=_0x1bafd4-0x0;var _0x44969b=_0x86c6[_0x1bafd4];return _0x44969b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x686c('0x0'));var _=require(_0x686c('0x1'));module[_0x686c('0x2')]={'name':{'type':Sequelize[_0x686c('0x3')],'allowNull':![],'unique':_0x686c('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1bd524){this[_0x686c('0x5')](_0x686c('0x4'),_0x1bd524);this[_0x686c('0x5')](_0x686c('0x6'),_0x1bd524);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x686c('0x3')],'allowNull':![],'set':function(_0xbac433){this[_0x686c('0x5')](_0x686c('0x7'),_0xbac433);this[_0x686c('0x5')](_0x686c('0x8'),util[_0x686c('0x9')](_0x686c('0xa'),_0xbac433,this[_0x686c('0xb')](_0x686c('0xc'))));}},'alias':{'type':Sequelize[_0x686c('0x3')]},'email':{'type':Sequelize[_0x686c('0x3')],'allowNull':![],'unique':_0x686c('0xd'),'validate':{'isEmail':!![]},'set':function(_0x489a9d){if(_0x489a9d){this[_0x686c('0x5')](_0x686c('0xd'),_0x489a9d[_0x686c('0xe')]());}}},'role':{'type':Sequelize[_0x686c('0xf')]('admin',_0x686c('0x10'),_0x686c('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x686c('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x686c('0x3')],'defaultValue':_0x686c('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x686c('0xc'),'set':function(_0x4f8936){this[_0x686c('0x5')](_0x686c('0xc'),_0x4f8936);this['setDataValue'](_0x686c('0x13'),_0x4f8936);this[_0x686c('0x5')](_0x686c('0x8'),util[_0x686c('0x9')](_0x686c('0xa'),this[_0x686c('0xb')](_0x686c('0x7')),_0x4f8936));}},'salt':{'type':Sequelize[_0x686c('0x3')]},'phone':{'type':Sequelize[_0x686c('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x686c('0x3')]},'zipcode':{'type':Sequelize[_0x686c('0x3')]},'userpic':{'type':Sequelize[_0x686c('0x3')]},'city':{'type':Sequelize[_0x686c('0x3')]},'country':{'type':Sequelize[_0x686c('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x686c('0x15')},'lastPauseAt':{'type':Sequelize[_0x686c('0x16')]},'chatCapacity':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x686c('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x686c('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x686c('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![],'defaultValue':_0x686c('0x18')},'ipaddr':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x686c('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x19'),_0x686c('0x10'),_0x686c('0x1a')),'allowNull':!![],'defaultValue':_0x686c('0x19')},'context':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![],'defaultValue':_0x686c('0x1b')},'callingpres':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x1c'),_0x686c('0x1d'),'ALLOWED_FAILED_SCREEN',_0x686c('0x1e'),_0x686c('0x1f'),_0x686c('0x20'),_0x686c('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x438479){this[_0x686c('0x5')]('transport',_0x438479?_0x438479[_0x686c('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x686c('0x23'))?this[_0x686c('0xb')](_0x686c('0x23'))['split'](','):null;},'comment':_0x686c('0x24')},'dtmfmode':{'type':Sequelize[_0x686c('0xf')]('rfc2833',_0x686c('0x25'),_0x686c('0x26'),_0x686c('0x27'),_0x686c('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no','nonat',_0x686c('0x2a'),_0x686c('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x686c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x686c('0x2c'),'set':function(_0x142ece){this['setDataValue']('nat',_0x142ece?_0x142ece[_0x686c('0x22')](','):null);},'get':function(){return this[_0x686c('0xb')](_0x686c('0x2d'))?this[_0x686c('0xb')](_0x686c('0x2d'))[_0x686c('0x2e')](','):null;},'comment':_0x686c('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x686c('0x3')]},'language':{'type':Sequelize[_0x686c('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x686c('0x3')]},'disallow':{'type':Sequelize[_0x686c('0x3')],'allowNull':![],'defaultValue':_0x686c('0x30')},'allow':{'type':Sequelize[_0x686c('0x3')],'allowNull':![],'defaultValue':_0x686c('0x31'),'set':function(_0x1d1303){this[_0x686c('0x5')](_0x686c('0x32'),_0x1d1303?_0x1d1303[_0x686c('0x22')](';'):_0x686c('0x31'));},'get':function(){return this[_0x686c('0xb')](_0x686c('0x32'))?this[_0x686c('0xb')](_0x686c('0x32'))[_0x686c('0x2e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x686c('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![],'set':function(_0x540604){this['setDataValue']('insecure',_0x540604?_0x540604[_0x686c('0x22')](','):null);},'get':function(){return this[_0x686c('0xb')](_0x686c('0x33'))?this[_0x686c('0xb')](_0x686c('0x33'))[_0x686c('0x2e')](','):null;},'comment':_0x686c('0x34')},'trustrpid':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x686c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x686c('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![],'defaultValue':_0x686c('0x35')},'amaflags':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![],'defaultValue':_0x686c('0x29')},'busylevel':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x686c('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x686c('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x686c('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x36'),_0x686c('0x37'),_0x686c('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x686c('0xf')]('uac',_0x686c('0x39')),'allowNull':!![],'defaultValue':_0x686c('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![],'defaultValue':_0x686c('0x29')},'keepalive':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x686c('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x686c('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no','fingerprint',_0x686c('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x686c('0xf')]('active',_0x686c('0x3b'),_0x686c('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x686c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x686c('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x686c('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x686c('0xf')]('yes','no','nonat',_0x686c('0x2a'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x686c('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x686c('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x686c('0x3d')]},'showWebBar':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0,'set':function(_0x4c0ad0){this[_0x686c('0x5')]('showWebBar',_0x4c0ad0);var _0x48d28b=this['get']({'plain':!![]});switch(_0x4c0ad0){case 0x0:case 0x1:var _0x25c582=_0x48d28b[_0x686c('0x23')]?_['isArray'](_0x48d28b['transport'])?_0x48d28b[_0x686c('0x23')]['join']():_0x48d28b[_0x686c('0x23')]:_0x686c('0x3e');if(_0x25c582==='wss'){_0x25c582='udp';}this[_0x686c('0x5')](_0x686c('0x23'),_0x25c582);this[_0x686c('0x5')](_0x686c('0x3f'),'no');this[_0x686c('0x5')](_0x686c('0x40'),null);this[_0x686c('0x5')](_0x686c('0x41'),null);this[_0x686c('0x5')](_0x686c('0x42'),null);this['setDataValue'](_0x686c('0x43'),null);this['setDataValue'](_0x686c('0x44'),null);this['setDataValue'](_0x686c('0x45'),null);this[_0x686c('0x5')](_0x686c('0x46'),null);this[_0x686c('0x5')](_0x686c('0x47'),null);this[_0x686c('0x5')](_0x686c('0x48'),'no');break;case 0x2:this[_0x686c('0x5')](_0x686c('0x23'),_0x686c('0x49'));this[_0x686c('0x5')](_0x686c('0x3f'),_0x686c('0x29'));this['setDataValue']('avpf',_0x686c('0x29'));this['setDataValue']('force_avp','yes');this['setDataValue'](_0x686c('0x42'),_0x686c('0x29'));this['setDataValue'](_0x686c('0x43'),'yes');this[_0x686c('0x5')](_0x686c('0x44'),'no');this[_0x686c('0x5')](_0x686c('0x45'),_0x686c('0x3c'));this['setDataValue'](_0x686c('0x46'),_0x48d28b['dtlscertfile']||_0x686c('0x4a'));this[_0x686c('0x5')](_0x686c('0x47'),_0x48d28b['dtlsprivatekey']||_0x686c('0x4b'));this[_0x686c('0x5')](_0x686c('0x48'),_0x686c('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x686c('0x3d')],'set':function(_0x5191f1){this[_0x686c('0x5')]('permissions',_0x5191f1?_0x5191f1[_0x686c('0x22')](','):[]);},'get':function(){return this[_0x686c('0xb')](_0x686c('0x4c'))?_[_0x686c('0x4d')](this[_0x686c('0xb')](_0x686c('0x4c'))[_0x686c('0x2e')](','),function(_0x281daf){return parseInt(_0x281daf,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x686c('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x686c('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x686c('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x686c('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x686c('0xf')](_0x686c('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x686c('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x686c('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x686c('0x4e')],'get':function(){return this[_0x686c('0xb')](_0x686c('0x4f'))?this[_0x686c('0xb')](_0x686c('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x686c('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x686c('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![],'set':function(_0x30f991){if(typeof _0x30f991===_0x686c('0x50')){var _0x2610a9=_0x30f991==='1'?!![]:_0x30f991==='0'?![]:_0x30f991===_0x686c('0x51')?!![]:_0x30f991===_0x686c('0x52')?![]:![];this['setDataValue'](_0x686c('0x53'),_0x2610a9);}else{this[_0x686c('0x5')](_0x686c('0x53'),_0x30f991);}}},'blocked':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![],'set':function(_0x49a058){this[_0x686c('0x5')](_0x686c('0x54'),_0x49a058);if(_0x49a058===!![]){this['setDataValue'](_0x686c('0x55'),moment());this[_0x686c('0x5')](_0x686c('0x56'),0x0);}else{this[_0x686c('0x5')](_0x686c('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x686c('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x686c('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x686c('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x686c('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x686c('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x686c('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 989311a..b4f613c 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x703a=['user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gte','$lt','$lte','$ne','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','token','removeApiKey','apiKeyNonce','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','teams','queues','inbound','flatten','toString','col','asc','desc','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','slice','charAt','toUpperCase','select','field','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','enabled','moment','util','path','ioredis','../../components/auth/service','../../components/realtime/agents','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','APIForbiddenrror','handleError','socket.io-emitter','redis','register','defaults','localhost','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','role','emit','userNotification:recalc:','destroy','get','Users','user','Agents','agent','Telephones','telephone','filter','value','includes','find','name','UserProfileResource','sendStatus','stack','rawAttributes','map','fieldName','type','key','password','salt','previousPasswords','resetPasswordExpires','md5secret','index','getOptions','User','query','includeAll','include','userSetting','UserSetting','attributes','findAll','true','rows','length','push','chat','sms','dataValues','mail','openchannel','whatsapp','all','catch','show','options','openTabs','fax','body','params','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','max','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','min_internal','from','voicemail','mailbox','VoiceMail','email','101','103','113','110','105','106','107','108','109','111','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','isValidChannel','add','capitalize','toLowerCase','Queues','QueueId','VoiceQueue','voice','format','SIP/%s','interface','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','isArray','Queue:remove','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','Queue','filters','intersection','model','fields','order','sort','where','pick','merge','Unknown\x20role','nolimit','getVoiceQueuesRt','keys','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','concat','LOGININPAUSE','isMiddleware','resolve','pause','online','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','getDataValue','Voice','penalty','TeamVoicePrefix','VoicePrefixId','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','UserVoicePrefix','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions'];(function(_0x18e2c2,_0x2675f3){var _0x362a13=function(_0x391ae4){while(--_0x391ae4){_0x18e2c2['push'](_0x18e2c2['shift']());}};_0x362a13(++_0x2675f3);}(_0x703a,0x1e0));var _0xa703=function(_0x125dc3,_0x321052){_0x125dc3=_0x125dc3-0x0;var _0x2edd77=_0x703a[_0x125dc3];return _0x2edd77;};'use strict';var moment=require(_0xa703('0x0'));var util=require(_0xa703('0x1'));var path=require(_0xa703('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa703('0x3'));var authService=require(_0xa703('0x4'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var rta=require(_0xa703('0x5'));var logger=require(_0xa703('0x6'))(_0xa703('0x7'));var utils=require('../../config/utils');var config=require(_0xa703('0x8'));var licenseUtil=require(_0xa703('0x9'));var APIBadRequestError=require(_0xa703('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0xa703('0xa'))[_0xa703('0xb')];var APIForbiddenError=require('../../errors/api')[_0xa703('0xc')];var APIHandleError=require(_0xa703('0xa'))[_0xa703('0xd')];var db=require('../../mysqldb')['db'];var socket=require(_0xa703('0xe'))(new Redis(config[_0xa703('0xf')]));require('./user.socket')[_0xa703('0x10')](socket);config[_0xa703('0xf')]=_[_0xa703('0x11')](config[_0xa703('0xf')],{'host':_0xa703('0x12'),'port':0x18eb});var values;function respondWithStatusCode(_0x5a00cf,_0x1b23e0){_0x1b23e0=_0x1b23e0||0xcc;return function(_0x62d665){if(_0x62d665){return _0x5a00cf['sendStatus'](_0x1b23e0);}return _0x5a00cf[_0xa703('0x13')](_0x1b23e0)[_0xa703('0x14')]();};}function respondWithResult(_0x56da3f,_0x3cde96){_0x3cde96=_0x3cde96||0xc8;return function(_0x3b5a41){if(_0x3b5a41){return _0x56da3f[_0xa703('0x13')](_0x3cde96)[_0xa703('0x15')](_0x3b5a41);}};}function respondWithFilteredResult(_0x906575,_0x52e4ef){return function(_0x303509){if(_0x303509){var _0x518859=typeof _0x52e4ef['offset']===_0xa703('0x16')&&typeof _0x52e4ef[_0xa703('0x17')]==='undefined';var _0xa3f6dc=_0x303509[_0xa703('0x18')];var _0x2de66c=_0x518859?0x0:_0x52e4ef[_0xa703('0x19')];var _0x255c30=_0x518859?_0x303509[_0xa703('0x18')]:_0x52e4ef[_0xa703('0x19')]+_0x52e4ef['limit'];var _0x410548;if(_0x255c30>=_0xa3f6dc){_0x255c30=_0xa3f6dc;_0x410548=0xc8;}else{_0x410548=0xce;}_0x906575[_0xa703('0x13')](_0x410548);return _0x906575[_0xa703('0x1a')](_0xa703('0x1b'),_0x2de66c+'-'+_0x255c30+'/'+_0xa3f6dc)[_0xa703('0x15')](_0x303509);}return null;};}function saveUpdates(_0x50890b){return function(_0x16518b){if(_0x16518b){return _0x16518b[_0xa703('0x1c')](_0x50890b)[_0xa703('0x1d')](function(_0x5e841d){if(_0x5e841d[_0xa703('0x1e')]==='agent'){socket[_0xa703('0x1f')](_0xa703('0x20')+_0x5e841d['id'],_0x5e841d);}return _0x5e841d;});}return null;};}function removeEntity(_0xa735a4,_0x615b1f){return function(_0x106ebb){if(_0x106ebb){return _0x106ebb[_0xa703('0x21')]({'transaction':_0x615b1f})[_0xa703('0x1d')](function(){var _0x1d0868=_0x106ebb[_0xa703('0x22')]({'plain':!![]});if(_0x1d0868[_0xa703('0x1e')]==='admin')return;var _0x33dc10=[{'name':_0xa703('0x23'),'value':_0xa703('0x24'),'ignore':!![]},{'name':_0xa703('0x25'),'value':_0xa703('0x26'),'ignore':![]},{'name':_0xa703('0x27'),'value':_0xa703('0x28'),'ignore':![]}];var _0x374a33=_(_0x33dc10)[_0xa703('0x29')]('ignore')['map'](_0xa703('0x2a'))[_0xa703('0x2a')]();if(_[_0xa703('0x2b')](_0x374a33,_0x1d0868[_0xa703('0x1e')])){return;}var _0x4bbb7b=_[_0xa703('0x2c')](_0x33dc10,[_0xa703('0x2a'),_0x1d0868[_0xa703('0x1e')]])[_0xa703('0x2d')];return db[_0xa703('0x2e')][_0xa703('0x21')]({'where':{'type':_0x4bbb7b,'resourceId':_0x1d0868['id']},'transaction':_0x615b1f})[_0xa703('0x1d')](function(){return _0x106ebb;});})[_0xa703('0x1d')](function(){_0xa735a4[_0xa703('0x13')](0xcc)[_0xa703('0x14')]();});}};}function handleEntityNotFound(_0x365b79){return function(_0x14d28b){if(!_0x14d28b){_0x365b79[_0xa703('0x2f')](0x194);}return _0x14d28b;};}function handleError(_0x23eca3,_0x5a92dd){_0x5a92dd=_0x5a92dd||0x1f4;return function(_0x1e22f7){logger['error'](_0x1e22f7[_0xa703('0x30')]);if(_0x1e22f7[_0xa703('0x2d')]){delete _0x1e22f7[_0xa703('0x2d')];}_0x23eca3[_0xa703('0x13')](_0x5a92dd)['send'](_0x1e22f7);};}function getUserAttributes(){return _(db['User'][_0xa703('0x31')])[_0xa703('0x32')](function(_0x152644){return{'name':_0x152644[_0xa703('0x33')],'type':_0x152644[_0xa703('0x34')][_0xa703('0x35')]};})[_0xa703('0x29')](function(_0x47f789){return![_0xa703('0x36'),_0xa703('0x37'),_0xa703('0x38'),'resetPasswordToken',_0xa703('0x39'),_0xa703('0x3a')][_0xa703('0x2b')](_0x47f789[_0xa703('0x2d')]);})[_0xa703('0x2a')]();}exports[_0xa703('0x3b')]=function(_0x1a64e5,_0x231f72){var _0xabc671={},_0x1dcfe4={'count':0x0,'rows':[]};var _0x366bc6=getUserAttributes();_0xabc671=qs[_0xa703('0x3c')](_0x366bc6,_0x1a64e5);var _0x49ce2b={'where':_0xabc671['where']};return db[_0xa703('0x3d')][_0xa703('0x18')](_0x49ce2b)[_0xa703('0x1d')](function(_0x24b4ea){_0x1dcfe4[_0xa703('0x18')]=_0x24b4ea;if(_0x1a64e5[_0xa703('0x3e')][_0xa703('0x3f')]){_0xabc671[_0xa703('0x40')]=[{'all':!![]}];}if(_0x1a64e5['query'][_0xa703('0x41')]==='true'){_0xabc671[_0xa703('0x40')]=[{'model':db[_0xa703('0x42')],'as':_0xa703('0x41')}];}if(!_[_0xa703('0x2b')](_0xabc671[_0xa703('0x43')],'id')){_0xabc671[_0xa703('0x43')]['push']('id');}return db[_0xa703('0x3d')][_0xa703('0x44')](_0xabc671);})['then'](function(_0x592509){_0x1dcfe4['rows']=_0x592509;if(_0x1a64e5[_0xa703('0x3e')]['openTabs']===_0xa703('0x45')){var _0x14c082=[];for(var _0x57750e=0x0;_0x57750e<_0x1dcfe4[_0xa703('0x46')][_0xa703('0x47')];_0x57750e++){_0x14c082[_0xa703('0x48')](get_open_tabs(_0xa703('0x49'),_0x1dcfe4[_0xa703('0x46')][_0x57750e]['dataValues']));_0x14c082['push'](get_open_tabs(_0xa703('0x4a'),_0x1dcfe4['rows'][_0x57750e][_0xa703('0x4b')]));_0x14c082[_0xa703('0x48')](get_open_tabs('fax',_0x1dcfe4[_0xa703('0x46')][_0x57750e][_0xa703('0x4b')]));_0x14c082[_0xa703('0x48')](get_open_tabs(_0xa703('0x4c'),_0x1dcfe4['rows'][_0x57750e]['dataValues']));_0x14c082[_0xa703('0x48')](get_open_tabs(_0xa703('0x4d'),_0x1dcfe4['rows'][_0x57750e][_0xa703('0x4b')]));_0x14c082['push'](get_open_tabs(_0xa703('0x4e'),_0x1dcfe4['rows'][_0x57750e][_0xa703('0x4b')]));}return Promise[_0xa703('0x4f')](_0x14c082)[_0xa703('0x1d')](function(){return _0x1dcfe4;});}else{return _0x1dcfe4;}})['then'](respondWithFilteredResult(_0x231f72,_0xabc671))[_0xa703('0x50')](handleError(_0x231f72,null));};exports[_0xa703('0x51')]=function(_0x4190ef,_0x353518){var _0x51f75a=getUserAttributes();_0x4190ef[_0xa703('0x3e')]['id']=_0x4190ef['params']['id'];var _0x3e64ae=qs[_0xa703('0x3c')](_0x51f75a,_0x4190ef);if(_0x4190ef[_0xa703('0x3e')][_0xa703('0x3f')]){_0x3e64ae[_0xa703('0x40')]=[{'all':!![]}];}if(_0x4190ef[_0xa703('0x3e')]['userSetting']===_0xa703('0x45')){_0x3e64ae[_0xa703('0x40')]=[{'model':db['UserSetting'],'as':_0xa703('0x41')}];}_0x3e64ae=_['merge']({},_0x3e64ae,_0x4190ef[_0xa703('0x52')]);if(!_[_0xa703('0x2b')](_0x3e64ae[_0xa703('0x43')],'id')){_0x3e64ae[_0xa703('0x43')]['push']('id');}return db[_0xa703('0x3d')][_0xa703('0x2c')](_0x3e64ae)[_0xa703('0x1d')](handleEntityNotFound(_0x353518,null))[_0xa703('0x1d')](function(_0x54d969){var _0x48acb2=[];values=_0x54d969;if(_0x4190ef[_0xa703('0x3e')][_0xa703('0x53')]===_0xa703('0x45')){_0x48acb2[_0xa703('0x48')](get_open_tabs(_0xa703('0x49'),_0x54d969[_0xa703('0x4b')]));_0x48acb2[_0xa703('0x48')](get_open_tabs(_0xa703('0x4a'),_0x54d969['dataValues']));_0x48acb2[_0xa703('0x48')](get_open_tabs('openchannel',_0x54d969['dataValues']));_0x48acb2['push'](get_open_tabs(_0xa703('0x4e'),_0x54d969[_0xa703('0x4b')]));_0x48acb2[_0xa703('0x48')](get_open_tabs(_0xa703('0x54'),_0x54d969[_0xa703('0x4b')]));_0x48acb2[_0xa703('0x48')](get_open_tabs(_0xa703('0x4c'),_0x54d969[_0xa703('0x4b')]));return Promise['all'](_0x48acb2);}else{return values;}})[_0xa703('0x1d')](function(){return values;})[_0xa703('0x1d')](respondWithResult(_0x353518,null))['catch'](handleError(_0x353518,null));};exports[_0xa703('0x1c')]=function(_0x286a6c,_0x15cd5d){if(_0x286a6c[_0xa703('0x55')]['id']){delete _0x286a6c[_0xa703('0x55')]['id'];}delete _0x286a6c['body'][_0xa703('0x1e')];return db['User'][_0xa703('0x2c')]({'where':{'id':_0x286a6c[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x15cd5d,null))['then'](saveUpdates(_0x286a6c[_0xa703('0x55')],null))[_0xa703('0x1d')](respondWithResult(_0x15cd5d,null))[_0xa703('0x50')](handleError(_0x15cd5d,null));};exports[_0xa703('0x57')]=function(_0x43f59a,_0x3e6985){return db[_0xa703('0x3d')][_0xa703('0x57')]()[_0xa703('0x1d')](respondWithResult(_0x3e6985,null))[_0xa703('0x50')](handleError(_0x3e6985,null));};exports[_0xa703('0x58')]=function(_0x3c89a1,_0x2650ba){return db[_0xa703('0x3d')][_0xa703('0x2c')]({'where':{'id':_0x3c89a1[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x2650ba,null))['then'](function(_0x7023d2){if(_0x7023d2){return _0x7023d2[_0xa703('0x58')](_0x3c89a1[_0xa703('0x55')][_0xa703('0x59')],_[_0xa703('0x5a')](_0x3c89a1[_0xa703('0x55')],['ids','id'])||{});}})[_0xa703('0x1d')](respondWithResult(_0x2650ba,null))[_0xa703('0x50')](handleError(_0x2650ba,null));};function validateUser(_0x477191){return new Promise(function(_0x3c36fc,_0x3f0196){if(_0x477191[_0xa703('0x5b')])return _0x3c36fc(_0x477191);return db[_0xa703('0x5c')][_0xa703('0x5d')](0x1)[_0xa703('0x1d')](function(_0x42ca8b){if(_0x42ca8b[_0xa703('0x5e')])authService['validatePasswordPattern'](_0x477191['password']);db['User'][_0xa703('0x5f')]('internal')[_0xa703('0x1d')](function(_0x5c8a20){if(_[_0xa703('0x60')](_0x5c8a20)){_0x477191[_0xa703('0x5b')]=_0x42ca8b['min_internal']||0x1;return;}if(_[_0xa703('0x60')](_0x42ca8b['min_internal'])||_0x42ca8b['min_internal']===_0x5c8a20){_0x477191[_0xa703('0x5b')]=_0x5c8a20+0x1;return;}if(_0x42ca8b['min_internal']>_0x5c8a20){_0x477191[_0xa703('0x5b')]=_0x42ca8b['min_internal'];return;}return db[_0xa703('0x61')][_0xa703('0x3e')](_0xa703('0x62'),{'type':db['sequelize'][_0xa703('0x63')][_0xa703('0x64')]})[_0xa703('0x1d')](function(_0xa06b0f){if(_0xa06b0f&&_0xa06b0f[_0xa703('0x47')]){for(var _0x19bce3=0x0,_0x152f4b=_0xa06b0f[_0xa703('0x47')];_0x19bce3<_0x152f4b&&_[_0xa703('0x60')](_0x477191[_0xa703('0x5b')]);_0x19bce3++){if(_0x42ca8b[_0xa703('0x65')]<=_0xa06b0f[_0x19bce3][_0xa703('0x66')]){_0x477191[_0xa703('0x5b')]=_0xa06b0f[_0x19bce3]['from'];}else if(_0x42ca8b[_0xa703('0x65')]>_0xa06b0f[_0x19bce3][_0xa703('0x66')]&&_0x42ca8b[_0xa703('0x65')]<=_0xa06b0f[_0x19bce3]['to']){_0x477191[_0xa703('0x5b')]=_0x42ca8b['min_internal'];}}}if(_[_0xa703('0x60')](_0x477191[_0xa703('0x5b')])){_0x477191[_0xa703('0x5b')]=_0x5c8a20+0x1;}return _0x3c36fc(_0x477191);});});})['catch'](function(_0x252380){_0x3f0196(_0x252380);});});}function updateUser(_0x3143a2){return new Promise(function(_0x2fe2ae,_0x21b3e1){try{if(_0x3143a2[_0xa703('0x67')]){_0x3143a2[_0xa703('0x68')]=_0x3143a2['internal'];_0x3143a2[_0xa703('0x69')]={'mailbox':_0x3143a2['internal'],'password':_0x3143a2[_0xa703('0x36')],'fullname':_0x3143a2['fullname'],'email':_0x3143a2[_0xa703('0x6a')]};}if(_0x3143a2[_0xa703('0x1e')]===_0xa703('0x26')){if(!_0x3143a2['permissions'])_0x3143a2['permissions']=[_0xa703('0x6b'),'102',_0xa703('0x6c'),_0xa703('0x6d'),_0xa703('0x6e'),'104',_0xa703('0x6f'),_0xa703('0x70'),_0xa703('0x71'),_0xa703('0x72'),_0xa703('0x73'),'100',_0xa703('0x74'),'114',_0xa703('0x75')];}_0x2fe2ae(_0x3143a2);}catch(_0x4a4aff){_0x21b3e1(_0x4a4aff);}});}exports['create']=function(_0x20e583,_0x2cac0b){if(_0x20e583[_0xa703('0x24')][_0xa703('0x1e')]===_0xa703('0x26'))throw new Error(_0xa703('0x76'));if(_0x20e583[_0xa703('0x55')][_0xa703('0x1e')]===_0xa703('0x24')&&_0x20e583[_0xa703('0x24')]['role']!=='admin'){throw new Error(_0xa703('0x77'));}if(_0x20e583[_0xa703('0x55')][_0xa703('0x1e')]===_0xa703('0x78')&&_0x20e583[_0xa703('0x24')][_0xa703('0x1e')]!==_0xa703('0x78')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xa703('0x79')]([_0x20e583[_0xa703('0x55')]])['then'](function(){return validateUser(_0x20e583[_0xa703('0x55')]);})[_0xa703('0x1d')](function(_0x38f792){return updateUser(_0x38f792)['then'](function(_0x3359e0){if(_0x3359e0[_0xa703('0x1e')]===_0xa703('0x78')){_0x3359e0[_0xa703('0x7a')]=_0x20e583['user'][_0xa703('0x7a')];delete _0x3359e0[_0xa703('0x7b')];}return _0x3359e0;});})[_0xa703('0x1d')](function(_0x30bb10){return db[_0xa703('0x3d')][_0xa703('0x7c')](_0x30bb10,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xa703('0x1d')](function(_0x599969){if(_0x20e583['body']['role']==='user')return _0x599969;if(_0x20e583[_0xa703('0x24')]['role']!==_0xa703('0x24'))return _0x599969;return db[_0xa703('0x7d')][_0xa703('0x2c')]({'where':{'name':_0x599969[_0xa703('0x1e')]==='agent'?'Agents':_0xa703('0x27'),'userProfileId':_0x20e583['user'][_0xa703('0x7b')]},'raw':!![]})['then'](function(_0x5005d1){if(!_0x5005d1||_0x5005d1[_0xa703('0x7e')]!=0x0)return _0x599969;return db[_0xa703('0x2e')][_0xa703('0x7c')]({'name':_0x599969['name'],'resourceId':_0x599969['id'],'type':_0x5005d1['name'],'sectionId':_0x5005d1['id']},{})[_0xa703('0x1d')](function(){return _0x599969;});})['catch'](function(_0x419e3a){logger[_0xa703('0x7f')](_0xa703('0x80'),_0x419e3a);throw _0x419e3a;});})[_0xa703('0x1d')](respondWithResult(_0x2cac0b,0xc9))['catch'](handleError(_0x2cac0b,null));};exports[_0xa703('0x81')]=function(_0x3d5ed1,_0x2200ae){var _0x4d4714=_0x3d5ed1[_0xa703('0x55')];var _0x17bfa5=[];if(_0x3d5ed1[_0xa703('0x24')]['role']==='agent')throw new Error(_0xa703('0x76'));if(_[_0xa703('0x82')](_0x4d4714,[_0xa703('0x1e'),_0xa703('0x24')])&&_0x3d5ed1['user'][_0xa703('0x1e')]!=='admin'){throw new Error(_0xa703('0x77'));}if(_['some'](_0x4d4714,[_0xa703('0x1e'),_0xa703('0x78')])&&_0x3d5ed1[_0xa703('0x24')][_0xa703('0x1e')]!==_0xa703('0x78')){throw new Error(_0xa703('0x83'));}return licenseUtil['checkUserLimits'](_0x4d4714)[_0xa703('0x1d')](function(){return validateUser(_0x4d4714[0x0]);})[_0xa703('0x1d')](function(){for(var _0x2cae43=0x1;_0x2cae43<_0x4d4714[_0xa703('0x47')];_0x2cae43++){var _0x3590f6=_0x4d4714[_0x2cae43-0x1][_0xa703('0x5b')];if(!_0x4d4714[_0x2cae43]['internal'])_0x4d4714[_0x2cae43][_0xa703('0x5b')]=_0x3590f6+0x1;_0x17bfa5[_0xa703('0x48')](validateUser(_0x4d4714[_0x2cae43]));}return Promise['all'](_0x17bfa5);})[_0xa703('0x1d')](function(){_0x17bfa5=[];for(var _0x2bc054=0x0;_0x2bc054<_0x4d4714['length'];_0x2bc054++){_0x17bfa5[_0xa703('0x48')](updateUser(_0x4d4714[_0x2bc054]));}return Promise['all'](_0x17bfa5);})['then'](function(){_0x17bfa5=_0x4d4714['map'](function(_0x3f201a){return db[_0xa703('0x3d')][_0xa703('0x7c')](_0x3f201a,{'include':[{'model':db['VoiceMail'],'as':_0xa703('0x69')}]})[_0xa703('0x1d')](function(_0xafc52e){_0x3f201a['id']=_0xafc52e['id'];return _0x3f201a;});});return Promise[_0xa703('0x4f')](_0x17bfa5);})[_0xa703('0x1d')](function(_0x4e4ce2){if(_0x3d5ed1['body']['role']==='user')return _0x4e4ce2;if(_0x3d5ed1[_0xa703('0x24')][_0xa703('0x1e')]!==_0xa703('0x24'))return _0x4e4ce2;var _0x5aff27=_[_0xa703('0x82')](_0x4e4ce2,function(_0x289e92){return _0x289e92['role']===_0xa703('0x26')||_0x289e92[_0xa703('0x1e')]===_0xa703('0x28');});if(!_0x5aff27)return _0x4e4ce2;return db[_0xa703('0x7d')][_0xa703('0x44')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x3d5ed1[_0xa703('0x24')][_0xa703('0x7b')]},'raw':!![]})[_0xa703('0x1d')](function(_0x30a268){if(_['isEmpty'](_0x30a268)||!_['some'](_0x30a268,['autoAssociation',0x0]))return _0x4e4ce2;_0x17bfa5=[];var _0x4d4d2f=_(_0x30a268)[_0xa703('0x32')](function(_0x36798e){if(_0x36798e[_0xa703('0x7e')]===0x1)return;return _0x36798e[_0xa703('0x2d')]===_0xa703('0x25')?_0xa703('0x26'):_0xa703('0x28');})[_0xa703('0x84')]()[_0xa703('0x2a')]();for(var _0x43fdff=0x0;_0x43fdff<_0x4e4ce2[_0xa703('0x47')];_0x43fdff++){if(!_['includes'](_0x4d4d2f,_0x4e4ce2[_0x43fdff][_0xa703('0x1e')]))return;var _0x37fa0a=_0x4e4ce2[_0x43fdff][_0xa703('0x1e')]===_0xa703('0x26')?'Agents':_0xa703('0x27');_0x17bfa5[_0xa703('0x48')](db[_0xa703('0x2e')][_0xa703('0x7c')]({'name':_0x4e4ce2[_0x43fdff][_0xa703('0x2d')],'resourceId':_0x4e4ce2[_0x43fdff]['id'],'type':_0x37fa0a,'sectionId':_[_0xa703('0x2c')](_0x30a268,[_0xa703('0x2d'),_0x37fa0a])['id']},{}));}return Promise[_0xa703('0x4f')](_0x17bfa5);});})['then'](respondWithResult(_0x2200ae,0xc9))[_0xa703('0x50')](handleError(_0x2200ae,null));};exports[_0xa703('0x85')]=function(_0x3c4cef,_0x4561f5){if(_0x3c4cef[_0xa703('0x55')]['id']){delete _0x3c4cef[_0xa703('0x55')]['id'];}return db[_0xa703('0x3d')]['find']({'where':{'id':_0x3c4cef[_0xa703('0x56')]['id']}})['then'](function(_0x5dd3b4){if(!_0x5dd3b4)return null;if(_0x5dd3b4['id']===_0x3c4cef[_0xa703('0x24')]['id']){if(!_0x3c4cef[_0xa703('0x55')][_0xa703('0x86')]||!_0x3c4cef[_0xa703('0x55')][_0xa703('0x87')]){throw new db[(_0xa703('0x88'))][(_0xa703('0x89'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x5dd3b4['authenticate'](_0x3c4cef['body'][_0xa703('0x86')])){throw new db[(_0xa703('0x88'))][(_0xa703('0x89'))](_0xa703('0x8a'));}if(_0x3c4cef['body'][_0xa703('0x86')]===_0x3c4cef[_0xa703('0x55')][_0xa703('0x87')]){throw new db[(_0xa703('0x88'))]['ValidationError'](_0xa703('0x8b'));}}else if(_0x3c4cef[_0xa703('0x24')][_0xa703('0x1e')]===_0xa703('0x78')){if(!_0x3c4cef[_0xa703('0x55')][_0xa703('0x87')]){throw new db[(_0xa703('0x88'))][(_0xa703('0x89'))](_0xa703('0x8c'));}}else if(_0x3c4cef[_0xa703('0x24')][_0xa703('0x1e')]===_0xa703('0x24')){if(!_0x3c4cef[_0xa703('0x55')][_0xa703('0x87')]){throw new db[(_0xa703('0x88'))][(_0xa703('0x89'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x5dd3b4[_0xa703('0x1e')]!==_0xa703('0x26')){throw new db[(_0xa703('0x88'))]['ValidationError'](_0xa703('0x76'));}}else{throw new db[(_0xa703('0x88'))][(_0xa703('0x89'))]('Unauthorized');}return _0x5dd3b4;})[_0xa703('0x1d')](handleEntityNotFound(_0x4561f5,null))['then'](function(_0x2497e5){return db[_0xa703('0x5c')][_0xa703('0x8d')]({'attributes':['id','securePassword',_0xa703('0x8e'),'passwordHistoryLimit']})['then'](function(_0x53f473){if(_0x53f473['securePassword'])authService['validatePasswordPattern'](_0x3c4cef['body'][_0xa703('0x87')]);if(!_0x53f473[_0xa703('0x8e')]||!_0x2497e5[_0xa703('0x38')])return _0x2497e5;authService[_0xa703('0x8f')](_0x3c4cef[_0xa703('0x55')]['newPassword'],_0x2497e5[_0xa703('0x38')],_0x53f473['passwordHistoryLimit']);return _0x2497e5;})[_0xa703('0x1d')](saveUpdates({'password':_0x3c4cef['body'][_0xa703('0x87')],'passwordResetAt':_0x3c4cef[_0xa703('0x24')]['id']==_0x3c4cef[_0xa703('0x56')]['id']?moment():null,'previousPasswords':authService[_0xa703('0x90')](_0x3c4cef['body'][_0xa703('0x87')],_0x2497e5[_0xa703('0x38')])},null));})[_0xa703('0x1d')](respondWithResult(_0x4561f5,null))[_0xa703('0x50')](handleError(_0x4561f5,null));};exports[_0xa703('0x91')]=function(_0x2f5ccf,_0x18b4c2){var _0x11ffa4=_0x2f5ccf[_0xa703('0x55')][_0xa703('0x92')];return db[_0xa703('0x3d')]['find']({'where':{'id':_0x2f5ccf[_0xa703('0x56')]['id']},'attributes':['id',_0xa703('0x2d'),_0xa703('0x1e'),'online',_0xa703('0x93'),'voicePause','interface']})['then'](handleEntityNotFound(_0x18b4c2,null))[_0xa703('0x1d')](function(_0x2a1104){if(_0x2a1104){if(!utils[_0xa703('0x94')](_0x11ffa4)){throw new db[(_0xa703('0x88'))][(_0xa703('0x89'))]('Unknown\x20channel');}return _0x2a1104[_0xa703('0x95')+_[_0xa703('0x96')](_0x11ffa4[_0xa703('0x97')]())+_0xa703('0x98')](_0x2f5ccf[_0xa703('0x55')]['ids'],{'penalty':_0x2f5ccf['body']['penalty']||0x0})['spread'](function(_0x2c14a5){for(var _0x313fa2=0x0;_0x313fa2<_0x2f5ccf[_0xa703('0x55')]['ids'][_0xa703('0x47')];_0x313fa2+=0x1){var _0xe0b3a3={'UserId':Number(_0x2f5ccf[_0xa703('0x56')]['id'])};_0xe0b3a3[_[_0xa703('0x96')](_0x11ffa4[_0xa703('0x97')]())+_0xa703('0x99')]=Number(_0x2f5ccf[_0xa703('0x55')]['ids'][_0x313fa2]);socket[_0xa703('0x1f')](_0xa703('0x24')+_['capitalize'](_0x11ffa4[_0xa703('0x97')]())+'Queue:save',_0xe0b3a3);}return _0x2c14a5;})[_0xa703('0x1d')](function(){if(_0x11ffa4==='voice'){return db[_0xa703('0x9a')]['findAll']({'where':{'id':_0x2f5ccf[_0xa703('0x55')][_0xa703('0x59')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xa703('0x1d')](function(_0x58db2b){var _0x5f4784=_0x2a1104[_0xa703('0x22')]({'plain':!![]});var _0x2c7d2c=[];if(_0x11ffa4===_0xa703('0x9b')&&_0x5f4784[_0xa703('0x1e')]===_0xa703('0x26')&&_0x5f4784['online']){for(let _0xf61818=0x0;_0xf61818<_0x58db2b[_0xa703('0x47')];_0xf61818+=0x1){_0x2c7d2c[_0xa703('0x48')]({'membername':_0x5f4784[_0xa703('0x2d')],'UserId':_0x5f4784['id'],'queue_name':_0x58db2b[_0xf61818]['name'],'VoiceQueueId':_0x58db2b[_0xf61818]['id'],'interface':_[_0xa703('0x60')](_0x5f4784['interface'])?util[_0xa703('0x9c')](_0xa703('0x9d'),_0x5f4784[_0xa703('0x2d')]):_0x5f4784[_0xa703('0x9e')],'paused':_0x5f4784['voicePause']||![],'penalty':_0x2f5ccf[_0xa703('0x55')]['penalty']||0x0});}return Promise[_0xa703('0x4f')](_0x2c7d2c[_0xa703('0x32')](function(_0x1d244b){return db[_0xa703('0x9f')][_0xa703('0xa0')](_0x1d244b);}));}return _0x2a1104;});}})['then'](respondWithStatusCode(_0x18b4c2,null))[_0xa703('0x50')](handleError(_0x18b4c2,null));};exports[_0xa703('0xa1')]=function(_0x1db70e,_0x1f486f){var _0x4a50c5,_0x178e09;return db[_0xa703('0x3d')][_0xa703('0x2c')]({'where':{'id':_0x1db70e[_0xa703('0x56')]['id']},'attributes':['id',_0xa703('0x2d'),_0xa703('0x1e')]})[_0xa703('0x1d')](handleEntityNotFound(_0x1f486f,null))[_0xa703('0x1d')](function(_0xf064c2){if(_0xf064c2){_0x4a50c5=_0xf064c2;if(!_0x1db70e['query']['channel']||!utils[_0xa703('0x94')](_0x1db70e['query']['channel'])){throw new db['Sequelize'][(_0xa703('0x89'))](_0xa703('0xa2'));}return _0xf064c2[_0xa703('0xa3')+_[_0xa703('0x96')](_0x1db70e[_0xa703('0x3e')][_0xa703('0x92')][_0xa703('0x97')]())+_0xa703('0x98')](_0x1db70e[_0xa703('0x3e')][_0xa703('0x59')]);}})['then'](function(_0x23ec2b){if(_[_0xa703('0xa4')](_0x1db70e[_0xa703('0x3e')]['ids'])){for(var _0x41dcab=0x0;_0x41dcab<_0x1db70e[_0xa703('0x3e')][_0xa703('0x59')]['length'];_0x41dcab+=0x1){_0x178e09={'UserId':Number(_0x1db70e[_0xa703('0x56')]['id'])};_0x178e09[_[_0xa703('0x96')](_0x1db70e[_0xa703('0x3e')]['channel'][_0xa703('0x97')]())+_0xa703('0x99')]=Number(_0x1db70e[_0xa703('0x3e')][_0xa703('0x59')][_0x41dcab]);socket['emit']('user'+_['capitalize'](_0x1db70e[_0xa703('0x3e')][_0xa703('0x92')][_0xa703('0x97')]())+_0xa703('0xa5'),_0x178e09);}}else{_0x178e09={'UserId':Number(_0x1db70e[_0xa703('0x56')]['id'])};_0x178e09[_[_0xa703('0x96')](_0x1db70e[_0xa703('0x3e')][_0xa703('0x92')][_0xa703('0x97')]())+'QueueId']=Number(_0x1db70e[_0xa703('0x3e')][_0xa703('0x59')]);socket['emit'](_0xa703('0x24')+_[_0xa703('0x96')](_0x1db70e[_0xa703('0x3e')]['channel'][_0xa703('0x97')]())+_0xa703('0xa5'),_0x178e09);}return _0x23ec2b;})[_0xa703('0x1d')](function(){if(_0x1db70e[_0xa703('0x3e')][_0xa703('0x92')]===_0xa703('0x9b')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x1db70e[_0xa703('0x56')]['id'],'VoiceQueueId':_0x1db70e[_0xa703('0x3e')][_0xa703('0x59')]},'individualHooks':!![]})[_0xa703('0x1d')](function(){return _0x4a50c5;});}return _0x4a50c5;})[_0xa703('0x1d')](respondWithStatusCode(_0x1f486f,null))[_0xa703('0x50')](handleError(_0x1f486f,null));};exports['addAvatar']=function(_0x189a8a,_0x595d98){_0x189a8a[_0xa703('0x55')][_0xa703('0xa6')]=_0x189a8a[_0xa703('0xa7')][_0xa703('0xa8')];return db['User'][_0xa703('0x2c')]({'where':{'id':_0x189a8a[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x595d98,null))[_0xa703('0x1d')](saveUpdates(_0x189a8a[_0xa703('0x55')],null))[_0xa703('0x1d')](respondWithResult(_0x595d98,null))[_0xa703('0x50')](handleError(_0x595d98,null));};exports['getAvatar']=function(_0x2f0bd0,_0x4d1389){var _0x1ed957=path[_0xa703('0xa9')](config[_0xa703('0xaa')],_0xa703('0xab'));return db[_0xa703('0x3d')][_0xa703('0x2c')]({'where':{'id':_0x2f0bd0['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xa703('0x1d')](handleEntityNotFound(_0x4d1389,null))['then'](function(_0x27a86b){if(_0x27a86b){if(_[_0xa703('0x60')](_0x27a86b[_0xa703('0xa6')])){return _0x4d1389[_0xa703('0xac')](_0x1ed957);}else{if(!fs[_0xa703('0xad')](path[_0xa703('0xa9')](config[_0xa703('0xaa')],_0xa703('0xae'),_0x27a86b['userpic']))){return _0x4d1389[_0xa703('0xac')](_0x1ed957);}return _0x4d1389[_0xa703('0xac')](path[_0xa703('0xa9')](config[_0xa703('0xaa')],_0xa703('0xae'),_0x27a86b[_0xa703('0xa6')]));}}})[_0xa703('0x50')](handleError(_0x4d1389,null));};exports[_0xa703('0xaf')]=function(_0x33c4c5,_0x4b66ec){return db[_0xa703('0x3d')][_0xa703('0x2c')]({'where':{'id':_0x33c4c5['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4b66ec,null))[_0xa703('0x1d')](function(_0x278317){var _0x36ca1a=[];values=_0x278317[_0xa703('0x4b')];_0x36ca1a[_0xa703('0x48')](get_open_tabs(_0xa703('0x49'),_0x278317[_0xa703('0x4b')]));_0x36ca1a[_0xa703('0x48')](get_open_tabs(_0xa703('0x4a'),_0x278317[_0xa703('0x4b')]));_0x36ca1a[_0xa703('0x48')](get_open_tabs(_0xa703('0x4d'),_0x278317[_0xa703('0x4b')]));_0x36ca1a[_0xa703('0x48')](get_open_tabs(_0xa703('0x4e'),_0x278317[_0xa703('0x4b')]));_0x36ca1a[_0xa703('0x48')](get_open_tabs(_0xa703('0x54'),_0x278317[_0xa703('0x4b')]));_0x36ca1a[_0xa703('0x48')](get_open_tabs('mail',_0x278317[_0xa703('0x4b')]));return Promise[_0xa703('0x4f')](_0x36ca1a);})[_0xa703('0x1d')](function(_0x338ac2){if(_0x338ac2){var _0x562be7=_['map'](values['ChatOpenTabs'],function(_0x3baf9c){return{'channel':_0xa703('0xb0'),'id':_0x3baf9c['id'],'createdAt':_0x3baf9c[_0xa703('0xb1')]};});var _0x182b47=_[_0xa703('0x32')](values[_0xa703('0xb2')],function(_0x4a76c9){return{'channel':'FAX','id':_0x4a76c9['id'],'createdAt':_0x4a76c9[_0xa703('0xb1')]};});var _0x59abd1=_[_0xa703('0x32')](values[_0xa703('0xb3')],function(_0x17fc14){return{'channel':_0xa703('0xb4'),'id':_0x17fc14['id'],'createdAt':_0x17fc14['createdAt']};});var _0x3e798e=_[_0xa703('0x32')](values[_0xa703('0xb5')],function(_0x3782b3){return{'channel':_0xa703('0xb6'),'id':_0x3782b3['id'],'createdAt':_0x3782b3[_0xa703('0xb1')]};});var _0x1ac404=_[_0xa703('0x32')](values[_0xa703('0xb7')],function(_0x43b5a8){return{'channel':_0xa703('0xb8'),'id':_0x43b5a8['id'],'createdAt':_0x43b5a8['createdAt']};});var _0x2fbf06=_[_0xa703('0x32')](values[_0xa703('0xb9')],function(_0x399a6f){return{'channel':_0xa703('0xba'),'id':_0x399a6f['id'],'createdAt':_0x399a6f[_0xa703('0xb1')]};});var _0x24cae7=_['concat'](_0x562be7,_0x182b47,_0x59abd1,_0x3e798e,_0x1ac404,_0x2fbf06);var _0x1a79ca={'count':_0x24cae7[_0xa703('0x47')],'rows':_0x24cae7};return _0x1a79ca;}else return null;})['then'](respondWithResult(_0x4b66ec,null))[_0xa703('0x50')](handleError(_0x4b66ec,null));};exports[_0xa703('0xbb')]=function(_0x205723,_0xd2f1e7){var _0x1a2092={};return db['User']['findOne']({'where':{'id':_0x205723[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](function(_0x1f19a8){if(!_0x1f19a8){throw new APINotFoundError(util[_0xa703('0x9c')](_0xa703('0xbc'),_0x205723[_0xa703('0x56')]['id']));}return contacts['describe']();})['then'](function(_0x94eb05){_0x205723[_0xa703('0x3e')][_0xa703('0x3d')]=_0x205723[_0xa703('0x56')]['id'];_0x1a2092=qs[_0xa703('0x3c')](_0x94eb05,_0x205723);if(_0x205723['query'][_0xa703('0xbd')](_0xa703('0x3f'))){_0x1a2092['include']=[{'model':db[_0xa703('0xbe')],'as':_0xa703('0xbf'),'required':![]},{'model':db[_0xa703('0xc0')],'as':_0xa703('0xc1'),'attributes':['id','name',_0xa703('0xc2')],'where':_0x205723[_0xa703('0x3e')][_0xa703('0xc3')]?{'id':_0x205723[_0xa703('0x3e')][_0xa703('0xc3')]}:undefined,'required':_0x205723[_0xa703('0x3e')][_0xa703('0xc3')]?!![]:![]}];}return contacts[_0xa703('0x44')](_0x205723[_0xa703('0x3e')],_0x205723[_0xa703('0x24')],_0x1a2092,_0x94eb05);})[_0xa703('0x1d')](respondWithFilteredResult(_0xd2f1e7,_0x1a2092))[_0xa703('0x50')](APIHandleError(_0xd2f1e7));};exports['getQueues']=function(_0x157757,_0x2b8a28){var _0x5e4a1f;var _0x18c397={};var _0x2429ce;return db[_0xa703('0x3d')][_0xa703('0x8d')]({'where':{'id':_0x157757[_0xa703('0x56')]['id']},'attributes':['id','name',_0xa703('0x1e')]})[_0xa703('0x1d')](handleEntityNotFound(_0x2b8a28,null))[_0xa703('0x1d')](function(_0x8dd946){if(!utils['isValidChannel'](_0x157757[_0xa703('0x3e')]['channel'])){throw new db[(_0xa703('0x88'))][(_0xa703('0x89'))](_0xa703('0xa2'));}_0x5e4a1f=_0x8dd946;var _0x3441d6={};_0x3441d6['model']=_['keys'](db[_[_0xa703('0x96')](_0x157757[_0xa703('0x3e')][_0xa703('0x92')])+_0xa703('0xc4')][_0xa703('0x31')]);_0x3441d6[_0xa703('0x3e')]=_['keys'](_0x157757['query']);_0x3441d6[_0xa703('0xc5')]=_[_0xa703('0xc6')](_0x3441d6[_0xa703('0xc7')],_0x3441d6[_0xa703('0x3e')]);_0x18c397[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x3441d6[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x157757[_0xa703('0x3e')][_0xa703('0xc8')]));_0x18c397[_0xa703('0x43')]=_0x18c397['attributes'][_0xa703('0x47')]?_0x18c397[_0xa703('0x43')]:_0x3441d6['model'];_0x18c397[_0xa703('0xc9')]=qs[_0xa703('0xca')](_0x157757['query'][_0xa703('0xca')]);_0x18c397[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x157757[_0xa703('0x3e')],_0x3441d6[_0xa703('0xc5')]));if(_0x157757[_0xa703('0x3e')][_0xa703('0x29')]){_0x18c397[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x18c397[_0xa703('0xcb')],{'$or':_[_0xa703('0x32')](_0x18c397[_0xa703('0x43')],function(_0x45250f){var _0x5dba26={};_0x5dba26[_0x45250f]={'$like':'%'+_0x157757['query'][_0xa703('0x29')]+'%'};return _0x5dba26;})});}_0x18c397=_[_0xa703('0xcd')]({},_0x18c397,_0x157757[_0xa703('0x52')]);switch(_0x5e4a1f[_0xa703('0x1e')]){case'admin':return db[_[_0xa703('0x96')](_0x157757[_0xa703('0x3e')][_0xa703('0x92')])+_0xa703('0xc4')][_0xa703('0x44')](_0x18c397);case'user':case _0xa703('0x26'):return _0x5e4a1f['get'+_[_0xa703('0x96')](_0x157757['query']['channel'])+_0xa703('0x98')](_0x18c397);default:throw new db['Sequelize'][(_0xa703('0x89'))](_0xa703('0xce'));}})[_0xa703('0x1d')](function(_0x2d5c6a){_0x2429ce=_0x2d5c6a[_0xa703('0x47')];if(!_0x157757[_0xa703('0x3e')][_0xa703('0xbd')](_0xa703('0xcf'))){_0x18c397['limit']=qs[_0xa703('0x17')](_0x157757[_0xa703('0x3e')]['limit']);_0x18c397[_0xa703('0x19')]=qs[_0xa703('0x19')](_0x157757[_0xa703('0x3e')][_0xa703('0x19')]);}switch(_0x5e4a1f[_0xa703('0x1e')]){case _0xa703('0x78'):return db[_[_0xa703('0x96')](_0x157757['query'][_0xa703('0x92')])+_0xa703('0xc4')]['findAll'](_0x18c397);case _0xa703('0x24'):case _0xa703('0x26'):return _0x5e4a1f[_0xa703('0x22')+_[_0xa703('0x96')](_0x157757[_0xa703('0x3e')][_0xa703('0x92')])+_0xa703('0x98')](_0x18c397);}})[_0xa703('0x1d')](function(_0x424e32){return{'count':_0x2429ce,'rows':_0x424e32};})['then'](respondWithResult(_0x2b8a28,null))[_0xa703('0x50')](handleError(_0x2b8a28,null));};exports[_0xa703('0xd0')]=function(_0x2f9db2,_0x182334){var _0x28dcfd={};var _0x4d8943={};var _0x468013;var _0x2d8fee;return db[_0xa703('0x3d')][_0xa703('0x8d')]({'where':{'id':_0x2f9db2[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x182334,null))['then'](function(_0x1c523b){if(_0x1c523b){_0x468013=_0x1c523b;_0x4d8943['model']=_['keys'](db[_0xa703('0x9f')]['rawAttributes']);_0x4d8943[_0xa703('0x3e')]=_[_0xa703('0xd1')](_0x2f9db2[_0xa703('0x3e')]);_0x4d8943['filters']=_[_0xa703('0xc6')](_0x4d8943['model'],_0x4d8943[_0xa703('0x3e')]);_0x28dcfd['attributes']=_[_0xa703('0xc6')](_0x4d8943[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x2f9db2[_0xa703('0x3e')][_0xa703('0xc8')]));_0x28dcfd[_0xa703('0x43')]=_0x28dcfd['attributes'][_0xa703('0x47')]?_0x28dcfd[_0xa703('0x43')]:_0x4d8943[_0xa703('0xc7')];_0x28dcfd[_0xa703('0xc9')]=qs[_0xa703('0xca')](_0x2f9db2[_0xa703('0x3e')][_0xa703('0xca')]);_0x28dcfd[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x2f9db2[_0xa703('0x3e')],_0x4d8943[_0xa703('0xc5')]));if(_0x2f9db2[_0xa703('0x3e')][_0xa703('0x29')]){_0x28dcfd[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x28dcfd['where'],{'$or':_[_0xa703('0x32')](_0x28dcfd[_0xa703('0x43')],function(_0x2973fb){var _0x7a63da={};_0x7a63da[_0x2973fb]={'$like':'%'+_0x2f9db2[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x7a63da;})});}_0x28dcfd=_['merge']({},_0x28dcfd,_0x2f9db2[_0xa703('0x52')]);return _0x468013[_0xa703('0xd0')](_0x28dcfd);}})[_0xa703('0x1d')](function(_0xee6b8b){if(_0xee6b8b){_0x2d8fee=_0xee6b8b[_0xa703('0x47')];if(!_0x2f9db2['query']['hasOwnProperty'](_0xa703('0xcf'))){_0x28dcfd['limit']=qs[_0xa703('0x17')](_0x2f9db2[_0xa703('0x3e')][_0xa703('0x17')]);_0x28dcfd['offset']=qs[_0xa703('0x19')](_0x2f9db2['query']['offset']);}return _0x468013[_0xa703('0xd0')](_0x28dcfd);}})['then'](function(_0x26b06c){if(_0x26b06c){return _0x26b06c?{'count':_0x2d8fee,'rows':_0x26b06c}:null;}})['then'](respondWithResult(_0x182334,null))[_0xa703('0x50')](handleError(_0x182334,null));};exports['getGroups']=function(_0xac3f29,_0x50a83c){var _0x2cd601={};var _0x5069fb={};var _0x13156d;var _0x216da9;return db[_0xa703('0x3d')][_0xa703('0x8d')]({'where':{'id':_0xac3f29[_0xa703('0x56')]['id']}})['then'](handleEntityNotFound(_0x50a83c,null))['then'](function(_0x3ecfd2){if(_0x3ecfd2){_0x13156d=_0x3ecfd2;_0x5069fb[_0xa703('0xc7')]=_['keys'](db['ChatGroup'][_0xa703('0x31')]);_0x5069fb[_0xa703('0x3e')]=_[_0xa703('0xd1')](_0xac3f29[_0xa703('0x3e')]);_0x5069fb[_0xa703('0xc5')]=_[_0xa703('0xc6')](_0x5069fb['model'],_0x5069fb[_0xa703('0x3e')]);_0x2cd601[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x5069fb[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0xac3f29[_0xa703('0x3e')][_0xa703('0xc8')]));_0x2cd601[_0xa703('0x43')]=_0x2cd601[_0xa703('0x43')][_0xa703('0x47')]?_0x2cd601[_0xa703('0x43')]:_0x5069fb[_0xa703('0xc7')];_0x2cd601[_0xa703('0xc9')]=qs['sort'](_0xac3f29['query'][_0xa703('0xca')]);_0x2cd601['where']=qs['filters'](_[_0xa703('0xcc')](_0xac3f29[_0xa703('0x3e')],_0x5069fb[_0xa703('0xc5')]));if(_0xac3f29[_0xa703('0x3e')][_0xa703('0x29')]){_0x2cd601[_0xa703('0xcb')]=_['merge'](_0x2cd601[_0xa703('0xcb')],{'$or':_[_0xa703('0x32')](_0x2cd601[_0xa703('0x43')],function(_0x5b2eb0){var _0x2bf43d={};_0x2bf43d[_0x5b2eb0]={'$like':'%'+_0xac3f29[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x2bf43d;})});}_0x2cd601=_[_0xa703('0xcd')]({},_0x2cd601,_0xac3f29[_0xa703('0x52')]);return _0x13156d[_0xa703('0xd2')](_0x2cd601);}})[_0xa703('0x1d')](function(_0x37b6dc){if(_0x37b6dc){_0x216da9=_0x37b6dc[_0xa703('0x47')];if(!_0xac3f29[_0xa703('0x3e')]['hasOwnProperty']('nolimit')){_0x2cd601[_0xa703('0x17')]=qs[_0xa703('0x17')](_0xac3f29[_0xa703('0x3e')][_0xa703('0x17')]);_0x2cd601[_0xa703('0x19')]=qs[_0xa703('0x19')](_0xac3f29['query'][_0xa703('0x19')]);}return _0x13156d['getGroups'](_0x2cd601);}})[_0xa703('0x1d')](function(_0x31127d){if(_0x31127d){return _0x31127d?{'count':_0x216da9,'rows':_0x31127d}:null;}})[_0xa703('0x1d')](respondWithResult(_0x50a83c,null))[_0xa703('0x50')](handleError(_0x50a83c,null));};exports['getRecordings']=function(_0x211c49,_0x1915f2){var _0x1d781d={'raw':!![],'where':{}};var _0x4b9626={};var _0x117e1b={'count':0x0,'rows':[]};return db['User'][_0xa703('0x8d')]({'where':{'id':_0x211c49[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x1915f2,null))[_0xa703('0x1d')](function(_0x596911){if(_0x596911){_0x4b9626['model']=_[_0xa703('0xd1')](db[_0xa703('0xd3')][_0xa703('0x31')]);_0x4b9626['query']=_['keys'](_0x211c49['query']);_0x4b9626['filters']=_[_0xa703('0xc6')](_0x4b9626[_0xa703('0xc7')],_0x4b9626['query']);_0x1d781d[_0xa703('0x43')]=_['intersection'](_0x4b9626[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x211c49[_0xa703('0x3e')][_0xa703('0xc8')]));_0x1d781d[_0xa703('0x43')]=_0x1d781d[_0xa703('0x43')][_0xa703('0x47')]?_0x1d781d['attributes']:_0x4b9626[_0xa703('0xc7')];if(!_0x211c49[_0xa703('0x3e')][_0xa703('0xbd')]('nolimit')){_0x1d781d[_0xa703('0x17')]=qs[_0xa703('0x17')](_0x211c49[_0xa703('0x3e')]['limit']);_0x1d781d[_0xa703('0x19')]=qs['offset'](_0x211c49[_0xa703('0x3e')][_0xa703('0x19')]);}_0x1d781d['order']=qs[_0xa703('0xca')](_0x211c49['query'][_0xa703('0xca')]);_0x1d781d[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x211c49[_0xa703('0x3e')],_0x4b9626['filters']));_0x1d781d[_0xa703('0xcb')][_0xa703('0xd4')]=_0x596911['id'];if(_0x211c49[_0xa703('0x3e')]['filter']){_0x1d781d[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x1d781d[_0xa703('0xcb')],{'$or':_[_0xa703('0x32')](_0x1d781d[_0xa703('0x43')],function(_0x3e953d){var _0x28037f={};_0x28037f[_0x3e953d]={'$like':'%'+_0x211c49[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x28037f;})});}_0x1d781d=_[_0xa703('0xcd')]({},_0x1d781d,_0x211c49[_0xa703('0x52')]);return db[_0xa703('0xd3')][_0xa703('0x18')]({'where':_0x1d781d[_0xa703('0xcb')]})[_0xa703('0x1d')](function(_0xc783b7){_0x117e1b[_0xa703('0x18')]=_0xc783b7;if(_0x211c49[_0xa703('0x3e')]['includeAll']){_0x1d781d['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x1d781d);})[_0xa703('0x1d')](function(_0x3b4924){_0x117e1b['rows']=_0x3b4924;return _0x117e1b;});}})[_0xa703('0x1d')](respondWithFilteredResult(_0x1915f2,_0x1d781d))['catch'](handleError(_0x1915f2,null));};exports[_0xa703('0xd5')]=function(_0x5808db,_0x3d3e5d){var _0x1be333={'raw':!![],'where':{}};var _0x3204f5={};var _0xdcfd={'count':0x0,'rows':[]};return db[_0xa703('0x3d')]['findOne']({'where':{'id':_0x5808db[_0xa703('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d3e5d,null))['then'](function(_0x2b0955){if(_0x2b0955){_0x3204f5[_0xa703('0xc7')]=_[_0xa703('0xd1')](db[_0xa703('0xd6')]['rawAttributes']);_0x3204f5[_0xa703('0x3e')]=_[_0xa703('0xd1')](_0x5808db[_0xa703('0x3e')]);_0x3204f5[_0xa703('0xc5')]=_['intersection'](_0x3204f5[_0xa703('0xc7')],_0x3204f5[_0xa703('0x3e')]);_0x1be333[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x3204f5[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x5808db[_0xa703('0x3e')][_0xa703('0xc8')]));_0x1be333['attributes']=_0x1be333['attributes']['length']?_0x1be333[_0xa703('0x43')]:_0x3204f5['model'];if(!_0x5808db[_0xa703('0x3e')][_0xa703('0xbd')](_0xa703('0xcf'))){_0x1be333[_0xa703('0x17')]=qs[_0xa703('0x17')](_0x5808db['query'][_0xa703('0x17')]);_0x1be333[_0xa703('0x19')]=qs[_0xa703('0x19')](_0x5808db[_0xa703('0x3e')]['offset']);}_0x1be333['order']=qs['sort'](_0x5808db[_0xa703('0x3e')][_0xa703('0xca')]);_0x1be333[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x5808db[_0xa703('0x3e')],_0x3204f5[_0xa703('0xc5')]));_0x1be333['where'][_0xa703('0xd4')]=_0x2b0955['id'];if(_0x5808db['query'][_0xa703('0x29')]){_0x1be333[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x1be333[_0xa703('0xcb')],{'$or':_['map'](_0x1be333['attributes'],function(_0x2a81c2){var _0x19f7db={};_0x19f7db[_0x2a81c2]={'$like':'%'+_0x5808db[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x19f7db;})});}_0x1be333=_[_0xa703('0xcd')]({},_0x1be333,_0x5808db['options']);return db[_0xa703('0xd6')][_0xa703('0x18')]({'where':_0x1be333[_0xa703('0xcb')]})[_0xa703('0x1d')](function(_0x22339d){_0xdcfd[_0xa703('0x18')]=_0x22339d;if(_0x5808db['query'][_0xa703('0x3f')]){_0x1be333[_0xa703('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xa703('0x44')](_0x1be333);})['then'](function(_0x38576b){_0xdcfd[_0xa703('0x46')]=_0x38576b;return _0xdcfd;});}})['then'](respondWithFilteredResult(_0x3d3e5d,_0x1be333))[_0xa703('0x50')](handleError(_0x3d3e5d,null));};exports[_0xa703('0xd7')]=function(_0x5ea0c5,_0x16d1b4){var _0x4e92d8={};var _0x5682a7={};var _0x15cd72;var _0x5776eb;return db[_0xa703('0x3d')][_0xa703('0x8d')]({'where':{'id':_0x5ea0c5[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x16d1b4,null))[_0xa703('0x1d')](function(_0x5eabe3){if(_0x5eabe3){_0x15cd72=_0x5eabe3;_0x5682a7[_0xa703('0xc7')]=_[_0xa703('0xd1')](db[_0xa703('0xd8')][_0xa703('0x31')]);_0x5682a7[_0xa703('0x3e')]=_[_0xa703('0xd1')](_0x5ea0c5[_0xa703('0x3e')]);_0x5682a7[_0xa703('0xc5')]=_[_0xa703('0xc6')](_0x5682a7['model'],_0x5682a7['query']);_0x4e92d8[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x5682a7['model'],qs['fields'](_0x5ea0c5[_0xa703('0x3e')][_0xa703('0xc8')]));_0x4e92d8[_0xa703('0x43')]=_0x4e92d8[_0xa703('0x43')][_0xa703('0x47')]?_0x4e92d8[_0xa703('0x43')]:_0x5682a7[_0xa703('0xc7')];_0x4e92d8[_0xa703('0xc9')]=qs['sort'](_0x5ea0c5[_0xa703('0x3e')][_0xa703('0xca')]);_0x4e92d8[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x5ea0c5['query'],_0x5682a7[_0xa703('0xc5')]));if(_0x5ea0c5[_0xa703('0x3e')][_0xa703('0x29')]){_0x4e92d8[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x4e92d8[_0xa703('0xcb')],{'$or':_[_0xa703('0x32')](_0x4e92d8[_0xa703('0x43')],function(_0x53eff0){var _0x58ac51={};_0x58ac51[_0x53eff0]={'$like':'%'+_0x5ea0c5[_0xa703('0x3e')]['filter']+'%'};return _0x58ac51;})});}_0x4e92d8=_['merge']({},_0x4e92d8,_0x5ea0c5[_0xa703('0x52')]);return _0x15cd72[_0xa703('0xd7')](_0x4e92d8);}})['then'](function(_0x45a902){if(_0x45a902){_0x5776eb=_0x45a902[_0xa703('0x47')];if(!_0x5ea0c5[_0xa703('0x3e')][_0xa703('0xbd')](_0xa703('0xcf'))){_0x4e92d8[_0xa703('0x17')]=qs[_0xa703('0x17')](_0x5ea0c5[_0xa703('0x3e')][_0xa703('0x17')]);_0x4e92d8[_0xa703('0x19')]=qs[_0xa703('0x19')](_0x5ea0c5['query'][_0xa703('0x19')]);}return _0x15cd72[_0xa703('0xd7')](_0x4e92d8);}})[_0xa703('0x1d')](function(_0x599962){if(_0x599962){return _0x599962?{'count':_0x5776eb,'rows':_0x599962}:null;}})[_0xa703('0x1d')](respondWithResult(_0x16d1b4,null))['catch'](handleError(_0x16d1b4,null));};exports[_0xa703('0xd9')]=function(_0x243438,_0x5a69d6){var _0x3ede20={};var _0x215d9e={};var _0x26917c;var _0x536e8a;return db[_0xa703('0x3d')][_0xa703('0x8d')]({'where':{'id':_0x243438[_0xa703('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a69d6,null))[_0xa703('0x1d')](function(_0x63000f){if(_0x63000f){_0x26917c=_0x63000f;_0x215d9e[_0xa703('0xc7')]=_[_0xa703('0xd1')](db['OpenchannelInteraction']['rawAttributes']);_0x215d9e['query']=_['keys'](_0x243438[_0xa703('0x3e')]);_0x215d9e['filters']=_[_0xa703('0xc6')](_0x215d9e['model'],_0x215d9e[_0xa703('0x3e')]);_0x3ede20[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x215d9e[_0xa703('0xc7')],qs['fields'](_0x243438['query'][_0xa703('0xc8')]));_0x3ede20[_0xa703('0x43')]=_0x3ede20[_0xa703('0x43')]['length']?_0x3ede20[_0xa703('0x43')]:_0x215d9e[_0xa703('0xc7')];_0x3ede20[_0xa703('0xc9')]=qs['sort'](_0x243438[_0xa703('0x3e')][_0xa703('0xca')]);_0x3ede20[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x243438[_0xa703('0x3e')],_0x215d9e[_0xa703('0xc5')]));if(_0x243438[_0xa703('0x3e')]['filter']){_0x3ede20[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x3ede20[_0xa703('0xcb')],{'$or':_[_0xa703('0x32')](_0x3ede20[_0xa703('0x43')],function(_0x3b1572){var _0x3b47af={};_0x3b47af[_0x3b1572]={'$like':'%'+_0x243438[_0xa703('0x3e')]['filter']+'%'};return _0x3b47af;})});}_0x3ede20=_['merge']({},_0x3ede20,_0x243438[_0xa703('0x52')]);return _0x26917c[_0xa703('0xd9')](_0x3ede20);}})[_0xa703('0x1d')](function(_0x47e9ea){if(_0x47e9ea){_0x536e8a=_0x47e9ea['length'];if(!_0x243438[_0xa703('0x3e')][_0xa703('0xbd')](_0xa703('0xcf'))){_0x3ede20[_0xa703('0x17')]=qs[_0xa703('0x17')](_0x243438[_0xa703('0x3e')][_0xa703('0x17')]);_0x3ede20['offset']=qs[_0xa703('0x19')](_0x243438['query'][_0xa703('0x19')]);}return _0x26917c[_0xa703('0xd9')](_0x3ede20);}})['then'](function(_0x870eed){if(_0x870eed){return _0x870eed?{'count':_0x536e8a,'rows':_0x870eed}:null;}})[_0xa703('0x1d')](respondWithResult(_0x5a69d6,null))[_0xa703('0x50')](handleError(_0x5a69d6,null));};exports[_0xa703('0xda')]=function(_0x5cddc0,_0x3a7a93){var _0x53e2a7={'raw':!![],'where':{}};var _0x2f20ca={};var _0x502874={'count':0x0,'rows':[]};return db[_0xa703('0x3d')]['findOne']({'where':{'id':_0x5cddc0[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x3a7a93,null))['then'](function(_0x48e65f){if(_0x48e65f){_0x2f20ca[_0xa703('0xc7')]=_[_0xa703('0xd1')](db[_0xa703('0xdb')][_0xa703('0x31')]);_0x2f20ca[_0xa703('0x3e')]=_['keys'](_0x5cddc0[_0xa703('0x3e')]);_0x2f20ca[_0xa703('0xc5')]=_[_0xa703('0xc6')](_0x2f20ca[_0xa703('0xc7')],_0x2f20ca[_0xa703('0x3e')]);_0x53e2a7[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x2f20ca[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x5cddc0[_0xa703('0x3e')]['fields']));_0x53e2a7[_0xa703('0x43')]=_0x53e2a7['attributes'][_0xa703('0x47')]?_0x53e2a7['attributes']:_0x2f20ca[_0xa703('0xc7')];if(!_0x5cddc0[_0xa703('0x3e')][_0xa703('0xbd')](_0xa703('0xcf'))){_0x53e2a7['limit']=qs[_0xa703('0x17')](_0x5cddc0['query'][_0xa703('0x17')]);_0x53e2a7['offset']=qs[_0xa703('0x19')](_0x5cddc0[_0xa703('0x3e')]['offset']);}_0x53e2a7[_0xa703('0xc9')]=qs[_0xa703('0xca')](_0x5cddc0[_0xa703('0x3e')][_0xa703('0xca')]);_0x53e2a7[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x5cddc0['query'],_0x2f20ca[_0xa703('0xc5')]));_0x53e2a7['where']['UserId']=_0x48e65f['id'];if(_0x5cddc0[_0xa703('0x3e')]['filter']){_0x53e2a7[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x53e2a7[_0xa703('0xcb')],{'$or':_[_0xa703('0x32')](_0x53e2a7[_0xa703('0x43')],function(_0x35a8ab){var _0x70ddd1={};_0x70ddd1[_0x35a8ab]={'$like':'%'+_0x5cddc0[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x70ddd1;})});}_0x53e2a7=_[_0xa703('0xcd')]({},_0x53e2a7,_0x5cddc0[_0xa703('0x52')]);return db['MailInteraction'][_0xa703('0x18')]({'where':_0x53e2a7[_0xa703('0xcb')]})[_0xa703('0x1d')](function(_0x100354){_0x502874[_0xa703('0x18')]=_0x100354;if(_0x5cddc0[_0xa703('0x3e')][_0xa703('0x3f')]){_0x53e2a7[_0xa703('0x40')]=[{'all':!![]}];}return db[_0xa703('0xdb')][_0xa703('0x44')](_0x53e2a7);})[_0xa703('0x1d')](function(_0x43d397){_0x502874[_0xa703('0x46')]=_0x43d397;return _0x502874;});}})[_0xa703('0x1d')](respondWithFilteredResult(_0x3a7a93,_0x53e2a7))['catch'](handleError(_0x3a7a93,null));};exports['getSmsInteractions']=function(_0x49d15c,_0x115fd4){var _0x4dec54={};var _0x5ac1e2={};var _0x2f67b1;var _0x5dc538;return db['User'][_0xa703('0x8d')]({'where':{'id':_0x49d15c[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x115fd4,null))[_0xa703('0x1d')](function(_0x5cceba){if(_0x5cceba){_0x2f67b1=_0x5cceba;_0x5ac1e2[_0xa703('0xc7')]=_['keys'](db[_0xa703('0xdc')][_0xa703('0x31')]);_0x5ac1e2[_0xa703('0x3e')]=_[_0xa703('0xd1')](_0x49d15c[_0xa703('0x3e')]);_0x5ac1e2[_0xa703('0xc5')]=_['intersection'](_0x5ac1e2[_0xa703('0xc7')],_0x5ac1e2[_0xa703('0x3e')]);_0x4dec54[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x5ac1e2[_0xa703('0xc7')],qs['fields'](_0x49d15c[_0xa703('0x3e')][_0xa703('0xc8')]));_0x4dec54['attributes']=_0x4dec54[_0xa703('0x43')]['length']?_0x4dec54[_0xa703('0x43')]:_0x5ac1e2['model'];_0x4dec54[_0xa703('0xc9')]=qs[_0xa703('0xca')](_0x49d15c[_0xa703('0x3e')][_0xa703('0xca')]);_0x4dec54[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x49d15c[_0xa703('0x3e')],_0x5ac1e2['filters']));if(_0x49d15c[_0xa703('0x3e')]['filter']){_0x4dec54[_0xa703('0xcb')]=_['merge'](_0x4dec54['where'],{'$or':_[_0xa703('0x32')](_0x4dec54[_0xa703('0x43')],function(_0x5dde01){var _0x221e9c={};_0x221e9c[_0x5dde01]={'$like':'%'+_0x49d15c[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x221e9c;})});}_0x4dec54=_['merge']({},_0x4dec54,_0x49d15c[_0xa703('0x52')]);return _0x2f67b1['getSmsInteractions'](_0x4dec54);}})[_0xa703('0x1d')](function(_0x118040){if(_0x118040){_0x5dc538=_0x118040[_0xa703('0x47')];if(!_0x49d15c[_0xa703('0x3e')][_0xa703('0xbd')]('nolimit')){_0x4dec54[_0xa703('0x17')]=qs['limit'](_0x49d15c[_0xa703('0x3e')][_0xa703('0x17')]);_0x4dec54[_0xa703('0x19')]=qs[_0xa703('0x19')](_0x49d15c['query'][_0xa703('0x19')]);}return _0x2f67b1[_0xa703('0xdd')](_0x4dec54);}})[_0xa703('0x1d')](function(_0x37afec){if(_0x37afec){return _0x37afec?{'count':_0x5dc538,'rows':_0x37afec}:null;}})['then'](respondWithResult(_0x115fd4,null))['catch'](handleError(_0x115fd4,null));};exports[_0xa703('0xde')]=function(_0x42eed8,_0x52200f){var _0x158293={};var _0x560b2e={};var _0x1ad963;var _0x5b65fc;return db[_0xa703('0x3d')][_0xa703('0x8d')]({'where':{'id':_0x42eed8[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x52200f,null))[_0xa703('0x1d')](function(_0x2fb47a){if(_0x2fb47a){_0x1ad963=_0x2fb47a;_0x560b2e['model']=_[_0xa703('0xd1')](db[_0xa703('0xdf')][_0xa703('0x31')]);_0x560b2e[_0xa703('0x3e')]=_[_0xa703('0xd1')](_0x42eed8['query']);_0x560b2e[_0xa703('0xc5')]=_['intersection'](_0x560b2e[_0xa703('0xc7')],_0x560b2e[_0xa703('0x3e')]);_0x158293[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x560b2e[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x42eed8['query'][_0xa703('0xc8')]));_0x158293[_0xa703('0x43')]=_0x158293[_0xa703('0x43')][_0xa703('0x47')]?_0x158293[_0xa703('0x43')]:_0x560b2e[_0xa703('0xc7')];_0x158293[_0xa703('0xc9')]=qs[_0xa703('0xca')](_0x42eed8[_0xa703('0x3e')][_0xa703('0xca')]);_0x158293[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x42eed8[_0xa703('0x3e')],_0x560b2e[_0xa703('0xc5')]));if(_0x42eed8[_0xa703('0x3e')][_0xa703('0x29')]){_0x158293[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x158293[_0xa703('0xcb')],{'$or':_[_0xa703('0x32')](_0x158293[_0xa703('0x43')],function(_0xc6ed91){var _0x543bc7={};_0x543bc7[_0xc6ed91]={'$like':'%'+_0x42eed8[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x543bc7;})});}_0x158293=_[_0xa703('0xcd')]({},_0x158293,_0x42eed8['options']);return _0x1ad963[_0xa703('0xde')](_0x158293);}})[_0xa703('0x1d')](function(_0x12c17c){if(_0x12c17c){_0x5b65fc=_0x12c17c['length'];if(!_0x42eed8[_0xa703('0x3e')][_0xa703('0xbd')](_0xa703('0xcf'))){_0x158293[_0xa703('0x17')]=qs[_0xa703('0x17')](_0x42eed8[_0xa703('0x3e')][_0xa703('0x17')]);_0x158293[_0xa703('0x19')]=qs['offset'](_0x42eed8[_0xa703('0x3e')]['offset']);}return _0x1ad963[_0xa703('0xde')](_0x158293);}})[_0xa703('0x1d')](function(_0x58c9c3){if(_0x58c9c3){return _0x58c9c3?{'count':_0x5b65fc,'rows':_0x58c9c3}:null;}})[_0xa703('0x1d')](respondWithResult(_0x52200f,null))[_0xa703('0x50')](handleError(_0x52200f,null));};exports['getWhatsappInteractions']=function(_0x4c49d3,_0x2d313f){var _0x4bf608={};var _0x157852={};var _0xd22768;var _0x4f3cdd;return db[_0xa703('0x3d')][_0xa703('0x8d')]({'where':{'id':_0x4c49d3['params']['id']}})['then'](handleEntityNotFound(_0x2d313f,null))['then'](function(_0x3a8004){if(_0x3a8004){_0xd22768=_0x3a8004;_0x157852[_0xa703('0xc7')]=_[_0xa703('0xd1')](db['WhatsappInteraction']['rawAttributes']);_0x157852['query']=_[_0xa703('0xd1')](_0x4c49d3['query']);_0x157852['filters']=_[_0xa703('0xc6')](_0x157852[_0xa703('0xc7')],_0x157852['query']);_0x4bf608[_0xa703('0x43')]=_[_0xa703('0xc6')](_0x157852[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x4c49d3[_0xa703('0x3e')]['fields']));_0x4bf608['attributes']=_0x4bf608['attributes'][_0xa703('0x47')]?_0x4bf608[_0xa703('0x43')]:_0x157852['model'];_0x4bf608[_0xa703('0xc9')]=qs[_0xa703('0xca')](_0x4c49d3[_0xa703('0x3e')][_0xa703('0xca')]);_0x4bf608[_0xa703('0xcb')]=qs['filters'](_[_0xa703('0xcc')](_0x4c49d3[_0xa703('0x3e')],_0x157852[_0xa703('0xc5')]));if(_0x4c49d3[_0xa703('0x3e')][_0xa703('0x29')]){_0x4bf608[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x4bf608[_0xa703('0xcb')],{'$or':_['map'](_0x4bf608[_0xa703('0x43')],function(_0xf54803){var _0x346736={};_0x346736[_0xf54803]={'$like':'%'+_0x4c49d3[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x346736;})});}_0x4bf608=_[_0xa703('0xcd')]({},_0x4bf608,_0x4c49d3['options']);return _0xd22768['getWhatsappInteractions'](_0x4bf608);}})['then'](function(_0x3c2174){if(_0x3c2174){_0x4f3cdd=_0x3c2174[_0xa703('0x47')];if(!_0x4c49d3[_0xa703('0x3e')][_0xa703('0xbd')]('nolimit')){_0x4bf608[_0xa703('0x17')]=qs['limit'](_0x4c49d3['query'][_0xa703('0x17')]);_0x4bf608[_0xa703('0x19')]=qs[_0xa703('0x19')](_0x4c49d3[_0xa703('0x3e')][_0xa703('0x19')]);}return _0xd22768[_0xa703('0xe0')](_0x4bf608);}})[_0xa703('0x1d')](function(_0x482aca){if(_0x482aca){return _0x482aca?{'count':_0x4f3cdd,'rows':_0x482aca}:null;}})[_0xa703('0x1d')](respondWithResult(_0x2d313f,null))[_0xa703('0x50')](handleError(_0x2d313f,null));};exports[_0xa703('0xe1')]=function(_0x50ea8b,_0x40f257,_0x44a506){var _0xa4d717;var _0x490933;var _0xe911a0;var _0x8325c9=!_['isNil'](_0x50ea8b[_0xa703('0x56')]['id'])?_0x50ea8b[_0xa703('0x56')]['id']:!_['isNil'](_0x50ea8b[_0xa703('0x24')]['id'])?_0x50ea8b['user']['id']:null;return db[_0xa703('0x3d')][_0xa703('0x2c')]({'where':{'id':_0x8325c9,'role':{'$or':[_0xa703('0x78'),_0xa703('0x24'),_0xa703('0x26')]}},'attributes':['id',_0xa703('0x2d'),_0xa703('0xe2'),_0xa703('0xe3'),_0xa703('0x1e'),'internal',_0xa703('0x93')]})[_0xa703('0x1d')](function(_0x1077a8){if(_0x1077a8){if(_0x1077a8[_0xa703('0x1e')]===_0xa703('0x26')){_0xa4d717=_0x1077a8;if(_0x50ea8b[_0xa703('0x55')][_0xa703('0x9e')]){_0xe911a0=util['format'](_0xa703('0xe4'),_0xa4d717[_0x50ea8b[_0xa703('0x55')]['interface']]);}else if(_0x50ea8b[_0xa703('0x55')][_0xa703('0xe5')]){_0xe911a0=util['format'](_0xa703('0x9d'),_0x50ea8b[_0xa703('0x55')][_0xa703('0xe5')]);}else{_0xe911a0=util[_0xa703('0x9c')](_0xa703('0x9d'),_0xa4d717[_0xa703('0x2d')]);}socket['to'](util['format']('user:%s',_0xa4d717[_0xa703('0x2d')]))[_0xa703('0x1f')](_0xa703('0xe6'),{'user':{'id':_0xa4d717['id'],'name':_0xa4d717[_0xa703('0x2d')]},'ip':_0x50ea8b[_0xa703('0xe7')][_0xa703('0xe8')]||_0x50ea8b[_0xa703('0xe9')][_0xa703('0xea')]||_0x50ea8b['socket'][_0xa703('0xea')]||_0x50ea8b[_0xa703('0xe9')][_0xa703('0xeb')]['remoteAddress']});return db[_0xa703('0x9f')]['destroy']({'where':{'membername':_0xa4d717[_0xa703('0x2d')]},'individualHooks':!![]});}}else{throw new db[(_0xa703('0x88'))][(_0xa703('0x89'))](_0xa703('0xec'));}})[_0xa703('0x1d')](function(){if(_0xa4d717){return _0xa4d717[_0xa703('0xed')]({'raw':!![]});}})[_0xa703('0x1d')](function(_0x1638c6){if(_0xa4d717){if(_0x1638c6){_0x490933=_0x1638c6;if(_0x490933['length']){var _0xa034b4=_0x490933[_0xa703('0x32')](function(_0xea2c2){var _0x2b214e={'membername':_0xa4d717[_0xa703('0x2d')],'UserId':_0xa4d717['id'],'queue_name':_0xea2c2[_0xa703('0x2d')],'VoiceQueueId':_0xea2c2['id'],'interface':_0xe911a0,'paused':_0xa4d717['loginInPause']||![],'penalty':_0xea2c2[_0xa703('0xee')]||0x0};return db[_0xa703('0x9f')][_0xa703('0xa0')](_0x2b214e);});return Promise[_0xa703('0x4f')](_0xa034b4);}}}})[_0xa703('0x1d')](function(){if(_0xa4d717){return db[_0xa703('0xef')][_0xa703('0x44')]({'where':{'membername':_0xa4d717['name'],'exitAt':null}});}})[_0xa703('0x1d')](function(_0x413b79){if(_0xa4d717){var _0x2230a3=[];_0x413b79[_0xa703('0xf0')](function(_0x4930b9){_0x2230a3[_0xa703('0x48')](_0x4930b9[_0xa703('0x1c')]({'exitAt':moment()[_0xa703('0x9c')](_0xa703('0xf1'))}));});return Promise[_0xa703('0x4f')](_0x2230a3);}})[_0xa703('0x1d')](function(){if(_0xa4d717){var _0x417ca2=[];var _0x998d3d=[];var _0x3f1b83=utils['getChannels']();var _0x19a7ac={'membername':_0xa4d717[_0xa703('0x2d')],'interface':_0xe911a0,'enterAt':moment()[_0xa703('0x9c')](_0xa703('0xf1')),'role':_0xa4d717[_0xa703('0x1e')],'internal':_0xa4d717['internal']};_0x3f1b83[_0xa703('0xf0')](function(_0x1fb7ec){_0x417ca2[_0xa703('0x48')](_[_0xa703('0xcd')]({'channel':_0x1fb7ec,'type':_0xa703('0xf2'),'data1':_0x50ea8b[_0xa703('0x55')][_0xa703('0xf3')],'data2':_0xe911a0},_0x19a7ac));if(_0xa4d717['loginInPause']){_0x998d3d['push'](_[_0xa703('0xcd')]({'channel':_0x1fb7ec,'type':_0xa703('0xf4'),'data1':'LOGININPAUSE'},_0x19a7ac));}});return db['MemberReport'][_0xa703('0x81')](_0x417ca2[_0xa703('0xf5')](_0x998d3d),{'individualHooks':!![]});}})[_0xa703('0x1d')](function(){if(_0xa4d717){return _0xa4d717[_0xa703('0x1c')]({'online':!![],'lastLoginAt':moment()['format'](_0xa703('0xf1')),'voicePause':_0xa4d717['loginInPause']||![],'mailPause':_0xa4d717[_0xa703('0x93')]||![],'chatPause':_0xa4d717['loginInPause']||![],'faxPause':_0xa4d717[_0xa703('0x93')]||![],'smsPause':_0xa4d717[_0xa703('0x93')]||![],'openchannelPause':_0xa4d717[_0xa703('0x93')]||![],'whatsappPause':_0xa4d717[_0xa703('0x93')]||![],'pauseType':_0xa4d717['loginInPause']?_0xa703('0xf6'):null,'interface':_0xe911a0,'lastPauseAt':moment()[_0xa703('0x9c')](_0xa703('0xf1'))});}})[_0xa703('0x1d')](function(_0x317a4f){if(_0x50ea8b[_0xa703('0xf7')]){return _0x44a506();}else{return Promise[_0xa703('0xf8')](_0x317a4f)[_0xa703('0x1d')](respondWithResult(_0x40f257,null));}})[_0xa703('0x50')](handleError(_0x40f257,null));};exports['logout']=function(_0x173639,_0x3cf388){var _0xa20b82;return db[_0xa703('0x3d')][_0xa703('0x2c')]({'where':{'id':_0x173639[_0xa703('0x56')]['id'],'role':_0xa703('0x26')},'attributes':['id','name',_0xa703('0x1e')]})[_0xa703('0x1d')](handleEntityNotFound(_0x3cf388,null))[_0xa703('0x1d')](function(_0x5a778b){if(_0x5a778b){_0xa20b82=_0x5a778b;return db[_0xa703('0x9f')][_0xa703('0x21')]({'where':{'membername':_0xa20b82[_0xa703('0x2d')]},'individualHooks':!![]});}})['then'](function(){return db[_0xa703('0xef')]['findAll']({'where':{'membername':_0xa20b82['name'],'exitAt':null}});})[_0xa703('0x1d')](function(_0x463c37){var _0x3d8cd2=[];_0x463c37[_0xa703('0xf0')](function(_0x2ef1b0){_0x3d8cd2['push'](_0x2ef1b0['update']({'exitAt':moment()[_0xa703('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xa703('0x4f')](_0x3d8cd2);})[_0xa703('0x1d')](function(){return _0xa20b82[_0xa703('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa703('0x1d')](respondWithResult(_0x3cf388,null))[_0xa703('0x50')](handleError(_0x3cf388,null));};exports[_0xa703('0xf9')]=function(_0x39cb6d,_0x4090df){var _0xe70b3c;return db[_0xa703('0x9f')][_0xa703('0x1c')]({'paused':0x1},{'where':{'UserId':_0x39cb6d[_0xa703('0x56')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0xa703('0x2c')]({'where':{'id':_0x39cb6d['params']['id'],'role':_0xa703('0x26')},'attributes':['id',_0xa703('0x2d'),_0xa703('0x1e'),_0xa703('0x5b'),_0xa703('0x9e'),_0xa703('0xfa')]});})[_0xa703('0x1d')](handleEntityNotFound(_0x4090df,null))[_0xa703('0x1d')](function(_0x49986a){if(_0x49986a){_0xe70b3c=_0x49986a;return db[_0xa703('0xef')][_0xa703('0x44')]({'where':{'membername':_0xe70b3c[_0xa703('0x2d')],'type':_0xa703('0xf4'),'exitAt':null}});}})[_0xa703('0x1d')](function(_0x373453){if(_0x373453['length']){var _0x14f480=moment()['format'](_0xa703('0xf1'));for(var _0x2dbf09=0x0,_0x533788=_0x373453[_0xa703('0x47')];_0x2dbf09<_0x533788;_0x2dbf09++){_0x373453[_0x2dbf09][_0xa703('0xfb')]({'exitAt':_0x14f480});}}})[_0xa703('0x1d')](function(){var _0x54b7df=[];var _0x3aca61=utils[_0xa703('0xfc')]();_0x3aca61['forEach'](function(_0x222e33){_0x54b7df[_0xa703('0x48')]({'channel':_0x222e33,'membername':_0xe70b3c[_0xa703('0x2d')],'interface':_['isNil'](_0xe70b3c['interface'])?util['format'](_0xa703('0x9d'),_0xe70b3c['name']):_0xe70b3c[_0xa703('0x9e')],'type':'PAUSE','enterAt':moment()[_0xa703('0x9c')](_0xa703('0xf1')),'data1':_0x39cb6d['body'][_0xa703('0x34')]||'DEFAULT\x20PAUSE','role':_0xe70b3c[_0xa703('0x1e')],'internal':_0xe70b3c[_0xa703('0x5b')]});});return db[_0xa703('0xef')][_0xa703('0x81')](_0x54b7df,{'individualHooks':!![]});})[_0xa703('0x1d')](function(){return _0xe70b3c[_0xa703('0x1c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x39cb6d[_0xa703('0x55')][_0xa703('0x34')]||_0xa703('0xfd'),'lastPauseAt':moment()['format'](_0xa703('0xf1'))});})[_0xa703('0x1d')](respondWithResult(_0x4090df,null))['catch'](handleError(_0x4090df,null));};exports[_0xa703('0xfe')]=function(_0x50c489,_0x5ddea0){if(_0x50c489['body'][_0xa703('0x92')]&&!utils[_0xa703('0x94')](_0x50c489['body']['channel'])){throw new APIBadRequestError(util[_0xa703('0x9c')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x50c489[_0xa703('0x55')][_0xa703('0x92')]));}return db[_0xa703('0x3d')][_0xa703('0x2c')]({'where':{'id':_0x50c489['params']['id']},'attributes':['id',_0xa703('0x2d'),_0xa703('0x1e'),_0xa703('0x5b'),_0xa703('0x9e'),'online',_0xa703('0xff'),_0xa703('0x100'),_0xa703('0x101'),_0xa703('0x102'),_0xa703('0x103'),_0xa703('0x104'),_0xa703('0x105'),_0xa703('0x106'),_0xa703('0x107')]})[_0xa703('0x1d')](function(_0x577880){if(!_0x577880){throw new APINotFoundError(util[_0xa703('0x9c')]('User\x20with\x20id\x20%s\x20not\x20found',_0x50c489[_0xa703('0x56')]['id']));}return _0x577880[_0xa703('0xfe')](_0x50c489['body'][_0xa703('0x92')]);})[_0xa703('0x1d')](respondWithResult(_0x5ddea0,null))[_0xa703('0x50')](APIHandleError(_0x5ddea0));};exports[_0xa703('0x108')]=function(_0x2ecafe,_0x4424aa){var _0x36ba54={};var _0x1f5107={};var _0x40f5e6;var _0x5d7d5f;return db['User'][_0xa703('0x8d')]({'where':{'id':_0x2ecafe['params']['id']}})['then'](handleEntityNotFound(_0x4424aa,null))[_0xa703('0x1d')](function(_0x1ff808){if(_0x1ff808){_0x40f5e6=_0x1ff808;_0x1f5107[_0xa703('0xc7')]=_[_0xa703('0xd1')](db[_0xa703('0x109')][_0xa703('0x31')]);_0x1f5107['query']=_[_0xa703('0xd1')](_0x2ecafe[_0xa703('0x3e')]);_0x1f5107[_0xa703('0xc5')]=_['intersection'](_0x1f5107[_0xa703('0xc7')],_0x1f5107[_0xa703('0x3e')]);_0x36ba54[_0xa703('0x43')]=_['intersection'](_0x1f5107[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x2ecafe[_0xa703('0x3e')][_0xa703('0xc8')]));_0x36ba54[_0xa703('0x43')]=_0x36ba54['attributes'][_0xa703('0x47')]?_0x36ba54[_0xa703('0x43')]:_0x1f5107['model'];_0x36ba54[_0xa703('0xc9')]=qs['sort'](_0x2ecafe[_0xa703('0x3e')][_0xa703('0xca')]);_0x36ba54['where']=qs['filters'](_['pick'](_0x2ecafe[_0xa703('0x3e')],_0x1f5107['filters']));if(_0x2ecafe['query']['filter']){_0x36ba54[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x36ba54['where'],{'$or':_[_0xa703('0x32')](_0x36ba54[_0xa703('0x43')],function(_0x4d083d){var _0x51d0a4={};_0x51d0a4[_0x4d083d]={'$like':'%'+_0x2ecafe['query'][_0xa703('0x29')]+'%'};return _0x51d0a4;})});}_0x36ba54=_['merge']({},_0x36ba54,_0x2ecafe[_0xa703('0x52')]);return _0x40f5e6['getTeams'](_0x36ba54);}})[_0xa703('0x1d')](function(_0x2fa1ed){if(_0x2fa1ed){_0x5d7d5f=_0x2fa1ed[_0xa703('0x47')];if(!_0x2ecafe[_0xa703('0x3e')][_0xa703('0xbd')](_0xa703('0xcf'))){_0x36ba54['limit']=qs[_0xa703('0x17')](_0x2ecafe[_0xa703('0x3e')][_0xa703('0x17')]);_0x36ba54['offset']=qs['offset'](_0x2ecafe['query'][_0xa703('0x19')]);}return _0x40f5e6[_0xa703('0x108')](_0x36ba54);}})['then'](function(_0x14169a){if(_0x14169a){return _0x14169a?{'count':_0x5d7d5f,'rows':_0x14169a}:null;}})[_0xa703('0x1d')](respondWithResult(_0x4424aa,null))[_0xa703('0x50')](handleError(_0x4424aa,null));};exports['addTeams']=function(_0x358929,_0x35c8d7){var _0x572a35=_0x358929[_0xa703('0x56')]['id'];var _0x37f37e=_0x358929['body']?_0x358929['body'][_0xa703('0x59')]:null;var _0x1c373b=[];return Promise[_0xa703('0xf8')]()[_0xa703('0x1d')](function(){if(!_0x37f37e)throw new APIBadRequestError(_0xa703('0x10a'));})[_0xa703('0x1d')](function(){return db['User'][_0xa703('0x8d')]({'where':{'id':_0x572a35}});})['then'](function(_0x2b0107){if(!_0x2b0107)throw new APINotFoundError(util['format'](_0xa703('0xbc'),_0x358929[_0xa703('0x56')]['id']));return db[_0xa703('0x61')][_0xa703('0x10b')](function(_0x26f3a6){return _0x2b0107[_0xa703('0x10c')](_0x37f37e,{'transaction':_0x26f3a6})[_0xa703('0x1d')](function(){return db[_0xa703('0x109')][_0xa703('0x44')]({'where':{'id':{'$in':_0x37f37e}}});})['then'](function(_0x4663bd){var _0x178f41=_[_0xa703('0x32')](_0x4663bd,function(_0x2b6e26){return _0x2b6e26[_0xa703('0x10d')]();});return Promise[_0xa703('0x4f')](_0x178f41);})['then'](function(_0x2a801e){_0x1c373b=_['flattenDeep'](_0x2a801e);var _0x51b5de=_[_0xa703('0x32')](_0x1c373b,function(_0x8a047){return _0x8a047['addAgent'](_0x2b0107['id'],{'transaction':_0x26f3a6});});return Promise[_0xa703('0x4f')](_0x51b5de);})[_0xa703('0x1d')](function(){if(!_0x2b0107[_0xa703('0xfa')])return;var _0x596f91=_[_0xa703('0x29')](_0x1c373b,function(_0x5795fb){return _0x5795fb[_0xa703('0x10e')]('channel')===_0xa703('0x10f');});var _0x306b65=_[_0xa703('0x32')](_0x596f91,function(_0x2a6f84){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2b0107[_0xa703('0x2d')],'UserId':_0x2b0107['id'],'queue_name':_0x2a6f84[_0xa703('0x2d')],'VoiceQueueId':_0x2a6f84['id'],'interface':_['isNil'](_0x2b0107['interface'])?util[_0xa703('0x9c')](_0xa703('0x9d'),_0x2b0107[_0xa703('0x2d')]):_0x2b0107['interface'],'paused':_0x2b0107['voicePause']||![],'penalty':_0x2b0107[_0xa703('0x110')]},{'transaction':_0x26f3a6});});return Promise[_0xa703('0x4f')](_0x306b65);})['then'](function(){return db[_0xa703('0x111')]['findAll']({'where':{'teamId':{'$in':_0x37f37e}}});})[_0xa703('0x1d')](function(_0x54352d){var _0x31c30f=_['map'](_0x54352d,function(_0x2cf711){return db['UserVoicePrefix'][_0xa703('0x7c')]({'UserId':_0x2b0107['id'],'VoicePrefixId':_0x2cf711[_0xa703('0x112')]},{'transaction':_0x26f3a6});});return Promise[_0xa703('0x4f')](_0x31c30f);});});})[_0xa703('0x1d')](function(){for(var _0x569b65=0x0;_0x569b65<_0x1c373b[_0xa703('0x47')];_0x569b65++){var _0x51f734=_0x1c373b[_0x569b65]['getDataValue'](_0xa703('0x92'));var _0x470043=_0x51f734+_0xa703('0x99');socket[_0xa703('0x1f')](_0xa703('0x24')+_0x51f734+_0xa703('0x113'),{'UserId':_0x572a35,['queueField']:_0x1c373b[_0x569b65]['id']});}})['then'](respondWithStatusCode(_0x35c8d7,null))[_0xa703('0x50')](APIHandleError(_0x35c8d7));};exports[_0xa703('0x114')]=function(_0x475b34,_0x477afe){var _0x5d7ac3=_0x475b34[_0xa703('0x56')]['id'];var _0x20dc7f=null;if(_0x475b34[_0xa703('0x3e')][_0xa703('0x59')]){_0x20dc7f=_[_0xa703('0xa4')](_0x475b34[_0xa703('0x3e')]['ids'])?_0x475b34[_0xa703('0x3e')]['ids']:[_0x475b34['query'][_0xa703('0x59')]];}var _0x2a7af2=[];return Promise['resolve']()[_0xa703('0x1d')](function(){if(!_0x20dc7f)throw new APIBadRequestError(_0xa703('0x115'));})[_0xa703('0x1d')](function(){return db['User']['findOne']({'where':{'id':_0x5d7ac3}});})[_0xa703('0x1d')](function(_0x5a6db7){if(!_0x5a6db7)throw new APINotFoundError(util[_0xa703('0x9c')](_0xa703('0xbc'),_0x475b34[_0xa703('0x56')]['id']));return db['sequelize']['transaction'](function(_0x25d34f){return _0x5a6db7[_0xa703('0x114')](_0x20dc7f,{'transaction':_0x25d34f})[_0xa703('0x1d')](function(){return db['Team'][_0xa703('0x44')]({'where':{'id':{'$in':_0x20dc7f}}});})[_0xa703('0x1d')](function(_0x5a9362){var _0xcb471a=_[_0xa703('0x32')](_0x5a9362,function(_0x2bc9d6){return _0x2bc9d6[_0xa703('0x10d')]();});return Promise[_0xa703('0x4f')](_0xcb471a);})[_0xa703('0x1d')](function(_0xbf78b5){_0x2a7af2=_['flattenDeep'](_0xbf78b5);var _0x494fdd=_['map'](_0x2a7af2,function(_0x4bd7b0){return _0x4bd7b0[_0xa703('0x116')](_0x5a6db7['id'],{'transaction':_0x25d34f});});return Promise['all'](_0x494fdd);})[_0xa703('0x1d')](function(){if(!_0x5a6db7[_0xa703('0xfa')])return;var _0x25c011=_[_0xa703('0x29')](_0x2a7af2,function(_0x3a5449){return _0x3a5449[_0xa703('0x10e')](_0xa703('0x92'))===_0xa703('0x10f');});var _0x537ae5=_[_0xa703('0x32')](_0x25c011,function(_0x4e024f){return db[_0xa703('0x9f')]['destroy']({'where':{'VoiceQueueId':_0x4e024f['id'],'UserId':_0x5a6db7['id']},'transaction':_0x25d34f});});return Promise[_0xa703('0x4f')](_0x537ae5);})[_0xa703('0x1d')](function(){return db[_0xa703('0x111')][_0xa703('0x44')]({'where':{'teamId':{'$in':_0x20dc7f}}});})[_0xa703('0x1d')](function(_0x1c16ee){var _0xc299a5=_[_0xa703('0x32')](_0x1c16ee,function(_0x23dc9e){return db[_0xa703('0x117')][_0xa703('0x21')]({'where':{'UserId':_0x5a6db7['id'],'VoicePrefixId':_0x23dc9e[_0xa703('0x112')]}},{'transaction':_0x25d34f});});return Promise[_0xa703('0x4f')](_0xc299a5);});});})['then'](function(){for(var _0x4695df=0x0;_0x4695df<_0x2a7af2['length'];_0x4695df++){var _0x1e5d22=_0x2a7af2[_0x4695df][_0xa703('0x10e')]('channel');var _0x421b47=_0x1e5d22+_0xa703('0x99');socket['emit'](_0xa703('0x24')+_0x1e5d22+_0xa703('0xa5'),{'UserId':_0x5d7ac3,['queueField']:_0x2a7af2[_0x4695df]['id']});}})[_0xa703('0x1d')](respondWithStatusCode(_0x477afe,null))['catch'](APIHandleError(_0x477afe));};exports['getLists']=function(_0x1c144e,_0x572a82){var _0x1e0226={};var _0x36eb7a={};var _0x4735b9;var _0x26d81f;return db[_0xa703('0x3d')]['findOne']({'where':{'id':_0x1c144e[_0xa703('0x56')]['id']}})['then'](handleEntityNotFound(_0x572a82,null))['then'](function(_0x4ee0f8){if(_0x4ee0f8){_0x4735b9=_0x4ee0f8;_0x36eb7a[_0xa703('0xc7')]=_[_0xa703('0xd1')](db['CmList'][_0xa703('0x31')]);_0x36eb7a[_0xa703('0x3e')]=_[_0xa703('0xd1')](_0x1c144e['query']);_0x36eb7a['filters']=_[_0xa703('0xc6')](_0x36eb7a[_0xa703('0xc7')],_0x36eb7a[_0xa703('0x3e')]);_0x1e0226[_0xa703('0x43')]=_['intersection'](_0x36eb7a[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x1c144e['query'][_0xa703('0xc8')]));_0x1e0226[_0xa703('0x43')]=_0x1e0226[_0xa703('0x43')][_0xa703('0x47')]?_0x1e0226[_0xa703('0x43')]:_0x36eb7a[_0xa703('0xc7')];_0x1e0226['order']=qs[_0xa703('0xca')](_0x1c144e['query'][_0xa703('0xca')]);_0x1e0226[_0xa703('0xcb')]=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x1c144e[_0xa703('0x3e')],_0x36eb7a[_0xa703('0xc5')]));if(_0x1c144e['query']['filter']){_0x1e0226[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x1e0226['where'],{'$or':_[_0xa703('0x32')](_0x1e0226[_0xa703('0x43')],function(_0x438eef){var _0x1c1dd9={};_0x1c1dd9[_0x438eef]={'$like':'%'+_0x1c144e[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x1c1dd9;})});}_0x1e0226=_[_0xa703('0xcd')]({},_0x1e0226,_0x1c144e[_0xa703('0x52')]);return _0x4735b9[_0xa703('0x118')](_0x1e0226);}})['then'](function(_0x504246){if(_0x504246){_0x26d81f=_0x504246[_0xa703('0x47')];if(!_0x1c144e[_0xa703('0x3e')][_0xa703('0xbd')]('nolimit')){_0x1e0226['limit']=qs[_0xa703('0x17')](_0x1c144e[_0xa703('0x3e')]['limit']);_0x1e0226[_0xa703('0x19')]=qs[_0xa703('0x19')](_0x1c144e[_0xa703('0x3e')][_0xa703('0x19')]);}return _0x4735b9[_0xa703('0x118')](_0x1e0226);}})[_0xa703('0x1d')](function(_0x436347){if(_0x436347){return _0x436347?{'count':_0x26d81f,'rows':_0x436347}:null;}})['then'](respondWithResult(_0x572a82,null))[_0xa703('0x50')](handleError(_0x572a82,null));};exports[_0xa703('0x119')]=function(_0x4e25ce,_0x21ac53){var _0x96ef2f={};var _0x596e0a={};var _0xfcd06a;return db['User'][_0xa703('0x8d')]({'where':{'id':_0x4e25ce[_0xa703('0x56')]['id']}})[_0xa703('0x1d')](handleEntityNotFound(_0x21ac53,null))[_0xa703('0x1d')](function(_0x3170b8){if(_0x3170b8){_0xfcd06a=_0x3170b8;_0x596e0a[_0xa703('0xc7')]=_[_0xa703('0xd1')](db[_0xa703('0x3d')][_0xa703('0x31')]);_0x596e0a[_0xa703('0x3e')]=_[_0xa703('0xd1')](_0x4e25ce['query']);_0x596e0a['filters']=_['intersection'](_0x596e0a[_0xa703('0xc7')],_0x596e0a[_0xa703('0x3e')]);_0x96ef2f[_0xa703('0x43')]=_['intersection'](_0x596e0a[_0xa703('0xc7')],qs[_0xa703('0xc8')](_0x4e25ce[_0xa703('0x3e')][_0xa703('0xc8')]));_0x96ef2f[_0xa703('0x43')]=_0x96ef2f[_0xa703('0x43')][_0xa703('0x47')]?_0x96ef2f[_0xa703('0x43')]:_0x596e0a[_0xa703('0xc7')];_0x96ef2f[_0xa703('0xc9')]=qs[_0xa703('0xca')](_0x4e25ce[_0xa703('0x3e')][_0xa703('0xca')]);_0x96ef2f['where']=qs[_0xa703('0xc5')](_[_0xa703('0xcc')](_0x4e25ce[_0xa703('0x3e')],_0x596e0a[_0xa703('0xc5')]));if(_0x4e25ce[_0xa703('0x3e')]['filter']){_0x96ef2f[_0xa703('0xcb')]=_[_0xa703('0xcd')](_0x96ef2f[_0xa703('0xcb')],{'$or':_['map'](_0x96ef2f[_0xa703('0x43')],function(_0x56c3ff){var _0x116f4c={};_0x116f4c[_0x56c3ff]={'$like':'%'+_0x4e25ce[_0xa703('0x3e')][_0xa703('0x29')]+'%'};return _0x116f4c;})});}_0x96ef2f[_0xa703('0xc7')]=db[_0xa703('0x3d')];_0x96ef2f['as']=_0xa703('0x25');_0x96ef2f=_[_0xa703('0xcd')]({},_0x96ef2f,_0x4e25ce[_0xa703('0x52')]);return _0xfcd06a[_0xa703('0xed')]({'include':[_0x96ef2f]});}})['then'](function(_0x47635e){if(_0x47635e){var _0x243097={},_0x487348=[];for(var _0x2cc2a0=0x0;_0x2cc2a0<_0x47635e[_0xa703('0x47')];_0x2cc2a0+=0x1){for(var _0x16be7e=0x0,_0x213139;_0x16be7e<_0x47635e[_0x2cc2a0][_0xa703('0x25')][_0xa703('0x47')];_0x16be7e+=0x1){_0x213139=_0x47635e[_0x2cc2a0][_0xa703('0x25')][_0x16be7e][_0xa703('0x22')]({'plain':!![]});_0x243097[_0x213139['id']]=_0x213139;}}_0x243097=_['values'](_0x243097);for(var _0x44fdfd=qs[_0xa703('0x19')](_0x4e25ce[_0xa703('0x3e')][_0xa703('0x19')]);_0x44fdfd<_0x243097[_0xa703('0x47')]&&_0x487348[_0xa703('0x47')]=_0x19bf9a){_0x11abf8=_0x19bf9a;_0x7cec21=0xc8;}else{_0x7cec21=0xce;}_0x1f0ed6['status'](_0x7cec21);return _0x1f0ed6[_0x7347('0x1d')]('Content-Range',_0x1cc814+'-'+_0x11abf8+'/'+_0x19bf9a)[_0x7347('0x18')](_0x21f6b1);}return null;};}function saveUpdates(_0x4321be){return function(_0x3ac561){if(_0x3ac561){return _0x3ac561['update'](_0x4321be)[_0x7347('0x1e')](function(_0x19f2de){if(_0x19f2de['role']===_0x7347('0x1f')){socket[_0x7347('0x20')](_0x7347('0x21')+_0x19f2de['id'],_0x19f2de);}return _0x19f2de;});}return null;};}function removeEntity(_0x35931b,_0x19b6c5){return function(_0xbcef7a){if(_0xbcef7a){return _0xbcef7a[_0x7347('0x22')]({'transaction':_0x19b6c5})[_0x7347('0x1e')](function(){var _0x361507=_0xbcef7a[_0x7347('0x23')]({'plain':!![]});if(_0x361507['role']===_0x7347('0x24'))return;var _0xa21e0f=[{'name':_0x7347('0x25'),'value':_0x7347('0x26'),'ignore':!![]},{'name':_0x7347('0x27'),'value':_0x7347('0x1f'),'ignore':![]},{'name':_0x7347('0x28'),'value':_0x7347('0x29'),'ignore':![]}];var _0x51c946=_(_0xa21e0f)['filter'](_0x7347('0x2a'))['map'](_0x7347('0x2b'))[_0x7347('0x2b')]();if(_[_0x7347('0x2c')](_0x51c946,_0x361507[_0x7347('0x2d')])){return;}var _0x10a7c0=_[_0x7347('0x2e')](_0xa21e0f,[_0x7347('0x2b'),_0x361507[_0x7347('0x2d')]])[_0x7347('0x2f')];return db[_0x7347('0x30')][_0x7347('0x22')]({'where':{'type':_0x10a7c0,'resourceId':_0x361507['id']},'transaction':_0x19b6c5})[_0x7347('0x1e')](function(){return _0xbcef7a;});})[_0x7347('0x1e')](function(){_0x35931b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ca0e0){return function(_0x2d3e94){if(!_0x2d3e94){_0x5ca0e0[_0x7347('0x15')](0x194);}return _0x2d3e94;};}function handleError(_0x20fcd1,_0x2ef48d){_0x2ef48d=_0x2ef48d||0x1f4;return function(_0x3a4046){logger[_0x7347('0x31')](_0x3a4046['stack']);if(_0x3a4046[_0x7347('0x2f')]){delete _0x3a4046[_0x7347('0x2f')];}_0x20fcd1[_0x7347('0x16')](_0x2ef48d)['send'](_0x3a4046);};}function getUserAttributes(){return _(db[_0x7347('0x32')][_0x7347('0x33')])[_0x7347('0x34')](function(_0x2712da){return{'name':_0x2712da[_0x7347('0x35')],'type':_0x2712da[_0x7347('0x36')][_0x7347('0x37')]};})[_0x7347('0x38')](function(_0x16143a){return!['password',_0x7347('0x39'),_0x7347('0x3a'),'resetPasswordToken','resetPasswordExpires','md5secret'][_0x7347('0x2c')](_0x16143a[_0x7347('0x2f')]);})[_0x7347('0x2b')]();}exports[_0x7347('0x3b')]=function(_0x4a4294,_0x364646){var _0x83fc3c={},_0x1932bb={'count':0x0,'rows':[]};var _0x444553=getUserAttributes();_0x83fc3c=qs[_0x7347('0x3c')](_0x444553,_0x4a4294);var _0x4339bd={'where':_0x83fc3c[_0x7347('0x3d')]};return db[_0x7347('0x32')][_0x7347('0x1c')](_0x4339bd)[_0x7347('0x1e')](function(_0x392cef){_0x1932bb['count']=_0x392cef;if(_0x4a4294[_0x7347('0x3e')][_0x7347('0x3f')]){_0x83fc3c['include']=[{'all':!![]}];}if(_0x4a4294[_0x7347('0x3e')][_0x7347('0x40')]===_0x7347('0x41')){_0x83fc3c['include']=[{'model':db[_0x7347('0x42')],'as':_0x7347('0x40')}];}if(!_[_0x7347('0x2c')](_0x83fc3c[_0x7347('0x43')],'id')){_0x83fc3c[_0x7347('0x43')][_0x7347('0x44')]('id');}return db[_0x7347('0x32')][_0x7347('0x45')](_0x83fc3c);})['then'](function(_0x35d91c){_0x1932bb[_0x7347('0x46')]=_0x35d91c;if(_0x4a4294[_0x7347('0x3e')][_0x7347('0x47')]===_0x7347('0x41')){var _0x1a8b5f=[];for(var _0x405a58=0x0;_0x405a58<_0x1932bb[_0x7347('0x46')][_0x7347('0x48')];_0x405a58++){_0x1a8b5f[_0x7347('0x44')](get_open_tabs(_0x7347('0x49'),_0x1932bb['rows'][_0x405a58]['dataValues']));_0x1a8b5f[_0x7347('0x44')](get_open_tabs('sms',_0x1932bb['rows'][_0x405a58]['dataValues']));_0x1a8b5f['push'](get_open_tabs(_0x7347('0x4a'),_0x1932bb[_0x7347('0x46')][_0x405a58][_0x7347('0x4b')]));_0x1a8b5f['push'](get_open_tabs('mail',_0x1932bb[_0x7347('0x46')][_0x405a58][_0x7347('0x4b')]));_0x1a8b5f[_0x7347('0x44')](get_open_tabs(_0x7347('0x4c'),_0x1932bb['rows'][_0x405a58]['dataValues']));_0x1a8b5f['push'](get_open_tabs(_0x7347('0x4d'),_0x1932bb['rows'][_0x405a58][_0x7347('0x4b')]));}return Promise[_0x7347('0x4e')](_0x1a8b5f)['then'](function(){return _0x1932bb;});}else{return _0x1932bb;}})[_0x7347('0x1e')](respondWithFilteredResult(_0x364646,_0x83fc3c))[_0x7347('0x4f')](handleError(_0x364646,null));};exports['show']=function(_0x11f7ef,_0x24e51a){var _0x143e50=getUserAttributes();_0x11f7ef[_0x7347('0x3e')]['id']=_0x11f7ef['params']['id'];var _0x227dbf=qs[_0x7347('0x3c')](_0x143e50,_0x11f7ef);if(_0x11f7ef[_0x7347('0x3e')][_0x7347('0x3f')]){_0x227dbf['include']=[{'all':!![]}];}if(_0x11f7ef[_0x7347('0x3e')]['userSetting']===_0x7347('0x41')){_0x227dbf['include']=[{'model':db[_0x7347('0x42')],'as':'userSetting'}];}_0x227dbf=_[_0x7347('0x50')]({},_0x227dbf,_0x11f7ef[_0x7347('0x51')]);if(!_['includes'](_0x227dbf[_0x7347('0x43')],'id')){_0x227dbf[_0x7347('0x43')]['push']('id');}return db[_0x7347('0x32')]['find'](_0x227dbf)['then'](handleEntityNotFound(_0x24e51a,null))['then'](function(_0x391a77){var _0x214779=[];values=_0x391a77;if(_0x11f7ef['query'][_0x7347('0x47')]===_0x7347('0x41')){_0x214779[_0x7347('0x44')](get_open_tabs('chat',_0x391a77[_0x7347('0x4b')]));_0x214779[_0x7347('0x44')](get_open_tabs(_0x7347('0x52'),_0x391a77['dataValues']));_0x214779[_0x7347('0x44')](get_open_tabs(_0x7347('0x4c'),_0x391a77[_0x7347('0x4b')]));_0x214779[_0x7347('0x44')](get_open_tabs(_0x7347('0x4d'),_0x391a77[_0x7347('0x4b')]));_0x214779['push'](get_open_tabs(_0x7347('0x4a'),_0x391a77[_0x7347('0x4b')]));_0x214779[_0x7347('0x44')](get_open_tabs(_0x7347('0x53'),_0x391a77['dataValues']));return Promise['all'](_0x214779);}else{return values;}})[_0x7347('0x1e')](function(){return values;})[_0x7347('0x1e')](respondWithResult(_0x24e51a,null))[_0x7347('0x4f')](handleError(_0x24e51a,null));};exports[_0x7347('0x54')]=function(_0x17f581,_0x567dc9){if(_0x17f581[_0x7347('0x55')]['id']){delete _0x17f581[_0x7347('0x55')]['id'];}delete _0x17f581[_0x7347('0x55')][_0x7347('0x2d')];return db['User'][_0x7347('0x2e')]({'where':{'id':_0x17f581[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x567dc9,null))['then'](saveUpdates(_0x17f581[_0x7347('0x55')],null))['then'](respondWithResult(_0x567dc9,null))[_0x7347('0x4f')](handleError(_0x567dc9,null));};exports[_0x7347('0x57')]=function(_0x2d13ff,_0x2eb9b7){return db[_0x7347('0x32')][_0x7347('0x57')]()['then'](respondWithResult(_0x2eb9b7,null))[_0x7347('0x4f')](handleError(_0x2eb9b7,null));};exports[_0x7347('0x58')]=function(_0x5cb9f5,_0x31a4f8){return db[_0x7347('0x32')]['find']({'where':{'id':_0x5cb9f5[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x31a4f8,null))['then'](function(_0x404e48){if(_0x404e48){return _0x404e48[_0x7347('0x58')](_0x5cb9f5[_0x7347('0x55')][_0x7347('0x59')],_[_0x7347('0x5a')](_0x5cb9f5['body'],[_0x7347('0x59'),'id'])||{});}})[_0x7347('0x1e')](respondWithResult(_0x31a4f8,null))['catch'](handleError(_0x31a4f8,null));};function validateUser(_0x238310){return new Promise(function(_0x2dfd80,_0x60f491){if(_0x238310['internal'])return _0x2dfd80(_0x238310);return db['Setting'][_0x7347('0x5b')](0x1)['then'](function(_0x2f35f9){if(_0x2f35f9[_0x7347('0x5c')])authService['validatePasswordPattern'](_0x238310['password']);db[_0x7347('0x32')][_0x7347('0x5d')](_0x7347('0x5e'))['then'](function(_0x15ce0c){if(_[_0x7347('0x5f')](_0x15ce0c)){_0x238310[_0x7347('0x5e')]=_0x2f35f9['min_internal']||0x1;return;}if(_[_0x7347('0x5f')](_0x2f35f9[_0x7347('0x60')])||_0x2f35f9[_0x7347('0x60')]===_0x15ce0c){_0x238310[_0x7347('0x5e')]=_0x15ce0c+0x1;return;}if(_0x2f35f9['min_internal']>_0x15ce0c){_0x238310[_0x7347('0x5e')]=_0x2f35f9[_0x7347('0x60')];return;}return db[_0x7347('0x61')][_0x7347('0x3e')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x7347('0x61')]['QueryTypes'][_0x7347('0x62')]})[_0x7347('0x1e')](function(_0x213459){if(_0x213459&&_0x213459['length']){for(var _0x6dd7ff=0x0,_0x45833e=_0x213459[_0x7347('0x48')];_0x6dd7ff<_0x45833e&&_[_0x7347('0x5f')](_0x238310['internal']);_0x6dd7ff++){if(_0x2f35f9[_0x7347('0x60')]<=_0x213459[_0x6dd7ff]['from']){_0x238310[_0x7347('0x5e')]=_0x213459[_0x6dd7ff][_0x7347('0x63')];}else if(_0x2f35f9[_0x7347('0x60')]>_0x213459[_0x6dd7ff][_0x7347('0x63')]&&_0x2f35f9['min_internal']<=_0x213459[_0x6dd7ff]['to']){_0x238310[_0x7347('0x5e')]=_0x2f35f9[_0x7347('0x60')];}}}if(_[_0x7347('0x5f')](_0x238310[_0x7347('0x5e')])){_0x238310[_0x7347('0x5e')]=_0x15ce0c+0x1;}return _0x2dfd80(_0x238310);});});})[_0x7347('0x4f')](function(_0x285cab){_0x60f491(_0x285cab);});});}function updateUser(_0x5d5bc1){return new Promise(function(_0x37c48f,_0x4ce34c){try{if(_0x5d5bc1[_0x7347('0x64')]){_0x5d5bc1[_0x7347('0x65')]=_0x5d5bc1['internal'];_0x5d5bc1['VoiceMail']={'mailbox':_0x5d5bc1[_0x7347('0x5e')],'password':_0x5d5bc1[_0x7347('0x66')],'fullname':_0x5d5bc1[_0x7347('0x67')],'email':_0x5d5bc1[_0x7347('0x68')]};}if(_0x5d5bc1[_0x7347('0x2d')]===_0x7347('0x1f')){if(!_0x5d5bc1[_0x7347('0x69')])_0x5d5bc1[_0x7347('0x69')]=[_0x7347('0x6a'),_0x7347('0x6b'),_0x7347('0x6c'),'113',_0x7347('0x6d'),_0x7347('0x6e'),_0x7347('0x6f'),_0x7347('0x70'),_0x7347('0x71'),_0x7347('0x72'),'109',_0x7347('0x73'),_0x7347('0x74'),'114',_0x7347('0x75')];}_0x37c48f(_0x5d5bc1);}catch(_0x4510d9){_0x4ce34c(_0x4510d9);}});}exports['create']=function(_0x5a1741,_0x2c5f30){if(_0x5a1741['user'][_0x7347('0x2d')]==='agent')throw new Error(_0x7347('0x76'));if(_0x5a1741[_0x7347('0x55')][_0x7347('0x2d')]===_0x7347('0x26')&&_0x5a1741[_0x7347('0x26')][_0x7347('0x2d')]!==_0x7347('0x24')){throw new Error(_0x7347('0x77'));}if(_0x5a1741['body'][_0x7347('0x2d')]===_0x7347('0x24')&&_0x5a1741[_0x7347('0x26')]['role']!==_0x7347('0x24')){throw new Error(_0x7347('0x78'));}return licenseUtil[_0x7347('0x79')]([_0x5a1741['body']])[_0x7347('0x1e')](function(){return validateUser(_0x5a1741[_0x7347('0x55')]);})['then'](function(_0x42c092){return updateUser(_0x42c092)[_0x7347('0x1e')](function(_0x250903){if(_0x250903[_0x7347('0x2d')]==='admin'){_0x250903[_0x7347('0x7a')]=_0x5a1741[_0x7347('0x26')][_0x7347('0x7a')];delete _0x250903[_0x7347('0x7b')];}return _0x250903;});})[_0x7347('0x1e')](function(_0x7b241f){return db[_0x7347('0x32')]['create'](_0x7b241f,{'include':[{'model':db[_0x7347('0x7c')],'as':'VoiceMail'}]});})[_0x7347('0x1e')](function(_0x14c220){if(_0x5a1741[_0x7347('0x55')][_0x7347('0x2d')]==='user')return _0x14c220;if(_0x5a1741[_0x7347('0x26')]['role']!=='user')return _0x14c220;return db[_0x7347('0x7d')][_0x7347('0x2e')]({'where':{'name':_0x14c220[_0x7347('0x2d')]===_0x7347('0x1f')?_0x7347('0x27'):'Telephones','userProfileId':_0x5a1741[_0x7347('0x26')][_0x7347('0x7b')]},'raw':!![]})[_0x7347('0x1e')](function(_0x4097b1){if(!_0x4097b1||_0x4097b1['autoAssociation']!=0x0)return _0x14c220;return db[_0x7347('0x30')][_0x7347('0x7e')]({'name':_0x14c220[_0x7347('0x2f')],'resourceId':_0x14c220['id'],'type':_0x4097b1[_0x7347('0x2f')],'sectionId':_0x4097b1['id']},{})['then'](function(){return _0x14c220;});})['catch'](function(_0x7e0a9b){logger[_0x7347('0x31')](_0x7347('0x7f'),_0x7e0a9b);throw _0x7e0a9b;});})[_0x7347('0x1e')](respondWithResult(_0x2c5f30,0xc9))[_0x7347('0x4f')](handleError(_0x2c5f30,null));};exports['bulkCreate']=function(_0x71c7c7,_0x5d6910){var _0x5cc104=_0x71c7c7[_0x7347('0x55')];var _0x33ac53=[];if(_0x71c7c7[_0x7347('0x26')]['role']===_0x7347('0x1f'))throw new Error(_0x7347('0x76'));if(_[_0x7347('0x80')](_0x5cc104,[_0x7347('0x2d'),_0x7347('0x26')])&&_0x71c7c7[_0x7347('0x26')][_0x7347('0x2d')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x7347('0x80')](_0x5cc104,[_0x7347('0x2d'),_0x7347('0x24')])&&_0x71c7c7[_0x7347('0x26')][_0x7347('0x2d')]!==_0x7347('0x24')){throw new Error(_0x7347('0x81'));}return licenseUtil[_0x7347('0x79')](_0x5cc104)[_0x7347('0x1e')](function(){return validateUser(_0x5cc104[0x0]);})[_0x7347('0x1e')](function(){for(var _0x2f53e5=0x1;_0x2f53e5<_0x5cc104[_0x7347('0x48')];_0x2f53e5++){var _0x483dfc=_0x5cc104[_0x2f53e5-0x1][_0x7347('0x5e')];if(!_0x5cc104[_0x2f53e5][_0x7347('0x5e')])_0x5cc104[_0x2f53e5][_0x7347('0x5e')]=_0x483dfc+0x1;_0x33ac53['push'](validateUser(_0x5cc104[_0x2f53e5]));}return Promise[_0x7347('0x4e')](_0x33ac53);})[_0x7347('0x1e')](function(){_0x33ac53=[];for(var _0x4693f6=0x0;_0x4693f6<_0x5cc104[_0x7347('0x48')];_0x4693f6++){_0x33ac53[_0x7347('0x44')](updateUser(_0x5cc104[_0x4693f6]));}return Promise[_0x7347('0x4e')](_0x33ac53);})[_0x7347('0x1e')](function(){_0x33ac53=_0x5cc104[_0x7347('0x34')](function(_0x4c4cdd){return db[_0x7347('0x32')][_0x7347('0x7e')](_0x4c4cdd,{'include':[{'model':db[_0x7347('0x7c')],'as':_0x7347('0x7c')}]})['then'](function(_0x5e8378){_0x4c4cdd['id']=_0x5e8378['id'];return _0x4c4cdd;});});return Promise[_0x7347('0x4e')](_0x33ac53);})[_0x7347('0x1e')](function(_0x43d892){if(_0x71c7c7[_0x7347('0x55')][_0x7347('0x2d')]===_0x7347('0x26'))return _0x43d892;if(_0x71c7c7['user'][_0x7347('0x2d')]!=='user')return _0x43d892;var _0x434b51=_[_0x7347('0x80')](_0x43d892,function(_0x5e2cec){return _0x5e2cec[_0x7347('0x2d')]===_0x7347('0x1f')||_0x5e2cec['role']===_0x7347('0x29');});if(!_0x434b51)return _0x43d892;return db[_0x7347('0x7d')][_0x7347('0x45')]({'where':{'name':{'$or':[_0x7347('0x27'),_0x7347('0x28')]},'userProfileId':_0x71c7c7[_0x7347('0x26')][_0x7347('0x7b')]},'raw':!![]})[_0x7347('0x1e')](function(_0x4d769a){if(_[_0x7347('0x82')](_0x4d769a)||!_[_0x7347('0x80')](_0x4d769a,[_0x7347('0x83'),0x0]))return _0x43d892;_0x33ac53=[];var _0x1faba2=_(_0x4d769a)[_0x7347('0x34')](function(_0x5f367a){if(_0x5f367a[_0x7347('0x83')]===0x1)return;return _0x5f367a['name']===_0x7347('0x27')?'agent':'telephone';})[_0x7347('0x84')]()[_0x7347('0x2b')]();for(var _0x92a7ab=0x0;_0x92a7ab<_0x43d892['length'];_0x92a7ab++){if(!_['includes'](_0x1faba2,_0x43d892[_0x92a7ab][_0x7347('0x2d')]))return;var _0x337e07=_0x43d892[_0x92a7ab][_0x7347('0x2d')]==='agent'?_0x7347('0x27'):_0x7347('0x28');_0x33ac53[_0x7347('0x44')](db['UserProfileResource']['create']({'name':_0x43d892[_0x92a7ab]['name'],'resourceId':_0x43d892[_0x92a7ab]['id'],'type':_0x337e07,'sectionId':_['find'](_0x4d769a,[_0x7347('0x2f'),_0x337e07])['id']},{}));}return Promise[_0x7347('0x4e')](_0x33ac53);});})['then'](respondWithResult(_0x5d6910,0xc9))['catch'](handleError(_0x5d6910,null));};exports[_0x7347('0x85')]=function(_0x1fdf68,_0x11b9ca){if(_0x1fdf68['body']['id']){delete _0x1fdf68[_0x7347('0x55')]['id'];}return db[_0x7347('0x32')][_0x7347('0x2e')]({'where':{'id':_0x1fdf68[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](function(_0x1a3f83){if(!_0x1a3f83)return null;if(_0x1a3f83['id']===_0x1fdf68['user']['id']){if(!_0x1fdf68[_0x7347('0x55')]['oldPassword']||!_0x1fdf68[_0x7347('0x55')]['newPassword']){throw new db[(_0x7347('0x86'))][(_0x7347('0x87'))](_0x7347('0x88'));}if(!_0x1a3f83[_0x7347('0x89')](_0x1fdf68[_0x7347('0x55')]['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0x7347('0x8a'));}if(_0x1fdf68[_0x7347('0x55')][_0x7347('0x8b')]===_0x1fdf68[_0x7347('0x55')][_0x7347('0x8c')]){throw new db[(_0x7347('0x86'))][(_0x7347('0x87'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x1fdf68[_0x7347('0x26')][_0x7347('0x2d')]==='admin'){if(!_0x1fdf68[_0x7347('0x55')][_0x7347('0x8c')]){throw new db[(_0x7347('0x86'))][(_0x7347('0x87'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1fdf68[_0x7347('0x26')][_0x7347('0x2d')]==='user'){if(!_0x1fdf68[_0x7347('0x55')][_0x7347('0x8c')]){throw new db[(_0x7347('0x86'))][(_0x7347('0x87'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1a3f83[_0x7347('0x2d')]!==_0x7347('0x1f')){throw new db[(_0x7347('0x86'))][(_0x7347('0x87'))](_0x7347('0x76'));}}else{throw new db[(_0x7347('0x86'))]['ValidationError']('Unauthorized');}return _0x1a3f83;})[_0x7347('0x1e')](handleEntityNotFound(_0x11b9ca,null))[_0x7347('0x1e')](function(_0x49a3c4){return db[_0x7347('0x8d')][_0x7347('0x8e')]({'attributes':['id',_0x7347('0x5c'),_0x7347('0x8f'),_0x7347('0x90')]})[_0x7347('0x1e')](function(_0x4b6962){if(_0x4b6962[_0x7347('0x5c')])authService['validatePasswordPattern'](_0x1fdf68[_0x7347('0x55')]['newPassword']);if(!_0x4b6962[_0x7347('0x8f')]||!_0x49a3c4['previousPasswords'])return _0x49a3c4;authService[_0x7347('0x91')](_0x1fdf68[_0x7347('0x55')]['newPassword'],_0x49a3c4[_0x7347('0x3a')],_0x4b6962[_0x7347('0x90')]);return _0x49a3c4;})['then'](saveUpdates({'password':_0x1fdf68['body'][_0x7347('0x8c')],'passwordResetAt':_0x1fdf68[_0x7347('0x26')]['id']==_0x1fdf68[_0x7347('0x56')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x1fdf68[_0x7347('0x55')][_0x7347('0x8c')],_0x49a3c4['previousPasswords'])},null));})['then'](respondWithResult(_0x11b9ca,null))['catch'](handleError(_0x11b9ca,null));};exports[_0x7347('0x92')]=function(_0x46d650,_0x2f2c7b){var _0x41eb92=_0x46d650[_0x7347('0x55')][_0x7347('0x93')];return db[_0x7347('0x32')]['find']({'where':{'id':_0x46d650[_0x7347('0x56')]['id']},'attributes':['id','name','role',_0x7347('0x94'),'loginInPause',_0x7347('0x95'),_0x7347('0x96')]})[_0x7347('0x1e')](handleEntityNotFound(_0x2f2c7b,null))['then'](function(_0x25d6bf){if(_0x25d6bf){if(!utils[_0x7347('0x97')](_0x41eb92)){throw new db['Sequelize'][(_0x7347('0x87'))](_0x7347('0x98'));}return _0x25d6bf['add'+_[_0x7347('0x99')](_0x41eb92['toLowerCase']())+_0x7347('0x9a')](_0x46d650[_0x7347('0x55')]['ids'],{'penalty':_0x46d650[_0x7347('0x55')][_0x7347('0x9b')]||0x0})['spread'](function(_0x4ec76a){for(var _0x2d584c=0x0;_0x2d584c<_0x46d650[_0x7347('0x55')][_0x7347('0x59')]['length'];_0x2d584c+=0x1){var _0x1512e7={'UserId':Number(_0x46d650[_0x7347('0x56')]['id'])};_0x1512e7[_[_0x7347('0x99')](_0x41eb92[_0x7347('0x9c')]())+'QueueId']=Number(_0x46d650[_0x7347('0x55')]['ids'][_0x2d584c]);socket[_0x7347('0x20')](_0x7347('0x26')+_[_0x7347('0x99')](_0x41eb92[_0x7347('0x9c')]())+'Queue:save',_0x1512e7);}return _0x4ec76a;})[_0x7347('0x1e')](function(){if(_0x41eb92===_0x7347('0x9d')){return db[_0x7347('0x9e')][_0x7347('0x45')]({'where':{'id':_0x46d650[_0x7347('0x55')][_0x7347('0x59')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x7347('0x1e')](function(_0x519bbb){var _0x14bc58=_0x25d6bf['get']({'plain':!![]});var _0x28b9c5=[];if(_0x41eb92==='voice'&&_0x14bc58[_0x7347('0x2d')]===_0x7347('0x1f')&&_0x14bc58[_0x7347('0x94')]){for(let _0xdb64be=0x0;_0xdb64be<_0x519bbb[_0x7347('0x48')];_0xdb64be+=0x1){_0x28b9c5[_0x7347('0x44')]({'membername':_0x14bc58[_0x7347('0x2f')],'UserId':_0x14bc58['id'],'queue_name':_0x519bbb[_0xdb64be]['name'],'VoiceQueueId':_0x519bbb[_0xdb64be]['id'],'interface':_['isNil'](_0x14bc58[_0x7347('0x96')])?util[_0x7347('0x9f')]('SIP/%s',_0x14bc58['name']):_0x14bc58[_0x7347('0x96')],'paused':_0x14bc58[_0x7347('0x95')]||![],'penalty':_0x46d650['body'][_0x7347('0x9b')]||0x0});}return Promise[_0x7347('0x4e')](_0x28b9c5[_0x7347('0x34')](function(_0x35327d){return db[_0x7347('0xa0')][_0x7347('0xa1')](_0x35327d);}));}return _0x25d6bf;});}})[_0x7347('0x1e')](respondWithStatusCode(_0x2f2c7b,null))[_0x7347('0x4f')](handleError(_0x2f2c7b,null));};exports[_0x7347('0xa2')]=function(_0x3013c6,_0x59a7da){var _0xe0c4c0,_0x586beb;return db[_0x7347('0x32')]['find']({'where':{'id':_0x3013c6['params']['id']},'attributes':['id',_0x7347('0x2f'),'role']})[_0x7347('0x1e')](handleEntityNotFound(_0x59a7da,null))[_0x7347('0x1e')](function(_0x3d4587){if(_0x3d4587){_0xe0c4c0=_0x3d4587;if(!_0x3013c6[_0x7347('0x3e')][_0x7347('0x93')]||!utils[_0x7347('0x97')](_0x3013c6[_0x7347('0x3e')][_0x7347('0x93')])){throw new db[(_0x7347('0x86'))][(_0x7347('0x87'))](_0x7347('0x98'));}return _0x3d4587[_0x7347('0xa3')+_[_0x7347('0x99')](_0x3013c6[_0x7347('0x3e')]['channel'][_0x7347('0x9c')]())+_0x7347('0x9a')](_0x3013c6[_0x7347('0x3e')][_0x7347('0x59')]);}})['then'](function(_0x7b6b3){if(_[_0x7347('0xa4')](_0x3013c6['query'][_0x7347('0x59')])){for(var _0x208560=0x0;_0x208560<_0x3013c6[_0x7347('0x3e')]['ids']['length'];_0x208560+=0x1){_0x586beb={'UserId':Number(_0x3013c6[_0x7347('0x56')]['id'])};_0x586beb[_['capitalize'](_0x3013c6[_0x7347('0x3e')][_0x7347('0x93')]['toLowerCase']())+_0x7347('0xa5')]=Number(_0x3013c6[_0x7347('0x3e')]['ids'][_0x208560]);socket[_0x7347('0x20')]('user'+_[_0x7347('0x99')](_0x3013c6[_0x7347('0x3e')][_0x7347('0x93')]['toLowerCase']())+'Queue:remove',_0x586beb);}}else{_0x586beb={'UserId':Number(_0x3013c6[_0x7347('0x56')]['id'])};_0x586beb[_['capitalize'](_0x3013c6[_0x7347('0x3e')]['channel'][_0x7347('0x9c')]())+_0x7347('0xa5')]=Number(_0x3013c6[_0x7347('0x3e')]['ids']);socket[_0x7347('0x20')]('user'+_['capitalize'](_0x3013c6['query'][_0x7347('0x93')]['toLowerCase']())+_0x7347('0xa6'),_0x586beb);}return _0x7b6b3;})[_0x7347('0x1e')](function(){if(_0x3013c6[_0x7347('0x3e')][_0x7347('0x93')]===_0x7347('0x9d')){return db[_0x7347('0xa0')][_0x7347('0x22')]({'where':{'UserId':_0x3013c6[_0x7347('0x56')]['id'],'VoiceQueueId':_0x3013c6['query'][_0x7347('0x59')]},'individualHooks':!![]})[_0x7347('0x1e')](function(){return _0xe0c4c0;});}return _0xe0c4c0;})[_0x7347('0x1e')](respondWithStatusCode(_0x59a7da,null))[_0x7347('0x4f')](handleError(_0x59a7da,null));};exports['addAvatar']=function(_0x77ba5e,_0x5377f2){_0x77ba5e[_0x7347('0x55')][_0x7347('0xa7')]=_0x77ba5e[_0x7347('0xa8')]['filename'];return db[_0x7347('0x32')]['find']({'where':{'id':_0x77ba5e['params']['id']}})['then'](handleEntityNotFound(_0x5377f2,null))[_0x7347('0x1e')](saveUpdates(_0x77ba5e[_0x7347('0x55')],null))[_0x7347('0x1e')](respondWithResult(_0x5377f2,null))['catch'](handleError(_0x5377f2,null));};exports[_0x7347('0xa9')]=function(_0x22aeb7,_0x482951){var _0x5a4ce8=path[_0x7347('0xaa')](config[_0x7347('0xab')],_0x7347('0xac'));return db['User']['find']({'where':{'id':_0x22aeb7['params']['id']},'attributes':['id',_0x7347('0xa7')],'raw':!![]})[_0x7347('0x1e')](handleEntityNotFound(_0x482951,null))['then'](function(_0x578474){if(_0x578474){if(_[_0x7347('0x5f')](_0x578474[_0x7347('0xa7')])){return _0x482951[_0x7347('0xad')](_0x5a4ce8);}else{if(!fs[_0x7347('0xae')](path['join'](config['root'],_0x7347('0xaf'),_0x578474[_0x7347('0xa7')]))){return _0x482951[_0x7347('0xad')](_0x5a4ce8);}return _0x482951[_0x7347('0xad')](path[_0x7347('0xaa')](config[_0x7347('0xab')],'server/files/images/',_0x578474[_0x7347('0xa7')]));}}})[_0x7347('0x4f')](handleError(_0x482951,null));};exports['getOpenTabs']=function(_0x13bcb5,_0x321940){return db['User']['find']({'where':{'id':_0x13bcb5[_0x7347('0x56')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x321940,null))[_0x7347('0x1e')](function(_0x3e3966){var _0x5a0cae=[];values=_0x3e3966[_0x7347('0x4b')];_0x5a0cae[_0x7347('0x44')](get_open_tabs('chat',_0x3e3966[_0x7347('0x4b')]));_0x5a0cae[_0x7347('0x44')](get_open_tabs(_0x7347('0x52'),_0x3e3966['dataValues']));_0x5a0cae[_0x7347('0x44')](get_open_tabs(_0x7347('0x4c'),_0x3e3966[_0x7347('0x4b')]));_0x5a0cae['push'](get_open_tabs(_0x7347('0x4d'),_0x3e3966[_0x7347('0x4b')]));_0x5a0cae[_0x7347('0x44')](get_open_tabs(_0x7347('0x4a'),_0x3e3966[_0x7347('0x4b')]));_0x5a0cae['push'](get_open_tabs(_0x7347('0x53'),_0x3e3966['dataValues']));return Promise['all'](_0x5a0cae);})['then'](function(_0x169055){if(_0x169055){var _0x2b1c7c=_[_0x7347('0x34')](values[_0x7347('0xb0')],function(_0x24384c){return{'channel':_0x7347('0xb1'),'id':_0x24384c['id'],'createdAt':_0x24384c['createdAt']};});var _0x17027e=_['map'](values[_0x7347('0xb2')],function(_0x7dae7f){return{'channel':_0x7347('0xb3'),'id':_0x7dae7f['id'],'createdAt':_0x7dae7f['createdAt']};});var _0xbc8910=_[_0x7347('0x34')](values[_0x7347('0xb4')],function(_0x38eb97){return{'channel':_0x7347('0xb5'),'id':_0x38eb97['id'],'createdAt':_0x38eb97[_0x7347('0xb6')]};});var _0x1f4236=_[_0x7347('0x34')](values[_0x7347('0xb7')],function(_0x6ea425){return{'channel':'MAIL','id':_0x6ea425['id'],'createdAt':_0x6ea425['createdAt']};});var _0x190be5=_['map'](values[_0x7347('0xb8')],function(_0x19080d){return{'channel':_0x7347('0xb9'),'id':_0x19080d['id'],'createdAt':_0x19080d[_0x7347('0xb6')]};});var _0x115785=_[_0x7347('0x34')](values[_0x7347('0xba')],function(_0x293f98){return{'channel':'WHATSAPP','id':_0x293f98['id'],'createdAt':_0x293f98[_0x7347('0xb6')]};});var _0x468c8f=_[_0x7347('0xbb')](_0x2b1c7c,_0x17027e,_0xbc8910,_0x1f4236,_0x190be5,_0x115785);var _0x140293={'count':_0x468c8f['length'],'rows':_0x468c8f};return _0x140293;}else return null;})[_0x7347('0x1e')](respondWithResult(_0x321940,null))[_0x7347('0x4f')](handleError(_0x321940,null));};exports[_0x7347('0xbc')]=function(_0x208a7f,_0x46c906){var _0x5dff4f={};return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0x208a7f[_0x7347('0x56')]['id']}})['then'](function(_0x48b98d){if(!_0x48b98d){throw new APINotFoundError(util['format'](_0x7347('0xbd'),_0x208a7f[_0x7347('0x56')]['id']));}return contacts[_0x7347('0x57')]();})[_0x7347('0x1e')](function(_0x52b0ef){_0x208a7f['query']['User']=_0x208a7f[_0x7347('0x56')]['id'];_0x5dff4f=qs[_0x7347('0x3c')](_0x52b0ef,_0x208a7f);if(_0x208a7f[_0x7347('0x3e')][_0x7347('0xbe')]('includeAll')){_0x5dff4f[_0x7347('0xbf')]=[{'model':db['CmList'],'as':_0x7347('0xc0'),'required':![]},{'model':db[_0x7347('0xc1')],'as':'Tags','attributes':['id','name',_0x7347('0xc2')],'where':_0x208a7f[_0x7347('0x3e')][_0x7347('0xc3')]?{'id':_0x208a7f['query'][_0x7347('0xc3')]}:undefined,'required':_0x208a7f['query']['tag']?!![]:![]}];}return contacts[_0x7347('0x45')](_0x208a7f[_0x7347('0x3e')],_0x208a7f[_0x7347('0x26')],_0x5dff4f,_0x52b0ef);})[_0x7347('0x1e')](respondWithFilteredResult(_0x46c906,_0x5dff4f))[_0x7347('0x4f')](APIHandleError(_0x46c906));};exports[_0x7347('0xc4')]=function(_0x354baa,_0x1ddfea){var _0x57d359;var _0x50beaa={};var _0xd66195;return db[_0x7347('0x32')]['findOne']({'where':{'id':_0x354baa[_0x7347('0x56')]['id']},'attributes':['id',_0x7347('0x2f'),'role']})['then'](handleEntityNotFound(_0x1ddfea,null))[_0x7347('0x1e')](function(_0x5cf323){if(!utils[_0x7347('0x97')](_0x354baa[_0x7347('0x3e')][_0x7347('0x93')])){throw new db[(_0x7347('0x86'))]['ValidationError']('Unknown\x20channel');}_0x57d359=_0x5cf323;var _0x3533b4={};_0x3533b4[_0x7347('0xc5')]=_['keys'](db[_[_0x7347('0x99')](_0x354baa[_0x7347('0x3e')]['channel'])+_0x7347('0xc6')][_0x7347('0x33')]);_0x3533b4[_0x7347('0x3e')]=_[_0x7347('0xc7')](_0x354baa['query']);_0x3533b4[_0x7347('0xc8')]=_['intersection'](_0x3533b4['model'],_0x3533b4[_0x7347('0x3e')]);_0x50beaa[_0x7347('0x43')]=_[_0x7347('0xc9')](_0x3533b4['model'],qs[_0x7347('0xca')](_0x354baa[_0x7347('0x3e')][_0x7347('0xca')]));_0x50beaa['attributes']=_0x50beaa[_0x7347('0x43')][_0x7347('0x48')]?_0x50beaa[_0x7347('0x43')]:_0x3533b4['model'];_0x50beaa[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x354baa[_0x7347('0x3e')][_0x7347('0xcc')]);_0x50beaa[_0x7347('0x3d')]=qs[_0x7347('0xc8')](_[_0x7347('0xcd')](_0x354baa[_0x7347('0x3e')],_0x3533b4['filters']));if(_0x354baa[_0x7347('0x3e')][_0x7347('0x38')]){_0x50beaa[_0x7347('0x3d')]=_['merge'](_0x50beaa[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x50beaa[_0x7347('0x43')],function(_0x51393d){var _0x38acf6={};_0x38acf6[_0x51393d]={'$like':'%'+_0x354baa['query'][_0x7347('0x38')]+'%'};return _0x38acf6;})});}_0x50beaa=_[_0x7347('0x50')]({},_0x50beaa,_0x354baa[_0x7347('0x51')]);switch(_0x57d359[_0x7347('0x2d')]){case _0x7347('0x24'):return db[_[_0x7347('0x99')](_0x354baa[_0x7347('0x3e')]['channel'])+_0x7347('0xc6')]['findAll'](_0x50beaa);case _0x7347('0x26'):case _0x7347('0x1f'):return _0x57d359[_0x7347('0x23')+_[_0x7347('0x99')](_0x354baa[_0x7347('0x3e')][_0x7347('0x93')])+_0x7347('0x9a')](_0x50beaa);default:throw new db[(_0x7347('0x86'))][(_0x7347('0x87'))](_0x7347('0xce'));}})[_0x7347('0x1e')](function(_0x260bf0){_0xd66195=_0x260bf0[_0x7347('0x48')];if(!_0x354baa[_0x7347('0x3e')][_0x7347('0xbe')](_0x7347('0xcf'))){_0x50beaa['limit']=qs['limit'](_0x354baa['query'][_0x7347('0x1b')]);_0x50beaa['offset']=qs['offset'](_0x354baa['query']['offset']);}switch(_0x57d359[_0x7347('0x2d')]){case _0x7347('0x24'):return db[_[_0x7347('0x99')](_0x354baa[_0x7347('0x3e')][_0x7347('0x93')])+'Queue']['findAll'](_0x50beaa);case'user':case _0x7347('0x1f'):return _0x57d359[_0x7347('0x23')+_[_0x7347('0x99')](_0x354baa[_0x7347('0x3e')][_0x7347('0x93')])+_0x7347('0x9a')](_0x50beaa);}})[_0x7347('0x1e')](function(_0x38f8f7){return{'count':_0xd66195,'rows':_0x38f8f7};})[_0x7347('0x1e')](respondWithResult(_0x1ddfea,null))['catch'](handleError(_0x1ddfea,null));};exports[_0x7347('0xd0')]=function(_0x337708,_0x340d46){var _0x41e316={};var _0x46060f={};var _0x55a69b;var _0x35c9c1;return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0x337708[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x340d46,null))[_0x7347('0x1e')](function(_0x2e1b84){if(_0x2e1b84){_0x55a69b=_0x2e1b84;_0x46060f['model']=_[_0x7347('0xc7')](db['UserVoiceQueueRt']['rawAttributes']);_0x46060f[_0x7347('0x3e')]=_[_0x7347('0xc7')](_0x337708[_0x7347('0x3e')]);_0x46060f[_0x7347('0xc8')]=_[_0x7347('0xc9')](_0x46060f[_0x7347('0xc5')],_0x46060f['query']);_0x41e316['attributes']=_[_0x7347('0xc9')](_0x46060f['model'],qs[_0x7347('0xca')](_0x337708[_0x7347('0x3e')][_0x7347('0xca')]));_0x41e316[_0x7347('0x43')]=_0x41e316[_0x7347('0x43')]['length']?_0x41e316[_0x7347('0x43')]:_0x46060f[_0x7347('0xc5')];_0x41e316['order']=qs[_0x7347('0xcc')](_0x337708[_0x7347('0x3e')][_0x7347('0xcc')]);_0x41e316[_0x7347('0x3d')]=qs['filters'](_[_0x7347('0xcd')](_0x337708[_0x7347('0x3e')],_0x46060f['filters']));if(_0x337708[_0x7347('0x3e')][_0x7347('0x38')]){_0x41e316[_0x7347('0x3d')]=_[_0x7347('0x50')](_0x41e316[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x41e316[_0x7347('0x43')],function(_0x3d5db1){var _0x1b945d={};_0x1b945d[_0x3d5db1]={'$like':'%'+_0x337708['query'][_0x7347('0x38')]+'%'};return _0x1b945d;})});}_0x41e316=_[_0x7347('0x50')]({},_0x41e316,_0x337708[_0x7347('0x51')]);return _0x55a69b[_0x7347('0xd0')](_0x41e316);}})[_0x7347('0x1e')](function(_0x5ccc81){if(_0x5ccc81){_0x35c9c1=_0x5ccc81[_0x7347('0x48')];if(!_0x337708[_0x7347('0x3e')][_0x7347('0xbe')](_0x7347('0xcf'))){_0x41e316[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x337708[_0x7347('0x3e')]['limit']);_0x41e316[_0x7347('0x19')]=qs[_0x7347('0x19')](_0x337708[_0x7347('0x3e')][_0x7347('0x19')]);}return _0x55a69b['getVoiceQueuesRt'](_0x41e316);}})[_0x7347('0x1e')](function(_0x3cc51e){if(_0x3cc51e){return _0x3cc51e?{'count':_0x35c9c1,'rows':_0x3cc51e}:null;}})[_0x7347('0x1e')](respondWithResult(_0x340d46,null))[_0x7347('0x4f')](handleError(_0x340d46,null));};exports[_0x7347('0xd1')]=function(_0x1e7495,_0x18a02c){var _0x22aef8={};var _0xede0cb={};var _0x2c5f3e;var _0xdb77e;return db['User'][_0x7347('0x8e')]({'where':{'id':_0x1e7495[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x18a02c,null))[_0x7347('0x1e')](function(_0x2a7e4a){if(_0x2a7e4a){_0x2c5f3e=_0x2a7e4a;_0xede0cb[_0x7347('0xc5')]=_['keys'](db[_0x7347('0xd2')][_0x7347('0x33')]);_0xede0cb[_0x7347('0x3e')]=_[_0x7347('0xc7')](_0x1e7495[_0x7347('0x3e')]);_0xede0cb[_0x7347('0xc8')]=_[_0x7347('0xc9')](_0xede0cb[_0x7347('0xc5')],_0xede0cb[_0x7347('0x3e')]);_0x22aef8[_0x7347('0x43')]=_['intersection'](_0xede0cb[_0x7347('0xc5')],qs[_0x7347('0xca')](_0x1e7495['query'][_0x7347('0xca')]));_0x22aef8[_0x7347('0x43')]=_0x22aef8[_0x7347('0x43')][_0x7347('0x48')]?_0x22aef8[_0x7347('0x43')]:_0xede0cb[_0x7347('0xc5')];_0x22aef8[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x1e7495['query'][_0x7347('0xcc')]);_0x22aef8[_0x7347('0x3d')]=qs['filters'](_[_0x7347('0xcd')](_0x1e7495[_0x7347('0x3e')],_0xede0cb[_0x7347('0xc8')]));if(_0x1e7495[_0x7347('0x3e')][_0x7347('0x38')]){_0x22aef8[_0x7347('0x3d')]=_['merge'](_0x22aef8[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x22aef8[_0x7347('0x43')],function(_0x593f51){var _0x1ef0a1={};_0x1ef0a1[_0x593f51]={'$like':'%'+_0x1e7495[_0x7347('0x3e')][_0x7347('0x38')]+'%'};return _0x1ef0a1;})});}_0x22aef8=_['merge']({},_0x22aef8,_0x1e7495[_0x7347('0x51')]);return _0x2c5f3e[_0x7347('0xd1')](_0x22aef8);}})[_0x7347('0x1e')](function(_0x2e01da){if(_0x2e01da){_0xdb77e=_0x2e01da[_0x7347('0x48')];if(!_0x1e7495[_0x7347('0x3e')][_0x7347('0xbe')]('nolimit')){_0x22aef8[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x1e7495[_0x7347('0x3e')][_0x7347('0x1b')]);_0x22aef8[_0x7347('0x19')]=qs[_0x7347('0x19')](_0x1e7495[_0x7347('0x3e')][_0x7347('0x19')]);}return _0x2c5f3e[_0x7347('0xd1')](_0x22aef8);}})[_0x7347('0x1e')](function(_0x3b31e9){if(_0x3b31e9){return _0x3b31e9?{'count':_0xdb77e,'rows':_0x3b31e9}:null;}})[_0x7347('0x1e')](respondWithResult(_0x18a02c,null))[_0x7347('0x4f')](handleError(_0x18a02c,null));};exports[_0x7347('0xd3')]=function(_0x1e6d86,_0x287bff){var _0x5ad066={'raw':!![],'where':{}};var _0x35c605={};var _0x4f5821={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x1e6d86[_0x7347('0x56')]['id']}})['then'](handleEntityNotFound(_0x287bff,null))[_0x7347('0x1e')](function(_0x227922){if(_0x227922){_0x35c605[_0x7347('0xc5')]=_[_0x7347('0xc7')](db[_0x7347('0xd4')][_0x7347('0x33')]);_0x35c605['query']=_['keys'](_0x1e6d86[_0x7347('0x3e')]);_0x35c605['filters']=_[_0x7347('0xc9')](_0x35c605['model'],_0x35c605[_0x7347('0x3e')]);_0x5ad066['attributes']=_[_0x7347('0xc9')](_0x35c605[_0x7347('0xc5')],qs[_0x7347('0xca')](_0x1e6d86[_0x7347('0x3e')][_0x7347('0xca')]));_0x5ad066[_0x7347('0x43')]=_0x5ad066[_0x7347('0x43')][_0x7347('0x48')]?_0x5ad066[_0x7347('0x43')]:_0x35c605['model'];if(!_0x1e6d86[_0x7347('0x3e')][_0x7347('0xbe')](_0x7347('0xcf'))){_0x5ad066[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x1e6d86[_0x7347('0x3e')]['limit']);_0x5ad066[_0x7347('0x19')]=qs['offset'](_0x1e6d86['query']['offset']);}_0x5ad066['order']=qs[_0x7347('0xcc')](_0x1e6d86[_0x7347('0x3e')]['sort']);_0x5ad066['where']=qs[_0x7347('0xc8')](_[_0x7347('0xcd')](_0x1e6d86[_0x7347('0x3e')],_0x35c605[_0x7347('0xc8')]));_0x5ad066['where'][_0x7347('0xd5')]=_0x227922['id'];if(_0x1e6d86[_0x7347('0x3e')]['filter']){_0x5ad066[_0x7347('0x3d')]=_[_0x7347('0x50')](_0x5ad066[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x5ad066[_0x7347('0x43')],function(_0xa388a5){var _0x394178={};_0x394178[_0xa388a5]={'$like':'%'+_0x1e6d86[_0x7347('0x3e')][_0x7347('0x38')]+'%'};return _0x394178;})});}_0x5ad066=_[_0x7347('0x50')]({},_0x5ad066,_0x1e6d86[_0x7347('0x51')]);return db[_0x7347('0xd4')][_0x7347('0x1c')]({'where':_0x5ad066['where']})[_0x7347('0x1e')](function(_0x211cf1){_0x4f5821[_0x7347('0x1c')]=_0x211cf1;if(_0x1e6d86[_0x7347('0x3e')][_0x7347('0x3f')]){_0x5ad066[_0x7347('0xbf')]=[{'all':!![]}];}return db['VoiceRecording'][_0x7347('0x45')](_0x5ad066);})[_0x7347('0x1e')](function(_0x45e27f){_0x4f5821[_0x7347('0x46')]=_0x45e27f;return _0x4f5821;});}})[_0x7347('0x1e')](respondWithFilteredResult(_0x287bff,_0x5ad066))[_0x7347('0x4f')](handleError(_0x287bff,null));};exports['getScreenRecordings']=function(_0x272292,_0xa0887f){var _0x164b18={'raw':!![],'where':{}};var _0x322002={};var _0x5cb001={'count':0x0,'rows':[]};return db[_0x7347('0x32')]['findOne']({'where':{'id':_0x272292['params']['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0xa0887f,null))['then'](function(_0xc1c9c1){if(_0xc1c9c1){_0x322002[_0x7347('0xc5')]=_[_0x7347('0xc7')](db[_0x7347('0xd6')][_0x7347('0x33')]);_0x322002[_0x7347('0x3e')]=_[_0x7347('0xc7')](_0x272292[_0x7347('0x3e')]);_0x322002[_0x7347('0xc8')]=_['intersection'](_0x322002[_0x7347('0xc5')],_0x322002[_0x7347('0x3e')]);_0x164b18[_0x7347('0x43')]=_['intersection'](_0x322002[_0x7347('0xc5')],qs[_0x7347('0xca')](_0x272292['query']['fields']));_0x164b18['attributes']=_0x164b18[_0x7347('0x43')][_0x7347('0x48')]?_0x164b18[_0x7347('0x43')]:_0x322002[_0x7347('0xc5')];if(!_0x272292[_0x7347('0x3e')]['hasOwnProperty'](_0x7347('0xcf'))){_0x164b18[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x272292[_0x7347('0x3e')][_0x7347('0x1b')]);_0x164b18[_0x7347('0x19')]=qs[_0x7347('0x19')](_0x272292[_0x7347('0x3e')]['offset']);}_0x164b18[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x272292[_0x7347('0x3e')][_0x7347('0xcc')]);_0x164b18['where']=qs[_0x7347('0xc8')](_['pick'](_0x272292[_0x7347('0x3e')],_0x322002[_0x7347('0xc8')]));_0x164b18['where'][_0x7347('0xd5')]=_0xc1c9c1['id'];if(_0x272292[_0x7347('0x3e')]['filter']){_0x164b18[_0x7347('0x3d')]=_['merge'](_0x164b18['where'],{'$or':_[_0x7347('0x34')](_0x164b18['attributes'],function(_0x623d15){var _0x20d276={};_0x20d276[_0x623d15]={'$like':'%'+_0x272292[_0x7347('0x3e')]['filter']+'%'};return _0x20d276;})});}_0x164b18=_[_0x7347('0x50')]({},_0x164b18,_0x272292[_0x7347('0x51')]);return db[_0x7347('0xd6')][_0x7347('0x1c')]({'where':_0x164b18[_0x7347('0x3d')]})[_0x7347('0x1e')](function(_0x3aba8c){_0x5cb001[_0x7347('0x1c')]=_0x3aba8c;if(_0x272292['query'][_0x7347('0x3f')]){_0x164b18[_0x7347('0xbf')]=[{'all':!![]}];}return db[_0x7347('0xd6')][_0x7347('0x45')](_0x164b18);})['then'](function(_0x10fc7a){_0x5cb001[_0x7347('0x46')]=_0x10fc7a;return _0x5cb001;});}})['then'](respondWithFilteredResult(_0xa0887f,_0x164b18))['catch'](handleError(_0xa0887f,null));};exports[_0x7347('0xd7')]=function(_0x16837a,_0x450eaa){var _0x3e8296={};var _0x474927={};var _0x43bbd9;var _0x296242;return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0x16837a[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x450eaa,null))[_0x7347('0x1e')](function(_0x5069b7){if(_0x5069b7){_0x43bbd9=_0x5069b7;_0x474927[_0x7347('0xc5')]=_[_0x7347('0xc7')](db[_0x7347('0xd8')][_0x7347('0x33')]);_0x474927['query']=_[_0x7347('0xc7')](_0x16837a[_0x7347('0x3e')]);_0x474927[_0x7347('0xc8')]=_[_0x7347('0xc9')](_0x474927[_0x7347('0xc5')],_0x474927[_0x7347('0x3e')]);_0x3e8296['attributes']=_[_0x7347('0xc9')](_0x474927['model'],qs[_0x7347('0xca')](_0x16837a[_0x7347('0x3e')]['fields']));_0x3e8296[_0x7347('0x43')]=_0x3e8296[_0x7347('0x43')][_0x7347('0x48')]?_0x3e8296[_0x7347('0x43')]:_0x474927[_0x7347('0xc5')];_0x3e8296[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x16837a[_0x7347('0x3e')][_0x7347('0xcc')]);_0x3e8296['where']=qs[_0x7347('0xc8')](_['pick'](_0x16837a[_0x7347('0x3e')],_0x474927['filters']));if(_0x16837a[_0x7347('0x3e')][_0x7347('0x38')]){_0x3e8296[_0x7347('0x3d')]=_[_0x7347('0x50')](_0x3e8296[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x3e8296['attributes'],function(_0x3ea4ed){var _0x42f672={};_0x42f672[_0x3ea4ed]={'$like':'%'+_0x16837a[_0x7347('0x3e')][_0x7347('0x38')]+'%'};return _0x42f672;})});}_0x3e8296=_[_0x7347('0x50')]({},_0x3e8296,_0x16837a[_0x7347('0x51')]);return _0x43bbd9[_0x7347('0xd7')](_0x3e8296);}})[_0x7347('0x1e')](function(_0x30cbb0){if(_0x30cbb0){_0x296242=_0x30cbb0[_0x7347('0x48')];if(!_0x16837a[_0x7347('0x3e')][_0x7347('0xbe')](_0x7347('0xcf'))){_0x3e8296[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x16837a[_0x7347('0x3e')][_0x7347('0x1b')]);_0x3e8296[_0x7347('0x19')]=qs['offset'](_0x16837a[_0x7347('0x3e')][_0x7347('0x19')]);}return _0x43bbd9[_0x7347('0xd7')](_0x3e8296);}})[_0x7347('0x1e')](function(_0x1ceddd){if(_0x1ceddd){return _0x1ceddd?{'count':_0x296242,'rows':_0x1ceddd}:null;}})[_0x7347('0x1e')](respondWithResult(_0x450eaa,null))[_0x7347('0x4f')](handleError(_0x450eaa,null));};exports['getOpenchannelInteractions']=function(_0x1f12db,_0x5aa1dc){var _0x2feeb8={};var _0x3df5d4={};var _0x276ca4;var _0x13629d;return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0x1f12db[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x5aa1dc,null))[_0x7347('0x1e')](function(_0x20102d){if(_0x20102d){_0x276ca4=_0x20102d;_0x3df5d4[_0x7347('0xc5')]=_[_0x7347('0xc7')](db['OpenchannelInteraction'][_0x7347('0x33')]);_0x3df5d4['query']=_[_0x7347('0xc7')](_0x1f12db['query']);_0x3df5d4[_0x7347('0xc8')]=_['intersection'](_0x3df5d4[_0x7347('0xc5')],_0x3df5d4[_0x7347('0x3e')]);_0x2feeb8[_0x7347('0x43')]=_[_0x7347('0xc9')](_0x3df5d4['model'],qs['fields'](_0x1f12db[_0x7347('0x3e')]['fields']));_0x2feeb8[_0x7347('0x43')]=_0x2feeb8[_0x7347('0x43')][_0x7347('0x48')]?_0x2feeb8[_0x7347('0x43')]:_0x3df5d4[_0x7347('0xc5')];_0x2feeb8[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x1f12db['query'][_0x7347('0xcc')]);_0x2feeb8[_0x7347('0x3d')]=qs['filters'](_['pick'](_0x1f12db[_0x7347('0x3e')],_0x3df5d4[_0x7347('0xc8')]));if(_0x1f12db[_0x7347('0x3e')][_0x7347('0x38')]){_0x2feeb8[_0x7347('0x3d')]=_['merge'](_0x2feeb8[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x2feeb8[_0x7347('0x43')],function(_0x12eb2c){var _0x5ed739={};_0x5ed739[_0x12eb2c]={'$like':'%'+_0x1f12db[_0x7347('0x3e')][_0x7347('0x38')]+'%'};return _0x5ed739;})});}_0x2feeb8=_[_0x7347('0x50')]({},_0x2feeb8,_0x1f12db[_0x7347('0x51')]);return _0x276ca4[_0x7347('0xd9')](_0x2feeb8);}})[_0x7347('0x1e')](function(_0x3b6c45){if(_0x3b6c45){_0x13629d=_0x3b6c45['length'];if(!_0x1f12db[_0x7347('0x3e')][_0x7347('0xbe')](_0x7347('0xcf'))){_0x2feeb8['limit']=qs[_0x7347('0x1b')](_0x1f12db[_0x7347('0x3e')][_0x7347('0x1b')]);_0x2feeb8[_0x7347('0x19')]=qs[_0x7347('0x19')](_0x1f12db['query'][_0x7347('0x19')]);}return _0x276ca4[_0x7347('0xd9')](_0x2feeb8);}})[_0x7347('0x1e')](function(_0x456c0e){if(_0x456c0e){return _0x456c0e?{'count':_0x13629d,'rows':_0x456c0e}:null;}})['then'](respondWithResult(_0x5aa1dc,null))['catch'](handleError(_0x5aa1dc,null));};exports[_0x7347('0xda')]=function(_0xc36430,_0xd88dcf){var _0x5e3ddb={'raw':!![],'where':{}};var _0x368ea={};var _0x5dbf90={'count':0x0,'rows':[]};return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0xc36430[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0xd88dcf,null))['then'](function(_0x325f07){if(_0x325f07){_0x368ea[_0x7347('0xc5')]=_[_0x7347('0xc7')](db[_0x7347('0xdb')][_0x7347('0x33')]);_0x368ea[_0x7347('0x3e')]=_[_0x7347('0xc7')](_0xc36430[_0x7347('0x3e')]);_0x368ea[_0x7347('0xc8')]=_[_0x7347('0xc9')](_0x368ea[_0x7347('0xc5')],_0x368ea[_0x7347('0x3e')]);_0x5e3ddb[_0x7347('0x43')]=_['intersection'](_0x368ea[_0x7347('0xc5')],qs['fields'](_0xc36430['query']['fields']));_0x5e3ddb['attributes']=_0x5e3ddb[_0x7347('0x43')][_0x7347('0x48')]?_0x5e3ddb[_0x7347('0x43')]:_0x368ea[_0x7347('0xc5')];if(!_0xc36430[_0x7347('0x3e')][_0x7347('0xbe')](_0x7347('0xcf'))){_0x5e3ddb[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0xc36430[_0x7347('0x3e')][_0x7347('0x1b')]);_0x5e3ddb[_0x7347('0x19')]=qs[_0x7347('0x19')](_0xc36430[_0x7347('0x3e')][_0x7347('0x19')]);}_0x5e3ddb[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0xc36430[_0x7347('0x3e')]['sort']);_0x5e3ddb[_0x7347('0x3d')]=qs[_0x7347('0xc8')](_[_0x7347('0xcd')](_0xc36430[_0x7347('0x3e')],_0x368ea['filters']));_0x5e3ddb[_0x7347('0x3d')][_0x7347('0xd5')]=_0x325f07['id'];if(_0xc36430[_0x7347('0x3e')]['filter']){_0x5e3ddb['where']=_['merge'](_0x5e3ddb['where'],{'$or':_[_0x7347('0x34')](_0x5e3ddb[_0x7347('0x43')],function(_0x587384){var _0x378476={};_0x378476[_0x587384]={'$like':'%'+_0xc36430[_0x7347('0x3e')][_0x7347('0x38')]+'%'};return _0x378476;})});}_0x5e3ddb=_[_0x7347('0x50')]({},_0x5e3ddb,_0xc36430[_0x7347('0x51')]);return db[_0x7347('0xdb')][_0x7347('0x1c')]({'where':_0x5e3ddb[_0x7347('0x3d')]})[_0x7347('0x1e')](function(_0x4b1463){_0x5dbf90[_0x7347('0x1c')]=_0x4b1463;if(_0xc36430[_0x7347('0x3e')][_0x7347('0x3f')]){_0x5e3ddb[_0x7347('0xbf')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x5e3ddb);})[_0x7347('0x1e')](function(_0x57a344){_0x5dbf90[_0x7347('0x46')]=_0x57a344;return _0x5dbf90;});}})['then'](respondWithFilteredResult(_0xd88dcf,_0x5e3ddb))[_0x7347('0x4f')](handleError(_0xd88dcf,null));};exports[_0x7347('0xdc')]=function(_0x58cd80,_0x3fedb4){var _0x4eb503={};var _0x31d9f9={};var _0x55af85;var _0x5abbaf;return db[_0x7347('0x32')]['findOne']({'where':{'id':_0x58cd80[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x3fedb4,null))[_0x7347('0x1e')](function(_0x430909){if(_0x430909){_0x55af85=_0x430909;_0x31d9f9[_0x7347('0xc5')]=_[_0x7347('0xc7')](db['SmsInteraction'][_0x7347('0x33')]);_0x31d9f9[_0x7347('0x3e')]=_[_0x7347('0xc7')](_0x58cd80[_0x7347('0x3e')]);_0x31d9f9[_0x7347('0xc8')]=_[_0x7347('0xc9')](_0x31d9f9[_0x7347('0xc5')],_0x31d9f9[_0x7347('0x3e')]);_0x4eb503[_0x7347('0x43')]=_['intersection'](_0x31d9f9[_0x7347('0xc5')],qs[_0x7347('0xca')](_0x58cd80[_0x7347('0x3e')][_0x7347('0xca')]));_0x4eb503['attributes']=_0x4eb503[_0x7347('0x43')][_0x7347('0x48')]?_0x4eb503[_0x7347('0x43')]:_0x31d9f9[_0x7347('0xc5')];_0x4eb503[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x58cd80[_0x7347('0x3e')]['sort']);_0x4eb503[_0x7347('0x3d')]=qs['filters'](_[_0x7347('0xcd')](_0x58cd80[_0x7347('0x3e')],_0x31d9f9[_0x7347('0xc8')]));if(_0x58cd80['query'][_0x7347('0x38')]){_0x4eb503['where']=_[_0x7347('0x50')](_0x4eb503[_0x7347('0x3d')],{'$or':_['map'](_0x4eb503[_0x7347('0x43')],function(_0x2847e0){var _0x3c07eb={};_0x3c07eb[_0x2847e0]={'$like':'%'+_0x58cd80[_0x7347('0x3e')][_0x7347('0x38')]+'%'};return _0x3c07eb;})});}_0x4eb503=_['merge']({},_0x4eb503,_0x58cd80[_0x7347('0x51')]);return _0x55af85['getSmsInteractions'](_0x4eb503);}})['then'](function(_0xc6ac43){if(_0xc6ac43){_0x5abbaf=_0xc6ac43[_0x7347('0x48')];if(!_0x58cd80[_0x7347('0x3e')][_0x7347('0xbe')](_0x7347('0xcf'))){_0x4eb503[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x58cd80[_0x7347('0x3e')]['limit']);_0x4eb503['offset']=qs['offset'](_0x58cd80[_0x7347('0x3e')][_0x7347('0x19')]);}return _0x55af85[_0x7347('0xdc')](_0x4eb503);}})[_0x7347('0x1e')](function(_0x52381b){if(_0x52381b){return _0x52381b?{'count':_0x5abbaf,'rows':_0x52381b}:null;}})[_0x7347('0x1e')](respondWithResult(_0x3fedb4,null))[_0x7347('0x4f')](handleError(_0x3fedb4,null));};exports[_0x7347('0xdd')]=function(_0x251392,_0x4d4847){var _0x1a3eee={};var _0xba13f7={};var _0x5245b6;var _0x2a34e8;return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0x251392[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x4d4847,null))[_0x7347('0x1e')](function(_0x2f8ae3){if(_0x2f8ae3){_0x5245b6=_0x2f8ae3;_0xba13f7[_0x7347('0xc5')]=_[_0x7347('0xc7')](db['FaxInteraction'][_0x7347('0x33')]);_0xba13f7['query']=_[_0x7347('0xc7')](_0x251392[_0x7347('0x3e')]);_0xba13f7['filters']=_[_0x7347('0xc9')](_0xba13f7['model'],_0xba13f7[_0x7347('0x3e')]);_0x1a3eee[_0x7347('0x43')]=_[_0x7347('0xc9')](_0xba13f7['model'],qs[_0x7347('0xca')](_0x251392[_0x7347('0x3e')][_0x7347('0xca')]));_0x1a3eee[_0x7347('0x43')]=_0x1a3eee['attributes'][_0x7347('0x48')]?_0x1a3eee[_0x7347('0x43')]:_0xba13f7[_0x7347('0xc5')];_0x1a3eee[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x251392[_0x7347('0x3e')][_0x7347('0xcc')]);_0x1a3eee[_0x7347('0x3d')]=qs[_0x7347('0xc8')](_[_0x7347('0xcd')](_0x251392[_0x7347('0x3e')],_0xba13f7['filters']));if(_0x251392[_0x7347('0x3e')][_0x7347('0x38')]){_0x1a3eee[_0x7347('0x3d')]=_[_0x7347('0x50')](_0x1a3eee[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x1a3eee[_0x7347('0x43')],function(_0x45f583){var _0x3c9507={};_0x3c9507[_0x45f583]={'$like':'%'+_0x251392[_0x7347('0x3e')][_0x7347('0x38')]+'%'};return _0x3c9507;})});}_0x1a3eee=_[_0x7347('0x50')]({},_0x1a3eee,_0x251392[_0x7347('0x51')]);return _0x5245b6[_0x7347('0xdd')](_0x1a3eee);}})[_0x7347('0x1e')](function(_0x514fc4){if(_0x514fc4){_0x2a34e8=_0x514fc4['length'];if(!_0x251392['query']['hasOwnProperty'](_0x7347('0xcf'))){_0x1a3eee[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x251392[_0x7347('0x3e')]['limit']);_0x1a3eee[_0x7347('0x19')]=qs[_0x7347('0x19')](_0x251392[_0x7347('0x3e')][_0x7347('0x19')]);}return _0x5245b6[_0x7347('0xdd')](_0x1a3eee);}})['then'](function(_0x33db42){if(_0x33db42){return _0x33db42?{'count':_0x2a34e8,'rows':_0x33db42}:null;}})[_0x7347('0x1e')](respondWithResult(_0x4d4847,null))[_0x7347('0x4f')](handleError(_0x4d4847,null));};exports[_0x7347('0xde')]=function(_0x37d068,_0x1c2876){var _0x5b5e90={};var _0xdc3d49={};var _0x28770d;var _0x2e7d99;return db['User'][_0x7347('0x8e')]({'where':{'id':_0x37d068['params']['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x1c2876,null))[_0x7347('0x1e')](function(_0x573f60){if(_0x573f60){_0x28770d=_0x573f60;_0xdc3d49[_0x7347('0xc5')]=_[_0x7347('0xc7')](db['WhatsappInteraction'][_0x7347('0x33')]);_0xdc3d49[_0x7347('0x3e')]=_[_0x7347('0xc7')](_0x37d068[_0x7347('0x3e')]);_0xdc3d49['filters']=_[_0x7347('0xc9')](_0xdc3d49['model'],_0xdc3d49[_0x7347('0x3e')]);_0x5b5e90[_0x7347('0x43')]=_['intersection'](_0xdc3d49[_0x7347('0xc5')],qs[_0x7347('0xca')](_0x37d068[_0x7347('0x3e')]['fields']));_0x5b5e90[_0x7347('0x43')]=_0x5b5e90['attributes']['length']?_0x5b5e90[_0x7347('0x43')]:_0xdc3d49[_0x7347('0xc5')];_0x5b5e90[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x37d068[_0x7347('0x3e')][_0x7347('0xcc')]);_0x5b5e90[_0x7347('0x3d')]=qs[_0x7347('0xc8')](_[_0x7347('0xcd')](_0x37d068['query'],_0xdc3d49[_0x7347('0xc8')]));if(_0x37d068[_0x7347('0x3e')]['filter']){_0x5b5e90[_0x7347('0x3d')]=_[_0x7347('0x50')](_0x5b5e90['where'],{'$or':_[_0x7347('0x34')](_0x5b5e90[_0x7347('0x43')],function(_0x22001c){var _0x16e1f2={};_0x16e1f2[_0x22001c]={'$like':'%'+_0x37d068['query'][_0x7347('0x38')]+'%'};return _0x16e1f2;})});}_0x5b5e90=_[_0x7347('0x50')]({},_0x5b5e90,_0x37d068[_0x7347('0x51')]);return _0x28770d[_0x7347('0xde')](_0x5b5e90);}})[_0x7347('0x1e')](function(_0x1176cf){if(_0x1176cf){_0x2e7d99=_0x1176cf[_0x7347('0x48')];if(!_0x37d068[_0x7347('0x3e')]['hasOwnProperty'](_0x7347('0xcf'))){_0x5b5e90[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x37d068['query']['limit']);_0x5b5e90['offset']=qs[_0x7347('0x19')](_0x37d068['query'][_0x7347('0x19')]);}return _0x28770d[_0x7347('0xde')](_0x5b5e90);}})[_0x7347('0x1e')](function(_0x40dceb){if(_0x40dceb){return _0x40dceb?{'count':_0x2e7d99,'rows':_0x40dceb}:null;}})['then'](respondWithResult(_0x1c2876,null))[_0x7347('0x4f')](handleError(_0x1c2876,null));};exports[_0x7347('0xdf')]=function(_0x44b31f,_0x48a88f,_0x501bdc){var _0x165630;var _0x1dd708;var _0x4dcab8;var _0x2c8cad=!_['isNil'](_0x44b31f[_0x7347('0x56')]['id'])?_0x44b31f[_0x7347('0x56')]['id']:!_['isNil'](_0x44b31f[_0x7347('0x26')]['id'])?_0x44b31f[_0x7347('0x26')]['id']:null;return db['User']['find']({'where':{'id':_0x2c8cad,'role':{'$or':[_0x7347('0x24'),_0x7347('0x26'),_0x7347('0x1f')]}},'attributes':['id','name',_0x7347('0xe0'),'mobile',_0x7347('0x2d'),_0x7347('0x5e'),_0x7347('0xe1')]})[_0x7347('0x1e')](function(_0x4b9002){if(_0x4b9002){if(_0x4b9002[_0x7347('0x2d')]===_0x7347('0x1f')){_0x165630=_0x4b9002;if(_0x44b31f[_0x7347('0x55')][_0x7347('0x96')]){_0x4dcab8=util[_0x7347('0x9f')](_0x7347('0xe2'),_0x165630[_0x44b31f[_0x7347('0x55')][_0x7347('0x96')]]);}else if(_0x44b31f[_0x7347('0x55')][_0x7347('0xe3')]){_0x4dcab8=util[_0x7347('0x9f')]('SIP/%s',_0x44b31f[_0x7347('0x55')][_0x7347('0xe3')]);}else{_0x4dcab8=util[_0x7347('0x9f')](_0x7347('0xe4'),_0x165630[_0x7347('0x2f')]);}socket['to'](util[_0x7347('0x9f')]('user:%s',_0x165630[_0x7347('0x2f')]))[_0x7347('0x20')](_0x7347('0xe5'),{'user':{'id':_0x165630['id'],'name':_0x165630[_0x7347('0x2f')]},'ip':_0x44b31f['headers'][_0x7347('0xe6')]||_0x44b31f[_0x7347('0xe7')][_0x7347('0xe8')]||_0x44b31f['socket'][_0x7347('0xe8')]||_0x44b31f[_0x7347('0xe7')][_0x7347('0xe9')][_0x7347('0xe8')]});return db['UserVoiceQueueRt'][_0x7347('0x22')]({'where':{'membername':_0x165630[_0x7347('0x2f')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x7347('0x87'))](_0x7347('0xea'));}})['then'](function(){if(_0x165630){return _0x165630[_0x7347('0xeb')]({'raw':!![]});}})[_0x7347('0x1e')](function(_0x154556){if(_0x165630){if(_0x154556){_0x1dd708=_0x154556;if(_0x1dd708[_0x7347('0x48')]){var _0xdb8856=_0x1dd708[_0x7347('0x34')](function(_0x2ad06b){var _0x28ab75={'membername':_0x165630['name'],'UserId':_0x165630['id'],'queue_name':_0x2ad06b[_0x7347('0x2f')],'VoiceQueueId':_0x2ad06b['id'],'interface':_0x4dcab8,'paused':_0x165630[_0x7347('0xe1')]||![],'penalty':_0x2ad06b[_0x7347('0xec')]||0x0};return db[_0x7347('0xa0')][_0x7347('0xa1')](_0x28ab75);});return Promise['all'](_0xdb8856);}}}})[_0x7347('0x1e')](function(){if(_0x165630){return db[_0x7347('0xed')][_0x7347('0x45')]({'where':{'membername':_0x165630['name'],'exitAt':null}});}})[_0x7347('0x1e')](function(_0x9b4be9){if(_0x165630){var _0x6a7b60=[];_0x9b4be9['forEach'](function(_0x23338f){_0x6a7b60[_0x7347('0x44')](_0x23338f[_0x7347('0x54')]({'exitAt':moment()[_0x7347('0x9f')](_0x7347('0xee'))}));});return Promise['all'](_0x6a7b60);}})[_0x7347('0x1e')](function(){if(_0x165630){var _0x4be93c=[];var _0x3adcbe=[];var _0x115831=utils[_0x7347('0xef')]();var _0x23a780={'membername':_0x165630[_0x7347('0x2f')],'interface':_0x4dcab8,'enterAt':moment()[_0x7347('0x9f')](_0x7347('0xee')),'role':_0x165630[_0x7347('0x2d')],'internal':_0x165630[_0x7347('0x5e')]};_0x115831[_0x7347('0xf0')](function(_0x34b727){_0x4be93c[_0x7347('0x44')](_[_0x7347('0x50')]({'channel':_0x34b727,'type':_0x7347('0xf1'),'data1':_0x44b31f[_0x7347('0x55')][_0x7347('0xf2')],'data2':_0x4dcab8},_0x23a780));if(_0x165630[_0x7347('0xe1')]){_0x3adcbe[_0x7347('0x44')](_[_0x7347('0x50')]({'channel':_0x34b727,'type':_0x7347('0xf3'),'data1':_0x7347('0xf4')},_0x23a780));}});return db['MemberReport'][_0x7347('0xf5')](_0x4be93c['concat'](_0x3adcbe),{'individualHooks':!![]});}})[_0x7347('0x1e')](function(){if(_0x165630){return _0x165630['update']({'online':!![],'lastLoginAt':moment()[_0x7347('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x165630['loginInPause']||![],'mailPause':_0x165630['loginInPause']||![],'chatPause':_0x165630[_0x7347('0xe1')]||![],'faxPause':_0x165630['loginInPause']||![],'smsPause':_0x165630[_0x7347('0xe1')]||![],'openchannelPause':_0x165630['loginInPause']||![],'whatsappPause':_0x165630[_0x7347('0xe1')]||![],'pauseType':_0x165630[_0x7347('0xe1')]?'LOGININPAUSE':null,'interface':_0x4dcab8,'lastPauseAt':moment()[_0x7347('0x9f')](_0x7347('0xee'))});}})['then'](function(_0x354531){if(_0x44b31f[_0x7347('0xf6')]){return _0x501bdc();}else{return Promise['resolve'](_0x354531)[_0x7347('0x1e')](respondWithResult(_0x48a88f,null));}})[_0x7347('0x4f')](handleError(_0x48a88f,null));};exports['logout']=function(_0x26dfff,_0x35a56e){var _0x70483a;return db['User'][_0x7347('0x2e')]({'where':{'id':_0x26dfff[_0x7347('0x56')]['id'],'role':_0x7347('0x1f')},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x35a56e,null))['then'](function(_0x42677f){if(_0x42677f){_0x70483a=_0x42677f;return db[_0x7347('0xa0')][_0x7347('0x22')]({'where':{'membername':_0x70483a['name']},'individualHooks':!![]});}})[_0x7347('0x1e')](function(){return db[_0x7347('0xed')][_0x7347('0x45')]({'where':{'membername':_0x70483a['name'],'exitAt':null}});})['then'](function(_0x33de26){var _0x20a021=[];_0x33de26[_0x7347('0xf0')](function(_0x49318b){_0x20a021['push'](_0x49318b[_0x7347('0x54')]({'exitAt':moment()[_0x7347('0x9f')](_0x7347('0xee'))}));});return Promise[_0x7347('0x4e')](_0x20a021);})['then'](function(){return _0x70483a[_0x7347('0x54')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x7347('0x1e')](respondWithResult(_0x35a56e,null))[_0x7347('0x4f')](handleError(_0x35a56e,null));};exports[_0x7347('0xf7')]=function(_0x3b4779,_0x557f36){var _0x221579;return db['UserVoiceQueueRt'][_0x7347('0x54')]({'paused':0x1},{'where':{'UserId':_0x3b4779[_0x7347('0x56')]['id']},'individualHooks':!![]})[_0x7347('0x1e')](function(){return db[_0x7347('0x32')]['find']({'where':{'id':_0x3b4779[_0x7347('0x56')]['id'],'role':'agent'},'attributes':['id','name',_0x7347('0x2d'),'internal','interface',_0x7347('0x94')]});})[_0x7347('0x1e')](handleEntityNotFound(_0x557f36,null))[_0x7347('0x1e')](function(_0x109bca){if(_0x109bca){_0x221579=_0x109bca;return db[_0x7347('0xed')][_0x7347('0x45')]({'where':{'membername':_0x221579['name'],'type':'PAUSE','exitAt':null}});}})[_0x7347('0x1e')](function(_0x4cc6e8){if(_0x4cc6e8[_0x7347('0x48')]){var _0x155c95=moment()['format'](_0x7347('0xee'));for(var _0x119908=0x0,_0x134176=_0x4cc6e8[_0x7347('0x48')];_0x119908<_0x134176;_0x119908++){_0x4cc6e8[_0x119908]['updateAttributes']({'exitAt':_0x155c95});}}})[_0x7347('0x1e')](function(){var _0x1d5a0b=[];var _0x3ed2e2=utils[_0x7347('0xef')]();_0x3ed2e2['forEach'](function(_0x28b5c7){_0x1d5a0b[_0x7347('0x44')]({'channel':_0x28b5c7,'membername':_0x221579[_0x7347('0x2f')],'interface':_[_0x7347('0x5f')](_0x221579[_0x7347('0x96')])?util[_0x7347('0x9f')](_0x7347('0xe4'),_0x221579[_0x7347('0x2f')]):_0x221579[_0x7347('0x96')],'type':_0x7347('0xf3'),'enterAt':moment()[_0x7347('0x9f')](_0x7347('0xee')),'data1':_0x3b4779[_0x7347('0x55')][_0x7347('0x36')]||'DEFAULT\x20PAUSE','role':_0x221579['role'],'internal':_0x221579[_0x7347('0x5e')]});});return db[_0x7347('0xed')][_0x7347('0xf5')](_0x1d5a0b,{'individualHooks':!![]});})[_0x7347('0x1e')](function(){return _0x221579['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3b4779[_0x7347('0x55')][_0x7347('0x36')]||_0x7347('0xf8'),'lastPauseAt':moment()[_0x7347('0x9f')](_0x7347('0xee'))});})[_0x7347('0x1e')](respondWithResult(_0x557f36,null))[_0x7347('0x4f')](handleError(_0x557f36,null));};exports[_0x7347('0xf9')]=function(_0x158853,_0x218ec3){if(_0x158853[_0x7347('0x55')][_0x7347('0x93')]&&!utils[_0x7347('0x97')](_0x158853[_0x7347('0x55')][_0x7347('0x93')])){throw new APIBadRequestError(util[_0x7347('0x9f')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x158853[_0x7347('0x55')]['channel']));}return db[_0x7347('0x32')][_0x7347('0x2e')]({'where':{'id':_0x158853[_0x7347('0x56')]['id']},'attributes':['id',_0x7347('0x2f'),'role',_0x7347('0x5e'),'interface',_0x7347('0x94'),_0x7347('0x95'),_0x7347('0xfa'),_0x7347('0xfb'),_0x7347('0xfc'),'openchannelPause',_0x7347('0xfd'),_0x7347('0xfe'),'pauseType',_0x7347('0xff')]})['then'](function(_0x57a03){if(!_0x57a03){throw new APINotFoundError(util[_0x7347('0x9f')](_0x7347('0xbd'),_0x158853['params']['id']));}return _0x57a03[_0x7347('0xf9')](_0x158853[_0x7347('0x55')][_0x7347('0x93')]);})[_0x7347('0x1e')](respondWithResult(_0x218ec3,null))['catch'](APIHandleError(_0x218ec3));};exports[_0x7347('0x100')]=function(_0x547997,_0x1a9e7d){var _0x2f469e={};var _0x5b4508={};var _0x166619;var _0x127d21;return db['User'][_0x7347('0x8e')]({'where':{'id':_0x547997['params']['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x1a9e7d,null))[_0x7347('0x1e')](function(_0x2519fc){if(_0x2519fc){_0x166619=_0x2519fc;_0x5b4508['model']=_[_0x7347('0xc7')](db[_0x7347('0x101')][_0x7347('0x33')]);_0x5b4508[_0x7347('0x3e')]=_[_0x7347('0xc7')](_0x547997[_0x7347('0x3e')]);_0x5b4508[_0x7347('0xc8')]=_[_0x7347('0xc9')](_0x5b4508[_0x7347('0xc5')],_0x5b4508['query']);_0x2f469e[_0x7347('0x43')]=_[_0x7347('0xc9')](_0x5b4508[_0x7347('0xc5')],qs[_0x7347('0xca')](_0x547997[_0x7347('0x3e')]['fields']));_0x2f469e['attributes']=_0x2f469e[_0x7347('0x43')][_0x7347('0x48')]?_0x2f469e['attributes']:_0x5b4508[_0x7347('0xc5')];_0x2f469e['order']=qs[_0x7347('0xcc')](_0x547997[_0x7347('0x3e')]['sort']);_0x2f469e['where']=qs['filters'](_['pick'](_0x547997[_0x7347('0x3e')],_0x5b4508[_0x7347('0xc8')]));if(_0x547997[_0x7347('0x3e')][_0x7347('0x38')]){_0x2f469e[_0x7347('0x3d')]=_[_0x7347('0x50')](_0x2f469e[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x2f469e['attributes'],function(_0x183cb0){var _0x548c87={};_0x548c87[_0x183cb0]={'$like':'%'+_0x547997[_0x7347('0x3e')]['filter']+'%'};return _0x548c87;})});}_0x2f469e=_['merge']({},_0x2f469e,_0x547997[_0x7347('0x51')]);return _0x166619['getTeams'](_0x2f469e);}})[_0x7347('0x1e')](function(_0x3fb07a){if(_0x3fb07a){_0x127d21=_0x3fb07a[_0x7347('0x48')];if(!_0x547997[_0x7347('0x3e')][_0x7347('0xbe')]('nolimit')){_0x2f469e[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x547997[_0x7347('0x3e')][_0x7347('0x1b')]);_0x2f469e[_0x7347('0x19')]=qs[_0x7347('0x19')](_0x547997['query'][_0x7347('0x19')]);}return _0x166619[_0x7347('0x100')](_0x2f469e);}})[_0x7347('0x1e')](function(_0x9a976c){if(_0x9a976c){return _0x9a976c?{'count':_0x127d21,'rows':_0x9a976c}:null;}})[_0x7347('0x1e')](respondWithResult(_0x1a9e7d,null))['catch'](handleError(_0x1a9e7d,null));};exports[_0x7347('0x102')]=function(_0x38ba0e,_0x10be6a){var _0x3c73ce=_0x38ba0e[_0x7347('0x56')]['id'];var _0x1f5234=_0x38ba0e[_0x7347('0x55')]?_0x38ba0e[_0x7347('0x55')][_0x7347('0x59')]:null;var _0x1a0af3=[];return Promise[_0x7347('0x103')]()[_0x7347('0x1e')](function(){if(!_0x1f5234)throw new APIBadRequestError(_0x7347('0x104'));})['then'](function(){return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0x3c73ce}});})[_0x7347('0x1e')](function(_0x172581){if(!_0x172581)throw new APINotFoundError(util[_0x7347('0x9f')](_0x7347('0xbd'),_0x38ba0e[_0x7347('0x56')]['id']));return db['sequelize'][_0x7347('0x105')](function(_0x2a79a2){return _0x172581['addTeams'](_0x1f5234,{'transaction':_0x2a79a2})[_0x7347('0x1e')](function(){return db[_0x7347('0x101')]['findAll']({'where':{'id':{'$in':_0x1f5234}}});})[_0x7347('0x1e')](function(_0x2b4182){var _0x529dbe=_[_0x7347('0x34')](_0x2b4182,function(_0x5e6070){return _0x5e6070[_0x7347('0x106')]();});return Promise[_0x7347('0x4e')](_0x529dbe);})[_0x7347('0x1e')](function(_0x24cb94){_0x1a0af3=_[_0x7347('0x107')](_0x24cb94);var _0x56aaab=_[_0x7347('0x34')](_0x1a0af3,function(_0x22e159){return _0x22e159[_0x7347('0x108')](_0x172581['id'],{'transaction':_0x2a79a2});});return Promise['all'](_0x56aaab);})['then'](function(){if(!_0x172581['online'])return;var _0x46b140=_[_0x7347('0x38')](_0x1a0af3,function(_0x245ddd){return _0x245ddd[_0x7347('0x109')](_0x7347('0x93'))===_0x7347('0x10a');});var _0x5daace=_['map'](_0x46b140,function(_0x21081d){return db[_0x7347('0xa0')][_0x7347('0xa1')]({'membername':_0x172581[_0x7347('0x2f')],'UserId':_0x172581['id'],'queue_name':_0x21081d['name'],'VoiceQueueId':_0x21081d['id'],'interface':_[_0x7347('0x5f')](_0x172581[_0x7347('0x96')])?util[_0x7347('0x9f')](_0x7347('0xe4'),_0x172581['name']):_0x172581['interface'],'paused':_0x172581[_0x7347('0x95')]||![],'penalty':_0x172581[_0x7347('0x9b')]},{'transaction':_0x2a79a2});});return Promise[_0x7347('0x4e')](_0x5daace);})['then'](function(){return db[_0x7347('0x10b')][_0x7347('0x45')]({'where':{'teamId':{'$in':_0x1f5234}}});})[_0x7347('0x1e')](function(_0x1d2040){var _0x2fe7ae=_[_0x7347('0x34')](_0x1d2040,function(_0x2b2c47){return db[_0x7347('0x10c')]['create']({'UserId':_0x172581['id'],'VoicePrefixId':_0x2b2c47[_0x7347('0x10d')]},{'transaction':_0x2a79a2});});return Promise[_0x7347('0x4e')](_0x2fe7ae);});});})[_0x7347('0x1e')](function(){for(var _0x46618c=0x0;_0x46618c<_0x1a0af3[_0x7347('0x48')];_0x46618c++){var _0x300412=_0x1a0af3[_0x46618c]['getDataValue'](_0x7347('0x93'));var _0x33b4cc=_0x300412+_0x7347('0xa5');socket[_0x7347('0x20')](_0x7347('0x26')+_0x300412+_0x7347('0x10e'),{'UserId':_0x3c73ce,['queueField']:_0x1a0af3[_0x46618c]['id']});}})[_0x7347('0x1e')](respondWithStatusCode(_0x10be6a,null))[_0x7347('0x4f')](APIHandleError(_0x10be6a));};exports[_0x7347('0x10f')]=function(_0x4f7c5c,_0x521f1d){var _0x6ebdbf=_0x4f7c5c[_0x7347('0x56')]['id'];var _0x31c7c5=null;if(_0x4f7c5c[_0x7347('0x3e')][_0x7347('0x59')]){_0x31c7c5=_['isArray'](_0x4f7c5c[_0x7347('0x3e')][_0x7347('0x59')])?_0x4f7c5c['query'][_0x7347('0x59')]:[_0x4f7c5c[_0x7347('0x3e')][_0x7347('0x59')]];}var _0x46f881=[];return Promise[_0x7347('0x103')]()[_0x7347('0x1e')](function(){if(!_0x31c7c5)throw new APIBadRequestError(_0x7347('0x110'));})[_0x7347('0x1e')](function(){return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0x6ebdbf}});})[_0x7347('0x1e')](function(_0x4b3ff2){if(!_0x4b3ff2)throw new APINotFoundError(util[_0x7347('0x9f')](_0x7347('0xbd'),_0x4f7c5c['params']['id']));return db[_0x7347('0x61')][_0x7347('0x105')](function(_0x1e01d8){return _0x4b3ff2['removeTeams'](_0x31c7c5,{'transaction':_0x1e01d8})[_0x7347('0x1e')](function(){return db[_0x7347('0x101')][_0x7347('0x45')]({'where':{'id':{'$in':_0x31c7c5}}});})[_0x7347('0x1e')](function(_0x3d53be){var _0x3744eb=_[_0x7347('0x34')](_0x3d53be,function(_0xc0fbbc){return _0xc0fbbc[_0x7347('0x106')]();});return Promise['all'](_0x3744eb);})[_0x7347('0x1e')](function(_0x219099){_0x46f881=_[_0x7347('0x107')](_0x219099);var _0x23769b=_[_0x7347('0x34')](_0x46f881,function(_0x18530a){return _0x18530a[_0x7347('0x111')](_0x4b3ff2['id'],{'transaction':_0x1e01d8});});return Promise[_0x7347('0x4e')](_0x23769b);})['then'](function(){if(!_0x4b3ff2[_0x7347('0x94')])return;var _0x29a382=_[_0x7347('0x38')](_0x46f881,function(_0x21a72d){return _0x21a72d[_0x7347('0x109')](_0x7347('0x93'))===_0x7347('0x10a');});var _0xed81b0=_['map'](_0x29a382,function(_0x1b1b94){return db[_0x7347('0xa0')]['destroy']({'where':{'VoiceQueueId':_0x1b1b94['id'],'UserId':_0x4b3ff2['id']},'transaction':_0x1e01d8});});return Promise[_0x7347('0x4e')](_0xed81b0);})[_0x7347('0x1e')](function(){return db['TeamVoicePrefix'][_0x7347('0x45')]({'where':{'teamId':{'$in':_0x31c7c5}}});})['then'](function(_0x41522d){var _0x4e9125=_['map'](_0x41522d,function(_0x1223c8){return db['UserVoicePrefix'][_0x7347('0x22')]({'where':{'UserId':_0x4b3ff2['id'],'VoicePrefixId':_0x1223c8[_0x7347('0x10d')]}},{'transaction':_0x1e01d8});});return Promise[_0x7347('0x4e')](_0x4e9125);});});})[_0x7347('0x1e')](function(){for(var _0x1d4903=0x0;_0x1d4903<_0x46f881[_0x7347('0x48')];_0x1d4903++){var _0x1536e7=_0x46f881[_0x1d4903][_0x7347('0x109')](_0x7347('0x93'));var _0x1751cf=_0x1536e7+_0x7347('0xa5');socket[_0x7347('0x20')](_0x7347('0x26')+_0x1536e7+_0x7347('0xa6'),{'UserId':_0x6ebdbf,['queueField']:_0x46f881[_0x1d4903]['id']});}})[_0x7347('0x1e')](respondWithStatusCode(_0x521f1d,null))[_0x7347('0x4f')](APIHandleError(_0x521f1d));};exports[_0x7347('0x112')]=function(_0x2449d1,_0x5c83fb){var _0x47dd6c={};var _0x2dbca8={};var _0x34bd36;var _0xba4192;return db['User']['findOne']({'where':{'id':_0x2449d1[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x5c83fb,null))[_0x7347('0x1e')](function(_0x38c032){if(_0x38c032){_0x34bd36=_0x38c032;_0x2dbca8['model']=_[_0x7347('0xc7')](db[_0x7347('0x113')]['rawAttributes']);_0x2dbca8[_0x7347('0x3e')]=_['keys'](_0x2449d1[_0x7347('0x3e')]);_0x2dbca8[_0x7347('0xc8')]=_['intersection'](_0x2dbca8['model'],_0x2dbca8[_0x7347('0x3e')]);_0x47dd6c[_0x7347('0x43')]=_[_0x7347('0xc9')](_0x2dbca8[_0x7347('0xc5')],qs[_0x7347('0xca')](_0x2449d1[_0x7347('0x3e')][_0x7347('0xca')]));_0x47dd6c[_0x7347('0x43')]=_0x47dd6c[_0x7347('0x43')][_0x7347('0x48')]?_0x47dd6c[_0x7347('0x43')]:_0x2dbca8[_0x7347('0xc5')];_0x47dd6c[_0x7347('0xcb')]=qs[_0x7347('0xcc')](_0x2449d1[_0x7347('0x3e')][_0x7347('0xcc')]);_0x47dd6c[_0x7347('0x3d')]=qs['filters'](_['pick'](_0x2449d1[_0x7347('0x3e')],_0x2dbca8['filters']));if(_0x2449d1[_0x7347('0x3e')][_0x7347('0x38')]){_0x47dd6c[_0x7347('0x3d')]=_[_0x7347('0x50')](_0x47dd6c[_0x7347('0x3d')],{'$or':_[_0x7347('0x34')](_0x47dd6c[_0x7347('0x43')],function(_0x3d3b4a){var _0x3ea857={};_0x3ea857[_0x3d3b4a]={'$like':'%'+_0x2449d1[_0x7347('0x3e')]['filter']+'%'};return _0x3ea857;})});}_0x47dd6c=_[_0x7347('0x50')]({},_0x47dd6c,_0x2449d1[_0x7347('0x51')]);return _0x34bd36[_0x7347('0x112')](_0x47dd6c);}})[_0x7347('0x1e')](function(_0x94b839){if(_0x94b839){_0xba4192=_0x94b839[_0x7347('0x48')];if(!_0x2449d1[_0x7347('0x3e')][_0x7347('0xbe')](_0x7347('0xcf'))){_0x47dd6c[_0x7347('0x1b')]=qs[_0x7347('0x1b')](_0x2449d1[_0x7347('0x3e')][_0x7347('0x1b')]);_0x47dd6c['offset']=qs[_0x7347('0x19')](_0x2449d1['query'][_0x7347('0x19')]);}return _0x34bd36[_0x7347('0x112')](_0x47dd6c);}})[_0x7347('0x1e')](function(_0x4038d6){if(_0x4038d6){return _0x4038d6?{'count':_0xba4192,'rows':_0x4038d6}:null;}})[_0x7347('0x1e')](respondWithResult(_0x5c83fb,null))[_0x7347('0x4f')](handleError(_0x5c83fb,null));};exports['getAgents']=function(_0x896379,_0x1999aa){var _0x39ed50={};var _0x3b8a4c={};var _0x277272;return db[_0x7347('0x32')][_0x7347('0x8e')]({'where':{'id':_0x896379[_0x7347('0x56')]['id']}})[_0x7347('0x1e')](handleEntityNotFound(_0x1999aa,null))['then'](function(_0x649625){if(_0x649625){_0x277272=_0x649625;_0x3b8a4c[_0x7347('0xc5')]=_[_0x7347('0xc7')](db[_0x7347('0x32')][_0x7347('0x33')]);_0x3b8a4c[_0x7347('0x3e')]=_['keys'](_0x896379[_0x7347('0x3e')]);_0x3b8a4c[_0x7347('0xc8')]=_[_0x7347('0xc9')](_0x3b8a4c[_0x7347('0xc5')],_0x3b8a4c[_0x7347('0x3e')]);_0x39ed50[_0x7347('0x43')]=_[_0x7347('0xc9')](_0x3b8a4c[_0x7347('0xc5')],qs[_0x7347('0xca')](_0x896379[_0x7347('0x3e')][_0x7347('0xca')]));_0x39ed50[_0x7347('0x43')]=_0x39ed50[_0x7347('0x43')][_0x7347('0x48')]?_0x39ed50['attributes']:_0x3b8a4c[_0x7347('0xc5')];_0x39ed50[_0x7347('0xcb')]=qs['sort'](_0x896379[_0x7347('0x3e')][_0x7347('0xcc')]);_0x39ed50[_0x7347('0x3d')]=qs[_0x7347('0xc8')](_['pick'](_0x896379[_0x7347('0x3e')],_0x3b8a4c[_0x7347('0xc8')]));if(_0x896379[_0x7347('0x3e')][_0x7347('0x38')]){_0x39ed50[_0x7347('0x3d')]=_['merge'](_0x39ed50[_0x7347('0x3d')],{'$or':_['map'](_0x39ed50['attributes'],function(_0x17c30d){var _0x43e24f={};_0x43e24f[_0x17c30d]={'$like':'%'+_0x896379[_0x7347('0x3e')][_0x7347('0x38')]+'%'};return _0x43e24f;})});}_0x39ed50[_0x7347('0xc5')]=db[_0x7347('0x32')];_0x39ed50['as']=_0x7347('0x27');_0x39ed50=_[_0x7347('0x50')]({},_0x39ed50,_0x896379[_0x7347('0x51')]);return _0x277272[_0x7347('0xeb')]({'include':[_0x39ed50]});}})[_0x7347('0x1e')](function(_0x577d50){if(_0x577d50){var _0x10bb63={},_0x2ea32d=[];for(var _0x269930=0x0;_0x269930<_0x577d50[_0x7347('0x48')];_0x269930+=0x1){for(var _0x4b558a=0x0,_0x55c549;_0x4b558a<_0x577d50[_0x269930][_0x7347('0x27')][_0x7347('0x48')];_0x4b558a+=0x1){_0x55c549=_0x577d50[_0x269930][_0x7347('0x27')][_0x4b558a][_0x7347('0x23')]({'plain':!![]});_0x10bb63[_0x55c549['id']]=_0x55c549;}}_0x10bb63=_[_0x7347('0x114')](_0x10bb63);for(var _0x5e1701=qs[_0x7347('0x19')](_0x896379[_0x7347('0x3e')]['offset']);_0x5e1701<_0x10bb63['length']&&_0x2ea32d[_0x7347('0x48')]=_0x1da81d['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0077('0x19')](function(){if(_0x5d27f6){return db['UserVoiceQueueRt'][_0x0077('0x45')]({'where':{'membername':_0x5d27f6['name']},'individualHooks':!![]});}})['then'](function(){if(_0x5d27f6){return _0x5d27f6['getVoiceQueues']({'raw':!![]});}})[_0x0077('0x19')](function(_0x5e256f){if(_0x5d27f6){if(_0x5e256f){var _0x13671f=[];_0x1ea7da=_0x5e256f;if(_0x1ea7da[_0x0077('0x2b')]){for(var _0x1a6837=0x0;_0x1a6837<_0x1ea7da[_0x0077('0x2b')];_0x1a6837++){_0x13671f[_0x0077('0x2d')](db[_0x0077('0x28')][_0x0077('0x52')]({'membername':_0x5d27f6[_0x0077('0x2a')],'UserId':_0x5d27f6['id'],'queue_name':_0x1ea7da[_0x1a6837][_0x0077('0x2a')],'VoiceQueueId':_0x1ea7da[_0x1a6837]['id'],'interface':_0x3a5eae,'paused':_0x5d27f6[_0x0077('0x4b')]||![],'penalty':_0x1ea7da[_0x1a6837][_0x0077('0x53')]||0x0}));}return BPromise[_0x0077('0x47')](_0x13671f);}}}})['then'](function(){if(_0x5d27f6){return db[_0x0077('0x29')][_0x0077('0x10')]({'where':{'membername':_0x5d27f6[_0x0077('0x2a')],'exitAt':null}});}})[_0x0077('0x19')](function(_0xa9bca8){if(_0x5d27f6){if(_0xa9bca8&&_0xa9bca8[_0x0077('0x2b')]){var _0x19a36a=[];_0xa9bca8[_0x0077('0x46')](function(_0x14e201){_0x19a36a[_0x0077('0x2d')](_0x14e201['update']({'exitAt':moment()['format'](_0x0077('0x30'))}));});return BPromise[_0x0077('0x47')](_0x19a36a);}}})[_0x0077('0x19')](function(){if(_0x5d27f6){var _0x3d02b6=[];var _0x215191=[];var _0x38425d=utils[_0x0077('0x2c')]();var _0xcba843={'membername':_0x5d27f6['name'],'interface':_0x3a5eae,'enterAt':moment()[_0x0077('0x25')](_0x0077('0x30')),'role':_0x5d27f6[_0x0077('0x22')],'internal':_0x5d27f6[_0x0077('0x23')]};_0x38425d[_0x0077('0x46')](function(_0x504107){_0x3d02b6['push'](_[_0x0077('0x54')]({'channel':_0x504107,'type':'LOGIN','data1':'callysquare','data2':_0x3a5eae},_0xcba843));if(_0x5d27f6['loginInPause']){_0x215191['push'](_[_0x0077('0x54')]({'channel':_0x504107,'type':_0x0077('0x2f'),'data1':'LOGININPAUSE'},_0xcba843));}});return db[_0x0077('0x29')][_0x0077('0x35')](_0x3d02b6[_0x0077('0x55')](_0x215191),{'individualHooks':!![]});}})[_0x0077('0x19')](function(){if(_0x5d27f6){return _0x5d27f6[_0x0077('0x36')]({'online':!![],'lastLoginAt':moment()[_0x0077('0x25')](_0x0077('0x30')),'voicePause':_0x5d27f6[_0x0077('0x4b')]||![],'mailPause':_0x5d27f6[_0x0077('0x4b')]||![],'chatPause':_0x5d27f6['loginInPause']||![],'faxPause':_0x5d27f6[_0x0077('0x4b')]||![],'smsPause':_0x5d27f6[_0x0077('0x4b')]||![],'openchannelPause':_0x5d27f6[_0x0077('0x4b')]||![],'pauseType':_0x5d27f6[_0x0077('0x4b')]?_0x0077('0x56'):null,'lastPauseAt':moment()['format'](_0x0077('0x30')),'interface':_0x3a5eae});}})[_0x0077('0x19')](function(_0x20c889){_0x4672ec(_0x20c889);})[_0x0077('0x1b')](function(_0x3f7636){_0x4f4948(_0x3267c5[_0x0077('0x1c')](0x1f4,_0x3f7636['message']));});});}; \ No newline at end of file +var _0x39e7=['MemberReport','findAll','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','body','type','uniqueid','bulkCreate','catch','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','destroy','forEach','LoginUser','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','upsert','UserVoiceQueue.penalty','all','merge','callysquare','LOGININPAUSE','concat','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','GetUser','User','options','raw','where','attributes','limit','map','include','model','then','info','debug','stringify','error','message','ShowUser','PauseUser','find','name','role','internal','interface','format','params','UserVoiceQueueRt','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e7,0x18d));var _0x739e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39e7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x739e('0x0'));var util=require('util');var moment=require(_0x739e('0x1'));var BPromise=require('bluebird');var Redis=require(_0x739e('0x2'));var db=require(_0x739e('0x3'))['db'];var utils=require(_0x739e('0x4'));var logger=require('../../config/logger')(_0x739e('0x5'));var config=require(_0x739e('0x6'));config[_0x739e('0x7')]=_['defaults'](config['redis'],{'host':_0x739e('0x8'),'port':0x18eb});var socket=require(_0x739e('0x9'))(new Redis(config['redis']));require('./user.socket')[_0x739e('0xa')](socket);exports[_0x739e('0xb')]=function(_0x24c714){var _0x4854db=this;return new Promise(function(_0x2bd0d6,_0x5855c9){return db[_0x739e('0xc')]['findAll']({'raw':_0x24c714[_0x739e('0xd')]?_0x24c714[_0x739e('0xd')][_0x739e('0xe')]===undefined?!![]:![]:!![],'where':_0x24c714[_0x739e('0xd')]?_0x24c714[_0x739e('0xd')][_0x739e('0xf')]||null:null,'attributes':_0x24c714[_0x739e('0xd')]?_0x24c714[_0x739e('0xd')][_0x739e('0x10')]||null:null,'limit':_0x24c714[_0x739e('0xd')]?_0x24c714[_0x739e('0xd')][_0x739e('0x11')]||null:null,'include':_0x24c714['options']?_0x24c714[_0x739e('0xd')]['include']?_[_0x739e('0x12')](_0x24c714[_0x739e('0xd')][_0x739e('0x13')],function(_0x336f11){return{'model':db[_0x336f11[_0x739e('0x14')]],'as':_0x336f11['as'],'attributes':_0x336f11[_0x739e('0x10')],'include':_0x336f11['include']?_['map'](_0x336f11[_0x739e('0x13')],function(_0x3c55cf){return{'model':db[_0x3c55cf['model']],'as':_0x3c55cf['as'],'attributes':_0x3c55cf[_0x739e('0x10')],'include':_0x3c55cf[_0x739e('0x13')]?_[_0x739e('0x12')](_0x3c55cf[_0x739e('0x13')],function(_0x5bc3c4){return{'model':db[_0x5bc3c4[_0x739e('0x14')]],'as':_0x5bc3c4['as'],'attributes':_0x5bc3c4[_0x739e('0x10')]};}):[]};}):[]};}):[]:[]})[_0x739e('0x15')](function(_0x1a8a4b){logger[_0x739e('0x16')](_0x739e('0xb'),_0x24c714);logger[_0x739e('0x17')]('GetUser',_0x24c714,JSON[_0x739e('0x18')](_0x1a8a4b));_0x2bd0d6(_0x1a8a4b);})['catch'](function(_0x43a1cf){logger[_0x739e('0x19')](_0x739e('0xb'),_0x43a1cf['message'],_0x24c714);_0x5855c9(_0x4854db[_0x739e('0x19')](0x1f4,_0x43a1cf[_0x739e('0x1a')]));});});};exports[_0x739e('0x1b')]=function(_0x44caed){var _0x1eb80e=this;return new Promise(function(_0x598134,_0x37f957){return db[_0x739e('0xc')]['find']({'raw':_0x44caed[_0x739e('0xd')]?_0x44caed['options'][_0x739e('0xe')]===undefined?!![]:![]:!![],'where':_0x44caed[_0x739e('0xd')]?_0x44caed[_0x739e('0xd')][_0x739e('0xf')]||null:null,'attributes':_0x44caed[_0x739e('0xd')]?_0x44caed[_0x739e('0xd')][_0x739e('0x10')]||null:null,'include':_0x44caed[_0x739e('0xd')]?_0x44caed[_0x739e('0xd')][_0x739e('0x13')]?_[_0x739e('0x12')](_0x44caed[_0x739e('0xd')]['include'],function(_0x475b32){return{'model':db[_0x475b32[_0x739e('0x14')]],'as':_0x475b32['as'],'attributes':_0x475b32[_0x739e('0x10')],'include':_0x475b32[_0x739e('0x13')]?_[_0x739e('0x12')](_0x475b32[_0x739e('0x13')],function(_0xb8448a){return{'model':db[_0xb8448a[_0x739e('0x14')]],'as':_0xb8448a['as'],'attributes':_0xb8448a[_0x739e('0x10')],'include':_0xb8448a['include']?_[_0x739e('0x12')](_0xb8448a['include'],function(_0x21af05){return{'model':db[_0x21af05[_0x739e('0x14')]],'as':_0x21af05['as'],'attributes':_0x21af05[_0x739e('0x10')]};}):[]};}):[]};}):[]:[]})[_0x739e('0x15')](function(_0x376fe0){logger[_0x739e('0x16')]('ShowUser',_0x44caed);logger[_0x739e('0x17')](_0x739e('0x1b'),_0x44caed,JSON['stringify'](_0x376fe0));_0x598134(_0x376fe0);})['catch'](function(_0x377c59){logger[_0x739e('0x19')]('ShowUser',_0x377c59[_0x739e('0x1a')],_0x44caed);_0x37f957(_0x1eb80e[_0x739e('0x19')](0x1f4,_0x377c59['message']));});});};exports[_0x739e('0x1c')]=function(_0x170ad0){var _0x26ad2a;return db[_0x739e('0xc')][_0x739e('0x1d')]({'where':_0x170ad0['options'][_0x739e('0xf')]||{},'attributes':['id',_0x739e('0x1e'),_0x739e('0x1f'),_0x739e('0x20'),_0x739e('0x21')]})[_0x739e('0x15')](function(_0x30702a){if(!_0x30702a){throw new Error(util[_0x739e('0x22')]('User\x20with\x20id\x20%s\x20not\x20found',_0x170ad0[_0x739e('0x23')]['id']));}_0x26ad2a=_0x30702a;return db[_0x739e('0x24')][_0x739e('0x25')]({'paused':0x1},{'where':{'UserId':_0x26ad2a['id']},'individualHooks':!![]});})[_0x739e('0x15')](function(){return db[_0x739e('0x26')][_0x739e('0x27')]({'where':{'membername':_0x26ad2a[_0x739e('0x1e')],'type':_0x739e('0x28'),'exitAt':null}});})[_0x739e('0x15')](function(_0xc03dc2){if(_0xc03dc2&&_0xc03dc2[_0x739e('0x29')]){var _0x16a139=moment()[_0x739e('0x22')](_0x739e('0x2a'));for(var _0x13b9d5=0x0,_0x3ba626=_0xc03dc2[_0x739e('0x29')];_0x13b9d5<_0x3ba626;_0x13b9d5++){_0xc03dc2[_0x13b9d5][_0x739e('0x2b')]({'exitAt':_0x16a139});}}})[_0x739e('0x15')](function(){var _0x16146f=[];var _0x5d1062=utils[_0x739e('0x2c')]();_0x5d1062['forEach'](function(_0x5f54aa){_0x16146f[_0x739e('0x2d')]({'channel':_0x5f54aa,'membername':_0x26ad2a[_0x739e('0x1e')],'interface':_[_0x739e('0x2e')](_0x26ad2a['interface'])?util[_0x739e('0x22')](_0x739e('0x2f'),_0x26ad2a[_0x739e('0x1e')]):_0x26ad2a['interface'],'type':_0x739e('0x28'),'enterAt':moment()[_0x739e('0x22')](_0x739e('0x2a')),'data1':_0x170ad0[_0x739e('0x30')][_0x739e('0x31')]||'DEFAULT\x20PAUSE','role':_0x26ad2a[_0x739e('0x1f')],'internal':_0x26ad2a[_0x739e('0x20')],'uniqueid':_0x170ad0['body'][_0x739e('0x32')]||null});});return db['MemberReport'][_0x739e('0x33')](_0x16146f,{'individualHooks':!![]});})['then'](function(){return _0x26ad2a[_0x739e('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x170ad0[_0x739e('0x30')][_0x739e('0x31')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x739e('0x22')](_0x739e('0x2a'))});})[_0x739e('0x34')](function(_0x4af1c9){throw _0x4af1c9;});};exports[_0x739e('0x35')]=function(_0x4a5508){return Promise[_0x739e('0x36')]()['then'](function(){if(_0x4a5508[_0x739e('0x30')][_0x739e('0x37')]&&!utils[_0x739e('0x38')](_0x4a5508['body']['channel'])){throw new Error(util['format'](_0x739e('0x39'),_0x4a5508[_0x739e('0x30')][_0x739e('0x37')]));}return db[_0x739e('0xc')][_0x739e('0x3a')]({'where':_0x4a5508[_0x739e('0xd')][_0x739e('0xf')]||{},'attributes':['id',_0x739e('0x1e'),_0x739e('0x1f'),_0x739e('0x20'),_0x739e('0x21'),_0x739e('0x3b'),_0x739e('0x3c'),_0x739e('0x3d'),_0x739e('0x3e'),'faxPause',_0x739e('0x3f'),_0x739e('0x40'),_0x739e('0x41'),_0x739e('0x42'),_0x739e('0x43')]});})['then'](function(_0x52cb84){if(!_0x52cb84){throw new Error(util[_0x739e('0x22')](_0x739e('0x44'),_0x4a5508['params']['id']));}return _0x52cb84[_0x739e('0x45')](_0x4a5508['body']['channel'],'system');})[_0x739e('0x34')](function(_0x5abb41){throw _0x5abb41;});};exports['LogoutUser']=function(_0xf07a7d){var _0xe28d0a=this;return new Promise(function(_0x448890,_0x569552){var _0x1e2979;return db[_0x739e('0xc')]['findOne']({'where':_0xf07a7d[_0x739e('0xd')][_0x739e('0xf')]||{},'attributes':['id',_0x739e('0x1e')]})[_0x739e('0x15')](function(_0x501970){if(_0x501970){_0x1e2979=_0x501970;return db['UserVoiceQueueRt'][_0x739e('0x46')]({'where':{'membername':_0x1e2979['name']},'individualHooks':!![]});}})[_0x739e('0x15')](function(){if(_0x1e2979){return db[_0x739e('0x26')][_0x739e('0x27')]({'where':{'membername':_0x1e2979[_0x739e('0x1e')],'exitAt':null}});}})[_0x739e('0x15')](function(_0xeed83d){if(_0x1e2979){if(_0xeed83d&&_0xeed83d[_0x739e('0x29')]){var _0x58badd=[];_0xeed83d[_0x739e('0x47')](function(_0x8609e8){_0x58badd[_0x739e('0x2d')](_0x8609e8[_0x739e('0x25')]({'exitAt':moment()[_0x739e('0x22')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x58badd);}}})['then'](function(){if(_0x1e2979){return _0x1e2979['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x739e('0x15')](function(_0x504787){_0x448890(_0x504787);})[_0x739e('0x34')](function(_0x39ef5a){_0x569552(_0xe28d0a[_0x739e('0x19')](0x1f4,_0x39ef5a['message']));});});};exports[_0x739e('0x48')]=function(_0x3ea553){var _0x1748e3=this;return new Promise(function(_0x577535,_0x2ed7db){var _0x2fd762;var _0x3cecc6;var _0x266498;var _0x3a7b79;return db[_0x739e('0xc')]['findOne']({'where':_0x3ea553[_0x739e('0xd')][_0x739e('0xf')]||{},'attributes':['id',_0x739e('0x1e'),_0x739e('0x1f'),'mobile',_0x739e('0x49'),_0x739e('0x20'),_0x739e('0x4a'),_0x739e('0x21')]})[_0x739e('0x15')](function(_0x2b8ea4){if(_0x2b8ea4){_0x2fd762=_0x2b8ea4;_0x3a7b79=_0x3ea553[_0x739e('0x30')][_0x739e('0x21')]?_0x3ea553[_0x739e('0x30')]['interface']:util[_0x739e('0x22')](_0x739e('0x2f'),_0x2fd762[_0x739e('0x1e')]);return db[_0x739e('0xc')][_0x739e('0x4b')]({'where':{'role':_0x739e('0x4c'),'online':!![],'id':{'$ne':_0x2fd762['id']}}});}})[_0x739e('0x15')](function(_0x3e0828){if(_0x3e0828){_0x266498=_0x3e0828;return require(_0x739e('0x4d'))[_0x739e('0x4e')]();}})[_0x739e('0x15')](function(_0xc7bea4){if(_0xc7bea4&&_0xc7bea4[_0x739e('0x4f')]&&_0x266498>=_0xc7bea4[_0x739e('0x4f')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x739e('0x15')](function(){if(_0x2fd762){return db['UserVoiceQueueRt'][_0x739e('0x46')]({'where':{'membername':_0x2fd762[_0x739e('0x1e')]},'individualHooks':!![]});}})[_0x739e('0x15')](function(){if(_0x2fd762){return _0x2fd762['getVoiceQueues']({'raw':!![]});}})[_0x739e('0x15')](function(_0x30e6ac){if(_0x2fd762){if(_0x30e6ac){var _0xa00b0e=[];_0x3cecc6=_0x30e6ac;if(_0x3cecc6['length']){for(var _0x37e759=0x0;_0x37e759<_0x3cecc6[_0x739e('0x29')];_0x37e759++){_0xa00b0e['push'](db['UserVoiceQueueRt'][_0x739e('0x50')]({'membername':_0x2fd762['name'],'UserId':_0x2fd762['id'],'queue_name':_0x3cecc6[_0x37e759]['name'],'VoiceQueueId':_0x3cecc6[_0x37e759]['id'],'interface':_0x3a7b79,'paused':_0x2fd762[_0x739e('0x4a')]||![],'penalty':_0x3cecc6[_0x37e759][_0x739e('0x51')]||0x0}));}return BPromise[_0x739e('0x52')](_0xa00b0e);}}}})[_0x739e('0x15')](function(){if(_0x2fd762){return db[_0x739e('0x26')][_0x739e('0x27')]({'where':{'membername':_0x2fd762[_0x739e('0x1e')],'exitAt':null}});}})[_0x739e('0x15')](function(_0x1ea05f){if(_0x2fd762){if(_0x1ea05f&&_0x1ea05f[_0x739e('0x29')]){var _0x30c330=[];_0x1ea05f[_0x739e('0x47')](function(_0x2cf351){_0x30c330[_0x739e('0x2d')](_0x2cf351[_0x739e('0x25')]({'exitAt':moment()[_0x739e('0x22')](_0x739e('0x2a'))}));});return BPromise[_0x739e('0x52')](_0x30c330);}}})[_0x739e('0x15')](function(){if(_0x2fd762){var _0xee9374=[];var _0x31b2ff=[];var _0x1b5ddf=utils[_0x739e('0x2c')]();var _0x24af5a={'membername':_0x2fd762['name'],'interface':_0x3a7b79,'enterAt':moment()[_0x739e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2fd762['role'],'internal':_0x2fd762[_0x739e('0x20')]};_0x1b5ddf[_0x739e('0x47')](function(_0x5e7fbd){_0xee9374[_0x739e('0x2d')](_[_0x739e('0x53')]({'channel':_0x5e7fbd,'type':'LOGIN','data1':_0x739e('0x54'),'data2':_0x3a7b79},_0x24af5a));if(_0x2fd762[_0x739e('0x4a')]){_0x31b2ff[_0x739e('0x2d')](_[_0x739e('0x53')]({'channel':_0x5e7fbd,'type':_0x739e('0x28'),'data1':_0x739e('0x55')},_0x24af5a));}});return db['MemberReport'][_0x739e('0x33')](_0xee9374[_0x739e('0x56')](_0x31b2ff),{'individualHooks':!![]});}})[_0x739e('0x15')](function(){if(_0x2fd762){return _0x2fd762[_0x739e('0x25')]({'online':!![],'lastLoginAt':moment()['format'](_0x739e('0x2a')),'voicePause':_0x2fd762[_0x739e('0x4a')]||![],'mailPause':_0x2fd762[_0x739e('0x4a')]||![],'chatPause':_0x2fd762[_0x739e('0x4a')]||![],'faxPause':_0x2fd762[_0x739e('0x4a')]||![],'smsPause':_0x2fd762[_0x739e('0x4a')]||![],'openchannelPause':_0x2fd762[_0x739e('0x4a')]||![],'pauseType':_0x2fd762['loginInPause']?_0x739e('0x55'):null,'lastPauseAt':moment()[_0x739e('0x22')](_0x739e('0x2a')),'interface':_0x3a7b79});}})[_0x739e('0x15')](function(_0x234aee){_0x577535(_0x234aee);})[_0x739e('0x34')](function(_0x3936fe){_0x2ed7db(_0x1748e3[_0x739e('0x19')](0x1f4,_0x3936fe[_0x739e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ba40a07..34cec8f 100644 --- a/server/api/user/user.socket.js +++ b/server/api/user/user.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3715=['save','remove','update','emit','removeListener','register'];(function(_0x5aea43,_0x35438d){var _0x2abe2b=function(_0x2ce3d2){while(--_0x2ce3d2){_0x5aea43['push'](_0x5aea43['shift']());}};_0x2abe2b(++_0x35438d);}(_0x3715,0xba));var _0x5371=function(_0x22e87a,_0x375a9f){_0x22e87a=_0x22e87a-0x0;var _0x24035c=_0x3715[_0x22e87a];return _0x24035c;};'use strict';var UserEvents=require('./user.events');var events=[_0x5371('0x0'),_0x5371('0x1'),_0x5371('0x2')];function createListener(_0x34168c,_0xc5920e){return function(_0x5cdaf1){_0xc5920e[_0x5371('0x3')](_0x34168c,_0x5cdaf1);};}function removeListener(_0x36118c,_0x16ab4c){return function(){UserEvents[_0x5371('0x4')](_0x36118c,_0x16ab4c);};}exports[_0x5371('0x5')]=function(_0x3f66d5){for(var _0x10df50=0x0,_0x2352e0=events['length'];_0x10df50<_0x2352e0;_0x10df50++){var _0x133924=events[_0x10df50];var _0x3df63d=createListener('user:'+_0x133924,_0x3f66d5);UserEvents['on'](_0x133924,_0x3df63d);}}; \ No newline at end of file +var _0xbf90=['user:','./user.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3eaf06,_0x1bf08d){var _0x4b16d2=function(_0xc1b0df){while(--_0xc1b0df){_0x3eaf06['push'](_0x3eaf06['shift']());}};_0x4b16d2(++_0x1bf08d);}(_0xbf90,0xbe));var _0x0bf9=function(_0x18bf0c,_0x194f5a){_0x18bf0c=_0x18bf0c-0x0;var _0x5e9cc3=_0xbf90[_0x18bf0c];return _0x5e9cc3;};'use strict';var UserEvents=require(_0x0bf9('0x0'));var events=[_0x0bf9('0x1'),_0x0bf9('0x2'),_0x0bf9('0x3')];function createListener(_0x1e55a8,_0x52890e){return function(_0x2a439f){_0x52890e[_0x0bf9('0x4')](_0x1e55a8,_0x2a439f);};}function removeListener(_0x3bf40d,_0x166189){return function(){UserEvents[_0x0bf9('0x5')](_0x3bf40d,_0x166189);};}exports[_0x0bf9('0x6')]=function(_0x29f9d7){for(var _0x9ab0bc=0x0,_0x19e7df=events[_0x0bf9('0x7')];_0x9ab0bc<_0x19e7df;_0x9ab0bc++){var _0x105c49=events[_0x9ab0bc];var _0x27bf25=createListener(_0x0bf9('0x8')+_0x105c49,_0x29f9d7);UserEvents['on'](_0x105c49,_0x27bf25);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6a428cc..b35bb19 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x148f84,_0x209f1f){var _0x5dd354=function(_0x2fefb8){while(--_0x2fefb8){_0x148f84['push'](_0x148f84['shift']());}};_0x5dd354(++_0x209f1f);}(_0xe706,0xa3));var _0x6e70=function(_0x22fb94,_0x9a235c){_0x22fb94=_0x22fb94-0x0;var _0x33da77=_0xe706[_0x22fb94];return _0x33da77;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1275b7,_0x457830){var _0x38524b=function(_0x51df7e){while(--_0x51df7e){_0x1275b7['push'](_0x1275b7['shift']());}};_0x38524b(++_0x457830);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 5ee89c1..39cabb3 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4215=['sequelize'];(function(_0x97b350,_0x3b85e1){var _0x5164d1=function(_0x429790){while(--_0x429790){_0x97b350['push'](_0x97b350['shift']());}};_0x5164d1(++_0x3b85e1);}(_0x4215,0x6e));var _0x5421=function(_0x21e9cf,_0x19387e){_0x21e9cf=_0x21e9cf-0x0;var _0x3515a9=_0x4215[_0x21e9cf];return _0x3515a9;};'use strict';var Sequelize=require(_0x5421('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa3d9=['exports','INTEGER'];(function(_0x5933a9,_0x11f1c2){var _0x1b4e5e=function(_0x379282){while(--_0x379282){_0x5933a9['push'](_0x5933a9['shift']());}};_0x1b4e5e(++_0x11f1c2);}(_0xa3d9,0x150));var _0x9a3d=function(_0x195c2c,_0x157ee4){_0x195c2c=_0x195c2c-0x0;var _0x35dbee=_0xa3d9[_0x195c2c];return _0x35dbee;};'use strict';var Sequelize=require('sequelize');module[_0x9a3d('0x0')]={'penalty':{'type':Sequelize[_0x9a3d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 6be649e..797b8be 100644 --- a/server/api/userChatQueue/userChatQueue.model.js +++ b/server/api/userChatQueue/userChatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0752=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1fcab5,_0x175c1e){var _0xa552b7=function(_0x105bd6){while(--_0x105bd6){_0x1fcab5['push'](_0x1fcab5['shift']());}};_0xa552b7(++_0x175c1e);}(_0x0752,0x19c));var _0x2075=function(_0x4ac738,_0x51a8be){_0x4ac738=_0x4ac738-0x0;var _0x862db6=_0x0752[_0x4ac738];return _0x862db6;};'use strict';var _=require(_0x2075('0x0'));var util=require(_0x2075('0x1'));var logger=require(_0x2075('0x2'))(_0x2075('0x3'));var moment=require(_0x2075('0x4'));var BPromise=require(_0x2075('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2075('0x6'));var rimraf=require(_0x2075('0x7'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x2075('0x8')]=function(_0x56a381,_0x30a7f2){return _0x56a381[_0x2075('0x9')](_0x2075('0xa'),attributes,{'tableName':_0x2075('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x264b=['request-promise','path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird'];(function(_0x50fef1,_0x1c06a1){var _0x2c19a6=function(_0x157d21){while(--_0x157d21){_0x50fef1['push'](_0x50fef1['shift']());}};_0x2c19a6(++_0x1c06a1);}(_0x264b,0x17c));var _0xb264=function(_0x3793e6,_0x3d919c){_0x3793e6=_0x3793e6-0x0;var _0x5b8d6f=_0x264b[_0x3793e6];return _0x5b8d6f;};'use strict';var _=require(_0xb264('0x0'));var util=require(_0xb264('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb264('0x2'));var BPromise=require(_0xb264('0x3'));var rp=require(_0xb264('0x4'));var fs=require('fs');var path=require(_0xb264('0x5'));var rimraf=require(_0xb264('0x6'));var config=require('../../config/environment');var attributes=require(_0xb264('0x7'));module[_0xb264('0x8')]=function(_0x50fe9f,_0x53f2f9){return _0x50fe9f[_0xb264('0x9')](_0xb264('0xa'),attributes,{'tableName':_0xb264('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 41ba7c1..846bb4e 100644 --- a/server/api/userChatQueue/userChatQueue.rpc.js +++ b/server/api/userChatQueue/userChatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9432=['../../mysqldb','../../config/utils','../../config/logger','http','request','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','result','moment','bluebird','randomstring','ioredis'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0x9432,0xb0));var _0x2943=function(_0x16f432,_0x44978b){_0x16f432=_0x16f432-0x0;var _0x9d6b36=_0x9432[_0x16f432];return _0x9d6b36;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2943('0x0'));var BPromise=require(_0x2943('0x1'));var rs=require(_0x2943('0x2'));var fs=require('fs');var Redis=require(_0x2943('0x3'));var db=require(_0x2943('0x4'))['db'];var utils=require(_0x2943('0x5'));var logger=require(_0x2943('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2943('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x585ee4,_0x1dcd96,_0x231269){return new BPromise(function(_0x355c91,_0x4d1680){return client[_0x2943('0x8')](_0x585ee4,_0x231269)['then'](function(_0x326d0c){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1dcd96,_0x2943('0x9'));logger['debug'](_0x2943('0xa'),_0x1dcd96,_0x2943('0x9'),JSON[_0x2943('0xb')](_0x326d0c));if(_0x326d0c[_0x2943('0xc')]){if(_0x326d0c[_0x2943('0xc')][_0x2943('0xd')]===0x1f4){logger[_0x2943('0xc')](_0x2943('0xe'),_0x1dcd96,_0x326d0c[_0x2943('0xc')][_0x2943('0xf')]);return _0x4d1680(_0x326d0c[_0x2943('0xc')][_0x2943('0xf')]);}logger[_0x2943('0xc')](_0x2943('0xe'),_0x1dcd96,_0x326d0c['error']['message']);return _0x355c91(_0x326d0c['error'][_0x2943('0xf')]);}else{logger[_0x2943('0x10')](_0x2943('0xe'),_0x1dcd96,_0x2943('0x9'));_0x355c91(_0x326d0c[_0x2943('0x11')][_0x2943('0xf')]);}})['catch'](function(_0x4c87d8){logger['error'](_0x2943('0xe'),_0x1dcd96,_0x4c87d8);_0x4d1680(_0x4c87d8);});});} \ No newline at end of file +var _0xf580=['client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xf580,0x174));var _0x0f58=function(_0x3df7ab,_0x1e757e){_0x3df7ab=_0x3df7ab-0x0;var _0x5cf38a=_0xf580[_0x3df7ab];return _0x5cf38a;};'use strict';var _=require(_0x0f58('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f58('0x1'));var rs=require(_0x0f58('0x2'));var fs=require('fs');var Redis=require(_0x0f58('0x3'));var db=require(_0x0f58('0x4'))['db'];var utils=require(_0x0f58('0x5'));var logger=require(_0x0f58('0x6'))(_0x0f58('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0f58('0x8')][_0x0f58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58fb4a,_0x488142,_0x232fd3){return new BPromise(function(_0x1a2202,_0x1ca806){return client[_0x0f58('0xa')](_0x58fb4a,_0x232fd3)['then'](function(_0xf32125){logger[_0x0f58('0xb')](_0x0f58('0xc'),_0x488142,_0x0f58('0xd'));logger[_0x0f58('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x488142,_0x0f58('0xd'),JSON[_0x0f58('0xf')](_0xf32125));if(_0xf32125['error']){if(_0xf32125[_0x0f58('0x10')][_0x0f58('0x11')]===0x1f4){logger[_0x0f58('0x10')](_0x0f58('0xc'),_0x488142,_0xf32125[_0x0f58('0x10')][_0x0f58('0x12')]);return _0x1ca806(_0xf32125[_0x0f58('0x10')][_0x0f58('0x12')]);}logger[_0x0f58('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x488142,_0xf32125[_0x0f58('0x10')]['message']);return _0x1a2202(_0xf32125[_0x0f58('0x10')][_0x0f58('0x12')]);}else{logger[_0x0f58('0xb')](_0x0f58('0xc'),_0x488142,_0x0f58('0xd'));_0x1a2202(_0xf32125[_0x0f58('0x13')]['message']);}})['catch'](function(_0x183a77){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x488142,_0x183a77);_0x1ca806(_0x183a77);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2bcf67b..fbddb66 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xc1b67e,_0x38e641){var _0x5d1736=function(_0x459dc5){while(--_0x459dc5){_0xc1b67e['push'](_0xc1b67e['shift']());}};_0x5d1736(++_0x38e641);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0xcb91[_0x13187a];return _0x65b85f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x31bf4a,_0x51eb5f){var _0x2265ec=function(_0x482a5a){while(--_0x482a5a){_0x31bf4a['push'](_0x31bf4a['shift']());}};_0x2265ec(++_0x51eb5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2068130..7520b76 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7ff=['STRING','exports','INTEGER'];(function(_0x334660,_0x3f19c3){var _0x30727c=function(_0x5541e8){while(--_0x5541e8){_0x334660['push'](_0x334660['shift']());}};_0x30727c(++_0x3f19c3);}(_0xb7ff,0x11e));var _0xfb7f=function(_0x5b6d31,_0x20de6a){_0x5b6d31=_0x5b6d31-0x0;var _0x2320d1=_0xb7ff[_0x5b6d31];return _0x2320d1;};'use strict';var Sequelize=require('sequelize');module[_0xfb7f('0x0')]={'penalty':{'type':Sequelize[_0xfb7f('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfb7f('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfb7f('0x2')]}}; \ No newline at end of file +var _0xd0e9=['STRING','exports','INTEGER'];(function(_0x40bc4a,_0x2f4fa6){var _0x497b7a=function(_0x5b5202){while(--_0x5b5202){_0x40bc4a['push'](_0x40bc4a['shift']());}};_0x497b7a(++_0x2f4fa6);}(_0xd0e9,0x1f0));var _0x9d0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd0e9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x9d0e('0x0')]={'penalty':{'type':Sequelize[_0x9d0e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9d0e('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9d0e('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c61186c..10ed41d 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6be0=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x5ec0ea,_0x4f15f8){var _0x29ea6b=function(_0x524f81){while(--_0x524f81){_0x5ec0ea['push'](_0x5ec0ea['shift']());}};_0x29ea6b(++_0x4f15f8);}(_0x6be0,0xd6));var _0x06be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x06be('0x0'));var util=require(_0x06be('0x1'));var logger=require('../../config/logger')(_0x06be('0x2'));var moment=require(_0x06be('0x3'));var BPromise=require('bluebird');var rp=require(_0x06be('0x4'));var fs=require('fs');var path=require(_0x06be('0x5'));var rimraf=require(_0x06be('0x6'));var config=require(_0x06be('0x7'));var attributes=require(_0x06be('0x8'));module[_0x06be('0x9')]=function(_0x36d373,_0xb11447){return _0x36d373[_0x06be('0xa')](_0x06be('0xb'),attributes,{'tableName':_0x06be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf34f=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2104fe,_0x2f2a9d){var _0x59f9d8=function(_0x122b72){while(--_0x122b72){_0x2104fe['push'](_0x2104fe['shift']());}};_0x59f9d8(++_0x2f2a9d);}(_0xf34f,0x94));var _0xff34=function(_0x60d728,_0x3638b3){_0x60d728=_0x60d728-0x0;var _0x401a42=_0xf34f[_0x60d728];return _0x401a42;};'use strict';var _=require(_0xff34('0x0'));var util=require(_0xff34('0x1'));var logger=require(_0xff34('0x2'))(_0xff34('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xff34('0x4'));var fs=require('fs');var path=require(_0xff34('0x5'));var rimraf=require(_0xff34('0x6'));var config=require(_0xff34('0x7'));var attributes=require(_0xff34('0x8'));module[_0xff34('0x9')]=function(_0x3efcf0,_0x521796){return _0x3efcf0[_0xff34('0xa')](_0xff34('0xb'),attributes,{'tableName':_0xff34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 7fd73b1..07a2cf6 100644 --- a/server/api/userFaxQueue/userFaxQueue.rpc.js +++ b/server/api/userFaxQueue/userFaxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc01e=['then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserFaxQueue,\x20%s,\x20%s','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request'];(function(_0x2f5e24,_0x483ea4){var _0x566d9f=function(_0x569c3){while(--_0x569c3){_0x2f5e24['push'](_0x2f5e24['shift']());}};_0x566d9f(++_0x483ea4);}(_0xc01e,0xa1));var _0xec01=function(_0x1a6158,_0x1ddf90){_0x1a6158=_0x1a6158-0x0;var _0x22906d=_0xc01e[_0x1a6158];return _0x22906d;};'use strict';var _=require(_0xec01('0x0'));var util=require(_0xec01('0x1'));var moment=require('moment');var BPromise=require(_0xec01('0x2'));var rs=require(_0xec01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec01('0x4'))['db'];var utils=require(_0xec01('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xec01('0x6'));var jayson=require(_0xec01('0x7'));var client=jayson['client'][_0xec01('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3312b0,_0x441ed1,_0x56d240){return new BPromise(function(_0x369f57,_0x1d3a1f){return client[_0xec01('0x9')](_0x3312b0,_0x56d240)[_0xec01('0xa')](function(_0x5689d5){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x441ed1,_0xec01('0xb'));logger[_0xec01('0xc')](_0xec01('0xd'),_0x441ed1,'request\x20sent',JSON['stringify'](_0x5689d5));if(_0x5689d5[_0xec01('0xe')]){if(_0x5689d5[_0xec01('0xe')][_0xec01('0xf')]===0x1f4){logger[_0xec01('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x441ed1,_0x5689d5[_0xec01('0xe')][_0xec01('0x10')]);return _0x1d3a1f(_0x5689d5[_0xec01('0xe')][_0xec01('0x10')]);}logger[_0xec01('0xe')](_0xec01('0x11'),_0x441ed1,_0x5689d5[_0xec01('0xe')][_0xec01('0x10')]);return _0x369f57(_0x5689d5[_0xec01('0xe')][_0xec01('0x10')]);}else{logger[_0xec01('0x12')](_0xec01('0x11'),_0x441ed1,_0xec01('0xb'));_0x369f57(_0x5689d5['result'][_0xec01('0x10')]);}})['catch'](function(_0x371472){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x441ed1,_0x371472);_0x1d3a1f(_0x371472);});});} \ No newline at end of file +var _0x4e8f=['client','http','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserFaxQueue,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x856b91,_0x4f7ee8){var _0x467df9=function(_0x22021e){while(--_0x22021e){_0x856b91['push'](_0x856b91['shift']());}};_0x467df9(++_0x4f7ee8);}(_0x4e8f,0x1ee));var _0xf4e8=function(_0x5aa275,_0x371985){_0x5aa275=_0x5aa275-0x0;var _0xbd076=_0x4e8f[_0x5aa275];return _0xbd076;};'use strict';var _=require(_0xf4e8('0x0'));var util=require('util');var moment=require(_0xf4e8('0x1'));var BPromise=require(_0xf4e8('0x2'));var rs=require(_0xf4e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4e8('0x4'))['db'];var utils=require(_0xf4e8('0x5'));var logger=require(_0xf4e8('0x6'))(_0xf4e8('0x7'));var config=require(_0xf4e8('0x8'));var jayson=require(_0xf4e8('0x9'));var client=jayson[_0xf4e8('0xa')][_0xf4e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x299bdd,_0x3ba0f4,_0x471b6a){return new BPromise(function(_0x492e6,_0x2644fe){return client['request'](_0x299bdd,_0x471b6a)[_0xf4e8('0xc')](function(_0xc47cd){logger[_0xf4e8('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x3ba0f4,_0xf4e8('0xe'));logger[_0xf4e8('0xf')](_0xf4e8('0x10'),_0x3ba0f4,_0xf4e8('0xe'),JSON[_0xf4e8('0x11')](_0xc47cd));if(_0xc47cd[_0xf4e8('0x12')]){if(_0xc47cd[_0xf4e8('0x12')][_0xf4e8('0x13')]===0x1f4){logger[_0xf4e8('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x3ba0f4,_0xc47cd['error'][_0xf4e8('0x14')]);return _0x2644fe(_0xc47cd['error'][_0xf4e8('0x14')]);}logger[_0xf4e8('0x12')](_0xf4e8('0x15'),_0x3ba0f4,_0xc47cd[_0xf4e8('0x12')]['message']);return _0x492e6(_0xc47cd[_0xf4e8('0x12')][_0xf4e8('0x14')]);}else{logger[_0xf4e8('0xd')](_0xf4e8('0x15'),_0x3ba0f4,_0xf4e8('0xe'));_0x492e6(_0xc47cd[_0xf4e8('0x16')][_0xf4e8('0x14')]);}})[_0xf4e8('0x17')](function(_0x178349){logger[_0xf4e8('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x3ba0f4,_0x178349);_0x2644fe(_0x178349);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b27d41c..357bdb4 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x514969,_0x568fb0){var _0x326d9f=function(_0x7724a9){while(--_0x7724a9){_0x514969['push'](_0x514969['shift']());}};_0x326d9f(++_0x568fb0);}(_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'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x460ab9,_0x3815ac){var _0x27ef6e=function(_0x19c0e8){while(--_0x19c0e8){_0x460ab9['push'](_0x460ab9['shift']());}};_0x27ef6e(++_0x3815ac);}(_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'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index a96f167..d010ccc 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3a3=['exports','INTEGER'];(function(_0x4d27ab,_0x296ce7){var _0x933b52=function(_0x5a9492){while(--_0x5a9492){_0x4d27ab['push'](_0x4d27ab['shift']());}};_0x933b52(++_0x296ce7);}(_0xb3a3,0x16a));var _0x3b3a=function(_0x143ba6,_0x2dc850){_0x143ba6=_0x143ba6-0x0;var _0x40df14=_0xb3a3[_0x143ba6];return _0x40df14;};'use strict';var Sequelize=require('sequelize');module[_0x3b3a('0x0')]={'penalty':{'type':Sequelize[_0x3b3a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb117=['sequelize','exports','INTEGER'];(function(_0x431140,_0x284950){var _0x47b968=function(_0x38dea3){while(--_0x38dea3){_0x431140['push'](_0x431140['shift']());}};_0x47b968(++_0x284950);}(_0xb117,0xb1));var _0x7b11=function(_0x545093,_0x5d8f02){_0x545093=_0x545093-0x0;var _0x19e36d=_0xb117[_0x545093];return _0x19e36d;};'use strict';var Sequelize=require(_0x7b11('0x0'));module[_0x7b11('0x1')]={'penalty':{'type':Sequelize[_0x7b11('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 2ac919c..0d2b4c2 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54a4=['UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x351d1f,_0x423b64){var _0x3da5d3=function(_0x17494e){while(--_0x17494e){_0x351d1f['push'](_0x351d1f['shift']());}};_0x3da5d3(++_0x423b64);}(_0x54a4,0x6e));var _0x454a=function(_0x5a51df,_0xa7ed0a){_0x5a51df=_0x5a51df-0x0;var _0x142dde=_0x54a4[_0x5a51df];return _0x142dde;};'use strict';var _=require(_0x454a('0x0'));var util=require('util');var logger=require(_0x454a('0x1'))(_0x454a('0x2'));var moment=require('moment');var BPromise=require(_0x454a('0x3'));var rp=require(_0x454a('0x4'));var fs=require('fs');var path=require(_0x454a('0x5'));var rimraf=require(_0x454a('0x6'));var config=require(_0x454a('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x454a('0x8')]=function(_0x1c3315,_0x172688){return _0x1c3315[_0x454a('0x9')](_0x454a('0xa'),attributes,{'tableName':_0x454a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2135=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','lodash','util','../../config/logger'];(function(_0x47aeb7,_0x14ad20){var _0xa18790=function(_0xc5236a){while(--_0xc5236a){_0x47aeb7['push'](_0x47aeb7['shift']());}};_0xa18790(++_0x14ad20);}(_0x2135,0xbd));var _0x5213=function(_0x1fe85b,_0x4d441b){_0x1fe85b=_0x1fe85b-0x0;var _0x53c0d6=_0x2135[_0x1fe85b];return _0x53c0d6;};'use strict';var _=require(_0x5213('0x0'));var util=require(_0x5213('0x1'));var logger=require(_0x5213('0x2'))(_0x5213('0x3'));var moment=require(_0x5213('0x4'));var BPromise=require('bluebird');var rp=require(_0x5213('0x5'));var fs=require('fs');var path=require(_0x5213('0x6'));var rimraf=require(_0x5213('0x7'));var config=require(_0x5213('0x8'));var attributes=require(_0x5213('0x9'));module['exports']=function(_0x196732,_0x338ef9){return _0x196732[_0x5213('0xa')](_0x5213('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 1700e34..edd8c37 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0xa928d1,_0x36f14b){var _0x5e8f6d=function(_0x1af3b8){while(--_0x1af3b8){_0xa928d1['push'](_0xa928d1['shift']());}};_0x5e8f6d(++_0x36f14b);}(_0xe14b,0x93));var _0xbe14=function(_0x2218d5,_0x3669be){_0x2218d5=_0x2218d5-0x0;var _0x52b0e7=_0xe14b[_0x2218d5];return _0x52b0e7;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20684f,_0x28c0f3){var _0x4d5651=function(_0x13372d){while(--_0x13372d){_0x20684f['push'](_0x20684f['shift']());}};_0x4d5651(++_0x28c0f3);}(_0x6aa7,0x178));var _0x76aa=function(_0xeb6e78,_0x44867d){_0xeb6e78=_0xeb6e78-0x0;var _0x3dd30a=_0x6aa7[_0xeb6e78];return _0x3dd30a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 488b971..dbc8069 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3156=['isAuthenticated','sendUserNotification','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x5abdee,_0x24fc39){var _0x140870=function(_0x51e0c8){while(--_0x51e0c8){_0x5abdee['push'](_0x5abdee['shift']());}};_0x140870(++_0x24fc39);}(_0x3156,0x1df));var _0x6315=function(_0x18d453,_0x14f8c8){_0x18d453=_0x18d453-0x0;var _0x3f48ea=_0x3156[_0x18d453];return _0x3f48ea;};'use strict';var multer=require('multer');var util=require(_0x6315('0x0'));var path=require(_0x6315('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6315('0x2'));var interaction=require(_0x6315('0x3'));var config=require(_0x6315('0x4'));var controller=require(_0x6315('0x5'));router[_0x6315('0x6')]('/',auth[_0x6315('0x7')](),controller[_0x6315('0x8')]);module['exports']=router; \ No newline at end of file +var _0x9e33=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports'];(function(_0x27b3df,_0x34a01a){var _0x275390=function(_0x46e282){while(--_0x46e282){_0x27b3df['push'](_0x27b3df['shift']());}};_0x275390(++_0x34a01a);}(_0x9e33,0x104));var _0x39e3=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0x9e33[_0x40015a];return _0x42f8a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x39e3('0x0'));var timeout=require(_0x39e3('0x1'));var express=require(_0x39e3('0x2'));var router=express['Router']();var fs_extra=require(_0x39e3('0x3'));var auth=require(_0x39e3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x39e3('0x5'));var controller=require(_0x39e3('0x6'));router['post']('/',auth[_0x39e3('0x7')](),controller[_0x39e3('0x8')]);module[_0x39e3('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c3fdb39..dd47a1b 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d56=['BOOLEAN','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d56,0xc9));var _0x62d5=function(_0xd6d920,_0x9ae286){_0xd6d920=_0xd6d920-0x0;var _0x5b35f1=_0x2d56[_0xd6d920];return _0x5b35f1;};'use strict';var Sequelize=require(_0x62d5('0x0'));module[_0x62d5('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x62d5('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x62d5('0x2')]},'beep':{'type':Sequelize[_0x62d5('0x3')]}}; \ No newline at end of file +var _0x6b0f=['BOOLEAN','exports','STRING'];(function(_0x45d7a,_0x3df80b){var _0x518358=function(_0x1f2c03){while(--_0x1f2c03){_0x45d7a['push'](_0x45d7a['shift']());}};_0x518358(++_0x3df80b);}(_0x6b0f,0x178));var _0xf6b0=function(_0xbe029d,_0x5354a6){_0xbe029d=_0xbe029d-0x0;var _0x561a7c=_0x6b0f[_0xbe029d];return _0x561a7c;};'use strict';var Sequelize=require('sequelize');module[_0xf6b0('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xf6b0('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xf6b0('0x1')]},'beep':{'type':Sequelize[_0xf6b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 8ff56e4..4d11e75 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','recipients','parse','error','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','emit','text','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','startCase','model','queue','replace','Queue','ids','push','all','union','catch','findOne','eml-format','rimraf'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0x32f4,0xc6));var _0x432f=function(_0x385358,_0x4aebf7){_0x385358=_0x385358-0x0;var _0x5bd30f=_0x32f4[_0x385358];return _0x5bd30f;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require(_0x432f('0x2'));var jsonpatch=require(_0x432f('0x3'));var rp=require(_0x432f('0x4'));var moment=require(_0x432f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x432f('0x6'));var util=require('util');var path=require(_0x432f('0x7'));var sox=require('sox');var csv=require(_0x432f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x432f('0x9'));var _=require(_0x432f('0xa'));var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require(_0x432f('0xd'));var deskjs=require(_0x432f('0xe'));var toCsv=require(_0x432f('0x8'));var querystring=require(_0x432f('0xf'));var Papa=require(_0x432f('0x10'));var Redis=require(_0x432f('0x11'));var authService=require(_0x432f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x432f('0x13'));var hardwareService=require(_0x432f('0x14'));var logger=require(_0x432f('0x15'))(_0x432f('0x16'));var utils=require(_0x432f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x432f('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x432f('0x19'),'port':0x18eb});var socket=require(_0x432f('0x1a'))(new Redis(config[_0x432f('0x1b')]));require('./userNotification.socket')[_0x432f('0x1c')](socket);function respondWithStatusCode(_0x40c959,_0x10c2af){_0x10c2af=_0x10c2af||0xcc;return function(_0x46429c){if(_0x46429c){return _0x40c959[_0x432f('0x1d')](_0x10c2af);}return _0x40c959[_0x432f('0x1e')](_0x10c2af)[_0x432f('0x1f')]();};}function respondWithResult(_0x54b4d6,_0xe88f3d){_0xe88f3d=_0xe88f3d||0xc8;return function(_0x28a2f2){if(_0x28a2f2){return _0x54b4d6['status'](_0xe88f3d)[_0x432f('0x20')](_0x28a2f2);}};}function respondWithFilteredResult(_0x5789d3,_0x6a71d3){return function(_0x3bd6fe){if(_0x3bd6fe){var _0x5a43ff=typeof _0x6a71d3[_0x432f('0x21')]==='undefined'&&typeof _0x6a71d3['limit']==='undefined';var _0x3800d3=_0x3bd6fe[_0x432f('0x22')];var _0x538ab1=_0x5a43ff?0x0:_0x6a71d3[_0x432f('0x21')];var _0x5e4ffb=_0x5a43ff?_0x3bd6fe[_0x432f('0x22')]:_0x6a71d3[_0x432f('0x21')]+_0x6a71d3[_0x432f('0x23')];var _0x465815;if(_0x5e4ffb>=_0x3800d3){_0x5e4ffb=_0x3800d3;_0x465815=0xc8;}else{_0x465815=0xce;}_0x5789d3[_0x432f('0x1e')](_0x465815);return _0x5789d3[_0x432f('0x24')](_0x432f('0x25'),_0x538ab1+'-'+_0x5e4ffb+'/'+_0x3800d3)['json'](_0x3bd6fe);}return null;};}function patchUpdates(_0x4aeea8){return function(_0x2b9c0f){try{jsonpatch[_0x432f('0x26')](_0x2b9c0f,_0x4aeea8,!![]);}catch(_0x21f39a){return BPromise[_0x432f('0x27')](_0x21f39a);}return _0x2b9c0f[_0x432f('0x28')]();};}function saveUpdates(_0x23d274,_0x5a26bc){return function(_0x58ead1){if(_0x58ead1){return _0x58ead1[_0x432f('0x29')](_0x23d274)[_0x432f('0x2a')](function(_0x23cd9f){return _0x23cd9f;});}return null;};}function removeEntity(_0xed86e5,_0x2e42fd){return function(_0x4a489d){if(_0x4a489d){return _0x4a489d[_0x432f('0x2b')]()[_0x432f('0x2a')](function(){_0xed86e5[_0x432f('0x1e')](0xcc)[_0x432f('0x1f')]();});}};}function handleEntityNotFound(_0x5257ab,_0x18904a){return function(_0x215254){if(!_0x215254){_0x5257ab[_0x432f('0x1d')](0x194);}return _0x215254;};}function handleError(_0x220dce,_0x5592ee){_0x5592ee=_0x5592ee||0x1f4;return function(_0x1df0af){logger['error'](_0x1df0af[_0x432f('0x2c')]);if(_0x1df0af[_0x432f('0x2d')]){delete _0x1df0af[_0x432f('0x2d')];}_0x220dce[_0x432f('0x1e')](_0x5592ee)[_0x432f('0x2e')](_0x1df0af);};}exports[_0x432f('0x2f')]=function(_0x3c4cd5,_0x1a897f,_0x247095){if(!_0x3c4cd5[_0x432f('0x30')][_0x432f('0x31')]('text')&&!_0x3c4cd5[_0x432f('0x30')][_0x432f('0x31')](_0x432f('0x32'))){throw new db['Sequelize'][(_0x432f('0x33'))](_0x432f('0x34'));}else{if(_0x3c4cd5['body'][_0x432f('0x31')]('TemplateId')&&!_0x3c4cd5['body'][_0x432f('0x31')]('view')){throw new db[(_0x432f('0x35'))][(_0x432f('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x3c4cd5[_0x432f('0x30')]['hasOwnProperty'](_0x432f('0x36'))){throw new db[(_0x432f('0x35'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x38ad4a=JSON[_0x432f('0x37')](_0x3c4cd5[_0x432f('0x30')][_0x432f('0x36')]);}catch(_0x12bf3b){logger[_0x432f('0x38')](_0x12bf3b);throw new db[(_0x432f('0x35'))][(_0x432f('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x156c8d=[_0x432f('0x39'),_0x432f('0x3a'),_0x432f('0x3b'),_0x432f('0x3c'),_0x432f('0x3d'),_0x432f('0x3e'),'whatsappqueue',_0x432f('0x3f'),_0x432f('0x40')];if(_[_0x432f('0x41')](_0x38ad4a,function(_0x28da10){return!_[_0x432f('0x42')](_0x156c8d,_0x28da10['model']['toLowerCase']());})){throw new db['Sequelize'][(_0x432f('0x33'))](_0x432f('0x43'));}}}var _0x375bbe={};_0x375bbe[_0x432f('0x44')]=_0x3c4cd5[_0x432f('0x30')]['hasOwnProperty'](_0x432f('0x44'))?_0x3c4cd5['body']['senderName']:_0x3c4cd5[_0x432f('0x40')][_0x432f('0x45')];_0x375bbe[_0x432f('0x46')]=_[_0x432f('0x47')](_0x3c4cd5['body'][_0x432f('0x46')])?null:_0x3c4cd5[_0x432f('0x30')][_0x432f('0x46')];_0x375bbe['beep']=_0x3c4cd5[_0x432f('0x30')][_0x432f('0x48')]||![];_0x375bbe[_0x432f('0x49')]=_0x3c4cd5['user']['id'];return getContent(_0x3c4cd5[_0x432f('0x30')])[_0x432f('0x2a')](function(_0xc3c7fb){_0x375bbe['body']=_0xc3c7fb;return getRecipients(_0x38ad4a);})[_0x432f('0x2a')](function(_0x2642bb){_0x375bbe[_0x432f('0x4a')]=_[_0x432f('0x4b')](_0x2642bb)[_0x432f('0x4c')](',');return db[_0x432f('0x4d')][_0x432f('0x4e')](function(_0x1ac3d6){return db[_0x432f('0x4f')][_0x432f('0x50')](_0x375bbe,{'raw':!![],'transaction':_0x1ac3d6})[_0x432f('0x2a')](function(_0x15bac9){var _0x59176d={'sender':_0x375bbe[_0x432f('0x44')],'description':_0x375bbe['recipientsDescription'],'content':_0x375bbe[_0x432f('0x30')],'beep':_0x375bbe[_0x432f('0x48')]};_0x2642bb[_0x432f('0x51')](function(_0x408145){_0x59176d['recipient']=_0x408145;socket[_0x432f('0x52')]('userNotification:send',_0x59176d);});return _0x15bac9;});});})['then'](respondWithResult(_0x1a897f,0xc9))['catch'](handleError(_0x1a897f,null));};function getContent(_0x3d64c0){return new BPromise(function(_0x3bbc16,_0x4def9b){if(_0x3d64c0[_0x432f('0x53')]){_0x3bbc16(_0x3d64c0[_0x432f('0x53')]);return;}return db[_0x432f('0x54')]['findOne']({'attributes':['html'],'where':{'id':_0x3d64c0[_0x432f('0x32')]},'raw':!![]})[_0x432f('0x2a')](function(_0x28c08e){if(!_0x28c08e)throw new db['Sequelize'][(_0x432f('0x33'))](_0x432f('0x55'));var _0x8a6c76=Mustache[_0x432f('0x56')](_0x28c08e[_0x432f('0x57')],_0x3d64c0[_0x432f('0x58')]);_0x3bbc16(_0x8a6c76);})['catch'](function(_0x2c8960){_0x4def9b(_0x2c8960);});});}function getRecipients(_0x43634c){return new BPromise(function(_0x4c91bf,_0x8e98fc){var _0x550831=[];var _0x2f16fb=[];_0x43634c[_0x432f('0x51')](function(_0x5078d0){var _0x2113ab=_[_0x432f('0x59')](_0x5078d0[_0x432f('0x5a')]['toLowerCase']());if(_0x2113ab==='User'){_0x550831=_['union'](_0x550831,_0x5078d0['ids']);}else{if(_[_0x432f('0x42')](_0x2113ab,_0x432f('0x5b')))_0x2113ab=_0x2113ab[_0x432f('0x5c')](_0x432f('0x5b'),_0x432f('0x5d'));_0x5078d0[_0x432f('0x5e')][_0x432f('0x51')](function(_0x2bc3ba){_0x2f16fb[_0x432f('0x5f')](getAgents(_0x2113ab,_0x2bc3ba));});}});return BPromise[_0x432f('0x60')](_0x2f16fb)[_0x432f('0x2a')](function(_0x55582d){_0x550831=_[_0x432f('0x61')](_0x550831,_['flatten'](_0x55582d));_0x4c91bf(_0x550831);})[_0x432f('0x62')](function(_0x2f8500){_0x8e98fc(_0x2f8500);});});}function getAgents(_0x212056,_0x11341d){return new BPromise(function(_0x2c6d0d,_0x421a39){return db[_0x212056][_0x432f('0x63')]({'where':{'id':_0x11341d}})[_0x432f('0x2a')](function(_0x22fbc0){return _0x22fbc0['getAgents']({'attributes':['id'],'raw':!![]})[_0x432f('0x2a')](function(_0xe5e4f4){var _0x259ee7=_['map'](_0xe5e4f4,'id');_0x2c6d0d(_0x259ee7);});})['catch'](function(_0x49972c){_0x421a39(_0x49972c);});});} \ No newline at end of file +var _0x1bd6=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','sendUserNotification','body','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sortBy','sequelize','transaction','UserNotification','forEach','recipient','emit','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','includes','queue','Queue','ids','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x15bb39,_0x42bd41){var _0x88fadc=function(_0x177f6c){while(--_0x177f6c){_0x15bb39['push'](_0x15bb39['shift']());}};_0x88fadc(++_0x42bd41);}(_0x1bd6,0xb0));var _0x61bd=function(_0x1993d6,_0x312ae6){_0x1993d6=_0x1993d6-0x0;var _0x2fa45e=_0x1bd6[_0x1993d6];return _0x2fa45e;};'use strict';var emlformat=require(_0x61bd('0x0'));var rimraf=require(_0x61bd('0x1'));var zipdir=require(_0x61bd('0x2'));var jsonpatch=require(_0x61bd('0x3'));var rp=require(_0x61bd('0x4'));var moment=require(_0x61bd('0x5'));var BPromise=require(_0x61bd('0x6'));var Mustache=require(_0x61bd('0x7'));var util=require(_0x61bd('0x8'));var path=require(_0x61bd('0x9'));var sox=require(_0x61bd('0xa'));var csv=require('to-csv');var ejs=require(_0x61bd('0xb'));var fs=require('fs');var fs_extra=require(_0x61bd('0xc'));var _=require(_0x61bd('0xd'));var squel=require(_0x61bd('0xe'));var crypto=require(_0x61bd('0xf'));var jsforce=require(_0x61bd('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x61bd('0x11'));var querystring=require('querystring');var Papa=require(_0x61bd('0x12'));var Redis=require(_0x61bd('0x13'));var authService=require(_0x61bd('0x14'));var qs=require(_0x61bd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61bd('0x16'));var logger=require(_0x61bd('0x17'))('api');var utils=require(_0x61bd('0x18'));var config=require(_0x61bd('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x61bd('0x1a'))['db'];config[_0x61bd('0x1b')]=_['defaults'](config[_0x61bd('0x1b')],{'host':_0x61bd('0x1c'),'port':0x18eb});var socket=require(_0x61bd('0x1d'))(new Redis(config['redis']));require(_0x61bd('0x1e'))[_0x61bd('0x1f')](socket);function respondWithStatusCode(_0x12733f,_0x470705){_0x470705=_0x470705||0xcc;return function(_0x56a8ab){if(_0x56a8ab){return _0x12733f[_0x61bd('0x20')](_0x470705);}return _0x12733f[_0x61bd('0x21')](_0x470705)[_0x61bd('0x22')]();};}function respondWithResult(_0x33d382,_0x2207f1){_0x2207f1=_0x2207f1||0xc8;return function(_0x5dfa1f){if(_0x5dfa1f){return _0x33d382['status'](_0x2207f1)[_0x61bd('0x23')](_0x5dfa1f);}};}function respondWithFilteredResult(_0x5c9540,_0x14f0a9){return function(_0x1ddc64){if(_0x1ddc64){var _0x4ede1d=typeof _0x14f0a9[_0x61bd('0x24')]==='undefined'&&typeof _0x14f0a9[_0x61bd('0x25')]===_0x61bd('0x26');var _0x4ac6c0=_0x1ddc64[_0x61bd('0x27')];var _0x19aa8c=_0x4ede1d?0x0:_0x14f0a9[_0x61bd('0x24')];var _0x4dcd20=_0x4ede1d?_0x1ddc64[_0x61bd('0x27')]:_0x14f0a9[_0x61bd('0x24')]+_0x14f0a9['limit'];var _0x352a93;if(_0x4dcd20>=_0x4ac6c0){_0x4dcd20=_0x4ac6c0;_0x352a93=0xc8;}else{_0x352a93=0xce;}_0x5c9540['status'](_0x352a93);return _0x5c9540[_0x61bd('0x28')](_0x61bd('0x29'),_0x19aa8c+'-'+_0x4dcd20+'/'+_0x4ac6c0)[_0x61bd('0x23')](_0x1ddc64);}return null;};}function patchUpdates(_0x1bb3aa){return function(_0x10a0f7){try{jsonpatch[_0x61bd('0x2a')](_0x10a0f7,_0x1bb3aa,!![]);}catch(_0x48620b){return BPromise[_0x61bd('0x2b')](_0x48620b);}return _0x10a0f7['save']();};}function saveUpdates(_0x34c453,_0x1ed0db){return function(_0x5bfffa){if(_0x5bfffa){return _0x5bfffa[_0x61bd('0x2c')](_0x34c453)[_0x61bd('0x2d')](function(_0x4e7a69){return _0x4e7a69;});}return null;};}function removeEntity(_0x3a80ba,_0x3abbf9){return function(_0x359f5c){if(_0x359f5c){return _0x359f5c[_0x61bd('0x2e')]()[_0x61bd('0x2d')](function(){_0x3a80ba[_0x61bd('0x21')](0xcc)[_0x61bd('0x22')]();});}};}function handleEntityNotFound(_0x6a289e,_0x3e982a){return function(_0x4b5335){if(!_0x4b5335){_0x6a289e[_0x61bd('0x20')](0x194);}return _0x4b5335;};}function handleError(_0x157d4c,_0x3b395d){_0x3b395d=_0x3b395d||0x1f4;return function(_0x53dd0a){logger[_0x61bd('0x2f')](_0x53dd0a[_0x61bd('0x30')]);if(_0x53dd0a[_0x61bd('0x31')]){delete _0x53dd0a[_0x61bd('0x31')];}_0x157d4c[_0x61bd('0x21')](_0x3b395d)['send'](_0x53dd0a);};}exports[_0x61bd('0x32')]=function(_0x418b57,_0x4fe304,_0x1d6808){if(!_0x418b57[_0x61bd('0x33')]['hasOwnProperty'](_0x61bd('0x34'))&&!_0x418b57[_0x61bd('0x33')]['hasOwnProperty'](_0x61bd('0x35'))){throw new db[(_0x61bd('0x36'))]['ValidationError'](_0x61bd('0x37'));}else{if(_0x418b57[_0x61bd('0x33')][_0x61bd('0x38')](_0x61bd('0x35'))&&!_0x418b57[_0x61bd('0x33')][_0x61bd('0x38')](_0x61bd('0x39'))){throw new db[(_0x61bd('0x36'))][(_0x61bd('0x3a'))](_0x61bd('0x3b'));}if(!_0x418b57[_0x61bd('0x33')][_0x61bd('0x38')](_0x61bd('0x3c'))){throw new db[(_0x61bd('0x36'))][(_0x61bd('0x3a'))](_0x61bd('0x3d'));}else{try{var _0x462475=JSON[_0x61bd('0x3e')](_0x418b57['body'][_0x61bd('0x3c')]);}catch(_0x1be7a9){logger[_0x61bd('0x2f')](_0x1be7a9);throw new db[(_0x61bd('0x36'))]['ValidationError'](_0x61bd('0x3f'));}var _0x53903e=[_0x61bd('0x40'),'faxqueue','mailqueue',_0x61bd('0x41'),'smsqueue',_0x61bd('0x42'),_0x61bd('0x43'),_0x61bd('0x44'),_0x61bd('0x45')];if(_['some'](_0x462475,function(_0x18b7e8){return!_['includes'](_0x53903e,_0x18b7e8['model'][_0x61bd('0x46')]());})){throw new db[(_0x61bd('0x36'))]['ValidationError'](_0x61bd('0x47'));}}}var _0x5d5095={};_0x5d5095[_0x61bd('0x48')]=_0x418b57[_0x61bd('0x33')][_0x61bd('0x38')](_0x61bd('0x48'))?_0x418b57['body'][_0x61bd('0x48')]:_0x418b57[_0x61bd('0x45')][_0x61bd('0x49')];_0x5d5095['recipientsDescription']=_[_0x61bd('0x4a')](_0x418b57['body'][_0x61bd('0x4b')])?null:_0x418b57[_0x61bd('0x33')][_0x61bd('0x4b')];_0x5d5095[_0x61bd('0x4c')]=_0x418b57[_0x61bd('0x33')][_0x61bd('0x4c')]||![];_0x5d5095[_0x61bd('0x4d')]=_0x418b57['user']['id'];return getContent(_0x418b57[_0x61bd('0x33')])[_0x61bd('0x2d')](function(_0x1920b9){_0x5d5095[_0x61bd('0x33')]=_0x1920b9;return getRecipients(_0x462475);})['then'](function(_0x49aa84){_0x5d5095['recipientsId']=_[_0x61bd('0x4e')](_0x49aa84)['join'](',');return db[_0x61bd('0x4f')][_0x61bd('0x50')](function(_0x269e94){return db[_0x61bd('0x51')]['create'](_0x5d5095,{'raw':!![],'transaction':_0x269e94})['then'](function(_0x2dcc70){var _0x2c6b3c={'sender':_0x5d5095[_0x61bd('0x48')],'description':_0x5d5095['recipientsDescription'],'content':_0x5d5095['body'],'beep':_0x5d5095[_0x61bd('0x4c')]};_0x49aa84[_0x61bd('0x52')](function(_0x4862a8){_0x2c6b3c[_0x61bd('0x53')]=_0x4862a8;socket[_0x61bd('0x54')]('userNotification:send',_0x2c6b3c);});return _0x2dcc70;});});})[_0x61bd('0x2d')](respondWithResult(_0x4fe304,0xc9))[_0x61bd('0x55')](handleError(_0x4fe304,null));};function getContent(_0x17f9f4){return new BPromise(function(_0x2b3218,_0x4906d2){if(_0x17f9f4['text']){_0x2b3218(_0x17f9f4[_0x61bd('0x34')]);return;}return db['Template'][_0x61bd('0x56')]({'attributes':[_0x61bd('0x57')],'where':{'id':_0x17f9f4[_0x61bd('0x35')]},'raw':!![]})[_0x61bd('0x2d')](function(_0x5ea280){if(!_0x5ea280)throw new db[(_0x61bd('0x36'))]['ValidationError'](_0x61bd('0x58'));var _0x29441a=Mustache[_0x61bd('0x59')](_0x5ea280[_0x61bd('0x57')],_0x17f9f4[_0x61bd('0x39')]);_0x2b3218(_0x29441a);})[_0x61bd('0x55')](function(_0x287022){_0x4906d2(_0x287022);});});}function getRecipients(_0x14f4ab){return new BPromise(function(_0x2cf19b,_0x39690a){var _0x2c1f7a=[];var _0x59a773=[];_0x14f4ab[_0x61bd('0x52')](function(_0x59ea9d){var _0x48e8be=_[_0x61bd('0x5a')](_0x59ea9d['model'][_0x61bd('0x46')]());if(_0x48e8be===_0x61bd('0x5b')){_0x2c1f7a=_[_0x61bd('0x5c')](_0x2c1f7a,_0x59ea9d['ids']);}else{if(_[_0x61bd('0x5d')](_0x48e8be,_0x61bd('0x5e')))_0x48e8be=_0x48e8be['replace'](_0x61bd('0x5e'),_0x61bd('0x5f'));_0x59ea9d[_0x61bd('0x60')][_0x61bd('0x52')](function(_0x9b3991){_0x59a773['push'](getAgents(_0x48e8be,_0x9b3991));});}});return BPromise['all'](_0x59a773)['then'](function(_0x431a87){_0x2c1f7a=_[_0x61bd('0x5c')](_0x2c1f7a,_['flatten'](_0x431a87));_0x2cf19b(_0x2c1f7a);})[_0x61bd('0x55')](function(_0x58faba){_0x39690a(_0x58faba);});});}function getAgents(_0xa69efb,_0x3e43ff){return new BPromise(function(_0x14deb4,_0x41c994){return db[_0xa69efb][_0x61bd('0x56')]({'where':{'id':_0x3e43ff}})['then'](function(_0xcf427e){return _0xcf427e[_0x61bd('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b71d9){var _0x593b44=_[_0x61bd('0x62')](_0x4b71d9,'id');_0x14deb4(_0x593b44);});})[_0x61bd('0x55')](function(_0x8698f4){_0x41c994(_0x8698f4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 289d180..495a601 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78bc=['hook','exports','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x78bc,0x198));var _0xc78b=function(_0x16ffb8,_0x17d477){_0x16ffb8=_0x16ffb8-0x0;var _0x2b63b2=_0x78bc[_0x16ffb8];return _0x2b63b2;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc78b('0x0')](0x0);var events={'afterCreate':_0xc78b('0x1'),'afterUpdate':'update','afterDestroy':_0xc78b('0x2')};function emitEvent(_0x1e364c){return function(_0x495709,_0x249b3a,_0x199a90){UserNotificationEvents['emit'](_0x1e364c+':'+_0x495709['id'],_0x495709);UserNotificationEvents[_0xc78b('0x3')](_0x1e364c,_0x495709);_0x199a90(null);};}for(var e in events){if(events[_0xc78b('0x4')](e)){var event=events[e];UserNotification[_0xc78b('0x5')](e,emitEvent(event));}}module[_0xc78b('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x8207=['../../mysqldb','UserNotification','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3cd28f,_0x100f03){var _0x5ded05=function(_0x5b79d8){while(--_0x5b79d8){_0x3cd28f['push'](_0x3cd28f['shift']());}};_0x5ded05(++_0x100f03);}(_0x8207,0xbf));var _0x7820=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8207[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x7820('0x0'));var UserNotification=require(_0x7820('0x1'))['db'][_0x7820('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7820('0x3'),'afterDestroy':_0x7820('0x4')};function emitEvent(_0x552d23){return function(_0x4cae2b,_0xe1d6a4,_0x1d2c81){UserNotificationEvents[_0x7820('0x5')](_0x552d23+':'+_0x4cae2b['id'],_0x4cae2b);UserNotificationEvents[_0x7820('0x5')](_0x552d23,_0x4cae2b);_0x1d2c81(null);};}for(var e in events){if(events[_0x7820('0x6')](e)){var event=events[e];UserNotification[_0x7820('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 8af61f4..a4dbbdc 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25d4=['request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x3b9bb7,_0x4e24df){var _0x4c0b9e=function(_0x3ab385){while(--_0x3ab385){_0x3b9bb7['push'](_0x3b9bb7['shift']());}};_0x4c0b9e(++_0x4e24df);}(_0x25d4,0x15c));var _0x425d=function(_0x338d0f,_0x720406){_0x338d0f=_0x338d0f-0x0;var _0xfa44e5=_0x25d4[_0x338d0f];return _0xfa44e5;};'use strict';var _=require(_0x425d('0x0'));var util=require('util');var logger=require(_0x425d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x425d('0x2'));var fs=require('fs');var path=require(_0x425d('0x3'));var rimraf=require(_0x425d('0x4'));var config=require(_0x425d('0x5'));var attributes=require(_0x425d('0x6'));module[_0x425d('0x7')]=function(_0x4f1f53,_0x1dd9dc){return _0x4f1f53['define'](_0x425d('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x425d('0x9')});}; \ No newline at end of file +var _0x7321=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x46125c,_0x43cef8){var _0x57b32c=function(_0x5ad3bc){while(--_0x5ad3bc){_0x46125c['push'](_0x46125c['shift']());}};_0x57b32c(++_0x43cef8);}(_0x7321,0x1e1));var _0x1732=function(_0x513683,_0x56bd88){_0x513683=_0x513683-0x0;var _0x6028e=_0x7321[_0x513683];return _0x6028e;};'use strict';var _=require('lodash');var util=require(_0x1732('0x0'));var logger=require('../../config/logger')(_0x1732('0x1'));var moment=require(_0x1732('0x2'));var BPromise=require(_0x1732('0x3'));var rp=require(_0x1732('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1732('0x5'));var config=require(_0x1732('0x6'));var attributes=require(_0x1732('0x7'));module[_0x1732('0x8')]=function(_0x56f592,_0x531b86){return _0x56f592[_0x1732('0x9')](_0x1732('0xa'),attributes,{'tableName':_0x1732('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1732('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b3832c2..b59358f 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce54=['defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x253e69,_0xff2236){var _0x3e6b5c=function(_0x334173){while(--_0x334173){_0x253e69['push'](_0x253e69['shift']());}};_0x3e6b5c(++_0xff2236);}(_0xce54,0x138));var _0x4ce5=function(_0x59723f,_0x3b4154){_0x59723f=_0x59723f-0x0;var _0x4532a1=_0xce54[_0x59723f];return _0x4532a1;};'use strict';var _=require('lodash');var util=require(_0x4ce5('0x0'));var moment=require('moment');var BPromise=require(_0x4ce5('0x1'));var rs=require(_0x4ce5('0x2'));var fs=require('fs');var Redis=require(_0x4ce5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ce5('0x4'));var logger=require(_0x4ce5('0x5'))(_0x4ce5('0x6'));var config=require(_0x4ce5('0x7'));var jayson=require(_0x4ce5('0x8'));var client=jayson[_0x4ce5('0x9')][_0x4ce5('0xa')]({'port':0x232a});config[_0x4ce5('0xb')]=_[_0x4ce5('0xc')](config[_0x4ce5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ce5('0xd'))(new Redis(config[_0x4ce5('0xb')]));require(_0x4ce5('0xe'))[_0x4ce5('0xf')](socket);function respondWithRpcPromise(_0x535f48,_0x436c27,_0x511d92){return new BPromise(function(_0x10e481,_0xd7c92f){return client[_0x4ce5('0x10')](_0x535f48,_0x511d92)[_0x4ce5('0x11')](function(_0x3369c0){logger[_0x4ce5('0x12')](_0x4ce5('0x13'),_0x436c27,_0x4ce5('0x14'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x436c27,_0x4ce5('0x14'),JSON[_0x4ce5('0x15')](_0x3369c0));if(_0x3369c0[_0x4ce5('0x16')]){if(_0x3369c0[_0x4ce5('0x16')][_0x4ce5('0x17')]===0x1f4){logger[_0x4ce5('0x16')](_0x4ce5('0x13'),_0x436c27,_0x3369c0[_0x4ce5('0x16')][_0x4ce5('0x18')]);return _0xd7c92f(_0x3369c0[_0x4ce5('0x16')][_0x4ce5('0x18')]);}logger[_0x4ce5('0x16')]('UserNotification,\x20%s,\x20%s',_0x436c27,_0x3369c0[_0x4ce5('0x16')][_0x4ce5('0x18')]);return _0x10e481(_0x3369c0['error'][_0x4ce5('0x18')]);}else{logger[_0x4ce5('0x12')](_0x4ce5('0x13'),_0x436c27,_0x4ce5('0x14'));_0x10e481(_0x3369c0[_0x4ce5('0x19')][_0x4ce5('0x18')]);}})[_0x4ce5('0x1a')](function(_0x54c5b3){logger[_0x4ce5('0x16')]('UserNotification,\x20%s,\x20%s',_0x436c27,_0x54c5b3);_0xd7c92f(_0x54c5b3);});});} \ No newline at end of file +var _0xae68=['rpc','jayson/promise','client','http','redis','defaults','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','ioredis'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xae68,0xe1));var _0x8ae6=function(_0x5e9693,_0x1eb992){_0x5e9693=_0x5e9693-0x0;var _0x5163e8=_0xae68[_0x5e9693];return _0x5163e8;};'use strict';var _=require(_0x8ae6('0x0'));var util=require(_0x8ae6('0x1'));var moment=require(_0x8ae6('0x2'));var BPromise=require(_0x8ae6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ae6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ae6('0x5'));var config=require('../../config/environment');var jayson=require(_0x8ae6('0x6'));var client=jayson[_0x8ae6('0x7')][_0x8ae6('0x8')]({'port':0x232a});config[_0x8ae6('0x9')]=_[_0x8ae6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ae6('0xb'))['register'](socket);function respondWithRpcPromise(_0x255436,_0x25ad76,_0x4eebac){return new BPromise(function(_0x576eb6,_0x52c3f7){return client[_0x8ae6('0xc')](_0x255436,_0x4eebac)[_0x8ae6('0xd')](function(_0x5a0bbe){logger[_0x8ae6('0xe')](_0x8ae6('0xf'),_0x25ad76,'request\x20sent');logger[_0x8ae6('0x10')](_0x8ae6('0x11'),_0x25ad76,_0x8ae6('0x12'),JSON[_0x8ae6('0x13')](_0x5a0bbe));if(_0x5a0bbe['error']){if(_0x5a0bbe[_0x8ae6('0x14')][_0x8ae6('0x15')]===0x1f4){logger[_0x8ae6('0x14')](_0x8ae6('0xf'),_0x25ad76,_0x5a0bbe[_0x8ae6('0x14')][_0x8ae6('0x16')]);return _0x52c3f7(_0x5a0bbe[_0x8ae6('0x14')]['message']);}logger['error'](_0x8ae6('0xf'),_0x25ad76,_0x5a0bbe[_0x8ae6('0x14')][_0x8ae6('0x16')]);return _0x576eb6(_0x5a0bbe[_0x8ae6('0x14')][_0x8ae6('0x16')]);}else{logger['info'](_0x8ae6('0xf'),_0x25ad76,_0x8ae6('0x12'));_0x576eb6(_0x5a0bbe['result'][_0x8ae6('0x16')]);}})['catch'](function(_0x37bbb7){logger[_0x8ae6('0x14')](_0x8ae6('0xf'),_0x25ad76,_0x37bbb7);_0x52c3f7(_0x37bbb7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 1acebe8..9fbaa9c 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cfa=['userNotification:','./userNotification.events','save','remove','emit','removeListener','register','length'];(function(_0x4ed9ef,_0x381176){var _0x2bb85b=function(_0x35c24d){while(--_0x35c24d){_0x4ed9ef['push'](_0x4ed9ef['shift']());}};_0x2bb85b(++_0x381176);}(_0x7cfa,0x111));var _0xa7cf=function(_0x27c0eb,_0x20e036){_0x27c0eb=_0x27c0eb-0x0;var _0xd62696=_0x7cfa[_0x27c0eb];return _0xd62696;};'use strict';var UserNotificationEvents=require(_0xa7cf('0x0'));var events=[_0xa7cf('0x1'),_0xa7cf('0x2'),'update'];function createListener(_0x352783,_0x1b8269){return function(_0x21370c){_0x1b8269[_0xa7cf('0x3')](_0x352783,_0x21370c);};}function removeListener(_0xb43fb6,_0x379454){return function(){UserNotificationEvents[_0xa7cf('0x4')](_0xb43fb6,_0x379454);};}exports[_0xa7cf('0x5')]=function(_0x8b2b01){for(var _0x388537=0x0,_0x5a7664=events[_0xa7cf('0x6')];_0x388537<_0x5a7664;_0x388537++){var _0x2c70e2=events[_0x388537];var _0x5d0778=createListener(_0xa7cf('0x7')+_0x2c70e2,_0x8b2b01);UserNotificationEvents['on'](_0x2c70e2,_0x5d0778);}}; \ No newline at end of file +var _0x3c61=['register','length','userNotification:','save','remove','update','emit','removeListener'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x3c61,0x1cb));var _0x13c6=function(_0x394a23,_0x352f67){_0x394a23=_0x394a23-0x0;var _0x57222f=_0x3c61[_0x394a23];return _0x57222f;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x13c6('0x0'),_0x13c6('0x1'),_0x13c6('0x2')];function createListener(_0x25f7c3,_0x3a8e3c){return function(_0x376d00){_0x3a8e3c[_0x13c6('0x3')](_0x25f7c3,_0x376d00);};}function removeListener(_0x5a08f1,_0x5c8cbe){return function(){UserNotificationEvents[_0x13c6('0x4')](_0x5a08f1,_0x5c8cbe);};}exports[_0x13c6('0x5')]=function(_0x590475){for(var _0x2a101f=0x0,_0x168c8b=events[_0x13c6('0x6')];_0x2a101f<_0x168c8b;_0x2a101f++){var _0xc8b11b=events[_0x2a101f];var _0x365489=createListener(_0x13c6('0x7')+_0xc8b11b,_0x590475);UserNotificationEvents['on'](_0xc8b11b,_0x365489);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a76c2bf..0e04211 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x28d5e8,_0x564554){var _0x33b105=function(_0xe04509){while(--_0xe04509){_0x28d5e8['push'](_0x28d5e8['shift']());}};_0x33b105(++_0x564554);}(_0x70e0,0x17b));var _0x070e=function(_0x17ef94,_0x508369){_0x17ef94=_0x17ef94-0x0;var _0x599c10=_0x70e0[_0x17ef94];return _0x599c10;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x24fcbe,_0x2a87d8){var _0x1fe65e=function(_0x387e3b){while(--_0x387e3b){_0x24fcbe['push'](_0x24fcbe['shift']());}};_0x1fe65e(++_0x2a87d8);}(_0x70e0,0x17b));var _0x070e=function(_0x128b9a,_0x5d939b){_0x128b9a=_0x128b9a-0x0;var _0x460245=_0x70e0[_0x128b9a];return _0x460245;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0392caa..34c285e 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f17=['sequelize','INTEGER'];(function(_0x366655,_0x4d032){var _0x11e076=function(_0x3ce9b8){while(--_0x3ce9b8){_0x366655['push'](_0x366655['shift']());}};_0x11e076(++_0x4d032);}(_0x9f17,0x1f0));var _0x79f1=function(_0x3d2228,_0x1ba220){_0x3d2228=_0x3d2228-0x0;var _0x443881=_0x9f17[_0x3d2228];return _0x443881;};'use strict';var Sequelize=require(_0x79f1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x79f1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x094c=['sequelize','exports'];(function(_0x392732,_0x24f9ed){var _0x414049=function(_0x5b3d8f){while(--_0x5b3d8f){_0x392732['push'](_0x392732['shift']());}};_0x414049(++_0x24f9ed);}(_0x094c,0x7e));var _0xc094=function(_0xfcc030,_0x3ec053){_0xfcc030=_0xfcc030-0x0;var _0x5caa66=_0x094c[_0xfcc030];return _0x5caa66;};'use strict';var Sequelize=require(_0xc094('0x0'));module[_0xc094('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 404b3b8..6c489b3 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc275=['moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x24c145,_0x542d79){var _0x4b5389=function(_0x4674da){while(--_0x4674da){_0x24c145['push'](_0x24c145['shift']());}};_0x4b5389(++_0x542d79);}(_0xc275,0x7f));var _0x5c27=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc275[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x5c27('0x0'));var util=require(_0x5c27('0x1'));var logger=require(_0x5c27('0x2'))('api');var moment=require(_0x5c27('0x3'));var BPromise=require(_0x5c27('0x4'));var rp=require(_0x5c27('0x5'));var fs=require('fs');var path=require(_0x5c27('0x6'));var rimraf=require('rimraf');var config=require(_0x5c27('0x7'));var attributes=require(_0x5c27('0x8'));module[_0x5c27('0x9')]=function(_0x3770a2,_0x28bf37){return _0x3770a2[_0x5c27('0xa')](_0x5c27('0xb'),attributes,{'tableName':_0x5c27('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8ed=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','UserOpenchannelQueue','lodash'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xb8ed,0xcf));var _0xdb8e=function(_0x3700a5,_0x4097c6){_0x3700a5=_0x3700a5-0x0;var _0x2d740b=_0xb8ed[_0x3700a5];return _0x2d740b;};'use strict';var _=require(_0xdb8e('0x0'));var util=require('util');var logger=require(_0xdb8e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdb8e('0x2'));var rp=require(_0xdb8e('0x3'));var fs=require('fs');var path=require(_0xdb8e('0x4'));var rimraf=require(_0xdb8e('0x5'));var config=require(_0xdb8e('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x3b247e,_0x287ec4){return _0x3b247e['define'](_0xdb8e('0x7'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index ed64d2c..5a0b9d5 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1504=['../../config/environment','jayson/promise','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x1504,0x1da));var _0x4150=function(_0xfc6c19,_0x5c87e5){_0xfc6c19=_0xfc6c19-0x0;var _0xc20bea=_0x1504[_0xfc6c19];return _0xc20bea;};'use strict';var _=require(_0x4150('0x0'));var util=require('util');var moment=require(_0x4150('0x1'));var BPromise=require(_0x4150('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4150('0x3'));var db=require(_0x4150('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4150('0x5'));var config=require(_0x4150('0x6'));var jayson=require(_0x4150('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1640fd,_0x32d1e9,_0x3d6540){return new BPromise(function(_0x2d9998,_0xbb40c7){return client[_0x4150('0x8')](_0x1640fd,_0x3d6540)[_0x4150('0x9')](function(_0x33181e){logger[_0x4150('0xa')](_0x4150('0xb'),_0x32d1e9,'request\x20sent');logger[_0x4150('0xc')](_0x4150('0xd'),_0x32d1e9,'request\x20sent',JSON[_0x4150('0xe')](_0x33181e));if(_0x33181e['error']){if(_0x33181e[_0x4150('0xf')][_0x4150('0x10')]===0x1f4){logger[_0x4150('0xf')](_0x4150('0xb'),_0x32d1e9,_0x33181e[_0x4150('0xf')][_0x4150('0x11')]);return _0xbb40c7(_0x33181e[_0x4150('0xf')][_0x4150('0x11')]);}logger[_0x4150('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32d1e9,_0x33181e[_0x4150('0xf')][_0x4150('0x11')]);return _0x2d9998(_0x33181e[_0x4150('0xf')][_0x4150('0x11')]);}else{logger['info'](_0x4150('0xb'),_0x32d1e9,'request\x20sent');_0x2d9998(_0x33181e[_0x4150('0x12')][_0x4150('0x11')]);}})[_0x4150('0x13')](function(_0x772a71){logger[_0x4150('0xf')](_0x4150('0xb'),_0x32d1e9,_0x772a71);_0xbb40c7(_0x772a71);});});} \ No newline at end of file +var _0xf888=['catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x495054,_0x304104){var _0x146d2e=function(_0x350426){while(--_0x350426){_0x495054['push'](_0x495054['shift']());}};_0x146d2e(++_0x304104);}(_0xf888,0x15a));var _0x8f88=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xf888[_0x4e93a9];return _0x43013c;};'use strict';var _=require('lodash');var util=require(_0x8f88('0x0'));var moment=require(_0x8f88('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f88('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f88('0x3'))['db'];var utils=require(_0x8f88('0x4'));var logger=require(_0x8f88('0x5'))(_0x8f88('0x6'));var config=require(_0x8f88('0x7'));var jayson=require(_0x8f88('0x8'));var client=jayson[_0x8f88('0x9')][_0x8f88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34a017,_0x1c430d,_0x1a6cd4){return new BPromise(function(_0x1ab028,_0x1dc6b7){return client[_0x8f88('0xb')](_0x34a017,_0x1a6cd4)[_0x8f88('0xc')](function(_0x11a2c4){logger[_0x8f88('0xd')](_0x8f88('0xe'),_0x1c430d,'request\x20sent');logger[_0x8f88('0xf')](_0x8f88('0x10'),_0x1c430d,_0x8f88('0x11'),JSON['stringify'](_0x11a2c4));if(_0x11a2c4[_0x8f88('0x12')]){if(_0x11a2c4['error'][_0x8f88('0x13')]===0x1f4){logger[_0x8f88('0x12')](_0x8f88('0xe'),_0x1c430d,_0x11a2c4[_0x8f88('0x12')][_0x8f88('0x14')]);return _0x1dc6b7(_0x11a2c4[_0x8f88('0x12')][_0x8f88('0x14')]);}logger[_0x8f88('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1c430d,_0x11a2c4[_0x8f88('0x12')][_0x8f88('0x14')]);return _0x1ab028(_0x11a2c4['error']['message']);}else{logger[_0x8f88('0xd')](_0x8f88('0xe'),_0x1c430d,_0x8f88('0x11'));_0x1ab028(_0x11a2c4[_0x8f88('0x15')][_0x8f88('0x14')]);}})[_0x8f88('0x16')](function(_0x99d959){logger['error'](_0x8f88('0xe'),_0x1c430d,_0x99d959);_0x1dc6b7(_0x99d959);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 343993f..ecbab76 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd63a=['/:id','show','/:id/sections','getSections','create','/:id/clone','clone','post','addSections','/:id/resources','addResources','put','update','delete','destroy','removeResources','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x28c210,_0x98c659){var _0xb30ae8=function(_0x8cdd13){while(--_0x8cdd13){_0x28c210['push'](_0x28c210['shift']());}};_0xb30ae8(++_0x98c659);}(_0xd63a,0x11e));var _0xad63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd63a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xad63('0x0'));var util=require('util');var path=require(_0xad63('0x1'));var timeout=require(_0xad63('0x2'));var express=require(_0xad63('0x3'));var router=express['Router']();var fs_extra=require(_0xad63('0x4'));var auth=require(_0xad63('0x5'));var interaction=require(_0xad63('0x6'));var config=require(_0xad63('0x7'));var controller=require(_0xad63('0x8'));router['get']('/',auth[_0xad63('0x9')](),controller[_0xad63('0xa')]);router[_0xad63('0xb')](_0xad63('0xc'),auth['isAuthenticated'](),controller[_0xad63('0xd')]);router['get'](_0xad63('0xe'),auth[_0xad63('0x9')](),controller[_0xad63('0xf')]);router['get'](_0xad63('0x10'),auth['isAuthenticated'](),controller[_0xad63('0x11')]);router[_0xad63('0xb')]('/:id/resources',auth[_0xad63('0x9')](),controller['getResources']);router['post']('/',auth['isAuthenticated'](),controller[_0xad63('0x12')]);router['post'](_0xad63('0x13'),auth[_0xad63('0x9')](),controller[_0xad63('0x14')]);router[_0xad63('0x15')](_0xad63('0x10'),auth[_0xad63('0x9')](),controller[_0xad63('0x16')]);router['post'](_0xad63('0x17'),auth[_0xad63('0x9')](),controller[_0xad63('0x18')]);router[_0xad63('0x19')](_0xad63('0xe'),auth[_0xad63('0x9')](),controller[_0xad63('0x1a')]);router[_0xad63('0x1b')](_0xad63('0xe'),auth[_0xad63('0x9')](),controller[_0xad63('0x1c')]);router[_0xad63('0x1b')](_0xad63('0x10'),auth[_0xad63('0x9')](),controller['removeSections']);router['delete'](_0xad63('0x17'),auth['isAuthenticated'](),controller[_0xad63('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x7f0d=['removeSections','removeResources','exports','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','clone','addSections','addResources','update','delete','destroy'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7f0d,0xd3));var _0xd7f0=function(_0x4023e4,_0x3f2df5){_0x4023e4=_0x4023e4-0x0;var _0x5c7f0e=_0x7f0d[_0x4023e4];return _0x5c7f0e;};'use strict';var multer=require('multer');var util=require(_0xd7f0('0x0'));var path=require(_0xd7f0('0x1'));var timeout=require('connect-timeout');var express=require(_0xd7f0('0x2'));var router=express[_0xd7f0('0x3')]();var fs_extra=require(_0xd7f0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd7f0('0x5'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xd7f0('0x6')]('/',auth[_0xd7f0('0x7')](),controller[_0xd7f0('0x8')]);router[_0xd7f0('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xd7f0('0x9')]);router['get'](_0xd7f0('0xa'),auth['isAuthenticated'](),controller[_0xd7f0('0xb')]);router['get'](_0xd7f0('0xc'),auth['isAuthenticated'](),controller[_0xd7f0('0xd')]);router['get'](_0xd7f0('0xe'),auth[_0xd7f0('0x7')](),controller['getResources']);router[_0xd7f0('0xf')]('/',auth[_0xd7f0('0x7')](),controller[_0xd7f0('0x10')]);router[_0xd7f0('0xf')]('/:id/clone',auth[_0xd7f0('0x7')](),controller[_0xd7f0('0x11')]);router[_0xd7f0('0xf')](_0xd7f0('0xc'),auth['isAuthenticated'](),controller[_0xd7f0('0x12')]);router[_0xd7f0('0xf')](_0xd7f0('0xe'),auth['isAuthenticated'](),controller[_0xd7f0('0x13')]);router['put'](_0xd7f0('0xa'),auth[_0xd7f0('0x7')](),controller[_0xd7f0('0x14')]);router[_0xd7f0('0x15')](_0xd7f0('0xa'),auth[_0xd7f0('0x7')](),controller[_0xd7f0('0x16')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0xd7f0('0x17')]);router[_0xd7f0('0x15')](_0xd7f0('0xe'),auth['isAuthenticated'](),controller[_0xd7f0('0x18')]);module[_0xd7f0('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index ed59bf3..4849fef 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e7b=['sequelize','STRING','name','setDataValue','join','getDataValue','crudPermissions','BOOLEAN'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x2e7b,0x188));var _0xb2e7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2e7b[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xb2e7('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2e7('0x1')],'allowNull':![],'unique':_0xb2e7('0x2')},'crudPermissions':{'type':Sequelize[_0xb2e7('0x1')],'set':function(_0x3b62b4){this[_0xb2e7('0x3')]('crudPermissions',_0x3b62b4?_0x3b62b4[_0xb2e7('0x4')](''):[]);},'get':function(){return this[_0xb2e7('0x5')](_0xb2e7('0x6'))?this[_0xb2e7('0x5')](_0xb2e7('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb2e7('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb2e7('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb2e7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb2e7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb2e7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb2e7('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb2e7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb2e7('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6d8f=['split','BOOLEAN','exports','STRING','name','setDataValue','crudPermissions','getDataValue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6d8f,0x17a));var _0xf6d8=function(_0x38a9af,_0x3bbfdd){_0x38a9af=_0x38a9af-0x0;var _0x123a38=_0x6d8f[_0x38a9af];return _0x123a38;};'use strict';var Sequelize=require('sequelize');module[_0xf6d8('0x0')]={'name':{'type':Sequelize[_0xf6d8('0x1')],'allowNull':![],'unique':_0xf6d8('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4364f0){this[_0xf6d8('0x3')](_0xf6d8('0x4'),_0x4364f0?_0x4364f0['join'](''):[]);},'get':function(){return this[_0xf6d8('0x5')](_0xf6d8('0x4'))?this[_0xf6d8('0x5')]('crudPermissions')[_0xf6d8('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf6d8('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf6d8('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf6d8('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf6d8('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf6d8('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf6d8('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index efaffe7..e6385eb 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39e6=['query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','UserProfile','includeAll','findAll','rows','catch','params','include','find','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','describe','addSections','ids','getSections','enabled','isEmpty','subsections','includes','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','end','status','limit','undefined','count','offset','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','key'];(function(_0x38dbde,_0x46ae01){var _0x185617=function(_0x2c01df){while(--_0x2c01df){_0x38dbde['push'](_0x38dbde['shift']());}};_0x185617(++_0x46ae01);}(_0x39e6,0x178));var _0x639e=function(_0x3716f6,_0x1269da){_0x3716f6=_0x3716f6-0x0;var _0x3b4138=_0x39e6[_0x3716f6];return _0x3b4138;};'use strict';var emlformat=require(_0x639e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x639e('0x1'));var rp=require(_0x639e('0x2'));var moment=require('moment');var BPromise=require(_0x639e('0x3'));var Mustache=require(_0x639e('0x4'));var util=require('util');var path=require(_0x639e('0x5'));var sox=require('sox');var csv=require(_0x639e('0x6'));var ejs=require(_0x639e('0x7'));var fs=require('fs');var fs_extra=require(_0x639e('0x8'));var _=require(_0x639e('0x9'));var squel=require(_0x639e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x639e('0xb'));var toCsv=require(_0x639e('0x6'));var querystring=require(_0x639e('0xc'));var Papa=require(_0x639e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x639e('0xe'));var as=require(_0x639e('0xf'));var hardwareService=require(_0x639e('0x10'));var logger=require(_0x639e('0x11'))(_0x639e('0x12'));var utils=require(_0x639e('0x13'));var config=require(_0x639e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x639e('0x15'))['db'];config[_0x639e('0x16')]=_[_0x639e('0x17')](config[_0x639e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x639e('0x18'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x5c10c6,_0x5a8f8c){_0x5a8f8c=_0x5a8f8c||0xcc;return function(_0x4df9d8){if(_0x4df9d8){return _0x5c10c6[_0x639e('0x19')](_0x5a8f8c);}return _0x5c10c6['status'](_0x5a8f8c)[_0x639e('0x1a')]();};}function respondWithResult(_0x522674,_0x210e57){_0x210e57=_0x210e57||0xc8;return function(_0xd765f4){if(_0xd765f4){return _0x522674[_0x639e('0x1b')](_0x210e57)['json'](_0xd765f4);}};}function respondWithFilteredResult(_0x3842ad,_0x5f26ae){return function(_0x370664){if(_0x370664){var _0x292867=typeof _0x5f26ae['offset']==='undefined'&&typeof _0x5f26ae[_0x639e('0x1c')]===_0x639e('0x1d');var _0x518d9c=_0x370664[_0x639e('0x1e')];var _0x2139f2=_0x292867?0x0:_0x5f26ae[_0x639e('0x1f')];var _0x5972ca=_0x292867?_0x370664['count']:_0x5f26ae[_0x639e('0x1f')]+_0x5f26ae[_0x639e('0x1c')];var _0x27ac4;if(_0x5972ca>=_0x518d9c){_0x5972ca=_0x518d9c;_0x27ac4=0xc8;}else{_0x27ac4=0xce;}_0x3842ad[_0x639e('0x1b')](_0x27ac4);return _0x3842ad['set']('Content-Range',_0x2139f2+'-'+_0x5972ca+'/'+_0x518d9c)['json'](_0x370664);}return null;};}function patchUpdates(_0x468eba){return function(_0x2277e1){try{jsonpatch[_0x639e('0x20')](_0x2277e1,_0x468eba,!![]);}catch(_0x2dd621){return BPromise[_0x639e('0x21')](_0x2dd621);}return _0x2277e1['save']();};}function saveUpdates(_0x3d92a1,_0x5cd9dd){return function(_0xbd9a8b){if(_0xbd9a8b){return _0xbd9a8b[_0x639e('0x22')](_0x3d92a1)[_0x639e('0x23')](function(_0x312b5d){return _0x312b5d;});}return null;};}function removeEntity(_0x33eb7c,_0x42610a){return function(_0x44f97a){if(_0x44f97a){return _0x44f97a[_0x639e('0x24')]()['then'](function(){_0x33eb7c[_0x639e('0x1b')](0xcc)[_0x639e('0x1a')]();});}};}function handleEntityNotFound(_0x41c0e1,_0x7b35c6){return function(_0x452c17){if(!_0x452c17){_0x41c0e1['sendStatus'](0x194);}return _0x452c17;};}function handleError(_0x2b4c0b,_0x47684d){_0x47684d=_0x47684d||0x1f4;return function(_0x277c8e){logger['error'](_0x277c8e[_0x639e('0x25')]);if(_0x277c8e[_0x639e('0x26')]){delete _0x277c8e[_0x639e('0x26')];}_0x2b4c0b['status'](_0x47684d)[_0x639e('0x27')](_0x277c8e);};}exports[_0x639e('0x28')]=function(_0x4d6e78,_0x2a18d8){var _0x1da36={},_0x2bc7b7={},_0x5a44ec={'count':0x0,'rows':[]};var _0x4d6a1f=_[_0x639e('0x29')](db['UserProfile'][_0x639e('0x2a')],function(_0x1238cf){return{'name':_0x1238cf['fieldName'],'type':_0x1238cf['type'][_0x639e('0x2b')]};});_0x2bc7b7['model']=_[_0x639e('0x29')](_0x4d6a1f,'name');_0x2bc7b7[_0x639e('0x2c')]=_[_0x639e('0x2d')](_0x4d6e78[_0x639e('0x2c')]);_0x2bc7b7[_0x639e('0x2e')]=_[_0x639e('0x2f')](_0x2bc7b7['model'],_0x2bc7b7[_0x639e('0x2c')]);_0x1da36[_0x639e('0x30')]=_['intersection'](_0x2bc7b7[_0x639e('0x31')],qs['fields'](_0x4d6e78[_0x639e('0x2c')][_0x639e('0x32')]));_0x1da36[_0x639e('0x30')]=_0x1da36['attributes'][_0x639e('0x33')]?_0x1da36[_0x639e('0x30')]:_0x2bc7b7[_0x639e('0x31')];if(!_0x4d6e78[_0x639e('0x2c')]['hasOwnProperty'](_0x639e('0x34'))){_0x1da36['limit']=qs[_0x639e('0x1c')](_0x4d6e78[_0x639e('0x2c')]['limit']);_0x1da36[_0x639e('0x1f')]=qs[_0x639e('0x1f')](_0x4d6e78[_0x639e('0x2c')][_0x639e('0x1f')]);}_0x1da36[_0x639e('0x35')]=qs['sort'](_0x4d6e78[_0x639e('0x2c')][_0x639e('0x36')]);_0x1da36['where']=qs['filters'](_[_0x639e('0x37')](_0x4d6e78[_0x639e('0x2c')],_0x2bc7b7[_0x639e('0x2e')]),_0x4d6a1f);if(_0x4d6e78['query'][_0x639e('0x38')]){_0x1da36[_0x639e('0x39')]=_[_0x639e('0x3a')](_0x1da36[_0x639e('0x39')],{'$or':_[_0x639e('0x29')](_0x4d6a1f,function(_0x478a33){if(_0x478a33[_0x639e('0x3b')]!==_0x639e('0x3c')){var _0x393de0={};_0x393de0[_0x478a33[_0x639e('0x26')]]={'$like':'%'+_0x4d6e78[_0x639e('0x2c')]['filter']+'%'};return _0x393de0;}})});}_0x1da36=_[_0x639e('0x3a')]({},_0x1da36,_0x4d6e78[_0x639e('0x3d')]);var _0x51609f={'where':_0x1da36[_0x639e('0x39')]};return db[_0x639e('0x3e')][_0x639e('0x1e')](_0x51609f)['then'](function(_0x2d4de5){_0x5a44ec['count']=_0x2d4de5;if(_0x4d6e78['query'][_0x639e('0x3f')]){_0x1da36['include']=[{'all':!![]}];}return db[_0x639e('0x3e')][_0x639e('0x40')](_0x1da36);})[_0x639e('0x23')](function(_0x2f5a72){_0x5a44ec[_0x639e('0x41')]=_0x2f5a72;return _0x5a44ec;})[_0x639e('0x23')](respondWithFilteredResult(_0x2a18d8,_0x1da36))[_0x639e('0x42')](handleError(_0x2a18d8,null));};exports['show']=function(_0x1d7673,_0x707894){var _0x37ff1a={'raw':![],'where':{'id':_0x1d7673[_0x639e('0x43')]['id']}},_0x20450b={};_0x20450b[_0x639e('0x31')]=_[_0x639e('0x2d')](db[_0x639e('0x3e')][_0x639e('0x2a')]);_0x20450b[_0x639e('0x2c')]=_[_0x639e('0x2d')](_0x1d7673['query']);_0x20450b['filters']=_[_0x639e('0x2f')](_0x20450b['model'],_0x20450b['query']);_0x37ff1a[_0x639e('0x30')]=_['intersection'](_0x20450b[_0x639e('0x31')],qs[_0x639e('0x32')](_0x1d7673[_0x639e('0x2c')]['fields']));_0x37ff1a[_0x639e('0x30')]=_0x37ff1a['attributes'][_0x639e('0x33')]?_0x37ff1a[_0x639e('0x30')]:_0x20450b[_0x639e('0x31')];if(_0x1d7673['query'][_0x639e('0x3f')]){_0x37ff1a[_0x639e('0x44')]=[{'all':!![]}];}_0x37ff1a=_[_0x639e('0x3a')]({},_0x37ff1a,_0x1d7673[_0x639e('0x3d')]);return db[_0x639e('0x3e')][_0x639e('0x45')](_0x37ff1a)[_0x639e('0x23')](handleEntityNotFound(_0x707894,null))[_0x639e('0x23')](respondWithResult(_0x707894,null))[_0x639e('0x42')](handleError(_0x707894,null));};exports[_0x639e('0x46')]=function(_0x56df0e,_0x4e0368){return db[_0x639e('0x3e')]['create'](_0x56df0e[_0x639e('0x47')],{})[_0x639e('0x23')](respondWithResult(_0x4e0368,0xc9))['catch'](handleError(_0x4e0368,null));};exports['clone']=function(_0x29f91a,_0x2e6da6){var _0x57d372={'where':{'id':_0x29f91a[_0x639e('0x43')]['id']}},_0x129224={};_0x129224[_0x639e('0x31')]=_[_0x639e('0x2d')](db['UserProfile']['rawAttributes']);_0x57d372[_0x639e('0x30')]=_[_0x639e('0x2f')](_0x129224['model'],qs[_0x639e('0x32')](_0x29f91a[_0x639e('0x2c')][_0x639e('0x32')]));_0x57d372[_0x639e('0x30')]=_0x57d372[_0x639e('0x30')][_0x639e('0x33')]?_0x57d372[_0x639e('0x30')]:_0x129224[_0x639e('0x31')];if(_0x29f91a[_0x639e('0x2c')]['includeAll']){_0x57d372[_0x639e('0x44')]=[{'all':!![]}];}_0x57d372=_['merge']({},_0x57d372,_0x29f91a[_0x639e('0x3d')]);return db[_0x639e('0x3e')][_0x639e('0x45')](_0x57d372)[_0x639e('0x23')](handleEntityNotFound(_0x2e6da6,null))[_0x639e('0x23')](function(_0x465d6d){if(_0x465d6d){var _0x5d272c=_0x465d6d[_0x639e('0x48')]({'plain':!![]});_0x5d272c=qs[_0x639e('0x49')](_0x5d272c,['id',_0x639e('0x4a'),_0x639e('0x4b'),_0x639e('0x4c')]);_0x29f91a[_0x639e('0x47')]=_['omit'](_0x29f91a[_0x639e('0x47')],['id',_0x639e('0x4a'),_0x639e('0x4b')]);return db[_0x639e('0x4d')][_0x639e('0x4e')](function(_0x384f29){return db[_0x639e('0x3e')][_0x639e('0x46')](_[_0x639e('0x3a')](_0x5d272c,_0x29f91a['body']),{'include':_0x29f91a[_0x639e('0x2c')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x384f29})[_0x639e('0x23')](function(_0x32c05a){var _0x547b0a=_0x32c05a['get']({'plain':!![]});return db[_0x639e('0x4f')][_0x639e('0x40')]({'where':{'userProfileId':_0x29f91a[_0x639e('0x43')]['id']},'raw':!![]})[_0x639e('0x23')](function(_0x2c5857){if(_0x2c5857){return BPromise[_0x639e('0x50')](_0x2c5857,function(_0x2f47f7){return new BPromise(function(_0x211bd9,_0x2941a4){if(_0x2f47f7[_0x639e('0x51')]===null||_0x2f47f7[_0x639e('0x51')]===0x1)_0x211bd9(null);return db[_0x639e('0x52')]['findAll']({'where':{'sectionId':_0x2f47f7['id']},'raw':!![]})[_0x639e('0x23')](function(_0x1141fb){var _0x43f4c8=_[_0x639e('0x29')](_0x1141fb,function(_0xc3067c){return qs[_0x639e('0x49')](_0xc3067c,['id',_0x639e('0x4a'),'updatedAt',_0x639e('0x53')]);});_0x211bd9(_0x43f4c8);})[_0x639e('0x42')](function(_0x12c6ff){_0x2941a4(_0x12c6ff);});})['then'](function(_0x3d24bd){var _0xdb85f5=qs[_0x639e('0x49')](_0x2f47f7,['id',_0x639e('0x4a'),_0x639e('0x4b')]);_0xdb85f5[_0x639e('0x54')]=_0x547b0a['id'];if(_0x3d24bd)_0xdb85f5['Resources']=_0x3d24bd;return _0xdb85f5;})['then'](function(_0x43c562){return db[_0x639e('0x4f')][_0x639e('0x46')](_0x43c562,{'include':[{'model':db[_0x639e('0x52')],'as':'Resources'}],'raw':!![],'transaction':_0x384f29});});})['then'](function(){return _0x547b0a;});}});});});}})[_0x639e('0x23')](respondWithResult(_0x2e6da6,0xc9))[_0x639e('0x42')](handleError(_0x2e6da6,null));};exports[_0x639e('0x22')]=function(_0x319381,_0x1a21b4){if(_0x319381[_0x639e('0x47')]['id']){delete _0x319381['body']['id'];}return db['UserProfile'][_0x639e('0x45')]({'where':{'id':_0x319381[_0x639e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a21b4,null))[_0x639e('0x23')](saveUpdates(_0x319381[_0x639e('0x47')],null))[_0x639e('0x23')](respondWithResult(_0x1a21b4,null))[_0x639e('0x42')](handleError(_0x1a21b4,null));};exports['destroy']=function(_0x43ebe3,_0x3de8a7){return db[_0x639e('0x3e')][_0x639e('0x45')]({'where':{'id':_0x43ebe3[_0x639e('0x43')]['id']}})['then'](handleEntityNotFound(_0x3de8a7,null))['then'](removeEntity(_0x3de8a7,null))[_0x639e('0x42')](handleError(_0x3de8a7,null));};exports[_0x639e('0x55')]=function(_0x5f452e,_0x583ff7){return db[_0x639e('0x3e')]['describe']()['then'](respondWithResult(_0x583ff7,null))[_0x639e('0x42')](handleError(_0x583ff7,null));};exports[_0x639e('0x56')]=function(_0x5c550b,_0x105b1e){var _0x3b7c40=_0x5c550b[_0x639e('0x47')];return db[_0x639e('0x3e')][_0x639e('0x45')]({'where':{'id':_0x5c550b[_0x639e('0x43')]['id']}})[_0x639e('0x23')](handleEntityNotFound(_0x105b1e,null))[_0x639e('0x23')](function(_0x17a364){if(_0x17a364){return db[_0x639e('0x4d')][_0x639e('0x4e')](function(_0x288249){return db[_0x639e('0x4f')][_0x639e('0x24')]({'where':{'userProfileId':_0x5c550b['params']['id'],'sectionId':_['map'](_0x3b7c40,function(_0x568391){return _0x568391[_0x639e('0x53')];})},'transaction':_0x288249})['then'](function(){var _0x2c16fe=_['map'](_0x3b7c40,function(_0xfe9f30){_0xfe9f30[_0x639e('0x54')]=_0x5c550b[_0x639e('0x43')]['id'];return _0xfe9f30;});var _0x31b163=[];return BPromise[_0x639e('0x50')](_0x2c16fe,function(_0x37f8f7){return db['UserProfileSection'][_0x639e('0x46')](_0x37f8f7,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x288249})[_0x639e('0x23')](function(_0x3ced64){_0x31b163['push'](_0x3ced64[_0x639e('0x48')]({'plain':!![]}));});})[_0x639e('0x23')](function(){return _0x31b163;});});});}})['then'](function(_0x8aa46){return _0x8aa46;})[_0x639e('0x23')](respondWithResult(_0x105b1e,null))[_0x639e('0x42')](handleError(_0x105b1e,null));};exports['removeSections']=function(_0x10aa09,_0xd998c0){var _0x464e62;return db[_0x639e('0x3e')][_0x639e('0x45')]({'where':{'id':_0x10aa09[_0x639e('0x43')]['id']},'attributes':['id',_0x639e('0x26')]})[_0x639e('0x23')](handleEntityNotFound(_0xd998c0,null))[_0x639e('0x23')](function(_0x3c5fdc){if(_0x3c5fdc){_0x464e62=_0x3c5fdc;return db[_0x639e('0x4f')][_0x639e('0x24')]({'where':{'userProfileId':_0x10aa09[_0x639e('0x43')]['id'],'sectionId':_0x10aa09['query'][_0x639e('0x57')]}});}})[_0x639e('0x23')](function(){return _0x464e62;})['then'](respondWithStatusCode(_0xd998c0,null))[_0x639e('0x42')](handleError(_0xd998c0,null));};exports[_0x639e('0x58')]=function(_0x53bb7c,_0x16fc97){var _0x3af570=[];var _0xafcea6=[];return db[_0x639e('0x4f')][_0x639e('0x40')]({'where':{'userProfileId':_0x53bb7c[_0x639e('0x43')]['id']},'raw':!![]})['then'](function(_0x8bb0c7){_0x3af570=_['filter'](_0x8bb0c7,function(_0x3bcd24){return _0x3bcd24[_0x639e('0x59')]===0x1||_['includes']([0x3eb,0x709],_0x3bcd24['sectionId']);});if(!_[_0x639e('0x5a')](_0x3af570)){return _[_0x639e('0x29')](_0x3af570,function(_0xe0d44a){return _0xe0d44a[_0x639e('0x53')];});}else{return;}})[_0x639e('0x23')](function(_0x5267e4){if(_0x5267e4)_0xafcea6=_0x5267e4;if(_['includes'](_0xafcea6,0x64)){var _0x45e33c=_['find'](_0x3af570,{'sectionId':0x64});return hasDefaultDashboard(_0x45e33c)[_0x639e('0x23')](function(_0x38af4b){return _[_0x639e('0x29')](_0x3af570,function(_0x3dc07e){if(_0x3dc07e[_0x639e('0x53')]===0x64){_0x3dc07e[_0x639e('0x5b')]=_0x38af4b;}return _0x3dc07e;});});}else{return;}})[_0x639e('0x23')](function(_0x276494){if(_0x276494)_0x3af570=_0x276494;if(_[_0x639e('0x5c')](_0xafcea6,0x3eb)){var _0x55adc2=_['find'](_0x3af570,{'sectionId':0x3eb});return getCustomDashboards(_0x55adc2)[_0x639e('0x23')](function(_0x16c7b0){return _['map'](_0x3af570,function(_0x2056cc){if(_0x55adc2[_0x639e('0x59')]){if(_0x2056cc[_0x639e('0x53')]===0x3eb){_0x2056cc[_0x639e('0x5b')]=_0x16c7b0;}}else{if(_0x2056cc[_0x639e('0x53')]===0x64){if(!_0x2056cc[_0x639e('0x5b')]){_0x2056cc[_0x639e('0x5b')]=[];}_0x2056cc[_0x639e('0x5b')]=_0x2056cc[_0x639e('0x5b')]['concat'](_0x16c7b0);}}return _0x2056cc;});});}else{return;}})['then'](function(_0x1f46f8){if(_0x1f46f8)_0x3af570=_0x1f46f8;if(_['includes'](_0xafcea6,0x709)){var _0x55b202=_[_0x639e('0x45')](_0x3af570,{'sectionId':0x709});return getPlugins(_0x55b202)['then'](function(_0x1504d3){if(_0x55b202[_0x639e('0x59')]){return _['map'](_0x3af570,function(_0x1c7cc7){if(_0x1c7cc7['sectionId']===0x709){_0x1c7cc7[_0x639e('0x5b')]=_0x1504d3;}return _0x1c7cc7;});}else{var _0x28a424={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1504d3};var _0x17b493=_[_0x639e('0x29')](_0x3af570);_0x17b493[_0x639e('0x5d')](_0x28a424);return _0x17b493;}});}else{return;}})[_0x639e('0x23')](function(_0x3f6b0e){if(_0x3f6b0e)_0x3af570=_0x3f6b0e;return _['filter'](_0x3af570,[_0x639e('0x59'),0x1]);})[_0x639e('0x23')](respondWithResult(_0x16fc97,null))['catch'](handleError(_0x16fc97,null));};function hasDefaultDashboard(_0x4d2e98){var _0x1a70f8=[0x65];return new BPromise(function(_0x2a22a9,_0x4cf23e){try{if(_0x4d2e98['autoAssociation']){_0x2a22a9(_0x1a70f8);}else{return db[_0x639e('0x52')][_0x639e('0x5e')]({'where':{'sectionId':_0x4d2e98['id']},'raw':!![]})[_0x639e('0x23')](function(_0x291e32){_0x291e32?_0x2a22a9(_0x1a70f8):_0x2a22a9();});}}catch(_0x47042c){_0x4cf23e(_0x47042c);}});}function getCustomDashboards(_0x3a5ce6){var _0x41df06=[];return new BPromise(function(_0x4960b1,_0x4f14e6){try{if(_0x3a5ce6[_0x639e('0x51')]){return db[_0x639e('0x5f')][_0x639e('0x40')]({'raw':!![]})['then'](function(_0x127d9a){_0x127d9a[_0x639e('0x60')](function(_0x5c49af){_0x41df06[_0x639e('0x5d')](_0x5c49af['id']+0x1869f);});_0x4960b1(_0x41df06);});}else{return db[_0x639e('0x52')][_0x639e('0x40')]({'where':{'sectionId':_0x3a5ce6['id']},'raw':!![]})[_0x639e('0x23')](function(_0x126b62){_0x126b62['forEach'](function(_0x2d5b55){_0x41df06[_0x639e('0x5d')](_0x2d5b55[_0x639e('0x61')]+0x1869f);});_0x4960b1(_0x41df06);});}}catch(_0x33129f){_0x4f14e6(_0x33129f);}});}function getPlugins(_0x3d99e4){var _0x50933a=[];return new BPromise(function(_0x40a0be,_0x5e5b2a){try{if(_0x3d99e4[_0x639e('0x51')]){return db[_0x639e('0x62')]['findAll']({'raw':!![]})[_0x639e('0x23')](function(_0x43d3e0){_0x43d3e0['forEach'](function(_0x5eb605){_0x50933a[_0x639e('0x5d')](_0x5eb605['id']+0x15b38);});_0x40a0be(_0x50933a);});}else{return db[_0x639e('0x52')][_0x639e('0x40')]({'where':{'sectionId':_0x3d99e4['id']},'raw':!![]})[_0x639e('0x23')](function(_0x2ba42f){_0x2ba42f[_0x639e('0x60')](function(_0x543282){_0x50933a[_0x639e('0x5d')](_0x543282[_0x639e('0x61')]+0x15b38);});_0x40a0be(_0x50933a);});}}catch(_0x4f0af6){_0x5e5b2a(_0x4f0af6);}});}exports[_0x639e('0x63')]=function(_0x2adcf7,_0x45308b){return db[_0x639e('0x3e')]['find']({'where':{'id':_0x2adcf7[_0x639e('0x43')]['id']}})[_0x639e('0x23')](handleEntityNotFound(_0x45308b,null))[_0x639e('0x23')](function(_0x2c52ba){if(_0x2c52ba){return db[_0x639e('0x4d')][_0x639e('0x4e')](function(_0xec0c2d){return db[_0x639e('0x4f')][_0x639e('0x40')]({'where':{'userProfileId':_0x2adcf7[_0x639e('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0x639e('0x23')](function(_0x5714df){if(_0x5714df){return db[_0x639e('0x4f')][_0x639e('0x24')]({'where':{'userProfileId':_0x2adcf7['params']['id'],'id':_[_0x639e('0x29')](_0x5714df,function(_0x3045e8){return _0x3045e8['id'];})},'transaction':_0xec0c2d});}})[_0x639e('0x23')](function(_0xbf5db3){var _0x9e8255=_[_0x639e('0x29')](_0x2adcf7[_0x639e('0x47')],function(_0x15396e){_0x15396e[_0x639e('0x54')]=_0x2adcf7[_0x639e('0x43')]['id'];return _0x15396e;});return db[_0x639e('0x4f')][_0x639e('0x64')](_0x9e8255,{'raw':!![],'transaction':_0xec0c2d});})['then'](function(_0x194db7){var _0x4325f7=_[_0x639e('0x38')](_[_0x639e('0x29')](_0x194db7,function(_0x561021){return _0x561021[_0x639e('0x48')]({'plain':!![]});}),{'includeAll':![]});if(_0x4325f7){return db[_0x639e('0x4f')][_0x639e('0x40')]({'where':{'userProfileId':_0x2adcf7[_0x639e('0x43')]['id'],'sectionId':_[_0x639e('0x29')](_0x4325f7,function(_0x25afa3){return _0x25afa3[_0x639e('0x53')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x639e('0x23')](function(_0x2235c){var _0x4f802c=_[_0x639e('0x29')](_0x2adcf7[_0x639e('0x47')],function(_0x4abe8f){_0x4abe8f['userProfileId']=_0x2adcf7['params']['id'];return _0x4abe8f;});return db['UserProfileResource']['bulkCreate'](_0x4f802c,{'raw':!![],'transaction':_0xec0c2d});});}})[_0x639e('0x42')](handleError(_0x45308b,null));});}})[_0x639e('0x23')](function(_0x5809b5){var _0x1b24f8=_[_0x639e('0x29')](_0x5809b5,function(_0x5c0c0b){return _0x5c0c0b[_0x639e('0x48')]({'plain':!![]});});})[_0x639e('0x23')](respondWithResult(_0x45308b,null))['catch'](handleError(_0x45308b,null));};exports[_0x639e('0x65')]=function(_0x2e585e,_0x2e36f5,_0x29322c){return db[_0x639e('0x3e')]['find']({'where':{'id':_0x2e585e[_0x639e('0x43')]['id']}})[_0x639e('0x23')](handleEntityNotFound(_0x2e36f5,null))[_0x639e('0x23')](function(_0x335652){if(_0x335652){return _0x335652[_0x639e('0x65')](_0x2e585e['query'][_0x639e('0x57')]);}})[_0x639e('0x23')](respondWithStatusCode(_0x2e36f5,null))[_0x639e('0x42')](handleError(_0x2e36f5,null));};exports['getResources']=function(_0x2ed1ce,_0x295144){var _0x5c3ae9={};if(!_0x2ed1ce[_0x639e('0x2c')]['section'])throw new Error(_0x639e('0x66'));if(!_0x2ed1ce[_0x639e('0x2c')][_0x639e('0x67')]('nolimit')){_0x5c3ae9[_0x639e('0x1c')]=qs[_0x639e('0x1c')](_0x2ed1ce[_0x639e('0x2c')][_0x639e('0x1c')]);_0x5c3ae9[_0x639e('0x1f')]=qs['offset'](_0x2ed1ce[_0x639e('0x2c')][_0x639e('0x1f')]);}return db[_0x639e('0x3e')][_0x639e('0x45')]({'where':{'id':_0x2ed1ce[_0x639e('0x43')]['id']}})[_0x639e('0x23')](function(_0x3620b2){if(!_0x3620b2)throw new Error(_0x639e('0x68')+_0x2ed1ce[_0x639e('0x43')]['id']);return db[_0x639e('0x3e')]['getResources'](_0x2ed1ce);})['then'](respondWithFilteredResult(_0x295144,_0x5c3ae9))[_0x639e('0x42')](handleError(_0x295144,null));}; \ No newline at end of file +var _0xf122=['omit','updatedAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','createdAt','userProfileId','Resources','describe','push','removeSections','ids','getSections','enabled','includes','sectionId','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','UserProfile','rows','catch','show','find','create','body','clone','params','get'];(function(_0x3971a7,_0x3d77bb){var _0x1e1363=function(_0x3b808d){while(--_0x3b808d){_0x3971a7['push'](_0x3971a7['shift']());}};_0x1e1363(++_0x3d77bb);}(_0xf122,0x114));var _0x2f12=function(_0x415829,_0x9db0de){_0x415829=_0x415829-0x0;var _0x11f9ec=_0xf122[_0x415829];return _0x11f9ec;};'use strict';var emlformat=require(_0x2f12('0x0'));var rimraf=require(_0x2f12('0x1'));var zipdir=require(_0x2f12('0x2'));var jsonpatch=require(_0x2f12('0x3'));var rp=require(_0x2f12('0x4'));var moment=require(_0x2f12('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2f12('0x6'));var util=require(_0x2f12('0x7'));var path=require(_0x2f12('0x8'));var sox=require(_0x2f12('0x9'));var csv=require(_0x2f12('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f12('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2f12('0xc'));var jsforce=require(_0x2f12('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2f12('0xa'));var querystring=require(_0x2f12('0xe'));var Papa=require(_0x2f12('0xf'));var Redis=require(_0x2f12('0x10'));var authService=require(_0x2f12('0x11'));var qs=require(_0x2f12('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f12('0x13'));var logger=require(_0x2f12('0x14'))(_0x2f12('0x15'));var utils=require(_0x2f12('0x16'));var config=require(_0x2f12('0x17'));var licenseUtil=require(_0x2f12('0x18'));var db=require(_0x2f12('0x19'))['db'];config[_0x2f12('0x1a')]=_[_0x2f12('0x1b')](config[_0x2f12('0x1a')],{'host':_0x2f12('0x1c'),'port':0x18eb});var socket=require(_0x2f12('0x1d'))(new Redis(config[_0x2f12('0x1a')]));require(_0x2f12('0x1e'))[_0x2f12('0x1f')](socket);function respondWithStatusCode(_0x1dd8b8,_0x682482){_0x682482=_0x682482||0xcc;return function(_0x297793){if(_0x297793){return _0x1dd8b8[_0x2f12('0x20')](_0x682482);}return _0x1dd8b8['status'](_0x682482)[_0x2f12('0x21')]();};}function respondWithResult(_0x23aedb,_0x5295a2){_0x5295a2=_0x5295a2||0xc8;return function(_0x9d2947){if(_0x9d2947){return _0x23aedb[_0x2f12('0x22')](_0x5295a2)[_0x2f12('0x23')](_0x9d2947);}};}function respondWithFilteredResult(_0x196c61,_0x5870af){return function(_0x369b31){if(_0x369b31){var _0x489428=typeof _0x5870af['offset']===_0x2f12('0x24')&&typeof _0x5870af[_0x2f12('0x25')]===_0x2f12('0x24');var _0x13e615=_0x369b31['count'];var _0x5ea7a2=_0x489428?0x0:_0x5870af[_0x2f12('0x26')];var _0x3cdb12=_0x489428?_0x369b31['count']:_0x5870af[_0x2f12('0x26')]+_0x5870af['limit'];var _0x1d5e48;if(_0x3cdb12>=_0x13e615){_0x3cdb12=_0x13e615;_0x1d5e48=0xc8;}else{_0x1d5e48=0xce;}_0x196c61[_0x2f12('0x22')](_0x1d5e48);return _0x196c61[_0x2f12('0x27')](_0x2f12('0x28'),_0x5ea7a2+'-'+_0x3cdb12+'/'+_0x13e615)[_0x2f12('0x23')](_0x369b31);}return null;};}function patchUpdates(_0x3681a2){return function(_0xd3a4b1){try{jsonpatch['apply'](_0xd3a4b1,_0x3681a2,!![]);}catch(_0x25c88){return BPromise[_0x2f12('0x29')](_0x25c88);}return _0xd3a4b1[_0x2f12('0x2a')]();};}function saveUpdates(_0x4b82aa,_0x2660fc){return function(_0x526b92){if(_0x526b92){return _0x526b92[_0x2f12('0x2b')](_0x4b82aa)['then'](function(_0x3fb2d6){return _0x3fb2d6;});}return null;};}function removeEntity(_0x51e3fe,_0x5d2723){return function(_0x4614cd){if(_0x4614cd){return _0x4614cd[_0x2f12('0x2c')]()[_0x2f12('0x2d')](function(){_0x51e3fe[_0x2f12('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d2ee,_0x2bb455){return function(_0x598415){if(!_0x598415){_0x11d2ee['sendStatus'](0x194);}return _0x598415;};}function handleError(_0x39995b,_0x37fe30){_0x37fe30=_0x37fe30||0x1f4;return function(_0x2b4e1d){logger[_0x2f12('0x2e')](_0x2b4e1d[_0x2f12('0x2f')]);if(_0x2b4e1d['name']){delete _0x2b4e1d[_0x2f12('0x30')];}_0x39995b['status'](_0x37fe30)[_0x2f12('0x31')](_0x2b4e1d);};}exports[_0x2f12('0x32')]=function(_0x153cce,_0x399883){var _0x135bcc={},_0x44213b={},_0x2570a6={'count':0x0,'rows':[]};var _0x20d6c2=_[_0x2f12('0x33')](db['UserProfile'][_0x2f12('0x34')],function(_0x1d2522){return{'name':_0x1d2522[_0x2f12('0x35')],'type':_0x1d2522['type'][_0x2f12('0x36')]};});_0x44213b['model']=_[_0x2f12('0x33')](_0x20d6c2,_0x2f12('0x30'));_0x44213b['query']=_[_0x2f12('0x37')](_0x153cce[_0x2f12('0x38')]);_0x44213b[_0x2f12('0x39')]=_[_0x2f12('0x3a')](_0x44213b[_0x2f12('0x3b')],_0x44213b[_0x2f12('0x38')]);_0x135bcc[_0x2f12('0x3c')]=_[_0x2f12('0x3a')](_0x44213b['model'],qs[_0x2f12('0x3d')](_0x153cce[_0x2f12('0x38')][_0x2f12('0x3d')]));_0x135bcc[_0x2f12('0x3c')]=_0x135bcc[_0x2f12('0x3c')][_0x2f12('0x3e')]?_0x135bcc[_0x2f12('0x3c')]:_0x44213b[_0x2f12('0x3b')];if(!_0x153cce['query']['hasOwnProperty']('nolimit')){_0x135bcc['limit']=qs[_0x2f12('0x25')](_0x153cce[_0x2f12('0x38')][_0x2f12('0x25')]);_0x135bcc[_0x2f12('0x26')]=qs[_0x2f12('0x26')](_0x153cce['query'][_0x2f12('0x26')]);}_0x135bcc[_0x2f12('0x3f')]=qs['sort'](_0x153cce[_0x2f12('0x38')][_0x2f12('0x40')]);_0x135bcc[_0x2f12('0x41')]=qs[_0x2f12('0x39')](_[_0x2f12('0x42')](_0x153cce[_0x2f12('0x38')],_0x44213b['filters']),_0x20d6c2);if(_0x153cce[_0x2f12('0x38')][_0x2f12('0x43')]){_0x135bcc[_0x2f12('0x41')]=_[_0x2f12('0x44')](_0x135bcc[_0x2f12('0x41')],{'$or':_[_0x2f12('0x33')](_0x20d6c2,function(_0x401797){if(_0x401797[_0x2f12('0x45')]!=='VIRTUAL'){var _0x246fed={};_0x246fed[_0x401797[_0x2f12('0x30')]]={'$like':'%'+_0x153cce[_0x2f12('0x38')][_0x2f12('0x43')]+'%'};return _0x246fed;}})});}_0x135bcc=_[_0x2f12('0x44')]({},_0x135bcc,_0x153cce[_0x2f12('0x46')]);var _0xd5883c={'where':_0x135bcc[_0x2f12('0x41')]};return db['UserProfile'][_0x2f12('0x47')](_0xd5883c)['then'](function(_0x21c984){_0x2570a6[_0x2f12('0x47')]=_0x21c984;if(_0x153cce[_0x2f12('0x38')][_0x2f12('0x48')]){_0x135bcc[_0x2f12('0x49')]=[{'all':!![]}];}return db[_0x2f12('0x4a')]['findAll'](_0x135bcc);})['then'](function(_0x53a323){_0x2570a6[_0x2f12('0x4b')]=_0x53a323;return _0x2570a6;})['then'](respondWithFilteredResult(_0x399883,_0x135bcc))[_0x2f12('0x4c')](handleError(_0x399883,null));};exports[_0x2f12('0x4d')]=function(_0x48bb2d,_0x4be53f){var _0x4a4ae5={'raw':![],'where':{'id':_0x48bb2d['params']['id']}},_0x10bdb9={};_0x10bdb9[_0x2f12('0x3b')]=_[_0x2f12('0x37')](db[_0x2f12('0x4a')]['rawAttributes']);_0x10bdb9[_0x2f12('0x38')]=_['keys'](_0x48bb2d[_0x2f12('0x38')]);_0x10bdb9['filters']=_[_0x2f12('0x3a')](_0x10bdb9[_0x2f12('0x3b')],_0x10bdb9[_0x2f12('0x38')]);_0x4a4ae5[_0x2f12('0x3c')]=_[_0x2f12('0x3a')](_0x10bdb9['model'],qs[_0x2f12('0x3d')](_0x48bb2d[_0x2f12('0x38')][_0x2f12('0x3d')]));_0x4a4ae5['attributes']=_0x4a4ae5['attributes']['length']?_0x4a4ae5['attributes']:_0x10bdb9[_0x2f12('0x3b')];if(_0x48bb2d['query'][_0x2f12('0x48')]){_0x4a4ae5['include']=[{'all':!![]}];}_0x4a4ae5=_[_0x2f12('0x44')]({},_0x4a4ae5,_0x48bb2d[_0x2f12('0x46')]);return db['UserProfile'][_0x2f12('0x4e')](_0x4a4ae5)[_0x2f12('0x2d')](handleEntityNotFound(_0x4be53f,null))[_0x2f12('0x2d')](respondWithResult(_0x4be53f,null))['catch'](handleError(_0x4be53f,null));};exports[_0x2f12('0x4f')]=function(_0x137edc,_0x4616b3){return db[_0x2f12('0x4a')][_0x2f12('0x4f')](_0x137edc[_0x2f12('0x50')],{})[_0x2f12('0x2d')](respondWithResult(_0x4616b3,0xc9))['catch'](handleError(_0x4616b3,null));};exports[_0x2f12('0x51')]=function(_0x434098,_0x2d8d10){var _0x5bad60={'where':{'id':_0x434098[_0x2f12('0x52')]['id']}},_0x1d9568={};_0x1d9568[_0x2f12('0x3b')]=_[_0x2f12('0x37')](db[_0x2f12('0x4a')]['rawAttributes']);_0x5bad60[_0x2f12('0x3c')]=_[_0x2f12('0x3a')](_0x1d9568[_0x2f12('0x3b')],qs['fields'](_0x434098[_0x2f12('0x38')][_0x2f12('0x3d')]));_0x5bad60[_0x2f12('0x3c')]=_0x5bad60['attributes'][_0x2f12('0x3e')]?_0x5bad60['attributes']:_0x1d9568['model'];if(_0x434098[_0x2f12('0x38')]['includeAll']){_0x5bad60[_0x2f12('0x49')]=[{'all':!![]}];}_0x5bad60=_[_0x2f12('0x44')]({},_0x5bad60,_0x434098['options']);return db[_0x2f12('0x4a')][_0x2f12('0x4e')](_0x5bad60)[_0x2f12('0x2d')](handleEntityNotFound(_0x2d8d10,null))[_0x2f12('0x2d')](function(_0x23d23f){if(_0x23d23f){var _0x3fb81f=_0x23d23f[_0x2f12('0x53')]({'plain':!![]});_0x3fb81f=qs[_0x2f12('0x54')](_0x3fb81f,['id','createdAt',_0x2f12('0x55'),'crudPermissions']);_0x434098['body']=_[_0x2f12('0x54')](_0x434098[_0x2f12('0x50')],['id','createdAt',_0x2f12('0x55')]);return db[_0x2f12('0x56')][_0x2f12('0x57')](function(_0x30ee29){return db[_0x2f12('0x4a')][_0x2f12('0x4f')](_['merge'](_0x3fb81f,_0x434098[_0x2f12('0x50')]),{'include':_0x434098[_0x2f12('0x38')][_0x2f12('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x30ee29})['then'](function(_0x28fc21){var _0x619df2=_0x28fc21[_0x2f12('0x53')]({'plain':!![]});return db[_0x2f12('0x58')][_0x2f12('0x59')]({'where':{'userProfileId':_0x434098[_0x2f12('0x52')]['id']},'raw':!![]})[_0x2f12('0x2d')](function(_0x4150f9){if(_0x4150f9){return BPromise[_0x2f12('0x5a')](_0x4150f9,function(_0x10d9cc){return new BPromise(function(_0x5355c2,_0x297931){if(_0x10d9cc['autoAssociation']===null||_0x10d9cc[_0x2f12('0x5b')]===0x1)_0x5355c2(null);return db[_0x2f12('0x5c')][_0x2f12('0x59')]({'where':{'sectionId':_0x10d9cc['id']},'raw':!![]})[_0x2f12('0x2d')](function(_0x29a3eb){var _0x41158f=_['map'](_0x29a3eb,function(_0x184b63){return qs[_0x2f12('0x54')](_0x184b63,['id',_0x2f12('0x5d'),_0x2f12('0x55'),'sectionId']);});_0x5355c2(_0x41158f);})[_0x2f12('0x4c')](function(_0x21d9b3){_0x297931(_0x21d9b3);});})[_0x2f12('0x2d')](function(_0x5ab833){var _0xf38853=qs[_0x2f12('0x54')](_0x10d9cc,['id',_0x2f12('0x5d'),_0x2f12('0x55')]);_0xf38853[_0x2f12('0x5e')]=_0x619df2['id'];if(_0x5ab833)_0xf38853[_0x2f12('0x5f')]=_0x5ab833;return _0xf38853;})[_0x2f12('0x2d')](function(_0x2110e8){return db[_0x2f12('0x58')]['create'](_0x2110e8,{'include':[{'model':db[_0x2f12('0x5c')],'as':_0x2f12('0x5f')}],'raw':!![],'transaction':_0x30ee29});});})['then'](function(){return _0x619df2;});}});});});}})[_0x2f12('0x2d')](respondWithResult(_0x2d8d10,0xc9))[_0x2f12('0x4c')](handleError(_0x2d8d10,null));};exports['update']=function(_0x1b3888,_0x5c9fda){if(_0x1b3888[_0x2f12('0x50')]['id']){delete _0x1b3888[_0x2f12('0x50')]['id'];}return db[_0x2f12('0x4a')][_0x2f12('0x4e')]({'where':{'id':_0x1b3888[_0x2f12('0x52')]['id']}})[_0x2f12('0x2d')](handleEntityNotFound(_0x5c9fda,null))[_0x2f12('0x2d')](saveUpdates(_0x1b3888['body'],null))[_0x2f12('0x2d')](respondWithResult(_0x5c9fda,null))[_0x2f12('0x4c')](handleError(_0x5c9fda,null));};exports[_0x2f12('0x2c')]=function(_0x152cf2,_0xe92c69){return db['UserProfile'][_0x2f12('0x4e')]({'where':{'id':_0x152cf2[_0x2f12('0x52')]['id']}})[_0x2f12('0x2d')](handleEntityNotFound(_0xe92c69,null))[_0x2f12('0x2d')](removeEntity(_0xe92c69,null))[_0x2f12('0x4c')](handleError(_0xe92c69,null));};exports[_0x2f12('0x60')]=function(_0x32addd,_0x31a718){return db[_0x2f12('0x4a')]['describe']()[_0x2f12('0x2d')](respondWithResult(_0x31a718,null))[_0x2f12('0x4c')](handleError(_0x31a718,null));};exports['addSections']=function(_0x2f09f8,_0x485b1a){var _0x5ea168=_0x2f09f8[_0x2f12('0x50')];return db['UserProfile'][_0x2f12('0x4e')]({'where':{'id':_0x2f09f8[_0x2f12('0x52')]['id']}})[_0x2f12('0x2d')](handleEntityNotFound(_0x485b1a,null))[_0x2f12('0x2d')](function(_0x427a51){if(_0x427a51){return db['sequelize']['transaction'](function(_0x564a1d){return db[_0x2f12('0x58')][_0x2f12('0x2c')]({'where':{'userProfileId':_0x2f09f8['params']['id'],'sectionId':_[_0x2f12('0x33')](_0x5ea168,function(_0x13f5ce){return _0x13f5ce['sectionId'];})},'transaction':_0x564a1d})['then'](function(){var _0x3b2f35=_[_0x2f12('0x33')](_0x5ea168,function(_0x19be61){_0x19be61[_0x2f12('0x5e')]=_0x2f09f8['params']['id'];return _0x19be61;});var _0xaea73=[];return BPromise['each'](_0x3b2f35,function(_0x6501b8){return db['UserProfileSection']['create'](_0x6501b8,{'include':[{'model':db[_0x2f12('0x5c')],'as':_0x2f12('0x5f')}],'raw':!![],'transaction':_0x564a1d})[_0x2f12('0x2d')](function(_0x31af2f){_0xaea73[_0x2f12('0x61')](_0x31af2f['get']({'plain':!![]}));});})[_0x2f12('0x2d')](function(){return _0xaea73;});});});}})['then'](function(_0x4e7525){return _0x4e7525;})[_0x2f12('0x2d')](respondWithResult(_0x485b1a,null))[_0x2f12('0x4c')](handleError(_0x485b1a,null));};exports[_0x2f12('0x62')]=function(_0x2dd269,_0x11c530){var _0x15128c;return db['UserProfile'][_0x2f12('0x4e')]({'where':{'id':_0x2dd269[_0x2f12('0x52')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x11c530,null))[_0x2f12('0x2d')](function(_0x30d531){if(_0x30d531){_0x15128c=_0x30d531;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2dd269[_0x2f12('0x52')]['id'],'sectionId':_0x2dd269[_0x2f12('0x38')][_0x2f12('0x63')]}});}})[_0x2f12('0x2d')](function(){return _0x15128c;})['then'](respondWithStatusCode(_0x11c530,null))['catch'](handleError(_0x11c530,null));};exports[_0x2f12('0x64')]=function(_0x5cf925,_0x20142c){var _0x2f8b53=[];var _0x5cbfb6=[];return db[_0x2f12('0x58')]['findAll']({'where':{'userProfileId':_0x5cf925[_0x2f12('0x52')]['id']},'raw':!![]})['then'](function(_0x234af0){_0x2f8b53=_[_0x2f12('0x43')](_0x234af0,function(_0x454918){return _0x454918[_0x2f12('0x65')]===0x1||_[_0x2f12('0x66')]([0x3eb,0x709],_0x454918[_0x2f12('0x67')]);});if(!_[_0x2f12('0x68')](_0x2f8b53)){return _[_0x2f12('0x33')](_0x2f8b53,function(_0x5d309e){return _0x5d309e['sectionId'];});}else{return;}})[_0x2f12('0x2d')](function(_0x1533fa){if(_0x1533fa)_0x5cbfb6=_0x1533fa;if(_[_0x2f12('0x66')](_0x5cbfb6,0x64)){var _0x1fad33=_[_0x2f12('0x4e')](_0x2f8b53,{'sectionId':0x64});return hasDefaultDashboard(_0x1fad33)[_0x2f12('0x2d')](function(_0x9633c0){return _[_0x2f12('0x33')](_0x2f8b53,function(_0x31afa2){if(_0x31afa2[_0x2f12('0x67')]===0x64){_0x31afa2['subsections']=_0x9633c0;}return _0x31afa2;});});}else{return;}})['then'](function(_0x307059){if(_0x307059)_0x2f8b53=_0x307059;if(_[_0x2f12('0x66')](_0x5cbfb6,0x3eb)){var _0x824552=_[_0x2f12('0x4e')](_0x2f8b53,{'sectionId':0x3eb});return getCustomDashboards(_0x824552)[_0x2f12('0x2d')](function(_0x27582b){return _[_0x2f12('0x33')](_0x2f8b53,function(_0x4ff9b9){if(_0x824552[_0x2f12('0x65')]){if(_0x4ff9b9['sectionId']===0x3eb){_0x4ff9b9[_0x2f12('0x69')]=_0x27582b;}}else{if(_0x4ff9b9[_0x2f12('0x67')]===0x64){if(!_0x4ff9b9[_0x2f12('0x69')]){_0x4ff9b9[_0x2f12('0x69')]=[];}_0x4ff9b9[_0x2f12('0x69')]=_0x4ff9b9['subsections'][_0x2f12('0x6a')](_0x27582b);}}return _0x4ff9b9;});});}else{return;}})[_0x2f12('0x2d')](function(_0x3a5939){if(_0x3a5939)_0x2f8b53=_0x3a5939;if(_['includes'](_0x5cbfb6,0x709)){var _0x5de94e=_[_0x2f12('0x4e')](_0x2f8b53,{'sectionId':0x709});return getPlugins(_0x5de94e)[_0x2f12('0x2d')](function(_0x212055){if(_0x5de94e[_0x2f12('0x65')]){return _[_0x2f12('0x33')](_0x2f8b53,function(_0x2c6d0f){if(_0x2c6d0f['sectionId']===0x709){_0x2c6d0f[_0x2f12('0x69')]=_0x212055;}return _0x2c6d0f;});}else{var _0x8c86d5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x212055};var _0x34c6c0=_[_0x2f12('0x33')](_0x2f8b53);_0x34c6c0[_0x2f12('0x61')](_0x8c86d5);return _0x34c6c0;}});}else{return;}})[_0x2f12('0x2d')](function(_0x2876ce){if(_0x2876ce)_0x2f8b53=_0x2876ce;return _[_0x2f12('0x43')](_0x2f8b53,[_0x2f12('0x65'),0x1]);})['then'](respondWithResult(_0x20142c,null))[_0x2f12('0x4c')](handleError(_0x20142c,null));};function hasDefaultDashboard(_0x41d6b1){var _0x3b4b13=[0x65];return new BPromise(function(_0x1c131b,_0xdb78d9){try{if(_0x41d6b1[_0x2f12('0x5b')]){_0x1c131b(_0x3b4b13);}else{return db[_0x2f12('0x5c')][_0x2f12('0x6b')]({'where':{'sectionId':_0x41d6b1['id']},'raw':!![]})[_0x2f12('0x2d')](function(_0x11ab25){_0x11ab25?_0x1c131b(_0x3b4b13):_0x1c131b();});}}catch(_0x435fde){_0xdb78d9(_0x435fde);}});}function getCustomDashboards(_0x1b4bd1){var _0x112d0f=[];return new BPromise(function(_0x8d1d20,_0x32e2a8){try{if(_0x1b4bd1[_0x2f12('0x5b')]){return db[_0x2f12('0x6c')][_0x2f12('0x59')]({'raw':!![]})[_0x2f12('0x2d')](function(_0x12dec7){_0x12dec7[_0x2f12('0x6d')](function(_0x47ce5c){_0x112d0f['push'](_0x47ce5c['id']+0x1869f);});_0x8d1d20(_0x112d0f);});}else{return db[_0x2f12('0x5c')][_0x2f12('0x59')]({'where':{'sectionId':_0x1b4bd1['id']},'raw':!![]})[_0x2f12('0x2d')](function(_0x4f7c22){_0x4f7c22['forEach'](function(_0x5629db){_0x112d0f[_0x2f12('0x61')](_0x5629db[_0x2f12('0x6e')]+0x1869f);});_0x8d1d20(_0x112d0f);});}}catch(_0x34a299){_0x32e2a8(_0x34a299);}});}function getPlugins(_0x1c2f0d){var _0x4010f6=[];return new BPromise(function(_0x5cc05e,_0x5f013a){try{if(_0x1c2f0d[_0x2f12('0x5b')]){return db[_0x2f12('0x6f')]['findAll']({'raw':!![]})[_0x2f12('0x2d')](function(_0xb859ef){_0xb859ef[_0x2f12('0x6d')](function(_0x31e335){_0x4010f6[_0x2f12('0x61')](_0x31e335['id']+0x15b38);});_0x5cc05e(_0x4010f6);});}else{return db[_0x2f12('0x5c')][_0x2f12('0x59')]({'where':{'sectionId':_0x1c2f0d['id']},'raw':!![]})[_0x2f12('0x2d')](function(_0x29e260){_0x29e260[_0x2f12('0x6d')](function(_0x2d3428){_0x4010f6[_0x2f12('0x61')](_0x2d3428[_0x2f12('0x6e')]+0x15b38);});_0x5cc05e(_0x4010f6);});}}catch(_0x4fa238){_0x5f013a(_0x4fa238);}});}exports[_0x2f12('0x70')]=function(_0x51c1b2,_0x570847){return db[_0x2f12('0x4a')]['find']({'where':{'id':_0x51c1b2[_0x2f12('0x52')]['id']}})['then'](handleEntityNotFound(_0x570847,null))[_0x2f12('0x2d')](function(_0x423c8b){if(_0x423c8b){return db[_0x2f12('0x56')][_0x2f12('0x57')](function(_0x2e9986){return db[_0x2f12('0x58')][_0x2f12('0x59')]({'where':{'userProfileId':_0x51c1b2[_0x2f12('0x52')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xaafdb5){if(_0xaafdb5){return db[_0x2f12('0x58')][_0x2f12('0x2c')]({'where':{'userProfileId':_0x51c1b2[_0x2f12('0x52')]['id'],'id':_[_0x2f12('0x33')](_0xaafdb5,function(_0x290a0a){return _0x290a0a['id'];})},'transaction':_0x2e9986});}})[_0x2f12('0x2d')](function(_0x417464){var _0x114eac=_[_0x2f12('0x33')](_0x51c1b2[_0x2f12('0x50')],function(_0x564079){_0x564079[_0x2f12('0x5e')]=_0x51c1b2[_0x2f12('0x52')]['id'];return _0x564079;});return db[_0x2f12('0x58')][_0x2f12('0x71')](_0x114eac,{'raw':!![],'transaction':_0x2e9986});})['then'](function(_0x1dc293){var _0x55302a=_[_0x2f12('0x43')](_[_0x2f12('0x33')](_0x1dc293,function(_0x4d89e3){return _0x4d89e3[_0x2f12('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x55302a){return db[_0x2f12('0x58')]['findAll']({'where':{'userProfileId':_0x51c1b2[_0x2f12('0x52')]['id'],'sectionId':_[_0x2f12('0x33')](_0x55302a,function(_0x10085e){return _0x10085e[_0x2f12('0x67')];})},'attributes':['id',_0x2f12('0x67')],'raw':!![]})[_0x2f12('0x2d')](function(_0x8df5af){var _0x355e6b=_[_0x2f12('0x33')](_0x51c1b2[_0x2f12('0x50')],function(_0x181811){_0x181811[_0x2f12('0x5e')]=_0x51c1b2['params']['id'];return _0x181811;});return db[_0x2f12('0x5c')][_0x2f12('0x71')](_0x355e6b,{'raw':!![],'transaction':_0x2e9986});});}})[_0x2f12('0x4c')](handleError(_0x570847,null));});}})['then'](function(_0x26ce42){var _0x35cedc=_[_0x2f12('0x33')](_0x26ce42,function(_0x32be61){return _0x32be61[_0x2f12('0x53')]({'plain':!![]});});})[_0x2f12('0x2d')](respondWithResult(_0x570847,null))[_0x2f12('0x4c')](handleError(_0x570847,null));};exports[_0x2f12('0x72')]=function(_0x4f565c,_0xbf425f,_0x1fe040){return db[_0x2f12('0x4a')][_0x2f12('0x4e')]({'where':{'id':_0x4f565c[_0x2f12('0x52')]['id']}})[_0x2f12('0x2d')](handleEntityNotFound(_0xbf425f,null))[_0x2f12('0x2d')](function(_0x350b4b){if(_0x350b4b){return _0x350b4b[_0x2f12('0x72')](_0x4f565c[_0x2f12('0x38')][_0x2f12('0x63')]);}})[_0x2f12('0x2d')](respondWithStatusCode(_0xbf425f,null))[_0x2f12('0x4c')](handleError(_0xbf425f,null));};exports['getResources']=function(_0x1c0886,_0x3ee110){var _0x591b43={};if(!_0x1c0886['query'][_0x2f12('0x73')])throw new Error(_0x2f12('0x74'));if(!_0x1c0886['query']['hasOwnProperty'](_0x2f12('0x75'))){_0x591b43[_0x2f12('0x25')]=qs['limit'](_0x1c0886['query'][_0x2f12('0x25')]);_0x591b43[_0x2f12('0x26')]=qs[_0x2f12('0x26')](_0x1c0886[_0x2f12('0x38')][_0x2f12('0x26')]);}return db[_0x2f12('0x4a')][_0x2f12('0x4e')]({'where':{'id':_0x1c0886[_0x2f12('0x52')]['id']}})['then'](function(_0xca21a9){if(!_0xca21a9)throw new Error(_0x2f12('0x76')+_0x1c0886[_0x2f12('0x52')]['id']);return db[_0x2f12('0x4a')][_0x2f12('0x77')](_0x1c0886);})[_0x2f12('0x2d')](respondWithFilteredResult(_0x3ee110,_0x591b43))[_0x2f12('0x4c')](handleError(_0x3ee110,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index b094759..1958f99 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf963=['emit','hook','exports','events','setMaxListeners','save'];(function(_0x25a822,_0x5d2e4d){var _0x2b994f=function(_0x3338d8){while(--_0x3338d8){_0x25a822['push'](_0x25a822['shift']());}};_0x2b994f(++_0x5d2e4d);}(_0xf963,0x11d));var _0x3f96=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xf963[_0x422905];return _0x33dc6c;};'use strict';var EventEmitter=require(_0x3f96('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3f96('0x1')](0x0);var events={'afterCreate':_0x3f96('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f30a1){return function(_0x1e7cb9,_0x3a6815,_0x1a91ab){UserProfileEvents['emit'](_0x1f30a1+':'+_0x1e7cb9['id'],_0x1e7cb9);UserProfileEvents[_0x3f96('0x3')](_0x1f30a1,_0x1e7cb9);_0x1a91ab(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x3f96('0x4')](e,emitEvent(event));}}module[_0x3f96('0x5')]=UserProfileEvents; \ No newline at end of file +var _0x741c=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x30e9e3,_0x320365){var _0x4461ae=function(_0x5cfeea){while(--_0x5cfeea){_0x30e9e3['push'](_0x30e9e3['shift']());}};_0x4461ae(++_0x320365);}(_0x741c,0x196));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xc741('0x0'));var UserProfile=require(_0xc741('0x1'))['db'][_0xc741('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc741('0x3')](0x0);var events={'afterCreate':_0xc741('0x4'),'afterUpdate':_0xc741('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5cee2e){return function(_0x4089bf,_0x4ccc27,_0xc80e99){UserProfileEvents[_0xc741('0x6')](_0x5cee2e+':'+_0x4089bf['id'],_0x4089bf);UserProfileEvents[_0xc741('0x6')](_0x5cee2e,_0x4089bf);_0xc80e99(null);};}for(var e in events){if(events[_0xc741('0x7')](e)){var event=events[e];UserProfile[_0xc741('0x8')](e,emitEvent(event));}}module[_0xc741('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1b5f1e6..839e90c 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x168b=['SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','rawAttributes','model','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','where','merge','foreignKey','autoAssociation','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','ids','order','extraQueryConditions','Tags','color','tag','ThroughTags','rows','openTabs','true','chat','sms','fax','dataValues','mail','whatsapp','lodash','./userProfile.attributes','squel','models','filter','field','value','findAll','associatedResources','map','catch','then','UserProfileResource','type','resourceId','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','name','projectName','projects','JscriptyProject','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x168b,0x73));var _0xb168=function(_0x54fa87,_0x11ea34){_0x54fa87=_0x54fa87-0x0;var _0x57b534=_0x168b[_0x54fa87];return _0x57b534;};'use strict';var _=require(_0xb168('0x0'));var attributes=require(_0xb168('0x1'));var squel=require(_0xb168('0x2'));module['exports']=function(_0x422797){var _0x2673d6=_0x422797[_0xb168('0x3')];function _0xb335f2(_0x1db93b,_0x3b4e64){return new Promise(function(_0x547d49,_0x2fefd8){if(!_0x3b4e64)return _0x547d49(null);var _0x4b8db1=_0x3b4e64[_0xb168('0x4')]?{[_0x3b4e64[_0xb168('0x4')][_0xb168('0x5')]]:_0x3b4e64['filter'][_0xb168('0x6')]}:undefined;return _0x2673d6[_0x1db93b][_0xb168('0x7')]({'where':_0x4b8db1,'raw':!![]})['then'](function(_0x324635){_0x3b4e64[_0xb168('0x8')]=_[_0xb168('0x9')](_0x324635,'id');_0x547d49(_0x3b4e64);})[_0xb168('0xa')](function(_0x2ce7e6){_0x2fefd8(_0x2ce7e6);});});}function _0x27a7d0(_0x5e2021,_0x19117b){return new Promise(function(_0x435a27,_0x18afe3){var _0x3e4ee7=_0x5e2021[_0xb168('0x4')]?{[_0x5e2021[_0xb168('0x4')][_0xb168('0x5')]]:_0x5e2021[_0xb168('0x4')][_0xb168('0x6')]}:undefined;return _0x2673d6[_0x5e2021['model']][_0xb168('0x7')]({'where':_0x3e4ee7,'raw':!![]})[_0xb168('0xb')](function(_0x2bb2ce){_0x19117b[_0xb168('0x8')]=_[_0xb168('0x9')](_0x2bb2ce,function(_0x44e0a9){return _0x44e0a9['name'];});_0x435a27(_0x19117b);})[_0xb168('0xa')](function(_0x358192){_0x18afe3(_0x358192);});});}function _0x9e7f6e(_0x4871e5,_0x310d95,_0x51a7f4){if(!_0x310d95)return Promise['resolve'](null);return new Promise(function(_0x2095e1,_0x4c7232){return _0x2673d6[_0xb168('0xc')]['findAll']({'where':{'sectionId':_0x310d95['id']},'raw':!![]})[_0xb168('0xb')](function(_0x457314){if(_0x4871e5[_0xb168('0x5')]&&_0x4871e5[_0xb168('0x5')]!=='id'){_0x310d95['associatedResources']=_['map'](_0x457314,function(_0x23f92a){return _0x23f92a[_0x4871e5['field']];});}else{if(_0x51a7f4==='AnalyticExtractedReport'){_0x310d95['associatedResources']=_[_0xb168('0x9')](_0x457314,function(_0x7445ee){return{'id':_0x7445ee['resourceId'],'type':_0x7445ee[_0xb168('0xd')]};});}else{_0x310d95[_0xb168('0x8')]=_['map'](_0x457314,function(_0x1ac864){return _0x1ac864[_0xb168('0xe')];});}}_0x2095e1(_0x310d95);})[_0xb168('0xa')](function(_0x480565){_0x4c7232(_0x480565);});});}function _0x13d6cc(_0x46920b,_0x5eb8c0){var _0x5aaf34={'parentSections':[]};switch(_0x46920b['toLowerCase']()){case'squareprojects':_0x5aaf34[_0xb168('0xf')]=_0xb168('0x10');break;case _0xb168('0x11'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x12');break;case _0xb168('0x13'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x14');_0x5aaf34['parentSections']=[{'name':'SquareProjects','field':_0xb168('0x15'),'foreignKey':_0xb168('0x16')}];break;case _0xb168('0x17'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x18');break;case'contacts':_0x5aaf34[_0xb168('0xf')]=_0xb168('0x19');_0x5aaf34[_0xb168('0x1a')]=[{'name':_0xb168('0x1b'),'field':'id','foreignKey':_0xb168('0x1c')}];break;case _0xb168('0x1d'):_0x5aaf34['childModel']=_0xb168('0x1e');break;case _0xb168('0x1f'):_0x5aaf34['childModel']=_0xb168('0x20');break;case _0xb168('0x21'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x22');break;case _0xb168('0x23'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x24');break;case _0xb168('0x25'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x26');break;case _0xb168('0x27'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x28');break;case _0xb168('0x29'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x2a');break;case _0xb168('0x2b'):case _0xb168('0x2c'):case _0xb168('0x2d'):_0x5aaf34['childModel']='VoiceExtension';break;case _0xb168('0x2e'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x2f');break;case _0xb168('0x30'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x31');break;case _0xb168('0x32'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x33');_0x5aaf34[_0xb168('0x1a')]=[{'name':_0xb168('0x34'),'field':'name','foreignKey':'membername','model':_0xb168('0x35'),'filter':{'field':_0xb168('0x36'),'value':[_0xb168('0x37')]}},{'name':_0xb168('0x38'),'field':_0xb168('0x15'),'foreignKey':_0xb168('0x39'),'model':_0xb168('0x35'),'filter':{'field':_0xb168('0x36'),'value':[_0xb168('0x3a')]}},{'name':_0xb168('0x3b'),'field':'name','foreignKey':'queue','model':_0xb168('0x3c'),'filter':{'field':_0xb168('0xd'),'value':['inbound']}},{'name':_0xb168('0x3d'),'field':_0xb168('0x15'),'foreignKey':_0xb168('0x3e'),'model':_0xb168('0x3c'),'filter':{'field':_0xb168('0xd'),'value':[_0xb168('0x3f')]}}];break;case _0xb168('0x40'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x41');break;case _0xb168('0x42'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x43');break;case _0xb168('0x44'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x45');break;case _0xb168('0x46'):_0x5aaf34[_0xb168('0xf')]='Campaign';break;case _0xb168('0x47'):_0x5aaf34[_0xb168('0xf')]='MailQueue';break;case _0xb168('0x48'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x49');break;case _0xb168('0x4a'):_0x5aaf34['childModel']=_0xb168('0x4b');break;case _0xb168('0x4c'):_0x5aaf34['childModel']=_0xb168('0x4d');break;case _0xb168('0x4e'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x4f');break;case _0xb168('0x50'):_0x5aaf34['childModel']='SmsQueue';break;case _0xb168('0x51'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x52');break;case'whatsappqueues':_0x5aaf34['childModel']=_0xb168('0x53');break;case _0xb168('0x54'):_0x5aaf34[_0xb168('0xf')]='WhatsappAccount';break;case _0xb168('0x55'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x56');break;case _0xb168('0x57'):case _0xb168('0x58'):_0x5aaf34['childModel']='VoiceQueue';if(_0x5eb8c0){_0x5aaf34[_0xb168('0x1a')]=[{'name':_0xb168('0x3b')},{'name':_0xb168('0x3d')}];}break;case'users':case _0xb168('0x59'):case'telephones':_0x5aaf34[_0xb168('0xf')]=_0xb168('0x35');if(_0x5eb8c0){_0x5aaf34[_0xb168('0x1a')]=[{'name':_0xb168('0x5a'),'filter':{'field':'role','value':[_0xb168('0x5b'),'user']},'ignore':!![]},{'name':_0xb168('0x34')},{'name':'Telephones'}];}break;case _0xb168('0x5c'):_0x5aaf34['childModel']=_0xb168('0x5d');break;case _0xb168('0x5e'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x5f');break;case'freshdeskaccounts':_0x5aaf34[_0xb168('0xf')]=_0xb168('0x60');break;case _0xb168('0x61'):_0x5aaf34[_0xb168('0xf')]='SugarcrmAccount';break;case'deskaccounts':_0x5aaf34['childModel']='DeskAccount';break;case'zohoaccounts':_0x5aaf34[_0xb168('0xf')]=_0xb168('0x62');break;case _0xb168('0x63'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x35');break;case _0xb168('0x64'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x65');break;case _0xb168('0x66'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x67');break;case _0xb168('0x68'):_0x5aaf34['childModel']=_0xb168('0x69');break;case _0xb168('0x6a'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x6b');break;case'pauses':_0x5aaf34[_0xb168('0xf')]='Pause';break;case _0xb168('0x6c'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x6d');break;case _0xb168('0x6e'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x6f');break;case _0xb168('0x70'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x71');break;case _0xb168('0x72'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x73');break;case _0xb168('0x74'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x75');break;case _0xb168('0x76'):_0x5aaf34['childModel']=_0xb168('0x77');break;case _0xb168('0x78'):_0x5aaf34[_0xb168('0xf')]='Variable';break;case _0xb168('0x79'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x7a');break;case _0xb168('0x7b'):_0x5aaf34[_0xb168('0xf')]=_0xb168('0x7c');_0x5aaf34[_0xb168('0x1a')]=[{'name':_0xb168('0x7d'),'field':'id','foreignKey':_0xb168('0x7e')}];break;case _0xb168('0x7f'):_0x5aaf34['childModel']=_0xb168('0x80');break;}return _0x5aaf34;}function _0x28def7(_0x11cbe0,_0x2486a1){var _0xd5540c=_0x11cbe0[_0xb168('0x81')](0x0)[_0xb168('0x82')]()+_0x11cbe0['slice'](0x1);var _0x3616ec={'type':_0x2673d6['Sequelize'][_0xb168('0x83')][_0xb168('0x84')],'raw':!![]};return new Promise(function(_0x1ea0ee,_0x4a4edf){var _0xad857d=squel[_0xb168('0x85')]()[_0xb168('0x5')](_0xb168('0x86')+_0xd5540c+'InteractionId','id')[_0xb168('0x5')](_0xb168('0x87'))[_0xb168('0x88')](_0xb168('0x89')+_0x11cbe0+_0xb168('0x8a'),'ui')['where'](_0xb168('0x8b'),_0x2486a1['id']);return _0x2673d6['sequelize'][_0xb168('0x8c')](_0xad857d[_0xb168('0x8d')](),_0x3616ec)[_0xb168('0xb')](function(_0x150b94){_0x2486a1[_0xd5540c+_0xb168('0x8e')]=_0x150b94;_0x1ea0ee(_0x150b94);})[_0xb168('0xa')](function(_0x57cb9c){_0x4a4edf(_0x57cb9c);});});}return _0x422797[_0xb168('0x8f')](_0xb168('0x90'),attributes,{'tableName':_0xb168('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x51f429){var _0x48bd61=require('../../components/parsers/qs');var _0x2995b4={'raw':_0x51f429[_0xb168('0x8c')][_0xb168('0x92')],'where':{}};var _0x5dc5cd={};var _0x444352={'count':0x0,'rows':[]};var _0x4d2941=_0x51f429['query']['section'];var _0xe6e5ee=_0x51f429[_0xb168('0x8c')]['mergeResources']||![];var _0x50a96c=_0x13d6cc(_0x4d2941,_0xe6e5ee);if(!_0x50a96c[_0xb168('0xf')])throw new Error(_0xb168('0x93')+_0x4d2941+'\x27');var _0x17018e=[{'name':_0x4d2941}];if(!_[_0xb168('0x94')](_0x50a96c['parentSections']))_0x17018e=_0x50a96c[_0xb168('0x1a')];var _0x448966=[];for(var _0x4ae161=0x0;_0x4ae161<_0x17018e[_0xb168('0x95')];_0x4ae161++){_0x448966[_0xb168('0x96')](_0x2673d6['UserProfileSection'][_0xb168('0x97')]({'where':{'userProfileId':_0x51f429[_0xb168('0x98')]['id'],'name':_0x17018e[_0x4ae161][_0xb168('0x15')]},'raw':!![]}));}return Promise[_0xb168('0x99')](_0x448966)[_0xb168('0xb')](function(_0x5260ce){var _0x4608e5=_[_0xb168('0x4')](_0x5260ce,function(_0x34e970){return _0x34e970?_0x34e970:undefined;});var _0x5a7fe9=_['filter'](_0x17018e,[_0xb168('0x9a'),!![]]);var _0x35a8fe=_[_0xb168('0x94')](_0x4608e5)&&_[_0xb168('0x94')](_0x5a7fe9)?null:_[_0xb168('0x9b')](_0x5a7fe9,_0x4608e5);if(!_0x35a8fe)return null;var _0x5e9618=[];for(var _0x358b48=0x0;_0x358b48<_0x35a8fe[_0xb168('0x95')];_0x358b48++){var _0x2073b0=_[_0xb168('0x97')](_0x17018e,function(_0x9ea8f9){return _0x35a8fe[_0x358b48]?_0x9ea8f9['name']===_0x35a8fe[_0x358b48][_0xb168('0x15')]:null;});if(_0x2073b0){if(_0x35a8fe[_0x358b48][_0xb168('0x9a')]){_0x5e9618[_0xb168('0x96')](_0xb335f2(_0x50a96c[_0xb168('0xf')],_0x35a8fe[_0x358b48]));}else{if(!_0x35a8fe[_0x358b48]['autoAssociation']){_0x5e9618[_0xb168('0x96')](_0x9e7f6e(_0x2073b0,_0x35a8fe[_0x358b48],_0x50a96c['childModel']));}else{if(_0x2073b0['model']){_0x5e9618[_0xb168('0x96')](_0x27a7d0(_0x2073b0,_0x35a8fe[_0x358b48]));}}}}}return Promise[_0xb168('0x99')](_0x5e9618);})[_0xb168('0xb')](function(_0x2d4eec){var _0x1cef39=_0x2d4eec;var _0x4d0c6f=null;if(_0x1cef39){_0x4d0c6f=_0x1cef39[_0xb168('0x95')]===0x1?_0x1cef39[0x0]:null;}if(!_0x4d0c6f&&!_0x1cef39)return _0x444352;var _0x194fdf=_0x2673d6[_0x50a96c[_0xb168('0xf')]][_0xb168('0x9c')];_0x5dc5cd[_0xb168('0x9d')]=_['keys'](_0x194fdf);_0x5dc5cd['query']=_[_0xb168('0x9e')](_0x51f429['query']);_0x5dc5cd[_0xb168('0x9f')]=_[_0xb168('0xa0')](_0x5dc5cd['model'],_0x5dc5cd['query']);_0x2995b4[_0xb168('0xa1')]=_[_0xb168('0xa0')](_0x5dc5cd[_0xb168('0x9d')],_0x48bd61[_0xb168('0xa2')](_0x51f429[_0xb168('0x8c')][_0xb168('0xa2')]));_0x2995b4[_0xb168('0xa1')]=_0x2995b4['attributes']['length']?_0x2995b4[_0xb168('0xa1')]:_0x5dc5cd[_0xb168('0x9d')];if(!_0x51f429['query']['hasOwnProperty'](_0xb168('0xa3'))){_0x2995b4[_0xb168('0xa4')]=_0x48bd61['limit'](_0x51f429['query'][_0xb168('0xa4')]);_0x2995b4[_0xb168('0xa5')]=_0x48bd61['offset'](_0x51f429[_0xb168('0x8c')][_0xb168('0xa5')]);}_0x2995b4['order']=_0x48bd61['sort'](_0x51f429[_0xb168('0x8c')][_0xb168('0xa6')]);_0x2995b4['where']=_0x48bd61[_0xb168('0x9f')](_[_0xb168('0xa7')](_0x51f429['query'],_0x5dc5cd[_0xb168('0x9f')]));if(_0x51f429[_0xb168('0x8c')][_0xb168('0x4')]){_0x2995b4[_0xb168('0xa8')]=_[_0xb168('0xa9')](_0x2995b4[_0xb168('0xa8')],{'$or':_[_0xb168('0x9')](_0x194fdf,function(_0x5da4e1){if(_0x5da4e1[_0xb168('0xd')]['key']!=='VIRTUAL'){var _0x116726={};_0x116726[_0x5da4e1['field']]={'$like':'%'+_0x51f429['query'][_0xb168('0x4')]+'%'};return _0x116726;}})});}var _0x28beb7=[];var _0x3138ec=null;var _0x1e7410={};if(_0x4d0c6f){_0x3138ec=_[_0xb168('0x97')](_0x17018e,[_0xb168('0x15'),_0x4d0c6f[_0xb168('0x15')]]);if(_0x3138ec['field']){_0x1e7410={};if(_0x50a96c['childModel']===_0xb168('0x7c')){_0x1e7410[_0x3138ec['foreignKey']]=_[_0xb168('0x9')](_0x4d0c6f[_0xb168('0x8')],'id');}else{_0x1e7410[_0x3138ec[_0xb168('0xaa')]]=_0x4d0c6f['associatedResources'];}_0x28beb7[_0xb168('0x96')](_0x1e7410);}else{_0x2995b4[_0xb168('0xa8')]['id']=_0x4d0c6f[_0xb168('0x8')];}}else{for(var _0xa289af=0x0;_0xa289af<_0x1cef39[_0xb168('0x95')];_0xa289af++){_0x3138ec=_[_0xb168('0x97')](_0x17018e,[_0xb168('0x15'),_0x1cef39[_0xa289af][_0xb168('0x15')]]);if(_0x3138ec[_0xb168('0x5')]){_0x1e7410={};_0x1e7410[_0x3138ec[_0xb168('0xaa')]]=_0x1cef39[_0xa289af][_0xb168('0x8')];_0x28beb7[_0xb168('0x96')](_0x1e7410);}else{if(!_0x2995b4[_0xb168('0xa8')]['id'])_0x2995b4[_0xb168('0xa8')]['id']=[];_0x1cef39[_0xa289af]['associatedResources']['forEach'](function(_0x235c47){_0x2995b4[_0xb168('0xa8')]['id'][_0xb168('0x96')](_0x235c47);});}}}if(!_[_0xb168('0x94')](_0x28beb7)){_0x2995b4[_0xb168('0xa8')]=_[_0xb168('0xa9')](_0x2995b4[_0xb168('0xa8')],{'$and':{'$or':_0x28beb7}});}_0x2995b4=_[_0xb168('0xa9')]({},_0x2995b4,_0x51f429['options']);if(_0x4d0c6f&&!_0x4d0c6f[_0xb168('0xab')]&&_0x50a96c[_0xb168('0xf')]==='AnalyticExtractedReport'){if(_0x51f429[_0xb168('0x8c')][_0xb168('0xac')]){_0x2995b4[_0xb168('0xad')]=[{'all':!![]}];}return _0x2673d6[_0x50a96c[_0xb168('0xf')]]['findAll'](_0x2995b4)[_0xb168('0xb')](function(_0x2b8ce5){var _0x329137=[];_0x2b8ce5[_0xb168('0xae')](function(_0x33ebcd){var _0x496750;switch(_0x33ebcd[_0xb168('0xaf')]){case _0xb168('0xb0'):_0x496750=_['find'](_0x4d0c6f[_0xb168('0x8')],function(_0x43435b){return _0x43435b['id']===_0x33ebcd[_0xb168('0x7e')]&&_0x43435b[_0xb168('0xd')]===_0xb168('0xb1');});break;case _0xb168('0xb2'):_0x496750=_[_0xb168('0x97')](_0x4d0c6f[_0xb168('0x8')],function(_0x5ab1ea){return _0x5ab1ea['id']===_0x33ebcd[_0xb168('0x7e')]&&_0x5ab1ea[_0xb168('0xd')]===_0xb168('0xb3');});break;}if(_0x496750)_0x329137[_0xb168('0x96')](_0x33ebcd);});_0x444352[_0xb168('0xb4')]=_0x329137['length'];_0x444352['rows']=_0x329137;return _0x444352;});}else{if(!_[_0xb168('0x94')](_0x51f429[_0xb168('0x8c')][_0xb168('0xb5')])){_0x2995b4[_0xb168('0xa8')]['id']=_0x2995b4[_0xb168('0xa8')]['id']?_['intersection'](_0x2995b4[_0xb168('0xa8')]['id'],_0x51f429[_0xb168('0x8c')][_0xb168('0xb5')]):_0x51f429['query']['ids'];if(_0x51f429[_0xb168('0x8c')]['customSorting']){_0x2995b4[_0xb168('0xb6')]=_0x51f429['query']['customSorting'];}}if(_0x51f429[_0xb168('0x8c')]['extraQueryConditions']){_0x2995b4['where']=_[_0xb168('0xa9')](_0x2995b4[_0xb168('0xa8')],{'$and':_0x51f429[_0xb168('0x8c')][_0xb168('0xb7')]});}return _0x2673d6[_0x50a96c[_0xb168('0xf')]]['count']({'where':_0x2995b4[_0xb168('0xa8')]})[_0xb168('0xb')](function(_0x65bd9e){_0x444352[_0xb168('0xb4')]=_0x65bd9e;if(_0x51f429[_0xb168('0x8c')][_0xb168('0xac')]){if(_0x50a96c['childModel']==='CmContact'){_0x2995b4[_0xb168('0xad')]=[{'model':_0x2673d6['Tag'],'as':_0xb168('0xb8'),'attributes':['id',_0xb168('0x15'),_0xb168('0xb9')],'required':_0x51f429[_0xb168('0x8c')][_0xb168('0xba')]?!![]:![]},{'model':_0x2673d6[_0xb168('0x71')],'as':_0xb168('0xbb'),'attributes':['id','name','color'],'through':_0x51f429[_0xb168('0x8c')][_0xb168('0xba')]?{'attributes':[],'where':{'TagId':_0x51f429[_0xb168('0x8c')]['tag']||undefined}}:{},'required':_0x51f429['query']['tag']?!![]:![]}];}else{_0x2995b4[_0xb168('0xad')]=[{'all':!![]}];}}return _0x2673d6[_0x50a96c[_0xb168('0xf')]][_0xb168('0x7')](_0x2995b4);})[_0xb168('0xb')](function(_0x4e0274){_0x444352[_0xb168('0xbc')]=_0x4e0274;if(_0x4d2941==='Agents'&&_0x51f429[_0xb168('0x8c')][_0xb168('0xbd')]===_0xb168('0xbe')){var _0x59e475=[];for(var _0x2d2e43=0x0;_0x2d2e43<_0x444352['rows'][_0xb168('0x95')];_0x2d2e43++){_0x59e475['push'](_0x28def7(_0xb168('0xbf'),_0x444352['rows'][_0x2d2e43]['dataValues']));_0x59e475[_0xb168('0x96')](_0x28def7(_0xb168('0xc0'),_0x444352['rows'][_0x2d2e43]['dataValues']));_0x59e475[_0xb168('0x96')](_0x28def7(_0xb168('0xc1'),_0x444352[_0xb168('0xbc')][_0x2d2e43][_0xb168('0xc2')]));_0x59e475[_0xb168('0x96')](_0x28def7(_0xb168('0xc3'),_0x444352[_0xb168('0xbc')][_0x2d2e43][_0xb168('0xc2')]));_0x59e475[_0xb168('0x96')](_0x28def7('openchannel',_0x444352[_0xb168('0xbc')][_0x2d2e43][_0xb168('0xc2')]));_0x59e475[_0xb168('0x96')](_0x28def7(_0xb168('0xc4'),_0x444352['rows'][_0x2d2e43][_0xb168('0xc2')]));}return Promise['all'](_0x59e475)['then'](function(){return _0x444352;});}return _0x444352;});}});}}});}; \ No newline at end of file +var _0xd325=['Schedule','sounds','Sound','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','count','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','mail','whatsapp','./userProfile.attributes','squel','models','filter','value','findAll','then','associatedResources','field','model','map','name','catch','resolve','AnalyticExtractedReport','type','resourceId','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','CmContact','Lists','ListId','CmList','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicerecordings','membername','role','agent','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailSubstatus','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','User','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Pause','scheduler'];(function(_0x108b94,_0x578d0f){var _0x5e377e=function(_0x309357){while(--_0x309357){_0x108b94['push'](_0x108b94['shift']());}};_0x5e377e(++_0x578d0f);}(_0xd325,0x1c2));var _0x5d32=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0xd325[_0x380e75];return _0x444d96;};'use strict';var _=require('lodash');var attributes=require(_0x5d32('0x0'));var squel=require(_0x5d32('0x1'));module['exports']=function(_0x15b30e){var _0x320a20=_0x15b30e[_0x5d32('0x2')];function _0x5473a8(_0x3fcf47,_0x541990){return new Promise(function(_0x2131b6,_0x57f6c0){if(!_0x541990)return _0x2131b6(null);var _0x14fd8e=_0x541990[_0x5d32('0x3')]?{[_0x541990[_0x5d32('0x3')]['field']]:_0x541990['filter'][_0x5d32('0x4')]}:undefined;return _0x320a20[_0x3fcf47][_0x5d32('0x5')]({'where':_0x14fd8e,'raw':!![]})[_0x5d32('0x6')](function(_0x3724ee){_0x541990[_0x5d32('0x7')]=_['map'](_0x3724ee,'id');_0x2131b6(_0x541990);})['catch'](function(_0x2651a0){_0x57f6c0(_0x2651a0);});});}function _0x39a047(_0x51a008,_0x213777){return new Promise(function(_0x5b83f1,_0x1bd5e7){var _0x382bfc=_0x51a008['filter']?{[_0x51a008[_0x5d32('0x3')][_0x5d32('0x8')]]:_0x51a008[_0x5d32('0x3')][_0x5d32('0x4')]}:undefined;return _0x320a20[_0x51a008[_0x5d32('0x9')]]['findAll']({'where':_0x382bfc,'raw':!![]})['then'](function(_0x603711){_0x213777[_0x5d32('0x7')]=_[_0x5d32('0xa')](_0x603711,function(_0x955cc8){return _0x955cc8[_0x5d32('0xb')];});_0x5b83f1(_0x213777);})[_0x5d32('0xc')](function(_0xddba3f){_0x1bd5e7(_0xddba3f);});});}function _0x27c6d9(_0x1ba340,_0x14d875,_0x1ba2ee){if(!_0x14d875)return Promise[_0x5d32('0xd')](null);return new Promise(function(_0x372b1d,_0x275212){return _0x320a20['UserProfileResource'][_0x5d32('0x5')]({'where':{'sectionId':_0x14d875['id']},'raw':!![]})[_0x5d32('0x6')](function(_0x31ddff){if(_0x1ba340['field']&&_0x1ba340[_0x5d32('0x8')]!=='id'){_0x14d875[_0x5d32('0x7')]=_[_0x5d32('0xa')](_0x31ddff,function(_0x5b3d9b){return _0x5b3d9b[_0x1ba340[_0x5d32('0x8')]];});}else{if(_0x1ba2ee===_0x5d32('0xe')){_0x14d875[_0x5d32('0x7')]=_[_0x5d32('0xa')](_0x31ddff,function(_0xf7e2a7){return{'id':_0xf7e2a7['resourceId'],'type':_0xf7e2a7[_0x5d32('0xf')]};});}else{_0x14d875[_0x5d32('0x7')]=_[_0x5d32('0xa')](_0x31ddff,function(_0x447acc){return _0x447acc[_0x5d32('0x10')];});}}_0x372b1d(_0x14d875);})['catch'](function(_0x2d0c80){_0x275212(_0x2d0c80);});});}function _0x20075a(_0xc82333,_0x46bc4b){var _0x38e9f8={'parentSections':[]};switch(_0xc82333['toLowerCase']()){case'squareprojects':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x12');break;case _0x5d32('0x13'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x14');break;case'squarerecordings':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x15');_0x38e9f8[_0x5d32('0x16')]=[{'name':_0x5d32('0x17'),'field':_0x5d32('0xb'),'foreignKey':_0x5d32('0x18')}];break;case'projects':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x19');break;case'contacts':_0x38e9f8['childModel']=_0x5d32('0x1a');_0x38e9f8[_0x5d32('0x16')]=[{'name':_0x5d32('0x1b'),'field':'id','foreignKey':_0x5d32('0x1c')}];break;case'lists':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x1d');break;case'companies':_0x38e9f8['childModel']=_0x5d32('0x1e');break;case _0x5d32('0x1f'):_0x38e9f8['childModel']='CmCustomField';break;case _0x5d32('0x20'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x21');break;case _0x5d32('0x22'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x23');break;case _0x5d32('0x24'):_0x38e9f8['childModel']=_0x5d32('0x25');break;case'faxaccounts':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x26');break;case _0x5d32('0x27'):case _0x5d32('0x28'):case _0x5d32('0x29'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x2a');break;case'contexts':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x2b');break;case'voicemails':_0x38e9f8['childModel']='VoiceMail';break;case _0x5d32('0x2c'):_0x38e9f8[_0x5d32('0x11')]='VoiceRecording';_0x38e9f8[_0x5d32('0x16')]=[{'name':'Agents','field':_0x5d32('0xb'),'foreignKey':_0x5d32('0x2d'),'model':'User','filter':{'field':_0x5d32('0x2e'),'value':[_0x5d32('0x2f')]}},{'name':'Telephones','field':_0x5d32('0xb'),'foreignKey':_0x5d32('0x2d'),'model':'User','filter':{'field':_0x5d32('0x2e'),'value':[_0x5d32('0x30')]}},{'name':_0x5d32('0x31'),'field':_0x5d32('0xb'),'foreignKey':_0x5d32('0x32'),'model':_0x5d32('0x33'),'filter':{'field':_0x5d32('0xf'),'value':['inbound']}},{'name':_0x5d32('0x34'),'field':_0x5d32('0xb'),'foreignKey':'queue','model':_0x5d32('0x33'),'filter':{'field':'type','value':['outbound']}}];break;case _0x5d32('0x35'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x36');break;case _0x5d32('0x37'):_0x38e9f8[_0x5d32('0x11')]='VoiceChanSpy';break;case _0x5d32('0x38'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x39');break;case _0x5d32('0x3a'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x3b');break;case _0x5d32('0x3c'):_0x38e9f8[_0x5d32('0x11')]='MailQueue';break;case _0x5d32('0x3d'):_0x38e9f8[_0x5d32('0x11')]='MailAccount';break;case'mailsubstatuses':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x3e');break;case'openchannelqueues':_0x38e9f8[_0x5d32('0x11')]='OpenchannelQueue';break;case _0x5d32('0x3f'):_0x38e9f8[_0x5d32('0x11')]='OpenchannelAccount';break;case _0x5d32('0x40'):_0x38e9f8['childModel']=_0x5d32('0x41');break;case'smsaccounts':_0x38e9f8[_0x5d32('0x11')]='SmsAccount';break;case _0x5d32('0x42'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x43');break;case _0x5d32('0x44'):_0x38e9f8['childModel']=_0x5d32('0x45');break;case _0x5d32('0x46'):_0x38e9f8['childModel']=_0x5d32('0x47');break;case _0x5d32('0x48'):case _0x5d32('0x49'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x33');if(_0x46bc4b){_0x38e9f8['parentSections']=[{'name':_0x5d32('0x31')},{'name':_0x5d32('0x34')}];}break;case _0x5d32('0x4a'):case'agents':case _0x5d32('0x4b'):_0x38e9f8['childModel']=_0x5d32('0x4c');if(_0x46bc4b){_0x38e9f8['parentSections']=[{'name':_0x5d32('0x4d'),'filter':{'field':_0x5d32('0x2e'),'value':[_0x5d32('0x4e'),_0x5d32('0x4f')]},'ignore':!![]},{'name':_0x5d32('0x50')},{'name':'Telephones'}];}break;case _0x5d32('0x51'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x52');break;case _0x5d32('0x53'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x54');break;case _0x5d32('0x55'):_0x38e9f8[_0x5d32('0x11')]='FreshdeskAccount';break;case _0x5d32('0x56'):_0x38e9f8[_0x5d32('0x11')]='SugarcrmAccount';break;case _0x5d32('0x57'):_0x38e9f8[_0x5d32('0x11')]='DeskAccount';break;case _0x5d32('0x58'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x59');break;case _0x5d32('0x5a'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x4c');break;case _0x5d32('0x5b'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x5c');break;case _0x5d32('0x5d'):_0x38e9f8['childModel']='Disposition';break;case _0x5d32('0x5e'):_0x38e9f8['childModel']=_0x5d32('0x5f');break;case _0x5d32('0x60'):_0x38e9f8[_0x5d32('0x11')]='Interval';break;case'pauses':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x61');break;case _0x5d32('0x62'):_0x38e9f8['childModel']=_0x5d32('0x63');break;case _0x5d32('0x64'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x65');break;case'tags':_0x38e9f8[_0x5d32('0x11')]='Tag';break;case'templates':_0x38e9f8['childModel']=_0x5d32('0x66');break;case _0x5d32('0x67'):_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x68');break;case _0x5d32('0x69'):_0x38e9f8['childModel']=_0x5d32('0x6a');break;case _0x5d32('0x6b'):_0x38e9f8[_0x5d32('0x11')]='Variable';break;case _0x5d32('0x6c'):_0x38e9f8['childModel']=_0x5d32('0x6d');break;case _0x5d32('0x6e'):_0x38e9f8[_0x5d32('0x11')]='AnalyticExtractedReport';_0x38e9f8['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x5d32('0x6f')}];break;case'metrics':_0x38e9f8[_0x5d32('0x11')]=_0x5d32('0x70');break;}return _0x38e9f8;}function _0x561776(_0x54b113,_0x2c7b7d){var _0x3fdaf6=_0x54b113[_0x5d32('0x71')](0x0)[_0x5d32('0x72')]()+_0x54b113[_0x5d32('0x73')](0x1);var _0x58adf1={'type':_0x320a20[_0x5d32('0x74')][_0x5d32('0x75')][_0x5d32('0x76')],'raw':!![]};return new Promise(function(_0x3dd940,_0x51da8e){var _0x326a44=squel[_0x5d32('0x77')]()[_0x5d32('0x8')](_0x5d32('0x78')+_0x3fdaf6+_0x5d32('0x79'),'id')['field'](_0x5d32('0x7a'))[_0x5d32('0x7b')](_0x5d32('0x7c')+_0x54b113+_0x5d32('0x7d'),'ui')[_0x5d32('0x7e')]('ui.UserId\x20=\x20?',_0x2c7b7d['id']);return _0x320a20['sequelize']['query'](_0x326a44[_0x5d32('0x7f')](),_0x58adf1)[_0x5d32('0x6')](function(_0xa35876){_0x2c7b7d[_0x3fdaf6+_0x5d32('0x80')]=_0xa35876;_0x3dd940(_0xa35876);})[_0x5d32('0xc')](function(_0x1ef7e5){_0x51da8e(_0x1ef7e5);});});}return _0x15b30e[_0x5d32('0x81')](_0x5d32('0x82'),attributes,{'tableName':_0x5d32('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x452a62){var _0x56a629=require(_0x5d32('0x84'));var _0x5055c4={'raw':_0x452a62[_0x5d32('0x85')]['raw'],'where':{}};var _0x13e656={};var _0x5b76ff={'count':0x0,'rows':[]};var _0x221a47=_0x452a62['query'][_0x5d32('0x86')];var _0xc35a50=_0x452a62[_0x5d32('0x85')][_0x5d32('0x87')]||![];var _0x169f5e=_0x20075a(_0x221a47,_0xc35a50);if(!_0x169f5e[_0x5d32('0x11')])throw new Error(_0x5d32('0x88')+_0x221a47+'\x27');var _0x1a1e4d=[{'name':_0x221a47}];if(!_[_0x5d32('0x89')](_0x169f5e[_0x5d32('0x16')]))_0x1a1e4d=_0x169f5e[_0x5d32('0x16')];var _0x13163d=[];for(var _0x401c79=0x0;_0x401c79<_0x1a1e4d[_0x5d32('0x8a')];_0x401c79++){_0x13163d[_0x5d32('0x8b')](_0x320a20[_0x5d32('0x8c')][_0x5d32('0x8d')]({'where':{'userProfileId':_0x452a62[_0x5d32('0x8e')]['id'],'name':_0x1a1e4d[_0x401c79][_0x5d32('0xb')]},'raw':!![]}));}return Promise[_0x5d32('0x8f')](_0x13163d)[_0x5d32('0x6')](function(_0x4628f7){var _0x546ecc=_['filter'](_0x4628f7,function(_0x30f552){return _0x30f552?_0x30f552:undefined;});var _0x5bb228=_[_0x5d32('0x3')](_0x1a1e4d,[_0x5d32('0x90'),!![]]);var _0x2847f3=_[_0x5d32('0x89')](_0x546ecc)&&_[_0x5d32('0x89')](_0x5bb228)?null:_['union'](_0x5bb228,_0x546ecc);if(!_0x2847f3)return null;var _0x3db0a6=[];for(var _0x4bcadf=0x0;_0x4bcadf<_0x2847f3[_0x5d32('0x8a')];_0x4bcadf++){var _0x4c9bd8=_[_0x5d32('0x8d')](_0x1a1e4d,function(_0x3c0dfe){return _0x2847f3[_0x4bcadf]?_0x3c0dfe[_0x5d32('0xb')]===_0x2847f3[_0x4bcadf]['name']:null;});if(_0x4c9bd8){if(_0x2847f3[_0x4bcadf]['ignore']){_0x3db0a6[_0x5d32('0x8b')](_0x5473a8(_0x169f5e[_0x5d32('0x11')],_0x2847f3[_0x4bcadf]));}else{if(!_0x2847f3[_0x4bcadf]['autoAssociation']){_0x3db0a6[_0x5d32('0x8b')](_0x27c6d9(_0x4c9bd8,_0x2847f3[_0x4bcadf],_0x169f5e[_0x5d32('0x11')]));}else{if(_0x4c9bd8[_0x5d32('0x9')]){_0x3db0a6[_0x5d32('0x8b')](_0x39a047(_0x4c9bd8,_0x2847f3[_0x4bcadf]));}}}}}return Promise[_0x5d32('0x8f')](_0x3db0a6);})[_0x5d32('0x6')](function(_0x2820d0){var _0x15e2c6=_0x2820d0;var _0x3eef6e=null;if(_0x15e2c6){_0x3eef6e=_0x15e2c6['length']===0x1?_0x15e2c6[0x0]:null;}if(!_0x3eef6e&&!_0x15e2c6)return _0x5b76ff;var _0x1843db=_0x320a20[_0x169f5e[_0x5d32('0x11')]][_0x5d32('0x91')];_0x13e656[_0x5d32('0x9')]=_[_0x5d32('0x92')](_0x1843db);_0x13e656[_0x5d32('0x85')]=_[_0x5d32('0x92')](_0x452a62[_0x5d32('0x85')]);_0x13e656[_0x5d32('0x93')]=_[_0x5d32('0x94')](_0x13e656[_0x5d32('0x9')],_0x13e656['query']);_0x5055c4[_0x5d32('0x95')]=_[_0x5d32('0x94')](_0x13e656[_0x5d32('0x9')],_0x56a629[_0x5d32('0x96')](_0x452a62[_0x5d32('0x85')][_0x5d32('0x96')]));_0x5055c4[_0x5d32('0x95')]=_0x5055c4[_0x5d32('0x95')][_0x5d32('0x8a')]?_0x5055c4[_0x5d32('0x95')]:_0x13e656[_0x5d32('0x9')];if(!_0x452a62[_0x5d32('0x85')][_0x5d32('0x97')](_0x5d32('0x98'))){_0x5055c4[_0x5d32('0x99')]=_0x56a629['limit'](_0x452a62[_0x5d32('0x85')][_0x5d32('0x99')]);_0x5055c4[_0x5d32('0x9a')]=_0x56a629[_0x5d32('0x9a')](_0x452a62[_0x5d32('0x85')][_0x5d32('0x9a')]);}_0x5055c4['order']=_0x56a629[_0x5d32('0x9b')](_0x452a62[_0x5d32('0x85')][_0x5d32('0x9b')]);_0x5055c4[_0x5d32('0x7e')]=_0x56a629[_0x5d32('0x93')](_[_0x5d32('0x9c')](_0x452a62['query'],_0x13e656[_0x5d32('0x93')]));if(_0x452a62[_0x5d32('0x85')][_0x5d32('0x3')]){_0x5055c4[_0x5d32('0x7e')]=_[_0x5d32('0x9d')](_0x5055c4[_0x5d32('0x7e')],{'$or':_[_0x5d32('0xa')](_0x1843db,function(_0x531a25){if(_0x531a25[_0x5d32('0xf')][_0x5d32('0x9e')]!==_0x5d32('0x9f')){var _0x204f92={};_0x204f92[_0x531a25[_0x5d32('0x8')]]={'$like':'%'+_0x452a62[_0x5d32('0x85')][_0x5d32('0x3')]+'%'};return _0x204f92;}})});}var _0x314746=[];var _0x9cd89=null;var _0x37f27d={};if(_0x3eef6e){_0x9cd89=_[_0x5d32('0x8d')](_0x1a1e4d,[_0x5d32('0xb'),_0x3eef6e[_0x5d32('0xb')]]);if(_0x9cd89['field']){_0x37f27d={};if(_0x169f5e[_0x5d32('0x11')]===_0x5d32('0xe')){_0x37f27d[_0x9cd89[_0x5d32('0xa0')]]=_[_0x5d32('0xa')](_0x3eef6e['associatedResources'],'id');}else{_0x37f27d[_0x9cd89['foreignKey']]=_0x3eef6e[_0x5d32('0x7')];}_0x314746[_0x5d32('0x8b')](_0x37f27d);}else{_0x5055c4['where']['id']=_0x3eef6e[_0x5d32('0x7')];}}else{for(var _0x52a292=0x0;_0x52a292<_0x15e2c6[_0x5d32('0x8a')];_0x52a292++){_0x9cd89=_[_0x5d32('0x8d')](_0x1a1e4d,[_0x5d32('0xb'),_0x15e2c6[_0x52a292]['name']]);if(_0x9cd89[_0x5d32('0x8')]){_0x37f27d={};_0x37f27d[_0x9cd89['foreignKey']]=_0x15e2c6[_0x52a292][_0x5d32('0x7')];_0x314746[_0x5d32('0x8b')](_0x37f27d);}else{if(!_0x5055c4[_0x5d32('0x7e')]['id'])_0x5055c4[_0x5d32('0x7e')]['id']=[];_0x15e2c6[_0x52a292]['associatedResources'][_0x5d32('0xa1')](function(_0x5a0d6a){_0x5055c4['where']['id'][_0x5d32('0x8b')](_0x5a0d6a);});}}}if(!_[_0x5d32('0x89')](_0x314746)){_0x5055c4['where']=_[_0x5d32('0x9d')](_0x5055c4[_0x5d32('0x7e')],{'$and':{'$or':_0x314746}});}_0x5055c4=_['merge']({},_0x5055c4,_0x452a62['options']);if(_0x3eef6e&&!_0x3eef6e['autoAssociation']&&_0x169f5e['childModel']===_0x5d32('0xe')){if(_0x452a62['query'][_0x5d32('0xa2')]){_0x5055c4[_0x5d32('0xa3')]=[{'all':!![]}];}return _0x320a20[_0x169f5e[_0x5d32('0x11')]][_0x5d32('0x5')](_0x5055c4)['then'](function(_0x5f4450){var _0x30532c=[];_0x5f4450[_0x5d32('0xa1')](function(_0x3fea49){var _0x3775e1;switch(_0x3fea49[_0x5d32('0xa4')]){case _0x5d32('0xa5'):_0x3775e1=_[_0x5d32('0x8d')](_0x3eef6e['associatedResources'],function(_0x1c1868){return _0x1c1868['id']===_0x3fea49['reportId']&&_0x1c1868[_0x5d32('0xf')]===_0x5d32('0xa6');});break;case _0x5d32('0xa7'):_0x3775e1=_['find'](_0x3eef6e[_0x5d32('0x7')],function(_0x58eef4){return _0x58eef4['id']===_0x3fea49[_0x5d32('0x6f')]&&_0x58eef4[_0x5d32('0xf')]===_0x5d32('0xa8');});break;}if(_0x3775e1)_0x30532c[_0x5d32('0x8b')](_0x3fea49);});_0x5b76ff['count']=_0x30532c[_0x5d32('0x8a')];_0x5b76ff[_0x5d32('0xa9')]=_0x30532c;return _0x5b76ff;});}else{if(!_[_0x5d32('0x89')](_0x452a62[_0x5d32('0x85')][_0x5d32('0xaa')])){_0x5055c4[_0x5d32('0x7e')]['id']=_0x5055c4[_0x5d32('0x7e')]['id']?_['intersection'](_0x5055c4[_0x5d32('0x7e')]['id'],_0x452a62['query'][_0x5d32('0xaa')]):_0x452a62[_0x5d32('0x85')][_0x5d32('0xaa')];if(_0x452a62[_0x5d32('0x85')]['customSorting']){_0x5055c4['order']=_0x452a62[_0x5d32('0x85')][_0x5d32('0xab')];}}if(_0x452a62['query']['extraQueryConditions']){_0x5055c4[_0x5d32('0x7e')]=_[_0x5d32('0x9d')](_0x5055c4['where'],{'$and':_0x452a62['query']['extraQueryConditions']});}return _0x320a20[_0x169f5e[_0x5d32('0x11')]][_0x5d32('0xac')]({'where':_0x5055c4['where']})[_0x5d32('0x6')](function(_0x14a1ed){_0x5b76ff['count']=_0x14a1ed;if(_0x452a62[_0x5d32('0x85')][_0x5d32('0xa2')]){if(_0x169f5e['childModel']===_0x5d32('0x1a')){_0x5055c4[_0x5d32('0xa3')]=[{'model':_0x320a20['Tag'],'as':'Tags','attributes':['id',_0x5d32('0xb'),_0x5d32('0xad')],'required':_0x452a62[_0x5d32('0x85')][_0x5d32('0xae')]?!![]:![]},{'model':_0x320a20['Tag'],'as':_0x5d32('0xaf'),'attributes':['id',_0x5d32('0xb'),_0x5d32('0xad')],'through':_0x452a62[_0x5d32('0x85')][_0x5d32('0xae')]?{'attributes':[],'where':{'TagId':_0x452a62[_0x5d32('0x85')][_0x5d32('0xae')]||undefined}}:{},'required':_0x452a62[_0x5d32('0x85')][_0x5d32('0xae')]?!![]:![]}];}else{_0x5055c4[_0x5d32('0xa3')]=[{'all':!![]}];}}return _0x320a20[_0x169f5e[_0x5d32('0x11')]]['findAll'](_0x5055c4);})[_0x5d32('0x6')](function(_0x3b009b){_0x5b76ff[_0x5d32('0xa9')]=_0x3b009b;if(_0x221a47===_0x5d32('0x50')&&_0x452a62[_0x5d32('0x85')][_0x5d32('0xb0')]===_0x5d32('0xb1')){var _0x5c2dd0=[];for(var _0xa98031=0x0;_0xa98031<_0x5b76ff[_0x5d32('0xa9')][_0x5d32('0x8a')];_0xa98031++){_0x5c2dd0[_0x5d32('0x8b')](_0x561776(_0x5d32('0xb2'),_0x5b76ff[_0x5d32('0xa9')][_0xa98031][_0x5d32('0xb3')]));_0x5c2dd0[_0x5d32('0x8b')](_0x561776('sms',_0x5b76ff[_0x5d32('0xa9')][_0xa98031][_0x5d32('0xb3')]));_0x5c2dd0[_0x5d32('0x8b')](_0x561776(_0x5d32('0xb4'),_0x5b76ff[_0x5d32('0xa9')][_0xa98031]['dataValues']));_0x5c2dd0[_0x5d32('0x8b')](_0x561776(_0x5d32('0xb5'),_0x5b76ff[_0x5d32('0xa9')][_0xa98031]['dataValues']));_0x5c2dd0['push'](_0x561776('openchannel',_0x5b76ff[_0x5d32('0xa9')][_0xa98031]['dataValues']));_0x5c2dd0[_0x5d32('0x8b')](_0x561776(_0x5d32('0xb6'),_0x5b76ff[_0x5d32('0xa9')][_0xa98031][_0x5d32('0xb3')]));}return Promise['all'](_0x5c2dd0)[_0x5d32('0x6')](function(){return _0x5b76ff;});}return _0x5b76ff;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0cad68e..6ee8c1a 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e8d=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4ab9ba,_0x1cf694){var _0x5a7302=function(_0x42ad23){while(--_0x42ad23){_0x4ab9ba['push'](_0x4ab9ba['shift']());}};_0x5a7302(++_0x1cf694);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x30c49c,_0x83329d){_0x30c49c=_0x30c49c-0x0;var _0x192ddf=_0x5e8d[_0x30c49c];return _0x192ddf;};'use strict';var _=require(_0xd5e8('0x0'));var util=require(_0xd5e8('0x1'));var moment=require(_0xd5e8('0x2'));var BPromise=require(_0xd5e8('0x3'));var rs=require(_0xd5e8('0x4'));var fs=require('fs');var Redis=require(_0xd5e8('0x5'));var db=require(_0xd5e8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5e8('0x7'))(_0xd5e8('0x8'));var config=require('../../config/environment');var jayson=require(_0xd5e8('0x9'));var client=jayson[_0xd5e8('0xa')][_0xd5e8('0xb')]({'port':0x232a});config['redis']=_[_0xd5e8('0xc')](config[_0xd5e8('0xd')],{'host':_0xd5e8('0xe'),'port':0x18eb});var socket=require(_0xd5e8('0xf'))(new Redis(config['redis']));require('./userProfile.socket')[_0xd5e8('0x10')](socket);function respondWithRpcPromise(_0x2ba696,_0x3422fb,_0x433a0d){return new BPromise(function(_0x4feaea,_0x1470cb){return client[_0xd5e8('0x11')](_0x2ba696,_0x433a0d)['then'](function(_0x4c6cba){logger[_0xd5e8('0x12')](_0xd5e8('0x13'),_0x3422fb,_0xd5e8('0x14'));logger[_0xd5e8('0x15')](_0xd5e8('0x16'),_0x3422fb,_0xd5e8('0x14'),JSON[_0xd5e8('0x17')](_0x4c6cba));if(_0x4c6cba[_0xd5e8('0x18')]){if(_0x4c6cba['error']['code']===0x1f4){logger[_0xd5e8('0x18')](_0xd5e8('0x13'),_0x3422fb,_0x4c6cba[_0xd5e8('0x18')][_0xd5e8('0x19')]);return _0x1470cb(_0x4c6cba[_0xd5e8('0x18')][_0xd5e8('0x19')]);}logger['error'](_0xd5e8('0x13'),_0x3422fb,_0x4c6cba[_0xd5e8('0x18')][_0xd5e8('0x19')]);return _0x4feaea(_0x4c6cba[_0xd5e8('0x18')]['message']);}else{logger[_0xd5e8('0x12')](_0xd5e8('0x13'),_0x3422fb,'request\x20sent');_0x4feaea(_0x4c6cba[_0xd5e8('0x1a')][_0xd5e8('0x19')]);}})[_0xd5e8('0x1b')](function(_0x2f34a1){logger[_0xd5e8('0x18')](_0xd5e8('0x13'),_0x3422fb,_0x2f34a1);_0x1470cb(_0x2f34a1);});});} \ No newline at end of file +var _0x5a99=['error','message','result','catch','UserProfile,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1c7b69,_0x1afeaa){var _0x54a9b9=function(_0x41c00a){while(--_0x41c00a){_0x1c7b69['push'](_0x1c7b69['shift']());}};_0x54a9b9(++_0x1afeaa);}(_0x5a99,0xc9));var _0x95a9=function(_0x2d5015,_0x1b18a6){_0x2d5015=_0x2d5015-0x0;var _0x447694=_0x5a99[_0x2d5015];return _0x447694;};'use strict';var _=require(_0x95a9('0x0'));var util=require(_0x95a9('0x1'));var moment=require(_0x95a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x95a9('0x3'));var fs=require('fs');var Redis=require(_0x95a9('0x4'));var db=require(_0x95a9('0x5'))['db'];var utils=require(_0x95a9('0x6'));var logger=require('../../config/logger')(_0x95a9('0x7'));var config=require(_0x95a9('0x8'));var jayson=require(_0x95a9('0x9'));var client=jayson[_0x95a9('0xa')]['http']({'port':0x232a});config[_0x95a9('0xb')]=_[_0x95a9('0xc')](config[_0x95a9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x95a9('0xd'))(new Redis(config['redis']));require(_0x95a9('0xe'))[_0x95a9('0xf')](socket);function respondWithRpcPromise(_0x48d5f0,_0x2be9a2,_0xc0e40d){return new BPromise(function(_0x4de148,_0x4aedae){return client[_0x95a9('0x10')](_0x48d5f0,_0xc0e40d)[_0x95a9('0x11')](function(_0x4de6ba){logger[_0x95a9('0x12')]('UserProfile,\x20%s,\x20%s',_0x2be9a2,_0x95a9('0x13'));logger[_0x95a9('0x14')](_0x95a9('0x15'),_0x2be9a2,_0x95a9('0x13'),JSON[_0x95a9('0x16')](_0x4de6ba));if(_0x4de6ba['error']){if(_0x4de6ba['error']['code']===0x1f4){logger[_0x95a9('0x17')]('UserProfile,\x20%s,\x20%s',_0x2be9a2,_0x4de6ba[_0x95a9('0x17')][_0x95a9('0x18')]);return _0x4aedae(_0x4de6ba[_0x95a9('0x17')]['message']);}logger[_0x95a9('0x17')]('UserProfile,\x20%s,\x20%s',_0x2be9a2,_0x4de6ba[_0x95a9('0x17')][_0x95a9('0x18')]);return _0x4de148(_0x4de6ba[_0x95a9('0x17')]['message']);}else{logger[_0x95a9('0x12')]('UserProfile,\x20%s,\x20%s',_0x2be9a2,'request\x20sent');_0x4de148(_0x4de6ba[_0x95a9('0x19')][_0x95a9('0x18')]);}})[_0x95a9('0x1a')](function(_0x183a64){logger[_0x95a9('0x17')](_0x95a9('0x1b'),_0x2be9a2,_0x183a64);_0x4aedae(_0x183a64);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2784f74..18ac66b 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03b6=['save','remove','update','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x421585,_0x47c85d){var _0x42717b=function(_0x401f25){while(--_0x401f25){_0x421585['push'](_0x421585['shift']());}};_0x42717b(++_0x47c85d);}(_0x03b6,0x1a7));var _0x603b=function(_0xf4e4e1,_0x40aa72){_0xf4e4e1=_0xf4e4e1-0x0;var _0xc16f65=_0x03b6[_0xf4e4e1];return _0xc16f65;};'use strict';var UserProfileEvents=require(_0x603b('0x0'));var events=[_0x603b('0x1'),_0x603b('0x2'),_0x603b('0x3')];function createListener(_0x32b398,_0x78c422){return function(_0x3a8490){_0x78c422['emit'](_0x32b398,_0x3a8490);};}function removeListener(_0xa11a0d,_0x4a6306){return function(){UserProfileEvents[_0x603b('0x4')](_0xa11a0d,_0x4a6306);};}exports[_0x603b('0x5')]=function(_0x571648){for(var _0x255fcc=0x0,_0xd3c255=events[_0x603b('0x6')];_0x255fcc<_0xd3c255;_0x255fcc++){var _0x2ad317=events[_0x255fcc];var _0x43b1b2=createListener(_0x603b('0x7')+_0x2ad317,_0x571648);UserProfileEvents['on'](_0x2ad317,_0x43b1b2);}}; \ No newline at end of file +var _0xe2b7=['remove','emit','removeListener','register','length','./userProfile.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2b7,0x98));var _0x7e2b=function(_0x120002,_0x40f5b4){_0x120002=_0x120002-0x0;var _0x5ba25f=_0xe2b7[_0x120002];return _0x5ba25f;};'use strict';var UserProfileEvents=require(_0x7e2b('0x0'));var events=[_0x7e2b('0x1'),_0x7e2b('0x2'),'update'];function createListener(_0x48d1a0,_0x24411e){return function(_0x897a3e){_0x24411e[_0x7e2b('0x3')](_0x48d1a0,_0x897a3e);};}function removeListener(_0x43d83a,_0x3e91d9){return function(){UserProfileEvents[_0x7e2b('0x4')](_0x43d83a,_0x3e91d9);};}exports[_0x7e2b('0x5')]=function(_0x572cdb){for(var _0x41e19e=0x0,_0x3d606a=events[_0x7e2b('0x6')];_0x41e19e<_0x3d606a;_0x41e19e++){var _0x460c88=events[_0x41e19e];var _0x213eda=createListener('userProfile:'+_0x460c88,_0x572cdb);UserProfileEvents['on'](_0x460c88,_0x213eda);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1adc48a..bd7bef5 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b3b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x3ffda1,_0xc0ecfb){var _0x41038f=function(_0x38c419){while(--_0x38c419){_0x3ffda1['push'](_0x3ffda1['shift']());}};_0x41038f(++_0xc0ecfb);}(_0x7b3b,0xba));var _0xb7b3=function(_0x2ead24,_0x2c3f5b){_0x2ead24=_0x2ead24-0x0;var _0x667be0=_0x7b3b[_0x2ead24];return _0x667be0;};'use strict';var multer=require(_0xb7b3('0x0'));var util=require('util');var path=require(_0xb7b3('0x1'));var timeout=require(_0xb7b3('0x2'));var express=require(_0xb7b3('0x3'));var router=express[_0xb7b3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb7b3('0x5'));var interaction=require(_0xb7b3('0x6'));var config=require(_0xb7b3('0x7'));var controller=require(_0xb7b3('0x8'));router[_0xb7b3('0x9')]('/',auth[_0xb7b3('0xa')](),controller[_0xb7b3('0xb')]);router['get'](_0xb7b3('0xc'),auth[_0xb7b3('0xa')](),controller[_0xb7b3('0xd')]);router['get'](_0xb7b3('0xe'),auth[_0xb7b3('0xa')](),controller[_0xb7b3('0xf')]);router[_0xb7b3('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb7b3('0x11')](_0xb7b3('0xe'),auth[_0xb7b3('0xa')](),controller[_0xb7b3('0x12')]);router[_0xb7b3('0x13')]('/:id',auth[_0xb7b3('0xa')](),controller[_0xb7b3('0x14')]);module['exports']=router; \ No newline at end of file +var _0x84fd=['post','create','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x21e14f,_0x38a8fa){var _0x212ebc=function(_0x476487){while(--_0x476487){_0x21e14f['push'](_0x21e14f['shift']());}};_0x212ebc(++_0x38a8fa);}(_0x84fd,0x191));var _0xd84f=function(_0x3c4103,_0x4fab6a){_0x3c4103=_0x3c4103-0x0;var _0x50f840=_0x84fd[_0x3c4103];return _0x50f840;};'use strict';var multer=require(_0xd84f('0x0'));var util=require(_0xd84f('0x1'));var path=require('path');var timeout=require(_0xd84f('0x2'));var express=require('express');var router=express[_0xd84f('0x3')]();var fs_extra=require(_0xd84f('0x4'));var auth=require(_0xd84f('0x5'));var interaction=require(_0xd84f('0x6'));var config=require('../../config/environment');var controller=require(_0xd84f('0x7'));router[_0xd84f('0x8')]('/',auth[_0xd84f('0x9')](),controller[_0xd84f('0xa')]);router[_0xd84f('0x8')]('/describe',auth[_0xd84f('0x9')](),controller[_0xd84f('0xb')]);router['get'](_0xd84f('0xc'),auth[_0xd84f('0x9')](),controller['show']);router[_0xd84f('0xd')]('/',auth[_0xd84f('0x9')](),controller[_0xd84f('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd84f('0xf')]);router['delete'](_0xd84f('0xc'),auth[_0xd84f('0x9')](),controller[_0xd84f('0x10')]);module[_0xd84f('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6cfa524..1b85682 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1ee=['sequelize','STRING','INTEGER'];(function(_0x545ed3,_0xe51819){var _0x32c68e=function(_0x1d8604){while(--_0x1d8604){_0x545ed3['push'](_0x545ed3['shift']());}};_0x32c68e(++_0xe51819);}(_0xa1ee,0x1bf));var _0xea1e=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xa1ee[_0x45346d];return _0x5ce7ca;};'use strict';var Sequelize=require(_0xea1e('0x0'));module['exports']={'name':{'type':Sequelize[_0xea1e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xea1e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xea1e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8d79=['exports','STRING'];(function(_0xf57a5a,_0x286e69){var _0x513846=function(_0x441e2d){while(--_0x441e2d){_0xf57a5a['push'](_0xf57a5a['shift']());}};_0x513846(++_0x286e69);}(_0x8d79,0x78));var _0x98d7=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x8d79[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require('sequelize');module[_0x98d7('0x0')]={'name':{'type':Sequelize[_0x98d7('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x98d7('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7968136..adc7e92 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x687b,0x14a));var _0xb687=function(_0xcd2975,_0x27d718){_0xcd2975=_0xcd2975-0x0;var _0x284074=_0x687b[_0xcd2975];return _0x284074;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['UserProfileResource'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file +var _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','UserProfileResource','rawAttributes','type','key','model','query'];(function(_0x2d31b4,_0x30fbed){var _0xbed3d0=function(_0x5d4542){while(--_0x5d4542){_0x2d31b4['push'](_0x2d31b4['shift']());}};_0xbed3d0(++_0x30fbed);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x300f8c,_0x1f92cb){_0x300f8c=_0x300f8c-0x0;var _0x72d5c0=_0xc1c6[_0x300f8c];return _0x72d5c0;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['UserProfileResource']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['UserProfileResource'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['UserProfileResource']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['UserProfileResource'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7fea959..6028380 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25b5=['rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','lodash','util','bluebird','request-promise','path'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x25b5,0x19f));var _0x525b=function(_0x3bb2a4,_0x1619e3){_0x3bb2a4=_0x3bb2a4-0x0;var _0x53d75d=_0x25b5[_0x3bb2a4];return _0x53d75d;};'use strict';var _=require(_0x525b('0x0'));var util=require(_0x525b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x525b('0x2'));var rp=require(_0x525b('0x3'));var fs=require('fs');var path=require(_0x525b('0x4'));var rimraf=require(_0x525b('0x5'));var config=require(_0x525b('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x525b('0x7')]=function(_0x50e0db,_0x50398b){return _0x50e0db[_0x525b('0x8')](_0x525b('0x9'),attributes,{'tableName':_0x525b('0xa'),'paranoid':![],'indexes':[{'name':_0x525b('0xb'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b7c=['UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0x545dda,_0x577f99){var _0xef8cba=function(_0x3cf2e8){while(--_0x3cf2e8){_0x545dda['push'](_0x545dda['shift']());}};_0xef8cba(++_0x577f99);}(_0x8b7c,0xd0));var _0xc8b7=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x8b7c[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require(_0xc8b7('0x7'));var rimraf=require(_0xc8b7('0x8'));var config=require(_0xc8b7('0x9'));var attributes=require(_0xc8b7('0xa'));module[_0xc8b7('0xb')]=function(_0x4c5c68,_0x428730){return _0x4c5c68[_0xc8b7('0xc')](_0xc8b7('0xd'),attributes,{'tableName':_0xc8b7('0xe'),'paranoid':![],'indexes':[{'name':_0xc8b7('0xf'),'fields':['resourceId',_0xc8b7('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 0c2b762..2975508 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a55=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','lodash','moment'];(function(_0x5aa7a1,_0x3b2623){var _0x50ca22=function(_0x3f3cd6){while(--_0x3f3cd6){_0x5aa7a1['push'](_0x5aa7a1['shift']());}};_0x50ca22(++_0x3b2623);}(_0x4a55,0x124));var _0x54a5=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x4a55[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x54a5('0x0'));var util=require('util');var moment=require(_0x54a5('0x1'));var BPromise=require(_0x54a5('0x2'));var rs=require(_0x54a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54a5('0x4'))['db'];var utils=require(_0x54a5('0x5'));var logger=require(_0x54a5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x54a5('0x7'));var client=jayson[_0x54a5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53342e,_0x5d3a23,_0x26c9bd){return new BPromise(function(_0x4235f8,_0x2730b9){return client[_0x54a5('0x9')](_0x53342e,_0x26c9bd)[_0x54a5('0xa')](function(_0xdd58e3){logger['info'](_0x54a5('0xb'),_0x5d3a23,'request\x20sent');logger[_0x54a5('0xc')](_0x54a5('0xd'),_0x5d3a23,_0x54a5('0xe'),JSON[_0x54a5('0xf')](_0xdd58e3));if(_0xdd58e3['error']){if(_0xdd58e3['error'][_0x54a5('0x10')]===0x1f4){logger[_0x54a5('0x11')](_0x54a5('0xb'),_0x5d3a23,_0xdd58e3[_0x54a5('0x11')][_0x54a5('0x12')]);return _0x2730b9(_0xdd58e3[_0x54a5('0x11')][_0x54a5('0x12')]);}logger[_0x54a5('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x5d3a23,_0xdd58e3[_0x54a5('0x11')]['message']);return _0x4235f8(_0xdd58e3[_0x54a5('0x11')][_0x54a5('0x12')]);}else{logger[_0x54a5('0x13')](_0x54a5('0xb'),_0x5d3a23,'request\x20sent');_0x4235f8(_0xdd58e3['result'][_0x54a5('0x12')]);}})[_0x54a5('0x14')](function(_0x2e23fd){logger[_0x54a5('0x11')](_0x54a5('0xb'),_0x5d3a23,_0x2e23fd);_0x2730b9(_0x2e23fd);});});} \ No newline at end of file +var _0xfcad=['../../config/environment','jayson/promise','client','http','request','then','info','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','UserProfileResource,\x20%s,\x20%s','util','moment','../../mysqldb','../../config/logger','rpc'];(function(_0x1ddfb9,_0x49a457){var _0x227b8a=function(_0x15c7be){while(--_0x15c7be){_0x1ddfb9['push'](_0x1ddfb9['shift']());}};_0x227b8a(++_0x49a457);}(_0xfcad,0xa6));var _0xdfca=function(_0xc1aa0e,_0x876c81){_0xc1aa0e=_0xc1aa0e-0x0;var _0xc7821d=_0xfcad[_0xc1aa0e];return _0xc7821d;};'use strict';var _=require('lodash');var util=require(_0xdfca('0x0'));var moment=require(_0xdfca('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfca('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfca('0x3'))(_0xdfca('0x4'));var config=require(_0xdfca('0x5'));var jayson=require(_0xdfca('0x6'));var client=jayson[_0xdfca('0x7')][_0xdfca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e0f27,_0x33bdc5,_0x14c206){return new BPromise(function(_0x4b3f94,_0x2200ba){return client[_0xdfca('0x9')](_0x1e0f27,_0x14c206)[_0xdfca('0xa')](function(_0x48d373){logger[_0xdfca('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x33bdc5,'request\x20sent');logger[_0xdfca('0xc')](_0xdfca('0xd'),_0x33bdc5,_0xdfca('0xe'),JSON['stringify'](_0x48d373));if(_0x48d373['error']){if(_0x48d373['error'][_0xdfca('0xf')]===0x1f4){logger[_0xdfca('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x33bdc5,_0x48d373[_0xdfca('0x10')][_0xdfca('0x11')]);return _0x2200ba(_0x48d373[_0xdfca('0x10')]['message']);}logger[_0xdfca('0x10')](_0xdfca('0x12'),_0x33bdc5,_0x48d373[_0xdfca('0x10')][_0xdfca('0x11')]);return _0x4b3f94(_0x48d373[_0xdfca('0x10')][_0xdfca('0x11')]);}else{logger[_0xdfca('0xb')](_0xdfca('0x12'),_0x33bdc5,_0xdfca('0xe'));_0x4b3f94(_0x48d373['result'][_0xdfca('0x11')]);}})['catch'](function(_0x29f462){logger[_0xdfca('0x10')](_0xdfca('0x12'),_0x33bdc5,_0x29f462);_0x2200ba(_0x29f462);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index de35789..f62b900 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5430=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x533016,_0x2b549b){var _0x2551a7=function(_0x35922a){while(--_0x35922a){_0x533016['push'](_0x533016['shift']());}};_0x2551a7(++_0x2b549b);}(_0x5430,0x115));var _0x0543=function(_0x19e22e,_0x366e20){_0x19e22e=_0x19e22e-0x0;var _0x5c89c8=_0x5430[_0x19e22e];return _0x5c89c8;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require(_0x0543('0x6'));var auth=require(_0x0543('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0543('0x8'));var controller=require(_0x0543('0x9'));router[_0x0543('0xa')]('/',auth[_0x0543('0xb')](),controller[_0x0543('0xc')]);router[_0x0543('0xa')]('/describe',auth[_0x0543('0xb')](),controller[_0x0543('0xd')]);router[_0x0543('0xa')](_0x0543('0xe'),auth[_0x0543('0xb')](),controller[_0x0543('0xf')]);router[_0x0543('0x10')]('/',auth[_0x0543('0xb')](),controller[_0x0543('0x11')]);router[_0x0543('0x12')](_0x0543('0xe'),auth[_0x0543('0xb')](),controller[_0x0543('0x13')]);router[_0x0543('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0543('0x15')]);module[_0x0543('0x16')]=router; \ No newline at end of file +var _0x2bd9=['create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','/:id','isAuthenticated'];(function(_0x1e694e,_0x51a8b5){var _0x5b4b37=function(_0x30df22){while(--_0x30df22){_0x1e694e['push'](_0x1e694e['shift']());}};_0x5b4b37(++_0x51a8b5);}(_0x2bd9,0x6a));var _0x92bd=function(_0x2de12c,_0x3f6936){_0x2de12c=_0x2de12c-0x0;var _0x48a375=_0x2bd9[_0x2de12c];return _0x48a375;};'use strict';var multer=require('multer');var util=require(_0x92bd('0x0'));var path=require(_0x92bd('0x1'));var timeout=require(_0x92bd('0x2'));var express=require(_0x92bd('0x3'));var router=express[_0x92bd('0x4')]();var fs_extra=require(_0x92bd('0x5'));var auth=require(_0x92bd('0x6'));var interaction=require(_0x92bd('0x7'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x92bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x92bd('0x9')]);router[_0x92bd('0x8')](_0x92bd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x92bd('0x8')](_0x92bd('0xb'),auth[_0x92bd('0xc')](),controller['show']);router['post']('/',auth[_0x92bd('0xc')](),controller[_0x92bd('0xd')]);router[_0x92bd('0xe')](_0x92bd('0xb'),auth[_0x92bd('0xc')](),controller['update']);router['delete'](_0x92bd('0xb'),auth['isAuthenticated'](),controller[_0x92bd('0xf')]);module[_0x92bd('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index c8ce1bd..8508e3d 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cc=['crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x3e17a9,_0x39afdc){var _0x402e91=function(_0x1a07b1){while(--_0x1a07b1){_0x3e17a9['push'](_0x3e17a9['shift']());}};_0x402e91(++_0x39afdc);}(_0x96cc,0x16c));var _0xc96c=function(_0x2eade5,_0x29bcdf){_0x2eade5=_0x2eade5-0x0;var _0x2de2c2=_0x96cc[_0x2eade5];return _0x2de2c2;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc96c('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc96c('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc96c('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xc96c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc96c('0x1')],'set':function(_0x71140d){this[_0xc96c('0x4')](_0xc96c('0x5'),_0x71140d?_0x71140d[_0xc96c('0x6')](''):[]);},'get':function(){return this[_0xc96c('0x7')]('crudPermissions')?this[_0xc96c('0x7')](_0xc96c('0x5'))[_0xc96c('0x8')](''):[];}}}; \ No newline at end of file +var _0x5ec6=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x28da10,_0x29470c){var _0x298372=function(_0x4acba9){while(--_0x4acba9){_0x28da10['push'](_0x28da10['shift']());}};_0x298372(++_0x29470c);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5e45ac,_0xe8c340){_0x5e45ac=_0x5e45ac-0x0;var _0x4eee99=_0x5ec6[_0x5e45ac];return _0x4eee99;};'use strict';var Sequelize=require(_0x65ec('0x0'));module[_0x65ec('0x1')]={'name':{'type':Sequelize[_0x65ec('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x65ec('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x65ec('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x33751d){this['setDataValue'](_0x65ec('0x5'),_0x33751d?_0x33751d['join'](''):[]);},'get':function(){return this[_0x65ec('0x6')](_0x65ec('0x5'))?this['getDataValue'](_0x65ec('0x5'))[_0x65ec('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c7ecdef..48ada58 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9c5=['params','length','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','sendStatus','error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show'];(function(_0x940347,_0x4746ed){var _0x51bbc3=function(_0x23776a){while(--_0x23776a){_0x940347['push'](_0x940347['shift']());}};_0x51bbc3(++_0x4746ed);}(_0xf9c5,0x1ce));var _0x5f9c=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xf9c5[_0x45783c];return _0x1161da;};'use strict';var emlformat=require(_0x5f9c('0x0'));var rimraf=require(_0x5f9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f9c('0x2'));var rp=require('request-promise');var moment=require(_0x5f9c('0x3'));var BPromise=require(_0x5f9c('0x4'));var Mustache=require('mustache');var util=require(_0x5f9c('0x5'));var path=require('path');var sox=require(_0x5f9c('0x6'));var csv=require('to-csv');var ejs=require(_0x5f9c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5f9c('0x8'));var crypto=require(_0x5f9c('0x9'));var jsforce=require(_0x5f9c('0xa'));var deskjs=require(_0x5f9c('0xb'));var toCsv=require(_0x5f9c('0xc'));var querystring=require(_0x5f9c('0xd'));var Papa=require(_0x5f9c('0xe'));var Redis=require(_0x5f9c('0xf'));var authService=require(_0x5f9c('0x10'));var qs=require(_0x5f9c('0x11'));var as=require(_0x5f9c('0x12'));var hardwareService=require(_0x5f9c('0x13'));var logger=require(_0x5f9c('0x14'))(_0x5f9c('0x15'));var utils=require(_0x5f9c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5f9c('0x17'));var db=require(_0x5f9c('0x18'))['db'];function respondWithStatusCode(_0x22020d,_0x1adb31){_0x1adb31=_0x1adb31||0xcc;return function(_0x154cc5){if(_0x154cc5){return _0x22020d['sendStatus'](_0x1adb31);}return _0x22020d[_0x5f9c('0x19')](_0x1adb31)[_0x5f9c('0x1a')]();};}function respondWithResult(_0x2895d6,_0x6bb4c3){_0x6bb4c3=_0x6bb4c3||0xc8;return function(_0x3154c4){if(_0x3154c4){return _0x2895d6[_0x5f9c('0x19')](_0x6bb4c3)['json'](_0x3154c4);}};}function respondWithFilteredResult(_0x28a865,_0x169bfb){return function(_0x181ee6){if(_0x181ee6){var _0x9102b6=typeof _0x169bfb[_0x5f9c('0x1b')]===_0x5f9c('0x1c')&&typeof _0x169bfb[_0x5f9c('0x1d')]===_0x5f9c('0x1c');var _0x4ba24e=_0x181ee6[_0x5f9c('0x1e')];var _0xa5a7ee=_0x9102b6?0x0:_0x169bfb[_0x5f9c('0x1b')];var _0x3119f9=_0x9102b6?_0x181ee6[_0x5f9c('0x1e')]:_0x169bfb[_0x5f9c('0x1b')]+_0x169bfb[_0x5f9c('0x1d')];var _0x56de22;if(_0x3119f9>=_0x4ba24e){_0x3119f9=_0x4ba24e;_0x56de22=0xc8;}else{_0x56de22=0xce;}_0x28a865['status'](_0x56de22);return _0x28a865[_0x5f9c('0x1f')]('Content-Range',_0xa5a7ee+'-'+_0x3119f9+'/'+_0x4ba24e)[_0x5f9c('0x20')](_0x181ee6);}return null;};}function patchUpdates(_0x30a4be){return function(_0x5c13a5){try{jsonpatch[_0x5f9c('0x21')](_0x5c13a5,_0x30a4be,!![]);}catch(_0x5729d2){return BPromise['reject'](_0x5729d2);}return _0x5c13a5[_0x5f9c('0x22')]();};}function saveUpdates(_0x31c2fe,_0xced6d2){return function(_0x546e48){if(_0x546e48){return _0x546e48[_0x5f9c('0x23')](_0x31c2fe)[_0x5f9c('0x24')](function(_0x12e33c){return _0x12e33c;});}return null;};}function removeEntity(_0x4c427a,_0x12e9d7){return function(_0xf2055f){if(_0xf2055f){return _0xf2055f[_0x5f9c('0x25')]()[_0x5f9c('0x24')](function(){_0x4c427a[_0x5f9c('0x19')](0xcc)[_0x5f9c('0x1a')]();});}};}function handleEntityNotFound(_0x373801,_0x6acbb6){return function(_0x313340){if(!_0x313340){_0x373801[_0x5f9c('0x26')](0x194);}return _0x313340;};}function handleError(_0x53408b,_0xfbd1ae){_0xfbd1ae=_0xfbd1ae||0x1f4;return function(_0x5ca4c2){logger[_0x5f9c('0x27')](_0x5ca4c2['stack']);if(_0x5ca4c2[_0x5f9c('0x28')]){delete _0x5ca4c2[_0x5f9c('0x28')];}_0x53408b[_0x5f9c('0x19')](_0xfbd1ae)[_0x5f9c('0x29')](_0x5ca4c2);};}exports['index']=function(_0x293e05,_0x43516d){var _0x20ba5e={},_0x967fb6={},_0x312259={'count':0x0,'rows':[]};var _0x320a54=_[_0x5f9c('0x2a')](db[_0x5f9c('0x2b')][_0x5f9c('0x2c')],function(_0x2461aa){return{'name':_0x2461aa[_0x5f9c('0x2d')],'type':_0x2461aa[_0x5f9c('0x2e')][_0x5f9c('0x2f')]};});_0x967fb6[_0x5f9c('0x30')]=_[_0x5f9c('0x2a')](_0x320a54,_0x5f9c('0x28'));_0x967fb6[_0x5f9c('0x31')]=_[_0x5f9c('0x32')](_0x293e05['query']);_0x967fb6[_0x5f9c('0x33')]=_[_0x5f9c('0x34')](_0x967fb6[_0x5f9c('0x30')],_0x967fb6[_0x5f9c('0x31')]);_0x20ba5e[_0x5f9c('0x35')]=_[_0x5f9c('0x34')](_0x967fb6[_0x5f9c('0x30')],qs['fields'](_0x293e05[_0x5f9c('0x31')][_0x5f9c('0x36')]));_0x20ba5e['attributes']=_0x20ba5e[_0x5f9c('0x35')]['length']?_0x20ba5e['attributes']:_0x967fb6['model'];if(!_0x293e05[_0x5f9c('0x31')][_0x5f9c('0x37')]('nolimit')){_0x20ba5e['limit']=qs[_0x5f9c('0x1d')](_0x293e05[_0x5f9c('0x31')]['limit']);_0x20ba5e[_0x5f9c('0x1b')]=qs['offset'](_0x293e05[_0x5f9c('0x31')]['offset']);}_0x20ba5e[_0x5f9c('0x38')]=qs[_0x5f9c('0x39')](_0x293e05['query']['sort']);_0x20ba5e[_0x5f9c('0x3a')]=qs['filters'](_[_0x5f9c('0x3b')](_0x293e05[_0x5f9c('0x31')],_0x967fb6[_0x5f9c('0x33')]),_0x320a54);if(_0x293e05[_0x5f9c('0x31')]['filter']){_0x20ba5e[_0x5f9c('0x3a')]=_[_0x5f9c('0x3c')](_0x20ba5e[_0x5f9c('0x3a')],{'$or':_['map'](_0x320a54,function(_0x46f96d){if(_0x46f96d[_0x5f9c('0x2e')]!==_0x5f9c('0x3d')){var _0x42596d={};_0x42596d[_0x46f96d[_0x5f9c('0x28')]]={'$like':'%'+_0x293e05[_0x5f9c('0x31')][_0x5f9c('0x3e')]+'%'};return _0x42596d;}})});}_0x20ba5e=_[_0x5f9c('0x3c')]({},_0x20ba5e,_0x293e05[_0x5f9c('0x3f')]);var _0x149014={'where':_0x20ba5e[_0x5f9c('0x3a')]};return db[_0x5f9c('0x2b')][_0x5f9c('0x1e')](_0x149014)[_0x5f9c('0x24')](function(_0x38e700){_0x312259[_0x5f9c('0x1e')]=_0x38e700;if(_0x293e05[_0x5f9c('0x31')][_0x5f9c('0x40')]){_0x20ba5e[_0x5f9c('0x41')]=[{'all':!![]}];}return db[_0x5f9c('0x2b')][_0x5f9c('0x42')](_0x20ba5e);})[_0x5f9c('0x24')](function(_0x267383){_0x312259[_0x5f9c('0x43')]=_0x267383;return _0x312259;})['then'](respondWithFilteredResult(_0x43516d,_0x20ba5e))[_0x5f9c('0x44')](handleError(_0x43516d,null));};exports[_0x5f9c('0x45')]=function(_0x599a18,_0x2002d3){var _0x2c9ead={'raw':![],'where':{'id':_0x599a18[_0x5f9c('0x46')]['id']}},_0x53e372={};_0x53e372[_0x5f9c('0x30')]=_['keys'](db[_0x5f9c('0x2b')][_0x5f9c('0x2c')]);_0x53e372['query']=_[_0x5f9c('0x32')](_0x599a18[_0x5f9c('0x31')]);_0x53e372[_0x5f9c('0x33')]=_[_0x5f9c('0x34')](_0x53e372[_0x5f9c('0x30')],_0x53e372[_0x5f9c('0x31')]);_0x2c9ead[_0x5f9c('0x35')]=_[_0x5f9c('0x34')](_0x53e372[_0x5f9c('0x30')],qs[_0x5f9c('0x36')](_0x599a18[_0x5f9c('0x31')][_0x5f9c('0x36')]));_0x2c9ead[_0x5f9c('0x35')]=_0x2c9ead[_0x5f9c('0x35')][_0x5f9c('0x47')]?_0x2c9ead['attributes']:_0x53e372[_0x5f9c('0x30')];if(_0x599a18[_0x5f9c('0x31')][_0x5f9c('0x40')]){_0x2c9ead[_0x5f9c('0x41')]=[{'all':!![]}];}_0x2c9ead=_[_0x5f9c('0x3c')]({},_0x2c9ead,_0x599a18[_0x5f9c('0x3f')]);return db['UserProfileSection']['find'](_0x2c9ead)['then'](handleEntityNotFound(_0x2002d3,null))[_0x5f9c('0x24')](respondWithResult(_0x2002d3,null))[_0x5f9c('0x44')](handleError(_0x2002d3,null));};exports[_0x5f9c('0x48')]=function(_0x262204,_0x1073ab){return db[_0x5f9c('0x2b')]['create'](_0x262204[_0x5f9c('0x49')],{})[_0x5f9c('0x24')](respondWithResult(_0x1073ab,0xc9))[_0x5f9c('0x44')](handleError(_0x1073ab,null));};exports[_0x5f9c('0x23')]=function(_0x3e0abe,_0x324dfa){if(_0x3e0abe[_0x5f9c('0x49')]['id']){delete _0x3e0abe[_0x5f9c('0x49')]['id'];}return db[_0x5f9c('0x2b')][_0x5f9c('0x4a')]({'where':{'id':_0x3e0abe[_0x5f9c('0x46')]['id']}})[_0x5f9c('0x24')](handleEntityNotFound(_0x324dfa,null))['then'](saveUpdates(_0x3e0abe['body'],null))[_0x5f9c('0x24')](respondWithResult(_0x324dfa,null))[_0x5f9c('0x44')](handleError(_0x324dfa,null));};exports['destroy']=function(_0x5204eb,_0x290644){return db[_0x5f9c('0x2b')][_0x5f9c('0x4a')]({'where':{'id':_0x5204eb[_0x5f9c('0x46')]['id']}})[_0x5f9c('0x24')](handleEntityNotFound(_0x290644,null))[_0x5f9c('0x24')](removeEntity(_0x290644,null))[_0x5f9c('0x44')](handleError(_0x290644,null));};exports['describe']=function(_0x5ade38,_0x420566){return db[_0x5f9c('0x2b')][_0x5f9c('0x4b')]()[_0x5f9c('0x24')](respondWithResult(_0x420566,null))[_0x5f9c('0x44')](handleError(_0x420566,null));}; \ No newline at end of file +var _0x4e03=['show','params','keys','length','merge','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x4e6a8b,_0x5102c0){var _0x1da877=function(_0x470476){while(--_0x470476){_0x4e6a8b['push'](_0x4e6a8b['shift']());}};_0x1da877(++_0x5102c0);}(_0x4e03,0xf3));var _0x34e0=function(_0x367a51,_0x3defa1){_0x367a51=_0x367a51-0x0;var _0x526846=_0x4e03[_0x367a51];return _0x526846;};'use strict';var emlformat=require(_0x34e0('0x0'));var rimraf=require(_0x34e0('0x1'));var zipdir=require(_0x34e0('0x2'));var jsonpatch=require(_0x34e0('0x3'));var rp=require(_0x34e0('0x4'));var moment=require('moment');var BPromise=require(_0x34e0('0x5'));var Mustache=require('mustache');var util=require(_0x34e0('0x6'));var path=require(_0x34e0('0x7'));var sox=require(_0x34e0('0x8'));var csv=require(_0x34e0('0x9'));var ejs=require(_0x34e0('0xa'));var fs=require('fs');var fs_extra=require(_0x34e0('0xb'));var _=require(_0x34e0('0xc'));var squel=require(_0x34e0('0xd'));var crypto=require('crypto');var jsforce=require(_0x34e0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x34e0('0x9'));var querystring=require(_0x34e0('0xf'));var Papa=require(_0x34e0('0x10'));var Redis=require(_0x34e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x34e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34e0('0x13'));var logger=require(_0x34e0('0x14'))(_0x34e0('0x15'));var utils=require(_0x34e0('0x16'));var config=require(_0x34e0('0x17'));var licenseUtil=require(_0x34e0('0x18'));var db=require(_0x34e0('0x19'))['db'];function respondWithStatusCode(_0x352b68,_0x463538){_0x463538=_0x463538||0xcc;return function(_0x48ee9a){if(_0x48ee9a){return _0x352b68[_0x34e0('0x1a')](_0x463538);}return _0x352b68[_0x34e0('0x1b')](_0x463538)['end']();};}function respondWithResult(_0x30f4d6,_0x31dd46){_0x31dd46=_0x31dd46||0xc8;return function(_0x433d9e){if(_0x433d9e){return _0x30f4d6[_0x34e0('0x1b')](_0x31dd46)['json'](_0x433d9e);}};}function respondWithFilteredResult(_0x2c3c1a,_0x186105){return function(_0x57a9a1){if(_0x57a9a1){var _0x5bc752=typeof _0x186105[_0x34e0('0x1c')]===_0x34e0('0x1d')&&typeof _0x186105['limit']===_0x34e0('0x1d');var _0x20fa98=_0x57a9a1[_0x34e0('0x1e')];var _0x7bc657=_0x5bc752?0x0:_0x186105[_0x34e0('0x1c')];var _0x869106=_0x5bc752?_0x57a9a1[_0x34e0('0x1e')]:_0x186105[_0x34e0('0x1c')]+_0x186105[_0x34e0('0x1f')];var _0x3aeb9b;if(_0x869106>=_0x20fa98){_0x869106=_0x20fa98;_0x3aeb9b=0xc8;}else{_0x3aeb9b=0xce;}_0x2c3c1a[_0x34e0('0x1b')](_0x3aeb9b);return _0x2c3c1a[_0x34e0('0x20')](_0x34e0('0x21'),_0x7bc657+'-'+_0x869106+'/'+_0x20fa98)[_0x34e0('0x22')](_0x57a9a1);}return null;};}function patchUpdates(_0x354fab){return function(_0x2c11c5){try{jsonpatch[_0x34e0('0x23')](_0x2c11c5,_0x354fab,!![]);}catch(_0x7c19cd){return BPromise[_0x34e0('0x24')](_0x7c19cd);}return _0x2c11c5[_0x34e0('0x25')]();};}function saveUpdates(_0x37457a,_0x41d24a){return function(_0xe0872e){if(_0xe0872e){return _0xe0872e['update'](_0x37457a)[_0x34e0('0x26')](function(_0x102ca1){return _0x102ca1;});}return null;};}function removeEntity(_0x25f0f7,_0x17b309){return function(_0x4f58a9){if(_0x4f58a9){return _0x4f58a9[_0x34e0('0x27')]()[_0x34e0('0x26')](function(){_0x25f0f7[_0x34e0('0x1b')](0xcc)[_0x34e0('0x28')]();});}};}function handleEntityNotFound(_0x1c7875,_0x335328){return function(_0x23b7b2){if(!_0x23b7b2){_0x1c7875['sendStatus'](0x194);}return _0x23b7b2;};}function handleError(_0x23761a,_0x2287e2){_0x2287e2=_0x2287e2||0x1f4;return function(_0x4d756b){logger[_0x34e0('0x29')](_0x4d756b[_0x34e0('0x2a')]);if(_0x4d756b[_0x34e0('0x2b')]){delete _0x4d756b[_0x34e0('0x2b')];}_0x23761a[_0x34e0('0x1b')](_0x2287e2)[_0x34e0('0x2c')](_0x4d756b);};}exports[_0x34e0('0x2d')]=function(_0x3e2352,_0x2eea9c){var _0x52e7f3={},_0x55faf4={},_0x231be5={'count':0x0,'rows':[]};var _0x5e7bd1=_[_0x34e0('0x2e')](db[_0x34e0('0x2f')][_0x34e0('0x30')],function(_0xd0613c){return{'name':_0xd0613c['fieldName'],'type':_0xd0613c[_0x34e0('0x31')]['key']};});_0x55faf4[_0x34e0('0x32')]=_[_0x34e0('0x2e')](_0x5e7bd1,_0x34e0('0x2b'));_0x55faf4['query']=_['keys'](_0x3e2352[_0x34e0('0x33')]);_0x55faf4[_0x34e0('0x34')]=_[_0x34e0('0x35')](_0x55faf4[_0x34e0('0x32')],_0x55faf4[_0x34e0('0x33')]);_0x52e7f3['attributes']=_[_0x34e0('0x35')](_0x55faf4[_0x34e0('0x32')],qs['fields'](_0x3e2352[_0x34e0('0x33')][_0x34e0('0x36')]));_0x52e7f3[_0x34e0('0x37')]=_0x52e7f3['attributes']['length']?_0x52e7f3['attributes']:_0x55faf4[_0x34e0('0x32')];if(!_0x3e2352[_0x34e0('0x33')][_0x34e0('0x38')](_0x34e0('0x39'))){_0x52e7f3[_0x34e0('0x1f')]=qs[_0x34e0('0x1f')](_0x3e2352[_0x34e0('0x33')][_0x34e0('0x1f')]);_0x52e7f3[_0x34e0('0x1c')]=qs[_0x34e0('0x1c')](_0x3e2352['query'][_0x34e0('0x1c')]);}_0x52e7f3[_0x34e0('0x3a')]=qs[_0x34e0('0x3b')](_0x3e2352[_0x34e0('0x33')][_0x34e0('0x3b')]);_0x52e7f3['where']=qs['filters'](_[_0x34e0('0x3c')](_0x3e2352[_0x34e0('0x33')],_0x55faf4[_0x34e0('0x34')]),_0x5e7bd1);if(_0x3e2352[_0x34e0('0x33')]['filter']){_0x52e7f3[_0x34e0('0x3d')]=_['merge'](_0x52e7f3[_0x34e0('0x3d')],{'$or':_[_0x34e0('0x2e')](_0x5e7bd1,function(_0x3cd31d){if(_0x3cd31d[_0x34e0('0x31')]!=='VIRTUAL'){var _0x5648e1={};_0x5648e1[_0x3cd31d[_0x34e0('0x2b')]]={'$like':'%'+_0x3e2352[_0x34e0('0x33')][_0x34e0('0x3e')]+'%'};return _0x5648e1;}})});}_0x52e7f3=_['merge']({},_0x52e7f3,_0x3e2352[_0x34e0('0x3f')]);var _0x3b7399={'where':_0x52e7f3[_0x34e0('0x3d')]};return db[_0x34e0('0x2f')]['count'](_0x3b7399)[_0x34e0('0x26')](function(_0x2fba13){_0x231be5[_0x34e0('0x1e')]=_0x2fba13;if(_0x3e2352['query'][_0x34e0('0x40')]){_0x52e7f3[_0x34e0('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0x34e0('0x42')](_0x52e7f3);})[_0x34e0('0x26')](function(_0x2a2934){_0x231be5[_0x34e0('0x43')]=_0x2a2934;return _0x231be5;})[_0x34e0('0x26')](respondWithFilteredResult(_0x2eea9c,_0x52e7f3))[_0x34e0('0x44')](handleError(_0x2eea9c,null));};exports[_0x34e0('0x45')]=function(_0x15fed8,_0xa7e75e){var _0x55927e={'raw':![],'where':{'id':_0x15fed8[_0x34e0('0x46')]['id']}},_0x520913={};_0x520913['model']=_[_0x34e0('0x47')](db[_0x34e0('0x2f')][_0x34e0('0x30')]);_0x520913[_0x34e0('0x33')]=_[_0x34e0('0x47')](_0x15fed8[_0x34e0('0x33')]);_0x520913[_0x34e0('0x34')]=_[_0x34e0('0x35')](_0x520913[_0x34e0('0x32')],_0x520913[_0x34e0('0x33')]);_0x55927e[_0x34e0('0x37')]=_[_0x34e0('0x35')](_0x520913[_0x34e0('0x32')],qs[_0x34e0('0x36')](_0x15fed8[_0x34e0('0x33')]['fields']));_0x55927e[_0x34e0('0x37')]=_0x55927e[_0x34e0('0x37')][_0x34e0('0x48')]?_0x55927e[_0x34e0('0x37')]:_0x520913[_0x34e0('0x32')];if(_0x15fed8[_0x34e0('0x33')][_0x34e0('0x40')]){_0x55927e[_0x34e0('0x41')]=[{'all':!![]}];}_0x55927e=_[_0x34e0('0x49')]({},_0x55927e,_0x15fed8[_0x34e0('0x3f')]);return db[_0x34e0('0x2f')][_0x34e0('0x4a')](_0x55927e)[_0x34e0('0x26')](handleEntityNotFound(_0xa7e75e,null))[_0x34e0('0x26')](respondWithResult(_0xa7e75e,null))[_0x34e0('0x44')](handleError(_0xa7e75e,null));};exports[_0x34e0('0x4b')]=function(_0x452f32,_0x335ab8){return db[_0x34e0('0x2f')][_0x34e0('0x4b')](_0x452f32[_0x34e0('0x4c')],{})[_0x34e0('0x26')](respondWithResult(_0x335ab8,0xc9))[_0x34e0('0x44')](handleError(_0x335ab8,null));};exports[_0x34e0('0x4d')]=function(_0x4b4d6f,_0x358b49){if(_0x4b4d6f[_0x34e0('0x4c')]['id']){delete _0x4b4d6f[_0x34e0('0x4c')]['id'];}return db[_0x34e0('0x2f')][_0x34e0('0x4a')]({'where':{'id':_0x4b4d6f[_0x34e0('0x46')]['id']}})[_0x34e0('0x26')](handleEntityNotFound(_0x358b49,null))[_0x34e0('0x26')](saveUpdates(_0x4b4d6f[_0x34e0('0x4c')],null))[_0x34e0('0x26')](respondWithResult(_0x358b49,null))[_0x34e0('0x44')](handleError(_0x358b49,null));};exports['destroy']=function(_0xb460cb,_0xac621){return db[_0x34e0('0x2f')][_0x34e0('0x4a')]({'where':{'id':_0xb460cb[_0x34e0('0x46')]['id']}})[_0x34e0('0x26')](handleEntityNotFound(_0xac621,null))[_0x34e0('0x26')](removeEntity(_0xac621,null))[_0x34e0('0x44')](handleError(_0xac621,null));};exports['describe']=function(_0x3a10ce,_0x4825a7){return db[_0x34e0('0x2f')]['describe']()[_0x34e0('0x26')](respondWithResult(_0x4825a7,null))[_0x34e0('0x44')](handleError(_0x4825a7,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 8b01bcc..2b92ae5 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd395=['user_profile_has_sections','userProfileId','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd395,0x12e));var _0x5d39=function(_0x1cba58,_0x5b126c){_0x1cba58=_0x1cba58-0x0;var _0x586aeb=_0xd395[_0x1cba58];return _0x586aeb;};'use strict';var _=require('lodash');var util=require(_0x5d39('0x0'));var logger=require(_0x5d39('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5d39('0x2'));var fs=require('fs');var path=require(_0x5d39('0x3'));var rimraf=require(_0x5d39('0x4'));var config=require(_0x5d39('0x5'));var attributes=require(_0x5d39('0x6'));module[_0x5d39('0x7')]=function(_0xf8b3f,_0x551daa){return _0xf8b3f[_0x5d39('0x8')](_0x5d39('0x9'),attributes,{'tableName':_0x5d39('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x5d39('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8345=['define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x8345,0x1e5));var _0x5834=function(_0xadd855,_0x313dd0){_0xadd855=_0xadd855-0x0;var _0x16a09f=_0x8345[_0xadd855];return _0x16a09f;};'use strict';var _=require(_0x5834('0x0'));var util=require(_0x5834('0x1'));var logger=require(_0x5834('0x2'))('api');var moment=require(_0x5834('0x3'));var BPromise=require(_0x5834('0x4'));var rp=require(_0x5834('0x5'));var fs=require('fs');var path=require(_0x5834('0x6'));var rimraf=require(_0x5834('0x7'));var config=require(_0x5834('0x8'));var attributes=require(_0x5834('0x9'));module[_0x5834('0xa')]=function(_0x3f9a2c,_0xfa4429){return _0x3f9a2c[_0x5834('0xb')](_0x5834('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x5834('0xd'),'fields':[_0x5834('0xe'),_0x5834('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 26d503a..8b3c58f 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99c1=['error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5a5a5d,_0xb5a2f){var _0x38737e=function(_0x4d08aa){while(--_0x4d08aa){_0x5a5a5d['push'](_0x5a5a5d['shift']());}};_0x38737e(++_0xb5a2f);}(_0x99c1,0x147));var _0x199c=function(_0x187d2f,_0x14514a){_0x187d2f=_0x187d2f-0x0;var _0x59d1ab=_0x99c1[_0x187d2f];return _0x59d1ab;};'use strict';var _=require('lodash');var util=require(_0x199c('0x0'));var moment=require(_0x199c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x199c('0x2'));var db=require(_0x199c('0x3'))['db'];var utils=require(_0x199c('0x4'));var logger=require(_0x199c('0x5'))(_0x199c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x199c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2288,_0x1dce8d,_0x52814e){return new BPromise(function(_0x1f448b,_0x527e08){return client[_0x199c('0x8')](_0x3a2288,_0x52814e)[_0x199c('0x9')](function(_0x15385a){logger[_0x199c('0xa')](_0x199c('0xb'),_0x1dce8d,'request\x20sent');logger[_0x199c('0xc')](_0x199c('0xd'),_0x1dce8d,_0x199c('0xe'),JSON['stringify'](_0x15385a));if(_0x15385a[_0x199c('0xf')]){if(_0x15385a[_0x199c('0xf')][_0x199c('0x10')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x1dce8d,_0x15385a[_0x199c('0xf')]['message']);return _0x527e08(_0x15385a[_0x199c('0xf')]['message']);}logger[_0x199c('0xf')](_0x199c('0xb'),_0x1dce8d,_0x15385a[_0x199c('0xf')]['message']);return _0x1f448b(_0x15385a[_0x199c('0xf')][_0x199c('0x11')]);}else{logger[_0x199c('0xa')](_0x199c('0xb'),_0x1dce8d,'request\x20sent');_0x1f448b(_0x15385a[_0x199c('0x12')][_0x199c('0x11')]);}})['catch'](function(_0x54c478){logger[_0x199c('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x1dce8d,_0x54c478);_0x527e08(_0x54c478);});});} \ No newline at end of file +var _0xa398=['bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2d0bd3,_0x1236cf){var _0x4b6921=function(_0xe11077){while(--_0xe11077){_0x2d0bd3['push'](_0x2d0bd3['shift']());}};_0x4b6921(++_0x1236cf);}(_0xa398,0xbb));var _0x8a39=function(_0x264bd7,_0x338aad){_0x264bd7=_0x264bd7-0x0;var _0x334a4e=_0xa398[_0x264bd7];return _0x334a4e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8a39('0x0'));var rs=require(_0x8a39('0x1'));var fs=require('fs');var Redis=require(_0x8a39('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a39('0x3'));var logger=require('../../config/logger')(_0x8a39('0x4'));var config=require('../../config/environment');var jayson=require(_0x8a39('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f318f,_0x20d404,_0xaa18aa){return new BPromise(function(_0x3d2007,_0x4e8876){return client[_0x8a39('0x6')](_0x2f318f,_0xaa18aa)[_0x8a39('0x7')](function(_0x4c396a){logger['info'](_0x8a39('0x8'),_0x20d404,_0x8a39('0x9'));logger[_0x8a39('0xa')](_0x8a39('0xb'),_0x20d404,'request\x20sent',JSON[_0x8a39('0xc')](_0x4c396a));if(_0x4c396a['error']){if(_0x4c396a[_0x8a39('0xd')][_0x8a39('0xe')]===0x1f4){logger[_0x8a39('0xd')](_0x8a39('0x8'),_0x20d404,_0x4c396a[_0x8a39('0xd')][_0x8a39('0xf')]);return _0x4e8876(_0x4c396a[_0x8a39('0xd')][_0x8a39('0xf')]);}logger[_0x8a39('0xd')](_0x8a39('0x8'),_0x20d404,_0x4c396a[_0x8a39('0xd')]['message']);return _0x3d2007(_0x4c396a[_0x8a39('0xd')]['message']);}else{logger[_0x8a39('0x10')](_0x8a39('0x8'),_0x20d404,'request\x20sent');_0x3d2007(_0x4c396a['result'][_0x8a39('0xf')]);}})['catch'](function(_0x1369db){logger['error'](_0x8a39('0x8'),_0x20d404,_0x1369db);_0x4e8876(_0x1369db);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 60dbafb..8bebad6 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x597ae0,_0x299b55){var _0x5a4bfa=function(_0x4e75e4){while(--_0x4e75e4){_0x597ae0['push'](_0x597ae0['shift']());}};_0x5a4bfa(++_0x299b55);}(_0xe706,0xa3));var _0x6e70=function(_0x41b62a,_0x13d23e){_0x41b62a=_0x41b62a-0x0;var _0x429f38=_0xe706[_0x41b62a];return _0x429f38;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x46aba5,_0x13b469){var _0x504154=function(_0x5d20d5){while(--_0x5d20d5){_0x46aba5['push'](_0x46aba5['shift']());}};_0x504154(++_0x13b469);}(_0x70e0,0x17b));var _0x070e=function(_0x56e4f2,_0x5547a1){_0x56e4f2=_0x56e4f2-0x0;var _0x4aafcb=_0x70e0[_0x56e4f2];return _0x4aafcb;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index df68fd3..41b1a80 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57cf=['INTEGER','sequelize','exports'];(function(_0x2acef2,_0x3697dd){var _0x1f9fc2=function(_0x18e429){while(--_0x18e429){_0x2acef2['push'](_0x2acef2['shift']());}};_0x1f9fc2(++_0x3697dd);}(_0x57cf,0x11b));var _0xf57c=function(_0x406ae7,_0x12181b){_0x406ae7=_0x406ae7-0x0;var _0x5a5b9d=_0x57cf[_0x406ae7];return _0x5a5b9d;};'use strict';var Sequelize=require(_0xf57c('0x0'));module[_0xf57c('0x1')]={'penalty':{'type':Sequelize[_0xf57c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb39f=['sequelize','exports','INTEGER'];(function(_0x487729,_0x3d5df8){var _0x5a1afd=function(_0x4ca49d){while(--_0x4ca49d){_0x487729['push'](_0x487729['shift']());}};_0x5a1afd(++_0x3d5df8);}(_0xb39f,0x1e6));var _0xfb39=function(_0x35ce1f,_0x2b0edd){_0x35ce1f=_0x35ce1f-0x0;var _0x56a697=_0xb39f[_0x35ce1f];return _0x56a697;};'use strict';var Sequelize=require(_0xfb39('0x0'));module[_0xfb39('0x1')]={'penalty':{'type':Sequelize[_0xfb39('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index d5455ed..23a892f 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf072=['path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0x30ba97,_0x107d5f){var _0x44aeef=function(_0x2ba1c7){while(--_0x2ba1c7){_0x30ba97['push'](_0x30ba97['shift']());}};_0x44aeef(++_0x107d5f);}(_0xf072,0x1cf));var _0x2f07=function(_0x2a75b5,_0x27649d){_0x2a75b5=_0x2a75b5-0x0;var _0x2017b3=_0xf072[_0x2a75b5];return _0x2017b3;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba18=['moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x2ccd8b,_0x1ad791){var _0x2dc6bd=function(_0x3b1a4a){while(--_0x3b1a4a){_0x2ccd8b['push'](_0x2ccd8b['shift']());}};_0x2dc6bd(++_0x1ad791);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var logger=require(_0x8ba1('0x2'))(_0x8ba1('0x3'));var moment=require(_0x8ba1('0x4'));var BPromise=require(_0x8ba1('0x5'));var rp=require(_0x8ba1('0x6'));var fs=require('fs');var path=require(_0x8ba1('0x7'));var rimraf=require('rimraf');var config=require(_0x8ba1('0x8'));var attributes=require(_0x8ba1('0x9'));module[_0x8ba1('0xa')]=function(_0x2a9dab,_0x3b107c){return _0x2a9dab[_0x8ba1('0xb')]('UserSmsQueue',attributes,{'tableName':_0x8ba1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 7c17a65..71a460d 100644 --- a/server/api/userSmsQueue/userSmsQueue.rpc.js +++ b/server/api/userSmsQueue/userSmsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2838=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x33fa0a,_0x2ec558){var _0x7147fe=function(_0xe0689f){while(--_0xe0689f){_0x33fa0a['push'](_0x33fa0a['shift']());}};_0x7147fe(++_0x2ec558);}(_0x2838,0x1be));var _0x8283=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2838[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x8283('0x0'));var moment=require(_0x8283('0x1'));var BPromise=require(_0x8283('0x2'));var rs=require(_0x8283('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8283('0x4'))['db'];var utils=require(_0x8283('0x5'));var logger=require(_0x8283('0x6'))('rpc');var config=require(_0x8283('0x7'));var jayson=require(_0x8283('0x8'));var client=jayson[_0x8283('0x9')][_0x8283('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7266c5,_0x14421d,_0x5f35d3){return new BPromise(function(_0x4d8c99,_0x24551d){return client[_0x8283('0xb')](_0x7266c5,_0x5f35d3)['then'](function(_0x19439e){logger['info'](_0x8283('0xc'),_0x14421d,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x14421d,_0x8283('0xd'),JSON[_0x8283('0xe')](_0x19439e));if(_0x19439e['error']){if(_0x19439e[_0x8283('0xf')][_0x8283('0x10')]===0x1f4){logger[_0x8283('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x14421d,_0x19439e[_0x8283('0xf')][_0x8283('0x11')]);return _0x24551d(_0x19439e[_0x8283('0xf')][_0x8283('0x11')]);}logger[_0x8283('0xf')](_0x8283('0xc'),_0x14421d,_0x19439e[_0x8283('0xf')]['message']);return _0x4d8c99(_0x19439e[_0x8283('0xf')][_0x8283('0x11')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x14421d,_0x8283('0xd'));_0x4d8c99(_0x19439e[_0x8283('0x12')][_0x8283('0x11')]);}})[_0x8283('0x13')](function(_0x2b9a80){logger['error'](_0x8283('0xc'),_0x14421d,_0x2b9a80);_0x24551d(_0x2b9a80);});});} \ No newline at end of file +var _0xb8fc=['http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb8fc,0x15e));var _0xcb8f=function(_0x1e7faa,_0x37a4e3){_0x1e7faa=_0x1e7faa-0x0;var _0x2ad137=_0xb8fc[_0x1e7faa];return _0x2ad137;};'use strict';var _=require('lodash');var util=require(_0xcb8f('0x0'));var moment=require(_0xcb8f('0x1'));var BPromise=require(_0xcb8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb8f('0x3'))['db'];var utils=require(_0xcb8f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xcb8f('0x5'));var jayson=require(_0xcb8f('0x6'));var client=jayson['client'][_0xcb8f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x12d707,_0x5e43f8,_0x467cdd){return new BPromise(function(_0x19b91e,_0x403071){return client['request'](_0x12d707,_0x467cdd)['then'](function(_0x121cc7){logger[_0xcb8f('0x8')](_0xcb8f('0x9'),_0x5e43f8,_0xcb8f('0xa'));logger[_0xcb8f('0xb')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x5e43f8,_0xcb8f('0xa'),JSON[_0xcb8f('0xc')](_0x121cc7));if(_0x121cc7[_0xcb8f('0xd')]){if(_0x121cc7[_0xcb8f('0xd')][_0xcb8f('0xe')]===0x1f4){logger[_0xcb8f('0xd')](_0xcb8f('0x9'),_0x5e43f8,_0x121cc7[_0xcb8f('0xd')]['message']);return _0x403071(_0x121cc7['error'][_0xcb8f('0xf')]);}logger[_0xcb8f('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x5e43f8,_0x121cc7[_0xcb8f('0xd')][_0xcb8f('0xf')]);return _0x19b91e(_0x121cc7[_0xcb8f('0xd')][_0xcb8f('0xf')]);}else{logger[_0xcb8f('0x8')](_0xcb8f('0x9'),_0x5e43f8,_0xcb8f('0xa'));_0x19b91e(_0x121cc7['result'][_0xcb8f('0xf')]);}})[_0xcb8f('0x10')](function(_0x80ed39){logger[_0xcb8f('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x5e43f8,_0x80ed39);_0x403071(_0x80ed39);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e92ce8c..6e4fb4e 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4776=['INTEGER','sequelize'];(function(_0x16fea1,_0x5a137c){var _0x4f8cec=function(_0x1fb3a0){while(--_0x1fb3a0){_0x16fea1['push'](_0x16fea1['shift']());}};_0x4f8cec(++_0x5a137c);}(_0x4776,0x1d3));var _0x6477=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x4776[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0x6477('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x6477('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x6477('0x1')]}}; \ No newline at end of file +var _0x39b0=['INTEGER','exports'];(function(_0x53de6a,_0x25d369){var _0x4b0f2d=function(_0x355198){while(--_0x355198){_0x53de6a['push'](_0x53de6a['shift']());}};_0x4b0f2d(++_0x25d369);}(_0x39b0,0x18d));var _0x039b=function(_0x205e78,_0x59d5c5){_0x205e78=_0x205e78-0x0;var _0x3fb2a1=_0x39b0[_0x205e78];return _0x3fb2a1;};'use strict';var Sequelize=require('sequelize');module[_0x039b('0x0')]={'UserId':{'type':Sequelize[_0x039b('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x039b('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index c1fb638..55f4256 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2213b8,_0x3c77d3){var _0x5cb1cf=function(_0x3297f7){while(--_0x3297f7){_0x2213b8['push'](_0x2213b8['shift']());}};_0x5cb1cf(++_0x3c77d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1f3ec4,_0x47fe40){var _0x10deea=function(_0x456b74){while(--_0x456b74){_0x1f3ec4['push'](_0x1f3ec4['shift']());}};_0x10deea(++_0x47fe40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9f5bea1..6f775eb 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4be88b,_0x22e2e2){var _0x17bad1=function(_0x2de873){while(--_0x2de873){_0x4be88b['push'](_0x4be88b['shift']());}};_0x17bad1(++_0x22e2e2);}(_0x70e0,0x17b));var _0x070e=function(_0x26ae10,_0x209b2d){_0x26ae10=_0x26ae10-0x0;var _0x4d4ccc=_0x70e0[_0x26ae10];return _0x4d4ccc;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index dec9199..26cd6c6 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15b6=['INTEGER','sequelize'];(function(_0x2a8b35,_0x3726e0){var _0x1fc759=function(_0x2ff71e){while(--_0x2ff71e){_0x2a8b35['push'](_0x2a8b35['shift']());}};_0x1fc759(++_0x3726e0);}(_0x15b6,0x1a9));var _0x615b=function(_0x574984,_0x569bd1){_0x574984=_0x574984-0x0;var _0x2ba85c=_0x15b6[_0x574984];return _0x2ba85c;};'use strict';var Sequelize=require(_0x615b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x615b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0bcd=['INTEGER','sequelize','exports'];(function(_0x5be6ee,_0x4e2fe8){var _0x197f3e=function(_0x145c63){while(--_0x145c63){_0x5be6ee['push'](_0x5be6ee['shift']());}};_0x197f3e(++_0x4e2fe8);}(_0x0bcd,0xb2));var _0xd0bc=function(_0x24da84,_0x3cdec2){_0x24da84=_0x24da84-0x0;var _0x339545=_0x0bcd[_0x24da84];return _0x339545;};'use strict';var Sequelize=require(_0xd0bc('0x0'));module[_0xd0bc('0x1')]={'penalty':{'type':Sequelize[_0xd0bc('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 04cc88b..445ca27 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.model.js +++ b/server/api/userVoiceQueue/userVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4542=['define','UserVoiceQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x81e682,_0x5619f1){var _0x26a643=function(_0x22dc08){while(--_0x22dc08){_0x81e682['push'](_0x81e682['shift']());}};_0x26a643(++_0x5619f1);}(_0x4542,0x1f0));var _0x2454=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x4542[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x2454('0x0'));var util=require(_0x2454('0x1'));var logger=require(_0x2454('0x2'))('api');var moment=require(_0x2454('0x3'));var BPromise=require(_0x2454('0x4'));var rp=require(_0x2454('0x5'));var fs=require('fs');var path=require(_0x2454('0x6'));var rimraf=require(_0x2454('0x7'));var config=require(_0x2454('0x8'));var attributes=require(_0x2454('0x9'));module[_0x2454('0xa')]=function(_0x554c0b,_0x49d22c){return _0x554c0b[_0x2454('0xb')](_0x2454('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d3d=['exports','define','UserVoiceQueue','lodash','util','request-promise','path','rimraf','./userVoiceQueue.attributes'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7d3d,0x1aa));var _0xd7d3=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x7d3d[_0x5cc8];return _0x450661;};'use strict';var _=require(_0xd7d3('0x0'));var util=require(_0xd7d3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd7d3('0x2'));var fs=require('fs');var path=require(_0xd7d3('0x3'));var rimraf=require(_0xd7d3('0x4'));var config=require('../../config/environment');var attributes=require(_0xd7d3('0x5'));module[_0xd7d3('0x6')]=function(_0x174438,_0x2e677e){return _0x174438[_0xd7d3('0x7')](_0xd7d3('0x8'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 73defee..e3bf17c 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.rpc.js +++ b/server/api/userVoiceQueue/userVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e10=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2ce00f,_0x41d23a){var _0x47f2f7=function(_0x352f8a){while(--_0x352f8a){_0x2ce00f['push'](_0x2ce00f['shift']());}};_0x47f2f7(++_0x41d23a);}(_0x3e10,0x11c));var _0x03e1=function(_0x4e8eef,_0x2cb73b){_0x4e8eef=_0x4e8eef-0x0;var _0x2998f7=_0x3e10[_0x4e8eef];return _0x2998f7;};'use strict';var _=require(_0x03e1('0x0'));var util=require(_0x03e1('0x1'));var moment=require(_0x03e1('0x2'));var BPromise=require(_0x03e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03e1('0x4'))['db'];var utils=require(_0x03e1('0x5'));var logger=require('../../config/logger')(_0x03e1('0x6'));var config=require(_0x03e1('0x7'));var jayson=require(_0x03e1('0x8'));var client=jayson[_0x03e1('0x9')][_0x03e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c41d6,_0x3e9a9d,_0x5eabe0){return new BPromise(function(_0x5b5cb9,_0x186f28){return client[_0x03e1('0xb')](_0x1c41d6,_0x5eabe0)['then'](function(_0x285282){logger[_0x03e1('0xc')](_0x03e1('0xd'),_0x3e9a9d,_0x03e1('0xe'));logger['debug'](_0x03e1('0xf'),_0x3e9a9d,_0x03e1('0xe'),JSON[_0x03e1('0x10')](_0x285282));if(_0x285282[_0x03e1('0x11')]){if(_0x285282['error'][_0x03e1('0x12')]===0x1f4){logger[_0x03e1('0x11')](_0x03e1('0xd'),_0x3e9a9d,_0x285282['error'][_0x03e1('0x13')]);return _0x186f28(_0x285282['error'][_0x03e1('0x13')]);}logger[_0x03e1('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3e9a9d,_0x285282[_0x03e1('0x11')][_0x03e1('0x13')]);return _0x5b5cb9(_0x285282['error'][_0x03e1('0x13')]);}else{logger[_0x03e1('0xc')](_0x03e1('0xd'),_0x3e9a9d,'request\x20sent');_0x5b5cb9(_0x285282[_0x03e1('0x14')]['message']);}})[_0x03e1('0x15')](function(_0x15ad13){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x3e9a9d,_0x15ad13);_0x186f28(_0x15ad13);});});} \ No newline at end of file +var _0xeb16=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','moment','bluebird'];(function(_0x61a814,_0x11bc14){var _0x45775e=function(_0x1a81e5){while(--_0x1a81e5){_0x61a814['push'](_0x61a814['shift']());}};_0x45775e(++_0x11bc14);}(_0xeb16,0x82));var _0x6eb1=function(_0x347211,_0x474cf0){_0x347211=_0x347211-0x0;var _0x3e6bae=_0xeb16[_0x347211];return _0x3e6bae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6eb1('0x0'));var BPromise=require(_0x6eb1('0x1'));var rs=require(_0x6eb1('0x2'));var fs=require('fs');var Redis=require(_0x6eb1('0x3'));var db=require(_0x6eb1('0x4'))['db'];var utils=require(_0x6eb1('0x5'));var logger=require(_0x6eb1('0x6'))(_0x6eb1('0x7'));var config=require(_0x6eb1('0x8'));var jayson=require(_0x6eb1('0x9'));var client=jayson['client'][_0x6eb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422beb,_0x407f28,_0x12330c){return new BPromise(function(_0xb61613,_0x5a7310){return client[_0x6eb1('0xb')](_0x422beb,_0x12330c)[_0x6eb1('0xc')](function(_0x1808aa){logger[_0x6eb1('0xd')](_0x6eb1('0xe'),_0x407f28,_0x6eb1('0xf'));logger[_0x6eb1('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x407f28,_0x6eb1('0xf'),JSON['stringify'](_0x1808aa));if(_0x1808aa[_0x6eb1('0x11')]){if(_0x1808aa['error'][_0x6eb1('0x12')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x407f28,_0x1808aa['error']['message']);return _0x5a7310(_0x1808aa['error']['message']);}logger['error'](_0x6eb1('0xe'),_0x407f28,_0x1808aa[_0x6eb1('0x11')][_0x6eb1('0x13')]);return _0xb61613(_0x1808aa[_0x6eb1('0x11')][_0x6eb1('0x13')]);}else{logger[_0x6eb1('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x407f28,_0x6eb1('0xf'));_0xb61613(_0x1808aa[_0x6eb1('0x14')][_0x6eb1('0x13')]);}})[_0x6eb1('0x15')](function(_0x40b960){logger['error'](_0x6eb1('0xe'),_0x407f28,_0x40b960);_0x5a7310(_0x40b960);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d8b2e00..ecb8150 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4095ad,_0x5482a5){var _0x437bf1=function(_0x4a8083){while(--_0x4a8083){_0x4095ad['push'](_0x4095ad['shift']());}};_0x437bf1(++_0x5482a5);}(_0xe706,0xa3));var _0x6e70=function(_0x312b2b,_0x2174f3){_0x312b2b=_0x312b2b-0x0;var _0x1d6a18=_0xe706[_0x312b2b];return _0x1d6a18;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d84b1,_0x599872){var _0x54fa39=function(_0x48ef05){while(--_0x48ef05){_0x1d84b1['push'](_0x1d84b1['shift']());}};_0x54fa39(++_0x599872);}(_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'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f218f2d..6ba1963 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc315=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2f243e,_0x2a3590){var _0x504765=function(_0x500fbb){while(--_0x500fbb){_0x2f243e['push'](_0x2f243e['shift']());}};_0x504765(++_0x2a3590);}(_0xc315,0x192));var _0x5c31=function(_0x52e01e,_0x2b29c7){_0x52e01e=_0x52e01e-0x0;var _0x276040=_0xc315[_0x52e01e];return _0x276040;};'use strict';var Sequelize=require('sequelize');module[_0x5c31('0x0')]={'uniqueid':{'type':Sequelize[_0x5c31('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5c31('0x2')},'membername':{'type':Sequelize[_0x5c31('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x5c31('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5c31('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x5c31('0x2')},'VoiceQueueId':{'type':Sequelize[_0x5c31('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x5c31('0x3')],'allowNull':![],'unique':_0x5c31('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x5c31('0x2')},'paused':{'type':Sequelize[_0x5c31('0x1')](0xb),'defaultValue':0x0,'comment':_0x5c31('0x2')}}; \ No newline at end of file +var _0xad2f=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','INTEGER'];(function(_0x3c7999,_0x36868d){var _0x4723b4=function(_0x1cdd19){while(--_0x1cdd19){_0x3c7999['push'](_0x3c7999['shift']());}};_0x4723b4(++_0x36868d);}(_0xad2f,0x1e3));var _0xfad2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xad2f[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0xfad2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xfad2('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xfad2('0x2')],'allowNull':![],'comment':_0xfad2('0x3')},'UserId':{'type':Sequelize[_0xfad2('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xfad2('0x2')],'allowNull':![],'unique':_0xfad2('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfad2('0x4'),'comment':_0xfad2('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xfad2('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xfad2('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0dc9be2..8ab8881 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a11=['update','../../mysqldb','UserVoiceQueueRt','save'];(function(_0x346107,_0x296b20){var _0x361e34=function(_0x20a924){while(--_0x20a924){_0x346107['push'](_0x346107['shift']());}};_0x361e34(++_0x296b20);}(_0x7a11,0x149));var _0x17a1=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x7a11[_0x41f2f5];return _0x3d49f1;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x17a1('0x0'))['db'][_0x17a1('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x17a1('0x2'),'afterUpdate':_0x17a1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x939cfa){return function(_0x505ebf,_0x8e1adf,_0x2bce86){UserVoiceQueueRtEvents['emit'](_0x939cfa+':'+_0x505ebf['id'],_0x505ebf);UserVoiceQueueRtEvents['emit'](_0x939cfa,_0x505ebf);_0x2bce86(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x73ba=['hook','exports','events','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x73ba,0x1d6));var _0xa73b=function(_0x2219d8,_0xbe0a89){_0x2219d8=_0x2219d8-0x0;var _0x3ac588=_0x73ba[_0x2219d8];return _0x3ac588;};'use strict';var EventEmitter=require(_0xa73b('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xa73b('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa73b('0x2')](0x0);var events={'afterCreate':_0xa73b('0x3'),'afterUpdate':_0xa73b('0x4'),'afterDestroy':_0xa73b('0x5')};function emitEvent(_0x3473d9){return function(_0x28795e,_0xf937e,_0x1006a8){UserVoiceQueueRtEvents[_0xa73b('0x6')](_0x3473d9+':'+_0x28795e['id'],_0x28795e);UserVoiceQueueRtEvents[_0xa73b('0x6')](_0x3473d9,_0x28795e);_0x1006a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xa73b('0x7')](e,emitEvent(event));}}module[_0xa73b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7bd5ada..274e158 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e4c=['lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x41f4a0,_0x59e659){var _0x395b4c=function(_0x29cbcf){while(--_0x29cbcf){_0x41f4a0['push'](_0x41f4a0['shift']());}};_0x395b4c(++_0x59e659);}(_0x3e4c,0x1c2));var _0xc3e4=function(_0x4bfa58,_0x50d569){_0x4bfa58=_0x4bfa58-0x0;var _0x247a4b=_0x3e4c[_0x4bfa58];return _0x247a4b;};'use strict';var _=require(_0xc3e4('0x0'));var util=require(_0xc3e4('0x1'));var logger=require(_0xc3e4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3e4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3e4('0x4'));var config=require(_0xc3e4('0x5'));var attributes=require(_0xc3e4('0x6'));module[_0xc3e4('0x7')]=function(_0x51a326,_0x3df8cd){return _0x51a326[_0xc3e4('0x8')](_0xc3e4('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd15e=['rimraf','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x2cd23c,_0x411cde){var _0x243962=function(_0xa7f1d5){while(--_0xa7f1d5){_0x2cd23c['push'](_0x2cd23c['shift']());}};_0x243962(++_0x411cde);}(_0xd15e,0x7d));var _0xed15=function(_0x1cad7f,_0x8aa17d){_0x1cad7f=_0x1cad7f-0x0;var _0x2f81fc=_0xd15e[_0x1cad7f];return _0x2f81fc;};'use strict';var _=require(_0xed15('0x0'));var util=require('util');var logger=require(_0xed15('0x1'))('api');var moment=require('moment');var BPromise=require(_0xed15('0x2'));var rp=require(_0xed15('0x3'));var fs=require('fs');var path=require(_0xed15('0x4'));var rimraf=require(_0xed15('0x5'));var config=require('../../config/environment');var attributes=require(_0xed15('0x6'));module[_0xed15('0x7')]=function(_0x4ca9ed,_0x20bf78){return _0x4ca9ed[_0xed15('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xed15('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 14f1a5e..b761cff 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ca4=['message','result','catch','GetVoiceQueueRtPauses','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x36fe1a,_0x3973f4){var _0x5aae39=function(_0x57fe68){while(--_0x57fe68){_0x36fe1a['push'](_0x36fe1a['shift']());}};_0x5aae39(++_0x3973f4);}(_0x5ca4,0xd7));var _0x45ca=function(_0x38fd8c,_0x377d4b){_0x38fd8c=_0x38fd8c-0x0;var _0x195912=_0x5ca4[_0x38fd8c];return _0x195912;};'use strict';var _=require(_0x45ca('0x0'));var util=require(_0x45ca('0x1'));var moment=require(_0x45ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x45ca('0x3'));var fs=require('fs');var Redis=require(_0x45ca('0x4'));var db=require(_0x45ca('0x5'))['db'];var utils=require(_0x45ca('0x6'));var logger=require(_0x45ca('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x45ca('0x8'));var client=jayson[_0x45ca('0x9')]['http']({'port':0x232a});config[_0x45ca('0xa')]=_['defaults'](config['redis'],{'host':_0x45ca('0xb'),'port':0x18eb});var socket=require(_0x45ca('0xc'))(new Redis(config['redis']));require(_0x45ca('0xd'))[_0x45ca('0xe')](socket);function respondWithRpcPromise(_0x4ec3c5,_0x172eb7,_0x154c30){return new BPromise(function(_0x4337f1,_0x4559f8){return client[_0x45ca('0xf')](_0x4ec3c5,_0x154c30)[_0x45ca('0x10')](function(_0x2ec5bd){logger[_0x45ca('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x172eb7,_0x45ca('0x12'));logger[_0x45ca('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x172eb7,_0x45ca('0x12'),JSON[_0x45ca('0x14')](_0x2ec5bd));if(_0x2ec5bd['error']){if(_0x2ec5bd[_0x45ca('0x15')]['code']===0x1f4){logger[_0x45ca('0x15')](_0x45ca('0x16'),_0x172eb7,_0x2ec5bd[_0x45ca('0x15')][_0x45ca('0x17')]);return _0x4559f8(_0x2ec5bd[_0x45ca('0x15')][_0x45ca('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x172eb7,_0x2ec5bd[_0x45ca('0x15')][_0x45ca('0x17')]);return _0x4337f1(_0x2ec5bd[_0x45ca('0x15')][_0x45ca('0x17')]);}else{logger['info'](_0x45ca('0x16'),_0x172eb7,_0x45ca('0x12'));_0x4337f1(_0x2ec5bd[_0x45ca('0x18')]['message']);}})[_0x45ca('0x19')](function(_0x1638df){logger['error'](_0x45ca('0x16'),_0x172eb7,_0x1638df);_0x4559f8(_0x1638df);});});}exports[_0x45ca('0x1a')]=function(_0x12c06b){var _0x1271a9=this;return new Promise(function(_0x58ba57,_0x198ee0){return db['UserVoiceQueueRt']['findAll']({'raw':_0x12c06b[_0x45ca('0x1b')]?_0x12c06b[_0x45ca('0x1b')][_0x45ca('0x1c')]===undefined?!![]:![]:!![],'where':_0x12c06b[_0x45ca('0x1b')]?_0x12c06b[_0x45ca('0x1b')][_0x45ca('0x1d')]||null:null,'attributes':[[db[_0x45ca('0x1e')]['fn']('COUNT',db[_0x45ca('0x1e')]['fn']('IF',db['sequelize'][_0x45ca('0x1f')](_0x45ca('0x20')))),_0x45ca('0x21')]]})[_0x45ca('0x10')](function(_0x30fa2f){logger['info'](_0x45ca('0x1a'),_0x12c06b);logger[_0x45ca('0x13')](_0x45ca('0x1a'),_0x12c06b,JSON[_0x45ca('0x14')](_0x30fa2f));_0x58ba57(_0x30fa2f);})['catch'](function(_0x35b383){logger[_0x45ca('0x15')](_0x45ca('0x1a'),_0x35b383[_0x45ca('0x17')],_0x12c06b);_0x198ee0(_0x1271a9[_0x45ca('0x15')](0x1f4,_0x35b383['message']));});});}; \ No newline at end of file +var _0x440a=['client','http','redis','defaults','localhost','socket.io-emitter','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ea4d1,_0xe76d8f){var _0x1a889c=function(_0x3448e9){while(--_0x3448e9){_0x5ea4d1['push'](_0x5ea4d1['shift']());}};_0x1a889c(++_0xe76d8f);}(_0x440a,0x12d));var _0xa440=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x440a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa440('0x0'));var util=require(_0xa440('0x1'));var moment=require('moment');var BPromise=require(_0xa440('0x2'));var rs=require(_0xa440('0x3'));var fs=require('fs');var Redis=require(_0xa440('0x4'));var db=require(_0xa440('0x5'))['db'];var utils=require(_0xa440('0x6'));var logger=require(_0xa440('0x7'))(_0xa440('0x8'));var config=require(_0xa440('0x9'));var jayson=require(_0xa440('0xa'));var client=jayson[_0xa440('0xb')][_0xa440('0xc')]({'port':0x232a});config[_0xa440('0xd')]=_[_0xa440('0xe')](config[_0xa440('0xd')],{'host':_0xa440('0xf'),'port':0x18eb});var socket=require(_0xa440('0x10'))(new Redis(config[_0xa440('0xd')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x2fab0d,_0x32372d,_0x114150){return new BPromise(function(_0x24ba2c,_0x567aa9){return client[_0xa440('0x11')](_0x2fab0d,_0x114150)[_0xa440('0x12')](function(_0x4d29de){logger['info'](_0xa440('0x13'),_0x32372d,_0xa440('0x14'));logger[_0xa440('0x15')](_0xa440('0x16'),_0x32372d,'request\x20sent',JSON['stringify'](_0x4d29de));if(_0x4d29de[_0xa440('0x17')]){if(_0x4d29de[_0xa440('0x17')]['code']===0x1f4){logger[_0xa440('0x17')](_0xa440('0x13'),_0x32372d,_0x4d29de[_0xa440('0x17')][_0xa440('0x18')]);return _0x567aa9(_0x4d29de[_0xa440('0x17')][_0xa440('0x18')]);}logger[_0xa440('0x17')](_0xa440('0x13'),_0x32372d,_0x4d29de[_0xa440('0x17')][_0xa440('0x18')]);return _0x24ba2c(_0x4d29de[_0xa440('0x17')][_0xa440('0x18')]);}else{logger[_0xa440('0x19')](_0xa440('0x13'),_0x32372d,_0xa440('0x14'));_0x24ba2c(_0x4d29de[_0xa440('0x1a')][_0xa440('0x18')]);}})[_0xa440('0x1b')](function(_0x1d811c){logger[_0xa440('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x32372d,_0x1d811c);_0x567aa9(_0x1d811c);});});}exports[_0xa440('0x1c')]=function(_0xd46eb1){var _0x546d3a=this;return new Promise(function(_0x2fe428,_0x33b245){return db[_0xa440('0x1d')][_0xa440('0x1e')]({'raw':_0xd46eb1[_0xa440('0x1f')]?_0xd46eb1[_0xa440('0x1f')][_0xa440('0x20')]===undefined?!![]:![]:!![],'where':_0xd46eb1[_0xa440('0x1f')]?_0xd46eb1[_0xa440('0x1f')][_0xa440('0x21')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa440('0x22')][_0xa440('0x23')](_0xa440('0x24')))),_0xa440('0x25')]]})[_0xa440('0x12')](function(_0x1f3c7d){logger['info'](_0xa440('0x1c'),_0xd46eb1);logger[_0xa440('0x15')]('GetVoiceQueueRtPauses',_0xd46eb1,JSON[_0xa440('0x26')](_0x1f3c7d));_0x2fe428(_0x1f3c7d);})[_0xa440('0x1b')](function(_0x1c9293){logger[_0xa440('0x17')](_0xa440('0x1c'),_0x1c9293[_0xa440('0x18')],_0xd46eb1);_0x33b245(_0x546d3a['error'](0x1f4,_0x1c9293[_0xa440('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 80edc3b..0c85ee3 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf11=['update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x20e5c3,_0x41470c){var _0x401520=function(_0x37f246){while(--_0x37f246){_0x20e5c3['push'](_0x20e5c3['shift']());}};_0x401520(++_0x41470c);}(_0xaf11,0x12f));var _0x1af1=function(_0x4400f4,_0xe16d37){_0x4400f4=_0x4400f4-0x0;var _0x5435c3=_0xaf11[_0x4400f4];return _0x5435c3;};'use strict';var UserVoiceQueueRtEvents=require(_0x1af1('0x0'));var events=[_0x1af1('0x1'),_0x1af1('0x2'),_0x1af1('0x3')];function createListener(_0x532050,_0x15fe21){return function(_0x2c89fa){_0x15fe21[_0x1af1('0x4')](_0x532050,_0x2c89fa);};}function removeListener(_0x53af48,_0xb0ace){return function(){UserVoiceQueueRtEvents[_0x1af1('0x5')](_0x53af48,_0xb0ace);};}exports[_0x1af1('0x6')]=function(_0x4d3153){for(var _0x36f1a0=0x0,_0x5dbe9d=events[_0x1af1('0x7')];_0x36f1a0<_0x5dbe9d;_0x36f1a0++){var _0x26d917=events[_0x36f1a0];var _0x48b286=createListener(_0x1af1('0x8')+_0x26d917,_0x4d3153);UserVoiceQueueRtEvents['on'](_0x26d917,_0x48b286);}}; \ No newline at end of file +var _0xae24=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','removeListener','register'];(function(_0x3d17e5,_0x6bf2f3){var _0x5f5d29=function(_0x466c43){while(--_0x466c43){_0x3d17e5['push'](_0x3d17e5['shift']());}};_0x5f5d29(++_0x6bf2f3);}(_0xae24,0x182));var _0x4ae2=function(_0x249491,_0x180964){_0x249491=_0x249491-0x0;var _0xaa3330=_0xae24[_0x249491];return _0xaa3330;};'use strict';var UserVoiceQueueRtEvents=require(_0x4ae2('0x0'));var events=['save',_0x4ae2('0x1'),'update'];function createListener(_0xf4c45d,_0x1bf293){return function(_0x564d54){_0x1bf293['emit'](_0xf4c45d,_0x564d54);};}function removeListener(_0x1afc7a,_0x5b25b5){return function(){UserVoiceQueueRtEvents[_0x4ae2('0x2')](_0x1afc7a,_0x5b25b5);};}exports[_0x4ae2('0x3')]=function(_0x20c85c){for(var _0x3e6055=0x0,_0x428054=events[_0x4ae2('0x4')];_0x3e6055<_0x428054;_0x3e6055++){var _0x4f2e84=events[_0x3e6055];var _0x5f589a=createListener(_0x4ae2('0x5')+_0x4f2e84,_0x20c85c);UserVoiceQueueRtEvents['on'](_0x4f2e84,_0x5f589a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 8e940d2..df402d5 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x50301e,_0xd9d28e){var _0xd9631c=function(_0x24856d){while(--_0x24856d){_0x50301e['push'](_0x50301e['shift']());}};_0xd9631c(++_0xd9d28e);}(_0xe706,0xa3));var _0x6e70=function(_0x11de69,_0x46c7c6){_0x11de69=_0x11de69-0x0;var _0x211379=_0xe706[_0x11de69];return _0x211379;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c64bd1f..456ccfd 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x079c=['sequelize','INTEGER'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x079c,0x1e4));var _0xc079=function(_0x37d732,_0x3a5b52){_0x37d732=_0x37d732-0x0;var _0x1c99a7=_0x079c[_0x37d732];return _0x1c99a7;};'use strict';var Sequelize=require(_0xc079('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc079('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a7f=['sequelize','INTEGER'];(function(_0x5c1614,_0x58c413){var _0x2a3f30=function(_0x4ea949){while(--_0x4ea949){_0x5c1614['push'](_0x5c1614['shift']());}};_0x2a3f30(++_0x58c413);}(_0x8a7f,0x1b8));var _0xf8a7=function(_0x3d1946,_0x120d74){_0x3d1946=_0x3d1946-0x0;var _0x59694f=_0x8a7f[_0x3d1946];return _0x59694f;};'use strict';var Sequelize=require(_0xf8a7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf8a7('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 21d8408..2b57c97 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7a8=['path','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46a003,_0x28c4ab){var _0x4084dc=function(_0x36bbba){while(--_0x36bbba){_0x46a003['push'](_0x46a003['shift']());}};_0x4084dc(++_0x28c4ab);}(_0xb7a8,0x95));var _0x8b7a=function(_0x326b78,_0x595272){_0x326b78=_0x326b78-0x0;var _0x28b145=_0xb7a8[_0x326b78];return _0x28b145;};'use strict';var _=require(_0x8b7a('0x0'));var util=require(_0x8b7a('0x1'));var logger=require(_0x8b7a('0x2'))(_0x8b7a('0x3'));var moment=require(_0x8b7a('0x4'));var BPromise=require(_0x8b7a('0x5'));var rp=require(_0x8b7a('0x6'));var fs=require('fs');var path=require(_0x8b7a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8b7a('0x8'));module[_0x8b7a('0x9')]=function(_0x2546d7,_0x350dbf){return _0x2546d7[_0x8b7a('0xa')](_0x8b7a('0xb'),attributes,{'tableName':_0x8b7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22d2=['../../config/logger','bluebird','request-promise','path','exports','define','lodash','util'];(function(_0x16d411,_0x5e0970){var _0x20336d=function(_0x15d8aa){while(--_0x15d8aa){_0x16d411['push'](_0x16d411['shift']());}};_0x20336d(++_0x5e0970);}(_0x22d2,0xd6));var _0x222d=function(_0x51862c,_0x56fd1d){_0x51862c=_0x51862c-0x0;var _0xc5f6f9=_0x22d2[_0x51862c];return _0xc5f6f9;};'use strict';var _=require(_0x222d('0x0'));var util=require(_0x222d('0x1'));var logger=require(_0x222d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x222d('0x3'));var rp=require(_0x222d('0x4'));var fs=require('fs');var path=require(_0x222d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x222d('0x6')]=function(_0x322407,_0x556b6e){return _0x322407[_0x222d('0x7')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c2b7c6a..4a46dd2 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4da4=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x50c154,_0x4e08a2){var _0x23aad4=function(_0xb549c1){while(--_0xb549c1){_0x50c154['push'](_0x50c154['shift']());}};_0x23aad4(++_0x4e08a2);}(_0x4da4,0xd4));var _0x44da=function(_0x520e16,_0x545cb6){_0x520e16=_0x520e16-0x0;var _0x4771b5=_0x4da4[_0x520e16];return _0x4771b5;};'use strict';var _=require(_0x44da('0x0'));var util=require(_0x44da('0x1'));var moment=require(_0x44da('0x2'));var BPromise=require(_0x44da('0x3'));var rs=require(_0x44da('0x4'));var fs=require('fs');var Redis=require(_0x44da('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x44da('0x6'));var logger=require('../../config/logger')(_0x44da('0x7'));var config=require('../../config/environment');var jayson=require(_0x44da('0x8'));var client=jayson[_0x44da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5620,_0x47669c,_0x2312f0){return new BPromise(function(_0x3f9ae5,_0x294cff){return client[_0x44da('0xa')](_0x3d5620,_0x2312f0)['then'](function(_0x58e29d){logger['info'](_0x44da('0xb'),_0x47669c,_0x44da('0xc'));logger['debug'](_0x44da('0xd'),_0x47669c,'request\x20sent',JSON['stringify'](_0x58e29d));if(_0x58e29d[_0x44da('0xe')]){if(_0x58e29d[_0x44da('0xe')][_0x44da('0xf')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x47669c,_0x58e29d['error'][_0x44da('0x10')]);return _0x294cff(_0x58e29d['error'][_0x44da('0x10')]);}logger[_0x44da('0xe')](_0x44da('0xb'),_0x47669c,_0x58e29d['error'][_0x44da('0x10')]);return _0x3f9ae5(_0x58e29d[_0x44da('0xe')]['message']);}else{logger['info'](_0x44da('0xb'),_0x47669c,_0x44da('0xc'));_0x3f9ae5(_0x58e29d[_0x44da('0x11')]['message']);}})['catch'](function(_0x21a775){logger[_0x44da('0xe')](_0x44da('0xb'),_0x47669c,_0x21a775);_0x294cff(_0x21a775);});});} \ No newline at end of file +var _0x5d97=['debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x3deab6,_0x282c78){var _0x1431a4=function(_0x35c81e){while(--_0x35c81e){_0x3deab6['push'](_0x3deab6['shift']());}};_0x1431a4(++_0x282c78);}(_0x5d97,0x1ac));var _0x75d9=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5d97[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x75d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x75d9('0x1'));var rs=require(_0x75d9('0x2'));var fs=require('fs');var Redis=require(_0x75d9('0x3'));var db=require(_0x75d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x75d9('0x5'));var jayson=require(_0x75d9('0x6'));var client=jayson[_0x75d9('0x7')][_0x75d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40a119,_0x2607ff,_0x3f7593){return new BPromise(function(_0x2b7669,_0x586d63){return client[_0x75d9('0x9')](_0x40a119,_0x3f7593)['then'](function(_0x2ded00){logger[_0x75d9('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2607ff,_0x75d9('0xb'));logger[_0x75d9('0xc')](_0x75d9('0xd'),_0x2607ff,_0x75d9('0xb'),JSON[_0x75d9('0xe')](_0x2ded00));if(_0x2ded00['error']){if(_0x2ded00[_0x75d9('0xf')]['code']===0x1f4){logger[_0x75d9('0xf')](_0x75d9('0x10'),_0x2607ff,_0x2ded00[_0x75d9('0xf')]['message']);return _0x586d63(_0x2ded00[_0x75d9('0xf')][_0x75d9('0x11')]);}logger[_0x75d9('0xf')](_0x75d9('0x10'),_0x2607ff,_0x2ded00[_0x75d9('0xf')][_0x75d9('0x11')]);return _0x2b7669(_0x2ded00[_0x75d9('0xf')][_0x75d9('0x11')]);}else{logger[_0x75d9('0xa')](_0x75d9('0x10'),_0x2607ff,_0x75d9('0xb'));_0x2b7669(_0x2ded00[_0x75d9('0x12')]['message']);}})[_0x75d9('0x13')](function(_0x354ab2){logger[_0x75d9('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2607ff,_0x354ab2);_0x586d63(_0x354ab2);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 7f31bbf..14273c6 100644 --- a/server/api/variable/index.js +++ b/server/api/variable/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55d2=['../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','post','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x55d2,0x9f));var _0x255d=function(_0x48d133,_0xecfe43){_0x48d133=_0x48d133-0x0;var _0x33758=_0x55d2[_0x48d133];return _0x33758;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x255d('0x0'));var timeout=require(_0x255d('0x1'));var express=require(_0x255d('0x2'));var router=express[_0x255d('0x3')]();var fs_extra=require(_0x255d('0x4'));var auth=require(_0x255d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x255d('0x6'));var controller=require(_0x255d('0x7'));router[_0x255d('0x8')]('/',auth[_0x255d('0x9')](),controller['index']);router['get'](_0x255d('0xa'),auth[_0x255d('0x9')](),controller[_0x255d('0xb')]);router[_0x255d('0xc')]('/',auth[_0x255d('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x255d('0xd')]);router['delete'](_0x255d('0xa'),auth[_0x255d('0x9')](),controller[_0x255d('0xe')]);module['exports']=router; \ No newline at end of file +var _0x826a=['./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xadffa9,_0x473052){var _0x2f223a=function(_0x580ee9){while(--_0x580ee9){_0xadffa9['push'](_0xadffa9['shift']());}};_0x2f223a(++_0x473052);}(_0x826a,0x1aa));var _0xa826=function(_0x6f1610,_0x27fce5){_0x6f1610=_0x6f1610-0x0;var _0x302725=_0x826a[_0x6f1610];return _0x302725;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var fs_extra=require(_0xa826('0x3'));var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router[_0xa826('0x7')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0x9')]);router[_0xa826('0x7')](_0xa826('0xa'),auth[_0xa826('0x8')](),controller[_0xa826('0xb')]);router[_0xa826('0xc')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0xd')]);router[_0xa826('0xe')](_0xa826('0xa'),auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);router[_0xa826('0x10')]('/:id',auth[_0xa826('0x8')](),controller['destroy']);module[_0xa826('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 1f64f1a..3e72b66 100644 --- a/server/api/variable/variable.attributes.js +++ b/server/api/variable/variable.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x487d=['STRING','sequelize','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x487d,0x1b4));var _0xd487=function(_0x7acd9c,_0x4ebb68){_0x7acd9c=_0x7acd9c-0x0;var _0x4af9d8=_0x487d[_0x7acd9c];return _0x4af9d8;};'use strict';var Sequelize=require(_0xd487('0x0'));module[_0xd487('0x1')]={'name':{'type':Sequelize[_0xd487('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1ee8=['STRING','exports'];(function(_0x34ffef,_0x276afb){var _0x18cd0b=function(_0xa25961){while(--_0xa25961){_0x34ffef['push'](_0x34ffef['shift']());}};_0x18cd0b(++_0x276afb);}(_0x1ee8,0x6d));var _0x81ee=function(_0x488d85,_0x4fc961){_0x488d85=_0x488d85-0x0;var _0x40c2a7=_0x1ee8[_0x488d85];return _0x40c2a7;};'use strict';var Sequelize=require('sequelize');module[_0x81ee('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x81ee('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a09fdc1..4677fb1 100644 --- a/server/api/variable/variable.controller.js +++ b/server/api/variable/variable.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x238f=['user','role','Variables','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','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','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body'];(function(_0x4a8c2d,_0x5f3504){var _0xbd0c48=function(_0x1049cb){while(--_0x1049cb){_0x4a8c2d['push'](_0x4a8c2d['shift']());}};_0xbd0c48(++_0x5f3504);}(_0x238f,0x155));var _0xf238=function(_0x57ac08,_0xe6acdd){_0x57ac08=_0x57ac08-0x0;var _0x304b4a=_0x238f[_0x57ac08];return _0x304b4a;};'use strict';var emlformat=require(_0xf238('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf238('0x1'));var jsonpatch=require(_0xf238('0x2'));var rp=require(_0xf238('0x3'));var moment=require(_0xf238('0x4'));var BPromise=require(_0xf238('0x5'));var Mustache=require(_0xf238('0x6'));var util=require(_0xf238('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf238('0x8'));var ejs=require(_0xf238('0x9'));var fs=require('fs');var fs_extra=require(_0xf238('0xa'));var _=require('lodash');var squel=require(_0xf238('0xb'));var crypto=require(_0xf238('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf238('0xd'));var toCsv=require(_0xf238('0x8'));var querystring=require(_0xf238('0xe'));var Papa=require(_0xf238('0xf'));var Redis=require(_0xf238('0x10'));var authService=require(_0xf238('0x11'));var qs=require(_0xf238('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf238('0x13'));var logger=require(_0xf238('0x14'))(_0xf238('0x15'));var utils=require(_0xf238('0x16'));var config=require(_0xf238('0x17'));var licenseUtil=require(_0xf238('0x18'));var db=require(_0xf238('0x19'))['db'];function respondWithStatusCode(_0x3c1586,_0x1d978d){_0x1d978d=_0x1d978d||0xcc;return function(_0x536c1b){if(_0x536c1b){return _0x3c1586[_0xf238('0x1a')](_0x1d978d);}return _0x3c1586[_0xf238('0x1b')](_0x1d978d)[_0xf238('0x1c')]();};}function respondWithResult(_0x10ba35,_0x327fdb){_0x327fdb=_0x327fdb||0xc8;return function(_0x56f88b){if(_0x56f88b){return _0x10ba35[_0xf238('0x1b')](_0x327fdb)[_0xf238('0x1d')](_0x56f88b);}};}function respondWithFilteredResult(_0x6dd3f0,_0x12958c){return function(_0x29fc25){if(_0x29fc25){var _0x2bb083=typeof _0x12958c[_0xf238('0x1e')]===_0xf238('0x1f')&&typeof _0x12958c[_0xf238('0x20')]===_0xf238('0x1f');var _0xbf49bf=_0x29fc25[_0xf238('0x21')];var _0x4a6a70=_0x2bb083?0x0:_0x12958c['offset'];var _0x79ec0f=_0x2bb083?_0x29fc25[_0xf238('0x21')]:_0x12958c[_0xf238('0x1e')]+_0x12958c[_0xf238('0x20')];var _0x103778;if(_0x79ec0f>=_0xbf49bf){_0x79ec0f=_0xbf49bf;_0x103778=0xc8;}else{_0x103778=0xce;}_0x6dd3f0[_0xf238('0x1b')](_0x103778);return _0x6dd3f0[_0xf238('0x22')](_0xf238('0x23'),_0x4a6a70+'-'+_0x79ec0f+'/'+_0xbf49bf)['json'](_0x29fc25);}return null;};}function patchUpdates(_0x15ddd5){return function(_0x1d343d){try{jsonpatch['apply'](_0x1d343d,_0x15ddd5,!![]);}catch(_0x589ac4){return BPromise['reject'](_0x589ac4);}return _0x1d343d['save']();};}function saveUpdates(_0x3a90cb,_0x31b95a){return function(_0x1401cf){if(_0x1401cf){return _0x1401cf[_0xf238('0x24')](_0x3a90cb)[_0xf238('0x25')](function(_0x5c44c8){return _0x5c44c8;});}return null;};}function removeEntity(_0x511d43,_0x4b433a){return function(_0x4a2841){if(_0x4a2841){return _0x4a2841[_0xf238('0x26')]()[_0xf238('0x25')](function(){var _0x176095=_0x4a2841[_0xf238('0x27')]({'plain':!![]});var _0xfa3d2b='Variables';return db[_0xf238('0x28')][_0xf238('0x26')]({'where':{'type':_0xfa3d2b,'resourceId':_0x176095['id']}})[_0xf238('0x25')](function(){return _0x4a2841;});})['then'](function(){_0x511d43[_0xf238('0x1b')](0xcc)[_0xf238('0x1c')]();});}};}function handleEntityNotFound(_0x696482,_0x4d072e){return function(_0x2f7ceb){if(!_0x2f7ceb){_0x696482[_0xf238('0x1a')](0x194);}return _0x2f7ceb;};}function handleError(_0x2cc138,_0x3b033a){_0x3b033a=_0x3b033a||0x1f4;return function(_0x2907b9){logger[_0xf238('0x29')](_0x2907b9[_0xf238('0x2a')]);if(_0x2907b9['name']){delete _0x2907b9[_0xf238('0x2b')];}_0x2cc138[_0xf238('0x1b')](_0x3b033a)[_0xf238('0x2c')](_0x2907b9);};}exports[_0xf238('0x2d')]=function(_0x4102e1,_0x1035ce){var _0x48a052={},_0x11e282={},_0x5b0f39={'count':0x0,'rows':[]};var _0x187115=_['map'](db[_0xf238('0x2e')][_0xf238('0x2f')],function(_0x22375d){return{'name':_0x22375d[_0xf238('0x30')],'type':_0x22375d[_0xf238('0x31')][_0xf238('0x32')]};});_0x11e282['model']=_['map'](_0x187115,_0xf238('0x2b'));_0x11e282[_0xf238('0x33')]=_[_0xf238('0x34')](_0x4102e1[_0xf238('0x33')]);_0x11e282[_0xf238('0x35')]=_[_0xf238('0x36')](_0x11e282[_0xf238('0x37')],_0x11e282[_0xf238('0x33')]);_0x48a052[_0xf238('0x38')]=_[_0xf238('0x36')](_0x11e282[_0xf238('0x37')],qs[_0xf238('0x39')](_0x4102e1['query']['fields']));_0x48a052[_0xf238('0x38')]=_0x48a052['attributes']['length']?_0x48a052[_0xf238('0x38')]:_0x11e282[_0xf238('0x37')];if(!_0x4102e1[_0xf238('0x33')][_0xf238('0x3a')](_0xf238('0x3b'))){_0x48a052[_0xf238('0x20')]=qs[_0xf238('0x20')](_0x4102e1[_0xf238('0x33')][_0xf238('0x20')]);_0x48a052[_0xf238('0x1e')]=qs[_0xf238('0x1e')](_0x4102e1['query'][_0xf238('0x1e')]);}_0x48a052[_0xf238('0x3c')]=qs[_0xf238('0x3d')](_0x4102e1['query']['sort']);_0x48a052[_0xf238('0x3e')]=qs[_0xf238('0x35')](_[_0xf238('0x3f')](_0x4102e1[_0xf238('0x33')],_0x11e282[_0xf238('0x35')]),_0x187115);if(_0x4102e1[_0xf238('0x33')][_0xf238('0x40')]){_0x48a052[_0xf238('0x3e')]=_[_0xf238('0x41')](_0x48a052[_0xf238('0x3e')],{'$or':_[_0xf238('0x42')](_0x187115,function(_0x1ebbac){if(_0x1ebbac[_0xf238('0x31')]!=='VIRTUAL'){var _0x5909e9={};_0x5909e9[_0x1ebbac[_0xf238('0x2b')]]={'$like':'%'+_0x4102e1[_0xf238('0x33')][_0xf238('0x40')]+'%'};return _0x5909e9;}})});}_0x48a052=_[_0xf238('0x41')]({},_0x48a052,_0x4102e1[_0xf238('0x43')]);var _0x3f8f06={'where':_0x48a052[_0xf238('0x3e')]};return db['Variable']['count'](_0x3f8f06)[_0xf238('0x25')](function(_0x3b4cde){_0x5b0f39[_0xf238('0x21')]=_0x3b4cde;if(_0x4102e1[_0xf238('0x33')][_0xf238('0x44')]){_0x48a052[_0xf238('0x45')]=[{'all':!![]}];}return db[_0xf238('0x2e')][_0xf238('0x46')](_0x48a052);})['then'](function(_0xd80374){_0x5b0f39[_0xf238('0x47')]=_0xd80374;return _0x5b0f39;})[_0xf238('0x25')](respondWithFilteredResult(_0x1035ce,_0x48a052))['catch'](handleError(_0x1035ce,null));};exports[_0xf238('0x48')]=function(_0x22e1b8,_0x1e092c){var _0x2104f6={'raw':!![],'where':{'id':_0x22e1b8[_0xf238('0x49')]['id']}},_0x2c40b1={};_0x2c40b1[_0xf238('0x37')]=_[_0xf238('0x34')](db['Variable'][_0xf238('0x2f')]);_0x2c40b1[_0xf238('0x33')]=_['keys'](_0x22e1b8['query']);_0x2c40b1[_0xf238('0x35')]=_['intersection'](_0x2c40b1[_0xf238('0x37')],_0x2c40b1['query']);_0x2104f6[_0xf238('0x38')]=_[_0xf238('0x36')](_0x2c40b1['model'],qs['fields'](_0x22e1b8[_0xf238('0x33')][_0xf238('0x39')]));_0x2104f6[_0xf238('0x38')]=_0x2104f6[_0xf238('0x38')][_0xf238('0x4a')]?_0x2104f6[_0xf238('0x38')]:_0x2c40b1[_0xf238('0x37')];if(_0x22e1b8[_0xf238('0x33')][_0xf238('0x44')]){_0x2104f6[_0xf238('0x45')]=[{'all':!![]}];}_0x2104f6=_[_0xf238('0x41')]({},_0x2104f6,_0x22e1b8['options']);return db['Variable'][_0xf238('0x4b')](_0x2104f6)[_0xf238('0x25')](handleEntityNotFound(_0x1e092c,null))[_0xf238('0x25')](respondWithResult(_0x1e092c,null))[_0xf238('0x4c')](handleError(_0x1e092c,null));};exports[_0xf238('0x4d')]=function(_0x3b8223,_0x137bbe){return db[_0xf238('0x2e')][_0xf238('0x4d')](_0x3b8223[_0xf238('0x4e')],{})['then'](function(_0x1dfa60){var _0x87ac72=_0x3b8223[_0xf238('0x4f')][_0xf238('0x27')]({'plain':!![]});if(!_0x87ac72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x87ac72[_0xf238('0x50')]===_0xf238('0x4f')){var _0x9970c3=_0x1dfa60[_0xf238('0x27')]({'plain':!![]});var _0x12c063=_0xf238('0x51');return db['UserProfileSection'][_0xf238('0x4b')]({'where':{'name':_0x12c063,'userProfileId':_0x87ac72[_0xf238('0x52')]},'raw':!![]})[_0xf238('0x25')](function(_0x204632){if(_0x204632&&_0x204632[_0xf238('0x53')]===0x0){return db[_0xf238('0x28')][_0xf238('0x4d')]({'name':_0x9970c3[_0xf238('0x2b')],'resourceId':_0x9970c3['id'],'type':_0x204632[_0xf238('0x2b')],'sectionId':_0x204632['id']},{})['then'](function(){return _0x1dfa60;});}else{return _0x1dfa60;}})['catch'](function(_0xd771e2){logger[_0xf238('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd771e2);throw _0xd771e2;});}return _0x1dfa60;})[_0xf238('0x25')](respondWithResult(_0x137bbe,0xc9))['catch'](handleError(_0x137bbe,null));};exports[_0xf238('0x24')]=function(_0x4dcd12,_0x4e2685){if(_0x4dcd12[_0xf238('0x4e')]['id']){delete _0x4dcd12[_0xf238('0x4e')]['id'];}return db[_0xf238('0x2e')][_0xf238('0x4b')]({'where':{'id':_0x4dcd12[_0xf238('0x49')]['id']}})[_0xf238('0x25')](handleEntityNotFound(_0x4e2685,null))['then'](saveUpdates(_0x4dcd12[_0xf238('0x4e')],null))[_0xf238('0x25')](respondWithResult(_0x4e2685,null))[_0xf238('0x4c')](handleError(_0x4e2685,null));};exports['destroy']=function(_0x49a898,_0x1bdce3){return db[_0xf238('0x2e')][_0xf238('0x4b')]({'where':{'id':_0x49a898[_0xf238('0x49')]['id']}})['then'](handleEntityNotFound(_0x1bdce3,null))[_0xf238('0x25')](removeEntity(_0x1bdce3,null))['catch'](handleError(_0x1bdce3,null));}; \ No newline at end of file +var _0xb3f1=['fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','rawAttributes','intersection','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','name','send','index','map','Variable'];(function(_0x5151ef,_0x16f9ab){var _0x80d83b=function(_0x350038){while(--_0x350038){_0x5151ef['push'](_0x5151ef['shift']());}};_0x80d83b(++_0x16f9ab);}(_0xb3f1,0x125));var _0x1b3f=function(_0x2a4e66,_0x3dfad3){_0x2a4e66=_0x2a4e66-0x0;var _0xe6444d=_0xb3f1[_0x2a4e66];return _0xe6444d;};'use strict';var emlformat=require(_0x1b3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b3f('0x1'));var jsonpatch=require(_0x1b3f('0x2'));var rp=require('request-promise');var moment=require(_0x1b3f('0x3'));var BPromise=require(_0x1b3f('0x4'));var Mustache=require(_0x1b3f('0x5'));var util=require(_0x1b3f('0x6'));var path=require(_0x1b3f('0x7'));var sox=require(_0x1b3f('0x8'));var csv=require(_0x1b3f('0x9'));var ejs=require(_0x1b3f('0xa'));var fs=require('fs');var fs_extra=require(_0x1b3f('0xb'));var _=require(_0x1b3f('0xc'));var squel=require(_0x1b3f('0xd'));var crypto=require(_0x1b3f('0xe'));var jsforce=require(_0x1b3f('0xf'));var deskjs=require(_0x1b3f('0x10'));var toCsv=require(_0x1b3f('0x9'));var querystring=require(_0x1b3f('0x11'));var Papa=require(_0x1b3f('0x12'));var Redis=require(_0x1b3f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1b3f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b3f('0x15'));var logger=require(_0x1b3f('0x16'))(_0x1b3f('0x17'));var utils=require('../../config/utils');var config=require(_0x1b3f('0x18'));var licenseUtil=require(_0x1b3f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c0238,_0x408e02){_0x408e02=_0x408e02||0xcc;return function(_0x24ad24){if(_0x24ad24){return _0x1c0238[_0x1b3f('0x1a')](_0x408e02);}return _0x1c0238[_0x1b3f('0x1b')](_0x408e02)[_0x1b3f('0x1c')]();};}function respondWithResult(_0x301012,_0x46eb99){_0x46eb99=_0x46eb99||0xc8;return function(_0x234f1e){if(_0x234f1e){return _0x301012[_0x1b3f('0x1b')](_0x46eb99)[_0x1b3f('0x1d')](_0x234f1e);}};}function respondWithFilteredResult(_0x3b9a30,_0x3c91cc){return function(_0x511f14){if(_0x511f14){var _0x1c8e50=typeof _0x3c91cc[_0x1b3f('0x1e')]===_0x1b3f('0x1f')&&typeof _0x3c91cc[_0x1b3f('0x20')]===_0x1b3f('0x1f');var _0xf53832=_0x511f14['count'];var _0x3274a6=_0x1c8e50?0x0:_0x3c91cc[_0x1b3f('0x1e')];var _0x179916=_0x1c8e50?_0x511f14[_0x1b3f('0x21')]:_0x3c91cc[_0x1b3f('0x1e')]+_0x3c91cc['limit'];var _0xe35fcd;if(_0x179916>=_0xf53832){_0x179916=_0xf53832;_0xe35fcd=0xc8;}else{_0xe35fcd=0xce;}_0x3b9a30['status'](_0xe35fcd);return _0x3b9a30[_0x1b3f('0x22')](_0x1b3f('0x23'),_0x3274a6+'-'+_0x179916+'/'+_0xf53832)[_0x1b3f('0x1d')](_0x511f14);}return null;};}function patchUpdates(_0x30a2e8){return function(_0x10337c){try{jsonpatch[_0x1b3f('0x24')](_0x10337c,_0x30a2e8,!![]);}catch(_0x50508d){return BPromise[_0x1b3f('0x25')](_0x50508d);}return _0x10337c[_0x1b3f('0x26')]();};}function saveUpdates(_0x40c245,_0x2adec3){return function(_0x5cbebd){if(_0x5cbebd){return _0x5cbebd[_0x1b3f('0x27')](_0x40c245)[_0x1b3f('0x28')](function(_0x4b3389){return _0x4b3389;});}return null;};}function removeEntity(_0xdb66a1,_0x1a02c0){return function(_0x1b987f){if(_0x1b987f){return _0x1b987f[_0x1b3f('0x29')]()[_0x1b3f('0x28')](function(){var _0x499004=_0x1b987f[_0x1b3f('0x2a')]({'plain':!![]});var _0x52983c=_0x1b3f('0x2b');return db[_0x1b3f('0x2c')][_0x1b3f('0x29')]({'where':{'type':_0x52983c,'resourceId':_0x499004['id']}})[_0x1b3f('0x28')](function(){return _0x1b987f;});})['then'](function(){_0xdb66a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf8767,_0x32532d){return function(_0x25f19d){if(!_0x25f19d){_0xbf8767[_0x1b3f('0x1a')](0x194);}return _0x25f19d;};}function handleError(_0x2d9e25,_0xb6a16){_0xb6a16=_0xb6a16||0x1f4;return function(_0x253f29){logger[_0x1b3f('0x2d')](_0x253f29['stack']);if(_0x253f29[_0x1b3f('0x2e')]){delete _0x253f29[_0x1b3f('0x2e')];}_0x2d9e25[_0x1b3f('0x1b')](_0xb6a16)[_0x1b3f('0x2f')](_0x253f29);};}exports[_0x1b3f('0x30')]=function(_0x3cd04c,_0x4ed54b){var _0x3bf494={},_0x1b74ca={},_0x38331e={'count':0x0,'rows':[]};var _0x4504e9=_[_0x1b3f('0x31')](db[_0x1b3f('0x32')]['rawAttributes'],function(_0x139475){return{'name':_0x139475[_0x1b3f('0x33')],'type':_0x139475[_0x1b3f('0x34')]['key']};});_0x1b74ca[_0x1b3f('0x35')]=_[_0x1b3f('0x31')](_0x4504e9,_0x1b3f('0x2e'));_0x1b74ca[_0x1b3f('0x36')]=_['keys'](_0x3cd04c[_0x1b3f('0x36')]);_0x1b74ca[_0x1b3f('0x37')]=_['intersection'](_0x1b74ca[_0x1b3f('0x35')],_0x1b74ca[_0x1b3f('0x36')]);_0x3bf494[_0x1b3f('0x38')]=_['intersection'](_0x1b74ca[_0x1b3f('0x35')],qs[_0x1b3f('0x39')](_0x3cd04c[_0x1b3f('0x36')][_0x1b3f('0x39')]));_0x3bf494['attributes']=_0x3bf494[_0x1b3f('0x38')][_0x1b3f('0x3a')]?_0x3bf494[_0x1b3f('0x38')]:_0x1b74ca[_0x1b3f('0x35')];if(!_0x3cd04c[_0x1b3f('0x36')][_0x1b3f('0x3b')](_0x1b3f('0x3c'))){_0x3bf494[_0x1b3f('0x20')]=qs[_0x1b3f('0x20')](_0x3cd04c[_0x1b3f('0x36')][_0x1b3f('0x20')]);_0x3bf494[_0x1b3f('0x1e')]=qs[_0x1b3f('0x1e')](_0x3cd04c[_0x1b3f('0x36')]['offset']);}_0x3bf494['order']=qs['sort'](_0x3cd04c['query'][_0x1b3f('0x3d')]);_0x3bf494['where']=qs[_0x1b3f('0x37')](_['pick'](_0x3cd04c['query'],_0x1b74ca[_0x1b3f('0x37')]),_0x4504e9);if(_0x3cd04c[_0x1b3f('0x36')]['filter']){_0x3bf494[_0x1b3f('0x3e')]=_[_0x1b3f('0x3f')](_0x3bf494[_0x1b3f('0x3e')],{'$or':_[_0x1b3f('0x31')](_0x4504e9,function(_0x38c779){if(_0x38c779[_0x1b3f('0x34')]!==_0x1b3f('0x40')){var _0x182562={};_0x182562[_0x38c779[_0x1b3f('0x2e')]]={'$like':'%'+_0x3cd04c[_0x1b3f('0x36')][_0x1b3f('0x41')]+'%'};return _0x182562;}})});}_0x3bf494=_['merge']({},_0x3bf494,_0x3cd04c[_0x1b3f('0x42')]);var _0x2cb17e={'where':_0x3bf494['where']};return db['Variable'][_0x1b3f('0x21')](_0x2cb17e)[_0x1b3f('0x28')](function(_0x20a5a2){_0x38331e[_0x1b3f('0x21')]=_0x20a5a2;if(_0x3cd04c[_0x1b3f('0x36')]['includeAll']){_0x3bf494[_0x1b3f('0x43')]=[{'all':!![]}];}return db['Variable'][_0x1b3f('0x44')](_0x3bf494);})['then'](function(_0x1d3705){_0x38331e[_0x1b3f('0x45')]=_0x1d3705;return _0x38331e;})[_0x1b3f('0x28')](respondWithFilteredResult(_0x4ed54b,_0x3bf494))[_0x1b3f('0x46')](handleError(_0x4ed54b,null));};exports[_0x1b3f('0x47')]=function(_0x5ed82a,_0x1ffc68){var _0x59e45a={'raw':!![],'where':{'id':_0x5ed82a['params']['id']}},_0x1dac03={};_0x1dac03[_0x1b3f('0x35')]=_[_0x1b3f('0x48')](db['Variable'][_0x1b3f('0x49')]);_0x1dac03[_0x1b3f('0x36')]=_['keys'](_0x5ed82a[_0x1b3f('0x36')]);_0x1dac03[_0x1b3f('0x37')]=_[_0x1b3f('0x4a')](_0x1dac03['model'],_0x1dac03[_0x1b3f('0x36')]);_0x59e45a[_0x1b3f('0x38')]=_[_0x1b3f('0x4a')](_0x1dac03[_0x1b3f('0x35')],qs[_0x1b3f('0x39')](_0x5ed82a[_0x1b3f('0x36')][_0x1b3f('0x39')]));_0x59e45a[_0x1b3f('0x38')]=_0x59e45a[_0x1b3f('0x38')]['length']?_0x59e45a[_0x1b3f('0x38')]:_0x1dac03[_0x1b3f('0x35')];if(_0x5ed82a[_0x1b3f('0x36')][_0x1b3f('0x4b')]){_0x59e45a[_0x1b3f('0x43')]=[{'all':!![]}];}_0x59e45a=_[_0x1b3f('0x3f')]({},_0x59e45a,_0x5ed82a[_0x1b3f('0x42')]);return db[_0x1b3f('0x32')]['find'](_0x59e45a)[_0x1b3f('0x28')](handleEntityNotFound(_0x1ffc68,null))[_0x1b3f('0x28')](respondWithResult(_0x1ffc68,null))[_0x1b3f('0x46')](handleError(_0x1ffc68,null));};exports[_0x1b3f('0x4c')]=function(_0x4ed208,_0x529f80){return db[_0x1b3f('0x32')][_0x1b3f('0x4c')](_0x4ed208['body'],{})[_0x1b3f('0x28')](function(_0x41e0c4){var _0x100a8c=_0x4ed208[_0x1b3f('0x4d')]['get']({'plain':!![]});if(!_0x100a8c)throw new Error(_0x1b3f('0x4e'));if(_0x100a8c[_0x1b3f('0x4f')]===_0x1b3f('0x4d')){var _0x1740cc=_0x41e0c4[_0x1b3f('0x2a')]({'plain':!![]});var _0x56b723='Variables';return db['UserProfileSection'][_0x1b3f('0x50')]({'where':{'name':_0x56b723,'userProfileId':_0x100a8c[_0x1b3f('0x51')]},'raw':!![]})['then'](function(_0x139460){if(_0x139460&&_0x139460[_0x1b3f('0x52')]===0x0){return db[_0x1b3f('0x2c')]['create']({'name':_0x1740cc[_0x1b3f('0x2e')],'resourceId':_0x1740cc['id'],'type':_0x139460['name'],'sectionId':_0x139460['id']},{})[_0x1b3f('0x28')](function(){return _0x41e0c4;});}else{return _0x41e0c4;}})[_0x1b3f('0x46')](function(_0xe9d2a9){logger[_0x1b3f('0x2d')](_0x1b3f('0x53'),_0xe9d2a9);throw _0xe9d2a9;});}return _0x41e0c4;})[_0x1b3f('0x28')](respondWithResult(_0x529f80,0xc9))[_0x1b3f('0x46')](handleError(_0x529f80,null));};exports['update']=function(_0x1034cd,_0x2d9ac0){if(_0x1034cd[_0x1b3f('0x54')]['id']){delete _0x1034cd[_0x1b3f('0x54')]['id'];}return db[_0x1b3f('0x32')][_0x1b3f('0x50')]({'where':{'id':_0x1034cd[_0x1b3f('0x55')]['id']}})[_0x1b3f('0x28')](handleEntityNotFound(_0x2d9ac0,null))[_0x1b3f('0x28')](saveUpdates(_0x1034cd[_0x1b3f('0x54')],null))[_0x1b3f('0x28')](respondWithResult(_0x2d9ac0,null))[_0x1b3f('0x46')](handleError(_0x2d9ac0,null));};exports[_0x1b3f('0x29')]=function(_0x34ed6f,_0x3cc6ec){return db[_0x1b3f('0x32')][_0x1b3f('0x50')]({'where':{'id':_0x34ed6f[_0x1b3f('0x55')]['id']}})[_0x1b3f('0x28')](handleEntityNotFound(_0x3cc6ec,null))[_0x1b3f('0x28')](removeEntity(_0x3cc6ec,null))['catch'](handleError(_0x3cc6ec,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 874f4df..389feb0 100644 --- a/server/api/variable/variable.model.js +++ b/server/api/variable/variable.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9e9=['../../config/logger','api','moment','bluebird','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','util'];(function(_0x1425db,_0x1b4287){var _0x95fbbf=function(_0x41159d){while(--_0x41159d){_0x1425db['push'](_0x1425db['shift']());}};_0x95fbbf(++_0x1b4287);}(_0xf9e9,0x11f));var _0x9f9e=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xf9e9[_0x4bdf64];return _0x9a1a19;};'use strict';var _=require('lodash');var util=require(_0x9f9e('0x0'));var logger=require(_0x9f9e('0x1'))(_0x9f9e('0x2'));var moment=require(_0x9f9e('0x3'));var BPromise=require(_0x9f9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f9e('0x5'));var rimraf=require(_0x9f9e('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f9e('0x7'));module[_0x9f9e('0x8')]=function(_0x3141a3,_0x5698f6){return _0x3141a3[_0x9f9e('0x9')](_0x9f9e('0xa'),attributes,{'tableName':_0x9f9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf33d=['rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x587b29,_0x5dba1f){var _0x409281=function(_0x30f810){while(--_0x30f810){_0x587b29['push'](_0x587b29['shift']());}};_0x409281(++_0x5dba1f);}(_0xf33d,0x12c));var _0xdf33=function(_0x3b6cc7,_0x5df0c1){_0x3b6cc7=_0x3b6cc7-0x0;var _0x37f564=_0xf33d[_0x3b6cc7];return _0x37f564;};'use strict';var _=require(_0xdf33('0x0'));var util=require(_0xdf33('0x1'));var logger=require(_0xdf33('0x2'))(_0xdf33('0x3'));var moment=require(_0xdf33('0x4'));var BPromise=require(_0xdf33('0x5'));var rp=require(_0xdf33('0x6'));var fs=require('fs');var path=require(_0xdf33('0x7'));var rimraf=require(_0xdf33('0x8'));var config=require(_0xdf33('0x9'));var attributes=require('./variable.attributes');module[_0xdf33('0xa')]=function(_0x129f35,_0x36446d){return _0x129f35[_0xdf33('0xb')](_0xdf33('0xc'),attributes,{'tableName':_0xdf33('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index dd04a47..5de5579 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x58d6e2,_0x454b59){var _0xb98e3=function(_0x4651d2){while(--_0x4651d2){_0x58d6e2['push'](_0x58d6e2['shift']());}};_0xb98e3(++_0x454b59);}(_0x6aa7,0x178));var _0x76aa=function(_0xc67d5d,_0x2c3960){_0xc67d5d=_0xc67d5d-0x0;var _0x2d1cda=_0x6aa7[_0xc67d5d];return _0x2d1cda;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x516225,_0x3a5f9c){var _0x36e8ce=function(_0x1e70a8){while(--_0x1e70a8){_0x516225['push'](_0x516225['shift']());}};_0x36e8ce(++_0x3a5f9c);}(_0x7217,0x19e));var _0x7721=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x7217[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e6bea1e..4286dba 100644 --- a/server/api/version/index.js +++ b/server/api/version/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50a8=['reset','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x50a8,0x1a5));var _0x850a=function(_0x345e4c,_0x3e73ba){_0x345e4c=_0x345e4c-0x0;var _0x40c41c=_0x50a8[_0x345e4c];return _0x40c41c;};'use strict';var express=require(_0x850a('0x0'));var router=express[_0x850a('0x1')]();var auth=require(_0x850a('0x2'));var controller=require(_0x850a('0x3'));router[_0x850a('0x4')]('/',controller[_0x850a('0x5')]);router[_0x850a('0x4')](_0x850a('0x6'),auth[_0x850a('0x7')](),auth[_0x850a('0x8')](),controller[_0x850a('0x9')]);router['get'](_0x850a('0xa'),auth[_0x850a('0x7')](),auth[_0x850a('0x8')](),controller[_0x850a('0xb')]);router[_0x850a('0x4')]('/pull',auth[_0x850a('0x7')](),auth['canUpdate'](),controller['pull']);router[_0x850a('0x4')](_0x850a('0xc'),auth[_0x850a('0x7')](),controller[_0x850a('0xd')]);router[_0x850a('0x4')]('/migrations',controller[_0x850a('0xe')]);module[_0x850a('0xf')]=router; \ No newline at end of file +var _0xdbf3=['../../components/auth/service','get','index','/fetch','isAuthenticated','fetch','canUpdate','reset','/pull','pull','restart','/migrations','migrations','exports','express','Router'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0xdbf3,0x8e));var _0x3dbf=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xdbf3[_0x1477ef];return _0x164acd;};'use strict';var express=require(_0x3dbf('0x0'));var router=express[_0x3dbf('0x1')]();var auth=require(_0x3dbf('0x2'));var controller=require('./version.controller');router[_0x3dbf('0x3')]('/',controller[_0x3dbf('0x4')]);router[_0x3dbf('0x3')](_0x3dbf('0x5'),auth[_0x3dbf('0x6')](),auth['canUpdate'](),controller[_0x3dbf('0x7')]);router['get']('/reset',auth[_0x3dbf('0x6')](),auth[_0x3dbf('0x8')](),controller[_0x3dbf('0x9')]);router['get'](_0x3dbf('0xa'),auth[_0x3dbf('0x6')](),auth[_0x3dbf('0x8')](),controller[_0x3dbf('0xb')]);router[_0x3dbf('0x3')]('/restart',auth[_0x3dbf('0x6')](),controller[_0x3dbf('0xc')]);router[_0x3dbf('0x3')](_0x3dbf('0xd'),controller[_0x3dbf('0xe')]);module[_0x3dbf('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 41616ea..7f0c78b 100644 --- a/server/api/version/version.controller.js +++ b/server/api/version/version.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0179=['exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0x0179,0x1cf));var _0x9017=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x0179[_0x4b2863];return _0x567d67;};'use strict';var Umzug=require(_0x9017('0x0'));var path=require(_0x9017('0x1'));var fs=require('fs');var _=require(_0x9017('0x2'));var pkginfo=require(_0x9017('0x3'))(module,_0x9017('0x4'));var compareVersions=require(_0x9017('0x5'));var exec=require('child_process')[_0x9017('0x6')];var db=require(_0x9017('0x7'))['db'];var config=require(_0x9017('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x9017('0x9'))(_0x9017('0xa'));var git=require(_0x9017('0xb'))(config[_0x9017('0xc')]);exports[_0x9017('0xd')]=function(_0x3387ee,_0x417986){var _0x2d612d={'current':module[_0x9017('0xe')][_0x9017('0x4')],'phonebar':0x2};if(_0x3387ee[_0x9017('0xf')]&&_0x3387ee[_0x9017('0xf')][_0x9017('0x10')]){return git[_0x9017('0x11')]()[_0x9017('0x12')](function(_0x244ae7,_0x55ebcc){_0x2d612d[_0x9017('0x10')]=(_0x244ae7?module[_0x9017('0xe')]['version']:_0x55ebcc['latest'])||_0x9017('0x13');return _0x417986[_0x9017('0x14')](0xc8)[_0x9017('0x15')](_0x2d612d);});}else{return _0x417986[_0x9017('0x14')](0xc8)[_0x9017('0x15')](_0x2d612d);}};exports[_0x9017('0x11')]=function(_0x2cb496,_0x46d6bb){return git[_0x9017('0x11')]([_0x9017('0x16'),'master'],function(_0x40150b){if(_0x40150b){logger[_0x9017('0x17')](_0x40150b);return _0x46d6bb[_0x9017('0x14')](0x1f4)['json'](_0x40150b);}logger['info'](_0x9017('0x18'));return _0x46d6bb[_0x9017('0x14')](0xc8)[_0x9017('0x15')]({'output':_0x9017('0x19')});});};exports[_0x9017('0x1a')]=function(_0xfc26a4,_0x7b9a27){return git['reset']([_0x9017('0x1b'),'FETCH_HEAD'],function(_0x37380d){if(_0x37380d){logger[_0x9017('0x17')](_0x37380d);return _0x7b9a27[_0x9017('0x14')](0x1f4)[_0x9017('0x15')](_0x37380d);}logger[_0x9017('0x1c')](_0x9017('0x1d'));return _0x7b9a27[_0x9017('0x14')](0xc8)['json']({'output':_0x9017('0x1e')});});};exports[_0x9017('0x1f')]=function(_0x4a6c4e,_0x23fc71){exec(_0x9017('0x20'),function(_0x21dd0a,_0x1045aa,_0x47c254){logger[_0x9017('0x1c')](_0x1045aa);logger[_0x9017('0x1c')](_0x47c254);if(_0x21dd0a){logger[_0x9017('0x17')](_0x21dd0a);return _0x23fc71[_0x9017('0x14')](0x1f4)['json'](_0x21dd0a);}return _0x23fc71['status'](0xc8)[_0x9017('0x15')]({'output':_0x1045aa});});};exports['restart']=function(_0x4bb096,_0x110df3){return pm2['restart'](_0x9017('0x21'))[_0x9017('0x22')](function(_0x294099){logger[_0x9017('0x1c')]('pm2\x20restart\x20motion\x20%s',_0x294099);return _0x110df3[_0x9017('0x14')](0xc8)[_0x9017('0x15')]({'output':_0x9017('0x23')});})[_0x9017('0x24')](function(_0x56da76){logger[_0x9017('0x17')](_0x56da76);return _0x110df3[_0x9017('0x14')](0x1f4)[_0x9017('0x15')](_0x56da76);});};exports[_0x9017('0x25')]=function(_0xaf4f55,_0x57db24){var _0x2214e9=fs['readdirSync'](path[_0x9017('0x26')](config[_0x9017('0xc')],_0x9017('0x27'),_0x9017('0x25')));var _0x84a0ec=[];for(var _0x2d6c46=0x0;_0x2d6c46<_0x2214e9['length'];_0x2d6c46++){var _0x585d32=_0x2214e9[_0x2d6c46][_0x9017('0x28')](_0x9017('0x29'),'');if(compareVersions(module['exports'][_0x9017('0x4')],_0x585d32)===-0x1){_0x84a0ec['push'](_0x585d32);}}if(_0x84a0ec['length']){var _0x124a66=_0x84a0ec[_0x9017('0x2a')](compareVersions);var _0x393420=new Umzug({'storage':_0x9017('0x2b'),'storageOptions':{'model':db[_0x9017('0x2c')],'modelName':_0x9017('0x2c'),'columnName':_0x9017('0x4')},'migrations':{'params':[db['sequelize'][_0x9017('0x2d')](),db['sequelize'][_0x9017('0x2e')],function(){throw new Error(_0x9017('0x2f'));}],'path':path[_0x9017('0x26')](config[_0x9017('0xc')],_0x9017('0x27'),'migrations'),'pattern':/\.js$/}});_0x393420['up']({'migrations':_['map'](_0x124a66,function(_0x7660e4){return _0x7660e4+_0x9017('0x29');})})['then'](function(){return _0x57db24[_0x9017('0x14')](0xc8)[_0x9017('0x15')]({'output':_0x9017('0x30')+module[_0x9017('0xe')]['version']+_0x9017('0x31')+_[_0x9017('0x32')](_0x124a66),'migrations':_['join'](_0x124a66)});})[_0x9017('0x24')](function(_0xa35340){if(_0xa35340 instanceof db[_0x9017('0x2b')][_0x9017('0x33')]){return _0x57db24[_0x9017('0x14')](0xc8)['json']({'output':_0x9017('0x34')});}else{return _0x57db24[_0x9017('0x14')](0x1f4)[_0x9017('0x15')](_0xa35340);}});}else{return _0x57db24[_0x9017('0x14')](0xc8)[_0x9017('0x15')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xb1c7=['index','exports','query','fetch','tags','latest','2.0.0','json','status','origin','master','error','info','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','exec','../../mysqldb','update','simple-git','root'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb1c7,0x1d4));var _0x7b1c=function(_0x2af009,_0x5432ee){_0x2af009=_0x2af009-0x0;var _0x46d15f=_0xb1c7[_0x2af009];return _0x46d15f;};'use strict';var Umzug=require(_0x7b1c('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x7b1c('0x1'))(module,_0x7b1c('0x2'));var compareVersions=require(_0x7b1c('0x3'));var exec=require('child_process')[_0x7b1c('0x4')];var db=require(_0x7b1c('0x5'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x7b1c('0x6'));var git=require(_0x7b1c('0x7'))(config[_0x7b1c('0x8')]);exports[_0x7b1c('0x9')]=function(_0x34e0bc,_0x1f9b0e){var _0x46b80b={'current':module[_0x7b1c('0xa')][_0x7b1c('0x2')],'phonebar':0x2};if(_0x34e0bc['query']&&_0x34e0bc[_0x7b1c('0xb')]['latest']){return git[_0x7b1c('0xc')]()[_0x7b1c('0xd')](function(_0x11f7e8,_0xb958c7){_0x46b80b[_0x7b1c('0xe')]=(_0x11f7e8?module[_0x7b1c('0xa')][_0x7b1c('0x2')]:_0xb958c7['latest'])||_0x7b1c('0xf');return _0x1f9b0e['status'](0xc8)[_0x7b1c('0x10')](_0x46b80b);});}else{return _0x1f9b0e[_0x7b1c('0x11')](0xc8)['json'](_0x46b80b);}};exports[_0x7b1c('0xc')]=function(_0x32cef6,_0xac778e){return git['fetch']([_0x7b1c('0x12'),_0x7b1c('0x13')],function(_0x50fb2a){if(_0x50fb2a){logger[_0x7b1c('0x14')](_0x50fb2a);return _0xac778e[_0x7b1c('0x11')](0x1f4)[_0x7b1c('0x10')](_0x50fb2a);}logger[_0x7b1c('0x15')]('git\x20fetch');return _0xac778e['status'](0xc8)[_0x7b1c('0x10')]({'output':_0x7b1c('0x16')});});};exports['reset']=function(_0x3445c8,_0x100154){return git['reset']([_0x7b1c('0x17'),_0x7b1c('0x18')],function(_0x34d82c){if(_0x34d82c){logger['error'](_0x34d82c);return _0x100154[_0x7b1c('0x11')](0x1f4)['json'](_0x34d82c);}logger['info'](_0x7b1c('0x19'));return _0x100154['status'](0xc8)[_0x7b1c('0x10')]({'output':_0x7b1c('0x1a')});});};exports[_0x7b1c('0x1b')]=function(_0x4d7a37,_0x462769){exec(_0x7b1c('0x1c'),function(_0x54d456,_0x3120d9,_0x45b9aa){logger['info'](_0x3120d9);logger[_0x7b1c('0x15')](_0x45b9aa);if(_0x54d456){logger[_0x7b1c('0x14')](_0x54d456);return _0x462769[_0x7b1c('0x11')](0x1f4)['json'](_0x54d456);}return _0x462769[_0x7b1c('0x11')](0xc8)[_0x7b1c('0x10')]({'output':_0x3120d9});});};exports[_0x7b1c('0x1d')]=function(_0x121f3b,_0x34f756){return pm2[_0x7b1c('0x1d')](_0x7b1c('0x1e'))[_0x7b1c('0x1f')](function(_0x1e4c09){logger['info'](_0x7b1c('0x20'),_0x1e4c09);return _0x34f756['status'](0xc8)['json']({'output':_0x7b1c('0x21')});})[_0x7b1c('0x22')](function(_0x248ead){logger[_0x7b1c('0x14')](_0x248ead);return _0x34f756[_0x7b1c('0x11')](0x1f4)[_0x7b1c('0x10')](_0x248ead);});};exports[_0x7b1c('0x23')]=function(_0x14b10b,_0x5da31f){var _0x6efd11=fs['readdirSync'](path[_0x7b1c('0x24')](config['root'],_0x7b1c('0x25'),_0x7b1c('0x23')));var _0x44ec2b=[];for(var _0x51df38=0x0;_0x51df38<_0x6efd11[_0x7b1c('0x26')];_0x51df38++){var _0x3f463e=_0x6efd11[_0x51df38][_0x7b1c('0x27')](_0x7b1c('0x28'),'');if(compareVersions(module[_0x7b1c('0xa')][_0x7b1c('0x2')],_0x3f463e)===-0x1){_0x44ec2b[_0x7b1c('0x29')](_0x3f463e);}}if(_0x44ec2b['length']){var _0x56637b=_0x44ec2b[_0x7b1c('0x2a')](compareVersions);var _0x6cf930=new Umzug({'storage':_0x7b1c('0x2b'),'storageOptions':{'model':db[_0x7b1c('0x2c')],'modelName':_0x7b1c('0x2c'),'columnName':_0x7b1c('0x2')},'migrations':{'params':[db['sequelize'][_0x7b1c('0x2d')](),db[_0x7b1c('0x2b')][_0x7b1c('0x2e')],function(){throw new Error(_0x7b1c('0x2f'));}],'path':path[_0x7b1c('0x24')](config[_0x7b1c('0x8')],'server','migrations'),'pattern':/\.js$/}});_0x6cf930['up']({'migrations':_['map'](_0x56637b,function(_0x4eb750){return _0x4eb750+_0x7b1c('0x28');})})[_0x7b1c('0x1f')](function(){return _0x5da31f['status'](0xc8)[_0x7b1c('0x10')]({'output':_0x7b1c('0x30')+module[_0x7b1c('0xa')][_0x7b1c('0x2')]+_0x7b1c('0x31')+_[_0x7b1c('0x32')](_0x56637b),'migrations':_[_0x7b1c('0x24')](_0x56637b)});})['catch'](function(_0x4ede01){if(_0x4ede01 instanceof db[_0x7b1c('0x2b')][_0x7b1c('0x33')]){return _0x5da31f[_0x7b1c('0x11')](0xc8)[_0x7b1c('0x10')]({'output':_0x7b1c('0x34')});}else{return _0x5da31f[_0x7b1c('0x11')](0x1f4)[_0x7b1c('0x10')](_0x4ede01);}});}else{return _0x5da31f['status'](0xc8)[_0x7b1c('0x10')]({'output':_0x7b1c('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f249ff5..98febfe 100644 --- a/server/api/voiceAgentReport/index.js +++ b/server/api/voiceAgentReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x751b=['create','/:id','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','describe','show','post'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x751b,0xe1));var _0xb751=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x751b[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xb751('0x0'));var path=require(_0xb751('0x1'));var timeout=require(_0xb751('0x2'));var express=require(_0xb751('0x3'));var router=express['Router']();var fs_extra=require(_0xb751('0x4'));var auth=require(_0xb751('0x5'));var interaction=require(_0xb751('0x6'));var config=require(_0xb751('0x7'));var controller=require(_0xb751('0x8'));router['get']('/',auth[_0xb751('0x9')](),controller[_0xb751('0xa')]);router[_0xb751('0xb')]('/describe',auth[_0xb751('0x9')](),controller[_0xb751('0xc')]);router['get']('/:id',auth[_0xb751('0x9')](),controller[_0xb751('0xd')]);router[_0xb751('0xe')]('/',auth[_0xb751('0x9')](),controller[_0xb751('0xf')]);router['put'](_0xb751('0x10'),auth['isAuthenticated'](),controller[_0xb751('0x11')]);router['delete'](_0xb751('0x10'),auth['isAuthenticated'](),controller[_0xb751('0x12')]);module[_0xb751('0x13')]=router; \ No newline at end of file +var _0x7909=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put'];(function(_0x1aa864,_0xc3fb36){var _0x2f01d5=function(_0x1115db){while(--_0x1115db){_0x1aa864['push'](_0x1aa864['shift']());}};_0x2f01d5(++_0xc3fb36);}(_0x7909,0xbf));var _0x9790=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7909[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x9790('0x0'));var util=require(_0x9790('0x1'));var path=require('path');var timeout=require(_0x9790('0x2'));var express=require(_0x9790('0x3'));var router=express[_0x9790('0x4')]();var fs_extra=require(_0x9790('0x5'));var auth=require(_0x9790('0x6'));var interaction=require(_0x9790('0x7'));var config=require(_0x9790('0x8'));var controller=require(_0x9790('0x9'));router['get']('/',auth[_0x9790('0xa')](),controller[_0x9790('0xb')]);router[_0x9790('0xc')](_0x9790('0xd'),auth[_0x9790('0xa')](),controller['describe']);router[_0x9790('0xc')](_0x9790('0xe'),auth['isAuthenticated'](),controller[_0x9790('0xf')]);router[_0x9790('0x10')]('/',auth[_0x9790('0xa')](),controller[_0x9790('0x11')]);router[_0x9790('0x12')](_0x9790('0xe'),auth[_0x9790('0xa')](),controller['update']);router['delete'](_0x9790('0xe'),auth[_0x9790('0xa')](),controller[_0x9790('0x13')]);module[_0x9790('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7e3f223..b26392d 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cc3=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1cc3,0x11b));var _0x31cc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1cc3[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x31cc('0x0'));module[_0x31cc('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x31cc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x31cc('0x2')]},'queue':{'type':Sequelize[_0x31cc('0x2')]},'interface':{'type':Sequelize[_0x31cc('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x31cc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x31cc('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x31cc('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x31cc('0x3')]},'holdtime':{'type':Sequelize[_0x31cc('0x4')]},'agentcomplete':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x31cc('0x4')]},'agentacw':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x31cc('0x4')]},'reason':{'type':Sequelize[_0x31cc('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x31cc('0x2')]},'channelstate':{'type':Sequelize[_0x31cc('0x4')]},'channelstatedesc':{'type':Sequelize[_0x31cc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x31cc('0x2')]},'connectedlinename':{'type':Sequelize[_0x31cc('0x2')]},'language':{'type':Sequelize[_0x31cc('0x2')]},'accountcode':{'type':Sequelize[_0x31cc('0x2')]},'context':{'type':Sequelize[_0x31cc('0x2')]},'exten':{'type':Sequelize[_0x31cc('0x2')]},'priority':{'type':Sequelize[_0x31cc('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x31cc('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x31cc('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x31cc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x31cc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x31cc('0x2')]},'destlanguage':{'type':Sequelize[_0x31cc('0x2')]},'destaccountcode':{'type':Sequelize[_0x31cc('0x2')]},'destcontext':{'type':Sequelize[_0x31cc('0x2')]},'destexten':{'type':Sequelize[_0x31cc('0x2')]},'destpriority':{'type':Sequelize[_0x31cc('0x2')]},'destuniqueid':{'type':Sequelize[_0x31cc('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x31cc('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x31cc('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x31cc('0x2')],'comment':_0x31cc('0x6')},'transferexten':{'type':Sequelize[_0x31cc('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x31cc('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x676c=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xd39ea2,_0x1ed23a){var _0x350a25=function(_0x3719cb){while(--_0x3719cb){_0xd39ea2['push'](_0xd39ea2['shift']());}};_0x350a25(++_0x1ed23a);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc676('0x0'));module[_0xc676('0x1')]={'type':{'type':Sequelize[_0xc676('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc676('0x2')]},'calleridname':{'type':Sequelize[_0xc676('0x2')]},'queue':{'type':Sequelize[_0xc676('0x2')]},'interface':{'type':Sequelize[_0xc676('0x2')]},'membername':{'type':Sequelize[_0xc676('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc676('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xc676('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xc676('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc676('0x3')]},'holdtime':{'type':Sequelize[_0xc676('0x4')]},'agentcomplete':{'type':Sequelize[_0xc676('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc676('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc676('0x4')]},'reason':{'type':Sequelize[_0xc676('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc676('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc676('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc676('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc676('0x2')]},'context':{'type':Sequelize[_0xc676('0x2')]},'exten':{'type':Sequelize[_0xc676('0x2')]},'priority':{'type':Sequelize[_0xc676('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc676('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc676('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc676('0x2')]},'destcalleridname':{'type':Sequelize[_0xc676('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc676('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc676('0x2')]},'destlanguage':{'type':Sequelize[_0xc676('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc676('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc676('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc676('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc676('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc676('0x2')]},'agententerreason':{'type':Sequelize[_0xc676('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index e3d5d18..4a0da42 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index d88ba6c..e289d3c 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c7b=['api','moment','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x231a9a,_0x37d527){_0x231a9a=_0x231a9a-0x0;var _0x2c7924=_0x3c7b[_0x231a9a];return _0x2c7924;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var logger=require(_0xb3c7('0x2'))(_0xb3c7('0x3'));var moment=require(_0xb3c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3c7('0x5'));var attributes=require(_0xb3c7('0x6'));module['exports']=function(_0x396a46,_0x5b810b){return _0x396a46[_0xb3c7('0x7')](_0xb3c7('0x8'),attributes,{'tableName':_0xb3c7('0x9'),'paranoid':![],'indexes':[{'fields':[_0xb3c7('0xa'),_0xb3c7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x919e=['VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x5d82cc,_0xcfdeec){var _0x410661=function(_0x21df9d){while(--_0x21df9d){_0x5d82cc['push'](_0x5d82cc['shift']());}};_0x410661(++_0xcfdeec);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var logger=require(_0xe919('0x2'))('api');var moment=require(_0xe919('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe919('0x4'));var rimraf=require(_0xe919('0x5'));var config=require(_0xe919('0x6'));var attributes=require(_0xe919('0x7'));module[_0xe919('0x8')]=function(_0x5a27ad,_0x1225a5){return _0x5a27ad['define'](_0xe919('0x9'),attributes,{'tableName':_0xe919('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xe919('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 2802318..57f75cb 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.rpc.js +++ b/server/api/voiceAgentReport/voiceAgentReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa69f=['CreateVoiceAgentReport','VoiceAgentReport','create','body','options','update','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4b8848,_0x2a0f69){var _0x5da23f=function(_0x3d2bfc){while(--_0x3d2bfc){_0x4b8848['push'](_0x4b8848['shift']());}};_0x5da23f(++_0x2a0f69);}(_0xa69f,0xb5));var _0xfa69=function(_0x44df79,_0x8de244){_0x44df79=_0x44df79-0x0;var _0x34db6f=_0xa69f[_0x44df79];return _0x34db6f;};'use strict';var _=require(_0xfa69('0x0'));var util=require('util');var moment=require(_0xfa69('0x1'));var BPromise=require(_0xfa69('0x2'));var rs=require(_0xfa69('0x3'));var fs=require('fs');var Redis=require(_0xfa69('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfa69('0x5'))(_0xfa69('0x6'));var config=require(_0xfa69('0x7'));var jayson=require(_0xfa69('0x8'));var client=jayson['client'][_0xfa69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x341e58,_0x66de46,_0x1041bb){return new BPromise(function(_0x2d0f3e,_0x7cce6f){return client[_0xfa69('0xa')](_0x341e58,_0x1041bb)[_0xfa69('0xb')](function(_0x464b36){logger[_0xfa69('0xc')](_0xfa69('0xd'),_0x66de46,'request\x20sent');logger[_0xfa69('0xe')](_0xfa69('0xf'),_0x66de46,_0xfa69('0x10'),JSON[_0xfa69('0x11')](_0x464b36));if(_0x464b36[_0xfa69('0x12')]){if(_0x464b36[_0xfa69('0x12')][_0xfa69('0x13')]===0x1f4){logger[_0xfa69('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x66de46,_0x464b36['error']['message']);return _0x7cce6f(_0x464b36[_0xfa69('0x12')]['message']);}logger[_0xfa69('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x66de46,_0x464b36['error'][_0xfa69('0x14')]);return _0x2d0f3e(_0x464b36[_0xfa69('0x12')][_0xfa69('0x14')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x66de46,'request\x20sent');_0x2d0f3e(_0x464b36[_0xfa69('0x15')]['message']);}})[_0xfa69('0x16')](function(_0x18b12d){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x66de46,_0x18b12d);_0x7cce6f(_0x18b12d);});});}exports[_0xfa69('0x17')]=function(_0x11ace7){var _0x5504d9=this;return new Promise(function(_0x49c566,_0x15dd5d){return db[_0xfa69('0x18')][_0xfa69('0x19')](_0x11ace7[_0xfa69('0x1a')],{'raw':_0x11ace7[_0xfa69('0x1b')]?_0x11ace7[_0xfa69('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xfa69('0xb')](function(_0x4438d2){logger[_0xfa69('0xc')]('CreateVoiceAgentReport',_0x11ace7);logger[_0xfa69('0xe')](_0xfa69('0x17'),_0x11ace7,JSON[_0xfa69('0x11')](_0x4438d2));_0x49c566(_0x4438d2);})[_0xfa69('0x16')](function(_0x462b3c){logger[_0xfa69('0x12')](_0xfa69('0x17'),_0x462b3c[_0xfa69('0x14')],_0x11ace7);_0x15dd5d(_0x5504d9[_0xfa69('0x12')](0x1f4,_0x462b3c['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x36a1ef){var _0x3b1b8e=this;return new Promise(function(_0xb52c3e,_0x3f32dc){return db[_0xfa69('0x18')][_0xfa69('0x1c')](_0x36a1ef[_0xfa69('0x1a')],{'raw':_0x36a1ef[_0xfa69('0x1b')]?_0x36a1ef[_0xfa69('0x1b')][_0xfa69('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a1ef['options']?_0x36a1ef[_0xfa69('0x1b')][_0xfa69('0x1e')]||null:null,'attributes':_0x36a1ef[_0xfa69('0x1b')]?_0x36a1ef['options'][_0xfa69('0x1f')]||null:null,'limit':_0x36a1ef['options']?_0x36a1ef['options'][_0xfa69('0x20')]||null:null})[_0xfa69('0xb')](function(_0x1f7131){logger[_0xfa69('0xc')](_0xfa69('0x21'),_0x36a1ef);logger[_0xfa69('0xe')](_0xfa69('0x21'),_0x36a1ef,JSON[_0xfa69('0x11')](_0x1f7131));_0xb52c3e(_0x1f7131);})[_0xfa69('0x16')](function(_0x364049){logger[_0xfa69('0x12')](_0xfa69('0x21'),_0x364049[_0xfa69('0x14')],_0x36a1ef);_0x3f32dc(_0x3b1b8e[_0xfa69('0x12')](0x1f4,_0x364049[_0xfa69('0x14')]));});});}; \ No newline at end of file +var _0x04cf=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','VoiceAgentReport','body','options','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','update','attributes','limit','info','moment'];(function(_0x4f582a,_0x22834c){var _0x5cc3d7=function(_0x2034d){while(--_0x2034d){_0x4f582a['push'](_0x4f582a['shift']());}};_0x5cc3d7(++_0x22834c);}(_0x04cf,0x1db));var _0xf04c=function(_0x33bcca,_0xaa0775){_0x33bcca=_0x33bcca-0x0;var _0x13907e=_0x04cf[_0x33bcca];return _0x13907e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf04c('0x0'));var BPromise=require(_0xf04c('0x1'));var rs=require(_0xf04c('0x2'));var fs=require('fs');var Redis=require(_0xf04c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf04c('0x4'));var logger=require(_0xf04c('0x5'))(_0xf04c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf04c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x164336,_0x5e3fa5,_0x5e4368){return new BPromise(function(_0xfb0ecc,_0x5a3551){return client['request'](_0x164336,_0x5e4368)[_0xf04c('0x8')](function(_0x18e75c){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x5e3fa5,_0xf04c('0x9'));logger[_0xf04c('0xa')](_0xf04c('0xb'),_0x5e3fa5,_0xf04c('0x9'),JSON[_0xf04c('0xc')](_0x18e75c));if(_0x18e75c['error']){if(_0x18e75c[_0xf04c('0xd')][_0xf04c('0xe')]===0x1f4){logger[_0xf04c('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x5e3fa5,_0x18e75c[_0xf04c('0xd')][_0xf04c('0xf')]);return _0x5a3551(_0x18e75c[_0xf04c('0xd')][_0xf04c('0xf')]);}logger[_0xf04c('0xd')](_0xf04c('0x10'),_0x5e3fa5,_0x18e75c[_0xf04c('0xd')][_0xf04c('0xf')]);return _0xfb0ecc(_0x18e75c[_0xf04c('0xd')]['message']);}else{logger['info'](_0xf04c('0x10'),_0x5e3fa5,'request\x20sent');_0xfb0ecc(_0x18e75c[_0xf04c('0x11')][_0xf04c('0xf')]);}})['catch'](function(_0x5b51bf){logger['error'](_0xf04c('0x10'),_0x5e3fa5,_0x5b51bf);_0x5a3551(_0x5b51bf);});});}exports['CreateVoiceAgentReport']=function(_0x25f184){var _0x3f6922=this;return new Promise(function(_0x43b494,_0x3dcd74){return db[_0xf04c('0x12')]['create'](_0x25f184[_0xf04c('0x13')],{'raw':_0x25f184['options']?_0x25f184[_0xf04c('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xf04c('0x8')](function(_0x2e40ab){logger['info'](_0xf04c('0x15'),_0x25f184);logger[_0xf04c('0xa')]('CreateVoiceAgentReport',_0x25f184,JSON[_0xf04c('0xc')](_0x2e40ab));_0x43b494(_0x2e40ab);})[_0xf04c('0x16')](function(_0xc6c340){logger['error']('CreateVoiceAgentReport',_0xc6c340[_0xf04c('0xf')],_0x25f184);_0x3dcd74(_0x3f6922['error'](0x1f4,_0xc6c340['message']));});});};exports[_0xf04c('0x17')]=function(_0xa3927c){var _0x276e28=this;return new Promise(function(_0x11807a,_0x583946){return db[_0xf04c('0x12')][_0xf04c('0x18')](_0xa3927c[_0xf04c('0x13')],{'raw':_0xa3927c[_0xf04c('0x14')]?_0xa3927c[_0xf04c('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa3927c[_0xf04c('0x14')]?_0xa3927c[_0xf04c('0x14')]['where']||null:null,'attributes':_0xa3927c[_0xf04c('0x14')]?_0xa3927c['options'][_0xf04c('0x19')]||null:null,'limit':_0xa3927c[_0xf04c('0x14')]?_0xa3927c[_0xf04c('0x14')][_0xf04c('0x1a')]||null:null})['then'](function(_0x1bf9a8){logger[_0xf04c('0x1b')](_0xf04c('0x17'),_0xa3927c);logger[_0xf04c('0xa')](_0xf04c('0x17'),_0xa3927c,JSON[_0xf04c('0xc')](_0x1bf9a8));_0x11807a(_0x1bf9a8);})[_0xf04c('0x16')](function(_0x2dc0e1){logger['error']('UpdateVoiceAgentReport',_0x2dc0e1['message'],_0xa3927c);_0x583946(_0x276e28[_0xf04c('0xd')](0x1f4,_0x2dc0e1[_0xf04c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c081395..2884b8d 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80d9=['get','/:id','show','post','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','isAuthenticated','describe'];(function(_0x9692b2,_0x1a70a9){var _0x420d29=function(_0xaf6548){while(--_0xaf6548){_0x9692b2['push'](_0x9692b2['shift']());}};_0x420d29(++_0x1a70a9);}(_0x80d9,0x15c));var _0x980d=function(_0x33d35a,_0x631337){_0x33d35a=_0x33d35a-0x0;var _0xa865f2=_0x80d9[_0x33d35a];return _0xa865f2;};'use strict';var multer=require(_0x980d('0x0'));var util=require('util');var path=require(_0x980d('0x1'));var timeout=require(_0x980d('0x2'));var express=require(_0x980d('0x3'));var router=express['Router']();var fs_extra=require(_0x980d('0x4'));var auth=require(_0x980d('0x5'));var interaction=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var controller=require(_0x980d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x980d('0x9')]);router['get']('/describe',auth[_0x980d('0xa')](),controller[_0x980d('0xb')]);router[_0x980d('0xc')](_0x980d('0xd'),auth[_0x980d('0xa')](),controller[_0x980d('0xe')]);router[_0x980d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x980d('0xd'),auth[_0x980d('0xa')](),controller['update']);router[_0x980d('0x10')]('/:id',auth[_0x980d('0xa')](),controller['destroy']);module[_0x980d('0x11')]=router; \ No newline at end of file +var _0xdc97=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0x140a03,_0x5cf435){var _0x4aa378=function(_0x885aa3){while(--_0x885aa3){_0x140a03['push'](_0x140a03['shift']());}};_0x4aa378(++_0x5cf435);}(_0xdc97,0x13b));var _0x7dc9=function(_0x588e8a,_0x2adc1a){_0x588e8a=_0x588e8a-0x0;var _0x4905c2=_0xdc97[_0x588e8a];return _0x4905c2;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0xe')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 35132bb..6673420 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa062=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','internal','outbound','inbound-fax'];(function(_0x15ac2b,_0x3f1b43){var _0x2276e5=function(_0x467bf6){while(--_0x467bf6){_0x15ac2b['push'](_0x15ac2b['shift']());}};_0x2276e5(++_0x3f1b43);}(_0xa062,0x101));var _0x2a06=function(_0x313903,_0x338dc6){_0x313903=_0x313903-0x0;var _0x4c6d4b=_0xa062[_0x313903];return _0x4c6d4b;};'use strict';var Sequelize=require(_0x2a06('0x0'));module[_0x2a06('0x1')]={'uniqueid':{'type':Sequelize[_0x2a06('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2a06('0x3'),_0x2a06('0x4'),_0x2a06('0x5'),_0x2a06('0x6'),'outbound-fax',_0x2a06('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x2a06('0x2')]},'destination':{'type':Sequelize[_0x2a06('0x2')]},'destinationcontext':{'type':Sequelize[_0x2a06('0x2')]},'callerid':{'type':Sequelize[_0x2a06('0x2')]},'channel':{'type':Sequelize[_0x2a06('0x2')]},'destinationchannel':{'type':Sequelize[_0x2a06('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x2a06('0x8')]},'starttime':{'type':Sequelize[_0x2a06('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x2a06('0x9')]},'endtime':{'type':Sequelize[_0x2a06('0x9')]},'duration':{'type':Sequelize[_0x2a06('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2a06('0x2')]},'userDisposition':{'type':Sequelize[_0x2a06('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2a06('0x2')]},'note':{'type':Sequelize[_0x2a06('0x2')]},'prefix':{'type':Sequelize[_0x2a06('0x2')]},'routeid':{'type':Sequelize[_0x2a06('0xa')]},'sipcallid':{'type':Sequelize[_0x2a06('0x2')]}}; \ No newline at end of file +var _0xc664=['inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','internal','outbound'];(function(_0x49b6f5,_0x3fb5eb){var _0x33aaf1=function(_0xb6f555){while(--_0xb6f555){_0x49b6f5['push'](_0x49b6f5['shift']());}};_0x33aaf1(++_0x3fb5eb);}(_0xc664,0x127));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4c66('0x0'));module[_0x4c66('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4c66('0x2')]('inbound',_0x4c66('0x3'),_0x4c66('0x4'),_0x4c66('0x5'),_0x4c66('0x6'),_0x4c66('0x7'))},'tag':{'type':Sequelize[_0x4c66('0x8')]},'accountcode':{'type':Sequelize[_0x4c66('0x8')]},'source':{'type':Sequelize[_0x4c66('0x8')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x4c66('0x8')]},'callerid':{'type':Sequelize[_0x4c66('0x8')]},'channel':{'type':Sequelize[_0x4c66('0x8')]},'destinationchannel':{'type':Sequelize[_0x4c66('0x8')]},'lastapplication':{'type':Sequelize[_0x4c66('0x8')]},'lastdata':{'type':Sequelize[_0x4c66('0x9')]},'starttime':{'type':Sequelize[_0x4c66('0xa')]},'systemanswertime':{'type':Sequelize[_0x4c66('0xa')]},'answertime':{'type':Sequelize[_0x4c66('0xa')]},'endtime':{'type':Sequelize[_0x4c66('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4c66('0xb')]},'mohtime':{'type':Sequelize[_0x4c66('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4c66('0x8')]},'amaflags':{'type':Sequelize[_0x4c66('0x8')]},'userfield':{'type':Sequelize[_0x4c66('0x8')]},'userDisposition':{'type':Sequelize[_0x4c66('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x4c66('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x4c66('0x8')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x4c66('0xb')]},'sipcallid':{'type':Sequelize[_0x4c66('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3fec4f9..93adf3f 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x2f398b,_0x443c95){var _0x4adadd=function(_0xdb58d){while(--_0xdb58d){_0x2f398b['push'](_0x2f398b['shift']());}};_0x4adadd(++_0x443c95);}(_0x0b0e,0x187));var _0xe0b0=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0x0b0e[_0x277721];return _0x286051;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0xadb5,0xad));var _0x5adb=function(_0x3532e0,_0x183733){_0x3532e0=_0x3532e0-0x0;var _0x2bbad2=_0xadb5[_0x3532e0];return _0x2bbad2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 47a08de..44b4d85 100644 --- a/server/api/voiceCallReport/voiceCallReport.model.js +++ b/server/api/voiceCallReport/voiceCallReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8508=['path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5e7799,_0x442fea){var _0x557fdd=function(_0x502fa1){while(--_0x502fa1){_0x5e7799['push'](_0x5e7799['shift']());}};_0x557fdd(++_0x442fea);}(_0x8508,0x166));var _0x8850=function(_0x5c402a,_0x1f1dfb){_0x5c402a=_0x5c402a-0x0;var _0xad1dff=_0x8508[_0x5c402a];return _0xad1dff;};'use strict';var _=require(_0x8850('0x0'));var util=require(_0x8850('0x1'));var logger=require(_0x8850('0x2'))(_0x8850('0x3'));var moment=require(_0x8850('0x4'));var BPromise=require('bluebird');var rp=require(_0x8850('0x5'));var fs=require('fs');var path=require(_0x8850('0x6'));var rimraf=require(_0x8850('0x7'));var config=require(_0x8850('0x8'));var attributes=require(_0x8850('0x9'));module[_0x8850('0xa')]=function(_0x3bfad8,_0x57a13a){return _0x3bfad8[_0x8850('0xb')](_0x8850('0xc'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x8850('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f37=['lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','report_call'];(function(_0x1cf052,_0x119db2){var _0x3b445b=function(_0x948136){while(--_0x948136){_0x1cf052['push'](_0x1cf052['shift']());}};_0x3b445b(++_0x119db2);}(_0x8f37,0x190));var _0x78f3=function(_0x13909d,_0x3d0a97){_0x13909d=_0x13909d-0x0;var _0x553514=_0x8f37[_0x13909d];return _0x553514;};'use strict';var _=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var logger=require(_0x78f3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x78f3('0x3'));var rp=require(_0x78f3('0x4'));var fs=require('fs');var path=require(_0x78f3('0x5'));var rimraf=require('rimraf');var config=require(_0x78f3('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x78f3('0x7')]=function(_0x597b85,_0x11c6ad){return _0x597b85[_0x78f3('0x8')]('VoiceCallReport',attributes,{'tableName':_0x78f3('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b07ac98..0324b34 100644 --- a/server/api/voiceCallReport/voiceCallReport.rpc.js +++ b/server/api/voiceCallReport/voiceCallReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4854=['moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','map','attributes','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash'];(function(_0x3f83ab,_0x1207df){var _0x4ca136=function(_0xd3d3ce){while(--_0xd3d3ce){_0x3f83ab['push'](_0x3f83ab['shift']());}};_0x4ca136(++_0x1207df);}(_0x4854,0x167));var _0x4485=function(_0x568427,_0x742280){_0x568427=_0x568427-0x0;var _0x3c2f86=_0x4854[_0x568427];return _0x3c2f86;};'use strict';var _=require(_0x4485('0x0'));var util=require('util');var moment=require(_0x4485('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4485('0x2'))(_0x4485('0x3'));var config=require(_0x4485('0x4'));var jayson=require(_0x4485('0x5'));var client=jayson[_0x4485('0x6')][_0x4485('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51cb61,_0xcf5e89,_0x494c8a){return new BPromise(function(_0x5c534d,_0x4c4891){return client[_0x4485('0x8')](_0x51cb61,_0x494c8a)[_0x4485('0x9')](function(_0x2ba741){logger[_0x4485('0xa')](_0x4485('0xb'),_0xcf5e89,_0x4485('0xc'));logger[_0x4485('0xd')](_0x4485('0xe'),_0xcf5e89,_0x4485('0xc'),JSON[_0x4485('0xf')](_0x2ba741));if(_0x2ba741[_0x4485('0x10')]){if(_0x2ba741[_0x4485('0x10')][_0x4485('0x11')]===0x1f4){logger[_0x4485('0x10')](_0x4485('0xb'),_0xcf5e89,_0x2ba741['error']['message']);return _0x4c4891(_0x2ba741[_0x4485('0x10')][_0x4485('0x12')]);}logger[_0x4485('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0xcf5e89,_0x2ba741[_0x4485('0x10')][_0x4485('0x12')]);return _0x5c534d(_0x2ba741[_0x4485('0x10')][_0x4485('0x12')]);}else{logger[_0x4485('0xa')](_0x4485('0xb'),_0xcf5e89,_0x4485('0xc'));_0x5c534d(_0x2ba741[_0x4485('0x13')][_0x4485('0x12')]);}})[_0x4485('0x14')](function(_0x13909d){logger[_0x4485('0x10')](_0x4485('0xb'),_0xcf5e89,_0x13909d);_0x4c4891(_0x13909d);});});}exports[_0x4485('0x15')]=function(_0x328523){var _0x5e30d5=this;return new Promise(function(_0x5b8a40,_0x261d0c){return db[_0x4485('0x16')][_0x4485('0x17')]({'raw':_0x328523[_0x4485('0x18')]?_0x328523[_0x4485('0x18')][_0x4485('0x19')]===undefined?!![]:![]:!![],'where':_0x328523[_0x4485('0x18')]?_0x328523[_0x4485('0x18')][_0x4485('0x1a')]||null:null,'attributes':_0x328523[_0x4485('0x18')]?_0x328523[_0x4485('0x18')]['attributes']||null:null,'limit':_0x328523['options']?_0x328523[_0x4485('0x18')]['limit']||null:null,'include':_0x328523[_0x4485('0x18')]?_0x328523['options'][_0x4485('0x1b')]?_[_0x4485('0x1c')](_0x328523[_0x4485('0x18')][_0x4485('0x1b')],function(_0x1b8144){return{'model':db[_0x1b8144['model']],'as':_0x1b8144['as'],'attributes':_0x1b8144[_0x4485('0x1d')],'include':_0x1b8144[_0x4485('0x1b')]?_[_0x4485('0x1c')](_0x1b8144[_0x4485('0x1b')],function(_0xab9b6c){return{'model':db[_0xab9b6c[_0x4485('0x1e')]],'as':_0xab9b6c['as'],'attributes':_0xab9b6c[_0x4485('0x1d')],'include':_0xab9b6c[_0x4485('0x1b')]?_[_0x4485('0x1c')](_0xab9b6c['include'],function(_0x4d1a1b){return{'model':db[_0x4d1a1b[_0x4485('0x1e')]],'as':_0x4d1a1b['as'],'attributes':_0x4d1a1b[_0x4485('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x264c05){logger['info']('GetVoiceCallReport',_0x328523);logger[_0x4485('0xd')](_0x4485('0x15'),_0x328523,JSON[_0x4485('0xf')](_0x264c05));_0x5b8a40(_0x264c05);})[_0x4485('0x14')](function(_0x44c863){logger[_0x4485('0x10')](_0x4485('0x15'),_0x44c863[_0x4485('0x12')],_0x328523);_0x261d0c(_0x5e30d5[_0x4485('0x10')](0x1f4,_0x44c863[_0x4485('0x12')]));});});};exports[_0x4485('0x1f')]=function(_0x26435a){var _0xc6c55=this;return new Promise(function(_0x5edd43,_0x2ce674){return db[_0x4485('0x16')][_0x4485('0x20')](_0x26435a[_0x4485('0x21')],{'raw':_0x26435a[_0x4485('0x18')]?_0x26435a[_0x4485('0x18')][_0x4485('0x19')]===undefined?!![]:![]:!![]})[_0x4485('0x9')](function(_0x46d95c){logger[_0x4485('0xa')](_0x4485('0x1f'),_0x26435a);logger[_0x4485('0xd')](_0x4485('0x1f'),_0x26435a,JSON[_0x4485('0xf')](_0x46d95c));_0x5edd43(_0x46d95c);})[_0x4485('0x14')](function(_0x199203){logger['error'](_0x4485('0x1f'),_0x199203[_0x4485('0x12')],_0x26435a);_0x2ce674(_0xc6c55['error'](0x1f4,_0x199203[_0x4485('0x12')]));});});};exports[_0x4485('0x22')]=function(_0x48d58e){var _0x4a4428=this;return new Promise(function(_0x558233,_0x630738){return db[_0x4485('0x16')][_0x4485('0x23')](_0x48d58e[_0x4485('0x21')],{'raw':_0x48d58e['options']?_0x48d58e['options'][_0x4485('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d58e[_0x4485('0x18')]?_0x48d58e['options'][_0x4485('0x1a')]||null:null,'attributes':_0x48d58e[_0x4485('0x18')]?_0x48d58e[_0x4485('0x18')][_0x4485('0x1d')]||null:null,'limit':_0x48d58e['options']?_0x48d58e[_0x4485('0x18')]['limit']||null:null})[_0x4485('0x9')](function(_0x57a9bf){logger[_0x4485('0xa')]('UpdateVoiceCallReport',_0x48d58e);logger[_0x4485('0xd')](_0x4485('0x22'),_0x48d58e,JSON[_0x4485('0xf')](_0x57a9bf));_0x558233(_0x57a9bf);})['catch'](function(_0x47a71f){logger[_0x4485('0x10')](_0x4485('0x22'),_0x47a71f[_0x4485('0x12')],_0x48d58e);_0x630738(_0x4a4428['error'](0x1f4,_0x47a71f[_0x4485('0x12')]));});});}; \ No newline at end of file +var _0x8e4f=['request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','raw','options','where','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1b43d3,_0xb9e41a){var _0x457e21=function(_0x1b344d){while(--_0x1b344d){_0x1b43d3['push'](_0x1b43d3['shift']());}};_0x457e21(++_0xb9e41a);}(_0x8e4f,0x160));var _0xf8e4=function(_0x1d1c7a,_0x2bd1e0){_0x1d1c7a=_0x1d1c7a-0x0;var _0x7bfb9=_0x8e4f[_0x1d1c7a];return _0x7bfb9;};'use strict';var _=require('lodash');var util=require(_0xf8e4('0x0'));var moment=require('moment');var BPromise=require(_0xf8e4('0x1'));var rs=require(_0xf8e4('0x2'));var fs=require('fs');var Redis=require(_0xf8e4('0x3'));var db=require(_0xf8e4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e4('0x5'))('rpc');var config=require(_0xf8e4('0x6'));var jayson=require(_0xf8e4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1cea6b,_0x4cce82,_0x1242ff){return new BPromise(function(_0x5274a2,_0x17afbd){return client[_0xf8e4('0x8')](_0x1cea6b,_0x1242ff)[_0xf8e4('0x9')](function(_0x382274){logger[_0xf8e4('0xa')](_0xf8e4('0xb'),_0x4cce82,_0xf8e4('0xc'));logger[_0xf8e4('0xd')](_0xf8e4('0xe'),_0x4cce82,_0xf8e4('0xc'),JSON[_0xf8e4('0xf')](_0x382274));if(_0x382274[_0xf8e4('0x10')]){if(_0x382274['error'][_0xf8e4('0x11')]===0x1f4){logger[_0xf8e4('0x10')](_0xf8e4('0xb'),_0x4cce82,_0x382274[_0xf8e4('0x10')][_0xf8e4('0x12')]);return _0x17afbd(_0x382274[_0xf8e4('0x10')][_0xf8e4('0x12')]);}logger[_0xf8e4('0x10')](_0xf8e4('0xb'),_0x4cce82,_0x382274['error'][_0xf8e4('0x12')]);return _0x5274a2(_0x382274['error'][_0xf8e4('0x12')]);}else{logger[_0xf8e4('0xa')](_0xf8e4('0xb'),_0x4cce82,_0xf8e4('0xc'));_0x5274a2(_0x382274[_0xf8e4('0x13')][_0xf8e4('0x12')]);}})[_0xf8e4('0x14')](function(_0x2a4c78){logger[_0xf8e4('0x10')](_0xf8e4('0xb'),_0x4cce82,_0x2a4c78);_0x17afbd(_0x2a4c78);});});}exports[_0xf8e4('0x15')]=function(_0x3bafb3){var _0x13568d=this;return new Promise(function(_0x43bc5c,_0x2184ab){return db[_0xf8e4('0x16')]['findAll']({'raw':_0x3bafb3['options']?_0x3bafb3['options'][_0xf8e4('0x17')]===undefined?!![]:![]:!![],'where':_0x3bafb3['options']?_0x3bafb3[_0xf8e4('0x18')][_0xf8e4('0x19')]||null:null,'attributes':_0x3bafb3[_0xf8e4('0x18')]?_0x3bafb3['options'][_0xf8e4('0x1a')]||null:null,'limit':_0x3bafb3[_0xf8e4('0x18')]?_0x3bafb3[_0xf8e4('0x18')][_0xf8e4('0x1b')]||null:null,'include':_0x3bafb3['options']?_0x3bafb3[_0xf8e4('0x18')][_0xf8e4('0x1c')]?_[_0xf8e4('0x1d')](_0x3bafb3[_0xf8e4('0x18')]['include'],function(_0x2785c0){return{'model':db[_0x2785c0[_0xf8e4('0x1e')]],'as':_0x2785c0['as'],'attributes':_0x2785c0[_0xf8e4('0x1a')],'include':_0x2785c0['include']?_['map'](_0x2785c0[_0xf8e4('0x1c')],function(_0x32ef19){return{'model':db[_0x32ef19['model']],'as':_0x32ef19['as'],'attributes':_0x32ef19[_0xf8e4('0x1a')],'include':_0x32ef19[_0xf8e4('0x1c')]?_['map'](_0x32ef19[_0xf8e4('0x1c')],function(_0xb27b9e){return{'model':db[_0xb27b9e[_0xf8e4('0x1e')]],'as':_0xb27b9e['as'],'attributes':_0xb27b9e[_0xf8e4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf8e4('0x9')](function(_0x2d9bcd){logger['info'](_0xf8e4('0x15'),_0x3bafb3);logger[_0xf8e4('0xd')]('GetVoiceCallReport',_0x3bafb3,JSON[_0xf8e4('0xf')](_0x2d9bcd));_0x43bc5c(_0x2d9bcd);})[_0xf8e4('0x14')](function(_0x3faf98){logger[_0xf8e4('0x10')](_0xf8e4('0x15'),_0x3faf98[_0xf8e4('0x12')],_0x3bafb3);_0x2184ab(_0x13568d[_0xf8e4('0x10')](0x1f4,_0x3faf98['message']));});});};exports['CreateVoiceCallReport']=function(_0x2adf90){var _0x42dd91=this;return new Promise(function(_0x37bb73,_0x200473){return db[_0xf8e4('0x16')][_0xf8e4('0x1f')](_0x2adf90[_0xf8e4('0x20')],{'raw':_0x2adf90[_0xf8e4('0x18')]?_0x2adf90[_0xf8e4('0x18')][_0xf8e4('0x17')]===undefined?!![]:![]:!![]})[_0xf8e4('0x9')](function(_0x5f4b7){logger[_0xf8e4('0xa')](_0xf8e4('0x21'),_0x2adf90);logger[_0xf8e4('0xd')]('CreateVoiceCallReport',_0x2adf90,JSON[_0xf8e4('0xf')](_0x5f4b7));_0x37bb73(_0x5f4b7);})[_0xf8e4('0x14')](function(_0x3bf31e){logger['error'](_0xf8e4('0x21'),_0x3bf31e[_0xf8e4('0x12')],_0x2adf90);_0x200473(_0x42dd91['error'](0x1f4,_0x3bf31e[_0xf8e4('0x12')]));});});};exports[_0xf8e4('0x22')]=function(_0x4a6842){var _0xcb901c=this;return new Promise(function(_0x1acc47,_0x539b6f){return db[_0xf8e4('0x16')][_0xf8e4('0x23')](_0x4a6842['body'],{'raw':_0x4a6842[_0xf8e4('0x18')]?_0x4a6842['options'][_0xf8e4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a6842['options']?_0x4a6842['options'][_0xf8e4('0x19')]||null:null,'attributes':_0x4a6842['options']?_0x4a6842['options'][_0xf8e4('0x1a')]||null:null,'limit':_0x4a6842[_0xf8e4('0x18')]?_0x4a6842['options'][_0xf8e4('0x1b')]||null:null})[_0xf8e4('0x9')](function(_0x57109d){logger['info'](_0xf8e4('0x22'),_0x4a6842);logger[_0xf8e4('0xd')](_0xf8e4('0x22'),_0x4a6842,JSON[_0xf8e4('0xf')](_0x57109d));_0x1acc47(_0x57109d);})[_0xf8e4('0x14')](function(_0x132870){logger[_0xf8e4('0x10')](_0xf8e4('0x22'),_0x132870['message'],_0x4a6842);_0x539b6f(_0xcb901c[_0xf8e4('0x10')](0x1f4,_0x132870[_0xf8e4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 88f38aa..78d4c8d 100644 --- a/server/api/voiceChanSpy/index.js +++ b/server/api/voiceChanSpy/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd636=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','create','delete'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xd636,0x74));var _0x6d63=function(_0x446d87,_0x49f577){_0x446d87=_0x446d87-0x0;var _0x1636fd=_0xd636[_0x446d87];return _0x1636fd;};'use strict';var multer=require(_0x6d63('0x0'));var util=require(_0x6d63('0x1'));var path=require(_0x6d63('0x2'));var timeout=require(_0x6d63('0x3'));var express=require(_0x6d63('0x4'));var router=express[_0x6d63('0x5')]();var fs_extra=require(_0x6d63('0x6'));var auth=require(_0x6d63('0x7'));var interaction=require(_0x6d63('0x8'));var config=require(_0x6d63('0x9'));var controller=require(_0x6d63('0xa'));router[_0x6d63('0xb')]('/',auth[_0x6d63('0xc')](),controller['index']);router[_0x6d63('0xb')](_0x6d63('0xd'),auth['isAuthenticated'](),controller[_0x6d63('0xe')]);router['post']('/',auth[_0x6d63('0xc')](),controller[_0x6d63('0xf')]);router['put'](_0x6d63('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6d63('0x10')](_0x6d63('0xd'),auth[_0x6d63('0xc')](),controller[_0x6d63('0x11')]);module[_0x6d63('0x12')]=router; \ No newline at end of file +var _0xde1e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var path=require(_0xede1('0x2'));var timeout=require(_0xede1('0x3'));var express=require(_0xede1('0x4'));var router=express[_0xede1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xede1('0x6'));var interaction=require(_0xede1('0x7'));var config=require(_0xede1('0x8'));var controller=require(_0xede1('0x9'));router[_0xede1('0xa')]('/',auth[_0xede1('0xb')](),controller['index']);router[_0xede1('0xa')](_0xede1('0xc'),auth[_0xede1('0xb')](),controller[_0xede1('0xd')]);router[_0xede1('0xe')]('/',auth[_0xede1('0xb')](),controller['create']);router[_0xede1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xede1('0x10')]);router[_0xede1('0x11')](_0xede1('0xc'),auth[_0xede1('0xb')](),controller[_0xede1('0x12')]);module[_0xede1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index fd95d33..e5779de 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.attributes.js +++ b/server/api/voiceChanSpy/voiceChanSpy.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc406=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join'];(function(_0x2179fd,_0x560761){var _0xacdfa=function(_0x3dd0c0){while(--_0x3dd0c0){_0x2179fd['push'](_0x2179fd['shift']());}};_0xacdfa(++_0x560761);}(_0xc406,0x85));var _0x6c40=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc406[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6c40('0x0'));module[_0x6c40('0x1')]={'name':{'type':Sequelize[_0x6c40('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x6c40('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1d626e){this[_0x6c40('0x4')](_0x6c40('0x5'),_0x1d626e?_0x1d626e[_0x6c40('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x6c40('0x5'))?this[_0x6c40('0x7')](_0x6c40('0x5'))[_0x6c40('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x6c40('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6c40('0x2')]},'description':{'type':Sequelize[_0x6c40('0x2')]}}; \ No newline at end of file +var _0x1419=['setDataValue','join','options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x337ab1,_0x5b8e8b){var _0x508f51=function(_0x1b273c){while(--_0x1b273c){_0x337ab1['push'](_0x337ab1['shift']());}};_0x508f51(++_0x5b8e8b);}(_0x1419,0xd8));var _0x9141=function(_0x5b6267,_0x3f1459){_0x5b6267=_0x5b6267-0x0;var _0x45d4e8=_0x1419[_0x5b6267];return _0x45d4e8;};'use strict';var Sequelize=require(_0x9141('0x0'));module[_0x9141('0x1')]={'name':{'type':Sequelize[_0x9141('0x2')]},'prefix':{'type':Sequelize[_0x9141('0x2')],'unique':_0x9141('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x9141('0x2')],'set':function(_0x435cbf){this[_0x9141('0x4')]('options',_0x435cbf?_0x435cbf[_0x9141('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x9141('0x6'))?this[_0x9141('0x7')](_0x9141('0x6'))[_0x9141('0x8')](''):[];}},'auth':{'type':Sequelize[_0x9141('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9141('0x2')]},'description':{'type':Sequelize[_0x9141('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index f37c55e..eab704e 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.controller.js +++ b/server/api/voiceChanSpy/voiceChanSpy.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad95=['VoiceChanSpy','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','show','params','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','body','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','end','stack','name','send','index'];(function(_0x4ef734,_0x5826d){var _0x33a7cb=function(_0x127a2b){while(--_0x127a2b){_0x4ef734['push'](_0x4ef734['shift']());}};_0x33a7cb(++_0x5826d);}(_0xad95,0x70));var _0x5ad9=function(_0x4638d0,_0x249103){_0x4638d0=_0x4638d0-0x0;var _0x6e53f9=_0xad95[_0x4638d0];return _0x6e53f9;};'use strict';var emlformat=require(_0x5ad9('0x0'));var rimraf=require(_0x5ad9('0x1'));var zipdir=require(_0x5ad9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ad9('0x3'));var BPromise=require(_0x5ad9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5ad9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ad9('0x6'));var squel=require(_0x5ad9('0x7'));var crypto=require(_0x5ad9('0x8'));var jsforce=require(_0x5ad9('0x9'));var deskjs=require(_0x5ad9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5ad9('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ad9('0xc'));var qs=require(_0x5ad9('0xd'));var as=require(_0x5ad9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ad9('0xf'))(_0x5ad9('0x10'));var utils=require('../../config/utils');var config=require(_0x5ad9('0x11'));var licenseUtil=require(_0x5ad9('0x12'));var db=require(_0x5ad9('0x13'))['db'];function respondWithStatusCode(_0x3b2718,_0x262ce4){_0x262ce4=_0x262ce4||0xcc;return function(_0xc7e5e9){if(_0xc7e5e9){return _0x3b2718['sendStatus'](_0x262ce4);}return _0x3b2718['status'](_0x262ce4)['end']();};}function respondWithResult(_0x431358,_0x4519ad){_0x4519ad=_0x4519ad||0xc8;return function(_0x52cb37){if(_0x52cb37){return _0x431358[_0x5ad9('0x14')](_0x4519ad)[_0x5ad9('0x15')](_0x52cb37);}};}function respondWithFilteredResult(_0x3f16ef,_0x543743){return function(_0x3da125){if(_0x3da125){var _0x32b0bd=typeof _0x543743[_0x5ad9('0x16')]===_0x5ad9('0x17')&&typeof _0x543743[_0x5ad9('0x18')]===_0x5ad9('0x17');var _0x521cc3=_0x3da125[_0x5ad9('0x19')];var _0x54f392=_0x32b0bd?0x0:_0x543743[_0x5ad9('0x16')];var _0x28682f=_0x32b0bd?_0x3da125[_0x5ad9('0x19')]:_0x543743[_0x5ad9('0x16')]+_0x543743[_0x5ad9('0x18')];var _0x2ba5c0;if(_0x28682f>=_0x521cc3){_0x28682f=_0x521cc3;_0x2ba5c0=0xc8;}else{_0x2ba5c0=0xce;}_0x3f16ef[_0x5ad9('0x14')](_0x2ba5c0);return _0x3f16ef['set'](_0x5ad9('0x1a'),_0x54f392+'-'+_0x28682f+'/'+_0x521cc3)['json'](_0x3da125);}return null;};}function patchUpdates(_0x49363b){return function(_0x3356e5){try{jsonpatch['apply'](_0x3356e5,_0x49363b,!![]);}catch(_0xded166){return BPromise[_0x5ad9('0x1b')](_0xded166);}return _0x3356e5[_0x5ad9('0x1c')]();};}function saveUpdates(_0xebbe63,_0x1274f7){return function(_0x57b2ba){if(_0x57b2ba){return _0x57b2ba[_0x5ad9('0x1d')](_0xebbe63)['then'](function(_0x807b05){return _0x807b05;});}return null;};}function removeEntity(_0x5b816d,_0x570d3c){return function(_0x524249){if(_0x524249){return _0x524249[_0x5ad9('0x1e')]()[_0x5ad9('0x1f')](function(){var _0x39a124=_0x524249[_0x5ad9('0x20')]({'plain':!![]});var _0x1252e6=_0x5ad9('0x21');return db[_0x5ad9('0x22')]['destroy']({'where':{'type':_0x1252e6,'resourceId':_0x39a124['id']}})['then'](function(){return _0x524249;});})[_0x5ad9('0x1f')](function(){_0x5b816d['status'](0xcc)[_0x5ad9('0x23')]();});}};}function handleEntityNotFound(_0x584de3,_0x346f35){return function(_0x55a0e4){if(!_0x55a0e4){_0x584de3['sendStatus'](0x194);}return _0x55a0e4;};}function handleError(_0x243f82,_0x46d565){_0x46d565=_0x46d565||0x1f4;return function(_0x49b3df){logger['error'](_0x49b3df[_0x5ad9('0x24')]);if(_0x49b3df[_0x5ad9('0x25')]){delete _0x49b3df[_0x5ad9('0x25')];}_0x243f82[_0x5ad9('0x14')](_0x46d565)[_0x5ad9('0x26')](_0x49b3df);};}exports[_0x5ad9('0x27')]=function(_0x5e5656,_0x132ec6){var _0x12867b={},_0x2d4f72={},_0x4118a7={'count':0x0,'rows':[]};var _0x5517c8=_['map'](db[_0x5ad9('0x28')][_0x5ad9('0x29')],function(_0x4afceb){return{'name':_0x4afceb['fieldName'],'type':_0x4afceb['type'][_0x5ad9('0x2a')]};});_0x2d4f72[_0x5ad9('0x2b')]=_['map'](_0x5517c8,_0x5ad9('0x25'));_0x2d4f72[_0x5ad9('0x2c')]=_[_0x5ad9('0x2d')](_0x5e5656[_0x5ad9('0x2c')]);_0x2d4f72['filters']=_['intersection'](_0x2d4f72[_0x5ad9('0x2b')],_0x2d4f72[_0x5ad9('0x2c')]);_0x12867b[_0x5ad9('0x2e')]=_[_0x5ad9('0x2f')](_0x2d4f72[_0x5ad9('0x2b')],qs['fields'](_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x30')]));_0x12867b[_0x5ad9('0x2e')]=_0x12867b[_0x5ad9('0x2e')][_0x5ad9('0x31')]?_0x12867b[_0x5ad9('0x2e')]:_0x2d4f72['model'];if(!_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x32')]('nolimit')){_0x12867b[_0x5ad9('0x18')]=qs[_0x5ad9('0x18')](_0x5e5656['query'][_0x5ad9('0x18')]);_0x12867b[_0x5ad9('0x16')]=qs[_0x5ad9('0x16')](_0x5e5656['query'][_0x5ad9('0x16')]);}_0x12867b[_0x5ad9('0x33')]=qs[_0x5ad9('0x34')](_0x5e5656[_0x5ad9('0x2c')]['sort']);_0x12867b[_0x5ad9('0x35')]=qs[_0x5ad9('0x36')](_[_0x5ad9('0x37')](_0x5e5656[_0x5ad9('0x2c')],_0x2d4f72[_0x5ad9('0x36')]),_0x5517c8);if(_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x38')]){_0x12867b[_0x5ad9('0x35')]=_[_0x5ad9('0x39')](_0x12867b['where'],{'$or':_[_0x5ad9('0x3a')](_0x5517c8,function(_0x39563f){if(_0x39563f[_0x5ad9('0x3b')]!==_0x5ad9('0x3c')){var _0x2a9e3b={};_0x2a9e3b[_0x39563f['name']]={'$like':'%'+_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x38')]+'%'};return _0x2a9e3b;}})});}_0x12867b=_[_0x5ad9('0x39')]({},_0x12867b,_0x5e5656['options']);var _0x3d027a={'where':_0x12867b[_0x5ad9('0x35')]};return db[_0x5ad9('0x28')]['count'](_0x3d027a)[_0x5ad9('0x1f')](function(_0x5cfe5b){_0x4118a7['count']=_0x5cfe5b;if(_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x3d')]){_0x12867b[_0x5ad9('0x3e')]=[{'all':!![]}];}return db[_0x5ad9('0x28')]['findAll'](_0x12867b);})['then'](function(_0x552c39){_0x4118a7['rows']=_0x552c39;return _0x4118a7;})[_0x5ad9('0x1f')](respondWithFilteredResult(_0x132ec6,_0x12867b))['catch'](handleError(_0x132ec6,null));};exports[_0x5ad9('0x3f')]=function(_0x5c5a7a,_0x21dfd1){var _0x1c04c3={'raw':![],'where':{'id':_0x5c5a7a[_0x5ad9('0x40')]['id']}},_0x6b2fa7={};_0x6b2fa7[_0x5ad9('0x2b')]=_[_0x5ad9('0x2d')](db[_0x5ad9('0x28')][_0x5ad9('0x29')]);_0x6b2fa7[_0x5ad9('0x2c')]=_['keys'](_0x5c5a7a[_0x5ad9('0x2c')]);_0x6b2fa7[_0x5ad9('0x36')]=_[_0x5ad9('0x2f')](_0x6b2fa7[_0x5ad9('0x2b')],_0x6b2fa7[_0x5ad9('0x2c')]);_0x1c04c3['attributes']=_[_0x5ad9('0x2f')](_0x6b2fa7['model'],qs['fields'](_0x5c5a7a['query'][_0x5ad9('0x30')]));_0x1c04c3[_0x5ad9('0x2e')]=_0x1c04c3[_0x5ad9('0x2e')]['length']?_0x1c04c3[_0x5ad9('0x2e')]:_0x6b2fa7[_0x5ad9('0x2b')];if(_0x5c5a7a[_0x5ad9('0x2c')][_0x5ad9('0x3d')]){_0x1c04c3['include']=[{'all':!![]}];}_0x1c04c3=_[_0x5ad9('0x39')]({},_0x1c04c3,_0x5c5a7a[_0x5ad9('0x41')]);return db[_0x5ad9('0x28')][_0x5ad9('0x42')](_0x1c04c3)['then'](handleEntityNotFound(_0x21dfd1,null))[_0x5ad9('0x1f')](respondWithResult(_0x21dfd1,null))[_0x5ad9('0x43')](handleError(_0x21dfd1,null));};exports[_0x5ad9('0x44')]=function(_0x1e03f,_0x479bbc){return db[_0x5ad9('0x28')][_0x5ad9('0x44')](_0x1e03f['body'],{})[_0x5ad9('0x1f')](function(_0x5d8a5f){var _0x42a662=_0x1e03f[_0x5ad9('0x45')][_0x5ad9('0x20')]({'plain':!![]});if(!_0x42a662)throw new Error(_0x5ad9('0x46'));if(_0x42a662[_0x5ad9('0x47')]===_0x5ad9('0x45')){var _0xa0f426=_0x5d8a5f[_0x5ad9('0x20')]({'plain':!![]});var _0x307dd9=_0x5ad9('0x21');return db[_0x5ad9('0x48')][_0x5ad9('0x42')]({'where':{'name':_0x307dd9,'userProfileId':_0x42a662[_0x5ad9('0x49')]},'raw':!![]})[_0x5ad9('0x1f')](function(_0x251b65){if(_0x251b65&&_0x251b65['autoAssociation']===0x0){return db[_0x5ad9('0x22')][_0x5ad9('0x44')]({'name':_0xa0f426[_0x5ad9('0x25')],'resourceId':_0xa0f426['id'],'type':_0x251b65[_0x5ad9('0x25')],'sectionId':_0x251b65['id']},{})[_0x5ad9('0x1f')](function(){return _0x5d8a5f;});}else{return _0x5d8a5f;}})[_0x5ad9('0x43')](function(_0xb5222e){logger[_0x5ad9('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb5222e);throw _0xb5222e;});}return _0x5d8a5f;})[_0x5ad9('0x1f')](respondWithResult(_0x479bbc,0xc9))['catch'](handleError(_0x479bbc,null));};exports[_0x5ad9('0x1d')]=function(_0x3445b6,_0x469b19){if(_0x3445b6['body']['id']){delete _0x3445b6[_0x5ad9('0x4b')]['id'];}return db[_0x5ad9('0x28')][_0x5ad9('0x42')]({'where':{'id':_0x3445b6['params']['id']}})[_0x5ad9('0x1f')](handleEntityNotFound(_0x469b19,null))['then'](saveUpdates(_0x3445b6['body'],null))[_0x5ad9('0x1f')](respondWithResult(_0x469b19,null))[_0x5ad9('0x43')](handleError(_0x469b19,null));};exports['destroy']=function(_0x5c6627,_0xbda89a){return db[_0x5ad9('0x28')][_0x5ad9('0x42')]({'where':{'id':_0x5c6627[_0x5ad9('0x40')]['id']}})[_0x5ad9('0x1f')](handleEntityNotFound(_0xbda89a,null))[_0x5ad9('0x1f')](removeEntity(_0xbda89a,null))[_0x5ad9('0x43')](handleError(_0xbda89a,null));}; \ No newline at end of file +var _0xfe60=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x5ca502,_0xe204d0){_0x5ca502=_0x5ca502-0x0;var _0x4dad13=_0xfe60[_0x5ca502];return _0x4dad13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fe6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe6('0x1'));var rp=require(_0x0fe6('0x2'));var moment=require(_0x0fe6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0fe6('0x4'));var util=require(_0x0fe6('0x5'));var path=require(_0x0fe6('0x6'));var sox=require(_0x0fe6('0x7'));var csv=require(_0x0fe6('0x8'));var ejs=require(_0x0fe6('0x9'));var fs=require('fs');var fs_extra=require(_0x0fe6('0xa'));var _=require(_0x0fe6('0xb'));var squel=require(_0x0fe6('0xc'));var crypto=require(_0x0fe6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0fe6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0fe6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0fe6('0x10'));var as=require(_0x0fe6('0x11'));var hardwareService=require(_0x0fe6('0x12'));var logger=require(_0x0fe6('0x13'))(_0x0fe6('0x14'));var utils=require(_0x0fe6('0x15'));var config=require(_0x0fe6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fe6('0x17'))['db'];function respondWithStatusCode(_0xa43382,_0x469b27){_0x469b27=_0x469b27||0xcc;return function(_0x51eda9){if(_0x51eda9){return _0xa43382['sendStatus'](_0x469b27);}return _0xa43382[_0x0fe6('0x18')](_0x469b27)['end']();};}function respondWithResult(_0x5c4e63,_0x500e06){_0x500e06=_0x500e06||0xc8;return function(_0x225253){if(_0x225253){return _0x5c4e63[_0x0fe6('0x18')](_0x500e06)[_0x0fe6('0x19')](_0x225253);}};}function respondWithFilteredResult(_0x156aff,_0x3ab844){return function(_0x16f2f6){if(_0x16f2f6){var _0x44011a=typeof _0x3ab844[_0x0fe6('0x1a')]===_0x0fe6('0x1b')&&typeof _0x3ab844[_0x0fe6('0x1c')]===_0x0fe6('0x1b');var _0x347ebb=_0x16f2f6['count'];var _0x469a48=_0x44011a?0x0:_0x3ab844[_0x0fe6('0x1a')];var _0x34fc0c=_0x44011a?_0x16f2f6[_0x0fe6('0x1d')]:_0x3ab844[_0x0fe6('0x1a')]+_0x3ab844[_0x0fe6('0x1c')];var _0xf351d5;if(_0x34fc0c>=_0x347ebb){_0x34fc0c=_0x347ebb;_0xf351d5=0xc8;}else{_0xf351d5=0xce;}_0x156aff[_0x0fe6('0x18')](_0xf351d5);return _0x156aff[_0x0fe6('0x1e')](_0x0fe6('0x1f'),_0x469a48+'-'+_0x34fc0c+'/'+_0x347ebb)[_0x0fe6('0x19')](_0x16f2f6);}return null;};}function patchUpdates(_0x288bd6){return function(_0x4e13f9){try{jsonpatch[_0x0fe6('0x20')](_0x4e13f9,_0x288bd6,!![]);}catch(_0x270fc2){return BPromise[_0x0fe6('0x21')](_0x270fc2);}return _0x4e13f9[_0x0fe6('0x22')]();};}function saveUpdates(_0x4e2892,_0x124214){return function(_0x35a5da){if(_0x35a5da){return _0x35a5da['update'](_0x4e2892)[_0x0fe6('0x23')](function(_0x57198d){return _0x57198d;});}return null;};}function removeEntity(_0x3f9071,_0x224741){return function(_0x447086){if(_0x447086){return _0x447086[_0x0fe6('0x24')]()['then'](function(){var _0x3ef260=_0x447086[_0x0fe6('0x25')]({'plain':!![]});var _0x7f855d=_0x0fe6('0x26');return db[_0x0fe6('0x27')]['destroy']({'where':{'type':_0x7f855d,'resourceId':_0x3ef260['id']}})[_0x0fe6('0x23')](function(){return _0x447086;});})[_0x0fe6('0x23')](function(){_0x3f9071[_0x0fe6('0x18')](0xcc)[_0x0fe6('0x28')]();});}};}function handleEntityNotFound(_0xfbd414,_0x45f831){return function(_0x4e1c48){if(!_0x4e1c48){_0xfbd414[_0x0fe6('0x29')](0x194);}return _0x4e1c48;};}function handleError(_0x36488a,_0x392fb0){_0x392fb0=_0x392fb0||0x1f4;return function(_0x167d17){logger[_0x0fe6('0x2a')](_0x167d17[_0x0fe6('0x2b')]);if(_0x167d17[_0x0fe6('0x2c')]){delete _0x167d17[_0x0fe6('0x2c')];}_0x36488a[_0x0fe6('0x18')](_0x392fb0)['send'](_0x167d17);};}exports[_0x0fe6('0x2d')]=function(_0x331fa5,_0x5e0839){var _0x34451d={},_0xa74fe6={},_0x118f31={'count':0x0,'rows':[]};var _0x176e35=_[_0x0fe6('0x2e')](db[_0x0fe6('0x2f')][_0x0fe6('0x30')],function(_0x3eb7ac){return{'name':_0x3eb7ac[_0x0fe6('0x31')],'type':_0x3eb7ac[_0x0fe6('0x32')][_0x0fe6('0x33')]};});_0xa74fe6[_0x0fe6('0x34')]=_[_0x0fe6('0x2e')](_0x176e35,_0x0fe6('0x2c'));_0xa74fe6[_0x0fe6('0x35')]=_[_0x0fe6('0x36')](_0x331fa5[_0x0fe6('0x35')]);_0xa74fe6['filters']=_['intersection'](_0xa74fe6[_0x0fe6('0x34')],_0xa74fe6[_0x0fe6('0x35')]);_0x34451d[_0x0fe6('0x37')]=_[_0x0fe6('0x38')](_0xa74fe6[_0x0fe6('0x34')],qs['fields'](_0x331fa5[_0x0fe6('0x35')][_0x0fe6('0x39')]));_0x34451d[_0x0fe6('0x37')]=_0x34451d[_0x0fe6('0x37')][_0x0fe6('0x3a')]?_0x34451d[_0x0fe6('0x37')]:_0xa74fe6['model'];if(!_0x331fa5['query'][_0x0fe6('0x3b')](_0x0fe6('0x3c'))){_0x34451d[_0x0fe6('0x1c')]=qs['limit'](_0x331fa5[_0x0fe6('0x35')][_0x0fe6('0x1c')]);_0x34451d[_0x0fe6('0x1a')]=qs['offset'](_0x331fa5[_0x0fe6('0x35')][_0x0fe6('0x1a')]);}_0x34451d[_0x0fe6('0x3d')]=qs[_0x0fe6('0x3e')](_0x331fa5['query'][_0x0fe6('0x3e')]);_0x34451d[_0x0fe6('0x3f')]=qs[_0x0fe6('0x40')](_[_0x0fe6('0x41')](_0x331fa5[_0x0fe6('0x35')],_0xa74fe6[_0x0fe6('0x40')]),_0x176e35);if(_0x331fa5['query'][_0x0fe6('0x42')]){_0x34451d[_0x0fe6('0x3f')]=_[_0x0fe6('0x43')](_0x34451d[_0x0fe6('0x3f')],{'$or':_[_0x0fe6('0x2e')](_0x176e35,function(_0x5d3473){if(_0x5d3473[_0x0fe6('0x32')]!=='VIRTUAL'){var _0x455300={};_0x455300[_0x5d3473[_0x0fe6('0x2c')]]={'$like':'%'+_0x331fa5[_0x0fe6('0x35')]['filter']+'%'};return _0x455300;}})});}_0x34451d=_[_0x0fe6('0x43')]({},_0x34451d,_0x331fa5[_0x0fe6('0x44')]);var _0x5c349a={'where':_0x34451d[_0x0fe6('0x3f')]};return db[_0x0fe6('0x2f')][_0x0fe6('0x1d')](_0x5c349a)[_0x0fe6('0x23')](function(_0xaf4224){_0x118f31[_0x0fe6('0x1d')]=_0xaf4224;if(_0x331fa5[_0x0fe6('0x35')][_0x0fe6('0x45')]){_0x34451d[_0x0fe6('0x46')]=[{'all':!![]}];}return db[_0x0fe6('0x2f')][_0x0fe6('0x47')](_0x34451d);})[_0x0fe6('0x23')](function(_0x13ad07){_0x118f31[_0x0fe6('0x48')]=_0x13ad07;return _0x118f31;})[_0x0fe6('0x23')](respondWithFilteredResult(_0x5e0839,_0x34451d))[_0x0fe6('0x49')](handleError(_0x5e0839,null));};exports['show']=function(_0xc74a59,_0x6b31f){var _0x19ed3a={'raw':![],'where':{'id':_0xc74a59[_0x0fe6('0x4a')]['id']}},_0x21fcbd={};_0x21fcbd[_0x0fe6('0x34')]=_['keys'](db['VoiceChanSpy'][_0x0fe6('0x30')]);_0x21fcbd[_0x0fe6('0x35')]=_[_0x0fe6('0x36')](_0xc74a59['query']);_0x21fcbd[_0x0fe6('0x40')]=_[_0x0fe6('0x38')](_0x21fcbd['model'],_0x21fcbd[_0x0fe6('0x35')]);_0x19ed3a['attributes']=_['intersection'](_0x21fcbd[_0x0fe6('0x34')],qs[_0x0fe6('0x39')](_0xc74a59['query'][_0x0fe6('0x39')]));_0x19ed3a['attributes']=_0x19ed3a['attributes'][_0x0fe6('0x3a')]?_0x19ed3a['attributes']:_0x21fcbd['model'];if(_0xc74a59[_0x0fe6('0x35')]['includeAll']){_0x19ed3a['include']=[{'all':!![]}];}_0x19ed3a=_['merge']({},_0x19ed3a,_0xc74a59[_0x0fe6('0x44')]);return db[_0x0fe6('0x2f')]['find'](_0x19ed3a)[_0x0fe6('0x23')](handleEntityNotFound(_0x6b31f,null))[_0x0fe6('0x23')](respondWithResult(_0x6b31f,null))[_0x0fe6('0x49')](handleError(_0x6b31f,null));};exports[_0x0fe6('0x4b')]=function(_0x36a692,_0x365504){return db[_0x0fe6('0x2f')][_0x0fe6('0x4b')](_0x36a692['body'],{})[_0x0fe6('0x23')](function(_0x58602f){var _0x199df6=_0x36a692['user'][_0x0fe6('0x25')]({'plain':!![]});if(!_0x199df6)throw new Error(_0x0fe6('0x4c'));if(_0x199df6[_0x0fe6('0x4d')]===_0x0fe6('0x4e')){var _0x2e47a1=_0x58602f[_0x0fe6('0x25')]({'plain':!![]});var _0x293f26='ChanSpies';return db[_0x0fe6('0x4f')][_0x0fe6('0x50')]({'where':{'name':_0x293f26,'userProfileId':_0x199df6[_0x0fe6('0x51')]},'raw':!![]})[_0x0fe6('0x23')](function(_0x3006ca){if(_0x3006ca&&_0x3006ca[_0x0fe6('0x52')]===0x0){return db[_0x0fe6('0x27')][_0x0fe6('0x4b')]({'name':_0x2e47a1[_0x0fe6('0x2c')],'resourceId':_0x2e47a1['id'],'type':_0x3006ca[_0x0fe6('0x2c')],'sectionId':_0x3006ca['id']},{})['then'](function(){return _0x58602f;});}else{return _0x58602f;}})['catch'](function(_0x36c54c){logger[_0x0fe6('0x2a')](_0x0fe6('0x53'),_0x36c54c);throw _0x36c54c;});}return _0x58602f;})[_0x0fe6('0x23')](respondWithResult(_0x365504,0xc9))[_0x0fe6('0x49')](handleError(_0x365504,null));};exports[_0x0fe6('0x54')]=function(_0x2fc011,_0x1994ef){if(_0x2fc011[_0x0fe6('0x55')]['id']){delete _0x2fc011['body']['id'];}return db[_0x0fe6('0x2f')][_0x0fe6('0x50')]({'where':{'id':_0x2fc011[_0x0fe6('0x4a')]['id']}})[_0x0fe6('0x23')](handleEntityNotFound(_0x1994ef,null))['then'](saveUpdates(_0x2fc011[_0x0fe6('0x55')],null))[_0x0fe6('0x23')](respondWithResult(_0x1994ef,null))['catch'](handleError(_0x1994ef,null));};exports['destroy']=function(_0xea08e8,_0x35c802){return db[_0x0fe6('0x2f')]['find']({'where':{'id':_0xea08e8['params']['id']}})['then'](handleEntityNotFound(_0x35c802,null))['then'](removeEntity(_0x35c802,null))[_0x0fe6('0x49')](handleError(_0x35c802,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5350e65..484f6c2 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.model.js +++ b/server/api/voiceChanSpy/voiceChanSpy.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc358=['models','define','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','catch','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','push','SIP/%s,%s','name','options','StopMixMonitor','concat','internal','User','findAll','agent'];(function(_0x5615d6,_0x57e6ee){var _0x201446=function(_0x3c9268){while(--_0x3c9268){_0x5615d6['push'](_0x5615d6['shift']());}};_0x201446(++_0x57e6ee);}(_0xc358,0x142));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c35('0x0'));var util=require(_0x8c35('0x1'));var BPromise=require(_0x8c35('0x2'));var attributes=require(_0x8c35('0x3'));var getUserApplications=function(_0x2138ec,_0x1250de,_0x46fe91){var _0x21e18f=0x1;var _0x4ba04f=[];var _0x1e163f={'context':_0x1250de['context']||_0x8c35('0x4'),'exten':util[_0x8c35('0x5')](_0x8c35('0x6'),_0x2138ec[_0x8c35('0x7')],_0x46fe91),'type':_0x8c35('0x8'),'isApp':![],'ChanSpyId':_0x2138ec['id'],'UserId':_0x1250de['id']};_0x4ba04f['push'](_[_0x8c35('0x9')]({'app':_0x8c35('0xa'),'appdata':util['format'](_0x8c35('0xb'),'chanspy'),'priority':_0x21e18f++},_0x1e163f));if(_0x2138ec[_0x8c35('0xc')]){_0x4ba04f['push'](_[_0x8c35('0x9')]({'app':_0x8c35('0xd'),'appdata':util[_0x8c35('0x5')](_0x8c35('0xe'),_0x2138ec[_0x8c35('0xf')]),'priority':_0x21e18f++},_0x1e163f));}if(_0x2138ec[_0x8c35('0x10')]){_0x4ba04f['push'](_[_0x8c35('0x9')]({'app':_0x8c35('0x11'),'appdata':_0x2138ec[_0x8c35('0x12')],'priority':_0x21e18f++},_0x1e163f));}_0x4ba04f[_0x8c35('0x13')](_[_0x8c35('0x9')]({'app':'ChanSpy','appdata':util['format'](_0x8c35('0x14'),_0x1250de[_0x8c35('0x15')],_0x2138ec[_0x8c35('0x16')]?_0x2138ec[_0x8c35('0x16')]['join'](''):''),'priority':_0x21e18f++},_0x1e163f));if(_0x2138ec['record']){_0x4ba04f[_0x8c35('0x13')](_['merge']({'app':_0x8c35('0x17'),'priority':_0x21e18f++},_0x1e163f));}return _0x4ba04f;};var getChanSpyApplications=function(_0x2d4430,_0x5430e5){var _0x3b44f4=[];for(var _0x1fbcbe=0x0,_0x182e52=0x1;_0x1fbcbe<_0x5430e5['length'];_0x1fbcbe++,_0x182e52=0x1){_0x3b44f4=_0x3b44f4[_0x8c35('0x18')](getUserApplications(_0x2d4430,_0x5430e5[_0x1fbcbe],_0x5430e5[_0x1fbcbe]['internal']));if(_0x5430e5[_0x1fbcbe][_0x8c35('0x19')]!=_0x5430e5[_0x1fbcbe][_0x8c35('0x15')]){_0x3b44f4=_0x3b44f4[_0x8c35('0x18')](getUserApplications(_0x2d4430,_0x5430e5[_0x1fbcbe],_0x5430e5[_0x1fbcbe][_0x8c35('0x15')]));}}return _0x3b44f4;};var getChanSpyPromise=function(_0x21ff1c,_0x25779f){return new BPromise(function(_0x33cfe0,_0x2c5c18){return _0x21ff1c[_0x8c35('0x1a')][_0x8c35('0x1b')]({'attributes':['id',_0x8c35('0x15'),_0x8c35('0x19')],'where':{'role':_0x8c35('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x52061e){if(_0x52061e){return _0x33cfe0(getChanSpyApplications(_0x25779f,_0x52061e));}return _0x33cfe0([]);})['catch'](function(_0x2ba8ab){_0x2c5c18(_0x2ba8ab);});});};module['exports']=function(_0x225020,_0x5256ba){var _0x13feab=_0x225020[_0x8c35('0x1d')];return _0x225020[_0x8c35('0x1e')](_0x8c35('0x1f'),attributes,{'tableName':_0x8c35('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a1879,_0x1d8a75,_0x250b52){return getChanSpyPromise(_0x13feab,_0x4a1879)[_0x8c35('0x21')](function(_0x1a2b3d){if(_0x1a2b3d&&_0x1a2b3d[_0x8c35('0x22')]){return _0x13feab[_0x8c35('0x23')][_0x8c35('0x24')](_0x1a2b3d);}})[_0x8c35('0x21')](function(){_0x250b52();})['catch'](function(_0x14835c){_0x250b52(_0x14835c);});},'afterUpdate':function(_0x412dd3,_0x573e69,_0x33030d){return _0x13feab['VoiceExtension'][_0x8c35('0x25')]({'where':{'ChanSpyId':_0x412dd3['id']}})['then'](function(){return getChanSpyPromise(_0x13feab,_0x412dd3);})[_0x8c35('0x21')](function(_0x11df2f){if(_0x11df2f&&_0x11df2f[_0x8c35('0x22')]){return _0x13feab['VoiceExtension'][_0x8c35('0x24')](_0x11df2f);}})[_0x8c35('0x21')](function(){_0x33030d();})[_0x8c35('0x26')](function(_0x5683cf){_0x33030d(_0x5683cf);});},'afterDestroy':function(_0x546afd,_0x5bf99f,_0x3b2f3b){return _0x13feab[_0x8c35('0x23')][_0x8c35('0x25')]({'where':{'ChanSpyId':_0x546afd['id']}})[_0x8c35('0x21')](function(){_0x3b2f3b();})['catch'](function(_0x44f468){_0x3b2f3b(_0x44f468);});}}});}; \ No newline at end of file +var _0x4fc8=['internal','User','then','catch','exports','models','voice_chanspy','bulkCreate','VoiceExtension','destroy','lodash','util','context','from-sip','format','%s%s','prefix','merge','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s','name','StopMixMonitor','length','concat'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4fc8,0x1ca));var _0x84fc=function(_0x50f2de,_0x485779){_0x50f2de=_0x50f2de-0x0;var _0x71f7e1=_0x4fc8[_0x50f2de];return _0x71f7e1;};'use strict';var _=require(_0x84fc('0x0'));var util=require(_0x84fc('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3b6cf6,_0x3bf0af,_0x1298fb){var _0x1181ee=0x1;var _0x47715c=[];var _0xd991d={'context':_0x3bf0af[_0x84fc('0x2')]||_0x84fc('0x3'),'exten':util[_0x84fc('0x4')](_0x84fc('0x5'),_0x3b6cf6[_0x84fc('0x6')],_0x1298fb),'type':'system','isApp':![],'ChanSpyId':_0x3b6cf6['id'],'UserId':_0x3bf0af['id']};_0x47715c['push'](_[_0x84fc('0x7')]({'app':'Set','appdata':util[_0x84fc('0x4')](_0x84fc('0x8'),_0x84fc('0x9')),'priority':_0x1181ee++},_0xd991d));if(_0x3b6cf6[_0x84fc('0xa')]){_0x47715c[_0x84fc('0xb')](_[_0x84fc('0x7')]({'app':_0x84fc('0xc'),'appdata':util['format'](_0x84fc('0xd'),_0x3b6cf6['recordingFormat']),'priority':_0x1181ee++},_0xd991d));}if(_0x3b6cf6['auth']){_0x47715c[_0x84fc('0xb')](_[_0x84fc('0x7')]({'app':_0x84fc('0xe'),'appdata':_0x3b6cf6[_0x84fc('0xf')],'priority':_0x1181ee++},_0xd991d));}_0x47715c[_0x84fc('0xb')](_['merge']({'app':_0x84fc('0x10'),'appdata':util[_0x84fc('0x4')](_0x84fc('0x11'),_0x3bf0af[_0x84fc('0x12')],_0x3b6cf6['options']?_0x3b6cf6['options']['join'](''):''),'priority':_0x1181ee++},_0xd991d));if(_0x3b6cf6[_0x84fc('0xa')]){_0x47715c[_0x84fc('0xb')](_['merge']({'app':_0x84fc('0x13'),'priority':_0x1181ee++},_0xd991d));}return _0x47715c;};var getChanSpyApplications=function(_0x31bb7a,_0x54f6ce){var _0x3e8a5f=[];for(var _0x6a202c=0x0,_0x97280f=0x1;_0x6a202c<_0x54f6ce[_0x84fc('0x14')];_0x6a202c++,_0x97280f=0x1){_0x3e8a5f=_0x3e8a5f[_0x84fc('0x15')](getUserApplications(_0x31bb7a,_0x54f6ce[_0x6a202c],_0x54f6ce[_0x6a202c][_0x84fc('0x16')]));if(_0x54f6ce[_0x6a202c][_0x84fc('0x16')]!=_0x54f6ce[_0x6a202c]['name']){_0x3e8a5f=_0x3e8a5f[_0x84fc('0x15')](getUserApplications(_0x31bb7a,_0x54f6ce[_0x6a202c],_0x54f6ce[_0x6a202c][_0x84fc('0x12')]));}}return _0x3e8a5f;};var getChanSpyPromise=function(_0x177ea5,_0x77a3ec){return new BPromise(function(_0x73843d,_0x489b18){return _0x177ea5[_0x84fc('0x17')]['findAll']({'attributes':['id',_0x84fc('0x12'),_0x84fc('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x84fc('0x18')](function(_0x166d43){if(_0x166d43){return _0x73843d(getChanSpyApplications(_0x77a3ec,_0x166d43));}return _0x73843d([]);})[_0x84fc('0x19')](function(_0x57695a){_0x489b18(_0x57695a);});});};module[_0x84fc('0x1a')]=function(_0xa3c149,_0x21cf72){var _0x269994=_0xa3c149[_0x84fc('0x1b')];return _0xa3c149['define']('VoiceChanSpy',attributes,{'tableName':_0x84fc('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x47eb7f,_0x840c9c,_0x3f1d61){return getChanSpyPromise(_0x269994,_0x47eb7f)[_0x84fc('0x18')](function(_0x578191){if(_0x578191&&_0x578191['length']){return _0x269994['VoiceExtension'][_0x84fc('0x1d')](_0x578191);}})[_0x84fc('0x18')](function(){_0x3f1d61();})[_0x84fc('0x19')](function(_0x42333b){_0x3f1d61(_0x42333b);});},'afterUpdate':function(_0x107705,_0x16b236,_0x93c1db){return _0x269994[_0x84fc('0x1e')][_0x84fc('0x1f')]({'where':{'ChanSpyId':_0x107705['id']}})['then'](function(){return getChanSpyPromise(_0x269994,_0x107705);})[_0x84fc('0x18')](function(_0x533712){if(_0x533712&&_0x533712['length']){return _0x269994[_0x84fc('0x1e')]['bulkCreate'](_0x533712);}})[_0x84fc('0x18')](function(){_0x93c1db();})[_0x84fc('0x19')](function(_0x4a2120){_0x93c1db(_0x4a2120);});},'afterDestroy':function(_0x583e03,_0x5e7a1a,_0x3bdc5d){return _0x269994[_0x84fc('0x1e')][_0x84fc('0x1f')]({'where':{'ChanSpyId':_0x583e03['id']}})[_0x84fc('0x18')](function(){_0x3bdc5d();})['catch'](function(_0x123464){_0x3bdc5d(_0x123464);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 10f9b17..e181bad 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe130=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x2a38bf,_0x1f05bd){var _0x1d08eb=function(_0x3eda65){while(--_0x3eda65){_0x2a38bf['push'](_0x2a38bf['shift']());}};_0x1d08eb(++_0x1f05bd);}(_0xe130,0x127));var _0x0e13=function(_0x143963,_0x2384e9){_0x143963=_0x143963-0x0;var _0x2ac56c=_0xe130[_0x143963];return _0x2ac56c;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1774a5,_0x5f0d09,_0x567031){return new BPromise(function(_0x5aaa22,_0x2faf49){return client[_0x0e13('0xb')](_0x1774a5,_0x567031)['then'](function(_0x5d066a){logger[_0x0e13('0xc')](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));logger[_0x0e13('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5f0d09,'request\x20sent',JSON[_0x0e13('0x10')](_0x5d066a));if(_0x5d066a[_0x0e13('0x11')]){if(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x12')]===0x1f4){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x5d066a['error'][_0x0e13('0x13')]);return _0x2faf49(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}logger[_0x0e13('0x11')](_0x0e13('0xd'),_0x5f0d09,_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);return _0x5aaa22(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}else{logger['info'](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));_0x5aaa22(_0x5d066a[_0x0e13('0x14')][_0x0e13('0x13')]);}})[_0x0e13('0x15')](function(_0x32f76a){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x32f76a);_0x2faf49(_0x32f76a);});});} \ No newline at end of file +var _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x113db3,_0x1ca6b9){var _0x2d1f80=function(_0x2f0617){while(--_0x2f0617){_0x113db3['push'](_0x113db3['shift']());}};_0x2d1f80(++_0x1ca6b9);}(_0xa75b,0x170));var _0xba75=function(_0x1d3ce1,_0x386f22){_0x1d3ce1=_0x1d3ce1-0x0;var _0x370969=_0xa75b[_0x1d3ce1];return _0x370969;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 24e41c7..087a7c8 100644 --- a/server/api/voiceContext/index.js +++ b/server/api/voiceContext/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9517=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','index','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3f0ba2,_0x6d46f9){var _0x593eb8=function(_0x4a5c03){while(--_0x4a5c03){_0x3f0ba2['push'](_0x3f0ba2['shift']());}};_0x593eb8(++_0x6d46f9);}(_0x9517,0x10e));var _0x7951=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9517[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7951('0x0'));var util=require(_0x7951('0x1'));var path=require(_0x7951('0x2'));var timeout=require(_0x7951('0x3'));var express=require(_0x7951('0x4'));var router=express[_0x7951('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7951('0x6'));var interaction=require(_0x7951('0x7'));var config=require(_0x7951('0x8'));var controller=require(_0x7951('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7951('0xa')]);router[_0x7951('0xb')](_0x7951('0xc'),auth[_0x7951('0xd')](),controller['show']);router[_0x7951('0xe')]('/',auth['isAuthenticated'](),controller[_0x7951('0xf')]);router[_0x7951('0x10')]('/:id',auth[_0x7951('0xd')](),controller[_0x7951('0x11')]);router[_0x7951('0x12')](_0x7951('0xc'),auth[_0x7951('0xd')](),controller[_0x7951('0x13')]);module[_0x7951('0x14')]=router; \ No newline at end of file +var _0x132f=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0x132f,0x157));var _0xf132=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x132f[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0xf132('0x0'));var util=require(_0xf132('0x1'));var path=require(_0xf132('0x2'));var timeout=require(_0xf132('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf132('0x4'));var auth=require(_0xf132('0x5'));var interaction=require(_0xf132('0x6'));var config=require(_0xf132('0x7'));var controller=require(_0xf132('0x8'));router[_0xf132('0x9')]('/',auth[_0xf132('0xa')](),controller[_0xf132('0xb')]);router[_0xf132('0x9')](_0xf132('0xc'),auth[_0xf132('0xa')](),controller['show']);router[_0xf132('0xd')]('/',auth[_0xf132('0xa')](),controller[_0xf132('0xe')]);router['put'](_0xf132('0xc'),auth[_0xf132('0xa')](),controller[_0xf132('0xf')]);router[_0xf132('0x10')](_0xf132('0xc'),auth['isAuthenticated'](),controller[_0xf132('0x11')]);module[_0xf132('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4231437..efaf29e 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x771d=['name','STRING','BOOLEAN','exports'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x771d,0x1ef));var _0xd771=function(_0x2acf4d,_0x41d206){_0x2acf4d=_0x2acf4d-0x0;var _0x455e40=_0x771d[_0x2acf4d];return _0x455e40;};'use strict';var Sequelize=require('sequelize');module[_0xd771('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd771('0x1')},'description':{'type':Sequelize[_0xd771('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd771('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbe7e=['STRING','BOOLEAN','sequelize','exports','name'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xbe7e,0x15b));var _0xebe7=function(_0x540eed,_0xbce402){_0x540eed=_0x540eed-0x0;var _0x14daa7=_0xbe7e[_0x540eed];return _0x14daa7;};'use strict';var Sequelize=require(_0xebe7('0x0'));module[_0xebe7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xebe7('0x2')},'description':{'type':Sequelize[_0xebe7('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xebe7('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 9ef4ecd..237a14a 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a73=['utf8','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','render','destroy','readFileSync','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','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','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','get','UserProfileResource','then','end','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','join','root','server/files/templates/context.ejs'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x2a73,0x14d));var _0x32a7=function(_0x5e9981,_0x1b2148){_0x5e9981=_0x5e9981-0x0;var _0x426459=_0x2a73[_0x5e9981];return _0x426459;};'use strict';var emlformat=require(_0x32a7('0x0'));var rimraf=require(_0x32a7('0x1'));var zipdir=require(_0x32a7('0x2'));var jsonpatch=require(_0x32a7('0x3'));var rp=require(_0x32a7('0x4'));var moment=require(_0x32a7('0x5'));var BPromise=require(_0x32a7('0x6'));var Mustache=require(_0x32a7('0x7'));var util=require('util');var path=require(_0x32a7('0x8'));var sox=require(_0x32a7('0x9'));var csv=require(_0x32a7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32a7('0xb'));var squel=require(_0x32a7('0xc'));var crypto=require(_0x32a7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x32a7('0xa'));var querystring=require(_0x32a7('0xe'));var Papa=require(_0x32a7('0xf'));var Redis=require(_0x32a7('0x10'));var authService=require(_0x32a7('0x11'));var qs=require(_0x32a7('0x12'));var as=require(_0x32a7('0x13'));var hardwareService=require(_0x32a7('0x14'));var logger=require(_0x32a7('0x15'))(_0x32a7('0x16'));var utils=require(_0x32a7('0x17'));var config=require(_0x32a7('0x18'));var licenseUtil=require(_0x32a7('0x19'));var db=require(_0x32a7('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x32a7('0x1b')][_0x32a7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5e4a86,_0x5d3658,_0x36849e,_0x25de35){return new BPromise(function(_0x451f0b,_0xc8b1ee){var _0x37de53=_0x25de35||client;return _0x37de53[_0x32a7('0x1d')](_0x5e4a86,_0x36849e)['then'](function(_0x1bbf8b){logger[_0x32a7('0x1e')](_0x32a7('0x1f'),_0x5d3658,_0x32a7('0x20'));logger[_0x32a7('0x21')](_0x32a7('0x22'),_0x5d3658,_0x32a7('0x20'),JSON['stringify'](_0x1bbf8b));if(_0x1bbf8b[_0x32a7('0x23')]){if(_0x1bbf8b['error']['code']===0x1f4){logger[_0x32a7('0x23')](_0x32a7('0x1f'),_0x5d3658,_0x1bbf8b[_0x32a7('0x23')][_0x32a7('0x24')]);return _0xc8b1ee(_0x1bbf8b[_0x32a7('0x23')][_0x32a7('0x24')]);}logger[_0x32a7('0x23')](_0x32a7('0x1f'),_0x5d3658,_0x1bbf8b[_0x32a7('0x23')][_0x32a7('0x24')]);return _0x451f0b(_0x1bbf8b[_0x32a7('0x23')][_0x32a7('0x24')]);}else{logger[_0x32a7('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x5d3658,'request\x20sent');_0x451f0b(_0x1bbf8b['result'][_0x32a7('0x24')]);}})[_0x32a7('0x25')](function(_0x3feaaf){logger[_0x32a7('0x23')](_0x32a7('0x1f'),_0x5d3658,_0x3feaaf);_0xc8b1ee(_0x3feaaf);});});}function respondWithStatusCode(_0x453706,_0xcf1b2a){_0xcf1b2a=_0xcf1b2a||0xcc;return function(_0x3661c1){if(_0x3661c1){return _0x453706[_0x32a7('0x26')](_0xcf1b2a);}return _0x453706[_0x32a7('0x27')](_0xcf1b2a)['end']();};}function respondWithResult(_0x4af6f8,_0xb99045){_0xb99045=_0xb99045||0xc8;return function(_0x12728b){if(_0x12728b){return _0x4af6f8[_0x32a7('0x27')](_0xb99045)[_0x32a7('0x28')](_0x12728b);}};}function respondWithFilteredResult(_0x2ab1b1,_0x45e835){return function(_0x2fa9c2){if(_0x2fa9c2){var _0x23492e=typeof _0x45e835[_0x32a7('0x29')]==='undefined'&&typeof _0x45e835[_0x32a7('0x2a')]===_0x32a7('0x2b');var _0x54aea7=_0x2fa9c2[_0x32a7('0x2c')];var _0x3f2d00=_0x23492e?0x0:_0x45e835[_0x32a7('0x29')];var _0x389355=_0x23492e?_0x2fa9c2[_0x32a7('0x2c')]:_0x45e835[_0x32a7('0x29')]+_0x45e835['limit'];var _0x702a02;if(_0x389355>=_0x54aea7){_0x389355=_0x54aea7;_0x702a02=0xc8;}else{_0x702a02=0xce;}_0x2ab1b1[_0x32a7('0x27')](_0x702a02);return _0x2ab1b1[_0x32a7('0x2d')](_0x32a7('0x2e'),_0x3f2d00+'-'+_0x389355+'/'+_0x54aea7)[_0x32a7('0x28')](_0x2fa9c2);}return null;};}function patchUpdates(_0x79925e){return function(_0x3090c6){try{jsonpatch[_0x32a7('0x2f')](_0x3090c6,_0x79925e,!![]);}catch(_0x1a53f6){return BPromise[_0x32a7('0x30')](_0x1a53f6);}return _0x3090c6['save']();};}function saveUpdates(_0x441d67,_0x50c5da){return function(_0x171053){if(_0x171053){return _0x171053[_0x32a7('0x31')](_0x441d67)['then'](function(_0x245302){return _0x245302;});}return null;};}function removeEntity(_0x1ebf97,_0x31d08b){return function(_0x5a05a2){if(_0x5a05a2){return _0x5a05a2['destroy']()['then'](function(){var _0x70519a=_0x5a05a2[_0x32a7('0x32')]({'plain':!![]});var _0x3d4ff1='Contexts';return db[_0x32a7('0x33')]['destroy']({'where':{'type':_0x3d4ff1,'resourceId':_0x70519a['id']}})[_0x32a7('0x34')](function(){return _0x5a05a2;});})[_0x32a7('0x34')](function(){_0x1ebf97[_0x32a7('0x27')](0xcc)[_0x32a7('0x35')]();});}};}function handleEntityNotFound(_0x203063,_0x3f3795){return function(_0x5154a9){if(!_0x5154a9){_0x203063['sendStatus'](0x194);}return _0x5154a9;};}function handleError(_0x122bd8,_0x23396c){_0x23396c=_0x23396c||0x1f4;return function(_0x4a4d62){logger['error'](_0x4a4d62[_0x32a7('0x36')]);if(_0x4a4d62[_0x32a7('0x37')]){delete _0x4a4d62[_0x32a7('0x37')];}_0x122bd8[_0x32a7('0x27')](_0x23396c)[_0x32a7('0x38')](_0x4a4d62);};}exports['index']=function(_0x32595f,_0x5657d1){var _0x2ba9af={},_0x20ea71={},_0x3c80f6={'count':0x0,'rows':[]};var _0x278f93=_[_0x32a7('0x39')](db[_0x32a7('0x3a')][_0x32a7('0x3b')],function(_0x3865e3){return{'name':_0x3865e3[_0x32a7('0x3c')],'type':_0x3865e3[_0x32a7('0x3d')][_0x32a7('0x3e')]};});_0x20ea71[_0x32a7('0x3f')]=_[_0x32a7('0x39')](_0x278f93,_0x32a7('0x37'));_0x20ea71['query']=_[_0x32a7('0x40')](_0x32595f[_0x32a7('0x41')]);_0x20ea71[_0x32a7('0x42')]=_[_0x32a7('0x43')](_0x20ea71[_0x32a7('0x3f')],_0x20ea71[_0x32a7('0x41')]);_0x2ba9af[_0x32a7('0x44')]=_[_0x32a7('0x43')](_0x20ea71[_0x32a7('0x3f')],qs['fields'](_0x32595f[_0x32a7('0x41')][_0x32a7('0x45')]));_0x2ba9af[_0x32a7('0x44')]=_0x2ba9af['attributes'][_0x32a7('0x46')]?_0x2ba9af[_0x32a7('0x44')]:_0x20ea71[_0x32a7('0x3f')];if(!_0x32595f[_0x32a7('0x41')][_0x32a7('0x47')](_0x32a7('0x48'))){_0x2ba9af[_0x32a7('0x2a')]=qs['limit'](_0x32595f['query'][_0x32a7('0x2a')]);_0x2ba9af[_0x32a7('0x29')]=qs[_0x32a7('0x29')](_0x32595f[_0x32a7('0x41')][_0x32a7('0x29')]);}_0x2ba9af[_0x32a7('0x49')]=qs['sort'](_0x32595f[_0x32a7('0x41')][_0x32a7('0x4a')]);_0x2ba9af['where']=qs[_0x32a7('0x42')](_[_0x32a7('0x4b')](_0x32595f[_0x32a7('0x41')],_0x20ea71[_0x32a7('0x42')]),_0x278f93);if(_0x32595f['query'][_0x32a7('0x4c')]){_0x2ba9af[_0x32a7('0x4d')]=_[_0x32a7('0x4e')](_0x2ba9af[_0x32a7('0x4d')],{'$or':_[_0x32a7('0x39')](_0x278f93,function(_0xb043db){if(_0xb043db['type']!==_0x32a7('0x4f')){var _0x3698f9={};_0x3698f9[_0xb043db[_0x32a7('0x37')]]={'$like':'%'+_0x32595f[_0x32a7('0x41')]['filter']+'%'};return _0x3698f9;}})});}_0x2ba9af=_['merge']({},_0x2ba9af,_0x32595f[_0x32a7('0x50')]);var _0x260e29={'where':_0x2ba9af[_0x32a7('0x4d')]};return db[_0x32a7('0x3a')][_0x32a7('0x2c')](_0x260e29)[_0x32a7('0x34')](function(_0x26209c){_0x3c80f6['count']=_0x26209c;if(_0x32595f[_0x32a7('0x41')][_0x32a7('0x51')]){_0x2ba9af[_0x32a7('0x52')]=[{'all':!![]}];}return db[_0x32a7('0x3a')][_0x32a7('0x53')](_0x2ba9af);})['then'](function(_0x2b5d25){_0x3c80f6['rows']=_0x2b5d25;return _0x3c80f6;})[_0x32a7('0x34')](respondWithFilteredResult(_0x5657d1,_0x2ba9af))[_0x32a7('0x25')](handleError(_0x5657d1,null));};exports[_0x32a7('0x54')]=function(_0xc397c7,_0x4542f8){var _0x2bcb3e={'raw':![],'where':{'id':_0xc397c7[_0x32a7('0x55')]['id']}},_0x31d8f6={};_0x31d8f6[_0x32a7('0x3f')]=_[_0x32a7('0x40')](db['VoiceContext'][_0x32a7('0x3b')]);_0x31d8f6['query']=_[_0x32a7('0x40')](_0xc397c7['query']);_0x31d8f6[_0x32a7('0x42')]=_[_0x32a7('0x43')](_0x31d8f6['model'],_0x31d8f6[_0x32a7('0x41')]);_0x2bcb3e[_0x32a7('0x44')]=_[_0x32a7('0x43')](_0x31d8f6[_0x32a7('0x3f')],qs[_0x32a7('0x45')](_0xc397c7['query'][_0x32a7('0x45')]));_0x2bcb3e[_0x32a7('0x44')]=_0x2bcb3e[_0x32a7('0x44')][_0x32a7('0x46')]?_0x2bcb3e[_0x32a7('0x44')]:_0x31d8f6[_0x32a7('0x3f')];if(_0xc397c7[_0x32a7('0x41')][_0x32a7('0x51')]){_0x2bcb3e[_0x32a7('0x52')]=[{'all':!![]}];}_0x2bcb3e=_[_0x32a7('0x4e')]({},_0x2bcb3e,_0xc397c7['options']);return db[_0x32a7('0x3a')][_0x32a7('0x56')](_0x2bcb3e)['then'](handleEntityNotFound(_0x4542f8,null))[_0x32a7('0x34')](respondWithResult(_0x4542f8,null))[_0x32a7('0x25')](handleError(_0x4542f8,null));};exports['create']=function(_0x135268,_0x28d1f9,_0x41e3e7){var _0xac5b57;return db[_0x32a7('0x3a')][_0x32a7('0x57')](_0x135268['body'],{'raw':!![]})['then'](function(_0x4e5af4){_0xac5b57=_0x4e5af4;return db[_0x32a7('0x3a')]['findAll']({'raw':!![]});})[_0x32a7('0x34')](function(_0x5f2850){var _0x5e4a6d=fs['readFileSync'](path[_0x32a7('0x58')](config[_0x32a7('0x59')],_0x32a7('0x5a')),_0x32a7('0x5b'));var _0x3947de=ejs['render'](_0x5e4a6d,{'contexts':_0x5f2850||[]});fs[_0x32a7('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3947de);})[_0x32a7('0x34')](function(){return respondWithRpcPromise(_0x32a7('0x5d'),_0x32a7('0x57'),{'module':_0x32a7('0x5e')});})[_0x32a7('0x34')](function(){var _0xe75382=_0x135268[_0x32a7('0x5f')][_0x32a7('0x32')]({'plain':!![]});if(!_0xe75382)throw new Error(_0x32a7('0x60'));if(_0xe75382[_0x32a7('0x61')]==='user'){var _0x57166f=_0xac5b57[_0x32a7('0x32')]({'plain':!![]});return db[_0x32a7('0x62')]['find']({'where':{'name':'Contexts','userProfileId':_0xe75382['userProfileId']},'raw':!![]})[_0x32a7('0x34')](function(_0x1914b5){if(_0x1914b5&&_0x1914b5[_0x32a7('0x63')]===0x0){return db[_0x32a7('0x33')][_0x32a7('0x57')]({'name':_0x57166f[_0x32a7('0x37')],'resourceId':_0x57166f['id'],'type':_0x1914b5[_0x32a7('0x37')],'sectionId':_0x1914b5['id']},{})[_0x32a7('0x34')](function(){return _0xac5b57;});}else{return _0xac5b57;}})[_0x32a7('0x25')](function(_0x36333a){logger[_0x32a7('0x23')](_0x32a7('0x64'),_0x36333a);throw _0x36333a;});}return _0xac5b57;})[_0x32a7('0x34')](respondWithResult(_0x28d1f9,0xc9))[_0x32a7('0x25')](handleError(_0x28d1f9,null));};exports[_0x32a7('0x31')]=function(_0x22f5c3,_0x5dac90,_0x24d738){var _0xdd868c;return db[_0x32a7('0x3a')][_0x32a7('0x56')]({'where':{'id':_0x22f5c3[_0x32a7('0x55')]['id']}})[_0x32a7('0x34')](handleEntityNotFound(_0x5dac90,null))[_0x32a7('0x34')](saveUpdates(_0x22f5c3[_0x32a7('0x65')],null))[_0x32a7('0x34')](function(_0x113bd2){if(_0x113bd2){_0xdd868c=_0x113bd2;return db[_0x32a7('0x3a')][_0x32a7('0x53')]({'raw':!![]});}})[_0x32a7('0x34')](function(_0x326a7e){var _0x56b1e0=fs['readFileSync'](path[_0x32a7('0x58')](config[_0x32a7('0x59')],'server/files/templates/context.ejs'),_0x32a7('0x5b'));var _0x29e791=ejs[_0x32a7('0x66')](_0x56b1e0,{'contexts':_0x326a7e||[]});fs[_0x32a7('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x29e791);})[_0x32a7('0x34')](function(){return respondWithRpcPromise(_0x32a7('0x5d'),_0x32a7('0x31'),{'module':_0x32a7('0x5e')});})['then'](function(){return _0xdd868c;})[_0x32a7('0x34')](respondWithResult(_0x5dac90,null))[_0x32a7('0x25')](handleError(_0x5dac90,null));};exports[_0x32a7('0x67')]=function(_0x35b56b,_0x55e282,_0x2231eb){var _0x596200;return db[_0x32a7('0x3a')]['find']({'where':{'id':_0x35b56b[_0x32a7('0x55')]['id']}})[_0x32a7('0x34')](handleEntityNotFound(_0x55e282,null))[_0x32a7('0x34')](removeEntity(_0x55e282,null))[_0x32a7('0x34')](function(){return db['VoiceContext'][_0x32a7('0x53')]({'raw':!![]});})['then'](function(_0x41adaf){var _0x4fe86e=fs[_0x32a7('0x68')](path[_0x32a7('0x58')](config[_0x32a7('0x59')],_0x32a7('0x5a')),_0x32a7('0x5b'));var _0x19dadc=ejs[_0x32a7('0x66')](_0x4fe86e,{'contexts':_0x41adaf});fs[_0x32a7('0x5c')](_0x32a7('0x69'),_0x19dadc);return respondWithRpcPromise(_0x32a7('0x5d'),_0x32a7('0x67'),{'module':_0x32a7('0x5e')});})[_0x32a7('0x25')](handleError(_0x55e282,null));}; \ No newline at end of file +var _0x7bf1=['stack','send','index','map','VoiceContext','rawAttributes','key','model','name','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','rows','params','keys','fields','includeAll','find','create','body','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','client','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','count','Content-Range','apply','reject','update','destroy','get','Contexts','UserProfileResource','then'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7bf1,0x95));var _0x17bf=function(_0x1f4db6,_0x459194){_0x1f4db6=_0x1f4db6-0x0;var _0x32962c=_0x7bf1[_0x1f4db6];return _0x32962c;};'use strict';var emlformat=require(_0x17bf('0x0'));var rimraf=require(_0x17bf('0x1'));var zipdir=require(_0x17bf('0x2'));var jsonpatch=require(_0x17bf('0x3'));var rp=require('request-promise');var moment=require(_0x17bf('0x4'));var BPromise=require(_0x17bf('0x5'));var Mustache=require('mustache');var util=require(_0x17bf('0x6'));var path=require(_0x17bf('0x7'));var sox=require(_0x17bf('0x8'));var csv=require(_0x17bf('0x9'));var ejs=require(_0x17bf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x17bf('0xb'));var crypto=require(_0x17bf('0xc'));var jsforce=require(_0x17bf('0xd'));var deskjs=require(_0x17bf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x17bf('0xf'));var Redis=require('ioredis');var authService=require(_0x17bf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x17bf('0x11'));var hardwareService=require(_0x17bf('0x12'));var logger=require(_0x17bf('0x13'))(_0x17bf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x17bf('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x17bf('0x16')][_0x17bf('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4056aa,_0x4a7b60,_0x262bd0,_0x5a6416){return new BPromise(function(_0x387307,_0x4dd809){var _0x289000=_0x5a6416||client;return _0x289000[_0x17bf('0x18')](_0x4056aa,_0x262bd0)['then'](function(_0x3dae9b){logger['info'](_0x17bf('0x19'),_0x4a7b60,_0x17bf('0x1a'));logger['debug'](_0x17bf('0x1b'),_0x4a7b60,_0x17bf('0x1a'),JSON[_0x17bf('0x1c')](_0x3dae9b));if(_0x3dae9b['error']){if(_0x3dae9b[_0x17bf('0x1d')][_0x17bf('0x1e')]===0x1f4){logger[_0x17bf('0x1d')](_0x17bf('0x19'),_0x4a7b60,_0x3dae9b['error'][_0x17bf('0x1f')]);return _0x4dd809(_0x3dae9b['error'][_0x17bf('0x1f')]);}logger[_0x17bf('0x1d')](_0x17bf('0x19'),_0x4a7b60,_0x3dae9b[_0x17bf('0x1d')][_0x17bf('0x1f')]);return _0x387307(_0x3dae9b[_0x17bf('0x1d')][_0x17bf('0x1f')]);}else{logger['info'](_0x17bf('0x19'),_0x4a7b60,'request\x20sent');_0x387307(_0x3dae9b[_0x17bf('0x20')][_0x17bf('0x1f')]);}})[_0x17bf('0x21')](function(_0x4ec753){logger['error'](_0x17bf('0x19'),_0x4a7b60,_0x4ec753);_0x4dd809(_0x4ec753);});});}function respondWithStatusCode(_0x576a82,_0x3fe6f9){_0x3fe6f9=_0x3fe6f9||0xcc;return function(_0x3dc387){if(_0x3dc387){return _0x576a82[_0x17bf('0x22')](_0x3fe6f9);}return _0x576a82[_0x17bf('0x23')](_0x3fe6f9)[_0x17bf('0x24')]();};}function respondWithResult(_0x3b0b64,_0x1b5f21){_0x1b5f21=_0x1b5f21||0xc8;return function(_0xc411f3){if(_0xc411f3){return _0x3b0b64['status'](_0x1b5f21)['json'](_0xc411f3);}};}function respondWithFilteredResult(_0x5ec67e,_0xdb4d63){return function(_0xa788ef){if(_0xa788ef){var _0x3b3232=typeof _0xdb4d63[_0x17bf('0x25')]==='undefined'&&typeof _0xdb4d63[_0x17bf('0x26')]==='undefined';var _0x35a8f7=_0xa788ef[_0x17bf('0x27')];var _0x2456e9=_0x3b3232?0x0:_0xdb4d63[_0x17bf('0x25')];var _0x53bc88=_0x3b3232?_0xa788ef[_0x17bf('0x27')]:_0xdb4d63['offset']+_0xdb4d63[_0x17bf('0x26')];var _0x50f02f;if(_0x53bc88>=_0x35a8f7){_0x53bc88=_0x35a8f7;_0x50f02f=0xc8;}else{_0x50f02f=0xce;}_0x5ec67e[_0x17bf('0x23')](_0x50f02f);return _0x5ec67e['set'](_0x17bf('0x28'),_0x2456e9+'-'+_0x53bc88+'/'+_0x35a8f7)['json'](_0xa788ef);}return null;};}function patchUpdates(_0x3ee2d7){return function(_0x152832){try{jsonpatch[_0x17bf('0x29')](_0x152832,_0x3ee2d7,!![]);}catch(_0x307020){return BPromise[_0x17bf('0x2a')](_0x307020);}return _0x152832['save']();};}function saveUpdates(_0x4eeb88,_0x2c6aa3){return function(_0x19c9af){if(_0x19c9af){return _0x19c9af[_0x17bf('0x2b')](_0x4eeb88)['then'](function(_0x2eaa7a){return _0x2eaa7a;});}return null;};}function removeEntity(_0x460147,_0x1e7e63){return function(_0x1c80a6){if(_0x1c80a6){return _0x1c80a6[_0x17bf('0x2c')]()['then'](function(){var _0x5c0964=_0x1c80a6[_0x17bf('0x2d')]({'plain':!![]});var _0x7cf749=_0x17bf('0x2e');return db[_0x17bf('0x2f')][_0x17bf('0x2c')]({'where':{'type':_0x7cf749,'resourceId':_0x5c0964['id']}})[_0x17bf('0x30')](function(){return _0x1c80a6;});})[_0x17bf('0x30')](function(){_0x460147['status'](0xcc)[_0x17bf('0x24')]();});}};}function handleEntityNotFound(_0x20e767,_0x123fa5){return function(_0x52ecb8){if(!_0x52ecb8){_0x20e767[_0x17bf('0x22')](0x194);}return _0x52ecb8;};}function handleError(_0x43437f,_0x3f5fa3){_0x3f5fa3=_0x3f5fa3||0x1f4;return function(_0x43c7ca){logger[_0x17bf('0x1d')](_0x43c7ca[_0x17bf('0x31')]);if(_0x43c7ca['name']){delete _0x43c7ca['name'];}_0x43437f[_0x17bf('0x23')](_0x3f5fa3)[_0x17bf('0x32')](_0x43c7ca);};}exports[_0x17bf('0x33')]=function(_0x2f9764,_0x516297){var _0x5751a8={},_0x3bba80={},_0x5f38c3={'count':0x0,'rows':[]};var _0x3615aa=_[_0x17bf('0x34')](db[_0x17bf('0x35')][_0x17bf('0x36')],function(_0x587fcc){return{'name':_0x587fcc['fieldName'],'type':_0x587fcc['type'][_0x17bf('0x37')]};});_0x3bba80[_0x17bf('0x38')]=_[_0x17bf('0x34')](_0x3615aa,_0x17bf('0x39'));_0x3bba80[_0x17bf('0x3a')]=_['keys'](_0x2f9764[_0x17bf('0x3a')]);_0x3bba80[_0x17bf('0x3b')]=_['intersection'](_0x3bba80[_0x17bf('0x38')],_0x3bba80['query']);_0x5751a8[_0x17bf('0x3c')]=_[_0x17bf('0x3d')](_0x3bba80[_0x17bf('0x38')],qs['fields'](_0x2f9764[_0x17bf('0x3a')]['fields']));_0x5751a8[_0x17bf('0x3c')]=_0x5751a8[_0x17bf('0x3c')][_0x17bf('0x3e')]?_0x5751a8['attributes']:_0x3bba80[_0x17bf('0x38')];if(!_0x2f9764[_0x17bf('0x3a')][_0x17bf('0x3f')](_0x17bf('0x40'))){_0x5751a8[_0x17bf('0x26')]=qs['limit'](_0x2f9764[_0x17bf('0x3a')]['limit']);_0x5751a8[_0x17bf('0x25')]=qs[_0x17bf('0x25')](_0x2f9764[_0x17bf('0x3a')][_0x17bf('0x25')]);}_0x5751a8[_0x17bf('0x41')]=qs['sort'](_0x2f9764['query'][_0x17bf('0x42')]);_0x5751a8[_0x17bf('0x43')]=qs[_0x17bf('0x3b')](_[_0x17bf('0x44')](_0x2f9764[_0x17bf('0x3a')],_0x3bba80[_0x17bf('0x3b')]),_0x3615aa);if(_0x2f9764[_0x17bf('0x3a')]['filter']){_0x5751a8['where']=_[_0x17bf('0x45')](_0x5751a8[_0x17bf('0x43')],{'$or':_[_0x17bf('0x34')](_0x3615aa,function(_0x3c192f){if(_0x3c192f[_0x17bf('0x46')]!==_0x17bf('0x47')){var _0x4de9af={};_0x4de9af[_0x3c192f[_0x17bf('0x39')]]={'$like':'%'+_0x2f9764[_0x17bf('0x3a')][_0x17bf('0x48')]+'%'};return _0x4de9af;}})});}_0x5751a8=_['merge']({},_0x5751a8,_0x2f9764[_0x17bf('0x49')]);var _0x399e88={'where':_0x5751a8[_0x17bf('0x43')]};return db[_0x17bf('0x35')]['count'](_0x399e88)[_0x17bf('0x30')](function(_0x5812dc){_0x5f38c3[_0x17bf('0x27')]=_0x5812dc;if(_0x2f9764[_0x17bf('0x3a')]['includeAll']){_0x5751a8['include']=[{'all':!![]}];}return db[_0x17bf('0x35')][_0x17bf('0x4a')](_0x5751a8);})['then'](function(_0x356114){_0x5f38c3[_0x17bf('0x4b')]=_0x356114;return _0x5f38c3;})[_0x17bf('0x30')](respondWithFilteredResult(_0x516297,_0x5751a8))[_0x17bf('0x21')](handleError(_0x516297,null));};exports['show']=function(_0x554b9f,_0x5cc086){var _0x30c253={'raw':![],'where':{'id':_0x554b9f[_0x17bf('0x4c')]['id']}},_0x566689={};_0x566689[_0x17bf('0x38')]=_[_0x17bf('0x4d')](db['VoiceContext'][_0x17bf('0x36')]);_0x566689[_0x17bf('0x3a')]=_[_0x17bf('0x4d')](_0x554b9f[_0x17bf('0x3a')]);_0x566689[_0x17bf('0x3b')]=_['intersection'](_0x566689[_0x17bf('0x38')],_0x566689[_0x17bf('0x3a')]);_0x30c253[_0x17bf('0x3c')]=_[_0x17bf('0x3d')](_0x566689[_0x17bf('0x38')],qs['fields'](_0x554b9f[_0x17bf('0x3a')][_0x17bf('0x4e')]));_0x30c253[_0x17bf('0x3c')]=_0x30c253['attributes'][_0x17bf('0x3e')]?_0x30c253[_0x17bf('0x3c')]:_0x566689[_0x17bf('0x38')];if(_0x554b9f['query'][_0x17bf('0x4f')]){_0x30c253['include']=[{'all':!![]}];}_0x30c253=_[_0x17bf('0x45')]({},_0x30c253,_0x554b9f[_0x17bf('0x49')]);return db[_0x17bf('0x35')][_0x17bf('0x50')](_0x30c253)['then'](handleEntityNotFound(_0x5cc086,null))[_0x17bf('0x30')](respondWithResult(_0x5cc086,null))[_0x17bf('0x21')](handleError(_0x5cc086,null));};exports[_0x17bf('0x51')]=function(_0x23aed5,_0x357fb5,_0x481fa1){var _0x618267;return db[_0x17bf('0x35')]['create'](_0x23aed5[_0x17bf('0x52')],{'raw':!![]})['then'](function(_0x5d68b8){_0x618267=_0x5d68b8;return db['VoiceContext'][_0x17bf('0x4a')]({'raw':!![]});})[_0x17bf('0x30')](function(_0x20c220){var _0x4ba4d1=fs['readFileSync'](path['join'](config[_0x17bf('0x53')],_0x17bf('0x54')),_0x17bf('0x55'));var _0x6e32f5=ejs[_0x17bf('0x56')](_0x4ba4d1,{'contexts':_0x20c220||[]});fs[_0x17bf('0x57')](_0x17bf('0x58'),_0x6e32f5);})[_0x17bf('0x30')](function(){return respondWithRpcPromise(_0x17bf('0x59'),'create',{'module':_0x17bf('0x5a')});})[_0x17bf('0x30')](function(){var _0x2f4fef=_0x23aed5['user'][_0x17bf('0x2d')]({'plain':!![]});if(!_0x2f4fef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f4fef[_0x17bf('0x5b')]===_0x17bf('0x5c')){var _0x5f2e0d=_0x618267[_0x17bf('0x2d')]({'plain':!![]});return db[_0x17bf('0x5d')][_0x17bf('0x50')]({'where':{'name':_0x17bf('0x2e'),'userProfileId':_0x2f4fef[_0x17bf('0x5e')]},'raw':!![]})[_0x17bf('0x30')](function(_0x5c4bbb){if(_0x5c4bbb&&_0x5c4bbb[_0x17bf('0x5f')]===0x0){return db[_0x17bf('0x2f')][_0x17bf('0x51')]({'name':_0x5f2e0d[_0x17bf('0x39')],'resourceId':_0x5f2e0d['id'],'type':_0x5c4bbb[_0x17bf('0x39')],'sectionId':_0x5c4bbb['id']},{})[_0x17bf('0x30')](function(){return _0x618267;});}else{return _0x618267;}})[_0x17bf('0x21')](function(_0x2a4344){logger[_0x17bf('0x1d')](_0x17bf('0x60'),_0x2a4344);throw _0x2a4344;});}return _0x618267;})[_0x17bf('0x30')](respondWithResult(_0x357fb5,0xc9))[_0x17bf('0x21')](handleError(_0x357fb5,null));};exports[_0x17bf('0x2b')]=function(_0x2f06a1,_0x1e5e25,_0x2a38c9){var _0x50840d;return db[_0x17bf('0x35')]['find']({'where':{'id':_0x2f06a1[_0x17bf('0x4c')]['id']}})[_0x17bf('0x30')](handleEntityNotFound(_0x1e5e25,null))[_0x17bf('0x30')](saveUpdates(_0x2f06a1[_0x17bf('0x52')],null))[_0x17bf('0x30')](function(_0x50f63b){if(_0x50f63b){_0x50840d=_0x50f63b;return db[_0x17bf('0x35')][_0x17bf('0x4a')]({'raw':!![]});}})[_0x17bf('0x30')](function(_0x49ba5b){var _0x43d782=fs[_0x17bf('0x61')](path['join'](config[_0x17bf('0x53')],'server/files/templates/context.ejs'),_0x17bf('0x55'));var _0x3a82d6=ejs[_0x17bf('0x56')](_0x43d782,{'contexts':_0x49ba5b||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3a82d6);})['then'](function(){return respondWithRpcPromise(_0x17bf('0x59'),_0x17bf('0x2b'),{'module':_0x17bf('0x5a')});})[_0x17bf('0x30')](function(){return _0x50840d;})['then'](respondWithResult(_0x1e5e25,null))[_0x17bf('0x21')](handleError(_0x1e5e25,null));};exports[_0x17bf('0x2c')]=function(_0x394650,_0x400e14,_0xa0c364){var _0x1305bd;return db[_0x17bf('0x35')][_0x17bf('0x50')]({'where':{'id':_0x394650['params']['id']}})['then'](handleEntityNotFound(_0x400e14,null))['then'](removeEntity(_0x400e14,null))[_0x17bf('0x30')](function(){return db[_0x17bf('0x35')][_0x17bf('0x4a')]({'raw':!![]});})[_0x17bf('0x30')](function(_0x1376db){var _0x55cd9c=fs['readFileSync'](path[_0x17bf('0x62')](config[_0x17bf('0x53')],_0x17bf('0x54')),_0x17bf('0x55'));var _0x2955d9=ejs['render'](_0x55cd9c,{'contexts':_0x1376db});fs[_0x17bf('0x57')](_0x17bf('0x58'),_0x2955d9);return respondWithRpcPromise(_0x17bf('0x59'),'destroy',{'module':_0x17bf('0x5a')});})['catch'](handleError(_0x400e14,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c7ffe94..da5f11e 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x505d=['./voiceContext.attributes','exports','VoiceContext','voice_contexts','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x29f647,_0x23eb0c){var _0x6d5dc9=function(_0x3a0718){while(--_0x3a0718){_0x29f647['push'](_0x29f647['shift']());}};_0x6d5dc9(++_0x23eb0c);}(_0x505d,0x93));var _0xd505=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x505d[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd505('0x0'))(_0xd505('0x1'));var moment=require(_0xd505('0x2'));var BPromise=require(_0xd505('0x3'));var rp=require(_0xd505('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd505('0x5'));var config=require(_0xd505('0x6'));var attributes=require(_0xd505('0x7'));module[_0xd505('0x8')]=function(_0x4ab634,_0x3a2863){return _0x4ab634['define'](_0xd505('0x9'),attributes,{'tableName':_0xd505('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23f0=['voice_contexts','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext'];(function(_0xe64d7a,_0x4a18f9){var _0x4f8596=function(_0x4977c1){while(--_0x4977c1){_0xe64d7a['push'](_0xe64d7a['shift']());}};_0x4f8596(++_0x4a18f9);}(_0x23f0,0x121));var _0x023f=function(_0x3c3054,_0x45a213){_0x3c3054=_0x3c3054-0x0;var _0x4ac38e=_0x23f0[_0x3c3054];return _0x4ac38e;};'use strict';var _=require('lodash');var util=require(_0x023f('0x0'));var logger=require(_0x023f('0x1'))(_0x023f('0x2'));var moment=require('moment');var BPromise=require(_0x023f('0x3'));var rp=require(_0x023f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x023f('0x5'));var config=require(_0x023f('0x6'));var attributes=require(_0x023f('0x7'));module[_0x023f('0x8')]=function(_0x23e367,_0x53f169){return _0x23e367[_0x023f('0x9')](_0x023f('0xa'),attributes,{'tableName':_0x023f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index db7c874..82b7850 100644 --- a/server/api/voiceContext/voiceContext.rpc.js +++ b/server/api/voiceContext/voiceContext.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47c7=['../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x27ebaa,_0x500a67){var _0x2bc168=function(_0x4db3e1){while(--_0x4db3e1){_0x27ebaa['push'](_0x27ebaa['shift']());}};_0x2bc168(++_0x500a67);}(_0x47c7,0x1f3));var _0x747c=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x47c7[_0x20ef64];return _0x3707d8;};'use strict';var _=require('lodash');var util=require(_0x747c('0x0'));var moment=require(_0x747c('0x1'));var BPromise=require(_0x747c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x747c('0x3'))['db'];var utils=require(_0x747c('0x4'));var logger=require(_0x747c('0x5'))(_0x747c('0x6'));var config=require('../../config/environment');var jayson=require(_0x747c('0x7'));var client=jayson['client'][_0x747c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x351f82,_0x808bac,_0x2e0e82){return new BPromise(function(_0x8b3b3b,_0x310e2f){return client[_0x747c('0x9')](_0x351f82,_0x2e0e82)[_0x747c('0xa')](function(_0x2c526d){logger[_0x747c('0xb')](_0x747c('0xc'),_0x808bac,_0x747c('0xd'));logger[_0x747c('0xe')](_0x747c('0xf'),_0x808bac,'request\x20sent',JSON['stringify'](_0x2c526d));if(_0x2c526d[_0x747c('0x10')]){if(_0x2c526d[_0x747c('0x10')][_0x747c('0x11')]===0x1f4){logger[_0x747c('0x10')]('VoiceContext,\x20%s,\x20%s',_0x808bac,_0x2c526d['error'][_0x747c('0x12')]);return _0x310e2f(_0x2c526d[_0x747c('0x10')][_0x747c('0x12')]);}logger[_0x747c('0x10')](_0x747c('0xc'),_0x808bac,_0x2c526d[_0x747c('0x10')][_0x747c('0x12')]);return _0x8b3b3b(_0x2c526d[_0x747c('0x10')]['message']);}else{logger[_0x747c('0xb')](_0x747c('0xc'),_0x808bac,_0x747c('0xd'));_0x8b3b3b(_0x2c526d[_0x747c('0x13')]['message']);}})[_0x747c('0x14')](function(_0x197f70){logger['error']('VoiceContext,\x20%s,\x20%s',_0x808bac,_0x197f70);_0x310e2f(_0x197f70);});});} \ No newline at end of file +var _0x6739=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x43e3d0,_0x52af6e){var _0x4823a9=function(_0x48b1d1){while(--_0x48b1d1){_0x43e3d0['push'](_0x43e3d0['shift']());}};_0x4823a9(++_0x52af6e);}(_0x6739,0xd3));var _0x9673=function(_0x564673,_0x355e77){_0x564673=_0x564673-0x0;var _0x1fa88c=_0x6739[_0x564673];return _0x1fa88c;};'use strict';var _=require(_0x9673('0x0'));var util=require(_0x9673('0x1'));var moment=require(_0x9673('0x2'));var BPromise=require(_0x9673('0x3'));var rs=require(_0x9673('0x4'));var fs=require('fs');var Redis=require(_0x9673('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9673('0x6'))('rpc');var config=require(_0x9673('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9673('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ad052,_0x3f82df,_0x4981d9){return new BPromise(function(_0x4e1dd5,_0x39b0f0){return client[_0x9673('0x9')](_0x3ad052,_0x4981d9)[_0x9673('0xa')](function(_0x509966){logger[_0x9673('0xb')](_0x9673('0xc'),_0x3f82df,_0x9673('0xd'));logger['debug'](_0x9673('0xe'),_0x3f82df,_0x9673('0xd'),JSON[_0x9673('0xf')](_0x509966));if(_0x509966[_0x9673('0x10')]){if(_0x509966['error'][_0x9673('0x11')]===0x1f4){logger[_0x9673('0x10')](_0x9673('0xc'),_0x3f82df,_0x509966[_0x9673('0x10')]['message']);return _0x39b0f0(_0x509966[_0x9673('0x10')][_0x9673('0x12')]);}logger['error'](_0x9673('0xc'),_0x3f82df,_0x509966[_0x9673('0x10')][_0x9673('0x12')]);return _0x4e1dd5(_0x509966['error'][_0x9673('0x12')]);}else{logger['info'](_0x9673('0xc'),_0x3f82df,'request\x20sent');_0x4e1dd5(_0x509966['result'][_0x9673('0x12')]);}})['catch'](function(_0x3d5642){logger[_0x9673('0x10')]('VoiceContext,\x20%s,\x20%s',_0x3f82df,_0x3d5642);_0x39b0f0(_0x3d5642);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 1060d31..ff93d2b 100644 --- a/server/api/voiceDialReport/index.js +++ b/server/api/voiceDialReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc40b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x2ade26,_0x4698de){var _0x175346=function(_0x4ff92a){while(--_0x4ff92a){_0x2ade26['push'](_0x2ade26['shift']());}};_0x175346(++_0x4698de);}(_0xc40b,0x95));var _0xbc40=function(_0x221840,_0x2a5fb7){_0x221840=_0x221840-0x0;var _0x4706e3=_0xc40b[_0x221840];return _0x4706e3;};'use strict';var multer=require(_0xbc40('0x0'));var util=require('util');var path=require(_0xbc40('0x1'));var timeout=require(_0xbc40('0x2'));var express=require('express');var router=express[_0xbc40('0x3')]();var fs_extra=require(_0xbc40('0x4'));var auth=require(_0xbc40('0x5'));var interaction=require(_0xbc40('0x6'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0xbc40('0x7')]('/',auth[_0xbc40('0x8')](),controller[_0xbc40('0x9')]);router[_0xbc40('0x7')](_0xbc40('0xa'),auth['isAuthenticated'](),controller[_0xbc40('0xb')]);router[_0xbc40('0x7')](_0xbc40('0xc'),auth[_0xbc40('0x8')](),controller[_0xbc40('0xd')]);router[_0xbc40('0xe')]('/',auth[_0xbc40('0x8')](),controller['create']);router['put']('/:id',auth[_0xbc40('0x8')](),controller[_0xbc40('0xf')]);router[_0xbc40('0x10')](_0xbc40('0xc'),auth['isAuthenticated'](),controller[_0xbc40('0x11')]);module[_0xbc40('0x12')]=router; \ No newline at end of file +var _0xe4ba=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xe4ba,0x190));var _0xae4b=function(_0xac2a17,_0x43992e){_0xac2a17=_0xac2a17-0x0;var _0x1a43ff=_0xe4ba[_0xac2a17];return _0x1a43ff;};'use strict';var multer=require('multer');var util=require(_0xae4b('0x0'));var path=require('path');var timeout=require(_0xae4b('0x1'));var express=require(_0xae4b('0x2'));var router=express[_0xae4b('0x3')]();var fs_extra=require(_0xae4b('0x4'));var auth=require(_0xae4b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xae4b('0x6'));var controller=require(_0xae4b('0x7'));router[_0xae4b('0x8')]('/',auth[_0xae4b('0x9')](),controller[_0xae4b('0xa')]);router['get'](_0xae4b('0xb'),auth[_0xae4b('0x9')](),controller['describe']);router['get'](_0xae4b('0xc'),auth[_0xae4b('0x9')](),controller[_0xae4b('0xd')]);router[_0xae4b('0xe')]('/',auth[_0xae4b('0x9')](),controller['create']);router['put'](_0xae4b('0xc'),auth[_0xae4b('0x9')](),controller[_0xae4b('0xf')]);router[_0xae4b('0x10')](_0xae4b('0xc'),auth[_0xae4b('0x9')](),controller[_0xae4b('0x11')]);module[_0xae4b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 265b6e4..2aade98 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xe14d,0x1ee));var _0xde14=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe14d[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'privilege':{'type':Sequelize[_0xde14('0x2')]},'channel':{'type':Sequelize[_0xde14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'calleridnum':{'type':Sequelize[_0xde14('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'connectedlinename':{'type':Sequelize[_0xde14('0x2')]},'language':{'type':Sequelize[_0xde14('0x2')]},'accountcode':{'type':Sequelize[_0xde14('0x2')]},'context':{'type':Sequelize[_0xde14('0x2')]},'exten':{'type':Sequelize[_0xde14('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xde14('0x2')]},'destchannel':{'type':Sequelize[_0xde14('0x2')]},'destchannelstate':{'type':Sequelize[_0xde14('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xde14('0x2')]},'destcalleridname':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xde14('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xde14('0x2')]},'destcontext':{'type':Sequelize[_0xde14('0x2')]},'destexten':{'type':Sequelize[_0xde14('0x2')]},'destpriority':{'type':Sequelize[_0xde14('0x3')]},'destuniqueid':{'type':Sequelize[_0xde14('0x2')]},'destlinkedid':{'type':Sequelize[_0xde14('0x2')]},'dialstring':{'type':Sequelize[_0xde14('0x2')]},'dialstatus':{'type':Sequelize[_0xde14('0x2')]},'starttime':{'type':Sequelize[_0xde14('0x4')]},'answertime':{'type':Sequelize[_0xde14('0x4')]},'endtime':{'type':Sequelize[_0xde14('0x4')]},'lastevent':{'type':Sequelize[_0xde14('0x2')],'comment':_0xde14('0x5')},'routeId':{'type':Sequelize[_0xde14('0x3')]},'duration':{'type':Sequelize[_0xde14('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x415fed,_0xa1e6c7){var _0x31409e=function(_0x2bcc74){while(--_0x2bcc74){_0x415fed['push'](_0x415fed['shift']());}};_0x31409e(++_0xa1e6c7);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f68ad,_0x151e56){_0x4f68ad=_0x4f68ad-0x0;var _0x380f45=_0xedd9[_0x4f68ad];return _0x380f45;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index bb71efe..55d83b8 100644 --- a/server/api/voiceDialReport/voiceDialReport.controller.js +++ b/server/api/voiceDialReport/voiceDialReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa66e=['destroy','sendStatus','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','update','find','describe','eml-format','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then'];(function(_0x139ea8,_0x135b29){var _0x45a658=function(_0x4c70f2){while(--_0x4c70f2){_0x139ea8['push'](_0x139ea8['shift']());}};_0x45a658(++_0x135b29);}(_0xa66e,0xb8));var _0xea66=function(_0x287118,_0x39dcf9){_0x287118=_0x287118-0x0;var _0x5119fb=_0xa66e[_0x287118];return _0x5119fb;};'use strict';var emlformat=require(_0xea66('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea66('0x1'));var BPromise=require(_0xea66('0x2'));var Mustache=require(_0xea66('0x3'));var util=require('util');var path=require(_0xea66('0x4'));var sox=require(_0xea66('0x5'));var csv=require(_0xea66('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea66('0x7'));var _=require(_0xea66('0x8'));var squel=require(_0xea66('0x9'));var crypto=require('crypto');var jsforce=require(_0xea66('0xa'));var deskjs=require(_0xea66('0xb'));var toCsv=require(_0xea66('0x6'));var querystring=require(_0xea66('0xc'));var Papa=require(_0xea66('0xd'));var Redis=require('ioredis');var authService=require(_0xea66('0xe'));var qs=require(_0xea66('0xf'));var as=require(_0xea66('0x10'));var hardwareService=require(_0xea66('0x11'));var logger=require('../../config/logger')(_0xea66('0x12'));var utils=require(_0xea66('0x13'));var config=require(_0xea66('0x14'));var licenseUtil=require(_0xea66('0x15'));var db=require(_0xea66('0x16'))['db'];function respondWithStatusCode(_0x1b8e9a,_0x41aaf5){_0x41aaf5=_0x41aaf5||0xcc;return function(_0x277eb0){if(_0x277eb0){return _0x1b8e9a['sendStatus'](_0x41aaf5);}return _0x1b8e9a[_0xea66('0x17')](_0x41aaf5)[_0xea66('0x18')]();};}function respondWithResult(_0x5eb30b,_0x475c3f){_0x475c3f=_0x475c3f||0xc8;return function(_0x37bec3){if(_0x37bec3){return _0x5eb30b[_0xea66('0x17')](_0x475c3f)[_0xea66('0x19')](_0x37bec3);}};}function respondWithFilteredResult(_0x200330,_0x56d2a9){return function(_0x4ff844){if(_0x4ff844){var _0x371e04=typeof _0x56d2a9[_0xea66('0x1a')]===_0xea66('0x1b')&&typeof _0x56d2a9[_0xea66('0x1c')]===_0xea66('0x1b');var _0x52eb75=_0x4ff844[_0xea66('0x1d')];var _0x5b45d8=_0x371e04?0x0:_0x56d2a9[_0xea66('0x1a')];var _0x29d23f=_0x371e04?_0x4ff844[_0xea66('0x1d')]:_0x56d2a9['offset']+_0x56d2a9[_0xea66('0x1c')];var _0x50fc93;if(_0x29d23f>=_0x52eb75){_0x29d23f=_0x52eb75;_0x50fc93=0xc8;}else{_0x50fc93=0xce;}_0x200330['status'](_0x50fc93);return _0x200330['set'](_0xea66('0x1e'),_0x5b45d8+'-'+_0x29d23f+'/'+_0x52eb75)[_0xea66('0x19')](_0x4ff844);}return null;};}function patchUpdates(_0x362972){return function(_0x500cf5){try{jsonpatch[_0xea66('0x1f')](_0x500cf5,_0x362972,!![]);}catch(_0x5afb42){return BPromise[_0xea66('0x20')](_0x5afb42);}return _0x500cf5[_0xea66('0x21')]();};}function saveUpdates(_0x3d40df,_0x221802){return function(_0x4551b2){if(_0x4551b2){return _0x4551b2['update'](_0x3d40df)[_0xea66('0x22')](function(_0x409124){return _0x409124;});}return null;};}function removeEntity(_0x1313e5,_0x200293){return function(_0x5c3801){if(_0x5c3801){return _0x5c3801[_0xea66('0x23')]()[_0xea66('0x22')](function(){_0x1313e5['status'](0xcc)[_0xea66('0x18')]();});}};}function handleEntityNotFound(_0x43847d,_0x27ffcc){return function(_0x527c44){if(!_0x527c44){_0x43847d[_0xea66('0x24')](0x194);}return _0x527c44;};}function handleError(_0x124237,_0x55aca9){_0x55aca9=_0x55aca9||0x1f4;return function(_0x3906f0){logger['error'](_0x3906f0[_0xea66('0x25')]);if(_0x3906f0[_0xea66('0x26')]){delete _0x3906f0[_0xea66('0x26')];}_0x124237['status'](_0x55aca9)[_0xea66('0x27')](_0x3906f0);};}exports['index']=function(_0xc3cc0a,_0xe1afbf){var _0x36c42a={},_0x5561a3={},_0x224ce2={'count':0x0,'rows':[]};var _0xaddf33=_[_0xea66('0x28')](db[_0xea66('0x29')][_0xea66('0x2a')],function(_0x4ef750){return{'name':_0x4ef750[_0xea66('0x2b')],'type':_0x4ef750[_0xea66('0x2c')]['key']};});_0x5561a3[_0xea66('0x2d')]=_[_0xea66('0x28')](_0xaddf33,_0xea66('0x26'));_0x5561a3[_0xea66('0x2e')]=_[_0xea66('0x2f')](_0xc3cc0a[_0xea66('0x2e')]);_0x5561a3[_0xea66('0x30')]=_[_0xea66('0x31')](_0x5561a3['model'],_0x5561a3[_0xea66('0x2e')]);_0x36c42a[_0xea66('0x32')]=_['intersection'](_0x5561a3[_0xea66('0x2d')],qs[_0xea66('0x33')](_0xc3cc0a['query'][_0xea66('0x33')]));_0x36c42a['attributes']=_0x36c42a[_0xea66('0x32')][_0xea66('0x34')]?_0x36c42a['attributes']:_0x5561a3[_0xea66('0x2d')];if(!_0xc3cc0a['query'][_0xea66('0x35')](_0xea66('0x36'))){_0x36c42a['limit']=qs[_0xea66('0x1c')](_0xc3cc0a[_0xea66('0x2e')]['limit']);_0x36c42a['offset']=qs[_0xea66('0x1a')](_0xc3cc0a[_0xea66('0x2e')][_0xea66('0x1a')]);}_0x36c42a[_0xea66('0x37')]=qs[_0xea66('0x38')](_0xc3cc0a[_0xea66('0x2e')][_0xea66('0x38')]);_0x36c42a['where']=qs[_0xea66('0x30')](_[_0xea66('0x39')](_0xc3cc0a['query'],_0x5561a3[_0xea66('0x30')]),_0xaddf33);if(_0xc3cc0a[_0xea66('0x2e')][_0xea66('0x3a')]){_0x36c42a['where']=_[_0xea66('0x3b')](_0x36c42a[_0xea66('0x3c')],{'$or':_[_0xea66('0x28')](_0xaddf33,function(_0x579dd5){if(_0x579dd5['type']!==_0xea66('0x3d')){var _0x3e2ac7={};_0x3e2ac7[_0x579dd5['name']]={'$like':'%'+_0xc3cc0a['query']['filter']+'%'};return _0x3e2ac7;}})});}_0x36c42a=_[_0xea66('0x3b')]({},_0x36c42a,_0xc3cc0a[_0xea66('0x3e')]);var _0x31d9fd={'where':_0x36c42a[_0xea66('0x3c')]};return db[_0xea66('0x29')][_0xea66('0x1d')](_0x31d9fd)[_0xea66('0x22')](function(_0x3a42df){_0x224ce2['count']=_0x3a42df;if(_0xc3cc0a[_0xea66('0x2e')][_0xea66('0x3f')]){_0x36c42a[_0xea66('0x40')]=[{'all':!![]}];}return db[_0xea66('0x29')][_0xea66('0x41')](_0x36c42a);})[_0xea66('0x22')](function(_0x2e6ead){_0x224ce2['rows']=_0x2e6ead;return _0x224ce2;})[_0xea66('0x22')](respondWithFilteredResult(_0xe1afbf,_0x36c42a))[_0xea66('0x42')](handleError(_0xe1afbf,null));};exports['show']=function(_0x3f84c5,_0x1988ad){var _0x2b8872={'raw':!![],'where':{'id':_0x3f84c5[_0xea66('0x43')]['id']}},_0x42ac25={};_0x42ac25[_0xea66('0x2d')]=_[_0xea66('0x2f')](db['VoiceDialReport'][_0xea66('0x2a')]);_0x42ac25[_0xea66('0x2e')]=_['keys'](_0x3f84c5['query']);_0x42ac25['filters']=_[_0xea66('0x31')](_0x42ac25[_0xea66('0x2d')],_0x42ac25[_0xea66('0x2e')]);_0x2b8872[_0xea66('0x32')]=_[_0xea66('0x31')](_0x42ac25[_0xea66('0x2d')],qs['fields'](_0x3f84c5[_0xea66('0x2e')][_0xea66('0x33')]));_0x2b8872[_0xea66('0x32')]=_0x2b8872['attributes']['length']?_0x2b8872[_0xea66('0x32')]:_0x42ac25[_0xea66('0x2d')];if(_0x3f84c5[_0xea66('0x2e')]['includeAll']){_0x2b8872[_0xea66('0x40')]=[{'all':!![]}];}_0x2b8872=_[_0xea66('0x3b')]({},_0x2b8872,_0x3f84c5[_0xea66('0x3e')]);return db['VoiceDialReport']['find'](_0x2b8872)[_0xea66('0x22')](handleEntityNotFound(_0x1988ad,null))[_0xea66('0x22')](respondWithResult(_0x1988ad,null))[_0xea66('0x42')](handleError(_0x1988ad,null));};exports[_0xea66('0x44')]=function(_0x468202,_0x303f19){return db[_0xea66('0x29')][_0xea66('0x44')](_0x468202[_0xea66('0x45')],{})[_0xea66('0x22')](respondWithResult(_0x303f19,0xc9))['catch'](handleError(_0x303f19,null));};exports[_0xea66('0x46')]=function(_0x4a5033,_0xff6b50){if(_0x4a5033['body']['id']){delete _0x4a5033[_0xea66('0x45')]['id'];}return db[_0xea66('0x29')][_0xea66('0x47')]({'where':{'id':_0x4a5033[_0xea66('0x43')]['id']}})['then'](handleEntityNotFound(_0xff6b50,null))[_0xea66('0x22')](saveUpdates(_0x4a5033['body'],null))[_0xea66('0x22')](respondWithResult(_0xff6b50,null))[_0xea66('0x42')](handleError(_0xff6b50,null));};exports['destroy']=function(_0x425d24,_0x6c1677){return db[_0xea66('0x29')]['find']({'where':{'id':_0x425d24[_0xea66('0x43')]['id']}})[_0xea66('0x22')](handleEntityNotFound(_0x6c1677,null))[_0xea66('0x22')](removeEntity(_0x6c1677,null))[_0xea66('0x42')](handleError(_0x6c1677,null));};exports[_0xea66('0x48')]=function(_0x2c0f87,_0x95f94c){return db[_0xea66('0x29')][_0xea66('0x48')]()[_0xea66('0x22')](respondWithResult(_0x95f94c,null))['catch'](handleError(_0x95f94c,null));}; \ No newline at end of file +var _0x58c2=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VoiceDialReport','includeAll','rows','catch','keys','include','options','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x131604,_0x475a68){var _0x4a2aea=function(_0xa43f77){while(--_0xa43f77){_0x131604['push'](_0x131604['shift']());}};_0x4a2aea(++_0x475a68);}(_0x58c2,0xcd));var _0x258c=function(_0x154584,_0x421e12){_0x154584=_0x154584-0x0;var _0x969074=_0x58c2[_0x154584];return _0x969074;};'use strict';var emlformat=require(_0x258c('0x0'));var rimraf=require(_0x258c('0x1'));var zipdir=require(_0x258c('0x2'));var jsonpatch=require(_0x258c('0x3'));var rp=require(_0x258c('0x4'));var moment=require(_0x258c('0x5'));var BPromise=require(_0x258c('0x6'));var Mustache=require(_0x258c('0x7'));var util=require(_0x258c('0x8'));var path=require(_0x258c('0x9'));var sox=require(_0x258c('0xa'));var csv=require(_0x258c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x258c('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x258c('0xd'));var jsforce=require(_0x258c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x258c('0xb'));var querystring=require(_0x258c('0xf'));var Papa=require(_0x258c('0x10'));var Redis=require(_0x258c('0x11'));var authService=require(_0x258c('0x12'));var qs=require(_0x258c('0x13'));var as=require(_0x258c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x258c('0x15'))(_0x258c('0x16'));var utils=require(_0x258c('0x17'));var config=require(_0x258c('0x18'));var licenseUtil=require(_0x258c('0x19'));var db=require(_0x258c('0x1a'))['db'];function respondWithStatusCode(_0x1360fe,_0x4316d2){_0x4316d2=_0x4316d2||0xcc;return function(_0x487339){if(_0x487339){return _0x1360fe[_0x258c('0x1b')](_0x4316d2);}return _0x1360fe[_0x258c('0x1c')](_0x4316d2)[_0x258c('0x1d')]();};}function respondWithResult(_0x4e94fa,_0x3daca2){_0x3daca2=_0x3daca2||0xc8;return function(_0x5ea775){if(_0x5ea775){return _0x4e94fa[_0x258c('0x1c')](_0x3daca2)[_0x258c('0x1e')](_0x5ea775);}};}function respondWithFilteredResult(_0x3c794e,_0x52fd6a){return function(_0x901d8e){if(_0x901d8e){var _0x5b4a79=typeof _0x52fd6a['offset']===_0x258c('0x1f')&&typeof _0x52fd6a[_0x258c('0x20')]==='undefined';var _0x183ef1=_0x901d8e[_0x258c('0x21')];var _0x26e032=_0x5b4a79?0x0:_0x52fd6a[_0x258c('0x22')];var _0x5622cb=_0x5b4a79?_0x901d8e[_0x258c('0x21')]:_0x52fd6a['offset']+_0x52fd6a[_0x258c('0x20')];var _0x3d5ae1;if(_0x5622cb>=_0x183ef1){_0x5622cb=_0x183ef1;_0x3d5ae1=0xc8;}else{_0x3d5ae1=0xce;}_0x3c794e[_0x258c('0x1c')](_0x3d5ae1);return _0x3c794e[_0x258c('0x23')](_0x258c('0x24'),_0x26e032+'-'+_0x5622cb+'/'+_0x183ef1)[_0x258c('0x1e')](_0x901d8e);}return null;};}function patchUpdates(_0xff7010){return function(_0x1db28d){try{jsonpatch[_0x258c('0x25')](_0x1db28d,_0xff7010,!![]);}catch(_0x36c9f4){return BPromise['reject'](_0x36c9f4);}return _0x1db28d['save']();};}function saveUpdates(_0x3aad44,_0x4df248){return function(_0x13fec3){if(_0x13fec3){return _0x13fec3[_0x258c('0x26')](_0x3aad44)[_0x258c('0x27')](function(_0x2b920b){return _0x2b920b;});}return null;};}function removeEntity(_0x2be344,_0x36ff29){return function(_0x58e7e7){if(_0x58e7e7){return _0x58e7e7['destroy']()[_0x258c('0x27')](function(){_0x2be344[_0x258c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3495da,_0x3a95f0){return function(_0x591c59){if(!_0x591c59){_0x3495da[_0x258c('0x1b')](0x194);}return _0x591c59;};}function handleError(_0x41a219,_0x48d305){_0x48d305=_0x48d305||0x1f4;return function(_0x5077ba){logger[_0x258c('0x28')](_0x5077ba[_0x258c('0x29')]);if(_0x5077ba['name']){delete _0x5077ba[_0x258c('0x2a')];}_0x41a219['status'](_0x48d305)[_0x258c('0x2b')](_0x5077ba);};}exports[_0x258c('0x2c')]=function(_0x4e2ef2,_0x4e59bb){var _0x2f3b97={},_0xd1ab79={},_0x5801f9={'count':0x0,'rows':[]};var _0x1b0d03=_[_0x258c('0x2d')](db['VoiceDialReport'][_0x258c('0x2e')],function(_0x123757){return{'name':_0x123757['fieldName'],'type':_0x123757[_0x258c('0x2f')][_0x258c('0x30')]};});_0xd1ab79[_0x258c('0x31')]=_[_0x258c('0x2d')](_0x1b0d03,_0x258c('0x2a'));_0xd1ab79[_0x258c('0x32')]=_['keys'](_0x4e2ef2['query']);_0xd1ab79['filters']=_[_0x258c('0x33')](_0xd1ab79['model'],_0xd1ab79[_0x258c('0x32')]);_0x2f3b97[_0x258c('0x34')]=_['intersection'](_0xd1ab79[_0x258c('0x31')],qs['fields'](_0x4e2ef2[_0x258c('0x32')][_0x258c('0x35')]));_0x2f3b97[_0x258c('0x34')]=_0x2f3b97[_0x258c('0x34')][_0x258c('0x36')]?_0x2f3b97[_0x258c('0x34')]:_0xd1ab79[_0x258c('0x31')];if(!_0x4e2ef2[_0x258c('0x32')][_0x258c('0x37')]('nolimit')){_0x2f3b97['limit']=qs[_0x258c('0x20')](_0x4e2ef2[_0x258c('0x32')]['limit']);_0x2f3b97['offset']=qs[_0x258c('0x22')](_0x4e2ef2[_0x258c('0x32')][_0x258c('0x22')]);}_0x2f3b97[_0x258c('0x38')]=qs[_0x258c('0x39')](_0x4e2ef2['query'][_0x258c('0x39')]);_0x2f3b97['where']=qs[_0x258c('0x3a')](_[_0x258c('0x3b')](_0x4e2ef2['query'],_0xd1ab79[_0x258c('0x3a')]),_0x1b0d03);if(_0x4e2ef2[_0x258c('0x32')]['filter']){_0x2f3b97[_0x258c('0x3c')]=_[_0x258c('0x3d')](_0x2f3b97[_0x258c('0x3c')],{'$or':_[_0x258c('0x2d')](_0x1b0d03,function(_0x44cc6f){if(_0x44cc6f[_0x258c('0x2f')]!=='VIRTUAL'){var _0x591f17={};_0x591f17[_0x44cc6f['name']]={'$like':'%'+_0x4e2ef2[_0x258c('0x32')]['filter']+'%'};return _0x591f17;}})});}_0x2f3b97=_[_0x258c('0x3d')]({},_0x2f3b97,_0x4e2ef2['options']);var _0x1b62d5={'where':_0x2f3b97[_0x258c('0x3c')]};return db[_0x258c('0x3e')][_0x258c('0x21')](_0x1b62d5)[_0x258c('0x27')](function(_0x256104){_0x5801f9[_0x258c('0x21')]=_0x256104;if(_0x4e2ef2[_0x258c('0x32')][_0x258c('0x3f')]){_0x2f3b97['include']=[{'all':!![]}];}return db[_0x258c('0x3e')]['findAll'](_0x2f3b97);})[_0x258c('0x27')](function(_0x376cf3){_0x5801f9[_0x258c('0x40')]=_0x376cf3;return _0x5801f9;})[_0x258c('0x27')](respondWithFilteredResult(_0x4e59bb,_0x2f3b97))[_0x258c('0x41')](handleError(_0x4e59bb,null));};exports['show']=function(_0x4b8476,_0x41a4f4){var _0x216c1a={'raw':!![],'where':{'id':_0x4b8476['params']['id']}},_0x30b5ba={};_0x30b5ba['model']=_[_0x258c('0x42')](db[_0x258c('0x3e')]['rawAttributes']);_0x30b5ba[_0x258c('0x32')]=_[_0x258c('0x42')](_0x4b8476['query']);_0x30b5ba['filters']=_['intersection'](_0x30b5ba[_0x258c('0x31')],_0x30b5ba[_0x258c('0x32')]);_0x216c1a[_0x258c('0x34')]=_['intersection'](_0x30b5ba[_0x258c('0x31')],qs['fields'](_0x4b8476[_0x258c('0x32')][_0x258c('0x35')]));_0x216c1a[_0x258c('0x34')]=_0x216c1a[_0x258c('0x34')]['length']?_0x216c1a[_0x258c('0x34')]:_0x30b5ba['model'];if(_0x4b8476[_0x258c('0x32')][_0x258c('0x3f')]){_0x216c1a[_0x258c('0x43')]=[{'all':!![]}];}_0x216c1a=_[_0x258c('0x3d')]({},_0x216c1a,_0x4b8476[_0x258c('0x44')]);return db[_0x258c('0x3e')]['find'](_0x216c1a)[_0x258c('0x27')](handleEntityNotFound(_0x41a4f4,null))[_0x258c('0x27')](respondWithResult(_0x41a4f4,null))[_0x258c('0x41')](handleError(_0x41a4f4,null));};exports[_0x258c('0x45')]=function(_0x42b94a,_0x22a4ef){return db[_0x258c('0x3e')][_0x258c('0x45')](_0x42b94a[_0x258c('0x46')],{})[_0x258c('0x27')](respondWithResult(_0x22a4ef,0xc9))['catch'](handleError(_0x22a4ef,null));};exports[_0x258c('0x26')]=function(_0x3488be,_0x4fff46){if(_0x3488be[_0x258c('0x46')]['id']){delete _0x3488be[_0x258c('0x46')]['id'];}return db[_0x258c('0x3e')][_0x258c('0x47')]({'where':{'id':_0x3488be[_0x258c('0x48')]['id']}})[_0x258c('0x27')](handleEntityNotFound(_0x4fff46,null))[_0x258c('0x27')](saveUpdates(_0x3488be[_0x258c('0x46')],null))['then'](respondWithResult(_0x4fff46,null))[_0x258c('0x41')](handleError(_0x4fff46,null));};exports[_0x258c('0x49')]=function(_0x4e8311,_0x4a8092){return db['VoiceDialReport'][_0x258c('0x47')]({'where':{'id':_0x4e8311[_0x258c('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a8092,null))[_0x258c('0x27')](removeEntity(_0x4a8092,null))[_0x258c('0x41')](handleError(_0x4a8092,null));};exports[_0x258c('0x4a')]=function(_0x24cbf1,_0x3b29e1){return db[_0x258c('0x3e')]['describe']()[_0x258c('0x27')](respondWithResult(_0x3b29e1,null))['catch'](handleError(_0x3b29e1,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7faf27e..e874c3a 100644 --- a/server/api/voiceDialReport/voiceDialReport.model.js +++ b/server/api/voiceDialReport/voiceDialReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4294=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x4294,0x6c));var _0x4429=function(_0x22eea4,_0xd948eb){_0x22eea4=_0x22eea4-0x0;var _0x3a74fa=_0x4294[_0x22eea4];return _0x3a74fa;};'use strict';var _=require(_0x4429('0x0'));var util=require(_0x4429('0x1'));var logger=require('../../config/logger')(_0x4429('0x2'));var moment=require(_0x4429('0x3'));var BPromise=require('bluebird');var rp=require(_0x4429('0x4'));var fs=require('fs');var path=require(_0x4429('0x5'));var rimraf=require(_0x4429('0x6'));var config=require(_0x4429('0x7'));var attributes=require(_0x4429('0x8'));module[_0x4429('0x9')]=function(_0x21f894,_0x360591){return _0x21f894[_0x4429('0xa')](_0x4429('0xb'),attributes,{'tableName':_0x4429('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4429('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3178=['define','VoiceDialReport','report_dial','uniqueid','api','bluebird','request-promise','rimraf','./voiceDialReport.attributes','exports'];(function(_0xd9e029,_0x2ba791){var _0x516c03=function(_0x9852ac){while(--_0x9852ac){_0xd9e029['push'](_0xd9e029['shift']());}};_0x516c03(++_0x2ba791);}(_0x3178,0x176));var _0x8317=function(_0x193836,_0x4f8a75){_0x193836=_0x193836-0x0;var _0x2fec34=_0x3178[_0x193836];return _0x2fec34;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8317('0x0'));var moment=require('moment');var BPromise=require(_0x8317('0x1'));var rp=require(_0x8317('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8317('0x3'));var config=require('../../config/environment');var attributes=require(_0x8317('0x4'));module[_0x8317('0x5')]=function(_0x1677b7,_0x649d81){return _0x1677b7[_0x8317('0x6')](_0x8317('0x7'),attributes,{'tableName':_0x8317('0x8'),'paranoid':![],'indexes':[{'fields':[_0x8317('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 2e289f8..949ca62 100644 --- a/server/api/voiceDialReport/voiceDialReport.rpc.js +++ b/server/api/voiceDialReport/voiceDialReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a03=['update','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0x1a03,0xf1));var _0x31a0=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x1a03[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x31a0('0x0'));var util=require(_0x31a0('0x1'));var moment=require(_0x31a0('0x2'));var BPromise=require(_0x31a0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31a0('0x4'));var db=require(_0x31a0('0x5'))['db'];var utils=require(_0x31a0('0x6'));var logger=require(_0x31a0('0x7'))(_0x31a0('0x8'));var config=require(_0x31a0('0x9'));var jayson=require(_0x31a0('0xa'));var client=jayson[_0x31a0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c55e2,_0x5e1499,_0x4d5080){return new BPromise(function(_0x4f256c,_0x31c66d){return client[_0x31a0('0xc')](_0x2c55e2,_0x4d5080)[_0x31a0('0xd')](function(_0x53de4f){logger[_0x31a0('0xe')](_0x31a0('0xf'),_0x5e1499,'request\x20sent');logger['debug'](_0x31a0('0x10'),_0x5e1499,_0x31a0('0x11'),JSON['stringify'](_0x53de4f));if(_0x53de4f[_0x31a0('0x12')]){if(_0x53de4f[_0x31a0('0x12')][_0x31a0('0x13')]===0x1f4){logger['error'](_0x31a0('0xf'),_0x5e1499,_0x53de4f[_0x31a0('0x12')][_0x31a0('0x14')]);return _0x31c66d(_0x53de4f[_0x31a0('0x12')][_0x31a0('0x14')]);}logger[_0x31a0('0x12')](_0x31a0('0xf'),_0x5e1499,_0x53de4f[_0x31a0('0x12')][_0x31a0('0x14')]);return _0x4f256c(_0x53de4f[_0x31a0('0x12')][_0x31a0('0x14')]);}else{logger['info'](_0x31a0('0xf'),_0x5e1499,_0x31a0('0x11'));_0x4f256c(_0x53de4f[_0x31a0('0x15')][_0x31a0('0x14')]);}})[_0x31a0('0x16')](function(_0x315d30){logger[_0x31a0('0x12')](_0x31a0('0xf'),_0x5e1499,_0x315d30);_0x31c66d(_0x315d30);});});}exports[_0x31a0('0x17')]=function(_0x5d01e4){var _0xfbade1=this;return new Promise(function(_0x1886ee,_0x1e04e4){return db[_0x31a0('0x18')][_0x31a0('0x19')](_0x5d01e4[_0x31a0('0x1a')],{'raw':_0x5d01e4[_0x31a0('0x1b')]?_0x5d01e4['options'][_0x31a0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4935f2){logger[_0x31a0('0xe')](_0x31a0('0x17'),_0x5d01e4);logger['debug'](_0x31a0('0x17'),_0x5d01e4,JSON[_0x31a0('0x1d')](_0x4935f2));_0x1886ee(_0x4935f2);})['catch'](function(_0x6ff2ea){logger[_0x31a0('0x12')](_0x31a0('0x17'),_0x6ff2ea[_0x31a0('0x14')],_0x5d01e4);_0x1e04e4(_0xfbade1[_0x31a0('0x12')](0x1f4,_0x6ff2ea[_0x31a0('0x14')]));});});};exports[_0x31a0('0x1e')]=function(_0x579254){var _0x199c37=this;return new Promise(function(_0x1ef5ed,_0x3923ae){return db[_0x31a0('0x18')][_0x31a0('0x1f')](_0x579254[_0x31a0('0x1a')],{'raw':_0x579254[_0x31a0('0x1b')]?_0x579254[_0x31a0('0x1b')][_0x31a0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x579254['options']?_0x579254[_0x31a0('0x1b')]['where']||null:null,'attributes':_0x579254[_0x31a0('0x1b')]?_0x579254[_0x31a0('0x1b')]['attributes']||null:null,'limit':_0x579254[_0x31a0('0x1b')]?_0x579254[_0x31a0('0x1b')][_0x31a0('0x20')]||null:null})[_0x31a0('0xd')](function(_0x22e351){logger[_0x31a0('0xe')](_0x31a0('0x1e'),_0x579254);logger[_0x31a0('0x21')](_0x31a0('0x1e'),_0x579254,JSON[_0x31a0('0x1d')](_0x22e351));_0x1ef5ed(_0x22e351);})[_0x31a0('0x16')](function(_0x10d0d7){logger[_0x31a0('0x12')](_0x31a0('0x1e'),_0x10d0d7[_0x31a0('0x14')],_0x579254);_0x3923ae(_0x199c37[_0x31a0('0x12')](0x1f4,_0x10d0d7[_0x31a0('0x14')]));});});}; \ No newline at end of file +var _0xe1fb=['info','request\x20sent','result','catch','CreateVoiceDialReport','create','options','then','UpdateVoiceDialReport','VoiceDialReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','VoiceDialReport,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x92116d,_0xa6ee1b){var _0xfe4f60=function(_0x1f052d){while(--_0x1f052d){_0x92116d['push'](_0x92116d['shift']());}};_0xfe4f60(++_0xa6ee1b);}(_0xe1fb,0x1a2));var _0xbe1f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe1fb[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xbe1f('0x0'));var util=require('util');var moment=require(_0xbe1f('0x1'));var BPromise=require(_0xbe1f('0x2'));var rs=require(_0xbe1f('0x3'));var fs=require('fs');var Redis=require(_0xbe1f('0x4'));var db=require(_0xbe1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbe1f('0x6'));var jayson=require(_0xbe1f('0x7'));var client=jayson['client'][_0xbe1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x204107,_0x19bf47,_0x574ab1){return new BPromise(function(_0x5d0d2e,_0x380bd8){return client[_0xbe1f('0x9')](_0x204107,_0x574ab1)['then'](function(_0x259733){logger['info'](_0xbe1f('0xa'),_0x19bf47,'request\x20sent');logger[_0xbe1f('0xb')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x19bf47,'request\x20sent',JSON[_0xbe1f('0xc')](_0x259733));if(_0x259733['error']){if(_0x259733[_0xbe1f('0xd')][_0xbe1f('0xe')]===0x1f4){logger[_0xbe1f('0xd')](_0xbe1f('0xa'),_0x19bf47,_0x259733[_0xbe1f('0xd')][_0xbe1f('0xf')]);return _0x380bd8(_0x259733[_0xbe1f('0xd')][_0xbe1f('0xf')]);}logger['error'](_0xbe1f('0xa'),_0x19bf47,_0x259733[_0xbe1f('0xd')][_0xbe1f('0xf')]);return _0x5d0d2e(_0x259733[_0xbe1f('0xd')][_0xbe1f('0xf')]);}else{logger[_0xbe1f('0x10')](_0xbe1f('0xa'),_0x19bf47,_0xbe1f('0x11'));_0x5d0d2e(_0x259733[_0xbe1f('0x12')][_0xbe1f('0xf')]);}})[_0xbe1f('0x13')](function(_0x155e16){logger[_0xbe1f('0xd')](_0xbe1f('0xa'),_0x19bf47,_0x155e16);_0x380bd8(_0x155e16);});});}exports[_0xbe1f('0x14')]=function(_0x5dcd76){var _0x1be4ca=this;return new Promise(function(_0x1a78a4,_0x533473){return db['VoiceDialReport'][_0xbe1f('0x15')](_0x5dcd76['body'],{'raw':_0x5dcd76[_0xbe1f('0x16')]?_0x5dcd76['options']['raw']===undefined?!![]:![]:!![]})[_0xbe1f('0x17')](function(_0x58844d){logger[_0xbe1f('0x10')](_0xbe1f('0x14'),_0x5dcd76);logger[_0xbe1f('0xb')](_0xbe1f('0x14'),_0x5dcd76,JSON[_0xbe1f('0xc')](_0x58844d));_0x1a78a4(_0x58844d);})[_0xbe1f('0x13')](function(_0x214483){logger[_0xbe1f('0xd')](_0xbe1f('0x14'),_0x214483[_0xbe1f('0xf')],_0x5dcd76);_0x533473(_0x1be4ca['error'](0x1f4,_0x214483[_0xbe1f('0xf')]));});});};exports[_0xbe1f('0x18')]=function(_0x17f862){var _0x389bdf=this;return new Promise(function(_0x539866,_0x2a441d){return db[_0xbe1f('0x19')][_0xbe1f('0x1a')](_0x17f862[_0xbe1f('0x1b')],{'raw':_0x17f862[_0xbe1f('0x16')]?_0x17f862['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17f862[_0xbe1f('0x16')]?_0x17f862[_0xbe1f('0x16')][_0xbe1f('0x1c')]||null:null,'attributes':_0x17f862['options']?_0x17f862[_0xbe1f('0x16')][_0xbe1f('0x1d')]||null:null,'limit':_0x17f862[_0xbe1f('0x16')]?_0x17f862['options'][_0xbe1f('0x1e')]||null:null})[_0xbe1f('0x17')](function(_0x348ed8){logger[_0xbe1f('0x10')](_0xbe1f('0x18'),_0x17f862);logger[_0xbe1f('0xb')](_0xbe1f('0x18'),_0x17f862,JSON[_0xbe1f('0xc')](_0x348ed8));_0x539866(_0x348ed8);})[_0xbe1f('0x13')](function(_0x5c7831){logger[_0xbe1f('0xd')](_0xbe1f('0x18'),_0x5c7831[_0xbe1f('0xf')],_0x17f862);_0x2a441d(_0x389bdf[_0xbe1f('0xd')](0x1f4,_0x5c7831[_0xbe1f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 81011d9..c463b3f 100644 --- a/server/api/voiceExtension/index.js +++ b/server/api/voiceExtension/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2548=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','create','addApplications','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x2548,0xb6));var _0x8254=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2548[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8254('0x0'));var util=require(_0x8254('0x1'));var path=require(_0x8254('0x2'));var timeout=require(_0x8254('0x3'));var express=require('express');var router=express[_0x8254('0x4')]();var fs_extra=require(_0x8254('0x5'));var auth=require(_0x8254('0x6'));var interaction=require(_0x8254('0x7'));var config=require(_0x8254('0x8'));var controller=require(_0x8254('0x9'));router[_0x8254('0xa')]('/',auth[_0x8254('0xb')](),controller['index']);router[_0x8254('0xa')](_0x8254('0xc'),auth['isAuthenticated'](),controller[_0x8254('0xd')]);router['post']('/',auth[_0x8254('0xb')](),controller[_0x8254('0xe')]);router['post']('/:id/applications',auth[_0x8254('0xb')](),controller[_0x8254('0xf')]);router[_0x8254('0x10')](_0x8254('0xc'),auth[_0x8254('0xb')](),controller[_0x8254('0x11')]);router['delete'](_0x8254('0xc'),auth[_0x8254('0xb')](),controller['destroy']);module[_0x8254('0x12')]=router; \ No newline at end of file +var _0x7b5e=['isAuthenticated','index','/:id','show','post','create','/:id/applications','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x3441e2,_0x57b820){var _0x1a129b=function(_0x4864bb){while(--_0x4864bb){_0x3441e2['push'](_0x3441e2['shift']());}};_0x1a129b(++_0x57b820);}(_0x7b5e,0x13b));var _0xe7b5=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x7b5e[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0xe7b5('0x0'));var util=require(_0xe7b5('0x1'));var path=require(_0xe7b5('0x2'));var timeout=require(_0xe7b5('0x3'));var express=require(_0xe7b5('0x4'));var router=express['Router']();var fs_extra=require(_0xe7b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe7b5('0x6'));var config=require(_0xe7b5('0x7'));var controller=require('./voiceExtension.controller');router[_0xe7b5('0x8')]('/',auth[_0xe7b5('0x9')](),controller[_0xe7b5('0xa')]);router['get'](_0xe7b5('0xb'),auth[_0xe7b5('0x9')](),controller[_0xe7b5('0xc')]);router[_0xe7b5('0xd')]('/',auth[_0xe7b5('0x9')](),controller[_0xe7b5('0xe')]);router['post'](_0xe7b5('0xf'),auth[_0xe7b5('0x9')](),controller['addApplications']);router['put'](_0xe7b5('0xb'),auth[_0xe7b5('0x9')](),controller['update']);router[_0xe7b5('0x10')](_0xe7b5('0xb'),auth[_0xe7b5('0x9')](),controller[_0xe7b5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index b6f1c5c..c9766fa 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa136=['wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER'];(function(_0x4ba380,_0x259bee){var _0x4b111b=function(_0x2bf227){while(--_0x2bf227){_0x4ba380['push'](_0x4ba380['shift']());}};_0x4b111b(++_0x259bee);}(_0xa136,0x93));var _0x6a13=function(_0x619fcc,_0x3bd756){_0x619fcc=_0x619fcc-0x0;var _0x4737a6=_0xa136[_0x619fcc];return _0x4737a6;};'use strict';var Sequelize=require(_0x6a13('0x0'));module[_0x6a13('0x1')]={'context':{'type':Sequelize[_0x6a13('0x2')],'allowNull':![],'unique':_0x6a13('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6a13('0x2')],'allowNull':![],'unique':_0x6a13('0x3')},'priority':{'type':Sequelize[_0x6a13('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6a13('0x3')},'tag':{'type':Sequelize[_0x6a13('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6a13('0x2')],'allowNull':![],'defaultValue':_0x6a13('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6a13('0x5')]('inbound',_0x6a13('0x6'),_0x6a13('0x7'),_0x6a13('0x8'),_0x6a13('0x9'),_0x6a13('0xa'),_0x6a13('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6a13('0x2')],'allowNull':![],'defaultValue':_0x6a13('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x6a13('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6a13('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x6a13('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6a13('0xe')]},'recordingFormat':{'type':Sequelize[_0x6a13('0x2')],'defaultValue':_0x6a13('0xf')},'answer':{'type':Sequelize[_0x6a13('0xd')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5d97a7){return this[_0x6a13('0x10')](_0x6a13('0x11'));}},'alias':{'type':Sequelize[_0x6a13('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6b7f=['exports','compositeIndex','STRING','NoOp','inbound','outbound','system','any','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten','sequelize'];(function(_0x2ddd38,_0x4d3074){var _0x4752f3=function(_0x4844a3){while(--_0x4844a3){_0x2ddd38['push'](_0x2ddd38['shift']());}};_0x4752f3(++_0x4d3074);}(_0x6b7f,0x86));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf6b7('0x0'));module[_0xf6b7('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf6b7('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf6b7('0x3')],'allowNull':![],'unique':_0xf6b7('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf6b7('0x3')],'allowNull':![],'defaultValue':_0xf6b7('0x4')},'appdata':{'type':Sequelize[_0xf6b7('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xf6b7('0x5'),_0xf6b7('0x6'),'internal','inbound-fax','outbound-fax',_0xf6b7('0x7'),_0xf6b7('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xf6b7('0x3')]},'interval':{'type':Sequelize[_0xf6b7('0x3')],'allowNull':![],'defaultValue':_0xf6b7('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xf6b7('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf6b7('0x3')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xf6b7('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf6b7('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xf6b7('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf6b7('0xc')],'get':function(_0x49a2ff){return this[_0xf6b7('0xd')](_0xf6b7('0xe'));}},'alias':{'type':Sequelize[_0xf6b7('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index ba17d34..9b26dc3 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7429=['UserProfileResource','sendStatus','error','send','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','options','includeAll','include','VoiceExtension','findAll','rows','catch','show','params','merge','body','startsWith','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','context','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','bulkCreate','findAndCountAll','stack','finally','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','internal','filter','ignore','map','value','type','find','name'];(function(_0xbd736a,_0x106957){var _0x42513f=function(_0x496c35){while(--_0x496c35){_0xbd736a['push'](_0xbd736a['shift']());}};_0x42513f(++_0x106957);}(_0x7429,0xf2));var _0x9742=function(_0x31e294,_0x1189f5){_0x31e294=_0x31e294-0x0;var _0x72d43e=_0x7429[_0x31e294];return _0x72d43e;};'use strict';var _=require('lodash');var Redis=require(_0x9742('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x9742('0x1'))(_0x9742('0x2'));var config=require(_0x9742('0x3'));var db=require(_0x9742('0x4'))['db'];config[_0x9742('0x5')]=_['defaults'](config[_0x9742('0x5')],{'host':_0x9742('0x6'),'port':0x18eb});var socket=require(_0x9742('0x7'))(new Redis(config[_0x9742('0x5')]));require(_0x9742('0x8'))['register'](socket);function respondWithStatusCode(_0x4391a2,_0x35acfc){_0x35acfc=_0x35acfc||0xcc;return function(_0x5281a4){if(_0x5281a4){return _0x4391a2['sendStatus'](_0x35acfc);}return _0x4391a2['status'](_0x35acfc)[_0x9742('0x9')]();};}function respondWithResult(_0xe96857,_0x36e492){_0x36e492=_0x36e492||0xc8;return function(_0x3d4334){if(_0x3d4334){return _0xe96857['status'](_0x36e492)[_0x9742('0xa')](_0x3d4334);}};}function respondWithFilteredResult(_0x2db67d,_0x4d4d73){return function(_0x33a6a8){if(_0x33a6a8){var _0x12ab06=typeof _0x4d4d73[_0x9742('0xb')]===_0x9742('0xc')&&typeof _0x4d4d73[_0x9742('0xd')]==='undefined';var _0x1e7dc5=_0x33a6a8[_0x9742('0xe')];var _0xa6f888=_0x12ab06?0x0:_0x4d4d73[_0x9742('0xb')];var _0x465a3e=_0x12ab06?_0x33a6a8['count']:_0x4d4d73['offset']+_0x4d4d73['limit'];var _0x592639;if(_0x465a3e>=_0x1e7dc5){_0x465a3e=_0x1e7dc5;_0x592639=0xc8;}else{_0x592639=0xce;}_0x2db67d[_0x9742('0xf')](_0x592639);return _0x2db67d[_0x9742('0x10')](_0x9742('0x11'),_0xa6f888+'-'+_0x465a3e+'/'+_0x1e7dc5)[_0x9742('0xa')](_0x33a6a8);}return null;};}function removeEntity(_0xbe59d7){return function(_0x16d1e5){if(_0x16d1e5){return _0x16d1e5[_0x9742('0x12')]()[_0x9742('0x13')](function(){var _0x5504e6=_0x16d1e5['get']({'plain':!![]});var _0x218631=[{'name':_0x9742('0x14'),'value':_0x9742('0x15'),'ignore':![]},{'name':_0x9742('0x16'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x9742('0x17'),'ignore':![]}];var _0x2e0283=_(_0x218631)[_0x9742('0x18')](_0x9742('0x19'))[_0x9742('0x1a')](_0x9742('0x1b'))[_0x9742('0x1b')]();if(_['includes'](_0x2e0283,_0x5504e6[_0x9742('0x1c')])){return;}var _0x24918f=_[_0x9742('0x1d')](_0x218631,[_0x9742('0x1b'),_0x5504e6['type']])[_0x9742('0x1e')];return db[_0x9742('0x1f')][_0x9742('0x12')]({'where':{'type':_0x24918f,'resourceId':_0x5504e6['id']}})[_0x9742('0x13')](function(){return _0x16d1e5;});})[_0x9742('0x13')](function(){_0xbe59d7[_0x9742('0xf')](0xcc)[_0x9742('0x9')]();});}};}function handleEntityNotFound(_0x5eb0bb){return function(_0x12f662){if(!_0x12f662){_0x5eb0bb[_0x9742('0x20')](0x194);}return _0x12f662;};}function handleError(_0x181500,_0x299e74){_0x299e74=_0x299e74||0x1f4;return function(_0x3dd056){logger[_0x9742('0x21')](_0x3dd056['stack']);if(_0x3dd056[_0x9742('0x1e')]){delete _0x3dd056[_0x9742('0x1e')];}_0x181500[_0x9742('0xf')](_0x299e74)[_0x9742('0x22')](_0x3dd056);};}exports['index']=function(_0x1d3287,_0x2b05a4){var _0x54a54b={},_0x53106e={},_0x269698={'count':0x0,'rows':[]};var _0x27b1d5=_['map'](db['VoiceExtension'][_0x9742('0x23')],function(_0x34fd6c){return{'name':_0x34fd6c['fieldName'],'type':_0x34fd6c[_0x9742('0x1c')][_0x9742('0x24')]};});_0x53106e[_0x9742('0x25')]=_['map'](_0x27b1d5,_0x9742('0x1e'));_0x53106e[_0x9742('0x26')]=_[_0x9742('0x27')](_0x1d3287[_0x9742('0x26')]);_0x53106e['filters']=_[_0x9742('0x28')](_0x53106e[_0x9742('0x25')],_0x53106e[_0x9742('0x26')]);_0x54a54b[_0x9742('0x29')]=_['intersection'](_0x53106e[_0x9742('0x25')],qs[_0x9742('0x2a')](_0x1d3287[_0x9742('0x26')][_0x9742('0x2a')]));_0x54a54b[_0x9742('0x29')]=_0x54a54b['attributes'][_0x9742('0x2b')]?_0x54a54b[_0x9742('0x29')]:_0x53106e[_0x9742('0x25')];if(!_0x1d3287[_0x9742('0x26')]['hasOwnProperty'](_0x9742('0x2c'))){_0x54a54b[_0x9742('0xd')]=qs[_0x9742('0xd')](_0x1d3287[_0x9742('0x26')][_0x9742('0xd')]);_0x54a54b['offset']=qs['offset'](_0x1d3287[_0x9742('0x26')][_0x9742('0xb')]);}_0x54a54b['order']=qs['sort'](_0x1d3287[_0x9742('0x26')][_0x9742('0x2d')]);_0x54a54b[_0x9742('0x2e')]=qs[_0x9742('0x2f')](_[_0x9742('0x30')](_0x1d3287[_0x9742('0x26')],_0x53106e[_0x9742('0x2f')]),_0x27b1d5);if(_0x1d3287[_0x9742('0x26')]['filter']){_0x54a54b[_0x9742('0x2e')]=_['merge'](_0x54a54b[_0x9742('0x2e')],{'$or':_[_0x9742('0x1a')](_0x27b1d5,function(_0x369e11){if(_0x369e11['type']!==_0x9742('0x31')){var _0x5dac10={};_0x5dac10[_0x369e11[_0x9742('0x1e')]]={'$like':'%'+_0x1d3287[_0x9742('0x26')][_0x9742('0x18')]+'%'};return _0x5dac10;}})});}_0x54a54b=_['merge']({},_0x54a54b,_0x1d3287[_0x9742('0x32')]);var _0x509dd0={'where':_0x54a54b[_0x9742('0x2e')]};return db['VoiceExtension']['count'](_0x509dd0)[_0x9742('0x13')](function(_0x57bde8){_0x269698[_0x9742('0xe')]=_0x57bde8;if(_0x1d3287[_0x9742('0x26')][_0x9742('0x33')]){_0x54a54b[_0x9742('0x34')]=[{'all':!![]}];}return db[_0x9742('0x35')][_0x9742('0x36')](_0x54a54b);})[_0x9742('0x13')](function(_0x22a8be){_0x269698[_0x9742('0x37')]=_0x22a8be;return _0x269698;})[_0x9742('0x13')](respondWithFilteredResult(_0x2b05a4,_0x54a54b))[_0x9742('0x38')](handleError(_0x2b05a4,null));};exports[_0x9742('0x39')]=function(_0x9ac3cd,_0x53972b){var _0xba2567={'raw':![],'where':{'id':_0x9ac3cd[_0x9742('0x3a')]['id']}},_0x472c2e={};_0x472c2e[_0x9742('0x25')]=_['keys'](db[_0x9742('0x35')][_0x9742('0x23')]);_0x472c2e[_0x9742('0x26')]=_[_0x9742('0x27')](_0x9ac3cd[_0x9742('0x26')]);_0x472c2e['filters']=_[_0x9742('0x28')](_0x472c2e[_0x9742('0x25')],_0x472c2e[_0x9742('0x26')]);_0xba2567['attributes']=_[_0x9742('0x28')](_0x472c2e[_0x9742('0x25')],qs[_0x9742('0x2a')](_0x9ac3cd['query'][_0x9742('0x2a')]));_0xba2567['attributes']=_0xba2567[_0x9742('0x29')]['length']?_0xba2567[_0x9742('0x29')]:_0x472c2e[_0x9742('0x25')];if(_0x9ac3cd[_0x9742('0x26')][_0x9742('0x33')]){_0xba2567['include']=[{'all':!![]}];}_0xba2567=_[_0x9742('0x3b')]({},_0xba2567,_0x9ac3cd[_0x9742('0x32')]);return db['VoiceExtension']['find'](_0xba2567)[_0x9742('0x13')](handleEntityNotFound(_0x53972b,null))[_0x9742('0x13')](respondWithResult(_0x53972b,null))[_0x9742('0x38')](handleError(_0x53972b,null));};exports[_0x9742('0x12')]=function(_0x3c1e66,_0x3eb359){return db[_0x9742('0x35')]['find']({'where':{'id':_0x3c1e66[_0x9742('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3eb359,null))[_0x9742('0x13')](removeEntity(_0x3eb359,null))['catch'](handleError(_0x3eb359,null));};exports['create']=function(_0x35b949,_0x4e2062){if(_0x35b949[_0x9742('0x3c')]['type']==='outbound'&&!_[_0x9742('0x3d')](_0x35b949['body'][_0x9742('0x3e')],'_')){_0x35b949['body'][_0x9742('0x3e')]='_'[_0x9742('0x3f')](_0x35b949['body'][_0x9742('0x3e')]);}return db['VoiceExtension'][_0x9742('0x40')](_0x35b949[_0x9742('0x3c')],{'raw':![]})[_0x9742('0x13')](function(_0x25bb90){var _0x5aeb5b=_0x35b949[_0x9742('0x41')][_0x9742('0x42')]({'plain':!![]});if(!_0x5aeb5b)throw new Error(_0x9742('0x43'));if(_0x5aeb5b[_0x9742('0x44')]===_0x9742('0x41')){var _0x1a487e=_0x25bb90[_0x9742('0x42')]({'plain':!![]});var _0x77c544=[{'name':_0x9742('0x14'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x9742('0x45')},{'name':_0x9742('0x46'),'value':_0x9742('0x17')}];var _0x3992bb=_[_0x9742('0x1d')](_0x77c544,[_0x9742('0x1b'),_0x1a487e[_0x9742('0x1c')]])['name'];return db[_0x9742('0x47')][_0x9742('0x1d')]({'where':{'name':_0x3992bb,'userProfileId':_0x5aeb5b[_0x9742('0x48')]},'raw':!![]})[_0x9742('0x13')](function(_0x1fa17b){if(_0x1fa17b&&_0x1fa17b[_0x9742('0x49')]===0x0){return db['UserProfileResource'][_0x9742('0x40')]({'name':_0x1a487e[_0x9742('0x1e')],'resourceId':_0x1a487e['id'],'type':_0x1fa17b[_0x9742('0x1e')],'sectionId':_0x1fa17b['id']},{})[_0x9742('0x13')](function(){return _0x25bb90;});}else{return _0x25bb90;}})['catch'](function(_0x5e04ce){logger[_0x9742('0x21')](_0x9742('0x4a'),_0x5e04ce);throw _0x5e04ce;});}return _0x25bb90;})[_0x9742('0x13')](respondWithResult(_0x4e2062,0xc9))[_0x9742('0x38')](handleError(_0x4e2062,null));};exports[_0x9742('0x4b')]=function(_0x474559,_0x574f12){if(_0x474559['body']['id']){delete _0x474559[_0x9742('0x3c')]['id'];}return db[_0x9742('0x35')][_0x9742('0x1d')]({'where':{'id':_0x474559['params']['id']}})[_0x9742('0x13')](handleEntityNotFound(_0x574f12,null))[_0x9742('0x13')](function(_0xcc8c88){if(_0xcc8c88){return db[_0x9742('0x35')][_0x9742('0x4b')](_[_0x9742('0x30')](_0x474559[_0x9742('0x3c')],[_0x9742('0x3e'),'context',_0x9742('0x4c'),_0x9742('0x4d'),_0x9742('0x4e'),'mandatoryDisposition','alias']),{'where':{'context':_0xcc8c88[_0x9742('0x4f')],'exten':_0xcc8c88['exten']},'individualHooks':!![]})['then'](function(_0x6f0f6d){return _0x6f0f6d;});}return null;})[_0x9742('0x13')](respondWithStatusCode(_0x574f12,null))[_0x9742('0x38')](handleError(_0x574f12,null));};exports[_0x9742('0x50')]=function(_0x13bb8a,_0x437111){var _0x7dc9b1=_0x13bb8a[_0x9742('0x3a')]['id'];var _0x44bc0b=_0x13bb8a[_0x9742('0x3c')];var _0x3a4a3c=0xc8;var _0x21e034=null;return db['sequelize'][_0x9742('0x51')]({'isolationLevel':db[_0x9742('0x52')]['Transaction'][_0x9742('0x53')][_0x9742('0x54')]},function(_0x41130d){return db[_0x9742('0x35')][_0x9742('0x55')]({'where':{'id':_0x7dc9b1},'transaction':_0x41130d})[_0x9742('0x13')](function(_0x4b0998){if(_0x4b0998){return db[_0x9742('0x35')][_0x9742('0x12')]({'where':{'VoiceExtensionId':_0x7dc9b1},'transaction':_0x41130d})[_0x9742('0x13')](function(){var _0x32c513=_[_0x9742('0x1a')](_0x44bc0b,function(_0x2a0630){_0x2a0630[_0x9742('0x56')]=_0x7dc9b1;_0x2a0630['isApp']=!![];return _0x2a0630;});return _0x4b0998['createRouting'](_0x32c513);})[_0x9742('0x13')](function(_0x58dd04){return db['VoiceExtension'][_0x9742('0x57')](_0x58dd04,{'transaction':_0x41130d});});}else{_0x3a4a3c=0x194;_0x21e034=[];}});})['then'](function(){if(_0x3a4a3c!==0x194){return db[_0x9742('0x35')][_0x9742('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x7dc9b1},'order':'cast(priority\x20as\x20unsigned)'})[_0x9742('0x13')](function(_0x78ea30){_0x21e034=_0x78ea30;});}})[_0x9742('0x38')](function(_0x295466){_0x3a4a3c=0x1f4;logger['error'](_0x295466[_0x9742('0x59')]);if(_0x295466[_0x9742('0x1e')]){delete _0x295466[_0x9742('0x1e')];}_0x21e034=_0x295466;})[_0x9742('0x5a')](function(){if(_0x21e034===null){_0x437111[_0x9742('0x20')](_0x3a4a3c);}else{if(_0x3a4a3c===0x1f4){_0x437111[_0x9742('0xf')](_0x3a4a3c)[_0x9742('0x22')](_0x21e034);}else{_0x437111[_0x9742('0xf')](_0x3a4a3c)[_0x9742('0xa')](_0x21e034);}}});}; \ No newline at end of file +var _0x283a=['cutdigits','alias','context','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','lodash','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','send','index','VoiceExtension','fieldName','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','length','merge','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','OutboundRoutes','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat'];(function(_0xbb0ccf,_0x19e718){var _0x38d7b3=function(_0x3bc6ff){while(--_0x3bc6ff){_0xbb0ccf['push'](_0xbb0ccf['shift']());}};_0x38d7b3(++_0x19e718);}(_0x283a,0x12b));var _0xa283=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0x283a[_0x313df3];return _0x241d59;};'use strict';var _=require(_0xa283('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa283('0x1'))('api');var config=require('../../config/environment');var db=require(_0xa283('0x2'))['db'];config['redis']=_[_0xa283('0x3')](config[_0xa283('0x4')],{'host':_0xa283('0x5'),'port':0x18eb});var socket=require(_0xa283('0x6'))(new Redis(config['redis']));require(_0xa283('0x7'))[_0xa283('0x8')](socket);function respondWithStatusCode(_0x236f13,_0x56e6a1){_0x56e6a1=_0x56e6a1||0xcc;return function(_0x235cbb){if(_0x235cbb){return _0x236f13[_0xa283('0x9')](_0x56e6a1);}return _0x236f13[_0xa283('0xa')](_0x56e6a1)[_0xa283('0xb')]();};}function respondWithResult(_0x32ff3c,_0x50f3bf){_0x50f3bf=_0x50f3bf||0xc8;return function(_0x3c7d96){if(_0x3c7d96){return _0x32ff3c['status'](_0x50f3bf)[_0xa283('0xc')](_0x3c7d96);}};}function respondWithFilteredResult(_0x8f24cd,_0x4acbf4){return function(_0xe532f7){if(_0xe532f7){var _0xf8a0c8=typeof _0x4acbf4[_0xa283('0xd')]===_0xa283('0xe')&&typeof _0x4acbf4[_0xa283('0xf')]===_0xa283('0xe');var _0x17e3d7=_0xe532f7[_0xa283('0x10')];var _0x3854ee=_0xf8a0c8?0x0:_0x4acbf4[_0xa283('0xd')];var _0x4124b4=_0xf8a0c8?_0xe532f7[_0xa283('0x10')]:_0x4acbf4['offset']+_0x4acbf4[_0xa283('0xf')];var _0x1b325c;if(_0x4124b4>=_0x17e3d7){_0x4124b4=_0x17e3d7;_0x1b325c=0xc8;}else{_0x1b325c=0xce;}_0x8f24cd['status'](_0x1b325c);return _0x8f24cd[_0xa283('0x11')](_0xa283('0x12'),_0x3854ee+'-'+_0x4124b4+'/'+_0x17e3d7)[_0xa283('0xc')](_0xe532f7);}return null;};}function removeEntity(_0x5226c7){return function(_0xf5cfe8){if(_0xf5cfe8){return _0xf5cfe8[_0xa283('0x13')]()[_0xa283('0x14')](function(){var _0x2e28f2=_0xf5cfe8[_0xa283('0x15')]({'plain':!![]});var _0x1147e3=[{'name':_0xa283('0x16'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xa283('0x17'),'ignore':![]},{'name':'InternalRoutes','value':_0xa283('0x18'),'ignore':![]}];var _0x1f7137=_(_0x1147e3)[_0xa283('0x19')](_0xa283('0x1a'))[_0xa283('0x1b')]('value')[_0xa283('0x1c')]();if(_[_0xa283('0x1d')](_0x1f7137,_0x2e28f2[_0xa283('0x1e')])){return;}var _0x89f602=_[_0xa283('0x1f')](_0x1147e3,[_0xa283('0x1c'),_0x2e28f2[_0xa283('0x1e')]])[_0xa283('0x20')];return db[_0xa283('0x21')][_0xa283('0x13')]({'where':{'type':_0x89f602,'resourceId':_0x2e28f2['id']}})[_0xa283('0x14')](function(){return _0xf5cfe8;});})[_0xa283('0x14')](function(){_0x5226c7[_0xa283('0xa')](0xcc)[_0xa283('0xb')]();});}};}function handleEntityNotFound(_0x39fd39){return function(_0x126ce6){if(!_0x126ce6){_0x39fd39[_0xa283('0x9')](0x194);}return _0x126ce6;};}function handleError(_0xe44340,_0x4ec209){_0x4ec209=_0x4ec209||0x1f4;return function(_0x19cfac){logger[_0xa283('0x22')](_0x19cfac['stack']);if(_0x19cfac['name']){delete _0x19cfac[_0xa283('0x20')];}_0xe44340[_0xa283('0xa')](_0x4ec209)[_0xa283('0x23')](_0x19cfac);};}exports[_0xa283('0x24')]=function(_0x8c14ee,_0x4fada5){var _0x1fbe1b={},_0x3c1488={},_0x10b3f3={'count':0x0,'rows':[]};var _0x4a75f3=_[_0xa283('0x1b')](db[_0xa283('0x25')]['rawAttributes'],function(_0x289c1a){return{'name':_0x289c1a[_0xa283('0x26')],'type':_0x289c1a['type'][_0xa283('0x27')]};});_0x3c1488[_0xa283('0x28')]=_[_0xa283('0x1b')](_0x4a75f3,'name');_0x3c1488['query']=_[_0xa283('0x29')](_0x8c14ee['query']);_0x3c1488[_0xa283('0x2a')]=_['intersection'](_0x3c1488['model'],_0x3c1488[_0xa283('0x2b')]);_0x1fbe1b[_0xa283('0x2c')]=_[_0xa283('0x2d')](_0x3c1488[_0xa283('0x28')],qs[_0xa283('0x2e')](_0x8c14ee[_0xa283('0x2b')][_0xa283('0x2e')]));_0x1fbe1b[_0xa283('0x2c')]=_0x1fbe1b['attributes']['length']?_0x1fbe1b[_0xa283('0x2c')]:_0x3c1488[_0xa283('0x28')];if(!_0x8c14ee[_0xa283('0x2b')][_0xa283('0x2f')](_0xa283('0x30'))){_0x1fbe1b[_0xa283('0xf')]=qs[_0xa283('0xf')](_0x8c14ee['query']['limit']);_0x1fbe1b[_0xa283('0xd')]=qs[_0xa283('0xd')](_0x8c14ee[_0xa283('0x2b')]['offset']);}_0x1fbe1b[_0xa283('0x31')]=qs[_0xa283('0x32')](_0x8c14ee[_0xa283('0x2b')][_0xa283('0x32')]);_0x1fbe1b['where']=qs[_0xa283('0x2a')](_[_0xa283('0x33')](_0x8c14ee[_0xa283('0x2b')],_0x3c1488[_0xa283('0x2a')]),_0x4a75f3);if(_0x8c14ee[_0xa283('0x2b')][_0xa283('0x19')]){_0x1fbe1b[_0xa283('0x34')]=_['merge'](_0x1fbe1b['where'],{'$or':_[_0xa283('0x1b')](_0x4a75f3,function(_0x391931){if(_0x391931['type']!==_0xa283('0x35')){var _0x956794={};_0x956794[_0x391931[_0xa283('0x20')]]={'$like':'%'+_0x8c14ee['query'][_0xa283('0x19')]+'%'};return _0x956794;}})});}_0x1fbe1b=_['merge']({},_0x1fbe1b,_0x8c14ee['options']);var _0x22e062={'where':_0x1fbe1b['where']};return db['VoiceExtension']['count'](_0x22e062)['then'](function(_0x5c2d9a){_0x10b3f3[_0xa283('0x10')]=_0x5c2d9a;if(_0x8c14ee[_0xa283('0x2b')][_0xa283('0x36')]){_0x1fbe1b[_0xa283('0x37')]=[{'all':!![]}];}return db[_0xa283('0x25')]['findAll'](_0x1fbe1b);})[_0xa283('0x14')](function(_0x5b8fa8){_0x10b3f3[_0xa283('0x38')]=_0x5b8fa8;return _0x10b3f3;})['then'](respondWithFilteredResult(_0x4fada5,_0x1fbe1b))[_0xa283('0x39')](handleError(_0x4fada5,null));};exports[_0xa283('0x3a')]=function(_0x5da4b8,_0x76af12){var _0x1c46d2={'raw':![],'where':{'id':_0x5da4b8[_0xa283('0x3b')]['id']}},_0x4f3837={};_0x4f3837[_0xa283('0x28')]=_[_0xa283('0x29')](db[_0xa283('0x25')][_0xa283('0x3c')]);_0x4f3837[_0xa283('0x2b')]=_[_0xa283('0x29')](_0x5da4b8[_0xa283('0x2b')]);_0x4f3837[_0xa283('0x2a')]=_[_0xa283('0x2d')](_0x4f3837[_0xa283('0x28')],_0x4f3837[_0xa283('0x2b')]);_0x1c46d2[_0xa283('0x2c')]=_['intersection'](_0x4f3837[_0xa283('0x28')],qs[_0xa283('0x2e')](_0x5da4b8[_0xa283('0x2b')][_0xa283('0x2e')]));_0x1c46d2['attributes']=_0x1c46d2[_0xa283('0x2c')][_0xa283('0x3d')]?_0x1c46d2[_0xa283('0x2c')]:_0x4f3837[_0xa283('0x28')];if(_0x5da4b8[_0xa283('0x2b')][_0xa283('0x36')]){_0x1c46d2['include']=[{'all':!![]}];}_0x1c46d2=_[_0xa283('0x3e')]({},_0x1c46d2,_0x5da4b8['options']);return db[_0xa283('0x25')]['find'](_0x1c46d2)[_0xa283('0x14')](handleEntityNotFound(_0x76af12,null))[_0xa283('0x14')](respondWithResult(_0x76af12,null))['catch'](handleError(_0x76af12,null));};exports['destroy']=function(_0x90e33,_0x3c20f9){return db[_0xa283('0x25')]['find']({'where':{'id':_0x90e33[_0xa283('0x3b')]['id']}})[_0xa283('0x14')](handleEntityNotFound(_0x3c20f9,null))[_0xa283('0x14')](removeEntity(_0x3c20f9,null))[_0xa283('0x39')](handleError(_0x3c20f9,null));};exports[_0xa283('0x3f')]=function(_0x12c7b5,_0x252349){if(_0x12c7b5['body'][_0xa283('0x1e')]===_0xa283('0x17')&&!_[_0xa283('0x40')](_0x12c7b5[_0xa283('0x41')][_0xa283('0x42')],'_')){_0x12c7b5[_0xa283('0x41')][_0xa283('0x42')]='_'[_0xa283('0x43')](_0x12c7b5[_0xa283('0x41')][_0xa283('0x42')]);}return db[_0xa283('0x25')][_0xa283('0x3f')](_0x12c7b5[_0xa283('0x41')],{'raw':![]})[_0xa283('0x14')](function(_0x529880){var _0x5db9e4=_0x12c7b5[_0xa283('0x44')][_0xa283('0x15')]({'plain':!![]});if(!_0x5db9e4)throw new Error(_0xa283('0x45'));if(_0x5db9e4[_0xa283('0x46')]===_0xa283('0x44')){var _0x15817f=_0x529880[_0xa283('0x15')]({'plain':!![]});var _0x3e96e0=[{'name':_0xa283('0x16'),'value':_0xa283('0x47')},{'name':_0xa283('0x48'),'value':_0xa283('0x17')},{'name':_0xa283('0x49'),'value':_0xa283('0x18')}];var _0x246e97=_['find'](_0x3e96e0,[_0xa283('0x1c'),_0x15817f[_0xa283('0x1e')]])[_0xa283('0x20')];return db[_0xa283('0x4a')][_0xa283('0x1f')]({'where':{'name':_0x246e97,'userProfileId':_0x5db9e4[_0xa283('0x4b')]},'raw':!![]})[_0xa283('0x14')](function(_0x473751){if(_0x473751&&_0x473751[_0xa283('0x4c')]===0x0){return db[_0xa283('0x21')][_0xa283('0x3f')]({'name':_0x15817f['name'],'resourceId':_0x15817f['id'],'type':_0x473751[_0xa283('0x20')],'sectionId':_0x473751['id']},{})[_0xa283('0x14')](function(){return _0x529880;});}else{return _0x529880;}})[_0xa283('0x39')](function(_0x10eae7){logger[_0xa283('0x22')](_0xa283('0x4d'),_0x10eae7);throw _0x10eae7;});}return _0x529880;})[_0xa283('0x14')](respondWithResult(_0x252349,0xc9))[_0xa283('0x39')](handleError(_0x252349,null));};exports[_0xa283('0x4e')]=function(_0x502317,_0x28eede){if(_0x502317[_0xa283('0x41')]['id']){delete _0x502317['body']['id'];}return db[_0xa283('0x25')]['find']({'where':{'id':_0x502317[_0xa283('0x3b')]['id']}})[_0xa283('0x14')](handleEntityNotFound(_0x28eede,null))[_0xa283('0x14')](function(_0x2717e5){if(_0x2717e5){return db['VoiceExtension'][_0xa283('0x4e')](_[_0xa283('0x33')](_0x502317[_0xa283('0x41')],['exten','context',_0xa283('0x4f'),_0xa283('0x50'),_0xa283('0x51'),'mandatoryDisposition',_0xa283('0x52')]),{'where':{'context':_0x2717e5[_0xa283('0x53')],'exten':_0x2717e5[_0xa283('0x42')]},'individualHooks':!![]})[_0xa283('0x14')](function(_0x16879a){return _0x16879a;});}return null;})[_0xa283('0x14')](respondWithStatusCode(_0x28eede,null))[_0xa283('0x39')](handleError(_0x28eede,null));};exports[_0xa283('0x54')]=function(_0x279185,_0x5d7a9b){var _0x25a135=_0x279185['params']['id'];var _0x763fdc=_0x279185[_0xa283('0x41')];var _0xb7a612=0xc8;var _0x36b6d7=null;return db[_0xa283('0x55')][_0xa283('0x56')]({'isolationLevel':db['sequelize'][_0xa283('0x57')]['ISOLATION_LEVELS'][_0xa283('0x58')]},function(_0x77591){return db[_0xa283('0x25')][_0xa283('0x59')]({'where':{'id':_0x25a135},'transaction':_0x77591})[_0xa283('0x14')](function(_0x53b820){if(_0x53b820){return db[_0xa283('0x25')][_0xa283('0x13')]({'where':{'VoiceExtensionId':_0x25a135},'transaction':_0x77591})[_0xa283('0x14')](function(){var _0x5d6aed=_[_0xa283('0x1b')](_0x763fdc,function(_0x251613){_0x251613['VoiceExtensionId']=_0x25a135;_0x251613[_0xa283('0x5a')]=!![];return _0x251613;});return _0x53b820[_0xa283('0x5b')](_0x5d6aed);})['then'](function(_0x6981d4){return db[_0xa283('0x25')]['bulkCreate'](_0x6981d4,{'transaction':_0x77591});});}else{_0xb7a612=0x194;_0x36b6d7=[];}});})['then'](function(){if(_0xb7a612!==0x194){return db[_0xa283('0x25')][_0xa283('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x25a135},'order':_0xa283('0x5d')})['then'](function(_0x5d86ff){_0x36b6d7=_0x5d86ff;});}})[_0xa283('0x39')](function(_0x53dd43){_0xb7a612=0x1f4;logger['error'](_0x53dd43[_0xa283('0x5e')]);if(_0x53dd43[_0xa283('0x20')]){delete _0x53dd43[_0xa283('0x20')];}_0x36b6d7=_0x53dd43;})['finally'](function(){if(_0x36b6d7===null){_0x5d7a9b[_0xa283('0x9')](_0xb7a612);}else{if(_0xb7a612===0x1f4){_0x5d7a9b[_0xa283('0xa')](_0xb7a612)[_0xa283('0x23')](_0x36b6d7);}else{_0x5d7a9b[_0xa283('0xa')](_0xb7a612)[_0xa283('0xc')](_0x36b6d7);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4f0ee61..b8dc179 100644 --- a/server/api/voiceExtension/voiceExtension.events.js +++ b/server/api/voiceExtension/voiceExtension.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b11=['emit','hook','exports','events','VoiceExtension','setMaxListeners','update'];(function(_0x5e4e77,_0x1b84cd){var _0x29074c=function(_0x1c3941){while(--_0x1c3941){_0x5e4e77['push'](_0x5e4e77['shift']());}};_0x29074c(++_0x1b84cd);}(_0x3b11,0x161));var _0x13b1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b11[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x13b1('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x13b1('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x13b1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x13b1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x292af0){return function(_0x449748,_0x421c7c,_0x2fc6af){VoiceExtensionEvents[_0x13b1('0x4')](_0x292af0+':'+_0x449748['id'],_0x449748);VoiceExtensionEvents[_0x13b1('0x4')](_0x292af0,_0x449748);_0x2fc6af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x13b1('0x5')](e,emitEvent(event));}}module[_0x13b1('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0xbf29=['setMaxListeners','update','emit','hook','events','../../mysqldb','VoiceExtension'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf29,0x1d9));var _0x9bf2=function(_0x26d438,_0x2c18a5){_0x26d438=_0x26d438-0x0;var _0x418453=_0xbf29[_0x26d438];return _0x418453;};'use strict';var EventEmitter=require(_0x9bf2('0x0'));var VoiceExtension=require(_0x9bf2('0x1'))['db'][_0x9bf2('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9bf2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9bf2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x66abfd){return function(_0x1c5212,_0x38ecb4,_0x39ca2b){VoiceExtensionEvents[_0x9bf2('0x5')](_0x66abfd+':'+_0x1c5212['id'],_0x1c5212);VoiceExtensionEvents[_0x9bf2('0x5')](_0x66abfd,_0x1c5212);_0x39ca2b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x9bf2('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index ed0997a..75444e3 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6653=['):Goto(','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','split','length','name','param','phone','prefix','SIP','join','none','options','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('];(function(_0x45ca37,_0x5b3f08){var _0x1b588c=function(_0x128877){while(--_0x128877){_0x45ca37['push'](_0x45ca37['shift']());}};_0x1b588c(++_0x5b3f08);}(_0x6653,0xdd));var _0x3665=function(_0x24d631,_0x363f97){_0x24d631=_0x24d631-0x0;var _0x54c1b1=_0x6653[_0x24d631];return _0x54c1b1;};'use strict';var _=require(_0x3665('0x0'));var attributes=require(_0x3665('0x1'));module['exports']=function(_0x5c688c){var _0x539aa2=_0x5c688c[_0x3665('0x2')];function _0x5843e2(_0x22f2c3){var _0x589fde=0x2;var _0x4bbfe3=[{'type':_0x22f2c3[_0x3665('0x3')],'app':_0x3665('0x4'),'appdata':_0x3665('0x5')+_0x22f2c3[_0x3665('0x3')],'context':_0x22f2c3[_0x3665('0x6')],'exten':_0x22f2c3[_0x3665('0x7')],'priority':_0x589fde++,'VoiceExtensionId':_0x22f2c3['id']},{'type':_0x22f2c3['type'],'app':_0x22f2c3['alias']?'Set':'NoOp','appdata':_0x22f2c3[_0x3665('0x8')]?_0x3665('0x9')+_0x22f2c3['alias']:_0x3665('0xa'),'context':_0x22f2c3[_0x3665('0x6')],'exten':_0x22f2c3[_0x3665('0x7')],'priority':_0x589fde++,'VoiceExtensionId':_0x22f2c3['id']}];if(_0x22f2c3['type']===_0x3665('0xb')){_0x4bbfe3[_0x3665('0xc')]({'type':_0x3665('0xb'),'app':_0x3665('0x4'),'appdata':'CDR(routeid)='+_0x22f2c3['id'],'context':_0x22f2c3[_0x3665('0x6')],'exten':_0x22f2c3[_0x3665('0x7')],'priority':_0x589fde++,'VoiceExtensionId':_0x22f2c3['id']});}_0x4bbfe3[_0x3665('0xc')]({'type':_0x22f2c3[_0x3665('0x3')],'app':'Set','appdata':_0x3665('0xd'),'context':_0x22f2c3[_0x3665('0x6')],'exten':_0x22f2c3['exten'],'priority':_0x589fde++,'VoiceExtensionId':_0x22f2c3['id']},{'type':_0x22f2c3[_0x3665('0x3')],'app':'Set','appdata':_0x3665('0xe'),'context':_0x22f2c3[_0x3665('0x6')],'exten':_0x22f2c3[_0x3665('0x7')],'priority':_0x589fde++,'VoiceExtensionId':_0x22f2c3['id']},{'type':_0x22f2c3[_0x3665('0x3')],'app':'Set','appdata':_0x3665('0xf'),'context':_0x22f2c3[_0x3665('0x6')],'exten':_0x22f2c3[_0x3665('0x7')],'priority':_0x589fde++,'VoiceExtensionId':_0x22f2c3['id']});return _0x4bbfe3;}function _0x102bc8(_0x27773f){var _0x16a04d=0x2;var _0x4b8cb0=[{'type':_0x3665('0x10'),'app':_0x3665('0x4'),'appdata':_0x3665('0x11'),'context':_0x27773f['context'],'exten':_0x27773f[_0x3665('0x7')],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':_0x3665('0x10'),'app':_0x27773f[_0x3665('0x8')]?_0x3665('0x4'):_0x3665('0x12'),'appdata':_0x27773f['alias']?_0x3665('0x9')+_0x27773f[_0x3665('0x8')]:_0x3665('0xa'),'context':_0x27773f[_0x3665('0x6')],'exten':_0x27773f[_0x3665('0x7')],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':'outbound','app':_0x3665('0x4'),'appdata':_0x3665('0x13')+(_0x27773f[_0x3665('0x14')]?_0x3665('0x15')+_0x27773f[_0x3665('0x14')]+'}':_0x3665('0x16')),'context':_0x27773f[_0x3665('0x6')],'exten':_0x27773f[_0x3665('0x7')],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':_0x3665('0x10'),'app':_0x3665('0x4'),'appdata':_0x3665('0x17')+_0x27773f['id'],'context':_0x27773f['context'],'exten':_0x27773f[_0x3665('0x7')],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':_0x3665('0x10'),'app':'ExecIf','appdata':_0x3665('0x18')+(_0x16a04d+0x2)+_0x3665('0x19')+(_0x16a04d+0x1)+')','context':_0x27773f['context'],'exten':_0x27773f[_0x3665('0x7')],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':_0x3665('0x10'),'app':'Set','appdata':_0x27773f[_0x3665('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x27773f[_0x3665('0x14')]+'}':_0x3665('0x1a'),'context':_0x27773f['context'],'exten':_0x27773f[_0x3665('0x7')],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':_0x3665('0x10'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x27773f['context'],'exten':_0x27773f['exten'],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':_0x3665('0x10'),'app':_0x3665('0x4'),'appdata':_0x3665('0xe'),'context':_0x27773f['context'],'exten':_0x27773f['exten'],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':_0x3665('0x10'),'app':_0x3665('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x27773f[_0x3665('0x6')],'exten':_0x27773f['exten'],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':_0x3665('0x10'),'app':_0x3665('0x4'),'appdata':'outboundrouteid='+_0x27773f['id'],'context':_0x27773f['context'],'exten':_0x27773f[_0x3665('0x7')],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']}];if(_0x27773f[_0x3665('0x1b')](_0x3665('0x1c'))&&_0x27773f[_0x3665('0x1c')]!=='none'){_0x4b8cb0[_0x3665('0xc')]({'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x27773f[_0x3665('0x6')],'exten':_0x27773f[_0x3665('0x7')],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']},{'type':'outbound','app':_0x3665('0x4'),'appdata':_0x3665('0x1d')+_0x27773f['recordingFormat']||'wav','context':_0x27773f[_0x3665('0x6')],'exten':_0x27773f['exten'],'priority':_0x16a04d++,'VoiceExtensionId':_0x27773f['id']});}return _0x4b8cb0;}function _0xc5c4e3(_0x54d6cb,_0x31ec16){var _0x1eec53=[{'name':_0x3665('0x1e'),'param':0x0},{'name':_0x3665('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x3665('0x20'),'param':0x3}];var _0x2ad415={};var _0x4e08ae=_0x31ec16[_0x3665('0x21')](',');var _0x29e7e8=[];for(var _0x367235=0x0;_0x367235<_0x1eec53[_0x3665('0x22')];_0x367235++){switch(_0x1eec53[_0x367235][_0x3665('0x23')]){case _0x3665('0x1e'):_0x2ad415[_0x3665('0x1e')]=_0x4e08ae[_0x1eec53[_0x367235][_0x3665('0x24')]]['split']('/')[0x1];_0x2ad415[_0x3665('0x25')]=_0x4e08ae[_0x1eec53[_0x367235][_0x3665('0x24')]][_0x3665('0x21')]('/')[0x2];_0x2ad415['prefix']=_0x2ad415[_0x3665('0x25')]?_0x2ad415[_0x3665('0x25')][_0x3665('0x21')]('$')[0x0]:undefined;_0x2ad415[_0x3665('0x25')]=_0x54d6cb[_0x3665('0x14')]?(_0x2ad415['prefix']||'')+_0x3665('0x15')+_0x54d6cb[_0x3665('0x14')]+'}':(_0x2ad415[_0x3665('0x26')]||'')+_0x3665('0x16');_0x29e7e8[_0x1eec53[_0x367235][_0x3665('0x24')]]=[_0x3665('0x27'),_0x2ad415[_0x3665('0x1e')],_0x2ad415[_0x3665('0x25')]][_0x3665('0x28')]('/');break;case'options':_0x2ad415['options']=_0x4e08ae[_0x1eec53[_0x367235]['param']];if(_0x54d6cb[_0x3665('0x1c')]!==_0x3665('0x29')){if(_0x2ad415[_0x3665('0x2a')]['indexOf'](_0x3665('0x2b'))<0x0){_0x2ad415[_0x3665('0x2a')]+=_0x3665('0x2b');}}else{_0x2ad415[_0x3665('0x2a')]=_0x2ad415['options']['replace'](_0x3665('0x2b'),'');}_0x29e7e8[_0x1eec53[_0x367235][_0x3665('0x24')]]=_0x2ad415[_0x3665('0x2a')];break;default:_0x29e7e8[_0x1eec53[_0x367235][_0x3665('0x24')]]=_0x4e08ae[_0x1eec53[_0x367235][_0x3665('0x24')]];}}return _0x29e7e8[_0x3665('0x28')](',');}function _0x1abae6(_0x5ee1dd,_0x371cf5,_0x22c933){return new Promise(function(_0x1558d3,_0x4d78a2){var _0x33a916=[];if(_[_0x3665('0x2c')](_0x371cf5))return _0x1558d3(_0x33a916);_0x539aa2['Interval'][_0x3665('0x2d')]({'attributes':['id',_0x3665('0x2e'),_0x3665('0x2f')],'raw':!![]})[_0x3665('0x30')](function(_0xb94f9a){for(var _0x4051e5=0x0,_0x43df37=0x0;_0x4051e5<_0x371cf5['length'];_0x4051e5++,_0x43df37=0x0){var _0x311ca3=_0x371cf5[_0x4051e5];var _0x2fb132=[];var _0x5d4900=[];delete _0x311ca3['id'];if(_0x311ca3[_0x3665('0x2e')]!==_0x3665('0x31')){_0x311ca3[_0x3665('0x32')]=[_0x311ca3[_0x3665('0x2e')]];}else{_0x311ca3['intervals']=_0x311ca3[_0x3665('0x2f')]?_[_0x3665('0x33')](_[_0x3665('0x34')](_0xb94f9a,{'IntervalId':_0x311ca3[_0x3665('0x2f')]}),_0x3665('0x2e')):[];}_0x311ca3[_0x3665('0x6')]=_0x5ee1dd['context'];_0x311ca3[_0x3665('0x7')]=_0x5ee1dd[_0x3665('0x7')];if(_0x311ca3[_0x3665('0x3')])_0x311ca3['type']=_0x311ca3[_0x3665('0x3')][_0x3665('0x35')]();if(_0x5ee1dd['type']===_0x3665('0x10')){if(_0x311ca3[_0x3665('0x1b')](_0x3665('0x36'))&&_0x311ca3[_0x3665('0x36')]&&_0x311ca3['tag']!=='--'){_0x2fb132[_0x3665('0xc')]({'type':_0x311ca3[_0x3665('0x3')][_0x3665('0x35')](),'app':'Set','appdata':'CDR(tag)='+_0x311ca3['tag'],'context':_0x5ee1dd[_0x3665('0x6')],'exten':_0x5ee1dd[_0x3665('0x7')],'priority':_0x311ca3[_0x3665('0x32')][_0x3665('0x22')]+_0x22c933+_0x43df37++,'VoiceExtensionId':_0x5ee1dd['id']});}_0x2fb132['push']({'type':_0x311ca3['type'][_0x3665('0x35')](),'app':_0x3665('0x37'),'appdata':_0x3665('0x38')+(_0x311ca3[_0x3665('0x39')]?_0x3665('0x3a')+_0x311ca3[_0x3665('0x39')]+')':_0x3665('0x3b')),'context':_0x5ee1dd[_0x3665('0x6')],'exten':_0x5ee1dd[_0x3665('0x7')],'priority':_0x311ca3[_0x3665('0x32')][_0x3665('0x22')]+_0x22c933+_0x43df37++,'VoiceExtensionId':_0x5ee1dd['id']});}else{if(_0x311ca3[_0x3665('0x1b')](_0x3665('0x3c'))){if([_0x3665('0x3d'),_0x3665('0x3e')][_0x3665('0x3f')](_0x311ca3[_0x3665('0x40')][_0x3665('0x35')]())&&_0x311ca3[_0x3665('0x41')]!==_0x3665('0x42')){if(_0x311ca3['answer']){_0x2fb132[_0x3665('0xc')]({'type':_0x311ca3['type'][_0x3665('0x35')](),'app':_0x3665('0x37'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5ee1dd[_0x3665('0x6')],'exten':_0x5ee1dd[_0x3665('0x7')],'priority':_0x311ca3[_0x3665('0x32')]['length']+_0x22c933+_0x43df37++,'VoiceExtensionId':_0x5ee1dd['id']});_0x2fb132[_0x3665('0xc')]({'type':_0x311ca3[_0x3665('0x3')]['toLowerCase'](),'app':_0x3665('0x4'),'appdata':_0x3665('0x43'),'context':_0x5ee1dd[_0x3665('0x6')],'exten':_0x5ee1dd[_0x3665('0x7')],'priority':_0x311ca3['intervals'][_0x3665('0x22')]+_0x22c933+_0x43df37++,'VoiceExtensionId':_0x5ee1dd['id']});}else{_0x2fb132['push']({'type':_0x311ca3[_0x3665('0x3')]['toLowerCase'](),'app':_0x3665('0x37'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5ee1dd[_0x3665('0x6')],'exten':_0x5ee1dd[_0x3665('0x7')],'priority':_0x311ca3[_0x3665('0x32')]['length']+_0x22c933+_0x43df37++,'VoiceExtensionId':_0x5ee1dd['id']});_0x2fb132[_0x3665('0xc')]({'type':_0x311ca3[_0x3665('0x3')][_0x3665('0x35')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5ee1dd['context'],'exten':_0x5ee1dd[_0x3665('0x7')],'priority':_0x311ca3['intervals'][_0x3665('0x22')]+_0x22c933+_0x43df37++,'VoiceExtensionId':_0x5ee1dd['id']});}}}}for(var _0x2b95ab=0x0;_0x2b95ab<_0x311ca3[_0x3665('0x32')][_0x3665('0x22')];_0x2b95ab++){var _0x43064e=_0x22c933+_0x311ca3[_0x3665('0x32')][_0x3665('0x22')];var _0x22b369=_0x2b95ab===_0x311ca3[_0x3665('0x32')][_0x3665('0x22')]-0x1?_0x22c933+_0x2fb132[_0x3665('0x22')]+_0x5d4900[_0x3665('0x22')]+0x2:_0x22c933+_0x2b95ab+0x1;_0x2fb132[_0x3665('0x44')](_0x2b95ab,0x0,{'type':_0x5ee1dd['type'],'app':_0x3665('0x45'),'appdata':_0x311ca3[_0x3665('0x32')][_0x2b95ab]+'?'+_0x5ee1dd['context']+_0x3665('0x46')+_0x43064e+':'+_0x5ee1dd[_0x3665('0x6')]+_0x3665('0x46')+_0x22b369,'exten':_0x5ee1dd[_0x3665('0x7')],'context':_0x5ee1dd[_0x3665('0x6')],'priority':_0x22c933+_0x2b95ab,'VoiceExtensionId':_0x5ee1dd['id']});}if(_0x311ca3[_0x3665('0x41')]===_0x3665('0x47')){_0x311ca3['appdata']=_0xc5c4e3(_0x5ee1dd,_0x311ca3[_0x3665('0x48')]);}if(_0x311ca3[_0x3665('0x41')]===_0x3665('0x49')){_0x2fb132[_0x3665('0xc')]({'type':_0x311ca3['type'][_0x3665('0x35')](),'app':'Set','appdata':_0x3665('0x4a'),'context':_0x5ee1dd['context'],'exten':_0x5ee1dd['exten'],'priority':_0x311ca3['intervals']['length']+_0x22c933+_0x43df37++,'VoiceExtensionId':_0x5ee1dd['id']});}_0x311ca3[_0x3665('0x4b')]=_0x2fb132[_0x3665('0x22')]?_[_0x3665('0x4c')](_0x2fb132)[_0x3665('0x4b')]+0x1:_0x22c933;_0x33a916=_[_0x3665('0x4d')](_0x33a916,_0x2fb132,[_0x311ca3],_0x5d4900);_0x22c933=_['last'](_0x33a916)[_0x3665('0x4b')]+0x1;}return _0x1558d3(_0x33a916);})[_0x3665('0x4e')](function(_0x4dde8d){_0x4d78a2(_0x4dde8d);});});}return _0x5c688c['define']('VoiceExtension',attributes,{'tableName':_0x3665('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4c6f41){var _0x315670=this[_0x3665('0x50')]({'plain':!![]});var _0x2835fc=_0x315670[_0x3665('0x3')]===_0x3665('0x10')?_0x102bc8(_0x315670):_0x5843e2(_0x315670);return _0x1abae6(_0x315670,_0x4c6f41,_[_0x3665('0x4c')](_0x2835fc)[_0x3665('0x4b')]+0x1)[_0x3665('0x30')](function(_0xa11d2e){var _0x3c0ef6=_[_0x3665('0x4d')](_0x2835fc,_0xa11d2e);_0x3c0ef6[_0x3665('0xc')]({'type':_0x315670[_0x3665('0x3')],'app':_0x3665('0x51'),'exten':_0x315670[_0x3665('0x7')],'context':_0x315670['context'],'priority':_[_0x3665('0x4c')](_0x3c0ef6)[_0x3665('0x4b')]+0x1,'VoiceExtensionId':_0x315670['id']});return _0x3c0ef6;});}}});}; \ No newline at end of file +var _0x6ddd=['interval','IntervalId','*,*,*,*','intervals','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','CDR(type)=','type','context','exten','alias','Set','No\x20alias\x20set','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','NoOp','CDR(routeAlias)=','outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','timeout','options','url','length','name','trunk','param','split','prefix','phone','${EXTEN:','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','findAll'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x6ddd,0x157));var _0xd6dd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6ddd[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xd6dd('0x0'));var attributes=require(_0xd6dd('0x1'));module['exports']=function(_0xe92406){var _0x1e646f=_0xe92406[_0xd6dd('0x2')];function _0x13d091(_0x2205d1){var _0x172192=0x2;var _0x25c44f=[{'type':_0x2205d1['type'],'app':'Set','appdata':_0xd6dd('0x3')+_0x2205d1[_0xd6dd('0x4')],'context':_0x2205d1[_0xd6dd('0x5')],'exten':_0x2205d1[_0xd6dd('0x6')],'priority':_0x172192++,'VoiceExtensionId':_0x2205d1['id']},{'type':_0x2205d1[_0xd6dd('0x4')],'app':_0x2205d1[_0xd6dd('0x7')]?_0xd6dd('0x8'):'NoOp','appdata':_0x2205d1[_0xd6dd('0x7')]?'CDR(routeAlias)='+_0x2205d1['alias']:_0xd6dd('0x9'),'context':_0x2205d1[_0xd6dd('0x5')],'exten':_0x2205d1[_0xd6dd('0x6')],'priority':_0x172192++,'VoiceExtensionId':_0x2205d1['id']}];if(_0x2205d1[_0xd6dd('0x4')]===_0xd6dd('0xa')){_0x25c44f[_0xd6dd('0xb')]({'type':_0xd6dd('0xa'),'app':_0xd6dd('0x8'),'appdata':'CDR(routeid)='+_0x2205d1['id'],'context':_0x2205d1[_0xd6dd('0x5')],'exten':_0x2205d1[_0xd6dd('0x6')],'priority':_0x172192++,'VoiceExtensionId':_0x2205d1['id']});}_0x25c44f['push']({'type':_0x2205d1[_0xd6dd('0x4')],'app':_0xd6dd('0x8'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2205d1['context'],'exten':_0x2205d1[_0xd6dd('0x6')],'priority':_0x172192++,'VoiceExtensionId':_0x2205d1['id']},{'type':_0x2205d1['type'],'app':'Set','appdata':_0xd6dd('0xc'),'context':_0x2205d1[_0xd6dd('0x5')],'exten':_0x2205d1[_0xd6dd('0x6')],'priority':_0x172192++,'VoiceExtensionId':_0x2205d1['id']},{'type':_0x2205d1[_0xd6dd('0x4')],'app':'Set','appdata':_0xd6dd('0xd'),'context':_0x2205d1[_0xd6dd('0x5')],'exten':_0x2205d1[_0xd6dd('0x6')],'priority':_0x172192++,'VoiceExtensionId':_0x2205d1['id']});return _0x25c44f;}function _0x1a5f47(_0x3feeaa){var _0xb07e27=0x2;var _0x17142d=[{'type':'outbound','app':_0xd6dd('0x8'),'appdata':_0xd6dd('0xe'),'context':_0x3feeaa['context'],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':'outbound','app':_0x3feeaa[_0xd6dd('0x7')]?_0xd6dd('0x8'):_0xd6dd('0xf'),'appdata':_0x3feeaa['alias']?_0xd6dd('0x10')+_0x3feeaa['alias']:_0xd6dd('0x9'),'context':_0x3feeaa[_0xd6dd('0x5')],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':_0xd6dd('0x11'),'app':'Set','appdata':_0xd6dd('0x12')+(_0x3feeaa[_0xd6dd('0x13')]?'${EXTEN:'+_0x3feeaa['cutdigits']+'}':_0xd6dd('0x14')),'context':_0x3feeaa['context'],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':_0xd6dd('0x11'),'app':'Set','appdata':'CDR(routeid)='+_0x3feeaa['id'],'context':_0x3feeaa[_0xd6dd('0x5')],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':'outbound','app':'ExecIf','appdata':_0xd6dd('0x15')+(_0xb07e27+0x2)+_0xd6dd('0x16')+(_0xb07e27+0x1)+')','context':_0x3feeaa[_0xd6dd('0x5')],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':_0xd6dd('0x11'),'app':'Set','appdata':_0x3feeaa[_0xd6dd('0x13')]?_0xd6dd('0x17')+_0x3feeaa[_0xd6dd('0x13')]+'}':_0xd6dd('0x18'),'context':_0x3feeaa[_0xd6dd('0x5')],'exten':_0x3feeaa['exten'],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':_0xd6dd('0x11'),'app':_0xd6dd('0x8'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3feeaa[_0xd6dd('0x5')],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':_0xd6dd('0x11'),'app':'Set','appdata':_0xd6dd('0xc'),'context':_0x3feeaa[_0xd6dd('0x5')],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':_0xd6dd('0x11'),'app':'Set','appdata':_0xd6dd('0xd'),'context':_0x3feeaa['context'],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':_0xd6dd('0x11'),'app':'Set','appdata':_0xd6dd('0x19')+_0x3feeaa['id'],'context':_0x3feeaa['context'],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']}];if(_0x3feeaa[_0xd6dd('0x1a')]('recordingFormat')&&_0x3feeaa[_0xd6dd('0x1b')]!==_0xd6dd('0x1c')){_0x17142d[_0xd6dd('0xb')]({'type':_0xd6dd('0x11'),'app':_0xd6dd('0x8'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3feeaa[_0xd6dd('0x5')],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']},{'type':_0xd6dd('0x11'),'app':_0xd6dd('0x8'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3feeaa[_0xd6dd('0x1b')]||_0xd6dd('0x1d'),'context':_0x3feeaa[_0xd6dd('0x5')],'exten':_0x3feeaa[_0xd6dd('0x6')],'priority':_0xb07e27++,'VoiceExtensionId':_0x3feeaa['id']});}return _0x17142d;}function _0x558091(_0x3d9769,_0x245c49){var _0x392937=[{'name':'trunk','param':0x0},{'name':_0xd6dd('0x1e'),'param':0x1},{'name':_0xd6dd('0x1f'),'param':0x2},{'name':_0xd6dd('0x20'),'param':0x3}];var _0x542c73={};var _0x147941=_0x245c49['split'](',');var _0x36b9b5=[];for(var _0x555f35=0x0;_0x555f35<_0x392937[_0xd6dd('0x21')];_0x555f35++){switch(_0x392937[_0x555f35][_0xd6dd('0x22')]){case'trunk':_0x542c73[_0xd6dd('0x23')]=_0x147941[_0x392937[_0x555f35][_0xd6dd('0x24')]][_0xd6dd('0x25')]('/')[0x1];_0x542c73['phone']=_0x147941[_0x392937[_0x555f35][_0xd6dd('0x24')]][_0xd6dd('0x25')]('/')[0x2];_0x542c73[_0xd6dd('0x26')]=_0x542c73[_0xd6dd('0x27')]?_0x542c73[_0xd6dd('0x27')]['split']('$')[0x0]:undefined;_0x542c73[_0xd6dd('0x27')]=_0x3d9769[_0xd6dd('0x13')]?(_0x542c73[_0xd6dd('0x26')]||'')+_0xd6dd('0x28')+_0x3d9769[_0xd6dd('0x13')]+'}':(_0x542c73[_0xd6dd('0x26')]||'')+_0xd6dd('0x14');_0x36b9b5[_0x392937[_0x555f35][_0xd6dd('0x24')]]=[_0xd6dd('0x29'),_0x542c73[_0xd6dd('0x23')],_0x542c73['phone']][_0xd6dd('0x2a')]('/');break;case _0xd6dd('0x1f'):_0x542c73[_0xd6dd('0x1f')]=_0x147941[_0x392937[_0x555f35]['param']];if(_0x3d9769['recordingFormat']!==_0xd6dd('0x1c')){if(_0x542c73['options']['indexOf'](_0xd6dd('0x2b'))<0x0){_0x542c73[_0xd6dd('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x542c73['options']=_0x542c73['options'][_0xd6dd('0x2c')]('U(xcally-mixmonitor-context)','');}_0x36b9b5[_0x392937[_0x555f35][_0xd6dd('0x24')]]=_0x542c73['options'];break;default:_0x36b9b5[_0x392937[_0x555f35]['param']]=_0x147941[_0x392937[_0x555f35]['param']];}}return _0x36b9b5[_0xd6dd('0x2a')](',');}function _0x199f2d(_0x1b3d42,_0x330aee,_0x470bfe){return new Promise(function(_0x3159cc,_0xd6f025){var _0x155ad3=[];if(_[_0xd6dd('0x2d')](_0x330aee))return _0x3159cc(_0x155ad3);_0x1e646f['Interval'][_0xd6dd('0x2e')]({'attributes':['id',_0xd6dd('0x2f'),_0xd6dd('0x30')],'raw':!![]})['then'](function(_0x2957d2){for(var _0x238e3b=0x0,_0x29ee6f=0x0;_0x238e3b<_0x330aee[_0xd6dd('0x21')];_0x238e3b++,_0x29ee6f=0x0){var _0x52a9fd=_0x330aee[_0x238e3b];var _0x4cdf70=[];var _0x56918c=[];delete _0x52a9fd['id'];if(_0x52a9fd[_0xd6dd('0x2f')]!==_0xd6dd('0x31')){_0x52a9fd[_0xd6dd('0x32')]=[_0x52a9fd[_0xd6dd('0x2f')]];}else{_0x52a9fd[_0xd6dd('0x32')]=_0x52a9fd[_0xd6dd('0x30')]?_['map'](_['filter'](_0x2957d2,{'IntervalId':_0x52a9fd[_0xd6dd('0x30')]}),_0xd6dd('0x2f')):[];}_0x52a9fd[_0xd6dd('0x5')]=_0x1b3d42[_0xd6dd('0x5')];_0x52a9fd[_0xd6dd('0x6')]=_0x1b3d42[_0xd6dd('0x6')];if(_0x52a9fd[_0xd6dd('0x4')])_0x52a9fd[_0xd6dd('0x4')]=_0x52a9fd['type']['toLowerCase']();if(_0x1b3d42[_0xd6dd('0x4')]===_0xd6dd('0x11')){if(_0x52a9fd[_0xd6dd('0x1a')](_0xd6dd('0x33'))&&_0x52a9fd[_0xd6dd('0x33')]&&_0x52a9fd[_0xd6dd('0x33')]!=='--'){_0x4cdf70[_0xd6dd('0xb')]({'type':_0x52a9fd[_0xd6dd('0x4')][_0xd6dd('0x34')](),'app':_0xd6dd('0x8'),'appdata':'CDR(tag)='+_0x52a9fd[_0xd6dd('0x33')],'context':_0x1b3d42[_0xd6dd('0x5')],'exten':_0x1b3d42['exten'],'priority':_0x52a9fd[_0xd6dd('0x32')]['length']+_0x470bfe+_0x29ee6f++,'VoiceExtensionId':_0x1b3d42['id']});}_0x4cdf70['push']({'type':_0x52a9fd[_0xd6dd('0x4')][_0xd6dd('0x34')](),'app':'ExecIf','appdata':_0xd6dd('0x35')+(_0x52a9fd[_0xd6dd('0x36')]?_0xd6dd('0x37')+_0x52a9fd[_0xd6dd('0x36')]+')':_0xd6dd('0x38')),'context':_0x1b3d42[_0xd6dd('0x5')],'exten':_0x1b3d42[_0xd6dd('0x6')],'priority':_0x52a9fd[_0xd6dd('0x32')][_0xd6dd('0x21')]+_0x470bfe+_0x29ee6f++,'VoiceExtensionId':_0x1b3d42['id']});}else{if(_0x52a9fd['hasOwnProperty'](_0xd6dd('0x39'))){if([_0xd6dd('0x3a'),'playback']['includes'](_0x52a9fd['app'][_0xd6dd('0x34')]())&&_0x52a9fd[_0xd6dd('0x3b')]!==_0xd6dd('0x3c')){if(_0x52a9fd[_0xd6dd('0x39')]){_0x4cdf70[_0xd6dd('0xb')]({'type':_0x52a9fd[_0xd6dd('0x4')]['toLowerCase'](),'app':_0xd6dd('0x3d'),'appdata':_0xd6dd('0x3e'),'context':_0x1b3d42[_0xd6dd('0x5')],'exten':_0x1b3d42[_0xd6dd('0x6')],'priority':_0x52a9fd[_0xd6dd('0x32')][_0xd6dd('0x21')]+_0x470bfe+_0x29ee6f++,'VoiceExtensionId':_0x1b3d42['id']});_0x4cdf70[_0xd6dd('0xb')]({'type':_0x52a9fd['type'][_0xd6dd('0x34')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1b3d42[_0xd6dd('0x5')],'exten':_0x1b3d42[_0xd6dd('0x6')],'priority':_0x52a9fd[_0xd6dd('0x32')]['length']+_0x470bfe+_0x29ee6f++,'VoiceExtensionId':_0x1b3d42['id']});}else{_0x4cdf70[_0xd6dd('0xb')]({'type':_0x52a9fd['type']['toLowerCase'](),'app':_0xd6dd('0x3d'),'appdata':_0xd6dd('0x3f'),'context':_0x1b3d42['context'],'exten':_0x1b3d42[_0xd6dd('0x6')],'priority':_0x52a9fd[_0xd6dd('0x32')]['length']+_0x470bfe+_0x29ee6f++,'VoiceExtensionId':_0x1b3d42['id']});_0x4cdf70[_0xd6dd('0xb')]({'type':_0x52a9fd[_0xd6dd('0x4')]['toLowerCase'](),'app':_0xd6dd('0x8'),'appdata':_0xd6dd('0x40'),'context':_0x1b3d42[_0xd6dd('0x5')],'exten':_0x1b3d42[_0xd6dd('0x6')],'priority':_0x52a9fd[_0xd6dd('0x32')][_0xd6dd('0x21')]+_0x470bfe+_0x29ee6f++,'VoiceExtensionId':_0x1b3d42['id']});}}}}for(var _0x2c2d9e=0x0;_0x2c2d9e<_0x52a9fd[_0xd6dd('0x32')][_0xd6dd('0x21')];_0x2c2d9e++){var _0x11037b=_0x470bfe+_0x52a9fd['intervals'][_0xd6dd('0x21')];var _0x45fd7c=_0x2c2d9e===_0x52a9fd['intervals']['length']-0x1?_0x470bfe+_0x4cdf70['length']+_0x56918c[_0xd6dd('0x21')]+0x2:_0x470bfe+_0x2c2d9e+0x1;_0x4cdf70[_0xd6dd('0x41')](_0x2c2d9e,0x0,{'type':_0x1b3d42['type'],'app':'GotoIfTime','appdata':_0x52a9fd[_0xd6dd('0x32')][_0x2c2d9e]+'?'+_0x1b3d42[_0xd6dd('0x5')]+_0xd6dd('0x42')+_0x11037b+':'+_0x1b3d42[_0xd6dd('0x5')]+_0xd6dd('0x42')+_0x45fd7c,'exten':_0x1b3d42[_0xd6dd('0x6')],'context':_0x1b3d42['context'],'priority':_0x470bfe+_0x2c2d9e,'VoiceExtensionId':_0x1b3d42['id']});}if(_0x52a9fd[_0xd6dd('0x3b')]===_0xd6dd('0x43')){_0x52a9fd[_0xd6dd('0x44')]=_0x558091(_0x1b3d42,_0x52a9fd[_0xd6dd('0x44')]);}if(_0x52a9fd['appType']===_0xd6dd('0x45')){_0x4cdf70[_0xd6dd('0xb')]({'type':_0x52a9fd[_0xd6dd('0x4')][_0xd6dd('0x34')](),'app':_0xd6dd('0x8'),'appdata':_0xd6dd('0x46'),'context':_0x1b3d42[_0xd6dd('0x5')],'exten':_0x1b3d42[_0xd6dd('0x6')],'priority':_0x52a9fd['intervals'][_0xd6dd('0x21')]+_0x470bfe+_0x29ee6f++,'VoiceExtensionId':_0x1b3d42['id']});}_0x52a9fd[_0xd6dd('0x47')]=_0x4cdf70['length']?_[_0xd6dd('0x48')](_0x4cdf70)[_0xd6dd('0x47')]+0x1:_0x470bfe;_0x155ad3=_[_0xd6dd('0x49')](_0x155ad3,_0x4cdf70,[_0x52a9fd],_0x56918c);_0x470bfe=_['last'](_0x155ad3)[_0xd6dd('0x47')]+0x1;}return _0x3159cc(_0x155ad3);})['catch'](function(_0x4278a9){_0xd6f025(_0x4278a9);});});}return _0xe92406['define'](_0xd6dd('0x4a'),attributes,{'tableName':_0xd6dd('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x331095){var _0x113c3d=this[_0xd6dd('0x4c')]({'plain':!![]});var _0x95374f=_0x113c3d[_0xd6dd('0x4')]===_0xd6dd('0x11')?_0x1a5f47(_0x113c3d):_0x13d091(_0x113c3d);return _0x199f2d(_0x113c3d,_0x331095,_[_0xd6dd('0x48')](_0x95374f)[_0xd6dd('0x47')]+0x1)['then'](function(_0xa39db2){var _0x2c0270=_['concat'](_0x95374f,_0xa39db2);_0x2c0270[_0xd6dd('0xb')]({'type':_0x113c3d['type'],'app':_0xd6dd('0x4d'),'exten':_0x113c3d[_0xd6dd('0x6')],'context':_0x113c3d['context'],'priority':_['last'](_0x2c0270)[_0xd6dd('0x47')]+0x1,'VoiceExtensionId':_0x113c3d['id']});return _0x2c0270;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 58db5d4..cc34f98 100644 --- a/server/api/voiceExtension/voiceExtension.rpc.js +++ b/server/api/voiceExtension/voiceExtension.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc9b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','debug','lodash'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xfc9b,0x74));var _0xbfc9=function(_0x1deef5,_0x4d0380){_0x1deef5=_0x1deef5-0x0;var _0x2ea1ed=_0xfc9b[_0x1deef5];return _0x2ea1ed;};'use strict';var _=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var moment=require(_0xbfc9('0x2'));var BPromise=require(_0xbfc9('0x3'));var rs=require(_0xbfc9('0x4'));var fs=require('fs');var Redis=require(_0xbfc9('0x5'));var db=require(_0xbfc9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfc9('0x7'))('rpc');var config=require(_0xbfc9('0x8'));var jayson=require(_0xbfc9('0x9'));var client=jayson['client'][_0xbfc9('0xa')]({'port':0x232a});config[_0xbfc9('0xb')]=_[_0xbfc9('0xc')](config[_0xbfc9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbfc9('0xd'))(new Redis(config['redis']));require(_0xbfc9('0xe'))['register'](socket);function respondWithRpcPromise(_0x1c8191,_0x52af50,_0x2c3bab){return new BPromise(function(_0x104521,_0x152c82){return client[_0xbfc9('0xf')](_0x1c8191,_0x2c3bab)[_0xbfc9('0x10')](function(_0x20ded8){logger['info'](_0xbfc9('0x11'),_0x52af50,_0xbfc9('0x12'));logger['debug'](_0xbfc9('0x13'),_0x52af50,'request\x20sent',JSON[_0xbfc9('0x14')](_0x20ded8));if(_0x20ded8[_0xbfc9('0x15')]){if(_0x20ded8[_0xbfc9('0x15')][_0xbfc9('0x16')]===0x1f4){logger['error'](_0xbfc9('0x11'),_0x52af50,_0x20ded8[_0xbfc9('0x15')][_0xbfc9('0x17')]);return _0x152c82(_0x20ded8[_0xbfc9('0x15')][_0xbfc9('0x17')]);}logger[_0xbfc9('0x15')](_0xbfc9('0x11'),_0x52af50,_0x20ded8[_0xbfc9('0x15')][_0xbfc9('0x17')]);return _0x104521(_0x20ded8[_0xbfc9('0x15')][_0xbfc9('0x17')]);}else{logger[_0xbfc9('0x18')](_0xbfc9('0x11'),_0x52af50,_0xbfc9('0x12'));_0x104521(_0x20ded8[_0xbfc9('0x19')][_0xbfc9('0x17')]);}})[_0xbfc9('0x1a')](function(_0x45967a){logger[_0xbfc9('0x15')](_0xbfc9('0x11'),_0x52af50,_0x45967a);_0x152c82(_0x45967a);});});}exports[_0xbfc9('0x1b')]=function(_0x3ec859){var _0x4f3e2e=this;return new Promise(function(_0x1740e2,_0x1217f4){return db[_0xbfc9('0x1c')][_0xbfc9('0x1d')]({'raw':_0x3ec859[_0xbfc9('0x1e')]?_0x3ec859[_0xbfc9('0x1e')][_0xbfc9('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ec859[_0xbfc9('0x1e')]?_0x3ec859[_0xbfc9('0x1e')][_0xbfc9('0x20')]||null:null,'attributes':_0x3ec859[_0xbfc9('0x1e')]?_0x3ec859[_0xbfc9('0x1e')][_0xbfc9('0x21')]||null:null,'limit':_0x3ec859[_0xbfc9('0x1e')]?_0x3ec859['options'][_0xbfc9('0x22')]||null:null,'include':_0x3ec859[_0xbfc9('0x1e')]?_0x3ec859[_0xbfc9('0x1e')][_0xbfc9('0x23')]?_[_0xbfc9('0x24')](_0x3ec859['options'][_0xbfc9('0x23')],function(_0xa64699){return{'model':db[_0xa64699[_0xbfc9('0x25')]],'as':_0xa64699['as'],'attributes':_0xa64699[_0xbfc9('0x21')],'include':_0xa64699[_0xbfc9('0x23')]?_[_0xbfc9('0x24')](_0xa64699[_0xbfc9('0x23')],function(_0x11eaa5){return{'model':db[_0x11eaa5[_0xbfc9('0x25')]],'as':_0x11eaa5['as'],'attributes':_0x11eaa5['attributes'],'include':_0x11eaa5['include']?_['map'](_0x11eaa5[_0xbfc9('0x23')],function(_0x4dd2da){return{'model':db[_0x4dd2da['model']],'as':_0x4dd2da['as'],'attributes':_0x4dd2da[_0xbfc9('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbfc9('0x10')](function(_0xfa1abc){logger[_0xbfc9('0x18')](_0xbfc9('0x1b'),_0x3ec859);logger[_0xbfc9('0x26')](_0xbfc9('0x1b'),_0x3ec859,JSON[_0xbfc9('0x14')](_0xfa1abc));_0x1740e2(_0xfa1abc);})[_0xbfc9('0x1a')](function(_0x56c98e){logger[_0xbfc9('0x15')](_0xbfc9('0x1b'),_0x56c98e[_0xbfc9('0x17')],_0x3ec859);_0x1217f4(_0x4f3e2e['error'](0x1f4,_0x56c98e[_0xbfc9('0x17')]));});});}; \ No newline at end of file +var _0x9973=['VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','include','model','map','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','./voiceExtension.socket','register','request','then','info'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x9973,0x157));var _0x3997=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9973[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x3997('0x0'));var moment=require(_0x3997('0x1'));var BPromise=require('bluebird');var rs=require(_0x3997('0x2'));var fs=require('fs');var Redis=require(_0x3997('0x3'));var db=require(_0x3997('0x4'))['db'];var utils=require(_0x3997('0x5'));var logger=require(_0x3997('0x6'))(_0x3997('0x7'));var config=require(_0x3997('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3997('0x9')]({'port':0x232a});config[_0x3997('0xa')]=_[_0x3997('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3997('0xa')]));require(_0x3997('0xc'))[_0x3997('0xd')](socket);function respondWithRpcPromise(_0xaa5f42,_0x96da4b,_0x2290df){return new BPromise(function(_0x6ec837,_0x1d166e){return client[_0x3997('0xe')](_0xaa5f42,_0x2290df)[_0x3997('0xf')](function(_0x140b13){logger[_0x3997('0x10')](_0x3997('0x11'),_0x96da4b,_0x3997('0x12'));logger[_0x3997('0x13')](_0x3997('0x14'),_0x96da4b,_0x3997('0x12'),JSON[_0x3997('0x15')](_0x140b13));if(_0x140b13[_0x3997('0x16')]){if(_0x140b13[_0x3997('0x16')][_0x3997('0x17')]===0x1f4){logger[_0x3997('0x16')](_0x3997('0x11'),_0x96da4b,_0x140b13['error'][_0x3997('0x18')]);return _0x1d166e(_0x140b13[_0x3997('0x16')][_0x3997('0x18')]);}logger[_0x3997('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x96da4b,_0x140b13[_0x3997('0x16')][_0x3997('0x18')]);return _0x6ec837(_0x140b13['error']['message']);}else{logger[_0x3997('0x10')](_0x3997('0x11'),_0x96da4b,'request\x20sent');_0x6ec837(_0x140b13[_0x3997('0x19')][_0x3997('0x18')]);}})[_0x3997('0x1a')](function(_0x122130){logger[_0x3997('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x96da4b,_0x122130);_0x1d166e(_0x122130);});});}exports[_0x3997('0x1b')]=function(_0x3631ef){var _0x16cb82=this;return new Promise(function(_0x541832,_0x20caab){return db[_0x3997('0x1c')]['findAll']({'raw':_0x3631ef[_0x3997('0x1d')]?_0x3631ef[_0x3997('0x1d')][_0x3997('0x1e')]===undefined?!![]:![]:!![],'where':_0x3631ef['options']?_0x3631ef['options'][_0x3997('0x1f')]||null:null,'attributes':_0x3631ef[_0x3997('0x1d')]?_0x3631ef[_0x3997('0x1d')][_0x3997('0x20')]||null:null,'limit':_0x3631ef['options']?_0x3631ef[_0x3997('0x1d')]['limit']||null:null,'include':_0x3631ef['options']?_0x3631ef[_0x3997('0x1d')][_0x3997('0x21')]?_['map'](_0x3631ef['options'][_0x3997('0x21')],function(_0xe3e7b6){return{'model':db[_0xe3e7b6[_0x3997('0x22')]],'as':_0xe3e7b6['as'],'attributes':_0xe3e7b6['attributes'],'include':_0xe3e7b6['include']?_['map'](_0xe3e7b6[_0x3997('0x21')],function(_0x124022){return{'model':db[_0x124022[_0x3997('0x22')]],'as':_0x124022['as'],'attributes':_0x124022[_0x3997('0x20')],'include':_0x124022[_0x3997('0x21')]?_[_0x3997('0x23')](_0x124022['include'],function(_0x5ad688){return{'model':db[_0x5ad688[_0x3997('0x22')]],'as':_0x5ad688['as'],'attributes':_0x5ad688[_0x3997('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cec57){logger[_0x3997('0x10')](_0x3997('0x1b'),_0x3631ef);logger[_0x3997('0x13')](_0x3997('0x1b'),_0x3631ef,JSON[_0x3997('0x15')](_0x2cec57));_0x541832(_0x2cec57);})['catch'](function(_0x24fdf2){logger[_0x3997('0x16')](_0x3997('0x1b'),_0x24fdf2[_0x3997('0x18')],_0x3631ef);_0x20caab(_0x16cb82[_0x3997('0x16')](0x1f4,_0x24fdf2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0784ba6..07ad788 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0x814b,0x1a2));var _0xb814=function(_0x2df4cc,_0x1233c6){_0x2df4cc=_0x2df4cc-0x0;var _0x40af8d=_0x814b[_0x2df4cc];return _0x40af8d;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x443d09,_0x352670){var _0x332743=function(_0x14d42a){while(--_0x14d42a){_0x443d09['push'](_0x443d09['shift']());}};_0x332743(++_0x352670);}(_0x326f,0xd1));var _0xf326=function(_0x22f2ac,_0x5b4eb5){_0x22f2ac=_0x22f2ac-0x0;var _0x41901d=_0x326f[_0x22f2ac];return _0x41901d;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4f44593..ab628f8 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fb4=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x4fb4,0x190));var _0x44fb=function(_0x4c9ea9,_0x287bb3){_0x4c9ea9=_0x4c9ea9-0x0;var _0xa6a9a1=_0x4fb4[_0x4c9ea9];return _0xa6a9a1;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var fs_extra=require(_0x44fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var controller=require(_0x44fb('0x8'));router[_0x44fb('0x9')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0xb')]);router[_0x44fb('0x9')](_0x44fb('0xc'),auth['isAuthenticated'](),controller[_0x44fb('0xd')]);router[_0x44fb('0x9')]('/:id/messages',auth[_0x44fb('0xa')](),controller[_0x44fb('0xe')]);router[_0x44fb('0xf')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0x10')]);router[_0x44fb('0x11')](_0x44fb('0xc'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x12')]);router[_0x44fb('0x13')]('/:id',auth[_0x44fb('0xa')](),controller[_0x44fb('0x14')]);module[_0x44fb('0x15')]=router; \ No newline at end of file +var _0x9fd4=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/messages'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x5b2a15,_0xd200ec){_0x5b2a15=_0x5b2a15-0x0;var _0x33038d=_0x9fd4[_0x5b2a15];return _0x33038d;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/:id',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['getMessages']);router[_0x49fd('0xe')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x10')](_0x49fd('0x11'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x12')]);router['delete'](_0x49fd('0x11'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x13')]);module[_0x49fd('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9604f19..0d69bdc 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27d0=['fullname','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x16f196,_0x296f96){var _0x39dbbc=function(_0x49581c){while(--_0x49581c){_0x16f196['push'](_0x16f196['shift']());}};_0x39dbbc(++_0x296f96);}(_0x27d0,0x97));var _0x027d=function(_0x18811b,_0x6bede4){_0x18811b=_0x18811b-0x0;var _0x2fbee4=_0x27d0[_0x18811b];return _0x2fbee4;};'use strict';var Sequelize=require(_0x027d('0x0'));module[_0x027d('0x1')]={'customer_id':{'type':Sequelize[_0x027d('0x2')]},'context':{'type':Sequelize[_0x027d('0x2')],'defaultValue':_0x027d('0x3'),'unique':_0x027d('0x4')},'mailbox':{'type':Sequelize[_0x027d('0x2')],'defaultValue':'','allowNull':![],'unique':_0x027d('0x4')},'password':{'type':Sequelize[_0x027d('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x16dfe4){this[_0x027d('0x5')](_0x027d('0x6'),typeof _0x16dfe4==='string'&&_0x16dfe4[_0x027d('0x7')]()?_0x16dfe4[_0x027d('0x7')]():null);}},'pager':{'type':Sequelize[_0x027d('0x2')]},'tz':{'type':Sequelize[_0x027d('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x027d('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x027d('0x8')]('yes','no'),'defaultValue':_0x027d('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x027d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x027d('0x8')](_0x027d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x027d('0x8')](_0x027d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x027d('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x027d('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x027d('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x027d('0x8')](_0x027d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x027d('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x027d('0x8')](_0x027d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x027d('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x027d('0x8')](_0x027d('0x9'),'no'),'defaultValue':_0x027d('0x9'),'allowNull':![]},'stamp':{'type':_0x027d('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x027d('0x2')]},'maxsecs':{'type':Sequelize[_0x027d('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x027d('0xd')](_0x027d('0xe'))+'\x20-\x20'+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x21d3=['fullname','\x20-\x20','mailbox','sequelize','STRING','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x2e9e28,_0x1dc395){var _0x129e66=function(_0x11a352){while(--_0x11a352){_0x2e9e28['push'](_0x2e9e28['shift']());}};_0x129e66(++_0x1dc395);}(_0x21d3,0xf3));var _0x321d=function(_0x58e0af,_0x4d943d){_0x58e0af=_0x58e0af-0x0;var _0x375f8c=_0x21d3[_0x58e0af];return _0x375f8c;};'use strict';var Sequelize=require(_0x321d('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x321d('0x1')]},'context':{'type':Sequelize[_0x321d('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x321d('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x321d('0x1')]},'fullname':{'type':Sequelize[_0x321d('0x1')]},'email':{'type':Sequelize[_0x321d('0x1')],'validate':{'isEmail':!![]},'set':function(_0x41770e){this[_0x321d('0x2')](_0x321d('0x3'),typeof _0x41770e===_0x321d('0x4')&&_0x41770e[_0x321d('0x5')]()?_0x41770e['trim']():null);}},'pager':{'type':Sequelize[_0x321d('0x1')]},'tz':{'type':Sequelize[_0x321d('0x1')],'defaultValue':_0x321d('0x6')},'attach':{'type':Sequelize[_0x321d('0x7')]('yes','no'),'defaultValue':_0x321d('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x321d('0x8'),'no'),'defaultValue':_0x321d('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x321d('0x1')]},'review':{'type':Sequelize[_0x321d('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x321d('0x7')](_0x321d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x321d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x321d('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x321d('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x321d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x321d('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x321d('0x7')](_0x321d('0x8'),'no'),'defaultValue':_0x321d('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x321d('0x7')](_0x321d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x321d('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x321d('0x7')](_0x321d('0x8'),'no'),'defaultValue':_0x321d('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x321d('0x1')]},'maxsecs':{'type':Sequelize[_0x321d('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x321d('0xb')],'get':function(){return this[_0x321d('0xc')](_0x321d('0xd'))+_0x321d('0xe')+this[_0x321d('0xc')](_0x321d('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 934027a..9501343 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../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','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x1bcadf,_0x12b827){var _0x39ed2c=function(_0x8685aa){while(--_0x8685aa){_0x1bcadf['push'](_0x1bcadf['shift']());}};_0x39ed2c(++_0x12b827);}(_0x34b7,0x196));var _0x734b=function(_0xaac2fd,_0x5357a7){_0xaac2fd=_0xaac2fd-0x0;var _0x57c27a=_0x34b7[_0xaac2fd];return _0x57c27a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file +var _0xd4f4=['get','Voicemails','then','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','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','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy'];(function(_0x4e413f,_0x266ab4){var _0x2eca8a=function(_0x36dc7e){while(--_0x36dc7e){_0x4e413f['push'](_0x4e413f['shift']());}};_0x2eca8a(++_0x266ab4);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x2c885f,_0x4bc00d){_0x2c885f=_0x2c885f-0x0;var _0x54f84f=_0xd4f4[_0x2c885f];return _0x54f84f;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){var _0x44bd2f=_0x3f4a55[_0x4d4f('0x2b')]({'plain':!![]});var _0x1cf365=_0x4d4f('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1cf365,'resourceId':_0x44bd2f['id']}})[_0x4d4f('0x2d')](function(){return _0x3f4a55;});})[_0x4d4f('0x2d')](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x58acbe,_0x671c87){return function(_0x380ebf){if(!_0x380ebf){_0x58acbe[_0x4d4f('0x1d')](0x194);}return _0x380ebf;};}function handleError(_0x2e91b2,_0x4effb1){_0x4effb1=_0x4effb1||0x1f4;return function(_0x338ba2){logger['error'](_0x338ba2[_0x4d4f('0x2e')]);if(_0x338ba2[_0x4d4f('0x2f')]){delete _0x338ba2['name'];}_0x2e91b2[_0x4d4f('0x1f')](_0x4effb1)[_0x4d4f('0x30')](_0x338ba2);};}exports[_0x4d4f('0x31')]=function(_0x3d7f14,_0x19a502){var _0x43a704={},_0x4c69cb={},_0x36eede={'count':0x0,'rows':[]};var _0x4578b6=_[_0x4d4f('0x32')](db[_0x4d4f('0x33')][_0x4d4f('0x34')],function(_0x4e47e5){return{'name':_0x4e47e5[_0x4d4f('0x35')],'type':_0x4e47e5['type'][_0x4d4f('0x36')]};});_0x4c69cb['model']=_['map'](_0x4578b6,'name');_0x4c69cb[_0x4d4f('0x37')]=_['keys'](_0x3d7f14[_0x4d4f('0x37')]);_0x4c69cb[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],_0x4c69cb[_0x4d4f('0x37')]);_0x43a704[_0x4d4f('0x3a')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],qs[_0x4d4f('0x3b')](_0x3d7f14['query'][_0x4d4f('0x3b')]));_0x43a704[_0x4d4f('0x3a')]=_0x43a704[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x43a704[_0x4d4f('0x3a')]:_0x4c69cb[_0x4d4f('0x3d')];if(!_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x43a704['limit']=qs[_0x4d4f('0x23')](_0x3d7f14['query']['limit']);_0x43a704[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x21')]);}_0x43a704[_0x4d4f('0x3f')]=qs['sort'](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x40')]);_0x43a704['where']=qs[_0x4d4f('0x38')](_[_0x4d4f('0x41')](_0x3d7f14[_0x4d4f('0x37')],_0x4c69cb[_0x4d4f('0x38')]),_0x4578b6);if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x43a704[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x43a704[_0x4d4f('0x43')],{'$or':_['map'](_0x4578b6,function(_0x55a151){if(_0x55a151[_0x4d4f('0x45')]!==_0x4d4f('0x46')){var _0x4b3ba1={};_0x4b3ba1[_0x55a151[_0x4d4f('0x2f')]]={'$like':'%'+_0x3d7f14['query']['filter']+'%'};return _0x4b3ba1;}})});}_0x43a704=_[_0x4d4f('0x44')]({},_0x43a704,_0x3d7f14[_0x4d4f('0x47')]);var _0x58b52c={'where':_0x43a704['where']};return db[_0x4d4f('0x33')][_0x4d4f('0x24')](_0x58b52c)['then'](function(_0x949a6d){_0x36eede[_0x4d4f('0x24')]=_0x949a6d;if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x43a704[_0x4d4f('0x49')]=[{'all':!![]}];}return db['VoiceMail'][_0x4d4f('0x4a')](_0x43a704);})['then'](function(_0x45a0c1){_0x36eede[_0x4d4f('0x4b')]=_0x45a0c1;return _0x36eede;})['then'](respondWithFilteredResult(_0x19a502,_0x43a704))[_0x4d4f('0x4c')](handleError(_0x19a502,null));};exports[_0x4d4f('0x4d')]=function(_0x1f7169,_0x489abe){var _0x379b59={'raw':!![],'where':{'id':_0x1f7169[_0x4d4f('0x4e')]['id']}},_0x48caa2={};_0x48caa2['model']=_[_0x4d4f('0x4f')](db[_0x4d4f('0x33')][_0x4d4f('0x34')]);_0x48caa2[_0x4d4f('0x37')]=_[_0x4d4f('0x4f')](_0x1f7169['query']);_0x48caa2['filters']=_[_0x4d4f('0x39')](_0x48caa2[_0x4d4f('0x3d')],_0x48caa2[_0x4d4f('0x37')]);_0x379b59[_0x4d4f('0x3a')]=_['intersection'](_0x48caa2['model'],qs['fields'](_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x379b59[_0x4d4f('0x3a')]=_0x379b59[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x379b59[_0x4d4f('0x3a')]:_0x48caa2[_0x4d4f('0x3d')];if(_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x379b59[_0x4d4f('0x49')]=[{'all':!![]}];}_0x379b59=_[_0x4d4f('0x44')]({},_0x379b59,_0x1f7169[_0x4d4f('0x47')]);return db['VoiceMail'][_0x4d4f('0x50')](_0x379b59)[_0x4d4f('0x2d')](handleEntityNotFound(_0x489abe,null))['then'](respondWithResult(_0x489abe,null))[_0x4d4f('0x4c')](handleError(_0x489abe,null));};exports['create']=function(_0x15cf38,_0x401466){return db['VoiceMail'][_0x4d4f('0x51')](_0x15cf38[_0x4d4f('0x52')],{})[_0x4d4f('0x2d')](function(_0x21d0d6){var _0x7f22f2=_0x15cf38[_0x4d4f('0x53')][_0x4d4f('0x2b')]({'plain':!![]});if(!_0x7f22f2)throw new Error(_0x4d4f('0x54'));if(_0x7f22f2[_0x4d4f('0x55')]===_0x4d4f('0x53')){var _0xa6cef=_0x21d0d6[_0x4d4f('0x2b')]({'plain':!![]});var _0x504d85=_0x4d4f('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x504d85,'userProfileId':_0x7f22f2['userProfileId']},'raw':!![]})[_0x4d4f('0x2d')](function(_0x168742){if(_0x168742&&_0x168742['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d4f('0x51')]({'name':_0xa6cef[_0x4d4f('0x2f')],'resourceId':_0xa6cef['id'],'type':_0x168742['name'],'sectionId':_0x168742['id']},{})[_0x4d4f('0x2d')](function(){return _0x21d0d6;});}else{return _0x21d0d6;}})['catch'](function(_0x17b59e){logger[_0x4d4f('0x56')](_0x4d4f('0x57'),_0x17b59e);throw _0x17b59e;});}return _0x21d0d6;})[_0x4d4f('0x2d')](respondWithResult(_0x401466,0xc9))['catch'](handleError(_0x401466,null));};exports[_0x4d4f('0x29')]=function(_0x2008c3,_0x36a446){if(_0x2008c3[_0x4d4f('0x52')]['id']){delete _0x2008c3[_0x4d4f('0x52')]['id'];}return db['VoiceMail'][_0x4d4f('0x50')]({'where':{'id':_0x2008c3['params']['id']}})[_0x4d4f('0x2d')](handleEntityNotFound(_0x36a446,null))['then'](saveUpdates(_0x2008c3[_0x4d4f('0x52')],null))[_0x4d4f('0x2d')](respondWithResult(_0x36a446,null))['catch'](handleError(_0x36a446,null));};exports[_0x4d4f('0x2a')]=function(_0x1d8ae6,_0x4d08c8){return db[_0x4d4f('0x33')]['find']({'where':{'id':_0x1d8ae6[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d08c8,null))['then'](removeEntity(_0x4d08c8,null))[_0x4d4f('0x4c')](handleError(_0x4d08c8,null));};exports[_0x4d4f('0x58')]=function(_0x23bf8e,_0x213cdb,_0x29a3a1){return db['VoiceMail']['findOne']({'where':{'id':_0x23bf8e[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x213cdb,null))[_0x4d4f('0x2d')](function(_0xadc9ac){var _0x23771c;var _0x4585b5={},_0x31aba3={};_0x31aba3[_0x4d4f('0x3d')]=_['keys'](db[_0x4d4f('0x59')][_0x4d4f('0x34')]);_0x31aba3[_0x4d4f('0x37')]=_['keys'](_0x23bf8e[_0x4d4f('0x37')]);_0x31aba3[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x31aba3['model'],_0x31aba3[_0x4d4f('0x37')]);_0x4585b5['attributes']=_[_0x4d4f('0x39')](_0x31aba3[_0x4d4f('0x3d')],qs[_0x4d4f('0x3b')](_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x4585b5[_0x4d4f('0x3a')]=_0x4585b5[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x4585b5[_0x4d4f('0x3a')]:_0x31aba3['model'];if(!_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x4585b5[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x23')]);_0x4585b5['offset']=qs[_0x4d4f('0x21')](_0x23bf8e[_0x4d4f('0x37')]['offset']);}_0x4585b5['order']=qs[_0x4d4f('0x40')](_0x23bf8e[_0x4d4f('0x37')]['sort']);_0x4585b5['where']=qs['filters'](_[_0x4d4f('0x41')](_0x23bf8e[_0x4d4f('0x37')],_0x31aba3['filters']));if(_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x4585b5[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x4585b5[_0x4d4f('0x43')],{'$or':_[_0x4d4f('0x32')](_0x4585b5[_0x4d4f('0x3a')],function(_0x20845c){var _0x542513={};_0x542513[_0x20845c]={'$like':'%'+_0x23bf8e[_0x4d4f('0x37')]['filter']+'%'};return _0x542513;})});}_0x4585b5[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x4585b5[_0x4d4f('0x43')],{'mailboxuser':_0xadc9ac['mailbox']});_0x4585b5=_[_0x4d4f('0x44')]({},_0x4585b5,_0x23bf8e[_0x4d4f('0x47')]);return db[_0x4d4f('0x59')][_0x4d4f('0x5a')](_0x4585b5)['then'](respondWithFilteredResult(_0x213cdb,_0x4585b5));})[_0x4d4f('0x4c')](handleError(_0x213cdb,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0025200..b18dd83 100644 --- a/server/api/voiceMail/voiceMail.model.js +++ b/server/api/voiceMail/voiceMail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdde1=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment','bluebird'];(function(_0x11c4ce,_0x411fb6){var _0x4b0a7c=function(_0x543b9b){while(--_0x543b9b){_0x11c4ce['push'](_0x11c4ce['shift']());}};_0x4b0a7c(++_0x411fb6);}(_0xdde1,0xdc));var _0x1dde=function(_0x6cfb8a,_0x53be6f){_0x6cfb8a=_0x6cfb8a-0x0;var _0x29ba1d=_0xdde1[_0x6cfb8a];return _0x29ba1d;};'use strict';var _=require(_0x1dde('0x0'));var util=require(_0x1dde('0x1'));var logger=require('../../config/logger')(_0x1dde('0x2'));var moment=require(_0x1dde('0x3'));var BPromise=require(_0x1dde('0x4'));var rp=require(_0x1dde('0x5'));var fs=require('fs');var path=require(_0x1dde('0x6'));var rimraf=require(_0x1dde('0x7'));var config=require(_0x1dde('0x8'));var attributes=require(_0x1dde('0x9'));module[_0x1dde('0xa')]=function(_0x48321f,_0x2255da){return _0x48321f['define']('VoiceMail',attributes,{'tableName':_0x1dde('0xb'),'paranoid':![],'indexes':[{'name':_0x1dde('0xc'),'fields':[_0x1dde('0xd'),_0x1dde('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8ec=['./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x25f4a6,_0x5c702b){var _0x2b623f=function(_0x3776d0){while(--_0x3776d0){_0x25f4a6['push'](_0x25f4a6['shift']());}};_0x2b623f(++_0x5c702b);}(_0xe8ec,0x1bf));var _0xce8e=function(_0x1e27a8,_0x5c0521){_0x1e27a8=_0x1e27a8-0x0;var _0x289d6a=_0xe8ec[_0x1e27a8];return _0x289d6a;};'use strict';var _=require(_0xce8e('0x0'));var util=require(_0xce8e('0x1'));var logger=require(_0xce8e('0x2'))(_0xce8e('0x3'));var moment=require(_0xce8e('0x4'));var BPromise=require(_0xce8e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce8e('0x6'));var rimraf=require(_0xce8e('0x7'));var config=require('../../config/environment');var attributes=require(_0xce8e('0x8'));module[_0xce8e('0x9')]=function(_0x1a8d23,_0x2a2bd5){return _0x1a8d23[_0xce8e('0xa')]('VoiceMail',attributes,{'tableName':_0xce8e('0xb'),'paranoid':![],'indexes':[{'name':_0xce8e('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index dbe27cb..2b13d7a 100644 --- a/server/api/voiceMail/voiceMail.rpc.js +++ b/server/api/voiceMail/voiceMail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x244a=['info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x430686,_0x1dbe9c){var _0x246759=function(_0x314627){while(--_0x314627){_0x430686['push'](_0x430686['shift']());}};_0x246759(++_0x1dbe9c);}(_0x244a,0x1a8));var _0xa244=function(_0x566b5d,_0x3685b1){_0x566b5d=_0x566b5d-0x0;var _0x774642=_0x244a[_0x566b5d];return _0x774642;};'use strict';var _=require(_0xa244('0x0'));var util=require(_0xa244('0x1'));var moment=require('moment');var BPromise=require(_0xa244('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa244('0x3'))['db'];var utils=require(_0xa244('0x4'));var logger=require(_0xa244('0x5'))(_0xa244('0x6'));var config=require(_0xa244('0x7'));var jayson=require(_0xa244('0x8'));var client=jayson[_0xa244('0x9')][_0xa244('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc531a4,_0x5b63d7,_0x17344a){return new BPromise(function(_0x2417bc,_0x1d18a5){return client[_0xa244('0xb')](_0xc531a4,_0x17344a)[_0xa244('0xc')](function(_0x37377e){logger[_0xa244('0xd')](_0xa244('0xe'),_0x5b63d7,'request\x20sent');logger[_0xa244('0xf')](_0xa244('0x10'),_0x5b63d7,_0xa244('0x11'),JSON['stringify'](_0x37377e));if(_0x37377e['error']){if(_0x37377e[_0xa244('0x12')][_0xa244('0x13')]===0x1f4){logger[_0xa244('0x12')](_0xa244('0xe'),_0x5b63d7,_0x37377e[_0xa244('0x12')][_0xa244('0x14')]);return _0x1d18a5(_0x37377e[_0xa244('0x12')][_0xa244('0x14')]);}logger[_0xa244('0x12')]('VoiceMail,\x20%s,\x20%s',_0x5b63d7,_0x37377e[_0xa244('0x12')][_0xa244('0x14')]);return _0x2417bc(_0x37377e['error'][_0xa244('0x14')]);}else{logger[_0xa244('0xd')]('VoiceMail,\x20%s,\x20%s',_0x5b63d7,'request\x20sent');_0x2417bc(_0x37377e[_0xa244('0x15')][_0xa244('0x14')]);}})[_0xa244('0x16')](function(_0x44403f){logger['error'](_0xa244('0xe'),_0x5b63d7,_0x44403f);_0x1d18a5(_0x44403f);});});} \ No newline at end of file +var _0xcd5a=['stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','client','http','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xfbd2d6,_0x488a1b){var _0x1af3df=function(_0x1fcc5e){while(--_0x1fcc5e){_0xfbd2d6['push'](_0xfbd2d6['shift']());}};_0x1af3df(++_0x488a1b);}(_0xcd5a,0x133));var _0xacd5=function(_0x530b7b,_0x3421a9){_0x530b7b=_0x530b7b-0x0;var _0x35be8f=_0xcd5a[_0x530b7b];return _0x35be8f;};'use strict';var _=require(_0xacd5('0x0'));var util=require(_0xacd5('0x1'));var moment=require(_0xacd5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacd5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacd5('0x4'))(_0xacd5('0x5'));var config=require(_0xacd5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xacd5('0x7')][_0xacd5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e1fc7,_0x49740a,_0x48df25){return new BPromise(function(_0x5687d9,_0x5b6fff){return client['request'](_0x5e1fc7,_0x48df25)['then'](function(_0x161186){logger['info'](_0xacd5('0x9'),_0x49740a,'request\x20sent');logger[_0xacd5('0xa')](_0xacd5('0xb'),_0x49740a,_0xacd5('0xc'),JSON[_0xacd5('0xd')](_0x161186));if(_0x161186[_0xacd5('0xe')]){if(_0x161186[_0xacd5('0xe')][_0xacd5('0xf')]===0x1f4){logger['error'](_0xacd5('0x9'),_0x49740a,_0x161186[_0xacd5('0xe')]['message']);return _0x5b6fff(_0x161186[_0xacd5('0xe')][_0xacd5('0x10')]);}logger[_0xacd5('0xe')]('VoiceMail,\x20%s,\x20%s',_0x49740a,_0x161186[_0xacd5('0xe')][_0xacd5('0x10')]);return _0x5687d9(_0x161186[_0xacd5('0xe')][_0xacd5('0x10')]);}else{logger[_0xacd5('0x11')](_0xacd5('0x9'),_0x49740a,_0xacd5('0xc'));_0x5687d9(_0x161186[_0xacd5('0x12')][_0xacd5('0x10')]);}})[_0xacd5('0x13')](function(_0x1a072f){logger[_0xacd5('0xe')](_0xacd5('0x9'),_0x49740a,_0x1a072f);_0x5b6fff(_0x1a072f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 351b71d..630aaac 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc9b=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','post','create','put','update'];(function(_0x3759a3,_0x74d481){var _0x2649df=function(_0x530c47){while(--_0x530c47){_0x3759a3['push'](_0x3759a3['shift']());}};_0x2649df(++_0x74d481);}(_0xdc9b,0xaa));var _0xbdc9=function(_0x109d7c,_0x3db0fd){_0x109d7c=_0x109d7c-0x0;var _0x349c29=_0xdc9b[_0x109d7c];return _0x349c29;};'use strict';var multer=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var path=require(_0xbdc9('0x2'));var timeout=require(_0xbdc9('0x3'));var express=require(_0xbdc9('0x4'));var router=express[_0xbdc9('0x5')]();var fs_extra=require(_0xbdc9('0x6'));var auth=require(_0xbdc9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbdc9('0x8'));var controller=require(_0xbdc9('0x9'));router[_0xbdc9('0xa')]('/',auth[_0xbdc9('0xb')](),controller[_0xbdc9('0xc')]);router[_0xbdc9('0xa')](_0xbdc9('0xd'),auth[_0xbdc9('0xb')](),controller['show']);router[_0xbdc9('0xa')](_0xbdc9('0xe'),auth[_0xbdc9('0xb')](),controller['download']);router[_0xbdc9('0xf')]('/',auth[_0xbdc9('0xb')](),controller[_0xbdc9('0x10')]);router[_0xbdc9('0x11')](_0xbdc9('0xd'),auth[_0xbdc9('0xb')](),controller[_0xbdc9('0x12')]);router[_0xbdc9('0x13')](_0xbdc9('0xd'),auth[_0xbdc9('0xb')](),controller[_0xbdc9('0x14')]);module['exports']=router; \ No newline at end of file +var _0x750e=['/:id','show','/:id/download','download','post','isAuthenticated','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x4be755,_0x3242ed){var _0x206513=function(_0x247446){while(--_0x247446){_0x4be755['push'](_0x4be755['shift']());}};_0x206513(++_0x3242ed);}(_0x750e,0x122));var _0xe750=function(_0x4be63f,_0x30b1dd){_0x4be63f=_0x4be63f-0x0;var _0xf11f9d=_0x750e[_0x4be63f];return _0xf11f9d;};'use strict';var multer=require(_0xe750('0x0'));var util=require('util');var path=require(_0xe750('0x1'));var timeout=require(_0xe750('0x2'));var express=require(_0xe750('0x3'));var router=express[_0xe750('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe750('0x5'));var interaction=require(_0xe750('0x6'));var config=require(_0xe750('0x7'));var controller=require(_0xe750('0x8'));router[_0xe750('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe750('0x9')](_0xe750('0xa'),auth['isAuthenticated'](),controller[_0xe750('0xb')]);router[_0xe750('0x9')](_0xe750('0xc'),auth['isAuthenticated'](),controller[_0xe750('0xd')]);router[_0xe750('0xe')]('/',auth[_0xe750('0xf')](),controller['create']);router[_0xe750('0x10')]('/:id',auth[_0xe750('0xf')](),controller[_0xe750('0x11')]);router['delete'](_0xe750('0xa'),auth[_0xe750('0xf')](),controller[_0xe750('0x12')]);module[_0xe750('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7dc5cbf..213129a 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.attributes.js +++ b/server/api/voiceMailMessage/voiceMailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf03e=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf03e,0xd8));var _0xef03=function(_0x27f7c6,_0x5baabe){_0x27f7c6=_0x27f7c6-0x0;var _0x46f47f=_0xf03e[_0x27f7c6];return _0x46f47f;};'use strict';var Sequelize=require('sequelize');module[_0xef03('0x0')]={'name':{'type':Sequelize[_0xef03('0x1')],'get':function(_0x1975f6){return this[_0xef03('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xef03('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xef03('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xef03('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xef03('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xef03('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xef03('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xef03('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xef03('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xef03('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xef03('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xef03('0x6'),'defaultValue':Sequelize[_0xef03('0x7')](_0xef03('0x8'))}}; \ No newline at end of file +var _0xe3d5=['BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING'];(function(_0x4348cc,_0x1143d3){var _0x362214=function(_0x3f8b39){while(--_0x3f8b39){_0x4348cc['push'](_0x4348cc['shift']());}};_0x362214(++_0x1143d3);}(_0xe3d5,0xb8));var _0x5e3d=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0xe3d5[_0x281e5e];return _0x5a22d2;};'use strict';var Sequelize=require(_0x5e3d('0x0'));module[_0x5e3d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x54b5c0){return this[_0x5e3d('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x5e3d('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5e3d('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x5e3d('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5e3d('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5e3d('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5e3d('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5e3d('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5e3d('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5e3d('0x5')](_0x5e3d('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5e3d('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x5e3d('0x7')](_0x5e3d('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 7425b5e..3987642 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.controller.js +++ b/server/api/voiceMailMessage/voiceMailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57a7=['msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','download','recording'];(function(_0x32fc14,_0x2017cf){var _0x58bd3a=function(_0x52689b){while(--_0x52689b){_0x32fc14['push'](_0x32fc14['shift']());}};_0x58bd3a(++_0x2017cf);}(_0x57a7,0xb5));var _0x757a=function(_0x35093f,_0x120c59){_0x35093f=_0x35093f-0x0;var _0x5a6a50=_0x57a7[_0x35093f];return _0x5a6a50;};'use strict';var emlformat=require(_0x757a('0x0'));var rimraf=require(_0x757a('0x1'));var zipdir=require(_0x757a('0x2'));var jsonpatch=require(_0x757a('0x3'));var rp=require('request-promise');var moment=require(_0x757a('0x4'));var BPromise=require(_0x757a('0x5'));var Mustache=require(_0x757a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x757a('0x7'));var fs=require('fs');var fs_extra=require(_0x757a('0x8'));var _=require('lodash');var squel=require(_0x757a('0x9'));var crypto=require(_0x757a('0xa'));var jsforce=require(_0x757a('0xb'));var deskjs=require(_0x757a('0xc'));var toCsv=require(_0x757a('0xd'));var querystring=require(_0x757a('0xe'));var Papa=require('papaparse');var Redis=require(_0x757a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x757a('0x10'));var as=require(_0x757a('0x11'));var hardwareService=require(_0x757a('0x12'));var logger=require(_0x757a('0x13'))(_0x757a('0x14'));var utils=require(_0x757a('0x15'));var config=require(_0x757a('0x16'));var licenseUtil=require(_0x757a('0x17'));var db=require(_0x757a('0x18'))['db'];function respondWithStatusCode(_0xedf803,_0x44985f){_0x44985f=_0x44985f||0xcc;return function(_0x590e4e){if(_0x590e4e){return _0xedf803[_0x757a('0x19')](_0x44985f);}return _0xedf803[_0x757a('0x1a')](_0x44985f)[_0x757a('0x1b')]();};}function respondWithResult(_0x1dfdd5,_0x573c0c){_0x573c0c=_0x573c0c||0xc8;return function(_0x1b93fb){if(_0x1b93fb){return _0x1dfdd5[_0x757a('0x1a')](_0x573c0c)[_0x757a('0x1c')](_0x1b93fb);}};}function respondWithFilteredResult(_0x1eafed,_0x199584){return function(_0x499b0a){if(_0x499b0a){var _0x1a642e=typeof _0x199584[_0x757a('0x1d')]===_0x757a('0x1e')&&typeof _0x199584[_0x757a('0x1f')]===_0x757a('0x1e');var _0x8fbd98=_0x499b0a['count'];var _0x42200a=_0x1a642e?0x0:_0x199584['offset'];var _0x266391=_0x1a642e?_0x499b0a[_0x757a('0x20')]:_0x199584[_0x757a('0x1d')]+_0x199584[_0x757a('0x1f')];var _0x565bb2;if(_0x266391>=_0x8fbd98){_0x266391=_0x8fbd98;_0x565bb2=0xc8;}else{_0x565bb2=0xce;}_0x1eafed[_0x757a('0x1a')](_0x565bb2);return _0x1eafed['set'](_0x757a('0x21'),_0x42200a+'-'+_0x266391+'/'+_0x8fbd98)[_0x757a('0x1c')](_0x499b0a);}return null;};}function patchUpdates(_0x39f755){return function(_0x535f73){try{jsonpatch[_0x757a('0x22')](_0x535f73,_0x39f755,!![]);}catch(_0x3be978){return BPromise[_0x757a('0x23')](_0x3be978);}return _0x535f73[_0x757a('0x24')]();};}function saveUpdates(_0x4a30d5,_0x1cfeb4){return function(_0x3b6843){if(_0x3b6843){return _0x3b6843['update'](_0x4a30d5)['then'](function(_0x34c336){return _0x34c336;});}return null;};}function removeEntity(_0x148cca,_0x120cc8){return function(_0x401aee){if(_0x401aee){return _0x401aee[_0x757a('0x25')]()[_0x757a('0x26')](function(){_0x148cca[_0x757a('0x1a')](0xcc)[_0x757a('0x1b')]();});}};}function handleEntityNotFound(_0x417151,_0x4e4e21){return function(_0x1c9c3a){if(!_0x1c9c3a){_0x417151[_0x757a('0x19')](0x194);}return _0x1c9c3a;};}function handleError(_0x2b2db8,_0x5b8487){_0x5b8487=_0x5b8487||0x1f4;return function(_0x30fb3c){logger['error'](_0x30fb3c['stack']);if(_0x30fb3c[_0x757a('0x27')]){delete _0x30fb3c[_0x757a('0x27')];}_0x2b2db8[_0x757a('0x1a')](_0x5b8487)[_0x757a('0x28')](_0x30fb3c);};}exports[_0x757a('0x29')]=function(_0x5a6784,_0x4bc920){var _0x3c7fb9={},_0xef4f30={},_0x351426={'count':0x0,'rows':[]};var _0x5675e3=_[_0x757a('0x2a')](db['VoiceMailMessage'][_0x757a('0x2b')],function(_0xbb5ffd){return{'name':_0xbb5ffd[_0x757a('0x2c')],'type':_0xbb5ffd[_0x757a('0x2d')][_0x757a('0x2e')]};});_0xef4f30[_0x757a('0x2f')]=_[_0x757a('0x30')](_[_0x757a('0x2a')](_0x5675e3,'name'),['name']);_0xef4f30[_0x757a('0x31')]=_[_0x757a('0x32')](_0x5a6784[_0x757a('0x31')]);_0xef4f30[_0x757a('0x33')]=_[_0x757a('0x34')](_0xef4f30['model'],_0xef4f30['query']);_0x3c7fb9['attributes']=_[_0x757a('0x34')](_0xef4f30['model'],qs[_0x757a('0x35')](_0x5a6784[_0x757a('0x31')][_0x757a('0x35')]));_0x3c7fb9[_0x757a('0x36')]=_0x3c7fb9[_0x757a('0x36')][_0x757a('0x37')]?_0x3c7fb9[_0x757a('0x36')]:_0xef4f30[_0x757a('0x2f')];if(!_0x5a6784['query'][_0x757a('0x38')](_0x757a('0x39'))){_0x3c7fb9[_0x757a('0x1f')]=qs['limit'](_0x5a6784[_0x757a('0x31')]['limit']);_0x3c7fb9[_0x757a('0x1d')]=qs[_0x757a('0x1d')](_0x5a6784[_0x757a('0x31')][_0x757a('0x1d')]);}_0x3c7fb9[_0x757a('0x3a')]=qs[_0x757a('0x3b')](_0x5a6784[_0x757a('0x31')]['sort']);_0x3c7fb9[_0x757a('0x3c')]=qs[_0x757a('0x33')](_[_0x757a('0x3d')](_0x5a6784[_0x757a('0x31')],_0xef4f30[_0x757a('0x33')]),_0x5675e3);if(_0x5a6784[_0x757a('0x31')]['filter']){_0x3c7fb9[_0x757a('0x3c')]=_[_0x757a('0x3e')](_0x3c7fb9[_0x757a('0x3c')],{'$or':_[_0x757a('0x2a')](_0x5675e3,function(_0x3ccf4f){if(_0x3ccf4f[_0x757a('0x2d')]!=='VIRTUAL'){var _0x5b2b16={};_0x5b2b16[_0x3ccf4f[_0x757a('0x27')]]={'$like':'%'+_0x5a6784[_0x757a('0x31')]['filter']+'%'};return _0x5b2b16;}})});}_0x3c7fb9=_[_0x757a('0x3e')]({},_0x3c7fb9,_0x5a6784['options']);var _0x42aee8={'where':_0x3c7fb9[_0x757a('0x3c')]};return db[_0x757a('0x3f')]['count'](_0x42aee8)[_0x757a('0x26')](function(_0x2eae82){_0x351426[_0x757a('0x20')]=_0x2eae82;if(_0x5a6784['query'][_0x757a('0x40')]){_0x3c7fb9[_0x757a('0x41')]=[{'all':!![]}];}return db[_0x757a('0x3f')][_0x757a('0x42')](_0x3c7fb9);})['then'](function(_0x3c5885){_0x351426[_0x757a('0x43')]=_0x3c5885;return _0x351426;})['then'](respondWithFilteredResult(_0x4bc920,_0x3c7fb9))[_0x757a('0x44')](handleError(_0x4bc920,null));};exports[_0x757a('0x45')]=function(_0xa82dc5,_0x472539){var _0x357430={'raw':!![],'where':{'id':_0xa82dc5[_0x757a('0x46')]['id']}},_0x54cb30={};_0x54cb30[_0x757a('0x2f')]=_[_0x757a('0x32')](db[_0x757a('0x3f')][_0x757a('0x2b')]);_0x54cb30['query']=_[_0x757a('0x32')](_0xa82dc5[_0x757a('0x31')]);_0x54cb30[_0x757a('0x33')]=_[_0x757a('0x34')](_0x54cb30[_0x757a('0x2f')],_0x54cb30[_0x757a('0x31')]);_0x357430['attributes']=_[_0x757a('0x34')](_0x54cb30[_0x757a('0x2f')],qs[_0x757a('0x35')](_0xa82dc5[_0x757a('0x31')][_0x757a('0x35')]));_0x357430[_0x757a('0x36')]=_0x357430[_0x757a('0x36')][_0x757a('0x37')]?_0x357430[_0x757a('0x36')]:_0x54cb30[_0x757a('0x2f')];if(_0xa82dc5['query'][_0x757a('0x40')]){_0x357430[_0x757a('0x41')]=[{'all':!![]}];}_0x357430=_[_0x757a('0x3e')]({},_0x357430,_0xa82dc5['options']);return db[_0x757a('0x3f')][_0x757a('0x47')](_0x357430)[_0x757a('0x26')](handleEntityNotFound(_0x472539,null))[_0x757a('0x26')](respondWithResult(_0x472539,null))['catch'](handleError(_0x472539,null));};exports['create']=function(_0x791ac7,_0x320483){return db[_0x757a('0x3f')][_0x757a('0x48')](_0x791ac7[_0x757a('0x49')],{})[_0x757a('0x26')](respondWithResult(_0x320483,0xc9))['catch'](handleError(_0x320483,null));};exports[_0x757a('0x4a')]=function(_0x2dea51,_0xea9732){if(_0x2dea51[_0x757a('0x49')]['id']){delete _0x2dea51[_0x757a('0x49')]['id'];}return db[_0x757a('0x3f')]['find']({'where':{'id':_0x2dea51[_0x757a('0x46')]['id']}})['then'](handleEntityNotFound(_0xea9732,null))[_0x757a('0x26')](saveUpdates(_0x2dea51[_0x757a('0x49')],null))[_0x757a('0x26')](respondWithResult(_0xea9732,null))[_0x757a('0x44')](handleError(_0xea9732,null));};exports[_0x757a('0x25')]=function(_0x54b319,_0x5c3217){return db[_0x757a('0x3f')]['find']({'where':{'id':_0x54b319[_0x757a('0x46')]['id']}})[_0x757a('0x26')](handleEntityNotFound(_0x5c3217,null))[_0x757a('0x26')](removeEntity(_0x5c3217,null))[_0x757a('0x44')](handleError(_0x5c3217,null));};exports[_0x757a('0x4b')]=function(_0x1273b7,_0x5e73d9,_0x4a6cf5){return db[_0x757a('0x3f')]['find']({'where':{'id':_0x1273b7[_0x757a('0x46')]['id']},'attributes':['id',_0x757a('0x4c'),_0x757a('0x4d')]})[_0x757a('0x26')](handleEntityNotFound(_0x5e73d9,null))[_0x757a('0x26')](function(_0x1d3e45){if(_0x1d3e45){if(!_0x1d3e45[_0x757a('0x4c')]){throw new db[(_0x757a('0x4e'))][(_0x757a('0x4f'))]('VoiceMailMessage\x20not\x20found');}var _0x32d7cc={'Content-Type':_0x757a('0x50'),'Content-Disposition':_0x757a('0x51')};if(_0x1d3e45[_0x757a('0x4d')]){_0x32d7cc[_0x757a('0x52')]=_0x757a('0x53')+_0x1d3e45[_0x757a('0x4d')]+_0x757a('0x54');}_0x5e73d9[_0x757a('0x55')](_0x32d7cc);return _0x5e73d9['send'](new Buffer(_0x1d3e45['recording']));}})[_0x757a('0x44')](handleError(_0x5e73d9,null));}; \ No newline at end of file +var _0xdd5e=['offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','end','error','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','find','catch','create','body','update','params','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status'];(function(_0x5bc787,_0x3ed610){var _0x3634e0=function(_0x277376){while(--_0x277376){_0x5bc787['push'](_0x5bc787['shift']());}};_0x3634e0(++_0x3ed610);}(_0xdd5e,0x1e0));var _0xedd5=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xdd5e[_0x8de54f];return _0x14cba4;};'use strict';var emlformat=require(_0xedd5('0x0'));var rimraf=require(_0xedd5('0x1'));var zipdir=require(_0xedd5('0x2'));var jsonpatch=require(_0xedd5('0x3'));var rp=require(_0xedd5('0x4'));var moment=require(_0xedd5('0x5'));var BPromise=require(_0xedd5('0x6'));var Mustache=require(_0xedd5('0x7'));var util=require(_0xedd5('0x8'));var path=require(_0xedd5('0x9'));var sox=require(_0xedd5('0xa'));var csv=require(_0xedd5('0xb'));var ejs=require(_0xedd5('0xc'));var fs=require('fs');var fs_extra=require(_0xedd5('0xd'));var _=require(_0xedd5('0xe'));var squel=require(_0xedd5('0xf'));var crypto=require(_0xedd5('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xedd5('0x11'));var toCsv=require('to-csv');var querystring=require(_0xedd5('0x12'));var Papa=require(_0xedd5('0x13'));var Redis=require(_0xedd5('0x14'));var authService=require(_0xedd5('0x15'));var qs=require(_0xedd5('0x16'));var as=require(_0xedd5('0x17'));var hardwareService=require(_0xedd5('0x18'));var logger=require(_0xedd5('0x19'))(_0xedd5('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xedd5('0x1b'))['db'];function respondWithStatusCode(_0x1b11aa,_0x2d441b){_0x2d441b=_0x2d441b||0xcc;return function(_0x152280){if(_0x152280){return _0x1b11aa[_0xedd5('0x1c')](_0x2d441b);}return _0x1b11aa[_0xedd5('0x1d')](_0x2d441b)['end']();};}function respondWithResult(_0x70d7f3,_0x27550e){_0x27550e=_0x27550e||0xc8;return function(_0x5bcb73){if(_0x5bcb73){return _0x70d7f3[_0xedd5('0x1d')](_0x27550e)['json'](_0x5bcb73);}};}function respondWithFilteredResult(_0x5c5189,_0x12d917){return function(_0x1f051d){if(_0x1f051d){var _0x1932c0=typeof _0x12d917[_0xedd5('0x1e')]===_0xedd5('0x1f')&&typeof _0x12d917[_0xedd5('0x20')]===_0xedd5('0x1f');var _0x275d47=_0x1f051d[_0xedd5('0x21')];var _0x51b261=_0x1932c0?0x0:_0x12d917[_0xedd5('0x1e')];var _0x2554e3=_0x1932c0?_0x1f051d[_0xedd5('0x21')]:_0x12d917[_0xedd5('0x1e')]+_0x12d917['limit'];var _0x29a73d;if(_0x2554e3>=_0x275d47){_0x2554e3=_0x275d47;_0x29a73d=0xc8;}else{_0x29a73d=0xce;}_0x5c5189[_0xedd5('0x1d')](_0x29a73d);return _0x5c5189['set'](_0xedd5('0x22'),_0x51b261+'-'+_0x2554e3+'/'+_0x275d47)[_0xedd5('0x23')](_0x1f051d);}return null;};}function patchUpdates(_0x4d787c){return function(_0x42e7e1){try{jsonpatch['apply'](_0x42e7e1,_0x4d787c,!![]);}catch(_0x566677){return BPromise[_0xedd5('0x24')](_0x566677);}return _0x42e7e1[_0xedd5('0x25')]();};}function saveUpdates(_0x11f9fc,_0x1781cb){return function(_0x4b0b20){if(_0x4b0b20){return _0x4b0b20['update'](_0x11f9fc)[_0xedd5('0x26')](function(_0x5181d2){return _0x5181d2;});}return null;};}function removeEntity(_0x4ed65b,_0x9ef3ba){return function(_0x1051ac){if(_0x1051ac){return _0x1051ac[_0xedd5('0x27')]()[_0xedd5('0x26')](function(){_0x4ed65b[_0xedd5('0x1d')](0xcc)[_0xedd5('0x28')]();});}};}function handleEntityNotFound(_0x234767,_0x27acb4){return function(_0x33e4ab){if(!_0x33e4ab){_0x234767[_0xedd5('0x1c')](0x194);}return _0x33e4ab;};}function handleError(_0x4fcec8,_0x410003){_0x410003=_0x410003||0x1f4;return function(_0x3c1718){logger[_0xedd5('0x29')](_0x3c1718['stack']);if(_0x3c1718['name']){delete _0x3c1718[_0xedd5('0x2a')];}_0x4fcec8[_0xedd5('0x1d')](_0x410003)[_0xedd5('0x2b')](_0x3c1718);};}exports[_0xedd5('0x2c')]=function(_0x1b5bd7,_0x232972){var _0x1348bf={},_0x31a19a={},_0x221826={'count':0x0,'rows':[]};var _0x91ee1=_[_0xedd5('0x2d')](db[_0xedd5('0x2e')][_0xedd5('0x2f')],function(_0x2eac0c){return{'name':_0x2eac0c['fieldName'],'type':_0x2eac0c[_0xedd5('0x30')][_0xedd5('0x31')]};});_0x31a19a[_0xedd5('0x32')]=_[_0xedd5('0x33')](_[_0xedd5('0x2d')](_0x91ee1,_0xedd5('0x2a')),[_0xedd5('0x2a')]);_0x31a19a['query']=_[_0xedd5('0x34')](_0x1b5bd7[_0xedd5('0x35')]);_0x31a19a[_0xedd5('0x36')]=_[_0xedd5('0x37')](_0x31a19a[_0xedd5('0x32')],_0x31a19a['query']);_0x1348bf['attributes']=_[_0xedd5('0x37')](_0x31a19a[_0xedd5('0x32')],qs[_0xedd5('0x38')](_0x1b5bd7[_0xedd5('0x35')]['fields']));_0x1348bf[_0xedd5('0x39')]=_0x1348bf[_0xedd5('0x39')]['length']?_0x1348bf['attributes']:_0x31a19a['model'];if(!_0x1b5bd7[_0xedd5('0x35')][_0xedd5('0x3a')](_0xedd5('0x3b'))){_0x1348bf[_0xedd5('0x20')]=qs[_0xedd5('0x20')](_0x1b5bd7[_0xedd5('0x35')][_0xedd5('0x20')]);_0x1348bf['offset']=qs[_0xedd5('0x1e')](_0x1b5bd7['query']['offset']);}_0x1348bf[_0xedd5('0x3c')]=qs[_0xedd5('0x3d')](_0x1b5bd7[_0xedd5('0x35')][_0xedd5('0x3d')]);_0x1348bf[_0xedd5('0x3e')]=qs[_0xedd5('0x36')](_[_0xedd5('0x3f')](_0x1b5bd7[_0xedd5('0x35')],_0x31a19a[_0xedd5('0x36')]),_0x91ee1);if(_0x1b5bd7[_0xedd5('0x35')]['filter']){_0x1348bf[_0xedd5('0x3e')]=_[_0xedd5('0x40')](_0x1348bf['where'],{'$or':_[_0xedd5('0x2d')](_0x91ee1,function(_0x5dce35){if(_0x5dce35[_0xedd5('0x30')]!=='VIRTUAL'){var _0x336a5c={};_0x336a5c[_0x5dce35[_0xedd5('0x2a')]]={'$like':'%'+_0x1b5bd7[_0xedd5('0x35')]['filter']+'%'};return _0x336a5c;}})});}_0x1348bf=_[_0xedd5('0x40')]({},_0x1348bf,_0x1b5bd7[_0xedd5('0x41')]);var _0x4a6363={'where':_0x1348bf['where']};return db['VoiceMailMessage'][_0xedd5('0x21')](_0x4a6363)[_0xedd5('0x26')](function(_0x452a35){_0x221826['count']=_0x452a35;if(_0x1b5bd7[_0xedd5('0x35')][_0xedd5('0x42')]){_0x1348bf[_0xedd5('0x43')]=[{'all':!![]}];}return db[_0xedd5('0x2e')][_0xedd5('0x44')](_0x1348bf);})[_0xedd5('0x26')](function(_0x2e5915){_0x221826[_0xedd5('0x45')]=_0x2e5915;return _0x221826;})[_0xedd5('0x26')](respondWithFilteredResult(_0x232972,_0x1348bf))['catch'](handleError(_0x232972,null));};exports['show']=function(_0x1ec518,_0x261075){var _0x40f3c4={'raw':!![],'where':{'id':_0x1ec518['params']['id']}},_0x2aa5c8={};_0x2aa5c8['model']=_[_0xedd5('0x34')](db['VoiceMailMessage']['rawAttributes']);_0x2aa5c8[_0xedd5('0x35')]=_['keys'](_0x1ec518[_0xedd5('0x35')]);_0x2aa5c8[_0xedd5('0x36')]=_[_0xedd5('0x37')](_0x2aa5c8['model'],_0x2aa5c8[_0xedd5('0x35')]);_0x40f3c4[_0xedd5('0x39')]=_['intersection'](_0x2aa5c8[_0xedd5('0x32')],qs[_0xedd5('0x38')](_0x1ec518[_0xedd5('0x35')][_0xedd5('0x38')]));_0x40f3c4[_0xedd5('0x39')]=_0x40f3c4[_0xedd5('0x39')]['length']?_0x40f3c4[_0xedd5('0x39')]:_0x2aa5c8[_0xedd5('0x32')];if(_0x1ec518['query'][_0xedd5('0x42')]){_0x40f3c4[_0xedd5('0x43')]=[{'all':!![]}];}_0x40f3c4=_[_0xedd5('0x40')]({},_0x40f3c4,_0x1ec518[_0xedd5('0x41')]);return db[_0xedd5('0x2e')][_0xedd5('0x46')](_0x40f3c4)[_0xedd5('0x26')](handleEntityNotFound(_0x261075,null))['then'](respondWithResult(_0x261075,null))[_0xedd5('0x47')](handleError(_0x261075,null));};exports[_0xedd5('0x48')]=function(_0x102dab,_0x28f7e1){return db[_0xedd5('0x2e')]['create'](_0x102dab[_0xedd5('0x49')],{})['then'](respondWithResult(_0x28f7e1,0xc9))[_0xedd5('0x47')](handleError(_0x28f7e1,null));};exports[_0xedd5('0x4a')]=function(_0x1d71a3,_0x130c7d){if(_0x1d71a3[_0xedd5('0x49')]['id']){delete _0x1d71a3[_0xedd5('0x49')]['id'];}return db['VoiceMailMessage'][_0xedd5('0x46')]({'where':{'id':_0x1d71a3[_0xedd5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x130c7d,null))['then'](saveUpdates(_0x1d71a3[_0xedd5('0x49')],null))[_0xedd5('0x26')](respondWithResult(_0x130c7d,null))[_0xedd5('0x47')](handleError(_0x130c7d,null));};exports[_0xedd5('0x27')]=function(_0x2e23fc,_0x534a64){return db[_0xedd5('0x2e')][_0xedd5('0x46')]({'where':{'id':_0x2e23fc[_0xedd5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x534a64,null))[_0xedd5('0x26')](removeEntity(_0x534a64,null))[_0xedd5('0x47')](handleError(_0x534a64,null));};exports[_0xedd5('0x4c')]=function(_0x161c01,_0x280cc0,_0x1e59ae){return db[_0xedd5('0x2e')]['find']({'where':{'id':_0x161c01[_0xedd5('0x4b')]['id']},'attributes':['id',_0xedd5('0x4d'),'msg_id']})[_0xedd5('0x26')](handleEntityNotFound(_0x280cc0,null))[_0xedd5('0x26')](function(_0x11f1ee){if(_0x11f1ee){if(!_0x11f1ee['recording']){throw new db[(_0xedd5('0x4e'))][(_0xedd5('0x4f'))](_0xedd5('0x50'));}var _0x2cb2a0={'Content-Type':_0xedd5('0x51'),'Content-Disposition':'attachment'};if(_0x11f1ee[_0xedd5('0x52')]){_0x2cb2a0[_0xedd5('0x53')]='attachment;\x20filename=\x22'+_0x11f1ee['msg_id']+'.wav\x22';}_0x280cc0[_0xedd5('0x54')](_0x2cb2a0);return _0x280cc0[_0xedd5('0x2b')](new Buffer(_0x11f1ee[_0xedd5('0x4d')]));}})['catch'](handleError(_0x280cc0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 09113bf..2ad6bf4 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.model.js +++ b/server/api/voiceMailMessage/voiceMailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4343=['rimraf','../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x17e911,_0x472ee9){var _0x46fe90=function(_0x2423be){while(--_0x2423be){_0x17e911['push'](_0x17e911['shift']());}};_0x46fe90(++_0x472ee9);}(_0x4343,0xa2));var _0x3434=function(_0x21d3c4,_0x48d915){_0x21d3c4=_0x21d3c4-0x0;var _0x341584=_0x4343[_0x21d3c4];return _0x341584;};'use strict';var _=require(_0x3434('0x0'));var util=require(_0x3434('0x1'));var logger=require(_0x3434('0x2'))('api');var moment=require(_0x3434('0x3'));var BPromise=require(_0x3434('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3434('0x5'));var rimraf=require(_0x3434('0x6'));var config=require(_0x3434('0x7'));var attributes=require(_0x3434('0x8'));module['exports']=function(_0x1bf0c4,_0x34dd1e){return _0x1bf0c4['define'](_0x3434('0x9'),attributes,{'tableName':_0x3434('0xa'),'paranoid':![],'indexes':[{'name':_0x3434('0xb'),'fields':[_0x3434('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9fca=['bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','lodash','../../config/logger','api'];(function(_0x4662ac,_0x3954b9){var _0x39be56=function(_0x3f4343){while(--_0x3f4343){_0x4662ac['push'](_0x4662ac['shift']());}};_0x39be56(++_0x3954b9);}(_0x9fca,0xf7));var _0xa9fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9fca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa9fc('0x0'));var util=require('util');var logger=require(_0xa9fc('0x1'))(_0xa9fc('0x2'));var moment=require('moment');var BPromise=require(_0xa9fc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa9fc('0x4'));var config=require(_0xa9fc('0x5'));var attributes=require(_0xa9fc('0x6'));module['exports']=function(_0x5d3aef,_0x519f32){return _0x5d3aef[_0xa9fc('0x7')](_0xa9fc('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xa9fc('0x9'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c431752..b486f52 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ed8=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x37cfb6,_0x4a9b59){var _0x5390ed=function(_0x506f0c){while(--_0x506f0c){_0x37cfb6['push'](_0x37cfb6['shift']());}};_0x5390ed(++_0x4a9b59);}(_0x0ed8,0xed));var _0x80ed=function(_0x1188df,_0x367325){_0x1188df=_0x1188df-0x0;var _0x4987d6=_0x0ed8[_0x1188df];return _0x4987d6;};'use strict';var _=require(_0x80ed('0x0'));var util=require(_0x80ed('0x1'));var moment=require(_0x80ed('0x2'));var BPromise=require('bluebird');var rs=require(_0x80ed('0x3'));var fs=require('fs');var Redis=require(_0x80ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x80ed('0x5'));var logger=require('../../config/logger')(_0x80ed('0x6'));var config=require(_0x80ed('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x373d8d,_0x3176b4,_0x4aa2bb){return new BPromise(function(_0x4b9805,_0x40ded8){return client['request'](_0x373d8d,_0x4aa2bb)[_0x80ed('0x8')](function(_0x2aa69b){logger[_0x80ed('0x9')]('VoiceMailMessage,\x20%s,\x20%s',_0x3176b4,_0x80ed('0xa'));logger[_0x80ed('0xb')](_0x80ed('0xc'),_0x3176b4,_0x80ed('0xa'),JSON[_0x80ed('0xd')](_0x2aa69b));if(_0x2aa69b['error']){if(_0x2aa69b[_0x80ed('0xe')][_0x80ed('0xf')]===0x1f4){logger[_0x80ed('0xe')](_0x80ed('0x10'),_0x3176b4,_0x2aa69b[_0x80ed('0xe')][_0x80ed('0x11')]);return _0x40ded8(_0x2aa69b['error']['message']);}logger[_0x80ed('0xe')](_0x80ed('0x10'),_0x3176b4,_0x2aa69b[_0x80ed('0xe')][_0x80ed('0x11')]);return _0x4b9805(_0x2aa69b[_0x80ed('0xe')][_0x80ed('0x11')]);}else{logger[_0x80ed('0x9')](_0x80ed('0x10'),_0x3176b4,'request\x20sent');_0x4b9805(_0x2aa69b[_0x80ed('0x12')][_0x80ed('0x11')]);}})[_0x80ed('0x13')](function(_0x54d3f3){logger[_0x80ed('0xe')](_0x80ed('0x10'),_0x3176b4,_0x54d3f3);_0x40ded8(_0x54d3f3);});});} \ No newline at end of file +var _0x7069=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7069,0x138));var _0x9706=function(_0x4c5273,_0x2c7807){_0x4c5273=_0x4c5273-0x0;var _0x5a5f96=_0x7069[_0x4c5273];return _0x5a5f96;};'use strict';var _=require(_0x9706('0x0'));var util=require(_0x9706('0x1'));var moment=require(_0x9706('0x2'));var BPromise=require(_0x9706('0x3'));var rs=require(_0x9706('0x4'));var fs=require('fs');var Redis=require(_0x9706('0x5'));var db=require(_0x9706('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9706('0x7'))(_0x9706('0x8'));var config=require('../../config/environment');var jayson=require(_0x9706('0x9'));var client=jayson[_0x9706('0xa')][_0x9706('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bc5dd,_0x271a26,_0x6f6a7){return new BPromise(function(_0xfe7815,_0x70af06){return client[_0x9706('0xc')](_0x4bc5dd,_0x6f6a7)[_0x9706('0xd')](function(_0x77d580){logger[_0x9706('0xe')](_0x9706('0xf'),_0x271a26,_0x9706('0x10'));logger[_0x9706('0x11')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x271a26,_0x9706('0x10'),JSON[_0x9706('0x12')](_0x77d580));if(_0x77d580[_0x9706('0x13')]){if(_0x77d580['error'][_0x9706('0x14')]===0x1f4){logger[_0x9706('0x13')](_0x9706('0xf'),_0x271a26,_0x77d580[_0x9706('0x13')][_0x9706('0x15')]);return _0x70af06(_0x77d580['error']['message']);}logger[_0x9706('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x271a26,_0x77d580[_0x9706('0x13')][_0x9706('0x15')]);return _0xfe7815(_0x77d580[_0x9706('0x13')][_0x9706('0x15')]);}else{logger['info'](_0x9706('0xf'),_0x271a26,_0x9706('0x10'));_0xfe7815(_0x77d580[_0x9706('0x16')]['message']);}})[_0x9706('0x17')](function(_0x2b1837){logger[_0x9706('0x13')](_0x9706('0xf'),_0x271a26,_0x2b1837);_0x70af06(_0x2b1837);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ba50d8e..297beba 100644 --- a/server/api/voiceMusicOnHold/index.js +++ b/server/api/voiceMusicOnHold/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9eb0=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','create','post','addSound','put','/:id','update','delete','/:id/sounds/:id2','removeSound','multer'];(function(_0x3d441b,_0x3d57e8){var _0x49a381=function(_0x55c6da){while(--_0x55c6da){_0x3d441b['push'](_0x3d441b['shift']());}};_0x49a381(++_0x3d57e8);}(_0x9eb0,0x11d));var _0x09eb=function(_0x58ecd6,_0x16bbba){_0x58ecd6=_0x58ecd6-0x0;var _0x19b674=_0x9eb0[_0x58ecd6];return _0x19b674;};'use strict';var multer=require(_0x09eb('0x0'));var util=require(_0x09eb('0x1'));var path=require(_0x09eb('0x2'));var timeout=require(_0x09eb('0x3'));var express=require(_0x09eb('0x4'));var router=express[_0x09eb('0x5')]();var fs_extra=require(_0x09eb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x09eb('0x7'));var config=require('../../config/environment');var controller=require(_0x09eb('0x8'));router[_0x09eb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09eb('0x9')]('/:id',auth[_0x09eb('0xa')](),controller[_0x09eb('0xb')]);router[_0x09eb('0x9')](_0x09eb('0xc'),auth[_0x09eb('0xa')](),controller['getSounds']);router['post']('/',auth[_0x09eb('0xa')](),controller[_0x09eb('0xd')]);router[_0x09eb('0xe')](_0x09eb('0xc'),auth[_0x09eb('0xa')](),controller[_0x09eb('0xf')]);router[_0x09eb('0x10')](_0x09eb('0x11'),auth['isAuthenticated'](),controller[_0x09eb('0x12')]);router[_0x09eb('0x13')]('/:id',auth[_0x09eb('0xa')](),controller['destroy']);router[_0x09eb('0x13')](_0x09eb('0x14'),auth[_0x09eb('0xa')](),controller[_0x09eb('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb87e=['getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds'];(function(_0x366648,_0x4866f3){var _0x254e47=function(_0x40b454){while(--_0x40b454){_0x366648['push'](_0x366648['shift']());}};_0x254e47(++_0x4866f3);}(_0xb87e,0xab));var _0xeb87=function(_0x5dfbcc,_0x287686){_0x5dfbcc=_0x5dfbcc-0x0;var _0x1ffa9a=_0xb87e[_0x5dfbcc];return _0x1ffa9a;};'use strict';var multer=require(_0xeb87('0x0'));var util=require('util');var path=require(_0xeb87('0x1'));var timeout=require(_0xeb87('0x2'));var express=require(_0xeb87('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb87('0x4'));var interaction=require(_0xeb87('0x5'));var config=require(_0xeb87('0x6'));var controller=require(_0xeb87('0x7'));router[_0xeb87('0x8')]('/',auth[_0xeb87('0x9')](),controller[_0xeb87('0xa')]);router['get'](_0xeb87('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xeb87('0xc'),auth[_0xeb87('0x9')](),controller[_0xeb87('0xd')]);router[_0xeb87('0xe')]('/',auth[_0xeb87('0x9')](),controller[_0xeb87('0xf')]);router['post'](_0xeb87('0xc'),auth[_0xeb87('0x9')](),controller[_0xeb87('0x10')]);router[_0xeb87('0x11')](_0xeb87('0xb'),auth[_0xeb87('0x9')](),controller[_0xeb87('0x12')]);router[_0xeb87('0x13')](_0xeb87('0xb'),auth[_0xeb87('0x9')](),controller[_0xeb87('0x14')]);router[_0xeb87('0x13')](_0xeb87('0x15'),auth[_0xeb87('0x9')](),controller['removeSound']);module[_0xeb87('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 8510f8a..68e4f91 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ac5=['ENUM','files','mp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x57c9a4,_0x14a60a){var _0x595210=function(_0x5527cf){while(--_0x5527cf){_0x57c9a4['push'](_0x57c9a4['shift']());}};_0x595210(++_0x14a60a);}(_0x5ac5,0x167));var _0x55ac=function(_0x5b2dc2,_0x59e0ea){_0x5b2dc2=_0x5b2dc2-0x0;var _0x2608e8=_0x5ac5[_0x5b2dc2];return _0x2608e8;};'use strict';var Sequelize=require(_0x55ac('0x0'));module[_0x55ac('0x1')]={'name':{'type':Sequelize[_0x55ac('0x2')],'allowNull':![],'unique':_0x55ac('0x3')},'mode':{'type':Sequelize[_0x55ac('0x4')]('custom',_0x55ac('0x5'),_0x55ac('0x6'),'quietmp3nb','quietmp3',_0x55ac('0x7')),'allowNull':!![],'defaultValue':_0x55ac('0x5')},'directory':{'type':Sequelize[_0x55ac('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x55ac('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x55ac('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x55ac('0x2')],'allowNull':!![],'defaultValue':_0x55ac('0x8')},'format':{'type':Sequelize[_0x55ac('0x2')],'allowNull':!![]},'stamp':{'type':_0x55ac('0x9')},'defaultEntry':{'type':Sequelize[_0x55ac('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x72d2=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x4799d7,_0x3dc3d1){var _0x187e3b=function(_0x44a50d){while(--_0x44a50d){_0x4799d7['push'](_0x4799d7['shift']());}};_0x187e3b(++_0x3dc3d1);}(_0x72d2,0xb9));var _0x272d=function(_0x5993de,_0x1e902f){_0x5993de=_0x5993de-0x0;var _0x481faf=_0x72d2[_0x5993de];return _0x481faf;};'use strict';var Sequelize=require(_0x272d('0x0'));module[_0x272d('0x1')]={'name':{'type':Sequelize[_0x272d('0x2')],'allowNull':![],'unique':_0x272d('0x3')},'mode':{'type':Sequelize[_0x272d('0x4')](_0x272d('0x5'),_0x272d('0x6'),_0x272d('0x7'),_0x272d('0x8'),_0x272d('0x9'),_0x272d('0xa')),'allowNull':!![],'defaultValue':_0x272d('0x6')},'directory':{'type':Sequelize[_0x272d('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x272d('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x272d('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x272d('0x2')],'allowNull':!![],'defaultValue':_0x272d('0xb')},'format':{'type':Sequelize[_0x272d('0x2')],'allowNull':!![]},'stamp':{'type':_0x272d('0xc')},'defaultEntry':{'type':Sequelize[_0x272d('0xd')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 439f941..fb94dd5 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34b9=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','then','destroy','get','UserProfileResource','end','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','update','body','create','sequelize','transaction','mode','files','directory','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','pick','hasOwnProperty','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x3372cb,_0x5afe8c){var _0x1084f6=function(_0x559231){while(--_0x559231){_0x3372cb['push'](_0x3372cb['shift']());}};_0x1084f6(++_0x5afe8c);}(_0x34b9,0x65));var _0x934b=function(_0x5ca953,_0x2cec8d){_0x5ca953=_0x5ca953-0x0;var _0x4a3e86=_0x34b9[_0x5ca953];return _0x4a3e86;};'use strict';var emlformat=require(_0x934b('0x0'));var rimraf=require(_0x934b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x934b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x934b('0x3'));var Mustache=require(_0x934b('0x4'));var util=require(_0x934b('0x5'));var path=require(_0x934b('0x6'));var sox=require(_0x934b('0x7'));var csv=require(_0x934b('0x8'));var ejs=require(_0x934b('0x9'));var fs=require('fs');var fs_extra=require(_0x934b('0xa'));var _=require(_0x934b('0xb'));var squel=require(_0x934b('0xc'));var crypto=require(_0x934b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x934b('0xe'));var toCsv=require(_0x934b('0x8'));var querystring=require(_0x934b('0xf'));var Papa=require(_0x934b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x934b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x934b('0x12'));var logger=require(_0x934b('0x13'))(_0x934b('0x14'));var utils=require('../../config/utils');var config=require(_0x934b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x934b('0x16'))['db'];function respondWithStatusCode(_0x677c3f,_0x2ffba3){_0x2ffba3=_0x2ffba3||0xcc;return function(_0x48b83b){if(_0x48b83b){return _0x677c3f[_0x934b('0x17')](_0x2ffba3);}return _0x677c3f[_0x934b('0x18')](_0x2ffba3)['end']();};}function respondWithResult(_0x218e90,_0x2c370e){_0x2c370e=_0x2c370e||0xc8;return function(_0x50036d){if(_0x50036d){return _0x218e90[_0x934b('0x18')](_0x2c370e)[_0x934b('0x19')](_0x50036d);}};}function respondWithFilteredResult(_0x3936f4,_0x510492){return function(_0x4b8631){if(_0x4b8631){var _0x4b2178=typeof _0x510492[_0x934b('0x1a')]===_0x934b('0x1b')&&typeof _0x510492['limit']===_0x934b('0x1b');var _0xaaff60=_0x4b8631['count'];var _0x3d1bf1=_0x4b2178?0x0:_0x510492[_0x934b('0x1a')];var _0x40c49f=_0x4b2178?_0x4b8631[_0x934b('0x1c')]:_0x510492[_0x934b('0x1a')]+_0x510492['limit'];var _0x23756b;if(_0x40c49f>=_0xaaff60){_0x40c49f=_0xaaff60;_0x23756b=0xc8;}else{_0x23756b=0xce;}_0x3936f4[_0x934b('0x18')](_0x23756b);return _0x3936f4['set'](_0x934b('0x1d'),_0x3d1bf1+'-'+_0x40c49f+'/'+_0xaaff60)[_0x934b('0x19')](_0x4b8631);}return null;};}function patchUpdates(_0x1eedeb){return function(_0x63bc25){try{jsonpatch[_0x934b('0x1e')](_0x63bc25,_0x1eedeb,!![]);}catch(_0x570328){return BPromise[_0x934b('0x1f')](_0x570328);}return _0x63bc25['save']();};}function saveUpdates(_0x16c9a0,_0x5c845f){return function(_0x1da690){if(_0x1da690){return _0x1da690['update'](_0x16c9a0)[_0x934b('0x20')](function(_0x3851bf){return _0x3851bf;});}return null;};}function removeEntity(_0x1fc655,_0x295172){return function(_0x220399){if(_0x220399){return _0x220399[_0x934b('0x21')]()[_0x934b('0x20')](function(){var _0x7ea702=_0x220399[_0x934b('0x22')]({'plain':!![]});var _0x2fb359='MusicOnHolds';return db[_0x934b('0x23')]['destroy']({'where':{'type':_0x2fb359,'resourceId':_0x7ea702['id']}})['then'](function(){return _0x220399;});})[_0x934b('0x20')](function(){_0x1fc655[_0x934b('0x18')](0xcc)[_0x934b('0x24')]();});}};}function handleEntityNotFound(_0x25adbe,_0x507125){return function(_0x32f180){if(!_0x32f180){_0x25adbe[_0x934b('0x17')](0x194);}return _0x32f180;};}function handleError(_0x13670b,_0x55f90f){_0x55f90f=_0x55f90f||0x1f4;return function(_0x339a3a){logger[_0x934b('0x25')](_0x339a3a['stack']);if(_0x339a3a[_0x934b('0x26')]){delete _0x339a3a[_0x934b('0x26')];}_0x13670b[_0x934b('0x18')](_0x55f90f)[_0x934b('0x27')](_0x339a3a);};}exports[_0x934b('0x28')]=function(_0x1dc9c5,_0x41e981){var _0x27b3cf={},_0x19f39c={},_0x1459a2={'count':0x0,'rows':[]};var _0xbd3025=_[_0x934b('0x29')](db[_0x934b('0x2a')][_0x934b('0x2b')],function(_0x4d56a3){return{'name':_0x4d56a3[_0x934b('0x2c')],'type':_0x4d56a3[_0x934b('0x2d')][_0x934b('0x2e')]};});_0x19f39c[_0x934b('0x2f')]=_[_0x934b('0x29')](_0xbd3025,'name');_0x19f39c[_0x934b('0x30')]=_[_0x934b('0x31')](_0x1dc9c5[_0x934b('0x30')]);_0x19f39c[_0x934b('0x32')]=_['intersection'](_0x19f39c['model'],_0x19f39c['query']);_0x27b3cf[_0x934b('0x33')]=_[_0x934b('0x34')](_0x19f39c[_0x934b('0x2f')],qs[_0x934b('0x35')](_0x1dc9c5[_0x934b('0x30')]['fields']));_0x27b3cf[_0x934b('0x33')]=_0x27b3cf[_0x934b('0x33')][_0x934b('0x36')]?_0x27b3cf[_0x934b('0x33')]:_0x19f39c[_0x934b('0x2f')];if(!_0x1dc9c5[_0x934b('0x30')]['hasOwnProperty'](_0x934b('0x37'))){_0x27b3cf['limit']=qs[_0x934b('0x38')](_0x1dc9c5[_0x934b('0x30')][_0x934b('0x38')]);_0x27b3cf[_0x934b('0x1a')]=qs[_0x934b('0x1a')](_0x1dc9c5[_0x934b('0x30')][_0x934b('0x1a')]);}_0x27b3cf[_0x934b('0x39')]=qs[_0x934b('0x3a')](_0x1dc9c5[_0x934b('0x30')]['sort']);delete _0x1dc9c5['query'][_0x934b('0x3a')];_0x27b3cf['where']=qs[_0x934b('0x32')](_['pick'](_0x1dc9c5[_0x934b('0x30')],_0x19f39c[_0x934b('0x32')]),_0xbd3025);if(_0x1dc9c5[_0x934b('0x30')]['filter']){_0x27b3cf[_0x934b('0x3b')]=_[_0x934b('0x3c')](_0x27b3cf[_0x934b('0x3b')],{'$or':_[_0x934b('0x29')](_0xbd3025,function(_0x3af950){if(_0x3af950[_0x934b('0x2d')]!==_0x934b('0x3d')){var _0x3c0100={};_0x3c0100[_0x3af950[_0x934b('0x26')]]={'$like':'%'+_0x1dc9c5[_0x934b('0x30')][_0x934b('0x3e')]+'%'};return _0x3c0100;}})});}_0x27b3cf=_[_0x934b('0x3c')]({},_0x27b3cf,_0x1dc9c5['options']);var _0x450657={'where':_0x27b3cf[_0x934b('0x3b')]};return db[_0x934b('0x2a')][_0x934b('0x1c')](_0x450657)['then'](function(_0x4b4b3d){_0x1459a2[_0x934b('0x1c')]=_0x4b4b3d;if(_0x1dc9c5['query'][_0x934b('0x3f')]){_0x27b3cf[_0x934b('0x40')]=[{'all':!![]}];}return db[_0x934b('0x2a')][_0x934b('0x41')](_0x27b3cf);})[_0x934b('0x20')](function(_0x1ebba7){_0x1459a2[_0x934b('0x42')]=_0x1ebba7;return _0x1459a2;})[_0x934b('0x20')](respondWithFilteredResult(_0x41e981,_0x27b3cf))[_0x934b('0x43')](handleError(_0x41e981,null));};exports[_0x934b('0x44')]=function(_0x48f729,_0x589641){var _0x18dc46={'raw':![],'where':{'id':_0x48f729[_0x934b('0x45')]['id']}},_0x56c6e0={};_0x56c6e0[_0x934b('0x2f')]=_[_0x934b('0x31')](db[_0x934b('0x2a')]['rawAttributes']);_0x56c6e0['query']=_[_0x934b('0x31')](_0x48f729['query']);_0x56c6e0[_0x934b('0x32')]=_['intersection'](_0x56c6e0[_0x934b('0x2f')],_0x56c6e0['query']);_0x18dc46['attributes']=_[_0x934b('0x34')](_0x56c6e0[_0x934b('0x2f')],qs['fields'](_0x48f729[_0x934b('0x30')][_0x934b('0x35')]));_0x18dc46[_0x934b('0x33')]=_0x18dc46[_0x934b('0x33')][_0x934b('0x36')]?_0x18dc46[_0x934b('0x33')]:_0x56c6e0['model'];if(_0x48f729['query'][_0x934b('0x3f')]){_0x18dc46[_0x934b('0x40')]=[{'all':!![]}];}_0x18dc46=_[_0x934b('0x3c')]({},_0x18dc46,_0x48f729[_0x934b('0x46')]);return db[_0x934b('0x2a')][_0x934b('0x47')](_0x18dc46)[_0x934b('0x20')](handleEntityNotFound(_0x589641,null))[_0x934b('0x20')](respondWithResult(_0x589641,null))[_0x934b('0x43')](handleError(_0x589641,null));};exports[_0x934b('0x48')]=function(_0x8ba225,_0x56f3cf){if(_0x8ba225[_0x934b('0x49')]['id']){delete _0x8ba225[_0x934b('0x49')]['id'];}return db[_0x934b('0x2a')][_0x934b('0x47')]({'where':{'id':_0x8ba225[_0x934b('0x45')]['id']}})['then'](handleEntityNotFound(_0x56f3cf,null))[_0x934b('0x20')](saveUpdates(_0x8ba225['body'],null))[_0x934b('0x20')](respondWithResult(_0x56f3cf,null))[_0x934b('0x43')](handleError(_0x56f3cf,null));};exports[_0x934b('0x4a')]=function(_0x3d00ba,_0x234cc1,_0x93298a){return db[_0x934b('0x4b')][_0x934b('0x4c')](function(_0x25badc){if(_0x3d00ba[_0x934b('0x49')][_0x934b('0x4d')]===_0x934b('0x4e')){_0x3d00ba[_0x934b('0x49')][_0x934b('0x4f')]=path['join'](config[_0x934b('0x50')],_0x934b('0x51'),_0x3d00ba['body']['name']);}return db[_0x934b('0x2a')][_0x934b('0x4a')](_0x3d00ba['body'],{'transaction':_0x25badc})[_0x934b('0x20')](function(_0x5fc387){if(_0x3d00ba['body'][_0x934b('0x4d')]===_0x934b('0x4e')){fs[_0x934b('0x52')](_0x5fc387[_0x934b('0x4f')],parseInt(_0x934b('0x53'),0x8));}var _0x5da259=_0x3d00ba[_0x934b('0x54')][_0x934b('0x22')]({'plain':!![]});if(!_0x5da259)throw new Error(_0x934b('0x55'));if(_0x5da259[_0x934b('0x56')]===_0x934b('0x54')){var _0x527a72=_0x5fc387[_0x934b('0x22')]({'plain':!![]});return db[_0x934b('0x57')][_0x934b('0x47')]({'where':{'name':_0x934b('0x58'),'userProfileId':_0x5da259[_0x934b('0x59')]},'raw':!![]})['then'](function(_0x3015b0){if(_0x3015b0&&_0x3015b0[_0x934b('0x5a')]===0x0){return db[_0x934b('0x23')][_0x934b('0x4a')]({'name':_0x527a72['name'],'resourceId':_0x527a72['id'],'type':_0x3015b0[_0x934b('0x26')],'sectionId':_0x3015b0['id']},{})[_0x934b('0x20')](function(){return _0x5fc387;});}else{return _0x5fc387;}})[_0x934b('0x43')](function(_0x573375){logger[_0x934b('0x25')](_0x934b('0x5b'),_0x573375);});}return _0x5fc387;});})[_0x934b('0x20')](respondWithResult(_0x234cc1,0xc9))[_0x934b('0x43')](handleError(_0x234cc1,null));};exports[_0x934b('0x21')]=function(_0x478bf8,_0x146a05,_0x24ae03){var _0x38078a;return db[_0x934b('0x2a')][_0x934b('0x47')]({'where':{'id':_0x478bf8['params']['id']}})[_0x934b('0x20')](function(_0x48754e){if(_0x48754e){return db[_0x934b('0x4b')][_0x934b('0x4c')](function(_0x1f5471){return _0x48754e[_0x934b('0x21')]({'transaction':_0x1f5471,'raw':!![]})[_0x934b('0x20')](function(_0x5a483b){if(_0x5a483b['directory']){fs[_0x934b('0x5c')](_0x5a483b[_0x934b('0x4f')])[_0x934b('0x5d')](function(_0x1e792d){fs[_0x934b('0x5e')](path[_0x934b('0x5f')](_0x5a483b['directory'],_0x1e792d));});fs[_0x934b('0x60')](_0x5a483b[_0x934b('0x4f')]);}return _0x5a483b;});})[_0x934b('0x43')](function(_0x4d85aa){throw new db[(_0x934b('0x61'))][(_0x934b('0x62'))](_0x4d85aa[_0x934b('0x63')]);});}})[_0x934b('0x20')](handleEntityNotFound(_0x146a05,null))['then'](removeEntity(_0x146a05,null))[_0x934b('0x43')](handleError(_0x146a05,null));};exports[_0x934b('0x64')]=function(_0x28d619,_0x200131,_0xb03f75){return db['sequelize'][_0x934b('0x4c')](function(_0x2aa01c){var _0x182753;return db[_0x934b('0x2a')]['find']({'where':{'id':_0x28d619['params']['id']}})[_0x934b('0x20')](function(_0x29cdc3){if(_0x29cdc3){_0x182753=_0x29cdc3;return _0x29cdc3[_0x934b('0x64')](_0x28d619[_0x934b('0x49')]['id'],{'transaction':_0x2aa01c});}})['then'](function(_0x24d0d5){if(_0x24d0d5){return db[_0x934b('0x65')][_0x934b('0x66')]({'where':{'id':_0x28d619[_0x934b('0x49')]['id']},'attributes':['id','name',_0x934b('0x67'),_0x934b('0x68'),_0x934b('0x69')],'raw':!![]});}})['then'](function(_0x34a3cd){if(_0x34a3cd){var _0x12ccb4=path[_0x934b('0x5f')](config[_0x934b('0x50')],'server/files/sounds/converted',util[_0x934b('0x6a')](_0x934b('0x6b'),path[_0x934b('0x6c')](_0x34a3cd[_0x934b('0x67')],path[_0x934b('0x6d')](_0x34a3cd[_0x934b('0x67')])),_0x34a3cd['converted_format']));var _0x5290ba=path[_0x934b('0x5f')](config[_0x934b('0x50')],_0x934b('0x51'),_0x182753[_0x934b('0x26')],util[_0x934b('0x6a')](_0x934b('0x6b'),_0x34a3cd[_0x934b('0x26')],_0x34a3cd[_0x934b('0x68')]));fs[_0x934b('0x6e')](_0x12ccb4,_0x5290ba);return _0x34a3cd;}})['catch'](function(_0x1fa2c1){throw new db[(_0x934b('0x61'))]['ValidationError'](_0x1fa2c1[_0x934b('0x63')]);});})[_0x934b('0x20')](handleEntityNotFound(_0x200131,null))[_0x934b('0x20')](respondWithResult(_0x200131,0xc9))[_0x934b('0x43')](handleError(_0x200131,null));};exports[_0x934b('0x6f')]=function(_0x328fbe,_0x47a0ec,_0x347674){return db[_0x934b('0x4b')][_0x934b('0x4c')](function(_0x3c8a6e){var _0x97ebd1;return db[_0x934b('0x2a')][_0x934b('0x66')]({'where':{'id':_0x328fbe[_0x934b('0x45')]['id']}})[_0x934b('0x20')](handleEntityNotFound(_0x47a0ec,null))[_0x934b('0x20')](function(_0x26ae73){if(_0x26ae73){_0x97ebd1=_0x26ae73;return _0x26ae73[_0x934b('0x6f')](_0x328fbe['params'][_0x934b('0x70')]);}})[_0x934b('0x20')](function(_0xdada70){if(_0xdada70){return db[_0x934b('0x65')][_0x934b('0x66')]({'where':{'id':_0x328fbe[_0x934b('0x45')][_0x934b('0x70')]},'attributes':['id',_0x934b('0x26'),_0x934b('0x67'),_0x934b('0x68'),_0x934b('0x69')],'raw':!![]});}})[_0x934b('0x20')](function(_0x306d40){if(_0x306d40){fs[_0x934b('0x5e')](path[_0x934b('0x5f')](_0x97ebd1[_0x934b('0x4f')],util[_0x934b('0x6a')](_0x934b('0x6b'),_0x306d40['name'],_0x306d40[_0x934b('0x68')])));return _0x306d40;}})[_0x934b('0x43')](function(_0x482ea4){throw new db[(_0x934b('0x61'))][(_0x934b('0x62'))](_0x482ea4[_0x934b('0x63')]);});})[_0x934b('0x20')](handleEntityNotFound(_0x47a0ec,null))[_0x934b('0x20')](respondWithStatusCode(_0x47a0ec,0xcc))[_0x934b('0x43')](handleError(_0x47a0ec,null));};exports[_0x934b('0x71')]=function(_0x7c4105,_0x4a6461,_0x2b4a55){var _0x496e8f={};var _0x3b1b4b={};var _0x446d33;var _0x52e45a;return db[_0x934b('0x2a')][_0x934b('0x66')]({'where':{'id':_0x7c4105[_0x934b('0x45')]['id']}})[_0x934b('0x20')](handleEntityNotFound(_0x4a6461,null))['then'](function(_0xcef2bf){if(_0xcef2bf){_0x446d33=_0xcef2bf;_0x3b1b4b[_0x934b('0x2f')]=_[_0x934b('0x31')](db[_0x934b('0x65')][_0x934b('0x2b')]);_0x3b1b4b[_0x934b('0x30')]=_[_0x934b('0x31')](_0x7c4105[_0x934b('0x30')]);_0x3b1b4b['filters']=_['intersection'](_0x3b1b4b['model'],_0x3b1b4b[_0x934b('0x30')]);_0x496e8f[_0x934b('0x33')]=_[_0x934b('0x34')](_0x3b1b4b['model'],qs['fields'](_0x7c4105['query']['fields']));_0x496e8f[_0x934b('0x33')]=_0x496e8f[_0x934b('0x33')][_0x934b('0x36')]?_0x496e8f[_0x934b('0x33')]:_0x3b1b4b[_0x934b('0x2f')];_0x496e8f[_0x934b('0x39')]=qs[_0x934b('0x3a')](_0x7c4105[_0x934b('0x30')][_0x934b('0x3a')]);_0x496e8f[_0x934b('0x3b')]=qs[_0x934b('0x32')](_[_0x934b('0x72')](_0x7c4105[_0x934b('0x30')],_0x3b1b4b[_0x934b('0x32')]));if(_0x7c4105['query']['filter']){_0x496e8f[_0x934b('0x3b')]=_[_0x934b('0x3c')](_0x496e8f[_0x934b('0x3b')],{'$or':_[_0x934b('0x29')](_0x496e8f[_0x934b('0x33')],function(_0x49b8ee){var _0x10e464={};_0x10e464[_0x49b8ee]={'$like':'%'+_0x7c4105['query']['filter']+'%'};return _0x10e464;})});}_0x496e8f=_[_0x934b('0x3c')]({},_0x496e8f,_0x7c4105['options']);return _0x446d33[_0x934b('0x71')](_0x496e8f);}})[_0x934b('0x20')](function(_0x4fb69c){if(_0x4fb69c){_0x52e45a=_0x4fb69c[_0x934b('0x36')];if(!_0x7c4105[_0x934b('0x30')][_0x934b('0x73')](_0x934b('0x37'))){_0x496e8f[_0x934b('0x38')]=qs[_0x934b('0x38')](_0x7c4105[_0x934b('0x30')][_0x934b('0x38')]);_0x496e8f[_0x934b('0x1a')]=qs['offset'](_0x7c4105[_0x934b('0x30')]['offset']);}return _0x446d33['getSounds'](_0x496e8f);}})['then'](function(_0x507a40){if(_0x507a40){return _0x507a40?{'count':_0x52e45a,'rows':_0x507a40}:null;}})[_0x934b('0x20')](respondWithResult(_0x4a6461,null))[_0x934b('0x43')](handleError(_0x4a6461,null));}; \ No newline at end of file +var _0xff69=['sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','forEach','Sequelize','ValidationError','message','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','symlinkSync','removeSound','id2','unlinkSync','getSounds','order','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','catch','body','find'];(function(_0x42eaf6,_0x4cbd21){var _0x20be5c=function(_0x374e28){while(--_0x374e28){_0x42eaf6['push'](_0x42eaf6['shift']());}};_0x20be5c(++_0x4cbd21);}(_0xff69,0x91));var _0x9ff6=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xff69[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require(_0x9ff6('0x0'));var rimraf=require(_0x9ff6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9ff6('0x2'));var moment=require(_0x9ff6('0x3'));var BPromise=require(_0x9ff6('0x4'));var Mustache=require(_0x9ff6('0x5'));var util=require(_0x9ff6('0x6'));var path=require(_0x9ff6('0x7'));var sox=require(_0x9ff6('0x8'));var csv=require(_0x9ff6('0x9'));var ejs=require(_0x9ff6('0xa'));var fs=require('fs');var fs_extra=require(_0x9ff6('0xb'));var _=require(_0x9ff6('0xc'));var squel=require(_0x9ff6('0xd'));var crypto=require(_0x9ff6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9ff6('0xf'));var toCsv=require(_0x9ff6('0x9'));var querystring=require(_0x9ff6('0x10'));var Papa=require('papaparse');var Redis=require(_0x9ff6('0x11'));var authService=require(_0x9ff6('0x12'));var qs=require(_0x9ff6('0x13'));var as=require(_0x9ff6('0x14'));var hardwareService=require(_0x9ff6('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9ff6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ff6('0x17'))['db'];function respondWithStatusCode(_0x1aadc4,_0x245305){_0x245305=_0x245305||0xcc;return function(_0x40b5f5){if(_0x40b5f5){return _0x1aadc4[_0x9ff6('0x18')](_0x245305);}return _0x1aadc4[_0x9ff6('0x19')](_0x245305)['end']();};}function respondWithResult(_0x5bf3fb,_0x2ca5d6){_0x2ca5d6=_0x2ca5d6||0xc8;return function(_0x1ca807){if(_0x1ca807){return _0x5bf3fb[_0x9ff6('0x19')](_0x2ca5d6)[_0x9ff6('0x1a')](_0x1ca807);}};}function respondWithFilteredResult(_0x50e519,_0x5bb613){return function(_0x3ba5bb){if(_0x3ba5bb){var _0x45e344=typeof _0x5bb613[_0x9ff6('0x1b')]==='undefined'&&typeof _0x5bb613[_0x9ff6('0x1c')]===_0x9ff6('0x1d');var _0x1819f5=_0x3ba5bb[_0x9ff6('0x1e')];var _0x4a456b=_0x45e344?0x0:_0x5bb613[_0x9ff6('0x1b')];var _0x210312=_0x45e344?_0x3ba5bb['count']:_0x5bb613[_0x9ff6('0x1b')]+_0x5bb613['limit'];var _0x395969;if(_0x210312>=_0x1819f5){_0x210312=_0x1819f5;_0x395969=0xc8;}else{_0x395969=0xce;}_0x50e519[_0x9ff6('0x19')](_0x395969);return _0x50e519['set'](_0x9ff6('0x1f'),_0x4a456b+'-'+_0x210312+'/'+_0x1819f5)[_0x9ff6('0x1a')](_0x3ba5bb);}return null;};}function patchUpdates(_0x1b5249){return function(_0x5ef8e1){try{jsonpatch[_0x9ff6('0x20')](_0x5ef8e1,_0x1b5249,!![]);}catch(_0x4e61d9){return BPromise[_0x9ff6('0x21')](_0x4e61d9);}return _0x5ef8e1[_0x9ff6('0x22')]();};}function saveUpdates(_0x1ca974,_0x148eff){return function(_0x230809){if(_0x230809){return _0x230809[_0x9ff6('0x23')](_0x1ca974)['then'](function(_0x5013c5){return _0x5013c5;});}return null;};}function removeEntity(_0x3a1fa6,_0x675d85){return function(_0x469eec){if(_0x469eec){return _0x469eec[_0x9ff6('0x24')]()['then'](function(){var _0xfb8f01=_0x469eec[_0x9ff6('0x25')]({'plain':!![]});var _0x59c55e=_0x9ff6('0x26');return db[_0x9ff6('0x27')][_0x9ff6('0x24')]({'where':{'type':_0x59c55e,'resourceId':_0xfb8f01['id']}})[_0x9ff6('0x28')](function(){return _0x469eec;});})['then'](function(){_0x3a1fa6[_0x9ff6('0x19')](0xcc)[_0x9ff6('0x29')]();});}};}function handleEntityNotFound(_0x401f31,_0x21c713){return function(_0x1fb574){if(!_0x1fb574){_0x401f31[_0x9ff6('0x18')](0x194);}return _0x1fb574;};}function handleError(_0x201902,_0x428d96){_0x428d96=_0x428d96||0x1f4;return function(_0x1b405a){logger['error'](_0x1b405a[_0x9ff6('0x2a')]);if(_0x1b405a[_0x9ff6('0x2b')]){delete _0x1b405a['name'];}_0x201902[_0x9ff6('0x19')](_0x428d96)[_0x9ff6('0x2c')](_0x1b405a);};}exports['index']=function(_0x20590e,_0x26410a){var _0x256853={},_0x37b973={},_0xae469c={'count':0x0,'rows':[]};var _0x16f0cc=_[_0x9ff6('0x2d')](db[_0x9ff6('0x2e')][_0x9ff6('0x2f')],function(_0x2d50d4){return{'name':_0x2d50d4[_0x9ff6('0x30')],'type':_0x2d50d4[_0x9ff6('0x31')][_0x9ff6('0x32')]};});_0x37b973['model']=_['map'](_0x16f0cc,_0x9ff6('0x2b'));_0x37b973[_0x9ff6('0x33')]=_[_0x9ff6('0x34')](_0x20590e['query']);_0x37b973[_0x9ff6('0x35')]=_[_0x9ff6('0x36')](_0x37b973['model'],_0x37b973['query']);_0x256853['attributes']=_['intersection'](_0x37b973[_0x9ff6('0x37')],qs[_0x9ff6('0x38')](_0x20590e[_0x9ff6('0x33')][_0x9ff6('0x38')]));_0x256853[_0x9ff6('0x39')]=_0x256853[_0x9ff6('0x39')]['length']?_0x256853[_0x9ff6('0x39')]:_0x37b973[_0x9ff6('0x37')];if(!_0x20590e[_0x9ff6('0x33')]['hasOwnProperty'](_0x9ff6('0x3a'))){_0x256853['limit']=qs[_0x9ff6('0x1c')](_0x20590e[_0x9ff6('0x33')][_0x9ff6('0x1c')]);_0x256853[_0x9ff6('0x1b')]=qs[_0x9ff6('0x1b')](_0x20590e['query'][_0x9ff6('0x1b')]);}_0x256853['order']=qs[_0x9ff6('0x3b')](_0x20590e['query'][_0x9ff6('0x3b')]);delete _0x20590e[_0x9ff6('0x33')][_0x9ff6('0x3b')];_0x256853[_0x9ff6('0x3c')]=qs[_0x9ff6('0x35')](_[_0x9ff6('0x3d')](_0x20590e['query'],_0x37b973[_0x9ff6('0x35')]),_0x16f0cc);if(_0x20590e[_0x9ff6('0x33')][_0x9ff6('0x3e')]){_0x256853['where']=_[_0x9ff6('0x3f')](_0x256853[_0x9ff6('0x3c')],{'$or':_['map'](_0x16f0cc,function(_0x255913){if(_0x255913[_0x9ff6('0x31')]!=='VIRTUAL'){var _0x34d1d9={};_0x34d1d9[_0x255913[_0x9ff6('0x2b')]]={'$like':'%'+_0x20590e[_0x9ff6('0x33')][_0x9ff6('0x3e')]+'%'};return _0x34d1d9;}})});}_0x256853=_[_0x9ff6('0x3f')]({},_0x256853,_0x20590e[_0x9ff6('0x40')]);var _0x47f3c5={'where':_0x256853[_0x9ff6('0x3c')]};return db[_0x9ff6('0x2e')][_0x9ff6('0x1e')](_0x47f3c5)['then'](function(_0x52ca11){_0xae469c[_0x9ff6('0x1e')]=_0x52ca11;if(_0x20590e[_0x9ff6('0x33')][_0x9ff6('0x41')]){_0x256853[_0x9ff6('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x9ff6('0x43')](_0x256853);})[_0x9ff6('0x28')](function(_0x525ecd){_0xae469c[_0x9ff6('0x44')]=_0x525ecd;return _0xae469c;})[_0x9ff6('0x28')](respondWithFilteredResult(_0x26410a,_0x256853))['catch'](handleError(_0x26410a,null));};exports[_0x9ff6('0x45')]=function(_0x3f8435,_0x278753){var _0x434389={'raw':![],'where':{'id':_0x3f8435[_0x9ff6('0x46')]['id']}},_0x488954={};_0x488954[_0x9ff6('0x37')]=_[_0x9ff6('0x34')](db['VoiceMusicOnHold'][_0x9ff6('0x2f')]);_0x488954['query']=_[_0x9ff6('0x34')](_0x3f8435['query']);_0x488954['filters']=_[_0x9ff6('0x36')](_0x488954[_0x9ff6('0x37')],_0x488954[_0x9ff6('0x33')]);_0x434389[_0x9ff6('0x39')]=_['intersection'](_0x488954['model'],qs['fields'](_0x3f8435['query']['fields']));_0x434389['attributes']=_0x434389['attributes'][_0x9ff6('0x47')]?_0x434389[_0x9ff6('0x39')]:_0x488954[_0x9ff6('0x37')];if(_0x3f8435['query'][_0x9ff6('0x41')]){_0x434389[_0x9ff6('0x42')]=[{'all':!![]}];}_0x434389=_[_0x9ff6('0x3f')]({},_0x434389,_0x3f8435['options']);return db['VoiceMusicOnHold']['find'](_0x434389)[_0x9ff6('0x28')](handleEntityNotFound(_0x278753,null))[_0x9ff6('0x28')](respondWithResult(_0x278753,null))[_0x9ff6('0x48')](handleError(_0x278753,null));};exports[_0x9ff6('0x23')]=function(_0x1b5d9e,_0x44179a){if(_0x1b5d9e['body']['id']){delete _0x1b5d9e[_0x9ff6('0x49')]['id'];}return db['VoiceMusicOnHold'][_0x9ff6('0x4a')]({'where':{'id':_0x1b5d9e[_0x9ff6('0x46')]['id']}})[_0x9ff6('0x28')](handleEntityNotFound(_0x44179a,null))[_0x9ff6('0x28')](saveUpdates(_0x1b5d9e[_0x9ff6('0x49')],null))[_0x9ff6('0x28')](respondWithResult(_0x44179a,null))[_0x9ff6('0x48')](handleError(_0x44179a,null));};exports['create']=function(_0x18cc86,_0xebb64d,_0x28fb1d){return db[_0x9ff6('0x4b')][_0x9ff6('0x4c')](function(_0x57e59c){if(_0x18cc86['body'][_0x9ff6('0x4d')]===_0x9ff6('0x4e')){_0x18cc86[_0x9ff6('0x49')][_0x9ff6('0x4f')]=path[_0x9ff6('0x50')](config[_0x9ff6('0x51')],_0x9ff6('0x52'),_0x18cc86[_0x9ff6('0x49')][_0x9ff6('0x2b')]);}return db[_0x9ff6('0x2e')][_0x9ff6('0x53')](_0x18cc86['body'],{'transaction':_0x57e59c})['then'](function(_0x2f1767){if(_0x18cc86[_0x9ff6('0x49')][_0x9ff6('0x4d')]===_0x9ff6('0x4e')){fs['mkdirSync'](_0x2f1767[_0x9ff6('0x4f')],parseInt(_0x9ff6('0x54'),0x8));}var _0x1b377b=_0x18cc86['user'][_0x9ff6('0x25')]({'plain':!![]});if(!_0x1b377b)throw new Error(_0x9ff6('0x55'));if(_0x1b377b[_0x9ff6('0x56')]===_0x9ff6('0x57')){var _0x1c8108=_0x2f1767['get']({'plain':!![]});return db[_0x9ff6('0x58')][_0x9ff6('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1b377b[_0x9ff6('0x59')]},'raw':!![]})[_0x9ff6('0x28')](function(_0x10c302){if(_0x10c302&&_0x10c302[_0x9ff6('0x5a')]===0x0){return db[_0x9ff6('0x27')][_0x9ff6('0x53')]({'name':_0x1c8108[_0x9ff6('0x2b')],'resourceId':_0x1c8108['id'],'type':_0x10c302[_0x9ff6('0x2b')],'sectionId':_0x10c302['id']},{})[_0x9ff6('0x28')](function(){return _0x2f1767;});}else{return _0x2f1767;}})[_0x9ff6('0x48')](function(_0x199d9f){logger[_0x9ff6('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x199d9f);});}return _0x2f1767;});})[_0x9ff6('0x28')](respondWithResult(_0xebb64d,0xc9))[_0x9ff6('0x48')](handleError(_0xebb64d,null));};exports[_0x9ff6('0x24')]=function(_0x2fd0e6,_0x1d12b1,_0x3fb501){var _0x57d108;return db[_0x9ff6('0x2e')][_0x9ff6('0x4a')]({'where':{'id':_0x2fd0e6['params']['id']}})[_0x9ff6('0x28')](function(_0xd567b4){if(_0xd567b4){return db['sequelize']['transaction'](function(_0x15cf04){return _0xd567b4[_0x9ff6('0x24')]({'transaction':_0x15cf04,'raw':!![]})[_0x9ff6('0x28')](function(_0x1ca145){if(_0x1ca145['directory']){fs['readdirSync'](_0x1ca145[_0x9ff6('0x4f')])[_0x9ff6('0x5c')](function(_0x9ea0f){fs['unlinkSync'](path[_0x9ff6('0x50')](_0x1ca145[_0x9ff6('0x4f')],_0x9ea0f));});fs['rmdirSync'](_0x1ca145['directory']);}return _0x1ca145;});})[_0x9ff6('0x48')](function(_0x3ddbde){throw new db[(_0x9ff6('0x5d'))][(_0x9ff6('0x5e'))](_0x3ddbde[_0x9ff6('0x5f')]);});}})[_0x9ff6('0x28')](handleEntityNotFound(_0x1d12b1,null))[_0x9ff6('0x28')](removeEntity(_0x1d12b1,null))[_0x9ff6('0x48')](handleError(_0x1d12b1,null));};exports['addSound']=function(_0xa56506,_0x4b791e,_0x4f5ac0){return db[_0x9ff6('0x4b')][_0x9ff6('0x4c')](function(_0x2a025d){var _0x4dc107;return db[_0x9ff6('0x2e')]['find']({'where':{'id':_0xa56506['params']['id']}})[_0x9ff6('0x28')](function(_0x3f522e){if(_0x3f522e){_0x4dc107=_0x3f522e;return _0x3f522e['addSound'](_0xa56506[_0x9ff6('0x49')]['id'],{'transaction':_0x2a025d});}})[_0x9ff6('0x28')](function(_0x16bbdf){if(_0x16bbdf){return db[_0x9ff6('0x60')][_0x9ff6('0x61')]({'where':{'id':_0xa56506[_0x9ff6('0x49')]['id']},'attributes':['id',_0x9ff6('0x2b'),_0x9ff6('0x62'),_0x9ff6('0x63'),_0x9ff6('0x64')],'raw':!![]});}})[_0x9ff6('0x28')](function(_0xe7deda){if(_0xe7deda){var _0x300c42=path[_0x9ff6('0x50')](config[_0x9ff6('0x51')],_0x9ff6('0x65'),util[_0x9ff6('0x66')]('%s.%s',path['basename'](_0xe7deda[_0x9ff6('0x62')],path['extname'](_0xe7deda[_0x9ff6('0x62')])),_0xe7deda[_0x9ff6('0x63')]));var _0x323eee=path[_0x9ff6('0x50')](config[_0x9ff6('0x51')],_0x9ff6('0x52'),_0x4dc107[_0x9ff6('0x2b')],util[_0x9ff6('0x66')](_0x9ff6('0x67'),_0xe7deda['name'],_0xe7deda[_0x9ff6('0x63')]));fs[_0x9ff6('0x68')](_0x300c42,_0x323eee);return _0xe7deda;}})[_0x9ff6('0x48')](function(_0x1c37c2){throw new db[(_0x9ff6('0x5d'))][(_0x9ff6('0x5e'))](_0x1c37c2['message']);});})[_0x9ff6('0x28')](handleEntityNotFound(_0x4b791e,null))[_0x9ff6('0x28')](respondWithResult(_0x4b791e,0xc9))[_0x9ff6('0x48')](handleError(_0x4b791e,null));};exports['removeSound']=function(_0x2c90ce,_0x2fb371,_0x31f548){return db[_0x9ff6('0x4b')][_0x9ff6('0x4c')](function(_0x4e26e4){var _0x511c03;return db[_0x9ff6('0x2e')]['findOne']({'where':{'id':_0x2c90ce[_0x9ff6('0x46')]['id']}})[_0x9ff6('0x28')](handleEntityNotFound(_0x2fb371,null))[_0x9ff6('0x28')](function(_0x12d552){if(_0x12d552){_0x511c03=_0x12d552;return _0x12d552[_0x9ff6('0x69')](_0x2c90ce[_0x9ff6('0x46')][_0x9ff6('0x6a')]);}})[_0x9ff6('0x28')](function(_0xc6ecb2){if(_0xc6ecb2){return db['Sound'][_0x9ff6('0x61')]({'where':{'id':_0x2c90ce['params'][_0x9ff6('0x6a')]},'attributes':['id',_0x9ff6('0x2b'),'save_name','converted_format',_0x9ff6('0x64')],'raw':!![]});}})[_0x9ff6('0x28')](function(_0xab5d4c){if(_0xab5d4c){fs[_0x9ff6('0x6b')](path[_0x9ff6('0x50')](_0x511c03[_0x9ff6('0x4f')],util[_0x9ff6('0x66')](_0x9ff6('0x67'),_0xab5d4c[_0x9ff6('0x2b')],_0xab5d4c[_0x9ff6('0x63')])));return _0xab5d4c;}})[_0x9ff6('0x48')](function(_0x37be5d){throw new db[(_0x9ff6('0x5d'))][(_0x9ff6('0x5e'))](_0x37be5d['message']);});})[_0x9ff6('0x28')](handleEntityNotFound(_0x2fb371,null))[_0x9ff6('0x28')](respondWithStatusCode(_0x2fb371,0xcc))[_0x9ff6('0x48')](handleError(_0x2fb371,null));};exports[_0x9ff6('0x6c')]=function(_0x5c6548,_0x1e9438,_0x10dce7){var _0x2fae09={};var _0x179213={};var _0x438b4e;var _0x3db5d1;return db[_0x9ff6('0x2e')][_0x9ff6('0x61')]({'where':{'id':_0x5c6548['params']['id']}})[_0x9ff6('0x28')](handleEntityNotFound(_0x1e9438,null))['then'](function(_0x321279){if(_0x321279){_0x438b4e=_0x321279;_0x179213[_0x9ff6('0x37')]=_[_0x9ff6('0x34')](db[_0x9ff6('0x60')][_0x9ff6('0x2f')]);_0x179213[_0x9ff6('0x33')]=_[_0x9ff6('0x34')](_0x5c6548[_0x9ff6('0x33')]);_0x179213[_0x9ff6('0x35')]=_['intersection'](_0x179213[_0x9ff6('0x37')],_0x179213['query']);_0x2fae09['attributes']=_['intersection'](_0x179213['model'],qs[_0x9ff6('0x38')](_0x5c6548['query'][_0x9ff6('0x38')]));_0x2fae09[_0x9ff6('0x39')]=_0x2fae09[_0x9ff6('0x39')][_0x9ff6('0x47')]?_0x2fae09['attributes']:_0x179213[_0x9ff6('0x37')];_0x2fae09[_0x9ff6('0x6d')]=qs[_0x9ff6('0x3b')](_0x5c6548[_0x9ff6('0x33')][_0x9ff6('0x3b')]);_0x2fae09[_0x9ff6('0x3c')]=qs[_0x9ff6('0x35')](_['pick'](_0x5c6548[_0x9ff6('0x33')],_0x179213[_0x9ff6('0x35')]));if(_0x5c6548[_0x9ff6('0x33')]['filter']){_0x2fae09[_0x9ff6('0x3c')]=_['merge'](_0x2fae09[_0x9ff6('0x3c')],{'$or':_[_0x9ff6('0x2d')](_0x2fae09[_0x9ff6('0x39')],function(_0x2e3e17){var _0x3c11b9={};_0x3c11b9[_0x2e3e17]={'$like':'%'+_0x5c6548[_0x9ff6('0x33')][_0x9ff6('0x3e')]+'%'};return _0x3c11b9;})});}_0x2fae09=_[_0x9ff6('0x3f')]({},_0x2fae09,_0x5c6548[_0x9ff6('0x40')]);return _0x438b4e[_0x9ff6('0x6c')](_0x2fae09);}})[_0x9ff6('0x28')](function(_0x36d354){if(_0x36d354){_0x3db5d1=_0x36d354[_0x9ff6('0x47')];if(!_0x5c6548[_0x9ff6('0x33')]['hasOwnProperty'](_0x9ff6('0x3a'))){_0x2fae09['limit']=qs[_0x9ff6('0x1c')](_0x5c6548['query'][_0x9ff6('0x1c')]);_0x2fae09[_0x9ff6('0x1b')]=qs[_0x9ff6('0x1b')](_0x5c6548[_0x9ff6('0x33')][_0x9ff6('0x1b')]);}return _0x438b4e[_0x9ff6('0x6c')](_0x2fae09);}})[_0x9ff6('0x28')](function(_0x153633){if(_0x153633){return _0x153633?{'count':_0x3db5d1,'rows':_0x153633}:null;}})[_0x9ff6('0x28')](respondWithResult(_0x1e9438,null))[_0x9ff6('0x48')](handleError(_0x1e9438,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 30b2b6e..be95c6c 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x331c=['moment','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0xedbfd,_0x3df491){var _0x3b0cff=function(_0x9f2e04){while(--_0x9f2e04){_0xedbfd['push'](_0xedbfd['shift']());}};_0x3b0cff(++_0x3df491);}(_0x331c,0xc2));var _0xc331=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x331c[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xc331('0x0'));var util=require(_0xc331('0x1'));var logger=require(_0xc331('0x2'))(_0xc331('0x3'));var moment=require(_0xc331('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc331('0x5'));var config=require('../../config/environment');var attributes=require(_0xc331('0x6'));module[_0xc331('0x7')]=function(_0x178677,_0x108be9){return _0x178677[_0xc331('0x8')](_0xc331('0x9'),attributes,{'tableName':_0xc331('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dc1=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold'];(function(_0x5ced70,_0x3b08c1){var _0x454c59=function(_0x570347){while(--_0x570347){_0x5ced70['push'](_0x5ced70['shift']());}};_0x454c59(++_0x3b08c1);}(_0x9dc1,0xdd));var _0x19dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19dc('0x0'));var util=require('util');var logger=require(_0x19dc('0x1'))(_0x19dc('0x2'));var moment=require(_0x19dc('0x3'));var BPromise=require(_0x19dc('0x4'));var rp=require(_0x19dc('0x5'));var fs=require('fs');var path=require(_0x19dc('0x6'));var rimraf=require(_0x19dc('0x7'));var config=require(_0x19dc('0x8'));var attributes=require(_0x19dc('0x9'));module[_0x19dc('0xa')]=function(_0xc1bff7,_0x2e7f97){return _0xc1bff7['define'](_0x19dc('0xb'),attributes,{'tableName':_0x19dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 4b0a9a4..f488aee 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5e195d,_0x4c975f){var _0x7590a1=function(_0x117d81){while(--_0x117d81){_0x5e195d['push'](_0x5e195d['shift']());}};_0x7590a1(++_0x4c975f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x17c0f8,_0x41a051){var _0x33ab29=function(_0x516f80){while(--_0x516f80){_0x17c0f8['push'](_0x17c0f8['shift']());}};_0x33ab29(++_0x41a051);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3258888..3db7f98 100644 --- a/server/api/voicePrefix/index.js +++ b/server/api/voicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10ab=['getTeams','post','create','addAgents','addTeams','put','/:id','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams'];(function(_0x788b63,_0x428a38){var _0x210170=function(_0x5f0960){while(--_0x5f0960){_0x788b63['push'](_0x788b63['shift']());}};_0x210170(++_0x428a38);}(_0x10ab,0x178));var _0xb10a=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x10ab[_0x2f3794];return _0x1c9fbe;};'use strict';var multer=require(_0xb10a('0x0'));var util=require(_0xb10a('0x1'));var path=require('path');var timeout=require(_0xb10a('0x2'));var express=require('express');var router=express[_0xb10a('0x3')]();var fs_extra=require(_0xb10a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb10a('0x5'));var config=require(_0xb10a('0x6'));var controller=require('./voicePrefix.controller');router[_0xb10a('0x7')]('/',auth[_0xb10a('0x8')](),controller[_0xb10a('0x9')]);router[_0xb10a('0x7')](_0xb10a('0xa'),auth[_0xb10a('0x8')](),controller[_0xb10a('0xb')]);router[_0xb10a('0x7')]('/:id',auth[_0xb10a('0x8')](),controller[_0xb10a('0xc')]);router[_0xb10a('0x7')](_0xb10a('0xd'),auth[_0xb10a('0x8')](),controller[_0xb10a('0xe')]);router[_0xb10a('0x7')](_0xb10a('0xf'),auth[_0xb10a('0x8')](),controller[_0xb10a('0x10')]);router[_0xb10a('0x11')]('/',auth[_0xb10a('0x8')](),controller[_0xb10a('0x12')]);router['post']('/:id/users',auth[_0xb10a('0x8')](),controller[_0xb10a('0x13')]);router[_0xb10a('0x11')](_0xb10a('0xf'),auth[_0xb10a('0x8')](),controller[_0xb10a('0x14')]);router[_0xb10a('0x15')](_0xb10a('0x16'),auth[_0xb10a('0x8')](),controller[_0xb10a('0x17')]);router[_0xb10a('0x18')](_0xb10a('0x16'),auth[_0xb10a('0x8')](),controller[_0xb10a('0x19')]);router['delete'](_0xb10a('0xd'),auth['isAuthenticated'](),controller['removeAgents']);router[_0xb10a('0x18')](_0xb10a('0xf'),auth['isAuthenticated'](),controller[_0xb10a('0x1a')]);module[_0xb10a('0x1b')]=router; \ No newline at end of file +var _0xd846=['Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','getTeams','post','addAgents','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','path'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0xd846,0x195));var _0x6d84=function(_0x46e2e1,_0x4d7230){_0x46e2e1=_0x46e2e1-0x0;var _0x4721a1=_0xd846[_0x46e2e1];return _0x4721a1;};'use strict';var multer=require(_0x6d84('0x0'));var util=require(_0x6d84('0x1'));var path=require(_0x6d84('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d84('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d84('0x4'));var config=require(_0x6d84('0x5'));var controller=require('./voicePrefix.controller');router[_0x6d84('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d84('0x6')](_0x6d84('0x7'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x9')]);router[_0x6d84('0x6')](_0x6d84('0xa'),auth[_0x6d84('0x8')](),controller[_0x6d84('0xb')]);router[_0x6d84('0x6')](_0x6d84('0xc'),auth[_0x6d84('0x8')](),controller['getAgents']);router[_0x6d84('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6d84('0xd')]);router[_0x6d84('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6d84('0xe')](_0x6d84('0xc'),auth[_0x6d84('0x8')](),controller[_0x6d84('0xf')]);router[_0x6d84('0xe')](_0x6d84('0x10'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x11')]);router[_0x6d84('0x12')](_0x6d84('0xa'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x13')]);router[_0x6d84('0x14')]('/:id',auth[_0x6d84('0x8')](),controller[_0x6d84('0x15')]);router['delete'](_0x6d84('0xc'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x16')]);router[_0x6d84('0x14')](_0x6d84('0x10'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 740f6a9..d86f2d0 100644 --- a/server/api/voicePrefix/voicePrefix.attributes.js +++ b/server/api/voicePrefix/voicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37a0=['name','VIRTUAL','system-','getDataValue','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x37a0,0x154));var _0x037a=function(_0x1f782c,_0x528875){_0x1f782c=_0x1f782c-0x0;var _0x36c8d7=_0x37a0[_0x1f782c];return _0x36c8d7;};'use strict';var Sequelize=require(_0x037a('0x0'));module[_0x037a('0x1')]={'name':{'type':Sequelize[_0x037a('0x2')],'allowNull':![],'unique':_0x037a('0x3')},'prefix':{'type':Sequelize[_0x037a('0x4')],'get':function(_0x4a9f6f){return _0x037a('0x5')+this[_0x037a('0x6')](_0x037a('0x3'))+'-';}},'description':{'type':Sequelize[_0x037a('0x2')]},'callerIdAll':{'type':Sequelize[_0x037a('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6573=['sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x6573,0xea));var _0x3657=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6573[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3657('0x0'));module[_0x3657('0x1')]={'name':{'type':Sequelize[_0x3657('0x2')],'allowNull':![],'unique':_0x3657('0x3')},'prefix':{'type':Sequelize[_0x3657('0x4')],'get':function(_0x2d7b48){return _0x3657('0x5')+this['getDataValue'](_0x3657('0x3'))+'-';}},'description':{'type':Sequelize[_0x3657('0x2')]},'callerIdAll':{'type':Sequelize[_0x3657('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index e9b4685..c5649c8 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3de3=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voicePrefix.socket','register','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','VoicePrefixes','UserProfileResource','destroy','end','error','stack','name','send','index','map','VoicePrefix','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','intersection','find','params','describe','create','transaction','body','get','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','callerIdAll','No\x20callerid\x20available','push','goto','${EXTEN:','charAt','system-','findById','ids','omit','spread','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','emit','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto'];(function(_0x263053,_0x3db497){var _0xf8ccbc=function(_0x398055){while(--_0x398055){_0x263053['push'](_0x263053['shift']());}};_0xf8ccbc(++_0x3db497);}(_0x3de3,0x1ce));var _0x33de=function(_0x1ecaaf,_0x41c143){_0x1ecaaf=_0x1ecaaf-0x0;var _0x5e54da=_0x3de3[_0x1ecaaf];return _0x5e54da;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];config[_0x33de('0x19')]=_['defaults'](config[_0x33de('0x19')],{'host':_0x33de('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x33de('0x1b'))[_0x33de('0x1c')](socket);function respondWithStatusCode(_0x2b3748,_0x57a2a1){_0x57a2a1=_0x57a2a1||0xcc;return function(_0x57aa73){if(_0x57aa73){return _0x2b3748[_0x33de('0x1d')](_0x57a2a1);}return _0x2b3748[_0x33de('0x1e')](_0x57a2a1)['end']();};}function respondWithResult(_0x4ff69f,_0x185849){_0x185849=_0x185849||0xc8;return function(_0x16c050){if(_0x16c050){return _0x4ff69f[_0x33de('0x1e')](_0x185849)['json'](_0x16c050);}};}function respondWithFilteredResult(_0x2db887,_0x1203cf){return function(_0x52cfa0){if(_0x52cfa0){var _0x2815a7=typeof _0x1203cf[_0x33de('0x1f')]==='undefined'&&typeof _0x1203cf['limit']===_0x33de('0x20');var _0x52d718=_0x52cfa0[_0x33de('0x21')];var _0x2f0529=_0x2815a7?0x0:_0x1203cf[_0x33de('0x1f')];var _0x315c9b=_0x2815a7?_0x52cfa0[_0x33de('0x21')]:_0x1203cf[_0x33de('0x1f')]+_0x1203cf[_0x33de('0x22')];var _0x493263;if(_0x315c9b>=_0x52d718){_0x315c9b=_0x52d718;_0x493263=0xc8;}else{_0x493263=0xce;}_0x2db887['status'](_0x493263);return _0x2db887[_0x33de('0x23')]('Content-Range',_0x2f0529+'-'+_0x315c9b+'/'+_0x52d718)[_0x33de('0x24')](_0x52cfa0);}return null;};}function patchUpdates(_0x4cd8db){return function(_0x28ed17){try{jsonpatch[_0x33de('0x25')](_0x28ed17,_0x4cd8db,!![]);}catch(_0x575e88){return BPromise[_0x33de('0x26')](_0x575e88);}return _0x28ed17['save']();};}function saveUpdates(_0x67d040,_0x5c602d){return function(_0x62743b){if(_0x62743b){return _0x62743b[_0x33de('0x27')](_0x67d040)[_0x33de('0x28')](function(_0x5b79d7){return _0x5b79d7;});}return null;};}function removeEntity(_0x3bdba4,_0x2d206b){return function(_0x140979){if(_0x140979){return _0x140979['destroy']()[_0x33de('0x28')](function(){var _0x5585a2=_0x140979['get']({'plain':!![]});var _0x1c8de9=_0x33de('0x29');return db[_0x33de('0x2a')][_0x33de('0x2b')]({'where':{'type':_0x1c8de9,'resourceId':_0x5585a2['id']}})[_0x33de('0x28')](function(){return _0x140979;});})[_0x33de('0x28')](function(){_0x3bdba4[_0x33de('0x1e')](0xcc)[_0x33de('0x2c')]();});}};}function handleEntityNotFound(_0x59bc3b,_0x5ae0e8){return function(_0x2755e6){if(!_0x2755e6){_0x59bc3b[_0x33de('0x1d')](0x194);}return _0x2755e6;};}function handleError(_0xaeaec5,_0x451ff5){_0x451ff5=_0x451ff5||0x1f4;return function(_0x167cec){logger[_0x33de('0x2d')](_0x167cec[_0x33de('0x2e')]);if(_0x167cec['name']){delete _0x167cec[_0x33de('0x2f')];}_0xaeaec5[_0x33de('0x1e')](_0x451ff5)[_0x33de('0x30')](_0x167cec);};}exports[_0x33de('0x31')]=function(_0x49e857,_0xe5dc68){var _0xf5d78a={},_0x5a9c43={},_0x5d2da4={'count':0x0,'rows':[]};var _0x57fcf3=_[_0x33de('0x32')](db[_0x33de('0x33')]['rawAttributes'],function(_0x1d0194){return{'name':_0x1d0194['fieldName'],'type':_0x1d0194['type'][_0x33de('0x34')]};});_0x5a9c43[_0x33de('0x35')]=_[_0x33de('0x32')](_0x57fcf3,_0x33de('0x2f'));_0x5a9c43[_0x33de('0x36')]=_[_0x33de('0x37')](_0x49e857[_0x33de('0x36')]);_0x5a9c43[_0x33de('0x38')]=_['intersection'](_0x5a9c43[_0x33de('0x35')],_0x5a9c43['query']);_0xf5d78a[_0x33de('0x39')]=_['intersection'](_0x5a9c43['model'],qs[_0x33de('0x3a')](_0x49e857[_0x33de('0x36')][_0x33de('0x3a')]));_0xf5d78a[_0x33de('0x39')]=_0xf5d78a[_0x33de('0x39')][_0x33de('0x3b')]?_0xf5d78a['attributes']:_0x5a9c43[_0x33de('0x35')];if(!_0x49e857[_0x33de('0x36')][_0x33de('0x3c')](_0x33de('0x3d'))){_0xf5d78a[_0x33de('0x22')]=qs[_0x33de('0x22')](_0x49e857[_0x33de('0x36')]['limit']);_0xf5d78a[_0x33de('0x1f')]=qs[_0x33de('0x1f')](_0x49e857[_0x33de('0x36')][_0x33de('0x1f')]);}_0xf5d78a[_0x33de('0x3e')]=qs[_0x33de('0x3f')](_0x49e857[_0x33de('0x36')]['sort']);_0xf5d78a[_0x33de('0x40')]=qs[_0x33de('0x38')](_[_0x33de('0x41')](_0x49e857[_0x33de('0x36')],_0x5a9c43[_0x33de('0x38')]),_0x57fcf3);if(_0x49e857[_0x33de('0x36')]['filter']){_0xf5d78a[_0x33de('0x40')]=_['merge'](_0xf5d78a[_0x33de('0x40')],{'$or':_[_0x33de('0x32')](_0x57fcf3,function(_0x4da2a5){if(_0x4da2a5[_0x33de('0x42')]!==_0x33de('0x43')){var _0x15918c={};_0x15918c[_0x4da2a5[_0x33de('0x2f')]]={'$like':'%'+_0x49e857[_0x33de('0x36')][_0x33de('0x44')]+'%'};return _0x15918c;}})});}_0xf5d78a=_[_0x33de('0x45')]({},_0xf5d78a,_0x49e857[_0x33de('0x46')]);var _0x48e0fc={'where':_0xf5d78a['where']};return db['VoicePrefix'][_0x33de('0x21')](_0x48e0fc)[_0x33de('0x28')](function(_0x20d04f){_0x5d2da4[_0x33de('0x21')]=_0x20d04f;if(_0x49e857['query'][_0x33de('0x47')]){_0xf5d78a['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x33de('0x48')](_0xf5d78a);})[_0x33de('0x28')](function(_0x384b12){_0x5d2da4[_0x33de('0x49')]=_0x384b12;return _0x5d2da4;})[_0x33de('0x28')](respondWithFilteredResult(_0xe5dc68,_0xf5d78a))[_0x33de('0x4a')](handleError(_0xe5dc68,null));};exports[_0x33de('0x4b')]=function(_0x49b067,_0x3b5530){var _0x5de38b={'raw':![],'where':{'id':_0x49b067['params']['id']}},_0x2fbca6={};_0x2fbca6[_0x33de('0x35')]=_[_0x33de('0x37')](db['VoicePrefix'][_0x33de('0x4c')]);_0x2fbca6[_0x33de('0x36')]=_[_0x33de('0x37')](_0x49b067['query']);_0x2fbca6['filters']=_[_0x33de('0x4d')](_0x2fbca6[_0x33de('0x35')],_0x2fbca6['query']);_0x5de38b['attributes']=_[_0x33de('0x4d')](_0x2fbca6['model'],qs['fields'](_0x49b067['query'][_0x33de('0x3a')]));_0x5de38b[_0x33de('0x39')]=_0x5de38b[_0x33de('0x39')][_0x33de('0x3b')]?_0x5de38b['attributes']:_0x2fbca6['model'];if(_0x49b067[_0x33de('0x36')][_0x33de('0x47')]){_0x5de38b['include']=[{'all':!![]}];}_0x5de38b=_[_0x33de('0x45')]({},_0x5de38b,_0x49b067[_0x33de('0x46')]);return db[_0x33de('0x33')][_0x33de('0x4e')](_0x5de38b)[_0x33de('0x28')](handleEntityNotFound(_0x3b5530,null))['then'](respondWithResult(_0x3b5530,null))[_0x33de('0x4a')](handleError(_0x3b5530,null));};exports[_0x33de('0x2b')]=function(_0x4fe3a2,_0x302573){return db[_0x33de('0x33')][_0x33de('0x4e')]({'where':{'id':_0x4fe3a2[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x302573,null))[_0x33de('0x28')](removeEntity(_0x302573,null))[_0x33de('0x4a')](handleError(_0x302573,null));};exports[_0x33de('0x50')]=function(_0x24e428,_0x1b4397){return db['VoicePrefix'][_0x33de('0x50')]()[_0x33de('0x28')](respondWithResult(_0x1b4397,null))[_0x33de('0x4a')](handleError(_0x1b4397,null));};exports[_0x33de('0x51')]=function(_0xe6d59,_0x3fe65d){var _0x5c91e7;return db['sequelize'][_0x33de('0x52')](function(_0x32042e){return db[_0x33de('0x33')]['create'](_0xe6d59[_0x33de('0x53')],{'transaction':_0x32042e})[_0x33de('0x28')](function(_0x379224){_0x5c91e7=_0x379224[_0x33de('0x54')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x5c91e7[_0x33de('0x55')]},'raw':!![]})[_0x33de('0x28')](function(_0x232da5){return createVoicePrefixExtensions(_0x5c91e7,_0x232da5,_0x32042e);});});})[_0x33de('0x28')](function(){var _0x379784=_0xe6d59['user']['get']({'plain':!![]});if(!_0x379784)throw new Error(_0x33de('0x56'));if(_0x379784[_0x33de('0x57')]===_0x33de('0x58')){var _0x7112db=_0x5c91e7;return db[_0x33de('0x59')][_0x33de('0x4e')]({'where':{'name':_0x33de('0x29'),'userProfileId':_0x379784[_0x33de('0x5a')]},'raw':!![]})[_0x33de('0x28')](function(_0x5de12f){if(_0x5de12f&&_0x5de12f[_0x33de('0x5b')]===0x0){return db[_0x33de('0x2a')][_0x33de('0x51')]({'name':_0x7112db['name'],'resourceId':_0x7112db['id'],'type':_0x5de12f[_0x33de('0x2f')],'sectionId':_0x5de12f['id']},{})['then'](function(){return _0x5c91e7;});}else{return _0x5c91e7;}})['catch'](function(_0x4dae6d){logger['error'](_0x33de('0x5c'),_0x4dae6d);throw _0x4dae6d;});}return _0x5c91e7;})[_0x33de('0x28')](respondWithResult(_0x3fe65d,null))['catch'](handleError(_0x3fe65d,null));};function Extension(_0x397179,_0x232840,_0x56542f,_0x42c8b9){this[_0x33de('0x5d')]='from-sip';this[_0x33de('0x5e')]=_0x397179;this[_0x33de('0x5f')]=_0x56542f;this[_0x33de('0x42')]=_0x33de('0x60');this[_0x33de('0x61')]=_0x33de('0x62');this[_0x33de('0x63')]=_0x232840;this['appdata']=_0x42c8b9;}function createVoicePrefixExtensions(_0x533863,_0x409e2e,_0x49516d){return new BPromise(function(_0x2af340,_0x3eef03){var _0x4ca20f=new Extension(formatPrefixName(_0x533863[_0x33de('0x64')]),0x1,'NoOp',_0x33de('0x65'));_0x4ca20f[_0x33de('0x66')]=_0x533863['id'];return db['VoiceExtension']['create'](_0x4ca20f,{'transaction':_0x49516d})[_0x33de('0x28')](function(_0x1b2d6f){var _0x17845c=_0x1b2d6f[_0x33de('0x54')]({'plain':!![]});var _0x24d936=_['map'](addVoicePrefixExtensions(_0x533863,_0x409e2e),function(_0x221038){_0x221038[_0x33de('0x55')]=_0x17845c['id'];_0x221038['VoicePrefixId']=_0x533863['id'];return _0x221038;});return db[_0x33de('0x67')][_0x33de('0x68')](_0x24d936,{'transaction':_0x49516d})['then'](function(_0x151551){if(!_0x151551){return _0x3eef03(_0x33de('0x69'));}else{return _0x2af340(_0x151551);}})['catch'](function(_0x4aa203){return _0x3eef03(_0x4aa203);});});;});};function addVoicePrefixExtensions(_0xc2504a,_0x55d7ef){var _0x31a511=[];var _0x4803b8=formatPrefixName(_0xc2504a[_0x33de('0x64')]);_0x31a511['push'](new Extension(_0x4803b8,0x2,'Set','CDR(prefix)='+_0xc2504a['name']));if(_0xc2504a['callerIdAll']){_0x31a511['push'](new Extension(_0x4803b8,0x3,_0x33de('0x6a'),'PREFIX-CALLERIDALL='+_0xc2504a[_0x33de('0x6b')]));}else{_0x31a511['push'](new Extension(_0x4803b8,0x3,'NoOp',_0x33de('0x6c')));}_0x31a511[_0x33de('0x6d')](new Extension(_0x4803b8,0x4,_0x33de('0x6e'),_0x55d7ef[_0x33de('0x5d')]+','+_0x33de('0x6f')+(0x8+_0xc2504a[_0x33de('0x2f')][_0x33de('0x3b')])+'}'+','+0x1));return _0x31a511;}function formatPrefixName(_0x659652){var _0x4893d2='_';for(var _0x297a84=0x0;_0x297a84<_0x659652['length'];_0x297a84++){if(_0x659652[_0x33de('0x70')](_0x297a84)=='-'){_0x4893d2+=_0x659652[_0x33de('0x70')](_0x297a84);}else{_0x4893d2+='['+_0x659652[_0x33de('0x70')](_0x297a84)+']';}}_0x4893d2+='.';return _0x4893d2;}exports[_0x33de('0x27')]=function(_0x8a9729,_0x3f5d52,_0x2a6004){var _0x355b7d=_0x8a9729[_0x33de('0x53')];_0x355b7d[_0x33de('0x64')]=_0x33de('0x71')+_0x355b7d['name']+'-';return db['sequelize'][_0x33de('0x52')](function(_0x1179f6){return db[_0x33de('0x33')][_0x33de('0x27')](_0x355b7d,{'where':{'id':_0x355b7d['id']},'transaction':_0x1179f6})[_0x33de('0x28')](function(){return db[_0x33de('0x67')][_0x33de('0x2b')]({'where':{'VoicePrefixId':_0x355b7d['id']},'transaction':_0x1179f6})[_0x33de('0x28')](function(){return db[_0x33de('0x67')][_0x33de('0x4e')]({'where':{'id':_0x355b7d['VoiceExtensionId']},'raw':!![]})[_0x33de('0x28')](function(_0x43eb19){return createVoicePrefixExtensions(_0x355b7d,_0x43eb19,_0x1179f6);});});});})[_0x33de('0x28')](function(){return db[_0x33de('0x33')][_0x33de('0x72')](_0x355b7d['id']);})[_0x33de('0x28')](respondWithResult(_0x3f5d52,null))['catch'](handleError(_0x3f5d52,null));};exports['addAgents']=function(_0x558c26,_0x1370ac,_0x2d2b02){return db[_0x33de('0x33')][_0x33de('0x4e')]({'where':{'id':_0x558c26['params']['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x1370ac,null))[_0x33de('0x28')](function(_0x484827){if(_0x484827){return _0x484827['addAgents'](_0x558c26['body'][_0x33de('0x73')],_[_0x33de('0x74')](_0x558c26[_0x33de('0x53')],[_0x33de('0x73'),'id'])||{})[_0x33de('0x75')](function(_0x545555){for(var _0x2e6389=0x0;_0x2e6389<_0x558c26['body'][_0x33de('0x73')][_0x33de('0x3b')];_0x2e6389+=0x1){socket['emit'](_0x33de('0x76'),{'UserId':Number(_0x558c26[_0x33de('0x53')]['ids'][_0x2e6389]),'VoicePrefixId':Number(_0x558c26[_0x33de('0x4f')]['id'])});}return _0x545555;});}})['then'](respondWithResult(_0x1370ac,null))['catch'](handleError(_0x1370ac,null));};exports[_0x33de('0x77')]=function(_0x2ef94d,_0x3fbbaf,_0x46e3d6){return db[_0x33de('0x33')]['find']({'where':{'id':_0x2ef94d[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x3fbbaf,null))[_0x33de('0x28')](function(_0x1e0637){if(_0x1e0637){return _0x1e0637['removeAgents'](_0x2ef94d[_0x33de('0x36')][_0x33de('0x73')])[_0x33de('0x28')](function(){if(_['isArray'](_0x2ef94d['query']['ids'])){for(var _0x586c51=0x0;_0x586c51<_0x2ef94d['query'][_0x33de('0x73')][_0x33de('0x3b')];_0x586c51+=0x1){socket['emit'](_0x33de('0x78'),{'UserId':Number(_0x2ef94d['query']['ids'][_0x586c51]),'VoicePrefixId':Number(_0x2ef94d[_0x33de('0x4f')]['id'])});}}else{socket[_0x33de('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x2ef94d[_0x33de('0x36')][_0x33de('0x73')]),'VoicePrefixId':Number(_0x2ef94d['params']['id'])});}});}})[_0x33de('0x28')](respondWithStatusCode(_0x3fbbaf,null))['catch'](handleError(_0x3fbbaf,null));};exports[_0x33de('0x7a')]=function(_0x1d060d,_0x487dac,_0x30d749){var _0x2cd94f={};var _0x53ec24={};var _0x4fa42c;var _0x130bbd;return db[_0x33de('0x33')][_0x33de('0x7b')]({'where':{'id':_0x1d060d[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x487dac,null))[_0x33de('0x28')](function(_0x4ef18b){if(_0x4ef18b){_0x4fa42c=_0x4ef18b;_0x53ec24[_0x33de('0x35')]=_[_0x33de('0x37')](db[_0x33de('0x7c')][_0x33de('0x4c')]);_0x53ec24[_0x33de('0x36')]=_[_0x33de('0x37')](_0x1d060d[_0x33de('0x36')]);_0x53ec24[_0x33de('0x38')]=_[_0x33de('0x4d')](_0x53ec24[_0x33de('0x35')],_0x53ec24[_0x33de('0x36')]);_0x2cd94f[_0x33de('0x39')]=_[_0x33de('0x4d')](_0x53ec24[_0x33de('0x35')],qs[_0x33de('0x3a')](_0x1d060d[_0x33de('0x36')]['fields']));_0x2cd94f[_0x33de('0x39')]=_0x2cd94f[_0x33de('0x39')][_0x33de('0x3b')]?_0x2cd94f[_0x33de('0x39')]:_0x53ec24[_0x33de('0x35')];_0x2cd94f['order']=qs[_0x33de('0x3f')](_0x1d060d[_0x33de('0x36')][_0x33de('0x3f')]);_0x2cd94f[_0x33de('0x40')]=qs[_0x33de('0x38')](_[_0x33de('0x41')](_0x1d060d[_0x33de('0x36')],_0x53ec24[_0x33de('0x38')]));if(_0x1d060d[_0x33de('0x36')][_0x33de('0x44')]){_0x2cd94f['where']=_['merge'](_0x2cd94f[_0x33de('0x40')],{'$or':_[_0x33de('0x32')](_0x2cd94f[_0x33de('0x39')],function(_0xa0b337){var _0x5b8928={};_0x5b8928[_0xa0b337]={'$like':'%'+_0x1d060d[_0x33de('0x36')][_0x33de('0x44')]+'%'};return _0x5b8928;})});}_0x2cd94f=_[_0x33de('0x45')]({},_0x2cd94f,_0x1d060d['options']);return _0x4fa42c['getAgents'](_0x2cd94f);}})[_0x33de('0x28')](function(_0xe6b940){if(_0xe6b940){_0x130bbd=_0xe6b940[_0x33de('0x3b')];if(!_0x1d060d['query'][_0x33de('0x3c')](_0x33de('0x3d'))){_0x2cd94f[_0x33de('0x22')]=qs['limit'](_0x1d060d[_0x33de('0x36')][_0x33de('0x22')]);_0x2cd94f['offset']=qs[_0x33de('0x1f')](_0x1d060d['query'][_0x33de('0x1f')]);}return _0x4fa42c[_0x33de('0x7a')](_0x2cd94f);}})['then'](function(_0x42546c){if(_0x42546c){return _0x42546c?{'count':_0x130bbd,'rows':_0x42546c}:null;}})[_0x33de('0x28')](respondWithResult(_0x487dac,null))[_0x33de('0x4a')](handleError(_0x487dac,null));};exports['getTeams']=function(_0x52b4e2,_0x48a039,_0xfb0042){var _0x5f46d7={};var _0x5817e3={};var _0x3df0d3;var _0xebf05f;return db[_0x33de('0x33')][_0x33de('0x7b')]({'where':{'id':_0x52b4e2['params']['id']}})[_0x33de('0x28')](handleEntityNotFound(_0x48a039,null))[_0x33de('0x28')](function(_0x27072a){if(_0x27072a){_0x3df0d3=_0x27072a;_0x5817e3['model']=_[_0x33de('0x37')](db[_0x33de('0x7d')][_0x33de('0x4c')]);_0x5817e3[_0x33de('0x36')]=_[_0x33de('0x37')](_0x52b4e2[_0x33de('0x36')]);_0x5817e3[_0x33de('0x38')]=_[_0x33de('0x4d')](_0x5817e3[_0x33de('0x35')],_0x5817e3[_0x33de('0x36')]);_0x5f46d7[_0x33de('0x39')]=_[_0x33de('0x4d')](_0x5817e3[_0x33de('0x35')],qs[_0x33de('0x3a')](_0x52b4e2[_0x33de('0x36')][_0x33de('0x3a')]));_0x5f46d7[_0x33de('0x39')]=_0x5f46d7[_0x33de('0x39')][_0x33de('0x3b')]?_0x5f46d7['attributes']:_0x5817e3[_0x33de('0x35')];_0x5f46d7[_0x33de('0x3e')]=qs[_0x33de('0x3f')](_0x52b4e2[_0x33de('0x36')][_0x33de('0x3f')]);_0x5f46d7['where']=qs[_0x33de('0x38')](_[_0x33de('0x41')](_0x52b4e2[_0x33de('0x36')],_0x5817e3[_0x33de('0x38')]));if(_0x52b4e2[_0x33de('0x36')][_0x33de('0x44')]){_0x5f46d7[_0x33de('0x40')]=_[_0x33de('0x45')](_0x5f46d7[_0x33de('0x40')],{'$or':_[_0x33de('0x32')](_0x5f46d7['attributes'],function(_0x3af223){var _0x258238={};_0x258238[_0x3af223]={'$like':'%'+_0x52b4e2['query'][_0x33de('0x44')]+'%'};return _0x258238;})});}_0x5f46d7=_[_0x33de('0x45')]({},_0x5f46d7,_0x52b4e2['options']);return _0x3df0d3['getTeams'](_0x5f46d7);}})['then'](function(_0x1f1bd4){if(_0x1f1bd4){_0xebf05f=_0x1f1bd4['length'];if(!_0x52b4e2[_0x33de('0x36')][_0x33de('0x3c')]('nolimit')){_0x5f46d7[_0x33de('0x22')]=qs['limit'](_0x52b4e2[_0x33de('0x36')][_0x33de('0x22')]);_0x5f46d7[_0x33de('0x1f')]=qs[_0x33de('0x1f')](_0x52b4e2[_0x33de('0x36')]['offset']);}return _0x3df0d3[_0x33de('0x7e')](_0x5f46d7);}})[_0x33de('0x28')](function(_0x24dcfe){if(_0x24dcfe){return _0x24dcfe?{'count':_0xebf05f,'rows':_0x24dcfe}:null;}})['then'](respondWithResult(_0x48a039,null))[_0x33de('0x4a')](handleError(_0x48a039,null));};exports[_0x33de('0x7f')]=function(_0x24af54,_0x2baee6,_0x56fadb){var _0x5ce00e=_0x24af54[_0x33de('0x53')][_0x33de('0x73')];var _0x2127ab;return db[_0x33de('0x7d')][_0x33de('0x48')]({'where':{'id':_0x5ce00e},'attributes':['id'],'include':[{'model':db[_0x33de('0x7c')],'as':_0x33de('0x80'),'attributes':['id',_0x33de('0x2f'),_0x33de('0x81'),_0x33de('0x82'),_0x33de('0x83')],'raw':!![]}]})[_0x33de('0x28')](function(_0x371e4d){if(_0x371e4d){_0x2127ab=_0x371e4d;var _0x17d367=_[_0x33de('0x84')](_0x371e4d,function(_0x21a70f){var _0x5e11f1=_0x21a70f[_0x33de('0x54')]({'plain':!![]});return _0x5e11f1[_0x33de('0x80')];});return db[_0x33de('0x33')][_0x33de('0x4e')]({'where':{'id':_0x24af54[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](function(_0x5120f5){return db[_0x33de('0x85')][_0x33de('0x52')](function(_0x51b000){return _0x5120f5[_0x33de('0x7f')](_0x5ce00e,{'transaction':_0x51b000})[_0x33de('0x28')](function(){return BPromise[_0x33de('0x86')](_0x2127ab,function(_0x131d87){return db[_0x33de('0x87')][_0x33de('0x88')]({'TeamId':_0x131d87['id'],'VoicePrefixId':_0x24af54[_0x33de('0x4f')]['id']},{'transaction':_0x51b000});});})['then'](function(){return BPromise['each'](_0x17d367,function(_0x446257){return db[_0x33de('0x89')]['findOrCreate']({'where':{'UserId':_0x446257['id'],'VoicePrefixId':_0x24af54[_0x33de('0x4f')]['id']},'transaction':_0x51b000});});})[_0x33de('0x28')](function(){_0x17d367[_0x33de('0x8a')](function(_0xf06806){socket[_0x33de('0x79')]('userVoicePrefix:save',{'UserId':_0xf06806['id'],'VoicePrefixId':_0x5120f5['id']});});});});});}})[_0x33de('0x28')](respondWithStatusCode(_0x2baee6,null))[_0x33de('0x4a')](handleError(_0x2baee6,null));};exports[_0x33de('0x8b')]=function(_0x1f5872,_0x38d880,_0x40758b){return db[_0x33de('0x7d')][_0x33de('0x48')]({'where':{'id':_0x1f5872[_0x33de('0x36')][_0x33de('0x73')]},'attributes':['id'],'include':[{'model':db[_0x33de('0x7c')],'as':_0x33de('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x38d880,null))[_0x33de('0x28')](function(_0xd41b76){var _0x24fa73=_['map'](_0xd41b76,'id');var _0x93313d=[];var _0x3c854d=[];var _0x3e00b7=squel['select']();_0x3e00b7['field'](_0x33de('0x8c'))['from'](_0x33de('0x8d'),'tq')[_0x33de('0x8e')](_0x33de('0x8f'),'ut',_0x33de('0x90'))[_0x33de('0x40')](_0x33de('0x91'),_0x1f5872[_0x33de('0x4f')]['id']);for(var _0x23b8e9=0x0;_0x23b8e9<_0xd41b76[_0x33de('0x3b')];_0x23b8e9+=0x1){let _0x64836b=_0xd41b76[_0x23b8e9];for(var _0x72b745=0x0;_0x72b745<_0x64836b[_0x33de('0x80')]['length'];_0x72b745+=0x1){let _0x4eacef=_0x64836b[_0x33de('0x80')][_0x72b745];var _0x13cd17=_0x3e00b7[_0x33de('0x92')]();_0x13cd17[_0x33de('0x40')]('ut.UserId\x20=\x20?',_0x4eacef['id']);_0x3c854d[_0x33de('0x6d')](db['sequelize']['query'](_0x13cd17[_0x33de('0x93')](),{'type':db[_0x33de('0x85')][_0x33de('0x94')][_0x33de('0x95')]})[_0x33de('0x28')](function(_0x251b71){if(_0x251b71['length']===0x1){return _0x4eacef['id'];}else{var _0x341b23=_[_0x33de('0x96')](_[_0x33de('0x32')](_0x251b71,_0x33de('0x97')),function(_0x29eda7){return _[_0x33de('0x98')](_0x24fa73,_0x29eda7);});if(_0x341b23){return _0x4eacef['id'];}}}));}}return BPromise[_0x33de('0x99')](_0x3c854d)['then'](function(_0x572532){_0x93313d=_(_0x93313d)[_0x33de('0x9a')](_0x572532)[_0x33de('0x9b')]()[_0x33de('0x9c')]();return db[_0x33de('0x33')]['find']({'where':{'id':_0x1f5872[_0x33de('0x4f')]['id']}})[_0x33de('0x28')](function(_0x24edf8){return db['sequelize'][_0x33de('0x52')](function(_0x1ad90f){return _0x24edf8['removeTeams'](_0x1f5872['query'][_0x33de('0x73')],{'transaction':_0x1ad90f})[_0x33de('0x28')](function(){if(!_[_0x33de('0x9d')](_0x93313d)){return _0x24edf8['removeAgents'](_0x93313d,{'transaction':_0x1ad90f});}})[_0x33de('0x28')](function(){_0x93313d[_0x33de('0x8a')](function(_0x4d56df){socket[_0x33de('0x79')](_0x33de('0x78'),{'UserId':_0x4d56df,'VoicePrefixId':_0x24edf8['id']});});});});});});})['then'](respondWithStatusCode(_0x38d880,null))['catch'](handleError(_0x38d880,null));}; \ No newline at end of file +var _0x955f=['online','voicePause','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','keys','find','catch','describe','sequelize','transaction','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','Agents'];(function(_0x4f74d7,_0x4ad22e){var _0x1c6d5c=function(_0x45b1c7){while(--_0x45b1c7){_0x4f74d7['push'](_0x4f74d7['shift']());}};_0x1c6d5c(++_0x4ad22e);}(_0x955f,0x1eb));var _0xf955=function(_0x3fa36f,_0x446aba){_0x3fa36f=_0x3fa36f-0x0;var _0x2dcef4=_0x955f[_0x3fa36f];return _0x2dcef4;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];config['redis']=_[_0xf955('0x17')](config['redis'],{'host':_0xf955('0x18'),'port':0x18eb});var socket=require(_0xf955('0x19'))(new Redis(config[_0xf955('0x1a')]));require(_0xf955('0x1b'))[_0xf955('0x1c')](socket);function respondWithStatusCode(_0x341b8c,_0x1c3235){_0x1c3235=_0x1c3235||0xcc;return function(_0x2783f2){if(_0x2783f2){return _0x341b8c[_0xf955('0x1d')](_0x1c3235);}return _0x341b8c[_0xf955('0x1e')](_0x1c3235)['end']();};}function respondWithResult(_0xc29b35,_0x54e60b){_0x54e60b=_0x54e60b||0xc8;return function(_0x3139d5){if(_0x3139d5){return _0xc29b35[_0xf955('0x1e')](_0x54e60b)[_0xf955('0x1f')](_0x3139d5);}};}function respondWithFilteredResult(_0x15c07c,_0x50930d){return function(_0x5ac6cb){if(_0x5ac6cb){var _0x1e20d1=typeof _0x50930d[_0xf955('0x20')]===_0xf955('0x21')&&typeof _0x50930d['limit']===_0xf955('0x21');var _0x3576fa=_0x5ac6cb[_0xf955('0x22')];var _0x3f960e=_0x1e20d1?0x0:_0x50930d[_0xf955('0x20')];var _0x5f4d9a=_0x1e20d1?_0x5ac6cb[_0xf955('0x22')]:_0x50930d[_0xf955('0x20')]+_0x50930d[_0xf955('0x23')];var _0x488d04;if(_0x5f4d9a>=_0x3576fa){_0x5f4d9a=_0x3576fa;_0x488d04=0xc8;}else{_0x488d04=0xce;}_0x15c07c[_0xf955('0x1e')](_0x488d04);return _0x15c07c['set'](_0xf955('0x24'),_0x3f960e+'-'+_0x5f4d9a+'/'+_0x3576fa)[_0xf955('0x1f')](_0x5ac6cb);}return null;};}function patchUpdates(_0x37143d){return function(_0xa4ebb4){try{jsonpatch[_0xf955('0x25')](_0xa4ebb4,_0x37143d,!![]);}catch(_0x565641){return BPromise[_0xf955('0x26')](_0x565641);}return _0xa4ebb4[_0xf955('0x27')]();};}function saveUpdates(_0x3585c7,_0x13a1a7){return function(_0x17dec2){if(_0x17dec2){return _0x17dec2[_0xf955('0x28')](_0x3585c7)[_0xf955('0x29')](function(_0x552cf3){return _0x552cf3;});}return null;};}function removeEntity(_0x18f435,_0x1acf33){return function(_0xba8a22){if(_0xba8a22){return _0xba8a22[_0xf955('0x2a')]()[_0xf955('0x29')](function(){var _0x13a86d=_0xba8a22[_0xf955('0x2b')]({'plain':!![]});var _0x51f3ab=_0xf955('0x2c');return db[_0xf955('0x2d')][_0xf955('0x2a')]({'where':{'type':_0x51f3ab,'resourceId':_0x13a86d['id']}})[_0xf955('0x29')](function(){return _0xba8a22;});})[_0xf955('0x29')](function(){_0x18f435[_0xf955('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2232a7,_0x1e5d37){return function(_0x4ec3e8){if(!_0x4ec3e8){_0x2232a7[_0xf955('0x1d')](0x194);}return _0x4ec3e8;};}function handleError(_0x2c8df1,_0xf3c870){_0xf3c870=_0xf3c870||0x1f4;return function(_0x1ef794){logger['error'](_0x1ef794[_0xf955('0x2e')]);if(_0x1ef794['name']){delete _0x1ef794[_0xf955('0x2f')];}_0x2c8df1[_0xf955('0x1e')](_0xf3c870)[_0xf955('0x30')](_0x1ef794);};}exports[_0xf955('0x31')]=function(_0x1e8024,_0x32121b){var _0xd5dfb0={},_0x366b6d={},_0x483a12={'count':0x0,'rows':[]};var _0x45e913=_[_0xf955('0x32')](db[_0xf955('0x33')][_0xf955('0x34')],function(_0x4fea0c){return{'name':_0x4fea0c[_0xf955('0x35')],'type':_0x4fea0c[_0xf955('0x36')][_0xf955('0x37')]};});_0x366b6d[_0xf955('0x38')]=_[_0xf955('0x32')](_0x45e913,'name');_0x366b6d['query']=_['keys'](_0x1e8024[_0xf955('0x39')]);_0x366b6d[_0xf955('0x3a')]=_[_0xf955('0x3b')](_0x366b6d[_0xf955('0x38')],_0x366b6d[_0xf955('0x39')]);_0xd5dfb0[_0xf955('0x3c')]=_['intersection'](_0x366b6d[_0xf955('0x38')],qs['fields'](_0x1e8024[_0xf955('0x39')][_0xf955('0x3d')]));_0xd5dfb0[_0xf955('0x3c')]=_0xd5dfb0['attributes'][_0xf955('0x3e')]?_0xd5dfb0['attributes']:_0x366b6d[_0xf955('0x38')];if(!_0x1e8024[_0xf955('0x39')][_0xf955('0x3f')](_0xf955('0x40'))){_0xd5dfb0['limit']=qs[_0xf955('0x23')](_0x1e8024[_0xf955('0x39')]['limit']);_0xd5dfb0[_0xf955('0x20')]=qs[_0xf955('0x20')](_0x1e8024[_0xf955('0x39')]['offset']);}_0xd5dfb0[_0xf955('0x41')]=qs[_0xf955('0x42')](_0x1e8024[_0xf955('0x39')]['sort']);_0xd5dfb0[_0xf955('0x43')]=qs[_0xf955('0x3a')](_[_0xf955('0x44')](_0x1e8024[_0xf955('0x39')],_0x366b6d[_0xf955('0x3a')]),_0x45e913);if(_0x1e8024[_0xf955('0x39')][_0xf955('0x45')]){_0xd5dfb0[_0xf955('0x43')]=_['merge'](_0xd5dfb0[_0xf955('0x43')],{'$or':_[_0xf955('0x32')](_0x45e913,function(_0x2aacdf){if(_0x2aacdf[_0xf955('0x36')]!==_0xf955('0x46')){var _0x13e57d={};_0x13e57d[_0x2aacdf[_0xf955('0x2f')]]={'$like':'%'+_0x1e8024[_0xf955('0x39')][_0xf955('0x45')]+'%'};return _0x13e57d;}})});}_0xd5dfb0=_[_0xf955('0x47')]({},_0xd5dfb0,_0x1e8024[_0xf955('0x48')]);var _0x1c72b8={'where':_0xd5dfb0[_0xf955('0x43')]};return db[_0xf955('0x33')][_0xf955('0x22')](_0x1c72b8)[_0xf955('0x29')](function(_0x356ec2){_0x483a12[_0xf955('0x22')]=_0x356ec2;if(_0x1e8024[_0xf955('0x39')]['includeAll']){_0xd5dfb0[_0xf955('0x49')]=[{'all':!![]}];}return db[_0xf955('0x33')][_0xf955('0x4a')](_0xd5dfb0);})['then'](function(_0x16fc1a){_0x483a12['rows']=_0x16fc1a;return _0x483a12;})[_0xf955('0x29')](respondWithFilteredResult(_0x32121b,_0xd5dfb0))['catch'](handleError(_0x32121b,null));};exports[_0xf955('0x4b')]=function(_0x24cb74,_0x213136){var _0x21ddf0={'raw':![],'where':{'id':_0x24cb74[_0xf955('0x4c')]['id']}},_0x50b209={};_0x50b209[_0xf955('0x38')]=_[_0xf955('0x4d')](db['VoicePrefix']['rawAttributes']);_0x50b209[_0xf955('0x39')]=_[_0xf955('0x4d')](_0x24cb74[_0xf955('0x39')]);_0x50b209[_0xf955('0x3a')]=_['intersection'](_0x50b209[_0xf955('0x38')],_0x50b209[_0xf955('0x39')]);_0x21ddf0[_0xf955('0x3c')]=_['intersection'](_0x50b209[_0xf955('0x38')],qs['fields'](_0x24cb74[_0xf955('0x39')][_0xf955('0x3d')]));_0x21ddf0[_0xf955('0x3c')]=_0x21ddf0['attributes'][_0xf955('0x3e')]?_0x21ddf0[_0xf955('0x3c')]:_0x50b209[_0xf955('0x38')];if(_0x24cb74[_0xf955('0x39')]['includeAll']){_0x21ddf0[_0xf955('0x49')]=[{'all':!![]}];}_0x21ddf0=_[_0xf955('0x47')]({},_0x21ddf0,_0x24cb74[_0xf955('0x48')]);return db[_0xf955('0x33')][_0xf955('0x4e')](_0x21ddf0)['then'](handleEntityNotFound(_0x213136,null))[_0xf955('0x29')](respondWithResult(_0x213136,null))['catch'](handleError(_0x213136,null));};exports[_0xf955('0x2a')]=function(_0x5b5621,_0x38edc7){return db['VoicePrefix']['find']({'where':{'id':_0x5b5621[_0xf955('0x4c')]['id']}})[_0xf955('0x29')](handleEntityNotFound(_0x38edc7,null))['then'](removeEntity(_0x38edc7,null))[_0xf955('0x4f')](handleError(_0x38edc7,null));};exports['describe']=function(_0x488fcd,_0x4c2977){return db['VoicePrefix'][_0xf955('0x50')]()[_0xf955('0x29')](respondWithResult(_0x4c2977,null))['catch'](handleError(_0x4c2977,null));};exports['create']=function(_0x171609,_0x17fc93){var _0x460052;return db[_0xf955('0x51')][_0xf955('0x52')](function(_0xa56483){return db[_0xf955('0x33')][_0xf955('0x53')](_0x171609[_0xf955('0x54')],{'transaction':_0xa56483})[_0xf955('0x29')](function(_0x1b7b73){_0x460052=_0x1b7b73[_0xf955('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0xf955('0x4e')]({'where':{'id':_0x460052[_0xf955('0x55')]},'raw':!![]})[_0xf955('0x29')](function(_0x24322a){return createVoicePrefixExtensions(_0x460052,_0x24322a,_0xa56483);});});})[_0xf955('0x29')](function(){var _0x4dc34b=_0x171609[_0xf955('0x56')][_0xf955('0x2b')]({'plain':!![]});if(!_0x4dc34b)throw new Error(_0xf955('0x57'));if(_0x4dc34b[_0xf955('0x58')]===_0xf955('0x56')){var _0x9057df=_0x460052;return db[_0xf955('0x59')][_0xf955('0x4e')]({'where':{'name':_0xf955('0x2c'),'userProfileId':_0x4dc34b[_0xf955('0x5a')]},'raw':!![]})['then'](function(_0x19a455){if(_0x19a455&&_0x19a455[_0xf955('0x5b')]===0x0){return db[_0xf955('0x2d')][_0xf955('0x53')]({'name':_0x9057df[_0xf955('0x2f')],'resourceId':_0x9057df['id'],'type':_0x19a455[_0xf955('0x2f')],'sectionId':_0x19a455['id']},{})[_0xf955('0x29')](function(){return _0x460052;});}else{return _0x460052;}})[_0xf955('0x4f')](function(_0x948963){logger[_0xf955('0x5c')](_0xf955('0x5d'),_0x948963);throw _0x948963;});}return _0x460052;})[_0xf955('0x29')](respondWithResult(_0x17fc93,null))['catch'](handleError(_0x17fc93,null));};function Extension(_0x1388a0,_0x452de9,_0x381cf0,_0x3eb727){this[_0xf955('0x5e')]=_0xf955('0x5f');this[_0xf955('0x60')]=_0x1388a0;this['app']=_0x381cf0;this['type']='system';this[_0xf955('0x61')]='Voice\x20Prefix\x20Extension';this['priority']=_0x452de9;this[_0xf955('0x62')]=_0x3eb727;}function createVoicePrefixExtensions(_0x533e0f,_0x10535d,_0x3fa5b5){return new BPromise(function(_0x158469,_0x30cb80){var _0x4c88ae=new Extension(formatPrefixName(_0x533e0f[_0xf955('0x63')]),0x1,_0xf955('0x64'),_0xf955('0x65'));_0x4c88ae[_0xf955('0x66')]=_0x533e0f['id'];return db[_0xf955('0x67')]['create'](_0x4c88ae,{'transaction':_0x3fa5b5})[_0xf955('0x29')](function(_0x5990d7){var _0x18905b=_0x5990d7[_0xf955('0x2b')]({'plain':!![]});var _0x3adee7=_['map'](addVoicePrefixExtensions(_0x533e0f,_0x10535d),function(_0x39aaed){_0x39aaed[_0xf955('0x55')]=_0x18905b['id'];_0x39aaed[_0xf955('0x66')]=_0x533e0f['id'];return _0x39aaed;});return db[_0xf955('0x67')][_0xf955('0x68')](_0x3adee7,{'transaction':_0x3fa5b5})[_0xf955('0x29')](function(_0x3761f2){if(!_0x3761f2){return _0x30cb80('Extensions\x20creation\x20failed');}else{return _0x158469(_0x3761f2);}})['catch'](function(_0x1bf4ac){return _0x30cb80(_0x1bf4ac);});});;});};function addVoicePrefixExtensions(_0x2d29a0,_0x3390f3){var _0x3f0873=[];var _0xab5eed=formatPrefixName(_0x2d29a0[_0xf955('0x63')]);_0x3f0873[_0xf955('0x69')](new Extension(_0xab5eed,0x2,_0xf955('0x6a'),_0xf955('0x6b')+_0x2d29a0[_0xf955('0x2f')]));if(_0x2d29a0[_0xf955('0x6c')]){_0x3f0873['push'](new Extension(_0xab5eed,0x3,_0xf955('0x6a'),'PREFIX-CALLERIDALL='+_0x2d29a0[_0xf955('0x6c')]));}else{_0x3f0873['push'](new Extension(_0xab5eed,0x3,'NoOp',_0xf955('0x6d')));}_0x3f0873[_0xf955('0x69')](new Extension(_0xab5eed,0x4,'goto',_0x3390f3[_0xf955('0x5e')]+','+_0xf955('0x6e')+(0x8+_0x2d29a0['name']['length'])+'}'+','+0x1));return _0x3f0873;}function formatPrefixName(_0x1e418){var _0xdf351a='_';for(var _0x46f0e2=0x0;_0x46f0e2<_0x1e418['length'];_0x46f0e2++){if(_0x1e418[_0xf955('0x6f')](_0x46f0e2)=='-'){_0xdf351a+=_0x1e418[_0xf955('0x6f')](_0x46f0e2);}else{_0xdf351a+='['+_0x1e418[_0xf955('0x6f')](_0x46f0e2)+']';}}_0xdf351a+='.';return _0xdf351a;}exports[_0xf955('0x28')]=function(_0x38461c,_0x2c2911,_0x260581){var _0xf1e40b=_0x38461c['body'];_0xf1e40b[_0xf955('0x63')]=_0xf955('0x70')+_0xf1e40b['name']+'-';return db[_0xf955('0x51')][_0xf955('0x52')](function(_0x54dac){return db[_0xf955('0x33')]['update'](_0xf1e40b,{'where':{'id':_0xf1e40b['id']},'transaction':_0x54dac})[_0xf955('0x29')](function(){return db[_0xf955('0x67')]['destroy']({'where':{'VoicePrefixId':_0xf1e40b['id']},'transaction':_0x54dac})['then'](function(){return db[_0xf955('0x67')][_0xf955('0x4e')]({'where':{'id':_0xf1e40b[_0xf955('0x55')]},'raw':!![]})[_0xf955('0x29')](function(_0x4de03b){return createVoicePrefixExtensions(_0xf1e40b,_0x4de03b,_0x54dac);});});});})[_0xf955('0x29')](function(){return db[_0xf955('0x33')][_0xf955('0x71')](_0xf1e40b['id']);})[_0xf955('0x29')](respondWithResult(_0x2c2911,null))[_0xf955('0x4f')](handleError(_0x2c2911,null));};exports[_0xf955('0x72')]=function(_0x403876,_0x4635e6,_0x61b1ef){return db[_0xf955('0x33')][_0xf955('0x4e')]({'where':{'id':_0x403876[_0xf955('0x4c')]['id']}})[_0xf955('0x29')](handleEntityNotFound(_0x4635e6,null))['then'](function(_0x1af54a){if(_0x1af54a){return _0x1af54a[_0xf955('0x72')](_0x403876[_0xf955('0x54')][_0xf955('0x73')],_['omit'](_0x403876[_0xf955('0x54')],[_0xf955('0x73'),'id'])||{})[_0xf955('0x74')](function(_0x8bdcf2){for(var _0x2b266d=0x0;_0x2b266d<_0x403876[_0xf955('0x54')][_0xf955('0x73')][_0xf955('0x3e')];_0x2b266d+=0x1){socket[_0xf955('0x75')](_0xf955('0x76'),{'UserId':Number(_0x403876[_0xf955('0x54')]['ids'][_0x2b266d]),'VoicePrefixId':Number(_0x403876[_0xf955('0x4c')]['id'])});}return _0x8bdcf2;});}})[_0xf955('0x29')](respondWithResult(_0x4635e6,null))[_0xf955('0x4f')](handleError(_0x4635e6,null));};exports[_0xf955('0x77')]=function(_0x33aa10,_0xaeaffb,_0x1cd55b){return db['VoicePrefix'][_0xf955('0x4e')]({'where':{'id':_0x33aa10['params']['id']}})[_0xf955('0x29')](handleEntityNotFound(_0xaeaffb,null))['then'](function(_0x1a61d9){if(_0x1a61d9){return _0x1a61d9[_0xf955('0x77')](_0x33aa10[_0xf955('0x39')][_0xf955('0x73')])[_0xf955('0x29')](function(){if(_[_0xf955('0x78')](_0x33aa10['query'][_0xf955('0x73')])){for(var _0x2b0c75=0x0;_0x2b0c75<_0x33aa10[_0xf955('0x39')]['ids']['length'];_0x2b0c75+=0x1){socket[_0xf955('0x75')](_0xf955('0x79'),{'UserId':Number(_0x33aa10[_0xf955('0x39')]['ids'][_0x2b0c75]),'VoicePrefixId':Number(_0x33aa10[_0xf955('0x4c')]['id'])});}}else{socket['emit'](_0xf955('0x79'),{'UserId':Number(_0x33aa10['query'][_0xf955('0x73')]),'VoicePrefixId':Number(_0x33aa10[_0xf955('0x4c')]['id'])});}});}})[_0xf955('0x29')](respondWithStatusCode(_0xaeaffb,null))['catch'](handleError(_0xaeaffb,null));};exports[_0xf955('0x7a')]=function(_0x397f7e,_0x2cd1bd,_0x521227){var _0xba62d0={};var _0x441a9c={};var _0x126cb5;var _0x3d796b;return db[_0xf955('0x33')][_0xf955('0x7b')]({'where':{'id':_0x397f7e[_0xf955('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2cd1bd,null))[_0xf955('0x29')](function(_0x1e0882){if(_0x1e0882){_0x126cb5=_0x1e0882;_0x441a9c[_0xf955('0x38')]=_[_0xf955('0x4d')](db[_0xf955('0x7c')]['rawAttributes']);_0x441a9c[_0xf955('0x39')]=_[_0xf955('0x4d')](_0x397f7e['query']);_0x441a9c['filters']=_[_0xf955('0x3b')](_0x441a9c[_0xf955('0x38')],_0x441a9c[_0xf955('0x39')]);_0xba62d0[_0xf955('0x3c')]=_['intersection'](_0x441a9c[_0xf955('0x38')],qs['fields'](_0x397f7e['query'][_0xf955('0x3d')]));_0xba62d0[_0xf955('0x3c')]=_0xba62d0['attributes']['length']?_0xba62d0[_0xf955('0x3c')]:_0x441a9c[_0xf955('0x38')];_0xba62d0[_0xf955('0x41')]=qs['sort'](_0x397f7e['query'][_0xf955('0x42')]);_0xba62d0[_0xf955('0x43')]=qs[_0xf955('0x3a')](_['pick'](_0x397f7e['query'],_0x441a9c['filters']));if(_0x397f7e['query'][_0xf955('0x45')]){_0xba62d0['where']=_[_0xf955('0x47')](_0xba62d0[_0xf955('0x43')],{'$or':_[_0xf955('0x32')](_0xba62d0[_0xf955('0x3c')],function(_0x325f2e){var _0x5e8f32={};_0x5e8f32[_0x325f2e]={'$like':'%'+_0x397f7e[_0xf955('0x39')][_0xf955('0x45')]+'%'};return _0x5e8f32;})});}_0xba62d0=_[_0xf955('0x47')]({},_0xba62d0,_0x397f7e[_0xf955('0x48')]);return _0x126cb5['getAgents'](_0xba62d0);}})[_0xf955('0x29')](function(_0x2737c6){if(_0x2737c6){_0x3d796b=_0x2737c6['length'];if(!_0x397f7e[_0xf955('0x39')][_0xf955('0x3f')](_0xf955('0x40'))){_0xba62d0[_0xf955('0x23')]=qs[_0xf955('0x23')](_0x397f7e[_0xf955('0x39')]['limit']);_0xba62d0['offset']=qs[_0xf955('0x20')](_0x397f7e['query'][_0xf955('0x20')]);}return _0x126cb5[_0xf955('0x7a')](_0xba62d0);}})[_0xf955('0x29')](function(_0x95cc72){if(_0x95cc72){return _0x95cc72?{'count':_0x3d796b,'rows':_0x95cc72}:null;}})['then'](respondWithResult(_0x2cd1bd,null))['catch'](handleError(_0x2cd1bd,null));};exports[_0xf955('0x7d')]=function(_0x12b9f8,_0x20a220,_0x25319c){var _0xee52ad={};var _0x4b2c01={};var _0x21f45e;var _0x132c80;return db[_0xf955('0x33')][_0xf955('0x7b')]({'where':{'id':_0x12b9f8['params']['id']}})['then'](handleEntityNotFound(_0x20a220,null))[_0xf955('0x29')](function(_0x14123e){if(_0x14123e){_0x21f45e=_0x14123e;_0x4b2c01['model']=_[_0xf955('0x4d')](db[_0xf955('0x7e')][_0xf955('0x34')]);_0x4b2c01[_0xf955('0x39')]=_['keys'](_0x12b9f8[_0xf955('0x39')]);_0x4b2c01[_0xf955('0x3a')]=_[_0xf955('0x3b')](_0x4b2c01[_0xf955('0x38')],_0x4b2c01[_0xf955('0x39')]);_0xee52ad[_0xf955('0x3c')]=_[_0xf955('0x3b')](_0x4b2c01['model'],qs['fields'](_0x12b9f8['query'][_0xf955('0x3d')]));_0xee52ad[_0xf955('0x3c')]=_0xee52ad[_0xf955('0x3c')][_0xf955('0x3e')]?_0xee52ad[_0xf955('0x3c')]:_0x4b2c01[_0xf955('0x38')];_0xee52ad[_0xf955('0x41')]=qs['sort'](_0x12b9f8[_0xf955('0x39')][_0xf955('0x42')]);_0xee52ad['where']=qs[_0xf955('0x3a')](_[_0xf955('0x44')](_0x12b9f8[_0xf955('0x39')],_0x4b2c01[_0xf955('0x3a')]));if(_0x12b9f8[_0xf955('0x39')][_0xf955('0x45')]){_0xee52ad[_0xf955('0x43')]=_[_0xf955('0x47')](_0xee52ad['where'],{'$or':_['map'](_0xee52ad['attributes'],function(_0x1d3d27){var _0x3945f5={};_0x3945f5[_0x1d3d27]={'$like':'%'+_0x12b9f8[_0xf955('0x39')][_0xf955('0x45')]+'%'};return _0x3945f5;})});}_0xee52ad=_[_0xf955('0x47')]({},_0xee52ad,_0x12b9f8['options']);return _0x21f45e[_0xf955('0x7d')](_0xee52ad);}})[_0xf955('0x29')](function(_0x1d2559){if(_0x1d2559){_0x132c80=_0x1d2559[_0xf955('0x3e')];if(!_0x12b9f8[_0xf955('0x39')][_0xf955('0x3f')](_0xf955('0x40'))){_0xee52ad[_0xf955('0x23')]=qs[_0xf955('0x23')](_0x12b9f8['query'][_0xf955('0x23')]);_0xee52ad['offset']=qs[_0xf955('0x20')](_0x12b9f8[_0xf955('0x39')][_0xf955('0x20')]);}return _0x21f45e[_0xf955('0x7d')](_0xee52ad);}})[_0xf955('0x29')](function(_0x187fb0){if(_0x187fb0){return _0x187fb0?{'count':_0x132c80,'rows':_0x187fb0}:null;}})[_0xf955('0x29')](respondWithResult(_0x20a220,null))['catch'](handleError(_0x20a220,null));};exports[_0xf955('0x7f')]=function(_0x4bb590,_0x222df2,_0x40d7c7){var _0x569eee=_0x4bb590[_0xf955('0x54')][_0xf955('0x73')];var _0x1d3aa1;return db[_0xf955('0x7e')][_0xf955('0x4a')]({'where':{'id':_0x569eee},'attributes':['id'],'include':[{'model':db[_0xf955('0x7c')],'as':_0xf955('0x80'),'attributes':['id','name',_0xf955('0x81'),_0xf955('0x82'),'interface'],'raw':!![]}]})[_0xf955('0x29')](function(_0x3fd8ed){if(_0x3fd8ed){_0x1d3aa1=_0x3fd8ed;var _0x4bbba6=_['flatMap'](_0x3fd8ed,function(_0x356eb0){var _0x314173=_0x356eb0[_0xf955('0x2b')]({'plain':!![]});return _0x314173['Agents'];});return db[_0xf955('0x33')][_0xf955('0x4e')]({'where':{'id':_0x4bb590[_0xf955('0x4c')]['id']}})[_0xf955('0x29')](function(_0x399ffb){return db[_0xf955('0x51')][_0xf955('0x52')](function(_0x8d0c5b){return _0x399ffb[_0xf955('0x7f')](_0x569eee,{'transaction':_0x8d0c5b})[_0xf955('0x29')](function(){return BPromise[_0xf955('0x83')](_0x1d3aa1,function(_0x41fde7){return db[_0xf955('0x84')][_0xf955('0x85')]({'TeamId':_0x41fde7['id'],'VoicePrefixId':_0x4bb590['params']['id']},{'transaction':_0x8d0c5b});});})['then'](function(){return BPromise[_0xf955('0x83')](_0x4bbba6,function(_0xc7cc7b){return db[_0xf955('0x86')][_0xf955('0x87')]({'where':{'UserId':_0xc7cc7b['id'],'VoicePrefixId':_0x4bb590[_0xf955('0x4c')]['id']},'transaction':_0x8d0c5b});});})['then'](function(){_0x4bbba6[_0xf955('0x88')](function(_0x3bab0d){socket['emit'](_0xf955('0x76'),{'UserId':_0x3bab0d['id'],'VoicePrefixId':_0x399ffb['id']});});});});});}})[_0xf955('0x29')](respondWithStatusCode(_0x222df2,null))[_0xf955('0x4f')](handleError(_0x222df2,null));};exports[_0xf955('0x89')]=function(_0x5a20d4,_0x3cc61c,_0x588a0f){return db[_0xf955('0x7e')][_0xf955('0x4a')]({'where':{'id':_0x5a20d4[_0xf955('0x39')][_0xf955('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf955('0x80'),'attributes':['id'],'raw':!![]}]})[_0xf955('0x29')](handleEntityNotFound(_0x3cc61c,null))[_0xf955('0x29')](function(_0x1c75cc){var _0x340089=_['map'](_0x1c75cc,'id');var _0x12e6aa=[];var _0x1f38db=[];var _0x395013=squel['select']();_0x395013[_0xf955('0x8a')](_0xf955('0x8b'))[_0xf955('0x8c')](_0xf955('0x8d'),'tq')[_0xf955('0x8e')](_0xf955('0x8f'),'ut',_0xf955('0x90'))['where']('VoicePrefixId\x20=\x20?',_0x5a20d4['params']['id']);for(var _0x345a7c=0x0;_0x345a7c<_0x1c75cc[_0xf955('0x3e')];_0x345a7c+=0x1){let _0x57fef3=_0x1c75cc[_0x345a7c];for(var _0x476e81=0x0;_0x476e81<_0x57fef3[_0xf955('0x80')][_0xf955('0x3e')];_0x476e81+=0x1){let _0x5397e4=_0x57fef3[_0xf955('0x80')][_0x476e81];var _0x31c26a=_0x395013['clone']();_0x31c26a['where'](_0xf955('0x91'),_0x5397e4['id']);_0x1f38db[_0xf955('0x69')](db[_0xf955('0x51')][_0xf955('0x39')](_0x31c26a[_0xf955('0x92')](),{'type':db['sequelize'][_0xf955('0x93')][_0xf955('0x94')]})[_0xf955('0x29')](function(_0x38935f){if(_0x38935f[_0xf955('0x3e')]===0x1){return _0x5397e4['id'];}else{var _0x480d95=_[_0xf955('0x95')](_[_0xf955('0x32')](_0x38935f,_0xf955('0x96')),function(_0x22cf11){return _['includes'](_0x340089,_0x22cf11);});if(_0x480d95){return _0x5397e4['id'];}}}));}}return BPromise[_0xf955('0x97')](_0x1f38db)[_0xf955('0x29')](function(_0x723d5e){_0x12e6aa=_(_0x12e6aa)[_0xf955('0x98')](_0x723d5e)[_0xf955('0x99')]()['value']();return db[_0xf955('0x33')][_0xf955('0x4e')]({'where':{'id':_0x5a20d4['params']['id']}})[_0xf955('0x29')](function(_0x38e078){return db[_0xf955('0x51')][_0xf955('0x52')](function(_0x19df1c){return _0x38e078[_0xf955('0x89')](_0x5a20d4[_0xf955('0x39')][_0xf955('0x73')],{'transaction':_0x19df1c})[_0xf955('0x29')](function(){if(!_[_0xf955('0x9a')](_0x12e6aa)){return _0x38e078['removeAgents'](_0x12e6aa,{'transaction':_0x19df1c});}})['then'](function(){_0x12e6aa[_0xf955('0x88')](function(_0x161a62){socket[_0xf955('0x75')](_0xf955('0x79'),{'UserId':_0x161a62,'VoicePrefixId':_0x38e078['id']});});});});});});})['then'](respondWithStatusCode(_0x3cc61c,null))[_0xf955('0x4f')](handleError(_0x3cc61c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 976f0c1..74193f4 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb425=['events','VoicePrefix','save','update','remove','hasOwnProperty','hook'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xb425,0x157));var _0x5b42=function(_0x1f525f,_0x2be89c){_0x1f525f=_0x1f525f-0x0;var _0x4a0b5f=_0xb425[_0x1f525f];return _0x4a0b5f;};'use strict';var EventEmitter=require(_0x5b42('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x5b42('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b42('0x2'),'afterUpdate':_0x5b42('0x3'),'afterDestroy':_0x5b42('0x4')};function emitEvent(_0x405119){return function(_0x346255,_0x1c3d0c,_0x4eb898){VoicePrefixEvents['emit'](_0x405119+':'+_0x346255['id'],_0x346255);VoicePrefixEvents['emit'](_0x405119,_0x346255);_0x4eb898(null);};}for(var e in events){if(events[_0x5b42('0x5')](e)){var event=events[e];VoicePrefix[_0x5b42('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x12b8=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12b8,0x10d));var _0x812b=function(_0x53a0e4,_0x59fb74){_0x53a0e4=_0x53a0e4-0x0;var _0x248e78=_0x12b8[_0x53a0e4];return _0x248e78;};'use strict';var EventEmitter=require(_0x812b('0x0'));var VoicePrefix=require(_0x812b('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x812b('0x2')](0x0);var events={'afterCreate':_0x812b('0x3'),'afterUpdate':_0x812b('0x4'),'afterDestroy':_0x812b('0x5')};function emitEvent(_0x521d3a){return function(_0x42626d,_0x48c0a5,_0x2b201f){VoicePrefixEvents[_0x812b('0x6')](_0x521d3a+':'+_0x42626d['id'],_0x42626d);VoicePrefixEvents['emit'](_0x521d3a,_0x42626d);_0x2b201f(null);};}for(var e in events){if(events[_0x812b('0x7')](e)){var event=events[e];VoicePrefix[_0x812b('0x8')](e,emitEvent(event));}}module[_0x812b('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index c20bd0b..22f6e89 100644 --- a/server/api/voicePrefix/voicePrefix.model.js +++ b/server/api/voicePrefix/voicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf105=['request-promise','rimraf','../../config/environment','VoicePrefix','util','moment','bluebird'];(function(_0x471826,_0x1f70d1){var _0x572fd6=function(_0x164be7){while(--_0x164be7){_0x471826['push'](_0x471826['shift']());}};_0x572fd6(++_0x1f70d1);}(_0xf105,0x17e));var _0x5f10=function(_0x4be9a7,_0x48e6cb){_0x4be9a7=_0x4be9a7-0x0;var _0x344018=_0xf105[_0x4be9a7];return _0x344018;};'use strict';var _=require('lodash');var util=require(_0x5f10('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5f10('0x1'));var BPromise=require(_0x5f10('0x2'));var rp=require(_0x5f10('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f10('0x4'));var config=require(_0x5f10('0x5'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x19517e,_0x25f473){return _0x19517e['define'](_0x5f10('0x6'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dad=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9dad,0x143));var _0xd9da=function(_0x5dc463,_0x195d98){_0x5dc463=_0x5dc463-0x0;var _0x5b558c=_0x9dad[_0x5dc463];return _0x5b558c;};'use strict';var _=require(_0xd9da('0x0'));var util=require(_0xd9da('0x1'));var logger=require('../../config/logger')(_0xd9da('0x2'));var moment=require(_0xd9da('0x3'));var BPromise=require(_0xd9da('0x4'));var rp=require(_0xd9da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9da('0x6'));var config=require(_0xd9da('0x7'));var attributes=require(_0xd9da('0x8'));module[_0xd9da('0x9')]=function(_0x101133,_0x1d9c1b){return _0x101133[_0xd9da('0xa')]('VoicePrefix',attributes,{'tableName':_0xd9da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 8ba1721..0c2eec1 100644 --- a/server/api/voicePrefix/voicePrefix.rpc.js +++ b/server/api/voicePrefix/voicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa37=['VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info'];(function(_0x200fcb,_0x4cacfd){var _0x466b22=function(_0x66969f){while(--_0x66969f){_0x200fcb['push'](_0x200fcb['shift']());}};_0x466b22(++_0x4cacfd);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xaa37[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var moment=require(_0x7aa3('0x2'));var BPromise=require(_0x7aa3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aa3('0x4'));var db=require(_0x7aa3('0x5'))['db'];var utils=require(_0x7aa3('0x6'));var logger=require(_0x7aa3('0x7'))(_0x7aa3('0x8'));var config=require(_0x7aa3('0x9'));var jayson=require(_0x7aa3('0xa'));var client=jayson['client'][_0x7aa3('0xb')]({'port':0x232a});config[_0x7aa3('0xc')]=_['defaults'](config[_0x7aa3('0xc')],{'host':_0x7aa3('0xd'),'port':0x18eb});var socket=require(_0x7aa3('0xe'))(new Redis(config['redis']));require(_0x7aa3('0xf'))[_0x7aa3('0x10')](socket);function respondWithRpcPromise(_0x321fd3,_0x1725d1,_0x10aa91){return new BPromise(function(_0x67838e,_0x5aa7f2){return client['request'](_0x321fd3,_0x10aa91)[_0x7aa3('0x11')](function(_0x509eb9){logger[_0x7aa3('0x12')](_0x7aa3('0x13'),_0x1725d1,'request\x20sent');logger[_0x7aa3('0x14')](_0x7aa3('0x15'),_0x1725d1,'request\x20sent',JSON['stringify'](_0x509eb9));if(_0x509eb9['error']){if(_0x509eb9[_0x7aa3('0x16')][_0x7aa3('0x17')]===0x1f4){logger[_0x7aa3('0x16')](_0x7aa3('0x13'),_0x1725d1,_0x509eb9[_0x7aa3('0x16')]['message']);return _0x5aa7f2(_0x509eb9[_0x7aa3('0x16')][_0x7aa3('0x18')]);}logger[_0x7aa3('0x16')](_0x7aa3('0x13'),_0x1725d1,_0x509eb9['error']['message']);return _0x67838e(_0x509eb9[_0x7aa3('0x16')]['message']);}else{logger[_0x7aa3('0x12')](_0x7aa3('0x13'),_0x1725d1,'request\x20sent');_0x67838e(_0x509eb9[_0x7aa3('0x19')][_0x7aa3('0x18')]);}})[_0x7aa3('0x1a')](function(_0x357564){logger[_0x7aa3('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x1725d1,_0x357564);_0x5aa7f2(_0x357564);});});} \ No newline at end of file +var _0x4c60=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x4c60,0xc1));var _0x04c6=function(_0x588613,_0x3108c2){_0x588613=_0x588613-0x0;var _0x10b197=_0x4c60[_0x588613];return _0x10b197;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});config[_0x04c6('0x9')]=_[_0x04c6('0xa')](config[_0x04c6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x04c6('0xb'))(new Redis(config[_0x04c6('0x9')]));require(_0x04c6('0xc'))[_0x04c6('0xd')](socket);function respondWithRpcPromise(_0x52a9af,_0x59a98c,_0x5498a9){return new BPromise(function(_0x376da8,_0x5584cd){return client[_0x04c6('0xe')](_0x52a9af,_0x5498a9)[_0x04c6('0xf')](function(_0x5236c8){logger[_0x04c6('0x10')](_0x04c6('0x11'),_0x59a98c,_0x04c6('0x12'));logger[_0x04c6('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x59a98c,_0x04c6('0x12'),JSON[_0x04c6('0x14')](_0x5236c8));if(_0x5236c8[_0x04c6('0x15')]){if(_0x5236c8['error'][_0x04c6('0x16')]===0x1f4){logger[_0x04c6('0x15')](_0x04c6('0x11'),_0x59a98c,_0x5236c8[_0x04c6('0x15')][_0x04c6('0x17')]);return _0x5584cd(_0x5236c8[_0x04c6('0x15')][_0x04c6('0x17')]);}logger[_0x04c6('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x59a98c,_0x5236c8[_0x04c6('0x15')][_0x04c6('0x17')]);return _0x376da8(_0x5236c8[_0x04c6('0x15')][_0x04c6('0x17')]);}else{logger[_0x04c6('0x10')](_0x04c6('0x11'),_0x59a98c,_0x04c6('0x12'));_0x376da8(_0x5236c8[_0x04c6('0x18')]['message']);}})[_0x04c6('0x19')](function(_0x13e472){logger[_0x04c6('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x59a98c,_0x13e472);_0x5584cd(_0x13e472);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index dc7e5fb..3d9b7ae 100644 --- a/server/api/voicePrefix/voicePrefix.socket.js +++ b/server/api/voicePrefix/voicePrefix.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa75b=['removeListener','register','length','voicePrefix:','./voicePrefix.events','update','emit'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa75b,0x170));var _0xba75=function(_0x5be2b9,_0x1b5e11){_0x5be2b9=_0x5be2b9-0x0;var _0x4af585=_0xa75b[_0x5be2b9];return _0x4af585;};'use strict';var VoicePrefixEvents=require(_0xba75('0x0'));var events=['save','remove',_0xba75('0x1')];function createListener(_0x39dc19,_0x17b666){return function(_0x3cde96){_0x17b666[_0xba75('0x2')](_0x39dc19,_0x3cde96);};}function removeListener(_0x336606,_0x152269){return function(){VoicePrefixEvents[_0xba75('0x3')](_0x336606,_0x152269);};}exports[_0xba75('0x4')]=function(_0x41afc9){for(var _0x2baa28=0x0,_0x238a33=events[_0xba75('0x5')];_0x2baa28<_0x238a33;_0x2baa28++){var _0x5c79e3=events[_0x2baa28];var _0x4b842d=createListener(_0xba75('0x6')+_0x5c79e3,_0x41afc9);VoicePrefixEvents['on'](_0x5c79e3,_0x4b842d);}}; \ No newline at end of file +var _0xc577=['./voicePrefix.events','update','emit','register','length'];(function(_0x309807,_0x4aadac){var _0x51b08c=function(_0x2ec6e8){while(--_0x2ec6e8){_0x309807['push'](_0x309807['shift']());}};_0x51b08c(++_0x4aadac);}(_0xc577,0x172));var _0x7c57=function(_0x62cfe,_0x894025){_0x62cfe=_0x62cfe-0x0;var _0x3ecfda=_0xc577[_0x62cfe];return _0x3ecfda;};'use strict';var VoicePrefixEvents=require(_0x7c57('0x0'));var events=['save','remove',_0x7c57('0x1')];function createListener(_0x35af09,_0xe9a500){return function(_0x2a2415){_0xe9a500[_0x7c57('0x2')](_0x35af09,_0x2a2415);};}function removeListener(_0x304922,_0x2ea08b){return function(){VoicePrefixEvents['removeListener'](_0x304922,_0x2ea08b);};}exports[_0x7c57('0x3')]=function(_0x1339b3){for(var _0xf50a9f=0x0,_0x2bc454=events[_0x7c57('0x4')];_0xf50a9f<_0x2bc454;_0xf50a9f++){var _0x4bb81b=events[_0xf50a9f];var _0x4e5cb2=createListener('voicePrefix:'+_0x4bb81b,_0x1339b3);VoicePrefixEvents['on'](_0x4bb81b,_0x4e5cb2);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3e1c8f6..e4da0df 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xb10b,0x12a));var _0xbb10=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0xb10b[_0x33c637];return _0x14aa20;};'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')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x3cfdfc,_0x2a5d3f){var _0x4ab0d4=function(_0x405ecb){while(--_0x405ecb){_0x3cfdfc['push'](_0x3cfdfc['shift']());}};_0x4ab0d4(++_0x2a5d3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index ba89c8a..71f425c 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3f2=['#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','ENUM','inbound','outbound','default','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','getDataValue','dialMethod','booked','roundrobin','includes','strategy','INTEGER','STRING','yes','all','periodic_announce','join','joinempty','leavewhenempty','split','acw','wrapuptime','BOOLEAN','preview','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x3ec69d,_0xf8aade){var _0x394c7e=function(_0x16764b){while(--_0x16764b){_0x3ec69d['push'](_0x3ec69d['shift']());}};_0x394c7e(++_0xf8aade);}(_0xf3f2,0x15e));var _0x2f3f=function(_0x1fff64,_0x5abdd5){_0x1fff64=_0x1fff64-0x0;var _0x46080e=_0xf3f2[_0x1fff64];return _0x46080e;};'use strict';var Sequelize=require('sequelize');module[_0x2f3f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x2'),_0x2f3f('0x3')),'allowNull':![],'defaultValue':_0x2f3f('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x2f3f('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall','leastrecent','fewestcalls',_0x2f3f('0x5'),_0x2f3f('0x6'),_0x2f3f('0x7'),_0x2f3f('0x8'),_0x2f3f('0x9')),'allowNull':![],'defaultValue':_0x2f3f('0xa'),'set':function(_0x57ba71){this[_0x2f3f('0xb')]('strategy',_0x57ba71?_0x57ba71:_0x2f3f('0x6'));},'get':function(){var _0x3c82a3=this[_0x2f3f('0xc')]('type');var _0x2aaf9d=this[_0x2f3f('0xc')](_0x2f3f('0xd'));var _0xe165c7=this['getDataValue']('strategy');if(_0x3c82a3===_0x2f3f('0x3')){if(_0x2aaf9d==='preview'){return null;}if(_0x2aaf9d===_0x2f3f('0xe')&&![_0x2f3f('0x6'),_0x2f3f('0xf')][_0x2f3f('0x10')](_0xe165c7)){this[_0x2f3f('0xb')](_0x2f3f('0x11'),_0x2f3f('0x6'));}}return _0xe165c7;}},'servicelevel':{'type':Sequelize[_0x2f3f('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2f3f('0x12')](0xb)},'timeout':{'type':Sequelize[_0x2f3f('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2f3f('0x13')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2f3f('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x14'),'no'),'defaultValue':_0x2f3f('0x14')},'autopause':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x14'),'no',_0x2f3f('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x2f3f('0x1')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2f3f('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2f3f('0x1')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2f3f('0x1')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x2f3f('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2f3f('0x13')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2f3f('0x13')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2f3f('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2f3f('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2f3f('0x1')]('yes','no'),'defaultValue':_0x2f3f('0x14')},'announce_holdtime':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x2f3f('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x2f3f('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2f3f('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x2f3f('0x13')]},'queue_quantity1':{'type':Sequelize[_0x2f3f('0x13')]},'queue_quantity2':{'type':Sequelize[_0x2f3f('0x13')]},'queue_periodic_announce':{'type':Sequelize[_0x2f3f('0x13')]},'queue_less_than':{'type':Sequelize[_0x2f3f('0x13')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xf29315){this[_0x2f3f('0xb')](_0x2f3f('0x16'),_0xf29315?_0xf29315[_0x2f3f('0x17')](','):[]);},'get':function(){return this[_0x2f3f('0xc')]('periodic_announce')?this[_0x2f3f('0xc')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x2f3f('0x14'),'set':function(_0x109968){this['setDataValue'](_0x2f3f('0x18'),_0x109968?_0x109968[_0x2f3f('0x17')](','):undefined);},'get':function(){return this[_0x2f3f('0xc')](_0x2f3f('0x18'))?this['getDataValue']('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':'no','set':function(_0x32b95d){this['setDataValue'](_0x2f3f('0x19'),_0x32b95d?_0x32b95d[_0x2f3f('0x17')](','):undefined);},'get':function(){return this[_0x2f3f('0xc')](_0x2f3f('0x19'))?this[_0x2f3f('0xc')]('leavewhenempty')[_0x2f3f('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2f3f('0x1')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2f3f('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2f3f('0x13')]},'description':{'type':Sequelize[_0x2f3f('0x13')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0xe788da){this[_0x2f3f('0xb')](_0x2f3f('0x1b'),_0xe788da);if(_0xe788da){if(this[_0x2f3f('0xc')]('wrapuptime')<0x2){this[_0x2f3f('0xb')](_0x2f3f('0x1c'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2f3f('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x2f3f('0x1')](_0x2f3f('0x1e'),'progressive',_0x2f3f('0x1f'),_0x2f3f('0x20'),_0x2f3f('0xe')),'defaultValue':_0x2f3f('0x21'),'comment':_0x2f3f('0x22')},'dialLimitChannel':{'type':Sequelize[_0x2f3f('0x12')](0x4)[_0x2f3f('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2f3f('0x24')},'dialLimitQueue':{'type':Sequelize[_0x2f3f('0x12')](0x4)[_0x2f3f('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2f3f('0x25')},'dialPowerLevel':{'type':Sequelize[_0x2f3f('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2f3f('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x2f3f('0x1')]('agentBusyFactor',_0x2f3f('0x28')),'defaultValue':_0x2f3f('0x28'),'comment':_0x2f3f('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2f3f('0x26')](0x2)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2f3f('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2f3f('0x13')]},'dialOriginateTimeout':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f3f('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':_0x2f3f('0x2c'),'comment':_0x2f3f('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f3f('0x2e')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x2f3f('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2f3f('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f3f('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2f3f('0x12')](0x5)[_0x2f3f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f3f('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2f3f('0x12')](0x5)[_0x2f3f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f3f('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x3,'comment':_0x2f3f('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2f3f('0x12')](0x5)[_0x2f3f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f3f('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2f3f('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x2f3f('0x36')},'dialPrefix':{'type':Sequelize[_0x2f3f('0x13')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x2f3f('0x37'),_0x2f3f('0x38'),_0x2f3f('0x39')),'defaultValue':_0x2f3f('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2f3f('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x2f3f('0x12')](0x9)[_0x2f3f('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2f3f('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x2f3f('0x12')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2f3f('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2f3f('0x12')](0x9)[_0x2f3f('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2f3f('0x12')](0x9)[_0x2f3f('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2f3f('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x2f3f('0x12')](0x9)[_0x2f3f('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2f3f('0x12')](0x9)[_0x2f3f('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2f3f('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2f3f('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2f3f('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2f3f('0x12')](0x9)[_0x2f3f('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2f3f('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x2f3f('0x12')](0x5)[_0x2f3f('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2f3f('0x41')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2f3f('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x2f3f('0x43'),_0x2f3f('0x44')),'defaultValue':_0x2f3f('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x2f3f('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2f3f('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2f3f('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x2f3f('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f3f('0x45')},'dialCutDigit':{'type':Sequelize[_0x2f3f('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f3f('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f3f('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2f3f('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f3f('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f3f('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f3f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f3f('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f3f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f3f('0x4b')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x2f3f('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f3f('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2f3f('0x12')](0x5)[_0x2f3f('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f3f('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2f3f('0x12')],'allowNull':!![],'comment':_0x2f3f('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x2f3f('0x1d')],'defaultValue':![],'comment':_0x2f3f('0x4f'),'set':function(_0x149a81){if(!_0x149a81)this[_0x2f3f('0xb')](_0x2f3f('0x50'),null);this[_0x2f3f('0xb')](_0x2f3f('0x51'),_0x149a81);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x2f3f('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2f3f('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x2f3f('0x12')](0x3)[_0x2f3f('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2f3f('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x41d6=['includes','setDataValue','INTEGER','yes','all','once','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','wrapuptime','preview','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\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','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','inbound','outbound','default','ringall','random','rrmemory','linear','rrordered','strategy','getDataValue','booked','roundrobin'];(function(_0x12492e,_0x433b1b){var _0x54fb29=function(_0x32e0bd){while(--_0x32e0bd){_0x12492e['push'](_0x12492e['shift']());}};_0x54fb29(++_0x433b1b);}(_0x41d6,0x164));var _0x641d=function(_0x2423d7,_0xe6ec57){_0x2423d7=_0x2423d7-0x0;var _0x151d17=_0x41d6[_0x2423d7];return _0x151d17;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x641d('0x0')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x2'),_0x641d('0x3')),'allowNull':![],'defaultValue':_0x641d('0x2')},'musiconhold':{'type':Sequelize[_0x641d('0x0')],'defaultValue':_0x641d('0x4')},'announce':{'type':Sequelize[_0x641d('0x0')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x641d('0x5'),'leastrecent','fewestcalls',_0x641d('0x6'),_0x641d('0x7'),_0x641d('0x8'),'wrandom',_0x641d('0x9')),'allowNull':![],'defaultValue':_0x641d('0x5'),'set':function(_0x46f4db){this['setDataValue'](_0x641d('0xa'),_0x46f4db?_0x46f4db:_0x641d('0x7'));},'get':function(){var _0x5adaad=this[_0x641d('0xb')]('type');var _0x5e9ac9=this['getDataValue']('dialMethod');var _0x237b8a=this[_0x641d('0xb')](_0x641d('0xa'));if(_0x5adaad===_0x641d('0x3')){if(_0x5e9ac9==='preview'){return null;}if(_0x5e9ac9===_0x641d('0xc')&&![_0x641d('0x7'),_0x641d('0xd')][_0x641d('0xe')](_0x237b8a)){this[_0x641d('0xf')]('strategy',_0x641d('0x7'));}}return _0x237b8a;}},'servicelevel':{'type':Sequelize[_0x641d('0x10')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x641d('0x10')](0xb)},'timeout':{'type':Sequelize[_0x641d('0x10')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x641d('0x10')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x641d('0x0')]},'weight':{'type':Sequelize[_0x641d('0x10')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x641d('0x10')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no'),'defaultValue':_0x641d('0x11')},'autopause':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no',_0x641d('0x12')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x641d('0x10')](0xb)},'autopausebusy':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x641d('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x641d('0x10')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x641d('0x1')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no',_0x641d('0x13')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x11'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x641d('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x641d('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x641d('0x0')]},'queue_youarenext':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x641d('0x0')]},'queue_periodic_announce':{'type':Sequelize[_0x641d('0x0')]},'queue_less_than':{'type':Sequelize[_0x641d('0x0')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x394802){this[_0x641d('0xf')](_0x641d('0x14'),_0x394802?_0x394802['join'](','):[]);},'get':function(){return this[_0x641d('0xb')]('periodic_announce')?this[_0x641d('0xb')](_0x641d('0x14'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x641d('0x0')],'defaultValue':'yes','set':function(_0x587bbb){this[_0x641d('0xf')](_0x641d('0x15'),_0x587bbb?_0x587bbb[_0x641d('0x16')](','):undefined);},'get':function(){return this[_0x641d('0xb')](_0x641d('0x15'))?this['getDataValue']('joinempty')[_0x641d('0x17')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x641d('0x0')],'defaultValue':'no','set':function(_0x28a159){this['setDataValue']('leavewhenempty',_0x28a159?_0x28a159['join'](','):undefined);},'get':function(){return this[_0x641d('0xb')](_0x641d('0x18'))?this[_0x641d('0xb')](_0x641d('0x18'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x641d('0x11'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x641d('0x11'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x641d('0x10')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x641d('0x1')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x641d('0x0')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x641d('0x19')],'defaultValue':0x0,'set':function(_0x5cc710){this[_0x641d('0xf')]('acw',_0x5cc710);if(_0x5cc710){if(this[_0x641d('0xb')](_0x641d('0x1a'))<0x2){this['setDataValue'](_0x641d('0x1a'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x641d('0x10')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x641d('0x19')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x1b'),_0x641d('0x1c'),_0x641d('0x1d'),_0x641d('0x1e'),'booked'),'defaultValue':_0x641d('0x1c'),'comment':_0x641d('0x1f')},'dialLimitChannel':{'type':Sequelize[_0x641d('0x10')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x641d('0x20')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x641d('0x21')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x641d('0x20')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x22'),'dropRate'),'defaultValue':_0x641d('0x23'),'comment':_0x641d('0x24')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x641d('0x25')](0x2)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x641d('0x26')},'dialPredictiveInterval':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x641d('0x27')},'dialOriginateCallerIdName':{'type':Sequelize[_0x641d('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x641d('0x28')},'dialQueueOptions':{'type':Sequelize[_0x641d('0x0')],'defaultValue':_0x641d('0x29'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x641d('0x2a')},'dialQueueProject':{'type':Sequelize[_0x641d('0x0')],'comment':_0x641d('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x641d('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x641d('0x10')](0x5)[_0x641d('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x641d('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x641d('0x10')](0x5)[_0x641d('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x641d('0x10')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x641d('0x10')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x641d('0x20')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x641d('0x2e')},'dialTimezone':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x641d('0x0')],'defaultValue':_0x641d('0x2f')},'dialPrefix':{'type':Sequelize[_0x641d('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x641d('0x1')]('always',_0x641d('0x30'),_0x641d('0x31')),'defaultValue':_0x641d('0x32')},'dialAMDActive':{'type':Sequelize[_0x641d('0x19')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x641d('0x10')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x641d('0x33')},'dialAMDGreeting':{'type':Sequelize[_0x641d('0x10')](0x9)[_0x641d('0x20')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x641d('0x10')](0x9)[_0x641d('0x20')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x641d('0x10')](0x9)[_0x641d('0x20')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x641d('0x10')](0x9)[_0x641d('0x20')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x641d('0x34')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x641d('0x35')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x641d('0x10')](0x9)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x641d('0x36')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x641d('0x10')](0x5)[_0x641d('0x20')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x641d('0x37')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x641d('0x10')](0x9)[_0x641d('0x20')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x641d('0x38')},'dialRecallMeTimeout':{'type':Sequelize[_0x641d('0x10')](0x5)[_0x641d('0x20')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x641d('0x39')},'dialRecallInQueue':{'type':Sequelize[_0x641d('0x19')],'defaultValue':0x0,'comment':_0x641d('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x641d('0x1')](_0x641d('0x3b'),_0x641d('0x3c')),'defaultValue':_0x641d('0x3b')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x641d('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x641d('0x19')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x641d('0x19')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x641d('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x641d('0x3d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x641d('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x641d('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x641d('0x10')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x641d('0x10')](0x5)[_0x641d('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x641d('0x3f')},'dialDropMaxRetry':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x641d('0x40')},'dialDropRetryFrequency':{'type':Sequelize[_0x641d('0x10')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x641d('0x41')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x641d('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x641d('0x42')},'dialMachineMaxRetry':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x641d('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x641d('0x43')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x641d('0x44')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x641d('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x641d('0x45')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x641d('0x10')],'allowNull':!![],'comment':_0x641d('0x46')},'mandatoryDisposition':{'type':Sequelize[_0x641d('0x19')],'defaultValue':![],'comment':_0x641d('0x47'),'set':function(_0x5ce0a3){if(!_0x5ce0a3)this['setDataValue'](_0x641d('0x48'),null);this[_0x641d('0xf')](_0x641d('0x49'),_0x5ce0a3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x641d('0x20')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x641d('0x19')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x641d('0x10')](0x3)[_0x641d('0x20')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x641d('0x19')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 39576bb..3a05af8 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x4aa912,_0x4380a6){var _0x5cfdd5=function(_0x100744){while(--_0x100744){_0x4aa912['push'](_0x4aa912['shift']());}};_0x5cfdd5(++_0x4380a6);}(_0xa41a,0x6b));var _0xaa41=function(_0x1482b9,_0x442858){_0x1482b9=_0x1482b9-0x0;var _0x17250d=_0xa41a[_0x1482b9];return _0x17250d;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file +var _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0xf6e5aa,_0x1c275d){var _0x43ede4=function(_0xa5697){while(--_0xa5697){_0xf6e5aa['push'](_0xf6e5aa['shift']());}};_0x43ede4(++_0x1c275d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2e0b34,_0x2f1237){_0x2e0b34=_0x2e0b34-0x0;var _0x2f6dac=_0x8ef6[_0x2e0b34];return _0x2f6dac;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8525af0..1cbdfcd 100644 --- a/server/api/voiceQueue/voiceQueue.events.js +++ b/server/api/voiceQueue/voiceQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95d4=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x1e6535,_0x1f90bf){var _0x330815=function(_0x72e6d1){while(--_0x72e6d1){_0x1e6535['push'](_0x1e6535['shift']());}};_0x330815(++_0x1f90bf);}(_0x95d4,0xee));var _0x495d=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0x95d4[_0x3815c2];return _0x271f88;};'use strict';var EventEmitter=require(_0x495d('0x0'));var VoiceQueue=require(_0x495d('0x1'))['db'][_0x495d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x495d('0x3')](0x0);var events={'afterCreate':_0x495d('0x4'),'afterUpdate':_0x495d('0x5'),'afterDestroy':_0x495d('0x6')};function emitEvent(_0x535290){return function(_0x2a5383,_0x1ad1d4,_0x59fd80){VoiceQueueEvents[_0x495d('0x7')](_0x535290+':'+_0x2a5383['id'],_0x2a5383);VoiceQueueEvents['emit'](_0x535290,_0x2a5383);_0x59fd80(null);};}for(var e in events){if(events[_0x495d('0x8')](e)){var event=events[e];VoiceQueue[_0x495d('0x9')](e,emitEvent(event));}}module[_0x495d('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x02ce=['VoiceQueue','save','update','remove','emit','events','../../mysqldb'];(function(_0x3c3021,_0x189015){var _0x347432=function(_0x324dfc){while(--_0x324dfc){_0x3c3021['push'](_0x3c3021['shift']());}};_0x347432(++_0x189015);}(_0x02ce,0x1b0));var _0xe02c=function(_0x514318,_0x569e78){_0x514318=_0x514318-0x0;var _0x418975=_0x02ce[_0x514318];return _0x418975;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var VoiceQueue=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x3'),'afterUpdate':_0xe02c('0x4'),'afterDestroy':_0xe02c('0x5')};function emitEvent(_0x2dff6b){return function(_0x4acf5c,_0x44af3d,_0x2d6ead){VoiceQueueEvents[_0xe02c('0x6')](_0x2dff6b+':'+_0x4acf5c['id'],_0x4acf5c);VoiceQueueEvents['emit'](_0x2dff6b,_0x4acf5c);_0x2d6ead(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 69b92ec..27e0ca1 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x41662e,_0x29296c){var _0x1cc186=function(_0x6b0f97){while(--_0x6b0f97){_0x41662e['push'](_0x41662e['shift']());}};_0x1cc186(++_0x29296c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5ab6af,_0x474f8e){var _0x49f27f=function(_0x216392){while(--_0x216392){_0x5ab6af['push'](_0x5ab6af['shift']());}};_0x49f27f(++_0x474f8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index aeb5c43..ecc2abf 100644 --- a/server/api/voiceQueue/voiceQueue.rpc.js +++ b/server/api/voiceQueue/voiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb421=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceQueue','findAll','options','raw','attributes','include','map','model','GetVoiceQueue','debug','ShowVoiceQueue','where','util'];(function(_0x288d1a,_0x975d6d){var _0xf9de08=function(_0x1754b0){while(--_0x1754b0){_0x288d1a['push'](_0x288d1a['shift']());}};_0xf9de08(++_0x975d6d);}(_0xb421,0x1bb));var _0x1b42=function(_0x280ba3,_0x50076b){_0x280ba3=_0x280ba3-0x0;var _0x308074=_0xb421[_0x280ba3];return _0x308074;};'use strict';var _=require('lodash');var util=require(_0x1b42('0x0'));var moment=require(_0x1b42('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b42('0x2'));var fs=require('fs');var Redis=require(_0x1b42('0x3'));var db=require(_0x1b42('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b42('0x5'))(_0x1b42('0x6'));var config=require('../../config/environment');var jayson=require(_0x1b42('0x7'));var client=jayson[_0x1b42('0x8')][_0x1b42('0x9')]({'port':0x232a});config[_0x1b42('0xa')]=_[_0x1b42('0xb')](config[_0x1b42('0xa')],{'host':_0x1b42('0xc'),'port':0x18eb});var socket=require(_0x1b42('0xd'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x1b42('0xe')](socket);function respondWithRpcPromise(_0x11f0c2,_0x52e2a1,_0x167b63){return new BPromise(function(_0x2ae29d,_0x11a505){return client[_0x1b42('0xf')](_0x11f0c2,_0x167b63)[_0x1b42('0x10')](function(_0x5e389c){logger[_0x1b42('0x11')](_0x1b42('0x12'),_0x52e2a1,_0x1b42('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x52e2a1,'request\x20sent',JSON[_0x1b42('0x14')](_0x5e389c));if(_0x5e389c[_0x1b42('0x15')]){if(_0x5e389c[_0x1b42('0x15')][_0x1b42('0x16')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x52e2a1,_0x5e389c['error'][_0x1b42('0x17')]);return _0x11a505(_0x5e389c['error'][_0x1b42('0x17')]);}logger[_0x1b42('0x15')](_0x1b42('0x12'),_0x52e2a1,_0x5e389c[_0x1b42('0x15')][_0x1b42('0x17')]);return _0x2ae29d(_0x5e389c[_0x1b42('0x15')][_0x1b42('0x17')]);}else{logger['info'](_0x1b42('0x12'),_0x52e2a1,'request\x20sent');_0x2ae29d(_0x5e389c['result']['message']);}})[_0x1b42('0x18')](function(_0x4187dc){logger['error'](_0x1b42('0x12'),_0x52e2a1,_0x4187dc);_0x11a505(_0x4187dc);});});}exports['GetVoiceQueue']=function(_0x4a3b14){var _0x173461=this;return new Promise(function(_0x547f5f,_0x5c3bbd){return db[_0x1b42('0x19')][_0x1b42('0x1a')]({'raw':_0x4a3b14[_0x1b42('0x1b')]?_0x4a3b14[_0x1b42('0x1b')][_0x1b42('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a3b14[_0x1b42('0x1b')]?_0x4a3b14['options']['where']||null:null,'attributes':_0x4a3b14[_0x1b42('0x1b')]?_0x4a3b14[_0x1b42('0x1b')][_0x1b42('0x1d')]||null:null,'limit':_0x4a3b14[_0x1b42('0x1b')]?_0x4a3b14[_0x1b42('0x1b')]['limit']||null:null,'include':_0x4a3b14['options']?_0x4a3b14[_0x1b42('0x1b')][_0x1b42('0x1e')]?_[_0x1b42('0x1f')](_0x4a3b14[_0x1b42('0x1b')][_0x1b42('0x1e')],function(_0x29f5f4){return{'model':db[_0x29f5f4[_0x1b42('0x20')]],'as':_0x29f5f4['as'],'attributes':_0x29f5f4[_0x1b42('0x1d')],'include':_0x29f5f4[_0x1b42('0x1e')]?_[_0x1b42('0x1f')](_0x29f5f4['include'],function(_0x3e5b98){return{'model':db[_0x3e5b98['model']],'as':_0x3e5b98['as'],'attributes':_0x3e5b98['attributes'],'include':_0x3e5b98[_0x1b42('0x1e')]?_['map'](_0x3e5b98[_0x1b42('0x1e')],function(_0x1a4a45){return{'model':db[_0x1a4a45[_0x1b42('0x20')]],'as':_0x1a4a45['as'],'attributes':_0x1a4a45[_0x1b42('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ce679){logger[_0x1b42('0x11')](_0x1b42('0x21'),_0x4a3b14);logger[_0x1b42('0x22')](_0x1b42('0x21'),_0x4a3b14,JSON[_0x1b42('0x14')](_0x1ce679));_0x547f5f(_0x1ce679);})['catch'](function(_0x1a033b){logger[_0x1b42('0x15')](_0x1b42('0x21'),_0x1a033b[_0x1b42('0x17')],_0x4a3b14);_0x5c3bbd(_0x173461['error'](0x1f4,_0x1a033b[_0x1b42('0x17')]));});});};exports[_0x1b42('0x23')]=function(_0xd34f7d){var _0x49d5c6=this;return new Promise(function(_0x1ddcc0,_0xf4dafe){return db[_0x1b42('0x19')]['find']({'raw':_0xd34f7d['options']?_0xd34f7d[_0x1b42('0x1b')][_0x1b42('0x1c')]===undefined?!![]:![]:!![],'where':_0xd34f7d[_0x1b42('0x1b')]?_0xd34f7d[_0x1b42('0x1b')][_0x1b42('0x24')]||null:null,'attributes':_0xd34f7d[_0x1b42('0x1b')]?_0xd34f7d['options']['attributes']||null:null,'include':_0xd34f7d[_0x1b42('0x1b')]?_0xd34f7d[_0x1b42('0x1b')][_0x1b42('0x1e')]?_[_0x1b42('0x1f')](_0xd34f7d['options'][_0x1b42('0x1e')],function(_0x390385){return{'model':db[_0x390385[_0x1b42('0x20')]],'as':_0x390385['as'],'attributes':_0x390385[_0x1b42('0x1d')],'include':_0x390385[_0x1b42('0x1e')]?_[_0x1b42('0x1f')](_0x390385[_0x1b42('0x1e')],function(_0x12f0c4){return{'model':db[_0x12f0c4['model']],'as':_0x12f0c4['as'],'attributes':_0x12f0c4[_0x1b42('0x1d')],'include':_0x12f0c4[_0x1b42('0x1e')]?_[_0x1b42('0x1f')](_0x12f0c4[_0x1b42('0x1e')],function(_0x1f4bea){return{'model':db[_0x1f4bea[_0x1b42('0x20')]],'as':_0x1f4bea['as'],'attributes':_0x1f4bea[_0x1b42('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5127fa){logger[_0x1b42('0x11')](_0x1b42('0x23'),_0xd34f7d);logger[_0x1b42('0x22')](_0x1b42('0x23'),_0xd34f7d,JSON[_0x1b42('0x14')](_0x5127fa));_0x1ddcc0(_0x5127fa);})[_0x1b42('0x18')](function(_0x418db8){logger[_0x1b42('0x15')](_0x1b42('0x23'),_0x418db8['message'],_0xd34f7d);_0xf4dafe(_0x49d5c6[_0x1b42('0x15')](0x1f4,_0x418db8[_0x1b42('0x17')]));});});}; \ No newline at end of file +var _0x6af7=['map','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','limit','model','include'];(function(_0x2ebf9d,_0x579167){var _0x1a9c54=function(_0x360e74){while(--_0x360e74){_0x2ebf9d['push'](_0x2ebf9d['shift']());}};_0x1a9c54(++_0x579167);}(_0x6af7,0xc2));var _0x76af=function(_0x5b6e85,_0x41fd2b){_0x5b6e85=_0x5b6e85-0x0;var _0x3bd5b0=_0x6af7[_0x5b6e85];return _0x3bd5b0;};'use strict';var _=require(_0x76af('0x0'));var util=require(_0x76af('0x1'));var moment=require('moment');var BPromise=require(_0x76af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76af('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76af('0x4'))(_0x76af('0x5'));var config=require(_0x76af('0x6'));var jayson=require(_0x76af('0x7'));var client=jayson[_0x76af('0x8')][_0x76af('0x9')]({'port':0x232a});config['redis']=_[_0x76af('0xa')](config[_0x76af('0xb')],{'host':_0x76af('0xc'),'port':0x18eb});var socket=require(_0x76af('0xd'))(new Redis(config[_0x76af('0xb')]));require('./voiceQueue.socket')[_0x76af('0xe')](socket);function respondWithRpcPromise(_0x374064,_0x9919fb,_0x382046){return new BPromise(function(_0x4370cb,_0x11f5b9){return client['request'](_0x374064,_0x382046)[_0x76af('0xf')](function(_0x5ee3a7){logger[_0x76af('0x10')](_0x76af('0x11'),_0x9919fb,_0x76af('0x12'));logger[_0x76af('0x13')](_0x76af('0x14'),_0x9919fb,'request\x20sent',JSON[_0x76af('0x15')](_0x5ee3a7));if(_0x5ee3a7[_0x76af('0x16')]){if(_0x5ee3a7['error']['code']===0x1f4){logger[_0x76af('0x16')](_0x76af('0x11'),_0x9919fb,_0x5ee3a7[_0x76af('0x16')][_0x76af('0x17')]);return _0x11f5b9(_0x5ee3a7['error'][_0x76af('0x17')]);}logger[_0x76af('0x16')](_0x76af('0x11'),_0x9919fb,_0x5ee3a7['error'][_0x76af('0x17')]);return _0x4370cb(_0x5ee3a7['error']['message']);}else{logger[_0x76af('0x10')](_0x76af('0x11'),_0x9919fb,_0x76af('0x12'));_0x4370cb(_0x5ee3a7[_0x76af('0x18')][_0x76af('0x17')]);}})[_0x76af('0x19')](function(_0x12193d){logger[_0x76af('0x16')](_0x76af('0x11'),_0x9919fb,_0x12193d);_0x11f5b9(_0x12193d);});});}exports['GetVoiceQueue']=function(_0x23332b){var _0x43b6dc=this;return new Promise(function(_0x554277,_0x55268a){return db['VoiceQueue'][_0x76af('0x1a')]({'raw':_0x23332b[_0x76af('0x1b')]?_0x23332b[_0x76af('0x1b')][_0x76af('0x1c')]===undefined?!![]:![]:!![],'where':_0x23332b[_0x76af('0x1b')]?_0x23332b['options'][_0x76af('0x1d')]||null:null,'attributes':_0x23332b[_0x76af('0x1b')]?_0x23332b[_0x76af('0x1b')][_0x76af('0x1e')]||null:null,'limit':_0x23332b[_0x76af('0x1b')]?_0x23332b[_0x76af('0x1b')][_0x76af('0x1f')]||null:null,'include':_0x23332b[_0x76af('0x1b')]?_0x23332b[_0x76af('0x1b')]['include']?_['map'](_0x23332b[_0x76af('0x1b')]['include'],function(_0x55ba76){return{'model':db[_0x55ba76[_0x76af('0x20')]],'as':_0x55ba76['as'],'attributes':_0x55ba76[_0x76af('0x1e')],'include':_0x55ba76[_0x76af('0x21')]?_[_0x76af('0x22')](_0x55ba76[_0x76af('0x21')],function(_0x214290){return{'model':db[_0x214290['model']],'as':_0x214290['as'],'attributes':_0x214290[_0x76af('0x1e')],'include':_0x214290[_0x76af('0x21')]?_[_0x76af('0x22')](_0x214290[_0x76af('0x21')],function(_0x4a9bf1){return{'model':db[_0x4a9bf1['model']],'as':_0x4a9bf1['as'],'attributes':_0x4a9bf1[_0x76af('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x76af('0xf')](function(_0x3ea819){logger[_0x76af('0x10')]('GetVoiceQueue',_0x23332b);logger[_0x76af('0x13')](_0x76af('0x23'),_0x23332b,JSON[_0x76af('0x15')](_0x3ea819));_0x554277(_0x3ea819);})[_0x76af('0x19')](function(_0x1eacca){logger[_0x76af('0x16')](_0x76af('0x23'),_0x1eacca[_0x76af('0x17')],_0x23332b);_0x55268a(_0x43b6dc[_0x76af('0x16')](0x1f4,_0x1eacca['message']));});});};exports[_0x76af('0x24')]=function(_0x30fec0){var _0x541a1a=this;return new Promise(function(_0x4803c2,_0x21d009){return db[_0x76af('0x25')]['find']({'raw':_0x30fec0[_0x76af('0x1b')]?_0x30fec0[_0x76af('0x1b')][_0x76af('0x1c')]===undefined?!![]:![]:!![],'where':_0x30fec0['options']?_0x30fec0[_0x76af('0x1b')]['where']||null:null,'attributes':_0x30fec0[_0x76af('0x1b')]?_0x30fec0[_0x76af('0x1b')][_0x76af('0x1e')]||null:null,'include':_0x30fec0[_0x76af('0x1b')]?_0x30fec0['options'][_0x76af('0x21')]?_[_0x76af('0x22')](_0x30fec0[_0x76af('0x1b')][_0x76af('0x21')],function(_0x265adc){return{'model':db[_0x265adc[_0x76af('0x20')]],'as':_0x265adc['as'],'attributes':_0x265adc[_0x76af('0x1e')],'include':_0x265adc[_0x76af('0x21')]?_[_0x76af('0x22')](_0x265adc[_0x76af('0x21')],function(_0x5ef6b5){return{'model':db[_0x5ef6b5[_0x76af('0x20')]],'as':_0x5ef6b5['as'],'attributes':_0x5ef6b5[_0x76af('0x1e')],'include':_0x5ef6b5[_0x76af('0x21')]?_[_0x76af('0x22')](_0x5ef6b5['include'],function(_0x309030){return{'model':db[_0x309030[_0x76af('0x20')]],'as':_0x309030['as'],'attributes':_0x309030[_0x76af('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x76af('0xf')](function(_0x3642c7){logger[_0x76af('0x10')](_0x76af('0x24'),_0x30fec0);logger[_0x76af('0x13')](_0x76af('0x24'),_0x30fec0,JSON[_0x76af('0x15')](_0x3642c7));_0x4803c2(_0x3642c7);})[_0x76af('0x19')](function(_0x75c371){logger[_0x76af('0x16')](_0x76af('0x24'),_0x75c371[_0x76af('0x17')],_0x30fec0);_0x21d009(_0x541a1a[_0x76af('0x16')](0x1f4,_0x75c371[_0x76af('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8440009..b0872cc 100644 --- a/server/api/voiceQueue/voiceQueue.socket.js +++ b/server/api/voiceQueue/voiceQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa27=['update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0xf9335b,_0x2afeb5){var _0x5aac02=function(_0x2dd734){while(--_0x2dd734){_0xf9335b['push'](_0xf9335b['shift']());}};_0x5aac02(++_0x2afeb5);}(_0xaa27,0x15c));var _0x7aa2=function(_0x437d1f,_0xedb6f2){_0x437d1f=_0x437d1f-0x0;var _0x43a86e=_0xaa27[_0x437d1f];return _0x43a86e;};'use strict';var VoiceQueueEvents=require(_0x7aa2('0x0'));var events=[_0x7aa2('0x1'),_0x7aa2('0x2'),_0x7aa2('0x3')];function createListener(_0xf81c4e,_0x8dee75){return function(_0x1fcc2d){_0x8dee75[_0x7aa2('0x4')](_0xf81c4e,_0x1fcc2d);};}function removeListener(_0x273467,_0x2731b3){return function(){VoiceQueueEvents[_0x7aa2('0x5')](_0x273467,_0x2731b3);};}exports[_0x7aa2('0x6')]=function(_0x2199c6){for(var _0x303a9a=0x0,_0x10f8f5=events[_0x7aa2('0x7')];_0x303a9a<_0x10f8f5;_0x303a9a++){var _0x8b341f=events[_0x303a9a];var _0x18e677=createListener(_0x7aa2('0x8')+_0x8b341f,_0x2199c6);VoiceQueueEvents['on'](_0x8b341f,_0x18e677);}}; \ No newline at end of file +var _0x466d=['register','length','./voiceQueue.events','remove','update','emit'];(function(_0x4d02dd,_0x5607cd){var _0x4b36ff=function(_0x3a9b5f){while(--_0x3a9b5f){_0x4d02dd['push'](_0x4d02dd['shift']());}};_0x4b36ff(++_0x5607cd);}(_0x466d,0x164));var _0xd466=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x466d[_0x2576d7];return _0x16a08c;};'use strict';var VoiceQueueEvents=require(_0xd466('0x0'));var events=['save',_0xd466('0x1'),_0xd466('0x2')];function createListener(_0x1c4378,_0x565cce){return function(_0x22bd60){_0x565cce[_0xd466('0x3')](_0x1c4378,_0x22bd60);};}function removeListener(_0x3818cb,_0x5ca066){return function(){VoiceQueueEvents['removeListener'](_0x3818cb,_0x5ca066);};}exports[_0xd466('0x4')]=function(_0x421883){for(var _0x128133=0x0,_0x54ee64=events[_0xd466('0x5')];_0x128133<_0x54ee64;_0x128133++){var _0x28e933=events[_0x128133];var _0x1f9df8=createListener('voiceQueue:'+_0x28e933,_0x421883);VoiceQueueEvents['on'](_0x28e933,_0x1f9df8);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index fdbef34..f27165d 100644 --- a/server/api/voiceQueueReport/index.js +++ b/server/api/voiceQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3294=['create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x3a934b,_0x163286){var _0x3cb3a5=function(_0x496dea){while(--_0x496dea){_0x3a934b['push'](_0x3a934b['shift']());}};_0x3cb3a5(++_0x163286);}(_0x3294,0x131));var _0x4329=function(_0x27cab7,_0x5451aa){_0x27cab7=_0x27cab7-0x0;var _0x5340d8=_0x3294[_0x27cab7];return _0x5340d8;};'use strict';var multer=require(_0x4329('0x0'));var util=require(_0x4329('0x1'));var path=require(_0x4329('0x2'));var timeout=require('connect-timeout');var express=require(_0x4329('0x3'));var router=express[_0x4329('0x4')]();var fs_extra=require(_0x4329('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4329('0x6'));var config=require(_0x4329('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x4329('0x8')]('/',auth[_0x4329('0x9')](),controller[_0x4329('0xa')]);router[_0x4329('0x8')](_0x4329('0xb'),auth[_0x4329('0x9')](),controller['describe']);router[_0x4329('0x8')]('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x4329('0x8')](_0x4329('0xc'),auth['isAuthenticated'](),controller[_0x4329('0xd')]);router[_0x4329('0xe')]('/',auth[_0x4329('0x9')](),controller[_0x4329('0xf')]);router[_0x4329('0x10')](_0x4329('0xc'),auth[_0x4329('0x9')](),controller['update']);router[_0x4329('0x11')](_0x4329('0xc'),auth[_0x4329('0x9')](),controller[_0x4329('0x12')]);module[_0x4329('0x13')]=router; \ No newline at end of file +var _0x25d4=['getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','/index','isAuthenticated'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x25d4,0x15c));var _0x425d=function(_0x25a4c8,_0x7873fc){_0x25a4c8=_0x25a4c8-0x0;var _0x3d500f=_0x25d4[_0x25a4c8];return _0x3d500f;};'use strict';var multer=require(_0x425d('0x0'));var util=require('util');var path=require(_0x425d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x425d('0x2'));var auth=require(_0x425d('0x3'));var interaction=require(_0x425d('0x4'));var config=require(_0x425d('0x5'));var controller=require(_0x425d('0x6'));router[_0x425d('0x7')]('/',auth['isAuthenticated'](),controller[_0x425d('0x8')]);router['get'](_0x425d('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x425d('0x7')](_0x425d('0xa'),auth[_0x425d('0xb')](),controller[_0x425d('0xc')]);router[_0x425d('0x7')](_0x425d('0xd'),auth[_0x425d('0xb')](),controller[_0x425d('0xe')]);router[_0x425d('0xf')]('/',auth[_0x425d('0xb')](),controller[_0x425d('0x10')]);router['put'](_0x425d('0xd'),auth[_0x425d('0xb')](),controller[_0x425d('0x11')]);router[_0x425d('0x12')](_0x425d('0xd'),auth[_0x425d('0xb')](),controller[_0x425d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 6c2244c..9edf179 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1556=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING'];(function(_0x559434,_0x2f9870){var _0x252834=function(_0x548490){while(--_0x548490){_0x559434['push'](_0x559434['shift']());}};_0x252834(++_0x2f9870);}(_0x1556,0x1c3));var _0x6155=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1556[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x6155('0x0'));var moment=require(_0x6155('0x1'));module[_0x6155('0x2')]={'type':{'type':Sequelize[_0x6155('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6155('0x3')]},'calleridname':{'type':Sequelize[_0x6155('0x3')]},'queue':{'type':Sequelize[_0x6155('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6155('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6155('0x4')],'set':function(_0x4365b7){var _0x4867d6=moment(_0x4365b7);var _0x4b7aef=moment(this['getDataValue']('queuecallerjoinAt'))[_0x6155('0x5')](_0x6155('0x6'));var _0x17aa6c=_0x4867d6[_0x6155('0x7')](_0x4b7aef,_0x6155('0x8'));this[_0x6155('0x9')]('queuecallerleaveAt',_0x4365b7);this[_0x6155('0x9')]('holdtime',_0x17aa6c||null);}},'position':{'type':Sequelize[_0x6155('0xa')]},'count':{'type':Sequelize[_0x6155('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x6155('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6155('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6155('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6155('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6155('0x3')],'comment':_0x6155('0xc')},'originalposition':{'type':Sequelize[_0x6155('0xa')]},'channel':{'type':Sequelize[_0x6155('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6155('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6155('0x3')]},'context':{'type':Sequelize[_0x6155('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6155('0x3')]},'holdtime':{'type':Sequelize[_0x6155('0xa')]},'mohtime':{'type':Sequelize[_0x6155('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6155('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6155('0x3')]},'transfer':{'type':Sequelize[_0x6155('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6155('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6155('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6155('0x3')]},'secondDisposition':{'type':Sequelize[_0x6155('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6155('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x6155('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x6155('0x3')]}}; \ No newline at end of file +var _0xdda4=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2bc188,_0x42ebee){var _0x715d11=function(_0x1716d8){while(--_0x1716d8){_0x2bc188['push'](_0x2bc188['shift']());}};_0x715d11(++_0x42ebee);}(_0xdda4,0x1e5));var _0x4dda=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0xdda4[_0x52b24f];return _0x46ea6b;};'use strict';var Sequelize=require(_0x4dda('0x0'));var moment=require(_0x4dda('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4dda('0x2')]},'calleridname':{'type':Sequelize[_0x4dda('0x2')]},'queue':{'type':Sequelize[_0x4dda('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x4dda('0x3')],'set':function(_0x4c6c87){var _0x17be82=moment(_0x4c6c87);var _0x1d68f3=moment(this[_0x4dda('0x4')](_0x4dda('0x5')))[_0x4dda('0x6')](_0x4dda('0x7'));var _0x2ae5f8=_0x17be82[_0x4dda('0x8')](_0x1d68f3,_0x4dda('0x9'));this[_0x4dda('0xa')](_0x4dda('0xb'),_0x4c6c87);this[_0x4dda('0xa')](_0x4dda('0xc'),_0x2ae5f8||null);}},'position':{'type':Sequelize[_0x4dda('0xd')]},'count':{'type':Sequelize[_0x4dda('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x4dda('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4dda('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x4dda('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x4dda('0x2')],'comment':_0x4dda('0xf')},'originalposition':{'type':Sequelize[_0x4dda('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4dda('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4dda('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4dda('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x4dda('0xd')]},'mohtime':{'type':Sequelize[_0x4dda('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4dda('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4dda('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4dda('0x2')],'comment':_0x4dda('0x10')},'transferexten':{'type':Sequelize[_0x4dda('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4dda('0x2')]},'disposition':{'type':Sequelize[_0x4dda('0x2')]},'secondDisposition':{'type':Sequelize[_0x4dda('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4dda('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x4dda('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 182fbee..399ab59 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x201b=['describe','order','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x201b,0x19d));var _0xb201=function(_0x509cf5,_0x294c6d){_0x509cf5=_0x509cf5-0x0;var _0x580a51=_0x201b[_0x509cf5];return _0x580a51;};'use strict';var emlformat=require(_0xb201('0x0'));var rimraf=require(_0xb201('0x1'));var zipdir=require(_0xb201('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb201('0x3'));var moment=require('moment');var BPromise=require(_0xb201('0x4'));var Mustache=require(_0xb201('0x5'));var util=require(_0xb201('0x6'));var path=require(_0xb201('0x7'));var sox=require(_0xb201('0x8'));var csv=require(_0xb201('0x9'));var ejs=require(_0xb201('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb201('0xb'));var squel=require(_0xb201('0xc'));var crypto=require(_0xb201('0xd'));var jsforce=require(_0xb201('0xe'));var deskjs=require(_0xb201('0xf'));var toCsv=require(_0xb201('0x9'));var querystring=require(_0xb201('0x10'));var Papa=require(_0xb201('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb201('0x12'));var as=require(_0xb201('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb201('0x14'))(_0xb201('0x15'));var utils=require(_0xb201('0x16'));var config=require(_0xb201('0x17'));var licenseUtil=require(_0xb201('0x18'));var db=require(_0xb201('0x19'))['db'];config['redis']=_[_0xb201('0x1a')](config[_0xb201('0x1b')],{'host':_0xb201('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb201('0x1b')]));require(_0xb201('0x1d'))[_0xb201('0x1e')](socket);function respondWithStatusCode(_0x10cc19,_0x39ce8a){_0x39ce8a=_0x39ce8a||0xcc;return function(_0x55e768){if(_0x55e768){return _0x10cc19[_0xb201('0x1f')](_0x39ce8a);}return _0x10cc19['status'](_0x39ce8a)[_0xb201('0x20')]();};}function respondWithResult(_0x3ef014,_0x28ced1){_0x28ced1=_0x28ced1||0xc8;return function(_0x46ca02){if(_0x46ca02){return _0x3ef014[_0xb201('0x21')](_0x28ced1)[_0xb201('0x22')](_0x46ca02);}};}function respondWithFilteredResult(_0x787aa0,_0x12a86b){return function(_0x319b0d){if(_0x319b0d){var _0x230d07=typeof _0x12a86b[_0xb201('0x23')]===_0xb201('0x24')&&typeof _0x12a86b[_0xb201('0x25')]===_0xb201('0x24');var _0x5c4ce6=_0x319b0d[_0xb201('0x26')];var _0x37aa12=_0x230d07?0x0:_0x12a86b[_0xb201('0x23')];var _0x835e22=_0x230d07?_0x319b0d['count']:_0x12a86b['offset']+_0x12a86b[_0xb201('0x25')];var _0x39defa;if(_0x835e22>=_0x5c4ce6){_0x835e22=_0x5c4ce6;_0x39defa=0xc8;}else{_0x39defa=0xce;}_0x787aa0[_0xb201('0x21')](_0x39defa);return _0x787aa0[_0xb201('0x27')](_0xb201('0x28'),_0x37aa12+'-'+_0x835e22+'/'+_0x5c4ce6)[_0xb201('0x22')](_0x319b0d);}return null;};}function patchUpdates(_0x262a23){return function(_0x92ca7a){try{jsonpatch['apply'](_0x92ca7a,_0x262a23,!![]);}catch(_0x120d8e){return BPromise[_0xb201('0x29')](_0x120d8e);}return _0x92ca7a['save']();};}function saveUpdates(_0x455f6,_0x47da1a){return function(_0x262e9c){if(_0x262e9c){return _0x262e9c['update'](_0x455f6)[_0xb201('0x2a')](function(_0x173e90){return _0x173e90;});}return null;};}function removeEntity(_0x36ceb2,_0x4dab1a){return function(_0x5162fc){if(_0x5162fc){return _0x5162fc['destroy']()[_0xb201('0x2a')](function(){_0x36ceb2[_0xb201('0x21')](0xcc)[_0xb201('0x20')]();});}};}function handleEntityNotFound(_0xdf861c,_0x9a493d){return function(_0x5d4c7e){if(!_0x5d4c7e){_0xdf861c[_0xb201('0x1f')](0x194);}return _0x5d4c7e;};}function handleError(_0x2e5814,_0x5697a4){_0x5697a4=_0x5697a4||0x1f4;return function(_0x208401){logger['error'](_0x208401[_0xb201('0x2b')]);if(_0x208401[_0xb201('0x2c')]){delete _0x208401[_0xb201('0x2c')];}_0x2e5814['status'](_0x5697a4)[_0xb201('0x2d')](_0x208401);};}exports[_0xb201('0x2e')]=function(_0x54a715,_0x1908a4){var _0x2ca14d={},_0x488150={},_0x3265bc={'count':0x0,'rows':[]};var _0x2ffdd2=_['map'](db[_0xb201('0x2f')][_0xb201('0x30')],function(_0x486fe9){return{'name':_0x486fe9[_0xb201('0x31')],'type':_0x486fe9[_0xb201('0x32')]['key']};});_0x488150[_0xb201('0x33')]=_[_0xb201('0x34')](_0x2ffdd2,_0xb201('0x2c'));_0x488150[_0xb201('0x35')]=_[_0xb201('0x36')](_0x54a715[_0xb201('0x35')]);_0x488150[_0xb201('0x37')]=_[_0xb201('0x38')](_0x488150[_0xb201('0x33')],_0x488150[_0xb201('0x35')]);_0x2ca14d[_0xb201('0x39')]=_['intersection'](_0x488150[_0xb201('0x33')],qs[_0xb201('0x3a')](_0x54a715[_0xb201('0x35')]['fields']));_0x2ca14d[_0xb201('0x39')]=_0x2ca14d['attributes'][_0xb201('0x3b')]?_0x2ca14d[_0xb201('0x39')]:_0x488150[_0xb201('0x33')];if(!_0x54a715[_0xb201('0x35')][_0xb201('0x3c')](_0xb201('0x3d'))){_0x2ca14d[_0xb201('0x25')]=qs['limit'](_0x54a715[_0xb201('0x35')][_0xb201('0x25')]);_0x2ca14d[_0xb201('0x23')]=qs[_0xb201('0x23')](_0x54a715['query'][_0xb201('0x23')]);}_0x2ca14d['order']=qs[_0xb201('0x3e')](_0x54a715[_0xb201('0x35')][_0xb201('0x3e')]);_0x2ca14d[_0xb201('0x3f')]=qs[_0xb201('0x37')](_[_0xb201('0x40')](_0x54a715[_0xb201('0x35')],_0x488150[_0xb201('0x37')]),_0x2ffdd2);if(_0x54a715[_0xb201('0x35')][_0xb201('0x41')]){_0x2ca14d[_0xb201('0x3f')]=_[_0xb201('0x42')](_0x2ca14d[_0xb201('0x3f')],{'$or':_[_0xb201('0x34')](_0x2ffdd2,function(_0x5190f2){if(_0x5190f2[_0xb201('0x32')]!==_0xb201('0x43')){var _0x487c62={};_0x487c62[_0x5190f2[_0xb201('0x2c')]]={'$like':'%'+_0x54a715['query'][_0xb201('0x41')]+'%'};return _0x487c62;}})});}_0x2ca14d=_[_0xb201('0x42')]({},_0x2ca14d,_0x54a715[_0xb201('0x44')]);var _0x5e7e78={'where':_0x2ca14d[_0xb201('0x3f')]};return db[_0xb201('0x2f')][_0xb201('0x26')](_0x5e7e78)[_0xb201('0x2a')](function(_0x13484c){_0x3265bc[_0xb201('0x26')]=_0x13484c;if(_0x54a715[_0xb201('0x35')][_0xb201('0x45')]){_0x2ca14d[_0xb201('0x46')]=[{'all':!![]}];}return db[_0xb201('0x2f')][_0xb201('0x47')](_0x2ca14d);})[_0xb201('0x2a')](function(_0x3f6639){_0x3265bc[_0xb201('0x48')]=_0x3f6639;return _0x3265bc;})[_0xb201('0x2a')](respondWithFilteredResult(_0x1908a4,_0x2ca14d))[_0xb201('0x49')](handleError(_0x1908a4,null));};exports[_0xb201('0x4a')]=function(_0x52a1ed,_0x3882c3){var _0x467220={'raw':![],'where':{'id':_0x52a1ed[_0xb201('0x4b')]['id']}},_0x5d2162={};_0x5d2162['model']=_[_0xb201('0x36')](db[_0xb201('0x2f')]['rawAttributes']);_0x5d2162[_0xb201('0x35')]=_[_0xb201('0x36')](_0x52a1ed[_0xb201('0x35')]);_0x5d2162['filters']=_[_0xb201('0x38')](_0x5d2162['model'],_0x5d2162['query']);_0x467220['attributes']=_[_0xb201('0x38')](_0x5d2162[_0xb201('0x33')],qs[_0xb201('0x3a')](_0x52a1ed[_0xb201('0x35')][_0xb201('0x3a')]));_0x467220[_0xb201('0x39')]=_0x467220['attributes']['length']?_0x467220['attributes']:_0x5d2162[_0xb201('0x33')];if(_0x52a1ed[_0xb201('0x35')]['includeAll']){_0x467220[_0xb201('0x46')]=[{'all':!![]}];}_0x467220=_[_0xb201('0x42')]({},_0x467220,_0x52a1ed['options']);return db[_0xb201('0x2f')][_0xb201('0x4c')](_0x467220)[_0xb201('0x2a')](handleEntityNotFound(_0x3882c3,null))[_0xb201('0x2a')](respondWithResult(_0x3882c3,null))[_0xb201('0x49')](handleError(_0x3882c3,null));};exports['create']=function(_0x240844,_0x5c399b){return db[_0xb201('0x2f')][_0xb201('0x4d')](_0x240844[_0xb201('0x4e')],{})['then'](respondWithResult(_0x5c399b,0xc9))[_0xb201('0x49')](handleError(_0x5c399b,null));};exports['update']=function(_0xb9f360,_0x59a214){if(_0xb9f360['body']['id']){delete _0xb9f360[_0xb201('0x4e')]['id'];}return db[_0xb201('0x2f')][_0xb201('0x4c')]({'where':{'id':_0xb9f360[_0xb201('0x4b')]['id']}})[_0xb201('0x2a')](handleEntityNotFound(_0x59a214,null))[_0xb201('0x2a')](saveUpdates(_0xb9f360[_0xb201('0x4e')],null))[_0xb201('0x2a')](respondWithResult(_0x59a214,null))['catch'](handleError(_0x59a214,null));};exports['destroy']=function(_0x5ba0f8,_0x19a0fe){return db[_0xb201('0x2f')][_0xb201('0x4c')]({'where':{'id':_0x5ba0f8[_0xb201('0x4b')]['id']}})[_0xb201('0x2a')](handleEntityNotFound(_0x19a0fe,null))['then'](removeEntity(_0x19a0fe,null))['catch'](handleError(_0x19a0fe,null));};exports[_0xb201('0x4f')]=function(_0x5aaf53,_0x4e329b){return db['VoiceQueueReport'][_0xb201('0x4f')]()['then'](respondWithResult(_0x4e329b,null))['catch'](handleError(_0x4e329b,null));};exports['getVoiceQueuesReport']=function(_0x1a28df,_0x248dba){var _0x4aa151={},_0x1142af={},_0x1b791f={'count':0x0,'rows':[]};_0x1142af[_0xb201('0x33')]=_[_0xb201('0x36')](db['VoiceQueueReport'][_0xb201('0x30')]);_0x1142af[_0xb201('0x35')]=_[_0xb201('0x36')](_0x1a28df[_0xb201('0x35')]);_0x1142af[_0xb201('0x37')]=_[_0xb201('0x38')](_0x1142af[_0xb201('0x33')],_0x1142af[_0xb201('0x35')]);_0x4aa151[_0xb201('0x39')]=_[_0xb201('0x38')](_0x1142af[_0xb201('0x33')],qs[_0xb201('0x3a')](_0x1a28df[_0xb201('0x35')]['fields']));_0x4aa151[_0xb201('0x39')]=_0x4aa151[_0xb201('0x39')][_0xb201('0x3b')]?_0x4aa151[_0xb201('0x39')]:_0x1142af[_0xb201('0x33')];if(!_0x1a28df[_0xb201('0x35')][_0xb201('0x3c')](_0xb201('0x3d'))){_0x4aa151[_0xb201('0x25')]=qs[_0xb201('0x25')](_0x1a28df[_0xb201('0x35')][_0xb201('0x25')]);_0x4aa151['offset']=qs[_0xb201('0x23')](_0x1a28df[_0xb201('0x35')][_0xb201('0x23')]);}_0x4aa151[_0xb201('0x50')]=qs[_0xb201('0x3e')](_0x1a28df[_0xb201('0x35')][_0xb201('0x3e')]);_0x4aa151[_0xb201('0x3f')]=qs[_0xb201('0x37')](_[_0xb201('0x40')](_0x1a28df[_0xb201('0x35')],_0x1142af[_0xb201('0x37')]));if(_0x1a28df['query'][_0xb201('0x41')]){_0x4aa151[_0xb201('0x3f')]=_[_0xb201('0x42')](_0x4aa151[_0xb201('0x3f')],{'$or':_[_0xb201('0x34')](_0x4aa151['attributes'],function(_0x1f9fa6){var _0x5d21dd={};_0x5d21dd[_0x1f9fa6]={'$like':'%'+_0x1a28df[_0xb201('0x35')]['filter']+'%'};return _0x5d21dd;})});}_0x4aa151=_[_0xb201('0x42')]({},_0x4aa151,_0x1a28df[_0xb201('0x44')]);var _0x135505={'where':_0x4aa151['where']};return db[_0xb201('0x2f')][_0xb201('0x26')](_0x135505)[_0xb201('0x2a')](function(_0x50b036){_0x1b791f['count']=_0x50b036;if(_0x1a28df[_0xb201('0x35')][_0xb201('0x45')]){_0x4aa151['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb201('0x47')](_0x4aa151);})[_0xb201('0x2a')](function(_0x4b56f2){_0x1b791f[_0xb201('0x48')]=_0x4b56f2;return _0x1b791f;})[_0xb201('0x2a')](respondWithFilteredResult(_0x248dba,_0x4aa151,'getVoiceQueuesReport'))[_0xb201('0x49')](handleError(_0x248dba,null,_0xb201('0x51')));}; \ No newline at end of file +var _0x4dda=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','VoiceQueueReport','includeAll','findAll','rows','catch','show','include','create','body','update','params','find','describe','getVoiceQueuesReport','nolimit','pick','eml-format','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','desk.js'];(function(_0x50f9ab,_0x5009b4){var _0x58dda4=function(_0x5f1ff5){while(--_0x5f1ff5){_0x50f9ab['push'](_0x50f9ab['shift']());}};_0x58dda4(++_0x5009b4);}(_0x4dda,0x13b));var _0xa4dd=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x4dda[_0x474d97];return _0x1edf25;};'use strict';var emlformat=require(_0xa4dd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa4dd('0x1'));var rp=require(_0xa4dd('0x2'));var moment=require(_0xa4dd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4dd('0x4'));var path=require('path');var sox=require(_0xa4dd('0x5'));var csv=require(_0xa4dd('0x6'));var ejs=require(_0xa4dd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa4dd('0x8'));var toCsv=require(_0xa4dd('0x6'));var querystring=require(_0xa4dd('0x9'));var Papa=require(_0xa4dd('0xa'));var Redis=require(_0xa4dd('0xb'));var authService=require(_0xa4dd('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa4dd('0xd'));var hardwareService=require(_0xa4dd('0xe'));var logger=require('../../config/logger')(_0xa4dd('0xf'));var utils=require(_0xa4dd('0x10'));var config=require(_0xa4dd('0x11'));var licenseUtil=require(_0xa4dd('0x12'));var db=require(_0xa4dd('0x13'))['db'];config[_0xa4dd('0x14')]=_[_0xa4dd('0x15')](config['redis'],{'host':_0xa4dd('0x16'),'port':0x18eb});var socket=require(_0xa4dd('0x17'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xa4dd('0x18')](socket);function respondWithStatusCode(_0x3a6244,_0x520c7b){_0x520c7b=_0x520c7b||0xcc;return function(_0x5b5c63){if(_0x5b5c63){return _0x3a6244['sendStatus'](_0x520c7b);}return _0x3a6244[_0xa4dd('0x19')](_0x520c7b)[_0xa4dd('0x1a')]();};}function respondWithResult(_0x188576,_0x8632cc){_0x8632cc=_0x8632cc||0xc8;return function(_0x3c980d){if(_0x3c980d){return _0x188576[_0xa4dd('0x19')](_0x8632cc)['json'](_0x3c980d);}};}function respondWithFilteredResult(_0x1a312f,_0x2352a2){return function(_0xe3acfe){if(_0xe3acfe){var _0x19c05f=typeof _0x2352a2[_0xa4dd('0x1b')]===_0xa4dd('0x1c')&&typeof _0x2352a2[_0xa4dd('0x1d')]==='undefined';var _0x21d378=_0xe3acfe['count'];var _0x25aa75=_0x19c05f?0x0:_0x2352a2['offset'];var _0x1dc065=_0x19c05f?_0xe3acfe[_0xa4dd('0x1e')]:_0x2352a2[_0xa4dd('0x1b')]+_0x2352a2[_0xa4dd('0x1d')];var _0x575373;if(_0x1dc065>=_0x21d378){_0x1dc065=_0x21d378;_0x575373=0xc8;}else{_0x575373=0xce;}_0x1a312f[_0xa4dd('0x19')](_0x575373);return _0x1a312f[_0xa4dd('0x1f')](_0xa4dd('0x20'),_0x25aa75+'-'+_0x1dc065+'/'+_0x21d378)[_0xa4dd('0x21')](_0xe3acfe);}return null;};}function patchUpdates(_0x101e6c){return function(_0x4d1e53){try{jsonpatch['apply'](_0x4d1e53,_0x101e6c,!![]);}catch(_0x5db3ca){return BPromise[_0xa4dd('0x22')](_0x5db3ca);}return _0x4d1e53[_0xa4dd('0x23')]();};}function saveUpdates(_0x5b0077,_0x4ae5f6){return function(_0xa8e8c){if(_0xa8e8c){return _0xa8e8c['update'](_0x5b0077)[_0xa4dd('0x24')](function(_0x2a32f5){return _0x2a32f5;});}return null;};}function removeEntity(_0x40b889,_0x4e3b0b){return function(_0x168ee8){if(_0x168ee8){return _0x168ee8[_0xa4dd('0x25')]()['then'](function(){_0x40b889[_0xa4dd('0x19')](0xcc)[_0xa4dd('0x1a')]();});}};}function handleEntityNotFound(_0x53d5ee,_0x9fef41){return function(_0x40d9de){if(!_0x40d9de){_0x53d5ee[_0xa4dd('0x26')](0x194);}return _0x40d9de;};}function handleError(_0xaf86d9,_0x2a7bda){_0x2a7bda=_0x2a7bda||0x1f4;return function(_0x32fbd3){logger[_0xa4dd('0x27')](_0x32fbd3[_0xa4dd('0x28')]);if(_0x32fbd3[_0xa4dd('0x29')]){delete _0x32fbd3['name'];}_0xaf86d9['status'](_0x2a7bda)[_0xa4dd('0x2a')](_0x32fbd3);};}exports[_0xa4dd('0x2b')]=function(_0x261e3e,_0x41ec3a){var _0x5476a8={},_0xcbcf44={},_0x533cf7={'count':0x0,'rows':[]};var _0x261ed1=_[_0xa4dd('0x2c')](db['VoiceQueueReport'][_0xa4dd('0x2d')],function(_0x23a02a){return{'name':_0x23a02a[_0xa4dd('0x2e')],'type':_0x23a02a[_0xa4dd('0x2f')][_0xa4dd('0x30')]};});_0xcbcf44[_0xa4dd('0x31')]=_['map'](_0x261ed1,_0xa4dd('0x29'));_0xcbcf44[_0xa4dd('0x32')]=_[_0xa4dd('0x33')](_0x261e3e[_0xa4dd('0x32')]);_0xcbcf44[_0xa4dd('0x34')]=_['intersection'](_0xcbcf44[_0xa4dd('0x31')],_0xcbcf44['query']);_0x5476a8['attributes']=_[_0xa4dd('0x35')](_0xcbcf44[_0xa4dd('0x31')],qs[_0xa4dd('0x36')](_0x261e3e[_0xa4dd('0x32')][_0xa4dd('0x36')]));_0x5476a8[_0xa4dd('0x37')]=_0x5476a8[_0xa4dd('0x37')][_0xa4dd('0x38')]?_0x5476a8[_0xa4dd('0x37')]:_0xcbcf44[_0xa4dd('0x31')];if(!_0x261e3e['query'][_0xa4dd('0x39')]('nolimit')){_0x5476a8['limit']=qs[_0xa4dd('0x1d')](_0x261e3e[_0xa4dd('0x32')][_0xa4dd('0x1d')]);_0x5476a8[_0xa4dd('0x1b')]=qs[_0xa4dd('0x1b')](_0x261e3e[_0xa4dd('0x32')][_0xa4dd('0x1b')]);}_0x5476a8[_0xa4dd('0x3a')]=qs[_0xa4dd('0x3b')](_0x261e3e[_0xa4dd('0x32')][_0xa4dd('0x3b')]);_0x5476a8['where']=qs[_0xa4dd('0x34')](_['pick'](_0x261e3e['query'],_0xcbcf44['filters']),_0x261ed1);if(_0x261e3e[_0xa4dd('0x32')][_0xa4dd('0x3c')]){_0x5476a8[_0xa4dd('0x3d')]=_[_0xa4dd('0x3e')](_0x5476a8[_0xa4dd('0x3d')],{'$or':_[_0xa4dd('0x2c')](_0x261ed1,function(_0x10a671){if(_0x10a671[_0xa4dd('0x2f')]!==_0xa4dd('0x3f')){var _0x1153b2={};_0x1153b2[_0x10a671[_0xa4dd('0x29')]]={'$like':'%'+_0x261e3e['query'][_0xa4dd('0x3c')]+'%'};return _0x1153b2;}})});}_0x5476a8=_[_0xa4dd('0x3e')]({},_0x5476a8,_0x261e3e[_0xa4dd('0x40')]);var _0x2ecc08={'where':_0x5476a8[_0xa4dd('0x3d')]};return db[_0xa4dd('0x41')]['count'](_0x2ecc08)[_0xa4dd('0x24')](function(_0x48d624){_0x533cf7[_0xa4dd('0x1e')]=_0x48d624;if(_0x261e3e[_0xa4dd('0x32')][_0xa4dd('0x42')]){_0x5476a8['include']=[{'all':!![]}];}return db[_0xa4dd('0x41')][_0xa4dd('0x43')](_0x5476a8);})[_0xa4dd('0x24')](function(_0x51c18c){_0x533cf7[_0xa4dd('0x44')]=_0x51c18c;return _0x533cf7;})[_0xa4dd('0x24')](respondWithFilteredResult(_0x41ec3a,_0x5476a8))[_0xa4dd('0x45')](handleError(_0x41ec3a,null));};exports[_0xa4dd('0x46')]=function(_0x5eec0a,_0x1ab672){var _0x616769={'raw':![],'where':{'id':_0x5eec0a['params']['id']}},_0x5e2ed2={};_0x5e2ed2['model']=_[_0xa4dd('0x33')](db['VoiceQueueReport'][_0xa4dd('0x2d')]);_0x5e2ed2[_0xa4dd('0x32')]=_[_0xa4dd('0x33')](_0x5eec0a[_0xa4dd('0x32')]);_0x5e2ed2[_0xa4dd('0x34')]=_['intersection'](_0x5e2ed2['model'],_0x5e2ed2['query']);_0x616769[_0xa4dd('0x37')]=_[_0xa4dd('0x35')](_0x5e2ed2[_0xa4dd('0x31')],qs['fields'](_0x5eec0a['query']['fields']));_0x616769[_0xa4dd('0x37')]=_0x616769[_0xa4dd('0x37')][_0xa4dd('0x38')]?_0x616769[_0xa4dd('0x37')]:_0x5e2ed2[_0xa4dd('0x31')];if(_0x5eec0a[_0xa4dd('0x32')][_0xa4dd('0x42')]){_0x616769[_0xa4dd('0x47')]=[{'all':!![]}];}_0x616769=_[_0xa4dd('0x3e')]({},_0x616769,_0x5eec0a[_0xa4dd('0x40')]);return db[_0xa4dd('0x41')]['find'](_0x616769)[_0xa4dd('0x24')](handleEntityNotFound(_0x1ab672,null))[_0xa4dd('0x24')](respondWithResult(_0x1ab672,null))[_0xa4dd('0x45')](handleError(_0x1ab672,null));};exports[_0xa4dd('0x48')]=function(_0x33d5d1,_0x4043e5){return db[_0xa4dd('0x41')]['create'](_0x33d5d1[_0xa4dd('0x49')],{})[_0xa4dd('0x24')](respondWithResult(_0x4043e5,0xc9))['catch'](handleError(_0x4043e5,null));};exports[_0xa4dd('0x4a')]=function(_0x169ac5,_0x1d07f2){if(_0x169ac5[_0xa4dd('0x49')]['id']){delete _0x169ac5['body']['id'];}return db[_0xa4dd('0x41')]['find']({'where':{'id':_0x169ac5[_0xa4dd('0x4b')]['id']}})[_0xa4dd('0x24')](handleEntityNotFound(_0x1d07f2,null))[_0xa4dd('0x24')](saveUpdates(_0x169ac5[_0xa4dd('0x49')],null))[_0xa4dd('0x24')](respondWithResult(_0x1d07f2,null))[_0xa4dd('0x45')](handleError(_0x1d07f2,null));};exports[_0xa4dd('0x25')]=function(_0xe50e6e,_0x288ca1){return db['VoiceQueueReport'][_0xa4dd('0x4c')]({'where':{'id':_0xe50e6e['params']['id']}})[_0xa4dd('0x24')](handleEntityNotFound(_0x288ca1,null))[_0xa4dd('0x24')](removeEntity(_0x288ca1,null))[_0xa4dd('0x45')](handleError(_0x288ca1,null));};exports[_0xa4dd('0x4d')]=function(_0x34f38f,_0x454b52){return db[_0xa4dd('0x41')][_0xa4dd('0x4d')]()[_0xa4dd('0x24')](respondWithResult(_0x454b52,null))[_0xa4dd('0x45')](handleError(_0x454b52,null));};exports[_0xa4dd('0x4e')]=function(_0x35472b,_0x25e424){var _0x248308={},_0x1914c3={},_0x22c1f6={'count':0x0,'rows':[]};_0x1914c3[_0xa4dd('0x31')]=_[_0xa4dd('0x33')](db[_0xa4dd('0x41')][_0xa4dd('0x2d')]);_0x1914c3[_0xa4dd('0x32')]=_['keys'](_0x35472b['query']);_0x1914c3['filters']=_['intersection'](_0x1914c3[_0xa4dd('0x31')],_0x1914c3[_0xa4dd('0x32')]);_0x248308[_0xa4dd('0x37')]=_[_0xa4dd('0x35')](_0x1914c3[_0xa4dd('0x31')],qs[_0xa4dd('0x36')](_0x35472b[_0xa4dd('0x32')][_0xa4dd('0x36')]));_0x248308['attributes']=_0x248308[_0xa4dd('0x37')]['length']?_0x248308[_0xa4dd('0x37')]:_0x1914c3[_0xa4dd('0x31')];if(!_0x35472b['query'][_0xa4dd('0x39')](_0xa4dd('0x4f'))){_0x248308['limit']=qs['limit'](_0x35472b[_0xa4dd('0x32')][_0xa4dd('0x1d')]);_0x248308[_0xa4dd('0x1b')]=qs[_0xa4dd('0x1b')](_0x35472b[_0xa4dd('0x32')][_0xa4dd('0x1b')]);}_0x248308[_0xa4dd('0x3a')]=qs[_0xa4dd('0x3b')](_0x35472b[_0xa4dd('0x32')]['sort']);_0x248308[_0xa4dd('0x3d')]=qs[_0xa4dd('0x34')](_[_0xa4dd('0x50')](_0x35472b[_0xa4dd('0x32')],_0x1914c3[_0xa4dd('0x34')]));if(_0x35472b[_0xa4dd('0x32')][_0xa4dd('0x3c')]){_0x248308['where']=_[_0xa4dd('0x3e')](_0x248308[_0xa4dd('0x3d')],{'$or':_[_0xa4dd('0x2c')](_0x248308[_0xa4dd('0x37')],function(_0x367dfe){var _0x29aaa3={};_0x29aaa3[_0x367dfe]={'$like':'%'+_0x35472b[_0xa4dd('0x32')][_0xa4dd('0x3c')]+'%'};return _0x29aaa3;})});}_0x248308=_[_0xa4dd('0x3e')]({},_0x248308,_0x35472b['options']);var _0x1a3d8a={'where':_0x248308[_0xa4dd('0x3d')]};return db['VoiceQueueReport'][_0xa4dd('0x1e')](_0x1a3d8a)[_0xa4dd('0x24')](function(_0x2502b4){_0x22c1f6[_0xa4dd('0x1e')]=_0x2502b4;if(_0x35472b[_0xa4dd('0x32')]['includeAll']){_0x248308[_0xa4dd('0x47')]=[{'all':!![]}];}return db[_0xa4dd('0x41')][_0xa4dd('0x43')](_0x248308);})[_0xa4dd('0x24')](function(_0x3f6456){_0x22c1f6[_0xa4dd('0x44')]=_0x3f6456;return _0x22c1f6;})[_0xa4dd('0x24')](respondWithFilteredResult(_0x25e424,_0x248308,_0xa4dd('0x4e')))[_0xa4dd('0x45')](handleError(_0x25e424,null,_0xa4dd('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 34a15ae..ad28291 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.events.js +++ b/server/api/voiceQueueReport/voiceQueueReport.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea5=['remove','emit','hasOwnProperty','hook','exports','events','VoiceQueueReport','setMaxListeners','save'];(function(_0x560a65,_0x53fde6){var _0xaa9c0c=function(_0x110973){while(--_0x110973){_0x560a65['push'](_0x560a65['shift']());}};_0xaa9c0c(++_0x53fde6);}(_0x4ea5,0x149));var _0x54ea=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0x4ea5[_0xb725be];return _0x2f2424;};'use strict';var EventEmitter=require(_0x54ea('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x54ea('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x54ea('0x2')](0x0);var events={'afterCreate':_0x54ea('0x3'),'afterUpdate':'update','afterDestroy':_0x54ea('0x4')};function emitEvent(_0x4e9fec){return function(_0x1815a8,_0x1a1900,_0x4fb69f){VoiceQueueReportEvents[_0x54ea('0x5')](_0x4e9fec+':'+_0x1815a8['id'],_0x1815a8);VoiceQueueReportEvents[_0x54ea('0x5')](_0x4e9fec,_0x1815a8);_0x4fb69f(null);};}for(var e in events){if(events[_0x54ea('0x6')](e)){var event=events[e];VoiceQueueReport[_0x54ea('0x7')](e,emitEvent(event));}}module[_0x54ea('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x7eb8=['VoiceQueueReport','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7eb8,0x1e7));var _0x87eb=function(_0x1f9856,_0x95edf9){_0x1f9856=_0x1f9856-0x0;var _0x91341c=_0x7eb8[_0x1f9856];return _0x91341c;};'use strict';var EventEmitter=require(_0x87eb('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x87eb('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x87eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x87eb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1cd264){return function(_0x438310,_0x53f2ab,_0x2a61ae){VoiceQueueReportEvents[_0x87eb('0x4')](_0x1cd264+':'+_0x438310['id'],_0x438310);VoiceQueueReportEvents['emit'](_0x1cd264,_0x438310);_0x2a61ae(null);};}for(var e in events){if(events[_0x87eb('0x5')](e)){var event=events[e];VoiceQueueReport[_0x87eb('0x6')](e,emitEvent(event));}}module[_0x87eb('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index dda92f6..7bbef9d 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4264=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','calleridnum','lodash','util','../../config/logger','api'];(function(_0x5f18f6,_0x252373){var _0x5c09f6=function(_0x52ea2b){while(--_0x52ea2b){_0x5f18f6['push'](_0x5f18f6['shift']());}};_0x5c09f6(++_0x252373);}(_0x4264,0x6c));var _0x4426=function(_0x3f4816,_0x4d457f){_0x3f4816=_0x3f4816-0x0;var _0x3e2822=_0x4264[_0x3f4816];return _0x3e2822;};'use strict';var _=require(_0x4426('0x0'));var util=require(_0x4426('0x1'));var logger=require(_0x4426('0x2'))(_0x4426('0x3'));var moment=require(_0x4426('0x4'));var BPromise=require(_0x4426('0x5'));var rp=require(_0x4426('0x6'));var fs=require('fs');var path=require(_0x4426('0x7'));var rimraf=require(_0x4426('0x8'));var config=require(_0x4426('0x9'));var attributes=require(_0x4426('0xa'));module[_0x4426('0xb')]=function(_0x11dd79,_0x23b44e){return _0x11dd79['define']('VoiceQueueReport',attributes,{'tableName':_0x4426('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x4426('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a1c=['report_queue','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport'];(function(_0x53286a,_0x485c92){var _0x5730ff=function(_0x478c81){while(--_0x478c81){_0x53286a['push'](_0x53286a['shift']());}};_0x5730ff(++_0x485c92);}(_0x8a1c,0xa9));var _0xc8a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8a1c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc8a1('0x0'));var util=require(_0xc8a1('0x1'));var logger=require(_0xc8a1('0x2'))('api');var moment=require(_0xc8a1('0x3'));var BPromise=require(_0xc8a1('0x4'));var rp=require(_0xc8a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8a1('0x6'));var config=require(_0xc8a1('0x7'));var attributes=require(_0xc8a1('0x8'));module[_0xc8a1('0x9')]=function(_0x44456c,_0x2817cc){return _0x44456c['define'](_0xc8a1('0xa'),attributes,{'tableName':_0xc8a1('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 9dfb890..5596803 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.rpc.js +++ b/server/api/voiceQueueReport/voiceQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe71a=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueueReport','debug','VoiceQueueReport','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x41b73e,_0x5a187e){var _0x279f78=function(_0x4a27ea){while(--_0x4a27ea){_0x41b73e['push'](_0x41b73e['shift']());}};_0x279f78(++_0x5a187e);}(_0xe71a,0x1bc));var _0xae71=function(_0x4f39bb,_0x310461){_0x4f39bb=_0x4f39bb-0x0;var _0x2d77bd=_0xe71a[_0x4f39bb];return _0x2d77bd;};'use strict';var _=require('lodash');var util=require(_0xae71('0x0'));var moment=require(_0xae71('0x1'));var BPromise=require(_0xae71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae71('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xae71('0x4'))(_0xae71('0x5'));var config=require(_0xae71('0x6'));var jayson=require(_0xae71('0x7'));var client=jayson[_0xae71('0x8')][_0xae71('0x9')]({'port':0x232a});config[_0xae71('0xa')]=_[_0xae71('0xb')](config[_0xae71('0xa')],{'host':_0xae71('0xc'),'port':0x18eb});var socket=require(_0xae71('0xd'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x44d7b7,_0x9c73ad,_0x38a515){return new BPromise(function(_0x580d16,_0x4723e8){return client[_0xae71('0xe')](_0x44d7b7,_0x38a515)['then'](function(_0x4b57c6){logger[_0xae71('0xf')](_0xae71('0x10'),_0x9c73ad,_0xae71('0x11'));logger['debug'](_0xae71('0x12'),_0x9c73ad,_0xae71('0x11'),JSON[_0xae71('0x13')](_0x4b57c6));if(_0x4b57c6['error']){if(_0x4b57c6['error']['code']===0x1f4){logger[_0xae71('0x14')](_0xae71('0x10'),_0x9c73ad,_0x4b57c6[_0xae71('0x14')][_0xae71('0x15')]);return _0x4723e8(_0x4b57c6[_0xae71('0x14')][_0xae71('0x15')]);}logger[_0xae71('0x14')](_0xae71('0x10'),_0x9c73ad,_0x4b57c6[_0xae71('0x14')][_0xae71('0x15')]);return _0x580d16(_0x4b57c6['error'][_0xae71('0x15')]);}else{logger['info'](_0xae71('0x10'),_0x9c73ad,_0xae71('0x11'));_0x580d16(_0x4b57c6[_0xae71('0x16')][_0xae71('0x15')]);}})[_0xae71('0x17')](function(_0x3bede6){logger[_0xae71('0x14')](_0xae71('0x10'),_0x9c73ad,_0x3bede6);_0x4723e8(_0x3bede6);});});}exports['GetVoiceQueueReport']=function(_0x2e6810){var _0x24d1f2=this;return new Promise(function(_0x48a1d9,_0x491dd0){return db['VoiceQueueReport'][_0xae71('0x18')]({'raw':_0x2e6810[_0xae71('0x19')]?_0x2e6810[_0xae71('0x19')][_0xae71('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e6810[_0xae71('0x19')]?_0x2e6810['options'][_0xae71('0x1b')]||null:null,'attributes':_0x2e6810['options']?_0x2e6810[_0xae71('0x19')][_0xae71('0x1c')]||null:null,'limit':_0x2e6810['options']?_0x2e6810[_0xae71('0x19')][_0xae71('0x1d')]||null:null,'include':_0x2e6810[_0xae71('0x19')]?_0x2e6810['options'][_0xae71('0x1e')]?_[_0xae71('0x1f')](_0x2e6810[_0xae71('0x19')][_0xae71('0x1e')],function(_0x387f35){return{'model':db[_0x387f35['model']],'as':_0x387f35['as'],'attributes':_0x387f35[_0xae71('0x1c')],'include':_0x387f35[_0xae71('0x1e')]?_[_0xae71('0x1f')](_0x387f35[_0xae71('0x1e')],function(_0x1370be){return{'model':db[_0x1370be['model']],'as':_0x1370be['as'],'attributes':_0x1370be[_0xae71('0x1c')],'include':_0x1370be[_0xae71('0x1e')]?_[_0xae71('0x1f')](_0x1370be[_0xae71('0x1e')],function(_0xffde38){return{'model':db[_0xffde38[_0xae71('0x20')]],'as':_0xffde38['as'],'attributes':_0xffde38[_0xae71('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae71('0x21')](function(_0x4d04c4){logger[_0xae71('0xf')](_0xae71('0x22'),_0x2e6810);logger[_0xae71('0x23')](_0xae71('0x22'),_0x2e6810,JSON[_0xae71('0x13')](_0x4d04c4));_0x48a1d9(_0x4d04c4);})[_0xae71('0x17')](function(_0x1ec96f){logger[_0xae71('0x14')](_0xae71('0x22'),_0x1ec96f[_0xae71('0x15')],_0x2e6810);_0x491dd0(_0x24d1f2['error'](0x1f4,_0x1ec96f[_0xae71('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0xbd51f9){var _0x542fda=this;return new Promise(function(_0x360f0c,_0x5f4d69){return db[_0xae71('0x24')][_0xae71('0x25')](_0xbd51f9[_0xae71('0x26')],{'raw':_0xbd51f9['options']?_0xbd51f9[_0xae71('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xae71('0x21')](function(_0x4275ee){logger[_0xae71('0xf')]('CreateVoiceQueueReport',_0xbd51f9);logger[_0xae71('0x23')](_0xae71('0x27'),_0xbd51f9,JSON['stringify'](_0x4275ee));_0x360f0c(_0x4275ee);})[_0xae71('0x17')](function(_0x1a993c){logger[_0xae71('0x14')](_0xae71('0x27'),_0x1a993c['message'],_0xbd51f9);_0x5f4d69(_0x542fda[_0xae71('0x14')](0x1f4,_0x1a993c['message']));});});};exports[_0xae71('0x28')]=function(_0x5e904c){var _0x34dfa9=this;return new Promise(function(_0x2421eb,_0x39e23e){return db[_0xae71('0x24')][_0xae71('0x29')](_0x5e904c[_0xae71('0x26')],{'raw':_0x5e904c[_0xae71('0x19')]?_0x5e904c[_0xae71('0x19')][_0xae71('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e904c['options']?_0x5e904c[_0xae71('0x19')][_0xae71('0x1b')]||null:null,'attributes':_0x5e904c[_0xae71('0x19')]?_0x5e904c[_0xae71('0x19')][_0xae71('0x1c')]||null:null,'limit':_0x5e904c[_0xae71('0x19')]?_0x5e904c[_0xae71('0x19')][_0xae71('0x1d')]||null:null})['then'](function(_0x889f4b){logger[_0xae71('0xf')]('UpdateVoiceQueueReport',_0x5e904c);logger[_0xae71('0x23')](_0xae71('0x28'),_0x5e904c,JSON['stringify'](_0x889f4b));_0x2421eb(_0x889f4b);})[_0xae71('0x17')](function(_0x5d6cfa){logger['error'](_0xae71('0x28'),_0x5d6cfa[_0xae71('0x15')],_0x5e904c);_0x39e23e(_0x34dfa9[_0xae71('0x14')](0x1f4,_0x5d6cfa[_0xae71('0x15')]));});});}; \ No newline at end of file +var _0xe5d4=['request\x20sent','debug','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','then','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x20e295,_0x308599){var _0x33ffbe=function(_0x2eeb46){while(--_0x2eeb46){_0x20e295['push'](_0x20e295['shift']());}};_0x33ffbe(++_0x308599);}(_0xe5d4,0xea));var _0x4e5d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe5d4[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x4e5d('0x0'));var moment=require('moment');var BPromise=require(_0x4e5d('0x1'));var rs=require(_0x4e5d('0x2'));var fs=require('fs');var Redis=require(_0x4e5d('0x3'));var db=require(_0x4e5d('0x4'))['db'];var utils=require(_0x4e5d('0x5'));var logger=require(_0x4e5d('0x6'))('rpc');var config=require(_0x4e5d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4e5d('0x8')]['http']({'port':0x232a});config[_0x4e5d('0x9')]=_[_0x4e5d('0xa')](config[_0x4e5d('0x9')],{'host':_0x4e5d('0xb'),'port':0x18eb});var socket=require(_0x4e5d('0xc'))(new Redis(config[_0x4e5d('0x9')]));require(_0x4e5d('0xd'))[_0x4e5d('0xe')](socket);function respondWithRpcPromise(_0x363cd5,_0x3fac0e,_0x2a6662){return new BPromise(function(_0x865596,_0x5ebb12){return client[_0x4e5d('0xf')](_0x363cd5,_0x2a6662)['then'](function(_0x3d40c8){logger[_0x4e5d('0x10')](_0x4e5d('0x11'),_0x3fac0e,_0x4e5d('0x12'));logger[_0x4e5d('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x3fac0e,_0x4e5d('0x12'),JSON[_0x4e5d('0x14')](_0x3d40c8));if(_0x3d40c8['error']){if(_0x3d40c8[_0x4e5d('0x15')][_0x4e5d('0x16')]===0x1f4){logger[_0x4e5d('0x15')](_0x4e5d('0x11'),_0x3fac0e,_0x3d40c8[_0x4e5d('0x15')][_0x4e5d('0x17')]);return _0x5ebb12(_0x3d40c8[_0x4e5d('0x15')][_0x4e5d('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x3fac0e,_0x3d40c8['error'][_0x4e5d('0x17')]);return _0x865596(_0x3d40c8[_0x4e5d('0x15')][_0x4e5d('0x17')]);}else{logger[_0x4e5d('0x10')](_0x4e5d('0x11'),_0x3fac0e,_0x4e5d('0x12'));_0x865596(_0x3d40c8[_0x4e5d('0x18')][_0x4e5d('0x17')]);}})[_0x4e5d('0x19')](function(_0x12880f){logger[_0x4e5d('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x3fac0e,_0x12880f);_0x5ebb12(_0x12880f);});});}exports['GetVoiceQueueReport']=function(_0x28246a){var _0x299fc2=this;return new Promise(function(_0xddb427,_0x59703c){return db[_0x4e5d('0x1a')][_0x4e5d('0x1b')]({'raw':_0x28246a[_0x4e5d('0x1c')]?_0x28246a[_0x4e5d('0x1c')][_0x4e5d('0x1d')]===undefined?!![]:![]:!![],'where':_0x28246a[_0x4e5d('0x1c')]?_0x28246a[_0x4e5d('0x1c')][_0x4e5d('0x1e')]||null:null,'attributes':_0x28246a['options']?_0x28246a[_0x4e5d('0x1c')][_0x4e5d('0x1f')]||null:null,'limit':_0x28246a[_0x4e5d('0x1c')]?_0x28246a['options']['limit']||null:null,'include':_0x28246a[_0x4e5d('0x1c')]?_0x28246a[_0x4e5d('0x1c')][_0x4e5d('0x20')]?_[_0x4e5d('0x21')](_0x28246a['options'][_0x4e5d('0x20')],function(_0x56da6f){return{'model':db[_0x56da6f[_0x4e5d('0x22')]],'as':_0x56da6f['as'],'attributes':_0x56da6f[_0x4e5d('0x1f')],'include':_0x56da6f['include']?_['map'](_0x56da6f['include'],function(_0x459a5d){return{'model':db[_0x459a5d[_0x4e5d('0x22')]],'as':_0x459a5d['as'],'attributes':_0x459a5d['attributes'],'include':_0x459a5d[_0x4e5d('0x20')]?_[_0x4e5d('0x21')](_0x459a5d['include'],function(_0x14a89f){return{'model':db[_0x14a89f[_0x4e5d('0x22')]],'as':_0x14a89f['as'],'attributes':_0x14a89f[_0x4e5d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4e5d('0x23')](function(_0x3a52ce){logger[_0x4e5d('0x10')]('GetVoiceQueueReport',_0x28246a);logger[_0x4e5d('0x13')](_0x4e5d('0x24'),_0x28246a,JSON[_0x4e5d('0x14')](_0x3a52ce));_0xddb427(_0x3a52ce);})[_0x4e5d('0x19')](function(_0x5d38c2){logger['error'](_0x4e5d('0x24'),_0x5d38c2[_0x4e5d('0x17')],_0x28246a);_0x59703c(_0x299fc2[_0x4e5d('0x15')](0x1f4,_0x5d38c2[_0x4e5d('0x17')]));});});};exports[_0x4e5d('0x25')]=function(_0x2c580a){var _0x13bd29=this;return new Promise(function(_0x4eeb51,_0xf41df5){return db['VoiceQueueReport'][_0x4e5d('0x26')](_0x2c580a[_0x4e5d('0x27')],{'raw':_0x2c580a[_0x4e5d('0x1c')]?_0x2c580a[_0x4e5d('0x1c')][_0x4e5d('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x429686){logger[_0x4e5d('0x10')](_0x4e5d('0x25'),_0x2c580a);logger[_0x4e5d('0x13')](_0x4e5d('0x25'),_0x2c580a,JSON['stringify'](_0x429686));_0x4eeb51(_0x429686);})[_0x4e5d('0x19')](function(_0x5a8787){logger['error'](_0x4e5d('0x25'),_0x5a8787[_0x4e5d('0x17')],_0x2c580a);_0xf41df5(_0x13bd29[_0x4e5d('0x15')](0x1f4,_0x5a8787[_0x4e5d('0x17')]));});});};exports[_0x4e5d('0x28')]=function(_0x5e5492){var _0x436b58=this;return new Promise(function(_0x22c559,_0x597a93){return db[_0x4e5d('0x1a')]['update'](_0x5e5492['body'],{'raw':_0x5e5492[_0x4e5d('0x1c')]?_0x5e5492[_0x4e5d('0x1c')][_0x4e5d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e5492[_0x4e5d('0x1c')]?_0x5e5492[_0x4e5d('0x1c')][_0x4e5d('0x1e')]||null:null,'attributes':_0x5e5492[_0x4e5d('0x1c')]?_0x5e5492[_0x4e5d('0x1c')][_0x4e5d('0x1f')]||null:null,'limit':_0x5e5492[_0x4e5d('0x1c')]?_0x5e5492[_0x4e5d('0x1c')][_0x4e5d('0x29')]||null:null})['then'](function(_0x267e08){logger[_0x4e5d('0x10')](_0x4e5d('0x28'),_0x5e5492);logger[_0x4e5d('0x13')](_0x4e5d('0x28'),_0x5e5492,JSON[_0x4e5d('0x14')](_0x267e08));_0x22c559(_0x267e08);})[_0x4e5d('0x19')](function(_0x3c2484){logger[_0x4e5d('0x15')](_0x4e5d('0x28'),_0x3c2484['message'],_0x5e5492);_0x597a93(_0x436b58['error'](0x1f4,_0x3c2484[_0x4e5d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 77efd61..6e3d476 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe953=['length','voiceQueueReport:','removeListener'];(function(_0xbfcfdd,_0xed133e){var _0x49936e=function(_0x46ca37){while(--_0x46ca37){_0xbfcfdd['push'](_0xbfcfdd['shift']());}};_0x49936e(++_0xed133e);}(_0xe953,0x1d0));var _0x3e95=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xe953[_0x1e4360];return _0x31e6b4;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save','remove','update'];function createListener(_0x56947e,_0x1afca4){return function(_0x31b87e){_0x1afca4['emit'](_0x56947e,_0x31b87e);};}function removeListener(_0x46f343,_0x5a0541){return function(){VoiceQueueReportEvents[_0x3e95('0x0')](_0x46f343,_0x5a0541);};}exports['register']=function(_0x30637c){for(var _0x3faa2b=0x0,_0x45f703=events[_0x3e95('0x1')];_0x3faa2b<_0x45f703;_0x3faa2b++){var _0x421e13=events[_0x3faa2b];var _0x5bb380=createListener(_0x3e95('0x2')+_0x421e13,_0x30637c);VoiceQueueReportEvents['on'](_0x421e13,_0x5bb380);}}; \ No newline at end of file +var _0x4784=['emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x24083e,_0x27814c){var _0x23afa1=function(_0x54749e){while(--_0x54749e){_0x24083e['push'](_0x24083e['shift']());}};_0x23afa1(++_0x27814c);}(_0x4784,0xe4));var _0x4478=function(_0x238d10,_0x18534e){_0x238d10=_0x238d10-0x0;var _0x4d5b76=_0x4784[_0x238d10];return _0x4d5b76;};'use strict';var VoiceQueueReportEvents=require(_0x4478('0x0'));var events=[_0x4478('0x1'),_0x4478('0x2'),_0x4478('0x3')];function createListener(_0x2da6a8,_0x9bad45){return function(_0x4ff3a7){_0x9bad45[_0x4478('0x4')](_0x2da6a8,_0x4ff3a7);};}function removeListener(_0xa4e8bb,_0x1e487c){return function(){VoiceQueueReportEvents['removeListener'](_0xa4e8bb,_0x1e487c);};}exports[_0x4478('0x5')]=function(_0x4ce0c1){for(var _0x42d230=0x0,_0x4858da=events[_0x4478('0x6')];_0x42d230<_0x4858da;_0x42d230++){var _0xe013ab=events[_0x42d230];var _0x3cd15f=createListener(_0x4478('0x7')+_0xe013ab,_0x4ce0c1);VoiceQueueReportEvents['on'](_0xe013ab,_0x3cd15f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 967d5f6..7065643 100644 --- a/server/api/voiceQueuesLog/index.js +++ b/server/api/voiceQueuesLog/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb6f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','index','get','/:id','isAuthenticated','post','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xdb6f,0x93));var _0xfdb6=function(_0x5ad00b,_0x22c334){_0x5ad00b=_0x5ad00b-0x0;var _0x2aab79=_0xdb6f[_0x5ad00b];return _0x2aab79;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfdb6('0x0'));var timeout=require(_0xfdb6('0x1'));var express=require(_0xfdb6('0x2'));var router=express[_0xfdb6('0x3')]();var fs_extra=require(_0xfdb6('0x4'));var auth=require(_0xfdb6('0x5'));var interaction=require(_0xfdb6('0x6'));var config=require(_0xfdb6('0x7'));var controller=require(_0xfdb6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfdb6('0x9')]);router[_0xfdb6('0xa')](_0xfdb6('0xb'),auth[_0xfdb6('0xc')](),controller['show']);router[_0xfdb6('0xd')]('/',auth['isAuthenticated'](),controller[_0xfdb6('0xe')]);router[_0xfdb6('0xf')](_0xfdb6('0xb'),auth['isAuthenticated'](),controller[_0xfdb6('0x10')]);router['delete'](_0xfdb6('0xb'),auth[_0xfdb6('0xc')](),controller[_0xfdb6('0x11')]);module[_0xfdb6('0x12')]=router; \ No newline at end of file +var _0xff98=['fs-extra','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','util','path','connect-timeout','express'];(function(_0x314c05,_0x221556){var _0x46d499=function(_0x4dff0a){while(--_0x4dff0a){_0x314c05['push'](_0x314c05['shift']());}};_0x46d499(++_0x221556);}(_0xff98,0x9c));var _0x8ff9=function(_0x1e61c6,_0x48cc07){_0x1e61c6=_0x1e61c6-0x0;var _0x30d7e1=_0xff98[_0x1e61c6];return _0x30d7e1;};'use strict';var multer=require('multer');var util=require(_0x8ff9('0x0'));var path=require(_0x8ff9('0x1'));var timeout=require(_0x8ff9('0x2'));var express=require(_0x8ff9('0x3'));var router=express['Router']();var fs_extra=require(_0x8ff9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8ff9('0x5'));var config=require('../../config/environment');var controller=require(_0x8ff9('0x6'));router['get']('/',auth[_0x8ff9('0x7')](),controller[_0x8ff9('0x8')]);router[_0x8ff9('0x9')](_0x8ff9('0xa'),auth[_0x8ff9('0x7')](),controller[_0x8ff9('0xb')]);router[_0x8ff9('0xc')]('/',auth[_0x8ff9('0x7')](),controller['create']);router[_0x8ff9('0xd')](_0x8ff9('0xa'),auth[_0x8ff9('0x7')](),controller[_0x8ff9('0xe')]);router[_0x8ff9('0xf')](_0x8ff9('0xa'),auth[_0x8ff9('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 616a198..4e6762c 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebec=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0xebec,0x129));var _0xcebe=function(_0x589127,_0xa2b9f4){_0x589127=_0x589127-0x0;var _0x151dab=_0xebec[_0x589127];return _0x151dab;};'use strict';var Sequelize=require(_0xcebe('0x0'));var moment=require(_0xcebe('0x1'));module[_0xcebe('0x2')]={'time':{'type':Sequelize[_0xcebe('0x3')]},'callid':{'type':Sequelize[_0xcebe('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xcebe('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xcebe('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xcebe('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xcebe('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xcebe('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xcebe('0x5')](_0xcebe('0x6'))}}; \ No newline at end of file +var _0xf411=['STRING','sequelize','moment','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xf411,0x119));var _0x1f41=function(_0x1a5038,_0x178cfc){_0x1a5038=_0x1a5038-0x0;var _0x737034=_0xf411[_0x1a5038];return _0x737034;};'use strict';var Sequelize=require(_0x1f41('0x0'));var moment=require(_0x1f41('0x1'));module[_0x1f41('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x1f41('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1f41('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1f41('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1f41('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1f41('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x1f41('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1f41('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1f41('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e9f6df3..7f4abed 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2591=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','type','model','map','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoiceQueuesLog','includeAll','findAll','rows','catch','show','rawAttributes','fields','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x1f9440,_0x5059cf){var _0x54550e=function(_0x3bf2fe){while(--_0x3bf2fe){_0x1f9440['push'](_0x1f9440['shift']());}};_0x54550e(++_0x5059cf);}(_0x2591,0xc3));var _0x1259=function(_0x1e80fd,_0x460cb1){_0x1e80fd=_0x1e80fd-0x0;var _0xc3791a=_0x2591[_0x1e80fd];return _0xc3791a;};'use strict';var emlformat=require(_0x1259('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1259('0x1'));var jsonpatch=require(_0x1259('0x2'));var rp=require(_0x1259('0x3'));var moment=require(_0x1259('0x4'));var BPromise=require(_0x1259('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1259('0x6'));var sox=require(_0x1259('0x7'));var csv=require(_0x1259('0x8'));var ejs=require(_0x1259('0x9'));var fs=require('fs');var fs_extra=require(_0x1259('0xa'));var _=require(_0x1259('0xb'));var squel=require(_0x1259('0xc'));var crypto=require(_0x1259('0xd'));var jsforce=require(_0x1259('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1259('0x8'));var querystring=require('querystring');var Papa=require(_0x1259('0xf'));var Redis=require(_0x1259('0x10'));var authService=require(_0x1259('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1259('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1259('0x13'))(_0x1259('0x14'));var utils=require('../../config/utils');var config=require(_0x1259('0x15'));var licenseUtil=require(_0x1259('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcac17d,_0x3c4d8a){_0x3c4d8a=_0x3c4d8a||0xcc;return function(_0x3ee950){if(_0x3ee950){return _0xcac17d[_0x1259('0x17')](_0x3c4d8a);}return _0xcac17d[_0x1259('0x18')](_0x3c4d8a)[_0x1259('0x19')]();};}function respondWithResult(_0x4c5077,_0x10b72f){_0x10b72f=_0x10b72f||0xc8;return function(_0x6118fe){if(_0x6118fe){return _0x4c5077['status'](_0x10b72f)[_0x1259('0x1a')](_0x6118fe);}};}function respondWithFilteredResult(_0x4d45fd,_0xf25e34){return function(_0x21a9f0){if(_0x21a9f0){var _0x39463b=typeof _0xf25e34[_0x1259('0x1b')]===_0x1259('0x1c')&&typeof _0xf25e34[_0x1259('0x1d')]===_0x1259('0x1c');var _0x4b3037=_0x21a9f0[_0x1259('0x1e')];var _0x1de746=_0x39463b?0x0:_0xf25e34[_0x1259('0x1b')];var _0x59538c=_0x39463b?_0x21a9f0[_0x1259('0x1e')]:_0xf25e34[_0x1259('0x1b')]+_0xf25e34[_0x1259('0x1d')];var _0x10a45f;if(_0x59538c>=_0x4b3037){_0x59538c=_0x4b3037;_0x10a45f=0xc8;}else{_0x10a45f=0xce;}_0x4d45fd[_0x1259('0x18')](_0x10a45f);return _0x4d45fd['set']('Content-Range',_0x1de746+'-'+_0x59538c+'/'+_0x4b3037)['json'](_0x21a9f0);}return null;};}function patchUpdates(_0x4523e2){return function(_0x203182){try{jsonpatch[_0x1259('0x1f')](_0x203182,_0x4523e2,!![]);}catch(_0x150c66){return BPromise[_0x1259('0x20')](_0x150c66);}return _0x203182[_0x1259('0x21')]();};}function saveUpdates(_0x21c529,_0x496387){return function(_0x449cec){if(_0x449cec){return _0x449cec[_0x1259('0x22')](_0x21c529)[_0x1259('0x23')](function(_0x246ff5){return _0x246ff5;});}return null;};}function removeEntity(_0x330ab3,_0x2bfc9d){return function(_0x15b307){if(_0x15b307){return _0x15b307[_0x1259('0x24')]()[_0x1259('0x23')](function(){_0x330ab3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd51cb7,_0xe8eaf9){return function(_0x3b9005){if(!_0x3b9005){_0xd51cb7[_0x1259('0x17')](0x194);}return _0x3b9005;};}function handleError(_0x35416a,_0x5f1ab2){_0x5f1ab2=_0x5f1ab2||0x1f4;return function(_0x2678c9){logger[_0x1259('0x25')](_0x2678c9[_0x1259('0x26')]);if(_0x2678c9[_0x1259('0x27')]){delete _0x2678c9[_0x1259('0x27')];}_0x35416a[_0x1259('0x18')](_0x5f1ab2)[_0x1259('0x28')](_0x2678c9);};}exports[_0x1259('0x29')]=function(_0x3c3d0d,_0x23ec29){var _0x112519={},_0x459bf3={},_0x57ca4b={'count':0x0,'rows':[]};var _0x5151b3=_['map'](db['VoiceQueuesLog']['rawAttributes'],function(_0x36ecea){return{'name':_0x36ecea['fieldName'],'type':_0x36ecea[_0x1259('0x2a')]['key']};});_0x459bf3[_0x1259('0x2b')]=_[_0x1259('0x2c')](_0x5151b3,_0x1259('0x27'));_0x459bf3[_0x1259('0x2d')]=_[_0x1259('0x2e')](_0x3c3d0d['query']);_0x459bf3['filters']=_[_0x1259('0x2f')](_0x459bf3[_0x1259('0x2b')],_0x459bf3[_0x1259('0x2d')]);_0x112519['attributes']=_[_0x1259('0x2f')](_0x459bf3[_0x1259('0x2b')],qs['fields'](_0x3c3d0d[_0x1259('0x2d')]['fields']));_0x112519[_0x1259('0x30')]=_0x112519['attributes'][_0x1259('0x31')]?_0x112519['attributes']:_0x459bf3['model'];if(!_0x3c3d0d[_0x1259('0x2d')][_0x1259('0x32')]('nolimit')){_0x112519[_0x1259('0x1d')]=qs[_0x1259('0x1d')](_0x3c3d0d[_0x1259('0x2d')]['limit']);_0x112519[_0x1259('0x1b')]=qs[_0x1259('0x1b')](_0x3c3d0d[_0x1259('0x2d')][_0x1259('0x1b')]);}_0x112519[_0x1259('0x33')]=qs[_0x1259('0x34')](_0x3c3d0d[_0x1259('0x2d')][_0x1259('0x34')]);_0x112519[_0x1259('0x35')]=qs[_0x1259('0x36')](_[_0x1259('0x37')](_0x3c3d0d[_0x1259('0x2d')],_0x459bf3[_0x1259('0x36')]),_0x5151b3);if(_0x3c3d0d['query'][_0x1259('0x38')]){_0x112519[_0x1259('0x35')]=_['merge'](_0x112519['where'],{'$or':_[_0x1259('0x2c')](_0x5151b3,function(_0x10e48d){if(_0x10e48d['type']!==_0x1259('0x39')){var _0x122993={};_0x122993[_0x10e48d[_0x1259('0x27')]]={'$like':'%'+_0x3c3d0d[_0x1259('0x2d')][_0x1259('0x38')]+'%'};return _0x122993;}})});}_0x112519=_[_0x1259('0x3a')]({},_0x112519,_0x3c3d0d[_0x1259('0x3b')]);var _0x31a493={'where':_0x112519['where']};return db[_0x1259('0x3c')][_0x1259('0x1e')](_0x31a493)[_0x1259('0x23')](function(_0x41011a){_0x57ca4b[_0x1259('0x1e')]=_0x41011a;if(_0x3c3d0d[_0x1259('0x2d')][_0x1259('0x3d')]){_0x112519['include']=[{'all':!![]}];}return db[_0x1259('0x3c')][_0x1259('0x3e')](_0x112519);})[_0x1259('0x23')](function(_0x49de8b){_0x57ca4b[_0x1259('0x3f')]=_0x49de8b;return _0x57ca4b;})[_0x1259('0x23')](respondWithFilteredResult(_0x23ec29,_0x112519))[_0x1259('0x40')](handleError(_0x23ec29,null));};exports[_0x1259('0x41')]=function(_0x1083f7,_0x19d1f2){var _0xa0ce8={'raw':!![],'where':{'id':_0x1083f7['params']['id']}},_0x3c5172={};_0x3c5172[_0x1259('0x2b')]=_[_0x1259('0x2e')](db[_0x1259('0x3c')][_0x1259('0x42')]);_0x3c5172[_0x1259('0x2d')]=_[_0x1259('0x2e')](_0x1083f7[_0x1259('0x2d')]);_0x3c5172[_0x1259('0x36')]=_[_0x1259('0x2f')](_0x3c5172[_0x1259('0x2b')],_0x3c5172[_0x1259('0x2d')]);_0xa0ce8[_0x1259('0x30')]=_[_0x1259('0x2f')](_0x3c5172[_0x1259('0x2b')],qs[_0x1259('0x43')](_0x1083f7[_0x1259('0x2d')][_0x1259('0x43')]));_0xa0ce8[_0x1259('0x30')]=_0xa0ce8['attributes'][_0x1259('0x31')]?_0xa0ce8[_0x1259('0x30')]:_0x3c5172[_0x1259('0x2b')];if(_0x1083f7['query'][_0x1259('0x3d')]){_0xa0ce8['include']=[{'all':!![]}];}_0xa0ce8=_[_0x1259('0x3a')]({},_0xa0ce8,_0x1083f7[_0x1259('0x3b')]);return db['VoiceQueuesLog']['find'](_0xa0ce8)[_0x1259('0x23')](handleEntityNotFound(_0x19d1f2,null))[_0x1259('0x23')](respondWithResult(_0x19d1f2,null))[_0x1259('0x40')](handleError(_0x19d1f2,null));};exports['create']=function(_0x5b2c5d,_0x4d5cfa){return db[_0x1259('0x3c')][_0x1259('0x44')](_0x5b2c5d['body'],{})[_0x1259('0x23')](respondWithResult(_0x4d5cfa,0xc9))[_0x1259('0x40')](handleError(_0x4d5cfa,null));};exports['update']=function(_0x4cf7b4,_0x7f9657){if(_0x4cf7b4['body']['id']){delete _0x4cf7b4[_0x1259('0x45')]['id'];}return db['VoiceQueuesLog'][_0x1259('0x46')]({'where':{'id':_0x4cf7b4['params']['id']}})[_0x1259('0x23')](handleEntityNotFound(_0x7f9657,null))[_0x1259('0x23')](saveUpdates(_0x4cf7b4['body'],null))['then'](respondWithResult(_0x7f9657,null))[_0x1259('0x40')](handleError(_0x7f9657,null));};exports[_0x1259('0x24')]=function(_0x915aaf,_0x19328a){return db['VoiceQueuesLog'][_0x1259('0x46')]({'where':{'id':_0x915aaf[_0x1259('0x47')]['id']}})[_0x1259('0x23')](handleEntityNotFound(_0x19328a,null))['then'](removeEntity(_0x19328a,null))[_0x1259('0x40')](handleError(_0x19328a,null));}; \ No newline at end of file +var _0xa338=['create','VoiceQueuesLog','body','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','stack','index','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','include','findAll','catch','params','length','includeAll','find'];(function(_0x5d5e77,_0x340461){var _0x87f0ab=function(_0x318885){while(--_0x318885){_0x5d5e77['push'](_0x5d5e77['shift']());}};_0x87f0ab(++_0x340461);}(_0xa338,0x117));var _0x8a33=function(_0x263580,_0x421012){_0x263580=_0x263580-0x0;var _0x408ae3=_0xa338[_0x263580];return _0x408ae3;};'use strict';var emlformat=require(_0x8a33('0x0'));var rimraf=require(_0x8a33('0x1'));var zipdir=require(_0x8a33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a33('0x3'));var moment=require(_0x8a33('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8a33('0x5'));var path=require(_0x8a33('0x6'));var sox=require(_0x8a33('0x7'));var csv=require(_0x8a33('0x8'));var ejs=require(_0x8a33('0x9'));var fs=require('fs');var fs_extra=require(_0x8a33('0xa'));var _=require(_0x8a33('0xb'));var squel=require(_0x8a33('0xc'));var crypto=require(_0x8a33('0xd'));var jsforce=require(_0x8a33('0xe'));var deskjs=require(_0x8a33('0xf'));var toCsv=require(_0x8a33('0x8'));var querystring=require(_0x8a33('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a33('0x11'))('api');var utils=require(_0x8a33('0x12'));var config=require(_0x8a33('0x13'));var licenseUtil=require(_0x8a33('0x14'));var db=require(_0x8a33('0x15'))['db'];function respondWithStatusCode(_0x48b5e0,_0x4bcbe7){_0x4bcbe7=_0x4bcbe7||0xcc;return function(_0x153ce9){if(_0x153ce9){return _0x48b5e0['sendStatus'](_0x4bcbe7);}return _0x48b5e0[_0x8a33('0x16')](_0x4bcbe7)[_0x8a33('0x17')]();};}function respondWithResult(_0x16434b,_0x8a3142){_0x8a3142=_0x8a3142||0xc8;return function(_0x483cd2){if(_0x483cd2){return _0x16434b[_0x8a33('0x16')](_0x8a3142)[_0x8a33('0x18')](_0x483cd2);}};}function respondWithFilteredResult(_0x4e557a,_0x311123){return function(_0x34ae18){if(_0x34ae18){var _0x2cf306=typeof _0x311123['offset']===_0x8a33('0x19')&&typeof _0x311123[_0x8a33('0x1a')]===_0x8a33('0x19');var _0x5bccac=_0x34ae18[_0x8a33('0x1b')];var _0x4f95bc=_0x2cf306?0x0:_0x311123[_0x8a33('0x1c')];var _0x1a850b=_0x2cf306?_0x34ae18[_0x8a33('0x1b')]:_0x311123[_0x8a33('0x1c')]+_0x311123[_0x8a33('0x1a')];var _0x2f7739;if(_0x1a850b>=_0x5bccac){_0x1a850b=_0x5bccac;_0x2f7739=0xc8;}else{_0x2f7739=0xce;}_0x4e557a[_0x8a33('0x16')](_0x2f7739);return _0x4e557a[_0x8a33('0x1d')](_0x8a33('0x1e'),_0x4f95bc+'-'+_0x1a850b+'/'+_0x5bccac)['json'](_0x34ae18);}return null;};}function patchUpdates(_0x2887cc){return function(_0x2a015f){try{jsonpatch['apply'](_0x2a015f,_0x2887cc,!![]);}catch(_0x26523a){return BPromise['reject'](_0x26523a);}return _0x2a015f['save']();};}function saveUpdates(_0x1b1957,_0x451a06){return function(_0x38d944){if(_0x38d944){return _0x38d944[_0x8a33('0x1f')](_0x1b1957)[_0x8a33('0x20')](function(_0x1e599e){return _0x1e599e;});}return null;};}function removeEntity(_0x2aa8cb,_0x2ad69f){return function(_0x35c951){if(_0x35c951){return _0x35c951[_0x8a33('0x21')]()[_0x8a33('0x20')](function(){_0x2aa8cb[_0x8a33('0x16')](0xcc)[_0x8a33('0x17')]();});}};}function handleEntityNotFound(_0x5f557e,_0x57f6d1){return function(_0x5419d2){if(!_0x5419d2){_0x5f557e[_0x8a33('0x22')](0x194);}return _0x5419d2;};}function handleError(_0x38fe06,_0x1ccbbb){_0x1ccbbb=_0x1ccbbb||0x1f4;return function(_0x89729){logger[_0x8a33('0x23')](_0x89729[_0x8a33('0x24')]);if(_0x89729['name']){delete _0x89729['name'];}_0x38fe06['status'](_0x1ccbbb)['send'](_0x89729);};}exports[_0x8a33('0x25')]=function(_0x2075ec,_0x51e277){var _0x426343={},_0x35e333={},_0x388d77={'count':0x0,'rows':[]};var _0x36d535=_[_0x8a33('0x26')](db['VoiceQueuesLog'][_0x8a33('0x27')],function(_0x2c5ccf){return{'name':_0x2c5ccf[_0x8a33('0x28')],'type':_0x2c5ccf['type'][_0x8a33('0x29')]};});_0x35e333[_0x8a33('0x2a')]=_[_0x8a33('0x26')](_0x36d535,_0x8a33('0x2b'));_0x35e333[_0x8a33('0x2c')]=_[_0x8a33('0x2d')](_0x2075ec[_0x8a33('0x2c')]);_0x35e333[_0x8a33('0x2e')]=_[_0x8a33('0x2f')](_0x35e333[_0x8a33('0x2a')],_0x35e333['query']);_0x426343['attributes']=_['intersection'](_0x35e333[_0x8a33('0x2a')],qs['fields'](_0x2075ec[_0x8a33('0x2c')][_0x8a33('0x30')]));_0x426343[_0x8a33('0x31')]=_0x426343[_0x8a33('0x31')]['length']?_0x426343[_0x8a33('0x31')]:_0x35e333[_0x8a33('0x2a')];if(!_0x2075ec[_0x8a33('0x2c')][_0x8a33('0x32')](_0x8a33('0x33'))){_0x426343['limit']=qs[_0x8a33('0x1a')](_0x2075ec['query'][_0x8a33('0x1a')]);_0x426343[_0x8a33('0x1c')]=qs['offset'](_0x2075ec[_0x8a33('0x2c')][_0x8a33('0x1c')]);}_0x426343[_0x8a33('0x34')]=qs[_0x8a33('0x35')](_0x2075ec['query'][_0x8a33('0x35')]);_0x426343['where']=qs['filters'](_['pick'](_0x2075ec['query'],_0x35e333[_0x8a33('0x2e')]),_0x36d535);if(_0x2075ec['query'][_0x8a33('0x36')]){_0x426343[_0x8a33('0x37')]=_[_0x8a33('0x38')](_0x426343[_0x8a33('0x37')],{'$or':_[_0x8a33('0x26')](_0x36d535,function(_0x25d519){if(_0x25d519[_0x8a33('0x39')]!=='VIRTUAL'){var _0x5e82fe={};_0x5e82fe[_0x25d519[_0x8a33('0x2b')]]={'$like':'%'+_0x2075ec[_0x8a33('0x2c')][_0x8a33('0x36')]+'%'};return _0x5e82fe;}})});}_0x426343=_[_0x8a33('0x38')]({},_0x426343,_0x2075ec[_0x8a33('0x3a')]);var _0x7458aa={'where':_0x426343[_0x8a33('0x37')]};return db['VoiceQueuesLog'][_0x8a33('0x1b')](_0x7458aa)[_0x8a33('0x20')](function(_0x124fe6){_0x388d77['count']=_0x124fe6;if(_0x2075ec[_0x8a33('0x2c')]['includeAll']){_0x426343[_0x8a33('0x3b')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x8a33('0x3c')](_0x426343);})['then'](function(_0x4447f4){_0x388d77['rows']=_0x4447f4;return _0x388d77;})[_0x8a33('0x20')](respondWithFilteredResult(_0x51e277,_0x426343))[_0x8a33('0x3d')](handleError(_0x51e277,null));};exports['show']=function(_0x365f7e,_0x2d6c86){var _0x1b0f30={'raw':!![],'where':{'id':_0x365f7e[_0x8a33('0x3e')]['id']}},_0x33d50a={};_0x33d50a[_0x8a33('0x2a')]=_['keys'](db['VoiceQueuesLog'][_0x8a33('0x27')]);_0x33d50a[_0x8a33('0x2c')]=_[_0x8a33('0x2d')](_0x365f7e[_0x8a33('0x2c')]);_0x33d50a[_0x8a33('0x2e')]=_[_0x8a33('0x2f')](_0x33d50a['model'],_0x33d50a['query']);_0x1b0f30['attributes']=_['intersection'](_0x33d50a[_0x8a33('0x2a')],qs['fields'](_0x365f7e['query']['fields']));_0x1b0f30[_0x8a33('0x31')]=_0x1b0f30[_0x8a33('0x31')][_0x8a33('0x3f')]?_0x1b0f30[_0x8a33('0x31')]:_0x33d50a[_0x8a33('0x2a')];if(_0x365f7e[_0x8a33('0x2c')][_0x8a33('0x40')]){_0x1b0f30[_0x8a33('0x3b')]=[{'all':!![]}];}_0x1b0f30=_[_0x8a33('0x38')]({},_0x1b0f30,_0x365f7e['options']);return db['VoiceQueuesLog'][_0x8a33('0x41')](_0x1b0f30)['then'](handleEntityNotFound(_0x2d6c86,null))['then'](respondWithResult(_0x2d6c86,null))['catch'](handleError(_0x2d6c86,null));};exports[_0x8a33('0x42')]=function(_0x494a6c,_0x3a6a2a){return db[_0x8a33('0x43')]['create'](_0x494a6c[_0x8a33('0x44')],{})[_0x8a33('0x20')](respondWithResult(_0x3a6a2a,0xc9))[_0x8a33('0x3d')](handleError(_0x3a6a2a,null));};exports[_0x8a33('0x1f')]=function(_0x3240c0,_0x316083){if(_0x3240c0[_0x8a33('0x44')]['id']){delete _0x3240c0[_0x8a33('0x44')]['id'];}return db['VoiceQueuesLog'][_0x8a33('0x41')]({'where':{'id':_0x3240c0[_0x8a33('0x3e')]['id']}})[_0x8a33('0x20')](handleEntityNotFound(_0x316083,null))['then'](saveUpdates(_0x3240c0[_0x8a33('0x44')],null))[_0x8a33('0x20')](respondWithResult(_0x316083,null))['catch'](handleError(_0x316083,null));};exports[_0x8a33('0x21')]=function(_0x2a4e5f,_0x836f1d){return db[_0x8a33('0x43')][_0x8a33('0x41')]({'where':{'id':_0x2a4e5f[_0x8a33('0x3e')]['id']}})['then'](handleEntityNotFound(_0x836f1d,null))['then'](removeEntity(_0x836f1d,null))['catch'](handleError(_0x836f1d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index dc9a80f..dc8dbbb 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.model.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe142=['event','dtm','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x204fa5,_0x5d249b){var _0x1cc9f9=function(_0x2bc418){while(--_0x2bc418){_0x204fa5['push'](_0x204fa5['shift']());}};_0x1cc9f9(++_0x5d249b);}(_0xe142,0xaa));var _0x2e14=function(_0x1cc15f,_0x5105c8){_0x1cc15f=_0x1cc15f-0x0;var _0x3c5201=_0xe142[_0x1cc15f];return _0x3c5201;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2e14('0x0'))('api');var moment=require(_0x2e14('0x1'));var BPromise=require(_0x2e14('0x2'));var rp=require(_0x2e14('0x3'));var fs=require('fs');var path=require(_0x2e14('0x4'));var rimraf=require(_0x2e14('0x5'));var config=require(_0x2e14('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x2e14('0x7')]=function(_0x33e99b,_0x1bfd45){return _0x33e99b[_0x2e14('0x8')](_0x2e14('0x9'),attributes,{'tableName':_0x2e14('0xa'),'paranoid':![],'indexes':[{'name':_0x2e14('0xb'),'fields':[_0x2e14('0xc'),_0x2e14('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6e37=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x6e37,0xee));var _0x76e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e37[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76e3('0x0'));var util=require(_0x76e3('0x1'));var logger=require(_0x76e3('0x2'))('api');var moment=require(_0x76e3('0x3'));var BPromise=require(_0x76e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76e3('0x5'));var rimraf=require(_0x76e3('0x6'));var config=require(_0x76e3('0x7'));var attributes=require(_0x76e3('0x8'));module[_0x76e3('0x9')]=function(_0x2920ca,_0x20b2f8){return _0x2920ca[_0x76e3('0xa')](_0x76e3('0xb'),attributes,{'tableName':_0x76e3('0xc'),'paranoid':![],'indexes':[{'name':_0x76e3('0xd'),'fields':[_0x76e3('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b487b93..17756cb 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca04=['VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1367d8,_0x570e09){var _0x33b2c7=function(_0xfc5de5){while(--_0xfc5de5){_0x1367d8['push'](_0x1367d8['shift']());}};_0x33b2c7(++_0x570e09);}(_0xca04,0xa4));var _0x4ca0=function(_0x1c296c,_0x9286ce){_0x1c296c=_0x1c296c-0x0;var _0x1d3108=_0xca04[_0x1c296c];return _0x1d3108;};'use strict';var _=require(_0x4ca0('0x0'));var util=require('util');var moment=require(_0x4ca0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ca0('0x2'));var db=require(_0x4ca0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ca0('0x4'));var config=require(_0x4ca0('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4ca0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4c6d3d,_0x2dfc4b,_0x51cc84){return new BPromise(function(_0x3e19e3,_0x229ee8){return client[_0x4ca0('0x7')](_0x4c6d3d,_0x51cc84)[_0x4ca0('0x8')](function(_0x24b7a3){logger[_0x4ca0('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2dfc4b,'request\x20sent');logger[_0x4ca0('0xa')](_0x4ca0('0xb'),_0x2dfc4b,_0x4ca0('0xc'),JSON[_0x4ca0('0xd')](_0x24b7a3));if(_0x24b7a3['error']){if(_0x24b7a3[_0x4ca0('0xe')][_0x4ca0('0xf')]===0x1f4){logger[_0x4ca0('0xe')](_0x4ca0('0x10'),_0x2dfc4b,_0x24b7a3[_0x4ca0('0xe')][_0x4ca0('0x11')]);return _0x229ee8(_0x24b7a3[_0x4ca0('0xe')][_0x4ca0('0x11')]);}logger[_0x4ca0('0xe')](_0x4ca0('0x10'),_0x2dfc4b,_0x24b7a3[_0x4ca0('0xe')]['message']);return _0x3e19e3(_0x24b7a3['error'][_0x4ca0('0x11')]);}else{logger[_0x4ca0('0x9')](_0x4ca0('0x10'),_0x2dfc4b,_0x4ca0('0xc'));_0x3e19e3(_0x24b7a3[_0x4ca0('0x12')][_0x4ca0('0x11')]);}})[_0x4ca0('0x13')](function(_0x5ced3a){logger[_0x4ca0('0xe')](_0x4ca0('0x10'),_0x2dfc4b,_0x5ced3a);_0x229ee8(_0x5ced3a);});});} \ No newline at end of file +var _0xc855=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x6b7158,_0x5e4228){var _0x57fcca=function(_0x23d78b){while(--_0x23d78b){_0x6b7158['push'](_0x6b7158['shift']());}};_0x57fcca(++_0x5e4228);}(_0xc855,0xe8));var _0x5c85=function(_0xddbe56,_0xb5d9ae){_0xddbe56=_0xddbe56-0x0;var _0x4c692a=_0xc855[_0xddbe56];return _0x4c692a;};'use strict';var _=require(_0x5c85('0x0'));var util=require('util');var moment=require(_0x5c85('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c85('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5c85('0x3'));var jayson=require(_0x5c85('0x4'));var client=jayson[_0x5c85('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x404dbb,_0x562e14,_0x50e441){return new BPromise(function(_0x101544,_0x2d6ec0){return client[_0x5c85('0x6')](_0x404dbb,_0x50e441)[_0x5c85('0x7')](function(_0x19e4f3){logger[_0x5c85('0x8')](_0x5c85('0x9'),_0x562e14,_0x5c85('0xa'));logger[_0x5c85('0xb')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x562e14,_0x5c85('0xa'),JSON['stringify'](_0x19e4f3));if(_0x19e4f3[_0x5c85('0xc')]){if(_0x19e4f3[_0x5c85('0xc')][_0x5c85('0xd')]===0x1f4){logger[_0x5c85('0xc')](_0x5c85('0x9'),_0x562e14,_0x19e4f3[_0x5c85('0xc')][_0x5c85('0xe')]);return _0x2d6ec0(_0x19e4f3['error']['message']);}logger[_0x5c85('0xc')](_0x5c85('0x9'),_0x562e14,_0x19e4f3[_0x5c85('0xc')][_0x5c85('0xe')]);return _0x101544(_0x19e4f3['error'][_0x5c85('0xe')]);}else{logger[_0x5c85('0x8')](_0x5c85('0x9'),_0x562e14,_0x5c85('0xa'));_0x101544(_0x19e4f3[_0x5c85('0xf')]['message']);}})[_0x5c85('0x10')](function(_0x5bec87){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x562e14,_0x5bec87);_0x2d6ec0(_0x5bec87);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c167977..c47c306 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3207=['runTranscribe','update','delete','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post'];(function(_0x53d6e5,_0x1aee40){var _0x4085dc=function(_0x213b2b){while(--_0x213b2b){_0x53d6e5['push'](_0x53d6e5['shift']());}};_0x4085dc(++_0x1aee40);}(_0x3207,0x87));var _0x7320=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x3207[_0x3ec1da];return _0x472358;};'use strict';var multer=require(_0x7320('0x0'));var util=require(_0x7320('0x1'));var path=require('path');var timeout=require(_0x7320('0x2'));var express=require(_0x7320('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7320('0x4'));var controller=require(_0x7320('0x5'));router[_0x7320('0x6')]('/',auth['isAuthenticated'](),controller[_0x7320('0x7')]);router['get'](_0x7320('0x8'),auth[_0x7320('0x9')](),controller[_0x7320('0xa')]);router[_0x7320('0x6')](_0x7320('0xb'),auth[_0x7320('0x9')](),controller[_0x7320('0xc')]);router[_0x7320('0x6')](_0x7320('0xd'),auth[_0x7320('0x9')](),controller[_0x7320('0xe')]);router['get'](_0x7320('0xf'),controller[_0x7320('0x10')]);router[_0x7320('0x6')](_0x7320('0x11'),auth[_0x7320('0x9')](),controller[_0x7320('0x12')]);router['post']('/',auth[_0x7320('0x9')](),controller[_0x7320('0x13')]);router[_0x7320('0x14')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x7320('0x15')]);router['put'](_0x7320('0xb'),auth[_0x7320('0x9')](),controller[_0x7320('0x16')]);router[_0x7320('0x17')](_0x7320('0xb'),auth[_0x7320('0x9')](),controller[_0x7320('0x18')]);module[_0x7320('0x19')]=router; \ No newline at end of file +var _0x9792=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','isAuthenticated','/describe','describe','/:id','show','get','download','/:id/downloads','downloads','/:id/transcribe','create','post','runTranscribe','put','update','delete','destroy'];(function(_0xd553ab,_0x788918){var _0x215442=function(_0x5b32f8){while(--_0x5b32f8){_0xd553ab['push'](_0xd553ab['shift']());}};_0x215442(++_0x788918);}(_0x9792,0xd1));var _0x2979=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9792[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x2979('0x0'));var util=require(_0x2979('0x1'));var path=require(_0x2979('0x2'));var timeout=require(_0x2979('0x3'));var express=require(_0x2979('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2979('0x5'));var interaction=require(_0x2979('0x6'));var config=require('../../config/environment');var controller=require(_0x2979('0x7'));router['get']('/',auth[_0x2979('0x8')](),controller['index']);router['get'](_0x2979('0x9'),auth[_0x2979('0x8')](),controller[_0x2979('0xa')]);router['get'](_0x2979('0xb'),auth[_0x2979('0x8')](),controller[_0x2979('0xc')]);router[_0x2979('0xd')]('/:id/download',auth[_0x2979('0x8')](),controller[_0x2979('0xe')]);router[_0x2979('0xd')](_0x2979('0xf'),controller[_0x2979('0x10')]);router[_0x2979('0xd')](_0x2979('0x11'),auth[_0x2979('0x8')](),controller['downloadTranscribe']);router['post']('/',auth[_0x2979('0x8')](),controller[_0x2979('0x12')]);router[_0x2979('0x13')](_0x2979('0x11'),auth[_0x2979('0x8')](),controller[_0x2979('0x14')]);router[_0x2979('0x15')](_0x2979('0xb'),auth[_0x2979('0x8')](),controller[_0x2979('0x16')]);router[_0x2979('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x2979('0x18')]);module[_0x2979('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 3fb2470..6679522 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 6084f80..4223f0b 100644 --- a/server/api/voiceRecording/voiceRecording.controller.js +++ b/server/api/voiceRecording/voiceRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9b2=['fields','length','order','sort','where','pick','filter','merge','findAll','rows','catch','show','options','find','create','body','params','describe','../../components/encryptor','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','download','filename','extname','unlink','message','sequelize','col','uniqueid','$and','push','secrets','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Setting','findOne','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','bluebird','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes'];(function(_0x1dba8d,_0x56a896){var _0x1b9165=function(_0x5de1e7){while(--_0x5de1e7){_0x1dba8d['push'](_0x1dba8d['shift']());}};_0x1b9165(++_0x56a896);}(_0xa9b2,0x171));var _0x2a9b=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0xa9b2[_0x2af29a];return _0x5ef02f;};'use strict';var emlformat=require(_0x2a9b('0x0'));var rimraf=require(_0x2a9b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a9b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a9b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2a9b('0x4'));var csv=require(_0x2a9b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a9b('0x6'));var _=require('lodash');var squel=require(_0x2a9b('0x7'));var crypto=require(_0x2a9b('0x8'));var jsforce=require(_0x2a9b('0x9'));var deskjs=require(_0x2a9b('0xa'));var toCsv=require(_0x2a9b('0x5'));var querystring=require(_0x2a9b('0xb'));var Papa=require(_0x2a9b('0xc'));var AWS=require(_0x2a9b('0xd'));var uuidv4=require(_0x2a9b('0xe'));var Redis=require(_0x2a9b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2a9b('0x10'));var as=require(_0x2a9b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a9b('0x12'));var utils=require('../../config/utils');var config=require(_0x2a9b('0x13'));var licenseUtil=require(_0x2a9b('0x14'));var db=require(_0x2a9b('0x15'))['db'];function respondWithStatusCode(_0x1f2023,_0x595952){_0x595952=_0x595952||0xcc;return function(_0x2e7773){if(_0x2e7773){return _0x1f2023['sendStatus'](_0x595952);}return _0x1f2023[_0x2a9b('0x16')](_0x595952)[_0x2a9b('0x17')]();};}function respondWithResult(_0x4858c5,_0x163eb2){_0x163eb2=_0x163eb2||0xc8;return function(_0x3262d4){if(_0x3262d4){return _0x4858c5[_0x2a9b('0x16')](_0x163eb2)[_0x2a9b('0x18')](_0x3262d4);}};}function respondWithFilteredResult(_0x2bfdc5,_0x1df202){return function(_0x25552f){if(_0x25552f){var _0x80139d=typeof _0x1df202[_0x2a9b('0x19')]===_0x2a9b('0x1a')&&typeof _0x1df202[_0x2a9b('0x1b')]===_0x2a9b('0x1a');var _0x194bac=_0x25552f[_0x2a9b('0x1c')];var _0x89f600=_0x80139d?0x0:_0x1df202[_0x2a9b('0x19')];var _0x57a870=_0x80139d?_0x25552f['count']:_0x1df202[_0x2a9b('0x19')]+_0x1df202[_0x2a9b('0x1b')];var _0x131429;if(_0x57a870>=_0x194bac){_0x57a870=_0x194bac;_0x131429=0xc8;}else{_0x131429=0xce;}_0x2bfdc5[_0x2a9b('0x16')](_0x131429);return _0x2bfdc5[_0x2a9b('0x1d')](_0x2a9b('0x1e'),_0x89f600+'-'+_0x57a870+'/'+_0x194bac)[_0x2a9b('0x18')](_0x25552f);}return null;};}function patchUpdates(_0x342c82){return function(_0x25efa5){try{jsonpatch['apply'](_0x25efa5,_0x342c82,!![]);}catch(_0x5eb08b){return BPromise[_0x2a9b('0x1f')](_0x5eb08b);}return _0x25efa5['save']();};}function saveUpdates(_0x4d0c55,_0x7ab4ae){return function(_0x2d8cf5){if(_0x2d8cf5){return _0x2d8cf5[_0x2a9b('0x20')](_0x4d0c55)[_0x2a9b('0x21')](function(_0x16a233){return _0x16a233;});}return null;};}function removeEntity(_0x58a1f2,_0x3c81b1){return function(_0x3a8e36){if(_0x3a8e36){return _0x3a8e36['destroy']()[_0x2a9b('0x21')](function(){_0x58a1f2[_0x2a9b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f049b,_0x3cfa7e){return function(_0x13c4cf){if(!_0x13c4cf){_0x4f049b['sendStatus'](0x194);}return _0x13c4cf;};}function handleError(_0x2b89d6,_0x3a43e8){_0x3a43e8=_0x3a43e8||0x1f4;return function(_0x5df407){logger[_0x2a9b('0x22')](_0x5df407[_0x2a9b('0x23')]);if(_0x5df407['name']){delete _0x5df407[_0x2a9b('0x24')];}_0x2b89d6['status'](_0x3a43e8)['send'](_0x5df407);};}exports[_0x2a9b('0x25')]=function(_0x2866f3,_0x10a7e7){var _0x2b61b8={},_0x27e92f={},_0x468640={'count':0x0,'rows':[]};var _0x30fb34=_[_0x2a9b('0x26')](db[_0x2a9b('0x27')][_0x2a9b('0x28')],function(_0x206e92){return{'name':_0x206e92['fieldName'],'type':_0x206e92[_0x2a9b('0x29')][_0x2a9b('0x2a')]};});_0x27e92f[_0x2a9b('0x2b')]=_[_0x2a9b('0x2c')](_[_0x2a9b('0x26')](_0x30fb34,'name'),[_0x2a9b('0x2d')]);_0x27e92f[_0x2a9b('0x2e')]=_[_0x2a9b('0x2f')](_0x2866f3['query']);_0x27e92f[_0x2a9b('0x30')]=_[_0x2a9b('0x31')](_0x27e92f['model'],_0x27e92f[_0x2a9b('0x2e')]);_0x2b61b8[_0x2a9b('0x32')]=_['intersection'](_0x27e92f['model'],qs[_0x2a9b('0x33')](_0x2866f3['query']['fields']));_0x2b61b8[_0x2a9b('0x32')]=_0x2b61b8[_0x2a9b('0x32')][_0x2a9b('0x34')]?_0x2b61b8[_0x2a9b('0x32')]:_0x27e92f[_0x2a9b('0x2b')];if(!_0x2866f3['query']['hasOwnProperty']('nolimit')){_0x2b61b8[_0x2a9b('0x1b')]=qs['limit'](_0x2866f3[_0x2a9b('0x2e')][_0x2a9b('0x1b')]);_0x2b61b8[_0x2a9b('0x19')]=qs[_0x2a9b('0x19')](_0x2866f3[_0x2a9b('0x2e')][_0x2a9b('0x19')]);}_0x2b61b8[_0x2a9b('0x35')]=qs[_0x2a9b('0x36')](_0x2866f3[_0x2a9b('0x2e')][_0x2a9b('0x36')]);_0x2b61b8[_0x2a9b('0x37')]=qs[_0x2a9b('0x30')](_[_0x2a9b('0x38')](_0x2866f3[_0x2a9b('0x2e')],_0x27e92f['filters']),_0x30fb34);if(_0x2866f3['query'][_0x2a9b('0x39')]){_0x2b61b8[_0x2a9b('0x37')]=_[_0x2a9b('0x3a')](_0x2b61b8[_0x2a9b('0x37')],{'$or':_[_0x2a9b('0x26')](_0x30fb34,function(_0x47b908){if(_0x47b908[_0x2a9b('0x29')]!=='VIRTUAL'){var _0x34718a={};_0x34718a[_0x47b908['name']]={'$like':'%'+_0x2866f3['query']['filter']+'%'};return _0x34718a;}})});}_0x2b61b8=_[_0x2a9b('0x3a')]({},_0x2b61b8,_0x2866f3['options']);var _0x2541a8={'where':_0x2b61b8[_0x2a9b('0x37')]};return db[_0x2a9b('0x27')][_0x2a9b('0x1c')](_0x2541a8)[_0x2a9b('0x21')](function(_0x53cd4e){_0x468640[_0x2a9b('0x1c')]=_0x53cd4e;if(_0x2866f3[_0x2a9b('0x2e')]['includeAll']){_0x2b61b8['include']=[{'all':!![]}];}return db[_0x2a9b('0x27')][_0x2a9b('0x3b')](_0x2b61b8);})[_0x2a9b('0x21')](function(_0x51d525){_0x468640[_0x2a9b('0x3c')]=_0x51d525;return _0x468640;})[_0x2a9b('0x21')](respondWithFilteredResult(_0x10a7e7,_0x2b61b8))[_0x2a9b('0x3d')](handleError(_0x10a7e7,null));};exports[_0x2a9b('0x3e')]=function(_0x10b26e,_0x4e5c1b){var _0x1545f1={'raw':![],'where':{'id':_0x10b26e['params']['id']}},_0x326bf7={};_0x326bf7[_0x2a9b('0x2b')]=_[_0x2a9b('0x2f')](db[_0x2a9b('0x27')][_0x2a9b('0x28')]);_0x326bf7['query']=_[_0x2a9b('0x2f')](_0x10b26e[_0x2a9b('0x2e')]);_0x326bf7[_0x2a9b('0x30')]=_['intersection'](_0x326bf7[_0x2a9b('0x2b')],_0x326bf7['query']);_0x1545f1[_0x2a9b('0x32')]=_['intersection'](_0x326bf7[_0x2a9b('0x2b')],qs[_0x2a9b('0x33')](_0x10b26e[_0x2a9b('0x2e')][_0x2a9b('0x33')]));_0x1545f1[_0x2a9b('0x32')]=_0x1545f1[_0x2a9b('0x32')][_0x2a9b('0x34')]?_0x1545f1[_0x2a9b('0x32')]:_0x326bf7[_0x2a9b('0x2b')];if(_0x10b26e['query']['includeAll']){_0x1545f1['include']=[{'all':!![]}];}_0x1545f1=_[_0x2a9b('0x3a')]({},_0x1545f1,_0x10b26e[_0x2a9b('0x3f')]);return db[_0x2a9b('0x27')][_0x2a9b('0x40')](_0x1545f1)[_0x2a9b('0x21')](handleEntityNotFound(_0x4e5c1b,null))[_0x2a9b('0x21')](respondWithResult(_0x4e5c1b,null))[_0x2a9b('0x3d')](handleError(_0x4e5c1b,null));};exports[_0x2a9b('0x41')]=function(_0x20002d,_0x127486){return db['VoiceRecording'][_0x2a9b('0x41')](_0x20002d[_0x2a9b('0x42')],{})[_0x2a9b('0x21')](respondWithResult(_0x127486,0xc9))[_0x2a9b('0x3d')](handleError(_0x127486,null));};exports[_0x2a9b('0x20')]=function(_0x2bc900,_0xb44b25){if(_0x2bc900[_0x2a9b('0x42')]['id']){delete _0x2bc900['body']['id'];}return db[_0x2a9b('0x27')][_0x2a9b('0x40')]({'where':{'id':_0x2bc900[_0x2a9b('0x43')]['id']}})['then'](handleEntityNotFound(_0xb44b25,null))['then'](saveUpdates(_0x2bc900[_0x2a9b('0x42')],null))[_0x2a9b('0x21')](respondWithResult(_0xb44b25,null))[_0x2a9b('0x3d')](handleError(_0xb44b25,null));};exports[_0x2a9b('0x44')]=function(_0x9083cc,_0x4bb0b1){return db[_0x2a9b('0x27')][_0x2a9b('0x44')]()['then'](respondWithResult(_0x4bb0b1,null))['catch'](handleError(_0x4bb0b1,null));};exports['download']=function(_0x11bbc5,_0x1c3637,_0x58d869){var _0x15e6a0=require(_0x2a9b('0x45'));var _0x3dd0a0=![];var _0x43d2a1={};if(_0x11bbc5[_0x2a9b('0x2e')]['type']&&_0x11bbc5['query'][_0x2a9b('0x29')]==='uniqueid'){_0x43d2a1['uniqueid']=_0x11bbc5[_0x2a9b('0x43')]['id'];}else{_0x43d2a1['id']=_0x11bbc5['params']['id'];}return db[_0x2a9b('0x27')]['find']({'where':_0x43d2a1,'attributes':['id',_0x2a9b('0x46')],'raw':!![]})[_0x2a9b('0x21')](handleEntityNotFound(_0x1c3637,null))[_0x2a9b('0x21')](function(_0x199ff4){if(_0x199ff4){var _0x43f97d=_0x199ff4[_0x2a9b('0x46')];var _0x376cfd=util[_0x2a9b('0x2d')](_0x2a9b('0x47'),_0x43f97d);if(fs[_0x2a9b('0x48')](_0x376cfd)){_0x3dd0a0=!![];return _0x15e6a0[_0x2a9b('0x49')](_0x376cfd,_0x43f97d,config['secrets'][_0x2a9b('0x4a')])[_0x2a9b('0x21')](function(){return _0x199ff4;});}return _0x199ff4;}})[_0x2a9b('0x21')](function(_0x532c64){if(_0x532c64){var _0x56cbd8=_0x532c64[_0x2a9b('0x46')];if(!fs[_0x2a9b('0x48')](_0x56cbd8)){throw new db[(_0x2a9b('0x4b'))][(_0x2a9b('0x4c'))](_0x2a9b('0x4d'));}if(_0x532c64['filename']){return _0x1c3637[_0x2a9b('0x4e')](_0x56cbd8,_0x532c64[_0x2a9b('0x4f')]+path[_0x2a9b('0x50')](_0x56cbd8),function(){if(_0x3dd0a0){fs['unlink'](_0x56cbd8);}});}else{return _0x1c3637['download'](_0x56cbd8,function(_0x140cc2){if(_0x3dd0a0){fs[_0x2a9b('0x51')](_0x56cbd8);}});}}})[_0x2a9b('0x3d')](function(_0x2641c5){if(_0x2641c5[_0x2a9b('0x52')]===_0x2a9b('0x4d')){_0x1c3637['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x1c3637,null);}});};exports['downloads']=function(_0x2f72e9,_0x4482b5,_0xa62200){var _0x33ba55=require(_0x2a9b('0x45'));var _0x1af324=![];var _0x2a7f38={'$and':[db[_0x2a9b('0x53')][_0x2a9b('0x37')](db[_0x2a9b('0x53')]['fn']('MD5',db['sequelize'][_0x2a9b('0x54')](_0x2a9b('0x55'))),_0x2f72e9['query']['token'])]};if(_0x2f72e9[_0x2a9b('0x2e')]['type']&&_0x2f72e9[_0x2a9b('0x2e')]['type']===_0x2a9b('0x55')){_0x2a7f38[_0x2a9b('0x56')]['push']({'uniqueid':_0x2f72e9['params']['id']});}else{_0x2a7f38['$and'][_0x2a9b('0x57')]({'id':_0x2f72e9[_0x2a9b('0x43')]['id']});}return db[_0x2a9b('0x27')][_0x2a9b('0x40')]({'where':_0x2a7f38,'attributes':['id',_0x2a9b('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x4482b5,null))[_0x2a9b('0x21')](function(_0x1a8c92){if(_0x1a8c92){var _0x33a1c9=util[_0x2a9b('0x2d')](_0x2a9b('0x47'),_0x1a8c92[_0x2a9b('0x46')]);if(fs['existsSync'](_0x33a1c9)){_0x1af324=!![];return _0x33ba55[_0x2a9b('0x49')](_0x33a1c9,_0x1a8c92[_0x2a9b('0x46')],config[_0x2a9b('0x58')][_0x2a9b('0x4a')])['then'](function(){return _0x1a8c92;});}return _0x1a8c92;}})[_0x2a9b('0x21')](function(_0x126285){if(_0x126285){if(!fs[_0x2a9b('0x48')](_0x126285['value'])){throw new db[(_0x2a9b('0x4b'))][(_0x2a9b('0x4c'))](_0x2a9b('0x4d'));}if(_0x126285[_0x2a9b('0x4f')]){return _0x4482b5[_0x2a9b('0x4e')](_0x126285[_0x2a9b('0x46')],_0x126285[_0x2a9b('0x4f')]+path[_0x2a9b('0x50')](_0x126285[_0x2a9b('0x46')]),function(){if(_0x1af324){fs[_0x2a9b('0x51')](_0x126285[_0x2a9b('0x46')]);}});}else{return _0x4482b5[_0x2a9b('0x4e')](_0x126285['value'],function(_0x40020a){if(_0x1af324){fs[_0x2a9b('0x51')](_0x126285[_0x2a9b('0x46')]);}});}}})['catch'](handleError(_0x4482b5,null));};exports[_0x2a9b('0x59')]=function(_0x583bab,_0x459ddc){return db['VoiceRecording'][_0x2a9b('0x40')]({'where':{'id':_0x583bab['params']['id']}})[_0x2a9b('0x21')](function(_0x2b0680){if(_['isNil'](_0x2b0680)){throw new ReferenceError(_0x2a9b('0x5a'));}return _0x2b0680;})[_0x2a9b('0x21')](function(_0x58de28){var _0x28f15e=_0x58de28[_0x2a9b('0x46')];logger[_0x2a9b('0x5b')](_0x2a9b('0x5c'),_0x28f15e);if(!_[_0x2a9b('0x5d')](_0x58de28['value'])&&fs[_0x2a9b('0x48')](_0x28f15e)){logger[_0x2a9b('0x5b')](_0x2a9b('0x5e')+_0x28f15e+_0x2a9b('0x5f'));fs[_0x2a9b('0x60')](_0x28f15e);}_0x28f15e=_0x28f15e+_0x2a9b('0x61');if(!_['isNil'](_0x58de28[_0x2a9b('0x46')])&&fs[_0x2a9b('0x48')](_0x28f15e)){logger['info'](_0x2a9b('0x5e')+_0x28f15e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2a9b('0x60')](_0x28f15e);}return _0x58de28;})[_0x2a9b('0x21')](function(_0x227629){if(!_0x227629)throw new InternalError();return _0x227629[_0x2a9b('0x59')]();})['then'](function(){_0x459ddc[_0x2a9b('0x16')](0xcc)[_0x2a9b('0x17')]();})[_0x2a9b('0x3d')](handleError(_0x459ddc,null));};function getBucketslist(_0x591876,_0x48cb1a,_0x345117){return new Promise(function(_0x37a48c,_0x33dc18){var _0x1280d8=new AWS['S3']({'accessKeyId':_0x48cb1a,'secretAccessKey':_0x591876,'region':_0x345117});_0x1280d8[_0x2a9b('0x62')]({},function(_0x39c776,_0x25a861){if(_0x39c776){return _0x33dc18(_0x39c776);}else{return _0x37a48c(_0x25a861);}});});}function createBucket(_0xd1f759,_0x541594,_0x4a3196,_0x4f1e6b){return new Promise(function(_0x19f17c,_0x559d20){var _0x26acc1=new AWS['S3']({'accessKeyId':_0x541594,'secretAccessKey':_0xd1f759,'region':_0x4a3196});_0x26acc1['createBucket']({'Bucket':_0x4f1e6b},function(_0x3f3fcb,_0x59bb3e){if(_0x3f3fcb){return _0x559d20(_0x3f3fcb);}else{return _0x19f17c(_0x59bb3e);}});});}function uploadFile(_0x4300cb,_0x499676,_0x263f78,_0x524d73,_0x5eb2ae,_0x4e59c1){return new Promise(function(_0x1a69a4,_0x300be5){var _0x3bbb25=new AWS['S3']({'accessKeyId':_0x499676,'secretAccessKey':_0x4300cb,'region':_0x263f78});_0x3bbb25[_0x2a9b('0x63')]({'Bucket':_0x524d73,'Key':_0x5eb2ae,'Body':_0x4e59c1},function(_0x4036c1,_0x185dc8){if(_0x4036c1){return _0x300be5(_0x4036c1);}else{return _0x1a69a4(_0x185dc8);}});});}function startTranscribe(_0x3296d9,_0x54bbc5,_0x1d8e0b,_0x2109aa,_0x3d206,_0x47e105){return new Promise(function(_0x42b7e4,_0x44f22a){var _0x4e5fa3=new AWS['TranscribeService']({'accessKeyId':_0x54bbc5,'secretAccessKey':_0x3296d9,'region':_0x1d8e0b});_0x4e5fa3['startTranscriptionJob']({'TranscriptionJobName':_0x2109aa,'LanguageCode':_0x3d206,'Media':{'MediaFileUri':_0x47e105}},function(_0x12fb18,_0x5a6172){if(_0x12fb18){return _0x44f22a(_0x12fb18);}else{return _0x42b7e4(_0x5a6172);}});});}function transcribe(_0x550101,_0x245c55,_0x4673da,_0x5bfbd3,_0x45c2e8,_0x2b231f,_0x2b5d86){return new Promise(function(_0x921cb1,_0x29eba4){var _0xeae993={};logger[_0x2a9b('0x5b')](util[_0x2a9b('0x2d')](_0x2a9b('0x64'),_0x550101,_0x45c2e8));return uploadFile(_0x245c55,_0x4673da,_0x5bfbd3,_0x45c2e8,path[_0x2a9b('0x65')](_0x2b231f),fs[_0x2a9b('0x66')](_0x2b231f))[_0x2a9b('0x21')](function(_0x23abea){logger[_0x2a9b('0x5b')](util[_0x2a9b('0x2d')](_0x2a9b('0x67'),_0x550101,_0x45c2e8,_0x23abea['Location']));_0xeae993[_0x2a9b('0x68')]=_0x23abea[_0x2a9b('0x69')];_0xeae993[_0x2a9b('0x6a')]=_0x23abea['Location'];logger[_0x2a9b('0x5b')](util[_0x2a9b('0x2d')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x550101));return startTranscribe(_0x245c55,_0x4673da,_0x5bfbd3,uuidv4(),_0x2b5d86,_0x23abea[_0x2a9b('0x6b')]);})[_0x2a9b('0x21')](function(_0x1e0b9f){logger[_0x2a9b('0x5b')](util[_0x2a9b('0x2d')](_0x2a9b('0x6c'),_0x550101,_0x1e0b9f[_0x2a9b('0x6d')][_0x2a9b('0x6e')]));_0xeae993[_0x2a9b('0x6f')]=_0x1e0b9f[_0x2a9b('0x6d')]['TranscriptionJobName'];_0xeae993[_0x2a9b('0x70')]=_0x1e0b9f[_0x2a9b('0x6d')][_0x2a9b('0x71')];return _0x921cb1(_0xeae993);})[_0x2a9b('0x3d')](function(_0x52ab1c){return _0x29eba4(_0x52ab1c);});});}exports[_0x2a9b('0x72')]=function(_0x5df962,_0x18dbdb,_0x5bf626){var _0x3afaf5;var _0x2a7b8b;var _0x3a0199;var _0x284799=require(_0x2a9b('0x45'));return db[_0x2a9b('0x27')]['findOne']({'where':{'id':_0x5df962[_0x2a9b('0x43')]['id']}})[_0x2a9b('0x21')](function(_0x19378e){if(_0x19378e){var _0x4bdd01=util[_0x2a9b('0x2d')](_0x2a9b('0x47'),_0x19378e[_0x2a9b('0x46')]);if(fs['existsSync'](_0x4bdd01)){cypher=!![];return _0x284799[_0x2a9b('0x49')](_0x4bdd01,_0x19378e[_0x2a9b('0x46')],config[_0x2a9b('0x58')][_0x2a9b('0x4a')])[_0x2a9b('0x21')](function(){return _0x19378e;});}return _0x19378e;}})['then'](function(_0x3b3b1e){if(!_0x3b3b1e){throw new db[(_0x2a9b('0x4b'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x2a7b8b=_0x3b3b1e;return db[_0x2a9b('0x73')][_0x2a9b('0x74')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x18dbdb,null))[_0x2a9b('0x21')](function(_0x5c3059){if(_0x5c3059){_0x3afaf5=_0x5c3059;if(!_0x3afaf5['transcribe']||!_0x3afaf5[_0x2a9b('0x75')]||!_0x3afaf5[_0x2a9b('0x76')]||!_0x3afaf5['language']||!_0x3afaf5[_0x2a9b('0x68')]){throw new db[(_0x2a9b('0x4b'))][(_0x2a9b('0x4c'))](_0x2a9b('0x77'));}if(_0x5df962[_0x2a9b('0x42')][_0x2a9b('0x78')]&&(!_0x3afaf5[_0x2a9b('0x79')]||!_0x3afaf5['sentimentAccountId']||!_0x3afaf5[_0x2a9b('0x7a')]||!_0x3afaf5[_0x2a9b('0x7b')]||!_0x3afaf5['bucket'])){throw new db[(_0x2a9b('0x4b'))][(_0x2a9b('0x4c'))](_0x2a9b('0x7c'));}return db['CloudProvider'][_0x2a9b('0x74')]({'where':{'id':_0x3afaf5['transcribeAccountId']}});}})[_0x2a9b('0x21')](function(_0x417980){if(!_0x417980){throw new db[(_0x2a9b('0x4b'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x417980[_0x2a9b('0x7d')]||!_0x417980[_0x2a9b('0x7e')]){throw new db[(_0x2a9b('0x4b'))][(_0x2a9b('0x4c'))]('Cloud\x20Provider\x20not\x20configured');}_0x3a0199=_0x417980;return getBucketslist(_0x3a0199[_0x2a9b('0x7d')],_0x3a0199['data2'],_0x3afaf5[_0x2a9b('0x76')]);})[_0x2a9b('0x21')](function(_0x383a07){if(_0x383a07&&_0x383a07[_0x2a9b('0x7f')]){var _0x1fae1b=_[_0x2a9b('0x40')](_0x383a07[_0x2a9b('0x7f')],function(_0x572beb){return _0x572beb[_0x2a9b('0x80')]===_0x3afaf5[_0x2a9b('0x68')];});if(!_0x1fae1b){logger[_0x2a9b('0x5b')](util['format'](_0x2a9b('0x81'),_0x5df962[_0x2a9b('0x43')]['id'],_0x3afaf5['bucket']));return createBucket(_0x3a0199[_0x2a9b('0x7d')],_0x3a0199[_0x2a9b('0x7e')],_0x3afaf5[_0x2a9b('0x76')],_0x3afaf5[_0x2a9b('0x68')]);}logger[_0x2a9b('0x5b')](util[_0x2a9b('0x2d')](_0x2a9b('0x82'),_0x5df962[_0x2a9b('0x43')]['id'],_0x3afaf5[_0x2a9b('0x68')]));return;}})[_0x2a9b('0x21')](function(_0x264e4f){if(_0x2a7b8b[_0x2a9b('0x70')]===_0x2a9b('0x83')){return transcribe(_0x5df962[_0x2a9b('0x43')]['id'],_0x3a0199['data1'],_0x3a0199[_0x2a9b('0x7e')],_0x3afaf5[_0x2a9b('0x76')],_0x3afaf5[_0x2a9b('0x68')],_0x2a7b8b[_0x2a9b('0x46')],_0x3afaf5[_0x2a9b('0x7b')]);}else{logger[_0x2a9b('0x5b')](util['format'](_0x2a9b('0x84'),_0x5df962[_0x2a9b('0x43')]['id']));return{'transcribeStatus':_0x2a9b('0x85')};}})[_0x2a9b('0x21')](function(_0x5e6a43){if(_0x5e6a43){_0x5e6a43['tempSentiment']=_0x5df962[_0x2a9b('0x42')]['runSentiment'];return _0x2a7b8b[_0x2a9b('0x86')](_0x5e6a43);}})[_0x2a9b('0x21')](respondWithResult(_0x18dbdb,null))[_0x2a9b('0x3d')](handleError(_0x18dbdb,null));};function writeFile(_0x179f64,_0x4be0dc){return new Promise(function(_0x148a39,_0x36d181){fs['writeFile'](_0x4be0dc,_0x179f64,function(_0xb59158,_0x49114e){if(_0xb59158){return _0x36d181(_0xb59158);}else{return _0x148a39(_0x49114e);}});});}exports[_0x2a9b('0x87')]=function(_0x236b51,_0x3e33b9,_0x34c57d){return db[_0x2a9b('0x27')]['findOne']({'where':{'id':_0x236b51[_0x2a9b('0x43')]['id']}})[_0x2a9b('0x21')](handleEntityNotFound(_0x3e33b9))[_0x2a9b('0x21')](function(_0x2c2913){if(_0x2c2913&&_0x2c2913[_0x2a9b('0x88')]){var _0x4ddfeb=_0x2c2913[_0x2a9b('0x88')];var _0x559100=config[_0x2a9b('0x89')]+'/server/files/transcribes/transcribe_'+_0x2c2913['id']+_0x2a9b('0x8a');if(fs['existsSync'](_0x559100)){return _0x559100;}return writeFile(_0x4ddfeb,_0x559100)['then'](function(){return _0x559100;});}else{throw new db[(_0x2a9b('0x4b'))]['ValidationError'](_0x2a9b('0x8b'));}})[_0x2a9b('0x21')](function(_0x57d006){return _0x3e33b9[_0x2a9b('0x4e')](_0x57d006);})[_0x2a9b('0x3d')](handleError(_0x3e33b9));}; \ No newline at end of file +var _0x5c4c=['apply','save','update','then','destroy','error','stack','name','fieldName','type','key','model','format','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','VoiceRecording','includeAll','include','rows','catch','show','keys','rawAttributes','create','body','find','params','describe','download','../../components/encryptor','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','uniqueid','$and','push','%s.cypher','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json'];(function(_0x5d1027,_0x47b06c){var _0x304def=function(_0x11de9e){while(--_0x11de9e){_0x5d1027['push'](_0x5d1027['shift']());}};_0x304def(++_0x47b06c);}(_0x5c4c,0x104));var _0xc5c4=function(_0x1e7f33,_0x5c1348){_0x1e7f33=_0x1e7f33-0x0;var _0x428258=_0x5c4c[_0x1e7f33];return _0x428258;};'use strict';var emlformat=require(_0xc5c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc5c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5c4('0x2'));var moment=require(_0xc5c4('0x3'));var BPromise=require(_0xc5c4('0x4'));var Mustache=require('mustache');var util=require(_0xc5c4('0x5'));var path=require(_0xc5c4('0x6'));var sox=require(_0xc5c4('0x7'));var csv=require('to-csv');var ejs=require(_0xc5c4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc5c4('0x9'));var squel=require(_0xc5c4('0xa'));var crypto=require(_0xc5c4('0xb'));var jsforce=require(_0xc5c4('0xc'));var deskjs=require(_0xc5c4('0xd'));var toCsv=require(_0xc5c4('0xe'));var querystring=require('querystring');var Papa=require(_0xc5c4('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0xc5c4('0x10'));var Redis=require(_0xc5c4('0x11'));var authService=require(_0xc5c4('0x12'));var qs=require(_0xc5c4('0x13'));var as=require(_0xc5c4('0x14'));var hardwareService=require(_0xc5c4('0x15'));var logger=require(_0xc5c4('0x16'))('api');var utils=require(_0xc5c4('0x17'));var config=require(_0xc5c4('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x382805,_0x111aee){_0x111aee=_0x111aee||0xcc;return function(_0x36ad07){if(_0x36ad07){return _0x382805[_0xc5c4('0x19')](_0x111aee);}return _0x382805[_0xc5c4('0x1a')](_0x111aee)[_0xc5c4('0x1b')]();};}function respondWithResult(_0x14eef5,_0x480c21){_0x480c21=_0x480c21||0xc8;return function(_0x299c6d){if(_0x299c6d){return _0x14eef5[_0xc5c4('0x1a')](_0x480c21)['json'](_0x299c6d);}};}function respondWithFilteredResult(_0x3749f7,_0x5bbfb2){return function(_0x136d71){if(_0x136d71){var _0x4322ce=typeof _0x5bbfb2['offset']===_0xc5c4('0x1c')&&typeof _0x5bbfb2[_0xc5c4('0x1d')]==='undefined';var _0x108998=_0x136d71[_0xc5c4('0x1e')];var _0x1ef767=_0x4322ce?0x0:_0x5bbfb2[_0xc5c4('0x1f')];var _0x360902=_0x4322ce?_0x136d71[_0xc5c4('0x1e')]:_0x5bbfb2[_0xc5c4('0x1f')]+_0x5bbfb2[_0xc5c4('0x1d')];var _0x29b146;if(_0x360902>=_0x108998){_0x360902=_0x108998;_0x29b146=0xc8;}else{_0x29b146=0xce;}_0x3749f7[_0xc5c4('0x1a')](_0x29b146);return _0x3749f7['set'](_0xc5c4('0x20'),_0x1ef767+'-'+_0x360902+'/'+_0x108998)[_0xc5c4('0x21')](_0x136d71);}return null;};}function patchUpdates(_0x370cff){return function(_0x318b0e){try{jsonpatch[_0xc5c4('0x22')](_0x318b0e,_0x370cff,!![]);}catch(_0x48aea6){return BPromise['reject'](_0x48aea6);}return _0x318b0e[_0xc5c4('0x23')]();};}function saveUpdates(_0x3aa73d,_0x302b0a){return function(_0x4b7084){if(_0x4b7084){return _0x4b7084[_0xc5c4('0x24')](_0x3aa73d)[_0xc5c4('0x25')](function(_0x2cb295){return _0x2cb295;});}return null;};}function removeEntity(_0x283df1,_0x582d14){return function(_0x284d45){if(_0x284d45){return _0x284d45[_0xc5c4('0x26')]()[_0xc5c4('0x25')](function(){_0x283df1['status'](0xcc)[_0xc5c4('0x1b')]();});}};}function handleEntityNotFound(_0x436d51,_0x31bba9){return function(_0x4b1fff){if(!_0x4b1fff){_0x436d51[_0xc5c4('0x19')](0x194);}return _0x4b1fff;};}function handleError(_0x1c0659,_0x1d1142){_0x1d1142=_0x1d1142||0x1f4;return function(_0x372259){logger[_0xc5c4('0x27')](_0x372259[_0xc5c4('0x28')]);if(_0x372259[_0xc5c4('0x29')]){delete _0x372259['name'];}_0x1c0659[_0xc5c4('0x1a')](_0x1d1142)['send'](_0x372259);};}exports['index']=function(_0x1d69d0,_0x3da614){var _0x15dd4a={},_0x2021d4={},_0x3da7b0={'count':0x0,'rows':[]};var _0x595515=_['map'](db['VoiceRecording']['rawAttributes'],function(_0x28660f){return{'name':_0x28660f[_0xc5c4('0x2a')],'type':_0x28660f[_0xc5c4('0x2b')][_0xc5c4('0x2c')]};});_0x2021d4[_0xc5c4('0x2d')]=_['differenceBy'](_['map'](_0x595515,'name'),[_0xc5c4('0x2e')]);_0x2021d4[_0xc5c4('0x2f')]=_['keys'](_0x1d69d0['query']);_0x2021d4[_0xc5c4('0x30')]=_[_0xc5c4('0x31')](_0x2021d4[_0xc5c4('0x2d')],_0x2021d4['query']);_0x15dd4a['attributes']=_[_0xc5c4('0x31')](_0x2021d4[_0xc5c4('0x2d')],qs[_0xc5c4('0x32')](_0x1d69d0['query'][_0xc5c4('0x32')]));_0x15dd4a[_0xc5c4('0x33')]=_0x15dd4a['attributes'][_0xc5c4('0x34')]?_0x15dd4a[_0xc5c4('0x33')]:_0x2021d4[_0xc5c4('0x2d')];if(!_0x1d69d0[_0xc5c4('0x2f')]['hasOwnProperty'](_0xc5c4('0x35'))){_0x15dd4a[_0xc5c4('0x1d')]=qs[_0xc5c4('0x1d')](_0x1d69d0[_0xc5c4('0x2f')][_0xc5c4('0x1d')]);_0x15dd4a['offset']=qs[_0xc5c4('0x1f')](_0x1d69d0[_0xc5c4('0x2f')][_0xc5c4('0x1f')]);}_0x15dd4a[_0xc5c4('0x36')]=qs[_0xc5c4('0x37')](_0x1d69d0[_0xc5c4('0x2f')][_0xc5c4('0x37')]);_0x15dd4a[_0xc5c4('0x38')]=qs[_0xc5c4('0x30')](_['pick'](_0x1d69d0[_0xc5c4('0x2f')],_0x2021d4[_0xc5c4('0x30')]),_0x595515);if(_0x1d69d0[_0xc5c4('0x2f')][_0xc5c4('0x39')]){_0x15dd4a[_0xc5c4('0x38')]=_[_0xc5c4('0x3a')](_0x15dd4a['where'],{'$or':_[_0xc5c4('0x3b')](_0x595515,function(_0x5d0b0c){if(_0x5d0b0c['type']!==_0xc5c4('0x3c')){var _0x21398f={};_0x21398f[_0x5d0b0c[_0xc5c4('0x29')]]={'$like':'%'+_0x1d69d0['query'][_0xc5c4('0x39')]+'%'};return _0x21398f;}})});}_0x15dd4a=_[_0xc5c4('0x3a')]({},_0x15dd4a,_0x1d69d0[_0xc5c4('0x3d')]);var _0x4fe443={'where':_0x15dd4a[_0xc5c4('0x38')]};return db[_0xc5c4('0x3e')][_0xc5c4('0x1e')](_0x4fe443)[_0xc5c4('0x25')](function(_0x3c030d){_0x3da7b0[_0xc5c4('0x1e')]=_0x3c030d;if(_0x1d69d0[_0xc5c4('0x2f')][_0xc5c4('0x3f')]){_0x15dd4a[_0xc5c4('0x40')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x15dd4a);})[_0xc5c4('0x25')](function(_0x67c97b){_0x3da7b0[_0xc5c4('0x41')]=_0x67c97b;return _0x3da7b0;})[_0xc5c4('0x25')](respondWithFilteredResult(_0x3da614,_0x15dd4a))[_0xc5c4('0x42')](handleError(_0x3da614,null));};exports[_0xc5c4('0x43')]=function(_0x563d2e,_0x312b3f){var _0x1fb55a={'raw':![],'where':{'id':_0x563d2e['params']['id']}},_0x4a354a={};_0x4a354a[_0xc5c4('0x2d')]=_[_0xc5c4('0x44')](db['VoiceRecording'][_0xc5c4('0x45')]);_0x4a354a[_0xc5c4('0x2f')]=_[_0xc5c4('0x44')](_0x563d2e[_0xc5c4('0x2f')]);_0x4a354a[_0xc5c4('0x30')]=_[_0xc5c4('0x31')](_0x4a354a[_0xc5c4('0x2d')],_0x4a354a['query']);_0x1fb55a[_0xc5c4('0x33')]=_[_0xc5c4('0x31')](_0x4a354a[_0xc5c4('0x2d')],qs[_0xc5c4('0x32')](_0x563d2e['query']['fields']));_0x1fb55a[_0xc5c4('0x33')]=_0x1fb55a[_0xc5c4('0x33')]['length']?_0x1fb55a[_0xc5c4('0x33')]:_0x4a354a['model'];if(_0x563d2e[_0xc5c4('0x2f')]['includeAll']){_0x1fb55a[_0xc5c4('0x40')]=[{'all':!![]}];}_0x1fb55a=_[_0xc5c4('0x3a')]({},_0x1fb55a,_0x563d2e[_0xc5c4('0x3d')]);return db[_0xc5c4('0x3e')]['find'](_0x1fb55a)[_0xc5c4('0x25')](handleEntityNotFound(_0x312b3f,null))[_0xc5c4('0x25')](respondWithResult(_0x312b3f,null))['catch'](handleError(_0x312b3f,null));};exports[_0xc5c4('0x46')]=function(_0x704746,_0x5f0713){return db[_0xc5c4('0x3e')][_0xc5c4('0x46')](_0x704746[_0xc5c4('0x47')],{})[_0xc5c4('0x25')](respondWithResult(_0x5f0713,0xc9))[_0xc5c4('0x42')](handleError(_0x5f0713,null));};exports['update']=function(_0x2d571f,_0xde1e2){if(_0x2d571f[_0xc5c4('0x47')]['id']){delete _0x2d571f['body']['id'];}return db[_0xc5c4('0x3e')][_0xc5c4('0x48')]({'where':{'id':_0x2d571f[_0xc5c4('0x49')]['id']}})[_0xc5c4('0x25')](handleEntityNotFound(_0xde1e2,null))[_0xc5c4('0x25')](saveUpdates(_0x2d571f[_0xc5c4('0x47')],null))[_0xc5c4('0x25')](respondWithResult(_0xde1e2,null))[_0xc5c4('0x42')](handleError(_0xde1e2,null));};exports['describe']=function(_0x33b133,_0x254166){return db[_0xc5c4('0x3e')][_0xc5c4('0x4a')]()['then'](respondWithResult(_0x254166,null))['catch'](handleError(_0x254166,null));};exports[_0xc5c4('0x4b')]=function(_0x483100,_0x1d4e87,_0x7cbf37){var _0x5a4a08=require(_0xc5c4('0x4c'));var _0x4dce0e=![];var _0xe7f887={};if(_0x483100[_0xc5c4('0x2f')][_0xc5c4('0x2b')]&&_0x483100[_0xc5c4('0x2f')]['type']==='uniqueid'){_0xe7f887['uniqueid']=_0x483100['params']['id'];}else{_0xe7f887['id']=_0x483100['params']['id'];}return db['VoiceRecording'][_0xc5c4('0x48')]({'where':_0xe7f887,'attributes':['id',_0xc5c4('0x4d')],'raw':!![]})[_0xc5c4('0x25')](handleEntityNotFound(_0x1d4e87,null))['then'](function(_0x10c49c){if(_0x10c49c){var _0x44712b=_0x10c49c[_0xc5c4('0x4d')];var _0x18674f=util[_0xc5c4('0x2e')]('%s.cypher',_0x44712b);if(fs[_0xc5c4('0x4e')](_0x18674f)){_0x4dce0e=!![];return _0x5a4a08[_0xc5c4('0x4f')](_0x18674f,_0x44712b,config[_0xc5c4('0x50')][_0xc5c4('0x51')])['then'](function(){return _0x10c49c;});}return _0x10c49c;}})[_0xc5c4('0x25')](function(_0x46fe0b){if(_0x46fe0b){var _0x22fa24=_0x46fe0b[_0xc5c4('0x4d')];if(!fs[_0xc5c4('0x4e')](_0x22fa24)){throw new db[(_0xc5c4('0x52'))][(_0xc5c4('0x53'))](_0xc5c4('0x54'));}if(_0x46fe0b[_0xc5c4('0x55')]){return _0x1d4e87['download'](_0x22fa24,_0x46fe0b[_0xc5c4('0x55')]+path[_0xc5c4('0x56')](_0x22fa24),function(){if(_0x4dce0e){fs[_0xc5c4('0x57')](_0x22fa24);}});}else{return _0x1d4e87[_0xc5c4('0x4b')](_0x22fa24,function(_0xdd7a30){if(_0x4dce0e){fs[_0xc5c4('0x57')](_0x22fa24);}});}}})[_0xc5c4('0x42')](function(_0x503d49){if(_0x503d49[_0xc5c4('0x58')]==='VoiceRecording\x20not\x20found'){_0x1d4e87['status'](0x194)[_0xc5c4('0x59')](_0xc5c4('0x5a'));}else{return handleError(_0x1d4e87,null);}});};exports[_0xc5c4('0x5b')]=function(_0x48b59b,_0x1c5b43,_0x270a3){var _0x2863f4=require(_0xc5c4('0x4c'));var _0x50a6df=![];var _0x56c0a8={'$and':[db['sequelize'][_0xc5c4('0x38')](db[_0xc5c4('0x5c')]['fn'](_0xc5c4('0x5d'),db[_0xc5c4('0x5c')][_0xc5c4('0x5e')](_0xc5c4('0x5f'))),_0x48b59b[_0xc5c4('0x2f')]['token'])]};if(_0x48b59b[_0xc5c4('0x2f')][_0xc5c4('0x2b')]&&_0x48b59b[_0xc5c4('0x2f')][_0xc5c4('0x2b')]===_0xc5c4('0x5f')){_0x56c0a8[_0xc5c4('0x60')][_0xc5c4('0x61')]({'uniqueid':_0x48b59b['params']['id']});}else{_0x56c0a8[_0xc5c4('0x60')][_0xc5c4('0x61')]({'id':_0x48b59b[_0xc5c4('0x49')]['id']});}return db[_0xc5c4('0x3e')][_0xc5c4('0x48')]({'where':_0x56c0a8,'attributes':['id','value'],'raw':!![]})[_0xc5c4('0x25')](handleEntityNotFound(_0x1c5b43,null))[_0xc5c4('0x25')](function(_0x25ce3b){if(_0x25ce3b){var _0x17f266=util[_0xc5c4('0x2e')](_0xc5c4('0x62'),_0x25ce3b[_0xc5c4('0x4d')]);if(fs['existsSync'](_0x17f266)){_0x50a6df=!![];return _0x2863f4['decryptFile'](_0x17f266,_0x25ce3b[_0xc5c4('0x4d')],config[_0xc5c4('0x50')][_0xc5c4('0x51')])[_0xc5c4('0x25')](function(){return _0x25ce3b;});}return _0x25ce3b;}})[_0xc5c4('0x25')](function(_0x5b9910){if(_0x5b9910){if(!fs['existsSync'](_0x5b9910[_0xc5c4('0x4d')])){throw new db[(_0xc5c4('0x52'))][(_0xc5c4('0x53'))](_0xc5c4('0x54'));}if(_0x5b9910['filename']){return _0x1c5b43['download'](_0x5b9910['value'],_0x5b9910[_0xc5c4('0x55')]+path[_0xc5c4('0x56')](_0x5b9910['value']),function(){if(_0x50a6df){fs[_0xc5c4('0x57')](_0x5b9910[_0xc5c4('0x4d')]);}});}else{return _0x1c5b43[_0xc5c4('0x4b')](_0x5b9910['value'],function(_0xc3568){if(_0x50a6df){fs['unlink'](_0x5b9910[_0xc5c4('0x4d')]);}});}}})['catch'](handleError(_0x1c5b43,null));};exports['destroy']=function(_0x4e568f,_0x3a9ea9){return db[_0xc5c4('0x3e')][_0xc5c4('0x48')]({'where':{'id':_0x4e568f[_0xc5c4('0x49')]['id']}})[_0xc5c4('0x25')](function(_0x5214ea){if(_[_0xc5c4('0x63')](_0x5214ea)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5214ea;})[_0xc5c4('0x25')](function(_0x398609){var _0x146b77=_0x398609[_0xc5c4('0x4d')];logger[_0xc5c4('0x64')](_0xc5c4('0x65'),_0x146b77);if(!_[_0xc5c4('0x63')](_0x398609[_0xc5c4('0x4d')])&&fs[_0xc5c4('0x4e')](_0x146b77)){logger[_0xc5c4('0x64')]('File:\x20\x22'+_0x146b77+_0xc5c4('0x66'));fs[_0xc5c4('0x67')](_0x146b77);}_0x146b77=_0x146b77+_0xc5c4('0x68');if(!_[_0xc5c4('0x63')](_0x398609['value'])&&fs[_0xc5c4('0x4e')](_0x146b77)){logger['info'](_0xc5c4('0x69')+_0x146b77+_0xc5c4('0x66'));fs['unlinkSync'](_0x146b77);}return _0x398609;})[_0xc5c4('0x25')](function(_0x1be8aa){if(!_0x1be8aa)throw new InternalError();return _0x1be8aa[_0xc5c4('0x26')]();})[_0xc5c4('0x25')](function(){_0x3a9ea9[_0xc5c4('0x1a')](0xcc)[_0xc5c4('0x1b')]();})[_0xc5c4('0x42')](handleError(_0x3a9ea9,null));};function getBucketslist(_0x49b596,_0x1baaa3,_0x420385){return new Promise(function(_0x4e0ff4,_0x2476e6){var _0x2fba4d=new AWS['S3']({'accessKeyId':_0x1baaa3,'secretAccessKey':_0x49b596,'region':_0x420385});_0x2fba4d[_0xc5c4('0x6a')]({},function(_0x3d61ec,_0x4cbff4){if(_0x3d61ec){return _0x2476e6(_0x3d61ec);}else{return _0x4e0ff4(_0x4cbff4);}});});}function createBucket(_0x1da4d0,_0x51c879,_0x238763,_0x47eb2c){return new Promise(function(_0x2b7533,_0x25078d){var _0x36b5b9=new AWS['S3']({'accessKeyId':_0x51c879,'secretAccessKey':_0x1da4d0,'region':_0x238763});_0x36b5b9[_0xc5c4('0x6b')]({'Bucket':_0x47eb2c},function(_0x399ead,_0x17e1f6){if(_0x399ead){return _0x25078d(_0x399ead);}else{return _0x2b7533(_0x17e1f6);}});});}function uploadFile(_0x2e65ee,_0x3cdbcc,_0x20e4d8,_0x1ba7c5,_0x52203e,_0x2937a5){return new Promise(function(_0x35b8af,_0x4c1961){var _0x273fb2=new AWS['S3']({'accessKeyId':_0x3cdbcc,'secretAccessKey':_0x2e65ee,'region':_0x20e4d8});_0x273fb2['upload']({'Bucket':_0x1ba7c5,'Key':_0x52203e,'Body':_0x2937a5},function(_0x51cc3b,_0x47c883){if(_0x51cc3b){return _0x4c1961(_0x51cc3b);}else{return _0x35b8af(_0x47c883);}});});}function startTranscribe(_0xb10f5a,_0x4ef8b9,_0x9eceff,_0x5b9398,_0x3ec5f2,_0x2b7694){return new Promise(function(_0xf87e39,_0x39edfc){var _0x40dde3=new AWS['TranscribeService']({'accessKeyId':_0x4ef8b9,'secretAccessKey':_0xb10f5a,'region':_0x9eceff});_0x40dde3[_0xc5c4('0x6c')]({'TranscriptionJobName':_0x5b9398,'LanguageCode':_0x3ec5f2,'Media':{'MediaFileUri':_0x2b7694}},function(_0x3316c2,_0x58acaa){if(_0x3316c2){return _0x39edfc(_0x3316c2);}else{return _0xf87e39(_0x58acaa);}});});}function transcribe(_0x39e6c0,_0x4ffbc4,_0x403738,_0x1e2d62,_0x41a045,_0xb60c9a,_0x2b67d3){return new Promise(function(_0x38062d,_0x3fb0d4){var _0x53ebda={};logger[_0xc5c4('0x64')](util[_0xc5c4('0x2e')](_0xc5c4('0x6d'),_0x39e6c0,_0x41a045));return uploadFile(_0x4ffbc4,_0x403738,_0x1e2d62,_0x41a045,path['basename'](_0xb60c9a),fs['readFileSync'](_0xb60c9a))[_0xc5c4('0x25')](function(_0x87b3b5){logger['info'](util['format'](_0xc5c4('0x6e'),_0x39e6c0,_0x41a045,_0x87b3b5[_0xc5c4('0x6f')]));_0x53ebda[_0xc5c4('0x70')]=_0x87b3b5['Bucket'];_0x53ebda['location']=_0x87b3b5[_0xc5c4('0x6f')];logger[_0xc5c4('0x64')](util[_0xc5c4('0x2e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x39e6c0));return startTranscribe(_0x4ffbc4,_0x403738,_0x1e2d62,uuidv4(),_0x2b67d3,_0x87b3b5[_0xc5c4('0x6f')]);})['then'](function(_0x4780cd){logger['info'](util[_0xc5c4('0x2e')](_0xc5c4('0x71'),_0x39e6c0,_0x4780cd['TranscriptionJob'][_0xc5c4('0x72')]));_0x53ebda['transcribeName']=_0x4780cd[_0xc5c4('0x73')][_0xc5c4('0x72')];_0x53ebda[_0xc5c4('0x74')]=_0x4780cd['TranscriptionJob'][_0xc5c4('0x75')];return _0x38062d(_0x53ebda);})['catch'](function(_0x2c0f2f){return _0x3fb0d4(_0x2c0f2f);});});}exports['runTranscribe']=function(_0x2c678e,_0x55adc9,_0x1c2a29){var _0x1a1c29;var _0x5d8da0;var _0x255036;var _0x3b8fff=require('../../components/encryptor');return db[_0xc5c4('0x3e')]['findOne']({'where':{'id':_0x2c678e[_0xc5c4('0x49')]['id']}})[_0xc5c4('0x25')](function(_0x40c91c){if(_0x40c91c){var _0x3acc7b=util[_0xc5c4('0x2e')](_0xc5c4('0x62'),_0x40c91c['value']);if(fs[_0xc5c4('0x4e')](_0x3acc7b)){cypher=!![];return _0x3b8fff['decryptFile'](_0x3acc7b,_0x40c91c[_0xc5c4('0x4d')],config[_0xc5c4('0x50')][_0xc5c4('0x51')])[_0xc5c4('0x25')](function(){return _0x40c91c;});}return _0x40c91c;}})[_0xc5c4('0x25')](function(_0x6f771b){if(!_0x6f771b){throw new db['Sequelize'][(_0xc5c4('0x53'))](_0xc5c4('0x76'));}_0x5d8da0=_0x6f771b;return db['Setting'][_0xc5c4('0x77')]({'where':{'id':0x1}});})[_0xc5c4('0x25')](handleEntityNotFound(_0x55adc9,null))['then'](function(_0xa6d54){if(_0xa6d54){_0x1a1c29=_0xa6d54;if(!_0x1a1c29['transcribe']||!_0x1a1c29[_0xc5c4('0x78')]||!_0x1a1c29[_0xc5c4('0x79')]||!_0x1a1c29[_0xc5c4('0x7a')]||!_0x1a1c29[_0xc5c4('0x70')]){throw new db[(_0xc5c4('0x52'))][(_0xc5c4('0x53'))](_0xc5c4('0x7b'));}if(_0x2c678e[_0xc5c4('0x47')]['runSentiment']&&(!_0x1a1c29[_0xc5c4('0x7c')]||!_0x1a1c29[_0xc5c4('0x7d')]||!_0x1a1c29[_0xc5c4('0x7e')]||!_0x1a1c29[_0xc5c4('0x7a')]||!_0x1a1c29[_0xc5c4('0x70')])){throw new db['Sequelize'][(_0xc5c4('0x53'))](_0xc5c4('0x7f'));}return db[_0xc5c4('0x80')][_0xc5c4('0x77')]({'where':{'id':_0x1a1c29[_0xc5c4('0x78')]}});}})[_0xc5c4('0x25')](function(_0x378c5f){if(!_0x378c5f){throw new db[(_0xc5c4('0x52'))][(_0xc5c4('0x53'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x378c5f[_0xc5c4('0x81')]||!_0x378c5f[_0xc5c4('0x82')]){throw new db[(_0xc5c4('0x52'))][(_0xc5c4('0x53'))](_0xc5c4('0x83'));}_0x255036=_0x378c5f;return getBucketslist(_0x255036[_0xc5c4('0x81')],_0x255036[_0xc5c4('0x82')],_0x1a1c29[_0xc5c4('0x79')]);})['then'](function(_0x1214d9){if(_0x1214d9&&_0x1214d9[_0xc5c4('0x84')]){var _0x5eee89=_['find'](_0x1214d9[_0xc5c4('0x84')],function(_0x3d486b){return _0x3d486b[_0xc5c4('0x85')]===_0x1a1c29[_0xc5c4('0x70')];});if(!_0x5eee89){logger['info'](util[_0xc5c4('0x2e')](_0xc5c4('0x86'),_0x2c678e[_0xc5c4('0x49')]['id'],_0x1a1c29[_0xc5c4('0x70')]));return createBucket(_0x255036['data1'],_0x255036['data2'],_0x1a1c29[_0xc5c4('0x79')],_0x1a1c29[_0xc5c4('0x70')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2c678e['params']['id'],_0x1a1c29['bucket']));return;}})[_0xc5c4('0x25')](function(_0x2ab79a){if(_0x5d8da0[_0xc5c4('0x74')]===_0xc5c4('0x87')){return transcribe(_0x2c678e['params']['id'],_0x255036[_0xc5c4('0x81')],_0x255036[_0xc5c4('0x82')],_0x1a1c29[_0xc5c4('0x79')],_0x1a1c29[_0xc5c4('0x70')],_0x5d8da0[_0xc5c4('0x4d')],_0x1a1c29[_0xc5c4('0x7a')]);}else{logger[_0xc5c4('0x64')](util[_0xc5c4('0x2e')](_0xc5c4('0x88'),_0x2c678e[_0xc5c4('0x49')]['id']));return{'transcribeStatus':_0xc5c4('0x89')};}})[_0xc5c4('0x25')](function(_0x246715){if(_0x246715){_0x246715[_0xc5c4('0x8a')]=_0x2c678e['body'][_0xc5c4('0x8b')];return _0x5d8da0[_0xc5c4('0x8c')](_0x246715);}})[_0xc5c4('0x25')](respondWithResult(_0x55adc9,null))[_0xc5c4('0x42')](handleError(_0x55adc9,null));};function writeFile(_0x527831,_0xaa9947){return new Promise(function(_0x54d95e,_0x29dc57){fs[_0xc5c4('0x8d')](_0xaa9947,_0x527831,function(_0xdf6562,_0x2cf6f0){if(_0xdf6562){return _0x29dc57(_0xdf6562);}else{return _0x54d95e(_0x2cf6f0);}});});}exports[_0xc5c4('0x8e')]=function(_0x34c4ac,_0x731aba,_0x25bc09){return db[_0xc5c4('0x3e')][_0xc5c4('0x77')]({'where':{'id':_0x34c4ac[_0xc5c4('0x49')]['id']}})[_0xc5c4('0x25')](handleEntityNotFound(_0x731aba))[_0xc5c4('0x25')](function(_0x45d35c){if(_0x45d35c&&_0x45d35c[_0xc5c4('0x8f')]){var _0x69f161=_0x45d35c[_0xc5c4('0x8f')];var _0x3a8e9c=config['root']+_0xc5c4('0x90')+_0x45d35c['id']+_0xc5c4('0x91');if(fs[_0xc5c4('0x4e')](_0x3a8e9c)){return _0x3a8e9c;}return writeFile(_0x69f161,_0x3a8e9c)[_0xc5c4('0x25')](function(){return _0x3a8e9c;});}else{throw new db[(_0xc5c4('0x52'))][(_0xc5c4('0x53'))](_0xc5c4('0x92'));}})[_0xc5c4('0x25')](function(_0x525d1b){return _0x731aba[_0xc5c4('0x4b')](_0x525d1b);})['catch'](handleError(_0x731aba));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index cf203cb..03773ff 100644 --- a/server/api/voiceRecording/voiceRecording.model.js +++ b/server/api/voiceRecording/voiceRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e25=['exports','define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x269091,_0x2fb92e){var _0x24092e=function(_0x49f415){while(--_0x49f415){_0x269091['push'](_0x269091['shift']());}};_0x24092e(++_0x2fb92e);}(_0x3e25,0x14f));var _0x53e2=function(_0xaeb8c3,_0x2c6b7f){_0xaeb8c3=_0xaeb8c3-0x0;var _0x325a0e=_0x3e25[_0xaeb8c3];return _0x325a0e;};'use strict';var attributes=require(_0x53e2('0x0'));module[_0x53e2('0x1')]=function(_0xce9c21,_0x5804b9){return _0xce9c21[_0x53e2('0x2')]('VoiceRecording',attributes,{'tableName':_0x53e2('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x53e2('0x4')]},{'name':_0x53e2('0x5'),'fields':[_0x53e2('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc818=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','VoiceRecording'];(function(_0x48d266,_0x2cbd75){var _0x5eb912=function(_0x25a826){while(--_0x25a826){_0x48d266['push'](_0x48d266['shift']());}};_0x5eb912(++_0x2cbd75);}(_0xc818,0x1e3));var _0x8c81=function(_0x18a367,_0xfd9163){_0x18a367=_0x18a367-0x0;var _0x2acccb=_0xc818[_0x18a367];return _0x2acccb;};'use strict';var attributes=require(_0x8c81('0x0'));module[_0x8c81('0x1')]=function(_0x2ebf7a,_0x42192c){return _0x2ebf7a['define'](_0x8c81('0x2'),attributes,{'tableName':_0x8c81('0x3'),'paranoid':![],'indexes':[{'name':_0x8c81('0x4'),'fields':[_0x8c81('0x4')]},{'name':_0x8c81('0x5'),'fields':[_0x8c81('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 6d84785..888a5b8 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x592db3,_0x389077){var _0x20cdf3=function(_0x20b0fd){while(--_0x20b0fd){_0x592db3['push'](_0x592db3['shift']());}};_0x20cdf3(++_0x389077);}(_0x1623,0xab));var _0x3162=function(_0x2e1a42,_0x1e8fec){_0x2e1a42=_0x2e1a42-0x0;var _0x2a1715=_0x1623[_0x2e1a42];return _0x2a1715;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')](_0x1eed46[_0x3162('0x19')],{'raw':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x1a')]?_0x1eed46['options']['attributes']||null:null,'limit':_0x1eed46[_0x3162('0x1a')]?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1c')]||null:null})[_0x3162('0xa')](function(_0x31b27b){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('UpdateVoiceRecording',_0x1eed46,JSON[_0x3162('0xf')](_0x31b27b));_0x4b2bf3(_0x31b27b);})[_0x3162('0x15')](function(_0x3919e7){logger[_0x3162('0x10')](_0x3162('0x16'),_0x3919e7[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97[_0x3162('0x10')](0x1f4,_0x3919e7[_0x3162('0x13')]));});});};exports[_0x3162('0x1d')]=function(_0x356c5d){var _0x8fa09f=this;return new Promise(function(_0x2f62d7,_0x1c03a4){var _0x48de45=require(_0x3162('0x1e'));var _0x552469;return db[_0x3162('0x1f')][_0x3162('0x20')]({'attributes':['id',_0x3162('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x4903e7){_0x552469=_0x4903e7;return db[_0x3162('0x17')][_0x3162('0x22')](_0x356c5d[_0x3162('0x19')]);})[_0x3162('0xa')](function(_0x2f88ec){if(_0x552469['callRecordingEncryption']&&fs[_0x3162('0x23')](_0x2f88ec['value'])){var _0xf11765=util[_0x3162('0x24')](_0x3162('0x25'),_0x2f88ec[_0x3162('0x26')]);return _0x48de45[_0x3162('0x27')](_0x2f88ec[_0x3162('0x26')],_0xf11765,config[_0x3162('0x28')][_0x3162('0x29')])['then'](function(){fs[_0x3162('0x2a')](_0x2f88ec[_0x3162('0x26')]);logger['info'](_0x3162('0x2b'));return _0x2f88ec;});}return _0x2f88ec;})[_0x3162('0xa')](function(_0x528340){logger['info'](_0x3162('0x1d'),_0x356c5d);logger['debug'](_0x3162('0x1d'),_0x356c5d,JSON[_0x3162('0xf')](_0x528340));_0x2f62d7(_0x528340);})[_0x3162('0x15')](function(_0x551442){logger['error'](_0x3162('0x1d'),_0x551442[_0x3162('0x13')],_0x356c5d);_0x1c03a4(_0x8fa09f['error'](0x1f4,_0x551442[_0x3162('0x13')]));});});}; \ No newline at end of file +var _0x627e=['VoiceRecording','create','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateVoiceRecording','update','options','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption'];(function(_0x515a10,_0x51d916){var _0x44f508=function(_0x3e3ae9){while(--_0x3e3ae9){_0x515a10['push'](_0x515a10['shift']());}};_0x44f508(++_0x51d916);}(_0x627e,0x14a));var _0xe627=function(_0x1fa66a,_0xf80af5){_0x1fa66a=_0x1fa66a-0x0;var _0x2265ea=_0x627e[_0x1fa66a];return _0x2265ea;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});}exports[_0xe627('0x14')]=function(_0x56559b){var _0x2fe46a=this;return new Promise(function(_0x538b22,_0x24fddd){return db['VoiceRecording'][_0xe627('0x15')](_0x56559b['body'],{'raw':_0x56559b['options']?_0x56559b[_0xe627('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56559b[_0xe627('0x16')]?_0x56559b[_0xe627('0x16')]['where']||null:null,'attributes':_0x56559b['options']?_0x56559b['options'][_0xe627('0x17')]||null:null,'limit':_0x56559b[_0xe627('0x16')]?_0x56559b['options'][_0xe627('0x18')]||null:null})[_0xe627('0x19')](function(_0x4873e6){logger[_0xe627('0xb')](_0xe627('0x14'),_0x56559b);logger['debug'](_0xe627('0x14'),_0x56559b,JSON[_0xe627('0xf')](_0x4873e6));_0x538b22(_0x4873e6);})[_0xe627('0x13')](function(_0x536b02){logger[_0xe627('0x10')](_0xe627('0x14'),_0x536b02[_0xe627('0x12')],_0x56559b);_0x24fddd(_0x2fe46a[_0xe627('0x10')](0x1f4,_0x536b02['message']));});});};exports[_0xe627('0x1a')]=function(_0x1fe192){var _0x1635a0=this;return new Promise(function(_0x29eb8e,_0xda614){var _0x40ab91=require(_0xe627('0x1b'));var _0x44c9f7;return db[_0xe627('0x1c')]['findOne']({'attributes':['id',_0xe627('0x1d')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x5cd7c8){_0x44c9f7=_0x5cd7c8;return db[_0xe627('0x1e')][_0xe627('0x1f')](_0x1fe192['body']);})[_0xe627('0x19')](function(_0x54029d){if(_0x44c9f7[_0xe627('0x1d')]&&fs['existsSync'](_0x54029d[_0xe627('0x20')])){var _0x26833a=util['format'](_0xe627('0x21'),_0x54029d['value']);return _0x40ab91[_0xe627('0x22')](_0x54029d[_0xe627('0x20')],_0x26833a,config[_0xe627('0x23')][_0xe627('0x24')])[_0xe627('0x19')](function(){fs[_0xe627('0x25')](_0x54029d[_0xe627('0x20')]);logger[_0xe627('0xb')](_0xe627('0x26'));return _0x54029d;});}return _0x54029d;})[_0xe627('0x19')](function(_0x12ebc9){logger['info']('CreateVoiceRecording',_0x1fe192);logger[_0xe627('0x27')]('CreateVoiceRecording',_0x1fe192,JSON[_0xe627('0xf')](_0x12ebc9));_0x29eb8e(_0x12ebc9);})['catch'](function(_0x56d1d7){logger[_0xe627('0x10')]('CreateVoiceRecording',_0x56d1d7['message'],_0x1fe192);_0xda614(_0x1635a0[_0xe627('0x10')](0x1f4,_0x56d1d7[_0xe627('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4c36539..359d503 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb947=['create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0xb947,0x14f));var _0x7b94=function(_0x3bd4a7,_0x137232){_0x3bd4a7=_0x3bd4a7-0x0;var _0x56585f=_0xb947[_0x3bd4a7];return _0x56585f;};'use strict';var multer=require(_0x7b94('0x0'));var util=require('util');var path=require(_0x7b94('0x1'));var timeout=require(_0x7b94('0x2'));var express=require(_0x7b94('0x3'));var router=express[_0x7b94('0x4')]();var fs_extra=require(_0x7b94('0x5'));var auth=require(_0x7b94('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7b94('0x7'));var controller=require(_0x7b94('0x8'));router[_0x7b94('0x9')]('/',auth[_0x7b94('0xa')](),controller[_0x7b94('0xb')]);router[_0x7b94('0x9')](_0x7b94('0xc'),auth[_0x7b94('0xa')](),controller[_0x7b94('0xd')]);router[_0x7b94('0x9')](_0x7b94('0xe'),auth[_0x7b94('0xa')](),controller[_0x7b94('0xf')]);router[_0x7b94('0x10')]('/',auth[_0x7b94('0xa')](),controller[_0x7b94('0x11')]);router[_0x7b94('0x12')](_0x7b94('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x7b94('0x13')](_0x7b94('0xe'),auth['isAuthenticated'](),controller[_0x7b94('0x14')]);module[_0x7b94('0x15')]=router; \ No newline at end of file +var _0x1197=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x1197,0x7b));var _0x7119=function(_0x5c1f54,_0x558080){_0x5c1f54=_0x5c1f54-0x0;var _0x257ed5=_0x1197[_0x5c1f54];return _0x257ed5;};'use strict';var multer=require(_0x7119('0x0'));var util=require(_0x7119('0x1'));var path=require(_0x7119('0x2'));var timeout=require(_0x7119('0x3'));var express=require(_0x7119('0x4'));var router=express['Router']();var fs_extra=require(_0x7119('0x5'));var auth=require(_0x7119('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7119('0x7'));var controller=require(_0x7119('0x8'));router[_0x7119('0x9')]('/',auth[_0x7119('0xa')](),controller[_0x7119('0xb')]);router[_0x7119('0x9')](_0x7119('0xc'),auth['isAuthenticated'](),controller[_0x7119('0xd')]);router[_0x7119('0x9')]('/:id',auth[_0x7119('0xa')](),controller['show']);router['post']('/',auth[_0x7119('0xa')](),controller[_0x7119('0xe')]);router[_0x7119('0xf')](_0x7119('0x10'),auth[_0x7119('0xa')](),controller[_0x7119('0x11')]);router[_0x7119('0x12')]('/:id',auth[_0x7119('0xa')](),controller[_0x7119('0x13')]);module[_0x7119('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 1d728db..6ed68a9 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.attributes.js +++ b/server/api/voiceTransferReport/voiceTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51b9=['Yes','sequelize','ENUM','blind','attended','STRING'];(function(_0x3d872a,_0x4b246d){var _0x387f64=function(_0x9d622c){while(--_0x9d622c){_0x3d872a['push'](_0x3d872a['shift']());}};_0x387f64(++_0x4b246d);}(_0x51b9,0x11b));var _0x951b=function(_0x2dbaa6,_0x19c303){_0x2dbaa6=_0x2dbaa6-0x0;var _0x1b57ba=_0x51b9[_0x2dbaa6];return _0x1b57ba;};'use strict';var Sequelize=require(_0x951b('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x951b('0x1')](_0x951b('0x2'),_0x951b('0x3'))},'result':{'type':Sequelize[_0x951b('0x4')]},'transfererchannel':{'type':Sequelize[_0x951b('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x951b('0x4')]},'transferercalleridname':{'type':Sequelize[_0x951b('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x951b('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x951b('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x951b('0x4')]},'transferercontext':{'type':Sequelize[_0x951b('0x4')]},'transfererexten':{'type':Sequelize[_0x951b('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x951b('0x4')]},'transfereechannel':{'type':Sequelize[_0x951b('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x951b('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x951b('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x951b('0x1')](_0x951b('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x951b('0x4')]}}; \ No newline at end of file +var _0x9465=['blind','attended','STRING','sequelize','ENUM'];(function(_0x19b23e,_0x5813de){var _0x54372c=function(_0x742640){while(--_0x742640){_0x19b23e['push'](_0x19b23e['shift']());}};_0x54372c(++_0x5813de);}(_0x9465,0xbc));var _0x5946=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x9465[_0x3de7e0];return _0x11d0b3;};'use strict';var Sequelize=require(_0x5946('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x5946('0x1')](_0x5946('0x2'),_0x5946('0x3'))},'result':{'type':Sequelize[_0x5946('0x4')]},'transfererchannel':{'type':Sequelize[_0x5946('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x5946('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5946('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x5946('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x5946('0x4')]},'transferercontext':{'type':Sequelize[_0x5946('0x4')]},'transfererexten':{'type':Sequelize[_0x5946('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x5946('0x4')]},'transfereechannel':{'type':Sequelize[_0x5946('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x5946('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x5946('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x5946('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x5946('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5946('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index db92afc..beff69d 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.controller.js +++ b/server/api/voiceTransferReport/voiceTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31df=['name','index','map','VoiceTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','fields','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x31df,0xf4));var _0xf31d=function(_0x369887,_0x1a53b0){_0x369887=_0x369887-0x0;var _0x739866=_0x31df[_0x369887];return _0x739866;};'use strict';var emlformat=require(_0xf31d('0x0'));var rimraf=require(_0xf31d('0x1'));var zipdir=require(_0xf31d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf31d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf31d('0x4'));var util=require(_0xf31d('0x5'));var path=require('path');var sox=require(_0xf31d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf31d('0x7'));var squel=require(_0xf31d('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf31d('0x9'));var toCsv=require(_0xf31d('0xa'));var querystring=require(_0xf31d('0xb'));var Papa=require(_0xf31d('0xc'));var Redis=require('ioredis');var authService=require(_0xf31d('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf31d('0xe'));var logger=require(_0xf31d('0xf'))(_0xf31d('0x10'));var utils=require(_0xf31d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf31d('0x12'));var db=require(_0xf31d('0x13'))['db'];function respondWithStatusCode(_0x4de49d,_0x1cf2bb){_0x1cf2bb=_0x1cf2bb||0xcc;return function(_0xf99804){if(_0xf99804){return _0x4de49d[_0xf31d('0x14')](_0x1cf2bb);}return _0x4de49d[_0xf31d('0x15')](_0x1cf2bb)[_0xf31d('0x16')]();};}function respondWithResult(_0xf16a5d,_0x1e6d5f){_0x1e6d5f=_0x1e6d5f||0xc8;return function(_0xd5d6c3){if(_0xd5d6c3){return _0xf16a5d[_0xf31d('0x15')](_0x1e6d5f)[_0xf31d('0x17')](_0xd5d6c3);}};}function respondWithFilteredResult(_0x4aa45c,_0x8c43da){return function(_0x3efc9f){if(_0x3efc9f){var _0x22f07d=typeof _0x8c43da['offset']==='undefined'&&typeof _0x8c43da[_0xf31d('0x18')]===_0xf31d('0x19');var _0x4241f6=_0x3efc9f['count'];var _0x15fb51=_0x22f07d?0x0:_0x8c43da[_0xf31d('0x1a')];var _0x36a8da=_0x22f07d?_0x3efc9f['count']:_0x8c43da[_0xf31d('0x1a')]+_0x8c43da[_0xf31d('0x18')];var _0x28cfbe;if(_0x36a8da>=_0x4241f6){_0x36a8da=_0x4241f6;_0x28cfbe=0xc8;}else{_0x28cfbe=0xce;}_0x4aa45c[_0xf31d('0x15')](_0x28cfbe);return _0x4aa45c[_0xf31d('0x1b')](_0xf31d('0x1c'),_0x15fb51+'-'+_0x36a8da+'/'+_0x4241f6)[_0xf31d('0x17')](_0x3efc9f);}return null;};}function patchUpdates(_0x5b5267){return function(_0x30b108){try{jsonpatch[_0xf31d('0x1d')](_0x30b108,_0x5b5267,!![]);}catch(_0x1156ed){return BPromise['reject'](_0x1156ed);}return _0x30b108[_0xf31d('0x1e')]();};}function saveUpdates(_0x5619bf,_0x180aef){return function(_0x45f99d){if(_0x45f99d){return _0x45f99d[_0xf31d('0x1f')](_0x5619bf)[_0xf31d('0x20')](function(_0x2f9c8b){return _0x2f9c8b;});}return null;};}function removeEntity(_0x7b28f1,_0x2493c9){return function(_0x4d12bc){if(_0x4d12bc){return _0x4d12bc[_0xf31d('0x21')]()[_0xf31d('0x20')](function(){_0x7b28f1[_0xf31d('0x15')](0xcc)[_0xf31d('0x16')]();});}};}function handleEntityNotFound(_0xf0f7b6,_0x4d59fb){return function(_0x462916){if(!_0x462916){_0xf0f7b6[_0xf31d('0x14')](0x194);}return _0x462916;};}function handleError(_0x7f9d28,_0x39b008){_0x39b008=_0x39b008||0x1f4;return function(_0x3b1575){logger[_0xf31d('0x22')](_0x3b1575[_0xf31d('0x23')]);if(_0x3b1575[_0xf31d('0x24')]){delete _0x3b1575[_0xf31d('0x24')];}_0x7f9d28[_0xf31d('0x15')](_0x39b008)['send'](_0x3b1575);};}exports[_0xf31d('0x25')]=function(_0x1649a5,_0x1966a2){var _0x1d6a8b={},_0x597275={},_0xc483e8={'count':0x0,'rows':[]};var _0x359c39=_[_0xf31d('0x26')](db[_0xf31d('0x27')][_0xf31d('0x28')],function(_0xf1bd35){return{'name':_0xf1bd35['fieldName'],'type':_0xf1bd35[_0xf31d('0x29')][_0xf31d('0x2a')]};});_0x597275[_0xf31d('0x2b')]=_['map'](_0x359c39,_0xf31d('0x24'));_0x597275[_0xf31d('0x2c')]=_[_0xf31d('0x2d')](_0x1649a5[_0xf31d('0x2c')]);_0x597275[_0xf31d('0x2e')]=_['intersection'](_0x597275[_0xf31d('0x2b')],_0x597275['query']);_0x1d6a8b[_0xf31d('0x2f')]=_[_0xf31d('0x30')](_0x597275[_0xf31d('0x2b')],qs['fields'](_0x1649a5[_0xf31d('0x2c')]['fields']));_0x1d6a8b[_0xf31d('0x2f')]=_0x1d6a8b['attributes']['length']?_0x1d6a8b[_0xf31d('0x2f')]:_0x597275['model'];if(!_0x1649a5[_0xf31d('0x2c')][_0xf31d('0x31')]('nolimit')){_0x1d6a8b[_0xf31d('0x18')]=qs[_0xf31d('0x18')](_0x1649a5[_0xf31d('0x2c')]['limit']);_0x1d6a8b['offset']=qs['offset'](_0x1649a5[_0xf31d('0x2c')]['offset']);}_0x1d6a8b['order']=qs[_0xf31d('0x32')](_0x1649a5[_0xf31d('0x2c')][_0xf31d('0x32')]);_0x1d6a8b['where']=qs['filters'](_[_0xf31d('0x33')](_0x1649a5[_0xf31d('0x2c')],_0x597275[_0xf31d('0x2e')]),_0x359c39);if(_0x1649a5['query'][_0xf31d('0x34')]){_0x1d6a8b[_0xf31d('0x35')]=_[_0xf31d('0x36')](_0x1d6a8b[_0xf31d('0x35')],{'$or':_[_0xf31d('0x26')](_0x359c39,function(_0x2c0d34){if(_0x2c0d34[_0xf31d('0x29')]!==_0xf31d('0x37')){var _0x484fca={};_0x484fca[_0x2c0d34['name']]={'$like':'%'+_0x1649a5[_0xf31d('0x2c')][_0xf31d('0x34')]+'%'};return _0x484fca;}})});}_0x1d6a8b=_[_0xf31d('0x36')]({},_0x1d6a8b,_0x1649a5[_0xf31d('0x38')]);var _0x20294a={'where':_0x1d6a8b[_0xf31d('0x35')]};return db[_0xf31d('0x27')][_0xf31d('0x39')](_0x20294a)[_0xf31d('0x20')](function(_0x519943){_0xc483e8[_0xf31d('0x39')]=_0x519943;if(_0x1649a5[_0xf31d('0x2c')][_0xf31d('0x3a')]){_0x1d6a8b[_0xf31d('0x3b')]=[{'all':!![]}];}return db[_0xf31d('0x27')]['findAll'](_0x1d6a8b);})[_0xf31d('0x20')](function(_0x571c19){_0xc483e8[_0xf31d('0x3c')]=_0x571c19;return _0xc483e8;})[_0xf31d('0x20')](respondWithFilteredResult(_0x1966a2,_0x1d6a8b))[_0xf31d('0x3d')](handleError(_0x1966a2,null));};exports[_0xf31d('0x3e')]=function(_0x3a339b,_0x263347){var _0x629ce2={'raw':!![],'where':{'id':_0x3a339b[_0xf31d('0x3f')]['id']}},_0xe842e3={};_0xe842e3[_0xf31d('0x2b')]=_[_0xf31d('0x2d')](db['VoiceTransferReport'][_0xf31d('0x28')]);_0xe842e3[_0xf31d('0x2c')]=_[_0xf31d('0x2d')](_0x3a339b[_0xf31d('0x2c')]);_0xe842e3[_0xf31d('0x2e')]=_[_0xf31d('0x30')](_0xe842e3[_0xf31d('0x2b')],_0xe842e3[_0xf31d('0x2c')]);_0x629ce2[_0xf31d('0x2f')]=_[_0xf31d('0x30')](_0xe842e3[_0xf31d('0x2b')],qs['fields'](_0x3a339b[_0xf31d('0x2c')][_0xf31d('0x40')]));_0x629ce2[_0xf31d('0x2f')]=_0x629ce2[_0xf31d('0x2f')][_0xf31d('0x41')]?_0x629ce2[_0xf31d('0x2f')]:_0xe842e3['model'];if(_0x3a339b[_0xf31d('0x2c')][_0xf31d('0x3a')]){_0x629ce2[_0xf31d('0x3b')]=[{'all':!![]}];}_0x629ce2=_[_0xf31d('0x36')]({},_0x629ce2,_0x3a339b[_0xf31d('0x38')]);return db[_0xf31d('0x27')][_0xf31d('0x42')](_0x629ce2)[_0xf31d('0x20')](handleEntityNotFound(_0x263347,null))['then'](respondWithResult(_0x263347,null))[_0xf31d('0x3d')](handleError(_0x263347,null));};exports['create']=function(_0x3360a0,_0x1bcf2d){return db[_0xf31d('0x27')][_0xf31d('0x43')](_0x3360a0[_0xf31d('0x44')],{})[_0xf31d('0x20')](respondWithResult(_0x1bcf2d,0xc9))['catch'](handleError(_0x1bcf2d,null));};exports[_0xf31d('0x1f')]=function(_0x278806,_0x427808){if(_0x278806[_0xf31d('0x44')]['id']){delete _0x278806[_0xf31d('0x44')]['id'];}return db[_0xf31d('0x27')]['find']({'where':{'id':_0x278806['params']['id']}})[_0xf31d('0x20')](handleEntityNotFound(_0x427808,null))[_0xf31d('0x20')](saveUpdates(_0x278806['body'],null))[_0xf31d('0x20')](respondWithResult(_0x427808,null))[_0xf31d('0x3d')](handleError(_0x427808,null));};exports['destroy']=function(_0x168b25,_0x1e6e69){return db[_0xf31d('0x27')]['find']({'where':{'id':_0x168b25['params']['id']}})[_0xf31d('0x20')](handleEntityNotFound(_0x1e6e69,null))[_0xf31d('0x20')](removeEntity(_0x1e6e69,null))[_0xf31d('0x3d')](handleError(_0x1e6e69,null));};exports[_0xf31d('0x45')]=function(_0x51691f,_0x50efb3){return db['VoiceTransferReport'][_0xf31d('0x45')]()['then'](respondWithResult(_0x50efb3,null))[_0xf31d('0x3d')](handleError(_0x50efb3,null));}; \ No newline at end of file +var _0x65e0=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x265ec7,_0x5d062c){var _0x351b7d=function(_0x5e14d2){while(--_0x5e14d2){_0x265ec7['push'](_0x265ec7['shift']());}};_0x351b7d(++_0x5d062c);}(_0x65e0,0x156));var _0x065e=function(_0x316b13,_0x21c7b3){_0x316b13=_0x316b13-0x0;var _0x29ab59=_0x65e0[_0x316b13];return _0x29ab59;};'use strict';var emlformat=require(_0x065e('0x0'));var rimraf=require(_0x065e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x065e('0x2'));var rp=require('request-promise');var moment=require(_0x065e('0x3'));var BPromise=require(_0x065e('0x4'));var Mustache=require(_0x065e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x065e('0x6'));var fs=require('fs');var fs_extra=require(_0x065e('0x7'));var _=require('lodash');var squel=require(_0x065e('0x8'));var crypto=require(_0x065e('0x9'));var jsforce=require(_0x065e('0xa'));var deskjs=require(_0x065e('0xb'));var toCsv=require(_0x065e('0xc'));var querystring=require(_0x065e('0xd'));var Papa=require('papaparse');var Redis=require(_0x065e('0xe'));var authService=require(_0x065e('0xf'));var qs=require(_0x065e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x065e('0x11'));var logger=require(_0x065e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x065e('0x13'));var licenseUtil=require(_0x065e('0x14'));var db=require(_0x065e('0x15'))['db'];function respondWithStatusCode(_0xf7dc3d,_0x2f5b37){_0x2f5b37=_0x2f5b37||0xcc;return function(_0x2999d4){if(_0x2999d4){return _0xf7dc3d[_0x065e('0x16')](_0x2f5b37);}return _0xf7dc3d[_0x065e('0x17')](_0x2f5b37)[_0x065e('0x18')]();};}function respondWithResult(_0xf64354,_0x11fb7e){_0x11fb7e=_0x11fb7e||0xc8;return function(_0x4c0ccf){if(_0x4c0ccf){return _0xf64354[_0x065e('0x17')](_0x11fb7e)[_0x065e('0x19')](_0x4c0ccf);}};}function respondWithFilteredResult(_0x4eee41,_0x292a37){return function(_0x46fcf4){if(_0x46fcf4){var _0x4084e6=typeof _0x292a37[_0x065e('0x1a')]===_0x065e('0x1b')&&typeof _0x292a37['limit']==='undefined';var _0x540b53=_0x46fcf4['count'];var _0x520965=_0x4084e6?0x0:_0x292a37[_0x065e('0x1a')];var _0x84fdd4=_0x4084e6?_0x46fcf4[_0x065e('0x1c')]:_0x292a37[_0x065e('0x1a')]+_0x292a37[_0x065e('0x1d')];var _0x3b600a;if(_0x84fdd4>=_0x540b53){_0x84fdd4=_0x540b53;_0x3b600a=0xc8;}else{_0x3b600a=0xce;}_0x4eee41[_0x065e('0x17')](_0x3b600a);return _0x4eee41[_0x065e('0x1e')](_0x065e('0x1f'),_0x520965+'-'+_0x84fdd4+'/'+_0x540b53)[_0x065e('0x19')](_0x46fcf4);}return null;};}function patchUpdates(_0xd0f247){return function(_0x4984bd){try{jsonpatch[_0x065e('0x20')](_0x4984bd,_0xd0f247,!![]);}catch(_0x4394e9){return BPromise[_0x065e('0x21')](_0x4394e9);}return _0x4984bd[_0x065e('0x22')]();};}function saveUpdates(_0x232da4,_0x38b106){return function(_0x2765e9){if(_0x2765e9){return _0x2765e9['update'](_0x232da4)[_0x065e('0x23')](function(_0x462dd1){return _0x462dd1;});}return null;};}function removeEntity(_0x9c9ab1,_0x542c9a){return function(_0x4ef234){if(_0x4ef234){return _0x4ef234[_0x065e('0x24')]()['then'](function(){_0x9c9ab1[_0x065e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44f054,_0x590f86){return function(_0x233bbd){if(!_0x233bbd){_0x44f054[_0x065e('0x16')](0x194);}return _0x233bbd;};}function handleError(_0x276c49,_0x3d7a4e){_0x3d7a4e=_0x3d7a4e||0x1f4;return function(_0x3af155){logger[_0x065e('0x25')](_0x3af155[_0x065e('0x26')]);if(_0x3af155['name']){delete _0x3af155[_0x065e('0x27')];}_0x276c49[_0x065e('0x17')](_0x3d7a4e)['send'](_0x3af155);};}exports[_0x065e('0x28')]=function(_0x2cb37c,_0xd73222){var _0xb345b={},_0x37c048={},_0x480082={'count':0x0,'rows':[]};var _0x1fa48b=_[_0x065e('0x29')](db['VoiceTransferReport'][_0x065e('0x2a')],function(_0x3ec8b8){return{'name':_0x3ec8b8['fieldName'],'type':_0x3ec8b8['type'][_0x065e('0x2b')]};});_0x37c048['model']=_[_0x065e('0x29')](_0x1fa48b,'name');_0x37c048[_0x065e('0x2c')]=_[_0x065e('0x2d')](_0x2cb37c['query']);_0x37c048['filters']=_[_0x065e('0x2e')](_0x37c048[_0x065e('0x2f')],_0x37c048[_0x065e('0x2c')]);_0xb345b[_0x065e('0x30')]=_[_0x065e('0x2e')](_0x37c048[_0x065e('0x2f')],qs[_0x065e('0x31')](_0x2cb37c[_0x065e('0x2c')][_0x065e('0x31')]));_0xb345b[_0x065e('0x30')]=_0xb345b[_0x065e('0x30')][_0x065e('0x32')]?_0xb345b[_0x065e('0x30')]:_0x37c048[_0x065e('0x2f')];if(!_0x2cb37c['query']['hasOwnProperty'](_0x065e('0x33'))){_0xb345b[_0x065e('0x1d')]=qs[_0x065e('0x1d')](_0x2cb37c[_0x065e('0x2c')][_0x065e('0x1d')]);_0xb345b[_0x065e('0x1a')]=qs[_0x065e('0x1a')](_0x2cb37c[_0x065e('0x2c')][_0x065e('0x1a')]);}_0xb345b[_0x065e('0x34')]=qs[_0x065e('0x35')](_0x2cb37c[_0x065e('0x2c')][_0x065e('0x35')]);_0xb345b[_0x065e('0x36')]=qs[_0x065e('0x37')](_['pick'](_0x2cb37c['query'],_0x37c048[_0x065e('0x37')]),_0x1fa48b);if(_0x2cb37c['query'][_0x065e('0x38')]){_0xb345b[_0x065e('0x36')]=_[_0x065e('0x39')](_0xb345b[_0x065e('0x36')],{'$or':_['map'](_0x1fa48b,function(_0xfc6e01){if(_0xfc6e01['type']!==_0x065e('0x3a')){var _0x349c40={};_0x349c40[_0xfc6e01[_0x065e('0x27')]]={'$like':'%'+_0x2cb37c[_0x065e('0x2c')][_0x065e('0x38')]+'%'};return _0x349c40;}})});}_0xb345b=_[_0x065e('0x39')]({},_0xb345b,_0x2cb37c[_0x065e('0x3b')]);var _0x321fa7={'where':_0xb345b[_0x065e('0x36')]};return db[_0x065e('0x3c')]['count'](_0x321fa7)[_0x065e('0x23')](function(_0x589506){_0x480082[_0x065e('0x1c')]=_0x589506;if(_0x2cb37c[_0x065e('0x2c')][_0x065e('0x3d')]){_0xb345b[_0x065e('0x3e')]=[{'all':!![]}];}return db[_0x065e('0x3c')][_0x065e('0x3f')](_0xb345b);})[_0x065e('0x23')](function(_0x87ed57){_0x480082[_0x065e('0x40')]=_0x87ed57;return _0x480082;})['then'](respondWithFilteredResult(_0xd73222,_0xb345b))[_0x065e('0x41')](handleError(_0xd73222,null));};exports[_0x065e('0x42')]=function(_0x1681cc,_0xd6c945){var _0x508348={'raw':!![],'where':{'id':_0x1681cc[_0x065e('0x43')]['id']}},_0x982c81={};_0x982c81['model']=_[_0x065e('0x2d')](db[_0x065e('0x3c')]['rawAttributes']);_0x982c81[_0x065e('0x2c')]=_[_0x065e('0x2d')](_0x1681cc[_0x065e('0x2c')]);_0x982c81[_0x065e('0x37')]=_[_0x065e('0x2e')](_0x982c81[_0x065e('0x2f')],_0x982c81['query']);_0x508348[_0x065e('0x30')]=_[_0x065e('0x2e')](_0x982c81['model'],qs[_0x065e('0x31')](_0x1681cc['query'][_0x065e('0x31')]));_0x508348['attributes']=_0x508348['attributes'][_0x065e('0x32')]?_0x508348[_0x065e('0x30')]:_0x982c81[_0x065e('0x2f')];if(_0x1681cc[_0x065e('0x2c')][_0x065e('0x3d')]){_0x508348[_0x065e('0x3e')]=[{'all':!![]}];}_0x508348=_['merge']({},_0x508348,_0x1681cc[_0x065e('0x3b')]);return db[_0x065e('0x3c')][_0x065e('0x44')](_0x508348)[_0x065e('0x23')](handleEntityNotFound(_0xd6c945,null))[_0x065e('0x23')](respondWithResult(_0xd6c945,null))['catch'](handleError(_0xd6c945,null));};exports[_0x065e('0x45')]=function(_0x2640cd,_0x44f55d){return db[_0x065e('0x3c')][_0x065e('0x45')](_0x2640cd[_0x065e('0x46')],{})[_0x065e('0x23')](respondWithResult(_0x44f55d,0xc9))[_0x065e('0x41')](handleError(_0x44f55d,null));};exports['update']=function(_0x5190ce,_0x198b6d){if(_0x5190ce['body']['id']){delete _0x5190ce[_0x065e('0x46')]['id'];}return db[_0x065e('0x3c')][_0x065e('0x44')]({'where':{'id':_0x5190ce[_0x065e('0x43')]['id']}})[_0x065e('0x23')](handleEntityNotFound(_0x198b6d,null))[_0x065e('0x23')](saveUpdates(_0x5190ce[_0x065e('0x46')],null))[_0x065e('0x23')](respondWithResult(_0x198b6d,null))['catch'](handleError(_0x198b6d,null));};exports[_0x065e('0x24')]=function(_0x450596,_0x556ac2){return db[_0x065e('0x3c')][_0x065e('0x44')]({'where':{'id':_0x450596[_0x065e('0x43')]['id']}})[_0x065e('0x23')](handleEntityNotFound(_0x556ac2,null))['then'](removeEntity(_0x556ac2,null))['catch'](handleError(_0x556ac2,null));};exports[_0x065e('0x47')]=function(_0x502b94,_0x37784b){return db['VoiceTransferReport']['describe']()[_0x065e('0x23')](respondWithResult(_0x37784b,null))[_0x065e('0x41')](handleError(_0x37784b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1a11d0c..c99a2ac 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.model.js +++ b/server/api/voiceTransferReport/voiceTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97fa=['../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','api','moment','request-promise','rimraf'];(function(_0x11c7e8,_0x1764c4){var _0x5a4da7=function(_0x4be14a){while(--_0x4be14a){_0x11c7e8['push'](_0x11c7e8['shift']());}};_0x5a4da7(++_0x1764c4);}(_0x97fa,0x131));var _0xa97f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97fa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa97f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa97f('0x1'));var moment=require(_0xa97f('0x2'));var BPromise=require('bluebird');var rp=require(_0xa97f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa97f('0x4'));var config=require(_0xa97f('0x5'));var attributes=require(_0xa97f('0x6'));module['exports']=function(_0x398579,_0x2a7ada){return _0x398579[_0xa97f('0x7')](_0xa97f('0x8'),attributes,{'tableName':_0xa97f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3902=['util','../../config/logger','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','report_call_transfer'];(function(_0x5b7c1c,_0x30781e){var _0x929a0f=function(_0x7cbe9){while(--_0x7cbe9){_0x5b7c1c['push'](_0x5b7c1c['shift']());}};_0x929a0f(++_0x30781e);}(_0x3902,0x1c2));var _0x2390=function(_0x591377,_0x200c78){_0x591377=_0x591377-0x0;var _0x6e4b30=_0x3902[_0x591377];return _0x6e4b30;};'use strict';var _=require('lodash');var util=require(_0x2390('0x0'));var logger=require(_0x2390('0x1'))('api');var moment=require(_0x2390('0x2'));var BPromise=require('bluebird');var rp=require(_0x2390('0x3'));var fs=require('fs');var path=require(_0x2390('0x4'));var rimraf=require(_0x2390('0x5'));var config=require('../../config/environment');var attributes=require(_0x2390('0x6'));module[_0x2390('0x7')]=function(_0x31e87d,_0x870c0c){return _0x31e87d[_0x2390('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x2390('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 949478c..ed89e5c 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.rpc.js +++ b/server/api/voiceTransferReport/voiceTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f28=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2361eb,_0x18f7f9){var _0x2d422b=function(_0x4a3d56){while(--_0x4a3d56){_0x2361eb['push'](_0x2361eb['shift']());}};_0x2d422b(++_0x18f7f9);}(_0x4f28,0x181));var _0x84f2=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x4f28[_0x37e886];return _0x57c5cd;};'use strict';var _=require(_0x84f2('0x0'));var util=require(_0x84f2('0x1'));var moment=require(_0x84f2('0x2'));var BPromise=require(_0x84f2('0x3'));var rs=require(_0x84f2('0x4'));var fs=require('fs');var Redis=require(_0x84f2('0x5'));var db=require(_0x84f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84f2('0x7'))(_0x84f2('0x8'));var config=require(_0x84f2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x84f2('0xa')][_0x84f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be00a,_0x34c49b,_0x33ffd7){return new BPromise(function(_0x2f50e0,_0x2283c4){return client['request'](_0x2be00a,_0x33ffd7)['then'](function(_0x1ed3b8){logger[_0x84f2('0xc')](_0x84f2('0xd'),_0x34c49b,'request\x20sent');logger[_0x84f2('0xe')](_0x84f2('0xf'),_0x34c49b,_0x84f2('0x10'),JSON['stringify'](_0x1ed3b8));if(_0x1ed3b8['error']){if(_0x1ed3b8[_0x84f2('0x11')][_0x84f2('0x12')]===0x1f4){logger[_0x84f2('0x11')](_0x84f2('0xd'),_0x34c49b,_0x1ed3b8['error'][_0x84f2('0x13')]);return _0x2283c4(_0x1ed3b8[_0x84f2('0x11')][_0x84f2('0x13')]);}logger[_0x84f2('0x11')](_0x84f2('0xd'),_0x34c49b,_0x1ed3b8[_0x84f2('0x11')][_0x84f2('0x13')]);return _0x2f50e0(_0x1ed3b8['error']['message']);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x34c49b,'request\x20sent');_0x2f50e0(_0x1ed3b8[_0x84f2('0x14')]['message']);}})['catch'](function(_0x5e5a9b){logger[_0x84f2('0x11')](_0x84f2('0xd'),_0x34c49b,_0x5e5a9b);_0x2283c4(_0x5e5a9b);});});}exports[_0x84f2('0x15')]=function(_0xa7d82d){var _0x15cd12=this;return new Promise(function(_0x58e1d2,_0xc90e06){return db[_0x84f2('0x16')][_0x84f2('0x17')](_0xa7d82d[_0x84f2('0x18')],{'raw':_0xa7d82d[_0x84f2('0x19')]?_0xa7d82d['options'][_0x84f2('0x1a')]===undefined?!![]:![]:!![]})[_0x84f2('0x1b')](function(_0x501221){logger[_0x84f2('0xc')](_0x84f2('0x15'),_0xa7d82d);logger['debug'](_0x84f2('0x15'),_0xa7d82d,JSON[_0x84f2('0x1c')](_0x501221));_0x58e1d2(_0x501221);})[_0x84f2('0x1d')](function(_0x11e60c){logger[_0x84f2('0x11')](_0x84f2('0x15'),_0x11e60c['message'],_0xa7d82d);_0xc90e06(_0x15cd12[_0x84f2('0x11')](0x1f4,_0x11e60c['message']));});});}; \ No newline at end of file +var _0xab51=['CreateVoiceTransferReport','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceTransferReport','create','body','options','raw'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xab51,0x92));var _0x1ab5=function(_0x2c639b,_0x1cbcdd){_0x2c639b=_0x2c639b-0x0;var _0x26e55c=_0xab51[_0x2c639b];return _0x26e55c;};'use strict';var _=require(_0x1ab5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ab5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ab5('0x2'));var db=require(_0x1ab5('0x3'))['db'];var utils=require(_0x1ab5('0x4'));var logger=require(_0x1ab5('0x5'))(_0x1ab5('0x6'));var config=require(_0x1ab5('0x7'));var jayson=require(_0x1ab5('0x8'));var client=jayson[_0x1ab5('0x9')][_0x1ab5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x266504,_0x22497b,_0x5f29b3){return new BPromise(function(_0x326846,_0x1ee3fa){return client[_0x1ab5('0xb')](_0x266504,_0x5f29b3)[_0x1ab5('0xc')](function(_0x3834c5){logger[_0x1ab5('0xd')](_0x1ab5('0xe'),_0x22497b,_0x1ab5('0xf'));logger[_0x1ab5('0x10')](_0x1ab5('0x11'),_0x22497b,_0x1ab5('0xf'),JSON[_0x1ab5('0x12')](_0x3834c5));if(_0x3834c5[_0x1ab5('0x13')]){if(_0x3834c5[_0x1ab5('0x13')]['code']===0x1f4){logger['error'](_0x1ab5('0xe'),_0x22497b,_0x3834c5[_0x1ab5('0x13')][_0x1ab5('0x14')]);return _0x1ee3fa(_0x3834c5[_0x1ab5('0x13')][_0x1ab5('0x14')]);}logger[_0x1ab5('0x13')](_0x1ab5('0xe'),_0x22497b,_0x3834c5[_0x1ab5('0x13')][_0x1ab5('0x14')]);return _0x326846(_0x3834c5[_0x1ab5('0x13')]['message']);}else{logger[_0x1ab5('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x22497b,_0x1ab5('0xf'));_0x326846(_0x3834c5[_0x1ab5('0x15')]['message']);}})[_0x1ab5('0x16')](function(_0x14232e){logger[_0x1ab5('0x13')](_0x1ab5('0xe'),_0x22497b,_0x14232e);_0x1ee3fa(_0x14232e);});});}exports['CreateVoiceTransferReport']=function(_0x48cddf){var _0x1f2962=this;return new Promise(function(_0x3e8510,_0x1be7cc){return db[_0x1ab5('0x17')][_0x1ab5('0x18')](_0x48cddf[_0x1ab5('0x19')],{'raw':_0x48cddf[_0x1ab5('0x1a')]?_0x48cddf[_0x1ab5('0x1a')][_0x1ab5('0x1b')]===undefined?!![]:![]:!![]})[_0x1ab5('0xc')](function(_0x5cfa08){logger[_0x1ab5('0xd')](_0x1ab5('0x1c'),_0x48cddf);logger[_0x1ab5('0x10')]('CreateVoiceTransferReport',_0x48cddf,JSON[_0x1ab5('0x12')](_0x5cfa08));_0x3e8510(_0x5cfa08);})[_0x1ab5('0x16')](function(_0x49ce2b){logger[_0x1ab5('0x13')](_0x1ab5('0x1c'),_0x49ce2b[_0x1ab5('0x14')],_0x48cddf);_0x1be7cc(_0x1f2962[_0x1ab5('0x13')](0x1f4,_0x49ce2b['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index fba3fa4..da57064 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x287779,_0x226f32){var _0x4202b2=function(_0x40d238){while(--_0x40d238){_0x287779['push'](_0x287779['shift']());}};_0x4202b2(++_0x226f32);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5091de,_0x290e49){_0x5091de=_0x5091de-0x0;var _0x530be9=_0x6f0d[_0x5091de];return _0x530be9;};'use strict';var express=require('express');var router=express[_0xd6f0('0x0')]();var auth=require(_0xd6f0('0x1'));var controller=require(_0xd6f0('0x2'));router[_0xd6f0('0x3')]('/originate',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0x6')]);router[_0xd6f0('0x3')](_0xd6f0('0x7'),auth['isAuthenticated'](),auth[_0xd6f0('0x5')](),controller['hangup']);router[_0xd6f0('0x3')](_0xd6f0('0x8'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller['answer']);router['post'](_0xd6f0('0x9'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xa')]);router[_0xd6f0('0x3')]('/unhold',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xb')]);router[_0xd6f0('0x3')]('/calls',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x3')](_0xd6f0('0xd'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xe')]);module[_0xd6f0('0xf')]=router; \ No newline at end of file +var _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x191a2b,_0x37a723){var _0x57b02d=function(_0x5e6d20){while(--_0x5e6d20){_0x191a2b['push'](_0x191a2b['shift']());}};_0x57b02d(++_0x37a723);}(_0xbec5,0xe5));var _0x5bec=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xbec5[_0x450689];return _0x46ffb0;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 7030f1d..5507bf5 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57d4=['filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','catch','hangup\x20fired:','json','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','webbar:conference','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','log','handleError:','stack','status','send','name','NotFound','request','error','code','message','result','findOne','agent','then','VoiceChannels'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x57d4,0x78));var _0x457d=function(_0x5c1fc6,_0x2919e6){_0x5c1fc6=_0x5c1fc6-0x0;var _0x507a47=_0x57d4[_0x5c1fc6];return _0x507a47;};'use strict';var path=require(_0x457d('0x0'));var fs=require('fs');var _=require(_0x457d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x457d('0x2'));var util=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var jayson=require(_0x457d('0x5'));var amiClient=jayson[_0x457d('0x6')][_0x457d('0x7')]({'port':0x232a});var logger=require(_0x457d('0x8'))(_0x457d('0x9'));var Redis=require(_0x457d('0xa'));config[_0x457d('0xb')]=_[_0x457d('0xc')](config['redis'],{'host':_0x457d('0xd'),'port':0x18eb});var io=require(_0x457d('0xe'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'callNumber':{'type':_0x457d('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'sessionId':{'type':_0x457d('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'sessionId':{'type':_0x457d('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'sessionId':{'type':_0x457d('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x457d('0x11'),'required':[!![],_0x457d('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x457d('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'sessionId':{'type':_0x457d('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]}});function emit(_0x55c6e4,_0xc9b3f8,_0x1ebc33){logger[_0x457d('0x13')](_0x55c6e4,_0xc9b3f8,JSON['stringify'](_0x1ebc33));io['to'](_0x55c6e4)['emit'](_0xc9b3f8,_0x1ebc33);}function handleError(_0xc0751f){return function(_0x4d988f){console[_0x457d('0x14')](_0x457d('0x15'),_0x4d988f,_0x4d988f instanceof RangeError);logger['error'](_0x4d988f[_0x457d('0x16')]);if(_0x4d988f instanceof RangeError){if(_0x4d988f['name']){delete _0x4d988f['name'];}_0xc0751f[_0x457d('0x17')](0x194)[_0x457d('0x18')](_0x4d988f);}else{if(_0x4d988f[_0x457d('0x19')]){delete _0x4d988f[_0x457d('0x19')];}_0xc0751f[_0x457d('0x17')](0x1f4)[_0x457d('0x18')](_0x4d988f);}};}function checkError(){return function(_0x1cc0ba){if(!_0x1cc0ba){throw new RangeError(_0x457d('0x1a'));}return _0x1cc0ba;};}function respondWithRpcPromise(_0x2087a5,_0x46fe6a){return new BPromise(function(_0x57f229,_0x4bf90d){var _0x4e2dff=amiClient;return _0x4e2dff[_0x457d('0x1b')](_0x2087a5,_0x46fe6a)['then'](function(_0x5177cf){if(_0x5177cf['error']){if(_0x5177cf[_0x457d('0x1c')][_0x457d('0x1d')]===0x1f4){return _0x4bf90d(_0x5177cf['error'][_0x457d('0x1e')]);}return _0x57f229(_0x5177cf[_0x457d('0x1c')][_0x457d('0x1e')]);}else{_0x57f229(_0x5177cf[_0x457d('0x1f')]);}})['catch'](function(_0x5d6554){_0x4bf90d(_0x5d6554);});});}function getAgent(_0x556a8){return db['User'][_0x457d('0x20')]({'where':{'id':_0x556a8,'role':_0x457d('0x21')}})[_0x457d('0x22')](checkError());}function getAgentCheckSession(_0x1bc311,_0x54de66){return new BPromise(function(_0x298dd4,_0x57a47f){var _0x4eb5ca=respondWithRpcPromise(_0x457d('0x23'));var _0x3f696d=getAgent(_0x1bc311);Promise['all']([_0x4eb5ca,_0x3f696d])[_0x457d('0x22')](function(_0x2d69d2){var _0x5b5b31=_0x2d69d2[0x0];var _0xec380b=_0x2d69d2[0x1];var _0x41f012=_[_0x457d('0x24')](_0x5b5b31[_0x457d('0x25')],function(_0x381a9d){return _0x381a9d[_0x457d('0x26')]==_0xec380b['id']&&_0x381a9d[_0x457d('0x27')]==_0x54de66;});if(_0x41f012[_0x457d('0x28')]==0x1){_0x298dd4(_0xec380b);}else{_0x57a47f(new RangeError(_0x457d('0x29')+_0x54de66+_0x457d('0x2a')));}});});}exports[_0x457d('0x2b')]=function(_0x5782ce,_0xf668ff){logger[_0x457d('0x13')](_0x457d('0x2c'),_0x5782ce[_0x457d('0x2d')]);var _0xf8b8dc=originateValidation[_0x457d('0x2e')](_0x5782ce['body']);if(_0xf8b8dc[_0x457d('0x28')]>0x0){return _0xf668ff[_0x457d('0x17')](0x190)['json'](_0xf8b8dc);}var _0x47b7e8=_0x5782ce[_0x457d('0x2d')][_0x457d('0x2f')];var _0x5b4622=_0x5782ce[_0x457d('0x2d')][_0x457d('0x30')];var _0x1acf15=_0x5782ce[_0x457d('0x2d')][_0x457d('0x31')];var _0x36a90b=_0x5782ce[_0x457d('0x2d')][_0x457d('0x32')];return getAgent(_0x47b7e8)[_0x457d('0x22')](function(_0xde9836){logger[_0x457d('0x13')](_0x457d('0x33'),_0xde9836[_0x457d('0x19')]);emit(util[_0x457d('0x34')](_0x457d('0x35'),_0xde9836['name']),_0x457d('0x36'),{'callNumber':_0x5b4622,'callerId':_0x1acf15,'callbackUrl':_0x36a90b});return _0xf668ff['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x457d('0x37')](handleError(_0xf668ff));};exports['hangup']=function(_0x18ed88,_0x55e580){logger['info'](_0x457d('0x38'),_0x18ed88[_0x457d('0x2d')]);var _0x2618f4=hangupValidation[_0x457d('0x2e')](_0x18ed88[_0x457d('0x2d')]);if(_0x2618f4[_0x457d('0x28')]>0x0){return _0x55e580[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x2618f4);}var _0x41a4a3=_0x18ed88[_0x457d('0x2d')][_0x457d('0x2f')];var _0x160755=_0x18ed88[_0x457d('0x2d')][_0x457d('0x27')];return getAgent(_0x41a4a3)[_0x457d('0x22')](function(_0x1bbd9d){logger[_0x457d('0x13')]('entityFound:',_0x1bbd9d[_0x457d('0x19')]);emit(util['format'](_0x457d('0x35'),_0x1bbd9d[_0x457d('0x19')]),_0x457d('0x3a'),{'sessionId':_0x160755});return _0x55e580[_0x457d('0x17')](0xc8)[_0x457d('0x39')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x55e580));};exports[_0x457d('0x3b')]=function(_0x4f7bad,_0x2db2ca){logger[_0x457d('0x13')](_0x457d('0x3c'),_0x4f7bad['body']);var _0x73e45d=answerValidation[_0x457d('0x2e')](_0x4f7bad[_0x457d('0x2d')]);if(_0x73e45d[_0x457d('0x28')]>0x0){return _0x2db2ca[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x73e45d);}var _0x34fdc0=_0x4f7bad[_0x457d('0x2d')][_0x457d('0x2f')];var _0x4a9896=_0x4f7bad['body'][_0x457d('0x27')];return getAgent(_0x34fdc0)[_0x457d('0x22')](function(_0x3bfce4){logger[_0x457d('0x13')](_0x457d('0x33'),_0x3bfce4[_0x457d('0x19')]);emit(util['format'](_0x457d('0x35'),_0x3bfce4[_0x457d('0x19')]),_0x457d('0x3d'),{'sessionId':_0x4a9896});return _0x2db2ca['status'](0xc8)[_0x457d('0x39')]({'error':![],'message':_0x457d('0x3e')});})[_0x457d('0x37')](handleError(_0x2db2ca));};exports['hold']=function(_0x1b8072,_0x57b0a5){logger[_0x457d('0x13')](_0x457d('0x3f'),_0x1b8072['body']);var _0xdc984c=holdValidation[_0x457d('0x2e')](_0x1b8072[_0x457d('0x2d')]);if(_0xdc984c[_0x457d('0x28')]>0x0){return _0x57b0a5[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0xdc984c);}var _0x13787f=_0x1b8072[_0x457d('0x2d')][_0x457d('0x2f')];var _0x15ae26=_0x1b8072['body'][_0x457d('0x27')];return getAgent(_0x13787f)[_0x457d('0x22')](function(_0x7abdf1){logger[_0x457d('0x13')]('entityFound:',_0x7abdf1[_0x457d('0x19')]);emit(util[_0x457d('0x34')](_0x457d('0x35'),_0x7abdf1[_0x457d('0x19')]),_0x457d('0x40'),{'sessionId':_0x15ae26});return _0x57b0a5[_0x457d('0x17')](0xc8)[_0x457d('0x39')]({'error':![],'message':_0x457d('0x41')});})['catch'](handleError(_0x57b0a5));};exports['unhold']=function(_0xec7449,_0x3e31cb){logger[_0x457d('0x13')](_0x457d('0x42'),_0xec7449[_0x457d('0x2d')]);var _0x10610a=unholdValidation[_0x457d('0x2e')](_0xec7449[_0x457d('0x2d')]);if(_0x10610a[_0x457d('0x28')]>0x0){return _0x3e31cb[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x10610a);}var _0x101afc=_0xec7449[_0x457d('0x2d')][_0x457d('0x2f')];var _0x4fe2f3=_0xec7449[_0x457d('0x2d')][_0x457d('0x27')];return getAgent(_0x101afc)[_0x457d('0x22')](function(_0x379a09){logger['info'](_0x457d('0x33'),_0x379a09[_0x457d('0x19')]);emit(util['format'](_0x457d('0x35'),_0x379a09[_0x457d('0x19')]),_0x457d('0x43'),{'sessionId':_0x4fe2f3});return _0x3e31cb['status'](0xc8)['json']({'error':![],'message':_0x457d('0x44')});})['catch'](handleError(_0x3e31cb));};exports[_0x457d('0x45')]=function(_0x3daf2c,_0xbed708){logger[_0x457d('0x13')](_0x457d('0x46'),_0xbed708[_0x457d('0x2d')]);var _0x2485bd=callsValidation[_0x457d('0x2e')](_0x3daf2c[_0x457d('0x2d')]);if(_0x2485bd[_0x457d('0x28')]>0x0){return _0xbed708[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x2485bd);}var _0x1d661e=_0x3daf2c[_0x457d('0x2d')]['userId'];var _0x2969b4=respondWithRpcPromise(_0x457d('0x23'));var _0x4e865a=getAgent(_0x1d661e);return Promise[_0x457d('0x47')]([_0x2969b4,_0x4e865a])['then'](function(_0x125f6f){var _0x1bec33=_0x125f6f[0x0];var _0x57a690=_0x125f6f[0x1];var _0x5ca847=_[_0x457d('0x24')](_0x1bec33[_0x457d('0x25')],function(_0x56de45){return _0x56de45['UserId']==_0x57a690['id'];});return _0xbed708[_0x457d('0x17')](0xc8)['json']({'count':_0x5ca847[_0x457d('0x28')],'rows':_0x5ca847});})['catch'](handleError(_0xbed708));};exports[_0x457d('0x48')]=function(_0x4786c4,_0x5a6d2d){logger[_0x457d('0x13')]('conference\x20fired:',_0x4786c4['body']);var _0x55ab65=conferenceValidation[_0x457d('0x2e')](_0x4786c4[_0x457d('0x2d')]);if(_0x55ab65['length']>0x0){return _0x5a6d2d[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x55ab65);}var _0x43dc83=_0x4786c4[_0x457d('0x2d')][_0x457d('0x2f')];return getAgent(_0x43dc83)[_0x457d('0x22')](function(_0x3c9a87){logger[_0x457d('0x13')](_0x457d('0x33'),_0x3c9a87['name']);emit(util['format'](_0x457d('0x35'),_0x3c9a87[_0x457d('0x19')]),_0x457d('0x49'));return _0x5a6d2d[_0x457d('0x17')](0xc8)[_0x457d('0x39')]({'error':![],'message':_0x457d('0x4a')});})[_0x457d('0x37')](handleError(_0x5a6d2d));};exports[_0x457d('0x4b')]=function(_0x1931e3,_0x270086){logger['info']('transfer\x20fired:',_0x1931e3[_0x457d('0x2d')]);var _0x4dc307=transferValidation[_0x457d('0x2e')](_0x1931e3['body']);if(_0x4dc307[_0x457d('0x28')]>0x0){return _0x270086[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x4dc307);}var _0x54a1e4=_0x1931e3['body'][_0x457d('0x2f')];var _0x155a2a=_0x1931e3['body']['sessionId'];var _0x1fd860=_0x1931e3[_0x457d('0x2d')]['transferNumber'];return getAgent(_0x54a1e4)[_0x457d('0x22')](function(_0x270cd5){logger[_0x457d('0x13')](_0x457d('0x33'),_0x270cd5['name']);emit(util[_0x457d('0x34')](_0x457d('0x35'),_0x270cd5[_0x457d('0x19')]),_0x457d('0x4c'),{'sessionId':_0x155a2a,'transferNumber':_0x1fd860});return _0x270086[_0x457d('0x17')](0xc8)['json']({'error':![],'message':_0x457d('0x4d')});})[_0x457d('0x37')](handleError(_0x270086));}; \ No newline at end of file +var _0x180f=['webbar:unhold','unhold\x20executed!','calls\x20fired:','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','hangup','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:'];(function(_0xeaad17,_0xf6d4e8){var _0x2e4f6b=function(_0x52d30d){while(--_0x52d30d){_0xeaad17['push'](_0xeaad17['shift']());}};_0x2e4f6b(++_0xf6d4e8);}(_0x180f,0xf3));var _0xf180=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x180f[_0x258fb0];return _0x4d1afe;};'use strict';var path=require(_0xf180('0x0'));var fs=require('fs');var _=require(_0xf180('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xf180('0x2'));var util=require(_0xf180('0x3'));var BPromise=require('bluebird');var jayson=require(_0xf180('0x4'));var amiClient=jayson[_0xf180('0x5')][_0xf180('0x6')]({'port':0x232a});var logger=require(_0xf180('0x7'))(_0xf180('0x8'));var Redis=require('ioredis');config[_0xf180('0x9')]=_[_0xf180('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf180('0xb'))(new Redis(config[_0xf180('0x9')]));var Schema=require(_0xf180('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]},'callNumber':{'type':_0xf180('0xf'),'required':[!![],_0xf180('0x10')]},'callerId':{'type':_0xf180('0xf')},'callbackUrl':{'type':_0xf180('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf180('0xe')]},'sessionId':{'type':_0xf180('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]},'sessionId':{'type':_0xf180('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]},'sessionId':{'type':_0xf180('0xf'),'required':[!![],_0xf180('0x11')]},'transferNumber':{'type':_0xf180('0xf'),'required':[!![],_0xf180('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf180('0xe')]},'sessionId':{'type':_0xf180('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],_0xf180('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf180('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x105c6a,_0x726be6,_0x496e65){logger[_0xf180('0x13')](_0x105c6a,_0x726be6,JSON[_0xf180('0x14')](_0x496e65));io['to'](_0x105c6a)['emit'](_0x726be6,_0x496e65);}function handleError(_0x4aa215){return function(_0x14ddc6){console[_0xf180('0x15')](_0xf180('0x16'),_0x14ddc6,_0x14ddc6 instanceof RangeError);logger[_0xf180('0x17')](_0x14ddc6[_0xf180('0x18')]);if(_0x14ddc6 instanceof RangeError){if(_0x14ddc6[_0xf180('0x19')]){delete _0x14ddc6[_0xf180('0x19')];}_0x4aa215[_0xf180('0x1a')](0x194)[_0xf180('0x1b')](_0x14ddc6);}else{if(_0x14ddc6[_0xf180('0x19')]){delete _0x14ddc6[_0xf180('0x19')];}_0x4aa215[_0xf180('0x1a')](0x1f4)['send'](_0x14ddc6);}};}function checkError(){return function(_0x3054d7){if(!_0x3054d7){throw new RangeError(_0xf180('0x1c'));}return _0x3054d7;};}function respondWithRpcPromise(_0x50f3b0,_0x466d1d){return new BPromise(function(_0x538bac,_0x36aeee){var _0x4c54b6=amiClient;return _0x4c54b6[_0xf180('0x1d')](_0x50f3b0,_0x466d1d)[_0xf180('0x1e')](function(_0x5d5ead){if(_0x5d5ead['error']){if(_0x5d5ead[_0xf180('0x17')][_0xf180('0x1f')]===0x1f4){return _0x36aeee(_0x5d5ead['error'][_0xf180('0x20')]);}return _0x538bac(_0x5d5ead[_0xf180('0x17')][_0xf180('0x20')]);}else{_0x538bac(_0x5d5ead[_0xf180('0x21')]);}})[_0xf180('0x22')](function(_0x2ca8f9){_0x36aeee(_0x2ca8f9);});});}function getAgent(_0x21498f){return db[_0xf180('0x23')][_0xf180('0x24')]({'where':{'id':_0x21498f,'role':_0xf180('0x25')}})['then'](checkError());}function getAgentCheckSession(_0x3cda7b,_0x158d1a){return new BPromise(function(_0x151b90,_0x113478){var _0x37379c=respondWithRpcPromise(_0xf180('0x26'));var _0xe1db31=getAgent(_0x3cda7b);Promise[_0xf180('0x27')]([_0x37379c,_0xe1db31])[_0xf180('0x1e')](function(_0x3bb197){var _0x564ce1=_0x3bb197[0x0];var _0x323482=_0x3bb197[0x1];var _0xe9a66b=_[_0xf180('0x28')](_0x564ce1[_0xf180('0x29')],function(_0x466895){return _0x466895[_0xf180('0x2a')]==_0x323482['id']&&_0x466895[_0xf180('0x2b')]==_0x158d1a;});if(_0xe9a66b[_0xf180('0x2c')]==0x1){_0x151b90(_0x323482);}else{_0x113478(new RangeError(_0xf180('0x2d')+_0x158d1a+_0xf180('0x2e')));}});});}exports[_0xf180('0x2f')]=function(_0x2702b1,_0x247068){logger[_0xf180('0x13')]('originate\x20fired:',_0x2702b1[_0xf180('0x30')]);var _0x37e211=originateValidation['validate'](_0x2702b1[_0xf180('0x30')]);if(_0x37e211['length']>0x0){return _0x247068[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x37e211);}var _0x303a39=_0x2702b1['body'][_0xf180('0x32')];var _0x2c5d05=_0x2702b1[_0xf180('0x30')][_0xf180('0x33')];var _0x52b1c3=_0x2702b1[_0xf180('0x30')][_0xf180('0x34')];var _0x438d2c=_0x2702b1[_0xf180('0x30')][_0xf180('0x35')];return getAgent(_0x303a39)[_0xf180('0x1e')](function(_0x3ec832){logger[_0xf180('0x13')](_0xf180('0x36'),_0x3ec832[_0xf180('0x19')]);emit(util['format'](_0xf180('0x37'),_0x3ec832['name']),'webbar:originate',{'callNumber':_0x2c5d05,'callerId':_0x52b1c3,'callbackUrl':_0x438d2c});return _0x247068[_0xf180('0x1a')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0xf180('0x22')](handleError(_0x247068));};exports[_0xf180('0x38')]=function(_0x9d65e0,_0x46b53c){logger['info']('hangup\x20fired:',_0x9d65e0[_0xf180('0x30')]);var _0x57dead=hangupValidation[_0xf180('0xc')](_0x9d65e0['body']);if(_0x57dead[_0xf180('0x2c')]>0x0){return _0x46b53c[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x57dead);}var _0x1d0978=_0x9d65e0[_0xf180('0x30')][_0xf180('0x32')];var _0xf43653=_0x9d65e0[_0xf180('0x30')][_0xf180('0x2b')];return getAgent(_0x1d0978)['then'](function(_0x389de4){logger[_0xf180('0x13')]('entityFound:',_0x389de4[_0xf180('0x19')]);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x389de4[_0xf180('0x19')]),'webbar:hangup',{'sessionId':_0xf43653});return _0x46b53c[_0xf180('0x1a')](0xc8)['json']({'error':![],'message':_0xf180('0x3a')});})[_0xf180('0x22')](handleError(_0x46b53c));};exports[_0xf180('0x3b')]=function(_0x21ac7,_0x5e0701){logger['info'](_0xf180('0x3c'),_0x21ac7[_0xf180('0x30')]);var _0xafbff7=answerValidation[_0xf180('0xc')](_0x21ac7[_0xf180('0x30')]);if(_0xafbff7[_0xf180('0x2c')]>0x0){return _0x5e0701[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0xafbff7);}var _0x321668=_0x21ac7[_0xf180('0x30')]['userId'];var _0x1c4821=_0x21ac7['body'][_0xf180('0x2b')];return getAgent(_0x321668)[_0xf180('0x1e')](function(_0x2cc5ad){logger['info'](_0xf180('0x36'),_0x2cc5ad[_0xf180('0x19')]);emit(util['format'](_0xf180('0x37'),_0x2cc5ad[_0xf180('0x19')]),_0xf180('0x3d'),{'sessionId':_0x1c4821});return _0x5e0701[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'error':![],'message':_0xf180('0x3e')});})[_0xf180('0x22')](handleError(_0x5e0701));};exports[_0xf180('0x3f')]=function(_0x17e0a0,_0x2c505c){logger[_0xf180('0x13')](_0xf180('0x40'),_0x17e0a0[_0xf180('0x30')]);var _0x1bd35d=holdValidation[_0xf180('0xc')](_0x17e0a0[_0xf180('0x30')]);if(_0x1bd35d[_0xf180('0x2c')]>0x0){return _0x2c505c[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x1bd35d);}var _0x43c26c=_0x17e0a0['body']['userId'];var _0x2c692e=_0x17e0a0[_0xf180('0x30')][_0xf180('0x2b')];return getAgent(_0x43c26c)[_0xf180('0x1e')](function(_0x1915b4){logger[_0xf180('0x13')](_0xf180('0x36'),_0x1915b4[_0xf180('0x19')]);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x1915b4[_0xf180('0x19')]),_0xf180('0x41'),{'sessionId':_0x2c692e});return _0x2c505c[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'error':![],'message':_0xf180('0x42')});})['catch'](handleError(_0x2c505c));};exports[_0xf180('0x43')]=function(_0x12fabe,_0x4b0dcd){logger[_0xf180('0x13')](_0xf180('0x44'),_0x12fabe[_0xf180('0x30')]);var _0x3603ca=unholdValidation[_0xf180('0xc')](_0x12fabe[_0xf180('0x30')]);if(_0x3603ca[_0xf180('0x2c')]>0x0){return _0x4b0dcd[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x3603ca);}var _0x34579a=_0x12fabe[_0xf180('0x30')][_0xf180('0x32')];var _0x581626=_0x12fabe[_0xf180('0x30')]['sessionId'];return getAgent(_0x34579a)[_0xf180('0x1e')](function(_0x5eb6af){logger['info']('entityFound:',_0x5eb6af['name']);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x5eb6af['name']),_0xf180('0x45'),{'sessionId':_0x581626});return _0x4b0dcd[_0xf180('0x1a')](0xc8)['json']({'error':![],'message':_0xf180('0x46')});})['catch'](handleError(_0x4b0dcd));};exports['calls']=function(_0x59500f,_0x40ebbc){logger[_0xf180('0x13')](_0xf180('0x47'),_0x40ebbc['body']);var _0x2dcc9e=callsValidation[_0xf180('0xc')](_0x59500f[_0xf180('0x30')]);if(_0x2dcc9e[_0xf180('0x2c')]>0x0){return _0x40ebbc[_0xf180('0x1a')](0x190)['json'](_0x2dcc9e);}var _0x1a6cf2=_0x59500f[_0xf180('0x30')]['userId'];var _0x2f4899=respondWithRpcPromise(_0xf180('0x26'));var _0x2d3ce7=getAgent(_0x1a6cf2);return Promise[_0xf180('0x27')]([_0x2f4899,_0x2d3ce7])[_0xf180('0x1e')](function(_0x516365){var _0x3d815b=_0x516365[0x0];var _0x3edc18=_0x516365[0x1];var _0x430f57=_[_0xf180('0x28')](_0x3d815b['rows'],function(_0xeefb20){return _0xeefb20[_0xf180('0x2a')]==_0x3edc18['id'];});return _0x40ebbc[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'count':_0x430f57[_0xf180('0x2c')],'rows':_0x430f57});})['catch'](handleError(_0x40ebbc));};exports[_0xf180('0x48')]=function(_0x5dbc6c,_0x2c8c50){logger[_0xf180('0x13')]('conference\x20fired:',_0x5dbc6c['body']);var _0x527066=conferenceValidation[_0xf180('0xc')](_0x5dbc6c[_0xf180('0x30')]);if(_0x527066[_0xf180('0x2c')]>0x0){return _0x2c8c50[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x527066);}var _0x5b6f3d=_0x5dbc6c['body'][_0xf180('0x32')];return getAgent(_0x5b6f3d)['then'](function(_0x348984){logger[_0xf180('0x13')](_0xf180('0x36'),_0x348984[_0xf180('0x19')]);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x348984[_0xf180('0x19')]),'webbar:conference');return _0x2c8c50[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'error':![],'message':_0xf180('0x49')});})['catch'](handleError(_0x2c8c50));};exports[_0xf180('0x4a')]=function(_0x365821,_0x216854){logger['info'](_0xf180('0x4b'),_0x365821[_0xf180('0x30')]);var _0x41fde4=transferValidation[_0xf180('0xc')](_0x365821[_0xf180('0x30')]);if(_0x41fde4['length']>0x0){return _0x216854[_0xf180('0x1a')](0x190)[_0xf180('0x31')](_0x41fde4);}var _0x2ff5d1=_0x365821['body'][_0xf180('0x32')];var _0x66ac3a=_0x365821['body'][_0xf180('0x2b')];var _0x4bd8b6=_0x365821[_0xf180('0x30')][_0xf180('0x4c')];return getAgent(_0x2ff5d1)['then'](function(_0x35edb1){logger[_0xf180('0x13')](_0xf180('0x36'),_0x35edb1[_0xf180('0x19')]);emit(util[_0xf180('0x39')](_0xf180('0x37'),_0x35edb1['name']),'webbar:transfer',{'sessionId':_0x66ac3a,'transferNumber':_0x4bd8b6});return _0x216854[_0xf180('0x1a')](0xc8)[_0xf180('0x31')]({'error':![],'message':_0xf180('0x4d')});})[_0xf180('0x22')](handleError(_0x216854));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 0ded3d0..5a4cfa9 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb7a=['./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x25389e,_0x14ade5){var _0x2e53fe=function(_0x563e9a){while(--_0x563e9a){_0x25389e['push'](_0x25389e['shift']());}};_0x2e53fe(++_0x14ade5);}(_0xfb7a,0x6f));var _0xafb7=function(_0x1e8bea,_0x47bde9){_0x1e8bea=_0x1e8bea-0x0;var _0x29f756=_0xfb7a[_0x1e8bea];return _0x29f756;};'use strict';var multer=require('multer');var util=require(_0xafb7('0x0'));var path=require(_0xafb7('0x1'));var timeout=require(_0xafb7('0x2'));var express=require(_0xafb7('0x3'));var router=express[_0xafb7('0x4')]();var fs_extra=require(_0xafb7('0x5'));var auth=require(_0xafb7('0x6'));var interaction=require(_0xafb7('0x7'));var config=require(_0xafb7('0x8'));var controller=require(_0xafb7('0x9'));router[_0xafb7('0xa')]('/',auth[_0xafb7('0xb')](),controller[_0xafb7('0xc')]);router[_0xafb7('0xa')](_0xafb7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xafb7('0xa')](_0xafb7('0xe'),auth[_0xafb7('0xb')](),controller['show']);router['get']('/:id/dispositions',auth[_0xafb7('0xb')](),controller[_0xafb7('0xf')]);router[_0xafb7('0xa')](_0xafb7('0x10'),auth[_0xafb7('0xb')](),controller[_0xafb7('0x11')]);router[_0xafb7('0xa')](_0xafb7('0x12'),auth[_0xafb7('0xb')](),controller['getAgents']);router[_0xafb7('0xa')](_0xafb7('0x13'),auth[_0xafb7('0xb')](),controller[_0xafb7('0x14')]);router[_0xafb7('0x15')]('/',auth[_0xafb7('0xb')](),controller[_0xafb7('0x16')]);router['post'](_0xafb7('0x17'),auth['isAuthenticated'](),controller[_0xafb7('0x18')]);router[_0xafb7('0x15')](_0xafb7('0x10'),auth[_0xafb7('0xb')](),controller[_0xafb7('0x19')]);router[_0xafb7('0x15')](_0xafb7('0x12'),auth[_0xafb7('0xb')](),controller[_0xafb7('0x1a')]);router[_0xafb7('0x15')](_0xafb7('0x13'),auth['isAuthenticated'](),controller[_0xafb7('0x1b')]);router[_0xafb7('0x15')](_0xafb7('0x1c'),controller[_0xafb7('0x1d')]);router[_0xafb7('0x15')](_0xafb7('0x1e'),auth[_0xafb7('0xb')](),controller[_0xafb7('0x1f')]);router[_0xafb7('0x20')]('/:id',auth[_0xafb7('0xb')](),controller[_0xafb7('0x21')]);router['delete'](_0xafb7('0xe'),auth['isAuthenticated'](),controller[_0xafb7('0x22')]);router[_0xafb7('0x23')]('/:id/dispositions',auth[_0xafb7('0xb')](),controller[_0xafb7('0x24')]);router[_0xafb7('0x23')](_0xafb7('0x10'),auth['isAuthenticated'](),controller[_0xafb7('0x25')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xafb7('0x26')]);module[_0xafb7('0x27')]=router; \ No newline at end of file +var _0x4979=['/:id/users','getAgents','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x48fab8,_0x24fc35){var _0x427532=function(_0x55acb6){while(--_0x55acb6){_0x48fab8['push'](_0x48fab8['shift']());}};_0x427532(++_0x24fc35);}(_0x4979,0xe4));var _0x9497=function(_0xe5d54f,_0x143d93){_0xe5d54f=_0xe5d54f-0x0;var _0x2a74bf=_0x4979[_0xe5d54f];return _0x2a74bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9497('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9497('0x1')]();var fs_extra=require(_0x9497('0x2'));var auth=require(_0x9497('0x3'));var interaction=require(_0x9497('0x4'));var config=require('../../config/environment');var controller=require(_0x9497('0x5'));router[_0x9497('0x6')]('/',auth[_0x9497('0x7')](),controller[_0x9497('0x8')]);router[_0x9497('0x6')](_0x9497('0x9'),auth['isAuthenticated'](),controller[_0x9497('0xa')]);router['get'](_0x9497('0xb'),auth[_0x9497('0x7')](),controller[_0x9497('0xc')]);router['get'](_0x9497('0xd'),auth['isAuthenticated'](),controller[_0x9497('0xe')]);router['get'](_0x9497('0xf'),auth[_0x9497('0x7')](),controller[_0x9497('0x10')]);router[_0x9497('0x6')](_0x9497('0x11'),auth[_0x9497('0x7')](),controller[_0x9497('0x12')]);router[_0x9497('0x6')]('/:id/applications',auth[_0x9497('0x7')](),controller[_0x9497('0x13')]);router[_0x9497('0x14')]('/',auth[_0x9497('0x7')](),controller[_0x9497('0x15')]);router['post'](_0x9497('0xd'),auth[_0x9497('0x7')](),controller['addDisposition']);router[_0x9497('0x14')]('/:id/canned_answers',auth[_0x9497('0x7')](),controller[_0x9497('0x16')]);router['post'](_0x9497('0x11'),auth['isAuthenticated'](),controller[_0x9497('0x17')]);router[_0x9497('0x14')]('/:id/applications',auth['isAuthenticated'](),controller[_0x9497('0x18')]);router[_0x9497('0x14')](_0x9497('0x19'),controller[_0x9497('0x1a')]);router['post'](_0x9497('0x1b'),auth[_0x9497('0x7')](),controller[_0x9497('0x1c')]);router[_0x9497('0x1d')](_0x9497('0xb'),auth[_0x9497('0x7')](),controller[_0x9497('0x1e')]);router[_0x9497('0x1f')](_0x9497('0xb'),auth[_0x9497('0x7')](),controller[_0x9497('0x20')]);router[_0x9497('0x1f')](_0x9497('0xd'),auth[_0x9497('0x7')](),controller['removeDispositions']);router[_0x9497('0x1f')](_0x9497('0xf'),auth[_0x9497('0x7')](),controller[_0x9497('0x21')]);router[_0x9497('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x9497('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 557fd34..6fff9aa 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd658=['STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition','randomstring','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd658,0xe8));var _0x8d65=function(_0x1f6b14,_0xf03341){_0x1f6b14=_0x1f6b14-0x0;var _0xa80278=_0xd658[_0x1f6b14];return _0xa80278;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8d65('0x0'));module[_0x8d65('0x1')]={'name':{'type':Sequelize[_0x8d65('0x2')],'unique':_0x8d65('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x8d65('0x2')],'defaultValue':function(){return rs[_0x8d65('0x4')]();}},'phone':{'type':Sequelize[_0x8d65('0x2')]},'type':{'type':Sequelize[_0x8d65('0x5')]('twilio',_0x8d65('0x6'))},'accountSid':{'type':Sequelize[_0x8d65('0x2')]},'baseUrl':{'type':Sequelize[_0x8d65('0x2')]},'authToken':{'type':Sequelize[_0x8d65('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8d65('0x7')],'defaultValue':function(){return _0x8d65('0x8');}},'notificationSound':{'type':Sequelize[_0x8d65('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8d65('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8d65('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8d65('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8d65('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8d65('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8d65('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8d65('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1446ff){if(!_0x1446ff){this[_0x8d65('0xb')]('mandatoryDispositionPauseId',null);}this[_0x8d65('0xb')](_0x8d65('0xc'),_0x1446ff);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x86db=['name','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING'];(function(_0x493cf9,_0x251175){var _0xd279da=function(_0x354e88){while(--_0x354e88){_0x493cf9['push'](_0x493cf9['shift']());}};_0xd279da(++_0x251175);}(_0x86db,0xf4));var _0xb86d=function(_0x626f86,_0x7619b5){_0x626f86=_0x626f86-0x0;var _0x418916=_0x86db[_0x626f86];return _0x418916;};'use strict';var Sequelize=require(_0xb86d('0x0'));var rs=require(_0xb86d('0x1'));module['exports']={'name':{'type':Sequelize[_0xb86d('0x2')],'unique':_0xb86d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb86d('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb86d('0x4')]();}},'phone':{'type':Sequelize[_0xb86d('0x2')]},'type':{'type':Sequelize[_0xb86d('0x5')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xb86d('0x2')]},'baseUrl':{'type':Sequelize[_0xb86d('0x2')]},'authToken':{'type':Sequelize[_0xb86d('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb86d('0x6')],'defaultValue':function(){return _0xb86d('0x7');}},'notificationSound':{'type':Sequelize[_0xb86d('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb86d('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb86d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb86d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb86d('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb86d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb86d('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb86d('0x8')],'defaultValue':![],'comment':_0xb86d('0xa'),'set':function(_0x19788f){if(!_0x19788f){this[_0xb86d('0xb')](_0xb86d('0xc'),null);}this[_0xb86d('0xb')]('mandatoryDisposition',_0x19788f);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d963363..16d2405 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4325=['nolimit','addAnswer','WhatsappAccountId','CannedAnswer','findOne','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','Body','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','list','WhatsappInteraction','spread','interaction','created','applications','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','text/xml','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','undefined','offset','limit','set','Content-Range','reject','save','destroy','WhatsappAccounts','UserProfileResource','end','stack','name','send','map','WhatsappAccount','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','length','hasOwnProperty','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','mandatoryDispositionPause','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','Pause','describe','addDisposition','Disposition','getDispositions','fields'];(function(_0x27ade7,_0x55b71d){var _0x25630a=function(_0x2d1312){while(--_0x2d1312){_0x27ade7['push'](_0x27ade7['shift']());}};_0x25630a(++_0x55b71d);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];config['redis']=_[_0x5432('0x17')](config[_0x5432('0x18')],{'host':_0x5432('0x19'),'port':0x18eb});var socket=require(_0x5432('0x1a'))(new Redis(config[_0x5432('0x18')]));require(_0x5432('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5432('0x1c')][_0x5432('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3859d1,_0x364152,_0x9d2023,_0x11db3c){return new BPromise(function(_0x5e18e8,_0x2cf409){var _0x49e8fd=_0x11db3c||client;return _0x49e8fd[_0x5432('0x1e')](_0x3859d1,_0x9d2023)[_0x5432('0x1f')](function(_0x333152){logger[_0x5432('0x20')](_0x5432('0x21'),_0x364152,'request\x20sent');logger[_0x5432('0x22')](_0x5432('0x23'),_0x364152,_0x5432('0x24'),JSON[_0x5432('0x25')](_0x333152));if(_0x333152[_0x5432('0x26')]){if(_0x333152[_0x5432('0x26')][_0x5432('0x27')]===0x1f4){logger['error'](_0x5432('0x21'),_0x364152,_0x333152[_0x5432('0x26')][_0x5432('0x28')]);return _0x2cf409(_0x333152[_0x5432('0x26')][_0x5432('0x28')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x364152,_0x333152['error'][_0x5432('0x28')]);return _0x5e18e8(_0x333152[_0x5432('0x26')][_0x5432('0x28')]);}else{logger[_0x5432('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x364152,'request\x20sent');_0x5e18e8(_0x333152[_0x5432('0x29')][_0x5432('0x28')]);}})['catch'](function(_0x19e6b2){logger[_0x5432('0x26')](_0x5432('0x21'),_0x364152,_0x19e6b2);_0x2cf409(_0x19e6b2);});});}function respondWithStatusCode(_0x4b6ea5,_0xd9928a){_0xd9928a=_0xd9928a||0xcc;return function(_0xccefeb){if(_0xccefeb){return _0x4b6ea5[_0x5432('0x2a')](_0xd9928a);}return _0x4b6ea5['status'](_0xd9928a)['end']();};}function respondWithResult(_0x1f2055,_0x2114b8){_0x2114b8=_0x2114b8||0xc8;return function(_0x589f79){if(_0x589f79){return _0x1f2055[_0x5432('0x2b')](_0x2114b8)[_0x5432('0x2c')](_0x589f79);}};}function respondWithFilteredResult(_0x1f2e8f,_0x4add5b){return function(_0x29dc15){if(_0x29dc15){var _0x5be867=typeof _0x4add5b['offset']===_0x5432('0x2d')&&typeof _0x4add5b['limit']===_0x5432('0x2d');var _0x578281=_0x29dc15['count'];var _0x465a09=_0x5be867?0x0:_0x4add5b[_0x5432('0x2e')];var _0x345b51=_0x5be867?_0x29dc15['count']:_0x4add5b[_0x5432('0x2e')]+_0x4add5b[_0x5432('0x2f')];var _0x214ed3;if(_0x345b51>=_0x578281){_0x345b51=_0x578281;_0x214ed3=0xc8;}else{_0x214ed3=0xce;}_0x1f2e8f[_0x5432('0x2b')](_0x214ed3);return _0x1f2e8f[_0x5432('0x30')](_0x5432('0x31'),_0x465a09+'-'+_0x345b51+'/'+_0x578281)[_0x5432('0x2c')](_0x29dc15);}return null;};}function patchUpdates(_0x444178){return function(_0x34a152){try{jsonpatch['apply'](_0x34a152,_0x444178,!![]);}catch(_0x57fd0b){return BPromise[_0x5432('0x32')](_0x57fd0b);}return _0x34a152[_0x5432('0x33')]();};}function saveUpdates(_0x2ebffa,_0x3cf8af){return function(_0x119712){if(_0x119712){return _0x119712['update'](_0x2ebffa)[_0x5432('0x1f')](function(_0x5649b6){return _0x5649b6;});}return null;};}function removeEntity(_0x2955e0,_0x1e1597){return function(_0x56f560){if(_0x56f560){return _0x56f560[_0x5432('0x34')]()[_0x5432('0x1f')](function(){var _0x112c83=_0x56f560['get']({'plain':!![]});var _0x45b152=_0x5432('0x35');return db[_0x5432('0x36')][_0x5432('0x34')]({'where':{'type':_0x45b152,'resourceId':_0x112c83['id']}})['then'](function(){return _0x56f560;});})[_0x5432('0x1f')](function(){_0x2955e0[_0x5432('0x2b')](0xcc)[_0x5432('0x37')]();});}};}function handleEntityNotFound(_0x2be93f,_0x3fb586){return function(_0x1b9ed8){if(!_0x1b9ed8){_0x2be93f[_0x5432('0x2a')](0x194);}return _0x1b9ed8;};}function handleError(_0x92b0b3,_0x228c59){_0x228c59=_0x228c59||0x1f4;return function(_0x571bbe){logger[_0x5432('0x26')](_0x571bbe[_0x5432('0x38')]);if(_0x571bbe[_0x5432('0x39')]){delete _0x571bbe[_0x5432('0x39')];}_0x92b0b3['status'](_0x228c59)[_0x5432('0x3a')](_0x571bbe);};}exports['index']=function(_0x6f5006,_0x397ef5){var _0x2b8c7f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1a5561={},_0x4dc00e={'count':0x0,'rows':[]};var _0x2b87b2=_[_0x5432('0x3b')](db[_0x5432('0x3c')][_0x5432('0x3d')],function(_0x52b296){return{'name':_0x52b296[_0x5432('0x3e')],'type':_0x52b296[_0x5432('0x3f')][_0x5432('0x40')]};});_0x1a5561['model']=_[_0x5432('0x3b')](_0x2b87b2,_0x5432('0x39'));_0x1a5561['query']=_[_0x5432('0x41')](_0x6f5006[_0x5432('0x42')]);_0x1a5561['filters']=_[_0x5432('0x43')](_0x1a5561['model'],_0x1a5561[_0x5432('0x42')]);_0x2b8c7f[_0x5432('0x44')]=_[_0x5432('0x43')](_0x1a5561[_0x5432('0x45')],qs['fields'](_0x6f5006[_0x5432('0x42')]['fields']));_0x2b8c7f[_0x5432('0x44')]=_0x2b8c7f[_0x5432('0x44')][_0x5432('0x46')]?_0x2b8c7f[_0x5432('0x44')]:_0x1a5561[_0x5432('0x45')];if(!_0x6f5006[_0x5432('0x42')][_0x5432('0x47')]('nolimit')){_0x2b8c7f[_0x5432('0x2f')]=qs[_0x5432('0x2f')](_0x6f5006[_0x5432('0x42')][_0x5432('0x2f')]);_0x2b8c7f[_0x5432('0x2e')]=qs[_0x5432('0x2e')](_0x6f5006[_0x5432('0x42')]['offset']);}_0x2b8c7f[_0x5432('0x48')]=qs[_0x5432('0x49')](_0x6f5006[_0x5432('0x42')][_0x5432('0x49')]);_0x2b8c7f[_0x5432('0x4a')]=qs['filters'](_[_0x5432('0x4b')](_0x6f5006['query'],_0x1a5561[_0x5432('0x4c')]),_0x2b87b2);if(_0x6f5006[_0x5432('0x42')]['filter']){_0x2b8c7f[_0x5432('0x4a')]=_['merge'](_0x2b8c7f[_0x5432('0x4a')],{'$or':_[_0x5432('0x3b')](_0x2b87b2,function(_0x512d84){if(_0x512d84['type']!==_0x5432('0x4d')){var _0xa971bd={};_0xa971bd[_0x512d84[_0x5432('0x39')]]={'$like':'%'+_0x6f5006[_0x5432('0x42')][_0x5432('0x4e')]+'%'};return _0xa971bd;}})});}_0x2b8c7f=_[_0x5432('0x4f')]({},_0x2b8c7f,_0x6f5006[_0x5432('0x50')]);var _0x4e3f9b={'where':_0x2b8c7f[_0x5432('0x4a')]};return db[_0x5432('0x3c')][_0x5432('0x51')](_0x4e3f9b)['then'](function(_0x5ca992){_0x4dc00e['count']=_0x5ca992;if(_0x6f5006['query'][_0x5432('0x52')]){_0x2b8c7f[_0x5432('0x53')]=[{'all':!![]}];}return db[_0x5432('0x3c')][_0x5432('0x54')](_0x2b8c7f);})[_0x5432('0x1f')](function(_0x4bc716){_0x4dc00e[_0x5432('0x55')]=_0x4bc716;return _0x4dc00e;})[_0x5432('0x1f')](respondWithFilteredResult(_0x397ef5,_0x2b8c7f))[_0x5432('0x56')](handleError(_0x397ef5,null));};exports['show']=function(_0x30d2ef,_0x9e921){var _0x2c2bce={'raw':![],'where':{'id':_0x30d2ef[_0x5432('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x5432('0x58')}]},_0x249f15={};_0x249f15['model']=_[_0x5432('0x41')](db['WhatsappAccount'][_0x5432('0x3d')]);_0x249f15[_0x5432('0x42')]=_['keys'](_0x30d2ef[_0x5432('0x42')]);_0x249f15['filters']=_[_0x5432('0x43')](_0x249f15[_0x5432('0x45')],_0x249f15[_0x5432('0x42')]);_0x2c2bce[_0x5432('0x44')]=_['intersection'](_0x249f15[_0x5432('0x45')],qs['fields'](_0x30d2ef[_0x5432('0x42')]['fields']));_0x2c2bce[_0x5432('0x44')]=_0x2c2bce[_0x5432('0x44')][_0x5432('0x46')]?_0x2c2bce[_0x5432('0x44')]:_0x249f15[_0x5432('0x45')];if(_0x30d2ef[_0x5432('0x42')][_0x5432('0x52')]){_0x2c2bce[_0x5432('0x53')]=[{'all':!![]}];}_0x2c2bce=_[_0x5432('0x4f')]({},_0x2c2bce,_0x30d2ef[_0x5432('0x50')]);return db['WhatsappAccount'][_0x5432('0x59')](_0x2c2bce)[_0x5432('0x1f')](handleEntityNotFound(_0x9e921,null))['then'](respondWithResult(_0x9e921,null))[_0x5432('0x56')](handleError(_0x9e921,null));};exports[_0x5432('0x5a')]=function(_0x38c435,_0x13fd25){return db[_0x5432('0x3c')]['create'](_0x38c435['body'],{})['then'](function(_0x567f91){var _0x3687b7=_0x38c435[_0x5432('0x5b')][_0x5432('0x5c')]({'plain':!![]});if(!_0x3687b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3687b7[_0x5432('0x5d')]===_0x5432('0x5b')){var _0x304f4f=_0x567f91[_0x5432('0x5c')]({'plain':!![]});var _0x3d3d2c=_0x5432('0x35');return db[_0x5432('0x5e')][_0x5432('0x59')]({'where':{'name':_0x3d3d2c,'userProfileId':_0x3687b7[_0x5432('0x5f')]},'raw':!![]})[_0x5432('0x1f')](function(_0x9c1ad9){if(_0x9c1ad9&&_0x9c1ad9['autoAssociation']===0x0){return db[_0x5432('0x36')][_0x5432('0x5a')]({'name':_0x304f4f[_0x5432('0x39')],'resourceId':_0x304f4f['id'],'type':_0x9c1ad9[_0x5432('0x39')],'sectionId':_0x9c1ad9['id']},{})[_0x5432('0x1f')](function(){return _0x567f91;});}else{return _0x567f91;}})['catch'](function(_0x24d570){logger['error'](_0x5432('0x60'),_0x24d570);throw _0x24d570;});}return _0x567f91;})[_0x5432('0x1f')](respondWithResult(_0x13fd25,0xc9))[_0x5432('0x56')](handleError(_0x13fd25,null));};exports[_0x5432('0x61')]=function(_0x279d9d,_0x2937e7){if(_0x279d9d[_0x5432('0x62')]['id']){delete _0x279d9d[_0x5432('0x62')]['id'];}return db[_0x5432('0x3c')][_0x5432('0x59')]({'where':{'id':_0x279d9d[_0x5432('0x57')]['id']},'include':[{'model':db[_0x5432('0x63')],'as':_0x5432('0x58')}]})[_0x5432('0x1f')](handleEntityNotFound(_0x2937e7,null))[_0x5432('0x1f')](saveUpdates(_0x279d9d[_0x5432('0x62')],null))[_0x5432('0x1f')](respondWithResult(_0x2937e7,null))[_0x5432('0x56')](handleError(_0x2937e7,null));};exports['destroy']=function(_0x3a00de,_0x4943a9){return db[_0x5432('0x3c')][_0x5432('0x59')]({'where':{'id':_0x3a00de['params']['id']}})[_0x5432('0x1f')](handleEntityNotFound(_0x4943a9,null))[_0x5432('0x1f')](removeEntity(_0x4943a9,null))[_0x5432('0x56')](handleError(_0x4943a9,null));};exports[_0x5432('0x64')]=function(_0x47d4e0,_0x3a78b3){return db['WhatsappAccount'][_0x5432('0x64')]()[_0x5432('0x1f')](respondWithResult(_0x3a78b3,null))[_0x5432('0x56')](handleError(_0x3a78b3,null));};exports[_0x5432('0x65')]=function(_0x1b54c4,_0x455085,_0x585835){if(_0x1b54c4[_0x5432('0x62')]['id']){delete _0x1b54c4[_0x5432('0x62')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1b54c4[_0x5432('0x57')]['id']}})['then'](handleEntityNotFound(_0x455085,null))[_0x5432('0x1f')](function(_0x53318b){if(_0x53318b){_0x1b54c4[_0x5432('0x62')]['WhatsappAccountId']=_0x53318b['id'];return db[_0x5432('0x66')]['create'](_0x1b54c4['body']);}})[_0x5432('0x1f')](respondWithResult(_0x455085,null))[_0x5432('0x56')](handleError(_0x455085,null));};exports[_0x5432('0x67')]=function(_0x50b478,_0x4c3e6f,_0x571d27){var _0xeedd08={'raw':![],'where':{}};var _0xd20561={};var _0x3a85aa={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x50b478[_0x5432('0x57')]['id']}})[_0x5432('0x1f')](handleEntityNotFound(_0x4c3e6f,null))[_0x5432('0x1f')](function(_0x3c0162){if(_0x3c0162){_0xd20561[_0x5432('0x45')]=_[_0x5432('0x41')](db[_0x5432('0x66')][_0x5432('0x3d')]);_0xd20561['query']=_[_0x5432('0x41')](_0x50b478['query']);_0xd20561[_0x5432('0x4c')]=_[_0x5432('0x43')](_0xd20561[_0x5432('0x45')],_0xd20561[_0x5432('0x42')]);_0xeedd08[_0x5432('0x44')]=_[_0x5432('0x43')](_0xd20561[_0x5432('0x45')],qs['fields'](_0x50b478[_0x5432('0x42')][_0x5432('0x68')]));_0xeedd08[_0x5432('0x44')]=_0xeedd08[_0x5432('0x44')]['length']?_0xeedd08[_0x5432('0x44')]:_0xd20561[_0x5432('0x45')];if(!_0x50b478[_0x5432('0x42')][_0x5432('0x47')](_0x5432('0x69'))){_0xeedd08[_0x5432('0x2f')]=qs[_0x5432('0x2f')](_0x50b478[_0x5432('0x42')]['limit']);_0xeedd08[_0x5432('0x2e')]=qs[_0x5432('0x2e')](_0x50b478[_0x5432('0x42')][_0x5432('0x2e')]);}_0xeedd08[_0x5432('0x48')]=qs[_0x5432('0x49')](_0x50b478[_0x5432('0x42')]['sort']);_0xeedd08[_0x5432('0x4a')]=qs[_0x5432('0x4c')](_[_0x5432('0x4b')](_0x50b478[_0x5432('0x42')],_0xd20561[_0x5432('0x4c')]));_0xeedd08[_0x5432('0x4a')]['WhatsappAccountId']=_0x3c0162['id'];if(_0x50b478['query']['filter']){_0xeedd08['where']=_[_0x5432('0x4f')](_0xeedd08['where'],{'$or':_[_0x5432('0x3b')](_0xeedd08[_0x5432('0x44')],function(_0x49d7dd){var _0x5c0af1={};_0x5c0af1[_0x49d7dd]={'$like':'%'+_0x50b478['query']['filter']+'%'};return _0x5c0af1;})});}_0xeedd08=_[_0x5432('0x4f')]({},_0xeedd08,_0x50b478[_0x5432('0x50')]);return db['Disposition'][_0x5432('0x51')]({'where':_0xeedd08[_0x5432('0x4a')]})[_0x5432('0x1f')](function(_0x557deb){_0x3a85aa[_0x5432('0x51')]=_0x557deb;if(_0x50b478[_0x5432('0x42')]['includeAll']){_0xeedd08[_0x5432('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x5432('0x54')](_0xeedd08);})[_0x5432('0x1f')](function(_0x231d06){_0x3a85aa[_0x5432('0x55')]=_0x231d06;return _0x3a85aa;});}})[_0x5432('0x1f')](respondWithFilteredResult(_0x4c3e6f,_0xeedd08))[_0x5432('0x56')](handleError(_0x4c3e6f,null));};exports['removeDispositions']=function(_0x35d83a,_0x276772,_0x51f54f){return db[_0x5432('0x3c')][_0x5432('0x59')]({'where':{'id':_0x35d83a[_0x5432('0x57')]['id']}})[_0x5432('0x1f')](handleEntityNotFound(_0x276772,null))[_0x5432('0x1f')](function(_0x3aad8f){if(_0x3aad8f){return _0x3aad8f['removeDispositions'](_0x35d83a[_0x5432('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x276772,null))['catch'](handleError(_0x276772,null));};exports[_0x5432('0x6a')]=function(_0x4e9aae,_0x5853c3,_0x19238b){if(_0x4e9aae['body']['id']){delete _0x4e9aae[_0x5432('0x62')]['id'];}return db[_0x5432('0x3c')][_0x5432('0x59')]({'where':{'id':_0x4e9aae[_0x5432('0x57')]['id']}})[_0x5432('0x1f')](handleEntityNotFound(_0x5853c3,null))[_0x5432('0x1f')](function(_0x14c491){if(_0x14c491){_0x4e9aae[_0x5432('0x62')][_0x5432('0x6b')]=_0x14c491['id'];return db[_0x5432('0x6c')][_0x5432('0x5a')](_0x4e9aae[_0x5432('0x62')]);}})['then'](respondWithResult(_0x5853c3,null))[_0x5432('0x56')](handleError(_0x5853c3,null));};exports['getAnswers']=function(_0x3f652d,_0x2f07ce,_0x305d73){var _0x4ca0be={'raw':![],'where':{}};var _0x3807c8={};var _0x221a7b={'count':0x0,'rows':[]};return db[_0x5432('0x3c')][_0x5432('0x6d')]({'where':{'id':_0x3f652d[_0x5432('0x57')]['id']}})['then'](handleEntityNotFound(_0x2f07ce,null))[_0x5432('0x1f')](function(_0x45c89e){if(_0x45c89e){_0x3807c8[_0x5432('0x45')]=_[_0x5432('0x41')](db[_0x5432('0x6c')][_0x5432('0x3d')]);_0x3807c8[_0x5432('0x42')]=_[_0x5432('0x41')](_0x3f652d[_0x5432('0x42')]);_0x3807c8[_0x5432('0x4c')]=_[_0x5432('0x43')](_0x3807c8[_0x5432('0x45')],_0x3807c8[_0x5432('0x42')]);_0x4ca0be[_0x5432('0x44')]=_['intersection'](_0x3807c8[_0x5432('0x45')],qs['fields'](_0x3f652d[_0x5432('0x42')]['fields']));_0x4ca0be[_0x5432('0x44')]=_0x4ca0be[_0x5432('0x44')][_0x5432('0x46')]?_0x4ca0be[_0x5432('0x44')]:_0x3807c8['model'];if(!_0x3f652d[_0x5432('0x42')][_0x5432('0x47')](_0x5432('0x69'))){_0x4ca0be[_0x5432('0x2f')]=qs[_0x5432('0x2f')](_0x3f652d[_0x5432('0x42')][_0x5432('0x2f')]);_0x4ca0be[_0x5432('0x2e')]=qs[_0x5432('0x2e')](_0x3f652d['query'][_0x5432('0x2e')]);}_0x4ca0be[_0x5432('0x48')]=qs[_0x5432('0x49')](_0x3f652d[_0x5432('0x42')][_0x5432('0x49')]);_0x4ca0be[_0x5432('0x4a')]=qs[_0x5432('0x4c')](_['pick'](_0x3f652d[_0x5432('0x42')],_0x3807c8[_0x5432('0x4c')]));_0x4ca0be[_0x5432('0x4a')]['WhatsappAccountId']=_0x45c89e['id'];if(_0x3f652d[_0x5432('0x42')][_0x5432('0x4e')]){_0x4ca0be[_0x5432('0x4a')]=_[_0x5432('0x4f')](_0x4ca0be[_0x5432('0x4a')],{'$or':_[_0x5432('0x3b')](_0x4ca0be[_0x5432('0x44')],function(_0x45a7c9){var _0x389a61={};_0x389a61[_0x45a7c9]={'$like':'%'+_0x3f652d[_0x5432('0x42')][_0x5432('0x4e')]+'%'};return _0x389a61;})});}_0x4ca0be=_[_0x5432('0x4f')]({},_0x4ca0be,_0x3f652d[_0x5432('0x50')]);return db['CannedAnswer'][_0x5432('0x51')]({'where':_0x4ca0be[_0x5432('0x4a')]})[_0x5432('0x1f')](function(_0x5b285a){_0x221a7b[_0x5432('0x51')]=_0x5b285a;if(_0x3f652d['query'][_0x5432('0x52')]){_0x4ca0be[_0x5432('0x53')]=[{'all':!![]}];}return db[_0x5432('0x6c')]['findAll'](_0x4ca0be);})[_0x5432('0x1f')](function(_0x1e2c5f){_0x221a7b[_0x5432('0x55')]=_0x1e2c5f;return _0x221a7b;});}})[_0x5432('0x1f')](respondWithFilteredResult(_0x2f07ce,_0x4ca0be))[_0x5432('0x56')](handleError(_0x2f07ce,null));};exports[_0x5432('0x6e')]=function(_0x4a7e92,_0x5c9cdf,_0x35eeee){return db[_0x5432('0x3c')]['find']({'where':{'id':_0x4a7e92['params']['id']}})[_0x5432('0x1f')](handleEntityNotFound(_0x5c9cdf,null))['then'](function(_0x4e115b){if(_0x4e115b){return _0x4e115b[_0x5432('0x6e')](_0x4a7e92[_0x5432('0x42')][_0x5432('0x6f')]);}})[_0x5432('0x1f')](respondWithStatusCode(_0x5c9cdf,null))[_0x5432('0x56')](handleError(_0x5c9cdf,null));};exports['addAgents']=function(_0x1a967c,_0x66045c,_0x9ea224){return db[_0x5432('0x3c')][_0x5432('0x59')]({'where':{'id':_0x1a967c[_0x5432('0x57')]['id']}})[_0x5432('0x1f')](handleEntityNotFound(_0x66045c,null))[_0x5432('0x1f')](function(_0x21d2b3){if(_0x21d2b3){return _0x21d2b3[_0x5432('0x70')](_0x1a967c[_0x5432('0x62')][_0x5432('0x6f')],_[_0x5432('0x71')](_0x1a967c['body'],[_0x5432('0x6f'),'id'])||{})['spread'](function(_0x17bcd4){for(var _0x2e6c4b=0x0;_0x2e6c4b<_0x1a967c[_0x5432('0x62')][_0x5432('0x6f')][_0x5432('0x46')];_0x2e6c4b+=0x1){socket[_0x5432('0x72')](_0x5432('0x73'),{'UserId':Number(_0x1a967c[_0x5432('0x62')][_0x5432('0x6f')][_0x2e6c4b]),'WhatsappAccountId':Number(_0x1a967c[_0x5432('0x57')]['id'])});}return _0x17bcd4;});}})[_0x5432('0x1f')](respondWithResult(_0x66045c,null))[_0x5432('0x56')](handleError(_0x66045c,null));};exports[_0x5432('0x74')]=function(_0x5c45f4,_0xa5f72b,_0x27e327){return db[_0x5432('0x3c')][_0x5432('0x59')]({'where':{'id':_0x5c45f4[_0x5432('0x57')]['id']}})[_0x5432('0x1f')](handleEntityNotFound(_0xa5f72b,null))[_0x5432('0x1f')](function(_0x4882df){if(_0x4882df){return _0x4882df[_0x5432('0x74')](_0x5c45f4[_0x5432('0x42')][_0x5432('0x6f')])[_0x5432('0x1f')](function(){if(_['isArray'](_0x5c45f4[_0x5432('0x42')][_0x5432('0x6f')])){for(var _0x423cd3=0x0;_0x423cd3<_0x5c45f4[_0x5432('0x42')][_0x5432('0x6f')]['length'];_0x423cd3+=0x1){socket[_0x5432('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x5c45f4[_0x5432('0x42')][_0x5432('0x6f')][_0x423cd3]),'WhatsappAccountId':Number(_0x5c45f4[_0x5432('0x57')]['id'])});}}else{socket['emit'](_0x5432('0x75'),{'UserId':Number(_0x5c45f4[_0x5432('0x42')][_0x5432('0x6f')]),'WhatsappAccountId':Number(_0x5c45f4['params']['id'])});}});}})[_0x5432('0x1f')](respondWithStatusCode(_0xa5f72b,null))[_0x5432('0x56')](handleError(_0xa5f72b,null));};exports[_0x5432('0x76')]=function(_0x3db90b,_0x7c5431,_0x121470){var _0x1c0d90={};var _0x55dfb9={};var _0x2b1dcc;var _0x46e6f1;return db[_0x5432('0x3c')][_0x5432('0x6d')]({'where':{'id':_0x3db90b['params']['id']}})['then'](handleEntityNotFound(_0x7c5431,null))['then'](function(_0x5e0c60){if(_0x5e0c60){_0x2b1dcc=_0x5e0c60;_0x55dfb9['model']=_['keys'](db['User']['rawAttributes']);_0x55dfb9['query']=_[_0x5432('0x41')](_0x3db90b[_0x5432('0x42')]);_0x55dfb9['filters']=_[_0x5432('0x43')](_0x55dfb9[_0x5432('0x45')],_0x55dfb9[_0x5432('0x42')]);_0x1c0d90[_0x5432('0x44')]=_['intersection'](_0x55dfb9[_0x5432('0x45')],qs[_0x5432('0x68')](_0x3db90b[_0x5432('0x42')][_0x5432('0x68')]));_0x1c0d90[_0x5432('0x44')]=_0x1c0d90['attributes']['length']?_0x1c0d90[_0x5432('0x44')]:_0x55dfb9['model'];_0x1c0d90['order']=qs[_0x5432('0x49')](_0x3db90b[_0x5432('0x42')][_0x5432('0x49')]);_0x1c0d90['where']=qs[_0x5432('0x4c')](_['pick'](_0x3db90b[_0x5432('0x42')],_0x55dfb9[_0x5432('0x4c')]));if(_0x3db90b['query'][_0x5432('0x4e')]){_0x1c0d90[_0x5432('0x4a')]=_[_0x5432('0x4f')](_0x1c0d90[_0x5432('0x4a')],{'$or':_['map'](_0x1c0d90[_0x5432('0x44')],function(_0xffa35){var _0x1303a8={};_0x1303a8[_0xffa35]={'$like':'%'+_0x3db90b[_0x5432('0x42')][_0x5432('0x4e')]+'%'};return _0x1303a8;})});}_0x1c0d90=_[_0x5432('0x4f')]({},_0x1c0d90,_0x3db90b[_0x5432('0x50')]);return _0x2b1dcc[_0x5432('0x76')](_0x1c0d90);}})[_0x5432('0x1f')](function(_0xbf95d0){if(_0xbf95d0){_0x46e6f1=_0xbf95d0[_0x5432('0x46')];if(!_0x3db90b['query']['hasOwnProperty'](_0x5432('0x69'))){_0x1c0d90['limit']=qs[_0x5432('0x2f')](_0x3db90b[_0x5432('0x42')][_0x5432('0x2f')]);_0x1c0d90[_0x5432('0x2e')]=qs[_0x5432('0x2e')](_0x3db90b['query']['offset']);}return _0x2b1dcc['getAgents'](_0x1c0d90);}})[_0x5432('0x1f')](function(_0x4048d5){if(_0x4048d5){return _0x4048d5?{'count':_0x46e6f1,'rows':_0x4048d5}:null;}})[_0x5432('0x1f')](respondWithResult(_0x7c5431,null))['catch'](handleError(_0x7c5431,null));};exports[_0x5432('0x77')]=function(_0x93c872,_0xf8798e){var _0x54284e=_0x93c872[_0x5432('0x57')]['id'];var _0xcdc2ad=_0x93c872[_0x5432('0x62')];var _0x2f932b=0xc8;var _0x568912=null;return db['sequelize'][_0x5432('0x78')]({'isolationLevel':db[_0x5432('0x79')][_0x5432('0x7a')][_0x5432('0x7b')]['READ_COMMITTED']},function(_0xbdbc76){return db[_0x5432('0x3c')][_0x5432('0x6d')]({'where':{'id':_0x54284e},'transaction':_0xbdbc76})['then'](function(_0x44d65a){if(_0x44d65a){return db[_0x5432('0x7c')][_0x5432('0x34')]({'where':{'WhatsappAccountId':_0x54284e},'transaction':_0xbdbc76})[_0x5432('0x1f')](function(){var _0x1c29ba=_[_0x5432('0x3b')](_0xcdc2ad,function(_0xc53eb2){_0xc53eb2['WhatsappAccountId']=_0x54284e;return _0xc53eb2;});return db[_0x5432('0x7c')][_0x5432('0x7d')](_0x1c29ba,{'transaction':_0xbdbc76});});}else{_0x2f932b=0x194;_0x568912=[];}});})[_0x5432('0x1f')](function(){if(_0x2f932b!==0x194){return db[_0x5432('0x7c')][_0x5432('0x7e')]({'where':{'WhatsappAccountId':_0x54284e},'order':'priority'})[_0x5432('0x1f')](function(_0xcaefb6){_0x568912=_0xcaefb6;});}})[_0x5432('0x56')](function(_0x657c3b){_0x2f932b=0x1f4;logger['error'](_0x657c3b[_0x5432('0x38')]);if(_0x657c3b[_0x5432('0x39')]){delete _0x657c3b[_0x5432('0x39')];}_0x568912=_0x657c3b;})['finally'](function(){if(_0x568912===null){_0xf8798e[_0x5432('0x2a')](_0x2f932b);}else{if(_0x2f932b===0x1f4){_0xf8798e[_0x5432('0x2b')](_0x2f932b)[_0x5432('0x3a')](_0x568912);}else{_0xf8798e[_0x5432('0x2b')](_0x2f932b)[_0x5432('0x2c')](_0x568912);}}});};exports[_0x5432('0x7f')]=function(_0x47b627,_0x4589c1,_0x2c6f0f){var _0x4fd588={};var _0x17042a={};var _0x25b05d;var _0x4d8359;return db[_0x5432('0x3c')][_0x5432('0x6d')]({'where':{'id':_0x47b627[_0x5432('0x57')]['id']}})[_0x5432('0x1f')](handleEntityNotFound(_0x4589c1,null))[_0x5432('0x1f')](function(_0x5b3f33){if(_0x5b3f33){_0x25b05d=_0x5b3f33;_0x17042a[_0x5432('0x45')]=_[_0x5432('0x41')](db[_0x5432('0x7c')][_0x5432('0x3d')]);_0x17042a[_0x5432('0x42')]=_[_0x5432('0x41')](_0x47b627[_0x5432('0x42')]);_0x17042a[_0x5432('0x4c')]=_[_0x5432('0x43')](_0x17042a[_0x5432('0x45')],_0x17042a[_0x5432('0x42')]);_0x4fd588[_0x5432('0x44')]=_[_0x5432('0x43')](_0x17042a[_0x5432('0x45')],qs['fields'](_0x47b627['query'][_0x5432('0x68')]));_0x4fd588[_0x5432('0x44')]=_0x4fd588['attributes'][_0x5432('0x46')]?_0x4fd588[_0x5432('0x44')]:_0x17042a[_0x5432('0x45')];_0x4fd588[_0x5432('0x48')]=qs[_0x5432('0x49')](_0x47b627[_0x5432('0x42')][_0x5432('0x49')]);_0x4fd588[_0x5432('0x4a')]=qs[_0x5432('0x4c')](_[_0x5432('0x4b')](_0x47b627[_0x5432('0x42')],_0x17042a[_0x5432('0x4c')]));if(_0x47b627[_0x5432('0x42')][_0x5432('0x4e')]){_0x4fd588[_0x5432('0x4a')]=_['merge'](_0x4fd588[_0x5432('0x4a')],{'$or':_[_0x5432('0x3b')](_0x4fd588[_0x5432('0x44')],function(_0x42fa5f){var _0xa39ad3={};_0xa39ad3[_0x42fa5f]={'$like':'%'+_0x47b627['query']['filter']+'%'};return _0xa39ad3;})});}_0x4fd588=_[_0x5432('0x4f')]({},_0x4fd588,_0x47b627[_0x5432('0x50')]);return _0x25b05d[_0x5432('0x7f')](_0x4fd588);}})[_0x5432('0x1f')](function(_0x549760){if(_0x549760){_0x4d8359=_0x549760[_0x5432('0x46')];if(!_0x47b627[_0x5432('0x42')][_0x5432('0x47')](_0x5432('0x69'))){_0x4fd588[_0x5432('0x2f')]=qs[_0x5432('0x2f')](_0x47b627[_0x5432('0x42')]['limit']);_0x4fd588[_0x5432('0x2e')]=qs[_0x5432('0x2e')](_0x47b627['query']['offset']);}return _0x25b05d[_0x5432('0x7f')](_0x4fd588);}})[_0x5432('0x1f')](function(_0x2f57f5){if(_0x2f57f5){return _0x2f57f5?{'count':_0x4d8359,'rows':_0x2f57f5}:null;}})[_0x5432('0x1f')](respondWithResult(_0x4589c1,null))['catch'](handleError(_0x4589c1,null));};exports[_0x5432('0x80')]=function(_0x30b9d9,_0xefb2f7,_0x1945e6){var _0x5eaa4e={'channel':_0x5432('0x81')};var _0x1a4802=[];var _0x5211de=[];var _0xe4d72a={};return db[_0x5432('0x3c')][_0x5432('0x59')]({'where':{'id':_0x30b9d9[_0x5432('0x57')]['id']},'include':[{'model':db[_0x5432('0x7c')],'as':_0x5432('0x82')}]})['then'](handleEntityNotFound(_0xefb2f7,null))[_0x5432('0x1f')](function(_0x4ea0d6){_0x5eaa4e[_0x5432('0x83')]=_0x4ea0d6;if(_0x5eaa4e[_0x5432('0x83')]&&_0x5eaa4e['account'][_0x5432('0x3f')]===_0x5432('0x84')&&_0x30b9d9['body'][_0x5432('0x85')]){if(_0x30b9d9[_0x5432('0x62')][_0x5432('0x85')]['length']===0x0)return;if(_0x30b9d9[_0x5432('0x62')][_0x5432('0x85')][0x0][_0x5432('0x86')]!==_0x5432('0x87'))return;return db[_0x5432('0x88')][_0x5432('0x61')]({'read':!![],'readAt':_0x30b9d9['body'][_0x5432('0x85')][0x0][_0x5432('0x89')]},{'where':{'messageId':_0x30b9d9[_0x5432('0x62')][_0x5432('0x85')][0x0][_0x5432('0x8a')]},'individualHooks':!![]})[_0x5432('0x1f')](function(_0x5e0035){return _0xefb2f7['status'](0xc8)['json'](_0x5e0035);});}_0x5eaa4e['applications']=_[_0x5432('0x8b')](_0x4ea0d6['Applications'],['priority'],['asc']);if(_0x5eaa4e[_0x5432('0x83')]['Applications']){delete _0x5eaa4e[_0x5432('0x83')]['Applications'];}return db[_0x5432('0x8c')][_0x5432('0x64')]()[_0x5432('0x1f')](function(_0x5c4b4f){if(!_0x5c4b4f){throw new db[(_0x5432('0x8d'))]['ValidationError'](_0x5432('0x8e'));}_0x1a4802=_[_0x5432('0x8f')](_[_0x5432('0x41')](_0x5c4b4f),[_0x5432('0x90'),'updatedAt']);_0x5211de=_[_0x5432('0x8f')](_[_0x5432('0x41')](_0x5c4b4f),[_0x5432('0x90'),_0x5432('0x91'),_0x5432('0x92'),_0x5432('0x93')]);_0x5eaa4e[_0x5432('0x62')]={'mapKey':_0x5432('0x94')};if(_0x5eaa4e['account']&&_0x5eaa4e['account'][_0x5432('0x3f')]==='twilio'){_0x5eaa4e[_0x5432('0x62')][_0x5432('0x95')]=_0x30b9d9[_0x5432('0x62')]['From']['replace']('whatsapp:','');_0x5eaa4e[_0x5432('0x62')][_0x5432('0x62')]=_0x30b9d9[_0x5432('0x62')][_0x5432('0x96')];_0x5eaa4e['body'][_0x5432('0x97')]=_0x30b9d9[_0x5432('0x62')][_0x5432('0x98')];}if(_0x5eaa4e['account']&&_0x5eaa4e[_0x5432('0x83')]['type']==='sinch'){_0x5eaa4e[_0x5432('0x62')][_0x5432('0x95')]=_0x30b9d9[_0x5432('0x62')][_0x5432('0x99')][0x0]['from'];_0x5eaa4e[_0x5432('0x62')]['body']=_0x30b9d9[_0x5432('0x62')]['notifications'][0x0][_0x5432('0x28')][_0x5432('0x62')];_0x5eaa4e['body'][_0x5432('0x97')]=_0x30b9d9[_0x5432('0x62')][_0x5432('0x99')][0x0][_0x5432('0x8a')];}if(_0x5eaa4e[_0x5432('0x62')]['id']){delete _0x5eaa4e[_0x5432('0x62')]['id'];}if(_[_0x5432('0x9a')](_0x5eaa4e[_0x5432('0x62')]['from'])){throw new db[(_0x5432('0x8d'))][(_0x5432('0x9b'))](_0x5432('0x9c'));}if(_[_0x5432('0x9a')](_0x5eaa4e[_0x5432('0x62')]['body'])||_0x5eaa4e[_0x5432('0x62')]['body']===''){throw new db['Sequelize'][(_0x5432('0x9b'))](_0x5432('0x9d'));}if(_[_0x5432('0x9a')](_0x5eaa4e[_0x5432('0x62')][_0x5432('0x9e')])){throw new db[(_0x5432('0x8d'))][(_0x5432('0x9b'))](_0x5432('0x9f')+_0x5211de);}if(!_[_0x5432('0xa0')](_0x5211de,_0x5eaa4e[_0x5432('0x62')][_0x5432('0x9e')])){throw new db[(_0x5432('0x8d'))][(_0x5432('0x9b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5211de);}_0xe4d72a[_0x5eaa4e[_0x5432('0x62')][_0x5432('0x9e')]]=_0x5eaa4e[_0x5432('0x62')][_0x5432('0x95')];return db['CmList'][_0x5432('0x59')]({'where':{'id':_0x5eaa4e[_0x5432('0x83')][_0x5432('0x93')]},'include':[{'model':db[_0x5432('0x8c')],'as':_0x5432('0xa1'),'where':_0xe4d72a,'limit':0x1,'order':[[_0x5432('0x91'),_0x5432('0xa2')]]}]});})[_0x5432('0x1f')](handleEntityNotFound(_0xefb2f7,null))[_0x5432('0x1f')](function(_0x13ad86){if(_0x13ad86){_0x5eaa4e[_0x5432('0xa3')]=_[_0x5432('0x71')](_0x13ad86,[_0x5432('0xa1')]);if(_0x13ad86[_0x5432('0xa1')][_0x5432('0x46')]){return _0x13ad86[_0x5432('0xa1')][0x0];}var _0x5657c3=_[_0x5432('0x17')](_0x5eaa4e[_0x5432('0x62')],{'firstName':_0x5eaa4e[_0x5432('0x62')][_0x5432('0x95')],'ListId':_0x13ad86['id']});_0x5657c3[_0x5eaa4e[_0x5432('0x62')][_0x5432('0x9e')]]=_0x5eaa4e['body'][_0x5432('0x95')];return db[_0x5432('0x8c')][_0x5432('0x5a')](_0x5657c3,{'fields':_0x1a4802,'raw':!![]});}})[_0x5432('0x1f')](handleEntityNotFound(_0xefb2f7,null))[_0x5432('0x1f')](function(_0x3aad0b){if(_0x3aad0b){_0x5eaa4e['contact']=_0x3aad0b;var _0x2a24d9={'ContactId':_0x3aad0b['id'],'phone':_0x5eaa4e[_0x5432('0x62')][_0x5432('0x95')],'WhatsappAccountId':_0x30b9d9[_0x5432('0x57')]['id']};var _0x566a39={'ContactId':_0x3aad0b['id'],'WhatsappAccountId':_0x30b9d9[_0x5432('0x57')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x5432('0x59')]({'where':_0x566a39})[_0x5432('0x1f')](function(_0x421e2d){if(_0x421e2d){return[_0x421e2d,![]];}return db[_0x5432('0xa4')][_0x5432('0x5a')](_0x2a24d9)[_0x5432('0x1f')](function(_0x4d5c82){return[_0x4d5c82,!![]];});});}})[_0x5432('0xa5')](function(_0xddcd00,_0x1c3fc6){_0x5eaa4e[_0x5432('0xa6')]=_0xddcd00[_0x5432('0x5c')]({'plain':!![]});_0x5eaa4e['interaction'][_0x5432('0xa7')]=![];if(_0x1c3fc6){if(_0x5eaa4e[_0x5432('0x83')]['autoclose']){_0x5eaa4e[_0x5432('0xa8')][_0x5432('0xa9')]({'id':0x0,'priority':_0x5eaa4e['applications'][_0x5432('0x46')]+0x1,'app':_0x5432('0xaa'),'appdata':'unmanaged','interval':_0x5432('0xab')});}_0x5eaa4e[_0x5432('0xa6')]['created']=!![];}return db[_0x5432('0x88')][_0x5432('0x5a')]({'phone':_0x5eaa4e[_0x5432('0x62')][_0x5432('0x95')],'messageId':_0x5eaa4e[_0x5432('0x62')]['messageId'],'body':_0x5eaa4e[_0x5432('0x62')][_0x5432('0x62')],'WhatsappAccountId':_0x30b9d9[_0x5432('0x57')]['id'],'WhatsappInteractionId':_0xddcd00['id'],'direction':'in','ContactId':_0xddcd00['ContactId'],'AttachmentId':_0x5eaa4e[_0x5432('0x62')][_0x5432('0xac')]});})[_0x5432('0x1f')](function(_0x4b7cd7){_0x5eaa4e['message']=_0x4b7cd7;if(!_0x5eaa4e[_0x5432('0xa6')][_0x5432('0xad')])return;return db[_0x5432('0xae')][_0x5432('0x59')]({'attributes':['id','name'],'where':{'id':_0x5eaa4e[_0x5432('0xa6')][_0x5432('0xad')]}});})['then'](function(_0x3c6491){if(_0x3c6491){_0x5eaa4e['applications'][_0x5432('0xaf')]({'id':0x0,'priority':0x0,'app':_0x5432('0xb0'),'appdata':_0x3c6491[_0x5432('0x39')]+','+(_0x5eaa4e[_0x5432('0x83')][_0x5432('0xb1')]||0xa),'interval':'*,*,*,*'});}if(!_0x5eaa4e[_0x5432('0xa6')][_0x5432('0xb2')])return;return db[_0x5432('0xb3')]['find']({'attributes':['id',_0x5432('0x39')],'where':{'id':_0x5eaa4e[_0x5432('0xa6')]['queueId']}});})[_0x5432('0x1f')](function(_0x3173d4){if(_0x3173d4){_0x5eaa4e[_0x5432('0xa8')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3173d4[_0x5432('0x39')]+','+(_0x5eaa4e['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x5432('0xab')});}return respondWithRpcPromise(_0x5432('0xb4'),'startRouting',_0x5eaa4e);})[_0x5432('0x1f')](function(_0x11787d){if(_0x11787d){var _0x362ea9=0xc8;var _0xf49a88=_0x5432('0xb5');logger[_0x5432('0x20')](_0x5432('0x23'),_0xf49a88,_0x362ea9,'entity\x20found');logger[_0x5432('0x22')](_0x5432('0xb6'),_0xf49a88,_0x362ea9,_0x5432('0xb7'),JSON['stringify'](_0x11787d));if(_0x5eaa4e[_0x5432('0x83')]['type']===_0x5432('0xb8')){return _0xefb2f7[_0x5432('0x2b')](_0x362ea9)[_0x5432('0x30')](_0x5432('0xb9'),_0x5432('0xba'))[_0x5432('0x3a')]('\x0a');}else{return _0xefb2f7['status'](_0x362ea9)[_0x5432('0x2c')](_0x11787d);}}});})[_0x5432('0x56')](handleError(_0xefb2f7,null));};exports['send']=function(_0x435b1b,_0xc12765,_0x47b945){var _0x18da80,_0x161468,_0x1c31ab;if(_['isNil'](_0x435b1b[_0x5432('0x62')][_0x5432('0x62')])||_0x435b1b[_0x5432('0x62')][_0x5432('0x62')]===''){throw new db[(_0x5432('0x8d'))][(_0x5432('0x9b'))](_0x5432('0x9d'));}if(_['isNil'](_0x435b1b[_0x5432('0x62')]['to'])){throw new db[(_0x5432('0x8d'))]['ValidationError'](_0x5432('0xbb'));}_0x18da80=_0x435b1b['body']['to'];return db[_0x5432('0x3c')]['find']({'where':{'id':_0x435b1b['params']['id']},'include':[{'model':db[_0x5432('0xbc')],'as':_0x5432('0xbd'),'include':[{'model':db[_0x5432('0x8c')],'as':_0x5432('0xa1'),'where':{'mobile':_0x18da80},'limit':0x1,'order':[[_0x5432('0x91'),_0x5432('0xa2')]]}]}]})['then'](handleEntityNotFound(_0xc12765,null))['then'](function(_0x28b66b){if(_0x28b66b&&_0x28b66b['List']){_0x161468=_0x28b66b[_0x5432('0x5c')]({'plain':!![]});if(_0x161468[_0x5432('0xbd')]&&_0x161468[_0x5432('0xbd')][_0x5432('0xa1')][_0x5432('0x46')]){return _0x161468[_0x5432('0xbd')][_0x5432('0xa1')][0x0];}return db[_0x5432('0x8c')][_0x5432('0x5a')](_['defaults'](_0x435b1b['body'],{'firstName':_0x18da80,'mobile':_0x18da80,'phone':_0x18da80,'ListId':_0x161468[_0x5432('0x93')]}));}})[_0x5432('0x1f')](handleEntityNotFound(_0xc12765,null))[_0x5432('0x1f')](function(_0x2e9669){if(_0x2e9669){_0x1c31ab=_0x2e9669;return db[_0x5432('0xa4')][_0x5432('0x59')]({'where':{'ContactId':_0x1c31ab['id'],'closed':![],'WhatsappAccountId':_0x161468['id']}})[_0x5432('0x1f')](function(_0x1ea6a7){if(_0x1ea6a7){return[_0x1ea6a7,![]];}return db[_0x5432('0xa4')][_0x5432('0x5a')]({'UserId':_0x435b1b[_0x5432('0x5b')]['id'],'ContactId':_0x1c31ab['id'],'WhatsappAccountId':_0x161468['id'],'phone':_0x18da80,'firstMsgDirection':_0x5432('0xbe'),'Messages':[_[_0x5432('0x4f')](_0x435b1b[_0x5432('0x62')],{'read':![],'body':_0x435b1b[_0x5432('0x62')][_0x5432('0x62')],'phone':_0x18da80,'WhatsappAccountId':_0x161468['id'],'UserId':_0x435b1b['user']['id'],'ContactId':_0x1c31ab['id']})]},{'include':[{'model':db[_0x5432('0x88')],'as':_0x5432('0xbf')}]})[_0x5432('0x1f')](function(_0x2fa39a){return[_0x2fa39a,!![]];});});}})[_0x5432('0xa5')](function(_0xdb5681,_0x65ff58){if(_0x65ff58){return _0xdb5681;}return db[_0x5432('0x88')][_0x5432('0x5a')](_[_0x5432('0x4f')](_0x435b1b[_0x5432('0x62')],{'read':![],'body':_0x435b1b[_0x5432('0x62')][_0x5432('0x62')],'phone':_0x18da80,'WhatsappAccountId':_0x161468['id'],'WhatsappInteractionId':_0xdb5681['id'],'UserId':_0x435b1b[_0x5432('0x5b')]['id'],'ContactId':_0x1c31ab['id']}))[_0x5432('0x1f')](function(_0x577853){_0xdb5681[_0x5432('0xc0')][_0x5432('0xbf')]=[];_0xdb5681[_0x5432('0xc0')][_0x5432('0xbf')][_0x5432('0xa9')](_0x577853['dataValues']);return _0xdb5681;});})['then'](respondWithResult(_0xc12765,null))[_0x5432('0x56')](handleError(_0xc12765,null));}; \ No newline at end of file +var _0x3f76=['waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','destroy','get','WhatsappAccounts','stack','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','name','options','includeAll','rows','catch','show','params','WhatsappAccount','length','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','nolimit','filter','findAll','removeDispositions','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','priority','send','getApplications','account','sinch','statuses','state','WhatsappMessage','update','timestamp','message_id','orderBy','Applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift'];(function(_0x588a1d,_0x4b209c){var _0x3841a8=function(_0x4b71a4){while(--_0x4b71a4){_0x588a1d['push'](_0x588a1d['shift']());}};_0x3841a8(++_0x4b209c);}(_0x3f76,0x1a4));var _0x63f7=function(_0x114ce4,_0x1eb9a1){_0x114ce4=_0x114ce4-0x0;var _0x5afed4=_0x3f76[_0x114ce4];return _0x5afed4;};'use strict';var emlformat=require(_0x63f7('0x0'));var rimraf=require(_0x63f7('0x1'));var zipdir=require(_0x63f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63f7('0x3'));var moment=require(_0x63f7('0x4'));var BPromise=require(_0x63f7('0x5'));var Mustache=require(_0x63f7('0x6'));var util=require(_0x63f7('0x7'));var path=require(_0x63f7('0x8'));var sox=require('sox');var csv=require(_0x63f7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63f7('0xa'));var _=require(_0x63f7('0xb'));var squel=require(_0x63f7('0xc'));var crypto=require(_0x63f7('0xd'));var jsforce=require(_0x63f7('0xe'));var deskjs=require(_0x63f7('0xf'));var toCsv=require(_0x63f7('0x9'));var querystring=require(_0x63f7('0x10'));var Papa=require(_0x63f7('0x11'));var Redis=require(_0x63f7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x63f7('0x13'));var as=require(_0x63f7('0x14'));var hardwareService=require(_0x63f7('0x15'));var logger=require(_0x63f7('0x16'))(_0x63f7('0x17'));var utils=require(_0x63f7('0x18'));var config=require(_0x63f7('0x19'));var licenseUtil=require(_0x63f7('0x1a'));var db=require(_0x63f7('0x1b'))['db'];config[_0x63f7('0x1c')]=_[_0x63f7('0x1d')](config['redis'],{'host':_0x63f7('0x1e'),'port':0x18eb});var socket=require(_0x63f7('0x1f'))(new Redis(config[_0x63f7('0x1c')]));require(_0x63f7('0x20'))['register'](socket);var jayson=require(_0x63f7('0x21'));var client=jayson[_0x63f7('0x22')][_0x63f7('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x400e2d,_0x2616d6,_0x154610,_0x594edf){return new BPromise(function(_0x1af469,_0x47d7f0){var _0x1cdf52=_0x594edf||client;return _0x1cdf52[_0x63f7('0x24')](_0x400e2d,_0x154610)[_0x63f7('0x25')](function(_0x572317){logger[_0x63f7('0x26')](_0x63f7('0x27'),_0x2616d6,_0x63f7('0x28'));logger[_0x63f7('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2616d6,_0x63f7('0x28'),JSON['stringify'](_0x572317));if(_0x572317['error']){if(_0x572317[_0x63f7('0x2a')][_0x63f7('0x2b')]===0x1f4){logger[_0x63f7('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x2616d6,_0x572317[_0x63f7('0x2a')]['message']);return _0x47d7f0(_0x572317[_0x63f7('0x2a')][_0x63f7('0x2c')]);}logger[_0x63f7('0x2a')](_0x63f7('0x27'),_0x2616d6,_0x572317[_0x63f7('0x2a')]['message']);return _0x1af469(_0x572317['error'][_0x63f7('0x2c')]);}else{logger['info'](_0x63f7('0x27'),_0x2616d6,_0x63f7('0x28'));_0x1af469(_0x572317[_0x63f7('0x2d')]['message']);}})['catch'](function(_0x495310){logger[_0x63f7('0x2a')](_0x63f7('0x27'),_0x2616d6,_0x495310);_0x47d7f0(_0x495310);});});}function respondWithStatusCode(_0xc0db3e,_0x394699){_0x394699=_0x394699||0xcc;return function(_0x299d3d){if(_0x299d3d){return _0xc0db3e[_0x63f7('0x2e')](_0x394699);}return _0xc0db3e[_0x63f7('0x2f')](_0x394699)[_0x63f7('0x30')]();};}function respondWithResult(_0x8f3f5,_0x23c9eb){_0x23c9eb=_0x23c9eb||0xc8;return function(_0x4e930c){if(_0x4e930c){return _0x8f3f5[_0x63f7('0x2f')](_0x23c9eb)['json'](_0x4e930c);}};}function respondWithFilteredResult(_0x27bb88,_0x530acc){return function(_0x5f0258){if(_0x5f0258){var _0x2b3528=typeof _0x530acc[_0x63f7('0x31')]==='undefined'&&typeof _0x530acc[_0x63f7('0x32')]===_0x63f7('0x33');var _0xc848ef=_0x5f0258[_0x63f7('0x34')];var _0x568833=_0x2b3528?0x0:_0x530acc['offset'];var _0x118ce2=_0x2b3528?_0x5f0258[_0x63f7('0x34')]:_0x530acc[_0x63f7('0x31')]+_0x530acc[_0x63f7('0x32')];var _0x347aeb;if(_0x118ce2>=_0xc848ef){_0x118ce2=_0xc848ef;_0x347aeb=0xc8;}else{_0x347aeb=0xce;}_0x27bb88[_0x63f7('0x2f')](_0x347aeb);return _0x27bb88['set'](_0x63f7('0x35'),_0x568833+'-'+_0x118ce2+'/'+_0xc848ef)[_0x63f7('0x36')](_0x5f0258);}return null;};}function patchUpdates(_0x564c37){return function(_0x4e0a76){try{jsonpatch[_0x63f7('0x37')](_0x4e0a76,_0x564c37,!![]);}catch(_0xd85f7b){return BPromise['reject'](_0xd85f7b);}return _0x4e0a76[_0x63f7('0x38')]();};}function saveUpdates(_0xf057cb,_0x2698be){return function(_0x1057e5){if(_0x1057e5){return _0x1057e5['update'](_0xf057cb)['then'](function(_0x22e359){return _0x22e359;});}return null;};}function removeEntity(_0x4ded4f,_0x4311fe){return function(_0x596f02){if(_0x596f02){return _0x596f02[_0x63f7('0x39')]()['then'](function(){var _0x1db5dd=_0x596f02[_0x63f7('0x3a')]({'plain':!![]});var _0x3b47ac=_0x63f7('0x3b');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b47ac,'resourceId':_0x1db5dd['id']}})[_0x63f7('0x25')](function(){return _0x596f02;});})['then'](function(){_0x4ded4f[_0x63f7('0x2f')](0xcc)[_0x63f7('0x30')]();});}};}function handleEntityNotFound(_0x3c0d45,_0xbfb121){return function(_0x31fec4){if(!_0x31fec4){_0x3c0d45['sendStatus'](0x194);}return _0x31fec4;};}function handleError(_0x5ae08d,_0x4f0384){_0x4f0384=_0x4f0384||0x1f4;return function(_0x54a1dc){logger[_0x63f7('0x2a')](_0x54a1dc[_0x63f7('0x3c')]);if(_0x54a1dc['name']){delete _0x54a1dc['name'];}_0x5ae08d[_0x63f7('0x2f')](_0x4f0384)['send'](_0x54a1dc);};}exports['index']=function(_0x49222a,_0x2c2002){var _0x114cf2={'include':[{'model':db[_0x63f7('0x3d')],'as':_0x63f7('0x3e')}]},_0xf207a1={},_0x1004f4={'count':0x0,'rows':[]};var _0x28e22a=_[_0x63f7('0x3f')](db['WhatsappAccount'][_0x63f7('0x40')],function(_0x5b3743){return{'name':_0x5b3743[_0x63f7('0x41')],'type':_0x5b3743[_0x63f7('0x42')][_0x63f7('0x43')]};});_0xf207a1[_0x63f7('0x44')]=_[_0x63f7('0x3f')](_0x28e22a,'name');_0xf207a1[_0x63f7('0x45')]=_[_0x63f7('0x46')](_0x49222a['query']);_0xf207a1['filters']=_[_0x63f7('0x47')](_0xf207a1['model'],_0xf207a1[_0x63f7('0x45')]);_0x114cf2[_0x63f7('0x48')]=_['intersection'](_0xf207a1[_0x63f7('0x44')],qs[_0x63f7('0x49')](_0x49222a[_0x63f7('0x45')][_0x63f7('0x49')]));_0x114cf2['attributes']=_0x114cf2['attributes']['length']?_0x114cf2['attributes']:_0xf207a1[_0x63f7('0x44')];if(!_0x49222a[_0x63f7('0x45')][_0x63f7('0x4a')]('nolimit')){_0x114cf2[_0x63f7('0x32')]=qs[_0x63f7('0x32')](_0x49222a[_0x63f7('0x45')][_0x63f7('0x32')]);_0x114cf2[_0x63f7('0x31')]=qs[_0x63f7('0x31')](_0x49222a['query'][_0x63f7('0x31')]);}_0x114cf2[_0x63f7('0x4b')]=qs[_0x63f7('0x4c')](_0x49222a[_0x63f7('0x45')][_0x63f7('0x4c')]);_0x114cf2[_0x63f7('0x4d')]=qs[_0x63f7('0x4e')](_[_0x63f7('0x4f')](_0x49222a['query'],_0xf207a1[_0x63f7('0x4e')]),_0x28e22a);if(_0x49222a[_0x63f7('0x45')]['filter']){_0x114cf2['where']=_['merge'](_0x114cf2[_0x63f7('0x4d')],{'$or':_[_0x63f7('0x3f')](_0x28e22a,function(_0x5de6f2){if(_0x5de6f2['type']!==_0x63f7('0x50')){var _0x41efc9={};_0x41efc9[_0x5de6f2[_0x63f7('0x51')]]={'$like':'%'+_0x49222a[_0x63f7('0x45')]['filter']+'%'};return _0x41efc9;}})});}_0x114cf2=_['merge']({},_0x114cf2,_0x49222a[_0x63f7('0x52')]);var _0x243d75={'where':_0x114cf2[_0x63f7('0x4d')]};return db['WhatsappAccount'][_0x63f7('0x34')](_0x243d75)[_0x63f7('0x25')](function(_0x48a0ac){_0x1004f4[_0x63f7('0x34')]=_0x48a0ac;if(_0x49222a['query'][_0x63f7('0x53')]){_0x114cf2['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x114cf2);})[_0x63f7('0x25')](function(_0x1f7d6a){_0x1004f4[_0x63f7('0x54')]=_0x1f7d6a;return _0x1004f4;})[_0x63f7('0x25')](respondWithFilteredResult(_0x2c2002,_0x114cf2))[_0x63f7('0x55')](handleError(_0x2c2002,null));};exports[_0x63f7('0x56')]=function(_0x1383b4,_0x48ff92){var _0x3e04ea={'raw':![],'where':{'id':_0x1383b4[_0x63f7('0x57')]['id']},'include':[{'model':db[_0x63f7('0x3d')],'as':_0x63f7('0x3e')}]},_0x3d203c={};_0x3d203c[_0x63f7('0x44')]=_[_0x63f7('0x46')](db[_0x63f7('0x58')][_0x63f7('0x40')]);_0x3d203c['query']=_[_0x63f7('0x46')](_0x1383b4[_0x63f7('0x45')]);_0x3d203c['filters']=_[_0x63f7('0x47')](_0x3d203c['model'],_0x3d203c[_0x63f7('0x45')]);_0x3e04ea[_0x63f7('0x48')]=_[_0x63f7('0x47')](_0x3d203c[_0x63f7('0x44')],qs['fields'](_0x1383b4['query'][_0x63f7('0x49')]));_0x3e04ea[_0x63f7('0x48')]=_0x3e04ea[_0x63f7('0x48')][_0x63f7('0x59')]?_0x3e04ea[_0x63f7('0x48')]:_0x3d203c[_0x63f7('0x44')];if(_0x1383b4[_0x63f7('0x45')][_0x63f7('0x53')]){_0x3e04ea[_0x63f7('0x5a')]=[{'all':!![]}];}_0x3e04ea=_[_0x63f7('0x5b')]({},_0x3e04ea,_0x1383b4[_0x63f7('0x52')]);return db[_0x63f7('0x58')][_0x63f7('0x5c')](_0x3e04ea)[_0x63f7('0x25')](handleEntityNotFound(_0x48ff92,null))[_0x63f7('0x25')](respondWithResult(_0x48ff92,null))['catch'](handleError(_0x48ff92,null));};exports[_0x63f7('0x5d')]=function(_0x35e99f,_0xe07286){return db[_0x63f7('0x58')][_0x63f7('0x5d')](_0x35e99f[_0x63f7('0x5e')],{})[_0x63f7('0x25')](function(_0x3a1cbe){var _0x325b1e=_0x35e99f[_0x63f7('0x5f')]['get']({'plain':!![]});if(!_0x325b1e)throw new Error(_0x63f7('0x60'));if(_0x325b1e[_0x63f7('0x61')]===_0x63f7('0x5f')){var _0x442e25=_0x3a1cbe[_0x63f7('0x3a')]({'plain':!![]});var _0x459643='WhatsappAccounts';return db['UserProfileSection'][_0x63f7('0x5c')]({'where':{'name':_0x459643,'userProfileId':_0x325b1e[_0x63f7('0x62')]},'raw':!![]})[_0x63f7('0x25')](function(_0x524548){if(_0x524548&&_0x524548[_0x63f7('0x63')]===0x0){return db[_0x63f7('0x64')][_0x63f7('0x5d')]({'name':_0x442e25[_0x63f7('0x51')],'resourceId':_0x442e25['id'],'type':_0x524548[_0x63f7('0x51')],'sectionId':_0x524548['id']},{})['then'](function(){return _0x3a1cbe;});}else{return _0x3a1cbe;}})[_0x63f7('0x55')](function(_0x348fbe){logger[_0x63f7('0x2a')](_0x63f7('0x65'),_0x348fbe);throw _0x348fbe;});}return _0x3a1cbe;})['then'](respondWithResult(_0xe07286,0xc9))[_0x63f7('0x55')](handleError(_0xe07286,null));};exports['update']=function(_0x5a9fb5,_0x4c3fc1){if(_0x5a9fb5[_0x63f7('0x5e')]['id']){delete _0x5a9fb5[_0x63f7('0x5e')]['id'];}return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x5a9fb5[_0x63f7('0x57')]['id']},'include':[{'model':db[_0x63f7('0x3d')],'as':_0x63f7('0x3e')}]})[_0x63f7('0x25')](handleEntityNotFound(_0x4c3fc1,null))[_0x63f7('0x25')](saveUpdates(_0x5a9fb5[_0x63f7('0x5e')],null))['then'](respondWithResult(_0x4c3fc1,null))[_0x63f7('0x55')](handleError(_0x4c3fc1,null));};exports[_0x63f7('0x39')]=function(_0x225efe,_0x35a429){return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x225efe[_0x63f7('0x57')]['id']}})['then'](handleEntityNotFound(_0x35a429,null))['then'](removeEntity(_0x35a429,null))[_0x63f7('0x55')](handleError(_0x35a429,null));};exports[_0x63f7('0x66')]=function(_0x5066de,_0x4b5123){return db['WhatsappAccount'][_0x63f7('0x66')]()['then'](respondWithResult(_0x4b5123,null))[_0x63f7('0x55')](handleError(_0x4b5123,null));};exports[_0x63f7('0x67')]=function(_0x537bf8,_0x1f309c,_0x14202d){if(_0x537bf8['body']['id']){delete _0x537bf8['body']['id'];}return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x537bf8[_0x63f7('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f309c,null))['then'](function(_0x4863e5){if(_0x4863e5){_0x537bf8[_0x63f7('0x5e')][_0x63f7('0x68')]=_0x4863e5['id'];return db['Disposition'][_0x63f7('0x5d')](_0x537bf8[_0x63f7('0x5e')]);}})[_0x63f7('0x25')](respondWithResult(_0x1f309c,null))['catch'](handleError(_0x1f309c,null));};exports['getDispositions']=function(_0x5bd5d4,_0x42aec6,_0x228b53){var _0x5a046c={'raw':![],'where':{}};var _0x56e99d={};var _0x391f75={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5bd5d4[_0x63f7('0x57')]['id']}})[_0x63f7('0x25')](handleEntityNotFound(_0x42aec6,null))[_0x63f7('0x25')](function(_0x4479ea){if(_0x4479ea){_0x56e99d[_0x63f7('0x44')]=_['keys'](db[_0x63f7('0x69')][_0x63f7('0x40')]);_0x56e99d[_0x63f7('0x45')]=_[_0x63f7('0x46')](_0x5bd5d4[_0x63f7('0x45')]);_0x56e99d[_0x63f7('0x4e')]=_[_0x63f7('0x47')](_0x56e99d[_0x63f7('0x44')],_0x56e99d[_0x63f7('0x45')]);_0x5a046c[_0x63f7('0x48')]=_['intersection'](_0x56e99d['model'],qs[_0x63f7('0x49')](_0x5bd5d4['query'][_0x63f7('0x49')]));_0x5a046c[_0x63f7('0x48')]=_0x5a046c['attributes'][_0x63f7('0x59')]?_0x5a046c['attributes']:_0x56e99d[_0x63f7('0x44')];if(!_0x5bd5d4[_0x63f7('0x45')][_0x63f7('0x4a')](_0x63f7('0x6a'))){_0x5a046c[_0x63f7('0x32')]=qs[_0x63f7('0x32')](_0x5bd5d4[_0x63f7('0x45')][_0x63f7('0x32')]);_0x5a046c['offset']=qs['offset'](_0x5bd5d4[_0x63f7('0x45')][_0x63f7('0x31')]);}_0x5a046c['order']=qs['sort'](_0x5bd5d4[_0x63f7('0x45')][_0x63f7('0x4c')]);_0x5a046c[_0x63f7('0x4d')]=qs[_0x63f7('0x4e')](_[_0x63f7('0x4f')](_0x5bd5d4[_0x63f7('0x45')],_0x56e99d[_0x63f7('0x4e')]));_0x5a046c[_0x63f7('0x4d')][_0x63f7('0x68')]=_0x4479ea['id'];if(_0x5bd5d4['query'][_0x63f7('0x6b')]){_0x5a046c['where']=_[_0x63f7('0x5b')](_0x5a046c[_0x63f7('0x4d')],{'$or':_['map'](_0x5a046c[_0x63f7('0x48')],function(_0x5bbc95){var _0x1bc02d={};_0x1bc02d[_0x5bbc95]={'$like':'%'+_0x5bd5d4['query'][_0x63f7('0x6b')]+'%'};return _0x1bc02d;})});}_0x5a046c=_[_0x63f7('0x5b')]({},_0x5a046c,_0x5bd5d4[_0x63f7('0x52')]);return db['Disposition'][_0x63f7('0x34')]({'where':_0x5a046c[_0x63f7('0x4d')]})['then'](function(_0x44c8ca){_0x391f75[_0x63f7('0x34')]=_0x44c8ca;if(_0x5bd5d4[_0x63f7('0x45')][_0x63f7('0x53')]){_0x5a046c[_0x63f7('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x63f7('0x6c')](_0x5a046c);})['then'](function(_0x32fa8a){_0x391f75['rows']=_0x32fa8a;return _0x391f75;});}})[_0x63f7('0x25')](respondWithFilteredResult(_0x42aec6,_0x5a046c))[_0x63f7('0x55')](handleError(_0x42aec6,null));};exports[_0x63f7('0x6d')]=function(_0x391195,_0x498ea7,_0x372146){return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x391195[_0x63f7('0x57')]['id']}})[_0x63f7('0x25')](handleEntityNotFound(_0x498ea7,null))[_0x63f7('0x25')](function(_0x530208){if(_0x530208){return _0x530208[_0x63f7('0x6d')](_0x391195[_0x63f7('0x45')]['ids']);}})[_0x63f7('0x25')](respondWithStatusCode(_0x498ea7,null))['catch'](handleError(_0x498ea7,null));};exports['addAnswer']=function(_0x4d383a,_0x206a3a,_0x54c5ec){if(_0x4d383a[_0x63f7('0x5e')]['id']){delete _0x4d383a['body']['id'];}return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x4d383a[_0x63f7('0x57')]['id']}})[_0x63f7('0x25')](handleEntityNotFound(_0x206a3a,null))[_0x63f7('0x25')](function(_0x748292){if(_0x748292){_0x4d383a[_0x63f7('0x5e')]['WhatsappAccountId']=_0x748292['id'];return db['CannedAnswer'][_0x63f7('0x5d')](_0x4d383a[_0x63f7('0x5e')]);}})[_0x63f7('0x25')](respondWithResult(_0x206a3a,null))[_0x63f7('0x55')](handleError(_0x206a3a,null));};exports[_0x63f7('0x6e')]=function(_0x3d27f4,_0x4bf2c4,_0x12a955){var _0x156359={'raw':![],'where':{}};var _0xa25755={};var _0x59cc99={'count':0x0,'rows':[]};return db[_0x63f7('0x58')][_0x63f7('0x6f')]({'where':{'id':_0x3d27f4['params']['id']}})[_0x63f7('0x25')](handleEntityNotFound(_0x4bf2c4,null))[_0x63f7('0x25')](function(_0x18edc0){if(_0x18edc0){_0xa25755[_0x63f7('0x44')]=_[_0x63f7('0x46')](db[_0x63f7('0x70')]['rawAttributes']);_0xa25755[_0x63f7('0x45')]=_['keys'](_0x3d27f4['query']);_0xa25755[_0x63f7('0x4e')]=_[_0x63f7('0x47')](_0xa25755[_0x63f7('0x44')],_0xa25755['query']);_0x156359[_0x63f7('0x48')]=_['intersection'](_0xa25755['model'],qs[_0x63f7('0x49')](_0x3d27f4[_0x63f7('0x45')][_0x63f7('0x49')]));_0x156359['attributes']=_0x156359[_0x63f7('0x48')][_0x63f7('0x59')]?_0x156359[_0x63f7('0x48')]:_0xa25755[_0x63f7('0x44')];if(!_0x3d27f4[_0x63f7('0x45')]['hasOwnProperty'](_0x63f7('0x6a'))){_0x156359[_0x63f7('0x32')]=qs[_0x63f7('0x32')](_0x3d27f4[_0x63f7('0x45')][_0x63f7('0x32')]);_0x156359[_0x63f7('0x31')]=qs['offset'](_0x3d27f4[_0x63f7('0x45')]['offset']);}_0x156359['order']=qs[_0x63f7('0x4c')](_0x3d27f4[_0x63f7('0x45')][_0x63f7('0x4c')]);_0x156359[_0x63f7('0x4d')]=qs[_0x63f7('0x4e')](_['pick'](_0x3d27f4[_0x63f7('0x45')],_0xa25755['filters']));_0x156359['where'][_0x63f7('0x68')]=_0x18edc0['id'];if(_0x3d27f4[_0x63f7('0x45')][_0x63f7('0x6b')]){_0x156359['where']=_[_0x63f7('0x5b')](_0x156359[_0x63f7('0x4d')],{'$or':_['map'](_0x156359[_0x63f7('0x48')],function(_0x4e4c5c){var _0x51d002={};_0x51d002[_0x4e4c5c]={'$like':'%'+_0x3d27f4['query'][_0x63f7('0x6b')]+'%'};return _0x51d002;})});}_0x156359=_[_0x63f7('0x5b')]({},_0x156359,_0x3d27f4[_0x63f7('0x52')]);return db[_0x63f7('0x70')][_0x63f7('0x34')]({'where':_0x156359[_0x63f7('0x4d')]})[_0x63f7('0x25')](function(_0x593511){_0x59cc99[_0x63f7('0x34')]=_0x593511;if(_0x3d27f4[_0x63f7('0x45')][_0x63f7('0x53')]){_0x156359['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x63f7('0x6c')](_0x156359);})[_0x63f7('0x25')](function(_0x38fd8b){_0x59cc99[_0x63f7('0x54')]=_0x38fd8b;return _0x59cc99;});}})['then'](respondWithFilteredResult(_0x4bf2c4,_0x156359))[_0x63f7('0x55')](handleError(_0x4bf2c4,null));};exports['removeAnswers']=function(_0x290eae,_0x11c3d6,_0x160867){return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x290eae[_0x63f7('0x57')]['id']}})['then'](handleEntityNotFound(_0x11c3d6,null))[_0x63f7('0x25')](function(_0x2bf5cb){if(_0x2bf5cb){return _0x2bf5cb[_0x63f7('0x71')](_0x290eae[_0x63f7('0x45')][_0x63f7('0x72')]);}})[_0x63f7('0x25')](respondWithStatusCode(_0x11c3d6,null))[_0x63f7('0x55')](handleError(_0x11c3d6,null));};exports[_0x63f7('0x73')]=function(_0x12d293,_0x288b43,_0x2dfe68){return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x12d293['params']['id']}})[_0x63f7('0x25')](handleEntityNotFound(_0x288b43,null))['then'](function(_0x4b49fd){if(_0x4b49fd){return _0x4b49fd[_0x63f7('0x73')](_0x12d293['body'][_0x63f7('0x72')],_[_0x63f7('0x74')](_0x12d293[_0x63f7('0x5e')],[_0x63f7('0x72'),'id'])||{})[_0x63f7('0x75')](function(_0x72d9d3){for(var _0xff49f7=0x0;_0xff49f7<_0x12d293[_0x63f7('0x5e')][_0x63f7('0x72')]['length'];_0xff49f7+=0x1){socket[_0x63f7('0x76')](_0x63f7('0x77'),{'UserId':Number(_0x12d293[_0x63f7('0x5e')][_0x63f7('0x72')][_0xff49f7]),'WhatsappAccountId':Number(_0x12d293[_0x63f7('0x57')]['id'])});}return _0x72d9d3;});}})[_0x63f7('0x25')](respondWithResult(_0x288b43,null))['catch'](handleError(_0x288b43,null));};exports['removeAgents']=function(_0x585960,_0x4006a1,_0x44a647){return db['WhatsappAccount'][_0x63f7('0x5c')]({'where':{'id':_0x585960['params']['id']}})[_0x63f7('0x25')](handleEntityNotFound(_0x4006a1,null))[_0x63f7('0x25')](function(_0x23b2c4){if(_0x23b2c4){return _0x23b2c4[_0x63f7('0x78')](_0x585960['query'][_0x63f7('0x72')])[_0x63f7('0x25')](function(){if(_[_0x63f7('0x79')](_0x585960[_0x63f7('0x45')][_0x63f7('0x72')])){for(var _0x4219f0=0x0;_0x4219f0<_0x585960[_0x63f7('0x45')][_0x63f7('0x72')][_0x63f7('0x59')];_0x4219f0+=0x1){socket[_0x63f7('0x76')](_0x63f7('0x7a'),{'UserId':Number(_0x585960[_0x63f7('0x45')]['ids'][_0x4219f0]),'WhatsappAccountId':Number(_0x585960[_0x63f7('0x57')]['id'])});}}else{socket[_0x63f7('0x76')](_0x63f7('0x7a'),{'UserId':Number(_0x585960[_0x63f7('0x45')][_0x63f7('0x72')]),'WhatsappAccountId':Number(_0x585960[_0x63f7('0x57')]['id'])});}});}})[_0x63f7('0x25')](respondWithStatusCode(_0x4006a1,null))['catch'](handleError(_0x4006a1,null));};exports['getAgents']=function(_0x394c95,_0x49681f,_0x29874c){var _0x3bad95={};var _0x5d87be={};var _0x520785;var _0xe00066;return db[_0x63f7('0x58')][_0x63f7('0x6f')]({'where':{'id':_0x394c95[_0x63f7('0x57')]['id']}})[_0x63f7('0x25')](handleEntityNotFound(_0x49681f,null))[_0x63f7('0x25')](function(_0x29ac9f){if(_0x29ac9f){_0x520785=_0x29ac9f;_0x5d87be[_0x63f7('0x44')]=_['keys'](db['User'][_0x63f7('0x40')]);_0x5d87be[_0x63f7('0x45')]=_[_0x63f7('0x46')](_0x394c95[_0x63f7('0x45')]);_0x5d87be[_0x63f7('0x4e')]=_[_0x63f7('0x47')](_0x5d87be[_0x63f7('0x44')],_0x5d87be[_0x63f7('0x45')]);_0x3bad95[_0x63f7('0x48')]=_['intersection'](_0x5d87be['model'],qs[_0x63f7('0x49')](_0x394c95['query'][_0x63f7('0x49')]));_0x3bad95[_0x63f7('0x48')]=_0x3bad95[_0x63f7('0x48')]['length']?_0x3bad95[_0x63f7('0x48')]:_0x5d87be[_0x63f7('0x44')];_0x3bad95[_0x63f7('0x4b')]=qs[_0x63f7('0x4c')](_0x394c95['query'][_0x63f7('0x4c')]);_0x3bad95[_0x63f7('0x4d')]=qs['filters'](_['pick'](_0x394c95[_0x63f7('0x45')],_0x5d87be[_0x63f7('0x4e')]));if(_0x394c95[_0x63f7('0x45')]['filter']){_0x3bad95['where']=_[_0x63f7('0x5b')](_0x3bad95['where'],{'$or':_[_0x63f7('0x3f')](_0x3bad95['attributes'],function(_0x2baf29){var _0x3e26c1={};_0x3e26c1[_0x2baf29]={'$like':'%'+_0x394c95[_0x63f7('0x45')][_0x63f7('0x6b')]+'%'};return _0x3e26c1;})});}_0x3bad95=_['merge']({},_0x3bad95,_0x394c95[_0x63f7('0x52')]);return _0x520785[_0x63f7('0x7b')](_0x3bad95);}})[_0x63f7('0x25')](function(_0x2f7f36){if(_0x2f7f36){_0xe00066=_0x2f7f36[_0x63f7('0x59')];if(!_0x394c95[_0x63f7('0x45')][_0x63f7('0x4a')](_0x63f7('0x6a'))){_0x3bad95['limit']=qs[_0x63f7('0x32')](_0x394c95['query'][_0x63f7('0x32')]);_0x3bad95[_0x63f7('0x31')]=qs[_0x63f7('0x31')](_0x394c95['query']['offset']);}return _0x520785[_0x63f7('0x7b')](_0x3bad95);}})['then'](function(_0x44752f){if(_0x44752f){return _0x44752f?{'count':_0xe00066,'rows':_0x44752f}:null;}})['then'](respondWithResult(_0x49681f,null))[_0x63f7('0x55')](handleError(_0x49681f,null));};exports['addApplications']=function(_0x2c22bc,_0x5ac3d1){var _0x1f19f1=_0x2c22bc[_0x63f7('0x57')]['id'];var _0x393d30=_0x2c22bc[_0x63f7('0x5e')];var _0x2a3c20=0xc8;var _0x1cb930=null;return db[_0x63f7('0x7c')][_0x63f7('0x7d')]({'isolationLevel':db[_0x63f7('0x7c')][_0x63f7('0x7e')][_0x63f7('0x7f')][_0x63f7('0x80')]},function(_0xdacf0a){return db[_0x63f7('0x58')][_0x63f7('0x6f')]({'where':{'id':_0x1f19f1},'transaction':_0xdacf0a})['then'](function(_0x25020f){if(_0x25020f){return db[_0x63f7('0x81')]['destroy']({'where':{'WhatsappAccountId':_0x1f19f1},'transaction':_0xdacf0a})['then'](function(){var _0x8a1d6c=_[_0x63f7('0x3f')](_0x393d30,function(_0x2272aa){_0x2272aa[_0x63f7('0x68')]=_0x1f19f1;return _0x2272aa;});return db[_0x63f7('0x81')]['bulkCreate'](_0x8a1d6c,{'transaction':_0xdacf0a});});}else{_0x2a3c20=0x194;_0x1cb930=[];}});})['then'](function(){if(_0x2a3c20!==0x194){return db[_0x63f7('0x81')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x1f19f1},'order':_0x63f7('0x82')})[_0x63f7('0x25')](function(_0x59fb8d){_0x1cb930=_0x59fb8d;});}})[_0x63f7('0x55')](function(_0x415693){_0x2a3c20=0x1f4;logger['error'](_0x415693[_0x63f7('0x3c')]);if(_0x415693[_0x63f7('0x51')]){delete _0x415693[_0x63f7('0x51')];}_0x1cb930=_0x415693;})['finally'](function(){if(_0x1cb930===null){_0x5ac3d1[_0x63f7('0x2e')](_0x2a3c20);}else{if(_0x2a3c20===0x1f4){_0x5ac3d1['status'](_0x2a3c20)[_0x63f7('0x83')](_0x1cb930);}else{_0x5ac3d1[_0x63f7('0x2f')](_0x2a3c20)[_0x63f7('0x36')](_0x1cb930);}}});};exports[_0x63f7('0x84')]=function(_0xdd545,_0x44ac53,_0x5946a9){var _0x1ecd8a={};var _0x3fb6a9={};var _0x1e589a;var _0x211d91;return db[_0x63f7('0x58')][_0x63f7('0x6f')]({'where':{'id':_0xdd545[_0x63f7('0x57')]['id']}})[_0x63f7('0x25')](handleEntityNotFound(_0x44ac53,null))['then'](function(_0x378266){if(_0x378266){_0x1e589a=_0x378266;_0x3fb6a9[_0x63f7('0x44')]=_[_0x63f7('0x46')](db[_0x63f7('0x81')]['rawAttributes']);_0x3fb6a9[_0x63f7('0x45')]=_['keys'](_0xdd545[_0x63f7('0x45')]);_0x3fb6a9['filters']=_[_0x63f7('0x47')](_0x3fb6a9[_0x63f7('0x44')],_0x3fb6a9[_0x63f7('0x45')]);_0x1ecd8a['attributes']=_[_0x63f7('0x47')](_0x3fb6a9[_0x63f7('0x44')],qs['fields'](_0xdd545[_0x63f7('0x45')]['fields']));_0x1ecd8a[_0x63f7('0x48')]=_0x1ecd8a[_0x63f7('0x48')][_0x63f7('0x59')]?_0x1ecd8a[_0x63f7('0x48')]:_0x3fb6a9[_0x63f7('0x44')];_0x1ecd8a[_0x63f7('0x4b')]=qs[_0x63f7('0x4c')](_0xdd545[_0x63f7('0x45')][_0x63f7('0x4c')]);_0x1ecd8a[_0x63f7('0x4d')]=qs[_0x63f7('0x4e')](_[_0x63f7('0x4f')](_0xdd545['query'],_0x3fb6a9[_0x63f7('0x4e')]));if(_0xdd545[_0x63f7('0x45')]['filter']){_0x1ecd8a[_0x63f7('0x4d')]=_['merge'](_0x1ecd8a[_0x63f7('0x4d')],{'$or':_[_0x63f7('0x3f')](_0x1ecd8a[_0x63f7('0x48')],function(_0x38d11a){var _0x486a9d={};_0x486a9d[_0x38d11a]={'$like':'%'+_0xdd545['query'][_0x63f7('0x6b')]+'%'};return _0x486a9d;})});}_0x1ecd8a=_['merge']({},_0x1ecd8a,_0xdd545[_0x63f7('0x52')]);return _0x1e589a[_0x63f7('0x84')](_0x1ecd8a);}})['then'](function(_0x3d67a5){if(_0x3d67a5){_0x211d91=_0x3d67a5[_0x63f7('0x59')];if(!_0xdd545['query'][_0x63f7('0x4a')](_0x63f7('0x6a'))){_0x1ecd8a[_0x63f7('0x32')]=qs[_0x63f7('0x32')](_0xdd545['query'][_0x63f7('0x32')]);_0x1ecd8a[_0x63f7('0x31')]=qs['offset'](_0xdd545[_0x63f7('0x45')][_0x63f7('0x31')]);}return _0x1e589a[_0x63f7('0x84')](_0x1ecd8a);}})['then'](function(_0x21954f){if(_0x21954f){return _0x21954f?{'count':_0x211d91,'rows':_0x21954f}:null;}})['then'](respondWithResult(_0x44ac53,null))['catch'](handleError(_0x44ac53,null));};exports['notify']=function(_0x6899ce,_0x3f2253,_0x489f67){var _0x54ed33={'channel':'whatsapp'};var _0x2bcbdc=[];var _0xe0d51c=[];var _0xb57367={};return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x6899ce['params']['id']},'include':[{'model':db[_0x63f7('0x81')],'as':'Applications'}]})[_0x63f7('0x25')](handleEntityNotFound(_0x3f2253,null))[_0x63f7('0x25')](function(_0x7e0384){_0x54ed33[_0x63f7('0x85')]=_0x7e0384;if(_0x54ed33[_0x63f7('0x85')]&&_0x54ed33[_0x63f7('0x85')]['type']===_0x63f7('0x86')&&_0x6899ce[_0x63f7('0x5e')][_0x63f7('0x87')]){if(_0x6899ce[_0x63f7('0x5e')][_0x63f7('0x87')][_0x63f7('0x59')]===0x0)return;if(_0x6899ce['body'][_0x63f7('0x87')][0x0][_0x63f7('0x88')]!=='read')return;return db[_0x63f7('0x89')][_0x63f7('0x8a')]({'read':!![],'readAt':_0x6899ce[_0x63f7('0x5e')][_0x63f7('0x87')][0x0][_0x63f7('0x8b')]},{'where':{'messageId':_0x6899ce[_0x63f7('0x5e')]['statuses'][0x0][_0x63f7('0x8c')]},'individualHooks':!![]})[_0x63f7('0x25')](function(_0x43725f){return _0x3f2253[_0x63f7('0x2f')](0xc8)['json'](_0x43725f);});}_0x54ed33['applications']=_[_0x63f7('0x8d')](_0x7e0384[_0x63f7('0x8e')],['priority'],[_0x63f7('0x8f')]);if(_0x54ed33[_0x63f7('0x85')][_0x63f7('0x8e')]){delete _0x54ed33[_0x63f7('0x85')][_0x63f7('0x8e')];}return db['CmContact']['describe']()[_0x63f7('0x25')](function(_0x592447){if(!_0x592447){throw new db[(_0x63f7('0x90'))][(_0x63f7('0x91'))](_0x63f7('0x92'));}_0x2bcbdc=_[_0x63f7('0x93')](_['keys'](_0x592447),[_0x63f7('0x94'),_0x63f7('0x95')]);_0xe0d51c=_[_0x63f7('0x93')](_['keys'](_0x592447),[_0x63f7('0x94'),_0x63f7('0x95'),_0x63f7('0x96'),_0x63f7('0x97')]);_0x54ed33[_0x63f7('0x5e')]={'mapKey':_0x63f7('0x98')};if(_0x54ed33[_0x63f7('0x85')]&&_0x54ed33[_0x63f7('0x85')][_0x63f7('0x42')]===_0x63f7('0x99')){_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x9a')]=_0x6899ce[_0x63f7('0x5e')][_0x63f7('0x9b')][_0x63f7('0x9c')](_0x63f7('0x9d'),'');_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x5e')]=_0x6899ce[_0x63f7('0x5e')]['Body'];_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x9e')]=_0x6899ce['body']['MessageSid'];}if(_0x54ed33[_0x63f7('0x85')]&&_0x54ed33[_0x63f7('0x85')][_0x63f7('0x42')]==='sinch'){_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x9a')]=_0x6899ce[_0x63f7('0x5e')][_0x63f7('0x9f')][0x0][_0x63f7('0x9a')];_0x54ed33[_0x63f7('0x5e')]['body']=_0x6899ce['body']['notifications'][0x0][_0x63f7('0x2c')]['body'];_0x54ed33[_0x63f7('0x5e')]['messageId']=_0x6899ce[_0x63f7('0x5e')][_0x63f7('0x9f')][0x0][_0x63f7('0x8c')];}if(_0x54ed33['body']['id']){delete _0x54ed33['body']['id'];}if(_[_0x63f7('0xa0')](_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x9a')])){throw new db['Sequelize'][(_0x63f7('0x91'))]('from\x20is\x20mandatory');}if(_[_0x63f7('0xa0')](_0x54ed33[_0x63f7('0x5e')]['body'])||_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x5e')]===''){throw new db[(_0x63f7('0x90'))][(_0x63f7('0x91'))](_0x63f7('0xa1'));}if(_['isNil'](_0x54ed33[_0x63f7('0x5e')][_0x63f7('0xa2')])){throw new db[(_0x63f7('0x90'))][(_0x63f7('0x91'))](_0x63f7('0xa3')+_0xe0d51c);}if(!_[_0x63f7('0xa4')](_0xe0d51c,_0x54ed33['body'][_0x63f7('0xa2')])){throw new db[(_0x63f7('0x90'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe0d51c);}_0xb57367[_0x54ed33[_0x63f7('0x5e')][_0x63f7('0xa2')]]=_0x54ed33['body'][_0x63f7('0x9a')];return db[_0x63f7('0xa5')]['find']({'where':{'id':_0x54ed33[_0x63f7('0x85')][_0x63f7('0x97')]},'include':[{'model':db[_0x63f7('0xa6')],'as':_0x63f7('0xa7'),'where':_0xb57367,'limit':0x1,'order':[[_0x63f7('0x95'),_0x63f7('0xa8')]]}]});})[_0x63f7('0x25')](handleEntityNotFound(_0x3f2253,null))['then'](function(_0x1f59a9){if(_0x1f59a9){_0x54ed33[_0x63f7('0xa9')]=_[_0x63f7('0x74')](_0x1f59a9,[_0x63f7('0xa7')]);if(_0x1f59a9[_0x63f7('0xa7')][_0x63f7('0x59')]){return _0x1f59a9[_0x63f7('0xa7')][0x0];}var _0x10aa6c=_[_0x63f7('0x1d')](_0x54ed33[_0x63f7('0x5e')],{'firstName':_0x54ed33['body'][_0x63f7('0x9a')],'ListId':_0x1f59a9['id']});_0x10aa6c[_0x54ed33[_0x63f7('0x5e')][_0x63f7('0xa2')]]=_0x54ed33['body']['from'];return db['CmContact'][_0x63f7('0x5d')](_0x10aa6c,{'fields':_0x2bcbdc,'raw':!![]});}})[_0x63f7('0x25')](handleEntityNotFound(_0x3f2253,null))['then'](function(_0xf79508){if(_0xf79508){_0x54ed33[_0x63f7('0xaa')]=_0xf79508;var _0x258881={'ContactId':_0xf79508['id'],'phone':_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x9a')],'WhatsappAccountId':_0x6899ce[_0x63f7('0x57')]['id']};var _0x3b2962={'ContactId':_0xf79508['id'],'WhatsappAccountId':_0x6899ce[_0x63f7('0x57')]['id'],'closed':![]};return db[_0x63f7('0xab')][_0x63f7('0x5c')]({'where':_0x3b2962})[_0x63f7('0x25')](function(_0x33b13f){if(_0x33b13f){return[_0x33b13f,![]];}return db[_0x63f7('0xab')][_0x63f7('0x5d')](_0x258881)[_0x63f7('0x25')](function(_0x148ed8){return[_0x148ed8,!![]];});});}})[_0x63f7('0x75')](function(_0x3e401e,_0x420924){_0x54ed33[_0x63f7('0xac')]=_0x3e401e[_0x63f7('0x3a')]({'plain':!![]});_0x54ed33['interaction'][_0x63f7('0xad')]=![];if(_0x420924){if(_0x54ed33[_0x63f7('0x85')][_0x63f7('0xae')]){_0x54ed33[_0x63f7('0xaf')][_0x63f7('0xb0')]({'id':0x0,'priority':_0x54ed33[_0x63f7('0xaf')][_0x63f7('0x59')]+0x1,'app':_0x63f7('0xb1'),'appdata':_0x63f7('0xb2'),'interval':_0x63f7('0xb3')});}_0x54ed33[_0x63f7('0xac')]['created']=!![];}return db['WhatsappMessage'][_0x63f7('0x5d')]({'phone':_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x9a')],'messageId':_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x9e')],'body':_0x54ed33[_0x63f7('0x5e')][_0x63f7('0x5e')],'WhatsappAccountId':_0x6899ce[_0x63f7('0x57')]['id'],'WhatsappInteractionId':_0x3e401e['id'],'direction':'in','ContactId':_0x3e401e['ContactId'],'AttachmentId':_0x54ed33['body'][_0x63f7('0xb4')]});})[_0x63f7('0x25')](function(_0x56396a){_0x54ed33['message']=_0x56396a;if(!_0x54ed33[_0x63f7('0xac')][_0x63f7('0xb5')])return;return db['User'][_0x63f7('0x5c')]({'attributes':['id',_0x63f7('0x51')],'where':{'id':_0x54ed33['interaction'][_0x63f7('0xb5')]}});})['then'](function(_0x1c330b){if(_0x1c330b){_0x54ed33[_0x63f7('0xaf')][_0x63f7('0xb6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1c330b[_0x63f7('0x51')]+','+(_0x54ed33[_0x63f7('0x85')][_0x63f7('0xb7')]||0xa),'interval':_0x63f7('0xb3')});}if(!_0x54ed33['interaction'][_0x63f7('0xb8')])return;return db[_0x63f7('0xb9')][_0x63f7('0x5c')]({'attributes':['id',_0x63f7('0x51')],'where':{'id':_0x54ed33[_0x63f7('0xac')][_0x63f7('0xb8')]}});})[_0x63f7('0x25')](function(_0x3f08a0){if(_0x3f08a0){_0x54ed33[_0x63f7('0xaf')][_0x63f7('0xb6')]({'id':0x0,'priority':0x1,'app':_0x63f7('0xba'),'appdata':_0x3f08a0[_0x63f7('0x51')]+','+(_0x54ed33[_0x63f7('0x85')][_0x63f7('0xbb')]||0x12c),'interval':_0x63f7('0xb3')});}return respondWithRpcPromise(_0x63f7('0xbc'),'startRouting',_0x54ed33);})['then'](function(_0x3d11f8){if(_0x3d11f8){var _0x2e425f=0xc8;var _0x57f30e=_0x63f7('0xbd');logger[_0x63f7('0x26')](_0x63f7('0xbe'),_0x57f30e,_0x2e425f,_0x63f7('0xbf'));logger[_0x63f7('0x29')](_0x63f7('0xc0'),_0x57f30e,_0x2e425f,_0x63f7('0xbf'),JSON[_0x63f7('0xc1')](_0x3d11f8));if(_0x54ed33['account'][_0x63f7('0x42')]===_0x63f7('0x99')){return _0x3f2253[_0x63f7('0x2f')](_0x2e425f)['set'](_0x63f7('0xc2'),_0x63f7('0xc3'))[_0x63f7('0x83')]('\x0a');}else{return _0x3f2253[_0x63f7('0x2f')](_0x2e425f)[_0x63f7('0x36')](_0x3d11f8);}}});})['catch'](handleError(_0x3f2253,null));};exports[_0x63f7('0x83')]=function(_0x28cc5a,_0xa46256,_0x34f264){var _0x9b8c1b,_0x31bd62,_0x14f405;if(_['isNil'](_0x28cc5a[_0x63f7('0x5e')][_0x63f7('0x5e')])||_0x28cc5a['body'][_0x63f7('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0x63f7('0xa1'));}if(_[_0x63f7('0xa0')](_0x28cc5a['body']['to'])){throw new db[(_0x63f7('0x90'))][(_0x63f7('0x91'))](_0x63f7('0xc4'));}_0x9b8c1b=_0x28cc5a[_0x63f7('0x5e')]['to'];return db[_0x63f7('0x58')][_0x63f7('0x5c')]({'where':{'id':_0x28cc5a['params']['id']},'include':[{'model':db[_0x63f7('0xa5')],'as':_0x63f7('0xc5'),'include':[{'model':db[_0x63f7('0xa6')],'as':_0x63f7('0xa7'),'where':{'mobile':_0x9b8c1b},'limit':0x1,'order':[[_0x63f7('0x95'),_0x63f7('0xa8')]]}]}]})['then'](handleEntityNotFound(_0xa46256,null))[_0x63f7('0x25')](function(_0x40ede4){if(_0x40ede4&&_0x40ede4[_0x63f7('0xc5')]){_0x31bd62=_0x40ede4['get']({'plain':!![]});if(_0x31bd62['List']&&_0x31bd62[_0x63f7('0xc5')][_0x63f7('0xa7')]['length']){return _0x31bd62[_0x63f7('0xc5')][_0x63f7('0xa7')][0x0];}return db[_0x63f7('0xa6')][_0x63f7('0x5d')](_[_0x63f7('0x1d')](_0x28cc5a[_0x63f7('0x5e')],{'firstName':_0x9b8c1b,'mobile':_0x9b8c1b,'phone':_0x9b8c1b,'ListId':_0x31bd62[_0x63f7('0x97')]}));}})[_0x63f7('0x25')](handleEntityNotFound(_0xa46256,null))[_0x63f7('0x25')](function(_0x4fc4c1){if(_0x4fc4c1){_0x14f405=_0x4fc4c1;return db[_0x63f7('0xab')]['find']({'where':{'ContactId':_0x14f405['id'],'closed':![],'WhatsappAccountId':_0x31bd62['id']}})[_0x63f7('0x25')](function(_0x40a421){if(_0x40a421){return[_0x40a421,![]];}return db[_0x63f7('0xab')][_0x63f7('0x5d')]({'UserId':_0x28cc5a[_0x63f7('0x5f')]['id'],'ContactId':_0x14f405['id'],'WhatsappAccountId':_0x31bd62['id'],'phone':_0x9b8c1b,'firstMsgDirection':_0x63f7('0xc6'),'Messages':[_['merge'](_0x28cc5a['body'],{'read':![],'body':_0x28cc5a[_0x63f7('0x5e')]['body'],'phone':_0x9b8c1b,'WhatsappAccountId':_0x31bd62['id'],'UserId':_0x28cc5a[_0x63f7('0x5f')]['id'],'ContactId':_0x14f405['id']})]},{'include':[{'model':db[_0x63f7('0x89')],'as':_0x63f7('0xc7')}]})[_0x63f7('0x25')](function(_0x3041ec){return[_0x3041ec,!![]];});});}})[_0x63f7('0x75')](function(_0x5cca6f,_0x2a5432){if(_0x2a5432){return _0x5cca6f;}return db[_0x63f7('0x89')][_0x63f7('0x5d')](_['merge'](_0x28cc5a[_0x63f7('0x5e')],{'read':![],'body':_0x28cc5a['body']['body'],'phone':_0x9b8c1b,'WhatsappAccountId':_0x31bd62['id'],'WhatsappInteractionId':_0x5cca6f['id'],'UserId':_0x28cc5a['user']['id'],'ContactId':_0x14f405['id']}))['then'](function(_0x544d0a){_0x5cca6f['dataValues'][_0x63f7('0xc7')]=[];_0x5cca6f[_0x63f7('0xc8')][_0x63f7('0xc7')][_0x63f7('0xb0')](_0x544d0a[_0x63f7('0xc8')]);return _0x5cca6f;});})[_0x63f7('0x25')](respondWithResult(_0xa46256,null))[_0x63f7('0x55')](handleError(_0xa46256,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 808d6e9..c56e697 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2559=['events','../../mysqldb','WhatsappAccount','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x38b7f4,_0x106e6c){var _0x310132=function(_0x22d14c){while(--_0x22d14c){_0x38b7f4['push'](_0x38b7f4['shift']());}};_0x310132(++_0x106e6c);}(_0x2559,0x1a7));var _0x9255=function(_0x565382,_0x1b8fde){_0x565382=_0x565382-0x0;var _0x36a5f8=_0x2559[_0x565382];return _0x36a5f8;};'use strict';var EventEmitter=require(_0x9255('0x0'));var WhatsappAccount=require(_0x9255('0x1'))['db'][_0x9255('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9255('0x3'),'afterUpdate':'update','afterDestroy':_0x9255('0x4')};function emitEvent(_0x5cb607){return function(_0x3f9be1,_0xc18360,_0x4014b8){WhatsappAccountEvents[_0x9255('0x5')](_0x5cb607+':'+_0x3f9be1['id'],_0x3f9be1);WhatsappAccountEvents[_0x9255('0x5')](_0x5cb607,_0x3f9be1);_0x4014b8(null);};}for(var e in events){if(events[_0x9255('0x6')](e)){var event=events[e];WhatsappAccount[_0x9255('0x7')](e,emitEvent(event));}}module[_0x9255('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x85e8=['exports','events','save','update','emit','hasOwnProperty'];(function(_0x1db92d,_0x1d0ed2){var _0x19be36=function(_0x426c94){while(--_0x426c94){_0x1db92d['push'](_0x1db92d['shift']());}};_0x19be36(++_0x1d0ed2);}(_0x85e8,0x103));var _0x885e=function(_0x59790c,_0x3f21a9){_0x59790c=_0x59790c-0x0;var _0x58ae3a=_0x85e8[_0x59790c];return _0x58ae3a;};'use strict';var EventEmitter=require(_0x885e('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x885e('0x1'),'afterUpdate':_0x885e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x411bb8){return function(_0x2b6afb,_0xde67,_0x5261b9){WhatsappAccountEvents[_0x885e('0x3')](_0x411bb8+':'+_0x2b6afb['id'],_0x2b6afb);WhatsappAccountEvents[_0x885e('0x3')](_0x411bb8,_0x2b6afb);_0x5261b9(null);};}for(var e in events){if(events[_0x885e('0x4')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x885e('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f6646cb..52c8c57 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x842e=['rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','util','moment','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x842e,0x162));var _0xe842=function(_0x17044c,_0x208790){_0x17044c=_0x17044c-0x0;var _0x5e6db0=_0x842e[_0x17044c];return _0x5e6db0;};'use strict';var _=require('lodash');var util=require(_0xe842('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe842('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe842('0x2'));var rimraf=require(_0xe842('0x3'));var config=require('../../config/environment');var attributes=require(_0xe842('0x4'));module[_0xe842('0x5')]=function(_0xa19d2d,_0x222a8d){return _0xa19d2d['define'](_0xe842('0x6'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bd4=['./whatsappAccount.attributes','exports','WhatsappAccount','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1bd4,0x1bb));var _0x41bd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41bd('0x0'))(_0x41bd('0x1'));var moment=require(_0x41bd('0x2'));var BPromise=require(_0x41bd('0x3'));var rp=require(_0x41bd('0x4'));var fs=require('fs');var path=require(_0x41bd('0x5'));var rimraf=require(_0x41bd('0x6'));var config=require(_0x41bd('0x7'));var attributes=require(_0x41bd('0x8'));module[_0x41bd('0x9')]=function(_0x3f4419,_0x302c5d){return _0x3f4419['define'](_0x41bd('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 0adeb58..b8dec1f 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4487=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','catch','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x367614,_0xc4d2a4){var _0x581c40=function(_0x33d37b){while(--_0x33d37b){_0x367614['push'](_0x367614['shift']());}};_0x581c40(++_0xc4d2a4);}(_0x4487,0x11b));var _0x7448=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x4487[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x7448('0x0'));var util=require('util');var moment=require(_0x7448('0x1'));var BPromise=require('bluebird');var rs=require(_0x7448('0x2'));var fs=require('fs');var Redis=require(_0x7448('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7448('0x4'));var logger=require(_0x7448('0x5'))(_0x7448('0x6'));var config=require(_0x7448('0x7'));var jayson=require(_0x7448('0x8'));var client=jayson[_0x7448('0x9')][_0x7448('0xa')]({'port':0x232a});config[_0x7448('0xb')]=_[_0x7448('0xc')](config[_0x7448('0xb')],{'host':_0x7448('0xd'),'port':0x18eb});var socket=require(_0x7448('0xe'))(new Redis(config[_0x7448('0xb')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x560aaf,_0x36a5d7,_0x5b00e8){return new BPromise(function(_0x453e6a,_0x45e22f){return client[_0x7448('0xf')](_0x560aaf,_0x5b00e8)[_0x7448('0x10')](function(_0xc227){logger[_0x7448('0x11')](_0x7448('0x12'),_0x36a5d7,'request\x20sent');logger['debug'](_0x7448('0x13'),_0x36a5d7,_0x7448('0x14'),JSON[_0x7448('0x15')](_0xc227));if(_0xc227[_0x7448('0x16')]){if(_0xc227[_0x7448('0x16')][_0x7448('0x17')]===0x1f4){logger[_0x7448('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x36a5d7,_0xc227[_0x7448('0x16')][_0x7448('0x18')]);return _0x45e22f(_0xc227[_0x7448('0x16')][_0x7448('0x18')]);}logger['error'](_0x7448('0x12'),_0x36a5d7,_0xc227[_0x7448('0x16')]['message']);return _0x453e6a(_0xc227[_0x7448('0x16')][_0x7448('0x18')]);}else{logger[_0x7448('0x11')](_0x7448('0x12'),_0x36a5d7,_0x7448('0x14'));_0x453e6a(_0xc227['result'][_0x7448('0x18')]);}})['catch'](function(_0x332bc3){logger[_0x7448('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x36a5d7,_0x332bc3);_0x45e22f(_0x332bc3);});});}exports[_0x7448('0x19')]=function(_0x287b92){var _0x3d6dd6=this;return new Promise(function(_0x373cee,_0x13ea1e){return db['WhatsappAccount'][_0x7448('0x1a')]({'raw':_0x287b92[_0x7448('0x1b')]?_0x287b92[_0x7448('0x1b')][_0x7448('0x1c')]===undefined?!![]:![]:!![],'where':_0x287b92[_0x7448('0x1b')]?_0x287b92[_0x7448('0x1b')][_0x7448('0x1d')]||null:null,'attributes':_0x287b92[_0x7448('0x1b')]?_0x287b92[_0x7448('0x1b')][_0x7448('0x1e')]||null:null,'include':_0x287b92[_0x7448('0x1b')]?_0x287b92[_0x7448('0x1b')][_0x7448('0x1f')]?_[_0x7448('0x20')](_0x287b92[_0x7448('0x1b')][_0x7448('0x1f')],function(_0x3cb68d){return{'model':db[_0x3cb68d[_0x7448('0x21')]],'as':_0x3cb68d['as'],'attributes':_0x3cb68d[_0x7448('0x1e')],'include':_0x3cb68d['include']?_[_0x7448('0x20')](_0x3cb68d[_0x7448('0x1f')],function(_0x81fc2a){return{'model':db[_0x81fc2a[_0x7448('0x21')]],'as':_0x81fc2a['as'],'attributes':_0x81fc2a[_0x7448('0x1e')],'include':_0x81fc2a[_0x7448('0x1f')]?_[_0x7448('0x20')](_0x81fc2a[_0x7448('0x1f')],function(_0xee8819){return{'model':db[_0xee8819[_0x7448('0x21')]],'as':_0xee8819['as'],'attributes':_0xee8819[_0x7448('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7448('0x10')](function(_0x5c5fd1){logger[_0x7448('0x11')]('ShowWhatsappAccount',_0x287b92);logger[_0x7448('0x22')](_0x7448('0x19'),_0x287b92,JSON['stringify'](_0x5c5fd1));_0x373cee(_0x5c5fd1);})[_0x7448('0x23')](function(_0x1a3075){logger['error'](_0x7448('0x19'),_0x1a3075['message'],_0x287b92);_0x13ea1e(_0x3d6dd6['error'](0x1f4,_0x1a3075[_0x7448('0x18')]));});});}; \ No newline at end of file +var _0x9e96=['./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis'];(function(_0x2452af,_0x162efb){var _0x387b91=function(_0x36e5f8){while(--_0x36e5f8){_0x2452af['push'](_0x2452af['shift']());}};_0x387b91(++_0x162efb);}(_0x9e96,0xa7));var _0x69e9=function(_0x987ab1,_0x38b3a0){_0x987ab1=_0x987ab1-0x0;var _0x5ace78=_0x9e96[_0x987ab1];return _0x5ace78;};'use strict';var _=require(_0x69e9('0x0'));var util=require(_0x69e9('0x1'));var moment=require(_0x69e9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69e9('0x3'));var db=require(_0x69e9('0x4'))['db'];var utils=require(_0x69e9('0x5'));var logger=require(_0x69e9('0x6'))(_0x69e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x69e9('0x8'));var client=jayson[_0x69e9('0x9')][_0x69e9('0xa')]({'port':0x232a});config['redis']=_[_0x69e9('0xb')](config[_0x69e9('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x69e9('0xd'))['register'](socket);function respondWithRpcPromise(_0x386afc,_0x465adf,_0x26c982){return new BPromise(function(_0x15e63f,_0x59206b){return client[_0x69e9('0xe')](_0x386afc,_0x26c982)[_0x69e9('0xf')](function(_0x9f4df6){logger[_0x69e9('0x10')](_0x69e9('0x11'),_0x465adf,_0x69e9('0x12'));logger[_0x69e9('0x13')](_0x69e9('0x14'),_0x465adf,_0x69e9('0x12'),JSON[_0x69e9('0x15')](_0x9f4df6));if(_0x9f4df6[_0x69e9('0x16')]){if(_0x9f4df6[_0x69e9('0x16')]['code']===0x1f4){logger['error'](_0x69e9('0x11'),_0x465adf,_0x9f4df6[_0x69e9('0x16')][_0x69e9('0x17')]);return _0x59206b(_0x9f4df6[_0x69e9('0x16')][_0x69e9('0x17')]);}logger[_0x69e9('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x465adf,_0x9f4df6['error']['message']);return _0x15e63f(_0x9f4df6[_0x69e9('0x16')][_0x69e9('0x17')]);}else{logger['info'](_0x69e9('0x11'),_0x465adf,_0x69e9('0x12'));_0x15e63f(_0x9f4df6[_0x69e9('0x18')]['message']);}})[_0x69e9('0x19')](function(_0x333413){logger[_0x69e9('0x16')](_0x69e9('0x11'),_0x465adf,_0x333413);_0x59206b(_0x333413);});});}exports['ShowWhatsappAccount']=function(_0x3d4204){var _0x527b14=this;return new Promise(function(_0x339091,_0x1405b1){return db[_0x69e9('0x1a')][_0x69e9('0x1b')]({'raw':_0x3d4204[_0x69e9('0x1c')]?_0x3d4204[_0x69e9('0x1c')][_0x69e9('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d4204[_0x69e9('0x1c')]?_0x3d4204[_0x69e9('0x1c')][_0x69e9('0x1e')]||null:null,'attributes':_0x3d4204[_0x69e9('0x1c')]?_0x3d4204['options'][_0x69e9('0x1f')]||null:null,'include':_0x3d4204[_0x69e9('0x1c')]?_0x3d4204[_0x69e9('0x1c')][_0x69e9('0x20')]?_[_0x69e9('0x21')](_0x3d4204[_0x69e9('0x1c')][_0x69e9('0x20')],function(_0x2445ff){return{'model':db[_0x2445ff[_0x69e9('0x22')]],'as':_0x2445ff['as'],'attributes':_0x2445ff[_0x69e9('0x1f')],'include':_0x2445ff['include']?_[_0x69e9('0x21')](_0x2445ff[_0x69e9('0x20')],function(_0x377f23){return{'model':db[_0x377f23['model']],'as':_0x377f23['as'],'attributes':_0x377f23[_0x69e9('0x1f')],'include':_0x377f23['include']?_['map'](_0x377f23[_0x69e9('0x20')],function(_0x22656b){return{'model':db[_0x22656b['model']],'as':_0x22656b['as'],'attributes':_0x22656b[_0x69e9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x69e9('0xf')](function(_0x279840){logger['info']('ShowWhatsappAccount',_0x3d4204);logger[_0x69e9('0x13')]('ShowWhatsappAccount',_0x3d4204,JSON[_0x69e9('0x15')](_0x279840));_0x339091(_0x279840);})[_0x69e9('0x19')](function(_0x291e4a){logger[_0x69e9('0x16')](_0x69e9('0x23'),_0x291e4a[_0x69e9('0x17')],_0x3d4204);_0x1405b1(_0x527b14[_0x69e9('0x16')](0x1f4,_0x291e4a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index c2a79f9..05188df 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x574b=['remove','update','emit','removeListener','register','length','save'];(function(_0x2d42c1,_0x3d647e){var _0xdba078=function(_0x1052ac){while(--_0x1052ac){_0x2d42c1['push'](_0x2d42c1['shift']());}};_0xdba078(++_0x3d647e);}(_0x574b,0x1db));var _0xb574=function(_0x319474,_0x539c8b){_0x319474=_0x319474-0x0;var _0x33bbc1=_0x574b[_0x319474];return _0x33bbc1;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xb574('0x0'),_0xb574('0x1'),_0xb574('0x2')];function createListener(_0x19833a,_0x4edc82){return function(_0x3f846a){_0x4edc82[_0xb574('0x3')](_0x19833a,_0x3f846a);};}function removeListener(_0x282212,_0x456f8b){return function(){WhatsappAccountEvents[_0xb574('0x4')](_0x282212,_0x456f8b);};}exports[_0xb574('0x5')]=function(_0x8b680f){for(var _0x401e96=0x0,_0x13a2a5=events[_0xb574('0x6')];_0x401e96<_0x13a2a5;_0x401e96++){var _0x37760a=events[_0x401e96];var _0x1d958f=createListener('whatsappAccount:'+_0x37760a,_0x8b680f);WhatsappAccountEvents['on'](_0x37760a,_0x1d958f);}}; \ No newline at end of file +var _0xc487=['remove','update','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x270c8d,_0x524eeb){var _0x5c74b0=function(_0x385a02){while(--_0x385a02){_0x270c8d['push'](_0x270c8d['shift']());}};_0x5c74b0(++_0x524eeb);}(_0xc487,0xce));var _0x7c48=function(_0x214f5d,_0x5d9652){_0x214f5d=_0x214f5d-0x0;var _0x98884e=_0xc487[_0x214f5d];return _0x98884e;};'use strict';var WhatsappAccountEvents=require(_0x7c48('0x0'));var events=[_0x7c48('0x1'),_0x7c48('0x2'),_0x7c48('0x3')];function createListener(_0x569f88,_0x2660c2){return function(_0x4ba77a){_0x2660c2[_0x7c48('0x4')](_0x569f88,_0x4ba77a);};}function removeListener(_0x1bbf85,_0x583b87){return function(){WhatsappAccountEvents[_0x7c48('0x5')](_0x1bbf85,_0x583b87);};}exports['register']=function(_0x3bf35c){for(var _0x249051=0x0,_0x57c66d=events[_0x7c48('0x6')];_0x249051<_0x57c66d;_0x249051++){var _0xbce8df=events[_0x249051];var _0x5c24cf=createListener(_0x7c48('0x7')+_0xbce8df,_0x3bf35c);WhatsappAccountEvents['on'](_0xbce8df,_0x5c24cf);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3a47772..f6b338e 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92b2=['index','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x92b2,0x129));var _0x292b=function(_0x29f730,_0x23d7ed){_0x29f730=_0x29f730-0x0;var _0x189806=_0x92b2[_0x29f730];return _0x189806;};'use strict';var multer=require('multer');var util=require(_0x292b('0x0'));var path=require('path');var timeout=require(_0x292b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x292b('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x292b('0x3'));var controller=require(_0x292b('0x4'));router[_0x292b('0x5')]('/',auth[_0x292b('0x6')](),controller[_0x292b('0x7')]);router[_0x292b('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x292b('0x8')]);router[_0x292b('0x9')]('/',auth[_0x292b('0x6')](),controller[_0x292b('0xa')]);router[_0x292b('0xb')]('/:id',auth[_0x292b('0x6')](),controller[_0x292b('0xc')]);router[_0x292b('0xd')]('/:id',auth[_0x292b('0x6')](),controller[_0x292b('0xe')]);module[_0x292b('0xf')]=router; \ No newline at end of file +var _0xe4b9=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3af84e,_0x5cfde8){var _0x5a7cc6=function(_0x80668b){while(--_0x80668b){_0x3af84e['push'](_0x3af84e['shift']());}};_0x5a7cc6(++_0x5cfde8);}(_0xe4b9,0x76));var _0x9e4b=function(_0x3fbbdf,_0x168c77){_0x3fbbdf=_0x3fbbdf-0x0;var _0x5677df=_0xe4b9[_0x3fbbdf];return _0x5677df;};'use strict';var multer=require('multer');var util=require(_0x9e4b('0x0'));var path=require(_0x9e4b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e4b('0x2')]();var fs_extra=require(_0x9e4b('0x3'));var auth=require(_0x9e4b('0x4'));var interaction=require(_0x9e4b('0x5'));var config=require(_0x9e4b('0x6'));var controller=require('./whatsappApplication.controller');router[_0x9e4b('0x7')]('/',auth[_0x9e4b('0x8')](),controller[_0x9e4b('0x9')]);router[_0x9e4b('0x7')](_0x9e4b('0xa'),auth['isAuthenticated'](),controller[_0x9e4b('0xb')]);router[_0x9e4b('0xc')]('/',auth['isAuthenticated'](),controller[_0x9e4b('0xd')]);router[_0x9e4b('0xe')]('/:id',auth[_0x9e4b('0x8')](),controller[_0x9e4b('0xf')]);router[_0x9e4b('0x10')](_0x9e4b('0xa'),auth[_0x9e4b('0x8')](),controller['destroy']);module[_0x9e4b('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ad11bf7..a512342 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc929=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc929,0x1e3));var _0x9c92=function(_0x51d054,_0x55106e){_0x51d054=_0x51d054-0x0;var _0x43d69a=_0xc929[_0x51d054];return _0x43d69a;};'use strict';var Sequelize=require(_0x9c92('0x0'));module[_0x9c92('0x1')]={'priority':{'type':Sequelize[_0x9c92('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9c92('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9c92('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9c92('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x17a9=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x28a899,_0x25bbd4){var _0x4379b2=function(_0x3c3097){while(--_0x3c3097){_0x28a899['push'](_0x28a899['shift']());}};_0x4379b2(++_0x25bbd4);}(_0x17a9,0xae));var _0x917a=function(_0x171e0a,_0x801e32){_0x171e0a=_0x171e0a-0x0;var _0x4cf06e=_0x17a9[_0x171e0a];return _0x4cf06e;};'use strict';var Sequelize=require(_0x917a('0x0'));module[_0x917a('0x1')]={'priority':{'type':Sequelize[_0x917a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x917a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x917a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x917a('0x3')],'defaultValue':_0x917a('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 6d40e05..1ba9be0 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b0e=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','WhatsappApplication','findAll','rows','catch','show','params','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x8b0e,0x166));var _0xe8b0=function(_0x4f3da4,_0x121375){_0x4f3da4=_0x4f3da4-0x0;var _0x1df1a1=_0x8b0e[_0x4f3da4];return _0x1df1a1;};'use strict';var emlformat=require(_0xe8b0('0x0'));var rimraf=require(_0xe8b0('0x1'));var zipdir=require(_0xe8b0('0x2'));var jsonpatch=require(_0xe8b0('0x3'));var rp=require(_0xe8b0('0x4'));var moment=require(_0xe8b0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe8b0('0x6'));var util=require('util');var path=require(_0xe8b0('0x7'));var sox=require(_0xe8b0('0x8'));var csv=require(_0xe8b0('0x9'));var ejs=require(_0xe8b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe8b0('0xb'));var _=require(_0xe8b0('0xc'));var squel=require(_0xe8b0('0xd'));var crypto=require(_0xe8b0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe8b0('0xf'));var toCsv=require(_0xe8b0('0x9'));var querystring=require(_0xe8b0('0x10'));var Papa=require(_0xe8b0('0x11'));var Redis=require(_0xe8b0('0x12'));var authService=require(_0xe8b0('0x13'));var qs=require(_0xe8b0('0x14'));var as=require(_0xe8b0('0x15'));var hardwareService=require(_0xe8b0('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe8b0('0x17'));var config=require(_0xe8b0('0x18'));var licenseUtil=require(_0xe8b0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8714fe,_0x41633d){_0x41633d=_0x41633d||0xcc;return function(_0x2469a2){if(_0x2469a2){return _0x8714fe[_0xe8b0('0x1a')](_0x41633d);}return _0x8714fe[_0xe8b0('0x1b')](_0x41633d)[_0xe8b0('0x1c')]();};}function respondWithResult(_0x27c633,_0x50da0c){_0x50da0c=_0x50da0c||0xc8;return function(_0x1b0368){if(_0x1b0368){return _0x27c633[_0xe8b0('0x1b')](_0x50da0c)[_0xe8b0('0x1d')](_0x1b0368);}};}function respondWithFilteredResult(_0x57ae6e,_0x1a78b4){return function(_0x55d9df){if(_0x55d9df){var _0x5bcc0b=typeof _0x1a78b4['offset']===_0xe8b0('0x1e')&&typeof _0x1a78b4[_0xe8b0('0x1f')]==='undefined';var _0x1a54e0=_0x55d9df[_0xe8b0('0x20')];var _0x1345b3=_0x5bcc0b?0x0:_0x1a78b4[_0xe8b0('0x21')];var _0x34f3b2=_0x5bcc0b?_0x55d9df[_0xe8b0('0x20')]:_0x1a78b4['offset']+_0x1a78b4['limit'];var _0x244412;if(_0x34f3b2>=_0x1a54e0){_0x34f3b2=_0x1a54e0;_0x244412=0xc8;}else{_0x244412=0xce;}_0x57ae6e[_0xe8b0('0x1b')](_0x244412);return _0x57ae6e[_0xe8b0('0x22')](_0xe8b0('0x23'),_0x1345b3+'-'+_0x34f3b2+'/'+_0x1a54e0)[_0xe8b0('0x1d')](_0x55d9df);}return null;};}function patchUpdates(_0x3d7711){return function(_0x2be40){try{jsonpatch[_0xe8b0('0x24')](_0x2be40,_0x3d7711,!![]);}catch(_0x45f5bf){return BPromise[_0xe8b0('0x25')](_0x45f5bf);}return _0x2be40[_0xe8b0('0x26')]();};}function saveUpdates(_0x4e6f22,_0x3a1c9d){return function(_0x30655d){if(_0x30655d){return _0x30655d[_0xe8b0('0x27')](_0x4e6f22)[_0xe8b0('0x28')](function(_0x52072e){return _0x52072e;});}return null;};}function removeEntity(_0x30ac12,_0x292f81){return function(_0x4d7a92){if(_0x4d7a92){return _0x4d7a92[_0xe8b0('0x29')]()[_0xe8b0('0x28')](function(){_0x30ac12[_0xe8b0('0x1b')](0xcc)[_0xe8b0('0x1c')]();});}};}function handleEntityNotFound(_0x58c536,_0x1bbd4e){return function(_0x317495){if(!_0x317495){_0x58c536[_0xe8b0('0x1a')](0x194);}return _0x317495;};}function handleError(_0x298d09,_0x1cd6b1){_0x1cd6b1=_0x1cd6b1||0x1f4;return function(_0x2ba170){logger[_0xe8b0('0x2a')](_0x2ba170[_0xe8b0('0x2b')]);if(_0x2ba170[_0xe8b0('0x2c')]){delete _0x2ba170[_0xe8b0('0x2c')];}_0x298d09[_0xe8b0('0x1b')](_0x1cd6b1)['send'](_0x2ba170);};}exports['index']=function(_0x21be91,_0x35b43d){var _0x1816e3={},_0x3d80d7={},_0xb5c5c6={'count':0x0,'rows':[]};var _0x54c3f9=_[_0xe8b0('0x2d')](db['WhatsappApplication'][_0xe8b0('0x2e')],function(_0x2e1e2c){return{'name':_0x2e1e2c[_0xe8b0('0x2f')],'type':_0x2e1e2c[_0xe8b0('0x30')]['key']};});_0x3d80d7[_0xe8b0('0x31')]=_[_0xe8b0('0x2d')](_0x54c3f9,_0xe8b0('0x2c'));_0x3d80d7[_0xe8b0('0x32')]=_[_0xe8b0('0x33')](_0x21be91['query']);_0x3d80d7[_0xe8b0('0x34')]=_['intersection'](_0x3d80d7[_0xe8b0('0x31')],_0x3d80d7[_0xe8b0('0x32')]);_0x1816e3[_0xe8b0('0x35')]=_[_0xe8b0('0x36')](_0x3d80d7['model'],qs[_0xe8b0('0x37')](_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x37')]));_0x1816e3[_0xe8b0('0x35')]=_0x1816e3[_0xe8b0('0x35')][_0xe8b0('0x38')]?_0x1816e3[_0xe8b0('0x35')]:_0x3d80d7[_0xe8b0('0x31')];if(!_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x39')](_0xe8b0('0x3a'))){_0x1816e3[_0xe8b0('0x1f')]=qs[_0xe8b0('0x1f')](_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x1f')]);_0x1816e3['offset']=qs[_0xe8b0('0x21')](_0x21be91[_0xe8b0('0x32')]['offset']);}_0x1816e3[_0xe8b0('0x3b')]=qs[_0xe8b0('0x3c')](_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x3c')]);_0x1816e3['where']=qs['filters'](_[_0xe8b0('0x3d')](_0x21be91['query'],_0x3d80d7[_0xe8b0('0x34')]),_0x54c3f9);if(_0x21be91[_0xe8b0('0x32')]['filter']){_0x1816e3[_0xe8b0('0x3e')]=_[_0xe8b0('0x3f')](_0x1816e3['where'],{'$or':_['map'](_0x54c3f9,function(_0x296d29){if(_0x296d29['type']!==_0xe8b0('0x40')){var _0x1a6af6={};_0x1a6af6[_0x296d29[_0xe8b0('0x2c')]]={'$like':'%'+_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x41')]+'%'};return _0x1a6af6;}})});}_0x1816e3=_[_0xe8b0('0x3f')]({},_0x1816e3,_0x21be91['options']);var _0x7a2ef2={'where':_0x1816e3[_0xe8b0('0x3e')]};return db['WhatsappApplication'][_0xe8b0('0x20')](_0x7a2ef2)[_0xe8b0('0x28')](function(_0x15f2d6){_0xb5c5c6[_0xe8b0('0x20')]=_0x15f2d6;if(_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x42')]){_0x1816e3[_0xe8b0('0x43')]=[{'all':!![]}];}return db[_0xe8b0('0x44')][_0xe8b0('0x45')](_0x1816e3);})['then'](function(_0x21650e){_0xb5c5c6[_0xe8b0('0x46')]=_0x21650e;return _0xb5c5c6;})[_0xe8b0('0x28')](respondWithFilteredResult(_0x35b43d,_0x1816e3))[_0xe8b0('0x47')](handleError(_0x35b43d,null));};exports[_0xe8b0('0x48')]=function(_0x4d2c10,_0x4d82b2){var _0x3513c1={'raw':!![],'where':{'id':_0x4d2c10[_0xe8b0('0x49')]['id']}},_0x271c4f={};_0x271c4f[_0xe8b0('0x31')]=_[_0xe8b0('0x33')](db[_0xe8b0('0x44')][_0xe8b0('0x2e')]);_0x271c4f[_0xe8b0('0x32')]=_['keys'](_0x4d2c10['query']);_0x271c4f[_0xe8b0('0x34')]=_[_0xe8b0('0x36')](_0x271c4f['model'],_0x271c4f[_0xe8b0('0x32')]);_0x3513c1['attributes']=_[_0xe8b0('0x36')](_0x271c4f[_0xe8b0('0x31')],qs[_0xe8b0('0x37')](_0x4d2c10['query'][_0xe8b0('0x37')]));_0x3513c1['attributes']=_0x3513c1['attributes'][_0xe8b0('0x38')]?_0x3513c1['attributes']:_0x271c4f[_0xe8b0('0x31')];if(_0x4d2c10['query']['includeAll']){_0x3513c1['include']=[{'all':!![]}];}_0x3513c1=_[_0xe8b0('0x3f')]({},_0x3513c1,_0x4d2c10[_0xe8b0('0x4a')]);return db[_0xe8b0('0x44')][_0xe8b0('0x4b')](_0x3513c1)[_0xe8b0('0x28')](handleEntityNotFound(_0x4d82b2,null))[_0xe8b0('0x28')](respondWithResult(_0x4d82b2,null))[_0xe8b0('0x47')](handleError(_0x4d82b2,null));};exports['create']=function(_0x794b34,_0x1f05f8){return db[_0xe8b0('0x44')]['create'](_0x794b34[_0xe8b0('0x4c')],{})['then'](respondWithResult(_0x1f05f8,0xc9))[_0xe8b0('0x47')](handleError(_0x1f05f8,null));};exports[_0xe8b0('0x27')]=function(_0x526d21,_0x2cb065){if(_0x526d21[_0xe8b0('0x4c')]['id']){delete _0x526d21[_0xe8b0('0x4c')]['id'];}return db[_0xe8b0('0x44')]['find']({'where':{'id':_0x526d21[_0xe8b0('0x49')]['id']}})[_0xe8b0('0x28')](handleEntityNotFound(_0x2cb065,null))[_0xe8b0('0x28')](saveUpdates(_0x526d21[_0xe8b0('0x4c')],null))['then'](respondWithResult(_0x2cb065,null))[_0xe8b0('0x47')](handleError(_0x2cb065,null));};exports['destroy']=function(_0x33b9e9,_0x4a7da9){return db[_0xe8b0('0x44')]['find']({'where':{'id':_0x33b9e9[_0xe8b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a7da9,null))['then'](removeEntity(_0x4a7da9,null))[_0xe8b0('0x47')](handleError(_0x4a7da9,null));}; \ No newline at end of file +var _0x6dc0=['../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','apply','reject','save','then','name','send','index','map','WhatsappApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x16670f,_0x31d975){var _0x2309bf=function(_0x46194e){while(--_0x46194e){_0x16670f['push'](_0x16670f['shift']());}};_0x2309bf(++_0x31d975);}(_0x6dc0,0xb6));var _0x06dc=function(_0x8a5e4a,_0x1739f3){_0x8a5e4a=_0x8a5e4a-0x0;var _0xe4bf9d=_0x6dc0[_0x8a5e4a];return _0xe4bf9d;};'use strict';var emlformat=require(_0x06dc('0x0'));var rimraf=require(_0x06dc('0x1'));var zipdir=require(_0x06dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06dc('0x3'));var moment=require(_0x06dc('0x4'));var BPromise=require(_0x06dc('0x5'));var Mustache=require(_0x06dc('0x6'));var util=require('util');var path=require(_0x06dc('0x7'));var sox=require(_0x06dc('0x8'));var csv=require('to-csv');var ejs=require(_0x06dc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06dc('0xa'));var squel=require(_0x06dc('0xb'));var crypto=require(_0x06dc('0xc'));var jsforce=require(_0x06dc('0xd'));var deskjs=require(_0x06dc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x06dc('0xf'));var authService=require(_0x06dc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06dc('0x11'));var hardwareService=require(_0x06dc('0x12'));var logger=require(_0x06dc('0x13'))(_0x06dc('0x14'));var utils=require('../../config/utils');var config=require(_0x06dc('0x15'));var licenseUtil=require(_0x06dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527806,_0x534c07){_0x534c07=_0x534c07||0xcc;return function(_0x4f086f){if(_0x4f086f){return _0x527806[_0x06dc('0x17')](_0x534c07);}return _0x527806['status'](_0x534c07)['end']();};}function respondWithResult(_0x4874ce,_0x196cfd){_0x196cfd=_0x196cfd||0xc8;return function(_0x47753d){if(_0x47753d){return _0x4874ce[_0x06dc('0x18')](_0x196cfd)['json'](_0x47753d);}};}function respondWithFilteredResult(_0x183302,_0x1d92c2){return function(_0x145a07){if(_0x145a07){var _0x3da2c5=typeof _0x1d92c2['offset']===_0x06dc('0x19')&&typeof _0x1d92c2[_0x06dc('0x1a')]===_0x06dc('0x19');var _0x2478b9=_0x145a07[_0x06dc('0x1b')];var _0x51df31=_0x3da2c5?0x0:_0x1d92c2[_0x06dc('0x1c')];var _0x1d6ec8=_0x3da2c5?_0x145a07[_0x06dc('0x1b')]:_0x1d92c2[_0x06dc('0x1c')]+_0x1d92c2[_0x06dc('0x1a')];var _0x152ed2;if(_0x1d6ec8>=_0x2478b9){_0x1d6ec8=_0x2478b9;_0x152ed2=0xc8;}else{_0x152ed2=0xce;}_0x183302['status'](_0x152ed2);return _0x183302['set'](_0x06dc('0x1d'),_0x51df31+'-'+_0x1d6ec8+'/'+_0x2478b9)['json'](_0x145a07);}return null;};}function patchUpdates(_0x21c8c3){return function(_0x5088f3){try{jsonpatch[_0x06dc('0x1e')](_0x5088f3,_0x21c8c3,!![]);}catch(_0x369c60){return BPromise[_0x06dc('0x1f')](_0x369c60);}return _0x5088f3[_0x06dc('0x20')]();};}function saveUpdates(_0x8aaf2,_0x427f39){return function(_0x577284){if(_0x577284){return _0x577284['update'](_0x8aaf2)[_0x06dc('0x21')](function(_0x426260){return _0x426260;});}return null;};}function removeEntity(_0x56c345,_0x95dab2){return function(_0x5eab9b){if(_0x5eab9b){return _0x5eab9b['destroy']()['then'](function(){_0x56c345['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3e42b,_0x5edc7b){return function(_0xfa043e){if(!_0xfa043e){_0xd3e42b['sendStatus'](0x194);}return _0xfa043e;};}function handleError(_0x52afcf,_0xa85ffc){_0xa85ffc=_0xa85ffc||0x1f4;return function(_0x26bbfe){logger['error'](_0x26bbfe['stack']);if(_0x26bbfe[_0x06dc('0x22')]){delete _0x26bbfe['name'];}_0x52afcf[_0x06dc('0x18')](_0xa85ffc)[_0x06dc('0x23')](_0x26bbfe);};}exports[_0x06dc('0x24')]=function(_0xfd5611,_0x1d98b8){var _0x31f5cd={},_0x164554={},_0x33ff4c={'count':0x0,'rows':[]};var _0x3f0e2d=_[_0x06dc('0x25')](db[_0x06dc('0x26')][_0x06dc('0x27')],function(_0x43e689){return{'name':_0x43e689['fieldName'],'type':_0x43e689['type'][_0x06dc('0x28')]};});_0x164554[_0x06dc('0x29')]=_[_0x06dc('0x25')](_0x3f0e2d,_0x06dc('0x22'));_0x164554[_0x06dc('0x2a')]=_[_0x06dc('0x2b')](_0xfd5611[_0x06dc('0x2a')]);_0x164554[_0x06dc('0x2c')]=_[_0x06dc('0x2d')](_0x164554[_0x06dc('0x29')],_0x164554['query']);_0x31f5cd[_0x06dc('0x2e')]=_[_0x06dc('0x2d')](_0x164554[_0x06dc('0x29')],qs[_0x06dc('0x2f')](_0xfd5611[_0x06dc('0x2a')]['fields']));_0x31f5cd[_0x06dc('0x2e')]=_0x31f5cd[_0x06dc('0x2e')][_0x06dc('0x30')]?_0x31f5cd['attributes']:_0x164554[_0x06dc('0x29')];if(!_0xfd5611[_0x06dc('0x2a')]['hasOwnProperty'](_0x06dc('0x31'))){_0x31f5cd[_0x06dc('0x1a')]=qs['limit'](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x1a')]);_0x31f5cd[_0x06dc('0x1c')]=qs[_0x06dc('0x1c')](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x1c')]);}_0x31f5cd[_0x06dc('0x32')]=qs[_0x06dc('0x33')](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x33')]);_0x31f5cd['where']=qs['filters'](_['pick'](_0xfd5611[_0x06dc('0x2a')],_0x164554[_0x06dc('0x2c')]),_0x3f0e2d);if(_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x34')]){_0x31f5cd['where']=_['merge'](_0x31f5cd[_0x06dc('0x35')],{'$or':_[_0x06dc('0x25')](_0x3f0e2d,function(_0xdc718a){if(_0xdc718a[_0x06dc('0x36')]!==_0x06dc('0x37')){var _0xe65d69={};_0xe65d69[_0xdc718a[_0x06dc('0x22')]]={'$like':'%'+_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x34')]+'%'};return _0xe65d69;}})});}_0x31f5cd=_[_0x06dc('0x38')]({},_0x31f5cd,_0xfd5611[_0x06dc('0x39')]);var _0x11e2f6={'where':_0x31f5cd[_0x06dc('0x35')]};return db[_0x06dc('0x26')][_0x06dc('0x1b')](_0x11e2f6)[_0x06dc('0x21')](function(_0x3e9434){_0x33ff4c[_0x06dc('0x1b')]=_0x3e9434;if(_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x3a')]){_0x31f5cd['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x06dc('0x3b')](_0x31f5cd);})[_0x06dc('0x21')](function(_0x4250fd){_0x33ff4c[_0x06dc('0x3c')]=_0x4250fd;return _0x33ff4c;})[_0x06dc('0x21')](respondWithFilteredResult(_0x1d98b8,_0x31f5cd))['catch'](handleError(_0x1d98b8,null));};exports[_0x06dc('0x3d')]=function(_0x37ec58,_0x64f6f3){var _0x59d4a0={'raw':!![],'where':{'id':_0x37ec58[_0x06dc('0x3e')]['id']}},_0x164684={};_0x164684['model']=_[_0x06dc('0x2b')](db[_0x06dc('0x26')][_0x06dc('0x27')]);_0x164684[_0x06dc('0x2a')]=_['keys'](_0x37ec58['query']);_0x164684[_0x06dc('0x2c')]=_[_0x06dc('0x2d')](_0x164684[_0x06dc('0x29')],_0x164684['query']);_0x59d4a0[_0x06dc('0x2e')]=_[_0x06dc('0x2d')](_0x164684[_0x06dc('0x29')],qs[_0x06dc('0x2f')](_0x37ec58[_0x06dc('0x2a')]['fields']));_0x59d4a0[_0x06dc('0x2e')]=_0x59d4a0['attributes']['length']?_0x59d4a0[_0x06dc('0x2e')]:_0x164684[_0x06dc('0x29')];if(_0x37ec58[_0x06dc('0x2a')][_0x06dc('0x3a')]){_0x59d4a0[_0x06dc('0x3f')]=[{'all':!![]}];}_0x59d4a0=_['merge']({},_0x59d4a0,_0x37ec58[_0x06dc('0x39')]);return db[_0x06dc('0x26')][_0x06dc('0x40')](_0x59d4a0)[_0x06dc('0x21')](handleEntityNotFound(_0x64f6f3,null))[_0x06dc('0x21')](respondWithResult(_0x64f6f3,null))[_0x06dc('0x41')](handleError(_0x64f6f3,null));};exports[_0x06dc('0x42')]=function(_0x6a5800,_0x1081a9){return db[_0x06dc('0x26')][_0x06dc('0x42')](_0x6a5800['body'],{})[_0x06dc('0x21')](respondWithResult(_0x1081a9,0xc9))[_0x06dc('0x41')](handleError(_0x1081a9,null));};exports['update']=function(_0xb9c6a2,_0x39e42a){if(_0xb9c6a2[_0x06dc('0x43')]['id']){delete _0xb9c6a2['body']['id'];}return db[_0x06dc('0x26')][_0x06dc('0x40')]({'where':{'id':_0xb9c6a2['params']['id']}})['then'](handleEntityNotFound(_0x39e42a,null))['then'](saveUpdates(_0xb9c6a2[_0x06dc('0x43')],null))[_0x06dc('0x21')](respondWithResult(_0x39e42a,null))[_0x06dc('0x41')](handleError(_0x39e42a,null));};exports['destroy']=function(_0x5dd2c2,_0x1d759b){return db[_0x06dc('0x26')][_0x06dc('0x40')]({'where':{'id':_0x5dd2c2[_0x06dc('0x3e')]['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x1d759b,null))['then'](removeEntity(_0x1d759b,null))[_0x06dc('0x41')](handleError(_0x1d759b,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f6f93e2..fb0e2ad 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a3a=['./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x480741,_0x46b497){var _0x59cb98=function(_0xc65dc2){while(--_0xc65dc2){_0x480741['push'](_0x480741['shift']());}};_0x59cb98(++_0x46b497);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x33cd2c,_0x2831af){_0x33cd2c=_0x33cd2c-0x0;var _0x2269ec=_0x2a3a[_0x33cd2c];return _0x2269ec;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa2a3('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x16cc=['path','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43e6f6,_0xb3bbf4){var _0x3ea02d=function(_0x237c8b){while(--_0x237c8b){_0x43e6f6['push'](_0x43e6f6['shift']());}};_0x3ea02d(++_0xb3bbf4);}(_0x16cc,0x120));var _0xc16c=function(_0xca6eed,_0x117e5d){_0xca6eed=_0xca6eed-0x0;var _0x597270=_0x16cc[_0xca6eed];return _0x597270;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var logger=require(_0xc16c('0x1'))(_0xc16c('0x2'));var moment=require(_0xc16c('0x3'));var BPromise=require(_0xc16c('0x4'));var rp=require(_0xc16c('0x5'));var fs=require('fs');var path=require(_0xc16c('0x6'));var rimraf=require('rimraf');var config=require(_0xc16c('0x7'));var attributes=require(_0xc16c('0x8'));module[_0xc16c('0x9')]=function(_0x1019ec,_0x5ea82b){return _0x1019ec[_0xc16c('0xa')]('WhatsappApplication',attributes,{'tableName':_0xc16c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc16c('0xc'),'collate':_0xc16c('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index aee3ab7..5d2bee8 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2f4d41,_0x525047){var _0x3b0bb2=function(_0x19960d){while(--_0x19960d){_0x2f4d41['push'](_0x2f4d41['shift']());}};_0x3b0bb2(++_0x525047);}(_0x2d17,0x17e));var _0x72d1=function(_0x41ea19,_0x3496d3){_0x41ea19=_0x41ea19-0x0;var _0x24ff3b=_0x2d17[_0x41ea19];return _0x24ff3b;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4442e4,_0x2b1156){var _0xf02812=function(_0x12df0c){while(--_0x12df0c){_0x4442e4['push'](_0x4442e4['shift']());}};_0xf02812(++_0x2b1156);}(_0x34e8,0x12c));var _0x834e=function(_0x4736ac,_0x1a3ac5){_0x4736ac=_0x4736ac-0x0;var _0x2fbc96=_0x34e8[_0x4736ac];return _0x2fbc96;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f626a0d..91d1720 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7278=['/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x231d55,_0x45d81d){var _0x30d374=function(_0x2f7853){while(--_0x2f7853){_0x231d55['push'](_0x231d55['shift']());}};_0x30d374(++_0x45d81d);}(_0x7278,0x161));var _0x8727=function(_0x1701ac,_0xf0ca5f){_0x1701ac=_0x1701ac-0x0;var _0x40ef41=_0x7278[_0x1701ac];return _0x40ef41;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8727('0xa')](_0x8727('0xe'),auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0xa')](_0x8727('0x10'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router['post']('/',auth[_0x8727('0xb')](),controller[_0x8727('0x12')]);router[_0x8727('0x13')]('/:id/messages',auth[_0x8727('0xb')](),controller[_0x8727('0x14')]);router['post'](_0x8727('0x15'),auth[_0x8727('0xb')](),interaction[_0x8727('0x16')](_0x8727('0x17'),_0x8727('0x18')),controller[_0x8727('0x19')]);router[_0x8727('0x1a')](_0x8727('0x1b'),auth[_0x8727('0xb')](),interaction[_0x8727('0x16')]('whatsapp',_0x8727('0x1c')),controller[_0x8727('0x1d')]);router[_0x8727('0x1e')](_0x8727('0x1b'),auth[_0x8727('0xb')](),interaction[_0x8727('0x16')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8727('0x1f')]);router['delete'](_0x8727('0x15'),auth[_0x8727('0xb')](),controller[_0x8727('0x20')]);module[_0x8727('0x21')]=router; \ No newline at end of file +var _0xfb65=['/:id/tags','tracked','addTags','put','whatsapp','update','delete','destroy','removeTags','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage'];(function(_0x204c5e,_0x24f5d5){var _0x23b4e3=function(_0x14cfdf){while(--_0x14cfdf){_0x204c5e['push'](_0x204c5e['shift']());}};_0x23b4e3(++_0x24f5d5);}(_0xfb65,0x82));var _0x5fb6=function(_0x3a335a,_0x401d39){_0x3a335a=_0x3a335a-0x0;var _0x512716=_0xfb65[_0x3a335a];return _0x512716;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var fs_extra=require(_0x5fb6('0x3'));var auth=require(_0x5fb6('0x4'));var interaction=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var controller=require(_0x5fb6('0x7'));router[_0x5fb6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5fb6('0x8')](_0x5fb6('0x9'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xb')]);router['get'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xd')]);router[_0x5fb6('0x8')]('/:id/messages',auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xe')]);router['get'](_0x5fb6('0xf'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0x10')]);router[_0x5fb6('0x11')]('/',auth[_0x5fb6('0xa')](),controller['create']);router[_0x5fb6('0x11')](_0x5fb6('0x12'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0x13')]);router[_0x5fb6('0x11')](_0x5fb6('0x14'),auth[_0x5fb6('0xa')](),interaction[_0x5fb6('0x15')]('whatsapp','whatsappinteraction:addtags'),controller[_0x5fb6('0x16')]);router[_0x5fb6('0x17')]('/:id',auth[_0x5fb6('0xa')](),interaction[_0x5fb6('0x15')](_0x5fb6('0x18'),'whatsappinteraction:update'),controller[_0x5fb6('0x19')]);router[_0x5fb6('0x1a')](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),interaction[_0x5fb6('0x15')](_0x5fb6('0x18'),'whatsappinteraction:destroy'),controller[_0x5fb6('0x1b')]);router['delete'](_0x5fb6('0x14'),auth['isAuthenticated'](),controller[_0x5fb6('0x1c')]);module[_0x5fb6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index a25b965..1205148 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9962=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x27db77,_0x55322f){var _0x5f0e56=function(_0x543139){while(--_0x543139){_0x27db77['push'](_0x27db77['shift']());}};_0x5f0e56(++_0x55322f);}(_0x9962,0xb8));var _0x2996=function(_0x18dad6,_0x281009){_0x18dad6=_0x18dad6-0x0;var _0x1870bb=_0x9962[_0x18dad6];return _0x1870bb;};'use strict';var Sequelize=require(_0x2996('0x0'));var moment=require('moment');module[_0x2996('0x1')]={'closed':{'type':Sequelize[_0x2996('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2996('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2996('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2996('0x4')]},'phone':{'type':Sequelize[_0x2996('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2996('0x5')]('in',_0x2996('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2996('0x5')]('in',_0x2996('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2996('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2996('0x7')]}}; \ No newline at end of file +var _0x0954=['STRING','DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x120fd7,_0x3a8ad0){var _0x5b17df=function(_0x3a3706){while(--_0x3a3706){_0x120fd7['push'](_0x120fd7['shift']());}};_0x5b17df(++_0x3a8ad0);}(_0x0954,0x135));var _0x4095=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x0954[_0x162780];return _0x1ea2dc;};'use strict';var Sequelize=require(_0x4095('0x0'));var moment=require('moment');module[_0x4095('0x1')]={'closed':{'type':Sequelize[_0x4095('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4095('0x3')]},'secondDisposition':{'type':Sequelize[_0x4095('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4095('0x3')]},'note':{'type':Sequelize[_0x4095('0x3')]},'phone':{'type':Sequelize[_0x4095('0x3')]},'read1stAt':{'type':Sequelize[_0x4095('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4095('0x5')]('in',_0x4095('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4095('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4095('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 20325b3..80657f0 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0b2=['sort','where','WhatsappInteractionId','filter','$gte','format','include','findAll','rows','spread','Tag','color','emit','removeTags','download','unix','toString','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','User','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','fullname','mkdirSync','Whatsapp','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','pipe','out','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','end','undefined','limit','count','offset','status','set','Content-Range','json','update','then','sendStatus','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','whatsapp','user','catch','model','keys','query','filters','intersection','attributes','fields','length','merge','options','find','create','body','params','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','order'];(function(_0x148dda,_0x9200a1){var _0x4b0bc9=function(_0x589239){while(--_0x589239){_0x148dda['push'](_0x148dda['shift']());}};_0x4b0bc9(++_0x9200a1);}(_0xc0b2,0x1aa));var _0x2c0b=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc0b2[_0x3ab9ee];return _0x82ee88;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x2c0b('0x0'));var moment=require(_0x2c0b('0x1'));var BPromise=require(_0x2c0b('0x2'));var util=require(_0x2c0b('0x3'));var path=require(_0x2c0b('0x4'));var ejs=require(_0x2c0b('0x5'));var fs=require('fs');var _=require(_0x2c0b('0x6'));var Redis=require(_0x2c0b('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x2c0b('0x8'));var pdf=require(_0x2c0b('0x9'));var logger=require('../../config/logger')(_0x2c0b('0xa'));var config=require(_0x2c0b('0xb'));var db=require(_0x2c0b('0xc'))['db'];config[_0x2c0b('0xd')]=_[_0x2c0b('0xe')](config[_0x2c0b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c0b('0xf'))(new Redis(config[_0x2c0b('0xd')]));require('./whatsappInteraction.socket')[_0x2c0b('0x10')](socket);function respondWithStatusCode(_0x17ea3c,_0x3ddd8c){_0x3ddd8c=_0x3ddd8c||0xcc;return function(_0xb78c0){if(_0xb78c0){return _0x17ea3c['sendStatus'](_0x3ddd8c);}return _0x17ea3c['status'](_0x3ddd8c)[_0x2c0b('0x11')]();};}function respondWithResult(_0x1fbac8,_0x248d66){_0x248d66=_0x248d66||0xc8;return function(_0x1799ca){if(_0x1799ca){return _0x1fbac8['status'](_0x248d66)['json'](_0x1799ca);}};}function respondWithFilteredResult(_0x130c08,_0xb50992){return function(_0x2668ad){if(_0x2668ad){var _0xf1ce08=typeof _0xb50992['offset']===_0x2c0b('0x12')&&typeof _0xb50992[_0x2c0b('0x13')]===_0x2c0b('0x12');var _0x1e943c=_0x2668ad[_0x2c0b('0x14')];var _0xc89599=_0xf1ce08?0x0:_0xb50992[_0x2c0b('0x15')];var _0xf17dcb=_0xf1ce08?_0x2668ad[_0x2c0b('0x14')]:_0xb50992[_0x2c0b('0x15')]+_0xb50992[_0x2c0b('0x13')];var _0x581f7c;if(_0xf17dcb>=_0x1e943c){_0xf17dcb=_0x1e943c;_0x581f7c=0xc8;}else{_0x581f7c=0xce;}_0x130c08[_0x2c0b('0x16')](_0x581f7c);return _0x130c08[_0x2c0b('0x17')](_0x2c0b('0x18'),_0xc89599+'-'+_0xf17dcb+'/'+_0x1e943c)[_0x2c0b('0x19')](_0x2668ad);}return null;};}function saveUpdates(_0x200b42){return function(_0x41dadf){if(_0x41dadf){return _0x41dadf[_0x2c0b('0x1a')](_0x200b42)[_0x2c0b('0x1b')](function(_0x833669){return _0x833669;});}return null;};}function removeEntity(_0xb5f408){return function(_0x2bde49){if(_0x2bde49){return _0x2bde49['destroy']()[_0x2c0b('0x1b')](function(){_0xb5f408[_0x2c0b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x94ec45){return function(_0x1b96cf){if(!_0x1b96cf){_0x94ec45[_0x2c0b('0x1c')](0x194);}return _0x1b96cf;};}function handleError(_0x573340,_0x4a6034){_0x4a6034=_0x4a6034||0x1f4;return function(_0x217414){logger['error'](_0x217414[_0x2c0b('0x1d')]);if(_0x217414[_0x2c0b('0x1e')]){delete _0x217414['name'];}_0x573340[_0x2c0b('0x16')](_0x4a6034)[_0x2c0b('0x1f')](_0x217414);};}exports[_0x2c0b('0x20')]=function(_0x17781e,_0x3fa457){var _0xfd41c2={};var _0x256af4=_[_0x2c0b('0x21')](db[_0x2c0b('0x22')][_0x2c0b('0x23')],function(_0x316d3c){return{'name':_0x316d3c[_0x2c0b('0x24')],'type':_0x316d3c[_0x2c0b('0x25')][_0x2c0b('0x26')]};});_0xfd41c2=qs['getOptions'](_0x256af4,_0x17781e);return interaction['findAll'](_0x2c0b('0x27'),_0x17781e['query'],_0x17781e[_0x2c0b('0x28')],_0xfd41c2,_0x256af4)['then'](respondWithFilteredResult(_0x3fa457,_0xfd41c2))[_0x2c0b('0x29')](handleError(_0x3fa457,null));};exports['show']=function(_0x3693b9,_0x521a36){var _0x170538={'raw':![],'where':{'id':_0x3693b9['params']['id']}},_0x2ee81c={};_0x2ee81c[_0x2c0b('0x2a')]=_[_0x2c0b('0x2b')](db[_0x2c0b('0x22')][_0x2c0b('0x23')]);_0x2ee81c[_0x2c0b('0x2c')]=_[_0x2c0b('0x2b')](_0x3693b9[_0x2c0b('0x2c')]);_0x2ee81c[_0x2c0b('0x2d')]=_[_0x2c0b('0x2e')](_0x2ee81c[_0x2c0b('0x2a')],_0x2ee81c[_0x2c0b('0x2c')]);_0x170538[_0x2c0b('0x2f')]=_['intersection'](_0x2ee81c[_0x2c0b('0x2a')],qs[_0x2c0b('0x30')](_0x3693b9[_0x2c0b('0x2c')][_0x2c0b('0x30')]));_0x170538[_0x2c0b('0x2f')]=_0x170538[_0x2c0b('0x2f')][_0x2c0b('0x31')]?_0x170538[_0x2c0b('0x2f')]:_0x2ee81c[_0x2c0b('0x2a')];if(_0x3693b9['query']['includeAll']){_0x170538['include']=[{'all':!![]}];}_0x170538=_[_0x2c0b('0x32')]({},_0x170538,_0x3693b9[_0x2c0b('0x33')]);return db[_0x2c0b('0x22')][_0x2c0b('0x34')](_0x170538)[_0x2c0b('0x1b')](handleEntityNotFound(_0x521a36,null))['then'](respondWithResult(_0x521a36,null))[_0x2c0b('0x29')](handleError(_0x521a36,null));};exports[_0x2c0b('0x35')]=function(_0x7714d3,_0x1ba374){return db[_0x2c0b('0x22')][_0x2c0b('0x35')](_0x7714d3['body'],{})[_0x2c0b('0x1b')](respondWithResult(_0x1ba374,0xc9))[_0x2c0b('0x29')](handleError(_0x1ba374,null));};exports['update']=function(_0x42d641,_0x40cf52){if(_0x42d641[_0x2c0b('0x36')]['id']){delete _0x42d641[_0x2c0b('0x36')]['id'];}return db[_0x2c0b('0x22')][_0x2c0b('0x34')]({'where':{'id':_0x42d641[_0x2c0b('0x37')]['id']}})['then'](handleEntityNotFound(_0x40cf52,null))[_0x2c0b('0x1b')](saveUpdates(_0x42d641[_0x2c0b('0x36')],null))[_0x2c0b('0x1b')](respondWithResult(_0x40cf52,null))[_0x2c0b('0x29')](handleError(_0x40cf52,null));};exports[_0x2c0b('0x38')]=function(_0x16c362,_0x568e6a){return db[_0x2c0b('0x22')]['find']({'where':{'id':_0x16c362['params']['id']}})[_0x2c0b('0x1b')](handleEntityNotFound(_0x568e6a,null))[_0x2c0b('0x1b')](removeEntity(_0x568e6a,null))[_0x2c0b('0x29')](handleError(_0x568e6a,null));};exports[_0x2c0b('0x39')]=function(_0x27343e,_0x1b7b41){return db[_0x2c0b('0x22')][_0x2c0b('0x39')]()['then'](respondWithResult(_0x1b7b41,null))['catch'](handleError(_0x1b7b41,null));};exports[_0x2c0b('0x3a')]=function(_0x30dc4c,_0x19d5b9){return db[_0x2c0b('0x3b')][_0x2c0b('0x34')]({'where':{'id':_0x30dc4c[_0x2c0b('0x37')]['id']}})['then'](handleEntityNotFound(_0x19d5b9,null))[_0x2c0b('0x1b')](function(_0x538829){if(_0x538829){return _0x538829[_0x2c0b('0x3a')](_0x30dc4c[_0x2c0b('0x36')][_0x2c0b('0x3c')],_[_0x2c0b('0x3d')](_0x30dc4c[_0x2c0b('0x36')],['ids','id'])||{});}})[_0x2c0b('0x1b')](respondWithResult(_0x19d5b9,null))[_0x2c0b('0x29')](handleError(_0x19d5b9,null));};exports[_0x2c0b('0x3e')]=function(_0x1bb055,_0x4af2dd){var _0x38d79f={'raw':![],'where':{}};var _0x582020={};var _0x3a4ef4={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x2c0b('0x3f')]({'where':{'id':_0x1bb055['params']['id']}})[_0x2c0b('0x1b')](handleEntityNotFound(_0x4af2dd,null))[_0x2c0b('0x1b')](function(_0x522984){if(_0x522984){_0x582020[_0x2c0b('0x2a')]=_[_0x2c0b('0x2b')](db[_0x2c0b('0x3b')][_0x2c0b('0x23')]);_0x582020['query']=_['keys'](_0x1bb055[_0x2c0b('0x2c')]);_0x582020[_0x2c0b('0x2d')]=_['intersection'](_0x582020[_0x2c0b('0x2a')],_0x582020[_0x2c0b('0x2c')]);_0x38d79f['attributes']=_['intersection'](_0x582020[_0x2c0b('0x2a')],qs[_0x2c0b('0x30')](_0x1bb055[_0x2c0b('0x2c')][_0x2c0b('0x30')]));_0x38d79f['attributes']=_0x38d79f[_0x2c0b('0x2f')][_0x2c0b('0x31')]?_0x38d79f['attributes']:_0x582020['model'];if(!_0x1bb055['query']['hasOwnProperty'](_0x2c0b('0x40'))){_0x38d79f[_0x2c0b('0x13')]=qs[_0x2c0b('0x13')](_0x1bb055[_0x2c0b('0x2c')]['limit']);_0x38d79f[_0x2c0b('0x15')]=qs[_0x2c0b('0x15')](_0x1bb055['query'][_0x2c0b('0x15')]);}_0x38d79f[_0x2c0b('0x41')]=qs[_0x2c0b('0x42')](_0x1bb055[_0x2c0b('0x2c')][_0x2c0b('0x42')]);_0x38d79f[_0x2c0b('0x43')]=qs['filters'](_['pick'](_0x1bb055[_0x2c0b('0x2c')],_0x582020['filters']));_0x38d79f[_0x2c0b('0x43')][_0x2c0b('0x44')]=_0x522984['id'];if(_0x1bb055[_0x2c0b('0x2c')][_0x2c0b('0x45')]){_0x38d79f['where']=_[_0x2c0b('0x32')](_0x38d79f[_0x2c0b('0x43')],{'$or':_[_0x2c0b('0x21')](_0x38d79f['attributes'],function(_0x5e3f36){var _0x3a7697={};_0x3a7697[_0x5e3f36]={'$like':'%'+_0x1bb055[_0x2c0b('0x2c')][_0x2c0b('0x45')]+'%'};return _0x3a7697;})});}if(_0x1bb055[_0x2c0b('0x2c')]['$gte']){var _0x3bf7a0=_0x1bb055[_0x2c0b('0x2c')][_0x2c0b('0x46')]['split'](',');var _0x2e1896={};_0x2e1896[_0x3bf7a0[0x0]]={'$gte':moment(_0x3bf7a0[0x1])[_0x2c0b('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x38d79f[_0x2c0b('0x43')]=_['merge'](_0x38d79f[_0x2c0b('0x43')],_0x2e1896);}_0x38d79f=_['merge']({},_0x38d79f,_0x1bb055[_0x2c0b('0x33')]);return db[_0x2c0b('0x3b')][_0x2c0b('0x14')]({'where':_0x38d79f[_0x2c0b('0x43')]})[_0x2c0b('0x1b')](function(_0x26783c){_0x3a4ef4['count']=_0x26783c;if(_0x1bb055['query']['includeAll']){_0x38d79f[_0x2c0b('0x48')]=[{'all':!![]}];}return db[_0x2c0b('0x3b')][_0x2c0b('0x49')](_0x38d79f);})[_0x2c0b('0x1b')](function(_0x4df065){_0x3a4ef4[_0x2c0b('0x4a')]=_0x4df065;return _0x3a4ef4;});}})[_0x2c0b('0x1b')](respondWithFilteredResult(_0x4af2dd,_0x38d79f))[_0x2c0b('0x29')](handleError(_0x4af2dd,null));};exports['addTags']=function(_0x30c774,_0x5086d6){return db[_0x2c0b('0x22')][_0x2c0b('0x34')]({'where':{'id':_0x30c774[_0x2c0b('0x37')]['id']}})['then'](handleEntityNotFound(_0x5086d6,null))['then'](function(_0x5b33e2){if(_0x5b33e2){return _0x5b33e2['setTags'](_0x30c774['body'][_0x2c0b('0x3c')],_['omit'](_0x30c774[_0x2c0b('0x36')],[_0x2c0b('0x3c'),'id'])||{})[_0x2c0b('0x4b')](function(){return db[_0x2c0b('0x4c')]['findAll']({'attributes':['id',_0x2c0b('0x1e'),_0x2c0b('0x4d')],'where':{'id':_0x30c774[_0x2c0b('0x36')][_0x2c0b('0x3c')]}});})[_0x2c0b('0x1b')](function(_0x310ae1){socket[_0x2c0b('0x4e')]('whatsappInteractionTags:save',{'id':Number(_0x30c774[_0x2c0b('0x37')]['id']),'tags':_0x310ae1||[]});return{'id':Number(_0x30c774['params']['id']),'tags':_0x310ae1||[]};});}})[_0x2c0b('0x1b')](respondWithResult(_0x5086d6,null))['catch'](handleError(_0x5086d6,null));};exports[_0x2c0b('0x4f')]=function(_0x478cd3,_0x52b930){return db[_0x2c0b('0x22')][_0x2c0b('0x34')]({'where':{'id':_0x478cd3[_0x2c0b('0x37')]['id']}})[_0x2c0b('0x1b')](handleEntityNotFound(_0x52b930,null))[_0x2c0b('0x1b')](function(_0x1bf1e2){if(_0x1bf1e2){return _0x1bf1e2['removeTags'](_0x478cd3[_0x2c0b('0x2c')][_0x2c0b('0x3c')]);}})[_0x2c0b('0x1b')](respondWithStatusCode(_0x52b930,null))['catch'](handleError(_0x52b930,null));};exports[_0x2c0b('0x50')]=function(_0x2434af,_0x3e6142){var _0x5de23f=moment()[_0x2c0b('0x51')]()[_0x2c0b('0x52')]();var _0x4aa98d=path['join'](config[_0x2c0b('0x53')],'server',_0x2c0b('0x54'),_0x2c0b('0x55'));var _0x13ef01=path[_0x2c0b('0x56')](config[_0x2c0b('0x53')],_0x2c0b('0x57'),_0x2c0b('0x54'),_0x2c0b('0x58'));var _0x17460a=path[_0x2c0b('0x56')](_0x4aa98d,_0x5de23f);var _0x35cdb2=util['format'](_0x2c0b('0x59'),_0x2434af['params']['id'],_0x5de23f);var _0x3283d7=path[_0x2c0b('0x56')](_0x4aa98d,_0x35cdb2);var _0x1085f1=[];_0x1085f1[_0x2c0b('0x5a')]({'model':db[_0x2c0b('0x5b')],'as':_0x2c0b('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x1085f1['push']({'model':db['CmContact'],'as':_0x2c0b('0x5c'),'attributes':['id','firstName',_0x2c0b('0x5d')],'raw':!![]});if(_0x2434af['query'][_0x2c0b('0x58')]){_0x1085f1[_0x2c0b('0x5a')]({'model':db[_0x2c0b('0x5e')],'as':_0x2c0b('0x5e'),'raw':!![]});}var _0x544668=[{'model':db[_0x2c0b('0x3b')],'as':_0x2c0b('0x5f'),'attributes':['id','body',_0x2c0b('0x60'),_0x2c0b('0x61'),_0x2c0b('0x62'),_0x2c0b('0x63')],'include':_0x1085f1}];_0x544668['push']({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x2c0b('0x1e')]});_0x544668['push']({'model':db[_0x2c0b('0x5b')],'as':'Owner','attributes':['id',_0x2c0b('0x64')]});return db[_0x2c0b('0x22')][_0x2c0b('0x34')]({'where':{'id':_0x2434af[_0x2c0b('0x37')]['id']},'include':_0x544668})[_0x2c0b('0x1b')](handleEntityNotFound(_0x3e6142,null))[_0x2c0b('0x1b')](function(_0x5e3126){if(_0x5e3126){var _0x21a80b=_0x5e3126['get']({'plain':!![]});fs[_0x2c0b('0x65')](_0x17460a);var _0x4b80c2={'channel':_0x2c0b('0x66'),'account':_0x21a80b['Account'][_0x2c0b('0x1e')],'agent':_0x21a80b['Owner']?_0x21a80b[_0x2c0b('0x67')][_0x2c0b('0x64')]:_0x2c0b('0x68'),'createdAt':moment(_0x21a80b['createdAt'])[_0x2c0b('0x47')](_0x2c0b('0x69'))['toString'](),'closedAt':_0x21a80b[_0x2c0b('0x6a')]?moment(_0x21a80b[_0x2c0b('0x6b')])[_0x2c0b('0x47')](_0x2c0b('0x69'))['toString']():'','disposition':_0x21a80b[_0x2c0b('0x6c')],'messages':_(_0x21a80b[_0x2c0b('0x5f')])[_0x2c0b('0x45')]({'secret':![]})[_0x2c0b('0x21')](function(_0x1105e6){if(_0x1105e6['Attachment']){var _0x323d7e=path[_0x2c0b('0x56')](_0x13ef01,_0x1105e6[_0x2c0b('0x5e')][_0x2c0b('0x6d')]);if(fs['existsSync'](_0x323d7e)){fs['createReadStream'](_0x323d7e)[_0x2c0b('0x6e')](fs['createWriteStream'](path[_0x2c0b('0x56')](_0x17460a,_0x1105e6[_0x2c0b('0x5e')][_0x2c0b('0x6d')])));}}return{'date':moment(_0x1105e6['createdAt'])[_0x2c0b('0x47')](_0x2c0b('0x69'))[_0x2c0b('0x52')](),'sender':_0x1105e6[_0x2c0b('0x61')]===_0x2c0b('0x6f')?_0x1105e6[_0x2c0b('0x5b')]?_0x1105e6[_0x2c0b('0x5b')][_0x2c0b('0x64')]:'System':_0x1105e6['Contact'][_0x2c0b('0x70')]+(_0x1105e6['Contact'][_0x2c0b('0x5d')]?'\x20'+_0x1105e6[_0x2c0b('0x5c')][_0x2c0b('0x5d')]:''),'body':_0x1105e6[_0x2c0b('0x5e')]?_0x1105e6['Attachment'][_0x2c0b('0x6d')]:_0x1105e6['body'],'direction':_0x1105e6[_0x2c0b('0x61')]==='out'?'A':'C','secret':_0x1105e6[_0x2c0b('0x62')],'read':_0x1105e6[_0x2c0b('0x63')],'attachment':_0x1105e6[_0x2c0b('0x5e')]};})[_0x2c0b('0x71')]()};return ejs[_0x2c0b('0x72')](path[_0x2c0b('0x56')](config['root'],_0x2c0b('0x57'),_0x2c0b('0x73'),_0x2c0b('0x74')),{'interaction':_0x4b80c2})[_0x2c0b('0x1b')](function(_0x581788){var _0x45f73c=path['join'](_0x17460a,_0x2c0b('0x75')+_0x21a80b['id']+'-'+_0x5de23f+_0x2c0b('0x76'));var _0x4a493c={'path':_0x45f73c,'channel':_0x2c0b('0x66'),'interactionId':_0x21a80b['id']};return pdf[_0x2c0b('0x77')](_0x581788,_0x4a493c);})[_0x2c0b('0x1b')](function(){return new BPromise(function(_0x2c01b4,_0x3c6058){zipdir(_0x17460a,{'saveTo':_0x3283d7},function(_0x49fe44,_0x47c2ee){if(_0x49fe44)return _0x3c6058(_0x49fe44);return _0x2c01b4(_0x47c2ee);});})['then'](function(){return new BPromise(function(_0x55c1cd,_0x482ee2){rimraf(_0x17460a,function(_0x77d04c){if(_0x77d04c)_0x482ee2(_0x77d04c);return _0x55c1cd();});});})[_0x2c0b('0x1b')](function(){return _0x3e6142['download'](_0x3283d7,_0x35cdb2,function(_0x96986f){if(_0x96986f){console[_0x2c0b('0x78')](_0x2c0b('0x79'),_0x96986f);}else{fs[_0x2c0b('0x7a')](_0x3283d7);}});});});}else{return _0x3e6142[_0x2c0b('0x1c')](0xc8);}})[_0x2c0b('0x29')](handleError(_0x3e6142,null));}; \ No newline at end of file +var _0x6beb=['err','unlinkSync','rimraf','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','params','WhatsappInteraction','keys','intersection','attributes','model','fields','length','includeAll','include','options','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','merge','$gte','split','format','rows','addTags','color','emit','whatsappInteractionTags:save','removeTags','download','root','server','files','join','attachments','transcript-%d-%s.zip','User','fullname','push','firstName','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','disposition','existsSync','createReadStream','basename','out','Contact','read','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log'];(function(_0x4e8db9,_0x15ff81){var _0x1fc3be=function(_0x1cc230){while(--_0x1cc230){_0x4e8db9['push'](_0x4e8db9['shift']());}};_0x1fc3be(++_0x15ff81);}(_0x6beb,0x1da));var _0xb6be=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6beb[_0x14add3];return _0x4a174f;};'use strict';var rimraf=require(_0xb6be('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xb6be('0x1'));var util=require(_0xb6be('0x2'));var path=require(_0xb6be('0x3'));var ejs=require(_0xb6be('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb6be('0x5'));var interaction=require(_0xb6be('0x6'));var qs=require(_0xb6be('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xb6be('0x8'));var config=require(_0xb6be('0x9'));var db=require('../../mysqldb')['db'];config[_0xb6be('0xa')]=_[_0xb6be('0xb')](config[_0xb6be('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb6be('0xc'))(new Redis(config[_0xb6be('0xa')]));require('./whatsappInteraction.socket')[_0xb6be('0xd')](socket);function respondWithStatusCode(_0xf92bbd,_0x27aa6e){_0x27aa6e=_0x27aa6e||0xcc;return function(_0x3a5eb5){if(_0x3a5eb5){return _0xf92bbd[_0xb6be('0xe')](_0x27aa6e);}return _0xf92bbd[_0xb6be('0xf')](_0x27aa6e)[_0xb6be('0x10')]();};}function respondWithResult(_0x4b0d20,_0x5e9ca6){_0x5e9ca6=_0x5e9ca6||0xc8;return function(_0x49891d){if(_0x49891d){return _0x4b0d20[_0xb6be('0xf')](_0x5e9ca6)['json'](_0x49891d);}};}function respondWithFilteredResult(_0x423f01,_0x15b271){return function(_0x35de70){if(_0x35de70){var _0x3e070d=typeof _0x15b271[_0xb6be('0x11')]===_0xb6be('0x12')&&typeof _0x15b271[_0xb6be('0x13')]==='undefined';var _0x27bc14=_0x35de70['count'];var _0x484f09=_0x3e070d?0x0:_0x15b271['offset'];var _0x3ad0d7=_0x3e070d?_0x35de70[_0xb6be('0x14')]:_0x15b271[_0xb6be('0x11')]+_0x15b271['limit'];var _0x432a62;if(_0x3ad0d7>=_0x27bc14){_0x3ad0d7=_0x27bc14;_0x432a62=0xc8;}else{_0x432a62=0xce;}_0x423f01[_0xb6be('0xf')](_0x432a62);return _0x423f01[_0xb6be('0x15')](_0xb6be('0x16'),_0x484f09+'-'+_0x3ad0d7+'/'+_0x27bc14)[_0xb6be('0x17')](_0x35de70);}return null;};}function saveUpdates(_0x5e0f1f){return function(_0x31b931){if(_0x31b931){return _0x31b931[_0xb6be('0x18')](_0x5e0f1f)[_0xb6be('0x19')](function(_0x697443){return _0x697443;});}return null;};}function removeEntity(_0x155dcc){return function(_0xa3e8c){if(_0xa3e8c){return _0xa3e8c[_0xb6be('0x1a')]()[_0xb6be('0x19')](function(){_0x155dcc[_0xb6be('0xf')](0xcc)[_0xb6be('0x10')]();});}};}function handleEntityNotFound(_0x4513e7){return function(_0x46acb3){if(!_0x46acb3){_0x4513e7['sendStatus'](0x194);}return _0x46acb3;};}function handleError(_0x400b82,_0x29100d){_0x29100d=_0x29100d||0x1f4;return function(_0x41a8be){logger['error'](_0x41a8be[_0xb6be('0x1b')]);if(_0x41a8be[_0xb6be('0x1c')]){delete _0x41a8be['name'];}_0x400b82['status'](_0x29100d)[_0xb6be('0x1d')](_0x41a8be);};}exports['index']=function(_0x43396b,_0x322291){var _0x366dcd={};var _0x41c50b=_[_0xb6be('0x1e')](db['WhatsappInteraction'][_0xb6be('0x1f')],function(_0x182274){return{'name':_0x182274[_0xb6be('0x20')],'type':_0x182274['type'][_0xb6be('0x21')]};});_0x366dcd=qs[_0xb6be('0x22')](_0x41c50b,_0x43396b);return interaction[_0xb6be('0x23')](_0xb6be('0x24'),_0x43396b[_0xb6be('0x25')],_0x43396b[_0xb6be('0x26')],_0x366dcd,_0x41c50b)[_0xb6be('0x19')](respondWithFilteredResult(_0x322291,_0x366dcd))['catch'](handleError(_0x322291,null));};exports['show']=function(_0x43c401,_0x5e7adc){var _0x321253={'raw':![],'where':{'id':_0x43c401[_0xb6be('0x27')]['id']}},_0x3b9bf4={};_0x3b9bf4['model']=_['keys'](db[_0xb6be('0x28')][_0xb6be('0x1f')]);_0x3b9bf4[_0xb6be('0x25')]=_[_0xb6be('0x29')](_0x43c401[_0xb6be('0x25')]);_0x3b9bf4['filters']=_[_0xb6be('0x2a')](_0x3b9bf4['model'],_0x3b9bf4[_0xb6be('0x25')]);_0x321253[_0xb6be('0x2b')]=_['intersection'](_0x3b9bf4[_0xb6be('0x2c')],qs['fields'](_0x43c401[_0xb6be('0x25')][_0xb6be('0x2d')]));_0x321253[_0xb6be('0x2b')]=_0x321253[_0xb6be('0x2b')][_0xb6be('0x2e')]?_0x321253[_0xb6be('0x2b')]:_0x3b9bf4[_0xb6be('0x2c')];if(_0x43c401['query'][_0xb6be('0x2f')]){_0x321253[_0xb6be('0x30')]=[{'all':!![]}];}_0x321253=_['merge']({},_0x321253,_0x43c401[_0xb6be('0x31')]);return db[_0xb6be('0x28')][_0xb6be('0x32')](_0x321253)['then'](handleEntityNotFound(_0x5e7adc,null))[_0xb6be('0x19')](respondWithResult(_0x5e7adc,null))[_0xb6be('0x33')](handleError(_0x5e7adc,null));};exports['create']=function(_0x151d49,_0x53b29d){return db['WhatsappInteraction'][_0xb6be('0x34')](_0x151d49[_0xb6be('0x35')],{})[_0xb6be('0x19')](respondWithResult(_0x53b29d,0xc9))[_0xb6be('0x33')](handleError(_0x53b29d,null));};exports[_0xb6be('0x18')]=function(_0x185c81,_0x28e951){if(_0x185c81[_0xb6be('0x35')]['id']){delete _0x185c81[_0xb6be('0x35')]['id'];}return db[_0xb6be('0x28')][_0xb6be('0x32')]({'where':{'id':_0x185c81[_0xb6be('0x27')]['id']}})[_0xb6be('0x19')](handleEntityNotFound(_0x28e951,null))[_0xb6be('0x19')](saveUpdates(_0x185c81[_0xb6be('0x35')],null))[_0xb6be('0x19')](respondWithResult(_0x28e951,null))[_0xb6be('0x33')](handleError(_0x28e951,null));};exports['destroy']=function(_0x17ce49,_0x2f546a){return db[_0xb6be('0x28')][_0xb6be('0x32')]({'where':{'id':_0x17ce49[_0xb6be('0x27')]['id']}})['then'](handleEntityNotFound(_0x2f546a,null))['then'](removeEntity(_0x2f546a,null))['catch'](handleError(_0x2f546a,null));};exports[_0xb6be('0x36')]=function(_0x164278,_0xc7be9f){return db['WhatsappInteraction'][_0xb6be('0x36')]()[_0xb6be('0x19')](respondWithResult(_0xc7be9f,null))[_0xb6be('0x33')](handleError(_0xc7be9f,null));};exports[_0xb6be('0x37')]=function(_0x1fa29a,_0x145722){return db[_0xb6be('0x38')][_0xb6be('0x32')]({'where':{'id':_0x1fa29a[_0xb6be('0x27')]['id']}})[_0xb6be('0x19')](handleEntityNotFound(_0x145722,null))[_0xb6be('0x19')](function(_0x346d1e){if(_0x346d1e){return _0x346d1e[_0xb6be('0x37')](_0x1fa29a[_0xb6be('0x35')][_0xb6be('0x39')],_[_0xb6be('0x3a')](_0x1fa29a[_0xb6be('0x35')],[_0xb6be('0x39'),'id'])||{});}})[_0xb6be('0x19')](respondWithResult(_0x145722,null))[_0xb6be('0x33')](handleError(_0x145722,null));};exports[_0xb6be('0x3b')]=function(_0x19e952,_0x598075){var _0x53c906={'raw':![],'where':{}};var _0x5a3cef={};var _0x11778d={'count':0x0,'rows':[]};return db[_0xb6be('0x28')]['findOne']({'where':{'id':_0x19e952[_0xb6be('0x27')]['id']}})[_0xb6be('0x19')](handleEntityNotFound(_0x598075,null))[_0xb6be('0x19')](function(_0x2143b5){if(_0x2143b5){_0x5a3cef[_0xb6be('0x2c')]=_[_0xb6be('0x29')](db['WhatsappMessage'][_0xb6be('0x1f')]);_0x5a3cef[_0xb6be('0x25')]=_[_0xb6be('0x29')](_0x19e952['query']);_0x5a3cef[_0xb6be('0x3c')]=_[_0xb6be('0x2a')](_0x5a3cef[_0xb6be('0x2c')],_0x5a3cef[_0xb6be('0x25')]);_0x53c906[_0xb6be('0x2b')]=_[_0xb6be('0x2a')](_0x5a3cef[_0xb6be('0x2c')],qs[_0xb6be('0x2d')](_0x19e952['query'][_0xb6be('0x2d')]));_0x53c906[_0xb6be('0x2b')]=_0x53c906[_0xb6be('0x2b')]['length']?_0x53c906[_0xb6be('0x2b')]:_0x5a3cef[_0xb6be('0x2c')];if(!_0x19e952['query'][_0xb6be('0x3d')](_0xb6be('0x3e'))){_0x53c906['limit']=qs[_0xb6be('0x13')](_0x19e952['query'][_0xb6be('0x13')]);_0x53c906['offset']=qs['offset'](_0x19e952[_0xb6be('0x25')]['offset']);}_0x53c906['order']=qs[_0xb6be('0x3f')](_0x19e952['query'][_0xb6be('0x3f')]);_0x53c906[_0xb6be('0x40')]=qs['filters'](_[_0xb6be('0x41')](_0x19e952[_0xb6be('0x25')],_0x5a3cef[_0xb6be('0x3c')]));_0x53c906[_0xb6be('0x40')][_0xb6be('0x42')]=_0x2143b5['id'];if(_0x19e952[_0xb6be('0x25')][_0xb6be('0x43')]){_0x53c906['where']=_[_0xb6be('0x44')](_0x53c906[_0xb6be('0x40')],{'$or':_[_0xb6be('0x1e')](_0x53c906[_0xb6be('0x2b')],function(_0x2a5e50){var _0x1ab27c={};_0x1ab27c[_0x2a5e50]={'$like':'%'+_0x19e952[_0xb6be('0x25')]['filter']+'%'};return _0x1ab27c;})});}if(_0x19e952[_0xb6be('0x25')][_0xb6be('0x45')]){var _0x44082e=_0x19e952[_0xb6be('0x25')][_0xb6be('0x45')][_0xb6be('0x46')](',');var _0x440271={};_0x440271[_0x44082e[0x0]]={'$gte':moment(_0x44082e[0x1])[_0xb6be('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x53c906[_0xb6be('0x40')]=_[_0xb6be('0x44')](_0x53c906['where'],_0x440271);}_0x53c906=_[_0xb6be('0x44')]({},_0x53c906,_0x19e952[_0xb6be('0x31')]);return db[_0xb6be('0x38')][_0xb6be('0x14')]({'where':_0x53c906[_0xb6be('0x40')]})['then'](function(_0x25c2fe){_0x11778d[_0xb6be('0x14')]=_0x25c2fe;if(_0x19e952['query'][_0xb6be('0x2f')]){_0x53c906['include']=[{'all':!![]}];}return db[_0xb6be('0x38')]['findAll'](_0x53c906);})['then'](function(_0xab09ba){_0x11778d[_0xb6be('0x48')]=_0xab09ba;return _0x11778d;});}})[_0xb6be('0x19')](respondWithFilteredResult(_0x598075,_0x53c906))[_0xb6be('0x33')](handleError(_0x598075,null));};exports[_0xb6be('0x49')]=function(_0x3b5e81,_0x39ed4f){return db[_0xb6be('0x28')][_0xb6be('0x32')]({'where':{'id':_0x3b5e81[_0xb6be('0x27')]['id']}})[_0xb6be('0x19')](handleEntityNotFound(_0x39ed4f,null))[_0xb6be('0x19')](function(_0x325381){if(_0x325381){return _0x325381['setTags'](_0x3b5e81[_0xb6be('0x35')]['ids'],_[_0xb6be('0x3a')](_0x3b5e81['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xb6be('0x23')]({'attributes':['id','name',_0xb6be('0x4a')],'where':{'id':_0x3b5e81[_0xb6be('0x35')]['ids']}});})[_0xb6be('0x19')](function(_0x37ba61){socket[_0xb6be('0x4b')](_0xb6be('0x4c'),{'id':Number(_0x3b5e81[_0xb6be('0x27')]['id']),'tags':_0x37ba61||[]});return{'id':Number(_0x3b5e81[_0xb6be('0x27')]['id']),'tags':_0x37ba61||[]};});}})[_0xb6be('0x19')](respondWithResult(_0x39ed4f,null))[_0xb6be('0x33')](handleError(_0x39ed4f,null));};exports['removeTags']=function(_0x3836c1,_0x2bd1f1){return db[_0xb6be('0x28')]['find']({'where':{'id':_0x3836c1[_0xb6be('0x27')]['id']}})[_0xb6be('0x19')](handleEntityNotFound(_0x2bd1f1,null))['then'](function(_0x2e33da){if(_0x2e33da){return _0x2e33da[_0xb6be('0x4d')](_0x3836c1[_0xb6be('0x25')][_0xb6be('0x39')]);}})['then'](respondWithStatusCode(_0x2bd1f1,null))[_0xb6be('0x33')](handleError(_0x2bd1f1,null));};exports[_0xb6be('0x4e')]=function(_0x31ec33,_0x57d7ca){var _0x18ea9e=moment()['unix']()['toString']();var _0x503198=path['join'](config[_0xb6be('0x4f')],_0xb6be('0x50'),_0xb6be('0x51'),'tmp');var _0x1a317f=path[_0xb6be('0x52')](config[_0xb6be('0x4f')],_0xb6be('0x50'),_0xb6be('0x51'),_0xb6be('0x53'));var _0x29053f=path['join'](_0x503198,_0x18ea9e);var _0x3b5d66=util[_0xb6be('0x47')](_0xb6be('0x54'),_0x31ec33[_0xb6be('0x27')]['id'],_0x18ea9e);var _0x3f80c7=path[_0xb6be('0x52')](_0x503198,_0x3b5d66);var _0x4842b7=[];_0x4842b7['push']({'model':db['User'],'as':_0xb6be('0x55'),'attributes':['id',_0xb6be('0x56')],'raw':!![]});_0x4842b7[_0xb6be('0x57')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xb6be('0x58'),_0xb6be('0x59')],'raw':!![]});if(_0x31ec33[_0xb6be('0x25')][_0xb6be('0x53')]){_0x4842b7[_0xb6be('0x57')]({'model':db[_0xb6be('0x5a')],'as':'Attachment','raw':!![]});}var _0xade7cf=[{'model':db['WhatsappMessage'],'as':_0xb6be('0x5b'),'attributes':['id','body',_0xb6be('0x5c'),_0xb6be('0x5d'),_0xb6be('0x5e'),'read'],'include':_0x4842b7}];_0xade7cf['push']({'model':db[_0xb6be('0x5f')],'as':_0xb6be('0x60'),'attributes':['id',_0xb6be('0x1c')]});_0xade7cf[_0xb6be('0x57')]({'model':db['User'],'as':_0xb6be('0x61'),'attributes':['id',_0xb6be('0x56')]});return db[_0xb6be('0x28')][_0xb6be('0x32')]({'where':{'id':_0x31ec33['params']['id']},'include':_0xade7cf})[_0xb6be('0x19')](handleEntityNotFound(_0x57d7ca,null))['then'](function(_0x47a6e2){if(_0x47a6e2){var _0x48a224=_0x47a6e2['get']({'plain':!![]});fs[_0xb6be('0x62')](_0x29053f);var _0xfacb43={'channel':_0xb6be('0x63'),'account':_0x48a224[_0xb6be('0x60')][_0xb6be('0x1c')],'agent':_0x48a224[_0xb6be('0x61')]?_0x48a224[_0xb6be('0x61')]['fullname']:_0xb6be('0x64'),'createdAt':moment(_0x48a224['createdAt'])[_0xb6be('0x47')](_0xb6be('0x65'))[_0xb6be('0x66')](),'closedAt':_0x48a224['closed']?moment(_0x48a224[_0xb6be('0x67')])[_0xb6be('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb6be('0x66')]():'','disposition':_0x48a224[_0xb6be('0x68')],'messages':_(_0x48a224[_0xb6be('0x5b')])[_0xb6be('0x43')]({'secret':![]})[_0xb6be('0x1e')](function(_0x3a02a9){if(_0x3a02a9[_0xb6be('0x5a')]){var _0x4e09db=path[_0xb6be('0x52')](_0x1a317f,_0x3a02a9[_0xb6be('0x5a')]['basename']);if(fs[_0xb6be('0x69')](_0x4e09db)){fs[_0xb6be('0x6a')](_0x4e09db)['pipe'](fs['createWriteStream'](path[_0xb6be('0x52')](_0x29053f,_0x3a02a9['Attachment'][_0xb6be('0x6b')])));}}return{'date':moment(_0x3a02a9['createdAt'])[_0xb6be('0x47')](_0xb6be('0x65'))['toString'](),'sender':_0x3a02a9[_0xb6be('0x5d')]===_0xb6be('0x6c')?_0x3a02a9[_0xb6be('0x55')]?_0x3a02a9['User'][_0xb6be('0x56')]:'System':_0x3a02a9[_0xb6be('0x6d')][_0xb6be('0x58')]+(_0x3a02a9['Contact'][_0xb6be('0x59')]?'\x20'+_0x3a02a9['Contact'][_0xb6be('0x59')]:''),'body':_0x3a02a9[_0xb6be('0x5a')]?_0x3a02a9[_0xb6be('0x5a')][_0xb6be('0x6b')]:_0x3a02a9[_0xb6be('0x35')],'direction':_0x3a02a9[_0xb6be('0x5d')]===_0xb6be('0x6c')?'A':'C','secret':_0x3a02a9[_0xb6be('0x5e')],'read':_0x3a02a9[_0xb6be('0x6e')],'attachment':_0x3a02a9[_0xb6be('0x5a')]};})['value']()};return ejs[_0xb6be('0x6f')](path[_0xb6be('0x52')](config[_0xb6be('0x4f')],_0xb6be('0x50'),_0xb6be('0x70'),_0xb6be('0x71')),{'interaction':_0xfacb43})['then'](function(_0x5921a2){var _0x15144d=path['join'](_0x29053f,'transcript-'+_0x48a224['id']+'-'+_0x18ea9e+'.pdf');var _0x4f2906={'path':_0x15144d,'channel':_0xb6be('0x63'),'interactionId':_0x48a224['id']};return pdf[_0xb6be('0x72')](_0x5921a2,_0x4f2906);})[_0xb6be('0x19')](function(){return new BPromise(function(_0x82fc3f,_0x4dd7a0){zipdir(_0x29053f,{'saveTo':_0x3f80c7},function(_0x1b63ff,_0x17bf9f){if(_0x1b63ff)return _0x4dd7a0(_0x1b63ff);return _0x82fc3f(_0x17bf9f);});})[_0xb6be('0x19')](function(){return new BPromise(function(_0x3a6c3f,_0x4d1877){rimraf(_0x29053f,function(_0x3834df){if(_0x3834df)_0x4d1877(_0x3834df);return _0x3a6c3f();});});})[_0xb6be('0x19')](function(){return _0x57d7ca[_0xb6be('0x4e')](_0x3f80c7,_0x3b5d66,function(_0x4a8ed8){if(_0x4a8ed8){console[_0xb6be('0x73')](_0xb6be('0x74'),_0x4a8ed8);}else{fs[_0xb6be('0x75')](_0x3f80c7);}});});});}else{return _0x57d7ca[_0xb6be('0xe')](0xc8);}})[_0xb6be('0x33')](handleError(_0x57d7ca,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5b23040..26a5924 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x544a=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers'];(function(_0x16e79e,_0x354d0f){var _0x34463f=function(_0x468d5e){while(--_0x468d5e){_0x16e79e['push'](_0x16e79e['shift']());}};_0x34463f(++_0x354d0f);}(_0x544a,0x118));var _0xa544=function(_0x170ae0,_0x3daa91){_0x170ae0=_0x170ae0-0x0;var _0x156ef3=_0x544a[_0x170ae0];return _0x156ef3;};'use strict';var EventEmitter=require(_0xa544('0x0'));var WhatsappInteraction=require(_0xa544('0x1'))['db'][_0xa544('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa544('0x3')](0x0);var events={'afterCreate':_0xa544('0x4'),'afterUpdate':_0xa544('0x5'),'afterDestroy':_0xa544('0x6')};function emitEvent(_0x4b4677){return function(_0x4cfd38,_0x4ec0e3,_0x2cb8c5){_0x4cfd38[_0xa544('0x7')]({'attributes':['id'],'raw':!![]})[_0xa544('0x8')](function(_0x5bfa0f){_0x4cfd38[_0xa544('0x9')](_0xa544('0xa'),_0x5bfa0f[_0xa544('0xb')](function(_0x4a0b98){return{'id':_0x4a0b98['id']};}));return WhatsappMessage[_0xa544('0xc')]({'where':{'WhatsappInteractionId':_0x4cfd38['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa544('0x8')](function(_0x35abd7){_0x4cfd38[_0xa544('0x9')]('unreadMessages',_0x35abd7[_0xa544('0xd')]);WhatsappInteractionEvents[_0xa544('0xe')](_0x4b4677+':'+_0x4cfd38['id'],_0x4cfd38);WhatsappInteractionEvents[_0xa544('0xe')](_0x4b4677,_0x4cfd38);_0x2cb8c5(null);})[_0xa544('0xf')](_0x2cb8c5(null));};}for(var e in events){if(events[_0xa544('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xa544('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xf958=['setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports','events','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then'];(function(_0x4c23cc,_0x46193e){var _0x1b1dc2=function(_0x359f0d){while(--_0x359f0d){_0x4c23cc['push'](_0x4c23cc['shift']());}};_0x1b1dc2(++_0x46193e);}(_0xf958,0xe6));var _0x8f95=function(_0x285fd8,_0x34acad){_0x285fd8=_0x285fd8-0x0;var _0x3f122f=_0xf958[_0x285fd8];return _0x3f122f;};'use strict';var EventEmitter=require(_0x8f95('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x8f95('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x8f95('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8f95('0x3'),'afterUpdate':_0x8f95('0x4'),'afterDestroy':_0x8f95('0x5')};function emitEvent(_0x482c0c){return function(_0x49d448,_0x32df52,_0x10a425){_0x49d448[_0x8f95('0x6')]({'attributes':['id'],'raw':!![]})[_0x8f95('0x7')](function(_0x5cfc04){_0x49d448[_0x8f95('0x8')](_0x8f95('0x9'),_0x5cfc04[_0x8f95('0xa')](function(_0x19cbd0){return{'id':_0x19cbd0['id']};}));return WhatsappMessage[_0x8f95('0xb')]({'where':{'WhatsappInteractionId':_0x49d448['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x378eb1){_0x49d448[_0x8f95('0x8')]('unreadMessages',_0x378eb1[_0x8f95('0xc')]);WhatsappInteractionEvents[_0x8f95('0xd')](_0x482c0c+':'+_0x49d448['id'],_0x49d448);WhatsappInteractionEvents[_0x8f95('0xd')](_0x482c0c,_0x49d448);_0x10a425(null);})['catch'](_0x10a425(null));};}for(var e in events){if(events[_0x8f95('0xe')](e)){var event=events[e];WhatsappInteraction[_0x8f95('0xf')](e,emitEvent(event));}}module[_0x8f95('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index cc85837..6afdd56 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x514a=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment'];(function(_0x573ce2,_0x136fac){var _0xbae03=function(_0x478132){while(--_0x478132){_0x573ce2['push'](_0x573ce2['shift']());}};_0xbae03(++_0x136fac);}(_0x514a,0xdc));var _0xa514=function(_0x14abbe,_0x526b94){_0x14abbe=_0x14abbe-0x0;var _0x39a91e=_0x514a[_0x14abbe];return _0x39a91e;};'use strict';var _=require(_0xa514('0x0'));var util=require(_0xa514('0x1'));var logger=require(_0xa514('0x2'))('api');var moment=require(_0xa514('0x3'));var BPromise=require(_0xa514('0x4'));var rp=require(_0xa514('0x5'));var fs=require('fs');var path=require(_0xa514('0x6'));var rimraf=require(_0xa514('0x7'));var config=require(_0xa514('0x8'));var attributes=require(_0xa514('0x9'));module['exports']=function(_0x1c4ac1,_0x25e477){return _0x1c4ac1['define'](_0xa514('0xa'),attributes,{'tableName':_0xa514('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16a82f,_0x41e13f,_0x35805c){if(_0x16a82f['changed'](_0xa514('0xc'))){_0x16a82f[_0xa514('0xd')]=moment()[_0xa514('0xe')](_0xa514('0xf'));}_0x35805c(null,_0x16a82f);}}});}; \ No newline at end of file +var _0xb5ae=['lodash','util','../../config/logger','bluebird','rimraf','./whatsappInteraction.attributes','define','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xd74d2,_0x52a0f5){var _0xdde5c9=function(_0x2a397e){while(--_0x2a397e){_0xd74d2['push'](_0xd74d2['shift']());}};_0xdde5c9(++_0x52a0f5);}(_0xb5ae,0x84));var _0xeb5a=function(_0x1c2314,_0x1e6b5c){_0x1c2314=_0x1c2314-0x0;var _0x48bfd7=_0xb5ae[_0x1c2314];return _0x48bfd7;};'use strict';var _=require(_0xeb5a('0x0'));var util=require(_0xeb5a('0x1'));var logger=require(_0xeb5a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeb5a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeb5a('0x4'));var config=require('../../config/environment');var attributes=require(_0xeb5a('0x5'));module['exports']=function(_0x2c9fca,_0x435760){return _0x2c9fca[_0xeb5a('0x6')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa36a1,_0x406178,_0x2bae58){if(_0xa36a1[_0xeb5a('0x7')](_0xeb5a('0x8'))){_0xa36a1['closedAt']=moment()[_0xeb5a('0x9')](_0xeb5a('0xa'));}_0x2bae58(null,_0xa36a1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1353387..17a9aef 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98d9=['error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','then','AddTagsToWhatsappInteraction','ids','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','debug','request\x20sent','stringify'];(function(_0x413a4f,_0x25550b){var _0x589e4d=function(_0x30cf46){while(--_0x30cf46){_0x413a4f['push'](_0x413a4f['shift']());}};_0x589e4d(++_0x25550b);}(_0x98d9,0x84));var _0x998d=function(_0x283d68,_0x56199e){_0x283d68=_0x283d68-0x0;var _0x184970=_0x98d9[_0x283d68];return _0x184970;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x998d('0x0'));var BPromise=require(_0x998d('0x1'));var rs=require(_0x998d('0x2'));var fs=require('fs');var Redis=require(_0x998d('0x3'));var db=require(_0x998d('0x4'))['db'];var utils=require(_0x998d('0x5'));var logger=require(_0x998d('0x6'))(_0x998d('0x7'));var config=require(_0x998d('0x8'));var jayson=require(_0x998d('0x9'));var client=jayson['client'][_0x998d('0xa')]({'port':0x232a});config[_0x998d('0xb')]=_[_0x998d('0xc')](config[_0x998d('0xb')],{'host':_0x998d('0xd'),'port':0x18eb});var socket=require(_0x998d('0xe'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x521275,_0x5064a7,_0x33069f){return new BPromise(function(_0xd035ca,_0x2a4966){return client[_0x998d('0xf')](_0x521275,_0x33069f)['then'](function(_0x883995){logger[_0x998d('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x5064a7,'request\x20sent');logger[_0x998d('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5064a7,_0x998d('0x12'),JSON[_0x998d('0x13')](_0x883995));if(_0x883995['error']){if(_0x883995[_0x998d('0x14')][_0x998d('0x15')]===0x1f4){logger[_0x998d('0x14')](_0x998d('0x16'),_0x5064a7,_0x883995['error'][_0x998d('0x17')]);return _0x2a4966(_0x883995['error'][_0x998d('0x17')]);}logger[_0x998d('0x14')](_0x998d('0x16'),_0x5064a7,_0x883995[_0x998d('0x14')][_0x998d('0x17')]);return _0xd035ca(_0x883995[_0x998d('0x14')][_0x998d('0x17')]);}else{logger[_0x998d('0x10')](_0x998d('0x16'),_0x5064a7,_0x998d('0x12'));_0xd035ca(_0x883995[_0x998d('0x18')][_0x998d('0x17')]);}})[_0x998d('0x19')](function(_0x814668){logger[_0x998d('0x14')](_0x998d('0x16'),_0x5064a7,_0x814668);_0x2a4966(_0x814668);});});}exports[_0x998d('0x1a')]=function(_0xd9f6d8){var _0x2f7ff2=this;return new Promise(function(_0xd1a255,_0x58f99b){return db[_0x998d('0x1b')][_0x998d('0x1c')](_0xd9f6d8[_0x998d('0x1d')],{'raw':_0xd9f6d8[_0x998d('0x1e')]?_0xd9f6d8[_0x998d('0x1e')][_0x998d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd9f6d8['options']?_0xd9f6d8['options'][_0x998d('0x20')]||null:null,'attributes':_0xd9f6d8[_0x998d('0x1e')]?_0xd9f6d8['options']['attributes']||null:null,'limit':_0xd9f6d8[_0x998d('0x1e')]?_0xd9f6d8[_0x998d('0x1e')][_0x998d('0x21')]||null:null})[_0x998d('0x22')](function(_0x390adb){logger[_0x998d('0x10')]('UpdateWhatsappInteraction',_0xd9f6d8);logger[_0x998d('0x11')]('UpdateWhatsappInteraction',_0xd9f6d8,JSON['stringify'](_0x390adb));_0xd1a255(_0x390adb);})[_0x998d('0x19')](function(_0xf56b3f){logger[_0x998d('0x14')](_0x998d('0x1a'),_0xf56b3f[_0x998d('0x17')],_0xd9f6d8);_0x58f99b(_0x2f7ff2[_0x998d('0x14')](0x1f4,_0xf56b3f['message']));});});};exports[_0x998d('0x23')]=function(_0x707eea){return new Promise(function(_0x4b54b7,_0x1457aa){return db[_0x998d('0x1b')]['find']({'where':_0x707eea[_0x998d('0x1e')]?_0x707eea[_0x998d('0x1e')][_0x998d('0x20')]||null:null})[_0x998d('0x22')](function(_0x26a708){if(_0x26a708){return _0x26a708['addTags'](_0x707eea['body'][_0x998d('0x24')],_['omit'](_0x707eea[_0x998d('0x1d')],[_0x998d('0x24'),'id'])||{});}})['spread'](function(_0x3094ed){logger[_0x998d('0x10')](_0x998d('0x25'),_0x707eea);logger['debug'](_0x998d('0x25'),_0x707eea,JSON[_0x998d('0x13')](_0x3094ed));_0x4b54b7(_0x3094ed);})[_0x998d('0x19')](function(_0x50d963){logger[_0x998d('0x14')](_0x998d('0x25'),_0x50d963[_0x998d('0x17')],_0x707eea);_0x1457aa(_this[_0x998d('0x14')](0x1f4,_0x50d963['message']));});});}; \ No newline at end of file +var _0xb0ea=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x1ab8b3,_0x3b4091){var _0x3770bf=function(_0x31789a){while(--_0x31789a){_0x1ab8b3['push'](_0x1ab8b3['shift']());}};_0x3770bf(++_0x3b4091);}(_0xb0ea,0xeb));var _0xab0e=function(_0x56ca61,_0x187321){_0x56ca61=_0x56ca61-0x0;var _0x1e7bee=_0xb0ea[_0x56ca61];return _0x1e7bee;};'use strict';var _=require(_0xab0e('0x0'));var util=require(_0xab0e('0x1'));var moment=require(_0xab0e('0x2'));var BPromise=require(_0xab0e('0x3'));var rs=require(_0xab0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab0e('0x5'))['db'];var utils=require(_0xab0e('0x6'));var logger=require(_0xab0e('0x7'))('rpc');var config=require(_0xab0e('0x8'));var jayson=require(_0xab0e('0x9'));var client=jayson['client'][_0xab0e('0xa')]({'port':0x232a});config[_0xab0e('0xb')]=_['defaults'](config[_0xab0e('0xb')],{'host':_0xab0e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab0e('0xb')]));require(_0xab0e('0xd'))[_0xab0e('0xe')](socket);function respondWithRpcPromise(_0x3bbc73,_0x1f5848,_0x33f191){return new BPromise(function(_0x54e383,_0x4b98d8){return client[_0xab0e('0xf')](_0x3bbc73,_0x33f191)[_0xab0e('0x10')](function(_0x4482a7){logger[_0xab0e('0x11')](_0xab0e('0x12'),_0x1f5848,_0xab0e('0x13'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1f5848,_0xab0e('0x13'),JSON[_0xab0e('0x14')](_0x4482a7));if(_0x4482a7[_0xab0e('0x15')]){if(_0x4482a7[_0xab0e('0x15')][_0xab0e('0x16')]===0x1f4){logger['error'](_0xab0e('0x12'),_0x1f5848,_0x4482a7[_0xab0e('0x15')][_0xab0e('0x17')]);return _0x4b98d8(_0x4482a7[_0xab0e('0x15')]['message']);}logger[_0xab0e('0x15')](_0xab0e('0x12'),_0x1f5848,_0x4482a7[_0xab0e('0x15')][_0xab0e('0x17')]);return _0x54e383(_0x4482a7[_0xab0e('0x15')][_0xab0e('0x17')]);}else{logger[_0xab0e('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x1f5848,_0xab0e('0x13'));_0x54e383(_0x4482a7[_0xab0e('0x18')]['message']);}})[_0xab0e('0x19')](function(_0x6fb4c6){logger['error'](_0xab0e('0x12'),_0x1f5848,_0x6fb4c6);_0x4b98d8(_0x6fb4c6);});});}exports[_0xab0e('0x1a')]=function(_0x42054b){var _0x2bc673=this;return new Promise(function(_0x14875a,_0x235764){return db[_0xab0e('0x1b')][_0xab0e('0x1c')](_0x42054b[_0xab0e('0x1d')],{'raw':_0x42054b[_0xab0e('0x1e')]?_0x42054b['options'][_0xab0e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42054b[_0xab0e('0x1e')]?_0x42054b[_0xab0e('0x1e')][_0xab0e('0x20')]||null:null,'attributes':_0x42054b[_0xab0e('0x1e')]?_0x42054b[_0xab0e('0x1e')][_0xab0e('0x21')]||null:null,'limit':_0x42054b[_0xab0e('0x1e')]?_0x42054b[_0xab0e('0x1e')]['limit']||null:null})[_0xab0e('0x10')](function(_0x1ee92b){logger[_0xab0e('0x11')]('UpdateWhatsappInteraction',_0x42054b);logger['debug'](_0xab0e('0x1a'),_0x42054b,JSON[_0xab0e('0x14')](_0x1ee92b));_0x14875a(_0x1ee92b);})[_0xab0e('0x19')](function(_0x1730ec){logger[_0xab0e('0x15')](_0xab0e('0x1a'),_0x1730ec['message'],_0x42054b);_0x235764(_0x2bc673['error'](0x1f4,_0x1730ec[_0xab0e('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3178fc){return new Promise(function(_0x5bdb25,_0x16227b){return db[_0xab0e('0x1b')]['find']({'where':_0x3178fc[_0xab0e('0x1e')]?_0x3178fc['options'][_0xab0e('0x20')]||null:null})[_0xab0e('0x10')](function(_0x47ba2a){if(_0x47ba2a){return _0x47ba2a[_0xab0e('0x22')](_0x3178fc[_0xab0e('0x1d')][_0xab0e('0x23')],_[_0xab0e('0x24')](_0x3178fc[_0xab0e('0x1d')],[_0xab0e('0x23'),'id'])||{});}})[_0xab0e('0x25')](function(_0x2812e2){logger[_0xab0e('0x11')](_0xab0e('0x26'),_0x3178fc);logger[_0xab0e('0x27')]('AddTags',_0x3178fc,JSON[_0xab0e('0x14')](_0x2812e2));_0x5bdb25(_0x2812e2);})['catch'](function(_0x2cafc1){logger[_0xab0e('0x15')](_0xab0e('0x26'),_0x2cafc1[_0xab0e('0x17')],_0x3178fc);_0x16227b(_this[_0xab0e('0x15')](0x1f4,_0x2cafc1[_0xab0e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 528d05f..20e7bc4 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfacf=['emit','removeListener','register','./whatsappInteraction.events','save','remove'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xfacf,0xa5));var _0xffac=function(_0xb12135,_0x444af5){_0xb12135=_0xb12135-0x0;var _0xc4641a=_0xfacf[_0xb12135];return _0xc4641a;};'use strict';var WhatsappInteractionEvents=require(_0xffac('0x0'));var events=[_0xffac('0x1'),_0xffac('0x2'),'update'];function createListener(_0x1ff074,_0x5c8c42){return function(_0x335d4f){_0x5c8c42[_0xffac('0x3')](_0x1ff074,_0x335d4f);};}function removeListener(_0x22c0d5,_0x44e572){return function(){WhatsappInteractionEvents[_0xffac('0x4')](_0x22c0d5,_0x44e572);};}exports[_0xffac('0x5')]=function(_0x2ffae9){for(var _0xd8e7b8=0x0,_0x49165c=events['length'];_0xd8e7b8<_0x49165c;_0xd8e7b8++){var _0x4b703c=events[_0xd8e7b8];var _0x3be9f3=createListener('whatsappInteraction:'+_0x4b703c,_0x2ffae9);WhatsappInteractionEvents['on'](_0x4b703c,_0x3be9f3);}}; \ No newline at end of file +var _0xe31c=['remove','update','removeListener','length','whatsappInteraction:','save'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xe31c,0x89));var _0xce31=function(_0x8cb357,_0x268240){_0x8cb357=_0x8cb357-0x0;var _0x4332a9=_0xe31c[_0x8cb357];return _0x4332a9;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xce31('0x0'),_0xce31('0x1'),_0xce31('0x2')];function createListener(_0x24d238,_0x9e64d6){return function(_0x2744b8){_0x9e64d6['emit'](_0x24d238,_0x2744b8);};}function removeListener(_0x118114,_0x4431db){return function(){WhatsappInteractionEvents[_0xce31('0x3')](_0x118114,_0x4431db);};}exports['register']=function(_0x259a47){for(var _0x32e524=0x0,_0x2653a8=events[_0xce31('0x4')];_0x32e524<_0x2653a8;_0x32e524++){var _0x6b4d00=events[_0x32e524];var _0x28eccf=createListener(_0xce31('0x5')+_0x6b4d00,_0x259a47);WhatsappInteractionEvents['on'](_0x6b4d00,_0x28eccf);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 82c2690..900dfcd 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26e7=['show','post','/:id/status','status','put','update','accept','reject','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','isAuthenticated','/describe'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x26e7,0x1aa));var _0x726e=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x26e7[_0x212a37];return _0x5d0bf9;};'use strict';var multer=require(_0x726e('0x0'));var util=require(_0x726e('0x1'));var path=require(_0x726e('0x2'));var timeout=require(_0x726e('0x3'));var express=require(_0x726e('0x4'));var router=express[_0x726e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x726e('0x6'));var interaction=require(_0x726e('0x7'));var config=require('../../config/environment');var controller=require(_0x726e('0x8'));router['get']('/',auth[_0x726e('0x9')](),controller['index']);router['get'](_0x726e('0xa'),auth[_0x726e('0x9')](),controller['describe']);router['get']('/:id',auth[_0x726e('0x9')](),controller[_0x726e('0xb')]);router[_0x726e('0xc')]('/',auth[_0x726e('0x9')](),interaction['tracked']('whatsapp','whatsappmessage:create'),controller['create']);router[_0x726e('0xc')](_0x726e('0xd'),controller[_0x726e('0xe')]);router[_0x726e('0xf')]('/:id',auth[_0x726e('0x9')](),controller[_0x726e('0x10')]);router[_0x726e('0xf')]('/:id/accept',auth[_0x726e('0x9')](),controller[_0x726e('0x11')]);router['put']('/:id/reject',auth[_0x726e('0x9')](),controller[_0x726e('0x12')]);router[_0x726e('0x13')](_0x726e('0x14'),auth[_0x726e('0x9')](),controller[_0x726e('0x15')]);module[_0x726e('0x16')]=router; \ No newline at end of file +var _0xe794=['index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x7e723d,_0x184564){var _0x94afb4=function(_0x818975){while(--_0x818975){_0x7e723d['push'](_0x7e723d['shift']());}};_0x94afb4(++_0x184564);}(_0xe794,0x134));var _0x4e79=function(_0x2b7e74,_0x57147c){_0x2b7e74=_0x2b7e74-0x0;var _0x2d5bb4=_0xe794[_0x2b7e74];return _0x2d5bb4;};'use strict';var multer=require('multer');var util=require(_0x4e79('0x0'));var path=require(_0x4e79('0x1'));var timeout=require(_0x4e79('0x2'));var express=require(_0x4e79('0x3'));var router=express[_0x4e79('0x4')]();var fs_extra=require(_0x4e79('0x5'));var auth=require(_0x4e79('0x6'));var interaction=require(_0x4e79('0x7'));var config=require(_0x4e79('0x8'));var controller=require(_0x4e79('0x9'));router[_0x4e79('0xa')]('/',auth['isAuthenticated'](),controller[_0x4e79('0xb')]);router[_0x4e79('0xa')](_0x4e79('0xc'),auth[_0x4e79('0xd')](),controller[_0x4e79('0xe')]);router[_0x4e79('0xa')](_0x4e79('0xf'),auth[_0x4e79('0xd')](),controller[_0x4e79('0x10')]);router[_0x4e79('0x11')]('/',auth['isAuthenticated'](),interaction[_0x4e79('0x12')]('whatsapp',_0x4e79('0x13')),controller[_0x4e79('0x14')]);router['post']('/:id/status',controller[_0x4e79('0x15')]);router[_0x4e79('0x16')]('/:id',auth[_0x4e79('0xd')](),controller[_0x4e79('0x17')]);router[_0x4e79('0x16')](_0x4e79('0x18'),auth[_0x4e79('0xd')](),controller[_0x4e79('0x19')]);router['put'](_0x4e79('0x1a'),auth[_0x4e79('0xd')](),controller['reject']);router[_0x4e79('0x1b')]('/:id',auth[_0x4e79('0xd')](),controller[_0x4e79('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4c94706..9e3a5c3 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d37=['ENUM','out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x6738e4,_0x4f3880){var _0x5a7387=function(_0x4018da){while(--_0x4018da){_0x6738e4['push'](_0x6738e4['shift']());}};_0x5a7387(++_0x4f3880);}(_0x8d37,0xbc));var _0x78d3=function(_0x2eb8d5,_0x5269cb){_0x2eb8d5=_0x2eb8d5-0x0;var _0x2d1f05=_0x8d37[_0x2eb8d5];return _0x2d1f05;};'use strict';var Sequelize=require(_0x78d3('0x0'));module['exports']={'body':{'type':Sequelize[_0x78d3('0x1')](_0x78d3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x78d3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x78d3('0x4')]('in',_0x78d3('0x5')),'defaultValue':_0x78d3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x78d3('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x78d3('0x7')]},'secret':{'type':Sequelize[_0x78d3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x78d3('0x1')]}}; \ No newline at end of file +var _0xb6a0=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb6a0,0x13d));var _0x0b6a=function(_0xdabb7,_0x59874d){_0xdabb7=_0xdabb7-0x0;var _0x58410e=_0xb6a0[_0xdabb7];return _0x58410e;};'use strict';var Sequelize=require(_0x0b6a('0x0'));module[_0x0b6a('0x1')]={'body':{'type':Sequelize[_0x0b6a('0x2')](_0x0b6a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0b6a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0b6a('0x5')),'defaultValue':_0x0b6a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0b6a('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0b6a('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0b6a('0x6')]},'providerResponse':{'type':Sequelize[_0x0b6a('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5ce9a68..e2334e1 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebfb=['WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','WhatsappMessage','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','whatsapp-interactions','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','format','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','contact','fullname','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','info','WhatsappMessage,\x20%s,\x20%s','debug'];(function(_0xbf2f5,_0x576dd5){var _0x52c3db=function(_0x36433c){while(--_0x36433c){_0xbf2f5['push'](_0xbf2f5['shift']());}};_0x52c3db(++_0x576dd5);}(_0xebfb,0x187));var _0xbebf=function(_0x30bd36,_0x1b934b){_0x30bd36=_0x30bd36-0x0;var _0x5976b1=_0xebfb[_0x30bd36];return _0x5976b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbebf('0x0'));var zipdir=require(_0xbebf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbebf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbebf('0x3'));var util=require(_0xbebf('0x4'));var path=require(_0xbebf('0x5'));var sox=require(_0xbebf('0x6'));var csv=require(_0xbebf('0x7'));var ejs=require(_0xbebf('0x8'));var fs=require('fs');var fs_extra=require(_0xbebf('0x9'));var _=require(_0xbebf('0xa'));var squel=require(_0xbebf('0xb'));var crypto=require(_0xbebf('0xc'));var jsforce=require(_0xbebf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbebf('0x7'));var querystring=require(_0xbebf('0xe'));var Papa=require(_0xbebf('0xf'));var Redis=require('ioredis');var authService=require(_0xbebf('0x10'));var qs=require(_0xbebf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbebf('0x12'));var logger=require(_0xbebf('0x13'))(_0xbebf('0x14'));var utils=require(_0xbebf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbebf('0x16'));var db=require(_0xbebf('0x17'))['db'];config[_0xbebf('0x18')]=_[_0xbebf('0x19')](config[_0xbebf('0x18')],{'host':_0xbebf('0x1a'),'port':0x18eb});var socket=require(_0xbebf('0x1b'))(new Redis(config[_0xbebf('0x18')]));require(_0xbebf('0x1c'))[_0xbebf('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbebf('0x1e')][_0xbebf('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4298ff,_0x13c4bc,_0x1afea7,_0x501167){return new BPromise(function(_0x695f88,_0x40468c){var _0x1251d8=_0x501167||client;return _0x1251d8['request'](_0x4298ff,_0x1afea7)['then'](function(_0x57c6f4){logger[_0xbebf('0x20')](_0xbebf('0x21'),_0x13c4bc,'request\x20sent');logger[_0xbebf('0x22')](_0xbebf('0x23'),_0x13c4bc,'request\x20sent',JSON[_0xbebf('0x24')](_0x57c6f4));if(_0x57c6f4['error']){if(_0x57c6f4[_0xbebf('0x25')][_0xbebf('0x26')]===0x1f4){logger[_0xbebf('0x25')](_0xbebf('0x21'),_0x13c4bc,_0x57c6f4[_0xbebf('0x25')][_0xbebf('0x27')]);return _0x40468c(_0x57c6f4[_0xbebf('0x25')][_0xbebf('0x27')]);}logger[_0xbebf('0x25')](_0xbebf('0x21'),_0x13c4bc,_0x57c6f4[_0xbebf('0x25')][_0xbebf('0x27')]);return _0x695f88(_0x57c6f4[_0xbebf('0x25')][_0xbebf('0x27')]);}else{logger[_0xbebf('0x20')](_0xbebf('0x21'),_0x13c4bc,_0xbebf('0x28'));_0x695f88(_0x57c6f4['result'][_0xbebf('0x27')]);}})['catch'](function(_0x5c8fdb){logger[_0xbebf('0x25')](_0xbebf('0x21'),_0x13c4bc,_0x5c8fdb);_0x40468c(_0x5c8fdb);});});}function respondWithStatusCode(_0x1ef6a1,_0x4b8ca){_0x4b8ca=_0x4b8ca||0xcc;return function(_0x17bbf8){if(_0x17bbf8){return _0x1ef6a1[_0xbebf('0x29')](_0x4b8ca);}return _0x1ef6a1[_0xbebf('0x2a')](_0x4b8ca)['end']();};}function respondWithResult(_0xcb78d7,_0x2dcdf1){_0x2dcdf1=_0x2dcdf1||0xc8;return function(_0x11644b){if(_0x11644b){return _0xcb78d7['status'](_0x2dcdf1)[_0xbebf('0x2b')](_0x11644b);}};}function respondWithFilteredResult(_0x1d02a9,_0x1822f7){return function(_0x5673a7){if(_0x5673a7){var _0xf4928d=typeof _0x1822f7[_0xbebf('0x2c')]===_0xbebf('0x2d')&&typeof _0x1822f7[_0xbebf('0x2e')]===_0xbebf('0x2d');var _0x5d16f4=_0x5673a7[_0xbebf('0x2f')];var _0x3b55fe=_0xf4928d?0x0:_0x1822f7[_0xbebf('0x2c')];var _0x1f73e6=_0xf4928d?_0x5673a7[_0xbebf('0x2f')]:_0x1822f7[_0xbebf('0x2c')]+_0x1822f7[_0xbebf('0x2e')];var _0x1c5e69;if(_0x1f73e6>=_0x5d16f4){_0x1f73e6=_0x5d16f4;_0x1c5e69=0xc8;}else{_0x1c5e69=0xce;}_0x1d02a9['status'](_0x1c5e69);return _0x1d02a9[_0xbebf('0x30')](_0xbebf('0x31'),_0x3b55fe+'-'+_0x1f73e6+'/'+_0x5d16f4)[_0xbebf('0x2b')](_0x5673a7);}return null;};}function patchUpdates(_0x50fbe1){return function(_0x196aba){try{jsonpatch['apply'](_0x196aba,_0x50fbe1,!![]);}catch(_0x1df98f){return BPromise[_0xbebf('0x32')](_0x1df98f);}return _0x196aba[_0xbebf('0x33')]();};}function saveUpdates(_0x198fce,_0x31e47a){return function(_0x388110){if(_0x388110){return _0x388110['update'](_0x198fce)['then'](function(_0x263fa0){return _0x263fa0;});}return null;};}function removeEntity(_0x1e3f24,_0xf2e51d){return function(_0x156e72){if(_0x156e72){return _0x156e72[_0xbebf('0x34')]()[_0xbebf('0x35')](function(){_0x1e3f24[_0xbebf('0x2a')](0xcc)[_0xbebf('0x36')]();});}};}function handleEntityNotFound(_0x4e678a,_0x19cebd){return function(_0x471b8a){if(!_0x471b8a){_0x4e678a[_0xbebf('0x29')](0x194);}return _0x471b8a;};}function handleError(_0x4b2f82,_0x9f787){_0x9f787=_0x9f787||0x1f4;return function(_0x537bca){logger['error'](_0x537bca[_0xbebf('0x37')]);if(_0x537bca[_0xbebf('0x38')]){delete _0x537bca[_0xbebf('0x38')];}_0x4b2f82[_0xbebf('0x2a')](_0x9f787)[_0xbebf('0x39')](_0x537bca);};}exports['index']=function(_0x5627f6,_0x1aaf78){var _0xfdb447={},_0x5a6624={},_0x544f5d={'count':0x0,'rows':[]};var _0x5167b3=_[_0xbebf('0x3a')](db['WhatsappMessage'][_0xbebf('0x3b')],function(_0xa48384){return{'name':_0xa48384[_0xbebf('0x3c')],'type':_0xa48384[_0xbebf('0x3d')][_0xbebf('0x3e')]};});_0x5a6624[_0xbebf('0x3f')]=_['map'](_0x5167b3,'name');_0x5a6624['query']=_[_0xbebf('0x40')](_0x5627f6[_0xbebf('0x41')]);_0x5a6624[_0xbebf('0x42')]=_['intersection'](_0x5a6624[_0xbebf('0x3f')],_0x5a6624[_0xbebf('0x41')]);_0xfdb447[_0xbebf('0x43')]=_['intersection'](_0x5a6624[_0xbebf('0x3f')],qs[_0xbebf('0x44')](_0x5627f6[_0xbebf('0x41')]['fields']));_0xfdb447[_0xbebf('0x43')]=_0xfdb447[_0xbebf('0x43')][_0xbebf('0x45')]?_0xfdb447[_0xbebf('0x43')]:_0x5a6624[_0xbebf('0x3f')];if(!_0x5627f6[_0xbebf('0x41')][_0xbebf('0x46')](_0xbebf('0x47'))){_0xfdb447['limit']=qs[_0xbebf('0x2e')](_0x5627f6[_0xbebf('0x41')]['limit']);_0xfdb447[_0xbebf('0x2c')]=qs['offset'](_0x5627f6[_0xbebf('0x41')]['offset']);}_0xfdb447['order']=qs['sort'](_0x5627f6['query']['sort']);_0xfdb447[_0xbebf('0x48')]=qs[_0xbebf('0x42')](_[_0xbebf('0x49')](_0x5627f6['query'],_0x5a6624[_0xbebf('0x42')]),_0x5167b3);if(_0x5627f6[_0xbebf('0x41')][_0xbebf('0x4a')]){_0xfdb447[_0xbebf('0x48')]=_[_0xbebf('0x4b')](_0xfdb447['where'],{'$or':_[_0xbebf('0x3a')](_0x5167b3,function(_0x16004e){if(_0x16004e['type']!==_0xbebf('0x4c')){var _0x5e0412={};_0x5e0412[_0x16004e['name']]={'$like':'%'+_0x5627f6[_0xbebf('0x41')][_0xbebf('0x4a')]+'%'};return _0x5e0412;}})});}_0xfdb447=_[_0xbebf('0x4b')]({},_0xfdb447,_0x5627f6['options']);var _0x7acd21={'where':_0xfdb447[_0xbebf('0x48')]};return db[_0xbebf('0x4d')][_0xbebf('0x2f')](_0x7acd21)[_0xbebf('0x35')](function(_0x3d917e){_0x544f5d[_0xbebf('0x2f')]=_0x3d917e;if(_0x5627f6[_0xbebf('0x41')][_0xbebf('0x4e')]){_0xfdb447[_0xbebf('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xbebf('0x50')](_0xfdb447);})[_0xbebf('0x35')](function(_0x50b375){_0x544f5d[_0xbebf('0x51')]=_0x50b375;return _0x544f5d;})[_0xbebf('0x35')](respondWithFilteredResult(_0x1aaf78,_0xfdb447))[_0xbebf('0x52')](handleError(_0x1aaf78,null));};exports[_0xbebf('0x53')]=function(_0x397710,_0x2ff64a){var _0x30d8b7={'raw':!![],'where':{'id':_0x397710[_0xbebf('0x54')]['id']}},_0x3d131b={};_0x3d131b[_0xbebf('0x3f')]=_[_0xbebf('0x40')](db[_0xbebf('0x4d')]['rawAttributes']);_0x3d131b['query']=_[_0xbebf('0x40')](_0x397710['query']);_0x3d131b['filters']=_[_0xbebf('0x55')](_0x3d131b[_0xbebf('0x3f')],_0x3d131b['query']);_0x30d8b7[_0xbebf('0x43')]=_[_0xbebf('0x55')](_0x3d131b[_0xbebf('0x3f')],qs[_0xbebf('0x44')](_0x397710[_0xbebf('0x41')][_0xbebf('0x44')]));_0x30d8b7[_0xbebf('0x43')]=_0x30d8b7[_0xbebf('0x43')][_0xbebf('0x45')]?_0x30d8b7[_0xbebf('0x43')]:_0x3d131b[_0xbebf('0x3f')];if(_0x397710['query'][_0xbebf('0x4e')]){_0x30d8b7['include']=[{'all':!![]}];}_0x30d8b7=_[_0xbebf('0x4b')]({},_0x30d8b7,_0x397710['options']);return db['WhatsappMessage'][_0xbebf('0x56')](_0x30d8b7)[_0xbebf('0x35')](handleEntityNotFound(_0x2ff64a,null))[_0xbebf('0x35')](respondWithResult(_0x2ff64a,null))[_0xbebf('0x52')](handleError(_0x2ff64a,null));};exports['create']=function(_0x55711f,_0x5aae50){return db['WhatsappMessage'][_0xbebf('0x57')](_0x55711f['body'],{})['then'](respondWithResult(_0x5aae50,0xc9))[_0xbebf('0x52')](handleError(_0x5aae50,null));};exports['update']=function(_0x4cd9d2,_0x21d2e9){if(_0x4cd9d2[_0xbebf('0x58')]['id']){delete _0x4cd9d2['body']['id'];}return db[_0xbebf('0x4d')][_0xbebf('0x56')]({'where':{'id':_0x4cd9d2[_0xbebf('0x54')]['id']}})[_0xbebf('0x35')](handleEntityNotFound(_0x21d2e9,null))[_0xbebf('0x35')](saveUpdates(_0x4cd9d2[_0xbebf('0x58')],null))[_0xbebf('0x35')](respondWithResult(_0x21d2e9,null))[_0xbebf('0x52')](handleError(_0x21d2e9,null));};exports[_0xbebf('0x34')]=function(_0x436e69,_0x1aae88){return db[_0xbebf('0x4d')][_0xbebf('0x56')]({'where':{'id':_0x436e69[_0xbebf('0x54')]['id']}})[_0xbebf('0x35')](handleEntityNotFound(_0x1aae88,null))['then'](removeEntity(_0x1aae88,null))['catch'](handleError(_0x1aae88,null));};exports['describe']=function(_0x24c7cd,_0xc2ff77){return db[_0xbebf('0x4d')]['describe']()['then'](respondWithResult(_0xc2ff77,null))[_0xbebf('0x52')](handleError(_0xc2ff77,null));};var interaction_log=require('../../config/logger')(_0xbebf('0x59'));exports['accept']=function(_0x500ecf,_0x3e108e,_0x598075){var _0x11bf21={'agent':{},'channel':_0xbebf('0x5a')};if(_0x500ecf['body']['id']){delete _0x500ecf[_0xbebf('0x58')]['id'];}_0x500ecf[_0xbebf('0x58')][_0xbebf('0x5b')]=!![];_0x500ecf[_0xbebf('0x58')][_0xbebf('0x5c')]=moment()['format'](_0xbebf('0x5d'));_0x500ecf[_0xbebf('0x58')][_0xbebf('0x5e')]=_0x500ecf['body'][_0xbebf('0x5e')]||_0x500ecf[_0xbebf('0x5f')]['id'];_0x11bf21[_0xbebf('0x60')]['id']=_0x500ecf[_0xbebf('0x58')][_0xbebf('0x5e')];return db[_0xbebf('0x4d')][_0xbebf('0x56')]({'where':{'id':_0x500ecf[_0xbebf('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e108e,null))[_0xbebf('0x35')](saveUpdates(_0x500ecf[_0xbebf('0x58')],null))[_0xbebf('0x35')](function(_0x1f364a){if(_0x1f364a){_0x11bf21[_0xbebf('0x27')]=_0x1f364a[_0xbebf('0x61')]({'plain':!![]});return db[_0xbebf('0x62')]['find']({'where':{'id':_0x1f364a[_0xbebf('0x63')]}});}return null;})[_0xbebf('0x35')](handleEntityNotFound(_0x3e108e,null))[_0xbebf('0x35')](function(_0x249626){if(_0x249626){return _0x249626[_0xbebf('0x64')]({'UserId':_0x500ecf[_0xbebf('0x58')][_0xbebf('0x5e')],'read1stAt':_[_0xbebf('0x65')](_0x249626[_0xbebf('0x66')])?moment()[_0xbebf('0x67')](_0xbebf('0x5d')):undefined});}return null;})[_0xbebf('0x35')](function(_0x50d1f8){if(_0x50d1f8){_0x11bf21[_0xbebf('0x68')]=_0x50d1f8['get']({'plain':!![]});interaction_log[_0xbebf('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x500ecf[_0xbebf('0x5f')]['id'],_0x500ecf[_0xbebf('0x5f')][_0xbebf('0x38')],_0x500ecf[_0xbebf('0x5f')]['role'],_0x11bf21[_0xbebf('0x68')]['id'],_0x500ecf[_0xbebf('0x58')]?JSON[_0xbebf('0x24')](_0x500ecf[_0xbebf('0x58')]):_0xbebf('0x69'));return respondWithRpcPromise(_0xbebf('0x6a'),_0xbebf('0x6b'),_0x11bf21);}return null;})['then'](function(_0x3f1c79){var _0x3e67ca=_0xbebf('0x6c')+_0x3f1c79[_0xbebf('0x27')][_0xbebf('0x6d')];return db[_0xbebf('0x6e')][_0xbebf('0x41')](_0x3e67ca,{'type':db[_0xbebf('0x6f')][_0xbebf('0x70')][_0xbebf('0x71')],'raw':!![]})[_0xbebf('0x35')](function(_0x59ed93){return _0x59ed93;});})[_0xbebf('0x35')](function(_0x3dfca1){if(_0x3dfca1){_0x11bf21[_0xbebf('0x27')]['contact']=_0x3dfca1[0x0];if(!_0x500ecf[_0xbebf('0x58')][_0xbebf('0x5e')])return;return db[_0xbebf('0x72')][_0xbebf('0x56')]({'where':{'id':_0x500ecf[_0xbebf('0x58')]['UserId'],'role':_0xbebf('0x60')},'attributes':['id',_0xbebf('0x38'),'fullname',_0xbebf('0x73'),_0xbebf('0x74')],'raw':!![]});}return null;})[_0xbebf('0x35')](function(_0x5a4657){if(!_0x5a4657)return null;_0x11bf21[_0xbebf('0x27')][_0xbebf('0x60')]=_0x5a4657;return _0x11bf21;})[_0xbebf('0x35')](function(_0x45c6c8){if(_0x45c6c8){if(_0x500ecf[_0xbebf('0x58')][_0xbebf('0x75')]){_0x11bf21[_0xbebf('0x27')][_0xbebf('0x76')]=util[_0xbebf('0x67')](_0xbebf('0x77'),_0x500ecf[_0xbebf('0x5f')]['name']);_0x11bf21['message']['channel']=_0x11bf21[_0xbebf('0x78')];_0x11bf21[_0xbebf('0x27')][_0xbebf('0x79')]=_0x11bf21[_0xbebf('0x78')];_0x11bf21[_0xbebf('0x27')][_0xbebf('0x7a')]=_0xbebf('0x7b');return respondWithRpcPromise(_0xbebf('0x7c'),_0xbebf('0x7c'),{'event':_0xbebf('0x7d'),'message':_0x11bf21['message']},client9002)[_0xbebf('0x35')](function(){return _0x11bf21;});}return _0x11bf21;}return null;})[_0xbebf('0x35')](respondWithResult(_0x3e108e,null))[_0xbebf('0x52')](handleError(_0x3e108e,null));};var interaction_log=require(_0xbebf('0x13'))(_0xbebf('0x59'));exports[_0xbebf('0x32')]=function(_0x13d1c2,_0x84ee58,_0x289675){var _0xd52f21={'agent':{},'channel':'whatsapp'};if(_0x13d1c2[_0xbebf('0x58')]['id']){delete _0x13d1c2['body']['id'];}_0x13d1c2['body']['UserId']=_0x13d1c2[_0xbebf('0x58')][_0xbebf('0x5e')]||_0x13d1c2[_0xbebf('0x5f')]['id'];_0xd52f21[_0xbebf('0x60')]['id']=_0x13d1c2['body'][_0xbebf('0x5e')];return db[_0xbebf('0x4d')]['find']({'where':{'id':_0x13d1c2[_0xbebf('0x54')]['id'],'UserId':null}})[_0xbebf('0x35')](handleEntityNotFound(_0x84ee58,null))[_0xbebf('0x35')](function(_0x2a22fb){if(_0x2a22fb){_0xd52f21[_0xbebf('0x27')]=_0x2a22fb[_0xbebf('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0xbebf('0x56')]({'where':{'id':_0x2a22fb['WhatsappInteractionId']}});}return null;})[_0xbebf('0x35')](handleEntityNotFound(_0x84ee58,null))[_0xbebf('0x35')](function(_0x1356bb){if(_0x1356bb){_0xd52f21['interaction']=_0x1356bb[_0xbebf('0x61')]({'plain':!![]});interaction_log['info'](_0xbebf('0x7e'),_0x13d1c2[_0xbebf('0x5f')]['id'],_0x13d1c2[_0xbebf('0x5f')][_0xbebf('0x38')],_0x13d1c2[_0xbebf('0x5f')][_0xbebf('0x7f')],_0xd52f21[_0xbebf('0x68')]['id'],_0x13d1c2['body']?JSON[_0xbebf('0x24')](_0x13d1c2[_0xbebf('0x58')]):'null');return respondWithRpcPromise(_0xbebf('0x80'),_0xbebf('0x81'),_0xd52f21);}return null;})[_0xbebf('0x35')](function(_0x47378e){var _0x23d054=_0xbebf('0x6c')+_0x47378e[_0xbebf('0x27')][_0xbebf('0x6d')];return db[_0xbebf('0x6e')][_0xbebf('0x41')](_0x23d054,{'type':db[_0xbebf('0x6f')][_0xbebf('0x70')][_0xbebf('0x71')],'raw':!![]})[_0xbebf('0x35')](function(_0x51446c){return _0x51446c;});})[_0xbebf('0x35')](function(_0x117581){if(_0x117581){_0xd52f21[_0xbebf('0x27')][_0xbebf('0x82')]=_0x117581[0x0];if(!_0x13d1c2['body'][_0xbebf('0x5e')])return;return db['User'][_0xbebf('0x56')]({'where':{'id':_0x13d1c2[_0xbebf('0x58')][_0xbebf('0x5e')],'role':'agent'},'attributes':['id',_0xbebf('0x38'),_0xbebf('0x83'),'email','internal'],'raw':!![]});}return null;})[_0xbebf('0x35')](function(_0x955c29){if(!_0x955c29)return null;_0xd52f21[_0xbebf('0x27')][_0xbebf('0x60')]=_0x955c29;return _0xd52f21;})['then'](function(_0x1be50b){if(_0x1be50b){_0x1be50b['message']['interface']=util['format']('SIP/%s',_0x13d1c2[_0xbebf('0x5f')][_0xbebf('0x38')]);_0x1be50b['message'][_0xbebf('0x78')]=_0xd52f21[_0xbebf('0x78')];_0x1be50b[_0xbebf('0x27')][_0xbebf('0x79')]=_0xd52f21[_0xbebf('0x78')];_0x1be50b[_0xbebf('0x27')][_0xbebf('0x7a')]='reject';respondWithRpcPromise(_0xbebf('0x7c'),_0xbebf('0x7c'),{'event':_0xbebf('0x84'),'message':_0x1be50b['message']},client9002);return _0xd52f21;}return null;})[_0xbebf('0x35')](respondWithResult(_0x84ee58,null))[_0xbebf('0x52')](handleError(_0x84ee58,null));};exports[_0xbebf('0x2a')]=function(_0x109ba7,_0x37c6cf,_0x343fd){if(_0x109ba7['body']['id']){delete _0x109ba7[_0xbebf('0x58')]['id'];}var _0x3ae3bf;return db[_0xbebf('0x4d')][_0xbebf('0x56')]({'where':{'id':_0x109ba7['params']['id']}})['then'](handleEntityNotFound(_0x37c6cf,null))['then'](function(_0x8a42fc){if(_0x8a42fc){_0x3ae3bf=_0x8a42fc;return db['WhatsappAccount'][_0xbebf('0x56')]({'where':{'id':_0x8a42fc[_0xbebf('0x85')]}});}})[_0xbebf('0x35')](handleEntityNotFound(_0x37c6cf,null))[_0xbebf('0x35')](function(_0x4bc431){if(_0x4bc431){logger[_0xbebf('0x22')](_0xbebf('0x86'),_0xbebf('0x2a'),_0xbebf('0x87'),_0x4bc431[_0xbebf('0x3d')],util[_0xbebf('0x88')](_0x109ba7[_0xbebf('0x58')],{'showHidden':![],'depth':null}));switch(_0x4bc431['type']){case _0xbebf('0x89'):if(_0x109ba7[_0xbebf('0x58')][_0xbebf('0x8a')]&&_0x109ba7[_0xbebf('0x58')][_0xbebf('0x8a')]===_0x3ae3bf[_0xbebf('0x8b')]&&_0x109ba7[_0xbebf('0x58')][_0xbebf('0x8c')]&&_0x109ba7[_0xbebf('0x58')][_0xbebf('0x8c')]===_0xbebf('0x5b')){return _0x3ae3bf[_0xbebf('0x64')]({'read':!![]});}else{logger[_0xbebf('0x25')](_0xbebf('0x8d'),_0xbebf('0x2a'),'twilio',util['inspect'](_0x109ba7[_0xbebf('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3ae3bf;}})[_0xbebf('0x35')](respondWithResult(_0x37c6cf,null))[_0xbebf('0x52')](handleError(_0x37c6cf,null));}; \ No newline at end of file +var _0x52c0=['VIRTUAL','options','includeAll','rows','show','params','length','include','find','create','body','describe','../../config/logger','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','internal','manual','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','email','interface','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','send','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0x52c0,0x15c));var _0x052c=function(_0x4aba7b,_0x11304d){_0x4aba7b=_0x4aba7b-0x0;var _0x39bd2d=_0x52c0[_0x4aba7b];return _0x39bd2d;};'use strict';var emlformat=require(_0x052c('0x0'));var rimraf=require(_0x052c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x052c('0x2'));var BPromise=require(_0x052c('0x3'));var Mustache=require(_0x052c('0x4'));var util=require(_0x052c('0x5'));var path=require('path');var sox=require(_0x052c('0x6'));var csv=require(_0x052c('0x7'));var ejs=require(_0x052c('0x8'));var fs=require('fs');var fs_extra=require(_0x052c('0x9'));var _=require(_0x052c('0xa'));var squel=require(_0x052c('0xb'));var crypto=require(_0x052c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x052c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x052c('0xe'));var Redis=require(_0x052c('0xf'));var authService=require(_0x052c('0x10'));var qs=require(_0x052c('0x11'));var as=require(_0x052c('0x12'));var hardwareService=require(_0x052c('0x13'));var logger=require('../../config/logger')(_0x052c('0x14'));var utils=require(_0x052c('0x15'));var config=require(_0x052c('0x16'));var licenseUtil=require(_0x052c('0x17'));var db=require(_0x052c('0x18'))['db'];config[_0x052c('0x19')]=_[_0x052c('0x1a')](config[_0x052c('0x19')],{'host':_0x052c('0x1b'),'port':0x18eb});var socket=require(_0x052c('0x1c'))(new Redis(config[_0x052c('0x19')]));require(_0x052c('0x1d'))[_0x052c('0x1e')](socket);var jayson=require(_0x052c('0x1f'));var client=jayson['client'][_0x052c('0x20')]({'port':0x232c});var client9002=jayson[_0x052c('0x21')][_0x052c('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x575fb7,_0x51f346,_0x623c90,_0x20acaa){return new BPromise(function(_0x399e3e,_0x255f6d){var _0x18992a=_0x20acaa||client;return _0x18992a[_0x052c('0x22')](_0x575fb7,_0x623c90)['then'](function(_0xb16cda){logger[_0x052c('0x23')](_0x052c('0x24'),_0x51f346,_0x052c('0x25'));logger['debug'](_0x052c('0x26'),_0x51f346,_0x052c('0x25'),JSON[_0x052c('0x27')](_0xb16cda));if(_0xb16cda[_0x052c('0x28')]){if(_0xb16cda['error']['code']===0x1f4){logger[_0x052c('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x51f346,_0xb16cda['error'][_0x052c('0x29')]);return _0x255f6d(_0xb16cda[_0x052c('0x28')][_0x052c('0x29')]);}logger[_0x052c('0x28')](_0x052c('0x24'),_0x51f346,_0xb16cda[_0x052c('0x28')]['message']);return _0x399e3e(_0xb16cda[_0x052c('0x28')][_0x052c('0x29')]);}else{logger[_0x052c('0x23')](_0x052c('0x24'),_0x51f346,_0x052c('0x25'));_0x399e3e(_0xb16cda[_0x052c('0x2a')]['message']);}})[_0x052c('0x2b')](function(_0x18cb64){logger['error'](_0x052c('0x24'),_0x51f346,_0x18cb64);_0x255f6d(_0x18cb64);});});}function respondWithStatusCode(_0x3f4c0a,_0x4d7bfa){_0x4d7bfa=_0x4d7bfa||0xcc;return function(_0x5e608e){if(_0x5e608e){return _0x3f4c0a[_0x052c('0x2c')](_0x4d7bfa);}return _0x3f4c0a[_0x052c('0x2d')](_0x4d7bfa)[_0x052c('0x2e')]();};}function respondWithResult(_0x365682,_0x490b04){_0x490b04=_0x490b04||0xc8;return function(_0x28cbec){if(_0x28cbec){return _0x365682[_0x052c('0x2d')](_0x490b04)[_0x052c('0x2f')](_0x28cbec);}};}function respondWithFilteredResult(_0x81ca58,_0x45ada7){return function(_0x345c17){if(_0x345c17){var _0x3327b3=typeof _0x45ada7[_0x052c('0x30')]===_0x052c('0x31')&&typeof _0x45ada7[_0x052c('0x32')]==='undefined';var _0x4206ec=_0x345c17[_0x052c('0x33')];var _0x543519=_0x3327b3?0x0:_0x45ada7['offset'];var _0x5123bd=_0x3327b3?_0x345c17[_0x052c('0x33')]:_0x45ada7[_0x052c('0x30')]+_0x45ada7[_0x052c('0x32')];var _0x549264;if(_0x5123bd>=_0x4206ec){_0x5123bd=_0x4206ec;_0x549264=0xc8;}else{_0x549264=0xce;}_0x81ca58[_0x052c('0x2d')](_0x549264);return _0x81ca58['set'](_0x052c('0x34'),_0x543519+'-'+_0x5123bd+'/'+_0x4206ec)[_0x052c('0x2f')](_0x345c17);}return null;};}function patchUpdates(_0x536488){return function(_0x58e410){try{jsonpatch[_0x052c('0x35')](_0x58e410,_0x536488,!![]);}catch(_0x3d6c78){return BPromise[_0x052c('0x36')](_0x3d6c78);}return _0x58e410[_0x052c('0x37')]();};}function saveUpdates(_0x42948d,_0x4228f5){return function(_0x5056a4){if(_0x5056a4){return _0x5056a4[_0x052c('0x38')](_0x42948d)[_0x052c('0x39')](function(_0x1e31eb){return _0x1e31eb;});}return null;};}function removeEntity(_0x4178c7,_0x3af785){return function(_0x2ddfc6){if(_0x2ddfc6){return _0x2ddfc6[_0x052c('0x3a')]()[_0x052c('0x39')](function(){_0x4178c7[_0x052c('0x2d')](0xcc)[_0x052c('0x2e')]();});}};}function handleEntityNotFound(_0x10aaf4,_0x535ea7){return function(_0x1394f2){if(!_0x1394f2){_0x10aaf4[_0x052c('0x2c')](0x194);}return _0x1394f2;};}function handleError(_0x2728e7,_0x5aad47){_0x5aad47=_0x5aad47||0x1f4;return function(_0x398efe){logger['error'](_0x398efe[_0x052c('0x3b')]);if(_0x398efe['name']){delete _0x398efe['name'];}_0x2728e7['status'](_0x5aad47)[_0x052c('0x3c')](_0x398efe);};}exports['index']=function(_0x42b67a,_0x453b6d){var _0x1ef188={},_0x441d79={},_0x4c4f9d={'count':0x0,'rows':[]};var _0x3be8a9=_['map'](db[_0x052c('0x3d')][_0x052c('0x3e')],function(_0x24f79d){return{'name':_0x24f79d[_0x052c('0x3f')],'type':_0x24f79d[_0x052c('0x40')][_0x052c('0x41')]};});_0x441d79[_0x052c('0x42')]=_[_0x052c('0x43')](_0x3be8a9,'name');_0x441d79[_0x052c('0x44')]=_[_0x052c('0x45')](_0x42b67a['query']);_0x441d79[_0x052c('0x46')]=_['intersection'](_0x441d79[_0x052c('0x42')],_0x441d79[_0x052c('0x44')]);_0x1ef188[_0x052c('0x47')]=_[_0x052c('0x48')](_0x441d79[_0x052c('0x42')],qs['fields'](_0x42b67a['query'][_0x052c('0x49')]));_0x1ef188['attributes']=_0x1ef188[_0x052c('0x47')]['length']?_0x1ef188[_0x052c('0x47')]:_0x441d79[_0x052c('0x42')];if(!_0x42b67a[_0x052c('0x44')][_0x052c('0x4a')](_0x052c('0x4b'))){_0x1ef188[_0x052c('0x32')]=qs['limit'](_0x42b67a[_0x052c('0x44')][_0x052c('0x32')]);_0x1ef188[_0x052c('0x30')]=qs[_0x052c('0x30')](_0x42b67a['query'][_0x052c('0x30')]);}_0x1ef188['order']=qs[_0x052c('0x4c')](_0x42b67a[_0x052c('0x44')][_0x052c('0x4c')]);_0x1ef188[_0x052c('0x4d')]=qs[_0x052c('0x46')](_[_0x052c('0x4e')](_0x42b67a[_0x052c('0x44')],_0x441d79[_0x052c('0x46')]),_0x3be8a9);if(_0x42b67a['query'][_0x052c('0x4f')]){_0x1ef188[_0x052c('0x4d')]=_[_0x052c('0x50')](_0x1ef188[_0x052c('0x4d')],{'$or':_[_0x052c('0x43')](_0x3be8a9,function(_0x2748a5){if(_0x2748a5['type']!==_0x052c('0x51')){var _0x1fdfd4={};_0x1fdfd4[_0x2748a5['name']]={'$like':'%'+_0x42b67a['query']['filter']+'%'};return _0x1fdfd4;}})});}_0x1ef188=_[_0x052c('0x50')]({},_0x1ef188,_0x42b67a[_0x052c('0x52')]);var _0x18752a={'where':_0x1ef188[_0x052c('0x4d')]};return db[_0x052c('0x3d')]['count'](_0x18752a)[_0x052c('0x39')](function(_0xfc585c){_0x4c4f9d['count']=_0xfc585c;if(_0x42b67a[_0x052c('0x44')][_0x052c('0x53')]){_0x1ef188['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x1ef188);})[_0x052c('0x39')](function(_0x297188){_0x4c4f9d[_0x052c('0x54')]=_0x297188;return _0x4c4f9d;})[_0x052c('0x39')](respondWithFilteredResult(_0x453b6d,_0x1ef188))[_0x052c('0x2b')](handleError(_0x453b6d,null));};exports[_0x052c('0x55')]=function(_0x4bf5d4,_0x1197f7){var _0x43b6aa={'raw':!![],'where':{'id':_0x4bf5d4[_0x052c('0x56')]['id']}},_0x614ff9={};_0x614ff9[_0x052c('0x42')]=_[_0x052c('0x45')](db['WhatsappMessage']['rawAttributes']);_0x614ff9[_0x052c('0x44')]=_[_0x052c('0x45')](_0x4bf5d4[_0x052c('0x44')]);_0x614ff9[_0x052c('0x46')]=_[_0x052c('0x48')](_0x614ff9[_0x052c('0x42')],_0x614ff9[_0x052c('0x44')]);_0x43b6aa[_0x052c('0x47')]=_[_0x052c('0x48')](_0x614ff9[_0x052c('0x42')],qs[_0x052c('0x49')](_0x4bf5d4[_0x052c('0x44')][_0x052c('0x49')]));_0x43b6aa['attributes']=_0x43b6aa['attributes'][_0x052c('0x57')]?_0x43b6aa[_0x052c('0x47')]:_0x614ff9[_0x052c('0x42')];if(_0x4bf5d4['query'][_0x052c('0x53')]){_0x43b6aa[_0x052c('0x58')]=[{'all':!![]}];}_0x43b6aa=_['merge']({},_0x43b6aa,_0x4bf5d4[_0x052c('0x52')]);return db['WhatsappMessage'][_0x052c('0x59')](_0x43b6aa)[_0x052c('0x39')](handleEntityNotFound(_0x1197f7,null))['then'](respondWithResult(_0x1197f7,null))[_0x052c('0x2b')](handleError(_0x1197f7,null));};exports[_0x052c('0x5a')]=function(_0x2d0e7e,_0xdd0300){return db['WhatsappMessage'][_0x052c('0x5a')](_0x2d0e7e[_0x052c('0x5b')],{})['then'](respondWithResult(_0xdd0300,0xc9))['catch'](handleError(_0xdd0300,null));};exports[_0x052c('0x38')]=function(_0x8e015,_0x388743){if(_0x8e015[_0x052c('0x5b')]['id']){delete _0x8e015[_0x052c('0x5b')]['id'];}return db[_0x052c('0x3d')][_0x052c('0x59')]({'where':{'id':_0x8e015[_0x052c('0x56')]['id']}})[_0x052c('0x39')](handleEntityNotFound(_0x388743,null))[_0x052c('0x39')](saveUpdates(_0x8e015['body'],null))['then'](respondWithResult(_0x388743,null))['catch'](handleError(_0x388743,null));};exports[_0x052c('0x3a')]=function(_0x101e87,_0x550de3){return db['WhatsappMessage'][_0x052c('0x59')]({'where':{'id':_0x101e87[_0x052c('0x56')]['id']}})['then'](handleEntityNotFound(_0x550de3,null))[_0x052c('0x39')](removeEntity(_0x550de3,null))[_0x052c('0x2b')](handleError(_0x550de3,null));};exports[_0x052c('0x5c')]=function(_0x35fc1d,_0x129c30){return db[_0x052c('0x3d')]['describe']()['then'](respondWithResult(_0x129c30,null))[_0x052c('0x2b')](handleError(_0x129c30,null));};var interaction_log=require(_0x052c('0x5d'))('whatsapp-interactions');exports['accept']=function(_0x3816d0,_0x5eaf5d,_0x53b7bc){var _0x105f52={'agent':{},'channel':_0x052c('0x5e')};if(_0x3816d0['body']['id']){delete _0x3816d0[_0x052c('0x5b')]['id'];}_0x3816d0[_0x052c('0x5b')][_0x052c('0x5f')]=!![];_0x3816d0['body']['readAt']=moment()[_0x052c('0x60')](_0x052c('0x61'));_0x3816d0[_0x052c('0x5b')][_0x052c('0x62')]=_0x3816d0[_0x052c('0x5b')][_0x052c('0x62')]||_0x3816d0[_0x052c('0x63')]['id'];_0x105f52['agent']['id']=_0x3816d0[_0x052c('0x5b')][_0x052c('0x62')];return db[_0x052c('0x3d')][_0x052c('0x59')]({'where':{'id':_0x3816d0[_0x052c('0x56')]['id'],'UserId':null}})[_0x052c('0x39')](handleEntityNotFound(_0x5eaf5d,null))[_0x052c('0x39')](saveUpdates(_0x3816d0['body'],null))['then'](function(_0x11ba81){if(_0x11ba81){_0x105f52[_0x052c('0x29')]=_0x11ba81[_0x052c('0x64')]({'plain':!![]});return db[_0x052c('0x65')][_0x052c('0x59')]({'where':{'id':_0x11ba81[_0x052c('0x66')]}});}return null;})[_0x052c('0x39')](handleEntityNotFound(_0x5eaf5d,null))[_0x052c('0x39')](function(_0x3b5de7){if(_0x3b5de7){return _0x3b5de7['update']({'UserId':_0x3816d0[_0x052c('0x5b')][_0x052c('0x62')],'read1stAt':_[_0x052c('0x67')](_0x3b5de7[_0x052c('0x68')])?moment()[_0x052c('0x60')](_0x052c('0x61')):undefined});}return null;})[_0x052c('0x39')](function(_0x4ca415){if(_0x4ca415){_0x105f52[_0x052c('0x69')]=_0x4ca415['get']({'plain':!![]});interaction_log['info'](_0x052c('0x6a'),_0x3816d0['user']['id'],_0x3816d0[_0x052c('0x63')][_0x052c('0x6b')],_0x3816d0[_0x052c('0x63')][_0x052c('0x6c')],_0x105f52[_0x052c('0x69')]['id'],_0x3816d0['body']?JSON[_0x052c('0x27')](_0x3816d0[_0x052c('0x5b')]):_0x052c('0x6d'));return respondWithRpcPromise(_0x052c('0x6e'),_0x052c('0x6f'),_0x105f52);}return null;})['then'](function(_0x58b62c){var _0x2a94fd=_0x052c('0x70')+_0x58b62c[_0x052c('0x29')][_0x052c('0x71')];return db[_0x052c('0x72')][_0x052c('0x44')](_0x2a94fd,{'type':db[_0x052c('0x73')]['QueryTypes'][_0x052c('0x74')],'raw':!![]})[_0x052c('0x39')](function(_0x3527d4){return _0x3527d4;});})[_0x052c('0x39')](function(_0xcbcc59){if(_0xcbcc59){_0x105f52['message'][_0x052c('0x75')]=_0xcbcc59[0x0];if(!_0x3816d0[_0x052c('0x5b')]['UserId'])return;return db[_0x052c('0x76')]['find']({'where':{'id':_0x3816d0['body'][_0x052c('0x62')],'role':_0x052c('0x77')},'attributes':['id',_0x052c('0x6b'),_0x052c('0x78'),'email',_0x052c('0x79')],'raw':!![]});}return null;})[_0x052c('0x39')](function(_0x31a491){if(!_0x31a491)return null;_0x105f52['message'][_0x052c('0x77')]=_0x31a491;return _0x105f52;})[_0x052c('0x39')](function(_0x127374){if(_0x127374){if(_0x3816d0[_0x052c('0x5b')][_0x052c('0x7a')]){_0x105f52[_0x052c('0x29')]['interface']=util['format']('SIP/%s',_0x3816d0[_0x052c('0x63')][_0x052c('0x6b')]);_0x105f52[_0x052c('0x29')][_0x052c('0x7b')]=_0x105f52['channel'];_0x105f52[_0x052c('0x29')]['motionChannel']=_0x105f52[_0x052c('0x7b')];_0x105f52['message'][_0x052c('0x7c')]='accept';return respondWithRpcPromise('EventManager',_0x052c('0x7d'),{'event':_0x052c('0x7e'),'message':_0x105f52[_0x052c('0x29')]},client9002)[_0x052c('0x39')](function(){return _0x105f52;});}return _0x105f52;}return null;})[_0x052c('0x39')](respondWithResult(_0x5eaf5d,null))[_0x052c('0x2b')](handleError(_0x5eaf5d,null));};var interaction_log=require(_0x052c('0x5d'))('whatsapp-interactions');exports['reject']=function(_0xa2fef7,_0x13d17a,_0x17f226){var _0x3b59d0={'agent':{},'channel':'whatsapp'};if(_0xa2fef7['body']['id']){delete _0xa2fef7[_0x052c('0x5b')]['id'];}_0xa2fef7[_0x052c('0x5b')][_0x052c('0x62')]=_0xa2fef7['body'][_0x052c('0x62')]||_0xa2fef7[_0x052c('0x63')]['id'];_0x3b59d0[_0x052c('0x77')]['id']=_0xa2fef7[_0x052c('0x5b')][_0x052c('0x62')];return db[_0x052c('0x3d')][_0x052c('0x59')]({'where':{'id':_0xa2fef7[_0x052c('0x56')]['id'],'UserId':null}})[_0x052c('0x39')](handleEntityNotFound(_0x13d17a,null))[_0x052c('0x39')](function(_0x229bb6){if(_0x229bb6){_0x3b59d0['message']=_0x229bb6['get']({'plain':!![]});return db[_0x052c('0x65')]['find']({'where':{'id':_0x229bb6[_0x052c('0x66')]}});}return null;})[_0x052c('0x39')](handleEntityNotFound(_0x13d17a,null))['then'](function(_0x4094e7){if(_0x4094e7){_0x3b59d0[_0x052c('0x69')]=_0x4094e7[_0x052c('0x64')]({'plain':!![]});interaction_log[_0x052c('0x23')](_0x052c('0x7f'),_0xa2fef7[_0x052c('0x63')]['id'],_0xa2fef7['user'][_0x052c('0x6b')],_0xa2fef7[_0x052c('0x63')][_0x052c('0x6c')],_0x3b59d0[_0x052c('0x69')]['id'],_0xa2fef7[_0x052c('0x5b')]?JSON[_0x052c('0x27')](_0xa2fef7[_0x052c('0x5b')]):_0x052c('0x6d'));return respondWithRpcPromise(_0x052c('0x80'),_0x052c('0x81'),_0x3b59d0);}return null;})['then'](function(_0x43153c){var _0xd8f528=_0x052c('0x70')+_0x43153c[_0x052c('0x29')]['ContactId'];return db[_0x052c('0x72')][_0x052c('0x44')](_0xd8f528,{'type':db[_0x052c('0x73')][_0x052c('0x82')][_0x052c('0x74')],'raw':!![]})[_0x052c('0x39')](function(_0x4a30be){return _0x4a30be;});})['then'](function(_0x2f5759){if(_0x2f5759){_0x3b59d0[_0x052c('0x29')]['contact']=_0x2f5759[0x0];if(!_0xa2fef7[_0x052c('0x5b')][_0x052c('0x62')])return;return db['User'][_0x052c('0x59')]({'where':{'id':_0xa2fef7[_0x052c('0x5b')][_0x052c('0x62')],'role':_0x052c('0x77')},'attributes':['id',_0x052c('0x6b'),_0x052c('0x78'),_0x052c('0x83'),_0x052c('0x79')],'raw':!![]});}return null;})[_0x052c('0x39')](function(_0x495365){if(!_0x495365)return null;_0x3b59d0[_0x052c('0x29')][_0x052c('0x77')]=_0x495365;return _0x3b59d0;})[_0x052c('0x39')](function(_0x12d971){if(_0x12d971){_0x12d971[_0x052c('0x29')][_0x052c('0x84')]=util['format']('SIP/%s',_0xa2fef7['user'][_0x052c('0x6b')]);_0x12d971[_0x052c('0x29')][_0x052c('0x7b')]=_0x3b59d0['channel'];_0x12d971[_0x052c('0x29')]['motionChannel']=_0x3b59d0[_0x052c('0x7b')];_0x12d971[_0x052c('0x29')][_0x052c('0x7c')]=_0x052c('0x36');respondWithRpcPromise(_0x052c('0x7d'),_0x052c('0x7d'),{'event':_0x052c('0x85'),'message':_0x12d971[_0x052c('0x29')]},client9002);return _0x3b59d0;}return null;})['then'](respondWithResult(_0x13d17a,null))[_0x052c('0x2b')](handleError(_0x13d17a,null));};exports['status']=function(_0x5c6b5c,_0x32b058,_0x556fbf){if(_0x5c6b5c['body']['id']){delete _0x5c6b5c[_0x052c('0x5b')]['id'];}var _0x3e16ae;return db['WhatsappMessage'][_0x052c('0x59')]({'where':{'id':_0x5c6b5c[_0x052c('0x56')]['id']}})[_0x052c('0x39')](handleEntityNotFound(_0x32b058,null))[_0x052c('0x39')](function(_0x2400d0){if(_0x2400d0){_0x3e16ae=_0x2400d0;return db['WhatsappAccount'][_0x052c('0x59')]({'where':{'id':_0x2400d0[_0x052c('0x86')]}});}})['then'](handleEntityNotFound(_0x32b058,null))[_0x052c('0x39')](function(_0x184d98){if(_0x184d98){logger[_0x052c('0x87')](_0x052c('0x88'),_0x052c('0x2d'),_0x052c('0x89'),_0x184d98[_0x052c('0x40')],util[_0x052c('0x8a')](_0x5c6b5c[_0x052c('0x5b')],{'showHidden':![],'depth':null}));switch(_0x184d98[_0x052c('0x40')]){case _0x052c('0x8b'):if(_0x5c6b5c['body'][_0x052c('0x8c')]&&_0x5c6b5c[_0x052c('0x5b')][_0x052c('0x8c')]===_0x3e16ae[_0x052c('0x8d')]&&_0x5c6b5c[_0x052c('0x5b')][_0x052c('0x8e')]&&_0x5c6b5c['body'][_0x052c('0x8e')]===_0x052c('0x5f')){return _0x3e16ae[_0x052c('0x38')]({'read':!![]});}else{logger[_0x052c('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x052c('0x8a')](_0x5c6b5c[_0x052c('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3e16ae;}})[_0x052c('0x39')](respondWithResult(_0x32b058,null))[_0x052c('0x2b')](handleError(_0x32b058,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 425e7c8..382e601 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8130=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x4911f4,_0x2be1ce){var _0x22725a=function(_0x7637a5){while(--_0x7637a5){_0x4911f4['push'](_0x4911f4['shift']());}};_0x22725a(++_0x2be1ce);}(_0x8130,0x146));var _0x0813=function(_0x5281e6,_0x367c0c){_0x5281e6=_0x5281e6-0x0;var _0x2f5dbc=_0x8130[_0x5281e6];return _0x2f5dbc;};'use strict';var EventEmitter=require(_0x0813('0x0'));var WhatsappMessage=require(_0x0813('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0813('0x2')](0x0);var events={'afterCreate':_0x0813('0x3'),'afterUpdate':_0x0813('0x4'),'afterDestroy':_0x0813('0x5')};function emitEvent(_0x1421d7){return function(_0x25d6c6,_0x4e66f4,_0x442a9b){WhatsappMessageEvents['emit'](_0x1421d7+':'+_0x25d6c6['id'],_0x25d6c6);WhatsappMessageEvents['emit'](_0x1421d7,_0x25d6c6);_0x442a9b(null);};}for(var e in events){if(events[_0x0813('0x6')](e)){var event=events[e];WhatsappMessage[_0x0813('0x7')](e,emitEvent(event));}}module[_0x0813('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb58b=['exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit','hook'];(function(_0x28b254,_0x20c0cd){var _0x1a1f34=function(_0x2bcdaf){while(--_0x2bcdaf){_0x28b254['push'](_0x28b254['shift']());}};_0x1a1f34(++_0x20c0cd);}(_0xb58b,0x1f1));var _0xbb58=function(_0xd79268,_0x605ab){_0xd79268=_0xd79268-0x0;var _0x257f20=_0xb58b[_0xd79268];return _0x257f20;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xbb58('0x0'))['db'][_0xbb58('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb58('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb58('0x3'),'afterDestroy':_0xbb58('0x4')};function emitEvent(_0x5c9ec5){return function(_0x226363,_0x546510,_0x2edb10){WhatsappMessageEvents[_0xbb58('0x5')](_0x5c9ec5+':'+_0x226363['id'],_0x226363);WhatsappMessageEvents[_0xbb58('0x5')](_0x5c9ec5,_0x226363);_0x2edb10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xbb58('0x6')](e,emitEvent(event));}}module[_0xbb58('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d9d9ab3..aaf7865 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe20d=['api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','twilio','accountSid','phone','authToken','messages','create','body','whatsapp:','remote','/status?token=','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','Bearer\x20','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3d6d7c,_0x307fc6){var _0x36e6fa=function(_0x109074){while(--_0x109074){_0x3d6d7c['push'](_0x3d6d7c['shift']());}};_0x36e6fa(++_0x307fc6);}(_0xe20d,0x1bd));var _0xde20=function(_0x16caf1,_0x5abf5e){_0x16caf1=_0x16caf1-0x0;var _0x4d77b7=_0xe20d[_0x16caf1];return _0x4d77b7;};'use strict';var _=require(_0xde20('0x0'));var util=require(_0xde20('0x1'));var logger=require(_0xde20('0x2'))(_0xde20('0x3'));var moment=require(_0xde20('0x4'));var BPromise=require(_0xde20('0x5'));var rp=require(_0xde20('0x6'));var fetch=require(_0xde20('0x7'));var fs=require('fs');var path=require(_0xde20('0x8'));var rimraf=require(_0xde20('0x9'));var config=require(_0xde20('0xa'));var attributes=require(_0xde20('0xb'));module[_0xde20('0xc')]=function(_0x757746,_0x10c321){return _0x757746[_0xde20('0xd')](_0xde20('0xe'),attributes,{'tableName':_0xde20('0xf'),'paranoid':![],'indexes':[{'name':_0xde20('0x10'),'fields':[_0xde20('0x10')]},{'name':_0xde20('0x11'),'fields':['body'],'type':_0xde20('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ef0e6,_0x24c248,_0x1762d2){var _0x319055=_0x757746[_0xde20('0x13')];var _0x5a06f3=_0x5ef0e6['get']({'plain':!![]});if(_0x5a06f3[_0xde20('0x14')][_0xde20('0x15')]()==='in'||_0x5a06f3['direction']['toLowerCase']()===_0xde20('0x16')&&!_0x5a06f3[_0xde20('0x17')]&&!_['isNil'](_0x5a06f3[_0xde20('0x18')])){_0x319055[_0xde20('0x19')][_0xde20('0x1a')]({'where':{'id':_0x5a06f3['WhatsappInteractionId']}})[_0xde20('0x1b')](function(_0x4ef03c){if(_0x4ef03c){_0x4ef03c[_0xde20('0x1c')]({'lastMsgAt':_0x5a06f3[_0xde20('0x1d')],'lastMsgDirection':_0x5a06f3['direction'][_0xde20('0x15')]()});}})[_0xde20('0x1e')](function(_0xc41e85){console[_0xde20('0x1f')](_0xc41e85);});}if(_0x5a06f3[_0xde20('0x14')]===_0xde20('0x16')&&!_0x5a06f3[_0xde20('0x17')]){var _0x226a53;_0x319055[_0xde20('0x20')]['find']({'where':{'id':_0x5a06f3['WhatsappAccountId']},'raw':!![]})[_0xde20('0x1b')](function(_0x27c306){_0x226a53=_0x27c306;if(_0x226a53&&_0x226a53['type']){switch(_0x226a53['type']){case _0xde20('0x21'):var _0x1c64ba=require(_0xde20('0x21'));if(_0x226a53[_0xde20('0x22')]&&_0x226a53['authToken']&&_0x226a53[_0xde20('0x23')]){var _0x2f7a0d=new _0x1c64ba(_0x226a53[_0xde20('0x22')],_0x226a53[_0xde20('0x24')]);_0x2f7a0d[_0xde20('0x25')][_0xde20('0x26')]({'body':_0x5a06f3[_0xde20('0x27')],'to':_0xde20('0x28')+_0x5a06f3[_0xde20('0x23')],'from':_0xde20('0x28')+_0x226a53[_0xde20('0x23')],'statusCallback':_0x226a53[_0xde20('0x29')]+'/api/whatsapp/messages/'+_0x5a06f3['id']+_0xde20('0x2a')+_0x226a53['token']})[_0xde20('0x1b')](function(_0x2917e8){if(_0x2917e8[_0xde20('0x2b')]){return _0x5ef0e6[_0xde20('0x1c')]({'messageId':_0x2917e8[_0xde20('0x2b')]});}})[_0xde20('0x1e')](function(_0x4178c0){logger[_0xde20('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xde20('0x2c'),_0xde20('0x21'),util[_0xde20('0x2d')](_0x4178c0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xde20('0x2e'),_0xde20('0x2c'),_0xde20('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xde20('0x2f'):var _0x416625=_0x226a53['accountSid'];var _0x2e988e=_0x226a53[_0xde20('0x24')];var _0x56654f=_0x226a53[_0xde20('0x30')]+'/whatsapp/v1/'+_0x416625+'/messages/';var _0x597c59={'to':[_0x5a06f3[_0xde20('0x23')]],'message':{'type':'text','text':_0x5a06f3['body']}};var _0x5d9454={'method':'POST','uri':_0x56654f,'headers':{'Authorization':_0xde20('0x31')+_0x2e988e,'Content-Type':'application/json'},'body':_0x597c59,'json':!![]};rp(_0x5d9454)[_0xde20('0x1b')](function(_0x50aaae){if(_0x50aaae[_0xde20('0x32')][0x0]['message_id']){return _0x5ef0e6[_0xde20('0x1c')]({'messageId':_0x50aaae['statuses'][0x0][_0xde20('0x33')]});}})[_0xde20('0x1e')](function(_0x5bdae1){logger[_0xde20('0x34')]('WhatsappMessage,\x20%s',_0x5bdae1);});break;}}})[_0xde20('0x35')](function(){_0x1762d2();});}else{_0x1762d2();}}},'charset':_0xde20('0x36'),'collate':_0xde20('0x37')});}; \ No newline at end of file +var _0x1799=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','then','createdAt','catch','error','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/messages/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x391635,_0x25d933){var _0x11c075=function(_0x1e377f){while(--_0x1e377f){_0x391635['push'](_0x391635['shift']());}};_0x11c075(++_0x25d933);}(_0x1799,0x19d));var _0x9179=function(_0xf99afb,_0x8916b2){_0xf99afb=_0xf99afb-0x0;var _0x23a12b=_0x1799[_0xf99afb];return _0x23a12b;};'use strict';var _=require(_0x9179('0x0'));var util=require('util');var logger=require(_0x9179('0x1'))(_0x9179('0x2'));var moment=require(_0x9179('0x3'));var BPromise=require(_0x9179('0x4'));var rp=require(_0x9179('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x9179('0x6'));var rimraf=require('rimraf');var config=require(_0x9179('0x7'));var attributes=require(_0x9179('0x8'));module['exports']=function(_0x141ccb,_0x240824){return _0x141ccb[_0x9179('0x9')]('WhatsappMessage',attributes,{'tableName':_0x9179('0xa'),'paranoid':![],'indexes':[{'name':_0x9179('0xb'),'fields':[_0x9179('0xb')]},{'name':_0x9179('0xc'),'fields':[_0x9179('0xd')],'type':_0x9179('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33b46a,_0x82b3c0,_0x4ac53e){var _0x316edb=_0x141ccb[_0x9179('0xf')];var _0x536229=_0x33b46a[_0x9179('0x10')]({'plain':!![]});if(_0x536229['direction']['toLowerCase']()==='in'||_0x536229[_0x9179('0x11')][_0x9179('0x12')]()===_0x9179('0x13')&&!_0x536229['secret']&&!_[_0x9179('0x14')](_0x536229[_0x9179('0x15')])){_0x316edb[_0x9179('0x16')]['findOne']({'where':{'id':_0x536229['WhatsappInteractionId']}})[_0x9179('0x17')](function(_0x1ba848){if(_0x1ba848){_0x1ba848['update']({'lastMsgAt':_0x536229[_0x9179('0x18')],'lastMsgDirection':_0x536229[_0x9179('0x11')][_0x9179('0x12')]()});}})[_0x9179('0x19')](function(_0x5de7b0){console[_0x9179('0x1a')](_0x5de7b0);});}if(_0x536229['direction']===_0x9179('0x13')&&!_0x536229[_0x9179('0x1b')]){var _0x453da4;_0x316edb[_0x9179('0x1c')]['find']({'where':{'id':_0x536229[_0x9179('0x1d')]},'raw':!![]})[_0x9179('0x17')](function(_0x21e48f){_0x453da4=_0x21e48f;if(_0x453da4&&_0x453da4[_0x9179('0x1e')]){switch(_0x453da4[_0x9179('0x1e')]){case _0x9179('0x1f'):var _0x180a91=require('twilio');if(_0x453da4[_0x9179('0x20')]&&_0x453da4['authToken']&&_0x453da4[_0x9179('0x21')]){var _0x2bdfcf=new _0x180a91(_0x453da4['accountSid'],_0x453da4[_0x9179('0x22')]);_0x2bdfcf[_0x9179('0x23')][_0x9179('0x24')]({'body':_0x536229['body'],'to':_0x9179('0x25')+_0x536229[_0x9179('0x21')],'from':_0x9179('0x25')+_0x453da4[_0x9179('0x21')],'statusCallback':_0x453da4[_0x9179('0x26')]+_0x9179('0x27')+_0x536229['id']+_0x9179('0x28')+_0x453da4[_0x9179('0x29')]})[_0x9179('0x17')](function(_0xdbc5e2){if(_0xdbc5e2[_0x9179('0x2a')]){return _0x33b46a[_0x9179('0x2b')]({'messageId':_0xdbc5e2[_0x9179('0x2a')]});}})['catch'](function(_0x18fb34){logger[_0x9179('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x9179('0x2c'),_0x9179('0x1f'),util['inspect'](_0x18fb34,{'showHidden':![],'depth':null}));});}else{logger[_0x9179('0x1a')](_0x9179('0x2d'),'afterCreate',_0x9179('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9179('0x2e'):var _0x2f53e1=_0x453da4[_0x9179('0x20')];var _0x31c674=_0x453da4[_0x9179('0x22')];var _0x3f31a8=_0x453da4[_0x9179('0x2f')]+'/whatsapp/v1/'+_0x2f53e1+_0x9179('0x30');var _0x2e9deb={'to':[_0x536229[_0x9179('0x21')]],'message':{'type':_0x9179('0x31'),'text':_0x536229[_0x9179('0xd')]}};var _0x52321d={'method':_0x9179('0x32'),'uri':_0x3f31a8,'headers':{'Authorization':_0x9179('0x33')+_0x31c674,'Content-Type':'application/json'},'body':_0x2e9deb,'json':!![]};rp(_0x52321d)['then'](function(_0x2904dd){if(_0x2904dd[_0x9179('0x34')][0x0][_0x9179('0x35')]){return _0x33b46a[_0x9179('0x2b')]({'messageId':_0x2904dd[_0x9179('0x34')][0x0][_0x9179('0x35')]});}})[_0x9179('0x19')](function(_0x3f3904){logger[_0x9179('0x36')](_0x9179('0x37'),_0x3f3904);});break;}}})[_0x9179('0x38')](function(){_0x4ac53e();});}else{_0x4ac53e();}}},'charset':_0x9179('0x39'),'collate':_0x9179('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f6768e6..782291f 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8877=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x30b090,_0x12e251){var _0x97a58e=function(_0x5dd83a){while(--_0x5dd83a){_0x30b090['push'](_0x30b090['shift']());}};_0x97a58e(++_0x12e251);}(_0x8877,0x16c));var _0x7887=function(_0x14fe62,_0x59b270){_0x14fe62=_0x14fe62-0x0;var _0x477655=_0x8877[_0x14fe62];return _0x477655;};'use strict';var _=require('lodash');var util=require(_0x7887('0x0'));var moment=require(_0x7887('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7887('0x2'));var db=require(_0x7887('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7887('0x4'))(_0x7887('0x5'));var config=require(_0x7887('0x6'));var jayson=require(_0x7887('0x7'));var client=jayson[_0x7887('0x8')][_0x7887('0x9')]({'port':0x232a});config[_0x7887('0xa')]=_[_0x7887('0xb')](config[_0x7887('0xa')],{'host':_0x7887('0xc'),'port':0x18eb});var socket=require(_0x7887('0xd'))(new Redis(config['redis']));require(_0x7887('0xe'))['register'](socket);function respondWithRpcPromise(_0x13bde9,_0x2bc814,_0x1728cf){return new BPromise(function(_0x54b952,_0x2381ae){return client[_0x7887('0xf')](_0x13bde9,_0x1728cf)[_0x7887('0x10')](function(_0x5e2aa9){logger[_0x7887('0x11')](_0x7887('0x12'),_0x2bc814,_0x7887('0x13'));logger[_0x7887('0x14')](_0x7887('0x15'),_0x2bc814,_0x7887('0x13'),JSON[_0x7887('0x16')](_0x5e2aa9));if(_0x5e2aa9[_0x7887('0x17')]){if(_0x5e2aa9[_0x7887('0x17')][_0x7887('0x18')]===0x1f4){logger[_0x7887('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x2bc814,_0x5e2aa9[_0x7887('0x17')][_0x7887('0x19')]);return _0x2381ae(_0x5e2aa9['error']['message']);}logger[_0x7887('0x17')](_0x7887('0x12'),_0x2bc814,_0x5e2aa9[_0x7887('0x17')]['message']);return _0x54b952(_0x5e2aa9[_0x7887('0x17')][_0x7887('0x19')]);}else{logger[_0x7887('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2bc814,_0x7887('0x13'));_0x54b952(_0x5e2aa9[_0x7887('0x1a')][_0x7887('0x19')]);}})[_0x7887('0x1b')](function(_0x108f83){logger['error'](_0x7887('0x12'),_0x2bc814,_0x108f83);_0x2381ae(_0x108f83);});});}exports[_0x7887('0x1c')]=function(_0x5f466d){var _0x3d3de3=this;return new Promise(function(_0x1f3c9a,_0x439315){return db[_0x7887('0x1d')]['create'](_0x5f466d[_0x7887('0x1e')],{'raw':_0x5f466d[_0x7887('0x1f')]?_0x5f466d[_0x7887('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x7887('0x10')](function(_0x235a68){logger[_0x7887('0x11')](_0x7887('0x1c'),_0x5f466d);logger[_0x7887('0x14')](_0x7887('0x1c'),_0x5f466d,JSON['stringify'](_0x235a68));_0x1f3c9a(_0x235a68);})[_0x7887('0x1b')](function(_0x4fad4d){logger['error'](_0x7887('0x1c'),_0x4fad4d[_0x7887('0x19')],_0x5f466d);_0x439315(_0x3d3de3[_0x7887('0x17')](0x1f4,_0x4fad4d[_0x7887('0x19')]));});});}; \ No newline at end of file +var _0xa407=['rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x29165d,_0x221063){var _0x3dd8f9=function(_0x428f99){while(--_0x428f99){_0x29165d['push'](_0x29165d['shift']());}};_0x3dd8f9(++_0x221063);}(_0xa407,0x96));var _0x7a40=function(_0x17d6a1,_0x26d649){_0x17d6a1=_0x17d6a1-0x0;var _0x94a62a=_0xa407[_0x17d6a1];return _0x94a62a;};'use strict';var _=require(_0x7a40('0x0'));var util=require('util');var moment=require(_0x7a40('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a40('0x2'));var fs=require('fs');var Redis=require(_0x7a40('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a40('0x4'));var logger=require('../../config/logger')(_0x7a40('0x5'));var config=require(_0x7a40('0x6'));var jayson=require(_0x7a40('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x7a40('0x8')]=_['defaults'](config[_0x7a40('0x8')],{'host':_0x7a40('0x9'),'port':0x18eb});var socket=require(_0x7a40('0xa'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x7a40('0xb')](socket);function respondWithRpcPromise(_0x5d8512,_0x3b656d,_0x3e857f){return new BPromise(function(_0x2a6d19,_0x2a75aa){return client[_0x7a40('0xc')](_0x5d8512,_0x3e857f)[_0x7a40('0xd')](function(_0x15bed){logger[_0x7a40('0xe')](_0x7a40('0xf'),_0x3b656d,_0x7a40('0x10'));logger[_0x7a40('0x11')](_0x7a40('0x12'),_0x3b656d,_0x7a40('0x10'),JSON[_0x7a40('0x13')](_0x15bed));if(_0x15bed[_0x7a40('0x14')]){if(_0x15bed[_0x7a40('0x14')][_0x7a40('0x15')]===0x1f4){logger[_0x7a40('0x14')](_0x7a40('0xf'),_0x3b656d,_0x15bed[_0x7a40('0x14')][_0x7a40('0x16')]);return _0x2a75aa(_0x15bed[_0x7a40('0x14')]['message']);}logger['error'](_0x7a40('0xf'),_0x3b656d,_0x15bed[_0x7a40('0x14')][_0x7a40('0x16')]);return _0x2a6d19(_0x15bed[_0x7a40('0x14')][_0x7a40('0x16')]);}else{logger[_0x7a40('0xe')](_0x7a40('0xf'),_0x3b656d,_0x7a40('0x10'));_0x2a6d19(_0x15bed[_0x7a40('0x17')]['message']);}})[_0x7a40('0x18')](function(_0x489fa8){logger['error'](_0x7a40('0xf'),_0x3b656d,_0x489fa8);_0x2a75aa(_0x489fa8);});});}exports['CreateWhatsappMessage']=function(_0x319387){var _0x461a9c=this;return new Promise(function(_0x3abd61,_0x3a2557){return db[_0x7a40('0x19')][_0x7a40('0x1a')](_0x319387[_0x7a40('0x1b')],{'raw':_0x319387['options']?_0x319387[_0x7a40('0x1c')][_0x7a40('0x1d')]===undefined?!![]:![]:!![]})[_0x7a40('0xd')](function(_0x354d84){logger[_0x7a40('0xe')]('CreateWhatsappMessage',_0x319387);logger[_0x7a40('0x11')]('CreateWhatsappMessage',_0x319387,JSON[_0x7a40('0x13')](_0x354d84));_0x3abd61(_0x354d84);})['catch'](function(_0x5409c1){logger[_0x7a40('0x14')](_0x7a40('0x1e'),_0x5409c1['message'],_0x319387);_0x3a2557(_0x461a9c[_0x7a40('0x14')](0x1f4,_0x5409c1[_0x7a40('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 683d549..e020fa1 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f3b=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','emit'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x2f3b,0xb9));var _0xb2f3=function(_0x3aea1e,_0x15c930){_0x3aea1e=_0x3aea1e-0x0;var _0x3e508a=_0x2f3b[_0x3aea1e];return _0x3e508a;};'use strict';var WhatsappMessageEvents=require(_0xb2f3('0x0'));var events=[_0xb2f3('0x1'),_0xb2f3('0x2'),'update'];function createListener(_0x43c123,_0x2482f7){return function(_0x4609d2){_0x2482f7[_0xb2f3('0x3')](_0x43c123,_0x4609d2);};}function removeListener(_0x151164,_0x49d136){return function(){WhatsappMessageEvents['removeListener'](_0x151164,_0x49d136);};}exports[_0xb2f3('0x4')]=function(_0x456072){for(var _0x5b5d90=0x0,_0x147061=events[_0xb2f3('0x5')];_0x5b5d90<_0x147061;_0x5b5d90++){var _0x3c06fc=events[_0x5b5d90];var _0xc8670=createListener(_0xb2f3('0x6')+_0x3c06fc,_0x456072);WhatsappMessageEvents['on'](_0x3c06fc,_0xc8670);}}; \ No newline at end of file +var _0xd6ab=['whatsappMessage:','./whatsappMessage.events','save','remove','update','length'];(function(_0x5049e1,_0x4ac87a){var _0x37f162=function(_0x2e06cb){while(--_0x2e06cb){_0x5049e1['push'](_0x5049e1['shift']());}};_0x37f162(++_0x4ac87a);}(_0xd6ab,0x10f));var _0xbd6a=function(_0x7b7181,_0x9bbe92){_0x7b7181=_0x7b7181-0x0;var _0x3657c4=_0xd6ab[_0x7b7181];return _0x3657c4;};'use strict';var WhatsappMessageEvents=require(_0xbd6a('0x0'));var events=[_0xbd6a('0x1'),_0xbd6a('0x2'),_0xbd6a('0x3')];function createListener(_0xb3d7a9,_0x188602){return function(_0x4a0b5b){_0x188602['emit'](_0xb3d7a9,_0x4a0b5b);};}function removeListener(_0x5631d8,_0x1e446b){return function(){WhatsappMessageEvents['removeListener'](_0x5631d8,_0x1e446b);};}exports['register']=function(_0x33231f){for(var _0x582790=0x0,_0x3989a5=events[_0xbd6a('0x4')];_0x582790<_0x3989a5;_0x582790++){var _0x3bc057=events[_0x582790];var _0x1cbda7=createListener(_0xbd6a('0x5')+_0x3bc057,_0x33231f);WhatsappMessageEvents['on'](_0x3bc057,_0x1cbda7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4fe29a3..b47d0b9 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9275=['./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x26eefd,_0x34054d){var _0x3b2a92=function(_0x3d0477){while(--_0x3d0477){_0x26eefd['push'](_0x26eefd['shift']());}};_0x3b2a92(++_0x34054d);}(_0x9275,0x170));var _0x5927=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x9275[_0x48b810];return _0x23c17d;};'use strict';var multer=require('multer');var util=require(_0x5927('0x0'));var path=require('path');var timeout=require(_0x5927('0x1'));var express=require(_0x5927('0x2'));var router=express[_0x5927('0x3')]();var fs_extra=require(_0x5927('0x4'));var auth=require(_0x5927('0x5'));var interaction=require(_0x5927('0x6'));var config=require('../../config/environment');var controller=require(_0x5927('0x7'));router[_0x5927('0x8')]('/',auth['isAuthenticated'](),controller[_0x5927('0x9')]);router['get'](_0x5927('0xa'),auth[_0x5927('0xb')](),controller[_0x5927('0xc')]);router[_0x5927('0x8')](_0x5927('0xd'),auth[_0x5927('0xb')](),controller[_0x5927('0xe')]);router[_0x5927('0x8')]('/:id/members',auth[_0x5927('0xb')](),controller['getMembers']);router[_0x5927('0x8')]('/:id/teams',auth[_0x5927('0xb')](),controller['getTeams']);router[_0x5927('0x8')](_0x5927('0xf'),auth['isAuthenticated'](),controller[_0x5927('0x10')]);router[_0x5927('0x11')]('/',auth[_0x5927('0xb')](),controller['create']);router[_0x5927('0x11')]('/:id/teams',auth[_0x5927('0xb')](),controller[_0x5927('0x12')]);router[_0x5927('0x11')](_0x5927('0xf'),auth[_0x5927('0xb')](),controller[_0x5927('0x13')]);router[_0x5927('0x14')](_0x5927('0xd'),auth[_0x5927('0xb')](),controller[_0x5927('0x15')]);router['delete'](_0x5927('0xd'),auth[_0x5927('0xb')](),controller['destroy']);router[_0x5927('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x5927('0x16')](_0x5927('0xf'),auth['isAuthenticated'](),controller[_0x5927('0x17')]);module[_0x5927('0x18')]=router; \ No newline at end of file +var _0xefab=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','delete','destroy','removeTeams','removeAgents','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3495b7,_0x3054fd){var _0x55eff5=function(_0x401d35){while(--_0x401d35){_0x3495b7['push'](_0x3495b7['shift']());}};_0x55eff5(++_0x3054fd);}(_0xefab,0x9b));var _0xbefa=function(_0x5c6293,_0x20002a){_0x5c6293=_0x5c6293-0x0;var _0x466bc5=_0xefab[_0x5c6293];return _0x466bc5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbefa('0x0'));var express=require(_0xbefa('0x1'));var router=express[_0xbefa('0x2')]();var fs_extra=require(_0xbefa('0x3'));var auth=require(_0xbefa('0x4'));var interaction=require(_0xbefa('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xbefa('0x6')]('/',auth[_0xbefa('0x7')](),controller[_0xbefa('0x8')]);router[_0xbefa('0x6')](_0xbefa('0x9'),auth['isAuthenticated'](),controller[_0xbefa('0xa')]);router[_0xbefa('0x6')](_0xbefa('0xb'),auth[_0xbefa('0x7')](),controller[_0xbefa('0xc')]);router['get'](_0xbefa('0xd'),auth[_0xbefa('0x7')](),controller[_0xbefa('0xe')]);router[_0xbefa('0x6')](_0xbefa('0xf'),auth[_0xbefa('0x7')](),controller[_0xbefa('0x10')]);router[_0xbefa('0x6')](_0xbefa('0x11'),auth['isAuthenticated'](),controller[_0xbefa('0x12')]);router['post']('/',auth[_0xbefa('0x7')](),controller[_0xbefa('0x13')]);router[_0xbefa('0x14')]('/:id/teams',auth[_0xbefa('0x7')](),controller['addTeams']);router[_0xbefa('0x14')](_0xbefa('0x11'),auth[_0xbefa('0x7')](),controller[_0xbefa('0x15')]);router[_0xbefa('0x16')](_0xbefa('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xbefa('0x17')](_0xbefa('0xb'),auth[_0xbefa('0x7')](),controller[_0xbefa('0x18')]);router[_0xbefa('0x17')](_0xbefa('0xf'),auth[_0xbefa('0x7')](),controller[_0xbefa('0x19')]);router[_0xbefa('0x17')](_0xbefa('0x11'),auth[_0xbefa('0x7')](),controller[_0xbefa('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0d14984..eb8e0ea 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eec=['rrmemory','beepall','roundrobin','STRING','sequelize','name','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc0ee('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc0ee('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc0ee('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc0ee('0x3')](_0xc0ee('0x4'),_0xc0ee('0x5'),_0xc0ee('0x6'))},'description':{'type':Sequelize[_0xc0ee('0x7')]}}; \ No newline at end of file +var _0x0439=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0xd2329f,_0x449908){var _0x2e2ac5=function(_0x223b9a){while(--_0x223b9a){_0xd2329f['push'](_0xd2329f['shift']());}};_0x2e2ac5(++_0x449908);}(_0x0439,0xdd));var _0x9043=function(_0x20724c,_0x4f1432){_0x20724c=_0x20724c-0x0;var _0x4e523d=_0x0439[_0x20724c];return _0x4e523d;};'use strict';var Sequelize=require(_0x9043('0x0'));module[_0x9043('0x1')]={'name':{'type':Sequelize[_0x9043('0x2')],'unique':_0x9043('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9043('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9043('0x5')](_0x9043('0x6'),'beepall',_0x9043('0x7'))},'description':{'type':Sequelize[_0x9043('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 98c72ce..138df54 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaeac=['order','sort','filters','WhatsappQueueId','filter','options','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','Team','pick','getTeams','nolimit','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','getAgents','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','end','error','name','send','index','map','key','getOptions','where','WhatsappQueue','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty'];(function(_0x337e75,_0x2785ab){var _0x4f26e5=function(_0x1c8971){while(--_0x1c8971){_0x337e75['push'](_0x337e75['shift']());}};_0x4f26e5(++_0x2785ab);}(_0xaeac,0x12e));var _0xcaea=function(_0x486969,_0x409783){_0x486969=_0x486969-0x0;var _0x524221=_0xaeac[_0x486969];return _0x524221;};'use strict';var BPromise=require('bluebird');var util=require(_0xcaea('0x0'));var _=require(_0xcaea('0x1'));var squel=require(_0xcaea('0x2'));var Redis=require(_0xcaea('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xcaea('0x4'))(_0xcaea('0x5'));var config=require(_0xcaea('0x6'));var db=require('../../mysqldb')['db'];config[_0xcaea('0x7')]=_[_0xcaea('0x8')](config[_0xcaea('0x7')],{'host':_0xcaea('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcaea('0x7')]));require(_0xcaea('0xa'))[_0xcaea('0xb')](socket);function respondWithStatusCode(_0xbbdacc,_0x5d17b7){_0x5d17b7=_0x5d17b7||0xcc;return function(_0x560129){if(_0x560129){return _0xbbdacc[_0xcaea('0xc')](_0x5d17b7);}return _0xbbdacc[_0xcaea('0xd')](_0x5d17b7)['end']();};}function respondWithResult(_0x27df1f,_0x3cc4b1){_0x3cc4b1=_0x3cc4b1||0xc8;return function(_0x22413d){if(_0x22413d){return _0x27df1f['status'](_0x3cc4b1)[_0xcaea('0xe')](_0x22413d);}};}function respondWithFilteredResult(_0x34445c,_0x585d63){return function(_0x180e87){if(_0x180e87){var _0x29619a=typeof _0x585d63['offset']===_0xcaea('0xf')&&typeof _0x585d63[_0xcaea('0x10')]===_0xcaea('0xf');var _0x2fe2cc=_0x180e87[_0xcaea('0x11')];var _0x1510a6=_0x29619a?0x0:_0x585d63[_0xcaea('0x12')];var _0x14bb3c=_0x29619a?_0x180e87[_0xcaea('0x11')]:_0x585d63[_0xcaea('0x12')]+_0x585d63['limit'];var _0x5d5e0d;if(_0x14bb3c>=_0x2fe2cc){_0x14bb3c=_0x2fe2cc;_0x5d5e0d=0xc8;}else{_0x5d5e0d=0xce;}_0x34445c[_0xcaea('0xd')](_0x5d5e0d);return _0x34445c[_0xcaea('0x13')](_0xcaea('0x14'),_0x1510a6+'-'+_0x14bb3c+'/'+_0x2fe2cc)[_0xcaea('0xe')](_0x180e87);}return null;};}function saveUpdates(_0x36c7b1){return function(_0x354559){if(_0x354559){return _0x354559[_0xcaea('0x15')](_0x36c7b1)['then'](function(_0x16af94){return _0x16af94;});}return null;};}function removeEntity(_0x1741cb){return function(_0x50b877){if(_0x50b877){return _0x50b877[_0xcaea('0x16')]()[_0xcaea('0x17')](function(){var _0x2c66a0=_0x50b877[_0xcaea('0x18')]({'plain':!![]});var _0x2710b9=_0xcaea('0x19');return db[_0xcaea('0x1a')][_0xcaea('0x16')]({'where':{'type':_0x2710b9,'resourceId':_0x2c66a0['id']}})[_0xcaea('0x17')](function(){return _0x50b877;});})['then'](function(){_0x1741cb[_0xcaea('0xd')](0xcc)[_0xcaea('0x1b')]();});}};}function handleEntityNotFound(_0x5335de){return function(_0x55ca8a){if(!_0x55ca8a){_0x5335de['sendStatus'](0x194);}return _0x55ca8a;};}function handleError(_0x56c841,_0x12fef9){_0x12fef9=_0x12fef9||0x1f4;return function(_0xf27cbd){logger[_0xcaea('0x1c')](_0xf27cbd['stack']);if(_0xf27cbd[_0xcaea('0x1d')]){delete _0xf27cbd[_0xcaea('0x1d')];}_0x56c841[_0xcaea('0xd')](_0x12fef9)[_0xcaea('0x1e')](_0xf27cbd);};}exports[_0xcaea('0x1f')]=function(_0x53a5d3,_0x2456e){var _0x319809={};var _0x36ab3d={'count':0x0,'rows':[]};var _0x340ee0=_[_0xcaea('0x20')](db['WhatsappQueue']['rawAttributes'],function(_0x227f06){return{'name':_0x227f06['fieldName'],'type':_0x227f06['type'][_0xcaea('0x21')]};});_0x319809=qs[_0xcaea('0x22')](_0x340ee0,_0x53a5d3);var _0x44eb7f={'where':_0x319809[_0xcaea('0x23')]};return db[_0xcaea('0x24')][_0xcaea('0x11')](_0x44eb7f)['then'](function(_0x199e70){_0x36ab3d[_0xcaea('0x11')]=_0x199e70;_0x319809['include']=qs[_0xcaea('0x25')](_0x53a5d3[_0xcaea('0x26')]);return db[_0xcaea('0x24')][_0xcaea('0x27')](_0x319809);})[_0xcaea('0x17')](function(_0x46a25d){_0x36ab3d[_0xcaea('0x28')]=_0x46a25d;return _0x36ab3d;})[_0xcaea('0x17')](respondWithFilteredResult(_0x2456e,_0x319809))[_0xcaea('0x29')](handleError(_0x2456e,null));};exports[_0xcaea('0x2a')]=function(_0x3808e,_0x32ddbb){var _0x5ac2a5={'raw':!![],'where':{'id':_0x3808e[_0xcaea('0x2b')]['id']}},_0x4cca0b={};_0x4cca0b[_0xcaea('0x2c')]=_[_0xcaea('0x2d')](db[_0xcaea('0x24')]['rawAttributes']);_0x4cca0b['query']=_['keys'](_0x3808e[_0xcaea('0x26')]);_0x4cca0b['filters']=_[_0xcaea('0x2e')](_0x4cca0b[_0xcaea('0x2c')],_0x4cca0b[_0xcaea('0x26')]);_0x5ac2a5[_0xcaea('0x2f')]=_[_0xcaea('0x2e')](_0x4cca0b[_0xcaea('0x2c')],qs[_0xcaea('0x30')](_0x3808e[_0xcaea('0x26')][_0xcaea('0x30')]));_0x5ac2a5[_0xcaea('0x2f')]=_0x5ac2a5[_0xcaea('0x2f')][_0xcaea('0x31')]?_0x5ac2a5['attributes']:_0x4cca0b[_0xcaea('0x2c')];if(_0x3808e[_0xcaea('0x26')][_0xcaea('0x32')]){_0x5ac2a5['include']=[{'all':!![]}];}_0x5ac2a5=_[_0xcaea('0x33')]({},_0x5ac2a5,_0x3808e['options']);return db[_0xcaea('0x24')][_0xcaea('0x34')](_0x5ac2a5)[_0xcaea('0x17')](handleEntityNotFound(_0x32ddbb,null))[_0xcaea('0x17')](respondWithResult(_0x32ddbb,null))[_0xcaea('0x29')](handleError(_0x32ddbb,null));};exports['create']=function(_0x3b7ae9,_0x12d306){return db[_0xcaea('0x24')][_0xcaea('0x35')](_0x3b7ae9['body'],{})[_0xcaea('0x17')](function(_0x2c9e08){var _0x5dc12a=_0x3b7ae9['user']['get']({'plain':!![]});if(!_0x5dc12a)throw new Error(_0xcaea('0x36'));if(_0x5dc12a[_0xcaea('0x37')]===_0xcaea('0x38')){var _0x2e9a19=_0x2c9e08[_0xcaea('0x18')]({'plain':!![]});var _0x37433f=_0xcaea('0x19');return db[_0xcaea('0x39')][_0xcaea('0x34')]({'where':{'name':_0x37433f,'userProfileId':_0x5dc12a[_0xcaea('0x3a')]},'raw':!![]})[_0xcaea('0x17')](function(_0x1986c8){if(_0x1986c8&&_0x1986c8[_0xcaea('0x3b')]===0x0){return db[_0xcaea('0x1a')][_0xcaea('0x35')]({'name':_0x2e9a19[_0xcaea('0x1d')],'resourceId':_0x2e9a19['id'],'type':_0x1986c8[_0xcaea('0x1d')],'sectionId':_0x1986c8['id']},{})[_0xcaea('0x17')](function(){return _0x2c9e08;});}else{return _0x2c9e08;}})['catch'](function(_0x23c57c){logger[_0xcaea('0x1c')](_0xcaea('0x3c'),_0x23c57c);throw _0x23c57c;});}return _0x2c9e08;})[_0xcaea('0x17')](respondWithResult(_0x12d306,0xc9))[_0xcaea('0x29')](handleError(_0x12d306,null));};exports[_0xcaea('0x15')]=function(_0x1a7f68,_0x1d14a3){if(_0x1a7f68['body']['id']){delete _0x1a7f68[_0xcaea('0x3d')]['id'];}return db[_0xcaea('0x24')][_0xcaea('0x34')]({'where':{'id':_0x1a7f68[_0xcaea('0x2b')]['id']}})[_0xcaea('0x17')](handleEntityNotFound(_0x1d14a3,null))[_0xcaea('0x17')](saveUpdates(_0x1a7f68[_0xcaea('0x3d')],null))[_0xcaea('0x17')](respondWithResult(_0x1d14a3,null))[_0xcaea('0x29')](handleError(_0x1d14a3,null));};exports[_0xcaea('0x16')]=function(_0x53896b,_0x444e77){return db[_0xcaea('0x24')][_0xcaea('0x34')]({'where':{'id':_0x53896b['params']['id']}})['then'](handleEntityNotFound(_0x444e77,null))[_0xcaea('0x17')](removeEntity(_0x444e77,null))[_0xcaea('0x29')](handleError(_0x444e77,null));};exports[_0xcaea('0x3e')]=function(_0x436ebc,_0x176f75){return db['WhatsappQueue'][_0xcaea('0x3e')]()[_0xcaea('0x17')](respondWithResult(_0x176f75,null))[_0xcaea('0x29')](handleError(_0x176f75,null));};exports[_0xcaea('0x3f')]=function(_0x3f00bb,_0x11a0a6){var _0x3a1339={'raw':!![],'where':{}},_0xca27cc={},_0x104b49;return db[_0xcaea('0x24')][_0xcaea('0x40')]({'where':{'id':_0x3f00bb['params']['id']}})[_0xcaea('0x17')](handleEntityNotFound(_0x11a0a6,null))['then'](function(_0x5f2619){if(_0x5f2619){_0x104b49=_0x5f2619[_0xcaea('0x18')]({'plain':!![]});_0xca27cc['model']=_['keys'](db[_0xcaea('0x41')]['rawAttributes']);_0xca27cc['query']=_[_0xcaea('0x2d')](_0x3f00bb[_0xcaea('0x26')]);_0xca27cc['filters']=_['intersection'](_0xca27cc['model'],_0xca27cc[_0xcaea('0x26')]);_0x3a1339['attributes']=_[_0xcaea('0x2e')](_0xca27cc[_0xcaea('0x2c')],qs['fields'](_0x3f00bb['query'][_0xcaea('0x30')]));_0x3a1339[_0xcaea('0x2f')]=_0x3a1339[_0xcaea('0x2f')][_0xcaea('0x31')]?_0x3a1339[_0xcaea('0x2f')]:_0xca27cc[_0xcaea('0x2c')];if(!_0x3f00bb[_0xcaea('0x26')][_0xcaea('0x42')]('nolimit')){_0x3a1339[_0xcaea('0x10')]=qs['limit'](_0x3f00bb[_0xcaea('0x26')]['limit']);_0x3a1339[_0xcaea('0x12')]=qs[_0xcaea('0x12')](_0x3f00bb[_0xcaea('0x26')]['offset']);}_0x3a1339[_0xcaea('0x43')]=qs[_0xcaea('0x44')](_0x3f00bb[_0xcaea('0x26')][_0xcaea('0x44')]);_0x3a1339[_0xcaea('0x23')]=qs[_0xcaea('0x45')](_['pick'](_0x3f00bb[_0xcaea('0x26')],_0xca27cc[_0xcaea('0x45')]));_0x3a1339[_0xcaea('0x23')][_0xcaea('0x46')]=_0x5f2619['id'];if(_0x3f00bb[_0xcaea('0x26')]['filter']){_0x3a1339[_0xcaea('0x23')]=_[_0xcaea('0x33')](_0x3a1339[_0xcaea('0x23')],{'$or':_[_0xcaea('0x20')](_0x3a1339[_0xcaea('0x2f')],function(_0x15b146){var _0x3bc5cb={};_0x3bc5cb[_0x15b146]={'$like':'%'+_0x3f00bb[_0xcaea('0x26')][_0xcaea('0x47')]+'%'};return _0x3bc5cb;})});}_0x3a1339=_[_0xcaea('0x33')]({},_0x3a1339,_0x3f00bb[_0xcaea('0x48')]);return db[_0xcaea('0x41')][_0xcaea('0x27')](_0x3a1339);}})[_0xcaea('0x17')](function(_0x1a638b){if(_0x1a638b){return db[_0xcaea('0x49')][_0xcaea('0x4a')]({'where':{'id':_[_0xcaea('0x20')](_0x1a638b,'UserId'),'role':_0xcaea('0x4b')},'attributes':['id',_0xcaea('0x1d'),_0xcaea('0x4c'),_0xcaea('0x4d'),_0xcaea('0x4e')]});}})[_0xcaea('0x17')](function(_0x14db6c){if(_0x14db6c){return{'count':_0x14db6c[_0xcaea('0x11')],'rows':_[_0xcaea('0x20')](_0x14db6c[_0xcaea('0x28')],function(_0xdd626f){return{'membername':_0xdd626f[_0xcaea('0x1d')],'UserId':_0xdd626f['id'],'queue_name':_0x104b49[_0xcaea('0x1d')],'WhatsappQueueId':_0x104b49['id'],'interface':util['format'](_0xcaea('0x4f'),_0xcaea('0x50'),_0xdd626f[_0xcaea('0x1d')]),'penalty':0x0,'paused':_0xdd626f['whatsappPause'],'createdAt':_0xdd626f[_0xcaea('0x4e')],'updatedAt':_0xdd626f[_0xcaea('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcaea('0x17')](respondWithFilteredResult(_0x11a0a6,_0x3a1339))['catch'](handleError(_0x11a0a6,null));};exports['getTeams']=function(_0xad6008,_0x30b6aa){var _0x1e5eb6={};var _0x174fa0={};var _0x455d21;var _0x57f807;return db[_0xcaea('0x24')][_0xcaea('0x40')]({'where':{'id':_0xad6008[_0xcaea('0x2b')]['id']}})[_0xcaea('0x17')](handleEntityNotFound(_0x30b6aa,null))[_0xcaea('0x17')](function(_0x44619e){if(_0x44619e){_0x455d21=_0x44619e;_0x174fa0[_0xcaea('0x2c')]=_['keys'](db[_0xcaea('0x51')]['rawAttributes']);_0x174fa0[_0xcaea('0x26')]=_[_0xcaea('0x2d')](_0xad6008[_0xcaea('0x26')]);_0x174fa0[_0xcaea('0x45')]=_[_0xcaea('0x2e')](_0x174fa0[_0xcaea('0x2c')],_0x174fa0[_0xcaea('0x26')]);_0x1e5eb6[_0xcaea('0x2f')]=_[_0xcaea('0x2e')](_0x174fa0['model'],qs[_0xcaea('0x30')](_0xad6008[_0xcaea('0x26')][_0xcaea('0x30')]));_0x1e5eb6['attributes']=_0x1e5eb6['attributes']['length']?_0x1e5eb6[_0xcaea('0x2f')]:_0x174fa0[_0xcaea('0x2c')];_0x1e5eb6[_0xcaea('0x43')]=qs[_0xcaea('0x44')](_0xad6008['query'][_0xcaea('0x44')]);_0x1e5eb6[_0xcaea('0x23')]=qs[_0xcaea('0x45')](_[_0xcaea('0x52')](_0xad6008[_0xcaea('0x26')],_0x174fa0['filters']));if(_0xad6008[_0xcaea('0x26')][_0xcaea('0x47')]){_0x1e5eb6['where']=_[_0xcaea('0x33')](_0x1e5eb6[_0xcaea('0x23')],{'$or':_['map'](_0x1e5eb6['attributes'],function(_0x59868f){var _0x59264d={};_0x59264d[_0x59868f]={'$like':'%'+_0xad6008['query'][_0xcaea('0x47')]+'%'};return _0x59264d;})});}_0x1e5eb6=_[_0xcaea('0x33')]({},_0x1e5eb6,_0xad6008['options']);return _0x455d21[_0xcaea('0x53')](_0x1e5eb6);}})[_0xcaea('0x17')](function(_0xbb11ec){if(_0xbb11ec){_0x57f807=_0xbb11ec['length'];if(!_0xad6008[_0xcaea('0x26')][_0xcaea('0x42')](_0xcaea('0x54'))){_0x1e5eb6['limit']=qs['limit'](_0xad6008[_0xcaea('0x26')][_0xcaea('0x10')]);_0x1e5eb6[_0xcaea('0x12')]=qs[_0xcaea('0x12')](_0xad6008[_0xcaea('0x26')][_0xcaea('0x12')]);}return _0x455d21[_0xcaea('0x53')](_0x1e5eb6);}})[_0xcaea('0x17')](function(_0x315848){if(_0x315848){return _0x315848?{'count':_0x57f807,'rows':_0x315848}:null;}})[_0xcaea('0x17')](respondWithResult(_0x30b6aa,null))[_0xcaea('0x29')](handleError(_0x30b6aa,null));};exports[_0xcaea('0x55')]=function(_0x1ad1e8,_0x51bf9d){var _0x3aa89c=_0x1ad1e8[_0xcaea('0x3d')]['ids'];return db[_0xcaea('0x51')][_0xcaea('0x27')]({'where':{'id':_0x3aa89c},'attributes':['id'],'include':[{'model':db[_0xcaea('0x49')],'as':_0xcaea('0x56'),'attributes':['id',_0xcaea('0x1d'),_0xcaea('0x57'),_0xcaea('0x58'),'interface'],'raw':!![]}]})[_0xcaea('0x17')](function(_0xb18e2d){if(_0xb18e2d){var _0x5e85dc=_[_0xcaea('0x59')](_0xb18e2d,function(_0xebaf22){var _0x4c8027=_0xebaf22[_0xcaea('0x18')]({'plain':!![]});return _0x4c8027[_0xcaea('0x56')];});return db[_0xcaea('0x24')]['find']({'where':{'id':_0x1ad1e8[_0xcaea('0x2b')]['id']}})['then'](function(_0x4e0344){return db[_0xcaea('0x5a')][_0xcaea('0x5b')](function(_0x142e3b){return _0x4e0344[_0xcaea('0x55')](_0x3aa89c,{'transaction':_0x142e3b})[_0xcaea('0x17')](function(){return BPromise[_0xcaea('0x5c')](_0x5e85dc,function(_0x59ccc8){return db[_0xcaea('0x41')][_0xcaea('0x5d')]({'where':{'UserId':_0x59ccc8['id'],'WhatsappQueueId':_0x1ad1e8[_0xcaea('0x2b')]['id']},'transaction':_0x142e3b});});})[_0xcaea('0x17')](function(){_0x5e85dc[_0xcaea('0x5e')](function(_0x4287c1){socket[_0xcaea('0x5f')]('userWhatsappQueue:save',{'UserId':_0x4287c1['id'],'WhatsappQueueId':_0x4e0344['id']});});});});});}})['then'](respondWithStatusCode(_0x51bf9d,null))[_0xcaea('0x29')](handleError(_0x51bf9d,null));};exports[_0xcaea('0x60')]=function(_0x30c9e7,_0xa16dee){return db[_0xcaea('0x51')][_0xcaea('0x27')]({'where':{'id':_0x30c9e7[_0xcaea('0x26')][_0xcaea('0x61')]},'attributes':['id'],'include':[{'model':db[_0xcaea('0x49')],'as':_0xcaea('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa16dee,null))[_0xcaea('0x17')](function(_0xa35b2f){var _0x2a691c=_[_0xcaea('0x20')](_0xa35b2f,'id');var _0x96a320=[];var _0x3e50de=[];var _0x35c627=squel[_0xcaea('0x62')]();_0x35c627[_0xcaea('0x63')]('tq.TeamId')[_0xcaea('0x64')](_0xcaea('0x65'),'tq')[_0xcaea('0x66')](_0xcaea('0x67'),'ut',_0xcaea('0x68'))[_0xcaea('0x23')](_0xcaea('0x69'),_0x30c9e7[_0xcaea('0x2b')]['id']);for(var _0x21b9cb=0x0;_0x21b9cb<_0xa35b2f[_0xcaea('0x31')];_0x21b9cb+=0x1){let _0x188bfd=_0xa35b2f[_0x21b9cb];for(var _0x3f7de2=0x0;_0x3f7de2<_0x188bfd[_0xcaea('0x56')]['length'];_0x3f7de2+=0x1){let _0x16e297=_0x188bfd[_0xcaea('0x56')][_0x3f7de2];var _0x597e69=_0x35c627[_0xcaea('0x6a')]();_0x597e69[_0xcaea('0x23')](_0xcaea('0x6b'),_0x16e297['id']);_0x3e50de['push'](db[_0xcaea('0x5a')]['query'](_0x597e69[_0xcaea('0x6c')](),{'type':db['sequelize'][_0xcaea('0x6d')][_0xcaea('0x6e')]})[_0xcaea('0x17')](function(_0x2f762a){if(_0x2f762a[_0xcaea('0x31')]===0x1){return _0x16e297['id'];}else{var _0xc5dd2f=_[_0xcaea('0x6f')](_[_0xcaea('0x20')](_0x2f762a,'TeamId'),function(_0x5707ac){return _[_0xcaea('0x70')](_0x2a691c,_0x5707ac);});if(_0xc5dd2f){return _0x16e297['id'];}}}));}}return BPromise[_0xcaea('0x71')](_0x3e50de)['then'](function(_0x4d0d38){_0x96a320=_(_0x96a320)[_0xcaea('0x72')](_0x4d0d38)[_0xcaea('0x73')]()['value']();return db[_0xcaea('0x24')][_0xcaea('0x34')]({'where':{'id':_0x30c9e7[_0xcaea('0x2b')]['id']}})[_0xcaea('0x17')](function(_0x56a85f){return db['sequelize'][_0xcaea('0x5b')](function(_0x18cd03){return _0x56a85f[_0xcaea('0x60')](_0x30c9e7['query'][_0xcaea('0x61')],{'transaction':_0x18cd03})[_0xcaea('0x17')](function(){if(!_[_0xcaea('0x74')](_0x96a320)){return _0x56a85f[_0xcaea('0x75')](_0x96a320,{'transaction':_0x18cd03});}})[_0xcaea('0x17')](function(){_0x96a320[_0xcaea('0x5e')](function(_0x4d875d){socket[_0xcaea('0x5f')](_0xcaea('0x76'),{'UserId':_0x4d875d,'WhatsappQueueId':_0x56a85f['id']});});});});});});})[_0xcaea('0x17')](respondWithStatusCode(_0xa16dee,null))[_0xcaea('0x29')](handleError(_0xa16dee,null));};exports['addAgents']=function(_0x429478,_0x4eee81){return db[_0xcaea('0x24')][_0xcaea('0x34')]({'where':{'id':_0x429478[_0xcaea('0x2b')]['id']}})[_0xcaea('0x17')](handleEntityNotFound(_0x4eee81,null))[_0xcaea('0x17')](function(_0x2cfb8b){if(_0x2cfb8b){return _0x2cfb8b[_0xcaea('0x77')](_0x429478[_0xcaea('0x3d')][_0xcaea('0x61')],_['omit'](_0x429478[_0xcaea('0x3d')],['ids','id'])||{})[_0xcaea('0x78')](function(_0x5ae57d){for(var _0x37387a=0x0;_0x37387a<_0x429478['body'][_0xcaea('0x61')][_0xcaea('0x31')];_0x37387a+=0x1){socket[_0xcaea('0x5f')](_0xcaea('0x79'),{'UserId':Number(_0x429478[_0xcaea('0x3d')][_0xcaea('0x61')][_0x37387a]),'WhatsappQueueId':Number(_0x429478[_0xcaea('0x2b')]['id'])});}return _0x5ae57d;});}})[_0xcaea('0x17')](respondWithResult(_0x4eee81,null))[_0xcaea('0x29')](handleError(_0x4eee81,null));};exports['removeAgents']=function(_0xa3e2a5,_0x495dd3){return db[_0xcaea('0x24')][_0xcaea('0x34')]({'where':{'id':_0xa3e2a5[_0xcaea('0x2b')]['id']}})[_0xcaea('0x17')](handleEntityNotFound(_0x495dd3,null))['then'](function(_0x4e1b6e){if(_0x4e1b6e){return _0x4e1b6e[_0xcaea('0x75')](_0xa3e2a5[_0xcaea('0x26')]['ids'])['then'](function(){if(_['isArray'](_0xa3e2a5[_0xcaea('0x26')]['ids'])){for(var _0x595e12=0x0;_0x595e12<_0xa3e2a5[_0xcaea('0x26')][_0xcaea('0x61')][_0xcaea('0x31')];_0x595e12+=0x1){socket[_0xcaea('0x5f')](_0xcaea('0x76'),{'UserId':Number(_0xa3e2a5['query']['ids'][_0x595e12]),'WhatsappQueueId':Number(_0xa3e2a5['params']['id'])});}}else{socket[_0xcaea('0x5f')](_0xcaea('0x76'),{'UserId':Number(_0xa3e2a5[_0xcaea('0x26')][_0xcaea('0x61')]),'WhatsappQueueId':Number(_0xa3e2a5['params']['id'])});}});}})[_0xcaea('0x17')](respondWithStatusCode(_0x495dd3,null))['catch'](handleError(_0x495dd3,null));};exports[_0xcaea('0x7a')]=function(_0x3c68f6,_0x4fc9a6){var _0x18bdc0={};var _0x2d23b9={};var _0x370219;var _0x1ddf7b;return db[_0xcaea('0x24')][_0xcaea('0x40')]({'where':{'id':_0x3c68f6['params']['id']}})[_0xcaea('0x17')](handleEntityNotFound(_0x4fc9a6,null))[_0xcaea('0x17')](function(_0x5c318e){if(_0x5c318e){_0x370219=_0x5c318e;_0x2d23b9['model']=_[_0xcaea('0x2d')](db[_0xcaea('0x49')]['rawAttributes']);_0x2d23b9[_0xcaea('0x26')]=_[_0xcaea('0x2d')](_0x3c68f6['query']);_0x2d23b9[_0xcaea('0x45')]=_[_0xcaea('0x2e')](_0x2d23b9['model'],_0x2d23b9[_0xcaea('0x26')]);_0x18bdc0['attributes']=_[_0xcaea('0x2e')](_0x2d23b9[_0xcaea('0x2c')],qs[_0xcaea('0x30')](_0x3c68f6['query'][_0xcaea('0x30')]));_0x18bdc0[_0xcaea('0x2f')]=_0x18bdc0[_0xcaea('0x2f')][_0xcaea('0x31')]?_0x18bdc0['attributes']:_0x2d23b9[_0xcaea('0x2c')];_0x18bdc0[_0xcaea('0x43')]=qs['sort'](_0x3c68f6[_0xcaea('0x26')][_0xcaea('0x44')]);_0x18bdc0[_0xcaea('0x23')]=qs[_0xcaea('0x45')](_[_0xcaea('0x52')](_0x3c68f6[_0xcaea('0x26')],_0x2d23b9[_0xcaea('0x45')]));if(_0x3c68f6['query']['filter']){_0x18bdc0['where']=_[_0xcaea('0x33')](_0x18bdc0['where'],{'$or':_[_0xcaea('0x20')](_0x18bdc0['attributes'],function(_0x14a73e){var _0x1be52e={};_0x1be52e[_0x14a73e]={'$like':'%'+_0x3c68f6[_0xcaea('0x26')]['filter']+'%'};return _0x1be52e;})});}_0x18bdc0=_[_0xcaea('0x33')]({},_0x18bdc0,_0x3c68f6[_0xcaea('0x48')]);return _0x370219[_0xcaea('0x7a')](_0x18bdc0);}})[_0xcaea('0x17')](function(_0x450ebc){if(_0x450ebc){_0x1ddf7b=_0x450ebc['length'];if(!_0x3c68f6[_0xcaea('0x26')]['hasOwnProperty'](_0xcaea('0x54'))){_0x18bdc0[_0xcaea('0x10')]=qs['limit'](_0x3c68f6[_0xcaea('0x26')][_0xcaea('0x10')]);_0x18bdc0['offset']=qs['offset'](_0x3c68f6['query'][_0xcaea('0x12')]);}return _0x370219[_0xcaea('0x7a')](_0x18bdc0);}})[_0xcaea('0x17')](function(_0x5513ac){if(_0x5513ac){return _0x5513ac?{'count':_0x1ddf7b,'rows':_0x5513ac}:null;}})['then'](respondWithResult(_0x4fc9a6,null))['catch'](handleError(_0x4fc9a6,null));}; \ No newline at end of file +var _0xffc5=['WhatsappQueues','error','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','show','model','keys','filters','intersection','fields','attributes','length','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','find','describe','getMembers','findOne','UserWhatsappQueue','nolimit','limit','order','sort','pick','WhatsappQueueId','filter','map','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','hasOwnProperty','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','undefined','count','set','Content-Range','json','update','then','destroy','get'];(function(_0x4d8331,_0x1b852a){var _0x2c0c78=function(_0x1100c6){while(--_0x1100c6){_0x4d8331['push'](_0x4d8331['shift']());}};_0x2c0c78(++_0x1b852a);}(_0xffc5,0x161));var _0x5ffc=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xffc5[_0x3cb3ca];return _0x214366;};'use strict';var BPromise=require('bluebird');var util=require(_0x5ffc('0x0'));var _=require(_0x5ffc('0x1'));var squel=require(_0x5ffc('0x2'));var Redis=require('ioredis');var qs=require(_0x5ffc('0x3'));var logger=require(_0x5ffc('0x4'))(_0x5ffc('0x5'));var config=require(_0x5ffc('0x6'));var db=require(_0x5ffc('0x7'))['db'];config[_0x5ffc('0x8')]=_['defaults'](config[_0x5ffc('0x8')],{'host':_0x5ffc('0x9'),'port':0x18eb});var socket=require(_0x5ffc('0xa'))(new Redis(config[_0x5ffc('0x8')]));require(_0x5ffc('0xb'))[_0x5ffc('0xc')](socket);function respondWithStatusCode(_0x124e1d,_0x381d9e){_0x381d9e=_0x381d9e||0xcc;return function(_0x5ebfe5){if(_0x5ebfe5){return _0x124e1d['sendStatus'](_0x381d9e);}return _0x124e1d[_0x5ffc('0xd')](_0x381d9e)[_0x5ffc('0xe')]();};}function respondWithResult(_0x1401bb,_0x2a3705){_0x2a3705=_0x2a3705||0xc8;return function(_0x58b319){if(_0x58b319){return _0x1401bb[_0x5ffc('0xd')](_0x2a3705)['json'](_0x58b319);}};}function respondWithFilteredResult(_0x263b88,_0x509b3c){return function(_0x14738d){if(_0x14738d){var _0x5df797=typeof _0x509b3c[_0x5ffc('0xf')]===_0x5ffc('0x10')&&typeof _0x509b3c['limit']==='undefined';var _0x56979d=_0x14738d[_0x5ffc('0x11')];var _0x86fb80=_0x5df797?0x0:_0x509b3c['offset'];var _0x1b71fd=_0x5df797?_0x14738d[_0x5ffc('0x11')]:_0x509b3c[_0x5ffc('0xf')]+_0x509b3c['limit'];var _0x1081cb;if(_0x1b71fd>=_0x56979d){_0x1b71fd=_0x56979d;_0x1081cb=0xc8;}else{_0x1081cb=0xce;}_0x263b88['status'](_0x1081cb);return _0x263b88[_0x5ffc('0x12')](_0x5ffc('0x13'),_0x86fb80+'-'+_0x1b71fd+'/'+_0x56979d)[_0x5ffc('0x14')](_0x14738d);}return null;};}function saveUpdates(_0x1a1aea){return function(_0x44031c){if(_0x44031c){return _0x44031c[_0x5ffc('0x15')](_0x1a1aea)[_0x5ffc('0x16')](function(_0x2471f3){return _0x2471f3;});}return null;};}function removeEntity(_0x56bc50){return function(_0x560b01){if(_0x560b01){return _0x560b01[_0x5ffc('0x17')]()[_0x5ffc('0x16')](function(){var _0x2abec9=_0x560b01[_0x5ffc('0x18')]({'plain':!![]});var _0x185664=_0x5ffc('0x19');return db['UserProfileResource'][_0x5ffc('0x17')]({'where':{'type':_0x185664,'resourceId':_0x2abec9['id']}})[_0x5ffc('0x16')](function(){return _0x560b01;});})[_0x5ffc('0x16')](function(){_0x56bc50[_0x5ffc('0xd')](0xcc)[_0x5ffc('0xe')]();});}};}function handleEntityNotFound(_0x661244){return function(_0x2dc7d1){if(!_0x2dc7d1){_0x661244['sendStatus'](0x194);}return _0x2dc7d1;};}function handleError(_0x309f9b,_0x23b2f4){_0x23b2f4=_0x23b2f4||0x1f4;return function(_0xc5a5ba){logger[_0x5ffc('0x1a')](_0xc5a5ba['stack']);if(_0xc5a5ba[_0x5ffc('0x1b')]){delete _0xc5a5ba[_0x5ffc('0x1b')];}_0x309f9b[_0x5ffc('0xd')](_0x23b2f4)[_0x5ffc('0x1c')](_0xc5a5ba);};}exports[_0x5ffc('0x1d')]=function(_0x58ca93,_0x52ca45){var _0x410fdd={};var _0x367144={'count':0x0,'rows':[]};var _0x3ab46b=_['map'](db[_0x5ffc('0x1e')][_0x5ffc('0x1f')],function(_0x3ca7d8){return{'name':_0x3ca7d8[_0x5ffc('0x20')],'type':_0x3ca7d8[_0x5ffc('0x21')][_0x5ffc('0x22')]};});_0x410fdd=qs[_0x5ffc('0x23')](_0x3ab46b,_0x58ca93);var _0x343e2a={'where':_0x410fdd[_0x5ffc('0x24')]};return db[_0x5ffc('0x1e')][_0x5ffc('0x11')](_0x343e2a)[_0x5ffc('0x16')](function(_0x5d7b66){_0x367144[_0x5ffc('0x11')]=_0x5d7b66;_0x410fdd[_0x5ffc('0x25')]=qs['include'](_0x58ca93[_0x5ffc('0x26')]);return db[_0x5ffc('0x1e')][_0x5ffc('0x27')](_0x410fdd);})[_0x5ffc('0x16')](function(_0x2af469){_0x367144[_0x5ffc('0x28')]=_0x2af469;return _0x367144;})[_0x5ffc('0x16')](respondWithFilteredResult(_0x52ca45,_0x410fdd))['catch'](handleError(_0x52ca45,null));};exports[_0x5ffc('0x29')]=function(_0x103157,_0x594593){var _0x22be8c={'raw':!![],'where':{'id':_0x103157['params']['id']}},_0x40a2db={};_0x40a2db[_0x5ffc('0x2a')]=_[_0x5ffc('0x2b')](db[_0x5ffc('0x1e')][_0x5ffc('0x1f')]);_0x40a2db[_0x5ffc('0x26')]=_[_0x5ffc('0x2b')](_0x103157['query']);_0x40a2db[_0x5ffc('0x2c')]=_[_0x5ffc('0x2d')](_0x40a2db[_0x5ffc('0x2a')],_0x40a2db['query']);_0x22be8c['attributes']=_[_0x5ffc('0x2d')](_0x40a2db[_0x5ffc('0x2a')],qs[_0x5ffc('0x2e')](_0x103157[_0x5ffc('0x26')][_0x5ffc('0x2e')]));_0x22be8c[_0x5ffc('0x2f')]=_0x22be8c[_0x5ffc('0x2f')][_0x5ffc('0x30')]?_0x22be8c[_0x5ffc('0x2f')]:_0x40a2db[_0x5ffc('0x2a')];if(_0x103157[_0x5ffc('0x26')]['includeAll']){_0x22be8c[_0x5ffc('0x25')]=[{'all':!![]}];}_0x22be8c=_[_0x5ffc('0x31')]({},_0x22be8c,_0x103157[_0x5ffc('0x32')]);return db['WhatsappQueue']['find'](_0x22be8c)[_0x5ffc('0x16')](handleEntityNotFound(_0x594593,null))[_0x5ffc('0x16')](respondWithResult(_0x594593,null))[_0x5ffc('0x33')](handleError(_0x594593,null));};exports[_0x5ffc('0x34')]=function(_0x23a6ad,_0x4a83f0){return db['WhatsappQueue'][_0x5ffc('0x34')](_0x23a6ad[_0x5ffc('0x35')],{})[_0x5ffc('0x16')](function(_0x18603e){var _0x410478=_0x23a6ad[_0x5ffc('0x36')][_0x5ffc('0x18')]({'plain':!![]});if(!_0x410478)throw new Error(_0x5ffc('0x37'));if(_0x410478[_0x5ffc('0x38')]==='user'){var _0x559819=_0x18603e[_0x5ffc('0x18')]({'plain':!![]});var _0x281728=_0x5ffc('0x19');return db[_0x5ffc('0x39')]['find']({'where':{'name':_0x281728,'userProfileId':_0x410478[_0x5ffc('0x3a')]},'raw':!![]})['then'](function(_0x582711){if(_0x582711&&_0x582711[_0x5ffc('0x3b')]===0x0){return db[_0x5ffc('0x3c')][_0x5ffc('0x34')]({'name':_0x559819[_0x5ffc('0x1b')],'resourceId':_0x559819['id'],'type':_0x582711['name'],'sectionId':_0x582711['id']},{})[_0x5ffc('0x16')](function(){return _0x18603e;});}else{return _0x18603e;}})[_0x5ffc('0x33')](function(_0x554023){logger[_0x5ffc('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x554023);throw _0x554023;});}return _0x18603e;})[_0x5ffc('0x16')](respondWithResult(_0x4a83f0,0xc9))[_0x5ffc('0x33')](handleError(_0x4a83f0,null));};exports[_0x5ffc('0x15')]=function(_0x55dbec,_0x1066b1){if(_0x55dbec[_0x5ffc('0x35')]['id']){delete _0x55dbec[_0x5ffc('0x35')]['id'];}return db[_0x5ffc('0x1e')]['find']({'where':{'id':_0x55dbec[_0x5ffc('0x3d')]['id']}})[_0x5ffc('0x16')](handleEntityNotFound(_0x1066b1,null))[_0x5ffc('0x16')](saveUpdates(_0x55dbec[_0x5ffc('0x35')],null))['then'](respondWithResult(_0x1066b1,null))['catch'](handleError(_0x1066b1,null));};exports[_0x5ffc('0x17')]=function(_0x5bf13b,_0x56f34c){return db[_0x5ffc('0x1e')][_0x5ffc('0x3e')]({'where':{'id':_0x5bf13b[_0x5ffc('0x3d')]['id']}})[_0x5ffc('0x16')](handleEntityNotFound(_0x56f34c,null))[_0x5ffc('0x16')](removeEntity(_0x56f34c,null))[_0x5ffc('0x33')](handleError(_0x56f34c,null));};exports[_0x5ffc('0x3f')]=function(_0x29e93e,_0x35bdc9){return db[_0x5ffc('0x1e')][_0x5ffc('0x3f')]()[_0x5ffc('0x16')](respondWithResult(_0x35bdc9,null))[_0x5ffc('0x33')](handleError(_0x35bdc9,null));};exports[_0x5ffc('0x40')]=function(_0x1a6c17,_0x25816c){var _0x11d3e0={'raw':!![],'where':{}},_0x12bf2f={},_0x491f7f;return db[_0x5ffc('0x1e')][_0x5ffc('0x41')]({'where':{'id':_0x1a6c17[_0x5ffc('0x3d')]['id']}})[_0x5ffc('0x16')](handleEntityNotFound(_0x25816c,null))[_0x5ffc('0x16')](function(_0x202ab8){if(_0x202ab8){_0x491f7f=_0x202ab8['get']({'plain':!![]});_0x12bf2f[_0x5ffc('0x2a')]=_[_0x5ffc('0x2b')](db[_0x5ffc('0x42')][_0x5ffc('0x1f')]);_0x12bf2f['query']=_[_0x5ffc('0x2b')](_0x1a6c17[_0x5ffc('0x26')]);_0x12bf2f[_0x5ffc('0x2c')]=_[_0x5ffc('0x2d')](_0x12bf2f['model'],_0x12bf2f['query']);_0x11d3e0[_0x5ffc('0x2f')]=_[_0x5ffc('0x2d')](_0x12bf2f[_0x5ffc('0x2a')],qs['fields'](_0x1a6c17[_0x5ffc('0x26')][_0x5ffc('0x2e')]));_0x11d3e0['attributes']=_0x11d3e0['attributes'][_0x5ffc('0x30')]?_0x11d3e0[_0x5ffc('0x2f')]:_0x12bf2f[_0x5ffc('0x2a')];if(!_0x1a6c17[_0x5ffc('0x26')]['hasOwnProperty'](_0x5ffc('0x43'))){_0x11d3e0[_0x5ffc('0x44')]=qs[_0x5ffc('0x44')](_0x1a6c17[_0x5ffc('0x26')]['limit']);_0x11d3e0[_0x5ffc('0xf')]=qs[_0x5ffc('0xf')](_0x1a6c17[_0x5ffc('0x26')][_0x5ffc('0xf')]);}_0x11d3e0[_0x5ffc('0x45')]=qs[_0x5ffc('0x46')](_0x1a6c17[_0x5ffc('0x26')][_0x5ffc('0x46')]);_0x11d3e0[_0x5ffc('0x24')]=qs['filters'](_[_0x5ffc('0x47')](_0x1a6c17[_0x5ffc('0x26')],_0x12bf2f['filters']));_0x11d3e0[_0x5ffc('0x24')][_0x5ffc('0x48')]=_0x202ab8['id'];if(_0x1a6c17[_0x5ffc('0x26')][_0x5ffc('0x49')]){_0x11d3e0[_0x5ffc('0x24')]=_[_0x5ffc('0x31')](_0x11d3e0[_0x5ffc('0x24')],{'$or':_[_0x5ffc('0x4a')](_0x11d3e0[_0x5ffc('0x2f')],function(_0x4235ec){var _0x82da1e={};_0x82da1e[_0x4235ec]={'$like':'%'+_0x1a6c17[_0x5ffc('0x26')]['filter']+'%'};return _0x82da1e;})});}_0x11d3e0=_['merge']({},_0x11d3e0,_0x1a6c17[_0x5ffc('0x32')]);return db[_0x5ffc('0x42')][_0x5ffc('0x27')](_0x11d3e0);}})['then'](function(_0x44427c){if(_0x44427c){return db[_0x5ffc('0x4b')]['findAndCountAll']({'where':{'id':_[_0x5ffc('0x4a')](_0x44427c,_0x5ffc('0x4c')),'role':_0x5ffc('0x4d')},'attributes':['id',_0x5ffc('0x1b'),_0x5ffc('0x4e'),_0x5ffc('0x4f'),_0x5ffc('0x50')]});}})[_0x5ffc('0x16')](function(_0x2b792a){if(_0x2b792a){return{'count':_0x2b792a['count'],'rows':_[_0x5ffc('0x4a')](_0x2b792a[_0x5ffc('0x28')],function(_0x49a839){return{'membername':_0x49a839[_0x5ffc('0x1b')],'UserId':_0x49a839['id'],'queue_name':_0x491f7f['name'],'WhatsappQueueId':_0x491f7f['id'],'interface':util[_0x5ffc('0x51')](_0x5ffc('0x52'),_0x5ffc('0x53'),_0x49a839[_0x5ffc('0x1b')]),'penalty':0x0,'paused':_0x49a839[_0x5ffc('0x4e')],'createdAt':_0x49a839[_0x5ffc('0x50')],'updatedAt':_0x49a839['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5ffc('0x16')](respondWithFilteredResult(_0x25816c,_0x11d3e0))[_0x5ffc('0x33')](handleError(_0x25816c,null));};exports['getTeams']=function(_0x1ab9a8,_0x5ad234){var _0x555b08={};var _0x504c1e={};var _0x110248;var _0x25c793;return db[_0x5ffc('0x1e')][_0x5ffc('0x41')]({'where':{'id':_0x1ab9a8['params']['id']}})[_0x5ffc('0x16')](handleEntityNotFound(_0x5ad234,null))[_0x5ffc('0x16')](function(_0x11e927){if(_0x11e927){_0x110248=_0x11e927;_0x504c1e[_0x5ffc('0x2a')]=_[_0x5ffc('0x2b')](db[_0x5ffc('0x54')][_0x5ffc('0x1f')]);_0x504c1e['query']=_['keys'](_0x1ab9a8['query']);_0x504c1e[_0x5ffc('0x2c')]=_['intersection'](_0x504c1e[_0x5ffc('0x2a')],_0x504c1e[_0x5ffc('0x26')]);_0x555b08['attributes']=_['intersection'](_0x504c1e[_0x5ffc('0x2a')],qs['fields'](_0x1ab9a8[_0x5ffc('0x26')]['fields']));_0x555b08[_0x5ffc('0x2f')]=_0x555b08[_0x5ffc('0x2f')][_0x5ffc('0x30')]?_0x555b08[_0x5ffc('0x2f')]:_0x504c1e['model'];_0x555b08[_0x5ffc('0x45')]=qs[_0x5ffc('0x46')](_0x1ab9a8[_0x5ffc('0x26')][_0x5ffc('0x46')]);_0x555b08['where']=qs[_0x5ffc('0x2c')](_[_0x5ffc('0x47')](_0x1ab9a8[_0x5ffc('0x26')],_0x504c1e[_0x5ffc('0x2c')]));if(_0x1ab9a8[_0x5ffc('0x26')][_0x5ffc('0x49')]){_0x555b08[_0x5ffc('0x24')]=_['merge'](_0x555b08[_0x5ffc('0x24')],{'$or':_[_0x5ffc('0x4a')](_0x555b08[_0x5ffc('0x2f')],function(_0x3ee900){var _0x54231e={};_0x54231e[_0x3ee900]={'$like':'%'+_0x1ab9a8['query'][_0x5ffc('0x49')]+'%'};return _0x54231e;})});}_0x555b08=_[_0x5ffc('0x31')]({},_0x555b08,_0x1ab9a8[_0x5ffc('0x32')]);return _0x110248[_0x5ffc('0x55')](_0x555b08);}})['then'](function(_0x5617c6){if(_0x5617c6){_0x25c793=_0x5617c6[_0x5ffc('0x30')];if(!_0x1ab9a8[_0x5ffc('0x26')]['hasOwnProperty'](_0x5ffc('0x43'))){_0x555b08[_0x5ffc('0x44')]=qs[_0x5ffc('0x44')](_0x1ab9a8[_0x5ffc('0x26')][_0x5ffc('0x44')]);_0x555b08[_0x5ffc('0xf')]=qs[_0x5ffc('0xf')](_0x1ab9a8[_0x5ffc('0x26')]['offset']);}return _0x110248['getTeams'](_0x555b08);}})[_0x5ffc('0x16')](function(_0x3e8376){if(_0x3e8376){return _0x3e8376?{'count':_0x25c793,'rows':_0x3e8376}:null;}})[_0x5ffc('0x16')](respondWithResult(_0x5ad234,null))[_0x5ffc('0x33')](handleError(_0x5ad234,null));};exports['addTeams']=function(_0x15f7ee,_0x34e9c6){var _0x581969=_0x15f7ee['body'][_0x5ffc('0x56')];return db[_0x5ffc('0x54')]['findAll']({'where':{'id':_0x581969},'attributes':['id'],'include':[{'model':db[_0x5ffc('0x4b')],'as':_0x5ffc('0x57'),'attributes':['id',_0x5ffc('0x1b'),_0x5ffc('0x58'),_0x5ffc('0x59'),_0x5ffc('0x5a')],'raw':!![]}]})['then'](function(_0x209764){if(_0x209764){var _0x7c911d=_[_0x5ffc('0x5b')](_0x209764,function(_0x82d3cd){var _0x2df3c4=_0x82d3cd[_0x5ffc('0x18')]({'plain':!![]});return _0x2df3c4[_0x5ffc('0x57')];});return db['WhatsappQueue'][_0x5ffc('0x3e')]({'where':{'id':_0x15f7ee[_0x5ffc('0x3d')]['id']}})[_0x5ffc('0x16')](function(_0x466696){return db[_0x5ffc('0x5c')][_0x5ffc('0x5d')](function(_0x4dd989){return _0x466696[_0x5ffc('0x5e')](_0x581969,{'transaction':_0x4dd989})[_0x5ffc('0x16')](function(){return BPromise['each'](_0x7c911d,function(_0x16d8b3){return db[_0x5ffc('0x42')]['findOrCreate']({'where':{'UserId':_0x16d8b3['id'],'WhatsappQueueId':_0x15f7ee[_0x5ffc('0x3d')]['id']},'transaction':_0x4dd989});});})[_0x5ffc('0x16')](function(){_0x7c911d[_0x5ffc('0x5f')](function(_0x26914b){socket[_0x5ffc('0x60')](_0x5ffc('0x61'),{'UserId':_0x26914b['id'],'WhatsappQueueId':_0x466696['id']});});});});});}})[_0x5ffc('0x16')](respondWithStatusCode(_0x34e9c6,null))['catch'](handleError(_0x34e9c6,null));};exports[_0x5ffc('0x62')]=function(_0x44a0fd,_0x449997){return db['Team'][_0x5ffc('0x27')]({'where':{'id':_0x44a0fd['query'][_0x5ffc('0x56')]},'attributes':['id'],'include':[{'model':db[_0x5ffc('0x4b')],'as':_0x5ffc('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x449997,null))['then'](function(_0xf20c02){var _0xd3c325=_[_0x5ffc('0x4a')](_0xf20c02,'id');var _0x58c10c=[];var _0x414555=[];var _0x8dff37=squel[_0x5ffc('0x63')]();_0x8dff37[_0x5ffc('0x64')](_0x5ffc('0x65'))[_0x5ffc('0x66')](_0x5ffc('0x67'),'tq')[_0x5ffc('0x68')](_0x5ffc('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x5ffc('0x6a'),_0x44a0fd['params']['id']);for(var _0x4f1ca3=0x0;_0x4f1ca3<_0xf20c02[_0x5ffc('0x30')];_0x4f1ca3+=0x1){let _0x237999=_0xf20c02[_0x4f1ca3];for(var _0x45ea5c=0x0;_0x45ea5c<_0x237999['Agents'][_0x5ffc('0x30')];_0x45ea5c+=0x1){let _0x1c22ca=_0x237999[_0x5ffc('0x57')][_0x45ea5c];var _0x98f44f=_0x8dff37[_0x5ffc('0x6b')]();_0x98f44f[_0x5ffc('0x24')](_0x5ffc('0x6c'),_0x1c22ca['id']);_0x414555['push'](db[_0x5ffc('0x5c')]['query'](_0x98f44f[_0x5ffc('0x6d')](),{'type':db[_0x5ffc('0x5c')][_0x5ffc('0x6e')][_0x5ffc('0x6f')]})[_0x5ffc('0x16')](function(_0x3c6305){if(_0x3c6305[_0x5ffc('0x30')]===0x1){return _0x1c22ca['id'];}else{var _0xfd4433=_[_0x5ffc('0x70')](_[_0x5ffc('0x4a')](_0x3c6305,_0x5ffc('0x71')),function(_0x5ca404){return _['includes'](_0xd3c325,_0x5ca404);});if(_0xfd4433){return _0x1c22ca['id'];}}}));}}return BPromise[_0x5ffc('0x72')](_0x414555)[_0x5ffc('0x16')](function(_0x3bec18){_0x58c10c=_(_0x58c10c)[_0x5ffc('0x73')](_0x3bec18)[_0x5ffc('0x74')]()[_0x5ffc('0x75')]();return db[_0x5ffc('0x1e')][_0x5ffc('0x3e')]({'where':{'id':_0x44a0fd[_0x5ffc('0x3d')]['id']}})['then'](function(_0x410753){return db[_0x5ffc('0x5c')][_0x5ffc('0x5d')](function(_0x24ae40){return _0x410753[_0x5ffc('0x62')](_0x44a0fd[_0x5ffc('0x26')][_0x5ffc('0x56')],{'transaction':_0x24ae40})['then'](function(){if(!_['isEmpty'](_0x58c10c)){return _0x410753[_0x5ffc('0x76')](_0x58c10c,{'transaction':_0x24ae40});}})[_0x5ffc('0x16')](function(){_0x58c10c[_0x5ffc('0x5f')](function(_0x11b38a){socket[_0x5ffc('0x60')](_0x5ffc('0x77'),{'UserId':_0x11b38a,'WhatsappQueueId':_0x410753['id']});});});});});});})[_0x5ffc('0x16')](respondWithStatusCode(_0x449997,null))[_0x5ffc('0x33')](handleError(_0x449997,null));};exports[_0x5ffc('0x78')]=function(_0x4c03f5,_0x386277){return db['WhatsappQueue'][_0x5ffc('0x3e')]({'where':{'id':_0x4c03f5[_0x5ffc('0x3d')]['id']}})[_0x5ffc('0x16')](handleEntityNotFound(_0x386277,null))[_0x5ffc('0x16')](function(_0x319b69){if(_0x319b69){return _0x319b69[_0x5ffc('0x78')](_0x4c03f5[_0x5ffc('0x35')]['ids'],_[_0x5ffc('0x79')](_0x4c03f5[_0x5ffc('0x35')],[_0x5ffc('0x56'),'id'])||{})[_0x5ffc('0x7a')](function(_0x35490a){for(var _0x326d5e=0x0;_0x326d5e<_0x4c03f5[_0x5ffc('0x35')][_0x5ffc('0x56')]['length'];_0x326d5e+=0x1){socket[_0x5ffc('0x60')]('userWhatsappQueue:save',{'UserId':Number(_0x4c03f5[_0x5ffc('0x35')][_0x5ffc('0x56')][_0x326d5e]),'WhatsappQueueId':Number(_0x4c03f5[_0x5ffc('0x3d')]['id'])});}return _0x35490a;});}})[_0x5ffc('0x16')](respondWithResult(_0x386277,null))[_0x5ffc('0x33')](handleError(_0x386277,null));};exports[_0x5ffc('0x76')]=function(_0x2d221f,_0x464e3a){return db['WhatsappQueue']['find']({'where':{'id':_0x2d221f[_0x5ffc('0x3d')]['id']}})[_0x5ffc('0x16')](handleEntityNotFound(_0x464e3a,null))['then'](function(_0x54e238){if(_0x54e238){return _0x54e238[_0x5ffc('0x76')](_0x2d221f[_0x5ffc('0x26')][_0x5ffc('0x56')])[_0x5ffc('0x16')](function(){if(_[_0x5ffc('0x7b')](_0x2d221f[_0x5ffc('0x26')]['ids'])){for(var _0x550a3e=0x0;_0x550a3e<_0x2d221f[_0x5ffc('0x26')]['ids'][_0x5ffc('0x30')];_0x550a3e+=0x1){socket[_0x5ffc('0x60')](_0x5ffc('0x77'),{'UserId':Number(_0x2d221f[_0x5ffc('0x26')][_0x5ffc('0x56')][_0x550a3e]),'WhatsappQueueId':Number(_0x2d221f[_0x5ffc('0x3d')]['id'])});}}else{socket[_0x5ffc('0x60')]('userWhatsappQueue:remove',{'UserId':Number(_0x2d221f[_0x5ffc('0x26')]['ids']),'WhatsappQueueId':Number(_0x2d221f['params']['id'])});}});}})[_0x5ffc('0x16')](respondWithStatusCode(_0x464e3a,null))[_0x5ffc('0x33')](handleError(_0x464e3a,null));};exports['getAgents']=function(_0xd1796b,_0x25844b){var _0x520675={};var _0x3db5b1={};var _0x2537ce;var _0x507e6e;return db[_0x5ffc('0x1e')][_0x5ffc('0x41')]({'where':{'id':_0xd1796b[_0x5ffc('0x3d')]['id']}})[_0x5ffc('0x16')](handleEntityNotFound(_0x25844b,null))['then'](function(_0xe9c698){if(_0xe9c698){_0x2537ce=_0xe9c698;_0x3db5b1['model']=_[_0x5ffc('0x2b')](db[_0x5ffc('0x4b')][_0x5ffc('0x1f')]);_0x3db5b1[_0x5ffc('0x26')]=_[_0x5ffc('0x2b')](_0xd1796b['query']);_0x3db5b1[_0x5ffc('0x2c')]=_[_0x5ffc('0x2d')](_0x3db5b1[_0x5ffc('0x2a')],_0x3db5b1['query']);_0x520675[_0x5ffc('0x2f')]=_['intersection'](_0x3db5b1['model'],qs[_0x5ffc('0x2e')](_0xd1796b[_0x5ffc('0x26')][_0x5ffc('0x2e')]));_0x520675[_0x5ffc('0x2f')]=_0x520675[_0x5ffc('0x2f')]['length']?_0x520675[_0x5ffc('0x2f')]:_0x3db5b1[_0x5ffc('0x2a')];_0x520675[_0x5ffc('0x45')]=qs[_0x5ffc('0x46')](_0xd1796b[_0x5ffc('0x26')][_0x5ffc('0x46')]);_0x520675[_0x5ffc('0x24')]=qs['filters'](_[_0x5ffc('0x47')](_0xd1796b[_0x5ffc('0x26')],_0x3db5b1['filters']));if(_0xd1796b[_0x5ffc('0x26')][_0x5ffc('0x49')]){_0x520675[_0x5ffc('0x24')]=_[_0x5ffc('0x31')](_0x520675[_0x5ffc('0x24')],{'$or':_[_0x5ffc('0x4a')](_0x520675['attributes'],function(_0x250c4a){var _0x53da8f={};_0x53da8f[_0x250c4a]={'$like':'%'+_0xd1796b[_0x5ffc('0x26')][_0x5ffc('0x49')]+'%'};return _0x53da8f;})});}_0x520675=_[_0x5ffc('0x31')]({},_0x520675,_0xd1796b[_0x5ffc('0x32')]);return _0x2537ce['getAgents'](_0x520675);}})[_0x5ffc('0x16')](function(_0x408b46){if(_0x408b46){_0x507e6e=_0x408b46[_0x5ffc('0x30')];if(!_0xd1796b[_0x5ffc('0x26')][_0x5ffc('0x7c')]('nolimit')){_0x520675[_0x5ffc('0x44')]=qs['limit'](_0xd1796b[_0x5ffc('0x26')][_0x5ffc('0x44')]);_0x520675[_0x5ffc('0xf')]=qs['offset'](_0xd1796b['query'][_0x5ffc('0xf')]);}return _0x2537ce[_0x5ffc('0x7d')](_0x520675);}})['then'](function(_0x23730b){if(_0x23730b){return _0x23730b?{'count':_0x507e6e,'rows':_0x23730b}:null;}})[_0x5ffc('0x16')](respondWithResult(_0x25844b,null))[_0x5ffc('0x33')](handleError(_0x25844b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b5f5e0e..c7a336a 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1043=['update','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save'];(function(_0x5b374f,_0x357906){var _0x2de59e=function(_0x1930ca){while(--_0x1930ca){_0x5b374f['push'](_0x5b374f['shift']());}};_0x2de59e(++_0x357906);}(_0x1043,0x90));var _0x3104=function(_0x32ab88,_0x1ed0d6){_0x32ab88=_0x32ab88-0x0;var _0x2c483e=_0x1043[_0x32ab88];return _0x2c483e;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x3104('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3104('0x1')](0x0);var events={'afterCreate':_0x3104('0x2'),'afterUpdate':_0x3104('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1d4edf){return function(_0xfa730e,_0x3a2bbf,_0x19f8e9){WhatsappQueueEvents[_0x3104('0x4')](_0x1d4edf+':'+_0xfa730e['id'],_0xfa730e);WhatsappQueueEvents['emit'](_0x1d4edf,_0xfa730e);_0x19f8e9(null);};}for(var e in events){if(events[_0x3104('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x3104('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x8d6d=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1018dd,_0x57607d){var _0xd08e34=function(_0x12d4f1){while(--_0x12d4f1){_0x1018dd['push'](_0x1018dd['shift']());}};_0xd08e34(++_0x57607d);}(_0x8d6d,0xda));var _0xd8d6=function(_0x49d9fe,_0x17b2e8){_0x49d9fe=_0x49d9fe-0x0;var _0x185bf6=_0x8d6d[_0x49d9fe];return _0x185bf6;};'use strict';var EventEmitter=require(_0xd8d6('0x0'));var WhatsappQueue=require(_0xd8d6('0x1'))['db'][_0xd8d6('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd8d6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd8d6('0x4'),'afterDestroy':_0xd8d6('0x5')};function emitEvent(_0x43de7b){return function(_0x79bac3,_0x59258a,_0xe19d64){WhatsappQueueEvents[_0xd8d6('0x6')](_0x43de7b+':'+_0x79bac3['id'],_0x79bac3);WhatsappQueueEvents['emit'](_0x43de7b,_0x79bac3);_0xe19d64(null);};}for(var e in events){if(events[_0xd8d6('0x7')](e)){var event=events[e];WhatsappQueue[_0xd8d6('0x8')](e,emitEvent(event));}}module[_0xd8d6('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2230a5a..500ea25 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda44=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util'];(function(_0x3c3d48,_0x1403f0){var _0x122317=function(_0x4ff1a2){while(--_0x4ff1a2){_0x3c3d48['push'](_0x3c3d48['shift']());}};_0x122317(++_0x1403f0);}(_0xda44,0x185));var _0x4da4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xda44[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x4da4('0x0'));var logger=require('../../config/logger')(_0x4da4('0x1'));var moment=require(_0x4da4('0x2'));var BPromise=require(_0x4da4('0x3'));var rp=require(_0x4da4('0x4'));var fs=require('fs');var path=require(_0x4da4('0x5'));var rimraf=require(_0x4da4('0x6'));var config=require(_0x4da4('0x7'));var attributes=require(_0x4da4('0x8'));module[_0x4da4('0x9')]=function(_0x26db71,_0x5e3ad4){return _0x26db71[_0x4da4('0xa')](_0x4da4('0xb'),attributes,{'tableName':_0x4da4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9131=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0xf9cb7a,_0x155fd9){var _0x337245=function(_0x385c3b){while(--_0x385c3b){_0xf9cb7a['push'](_0xf9cb7a['shift']());}};_0x337245(++_0x155fd9);}(_0x9131,0x8e));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1913('0x0'));var util=require(_0x1913('0x1'));var logger=require(_0x1913('0x2'))(_0x1913('0x3'));var moment=require('moment');var BPromise=require(_0x1913('0x4'));var rp=require(_0x1913('0x5'));var fs=require('fs');var path=require(_0x1913('0x6'));var rimraf=require(_0x1913('0x7'));var config=require(_0x1913('0x8'));var attributes=require(_0x1913('0x9'));module[_0x1913('0xa')]=function(_0x1e42e2,_0xb4f493){return _0x1e42e2[_0x1913('0xb')](_0x1913('0xc'),attributes,{'tableName':_0x1913('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index be59a19..328c48a 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4389=['catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result'];(function(_0x9a7d5b,_0x50327f){var _0xe2a5b3=function(_0x98ad8d){while(--_0x98ad8d){_0x9a7d5b['push'](_0x9a7d5b['shift']());}};_0xe2a5b3(++_0x50327f);}(_0x4389,0x125));var _0x9438=function(_0x5ec73f,_0x580fd2){_0x5ec73f=_0x5ec73f-0x0;var _0x9f596c=_0x4389[_0x5ec73f];return _0x9f596c;};'use strict';var _=require(_0x9438('0x0'));var util=require(_0x9438('0x1'));var moment=require(_0x9438('0x2'));var BPromise=require(_0x9438('0x3'));var rs=require(_0x9438('0x4'));var fs=require('fs');var Redis=require(_0x9438('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9438('0x6'));var logger=require(_0x9438('0x7'))(_0x9438('0x8'));var config=require(_0x9438('0x9'));var jayson=require(_0x9438('0xa'));var client=jayson[_0x9438('0xb')]['http']({'port':0x232a});config[_0x9438('0xc')]=_['defaults'](config['redis'],{'host':_0x9438('0xd'),'port':0x18eb});var socket=require(_0x9438('0xe'))(new Redis(config['redis']));require(_0x9438('0xf'))[_0x9438('0x10')](socket);function respondWithRpcPromise(_0x1da283,_0x6d0b65,_0x11db1d){return new BPromise(function(_0x5b4665,_0x586f7c){return client[_0x9438('0x11')](_0x1da283,_0x11db1d)[_0x9438('0x12')](function(_0x1688f8){logger['info'](_0x9438('0x13'),_0x6d0b65,'request\x20sent');logger[_0x9438('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x6d0b65,_0x9438('0x15'),JSON[_0x9438('0x16')](_0x1688f8));if(_0x1688f8[_0x9438('0x17')]){if(_0x1688f8[_0x9438('0x17')]['code']===0x1f4){logger[_0x9438('0x17')](_0x9438('0x13'),_0x6d0b65,_0x1688f8[_0x9438('0x17')]['message']);return _0x586f7c(_0x1688f8[_0x9438('0x17')]['message']);}logger[_0x9438('0x17')](_0x9438('0x13'),_0x6d0b65,_0x1688f8[_0x9438('0x17')][_0x9438('0x18')]);return _0x5b4665(_0x1688f8[_0x9438('0x17')][_0x9438('0x18')]);}else{logger[_0x9438('0x19')](_0x9438('0x13'),_0x6d0b65,'request\x20sent');_0x5b4665(_0x1688f8[_0x9438('0x1a')]['message']);}})[_0x9438('0x1b')](function(_0x41669b){logger[_0x9438('0x17')](_0x9438('0x13'),_0x6d0b65,_0x41669b);_0x586f7c(_0x41669b);});});}exports[_0x9438('0x1c')]=function(_0x443caf){var _0x25f148=this;return new Promise(function(_0x1552cb,_0x5a11ef){return db[_0x9438('0x1d')][_0x9438('0x1e')]({'raw':_0x443caf[_0x9438('0x1f')]?_0x443caf[_0x9438('0x1f')][_0x9438('0x20')]===undefined?!![]:![]:!![],'where':_0x443caf['options']?_0x443caf['options'][_0x9438('0x21')]||null:null,'attributes':_0x443caf[_0x9438('0x1f')]?_0x443caf[_0x9438('0x1f')][_0x9438('0x22')]||null:null,'limit':_0x443caf[_0x9438('0x1f')]?_0x443caf['options'][_0x9438('0x23')]||null:null,'include':_0x443caf['options']?_0x443caf[_0x9438('0x1f')]['include']?_[_0x9438('0x24')](_0x443caf[_0x9438('0x1f')][_0x9438('0x25')],function(_0x47480d){return{'model':db[_0x47480d[_0x9438('0x26')]],'as':_0x47480d['as'],'attributes':_0x47480d['attributes'],'include':_0x47480d[_0x9438('0x25')]?_['map'](_0x47480d[_0x9438('0x25')],function(_0x589a32){return{'model':db[_0x589a32[_0x9438('0x26')]],'as':_0x589a32['as'],'attributes':_0x589a32['attributes'],'include':_0x589a32[_0x9438('0x25')]?_[_0x9438('0x24')](_0x589a32['include'],function(_0x6a5ea5){return{'model':db[_0x6a5ea5['model']],'as':_0x6a5ea5['as'],'attributes':_0x6a5ea5[_0x9438('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9438('0x12')](function(_0x13a2fe){logger['info'](_0x9438('0x1c'),_0x443caf);logger[_0x9438('0x14')](_0x9438('0x1c'),_0x443caf,JSON[_0x9438('0x16')](_0x13a2fe));_0x1552cb(_0x13a2fe);})[_0x9438('0x1b')](function(_0x32e187){logger['error'](_0x9438('0x1c'),_0x32e187[_0x9438('0x18')],_0x443caf);_0x5a11ef(_0x25f148[_0x9438('0x17')](0x1f4,_0x32e187[_0x9438('0x18')]));});});};exports[_0x9438('0x27')]=function(_0x2ed0b7){var _0x5409de=this;return new Promise(function(_0x53251d,_0x3aca48){return db[_0x9438('0x1d')]['find']({'raw':_0x2ed0b7[_0x9438('0x1f')]?_0x2ed0b7[_0x9438('0x1f')][_0x9438('0x20')]===undefined?!![]:![]:!![],'where':_0x2ed0b7[_0x9438('0x1f')]?_0x2ed0b7[_0x9438('0x1f')][_0x9438('0x21')]||null:null,'attributes':_0x2ed0b7['options']?_0x2ed0b7['options'][_0x9438('0x22')]||null:null,'include':_0x2ed0b7[_0x9438('0x1f')]?_0x2ed0b7[_0x9438('0x1f')]['include']?_[_0x9438('0x24')](_0x2ed0b7[_0x9438('0x1f')][_0x9438('0x25')],function(_0x2205bf){return{'model':db[_0x2205bf[_0x9438('0x26')]],'as':_0x2205bf['as'],'attributes':_0x2205bf['attributes'],'include':_0x2205bf['include']?_[_0x9438('0x24')](_0x2205bf[_0x9438('0x25')],function(_0x2ae51b){return{'model':db[_0x2ae51b[_0x9438('0x26')]],'as':_0x2ae51b['as'],'attributes':_0x2ae51b['attributes'],'include':_0x2ae51b[_0x9438('0x25')]?_['map'](_0x2ae51b[_0x9438('0x25')],function(_0x3ea592){return{'model':db[_0x3ea592['model']],'as':_0x3ea592['as'],'attributes':_0x3ea592['attributes']};}):[]};}):[]};}):[]:[]})[_0x9438('0x12')](function(_0x27b135){logger[_0x9438('0x19')](_0x9438('0x27'),_0x2ed0b7);logger[_0x9438('0x14')](_0x9438('0x27'),_0x2ed0b7,JSON[_0x9438('0x16')](_0x27b135));_0x53251d(_0x27b135);})[_0x9438('0x1b')](function(_0x3863cb){logger[_0x9438('0x17')]('ShowWhatsappQueue',_0x3863cb[_0x9438('0x18')],_0x2ed0b7);_0x3aca48(_0x5409de[_0x9438('0x17')](0x1f4,_0x3863cb['message']));});});}; \ No newline at end of file +var _0x8662=['http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','request\x20sent','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','WhatsappQueue','find','ShowWhatsappQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3438e5,_0x549b1f){var _0x224aea=function(_0x34bcfe){while(--_0x34bcfe){_0x3438e5['push'](_0x3438e5['shift']());}};_0x224aea(++_0x549b1f);}(_0x8662,0x97));var _0x2866=function(_0x37c345,_0x45c477){_0x37c345=_0x37c345-0x0;var _0x90917d=_0x8662[_0x37c345];return _0x90917d;};'use strict';var _=require('lodash');var util=require(_0x2866('0x0'));var moment=require(_0x2866('0x1'));var BPromise=require('bluebird');var rs=require(_0x2866('0x2'));var fs=require('fs');var Redis=require(_0x2866('0x3'));var db=require(_0x2866('0x4'))['db'];var utils=require(_0x2866('0x5'));var logger=require('../../config/logger')(_0x2866('0x6'));var config=require(_0x2866('0x7'));var jayson=require(_0x2866('0x8'));var client=jayson['client'][_0x2866('0x9')]({'port':0x232a});config['redis']=_[_0x2866('0xa')](config[_0x2866('0xb')],{'host':_0x2866('0xc'),'port':0x18eb});var socket=require(_0x2866('0xd'))(new Redis(config[_0x2866('0xb')]));require('./whatsappQueue.socket')[_0x2866('0xe')](socket);function respondWithRpcPromise(_0x38c11b,_0x359228,_0x24ebe6){return new BPromise(function(_0x344dd3,_0x187cee){return client[_0x2866('0xf')](_0x38c11b,_0x24ebe6)[_0x2866('0x10')](function(_0x103d05){logger[_0x2866('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x359228,'request\x20sent');logger[_0x2866('0x12')](_0x2866('0x13'),_0x359228,'request\x20sent',JSON['stringify'](_0x103d05));if(_0x103d05['error']){if(_0x103d05[_0x2866('0x14')][_0x2866('0x15')]===0x1f4){logger[_0x2866('0x14')](_0x2866('0x16'),_0x359228,_0x103d05[_0x2866('0x14')][_0x2866('0x17')]);return _0x187cee(_0x103d05[_0x2866('0x14')][_0x2866('0x17')]);}logger[_0x2866('0x14')](_0x2866('0x16'),_0x359228,_0x103d05['error'][_0x2866('0x17')]);return _0x344dd3(_0x103d05['error'][_0x2866('0x17')]);}else{logger[_0x2866('0x11')](_0x2866('0x16'),_0x359228,_0x2866('0x18'));_0x344dd3(_0x103d05['result'][_0x2866('0x17')]);}})[_0x2866('0x19')](function(_0x50bdc7){logger[_0x2866('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x359228,_0x50bdc7);_0x187cee(_0x50bdc7);});});}exports[_0x2866('0x1a')]=function(_0x59ed5f){var _0x1db4a3=this;return new Promise(function(_0x256f77,_0x56d04d){return db['WhatsappQueue'][_0x2866('0x1b')]({'raw':_0x59ed5f['options']?_0x59ed5f[_0x2866('0x1c')][_0x2866('0x1d')]===undefined?!![]:![]:!![],'where':_0x59ed5f['options']?_0x59ed5f[_0x2866('0x1c')][_0x2866('0x1e')]||null:null,'attributes':_0x59ed5f[_0x2866('0x1c')]?_0x59ed5f[_0x2866('0x1c')][_0x2866('0x1f')]||null:null,'limit':_0x59ed5f[_0x2866('0x1c')]?_0x59ed5f[_0x2866('0x1c')][_0x2866('0x20')]||null:null,'include':_0x59ed5f[_0x2866('0x1c')]?_0x59ed5f[_0x2866('0x1c')][_0x2866('0x21')]?_[_0x2866('0x22')](_0x59ed5f[_0x2866('0x1c')]['include'],function(_0x2a3eff){return{'model':db[_0x2a3eff[_0x2866('0x23')]],'as':_0x2a3eff['as'],'attributes':_0x2a3eff[_0x2866('0x1f')],'include':_0x2a3eff['include']?_[_0x2866('0x22')](_0x2a3eff['include'],function(_0x525fba){return{'model':db[_0x525fba[_0x2866('0x23')]],'as':_0x525fba['as'],'attributes':_0x525fba[_0x2866('0x1f')],'include':_0x525fba[_0x2866('0x21')]?_[_0x2866('0x22')](_0x525fba[_0x2866('0x21')],function(_0x299378){return{'model':db[_0x299378[_0x2866('0x23')]],'as':_0x299378['as'],'attributes':_0x299378[_0x2866('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2866('0x10')](function(_0x1c0aac){logger[_0x2866('0x11')]('GetWhatsappQueue',_0x59ed5f);logger['debug'](_0x2866('0x1a'),_0x59ed5f,JSON[_0x2866('0x24')](_0x1c0aac));_0x256f77(_0x1c0aac);})[_0x2866('0x19')](function(_0x5d3281){logger[_0x2866('0x14')](_0x2866('0x1a'),_0x5d3281[_0x2866('0x17')],_0x59ed5f);_0x56d04d(_0x1db4a3[_0x2866('0x14')](0x1f4,_0x5d3281['message']));});});};exports['ShowWhatsappQueue']=function(_0xef46d7){var _0x5e6845=this;return new Promise(function(_0x59ca59,_0x3e5569){return db[_0x2866('0x25')][_0x2866('0x26')]({'raw':_0xef46d7[_0x2866('0x1c')]?_0xef46d7[_0x2866('0x1c')][_0x2866('0x1d')]===undefined?!![]:![]:!![],'where':_0xef46d7[_0x2866('0x1c')]?_0xef46d7[_0x2866('0x1c')][_0x2866('0x1e')]||null:null,'attributes':_0xef46d7['options']?_0xef46d7[_0x2866('0x1c')][_0x2866('0x1f')]||null:null,'include':_0xef46d7['options']?_0xef46d7['options'][_0x2866('0x21')]?_[_0x2866('0x22')](_0xef46d7[_0x2866('0x1c')][_0x2866('0x21')],function(_0x962fae){return{'model':db[_0x962fae[_0x2866('0x23')]],'as':_0x962fae['as'],'attributes':_0x962fae[_0x2866('0x1f')],'include':_0x962fae[_0x2866('0x21')]?_[_0x2866('0x22')](_0x962fae[_0x2866('0x21')],function(_0x39ca95){return{'model':db[_0x39ca95['model']],'as':_0x39ca95['as'],'attributes':_0x39ca95[_0x2866('0x1f')],'include':_0x39ca95['include']?_[_0x2866('0x22')](_0x39ca95[_0x2866('0x21')],function(_0x265d09){return{'model':db[_0x265d09['model']],'as':_0x265d09['as'],'attributes':_0x265d09['attributes']};}):[]};}):[]};}):[]:[]})[_0x2866('0x10')](function(_0x2cb9a2){logger[_0x2866('0x11')]('ShowWhatsappQueue',_0xef46d7);logger[_0x2866('0x12')](_0x2866('0x27'),_0xef46d7,JSON[_0x2866('0x24')](_0x2cb9a2));_0x59ca59(_0x2cb9a2);})[_0x2866('0x19')](function(_0x34e463){logger[_0x2866('0x14')](_0x2866('0x27'),_0x34e463[_0x2866('0x17')],_0xef46d7);_0x3e5569(_0x5e6845[_0x2866('0x14')](0x1f4,_0x34e463[_0x2866('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index f07259c..3082b13 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3f8=['register','length','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x29d398,_0x537070){var _0x3d5ed9=function(_0x5c9b00){while(--_0x5c9b00){_0x29d398['push'](_0x29d398['shift']());}};_0x3d5ed9(++_0x537070);}(_0xb3f8,0x1c9));var _0x8b3f=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0xb3f8[_0x1073ad];return _0x528474;};'use strict';var WhatsappQueueEvents=require(_0x8b3f('0x0'));var events=['save',_0x8b3f('0x1'),_0x8b3f('0x2')];function createListener(_0xf6ceff,_0x497d9e){return function(_0x291f13){_0x497d9e[_0x8b3f('0x3')](_0xf6ceff,_0x291f13);};}function removeListener(_0x1cb174,_0x4b8f2e){return function(){WhatsappQueueEvents[_0x8b3f('0x4')](_0x1cb174,_0x4b8f2e);};}exports[_0x8b3f('0x5')]=function(_0x314b3d){for(var _0x3da856=0x0,_0x30c1da=events[_0x8b3f('0x6')];_0x3da856<_0x30c1da;_0x3da856++){var _0x9f18c3=events[_0x3da856];var _0x26549f=createListener('whatsappQueue:'+_0x9f18c3,_0x314b3d);WhatsappQueueEvents['on'](_0x9f18c3,_0x26549f);}}; \ No newline at end of file +var _0x1f49=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','remove'];(function(_0x3b2753,_0x1a30ba){var _0x1e19c6=function(_0x2b6b3d){while(--_0x2b6b3d){_0x3b2753['push'](_0x3b2753['shift']());}};_0x1e19c6(++_0x1a30ba);}(_0x1f49,0x1ce));var _0x91f4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1f49[_0x2be8c2];return _0x97f531;};'use strict';var WhatsappQueueEvents=require(_0x91f4('0x0'));var events=['save',_0x91f4('0x1'),_0x91f4('0x2')];function createListener(_0x367db2,_0x355011){return function(_0x241b35){_0x355011[_0x91f4('0x3')](_0x367db2,_0x241b35);};}function removeListener(_0xa7576c,_0x469344){return function(){WhatsappQueueEvents[_0x91f4('0x4')](_0xa7576c,_0x469344);};}exports[_0x91f4('0x5')]=function(_0x4cbfca){for(var _0x437d33=0x0,_0x1d7808=events[_0x91f4('0x6')];_0x437d33<_0x1d7808;_0x437d33++){var _0x398fbc=events[_0x437d33];var _0x323285=createListener(_0x91f4('0x7')+_0x398fbc,_0x4cbfca);WhatsappQueueEvents['on'](_0x398fbc,_0x323285);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 4949388..272e956 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7319=['create','put','/:id','destroy','multer','util','path','connect-timeout','express','../../config/environment','./whatsappQueueReport.controller','index','/describe','isAuthenticated','describe','get','post'];(function(_0x178dac,_0x58bf0c){var _0x55e20a=function(_0x2eaf95){while(--_0x2eaf95){_0x178dac['push'](_0x178dac['shift']());}};_0x55e20a(++_0x58bf0c);}(_0x7319,0x8c));var _0x9731=function(_0x14ff22,_0x489116){_0x14ff22=_0x14ff22-0x0;var _0x12ee82=_0x7319[_0x14ff22];return _0x12ee82;};'use strict';var multer=require(_0x9731('0x0'));var util=require(_0x9731('0x1'));var path=require(_0x9731('0x2'));var timeout=require(_0x9731('0x3'));var express=require(_0x9731('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9731('0x5'));var controller=require(_0x9731('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9731('0x7')]);router['get'](_0x9731('0x8'),auth[_0x9731('0x9')](),controller[_0x9731('0xa')]);router[_0x9731('0xb')]('/:id',auth[_0x9731('0x9')](),controller['show']);router[_0x9731('0xc')]('/',auth[_0x9731('0x9')](),controller[_0x9731('0xd')]);router[_0x9731('0xe')](_0x9731('0xf'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x9731('0x9')](),controller[_0x9731('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2910=['/:id','post','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x2910,0x66));var _0x0291=function(_0x597207,_0x3244c0){_0x597207=_0x597207-0x0;var _0x1b9743=_0x2910[_0x597207];return _0x1b9743;};'use strict';var multer=require(_0x0291('0x0'));var util=require(_0x0291('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0291('0x2')]();var fs_extra=require(_0x0291('0x3'));var auth=require(_0x0291('0x4'));var interaction=require(_0x0291('0x5'));var config=require(_0x0291('0x6'));var controller=require(_0x0291('0x7'));router[_0x0291('0x8')]('/',auth[_0x0291('0x9')](),controller['index']);router['get'](_0x0291('0xa'),auth['isAuthenticated'](),controller[_0x0291('0xb')]);router[_0x0291('0x8')](_0x0291('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0291('0xd')]('/',auth[_0x0291('0x9')](),controller[_0x0291('0xe')]);router[_0x0291('0xf')](_0x0291('0xc'),auth[_0x0291('0x9')](),controller[_0x0291('0x10')]);router[_0x0291('0x11')](_0x0291('0xc'),auth[_0x0291('0x9')](),controller['destroy']);module[_0x0291('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 1e5d044..bfac051 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0xbdf5c6,_0x2e5338){var _0x39cd43=function(_0x1fe5a4){while(--_0x1fe5a4){_0xbdf5c6['push'](_0xbdf5c6['shift']());}};_0x39cd43(++_0x2e5338);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x496b8d,_0x27ddb0){var _0x465060=function(_0x3fdb8d){while(--_0x3fdb8d){_0x496b8d['push'](_0x496b8d['shift']());}};_0x465060(++_0x27ddb0);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c921296..6ceef93 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb574=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x4a664c,_0x3bed21){var _0x4e4c76=function(_0x1f8f6e){while(--_0x1f8f6e){_0x4a664c['push'](_0x4a664c['shift']());}};_0x4e4c76(++_0x3bed21);}(_0xb574,0x106));var _0x4b57=function(_0x58c4f0,_0x13f4aa){_0x58c4f0=_0x58c4f0-0x0;var _0x5c1097=_0xb574[_0x58c4f0];return _0x5c1097;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x540eff,_0x156962){return function(_0x51d0c3){if(!_0x51d0c3){_0x540eff[_0x4b57('0x16')](0x194);}return _0x51d0c3;};}function handleError(_0x517119,_0x36ceb1){_0x36ceb1=_0x36ceb1||0x1f4;return function(_0x2dc9d8){logger[_0x4b57('0x25')](_0x2dc9d8[_0x4b57('0x26')]);if(_0x2dc9d8[_0x4b57('0x27')]){delete _0x2dc9d8[_0x4b57('0x27')];}_0x517119['status'](_0x36ceb1)['send'](_0x2dc9d8);};}exports[_0x4b57('0x28')]=function(_0x4c58e4,_0x1ea0cb){var _0x458f70={},_0x874cf7={},_0x3af22f={'count':0x0,'rows':[]};var _0x249461=_[_0x4b57('0x29')](db['WhatsappQueueReport'][_0x4b57('0x2a')],function(_0x2e9922){return{'name':_0x2e9922[_0x4b57('0x2b')],'type':_0x2e9922[_0x4b57('0x2c')]['key']};});_0x874cf7[_0x4b57('0x2d')]=_[_0x4b57('0x29')](_0x249461,'name');_0x874cf7[_0x4b57('0x2e')]=_[_0x4b57('0x2f')](_0x4c58e4[_0x4b57('0x2e')]);_0x874cf7[_0x4b57('0x30')]=_['intersection'](_0x874cf7['model'],_0x874cf7['query']);_0x458f70[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x874cf7[_0x4b57('0x2d')],qs[_0x4b57('0x33')](_0x4c58e4[_0x4b57('0x2e')]['fields']));_0x458f70[_0x4b57('0x31')]=_0x458f70[_0x4b57('0x31')][_0x4b57('0x34')]?_0x458f70['attributes']:_0x874cf7[_0x4b57('0x2d')];if(!_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x35')]('nolimit')){_0x458f70[_0x4b57('0x1b')]=qs[_0x4b57('0x1b')](_0x4c58e4['query'][_0x4b57('0x1b')]);_0x458f70[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x1d')]);}_0x458f70[_0x4b57('0x36')]=qs['sort'](_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x37')]);_0x458f70[_0x4b57('0x38')]=qs[_0x4b57('0x30')](_[_0x4b57('0x39')](_0x4c58e4[_0x4b57('0x2e')],_0x874cf7[_0x4b57('0x30')]),_0x249461);if(_0x4c58e4['query']['filter']){_0x458f70[_0x4b57('0x38')]=_[_0x4b57('0x3a')](_0x458f70[_0x4b57('0x38')],{'$or':_['map'](_0x249461,function(_0x40414f){if(_0x40414f[_0x4b57('0x2c')]!==_0x4b57('0x3b')){var _0x3c086e={};_0x3c086e[_0x40414f['name']]={'$like':'%'+_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x3c')]+'%'};return _0x3c086e;}})});}_0x458f70=_[_0x4b57('0x3a')]({},_0x458f70,_0x4c58e4[_0x4b57('0x3d')]);var _0x56528f={'where':_0x458f70['where']};return db['WhatsappQueueReport'][_0x4b57('0x1c')](_0x56528f)[_0x4b57('0x23')](function(_0x188f24){_0x3af22f[_0x4b57('0x1c')]=_0x188f24;if(_0x4c58e4['query'][_0x4b57('0x3e')]){_0x458f70[_0x4b57('0x3f')]=[{'all':!![]}];}return db[_0x4b57('0x40')][_0x4b57('0x41')](_0x458f70);})[_0x4b57('0x23')](function(_0x453129){_0x3af22f[_0x4b57('0x42')]=_0x453129;return _0x3af22f;})[_0x4b57('0x23')](respondWithFilteredResult(_0x1ea0cb,_0x458f70))[_0x4b57('0x43')](handleError(_0x1ea0cb,null));};exports['show']=function(_0x318187,_0x3685fd){var _0x3c5095={'raw':!![],'where':{'id':_0x318187[_0x4b57('0x44')]['id']}},_0x5b2f50={};_0x5b2f50['model']=_[_0x4b57('0x2f')](db[_0x4b57('0x40')][_0x4b57('0x2a')]);_0x5b2f50[_0x4b57('0x2e')]=_[_0x4b57('0x2f')](_0x318187[_0x4b57('0x2e')]);_0x5b2f50[_0x4b57('0x30')]=_[_0x4b57('0x32')](_0x5b2f50[_0x4b57('0x2d')],_0x5b2f50[_0x4b57('0x2e')]);_0x3c5095[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x5b2f50[_0x4b57('0x2d')],qs['fields'](_0x318187['query'][_0x4b57('0x33')]));_0x3c5095[_0x4b57('0x31')]=_0x3c5095[_0x4b57('0x31')][_0x4b57('0x34')]?_0x3c5095['attributes']:_0x5b2f50[_0x4b57('0x2d')];if(_0x318187[_0x4b57('0x2e')]['includeAll']){_0x3c5095[_0x4b57('0x3f')]=[{'all':!![]}];}_0x3c5095=_['merge']({},_0x3c5095,_0x318187[_0x4b57('0x3d')]);return db['WhatsappQueueReport']['find'](_0x3c5095)[_0x4b57('0x23')](handleEntityNotFound(_0x3685fd,null))[_0x4b57('0x23')](respondWithResult(_0x3685fd,null))['catch'](handleError(_0x3685fd,null));};exports[_0x4b57('0x45')]=function(_0xc19684,_0x2732ff){return db[_0x4b57('0x40')][_0x4b57('0x45')](_0xc19684[_0x4b57('0x46')],{})['then'](respondWithResult(_0x2732ff,0xc9))[_0x4b57('0x43')](handleError(_0x2732ff,null));};exports[_0x4b57('0x22')]=function(_0x4a632c,_0xd529fb){if(_0x4a632c[_0x4b57('0x46')]['id']){delete _0x4a632c[_0x4b57('0x46')]['id'];}return db['WhatsappQueueReport'][_0x4b57('0x47')]({'where':{'id':_0x4a632c['params']['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0xd529fb,null))[_0x4b57('0x23')](saveUpdates(_0x4a632c[_0x4b57('0x46')],null))[_0x4b57('0x23')](respondWithResult(_0xd529fb,null))[_0x4b57('0x43')](handleError(_0xd529fb,null));};exports[_0x4b57('0x24')]=function(_0x3d1ecd,_0x3ec6ba){return db['WhatsappQueueReport'][_0x4b57('0x47')]({'where':{'id':_0x3d1ecd[_0x4b57('0x44')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x3ec6ba,null))['then'](removeEntity(_0x3ec6ba,null))[_0x4b57('0x43')](handleError(_0x3ec6ba,null));};exports[_0x4b57('0x48')]=function(_0x32985f,_0x488bea){return db[_0x4b57('0x40')][_0x4b57('0x48')]()[_0x4b57('0x23')](respondWithResult(_0x488bea,null))[_0x4b57('0x43')](handleError(_0x488bea,null));}; \ No newline at end of file +var _0xfef3=['offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueueReport','then','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json'];(function(_0x27638d,_0x4094db){var _0x35da35=function(_0x538095){while(--_0x538095){_0x27638d['push'](_0x27638d['shift']());}};_0x35da35(++_0x4094db);}(_0xfef3,0x118));var _0x3fef=function(_0x4535c7,_0x2c89c7){_0x4535c7=_0x4535c7-0x0;var _0x37ca9c=_0xfef3[_0x4535c7];return _0x37ca9c;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];function respondWithStatusCode(_0x4c4a47,_0x2c99ff){_0x2c99ff=_0x2c99ff||0xcc;return function(_0x3d2c2d){if(_0x3d2c2d){return _0x4c4a47[_0x3fef('0x19')](_0x2c99ff);}return _0x4c4a47['status'](_0x2c99ff)[_0x3fef('0x1a')]();};}function respondWithResult(_0x4be62f,_0x15b757){_0x15b757=_0x15b757||0xc8;return function(_0x14c053){if(_0x14c053){return _0x4be62f['status'](_0x15b757)[_0x3fef('0x1b')](_0x14c053);}};}function respondWithFilteredResult(_0x177e28,_0x40b479){return function(_0x79b617){if(_0x79b617){var _0x395df0=typeof _0x40b479[_0x3fef('0x1c')]==='undefined'&&typeof _0x40b479[_0x3fef('0x1d')]===_0x3fef('0x1e');var _0x1ec282=_0x79b617[_0x3fef('0x1f')];var _0x1613ad=_0x395df0?0x0:_0x40b479[_0x3fef('0x1c')];var _0x53d993=_0x395df0?_0x79b617[_0x3fef('0x1f')]:_0x40b479[_0x3fef('0x1c')]+_0x40b479['limit'];var _0x2c7f36;if(_0x53d993>=_0x1ec282){_0x53d993=_0x1ec282;_0x2c7f36=0xc8;}else{_0x2c7f36=0xce;}_0x177e28[_0x3fef('0x20')](_0x2c7f36);return _0x177e28[_0x3fef('0x21')](_0x3fef('0x22'),_0x1613ad+'-'+_0x53d993+'/'+_0x1ec282)[_0x3fef('0x1b')](_0x79b617);}return null;};}function patchUpdates(_0x2b5226){return function(_0x451d11){try{jsonpatch[_0x3fef('0x23')](_0x451d11,_0x2b5226,!![]);}catch(_0x124e7c){return BPromise[_0x3fef('0x24')](_0x124e7c);}return _0x451d11[_0x3fef('0x25')]();};}function saveUpdates(_0x3bb110,_0x2eb578){return function(_0x39a8ea){if(_0x39a8ea){return _0x39a8ea[_0x3fef('0x26')](_0x3bb110)['then'](function(_0x5b56de){return _0x5b56de;});}return null;};}function removeEntity(_0x50025f,_0x378b03){return function(_0x3ba38d){if(_0x3ba38d){return _0x3ba38d[_0x3fef('0x27')]()['then'](function(){_0x50025f[_0x3fef('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45464b,_0x2c0848){return function(_0x64d3e6){if(!_0x64d3e6){_0x45464b[_0x3fef('0x19')](0x194);}return _0x64d3e6;};}function handleError(_0x30e17a,_0x492ea0){_0x492ea0=_0x492ea0||0x1f4;return function(_0x4b4dee){logger['error'](_0x4b4dee[_0x3fef('0x28')]);if(_0x4b4dee[_0x3fef('0x29')]){delete _0x4b4dee['name'];}_0x30e17a[_0x3fef('0x20')](_0x492ea0)[_0x3fef('0x2a')](_0x4b4dee);};}exports['index']=function(_0x30a954,_0x3bdf03){var _0xf892bb={},_0x2b73fb={},_0x3a1a0a={'count':0x0,'rows':[]};var _0x137849=_[_0x3fef('0x2b')](db['WhatsappQueueReport'][_0x3fef('0x2c')],function(_0xc20ce5){return{'name':_0xc20ce5[_0x3fef('0x2d')],'type':_0xc20ce5[_0x3fef('0x2e')]['key']};});_0x2b73fb[_0x3fef('0x2f')]=_['map'](_0x137849,_0x3fef('0x29'));_0x2b73fb[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x30a954[_0x3fef('0x30')]);_0x2b73fb[_0x3fef('0x32')]=_[_0x3fef('0x33')](_0x2b73fb[_0x3fef('0x2f')],_0x2b73fb[_0x3fef('0x30')]);_0xf892bb[_0x3fef('0x34')]=_[_0x3fef('0x33')](_0x2b73fb['model'],qs['fields'](_0x30a954[_0x3fef('0x30')]['fields']));_0xf892bb[_0x3fef('0x34')]=_0xf892bb[_0x3fef('0x34')][_0x3fef('0x35')]?_0xf892bb[_0x3fef('0x34')]:_0x2b73fb[_0x3fef('0x2f')];if(!_0x30a954[_0x3fef('0x30')][_0x3fef('0x36')](_0x3fef('0x37'))){_0xf892bb[_0x3fef('0x1d')]=qs[_0x3fef('0x1d')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x1d')]);_0xf892bb[_0x3fef('0x1c')]=qs[_0x3fef('0x1c')](_0x30a954['query'][_0x3fef('0x1c')]);}_0xf892bb[_0x3fef('0x38')]=qs[_0x3fef('0x39')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x39')]);_0xf892bb[_0x3fef('0x3a')]=qs['filters'](_['pick'](_0x30a954[_0x3fef('0x30')],_0x2b73fb[_0x3fef('0x32')]),_0x137849);if(_0x30a954[_0x3fef('0x30')][_0x3fef('0x3b')]){_0xf892bb[_0x3fef('0x3a')]=_[_0x3fef('0x3c')](_0xf892bb[_0x3fef('0x3a')],{'$or':_[_0x3fef('0x2b')](_0x137849,function(_0x1fa70f){if(_0x1fa70f[_0x3fef('0x2e')]!==_0x3fef('0x3d')){var _0x560aae={};_0x560aae[_0x1fa70f[_0x3fef('0x29')]]={'$like':'%'+_0x30a954[_0x3fef('0x30')]['filter']+'%'};return _0x560aae;}})});}_0xf892bb=_['merge']({},_0xf892bb,_0x30a954[_0x3fef('0x3e')]);var _0x3dda68={'where':_0xf892bb[_0x3fef('0x3a')]};return db[_0x3fef('0x3f')][_0x3fef('0x1f')](_0x3dda68)[_0x3fef('0x40')](function(_0x17aff8){_0x3a1a0a[_0x3fef('0x1f')]=_0x17aff8;if(_0x30a954['query'][_0x3fef('0x41')]){_0xf892bb[_0x3fef('0x42')]=[{'all':!![]}];}return db[_0x3fef('0x3f')][_0x3fef('0x43')](_0xf892bb);})[_0x3fef('0x40')](function(_0x2143ec){_0x3a1a0a[_0x3fef('0x44')]=_0x2143ec;return _0x3a1a0a;})[_0x3fef('0x40')](respondWithFilteredResult(_0x3bdf03,_0xf892bb))[_0x3fef('0x45')](handleError(_0x3bdf03,null));};exports[_0x3fef('0x46')]=function(_0x12867c,_0x254880){var _0x2e1d7f={'raw':!![],'where':{'id':_0x12867c[_0x3fef('0x47')]['id']}},_0x15d2c7={};_0x15d2c7['model']=_[_0x3fef('0x31')](db[_0x3fef('0x3f')][_0x3fef('0x2c')]);_0x15d2c7[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x12867c[_0x3fef('0x30')]);_0x15d2c7['filters']=_[_0x3fef('0x33')](_0x15d2c7['model'],_0x15d2c7[_0x3fef('0x30')]);_0x2e1d7f[_0x3fef('0x34')]=_['intersection'](_0x15d2c7[_0x3fef('0x2f')],qs['fields'](_0x12867c[_0x3fef('0x30')][_0x3fef('0x48')]));_0x2e1d7f[_0x3fef('0x34')]=_0x2e1d7f[_0x3fef('0x34')][_0x3fef('0x35')]?_0x2e1d7f[_0x3fef('0x34')]:_0x15d2c7[_0x3fef('0x2f')];if(_0x12867c[_0x3fef('0x30')][_0x3fef('0x41')]){_0x2e1d7f[_0x3fef('0x42')]=[{'all':!![]}];}_0x2e1d7f=_[_0x3fef('0x3c')]({},_0x2e1d7f,_0x12867c[_0x3fef('0x3e')]);return db[_0x3fef('0x3f')]['find'](_0x2e1d7f)[_0x3fef('0x40')](handleEntityNotFound(_0x254880,null))[_0x3fef('0x40')](respondWithResult(_0x254880,null))['catch'](handleError(_0x254880,null));};exports[_0x3fef('0x49')]=function(_0x4210d6,_0x2f00c0){return db['WhatsappQueueReport'][_0x3fef('0x49')](_0x4210d6[_0x3fef('0x4a')],{})['then'](respondWithResult(_0x2f00c0,0xc9))[_0x3fef('0x45')](handleError(_0x2f00c0,null));};exports['update']=function(_0x48322c,_0x15fb2c){if(_0x48322c['body']['id']){delete _0x48322c[_0x3fef('0x4a')]['id'];}return db[_0x3fef('0x3f')]['find']({'where':{'id':_0x48322c[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x15fb2c,null))[_0x3fef('0x40')](saveUpdates(_0x48322c['body'],null))[_0x3fef('0x40')](respondWithResult(_0x15fb2c,null))[_0x3fef('0x45')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x27')]=function(_0x5b1acb,_0x324f70){return db[_0x3fef('0x3f')][_0x3fef('0x4b')]({'where':{'id':_0x5b1acb[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x324f70,null))['then'](removeEntity(_0x324f70,null))[_0x3fef('0x45')](handleError(_0x324f70,null));};exports[_0x3fef('0x4c')]=function(_0x39a4b1,_0x2b9275){return db[_0x3fef('0x3f')][_0x3fef('0x4c')]()[_0x3fef('0x40')](respondWithResult(_0x2b9275,null))[_0x3fef('0x45')](handleError(_0x2b9275,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e0874ed..c4f98ac 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc960=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x2eeac6,_0x50182a){var _0x597a20=function(_0x3be761){while(--_0x3be761){_0x2eeac6['push'](_0x2eeac6['shift']());}};_0x597a20(++_0x50182a);}(_0xc960,0xc8));var _0x0c96=function(_0x3a9a6e,_0x42e5ba){_0x3a9a6e=_0x3a9a6e-0x0;var _0x396dbd=_0xc960[_0x3a9a6e];return _0x396dbd;};'use strict';var _=require(_0x0c96('0x0'));var util=require(_0x0c96('0x1'));var logger=require(_0x0c96('0x2'))(_0x0c96('0x3'));var moment=require(_0x0c96('0x4'));var BPromise=require('bluebird');var rp=require(_0x0c96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c96('0x6'));var config=require(_0x0c96('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x0c96('0x8')]=function(_0x55a353,_0x5566e2){return _0x55a353[_0x0c96('0x9')](_0x0c96('0xa'),attributes,{'tableName':_0x0c96('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0c96('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ebd=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger'];(function(_0xe5195c,_0x2503a0){var _0x3572f6=function(_0x17fcd3){while(--_0x17fcd3){_0xe5195c['push'](_0xe5195c['shift']());}};_0x3572f6(++_0x2503a0);}(_0x0ebd,0x9b));var _0xd0eb=function(_0x860f2b,_0x3ebf56){_0x860f2b=_0x860f2b-0x0;var _0x4539ca=_0x0ebd[_0x860f2b];return _0x4539ca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd0eb('0x0'))(_0xd0eb('0x1'));var moment=require(_0xd0eb('0x2'));var BPromise=require('bluebird');var rp=require(_0xd0eb('0x3'));var fs=require('fs');var path=require(_0xd0eb('0x4'));var rimraf=require(_0xd0eb('0x5'));var config=require(_0xd0eb('0x6'));var attributes=require(_0xd0eb('0x7'));module[_0xd0eb('0x8')]=function(_0x1ee2a3,_0x281cba){return _0x1ee2a3[_0xd0eb('0x9')](_0xd0eb('0xa'),attributes,{'tableName':_0xd0eb('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd0eb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7abfe47..c5330f8 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8237=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','then','stringify','catch','UpdateWhatsappQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1b56bb,_0x3477fd){var _0x53229c=function(_0x29cabe){while(--_0x29cabe){_0x1b56bb['push'](_0x1b56bb['shift']());}};_0x53229c(++_0x3477fd);}(_0x8237,0x7a));var _0x7823=function(_0x315f63,_0x9b4163){_0x315f63=_0x315f63-0x0;var _0x379607=_0x8237[_0x315f63];return _0x379607;};'use strict';var _=require(_0x7823('0x0'));var util=require(_0x7823('0x1'));var moment=require(_0x7823('0x2'));var BPromise=require(_0x7823('0x3'));var rs=require(_0x7823('0x4'));var fs=require('fs');var Redis=require(_0x7823('0x5'));var db=require(_0x7823('0x6'))['db'];var utils=require(_0x7823('0x7'));var logger=require(_0x7823('0x8'))(_0x7823('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7823('0xa')][_0x7823('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d353,_0x2b1dd7,_0x28e302){return new BPromise(function(_0x3a8956,_0x3934b2){return client[_0x7823('0xc')](_0x38d353,_0x28e302)['then'](function(_0x2c8630){logger[_0x7823('0xd')](_0x7823('0xe'),_0x2b1dd7,_0x7823('0xf'));logger[_0x7823('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2b1dd7,'request\x20sent',JSON['stringify'](_0x2c8630));if(_0x2c8630['error']){if(_0x2c8630[_0x7823('0x11')]['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x2b1dd7,_0x2c8630[_0x7823('0x11')]['message']);return _0x3934b2(_0x2c8630['error']['message']);}logger[_0x7823('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2b1dd7,_0x2c8630[_0x7823('0x11')][_0x7823('0x12')]);return _0x3a8956(_0x2c8630[_0x7823('0x11')][_0x7823('0x12')]);}else{logger[_0x7823('0xd')](_0x7823('0xe'),_0x2b1dd7,_0x7823('0xf'));_0x3a8956(_0x2c8630[_0x7823('0x13')][_0x7823('0x12')]);}})['catch'](function(_0x46eb8b){logger[_0x7823('0x11')](_0x7823('0xe'),_0x2b1dd7,_0x46eb8b);_0x3934b2(_0x46eb8b);});});}exports[_0x7823('0x14')]=function(_0x392ff7){var _0x1a16fa=this;return new Promise(function(_0x3a28f1,_0x4dc9fe){return db[_0x7823('0x15')]['create'](_0x392ff7[_0x7823('0x16')],{'raw':_0x392ff7[_0x7823('0x17')]?_0x392ff7[_0x7823('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7823('0x18')](function(_0x5c1d46){logger[_0x7823('0xd')]('CreateWhatsappQueueReport',_0x392ff7);logger[_0x7823('0x10')](_0x7823('0x14'),_0x392ff7,JSON[_0x7823('0x19')](_0x5c1d46));_0x3a28f1(_0x5c1d46);})[_0x7823('0x1a')](function(_0x46e98b){logger[_0x7823('0x11')]('CreateWhatsappQueueReport',_0x46e98b[_0x7823('0x12')],_0x392ff7);_0x4dc9fe(_0x1a16fa['error'](0x1f4,_0x46e98b[_0x7823('0x12')]));});});};exports[_0x7823('0x1b')]=function(_0x586e69){var _0x4a6258=this;return new Promise(function(_0x31c35b,_0x1cc8c5){return db['WhatsappQueueReport'][_0x7823('0x1c')](_0x586e69['body'],{'raw':_0x586e69['options']?_0x586e69[_0x7823('0x17')][_0x7823('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x586e69[_0x7823('0x17')]?_0x586e69['options'][_0x7823('0x1e')]||null:null,'attributes':_0x586e69[_0x7823('0x17')]?_0x586e69['options']['attributes']||null:null,'limit':_0x586e69[_0x7823('0x17')]?_0x586e69['options'][_0x7823('0x1f')]||null:null})[_0x7823('0x18')](function(_0x229559){logger['info'](_0x7823('0x1b'),_0x586e69);logger[_0x7823('0x10')](_0x7823('0x1b'),_0x586e69,JSON[_0x7823('0x19')](_0x229559));_0x31c35b(_0x229559);})[_0x7823('0x1a')](function(_0x81b8ef){logger[_0x7823('0x11')](_0x7823('0x1b'),_0x81b8ef[_0x7823('0x12')],_0x586e69);_0x1cc8c5(_0x4a6258['error'](0x1f4,_0x81b8ef['message']));});});}; \ No newline at end of file +var _0x636e=['error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','update','limit','then','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4161fe,_0x1a1303){var _0x125fa3=function(_0xa1d20f){while(--_0xa1d20f){_0x4161fe['push'](_0x4161fe['shift']());}};_0x125fa3(++_0x1a1303);}(_0x636e,0xf0));var _0xe636=function(_0x45b3e7,_0x28b77d){_0x45b3e7=_0x45b3e7-0x0;var _0x35b336=_0x636e[_0x45b3e7];return _0x35b336;};'use strict';var _=require(_0xe636('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe636('0x1'));var rs=require(_0xe636('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe636('0x3'))['db'];var utils=require(_0xe636('0x4'));var logger=require(_0xe636('0x5'))(_0xe636('0x6'));var config=require(_0xe636('0x7'));var jayson=require(_0xe636('0x8'));var client=jayson[_0xe636('0x9')][_0xe636('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3688de,_0x28d688,_0x1559e9){return new BPromise(function(_0x4a02be,_0xd6f53d){return client['request'](_0x3688de,_0x1559e9)['then'](function(_0x54cdd7){logger[_0xe636('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x28d688,_0xe636('0xc'));logger[_0xe636('0xd')](_0xe636('0xe'),_0x28d688,_0xe636('0xc'),JSON[_0xe636('0xf')](_0x54cdd7));if(_0x54cdd7[_0xe636('0x10')]){if(_0x54cdd7[_0xe636('0x10')][_0xe636('0x11')]===0x1f4){logger[_0xe636('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x28d688,_0x54cdd7[_0xe636('0x10')][_0xe636('0x12')]);return _0xd6f53d(_0x54cdd7[_0xe636('0x10')][_0xe636('0x12')]);}logger['error'](_0xe636('0x13'),_0x28d688,_0x54cdd7[_0xe636('0x10')][_0xe636('0x12')]);return _0x4a02be(_0x54cdd7[_0xe636('0x10')][_0xe636('0x12')]);}else{logger[_0xe636('0xb')](_0xe636('0x13'),_0x28d688,_0xe636('0xc'));_0x4a02be(_0x54cdd7[_0xe636('0x14')][_0xe636('0x12')]);}})[_0xe636('0x15')](function(_0x2532f3){logger[_0xe636('0x10')](_0xe636('0x13'),_0x28d688,_0x2532f3);_0xd6f53d(_0x2532f3);});});}exports['CreateWhatsappQueueReport']=function(_0x2371ac){var _0x4aef9f=this;return new Promise(function(_0x271983,_0x48082b){return db['WhatsappQueueReport'][_0xe636('0x16')](_0x2371ac[_0xe636('0x17')],{'raw':_0x2371ac['options']?_0x2371ac[_0xe636('0x18')][_0xe636('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x13b730){logger[_0xe636('0xb')](_0xe636('0x1a'),_0x2371ac);logger[_0xe636('0xd')](_0xe636('0x1a'),_0x2371ac,JSON[_0xe636('0xf')](_0x13b730));_0x271983(_0x13b730);})['catch'](function(_0x54463a){logger[_0xe636('0x10')](_0xe636('0x1a'),_0x54463a[_0xe636('0x12')],_0x2371ac);_0x48082b(_0x4aef9f[_0xe636('0x10')](0x1f4,_0x54463a[_0xe636('0x12')]));});});};exports[_0xe636('0x1b')]=function(_0x4acb5f){var _0x28ebe5=this;return new Promise(function(_0x216415,_0x4c0a30){return db[_0xe636('0x1c')][_0xe636('0x1d')](_0x4acb5f['body'],{'raw':_0x4acb5f['options']?_0x4acb5f['options'][_0xe636('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4acb5f[_0xe636('0x18')]?_0x4acb5f[_0xe636('0x18')]['where']||null:null,'attributes':_0x4acb5f[_0xe636('0x18')]?_0x4acb5f['options']['attributes']||null:null,'limit':_0x4acb5f[_0xe636('0x18')]?_0x4acb5f['options'][_0xe636('0x1e')]||null:null})[_0xe636('0x1f')](function(_0xd01aea){logger[_0xe636('0xb')]('UpdateWhatsappQueueReport',_0x4acb5f);logger[_0xe636('0xd')](_0xe636('0x1b'),_0x4acb5f,JSON[_0xe636('0xf')](_0xd01aea));_0x216415(_0xd01aea);})[_0xe636('0x15')](function(_0x5e0704){logger['error']('UpdateWhatsappQueueReport',_0x5e0704['message'],_0x4acb5f);_0x4c0a30(_0x28ebe5[_0xe636('0x10')](0x1f4,_0x5e0704[_0xe636('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9bad4a8..7930c8a 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fcc=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create','/:id','update','delete','util'];(function(_0x2a7e5,_0x5d0731){var _0x3386e8=function(_0x3ffad1){while(--_0x3ffad1){_0x2a7e5['push'](_0x2a7e5['shift']());}};_0x3386e8(++_0x5d0731);}(_0x8fcc,0x155));var _0xc8fc=function(_0xda5e08,_0xbae603){_0xda5e08=_0xda5e08-0x0;var _0x280d0d=_0x8fcc[_0xda5e08];return _0x280d0d;};'use strict';var multer=require('multer');var util=require(_0xc8fc('0x0'));var path=require(_0xc8fc('0x1'));var timeout=require(_0xc8fc('0x2'));var express=require(_0xc8fc('0x3'));var router=express[_0xc8fc('0x4')]();var fs_extra=require(_0xc8fc('0x5'));var auth=require(_0xc8fc('0x6'));var interaction=require(_0xc8fc('0x7'));var config=require(_0xc8fc('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0xc8fc('0x9')]('/',auth[_0xc8fc('0xa')](),controller['index']);router[_0xc8fc('0x9')](_0xc8fc('0xb'),auth['isAuthenticated'](),controller[_0xc8fc('0xc')]);router[_0xc8fc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc8fc('0xd')]);router[_0xc8fc('0xe')]('/',auth[_0xc8fc('0xa')](),controller[_0xc8fc('0xf')]);router['put'](_0xc8fc('0x10'),auth[_0xc8fc('0xa')](),controller[_0xc8fc('0x11')]);router[_0xc8fc('0x12')]('/:id',auth[_0xc8fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x45cb=['update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x45cb,0x11b));var _0xb45c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x45cb[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xb45c('0x0'));var util=require(_0xb45c('0x1'));var path=require(_0xb45c('0x2'));var timeout=require(_0xb45c('0x3'));var express=require('express');var router=express[_0xb45c('0x4')]();var fs_extra=require(_0xb45c('0x5'));var auth=require(_0xb45c('0x6'));var interaction=require(_0xb45c('0x7'));var config=require(_0xb45c('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0xb45c('0x9')]('/',auth[_0xb45c('0xa')](),controller[_0xb45c('0xb')]);router['get'](_0xb45c('0xc'),auth[_0xb45c('0xa')](),controller[_0xb45c('0xd')]);router[_0xb45c('0x9')](_0xb45c('0xe'),auth[_0xb45c('0xa')](),controller[_0xb45c('0xf')]);router[_0xb45c('0x10')]('/',auth[_0xb45c('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb45c('0x11')]);router[_0xb45c('0x12')](_0xb45c('0xe'),auth[_0xb45c('0xa')](),controller[_0xb45c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 1be9bb1..96d7947 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x693f=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf693('0x0'));module[_0xf693('0x1')]={'uniqueid':{'type':Sequelize[_0xf693('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf693('0x3')]('account',_0xf693('0x4'),_0xf693('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf693('0x6')]}}; \ No newline at end of file +var _0x5ed9=['account','agent','queue','sequelize','exports','ENUM'];(function(_0x405dfd,_0x49f25d){var _0x935c27=function(_0x1259e8){while(--_0x1259e8){_0x405dfd['push'](_0x405dfd['shift']());}};_0x935c27(++_0x49f25d);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5ed9[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x95ed('0x0'));module[_0x95ed('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x95ed('0x2')](_0x95ed('0x3'),_0x95ed('0x4'),_0x95ed('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7be21d8..be64d22 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c8a=['where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','sort'];(function(_0x28e59f,_0x351542){var _0x29ff9b=function(_0x5242b1){while(--_0x5242b1){_0x28e59f['push'](_0x28e59f['shift']());}};_0x29ff9b(++_0x351542);}(_0x4c8a,0x1d9));var _0xa4c8=function(_0x16312c,_0x429778){_0x16312c=_0x16312c-0x0;var _0x5c0a27=_0x4c8a[_0x16312c];return _0x5c0a27;};'use strict';var emlformat=require(_0xa4c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4c8('0x1'));var jsonpatch=require(_0xa4c8('0x2'));var rp=require(_0xa4c8('0x3'));var moment=require(_0xa4c8('0x4'));var BPromise=require(_0xa4c8('0x5'));var Mustache=require(_0xa4c8('0x6'));var util=require(_0xa4c8('0x7'));var path=require(_0xa4c8('0x8'));var sox=require(_0xa4c8('0x9'));var csv=require(_0xa4c8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4c8('0xb'));var _=require(_0xa4c8('0xc'));var squel=require(_0xa4c8('0xd'));var crypto=require(_0xa4c8('0xe'));var jsforce=require(_0xa4c8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa4c8('0xa'));var querystring=require(_0xa4c8('0x10'));var Papa=require(_0xa4c8('0x11'));var Redis=require(_0xa4c8('0x12'));var authService=require(_0xa4c8('0x13'));var qs=require(_0xa4c8('0x14'));var as=require(_0xa4c8('0x15'));var hardwareService=require(_0xa4c8('0x16'));var logger=require('../../config/logger')(_0xa4c8('0x17'));var utils=require(_0xa4c8('0x18'));var config=require(_0xa4c8('0x19'));var licenseUtil=require(_0xa4c8('0x1a'));var db=require(_0xa4c8('0x1b'))['db'];function respondWithStatusCode(_0x6df97c,_0x45c02f){_0x45c02f=_0x45c02f||0xcc;return function(_0x488137){if(_0x488137){return _0x6df97c[_0xa4c8('0x1c')](_0x45c02f);}return _0x6df97c[_0xa4c8('0x1d')](_0x45c02f)['end']();};}function respondWithResult(_0x371ff0,_0x303861){_0x303861=_0x303861||0xc8;return function(_0xb5dc4c){if(_0xb5dc4c){return _0x371ff0[_0xa4c8('0x1d')](_0x303861)[_0xa4c8('0x1e')](_0xb5dc4c);}};}function respondWithFilteredResult(_0x1e89f2,_0x472c08){return function(_0x21b63b){if(_0x21b63b){var _0x175de5=typeof _0x472c08[_0xa4c8('0x1f')]==='undefined'&&typeof _0x472c08[_0xa4c8('0x20')]==='undefined';var _0x16af4b=_0x21b63b[_0xa4c8('0x21')];var _0x546a25=_0x175de5?0x0:_0x472c08[_0xa4c8('0x1f')];var _0x3780c3=_0x175de5?_0x21b63b[_0xa4c8('0x21')]:_0x472c08[_0xa4c8('0x1f')]+_0x472c08[_0xa4c8('0x20')];var _0xc7a468;if(_0x3780c3>=_0x16af4b){_0x3780c3=_0x16af4b;_0xc7a468=0xc8;}else{_0xc7a468=0xce;}_0x1e89f2[_0xa4c8('0x1d')](_0xc7a468);return _0x1e89f2[_0xa4c8('0x22')](_0xa4c8('0x23'),_0x546a25+'-'+_0x3780c3+'/'+_0x16af4b)['json'](_0x21b63b);}return null;};}function patchUpdates(_0x5db1bd){return function(_0x27bf95){try{jsonpatch[_0xa4c8('0x24')](_0x27bf95,_0x5db1bd,!![]);}catch(_0x105ca9){return BPromise[_0xa4c8('0x25')](_0x105ca9);}return _0x27bf95['save']();};}function saveUpdates(_0x4693a0,_0x54e7d8){return function(_0x24eaca){if(_0x24eaca){return _0x24eaca[_0xa4c8('0x26')](_0x4693a0)[_0xa4c8('0x27')](function(_0x27b279){return _0x27b279;});}return null;};}function removeEntity(_0x12b429,_0x2c6fe9){return function(_0x190707){if(_0x190707){return _0x190707[_0xa4c8('0x28')]()[_0xa4c8('0x27')](function(){_0x12b429[_0xa4c8('0x1d')](0xcc)[_0xa4c8('0x29')]();});}};}function handleEntityNotFound(_0x4ac814,_0x10a4a8){return function(_0x1076a7){if(!_0x1076a7){_0x4ac814[_0xa4c8('0x1c')](0x194);}return _0x1076a7;};}function handleError(_0x37c84b,_0x4f0c7b){_0x4f0c7b=_0x4f0c7b||0x1f4;return function(_0x31165a){logger['error'](_0x31165a[_0xa4c8('0x2a')]);if(_0x31165a[_0xa4c8('0x2b')]){delete _0x31165a['name'];}_0x37c84b[_0xa4c8('0x1d')](_0x4f0c7b)[_0xa4c8('0x2c')](_0x31165a);};}exports['index']=function(_0x51f4c5,_0x1c811b){var _0x7427c2={},_0x330cfd={},_0x3afc61={'count':0x0,'rows':[]};var _0x4cd39e=_[_0xa4c8('0x2d')](db[_0xa4c8('0x2e')][_0xa4c8('0x2f')],function(_0x32b6e7){return{'name':_0x32b6e7[_0xa4c8('0x30')],'type':_0x32b6e7[_0xa4c8('0x31')][_0xa4c8('0x32')]};});_0x330cfd[_0xa4c8('0x33')]=_[_0xa4c8('0x2d')](_0x4cd39e,_0xa4c8('0x2b'));_0x330cfd[_0xa4c8('0x34')]=_[_0xa4c8('0x35')](_0x51f4c5[_0xa4c8('0x34')]);_0x330cfd['filters']=_[_0xa4c8('0x36')](_0x330cfd[_0xa4c8('0x33')],_0x330cfd['query']);_0x7427c2['attributes']=_[_0xa4c8('0x36')](_0x330cfd[_0xa4c8('0x33')],qs[_0xa4c8('0x37')](_0x51f4c5[_0xa4c8('0x34')]['fields']));_0x7427c2[_0xa4c8('0x38')]=_0x7427c2[_0xa4c8('0x38')]['length']?_0x7427c2['attributes']:_0x330cfd[_0xa4c8('0x33')];if(!_0x51f4c5[_0xa4c8('0x34')]['hasOwnProperty'](_0xa4c8('0x39'))){_0x7427c2[_0xa4c8('0x20')]=qs['limit'](_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x20')]);_0x7427c2[_0xa4c8('0x1f')]=qs[_0xa4c8('0x1f')](_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x1f')]);}_0x7427c2['order']=qs[_0xa4c8('0x3a')](_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x3a')]);_0x7427c2[_0xa4c8('0x3b')]=qs[_0xa4c8('0x3c')](_[_0xa4c8('0x3d')](_0x51f4c5['query'],_0x330cfd[_0xa4c8('0x3c')]),_0x4cd39e);if(_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x3e')]){_0x7427c2[_0xa4c8('0x3b')]=_[_0xa4c8('0x3f')](_0x7427c2[_0xa4c8('0x3b')],{'$or':_[_0xa4c8('0x2d')](_0x4cd39e,function(_0x1d44b6){if(_0x1d44b6['type']!==_0xa4c8('0x40')){var _0x4f8132={};_0x4f8132[_0x1d44b6['name']]={'$like':'%'+_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x3e')]+'%'};return _0x4f8132;}})});}_0x7427c2=_['merge']({},_0x7427c2,_0x51f4c5[_0xa4c8('0x41')]);var _0x255502={'where':_0x7427c2[_0xa4c8('0x3b')]};return db['WhatsappTransferReport']['count'](_0x255502)[_0xa4c8('0x27')](function(_0x4c32ac){_0x3afc61['count']=_0x4c32ac;if(_0x51f4c5[_0xa4c8('0x34')]['includeAll']){_0x7427c2[_0xa4c8('0x42')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xa4c8('0x43')](_0x7427c2);})[_0xa4c8('0x27')](function(_0x4ba153){_0x3afc61['rows']=_0x4ba153;return _0x3afc61;})[_0xa4c8('0x27')](respondWithFilteredResult(_0x1c811b,_0x7427c2))[_0xa4c8('0x44')](handleError(_0x1c811b,null));};exports[_0xa4c8('0x45')]=function(_0x2ec966,_0x5783f6){var _0x1db8a5={'raw':!![],'where':{'id':_0x2ec966[_0xa4c8('0x46')]['id']}},_0x28c6c6={};_0x28c6c6[_0xa4c8('0x33')]=_['keys'](db[_0xa4c8('0x2e')][_0xa4c8('0x2f')]);_0x28c6c6[_0xa4c8('0x34')]=_[_0xa4c8('0x35')](_0x2ec966[_0xa4c8('0x34')]);_0x28c6c6[_0xa4c8('0x3c')]=_['intersection'](_0x28c6c6['model'],_0x28c6c6[_0xa4c8('0x34')]);_0x1db8a5[_0xa4c8('0x38')]=_['intersection'](_0x28c6c6[_0xa4c8('0x33')],qs['fields'](_0x2ec966[_0xa4c8('0x34')][_0xa4c8('0x37')]));_0x1db8a5[_0xa4c8('0x38')]=_0x1db8a5[_0xa4c8('0x38')]['length']?_0x1db8a5[_0xa4c8('0x38')]:_0x28c6c6[_0xa4c8('0x33')];if(_0x2ec966[_0xa4c8('0x34')][_0xa4c8('0x47')]){_0x1db8a5['include']=[{'all':!![]}];}_0x1db8a5=_[_0xa4c8('0x3f')]({},_0x1db8a5,_0x2ec966[_0xa4c8('0x41')]);return db[_0xa4c8('0x2e')]['find'](_0x1db8a5)['then'](handleEntityNotFound(_0x5783f6,null))[_0xa4c8('0x27')](respondWithResult(_0x5783f6,null))[_0xa4c8('0x44')](handleError(_0x5783f6,null));};exports['create']=function(_0x23f059,_0xcde3e){return db[_0xa4c8('0x2e')][_0xa4c8('0x48')](_0x23f059[_0xa4c8('0x49')],{})[_0xa4c8('0x27')](respondWithResult(_0xcde3e,0xc9))['catch'](handleError(_0xcde3e,null));};exports['update']=function(_0x1f3569,_0x42aa37){if(_0x1f3569[_0xa4c8('0x49')]['id']){delete _0x1f3569['body']['id'];}return db[_0xa4c8('0x2e')]['find']({'where':{'id':_0x1f3569['params']['id']}})[_0xa4c8('0x27')](handleEntityNotFound(_0x42aa37,null))[_0xa4c8('0x27')](saveUpdates(_0x1f3569['body'],null))['then'](respondWithResult(_0x42aa37,null))[_0xa4c8('0x44')](handleError(_0x42aa37,null));};exports[_0xa4c8('0x28')]=function(_0x221a4f,_0x42b020){return db[_0xa4c8('0x2e')][_0xa4c8('0x4a')]({'where':{'id':_0x221a4f[_0xa4c8('0x46')]['id']}})[_0xa4c8('0x27')](handleEntityNotFound(_0x42b020,null))[_0xa4c8('0x27')](removeEntity(_0x42b020,null))[_0xa4c8('0x44')](handleError(_0x42b020,null));};exports[_0xa4c8('0x4b')]=function(_0xca38a0,_0x1a90ad){return db[_0xa4c8('0x2e')]['describe']()[_0xa4c8('0x27')](respondWithResult(_0x1a90ad,null))['catch'](handleError(_0x1a90ad,null));}; \ No newline at end of file +var _0x20df=['limit','Content-Range','apply','destroy','then','end','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x59c6e6,_0x267947){var _0xd37888=function(_0x3dc53f){while(--_0x3dc53f){_0x59c6e6['push'](_0x59c6e6['shift']());}};_0xd37888(++_0x267947);}(_0x20df,0x7c));var _0xf20d=function(_0x2f32c4,_0x531dc6){_0x2f32c4=_0x2f32c4-0x0;var _0x3f3018=_0x20df[_0x2f32c4];return _0x3f3018;};'use strict';var emlformat=require(_0xf20d('0x0'));var rimraf=require(_0xf20d('0x1'));var zipdir=require(_0xf20d('0x2'));var jsonpatch=require(_0xf20d('0x3'));var rp=require('request-promise');var moment=require(_0xf20d('0x4'));var BPromise=require(_0xf20d('0x5'));var Mustache=require(_0xf20d('0x6'));var util=require(_0xf20d('0x7'));var path=require(_0xf20d('0x8'));var sox=require('sox');var csv=require(_0xf20d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf20d('0xa'));var _=require(_0xf20d('0xb'));var squel=require('squel');var crypto=require(_0xf20d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf20d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf20d('0xe'));var Papa=require(_0xf20d('0xf'));var Redis=require(_0xf20d('0x10'));var authService=require(_0xf20d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf20d('0x12'));var hardwareService=require(_0xf20d('0x13'));var logger=require(_0xf20d('0x14'))(_0xf20d('0x15'));var utils=require(_0xf20d('0x16'));var config=require(_0xf20d('0x17'));var licenseUtil=require(_0xf20d('0x18'));var db=require(_0xf20d('0x19'))['db'];function respondWithStatusCode(_0x5457a3,_0x2fa3f6){_0x2fa3f6=_0x2fa3f6||0xcc;return function(_0x5126e0){if(_0x5126e0){return _0x5457a3[_0xf20d('0x1a')](_0x2fa3f6);}return _0x5457a3[_0xf20d('0x1b')](_0x2fa3f6)['end']();};}function respondWithResult(_0x1dce9d,_0x2e3cf2){_0x2e3cf2=_0x2e3cf2||0xc8;return function(_0x41fc44){if(_0x41fc44){return _0x1dce9d[_0xf20d('0x1b')](_0x2e3cf2)[_0xf20d('0x1c')](_0x41fc44);}};}function respondWithFilteredResult(_0x5c2ff0,_0x5d4244){return function(_0x3a4563){if(_0x3a4563){var _0xcd434c=typeof _0x5d4244[_0xf20d('0x1d')]===_0xf20d('0x1e')&&typeof _0x5d4244['limit']===_0xf20d('0x1e');var _0x4d3bfc=_0x3a4563[_0xf20d('0x1f')];var _0x5322ba=_0xcd434c?0x0:_0x5d4244['offset'];var _0x4b91bc=_0xcd434c?_0x3a4563[_0xf20d('0x1f')]:_0x5d4244[_0xf20d('0x1d')]+_0x5d4244[_0xf20d('0x20')];var _0x2483c4;if(_0x4b91bc>=_0x4d3bfc){_0x4b91bc=_0x4d3bfc;_0x2483c4=0xc8;}else{_0x2483c4=0xce;}_0x5c2ff0[_0xf20d('0x1b')](_0x2483c4);return _0x5c2ff0['set'](_0xf20d('0x21'),_0x5322ba+'-'+_0x4b91bc+'/'+_0x4d3bfc)['json'](_0x3a4563);}return null;};}function patchUpdates(_0x41b8c8){return function(_0x500bc9){try{jsonpatch[_0xf20d('0x22')](_0x500bc9,_0x41b8c8,!![]);}catch(_0x40e359){return BPromise['reject'](_0x40e359);}return _0x500bc9['save']();};}function saveUpdates(_0x3679cc,_0x1f9a62){return function(_0x37e292){if(_0x37e292){return _0x37e292['update'](_0x3679cc)['then'](function(_0x2a8d7e){return _0x2a8d7e;});}return null;};}function removeEntity(_0x96628b,_0x37b480){return function(_0x419b19){if(_0x419b19){return _0x419b19[_0xf20d('0x23')]()[_0xf20d('0x24')](function(){_0x96628b['status'](0xcc)[_0xf20d('0x25')]();});}};}function handleEntityNotFound(_0x486104,_0x505645){return function(_0x3e97bd){if(!_0x3e97bd){_0x486104[_0xf20d('0x1a')](0x194);}return _0x3e97bd;};}function handleError(_0x3d935f,_0x5a815b){_0x5a815b=_0x5a815b||0x1f4;return function(_0x5c6e7a){logger['error'](_0x5c6e7a[_0xf20d('0x26')]);if(_0x5c6e7a[_0xf20d('0x27')]){delete _0x5c6e7a[_0xf20d('0x27')];}_0x3d935f['status'](_0x5a815b)[_0xf20d('0x28')](_0x5c6e7a);};}exports[_0xf20d('0x29')]=function(_0x1dfda0,_0x8372b2){var _0x19e60b={},_0x36e7a5={},_0xd8678f={'count':0x0,'rows':[]};var _0x4cb600=_['map'](db[_0xf20d('0x2a')][_0xf20d('0x2b')],function(_0x5ca630){return{'name':_0x5ca630[_0xf20d('0x2c')],'type':_0x5ca630[_0xf20d('0x2d')][_0xf20d('0x2e')]};});_0x36e7a5[_0xf20d('0x2f')]=_[_0xf20d('0x30')](_0x4cb600,'name');_0x36e7a5['query']=_['keys'](_0x1dfda0[_0xf20d('0x31')]);_0x36e7a5['filters']=_[_0xf20d('0x32')](_0x36e7a5[_0xf20d('0x2f')],_0x36e7a5[_0xf20d('0x31')]);_0x19e60b[_0xf20d('0x33')]=_['intersection'](_0x36e7a5[_0xf20d('0x2f')],qs[_0xf20d('0x34')](_0x1dfda0[_0xf20d('0x31')][_0xf20d('0x34')]));_0x19e60b[_0xf20d('0x33')]=_0x19e60b[_0xf20d('0x33')][_0xf20d('0x35')]?_0x19e60b[_0xf20d('0x33')]:_0x36e7a5[_0xf20d('0x2f')];if(!_0x1dfda0['query'][_0xf20d('0x36')](_0xf20d('0x37'))){_0x19e60b[_0xf20d('0x20')]=qs[_0xf20d('0x20')](_0x1dfda0['query'][_0xf20d('0x20')]);_0x19e60b[_0xf20d('0x1d')]=qs[_0xf20d('0x1d')](_0x1dfda0[_0xf20d('0x31')][_0xf20d('0x1d')]);}_0x19e60b[_0xf20d('0x38')]=qs[_0xf20d('0x39')](_0x1dfda0[_0xf20d('0x31')][_0xf20d('0x39')]);_0x19e60b[_0xf20d('0x3a')]=qs['filters'](_[_0xf20d('0x3b')](_0x1dfda0['query'],_0x36e7a5[_0xf20d('0x3c')]),_0x4cb600);if(_0x1dfda0[_0xf20d('0x31')][_0xf20d('0x3d')]){_0x19e60b[_0xf20d('0x3a')]=_[_0xf20d('0x3e')](_0x19e60b[_0xf20d('0x3a')],{'$or':_[_0xf20d('0x30')](_0x4cb600,function(_0x59b478){if(_0x59b478['type']!==_0xf20d('0x3f')){var _0x41b3bf={};_0x41b3bf[_0x59b478['name']]={'$like':'%'+_0x1dfda0['query'][_0xf20d('0x3d')]+'%'};return _0x41b3bf;}})});}_0x19e60b=_[_0xf20d('0x3e')]({},_0x19e60b,_0x1dfda0['options']);var _0x37e04c={'where':_0x19e60b['where']};return db[_0xf20d('0x2a')][_0xf20d('0x1f')](_0x37e04c)['then'](function(_0x24383c){_0xd8678f[_0xf20d('0x1f')]=_0x24383c;if(_0x1dfda0[_0xf20d('0x31')][_0xf20d('0x40')]){_0x19e60b[_0xf20d('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xf20d('0x42')](_0x19e60b);})['then'](function(_0x5761da){_0xd8678f[_0xf20d('0x43')]=_0x5761da;return _0xd8678f;})[_0xf20d('0x24')](respondWithFilteredResult(_0x8372b2,_0x19e60b))[_0xf20d('0x44')](handleError(_0x8372b2,null));};exports[_0xf20d('0x45')]=function(_0x307ed8,_0x54966d){var _0x141c84={'raw':!![],'where':{'id':_0x307ed8['params']['id']}},_0x5319ca={};_0x5319ca[_0xf20d('0x2f')]=_[_0xf20d('0x46')](db[_0xf20d('0x2a')][_0xf20d('0x2b')]);_0x5319ca[_0xf20d('0x31')]=_[_0xf20d('0x46')](_0x307ed8[_0xf20d('0x31')]);_0x5319ca[_0xf20d('0x3c')]=_[_0xf20d('0x32')](_0x5319ca[_0xf20d('0x2f')],_0x5319ca[_0xf20d('0x31')]);_0x141c84[_0xf20d('0x33')]=_['intersection'](_0x5319ca['model'],qs[_0xf20d('0x34')](_0x307ed8['query'][_0xf20d('0x34')]));_0x141c84[_0xf20d('0x33')]=_0x141c84[_0xf20d('0x33')][_0xf20d('0x35')]?_0x141c84[_0xf20d('0x33')]:_0x5319ca['model'];if(_0x307ed8[_0xf20d('0x31')][_0xf20d('0x40')]){_0x141c84['include']=[{'all':!![]}];}_0x141c84=_[_0xf20d('0x3e')]({},_0x141c84,_0x307ed8[_0xf20d('0x47')]);return db['WhatsappTransferReport'][_0xf20d('0x48')](_0x141c84)[_0xf20d('0x24')](handleEntityNotFound(_0x54966d,null))[_0xf20d('0x24')](respondWithResult(_0x54966d,null))[_0xf20d('0x44')](handleError(_0x54966d,null));};exports[_0xf20d('0x49')]=function(_0x104e87,_0x41197b){return db[_0xf20d('0x2a')][_0xf20d('0x49')](_0x104e87[_0xf20d('0x4a')],{})[_0xf20d('0x24')](respondWithResult(_0x41197b,0xc9))['catch'](handleError(_0x41197b,null));};exports[_0xf20d('0x4b')]=function(_0x5ddbb9,_0x4fe574){if(_0x5ddbb9[_0xf20d('0x4a')]['id']){delete _0x5ddbb9['body']['id'];}return db[_0xf20d('0x2a')]['find']({'where':{'id':_0x5ddbb9[_0xf20d('0x4c')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x4fe574,null))['then'](saveUpdates(_0x5ddbb9[_0xf20d('0x4a')],null))[_0xf20d('0x24')](respondWithResult(_0x4fe574,null))[_0xf20d('0x44')](handleError(_0x4fe574,null));};exports['destroy']=function(_0x5a79f4,_0x8398f){return db[_0xf20d('0x2a')][_0xf20d('0x48')]({'where':{'id':_0x5a79f4[_0xf20d('0x4c')]['id']}})[_0xf20d('0x24')](handleEntityNotFound(_0x8398f,null))['then'](removeEntity(_0x8398f,null))[_0xf20d('0x44')](handleError(_0x8398f,null));};exports[_0xf20d('0x4d')]=function(_0x4d5f78,_0x54b4ad){return db[_0xf20d('0x2a')]['describe']()['then'](respondWithResult(_0x54b4ad,null))[_0xf20d('0x44')](handleError(_0x54b4ad,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a577456..300ae19 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26dd=['uniqueid','lodash','util','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer'];(function(_0x5d91d2,_0x2c3e77){var _0x1b262=function(_0x24e7a1){while(--_0x24e7a1){_0x5d91d2['push'](_0x5d91d2['shift']());}};_0x1b262(++_0x2c3e77);}(_0x26dd,0x145));var _0xd26d=function(_0x5e7b79,_0x4f144b){_0x5e7b79=_0x5e7b79-0x0;var _0xcb1eea=_0x26dd[_0x5e7b79];return _0xcb1eea;};'use strict';var _=require(_0xd26d('0x0'));var util=require(_0xd26d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd26d('0x2'));var fs=require('fs');var path=require(_0xd26d('0x3'));var rimraf=require('rimraf');var config=require(_0xd26d('0x4'));var attributes=require(_0xd26d('0x5'));module[_0xd26d('0x6')]=function(_0x5db539,_0x363854){return _0x5db539['define']('WhatsappTransferReport',attributes,{'tableName':_0xd26d('0x7'),'paranoid':![],'indexes':[{'name':_0xd26d('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2404=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20c020,_0xc0438b){var _0x38e214=function(_0x4597bf){while(--_0x4597bf){_0x20c020['push'](_0x20c020['shift']());}};_0x38e214(++_0xc0438b);}(_0x2404,0x7d));var _0x4240=function(_0x2c6ba5,_0xeee73){_0x2c6ba5=_0x2c6ba5-0x0;var _0x3288e8=_0x2404[_0x2c6ba5];return _0x3288e8;};'use strict';var _=require(_0x4240('0x0'));var util=require(_0x4240('0x1'));var logger=require(_0x4240('0x2'))(_0x4240('0x3'));var moment=require(_0x4240('0x4'));var BPromise=require(_0x4240('0x5'));var rp=require(_0x4240('0x6'));var fs=require('fs');var path=require(_0x4240('0x7'));var rimraf=require(_0x4240('0x8'));var config=require(_0x4240('0x9'));var attributes=require(_0x4240('0xa'));module[_0x4240('0xb')]=function(_0xbae259,_0x20bd44){return _0xbae259[_0x4240('0xc')](_0x4240('0xd'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x4240('0xe'),'fields':[_0x4240('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e64c46f..cb877cc 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c8b=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x181ac8,_0x5c0d70){var _0x4f4cca=function(_0x1c2c71){while(--_0x1c2c71){_0x181ac8['push'](_0x181ac8['shift']());}};_0x4f4cca(++_0x5c0d70);}(_0x8c8b,0x106));var _0xb8c8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c8b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb8c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8c8('0x1'));var rs=require(_0xb8c8('0x2'));var fs=require('fs');var Redis=require(_0xb8c8('0x3'));var db=require(_0xb8c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8c8('0x5'));var config=require(_0xb8c8('0x6'));var jayson=require(_0xb8c8('0x7'));var client=jayson[_0xb8c8('0x8')][_0xb8c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c33cf,_0x1fa488,_0x36d081){return new BPromise(function(_0x1d9bd8,_0x2badd9){return client[_0xb8c8('0xa')](_0x3c33cf,_0x36d081)['then'](function(_0xfa7361){logger[_0xb8c8('0xb')](_0xb8c8('0xc'),_0x1fa488,_0xb8c8('0xd'));logger[_0xb8c8('0xe')](_0xb8c8('0xf'),_0x1fa488,_0xb8c8('0xd'),JSON[_0xb8c8('0x10')](_0xfa7361));if(_0xfa7361[_0xb8c8('0x11')]){if(_0xfa7361[_0xb8c8('0x11')][_0xb8c8('0x12')]===0x1f4){logger[_0xb8c8('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1fa488,_0xfa7361[_0xb8c8('0x11')]['message']);return _0x2badd9(_0xfa7361[_0xb8c8('0x11')][_0xb8c8('0x13')]);}logger['error'](_0xb8c8('0xc'),_0x1fa488,_0xfa7361[_0xb8c8('0x11')][_0xb8c8('0x13')]);return _0x1d9bd8(_0xfa7361['error'][_0xb8c8('0x13')]);}else{logger[_0xb8c8('0xb')](_0xb8c8('0xc'),_0x1fa488,_0xb8c8('0xd'));_0x1d9bd8(_0xfa7361['result'][_0xb8c8('0x13')]);}})[_0xb8c8('0x14')](function(_0x190365){logger[_0xb8c8('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1fa488,_0x190365);_0x2badd9(_0x190365);});});} \ No newline at end of file +var _0xe5eb=['debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x429f02,_0x40d60c){var _0x3453ea=function(_0x57e856){while(--_0x57e856){_0x429f02['push'](_0x429f02['shift']());}};_0x3453ea(++_0x40d60c);}(_0xe5eb,0xdf));var _0xbe5e=function(_0x2c5987,_0x101621){_0x2c5987=_0x2c5987-0x0;var _0x55773d=_0xe5eb[_0x2c5987];return _0x55773d;};'use strict';var _=require(_0xbe5e('0x0'));var util=require(_0xbe5e('0x1'));var moment=require(_0xbe5e('0x2'));var BPromise=require(_0xbe5e('0x3'));var rs=require(_0xbe5e('0x4'));var fs=require('fs');var Redis=require(_0xbe5e('0x5'));var db=require(_0xbe5e('0x6'))['db'];var utils=require(_0xbe5e('0x7'));var logger=require(_0xbe5e('0x8'))('rpc');var config=require(_0xbe5e('0x9'));var jayson=require(_0xbe5e('0xa'));var client=jayson[_0xbe5e('0xb')][_0xbe5e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4aab72,_0x42aa34,_0x4726ba){return new BPromise(function(_0x4a3045,_0x49c9bd){return client[_0xbe5e('0xd')](_0x4aab72,_0x4726ba)[_0xbe5e('0xe')](function(_0x579b95){logger[_0xbe5e('0xf')](_0xbe5e('0x10'),_0x42aa34,'request\x20sent');logger[_0xbe5e('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x42aa34,_0xbe5e('0x12'),JSON[_0xbe5e('0x13')](_0x579b95));if(_0x579b95[_0xbe5e('0x14')]){if(_0x579b95[_0xbe5e('0x14')]['code']===0x1f4){logger[_0xbe5e('0x14')](_0xbe5e('0x10'),_0x42aa34,_0x579b95[_0xbe5e('0x14')]['message']);return _0x49c9bd(_0x579b95[_0xbe5e('0x14')][_0xbe5e('0x15')]);}logger['error'](_0xbe5e('0x10'),_0x42aa34,_0x579b95[_0xbe5e('0x14')]['message']);return _0x4a3045(_0x579b95[_0xbe5e('0x14')]['message']);}else{logger[_0xbe5e('0xf')](_0xbe5e('0x10'),_0x42aa34,_0xbe5e('0x12'));_0x4a3045(_0x579b95[_0xbe5e('0x16')][_0xbe5e('0x15')]);}})[_0xbe5e('0x17')](function(_0x4f016b){logger[_0xbe5e('0x14')](_0xbe5e('0x10'),_0x42aa34,_0x4f016b);_0x49c9bd(_0x4f016b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index b81ce23..dfb5bb2 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdad2=['filter','exitCode','length','pm2_env','name','Online\x20apps:','online','join','map','status','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','then','seedDB','default','info','start'];(function(_0x3362f3,_0x2af0bc){var _0x57be75=function(_0x43eed8){while(--_0x43eed8){_0x3362f3['push'](_0x3362f3['shift']());}};_0x57be75(++_0x2af0bc);}(_0xdad2,0x14c));var _0x2dad=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xdad2[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var db=require(_0x2dad('0x0'))['db'];var seedDb=require(_0x2dad('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x2dad('0x2'));var config=require(_0x2dad('0x3'));var logger=require(_0x2dad('0x4'))('app');var pm2=require(_0x2dad('0x5'));var pm2Config=require(_0x2dad('0x6'));var schedule=require('./config/schedule');var chat=require(_0x2dad('0x7'));var whatsapp=require(_0x2dad('0x8'));var transcribe=require(_0x2dad('0x9'));var provider=require(_0x2dad('0xa'));function main(){return db['sequelize']['sync']()[_0x2dad('0xb')](function(){if(config[_0x2dad('0xc')]){return seedDb[_0x2dad('0xd')]();}})[_0x2dad('0xb')](function(){return checkLicense[_0x2dad('0xd')]();})[_0x2dad('0xb')](function(){return rpc['listen']();})[_0x2dad('0xb')](function(_0x57d1a2){logger[_0x2dad('0xe')](_0x57d1a2);return chat[_0x2dad('0xf')]();})['then'](function(){return whatsapp[_0x2dad('0xf')]();})[_0x2dad('0xb')](function(){return schedule[_0x2dad('0xf')]();})['then'](function(){return transcribe[_0x2dad('0xf')]();})[_0x2dad('0xb')](function(){return provider['start']();})[_0x2dad('0xb')](function(_0x2fabe2){logger[_0x2dad('0xe')](_0x2fabe2);return pm2[_0x2dad('0xf')](pm2Config);})['then'](function(_0x711ee2){var _0x2c727d=_0x711ee2[_0x2dad('0x10')](function(_0x1ea049){return typeof _0x1ea049[_0x2dad('0x11')]==='number'&&_0x1ea049['exitCode']>=0x0;});if(_0x2c727d[_0x2dad('0x12')]>0x0){throw new Error(_0x2c727d['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x2c727d,function(_0xa5dc24){return'\x22'+_0xa5dc24[_0x2dad('0x13')][_0x2dad('0x14')]+'\x22';}));}logger[_0x2dad('0xe')](_0x2dad('0x15'),_['map'](_[_0x2dad('0x10')](_0x711ee2,{'status':_0x2dad('0x16')}),'name')[_0x2dad('0x17')]());logger['info']('Offline\x20apps:',_[_0x2dad('0x18')](_[_0x2dad('0x10')](_0x711ee2,function(_0x2cc5db){return _0x2cc5db[_0x2dad('0x19')]!==_0x2dad('0x16');}),_0x2dad('0x14'))['join']()||'None');console[_0x2dad('0x1a')]('App\x20Ready!');})['catch'](function(_0x18a0f9){console[_0x2dad('0x1a')](_0x2dad('0x1b'),_0x18a0f9);logger['error'](_0x2dad('0x1c'),_0x18a0f9);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x18af=['online','join','status','name','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./rpc','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','filter','exitCode','length','map','Online\x20apps:'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x18af,0x8b));var _0xf18a=function(_0x3c5f1c,_0xf9e096){_0x3c5f1c=_0x3c5f1c-0x0;var _0x23cddc=_0x18af[_0x3c5f1c];return _0x23cddc;};'use strict';var _=require(_0xf18a('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xf18a('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xf18a('0x2'));var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require(_0xf18a('0x3'));var pm2Config=require(_0xf18a('0x4'));var schedule=require(_0xf18a('0x5'));var chat=require(_0xf18a('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xf18a('0x7'));var provider=require(_0xf18a('0x8'));function main(){return db[_0xf18a('0x9')]['sync']()[_0xf18a('0xa')](function(){if(config[_0xf18a('0xb')]){return seedDb[_0xf18a('0xc')]();}})[_0xf18a('0xa')](function(){return checkLicense[_0xf18a('0xc')]();})[_0xf18a('0xa')](function(){return rpc[_0xf18a('0xd')]();})[_0xf18a('0xa')](function(_0x33fb6a){logger[_0xf18a('0xe')](_0x33fb6a);return chat[_0xf18a('0xf')]();})[_0xf18a('0xa')](function(){return whatsapp[_0xf18a('0xf')]();})['then'](function(){return schedule[_0xf18a('0xf')]();})[_0xf18a('0xa')](function(){return transcribe[_0xf18a('0xf')]();})[_0xf18a('0xa')](function(){return provider[_0xf18a('0xf')]();})['then'](function(_0x2af3dc){logger[_0xf18a('0xe')](_0x2af3dc);return pm2['start'](pm2Config);})[_0xf18a('0xa')](function(_0x5a06b5){var _0x27428a=_0x5a06b5[_0xf18a('0x10')](function(_0x52dc2c){return typeof _0x52dc2c[_0xf18a('0x11')]==='number'&&_0x52dc2c[_0xf18a('0x11')]>=0x0;});if(_0x27428a[_0xf18a('0x12')]>0x0){throw new Error(_0x27428a['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xf18a('0x13')](_0x27428a,function(_0x23c8f1){return'\x22'+_0x23c8f1['pm2_env']['name']+'\x22';}));}logger[_0xf18a('0xe')](_0xf18a('0x14'),_[_0xf18a('0x13')](_['filter'](_0x5a06b5,{'status':_0xf18a('0x15')}),'name')[_0xf18a('0x16')]());logger[_0xf18a('0xe')]('Offline\x20apps:',_[_0xf18a('0x13')](_[_0xf18a('0x10')](_0x5a06b5,function(_0x533acb){return _0x533acb[_0xf18a('0x17')]!==_0xf18a('0x15');}),_0xf18a('0x18'))['join']()||'None');console[_0xf18a('0x19')](_0xf18a('0x1a'));})[_0xf18a('0x1b')](function(_0xfc6308){console[_0xf18a('0x19')](_0xf18a('0x1c'),_0xfc6308);logger[_0xf18a('0x1d')](_0xf18a('0x1e'),_0xfc6308);process[_0xf18a('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index afe994a..28ef7a4 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaaa=['voicePause','mailPause','faxPause','openchannelPause','lastLoginAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','faxAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','headers','Basic','User','authenticate','startsWith','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','add','blockDuration','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyNonce','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','split','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','floor','now','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','composable-middleware','basic-auth','crypto','util','moment','secrets','role','fullname','name','internal','email','userpic','md5secret'];(function(_0xbc88d6,_0x402b9e){var _0x466c25=function(_0x5b6045){while(--_0x5b6045){_0xbc88d6['push'](_0xbc88d6['shift']());}};_0x466c25(++_0x402b9e);}(_0xcaaa,0x1f2));var _0xacaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaaa[_0x3dd15e];return _0x231fd0;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xacaa('0x0'));var hardwareConf=require(_0xacaa('0x1'));var licenseUtil=require(_0xacaa('0x2'));var encryptor=require(_0xacaa('0x3'));var _=require('lodash');var jwt=require(_0xacaa('0x4'));var expressJwt=require('express-jwt');var compose=require(_0xacaa('0x5'));var basicAuth=require(_0xacaa('0x6'));var crypto=require(_0xacaa('0x7'));var BPromise=require('bluebird');var util=require(_0xacaa('0x8'));var moment=require(_0xacaa('0x9'));var validateJwt=expressJwt({'secret':config[_0xacaa('0xa')]['session']});var userAttributes=['id',_0xacaa('0xb'),_0xacaa('0xc'),_0xacaa('0xd'),_0xacaa('0xe'),_0xacaa('0xf'),_0xacaa('0x10'),'permissions',_0xacaa('0x11'),_0xacaa('0x12'),'chatPause',_0xacaa('0x13'),_0xacaa('0x14'),'smsPause',_0xacaa('0x15'),'pauseType','showWebBar',_0xacaa('0x16'),'lastPauseAt','crudPermissions','allowmessenger',_0xacaa('0x17'),_0xacaa('0x18'),_0xacaa('0x19'),_0xacaa('0x1a'),_0xacaa('0x1b'),_0xacaa('0x1c'),_0xacaa('0x1d'),'phoneBarEnableSettings',_0xacaa('0x1e'),_0xacaa('0x1f'),_0xacaa('0x20'),'phoneBarRemoteControlPort','hotdesk',_0xacaa('0x21'),_0xacaa('0x22'),_0xacaa('0x23'),_0xacaa('0x24'),_0xacaa('0x25'),_0xacaa('0x26'),_0xacaa('0x27'),_0xacaa('0x28'),'ignorePauseForPreviewCalls',_0xacaa('0x29'),_0xacaa('0x2a'),_0xacaa('0x2b'),_0xacaa('0x2c'),_0xacaa('0x2d'),_0xacaa('0x2e'),_0xacaa('0x2f'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer',_0xacaa('0x30'),'whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];exports[_0xacaa('0x31')]=function(){return this['isAuthenticated'](!![])[_0xacaa('0x32')](function(_0x28be66,_0x36c59d,_0x5de80a){if(_0x28be66[_0xacaa('0x33')]){_0x5de80a();}else{return db[_0xacaa('0x34')][_0xacaa('0x35')]({'where':{'id':_0x28be66[_0xacaa('0x36')]['id']},'attributes':['id',_0xacaa('0x37'),_0xacaa('0x38')],'raw':!![]})[_0xacaa('0x39')](function(_0x1de960){if(_0x1de960&&_0x1de960['closed']&&!_0x28be66[_0xacaa('0x3a')][_0xacaa('0x3b')]){return _0x36c59d[_0xacaa('0x3c')](_0x1de960[_0xacaa('0x38')]===_0xacaa('0x3d')?0x195:0x193)[_0xacaa('0x3e')]({'message':_0x1de960[_0xacaa('0x38')]===_0xacaa('0x3d')?_0xacaa('0x3f'):_0xacaa('0x40')});}else{_0x5de80a();}})[_0xacaa('0x41')](function(_0x33944f){_0x5de80a(_0x33944f);});}});};exports['isAuthenticated']=function isAuthenticated(_0xe64d61){return compose()[_0xacaa('0x32')](function(_0x10d6cc,_0x5ee461,_0x422f47){var _0x42c1d6;if(_0x10d6cc['headers'][_0xacaa('0x42')]){if(_['startsWith'](_0x10d6cc[_0xacaa('0x43')][_0xacaa('0x42')],_0xacaa('0x44'))){var _0x2d2c50=basicAuth(_0x10d6cc);db[_0xacaa('0x45')]['find']({'where':{'name':_0x2d2c50[_0xacaa('0xd')]}})['then'](function(_0xa765f0){if(!_0xa765f0||!_0xa765f0[_0xacaa('0x46')](_0x2d2c50['pass'])){return _0x5ee461[_0xacaa('0x3c')](0x191)[_0xacaa('0x3e')]({'message':'Wrong\x20credentials.'});}_0x10d6cc['user']={'id':_0xa765f0['id']};_0x422f47();})[_0xacaa('0x41')](function(_0x5c153d){_0x422f47(_0x5c153d);});}else if(_[_0xacaa('0x47')](_0x10d6cc[_0xacaa('0x43')][_0xacaa('0x42')],_0xacaa('0x48'))){validateJwt(_0x10d6cc,_0x5ee461,_0x422f47);}else{if(_0xe64d61){_0x422f47();}else{return _0x5ee461[_0xacaa('0x3c')](0x193)[_0xacaa('0x3e')]({'message':_0xacaa('0x49')});}}}else if(_0x10d6cc[_0xacaa('0x3a')][_0xacaa('0x4a')]){try{var _0x3a8bd6={'audience':hardwareConf[_0xacaa('0x4b')](),'issuer':hardwareConf[_0xacaa('0x4b')]()};verifyJwt(_0x10d6cc[_0xacaa('0x3a')][_0xacaa('0x4a')],_0x3a8bd6)[_0xacaa('0x39')](function(_0x48ebdc){return db['User'][_0xacaa('0x4c')]({'where':{'id':_0x48ebdc[_0xacaa('0x4d')]}})['then'](function(_0x236e08){_0x42c1d6=_0x236e08;return db[_0xacaa('0x4e')][_0xacaa('0x35')]({'where':{'id':0x1},'attributes':[_0xacaa('0x4f'),'blockDuration'],'raw':!![]});})[_0xacaa('0x39')](function(_0x5dd92d){if(!_0x42c1d6||!_[_0xacaa('0x50')](_0x42c1d6['apiKeyNonce'],_0x48ebdc[_0xacaa('0x51')])){return _0x5ee461['status'](0x191)[_0xacaa('0x3e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x42c1d6[_0xacaa('0x52')]){return _0x5ee461[_0xacaa('0x3c')](0x191)[_0xacaa('0x3e')]({'message':_0xacaa('0x53')});}if(_0x42c1d6[_0xacaa('0x54')]){if(_0x5dd92d['blockDuration']>0x0){if(moment(_0x42c1d6['blockedAt'])[_0xacaa('0x55')](_0x5dd92d[_0xacaa('0x56')],_0xacaa('0x57'))>moment()){return _0x5ee461['status'](0x191)[_0xacaa('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5ee461['status'](0x191)[_0xacaa('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x10d6cc[_0xacaa('0x33')]={'id':_0x42c1d6['id']};_0x422f47();});})[_0xacaa('0x41')](function(){return _0x5ee461['status'](0x191)['json']({'message':_0xacaa('0x53')});});}catch(_0x222d9a){_0x422f47(_0x222d9a);}}else if(_0xe64d61){_0x422f47();}else{return _0x5ee461[_0xacaa('0x3c')](0x193)['json']({'message':_0xacaa('0x49')});}})[_0xacaa('0x32')](function(_0x277778,_0x59f18c,_0x191eb2){if(_0x277778[_0xacaa('0x33')]){db[_0xacaa('0x45')][_0xacaa('0x4c')]({'where':{'id':_0x277778[_0xacaa('0x33')]['id']},'attributes':userAttributes})[_0xacaa('0x39')](function(_0x594140){if(!_0x594140){return _0x59f18c[_0xacaa('0x3c')](0x194)[_0xacaa('0x3e')]({'message':'User\x20not\x20found.'});}_0x277778[_0xacaa('0x33')]=_0x594140;_0x191eb2();})[_0xacaa('0x41')](function(_0x26f74e){_0x191eb2(_0x26f74e);});}else if(_0xe64d61){_0x191eb2();}else{return _0x59f18c['status'](0x194)[_0xacaa('0x3e')]({'message':_0xacaa('0x58')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xacaa('0x32')](function(_0x55b580,_0x3e2bd3,_0x4aded6){return licenseUtil[_0xacaa('0x59')]()[_0xacaa('0x39')](function(_0x1cab7d){if(_0x1cab7d[_0xacaa('0x5a')]){_0x4aded6();}else{return _0x3e2bd3[_0xacaa('0x3c')](0x193)[_0xacaa('0x3e')]({'message':_0xacaa('0x5b')});}})[_0xacaa('0x41')](function(_0x4215c9){_0x4aded6(_0x4215c9);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x24ddae,_0x15946c,_0x105317){return licenseUtil[_0xacaa('0x59')]()[_0xacaa('0x39')](function(_0x3774b4){if(_0x3774b4[_0xacaa('0x5c')]){_0x105317();}else{return _0x15946c['status'](0x193)['json']({'message':_0xacaa('0x5b')});}})[_0xacaa('0x41')](function(_0x215e8d){_0x105317(_0x215e8d);});});};exports['isMiddleware']=function(_0x207904,_0x3a3130,_0x36ae33){_0x207904['isMiddleware']=!![];return _0x36ae33();};exports['signToken']=function signToken(_0x165513){return signJwt(_0x165513);};exports[_0xacaa('0x5d')]=function(_0x568796,_0x3646bf){if(!_0x568796[_0xacaa('0x33')]){return _0x3646bf[_0xacaa('0x3c')](0x194)[_0xacaa('0x3e')]({'message':_0xacaa('0x5e')});}var _0x38e202={'payload':{'id':_0x568796[_0xacaa('0x33')]['id'],'role':_0x568796[_0xacaa('0x33')][_0xacaa('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x38e202)[_0xacaa('0x39')](function(_0xdcbb04){_0x3646bf['cookie']('motion.token',_0xdcbb04);_0x3646bf[_0xacaa('0x5f')]('/dashboards/general');})[_0xacaa('0x41')](function(_0x5b9ea7){return _0x3646bf['status'](0x1f4)[_0xacaa('0x60')](_0x5b9ea7);});};exports[_0xacaa('0x61')]=function(_0x41e60d){if(_[_0xacaa('0x62')](_0x41e60d['apiKeyNonce'])||_[_0xacaa('0x62')](_0x41e60d['apiKeyIat'])){return null;}else{return createJwt(_0x41e60d);}};exports[_0xacaa('0x63')]=function(_0x5b8d72){_0x5b8d72[_0xacaa('0x64')]=generateNonce();_0x5b8d72[_0xacaa('0x65')]=generateIssuedAt();return createJwt(_0x5b8d72);};exports[_0xacaa('0x66')]=function(_0x3c5cf1,_0x12374b){var _0x2baba4=_0x3c5cf1['query'][_0xacaa('0x4a')];if(_0x2baba4){var _0x13d1d2={'nonce':_0x12374b[_0xacaa('0x64')],'iat':_0x12374b['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xacaa('0x4b')]()};return verifyJwt(_0x2baba4,_0x13d1d2)['then'](function(){return generateApiKey(_0x12374b);});}else{throw{'message':_0xacaa('0x67')};}};exports[_0xacaa('0x68')]=function(_0x51eb51){var _0x33218d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x33218d[_0xacaa('0x69')](_0x51eb51))throw new db[(_0xacaa('0x6a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x4fc4c9,_0x5929e3,_0x43aa42){var _0x2a5b41=encryptor[_0xacaa('0x6b')](_0x5929e3)['split'](',');for(var _0x143276=0x0;_0x143276<_0x43aa42;_0x143276++){if(!_0x2a5b41[_0x143276])break;if(_0x4fc4c9[_0xacaa('0x6c')]()===_0x2a5b41[_0x143276][_0xacaa('0x6c')]()){var _0x11d59b=util[_0xacaa('0x6d')](_0xacaa('0x6e'),_0x43aa42);if(_0x43aa42===0x1){_0x11d59b=_0xacaa('0x6f');}throw new db['Sequelize'][(_0xacaa('0x70'))](_0x11d59b);}}return;};exports['updatePasswordsHistory']=function(_0x12a15d,_0x33e437){var _0xe5b9e6=_0x33e437?encryptor[_0xacaa('0x6b')](_0x33e437)[_0xacaa('0x71')](','):[];if(_0xe5b9e6[_0xacaa('0x72')]===0x5){_0xe5b9e6['splice'](-0x1,0x1);}_0xe5b9e6[_0xacaa('0x73')](_0x12a15d);return encryptor[_0xacaa('0x74')](_0xe5b9e6[_0xacaa('0x75')](','));};function signJwt(_0x45edde){var _0x16724b=BPromise['promisify'](jwt[_0xacaa('0x76')],{'context':jwt});var _0x252568=_0x45edde[_0xacaa('0x77')]||config[_0xacaa('0xa')]['session'];return new BPromise(function(_0x439a98,_0x333ee5){_0x16724b(_0x45edde[_0xacaa('0x78')],_0x252568,_0x45edde[_0xacaa('0x79')])['then'](function(_0x324f62){_0x439a98(_0x324f62);})[_0xacaa('0x41')](function(_0xeb2dcb){_0x333ee5(_0xeb2dcb);});});}function verifyJwt(_0x1f175e,_0x1d93ed,_0x46bd1b){var _0x2c23d7=BPromise[_0xacaa('0x7a')](jwt[_0xacaa('0x7b')],{'context':jwt});var _0x56628f=_0x46bd1b||config['secrets']['session'];return new BPromise(function(_0x54d9bb,_0x183c8b){_0x2c23d7(_0x1f175e,_0x56628f,_0x1d93ed)['then'](function(_0xa53067){_0x54d9bb(_0xa53067);})['catch'](function(_0x6ad3){_0x183c8b(_0x6ad3);});});}function generateNonce(){return crypto[_0xacaa('0x7c')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xacaa('0x7d')](Date[_0xacaa('0x7e')]()/0x3e8)[_0xacaa('0x7f')]();}function createJwt(_0x5cf5b9){var _0x3cafae={'payload':{'iat':_0x5cf5b9[_0xacaa('0x65')],'nonce':_0x5cf5b9[_0xacaa('0x64')]},'options':{'algorithm':_0xacaa('0x80'),'subject':_0x5cf5b9['id'][_0xacaa('0x7f')](),'issuer':hardwareConf[_0xacaa('0x4b')](),'audience':hardwareConf[_0xacaa('0x4b')]()}};return signJwt(_0x3cafae)[_0xacaa('0x39')](function(_0x10797a){return{'iat':_0x5cf5b9[_0xacaa('0x65')],'nonce':_0x5cf5b9['apiKeyNonce'],'token':_0x10797a};});} \ No newline at end of file +var _0x4c56=['split','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','secrets','session','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','moment','role','name','email','userpic','md5secret','voicePause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','forceDownload','json','unmanaged','catch','headers','authorization','Basic','find','then','pass','status','startsWith','query','apikey','getUuid','User','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x4c56,0x120));var _0x64c5=function(_0x2aa6d6,_0x1dad54){_0x2aa6d6=_0x2aa6d6-0x0;var _0x3a42c8=_0x4c56[_0x2aa6d6];return _0x3a42c8;};'use strict';var db=require(_0x64c5('0x0'))['db'];var config=require(_0x64c5('0x1'));var hardwareConf=require(_0x64c5('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x64c5('0x3'));var _=require(_0x64c5('0x4'));var jwt=require(_0x64c5('0x5'));var expressJwt=require(_0x64c5('0x6'));var compose=require(_0x64c5('0x7'));var basicAuth=require(_0x64c5('0x8'));var crypto=require('crypto');var BPromise=require(_0x64c5('0x9'));var util=require('util');var moment=require(_0x64c5('0xa'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x64c5('0xb'),'fullname',_0x64c5('0xc'),'internal',_0x64c5('0xd'),_0x64c5('0xe'),'permissions',_0x64c5('0xf'),_0x64c5('0x10'),'chatPause','mailPause','faxPause',_0x64c5('0x11'),_0x64c5('0x12'),_0x64c5('0x13'),_0x64c5('0x14'),_0x64c5('0x15'),_0x64c5('0x16'),_0x64c5('0x17'),'allowmessenger',_0x64c5('0x18'),_0x64c5('0x19'),_0x64c5('0x1a'),_0x64c5('0x1b'),_0x64c5('0x1c'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x64c5('0x1d'),_0x64c5('0x1e'),'phoneBarPrefixRequired',_0x64c5('0x1f'),_0x64c5('0x20'),_0x64c5('0x21'),_0x64c5('0x22'),'userProfileId',_0x64c5('0x23'),'settingsEnabled',_0x64c5('0x24'),_0x64c5('0x25'),_0x64c5('0x26'),_0x64c5('0x27'),'ignorePauseForPreviewCalls',_0x64c5('0x28'),'chatAutoanswer','chatAutoanswerDelay',_0x64c5('0x29'),_0x64c5('0x2a'),_0x64c5('0x2b'),_0x64c5('0x2c'),_0x64c5('0x2d'),_0x64c5('0x2e'),_0x64c5('0x2f'),_0x64c5('0x30'),_0x64c5('0x31'),_0x64c5('0x32'),_0x64c5('0x33')];exports['isChatInteractionAuthorized']=function(){return this[_0x64c5('0x34')](!![])[_0x64c5('0x35')](function(_0x19ffdc,_0x4c009c,_0x278946){if(_0x19ffdc[_0x64c5('0x36')]){_0x278946();}else{return db[_0x64c5('0x37')]['findOne']({'where':{'id':_0x19ffdc[_0x64c5('0x38')]['id']},'attributes':['id',_0x64c5('0x39'),_0x64c5('0x3a')],'raw':!![]})['then'](function(_0x220e0b){if(_0x220e0b&&_0x220e0b[_0x64c5('0x39')]&&!_0x19ffdc['query'][_0x64c5('0x3b')]){return _0x4c009c['status'](_0x220e0b['disposition']==='unmanaged'?0x195:0x193)[_0x64c5('0x3c')]({'message':_0x220e0b['disposition']===_0x64c5('0x3d')?'Unmanaged.':'Forbidden.'});}else{_0x278946();}})[_0x64c5('0x3e')](function(_0x46fb1c){_0x278946(_0x46fb1c);});}});};exports[_0x64c5('0x34')]=function isAuthenticated(_0x3940bf){return compose()[_0x64c5('0x35')](function(_0x1f82f2,_0x3d9545,_0x1ac27a){var _0x4fdc8c;if(_0x1f82f2[_0x64c5('0x3f')][_0x64c5('0x40')]){if(_['startsWith'](_0x1f82f2[_0x64c5('0x3f')]['authorization'],_0x64c5('0x41'))){var _0xda970b=basicAuth(_0x1f82f2);db['User'][_0x64c5('0x42')]({'where':{'name':_0xda970b[_0x64c5('0xc')]}})[_0x64c5('0x43')](function(_0x25dd94){if(!_0x25dd94||!_0x25dd94['authenticate'](_0xda970b[_0x64c5('0x44')])){return _0x3d9545[_0x64c5('0x45')](0x191)[_0x64c5('0x3c')]({'message':'Wrong\x20credentials.'});}_0x1f82f2[_0x64c5('0x36')]={'id':_0x25dd94['id']};_0x1ac27a();})[_0x64c5('0x3e')](function(_0x4ac888){_0x1ac27a(_0x4ac888);});}else if(_[_0x64c5('0x46')](_0x1f82f2['headers'][_0x64c5('0x40')],'Bearer')){validateJwt(_0x1f82f2,_0x3d9545,_0x1ac27a);}else{if(_0x3940bf){_0x1ac27a();}else{return _0x3d9545[_0x64c5('0x45')](0x193)[_0x64c5('0x3c')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1f82f2[_0x64c5('0x47')][_0x64c5('0x48')]){try{var _0x51f0da={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x64c5('0x49')]()};verifyJwt(_0x1f82f2[_0x64c5('0x47')][_0x64c5('0x48')],_0x51f0da)[_0x64c5('0x43')](function(_0x2d8fad){return db[_0x64c5('0x4a')][_0x64c5('0x42')]({'where':{'id':_0x2d8fad[_0x64c5('0x4b')]}})['then'](function(_0x5ae776){_0x4fdc8c=_0x5ae776;return db[_0x64c5('0x4c')][_0x64c5('0x4d')]({'where':{'id':0x1},'attributes':[_0x64c5('0x4e'),_0x64c5('0x4f')],'raw':!![]});})[_0x64c5('0x43')](function(_0x297b7a){if(!_0x4fdc8c||!_[_0x64c5('0x50')](_0x4fdc8c[_0x64c5('0x51')],_0x2d8fad[_0x64c5('0x52')])){return _0x3d9545[_0x64c5('0x45')](0x191)[_0x64c5('0x3c')]({'message':_0x64c5('0x53')});}if(_0x4fdc8c[_0x64c5('0x54')]){return _0x3d9545['status'](0x191)[_0x64c5('0x3c')]({'message':_0x64c5('0x55')});}if(_0x4fdc8c[_0x64c5('0x56')]){if(_0x297b7a[_0x64c5('0x4f')]>0x0){if(moment(_0x4fdc8c[_0x64c5('0x57')])[_0x64c5('0x58')](_0x297b7a['blockDuration'],_0x64c5('0x59'))>moment()){return _0x3d9545['status'](0x191)[_0x64c5('0x3c')]({'message':_0x64c5('0x55')});}}else{return _0x3d9545[_0x64c5('0x45')](0x191)[_0x64c5('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1f82f2['user']={'id':_0x4fdc8c['id']};_0x1ac27a();});})[_0x64c5('0x3e')](function(){return _0x3d9545[_0x64c5('0x45')](0x191)[_0x64c5('0x3c')]({'message':_0x64c5('0x55')});});}catch(_0x98eadd){_0x1ac27a(_0x98eadd);}}else if(_0x3940bf){_0x1ac27a();}else{return _0x3d9545['status'](0x193)[_0x64c5('0x3c')]({'message':_0x64c5('0x5a')});}})[_0x64c5('0x35')](function(_0x24904a,_0xd72dbc,_0x1718a7){if(_0x24904a['user']){db[_0x64c5('0x4a')][_0x64c5('0x42')]({'where':{'id':_0x24904a[_0x64c5('0x36')]['id']},'attributes':userAttributes})[_0x64c5('0x43')](function(_0x27a2b9){if(!_0x27a2b9){return _0xd72dbc['status'](0x194)[_0x64c5('0x3c')]({'message':_0x64c5('0x5b')});}_0x24904a[_0x64c5('0x36')]=_0x27a2b9;_0x1718a7();})[_0x64c5('0x3e')](function(_0x95e652){_0x1718a7(_0x95e652);});}else if(_0x3940bf){_0x1718a7();}else{return _0xd72dbc[_0x64c5('0x45')](0x194)[_0x64c5('0x3c')]({'message':_0x64c5('0x5c')});}});};exports[_0x64c5('0x5d')]=function canUpdate(){return compose()[_0x64c5('0x35')](function(_0x4ad9f9,_0x48925a,_0x1de034){return licenseUtil[_0x64c5('0x5e')]()['then'](function(_0x39d0ac){if(_0x39d0ac[_0x64c5('0x5f')]){_0x1de034();}else{return _0x48925a[_0x64c5('0x45')](0x193)[_0x64c5('0x3c')]({'message':_0x64c5('0x60')});}})[_0x64c5('0x3e')](function(_0x26aa65){_0x1de034(_0x26aa65);});});};exports[_0x64c5('0x61')]=function isWebrtcLicence(){return compose()[_0x64c5('0x35')](function(_0x2bf920,_0x2dbc77,_0x1eced2){return licenseUtil['getLicense']()[_0x64c5('0x43')](function(_0x5a04cc){if(_0x5a04cc[_0x64c5('0x62')]){_0x1eced2();}else{return _0x2dbc77[_0x64c5('0x45')](0x193)[_0x64c5('0x3c')]({'message':_0x64c5('0x60')});}})[_0x64c5('0x3e')](function(_0x4f799f){_0x1eced2(_0x4f799f);});});};exports[_0x64c5('0x63')]=function(_0xd7fd94,_0x4a3b56,_0x4115df){_0xd7fd94[_0x64c5('0x63')]=!![];return _0x4115df();};exports[_0x64c5('0x64')]=function signToken(_0x171105){return signJwt(_0x171105);};exports[_0x64c5('0x65')]=function(_0x1770d1,_0x5017f5){if(!_0x1770d1[_0x64c5('0x36')]){return _0x5017f5[_0x64c5('0x45')](0x194)[_0x64c5('0x3c')]({'message':_0x64c5('0x66')});}var _0x257aaf={'payload':{'id':_0x1770d1[_0x64c5('0x36')]['id'],'role':_0x1770d1[_0x64c5('0x36')][_0x64c5('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x257aaf)[_0x64c5('0x43')](function(_0x29436c){_0x5017f5['cookie'](_0x64c5('0x67'),_0x29436c);_0x5017f5[_0x64c5('0x68')](_0x64c5('0x69'));})[_0x64c5('0x3e')](function(_0x2c78ac){return _0x5017f5[_0x64c5('0x45')](0x1f4)[_0x64c5('0x6a')](_0x2c78ac);});};exports['retrieveApiKey']=function(_0x3ebba){if(_[_0x64c5('0x6b')](_0x3ebba['apiKeyNonce'])||_['isNil'](_0x3ebba[_0x64c5('0x6c')])){return null;}else{return createJwt(_0x3ebba);}};exports[_0x64c5('0x6d')]=function(_0x1e7abf){_0x1e7abf[_0x64c5('0x51')]=generateNonce();_0x1e7abf['apiKeyIat']=generateIssuedAt();return createJwt(_0x1e7abf);};exports[_0x64c5('0x6e')]=function(_0xfbba20,_0x1e6faf){var _0x424bb6=_0xfbba20[_0x64c5('0x47')][_0x64c5('0x48')];if(_0x424bb6){var _0x4e1fcd={'nonce':_0x1e6faf[_0x64c5('0x51')],'iat':_0x1e6faf[_0x64c5('0x6c')],'audience':hardwareConf[_0x64c5('0x49')](),'issuer':hardwareConf[_0x64c5('0x49')]()};return verifyJwt(_0x424bb6,_0x4e1fcd)[_0x64c5('0x43')](function(){return generateApiKey(_0x1e6faf);});}else{throw{'message':_0x64c5('0x6f')};}};exports['validatePasswordPattern']=function(_0x5e5839){var _0x346b68=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x346b68[_0x64c5('0x70')](_0x5e5839))throw new db['Sequelize'][(_0x64c5('0x71'))](_0x64c5('0x72'));return;};exports[_0x64c5('0x73')]=function(_0x3efd25,_0x509202,_0x8205ad){var _0x54fef4=encryptor[_0x64c5('0x74')](_0x509202)[_0x64c5('0x75')](',');for(var _0x3aedfa=0x0;_0x3aedfa<_0x8205ad;_0x3aedfa++){if(!_0x54fef4[_0x3aedfa])break;if(_0x3efd25['toLowerCase']()===_0x54fef4[_0x3aedfa]['toLowerCase']()){var _0xc73f1c=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x8205ad);if(_0x8205ad===0x1){_0xc73f1c='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x64c5('0x76'))]['ValidationError'](_0xc73f1c);}}return;};exports[_0x64c5('0x77')]=function(_0x353620,_0x275f40){var _0x190624=_0x275f40?encryptor[_0x64c5('0x74')](_0x275f40)[_0x64c5('0x75')](','):[];if(_0x190624[_0x64c5('0x78')]===0x5){_0x190624[_0x64c5('0x79')](-0x1,0x1);}_0x190624[_0x64c5('0x7a')](_0x353620);return encryptor[_0x64c5('0x7b')](_0x190624[_0x64c5('0x7c')](','));};function signJwt(_0x18f67b){var _0x57ba3b=BPromise['promisify'](jwt[_0x64c5('0x7d')],{'context':jwt});var _0x539340=_0x18f67b[_0x64c5('0x7e')]||config[_0x64c5('0x7f')][_0x64c5('0x80')];return new BPromise(function(_0x1e9842,_0x468db6){_0x57ba3b(_0x18f67b['payload'],_0x539340,_0x18f67b[_0x64c5('0x81')])[_0x64c5('0x43')](function(_0x5e7d2d){_0x1e9842(_0x5e7d2d);})[_0x64c5('0x3e')](function(_0x1af682){_0x468db6(_0x1af682);});});}function verifyJwt(_0x2e033e,_0x3c98ce,_0x29b042){var _0xc9e451=BPromise['promisify'](jwt[_0x64c5('0x82')],{'context':jwt});var _0x23541e=_0x29b042||config[_0x64c5('0x7f')]['session'];return new BPromise(function(_0x1175cb,_0x2d92b3){_0xc9e451(_0x2e033e,_0x23541e,_0x3c98ce)[_0x64c5('0x43')](function(_0x1e9784){_0x1175cb(_0x1e9784);})[_0x64c5('0x3e')](function(_0x50df57){_0x2d92b3(_0x50df57);});});}function generateNonce(){return crypto[_0x64c5('0x83')](0x10)[_0x64c5('0x84')](_0x64c5('0x85'));}function generateIssuedAt(){return Math['floor'](Date[_0x64c5('0x86')]()/0x3e8)[_0x64c5('0x84')]();}function createJwt(_0x1df461){var _0x29ae57={'payload':{'iat':_0x1df461['apiKeyIat'],'nonce':_0x1df461[_0x64c5('0x51')]},'options':{'algorithm':'HS512','subject':_0x1df461['id'][_0x64c5('0x84')](),'issuer':hardwareConf[_0x64c5('0x49')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x29ae57)['then'](function(_0x43e2b9){return{'iat':_0x1df461[_0x64c5('0x6c')],'nonce':_0x1df461[_0x64c5('0x51')],'token':_0x43e2b9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 4da8e3b..aec7071 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1018=['buildContactsQuery','getFilteredContacts','rows','CmContact','keys','startsWith','cf_','map','findOne','slice','all','length','fieldType','type','catch','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter','user','clause','tags','checkListsRestrictions','tag','countFilteredContacts','count','User'];(function(_0x3e12f9,_0x549003){var _0x57852b=function(_0x31b114){while(--_0x31b114){_0x3e12f9['push'](_0x3e12f9['shift']());}};_0x57852b(++_0x549003);}(_0x1018,0x1e3));var _0x8101=function(_0x2f5d23,_0x55b4ac){_0x2f5d23=_0x2f5d23-0x0;var _0x35aa9b=_0x1018[_0x2f5d23];return _0x35aa9b;};'use strict';var _=require(_0x8101('0x0'));var sqlUtils=require(_0x8101('0x1'));var db=require(_0x8101('0x2'))['db'];exports[_0x8101('0x3')]=function(_0x39eed3,_0x4e3b73,_0x524e,_0xea95e6){var _0x45a437={'count':0x0,'rows':[]};var _0xb50504=sqlUtils[_0x8101('0x4')](_0x4e3b73,_0x39eed3);if(_0xb50504){return Promise[_0x8101('0x5')](_0x45a437);}var _0x1061d5=sqlUtils[_0x8101('0x6')]();var _0x36b613={};var _0x2415b0=![];var _0x1dd521=![];return Promise[_0x8101('0x5')]()[_0x8101('0x7')](function(){if(_0x39eed3['search']){return sqlUtils[_0x8101('0x8')](_0x39eed3['search'],_0xea95e6);}else{return sqlUtils[_0x8101('0x9')](_0x39eed3,_0xea95e6);}})['then'](function(_0xebeaa7){_0x1061d5[_0x8101('0xa')](_0xebeaa7['default']);_0x1061d5[_0x8101('0xa')](_0xebeaa7[_0x8101('0xb')]);_0x1061d5[_0x8101('0xa')](_0xebeaa7[_0x8101('0xc')]);_0x1061d5['where'](_0xebeaa7[_0x8101('0xd')][_0x8101('0xe')]);_0x36b613=_0xebeaa7[_0x8101('0xf')];_0x1dd521=_0xebeaa7[_0x8101('0xd')]['skip'];return sqlUtils[_0x8101('0x10')](_0x4e3b73,_0x39eed3,_0x1dd521);})[_0x8101('0x7')](function(_0xfe66b5){_0x1061d5[_0x8101('0xa')](_0xfe66b5);var _0x594dd8=_0x39eed3['search']?_0x36b613['ids']:_0x39eed3[_0x8101('0x11')];_0x2415b0=_0x594dd8?!![]:![];return sqlUtils[_0x8101('0x12')](_0x1061d5,_0x594dd8);})[_0x8101('0x7')](function(_0x108e78){_0x45a437[_0x8101('0x13')]=_0x108e78;if(_0x45a437[_0x8101('0x13')]===0x0){return;}if(_0x39eed3[_0x8101('0x14')]){_0x1dd521=!![];}return sqlUtils[_0x8101('0x15')](_0x1061d5,_0x39eed3['fields'],_0x524e,_0x2415b0,_0x36b613[_0x8101('0xe')],_0x1dd521);})['then'](function(_0x3c9965){if(!_0x3c9965){return[];}return sqlUtils[_0x8101('0x16')](_0x3c9965,_0x39eed3,_0x524e);})[_0x8101('0x7')](function(_0x372747){_0x45a437[_0x8101('0x17')]=_0x372747;return _0x45a437;})['catch'](function(_0x5d2ac9){throw _0x5d2ac9;});};exports['describe']=function(){var _0x3977da={};var _0x54db2f=[];return db[_0x8101('0x18')]['describe']()[_0x8101('0x7')](function(_0x1ff2da){_0x3977da=_0x1ff2da;var _0x3e2859=Object[_0x8101('0x19')](_0x3977da)[_0x8101('0xc')](function(_0x2f3303){return _[_0x8101('0x1a')](_0x2f3303,_0x8101('0x1b'))?_0x2f3303:undefined;});var _0x1ad462=_0x3e2859[_0x8101('0x1c')](function(_0x5f3781){return db['CmCustomField'][_0x8101('0x1d')]({'where':{'id':_0x5f3781[_0x8101('0x1e')](0x3)},'raw':!![]});});return Promise[_0x8101('0x1f')](_0x1ad462);})['then'](function(_0x2fbfe2){for(var _0x346fad=0x0;_0x346fad<_0x2fbfe2[_0x8101('0x20')];_0x346fad++){if(_0x2fbfe2[_0x346fad]){var _0x3a989e='cf_'+_0x2fbfe2[_0x346fad]['id'];_0x3977da[_0x3a989e][_0x8101('0x21')]=_0x2fbfe2[_0x346fad][_0x8101('0x22')];}}_0x54db2f=_[_0x8101('0x1c')](Object['keys'](_0x3977da),function(_0x38e9de){return{'name':_0x38e9de,'type':_0x3977da[_0x38e9de][_0x8101('0x22')]};});return _0x54db2f;})[_0x8101('0x23')](function(_0x346fc1){throw _0x346fc1;});}; \ No newline at end of file +var _0x1665=['countFilteredContacts','count','User','buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter','user','skip','search','ids','tag'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1665,0x11e));var _0x5166=function(_0x2e30b0,_0x3be40e){_0x2e30b0=_0x2e30b0-0x0;var _0x5167d4=_0x1665[_0x2e30b0];return _0x5167d4;};'use strict';var _=require(_0x5166('0x0'));var sqlUtils=require(_0x5166('0x1'));var db=require(_0x5166('0x2'))['db'];exports[_0x5166('0x3')]=function(_0x30eaa3,_0x3bc497,_0x12ddd9,_0x4b9efc){var _0xe1420={'count':0x0,'rows':[]};var _0x36618e=sqlUtils[_0x5166('0x4')](_0x3bc497,_0x30eaa3);if(_0x36618e){return Promise[_0x5166('0x5')](_0xe1420);}var _0x5aa582=sqlUtils[_0x5166('0x6')]();var _0x4cd461={};var _0x41d3f0=![];var _0x3ecb42=![];return Promise[_0x5166('0x5')]()[_0x5166('0x7')](function(){if(_0x30eaa3['search']){return sqlUtils[_0x5166('0x8')](_0x30eaa3['search'],_0x4b9efc);}else{return sqlUtils[_0x5166('0x9')](_0x30eaa3,_0x4b9efc);}})[_0x5166('0x7')](function(_0x269d96){_0x5aa582[_0x5166('0xa')](_0x269d96['default']);_0x5aa582[_0x5166('0xa')](_0x269d96[_0x5166('0xb')]);_0x5aa582[_0x5166('0xa')](_0x269d96[_0x5166('0xc')]);_0x5aa582[_0x5166('0xa')](_0x269d96['user']['clause']);_0x4cd461=_0x269d96['tags'];_0x3ecb42=_0x269d96[_0x5166('0xd')][_0x5166('0xe')];return sqlUtils['checkListsRestrictions'](_0x3bc497,_0x30eaa3,_0x3ecb42);})[_0x5166('0x7')](function(_0xe8203e){_0x5aa582[_0x5166('0xa')](_0xe8203e);var _0x503ff0=_0x30eaa3[_0x5166('0xf')]?_0x4cd461[_0x5166('0x10')]:_0x30eaa3[_0x5166('0x11')];_0x41d3f0=_0x503ff0?!![]:![];return sqlUtils[_0x5166('0x12')](_0x5aa582,_0x503ff0);})[_0x5166('0x7')](function(_0x535e33){_0xe1420[_0x5166('0x13')]=_0x535e33;if(_0xe1420[_0x5166('0x13')]===0x0){return;}if(_0x30eaa3[_0x5166('0x14')]){_0x3ecb42=!![];}return sqlUtils[_0x5166('0x15')](_0x5aa582,_0x30eaa3['fields'],_0x12ddd9,_0x41d3f0,_0x4cd461[_0x5166('0x16')],_0x3ecb42);})['then'](function(_0x53280c){if(!_0x53280c){return[];}return sqlUtils[_0x5166('0x17')](_0x53280c,_0x30eaa3,_0x12ddd9);})[_0x5166('0x7')](function(_0x58623c){_0xe1420[_0x5166('0x18')]=_0x58623c;return _0xe1420;})[_0x5166('0x19')](function(_0x24a6a2){throw _0x24a6a2;});};exports[_0x5166('0x1a')]=function(){var _0x39a1c2={};var _0x4bd6e7=[];return db['CmContact']['describe']()[_0x5166('0x7')](function(_0x4a3a96){_0x39a1c2=_0x4a3a96;var _0xde80d4=Object[_0x5166('0x1b')](_0x39a1c2)[_0x5166('0xc')](function(_0x288b40){return _[_0x5166('0x1c')](_0x288b40,_0x5166('0x1d'))?_0x288b40:undefined;});var _0x32c91d=_0xde80d4[_0x5166('0x1e')](function(_0x58926f){return db[_0x5166('0x1f')][_0x5166('0x20')]({'where':{'id':_0x58926f[_0x5166('0x21')](0x3)},'raw':!![]});});return Promise[_0x5166('0x22')](_0x32c91d);})[_0x5166('0x7')](function(_0x4085b0){for(var _0x2eeb3f=0x0;_0x2eeb3f<_0x4085b0[_0x5166('0x23')];_0x2eeb3f++){if(_0x4085b0[_0x2eeb3f]){var _0x32ccdd=_0x5166('0x1d')+_0x4085b0[_0x2eeb3f]['id'];_0x39a1c2[_0x32ccdd][_0x5166('0x24')]=_0x4085b0[_0x2eeb3f][_0x5166('0x25')];}}_0x4bd6e7=_[_0x5166('0x1e')](Object[_0x5166('0x1b')](_0x39a1c2),function(_0x1673b3){return{'name':_0x1673b3,'type':_0x39a1c2[_0x1673b3][_0x5166('0x25')]};});return _0x4bd6e7;})[_0x5166('0x19')](function(_0x36441b){throw _0x36441b;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index d56ca1c..05fdf01 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f30=['toString','Tags','clone','c.id','isEmpty','Sequelize','sequelize','COUNT(*)','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','fax','email','updatedAt','includes','push','forEach','TagIds','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','tags','clause','and','User','user','uc.UserId\x20=\x20?','skip','keys','map','some','compact','Contact','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','filter','resolve','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','group','limit','offset','subqry.id','having','order','DESC','findAll','color','keyBy','QueryTypes','SELECT','query'];(function(_0x195da9,_0x39f1cc){var _0x208305=function(_0x40acf7){while(--_0x40acf7){_0x195da9['push'](_0x195da9['shift']());}};_0x208305(++_0x39f1cc);}(_0x8f30,0x77));var _0x08f3=function(_0x60783a,_0x25f827){_0x60783a=_0x60783a-0x0;var _0x7ffde=_0x8f30[_0x60783a];return _0x7ffde;};'use strict';var _=require('lodash');var squel=require(_0x08f3('0x0'));var as=require(_0x08f3('0x1'));var qs=require(_0x08f3('0x2'));var utils=require(_0x08f3('0x3'));var db=require(_0x08f3('0x4'))['db'];function skipContactsQuery(_0x466e2c,_0x55b18c){var _0x203d35=![];if(_0x466e2c[_0x08f3('0x5')]===_0x08f3('0x6')&&!_0x55b18c[_0x08f3('0x7')]&&!_0x55b18c['ListId']&&_0x55b18c['autocomplete']!==_0x08f3('0x8')){_0x203d35=!![];}return _0x203d35;}function getContactsSubquery(){return squel[_0x08f3('0x9')]()[_0x08f3('0xa')](_0x08f3('0xb'),'c')[_0x08f3('0xc')](_0x08f3('0xd'));}function applyJoinClauses(_0x49075d,_0x30462a){var _0x90083b=_0x30462a?'c':_0x08f3('0xe');_0x49075d[_0x08f3('0xf')]('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x90083b+_0x08f3('0x10'))[_0x08f3('0xf')](_0x08f3('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x90083b+_0x08f3('0x10'))[_0x08f3('0xf')](_0x08f3('0x12'),'t',_0x08f3('0x13'));return _0x49075d;}function addFieldsToQuery(_0x2f1572,_0x1e6ce7,_0x52e597,_0x53b2e0,_0x4cb9f5){var _0x2a1d18=_0x4cb9f5?'c':_0x08f3('0xe');if(!_0x1e6ce7){_0x1e6ce7=['id',_0x08f3('0x14'),_0x08f3('0x15'),_0x08f3('0x16'),'mobile',_0x08f3('0x17'),_0x08f3('0x18'),'ListId','CompanyId','createdAt',_0x08f3('0x19'),'deletedAt','TagIds'];}else if(!_0x1e6ce7[_0x08f3('0x1a')]('id')){_0x1e6ce7[_0x08f3('0x1b')]('id');}var _0x269274=_0x52e597&&_0x4cb9f5||!_0x52e597&&!_0x4cb9f5;if(_0x53b2e0){_0x269274=_0x53b2e0&&_0x4cb9f5||!_0x53b2e0&&!_0x4cb9f5;}_0x1e6ce7[_0x08f3('0x1c')](function(_0x53e6e6){if(_0x53e6e6===_0x08f3('0x1d')){if(_0x269274){_0x2f1572['field'](_0x08f3('0x1e'),_0x53e6e6);}else if(_0x52e597||_0x53b2e0){_0x2f1572['field'](_0x2a1d18+'.'+_0x53e6e6);}}else{_0x2f1572[_0x08f3('0x1f')](_0x2a1d18+'.'+_0x53e6e6);}});return _0x2f1572;}function getSqlClauses(){var _0x3eb8e8={'default':squel[_0x08f3('0x20')](),'fields':squel['expr'](),'filter':squel[_0x08f3('0x20')](),'tags':{'clause':squel[_0x08f3('0x20')](),'ids':null},'user':{'clause':squel[_0x08f3('0x20')](),'skip':![]}};return _0x3eb8e8;}function parseTagParameter(_0x137b95){var _0x2f064a=squel[_0x08f3('0x20')]();if(_0x137b95){var _0x1e04ae=utils[_0x08f3('0x21')](_0x137b95);_0x1e04ae[_0x08f3('0x1c')](function(_0xd3dc26){_0x2f064a['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd3dc26+',%');});}return _0x2f064a;}function parseSearchFilter(_0x162b4a){var _0xb87d2=squel['expr']();if(_0x162b4a){var _0x280c1f=_0x162b4a['replace']('\x5c','\x5c\x5c')[_0x08f3('0x22')](/'/g,'\x27\x27');if(_0x280c1f[_0x08f3('0x23')]('\x20')[_0x08f3('0x24')]>0x1){_0xb87d2['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x08f3('0x25')](_0x280c1f,!![]),null);}else{if(qs[_0x08f3('0x26')](_0x280c1f)){_0xb87d2['or'](_0x08f3('0x27'),_0x280c1f+'%');_0xb87d2['or'](_0x08f3('0x28'),_0x280c1f+'%');_0xb87d2['or'](_0x08f3('0x29'),_0x280c1f+'%');_0xb87d2['or'](_0x08f3('0x2a'),_0x280c1f+'%');}else if(qs['isEmail'](_0x280c1f)){_0xb87d2['or'](_0x08f3('0x2b'),_0x280c1f+'%');}else{_0xb87d2['or'](_0x08f3('0x2c'),'%'+_0x280c1f+'%');_0xb87d2['or'](_0x08f3('0x2d'),'%'+_0x280c1f+'%');_0xb87d2['or']('c.email\x20LIKE\x20?','%'+_0x280c1f+'%');}}}return _0xb87d2;}function parseAdvancedSearchFilter(_0x4e2ef7,_0x4d478a){var _0x3c4f53=getSqlClauses();var _0x4d3ca1=as[_0x08f3('0x2e')](_0x4e2ef7);var _0x4d2e8d=_0x4d3ca1[_0x08f3('0x2f')];for(var _0x1b1338=0x0;_0x1b1338<_0x4d3ca1[_0x08f3('0x30')][_0x08f3('0x24')];_0x1b1338++){var _0x1b401e=_0x4d3ca1[_0x08f3('0x30')][_0x1b1338];var _0x3c20e5='c';var _0x1d23ad=_[_0x08f3('0x31')](_0x4d478a,[_0x08f3('0x32'),_0x1b401e[_0x08f3('0x1f')]]);if(_0x1d23ad){if(_0x1b401e[_0x08f3('0x1f')]===_0x08f3('0x33')||_0x1d23ad[_0x08f3('0x34')]===_0x08f3('0x35')){_0x1b401e[_0x08f3('0x36')]=_0x08f3('0x37');}var _0x55fb9e=as[_0x08f3('0x38')](_0x3c20e5,_0x1d23ad[_0x08f3('0x39')],_0x1b401e);_0x3c4f53[_0x08f3('0x3a')][_0x4d2e8d](_0x55fb9e[_0x08f3('0x3b')],_0x55fb9e[_0x08f3('0x3c')][_0x08f3('0x3d')],_0x55fb9e[_0x08f3('0x3c')][_0x08f3('0x3e')]);}else{if(_0x1b401e[_0x08f3('0x1f')]===_0x08f3('0x3f')){var _0x14c7ad=_0x1b401e['value'][_0x08f3('0x23')](',')['map'](function(_0x4b82b2){return Number(_0x4b82b2);});var _0x1f3f45=parseTagParameter(_0x14c7ad);_0x3c4f53[_0x08f3('0x40')][_0x08f3('0x41')][_0x08f3('0x42')](_0x1f3f45);_0x3c4f53[_0x08f3('0x40')]['ids']=_0x14c7ad;}else if(_0x1b401e[_0x08f3('0x1f')]===_0x08f3('0x43')){_0x3c4f53[_0x08f3('0x44')][_0x08f3('0x41')][_0x08f3('0x42')](_0x08f3('0x45'),_0x1b401e[_0x08f3('0x3c')]);_0x3c4f53[_0x08f3('0x44')][_0x08f3('0x46')]=!![];}}}return _0x3c4f53;}function parseModelFields(_0x40fced,_0x4da078){var _0x2a73de=squel[_0x08f3('0x20')]();var _0x10e030=_(_0x40fced)[_0x08f3('0x47')]()[_0x08f3('0x48')](function(_0x297098){return _[_0x08f3('0x49')](_0x4da078,['name',_0x297098])?_0x297098:undefined;})[_0x08f3('0x4a')]()[_0x08f3('0x3c')]();if(_0x40fced[_0x08f3('0x4b')]){_0x10e030[_0x08f3('0x1b')](_0x08f3('0x4b'));}if(_0x40fced[_0x08f3('0x43')]){_0x10e030[_0x08f3('0x1b')](_0x08f3('0x43'));}if(_0x10e030[_0x08f3('0x24')]>0x0){_0x10e030[_0x08f3('0x1c')](function(_0x5ef0b2){if(_0x5ef0b2===_0x08f3('0x4c')){_0x2a73de[_0x08f3('0x42')]('c.ListId\x20IN\x20?',[][_0x08f3('0x4d')](_0x40fced[_0x5ef0b2]));}else if(_0x5ef0b2==='Contact'){var _0xbb32d0='%'+_0x40fced[_0x5ef0b2]+'%';_0x2a73de[_0x08f3('0x42')](_0x08f3('0x4e'),_0xbb32d0);}else if(_0x5ef0b2===_0x08f3('0x43')){_0x2a73de[_0x08f3('0x42')](_0x08f3('0x45'),_0x40fced[_0x5ef0b2]);}else{_0x2a73de['and']('c.'+_0x5ef0b2+_0x08f3('0x4f'),_0x40fced[_0x5ef0b2]);}});}return _0x2a73de;}function parseQueryParameters(_0x1ce957,_0x30f627){var _0x4e9eb4=getSqlClauses();return Promise['resolve']()[_0x08f3('0x50')](function(){return parseModelFields(_0x1ce957,_0x30f627);})[_0x08f3('0x50')](function(_0x20e544){_0x4e9eb4[_0x08f3('0x51')][_0x08f3('0x42')](_0x20e544);return parseTagParameter(_0x1ce957[_0x08f3('0x52')]);})[_0x08f3('0x50')](function(_0x17b57f){_0x4e9eb4[_0x08f3('0x40')][_0x08f3('0x41')][_0x08f3('0x42')](_0x17b57f);return parseSearchFilter(_0x1ce957[_0x08f3('0x53')]);})['then'](function(_0x42f370){_0x4e9eb4[_0x08f3('0x53')]=_0x42f370;return _0x4e9eb4;});}function checkListsRestrictions(_0x545023,_0x260554,_0x4ebc23){var _0x68ade1=squel['expr']();return Promise[_0x08f3('0x54')]()[_0x08f3('0x50')](function(){if(_0x260554['search']&&_0x545023['role']===_0x08f3('0x6')&&!_0x4ebc23){return _0x545023[_0x08f3('0x55')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2d425a){if(_0x2d425a){if(_0x2d425a[_0x08f3('0x24')]===0x0){_0x68ade1[_0x08f3('0x42')](_0x08f3('0x56'));}else{_0x68ade1['and'](_0x08f3('0x57'),_[_0x08f3('0x48')](_0x2d425a,'id'));}}})['then'](function(){return _0x68ade1;});}function buildContactsQuery(_0x3a8ac2,_0x476486,_0x6e753f,_0x311d25,_0x327f52,_0x2e6f5e){if(_0x476486){_0x476486=_0x6e753f['attributes'];}_0x3a8ac2=addFieldsToQuery(_0x3a8ac2,_0x476486,_0x311d25,_0x2e6f5e,!![]);var _0x4c0094=squel[_0x08f3('0x9')]();_0x4c0094=addFieldsToQuery(_0x4c0094,_0x476486,_0x311d25,_0x2e6f5e,![]);if(_0x311d25||_0x2e6f5e){_0x3a8ac2=applyJoinClauses(_0x3a8ac2,!![]);_0x3a8ac2[_0x08f3('0x58')]('c.id');if(_0x6e753f[_0x08f3('0x59')]){_0x4c0094[_0x08f3('0x59')](_0x6e753f[_0x08f3('0x59')]);}if(_0x6e753f['offset']){_0x4c0094['offset'](_0x6e753f[_0x08f3('0x5a')]);}}else{_0x4c0094=applyJoinClauses(_0x4c0094,![]);_0x4c0094[_0x08f3('0x58')](_0x08f3('0x5b'));if(_0x6e753f[_0x08f3('0x59')]){_0x3a8ac2[_0x08f3('0x59')](_0x6e753f[_0x08f3('0x59')]);}if(_0x6e753f['offset']){_0x3a8ac2['offset'](_0x6e753f[_0x08f3('0x5a')]);}}_0x4c0094[_0x08f3('0x5c')](_0x327f52);if(_0x6e753f['order']){_0x6e753f[_0x08f3('0x5d')][_0x08f3('0x1c')](function(_0x53cebc){_0x3a8ac2[_0x08f3('0x5d')]('c.'+_0x53cebc[0x0],_0x53cebc[0x1]===_0x08f3('0x5e')?![]:!![]);_0x4c0094[_0x08f3('0x5d')]('subqry.'+_0x53cebc[0x0],_0x53cebc[0x1]===_0x08f3('0x5e')?![]:!![]);});}_0x4c0094[_0x08f3('0xa')](_0x3a8ac2,_0x08f3('0xe'));return _0x4c0094;}function getFilteredContacts(_0x36daba){var _0x4615fa=[];return db[_0x08f3('0x3f')][_0x08f3('0x5f')]({'attributes':['id','name',_0x08f3('0x60')],'raw':!![]})[_0x08f3('0x50')](function(_0x2ed001){_0x4615fa=_[_0x08f3('0x61')](_0x2ed001,'id');var _0x18f303={'type':db['Sequelize'][_0x08f3('0x62')][_0x08f3('0x63')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x08f3('0x64')](_0x36daba[_0x08f3('0x65')](),_0x18f303);})[_0x08f3('0x50')](function(_0xaae60){_0xaae60[_0x08f3('0x1c')](function(_0x3d68c6){if(_0x3d68c6[_0x08f3('0x1d')]){_0x3d68c6[_0x08f3('0x66')]=[];_0x3d68c6[_0x08f3('0x1d')][_0x08f3('0x23')](',')['forEach'](function(_0x55afe3){_0x3d68c6[_0x08f3('0x66')]['push'](_0x4615fa[_0x55afe3]);});}delete _0x3d68c6['TagIds'];});return _0xaae60;});}function countFilteredContacts(_0x421b2b,_0x47d110){var _0x45b85d=_0x421b2b[_0x08f3('0x67')]();_0x45b85d[_0x08f3('0x1f')]('COUNT(*)');_0x45b85d=applyJoinClauses(_0x45b85d,!![]);_0x421b2b[_0x08f3('0x58')](_0x08f3('0x68'));var _0x2dc96e=utils[_0x08f3('0x21')](_0x47d110);if(!_[_0x08f3('0x69')](_0x2dc96e)){_0x45b85d[_0x08f3('0xc')]('t.id\x20IN\x20?',_0x2dc96e);}var _0x259fcc={'type':db[_0x08f3('0x6a')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x08f3('0x6b')]['query'](_0x45b85d[_0x08f3('0x65')](),_0x259fcc)[_0x08f3('0x50')](function(_0x3f02d2){return _0x3f02d2[0x0][_0x08f3('0x6c')];});}module[_0x08f3('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xf1aa=['c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','having','order','DESC','subqry.','from','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','t.id\x20IN\x20?','query','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','search','ListId','true','select','cm_contacts','where','subqry','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','createdAt','updatedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','default','text','value','start','end','Tag','split','map','tags','clause','and','ids','User','user','keys','compact','Contact'];(function(_0x23112b,_0x59a58a){var _0x502b74=function(_0x36369c){while(--_0x36369c){_0x23112b['push'](_0x23112b['shift']());}};_0x502b74(++_0x59a58a);}(_0xf1aa,0x177));var _0xaf1a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf1aa[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xaf1a('0x0'));var squel=require(_0xaf1a('0x1'));var as=require(_0xaf1a('0x2'));var qs=require(_0xaf1a('0x3'));var utils=require('../interaction/utils');var db=require(_0xaf1a('0x4'))['db'];function skipContactsQuery(_0x4d725b,_0x36b24a){var _0x1680b5=![];if(_0x4d725b[_0xaf1a('0x5')]===_0xaf1a('0x6')&&!_0x36b24a[_0xaf1a('0x7')]&&!_0x36b24a[_0xaf1a('0x8')]&&_0x36b24a['autocomplete']!==_0xaf1a('0x9')){_0x1680b5=!![];}return _0x1680b5;}function getContactsSubquery(){return squel[_0xaf1a('0xa')]()['from'](_0xaf1a('0xb'),'c')[_0xaf1a('0xc')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x37d409,_0x21a39c){var _0x24ce47=_0x21a39c?'c':_0xaf1a('0xd');_0x37d409['left_join']('cm_user_has_contacts','uc',_0xaf1a('0xe')+_0x24ce47+_0xaf1a('0xf'))[_0xaf1a('0x10')](_0xaf1a('0x11'),'ct',_0xaf1a('0x12')+_0x24ce47+_0xaf1a('0xf'))['left_join'](_0xaf1a('0x13'),'t',_0xaf1a('0x14'));return _0x37d409;}function addFieldsToQuery(_0x153b7c,_0x341dea,_0x1c652c,_0x5a2ea9,_0x49ba91){var _0x1e8fc8=_0x49ba91?'c':_0xaf1a('0xd');if(!_0x341dea){_0x341dea=['id',_0xaf1a('0x15'),_0xaf1a('0x16'),_0xaf1a('0x17'),_0xaf1a('0x18'),_0xaf1a('0x19'),'email',_0xaf1a('0x8'),'CompanyId',_0xaf1a('0x1a'),_0xaf1a('0x1b'),'deletedAt',_0xaf1a('0x1c')];}else if(!_0x341dea[_0xaf1a('0x1d')]('id')){_0x341dea[_0xaf1a('0x1e')]('id');}var _0x1def44=_0x1c652c&&_0x49ba91||!_0x1c652c&&!_0x49ba91;if(_0x5a2ea9){_0x1def44=_0x5a2ea9&&_0x49ba91||!_0x5a2ea9&&!_0x49ba91;}_0x341dea[_0xaf1a('0x1f')](function(_0x3a5312){if(_0x3a5312===_0xaf1a('0x1c')){if(_0x1def44){_0x153b7c[_0xaf1a('0x20')](_0xaf1a('0x21'),_0x3a5312);}else if(_0x1c652c||_0x5a2ea9){_0x153b7c[_0xaf1a('0x20')](_0x1e8fc8+'.'+_0x3a5312);}}else{_0x153b7c['field'](_0x1e8fc8+'.'+_0x3a5312);}});return _0x153b7c;}function getSqlClauses(){var _0x40d52b={'default':squel[_0xaf1a('0x22')](),'fields':squel[_0xaf1a('0x22')](),'filter':squel[_0xaf1a('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xaf1a('0x22')](),'skip':![]}};return _0x40d52b;}function parseTagParameter(_0x34b6f1){var _0x101867=squel['expr']();if(_0x34b6f1){var _0x4db365=utils[_0xaf1a('0x23')](_0x34b6f1);_0x4db365['forEach'](function(_0x2a4d17){_0x101867['or'](_0xaf1a('0x24'),'%,'+_0x2a4d17+',%');});}return _0x101867;}function parseSearchFilter(_0x466e80){var _0x19e3a6=squel[_0xaf1a('0x22')]();if(_0x466e80){var _0x5301d4=_0x466e80[_0xaf1a('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x5301d4['split']('\x20')[_0xaf1a('0x26')]>0x1){_0x19e3a6['or'](_0xaf1a('0x27'),qs[_0xaf1a('0x28')](_0x5301d4,!![]),null);}else{if(qs[_0xaf1a('0x29')](_0x5301d4)){_0x19e3a6['or'](_0xaf1a('0x2a'),_0x5301d4+'%');_0x19e3a6['or'](_0xaf1a('0x2b'),_0x5301d4+'%');_0x19e3a6['or'](_0xaf1a('0x2c'),_0x5301d4+'%');_0x19e3a6['or'](_0xaf1a('0x2d'),_0x5301d4+'%');}else if(qs[_0xaf1a('0x2e')](_0x5301d4)){_0x19e3a6['or']('c.email\x20LIKE\x20?',_0x5301d4+'%');}else{_0x19e3a6['or'](_0xaf1a('0x2f'),'%'+_0x5301d4+'%');_0x19e3a6['or'](_0xaf1a('0x30'),'%'+_0x5301d4+'%');_0x19e3a6['or'](_0xaf1a('0x31'),'%'+_0x5301d4+'%');}}}return _0x19e3a6;}function parseAdvancedSearchFilter(_0x35173f,_0xf01382){var _0x4eaf1a=getSqlClauses();var _0x11eca5=as[_0xaf1a('0x32')](_0x35173f);var _0x17c4ae=_0x11eca5[_0xaf1a('0x33')];for(var _0x5d50e6=0x0;_0x5d50e6<_0x11eca5[_0xaf1a('0x34')][_0xaf1a('0x26')];_0x5d50e6++){var _0x45a28b=_0x11eca5['conditions'][_0x5d50e6];var _0xfae775='c';var _0x1e8d38=_['find'](_0xf01382,[_0xaf1a('0x35'),_0x45a28b[_0xaf1a('0x20')]]);if(_0x1e8d38){if(_0x45a28b['field']===_0xaf1a('0x36')||_0x1e8d38[_0xaf1a('0x37')]===_0xaf1a('0x38')){_0x45a28b['castTo']=_0xaf1a('0x39');}var _0xfcf5c3=as[_0xaf1a('0x3a')](_0xfae775,_0x1e8d38[_0xaf1a('0x3b')],_0x45a28b);_0x4eaf1a[_0xaf1a('0x3c')][_0x17c4ae](_0xfcf5c3[_0xaf1a('0x3d')],_0xfcf5c3[_0xaf1a('0x3e')][_0xaf1a('0x3f')],_0xfcf5c3[_0xaf1a('0x3e')][_0xaf1a('0x40')]);}else{if(_0x45a28b[_0xaf1a('0x20')]===_0xaf1a('0x41')){var _0x145982=_0x45a28b['value'][_0xaf1a('0x42')](',')[_0xaf1a('0x43')](function(_0x5142bf){return Number(_0x5142bf);});var _0x1fecc2=parseTagParameter(_0x145982);_0x4eaf1a[_0xaf1a('0x44')][_0xaf1a('0x45')][_0xaf1a('0x46')](_0x1fecc2);_0x4eaf1a[_0xaf1a('0x44')][_0xaf1a('0x47')]=_0x145982;}else if(_0x45a28b[_0xaf1a('0x20')]===_0xaf1a('0x48')){_0x4eaf1a[_0xaf1a('0x49')][_0xaf1a('0x45')][_0xaf1a('0x46')]('uc.UserId\x20=\x20?',_0x45a28b['value']);_0x4eaf1a[_0xaf1a('0x49')]['skip']=!![];}}}return _0x4eaf1a;}function parseModelFields(_0x86271d,_0x316c9a){var _0x5cde48=squel[_0xaf1a('0x22')]();var _0xbb4908=_(_0x86271d)[_0xaf1a('0x4a')]()[_0xaf1a('0x43')](function(_0x31f961){return _['some'](_0x316c9a,['name',_0x31f961])?_0x31f961:undefined;})[_0xaf1a('0x4b')]()['value']();if(_0x86271d['Contact']){_0xbb4908[_0xaf1a('0x1e')](_0xaf1a('0x4c'));}if(_0x86271d[_0xaf1a('0x48')]){_0xbb4908[_0xaf1a('0x1e')](_0xaf1a('0x48'));}if(_0xbb4908[_0xaf1a('0x26')]>0x0){_0xbb4908['forEach'](function(_0x45395e){if(_0x45395e===_0xaf1a('0x8')){_0x5cde48[_0xaf1a('0x46')](_0xaf1a('0x4d'),[][_0xaf1a('0x4e')](_0x86271d[_0x45395e]));}else if(_0x45395e===_0xaf1a('0x4c')){var _0x331319='%'+_0x86271d[_0x45395e]+'%';_0x5cde48[_0xaf1a('0x46')](_0xaf1a('0x4f'),_0x331319);}else if(_0x45395e===_0xaf1a('0x48')){_0x5cde48[_0xaf1a('0x46')](_0xaf1a('0x50'),_0x86271d[_0x45395e]);}else{_0x5cde48[_0xaf1a('0x46')]('c.'+_0x45395e+_0xaf1a('0x51'),_0x86271d[_0x45395e]);}});}return _0x5cde48;}function parseQueryParameters(_0x56f2d0,_0x50a87f){var _0x113674=getSqlClauses();return Promise[_0xaf1a('0x52')]()[_0xaf1a('0x53')](function(){return parseModelFields(_0x56f2d0,_0x50a87f);})['then'](function(_0x2a390d){_0x113674[_0xaf1a('0x54')][_0xaf1a('0x46')](_0x2a390d);return parseTagParameter(_0x56f2d0[_0xaf1a('0x55')]);})[_0xaf1a('0x53')](function(_0x49c85a){_0x113674[_0xaf1a('0x44')][_0xaf1a('0x45')][_0xaf1a('0x46')](_0x49c85a);return parseSearchFilter(_0x56f2d0[_0xaf1a('0x56')]);})[_0xaf1a('0x53')](function(_0x3d4895){_0x113674['filter']=_0x3d4895;return _0x113674;});}function checkListsRestrictions(_0x1e01f9,_0x2d2138,_0x58a29b){var _0x28b62e=squel[_0xaf1a('0x22')]();return Promise[_0xaf1a('0x52')]()[_0xaf1a('0x53')](function(){if(_0x2d2138[_0xaf1a('0x7')]&&_0x1e01f9[_0xaf1a('0x5')]===_0xaf1a('0x6')&&!_0x58a29b){return _0x1e01f9[_0xaf1a('0x57')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x162650){if(_0x162650){if(_0x162650[_0xaf1a('0x26')]===0x0){_0x28b62e[_0xaf1a('0x46')](_0xaf1a('0x58'));}else{_0x28b62e[_0xaf1a('0x46')](_0xaf1a('0x4d'),_[_0xaf1a('0x43')](_0x162650,'id'));}}})[_0xaf1a('0x53')](function(){return _0x28b62e;});}function buildContactsQuery(_0x21331c,_0x6269f7,_0x37c265,_0x2c07d8,_0x12beba,_0x57bc5f){if(_0x6269f7){_0x6269f7=_0x37c265[_0xaf1a('0x59')];}_0x21331c=addFieldsToQuery(_0x21331c,_0x6269f7,_0x2c07d8,_0x57bc5f,!![]);var _0x4cfdf3=squel[_0xaf1a('0xa')]();_0x4cfdf3=addFieldsToQuery(_0x4cfdf3,_0x6269f7,_0x2c07d8,_0x57bc5f,![]);if(_0x2c07d8||_0x57bc5f){_0x21331c=applyJoinClauses(_0x21331c,!![]);_0x21331c['group'](_0xaf1a('0x5a'));if(_0x37c265['limit']){_0x4cfdf3[_0xaf1a('0x5b')](_0x37c265[_0xaf1a('0x5b')]);}if(_0x37c265[_0xaf1a('0x5c')]){_0x4cfdf3[_0xaf1a('0x5c')](_0x37c265[_0xaf1a('0x5c')]);}}else{_0x4cfdf3=applyJoinClauses(_0x4cfdf3,![]);_0x4cfdf3[_0xaf1a('0x5d')]('subqry.id');if(_0x37c265[_0xaf1a('0x5b')]){_0x21331c[_0xaf1a('0x5b')](_0x37c265[_0xaf1a('0x5b')]);}if(_0x37c265[_0xaf1a('0x5c')]){_0x21331c[_0xaf1a('0x5c')](_0x37c265[_0xaf1a('0x5c')]);}}_0x4cfdf3[_0xaf1a('0x5e')](_0x12beba);if(_0x37c265[_0xaf1a('0x5f')]){_0x37c265[_0xaf1a('0x5f')][_0xaf1a('0x1f')](function(_0x908108){_0x21331c[_0xaf1a('0x5f')]('c.'+_0x908108[0x0],_0x908108[0x1]===_0xaf1a('0x60')?![]:!![]);_0x4cfdf3['order'](_0xaf1a('0x61')+_0x908108[0x0],_0x908108[0x1]===_0xaf1a('0x60')?![]:!![]);});}_0x4cfdf3[_0xaf1a('0x62')](_0x21331c,'subqry');return _0x4cfdf3;}function getFilteredContacts(_0xcc755d){var _0x1a57da=[];return db[_0xaf1a('0x41')]['findAll']({'attributes':['id',_0xaf1a('0x35'),_0xaf1a('0x63')],'raw':!![]})[_0xaf1a('0x53')](function(_0x5bfa15){_0x1a57da=_[_0xaf1a('0x64')](_0x5bfa15,'id');var _0x3f1e22={'type':db[_0xaf1a('0x65')][_0xaf1a('0x66')][_0xaf1a('0x67')],'model':db[_0xaf1a('0x68')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xaf1a('0x69')]['query'](_0xcc755d[_0xaf1a('0x6a')](),_0x3f1e22);})[_0xaf1a('0x53')](function(_0x51e494){_0x51e494[_0xaf1a('0x1f')](function(_0x3c388d){if(_0x3c388d[_0xaf1a('0x1c')]){_0x3c388d[_0xaf1a('0x6b')]=[];_0x3c388d[_0xaf1a('0x1c')][_0xaf1a('0x42')](',')[_0xaf1a('0x1f')](function(_0x7b50dd){_0x3c388d[_0xaf1a('0x6b')][_0xaf1a('0x1e')](_0x1a57da[_0x7b50dd]);});}delete _0x3c388d[_0xaf1a('0x1c')];});return _0x51e494;});}function countFilteredContacts(_0x41b3e2,_0x166998){var _0x2a70f2=_0x41b3e2[_0xaf1a('0x6c')]();_0x2a70f2[_0xaf1a('0x20')](_0xaf1a('0x6d'));_0x2a70f2=applyJoinClauses(_0x2a70f2,!![]);_0x41b3e2[_0xaf1a('0x5d')]('c.id');var _0xd29949=utils[_0xaf1a('0x23')](_0x166998);if(!_['isEmpty'](_0xd29949)){_0x2a70f2['where'](_0xaf1a('0x6e'),_0xd29949);}var _0x72e0e4={'type':db[_0xaf1a('0x65')][_0xaf1a('0x66')][_0xaf1a('0x67')],'raw':!![]};return db[_0xaf1a('0x69')][_0xaf1a('0x6f')](_0x2a70f2[_0xaf1a('0x6a')](),_0x72e0e4)[_0xaf1a('0x53')](function(_0x45bd63){return _0x45bd63[0x0]['COUNT(*)'];});}module[_0xaf1a('0x70')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index cc34e23..3476f87 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x625e=['base64','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','decryptFile','createDecipher','encryptString','utf8'];(function(_0x4f7366,_0x2f1d0){var _0x51dbd9=function(_0x158212){while(--_0x158212){_0x4f7366['push'](_0x4f7366['shift']());}};_0x51dbd9(++_0x2f1d0);}(_0x625e,0x85));var _0xe625=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0x625e[_0xec034];return _0x2c5a19;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xe625('0x0'));var _=require(_0xe625('0x1'));var config=require(_0xe625('0x2'));var logger=require(_0xe625('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe625('0x4')][_0xe625('0x5')],'algorithm':_0xe625('0x6')};const fileOptions={'algorithm':_0xe625('0x7')};if(config[_0xe625('0x8')]&&config[_0xe625('0x8')][_0xe625('0x9')]){var isSupported=isAlgorithmSupported(config[_0xe625('0x8')][_0xe625('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0xe625('0x8')][_0xe625('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe625('0xa')](',\x20');logger['error'](config[_0xe625('0x8')]['algorithm'],_0xe625('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x1f63be){return AES_SUPPORTED_RX[_0xe625('0xc')](_0x1f63be);}function getSupportedCiphers(){return crypto[_0xe625('0xd')]()[_0xe625('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x3ef7e8){return getSupportedCiphers()[_0xe625('0xf')](_0x3ef7e8)>-0x1;}function combineOptions(_0x3404c3){var _0x510ff0={};for(var _0x239236 in fileOptions){if(fileOptions[_0xe625('0x10')](_0x239236)){_0x510ff0[_0x239236]=fileOptions[_0x239236];}}if(_0x3404c3){for(var _0x3e670c in _0x3404c3){if(_0x3404c3[_0xe625('0x10')](_0x3e670c)){_0x510ff0[_0x3e670c]=_0x3404c3[_0x3e670c];}}}return _0x510ff0;}exports[_0xe625('0x11')]=function(_0x1d779a,_0x5af051,_0x39b9be,_0x29e741){return new BPromise(function(_0x52d7a4,_0x51b2a2){_0x29e741=combineOptions(_0x29e741);var _0x24a6d3=new Buffer(_0x39b9be);var _0x59a6ae=fs[_0xe625('0x12')](_0x1d779a);var _0x4958d8=fs[_0xe625('0x13')](_0x5af051);var _0x419b35=crypto[_0xe625('0x14')](_0x29e741['algorithm'],_0x24a6d3);_0x59a6ae['on'](_0xe625('0x15'),function(_0x1d55da){var _0x4dd098=new Buffer(_0x419b35[_0xe625('0x16')](_0x1d55da),_0xe625('0x17'));_0x4958d8[_0xe625('0x18')](_0x4dd098);});_0x59a6ae['on'](_0xe625('0x19'),function(){try{var _0x3543b8=new Buffer(_0x419b35[_0xe625('0x1a')](_0xe625('0x17')),_0xe625('0x17'));_0x4958d8[_0xe625('0x18')](_0x3543b8);_0x4958d8[_0xe625('0x19')]();_0x4958d8['on'](_0xe625('0x1b'),function(){return _0x52d7a4(_0x5af051);});}catch(_0x3d7aba){fs['unlink'](_0x5af051);return _0x51b2a2(_0x3d7aba);}});});};exports[_0xe625('0x1c')]=function(_0x1a1777,_0x3d7116,_0x12e881,_0x2dce6b){return new BPromise(function(_0x55da62,_0x16ba88){_0x2dce6b=combineOptions(_0x2dce6b);var _0x60452b=new Buffer(_0x12e881);var _0x2499d9=fs[_0xe625('0x12')](_0x1a1777);var _0x223df5=fs[_0xe625('0x13')](_0x3d7116);var _0x427173=crypto[_0xe625('0x1d')](_0x2dce6b[_0xe625('0x9')],_0x60452b);_0x2499d9['on'](_0xe625('0x15'),function(_0x4c9c62){var _0x31670e=new Buffer(_0x427173[_0xe625('0x16')](_0x4c9c62),_0xe625('0x17'));_0x223df5['write'](_0x31670e);});_0x2499d9['on'](_0xe625('0x19'),function(){try{var _0x3def85=new Buffer(_0x427173[_0xe625('0x1a')](_0xe625('0x17')),'binary');_0x223df5[_0xe625('0x18')](_0x3def85);_0x223df5[_0xe625('0x19')]();_0x223df5['on']('close',function(){return _0x55da62(_0x3d7116);});}catch(_0x6f267b){fs['unlink'](_0x3d7116);return _0x16ba88(_0x6f267b);}});});};exports[_0xe625('0x1e')]=function(_0x8a04fe,_0x3085e3,_0x1c1693){var _0xc80768=_0x1c1693||stringOptions[_0xe625('0x9')];var _0x494f10=_0x3085e3||stringOptions['secret'];var _0x84ff71=crypto[_0xe625('0x14')](_0xc80768,_0x494f10);var _0x471c69=_0x84ff71[_0xe625('0x16')](_0x8a04fe,_0xe625('0x1f'),_0xe625('0x20'));_0x471c69+=_0x84ff71[_0xe625('0x1a')](_0xe625('0x20'));return _0x471c69;};exports['decryptString']=function(_0x34b148,_0x475e1f,_0x4ea7b1){var _0x3c3dd9=_0x4ea7b1||stringOptions['algorithm'];var _0x518b2e=_0x475e1f||stringOptions['secret'];var _0x296653=crypto[_0xe625('0x1d')](_0x3c3dd9,_0x518b2e);var _0xb23bf5=_0x296653[_0xe625('0x16')](_0x34b148,_0xe625('0x20'),_0xe625('0x1f'));_0xb23bf5+=_0x296653[_0xe625('0x1a')](_0xe625('0x1f'));return _0xb23bf5;}; \ No newline at end of file +var _0xcd48=['createWriteStream','createCipher','update','write','end','final','binary','close','unlink','decryptFile','createReadStream','createDecipher','data','encryptString','utf8','base64','decryptString','secret','crypto','bluebird','../../config/environment','app','session','aes-256-ctr','aes192','encrypt','algorithm','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile'];(function(_0x5f56c8,_0x3ffe2d){var _0x344485=function(_0x3e9b17){while(--_0x3e9b17){_0x5f56c8['push'](_0x5f56c8['shift']());}};_0x344485(++_0x3ffe2d);}(_0xcd48,0xf9));var _0x8cd4=function(_0x5c4d37,_0x12e963){_0x5c4d37=_0x5c4d37-0x0;var _0x201887=_0xcd48[_0x5c4d37];return _0x201887;};'use strict';var crypto=require(_0x8cd4('0x0'));var fs=require('fs');var BPromise=require(_0x8cd4('0x1'));var _=require('lodash');var config=require(_0x8cd4('0x2'));var logger=require('../../config/logger')(_0x8cd4('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x8cd4('0x4')],'algorithm':_0x8cd4('0x5')};const fileOptions={'algorithm':_0x8cd4('0x6')};if(config[_0x8cd4('0x7')]&&config[_0x8cd4('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x8cd4('0x7')][_0x8cd4('0x8')]);if(isSupported){fileOptions[_0x8cd4('0x8')]=config[_0x8cd4('0x7')][_0x8cd4('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x8cd4('0x7')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2ca572){return AES_SUPPORTED_RX[_0x8cd4('0x9')](_0x2ca572);}function getSupportedCiphers(){return crypto[_0x8cd4('0xa')]()[_0x8cd4('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3e9322){return getSupportedCiphers()[_0x8cd4('0xc')](_0x3e9322)>-0x1;}function combineOptions(_0x3bfb40){var _0x10b7d1={};for(var _0x6a81a9 in fileOptions){if(fileOptions[_0x8cd4('0xd')](_0x6a81a9)){_0x10b7d1[_0x6a81a9]=fileOptions[_0x6a81a9];}}if(_0x3bfb40){for(var _0xf00e3e in _0x3bfb40){if(_0x3bfb40[_0x8cd4('0xd')](_0xf00e3e)){_0x10b7d1[_0xf00e3e]=_0x3bfb40[_0xf00e3e];}}}return _0x10b7d1;}exports[_0x8cd4('0xe')]=function(_0xccc99e,_0x1bc0bb,_0xcd3c2b,_0x20ee9e){return new BPromise(function(_0x409275,_0x10cd24){_0x20ee9e=combineOptions(_0x20ee9e);var _0xe430e6=new Buffer(_0xcd3c2b);var _0x324e86=fs['createReadStream'](_0xccc99e);var _0x594b92=fs[_0x8cd4('0xf')](_0x1bc0bb);var _0x46861a=crypto[_0x8cd4('0x10')](_0x20ee9e['algorithm'],_0xe430e6);_0x324e86['on']('data',function(_0xa7d382){var _0x5a3b3f=new Buffer(_0x46861a[_0x8cd4('0x11')](_0xa7d382),'binary');_0x594b92[_0x8cd4('0x12')](_0x5a3b3f);});_0x324e86['on'](_0x8cd4('0x13'),function(){try{var _0x1e9ab5=new Buffer(_0x46861a[_0x8cd4('0x14')](_0x8cd4('0x15')),'binary');_0x594b92['write'](_0x1e9ab5);_0x594b92['end']();_0x594b92['on'](_0x8cd4('0x16'),function(){return _0x409275(_0x1bc0bb);});}catch(_0x17e3e4){fs[_0x8cd4('0x17')](_0x1bc0bb);return _0x10cd24(_0x17e3e4);}});});};exports[_0x8cd4('0x18')]=function(_0x28ef2b,_0x13b374,_0x17c61a,_0x4e3e2f){return new BPromise(function(_0x2d7c77,_0x4fc5bd){_0x4e3e2f=combineOptions(_0x4e3e2f);var _0x3a99d4=new Buffer(_0x17c61a);var _0x2030dd=fs[_0x8cd4('0x19')](_0x28ef2b);var _0x128ba0=fs['createWriteStream'](_0x13b374);var _0x305134=crypto[_0x8cd4('0x1a')](_0x4e3e2f[_0x8cd4('0x8')],_0x3a99d4);_0x2030dd['on'](_0x8cd4('0x1b'),function(_0x2649d2){var _0x2caffe=new Buffer(_0x305134['update'](_0x2649d2),'binary');_0x128ba0['write'](_0x2caffe);});_0x2030dd['on'](_0x8cd4('0x13'),function(){try{var _0x5909fc=new Buffer(_0x305134['final'](_0x8cd4('0x15')),_0x8cd4('0x15'));_0x128ba0['write'](_0x5909fc);_0x128ba0[_0x8cd4('0x13')]();_0x128ba0['on'](_0x8cd4('0x16'),function(){return _0x2d7c77(_0x13b374);});}catch(_0xa481d){fs[_0x8cd4('0x17')](_0x13b374);return _0x4fc5bd(_0xa481d);}});});};exports[_0x8cd4('0x1c')]=function(_0x17383d,_0x23375d,_0xf49d17){var _0x38b7c0=_0xf49d17||stringOptions[_0x8cd4('0x8')];var _0x1c7ea3=_0x23375d||stringOptions['secret'];var _0x3ceecf=crypto[_0x8cd4('0x10')](_0x38b7c0,_0x1c7ea3);var _0x3325e3=_0x3ceecf[_0x8cd4('0x11')](_0x17383d,_0x8cd4('0x1d'),_0x8cd4('0x1e'));_0x3325e3+=_0x3ceecf['final'](_0x8cd4('0x1e'));return _0x3325e3;};exports[_0x8cd4('0x1f')]=function(_0x4d6a48,_0x21e4f6,_0x18fd75){var _0x86ec4c=_0x18fd75||stringOptions[_0x8cd4('0x8')];var _0xa8c614=_0x21e4f6||stringOptions[_0x8cd4('0x20')];var _0xc4d57=crypto['createDecipher'](_0x86ec4c,_0xa8c614);var _0x56f5bc=_0xc4d57['update'](_0x4d6a48,_0x8cd4('0x1e'),_0x8cd4('0x1d'));_0x56f5bc+=_0xc4d57[_0x8cd4('0x14')](_0x8cd4('0x1d'));return _0x56f5bc;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a5b5b8a..fe6d2d3 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc668=['Setting','find','then','splitSizeCsv','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','isInteger','forEach','push','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','mkdirSync','each','%s%d.%s','join','%s.%s','csv','zip','zip\x20finished','catch','inspect','Failed','finally','util','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0xc668,0x179));var _0x8c66=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc668[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x8c66('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0x8c66('0x1'));var fs=require('fs');var BPromise=require(_0x8c66('0x2'));var zipdir=require(_0x8c66('0x3'));var rimraf=require(_0x8c66('0x4'));var db=require(_0x8c66('0x5'))['db'];var dbH=require('../../mysqldb')[_0x8c66('0x6')];var logger=require(_0x8c66('0x7'))(_0x8c66('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x8c66('0x9')][0x2]);var QUERY=process[_0x8c66('0x9')][0x3];var PATH=process[_0x8c66('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x327f30,_0x568560){var _0x54fdb9={'status':_0x327f30};var _0x11fbb8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x568560){_0x54fdb9['savename']=_0x568560;}return db[_0x8c66('0xa')]['update'](_0x54fdb9,_0x11fbb8);}function main(){var _0x45ace5=0x1388;var _0x54e594;logger[_0x8c66('0xb')](util[_0x8c66('0xc')](_0x8c66('0xd'),EXTRACTED_REPORT_ID,_0x8c66('0xe')));return db[_0x8c66('0xf')][_0x8c66('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x8c66('0x11')](function(_0x964519){if(_0x964519){_0x54e594=_0x964519;_0x45ace5=_0x54e594[_0x8c66('0x12')]||0x1388;}})['then'](function(){return dbH[_0x8c66('0x13')]['query'](util[_0x8c66('0xc')](_0x8c66('0x14'),QUERY),{'type':dbH[_0x8c66('0x13')]['QueryTypes'][_0x8c66('0x15')]});})[_0x8c66('0x11')](function(_0x1cebd6){if(!_0x1cebd6[0x0][_0x8c66('0x16')]){return analyticExtractedReport(_0x8c66('0x17'));}var _0x57e1af=[];var _0x3879b8=0x0;if(_0x54e594[_0x8c66('0x18')]){if(_0x1cebd6&&_0x1cebd6[_0x8c66('0x19')]){var _0x426f36=_[_0x8c66('0x1a')](_0x1cebd6[0x0][_0x8c66('0x16')]/_0x45ace5);var _0xc88ef8=Number[_0x8c66('0x1b')](_0x1cebd6[0x0][_0x8c66('0x16')]/_0x45ace5)?_0x1cebd6[0x0][_0x8c66('0x16')]%_0x45ace5:0x0;_0x426f36[_0x8c66('0x1c')](function(_0x584613){if(_0x584613>0x0){_0x3879b8+=_0x45ace5;}_0x57e1af[_0x8c66('0x1d')](dbH[_0x8c66('0x13')][_0x8c66('0x1e')](util[_0x8c66('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x45ace5,_0x3879b8),{'type':dbH['sequelize'][_0x8c66('0x1f')][_0x8c66('0x15')]}));});if(_0xc88ef8>0x0){_0x3879b8+=_0x45ace5;_0x57e1af[_0x8c66('0x1d')](dbH[_0x8c66('0x13')][_0x8c66('0x1e')](util[_0x8c66('0xc')](_0x8c66('0x20'),QUERY,_0xc88ef8,_0x3879b8),{'type':dbH[_0x8c66('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x57e1af[_0x8c66('0x1d')](dbH[_0x8c66('0x13')][_0x8c66('0x1e')](QUERY,{'type':dbH[_0x8c66('0x13')][_0x8c66('0x1f')][_0x8c66('0x15')]}));}var _0x3e775c=path[_0x8c66('0x21')](PATH);var _0x1a5e14=path[_0x8c66('0x22')](PATH,_0x8c66('0x23'));var _0x59cbdc=_0x54e594[_0x8c66('0x18')]&&_0x57e1af['length']>0x1;var _0x3f9c70=[];if(!fs[_0x8c66('0x24')](path['join'](_0x3e775c,_0x1a5e14))&&_0x59cbdc){fs[_0x8c66('0x25')](path['join'](_0x3e775c,_0x1a5e14));}return BPromise[_0x8c66('0x26')](_0x57e1af,function(_0x1b7a0d){_0x3f9c70['push'](_0x1b7a0d);})[_0x8c66('0x11')](function(){for(var _0x489b2c=0x0;_0x489b2c<_0x3f9c70['length'];_0x489b2c+=0x1){var _0x45d16e;var _0x348a8b=_0x3f9c70[_0x489b2c];if(_0x59cbdc){_0x45d16e=path['join'](_0x3e775c,_0x1a5e14,util[_0x8c66('0xc')](_0x8c66('0x27'),_0x1a5e14,_0x489b2c,'csv'));}else{_0x45d16e=path[_0x8c66('0x28')](_0x3e775c,util[_0x8c66('0xc')](_0x8c66('0x29'),_0x1a5e14,_0x8c66('0x2a')));}fs['writeFileSync'](_0x45d16e,csv(_0x348a8b));}})[_0x8c66('0x11')](function(){if(_0x59cbdc){return new Promise(function(_0x1fa13d){zipdir(path[_0x8c66('0x28')](_0x3e775c,_0x1a5e14),{'saveTo':path[_0x8c66('0x28')](_0x3e775c,util[_0x8c66('0xc')](_0x8c66('0x29'),_0x1a5e14,_0x8c66('0x2b')))},function(_0x408e6f,_0x16def8){rimraf(path['join'](_0x3e775c,_0x1a5e14),function(){});_0x1fa13d(_0x8c66('0x2c'));});});}})[_0x8c66('0x11')](function(){logger[_0x8c66('0xb')](util[_0x8c66('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8c66('0xe')));return analyticExtractedReport('Completed',_0x59cbdc?util['format'](_0x8c66('0x29'),_0x1a5e14,_0x59cbdc?_0x8c66('0x2b'):_0x8c66('0x2a')):null);});})[_0x8c66('0x2d')](function(_0x3c7ab1){logger[_0x8c66('0xb')](util[_0x8c66('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8c66('0xe')),util[_0x8c66('0x2e')](_0x3c7ab1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8c66('0x2f'));})[_0x8c66('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc2c4=['info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','splitSizeCsv','then','sequelize','query','format','QueryTypes','num','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','join','mkdirSync','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update'];(function(_0x9ddbdb,_0x559bb1){var _0x7a4a74=function(_0x2a053d){while(--_0x2a053d){_0x9ddbdb['push'](_0x9ddbdb['shift']());}};_0x7a4a74(++_0x559bb1);}(_0xc2c4,0x156));var _0x4c2c=function(_0x5deff9,_0x4cb0ad){_0x5deff9=_0x5deff9-0x0;var _0x42edf6=_0xc2c4[_0x5deff9];return _0x42edf6;};'use strict';var util=require(_0x4c2c('0x0'));var path=require(_0x4c2c('0x1'));var _=require(_0x4c2c('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x4c2c('0x3'))['db'];var dbH=require(_0x4c2c('0x3'))[_0x4c2c('0x4')];var logger=require(_0x4c2c('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x4c2c('0x6')][0x2]);var QUERY=process[_0x4c2c('0x6')][0x3];var PATH=process[_0x4c2c('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5efe5d,_0x3da816){var _0x1b046d={'status':_0x5efe5d};var _0x4af717={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3da816){_0x1b046d[_0x4c2c('0x7')]=_0x3da816;}return db[_0x4c2c('0x8')][_0x4c2c('0x9')](_0x1b046d,_0x4af717);}function main(){var _0x32f7be=0x1388;var _0x150b67;logger[_0x4c2c('0xa')](util['format'](_0x4c2c('0xb'),EXTRACTED_REPORT_ID,_0x4c2c('0xc')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4c2c('0xd')]})[_0x4c2c('0xe')](function(_0x828d14){if(_0x828d14){_0x150b67=_0x828d14;_0x32f7be=_0x150b67[_0x4c2c('0xd')]||0x1388;}})[_0x4c2c('0xe')](function(){return dbH[_0x4c2c('0xf')][_0x4c2c('0x10')](util[_0x4c2c('0x11')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4c2c('0xf')][_0x4c2c('0x12')]['SELECT']});})[_0x4c2c('0xe')](function(_0x475e5){if(!_0x475e5[0x0][_0x4c2c('0x13')]){return analyticExtractedReport('Empty');}var _0x5e64b3=[];var _0x32ba17=0x0;if(_0x150b67[_0x4c2c('0x14')]){if(_0x475e5&&_0x475e5[_0x4c2c('0x15')]){var _0x4df83a=_[_0x4c2c('0x16')](_0x475e5[0x0]['num']/_0x32f7be);var _0x5ce05a=Number[_0x4c2c('0x17')](_0x475e5[0x0]['num']/_0x32f7be)?_0x475e5[0x0]['num']%_0x32f7be:0x0;_0x4df83a['forEach'](function(_0x2aac6b){if(_0x2aac6b>0x0){_0x32ba17+=_0x32f7be;}_0x5e64b3[_0x4c2c('0x18')](dbH['sequelize'][_0x4c2c('0x10')](util['format'](_0x4c2c('0x19'),QUERY,_0x32f7be,_0x32ba17),{'type':dbH[_0x4c2c('0xf')][_0x4c2c('0x12')][_0x4c2c('0x1a')]}));});if(_0x5ce05a>0x0){_0x32ba17+=_0x32f7be;_0x5e64b3[_0x4c2c('0x18')](dbH[_0x4c2c('0xf')]['query'](util[_0x4c2c('0x11')](_0x4c2c('0x19'),QUERY,_0x5ce05a,_0x32ba17),{'type':dbH[_0x4c2c('0xf')][_0x4c2c('0x12')][_0x4c2c('0x1a')]}));}}}else{_0x5e64b3[_0x4c2c('0x18')](dbH['sequelize'][_0x4c2c('0x10')](QUERY,{'type':dbH[_0x4c2c('0xf')][_0x4c2c('0x12')][_0x4c2c('0x1a')]}));}var _0x201451=path[_0x4c2c('0x1b')](PATH);var _0x1ae06e=path[_0x4c2c('0x1c')](PATH,'.csv');var _0x4b3a3b=_0x150b67['split']&&_0x5e64b3[_0x4c2c('0x15')]>0x1;var _0x5b9882=[];if(!fs['existsSync'](path[_0x4c2c('0x1d')](_0x201451,_0x1ae06e))&&_0x4b3a3b){fs[_0x4c2c('0x1e')](path[_0x4c2c('0x1d')](_0x201451,_0x1ae06e));}return BPromise['each'](_0x5e64b3,function(_0x55be25){_0x5b9882[_0x4c2c('0x18')](_0x55be25);})['then'](function(){for(var _0x22afaa=0x0;_0x22afaa<_0x5b9882[_0x4c2c('0x15')];_0x22afaa+=0x1){var _0x4b9a8d;var _0x4000c9=_0x5b9882[_0x22afaa];if(_0x4b3a3b){_0x4b9a8d=path[_0x4c2c('0x1d')](_0x201451,_0x1ae06e,util[_0x4c2c('0x11')](_0x4c2c('0x1f'),_0x1ae06e,_0x22afaa,_0x4c2c('0x20')));}else{_0x4b9a8d=path['join'](_0x201451,util[_0x4c2c('0x11')]('%s.%s',_0x1ae06e,'csv'));}fs[_0x4c2c('0x21')](_0x4b9a8d,csv(_0x4000c9));}})[_0x4c2c('0xe')](function(){if(_0x4b3a3b){return new Promise(function(_0x4a3027){zipdir(path[_0x4c2c('0x1d')](_0x201451,_0x1ae06e),{'saveTo':path[_0x4c2c('0x1d')](_0x201451,util[_0x4c2c('0x11')](_0x4c2c('0x22'),_0x1ae06e,_0x4c2c('0x23')))},function(_0x38310e,_0x8267e1){rimraf(path['join'](_0x201451,_0x1ae06e),function(){});_0x4a3027(_0x4c2c('0x24'));});});}})[_0x4c2c('0xe')](function(){logger[_0x4c2c('0xa')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x4c2c('0x25'),_0x4b3a3b?util[_0x4c2c('0x11')](_0x4c2c('0x22'),_0x1ae06e,_0x4b3a3b?'zip':_0x4c2c('0x20')):null);});})[_0x4c2c('0x26')](function(_0x1d3a3c){logger['info'](util[_0x4c2c('0x11')](_0x4c2c('0x27'),EXTRACTED_REPORT_ID,_0x4c2c('0xc')),util[_0x4c2c('0x28')](_0x1d3a3c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4c2c('0x29'));})[_0x4c2c('0x2a')](function(){process[_0x4c2c('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4dfa399..913c860 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d09=['/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','toString','value','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','flatten','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf'];(function(_0x18b181,_0x1c8dcb){var _0x167cde=function(_0xb0c662){while(--_0xb0c662){_0x18b181['push'](_0x18b181['shift']());}};_0x167cde(++_0x1c8dcb);}(_0x1d09,0x189));var _0x91d0=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x1d09[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x91d0('0x0'));var path=require(_0x91d0('0x1'));var moment=require(_0x91d0('0x2'));var htmlToPdfmake=require(_0x91d0('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x91d0('0x4'));var rimraf=require(_0x91d0('0x5'));var JSDOM=require(_0x91d0('0x6'))[_0x91d0('0x7')];var window=new JSDOM('')[_0x91d0('0x8')];var BPromise=require(_0x91d0('0x9'));var db=require(_0x91d0('0xa'))['db'];var dbH=require(_0x91d0('0xa'))[_0x91d0('0xb')];var logger=require('../../config/logger')(_0x91d0('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x91d0('0xd')][0x3];var PATH=process[_0x91d0('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x91d0('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x29e30e,_0x43bda2){var _0x4003b1={'status':_0x29e30e};var _0x4e7810={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43bda2){_0x4003b1[_0x91d0('0xf')]=_0x43bda2;}return db['AnalyticExtractedReport']['update'](_0x4003b1,_0x4e7810);}function getHeaders(_0x5e0b00){return _[_0x91d0('0x10')](_0x5e0b00,function(_0x124ace){return{'text':_0x124ace,'style':_0x91d0('0x11')};});}function getRows(_0x3444c9,_0x2cc21f){return _['map'](_0x2cc21f,function(_0x282cad){return _(_0x282cad)['pick'](_0x3444c9)[_0x91d0('0x10')](function(_0x34bb72){return _0x34bb72?_[_0x91d0('0x12')](_0x34bb72):'';})[_0x91d0('0x13')]();});}function createTable(_0xef3fe9,_0x52e1f7){var _0x345096={'widths':_['fill'](Array(_0xef3fe9[_0x91d0('0x14')]),0x91),'heights':function(_0x3a1b96){return _0x3a1b96===0x0?_0x91d0('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3f4bb7=getHeaders(_0xef3fe9);_0x345096[_0x91d0('0x16')][_0x91d0('0x17')](_0x3f4bb7);var _0x19092b=getRows(_0xef3fe9,_0x52e1f7);_0x345096['body']=_0x345096[_0x91d0('0x16')][_0x91d0('0x18')](_0x19092b);return _0x345096;}function createTables(_0x5f49b6){var _0x285395=[];var _0x4af00e=_[_0x91d0('0x19')](Object[_0x91d0('0x1a')](_0x5f49b6[0x0]),0x5);_0x4af00e[_0x91d0('0x1b')](function(_0x2189b3){_0x285395[_0x91d0('0x17')](createTable(_0x2189b3,_0x5f49b6));});return _0x285395;}function getPDFDocDefinition(_0x786b41){var _0x78f71e=util[_0x91d0('0x1c')](_0x91d0('0x1d'),NAME,EXTRACTED_REPORT[_0x91d0('0x1e')],moment(EXTRACTED_REPORT[_0x91d0('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x91d0('0x20')])[_0x91d0('0x1c')](FORMAT));var _0x2f9cd9=[];for(var _0x19f5f3=0x0;_0x19f5f3<_0x786b41[_0x91d0('0x14')];_0x19f5f3++){var _0x2bf7cb=[];if(_0x19f5f3===0x0){_0x2bf7cb[_0x91d0('0x17')]({'text':_0x78f71e,'style':_0x91d0('0x21')});}var _0x109c5a={'table':_0x786b41[_0x19f5f3]};if(_0x19f5f3>0x0){_0x109c5a[_0x91d0('0x22')]=_0x91d0('0x23');_0x109c5a[_0x91d0('0x24')]=[0x0,0x46,0x0,0x0];}_0x2bf7cb[_0x91d0('0x17')](_0x109c5a);_0x2f9cd9['push'](_0x2bf7cb);}return{'pageSize':'A4','pageOrientation':_0x91d0('0x25'),'content':_0x2f9cd9,'footer':function(_0x156460,_0x1fba00){return{'text':_0x156460[_0x91d0('0x12')]()+_0x91d0('0x26')+_0x1fba00,'style':_0x91d0('0x27')};},'defaultStyle':{'font':_0x91d0('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x91d0('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x17048b){var _0x3c60d7=0x1388;var _0x4dcfc5;if(!_0x17048b[0x0][_0x91d0('0x2a')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x91d0('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x91d0('0x2c'),_0x91d0('0x2d')]})[_0x91d0('0x2e')](function(_0x88ea03){if(_0x88ea03){_0x4dcfc5=_0x88ea03;_0x3c60d7=_0x4dcfc5[_0x91d0('0x2d')]||0x3e8;}})[_0x91d0('0x2e')](function(){var _0xefbb93=[];var _0x283763=0x0;if(_0x4dcfc5[_0x91d0('0x2c')]){if(_0x17048b&&_0x17048b[_0x91d0('0x14')]){var _0x6327=_[_0x91d0('0x2f')](_0x17048b[0x0][_0x91d0('0x2a')]/_0x3c60d7);var _0x2b7099=Number[_0x91d0('0x30')](_0x17048b[0x0][_0x91d0('0x2a')]/_0x3c60d7)?_0x17048b[0x0][_0x91d0('0x2a')]%_0x3c60d7:0x0;_0x6327[_0x91d0('0x1b')](function(_0x2881a5){if(_0x2881a5>0x0){_0x283763+=_0x3c60d7;}_0xefbb93['push'](dbH[_0x91d0('0x31')][_0x91d0('0x32')](util[_0x91d0('0x1c')](_0x91d0('0x33'),QUERY,_0x3c60d7,_0x283763),{'type':dbH[_0x91d0('0x31')][_0x91d0('0x34')][_0x91d0('0x35')]}));});if(_0x2b7099>0x0){_0x283763+=_0x3c60d7;_0xefbb93[_0x91d0('0x17')](dbH[_0x91d0('0x31')][_0x91d0('0x32')](util[_0x91d0('0x1c')](_0x91d0('0x33'),QUERY,_0x2b7099,_0x283763),{'type':dbH['sequelize'][_0x91d0('0x34')]['SELECT']}));}}}else{_0xefbb93[_0x91d0('0x17')](dbH[_0x91d0('0x31')][_0x91d0('0x32')](QUERY,{'type':dbH[_0x91d0('0x31')][_0x91d0('0x34')][_0x91d0('0x35')]}));}var _0x335312=path[_0x91d0('0x36')](PATH);var _0x376bae=path[_0x91d0('0x37')](PATH,'.pdf');var _0x266483=_0x4dcfc5[_0x91d0('0x2c')]&&_0xefbb93['length']>0x1;var _0xb350f3=[];if(!fs[_0x91d0('0x38')](path[_0x91d0('0x39')](_0x335312,_0x376bae))&&_0x266483){fs[_0x91d0('0x3a')](path['join'](_0x335312,_0x376bae));}return BPromise[_0x91d0('0x3b')](_0xefbb93,function(_0x694319){_0xb350f3[_0x91d0('0x17')](_0x694319);})[_0x91d0('0x2e')](function(){var _0x28c8a5=[];for(var _0xb261e=0x0;_0xb261e<_0xb350f3[_0x91d0('0x14')];_0xb261e+=0x1){var _0x8fd8e7=_0xb350f3[_0xb261e];var _0xfef038=createTables(_[_0x91d0('0x3c')](_0x8fd8e7));var _0x4c50dc;var _0x543b29=getPDFDocDefinition(_0xfef038);var _0x25de8f=getPDFPrinter();var _0x20ac6d=_0x25de8f['createPdfKitDocument'](_0x543b29);if(_0x266483){_0x4c50dc=path['join'](_0x335312,_0x376bae,util[_0x91d0('0x1c')]('%s%d.%s',_0x376bae,_0xb261e,_0x91d0('0x3d')));}else{_0x4c50dc=path[_0x91d0('0x39')](_0x335312,util[_0x91d0('0x1c')]('%s.%s',_0x376bae,'pdf'));}_0x28c8a5['push'](writePDFDocument(_0x20ac6d,_0x4c50dc));}return Promise[_0x91d0('0x3e')](_0x28c8a5);})[_0x91d0('0x2e')](function(){if(_0x266483){return new Promise(function(_0x42d089){zipdir(path[_0x91d0('0x39')](_0x335312,_0x376bae),{'saveTo':path['join'](_0x335312,util[_0x91d0('0x1c')](_0x91d0('0x3f'),_0x376bae,_0x91d0('0x40')))},function(){rimraf(path[_0x91d0('0x39')](_0x335312,_0x376bae),function(){});_0x42d089(_0x91d0('0x41'));});});}})[_0x91d0('0x2e')](function(){if(!_0x266483)return;rimraf(path['join'](_0x335312,_0x376bae),function(){});})['then'](function(){logger[_0x91d0('0x42')](util[_0x91d0('0x1c')](_0x91d0('0x43'),EXTRACTED_REPORT_ID,_0x91d0('0x44')));return analyticExtractedReport(_0x91d0('0x45'),_0x266483?util[_0x91d0('0x1c')](_0x91d0('0x3f'),_0x376bae,_0x266483?_0x91d0('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x91d0('0x42')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x91d0('0x44')));return db[_0x91d0('0x46')][_0x91d0('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x91d0('0x2e')](function(_0xc0f140){EXTRACTED_REPORT=_0xc0f140;return dbH[_0x91d0('0x31')]['query'](util['format'](_0x91d0('0x48'),QUERY),{'type':dbH[_0x91d0('0x31')][_0x91d0('0x34')][_0x91d0('0x35')]});})[_0x91d0('0x2e')](extractReport)[_0x91d0('0x49')](function(_0x3a2e47){logger[_0x91d0('0x42')](util[_0x91d0('0x1c')](_0x91d0('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0x91d0('0x4b')](_0x3a2e47,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x91d0('0x4c'));})[_0x91d0('0x4d')](function(){process[_0x91d0('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x11473b=new PdfPrinter({'Arial':{'normal':__dirname+_0x91d0('0x4f'),'bold':__dirname+_0x91d0('0x50'),'italics':__dirname+_0x91d0('0x51'),'bolditalics':__dirname+_0x91d0('0x52')}});return _0x11473b;}function getPDFDocDefinitionFromHTML(_0x51c74b,_0x4cdd24){var _0x5d4e44=util[_0x91d0('0x1c')]('%s\x20#%d',_0x4cdd24[_0x91d0('0x53')],_0x4cdd24[_0x91d0('0x54')]);var _0x1db57f=moment()[_0x91d0('0x1c')](_0x91d0('0x55'))[_0x91d0('0x12')]();var _0x4cdc2d=htmlToPdfmake(_0x51c74b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4cdc2d],'defaultStyle':{'font':_0x91d0('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x91d0('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x91d0('0x56')}},'header':function(){return[{'text':_0x91d0('0x57'),'style':_0x91d0('0x21')}];},'footer':function(_0xa3dc2b,_0x788182){return[{'text':util['format'](_0x91d0('0x58'),_0x5d4e44,_0xa3dc2b,_0x788182,_0x1db57f),'style':_0x91d0('0x27')}];}};}function writePDFDocument(_0x426b1a,_0x32684c){return new Promise(function(_0x35ac06,_0x459874){var _0x3c75b5=_0x426b1a[_0x91d0('0x59')](fs[_0x91d0('0x5a')](_0x32684c));_0x3c75b5['on'](_0x91d0('0x5b'),function(){_0x35ac06(_0x91d0('0x5b'));});_0x3c75b5['on'](_0x91d0('0x5c'),function(_0x205317){_0x459874(_0x205317);});_0x426b1a[_0x91d0('0x5d')]();});}exports[_0x91d0('0x5e')]=function(_0x2119aa,_0x245ea3){var _0x55b330=getPDFPrinter();var _0x4eebf9=getPDFDocDefinitionFromHTML(_0x2119aa,_0x245ea3);var _0x188818=_0x55b330['createPdfKitDocument'](_0x4eebf9);return writePDFDocument(_0x188818,_0x245ea3[_0x91d0('0x1')])[_0x91d0('0x49')](function(_0x3852e5){throw _0x3852e5;});}; \ No newline at end of file +var _0x5e09=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','mkdirSync','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','rimraf','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body','concat','chunk','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','pageBreak','margin','landscape','\x20/\x20','footer','black','Setting','find','splitSizePdf','then','split','range','num','isInteger','sequelize','query'];(function(_0x27d7b4,_0x33eda1){var _0x260e74=function(_0x26603d){while(--_0x26603d){_0x27d7b4['push'](_0x27d7b4['shift']());}};_0x260e74(++_0x33eda1);}(_0x5e09,0x1e7));var _0x95e0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5e09[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x95e0('0x0'));var fs=require('fs');var util=require(_0x95e0('0x1'));var path=require(_0x95e0('0x2'));var moment=require(_0x95e0('0x3'));var htmlToPdfmake=require(_0x95e0('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x95e0('0x5'));var JSDOM=require('jsdom')[_0x95e0('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x95e0('0x7'));var db=require(_0x95e0('0x8'))['db'];var dbH=require(_0x95e0('0x8'))[_0x95e0('0x9')];var logger=require(_0x95e0('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x95e0('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x95e0('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x95e0('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ab6c7,_0x3b2bc8){var _0x3d0c02={'status':_0x5ab6c7};var _0x2987ee={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b2bc8){_0x3d0c02[_0x95e0('0xd')]=_0x3b2bc8;}return db[_0x95e0('0xe')][_0x95e0('0xf')](_0x3d0c02,_0x2987ee);}function getHeaders(_0x1ff43a){return _[_0x95e0('0x10')](_0x1ff43a,function(_0x531fa5){return{'text':_0x531fa5,'style':'tableHeader'};});}function getRows(_0x1e12fe,_0x1eff7d){return _[_0x95e0('0x10')](_0x1eff7d,function(_0x4fc63d){return _(_0x4fc63d)[_0x95e0('0x11')](_0x1e12fe)['map'](function(_0xd157e4){return _0xd157e4?_[_0x95e0('0x12')](_0xd157e4):'';})[_0x95e0('0x13')]();});}function createTable(_0x1fcd1c,_0x25ad1e){var _0x200e41={'widths':_[_0x95e0('0x14')](Array(_0x1fcd1c[_0x95e0('0x15')]),0x91),'heights':function(_0x4e9e4e){return _0x4e9e4e===0x0?_0x95e0('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1fda8b=getHeaders(_0x1fcd1c);_0x200e41[_0x95e0('0x17')]['push'](_0x1fda8b);var _0x4821ce=getRows(_0x1fcd1c,_0x25ad1e);_0x200e41['body']=_0x200e41[_0x95e0('0x17')][_0x95e0('0x18')](_0x4821ce);return _0x200e41;}function createTables(_0x25586d){var _0x2f78e9=[];var _0x5e7ed4=_[_0x95e0('0x19')](Object['keys'](_0x25586d[0x0]),0x5);_0x5e7ed4[_0x95e0('0x1a')](function(_0x714def){_0x2f78e9[_0x95e0('0x1b')](createTable(_0x714def,_0x25586d));});return _0x2f78e9;}function getPDFDocDefinition(_0x207b7d){var _0x2af47e=util[_0x95e0('0x1c')](_0x95e0('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x95e0('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x95e0('0x1e')])[_0x95e0('0x1c')](FORMAT));var _0x58c371=[];for(var _0x8fbfdf=0x0;_0x8fbfdf<_0x207b7d[_0x95e0('0x15')];_0x8fbfdf++){var _0x15999a=[];if(_0x8fbfdf===0x0){_0x15999a[_0x95e0('0x1b')]({'text':_0x2af47e,'style':'header'});}var _0x1f682f={'table':_0x207b7d[_0x8fbfdf]};if(_0x8fbfdf>0x0){_0x1f682f[_0x95e0('0x1f')]='before';_0x1f682f[_0x95e0('0x20')]=[0x0,0x46,0x0,0x0];}_0x15999a[_0x95e0('0x1b')](_0x1f682f);_0x58c371[_0x95e0('0x1b')](_0x15999a);}return{'pageSize':'A4','pageOrientation':_0x95e0('0x21'),'content':_0x58c371,'footer':function(_0x49830f,_0x170000){return{'text':_0x49830f[_0x95e0('0x12')]()+_0x95e0('0x22')+_0x170000,'style':_0x95e0('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x95e0('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x434055){var _0x4c91f2=0x1388;var _0x43cbea;if(!_0x434055[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0x95e0('0x25')][_0x95e0('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x95e0('0x27')]})[_0x95e0('0x28')](function(_0x1d1a75){if(_0x1d1a75){_0x43cbea=_0x1d1a75;_0x4c91f2=_0x43cbea[_0x95e0('0x27')]||0x3e8;}})[_0x95e0('0x28')](function(){var _0xfd2aa3=[];var _0x2d95fc=0x0;if(_0x43cbea[_0x95e0('0x29')]){if(_0x434055&&_0x434055[_0x95e0('0x15')]){var _0x276842=_[_0x95e0('0x2a')](_0x434055[0x0][_0x95e0('0x2b')]/_0x4c91f2);var _0xa76ad8=Number[_0x95e0('0x2c')](_0x434055[0x0]['num']/_0x4c91f2)?_0x434055[0x0][_0x95e0('0x2b')]%_0x4c91f2:0x0;_0x276842[_0x95e0('0x1a')](function(_0x4318f0){if(_0x4318f0>0x0){_0x2d95fc+=_0x4c91f2;}_0xfd2aa3[_0x95e0('0x1b')](dbH[_0x95e0('0x2d')][_0x95e0('0x2e')](util[_0x95e0('0x1c')](_0x95e0('0x2f'),QUERY,_0x4c91f2,_0x2d95fc),{'type':dbH[_0x95e0('0x2d')][_0x95e0('0x30')]['SELECT']}));});if(_0xa76ad8>0x0){_0x2d95fc+=_0x4c91f2;_0xfd2aa3['push'](dbH[_0x95e0('0x2d')][_0x95e0('0x2e')](util[_0x95e0('0x1c')](_0x95e0('0x2f'),QUERY,_0xa76ad8,_0x2d95fc),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0xfd2aa3[_0x95e0('0x1b')](dbH[_0x95e0('0x2d')]['query'](QUERY,{'type':dbH[_0x95e0('0x2d')][_0x95e0('0x30')]['SELECT']}));}var _0x1292a7=path[_0x95e0('0x31')](PATH);var _0x4054dd=path[_0x95e0('0x32')](PATH,'.pdf');var _0x57a54f=_0x43cbea[_0x95e0('0x29')]&&_0xfd2aa3[_0x95e0('0x15')]>0x1;var _0x589b40=[];if(!fs[_0x95e0('0x33')](path[_0x95e0('0x34')](_0x1292a7,_0x4054dd))&&_0x57a54f){fs[_0x95e0('0x35')](path[_0x95e0('0x34')](_0x1292a7,_0x4054dd));}return BPromise['each'](_0xfd2aa3,function(_0x425c29){_0x589b40[_0x95e0('0x1b')](_0x425c29);})[_0x95e0('0x28')](function(){var _0x5cd2fb=[];for(var _0x590ba5=0x0;_0x590ba5<_0x589b40[_0x95e0('0x15')];_0x590ba5+=0x1){var _0x58c7de=_0x589b40[_0x590ba5];var _0x512375=createTables(_['flatten'](_0x58c7de));var _0x513c54;var _0xac1937=getPDFDocDefinition(_0x512375);var _0x56c7fa=getPDFPrinter();var _0x1f8434=_0x56c7fa[_0x95e0('0x36')](_0xac1937);if(_0x57a54f){_0x513c54=path[_0x95e0('0x34')](_0x1292a7,_0x4054dd,util[_0x95e0('0x1c')](_0x95e0('0x37'),_0x4054dd,_0x590ba5,_0x95e0('0x38')));}else{_0x513c54=path[_0x95e0('0x34')](_0x1292a7,util[_0x95e0('0x1c')](_0x95e0('0x39'),_0x4054dd,'pdf'));}_0x5cd2fb['push'](writePDFDocument(_0x1f8434,_0x513c54));}return Promise[_0x95e0('0x3a')](_0x5cd2fb);})[_0x95e0('0x28')](function(){if(_0x57a54f){return new Promise(function(_0x543257){zipdir(path[_0x95e0('0x34')](_0x1292a7,_0x4054dd),{'saveTo':path[_0x95e0('0x34')](_0x1292a7,util[_0x95e0('0x1c')](_0x95e0('0x39'),_0x4054dd,_0x95e0('0x3b')))},function(){rimraf(path[_0x95e0('0x34')](_0x1292a7,_0x4054dd),function(){});_0x543257(_0x95e0('0x3c'));});});}})[_0x95e0('0x28')](function(){if(!_0x57a54f)return;rimraf(path[_0x95e0('0x34')](_0x1292a7,_0x4054dd),function(){});})[_0x95e0('0x28')](function(){logger[_0x95e0('0x3d')](util['format'](_0x95e0('0x3e'),EXTRACTED_REPORT_ID,_0x95e0('0x3f')));return analyticExtractedReport(_0x95e0('0x40'),_0x57a54f?util[_0x95e0('0x1c')](_0x95e0('0x39'),_0x4054dd,_0x57a54f?_0x95e0('0x3b'):_0x95e0('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x95e0('0x1c')](_0x95e0('0x41'),EXTRACTED_REPORT_ID,_0x95e0('0x3f')));return db[_0x95e0('0xe')][_0x95e0('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x95e0('0x28')](function(_0xb40a7e){EXTRACTED_REPORT=_0xb40a7e;return dbH[_0x95e0('0x2d')][_0x95e0('0x2e')](util[_0x95e0('0x1c')](_0x95e0('0x43'),QUERY),{'type':dbH[_0x95e0('0x2d')][_0x95e0('0x30')][_0x95e0('0x44')]});})[_0x95e0('0x28')](extractReport)[_0x95e0('0x45')](function(_0x4b78e6){logger[_0x95e0('0x3d')](util['format'](_0x95e0('0x46'),EXTRACTED_REPORT_ID,_0x95e0('0x3f')),util[_0x95e0('0x47')](_0x4b78e6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x95e0('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xd51aac=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x95e0('0x49'),'italics':__dirname+_0x95e0('0x4a'),'bolditalics':__dirname+_0x95e0('0x4b')}});return _0xd51aac;}function getPDFDocDefinitionFromHTML(_0x4fff1f,_0x373981){var _0x459f1f=util[_0x95e0('0x1c')](_0x95e0('0x4c'),_0x373981['channel'],_0x373981['interactionId']);var _0x28057e=moment()[_0x95e0('0x1c')](_0x95e0('0x4d'))[_0x95e0('0x12')]();var _0x811a1f=htmlToPdfmake(_0x4fff1f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x811a1f],'defaultStyle':{'font':_0x95e0('0x4e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x95e0('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x95e0('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x95e0('0x4f')}},'header':function(){return[{'text':_0x95e0('0x50'),'style':_0x95e0('0x51')}];},'footer':function(_0xaed8eb,_0x19701b){return[{'text':util['format'](_0x95e0('0x52'),_0x459f1f,_0xaed8eb,_0x19701b,_0x28057e),'style':_0x95e0('0x23')}];}};}function writePDFDocument(_0x3efb31,_0x4af492){return new Promise(function(_0x44af04,_0x2ceebd){var _0x254f96=_0x3efb31[_0x95e0('0x53')](fs[_0x95e0('0x54')](_0x4af492));_0x254f96['on'](_0x95e0('0x55'),function(){_0x44af04(_0x95e0('0x55'));});_0x254f96['on'](_0x95e0('0x56'),function(_0x155eb0){_0x2ceebd(_0x155eb0);});_0x3efb31[_0x95e0('0x57')]();});}exports[_0x95e0('0x58')]=function(_0x5ab3e6,_0x58977){var _0x5b3ad0=getPDFPrinter();var _0x3e441c=getPDFDocDefinitionFromHTML(_0x5ab3e6,_0x58977);var _0x3893bf=_0x5b3ad0[_0x95e0('0x36')](_0x3e441c);return writePDFDocument(_0x3893bf,_0x58977['path'])[_0x95e0('0x45')](function(_0x21afc1){throw _0x21afc1;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 828f454..687be29 100644 --- a/server/components/export/xlsx.js +++ b/server/components/export/xlsx.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc17f=['AnalyticExtractedReport','info','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','existsSync','join','mkdirSync','%s%d.%s','xlsx','binary','%s.%s','zip\x20finished','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','dbH','analytics','argv','savename'];(function(_0x16bd3a,_0x4554bf){var _0x37923c=function(_0x5469cf){while(--_0x5469cf){_0x16bd3a['push'](_0x16bd3a['shift']());}};_0x37923c(++_0x4554bf);}(_0xc17f,0xae));var _0xfc17=function(_0x2f366d,_0x345d21){_0x2f366d=_0x2f366d-0x0;var _0x2c6a16=_0xc17f[_0x2f366d];return _0x2c6a16;};'use strict';var util=require(_0xfc17('0x0'));var path=require(_0xfc17('0x1'));var _=require(_0xfc17('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xfc17('0x3'));var zipdir=require(_0xfc17('0x4'));var rimraf=require(_0xfc17('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xfc17('0x6')];var logger=require('../../config/logger')(_0xfc17('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xfc17('0x8')][0x2]);var QUERY=process[_0xfc17('0x8')][0x3];var PATH=process[_0xfc17('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x13598a,_0x308878){var _0x497448={'status':_0x13598a};var _0x45ac9a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x308878){_0x497448[_0xfc17('0x9')]=_0x308878;}return db[_0xfc17('0xa')]['update'](_0x497448,_0x45ac9a);}function main(){var _0xa2f23b=0x1388;var _0x40e7a9;logger[_0xfc17('0xb')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xfc17('0xc')));return db[_0xfc17('0xd')][_0xfc17('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfc17('0xf'),_0xfc17('0x10')]})[_0xfc17('0x11')](function(_0x411880){if(_0x411880){_0x40e7a9=_0x411880;_0xa2f23b=_0x40e7a9[_0xfc17('0x10')]||0x1388;}})['then'](function(){return dbH[_0xfc17('0x12')]['query'](util[_0xfc17('0x13')](_0xfc17('0x14'),QUERY),{'type':dbH['sequelize'][_0xfc17('0x15')][_0xfc17('0x16')]});})[_0xfc17('0x11')](function(_0x1b958b){if(!_0x1b958b[0x0][_0xfc17('0x17')]){return analyticExtractedReport(_0xfc17('0x18'));}var _0x267704=[];var _0x21a3bc=0x0;if(_0x40e7a9[_0xfc17('0xf')]){if(_0x1b958b&&_0x1b958b[_0xfc17('0x19')]){var _0x19c2f6=_[_0xfc17('0x1a')](_0x1b958b[0x0]['num']/_0xa2f23b);var _0x4ed1e0=Number['isInteger'](_0x1b958b[0x0][_0xfc17('0x17')]/_0xa2f23b)?_0x1b958b[0x0][_0xfc17('0x17')]%_0xa2f23b:0x0;_0x19c2f6[_0xfc17('0x1b')](function(_0x5e9f7d){if(_0x5e9f7d>0x0){_0x21a3bc+=_0xa2f23b;}_0x267704[_0xfc17('0x1c')](dbH[_0xfc17('0x12')][_0xfc17('0x1d')](util[_0xfc17('0x13')](_0xfc17('0x1e'),QUERY,_0xa2f23b,_0x21a3bc),{'type':dbH[_0xfc17('0x12')][_0xfc17('0x15')][_0xfc17('0x16')]}));});if(_0x4ed1e0>0x0){_0x21a3bc+=_0xa2f23b;_0x267704[_0xfc17('0x1c')](dbH[_0xfc17('0x12')][_0xfc17('0x1d')](util['format'](_0xfc17('0x1e'),QUERY,_0x4ed1e0,_0x21a3bc),{'type':dbH[_0xfc17('0x12')][_0xfc17('0x15')][_0xfc17('0x16')]}));}}}else{_0x267704[_0xfc17('0x1c')](dbH[_0xfc17('0x12')]['query'](QUERY,{'type':dbH[_0xfc17('0x12')]['QueryTypes']['SELECT']}));}var _0x2d5909=path[_0xfc17('0x1f')](PATH);var _0x38767d=path['basename'](PATH,'.xlsx');var _0x34a8d7=_0x40e7a9['split']&&_0x267704['length']>0x1;var _0xd25fd3=[];if(!fs[_0xfc17('0x20')](path[_0xfc17('0x21')](_0x2d5909,_0x38767d))&&_0x34a8d7){fs[_0xfc17('0x22')](path[_0xfc17('0x21')](_0x2d5909,_0x38767d));}return BPromise['each'](_0x267704,function(_0x6d5265){_0xd25fd3[_0xfc17('0x1c')](_0x6d5265);})[_0xfc17('0x11')](function(){for(var _0x3c9dda=0x0;_0x3c9dda<_0xd25fd3[_0xfc17('0x19')];_0x3c9dda+=0x1){var _0x1a474d;var _0x45dcab=_0xd25fd3[_0x3c9dda];if(_0x34a8d7){_0x1a474d=path[_0xfc17('0x21')](_0x2d5909,_0x38767d,util['format'](_0xfc17('0x23'),_0x38767d,_0x3c9dda,_0xfc17('0x24')));}else{_0x1a474d=path[_0xfc17('0x21')](_0x2d5909,util[_0xfc17('0x13')]('%s.%s',_0x38767d,_0xfc17('0x24')));}fs['writeFileSync'](_0x1a474d,json2xls(_0x45dcab),_0xfc17('0x25'));}})[_0xfc17('0x11')](function(){if(_0x34a8d7){return new Promise(function(_0x3f3cf1){zipdir(path[_0xfc17('0x21')](_0x2d5909,_0x38767d),{'saveTo':path[_0xfc17('0x21')](_0x2d5909,util[_0xfc17('0x13')](_0xfc17('0x26'),_0x38767d,'zip'))},function(_0x1f888a,_0x50b71c){rimraf(path[_0xfc17('0x21')](_0x2d5909,_0x38767d),function(){});_0x3f3cf1(_0xfc17('0x27'));});});}})[_0xfc17('0x11')](function(){logger[_0xfc17('0xb')](util[_0xfc17('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfc17('0xc')));return analyticExtractedReport('Completed',_0x34a8d7?util['format'](_0xfc17('0x26'),_0x38767d,_0x34a8d7?_0xfc17('0x28'):_0xfc17('0x24')):null);});})[_0xfc17('0x29')](function(_0x464d52){logger[_0xfc17('0xb')](util[_0xfc17('0x13')](_0xfc17('0x2a'),EXTRACTED_REPORT_ID,_0xfc17('0xc')),util[_0xfc17('0x2b')](_0x464d52,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xfc17('0x2c')](function(){process[_0xfc17('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9861=['basename','.xlsx','mkdirSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','inspect','Failed','util','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','split','length','range','isInteger','forEach','push','SELECT','dirname'];(function(_0x4ab830,_0x19070b){var _0x3f3b64=function(_0x128551){while(--_0x128551){_0x4ab830['push'](_0x4ab830['shift']());}};_0x3f3b64(++_0x19070b);}(_0x9861,0x176));var _0x1986=function(_0x35ab3d,_0x3e5d0a){_0x35ab3d=_0x35ab3d-0x0;var _0x3d0a80=_0x9861[_0x35ab3d];return _0x3d0a80;};'use strict';var util=require(_0x1986('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x1986('0x1'));var BPromise=require(_0x1986('0x2'));var zipdir=require(_0x1986('0x3'));var rimraf=require(_0x1986('0x4'));var db=require(_0x1986('0x5'))['db'];var dbH=require(_0x1986('0x5'))['dbH'];var logger=require(_0x1986('0x6'))(_0x1986('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1986('0x8')][0x2]);var QUERY=process[_0x1986('0x8')][0x3];var PATH=process[_0x1986('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc5e066,_0x412444){var _0x4150da={'status':_0xc5e066};var _0x2bd40f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x412444){_0x4150da[_0x1986('0x9')]=_0x412444;}return db['AnalyticExtractedReport'][_0x1986('0xa')](_0x4150da,_0x2bd40f);}function main(){var _0x1578f9=0x1388;var _0x66f64d;logger[_0x1986('0xb')](util['format'](_0x1986('0xc'),EXTRACTED_REPORT_ID,_0x1986('0xd')));return db['Setting'][_0x1986('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0x1986('0xf')](function(_0x1f49f6){if(_0x1f49f6){_0x66f64d=_0x1f49f6;_0x1578f9=_0x66f64d[_0x1986('0x10')]||0x1388;}})[_0x1986('0xf')](function(){return dbH[_0x1986('0x11')][_0x1986('0x12')](util[_0x1986('0x13')](_0x1986('0x14'),QUERY),{'type':dbH[_0x1986('0x11')][_0x1986('0x15')]['SELECT']});})['then'](function(_0x12984d){if(!_0x12984d[0x0][_0x1986('0x16')]){return analyticExtractedReport('Empty');}var _0x3b4244=[];var _0xf4c7bc=0x0;if(_0x66f64d[_0x1986('0x17')]){if(_0x12984d&&_0x12984d[_0x1986('0x18')]){var _0x306a43=_[_0x1986('0x19')](_0x12984d[0x0][_0x1986('0x16')]/_0x1578f9);var _0x15f7b9=Number[_0x1986('0x1a')](_0x12984d[0x0][_0x1986('0x16')]/_0x1578f9)?_0x12984d[0x0][_0x1986('0x16')]%_0x1578f9:0x0;_0x306a43[_0x1986('0x1b')](function(_0xae8d94){if(_0xae8d94>0x0){_0xf4c7bc+=_0x1578f9;}_0x3b4244[_0x1986('0x1c')](dbH['sequelize'][_0x1986('0x12')](util[_0x1986('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1578f9,_0xf4c7bc),{'type':dbH[_0x1986('0x11')][_0x1986('0x15')]['SELECT']}));});if(_0x15f7b9>0x0){_0xf4c7bc+=_0x1578f9;_0x3b4244['push'](dbH[_0x1986('0x11')][_0x1986('0x12')](util[_0x1986('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x15f7b9,_0xf4c7bc),{'type':dbH[_0x1986('0x11')][_0x1986('0x15')][_0x1986('0x1d')]}));}}}else{_0x3b4244['push'](dbH[_0x1986('0x11')][_0x1986('0x12')](QUERY,{'type':dbH[_0x1986('0x11')][_0x1986('0x15')][_0x1986('0x1d')]}));}var _0x502488=path[_0x1986('0x1e')](PATH);var _0x518f3c=path[_0x1986('0x1f')](PATH,_0x1986('0x20'));var _0x5873eb=_0x66f64d[_0x1986('0x17')]&&_0x3b4244[_0x1986('0x18')]>0x1;var _0x3b8f25=[];if(!fs['existsSync'](path['join'](_0x502488,_0x518f3c))&&_0x5873eb){fs[_0x1986('0x21')](path[_0x1986('0x22')](_0x502488,_0x518f3c));}return BPromise['each'](_0x3b4244,function(_0x2ff2c9){_0x3b8f25[_0x1986('0x1c')](_0x2ff2c9);})[_0x1986('0xf')](function(){for(var _0x455937=0x0;_0x455937<_0x3b8f25['length'];_0x455937+=0x1){var _0x39796d;var _0xd74e09=_0x3b8f25[_0x455937];if(_0x5873eb){_0x39796d=path[_0x1986('0x22')](_0x502488,_0x518f3c,util['format'](_0x1986('0x23'),_0x518f3c,_0x455937,_0x1986('0x24')));}else{_0x39796d=path[_0x1986('0x22')](_0x502488,util[_0x1986('0x13')](_0x1986('0x25'),_0x518f3c,_0x1986('0x24')));}fs[_0x1986('0x26')](_0x39796d,json2xls(_0xd74e09),'binary');}})[_0x1986('0xf')](function(){if(_0x5873eb){return new Promise(function(_0x3412e4){zipdir(path[_0x1986('0x22')](_0x502488,_0x518f3c),{'saveTo':path['join'](_0x502488,util[_0x1986('0x13')](_0x1986('0x25'),_0x518f3c,'zip'))},function(_0x5f0f66,_0x1f7eae){rimraf(path[_0x1986('0x22')](_0x502488,_0x518f3c),function(){});_0x3412e4(_0x1986('0x27'));});});}})[_0x1986('0xf')](function(){logger['info'](util['format'](_0x1986('0x28'),EXTRACTED_REPORT_ID,_0x1986('0xd')));return analyticExtractedReport('Completed',_0x5873eb?util['format'](_0x1986('0x25'),_0x518f3c,_0x5873eb?_0x1986('0x29'):'xlsx'):null);});})[_0x1986('0x2a')](function(_0x5f7333){logger[_0x1986('0xb')](util[_0x1986('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1986('0xd')),util[_0x1986('0x2b')](_0x5f7333,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1986('0x2c'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 18398b1..0daa135 100644 --- a/server/components/extensions/rewrite.js +++ b/server/components/extensions/rewrite.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cc9=['catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','groupBy','exten','playback','priority','extensions','extension','find','push','type','CDR(type)=%s','context','VoiceExtensionId','inbound','Set','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','IntervalId','tag','CDR(tag)=','hasOwnProperty','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy'];(function(_0x3e10a0,_0x52ba11){var _0x3f7635=function(_0x4bdd65){while(--_0x4bdd65){_0x3e10a0['push'](_0x3e10a0['shift']());}};_0x3f7635(++_0x52ba11);}(_0x2cc9,0x1b3));var _0x92cc=function(_0x1d6319,_0x246901){_0x1d6319=_0x1d6319-0x0;var _0x4e07a6=_0x2cc9[_0x1d6319];return _0x4e07a6;};'use strict';var _=require(_0x92cc('0x0'));var util=require(_0x92cc('0x1'));function rewrite(_0x4a985e,_0xe80eea){var _0x4095dd=this;return _0x4a985e[_0x92cc('0x2')][_0x92cc('0x3')]['findAll']({'raw':!![]})[_0x92cc('0x4')](function(_0x59087c){_0x4095dd[_0x92cc('0x5')]=_0x59087c;return _0x4a985e[_0x92cc('0x2')][_0x92cc('0x6')][_0x92cc('0x7')]({'where':{'IntervalId':_0xe80eea['IntervalId']},'raw':!![]});})[_0x92cc('0x4')](function(_0x3f9564){return _0x4a985e[_0x92cc('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x92cc('0x8')](_[_0x92cc('0x9')](_0x3f9564,'exten'))}},'order':[{'raw':_0x92cc('0xa')}],'raw':!![]});})[_0x92cc('0x4')](function(_0x419de9){var _0x2b22a0=_['filter'](_0x419de9,{'priority':'1'});var _0x384f73=_['filter'](_0x419de9,{'isApp':0x1});var _0xefbdf1=_[_0x92cc('0xb')](_0x384f73,_0x92cc('0xc'));var _0x581db3=['queue',_0x92cc('0xd')];var _0x217fa8=[];var _0x213368=[];for(var _0x3704fa in _0xefbdf1){if(_0xefbdf1['hasOwnProperty'](_0x3704fa)){_0x4095dd[_0x92cc('0xe')]=0x2;_0x4095dd[_0x92cc('0xf')]=[];_0x4095dd[_0x92cc('0x10')]=_[_0x92cc('0x11')](_0x2b22a0,{'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')]});_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':'Set','appdata':util['format'](_0x92cc('0x14'),_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')]),'context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0x4095dd[_0x92cc('0xe')]++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});if(_0xefbdf1[_0x3704fa][0x0]['type']===_0x92cc('0x17')){_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':'CDR(routeid)='+_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')],'context':_0xefbdf1[_0x3704fa][0x0]['context'],'exten':_0xefbdf1[_0x3704fa][0x0]['exten'],'priority':_0x4095dd[_0x92cc('0xe')]++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});}else if(_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')]===_0x92cc('0x19')){if(_0x4095dd['extension']){_0x4095dd['extensions'][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':_0x92cc('0x1a')+(_0x4095dd[_0x92cc('0x10')][_0x92cc('0x1b')]?_0x92cc('0x1c')+_0x4095dd[_0x92cc('0x10')]['cutdigits']+'}':_0x92cc('0x1d')),'context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0x4095dd[_0x92cc('0xe')]++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});}_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':'CDR(routeid)='+_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')],'context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0x4095dd[_0x92cc('0xe')]++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0]['VoiceExtensionId']});var _0xef14d9=_0x4095dd[_0x92cc('0xe')]++;_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':'ExecIf','appdata':_0x92cc('0x1e')+(_0xef14d9+0x2)+_0x92cc('0x1f')+(_0xef14d9+0x1)+')','context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0xef14d9,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});if(_0x4095dd[_0x92cc('0x10')]){_0x4095dd[_0x92cc('0xf')]['push']({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':_0x4095dd[_0x92cc('0x10')][_0x92cc('0x1b')]?_0x92cc('0x20')+_0x4095dd['extension']['cutdigits']+'}':_0x92cc('0x21'),'context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0]['exten'],'priority':_0x4095dd[_0x92cc('0xe')]++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});}_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':'Set','appdata':_0x92cc('0x22')+_0xefbdf1[_0x3704fa][0x0]['VoiceExtensionId'],'context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0x4095dd['priority']++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});if(_0x4095dd['extension']&&_0x4095dd['extension']['hasOwnProperty'](_0x92cc('0x23'))&&_0x4095dd[_0x92cc('0x10')][_0x92cc('0x23')]!==_0x92cc('0x24')){_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0x4095dd['priority']++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':_0x92cc('0x25')+_0x4095dd[_0x92cc('0x10')][_0x92cc('0x23')]||_0x92cc('0x26'),'context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0]['exten'],'priority':_0x4095dd['priority']++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});}}_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':_0x92cc('0x27'),'context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0x4095dd[_0x92cc('0xe')]++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x15')],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0x4095dd[_0x92cc('0xe')]++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':_0x92cc('0x28'),'context':_0xefbdf1[_0x3704fa][0x0]['context'],'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'priority':_0x4095dd[_0x92cc('0xe')]++,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});for(var _0x48f7a1=0x0,_0x48c04c=0x0;_0x48f7a1<_0xefbdf1[_0x3704fa][_0x92cc('0x29')];_0x48f7a1+=0x1,_0x48c04c=0x0){var _0x1ece77=_0xefbdf1[_0x3704fa][_0x48f7a1];if(_0x1ece77[_0x92cc('0x13')]){_0x1ece77[_0x92cc('0x13')]=_0x1ece77[_0x92cc('0x13')][_0x92cc('0x2a')]();}var _0x5b5f8d=[];var _0xc1141b=[];delete _0x1ece77['id'];delete _0x1ece77[_0x92cc('0x2b')];delete _0x1ece77[_0x92cc('0x2c')];var _0x19e220=_0x1ece77[_0x92cc('0x2d')]!=='*,*,*,*'?[_0x1ece77[_0x92cc('0x2d')]]:_0x1ece77[_0x92cc('0x2e')]?_[_0x92cc('0x9')](_['filter'](_0x4095dd[_0x92cc('0x5')],{'IntervalId':_0x1ece77[_0x92cc('0x2e')]}),_0x92cc('0x2d')):[];if(_0x1ece77['hasOwnProperty'](_0x92cc('0x2f'))){if(_0x1ece77[_0x92cc('0x2f')]&&_0x1ece77[_0x92cc('0x2f')]!=='--'){_0x5b5f8d[_0x92cc('0x12')]({'type':_0x1ece77[_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':_0x92cc('0x30')+_0x1ece77['tag'],'context':_0x1ece77[_0x92cc('0x15')],'exten':_0x1ece77[_0x92cc('0xc')],'priority':_0x19e220[_0x92cc('0x29')]+_0x4095dd['priority']+_0x48c04c++,'VoiceExtensionId':_0x1ece77[_0x92cc('0x16')]});}}if(_0x1ece77[_0x92cc('0x13')]===_0x92cc('0x19')&&_0x1ece77[_0x92cc('0x31')](_0x92cc('0x32'))){if(_0x1ece77[_0x92cc('0x32')]){_0x5b5f8d['push']({'type':_0x1ece77[_0x92cc('0x13')],'app':_0x92cc('0x33'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x1ece77[_0x92cc('0x32')]+')','context':_0x1ece77[_0x92cc('0x15')],'exten':_0x1ece77[_0x92cc('0xc')],'priority':_0x19e220[_0x92cc('0x29')]+_0x4095dd[_0x92cc('0xe')]+_0x48c04c++,'VoiceExtensionId':_0x1ece77[_0x92cc('0x16')]});}else{_0x5b5f8d[_0x92cc('0x12')]({'type':_0x1ece77['type'],'app':_0x92cc('0x33'),'appdata':_0x92cc('0x34'),'context':_0x1ece77['context'],'exten':_0x1ece77['exten'],'priority':_0x19e220[_0x92cc('0x29')]+_0x4095dd['priority']+_0x48c04c++,'VoiceExtensionId':_0x1ece77[_0x92cc('0x16')]});}}if(_0x1ece77[_0x92cc('0x31')](_0x92cc('0x35'))){if(_0x581db3['indexOf'](_0x1ece77['app'][_0x92cc('0x2a')]())>=0x0&&_0x1ece77[_0x92cc('0x36')]!==_0x92cc('0x37')){if(_0x1ece77['answer']){_0x5b5f8d[_0x92cc('0x12')]({'type':_0x1ece77[_0x92cc('0x13')],'app':_0x92cc('0x33'),'appdata':_0x92cc('0x38'),'context':_0x1ece77['context'],'exten':_0x1ece77[_0x92cc('0xc')],'priority':_0x19e220[_0x92cc('0x29')]+_0x4095dd[_0x92cc('0xe')]+_0x48c04c++,'VoiceExtensionId':_0x1ece77['VoiceExtensionId']});_0x5b5f8d[_0x92cc('0x12')]({'type':_0x1ece77[_0x92cc('0x13')],'app':_0x92cc('0x18'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1ece77['context'],'exten':_0x1ece77[_0x92cc('0xc')],'priority':_0x19e220['length']+_0x4095dd['priority']+_0x48c04c++,'VoiceExtensionId':_0x1ece77[_0x92cc('0x16')]});}else{_0x5b5f8d[_0x92cc('0x12')]({'type':_0x1ece77[_0x92cc('0x13')],'app':_0x92cc('0x33'),'appdata':_0x92cc('0x39'),'context':_0x1ece77[_0x92cc('0x15')],'exten':_0x1ece77[_0x92cc('0xc')],'priority':_0x19e220['length']+_0x4095dd[_0x92cc('0xe')]+_0x48c04c++,'VoiceExtensionId':_0x1ece77[_0x92cc('0x16')]});_0x5b5f8d[_0x92cc('0x12')]({'type':_0x1ece77[_0x92cc('0x13')],'app':'Set','appdata':_0x92cc('0x3a'),'context':_0x1ece77[_0x92cc('0x15')],'exten':_0x1ece77[_0x92cc('0xc')],'priority':_0x19e220['length']+_0x4095dd[_0x92cc('0xe')]+_0x48c04c++,'VoiceExtensionId':_0x1ece77[_0x92cc('0x16')]});}}}for(var _0x24f81b=0x0;_0x24f81b<_0x19e220[_0x92cc('0x29')];_0x24f81b+=0x1){var _0x45ec4f=_0x4095dd[_0x92cc('0xe')]+_0x19e220[_0x92cc('0x29')];var _0x2eb6ad=_0x24f81b===_0x19e220[_0x92cc('0x29')]-0x1?_0x4095dd[_0x92cc('0xe')]+_0x5b5f8d['length']+_0xc1141b[_0x92cc('0x29')]+0x2:_0x4095dd[_0x92cc('0xe')]+_0x24f81b+0x1;_0x5b5f8d[_0x92cc('0x3b')](_0x24f81b,0x0,{'type':_0x1ece77[_0x92cc('0x13')],'app':_0x92cc('0x3c'),'appdata':_0x19e220[_0x24f81b]+'?'+_0x1ece77[_0x92cc('0x15')]+_0x92cc('0x3d')+_0x45ec4f+':'+_0x1ece77[_0x92cc('0x15')]+_0x92cc('0x3d')+_0x2eb6ad,'exten':_0x1ece77[_0x92cc('0xc')],'context':_0x1ece77['context'],'priority':_0x4095dd[_0x92cc('0xe')]+_0x24f81b,'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});}_0x1ece77[_0x92cc('0xe')]=_0x5b5f8d[_0x92cc('0x29')]?_[_0x92cc('0x3e')](_0x5b5f8d)['priority']+0x1:_0x4095dd[_0x92cc('0xe')];_0x4095dd[_0x92cc('0xe')]=(_0xc1141b['length']?_[_0x92cc('0x3e')](_0xc1141b)[_0x92cc('0xe')]:_0x1ece77['priority'])+0x1;_0x4095dd[_0x92cc('0xf')]=_[_0x92cc('0x3f')](_0x4095dd[_0x92cc('0xf')],_0x5b5f8d,[_0x1ece77],_0xc1141b);}_0x4095dd[_0x92cc('0xf')][_0x92cc('0x12')]({'type':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x13')],'app':_0x92cc('0x40'),'exten':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0xc')],'context':_0xefbdf1[_0x3704fa][0x0]['context'],'priority':_0x4095dd[_0x92cc('0xe')],'VoiceExtensionId':_0xefbdf1[_0x3704fa][0x0][_0x92cc('0x16')]});_0x217fa8['push'](_0xefbdf1[_0x3704fa][0x0]['VoiceExtensionId']);_0x213368=_[_0x92cc('0x3f')](_0x213368,_0x4095dd['extensions']);}}return _0x4a985e[_0x92cc('0x41')](function(_0x321246){return _0x4a985e['models'][_0x92cc('0x6')][_0x92cc('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x217fa8}},'transaction':_0x321246})[_0x92cc('0x4')](function(_0x135b34){return _0x4a985e[_0x92cc('0x2')][_0x92cc('0x6')][_0x92cc('0x43')](_[_0x92cc('0x44')](_0x213368,_0x92cc('0xe')),{'transaction':_0x321246});});});})[_0x92cc('0x45')](function(_0x39eb5d){console[_0x92cc('0x46')](_0x39eb5d);});}exports[_0x92cc('0x47')]=rewrite; \ No newline at end of file +var _0x981e=['splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','Set','format','context','priority','VoiceExtensionId','type','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x589ae7,_0x5e023c){var _0x194b56=function(_0x3678c4){while(--_0x3678c4){_0x589ae7['push'](_0x589ae7['shift']());}};_0x194b56(++_0x5e023c);}(_0x981e,0xd3));var _0xe981=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x981e[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xe981('0x0'));var util=require(_0xe981('0x1'));function rewrite(_0x574915,_0x2e2809){var _0x45754a=this;return _0x574915[_0xe981('0x2')][_0xe981('0x3')][_0xe981('0x4')]({'raw':!![]})[_0xe981('0x5')](function(_0xe4e740){_0x45754a[_0xe981('0x6')]=_0xe4e740;return _0x574915['models']['VoiceExtension'][_0xe981('0x4')]({'where':{'IntervalId':_0x2e2809[_0xe981('0x7')]},'raw':!![]});})['then'](function(_0x57fd0b){return _0x574915[_0xe981('0x2')][_0xe981('0x8')][_0xe981('0x4')]({'where':{'exten':{'$in':_[_0xe981('0x9')](_[_0xe981('0xa')](_0x57fd0b,_0xe981('0xb')))}},'order':[{'raw':_0xe981('0xc')}],'raw':!![]});})['then'](function(_0x3738d5){var _0x5cf32b=_[_0xe981('0xd')](_0x3738d5,{'priority':'1'});var _0x268fc9=_[_0xe981('0xd')](_0x3738d5,{'isApp':0x1});var _0x43d092=_[_0xe981('0xe')](_0x268fc9,_0xe981('0xb'));var _0x3cbcb8=['queue','playback'];var _0x30a925=[];var _0x522a7c=[];for(var _0x16cecd in _0x43d092){if(_0x43d092[_0xe981('0xf')](_0x16cecd)){_0x45754a['priority']=0x2;_0x45754a[_0xe981('0x10')]=[];_0x45754a[_0xe981('0x11')]=_['find'](_0x5cf32b,{'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')]});_0x45754a[_0xe981('0x10')]['push']({'type':_0x43d092[_0x16cecd][0x0]['type'],'app':_0xe981('0x12'),'appdata':util[_0xe981('0x13')]('CDR(type)=%s',_0x43d092[_0x16cecd][0x0]['type']),'context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});if(_0x43d092[_0x16cecd][0x0][_0xe981('0x17')]===_0xe981('0x18')){_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':_0xe981('0x12'),'appdata':_0xe981('0x1a')+_0x43d092[_0x16cecd][0x0]['VoiceExtensionId'],'context':_0x43d092[_0x16cecd][0x0]['context'],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});}else if(_0x43d092[_0x16cecd][0x0][_0xe981('0x17')]===_0xe981('0x1b')){if(_0x45754a[_0xe981('0x11')]){_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0]['type'],'app':_0xe981('0x12'),'appdata':_0xe981('0x1c')+(_0x45754a[_0xe981('0x11')][_0xe981('0x1d')]?'${EXTEN:'+_0x45754a[_0xe981('0x11')]['cutdigits']+'}':'${EXTEN}'),'context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0]['VoiceExtensionId']});}_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':'Set','appdata':_0xe981('0x1a')+_0x43d092[_0x16cecd][0x0][_0xe981('0x16')],'context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0]['VoiceExtensionId']});var _0xbda8b1=_0x45754a[_0xe981('0x15')]++;_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0]['type'],'app':'ExecIf','appdata':_0xe981('0x1e')+(_0xbda8b1+0x2)+'):Goto('+(_0xbda8b1+0x1)+')','context':_0x43d092[_0x16cecd][0x0]['context'],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0xbda8b1,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});if(_0x45754a[_0xe981('0x11')]){_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':'Set','appdata':_0x45754a[_0xe981('0x11')][_0xe981('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x45754a[_0xe981('0x11')][_0xe981('0x1d')]+'}':_0xe981('0x1f'),'context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});}_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':'Set','appdata':_0xe981('0x20')+_0x43d092[_0x16cecd][0x0][_0xe981('0x16')],'context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a['priority']++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});if(_0x45754a[_0xe981('0x11')]&&_0x45754a[_0xe981('0x11')][_0xe981('0xf')](_0xe981('0x21'))&&_0x45754a[_0xe981('0x11')]['recordingFormat']!=='none'){_0x45754a['extensions'][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':_0xe981('0x12'),'appdata':_0xe981('0x22'),'context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':_0xe981('0x12'),'appdata':_0xe981('0x23')+_0x45754a[_0xe981('0x11')][_0xe981('0x21')]||_0xe981('0x24'),'context':_0x43d092[_0x16cecd][0x0]['context'],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});}}_0x45754a['extensions'][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':_0xe981('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':_0xe981('0x12'),'appdata':_0xe981('0x25'),'context':_0x43d092[_0x16cecd][0x0]['context'],'exten':_0x43d092[_0x16cecd][0x0]['exten'],'priority':_0x45754a['priority']++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0]['VoiceExtensionId']});_0x45754a[_0xe981('0x10')]['push']({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':'Set','appdata':_0xe981('0x26'),'context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'priority':_0x45754a[_0xe981('0x15')]++,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});for(var _0x2ead1b=0x0,_0xe4c812=0x0;_0x2ead1b<_0x43d092[_0x16cecd]['length'];_0x2ead1b+=0x1,_0xe4c812=0x0){var _0x52f7bc=_0x43d092[_0x16cecd][_0x2ead1b];if(_0x52f7bc[_0xe981('0x17')]){_0x52f7bc[_0xe981('0x17')]=_0x52f7bc[_0xe981('0x17')][_0xe981('0x27')]();}var _0x238463=[];var _0x180cb2=[];delete _0x52f7bc['id'];delete _0x52f7bc[_0xe981('0x28')];delete _0x52f7bc[_0xe981('0x29')];var _0x13170f=_0x52f7bc[_0xe981('0x2a')]!==_0xe981('0x2b')?[_0x52f7bc[_0xe981('0x2a')]]:_0x52f7bc[_0xe981('0x7')]?_[_0xe981('0xa')](_[_0xe981('0xd')](_0x45754a[_0xe981('0x6')],{'IntervalId':_0x52f7bc[_0xe981('0x7')]}),_0xe981('0x2a')):[];if(_0x52f7bc[_0xe981('0xf')](_0xe981('0x2c'))){if(_0x52f7bc[_0xe981('0x2c')]&&_0x52f7bc[_0xe981('0x2c')]!=='--'){_0x238463[_0xe981('0x19')]({'type':_0x52f7bc[_0xe981('0x17')],'app':'Set','appdata':_0xe981('0x2d')+_0x52f7bc[_0xe981('0x2c')],'context':_0x52f7bc[_0xe981('0x14')],'exten':_0x52f7bc[_0xe981('0xb')],'priority':_0x13170f[_0xe981('0x2e')]+_0x45754a[_0xe981('0x15')]+_0xe4c812++,'VoiceExtensionId':_0x52f7bc['VoiceExtensionId']});}}if(_0x52f7bc[_0xe981('0x17')]===_0xe981('0x1b')&&_0x52f7bc[_0xe981('0xf')]('callerID')){if(_0x52f7bc[_0xe981('0x2f')]){_0x238463[_0xe981('0x19')]({'type':_0x52f7bc[_0xe981('0x17')],'app':'ExecIf','appdata':_0xe981('0x30')+_0x52f7bc[_0xe981('0x2f')]+')','context':_0x52f7bc[_0xe981('0x14')],'exten':_0x52f7bc['exten'],'priority':_0x13170f[_0xe981('0x2e')]+_0x45754a['priority']+_0xe4c812++,'VoiceExtensionId':_0x52f7bc[_0xe981('0x16')]});}else{_0x238463[_0xe981('0x19')]({'type':_0x52f7bc[_0xe981('0x17')],'app':_0xe981('0x31'),'appdata':_0xe981('0x32'),'context':_0x52f7bc[_0xe981('0x14')],'exten':_0x52f7bc[_0xe981('0xb')],'priority':_0x13170f['length']+_0x45754a['priority']+_0xe4c812++,'VoiceExtensionId':_0x52f7bc[_0xe981('0x16')]});}}if(_0x52f7bc['hasOwnProperty'](_0xe981('0x33'))){if(_0x3cbcb8['indexOf'](_0x52f7bc[_0xe981('0x34')][_0xe981('0x27')]())>=0x0&&_0x52f7bc['appType']!==_0xe981('0x35')){if(_0x52f7bc[_0xe981('0x33')]){_0x238463['push']({'type':_0x52f7bc[_0xe981('0x17')],'app':_0xe981('0x31'),'appdata':_0xe981('0x36'),'context':_0x52f7bc[_0xe981('0x14')],'exten':_0x52f7bc[_0xe981('0xb')],'priority':_0x13170f[_0xe981('0x2e')]+_0x45754a[_0xe981('0x15')]+_0xe4c812++,'VoiceExtensionId':_0x52f7bc['VoiceExtensionId']});_0x238463[_0xe981('0x19')]({'type':_0x52f7bc[_0xe981('0x17')],'app':_0xe981('0x12'),'appdata':_0xe981('0x37'),'context':_0x52f7bc[_0xe981('0x14')],'exten':_0x52f7bc[_0xe981('0xb')],'priority':_0x13170f['length']+_0x45754a[_0xe981('0x15')]+_0xe4c812++,'VoiceExtensionId':_0x52f7bc[_0xe981('0x16')]});}else{_0x238463[_0xe981('0x19')]({'type':_0x52f7bc[_0xe981('0x17')],'app':_0xe981('0x31'),'appdata':_0xe981('0x38'),'context':_0x52f7bc['context'],'exten':_0x52f7bc[_0xe981('0xb')],'priority':_0x13170f[_0xe981('0x2e')]+_0x45754a[_0xe981('0x15')]+_0xe4c812++,'VoiceExtensionId':_0x52f7bc[_0xe981('0x16')]});_0x238463[_0xe981('0x19')]({'type':_0x52f7bc['type'],'app':_0xe981('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x52f7bc['context'],'exten':_0x52f7bc[_0xe981('0xb')],'priority':_0x13170f[_0xe981('0x2e')]+_0x45754a['priority']+_0xe4c812++,'VoiceExtensionId':_0x52f7bc[_0xe981('0x16')]});}}}for(var _0x25c79b=0x0;_0x25c79b<_0x13170f['length'];_0x25c79b+=0x1){var _0x1912a8=_0x45754a[_0xe981('0x15')]+_0x13170f[_0xe981('0x2e')];var _0x5b4b22=_0x25c79b===_0x13170f['length']-0x1?_0x45754a[_0xe981('0x15')]+_0x238463['length']+_0x180cb2['length']+0x2:_0x45754a['priority']+_0x25c79b+0x1;_0x238463[_0xe981('0x39')](_0x25c79b,0x0,{'type':_0x52f7bc['type'],'app':_0xe981('0x3a'),'appdata':_0x13170f[_0x25c79b]+'?'+_0x52f7bc[_0xe981('0x14')]+_0xe981('0x3b')+_0x1912a8+':'+_0x52f7bc[_0xe981('0x14')]+_0xe981('0x3b')+_0x5b4b22,'exten':_0x52f7bc[_0xe981('0xb')],'context':_0x52f7bc[_0xe981('0x14')],'priority':_0x45754a[_0xe981('0x15')]+_0x25c79b,'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});}_0x52f7bc['priority']=_0x238463[_0xe981('0x2e')]?_[_0xe981('0x3c')](_0x238463)[_0xe981('0x15')]+0x1:_0x45754a['priority'];_0x45754a[_0xe981('0x15')]=(_0x180cb2[_0xe981('0x2e')]?_[_0xe981('0x3c')](_0x180cb2)[_0xe981('0x15')]:_0x52f7bc[_0xe981('0x15')])+0x1;_0x45754a[_0xe981('0x10')]=_[_0xe981('0x3d')](_0x45754a[_0xe981('0x10')],_0x238463,[_0x52f7bc],_0x180cb2);}_0x45754a[_0xe981('0x10')][_0xe981('0x19')]({'type':_0x43d092[_0x16cecd][0x0][_0xe981('0x17')],'app':'Hangup','exten':_0x43d092[_0x16cecd][0x0][_0xe981('0xb')],'context':_0x43d092[_0x16cecd][0x0][_0xe981('0x14')],'priority':_0x45754a[_0xe981('0x15')],'VoiceExtensionId':_0x43d092[_0x16cecd][0x0][_0xe981('0x16')]});_0x30a925['push'](_0x43d092[_0x16cecd][0x0]['VoiceExtensionId']);_0x522a7c=_[_0xe981('0x3d')](_0x522a7c,_0x45754a[_0xe981('0x10')]);}}return _0x574915[_0xe981('0x3e')](function(_0x4b06d7){return _0x574915[_0xe981('0x2')][_0xe981('0x8')][_0xe981('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x30a925}},'transaction':_0x4b06d7})[_0xe981('0x5')](function(_0x2612d1){return _0x574915['models'][_0xe981('0x8')][_0xe981('0x40')](_[_0xe981('0x41')](_0x522a7c,_0xe981('0x15')),{'transaction':_0x4b06d7});});});})['catch'](function(_0x190831){console['error'](_0x190831);});}exports[_0xe981('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index aa37730..cdfcaac 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d7c=['dialCheckDuplicateType','Lists','then','get','always','sequelize','query','VoiceQueueId','all','findAll','CmList','BlackLists','CampaignId','onlyIfOpen','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','api','redis','defaults','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','duplicate','CmContact','create','keys','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','insert','str','calleridnum','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','fromQuery','VoiceQueue','outbound'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x9d7c,0x84));var _0xc9d7=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0x9d7c[_0x58b301];return _0x2171b3;};'use strict';var BPromise=require(_0xc9d7('0x0'));var util=require(_0xc9d7('0x1'));var _=require(_0xc9d7('0x2'));var fs=require('fs');var squel=require(_0xc9d7('0x3'));var Papa=require(_0xc9d7('0x4'));var Redis=require('ioredis');var db=require(_0xc9d7('0x5'))['db'];var config=require(_0xc9d7('0x6'));var logger=require('../../../config/logger')(_0xc9d7('0x7'));config[_0xc9d7('0x8')]=_[_0xc9d7('0x9')](config[_0xc9d7('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc9d7('0xa'))[_0xc9d7('0xb')](socket);try{if(!process['argv'][0x2]||process[_0xc9d7('0xc')][0x2]===_0xc9d7('0xd')||process['argv'][0x2]===_0xc9d7('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xc9d7('0xc')][0x2];if(!process[_0xc9d7('0xc')][0x3]||process[_0xc9d7('0xc')][0x3]==='undefined'||process[_0xc9d7('0xc')][0x3]==='null'||!process['argv'][0x4]||process[_0xc9d7('0xc')][0x4]===_0xc9d7('0xd')||process[_0xc9d7('0xc')][0x4]===_0xc9d7('0xe')){throw new Error(_0xc9d7('0xf'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0xc9d7('0x10')](','),process[_0xc9d7('0xc')][0x4][_0xc9d7('0x10')](','));if(!process[_0xc9d7('0xc')][0x5]||process[_0xc9d7('0xc')][0x5]===_0xc9d7('0xd')||process[_0xc9d7('0xc')][0x5]==='null'){throw new Error(_0xc9d7('0x11'));}var LISTID=process[_0xc9d7('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xc9d7('0xc')][0x6]!==_0xc9d7('0xd')&&process[_0xc9d7('0xc')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xc9d7('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xc9d7('0xc')][0x7]!==_0xc9d7('0xe')?process[_0xc9d7('0xc')][0x7]:null;if(!process[_0xc9d7('0xc')][0x8]||process[_0xc9d7('0xc')][0x8]===_0xc9d7('0xd')||process[_0xc9d7('0xc')][0x8]===_0xc9d7('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xc9d7('0xc')][0x8];}catch(_0x100603){logger[_0xc9d7('0x12')](_0x100603);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x3303b5,_0x4cbbff,_0x3f1f4a,_0x481337){var _0x13a40a={'message':_0x4cbbff};_0x13a40a[_0x3303b5]=!![];if(_0x3f1f4a){_0x13a40a[_0xc9d7('0x13')]=_0x3f1f4a;}if(_0x481337){_0x13a40a['index']=_0x481337;}return _0x13a40a;}function isEmail(_0x4c43e7){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xc9d7('0x14')](_0x4c43e7);}function checkRow(_0x2fe959,_0x2d72a8,_0x16cc2d){return new BPromise(function(_0x43012d,_0x15081c){if(_[_0xc9d7('0x15')](_0x2fe959)){return _0x15081c(handleCheckRowError(_0xc9d7('0x12'),_0xc9d7('0x16'),null,_0x16cc2d));}if(_0x2fe959[_0xc9d7('0x17')]&&_0x2fe959[_0xc9d7('0x17')][_0xc9d7('0x18')]){var _0x25893c=_[_0xc9d7('0x19')](_0x2fe959['errors'],'message')[_0xc9d7('0x1a')](';');return _0x15081c(handleCheckRowError(_0xc9d7('0x12'),_0x25893c,null,_0x16cc2d));}var _0x407470={};for(var _0x490095 in FIELDS){if(FIELDS['hasOwnProperty'](_0x490095)&&FIELDS[_0x490095]){_0x407470[_0x490095]=_0x2fe959[_0xc9d7('0x1b')][0x0][FIELDS[_0x490095]]||_0x2fe959['data'][0x0]['\ufeff'+FIELDS[_0x490095]];}}if(!_0x407470[_0xc9d7('0x1c')]){return _0x15081c(handleCheckRowError('error',_0xc9d7('0x1d'),null,_0x16cc2d));}if(!_0x407470[_0xc9d7('0x1e')]){return _0x15081c(handleCheckRowError(_0xc9d7('0x12'),'phone\x20not\x20specified!',null,_0x16cc2d));}if(_0x407470[_0xc9d7('0x1f')]){var _0x4537ca=moment(_0x407470[_0xc9d7('0x1f')],_0xc9d7('0x20'));if(!_0x4537ca[_0xc9d7('0x21')]()){return _0x15081c(handleCheckRowError(_0xc9d7('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x16cc2d));}}if(_0x407470[_0xc9d7('0x22')]){if(!isEmail(_0x407470[_0xc9d7('0x22')])){return _0x15081c(handleCheckRowError(_0xc9d7('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x16cc2d));}}_0x407470[_0xc9d7('0x23')]=LISTID;_0x407470[_0xc9d7('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc9d7('0x18')]&&_0x2d72a8){var _0x4da380={};for(var _0x3ffa5f=0x0,_0x21b0f2=DUPLICATES[_0xc9d7('0x18')];_0x3ffa5f<_0x21b0f2;_0x3ffa5f+=0x1){_0x4da380[DUPLICATES[_0x3ffa5f]]=_0x407470[DUPLICATES[_0x3ffa5f]];}var _0x329391=_[_0xc9d7('0x25')](_0x2d72a8,_0x4da380);if(_0x329391){return _0x15081c(handleCheckRowError(_0xc9d7('0x26'),'Duplicate\x20Contact',_0x329391,_0x16cc2d));}}return db[_0xc9d7('0x27')][_0xc9d7('0x28')](_0x407470,{'raw':!![],'hooks':![],'fields':_[_0xc9d7('0x29')](_0x407470)})['then'](function(_0x3751e1){if(DUPLICATES&&DUPLICATES['length']&&_0x2d72a8){_0x2d72a8[_0xc9d7('0x2a')](_[_0xc9d7('0x2b')](_0x407470,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3751e1['id'];return _0x43012d();})[_0xc9d7('0x2c')](function(_0x30ac48){return _0x15081c(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x30ac48[_0xc9d7('0x2d')]||JSON[_0xc9d7('0x2e')](_0x30ac48)),null,_0x16cc2d));});});}function checkHopper(){function _0x532a23(){return function(_0x31d213){logger[_0xc9d7('0x12')](_0xc9d7('0x2f'),_0xc9d7('0x30'),util[_0xc9d7('0x31')](_0x31d213,{'showHidden':![],'depth':null}));};}var _0x49d0e3=function(_0x133db8,_0x101deb){var _0x163a66=squel['insert']()[_0xc9d7('0x32')](_0xc9d7('0x33'))['fromQuery'](['phone',_0xc9d7('0x34'),_0xc9d7('0x35'),_0xc9d7('0x23'),_0x101deb,_0xc9d7('0x36'),_0xc9d7('0x37')],squel[_0xc9d7('0x38')]()['field'](_0xc9d7('0x1e'),'phone')['field'](_0xc9d7('0x39'),_0xc9d7('0x34'))[_0xc9d7('0x3a')]('id',_0xc9d7('0x35'))[_0xc9d7('0x3a')](LISTID[_0xc9d7('0x3b')](),_0xc9d7('0x23'))['field'](_0x133db8['id'][_0xc9d7('0x3b')](),_0x101deb)[_0xc9d7('0x3a')](_0xc9d7('0x39'),_0xc9d7('0x36'))[_0xc9d7('0x3a')](_0xc9d7('0x39'),'updatedAt')[_0xc9d7('0x3c')](_0xc9d7('0x3d'))['where'](_0xc9d7('0x3e'))['where'](_0xc9d7('0x3f'),LISTID[_0xc9d7('0x3b')]())[_0xc9d7('0x40')](_0xc9d7('0x41'))[_0xc9d7('0x40')](_0xc9d7('0x42'),squel[_0xc9d7('0x38')]()['field'](_0xc9d7('0x1e'))['from'](_0xc9d7('0x33'))[_0xc9d7('0x40')](_0x101deb+'\x20=\x20?',_0x133db8['id']['toString']())))['toString']();return _0x163a66;};var _0x3bb414=function(_0x35b909,_0x38c00f){var _0x511ebb=squel[_0xc9d7('0x43')]()[_0xc9d7('0x32')](_0xc9d7('0x33'))['fromQuery']([_0xc9d7('0x1e'),'scheduledAt',_0xc9d7('0x35'),'ListId',_0x38c00f,_0xc9d7('0x36'),_0xc9d7('0x37')],squel[_0xc9d7('0x38')]()[_0xc9d7('0x3a')](_0xc9d7('0x1e'),_0xc9d7('0x1e'))['field'](_0xc9d7('0x39'),_0xc9d7('0x34'))[_0xc9d7('0x3a')]('id',_0xc9d7('0x35'))['field'](LISTID['toString'](),_0xc9d7('0x23'))[_0xc9d7('0x3a')](_0x35b909['id'][_0xc9d7('0x3b')](),_0x38c00f)[_0xc9d7('0x3a')](_0xc9d7('0x39'),_0xc9d7('0x36'))['field']('NOW()','updatedAt')[_0xc9d7('0x3c')]('cm_contacts')[_0xc9d7('0x40')](_0xc9d7('0x3e'))[_0xc9d7('0x40')](_0xc9d7('0x3f'),LISTID[_0xc9d7('0x3b')]())[_0xc9d7('0x40')]('id\x20IN\x20?',squel[_0xc9d7('0x44')](hopperContacts))[_0xc9d7('0x40')](_0xc9d7('0x41'))[_0xc9d7('0x40')](_0xc9d7('0x42'),squel['select']()[_0xc9d7('0x3a')](_0xc9d7('0x45'))[_0xc9d7('0x3c')](_0xc9d7('0x46'))[_0xc9d7('0x40')](_0x38c00f+_0xc9d7('0x47'),_0x35b909['id'][_0xc9d7('0x3b')]()))[_0xc9d7('0x40')](_0xc9d7('0x42'),squel['select']()['field']('phone')[_0xc9d7('0x3c')](_0xc9d7('0x33'))['where'](_0x38c00f+_0xc9d7('0x47'),_0x35b909['id'][_0xc9d7('0x3b')]())))[_0xc9d7('0x3b')]();return _0x511ebb;};function _0x28f8f7(_0x4c5244,_0x3ff620){var _0x48f1e2=squel[_0xc9d7('0x43')]()[_0xc9d7('0x32')]('cm_hopper')['fromQuery']([_0xc9d7('0x1e'),_0xc9d7('0x34'),_0xc9d7('0x35'),'ListId',_0x3ff620,_0xc9d7('0x36'),_0xc9d7('0x37')],squel['select']()[_0xc9d7('0x3a')](_0xc9d7('0x1e'),_0xc9d7('0x1e'))['field']('NOW()',_0xc9d7('0x34'))['field']('id',_0xc9d7('0x35'))[_0xc9d7('0x3a')](LISTID[_0xc9d7('0x3b')](),_0xc9d7('0x23'))[_0xc9d7('0x3a')](_0x4c5244['id'][_0xc9d7('0x3b')](),_0x3ff620)[_0xc9d7('0x3a')](_0xc9d7('0x39'),'createdAt')[_0xc9d7('0x3a')](_0xc9d7('0x39'),_0xc9d7('0x37'))[_0xc9d7('0x3c')](_0xc9d7('0x3d'))[_0xc9d7('0x40')](_0xc9d7('0x3e'))[_0xc9d7('0x40')](_0xc9d7('0x3f'),LISTID['toString']())[_0xc9d7('0x40')](_0xc9d7('0x48'),squel[_0xc9d7('0x44')](hopperContacts))[_0xc9d7('0x40')](_0xc9d7('0x41')))[_0xc9d7('0x3b')]();return _0x48f1e2;}function _0x4f5cbf(_0x35d11d,_0x57a6c9){var _0x1dbbec=squel[_0xc9d7('0x43')]()[_0xc9d7('0x32')]('cm_hopper_black')[_0xc9d7('0x49')]([_0xc9d7('0x1e'),_0xc9d7('0x35'),_0xc9d7('0x23'),_0x57a6c9,_0xc9d7('0x36'),'updatedAt'],squel[_0xc9d7('0x38')]()[_0xc9d7('0x3a')](_0xc9d7('0x1e'),_0xc9d7('0x1e'))[_0xc9d7('0x3a')]('id','ContactId')[_0xc9d7('0x3a')](LISTID['toString'](),'ListId')['field'](_0x35d11d['id']['toString'](),_0x57a6c9)[_0xc9d7('0x3a')](_0xc9d7('0x39'),_0xc9d7('0x36'))[_0xc9d7('0x3a')](_0xc9d7('0x39'),_0xc9d7('0x37'))[_0xc9d7('0x3c')]('cm_contacts')['where'](_0xc9d7('0x3e'))[_0xc9d7('0x40')](_0xc9d7('0x3f'),LISTID[_0xc9d7('0x3b')]())[_0xc9d7('0x40')](_0xc9d7('0x48'),squel[_0xc9d7('0x44')](hopperContacts))['where'](_0xc9d7('0x41')))[_0xc9d7('0x3b')]();return _0x1dbbec;}return db[_0xc9d7('0x4a')]['findAll']({'where':{'type':_0xc9d7('0x4b')},'attributes':['id',_0xc9d7('0x4c')],'include':[{'model':db['CmList'],'as':_0xc9d7('0x4d'),'where':{'id':LISTID}}]})[_0xc9d7('0x4e')](function(_0x32e536){var _0x30f097=[];if(_0x32e536){var _0xee6015;for(var _0x291d10=0x0,_0x40d990;_0x291d10<_0x32e536[_0xc9d7('0x18')];_0x291d10+=0x1){_0x40d990=_0x32e536[_0x291d10][_0xc9d7('0x4f')]({'plain':!![]});switch(_0x40d990[_0xc9d7('0x4c')]){case _0xc9d7('0x50'):_0x30f097[_0xc9d7('0x2a')](db[_0xc9d7('0x51')][_0xc9d7('0x52')](_0x3bb414(_0x40d990,_0xc9d7('0x53')))[_0xc9d7('0x4e')](function(){})[_0xc9d7('0x2c')](_0x532a23()));break;case'onlyIfOpen':_0x30f097[_0xc9d7('0x2a')](db['sequelize'][_0xc9d7('0x52')](_0x49d0e3(_0x40d990,_0xc9d7('0x53')))[_0xc9d7('0x4e')](function(){})['catch'](_0x532a23()));break;default:_0x30f097[_0xc9d7('0x2a')](db['sequelize'][_0xc9d7('0x52')](_0x28f8f7(_0x40d990,'VoiceQueueId'))['then'](function(){})[_0xc9d7('0x2c')](_0x532a23()));}}}return _0x30f097;})[_0xc9d7('0x54')]()[_0xc9d7('0x4e')](function(){return db['VoiceQueue'][_0xc9d7('0x55')]({'where':{'type':_0xc9d7('0x4b')},'attributes':['id'],'include':[{'model':db[_0xc9d7('0x56')],'as':_0xc9d7('0x57'),'where':{'id':LISTID}}]})[_0xc9d7('0x4e')](function(_0x4a4485){var _0x2f8eb9=[];if(_0x4a4485){var _0x5b95c4;for(var _0x14fd58=0x0,_0x4d97fc;_0x14fd58<_0x4a4485[_0xc9d7('0x18')];_0x14fd58+=0x1){_0x4d97fc=_0x4a4485[_0x14fd58][_0xc9d7('0x4f')]({'plain':!![]});_0x2f8eb9[_0xc9d7('0x2a')](db[_0xc9d7('0x51')][_0xc9d7('0x52')](_0x4f5cbf(_0x4d97fc,_0xc9d7('0x53')))[_0xc9d7('0x4e')](function(){})[_0xc9d7('0x2c')](_0x532a23()));}}return _0x2f8eb9;})[_0xc9d7('0x54')]();})[_0xc9d7('0x4e')](function(){return db['Campaign'][_0xc9d7('0x55')]({'attributes':['id',_0xc9d7('0x4c')],'include':[{'model':db[_0xc9d7('0x56')],'as':_0xc9d7('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x1d0550){var _0x8640a0=[];if(_0x1d0550){for(var _0x2d45ee=0x0,_0x5ec696;_0x2d45ee<_0x1d0550[_0xc9d7('0x18')];_0x2d45ee+=0x1){_0x5ec696=_0x1d0550[_0x2d45ee][_0xc9d7('0x4f')]({'plain':!![]});switch(_0x5ec696['dialCheckDuplicateType']){case'always':_0x8640a0[_0xc9d7('0x2a')](db[_0xc9d7('0x51')]['query'](_0x3bb414(_0x5ec696,_0xc9d7('0x58')))[_0xc9d7('0x4e')](function(){})[_0xc9d7('0x2c')](_0x532a23()));break;case _0xc9d7('0x59'):_0x8640a0[_0xc9d7('0x2a')](db['sequelize'][_0xc9d7('0x52')](_0x49d0e3(_0x5ec696,_0xc9d7('0x58')))[_0xc9d7('0x4e')](function(){})[_0xc9d7('0x2c')](_0x532a23()));break;default:_0x8640a0[_0xc9d7('0x2a')](db[_0xc9d7('0x51')][_0xc9d7('0x52')](_0x28f8f7(_0x5ec696,'CampaignId'))['then'](function(){})['catch'](_0x532a23()));}}}return _0x8640a0;})[_0xc9d7('0x54')]();})[_0xc9d7('0x4e')](function(){return db['Campaign'][_0xc9d7('0x55')]({'attributes':['id'],'include':[{'model':db[_0xc9d7('0x56')],'as':_0xc9d7('0x57'),'where':{'id':LISTID}}]})[_0xc9d7('0x4e')](function(_0x39b14c){var _0x30bc1d=[];if(_0x39b14c){for(var _0x3ed561=0x0,_0x1be990;_0x3ed561<_0x39b14c[_0xc9d7('0x18')];_0x3ed561+=0x1){_0x1be990=_0x39b14c[_0x3ed561]['get']({'plain':!![]});_0x30bc1d[_0xc9d7('0x2a')](db[_0xc9d7('0x51')][_0xc9d7('0x52')](_0x4f5cbf(_0x1be990,_0xc9d7('0x58')))[_0xc9d7('0x4e')](function(){})['catch'](_0x532a23()));}}return _0x30bc1d;})[_0xc9d7('0x54')]();})[_0xc9d7('0x2c')](function(_0x17e30a){logger[_0xc9d7('0x12')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x17e30a[_0xc9d7('0x2d')]);});}var processPromises=function(_0x180ec9){return BPromise[_0xc9d7('0x54')](promises)['then'](function(_0x21f35e){})['catch'](function(_0x258c8c){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0xc9d7('0x2e')](_0x258c8c));})['finally'](function(){socket[_0xc9d7('0x5a')](_0xc9d7('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x180ec9){return _0x180ec9[_0xc9d7('0x5c')]();}});};var endCsv=function(){return BPromise[_0xc9d7('0x5d')]()[_0xc9d7('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0xc9d7('0x4e')](function(){socket[_0xc9d7('0x5a')](_0xc9d7('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc9d7('0x5e')](FILEPATH);}catch(_0x44e44f){logger[_0xc9d7('0x12')](_0xc9d7('0x5f'),JSON[_0xc9d7('0x2e')](_0x44e44f));}finally{process[_0xc9d7('0x60')](0x0);}});};process['on'](_0xc9d7('0x61'),function(){logger['info'](_0xc9d7('0x62'));endCsv();});function main(){return BPromise['resolve']()[_0xc9d7('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xc9d7('0x27')][_0xc9d7('0x55')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc9d7('0x4e')](function(_0x45a4f2){var _0x4c7edc=fs[_0xc9d7('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4c7edc,{'header':!![],'skipEmptyLines':!![],'step':function(_0x491d40,_0x249067){total+=0x1;var _0x27b3cb=total;promises[_0xc9d7('0x2a')](checkRow(_0x491d40,_0x45a4f2,_0x27b3cb)[_0xc9d7('0x4e')](function(){success+=0x1;})['catch'](function(_0x42bb5f){if(_0x42bb5f[_0xc9d7('0x12')]){errors+=0x1;delete _0x42bb5f[_0xc9d7('0x12')];}else if(_0x42bb5f[_0xc9d7('0x26')]){duplicates+=0x1;delete _0x42bb5f[_0xc9d7('0x26')];}rows['push'](_0x42bb5f);}));if(total%0xc8===0x0){_0x249067[_0xc9d7('0x64')]();return processPromises(_0x249067);}},'complete':function(){return processPromises()['then'](function(){logger[_0xc9d7('0x65')](_0xc9d7('0x66'));endCsv();});},'error':function(_0x2b3241,_0x5443d1){logger[_0xc9d7('0x65')](_0xc9d7('0x67'),JSON[_0xc9d7('0x2e')](_0x2b3241));endCsv();}});})[_0xc9d7('0x2c')](function(_0x45d24b){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xc9d7('0x2e')](_0x45d24b));});}main(); \ No newline at end of file +var _0xe1ff=['ContactId','createdAt','select','field','NOW()','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','insert','fromQuery','ListId\x20=\x20?','id\x20IN\x20?','cm_hopper_final','\x20=\x20?','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','query','onlyIfOpen','VoiceQueueId','all','BlackLists','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','keys','then','catch','stringify','cmContact','inspect','into','cm_hopper','scheduledAt'];(function(_0x448bab,_0x25517b){var _0x5dc534=function(_0x2196ba){while(--_0x2196ba){_0x448bab['push'](_0x448bab['shift']());}};_0x5dc534(++_0x25517b);}(_0xe1ff,0x10f));var _0xfe1f=function(_0x4e1a8d,_0x106b9d){_0x4e1a8d=_0x4e1a8d-0x0;var _0x53287c=_0xe1ff[_0x4e1a8d];return _0x53287c;};'use strict';var BPromise=require('bluebird');var util=require(_0xfe1f('0x0'));var _=require(_0xfe1f('0x1'));var fs=require('fs');var squel=require(_0xfe1f('0x2'));var Papa=require(_0xfe1f('0x3'));var Redis=require(_0xfe1f('0x4'));var db=require(_0xfe1f('0x5'))['db'];var config=require(_0xfe1f('0x6'));var logger=require(_0xfe1f('0x7'))(_0xfe1f('0x8'));config[_0xfe1f('0x9')]=_[_0xfe1f('0xa')](config[_0xfe1f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe1f('0xb'))(new Redis(config[_0xfe1f('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0xfe1f('0xc')](socket);try{if(!process[_0xfe1f('0xd')][0x2]||process[_0xfe1f('0xd')][0x2]===_0xfe1f('0xe')||process[_0xfe1f('0xd')][0x2]===_0xfe1f('0xf')){throw new Error(_0xfe1f('0x10'));}var FILEPATH=process[_0xfe1f('0xd')][0x2];if(!process[_0xfe1f('0xd')][0x3]||process[_0xfe1f('0xd')][0x3]===_0xfe1f('0xe')||process['argv'][0x3]===_0xfe1f('0xf')||!process[_0xfe1f('0xd')][0x4]||process[_0xfe1f('0xd')][0x4]==='undefined'||process[_0xfe1f('0xd')][0x4]===_0xfe1f('0xf')){throw new Error(_0xfe1f('0x11'));}var FIELDS=_[_0xfe1f('0x12')](process[_0xfe1f('0xd')][0x3][_0xfe1f('0x13')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0xfe1f('0xd')][0x5]===_0xfe1f('0xe')||process[_0xfe1f('0xd')][0x5]===_0xfe1f('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xfe1f('0xd')][0x5];var COMPANYID=process[_0xfe1f('0xd')][0x6]&&process[_0xfe1f('0xd')][0x6]!==_0xfe1f('0xe')&&process[_0xfe1f('0xd')][0x6]!==_0xfe1f('0xf')?process[_0xfe1f('0xd')][0x6]:null;var DUPLICATES=process[_0xfe1f('0xd')][0x7]&&process[_0xfe1f('0xd')][0x7]!==_0xfe1f('0xe')&&process[_0xfe1f('0xd')][0x7]!=='null'?process[_0xfe1f('0xd')][0x7]:null;if(!process[_0xfe1f('0xd')][0x8]||process['argv'][0x8]===_0xfe1f('0xe')||process[_0xfe1f('0xd')][0x8]==='null'){throw new Error(_0xfe1f('0x14'));}var SOCKET_TIMESTAMP=process[_0xfe1f('0xd')][0x8];}catch(_0x30615a){logger[_0xfe1f('0x15')](_0x30615a);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x495815,_0x5b3d3d,_0x5deeaf,_0x846e33){var _0x3bee33={'message':_0x5b3d3d};_0x3bee33[_0x495815]=!![];if(_0x5deeaf){_0x3bee33['contact']=_0x5deeaf;}if(_0x846e33){_0x3bee33[_0xfe1f('0x16')]=_0x846e33;}return _0x3bee33;}function isEmail(_0x1e5e9c){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x1e5e9c);}function checkRow(_0x556c50,_0x40bb55,_0x46261f){return new BPromise(function(_0x48d156,_0x5e19af){if(_['isNil'](_0x556c50)){return _0x5e19af(handleCheckRowError(_0xfe1f('0x15'),_0xfe1f('0x17'),null,_0x46261f));}if(_0x556c50[_0xfe1f('0x18')]&&_0x556c50[_0xfe1f('0x18')][_0xfe1f('0x19')]){var _0x21e319=_[_0xfe1f('0x1a')](_0x556c50['errors'],'message')[_0xfe1f('0x1b')](';');return _0x5e19af(handleCheckRowError(_0xfe1f('0x15'),_0x21e319,null,_0x46261f));}var _0x8bc72a={};for(var _0xe656ef in FIELDS){if(FIELDS[_0xfe1f('0x1c')](_0xe656ef)&&FIELDS[_0xe656ef]){_0x8bc72a[_0xe656ef]=_0x556c50['data'][0x0][FIELDS[_0xe656ef]]||_0x556c50[_0xfe1f('0x1d')][0x0]['\ufeff'+FIELDS[_0xe656ef]];}}if(!_0x8bc72a[_0xfe1f('0x1e')]){return _0x5e19af(handleCheckRowError(_0xfe1f('0x15'),'firstName\x20not\x20specified!',null,_0x46261f));}if(!_0x8bc72a[_0xfe1f('0x1f')]){return _0x5e19af(handleCheckRowError(_0xfe1f('0x15'),_0xfe1f('0x20'),null,_0x46261f));}if(_0x8bc72a[_0xfe1f('0x21')]){var _0x1d8e4e=moment(_0x8bc72a[_0xfe1f('0x21')],_0xfe1f('0x22'));if(!_0x1d8e4e[_0xfe1f('0x23')]()){return _0x5e19af(handleCheckRowError(_0xfe1f('0x15'),_0xfe1f('0x24'),null,_0x46261f));}}if(_0x8bc72a['email']){if(!isEmail(_0x8bc72a[_0xfe1f('0x25')])){return _0x5e19af(handleCheckRowError('error',_0xfe1f('0x26'),null,_0x46261f));}}_0x8bc72a[_0xfe1f('0x27')]=LISTID;_0x8bc72a[_0xfe1f('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x40bb55){var _0x14602c={};for(var _0x356703=0x0,_0x437d0d=DUPLICATES['length'];_0x356703<_0x437d0d;_0x356703+=0x1){_0x14602c[DUPLICATES[_0x356703]]=_0x8bc72a[DUPLICATES[_0x356703]];}var _0x1bdeae=_[_0xfe1f('0x29')](_0x40bb55,_0x14602c);if(_0x1bdeae){return _0x5e19af(handleCheckRowError(_0xfe1f('0x2a'),_0xfe1f('0x2b'),_0x1bdeae,_0x46261f));}}return db['CmContact']['create'](_0x8bc72a,{'raw':!![],'hooks':![],'fields':_[_0xfe1f('0x2c')](_0x8bc72a)})[_0xfe1f('0x2d')](function(_0x55cc3d){if(DUPLICATES&&DUPLICATES[_0xfe1f('0x19')]&&_0x40bb55){_0x40bb55['push'](_['pick'](_0x8bc72a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x55cc3d['id'];return _0x48d156();})[_0xfe1f('0x2e')](function(_0x36f22b){return _0x5e19af(handleCheckRowError(_0xfe1f('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x36f22b['message']||JSON[_0xfe1f('0x2f')](_0x36f22b)),null,_0x46261f));});});}function checkHopper(){function _0x2a32bf(){return function(_0x522b6a){logger[_0xfe1f('0x15')](_0xfe1f('0x30'),'checkHopper',util[_0xfe1f('0x31')](_0x522b6a,{'showHidden':![],'depth':null}));};}var _0x29afdb=function(_0xf24fa1,_0x38aa16){var _0x321f6f=squel['insert']()[_0xfe1f('0x32')](_0xfe1f('0x33'))['fromQuery']([_0xfe1f('0x1f'),_0xfe1f('0x34'),_0xfe1f('0x35'),_0xfe1f('0x27'),_0x38aa16,_0xfe1f('0x36'),'updatedAt'],squel[_0xfe1f('0x37')]()[_0xfe1f('0x38')](_0xfe1f('0x1f'),'phone')[_0xfe1f('0x38')](_0xfe1f('0x39'),_0xfe1f('0x34'))[_0xfe1f('0x38')]('id','ContactId')[_0xfe1f('0x38')](LISTID['toString'](),_0xfe1f('0x27'))[_0xfe1f('0x38')](_0xf24fa1['id'][_0xfe1f('0x3a')](),_0x38aa16)[_0xfe1f('0x38')](_0xfe1f('0x39'),'createdAt')[_0xfe1f('0x38')](_0xfe1f('0x39'),_0xfe1f('0x3b'))[_0xfe1f('0x3c')](_0xfe1f('0x3d'))[_0xfe1f('0x3e')](_0xfe1f('0x3f'))[_0xfe1f('0x3e')]('ListId\x20=\x20?',LISTID[_0xfe1f('0x3a')]())[_0xfe1f('0x3e')](_0xfe1f('0x40'))[_0xfe1f('0x3e')](_0xfe1f('0x41'),squel[_0xfe1f('0x37')]()[_0xfe1f('0x38')](_0xfe1f('0x1f'))[_0xfe1f('0x3c')](_0xfe1f('0x33'))[_0xfe1f('0x3e')](_0x38aa16+'\x20=\x20?',_0xf24fa1['id'][_0xfe1f('0x3a')]())))['toString']();return _0x321f6f;};var _0x2e5717=function(_0x24b4e9,_0x148ebd){var _0xbaf038=squel[_0xfe1f('0x42')]()[_0xfe1f('0x32')](_0xfe1f('0x33'))[_0xfe1f('0x43')]([_0xfe1f('0x1f'),_0xfe1f('0x34'),_0xfe1f('0x35'),_0xfe1f('0x27'),_0x148ebd,_0xfe1f('0x36'),_0xfe1f('0x3b')],squel['select']()[_0xfe1f('0x38')](_0xfe1f('0x1f'),_0xfe1f('0x1f'))['field']('NOW()','scheduledAt')['field']('id','ContactId')['field'](LISTID[_0xfe1f('0x3a')](),_0xfe1f('0x27'))[_0xfe1f('0x38')](_0x24b4e9['id']['toString'](),_0x148ebd)[_0xfe1f('0x38')](_0xfe1f('0x39'),_0xfe1f('0x36'))['field'](_0xfe1f('0x39'),_0xfe1f('0x3b'))[_0xfe1f('0x3c')](_0xfe1f('0x3d'))['where'](_0xfe1f('0x3f'))[_0xfe1f('0x3e')](_0xfe1f('0x44'),LISTID[_0xfe1f('0x3a')]())[_0xfe1f('0x3e')](_0xfe1f('0x45'),squel['str'](hopperContacts))[_0xfe1f('0x3e')](_0xfe1f('0x40'))['where'](_0xfe1f('0x41'),squel[_0xfe1f('0x37')]()['field']('calleridnum')[_0xfe1f('0x3c')](_0xfe1f('0x46'))[_0xfe1f('0x3e')](_0x148ebd+'\x20=\x20?',_0x24b4e9['id'][_0xfe1f('0x3a')]()))[_0xfe1f('0x3e')](_0xfe1f('0x41'),squel[_0xfe1f('0x37')]()[_0xfe1f('0x38')](_0xfe1f('0x1f'))['from'](_0xfe1f('0x33'))[_0xfe1f('0x3e')](_0x148ebd+_0xfe1f('0x47'),_0x24b4e9['id'][_0xfe1f('0x3a')]())))[_0xfe1f('0x3a')]();return _0xbaf038;};function _0x1e6f41(_0x3204c2,_0x498377){var _0x1fa974=squel['insert']()[_0xfe1f('0x32')]('cm_hopper')[_0xfe1f('0x43')]([_0xfe1f('0x1f'),'scheduledAt','ContactId',_0xfe1f('0x27'),_0x498377,'createdAt',_0xfe1f('0x3b')],squel['select']()[_0xfe1f('0x38')](_0xfe1f('0x1f'),'phone')[_0xfe1f('0x38')]('NOW()',_0xfe1f('0x34'))[_0xfe1f('0x38')]('id',_0xfe1f('0x35'))[_0xfe1f('0x38')](LISTID[_0xfe1f('0x3a')](),'ListId')[_0xfe1f('0x38')](_0x3204c2['id']['toString'](),_0x498377)[_0xfe1f('0x38')](_0xfe1f('0x39'),_0xfe1f('0x36'))[_0xfe1f('0x38')](_0xfe1f('0x39'),_0xfe1f('0x3b'))['from'](_0xfe1f('0x3d'))[_0xfe1f('0x3e')](_0xfe1f('0x3f'))[_0xfe1f('0x3e')](_0xfe1f('0x44'),LISTID[_0xfe1f('0x3a')]())[_0xfe1f('0x3e')](_0xfe1f('0x45'),squel[_0xfe1f('0x48')](hopperContacts))[_0xfe1f('0x3e')](_0xfe1f('0x40')))[_0xfe1f('0x3a')]();return _0x1fa974;}function _0xf70250(_0x13d9f0,_0x28669d){var _0x1df23a=squel[_0xfe1f('0x42')]()['into']('cm_hopper_black')[_0xfe1f('0x43')](['phone',_0xfe1f('0x35'),_0xfe1f('0x27'),_0x28669d,_0xfe1f('0x36'),_0xfe1f('0x3b')],squel[_0xfe1f('0x37')]()[_0xfe1f('0x38')](_0xfe1f('0x1f'),_0xfe1f('0x1f'))[_0xfe1f('0x38')]('id','ContactId')[_0xfe1f('0x38')](LISTID['toString'](),'ListId')[_0xfe1f('0x38')](_0x13d9f0['id'][_0xfe1f('0x3a')](),_0x28669d)[_0xfe1f('0x38')](_0xfe1f('0x39'),_0xfe1f('0x36'))['field'](_0xfe1f('0x39'),_0xfe1f('0x3b'))['from'](_0xfe1f('0x3d'))['where']('deletedAt\x20IS\x20NULL')[_0xfe1f('0x3e')](_0xfe1f('0x44'),LISTID['toString']())[_0xfe1f('0x3e')](_0xfe1f('0x45'),squel[_0xfe1f('0x48')](hopperContacts))[_0xfe1f('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xfe1f('0x3a')]();return _0x1df23a;}return db[_0xfe1f('0x49')][_0xfe1f('0x4a')]({'where':{'type':_0xfe1f('0x4b')},'attributes':['id',_0xfe1f('0x4c')],'include':[{'model':db[_0xfe1f('0x4d')],'as':_0xfe1f('0x4e'),'where':{'id':LISTID}}]})[_0xfe1f('0x2d')](function(_0x596e27){var _0x4bf304=[];if(_0x596e27){var _0xcd28ce;for(var _0x4b1d36=0x0,_0x245b64;_0x4b1d36<_0x596e27[_0xfe1f('0x19')];_0x4b1d36+=0x1){_0x245b64=_0x596e27[_0x4b1d36][_0xfe1f('0x4f')]({'plain':!![]});switch(_0x245b64[_0xfe1f('0x4c')]){case'always':_0x4bf304[_0xfe1f('0x50')](db[_0xfe1f('0x51')][_0xfe1f('0x52')](_0x2e5717(_0x245b64,'VoiceQueueId'))[_0xfe1f('0x2d')](function(){})['catch'](_0x2a32bf()));break;case _0xfe1f('0x53'):_0x4bf304[_0xfe1f('0x50')](db[_0xfe1f('0x51')][_0xfe1f('0x52')](_0x29afdb(_0x245b64,'VoiceQueueId'))[_0xfe1f('0x2d')](function(){})[_0xfe1f('0x2e')](_0x2a32bf()));break;default:_0x4bf304[_0xfe1f('0x50')](db['sequelize']['query'](_0x1e6f41(_0x245b64,_0xfe1f('0x54')))['then'](function(){})[_0xfe1f('0x2e')](_0x2a32bf()));}}}return _0x4bf304;})[_0xfe1f('0x55')]()[_0xfe1f('0x2d')](function(){return db['VoiceQueue'][_0xfe1f('0x4a')]({'where':{'type':_0xfe1f('0x4b')},'attributes':['id'],'include':[{'model':db[_0xfe1f('0x4d')],'as':_0xfe1f('0x56'),'where':{'id':LISTID}}]})[_0xfe1f('0x2d')](function(_0x52ab66){var _0x15b7ea=[];if(_0x52ab66){var _0x475e20;for(var _0x4ed32c=0x0,_0x2d4ec7;_0x4ed32c<_0x52ab66['length'];_0x4ed32c+=0x1){_0x2d4ec7=_0x52ab66[_0x4ed32c][_0xfe1f('0x4f')]({'plain':!![]});_0x15b7ea[_0xfe1f('0x50')](db[_0xfe1f('0x51')][_0xfe1f('0x52')](_0xf70250(_0x2d4ec7,'VoiceQueueId'))[_0xfe1f('0x2d')](function(){})[_0xfe1f('0x2e')](_0x2a32bf()));}}return _0x15b7ea;})['all']();})[_0xfe1f('0x2d')](function(){return db[_0xfe1f('0x57')][_0xfe1f('0x4a')]({'attributes':['id',_0xfe1f('0x4c')],'include':[{'model':db[_0xfe1f('0x4d')],'as':_0xfe1f('0x4e'),'where':{'id':LISTID}}]})[_0xfe1f('0x2d')](function(_0x5cf1f0){var _0x3f6214=[];if(_0x5cf1f0){for(var _0xa11d54=0x0,_0x9828d4;_0xa11d54<_0x5cf1f0[_0xfe1f('0x19')];_0xa11d54+=0x1){_0x9828d4=_0x5cf1f0[_0xa11d54][_0xfe1f('0x4f')]({'plain':!![]});switch(_0x9828d4[_0xfe1f('0x4c')]){case _0xfe1f('0x58'):_0x3f6214[_0xfe1f('0x50')](db[_0xfe1f('0x51')][_0xfe1f('0x52')](_0x2e5717(_0x9828d4,'CampaignId'))[_0xfe1f('0x2d')](function(){})[_0xfe1f('0x2e')](_0x2a32bf()));break;case _0xfe1f('0x53'):_0x3f6214[_0xfe1f('0x50')](db[_0xfe1f('0x51')][_0xfe1f('0x52')](_0x29afdb(_0x9828d4,_0xfe1f('0x59')))['then'](function(){})[_0xfe1f('0x2e')](_0x2a32bf()));break;default:_0x3f6214[_0xfe1f('0x50')](db[_0xfe1f('0x51')]['query'](_0x1e6f41(_0x9828d4,_0xfe1f('0x59')))[_0xfe1f('0x2d')](function(){})[_0xfe1f('0x2e')](_0x2a32bf()));}}}return _0x3f6214;})['all']();})[_0xfe1f('0x2d')](function(){return db[_0xfe1f('0x57')][_0xfe1f('0x4a')]({'attributes':['id'],'include':[{'model':db[_0xfe1f('0x4d')],'as':_0xfe1f('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x4b30c0){var _0x57de32=[];if(_0x4b30c0){for(var _0x4461ab=0x0,_0x1a575c;_0x4461ab<_0x4b30c0[_0xfe1f('0x19')];_0x4461ab+=0x1){_0x1a575c=_0x4b30c0[_0x4461ab][_0xfe1f('0x4f')]({'plain':!![]});_0x57de32[_0xfe1f('0x50')](db[_0xfe1f('0x51')][_0xfe1f('0x52')](_0xf70250(_0x1a575c,_0xfe1f('0x59')))[_0xfe1f('0x2d')](function(){})[_0xfe1f('0x2e')](_0x2a32bf()));}}return _0x57de32;})[_0xfe1f('0x55')]();})[_0xfe1f('0x2e')](function(_0x193910){logger[_0xfe1f('0x15')](_0xfe1f('0x5a'),_0xfe1f('0x5b'),_0x193910[_0xfe1f('0x5c')]);});}var processPromises=function(_0x1457e6){return BPromise[_0xfe1f('0x55')](promises)[_0xfe1f('0x2d')](function(_0x5ab24f){})[_0xfe1f('0x2e')](function(_0x37d417){logger[_0xfe1f('0x15')]('Error\x20processing\x20rows\x20block:',JSON[_0xfe1f('0x2f')](_0x37d417));})[_0xfe1f('0x5d')](function(){socket['emit'](_0xfe1f('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1457e6){return _0x1457e6[_0xfe1f('0x5f')]();}});};var endCsv=function(){return BPromise[_0xfe1f('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xfe1f('0x2d')](function(){socket[_0xfe1f('0x61')](_0xfe1f('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xfe1f('0x62')](FILEPATH);}catch(_0xc55418){logger['error'](_0xfe1f('0x63'),JSON['stringify'](_0xc55418));}finally{process[_0xfe1f('0x64')](0x0);}});};process['on'](_0xfe1f('0x65'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xfe1f('0x60')]()[_0xfe1f('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xfe1f('0x13')](',');return db['CmContact'][_0xfe1f('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xfe1f('0x2d')](function(_0x48e2b0){var _0x22c815=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfe1f('0x66')](_0x22c815,{'header':!![],'skipEmptyLines':!![],'step':function(_0xfba4bf,_0xe169d7){total+=0x1;var _0x56f1fa=total;promises[_0xfe1f('0x50')](checkRow(_0xfba4bf,_0x48e2b0,_0x56f1fa)['then'](function(){success+=0x1;})[_0xfe1f('0x2e')](function(_0x339ec2){if(_0x339ec2['error']){errors+=0x1;delete _0x339ec2[_0xfe1f('0x15')];}else if(_0x339ec2[_0xfe1f('0x2a')]){duplicates+=0x1;delete _0x339ec2[_0xfe1f('0x2a')];}rows[_0xfe1f('0x50')](_0x339ec2);}));if(total%0xc8===0x0){_0xe169d7[_0xfe1f('0x67')]();return processPromises(_0xe169d7);}},'complete':function(){return processPromises()[_0xfe1f('0x2d')](function(){logger[_0xfe1f('0x68')](_0xfe1f('0x69'));endCsv();});},'error':function(_0x25f6af,_0x419c26){logger[_0xfe1f('0x68')](_0xfe1f('0x6a'),JSON[_0xfe1f('0x2f')](_0x25f6af));endCsv();}});})[_0xfe1f('0x2e')](function(_0x287605){logger[_0xfe1f('0x15')](_0xfe1f('0x6b'),JSON['stringify'](_0x287605));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 8c6aaff..6486d36 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c08=['updated','CmContactHasItem','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','updatedAt','.CmListId\x20=\x20?','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','ContactId','insert','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','all','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','clone','root','.csv','includes','header','ContactItemType','name','parse','data','rows','find','_description','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','emit','contact:import:','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','argv','server/files/tmp','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','split','isNil','length','findOne','update'];(function(_0x3fb5a4,_0x9a5ce3){var _0x4f35dd=function(_0x199ccc){while(--_0x199ccc){_0x3fb5a4['push'](_0x3fb5a4['shift']());}};_0x4f35dd(++_0x9a5ce3);}(_0x6c08,0x98));var _0x86c0=function(_0x3f3ab3,_0x2508a5){_0x3f3ab3=_0x3f3ab3-0x0;var _0x435e73=_0x6c08[_0x3f3ab3];return _0x435e73;};'use strict';var fs=require('fs');var path=require(_0x86c0('0x0'));var _=require(_0x86c0('0x1'));var Papa=require('papaparse');var util=require(_0x86c0('0x2'));var BPromise=require(_0x86c0('0x3'));var moment=require(_0x86c0('0x4'));var squel=require(_0x86c0('0x5'));var Redis=require(_0x86c0('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x86c0('0x7'));var shared=require(_0x86c0('0x8'));var logger=require(_0x86c0('0x9'))(_0x86c0('0xa'));config[_0x86c0('0xb')]=_['defaults'](config[_0x86c0('0xb')],{'host':_0x86c0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x86c0('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x86c0('0xd')](_0x86c0('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x86c0('0xd')](_0x86c0('0xe'));function isEmail(_0x10ac02){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x10ac02);}function selectNotIn(_0x3857f4,_0x3a2e5f,_0x4c13aa,_0x25606f,_0x3dde28){return squel[_0x86c0('0xf')]()['field']('phone')[_0x86c0('0x10')](_0x25606f)[_0x86c0('0x11')](_0x3a2e5f,null,_0x3a2e5f+_0x86c0('0x12')+_0x25606f+'.'+_0x4c13aa)[_0x86c0('0x13')](_0x25606f+'.'+_0x4c13aa+'\x20=\x20'+_0x3857f4+'.'+_0x4c13aa)[_0x86c0('0x13')](_0x3a2e5f+_0x86c0('0x14')+_0x3dde28[_0x86c0('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5a4065,_0x15b0f8){promisesAdditionalPhones=[];return db[_0x86c0('0x15')][_0x86c0('0x16')]({'raw':!![],'attributes':['id',_0x86c0('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x86c0('0x18')](function(_0x100746){if(_0x100746!==null){var _0x3cbec2=[];for(var _0x1a36a1=0x0;_0x1a36a1<_0x100746['length'];_0x1a36a1++){var _0x53b313=_0x100746[_0x1a36a1];_0x3cbec2[_0x86c0('0x19')](insertAdditionalPhones(_0x53b313));}}Promise['all'](_0x3cbec2)[_0x86c0('0x18')](function(){_0x5a4065({'val':0x1});});});});}function insertAdditionalPhones(_0x1bdc72){return new Promise(function(_0x47872e,_0x50d2e2){var _0x2e5383=_0x1bdc72[_0x86c0('0x17')];var _0x453ec6=_0x2e5383[_0x86c0('0x1a')](';');var _0x1d36cc=[];orderBy=0x0;for(var _0x4ff281=0x0;_0x4ff281<_0x453ec6['length'];_0x4ff281++){_0x1d36cc[_0x86c0('0x19')](splitAdditionalPhone(_0x1bdc72['id'],_0x453ec6[_0x4ff281]));}Promise['all'](_0x1d36cc)[_0x86c0('0x18')](function(){_0x47872e({'val':_0x453ec6['length']});});});}function splitAdditionalPhone(_0x20877c,_0x8ee081){return new Promise(function(_0x46b66a,_0x3b9d87){var _0x13a0b8=_0x8ee081[_0x86c0('0x1a')](':');var _0x2525e2=_0x13a0b8[0x0];var _0x36cd23=_0x13a0b8[0x1];if(!_[_0x86c0('0x1b')](_0x36cd23)){var _0x235ad4=_0x36cd23[_0x86c0('0x1a')]('|');var _0x59ae48=[];for(var _0x55448e=0x0;_0x55448e<_0x235ad4[_0x86c0('0x1c')];_0x55448e++){if(_0x235ad4[_0x55448e]!==''){var _0x3fab93=_['filter'](promisesAdditionalPhones,{'contactId':_0x20877c,'phone':_0x235ad4[_0x55448e]});if(_0x3fab93[_0x86c0('0x1c')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x20877c,'contactTypeId':_0x2525e2,'phone':_0x235ad4[_0x55448e],'orderBy':orderBy});}}}_0x46b66a({'ok':0x1});}else _0x46b66a({'res':0x0});});}function createAdditionalPhone(_0x37d744,_0x2d6e14,_0x4eef2a,_0x27c6c4){var _0x3fa928='';var _0x1c46a5='';var _0x540171=_0x4eef2a[_0x86c0('0x1a')]('§');_0x3fa928=_0x540171[0x0];if(_0x540171[_0x86c0('0x1c')]==0x2)_0x1c46a5=_0x540171[0x1];return new Promise(function(_0x2fe30a,_0x4aa7bf){return db['CmContactHasItem'][_0x86c0('0x1d')]({'where':{'CmContactId':_0x37d744,'item':_0x3fa928}})[_0x86c0('0x18')](function(_0x360d48){if(_0x360d48){return db['CmContactHasItem'][_0x86c0('0x1e')]({'ItemTypeId':_0x2d6e14,'description':_0x1c46a5,'OrderBy':_0x27c6c4},{'where':{'CmContactId':_0x37d744,'item':_0x3fa928}})[_0x86c0('0x18')](function(_0x5b87a5){_0x2fe30a({'res':_0x86c0('0x1f')});});}else{return db[_0x86c0('0x20')][_0x86c0('0x21')]({'CmContactId':_0x37d744,'item':_0x3fa928,'description':_0x1c46a5,'ItemTypeId':_0x2d6e14,'OrderBy':_0x27c6c4,'ItemClass':_0x86c0('0x22')})[_0x86c0('0x18')](function(_0x31564f){_0x2fe30a({'res':_0x86c0('0x23')});});}});});}function insertCmHopper(_0x5b82d6,_0x26ddce,_0x17733e,_0x148456,_0x338a2b){var _0xae8d70=[_0x86c0('0x24'),_0x86c0('0x25'),_0x86c0('0x26'),'cm_contacts.ListId',_0x26ddce+'.'+_0x148456,_0x86c0('0x27'),_0x86c0('0x28'),_0x86c0('0x29'),_0x86c0('0x2a'),'\x22'+_0x338a2b+'\x22'];return squel['insert']()[_0x86c0('0x2b')]('cm_hopper')[_0x86c0('0x2c')](['phone',_0x86c0('0x2d'),'ContactId',_0x86c0('0x2e'),_0x148456,_0x86c0('0x2f'),'updatedAt',_0x86c0('0x30'),_0x86c0('0x31'),_0x86c0('0x32')],squel[_0x86c0('0xf')]()[_0x86c0('0x33')](_0xae8d70)[_0x86c0('0x10')](_0x26ddce)[_0x86c0('0x11')](_0x86c0('0x34'),null,_0x86c0('0x35')+_0x26ddce+_0x86c0('0x36'))[_0x86c0('0x11')](_0x17733e,null,_0x17733e+'.id\x20=\x20'+_0x26ddce+'.'+_0x148456)[_0x86c0('0x13')](_0x26ddce+'.CmListId\x20=\x20?',_0x5b82d6)[_0x86c0('0x13')](_0x86c0('0x37'),NOW)['where'](_0x86c0('0x38'),selectNotIn(_0x26ddce,_0x17733e,_0x148456,_0x86c0('0x39'),[_0x86c0('0x3a'),_0x86c0('0x3b')]))[_0x86c0('0x13')](_0x86c0('0x38'),selectNotIn(_0x26ddce,_0x17733e,_0x148456,_0x86c0('0x39'),['\x22always\x22'])))[_0x86c0('0x3c')]();}function insertCmHopperBlack(_0x790aad,_0x19c6db,_0x22fb98,_0x59e6ac){var _0x2ecc72=[_0x86c0('0x24'),_0x86c0('0x26'),_0x86c0('0x3d'),_0x19c6db+'.'+_0x59e6ac,_0x86c0('0x27'),_0x86c0('0x28')];return squel['insert']()[_0x86c0('0x2b')](_0x86c0('0x3e'))[_0x86c0('0x2c')]([_0x86c0('0x3f'),'ContactId',_0x86c0('0x2e'),_0x59e6ac,_0x86c0('0x2f'),_0x86c0('0x40')],squel[_0x86c0('0xf')]()['fields'](_0x2ecc72)[_0x86c0('0x10')](_0x19c6db)[_0x86c0('0x11')](_0x86c0('0x34'),null,_0x86c0('0x35')+_0x19c6db+_0x86c0('0x36'))[_0x86c0('0x11')](_0x22fb98,null,_0x22fb98+_0x86c0('0x12')+_0x19c6db+'.'+_0x59e6ac)[_0x86c0('0x13')](_0x19c6db+_0x86c0('0x41'),_0x790aad)[_0x86c0('0x13')](_0x86c0('0x37'),NOW)[_0x86c0('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x86c0('0x42')](_0x86c0('0x3f'))['from'](_0x86c0('0x3e'))[_0x86c0('0x13')](_0x86c0('0x43'),_0x790aad)['where'](_0x59e6ac+'\x20=\x20'+_0x19c6db+'.'+_0x59e6ac)))[_0x86c0('0x3c')]();}function insertTzCmHopper(_0x4a9318,_0x580e61,_0x5bda38,_0x2f0085,_0x1ca419,_0x11f8de){var _0x20d9d3=[_0x86c0('0x24'),_0x86c0('0x44')+_0x11f8de+'.offset-cm_contacts.utcOffset\x20minute)',_0x86c0('0x26'),'cm_contacts.ListId',_0x580e61+'.'+_0x2f0085,_0x86c0('0x27'),_0x86c0('0x28'),_0x86c0('0x29'),_0x86c0('0x2a'),'\x22'+_0x1ca419+'\x22'];var _0x1d597f=squel['insert']()[_0x86c0('0x2b')](_0x86c0('0x39'))[_0x86c0('0x2c')]([_0x86c0('0x3f'),_0x86c0('0x2d'),_0x86c0('0x45'),_0x86c0('0x2e'),_0x2f0085,'createdAt',_0x86c0('0x40'),_0x86c0('0x30'),'UserId',_0x86c0('0x32')],squel['select']()[_0x86c0('0x33')](_0x20d9d3)[_0x86c0('0x10')](_0x580e61)[_0x86c0('0x11')](_0x86c0('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x580e61+_0x86c0('0x36'))[_0x86c0('0x11')](_0x5bda38,null,_0x5bda38+'.id\x20=\x20'+_0x580e61+'.'+_0x2f0085)['join'](_0x11f8de,null,_0x11f8de+_0x86c0('0x12')+_0x580e61+'.'+_0x2f0085)[_0x86c0('0x13')](_0x580e61+_0x86c0('0x41'),_0x4a9318)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x86c0('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x580e61,_0x5bda38,_0x2f0085,_0x86c0('0x39'),[_0x86c0('0x3a'),_0x86c0('0x3b')]))[_0x86c0('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x580e61,_0x5bda38,_0x2f0085,_0x86c0('0x39'),[_0x86c0('0x3a')])))[_0x86c0('0x3c')]();return _0x1d597f;}function insertTzCmHopperBlack(_0x2c7009,_0x5099e8,_0x38cf54,_0x245727){var _0x2d226d=[_0x86c0('0x24'),_0x86c0('0x26'),'cm_contacts.ListId',_0x5099e8+'.'+_0x245727,'cm_contacts.createdAt',_0x86c0('0x28')];return squel[_0x86c0('0x46')]()[_0x86c0('0x2b')](_0x86c0('0x3e'))[_0x86c0('0x2c')]([_0x86c0('0x3f'),_0x86c0('0x45'),_0x86c0('0x2e'),_0x245727,_0x86c0('0x2f'),'updatedAt'],squel[_0x86c0('0xf')]()['fields'](_0x2d226d)['from'](_0x5099e8)[_0x86c0('0x11')]('cm_contacts',null,_0x86c0('0x35')+_0x5099e8+_0x86c0('0x36'))[_0x86c0('0x11')](_0x38cf54,null,_0x38cf54+_0x86c0('0x12')+_0x5099e8+'.'+_0x245727)[_0x86c0('0x13')](_0x5099e8+_0x86c0('0x41'),_0x2c7009)[_0x86c0('0x13')](_0x86c0('0x37'),NOW)[_0x86c0('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x86c0('0x42')](_0x86c0('0x3f'))[_0x86c0('0x10')](_0x86c0('0x3e'))[_0x86c0('0x13')](_0x86c0('0x43'),_0x2c7009)[_0x86c0('0x13')](_0x245727+_0x86c0('0x47')+_0x5099e8+'.'+_0x245727)))[_0x86c0('0x3c')]();}function insertCmHopperAdditionalPhones(_0x23dbf2){var _0xc94604=[_0x86c0('0x48'),_0x86c0('0x49'),_0x86c0('0x4a'),'cm_contact_has_items.createdAt',_0x86c0('0x4b')];return squel[_0x86c0('0x46')]()[_0x86c0('0x2b')](_0x86c0('0x4c'))[_0x86c0('0x2c')]([_0x86c0('0x4d'),_0x86c0('0x3f'),_0x86c0('0x4e'),'createdAt','updatedAt'],squel[_0x86c0('0xf')]()[_0x86c0('0x33')](_0xc94604)['from'](_0x86c0('0x39'))[_0x86c0('0x11')](_0x86c0('0x34'),null,_0x86c0('0x4f'))['join'](_0x86c0('0x50'),null,_0x86c0('0x51'))[_0x86c0('0x13')](_0x86c0('0x52'),_0x23dbf2)['where'](_0x86c0('0x37'),NOW))[_0x86c0('0x3c')]();}function insertCmContact(_0x3d8c06,_0x49107a,_0x304961,_0x3dc6f8){var _0x372e2a=_[_0x86c0('0x53')](_[_0x86c0('0x54')](_0x3dc6f8),['ListId',_0x86c0('0x55'),_0x86c0('0x2f'),'updatedAt',_0x86c0('0x56')]);return squel[_0x86c0('0x46')]()['into']('cm_contacts')[_0x86c0('0x2c')](_0x372e2a,squel[_0x86c0('0xf')]()[_0x86c0('0x33')](_0x372e2a)[_0x86c0('0x10')](_0x49107a)[_0x86c0('0x13')]('('+_0x304961[_0x86c0('0x11')](',')+_0x86c0('0x57'),squel[_0x86c0('0xf')]()[_0x86c0('0x33')](_0x304961)[_0x86c0('0x10')](_0x86c0('0x34'))[_0x86c0('0x13')]('ListId\x20=\x20?',_0x3d8c06)[_0x86c0('0x13')](_0x86c0('0x58')))[_0x86c0('0x13')](_0x86c0('0x59'),squel[_0x86c0('0xf')]()[_0x86c0('0x42')](_0x86c0('0x5a'),'min_id')['from'](_0x49107a)[_0x86c0('0x5b')](_0x304961[_0x86c0('0x11')](','))))['toString']();}function handleStop(){logger[_0x86c0('0x5c')](_0x86c0('0x5d'));stopped=!![];}function handleUncaughtException(_0x39bdcb){logger[_0x86c0('0x5e')](_0x39bdcb[_0x86c0('0x5f')]);process[_0x86c0('0x60')](0x1);}function handleError(_0x502603,_0x37e73e){stats[_0x86c0('0x61')][_0x86c0('0x19')]({'name':_0x37e73e[_0x86c0('0x62')],'message':_0x37e73e['message'],'row':_0x502603});}function handleQuery(_0x443fa1){logger[_0x86c0('0x5c')](_0x443fa1);return db[_0x86c0('0x63')][_0x86c0('0x64')](_0x443fa1)[_0x86c0('0x65')](function(_0xa15a9){results[_0x86c0('0x19')](_0xa15a9);})[_0x86c0('0x66')](function(_0x322b09){logger[_0x86c0('0x5e')](_0x322b09[_0x86c0('0x5f')]);});}function updateTzCampaigns(_0x27059f){return new Promise(function(_0x48f896,_0x47c1bf){var _0x2ab488=squel[_0x86c0('0xf')]()[_0x86c0('0x33')]([_0x86c0('0x67'),_0x86c0('0x68')])['from']('campaigns')['join']('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x86c0('0x13')]('campaigns_has_cm_lists.CmListId='+_0x27059f);db['sequelize'][_0x86c0('0x64')](_0x2ab488['toString']())[_0x86c0('0x65')](function(_0x5ae1b0){var _0x49958f=[];for(var _0x38c9f5=0x0;_0x38c9f5<_0x5ae1b0['length'];_0x38c9f5++){_0x49958f[_0x86c0('0x19')](getTimezoneData(_0x5ae1b0[_0x38c9f5],tmp_campaigns));}BPromise[_0x86c0('0x69')](_0x49958f)[_0x86c0('0x18')](function(){_0x48f896({'val':0x1});});})['catch'](function(_0x42fe94){logger[_0x86c0('0x5e')](_0x42fe94[_0x86c0('0x5f')]);_0x48f896({'val':0x0});});});}function updateTzVoiceQueues(_0x475251){return new Promise(function(_0x33ce7b,_0x2533f7){var _0x5e1e7a=squel['select']()['fields']([_0x86c0('0x6a'),_0x86c0('0x6b')])[_0x86c0('0x10')](_0x86c0('0x6c'))[_0x86c0('0x11')]('voice_queues_has_cm_lists',null,_0x86c0('0x6d'))['where']('voice_queues_has_cm_lists.CmListId='+_0x475251);db[_0x86c0('0x63')][_0x86c0('0x64')](_0x5e1e7a[_0x86c0('0x3c')]())[_0x86c0('0x65')](function(_0x34f12f){var _0x5b079f=[];for(var _0xe2feb4=0x0;_0xe2feb4<_0x34f12f['length'];_0xe2feb4++){_0x5b079f['push'](getTimezoneData(_0x34f12f[_0xe2feb4],tmp_voice_queues));}BPromise[_0x86c0('0x69')](_0x5b079f)[_0x86c0('0x18')](function(){_0x33ce7b({'val':0x1});});})[_0x86c0('0x66')](function(_0x25d259){logger['error'](_0x25d259[_0x86c0('0x5f')]);_0x33ce7b({'val':0x0});});});}function getTimezoneData(_0x1e9f6f,_0x2cec7d){return new Promise(function(_0x95fccd,_0x285460){var _0x46b3d5=shared[_0x86c0('0x6e')];var _0x2768cb=_0x46b3d5[_0x1e9f6f[_0x86c0('0x6f')]];if(_[_0x86c0('0x1b')](_0x2768cb)){_0x95fccd({'ret':0x1});}else{var _0x4e5c40=_0x2768cb[_0x86c0('0x70')];var _0x2065d3=squel['insert']()[_0x86c0('0x2b')](_0x2cec7d)[_0x86c0('0x71')]('id',_0x1e9f6f['id'])['set'](_0x86c0('0x72'),_0x4e5c40)['set']('dialTimezone',_0x1e9f6f['dialTimezone'])[_0x86c0('0x3c')]();return db[_0x86c0('0x63')]['query'](_0x2065d3)['spread'](function(_0x423b6c){_0x95fccd({'ret':0x1});})[_0x86c0('0x66')](function(_0x171e19){logger[_0x86c0('0x5e')](_0x171e19[_0x86c0('0x5f')]);_0x285460({'ret':0x1});});}});}function handleTZQuery(_0x4d6d11){logger['info'](_0x4d6d11);return db[_0x86c0('0x63')][_0x86c0('0x64')](_0x4d6d11)[_0x86c0('0x65')](function(_0xabf65b){})['catch'](function(_0xd05b9d){logger[_0x86c0('0x5e')](_0xd05b9d[_0x86c0('0x5f')]);});}function main(_0x1fcd6f,_0x33a75d,_0x4c26fa,_0x38a996){logger[_0x86c0('0x5c')](_0x86c0('0x73'),_0x1fcd6f,JSON[_0x86c0('0x74')](_0x33a75d));process[_0x86c0('0x75')](_0x86c0('0x76'));var _0xbfdc57=_0x33a75d[_0x86c0('0x77')];var _0x308458=_[_0x86c0('0x78')](_0xbfdc57);var _0x107f70=_0x33a75d['socket_timestamp'];var _0x15c664=path[_0x86c0('0x11')](config[_0x86c0('0x79')],'server/files/tmp',_0x107f70+_0x86c0('0x7a'));hasTZ=_[_0x86c0('0x54')](_0xbfdc57)[_0x86c0('0x7b')](_0x86c0('0x6f'));var _0x1af517=_[_0x86c0('0x54')](_0xbfdc57)['join']();logger['info'](_0x86c0('0x7c'),_0x1af517);db[_0x86c0('0x7d')]['findAll']({'raw':!![],'attributes':['id',_0x86c0('0x7e')]})[_0x86c0('0x18')](function(_0x2f301d){for(var _0x209f71=0x0;_0x209f71<_0x2f301d[_0x86c0('0x1c')];_0x209f71++){if(_0x2f301d[_0x209f71][_0x86c0('0x7e')]in _0xbfdc57){contactItemTypes[_0x86c0('0x19')](_0x2f301d[_0x209f71]);delete _0x308458[_0x2f301d[_0x209f71][_0x86c0('0x7e')]];hasAdditionalPhones=!![];}for(var _0x4e0caf in _0xbfdc57){if(_0x2f301d[_0x209f71][_0x86c0('0x7e')]+'_description'===_0x4e0caf){phoneDescriptions[_0x86c0('0x19')]({'itemTypeId':_0x2f301d[_0x209f71]['id'],'description':_0x4e0caf});delete _0x308458[_0x4e0caf];}}}if(hasAdditionalPhones)_0x308458['AdditionalPhones']='';var _0xfc7880=_[_0x86c0('0x54')](_0x308458)[_0x86c0('0x11')]();logger[_0x86c0('0x5c')](_0x86c0('0x7c'),_0xfc7880);fs['writeFileSync'](_0x15c664,_0xfc7880+'\x0a');Papa[_0x86c0('0x7f')](fs['createReadStream'](_0x1fcd6f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x16bafc,_0x42d27d){try{for(var _0x44b572=0x0,_0x5b4afa=[];_0x44b572<_0x16bafc[_0x86c0('0x80')][_0x86c0('0x1c')];_0x44b572++){stats[_0x86c0('0x81')]+=0x1;if(_0x16bafc[_0x86c0('0x61')][_0x44b572]){handleError(_0x16bafc['data'][_0x44b572],_0x16bafc[_0x86c0('0x61')][_0x44b572]);}else{var _0x2889b1=[];var _0x4f89f5=[];var _0x5ee970={};for(var _0x51dd86 in _0xbfdc57){let _0x29eb8c=contactItemTypes[_0x86c0('0x82')](_0x19cd10=>_0x19cd10[_0x86c0('0x7e')]===_0x51dd86);let _0x3b7509=contactItemTypes[_0x86c0('0x82')](_0x5528a0=>_0x5528a0[_0x86c0('0x7e')]+_0x86c0('0x83')===_0x51dd86);if(_[_0x86c0('0x1b')](_0x29eb8c)&&_[_0x86c0('0x1b')](_0x3b7509)){if(_0xbfdc57[_0x86c0('0x84')](_0x51dd86)){if(_0x16bafc[_0x86c0('0x80')][_0x44b572][_0xbfdc57[_0x51dd86]]){var _0x4285a9=_[_0x86c0('0x85')](_0x16bafc[_0x86c0('0x80')][_0x44b572][_0xbfdc57[_0x51dd86]][_0x86c0('0x86')](/"/g,'\x27'));switch(_0x51dd86){case _0x86c0('0x2d'):var _0x47f8cc=moment(_0x4285a9,_0x86c0('0xe'),!![]);if(_0x47f8cc[_0x86c0('0x87')]()){_0x5b4afa[_0x86c0('0x19')]('\x22'+_0x4285a9+'\x22');}else{_0x2889b1['push'](_0x86c0('0x88'));}break;case _0x86c0('0x30'):var _0xbbbfee=parseInt(_0x4285a9);_0x4285a9=_['isNaN'](_0xbbbfee)||_0xbbbfee<0x0||_0xbbbfee>0x4?_0x38a996?0x3:0x2:_0xbbbfee;_0x5b4afa[_0x86c0('0x19')]('\x22'+_0x4285a9+'\x22');break;case _0x86c0('0x31'):var _0x12e312=parseInt(_0x4285a9);if(_[_0x86c0('0x89')](_0x12e312)&&_['includes'](_0x4c26fa,_0x12e312)){_0x5b4afa[_0x86c0('0x19')]('\x22'+_0x12e312+'\x22');}else{_0x2889b1['push']('agent\x20not\x20exists');}break;case _0x86c0('0x8a'):if(isEmail(_0x4285a9)){_0x5b4afa[_0x86c0('0x19')]('\x22'+_0x4285a9+'\x22');}else{_0x2889b1[_0x86c0('0x19')](_0x86c0('0x8b'));}break;case _0x86c0('0x8c'):var _0x54a46b=moment(_0x4285a9,_0x86c0('0x8d'),!![]);if(_0x54a46b[_0x86c0('0x87')]()){_0x5b4afa['push']('\x22'+_0x4285a9+'\x22');}else{_0x2889b1[_0x86c0('0x19')](_0x86c0('0x8e'));}break;case _0x86c0('0x6f'):var _0x4e4813=shared[_0x86c0('0x6e')];var _0xade90f=_0x4e4813[_0x4285a9];if(!_[_0x86c0('0x1b')](_0xade90f)){var _0x19833c=_0xade90f[_0x86c0('0x70')];_0x5b4afa[_0x86c0('0x19')]('\x22'+_0x4285a9+'\x22');_0x5b4afa['push']('\x22'+_0x19833c+'\x22');}break;default:_0x5b4afa[_0x86c0('0x19')]('\x22'+_0x4285a9+'\x22');}}else{switch(_0x51dd86){case _0x86c0('0x8f'):case _0x86c0('0x3f'):_0x2889b1[_0x86c0('0x19')](_0x51dd86+_0x86c0('0x90'));break;default:_0x5b4afa[_0x86c0('0x19')]('\x22\x22');}}}}else{var _0x3e9673='';if(!_[_0x86c0('0x1b')](_0x29eb8c)){if(!_0x5ee970[_0x86c0('0x84')](_0x29eb8c['id'])){if(!_[_0x86c0('0x1b')](_0x16bafc[_0x86c0('0x80')][_0x44b572][_0xbfdc57[_0x51dd86]])){var _0x4285a9=_[_0x86c0('0x85')](_0x16bafc[_0x86c0('0x80')][_0x44b572][_0xbfdc57[_0x51dd86]][_0x86c0('0x86')](/"/g,'\x27'));var _0x4237d5=phoneDescriptions[_0x86c0('0x82')](_0x1db8c2=>_0x1db8c2[_0x86c0('0x91')]===_0x29eb8c['id']);if(!_[_0x86c0('0x1b')](_0x4237d5)){var _0xb81df6=_[_0x86c0('0x85')](_0x16bafc['data'][_0x44b572][_0xbfdc57[_0x4237d5[_0x86c0('0x92')]]][_0x86c0('0x86')](/"/g,'\x27'));if(!_[_0x86c0('0x1b')](_0xb81df6))_0x4285a9=_0x4285a9+'§'+_0xb81df6;}if(_0x3e9673=='')_0x3e9673=_0x4285a9;else _0x3e9673+='|'+_0x4285a9;}_0x4f89f5[_0x86c0('0x19')](_0x29eb8c['id']+':'+_0x3e9673);_0x5ee970[_0x29eb8c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5b4afa[_0x86c0('0x19')]('\x22'+_0x4f89f5['join'](';')+'\x22');}if(_0x2889b1[_0x86c0('0x1c')]){handleError(_0x16bafc['data'][_0x44b572],{'code':_0x86c0('0x93'),'message':_0x2889b1[_0x86c0('0x11')]()});}else{fs['appendFileSync'](_0x15c664,_0x5b4afa[_0x86c0('0x11')]()+'\x0a');}_0x5b4afa=[];}if(!(stats[_0x86c0('0x81')]%0xc8)){socket[_0x86c0('0x94')](_0x86c0('0x95')+_0x107f70,stats);stats[_0x86c0('0x61')]=[];}}if(stopped){logger[_0x86c0('0x5c')]('Abort\x20parser');_0x42d27d['abort']();}}catch(_0x22584a){handleError(_0x16bafc['data'][_0x44b572],{'code':'SystemError','message':_0x22584a[_0x86c0('0x5f')]});logger[_0x86c0('0x5e')](_0x86c0('0x96'),_0x22584a[_0x86c0('0x5f')]);}},'complete':function(){try{var _0x3ec2f1=[];var _0x50c7ea=[];var _0x22512a=_0x86c0('0x34');if(_0x33a75d[_0x86c0('0x97')]&&_0x33a75d[_0x86c0('0x97')]['length']){_0x22512a=_0x86c0('0x98')+_0x107f70;_0x3ec2f1[_0x86c0('0x19')](_0x86c0('0x99')+_0x22512a+_0x86c0('0x9a'));}tmp_campaigns=_0x86c0('0x9b')+_0x107f70;tmp_voice_queues=_0x86c0('0x9c')+_0x107f70;_0x50c7ea[_0x86c0('0x19')](_0x86c0('0x99')+tmp_campaigns+_0x86c0('0x9d'));_0x50c7ea[_0x86c0('0x19')](_0x86c0('0x99')+tmp_voice_queues+_0x86c0('0x9d'));BPromise[_0x86c0('0x9e')](_0x50c7ea,handleTZQuery)['then'](function(_0x26375c){updateTzCampaigns(_0x33a75d[_0x86c0('0x2e')])['then'](function(_0x27963f){updateTzVoiceQueues(_0x33a75d[_0x86c0('0x2e')])[_0x86c0('0x18')](function(_0x396e62){if(hasTZ)_0xfc7880=_0xfc7880['replace'](_0x86c0('0x6f'),_0x86c0('0x9f'));var _0x3480b5=util[_0x86c0('0xd')](_0x86c0('0xa0'),_0x15c664,_0x22512a,_0xfc7880,_0x33a75d[_0x86c0('0x2e')],_0x33a75d['CompanyId']||null,NOW,NOW);if(_[_0x86c0('0x1b')](_0xbfdc57[_0x86c0('0x2d')])){_0x3480b5+=',\x20scheduledAt\x20=\x20NOW()';}_0x3ec2f1['push'](_0x3480b5);if(_0x33a75d[_0x86c0('0x97')]&&_0x33a75d[_0x86c0('0x97')][_0x86c0('0x1c')]){_0x3ec2f1[_0x86c0('0x19')](insertCmContact(_0x33a75d[_0x86c0('0x2e')],_0x22512a,_0x33a75d[_0x86c0('0x97')],_0xbfdc57));_0x3ec2f1[_0x86c0('0x19')](_0x86c0('0xa1')+_0x22512a+';');}BPromise[_0x86c0('0x9e')](_0x3ec2f1,handleQuery)[_0x86c0('0x18')](function(_0x5c6b96){BPromise[_0x86c0('0x69')]([handleAdditionalPhones()])[_0x86c0('0x18')](function(){_0x3ec2f1=[];for(var _0x5ee7b1=0x0;_0x5ee7b1\x20\x20');}var _0x4dd11b=path[_0x86c0('0x11')](config[_0x86c0('0x79')],_0x86c0('0xaf'),process['argv'][0x2]);if(!fs['existsSync'](_0x4dd11b)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x59b749={};try{_0x59b749=JSON[_0x86c0('0x7f')](process['argv'][0x3]);if(!_0x59b749['binding']){throw new Error(_0x86c0('0xb0'));}if(!_0x59b749[_0x86c0('0x77')]['phone']){throw new Error(_0x86c0('0xb1'));}if(!_0x59b749['binding'][_0x86c0('0x8f')]){throw new Error(_0x86c0('0xb2'));}var _0x31c4af=0x0;if(_0x59b749[_0x86c0('0x77')][_0x86c0('0x31')]){_0x31c4af=0x1;}if(!_0x59b749[_0x86c0('0x2e')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x33a7db){throw new Error(_0x86c0('0xb3'));}var _0x518842=[];try{_0x518842=_[_0x86c0('0xb4')](JSON[_0x86c0('0x7f')](process[_0x86c0('0xae')][0x4]),'id');}catch(_0x10b3da){logger[_0x86c0('0x5c')]('No\x20agent\x20available');}main(_0x4dd11b,_0x59b749,_0x518842,_0x31c4af);}validate();process['on'](_0x86c0('0xb5'),handleStop);process['on'](_0x86c0('0xb6'),handleUncaughtException); \ No newline at end of file +var _0x981b=['existsSync','binding\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','SIGINT','uncaughtException','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','then','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','fromQuery','ContactId','createdAt','updatedAt','recallme','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','ListId','fields','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','priority','UserId','cm_contacts','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','Received\x20SIGINT','error','message','exit','code','info','sequelize','query','catch','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','utcOffset','set','offset','main','stringify','send','clone','socket_timestamp','root','server/files/tmp','.csv','includes','ContactItemType','name','_description','writeFileSync','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','complete','argv','arguments\x20\x20\x20'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x981b,0xbf));var _0xb981=function(_0x1281d6,_0x37b086){_0x1281d6=_0x1281d6-0x0;var _0x1feb3c=_0x981b[_0x1281d6];return _0x1feb3c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xb981('0x0'));var Papa=require(_0xb981('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0xb981('0x2'));var db=require(_0xb981('0x3'))['db'];var config=require(_0xb981('0x4'));var shared=require(_0xb981('0x5'));var logger=require(_0xb981('0x6'))(_0xb981('0x7'));config[_0xb981('0x8')]=_[_0xb981('0x9')](config['redis'],{'host':_0xb981('0xa'),'port':0x18eb});var socket=require(_0xb981('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xb981('0xc')](_0xb981('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xb981('0xc')](_0xb981('0xd'));function isEmail(_0x514aa0){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x514aa0);}function selectNotIn(_0x5cf6c5,_0x562ba8,_0x315b29,_0x525abb,_0x369a21){return squel[_0xb981('0xe')]()[_0xb981('0xf')](_0xb981('0x10'))[_0xb981('0x11')](_0x525abb)[_0xb981('0x12')](_0x562ba8,null,_0x562ba8+_0xb981('0x13')+_0x525abb+'.'+_0x315b29)[_0xb981('0x14')](_0x525abb+'.'+_0x315b29+'\x20=\x20'+_0x5cf6c5+'.'+_0x315b29)[_0xb981('0x14')](_0x562ba8+_0xb981('0x15')+_0x369a21[_0xb981('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x34243c,_0x2e5214){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0xb981('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4c7978){if(_0x4c7978!==null){var _0x37a7e7=[];for(var _0x88bfe0=0x0;_0x88bfe0<_0x4c7978[_0xb981('0x17')];_0x88bfe0++){var _0x3b8b00=_0x4c7978[_0x88bfe0];_0x37a7e7[_0xb981('0x18')](insertAdditionalPhones(_0x3b8b00));}}Promise[_0xb981('0x19')](_0x37a7e7)['then'](function(){_0x34243c({'val':0x1});});});});}function insertAdditionalPhones(_0x57f7c1){return new Promise(function(_0x3a9d3b,_0x1c7841){var _0x511630=_0x57f7c1[_0xb981('0x16')];var _0x18046f=_0x511630['split'](';');var _0x121329=[];orderBy=0x0;for(var _0x32abb9=0x0;_0x32abb9<_0x18046f['length'];_0x32abb9++){_0x121329[_0xb981('0x18')](splitAdditionalPhone(_0x57f7c1['id'],_0x18046f[_0x32abb9]));}Promise[_0xb981('0x19')](_0x121329)['then'](function(){_0x3a9d3b({'val':_0x18046f['length']});});});}function splitAdditionalPhone(_0x1e67c5,_0x29e1ca){return new Promise(function(_0x24dd77,_0x1d81fe){var _0x4c8faf=_0x29e1ca[_0xb981('0x1a')](':');var _0x109091=_0x4c8faf[0x0];var _0x138307=_0x4c8faf[0x1];if(!_[_0xb981('0x1b')](_0x138307)){var _0x2c404e=_0x138307[_0xb981('0x1a')]('|');var _0x504bbb=[];for(var _0x29a8ce=0x0;_0x29a8ce<_0x2c404e['length'];_0x29a8ce++){if(_0x2c404e[_0x29a8ce]!==''){var _0x3ad057=_[_0xb981('0x1c')](promisesAdditionalPhones,{'contactId':_0x1e67c5,'phone':_0x2c404e[_0x29a8ce]});if(_0x3ad057[_0xb981('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0xb981('0x18')]({'contactId':_0x1e67c5,'contactTypeId':_0x109091,'phone':_0x2c404e[_0x29a8ce],'orderBy':orderBy});}}}_0x24dd77({'ok':0x1});}else _0x24dd77({'res':0x0});});}function createAdditionalPhone(_0xee9a45,_0x3ef8bd,_0x3b1fcc,_0x524b9){var _0x17fcb3='';var _0x5b6bf2='';var _0x3d49f6=_0x3b1fcc['split']('§');_0x17fcb3=_0x3d49f6[0x0];if(_0x3d49f6[_0xb981('0x17')]==0x2)_0x5b6bf2=_0x3d49f6[0x1];return new Promise(function(_0x1ee05e,_0x223d39){return db[_0xb981('0x1d')][_0xb981('0x1e')]({'where':{'CmContactId':_0xee9a45,'item':_0x17fcb3}})['then'](function(_0x4fffff){if(_0x4fffff){return db[_0xb981('0x1d')][_0xb981('0x1f')]({'ItemTypeId':_0x3ef8bd,'description':_0x5b6bf2,'OrderBy':_0x524b9},{'where':{'CmContactId':_0xee9a45,'item':_0x17fcb3}})[_0xb981('0x20')](function(_0x12fc7f){_0x1ee05e({'res':_0xb981('0x21')});});}else{return db[_0xb981('0x1d')][_0xb981('0x22')]({'CmContactId':_0xee9a45,'item':_0x17fcb3,'description':_0x5b6bf2,'ItemTypeId':_0x3ef8bd,'OrderBy':_0x524b9,'ItemClass':_0xb981('0x23')})['then'](function(_0x3bc7c8){_0x1ee05e({'res':_0xb981('0x24')});});}});});}function insertCmHopper(_0x2b180b,_0x4cb952,_0xb9cebb,_0x5743ae,_0x596e4d){var _0x219a9f=[_0xb981('0x25'),_0xb981('0x26'),_0xb981('0x27'),_0xb981('0x28'),_0x4cb952+'.'+_0x5743ae,_0xb981('0x29'),_0xb981('0x2a'),'cm_contacts.priority',_0xb981('0x2b'),'\x22'+_0x596e4d+'\x22'];return squel[_0xb981('0x2c')]()[_0xb981('0x2d')]('cm_hopper')[_0xb981('0x2e')]([_0xb981('0x10'),'scheduledat',_0xb981('0x2f'),'ListId',_0x5743ae,_0xb981('0x30'),_0xb981('0x31'),'priority','UserId',_0xb981('0x32')],squel[_0xb981('0xe')]()['fields'](_0x219a9f)['from'](_0x4cb952)['join']('cm_contacts',null,_0xb981('0x33')+_0x4cb952+_0xb981('0x34'))['join'](_0xb9cebb,null,_0xb9cebb+_0xb981('0x13')+_0x4cb952+'.'+_0x5743ae)[_0xb981('0x14')](_0x4cb952+_0xb981('0x35'),_0x2b180b)['where'](_0xb981('0x36'),NOW)[_0xb981('0x14')](_0xb981('0x37'),selectNotIn(_0x4cb952,_0xb9cebb,_0x5743ae,_0xb981('0x38'),[_0xb981('0x39'),_0xb981('0x3a')]))[_0xb981('0x14')](_0xb981('0x37'),selectNotIn(_0x4cb952,_0xb9cebb,_0x5743ae,'cm_hopper',['\x22always\x22'])))[_0xb981('0x3b')]();}function insertCmHopperBlack(_0x25db9a,_0x1c00c1,_0xcc7437,_0x5178ea){var _0x1ac3e8=['cm_contacts.phone',_0xb981('0x27'),_0xb981('0x28'),_0x1c00c1+'.'+_0x5178ea,_0xb981('0x29'),_0xb981('0x2a')];return squel[_0xb981('0x2c')]()[_0xb981('0x2d')]('cm_hopper_black')[_0xb981('0x2e')]([_0xb981('0x10'),_0xb981('0x2f'),_0xb981('0x3c'),_0x5178ea,'createdAt','updatedAt'],squel[_0xb981('0xe')]()[_0xb981('0x3d')](_0x1ac3e8)['from'](_0x1c00c1)[_0xb981('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1c00c1+_0xb981('0x34'))['join'](_0xcc7437,null,_0xcc7437+'.id\x20=\x20'+_0x1c00c1+'.'+_0x5178ea)[_0xb981('0x14')](_0x1c00c1+'.CmListId\x20=\x20?',_0x25db9a)[_0xb981('0x14')](_0xb981('0x36'),NOW)[_0xb981('0x14')](_0xb981('0x37'),squel[_0xb981('0xe')]()[_0xb981('0xf')](_0xb981('0x10'))[_0xb981('0x11')](_0xb981('0x3e'))[_0xb981('0x14')](_0xb981('0x3f'),_0x25db9a)[_0xb981('0x14')](_0x5178ea+'\x20=\x20'+_0x1c00c1+'.'+_0x5178ea)))['toString']();}function insertTzCmHopper(_0x417f8e,_0x4a7c37,_0x5b3cd2,_0x26279b,_0x10888b,_0x570af7){var _0x5b8cce=[_0xb981('0x25'),_0xb981('0x40')+_0x570af7+_0xb981('0x41'),_0xb981('0x27'),_0xb981('0x28'),_0x4a7c37+'.'+_0x26279b,'cm_contacts.createdAt',_0xb981('0x2a'),'cm_contacts.priority',_0xb981('0x2b'),'\x22'+_0x10888b+'\x22'];var _0x3be49e=squel[_0xb981('0x2c')]()['into'](_0xb981('0x38'))[_0xb981('0x2e')]([_0xb981('0x10'),_0xb981('0x42'),_0xb981('0x2f'),'ListId',_0x26279b,'createdAt',_0xb981('0x31'),_0xb981('0x43'),_0xb981('0x44'),'recallme'],squel[_0xb981('0xe')]()[_0xb981('0x3d')](_0x5b8cce)['from'](_0x4a7c37)[_0xb981('0x12')](_0xb981('0x45'),null,_0xb981('0x33')+_0x4a7c37+_0xb981('0x34'))[_0xb981('0x12')](_0x5b3cd2,null,_0x5b3cd2+_0xb981('0x13')+_0x4a7c37+'.'+_0x26279b)[_0xb981('0x12')](_0x570af7,null,_0x570af7+'.id\x20=\x20'+_0x4a7c37+'.'+_0x26279b)[_0xb981('0x14')](_0x4a7c37+_0xb981('0x35'),_0x417f8e)[_0xb981('0x14')](_0xb981('0x36'),NOW)['where'](_0xb981('0x37'),selectNotIn(_0x4a7c37,_0x5b3cd2,_0x26279b,_0xb981('0x38'),[_0xb981('0x39'),_0xb981('0x3a')]))['where'](_0xb981('0x37'),selectNotIn(_0x4a7c37,_0x5b3cd2,_0x26279b,_0xb981('0x38'),[_0xb981('0x39')])))[_0xb981('0x3b')]();return _0x3be49e;}function insertTzCmHopperBlack(_0x182019,_0x2df339,_0x39c09d,_0x47e6c6){var _0x293929=[_0xb981('0x25'),_0xb981('0x27'),'cm_contacts.ListId',_0x2df339+'.'+_0x47e6c6,'cm_contacts.createdAt',_0xb981('0x2a')];return squel[_0xb981('0x2c')]()[_0xb981('0x2d')](_0xb981('0x3e'))['fromQuery']([_0xb981('0x10'),'ContactId','ListId',_0x47e6c6,_0xb981('0x30'),_0xb981('0x31')],squel[_0xb981('0xe')]()['fields'](_0x293929)['from'](_0x2df339)[_0xb981('0x12')](_0xb981('0x45'),null,_0xb981('0x33')+_0x2df339+_0xb981('0x34'))['join'](_0x39c09d,null,_0x39c09d+'.id\x20=\x20'+_0x2df339+'.'+_0x47e6c6)[_0xb981('0x14')](_0x2df339+_0xb981('0x35'),_0x182019)[_0xb981('0x14')](_0xb981('0x36'),NOW)[_0xb981('0x14')](_0xb981('0x37'),squel[_0xb981('0xe')]()[_0xb981('0xf')](_0xb981('0x10'))['from'](_0xb981('0x3e'))[_0xb981('0x14')](_0xb981('0x3f'),_0x182019)[_0xb981('0x14')](_0x47e6c6+_0xb981('0x46')+_0x2df339+'.'+_0x47e6c6)))[_0xb981('0x3b')]();}function insertCmHopperAdditionalPhones(_0x379f65){var _0xd88047=[_0xb981('0x47'),_0xb981('0x48'),'cm_contact_has_items.OrderBy',_0xb981('0x49'),_0xb981('0x4a')];return squel[_0xb981('0x2c')]()['into'](_0xb981('0x4b'))[_0xb981('0x2e')](['CmHopperId','phone',_0xb981('0x4c'),_0xb981('0x30'),_0xb981('0x31')],squel[_0xb981('0xe')]()['fields'](_0xd88047)['from'](_0xb981('0x38'))[_0xb981('0x12')](_0xb981('0x45'),null,_0xb981('0x4d'))[_0xb981('0x12')](_0xb981('0x4e'),null,_0xb981('0x4f'))[_0xb981('0x14')]('cm_hopper.ListId\x20=\x20?',_0x379f65)[_0xb981('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xb981('0x3b')]();}function insertCmContact(_0x5cbb4c,_0x1b5f04,_0x181c95,_0x17f30f){var _0x26d8c5=_[_0xb981('0x50')](_[_0xb981('0x51')](_0x17f30f),['ListId',_0xb981('0x52'),_0xb981('0x30'),_0xb981('0x31'),'scheduledAt']);return squel['insert']()[_0xb981('0x2d')](_0xb981('0x45'))['fromQuery'](_0x26d8c5,squel[_0xb981('0xe')]()[_0xb981('0x3d')](_0x26d8c5)[_0xb981('0x11')](_0x1b5f04)[_0xb981('0x14')]('('+_0x181c95[_0xb981('0x12')](',')+_0xb981('0x53'),squel[_0xb981('0xe')]()[_0xb981('0x3d')](_0x181c95)[_0xb981('0x11')](_0xb981('0x45'))[_0xb981('0x14')](_0xb981('0x3f'),_0x5cbb4c)[_0xb981('0x14')](_0xb981('0x54')))[_0xb981('0x14')](_0xb981('0x55'),squel[_0xb981('0xe')]()[_0xb981('0xf')](_0xb981('0x56'),'min_id')[_0xb981('0x11')](_0x1b5f04)['group'](_0x181c95['join'](','))))[_0xb981('0x3b')]();}function handleStop(){logger['info'](_0xb981('0x57'));stopped=!![];}function handleUncaughtException(_0x1c8587){logger[_0xb981('0x58')](_0x1c8587[_0xb981('0x59')]);process[_0xb981('0x5a')](0x1);}function handleError(_0x2a7dec,_0x5596af){stats['errors'][_0xb981('0x18')]({'name':_0x5596af[_0xb981('0x5b')],'message':_0x5596af['message'],'row':_0x2a7dec});}function handleQuery(_0x57a5fd){logger[_0xb981('0x5c')](_0x57a5fd);return db[_0xb981('0x5d')][_0xb981('0x5e')](_0x57a5fd)['spread'](function(_0x12cc4a){results['push'](_0x12cc4a);})[_0xb981('0x5f')](function(_0x159ae3){logger['error'](_0x159ae3['message']);});}function updateTzCampaigns(_0x14f869){return new Promise(function(_0x48208d,_0xc61861){var _0x2ab98c=squel[_0xb981('0xe')]()['fields']([_0xb981('0x60'),'campaigns.dialTimezone'])[_0xb981('0x11')](_0xb981('0x61'))[_0xb981('0x12')](_0xb981('0x62'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xb981('0x14')](_0xb981('0x63')+_0x14f869);db['sequelize']['query'](_0x2ab98c[_0xb981('0x3b')]())[_0xb981('0x64')](function(_0x19759c){var _0x5d0146=[];for(var _0xd19206=0x0;_0xd19206<_0x19759c[_0xb981('0x17')];_0xd19206++){_0x5d0146[_0xb981('0x18')](getTimezoneData(_0x19759c[_0xd19206],tmp_campaigns));}BPromise[_0xb981('0x19')](_0x5d0146)['then'](function(){_0x48208d({'val':0x1});});})[_0xb981('0x5f')](function(_0x4a6bd8){logger[_0xb981('0x58')](_0x4a6bd8[_0xb981('0x59')]);_0x48208d({'val':0x0});});});}function updateTzVoiceQueues(_0x1c756f){return new Promise(function(_0x126bac,_0x2e5c6e){var _0x392724=squel['select']()['fields']([_0xb981('0x65'),_0xb981('0x66')])[_0xb981('0x11')]('voice_queues')['join'](_0xb981('0x67'),null,_0xb981('0x68'))[_0xb981('0x14')](_0xb981('0x69')+_0x1c756f);db['sequelize'][_0xb981('0x5e')](_0x392724['toString']())['spread'](function(_0x2c148f){var _0x1d3197=[];for(var _0x7c568b=0x0;_0x7c568b<_0x2c148f[_0xb981('0x17')];_0x7c568b++){_0x1d3197[_0xb981('0x18')](getTimezoneData(_0x2c148f[_0x7c568b],tmp_voice_queues));}BPromise['all'](_0x1d3197)[_0xb981('0x20')](function(){_0x126bac({'val':0x1});});})[_0xb981('0x5f')](function(_0x331f4c){logger[_0xb981('0x58')](_0x331f4c[_0xb981('0x59')]);_0x126bac({'val':0x0});});});}function getTimezoneData(_0x2d4f10,_0x1588b6){return new Promise(function(_0x54ff39,_0x18e88b){var _0x1a2d76=shared['timezones'];var _0x2680a2=_0x1a2d76[_0x2d4f10[_0xb981('0x6a')]];if(_[_0xb981('0x1b')](_0x2680a2)){_0x54ff39({'ret':0x1});}else{var _0x30a59d=_0x2680a2[_0xb981('0x6b')];var _0x256b9b=squel['insert']()[_0xb981('0x2d')](_0x1588b6)[_0xb981('0x6c')]('id',_0x2d4f10['id'])[_0xb981('0x6c')](_0xb981('0x6d'),_0x30a59d)[_0xb981('0x6c')](_0xb981('0x6a'),_0x2d4f10[_0xb981('0x6a')])['toString']();return db[_0xb981('0x5d')]['query'](_0x256b9b)[_0xb981('0x64')](function(_0x83e196){_0x54ff39({'ret':0x1});})[_0xb981('0x5f')](function(_0x9daf26){logger[_0xb981('0x58')](_0x9daf26[_0xb981('0x59')]);_0x18e88b({'ret':0x1});});}});}function handleTZQuery(_0x594a07){logger[_0xb981('0x5c')](_0x594a07);return db[_0xb981('0x5d')][_0xb981('0x5e')](_0x594a07)[_0xb981('0x64')](function(_0x1b3f94){})[_0xb981('0x5f')](function(_0x333100){logger[_0xb981('0x58')](_0x333100[_0xb981('0x59')]);});}function main(_0xfe643a,_0x5a6434,_0x3c37d0,_0x5df57e){logger[_0xb981('0x5c')](_0xb981('0x6e'),_0xfe643a,JSON[_0xb981('0x6f')](_0x5a6434));process[_0xb981('0x70')]('start');var _0x4c1462=_0x5a6434['binding'];var _0x598c40=_[_0xb981('0x71')](_0x4c1462);var _0x3adcc9=_0x5a6434[_0xb981('0x72')];var _0xe865dc=path[_0xb981('0x12')](config[_0xb981('0x73')],_0xb981('0x74'),_0x3adcc9+_0xb981('0x75'));hasTZ=_[_0xb981('0x51')](_0x4c1462)[_0xb981('0x76')](_0xb981('0x6a'));var _0xb77bc3=_[_0xb981('0x51')](_0x4c1462)[_0xb981('0x12')]();logger[_0xb981('0x5c')]('header',_0xb77bc3);db[_0xb981('0x77')]['findAll']({'raw':!![],'attributes':['id',_0xb981('0x78')]})[_0xb981('0x20')](function(_0x4e0c9e){for(var _0x50b2b6=0x0;_0x50b2b6<_0x4e0c9e[_0xb981('0x17')];_0x50b2b6++){if(_0x4e0c9e[_0x50b2b6][_0xb981('0x78')]in _0x4c1462){contactItemTypes[_0xb981('0x18')](_0x4e0c9e[_0x50b2b6]);delete _0x598c40[_0x4e0c9e[_0x50b2b6][_0xb981('0x78')]];hasAdditionalPhones=!![];}for(var _0x3ff032 in _0x4c1462){if(_0x4e0c9e[_0x50b2b6][_0xb981('0x78')]+_0xb981('0x79')===_0x3ff032){phoneDescriptions[_0xb981('0x18')]({'itemTypeId':_0x4e0c9e[_0x50b2b6]['id'],'description':_0x3ff032});delete _0x598c40[_0x3ff032];}}}if(hasAdditionalPhones)_0x598c40[_0xb981('0x16')]='';var _0x2bb277=_[_0xb981('0x51')](_0x598c40)[_0xb981('0x12')]();logger[_0xb981('0x5c')]('header',_0x2bb277);fs[_0xb981('0x7a')](_0xe865dc,_0x2bb277+'\x0a');Papa['parse'](fs[_0xb981('0x7b')](_0xfe643a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1a241a,_0x15f8f3){try{for(var _0x1726f4=0x0,_0x353fd8=[];_0x1726f4<_0x1a241a[_0xb981('0x7c')][_0xb981('0x17')];_0x1726f4++){stats[_0xb981('0x7d')]+=0x1;if(_0x1a241a[_0xb981('0x7e')][_0x1726f4]){handleError(_0x1a241a['data'][_0x1726f4],_0x1a241a['errors'][_0x1726f4]);}else{var _0x5eb058=[];var _0x3de470=[];var _0x383784={};for(var _0x4cfca2 in _0x4c1462){let _0xa844b9=contactItemTypes[_0xb981('0x7f')](_0x49c631=>_0x49c631['name']===_0x4cfca2);let _0x46574b=contactItemTypes[_0xb981('0x7f')](_0x52c965=>_0x52c965[_0xb981('0x78')]+_0xb981('0x79')===_0x4cfca2);if(_[_0xb981('0x1b')](_0xa844b9)&&_[_0xb981('0x1b')](_0x46574b)){if(_0x4c1462[_0xb981('0x80')](_0x4cfca2)){if(_0x1a241a[_0xb981('0x7c')][_0x1726f4][_0x4c1462[_0x4cfca2]]){var _0x3556f1=_[_0xb981('0x81')](_0x1a241a['data'][_0x1726f4][_0x4c1462[_0x4cfca2]][_0xb981('0x82')](/"/g,'\x27'));switch(_0x4cfca2){case _0xb981('0x42'):var _0x272b75=moment(_0x3556f1,_0xb981('0xd'),!![]);if(_0x272b75['isValid']()){_0x353fd8[_0xb981('0x18')]('\x22'+_0x3556f1+'\x22');}else{_0x5eb058[_0xb981('0x18')](_0xb981('0x83'));}break;case _0xb981('0x43'):var _0x779f47=parseInt(_0x3556f1);_0x3556f1=_['isNaN'](_0x779f47)||_0x779f47<0x0||_0x779f47>0x4?_0x5df57e?0x3:0x2:_0x779f47;_0x353fd8['push']('\x22'+_0x3556f1+'\x22');break;case'UserId':var _0x4356d8=parseInt(_0x3556f1);if(_[_0xb981('0x84')](_0x4356d8)&&_[_0xb981('0x76')](_0x3c37d0,_0x4356d8)){_0x353fd8[_0xb981('0x18')]('\x22'+_0x4356d8+'\x22');}else{_0x5eb058[_0xb981('0x18')](_0xb981('0x85'));}break;case _0xb981('0x86'):if(isEmail(_0x3556f1)){_0x353fd8[_0xb981('0x18')]('\x22'+_0x3556f1+'\x22');}else{_0x5eb058[_0xb981('0x18')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x209fc0=moment(_0x3556f1,_0xb981('0x87'),!![]);if(_0x209fc0[_0xb981('0x88')]()){_0x353fd8[_0xb981('0x18')]('\x22'+_0x3556f1+'\x22');}else{_0x5eb058[_0xb981('0x18')](_0xb981('0x89'));}break;case _0xb981('0x6a'):var _0x20410e=shared['timezones'];var _0x308de8=_0x20410e[_0x3556f1];if(!_[_0xb981('0x1b')](_0x308de8)){var _0x56d993=_0x308de8[_0xb981('0x6b')];_0x353fd8[_0xb981('0x18')]('\x22'+_0x3556f1+'\x22');_0x353fd8[_0xb981('0x18')]('\x22'+_0x56d993+'\x22');}break;default:_0x353fd8[_0xb981('0x18')]('\x22'+_0x3556f1+'\x22');}}else{switch(_0x4cfca2){case _0xb981('0x8a'):case _0xb981('0x10'):_0x5eb058[_0xb981('0x18')](_0x4cfca2+_0xb981('0x8b'));break;default:_0x353fd8['push']('\x22\x22');}}}}else{var _0x34a26a='';if(!_[_0xb981('0x1b')](_0xa844b9)){if(!_0x383784[_0xb981('0x80')](_0xa844b9['id'])){if(!_[_0xb981('0x1b')](_0x1a241a[_0xb981('0x7c')][_0x1726f4][_0x4c1462[_0x4cfca2]])){var _0x3556f1=_['trim'](_0x1a241a[_0xb981('0x7c')][_0x1726f4][_0x4c1462[_0x4cfca2]]['replace'](/"/g,'\x27'));var _0x3db9ba=phoneDescriptions[_0xb981('0x7f')](_0x11ef26=>_0x11ef26[_0xb981('0x8c')]===_0xa844b9['id']);if(!_[_0xb981('0x1b')](_0x3db9ba)){var _0x71409d=_[_0xb981('0x81')](_0x1a241a['data'][_0x1726f4][_0x4c1462[_0x3db9ba['description']]]['replace'](/"/g,'\x27'));if(!_[_0xb981('0x1b')](_0x71409d))_0x3556f1=_0x3556f1+'§'+_0x71409d;}if(_0x34a26a=='')_0x34a26a=_0x3556f1;else _0x34a26a+='|'+_0x3556f1;}_0x3de470[_0xb981('0x18')](_0xa844b9['id']+':'+_0x34a26a);_0x383784[_0xa844b9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x353fd8[_0xb981('0x18')]('\x22'+_0x3de470['join'](';')+'\x22');}if(_0x5eb058[_0xb981('0x17')]){handleError(_0x1a241a['data'][_0x1726f4],{'code':_0xb981('0x8d'),'message':_0x5eb058[_0xb981('0x12')]()});}else{fs[_0xb981('0x8e')](_0xe865dc,_0x353fd8[_0xb981('0x12')]()+'\x0a');}_0x353fd8=[];}if(!(stats[_0xb981('0x7d')]%0xc8)){socket[_0xb981('0x8f')](_0xb981('0x90')+_0x3adcc9,stats);stats[_0xb981('0x7e')]=[];}}if(stopped){logger[_0xb981('0x5c')](_0xb981('0x91'));_0x15f8f3[_0xb981('0x92')]();}}catch(_0x672f61){handleError(_0x1a241a['data'][_0x1726f4],{'code':_0xb981('0x93'),'message':_0x672f61['message']});logger['error']('step',_0x672f61[_0xb981('0x59')]);}},'complete':function(){try{var _0x19fbca=[];var _0x1f5857=[];var _0x4ab45e='cm_contacts';if(_0x5a6434[_0xb981('0x94')]&&_0x5a6434['duplicates']['length']){_0x4ab45e=_0xb981('0x95')+_0x3adcc9;_0x19fbca[_0xb981('0x18')](_0xb981('0x96')+_0x4ab45e+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x3adcc9;tmp_voice_queues=_0xb981('0x97')+_0x3adcc9;_0x1f5857[_0xb981('0x18')](_0xb981('0x96')+tmp_campaigns+_0xb981('0x98'));_0x1f5857[_0xb981('0x18')](_0xb981('0x96')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xb981('0x99')](_0x1f5857,handleTZQuery)[_0xb981('0x20')](function(_0x49b0b0){updateTzCampaigns(_0x5a6434[_0xb981('0x3c')])[_0xb981('0x20')](function(_0x15d857){updateTzVoiceQueues(_0x5a6434[_0xb981('0x3c')])[_0xb981('0x20')](function(_0x208bb4){if(hasTZ)_0x2bb277=_0x2bb277[_0xb981('0x82')](_0xb981('0x6a'),_0xb981('0x9a'));var _0x1c1cdc=util[_0xb981('0xc')](_0xb981('0x9b'),_0xe865dc,_0x4ab45e,_0x2bb277,_0x5a6434[_0xb981('0x3c')],_0x5a6434[_0xb981('0x52')]||null,NOW,NOW);if(_[_0xb981('0x1b')](_0x4c1462[_0xb981('0x42')])){_0x1c1cdc+=_0xb981('0x9c');}_0x19fbca[_0xb981('0x18')](_0x1c1cdc);if(_0x5a6434['duplicates']&&_0x5a6434['duplicates'][_0xb981('0x17')]){_0x19fbca['push'](insertCmContact(_0x5a6434['ListId'],_0x4ab45e,_0x5a6434[_0xb981('0x94')],_0x4c1462));_0x19fbca[_0xb981('0x18')](_0xb981('0x9d')+_0x4ab45e+';');}BPromise[_0xb981('0x99')](_0x19fbca,handleQuery)[_0xb981('0x20')](function(_0x3b8cf4){BPromise['all']([handleAdditionalPhones()])[_0xb981('0x20')](function(){_0x19fbca=[];for(var _0x522d94=0x0;_0x522d94\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','isNil','push','then','error','split','all','length','CmContactHasItem','update','updated','PHONE'];(function(_0x38553a,_0x1ec329){var _0x4f01c9=function(_0x208530){while(--_0x208530){_0x38553a['push'](_0x38553a['shift']());}};_0x4f01c9(++_0x1ec329);}(_0xc210,0x7c));var _0x0c21=function(_0x17d314,_0x1fcc63){_0x17d314=_0x17d314-0x0;var _0x1775c6=_0xc210[_0x17d314];return _0x1775c6;};'use strict';var fs=require('fs');var path=require(_0x0c21('0x0'));var _=require(_0x0c21('0x1'));var Papa=require('papaparse');var util=require(_0x0c21('0x2'));var BPromise=require(_0x0c21('0x3'));var moment=require(_0x0c21('0x4'));var squel=require(_0x0c21('0x5'));var Redis=require(_0x0c21('0x6'));var db=require(_0x0c21('0x7'))['db'];var config=require(_0x0c21('0x8'));var logger=require(_0x0c21('0x9'))(_0x0c21('0xa'));config[_0x0c21('0xb')]=_[_0x0c21('0xc')](config[_0x0c21('0xb')],{'host':_0x0c21('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c21('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x0c21('0xe')+moment()[_0x0c21('0xf')](_0x0c21('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x10d648){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0c21('0x11')](_0x10d648);}function selectNotIn(_0x122c13,_0xbadf75,_0x5f5863,_0x15a6c0,_0x10cbb7){return squel['select']()['field'](_0x0c21('0x12'))[_0x0c21('0x13')](_0x15a6c0)[_0x0c21('0x14')](_0xbadf75,null,_0xbadf75+_0x0c21('0x15')+_0x15a6c0+'.'+_0x5f5863)['where'](_0x15a6c0+'.'+_0x5f5863+_0x0c21('0x16')+_0x122c13+'.'+_0x5f5863)[_0x0c21('0x17')](_0xbadf75+_0x0c21('0x18')+_0x10cbb7[_0x0c21('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1e6991,_0x522612){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x0c21('0x19')](_0x0c21('0x1a')+tempTableName)[_0x0c21('0x1b')](function(_0x50f86f){if(_0x50f86f!==null){var _0xd3fa93=[];for(var _0x2ea818=0x0;_0x2ea818<_0x50f86f['length'];_0x2ea818++){var _0x409bde=_0x50f86f[_0x2ea818];if(!_[_0x0c21('0x1c')](_0x409bde[_0x0c21('0x12')])){if(!_['isNil'](_0x409bde['AdditionalPhones']))_0xd3fa93[_0x0c21('0x1d')](insertAdditionalPhones(_0x409bde));promisesContact[_0x0c21('0x1d')]({'contact':_0x409bde});}}}Promise['all'](_0xd3fa93)[_0x0c21('0x1e')](function(){_0x1e6991({'val':0x1});});})['catch'](function(_0x3b902a){logger[_0x0c21('0x1f')](_0x3b902a['message']);});});}function insertAdditionalPhones(_0x27a80b){return new Promise(function(_0x46b8fd,_0x4ffa33){var _0x199622=_0x27a80b['AdditionalPhones'];if(_[_0x0c21('0x1c')](_0x199622))_0x4ffa33({'val':0x0});else{var _0x36e1d0=_0x199622[_0x0c21('0x20')](';');var _0x2459e1=[];orderBy=0x0;for(var _0x3b71e3=0x0;_0x3b71e3<_0x36e1d0['length'];_0x3b71e3++){_0x2459e1['push'](splitAdditionalPhone(_0x27a80b['id'],_0x36e1d0[_0x3b71e3]));}Promise[_0x0c21('0x21')](_0x2459e1)[_0x0c21('0x1e')](function(){_0x46b8fd({'val':_0x36e1d0[_0x0c21('0x22')]});});}});}function splitAdditionalPhone(_0x2ef9f0,_0x136cd5){return new Promise(function(_0x3f9e91,_0x4279e0){var _0x33f131=_0x136cd5['split'](':');var _0x147b6c=_0x33f131[0x0];var _0x1950a2=_0x33f131[0x1];if(_0x1950a2!==''){var _0x56114f=_0x1950a2[_0x0c21('0x20')]('|');var _0x42984d=[];for(var _0x3b9f37=0x0;_0x3b9f37<_0x56114f[_0x0c21('0x22')];_0x3b9f37++){if(_0x56114f[_0x3b9f37]!==''){var _0xfd0479=_['filter'](promisesAdditionalPhones,{'contactId':_0x2ef9f0,'phone':_0x56114f[_0x3b9f37]});if(_0xfd0479[_0x0c21('0x22')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2ef9f0,'contactTypeId':_0x147b6c,'phone':_0x56114f[_0x3b9f37],'orderBy':orderBy});}}}_0x3f9e91({'ok':0x1});}else _0x3f9e91({'res':0x0});});}function createAdditionalPhone(_0x2b8b14,_0x40ddf8,_0x48b6f1,_0x1586bb){var _0x2ab69a='';var _0x4444a6='';var _0x2a8b6e=_0x48b6f1['split']('§');_0x2ab69a=_0x2a8b6e[0x0];if(_0x2a8b6e['length']==0x2)_0x4444a6=_0x2a8b6e[0x1];return new Promise(function(_0x42400d,_0x2e0a39){return db[_0x0c21('0x23')]['findOne']({'where':{'CmContactId':_0x2b8b14,'item':_0x2ab69a}})[_0x0c21('0x1e')](function(_0x2b5ad8){if(_0x2b5ad8){return db[_0x0c21('0x23')][_0x0c21('0x24')]({'ItemTypeId':_0x40ddf8,'description':_0x4444a6,'OrderBy':_0x1586bb},{'where':{'CmContactId':_0x2b8b14,'item':_0x2ab69a}})[_0x0c21('0x1e')](function(_0x5f4aef){_0x42400d({'res':_0x0c21('0x25')});});}else{return db[_0x0c21('0x23')]['create']({'CmContactId':_0x2b8b14,'item':_0x2ab69a,'ItemTypeId':_0x40ddf8,'description':_0x4444a6,'OrderBy':_0x1586bb,'ItemClass':_0x0c21('0x26')})['then'](function(_0x3cc59b){_0x42400d({'res':_0x0c21('0x27')});});}});});}function updateContact(_0x50d395){return new Promise(function(_0x4d2253,_0x32b54a){var _0x5aab8c=_0x50d395['id'];delete _0x50d395['id'];return db[_0x0c21('0x28')][_0x0c21('0x24')](_0x50d395,{'where':{'id':_0x5aab8c}})['then'](function(_0x1b74fa){updatedRows+=0x1;return db[_0x0c21('0x29')][_0x0c21('0x24')]({'phone':_0x50d395[_0x0c21('0x12')]},{'where':{'ContactId':_0x5aab8c}})[_0x0c21('0x1e')](function(_0x492a34){_0x4d2253({'ret':'OK'});});});});}function insertCmHopper(_0x20237e,_0x36a7ee,_0x524d70,_0x1d001b,_0x20f299){var _0x1b7134=[_0x0c21('0x2a'),_0x0c21('0x2b'),_0x0c21('0x2c'),_0x0c21('0x2d'),_0x36a7ee+'.'+_0x1d001b,_0x0c21('0x2e'),'cm_contacts.updatedAt',_0x0c21('0x2f'),_0x0c21('0x30'),'\x22'+_0x20f299+'\x22'];return squel[_0x0c21('0x31')]()[_0x0c21('0x32')](_0x0c21('0x33'))[_0x0c21('0x34')](['phone',_0x0c21('0x35'),_0x0c21('0x36'),_0x0c21('0x37'),_0x1d001b,_0x0c21('0x38'),'updatedAt',_0x0c21('0x39'),_0x0c21('0x3a'),_0x0c21('0x3b')],squel[_0x0c21('0x3c')]()[_0x0c21('0x3d')](_0x1b7134)['from'](_0x36a7ee)[_0x0c21('0x14')]('cm_contacts',null,_0x0c21('0x3e')+_0x36a7ee+_0x0c21('0x3f'))[_0x0c21('0x14')](_0x524d70,null,_0x524d70+_0x0c21('0x15')+_0x36a7ee+'.'+_0x1d001b)[_0x0c21('0x17')](_0x36a7ee+_0x0c21('0x40'),_0x20237e)[_0x0c21('0x17')](_0x0c21('0x41'),NOW)['where'](_0x0c21('0x42'),selectNotIn(_0x36a7ee,_0x524d70,_0x1d001b,_0x0c21('0x33'),['\x22always\x22',_0x0c21('0x43')]))[_0x0c21('0x17')](_0x0c21('0x42'),selectNotIn(_0x36a7ee,_0x524d70,_0x1d001b,'cm_hopper',[_0x0c21('0x44')])))[_0x0c21('0x45')]();}function insertCmHopperBlack(_0x14284c,_0x59cff8,_0xc9f5f2,_0x5989e8){var _0x39ed5f=['cm_contacts.phone',_0x0c21('0x2c'),'cm_contacts.ListId',_0x59cff8+'.'+_0x5989e8,'cm_contacts.createdAt',_0x0c21('0x46')];return squel[_0x0c21('0x31')]()[_0x0c21('0x32')](_0x0c21('0x47'))[_0x0c21('0x34')]([_0x0c21('0x12'),'ContactId',_0x0c21('0x37'),_0x5989e8,'createdAt',_0x0c21('0x48')],squel[_0x0c21('0x3c')]()[_0x0c21('0x3d')](_0x39ed5f)[_0x0c21('0x13')](_0x59cff8)[_0x0c21('0x14')](_0x0c21('0x49'),null,'cm_contacts.ListId\x20=\x20'+_0x59cff8+'.CmListId')[_0x0c21('0x14')](_0xc9f5f2,null,_0xc9f5f2+_0x0c21('0x15')+_0x59cff8+'.'+_0x5989e8)[_0x0c21('0x17')](_0x59cff8+_0x0c21('0x40'),_0x14284c)['where'](_0x0c21('0x41'),NOW)[_0x0c21('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x0c21('0x3c')]()[_0x0c21('0x4a')]('phone')[_0x0c21('0x13')]('cm_hopper_black')[_0x0c21('0x17')](_0x0c21('0x4b'),_0x14284c)[_0x0c21('0x17')](_0x5989e8+_0x0c21('0x4c'),_0x59cff8+'.'+_0x5989e8)))[_0x0c21('0x45')]();}function insertCmHopperAdditionalPhones(_0x1956d9){var _0x2d441d=[_0x0c21('0x4d'),_0x0c21('0x4e'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x0c21('0x4f')];return squel['insert']()[_0x0c21('0x32')](_0x0c21('0x50'))[_0x0c21('0x34')]([_0x0c21('0x51'),_0x0c21('0x12'),_0x0c21('0x52'),_0x0c21('0x38'),'updatedAt'],squel[_0x0c21('0x3c')]()[_0x0c21('0x3d')](_0x2d441d)[_0x0c21('0x13')](_0x0c21('0x33'))[_0x0c21('0x14')](_0x0c21('0x49'),null,_0x0c21('0x53'))['join'](_0x0c21('0x54'),null,_0x0c21('0x55'))[_0x0c21('0x17')](_0x0c21('0x56'),_0x1956d9)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x0c21('0x45')]();}function insertCmContact(_0x3d02ef,_0x544725,_0x1f3bd3,_0x5b90ee){var _0x47b12d=_['concat'](_[_0x0c21('0x57')](_0x5b90ee),[_0x0c21('0x37'),_0x0c21('0x58'),_0x0c21('0x38'),'updatedAt']);return squel[_0x0c21('0x31')]()[_0x0c21('0x32')](_0x0c21('0x49'))[_0x0c21('0x34')](_0x47b12d,squel['select']()[_0x0c21('0x3d')](_0x47b12d)[_0x0c21('0x13')](_0x544725)[_0x0c21('0x17')]('('+_0x1f3bd3['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x0c21('0x3c')]()[_0x0c21('0x3d')](_0x1f3bd3)[_0x0c21('0x13')](_0x0c21('0x49'))[_0x0c21('0x17')]('ListId\x20=\x20?',_0x3d02ef))[_0x0c21('0x17')](_0x0c21('0x59'),squel[_0x0c21('0x3c')]()['field'](_0x0c21('0x5a'),'min_id')[_0x0c21('0x13')](_0x544725)[_0x0c21('0x5b')](_0x1f3bd3['join'](','))))[_0x0c21('0x45')]();}function handleStop(){logger[_0x0c21('0x5c')](_0x0c21('0x5d'));stopped=!![];}function handleUncaughtException(_0x1a6667){logger[_0x0c21('0x1f')](_0x1a6667['message']);process['exit'](0x1);}function handleError(_0x552d63,_0x4a211d){stats[_0x0c21('0x5e')][_0x0c21('0x1d')]({'name':_0x4a211d[_0x0c21('0x5f')],'message':_0x4a211d['message'],'row':_0x552d63});}function handleQuery(_0x4a5980){logger[_0x0c21('0x5c')](_0x4a5980);return db[_0x0c21('0x60')][_0x0c21('0x19')](_0x4a5980)[_0x0c21('0x1b')](function(_0x5e1836){results[_0x0c21('0x1d')](_0x5e1836);})['catch'](function(_0x1d2dd5){logger[_0x0c21('0x1f')](_0x1d2dd5[_0x0c21('0x61')]);});}function main(_0x3f0364,_0x498cf2,_0xc6761c,_0x3a2a7d){logger['info'](_0x0c21('0x62'),_0x3f0364,JSON[_0x0c21('0x63')](_0x498cf2));process[_0x0c21('0x64')]('start');var _0x4ccb1d=_0x498cf2[_0x0c21('0x65')];var _0x5ed677=_['clone'](_0x4ccb1d);var _0x50f853=_0x498cf2[_0x0c21('0x66')];var _0xae9e4f=path[_0x0c21('0x14')](config[_0x0c21('0x67')],_0x0c21('0x68'),_0x50f853+_0x0c21('0x69'));logger[_0x0c21('0x5c')](_0x0c21('0x6a'),_0x498cf2);db['ContactItemType'][_0x0c21('0x6b')]({'raw':!![],'attributes':['id',_0x0c21('0x6c')]})['then'](function(_0x569240){for(var _0xba2ce8=0x0;_0xba2ce8<_0x569240[_0x0c21('0x22')];_0xba2ce8++){if(_0x569240[_0xba2ce8][_0x0c21('0x6c')]in _0x4ccb1d){contactItemTypes[_0x0c21('0x1d')](_0x569240[_0xba2ce8]);delete _0x5ed677[_0x569240[_0xba2ce8]['name']];hasAdditionalPhones=!![];}for(var _0xceb615 in _0x4ccb1d){if(_0x569240[_0xba2ce8]['name']+_0x0c21('0x6d')===_0xceb615){phoneDescriptions['push']({'itemTypeId':_0x569240[_0xba2ce8]['id'],'description':_0xceb615});delete _0x5ed677[_0xceb615];}}}if(hasAdditionalPhones)_0x5ed677[_0x0c21('0x6e')]='';var _0x6459ae=_[_0x0c21('0x57')](_0x5ed677)['join']();logger['info']('header',_0x6459ae);fs[_0x0c21('0x6f')](_0xae9e4f,_0x6459ae+'\x0a');Papa[_0x0c21('0x70')](fs[_0x0c21('0x71')](_0x3f0364),{'header':!![],'skipEmptyLines':!![],'step':function(_0x544eff,_0x9c9363){try{for(var _0x4fddc7=0x0,_0x398427=[];_0x4fddc7<_0x544eff['data'][_0x0c21('0x22')];_0x4fddc7++){stats['rows']+=0x1;if(_0x544eff[_0x0c21('0x5e')][_0x4fddc7]){handleError(_0x544eff['data'][_0x4fddc7],_0x544eff['errors'][_0x4fddc7]);}else{var _0x42a243=[];var _0x4e6d51=[];var _0x33ce2f={};for(var _0x4163ac in _0x4ccb1d){let _0x2c3395=contactItemTypes[_0x0c21('0x72')](_0x8a0882=>_0x8a0882[_0x0c21('0x6c')]===_0x4163ac);let _0x454f69=contactItemTypes[_0x0c21('0x72')](_0xc706ae=>_0xc706ae[_0x0c21('0x6c')]+_0x0c21('0x6d')===_0x4163ac);if(_[_0x0c21('0x1c')](_0x2c3395)&&_[_0x0c21('0x1c')](_0x454f69)){if(_0x4ccb1d[_0x0c21('0x73')](_0x4163ac)){if(_0x544eff['data'][_0x4fddc7][_0x4ccb1d[_0x4163ac]]){var _0x194cc1=_[_0x0c21('0x74')](_0x544eff[_0x0c21('0x75')][_0x4fddc7][_0x4ccb1d[_0x4163ac]][_0x0c21('0x76')](/"/g,'\x27'));switch(_0x4163ac){case'scheduledat':var _0x57da8e=moment(_0x194cc1,_0x0c21('0x77'),!![]);if(_0x57da8e[_0x0c21('0x78')]()){_0x398427[_0x0c21('0x1d')]('\x22'+_0x194cc1+'\x22');}else{_0x42a243['push'](_0x0c21('0x79'));}break;case _0x0c21('0x39'):var _0x2d4517=parseInt(_0x194cc1);_0x194cc1=_[_0x0c21('0x7a')](_0x2d4517)||_0x2d4517<0x0||_0x2d4517>0x4?_0x3a2a7d?0x3:0x2:_0x2d4517;_0x398427['push']('\x22'+_0x194cc1+'\x22');break;case _0x0c21('0x3a'):var _0x224a58=parseInt(_0x194cc1);if(_[_0x0c21('0x7b')](_0x224a58)&&_[_0x0c21('0x7c')](_0xc6761c,_0x224a58)){_0x398427[_0x0c21('0x1d')]('\x22'+_0x224a58+'\x22');}else{_0x42a243[_0x0c21('0x1d')](_0x0c21('0x7d'));}break;case _0x0c21('0x7e'):if(isEmail(_0x194cc1)){_0x398427[_0x0c21('0x1d')]('\x22'+_0x194cc1+'\x22');}else{_0x42a243[_0x0c21('0x1d')]('email\x20wrong\x20format');}break;case _0x0c21('0x7f'):var _0x5f4e68=moment(_0x194cc1,_0x0c21('0x80'),!![]);if(_0x5f4e68[_0x0c21('0x78')]()){_0x398427[_0x0c21('0x1d')]('\x22'+_0x194cc1+'\x22');}else{_0x42a243[_0x0c21('0x1d')](_0x0c21('0x81'));}break;default:_0x398427[_0x0c21('0x1d')]('\x22'+_0x194cc1+'\x22');}}else{switch(_0x4163ac){case'firstName':case _0x0c21('0x12'):_0x42a243[_0x0c21('0x1d')](_0x4163ac+'\x20not\x20specified');break;default:_0x398427[_0x0c21('0x1d')]('\x22\x22');}}}}else{var _0x3ee7b8='';if(!_['isNil'](_0x2c3395)){if(!_0x33ce2f[_0x0c21('0x73')](_0x2c3395['id'])){for(var _0x13206f=0x0;_0x13206f<_0x4ccb1d[_0x4163ac]['length'];_0x13206f++){var _0x194cc1=_[_0x0c21('0x74')](_0x544eff['data'][_0x4fddc7][_0x4ccb1d[_0x4163ac][_0x13206f]][_0x0c21('0x76')](/"/g,'\x27'));var _0x3e95b9=phoneDescriptions[_0x0c21('0x72')](_0x19193a=>_0x19193a['itemTypeId']===_0x2c3395['id']);if(!_[_0x0c21('0x1c')](_0x3e95b9)){var _0x3e208c=_['trim'](_0x544eff[_0x0c21('0x75')][_0x4fddc7][_0x4ccb1d[_0x3e95b9[_0x0c21('0x82')]][0x0]][_0x0c21('0x76')](/"/g,'\x27'));if(!_[_0x0c21('0x1c')](_0x3e208c))_0x194cc1=_0x194cc1+'§'+_0x3e208c;}if(_0x3ee7b8=='')_0x3ee7b8=_0x194cc1;else _0x3ee7b8+='|'+_0x194cc1;}_0x4e6d51['push'](_0x2c3395['id']+':'+_0x3ee7b8);_0x33ce2f[_0x2c3395['id']]=0x1;}}}}if(hasAdditionalPhones){_0x398427[_0x0c21('0x1d')]('\x22'+_0x4e6d51[_0x0c21('0x14')](';')+'\x22');}if(_0x42a243[_0x0c21('0x22')]){handleError(_0x544eff[_0x0c21('0x75')][_0x4fddc7],{'code':_0x0c21('0x83'),'message':_0x42a243[_0x0c21('0x14')]()});}else{fs[_0x0c21('0x84')](_0xae9e4f,_0x398427[_0x0c21('0x14')]()+'\x0a');}_0x398427=[];}if(!(stats[_0x0c21('0x85')]%0xc8)){socket[_0x0c21('0x86')](_0x0c21('0x87')+_0x50f853,stats);stats[_0x0c21('0x5e')]=[];}}if(stopped){logger[_0x0c21('0x5c')](_0x0c21('0x88'));_0x9c9363['abort']();}}catch(_0x501efd){handleError(_0x544eff['data'][_0x4fddc7],{'code':'SystemError','message':_0x501efd[_0x0c21('0x61')]});logger['error'](_0x0c21('0x89'),_0x501efd[_0x0c21('0x61')]);}},'complete':function(){try{var _0x22797c=[];var _0x4a491e=tempTableName;_0x22797c[_0x0c21('0x1d')](_0x0c21('0x8a')+_0x4a491e+_0x0c21('0x8b'));logger[_0x0c21('0x5c')](_0x0c21('0x8c'),contactItemTypes[_0x0c21('0x22')]);var _0x12df7e=util[_0x0c21('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0xae9e4f,_0x4a491e,_0x6459ae,_0x498cf2[_0x0c21('0x37')],_0x498cf2['CompanyId']||null,NOW,NOW);if(_[_0x0c21('0x1c')](_0x4ccb1d[_0x0c21('0x35')])){_0x12df7e+=_0x0c21('0x8d');}_0x22797c[_0x0c21('0x1d')](_0x12df7e);BPromise[_0x0c21('0x8e')](_0x22797c,handleQuery)[_0x0c21('0x1e')](function(_0x1169fb){BPromise['all']([handleAdditionalPhones()])[_0x0c21('0x1e')](function(){_0x22797c=[];for(var _0x413994=0x0;_0x413994\x20\x20','root','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map'];(function(_0x293fa9,_0x5957cc){var _0x41aa57=function(_0x5ab74f){while(--_0x5ab74f){_0x293fa9['push'](_0x293fa9['shift']());}};_0x41aa57(++_0x5957cc);}(_0x955f,0x1eb));var _0xf955=function(_0x5f92ca,_0x234999){_0x5f92ca=_0x5f92ca-0x0;var _0x33c015=_0x955f[_0x5f92ca];return _0x33c015;};'use strict';var fs=require('fs');var path=require(_0xf955('0x0'));var _=require(_0xf955('0x1'));var Papa=require(_0xf955('0x2'));var util=require(_0xf955('0x3'));var BPromise=require(_0xf955('0x4'));var moment=require('moment');var squel=require(_0xf955('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xf955('0x6'));var logger=require('../../../config/logger')(_0xf955('0x7'));config[_0xf955('0x8')]=_[_0xf955('0x9')](config['redis'],{'host':_0xf955('0xa'),'port':0x18eb});var socket=require(_0xf955('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xf955('0xc')](_0xf955('0xd'));var tempTableName=_0xf955('0xe')+moment()[_0xf955('0xc')](_0xf955('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x421e4a){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xf955('0x10')](_0x421e4a);}function selectNotIn(_0x4d213a,_0xf7e3e,_0x5b0afa,_0x2d59e9,_0x5d6211){return squel[_0xf955('0x11')]()['field'](_0xf955('0x12'))['from'](_0x2d59e9)[_0xf955('0x13')](_0xf7e3e,null,_0xf7e3e+'.id\x20=\x20'+_0x2d59e9+'.'+_0x5b0afa)[_0xf955('0x14')](_0x2d59e9+'.'+_0x5b0afa+_0xf955('0x15')+_0x4d213a+'.'+_0x5b0afa)[_0xf955('0x14')](_0xf7e3e+_0xf955('0x16')+_0x5d6211[_0xf955('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x341b8c,_0x1c3235){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf955('0x17')][_0xf955('0x18')](_0xf955('0x19')+tempTableName)['spread'](function(_0xc29b35){if(_0xc29b35!==null){var _0x54e60b=[];for(var _0x3139d5=0x0;_0x3139d5<_0xc29b35[_0xf955('0x1a')];_0x3139d5++){var _0x2f881b=_0xc29b35[_0x3139d5];if(!_[_0xf955('0x1b')](_0x2f881b['phone'])){if(!_['isNil'](_0x2f881b[_0xf955('0x1c')]))_0x54e60b[_0xf955('0x1d')](insertAdditionalPhones(_0x2f881b));promisesContact[_0xf955('0x1d')]({'contact':_0x2f881b});}}}Promise['all'](_0x54e60b)[_0xf955('0x1e')](function(){_0x341b8c({'val':0x1});});})[_0xf955('0x1f')](function(_0x423824){logger[_0xf955('0x20')](_0x423824[_0xf955('0x21')]);});});}function insertAdditionalPhones(_0x5f4d9a){return new Promise(function(_0x17d86a,_0x3dbbe8){var _0xfb8102=_0x5f4d9a['AdditionalPhones'];if(_[_0xf955('0x1b')](_0xfb8102))_0x3dbbe8({'val':0x0});else{var _0x5daa73=_0xfb8102[_0xf955('0x22')](';');var _0x43b078=[];orderBy=0x0;for(var _0x37143d=0x0;_0x37143d<_0x5daa73[_0xf955('0x1a')];_0x37143d++){_0x43b078[_0xf955('0x1d')](splitAdditionalPhone(_0x5f4d9a['id'],_0x5daa73[_0x37143d]));}Promise['all'](_0x43b078)[_0xf955('0x1e')](function(){_0x17d86a({'val':_0x5daa73[_0xf955('0x1a')]});});}});}function splitAdditionalPhone(_0x3585c7,_0x13a1a7){return new Promise(function(_0x17dec2,_0x102e36){var _0x1f87f6=_0x13a1a7['split'](':');var _0x18f435=_0x1f87f6[0x0];var _0x1acf33=_0x1f87f6[0x1];if(_0x1acf33!==''){var _0xba8a22=_0x1acf33[_0xf955('0x22')]('|');var _0x2dcd55=[];for(var _0x13a86d=0x0;_0x13a86d<_0xba8a22[_0xf955('0x1a')];_0x13a86d++){if(_0xba8a22[_0x13a86d]!==''){var _0x51f3ab=_[_0xf955('0x23')](promisesAdditionalPhones,{'contactId':_0x3585c7,'phone':_0xba8a22[_0x13a86d]});if(_0x51f3ab[_0xf955('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xf955('0x1d')]({'contactId':_0x3585c7,'contactTypeId':_0x18f435,'phone':_0xba8a22[_0x13a86d],'orderBy':orderBy});}}}_0x17dec2({'ok':0x1});}else _0x17dec2({'res':0x0});});}function createAdditionalPhone(_0xbd0b74,_0x28fa9c,_0x264f6d,_0x4d4af0){var _0x2232a7='';var _0x1e5d37='';var _0x4ec3e8=_0x264f6d[_0xf955('0x22')]('§');_0x2232a7=_0x4ec3e8[0x0];if(_0x4ec3e8[_0xf955('0x1a')]==0x2)_0x1e5d37=_0x4ec3e8[0x1];return new Promise(function(_0xf3c870,_0x1ef794){return db['CmContactHasItem'][_0xf955('0x24')]({'where':{'CmContactId':_0xbd0b74,'item':_0x2232a7}})['then'](function(_0x227104){if(_0x227104){return db[_0xf955('0x25')][_0xf955('0x26')]({'ItemTypeId':_0x28fa9c,'description':_0x1e5d37,'OrderBy':_0x4d4af0},{'where':{'CmContactId':_0xbd0b74,'item':_0x2232a7}})[_0xf955('0x1e')](function(_0x1e8024){_0xf3c870({'res':_0xf955('0x27')});});}else{return db[_0xf955('0x25')][_0xf955('0x28')]({'CmContactId':_0xbd0b74,'item':_0x2232a7,'ItemTypeId':_0x28fa9c,'description':_0x1e5d37,'OrderBy':_0x4d4af0,'ItemClass':'PHONE'})[_0xf955('0x1e')](function(_0x165cc4){_0xf3c870({'res':_0xf955('0x29')});});}});});}function updateContact(_0x2046c8){return new Promise(function(_0x4fea0c,_0x23c848){var _0x31dad5=_0x2046c8['id'];delete _0x2046c8['id'];return db[_0xf955('0x2a')][_0xf955('0x26')](_0x2046c8,{'where':{'id':_0x31dad5}})[_0xf955('0x1e')](function(_0x4eb2c3){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x2046c8[_0xf955('0x12')]},{'where':{'ContactId':_0x31dad5}})[_0xf955('0x1e')](function(_0x374e95){_0x4fea0c({'ret':'OK'});});});});}function insertCmHopper(_0x6d564c,_0x467447,_0x39de9c,_0x5acb00,_0x3acc4b){var _0x515dc6=[_0xf955('0x2b'),_0xf955('0x2c'),_0xf955('0x2d'),'cm_contacts.ListId',_0x467447+'.'+_0x5acb00,_0xf955('0x2e'),'cm_contacts.updatedAt',_0xf955('0x2f'),_0xf955('0x30'),'\x22'+_0x3acc4b+'\x22'];return squel[_0xf955('0x31')]()[_0xf955('0x32')]('cm_hopper')[_0xf955('0x33')]([_0xf955('0x12'),'scheduledat',_0xf955('0x34'),_0xf955('0x35'),_0x5acb00,_0xf955('0x36'),'updatedAt',_0xf955('0x37'),_0xf955('0x38'),_0xf955('0x39')],squel['select']()[_0xf955('0x3a')](_0x515dc6)[_0xf955('0x3b')](_0x467447)[_0xf955('0x13')](_0xf955('0x3c'),null,_0xf955('0x3d')+_0x467447+_0xf955('0x3e'))[_0xf955('0x13')](_0x39de9c,null,_0x39de9c+_0xf955('0x3f')+_0x467447+'.'+_0x5acb00)['where'](_0x467447+_0xf955('0x40'),_0x6d564c)[_0xf955('0x14')](_0xf955('0x41'),NOW)[_0xf955('0x14')](_0xf955('0x42'),selectNotIn(_0x467447,_0x39de9c,_0x5acb00,_0xf955('0x43'),[_0xf955('0x44'),_0xf955('0x45')]))[_0xf955('0x14')](_0xf955('0x42'),selectNotIn(_0x467447,_0x39de9c,_0x5acb00,_0xf955('0x43'),[_0xf955('0x44')])))[_0xf955('0x46')]();}function insertCmHopperBlack(_0x159ae3,_0x3557b5,_0x248f60,_0x356ec2){var _0x34f0f1=[_0xf955('0x2b'),'cm_contacts.id',_0xf955('0x47'),_0x3557b5+'.'+_0x356ec2,_0xf955('0x2e'),_0xf955('0x48')];return squel['insert']()[_0xf955('0x32')]('cm_hopper_black')[_0xf955('0x33')](['phone',_0xf955('0x34'),_0xf955('0x35'),_0x356ec2,_0xf955('0x36'),_0xf955('0x49')],squel['select']()[_0xf955('0x3a')](_0x34f0f1)[_0xf955('0x3b')](_0x3557b5)[_0xf955('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x3557b5+_0xf955('0x3e'))[_0xf955('0x13')](_0x248f60,null,_0x248f60+_0xf955('0x3f')+_0x3557b5+'.'+_0x356ec2)[_0xf955('0x14')](_0x3557b5+'.CmListId\x20=\x20?',_0x159ae3)[_0xf955('0x14')](_0xf955('0x41'),NOW)[_0xf955('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf955('0x11')]()['field'](_0xf955('0x12'))[_0xf955('0x3b')](_0xf955('0x4a'))['where'](_0xf955('0x4b'),_0x159ae3)[_0xf955('0x14')](_0x356ec2+_0xf955('0x4c'),_0x3557b5+'.'+_0x356ec2)))[_0xf955('0x46')]();}function insertCmHopperAdditionalPhones(_0x571cfb){var _0xa8edda=[_0xf955('0x4d'),_0xf955('0x4e'),_0xf955('0x4f'),_0xf955('0x50'),'cm_contact_has_items.updatedAt'];return squel[_0xf955('0x31')]()['into'](_0xf955('0x51'))['fromQuery']([_0xf955('0x52'),'phone','OrderBy',_0xf955('0x36'),_0xf955('0x49')],squel['select']()[_0xf955('0x3a')](_0xa8edda)['from']('cm_hopper')['join']('cm_contacts',null,_0xf955('0x53'))[_0xf955('0x13')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xf955('0x14')](_0xf955('0x54'),_0x571cfb)[_0xf955('0x14')](_0xf955('0x41'),NOW))[_0xf955('0x46')]();}function insertCmContact(_0xa56483,_0x190500,_0x3a69ca,_0x376974){var _0x141314=_[_0xf955('0x55')](_[_0xf955('0x56')](_0x376974),['ListId',_0xf955('0x57'),_0xf955('0x36'),_0xf955('0x49')]);return squel[_0xf955('0x31')]()[_0xf955('0x32')]('cm_contacts')[_0xf955('0x33')](_0x141314,squel[_0xf955('0x11')]()[_0xf955('0x3a')](_0x141314)[_0xf955('0x3b')](_0x190500)[_0xf955('0x14')]('('+_0x3a69ca[_0xf955('0x13')](',')+_0xf955('0x58'),squel[_0xf955('0x11')]()[_0xf955('0x3a')](_0x3a69ca)[_0xf955('0x3b')]('cm_contacts')[_0xf955('0x14')](_0xf955('0x4b'),_0xa56483))[_0xf955('0x14')](_0xf955('0x59'),squel[_0xf955('0x11')]()[_0xf955('0x5a')](_0xf955('0x5b'),_0xf955('0x5c'))[_0xf955('0x3b')](_0x190500)[_0xf955('0x5d')](_0x3a69ca[_0xf955('0x13')](','))))[_0xf955('0x46')]();}function handleStop(){logger['info'](_0xf955('0x5e'));stopped=!![];}function handleUncaughtException(_0x452de9){logger[_0xf955('0x20')](_0x452de9[_0xf955('0x21')]);process[_0xf955('0x5f')](0x1);}function handleError(_0x3171ba,_0x1c4e2d){stats['errors']['push']({'name':_0x1c4e2d['code'],'message':_0x1c4e2d[_0xf955('0x21')],'row':_0x3171ba});}function handleQuery(_0x530ec7){logger['info'](_0x530ec7);return db[_0xf955('0x17')]['query'](_0x530ec7)[_0xf955('0x60')](function(_0x3fa5b5){results[_0xf955('0x1d')](_0x3fa5b5);})[_0xf955('0x1f')](function(_0x4c88ae){logger[_0xf955('0x20')](_0x4c88ae[_0xf955('0x21')]);});}function main(_0xabf581,_0x3149b3,_0x36364d,_0x545c1f){logger[_0xf955('0x61')]('main',_0xabf581,JSON[_0xf955('0x62')](_0x3149b3));process[_0xf955('0x63')](_0xf955('0x64'));var _0x49400d=_0x3149b3[_0xf955('0x65')];var _0x40ca54=_[_0xf955('0x66')](_0x49400d);var _0x379aa=_0x3149b3[_0xf955('0x67')];var _0x339661=path[_0xf955('0x13')](config['root'],'server/files/tmp',_0x379aa+_0xf955('0x68'));logger[_0xf955('0x61')](_0xf955('0x69'),_0x3149b3);db[_0xf955('0x6a')][_0xf955('0x6b')]({'raw':!![],'attributes':['id',_0xf955('0x6c')]})[_0xf955('0x1e')](function(_0x319e62){for(var _0x2ceeb4=0x0;_0x2ceeb4<_0x319e62[_0xf955('0x1a')];_0x2ceeb4++){if(_0x319e62[_0x2ceeb4][_0xf955('0x6c')]in _0x49400d){contactItemTypes['push'](_0x319e62[_0x2ceeb4]);delete _0x40ca54[_0x319e62[_0x2ceeb4][_0xf955('0x6c')]];hasAdditionalPhones=!![];}for(var _0x4916c3 in _0x49400d){if(_0x319e62[_0x2ceeb4][_0xf955('0x6c')]+'_description'===_0x4916c3){phoneDescriptions['push']({'itemTypeId':_0x319e62[_0x2ceeb4]['id'],'description':_0x4916c3});delete _0x40ca54[_0x4916c3];}}}if(hasAdditionalPhones)_0x40ca54[_0xf955('0x1c')]='';var _0x20f11c=_['keys'](_0x40ca54)[_0xf955('0x13')]();logger[_0xf955('0x61')]('header',_0x20f11c);fs['writeFileSync'](_0x339661,_0x20f11c+'\x0a');Papa[_0xf955('0x6d')](fs[_0xf955('0x6e')](_0xabf581),{'header':!![],'skipEmptyLines':!![],'step':function(_0x46f0e2,_0x5491b2){try{for(var _0x2bf005=0x0,_0x29763d=[];_0x2bf005<_0x46f0e2[_0xf955('0x6f')][_0xf955('0x1a')];_0x2bf005++){stats[_0xf955('0x70')]+=0x1;if(_0x46f0e2[_0xf955('0x71')][_0x2bf005]){handleError(_0x46f0e2[_0xf955('0x6f')][_0x2bf005],_0x46f0e2[_0xf955('0x71')][_0x2bf005]);}else{var _0x5a45da=[];var _0x3960ec=[];var _0x1bc7b9={};for(var _0x58eb99 in _0x49400d){let _0x45dba4=contactItemTypes[_0xf955('0x72')](_0x54dac=>_0x54dac[_0xf955('0x6c')]===_0x58eb99);let _0x4e0e3f=contactItemTypes[_0xf955('0x72')](_0x360786=>_0x360786['name']+'_description'===_0x58eb99);if(_[_0xf955('0x1b')](_0x45dba4)&&_[_0xf955('0x1b')](_0x4e0e3f)){if(_0x49400d[_0xf955('0x73')](_0x58eb99)){if(_0x46f0e2[_0xf955('0x6f')][_0x2bf005][_0x49400d[_0x58eb99]]){var _0x1a61d9=_[_0xf955('0x74')](_0x46f0e2[_0xf955('0x6f')][_0x2bf005][_0x49400d[_0x58eb99]][_0xf955('0x75')](/"/g,'\x27'));switch(_0x58eb99){case _0xf955('0x76'):var _0xc6b79=moment(_0x1a61d9,_0xf955('0xd'),!![]);if(_0xc6b79[_0xf955('0x77')]()){_0x29763d[_0xf955('0x1d')]('\x22'+_0x1a61d9+'\x22');}else{_0x5a45da[_0xf955('0x1d')](_0xf955('0x78'));}break;case _0xf955('0x37'):var _0x102ef0=parseInt(_0x1a61d9);_0x1a61d9=_[_0xf955('0x79')](_0x102ef0)||_0x102ef0<0x0||_0x102ef0>0x4?_0x545c1f?0x3:0x2:_0x102ef0;_0x29763d['push']('\x22'+_0x1a61d9+'\x22');break;case _0xf955('0x38'):var _0x22b3b3=parseInt(_0x1a61d9);if(_[_0xf955('0x7a')](_0x22b3b3)&&_[_0xf955('0x7b')](_0x36364d,_0x22b3b3)){_0x29763d['push']('\x22'+_0x22b3b3+'\x22');}else{_0x5a45da[_0xf955('0x1d')](_0xf955('0x7c'));}break;case _0xf955('0x7d'):if(isEmail(_0x1a61d9)){_0x29763d[_0xf955('0x1d')]('\x22'+_0x1a61d9+'\x22');}else{_0x5a45da[_0xf955('0x1d')](_0xf955('0x7e'));}break;case _0xf955('0x7f'):var _0x46a692=moment(_0x1a61d9,_0xf955('0x80'),!![]);if(_0x46a692[_0xf955('0x77')]()){_0x29763d[_0xf955('0x1d')]('\x22'+_0x1a61d9+'\x22');}else{_0x5a45da['push'](_0xf955('0x81'));}break;default:_0x29763d[_0xf955('0x1d')]('\x22'+_0x1a61d9+'\x22');}}else{switch(_0x58eb99){case _0xf955('0x82'):case _0xf955('0x12'):_0x5a45da[_0xf955('0x1d')](_0x58eb99+_0xf955('0x83'));break;default:_0x29763d[_0xf955('0x1d')]('\x22\x22');}}}}else{var _0x57f27f='';if(!_[_0xf955('0x1b')](_0x45dba4)){if(!_0x1bc7b9['hasOwnProperty'](_0x45dba4['id'])){for(var _0x3bf047=0x0;_0x3bf047<_0x49400d[_0x58eb99]['length'];_0x3bf047++){var _0x1a61d9=_[_0xf955('0x74')](_0x46f0e2[_0xf955('0x6f')][_0x2bf005][_0x49400d[_0x58eb99][_0x3bf047]][_0xf955('0x75')](/"/g,'\x27'));var _0x6da71d=phoneDescriptions[_0xf955('0x72')](_0x4d0f28=>_0x4d0f28[_0xf955('0x84')]===_0x45dba4['id']);if(!_[_0xf955('0x1b')](_0x6da71d)){var _0xf9ec26=_['trim'](_0x46f0e2['data'][_0x2bf005][_0x49400d[_0x6da71d[_0xf955('0x85')]][0x0]][_0xf955('0x75')](/"/g,'\x27'));if(!_[_0xf955('0x1b')](_0xf9ec26))_0x1a61d9=_0x1a61d9+'§'+_0xf9ec26;}if(_0x57f27f=='')_0x57f27f=_0x1a61d9;else _0x57f27f+='|'+_0x1a61d9;}_0x3960ec['push'](_0x45dba4['id']+':'+_0x57f27f);_0x1bc7b9[_0x45dba4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x29763d[_0xf955('0x1d')]('\x22'+_0x3960ec['join'](';')+'\x22');}if(_0x5a45da[_0xf955('0x1a')]){handleError(_0x46f0e2['data'][_0x2bf005],{'code':_0xf955('0x86'),'message':_0x5a45da[_0xf955('0x13')]()});}else{fs[_0xf955('0x87')](_0x339661,_0x29763d['join']()+'\x0a');}_0x29763d=[];}if(!(stats[_0xf955('0x70')]%0xc8)){socket[_0xf955('0x88')](_0xf955('0x89')+_0x379aa,stats);stats['errors']=[];}}if(stopped){logger[_0xf955('0x61')](_0xf955('0x8a'));_0x5491b2[_0xf955('0x8b')]();}}catch(_0x3d796b){handleError(_0x46f0e2[_0xf955('0x6f')][_0x2bf005],{'code':_0xf955('0x8c'),'message':_0x3d796b[_0xf955('0x21')]});logger['error'](_0xf955('0x8d'),_0x3d796b[_0xf955('0x21')]);}},'complete':function(){try{var _0x98178c=[];var _0x347078=tempTableName;_0x98178c[_0xf955('0x1d')]('CREATE\x20TABLE\x20'+_0x347078+_0xf955('0x8e'));logger[_0xf955('0x61')]('CIS\x20len',contactItemTypes['length']);var _0x23b771=util[_0xf955('0xc')](_0xf955('0x8f'),_0x339661,_0x347078,_0x20f11c,_0x3149b3[_0xf955('0x35')],_0x3149b3['CompanyId']||null,NOW,NOW);if(_[_0xf955('0x1b')](_0x49400d['scheduledat'])){_0x23b771+=',\x20scheduledAt\x20=\x20NOW()';}_0x98178c[_0xf955('0x1d')](_0x23b771);BPromise[_0xf955('0x90')](_0x98178c,handleQuery)['then'](function(_0x480610){BPromise[_0xf955('0x91')]([handleAdditionalPhones()])[_0xf955('0x1e')](function(){_0x98178c=[];for(var _0x13e548=0x0;_0x13e548\x20\x27\x27\x20THEN\x20i.from\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','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','./update-interaction','updateInteraction','getAccountFK','role','agent','search','select','field','name','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','ui.','from','left_join','users'];(function(_0x476bf4,_0x5e8a43){var _0x2f170b=function(_0x2f0c5e){while(--_0x2f0c5e){_0x476bf4['push'](_0x476bf4['shift']());}};_0x2f170b(++_0x5e8a43);}(_0xed36,0x120));var _0x6ed3=function(_0x2de1dd,_0x321140){_0x2de1dd=_0x2de1dd-0x0;var _0x5b7537=_0xed36[_0x2de1dd];return _0x5b7537;};'use strict';var _=require(_0x6ed3('0x0'));var squel=require(_0x6ed3('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require(_0x6ed3('0x2'))[_0x6ed3('0x3')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x32813a,_0x8c7b68,_0x8c5eeb){var _0x1e5bf8=![];var _0x3f7d10=utils[_0x6ed3('0x4')](_0x32813a);if(_0x8c7b68[_0x6ed3('0x5')]===_0x6ed3('0x6')&&!_0x8c5eeb[_0x6ed3('0x7')]&&!_0x8c5eeb[_0x3f7d10]){_0x1e5bf8=!![];}return _0x1e5bf8;}function getTagsQuery(){return squel[_0x6ed3('0x8')]()[_0x6ed3('0x9')]('id')[_0x6ed3('0x9')](_0x6ed3('0xa'))[_0x6ed3('0x9')]('color')['from'](_0x6ed3('0xb'));}function getUsersQuery(_0x15f971,_0x202483){var _0xbd5fd0=utils[_0x6ed3('0xc')](_0x15f971);var _0x5a55c8=_0x6ed3('0xd')+_0x15f971+_0x6ed3('0xe');var _0x617e74=squel[_0x6ed3('0x8')]()[_0x6ed3('0x9')]('u.id')[_0x6ed3('0x9')](_0x6ed3('0xf'))[_0x6ed3('0x9')](_0x6ed3('0x10')+_0xbd5fd0)[_0x6ed3('0x11')](_0x5a55c8,'ui')[_0x6ed3('0x12')](_0x6ed3('0x13'),'u',_0x6ed3('0x14'));if(_0x202483['length']>0x0){_0x617e74[_0x6ed3('0x15')]('ui.'+_0xbd5fd0+_0x6ed3('0x16'),_[_0x6ed3('0x17')](_0x202483,'id'));}return _0x617e74;}function getInteractionsQuery(_0x5d285c){var _0x5e377b=utils[_0x6ed3('0x18')](_0x5d285c);var _0x1ba760=utils['getAccountFK'](_0x5d285c);var _0x1afb63=utils['getInteractionFK'](_0x5d285c);return squel[_0x6ed3('0x8')]()['from'](_0x5e377b[_0x6ed3('0x19')],'i')['left_join'](_0x6ed3('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6ed3('0x12')](_0x6ed3('0x13'),'o',_0x6ed3('0x1b'))['left_join'](_0x5e377b[_0x6ed3('0x1c')],'a',_0x6ed3('0x1d')+_0x1ba760)[_0x6ed3('0x12')](_0x5e377b[_0x6ed3('0x1e')],'me',_0x6ed3('0x1f')+_0x1afb63+'\x20=\x20i.id')[_0x6ed3('0x12')](_0x5e377b['interactionsTags'],'it',_0x6ed3('0x20')+_0x1afb63+'\x20=\x20i.id')[_0x6ed3('0x12')](_0x6ed3('0xb'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x254349={'body':squel[_0x6ed3('0x21')](),'contact':squel[_0x6ed3('0x21')](),'default':squel['expr'](),'fields':squel[_0x6ed3('0x21')](),'filter':squel['expr'](),'read':squel[_0x6ed3('0x21')](),'tags':{'clause':squel[_0x6ed3('0x21')](),'ids':null},'user':squel[_0x6ed3('0x21')]()};return _0x254349;}function parseTagParameter(_0x44add4){var _0x3afc2c=squel['expr']();if(_0x44add4){var _0x3d8e11=utils[_0x6ed3('0x22')](_0x44add4);_0x3d8e11[_0x6ed3('0x23')](function(_0x1e053d){_0x3afc2c['or'](_0x6ed3('0x24'),'%,'+_0x1e053d+',%');});}return _0x3afc2c;}function parseReadParameter(_0x18b6b0){var _0x2ded2a='';if(_0x18b6b0){_0x2ded2a=_0x6ed3('0x25');if(_0x18b6b0==='1'){_0x2ded2a=_0x2ded2a['replace']('{OPERATOR}','=');}else{_0x2ded2a=_0x2ded2a['replace'](_0x6ed3('0x26'),'>');}}return _0x2ded2a;}function parseSearchFilter(_0xceeff2,_0x4cb9e4){var _0x54c512=squel[_0x6ed3('0x21')]();if(_0x4cb9e4){var _0x56c584=_0x4cb9e4[_0x6ed3('0x27')]('\x5c','\x5c\x5c')[_0x6ed3('0x27')](/'/g,'\x27\x27');if(qs[_0x6ed3('0x28')](_0x56c584)){_0x54c512['or'](_0x6ed3('0x29'),_0x56c584+'%');if([_0x6ed3('0x2a'),_0x6ed3('0x2b')][_0x6ed3('0x2c')](_0xceeff2)){_0x54c512['or']('i.phone\x20LIKE\x20?',_0x56c584+'%');}else if(_0xceeff2===_0x6ed3('0x2d')){_0x54c512['or'](_0x6ed3('0x2e'),_0x56c584+'%');}else if(_0xceeff2===_0x6ed3('0x2f')){_0x54c512['or'](_0x6ed3('0x30'),_0x56c584+'%');}}else if(_0xceeff2===_0x6ed3('0x31')&&qs['isEmail'](_0x56c584)){_0x54c512['or']('c.email\x20LIKE\x20?',_0x56c584+'%');}else{if(_0xceeff2===_0x6ed3('0x31')){_0x54c512['or'](_0x6ed3('0x32'),qs[_0x6ed3('0x33')](_0x56c584,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6ed3('0x33')](_0x56c584));}else if(_0xceeff2!==_0x6ed3('0x2d')){_0x54c512['or'](_0x6ed3('0x34'),qs[_0x6ed3('0x33')](_0x56c584));}_0x54c512['or'](_0x6ed3('0x35'),qs['getFullTextValue'](_0x56c584,!![]),null);}}return _0x54c512;}function parseAdvancedSearchFilter(_0x3b09de,_0x143fe3){var _0x3eb093=getSqlClauses();var _0x1e96ba=as['parseSearch'](_0x3b09de);var _0xe87e17=_0x1e96ba[_0x6ed3('0x36')];for(var _0xe6b867=0x0;_0xe6b867<_0x1e96ba['conditions'][_0x6ed3('0x37')];_0xe6b867++){var _0x17be26=_0x1e96ba['conditions'][_0xe6b867];var _0x36e5a0='i';var _0x2ff429=_[_0x6ed3('0x38')](_0x143fe3,['name',_0x17be26['field']]);if(_0x2ff429){var _0x3e66fe=as[_0x6ed3('0x39')](_0x36e5a0,_0x2ff429['type'],_0x17be26);_0x3eb093[_0x6ed3('0x3a')][_0xe87e17](_0x3e66fe['text'],_0x3e66fe['value']['start'],_0x3e66fe[_0x6ed3('0x3b')][_0x6ed3('0x3c')]);}else{switch(_0x17be26[_0x6ed3('0x9')]){case _0x6ed3('0x3d'):var _0x112655=parseReadParameter(_0x17be26[_0x6ed3('0x3b')]);_0x3eb093['read']['and'](_0x112655);break;case'Contact':if(_0x17be26[_0x6ed3('0x3e')]===_0x6ed3('0x3f')){if(_0x17be26[_0x6ed3('0x3b')][_0x6ed3('0x40')]('\x20')[_0x6ed3('0x37')]>0x1){_0x3eb093[_0x6ed3('0x41')][_0xe87e17](_0x6ed3('0x35'),qs[_0x6ed3('0x33')](_0x17be26['value'],!![]),null);}else{var _0x5d1729='%'+_0x17be26['value']+'%';_0x3eb093[_0x6ed3('0x41')][_0xe87e17]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5d1729,_0x5d1729,_0x5d1729);}}else{_0x2ff429=_[_0x6ed3('0x38')](_0x143fe3,[_0x6ed3('0xa'),_0x6ed3('0x42')]);_0x17be26[_0x6ed3('0x9')]=_0x6ed3('0x42');_0x3e66fe=as['buildExpression'](_0x36e5a0,_0x2ff429[_0x6ed3('0x43')],_0x17be26);_0x3eb093[_0x6ed3('0x41')][_0xe87e17](_0x3e66fe[_0x6ed3('0x44')],_0x3e66fe[_0x6ed3('0x3b')][_0x6ed3('0x45')],_0x3e66fe[_0x6ed3('0x3b')]['end']);}break;case _0x6ed3('0x46'):var _0x123414=_0x17be26[_0x6ed3('0x3b')]['split'](',')[_0x6ed3('0x17')](function(_0x2e44f3){return Number(_0x2e44f3);});var _0x3bd320=parseTagParameter(_0x123414);_0x3eb093[_0x6ed3('0x47')]['clause']['and'](_0x3bd320);_0x3eb093[_0x6ed3('0x47')][_0x6ed3('0x48')]=_0x123414;break;case _0x6ed3('0x49'):if(_0x17be26[_0x6ed3('0x3e')]===_0x6ed3('0x3f')){_0x3eb093[_0x6ed3('0x4a')][_0xe87e17](_0x6ed3('0x4b'),'%'+_0x17be26[_0x6ed3('0x3b')]+'%',null);}else{_0x2ff429=_[_0x6ed3('0x38')](_0x143fe3,[_0x6ed3('0xa'),_0x6ed3('0x4c')]);_0x17be26[_0x6ed3('0x9')]='UserId';_0x3e66fe=as[_0x6ed3('0x39')](_0x36e5a0,_0x2ff429[_0x6ed3('0x43')],_0x17be26);_0x3eb093[_0x6ed3('0x4a')][_0xe87e17](_0x3e66fe[_0x6ed3('0x44')],_0x3e66fe[_0x6ed3('0x3b')]['start'],_0x3e66fe['value'][_0x6ed3('0x3c')]);}break;case _0x6ed3('0x4d'):case'plainBody':_0x3e66fe=as['buildExpression']('me',null,_0x17be26);_0x3eb093['body'][_0xe87e17](_0x3e66fe[_0x6ed3('0x44')],_0x3e66fe[_0x6ed3('0x3b')][_0x6ed3('0x45')],_0x3e66fe[_0x6ed3('0x3b')][_0x6ed3('0x3c')]);break;}}}return _0x3eb093;}function parseModelFields(_0x3f861d,_0x226acf,_0x414343){var _0x58417b=utils[_0x6ed3('0x4')](_0x3f861d);var _0xe48c7e=squel['expr']();var _0x43bc32=_(_0x226acf)[_0x6ed3('0x4e')]()[_0x6ed3('0x17')](function(_0x1ad6ac){return _['some'](_0x414343,[_0x6ed3('0xa'),_0x1ad6ac])?_0x1ad6ac:undefined;})[_0x6ed3('0x4f')]()[_0x6ed3('0x3b')]();if(_0x43bc32['length']>0x0){_0x43bc32[_0x6ed3('0x23')](function(_0x3ae5ed){if(_0x3ae5ed===_0x58417b){_0xe48c7e[_0x6ed3('0x50')]('i.'+_0x58417b+_0x6ed3('0x16'),[]['concat'](_0x226acf[_0x3ae5ed]));}else if(_0x3ae5ed==='createdAt'){var _0x2f9a64=JSON[_0x6ed3('0x51')](_0x226acf[_0x3ae5ed])['$gte'];var _0x5aefe9=JSON[_0x6ed3('0x51')](_0x226acf[_0x3ae5ed])['$lte'];_0xe48c7e[_0x6ed3('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2f9a64,_0x5aefe9);}else{if(_0x226acf[_0x3ae5ed]===_0x6ed3('0x52')){_0xe48c7e[_0x6ed3('0x50')]('i.'+_0x3ae5ed+_0x6ed3('0x53'));}else{_0xe48c7e[_0x6ed3('0x50')]('i.'+_0x3ae5ed+'\x20=\x20?',_0x226acf[_0x3ae5ed]);}}});}return _0xe48c7e;}function parseQueryParameters(_0x4cb8be,_0x37f790,_0x11391b){var _0x2c27c8=getSqlClauses();return Promise[_0x6ed3('0x54')]()[_0x6ed3('0x55')](function(){return parseModelFields(_0x4cb8be,_0x37f790,_0x11391b);})[_0x6ed3('0x55')](function(_0x1003a3){_0x2c27c8[_0x6ed3('0x56')][_0x6ed3('0x50')](_0x1003a3);return parseReadParameter(_0x37f790['read']);})['then'](function(_0x5a26df){_0x2c27c8['read'][_0x6ed3('0x50')](_0x5a26df);return parseTagParameter(_0x37f790[_0x6ed3('0x57')]);})[_0x6ed3('0x55')](function(_0xab38d2){_0x2c27c8['tags'][_0x6ed3('0x58')]['and'](_0xab38d2);return parseSearchFilter(_0x4cb8be,_0x37f790[_0x6ed3('0x59')]);})[_0x6ed3('0x55')](function(_0x546665){_0x2c27c8[_0x6ed3('0x59')]=_0x546665;return _0x2c27c8;});}function checkAccountsRestrictions(_0x56a2f6,_0x51eb0e,_0x1de483){var _0x20aafd=utils['getAccountFK'](_0x56a2f6);var _0x467792='get'+_[_0x6ed3('0x5a')](_0x56a2f6)+(_0x56a2f6===_0x6ed3('0x5b')?_0x6ed3('0x5c'):_0x6ed3('0x5d'));var _0x20a33c=squel[_0x6ed3('0x21')]();return Promise[_0x6ed3('0x54')]()[_0x6ed3('0x55')](function(){if(_0x1de483[_0x6ed3('0x7')]&&_0x51eb0e[_0x6ed3('0x5')]==='agent'){return _0x51eb0e[_0x467792]({'attributes':['id'],'raw':!![]});}})[_0x6ed3('0x55')](function(_0x4ccf28){if(_0x4ccf28){if(_0x4ccf28[_0x6ed3('0x37')]===0x0){_0x20a33c[_0x6ed3('0x50')]('i.'+_0x20aafd+_0x6ed3('0x53'));}else{_0x20a33c['and']('i.'+_0x20aafd+_0x6ed3('0x16'),_[_0x6ed3('0x17')](_0x4ccf28,'id'));}}else if(!_0x1de483[_0x20aafd]){_0x20a33c[_0x6ed3('0x50')]('i.'+_0x20aafd+_0x6ed3('0x5e'));}})[_0x6ed3('0x55')](function(){return _0x20a33c;});}function getClosedOrderClause(_0x5d9262,_0x533db5){var _0x5cb0ba='';var _0x2fee7a=[_0x6ed3('0x5f'),_0x6ed3('0x60'),_0x6ed3('0x61')];if(_0x5d9262===_0x6ed3('0x31')){_0x2fee7a[_0x6ed3('0x62')](_0x6ed3('0x63'));}if(_0x533db5[_0x6ed3('0x64')]==='0'&&_0x5d9262===_0x6ed3('0x31')){_0x5cb0ba=_0x6ed3('0x63');}else{if(_0x533db5['closed']==='1'){_0x2fee7a[_0x6ed3('0x65')]();}_0x5cb0ba='CONCAT_WS(\x27\x27,\x20'+_0x2fee7a[_0x6ed3('0x66')](',\x20')+')';}return _0x5cb0ba;}function getFilteredInteractions(_0x31e5e4,_0x2d04af,_0x2278d3,_0x328dc0){var _0x290019=utils[_0x6ed3('0xc')](_0x31e5e4);var _0xfff32a=_['capitalize'](_0x31e5e4)+'Interaction';var _0x509c8f=[];var _0x28332e=getTagsQuery();var _0x8a411b={'type':db[_0x6ed3('0x67')][_0x6ed3('0x68')]['SELECT'],'raw':!![]};var _0x29c844=[];var _0x55c2cc=[];return db['sequelize'][_0x6ed3('0x69')](_0x28332e[_0x6ed3('0x6a')](),_0x8a411b)[_0x6ed3('0x55')](function(_0x44b0b7){_0x509c8f=_['keyBy'](_0x44b0b7,'id');_0x8a411b=_[_0x6ed3('0x6b')](_0x8a411b,{'model':db[_0xfff32a],'mapToModel':!![],'nest':!![]});if(_0x2278d3[_0x6ed3('0x56')]){_0x328dc0[_0x6ed3('0x6c')][_0x6ed3('0x23')](function(_0x2bc1f3){_0x2d04af['field']('i.'+_0x2bc1f3);});}else{_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x6d'),_0x6ed3('0x3d'));_0x2d04af[_0x6ed3('0x9')]('a.key','Account.key');_0x2d04af['field']('a.mandatoryDisposition',_0x6ed3('0x6e'));if(_0x31e5e4===_0x6ed3('0x31')){_0x2d04af['field'](_0x6ed3('0x6f'),_0x6ed3('0x70'));_0x2d04af[_0x6ed3('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\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',_0x6ed3('0x71'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x72'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x73'));_0x2d04af[_0x6ed3('0x9')]('i.updatedAt');_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x74'));_0x2d04af['field'](_0x6ed3('0x75'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x76'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x77'));_0x2d04af['field'](_0x6ed3('0x78'));_0x2d04af[_0x6ed3('0x9')]('i.subject');_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x61'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x60'));_0x2d04af['field'](_0x6ed3('0x5f'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x63'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x79'));_0x2d04af['field'](_0x6ed3('0x7a'));_0x2d04af[_0x6ed3('0x9')]('i.MailAccountId');_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x7b'));}else if(_0x31e5e4===_0x6ed3('0x2f')){_0x2d04af['field'](_0x6ed3('0x7c'),_0x6ed3('0x71'));}else{_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x7d'),'contactName');}if(_0x31e5e4!==_0x6ed3('0x31')){_0x2d04af['field']('i.*');}_0x2d04af['field'](_0x6ed3('0x7e'),_0x6ed3('0x7f'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x80'),_0x6ed3('0x81'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x82'),'Contact.email');_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x83'),_0x6ed3('0x84'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x85'),'Contact.mobile');_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x86'),_0x6ed3('0x87'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x88'),_0x6ed3('0x89'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x8a'),_0x6ed3('0x8b'));_0x2d04af[_0x6ed3('0x9')](_0x6ed3('0x8c'),_0x6ed3('0x8d'));}if(_0x328dc0['limit']){_0x2d04af[_0x6ed3('0x8e')](_0x328dc0[_0x6ed3('0x8e')]);}if(_0x328dc0[_0x6ed3('0x8f')]){_0x2d04af[_0x6ed3('0x8f')](_0x328dc0[_0x6ed3('0x8f')]);}return db[_0x6ed3('0x90')]['query'](_0x2d04af[_0x6ed3('0x6a')](),_0x8a411b);})['then'](function(_0x2b287a){_0x29c844=_0x2b287a;var _0x6c7b15=getUsersQuery(_0x31e5e4,_0x29c844);return db[_0x6ed3('0x90')][_0x6ed3('0x69')](_0x6c7b15['toString'](),_0x8a411b);})['then'](function(_0x50c466){_0x55c2cc=_[_0x6ed3('0x91')](_0x50c466,_0x290019);if(_0x31e5e4===_0x6ed3('0x31')){return db['Setting'][_0x6ed3('0x92')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x6ed3('0x55')](function(_0x516407){var _0x4b4830=_0x516407?_0x516407[_0x6ed3('0x93')]:undefined;var _0x431cf5=_0x29c844[_0x6ed3('0x17')](function(_0x45ccf9){return updateInteraction(_0x45ccf9,_0x509c8f,_0x55c2cc,_0x4b4830);});return Promise[_0x6ed3('0x94')](_0x431cf5);});}function countFilteredInteractions(_0x472fd5,_0x59f9c5){var _0x2ebaaa=_0x472fd5[_0x6ed3('0x95')]();_0x2ebaaa[_0x6ed3('0x9')](_0x6ed3('0x96'));_0x2ebaaa['field'](_0x6ed3('0x6d'),'unreadMessages');var _0x444c6e=utils[_0x6ed3('0x22')](_0x59f9c5);if(!_[_0x6ed3('0x97')](_0x444c6e)){_0x2ebaaa[_0x6ed3('0x15')](_0x6ed3('0x98'),_0x444c6e);}var _0x3c2b58={'type':db['Sequelize'][_0x6ed3('0x68')]['SELECT'],'raw':!![]};return db[_0x6ed3('0x90')][_0x6ed3('0x69')](_0x2ebaaa[_0x6ed3('0x6a')](),_0x3c2b58);}module[_0x6ed3('0x99')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x62b5=['enableEmailPreview','all','clone','t.id\x20IN\x20?','Sequelize','QueryTypes','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','field','name','color','from','tools_tags','getInteractionFK','_interactions','select','u.id','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','default','text','start','value','end','unreadMessages','read','and','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','clause','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','concat','createdAt','$gte','parse','null','\x20IS\x20NULL','\x20=\x20?','then','fields','tags','filter','chat','Websites','resolve','\x20IS\x20NOT\x20NULL','i.secondDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\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','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\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','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','i.*','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','findOne'];(function(_0x5b9416,_0x1d2b28){var _0x22ec13=function(_0x36e1c9){while(--_0x36e1c9){_0x5b9416['push'](_0x5b9416['shift']());}};_0x22ec13(++_0x1d2b28);}(_0x62b5,0x1f0));var _0x562b=function(_0x183748,_0x3a739b){_0x183748=_0x183748-0x0;var _0x1cb930=_0x62b5[_0x183748];return _0x1cb930;};'use strict';var _=require(_0x562b('0x0'));var squel=require(_0x562b('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x562b('0x2'));var updateInteraction=require(_0x562b('0x3'))[_0x562b('0x4')];var utils=require(_0x562b('0x5'));var db=require(_0x562b('0x6'))['db'];function skipInteractionsQuery(_0x590302,_0xb6c9c,_0x1671fa){var _0x497380=![];var _0x3898e3=utils[_0x562b('0x7')](_0x590302);if(_0xb6c9c['role']===_0x562b('0x8')&&!_0x1671fa[_0x562b('0x9')]&&!_0x1671fa[_0x3898e3]){_0x497380=!![];}return _0x497380;}function getTagsQuery(){return squel['select']()[_0x562b('0xa')]('id')[_0x562b('0xa')](_0x562b('0xb'))['field'](_0x562b('0xc'))[_0x562b('0xd')](_0x562b('0xe'));}function getUsersQuery(_0x3c86f2,_0x19c62f){var _0x22afd8=utils[_0x562b('0xf')](_0x3c86f2);var _0x19dd8b='user_has_'+_0x3c86f2+_0x562b('0x10');var _0x37aa6d=squel[_0x562b('0x11')]()[_0x562b('0xa')](_0x562b('0x12'))[_0x562b('0xa')](_0x562b('0x13'))['field'](_0x562b('0x14')+_0x22afd8)[_0x562b('0xd')](_0x19dd8b,'ui')[_0x562b('0x15')]('users','u',_0x562b('0x16'));if(_0x19c62f[_0x562b('0x17')]>0x0){_0x37aa6d[_0x562b('0x18')](_0x562b('0x14')+_0x22afd8+_0x562b('0x19'),_[_0x562b('0x1a')](_0x19c62f,'id'));}return _0x37aa6d;}function getInteractionsQuery(_0x268f4f){var _0x23e369=utils[_0x562b('0x1b')](_0x268f4f);var _0x5c52d6=utils[_0x562b('0x7')](_0x268f4f);var _0x4ac61d=utils['getInteractionFK'](_0x268f4f);return squel[_0x562b('0x11')]()['from'](_0x23e369[_0x562b('0x1c')],'i')[_0x562b('0x15')]('cm_contacts','c',_0x562b('0x1d'))[_0x562b('0x15')](_0x562b('0x1e'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x23e369['accounts'],'a',_0x562b('0x1f')+_0x5c52d6)[_0x562b('0x15')](_0x23e369[_0x562b('0x20')],'me',_0x562b('0x21')+_0x4ac61d+_0x562b('0x22'))[_0x562b('0x15')](_0x23e369[_0x562b('0x23')],'it','it.'+_0x4ac61d+_0x562b('0x22'))[_0x562b('0x15')](_0x562b('0xe'),'t',_0x562b('0x24'));}function getSqlClauses(){var _0x280052={'body':squel[_0x562b('0x25')](),'contact':squel[_0x562b('0x25')](),'default':squel[_0x562b('0x25')](),'fields':squel[_0x562b('0x25')](),'filter':squel['expr'](),'read':squel[_0x562b('0x25')](),'tags':{'clause':squel[_0x562b('0x25')](),'ids':null},'user':squel[_0x562b('0x25')]()};return _0x280052;}function parseTagParameter(_0x59beb3){var _0x21fa47=squel[_0x562b('0x25')]();if(_0x59beb3){var _0x355caa=utils[_0x562b('0x26')](_0x59beb3);_0x355caa[_0x562b('0x27')](function(_0x364f7b){_0x21fa47['or'](_0x562b('0x28'),'%,'+_0x364f7b+',%');});}return _0x21fa47;}function parseReadParameter(_0x1f7204){var _0xbbbf0='';if(_0x1f7204){_0xbbbf0=_0x562b('0x29');if(_0x1f7204==='1'){_0xbbbf0=_0xbbbf0['replace'](_0x562b('0x2a'),'=');}else{_0xbbbf0=_0xbbbf0[_0x562b('0x2b')](_0x562b('0x2a'),'>');}}return _0xbbbf0;}function parseSearchFilter(_0x53f043,_0x41a124){var _0x576343=squel[_0x562b('0x25')]();if(_0x41a124){var _0x22f876=_0x41a124[_0x562b('0x2b')]('\x5c','\x5c\x5c')[_0x562b('0x2b')](/'/g,'\x27\x27');if(qs[_0x562b('0x2c')](_0x22f876)){_0x576343['or']('i.id\x20LIKE\x20?',_0x22f876+'%');if([_0x562b('0x2d'),_0x562b('0x2e')][_0x562b('0x2f')](_0x53f043)){_0x576343['or'](_0x562b('0x30'),_0x22f876+'%');}else if(_0x53f043===_0x562b('0x31')){_0x576343['or']('i.fax\x20LIKE\x20?',_0x22f876+'%');}else if(_0x53f043===_0x562b('0x32')){_0x576343['or'](_0x562b('0x33'),_0x22f876+'%');}}else if(_0x53f043===_0x562b('0x34')&&qs[_0x562b('0x35')](_0x22f876)){_0x576343['or'](_0x562b('0x36'),_0x22f876+'%');}else{if(_0x53f043===_0x562b('0x34')){_0x576343['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x562b('0x37')](_0x22f876,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x562b('0x37')](_0x22f876));}else if(_0x53f043!==_0x562b('0x31')){_0x576343['or'](_0x562b('0x38'),qs['getFullTextValue'](_0x22f876));}_0x576343['or'](_0x562b('0x39'),qs[_0x562b('0x37')](_0x22f876,!![]),null);}}return _0x576343;}function parseAdvancedSearchFilter(_0x24dab1,_0x4b94c2){var _0x443f72=getSqlClauses();var _0x2d667e=as[_0x562b('0x3a')](_0x24dab1);var _0x29bb8b=_0x2d667e[_0x562b('0x3b')];for(var _0x4ad537=0x0;_0x4ad537<_0x2d667e[_0x562b('0x3c')][_0x562b('0x17')];_0x4ad537++){var _0x40c569=_0x2d667e[_0x562b('0x3c')][_0x4ad537];var _0x5b12e3='i';var _0x24495b=_[_0x562b('0x3d')](_0x4b94c2,[_0x562b('0xb'),_0x40c569[_0x562b('0xa')]]);if(_0x24495b){var _0x579aac=as['buildExpression'](_0x5b12e3,_0x24495b[_0x562b('0x3e')],_0x40c569);_0x443f72[_0x562b('0x3f')][_0x29bb8b](_0x579aac[_0x562b('0x40')],_0x579aac['value'][_0x562b('0x41')],_0x579aac[_0x562b('0x42')][_0x562b('0x43')]);}else{switch(_0x40c569['field']){case _0x562b('0x44'):var _0x26157c=parseReadParameter(_0x40c569[_0x562b('0x42')]);_0x443f72[_0x562b('0x45')][_0x562b('0x46')](_0x26157c);break;case _0x562b('0x47'):if(_0x40c569[_0x562b('0x48')]===_0x562b('0x49')){if(_0x40c569[_0x562b('0x42')]['split']('\x20')[_0x562b('0x17')]>0x1){_0x443f72[_0x562b('0x4a')][_0x29bb8b](_0x562b('0x39'),qs[_0x562b('0x37')](_0x40c569[_0x562b('0x42')],!![]),null);}else{var _0x534058='%'+_0x40c569[_0x562b('0x42')]+'%';_0x443f72[_0x562b('0x4a')][_0x29bb8b](_0x562b('0x4b'),_0x534058,_0x534058,_0x534058);}}else{_0x24495b=_[_0x562b('0x3d')](_0x4b94c2,[_0x562b('0xb'),_0x562b('0x4c')]);_0x40c569[_0x562b('0xa')]='ContactId';_0x579aac=as[_0x562b('0x4d')](_0x5b12e3,_0x24495b[_0x562b('0x3e')],_0x40c569);_0x443f72[_0x562b('0x4a')][_0x29bb8b](_0x579aac['text'],_0x579aac['value'][_0x562b('0x41')],_0x579aac[_0x562b('0x42')][_0x562b('0x43')]);}break;case _0x562b('0x4e'):var _0x3794d9=_0x40c569['value']['split'](',')[_0x562b('0x1a')](function(_0xf3277c){return Number(_0xf3277c);});var _0x1d990d=parseTagParameter(_0x3794d9);_0x443f72['tags'][_0x562b('0x4f')][_0x562b('0x46')](_0x1d990d);_0x443f72['tags'][_0x562b('0x50')]=_0x3794d9;break;case'User':if(_0x40c569[_0x562b('0x48')]===_0x562b('0x49')){_0x443f72[_0x562b('0x51')][_0x29bb8b](_0x562b('0x52'),'%'+_0x40c569[_0x562b('0x42')]+'%',null);}else{_0x24495b=_[_0x562b('0x3d')](_0x4b94c2,['name',_0x562b('0x53')]);_0x40c569[_0x562b('0xa')]=_0x562b('0x53');_0x579aac=as[_0x562b('0x4d')](_0x5b12e3,_0x24495b[_0x562b('0x3e')],_0x40c569);_0x443f72[_0x562b('0x51')][_0x29bb8b](_0x579aac[_0x562b('0x40')],_0x579aac[_0x562b('0x42')][_0x562b('0x41')],_0x579aac[_0x562b('0x42')][_0x562b('0x43')]);}break;case'body':case'plainBody':_0x579aac=as[_0x562b('0x4d')]('me',null,_0x40c569);_0x443f72[_0x562b('0x54')][_0x29bb8b](_0x579aac[_0x562b('0x40')],_0x579aac[_0x562b('0x42')][_0x562b('0x41')],_0x579aac['value'][_0x562b('0x43')]);break;}}}return _0x443f72;}function parseModelFields(_0xd18f9c,_0xaea58c,_0xaf0f60){var _0x3623ba=utils[_0x562b('0x7')](_0xd18f9c);var _0x14e3b8=squel['expr']();var _0x42ffce=_(_0xaea58c)[_0x562b('0x55')]()[_0x562b('0x1a')](function(_0x2ad9a2){return _[_0x562b('0x56')](_0xaf0f60,['name',_0x2ad9a2])?_0x2ad9a2:undefined;})['compact']()[_0x562b('0x42')]();if(_0x42ffce['length']>0x0){_0x42ffce[_0x562b('0x27')](function(_0x28ed4a){if(_0x28ed4a===_0x3623ba){_0x14e3b8[_0x562b('0x46')]('i.'+_0x3623ba+_0x562b('0x19'),[][_0x562b('0x57')](_0xaea58c[_0x28ed4a]));}else if(_0x28ed4a===_0x562b('0x58')){var _0x553255=JSON['parse'](_0xaea58c[_0x28ed4a])[_0x562b('0x59')];var _0x28f10c=JSON[_0x562b('0x5a')](_0xaea58c[_0x28ed4a])['$lte'];_0x14e3b8['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x553255,_0x28f10c);}else{if(_0xaea58c[_0x28ed4a]===_0x562b('0x5b')){_0x14e3b8[_0x562b('0x46')]('i.'+_0x28ed4a+_0x562b('0x5c'));}else{_0x14e3b8[_0x562b('0x46')]('i.'+_0x28ed4a+_0x562b('0x5d'),_0xaea58c[_0x28ed4a]);}}});}return _0x14e3b8;}function parseQueryParameters(_0x25df85,_0x9f6805,_0x4ecac2){var _0x321b71=getSqlClauses();return Promise['resolve']()[_0x562b('0x5e')](function(){return parseModelFields(_0x25df85,_0x9f6805,_0x4ecac2);})['then'](function(_0x44c216){_0x321b71[_0x562b('0x5f')][_0x562b('0x46')](_0x44c216);return parseReadParameter(_0x9f6805[_0x562b('0x45')]);})[_0x562b('0x5e')](function(_0x20c993){_0x321b71[_0x562b('0x45')][_0x562b('0x46')](_0x20c993);return parseTagParameter(_0x9f6805['tag']);})[_0x562b('0x5e')](function(_0x5e629b){_0x321b71[_0x562b('0x60')][_0x562b('0x4f')][_0x562b('0x46')](_0x5e629b);return parseSearchFilter(_0x25df85,_0x9f6805[_0x562b('0x61')]);})[_0x562b('0x5e')](function(_0x1964fc){_0x321b71['filter']=_0x1964fc;return _0x321b71;});}function checkAccountsRestrictions(_0x161bf5,_0x311914,_0x5becd2){var _0x2664c9=utils[_0x562b('0x7')](_0x161bf5);var _0x480e22='get'+_['capitalize'](_0x161bf5)+(_0x161bf5===_0x562b('0x62')?_0x562b('0x63'):'Accounts');var _0x6a6cf9=squel['expr']();return Promise[_0x562b('0x64')]()[_0x562b('0x5e')](function(){if(_0x5becd2[_0x562b('0x9')]&&_0x311914['role']===_0x562b('0x8')){return _0x311914[_0x480e22]({'attributes':['id'],'raw':!![]});}})[_0x562b('0x5e')](function(_0x429107){if(_0x429107){if(_0x429107[_0x562b('0x17')]===0x0){_0x6a6cf9[_0x562b('0x46')]('i.'+_0x2664c9+'\x20IS\x20NULL');}else{_0x6a6cf9['and']('i.'+_0x2664c9+_0x562b('0x19'),_[_0x562b('0x1a')](_0x429107,'id'));}}else if(!_0x5becd2[_0x2664c9]){_0x6a6cf9[_0x562b('0x46')]('i.'+_0x2664c9+_0x562b('0x65'));}})[_0x562b('0x5e')](function(){return _0x6a6cf9;});}function getClosedOrderClause(_0x424836,_0x1e737d){var _0x5baba7='';var _0xe31205=['i.thirdDisposition',_0x562b('0x66'),'i.disposition'];if(_0x424836===_0x562b('0x34')){_0xe31205[_0x562b('0x67')](_0x562b('0x68'));}if(_0x1e737d[_0x562b('0x69')]==='0'&&_0x424836===_0x562b('0x34')){_0x5baba7=_0x562b('0x68');}else{if(_0x1e737d[_0x562b('0x69')]==='1'){_0xe31205[_0x562b('0x6a')]();}_0x5baba7=_0x562b('0x6b')+_0xe31205[_0x562b('0x6c')](',\x20')+')';}return _0x5baba7;}function getFilteredInteractions(_0x57f92f,_0xbb1b73,_0x9ac007,_0x41b5eb){var _0x19c24c=utils['getInteractionFK'](_0x57f92f);var _0x432afb=_['capitalize'](_0x57f92f)+_0x562b('0x6d');var _0x2cc807=[];var _0x29ab87=getTagsQuery();var _0x3db2df={'type':db['Sequelize']['QueryTypes'][_0x562b('0x6e')],'raw':!![]};var _0x4f1a48=[];var _0x17e83e=[];return db[_0x562b('0x6f')][_0x562b('0x70')](_0x29ab87[_0x562b('0x71')](),_0x3db2df)[_0x562b('0x5e')](function(_0x92c5bc){_0x2cc807=_[_0x562b('0x72')](_0x92c5bc,'id');_0x3db2df=_[_0x562b('0x73')](_0x3db2df,{'model':db[_0x432afb],'mapToModel':!![],'nest':!![]});if(_0x9ac007[_0x562b('0x5f')]){_0x41b5eb['attributes']['forEach'](function(_0xec0913){_0xbb1b73[_0x562b('0xa')]('i.'+_0xec0913);});}else{_0xbb1b73[_0x562b('0xa')](_0x562b('0x74'),_0x562b('0x44'));_0xbb1b73['field']('a.key',_0x562b('0x75'));_0xbb1b73['field'](_0x562b('0x76'),_0x562b('0x77'));if(_0x57f92f===_0x562b('0x34')){_0xbb1b73[_0x562b('0xa')](_0x562b('0x78'),'Account.email');_0xbb1b73[_0x562b('0xa')](_0x562b('0x79'),_0x562b('0x7a'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x7b'));_0xbb1b73['field'](_0x562b('0x7c'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x7d'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x7e'));_0xbb1b73['field'](_0x562b('0x7f'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x80'));_0xbb1b73['field'](_0x562b('0x81'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x82'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x83'));_0xbb1b73['field'](_0x562b('0x84'));_0xbb1b73['field']('i.secondDisposition');_0xbb1b73['field']('i.thirdDisposition');_0xbb1b73[_0x562b('0xa')](_0x562b('0x68'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x85'));_0xbb1b73[_0x562b('0xa')]('i.ContactId');_0xbb1b73['field']('i.MailAccountId');_0xbb1b73[_0x562b('0xa')](_0x562b('0x86'));}else if(_0x57f92f===_0x562b('0x32')){_0xbb1b73[_0x562b('0xa')](_0x562b('0x87'),_0x562b('0x7a'));}else{_0xbb1b73['field'](_0x562b('0x88'),'contactName');}if(_0x57f92f!=='mail'){_0xbb1b73[_0x562b('0xa')](_0x562b('0x89'));}_0xbb1b73['field']('c.firstName',_0x562b('0x8a'));_0xbb1b73['field'](_0x562b('0x8b'),'Contact.lastName');_0xbb1b73[_0x562b('0xa')]('c.email',_0x562b('0x8c'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x8d'),_0x562b('0x8e'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x8f'),_0x562b('0x90'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x91'),_0x562b('0x92'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x93'),'Owner.fullname');_0xbb1b73['field'](_0x562b('0x94'),_0x562b('0x95'));_0xbb1b73[_0x562b('0xa')](_0x562b('0x96'),'TagIds');}if(_0x41b5eb['limit']){_0xbb1b73[_0x562b('0x97')](_0x41b5eb['limit']);}if(_0x41b5eb[_0x562b('0x98')]){_0xbb1b73['offset'](_0x41b5eb[_0x562b('0x98')]);}return db['sequelize'][_0x562b('0x70')](_0xbb1b73[_0x562b('0x71')](),_0x3db2df);})[_0x562b('0x5e')](function(_0xa0358c){_0x4f1a48=_0xa0358c;var _0x236f75=getUsersQuery(_0x57f92f,_0x4f1a48);return db[_0x562b('0x6f')][_0x562b('0x70')](_0x236f75[_0x562b('0x71')](),_0x3db2df);})['then'](function(_0x26c46c){_0x17e83e=_[_0x562b('0x99')](_0x26c46c,_0x19c24c);if(_0x57f92f===_0x562b('0x34')){return db[_0x562b('0x9a')][_0x562b('0x9b')]({'attributes':[_0x562b('0x9c')],'raw':!![]});}})[_0x562b('0x5e')](function(_0xd9c2a1){var _0x523ac3=_0xd9c2a1?_0xd9c2a1['enableEmailPreview']:undefined;var _0x57f90b=_0x4f1a48[_0x562b('0x1a')](function(_0x3a6cc5){return updateInteraction(_0x3a6cc5,_0x2cc807,_0x17e83e,_0x523ac3);});return Promise[_0x562b('0x9d')](_0x57f90b);});}function countFilteredInteractions(_0x30f363,_0x1dad49){var _0x207477=_0x30f363[_0x562b('0x9e')]();_0x207477['field']('COUNT(*)');_0x207477[_0x562b('0xa')](_0x562b('0x74'),_0x562b('0x44'));var _0x39df3f=utils[_0x562b('0x26')](_0x1dad49);if(!_['isEmpty'](_0x39df3f)){_0x207477[_0x562b('0x18')](_0x562b('0x9f'),_0x39df3f);}var _0x4a21ff={'type':db[_0x562b('0xa0')][_0x562b('0xa1')][_0x562b('0x6e')],'raw':!![]};return db[_0x562b('0x6f')][_0x562b('0x70')](_0x207477['toString'](),_0x4a21ff);}module[_0x562b('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index b51f38e..171c57d 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2797=['closed','disposition','UserId','findOne','out','plainBody','-id','then','lastMsgText','catch','updateInteraction','Users','Tags','lodash','../../mysqldb','fullname','forEach','waiting','talking','answered','unmanaged','abandoned','total'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x2797,0x69));var _0x7279=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x2797[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x7279('0x0'));var db=require(_0x7279('0x1'))['db'];function getInteractionUsers(_0x917e43,_0x33cff5){return new Promise(function(_0x2c0a35,_0x35a6d0){try{var _0x44d023=[];if(_0x33cff5[_0x917e43]){_0x44d023=_0x33cff5[_0x917e43]['map'](function(_0xcce7d8){return{'id':_0xcce7d8['id'],'fullname':_0xcce7d8[_0x7279('0x2')]};});}return _0x2c0a35(_0x44d023);}catch(_0xc76ae){_0x35a6d0(_0xc76ae);}});}function getInteractionTags(_0x56eade,_0xf992dd){var _0x6bb59c=[];if(_0x56eade){_0x56eade['split'](',')[_0x7279('0x3')](function(_0x2c0105){_0x6bb59c['push'](_0xf992dd[_0x2c0105]);});}return _0x6bb59c;}function updateWaitingCounter(_0x47269f){if(_0x47269f[_0x7279('0x4')]){_0x47269f[_0x7279('0x4')]-=0x1;}}function updateInteractionCounters(_0x1146fe){_0x1146fe[_0x7279('0x4')]=0x0;_0x1146fe[_0x7279('0x5')]=0x0;_0x1146fe[_0x7279('0x6')]=0x0;_0x1146fe[_0x7279('0x7')]=0x0;_0x1146fe[_0x7279('0x8')]=0x0;_0x1146fe[_0x7279('0x9')]=0x0;if(_0x1146fe[_0x7279('0xa')]){if(_0x1146fe[_0x7279('0xb')]==='abandoned'){_0x1146fe[_0x7279('0x8')]+=0x1;updateWaitingCounter(_0x1146fe);}if(_0x1146fe['UserId']){_0x1146fe[_0x7279('0x6')]+=0x1;if(_0x1146fe[_0x7279('0x5')]){_0x1146fe[_0x7279('0x5')]-=0x1;}}else{if(_0x1146fe[_0x7279('0xb')]){_0x1146fe[_0x7279('0x7')]+=0x1;updateWaitingCounter(_0x1146fe);}}}else{if(!_0x1146fe[_0x7279('0xc')]){_0x1146fe[_0x7279('0x4')]+=0x1;}if(_0x1146fe['UserId']){_0x1146fe['talking']+=0x1;updateWaitingCounter(_0x1146fe);}}_0x1146fe[_0x7279('0x9')]+=0x1;return _0x1146fe;}function getLastMessageText(_0x4af7a7){return db['MailMessage'][_0x7279('0xd')]({'where':{'$and':[{'MailInteractionId':_0x4af7a7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7279('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7279('0xf')],'order':_0x7279('0x10'),'raw':!![]})[_0x7279('0x11')](function(_0x1ebc0c){if(_0x1ebc0c&&_0x1ebc0c['plainBody']){_0x4af7a7[_0x7279('0x12')]=_['trimStart'](_0x1ebc0c['plainBody']);}return _0x4af7a7;})[_0x7279('0x13')](function(_0x522645){throw _0x522645;});}exports[_0x7279('0x14')]=function(_0x553b46,_0x133143,_0xf6e30b,_0x3e024d){return new Promise(function(_0x10e989,_0x308407){return getInteractionUsers(_0x553b46['id'],_0xf6e30b)[_0x7279('0x11')](function(_0x1b4c7f){_0x553b46[_0x7279('0x15')]=_0x1b4c7f;return getInteractionTags(_0x553b46['TagIds'],_0x133143);})[_0x7279('0x11')](function(_0x1689e0){_0x553b46[_0x7279('0x16')]=_0x1689e0;delete _0x553b46['TagIds'];return updateInteractionCounters(_0x553b46);})[_0x7279('0x11')](function(_0x1153b2){if(_0x3e024d){return getLastMessageText(_0x1153b2);}else{return _0x1153b2;}})[_0x7279('0x11')](function(_0x7dc867){_0x10e989(_0x7dc867);})[_0x7279('0x13')](function(_0x37eaba){_0x308407(_0x37eaba);});});}; \ No newline at end of file +var _0xa61b=['abandoned','UserId','unmanaged','MailMessage','findOne','then','trimStart','plainBody','catch','updateInteraction','TagIds','../../mysqldb','map','split','forEach','push','waiting','talking','answered','total','closed','disposition'];(function(_0x2ada6a,_0x456354){var _0x509442=function(_0x43c0d9){while(--_0x43c0d9){_0x2ada6a['push'](_0x2ada6a['shift']());}};_0x509442(++_0x456354);}(_0xa61b,0x1d9));var _0xba61=function(_0x1ead5b,_0x14662e){_0x1ead5b=_0x1ead5b-0x0;var _0x19f149=_0xa61b[_0x1ead5b];return _0x19f149;};'use strict';var _=require('lodash');var db=require(_0xba61('0x0'))['db'];function getInteractionUsers(_0x11a23f,_0x6b97be){return new Promise(function(_0x18c5e2,_0x374208){try{var _0x35ac4f=[];if(_0x6b97be[_0x11a23f]){_0x35ac4f=_0x6b97be[_0x11a23f][_0xba61('0x1')](function(_0x4cb8cf){return{'id':_0x4cb8cf['id'],'fullname':_0x4cb8cf['fullname']};});}return _0x18c5e2(_0x35ac4f);}catch(_0x3d1765){_0x374208(_0x3d1765);}});}function getInteractionTags(_0x208ba5,_0x5baf90){var _0x62d0fd=[];if(_0x208ba5){_0x208ba5[_0xba61('0x2')](',')[_0xba61('0x3')](function(_0x2cdd29){_0x62d0fd[_0xba61('0x4')](_0x5baf90[_0x2cdd29]);});}return _0x62d0fd;}function updateWaitingCounter(_0x1f8c54){if(_0x1f8c54['waiting']){_0x1f8c54[_0xba61('0x5')]-=0x1;}}function updateInteractionCounters(_0x5dfebd){_0x5dfebd[_0xba61('0x5')]=0x0;_0x5dfebd[_0xba61('0x6')]=0x0;_0x5dfebd[_0xba61('0x7')]=0x0;_0x5dfebd['unmanaged']=0x0;_0x5dfebd['abandoned']=0x0;_0x5dfebd[_0xba61('0x8')]=0x0;if(_0x5dfebd[_0xba61('0x9')]){if(_0x5dfebd[_0xba61('0xa')]===_0xba61('0xb')){_0x5dfebd[_0xba61('0xb')]+=0x1;updateWaitingCounter(_0x5dfebd);}if(_0x5dfebd[_0xba61('0xc')]){_0x5dfebd[_0xba61('0x7')]+=0x1;if(_0x5dfebd[_0xba61('0x6')]){_0x5dfebd[_0xba61('0x6')]-=0x1;}}else{if(_0x5dfebd['disposition']){_0x5dfebd[_0xba61('0xd')]+=0x1;updateWaitingCounter(_0x5dfebd);}}}else{if(!_0x5dfebd[_0xba61('0xc')]){_0x5dfebd[_0xba61('0x5')]+=0x1;}if(_0x5dfebd[_0xba61('0xc')]){_0x5dfebd[_0xba61('0x6')]+=0x1;updateWaitingCounter(_0x5dfebd);}}_0x5dfebd[_0xba61('0x8')]+=0x1;return _0x5dfebd;}function getLastMessageText(_0x569778){return db[_0xba61('0xe')][_0xba61('0xf')]({'where':{'$and':[{'MailInteractionId':_0x569778['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0xba61('0x10')](function(_0xe0084c){if(_0xe0084c&&_0xe0084c['plainBody']){_0x569778['lastMsgText']=_[_0xba61('0x11')](_0xe0084c[_0xba61('0x12')]);}return _0x569778;})[_0xba61('0x13')](function(_0x2a7d29){throw _0x2a7d29;});}exports[_0xba61('0x14')]=function(_0x30e56c,_0x280e2d,_0xbd66c3,_0x3b5355){return new Promise(function(_0x5ae93c,_0x14c2ac){return getInteractionUsers(_0x30e56c['id'],_0xbd66c3)['then'](function(_0x32c92f){_0x30e56c['Users']=_0x32c92f;return getInteractionTags(_0x30e56c['TagIds'],_0x280e2d);})[_0xba61('0x10')](function(_0x559fa7){_0x30e56c['Tags']=_0x559fa7;delete _0x30e56c[_0xba61('0x15')];return updateInteractionCounters(_0x30e56c);})[_0xba61('0x10')](function(_0x2e7ef0){if(_0x3b5355){return getLastMessageText(_0x2e7ef0);}else{return _0x2e7ef0;}})[_0xba61('0x10')](function(_0x46d8e9){_0x5ae93c(_0x46d8e9);})[_0xba61('0x13')](function(_0x34f0ab){_0x14c2ac(_0x34f0ab);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 695d755..e0ec869 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ec1=['upperFirst','chat','websites','_interactions','_interaction_has_tags','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','Interaction','then','update','info','catch','error','exports','lodash','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId'];(function(_0x2f9aee,_0x29b9d4){var _0x39581e=function(_0x534fa6){while(--_0x534fa6){_0x2f9aee['push'](_0x2f9aee['shift']());}};_0x39581e(++_0x29b9d4);}(_0x7ec1,0x1e2));var _0x17ec=function(_0x1a1177,_0x4f1939){_0x1a1177=_0x1a1177-0x0;var _0x48f52f=_0x7ec1[_0x1a1177];return _0x48f52f;};'use strict';var _=require(_0x17ec('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x17ec('0x1'))(_0x17ec('0x2')),'fax':require(_0x17ec('0x1'))(_0x17ec('0x3')),'sms':require('../../config/logger')(_0x17ec('0x4')),'chat':require(_0x17ec('0x1'))(_0x17ec('0x5')),'whatsapp':require('../../config/logger')(_0x17ec('0x6'))};function getAccountFK(_0x44a20f){return _[_0x17ec('0x7')](_0x44a20f)+(_0x44a20f==='chat'?_0x17ec('0x8'):_0x17ec('0x9'))+'Id';}function getInteractionFK(_0x5d4482){return _[_0x17ec('0x7')](_0x5d4482)+_0x17ec('0xa');}function getInteractionId(_0x3e19ad,_0x4153a8,_0x30c344){if(_0x3e19ad&&_0x3e19ad[_[_0x17ec('0xb')](_0x30c344)+_0x17ec('0xa')]){return _0x3e19ad[_[_0x17ec('0xb')](_0x30c344)+_0x17ec('0xa')];}else if(_0x3e19ad&&_0x3e19ad['id']){return _0x3e19ad['id'];}else if(_0x4153a8&&_0x4153a8['id']){return _0x4153a8['id'];}else{return'unknown';}}function getInteractionsTables(_0x323c8d){return{'accounts':_0x323c8d+'_'+(_0x323c8d===_0x17ec('0xc')?_0x17ec('0xd'):'accounts'),'interactions':_0x323c8d+_0x17ec('0xe'),'interactionsTags':_0x323c8d+_0x17ec('0xf'),'messages':_0x323c8d+_0x17ec('0x10'),'userInteractions':'user_has_'+_0x323c8d+_0x17ec('0xe')};}function getSelectedTags(_0x29c14e){var _0x2d6376=[];if(_0x29c14e){_0x2d6376=Array['isArray'](_0x29c14e)?_0x29c14e:[_0x29c14e];}return _0x2d6376;}function log(_0x58f663,_0x44353d,_0x630df7,_0xbf3980,_0x2159e5,_0x1c33db){loggers[_0x2159e5[_0x17ec('0x11')]()][_0x58f663](_0x17ec('0x12'),_0x1c33db['toUpperCase'](),_0x44353d?_0x44353d['id']:null,_0x44353d?_0x44353d[_0x17ec('0x13')]:null,_0x44353d?_0x44353d['role']:null,getInteractionId(_0x630df7,_0xbf3980,_0x2159e5),_0x630df7?JSON[_0x17ec('0x14')](_0x630df7):_0x17ec('0x15'));}function updateUser(_0x554d22,_0x58167e,_0x516a23,_0x116f2c,_0x52cbe5){db[_['upperFirst'](_0x116f2c)+_0x17ec('0x16')]['findOne']({'where':{'id':getInteractionId(_0x58167e,_0x516a23,_0x116f2c)}})[_0x17ec('0x17')](function(_0x4f967a){if(_0x4f967a){return _0x4f967a[_0x17ec('0x18')]({'UserId':_0x554d22?_0x554d22['id']:null});}})[_0x17ec('0x17')](function(_0x5f1f48){if(_0x5f1f48){log(_0x17ec('0x19'),_0x554d22,_0x58167e,_0x516a23,_0x116f2c,_0x52cbe5);}})[_0x17ec('0x1a')](function(){log(_0x17ec('0x1b'),_0x554d22,_0x58167e,_0x516a23,_0x116f2c,_0x52cbe5);});}module[_0x17ec('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xb29a=['websites','_interactions','_interaction_has_tags','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','findOne','then','update','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown'];(function(_0x51c67e,_0x3551a3){var _0x57ca71=function(_0x44b306){while(--_0x44b306){_0x51c67e['push'](_0x51c67e['shift']());}};_0x57ca71(++_0x3551a3);}(_0xb29a,0xa1));var _0xab29=function(_0x32c6ce,_0x24af89){_0x32c6ce=_0x32c6ce-0x0;var _0x32c00c=_0xb29a[_0x32c6ce];return _0x32c00c;};'use strict';var _=require(_0xab29('0x0'));var db=require(_0xab29('0x1'))['db'];var loggers={'openchannel':require(_0xab29('0x2'))(_0xab29('0x3')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0xab29('0x2'))(_0xab29('0x4')),'sms':require(_0xab29('0x2'))(_0xab29('0x5')),'chat':require(_0xab29('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xab29('0x6'))};function getAccountFK(_0x45f9f0){return _[_0xab29('0x7')](_0x45f9f0)+(_0x45f9f0===_0xab29('0x8')?'Website':_0xab29('0x9'))+'Id';}function getInteractionFK(_0x15286f){return _[_0xab29('0x7')](_0x15286f)+_0xab29('0xa');}function getInteractionId(_0x1fe7e5,_0x41632c,_0x1d61b5){if(_0x1fe7e5&&_0x1fe7e5[_[_0xab29('0xb')](_0x1d61b5)+_0xab29('0xa')]){return _0x1fe7e5[_[_0xab29('0xb')](_0x1d61b5)+_0xab29('0xa')];}else if(_0x1fe7e5&&_0x1fe7e5['id']){return _0x1fe7e5['id'];}else if(_0x41632c&&_0x41632c['id']){return _0x41632c['id'];}else{return _0xab29('0xc');}}function getInteractionsTables(_0x2921be){return{'accounts':_0x2921be+'_'+(_0x2921be===_0xab29('0x8')?_0xab29('0xd'):'accounts'),'interactions':_0x2921be+_0xab29('0xe'),'interactionsTags':_0x2921be+_0xab29('0xf'),'messages':_0x2921be+_0xab29('0x10'),'userInteractions':'user_has_'+_0x2921be+_0xab29('0xe')};}function getSelectedTags(_0x951989){var _0x203ed4=[];if(_0x951989){_0x203ed4=Array['isArray'](_0x951989)?_0x951989:[_0x951989];}return _0x203ed4;}function log(_0x48a2aa,_0x28350d,_0x56c13a,_0x3d9052,_0x23b8cc,_0x260b41){loggers[_0x23b8cc[_0xab29('0x11')]()][_0x48a2aa](_0xab29('0x12'),_0x260b41[_0xab29('0x13')](),_0x28350d?_0x28350d['id']:null,_0x28350d?_0x28350d[_0xab29('0x14')]:null,_0x28350d?_0x28350d[_0xab29('0x15')]:null,getInteractionId(_0x56c13a,_0x3d9052,_0x23b8cc),_0x56c13a?JSON[_0xab29('0x16')](_0x56c13a):'null');}function updateUser(_0x4b6ce0,_0x551362,_0x4b8834,_0x8e76e1,_0x48330c){db[_[_0xab29('0xb')](_0x8e76e1)+_0xab29('0x17')][_0xab29('0x18')]({'where':{'id':getInteractionId(_0x551362,_0x4b8834,_0x8e76e1)}})[_0xab29('0x19')](function(_0x338b5f){if(_0x338b5f){return _0x338b5f[_0xab29('0x1a')]({'UserId':_0x4b6ce0?_0x4b6ce0['id']:null});}})[_0xab29('0x19')](function(_0x3551d0){if(_0x3551d0){log('info',_0x4b6ce0,_0x551362,_0x4b8834,_0x8e76e1,_0x48330c);}})['catch'](function(){log(_0xab29('0x1b'),_0x4b6ce0,_0x551362,_0x4b8834,_0x8e76e1,_0x48330c);});}module[_0xab29('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5b822b8..d71bfb3 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc211=['data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','final','parse','hasOwnProperty','License','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','isUserLimit','crypto','composable-middleware','../../mysqldb'];(function(_0xed60ba,_0x587c44){var _0x1b1a07=function(_0xa4b107){while(--_0xa4b107){_0xed60ba['push'](_0xed60ba['shift']());}};_0x1b1a07(++_0x587c44);}(_0xc211,0x19f));var _0x1c21=function(_0x2826f6,_0x226c12){_0x2826f6=_0x2826f6-0x0;var _0x22d31a=_0xc211[_0x2826f6];return _0x22d31a;};'use strict';var crypto=require(_0x1c21('0x0'));var util=require('util');var compose=require(_0x1c21('0x1'));var db=require(_0x1c21('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x13acea,_0x5f50ec){if(_0x13acea&&_0x5f50ec){if(_0x5f50ec[_0x1c21('0x3')]&&_0x5f50ec[_0x1c21('0x4')]){var _0x4475ae=_0x5f50ec[_0x1c21('0x3')];var _0x4d1fee=_0x5f50ec[_0x1c21('0x4')];var _0x3f9b2e=_0x4475ae['split']('-')[0x4];var _0x23311d=_0x4475ae[_0x1c21('0x5')]('-')[0x0];var _0x534c99=crypto['createDecipher'](_0x1c21('0x6'),util[_0x1c21('0x7')](_0x1c21('0x8'),_0x3f9b2e,_0x4475ae,_0x23311d));var _0x927497=_0x534c99[_0x1c21('0x9')](_0x4d1fee,_0x1c21('0xa'),'utf8');_0x927497+=_0x534c99[_0x1c21('0xb')]('utf8');var _0x268b62=JSON[_0x1c21('0xc')](_0x927497);return _0x268b62[_0x1c21('0xd')](_0x13acea)?_0x268b62[_0x13acea]:null;}}return null;}function isLimit(_0x2589ea,_0x52bf17,_0x2cef5d,_0x2cfc9e){var _0x6f6e6f=_0x52bf17;return compose()['use'](function(_0x5eb46f,_0x5eb61c,_0x11409d){return db[_0x1c21('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5a0b70){var _0x3b2e5f=getValueFromLicense(_0x2589ea,_0x5a0b70);return _0x3b2e5f?_0x3b2e5f:_0x6f6e6f;})[_0x1c21('0xf')](function(_0x45af89){_0x6f6e6f=_0x45af89;return _0x2cef5d[_0x1c21('0x10')](_0x2cfc9e);})['then'](function(_0xbfecb1){if(_0xbfecb1>=_0x6f6e6f){return _0x5eb61c['status'](0x193)['json']({'message':util[_0x1c21('0x7')](_0x1c21('0x11'),_0x2589ea)});}_0x11409d();})[_0x1c21('0x12')](function(_0x758145){_0x11409d(_0x758145);});});}function isUserLimit(){return isLimit(_0x1c21('0x13'),0x1,db[_0x1c21('0x14')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x1c21('0x15')]=isUserLimit; \ No newline at end of file +var _0xc6d3=['crypto','util','composable-middleware','../../config/environment','data1','license','createDecipher','aes-256-ctr','%s:%s:%s','base64','utf8','final','hasOwnProperty','License','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit'];(function(_0x2bf699,_0x5ce8b8){var _0x57aea0=function(_0x2e8820){while(--_0x2e8820){_0x2bf699['push'](_0x2bf699['shift']());}};_0x57aea0(++_0x5ce8b8);}(_0xc6d3,0x1e4));var _0x3c6d=function(_0x3c532f,_0x2ff7e0){_0x3c532f=_0x3c532f-0x0;var _0x4fdde2=_0xc6d3[_0x3c532f];return _0x4fdde2;};'use strict';var crypto=require(_0x3c6d('0x0'));var util=require(_0x3c6d('0x1'));var compose=require(_0x3c6d('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x3c6d('0x3'));function getValueFromLicense(_0x212310,_0x2d3916){if(_0x212310&&_0x2d3916){if(_0x2d3916[_0x3c6d('0x4')]&&_0x2d3916['license']){var _0xc569ea=_0x2d3916[_0x3c6d('0x4')];var _0x4d496d=_0x2d3916[_0x3c6d('0x5')];var _0x2a14f2=_0xc569ea['split']('-')[0x4];var _0x210230=_0xc569ea['split']('-')[0x0];var _0x4a369a=crypto[_0x3c6d('0x6')](_0x3c6d('0x7'),util['format'](_0x3c6d('0x8'),_0x2a14f2,_0xc569ea,_0x210230));var _0xceecba=_0x4a369a['update'](_0x4d496d,_0x3c6d('0x9'),_0x3c6d('0xa'));_0xceecba+=_0x4a369a[_0x3c6d('0xb')]('utf8');var _0x4e68d6=JSON['parse'](_0xceecba);return _0x4e68d6[_0x3c6d('0xc')](_0x212310)?_0x4e68d6[_0x212310]:null;}}return null;}function isLimit(_0x17ceb2,_0x3b6d74,_0x52cf2f,_0x1feb7f){var _0x2e72d4=_0x3b6d74;return compose()['use'](function(_0x24ffb8,_0x2f492a,_0x905a2b){return db[_0x3c6d('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x3c6d('0xe')](function(_0x3185cb){var _0x3de7b2=getValueFromLicense(_0x17ceb2,_0x3185cb);return _0x3de7b2?_0x3de7b2:_0x2e72d4;})[_0x3c6d('0xe')](function(_0x350394){_0x2e72d4=_0x350394;return _0x52cf2f['count'](_0x1feb7f);})[_0x3c6d('0xe')](function(_0x3ff777){if(_0x3ff777>=_0x2e72d4){return _0x2f492a[_0x3c6d('0xf')](0x193)['json']({'message':util['format'](_0x3c6d('0x10'),_0x17ceb2)});}_0x905a2b();})['catch'](function(_0x15acfb){_0x905a2b(_0x15acfb);});});}function isUserLimit(){return isLimit(_0x3c6d('0x11'),0x1,db[_0x3c6d('0x12')],{'where':{'$or':[{'role':_0x3c6d('0x13')},{'role':_0x3c6d('0x14')}]}});}exports[_0x3c6d('0x15')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index da24d53..2290a8c 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2609=['$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','LIKE\x20?','$gt','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','shift','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20'];(function(_0x18be13,_0x12f269){var _0x17317b=function(_0x449d31){while(--_0x449d31){_0x18be13['push'](_0x18be13['shift']());}};_0x17317b(++_0x12f269);}(_0x2609,0x86));var _0x9260=function(_0x5cd3b5,_0x4c02e0){_0x5cd3b5=_0x5cd3b5-0x0;var _0x1f1f09=_0x2609[_0x5cd3b5];return _0x1f1f09;};'use strict';var _=require(_0x9260('0x0'));var moment=require(_0x9260('0x1'));exports[_0x9260('0x2')]=function(_0x41202e){var _0x155ed5={'conditions':[]};_0x155ed5[_0x9260('0x3')]=_[_0x9260('0x4')](_0x41202e,_0x9260('0x5'))?'or':_0x9260('0x6');var _0x88f8d3=_0x41202e[_0x9260('0x7')](_0x9260('0x8'),'')[_0x9260('0x7')](_0x9260('0x5'),'')[_0x9260('0x9')]('||');for(var _0x3da9e6=0x0;_0x3da9e6<_0x88f8d3[_0x9260('0xa')];_0x3da9e6++){var _0x391fbb=_0x88f8d3[_0x3da9e6][_0x9260('0x9')](':=');var _0x20cc84=_0x391fbb[0x0];var _0x4b8611=_0x391fbb[_0x9260('0xb')](0x1);_0x4b8611[_0x9260('0xc')](function(_0x80d7e2){var _0x2a27c0=_0x80d7e2['split']('[')['shift']();var _0x1ff53c=_0x80d7e2[_0x9260('0xd')](/\[(.*?)\]/g);_0x1ff53c['forEach'](function(_0x2e81d2){var _0x4f7d8b=_0x2e81d2[_0x9260('0x9')]('[')[_0x9260('0xe')](function(_0x15c111){return _0x15c111[_0x9260('0xf')](']')>-0x1;})['map'](function(_0x24f989){return _0x24f989['split'](']')[0x0];})[0x0];_0x155ed5[_0x9260('0x10')][_0x9260('0x11')]({'field':_0x20cc84,'operator':_0x2a27c0,'value':_0x4f7d8b});});});}return _0x155ed5;};exports[_0x9260('0x12')]=function(_0x2dcd79,_0x3425aa,_0x2f0c76){var _0x26a2ed={};if(_0x3425aa===_0x9260('0x13')){if(_0x2f0c76[_0x9260('0x14')]===_0x9260('0x15')){_0x2f0c76[_0x9260('0x14')]=_0x9260('0x16');_0x2f0c76[_0x9260('0x17')]+=','+_0x2f0c76[_0x9260('0x17')];}else if(_[_0x9260('0x18')](['$gt',_0x9260('0x19')],_0x2f0c76[_0x9260('0x14')])){_0x2f0c76[_0x9260('0x17')]=moment(_0x2f0c76[_0x9260('0x17')])[_0x9260('0x1a')](0x1,'days')[_0x9260('0x1b')](_0x9260('0x1c'));}}if(_0x2f0c76[_0x9260('0x1d')]){_0x3425aa=_0x2f0c76[_0x9260('0x1d')];_0x26a2ed[_0x9260('0x1e')]=_0x9260('0x1f')+_0x2dcd79+'.'+_0x2f0c76[_0x9260('0x20')]+_0x9260('0x21')+_0x2f0c76['castTo']+')\x20'+parseOperator(_0x2f0c76[_0x9260('0x14')]);}else{_0x26a2ed[_0x9260('0x1e')]=_0x2dcd79+'.'+_0x2f0c76[_0x9260('0x20')]+'\x20'+parseOperator(_0x2f0c76[_0x9260('0x14')]);}if(_[_0x9260('0x18')](['$ne','$notIn'],_0x2f0c76[_0x9260('0x14')]))_0x26a2ed['text']='('+_0x26a2ed[_0x9260('0x1e')]+'\x20OR\x20'+_0x2dcd79+'.'+_0x2f0c76[_0x9260('0x20')]+'\x20IS\x20NULL)';_0x26a2ed[_0x9260('0x17')]=parseValue(_0x3425aa,_0x2f0c76[_0x9260('0x14')],_0x2f0c76[_0x9260('0x17')]);return _0x26a2ed;};function parseOperator(_0x48a0aa){var _0x2eb3cb;switch(_0x48a0aa){case _0x9260('0x22'):_0x2eb3cb=_0x9260('0x23');break;case _0x9260('0x24'):_0x2eb3cb=_0x9260('0x25');break;case _0x9260('0x15'):_0x2eb3cb=_0x9260('0x26');break;case _0x9260('0x27'):_0x2eb3cb=_0x9260('0x28');break;case _0x9260('0x29'):case'$startsWith':case _0x9260('0x2a'):_0x2eb3cb=_0x9260('0x2b');break;case'$lt':_0x2eb3cb='<\x20?';break;case _0x9260('0x2c'):_0x2eb3cb=_0x9260('0x2d');break;case'$lte':_0x2eb3cb=_0x9260('0x2e');break;case'$gte':_0x2eb3cb=_0x9260('0x2f');break;case _0x9260('0x16'):_0x2eb3cb=_0x9260('0x30');break;}return _0x2eb3cb;}function parseValue(_0x4d646b,_0x4710ac,_0x353465){var _0x322b9e={'start':undefined,'end':undefined};switch(_0x4710ac){case _0x9260('0x22'):case _0x9260('0x24'):_0x322b9e[_0x9260('0x31')]=_0x353465[_0x9260('0x9')](',');break;case _0x9260('0x29'):_0x322b9e[_0x9260('0x31')]='%'+_0x353465+'%';break;case _0x9260('0x32'):_0x322b9e[_0x9260('0x31')]=_0x353465+'%';break;case _0x9260('0x2a'):_0x322b9e[_0x9260('0x31')]='%'+_0x353465;break;case _0x9260('0x16'):var _0xd791e9=_0x353465[_0x9260('0x9')](',');var _0x353465=_0xd791e9[_0x9260('0x33')]();var _0x3d37d4=_0xd791e9[_0x9260('0x34')]();if(_0x4d646b==='DATE'){_0x353465=moment(_0x353465)[_0x9260('0x35')](0x0,!![])[_0x9260('0x1b')]();_0x3d37d4=moment(_0x3d37d4)[_0x9260('0x35')](0x0,!![])[_0x9260('0x1a')](0x17,_0x9260('0x36'))['add'](0x3b,'minutes')[_0x9260('0x1a')](0x3b,_0x9260('0x37'))[_0x9260('0x1b')]();}_0x322b9e={'start':_0x353465,'end':_0x3d37d4};break;default:_0x322b9e[_0x9260('0x31')]=_0x353465;break;}return _0x322b9e;} \ No newline at end of file +var _0x3151=['>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','DATE','format','utcOffset','seconds','lodash','moment','sqlOperator','startsWith','[$or]','[$and]','length','split','slice','forEach','shift','match','push','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x3151,0xdd));var _0x1315=function(_0x14f154,_0x327c57){_0x14f154=_0x14f154-0x0;var _0x3fd3c0=_0x3151[_0x14f154];return _0x3fd3c0;};'use strict';var _=require(_0x1315('0x0'));var moment=require(_0x1315('0x1'));exports['parseSearch']=function(_0x4b863f){var _0x4e6032={'conditions':[]};_0x4e6032[_0x1315('0x2')]=_[_0x1315('0x3')](_0x4b863f,_0x1315('0x4'))?'or':'and';var _0x1b4c47=_0x4b863f['replace'](_0x1315('0x5'),'')['replace'](_0x1315('0x4'),'')['split']('||');for(var _0x301c67=0x0;_0x301c67<_0x1b4c47[_0x1315('0x6')];_0x301c67++){var _0x14c29c=_0x1b4c47[_0x301c67][_0x1315('0x7')](':=');var _0x52e5e9=_0x14c29c[0x0];var _0x1ae532=_0x14c29c[_0x1315('0x8')](0x1);_0x1ae532[_0x1315('0x9')](function(_0x4e9bae){var _0x30f65c=_0x4e9bae[_0x1315('0x7')]('[')[_0x1315('0xa')]();var _0x3aff91=_0x4e9bae[_0x1315('0xb')](/\[(.*?)\]/g);_0x3aff91[_0x1315('0x9')](function(_0x2638ce){var _0xff0271=_0x2638ce[_0x1315('0x7')]('[')['filter'](function(_0x4e76a9){return _0x4e76a9['indexOf'](']')>-0x1;})['map'](function(_0x510823){return _0x510823['split'](']')[0x0];})[0x0];_0x4e6032['conditions'][_0x1315('0xc')]({'field':_0x52e5e9,'operator':_0x30f65c,'value':_0xff0271});});});}return _0x4e6032;};exports[_0x1315('0xd')]=function(_0x502831,_0x383f46,_0x32bbdd){var _0x52d1ed={};if(_0x383f46==='DATE'){if(_0x32bbdd[_0x1315('0xe')]===_0x1315('0xf')){_0x32bbdd['operator']=_0x1315('0x10');_0x32bbdd[_0x1315('0x11')]+=','+_0x32bbdd[_0x1315('0x11')];}else if(_[_0x1315('0x12')]([_0x1315('0x13'),_0x1315('0x14')],_0x32bbdd['operator'])){_0x32bbdd['value']=moment(_0x32bbdd[_0x1315('0x11')])[_0x1315('0x15')](0x1,_0x1315('0x16'))['format'](_0x1315('0x17'));}}if(_0x32bbdd['castTo']){_0x383f46=_0x32bbdd[_0x1315('0x18')];_0x52d1ed[_0x1315('0x19')]=_0x1315('0x1a')+_0x502831+'.'+_0x32bbdd[_0x1315('0x1b')]+'\x20AS\x20'+_0x32bbdd[_0x1315('0x18')]+')\x20'+parseOperator(_0x32bbdd[_0x1315('0xe')]);}else{_0x52d1ed[_0x1315('0x19')]=_0x502831+'.'+_0x32bbdd[_0x1315('0x1b')]+'\x20'+parseOperator(_0x32bbdd['operator']);}if(_[_0x1315('0x12')](['$ne','$notIn'],_0x32bbdd['operator']))_0x52d1ed[_0x1315('0x19')]='('+_0x52d1ed['text']+_0x1315('0x1c')+_0x502831+'.'+_0x32bbdd['field']+_0x1315('0x1d');_0x52d1ed[_0x1315('0x11')]=parseValue(_0x383f46,_0x32bbdd[_0x1315('0xe')],_0x32bbdd[_0x1315('0x11')]);return _0x52d1ed;};function parseOperator(_0x1d8bcc){var _0x577f11;switch(_0x1d8bcc){case _0x1315('0x1e'):_0x577f11=_0x1315('0x1f');break;case _0x1315('0x20'):_0x577f11=_0x1315('0x21');break;case _0x1315('0xf'):_0x577f11=_0x1315('0x22');break;case _0x1315('0x23'):_0x577f11=_0x1315('0x24');break;case'$substring':case'$startsWith':case _0x1315('0x25'):_0x577f11=_0x1315('0x26');break;case _0x1315('0x27'):_0x577f11=_0x1315('0x28');break;case'$gt':_0x577f11=_0x1315('0x29');break;case _0x1315('0x14'):_0x577f11=_0x1315('0x2a');break;case _0x1315('0x2b'):_0x577f11=_0x1315('0x2c');break;case _0x1315('0x10'):_0x577f11=_0x1315('0x2d');break;}return _0x577f11;}function parseValue(_0x2ec352,_0x3cf72a,_0x3e5da6){var _0x388e31={'start':undefined,'end':undefined};switch(_0x3cf72a){case _0x1315('0x1e'):case'$notIn':_0x388e31[_0x1315('0x2e')]=_0x3e5da6[_0x1315('0x7')](',');break;case'$substring':_0x388e31[_0x1315('0x2e')]='%'+_0x3e5da6+'%';break;case _0x1315('0x2f'):_0x388e31['start']=_0x3e5da6+'%';break;case _0x1315('0x25'):_0x388e31[_0x1315('0x2e')]='%'+_0x3e5da6;break;case _0x1315('0x10'):var _0x51a804=_0x3e5da6[_0x1315('0x7')](',');var _0x3e5da6=_0x51a804[_0x1315('0xa')]();var _0x34e519=_0x51a804[_0x1315('0x30')]();if(_0x2ec352===_0x1315('0x31')){_0x3e5da6=moment(_0x3e5da6)['utcOffset'](0x0,!![])[_0x1315('0x32')]();_0x34e519=moment(_0x34e519)[_0x1315('0x33')](0x0,!![])[_0x1315('0x15')](0x17,'hours')[_0x1315('0x15')](0x3b,'minutes')[_0x1315('0x15')](0x3b,_0x1315('0x34'))[_0x1315('0x32')]();}_0x388e31={'start':_0x3e5da6,'end':_0x34e519};break;default:_0x388e31[_0x1315('0x2e')]=_0x3e5da6;break;}return _0x388e31;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2f810f7..e499920 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb150=['uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','name','attributes','nolimit','limit','order','where','filters','pick','filter','columns','value','VIRTUAL','lower','merge','options','include','lodash','sequelize','moment','../../mysqldb','parse','includes','keys','model','alias','fields','raw','split','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','subtract'];(function(_0x3a4d59,_0x3685d8){var _0x5ee316=function(_0x392e88){while(--_0x392e88){_0x3a4d59['push'](_0x3a4d59['shift']());}};_0x5ee316(++_0x3685d8);}(_0xb150,0x18e));var _0x0b15=function(_0x1c4e67,_0x34058e){_0x1c4e67=_0x1c4e67-0x0;var _0x4e9ade=_0xb150[_0x1c4e67];return _0x4e9ade;};'use strict';var _=require(_0x0b15('0x0'));var sequelize=require(_0x0b15('0x1'));var moment=require(_0x0b15('0x2'));var db=require(_0x0b15('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xc302be){var _0x120cb1=['ne'];try{var _0x338971=JSON[_0x0b15('0x4')](_0xc302be);var _0x1e233c=Object['keys'](_0x338971)[0x0];return _0x120cb1[_0x0b15('0x5')](_0x1e233c);}catch(_0x1c0e62){return![];}}function getOperatorValue(_0x1d9d4c){var _0x1dd580=JSON[_0x0b15('0x4')](_0x1d9d4c);var _0xac8710=Object[_0x0b15('0x6')](_0x1dd580)[0x0];var _0x24e11c=_0x1dd580[_0xac8710];return{['$'+_0xac8710]:_0x24e11c};}function parseIncludeModel(_0xee56a){var _0x495002=JSON[_0x0b15('0x4')](_0xee56a);return{'model':db[_0x495002[_0x0b15('0x7')]],'as':_0x495002[_0x0b15('0x8')],'attributes':_0x495002[_0x0b15('0x9')],'raw':_0x495002[_0x0b15('0xa')]};}exports[_0x0b15('0x9')]=function(_0x136f43){var _0x25979e=null;if(_0x136f43){_0x25979e=_0x136f43[_0x0b15('0xb')](',');}return _0x25979e;};exports['filters']=function(_0x326032,_0x116bdf){var _0x943d4f={};if(!_[_0x0b15('0xc')](_0x326032)){_[_0x0b15('0xd')](_0x326032,function(_0xd73f5c,_0x26d194){try{if(_0x116bdf){var _0x37a847=_[_0x0b15('0xe')](_0x116bdf,{'name':_0x26d194})||{};if(hasSequelizeOperator(_0xd73f5c)){_0x943d4f[_0x26d194]=getOperatorValue(_0xd73f5c);}else if(_0x37a847[_0x0b15('0xf')]===_0x0b15('0x10')&&_['isPlainObject'](_0xd73f5c)){var _0x4c8ccd=JSON['parse'](_0xd73f5c);var _0x53258e={'$gte':moment(moment(_0x4c8ccd[_0x0b15('0x11')])['format']('YYYY-MM-DD'))['utc']()[_0x0b15('0x12')](),'$lte':moment(moment(_0x4c8ccd['$lte'])[_0x0b15('0x12')](_0x0b15('0x13')))[_0x0b15('0x14')]()[_0x0b15('0x15')](0x1,'s')['format']()};_0x943d4f[_0x26d194]=_0x53258e;}else if(_0x37a847['name']===_0x0b15('0x16')){_0x943d4f[_0x26d194]=_0xd73f5c;}else{_0x943d4f[_0x26d194]=_[_0x0b15('0x17')](_0xd73f5c)?_0xd73f5c:JSON['parse'](_0xd73f5c);}}else{_0x943d4f[_0x26d194]=_[_0x0b15('0x17')](_0xd73f5c)?_0xd73f5c:JSON['parse'](_0xd73f5c);}}catch(_0x32f2d9){_0x943d4f[_0x26d194]=_0xd73f5c[_0x0b15('0xb')](',');}});}return _0x943d4f;};exports['limit']=function(_0x3edf63){_0x3edf63=parseInt(_0x3edf63,0xa);if(!_0x3edf63||_0x3edf63<0x0){_0x3edf63=LIMIT_VALUE;}return _0x3edf63;};exports[_0x0b15('0x18')]=function(_0x231495){_0x231495=parseInt(_0x231495,0xa);if(!_0x231495||_0x231495<0x0){_0x231495=0x0;}return _0x231495;};exports[_0x0b15('0x19')]=function(_0xbaa4d6){var _0x24bc20,_0x5d8ef0=null;if(_0xbaa4d6){_0x24bc20=_0xbaa4d6[_0x0b15('0xb')](',');_0x5d8ef0=_[_0x0b15('0x1a')](_0x24bc20,function(_0x115128){if(_0x115128[_0x0b15('0x1b')]('-')===0x0){return[_0x115128===_0x0b15('0x1c')?sequelize[_0x0b15('0x1d')](sequelize[_0x0b15('0x1e')](_0x0b15('0x1c')),_0x0b15('0x1f')):_0x115128[_0x0b15('0x20')](0x1),_0x0b15('0x21')];}else{return[_0x115128===_0x0b15('0x1c')?sequelize[_0x0b15('0x1d')](sequelize[_0x0b15('0x1e')](_0x0b15('0x1c')),_0x0b15('0x1f')):_0x115128,_0x0b15('0x22')];}});}return _0x5d8ef0;};exports['omit']=function(_0x2b35ba,_0x23ef92){if(_[_0x0b15('0xc')](_0x2b35ba)){return _0x2b35ba;}if(_['isArray'](_0x2b35ba)){for(var _0x295bbd=0x0;_0x295bbd<_0x2b35ba[_0x0b15('0x23')];_0x295bbd+=0x1){_0x2b35ba[_0x295bbd]=this[_0x0b15('0x24')](_0x2b35ba[_0x295bbd],_0x23ef92);}return _0x2b35ba;}if(!_[_0x0b15('0x25')](_0x2b35ba)){return _0x2b35ba;}if(_[_0x0b15('0x26')](_0x23ef92)){_0x23ef92=[_0x23ef92];}if(!_['isArray'](_0x23ef92)){return _0x2b35ba;}for(var _0x4abb19=0x0;_0x4abb19<_0x23ef92[_0x0b15('0x23')];_0x4abb19+=0x1){_[_0x0b15('0x27')](_0x2b35ba,_0x23ef92[_0x4abb19]);}for(var _0x69706d in _0x2b35ba){if(_0x2b35ba[_0x0b15('0x28')](_0x69706d)){_0x2b35ba[_0x69706d]=this[_0x0b15('0x24')](_0x2b35ba[_0x69706d],_0x23ef92);}}return _0x2b35ba;};exports[_0x0b15('0x29')]=function(_0xb6b0f){return _0xb6b0f[_0x0b15('0x2a')](RegExp(_0x0b15('0x2b')))?!![]:![];};exports[_0x0b15('0x2c')]=function(_0x5d78d5){return _0x5d78d5[_0x0b15('0x2a')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3cd679,_0x547f20){var _0x59db5f=[];var _0x2aac42=/[ `!@#$%^&*()_\-?~]/;var _0x58a0fd=_0x547f20?_0x0b15('0x2d'):_0x0b15('0x2e');_0x3cd679['split'](/[ ,]+/)[_0x0b15('0x2f')](function(_0x41a3af){_0x41a3af=_0x41a3af[_0x0b15('0x30')](/([^:]")"+/g,'$1');_0x41a3af='+'+_0x41a3af+'*';var _0x4503a3=_0x41a3af[_0x0b15('0x2a')](_0x2aac42);if(_0x4503a3){_0x41a3af='\x22'+_0x41a3af+'\x22';}_0x59db5f[_0x0b15('0x31')](_0x41a3af);});_0x58a0fd=_0x58a0fd['replace'](_0x0b15('0x2e'),_0x59db5f[_0x0b15('0x32')]('\x20'));return _0x58a0fd;};exports[_0x0b15('0x33')]=function(_0x3ed082,_0x51b28c,_0x18c152){var _0x593018={},_0x25108c={};if(_0x51b28c['query']['$id']){_0x51b28c[_0x0b15('0x34')]['id']=_0x51b28c[_0x0b15('0x34')][_0x0b15('0x35')];delete _0x51b28c[_0x0b15('0x34')][_0x0b15('0x35')];}_0x593018[_0x0b15('0x7')]=_['map'](_0x3ed082,_0x0b15('0x36'));_0x593018[_0x0b15('0x34')]=_['keys'](_0x51b28c[_0x0b15('0x34')]);_0x593018['filters']=_['intersection'](_0x593018['model'],_0x593018[_0x0b15('0x34')]);_0x25108c[_0x0b15('0x37')]=_['intersection'](_0x593018[_0x0b15('0x7')],this[_0x0b15('0x9')](_0x51b28c[_0x0b15('0x34')][_0x0b15('0x9')]));_0x25108c[_0x0b15('0x37')]=_0x25108c['attributes']['length']?_0x25108c[_0x0b15('0x37')]:_0x593018['model'];if(!_0x51b28c[_0x0b15('0x34')][_0x0b15('0x28')](_0x0b15('0x38'))){_0x25108c[_0x0b15('0x39')]=this[_0x0b15('0x39')](_0x51b28c['query'][_0x0b15('0x39')]);_0x25108c[_0x0b15('0x18')]=this[_0x0b15('0x18')](_0x51b28c[_0x0b15('0x34')][_0x0b15('0x18')]);}_0x25108c[_0x0b15('0x3a')]=this[_0x0b15('0x19')](_0x51b28c[_0x0b15('0x34')][_0x0b15('0x19')]);_0x25108c[_0x0b15('0x3b')]=this[_0x0b15('0x3c')](_[_0x0b15('0x3d')](_0x51b28c[_0x0b15('0x34')],_0x593018[_0x0b15('0x3c')]),_0x3ed082);if(_0x51b28c[_0x0b15('0x34')][_0x0b15('0x3e')]){var _0x566d2d=_0x3ed082;var _0x431b42=_0x51b28c['query']['filter'];if(typeof _0x431b42==='object'){_0x566d2d=_[_0x0b15('0x3e')](_0x3ed082,function(_0x3b1108){return _[_0x0b15('0x5')](_0x431b42[_0x0b15('0x3f')],_0x3b1108[_0x0b15('0x36')]);});_0x431b42=_0x431b42[_0x0b15('0x40')];}_0x25108c[_0x0b15('0x3b')]=_['merge'](_0x25108c[_0x0b15('0x3b')],{'$or':_[_0x0b15('0x1a')](_0x566d2d,function(_0xf9a39){if(_0xf9a39[_0x0b15('0xf')]!==_0x0b15('0x41')){if(_0x18c152){return sequelize[_0x0b15('0x3b')](sequelize['fn'](_0x0b15('0x42'),sequelize[_0x0b15('0x1e')](_0xf9a39[_0x0b15('0x36')])),{'$like':sequelize['fn'](_0x0b15('0x42'),'%'+_0x51b28c[_0x0b15('0x34')][_0x0b15('0x3e')]+'%')});}else{var _0x3f6631={};_0x3f6631[_0xf9a39[_0x0b15('0x36')]]={'$like':'%'+_0x51b28c['query'][_0x0b15('0x3e')]+'%'};return _0x3f6631;}}})});}_0x25108c=_[_0x0b15('0x43')]({},_0x25108c,_0x51b28c[_0x0b15('0x44')]);return _0x25108c;};exports['include']=function(_0x440e43){var _0x5cfd01=[];if(_0x440e43['includeAll']){_0x5cfd01['push']({'all':!![]});}else if(_0x440e43[_0x0b15('0x45')]){if(Array[_0x0b15('0x17')](_0x440e43[_0x0b15('0x45')])){_0x5cfd01=Object['keys'](_0x440e43['include'])[_0x0b15('0x1a')](function(_0x463fb2){return parseIncludeModel(_0x440e43['include'][_0x463fb2]);});}else{var _0x23800d=parseIncludeModel(_0x440e43[_0x0b15('0x45')]);_0x5cfd01['push'](_0x23800d);}}return _0x5cfd01;}; \ No newline at end of file +var _0x9cd2=['value','where','merge','col','options','includeAll','include','lodash','moment','../../mysqldb','keys','includes','parse','model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','name','uniqueid','isArray','limit','offset','map','indexOf','priority','cast','unsigned','substr','DESC','length','isObject','hasOwnProperty','omit','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','join','query','$id','intersection','attributes','nolimit','order','sort','pick','filter'];(function(_0x551ed2,_0x197d2d){var _0x4bb9d1=function(_0x5b49f6){while(--_0x5b49f6){_0x551ed2['push'](_0x551ed2['shift']());}};_0x4bb9d1(++_0x197d2d);}(_0x9cd2,0x85));var _0x29cd=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0x9cd2[_0x24875d];return _0x181471;};'use strict';var _=require(_0x29cd('0x0'));var sequelize=require('sequelize');var moment=require(_0x29cd('0x1'));var db=require(_0x29cd('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4a5a1d){var _0xad708c=['ne'];try{var _0x40a756=JSON['parse'](_0x4a5a1d);var _0x56cfa7=Object[_0x29cd('0x3')](_0x40a756)[0x0];return _0xad708c[_0x29cd('0x4')](_0x56cfa7);}catch(_0x305a97){return![];}}function getOperatorValue(_0x3e4a25){var _0x376643=JSON[_0x29cd('0x5')](_0x3e4a25);var _0x5ecd14=Object['keys'](_0x376643)[0x0];var _0x2c30ab=_0x376643[_0x5ecd14];return{['$'+_0x5ecd14]:_0x2c30ab};}function parseIncludeModel(_0x4dcdcd){var _0x333d7c=JSON[_0x29cd('0x5')](_0x4dcdcd);return{'model':db[_0x333d7c[_0x29cd('0x6')]],'as':_0x333d7c[_0x29cd('0x7')],'attributes':_0x333d7c[_0x29cd('0x8')],'raw':_0x333d7c[_0x29cd('0x9')]};}exports[_0x29cd('0x8')]=function(_0x19d4c1){var _0x5cd216=null;if(_0x19d4c1){_0x5cd216=_0x19d4c1[_0x29cd('0xa')](',');}return _0x5cd216;};exports[_0x29cd('0xb')]=function(_0x1dd175,_0x431317){var _0x3731a7={};if(!_[_0x29cd('0xc')](_0x1dd175)){_[_0x29cd('0xd')](_0x1dd175,function(_0x315703,_0x2a4f9a){try{if(_0x431317){var _0x50d813=_[_0x29cd('0xe')](_0x431317,{'name':_0x2a4f9a})||{};if(hasSequelizeOperator(_0x315703)){_0x3731a7[_0x2a4f9a]=getOperatorValue(_0x315703);}else if(_0x50d813[_0x29cd('0xf')]==='DATE'&&_[_0x29cd('0x10')](_0x315703)){var _0x42b5cd=JSON[_0x29cd('0x5')](_0x315703);var _0x404ec1={'$gte':moment(moment(_0x42b5cd[_0x29cd('0x11')])['format'](_0x29cd('0x12')))[_0x29cd('0x13')]()[_0x29cd('0x14')](),'$lte':moment(moment(_0x42b5cd[_0x29cd('0x15')])[_0x29cd('0x14')]('YYYY-MM-DD'))[_0x29cd('0x13')]()['subtract'](0x1,'s')[_0x29cd('0x14')]()};_0x3731a7[_0x2a4f9a]=_0x404ec1;}else if(_0x50d813[_0x29cd('0x16')]===_0x29cd('0x17')){_0x3731a7[_0x2a4f9a]=_0x315703;}else{_0x3731a7[_0x2a4f9a]=_[_0x29cd('0x18')](_0x315703)?_0x315703:JSON[_0x29cd('0x5')](_0x315703);}}else{_0x3731a7[_0x2a4f9a]=_[_0x29cd('0x18')](_0x315703)?_0x315703:JSON['parse'](_0x315703);}}catch(_0x112b2c){_0x3731a7[_0x2a4f9a]=_0x315703['split'](',');}});}return _0x3731a7;};exports[_0x29cd('0x19')]=function(_0x45b7f8){_0x45b7f8=parseInt(_0x45b7f8,0xa);if(!_0x45b7f8||_0x45b7f8<0x0){_0x45b7f8=LIMIT_VALUE;}return _0x45b7f8;};exports[_0x29cd('0x1a')]=function(_0x491377){_0x491377=parseInt(_0x491377,0xa);if(!_0x491377||_0x491377<0x0){_0x491377=0x0;}return _0x491377;};exports['sort']=function(_0x337225){var _0x574ed5,_0x5d2a7c=null;if(_0x337225){_0x574ed5=_0x337225['split'](',');_0x5d2a7c=_[_0x29cd('0x1b')](_0x574ed5,function(_0x9584de){if(_0x9584de[_0x29cd('0x1c')]('-')===0x0){return[_0x9584de===_0x29cd('0x1d')?sequelize[_0x29cd('0x1e')](sequelize['col'](_0x29cd('0x1d')),_0x29cd('0x1f')):_0x9584de[_0x29cd('0x20')](0x1),_0x29cd('0x21')];}else{return[_0x9584de===_0x29cd('0x1d')?sequelize[_0x29cd('0x1e')](sequelize['col'](_0x29cd('0x1d')),_0x29cd('0x1f')):_0x9584de,'ASC'];}});}return _0x5d2a7c;};exports['omit']=function(_0x2a22a6,_0xe973a0){if(_[_0x29cd('0xc')](_0x2a22a6)){return _0x2a22a6;}if(_['isArray'](_0x2a22a6)){for(var _0x8f1349=0x0;_0x8f1349<_0x2a22a6[_0x29cd('0x22')];_0x8f1349+=0x1){_0x2a22a6[_0x8f1349]=this['omit'](_0x2a22a6[_0x8f1349],_0xe973a0);}return _0x2a22a6;}if(!_[_0x29cd('0x23')](_0x2a22a6)){return _0x2a22a6;}if(_['isString'](_0xe973a0)){_0xe973a0=[_0xe973a0];}if(!_[_0x29cd('0x18')](_0xe973a0)){return _0x2a22a6;}for(var _0x1e6071=0x0;_0x1e6071<_0xe973a0[_0x29cd('0x22')];_0x1e6071+=0x1){_['unset'](_0x2a22a6,_0xe973a0[_0x1e6071]);}for(var _0x2efbe5 in _0x2a22a6){if(_0x2a22a6[_0x29cd('0x24')](_0x2efbe5)){_0x2a22a6[_0x2efbe5]=this[_0x29cd('0x25')](_0x2a22a6[_0x2efbe5],_0xe973a0);}}return _0x2a22a6;};exports[_0x29cd('0x26')]=function(_0x1ec045){return _0x1ec045[_0x29cd('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x29cd('0x28')]=function(_0x38f103){return _0x38f103[_0x29cd('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x29cd('0x29')]=function(_0x487fab,_0x3f8255){var _0x372f94=[];var _0x293977=/[ `!@#$%^&*()_\-?~]/;var _0x3cc4b2=_0x3f8255?_0x29cd('0x2a'):'{EXPR}';_0x487fab[_0x29cd('0xa')](/[ ,]+/)[_0x29cd('0x2b')](function(_0xcf4c83){_0xcf4c83=_0xcf4c83[_0x29cd('0x2c')](/([^:]")"+/g,'$1');_0xcf4c83='+'+_0xcf4c83+'*';var _0x26a82f=_0xcf4c83['match'](_0x293977);if(_0x26a82f){_0xcf4c83='\x22'+_0xcf4c83+'\x22';}_0x372f94[_0x29cd('0x2d')](_0xcf4c83);});_0x3cc4b2=_0x3cc4b2['replace']('{EXPR}',_0x372f94[_0x29cd('0x2e')]('\x20'));return _0x3cc4b2;};exports['getOptions']=function(_0x2947b9,_0x2c2a75,_0x1dc38d){var _0x26c496={},_0x250b52={};if(_0x2c2a75[_0x29cd('0x2f')][_0x29cd('0x30')]){_0x2c2a75[_0x29cd('0x2f')]['id']=_0x2c2a75[_0x29cd('0x2f')][_0x29cd('0x30')];delete _0x2c2a75['query']['$id'];}_0x26c496[_0x29cd('0x6')]=_[_0x29cd('0x1b')](_0x2947b9,'name');_0x26c496[_0x29cd('0x2f')]=_[_0x29cd('0x3')](_0x2c2a75['query']);_0x26c496[_0x29cd('0xb')]=_[_0x29cd('0x31')](_0x26c496[_0x29cd('0x6')],_0x26c496[_0x29cd('0x2f')]);_0x250b52[_0x29cd('0x32')]=_[_0x29cd('0x31')](_0x26c496['model'],this[_0x29cd('0x8')](_0x2c2a75['query'][_0x29cd('0x8')]));_0x250b52['attributes']=_0x250b52[_0x29cd('0x32')][_0x29cd('0x22')]?_0x250b52['attributes']:_0x26c496['model'];if(!_0x2c2a75[_0x29cd('0x2f')][_0x29cd('0x24')](_0x29cd('0x33'))){_0x250b52[_0x29cd('0x19')]=this['limit'](_0x2c2a75[_0x29cd('0x2f')][_0x29cd('0x19')]);_0x250b52[_0x29cd('0x1a')]=this['offset'](_0x2c2a75[_0x29cd('0x2f')][_0x29cd('0x1a')]);}_0x250b52[_0x29cd('0x34')]=this[_0x29cd('0x35')](_0x2c2a75[_0x29cd('0x2f')][_0x29cd('0x35')]);_0x250b52['where']=this['filters'](_[_0x29cd('0x36')](_0x2c2a75[_0x29cd('0x2f')],_0x26c496[_0x29cd('0xb')]),_0x2947b9);if(_0x2c2a75['query'][_0x29cd('0x37')]){var _0x4067fb=_0x2947b9;var _0x30170d=_0x2c2a75[_0x29cd('0x2f')][_0x29cd('0x37')];if(typeof _0x30170d==='object'){_0x4067fb=_['filter'](_0x2947b9,function(_0xb8bc8d){return _[_0x29cd('0x4')](_0x30170d['columns'],_0xb8bc8d[_0x29cd('0x16')]);});_0x30170d=_0x30170d[_0x29cd('0x38')];}_0x250b52[_0x29cd('0x39')]=_[_0x29cd('0x3a')](_0x250b52[_0x29cd('0x39')],{'$or':_[_0x29cd('0x1b')](_0x4067fb,function(_0x35aeb8){if(_0x35aeb8[_0x29cd('0xf')]!=='VIRTUAL'){if(_0x1dc38d){return sequelize[_0x29cd('0x39')](sequelize['fn']('lower',sequelize[_0x29cd('0x3b')](_0x35aeb8['name'])),{'$like':sequelize['fn']('lower','%'+_0x2c2a75[_0x29cd('0x2f')][_0x29cd('0x37')]+'%')});}else{var _0x2a959b={};_0x2a959b[_0x35aeb8[_0x29cd('0x16')]]={'$like':'%'+_0x2c2a75['query'][_0x29cd('0x37')]+'%'};return _0x2a959b;}}})});}_0x250b52=_['merge']({},_0x250b52,_0x2c2a75[_0x29cd('0x3c')]);return _0x250b52;};exports['include']=function(_0x30a026){var _0x1bf5e6=[];if(_0x30a026[_0x29cd('0x3d')]){_0x1bf5e6[_0x29cd('0x2d')]({'all':!![]});}else if(_0x30a026[_0x29cd('0x3e')]){if(Array[_0x29cd('0x18')](_0x30a026['include'])){_0x1bf5e6=Object[_0x29cd('0x3')](_0x30a026[_0x29cd('0x3e')])['map'](function(_0x49e338){return parseIncludeModel(_0x30a026[_0x29cd('0x3e')][_0x49e338]);});}else{var _0x3e67e1=parseIncludeModel(_0x30a026[_0x29cd('0x3e')]);_0x1bf5e6['push'](_0x3e67e1);}}return _0x1bf5e6;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 41770e7..1f1dc99 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['fullname','internal','indexOf','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','role','whatsappStatus','whatsappStatusTime','mailCapacity','openchannelCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','length','unavailable','ringing','voiceStatus','idle','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','Agents','then','error','result','request','merge','catch','getRealtimeAgents','unknown','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','uniq','value','getAgentIdsByQueues','filter','includes','busy','getAgentIdsByStatus','resolve','name','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal'];(function(_0x2cab87,_0x34bff4){var _0x356bca=function(_0x1edb31){while(--_0x1edb31){_0x2cab87['push'](_0x2cab87['shift']());}};_0x356bca(++_0x34bff4);}(_0xe14b,0x93));var _0xbe14=function(_0x3be6e2,_0x5722e6){_0x3be6e2=_0x3be6e2-0x0;var _0x172e01=_0xe14b[_0x3be6e2];return _0x172e01;};'use strict';var _=require(_0xbe14('0x0'));var jayson=require(_0xbe14('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0xbe14('0x2')]({'port':0x232a});var routingClient=jayson[_0xbe14('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x7d3665,_0x5ce8fb){var _0x496c04=[_0x7d3665[_0xbe14('0x4')],_0x7d3665[_0xbe14('0x5')],_0x7d3665[_0xbe14('0x6')],_0x7d3665[_0xbe14('0x7')],_0x7d3665[_0xbe14('0x8')],_0x7d3665[_0xbe14('0x9')],_0x7d3665[_0xbe14('0xa')]];if(!_0x5ce8fb)return _['every'](_0x496c04);var _0x50f909=_['filter'](_0x496c04);return _0x50f909[_0xbe14('0xb')]>0x0&&_0x50f909[_0xbe14('0xb')]<_0x496c04[_0xbe14('0xb')]?!![]:![];}function isIdle(_0x90b4f){return _0x90b4f==='idle'||_0x90b4f==='unknown'||_0x90b4f===_0xbe14('0xc')||_0x90b4f===_0xbe14('0xd')||_['isNil'](_0x90b4f);}function isAgentIdle(_0x254c3b){if(_0x254c3b[_0xbe14('0xe')]!==_0xbe14('0xf')&&_0x254c3b[_0xbe14('0x9')]){_0x254c3b[_0xbe14('0xe')]=_0xbe14('0x10');return![];}return _[_0xbe14('0x11')]([_0x254c3b[_0xbe14('0x12')],_0x254c3b[_0xbe14('0x13')],_0x254c3b[_0xbe14('0x14')],_0x254c3b[_0xbe14('0x15')],_0x254c3b[_0xbe14('0x16')],_0x254c3b[_0xbe14('0xe')],_0x254c3b['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xbe14('0x17'),{})[_0xbe14('0x18')](function(_0xf4ac9){if(_0xf4ac9[_0xbe14('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x21c789=_0xf4ac9[_0xbe14('0x1a')];return routingClient[_0xbe14('0x1b')](_0xbe14('0x17'),{})[_0xbe14('0x18')](function(_0x29ab73){if(_0x29ab73[_0xbe14('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x137ee5=_0x29ab73[_0xbe14('0x1a')];return _[_0xbe14('0x1c')]({},_0x21c789,_0x137ee5);});})[_0xbe14('0x1d')](function(_0x3249da){throw _0x3249da;});}exports[_0xbe14('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x59a9e3){var _0x24f820=_0xbe14('0x1f');if(isAgentPaused(_0x59a9e3))_0x24f820=_0xbe14('0x10');else if(isAgentPaused(_0x59a9e3,!![]))_0x24f820=_0xbe14('0x20');else if(isAgentIdle(_0x59a9e3))_0x24f820=_0xbe14('0xf');else _0x24f820='busy';return _0x24f820;}exports[_0xbe14('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x56d845,_0x3c1c85){var _0x56e80c=_[_0xbe14('0x22')](_0x56d845)?_0x56d845:[_0x56d845];var _0x4a25fa=_[_0xbe14('0x23')](_0x3c1c85)+_0xbe14('0x24');var _0x505dbd=_[_0xbe14('0x25')](_0x56e80c,function(_0x4d4190){return db[_0x4a25fa][_0xbe14('0x26')]({'where':{'id':_0x4d4190}})['then'](function(_0x36a21e){if(!_0x36a21e)return[];return _0x36a21e[_0xbe14('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xbe14('0x28')](_0x505dbd)[_0xbe14('0x18')](function(_0x15ef02){var _0x2703f5=_(_0x15ef02)['flatten']()[_0xbe14('0x25')]('id')[_0xbe14('0x29')]()[_0xbe14('0x2a')]();return _0x2703f5;});}exports[_0xbe14('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5dd475,_0x16f884,_0x29fc64){try{if(_0x16f884['length']>0x0){_0x5dd475=_0x5dd475[_0xbe14('0x2c')](function(_0x3b3e84){return _0x16f884[_0xbe14('0x2d')](_0x3b3e84['id']);});}var _0x19252f=_0x5dd475[_0xbe14('0x2c')](function(_0x36d4b2){var _0x31a664=_0xbe14('0x2e');if(isAgentIdle(_0x36d4b2)){_0x31a664=_0xbe14('0xf');}return _0x31a664===_0x29fc64;});return _[_0xbe14('0x25')](_0x19252f,'id');}catch(_0x40538f){throw _0x40538f;}}exports[_0xbe14('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x39dc0a,_0x10ae36,_0x223f7a){return Promise[_0xbe14('0x30')]()[_0xbe14('0x18')](function(){if(_0x10ae36[_0xbe14('0xb')]>0x0){_0x39dc0a=_0x39dc0a[_0xbe14('0x2c')](function(_0x14e7c4){return _0x10ae36['includes'](_0x14e7c4['id']);});}return _0x39dc0a;})[_0xbe14('0x18')](function(){return db['User']['findAll']({'attributes':['id',_0xbe14('0x31'),'fullname',_0xbe14('0x4'),_0xbe14('0x5'),'mailPause','openchannelPause','smsPause',_0xbe14('0x9'),_0xbe14('0xa'),'pauseType'],'where':{'id':{'$in':_[_0xbe14('0x25')](_0x39dc0a,'id')}},'raw':!![]});})[_0xbe14('0x18')](function(_0x452635){return _0x452635[_0xbe14('0x25')](function(_0x29c23e){var _0x5ef1e5=_['find'](_0x39dc0a,['id',_0x29c23e['id']]);var _0x15a997=filterAgentAttributes(_0x5ef1e5);_['merge'](_0x29c23e,_0x15a997);_0x29c23e['globalStatus']=getAgentStatus(_0x29c23e);return _0x29c23e;});})['then'](function(_0x163ef7){var _0x393f6b=sortAgentsByStatus(_0x163ef7,_0x223f7a);return _[_0xbe14('0x25')](_0x393f6b,'id');})[_0xbe14('0x1d')](function(_0x172e79){throw _0x172e79;});}exports[_0xbe14('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xcdc50){var _0x10ec3c={'fields':[],'order':null};var _0x2d9c12=_0xcdc50[_0xbe14('0x33')](',');_0x10ec3c[_0xbe14('0x34')]=_[_0xbe14('0x2c')](_0x2d9c12,function(_0x539c41){if(!_0x539c41['includes'](_0xbe14('0x35'))){return!![];}_0x10ec3c[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x539c41,'-')?'DESC':_0xbe14('0x38');return![];});return _0x10ec3c;}exports[_0xbe14('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0xeda70e){if(!_0xeda70e){_0xeda70e=_0xbe14('0x3a');}if(_0xeda70e[_0xbe14('0x2d')](_0xbe14('0x3b'))&&!_0xeda70e[_0xbe14('0x2d')](_0xbe14('0x3c'))){var _0x1b2608=_0xeda70e['substring'](0x0,_0xeda70e[_0xbe14('0x3d')](_0xbe14('0x3b')));_0xeda70e+=','+_0x1b2608+_0xbe14('0x3c');}return _0xeda70e;}exports[_0xbe14('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x3287b9,_0x2dd3e3){var _0x548d17=_0x3287b9[_0xbe14('0x3f')](function(_0x1974a4,_0x1220c9){if(_0x1974a4[_0xbe14('0x35')]===_0x1220c9['globalStatus']){if(_0x1974a4['globalStatus']===_0xbe14('0x10')){if(_0x2dd3e3===_0xbe14('0x40')){return(_0x1974a4[_0xbe14('0x41')]||'')<(_0x1220c9['pauseType']||'')||_0x1974a4['fullname'][_0xbe14('0x42')]()>_0x1220c9['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x1974a4[_0xbe14('0x41')]||'')<(_0x1220c9[_0xbe14('0x41')]||'')||_0x1974a4[_0xbe14('0x3b')]['toLowerCase']()>_0x1220c9['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x2dd3e3===_0xbe14('0x40')){return _0x1974a4[_0xbe14('0x3b')][_0xbe14('0x42')]()<_0x1220c9['fullname'][_0xbe14('0x42')]()?0x1:-0x1;}else{return _0x1974a4[_0xbe14('0x3b')][_0xbe14('0x42')]()<_0x1220c9[_0xbe14('0x3b')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x2dd3e3==='DESC'){return _0x1974a4[_0xbe14('0x35')]<_0x1220c9[_0xbe14('0x35')]?0x1:-0x1;}else{return _0x1974a4[_0xbe14('0x35')]<_0x1220c9[_0xbe14('0x35')]?-0x1:0x1;}}});return _0x548d17;}exports[_0xbe14('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x4f2d95){var _0x51023a=[_0xbe14('0x44'),_0xbe14('0x45'),_0xbe14('0x46'),_0xbe14('0x47'),'pauseType',_0xbe14('0x47'),_0xbe14('0x3c'),'address',_0xbe14('0x4'),_0xbe14('0x7'),_0xbe14('0x6'),_0xbe14('0x8'),'whatsappPause','faxPause',_0xbe14('0x9'),_0xbe14('0x48'),'openchannelCapacity','mailCapacity',_0xbe14('0x49'),_0xbe14('0x4a'),_0xbe14('0x4b'),_0xbe14('0x4c'),_0xbe14('0x4d'),_0xbe14('0x4e'),_0xbe14('0x4f'),'whatsappCurrentCapacity',_0xbe14('0x50'),_0xbe14('0x12'),_0xbe14('0x15'),_0xbe14('0x14'),_0xbe14('0x16'),'whatsappStatus',_0xbe14('0x13'),_0xbe14('0xe'),_0xbe14('0x51'),_0xbe14('0x52'),_0xbe14('0x53'),_0xbe14('0x54'),'whatsappStatusTime','faxStatusTime',_0xbe14('0x55'),_0xbe14('0x56'),_0xbe14('0x57'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0xbe14('0x58'),_0xbe14('0x59')];var _0x50d78f=[_0xbe14('0x4'),_0xbe14('0x7'),'mailPause',_0xbe14('0x8'),'whatsappPause',_0xbe14('0x5'),_0xbe14('0x9'),_0xbe14('0x45')];var _0x550291=_(_0x4f2d95)[_0xbe14('0x5a')](_0x50d78f)[_0xbe14('0x5b')](_0x51023a)['value']();return _0x550291;}exports[_0xbe14('0x5c')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xbe14('0x31'),_0xbe14('0x3b'),_0xbe14('0x5d'),_0xbe14('0x3c'),'online',_0xbe14('0x35'),_0xbe14('0x44'),_0xbe14('0x46'),_0xbe14('0x41'),_0xbe14('0x47'),_0xbe14('0x5'),_0xbe14('0x4'),'mailPause',_0xbe14('0x7'),_0xbe14('0x8'),_0xbe14('0x9'),_0xbe14('0xa'),_0xbe14('0x12'),_0xbe14('0x13'),_0xbe14('0x14'),_0xbe14('0x15'),_0xbe14('0x16'),_0xbe14('0xe'),_0xbe14('0x5e'),'chatStatusTime','faxStatusTime','mailStatusTime',_0xbe14('0x52'),_0xbe14('0x54'),_0xbe14('0x55'),_0xbe14('0x5f'),_0xbe14('0x48'),_0xbe14('0x4b'),_0xbe14('0x60'),_0xbe14('0x61'),_0xbe14('0x49'),_0xbe14('0x4a'),_0xbe14('0x4c'),_0xbe14('0x50'),_0xbe14('0x4e'),_0xbe14('0x4d'),_0xbe14('0x4f'),_0xbe14('0x62'),_0xbe14('0x63'),_0xbe14('0x58'),_0xbe14('0x57'),_0xbe14('0x64'),'queue',_0xbe14('0x59'),_0xbe14('0x65')];}exports[_0xbe14('0x66')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x6aa7=['getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','name','chatPause','pauseType','find','globalStatus','fields','order','startsWith','DESC','ASC','fullname,internal','fullname','internal','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelPause','faxPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','omit','pick','role','openchannelStatusTime','smsStatusTime','chatCurrentCapacity','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','mailPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','every','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','Agents','then','error','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value'];(function(_0x1d3391,_0x23e5cb){var _0x3c747b=function(_0x45a205){while(--_0x45a205){_0x1d3391['push'](_0x1d3391['shift']());}};_0x3c747b(++_0x23e5cb);}(_0x6aa7,0x178));var _0x76aa=function(_0x39a4c,_0x2ab523){_0x39a4c=_0x39a4c-0x0;var _0x4981af=_0x6aa7[_0x39a4c];return _0x4981af;};'use strict';var _=require(_0x76aa('0x0'));var jayson=require('jayson/promise');var db=require(_0x76aa('0x1'))['db'];var amiClient=jayson[_0x76aa('0x2')][_0x76aa('0x3')]({'port':0x232a});var routingClient=jayson[_0x76aa('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x13f62b,_0xef15ef){var _0x1d6e04=[_0x13f62b['chatPause'],_0x13f62b['faxPause'],_0x13f62b[_0x76aa('0x4')],_0x13f62b['openchannelPause'],_0x13f62b[_0x76aa('0x5')],_0x13f62b[_0x76aa('0x6')],_0x13f62b[_0x76aa('0x7')]];if(!_0xef15ef)return _['every'](_0x1d6e04);var _0x3dae33=_[_0x76aa('0x8')](_0x1d6e04);return _0x3dae33[_0x76aa('0x9')]>0x0&&_0x3dae33['length']<_0x1d6e04[_0x76aa('0x9')]?!![]:![];}function isIdle(_0x25856d){return _0x25856d===_0x76aa('0xa')||_0x25856d===_0x76aa('0xb')||_0x25856d===_0x76aa('0xc')||_0x25856d===_0x76aa('0xd')||_[_0x76aa('0xe')](_0x25856d);}function isAgentIdle(_0x8dc35c){if(_0x8dc35c[_0x76aa('0xf')]!==_0x76aa('0xa')&&_0x8dc35c['voicePause']){_0x8dc35c[_0x76aa('0xf')]='pause';return![];}return _[_0x76aa('0x10')]([_0x8dc35c[_0x76aa('0x11')],_0x8dc35c[_0x76aa('0x12')],_0x8dc35c[_0x76aa('0x13')],_0x8dc35c[_0x76aa('0x14')],_0x8dc35c['smsStatus'],_0x8dc35c['voiceStatus'],_0x8dc35c[_0x76aa('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x76aa('0x16'),{})[_0x76aa('0x17')](function(_0x5cf594){if(_0x5cf594[_0x76aa('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x328381=_0x5cf594['result'];return routingClient[_0x76aa('0x19')](_0x76aa('0x16'),{})[_0x76aa('0x17')](function(_0x21c16d){if(_0x21c16d[_0x76aa('0x18')]){throw new Error(_0x76aa('0x1a'));}var _0x496902=_0x21c16d['result'];return _[_0x76aa('0x1b')]({},_0x328381,_0x496902);});})[_0x76aa('0x1c')](function(_0xf0711){throw _0xf0711;});}exports[_0x76aa('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x15109b){var _0x191560=_0x76aa('0xb');if(isAgentPaused(_0x15109b))_0x191560=_0x76aa('0x1e');else if(isAgentPaused(_0x15109b,!![]))_0x191560=_0x76aa('0x1f');else if(isAgentIdle(_0x15109b))_0x191560='idle';else _0x191560=_0x76aa('0x20');return _0x191560;}exports[_0x76aa('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x338a6b,_0x5b3f55){var _0x41463a=_[_0x76aa('0x22')](_0x338a6b)?_0x338a6b:[_0x338a6b];var _0x31252f=_[_0x76aa('0x23')](_0x5b3f55)+_0x76aa('0x24');var _0xc1044c=_[_0x76aa('0x25')](_0x41463a,function(_0x3363b3){return db[_0x31252f][_0x76aa('0x26')]({'where':{'id':_0x3363b3}})[_0x76aa('0x17')](function(_0x37f1ab){if(!_0x37f1ab)return[];return _0x37f1ab[_0x76aa('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x76aa('0x28')](_0xc1044c)['then'](function(_0xb5e8a9){var _0x1d6d15=_(_0xb5e8a9)[_0x76aa('0x29')]()[_0x76aa('0x25')]('id')[_0x76aa('0x2a')]()[_0x76aa('0x2b')]();return _0x1d6d15;});}exports[_0x76aa('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x282d0a,_0xd12a99,_0x1bdc3d){try{if(_0xd12a99['length']>0x0){_0x282d0a=_0x282d0a[_0x76aa('0x8')](function(_0x5a8030){return _0xd12a99[_0x76aa('0x2d')](_0x5a8030['id']);});}var _0x365ff8=_0x282d0a[_0x76aa('0x8')](function(_0x1e90b9){var _0x1eecd9=_0x76aa('0x20');if(isAgentIdle(_0x1e90b9)){_0x1eecd9=_0x76aa('0xa');}return _0x1eecd9===_0x1bdc3d;});return _[_0x76aa('0x25')](_0x365ff8,'id');}catch(_0x19fd4f){throw _0x19fd4f;}}exports[_0x76aa('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5edcd8,_0x430ad6,_0x5532c7){return Promise[_0x76aa('0x2f')]()[_0x76aa('0x17')](function(){if(_0x430ad6[_0x76aa('0x9')]>0x0){_0x5edcd8=_0x5edcd8[_0x76aa('0x8')](function(_0x35a705){return _0x430ad6['includes'](_0x35a705['id']);});}return _0x5edcd8;})[_0x76aa('0x17')](function(){return db[_0x76aa('0x30')]['findAll']({'attributes':['id',_0x76aa('0x31'),'fullname',_0x76aa('0x32'),'faxPause',_0x76aa('0x4'),'openchannelPause','smsPause',_0x76aa('0x6'),_0x76aa('0x7'),_0x76aa('0x33')],'where':{'id':{'$in':_[_0x76aa('0x25')](_0x5edcd8,'id')}},'raw':!![]});})['then'](function(_0x592596){return _0x592596[_0x76aa('0x25')](function(_0x1c7b6f){var _0x58127c=_[_0x76aa('0x34')](_0x5edcd8,['id',_0x1c7b6f['id']]);var _0x23029e=filterAgentAttributes(_0x58127c);_['merge'](_0x1c7b6f,_0x23029e);_0x1c7b6f[_0x76aa('0x35')]=getAgentStatus(_0x1c7b6f);return _0x1c7b6f;});})['then'](function(_0x5086f5){var _0x4fdbde=sortAgentsByStatus(_0x5086f5,_0x5532c7);return _[_0x76aa('0x25')](_0x4fdbde,'id');})[_0x76aa('0x1c')](function(_0x127bc4){throw _0x127bc4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x401c07){var _0x1c22f7={'fields':[],'order':null};var _0x2eea79=_0x401c07['split'](',');_0x1c22f7[_0x76aa('0x36')]=_[_0x76aa('0x8')](_0x2eea79,function(_0x2f7726){if(!_0x2f7726[_0x76aa('0x2d')](_0x76aa('0x35'))){return!![];}_0x1c22f7[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x2f7726,'-')?_0x76aa('0x39'):_0x76aa('0x3a');return![];});return _0x1c22f7;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x1525cb){if(!_0x1525cb){_0x1525cb=_0x76aa('0x3b');}if(_0x1525cb[_0x76aa('0x2d')](_0x76aa('0x3c'))&&!_0x1525cb[_0x76aa('0x2d')](_0x76aa('0x3d'))){var _0x572fdb=_0x1525cb['substring'](0x0,_0x1525cb[_0x76aa('0x3e')](_0x76aa('0x3c')));_0x1525cb+=','+_0x572fdb+_0x76aa('0x3d');}return _0x1525cb;}exports[_0x76aa('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x50599f,_0x174a14){var _0x403084=_0x50599f[_0x76aa('0x40')](function(_0x30cdcb,_0x1138b5){if(_0x30cdcb['globalStatus']===_0x1138b5[_0x76aa('0x35')]){if(_0x30cdcb['globalStatus']===_0x76aa('0x1e')){if(_0x174a14==='DESC'){return(_0x30cdcb['pauseType']||'')<(_0x1138b5['pauseType']||'')||_0x30cdcb[_0x76aa('0x3c')]['toLowerCase']()>_0x1138b5['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x30cdcb[_0x76aa('0x33')]||'')<(_0x1138b5[_0x76aa('0x33')]||'')||_0x30cdcb[_0x76aa('0x3c')][_0x76aa('0x41')]()>_0x1138b5[_0x76aa('0x3c')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x174a14===_0x76aa('0x39')){return _0x30cdcb[_0x76aa('0x3c')][_0x76aa('0x41')]()<_0x1138b5[_0x76aa('0x3c')][_0x76aa('0x41')]()?0x1:-0x1;}else{return _0x30cdcb['fullname'][_0x76aa('0x41')]()<_0x1138b5[_0x76aa('0x3c')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x174a14===_0x76aa('0x39')){return _0x30cdcb['globalStatus']<_0x1138b5[_0x76aa('0x35')]?0x1:-0x1;}else{return _0x30cdcb[_0x76aa('0x35')]<_0x1138b5[_0x76aa('0x35')]?-0x1:0x1;}}});return _0x403084;}exports[_0x76aa('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x2d0bc4){var _0x3e0315=[_0x76aa('0x43'),_0x76aa('0x44'),_0x76aa('0x45'),_0x76aa('0x46'),'pauseType',_0x76aa('0x46'),'internal',_0x76aa('0x47'),_0x76aa('0x32'),_0x76aa('0x48'),_0x76aa('0x4'),'smsPause','whatsappPause',_0x76aa('0x49'),'voicePause',_0x76aa('0x4a'),_0x76aa('0x4b'),_0x76aa('0x4c'),_0x76aa('0x4d'),_0x76aa('0x4e'),_0x76aa('0x4f'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x76aa('0x50'),_0x76aa('0x51'),_0x76aa('0x52'),_0x76aa('0x53'),_0x76aa('0x11'),_0x76aa('0x14'),'mailStatus',_0x76aa('0x54'),_0x76aa('0x15'),_0x76aa('0x12'),'voiceStatus',_0x76aa('0x55'),'openchannelStatusTime',_0x76aa('0x56'),'smsStatusTime',_0x76aa('0x57'),_0x76aa('0x58'),_0x76aa('0x59'),_0x76aa('0x5a'),_0x76aa('0x5b'),_0x76aa('0x5c'),_0x76aa('0x5d'),'phoneBarEnableAutomaticScreenRecording',_0x76aa('0x5e')];var _0x5eeaa5=[_0x76aa('0x32'),_0x76aa('0x48'),_0x76aa('0x4'),_0x76aa('0x5'),_0x76aa('0x7'),_0x76aa('0x49'),_0x76aa('0x6'),'online'];var _0x333a3a=_(_0x2d0bc4)[_0x76aa('0x5f')](_0x5eeaa5)[_0x76aa('0x60')](_0x3e0315)[_0x76aa('0x2b')]();return _0x333a3a;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x76aa('0x31'),_0x76aa('0x3c'),_0x76aa('0x61'),_0x76aa('0x3d'),_0x76aa('0x44'),_0x76aa('0x35'),'userpic',_0x76aa('0x45'),_0x76aa('0x33'),_0x76aa('0x46'),_0x76aa('0x49'),_0x76aa('0x32'),_0x76aa('0x4'),_0x76aa('0x48'),'smsPause','voicePause',_0x76aa('0x7'),_0x76aa('0x11'),'faxStatus',_0x76aa('0x13'),_0x76aa('0x14'),'smsStatus',_0x76aa('0xf'),_0x76aa('0x15'),_0x76aa('0x55'),_0x76aa('0x58'),_0x76aa('0x56'),_0x76aa('0x62'),_0x76aa('0x63'),_0x76aa('0x59'),_0x76aa('0x57'),'chatCapacity',_0x76aa('0x4f'),'mailCapacity',_0x76aa('0x4b'),_0x76aa('0x4d'),_0x76aa('0x4e'),_0x76aa('0x64'),_0x76aa('0x53'),_0x76aa('0x50'),_0x76aa('0x65'),_0x76aa('0x51'),_0x76aa('0x52'),'phoneBarEnableScreenRecordingByAgent',_0x76aa('0x66'),_0x76aa('0x5b'),_0x76aa('0x67'),_0x76aa('0x5a'),_0x76aa('0x5e'),_0x76aa('0x5c')];}exports[_0x76aa('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 6cd275a..e68712f 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2da5=['client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','outbound','concat','map','get','find','merge','pick','initializeQueues','jayson/promise','util'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0x2da5,0x107));var _0x52da=function(_0xbe183e,_0x2797d9){_0xbe183e=_0xbe183e-0x0;var _0x397012=_0x2da5[_0xbe183e];return _0x397012;};'use strict';var _=require('lodash');var jayson=require(_0x52da('0x0'));var util=require(_0x52da('0x1'));var amiClient=jayson[_0x52da('0x2')][_0x52da('0x3')]({'port':0x232a});var routingClient=jayson[_0x52da('0x2')][_0x52da('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x52da('0x4'),_0x52da('0x5'),_0x52da('0x6'),_0x52da('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x52da('0x8'),_0x52da('0x9'),_0x52da('0xa'),_0x52da('0xb'),_0x52da('0xc'),_0x52da('0xd'),'ringing',_0x52da('0xe'),_0x52da('0xf'),_0x52da('0x10'),_0x52da('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x52da('0x12'),_0x52da('0x13'),_0x52da('0x14'),_0x52da('0x15'),_0x52da('0x16'),'dialMethod','Trunk',_0x52da('0x17'),'startProgressive',_0x52da('0x18'),_0x52da('0x19'),_0x52da('0x1a'),_0x52da('0x1b'),_0x52da('0x1c'),'dialPredictiveIntervalMaxThreshold',_0x52da('0x1d'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0x52da('0x1e'),_0x52da('0x1f'),_0x52da('0x20'),_0x52da('0x21'),_0x52da('0x22')];function getRealtimeQueues(_0x21da3f,_0x1dc2e7){var _0x5a062b=_0x1dc2e7===_0x52da('0x23')?amiClient:routingClient;return _0x5a062b['request'](_[_0x52da('0x24')](_0x1dc2e7)+_0x52da('0x25'),_0x21da3f)['then'](function(_0x393b61){if(_0x393b61[_0x52da('0x26')])throw new Error(util[_0x52da('0x27')](_0x52da('0x28'),_0x1dc2e7));return _0x393b61[_0x52da('0x29')];})[_0x52da('0x2a')](function(_0x5b81b8){throw _0x5b81b8;});}exports[_0x52da('0x2b')]=getRealtimeQueues;function initializeQueues(_0x377a7b,_0x3e107e,_0x4a2012,_0x226967){var _0x5d914f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4a2012===_0x52da('0x23')){if(_0x226967===_0x52da('0x2c')){_0x5d914f=_0x5d914f['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x226967===_0x52da('0x2d')){_0x5d914f=_0x5d914f[_0x52da('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x377a7b[_0x52da('0x2f')](function(_0x20a922){var _0x18f6d8=_0x20a922[_0x52da('0x30')]({'plain':!![]});_0x18f6d8[_0x52da('0x6')]=0x0;_0x18f6d8[_0x52da('0xb')]=0x0;_0x18f6d8['loggedIn']=0x0;_0x18f6d8['available']=0x0;_0x18f6d8[_0x52da('0x7')]=0x0;if(_0x4a2012==='voice'){_0x18f6d8[_0x52da('0xf')]=0x0;_0x18f6d8[_0x52da('0x8')]=0x0;if(_0x226967===_0x52da('0x2d')){_0x18f6d8[_0x52da('0x12')]=0x0;_0x18f6d8[_0x52da('0x13')]=0x0;}}var _0x48bac0=_[_0x52da('0x31')](_0x3e107e,['id',_0x18f6d8['id']]);if(_0x48bac0){_[_0x52da('0x32')](_0x18f6d8,_[_0x52da('0x33')](_0x48bac0,_0x5d914f));}return _0x18f6d8;});}exports[_0x52da('0x34')]=initializeQueues; \ No newline at end of file +var _0xd745=['talking','unknown','pTalking','originated','message','statusMessage','dialActive','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','concat','outbound','map','loggedInDb','merge','pick','initializeQueues','util','client','http','available','loggedIn','paused','waiting','invalid','notInUse','onHold','ringing','ringInUse'];(function(_0x148acb,_0x2694f7){var _0x3b9378=function(_0x5bb255){while(--_0x5bb255){_0x148acb['push'](_0x148acb['shift']());}};_0x3b9378(++_0x2694f7);}(_0xd745,0x13d));var _0x5d74=function(_0x210c2a,_0x53017c){_0x210c2a=_0x210c2a-0x0;var _0x1ea3b1=_0xd745[_0x210c2a];return _0x1ea3b1;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var util=require(_0x5d74('0x0'));var amiClient=jayson[_0x5d74('0x1')][_0x5d74('0x2')]({'port':0x232a});var routingClient=jayson[_0x5d74('0x1')][_0x5d74('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x5d74('0x3'),_0x5d74('0x4'),_0x5d74('0x5'),_0x5d74('0x6')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x5d74('0x7'),'loggedInDb',_0x5d74('0x8'),_0x5d74('0x9'),_0x5d74('0xa'),_0x5d74('0xb'),_0x5d74('0xc'),'unavailable',_0x5d74('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x5d74('0xe'),_0x5d74('0xf'),_0x5d74('0x10'),_0x5d74('0x11'),_0x5d74('0x12'),'dialMethod',_0x5d74('0x13'),_0x5d74('0x14'),'startProgressive',_0x5d74('0x15'),_0x5d74('0x16'),_0x5d74('0x17'),'erlangBusyFactor',_0x5d74('0x18'),_0x5d74('0x19'),'dialPredictiveIntervalMinThreshold',_0x5d74('0x1a'),_0x5d74('0x1b'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x5d74('0x1c'),_0x5d74('0x1d'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3e99ca,_0xe14c38){var _0x10153d=_0xe14c38==='voice'?amiClient:routingClient;return _0x10153d[_0x5d74('0x1e')](_['startCase'](_0xe14c38)+_0x5d74('0x1f'),_0x3e99ca)[_0x5d74('0x20')](function(_0x30a41b){if(_0x30a41b[_0x5d74('0x21')])throw new Error(util[_0x5d74('0x22')](_0x5d74('0x23'),_0xe14c38));return _0x30a41b[_0x5d74('0x24')];})[_0x5d74('0x25')](function(_0x45921d){throw _0x45921d;});}exports[_0x5d74('0x26')]=getRealtimeQueues;function initializeQueues(_0x3e8b3c,_0x4f59ca,_0xff5562,_0x2e3c8e){var _0x444f2d=DEFAULT_QUEUE_ATTRIBUTES;if(_0xff5562===_0x5d74('0x27')){if(_0x2e3c8e==='inbound'){_0x444f2d=_0x444f2d[_0x5d74('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2e3c8e===_0x5d74('0x29')){_0x444f2d=_0x444f2d[_0x5d74('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3e8b3c[_0x5d74('0x2a')](function(_0x117ba7){var _0x4cc033=_0x117ba7['get']({'plain':!![]});_0x4cc033[_0x5d74('0x5')]=0x0;_0x4cc033[_0x5d74('0x2b')]=0x0;_0x4cc033[_0x5d74('0x4')]=0x0;_0x4cc033[_0x5d74('0x3')]=0x0;_0x4cc033['waiting']=0x0;if(_0xff5562===_0x5d74('0x27')){_0x4cc033[_0x5d74('0xc')]=0x0;_0x4cc033['busy']=0x0;if(_0x2e3c8e===_0x5d74('0x29')){_0x4cc033[_0x5d74('0xe')]=0x0;_0x4cc033[_0x5d74('0xf')]=0x0;}}var _0x10e033=_['find'](_0x4f59ca,['id',_0x4cc033['id']]);if(_0x10e033){_[_0x5d74('0x2c')](_0x4cc033,_[_0x5d74('0x2d')](_0x10e033,_0x444f2d));}return _0x4cc033;});}exports[_0x5d74('0x2e')]=initializeQueues; \ No newline at end of file diff --git a/server/config/environment/development.js b/server/config/environment/development.js index 8e0e3b9..9753583 100644 --- a/server/config/environment/development.js +++ b/server/config/environment/development.js @@ -8,7 +8,7 @@ var isDocker = process.env.USE_DOCKER == '1' // Development specific configuration // ================================== module.exports = { - licenseToken: process.env.XC_LICENSE_TOKEN || '684ca050-17fb-c985-fdbf-ad1ab0fcdb21', + licenseToken: process.env.XC_LICENSE_TOKEN || '', // Sequelize connection opions sequelize: { database: 'motion2', diff --git a/server/config/express.js b/server/config/express.js index d11a782..170a35c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5c609f,_0x121078){var _0x3e934d=function(_0x5d3402){while(--_0x5d3402){_0x5c609f['push'](_0x5c609f['shift']());}};_0x3e934d(++_0x121078);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 2ea5d65..0b5ea0a 100644 --- a/server/config/license/hardware.js +++ b/server/config/license/hardware.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x861e=['win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','createHash','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','update','hex','platform','licenseToken','test'];(function(_0x2b7efa,_0x5694f6){var _0x48e4c1=function(_0x241479){while(--_0x241479){_0x2b7efa['push'](_0x2b7efa['shift']());}};_0x48e4c1(++_0x5694f6);}(_0x861e,0x76));var _0xe861=function(_0x3e2e5e,_0x23f959){_0x3e2e5e=_0x3e2e5e-0x0;var _0x58740a=_0x861e[_0x3e2e5e];return _0x58740a;};'use strict';var _=require(_0xe861('0x0'));var os=require('os');var crypto=require(_0xe861('0x1'));var machine=require(_0xe861('0x2'));var exec=require(_0xe861('0x3'))[_0xe861('0x4')];var config=require(_0xe861('0x5'));function getInterfaces(){var _0x20064a=[];var _0x13f28c=os['networkInterfaces']();var _0x5b135b=_[_0xe861('0x6')](_[_0xe861('0x7')](_0x13f28c));for(var _0x299541=0x0;_0x299541<_0x5b135b[_0xe861('0x8')];_0x299541++){var _0x2db456=_0x13f28c[_0x5b135b[_0x299541]][_0xe861('0x9')](function(_0x4f1792){return _0x4f1792[_0xe861('0xa')]===_0xe861('0xb')&&_0x4f1792[_0xe861('0xc')]===![];});_0x20064a=_0x20064a[_0xe861('0xd')](_0x2db456);}return _0x20064a;}function getFirstInterface(){var _0x4632e6=_[_0xe861('0xe')](getInterfaces());return{'macAddress':_0x4632e6&&_0x4632e6[_0xe861('0xf')]?_0x4632e6[_0xe861('0xf')]:_0xe861('0x10'),'ipAddress':_0x4632e6&&_0x4632e6[_0xe861('0x11')]?_0x4632e6[_0xe861('0x11')]:_0xe861('0x12')};}exports[_0xe861('0x13')]=getFirstInterface;function getCPUhash(){var _0x60f2cd=_[_0xe861('0x6')](os[_0xe861('0x14')]()[_0xe861('0x15')](function(_0x177082){return _0x177082[_0xe861('0x16')];}))[_0xe861('0x17')](':');return crypto['createHash'](_0xe861('0x18'))[_0xe861('0x19')](_0x60f2cd)['digest'](_0xe861('0x1a'));}exports['getUuid']=function(){var _0x5339d6=os[_0xe861('0x1b')]();var _0x2291e6=/[0-9a-f-]{36}/;if(config[_0xe861('0x1c')]&&_0x2291e6[_0xe861('0x1d')](config[_0xe861('0x1c')])){return config['licenseToken'];}else if(_0x5339d6===_0xe861('0x1e')){return exec(_0xe861('0x1f'),{'encoding':_0xe861('0x20')})['replace']('\x0d\x0a','');}else{var _0x3342a4=getFirstInterface();var _0x4144ff=getCPUhash();var _0x1cede5=_0x4144ff+'|'+os[_0xe861('0x21')]()+'|'+_0x3342a4['macAddress']+'|'+_0x3342a4['ipAddress'];var _0x1a4e69=crypto[_0xe861('0x22')](_0xe861('0x18'))[_0xe861('0x19')](_0x1cede5)[_0xe861('0x23')](_0xe861('0x1a'));return _0x1a4e69['substring'](0x0,0x8)+'-'+_0x1a4e69[_0xe861('0x24')](0x8,0xc)+'-'+_0x1a4e69[_0xe861('0x24')](0xc,0x10)+'-'+_0x1a4e69['substring'](0x10,0x14)+'-'+_0x1a4e69[_0xe861('0x24')](0x14);}}; \ No newline at end of file +var _0x19ff=['execSync','../environment','networkInterfaces','orderBy','keys','length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','substring','lodash','child_process'];(function(_0x1dfa31,_0x17f917){var _0x25f2cd=function(_0x392e00){while(--_0x392e00){_0x1dfa31['push'](_0x1dfa31['shift']());}};_0x25f2cd(++_0x17f917);}(_0x19ff,0x1da));var _0xf19f=function(_0x13bfea,_0x3bb88a){_0x13bfea=_0x13bfea-0x0;var _0x579acf=_0x19ff[_0x13bfea];return _0x579acf;};'use strict';var _=require(_0xf19f('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0xf19f('0x1'))[_0xf19f('0x2')];var config=require(_0xf19f('0x3'));function getInterfaces(){var _0x5c301d=[];var _0x2e171b=os[_0xf19f('0x4')]();var _0x275f1a=_[_0xf19f('0x5')](_[_0xf19f('0x6')](_0x2e171b));for(var _0x26a749=0x0;_0x26a749<_0x275f1a[_0xf19f('0x7')];_0x26a749++){var _0x365454=_0x2e171b[_0x275f1a[_0x26a749]]['filter'](function(_0x3b3bc8){return _0x3b3bc8[_0xf19f('0x8')]===_0xf19f('0x9')&&_0x3b3bc8[_0xf19f('0xa')]===![];});_0x5c301d=_0x5c301d[_0xf19f('0xb')](_0x365454);}return _0x5c301d;}function getFirstInterface(){var _0x55efa3=_[_0xf19f('0xc')](getInterfaces());return{'macAddress':_0x55efa3&&_0x55efa3[_0xf19f('0xd')]?_0x55efa3[_0xf19f('0xd')]:_0xf19f('0xe'),'ipAddress':_0x55efa3&&_0x55efa3['address']?_0x55efa3[_0xf19f('0xf')]:'127.0.0.1'};}exports[_0xf19f('0x10')]=getFirstInterface;function getCPUhash(){var _0x3b4157=_[_0xf19f('0x5')](os[_0xf19f('0x11')]()[_0xf19f('0x12')](function(_0x370ece){return _0x370ece[_0xf19f('0x13')];}))[_0xf19f('0x14')](':');return crypto[_0xf19f('0x15')](_0xf19f('0x16'))[_0xf19f('0x17')](_0x3b4157)[_0xf19f('0x18')](_0xf19f('0x19'));}exports['getUuid']=function(){var _0x337485=os['platform']();var _0x684acf=/[0-9a-f-]{36}/;if(config[_0xf19f('0x1a')]&&_0x684acf[_0xf19f('0x1b')](config[_0xf19f('0x1a')])){return config[_0xf19f('0x1a')];}else if(_0x337485===_0xf19f('0x1c')){return exec(_0xf19f('0x1d'),{'encoding':_0xf19f('0x1e')})[_0xf19f('0x1f')]('\x0d\x0a','');}else{var _0x15f621=getFirstInterface();var _0x277b78=getCPUhash();var _0x5aeb8b=_0x277b78+'|'+os[_0xf19f('0x20')]()+'|'+_0x15f621['macAddress']+'|'+_0x15f621['ipAddress'];var _0x519000=crypto['createHash']('md5')[_0xf19f('0x17')](_0x5aeb8b)[_0xf19f('0x18')](_0xf19f('0x19'));return _0x519000[_0xf19f('0x21')](0x0,0x8)+'-'+_0x519000[_0xf19f('0x21')](0x8,0xc)+'-'+_0x519000[_0xf19f('0x21')](0xc,0x10)+'-'+_0x519000[_0xf19f('0x21')](0x10,0x14)+'-'+_0x519000[_0xf19f('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index eca6497..c77692c 100644 --- a/server/config/license/index.js +++ b/server/config/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f3d=['DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','moment','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days'];(function(_0x56321f,_0x1c41eb){var _0x5aa129=function(_0x5cab95){while(--_0x5cab95){_0x56321f['push'](_0x56321f['shift']());}};_0x5aa129(++_0x1c41eb);}(_0x6f3d,0xda));var _0xd6f3=function(_0x11a5a2,_0x1411fb){_0x11a5a2=_0x11a5a2-0x0;var _0xaf1ed0=_0x6f3d[_0x11a5a2];return _0xaf1ed0;};'use strict';var util=require(_0xd6f3('0x0'));var moment=require(_0xd6f3('0x1'));var rp=require('request-promise');var BPromise=require(_0xd6f3('0x2'));var pkginfo=require(_0xd6f3('0x3'))(module,_0xd6f3('0x4'));var db=require(_0xd6f3('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xd6f3('0x6'));var logger=require(_0xd6f3('0x7'))(_0xd6f3('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5efde7){return new BPromise(function(_0x5fc44,_0x5a0652){var _0x1cf67f=util[_0xd6f3('0x9')](_0xd6f3('0xa'),HOST,_0x5efde7,module['exports'][_0xd6f3('0x4')]);if(oldToken){_0x1cf67f=util[_0xd6f3('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x5efde7,module[_0xd6f3('0xb')][_0xd6f3('0x4')],oldToken);}var _0x734f68={'uri':_0x1cf67f,'method':_0xd6f3('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x734f68)[_0xd6f3('0xd')](function(_0x4f92ae){_0x5fc44(_0x4f92ae);})[_0xd6f3('0xe')](function(_0x3cebc0){_0x5a0652(_0x3cebc0);});});}function manageLicense(_0x5c75cb,_0x2ed8af){var _0x5f0de3=_0x2ed8af[_0xd6f3('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x5f0de3[_0xd6f3('0x10')]!==_0x5c75cb&&!_0x5f0de3[_0xd6f3('0x11')]){oldToken=_0x5f0de3['data1'];}httpRequest(_0x5c75cb)[_0xd6f3('0xd')](function(_0x1d8698){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1d8698[_0xd6f3('0x12')]){isOldTokenSent=![];if(!_0x5f0de3['license']&&_0x5f0de3[_0xd6f3('0x8')]!=_0x1d8698[_0xd6f3('0x8')]||_0x5f0de3[_0xd6f3('0x8')]&&_0x5f0de3['data2']){logger['info'](_0xd6f3('0x13'));}if(_0x5f0de3[_0xd6f3('0x8')]&&!_0x5f0de3[_0xd6f3('0x11')]&&_0x5f0de3[_0xd6f3('0x8')]!=_0x1d8698[_0xd6f3('0x8')]){logger[_0xd6f3('0x14')](_0xd6f3('0x15'));}if(_0x5f0de3[_0xd6f3('0x8')]&&!_0x5f0de3['data2']&&_0x5f0de3[_0xd6f3('0x8')]==_0x1d8698[_0xd6f3('0x8')]){return _0x2ed8af;}return _0x2ed8af[_0xd6f3('0x16')]({'data1':_0x5c75cb,'data2':null,'license':_0x1d8698[_0xd6f3('0x8')]});}else{if(_0x1d8698[_0xd6f3('0x8')]||_0x5f0de3[_0xd6f3('0x8')]){if(!_0x5f0de3['data2']){if(_0x5f0de3[_0xd6f3('0x10')]==_0x5c75cb){GRAY_PERIOD_REASON=_0xd6f3('0x17');logger[_0xd6f3('0x14')](_0xd6f3('0x18'));}else{GRAY_PERIOD_REASON=_0xd6f3('0x19');logger[_0xd6f3('0x14')](_0xd6f3('0x1a'),_0x5f0de3['data1'],_0x5c75cb);}logger[_0xd6f3('0x14')](_0xd6f3('0x1b'),GRAY_PERIOD_REASON[_0xd6f3('0x1c')](),moment()[_0xd6f3('0x9')](_0xd6f3('0x1d')));return _0x2ed8af[_0xd6f3('0x16')]({'data2':encryptor[_0xd6f3('0x1e')](moment()[_0xd6f3('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xd6f3('0x1f')](encryptor[_0xd6f3('0x20')](_0x5f0de3[_0xd6f3('0x11')]),_0xd6f3('0x21'))>DAYS){logger[_0xd6f3('0x14')](_0xd6f3('0x22'),moment()['format'](_0xd6f3('0x1d')));isOldTokenSent=![];return _0x2ed8af[_0xd6f3('0x16')]({'data1':_0x5c75cb,'data2':null,'license':null});}}}else{if(_0x5f0de3[_0xd6f3('0x10')]!=_0x5c75cb){logger[_0xd6f3('0x14')](_0xd6f3('0x1a'),_0x5f0de3[_0xd6f3('0x10')],_0x5c75cb);return _0x2ed8af[_0xd6f3('0x16')]({'data1':_0x5c75cb,'data2':null,'license':null});}}}return _0x2ed8af;})[_0xd6f3('0xd')](function(_0x536e80){_0x2ed8af=_0x536e80;})[_0xd6f3('0xe')](function(_0x1ff226){logger['error'](_0x1ff226[_0xd6f3('0x23')]);})[_0xd6f3('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xd6f3('0x25')](),_0x2ed8af);},TIME);});}function defaultLicense(){var _0x100021=hardware[_0xd6f3('0x25')]();if(_0x100021){return db[_0xd6f3('0x26')][_0xd6f3('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x100021}})['spread'](function(_0x65f19b,_0x5efbc7){logger[_0xd6f3('0x14')](_0xd6f3('0x28'),_0x100021);manageLicense(_0x100021,_0x65f19b);})[_0xd6f3('0xe')](function(_0x59ad2a){logger[_0xd6f3('0x29')](_0x59ad2a[_0xd6f3('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xe904=['../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','License','findOrCreate','spread','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor'];(function(_0x2e20fb,_0x5b5c93){var _0x5e445a=function(_0x425bb3){while(--_0x425bb3){_0x2e20fb['push'](_0x2e20fb['shift']());}};_0x5e445a(++_0x5b5c93);}(_0xe904,0x16a));var _0x4e90=function(_0x2da296,_0x25d15a){_0x2da296=_0x2da296-0x0;var _0x29672f=_0xe904[_0x2da296];return _0x29672f;};'use strict';var util=require(_0x4e90('0x0'));var moment=require(_0x4e90('0x1'));var rp=require(_0x4e90('0x2'));var BPromise=require(_0x4e90('0x3'));var pkginfo=require(_0x4e90('0x4'))(module,_0x4e90('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x4e90('0x6'));var hardware=require('./hardware');var logger=require(_0x4e90('0x7'))(_0x4e90('0x8'));var HOST=_0x4e90('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x16225e){return new BPromise(function(_0x594868,_0x49ea85){var _0x2ba5aa=util[_0x4e90('0xa')](_0x4e90('0xb'),HOST,_0x16225e,module[_0x4e90('0xc')][_0x4e90('0x5')]);if(oldToken){_0x2ba5aa=util['format'](_0x4e90('0xd'),HOST,_0x16225e,module[_0x4e90('0xc')][_0x4e90('0x5')],oldToken);}var _0x3bf8fc={'uri':_0x2ba5aa,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3bf8fc)['then'](function(_0xd11114){_0x594868(_0xd11114);})['catch'](function(_0x171301){_0x49ea85(_0x171301);});});}function manageLicense(_0x5994f9,_0x114960){var _0x289d40=_0x114960['get']({'plain':!![]});if(!isOldTokenSent&&_0x289d40[_0x4e90('0xe')]!==_0x5994f9&&!_0x289d40[_0x4e90('0xf')]){oldToken=_0x289d40[_0x4e90('0xe')];}httpRequest(_0x5994f9)[_0x4e90('0x10')](function(_0x5ced15){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5ced15[_0x4e90('0x11')]){isOldTokenSent=![];if(!_0x289d40['license']&&_0x289d40[_0x4e90('0x8')]!=_0x5ced15[_0x4e90('0x8')]||_0x289d40['license']&&_0x289d40['data2']){logger[_0x4e90('0x12')](_0x4e90('0x13'));}if(_0x289d40[_0x4e90('0x8')]&&!_0x289d40['data2']&&_0x289d40['license']!=_0x5ced15[_0x4e90('0x8')]){logger[_0x4e90('0x12')](_0x4e90('0x14'));}if(_0x289d40[_0x4e90('0x8')]&&!_0x289d40[_0x4e90('0xf')]&&_0x289d40[_0x4e90('0x8')]==_0x5ced15[_0x4e90('0x8')]){return _0x114960;}return _0x114960[_0x4e90('0x15')]({'data1':_0x5994f9,'data2':null,'license':_0x5ced15[_0x4e90('0x8')]});}else{if(_0x5ced15[_0x4e90('0x8')]||_0x289d40[_0x4e90('0x8')]){if(!_0x289d40['data2']){if(_0x289d40['data1']==_0x5994f9){GRAY_PERIOD_REASON=_0x4e90('0x16');logger['info'](_0x4e90('0x17'));}else{GRAY_PERIOD_REASON=_0x4e90('0x18');logger[_0x4e90('0x12')](_0x4e90('0x19'),_0x289d40[_0x4e90('0xe')],_0x5994f9);}logger[_0x4e90('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x4e90('0x1a')](),moment()[_0x4e90('0xa')](_0x4e90('0x1b')));return _0x114960['update']({'data2':encryptor[_0x4e90('0x1c')](moment()[_0x4e90('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x4e90('0x1d')](encryptor['decryptString'](_0x289d40[_0x4e90('0xf')]),_0x4e90('0x1e'))>DAYS){logger[_0x4e90('0x12')](_0x4e90('0x1f'),moment()[_0x4e90('0xa')](_0x4e90('0x1b')));isOldTokenSent=![];return _0x114960[_0x4e90('0x15')]({'data1':_0x5994f9,'data2':null,'license':null});}}}else{if(_0x289d40['data1']!=_0x5994f9){logger['info'](_0x4e90('0x19'),_0x289d40[_0x4e90('0xe')],_0x5994f9);return _0x114960[_0x4e90('0x15')]({'data1':_0x5994f9,'data2':null,'license':null});}}}return _0x114960;})['then'](function(_0x52a3b1){_0x114960=_0x52a3b1;})[_0x4e90('0x20')](function(_0x537c66){logger[_0x4e90('0x21')](_0x537c66['message']);})[_0x4e90('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x4e90('0x23')](),_0x114960);},TIME);});}function defaultLicense(){var _0xc520dd=hardware['getUuid']();if(_0xc520dd){return db[_0x4e90('0x24')][_0x4e90('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0xc520dd}})[_0x4e90('0x26')](function(_0x121413,_0x5d5178){logger[_0x4e90('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0xc520dd);manageLicense(_0xc520dd,_0x121413);})[_0x4e90('0x20')](function(_0x147c32){logger['error'](_0x147c32[_0x4e90('0x27')]);});}}exports[_0x4e90('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index aaaea82..27d83e9 100644 --- a/server/config/license/util.js +++ b/server/config/license/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4780=['find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','col','user','telephone','users','telephones','admin','count','pick','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License'];(function(_0x11a514,_0x456822){var _0x5f19d4=function(_0x2f778){while(--_0x2f778){_0x11a514['push'](_0x11a514['shift']());}};_0x5f19d4(++_0x456822);}(_0x4780,0x11b));var _0x0478=function(_0x486015,_0x5b5ab0){_0x486015=_0x486015-0x0;var _0x4ad3e8=_0x4780[_0x486015];return _0x4ad3e8;};'use strict';var util=require(_0x0478('0x0'));var _=require(_0x0478('0x1'));var moment=require(_0x0478('0x2'));var BPromise=require(_0x0478('0x3'));var hardware=require(_0x0478('0x4'));var encryptor=require(_0x0478('0x5'));var db=require(_0x0478('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0478('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x0478('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0478('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0478('0x9'),'machineUuid':hardware[_0x0478('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4c1fb5){return new BPromise(function(_0x5033d9,_0x25e602){return db[_0x0478('0xa')][_0x0478('0xb')](_[_0x0478('0xc')](_0x4c1fb5,{'raw':!![],'where':{'id':0x1}}))[_0x0478('0xd')](function(_0xfac65d){return checkLicense(_0xfac65d,null);})[_0x0478('0xd')](function(_0x27b044){_0x5033d9(_0x27b044);return;})[_0x0478('0xe')](function(_0x35fe87){_0x25e602(_0x35fe87);});});}function checkLicense(_0x268da0,_0x4a56ef){if(!_0x268da0){demoLicense[_0x0478('0xf')]=_0x268da0[_0x0478('0x10')];return demoLicense;}try{var _0x5a23ea=_0x4a56ef||_0x268da0[_0x0478('0x11')];if(_[_0x0478('0x12')](_0x5a23ea)){throw new Error(_0x0478('0x13'));}var _0xfde5e8=_0x268da0['data1'];var _0x2386d0=_0x268da0[_0x0478('0x14')];var _0x2ad0ba=_0xfde5e8['split']('-')[0x4];var _0x426e2b=_0xfde5e8[_0x0478('0x15')]('-')[0x0];var _0x57c84b=encryptor[_0x0478('0x16')](_0x5a23ea,util[_0x0478('0x17')](_0x0478('0x18'),_0x2ad0ba,_0xfde5e8,_0x426e2b));var _0x2dc91c=JSON[_0x0478('0x19')](_0x57c84b);_0x2dc91c['demo']=![];_0x2dc91c[_0x0478('0xf')]=_0xfde5e8;_0x2dc91c[_0x0478('0x1a')]=hardware[_0x0478('0x8')]();if(_0x2386d0){var _0x431b7c=encryptor['decryptString'](_0x2386d0);_0x2dc91c[_0x0478('0x1b')]=_0x431b7c;_0x2dc91c[_0x0478('0x1c')]=moment(_0x431b7c)[_0x0478('0x1d')](0x7,_0x0478('0x1e'))[_0x0478('0x17')]();_0x2dc91c[_0x0478('0x1f')]=_0x2dc91c[_0x0478('0xf')]!=_0x2dc91c['machineUuid']?_0x0478('0x20'):_0x0478('0x21');}return _0x2dc91c;}catch(_0x2c7ac5){breakingLicense['uuid']=_0x268da0[_0x0478('0x10')];breakingLicense[_0x0478('0x22')]=_0x2c7ac5[_0x0478('0x22')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x36af3d,_0x2f0d09){getLicense()[_0x0478('0xd')](function(_0x288dc9){return db[_0x0478('0x23')][_0x0478('0x24')]({'attributes':[_0x0478('0x25'),[db[_0x0478('0x26')]['fn']('COUNT',db[_0x0478('0x26')][_0x0478('0x27')]('role')),'count']],'group':'role','where':{'role':{'$or':['admin',_0x0478('0x28'),_0x0478('0x29')]}},'raw':!![]})[_0x0478('0xd')](function(_0x24663d){var _0x1f6017={'user':_0x288dc9[_0x0478('0x2a')]||0x0,'telephone':_0x288dc9[_0x0478('0x2b')]||0x0};_0x24663d['forEach'](function(_0x17e4eb){var _0x5459d2=_0x17e4eb[_0x0478('0x25')]===_0x0478('0x2c')?_0x0478('0x28'):_0x17e4eb[_0x0478('0x25')];_0x1f6017[_0x5459d2]-=_0x17e4eb[_0x0478('0x2d')];if(_0x1f6017[_0x5459d2]<0x0)_0x1f6017[_0x5459d2]=0x0;});_0x36af3d(_0x1f6017);return;});})[_0x0478('0xe')](function(_0x555ddc){_0x2f0d09(_0x555ddc);});});}function checkUserLimits(_0x5db536){return new BPromise(function(_0x16ec52,_0x2d6bb9){getLimits()[_0x0478('0xd')](function(_0x200b17){var _0x3a7777=_[_0x0478('0x2e')](_['countBy'](_0x5db536,_0x0478('0x25')),[_0x0478('0x2c'),_0x0478('0x28'),_0x0478('0x29')]);var _0x59813c=(_0x3a7777[_0x0478('0x2c')]||0x0)+(_0x3a7777[_0x0478('0x28')]||0x0);var _0x40e339=_0x3a7777[_0x0478('0x29')]||0x0;if(_0x59813c>_0x200b17[_0x0478('0x28')])return _0x2d6bb9(_0x0478('0x2f'));if(_0x40e339>_0x200b17['telephone'])return _0x2d6bb9('License\x20limit\x20reached\x20for\x20telephones');return _0x16ec52();})[_0x0478('0xe')](function(_0x42d05a){_0x2d6bb9(_0x42d05a);});});}module[_0x0478('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x08b3=['lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','catch','countBy','License\x20limit\x20reached\x20for\x20telephones','exports'];(function(_0x4fd13f,_0x5ddf69){var _0xe0d575=function(_0x58305c){while(--_0x58305c){_0x4fd13f['push'](_0x4fd13f['shift']());}};_0xe0d575(++_0x5ddf69);}(_0x08b3,0x157));var _0x308b=function(_0x364eba,_0x4a1596){_0x364eba=_0x364eba-0x0;var _0x3109e2=_0x08b3[_0x364eba];return _0x3109e2;};'use strict';var util=require('util');var _=require(_0x308b('0x0'));var moment=require(_0x308b('0x1'));var BPromise=require(_0x308b('0x2'));var hardware=require(_0x308b('0x3'));var encryptor=require(_0x308b('0x4'));var db=require(_0x308b('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x308b('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x308b('0x7'),'machineUuid':hardware[_0x308b('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x308b('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x7fded6){return new BPromise(function(_0x2b7e98,_0x65c1ae){return db[_0x308b('0xa')][_0x308b('0xb')](_[_0x308b('0xc')](_0x7fded6,{'raw':!![],'where':{'id':0x1}}))[_0x308b('0xd')](function(_0x26963e){return checkLicense(_0x26963e,null);})[_0x308b('0xd')](function(_0xae5eeb){_0x2b7e98(_0xae5eeb);return;})['catch'](function(_0x2208ed){_0x65c1ae(_0x2208ed);});});}function checkLicense(_0x4a70e8,_0x398e18){if(!_0x4a70e8){demoLicense['uuid']=_0x4a70e8[_0x308b('0xe')];return demoLicense;}try{var _0x2fbb0d=_0x398e18||_0x4a70e8[_0x308b('0xf')];if(_[_0x308b('0x10')](_0x2fbb0d)){throw new Error(_0x308b('0x11'));}var _0x30790f=_0x4a70e8[_0x308b('0xe')];var _0x4129ba=_0x4a70e8[_0x308b('0x12')];var _0x30a600=_0x30790f[_0x308b('0x13')]('-')[0x4];var _0x4116a0=_0x30790f[_0x308b('0x13')]('-')[0x0];var _0x5b6943=encryptor[_0x308b('0x14')](_0x2fbb0d,util[_0x308b('0x15')]('%s:%s:%s',_0x30a600,_0x30790f,_0x4116a0));var _0x39d2b8=JSON[_0x308b('0x16')](_0x5b6943);_0x39d2b8[_0x308b('0x17')]=![];_0x39d2b8['uuid']=_0x30790f;_0x39d2b8['machineUuid']=hardware['getUuid']();if(_0x4129ba){var _0x2be58b=encryptor['decryptString'](_0x4129ba);_0x39d2b8[_0x308b('0x18')]=_0x2be58b;_0x39d2b8[_0x308b('0x19')]=moment(_0x2be58b)[_0x308b('0x1a')](0x7,_0x308b('0x1b'))['format']();_0x39d2b8[_0x308b('0x1c')]=_0x39d2b8['uuid']!=_0x39d2b8[_0x308b('0x1d')]?_0x308b('0x1e'):_0x308b('0x1f');}return _0x39d2b8;}catch(_0x5301c0){breakingLicense['uuid']=_0x4a70e8[_0x308b('0xe')];breakingLicense[_0x308b('0x20')]=_0x5301c0[_0x308b('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1258e7,_0x170fa3){getLicense()[_0x308b('0xd')](function(_0x3371e6){return db[_0x308b('0x21')][_0x308b('0x22')]({'attributes':[_0x308b('0x23'),[db[_0x308b('0x24')]['fn'](_0x308b('0x25'),db[_0x308b('0x24')][_0x308b('0x26')]('role')),_0x308b('0x27')]],'group':_0x308b('0x23'),'where':{'role':{'$or':[_0x308b('0x28'),_0x308b('0x29'),_0x308b('0x2a')]}},'raw':!![]})[_0x308b('0xd')](function(_0x520247){var _0x55fc41={'user':_0x3371e6[_0x308b('0x2b')]||0x0,'telephone':_0x3371e6[_0x308b('0x2c')]||0x0};_0x520247['forEach'](function(_0xf09754){var _0x16c1e8=_0xf09754[_0x308b('0x23')]===_0x308b('0x28')?_0x308b('0x29'):_0xf09754[_0x308b('0x23')];_0x55fc41[_0x16c1e8]-=_0xf09754[_0x308b('0x27')];if(_0x55fc41[_0x16c1e8]<0x0)_0x55fc41[_0x16c1e8]=0x0;});_0x1258e7(_0x55fc41);return;});})[_0x308b('0x2d')](function(_0x48fee){_0x170fa3(_0x48fee);});});}function checkUserLimits(_0x3ea4ec){return new BPromise(function(_0x597f44,_0x31e7e8){getLimits()[_0x308b('0xd')](function(_0x91a5e4){var _0x569b37=_['pick'](_[_0x308b('0x2e')](_0x3ea4ec,_0x308b('0x23')),[_0x308b('0x28'),_0x308b('0x29'),_0x308b('0x2a')]);var _0x5ce5ce=(_0x569b37[_0x308b('0x28')]||0x0)+(_0x569b37[_0x308b('0x29')]||0x0);var _0x3e6cbb=_0x569b37[_0x308b('0x2a')]||0x0;if(_0x5ce5ce>_0x91a5e4[_0x308b('0x29')])return _0x31e7e8('License\x20limit\x20reached\x20for\x20users');if(_0x3e6cbb>_0x91a5e4['telephone'])return _0x31e7e8(_0x308b('0x2f'));return _0x597f44();})[_0x308b('0x2d')](function(_0x3a9e19){_0x31e7e8(_0x3a9e19);});});}module[_0x308b('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 7d1d93e..f3b5754 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe511=['app-id','exports','http://localhost:9000'];(function(_0x37fb3a,_0x5a14ee){var _0x1e5c8f=function(_0x4e79d1){while(--_0x4e79d1){_0x37fb3a['push'](_0x37fb3a['shift']());}};_0x1e5c8f(++_0x5a14ee);}(_0xe511,0x16f));var _0x1e51=function(_0x1d0e5e,_0x596f00){_0x1d0e5e=_0x1d0e5e-0x0;var _0x3ba445=_0xe511[_0x1d0e5e];return _0x3ba445;};'use strict';module[_0x1e51('0x0')]={'DOMAIN':_0x1e51('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x1e51('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x8952=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8952,0x17e));var _0x2895=function(_0x419b0b,_0x68d5f1){_0x419b0b=_0x419b0b-0x0;var _0x377db6=_0x8952[_0x419b0b];return _0x377db6;};'use strict';module['exports']={'DOMAIN':_0x2895('0x0'),'SESSION_SECRET':_0x2895('0x1'),'GOOGLE_ID':_0x2895('0x2'),'GOOGLE_SECRET':_0x2895('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1a4f706..1233be2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fbc=['exports','../utils/loggers','fileLogger'];(function(_0x4d3ef3,_0x3c5837){var _0x589136=function(_0x6f7a2e){while(--_0x6f7a2e){_0x4d3ef3['push'](_0x4d3ef3['shift']());}};_0x589136(++_0x3c5837);}(_0x8fbc,0xcd));var _0xc8fb=function(_0xf0b067,_0x38839f){_0xf0b067=_0xf0b067-0x0;var _0x38bf5b=_0x8fbc[_0xf0b067];return _0x38bf5b;};'use strict';var fileLogger=require(_0xc8fb('0x0'))[_0xc8fb('0x1')];module[_0xc8fb('0x2')]=fileLogger; \ No newline at end of file +var _0xb637=['fileLogger'];(function(_0x312598,_0x54323d){var _0xa0d03e=function(_0x58474c){while(--_0x58474c){_0x312598['push'](_0x312598['shift']());}};_0xa0d03e(++_0x54323d);}(_0xb637,0xee));var _0x7b63=function(_0x3eb8d5,_0x32fa2b){_0x3eb8d5=_0x3eb8d5-0x0;var _0x4ea72c=_0xb637[_0x3eb8d5];return _0x4ea72c;};'use strict';var fileLogger=require('../utils/loggers')[_0x7b63('0x0')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c994382..9de72e9 100644 --- a/server/config/pm2/config.js +++ b/server/config/pm2/config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84b2=['root','legacy-libs','join','ami','../../services/ami/index.js','agi','email','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment'];(function(_0x2831be,_0x2f3cab){var _0x29a6d7=function(_0x2e0612){while(--_0x2e0612){_0x2831be['push'](_0x2831be['shift']());}};_0x29a6d7(++_0x2f3cab);}(_0x84b2,0x172));var _0x284b=function(_0x3c65d9,_0x15266f){_0x3c65d9=_0x3c65d9-0x0;var _0x2e86a8=_0x84b2[_0x3c65d9];return _0x2e86a8;};'use strict';var path=require(_0x284b('0x0'));var cfg=require(_0x284b('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0x284b('0x2')],_0x284b('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0x284b('0x4')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x284b('0x5'),'script':path[_0x284b('0x4')](__dirname,_0x284b('0x6')),'env':env},{'name':_0x284b('0x7'),'script':path[_0x284b('0x4')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x284b('0x8'),'script':path[_0x284b('0x4')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x284b('0x4')](__dirname,_0x284b('0x9')),'env':env},{'name':_0x284b('0xa'),'script':path[_0x284b('0x4')](__dirname,_0x284b('0xb')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x6034=['join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','exports','resolve','root','legacy-libs','express'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x6034,0x13e));var _0x4603=function(_0x15fa2b,_0x1044c9){_0x15fa2b=_0x15fa2b-0x0;var _0x5e6268=_0x6034[_0x15fa2b];return _0x5e6268;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x4603('0x0')](path['join'](cfg[_0x4603('0x1')],_0x4603('0x2')))};var pm2config={'apps':[{'name':_0x4603('0x3'),'script':path[_0x4603('0x4')](__dirname,_0x4603('0x5')),'env':env},{'name':_0x4603('0x6'),'script':path[_0x4603('0x4')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x4603('0x7'),'script':path[_0x4603('0x4')](__dirname,_0x4603('0x8')),'env':env},{'name':_0x4603('0x9'),'script':path['join'](__dirname,_0x4603('0xa')),'env':env},{'name':'routing','script':path[_0x4603('0x4')](__dirname,_0x4603('0xb')),'env':env},{'name':_0x4603('0xc'),'script':path[_0x4603('0x4')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x4603('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 589c5f0..9e0778a 100644 --- a/server/config/pm2/index.js +++ b/server/config/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90b5=['bluebird','./config','connect','connected','then','start','disconnect','stop','restart','list','describe','delete','pm2'];(function(_0x2e77c9,_0xeae80e){var _0x4ef5d4=function(_0x564898){while(--_0x564898){_0x2e77c9['push'](_0x2e77c9['shift']());}};_0x4ef5d4(++_0xeae80e);}(_0x90b5,0x11d));var _0x590b=function(_0x511058,_0x289636){_0x511058=_0x511058-0x0;var _0x472041=_0x90b5[_0x511058];return _0x472041;};'use strict';var pm2=require(_0x590b('0x0'));var BPromise=require(_0x590b('0x1'));var config=require(_0x590b('0x2'));function connect(){return new BPromise(function(_0x3e037e,_0x4915cd){return pm2[_0x590b('0x3')](function(_0x11534c){if(_0x11534c){return _0x4915cd(_0x11534c);}return _0x3e037e(_0x590b('0x4'));});});};exports['start']=function(_0x5191ae){return connect()[_0x590b('0x5')](function(){return new BPromise(function(_0x562560,_0x291ca6){return pm2[_0x590b('0x6')](_0x5191ae,function(_0x4ce901,_0x243121){if(_0x4ce901){return _0x291ca6(_0x4ce901);}pm2[_0x590b('0x7')]();return _0x562560(_0x243121);});});});};exports[_0x590b('0x8')]=function(_0x47d408){return connect()[_0x590b('0x5')](function(){return new BPromise(function(_0x2736b1,_0x249016){return pm2[_0x590b('0x8')](_0x47d408,function(_0x40c9da,_0x249f28){if(_0x40c9da){return _0x249016(_0x40c9da);}pm2['disconnect']();return _0x2736b1(_0x249f28);});});});};exports[_0x590b('0x9')]=function(_0x185ab6){return connect()[_0x590b('0x5')](function(){return new BPromise(function(_0x141302,_0x31a27d){return pm2[_0x590b('0x9')](_0x185ab6,function(_0x81d0e7,_0x2cb6b8){if(_0x81d0e7){return _0x31a27d(_0x81d0e7);}pm2[_0x590b('0x7')]();return _0x141302(_0x2cb6b8);});});});};exports['list']=function(){return connect()[_0x590b('0x5')](function(){return new BPromise(function(_0x1b69f8,_0x364c25){return pm2[_0x590b('0xa')](function(_0x25c699,_0x5d9e56){if(_0x25c699){return _0x364c25(_0x25c699);}pm2['disconnect']();return _0x1b69f8(_0x5d9e56);});});});};exports[_0x590b('0xb')]=function(_0x121101){return connect()['then'](function(){return new BPromise(function(_0x5074f4,_0x4ff978){return pm2[_0x590b('0xb')](_0x121101,function(_0x5055bb,_0x3e6dc8){if(_0x5055bb){return _0x4ff978(_0x5055bb);}pm2[_0x590b('0x7')]();return _0x5074f4(_0x3e6dc8);});});});};exports[_0x590b('0xc')]=function(_0x4c0c84){return connect()[_0x590b('0x5')](function(){return new BPromise(function(_0xda54b9,_0x238634){return pm2[_0x590b('0xc')](_0x4c0c84,function(_0x317e17,_0x4efb31){if(_0x317e17){return _0x238634(_0x317e17);}pm2[_0x590b('0x7')]();return _0xda54b9(_0x4efb31);});});});};exports['dump']=function(){return connect()[_0x590b('0x5')](function(){return new BPromise(function(_0x46d97d,_0x506e32){return pm2['dump'](function(_0x38b9cf){if(_0x38b9cf){return _0x506e32(_0x38b9cf);}return _0x46d97d('saved');});});});}; \ No newline at end of file +var _0x6378=['./config','connect','then','stop','disconnect','restart','list','describe','delete','dump','saved','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6378,0x83));var _0x8637=function(_0x531662,_0x5d78fc){_0x531662=_0x531662-0x0;var _0x2bb218=_0x6378[_0x531662];return _0x2bb218;};'use strict';var pm2=require('pm2');var BPromise=require(_0x8637('0x0'));var config=require(_0x8637('0x1'));function connect(){return new BPromise(function(_0x3ab8c3,_0x39a116){return pm2[_0x8637('0x2')](function(_0x456c95){if(_0x456c95){return _0x39a116(_0x456c95);}return _0x3ab8c3('connected');});});};exports['start']=function(_0x758cbc){return connect()[_0x8637('0x3')](function(){return new BPromise(function(_0x214926,_0x5ada57){return pm2['start'](_0x758cbc,function(_0x4c8e6d,_0x4e308a){if(_0x4c8e6d){return _0x5ada57(_0x4c8e6d);}pm2['disconnect']();return _0x214926(_0x4e308a);});});});};exports[_0x8637('0x4')]=function(_0x27771d){return connect()['then'](function(){return new BPromise(function(_0x310eef,_0x22671a){return pm2[_0x8637('0x4')](_0x27771d,function(_0x5693a7,_0x317051){if(_0x5693a7){return _0x22671a(_0x5693a7);}pm2[_0x8637('0x5')]();return _0x310eef(_0x317051);});});});};exports[_0x8637('0x6')]=function(_0x396b6d){return connect()[_0x8637('0x3')](function(){return new BPromise(function(_0x3680d5,_0x196d52){return pm2['restart'](_0x396b6d,function(_0x41c387,_0x528186){if(_0x41c387){return _0x196d52(_0x41c387);}pm2['disconnect']();return _0x3680d5(_0x528186);});});});};exports[_0x8637('0x7')]=function(){return connect()[_0x8637('0x3')](function(){return new BPromise(function(_0x300ac8,_0x59433f){return pm2[_0x8637('0x7')](function(_0x45220f,_0x5e1c51){if(_0x45220f){return _0x59433f(_0x45220f);}pm2[_0x8637('0x5')]();return _0x300ac8(_0x5e1c51);});});});};exports[_0x8637('0x8')]=function(_0x139034){return connect()['then'](function(){return new BPromise(function(_0x2a81b6,_0x324969){return pm2[_0x8637('0x8')](_0x139034,function(_0x222f98,_0x35c08d){if(_0x222f98){return _0x324969(_0x222f98);}pm2['disconnect']();return _0x2a81b6(_0x35c08d);});});});};exports[_0x8637('0x9')]=function(_0x42b406){return connect()['then'](function(){return new BPromise(function(_0x249d2b,_0x28c457){return pm2[_0x8637('0x9')](_0x42b406,function(_0xfe30d2,_0x214bf6){if(_0xfe30d2){return _0x28c457(_0xfe30d2);}pm2[_0x8637('0x5')]();return _0x249d2b(_0x214bf6);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0xa58655,_0x410d6c){return pm2[_0x8637('0xa')](function(_0x40927a){if(_0x40927a){return _0x410d6c(_0x40927a);}return _0xa58655(_0x8637('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a0c688e..66b566d 100644 --- a/server/config/schedule/chat.js +++ b/server/config/schedule/chat.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe513=['minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xe513,0x15a));var _0x3e51=function(_0x1637f9,_0x4e6c78){_0x1637f9=_0x1637f9-0x0;var _0x14d721=_0xe513[_0x1637f9];return _0x14d721;};'use strict';var _=require(_0x3e51('0x0'));var moment=require('moment');var Redis=require(_0x3e51('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x3e51('0x2'))['db'];var logger=require(_0x3e51('0x3'))(_0x3e51('0x4'));config[_0x3e51('0x5')]=_['defaults'](config[_0x3e51('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3e51('0x6'))(new Redis(config[_0x3e51('0x5')]));function closeInteractions(){var _0x264677=0x0;var _0x344f1b=[];return db[_0x3e51('0x7')][_0x3e51('0x8')]({'raw':!![],'attributes':['id',_0x3e51('0x9')],'where':{'id':0x1}})[_0x3e51('0xa')](function(_0x426edb){_0x264677=_0x426edb[_0x3e51('0x9')];if(_0x264677){return db[_0x3e51('0xb')][_0x3e51('0xc')]({'raw':!![],'attributes':['id',_0x3e51('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x426edb['chatTimeout'],_0x3e51('0xe'))}}});}else{return[];}})[_0x3e51('0xa')](function(_0x5bd7dd){if(_0x5bd7dd&&_0x5bd7dd[_0x3e51('0xf')]){_0x344f1b=_[_0x3e51('0x10')](_0x5bd7dd||[],'id');logger[_0x3e51('0x11')](_0x3e51('0x12'),_0x344f1b[_0x3e51('0x13')]());return db[_0x3e51('0xb')][_0x3e51('0x14')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x3e51('0x15'))},{'where':{'id':_0x344f1b}});}})[_0x3e51('0xa')](function(){if(_0x344f1b&&_0x344f1b['length']){logger[_0x3e51('0x11')](_0x3e51('0x16'),_0x344f1b[_0x3e51('0x13')]());for(var _0x4a4767=0x0;_0x4a4767<_0x344f1b['length'];_0x4a4767++){io[_0x3e51('0x17')](_0x3e51('0x18'),{'id':_0x344f1b[_0x4a4767],'closed':!![]});}}})[_0x3e51('0x19')](function(_0x1ba011){logger[_0x3e51('0x1a')](_0x3e51('0x1b'),_0x1ba011?util[_0x3e51('0x1c')](_0x1ba011,{'showHidden':![],'depth':null}):'');});}exports[_0x3e51('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc888=['info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','map','join','update','system','timeout','format','length'];(function(_0x392890,_0xb8d3dd){var _0x2b2e30=function(_0x4b355f){while(--_0x4b355f){_0x392890['push'](_0x392890['shift']());}};_0x2b2e30(++_0xb8d3dd);}(_0xc888,0x1a0));var _0x8c88=function(_0x3727ae,_0x165f88){_0x3727ae=_0x3727ae-0x0;var _0x1c3f01=_0xc888[_0x3727ae];return _0x1c3f01;};'use strict';var _=require('lodash');var moment=require(_0x8c88('0x0'));var Redis=require(_0x8c88('0x1'));var util=require(_0x8c88('0x2'));var config=require(_0x8c88('0x3'));var db=require(_0x8c88('0x4'))['db'];var logger=require(_0x8c88('0x5'))(_0x8c88('0x6'));config[_0x8c88('0x7')]=_[_0x8c88('0x8')](config['redis'],{'host':_0x8c88('0x9'),'port':0x18eb});var io=require(_0x8c88('0xa'))(new Redis(config[_0x8c88('0x7')]));function closeInteractions(){var _0x5a8075=0x0;var _0x401903=[];return db[_0x8c88('0xb')][_0x8c88('0xc')]({'raw':!![],'attributes':['id',_0x8c88('0xd')],'where':{'id':0x1}})[_0x8c88('0xe')](function(_0x5c7251){_0x5a8075=_0x5c7251[_0x8c88('0xd')];if(_0x5a8075){return db[_0x8c88('0xf')][_0x8c88('0x10')]({'raw':!![],'attributes':['id',_0x8c88('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5c7251[_0x8c88('0xd')],_0x8c88('0x12'))}}});}else{return[];}})[_0x8c88('0xe')](function(_0x4d61ad){if(_0x4d61ad&&_0x4d61ad['length']){_0x401903=_[_0x8c88('0x13')](_0x4d61ad||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x401903[_0x8c88('0x14')]());return db[_0x8c88('0xf')][_0x8c88('0x15')]({'closeReason':_0x8c88('0x16'),'disposition':_0x8c88('0x17'),'closed':!![],'closedAt':moment()[_0x8c88('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x401903}});}})['then'](function(){if(_0x401903&&_0x401903[_0x8c88('0x19')]){logger[_0x8c88('0x1a')](_0x8c88('0x1b'),_0x401903[_0x8c88('0x14')]());for(var _0x45e941=0x0;_0x45e941<_0x401903[_0x8c88('0x19')];_0x45e941++){io['emit'](_0x8c88('0x1c'),{'id':_0x401903[_0x45e941],'closed':!![]});}}})[_0x8c88('0x1d')](function(_0x299e72){logger[_0x8c88('0x1e')](_0x8c88('0x1f'),_0x299e72?util[_0x8c88('0x20')](_0x299e72,{'showHidden':![],'depth':null}):'');});}exports[_0x8c88('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 2d02814..88f8b91 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c71=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x30b48c,_0x39f350){var _0x5a8b83=function(_0x4e8ac3){while(--_0x4e8ac3){_0x30b48c['push'](_0x30b48c['shift']());}};_0x5a8b83(++_0x39f350);}(_0x5c71,0x73));var _0x15c7=function(_0x2e5a3f,_0x165893){_0x2e5a3f=_0x2e5a3f-0x0;var _0x10b64e=_0x5c71[_0x2e5a3f];return _0x10b64e;};'use strict';function start(){var _0x595e4e=require(_0x15c7('0x0'));return _0x595e4e[_0x15c7('0x1')]();}module[_0x15c7('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x237c=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x237c,0x1bb));var _0xc237=function(_0x4f70f7,_0x4897b6){_0x4f70f7=_0x4f70f7-0x0;var _0x23bafb=_0x237c[_0x4f70f7];return _0x23bafb;};'use strict';function start(){var _0x4aa9b8=require(_0xc237('0x0'));return _0x4aa9b8[_0xc237('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 6c76366..cb0629d 100644 --- a/server/config/schedule/index.js +++ b/server/config/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x002c=['bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','basename','existsSync','status','Sent','message','text','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','data','isNil','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','Schedule','MailServerOut','CloudProvider','keys','toString','keyBy','difference','intersection','exists','stop','deleteJob','toRun','length','index','my\x20id','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','stop\x20cron','endAt','update\x20cron','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','Smtp','user'];(function(_0x1cabe5,_0x16524b){var _0x28d6de=function(_0x853899){while(--_0x853899){_0x1cabe5['push'](_0x1cabe5['shift']());}};_0x28d6de(++_0x16524b);}(_0x002c,0x1d8));var _0xc002=function(_0x52b830,_0x2cc183){_0x52b830=_0x52b830-0x0;var _0x40eef6=_0x002c[_0x52b830];return _0x40eef6;};'use strict';var fs=require('fs');var util=require(_0xc002('0x0'));var path=require(_0xc002('0x1'));var _=require('lodash');var moment=require(_0xc002('0x2'));var CronJobManager=require(_0xc002('0x3'));var jayson=require(_0xc002('0x4'));var BPromise=require(_0xc002('0x5'));var logger=require(_0xc002('0x6'))(_0xc002('0x7'));var db=require(_0xc002('0x8'))['db'];var analyticCustomReportController=require(_0xc002('0x9'));var analyticDefaultReportController=require(_0xc002('0xa'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x147ee2,_0x3512f0){return function(){logger[_0xc002('0xb')](_0xc002('0xc'),_0x147ee2[_0xc002('0xd')]);var _0x2ecadb=!![];var _0x4d4e19=_0x147ee2['MailAccount'][_0xc002('0xe')]();var _0x3c0eed={'account':_0x4d4e19,'message':{'from':util[_0xc002('0xf')](_0xc002('0x10'),_0x147ee2['MailAccount']['name'],_0x147ee2[_0xc002('0x11')][_0xc002('0xd')]||_0x147ee2[_0xc002('0x11')][_0xc002('0x12')][_0xc002('0x13')]),'to':_0x147ee2[_0xc002('0xd')],'cc':_0x147ee2['cc'],'bcc':_0x147ee2[_0xc002('0x14')],'subject':util['format'](_0xc002('0x15'),_0x3512f0[_0xc002('0x16')],_0x147ee2[_0xc002('0x17')],_0x147ee2['subtractUnit'])}};var _0x30a7f7=path[_0xc002('0x18')](__dirname,_0xc002('0x19'));var _0x55742f=_0x3512f0[_0xc002('0x1a')];var _0x3303b2=util[_0xc002('0xf')]('%s.%s',path[_0xc002('0x1b')](_0x3512f0[_0xc002('0x1a')],path['extname'](_0x3512f0['savename'])),'zip');var _0x476c80=path[_0xc002('0x18')](_0x30a7f7,_0x55742f);var _0xd3efbd=path[_0xc002('0x18')](_0x30a7f7,_0x3303b2);if(fs[_0xc002('0x1c')](_0x476c80)){_0x3512f0[_0xc002('0x1d')]=_0xc002('0x1e');_0x3c0eed[_0xc002('0x1f')]['attachments']=[{'filename':_0x55742f,'path':_0x476c80}];_0x3c0eed['message'][_0xc002('0x20')]=util[_0xc002('0xf')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xc002('0x21')](_0x3512f0,null,0x2));}else if(fs[_0xc002('0x1c')](_0xd3efbd)){_0x3512f0[_0xc002('0x1d')]=_0xc002('0x1e');_0x3c0eed[_0xc002('0x1f')][_0xc002('0x22')]=[{'filename':_0x3303b2,'path':_0xd3efbd}];}else{_0x3c0eed['message'][_0xc002('0x20')]=_0xc002('0x23');if(!_0x147ee2[_0xc002('0x24')]){_0x2ecadb=![];logger['info'](_0xc002('0x25'));}}if(_0x2ecadb){return client[_0xc002('0x26')](_0xc002('0x27'),_0x3c0eed)[_0xc002('0x28')](function(_0x4b51f5){if(_0x4b51f5[_0xc002('0x29')]){return logger['error'](_0xc002('0x2a'),JSON[_0xc002('0x21')](_0x4b51f5));}return logger[_0xc002('0xb')]('email\x20sent');})[_0xc002('0x2b')](function(_0x24e4e5){return logger[_0xc002('0x29')](_0xc002('0x2a'),JSON[_0xc002('0x21')](_0x24e4e5));});}};}function handleError(){return function(_0x369e77){return logger[_0xc002('0x29')](JSON[_0xc002('0x21')](_0x369e77));};}function handleResult(_0x45c1ef){return function(_0x35cef3){logger[_0xc002('0xb')](_0xc002('0x2c'),JSON[_0xc002('0x21')](_0x35cef3));if(_0x45c1ef[_0xc002('0x11')]&&_0x45c1ef[_0xc002('0x11')][_0xc002('0x12')]&&!_[_0xc002('0x2d')](_0x45c1ef[_0xc002('0xd')])){setTimeout(handleSendEmail(_0x45c1ef,_0x35cef3),0x3c*0x3e8);}};}function handleJob(_0x4a3a7a){return function(){try{if(_[_0xc002('0x2d')](_0x4a3a7a[_0xc002('0x17')])){return logger[_0xc002('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x4a3a7a[_0xc002('0x2e')])){return logger[_0xc002('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5ba43a={'startDate':moment()[_0xc002('0x2f')](_0x4a3a7a['subtractNumber'],_0x4a3a7a[_0xc002('0x2e')])[_0xc002('0xf')](_0xc002('0x30')),'endDate':moment()[_0xc002('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xc002('0x31'),'output':_0x4a3a7a[_0xc002('0x32')],'name':_0x4a3a7a[_0xc002('0x16')]};if(!_[_0xc002('0x2d')](_0x4a3a7a[_0xc002('0x33')])){logger['info'](_0xc002('0x34'),_0x4a3a7a[_0xc002('0x33')]);return analyticDefaultReportController['runReport']({'id':_0x4a3a7a[_0xc002('0x33')]},_0x5ba43a)['then'](handleResult(_0x4a3a7a))[_0xc002('0x2b')](handleError());}if(!_[_0xc002('0x2d')](_0x4a3a7a[_0xc002('0x35')])){logger['info'](_0xc002('0x36'),_0x4a3a7a['CustomReportId']);return analyticCustomReportController[_0xc002('0x37')]({'id':_0x4a3a7a[_0xc002('0x35')]},_0x5ba43a)[_0xc002('0x28')](handleResult(_0x4a3a7a))[_0xc002('0x2b')](handleError());}}catch(_0x1db3a5){logger[_0xc002('0x29')](JSON[_0xc002('0x21')](_0x1db3a5));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x32ae71){var _0x294623={};if(_0x32ae71){_0x294623['id']=_0x32ae71;}return db[_0xc002('0x38')]['findAll']({'where':_0x294623,'include':[{'model':db['MailAccount'],'attributes':['id',_0xc002('0x16'),_0xc002('0xd')],'include':[{'model':db[_0xc002('0x39')],'as':_0xc002('0x12'),'include':[{'model':db[_0xc002('0x3a')],'as':_0xc002('0x3a')}]}]}]})[_0xc002('0x28')](function(_0x1b9db1){var _0x2e5544=_[_0xc002('0x3b')](manager['jobs']);var _0x4b3e2e=_['map'](_0x1b9db1,function(_0x5a0b95){return _0x5a0b95['id'][_0xc002('0x3c')]();});var _0x43ae0b=_[_0xc002('0x3d')](_0x1b9db1,function(_0x18e1d0){return _0x18e1d0['id'][_0xc002('0x3c')]();});var _0x10f29f=_0x32ae71?_0x4b3e2e:_[_0xc002('0x3e')](_0x4b3e2e,_0x2e5544);var _0x14f1a9=_[_0xc002('0x3f')](_0x4b3e2e,_0x2e5544);var _0xca4f12=_[_0xc002('0x3e')](_0x2e5544,_0x4b3e2e);var _0x35b5b9;var _0x534fed;for(_0x35b5b9=0x0;_0x35b5b9<_0xca4f12['length']&&!_0x32ae71;_0x35b5b9+=0x1){_0x534fed=_0xca4f12[_0x35b5b9][_0xc002('0x3c')]();if(manager[_0xc002('0x40')](_0x534fed)){manager[_0xc002('0x41')](_0x534fed);manager[_0xc002('0x42')](_0x534fed);logger[_0xc002('0xb')]('delete\x20cron',_0x534fed);}}logger[_0xc002('0xb')](_0xc002('0x43'),JSON['stringify'](_0x10f29f));for(_0x35b5b9=0x0;_0x35b5b9<_0x10f29f[_0xc002('0x44')];_0x35b5b9+=0x1){_0x534fed=_0x10f29f[_0x35b5b9][_0xc002('0x3c')]();logger[_0xc002('0xb')](_0xc002('0x45'),_0x534fed);if(_0x32ae71){logger[_0xc002('0xb')](_0xc002('0x46'),_0x32ae71);logger[_0xc002('0xb')](JSON[_0xc002('0x21')](_0x43ae0b[_0x534fed]));BPromise['resolve']()[_0xc002('0x28')](handleJob(_0x43ae0b[_0x534fed]));logger[_0xc002('0xb')](_0xc002('0x47'),_0x43ae0b[_0x534fed]['name'],_0x43ae0b[_0x534fed][_0xc002('0x48')]);}else if(_0x43ae0b[_0x534fed][_0xc002('0x48')]&&_0x43ae0b[_0x534fed][_0xc002('0x49')]&&moment()[_0xc002('0x4a')](_0x43ae0b[_0x534fed][_0xc002('0x4b')],_0x43ae0b[_0x534fed]['endAt'])){manager[_0xc002('0x4c')](_0x534fed,_0x43ae0b[_0x534fed][_0xc002('0x48')],handleJob(_0x43ae0b[_0x534fed]));manager[_0xc002('0x4d')](_0x534fed);logger[_0xc002('0xb')](_0xc002('0x4e'),_0x43ae0b[_0x534fed][_0xc002('0x16')],_0x43ae0b[_0x534fed][_0xc002('0x48')]);}else if(manager[_0xc002('0x40')](_0x534fed)){manager['stop'](_0x534fed);manager[_0xc002('0x42')](_0x534fed);logger[_0xc002('0xb')](_0xc002('0x4f'),_0x43ae0b[_0x534fed]['name'],_0x43ae0b[_0x534fed][_0xc002('0x48')]);}}for(_0x35b5b9=0x0,_0x534fed;_0x35b5b9<_0x14f1a9[_0xc002('0x44')]&&!_0x32ae71;_0x35b5b9+=0x1){_0x534fed=_0x14f1a9[_0x35b5b9][_0xc002('0x3c')]();if(manager['exists'](_0x534fed)){if(_0x43ae0b[_0x534fed][_0xc002('0x48')]&&_0x43ae0b[_0x534fed]['active']&&moment()[_0xc002('0x4a')](_0x43ae0b[_0x534fed]['startAt'],_0x43ae0b[_0x534fed][_0xc002('0x50')])){manager['update'](_0x534fed,_0x43ae0b[_0x534fed][_0xc002('0x48')],handleJob(_0x43ae0b[_0x534fed]));logger['info'](_0xc002('0x51'),_0x43ae0b[_0x534fed][_0xc002('0x16')],_0x43ae0b[_0x534fed][_0xc002('0x48')]);}else{manager[_0xc002('0x41')](_0x534fed);manager[_0xc002('0x42')](_0x534fed);logger[_0xc002('0xb')](_0xc002('0x4f'),_0x43ae0b[_0x534fed][_0xc002('0x16')],_0x43ae0b[_0x534fed][_0xc002('0x48')]);}}}})[_0xc002('0x2b')](function(_0x418d88){logger['error'](JSON[_0xc002('0x21')](_0x418d88));});}exports['run']=function(_0x46f23f){return getJobs(_0x46f23f);};exports[_0xc002('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xcf75=['error','error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','difference','intersection','length','toString','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','stop\x20cron','run','path','lodash','moment','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xcf75,0x83));var _0x5cf7=function(_0x457f47,_0x22dc6c){_0x457f47=_0x457f47-0x0;var _0x43e1ca=_0xcf75[_0x457f47];return _0x43e1ca;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x5cf7('0x0'));var _=require(_0x5cf7('0x1'));var moment=require(_0x5cf7('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x5cf7('0x3'));var logger=require(_0x5cf7('0x4'))('schedule');var db=require(_0x5cf7('0x5'))['db'];var analyticCustomReportController=require(_0x5cf7('0x6'));var analyticDefaultReportController=require(_0x5cf7('0x7'));var client=jayson['client'][_0x5cf7('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xa33b7a,_0x4ab7fe){return function(){logger[_0x5cf7('0x9')](_0x5cf7('0xa'),_0xa33b7a[_0x5cf7('0xb')]);var _0x54fd4e=!![];var _0x1bdc89=_0xa33b7a[_0x5cf7('0xc')][_0x5cf7('0xd')]();var _0x1a0303={'account':_0x1bdc89,'message':{'from':util['format'](_0x5cf7('0xe'),_0xa33b7a[_0x5cf7('0xc')][_0x5cf7('0xf')],_0xa33b7a['MailAccount'][_0x5cf7('0xb')]||_0xa33b7a[_0x5cf7('0xc')][_0x5cf7('0x10')][_0x5cf7('0x11')]),'to':_0xa33b7a[_0x5cf7('0xb')],'cc':_0xa33b7a['cc'],'bcc':_0xa33b7a[_0x5cf7('0x12')],'subject':util[_0x5cf7('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0x4ab7fe[_0x5cf7('0xf')],_0xa33b7a['subtractNumber'],_0xa33b7a[_0x5cf7('0x14')])}};var _0x2ffa28=path['join'](__dirname,_0x5cf7('0x15'));var _0x3ad9e5=_0x4ab7fe[_0x5cf7('0x16')];var _0x5a2653=util[_0x5cf7('0x13')](_0x5cf7('0x17'),path[_0x5cf7('0x18')](_0x4ab7fe[_0x5cf7('0x16')],path[_0x5cf7('0x19')](_0x4ab7fe[_0x5cf7('0x16')])),_0x5cf7('0x1a'));var _0x445cba=path[_0x5cf7('0x1b')](_0x2ffa28,_0x3ad9e5);var _0x12b88b=path[_0x5cf7('0x1b')](_0x2ffa28,_0x5a2653);if(fs['existsSync'](_0x445cba)){_0x4ab7fe[_0x5cf7('0x1c')]=_0x5cf7('0x1d');_0x1a0303['message'][_0x5cf7('0x1e')]=[{'filename':_0x3ad9e5,'path':_0x445cba}];_0x1a0303[_0x5cf7('0x1f')][_0x5cf7('0x20')]=util[_0x5cf7('0x13')](_0x5cf7('0x21'),JSON['stringify'](_0x4ab7fe,null,0x2));}else if(fs[_0x5cf7('0x22')](_0x12b88b)){_0x4ab7fe[_0x5cf7('0x1c')]=_0x5cf7('0x1d');_0x1a0303[_0x5cf7('0x1f')][_0x5cf7('0x1e')]=[{'filename':_0x5a2653,'path':_0x12b88b}];}else{_0x1a0303['message'][_0x5cf7('0x20')]=_0x5cf7('0x23');if(!_0xa33b7a[_0x5cf7('0x24')]){_0x54fd4e=![];logger['info'](_0x5cf7('0x25'));}}if(_0x54fd4e){return client[_0x5cf7('0x26')](_0x5cf7('0x27'),_0x1a0303)[_0x5cf7('0x28')](function(_0x30f4ce){if(_0x30f4ce[_0x5cf7('0x29')]){return logger['error'](_0x5cf7('0x2a'),JSON[_0x5cf7('0x2b')](_0x30f4ce));}return logger[_0x5cf7('0x9')](_0x5cf7('0x2c'));})[_0x5cf7('0x2d')](function(_0x20560f){return logger[_0x5cf7('0x29')]('error\x20mail',JSON[_0x5cf7('0x2b')](_0x20560f));});}};}function handleError(){return function(_0x38f7fa){return logger['error'](JSON[_0x5cf7('0x2b')](_0x38f7fa));};}function handleResult(_0x546a21){return function(_0x4de706){logger[_0x5cf7('0x9')](_0x5cf7('0x2e'),JSON[_0x5cf7('0x2b')](_0x4de706));if(_0x546a21['MailAccount']&&_0x546a21[_0x5cf7('0xc')]['Smtp']&&!_[_0x5cf7('0x2f')](_0x546a21[_0x5cf7('0xb')])){setTimeout(handleSendEmail(_0x546a21,_0x4de706),0x3c*0x3e8);}};}function handleJob(_0x5dd808){return function(){try{if(_['isNil'](_0x5dd808[_0x5cf7('0x30')])){return logger['info'](_0x5cf7('0x31'));}if(_[_0x5cf7('0x2f')](_0x5dd808[_0x5cf7('0x14')])){return logger[_0x5cf7('0x9')](_0x5cf7('0x32'));}var _0x38935f={'startDate':moment()[_0x5cf7('0x33')](_0x5dd808[_0x5cf7('0x30')],_0x5dd808[_0x5cf7('0x14')])[_0x5cf7('0x13')](_0x5cf7('0x34')),'endDate':moment()[_0x5cf7('0x13')](_0x5cf7('0x34')),'type':_0x5cf7('0x35'),'output':_0x5dd808['output'],'name':_0x5dd808[_0x5cf7('0xf')]};if(!_[_0x5cf7('0x2f')](_0x5dd808[_0x5cf7('0x36')])){logger[_0x5cf7('0x9')](_0x5cf7('0x37'),_0x5dd808['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x5dd808[_0x5cf7('0x36')]},_0x38935f)['then'](handleResult(_0x5dd808))[_0x5cf7('0x2d')](handleError());}if(!_[_0x5cf7('0x2f')](_0x5dd808['CustomReportId'])){logger[_0x5cf7('0x9')](_0x5cf7('0x38'),_0x5dd808[_0x5cf7('0x39')]);return analyticCustomReportController[_0x5cf7('0x3a')]({'id':_0x5dd808[_0x5cf7('0x39')]},_0x38935f)[_0x5cf7('0x28')](handleResult(_0x5dd808))[_0x5cf7('0x2d')](handleError());}}catch(_0x42a400){logger[_0x5cf7('0x29')](JSON[_0x5cf7('0x2b')](_0x42a400));}return logger['info'](_0x5cf7('0x3b'));};}function getJobs(_0x65b854){var _0x25e367={};if(_0x65b854){_0x25e367['id']=_0x65b854;}return db['Schedule'][_0x5cf7('0x3c')]({'where':_0x25e367,'include':[{'model':db[_0x5cf7('0xc')],'attributes':['id','name',_0x5cf7('0xb')],'include':[{'model':db[_0x5cf7('0x3d')],'as':_0x5cf7('0x10'),'include':[{'model':db[_0x5cf7('0x3e')],'as':_0x5cf7('0x3e')}]}]}]})[_0x5cf7('0x28')](function(_0x3b3b09){var _0xce022=_[_0x5cf7('0x3f')](manager['jobs']);var _0x3d1a1d=_['map'](_0x3b3b09,function(_0x21cd30){return _0x21cd30['id']['toString']();});var _0x4e1986=_['keyBy'](_0x3b3b09,function(_0xd3df9){return _0xd3df9['id']['toString']();});var _0x8b498=_0x65b854?_0x3d1a1d:_[_0x5cf7('0x40')](_0x3d1a1d,_0xce022);var _0x583001=_[_0x5cf7('0x41')](_0x3d1a1d,_0xce022);var _0x40e298=_[_0x5cf7('0x40')](_0xce022,_0x3d1a1d);var _0x59f8f6;var _0x184529;for(_0x59f8f6=0x0;_0x59f8f6<_0x40e298[_0x5cf7('0x42')]&&!_0x65b854;_0x59f8f6+=0x1){_0x184529=_0x40e298[_0x59f8f6][_0x5cf7('0x43')]();if(manager[_0x5cf7('0x44')](_0x184529)){manager[_0x5cf7('0x45')](_0x184529);manager[_0x5cf7('0x46')](_0x184529);logger[_0x5cf7('0x9')](_0x5cf7('0x47'),_0x184529);}}logger[_0x5cf7('0x9')](_0x5cf7('0x48'),JSON[_0x5cf7('0x2b')](_0x8b498));for(_0x59f8f6=0x0;_0x59f8f6<_0x8b498[_0x5cf7('0x42')];_0x59f8f6+=0x1){_0x184529=_0x8b498[_0x59f8f6][_0x5cf7('0x43')]();logger[_0x5cf7('0x9')](_0x5cf7('0x49'),_0x184529);if(_0x65b854){logger[_0x5cf7('0x9')](_0x5cf7('0x4a'),_0x65b854);logger['info'](JSON['stringify'](_0x4e1986[_0x184529]));BPromise[_0x5cf7('0x4b')]()['then'](handleJob(_0x4e1986[_0x184529]));logger[_0x5cf7('0x9')](_0x5cf7('0x4c'),_0x4e1986[_0x184529][_0x5cf7('0xf')],_0x4e1986[_0x184529][_0x5cf7('0x4d')]);}else if(_0x4e1986[_0x184529][_0x5cf7('0x4d')]&&_0x4e1986[_0x184529][_0x5cf7('0x4e')]&&moment()[_0x5cf7('0x4f')](_0x4e1986[_0x184529][_0x5cf7('0x50')],_0x4e1986[_0x184529][_0x5cf7('0x51')])){manager[_0x5cf7('0x52')](_0x184529,_0x4e1986[_0x184529][_0x5cf7('0x4d')],handleJob(_0x4e1986[_0x184529]));manager[_0x5cf7('0x53')](_0x184529);logger[_0x5cf7('0x9')]('add\x20cron',_0x4e1986[_0x184529][_0x5cf7('0xf')],_0x4e1986[_0x184529][_0x5cf7('0x4d')]);}else if(manager[_0x5cf7('0x44')](_0x184529)){manager[_0x5cf7('0x45')](_0x184529);manager[_0x5cf7('0x46')](_0x184529);logger[_0x5cf7('0x9')](_0x5cf7('0x54'),_0x4e1986[_0x184529][_0x5cf7('0xf')],_0x4e1986[_0x184529][_0x5cf7('0x4d')]);}}for(_0x59f8f6=0x0,_0x184529;_0x59f8f6<_0x583001[_0x5cf7('0x42')]&&!_0x65b854;_0x59f8f6+=0x1){_0x184529=_0x583001[_0x59f8f6]['toString']();if(manager[_0x5cf7('0x44')](_0x184529)){if(_0x4e1986[_0x184529]['cron']&&_0x4e1986[_0x184529][_0x5cf7('0x4e')]&&moment()[_0x5cf7('0x4f')](_0x4e1986[_0x184529]['startAt'],_0x4e1986[_0x184529][_0x5cf7('0x51')])){manager['update'](_0x184529,_0x4e1986[_0x184529]['cron'],handleJob(_0x4e1986[_0x184529]));logger[_0x5cf7('0x9')]('update\x20cron',_0x4e1986[_0x184529][_0x5cf7('0xf')],_0x4e1986[_0x184529]['cron']);}else{manager[_0x5cf7('0x45')](_0x184529);manager['deleteJob'](_0x184529);logger['info']('stop\x20cron',_0x4e1986[_0x184529][_0x5cf7('0xf')],_0x4e1986[_0x184529][_0x5cf7('0x4d')]);}}}})[_0x5cf7('0x2d')](function(_0x389e31){logger['error'](JSON[_0x5cf7('0x2b')](_0x389e31));});}exports[_0x5cf7('0x55')]=function(_0x621eda){return getJobs(_0x621eda);};exports[_0x5cf7('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index d99d1c7..f0d3442 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2136=['length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','CloudProvider','Positive','catch','name','SequelizeValidationError','error','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','substring','format','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x53199f,_0x1dac3a){var _0x1f9609=function(_0x452065){while(--_0x452065){_0x53199f['push'](_0x53199f['shift']());}};_0x1f9609(++_0x1dac3a);}(_0x2136,0x1eb));var _0x6213=function(_0x4529b3,_0x390ebb){_0x4529b3=_0x4529b3-0x0;var _0x21e907=_0x2136[_0x4529b3];return _0x21e907;};var _=require(_0x6213('0x0'));var AWS=require(_0x6213('0x1'));var rp=require(_0x6213('0x2'));var util=require(_0x6213('0x3'));var BPromise=require(_0x6213('0x4'));var db=require(_0x6213('0x5'))['db'];var logger=require(_0x6213('0x6'))(_0x6213('0x7'));function getTranscriptionJob(_0x41f18f,_0x2e89e8,_0x50da41,_0x458207){return new Promise(function(_0x41b760,_0x1ae2cc){var _0x49db78=new AWS[(_0x6213('0x8'))]({'accessKeyId':_0x2e89e8,'secretAccessKey':_0x41f18f,'region':_0x50da41});_0x49db78['getTranscriptionJob']({'TranscriptionJobName':_0x458207},function(_0x3604f1,_0x88e8a0){if(_0x3604f1){return _0x1ae2cc(_0x3604f1);}else{return _0x41b760(_0x88e8a0);}});});}function sentiment(_0x551a16,_0x49c38c,_0x275ba8,_0x23548f,_0x4082b0){return new Promise(function(_0x41d1db,_0x1d9bf2){var _0x2fd8d4=new AWS[(_0x6213('0x9'))]({'accessKeyId':_0x49c38c,'secretAccessKey':_0x551a16,'region':_0x275ba8});_0x2fd8d4['detectSentiment']({'Text':_0x23548f,'LanguageCode':_0x4082b0[_0x6213('0xa')](0x0,0x2)},function(_0x1c6bcf,_0x2b238e){if(_0x1c6bcf){return _0x1d9bf2(_0x1c6bcf);}else{return _0x41d1db(_0x2b238e);}});});}function checkTranscribeJob(_0x5d665a,_0x23c118,_0x23dd5b){var _0x3a7c02;return new BPromise(function(_0x26b968,_0x1ef15f){logger['info'](util[_0x6213('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5d665a['id'],_0x5d665a[_0x6213('0xc')]));return getTranscriptionJob(_0x23dd5b[_0x6213('0xd')],_0x23dd5b[_0x6213('0xe')],_0x23c118['transcribeRegion'],_0x5d665a[_0x6213('0xc')])[_0x6213('0xf')](function(_0x5ef2d6){logger['info'](util[_0x6213('0xb')](_0x6213('0x10'),_0x5d665a['id'],_0x5d665a['transcribeName'],_0x5ef2d6[_0x6213('0x11')][_0x6213('0x12')]));if(!_0x5d665a[_0x6213('0x13')]){switch(_0x5ef2d6['TranscriptionJob'][_0x6213('0x12')]){case'COMPLETED':var _0x1a9421={'transcribeStatus':_0x5ef2d6[_0x6213('0x11')]['TranscriptionJobStatus'],'fileUri':_0x5ef2d6[_0x6213('0x11')]['Transcript'][_0x6213('0x14')]};logger[_0x6213('0x15')](util[_0x6213('0xb')](_0x6213('0x16'),_0x5d665a['id']));return rp({'uri':_0x5ef2d6[_0x6213('0x11')][_0x6213('0x17')][_0x6213('0x14')],'json':!![]})[_0x6213('0xf')](function(_0x363584){logger[_0x6213('0x15')](util['format'](_0x6213('0x18'),_0x5d665a['id']));if(_0x363584&&_0x363584[_0x6213('0x19')]&&_0x363584[_0x6213('0x19')][_0x6213('0x1a')]&&_0x363584[_0x6213('0x19')][_0x6213('0x1a')][_0x6213('0x1b')]){_0x1a9421[_0x6213('0x13')]='';for(var _0x229fb0=0x0;_0x229fb0<_0x363584[_0x6213('0x19')][_0x6213('0x1a')][_0x6213('0x1b')];_0x229fb0++){_0x1a9421[_0x6213('0x13')]+=_0x363584['results']['transcripts'][_0x229fb0][_0x6213('0x1c')]+'';}}return _0x5d665a[_0x6213('0x1d')](_0x1a9421);})[_0x6213('0xf')](function(){logger[_0x6213('0x15')](util[_0x6213('0xb')](_0x6213('0x1e'),_0x5d665a['id']));if(!_0x5d665a[_0x6213('0x1f')]){throw new db[(_0x6213('0x20'))]['ValidationError'](_0x6213('0x21'));}if(!_0x23c118[_0x6213('0x22')]||!_0x23c118['sentimentAccountId']||!_0x23c118[_0x6213('0x23')]||!_0x23c118[_0x6213('0x24')]||!_0x23c118['bucket']){throw new db['Sequelize'][(_0x6213('0x25'))](_0x6213('0x26'));}if(!_0x1a9421[_0x6213('0x13')]){throw new Error(_0x6213('0x27'));}if(_0x23c118[_0x6213('0x28')]===_0x23dd5b['id']){return _0x23dd5b;}else{return db['CloudProvider'][_0x6213('0x29')]({'where':{'id':_settings[_0x6213('0x28')]}});}})[_0x6213('0xf')](function(_0x2f160b){if(!_0x2f160b){throw new db[(_0x6213('0x20'))][(_0x6213('0x25'))](_0x6213('0x2a'));}if(!_0x2f160b[_0x6213('0xd')]||!_0x2f160b[_0x6213('0xe')]){throw new db[(_0x6213('0x20'))][(_0x6213('0x25'))]('Cloud\x20Provider\x20not\x20configured');}_0x3a7c02=_0x2f160b;logger[_0x6213('0x15')](util[_0x6213('0xb')](_0x6213('0x2b'),_0x5d665a['id']));return sentiment(_0x3a7c02[_0x6213('0xd')],_0x3a7c02[_0x6213('0xe')],_0x23c118[_0x6213('0x23')],_0x1a9421[_0x6213('0x13')],_0x23c118['language']);})[_0x6213('0xf')](function(_0x240088){logger[_0x6213('0x15')](util[_0x6213('0xb')](_0x6213('0x2c'),_0x5d665a['id']));return _0x5d665a[_0x6213('0x1d')]({'sentiment':_0x240088[_0x6213('0x2d')],'sPositive':_0x240088['SentimentScore']['Positive'],'sNegative':_0x240088[_0x6213('0x2e')][_0x6213('0x2f')],'sMixed':_0x240088[_0x6213('0x2e')][_0x6213('0x30')],'sNeutral':_0x240088[_0x6213('0x2e')][_0x6213('0x31')]});})[_0x6213('0xf')](function(){logger[_0x6213('0x15')](util['format'](_0x6213('0x1e'),_0x5d665a['id']));_0x26b968();});case _0x6213('0x32'):return _0x5d665a[_0x6213('0x1d')]({'transcribeStatus':_0x6213('0x32'),'failureReason':_0x5ef2d6[_0x6213('0x11')][_0x6213('0x33')]})[_0x6213('0xf')](function(){logger['info'](util[_0x6213('0xb')](_0x6213('0x1e'),_0x5d665a['id']));_0x26b968();});default:logger[_0x6213('0x15')](util[_0x6213('0xb')](_0x6213('0x34'),_0x5d665a['id']));break;}}else{return BPromise[_0x6213('0x35')]()['then'](function(){if(!_0x5d665a[_0x6213('0x1f')]){throw new db['Sequelize'][(_0x6213('0x25'))](_0x6213('0x21'));}if(!_0x23c118['sentiment']||!_0x23c118[_0x6213('0x28')]||!_0x23c118[_0x6213('0x23')]||!_0x23c118[_0x6213('0x24')]||!_0x23c118[_0x6213('0x36')]){throw new db[(_0x6213('0x20'))][(_0x6213('0x25'))](_0x6213('0x26'));}if(!_0x5d665a['fileText']){throw new Error(_0x6213('0x27'));}if(_0x23c118['sentimentAccountId']===_0x23dd5b['id']){return _0x23dd5b;}else{return db[_0x6213('0x37')][_0x6213('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6213('0xf')](function(_0x3d0b00){if(!_0x3d0b00){throw new db['Sequelize'][(_0x6213('0x25'))](_0x6213('0x2a'));}if(!_0x3d0b00['data1']||!_0x3d0b00[_0x6213('0xe')]){throw new db['Sequelize'][(_0x6213('0x25'))]('Cloud\x20Provider\x20not\x20configured');}_0x3a7c02=_0x3d0b00;logger[_0x6213('0x15')](util[_0x6213('0xb')](_0x6213('0x2b'),_0x5d665a['id']));return sentiment(_0x3a7c02['data1'],_0x3a7c02['data2'],_0x23c118[_0x6213('0x23')],_0x5d665a['fileText'],_0x23c118[_0x6213('0x24')]);})[_0x6213('0xf')](function(_0x18c4f6){logger[_0x6213('0x15')](util['format'](_0x6213('0x2c'),_0x5d665a['id']));return _0x5d665a[_0x6213('0x1d')]({'sentiment':_0x18c4f6[_0x6213('0x2d')],'sPositive':_0x18c4f6[_0x6213('0x2e')][_0x6213('0x38')],'sNegative':_0x18c4f6[_0x6213('0x2e')][_0x6213('0x2f')],'sMixed':_0x18c4f6['SentimentScore'][_0x6213('0x30')],'sNeutral':_0x18c4f6[_0x6213('0x2e')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x6213('0xf')](function(){logger['info'](util[_0x6213('0xb')](_0x6213('0x1e'),_0x5d665a['id']));_0x26b968();});}})[_0x6213('0x39')](function(_0x7f2e69){if(_0x7f2e69){if(!_0x7f2e69[_0x6213('0x3a')]||_0x7f2e69[_0x6213('0x3a')]!==_0x6213('0x3b')){logger[_0x6213('0x3c')](util[_0x6213('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5d665a['id']),util['inspect'](_0x7f2e69,{'showHidden':![],'depth':null}));}}_0x26b968();});});}function checkTranscribe(){var _0x37efb3;var _0x4c9247;var _0x47eadf;return db['VoiceRecording'][_0x6213('0x3d')]({'where':{'transcribeStatus':_0x6213('0x3e')}})[_0x6213('0xf')](function(_0x16661a){if(!_0x16661a||!_0x16661a['length']){throw new db[(_0x6213('0x20'))][(_0x6213('0x25'))](_0x6213('0x3f'));}_0x37efb3=_0x16661a;return db[_0x6213('0x40')][_0x6213('0x29')]({'where':{'id':0x1}});})[_0x6213('0xf')](function(_0x28394b){if(!_0x28394b){throw new db[(_0x6213('0x20'))][(_0x6213('0x25'))]('Settings\x20not\x20available');}_0x4c9247=_0x28394b;if(!_0x4c9247['transcribe']||!_0x4c9247[_0x6213('0x41')]||!_0x4c9247[_0x6213('0x42')]||!_0x4c9247['language']||!_0x4c9247[_0x6213('0x36')]){throw new db['Sequelize']['ValidationError'](_0x6213('0x43'));}return db[_0x6213('0x37')]['findOne']({'where':{'id':_0x4c9247[_0x6213('0x41')]}});})[_0x6213('0xf')](function(_0x58fce6){if(!_0x58fce6){throw new db['Sequelize']['ValidationError'](_0x6213('0x2a'));}if(!_0x58fce6[_0x6213('0xd')]||!_0x58fce6[_0x6213('0xe')]){throw new db['Sequelize']['ValidationError'](_0x6213('0x44'));}_0x47eadf=_0x58fce6;var _0x2ebedb=[];_0x37efb3[_0x6213('0x45')](function(_0xa935da){_0x2ebedb[_0x6213('0x46')](checkTranscribeJob(_0xa935da,_0x4c9247,_0x47eadf));});return BPromise[_0x6213('0x47')](_0x2ebedb);})[_0x6213('0x39')](function(_0x5a9935){if(_0x5a9935){if(!_0x5a9935['name']||_0x5a9935[_0x6213('0x3a')]!==_0x6213('0x3b')){logger[_0x6213('0x3c')](util[_0x6213('0x48')](_0x5a9935,{'showHidden':![],'depth':null}));}}});}exports[_0x6213('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1ca7=['TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20configured','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','lodash','aws-sdk','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript'];(function(_0x397bfb,_0x589665){var _0x16c9b9=function(_0x13ce8a){while(--_0x13ce8a){_0x397bfb['push'](_0x397bfb['shift']());}};_0x16c9b9(++_0x589665);}(_0x1ca7,0x157));var _0x71ca=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1ca7[_0x2dafbe];return _0x58a45a;};var _=require(_0x71ca('0x0'));var AWS=require(_0x71ca('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x71ca('0x2'))['db'];var logger=require(_0x71ca('0x3'))(_0x71ca('0x4'));function getTranscriptionJob(_0x569781,_0x2501cd,_0x3b6cbf,_0x58f288){return new Promise(function(_0x58c4a5,_0x3ebc2f){var _0x2d5d49=new AWS[(_0x71ca('0x5'))]({'accessKeyId':_0x2501cd,'secretAccessKey':_0x569781,'region':_0x3b6cbf});_0x2d5d49[_0x71ca('0x6')]({'TranscriptionJobName':_0x58f288},function(_0x4f25f6,_0x378012){if(_0x4f25f6){return _0x3ebc2f(_0x4f25f6);}else{return _0x58c4a5(_0x378012);}});});}function sentiment(_0x41ca0a,_0x59f41c,_0x2ad516,_0x2aff62,_0x1fcf82){return new Promise(function(_0x5def7b,_0x25a84b){var _0x342d5c=new AWS[(_0x71ca('0x7'))]({'accessKeyId':_0x59f41c,'secretAccessKey':_0x41ca0a,'region':_0x2ad516});_0x342d5c[_0x71ca('0x8')]({'Text':_0x2aff62,'LanguageCode':_0x1fcf82[_0x71ca('0x9')](0x0,0x2)},function(_0x3d5a28,_0x5df2cd){if(_0x3d5a28){return _0x25a84b(_0x3d5a28);}else{return _0x5def7b(_0x5df2cd);}});});}function checkTranscribeJob(_0x1d92d6,_0x1654d3,_0x4da234){var _0x230345;return new BPromise(function(_0x42ad77,_0x40f45d){logger[_0x71ca('0xa')](util[_0x71ca('0xb')](_0x71ca('0xc'),_0x1d92d6['id'],_0x1d92d6[_0x71ca('0xd')]));return getTranscriptionJob(_0x4da234[_0x71ca('0xe')],_0x4da234[_0x71ca('0xf')],_0x1654d3[_0x71ca('0x10')],_0x1d92d6['transcribeName'])['then'](function(_0x3f206d){logger['info'](util[_0x71ca('0xb')](_0x71ca('0x11'),_0x1d92d6['id'],_0x1d92d6['transcribeName'],_0x3f206d['TranscriptionJob'][_0x71ca('0x12')]));if(!_0x1d92d6['fileText']){switch(_0x3f206d[_0x71ca('0x13')][_0x71ca('0x12')]){case _0x71ca('0x14'):var _0x3750fa={'transcribeStatus':_0x3f206d['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x3f206d['TranscriptionJob'][_0x71ca('0x15')][_0x71ca('0x16')]};logger[_0x71ca('0xa')](util[_0x71ca('0xb')](_0x71ca('0x17'),_0x1d92d6['id']));return rp({'uri':_0x3f206d[_0x71ca('0x13')][_0x71ca('0x15')][_0x71ca('0x16')],'json':!![]})[_0x71ca('0x18')](function(_0x1f0140){logger['info'](util[_0x71ca('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x1d92d6['id']));if(_0x1f0140&&_0x1f0140[_0x71ca('0x19')]&&_0x1f0140['results']['transcripts']&&_0x1f0140[_0x71ca('0x19')][_0x71ca('0x1a')][_0x71ca('0x1b')]){_0x3750fa[_0x71ca('0x1c')]='';for(var _0x31e9a6=0x0;_0x31e9a6<_0x1f0140[_0x71ca('0x19')][_0x71ca('0x1a')][_0x71ca('0x1b')];_0x31e9a6++){_0x3750fa[_0x71ca('0x1c')]+=_0x1f0140[_0x71ca('0x19')][_0x71ca('0x1a')][_0x31e9a6][_0x71ca('0x1d')]+'';}}return _0x1d92d6[_0x71ca('0x1e')](_0x3750fa);})[_0x71ca('0x18')](function(){logger['info'](util[_0x71ca('0xb')](_0x71ca('0x1f'),_0x1d92d6['id']));if(!_0x1d92d6[_0x71ca('0x20')]){throw new db[(_0x71ca('0x21'))][(_0x71ca('0x22'))](_0x71ca('0x23'));}if(!_0x1654d3[_0x71ca('0x24')]||!_0x1654d3['sentimentAccountId']||!_0x1654d3['sentimentRegion']||!_0x1654d3[_0x71ca('0x25')]||!_0x1654d3[_0x71ca('0x26')]){throw new db[(_0x71ca('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3750fa['fileText']){throw new Error(_0x71ca('0x27'));}if(_0x1654d3['sentimentAccountId']===_0x4da234['id']){return _0x4da234;}else{return db['CloudProvider'][_0x71ca('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x71ca('0x18')](function(_0x3b456d){if(!_0x3b456d){throw new db[(_0x71ca('0x21'))]['ValidationError'](_0x71ca('0x29'));}if(!_0x3b456d[_0x71ca('0xe')]||!_0x3b456d[_0x71ca('0xf')]){throw new db[(_0x71ca('0x21'))][(_0x71ca('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x230345=_0x3b456d;logger[_0x71ca('0xa')](util[_0x71ca('0xb')](_0x71ca('0x2a'),_0x1d92d6['id']));return sentiment(_0x230345[_0x71ca('0xe')],_0x230345[_0x71ca('0xf')],_0x1654d3[_0x71ca('0x2b')],_0x3750fa[_0x71ca('0x1c')],_0x1654d3[_0x71ca('0x25')]);})['then'](function(_0x59d9bd){logger[_0x71ca('0xa')](util[_0x71ca('0xb')](_0x71ca('0x2c'),_0x1d92d6['id']));return _0x1d92d6[_0x71ca('0x1e')]({'sentiment':_0x59d9bd[_0x71ca('0x2d')],'sPositive':_0x59d9bd[_0x71ca('0x2e')][_0x71ca('0x2f')],'sNegative':_0x59d9bd[_0x71ca('0x2e')]['Negative'],'sMixed':_0x59d9bd[_0x71ca('0x2e')]['Mixed'],'sNeutral':_0x59d9bd[_0x71ca('0x2e')][_0x71ca('0x30')]});})[_0x71ca('0x18')](function(){logger[_0x71ca('0xa')](util[_0x71ca('0xb')](_0x71ca('0x1f'),_0x1d92d6['id']));_0x42ad77();});case _0x71ca('0x31'):return _0x1d92d6[_0x71ca('0x1e')]({'transcribeStatus':_0x71ca('0x31'),'failureReason':_0x3f206d[_0x71ca('0x13')][_0x71ca('0x32')]})['then'](function(){logger[_0x71ca('0xa')](util[_0x71ca('0xb')](_0x71ca('0x1f'),_0x1d92d6['id']));_0x42ad77();});default:logger['info'](util[_0x71ca('0xb')](_0x71ca('0x33'),_0x1d92d6['id']));break;}}else{return BPromise[_0x71ca('0x34')]()[_0x71ca('0x18')](function(){if(!_0x1d92d6[_0x71ca('0x20')]){throw new db['Sequelize']['ValidationError'](_0x71ca('0x23'));}if(!_0x1654d3[_0x71ca('0x24')]||!_0x1654d3[_0x71ca('0x35')]||!_0x1654d3[_0x71ca('0x2b')]||!_0x1654d3[_0x71ca('0x25')]||!_0x1654d3[_0x71ca('0x26')]){throw new db['Sequelize']['ValidationError'](_0x71ca('0x36'));}if(!_0x1d92d6[_0x71ca('0x1c')]){throw new Error(_0x71ca('0x27'));}if(_0x1654d3['sentimentAccountId']===_0x4da234['id']){return _0x4da234;}else{return db[_0x71ca('0x37')][_0x71ca('0x28')]({'where':{'id':_settings[_0x71ca('0x35')]}});}})[_0x71ca('0x18')](function(_0x437e46){if(!_0x437e46){throw new db[(_0x71ca('0x21'))][(_0x71ca('0x22'))](_0x71ca('0x29'));}if(!_0x437e46[_0x71ca('0xe')]||!_0x437e46[_0x71ca('0xf')]){throw new db['Sequelize']['ValidationError'](_0x71ca('0x38'));}_0x230345=_0x437e46;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1d92d6['id']));return sentiment(_0x230345['data1'],_0x230345['data2'],_0x1654d3[_0x71ca('0x2b')],_0x1d92d6[_0x71ca('0x1c')],_0x1654d3[_0x71ca('0x25')]);})[_0x71ca('0x18')](function(_0x12662f){logger['info'](util['format'](_0x71ca('0x2c'),_0x1d92d6['id']));return _0x1d92d6[_0x71ca('0x1e')]({'sentiment':_0x12662f[_0x71ca('0x2d')],'sPositive':_0x12662f[_0x71ca('0x2e')][_0x71ca('0x2f')],'sNegative':_0x12662f[_0x71ca('0x2e')]['Negative'],'sMixed':_0x12662f[_0x71ca('0x2e')][_0x71ca('0x39')],'sNeutral':_0x12662f[_0x71ca('0x2e')][_0x71ca('0x30')],'transcribeStatus':'COMPLETED'});})[_0x71ca('0x18')](function(){logger['info'](util[_0x71ca('0xb')](_0x71ca('0x1f'),_0x1d92d6['id']));_0x42ad77();});}})[_0x71ca('0x3a')](function(_0x2555ba){if(_0x2555ba){if(!_0x2555ba[_0x71ca('0x3b')]||_0x2555ba[_0x71ca('0x3b')]!==_0x71ca('0x3c')){logger[_0x71ca('0x3d')](util[_0x71ca('0xb')](_0x71ca('0x3e'),_0x1d92d6['id']),util[_0x71ca('0x3f')](_0x2555ba,{'showHidden':![],'depth':null}));}}_0x42ad77();});});}function checkTranscribe(){var _0x264613;var _0x5a9d87;var _0x1ccbbe;return db[_0x71ca('0x40')][_0x71ca('0x41')]({'where':{'transcribeStatus':_0x71ca('0x42')}})['then'](function(_0x3c8474){if(!_0x3c8474||!_0x3c8474[_0x71ca('0x1b')]){throw new db[(_0x71ca('0x21'))]['ValidationError'](_0x71ca('0x43'));}_0x264613=_0x3c8474;return db['Setting'][_0x71ca('0x28')]({'where':{'id':0x1}});})['then'](function(_0x2f9e82){if(!_0x2f9e82){throw new db[(_0x71ca('0x21'))][(_0x71ca('0x22'))]('Settings\x20not\x20available');}_0x5a9d87=_0x2f9e82;if(!_0x5a9d87[_0x71ca('0x4')]||!_0x5a9d87[_0x71ca('0x44')]||!_0x5a9d87[_0x71ca('0x10')]||!_0x5a9d87[_0x71ca('0x25')]||!_0x5a9d87['bucket']){throw new db['Sequelize'][(_0x71ca('0x22'))](_0x71ca('0x45'));}return db['CloudProvider'][_0x71ca('0x28')]({'where':{'id':_0x5a9d87[_0x71ca('0x44')]}});})['then'](function(_0xf11ba3){if(!_0xf11ba3){throw new db['Sequelize'][(_0x71ca('0x22'))](_0x71ca('0x29'));}if(!_0xf11ba3[_0x71ca('0xe')]||!_0xf11ba3[_0x71ca('0xf')]){throw new db[(_0x71ca('0x21'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1ccbbe=_0xf11ba3;var _0x24a172=[];_0x264613[_0x71ca('0x46')](function(_0x384dee){_0x24a172['push'](checkTranscribeJob(_0x384dee,_0x5a9d87,_0x1ccbbe));});return BPromise[_0x71ca('0x47')](_0x24a172);})[_0x71ca('0x3a')](function(_0xdfa72d){if(_0xdfa72d){if(!_0xdfa72d[_0x71ca('0x3b')]||_0xdfa72d[_0x71ca('0x3b')]!==_0x71ca('0x3c')){logger[_0x71ca('0x3d')](util[_0x71ca('0x3f')](_0xdfa72d,{'showHidden':![],'depth':null}));}}});}exports[_0x71ca('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 2334d03..94d13bb 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4da=['format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','update','system','timeout'];(function(_0x216794,_0xca1003){var _0x573284=function(_0x738bb2){while(--_0x738bb2){_0x216794['push'](_0x216794['shift']());}};_0x573284(++_0xca1003);}(_0xf4da,0x190));var _0xaf4d=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xf4da[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xaf4d('0x0'));var moment=require(_0xaf4d('0x1'));var Redis=require(_0xaf4d('0x2'));var util=require(_0xaf4d('0x3'));var config=require(_0xaf4d('0x4'));var db=require(_0xaf4d('0x5'))['db'];var logger=require(_0xaf4d('0x6'))(_0xaf4d('0x7'));config[_0xaf4d('0x8')]=_[_0xaf4d('0x9')](config[_0xaf4d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xaf4d('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0xdffcf1=[];return db[_0xaf4d('0xb')][_0xaf4d('0xc')]({'raw':!![],'attributes':['id',_0xaf4d('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xaf4d('0xe'))}}})[_0xaf4d('0xf')](function(_0x1462c8){if(_0x1462c8&&_0x1462c8[_0xaf4d('0x10')]){_0xdffcf1=_['map'](_0x1462c8||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xdffcf1['join']());return db[_0xaf4d('0xb')][_0xaf4d('0x11')]({'closeReason':_0xaf4d('0x12'),'disposition':_0xaf4d('0x13'),'closed':!![],'closedAt':moment()[_0xaf4d('0x14')](_0xaf4d('0x15'))},{'where':{'id':_0xdffcf1}});}})[_0xaf4d('0xf')](function(){if(_0xdffcf1&&_0xdffcf1[_0xaf4d('0x10')]){logger[_0xaf4d('0x16')](_0xaf4d('0x17'),_0xdffcf1['join']());for(var _0x51a8f6=0x0;_0x51a8f6<_0xdffcf1[_0xaf4d('0x10')];_0x51a8f6++){io[_0xaf4d('0x18')](_0xaf4d('0x19'),{'id':_0xdffcf1[_0x51a8f6],'closed':!![]});}}})[_0xaf4d('0x1a')](function(_0x15d598){logger[_0xaf4d('0x1b')](_0xaf4d('0x1c'),_0x15d598?util[_0xaf4d('0x1d')](_0x15d598,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2d80=['update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','length','info','join'];(function(_0x11d6c9,_0x32c4fe){var _0x14ae28=function(_0x1890ab){while(--_0x1890ab){_0x11d6c9['push'](_0x11d6c9['shift']());}};_0x14ae28(++_0x32c4fe);}(_0x2d80,0xac));var _0x02d8=function(_0xf5eaa0,_0x5bfa29){_0xf5eaa0=_0xf5eaa0-0x0;var _0x47039e=_0x2d80[_0xf5eaa0];return _0x47039e;};'use strict';var _=require(_0x02d8('0x0'));var moment=require(_0x02d8('0x1'));var Redis=require(_0x02d8('0x2'));var util=require(_0x02d8('0x3'));var config=require('../../config/environment');var db=require(_0x02d8('0x4'))['db'];var logger=require(_0x02d8('0x5'))('schedule');config[_0x02d8('0x6')]=_[_0x02d8('0x7')](config[_0x02d8('0x6')],{'host':_0x02d8('0x8'),'port':0x18eb});var io=require(_0x02d8('0x9'))(new Redis(config[_0x02d8('0x6')]));function closeInteractions(){var _0x18a35c=[];return db[_0x02d8('0xa')][_0x02d8('0xb')]({'raw':!![],'attributes':['id',_0x02d8('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x02d8('0xd'))}}})['then'](function(_0x434c64){if(_0x434c64&&_0x434c64[_0x02d8('0xe')]){_0x18a35c=_['map'](_0x434c64||[],'id');logger[_0x02d8('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x18a35c[_0x02d8('0x10')]());return db[_0x02d8('0xa')][_0x02d8('0x11')]({'closeReason':_0x02d8('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x02d8('0x13')](_0x02d8('0x14'))},{'where':{'id':_0x18a35c}});}})['then'](function(){if(_0x18a35c&&_0x18a35c[_0x02d8('0xe')]){logger[_0x02d8('0xf')](_0x02d8('0x15'),_0x18a35c[_0x02d8('0x10')]());for(var _0xa746ea=0x0;_0xa746ea<_0x18a35c[_0x02d8('0xe')];_0xa746ea++){io['emit'](_0x02d8('0x16'),{'id':_0x18a35c[_0xa746ea],'closed':!![]});}}})[_0x02d8('0x17')](function(_0x227a81){logger[_0x02d8('0x18')](_0x02d8('0x19'),_0x227a81?util[_0x02d8('0x1a')](_0x227a81,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e424d9a..0ad1f27 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63e1=['../mysqldb','push','Innocenzo','@xcally.com','now','Biondo','innocenzo.biondo','CmContact','destroy','then','log','contacts1','CmHopper','bulkCreate','finished\x20populating','contacts2','hopper2','catch','util'];(function(_0x5c63ab,_0x220ec5){var _0xb20baa=function(_0x491e41){while(--_0x491e41){_0x5c63ab['push'](_0x5c63ab['shift']());}};_0xb20baa(++_0x220ec5);}(_0x63e1,0xf6));var _0x163e=function(_0x39a757,_0x21348c){_0x39a757=_0x39a757-0x0;var _0x56531a=_0x63e1[_0x39a757];return _0x56531a;};'use strict';var util=require(_0x163e('0x0'));var db=require(_0x163e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x163e('0x2')]({'id':i,'firstName':_0x163e('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x163e('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x163e('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x163e('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x163e('0x5')](),'updatedAt':Date[_0x163e('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x163e('0x2')]({'id':i,'firstName':_0x163e('0x3')+i,'lastName':_0x163e('0x6')+i,'phone':0xf879fb460+i,'email':_0x163e('0x7')+i+_0x163e('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x163e('0x5')](),'updatedAt':Date[_0x163e('0x5')]()});}db[_0x163e('0x8')][_0x163e('0x9')]({'where':{}})[_0x163e('0xa')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x163e('0xa')](function(){console[_0x163e('0xb')]('finished\x20populating',_0x163e('0xc'));return db[_0x163e('0xd')][_0x163e('0x9')]({'where':{}});})[_0x163e('0xa')](function(){return db[_0x163e('0xd')][_0x163e('0xe')](hopper);})['then'](function(){console[_0x163e('0xb')]('finished\x20populating','hopper1');return db['CmContact'][_0x163e('0xe')](contacts2);})[_0x163e('0xa')](function(){console['log'](_0x163e('0xf'),_0x163e('0x10'));return db[_0x163e('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0x163e('0xb')]('finished\x20populating',_0x163e('0x11'));})[_0x163e('0x12')](function(_0x4cfc2c){console['log'](_0x4cfc2c);}); \ No newline at end of file +var _0x58fe=['CmContact','destroy','then','bulkCreate','contacts1','CmHopper','log','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now'];(function(_0x520a02,_0x2cba66){var _0x5152b1=function(_0x2d23f0){while(--_0x2d23f0){_0x520a02['push'](_0x520a02['shift']());}};_0x5152b1(++_0x2cba66);}(_0x58fe,0xef));var _0xe58f=function(_0x5ef161,_0x27d16c){_0x5ef161=_0x5ef161-0x0;var _0x1c6e9e=_0x58fe[_0x5ef161];return _0x1c6e9e;};'use strict';var util=require(_0xe58f('0x0'));var db=require(_0xe58f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xe58f('0x2')+i,'lastName':_0xe58f('0x3')+i,'phone':0xf879fb460+i,'email':_0xe58f('0x4')+i+_0xe58f('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe58f('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe58f('0x7')](),'updatedAt':Date[_0xe58f('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe58f('0x6')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe58f('0x3')+i,'phone':0xf879fb460+i,'email':_0xe58f('0x4')+i+_0xe58f('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe58f('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xe58f('0x7')]()});}db[_0xe58f('0x8')][_0xe58f('0x9')]({'where':{}})[_0xe58f('0xa')](function(){return db['CmContact'][_0xe58f('0xb')](contacts);})[_0xe58f('0xa')](function(){console['log']('finished\x20populating',_0xe58f('0xc'));return db['CmHopper'][_0xe58f('0x9')]({'where':{}});})[_0xe58f('0xa')](function(){return db[_0xe58f('0xd')][_0xe58f('0xb')](hopper);})[_0xe58f('0xa')](function(){console[_0xe58f('0xe')]('finished\x20populating','hopper1');return db[_0xe58f('0x8')][_0xe58f('0xb')](contacts2);})[_0xe58f('0xa')](function(){console[_0xe58f('0xe')](_0xe58f('0xf'),_0xe58f('0x10'));return db[_0xe58f('0xd')][_0xe58f('0xb')](hopper2);})['then'](function(){console[_0xe58f('0xe')](_0xe58f('0xf'),_0xe58f('0x11'));})[_0xe58f('0x12')](function(_0x1881a4){console[_0xe58f('0xe')](_0x1881a4);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 573a5f8..cd92472 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d93=['catch','push','%s%s','agent','friend','udp','ulaw','format','yes','User','bulkCreate','then'];(function(_0x45ebbc,_0x6a14ac){var _0x2048d6=function(_0xbb48c9){while(--_0xbb48c9){_0x45ebbc['push'](_0x45ebbc['shift']());}};_0x2048d6(++_0x6a14ac);}(_0x9d93,0x175));var _0x39d9=function(_0x526707,_0x438310){_0x526707=_0x526707-0x0;var _0x3de748=_0x9d93[_0x526707];return _0x3de748;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x39d9('0x0')]({'name':util['format'](_0x39d9('0x1'),_0x39d9('0x2'),i),'fullname':util['format'](_0x39d9('0x1'),_0x39d9('0x2'),i),'email':util['format']('%s%s@xcally.com','agent',i),'role':_0x39d9('0x2'),'password':'password','internal':0xfa0+i,'type':_0x39d9('0x3'),'transport':[_0x39d9('0x4'),'ws','wss'],'disallow':['all'],'allow':[_0x39d9('0x5')],'defaultuser':util[_0x39d9('0x6')](_0x39d9('0x1'),_0x39d9('0x2'),i),'encryption':_0x39d9('0x7'),'avpf':_0x39d9('0x7'),'force_avp':_0x39d9('0x7'),'icesupport':_0x39d9('0x7'),'dtlsenable':_0x39d9('0x7'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x39d9('0x6')]('\x22%s\x22\x20<%s>',util[_0x39d9('0x6')](_0x39d9('0x1'),_0x39d9('0x2'),i),0xfa0+i)});}db[_0x39d9('0x8')][_0x39d9('0x9')](users)[_0x39d9('0xa')](function(){console['log']('add\x20user');})[_0x39d9('0xb')](function(_0x544e8a){console['log'](_0x544e8a);}); \ No newline at end of file +var _0x99c5=['push','agent','format','%s%s','%s%s@xcally.com','password','friend','udp','all','yes','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0x99c5,0x1ec));var _0x599c=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x99c5[_0x11c573];return _0x6b72de;};'use strict';var util=require(_0x599c('0x0'));var db=require(_0x599c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x599c('0x2')]({'name':util['format']('%s%s',_0x599c('0x3'),i),'fullname':util[_0x599c('0x4')](_0x599c('0x5'),_0x599c('0x3'),i),'email':util[_0x599c('0x4')](_0x599c('0x6'),_0x599c('0x3'),i),'role':_0x599c('0x3'),'password':_0x599c('0x7'),'internal':0xfa0+i,'type':_0x599c('0x8'),'transport':[_0x599c('0x9'),'ws','wss'],'disallow':[_0x599c('0xa')],'allow':['ulaw'],'defaultuser':util[_0x599c('0x4')](_0x599c('0x5'),_0x599c('0x3'),i),'encryption':_0x599c('0xb'),'avpf':'yes','force_avp':_0x599c('0xb'),'icesupport':_0x599c('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x599c('0xc'),'dtlssetup':'actpass','callerid':util[_0x599c('0x4')]('\x22%s\x22\x20<%s>',util[_0x599c('0x4')](_0x599c('0x5'),_0x599c('0x3'),i),0xfa0+i)});}db[_0x599c('0xd')][_0x599c('0xe')](users)[_0x599c('0xf')](function(){console[_0x599c('0x10')](_0x599c('0x11'));})[_0x599c('0x12')](function(_0x50a492){console[_0x599c('0x10')](_0x50a492);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b072c50..153f6af 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa533=['removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','remoteAddress','request','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','%s:queue:%s','Agents','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','SmsQueue','MailQueues','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','MailInteractions'];(function(_0x4bd043,_0x2ae539){var _0x4333f0=function(_0x55a839){while(--_0x55a839){_0x4bd043['push'](_0x4bd043['shift']());}};_0x4333f0(++_0x2ae539);}(_0xa533,0x1c6));var _0x3a53=function(_0x1a1187,_0x5b9992){_0x1a1187=_0x1a1187-0x0;var _0xcabb7a=_0xa533[_0x1a1187];return _0xcabb7a;};'use strict';var _=require(_0x3a53('0x0'));var util=require(_0x3a53('0x1'));var BPromise=require(_0x3a53('0x2'));var db=require(_0x3a53('0x3'))['db'];var config=require(_0x3a53('0x4'));var queryQueues={'attributes':['id',_0x3a53('0x5')],'include':[{'as':'Agents','model':db[_0x3a53('0x6')],'attributes':['id',_0x3a53('0x5'),_0x3a53('0x7')],'raw':!![],'where':{'role':_0x3a53('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3a53('0x5')],'where':{'role':_0x3a53('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x3a53('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x3a53('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x3a53('0xa')],'where':{'type':_0x3a53('0xb')}};function getAssociatedResources(_0xf547ce,_0x21ea52,_0x284c21){return db[_0x3a53('0xc')]['findOne']({'where':{'name':_0xf547ce,'userProfileId':_0x21ea52},'raw':!![]})[_0x3a53('0xd')](function(_0x42f653){if(_0x42f653){if(_0x42f653[_0x3a53('0xe')]){switch(_0xf547ce){case _0x3a53('0xf'):case _0x3a53('0x10'):case _0x3a53('0x11'):case _0x3a53('0x12'):case'MailQueues':case _0x3a53('0x13'):case _0x3a53('0x14'):return db[_0x284c21][_0x3a53('0x15')](queryQueues);case _0x3a53('0x16'):return db[_0x284c21]['findAll'](queryTelephones);case _0x3a53('0x17'):return db[_0x284c21]['findAll'](queryTrunks);case _0x3a53('0x18'):return db[_0x284c21]['findAll'](queryCampaigns);}}else{return db[_0x3a53('0x19')][_0x3a53('0x15')]({'attributes':[_0x3a53('0x1a')],'where':{'sectionId':_0x42f653['id']},'raw':!![]})['then'](function(_0x1047af){if(_0x1047af){var _0x13a8de={'where':{'id':_[_0x3a53('0x1b')](_0x1047af,'resourceId')},'raw':!![]};switch(_0x284c21){case'User':_0x13a8de[_0x3a53('0x1c')][_0x3a53('0x7')]='telephone';break;case'Campaign':_0x13a8de[_0x3a53('0x1c')][_0x3a53('0xa')]=_0x3a53('0xb');break;}return db[_0x284c21][_0x3a53('0x15')](_0x13a8de);}else{return[];}});}}else{return[];}})[_0x3a53('0xd')](function(_0x2fd945){return _0x2fd945;});}function joinOrLeaveQueues(_0x256e48,_0x1749fd,_0x43a9a8,_0x4b0295){_0x256e48[_0x1749fd](util['format'](_0x3a53('0x1d'),_0x43a9a8,_0x4b0295['name']));if(_0x4b0295['Agents']){for(var _0x27b52b=0x0;_0x27b52b<_0x4b0295[_0x3a53('0x1e')]['length'];_0x27b52b+=0x1){_0x256e48[_0x1749fd](util[_0x3a53('0x1f')](_0x3a53('0x20'),_0x4b0295[_0x3a53('0x1e')][_0x27b52b]['name']));}}}function joinOrLeave(_0x5ec1e2,_0x42604e,_0x28478c){var _0x50dadd;if(_0x5ec1e2[_0x3a53('0x21')][_0x3a53('0x22')]['id']){db[_0x3a53('0x6')][_0x3a53('0x23')]({'attributes':['id',_0x3a53('0x5'),_0x3a53('0x7'),_0x3a53('0x24')],'where':{'id':_0x5ec1e2[_0x3a53('0x21')][_0x3a53('0x22')]['id']},'include':[{'model':db[_0x3a53('0x25')],'as':_0x3a53('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x27')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x28')],'as':_0x3a53('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x2a')],'as':_0x3a53('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x2c')],'as':_0x3a53('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x3a53('0x2e')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x3a53('0xd')](function(_0x905690){if(_0x905690){_0x50dadd=_0x905690;_0x5ec1e2[_0x42604e](util['format'](_0x3a53('0x20'),_0x905690['name']));var _0x5e45c0=[];switch(_0x905690[_0x3a53('0x7')]){case'admin':_0x5ec1e2[_0x42604e](_0x3a53('0x2f'));_0x5ec1e2[_0x42604e](_0x3a53('0x30'));if(queryQueues[_0x3a53('0x31')](_0x3a53('0x32'))){delete queryQueues[_0x3a53('0x32')];}_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x34')][_0x3a53('0x15')](queryQueues));_0x5e45c0['push'](db['ChatQueue'][_0x3a53('0x15')](queryQueues));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x35')][_0x3a53('0x15')](queryQueues));_0x5e45c0[_0x3a53('0x33')](db['SmsQueue']['findAll'](queryQueues));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x36')][_0x3a53('0x15')](queryQueues));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x37')][_0x3a53('0x15')](queryQueues));_0x5e45c0[_0x3a53('0x33')](db['WhatsappQueue'][_0x3a53('0x15')](queryQueues));_0x5e45c0['push'](db[_0x3a53('0x6')][_0x3a53('0x15')](queryTelephones));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x38')][_0x3a53('0x15')](queryTrunks));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x39')]['findAll'](queryCampaigns));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x6')][_0x3a53('0x15')](queryAgents));break;case _0x3a53('0x3a'):_0x5ec1e2[_0x42604e](_0x3a53('0x2f'));_0x5ec1e2[_0x42604e]('voice:outbound');_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0xf'),_0x905690[_0x3a53('0x24')],'VoiceQueue'));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources('ChatQueues',_0x905690[_0x3a53('0x24')],'ChatQueue'));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x11'),_0x905690[_0x3a53('0x24')],_0x3a53('0x35')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x12'),_0x905690['userProfileId'],_0x3a53('0x3b')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x3c'),_0x905690[_0x3a53('0x24')],_0x3a53('0x36')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x13'),_0x905690[_0x3a53('0x24')],_0x3a53('0x37')));_0x5e45c0['push'](getAssociatedResources(_0x3a53('0x14'),_0x905690[_0x3a53('0x24')],_0x3a53('0x3d')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x16'),_0x905690['userProfileId'],_0x3a53('0x6')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x17'),_0x905690[_0x3a53('0x24')],_0x3a53('0x38')));_0x5e45c0[_0x3a53('0x33')](getAssociatedResources(_0x3a53('0x18'),_0x905690[_0x3a53('0x24')],'Campaign'));_0x5e45c0[_0x3a53('0x33')](db[_0x3a53('0x6')][_0x3a53('0x15')](queryAgents));break;case _0x3a53('0x8'):_0x5ec1e2[_0x42604e](_0x3a53('0x2f'));_0x5ec1e2[_0x42604e]('voice:outbound');_0x5e45c0[_0x3a53('0x33')](_0x905690[_0x3a53('0x3e')]({'attributes':['id',_0x3a53('0x5')]}));_0x5e45c0['push'](_0x905690['getChatQueues']({'attributes':['id','name']}));_0x5e45c0['push'](_0x905690[_0x3a53('0x3f')]({'attributes':['id','name']}));_0x5e45c0[_0x3a53('0x33')](_0x905690[_0x3a53('0x40')]({'attributes':['id','name']}));_0x5e45c0[_0x3a53('0x33')](_0x905690[_0x3a53('0x41')]({'attributes':['id',_0x3a53('0x5')]}));_0x5e45c0[_0x3a53('0x33')](_0x905690[_0x3a53('0x42')]({'attributes':['id',_0x3a53('0x5')]}));_0x5e45c0['push'](_0x905690[_0x3a53('0x43')]({'attributes':['id','name']}));break;}return BPromise[_0x3a53('0x44')](_0x5e45c0);}})['then'](function(_0x17a803){if(_0x17a803&&_0x17a803[_0x3a53('0x45')]){for(var _0x2ead88=0x0;_0x2ead88<_0x17a803['length'];_0x2ead88+=0x1){for(var _0xaa4b1c=0x0;_0xaa4b1c<_0x17a803[_0x2ead88][_0x3a53('0x45')];_0xaa4b1c+=0x1){switch(_0x2ead88){case 0x0:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x46'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x1:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x47'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x2:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x48'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x3:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x49'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x4:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,'mail',_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x5:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x4a'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x6:joinOrLeaveQueues(_0x5ec1e2,_0x42604e,_0x3a53('0x4b'),_0x17a803[_0x2ead88][_0xaa4b1c]);break;case 0x7:if(_0x50dadd[_0x3a53('0x7')]!==_0x3a53('0x8'))_0x5ec1e2[_0x42604e](util['format']('telephone:%s',_0x17a803[_0x2ead88][_0xaa4b1c]['name']));break;case 0x8:if(_0x50dadd[_0x3a53('0x7')]!==_0x3a53('0x8'))_0x5ec1e2[_0x42604e](util[_0x3a53('0x1f')](_0x3a53('0x4c'),_0x17a803[_0x2ead88][_0xaa4b1c]['name']));break;case 0x9:if(_0x50dadd[_0x3a53('0x7')]!==_0x3a53('0x8'))_0x5ec1e2[_0x42604e](util[_0x3a53('0x1f')]('campaign:%s:%s',_0x17a803[_0x2ead88][_0xaa4b1c][_0x3a53('0xa')],_0x17a803[_0x2ead88][_0xaa4b1c]['name']));break;case 0xa:_0x5ec1e2[_0x42604e](util[_0x3a53('0x1f')](_0x3a53('0x20'),_0x17a803[_0x2ead88][_0xaa4b1c][_0x3a53('0x5')]));break;}}}}})[_0x3a53('0xd')](function(){if(_0x42604e===_0x3a53('0x4d')){var _0x8f834d=_[_0x3a53('0x1b')](_0x50dadd[_0x3a53('0x26')],'id');return _0x50dadd[_0x3a53('0x4e')](_0x8f834d)[_0x3a53('0xd')](function(){for(var _0x57a364=0x0;_0x57a364<_0x8f834d[_0x3a53('0x45')];_0x57a364+=0x1){_0x28478c[_0x3a53('0x4f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x8f834d[_0x57a364]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0xd')](function(){if(_0x42604e===_0x3a53('0x4d')){var _0x13eaea=_['map'](_0x50dadd[_0x3a53('0x50')],'id');return _0x50dadd[_0x3a53('0x51')](_0x13eaea)[_0x3a53('0xd')](function(){for(var _0x19fc89=0x0;_0x19fc89<_0x13eaea['length'];_0x19fc89+=0x1){_0x28478c[_0x3a53('0x4f')](_0x3a53('0x52'),{'MailInteractionId':Number(_0x13eaea[_0x19fc89]),'UserId':Number(_0x50dadd['id'])});}});}})['then'](function(){if(_0x42604e===_0x3a53('0x4d')){var _0x1977e5=_[_0x3a53('0x1b')](_0x50dadd[_0x3a53('0x29')],'id');return _0x50dadd[_0x3a53('0x53')](_0x1977e5)['then'](function(){for(var _0x543022=0x0;_0x543022<_0x1977e5[_0x3a53('0x45')];_0x543022+=0x1){_0x28478c['emit'](_0x3a53('0x54'),{'FaxInteractionId':Number(_0x1977e5[_0x543022]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0xd')](function(){if(_0x42604e===_0x3a53('0x4d')){var _0x484db5=_['map'](_0x50dadd[_0x3a53('0x2b')],'id');return _0x50dadd[_0x3a53('0x55')](_0x484db5)[_0x3a53('0xd')](function(){for(var _0x871dd7=0x0;_0x871dd7<_0x484db5[_0x3a53('0x45')];_0x871dd7+=0x1){_0x28478c[_0x3a53('0x4f')](_0x3a53('0x56'),{'SmsInteractionId':Number(_0x484db5[_0x871dd7]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0xd')](function(){if(_0x42604e==='leave'){var _0x55af36=_[_0x3a53('0x1b')](_0x50dadd[_0x3a53('0x2d')],'id');return _0x50dadd[_0x3a53('0x57')](_0x55af36)[_0x3a53('0xd')](function(){for(var _0x44025b=0x0;_0x44025b<_0x55af36[_0x3a53('0x45')];_0x44025b+=0x1){_0x28478c[_0x3a53('0x4f')](_0x3a53('0x58'),{'OpenchannelInteractionId':Number(_0x55af36[_0x44025b]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0xd')](function(){if(_0x42604e==='leave'){var _0x3739e1=_[_0x3a53('0x1b')](_0x50dadd[_0x3a53('0x59')],'id');return _0x50dadd[_0x3a53('0x5a')](_0x3739e1)[_0x3a53('0xd')](function(){for(var _0x5e6989=0x0;_0x5e6989<_0x3739e1[_0x3a53('0x45')];_0x5e6989+=0x1){_0x28478c[_0x3a53('0x4f')](_0x3a53('0x5b'),{'WhatsappInteractionId':Number(_0x3739e1[_0x5e6989]),'UserId':Number(_0x50dadd['id'])});}});}})[_0x3a53('0x5c')](function(_0x5f5c41){_0x5ec1e2[_0x3a53('0x5d')](_0x5f5c41);});}}function onDisconnect(_0xba6e66,_0x478e42){joinOrLeave(_0xba6e66,_0x3a53('0x4d'),_0x478e42);}function onConnect(_0x4eb611){joinOrLeave(_0x4eb611,_0x3a53('0x5e'));}exports[_0x3a53('0x5f')]=function(_0x49a521){_0x49a521['on'](_0x3a53('0x60'),function(_0x1c1d4d){_0x1c1d4d[_0x3a53('0x61')](0x0);_0x1c1d4d['address']=_0x1c1d4d['request'][_0x3a53('0x60')][_0x3a53('0x62')]+':'+_0x1c1d4d[_0x3a53('0x63')][_0x3a53('0x60')]['remotePort'];_0x1c1d4d[_0x3a53('0x64')]=new Date();_0x1c1d4d[_0x3a53('0x5d')]=function(_0x437313){console['log'](_0x3a53('0x65')+_0x1c1d4d[_0x3a53('0x66')][_0x3a53('0x5')]+'['+_0x1c1d4d[_0x3a53('0x67')]+']',_0x437313);};_0x1c1d4d['on'](_0x3a53('0x68'),function(){onDisconnect(_0x1c1d4d,_0x49a521);_0x1c1d4d[_0x3a53('0x5d')](_0x3a53('0x69'));});onConnect(_0x1c1d4d);_0x1c1d4d[_0x3a53('0x5d')](_0x3a53('0x6a'));});}; \ No newline at end of file +var _0x39b2=['ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','%s:queue:%s','length','user:%s','userProfileId','handshake','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','ChatInteractions','removeChatInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','connection','address','request','remotePort','connectedAt','SocketIO\x20','disconnect','CONNECTED','lodash','bluebird','./environment','Agents','User','role','agent','name','ivr','UserProfileSection','VoiceQueues'];(function(_0x5542a9,_0x24f016){var _0x56dca5=function(_0x51db81){while(--_0x51db81){_0x5542a9['push'](_0x5542a9['shift']());}};_0x56dca5(++_0x24f016);}(_0x39b2,0x10f));var _0x239b=function(_0x5b3ed2,_0x1f2dc8){_0x5b3ed2=_0x5b3ed2-0x0;var _0x370f36=_0x39b2[_0x5b3ed2];return _0x370f36;};'use strict';var _=require(_0x239b('0x0'));var util=require('util');var BPromise=require(_0x239b('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x239b('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x239b('0x3'),'model':db[_0x239b('0x4')],'attributes':['id','name',_0x239b('0x5')],'raw':!![],'where':{'role':_0x239b('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x239b('0x7')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x239b('0x7'),'type'],'where':{'type':_0x239b('0x8')}};function getAssociatedResources(_0x3a1846,_0x214a89,_0xe20a23){return db[_0x239b('0x9')]['findOne']({'where':{'name':_0x3a1846,'userProfileId':_0x214a89},'raw':!![]})['then'](function(_0x12b3b1){if(_0x12b3b1){if(_0x12b3b1['autoAssociation']){switch(_0x3a1846){case _0x239b('0xa'):case _0x239b('0xb'):case'FaxQueues':case _0x239b('0xc'):case _0x239b('0xd'):case _0x239b('0xe'):case _0x239b('0xf'):return db[_0xe20a23]['findAll'](queryQueues);case _0x239b('0x10'):return db[_0xe20a23][_0x239b('0x11')](queryTelephones);case'Trunks':return db[_0xe20a23]['findAll'](queryTrunks);case _0x239b('0x12'):return db[_0xe20a23]['findAll'](queryCampaigns);}}else{return db[_0x239b('0x13')][_0x239b('0x11')]({'attributes':[_0x239b('0x14')],'where':{'sectionId':_0x12b3b1['id']},'raw':!![]})[_0x239b('0x15')](function(_0x360dc0){if(_0x360dc0){var _0x2c875f={'where':{'id':_[_0x239b('0x16')](_0x360dc0,_0x239b('0x14'))},'raw':!![]};switch(_0xe20a23){case _0x239b('0x4'):_0x2c875f[_0x239b('0x17')][_0x239b('0x5')]='telephone';break;case _0x239b('0x18'):_0x2c875f[_0x239b('0x17')]['type']='ivr';break;}return db[_0xe20a23][_0x239b('0x11')](_0x2c875f);}else{return[];}});}}else{return[];}})['then'](function(_0x351743){return _0x351743;});}function joinOrLeaveQueues(_0x2069f6,_0x2abdf7,_0x5e85ad,_0x33c1db){_0x2069f6[_0x2abdf7](util[_0x239b('0x19')](_0x239b('0x1a'),_0x5e85ad,_0x33c1db[_0x239b('0x7')]));if(_0x33c1db['Agents']){for(var _0x3efc12=0x0;_0x3efc12<_0x33c1db[_0x239b('0x3')][_0x239b('0x1b')];_0x3efc12+=0x1){_0x2069f6[_0x2abdf7](util[_0x239b('0x19')](_0x239b('0x1c'),_0x33c1db[_0x239b('0x3')][_0x3efc12]['name']));}}}function joinOrLeave(_0xde9864,_0x2152d8,_0x4f824b){var _0x449535;if(_0xde9864['handshake']['query']['id']){db['User']['find']({'attributes':['id',_0x239b('0x7'),_0x239b('0x5'),_0x239b('0x1d')],'where':{'id':_0xde9864[_0x239b('0x1e')][_0x239b('0x1f')]['id']},'include':[{'model':db[_0x239b('0x20')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x239b('0x21')],'as':_0x239b('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x239b('0x23')],'as':_0x239b('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x239b('0x25')],'as':_0x239b('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x239b('0x27')],'as':_0x239b('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x239b('0x29')],'as':_0x239b('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x239b('0x15')](function(_0x396198){if(_0x396198){_0x449535=_0x396198;_0xde9864[_0x2152d8](util[_0x239b('0x19')](_0x239b('0x1c'),_0x396198['name']));var _0xb161da=[];switch(_0x396198['role']){case _0x239b('0x2b'):_0xde9864[_0x2152d8](_0x239b('0x2c'));_0xde9864[_0x2152d8](_0x239b('0x2d'));if(queryQueues[_0x239b('0x2e')]('include')){delete queryQueues[_0x239b('0x2f')];}_0xb161da[_0x239b('0x30')](db['VoiceQueue'][_0x239b('0x11')](queryQueues));_0xb161da[_0x239b('0x30')](db[_0x239b('0x31')][_0x239b('0x11')](queryQueues));_0xb161da[_0x239b('0x30')](db['FaxQueue']['findAll'](queryQueues));_0xb161da['push'](db['SmsQueue'][_0x239b('0x11')](queryQueues));_0xb161da['push'](db[_0x239b('0x32')]['findAll'](queryQueues));_0xb161da[_0x239b('0x30')](db[_0x239b('0x33')][_0x239b('0x11')](queryQueues));_0xb161da['push'](db[_0x239b('0x34')][_0x239b('0x11')](queryQueues));_0xb161da[_0x239b('0x30')](db[_0x239b('0x4')][_0x239b('0x11')](queryTelephones));_0xb161da[_0x239b('0x30')](db[_0x239b('0x35')][_0x239b('0x11')](queryTrunks));_0xb161da[_0x239b('0x30')](db[_0x239b('0x18')]['findAll'](queryCampaigns));_0xb161da[_0x239b('0x30')](db['User'][_0x239b('0x11')](queryAgents));break;case _0x239b('0x36'):_0xde9864[_0x2152d8](_0x239b('0x2c'));_0xde9864[_0x2152d8](_0x239b('0x2d'));_0xb161da['push'](getAssociatedResources(_0x239b('0xa'),_0x396198[_0x239b('0x1d')],_0x239b('0x37')));_0xb161da['push'](getAssociatedResources(_0x239b('0xb'),_0x396198['userProfileId'],'ChatQueue'));_0xb161da[_0x239b('0x30')](getAssociatedResources('FaxQueues',_0x396198[_0x239b('0x1d')],'FaxQueue'));_0xb161da[_0x239b('0x30')](getAssociatedResources(_0x239b('0xc'),_0x396198[_0x239b('0x1d')],'SmsQueue'));_0xb161da[_0x239b('0x30')](getAssociatedResources('MailQueues',_0x396198[_0x239b('0x1d')],_0x239b('0x32')));_0xb161da[_0x239b('0x30')](getAssociatedResources(_0x239b('0xe'),_0x396198[_0x239b('0x1d')],'OpenchannelQueue'));_0xb161da[_0x239b('0x30')](getAssociatedResources('WhatsappQueues',_0x396198[_0x239b('0x1d')],_0x239b('0x34')));_0xb161da[_0x239b('0x30')](getAssociatedResources(_0x239b('0x10'),_0x396198['userProfileId'],_0x239b('0x4')));_0xb161da['push'](getAssociatedResources('Trunks',_0x396198['userProfileId'],'Trunk'));_0xb161da[_0x239b('0x30')](getAssociatedResources(_0x239b('0x12'),_0x396198[_0x239b('0x1d')],'Campaign'));_0xb161da[_0x239b('0x30')](db[_0x239b('0x4')][_0x239b('0x11')](queryAgents));break;case _0x239b('0x6'):_0xde9864[_0x2152d8]('voice:inbound');_0xde9864[_0x2152d8](_0x239b('0x2d'));_0xb161da[_0x239b('0x30')](_0x396198[_0x239b('0x38')]({'attributes':['id','name']}));_0xb161da[_0x239b('0x30')](_0x396198[_0x239b('0x39')]({'attributes':['id',_0x239b('0x7')]}));_0xb161da[_0x239b('0x30')](_0x396198['getFaxQueues']({'attributes':['id',_0x239b('0x7')]}));_0xb161da['push'](_0x396198[_0x239b('0x3a')]({'attributes':['id',_0x239b('0x7')]}));_0xb161da[_0x239b('0x30')](_0x396198[_0x239b('0x3b')]({'attributes':['id',_0x239b('0x7')]}));_0xb161da[_0x239b('0x30')](_0x396198[_0x239b('0x3c')]({'attributes':['id',_0x239b('0x7')]}));_0xb161da[_0x239b('0x30')](_0x396198[_0x239b('0x3d')]({'attributes':['id',_0x239b('0x7')]}));break;}return BPromise[_0x239b('0x3e')](_0xb161da);}})[_0x239b('0x15')](function(_0x31bff6){if(_0x31bff6&&_0x31bff6[_0x239b('0x1b')]){for(var _0x1d2fa9=0x0;_0x1d2fa9<_0x31bff6[_0x239b('0x1b')];_0x1d2fa9+=0x1){for(var _0x1ffebc=0x0;_0x1ffebc<_0x31bff6[_0x1d2fa9][_0x239b('0x1b')];_0x1ffebc+=0x1){switch(_0x1d2fa9){case 0x0:joinOrLeaveQueues(_0xde9864,_0x2152d8,_0x239b('0x3f'),_0x31bff6[_0x1d2fa9][_0x1ffebc]);break;case 0x1:joinOrLeaveQueues(_0xde9864,_0x2152d8,_0x239b('0x40'),_0x31bff6[_0x1d2fa9][_0x1ffebc]);break;case 0x2:joinOrLeaveQueues(_0xde9864,_0x2152d8,_0x239b('0x41'),_0x31bff6[_0x1d2fa9][_0x1ffebc]);break;case 0x3:joinOrLeaveQueues(_0xde9864,_0x2152d8,_0x239b('0x42'),_0x31bff6[_0x1d2fa9][_0x1ffebc]);break;case 0x4:joinOrLeaveQueues(_0xde9864,_0x2152d8,'mail',_0x31bff6[_0x1d2fa9][_0x1ffebc]);break;case 0x5:joinOrLeaveQueues(_0xde9864,_0x2152d8,_0x239b('0x43'),_0x31bff6[_0x1d2fa9][_0x1ffebc]);break;case 0x6:joinOrLeaveQueues(_0xde9864,_0x2152d8,_0x239b('0x44'),_0x31bff6[_0x1d2fa9][_0x1ffebc]);break;case 0x7:if(_0x449535[_0x239b('0x5')]!==_0x239b('0x6'))_0xde9864[_0x2152d8](util['format'](_0x239b('0x45'),_0x31bff6[_0x1d2fa9][_0x1ffebc][_0x239b('0x7')]));break;case 0x8:if(_0x449535[_0x239b('0x5')]!=='agent')_0xde9864[_0x2152d8](util[_0x239b('0x19')](_0x239b('0x46'),_0x31bff6[_0x1d2fa9][_0x1ffebc]['name']));break;case 0x9:if(_0x449535['role']!==_0x239b('0x6'))_0xde9864[_0x2152d8](util['format'](_0x239b('0x47'),_0x31bff6[_0x1d2fa9][_0x1ffebc][_0x239b('0x48')],_0x31bff6[_0x1d2fa9][_0x1ffebc][_0x239b('0x7')]));break;case 0xa:_0xde9864[_0x2152d8](util[_0x239b('0x19')]('user:%s',_0x31bff6[_0x1d2fa9][_0x1ffebc][_0x239b('0x7')]));break;}}}}})[_0x239b('0x15')](function(){if(_0x2152d8===_0x239b('0x49')){var _0x1a2903=_['map'](_0x449535[_0x239b('0x4a')],'id');return _0x449535[_0x239b('0x4b')](_0x1a2903)[_0x239b('0x15')](function(){for(var _0x59ad0d=0x0;_0x59ad0d<_0x1a2903[_0x239b('0x1b')];_0x59ad0d+=0x1){_0x4f824b[_0x239b('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1a2903[_0x59ad0d]),'UserId':Number(_0x449535['id'])});}});}})[_0x239b('0x15')](function(){if(_0x2152d8===_0x239b('0x49')){var _0x40c9e2=_[_0x239b('0x16')](_0x449535[_0x239b('0x22')],'id');return _0x449535['removeMailInteractions'](_0x40c9e2)[_0x239b('0x15')](function(){for(var _0x32fdc9=0x0;_0x32fdc9<_0x40c9e2[_0x239b('0x1b')];_0x32fdc9+=0x1){_0x4f824b[_0x239b('0x4c')](_0x239b('0x4d'),{'MailInteractionId':Number(_0x40c9e2[_0x32fdc9]),'UserId':Number(_0x449535['id'])});}});}})[_0x239b('0x15')](function(){if(_0x2152d8===_0x239b('0x49')){var _0x332092=_['map'](_0x449535[_0x239b('0x24')],'id');return _0x449535[_0x239b('0x4e')](_0x332092)[_0x239b('0x15')](function(){for(var _0xe4e22b=0x0;_0xe4e22b<_0x332092['length'];_0xe4e22b+=0x1){_0x4f824b[_0x239b('0x4c')](_0x239b('0x4f'),{'FaxInteractionId':Number(_0x332092[_0xe4e22b]),'UserId':Number(_0x449535['id'])});}});}})['then'](function(){if(_0x2152d8===_0x239b('0x49')){var _0x30ea33=_['map'](_0x449535['SmsInteractions'],'id');return _0x449535['removeSmsInteractions'](_0x30ea33)[_0x239b('0x15')](function(){for(var _0x3b75d2=0x0;_0x3b75d2<_0x30ea33[_0x239b('0x1b')];_0x3b75d2+=0x1){_0x4f824b[_0x239b('0x4c')](_0x239b('0x50'),{'SmsInteractionId':Number(_0x30ea33[_0x3b75d2]),'UserId':Number(_0x449535['id'])});}});}})['then'](function(){if(_0x2152d8==='leave'){var _0x3d6f28=_[_0x239b('0x16')](_0x449535[_0x239b('0x28')],'id');return _0x449535[_0x239b('0x51')](_0x3d6f28)[_0x239b('0x15')](function(){for(var _0x29b4b9=0x0;_0x29b4b9<_0x3d6f28[_0x239b('0x1b')];_0x29b4b9+=0x1){_0x4f824b['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3d6f28[_0x29b4b9]),'UserId':Number(_0x449535['id'])});}});}})['then'](function(){if(_0x2152d8===_0x239b('0x49')){var _0x18a29e=_[_0x239b('0x16')](_0x449535[_0x239b('0x2a')],'id');return _0x449535[_0x239b('0x52')](_0x18a29e)[_0x239b('0x15')](function(){for(var _0x167bba=0x0;_0x167bba<_0x18a29e[_0x239b('0x1b')];_0x167bba+=0x1){_0x4f824b[_0x239b('0x4c')](_0x239b('0x53'),{'WhatsappInteractionId':Number(_0x18a29e[_0x167bba]),'UserId':Number(_0x449535['id'])});}});}})[_0x239b('0x54')](function(_0x341e65){_0xde9864[_0x239b('0x55')](_0x341e65);});}}function onDisconnect(_0xa3290f,_0x4ff191){joinOrLeave(_0xa3290f,_0x239b('0x49'),_0x4ff191);}function onConnect(_0x570aa5){joinOrLeave(_0x570aa5,'join');}exports['default']=function(_0x2ff6e3){_0x2ff6e3['on'](_0x239b('0x56'),function(_0x356ce3){_0x356ce3['setMaxListeners'](0x0);_0x356ce3[_0x239b('0x57')]=_0x356ce3[_0x239b('0x58')][_0x239b('0x56')]['remoteAddress']+':'+_0x356ce3['request']['connection'][_0x239b('0x59')];_0x356ce3[_0x239b('0x5a')]=new Date();_0x356ce3[_0x239b('0x55')]=function(_0x1cfd62){console[_0x239b('0x55')](_0x239b('0x5b')+_0x356ce3['nsp']['name']+'['+_0x356ce3['address']+']',_0x1cfd62);};_0x356ce3['on'](_0x239b('0x5c'),function(){onDisconnect(_0x356ce3,_0x2ff6e3);_0x356ce3['log']('DISCONNECTED');});onConnect(_0x356ce3);_0x356ce3[_0x239b('0x55')](_0x239b('0x5d'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a8f83a4..8cb7ac8 100644 --- a/server/config/triggers/index.js +++ b/server/config/triggers/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bcb=['afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','newinteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','catch','get','motionChannel','event','direction','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','offlineMessage','format','closed','substatus','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','client','http','Chat','ChatInteraction','afterUpdate','closedinteraction','ChatMessage'];(function(_0x51a2aa,_0x8e1d27){var _0x737521=function(_0x1fae50){while(--_0x1fae50){_0x51a2aa['push'](_0x51a2aa['shift']());}};_0x737521(++_0x8e1d27);}(_0x2bcb,0x1ac));var _0xb2bc=function(_0x30aa46,_0x59465c){_0x30aa46=_0x30aa46-0x0;var _0x1b4c19=_0x2bcb[_0x30aa46];return _0x1b4c19;};'use strict';var util=require(_0xb2bc('0x0'));var db=require(_0xb2bc('0x1'))['db'];var jayson=require(_0xb2bc('0x2'));var logger=require('../logger')('triggers');var client=jayson[_0xb2bc('0x3')][_0xb2bc('0x4')]({'port':0x232a});var triggers=[{'channel':_0xb2bc('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xb2bc('0x5'),'model':_0xb2bc('0x6'),'event':_0xb2bc('0x7'),'condition':_0xb2bc('0x8'),'callback':afterUpdate},{'channel':_0xb2bc('0x5'),'model':_0xb2bc('0x9'),'event':_0xb2bc('0xa'),'condition':_0xb2bc('0xb'),'callback':afterCreateMessage},{'channel':_0xb2bc('0x5'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0xb2bc('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0xb2bc('0xc'),'model':_0xb2bc('0xd'),'event':_0xb2bc('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0xb2bc('0xd'),'event':_0xb2bc('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb2bc('0xc'),'model':_0xb2bc('0xe'),'event':_0xb2bc('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xb2bc('0xf'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0xb2bc('0x7'),'condition':_0xb2bc('0x8'),'callback':afterUpdate},{'channel':_0xb2bc('0x10'),'model':'WhatsappMessage','event':_0xb2bc('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb2bc('0x11'),'model':_0xb2bc('0x12'),'event':_0xb2bc('0xa'),'condition':_0xb2bc('0x13'),'callback':afterCreate},{'channel':_0xb2bc('0x11'),'model':'FaxInteraction','event':_0xb2bc('0x7'),'condition':_0xb2bc('0x8'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0xb2bc('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0xb2bc('0x14'),'event':_0xb2bc('0xa'),'condition':_0xb2bc('0x13'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':'afterUpdate','condition':_0xb2bc('0x8'),'callback':afterUpdate},{'channel':_0xb2bc('0x15'),'model':_0xb2bc('0x16'),'event':_0xb2bc('0xa'),'condition':_0xb2bc('0xb'),'callback':afterCreateMessage},{'channel':_0xb2bc('0x17'),'model':_0xb2bc('0x18'),'event':'afterCreate','condition':_0xb2bc('0x13'),'callback':afterCreate},{'channel':_0xb2bc('0x17'),'model':_0xb2bc('0x18'),'event':_0xb2bc('0x7'),'condition':_0xb2bc('0x8'),'callback':afterUpdate},{'channel':_0xb2bc('0x17'),'model':_0xb2bc('0x19'),'event':'afterCreate','condition':_0xb2bc('0xb'),'callback':afterCreateMessage}];function request(_0x58b2bd){return client[_0xb2bc('0x1a')](_0xb2bc('0x1b'),_0x58b2bd)[_0xb2bc('0x1c')](function(_0x461b4b){logger[_0xb2bc('0x1d')]('Trigger,\x20%s','EventManager',_0x461b4b);if(_0x461b4b[_0xb2bc('0x1e')]){if(_0x461b4b[_0xb2bc('0x1e')][_0xb2bc('0x1f')]===0x1f4){logger['error'](_0xb2bc('0x20'),_0xb2bc('0x1b'),_0x461b4b[_0xb2bc('0x1e')]);}}})[_0xb2bc('0x21')](function(_0x2ac21a){logger[_0xb2bc('0x1e')](_0xb2bc('0x20'),_0xb2bc('0x1b'),_0x2ac21a);});}function afterCreateMessage(_0x3f6461){return function(_0xc3fa7a){_0xc3fa7a=_0xc3fa7a[_0xb2bc('0x22')]({'plain':!![]});_0xc3fa7a['channel']=_0x3f6461;_0xc3fa7a[_0xb2bc('0x23')]=_0x3f6461;_0xc3fa7a[_0xb2bc('0x24')]=_0xc3fa7a[_0xb2bc('0x25')];Promise[_0xb2bc('0x26')]()[_0xb2bc('0x1c')](function(){if(typeof _0xc3fa7a['ContactId']===_0xb2bc('0x27'))return null;var _0x835228=_0xb2bc('0x28')+_0xc3fa7a[_0xb2bc('0x29')];return db[_0xb2bc('0x2a')][_0xb2bc('0x2b')](_0x835228,{'type':db[_0xb2bc('0x2c')][_0xb2bc('0x2d')][_0xb2bc('0x2e')],'raw':!![]});})[_0xb2bc('0x1c')](function(_0xfca2f7){if(_0xfca2f7){_0xc3fa7a[_0xb2bc('0x2f')]=_0xfca2f7[0x0];}if(typeof _0xc3fa7a[_0xb2bc('0x30')]===_0xb2bc('0x27'))return;return getAgent(_0xc3fa7a[_0xb2bc('0x30')]);})['then'](function(_0x5a0fe9){if(_0x5a0fe9){_0xc3fa7a[_0xb2bc('0x31')]=util['format'](_0xb2bc('0x32'),_0x5a0fe9[_0xb2bc('0x33')]);_0xc3fa7a[_0xb2bc('0x34')]=_0x5a0fe9;_0xc3fa7a[_0xb2bc('0x35')]=_0x3f6461;return request({'event':_0xb2bc('0x36'),'message':_0xc3fa7a});}else{return request({'event':_0xb2bc('0x37'),'message':_0xc3fa7a});}})[_0xb2bc('0x21')](function(_0x316cc1){logger[_0xb2bc('0x1e')](_0xb2bc('0x20'),'AfterCreateMessage',_0x316cc1);});};}function afterCreateOfflineMessage(_0x4a902d){return function(_0x567c68){_0x567c68=_0x567c68[_0xb2bc('0x22')]({'plain':!![]});_0x567c68[_0xb2bc('0x35')]=_0x4a902d;_0x567c68['motionChannel']=_0x4a902d;_0x567c68['event']=_0xb2bc('0x38');return request({'event':_0x567c68[_0xb2bc('0x24')],'message':_0x567c68});};}function afterCreate(_0x5aff78,_0x5b184b){return function(_0x401ae9){_0x401ae9=_0x401ae9[_0xb2bc('0x22')]({'plain':!![]});_0x401ae9[_0xb2bc('0x35')]=_0x5aff78;_0x401ae9['motionChannel']=_0x5aff78;_0x401ae9[_0xb2bc('0x24')]='opened';Promise['resolve']()[_0xb2bc('0x1c')](function(){var _0x41a09e=_0xb2bc('0x28')+_0x401ae9['ContactId'];return db[_0xb2bc('0x2a')]['query'](_0x41a09e,{'type':db[_0xb2bc('0x2c')][_0xb2bc('0x2d')][_0xb2bc('0x2e')],'raw':!![]});})[_0xb2bc('0x1c')](function(_0x5a7fff){if(_0x5a7fff){_0x401ae9[_0xb2bc('0x2f')]=_0x5a7fff[0x0];}if(typeof _0x401ae9[_0xb2bc('0x30')]==='undefined')return;return getAgent(_0x401ae9['UserId']);})['then'](function(_0x43bce1){if(_0x43bce1){_0x401ae9['interface']=util[_0xb2bc('0x39')](_0xb2bc('0x32'),_0x43bce1[_0xb2bc('0x33')]);_0x401ae9[_0xb2bc('0x34')]=_0x43bce1;}return request({'event':_0x5b184b,'message':_0x401ae9});})[_0xb2bc('0x21')](function(_0x18e4ee){logger['error'](_0xb2bc('0x20'),'AfterCreate',_0x18e4ee);});};}function afterUpdate(_0x449929){return function(_0x41b90b){var _0x5ce9de=_0x41b90b['changed'](_0xb2bc('0x3a'))&&_0x41b90b['closed'];var _0x3a5644=_0x41b90b['changed'](_0xb2bc('0x3b'));if(_0x5ce9de||_0x3a5644){var _0x115de5=_0x5ce9de?_0xb2bc('0x8'):_0xb2bc('0x3b');var _0x4d6808=_0x41b90b[_0xb2bc('0x22')]({'plain':!![]});_0x4d6808['channel']=_0x449929;_0x4d6808[_0xb2bc('0x23')]=_0x449929;_0x4d6808[_0xb2bc('0x24')]=_0x5ce9de?_0xb2bc('0x3a'):_0xb2bc('0x3b');var _0x5cf196=_0xb2bc('0x28')+_0x4d6808[_0xb2bc('0x29')];return db[_0xb2bc('0x2a')][_0xb2bc('0x2b')](_0x5cf196,{'type':db[_0xb2bc('0x2c')][_0xb2bc('0x2d')][_0xb2bc('0x2e')],'raw':!![]})['then'](function(_0x5e5f4d){if(_0x5e5f4d){_0x4d6808[_0xb2bc('0x2f')]=_0x5e5f4d[0x0];}if(typeof _0x4d6808['UserId']===_0xb2bc('0x27'))return;return getAgent(_0x4d6808['UserId']);})[_0xb2bc('0x1c')](function(_0x37382){if(_0x37382){_0x4d6808[_0xb2bc('0x31')]=util[_0xb2bc('0x39')](_0xb2bc('0x32'),_0x37382[_0xb2bc('0x33')]);_0x4d6808[_0xb2bc('0x34')]=_0x37382;}return request({'event':_0x115de5,'message':_0x4d6808});})[_0xb2bc('0x21')](function(_0x1f6483){logger[_0xb2bc('0x1e')](_0xb2bc('0x20'),'AfterUpdate',_0x1f6483);});}};}function getAgent(_0x294d8a){return db[_0xb2bc('0x3c')][_0xb2bc('0x3d')]({'where':{'id':_0x294d8a},'attributes':['id',_0xb2bc('0x33'),_0xb2bc('0x3e'),_0xb2bc('0x3f'),_0xb2bc('0x40')],'raw':!![]})[_0xb2bc('0x1c')](function(_0x4f2d7e){return _0x4f2d7e;});}exports[_0xb2bc('0x41')]=function(){for(var _0x501bb5=0x0;_0x501bb5=_0x33a7f6[_0x93db('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x24379d(_0x3ce1ff);})['catch'](function(_0x336fb2){_0x38efb5(_0x336fb2);});});}; \ No newline at end of file +var _0x968e=['getLicense','role','User','count','agent','agents','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes'];(function(_0x1be220,_0x1208d2){var _0xcc9aa=function(_0x335189){while(--_0x335189){_0x1be220['push'](_0x1be220['shift']());}};_0xcc9aa(++_0x1208d2);}(_0x968e,0x131));var _0xe968=function(_0x211f68,_0x47a58a){_0x211f68=_0x211f68-0x0;var _0x13604e=_0x968e[_0x211f68];return _0x13604e;};'use strict';var _=require(_0xe968('0x0'));var BPromise=require(_0xe968('0x1'));var db=require(_0xe968('0x2'))['db'];var util=require(_0xe968('0x3'));var channels=[_0xe968('0x4'),_0xe968('0x5'),_0xe968('0x6'),_0xe968('0x7'),_0xe968('0x8'),_0xe968('0x9'),_0xe968('0xa')];exports['getChannels']=function(){return channels;};exports[_0xe968('0xb')]=function(_0x1b91f8){_0x1b91f8=_0x1b91f8[_0xe968('0xc')]();return _['includes'](channels,_0x1b91f8);};exports[_0xe968('0xd')]=function(_0x42e5f3,_0x267d06,_0x252828,_0x126a77){var _0x1b6f2b={'loginAttempts':_0x267d06,'blocked':_0x252828};if(!_[_0xe968('0xe')](_0x126a77)){_0x1b6f2b[_0xe968('0xf')]=_0x126a77;}return _0x42e5f3[_0xe968('0x10')](_0x1b6f2b);};exports[_0xe968('0x11')]=function(_0x2d594c){return new BPromise(function(_0x214592,_0x508141){var _0x1ddc1c=0x0;if(_0x2d594c[_0xe968('0x12')]!=='agent'){_0x214592(_0x2d594c);}db[_0xe968('0x13')][_0xe968('0x14')]({'where':{'role':_0xe968('0x15'),'online':!![],'id':{'$ne':_0x2d594c['id']}}})['then'](function(_0x2f6505){_0x1ddc1c=_0x2f6505;return util[_0xe968('0x11')]();})['then'](function(_0x39c8df){if(_0x39c8df&&_0x39c8df['agents']&&_0x1ddc1c>=_0x39c8df[_0xe968('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x214592(_0x2d594c);})['catch'](function(_0x44eaf8){_0x508141(_0x44eaf8);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 9046e2d..e111fb5 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcce8=['send','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Conflict','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','details','error','stack','statusMessage','status'];(function(_0x1e6b5a,_0x34809c){var _0x450e4b=function(_0x1df183){while(--_0x1df183){_0x1e6b5a['push'](_0x1e6b5a['shift']());}};_0x450e4b(++_0x34809c);}(_0xcce8,0x1a5));var _0x8cce=function(_0x4ac8ce,_0x15e0ab){_0x4ac8ce=_0x4ac8ce-0x0;var _0x30d46b=_0xcce8[_0x4ac8ce];return _0x30d46b;};'use strict';var util=require(_0x8cce('0x0'));var logger=require(_0x8cce('0x1'))(_0x8cce('0x2'));var APIError=function(_0x1c4a9d,_0x67fcf1){this[_0x8cce('0x3')]=_0x1c4a9d||_0x8cce('0x4');this[_0x8cce('0x5')]=_0x67fcf1||_0x8cce('0x6');util[_0x8cce('0x7')](APIError,Error);};var APIBadRequestError=function(_0x59c725){this[_0x8cce('0x3')]=_0x59c725||_0x8cce('0x8');this[_0x8cce('0x5')]=_0x8cce('0x8');util[_0x8cce('0x7')](APIBadRequestError,APIError);};var APIConflictError=function(_0x1421b3){this['message']=_0x1421b3||'Resource\x20Conflict';this['name']=_0x8cce('0x9');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x4b03f2){this[_0x8cce('0x3')]=_0x4b03f2||_0x8cce('0xa');this['name']=_0x8cce('0xa');util[_0x8cce('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x38a854){this['message']=_0x38a854||_0x8cce('0xb');this[_0x8cce('0x5')]=_0x8cce('0xc');util[_0x8cce('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x54f76c){this[_0x8cce('0x3')]=_0x54f76c||_0x8cce('0xd');this[_0x8cce('0x5')]=_0x8cce('0xe');this['code']=0x193;this[_0x8cce('0xf')]={'type':'OutOfInterval'};util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x3ad83d){switch(_0x3ad83d){case'Bad\x20Request':return 0x190;case _0x8cce('0xa'),_0x8cce('0xe'):return 0x193;case _0x8cce('0xc'):return 0x194;case _0x8cce('0x9'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0xdbbfe3){if(_0xdbbfe3===_0x8cce('0xe'))return _0xdbbfe3;return null;}function handleError(_0xdf18b0){return function(_0x44fd50){logger[_0x8cce('0x10')](_0x44fd50[_0x8cce('0x11')]);var _0x4f017b=getStatusCode(_0x44fd50[_0x8cce('0x5')]);var _0x3a32e3=getCustomStatusMessage(_0x44fd50['name']);if(_0x44fd50[_0x8cce('0x5')]){delete _0x44fd50[_0x8cce('0x5')];}if(_0x3a32e3){_0xdf18b0[_0x8cce('0x12')]=_0x3a32e3;}return _0xdf18b0[_0x8cce('0x13')](_0x4f017b)[_0x8cce('0x14')](_0x44fd50);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIConflict':APIConflictError,'APIOutOfIntervalError':APIOutOfIntervalError,'handleError':handleError}; \ No newline at end of file +var _0xdaeb=['Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','statusMessage','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdaeb,0x108));var _0xbdae=function(_0x3f228e,_0x5540b6){_0x3f228e=_0x3f228e-0x0;var _0x23a8c2=_0xdaeb[_0x3f228e];return _0x23a8c2;};'use strict';var util=require('util');var logger=require(_0xbdae('0x0'))(_0xbdae('0x1'));var APIError=function(_0x1144cc,_0x1b2f35){this[_0xbdae('0x2')]=_0x1144cc||_0xbdae('0x3');this[_0xbdae('0x4')]=_0x1b2f35||_0xbdae('0x5');util[_0xbdae('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4e984c){this[_0xbdae('0x2')]=_0x4e984c||_0xbdae('0x7');this[_0xbdae('0x4')]=_0xbdae('0x7');util[_0xbdae('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x564209){this[_0xbdae('0x2')]=_0x564209||'Forbidden';this[_0xbdae('0x4')]=_0xbdae('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x4dca6b){this['message']=_0x4dca6b||_0xbdae('0x9');this[_0xbdae('0x4')]=_0xbdae('0xa');util[_0xbdae('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x464e59){this[_0xbdae('0x2')]=_0x464e59||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xbdae('0x4')]=_0xbdae('0xb');this['code']=0x193;this['details']={'type':_0xbdae('0xc')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x29cff4){this[_0xbdae('0x2')]=_0x29cff4||_0xbdae('0xd');this[_0xbdae('0x4')]='Conflict';util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0xdbe932){switch(_0xdbe932){case'Bad\x20Request':return 0x190;case _0xbdae('0x8'),_0xbdae('0xb'):return 0x193;case _0xbdae('0xa'):return 0x194;case _0xbdae('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x4decd6){if(_0x4decd6===_0xbdae('0xb'))return _0x4decd6;return null;}function handleError(_0x9a905b){return function(_0x42890f){logger[_0xbdae('0xf')](_0x42890f[_0xbdae('0x10')]);var _0x44f0d7=getStatusCode(_0x42890f[_0xbdae('0x4')]);var _0x59da7a=getCustomStatusMessage(_0x42890f[_0xbdae('0x4')]);if(_0x42890f[_0xbdae('0x4')]){delete _0x42890f['name'];}if(_0x59da7a){_0x9a905b[_0xbdae('0x11')]=_0x59da7a;}return _0x9a905b[_0xbdae('0x12')](_0x44f0d7)[_0xbdae('0x13')](_0x42890f);};}module[_0xbdae('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index aaabd62..cd75044 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3526=['404','status','render','json','send'];(function(_0x39f860,_0x220144){var _0x23228b=function(_0x133b47){while(--_0x133b47){_0x39f860['push'](_0x39f860['shift']());}};_0x23228b(++_0x220144);}(_0x3526,0x1db));var _0x6352=function(_0x5e1c6b,_0x331e1f){_0x5e1c6b=_0x5e1c6b-0x0;var _0x3d952c=_0x3526[_0x5e1c6b];return _0x3d952c;};'use strict';module['exports'][0x194]=function pageNotFound(_0x46a34f,_0x13d2ca){var _0x171806=_0x6352('0x0');var _0xadb87=0x194;var _0x43c117={'status':_0xadb87};_0x13d2ca[_0x6352('0x1')](_0x43c117[_0x6352('0x1')]);_0x13d2ca[_0x6352('0x2')](_0x171806,{},function(_0xf85948,_0xaa8b2e){if(_0xf85948){return _0x13d2ca[_0x6352('0x1')](_0x43c117[_0x6352('0x1')])[_0x6352('0x3')](_0x43c117);}_0x13d2ca[_0x6352('0x4')](_0xaa8b2e);});}; \ No newline at end of file +var _0x6f1a=['status','render','exports'];(function(_0x2949de,_0x47b38d){var _0xc974b6=function(_0x2ef45e){while(--_0x2ef45e){_0x2949de['push'](_0x2949de['shift']());}};_0xc974b6(++_0x47b38d);}(_0x6f1a,0x1f4));var _0xa6f1=function(_0x26cd0d,_0x2773e2){_0x26cd0d=_0x26cd0d-0x0;var _0x375b68=_0x6f1a[_0x26cd0d];return _0x375b68;};'use strict';module[_0xa6f1('0x0')][0x194]=function pageNotFound(_0x4df562,_0x1f96d1){var _0x10e0f1='404';var _0x5dd8b2=0x194;var _0x459e32={'status':_0x5dd8b2};_0x1f96d1[_0xa6f1('0x1')](_0x459e32['status']);_0x1f96d1[_0xa6f1('0x2')](_0x10e0f1,{},function(_0x1f856e,_0x32a7f0){if(_0x1f856e){return _0x1f96d1[_0xa6f1('0x1')](_0x459e32[_0xa6f1('0x1')])['json'](_0x459e32);}_0x1f96d1['send'](_0x32a7f0);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a01c39b..ea0662c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dd6=['ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','SenderId','belongsTo','belongsToMany','Groups','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueue','MailQueues','ChatQueue','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut','Imap','Smtp','Disposition','Dispositions','MailApplication','ListId','mandatoryDispositionPauseId','Team','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','List','Items','FaxAccountId','Answers','Interactions','FaxMessage','Messages','FaxApplication','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','Contacts','CompanyId','CmContactHasItem','Phones','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','Schedule','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemTypeId','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','SalesforceField','Descriptions','DescriptionId','FieldId','SalesforceAccount','SubjectId','Description','Field','Variable','VariableId','SugarcrmAccount','AccountId','DeskConfiguration','Subject','ZohoAccount','Subjects','ZendeskAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Field','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','ChatQueues','FaxQueues','SmsQueues','team_has_whatsapp_queues','TrunkId','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','FaxTransferReport','FromAgent','ToFaxQueueId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','userProfileId','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','jstz','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','utf8mb4','name','sequelizeHistory','127.0.0.1','mysql','utf8','utf8_general_ci','database','username','password','options','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x5dd6,0x140));var _0x65dd=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x5dd6[_0x54d49e];return _0x4af0f1;};'use strict';var config=require(_0x65dd('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x65dd('0x1'));var timezone=jstz[_0x65dd('0x2')]();config['sequelize']=_[_0x65dd('0x3')](config[_0x65dd('0x4')],{'database':_0x65dd('0x5'),'username':_0x65dd('0x6'),'password':_0x65dd('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x65dd('0x8')},'logging':![],'timezone':timezone[_0x65dd('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x65dd('0xa')]=_[_0x65dd('0x3')](config[_0x65dd('0xa')],{'database':_0x65dd('0x5'),'username':_0x65dd('0x6'),'password':_0x65dd('0x7'),'options':{'host':_0x65dd('0xb'),'port':0xcea,'dialect':_0x65dd('0xc'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x65dd('0x9')](),'define':{'charset':_0x65dd('0xd'),'collate':_0x65dd('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x65dd('0x4')][_0x65dd('0xf')],config[_0x65dd('0x4')][_0x65dd('0x10')],config[_0x65dd('0x4')][_0x65dd('0x11')],config[_0x65dd('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x65dd('0xa')][_0x65dd('0xf')],config[_0x65dd('0xa')][_0x65dd('0x10')],config[_0x65dd('0xa')][_0x65dd('0x11')],config[_0x65dd('0xa')][_0x65dd('0x12')])};db['User']=db['sequelize']['import'](_0x65dd('0x13'));db[_0x65dd('0x14')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x16'));db['VoiceContext']=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/voiceContext/voiceContext.model');db[_0x65dd('0x17')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x18'));db[_0x65dd('0x19')]=db[_0x65dd('0x4')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x65dd('0x1a')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x1b'));db[_0x65dd('0x1c')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x1d'));db[_0x65dd('0x1e')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x1f'));db[_0x65dd('0x20')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x21'));db[_0x65dd('0x22')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x23'));db[_0x65dd('0x24')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x25'));db['VoiceDialReport']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x26'));db[_0x65dd('0x27')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x28'));db[_0x65dd('0x29')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x2a'));db[_0x65dd('0x2b')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x2c'));db[_0x65dd('0x2d')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x2e'));db[_0x65dd('0x2f')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x30'));db[_0x65dd('0x31')]=db['sequelize']['import'](_0x65dd('0x32'));db['UserVoiceQueue']=db[_0x65dd('0x4')]['import'](_0x65dd('0x33'));db[_0x65dd('0x34')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x35'));db[_0x65dd('0x36')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x37'));db[_0x65dd('0x38')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x39'));db[_0x65dd('0x3a')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x3b'));db['UserOpenchannelQueue']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x3c'));db[_0x65dd('0x3d')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x3e'));db[_0x65dd('0x3f')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x40'));db['MailServerOut']=db[_0x65dd('0x4')]['import'](_0x65dd('0x41'));db[_0x65dd('0x42')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x43'));db['MailQueue']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x44'));db[_0x65dd('0x45')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x65dd('0x4')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x65dd('0x46')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x47'));db['MailApplication']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x48'));db[_0x65dd('0x49')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x4a'));db[_0x65dd('0x4b')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/dashboard/dashboard.model');db[_0x65dd('0x4c')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x4d'));db[_0x65dd('0x4e')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x4f'));db['FaxApplication']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x50'));db[_0x65dd('0x51')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x52'));db['FaxMessage']=db[_0x65dd('0x4')]['import'](_0x65dd('0x53'));db[_0x65dd('0x54')]=db['sequelize'][_0x65dd('0x15')]('../api/faxQueue/faxQueue.model');db[_0x65dd('0x55')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x56'));db[_0x65dd('0x57')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x58'));db['SmsApplication']=db['sequelize']['import']('../api/smsApplication/smsApplication.model');db[_0x65dd('0x59')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x5a'));db[_0x65dd('0x5b')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x5c'));db[_0x65dd('0x5d')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x5e'));db[_0x65dd('0x5f')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x60'));db[_0x65dd('0x61')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x62'));db[_0x65dd('0x63')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x64'));db[_0x65dd('0x65')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x66'));db[_0x65dd('0x67')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x68'));db['ChatWebsite']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x69'));db[_0x65dd('0x6a')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x6b'));db['ChatApplication']=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x6c'));db[_0x65dd('0x6d')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x6e'));db[_0x65dd('0x6f')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x70'));db['ChatQueue']=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x71'));db[_0x65dd('0x72')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x73'));db[_0x65dd('0x74')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x75'));db[_0x65dd('0x76')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x77'));db[_0x65dd('0x78')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/cmHopper/cmHopper.model');db[_0x65dd('0x79')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x7a'));db['CmHopperFinal']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x7b'));db[_0x65dd('0x7c')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x7d'));db[_0x65dd('0x7e')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x7f'));db[_0x65dd('0x80')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x81'));db[_0x65dd('0x82')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/action/action.model');db[_0x65dd('0x83')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x84'));db[_0x65dd('0x85')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x86'));db['Disposition']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x87'));db[_0x65dd('0x88')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x89'));db[_0x65dd('0x8a')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/interval/interval.model');db['Pause']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x8b'));db[_0x65dd('0x8c')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x8d'));db[_0x65dd('0x8e')]=db['sequelize']['import'](_0x65dd('0x8f'));db['Schedule']=db['sequelize']['import'](_0x65dd('0x90'));db[_0x65dd('0x91')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x92'));db[_0x65dd('0x93')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/tag/tag.model');db['ContactItemType']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x94'));db['CmContactHasItem']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x95'));db[_0x65dd('0x96')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x97'));db[_0x65dd('0x98')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x99'));db[_0x65dd('0x9a')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x9b'));db['Variable']=db['sequelize']['import']('../api/variable/variable.model');db[_0x65dd('0x9c')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x9d'));db['IntegrationReport']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x9e'));db[_0x65dd('0x9f')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xa0'));db['AnalyticDefaultReport']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xa1'));db['AnalyticExtractedReport']=db['sequelize']['import'](_0x65dd('0xa2'));db[_0x65dd('0xa3')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xa4'));db[_0x65dd('0xa5')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xa6'));db[_0x65dd('0xa7')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xa8'));db['SalesforceAccount']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xa9'));db[_0x65dd('0xaa')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xab'));db['SalesforceField']=db[_0x65dd('0x4')]['import'](_0x65dd('0xac'));db['SugarcrmAccount']=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x65dd('0xad')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xae'));db[_0x65dd('0xaf')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x65dd('0xb0')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xb1'));db['DeskConfiguration']=db[_0x65dd('0x4')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x65dd('0xb2')]=db['sequelize']['import'](_0x65dd('0xb3'));db['ZohoAccount']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xb4'));db[_0x65dd('0xb5')]=db[_0x65dd('0x4')]['import'](_0x65dd('0xb6'));db[_0x65dd('0xb7')]=db['sequelize']['import'](_0x65dd('0xb8'));db['ZendeskAccount']=db[_0x65dd('0x4')]['import'](_0x65dd('0xb9'));db['ZendeskConfiguration']=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xba'));db[_0x65dd('0xbb')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xbc'));db[_0x65dd('0xbd')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xbe'));db[_0x65dd('0xbf')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xc0'));db[_0x65dd('0xc1')]=db[_0x65dd('0x4')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x65dd('0xc2')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xc3'));db[_0x65dd('0xc4')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xc5'));db[_0x65dd('0xc6')]=db[_0x65dd('0x4')]['import'](_0x65dd('0xc7'));db[_0x65dd('0xc8')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x65dd('0xc9')]=db[_0x65dd('0x4')]['import'](_0x65dd('0xca'));db['Dynamics365Field']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xcb'));db[_0x65dd('0xcc')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xcd'));db[_0x65dd('0xce')]=db[_0x65dd('0x4')]['import'](_0x65dd('0xcf'));db[_0x65dd('0xd0')]=db['sequelize'][_0x65dd('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x65dd('0x9c')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0x9d'));db[_0x65dd('0xd1')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xd2'));db[_0x65dd('0xd3')]=db[_0x65dd('0x4')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x65dd('0xd4')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xd5'));db['JscriptyAnswerReport']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xd6'));db['JscriptyQuestionReport']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xd7'));db[_0x65dd('0xd8')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xd9'));db[_0x65dd('0xda')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xdb'));db[_0x65dd('0xdc')]=db[_0x65dd('0x4')]['import'](_0x65dd('0xdd'));db[_0x65dd('0xde')]=db[_0x65dd('0x4')]['import'](_0x65dd('0xdf'));db[_0x65dd('0xe0')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xe1'));db[_0x65dd('0xe2')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xe3'));db[_0x65dd('0xe4')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xe5'));db[_0x65dd('0xe6')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xe7'));db[_0x65dd('0xe8')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xe9'));db[_0x65dd('0xea')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xeb'));db['Team']=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/team/team.model');db[_0x65dd('0xec')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xed'));db[_0x65dd('0xee')]=db[_0x65dd('0x4')]['import'](_0x65dd('0xef'));db[_0x65dd('0xf0')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xf1'));db[_0x65dd('0xf2')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xf3'));db[_0x65dd('0xf4')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xf5'));db[_0x65dd('0xf6')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xf7'));db[_0x65dd('0xf8')]=db['sequelize'][_0x65dd('0x15')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/faxTransferReport/faxTransferReport.model');db[_0x65dd('0xf9')]=db[_0x65dd('0x4')][_0x65dd('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x65dd('0xfa')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xfb'));db[_0x65dd('0xfc')]=db['sequelize'][_0x65dd('0x15')](_0x65dd('0xfd'));db[_0x65dd('0xfe')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0xff'));db[_0x65dd('0x100')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x101'));db[_0x65dd('0x102')]=db['sequelize'][_0x65dd('0x15')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db['sequelize']['import'](_0x65dd('0x103'));db[_0x65dd('0x104')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x105'));db[_0x65dd('0x106')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x107'));db['WhatsappApplication']=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x108'));db[_0x65dd('0x109')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x10a'));db[_0x65dd('0x10b')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x10c'));db[_0x65dd('0x10d')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x10e'));db[_0x65dd('0x10f')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x110'));db[_0x65dd('0x111')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x112'));db[_0x65dd('0x113')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x114'));db[_0x65dd('0x115')]=db[_0x65dd('0x4')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x65dd('0x116')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x117'));db[_0x65dd('0x118')]=db[_0x65dd('0x4')]['import'](_0x65dd('0x119'));db[_0x65dd('0x11a')]=db[_0x65dd('0x4')][_0x65dd('0x15')](_0x65dd('0x11b'));db[_0x65dd('0x11c')][_0x65dd('0x11d')](db[_0x65dd('0x20')],{'as':_0x65dd('0x20'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')][_0x65dd('0x11d')](db[_0x65dd('0x11a')],{'as':_0x65dd('0x120'),'onDelete':_0x65dd('0x11e'),'foreignKey':'UserId'});db[_0x65dd('0x11c')][_0x65dd('0x121')](db['VoiceRecording'],{'as':_0x65dd('0x122'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x65dd('0x123'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')][_0x65dd('0x121')](db[_0x65dd('0x17')],{'as':'Extensions','onDelete':_0x65dd('0x11e'),'hooks':!![]});db[_0x65dd('0x11c')]['hasMany'](db[_0x65dd('0x124')],{'as':_0x65dd('0x125'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')]['hasMany'](db[_0x65dd('0x7c')],{'as':_0x65dd('0x126'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')][_0x65dd('0x121')](db['ReportAgentPreview'],{'as':_0x65dd('0x7e'),'foreignKey':_0x65dd('0x11f')});db['User'][_0x65dd('0x121')](db[_0x65dd('0x63')],{'as':_0x65dd('0x127'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')][_0x65dd('0x121')](db['ChatInteraction'],{'as':_0x65dd('0x128'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')]['hasMany'](db[_0x65dd('0x59')],{'as':_0x65dd('0x129'),'foreignKey':'UserId'});db[_0x65dd('0x11c')]['hasMany'](db[_0x65dd('0x51')],{'as':_0x65dd('0x12a'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')]['hasMany'](db[_0x65dd('0x12b')],{'as':_0x65dd('0x12c'),'foreignKey':'UserId'});db[_0x65dd('0x11c')][_0x65dd('0x121')](db[_0x65dd('0x109')],{'as':_0x65dd('0x12d'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x11c')][_0x65dd('0x121')](db[_0x65dd('0x104')],{'as':'UserNotifications','foreignKey':_0x65dd('0x12e')});db[_0x65dd('0x11c')][_0x65dd('0x121')](db[_0x65dd('0x78')],{'as':'Hoppers','foreignKey':_0x65dd('0x11f'),'onDelete':'SET\x20NULL'});db[_0x65dd('0x11c')][_0x65dd('0x12f')](db[_0x65dd('0x100')],{'as':_0x65dd('0x100'),'foreignKey':'userProfileId'});db['User'][_0x65dd('0x130')](db['ChatGroup'],{'as':_0x65dd('0x131'),'through':'chat_group_has_users'});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0x76')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0xfc')],{'as':_0x65dd('0x132'),'through':_0x65dd('0x133')});db[_0x65dd('0x11c')][_0x65dd('0x130')](db['Team'],{'through':_0x65dd('0x134')});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0x12b')],{'as':_0x65dd('0x12c'),'through':_0x65dd('0x135')});db['User']['belongsToMany'](db[_0x65dd('0x136')],{'as':_0x65dd('0x128'),'through':_0x65dd('0x137')});db['User'][_0x65dd('0x130')](db[_0x65dd('0x51')],{'as':_0x65dd('0x12a'),'through':_0x65dd('0x138')});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0x59')],{'as':_0x65dd('0x129'),'through':'user_has_sms_interactions'});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0x63')],{'as':'OpenchannelInteractions','through':_0x65dd('0x139')});db[_0x65dd('0x11c')][_0x65dd('0x130')](db['WhatsappInteraction'],{'as':_0x65dd('0x12d'),'through':_0x65dd('0x13a')});db['User'][_0x65dd('0x130')](db['VoiceQueue'],{'as':_0x65dd('0x13b'),'through':_0x65dd('0x13c'),'required':![]});db[_0x65dd('0x11c')]['belongsToMany'](db['VoicePrefix'],{'as':_0x65dd('0x13d'),'through':_0x65dd('0x118'),'required':![]});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0x13e')],{'as':_0x65dd('0x13f'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db[_0x65dd('0x140')],{'as':'ChatQueues','through':_0x65dd('0x34'),'required':![],'hooks':!![]});db['User'][_0x65dd('0x130')](db[_0x65dd('0x54')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x65dd('0x11c')]['belongsToMany'](db[_0x65dd('0x5d')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x65dd('0x11c')][_0x65dd('0x130')](db['OpenchannelQueue'],{'as':_0x65dd('0x141'),'through':'UserOpenchannelQueue','required':![]});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0x111')],{'as':_0x65dd('0x142'),'through':_0x65dd('0x3d'),'required':![]});db[_0x65dd('0x11c')][_0x65dd('0x130')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0x143')],{'as':_0x65dd('0x144'),'through':_0x65dd('0x145')});db['User'][_0x65dd('0x130')](db['FaxAccount'],{'as':_0x65dd('0x146'),'through':_0x65dd('0x147')});db[_0x65dd('0x11c')]['belongsToMany'](db[_0x65dd('0x42')],{'as':_0x65dd('0x148'),'through':_0x65dd('0x149')});db[_0x65dd('0x11c')][_0x65dd('0x130')](db[_0x65dd('0x5f')],{'as':_0x65dd('0x14a'),'through':'user_has_openchannel_accounts'});db[_0x65dd('0x11c')]['belongsToMany'](db[_0x65dd('0x57')],{'as':_0x65dd('0x14b'),'through':_0x65dd('0x14c')});db[_0x65dd('0x11c')][_0x65dd('0x130')](db['WhatsappAccount'],{'as':_0x65dd('0x14d'),'through':'user_has_whatsapp_accounts'});db[_0x65dd('0x14')]['hasMany'](db[_0x65dd('0x17')],{'as':_0x65dd('0x14e'),'onDelete':'cascade','foreignKey':_0x65dd('0x14f')});db[_0x65dd('0x150')]['hasMany'](db[_0x65dd('0x17')],{'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x17')][_0x65dd('0x121')](db['VoiceExtension'],{'as':_0x65dd('0x151'),'onDelete':'cascade'});db['VoiceMusicOnHold']['belongsToMany'](db[_0x65dd('0x91')],{'as':_0x65dd('0x152'),'through':'moh_has_sounds'});db[_0x65dd('0x1a')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x65dd('0x153'),'foreignKey':_0x65dd('0x154')});db[_0x65dd('0x1a')][_0x65dd('0x121')](db[_0x65dd('0x78')],{'as':_0x65dd('0x155'),'foreignKey':'VoiceQueueId'});db[_0x65dd('0x1a')]['hasMany'](db[_0x65dd('0x124')],{'as':_0x65dd('0x125'),'foreignKey':_0x65dd('0x154')});db[_0x65dd('0x1a')][_0x65dd('0x121')](db[_0x65dd('0x7c')],{'as':'HopperHistories','foreignKey':_0x65dd('0x154')});db[_0x65dd('0x1a')][_0x65dd('0x121')](db[_0x65dd('0x7e')],{'as':_0x65dd('0x7e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x65dd('0x121')](db[_0x65dd('0x79')],{'as':_0x65dd('0x156'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x65dd('0xd8')],{'as':_0x65dd('0x157'),'foreignKey':_0x65dd('0x154')});db[_0x65dd('0x1a')][_0x65dd('0x12f')](db[_0x65dd('0x2d')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x65dd('0x1a')][_0x65dd('0x12f')](db['Trunk'],{'as':_0x65dd('0x158'),'foreignKey':_0x65dd('0x159')});db[_0x65dd('0x1a')][_0x65dd('0x12f')](db['Interval'],{'as':'Interval','foreignKey':_0x65dd('0x15a')});db['VoiceQueue']['belongsTo'](db[_0x65dd('0x15b')],{'as':_0x65dd('0x15c'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x65dd('0x132'),'through':_0x65dd('0x15d')});db['VoiceQueue'][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x13c')});db[_0x65dd('0x1a')][_0x65dd('0x130')](db['Team'],{'as':_0x65dd('0x15f'),'through':_0x65dd('0x115')});db[_0x65dd('0x1a')]['belongsToMany'](db[_0x65dd('0xfc')],{'as':_0x65dd('0x160'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x65dd('0x12f')](db['User'],{'as':_0x65dd('0x11c'),'foreignKey':'UserId'});db[_0x65dd('0x1e')]['belongsTo'](db[_0x65dd('0x11c')],{'as':'User','foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x20')][_0x65dd('0x121')](db[_0x65dd('0x22')],{'as':'Messages','onDelete':_0x65dd('0x11e'),'foreignKey':'mailboxuser','sourceKey':_0x65dd('0x161')});db['VoiceMailMessage'][_0x65dd('0x12f')](db[_0x65dd('0x20')],{'foreignKey':_0x65dd('0x162'),'targetKey':_0x65dd('0x161')});db[_0x65dd('0x24')][_0x65dd('0x121')](db['VoiceQueueReport'],{'as':_0x65dd('0x163'),'foreignKey':_0x65dd('0x164'),'constraints':![]});db[_0x65dd('0x24')][_0x65dd('0x121')](db[_0x65dd('0x27')],{'as':_0x65dd('0x165'),'foreignKey':'uniqueid','constraints':![]});db[_0x65dd('0x24')][_0x65dd('0x12f')](db['User'],{'as':_0x65dd('0x11c'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x24')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db[_0x65dd('0x3f')][_0x65dd('0x12f')](db[_0x65dd('0x42')],{'as':_0x65dd('0x42'),'foreignKey':_0x65dd('0x168')});db[_0x65dd('0x3f')]['belongsTo'](db[_0x65dd('0x113')],{'as':'CloudProvider','foreignKey':_0x65dd('0x169'),'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x16b')][_0x65dd('0x12f')](db[_0x65dd('0x42')],{'as':_0x65dd('0x42'),'foreignKey':_0x65dd('0x168')});db[_0x65dd('0x16b')][_0x65dd('0x12f')](db[_0x65dd('0x113')],{'as':_0x65dd('0x113'),'foreignKey':_0x65dd('0x169'),'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x42')][_0x65dd('0x11d')](db[_0x65dd('0x3f')],{'as':_0x65dd('0x16c'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x42')][_0x65dd('0x11d')](db['MailServerOut'],{'as':_0x65dd('0x16d'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x42')][_0x65dd('0x121')](db[_0x65dd('0x16e')],{'as':_0x65dd('0x16f'),'foreignKey':_0x65dd('0x168'),'onDelete':'cascade'});db[_0x65dd('0x42')][_0x65dd('0x121')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x65dd('0x168')});db[_0x65dd('0x42')]['hasMany'](db[_0x65dd('0x46')],{'as':'Messages','foreignKey':_0x65dd('0x168')});db[_0x65dd('0x42')][_0x65dd('0x121')](db[_0x65dd('0x12b')],{'as':'Interactions'});db[_0x65dd('0x42')][_0x65dd('0x121')](db[_0x65dd('0x170')],{'as':'Applications','foreignKey':_0x65dd('0x168'),'onDelete':'cascade'});db['MailAccount'][_0x65dd('0x12f')](db[_0x65dd('0xfc')],{'as':'List','foreignKey':_0x65dd('0x171')});db[_0x65dd('0x42')][_0x65dd('0x12f')](db[_0x65dd('0x98')],{'as':_0x65dd('0x98'),'foreignKey':'TemplateId'});db[_0x65dd('0x42')][_0x65dd('0x12f')](db[_0x65dd('0x15b')],{'as':'mandatoryDispositionPause','foreignKey':_0x65dd('0x172')});db[_0x65dd('0x42')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x149')});db[_0x65dd('0x13e')]['belongsToMany'](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x36')});db[_0x65dd('0x13e')][_0x65dd('0x130')](db[_0x65dd('0x173')],{'through':_0x65dd('0x174'),'as':_0x65dd('0x15f')});db[_0x65dd('0x12b')][_0x65dd('0x121')](db[_0x65dd('0x46')],{'as':'Messages','onDelete':_0x65dd('0x11e'),'foreignKey':'MailInteractionId'});db[_0x65dd('0x12b')]['belongsTo'](db[_0x65dd('0x42')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x168')});db[_0x65dd('0x12b')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db['MailInteraction'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x176'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x12b')][_0x65dd('0x130')](db[_0x65dd('0x93')],{'through':_0x65dd('0x177'),'as':_0x65dd('0x178')});db[_0x65dd('0x12b')][_0x65dd('0x130')](db[_0x65dd('0x93')],{'through':_0x65dd('0x177'),'as':_0x65dd('0x179')});db['MailInteraction'][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x17a'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db[_0x65dd('0xf2')],{'as':_0x65dd('0x17b'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x46')]['belongsTo'](db['User'],{'as':_0x65dd('0x11c')});db[_0x65dd('0x46')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'onDelete':'cascade','as':_0x65dd('0x166')});db[_0x65dd('0x46')][_0x65dd('0x12f')](db[_0x65dd('0x12b')],{'as':_0x65dd('0x17c'),'foreignKey':'MailInteractionId'});db[_0x65dd('0x46')][_0x65dd('0x12f')](db[_0x65dd('0x42')],{'as':'Account','foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db[_0x65dd('0x143')],{'as':_0x65dd('0x143'),'foreignKey':_0x65dd('0x17d')});db['MailMessage'][_0x65dd('0x12f')](db[_0x65dd('0x6f')],{'as':_0x65dd('0x6f'),'foreignKey':_0x65dd('0x17e')});db[_0x65dd('0x170')]['belongsTo'](db[_0x65dd('0x11c')],{'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x170')][_0x65dd('0x12f')](db['MailQueue'],{'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x170')][_0x65dd('0x12f')](db[_0x65dd('0x42')],{'onDelete':'restrict'});db[_0x65dd('0x170')][_0x65dd('0x12f')](db[_0x65dd('0x8a')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x15a')});db[_0x65dd('0x170')][_0x65dd('0x12f')](db[_0x65dd('0x93')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x17f')});db[_0x65dd('0x49')][_0x65dd('0x12f')](db[_0x65dd('0x42')],{});db[_0x65dd('0x49')][_0x65dd('0x12f')](db[_0x65dd('0xfc')],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0x49')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x65dd('0x49')][_0x65dd('0x12f')](db[_0x65dd('0x12b')],{});db[_0x65dd('0x49')]['belongsTo'](db[_0x65dd('0x46')],{});db[_0x65dd('0x49')][_0x65dd('0x12f')](db['User'],{});db[_0x65dd('0x49')]['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0x65dd('0x121')](db[_0x65dd('0x4c')],{'as':_0x65dd('0x181'),'onDelete':_0x65dd('0x11e')});db['FaxAccount'][_0x65dd('0x121')](db[_0x65dd('0x16e')],{'as':'Dispositions','foreignKey':_0x65dd('0x182'),'onDelete':_0x65dd('0x11e')});db['FaxAccount'][_0x65dd('0x121')](db[_0x65dd('0x85')],{'as':_0x65dd('0x183'),'foreignKey':_0x65dd('0x182')});db[_0x65dd('0x4e')][_0x65dd('0x121')](db[_0x65dd('0x51')],{'as':_0x65dd('0x184')});db[_0x65dd('0x4e')][_0x65dd('0x121')](db['FaxApplication'],{'as':_0x65dd('0x151'),'foreignKey':_0x65dd('0x182'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x4e')]['hasMany'](db[_0x65dd('0x17')],{'as':'Exntensions','onDelete':_0x65dd('0x11e')});db[_0x65dd('0x4e')][_0x65dd('0x121')](db[_0x65dd('0x185')],{'as':_0x65dd('0x186')});db[_0x65dd('0x4e')][_0x65dd('0x12f')](db[_0x65dd('0x2d')],{'as':'Trunk'});db[_0x65dd('0x4e')]['belongsTo'](db[_0x65dd('0xfc')],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db['FaxAccount'][_0x65dd('0x12f')](db[_0x65dd('0x15b')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x65dd('0x4e')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x65dd('0x187')]['belongsTo'](db[_0x65dd('0x11c')],{'onDelete':'restrict'});db[_0x65dd('0x187')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x65dd('0x16a')});db['FaxApplication'][_0x65dd('0x12f')](db[_0x65dd('0x4e')],{'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x187')][_0x65dd('0x12f')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['FaxInteraction']['hasMany'](db[_0x65dd('0x185')],{'as':_0x65dd('0x186'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x188')});db[_0x65dd('0x51')]['belongsTo'](db[_0x65dd('0x4e')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x182')});db[_0x65dd('0x51')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db[_0x65dd('0x51')][_0x65dd('0x12f')](db['User'],{'as':'Owner','foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x51')][_0x65dd('0x130')](db[_0x65dd('0x93')],{'through':'fax_interaction_has_tags','as':_0x65dd('0x178')});db[_0x65dd('0x51')][_0x65dd('0x130')](db[_0x65dd('0x93')],{'through':_0x65dd('0x189'),'as':_0x65dd('0x179')});db[_0x65dd('0x51')]['belongsToMany'](db[_0x65dd('0x11c')],{'as':_0x65dd('0x17a'),'through':_0x65dd('0x138'),'foreignKey':_0x65dd('0x188')});db[_0x65dd('0x185')]['belongsTo'](db[_0x65dd('0x11c')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x11c')});db[_0x65dd('0x185')][_0x65dd('0x12f')](db['FaxInteraction'],{'as':_0x65dd('0x17c'),'foreignKey':'FaxInteractionId'});db[_0x65dd('0x185')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x166')});db[_0x65dd('0x185')][_0x65dd('0x12f')](db['Attachment'],{'as':_0x65dd('0xf2'),'foreignKey':_0x65dd('0x18a')});db[_0x65dd('0x185')][_0x65dd('0x12f')](db['FaxAccount'],{'as':'Account','foreignKey':_0x65dd('0x182')});db[_0x65dd('0x54')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':'UserFaxQueue'});db[_0x65dd('0x54')][_0x65dd('0x130')](db[_0x65dd('0x173')],{'through':_0x65dd('0x18b'),'as':_0x65dd('0x15f')});db[_0x65dd('0x55')]['belongsTo'](db[_0x65dd('0x4e')],{});db['FaxQueueReport'][_0x65dd('0x12f')](db[_0x65dd('0xfc')],{'as':_0x65dd('0x180'),'foreignKey':'ListId'});db['FaxQueueReport'][_0x65dd('0x12f')](db['CmContact'],{'as':'Contact','foreignKey':_0x65dd('0x167')});db[_0x65dd('0x55')][_0x65dd('0x12f')](db[_0x65dd('0x51')],{});db[_0x65dd('0x55')][_0x65dd('0x12f')](db[_0x65dd('0x185')],{});db['FaxQueueReport'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{});db[_0x65dd('0x55')][_0x65dd('0x12f')](db[_0x65dd('0x54')],{});db[_0x65dd('0x57')][_0x65dd('0x121')](db[_0x65dd('0x16e')],{'as':_0x65dd('0x16f'),'foreignKey':_0x65dd('0x18c'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x57')]['hasMany'](db[_0x65dd('0x85')],{'as':'Answers','foreignKey':_0x65dd('0x18c')});db[_0x65dd('0x57')][_0x65dd('0x121')](db[_0x65dd('0x5b')],{'as':_0x65dd('0x186'),'foreignKey':_0x65dd('0x18c')});db[_0x65dd('0x57')][_0x65dd('0x121')](db[_0x65dd('0x59')],{'as':_0x65dd('0x184')});db['SmsAccount']['hasMany'](db[_0x65dd('0x18d')],{'as':'Applications','foreignKey':_0x65dd('0x18c'),'onDelete':_0x65dd('0x11e')});db['SmsAccount'][_0x65dd('0x12f')](db[_0x65dd('0xfc')],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0x57')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x65dd('0x57')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x14c')});db[_0x65dd('0x18d')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x18d')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x65dd('0x16a')});db['SmsApplication'][_0x65dd('0x12f')](db[_0x65dd('0x57')],{'onDelete':'restrict'});db[_0x65dd('0x18d')][_0x65dd('0x12f')](db[_0x65dd('0x8a')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x15a')});db['SmsApplication'][_0x65dd('0x12f')](db[_0x65dd('0x93')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x17f')});db[_0x65dd('0x59')][_0x65dd('0x121')](db[_0x65dd('0x5b')],{'as':_0x65dd('0x186'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x65dd('0x59')][_0x65dd('0x12f')](db[_0x65dd('0x57')],{'as':_0x65dd('0x175'),'foreignKey':'SmsAccountId'});db[_0x65dd('0x59')]['belongsTo'](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db['SmsInteraction'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'as':'Owner','foreignKey':'UserId'});db[_0x65dd('0x59')][_0x65dd('0x130')](db['Tag'],{'through':_0x65dd('0x18e'),'as':_0x65dd('0x178')});db[_0x65dd('0x59')][_0x65dd('0x130')](db[_0x65dd('0x93')],{'through':'sms_interaction_has_tags','as':_0x65dd('0x179')});db['SmsInteraction'][_0x65dd('0x130')](db['User'],{'as':_0x65dd('0x17a'),'through':'user_has_sms_interactions','foreignKey':_0x65dd('0x18f')});db[_0x65dd('0x5b')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'as':'User'});db[_0x65dd('0x5b')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x166')});db[_0x65dd('0x5b')][_0x65dd('0x12f')](db[_0x65dd('0x59')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x65dd('0x18f')});db[_0x65dd('0x5b')]['belongsTo'](db['SmsAccount'],{'as':_0x65dd('0x175'),'foreignKey':'SmsAccountId'});db[_0x65dd('0x5d')]['belongsToMany'](db['User'],{'as':_0x65dd('0x15e'),'through':'UserSmsQueue','foreignKey':_0x65dd('0x190')});db[_0x65dd('0x5d')][_0x65dd('0x130')](db[_0x65dd('0x173')],{'through':_0x65dd('0x191'),'as':_0x65dd('0x15f')});db[_0x65dd('0x5f')][_0x65dd('0x121')](db[_0x65dd('0x16e')],{'as':'Dispositions','foreignKey':_0x65dd('0x192'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x5f')][_0x65dd('0x121')](db['CannedAnswer'],{'as':_0x65dd('0x183'),'foreignKey':_0x65dd('0x192')});db[_0x65dd('0x5f')][_0x65dd('0x121')](db[_0x65dd('0x63')],{'as':_0x65dd('0x184'),'foreignKey':'OpenchannelAccountId'});db[_0x65dd('0x5f')][_0x65dd('0x121')](db[_0x65dd('0x65')],{'as':_0x65dd('0x186'),'foreignKey':_0x65dd('0x192')});db['OpenchannelAccount'][_0x65dd('0x121')](db[_0x65dd('0x61')],{'as':'Applications','foreignKey':_0x65dd('0x192'),'onDelete':_0x65dd('0x11e')});db['OpenchannelAccount'][_0x65dd('0x12f')](db[_0x65dd('0xfc')],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0x5f')]['belongsTo'](db[_0x65dd('0x15b')],{'as':_0x65dd('0x15c'),'foreignKey':_0x65dd('0x172')});db['OpenchannelAccount'][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x193')});db[_0x65dd('0x61')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x61')][_0x65dd('0x12f')](db[_0x65dd('0x67')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x194')});db['OpenchannelApplication']['belongsTo'](db[_0x65dd('0x5f')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x192')});db[_0x65dd('0x61')][_0x65dd('0x12f')](db[_0x65dd('0x8a')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x15a')});db[_0x65dd('0x61')][_0x65dd('0x12f')](db[_0x65dd('0x93')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x65dd('0x63')][_0x65dd('0x121')](db['OpenchannelMessage'],{'as':_0x65dd('0x186'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x195')});db[_0x65dd('0x63')][_0x65dd('0x12f')](db[_0x65dd('0x5f')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x192')});db[_0x65dd('0x63')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':'Contact','foreignKey':_0x65dd('0x167')});db['OpenchannelInteraction'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x176'),'foreignKey':'UserId'});db['OpenchannelInteraction']['belongsToMany'](db[_0x65dd('0x93')],{'through':'openchannel_interaction_has_tags','as':_0x65dd('0x178')});db['OpenchannelInteraction'][_0x65dd('0x130')](db['Tag'],{'through':_0x65dd('0x196'),'as':'ThroughTags'});db[_0x65dd('0x63')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x17a'),'through':_0x65dd('0x139'),'foreignKey':_0x65dd('0x195')});db[_0x65dd('0x65')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x11c')});db[_0x65dd('0x65')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x166')});db[_0x65dd('0x65')][_0x65dd('0x12f')](db['OpenchannelInteraction'],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x17c'),'foreignKey':_0x65dd('0x195')});db[_0x65dd('0x65')]['belongsTo'](db[_0x65dd('0xf2')],{'as':_0x65dd('0xf2'),'foreignKey':_0x65dd('0x18a')});db[_0x65dd('0x65')][_0x65dd('0x12f')](db[_0x65dd('0x5f')],{'as':_0x65dd('0x175'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x197'),'foreignKey':'OpenchannelQueueId'});db[_0x65dd('0x67')][_0x65dd('0x130')](db['Team'],{'through':_0x65dd('0x198'),'as':_0x65dd('0x15f')});db[_0x65dd('0x143')][_0x65dd('0x121')](db['Disposition'],{'as':_0x65dd('0x16f'),'foreignKey':_0x65dd('0x17d'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x143')][_0x65dd('0x121')](db[_0x65dd('0x85')],{'as':_0x65dd('0x183'),'foreignKey':_0x65dd('0x17d')});db[_0x65dd('0x143')][_0x65dd('0x121')](db[_0x65dd('0x74')],{'as':_0x65dd('0x199')});db['ChatWebsite']['hasMany'](db[_0x65dd('0x136')],{'as':_0x65dd('0x184')});db[_0x65dd('0x143')][_0x65dd('0x121')](db[_0x65dd('0x19a')],{'as':_0x65dd('0x151'),'foreignKey':_0x65dd('0x17d'),'onDelete':'cascade'});db[_0x65dd('0x143')][_0x65dd('0x121')](db['ChatMessage'],{'as':_0x65dd('0x186')});db[_0x65dd('0x143')][_0x65dd('0x12f')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['ChatWebsite']['belongsTo'](db[_0x65dd('0x8a')],{'as':_0x65dd('0x8a'),'foreignKey':_0x65dd('0x15a')});db['ChatWebsite']['belongsTo'](db[_0x65dd('0x42')],{'as':'MailAccount','foreignKey':_0x65dd('0x168')});db['ChatWebsite'][_0x65dd('0x12f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x65dd('0x172')});db[_0x65dd('0x143')][_0x65dd('0x130')](db['User'],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x145')});db['OpenchannelQueueReport'][_0x65dd('0x12f')](db[_0x65dd('0x5f')],{});db[_0x65dd('0x6a')][_0x65dd('0x12f')](db[_0x65dd('0xfc')],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0x6a')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x65dd('0x12f')](db['OpenchannelInteraction'],{});db[_0x65dd('0x6a')][_0x65dd('0x12f')](db[_0x65dd('0x65')],{});db[_0x65dd('0x6a')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x65dd('0x67')],{});db[_0x65dd('0x19a')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x19b'),'foreignKey':_0x65dd('0x11f'),'onDelete':_0x65dd('0x16a')});db['ChatApplication'][_0x65dd('0x12f')](db[_0x65dd('0x140')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x65dd('0x16a')});db[_0x65dd('0x19a')]['belongsTo'](db['ChatWebsite'],{'as':_0x65dd('0x19c'),'foreignKey':_0x65dd('0x17d'),'onDelete':_0x65dd('0x16a')});db['ChatApplication'][_0x65dd('0x12f')](db[_0x65dd('0x93')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x65dd('0x136')][_0x65dd('0x121')](db[_0x65dd('0x6d')],{'as':_0x65dd('0x186'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x19d')});db['ChatInteraction']['belongsTo'](db[_0x65dd('0x143')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x17d')});db[_0x65dd('0x136')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db['ChatInteraction'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x176'),'foreignKey':_0x65dd('0x11f')});db[_0x65dd('0x136')][_0x65dd('0x130')](db[_0x65dd('0x93')],{'through':_0x65dd('0x19e'),'as':_0x65dd('0x178')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x65dd('0x19e'),'as':_0x65dd('0x179')});db[_0x65dd('0x136')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x17a'),'through':_0x65dd('0x137'),'foreignKey':_0x65dd('0x19d')});db[_0x65dd('0x6d')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x11c')});db['ChatMessage']['belongsTo'](db[_0x65dd('0x76')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db[_0x65dd('0x6d')][_0x65dd('0x12f')](db[_0x65dd('0x136')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x17c'),'foreignKey':_0x65dd('0x19d')});db[_0x65dd('0x6d')][_0x65dd('0x12f')](db[_0x65dd('0xf2')],{'as':_0x65dd('0xf2'),'foreignKey':_0x65dd('0x18a')});db[_0x65dd('0x6d')]['belongsTo'](db[_0x65dd('0x143')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x17d')});db[_0x65dd('0x6f')][_0x65dd('0x121')](db[_0x65dd('0xf2')],{'as':_0x65dd('0x17b'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x65dd('0x11e'),'hooks':!![]});db[_0x65dd('0x6f')]['belongsTo'](db[_0x65dd('0x76')],{'onDelete':_0x65dd('0x11e'),'as':'Contact','foreignKey':_0x65dd('0x167')});db[_0x65dd('0x6f')][_0x65dd('0x12f')](db[_0x65dd('0x143')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x65dd('0x140')]['belongsToMany'](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x34'),'hooks':!![]});db[_0x65dd('0x140')][_0x65dd('0x130')](db[_0x65dd('0x173')],{'through':_0x65dd('0x19f'),'as':_0x65dd('0x15f')});db[_0x65dd('0x72')][_0x65dd('0x121')](db[_0x65dd('0xd4')],{'as':_0x65dd('0x186'),'foreignKey':_0x65dd('0x1a0'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x72')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':'Members','through':'chat_group_has_users'});db[_0x65dd('0x74')][_0x65dd('0x12f')](db[_0x65dd('0x143')],{'as':_0x65dd('0x19c'),'foreignKey':_0x65dd('0x17d')});db[_0x65dd('0x1a1')][_0x65dd('0x121')](db[_0x65dd('0x76')],{'as':_0x65dd('0x1a2'),'foreignKey':_0x65dd('0x1a3')});db[_0x65dd('0x76')][_0x65dd('0x121')](db[_0x65dd('0x1a4')],{'as':_0x65dd('0x1a5'),'foreignKey':'CmContactId'});db[_0x65dd('0x76')][_0x65dd('0x121')](db[_0x65dd('0x78')],{'as':_0x65dd('0x155'),'foreignKey':_0x65dd('0x167')});db[_0x65dd('0x76')]['hasMany'](db[_0x65dd('0x124')],{'as':'HopperFinals','foreignKey':_0x65dd('0x167')});db[_0x65dd('0x76')][_0x65dd('0x121')](db[_0x65dd('0x7c')],{'as':_0x65dd('0x1a6'),'foreignKey':_0x65dd('0x167')});db[_0x65dd('0x76')][_0x65dd('0x121')](db[_0x65dd('0x7e')],{'as':_0x65dd('0x7e'),'foreignKey':_0x65dd('0x167')});db[_0x65dd('0x76')]['hasMany'](db[_0x65dd('0xd8')],{'as':'JscriptySessions','foreignKey':_0x65dd('0x167')});db[_0x65dd('0x76')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x65dd('0x127'),'foreignKey':_0x65dd('0x167'),'onDelete':'restrict'});db[_0x65dd('0x76')]['hasMany'](db['ChatInteraction'],{'as':_0x65dd('0x128'),'foreignKey':_0x65dd('0x167'),'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x76')]['hasMany'](db[_0x65dd('0x59')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x65dd('0x76')][_0x65dd('0x121')](db[_0x65dd('0x51')],{'as':_0x65dd('0x12a'),'foreignKey':_0x65dd('0x167'),'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x76')][_0x65dd('0x121')](db[_0x65dd('0x12b')],{'as':_0x65dd('0x12c'),'foreignKey':_0x65dd('0x167'),'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x76')]['belongsTo'](db[_0x65dd('0x1a1')],{'as':_0x65dd('0x1a7'),'foreignKey':_0x65dd('0x1a3')});db[_0x65dd('0x76')][_0x65dd('0x12f')](db[_0x65dd('0xfc')],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x76')][_0x65dd('0x130')](db['User'],{'as':_0x65dd('0x17a'),'through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db[_0x65dd('0x93')],{'as':_0x65dd('0x178'),'through':_0x65dd('0x1a8')});db[_0x65dd('0x76')][_0x65dd('0x130')](db[_0x65dd('0x93')],{'through':_0x65dd('0x1a8'),'as':_0x65dd('0x179')});db[_0x65dd('0x78')][_0x65dd('0x121')](db[_0x65dd('0x96')],{'as':_0x65dd('0x1a9'),'foreignKey':_0x65dd('0x1aa')});db[_0x65dd('0x78')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x65dd('0x78')][_0x65dd('0x12f')](db[_0x65dd('0xfc')],{'as':'List','foreignKey':_0x65dd('0x171'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x78')]['belongsTo'](db['User'],{'as':_0x65dd('0x19b'),'foreignKey':'UserId'});db[_0x65dd('0x78')]['belongsTo'](db['VoiceQueue'],{'as':_0x65dd('0x1ab'),'foreignKey':_0x65dd('0x154'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x78')][_0x65dd('0x12f')](db[_0x65dd('0xee')],{'as':_0x65dd('0xee'),'foreignKey':_0x65dd('0x1ac'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x78')]['belongsTo'](db['User'],{'as':_0x65dd('0x176'),'foreignKey':_0x65dd('0x1ad')});db['CmHopperBlack'][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x79')][_0x65dd('0x12f')](db['CmList'],{'as':'List','foreignKey':_0x65dd('0x171'),'onDelete':'cascade'});db[_0x65dd('0x79')][_0x65dd('0x12f')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x65dd('0x154'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x79')][_0x65dd('0x12f')](db['Campaign'],{'as':_0x65dd('0xee'),'foreignKey':_0x65dd('0x1ac'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x83')][_0x65dd('0x121')](db[_0x65dd('0x88')],{'as':{'plural':_0x65dd('0x1ae'),'singular':_0x65dd('0x1af')},'foreignKey':_0x65dd('0x1b0'),'onDelete':_0x65dd('0x11e'),'hooks':!![]});db[_0x65dd('0x83')]['hasMany'](db[_0x65dd('0x88')],{'as':{'plural':_0x65dd('0x1b1'),'singular':_0x65dd('0x1b2')},'foreignKey':_0x65dd('0x1b3'),'onDelete':_0x65dd('0x11e'),'hooks':!![]});db[_0x65dd('0x83')][_0x65dd('0x121')](db['Action'],{'as':_0x65dd('0x1b4'),'foreignKey':_0x65dd('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0x65dd('0x16e')][_0x65dd('0x121')](db[_0x65dd('0x16e')],{'as':_0x65dd('0x16f'),'foreignKey':_0x65dd('0x1b6'),'onDelete':'cascade'});db['Interval'][_0x65dd('0x121')](db['Interval'],{'as':_0x65dd('0x1b7'),'foreignKey':_0x65dd('0x15a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x65dd('0x8a')][_0x65dd('0x121')](db[_0x65dd('0x17')],{'as':_0x65dd('0x1b8'),'foreignKey':'IntervalId','onDelete':_0x65dd('0x16a')});db[_0x65dd('0x8a')][_0x65dd('0x121')](db['MailApplication'],{'as':_0x65dd('0x1b9'),'foreignKey':'IntervalId'});db[_0x65dd('0x8a')][_0x65dd('0x121')](db[_0x65dd('0x19a')],{'as':_0x65dd('0x1ba'),'foreignKey':_0x65dd('0x15a')});db[_0x65dd('0x8a')][_0x65dd('0x121')](db[_0x65dd('0x187')],{'as':_0x65dd('0x1bb'),'foreignKey':_0x65dd('0x15a')});db[_0x65dd('0x8a')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x65dd('0x15a')});db['Schedule']['belongsTo'](db[_0x65dd('0x42')],{});db[_0x65dd('0x1bc')]['belongsTo'](db[_0x65dd('0x1bd')],{'foreignKey':_0x65dd('0x1be')});db[_0x65dd('0x1bc')][_0x65dd('0x12f')](db['AnalyticCustomReport'],{'foreignKey':_0x65dd('0x1bf')});db[_0x65dd('0x91')]['belongsToMany'](db[_0x65dd('0x19')],{'as':_0x65dd('0x1c0'),'through':_0x65dd('0x1c1'),'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x93')]['belongsToMany'](db[_0x65dd('0x76')],{'through':_0x65dd('0x1a8')});db[_0x65dd('0x93')]['belongsToMany'](db[_0x65dd('0x136')],{'through':_0x65dd('0x19e')});db['Tag'][_0x65dd('0x130')](db[_0x65dd('0x12b')],{'through':_0x65dd('0x177')});db[_0x65dd('0x93')]['belongsToMany'](db[_0x65dd('0x59')],{'through':_0x65dd('0x18e')});db['Tag'][_0x65dd('0x130')](db['FaxInteraction'],{'through':_0x65dd('0x189')});db['Tag'][_0x65dd('0x130')](db[_0x65dd('0x63')],{'through':_0x65dd('0x196')});db['Tag'][_0x65dd('0x130')](db[_0x65dd('0x109')],{'through':_0x65dd('0x1c2')});db[_0x65dd('0x1a4')][_0x65dd('0x12f')](db['ContactItemType'],{'as':'ItemType','foreignKey':_0x65dd('0x1c3')});db[_0x65dd('0x96')][_0x65dd('0x12f')](db[_0x65dd('0x78')],{'as':'Hopper','foreignKey':_0x65dd('0x1aa')});db[_0x65dd('0x1a4')]['belongsTo'](db['CmContact'],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x1c4')});db[_0x65dd('0x9a')][_0x65dd('0x121')](db['Condition'],{'as':{'plural':_0x65dd('0x1c5'),'singular':_0x65dd('0x1c6')},'foreignKey':_0x65dd('0x1c7'),'onDelete':_0x65dd('0x11e'),'hooks':!![]});db[_0x65dd('0x9a')][_0x65dd('0x121')](db[_0x65dd('0x88')],{'as':{'plural':_0x65dd('0x1c8'),'singular':'AnyCondition'},'foreignKey':_0x65dd('0x1c9'),'onDelete':_0x65dd('0x11e'),'hooks':!![]});db['Trigger'][_0x65dd('0x121')](db[_0x65dd('0x82')],{'as':_0x65dd('0x1b4'),'foreignKey':_0x65dd('0x1ca'),'onDelete':_0x65dd('0x11e'),'hooks':!![]});db[_0x65dd('0x9f')][_0x65dd('0x121')](db[_0x65dd('0xa5')],{'as':'Fields','onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1bf'),'hooks':!![]});db[_0x65dd('0x1bd')][_0x65dd('0x121')](db['AnalyticFieldReport'],{'as':_0x65dd('0x1cb'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1be')});db[_0x65dd('0xa3')][_0x65dd('0x121')](db['AnalyticFieldReport'],{'as':_0x65dd('0x1cb'),'onDelete':_0x65dd('0x11e'),'foreignKey':'MetricId'});db[_0x65dd('0xa5')][_0x65dd('0x12f')](db[_0x65dd('0xa3')],{'foreignKey':_0x65dd('0x1cc')});db['SalesforceAccount'][_0x65dd('0x121')](db[_0x65dd('0xaa')],{'as':_0x65dd('0x1cd'),'onDelete':_0x65dd('0x11e'),'foreignKey':'AccountId'});db[_0x65dd('0xaa')][_0x65dd('0x121')](db[_0x65dd('0x1ce')],{'as':'Subjects','onDelete':_0x65dd('0x11e'),'foreignKey':'SubjectId'});db[_0x65dd('0xaa')][_0x65dd('0x121')](db[_0x65dd('0x1ce')],{'as':_0x65dd('0x1cf'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0xaa')][_0x65dd('0x121')](db[_0x65dd('0x1ce')],{'as':_0x65dd('0x1cb'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xaa')][_0x65dd('0x12f')](db[_0x65dd('0x1d2')],{'as':'Account','foreignKey':'AccountId'});db[_0x65dd('0x1ce')][_0x65dd('0x121')](db[_0x65dd('0x1ce')],{'as':'Subject','foreignKey':_0x65dd('0x1d3')});db['SalesforceField'][_0x65dd('0x121')](db['SalesforceField'],{'as':_0x65dd('0x1d4'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x65dd('0x121')](db[_0x65dd('0x1ce')],{'as':_0x65dd('0x1d5'),'foreignKey':'FieldId'});db[_0x65dd('0x1ce')][_0x65dd('0x12f')](db['Variable'],{'as':_0x65dd('0x1d6'),'foreignKey':_0x65dd('0x1d7')});db[_0x65dd('0x1d8')]['hasMany'](db[_0x65dd('0xad')],{'as':_0x65dd('0x1cd'),'onDelete':'cascade','foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xad')][_0x65dd('0x121')](db[_0x65dd('0xaf')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0xad')][_0x65dd('0x121')](db['SugarcrmField'],{'as':_0x65dd('0x1cf'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0xad')][_0x65dd('0x121')](db[_0x65dd('0xaf')],{'as':_0x65dd('0x1cb'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d1')});db['SugarcrmConfiguration'][_0x65dd('0x12f')](db[_0x65dd('0x1d8')],{'as':'Account','foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xaf')][_0x65dd('0x121')](db[_0x65dd('0xaf')],{'as':'Subject','foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0xaf')][_0x65dd('0x121')](db['SugarcrmField'],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db['SugarcrmField'][_0x65dd('0x121')](db[_0x65dd('0xaf')],{'as':_0x65dd('0x1d5'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xaf')][_0x65dd('0x12f')](db[_0x65dd('0x1d6')],{'as':_0x65dd('0x1d6'),'foreignKey':'VariableId'});db[_0x65dd('0xb0')][_0x65dd('0x121')](db[_0x65dd('0x1da')],{'as':_0x65dd('0x1cd'),'onDelete':_0x65dd('0x11e'),'foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0x65dd('0xb2')],{'as':'Subjects','onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0x1da')][_0x65dd('0x121')](db['DeskField'],{'as':_0x65dd('0x1cf'),'onDelete':'cascade','foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0x1da')]['hasMany'](db[_0x65dd('0xb2')],{'as':'Fields','onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0x1da')][_0x65dd('0x12f')](db['DeskAccount'],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x1d9')});db['DeskConfiguration'][_0x65dd('0x130')](db[_0x65dd('0x93')],{'through':'int_desk_configuration_has_tags'});db[_0x65dd('0xb2')][_0x65dd('0x121')](db[_0x65dd('0xb2')],{'as':_0x65dd('0x1db'),'foreignKey':_0x65dd('0x1d3')});db['DeskField'][_0x65dd('0x121')](db[_0x65dd('0xb2')],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0x65dd('0x1d5'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xb2')][_0x65dd('0x12f')](db[_0x65dd('0x1d6')],{'as':_0x65dd('0x1d6'),'foreignKey':_0x65dd('0x1d7')});db[_0x65dd('0x1dc')][_0x65dd('0x121')](db[_0x65dd('0xb5')],{'as':_0x65dd('0x1cd'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d9')});db['ZohoConfiguration'][_0x65dd('0x121')](db[_0x65dd('0xb7')],{'as':_0x65dd('0x1dd'),'onDelete':_0x65dd('0x11e'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x65dd('0x121')](db[_0x65dd('0xb7')],{'as':_0x65dd('0x1cf'),'onDelete':'cascade','foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0xb5')]['hasMany'](db['ZohoField'],{'as':'Fields','onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xb5')]['belongsTo'](db[_0x65dd('0x1dc')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x1d9')});db['ZohoField'][_0x65dd('0x121')](db['ZohoField'],{'as':'Subject','foreignKey':_0x65dd('0x1d3')});db['ZohoField'][_0x65dd('0x121')](db['ZohoField'],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0xb7')][_0x65dd('0x121')](db[_0x65dd('0xb7')],{'as':'Field','foreignKey':_0x65dd('0x1d1')});db['ZohoField'][_0x65dd('0x12f')](db[_0x65dd('0x1d6')],{'as':_0x65dd('0x1d6'),'foreignKey':_0x65dd('0x1d7')});db[_0x65dd('0x1de')][_0x65dd('0x121')](db['ZendeskConfiguration'],{'as':_0x65dd('0x1cd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x65dd('0x1df')][_0x65dd('0x121')](db[_0x65dd('0x1e0')],{'as':_0x65dd('0x1dd'),'foreignKey':'SubjectId'});db[_0x65dd('0x1df')][_0x65dd('0x121')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0x1df')][_0x65dd('0x121')](db[_0x65dd('0x1e0')],{'as':_0x65dd('0x1cb'),'foreignKey':_0x65dd('0x1d1')});db['ZendeskConfiguration']['belongsTo'](db[_0x65dd('0x1de')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0x1df')]['belongsToMany'](db[_0x65dd('0x93')],{'through':_0x65dd('0x1e1')});db[_0x65dd('0x1e0')][_0x65dd('0x121')](db[_0x65dd('0x1e0')],{'as':_0x65dd('0x1db'),'foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0x1e0')][_0x65dd('0x121')](db[_0x65dd('0x1e0')],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0x1e0')]['hasMany'](db[_0x65dd('0x1e0')],{'as':_0x65dd('0x1d5'),'foreignKey':'FieldId'});db[_0x65dd('0x1e0')][_0x65dd('0x12f')](db['Variable'],{'as':_0x65dd('0x1d6'),'foreignKey':'VariableId'});db['FreshdeskAccount']['hasMany'](db[_0x65dd('0xbd')],{'as':'Configurations','onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xbd')][_0x65dd('0x121')](db[_0x65dd('0xbf')],{'as':_0x65dd('0x1dd'),'onDelete':_0x65dd('0x11e'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration']['hasMany'](db[_0x65dd('0xbf')],{'as':_0x65dd('0x1cf'),'onDelete':'cascade','foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0xbd')][_0x65dd('0x121')](db[_0x65dd('0xbf')],{'as':_0x65dd('0x1cb'),'onDelete':_0x65dd('0x11e'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x65dd('0x12f')](db[_0x65dd('0xbb')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xbd')][_0x65dd('0x130')](db['Tag'],{'through':_0x65dd('0x1e2')});db[_0x65dd('0xbf')]['hasMany'](db[_0x65dd('0xbf')],{'as':_0x65dd('0x1db'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db[_0x65dd('0xbf')],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db['FreshdeskField'][_0x65dd('0x121')](db[_0x65dd('0xbf')],{'as':'Field','foreignKey':'FieldId'});db[_0x65dd('0xbf')][_0x65dd('0x12f')](db['Variable'],{'as':_0x65dd('0x1d6'),'foreignKey':'VariableId'});db[_0x65dd('0x1e3')][_0x65dd('0x121')](db[_0x65dd('0xc1')],{'as':_0x65dd('0x1cd'),'onDelete':'cascade','foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xc1')][_0x65dd('0x121')](db['VtigerField'],{'as':_0x65dd('0x1dd'),'foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0xc1')]['hasMany'](db[_0x65dd('0xc2')],{'as':_0x65dd('0x1cf'),'foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0xc1')][_0x65dd('0x121')](db['VtigerField'],{'as':_0x65dd('0x1cb'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xc1')]['belongsTo'](db[_0x65dd('0x1e3')],{'as':_0x65dd('0x175'),'foreignKey':'AccountId'});db[_0x65dd('0xc2')][_0x65dd('0x121')](db[_0x65dd('0xc2')],{'as':_0x65dd('0x1db'),'foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0xc2')]['hasMany'](db[_0x65dd('0xc2')],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0xc2')][_0x65dd('0x121')](db[_0x65dd('0xc2')],{'as':_0x65dd('0x1d5'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xc2')]['belongsTo'](db[_0x65dd('0x1d6')],{'as':_0x65dd('0x1d6'),'foreignKey':'VariableId'});db[_0x65dd('0xc4')]['hasMany'](db[_0x65dd('0x1e4')],{'as':'Configurations','onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0x1e4')][_0x65dd('0x121')](db[_0x65dd('0xc6')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x65dd('0x1e4')]['hasMany'](db[_0x65dd('0xc6')],{'as':'Descriptions','foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0x1e4')][_0x65dd('0x121')](db[_0x65dd('0xc6')],{'as':_0x65dd('0x1cb'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x65dd('0x12f')](db[_0x65dd('0xc4')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xc6')][_0x65dd('0x121')](db['ServicenowField'],{'as':_0x65dd('0x1db'),'foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0xc6')][_0x65dd('0x121')](db[_0x65dd('0xc6')],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db['ServicenowField'][_0x65dd('0x121')](db['ServicenowField'],{'as':_0x65dd('0x1d5'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xc6')][_0x65dd('0x12f')](db[_0x65dd('0x1d6')],{'as':'Variable','foreignKey':'VariableId'});db[_0x65dd('0xc8')]['hasMany'](db[_0x65dd('0xc9')],{'as':_0x65dd('0x1cd'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xc8')][_0x65dd('0x12f')](db['CloudProvider'],{'as':_0x65dd('0x113'),'foreignKey':_0x65dd('0x169')});db['Dynamics365Configuration'][_0x65dd('0x121')](db[_0x65dd('0x1e5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0xc9')][_0x65dd('0x121')](db[_0x65dd('0x1e5')],{'as':_0x65dd('0x1cf'),'onDelete':_0x65dd('0x11e'),'foreignKey':'DescriptionId'});db[_0x65dd('0xc9')][_0x65dd('0x121')](db[_0x65dd('0x1e5')],{'as':_0x65dd('0x1cb'),'onDelete':_0x65dd('0x11e'),'foreignKey':'FieldId'});db[_0x65dd('0xc9')][_0x65dd('0x12f')](db[_0x65dd('0xc8')],{'as':'Account','foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0x1e5')]['hasMany'](db['Dynamics365Field'],{'as':_0x65dd('0x1db'),'foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0x1e5')][_0x65dd('0x121')](db[_0x65dd('0x1e5')],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0x1e5')][_0x65dd('0x121')](db[_0x65dd('0x1e5')],{'as':'Field','foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0x1e5')][_0x65dd('0x12f')](db[_0x65dd('0x1d6')],{'as':'Variable','foreignKey':_0x65dd('0x1d7')});db['FreshsalesAccount'][_0x65dd('0x121')](db[_0x65dd('0xce')],{'as':'Configurations','onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xce')][_0x65dd('0x121')](db[_0x65dd('0xd0')],{'as':_0x65dd('0x1dd'),'foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0xce')][_0x65dd('0x121')](db[_0x65dd('0xd0')],{'as':_0x65dd('0x1cf'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0x65dd('0xd0')],{'as':_0x65dd('0x1cb'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xce')][_0x65dd('0x12f')](db[_0x65dd('0xcc')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x1d9')});db[_0x65dd('0xd0')]['hasMany'](db[_0x65dd('0xd0')],{'as':_0x65dd('0x1db'),'foreignKey':_0x65dd('0x1d3')});db[_0x65dd('0xd0')]['hasMany'](db['FreshsalesField'],{'as':_0x65dd('0x1d4'),'foreignKey':_0x65dd('0x1d0')});db[_0x65dd('0xd0')]['hasMany'](db['FreshsalesField'],{'as':_0x65dd('0x1d5'),'foreignKey':_0x65dd('0x1d1')});db[_0x65dd('0xd0')][_0x65dd('0x12f')](db[_0x65dd('0x1d6')],{'as':'Variable','foreignKey':_0x65dd('0x1d7')});db[_0x65dd('0xd3')]['belongsTo'](db[_0x65dd('0x143')],{});db[_0x65dd('0xd3')][_0x65dd('0x12f')](db['CmList'],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0xd3')]['belongsTo'](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db['ChatQueueReport'][_0x65dd('0x12f')](db[_0x65dd('0x136')],{});db['ChatQueueReport'][_0x65dd('0x12f')](db[_0x65dd('0x6d')],{});db[_0x65dd('0xd3')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{});db[_0x65dd('0xd3')][_0x65dd('0x12f')](db['ChatQueue'],{});db[_0x65dd('0xd4')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'onDelete':_0x65dd('0x11e'),'foreignKey':'FromId'});db[_0x65dd('0xd4')]['belongsTo'](db[_0x65dd('0x11c')],{'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x1e6')});db[_0x65dd('0xd8')]['hasMany'](db[_0x65dd('0x1e7')],{'foreignKey':_0x65dd('0x1e8'),'onDelete':_0x65dd('0x11e')});db['JscriptySessionReport'][_0x65dd('0x121')](db[_0x65dd('0x1e9')],{'foreignKey':_0x65dd('0x1e8'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0xda')][_0x65dd('0x12f')](db[_0x65dd('0x57')],{});db[_0x65dd('0xda')]['belongsTo'](db[_0x65dd('0xfc')],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0xda')][_0x65dd('0x12f')](db['CmContact'],{'as':_0x65dd('0x166'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0x65dd('0x12f')](db[_0x65dd('0x59')],{});db[_0x65dd('0xda')][_0x65dd('0x12f')](db[_0x65dd('0x5b')],{});db['SmsQueueReport'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{});db['SmsQueueReport'][_0x65dd('0x12f')](db[_0x65dd('0x5d')],{});db[_0x65dd('0xe0')][_0x65dd('0x121')](db[_0x65dd('0xd8')],{'foreignKey':_0x65dd('0x1ea')});db[_0x65dd('0xe0')][_0x65dd('0x121')](db[_0x65dd('0x1e7')],{'foreignKey':_0x65dd('0x1ea')});db[_0x65dd('0xe0')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x65dd('0x1ea')});db[_0x65dd('0x173')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':'user_has_teams'});db[_0x65dd('0x173')]['belongsToMany'](db[_0x65dd('0x1a')],{'through':_0x65dd('0x115'),'as':_0x65dd('0x13b')});db[_0x65dd('0x173')][_0x65dd('0x130')](db[_0x65dd('0x13e')],{'through':_0x65dd('0x174'),'as':_0x65dd('0x13f')});db['Team']['belongsToMany'](db[_0x65dd('0x140')],{'through':_0x65dd('0x19f'),'as':_0x65dd('0x1eb')});db['Team'][_0x65dd('0x130')](db[_0x65dd('0x54')],{'through':_0x65dd('0x18b'),'as':_0x65dd('0x1ec')});db[_0x65dd('0x173')][_0x65dd('0x130')](db[_0x65dd('0x5d')],{'through':_0x65dd('0x191'),'as':_0x65dd('0x1ed')});db[_0x65dd('0x173')][_0x65dd('0x130')](db[_0x65dd('0x67')],{'through':_0x65dd('0x198'),'as':_0x65dd('0x141')});db[_0x65dd('0x173')][_0x65dd('0x130')](db[_0x65dd('0x111')],{'through':_0x65dd('0x1ee'),'as':_0x65dd('0x142')});db[_0x65dd('0x173')][_0x65dd('0x130')](db[_0x65dd('0xfe')],{'through':_0x65dd('0x116'),'as':_0x65dd('0x13d')});db[_0x65dd('0xee')]['hasMany'](db[_0x65dd('0x78')],{'as':_0x65dd('0x155'),'foreignKey':'CampaignId'});db[_0x65dd('0xee')]['hasMany'](db[_0x65dd('0x124')],{'as':'HopperFinals','foreignKey':_0x65dd('0x1ac')});db[_0x65dd('0xee')]['hasMany'](db[_0x65dd('0x7c')],{'as':_0x65dd('0x1a6'),'foreignKey':_0x65dd('0x1ac')});db['Campaign'][_0x65dd('0x121')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x65dd('0xee')][_0x65dd('0x12f')](db[_0x65dd('0x2d')],{'as':_0x65dd('0x2d'),'foreignKey':_0x65dd('0x1ef')});db[_0x65dd('0xee')][_0x65dd('0x12f')](db[_0x65dd('0x2d')],{'as':'TrunkBackup','foreignKey':_0x65dd('0x159')});db['Campaign']['belongsTo'](db[_0x65dd('0x8a')],{'as':_0x65dd('0x8a'),'foreignKey':_0x65dd('0x15a')});db['Campaign'][_0x65dd('0x12f')](db['SquareProject'],{'as':_0x65dd('0xe6'),'foreignKey':_0x65dd('0x1f0')});db['Campaign'][_0x65dd('0x130')](db[_0x65dd('0xfc')],{'as':_0x65dd('0x132'),'through':'campaigns_has_cm_lists'});db[_0x65dd('0xee')][_0x65dd('0x130')](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x65dd('0x12f')](db[_0x65dd('0x6f')],{'as':_0x65dd('0x6f'),'foreignKey':_0x65dd('0x17e')});db[_0x65dd('0xf6')][_0x65dd('0x12f')](db[_0x65dd('0x46')],{});db[_0x65dd('0xf6')][_0x65dd('0x12f')](db[_0x65dd('0x12b')],{});db[_0x65dd('0xf6')][_0x65dd('0x12f')](db[_0x65dd('0x42')],{'foreignKey':_0x65dd('0x1f1'),'as':_0x65dd('0x1f2')});db['MailTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f3'),'as':'FromAgent'});db[_0x65dd('0xf6')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f4'),'as':_0x65dd('0x1f5')});db['MailTransferReport']['belongsTo'](db[_0x65dd('0x13e')],{'foreignKey':_0x65dd('0x1f6'),'as':_0x65dd('0x1f7')});db[_0x65dd('0xf6')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x65dd('0x1f8'),'as':'ToAccount'});db[_0x65dd('0xf8')][_0x65dd('0x12f')](db[_0x65dd('0x6d')],{});db[_0x65dd('0xf8')][_0x65dd('0x12f')](db[_0x65dd('0x136')],{});db['ChatTransferReport'][_0x65dd('0x12f')](db['ChatWebsite'],{'foreignKey':_0x65dd('0x1f9'),'as':_0x65dd('0x1f2')});db['ChatTransferReport'][_0x65dd('0x12f')](db['User'],{'foreignKey':_0x65dd('0x1f3'),'as':'FromAgent'});db['ChatTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f4'),'as':_0x65dd('0x1f5')});db[_0x65dd('0xf8')][_0x65dd('0x12f')](db[_0x65dd('0x140')],{'foreignKey':_0x65dd('0x1fa'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db[_0x65dd('0x143')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x65dd('0x1fb')][_0x65dd('0x12f')](db['FaxMessage'],{});db[_0x65dd('0x1fb')][_0x65dd('0x12f')](db[_0x65dd('0x51')],{});db['FaxTransferReport']['belongsTo'](db[_0x65dd('0x4e')],{'foreignKey':'FromFaxAccountId','as':_0x65dd('0x1f2')});db[_0x65dd('0x1fb')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':'FromUserId','as':_0x65dd('0x1fc')});db['FaxTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f4'),'as':'ToAgent'});db[_0x65dd('0x1fb')][_0x65dd('0x12f')](db[_0x65dd('0x54')],{'foreignKey':_0x65dd('0x1fd'),'as':_0x65dd('0x1f7')});db[_0x65dd('0x1fb')][_0x65dd('0x12f')](db[_0x65dd('0x4e')],{'foreignKey':_0x65dd('0x1fe'),'as':_0x65dd('0x1ff')});db[_0x65dd('0xf9')][_0x65dd('0x12f')](db[_0x65dd('0x65')],{});db[_0x65dd('0xf9')][_0x65dd('0x12f')](db['OpenchannelInteraction'],{});db[_0x65dd('0xf9')][_0x65dd('0x12f')](db['OpenchannelAccount'],{'foreignKey':_0x65dd('0x200'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f3'),'as':_0x65dd('0x1fc')});db[_0x65dd('0xf9')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f4'),'as':_0x65dd('0x1f5')});db[_0x65dd('0xf9')][_0x65dd('0x12f')](db['OpenchannelQueue'],{'foreignKey':_0x65dd('0x201'),'as':_0x65dd('0x1f7')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x65dd('0x202'),'as':_0x65dd('0x1ff')});db['SmsTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x5b')],{});db['SmsTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x59')],{});db[_0x65dd('0xfa')][_0x65dd('0x12f')](db[_0x65dd('0x57')],{'foreignKey':_0x65dd('0x203'),'as':_0x65dd('0x1f2')});db[_0x65dd('0xfa')]['belongsTo'](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f3'),'as':_0x65dd('0x1fc')});db['SmsTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f4'),'as':_0x65dd('0x1f5')});db['SmsTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x5d')],{'foreignKey':_0x65dd('0x204'),'as':'ToQueue'});db[_0x65dd('0xfa')][_0x65dd('0x12f')](db[_0x65dd('0x57')],{'foreignKey':_0x65dd('0x205'),'as':_0x65dd('0x1ff')});db[_0x65dd('0xfc')][_0x65dd('0x121')](db[_0x65dd('0x16e')],{'as':_0x65dd('0x16f'),'foreignKey':_0x65dd('0x171'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0xfc')][_0x65dd('0x121')](db[_0x65dd('0x80')],{'as':_0x65dd('0x206'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0xfc')]['hasMany'](db[_0x65dd('0x76')],{'as':_0x65dd('0x1a2'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0xfc')][_0x65dd('0x121')](db[_0x65dd('0x124')],{'as':_0x65dd('0x125'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0xfc')]['hasMany'](db[_0x65dd('0x7c')],{'as':_0x65dd('0x126'),'foreignKey':_0x65dd('0x171')});db['CmList'][_0x65dd('0x121')](db['ReportAgentPreview'],{'as':_0x65dd('0x7e'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0xfc')][_0x65dd('0x130')](db[_0x65dd('0x1a')],{'as':'Queues','through':_0x65dd('0x15d')});db[_0x65dd('0xfc')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x133')});db[_0x65dd('0xfe')]['hasMany'](db[_0x65dd('0x17')],{'as':'Extensions','onDelete':'cascade'});db[_0x65dd('0xfe')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':'Agents','through':_0x65dd('0x118')});db[_0x65dd('0xfe')][_0x65dd('0x130')](db['Team'],{'through':_0x65dd('0x116'),'as':_0x65dd('0x15f')});db[_0x65dd('0x100')][_0x65dd('0x121')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x17a'),'foreignKey':_0x65dd('0x207')});db['UserProfile'][_0x65dd('0x121')](db[_0x65dd('0x102')],{'as':_0x65dd('0x208'),'foreignKey':_0x65dd('0x207'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x102')][_0x65dd('0x121')](db[_0x65dd('0x209')],{'as':'Resources','foreignKey':_0x65dd('0x20a'),'onDelete':_0x65dd('0x11e')});db[_0x65dd('0x106')]['hasMany'](db[_0x65dd('0x16e')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x65dd('0x11e')});db[_0x65dd('0x106')][_0x65dd('0x121')](db[_0x65dd('0x85')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db['WhatsappMessage'],{'as':_0x65dd('0x186'),'foreignKey':_0x65dd('0x20b')});db[_0x65dd('0x106')][_0x65dd('0x121')](db['WhatsappInteraction'],{'as':_0x65dd('0x184')});db[_0x65dd('0x106')]['hasMany'](db['WhatsappApplication'],{'as':_0x65dd('0x151'),'foreignKey':_0x65dd('0x20b'),'onDelete':'cascade'});db[_0x65dd('0x106')]['belongsTo'](db['CmList'],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0x106')][_0x65dd('0x12f')](db[_0x65dd('0x15b')],{'as':_0x65dd('0x15c'),'foreignKey':_0x65dd('0x172')});db[_0x65dd('0x106')][_0x65dd('0x130')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':_0x65dd('0x20c')});db[_0x65dd('0x20d')]['belongsTo'](db['User'],{'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x20d')][_0x65dd('0x12f')](db['WhatsappQueue'],{'onDelete':'restrict'});db['WhatsappApplication'][_0x65dd('0x12f')](db[_0x65dd('0x106')],{'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x20d')][_0x65dd('0x12f')](db[_0x65dd('0x8a')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x15a')});db[_0x65dd('0x20d')]['belongsTo'](db[_0x65dd('0x93')],{'onDelete':_0x65dd('0x16a'),'foreignKey':_0x65dd('0x17f')});db[_0x65dd('0x109')][_0x65dd('0x121')](db[_0x65dd('0x10b')],{'as':_0x65dd('0x186'),'onDelete':_0x65dd('0x11e'),'foreignKey':_0x65dd('0x20e')});db[_0x65dd('0x109')][_0x65dd('0x12f')](db[_0x65dd('0x106')],{'as':_0x65dd('0x175'),'foreignKey':_0x65dd('0x20b')});db[_0x65dd('0x109')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db[_0x65dd('0x109')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x176'),'foreignKey':'UserId'});db[_0x65dd('0x109')][_0x65dd('0x130')](db['Tag'],{'through':_0x65dd('0x1c2'),'as':_0x65dd('0x178')});db['WhatsappInteraction']['belongsToMany'](db[_0x65dd('0x93')],{'through':'whatsapp_interaction_has_tags','as':_0x65dd('0x179')});db[_0x65dd('0x109')][_0x65dd('0x130')](db['User'],{'as':_0x65dd('0x17a'),'through':_0x65dd('0x13a'),'foreignKey':_0x65dd('0x20e')});db['WhatsappMessage'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'as':_0x65dd('0x11c')});db['WhatsappMessage'][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x166')});db[_0x65dd('0x10b')][_0x65dd('0x12f')](db[_0x65dd('0x109')],{'onDelete':_0x65dd('0x11e'),'as':_0x65dd('0x17c'),'foreignKey':_0x65dd('0x20e')});db[_0x65dd('0x10b')][_0x65dd('0x12f')](db[_0x65dd('0x106')],{'as':_0x65dd('0x175'),'foreignKey':'WhatsappAccountId'});db[_0x65dd('0x10d')][_0x65dd('0x12f')](db[_0x65dd('0x106')],{});db[_0x65dd('0x10d')]['belongsTo'](db['CmList'],{'as':_0x65dd('0x180'),'foreignKey':_0x65dd('0x171')});db[_0x65dd('0x10d')][_0x65dd('0x12f')](db[_0x65dd('0x76')],{'as':_0x65dd('0x166'),'foreignKey':_0x65dd('0x167')});db['WhatsappQueueReport']['belongsTo'](db[_0x65dd('0x109')],{});db[_0x65dd('0x10d')][_0x65dd('0x12f')](db[_0x65dd('0x111')],{});db[_0x65dd('0x10d')][_0x65dd('0x12f')](db['WhatsappMessage'],{});db[_0x65dd('0x10d')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{});db[_0x65dd('0x10f')][_0x65dd('0x12f')](db[_0x65dd('0x10b')],{});db[_0x65dd('0x10f')][_0x65dd('0x12f')](db[_0x65dd('0x109')],{});db[_0x65dd('0x10f')][_0x65dd('0x12f')](db[_0x65dd('0x106')],{'foreignKey':_0x65dd('0x20f'),'as':_0x65dd('0x1f2')});db[_0x65dd('0x10f')][_0x65dd('0x12f')](db[_0x65dd('0x106')],{'foreignKey':_0x65dd('0x210'),'as':_0x65dd('0x1ff')});db['WhatsappTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x111')],{'foreignKey':_0x65dd('0x211'),'as':'ToQueue'});db[_0x65dd('0x10f')][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':'FromUserId','as':_0x65dd('0x1fc')});db['WhatsappTransferReport'][_0x65dd('0x12f')](db[_0x65dd('0x11c')],{'foreignKey':_0x65dd('0x1f4'),'as':_0x65dd('0x1f5')});db[_0x65dd('0x111')]['belongsToMany'](db[_0x65dd('0x11c')],{'as':_0x65dd('0x15e'),'through':'UserWhatsappQueue','foreignKey':_0x65dd('0x212')});db[_0x65dd('0x111')][_0x65dd('0x130')](db[_0x65dd('0x173')],{'through':_0x65dd('0x1ee'),'as':_0x65dd('0x15f')});db['UserSetting']['belongsTo'](db['User'],{'as':_0x65dd('0x213'),'foreignKey':_0x65dd('0x11f'),'onDelete':_0x65dd('0x11e'),'hooks':!![]});db[_0x65dd('0x113')][_0x65dd('0x11d')](db[_0x65dd('0xc8')],{'as':_0x65dd('0xc8'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0x65dd('0x3f')],{'as':_0x65dd('0x16c'),'onDelete':_0x65dd('0x16a')});db[_0x65dd('0x113')][_0x65dd('0x11d')](db['MailServerOut'],{'as':_0x65dd('0x16d'),'onDelete':_0x65dd('0x16a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2952=['SmsAccounts','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','Agents','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Answers','Messages','ListId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','ThroughTags','Users','Attachment','Interaction','ChatOfflineMessageId','TagId','List','DashboardItem','Items','FaxAccountId','Interactions','Exntensions','FaxApplication','FaxInteractionId','Owner','fax_interaction_has_tags','Tags','AttachmentId','team_has_fax_queues','Teams','FaxQueueReport','Dispositions','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','Queue','Website','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemTypeId','AllConditions','AllCondition','AnyConditions','TriggerAnyId','Fields','MetricId','SalesforceConfiguration','Configurations','SubjectId','DescriptionId','AccountId','Subject','Description','Field','FieldId','Variable','VariableId','SugarcrmAccount','Subjects','Descriptions','DeskAccount','int_desk_configuration_has_tags','ZendeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FreshsalesConfiguration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','FaxQueues','WhatsappQueue','team_has_whatsapp_queues','TeamVoicePrefix','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','utf8mb4','username','options','database','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','Pause','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueue','SmsQueue','SmsQueues','OpenchannelQueue','WhatsappQueues','cm_user_has_lists','ChatWebsite','ChatWebsites','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts'];(function(_0x2c2f3e,_0x7ae374){var _0x495ec5=function(_0x191ec9){while(--_0x191ec9){_0x2c2f3e['push'](_0x2c2f3e['shift']());}};_0x495ec5(++_0x7ae374);}(_0x2952,0xb8));var _0x2295=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x2952[_0x36ed48];return _0x51c63a;};'use strict';var config=require(_0x2295('0x0'));var Sequelize=require(_0x2295('0x1'));var _=require(_0x2295('0x2'));var jstz=require(_0x2295('0x3'));var timezone=jstz[_0x2295('0x4')]();config['sequelize']=_[_0x2295('0x5')](config[_0x2295('0x1')],{'database':_0x2295('0x6'),'username':_0x2295('0x7'),'password':'xC@LL1234','options':{'host':_0x2295('0x8'),'port':0xcea,'dialect':_0x2295('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x2295('0xa')](),'define':{'charset':_0x2295('0xb'),'collate':_0x2295('0xc')}}});config['sequelizeHistory']=_[_0x2295('0x5')](config[_0x2295('0xd')],{'database':'motion2','username':_0x2295('0x7'),'password':_0x2295('0xe'),'options':{'host':_0x2295('0x8'),'port':0xcea,'dialect':_0x2295('0x9'),'dialectOptions':{'charset':_0x2295('0xf')},'logging':![],'timezone':timezone[_0x2295('0xa')](),'define':{'charset':_0x2295('0xb'),'collate':_0x2295('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x2295('0x1')][_0x2295('0x10')],config['sequelize']['password'],config[_0x2295('0x1')][_0x2295('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2295('0xd')][_0x2295('0x12')],config[_0x2295('0xd')]['username'],config[_0x2295('0xd')][_0x2295('0x13')],config[_0x2295('0xd')][_0x2295('0x11')])};db['User']=db['sequelize'][_0x2295('0x14')](_0x2295('0x15'));db[_0x2295('0x16')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x17'));db[_0x2295('0x18')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x19'));db[_0x2295('0x1a')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0x2295('0x1b')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x1c'));db['VoiceQueue']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x1d'));db[_0x2295('0x1e')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x1f'));db[_0x2295('0x20')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x21'));db[_0x2295('0x22')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x2295('0x23')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x24'));db[_0x2295('0x25')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0x2295('0x26')]=db['sequelize'][_0x2295('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x2295('0x27')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x28'));db[_0x2295('0x29')]=db['sequelize'][_0x2295('0x14')](_0x2295('0x2a'));db[_0x2295('0x2b')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x2c'));db[_0x2295('0x2d')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x2e'));db['UserVoiceQueueRt']=db['sequelize']['import'](_0x2295('0x2f'));db[_0x2295('0x30')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x2295('0x31')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x2295('0x32')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x33'));db[_0x2295('0x34')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x35'));db[_0x2295('0x36')]=db['sequelize'][_0x2295('0x14')](_0x2295('0x37'));db[_0x2295('0x38')]=db['sequelize'][_0x2295('0x14')](_0x2295('0x39'));db[_0x2295('0x3a')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x2295('0x3b')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x3c'));db[_0x2295('0x3d')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x3e'));db[_0x2295('0x3f')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x40'));db[_0x2295('0x41')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x42'));db[_0x2295('0x43')]=db['sequelize']['import'](_0x2295('0x44'));db[_0x2295('0x45')]=db[_0x2295('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0x2295('0x46')]=db['sequelize'][_0x2295('0x14')]('../api/mailApplication/mailApplication.model');db[_0x2295('0x47')]=db[_0x2295('0x1')]['import'](_0x2295('0x48'));db[_0x2295('0x49')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x4a'));db[_0x2295('0x4b')]=db['sequelize'][_0x2295('0x14')](_0x2295('0x4c'));db['FaxApplication']=db[_0x2295('0x1')]['import'](_0x2295('0x4d'));db[_0x2295('0x4e')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x4f'));db[_0x2295('0x50')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x51'));db['FaxQueue']=db['sequelize'][_0x2295('0x14')](_0x2295('0x52'));db['FaxQueueReport']=db['sequelize'][_0x2295('0x14')]('../api/faxQueueReport/faxQueueReport.model');db[_0x2295('0x53')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x54'));db[_0x2295('0x55')]=db[_0x2295('0x1')]['import']('../api/smsApplication/smsApplication.model');db[_0x2295('0x56')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x57'));db[_0x2295('0x58')]=db['sequelize']['import'](_0x2295('0x59'));db['SmsQueue']=db[_0x2295('0x1')]['import'](_0x2295('0x5a'));db['OpenchannelAccount']=db['sequelize']['import']('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db['sequelize'][_0x2295('0x14')](_0x2295('0x5b'));db[_0x2295('0x5c')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x5d'));db[_0x2295('0x5e')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x5f'));db['OpenchannelQueue']=db['sequelize'][_0x2295('0x14')](_0x2295('0x60'));db['ChatWebsite']=db[_0x2295('0x1')][_0x2295('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x2295('0x61')]=db[_0x2295('0x1')]['import'](_0x2295('0x62'));db[_0x2295('0x63')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/chatApplication/chatApplication.model');db[_0x2295('0x64')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x65'));db[_0x2295('0x66')]=db[_0x2295('0x1')]['import'](_0x2295('0x67'));db[_0x2295('0x68')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x69'));db[_0x2295('0x6a')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x6b'));db[_0x2295('0x6c')]=db['sequelize'][_0x2295('0x14')](_0x2295('0x6d'));db[_0x2295('0x6e')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x6f'));db[_0x2295('0x70')]=db[_0x2295('0x1')]['import'](_0x2295('0x71'));db[_0x2295('0x72')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x73'));db[_0x2295('0x74')]=db['sequelize']['import'](_0x2295('0x75'));db[_0x2295('0x76')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x77'));db[_0x2295('0x78')]=db[_0x2295('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x2295('0x79')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x7a'));db[_0x2295('0x7b')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x7c'));db[_0x2295('0x7d')]=db['sequelize'][_0x2295('0x14')](_0x2295('0x7e'));db['Action']=db[_0x2295('0x1')]['import'](_0x2295('0x7f'));db[_0x2295('0x80')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x81'));db[_0x2295('0x82')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x83'));db[_0x2295('0x84')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/disposition/disposition.model');db[_0x2295('0x85')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x86'));db[_0x2295('0x87')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/interval/interval.model');db[_0x2295('0x88')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/pause/pause.model');db['Cdr']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x89'));db[_0x2295('0x8a')]=db['sequelize'][_0x2295('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x2295('0x8b')]=db[_0x2295('0x1')]['import'](_0x2295('0x8c'));db[_0x2295('0x8d')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/sound/sound.model');db[_0x2295('0x8e')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x8f'));db['ContactItemType']=db['sequelize'][_0x2295('0x14')](_0x2295('0x90'));db[_0x2295('0x91')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x92'));db[_0x2295('0x93')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x2295('0x94')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x95'));db[_0x2295('0x96')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x97'));db['Variable']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x98'));db[_0x2295('0x99')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/integration/integration.model');db[_0x2295('0x9a')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x9b'));db[_0x2295('0x9c')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x9d'));db[_0x2295('0x9e')]=db[_0x2295('0x1')]['import'](_0x2295('0x9f'));db[_0x2295('0xa0')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xa1'));db[_0x2295('0xa2')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xa3'));db[_0x2295('0xa4')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xa5'));db[_0x2295('0xa6')]=db['sequelize'][_0x2295('0x14')](_0x2295('0xa7'));db['SalesforceConfiguration']=db['sequelize'][_0x2295('0x14')](_0x2295('0xa8'));db[_0x2295('0xa9')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xaa'));db['SugarcrmAccount']=db[_0x2295('0x1')]['import'](_0x2295('0xab'));db[_0x2295('0xac')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xad'));db[_0x2295('0xae')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xaf'));db['DeskAccount']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xb0'));db[_0x2295('0xb1')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xb2'));db[_0x2295('0xb3')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xb4'));db[_0x2295('0xb5')]=db[_0x2295('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0x2295('0xb6')]=db['sequelize'][_0x2295('0x14')](_0x2295('0xb7'));db[_0x2295('0xb8')]=db[_0x2295('0x1')]['import'](_0x2295('0xb9'));db[_0x2295('0xba')]=db['sequelize']['import'](_0x2295('0xbb'));db[_0x2295('0xbc')]=db['sequelize'][_0x2295('0x14')](_0x2295('0xbd'));db['ZendeskField']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xbe'));db[_0x2295('0xbf')]=db['sequelize']['import'](_0x2295('0xc0'));db[_0x2295('0xc1')]=db[_0x2295('0x1')]['import'](_0x2295('0xc2'));db[_0x2295('0xc3')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xc4'));db[_0x2295('0xc5')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xc6'));db[_0x2295('0xc7')]=db[_0x2295('0x1')]['import'](_0x2295('0xc8'));db[_0x2295('0xc9')]=db['sequelize'][_0x2295('0x14')](_0x2295('0xca'));db[_0x2295('0xcb')]=db[_0x2295('0x1')]['import'](_0x2295('0xcc'));db['ServicenowConfiguration']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xcd'));db[_0x2295('0xce')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x2295('0xcf')]=db[_0x2295('0x1')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0x2295('0xd0')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xd1'));db[_0x2295('0xd2')]=db[_0x2295('0x1')]['import'](_0x2295('0xd3'));db[_0x2295('0xd4')]=db[_0x2295('0x1')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db['sequelize'][_0x2295('0x14')](_0x2295('0xd5'));db[_0x2295('0xd6')]=db['sequelize'][_0x2295('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x2295('0x99')]=db[_0x2295('0x1')]['import']('../api/integration/integration.model');db[_0x2295('0xd7')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xd8'));db[_0x2295('0xd9')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xda'));db[_0x2295('0xdb')]=db['sequelize']['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x2295('0xdc')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xdd'));db[_0x2295('0xde')]=db['sequelize'][_0x2295('0x14')](_0x2295('0xdf'));db[_0x2295('0xe0')]=db['sequelize'][_0x2295('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x2295('0x1')]['import'](_0x2295('0xe1'));db[_0x2295('0xe2')]=db['sequelize']['import'](_0x2295('0xe3'));db[_0x2295('0xe4')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xe5'));db[_0x2295('0xe6')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xe7'));db[_0x2295('0xe8')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/setting/setting.model');db[_0x2295('0xe9')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xea'));db[_0x2295('0xeb')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xec'));db[_0x2295('0xed')]=db['sequelize'][_0x2295('0x14')](_0x2295('0xee'));db['SquareMessage']=db['sequelize'][_0x2295('0x14')](_0x2295('0xef'));db[_0x2295('0xf0')]=db['sequelize'][_0x2295('0x14')]('../api/team/team.model');db[_0x2295('0xf1')]=db[_0x2295('0x1')]['import'](_0x2295('0xf2'));db['Campaign']=db[_0x2295('0x1')]['import'](_0x2295('0xf3'));db['Migration']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xf4'));db['Attachment']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xf5'));db['Plugin']=db[_0x2295('0x1')]['import']('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xf6'));db[_0x2295('0xf7')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x2295('0xf8')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0xf9'));db[_0x2295('0xfa')]=db['sequelize'][_0x2295('0x14')](_0x2295('0xfb'));db['SmsTransferReport']=db[_0x2295('0x1')][_0x2295('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0x2295('0xfc')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/cmList/cmList.model');db[_0x2295('0xfd')]=db['sequelize'][_0x2295('0x14')](_0x2295('0xfe'));db[_0x2295('0xff')]=db[_0x2295('0x1')][_0x2295('0x14')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x100'));db[_0x2295('0x101')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x102'));db[_0x2295('0x103')]=db[_0x2295('0x1')]['import'](_0x2295('0x104'));db[_0x2295('0x105')]=db['sequelize']['import'](_0x2295('0x106'));db[_0x2295('0x107')]=db['sequelize']['import'](_0x2295('0x108'));db[_0x2295('0x109')]=db['sequelize']['import'](_0x2295('0x10a'));db[_0x2295('0x10b')]=db[_0x2295('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x2295('0x10c')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x10d'));db[_0x2295('0x10e')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x10f'));db['WhatsappQueue']=db['sequelize']['import'](_0x2295('0x110'));db[_0x2295('0x111')]=db[_0x2295('0x1')]['import'](_0x2295('0x112'));db['TeamVoiceQueue']=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x113'));db['TeamVoicePrefix']=db[_0x2295('0x1')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x2295('0x114')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x115'));db[_0x2295('0x116')]=db[_0x2295('0x1')][_0x2295('0x14')](_0x2295('0x117'));db[_0x2295('0x118')][_0x2295('0x119')](db[_0x2295('0x20')],{'as':_0x2295('0x20'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')][_0x2295('0x119')](db[_0x2295('0x116')],{'as':'userSetting','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')][_0x2295('0x11c')](db[_0x2295('0x1e')],{'as':_0x2295('0x11d'),'foreignKey':'UserId'});db[_0x2295('0x118')][_0x2295('0x11c')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')]['hasMany'](db[_0x2295('0x1a')],{'as':_0x2295('0x11e'),'onDelete':_0x2295('0x11a'),'hooks':!![]});db['User'][_0x2295('0x11c')](db[_0x2295('0x78')],{'as':_0x2295('0x11f'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')][_0x2295('0x11c')](db['CmHopperHistory'],{'as':_0x2295('0x120'),'foreignKey':_0x2295('0x11b')});db['User'][_0x2295('0x11c')](db[_0x2295('0x7b')],{'as':_0x2295('0x7b'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')][_0x2295('0x11c')](db['ChatInteraction'],{'as':_0x2295('0x121'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')][_0x2295('0x11c')](db[_0x2295('0x56')],{'as':_0x2295('0x122'),'foreignKey':_0x2295('0x11b')});db['User'][_0x2295('0x11c')](db['FaxInteraction'],{'as':_0x2295('0x123'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')][_0x2295('0x11c')](db[_0x2295('0x43')],{'as':'MailInteractions','foreignKey':_0x2295('0x11b')});db['User'][_0x2295('0x11c')](db['WhatsappInteraction'],{'as':_0x2295('0x124'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x118')][_0x2295('0x11c')](db[_0x2295('0x103')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x2295('0x118')]['hasMany'](db[_0x2295('0x74')],{'as':'Hoppers','foreignKey':_0x2295('0x11b'),'onDelete':_0x2295('0x125')});db[_0x2295('0x118')][_0x2295('0x126')](db[_0x2295('0xff')],{'as':_0x2295('0xff'),'foreignKey':_0x2295('0x127')});db[_0x2295('0x118')][_0x2295('0x128')](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db[_0x2295('0x118')]['belongsToMany'](db[_0x2295('0x72')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x2295('0x118')]['belongsToMany'](db[_0x2295('0xfc')],{'as':_0x2295('0x129'),'through':'cm_user_has_lists'});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0xf0')],{'through':_0x2295('0x12a')});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x43')],{'as':_0x2295('0x12b'),'through':_0x2295('0x12c')});db['User']['belongsToMany'](db['ChatInteraction'],{'as':_0x2295('0x121'),'through':_0x2295('0x12d')});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x4e')],{'as':_0x2295('0x123'),'through':_0x2295('0x12e')});db[_0x2295('0x118')][_0x2295('0x128')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x2295('0x12f')});db[_0x2295('0x118')]['belongsToMany'](db[_0x2295('0x5c')],{'as':_0x2295('0x130'),'through':'user_has_openchannel_interactions'});db['User'][_0x2295('0x128')](db['WhatsappInteraction'],{'as':_0x2295('0x124'),'through':_0x2295('0x131')});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x132')],{'as':_0x2295('0x133'),'through':'UserVoiceQueue','required':![]});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0xfd')],{'as':_0x2295('0x134'),'through':'UserVoicePrefix','required':![]});db[_0x2295('0x118')][_0x2295('0x128')](db['MailQueue'],{'as':_0x2295('0x135'),'through':_0x2295('0x32'),'required':![]});db[_0x2295('0x118')]['belongsToMany'](db[_0x2295('0x6a')],{'as':_0x2295('0x136'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x137')],{'as':'FaxQueues','through':_0x2295('0x34'),'required':![]});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x138')],{'as':_0x2295('0x139'),'through':'UserSmsQueue','required':![]});db[_0x2295('0x118')]['belongsToMany'](db[_0x2295('0x13a')],{'as':'OpenchannelQueues','through':_0x2295('0x38'),'required':![]});db[_0x2295('0x118')][_0x2295('0x128')](db['WhatsappQueue'],{'as':_0x2295('0x13b'),'through':_0x2295('0x3a'),'required':![]});db[_0x2295('0x118')]['belongsToMany'](db[_0x2295('0xfc')],{'through':_0x2295('0x13c')});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x13d')],{'as':_0x2295('0x13e'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db['FaxAccount'],{'as':'FaxAccounts','through':_0x2295('0x13f')});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x3f')],{'as':'MailAccounts','through':_0x2295('0x140')});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x141')],{'as':_0x2295('0x142'),'through':_0x2295('0x143')});db[_0x2295('0x118')][_0x2295('0x128')](db[_0x2295('0x53')],{'as':_0x2295('0x144'),'through':'user_has_sms_accounts'});db[_0x2295('0x118')]['belongsToMany'](db[_0x2295('0x105')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x2295('0x16')][_0x2295('0x11c')](db[_0x2295('0x1a')],{'as':_0x2295('0x145'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x146')});db[_0x2295('0x18')][_0x2295('0x11c')](db[_0x2295('0x1a')],{'onDelete':_0x2295('0x11a')});db[_0x2295('0x1a')][_0x2295('0x11c')](db[_0x2295('0x1a')],{'as':_0x2295('0x147'),'onDelete':_0x2295('0x11a')});db['VoiceMusicOnHold'][_0x2295('0x128')](db[_0x2295('0x8d')],{'as':'Sounds','through':_0x2295('0x148')});db[_0x2295('0x132')][_0x2295('0x11c')](db[_0x2295('0x149')],{'as':'Members','foreignKey':_0x2295('0x14a')});db[_0x2295('0x132')]['hasMany'](db[_0x2295('0x74')],{'as':_0x2295('0x14b'),'foreignKey':_0x2295('0x14a')});db[_0x2295('0x132')]['hasMany'](db['CmHopperFinal'],{'as':_0x2295('0x11f'),'foreignKey':'VoiceQueueId'});db[_0x2295('0x132')][_0x2295('0x11c')](db['CmHopperHistory'],{'as':_0x2295('0x14c'),'foreignKey':_0x2295('0x14a')});db[_0x2295('0x132')][_0x2295('0x11c')](db['ReportAgentPreview'],{'as':_0x2295('0x7b'),'foreignKey':_0x2295('0x14a')});db[_0x2295('0x132')][_0x2295('0x11c')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x2295('0x132')][_0x2295('0x11c')](db[_0x2295('0xe0')],{'as':_0x2295('0x14d'),'foreignKey':_0x2295('0x14a')});db[_0x2295('0x132')][_0x2295('0x126')](db['Trunk'],{'as':'Trunk','foreignKey':_0x2295('0x14e')});db[_0x2295('0x132')]['belongsTo'](db[_0x2295('0x2b')],{'as':_0x2295('0x14f'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x2295('0x126')](db[_0x2295('0x87')],{'as':_0x2295('0x87'),'foreignKey':_0x2295('0x150')});db['VoiceQueue'][_0x2295('0x126')](db[_0x2295('0x88')],{'as':_0x2295('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2295('0x132')]['belongsToMany'](db['CmList'],{'as':_0x2295('0x129'),'through':'voice_queues_has_cm_lists'});db[_0x2295('0x132')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':_0x2295('0x30')});db[_0x2295('0x132')][_0x2295('0x128')](db[_0x2295('0xf0')],{'as':'Teams','through':_0x2295('0x153')});db[_0x2295('0x132')]['belongsToMany'](db[_0x2295('0xfc')],{'as':_0x2295('0x154'),'through':_0x2295('0x155')});db[_0x2295('0x1e')][_0x2295('0x126')](db[_0x2295('0x118')],{'as':_0x2295('0x118'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x156')][_0x2295('0x126')](db[_0x2295('0x118')],{'as':'User','foreignKey':'UserId'});db['VoiceMail'][_0x2295('0x11c')](db[_0x2295('0x22')],{'as':'Messages','onDelete':_0x2295('0x11a'),'foreignKey':'mailboxuser','sourceKey':_0x2295('0x157')});db[_0x2295('0x22')]['belongsTo'](db[_0x2295('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x2295('0x157')});db['VoiceCallReport'][_0x2295('0x11c')](db[_0x2295('0x27')],{'as':_0x2295('0x158'),'foreignKey':_0x2295('0x159'),'constraints':![]});db[_0x2295('0x23')][_0x2295('0x11c')](db[_0x2295('0x26')],{'as':_0x2295('0x15a'),'foreignKey':_0x2295('0x159'),'constraints':![]});db[_0x2295('0x23')][_0x2295('0x126')](db[_0x2295('0x118')],{'as':_0x2295('0x118'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x23')][_0x2295('0x126')](db[_0x2295('0x72')],{'as':_0x2295('0x15b'),'foreignKey':_0x2295('0x15c')});db[_0x2295('0x3b')][_0x2295('0x126')](db['MailAccount'],{'as':_0x2295('0x3f'),'foreignKey':_0x2295('0x15d')});db[_0x2295('0x3b')][_0x2295('0x126')](db[_0x2295('0x111')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x2295('0x15e')});db[_0x2295('0x3d')][_0x2295('0x126')](db[_0x2295('0x3f')],{'as':_0x2295('0x3f'),'foreignKey':_0x2295('0x15d')});db[_0x2295('0x3d')][_0x2295('0x126')](db[_0x2295('0x111')],{'as':_0x2295('0x111'),'foreignKey':_0x2295('0x15f'),'onDelete':_0x2295('0x15e')});db['MailAccount'][_0x2295('0x119')](db[_0x2295('0x3b')],{'as':_0x2295('0x160'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x3f')][_0x2295('0x119')](db['MailServerOut'],{'as':_0x2295('0x161'),'onDelete':'cascade'});db[_0x2295('0x3f')]['hasMany'](db[_0x2295('0x84')],{'as':'Dispositions','foreignKey':_0x2295('0x15d'),'onDelete':_0x2295('0x11a')});db['MailAccount'][_0x2295('0x11c')](db['CannedAnswer'],{'as':_0x2295('0x162'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x2295('0x11c')](db[_0x2295('0x45')],{'as':_0x2295('0x163'),'foreignKey':_0x2295('0x15d')});db[_0x2295('0x3f')][_0x2295('0x11c')](db[_0x2295('0x43')],{'as':'Interactions'});db[_0x2295('0x3f')][_0x2295('0x11c')](db[_0x2295('0x46')],{'as':_0x2295('0x147'),'foreignKey':_0x2295('0x15d'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x3f')]['belongsTo'](db[_0x2295('0xfc')],{'as':'List','foreignKey':_0x2295('0x164')});db[_0x2295('0x3f')][_0x2295('0x126')](db['Template'],{'as':_0x2295('0x94'),'foreignKey':'TemplateId'});db[_0x2295('0x3f')]['belongsTo'](db[_0x2295('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2295('0x165')});db[_0x2295('0x3f')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':'user_has_mail_accounts'});db[_0x2295('0x41')]['belongsToMany'](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':_0x2295('0x32')});db['MailQueue'][_0x2295('0x128')](db[_0x2295('0xf0')],{'through':_0x2295('0x166'),'as':'Teams'});db['MailInteraction']['hasMany'](db[_0x2295('0x45')],{'as':_0x2295('0x163'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x167')});db[_0x2295('0x43')][_0x2295('0x126')](db[_0x2295('0x3f')],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x15d')});db[_0x2295('0x43')][_0x2295('0x126')](db['CmContact'],{'as':_0x2295('0x15b'),'foreignKey':_0x2295('0x15c')});db[_0x2295('0x43')][_0x2295('0x126')](db[_0x2295('0x118')],{'as':'Owner','foreignKey':_0x2295('0x11b')});db[_0x2295('0x43')]['belongsToMany'](db[_0x2295('0x8e')],{'through':_0x2295('0x169'),'as':'Tags'});db[_0x2295('0x43')][_0x2295('0x128')](db['Tag'],{'through':_0x2295('0x169'),'as':_0x2295('0x16a')});db[_0x2295('0x43')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x16b'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x2295('0x45')][_0x2295('0x11c')](db[_0x2295('0x16c')],{'as':'Attachments','onDelete':_0x2295('0x11a')});db[_0x2295('0x45')][_0x2295('0x126')](db[_0x2295('0x118')],{'as':_0x2295('0x118')});db[_0x2295('0x45')][_0x2295('0x126')](db[_0x2295('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0x2295('0x45')][_0x2295('0x126')](db['MailInteraction'],{'as':_0x2295('0x16d'),'foreignKey':_0x2295('0x167')});db[_0x2295('0x45')][_0x2295('0x126')](db[_0x2295('0x3f')],{'as':'Account','foreignKey':_0x2295('0x15d')});db[_0x2295('0x45')][_0x2295('0x126')](db[_0x2295('0x13d')],{'as':_0x2295('0x13d'),'foreignKey':'ChatWebsiteId'});db[_0x2295('0x45')]['belongsTo'](db[_0x2295('0x68')],{'as':_0x2295('0x68'),'foreignKey':_0x2295('0x16e')});db['MailApplication'][_0x2295('0x126')](db[_0x2295('0x118')],{'onDelete':_0x2295('0x15e')});db[_0x2295('0x46')][_0x2295('0x126')](db[_0x2295('0x41')],{'onDelete':_0x2295('0x15e')});db['MailApplication'][_0x2295('0x126')](db[_0x2295('0x3f')],{'onDelete':_0x2295('0x15e')});db[_0x2295('0x46')]['belongsTo'](db[_0x2295('0x87')],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x150')});db['MailApplication'][_0x2295('0x126')](db[_0x2295('0x8e')],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x16f')});db[_0x2295('0x47')][_0x2295('0x126')](db[_0x2295('0x3f')],{});db[_0x2295('0x47')][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db[_0x2295('0x47')][_0x2295('0x126')](db[_0x2295('0x72')],{'as':_0x2295('0x15b'),'foreignKey':'ContactId'});db[_0x2295('0x47')]['belongsTo'](db[_0x2295('0x43')],{});db[_0x2295('0x47')]['belongsTo'](db[_0x2295('0x45')],{});db[_0x2295('0x47')]['belongsTo'](db[_0x2295('0x118')],{});db[_0x2295('0x47')][_0x2295('0x126')](db[_0x2295('0x41')],{});db['Dashboard'][_0x2295('0x11c')](db[_0x2295('0x171')],{'as':_0x2295('0x172'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x4b')]['hasMany'](db[_0x2295('0x84')],{'as':'Dispositions','foreignKey':_0x2295('0x173'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x4b')][_0x2295('0x11c')](db[_0x2295('0x82')],{'as':_0x2295('0x162'),'foreignKey':'FaxAccountId'});db[_0x2295('0x4b')][_0x2295('0x11c')](db[_0x2295('0x4e')],{'as':_0x2295('0x174')});db[_0x2295('0x4b')]['hasMany'](db['FaxApplication'],{'as':_0x2295('0x147'),'foreignKey':_0x2295('0x173'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x4b')][_0x2295('0x11c')](db[_0x2295('0x1a')],{'as':_0x2295('0x175'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x4b')][_0x2295('0x11c')](db[_0x2295('0x50')],{'as':'Messages'});db[_0x2295('0x4b')][_0x2295('0x126')](db[_0x2295('0x2b')],{'as':_0x2295('0x2b')});db['FaxAccount'][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db[_0x2295('0x4b')][_0x2295('0x126')](db[_0x2295('0x88')],{'as':_0x2295('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2295('0x4b')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':_0x2295('0x13f')});db[_0x2295('0x176')][_0x2295('0x126')](db[_0x2295('0x118')],{'onDelete':_0x2295('0x15e')});db[_0x2295('0x176')][_0x2295('0x126')](db[_0x2295('0x137')],{'onDelete':'restrict'});db[_0x2295('0x176')][_0x2295('0x126')](db[_0x2295('0x4b')],{'onDelete':'restrict'});db[_0x2295('0x176')][_0x2295('0x126')](db['Tag'],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x16f')});db['FaxInteraction'][_0x2295('0x11c')](db[_0x2295('0x50')],{'as':_0x2295('0x163'),'onDelete':'cascade','foreignKey':_0x2295('0x177')});db[_0x2295('0x4e')][_0x2295('0x126')](db[_0x2295('0x4b')],{'as':'Account','foreignKey':_0x2295('0x173')});db[_0x2295('0x4e')][_0x2295('0x126')](db[_0x2295('0x72')],{'as':'Contact','foreignKey':_0x2295('0x15c')});db[_0x2295('0x4e')]['belongsTo'](db[_0x2295('0x118')],{'as':_0x2295('0x178'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x4e')]['belongsToMany'](db['Tag'],{'through':_0x2295('0x179'),'as':_0x2295('0x17a')});db[_0x2295('0x4e')][_0x2295('0x128')](db[_0x2295('0x8e')],{'through':_0x2295('0x179'),'as':'ThroughTags'});db[_0x2295('0x4e')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x16b'),'through':'user_has_fax_interactions','foreignKey':_0x2295('0x177')});db[_0x2295('0x50')]['belongsTo'](db[_0x2295('0x118')],{'onDelete':'cascade','as':'User'});db[_0x2295('0x50')][_0x2295('0x126')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x2295('0x177')});db[_0x2295('0x50')][_0x2295('0x126')](db['CmContact'],{'onDelete':_0x2295('0x11a'),'as':_0x2295('0x15b')});db[_0x2295('0x50')]['belongsTo'](db[_0x2295('0x16c')],{'as':_0x2295('0x16c'),'foreignKey':_0x2295('0x17b')});db[_0x2295('0x50')]['belongsTo'](db[_0x2295('0x4b')],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x173')});db[_0x2295('0x137')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':_0x2295('0x34')});db['FaxQueue']['belongsToMany'](db[_0x2295('0xf0')],{'through':_0x2295('0x17c'),'as':_0x2295('0x17d')});db[_0x2295('0x17e')]['belongsTo'](db[_0x2295('0x4b')],{});db[_0x2295('0x17e')]['belongsTo'](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db[_0x2295('0x17e')][_0x2295('0x126')](db[_0x2295('0x72')],{'as':_0x2295('0x15b'),'foreignKey':_0x2295('0x15c')});db['FaxQueueReport'][_0x2295('0x126')](db[_0x2295('0x4e')],{});db['FaxQueueReport'][_0x2295('0x126')](db[_0x2295('0x50')],{});db[_0x2295('0x17e')]['belongsTo'](db['User'],{});db['FaxQueueReport'][_0x2295('0x126')](db[_0x2295('0x137')],{});db[_0x2295('0x53')]['hasMany'](db[_0x2295('0x84')],{'as':_0x2295('0x17f'),'foreignKey':_0x2295('0x180'),'onDelete':'cascade'});db[_0x2295('0x53')][_0x2295('0x11c')](db[_0x2295('0x82')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x2295('0x53')]['hasMany'](db[_0x2295('0x58')],{'as':_0x2295('0x163'),'foreignKey':_0x2295('0x180')});db[_0x2295('0x53')][_0x2295('0x11c')](db['SmsInteraction'],{'as':_0x2295('0x174')});db[_0x2295('0x53')][_0x2295('0x11c')](db['SmsApplication'],{'as':_0x2295('0x147'),'foreignKey':_0x2295('0x180'),'onDelete':_0x2295('0x11a')});db['SmsAccount']['belongsTo'](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db['SmsAccount']['belongsTo'](db[_0x2295('0x88')],{'as':_0x2295('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2295('0x53')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':'Agents','through':_0x2295('0x181')});db[_0x2295('0x55')][_0x2295('0x126')](db[_0x2295('0x118')],{'onDelete':'restrict'});db[_0x2295('0x55')][_0x2295('0x126')](db[_0x2295('0x138')],{'onDelete':_0x2295('0x15e')});db[_0x2295('0x55')][_0x2295('0x126')](db[_0x2295('0x53')],{'onDelete':_0x2295('0x15e')});db['SmsApplication']['belongsTo'](db[_0x2295('0x87')],{'onDelete':_0x2295('0x15e'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x2295('0x126')](db['Tag'],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x16f')});db['SmsInteraction'][_0x2295('0x11c')](db[_0x2295('0x58')],{'as':_0x2295('0x163'),'onDelete':_0x2295('0x11a'),'foreignKey':'SmsInteractionId'});db[_0x2295('0x56')]['belongsTo'](db[_0x2295('0x53')],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x180')});db[_0x2295('0x56')]['belongsTo'](db[_0x2295('0x72')],{'as':'Contact','foreignKey':_0x2295('0x15c')});db[_0x2295('0x56')][_0x2295('0x126')](db[_0x2295('0x118')],{'as':_0x2295('0x178'),'foreignKey':_0x2295('0x11b')});db[_0x2295('0x56')]['belongsToMany'](db[_0x2295('0x8e')],{'through':'sms_interaction_has_tags','as':_0x2295('0x17a')});db[_0x2295('0x56')][_0x2295('0x128')](db[_0x2295('0x8e')],{'through':_0x2295('0x182'),'as':_0x2295('0x16a')});db[_0x2295('0x56')][_0x2295('0x128')](db['User'],{'as':_0x2295('0x16b'),'through':_0x2295('0x12f'),'foreignKey':_0x2295('0x183')});db['SmsMessage']['belongsTo'](db[_0x2295('0x118')],{'as':'User'});db[_0x2295('0x58')][_0x2295('0x126')](db[_0x2295('0x72')],{'onDelete':_0x2295('0x11a'),'as':'Contact'});db[_0x2295('0x58')][_0x2295('0x126')](db['SmsInteraction'],{'onDelete':_0x2295('0x11a'),'as':_0x2295('0x16d'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x2295('0x126')](db['SmsAccount'],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x180')});db['SmsQueue'][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x2295('0x138')]['belongsToMany'](db[_0x2295('0xf0')],{'through':_0x2295('0x184'),'as':_0x2295('0x17d')});db['OpenchannelAccount'][_0x2295('0x11c')](db[_0x2295('0x84')],{'as':'Dispositions','foreignKey':_0x2295('0x185'),'onDelete':_0x2295('0x11a')});db['OpenchannelAccount'][_0x2295('0x11c')](db[_0x2295('0x82')],{'as':_0x2295('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x2295('0x141')][_0x2295('0x11c')](db[_0x2295('0x5c')],{'as':_0x2295('0x174'),'foreignKey':'OpenchannelAccountId'});db[_0x2295('0x141')][_0x2295('0x11c')](db['OpenchannelMessage'],{'as':_0x2295('0x163'),'foreignKey':_0x2295('0x185')});db[_0x2295('0x141')][_0x2295('0x11c')](db['OpenchannelApplication'],{'as':_0x2295('0x147'),'foreignKey':_0x2295('0x185'),'onDelete':'cascade'});db[_0x2295('0x141')][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db[_0x2295('0x141')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x2295('0x165')});db[_0x2295('0x141')]['belongsToMany'](db['User'],{'as':_0x2295('0x152'),'through':_0x2295('0x143')});db['OpenchannelApplication'][_0x2295('0x126')](db['User'],{'onDelete':'restrict'});db[_0x2295('0x186')][_0x2295('0x126')](db['OpenchannelQueue'],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x187')});db[_0x2295('0x186')][_0x2295('0x126')](db['OpenchannelAccount'],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x185')});db[_0x2295('0x186')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x2295('0x150')});db['OpenchannelApplication'][_0x2295('0x126')](db[_0x2295('0x8e')],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x16f')});db[_0x2295('0x5c')][_0x2295('0x11c')](db[_0x2295('0x5e')],{'as':'Messages','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x188')});db[_0x2295('0x5c')]['belongsTo'](db[_0x2295('0x141')],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x185')});db[_0x2295('0x5c')]['belongsTo'](db[_0x2295('0x72')],{'as':'Contact','foreignKey':_0x2295('0x15c')});db[_0x2295('0x5c')][_0x2295('0x126')](db['User'],{'as':_0x2295('0x178'),'foreignKey':_0x2295('0x11b')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0x2295('0x189'),'as':_0x2295('0x17a')});db[_0x2295('0x5c')][_0x2295('0x128')](db[_0x2295('0x8e')],{'through':_0x2295('0x189'),'as':_0x2295('0x16a')});db[_0x2295('0x5c')][_0x2295('0x128')](db['User'],{'as':_0x2295('0x16b'),'through':_0x2295('0x18a'),'foreignKey':'OpenchannelInteractionId'});db[_0x2295('0x5e')][_0x2295('0x126')](db[_0x2295('0x118')],{'onDelete':_0x2295('0x11a'),'as':_0x2295('0x118')});db[_0x2295('0x5e')][_0x2295('0x126')](db[_0x2295('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0x2295('0x5e')][_0x2295('0x126')](db[_0x2295('0x5c')],{'onDelete':'cascade','as':_0x2295('0x16d'),'foreignKey':_0x2295('0x188')});db['OpenchannelMessage']['belongsTo'](db[_0x2295('0x16c')],{'as':'Attachment','foreignKey':_0x2295('0x17b')});db[_0x2295('0x5e')][_0x2295('0x126')](db[_0x2295('0x141')],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x185')});db[_0x2295('0x13a')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':_0x2295('0x38'),'foreignKey':_0x2295('0x187')});db[_0x2295('0x13a')]['belongsToMany'](db[_0x2295('0xf0')],{'through':_0x2295('0x18b'),'as':_0x2295('0x17d')});db[_0x2295('0x13d')]['hasMany'](db[_0x2295('0x84')],{'as':_0x2295('0x17f'),'foreignKey':_0x2295('0x18c'),'onDelete':'cascade'});db[_0x2295('0x13d')]['hasMany'](db['CannedAnswer'],{'as':_0x2295('0x162'),'foreignKey':_0x2295('0x18c')});db[_0x2295('0x13d')][_0x2295('0x11c')](db[_0x2295('0x6e')],{'as':_0x2295('0x18d')});db['ChatWebsite'][_0x2295('0x11c')](db[_0x2295('0x64')],{'as':_0x2295('0x174')});db[_0x2295('0x13d')]['hasMany'](db[_0x2295('0x63')],{'as':_0x2295('0x147'),'foreignKey':_0x2295('0x18c'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x13d')][_0x2295('0x11c')](db[_0x2295('0x66')],{'as':_0x2295('0x163')});db[_0x2295('0x13d')][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db[_0x2295('0x13d')][_0x2295('0x126')](db['Interval'],{'as':_0x2295('0x87'),'foreignKey':_0x2295('0x150')});db[_0x2295('0x13d')][_0x2295('0x126')](db[_0x2295('0x3f')],{'as':_0x2295('0x3f'),'foreignKey':'MailAccountId'});db[_0x2295('0x13d')]['belongsTo'](db['Pause'],{'as':_0x2295('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2295('0x13d')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':'Agents','through':_0x2295('0x18e')});db[_0x2295('0x61')][_0x2295('0x126')](db[_0x2295('0x141')],{});db[_0x2295('0x61')]['belongsTo'](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':'ListId'});db[_0x2295('0x61')]['belongsTo'](db[_0x2295('0x72')],{'as':_0x2295('0x15b'),'foreignKey':_0x2295('0x15c')});db[_0x2295('0x61')][_0x2295('0x126')](db[_0x2295('0x5c')],{});db[_0x2295('0x61')][_0x2295('0x126')](db[_0x2295('0x5e')],{});db[_0x2295('0x61')][_0x2295('0x126')](db[_0x2295('0x118')],{});db[_0x2295('0x61')][_0x2295('0x126')](db[_0x2295('0x13a')],{});db[_0x2295('0x63')]['belongsTo'](db[_0x2295('0x118')],{'as':_0x2295('0x18f'),'foreignKey':_0x2295('0x11b'),'onDelete':_0x2295('0x15e')});db['ChatApplication'][_0x2295('0x126')](db[_0x2295('0x6a')],{'as':_0x2295('0x190'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x2295('0x63')][_0x2295('0x126')](db[_0x2295('0x13d')],{'as':_0x2295('0x191'),'foreignKey':_0x2295('0x18c'),'onDelete':_0x2295('0x15e')});db[_0x2295('0x63')][_0x2295('0x126')](db[_0x2295('0x8e')],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x16f')});db[_0x2295('0x64')]['hasMany'](db[_0x2295('0x66')],{'as':_0x2295('0x163'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x192')});db[_0x2295('0x64')][_0x2295('0x126')](db[_0x2295('0x13d')],{'as':_0x2295('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x2295('0x64')][_0x2295('0x126')](db[_0x2295('0x72')],{'as':_0x2295('0x15b'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x2295('0x126')](db[_0x2295('0x118')],{'as':_0x2295('0x178'),'foreignKey':_0x2295('0x11b')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x2295('0x17a')});db['ChatInteraction'][_0x2295('0x128')](db['Tag'],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db['ChatInteraction']['belongsToMany'](db[_0x2295('0x118')],{'as':_0x2295('0x16b'),'through':_0x2295('0x12d'),'foreignKey':_0x2295('0x192')});db['ChatMessage'][_0x2295('0x126')](db[_0x2295('0x118')],{'onDelete':'cascade','as':'User'});db[_0x2295('0x66')][_0x2295('0x126')](db[_0x2295('0x72')],{'onDelete':'cascade','as':_0x2295('0x15b'),'foreignKey':_0x2295('0x15c')});db[_0x2295('0x66')]['belongsTo'](db[_0x2295('0x64')],{'onDelete':_0x2295('0x11a'),'as':_0x2295('0x16d'),'foreignKey':_0x2295('0x192')});db[_0x2295('0x66')][_0x2295('0x126')](db[_0x2295('0x16c')],{'as':_0x2295('0x16c'),'foreignKey':_0x2295('0x17b')});db[_0x2295('0x66')][_0x2295('0x126')](db['ChatWebsite'],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x18c')});db['ChatOfflineMessage'][_0x2295('0x11c')](db['Attachment'],{'as':_0x2295('0x193'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x2295('0x11a'),'hooks':!![]});db[_0x2295('0x68')][_0x2295('0x126')](db[_0x2295('0x72')],{'onDelete':_0x2295('0x11a'),'as':_0x2295('0x15b'),'foreignKey':_0x2295('0x15c')});db['ChatOfflineMessage'][_0x2295('0x126')](db[_0x2295('0x13d')],{'as':'Account','foreignKey':_0x2295('0x18c')});db[_0x2295('0x6a')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':_0x2295('0x31'),'hooks':!![]});db[_0x2295('0x6a')][_0x2295('0x128')](db[_0x2295('0xf0')],{'through':_0x2295('0x194'),'as':_0x2295('0x17d')});db[_0x2295('0x6c')][_0x2295('0x11c')](db[_0x2295('0xdb')],{'as':_0x2295('0x163'),'foreignKey':_0x2295('0x195'),'onDelete':_0x2295('0x11a')});db['ChatGroup'][_0x2295('0x128')](db[_0x2295('0x118')],{'as':'Members','through':'chat_group_has_users'});db[_0x2295('0x6e')][_0x2295('0x126')](db[_0x2295('0x13d')],{'as':_0x2295('0x191'),'foreignKey':'ChatWebsiteId'});db[_0x2295('0x70')]['hasMany'](db['CmContact'],{'as':_0x2295('0x196'),'foreignKey':_0x2295('0x197')});db[_0x2295('0x72')][_0x2295('0x11c')](db['CmContactHasItem'],{'as':_0x2295('0x198'),'foreignKey':_0x2295('0x199')});db[_0x2295('0x72')][_0x2295('0x11c')](db['CmHopper'],{'as':_0x2295('0x14b'),'foreignKey':_0x2295('0x15c')});db[_0x2295('0x72')][_0x2295('0x11c')](db['CmHopperFinal'],{'as':_0x2295('0x11f'),'foreignKey':_0x2295('0x15c')});db['CmContact']['hasMany'](db[_0x2295('0x79')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x2295('0x72')][_0x2295('0x11c')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db['CmContact'][_0x2295('0x11c')](db[_0x2295('0xe0')],{'as':'JscriptySessions','foreignKey':_0x2295('0x15c')});db[_0x2295('0x72')]['hasMany'](db[_0x2295('0x5c')],{'as':_0x2295('0x130'),'foreignKey':'ContactId','onDelete':_0x2295('0x15e')});db[_0x2295('0x72')][_0x2295('0x11c')](db[_0x2295('0x64')],{'as':_0x2295('0x121'),'foreignKey':_0x2295('0x15c'),'onDelete':_0x2295('0x15e')});db[_0x2295('0x72')][_0x2295('0x11c')](db[_0x2295('0x56')],{'as':_0x2295('0x122'),'foreignKey':_0x2295('0x15c'),'onDelete':_0x2295('0x15e')});db[_0x2295('0x72')][_0x2295('0x11c')](db[_0x2295('0x4e')],{'as':_0x2295('0x123'),'foreignKey':_0x2295('0x15c'),'onDelete':'restrict'});db[_0x2295('0x72')][_0x2295('0x11c')](db[_0x2295('0x43')],{'as':_0x2295('0x12b'),'foreignKey':'ContactId','onDelete':_0x2295('0x15e')});db[_0x2295('0x72')][_0x2295('0x126')](db['CmCompany'],{'as':_0x2295('0x19a'),'foreignKey':_0x2295('0x197')});db['CmContact'][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x72')]['belongsToMany'](db['User'],{'as':_0x2295('0x16b'),'through':'cm_user_has_contacts'});db['CmContact'][_0x2295('0x128')](db[_0x2295('0x8e')],{'as':_0x2295('0x17a'),'through':_0x2295('0x19b')});db[_0x2295('0x72')][_0x2295('0x128')](db['Tag'],{'through':_0x2295('0x19b'),'as':_0x2295('0x16a')});db[_0x2295('0x74')][_0x2295('0x11c')](db[_0x2295('0x93')],{'as':_0x2295('0x19c'),'foreignKey':_0x2295('0x19d')});db['CmHopper']['belongsTo'](db['CmContact'],{'as':_0x2295('0x15b'),'foreignKey':'ContactId','onDelete':_0x2295('0x11a')});db[_0x2295('0x74')][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':'List','foreignKey':_0x2295('0x164'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x74')][_0x2295('0x126')](db['User'],{'as':_0x2295('0x18f'),'foreignKey':_0x2295('0x11b')});db['CmHopper']['belongsTo'](db[_0x2295('0x132')],{'as':_0x2295('0x190'),'foreignKey':_0x2295('0x14a'),'onDelete':'cascade'});db[_0x2295('0x74')][_0x2295('0x126')](db[_0x2295('0x19e')],{'as':_0x2295('0x19e'),'foreignKey':_0x2295('0x19f'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x2295('0x118')],{'as':_0x2295('0x178'),'foreignKey':_0x2295('0x1a0')});db[_0x2295('0x76')][_0x2295('0x126')](db[_0x2295('0x72')],{'as':_0x2295('0x15b'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x2295('0x76')]['belongsTo'](db['CmList'],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164'),'onDelete':_0x2295('0x11a')});db['CmHopperBlack']['belongsTo'](db[_0x2295('0x132')],{'as':_0x2295('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0x2295('0x11a')});db[_0x2295('0x76')][_0x2295('0x126')](db[_0x2295('0x19e')],{'as':_0x2295('0x19e'),'foreignKey':_0x2295('0x19f'),'onDelete':_0x2295('0x11a')});db['Automation'][_0x2295('0x11c')](db[_0x2295('0x85')],{'as':{'plural':_0x2295('0x1a1'),'singular':_0x2295('0x1a2')},'foreignKey':_0x2295('0x1a3'),'onDelete':_0x2295('0x11a'),'hooks':!![]});db[_0x2295('0x80')][_0x2295('0x11c')](db[_0x2295('0x85')],{'as':{'plural':'Any','singular':_0x2295('0x1a4')},'foreignKey':_0x2295('0x1a5'),'onDelete':_0x2295('0x11a'),'hooks':!![]});db[_0x2295('0x80')]['hasMany'](db['Action'],{'as':_0x2295('0x1a6'),'foreignKey':_0x2295('0x1a7'),'onDelete':_0x2295('0x11a'),'hooks':!![]});db[_0x2295('0x84')][_0x2295('0x11c')](db['Disposition'],{'as':_0x2295('0x17f'),'foreignKey':_0x2295('0x1a8'),'onDelete':'cascade'});db[_0x2295('0x87')][_0x2295('0x11c')](db[_0x2295('0x87')],{'as':_0x2295('0x1a9'),'foreignKey':_0x2295('0x150'),'onDelete':_0x2295('0x11a'),'hooks':!![],'required':![]});db['Interval'][_0x2295('0x11c')](db[_0x2295('0x1a')],{'as':_0x2295('0x11e'),'foreignKey':_0x2295('0x150'),'onDelete':_0x2295('0x15e')});db[_0x2295('0x87')][_0x2295('0x11c')](db[_0x2295('0x46')],{'as':'MailApplications','foreignKey':_0x2295('0x150')});db[_0x2295('0x87')][_0x2295('0x11c')](db[_0x2295('0x63')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x2295('0x87')][_0x2295('0x11c')](db[_0x2295('0x176')],{'as':'FaxApplications','foreignKey':_0x2295('0x150')});db[_0x2295('0x87')]['hasMany'](db['SmsApplication'],{'as':_0x2295('0x1aa'),'foreignKey':_0x2295('0x150')});db['Schedule'][_0x2295('0x126')](db[_0x2295('0x3f')],{});db[_0x2295('0x8b')][_0x2295('0x126')](db[_0x2295('0x1ab')],{'foreignKey':_0x2295('0x1ac')});db[_0x2295('0x8b')][_0x2295('0x126')](db[_0x2295('0x9c')],{'foreignKey':_0x2295('0x1ad')});db[_0x2295('0x8d')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x2295('0x1ae'),'through':'moh_has_sounds','onDelete':'restrict'});db['Tag'][_0x2295('0x128')](db[_0x2295('0x72')],{'through':_0x2295('0x19b')});db[_0x2295('0x8e')][_0x2295('0x128')](db[_0x2295('0x64')],{'through':'chat_interaction_has_tags'});db[_0x2295('0x8e')][_0x2295('0x128')](db[_0x2295('0x43')],{'through':_0x2295('0x169')});db[_0x2295('0x8e')][_0x2295('0x128')](db[_0x2295('0x56')],{'through':_0x2295('0x182')});db[_0x2295('0x8e')][_0x2295('0x128')](db['FaxInteraction'],{'through':_0x2295('0x179')});db['Tag']['belongsToMany'](db[_0x2295('0x5c')],{'through':_0x2295('0x189')});db['Tag']['belongsToMany'](db[_0x2295('0x109')],{'through':_0x2295('0x1af')});db[_0x2295('0x91')][_0x2295('0x126')](db[_0x2295('0x1b0')],{'as':'ItemType','foreignKey':_0x2295('0x1b1')});db[_0x2295('0x93')]['belongsTo'](db[_0x2295('0x74')],{'as':'Hopper','foreignKey':_0x2295('0x19d')});db['CmContactHasItem'][_0x2295('0x126')](db['CmContact'],{'as':_0x2295('0x15b'),'foreignKey':_0x2295('0x199')});db[_0x2295('0x96')][_0x2295('0x11c')](db[_0x2295('0x85')],{'as':{'plural':_0x2295('0x1b2'),'singular':_0x2295('0x1b3')},'foreignKey':'TriggerAllId','onDelete':_0x2295('0x11a'),'hooks':!![]});db['Trigger'][_0x2295('0x11c')](db[_0x2295('0x85')],{'as':{'plural':_0x2295('0x1b4'),'singular':'AnyCondition'},'foreignKey':_0x2295('0x1b5'),'onDelete':_0x2295('0x11a'),'hooks':!![]});db[_0x2295('0x96')][_0x2295('0x11c')](db['Action'],{'as':_0x2295('0x1a6'),'foreignKey':'TriggerId','onDelete':_0x2295('0x11a'),'hooks':!![]});db['AnalyticCustomReport'][_0x2295('0x11c')](db[_0x2295('0xa2')],{'as':_0x2295('0x1b6'),'onDelete':_0x2295('0x11a'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db['AnalyticFieldReport'],{'as':_0x2295('0x1b6'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1ac')});db['AnalyticMetric'][_0x2295('0x11c')](db[_0x2295('0xa2')],{'as':_0x2295('0x1b6'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1b7')});db[_0x2295('0xa2')][_0x2295('0x126')](db[_0x2295('0xa0')],{'foreignKey':'MetricId'});db[_0x2295('0xa6')]['hasMany'](db[_0x2295('0x1b8')],{'as':_0x2295('0x1b9'),'onDelete':'cascade','foreignKey':'AccountId'});db['SalesforceConfiguration']['hasMany'](db[_0x2295('0xa9')],{'as':'Subjects','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0x1b8')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bb')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x2295('0x1b6'),'onDelete':'cascade','foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db[_0x2295('0xa6')],{'as':'Account','foreignKey':_0x2295('0x1bc')});db['SalesforceField'][_0x2295('0x11c')](db['SalesforceField'],{'as':_0x2295('0x1bd'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xa9')]['hasMany'](db[_0x2295('0xa9')],{'as':_0x2295('0x1be'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0xa9')]['hasMany'](db[_0x2295('0xa9')],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xa9')][_0x2295('0x126')](db[_0x2295('0x1c1')],{'as':'Variable','foreignKey':_0x2295('0x1c2')});db[_0x2295('0x1c3')]['hasMany'](db[_0x2295('0xac')],{'as':'Configurations','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bc')});db['SugarcrmConfiguration'][_0x2295('0x11c')](db[_0x2295('0xae')],{'as':_0x2295('0x1c4'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xac')]['hasMany'](db[_0x2295('0xae')],{'as':_0x2295('0x1c5'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bb')});db['SugarcrmConfiguration'][_0x2295('0x11c')](db['SugarcrmField'],{'as':_0x2295('0x1b6'),'onDelete':'cascade','foreignKey':_0x2295('0x1c0')});db[_0x2295('0xac')][_0x2295('0x126')](db[_0x2295('0x1c3')],{'as':'Account','foreignKey':_0x2295('0x1bc')});db[_0x2295('0xae')]['hasMany'](db[_0x2295('0xae')],{'as':_0x2295('0x1bd'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xae')][_0x2295('0x11c')](db[_0x2295('0xae')],{'as':_0x2295('0x1be'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0xae')][_0x2295('0x11c')](db[_0x2295('0xae')],{'as':'Field','foreignKey':'FieldId'});db['SugarcrmField'][_0x2295('0x126')](db[_0x2295('0x1c1')],{'as':_0x2295('0x1c1'),'foreignKey':_0x2295('0x1c2')});db[_0x2295('0x1c6')][_0x2295('0x11c')](db[_0x2295('0xb1')],{'as':'Configurations','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bc')});db[_0x2295('0xb1')]['hasMany'](db['DeskField'],{'as':'Subjects','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xb1')]['hasMany'](db['DeskField'],{'as':_0x2295('0x1c5'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0xb1')][_0x2295('0x11c')](db['DeskField'],{'as':_0x2295('0x1b6'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xb1')][_0x2295('0x126')](db[_0x2295('0x1c6')],{'as':_0x2295('0x168'),'foreignKey':'AccountId'});db['DeskConfiguration']['belongsToMany'](db[_0x2295('0x8e')],{'through':_0x2295('0x1c7')});db[_0x2295('0xb3')]['hasMany'](db[_0x2295('0xb3')],{'as':'Subject','foreignKey':_0x2295('0x1ba')});db[_0x2295('0xb3')][_0x2295('0x11c')](db[_0x2295('0xb3')],{'as':'Description','foreignKey':_0x2295('0x1bb')});db[_0x2295('0xb3')][_0x2295('0x11c')](db['DeskField'],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xb3')][_0x2295('0x126')](db[_0x2295('0x1c1')],{'as':'Variable','foreignKey':_0x2295('0x1c2')});db[_0x2295('0xb5')][_0x2295('0x11c')](db[_0x2295('0xb6')],{'as':_0x2295('0x1b9'),'onDelete':'cascade','foreignKey':_0x2295('0x1bc')});db[_0x2295('0xb6')][_0x2295('0x11c')](db['ZohoField'],{'as':_0x2295('0x1c4'),'onDelete':'cascade','foreignKey':_0x2295('0x1ba')});db[_0x2295('0xb6')][_0x2295('0x11c')](db[_0x2295('0xb8')],{'as':_0x2295('0x1c5'),'onDelete':'cascade','foreignKey':_0x2295('0x1bb')});db[_0x2295('0xb6')][_0x2295('0x11c')](db[_0x2295('0xb8')],{'as':_0x2295('0x1b6'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xb6')][_0x2295('0x126')](db[_0x2295('0xb5')],{'as':'Account','foreignKey':'AccountId'});db[_0x2295('0xb8')][_0x2295('0x11c')](db['ZohoField'],{'as':'Subject','foreignKey':_0x2295('0x1ba')});db[_0x2295('0xb8')][_0x2295('0x11c')](db['ZohoField'],{'as':_0x2295('0x1be'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0xb8')][_0x2295('0x11c')](db[_0x2295('0xb8')],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xb8')][_0x2295('0x126')](db['Variable'],{'as':_0x2295('0x1c1'),'foreignKey':_0x2295('0x1c2')});db[_0x2295('0xba')]['hasMany'](db[_0x2295('0xbc')],{'as':_0x2295('0x1b9'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bc')});db['ZendeskConfiguration'][_0x2295('0x11c')](db[_0x2295('0x1c8')],{'as':_0x2295('0x1c4'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xbc')]['hasMany'](db[_0x2295('0x1c8')],{'as':'Descriptions','foreignKey':_0x2295('0x1bb')});db[_0x2295('0xbc')][_0x2295('0x11c')](db[_0x2295('0x1c8')],{'as':_0x2295('0x1b6'),'foreignKey':_0x2295('0x1c0')});db['ZendeskConfiguration'][_0x2295('0x126')](db['ZendeskAccount'],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x1bc')});db[_0x2295('0xbc')][_0x2295('0x128')](db[_0x2295('0x8e')],{'through':'int_zendesk_configuration_has_tags'});db[_0x2295('0x1c8')][_0x2295('0x11c')](db[_0x2295('0x1c8')],{'as':_0x2295('0x1bd'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0x1c8')][_0x2295('0x11c')](db['ZendeskField'],{'as':_0x2295('0x1be'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0x1c8')]['hasMany'](db[_0x2295('0x1c8')],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0x1c8')]['belongsTo'](db[_0x2295('0x1c1')],{'as':'Variable','foreignKey':'VariableId'});db[_0x2295('0xbf')][_0x2295('0x11c')](db[_0x2295('0xc1')],{'as':_0x2295('0x1b9'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bc')});db['FreshdeskConfiguration']['hasMany'](db[_0x2295('0xc3')],{'as':_0x2295('0x1c4'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1ba')});db['FreshdeskConfiguration'][_0x2295('0x11c')](db[_0x2295('0xc3')],{'as':'Descriptions','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0xc1')][_0x2295('0x11c')](db[_0x2295('0xc3')],{'as':'Fields','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xc1')][_0x2295('0x126')](db['FreshdeskAccount'],{'as':'Account','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x2295('0x128')](db[_0x2295('0x8e')],{'through':_0x2295('0x1c9')});db[_0x2295('0xc3')][_0x2295('0x11c')](db[_0x2295('0xc3')],{'as':_0x2295('0x1bd'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xc3')][_0x2295('0x11c')](db[_0x2295('0xc3')],{'as':_0x2295('0x1be'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0xc3')][_0x2295('0x11c')](db[_0x2295('0xc3')],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xc3')][_0x2295('0x126')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['VtigerAccount']['hasMany'](db[_0x2295('0xc7')],{'as':'Configurations','onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bc')});db[_0x2295('0xc7')][_0x2295('0x11c')](db['VtigerField'],{'as':_0x2295('0x1c4'),'foreignKey':'SubjectId'});db[_0x2295('0xc7')][_0x2295('0x11c')](db[_0x2295('0xc9')],{'as':_0x2295('0x1c5'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0xc7')][_0x2295('0x11c')](db[_0x2295('0xc9')],{'as':'Fields','foreignKey':_0x2295('0x1c0')});db['VtigerConfiguration'][_0x2295('0x126')](db[_0x2295('0xc5')],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x1bc')});db[_0x2295('0xc9')]['hasMany'](db[_0x2295('0xc9')],{'as':_0x2295('0x1bd'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xc9')][_0x2295('0x11c')](db[_0x2295('0xc9')],{'as':_0x2295('0x1be'),'foreignKey':'DescriptionId'});db[_0x2295('0xc9')][_0x2295('0x11c')](db[_0x2295('0xc9')],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xc9')]['belongsTo'](db[_0x2295('0x1c1')],{'as':_0x2295('0x1c1'),'foreignKey':_0x2295('0x1c2')});db[_0x2295('0xcb')][_0x2295('0x11c')](db[_0x2295('0x1ca')],{'as':_0x2295('0x1b9'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bc')});db['ServicenowConfiguration']['hasMany'](db[_0x2295('0xce')],{'as':_0x2295('0x1c4'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0x1ca')][_0x2295('0x11c')](db[_0x2295('0xce')],{'as':_0x2295('0x1c5'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0x1ca')]['hasMany'](db[_0x2295('0xce')],{'as':_0x2295('0x1b6'),'foreignKey':'FieldId'});db[_0x2295('0x1ca')][_0x2295('0x126')](db[_0x2295('0xcb')],{'as':'Account','foreignKey':_0x2295('0x1bc')});db[_0x2295('0xce')][_0x2295('0x11c')](db[_0x2295('0xce')],{'as':_0x2295('0x1bd'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xce')]['hasMany'](db[_0x2295('0xce')],{'as':'Description','foreignKey':_0x2295('0x1bb')});db[_0x2295('0xce')][_0x2295('0x11c')](db[_0x2295('0xce')],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db['ServicenowField'][_0x2295('0x126')](db[_0x2295('0x1c1')],{'as':_0x2295('0x1c1'),'foreignKey':_0x2295('0x1c2')});db[_0x2295('0xcf')][_0x2295('0x11c')](db['Dynamics365Configuration'],{'as':_0x2295('0x1b9'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bc')});db['Dynamics365Account'][_0x2295('0x126')](db[_0x2295('0x111')],{'as':_0x2295('0x111'),'foreignKey':_0x2295('0x15f')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x2295('0x11a'),'foreignKey':'SubjectId'});db[_0x2295('0xd0')][_0x2295('0x11c')](db[_0x2295('0xd2')],{'as':_0x2295('0x1c5'),'onDelete':'cascade','foreignKey':_0x2295('0x1bb')});db['Dynamics365Configuration'][_0x2295('0x11c')](db[_0x2295('0xd2')],{'as':'Fields','onDelete':_0x2295('0x11a'),'foreignKey':'FieldId'});db[_0x2295('0xd0')][_0x2295('0x126')](db['Dynamics365Account'],{'as':_0x2295('0x168'),'foreignKey':'AccountId'});db[_0x2295('0xd2')][_0x2295('0x11c')](db[_0x2295('0xd2')],{'as':_0x2295('0x1bd'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xd2')][_0x2295('0x11c')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0x2295('0x1bb')});db['Dynamics365Field'][_0x2295('0x11c')](db[_0x2295('0xd2')],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xd2')][_0x2295('0x126')](db[_0x2295('0x1c1')],{'as':_0x2295('0x1c1'),'foreignKey':'VariableId'});db[_0x2295('0xd4')][_0x2295('0x11c')](db[_0x2295('0x1cb')],{'as':_0x2295('0x1b9'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1bc')});db[_0x2295('0x1cb')][_0x2295('0x11c')](db[_0x2295('0xd6')],{'as':_0x2295('0x1c4'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0x1cb')][_0x2295('0x11c')](db[_0x2295('0xd6')],{'as':_0x2295('0x1c5'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0x1cb')]['hasMany'](db['FreshsalesField'],{'as':_0x2295('0x1b6'),'foreignKey':'FieldId'});db[_0x2295('0x1cb')][_0x2295('0x126')](db[_0x2295('0xd4')],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x1bc')});db[_0x2295('0xd6')][_0x2295('0x11c')](db[_0x2295('0xd6')],{'as':_0x2295('0x1bd'),'foreignKey':_0x2295('0x1ba')});db[_0x2295('0xd6')][_0x2295('0x11c')](db[_0x2295('0xd6')],{'as':_0x2295('0x1be'),'foreignKey':_0x2295('0x1bb')});db[_0x2295('0xd6')][_0x2295('0x11c')](db[_0x2295('0xd6')],{'as':_0x2295('0x1bf'),'foreignKey':_0x2295('0x1c0')});db[_0x2295('0xd6')][_0x2295('0x126')](db[_0x2295('0x1c1')],{'as':'Variable','foreignKey':'VariableId'});db[_0x2295('0xd9')][_0x2295('0x126')](db[_0x2295('0x13d')],{});db[_0x2295('0xd9')][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db[_0x2295('0xd9')][_0x2295('0x126')](db[_0x2295('0x72')],{'as':_0x2295('0x15b'),'foreignKey':_0x2295('0x15c')});db[_0x2295('0xd9')][_0x2295('0x126')](db['ChatInteraction'],{});db[_0x2295('0xd9')][_0x2295('0x126')](db[_0x2295('0x66')],{});db[_0x2295('0xd9')]['belongsTo'](db['User'],{});db['ChatQueueReport'][_0x2295('0x126')](db[_0x2295('0x6a')],{});db[_0x2295('0xdb')][_0x2295('0x126')](db['User'],{'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1cc')});db[_0x2295('0xdb')][_0x2295('0x126')](db[_0x2295('0x118')],{'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x1cd')});db[_0x2295('0xe0')][_0x2295('0x11c')](db[_0x2295('0xde')],{'foreignKey':_0x2295('0x1ce'),'onDelete':_0x2295('0x11a')});db[_0x2295('0xe0')][_0x2295('0x11c')](db[_0x2295('0xdc')],{'foreignKey':_0x2295('0x1ce'),'onDelete':'cascade'});db[_0x2295('0x1cf')][_0x2295('0x126')](db[_0x2295('0x53')],{});db[_0x2295('0x1cf')][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db[_0x2295('0x1cf')][_0x2295('0x126')](db[_0x2295('0x72')],{'as':'Contact','foreignKey':_0x2295('0x15c')});db[_0x2295('0x1cf')][_0x2295('0x126')](db[_0x2295('0x56')],{});db['SmsQueueReport'][_0x2295('0x126')](db['SmsMessage'],{});db[_0x2295('0x1cf')][_0x2295('0x126')](db['User'],{});db[_0x2295('0x1cf')][_0x2295('0x126')](db[_0x2295('0x138')],{});db[_0x2295('0xe6')][_0x2295('0x11c')](db[_0x2295('0xe0')],{'foreignKey':_0x2295('0x1d0')});db[_0x2295('0xe6')]['hasMany'](db[_0x2295('0xde')],{'foreignKey':_0x2295('0x1d0')});db[_0x2295('0xe6')][_0x2295('0x11c')](db[_0x2295('0xdc')],{'foreignKey':_0x2295('0x1d0')});db['Team'][_0x2295('0x128')](db['User'],{'as':_0x2295('0x152'),'through':_0x2295('0x12a')});db[_0x2295('0xf0')][_0x2295('0x128')](db[_0x2295('0x132')],{'through':_0x2295('0x153'),'as':_0x2295('0x133')});db['Team'][_0x2295('0x128')](db[_0x2295('0x41')],{'through':_0x2295('0x166'),'as':_0x2295('0x135')});db['Team'][_0x2295('0x128')](db[_0x2295('0x6a')],{'through':_0x2295('0x194'),'as':'ChatQueues'});db[_0x2295('0xf0')][_0x2295('0x128')](db[_0x2295('0x137')],{'through':'team_has_fax_queues','as':_0x2295('0x1d1')});db[_0x2295('0xf0')][_0x2295('0x128')](db[_0x2295('0x138')],{'through':_0x2295('0x184'),'as':_0x2295('0x139')});db[_0x2295('0xf0')][_0x2295('0x128')](db[_0x2295('0x13a')],{'through':_0x2295('0x18b'),'as':'OpenchannelQueues'});db['Team'][_0x2295('0x128')](db[_0x2295('0x1d2')],{'through':_0x2295('0x1d3'),'as':_0x2295('0x13b')});db[_0x2295('0xf0')][_0x2295('0x128')](db[_0x2295('0xfd')],{'through':_0x2295('0x1d4'),'as':_0x2295('0x134')});db['Campaign'][_0x2295('0x11c')](db[_0x2295('0x74')],{'as':_0x2295('0x14b'),'foreignKey':_0x2295('0x19f')});db[_0x2295('0x19e')][_0x2295('0x11c')](db[_0x2295('0x78')],{'as':_0x2295('0x11f'),'foreignKey':_0x2295('0x19f')});db[_0x2295('0x19e')][_0x2295('0x11c')](db['CmHopperHistory'],{'as':_0x2295('0x14c'),'foreignKey':'CampaignId'});db[_0x2295('0x19e')][_0x2295('0x11c')](db['CmHopperBlack'],{'as':_0x2295('0x1d5'),'foreignKey':_0x2295('0x19f')});db[_0x2295('0x19e')][_0x2295('0x126')](db[_0x2295('0x2b')],{'as':'Trunk','foreignKey':_0x2295('0x14e')});db[_0x2295('0x19e')]['belongsTo'](db[_0x2295('0x2b')],{'as':_0x2295('0x14f'),'foreignKey':'TrunkBackupId'});db[_0x2295('0x19e')][_0x2295('0x126')](db[_0x2295('0x87')],{'as':_0x2295('0x87'),'foreignKey':'IntervalId'});db[_0x2295('0x19e')][_0x2295('0x126')](db[_0x2295('0xeb')],{'as':_0x2295('0xeb'),'foreignKey':_0x2295('0x1d6')});db[_0x2295('0x19e')][_0x2295('0x128')](db[_0x2295('0xfc')],{'as':'Lists','through':_0x2295('0x1d7')});db['Campaign'][_0x2295('0x128')](db[_0x2295('0xfc')],{'as':_0x2295('0x154'),'through':'campaigns_has_cm_blacklists'});db[_0x2295('0x16c')][_0x2295('0x126')](db[_0x2295('0x68')],{'as':_0x2295('0x68'),'foreignKey':_0x2295('0x16e')});db[_0x2295('0x1d8')]['belongsTo'](db['MailMessage'],{});db[_0x2295('0x1d8')][_0x2295('0x126')](db[_0x2295('0x43')],{});db[_0x2295('0x1d8')][_0x2295('0x126')](db[_0x2295('0x3f')],{'foreignKey':_0x2295('0x1d9'),'as':_0x2295('0x1da')});db['MailTransferReport'][_0x2295('0x126')](db[_0x2295('0x118')],{'foreignKey':_0x2295('0x1db'),'as':'FromAgent'});db[_0x2295('0x1d8')][_0x2295('0x126')](db['User'],{'foreignKey':_0x2295('0x1dc'),'as':_0x2295('0x1dd')});db[_0x2295('0x1d8')][_0x2295('0x126')](db[_0x2295('0x41')],{'foreignKey':_0x2295('0x1de'),'as':_0x2295('0x1df')});db['MailTransferReport'][_0x2295('0x126')](db['MailAccount'],{'foreignKey':_0x2295('0x1e0'),'as':_0x2295('0x1e1')});db[_0x2295('0xf7')][_0x2295('0x126')](db['ChatMessage'],{});db[_0x2295('0xf7')][_0x2295('0x126')](db[_0x2295('0x64')],{});db['ChatTransferReport']['belongsTo'](db[_0x2295('0x13d')],{'foreignKey':'FromChatWebsiteId','as':_0x2295('0x1da')});db[_0x2295('0xf7')][_0x2295('0x126')](db['User'],{'foreignKey':_0x2295('0x1db'),'as':'FromAgent'});db[_0x2295('0xf7')][_0x2295('0x126')](db[_0x2295('0x118')],{'foreignKey':_0x2295('0x1dc'),'as':_0x2295('0x1dd')});db[_0x2295('0xf7')][_0x2295('0x126')](db[_0x2295('0x6a')],{'foreignKey':_0x2295('0x1e2'),'as':_0x2295('0x1df')});db[_0x2295('0xf7')][_0x2295('0x126')](db[_0x2295('0x13d')],{'foreignKey':_0x2295('0x1e3'),'as':'ToAccount'});db[_0x2295('0xf8')]['belongsTo'](db[_0x2295('0x50')],{});db[_0x2295('0xf8')]['belongsTo'](db[_0x2295('0x4e')],{});db[_0x2295('0xf8')][_0x2295('0x126')](db[_0x2295('0x4b')],{'foreignKey':_0x2295('0x1e4'),'as':_0x2295('0x1da')});db[_0x2295('0xf8')][_0x2295('0x126')](db[_0x2295('0x118')],{'foreignKey':_0x2295('0x1db'),'as':_0x2295('0x1e5')});db['FaxTransferReport'][_0x2295('0x126')](db['User'],{'foreignKey':_0x2295('0x1dc'),'as':_0x2295('0x1dd')});db[_0x2295('0xf8')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x2295('0x1e6'),'as':_0x2295('0x1df')});db[_0x2295('0xf8')]['belongsTo'](db[_0x2295('0x4b')],{'foreignKey':_0x2295('0x1e7'),'as':'ToAccount'});db[_0x2295('0xfa')][_0x2295('0x126')](db['OpenchannelMessage'],{});db[_0x2295('0xfa')]['belongsTo'](db[_0x2295('0x5c')],{});db[_0x2295('0xfa')][_0x2295('0x126')](db[_0x2295('0x141')],{'foreignKey':_0x2295('0x1e8'),'as':_0x2295('0x1da')});db[_0x2295('0xfa')][_0x2295('0x126')](db['User'],{'foreignKey':_0x2295('0x1db'),'as':_0x2295('0x1e5')});db[_0x2295('0xfa')][_0x2295('0x126')](db[_0x2295('0x118')],{'foreignKey':_0x2295('0x1dc'),'as':_0x2295('0x1dd')});db['OpenchannelTransferReport'][_0x2295('0x126')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x2295('0xfa')][_0x2295('0x126')](db[_0x2295('0x141')],{'foreignKey':_0x2295('0x1e9'),'as':_0x2295('0x1e1')});db['SmsTransferReport'][_0x2295('0x126')](db[_0x2295('0x58')],{});db[_0x2295('0x1ea')]['belongsTo'](db['SmsInteraction'],{});db[_0x2295('0x1ea')][_0x2295('0x126')](db[_0x2295('0x53')],{'foreignKey':_0x2295('0x1eb'),'as':_0x2295('0x1da')});db[_0x2295('0x1ea')][_0x2295('0x126')](db['User'],{'foreignKey':'FromUserId','as':_0x2295('0x1e5')});db[_0x2295('0x1ea')]['belongsTo'](db['User'],{'foreignKey':_0x2295('0x1dc'),'as':_0x2295('0x1dd')});db[_0x2295('0x1ea')][_0x2295('0x126')](db[_0x2295('0x138')],{'foreignKey':_0x2295('0x1ec'),'as':_0x2295('0x1df')});db[_0x2295('0x1ea')][_0x2295('0x126')](db[_0x2295('0x53')],{'foreignKey':'ToSmsAccountId','as':_0x2295('0x1e1')});db[_0x2295('0xfc')][_0x2295('0x11c')](db['Disposition'],{'as':_0x2295('0x17f'),'foreignKey':_0x2295('0x164'),'onDelete':_0x2295('0x11a')});db['CmList'][_0x2295('0x11c')](db[_0x2295('0x7d')],{'as':_0x2295('0x1ed'),'foreignKey':_0x2295('0x164')});db[_0x2295('0xfc')][_0x2295('0x11c')](db['CmContact'],{'as':_0x2295('0x196'),'onDelete':_0x2295('0x11a'),'foreignKey':_0x2295('0x164')});db[_0x2295('0xfc')]['hasMany'](db[_0x2295('0x78')],{'as':_0x2295('0x11f'),'foreignKey':_0x2295('0x164')});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':_0x2295('0x120'),'foreignKey':_0x2295('0x164')});db[_0x2295('0xfc')]['hasMany'](db[_0x2295('0x7b')],{'as':_0x2295('0x7b'),'foreignKey':_0x2295('0x164')});db[_0x2295('0xfc')][_0x2295('0x128')](db[_0x2295('0x132')],{'as':_0x2295('0x1ee'),'through':_0x2295('0x1ef')});db[_0x2295('0xfc')]['belongsToMany'](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':'cm_user_has_lists'});db[_0x2295('0xfd')][_0x2295('0x11c')](db[_0x2295('0x1a')],{'as':'Extensions','onDelete':_0x2295('0x11a')});db[_0x2295('0xfd')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':'Agents','through':_0x2295('0x114')});db[_0x2295('0xfd')][_0x2295('0x128')](db['Team'],{'through':'TeamVoicePrefix','as':_0x2295('0x17d')});db[_0x2295('0xff')]['hasMany'](db[_0x2295('0x118')],{'as':_0x2295('0x16b'),'foreignKey':_0x2295('0x127')});db[_0x2295('0xff')][_0x2295('0x11c')](db[_0x2295('0x1f0')],{'as':_0x2295('0x1f1'),'foreignKey':_0x2295('0x127'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x1f0')][_0x2295('0x11c')](db['UserProfileResource'],{'as':_0x2295('0x1f2'),'foreignKey':_0x2295('0x1f3'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x105')][_0x2295('0x11c')](db['Disposition'],{'as':_0x2295('0x17f'),'foreignKey':_0x2295('0x1f4'),'onDelete':_0x2295('0x11a')});db['WhatsappAccount'][_0x2295('0x11c')](db[_0x2295('0x82')],{'as':_0x2295('0x162'),'foreignKey':_0x2295('0x1f4')});db['WhatsappAccount']['hasMany'](db['WhatsappMessage'],{'as':_0x2295('0x163'),'foreignKey':_0x2295('0x1f4')});db[_0x2295('0x105')][_0x2295('0x11c')](db[_0x2295('0x109')],{'as':_0x2295('0x174')});db[_0x2295('0x105')][_0x2295('0x11c')](db[_0x2295('0x107')],{'as':'Applications','foreignKey':_0x2295('0x1f4'),'onDelete':_0x2295('0x11a')});db[_0x2295('0x105')][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':'ListId'});db[_0x2295('0x105')][_0x2295('0x126')](db['Pause'],{'as':_0x2295('0x151'),'foreignKey':_0x2295('0x165')});db[_0x2295('0x105')][_0x2295('0x128')](db['User'],{'as':_0x2295('0x152'),'through':_0x2295('0x1f5')});db[_0x2295('0x107')][_0x2295('0x126')](db['User'],{'onDelete':_0x2295('0x15e')});db['WhatsappApplication']['belongsTo'](db[_0x2295('0x1d2')],{'onDelete':'restrict'});db[_0x2295('0x107')][_0x2295('0x126')](db[_0x2295('0x105')],{'onDelete':_0x2295('0x15e')});db[_0x2295('0x107')][_0x2295('0x126')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x2295('0x150')});db[_0x2295('0x107')]['belongsTo'](db[_0x2295('0x8e')],{'onDelete':_0x2295('0x15e'),'foreignKey':_0x2295('0x16f')});db['WhatsappInteraction'][_0x2295('0x11c')](db[_0x2295('0x10b')],{'as':_0x2295('0x163'),'onDelete':_0x2295('0x11a'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x2295('0x126')](db['WhatsappAccount'],{'as':_0x2295('0x168'),'foreignKey':'WhatsappAccountId'});db[_0x2295('0x109')][_0x2295('0x126')](db['CmContact'],{'as':_0x2295('0x15b'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x2295('0x126')](db[_0x2295('0x118')],{'as':'Owner','foreignKey':_0x2295('0x11b')});db[_0x2295('0x109')][_0x2295('0x128')](db[_0x2295('0x8e')],{'through':_0x2295('0x1af'),'as':_0x2295('0x17a')});db[_0x2295('0x109')][_0x2295('0x128')](db['Tag'],{'through':_0x2295('0x1af'),'as':_0x2295('0x16a')});db[_0x2295('0x109')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x16b'),'through':_0x2295('0x131'),'foreignKey':_0x2295('0x1f6')});db[_0x2295('0x10b')][_0x2295('0x126')](db[_0x2295('0x118')],{'as':_0x2295('0x118')});db[_0x2295('0x10b')][_0x2295('0x126')](db[_0x2295('0x72')],{'onDelete':'cascade','as':_0x2295('0x15b')});db[_0x2295('0x10b')][_0x2295('0x126')](db[_0x2295('0x109')],{'onDelete':'cascade','as':_0x2295('0x16d'),'foreignKey':_0x2295('0x1f6')});db[_0x2295('0x10b')]['belongsTo'](db[_0x2295('0x105')],{'as':_0x2295('0x168'),'foreignKey':_0x2295('0x1f4')});db[_0x2295('0x10c')][_0x2295('0x126')](db[_0x2295('0x105')],{});db['WhatsappQueueReport'][_0x2295('0x126')](db[_0x2295('0xfc')],{'as':_0x2295('0x170'),'foreignKey':_0x2295('0x164')});db[_0x2295('0x10c')]['belongsTo'](db[_0x2295('0x72')],{'as':_0x2295('0x15b'),'foreignKey':_0x2295('0x15c')});db[_0x2295('0x10c')][_0x2295('0x126')](db[_0x2295('0x109')],{});db[_0x2295('0x10c')][_0x2295('0x126')](db[_0x2295('0x1d2')],{});db[_0x2295('0x10c')][_0x2295('0x126')](db[_0x2295('0x10b')],{});db[_0x2295('0x10c')]['belongsTo'](db[_0x2295('0x118')],{});db[_0x2295('0x10e')][_0x2295('0x126')](db[_0x2295('0x10b')],{});db[_0x2295('0x10e')][_0x2295('0x126')](db['WhatsappInteraction'],{});db[_0x2295('0x10e')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x2295('0x1f7'),'as':_0x2295('0x1da')});db['WhatsappTransferReport'][_0x2295('0x126')](db['WhatsappAccount'],{'foreignKey':_0x2295('0x1f8'),'as':_0x2295('0x1e1')});db[_0x2295('0x10e')][_0x2295('0x126')](db[_0x2295('0x1d2')],{'foreignKey':_0x2295('0x1f9'),'as':'ToQueue'});db[_0x2295('0x10e')][_0x2295('0x126')](db[_0x2295('0x118')],{'foreignKey':_0x2295('0x1db'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x2295('0x126')](db[_0x2295('0x118')],{'foreignKey':_0x2295('0x1dc'),'as':_0x2295('0x1dd')});db[_0x2295('0x1d2')][_0x2295('0x128')](db[_0x2295('0x118')],{'as':_0x2295('0x152'),'through':_0x2295('0x3a'),'foreignKey':_0x2295('0x1fa')});db[_0x2295('0x1d2')][_0x2295('0x128')](db[_0x2295('0xf0')],{'through':_0x2295('0x1d3'),'as':_0x2295('0x17d')});db['UserSetting'][_0x2295('0x126')](db['User'],{'as':_0x2295('0x1fb'),'foreignKey':_0x2295('0x11b'),'onDelete':_0x2295('0x11a'),'hooks':!![]});db[_0x2295('0x111')][_0x2295('0x119')](db['Dynamics365Account'],{'as':_0x2295('0xcf'),'onDelete':_0x2295('0x15e')});db['CloudProvider'][_0x2295('0x119')](db[_0x2295('0x3b')],{'as':_0x2295('0x160'),'onDelete':'restrict'});db[_0x2295('0x111')][_0x2295('0x119')](db[_0x2295('0x3d')],{'as':'Smtp','onDelete':_0x2295('0x15e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c772214..50a3616 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55cf=['/api/integrations/servicenow/accounts','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','/api/fax/reports/transfer','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','route','get','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField'];(function(_0x2f48d5,_0x1042eb){var _0x2573f0=function(_0x302dd3){while(--_0x302dd3){_0x2f48d5['push'](_0x2f48d5['shift']());}};_0x2573f0(++_0x1042eb);}(_0x55cf,0x170));var _0xf55c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x55cf[_0xbca1b1];return _0x4e1686;};'use strict';var path=require(_0xf55c('0x0'));var express=require(_0xf55c('0x1'));var errors=require(_0xf55c('0x2'));var config=require(_0xf55c('0x3'));var setupLoggers=require(_0xf55c('0x4'))[_0xf55c('0x5')];var clientSideLogs=require(_0xf55c('0x6'));exports[_0xf55c('0x7')]=function(_0x41b702){return setupLoggers(_0x41b702)[_0xf55c('0x8')](function(){_0x41b702[_0xf55c('0x9')](_0xf55c('0xa'),require(_0xf55c('0xb')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xc'),require(_0xf55c('0xd')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xe'),require(_0xf55c('0xf')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x10'),require(_0xf55c('0x11')));_0x41b702[_0xf55c('0x9')]('/api/voice/mohs',require(_0xf55c('0x12')));_0x41b702['use'](_0xf55c('0x13'),require(_0xf55c('0x14')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x15'),require(_0xf55c('0x16')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x17'),require(_0xf55c('0x18')));_0x41b702[_0xf55c('0x9')]('/api/voice/mails',require(_0xf55c('0x19')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x1a'),require(_0xf55c('0x1b')));_0x41b702[_0xf55c('0x9')]('/api/voice/calls/reports',require(_0xf55c('0x1c')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x1d'),require(_0xf55c('0x1e')));_0x41b702[_0xf55c('0x9')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x1f'),require(_0xf55c('0x20')));_0x41b702[_0xf55c('0x9')]('/api/members/reports',require(_0xf55c('0x21')));_0x41b702[_0xf55c('0x9')]('/api/trunks',require('./api/trunk'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x22'),require(_0xf55c('0x23')));_0x41b702['use'](_0xf55c('0x24'),require(_0xf55c('0x25')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x26'),require(_0xf55c('0x27')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x28'),require(_0xf55c('0x29')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x2a'),require('./api/mailSubstatus'));_0x41b702['use'](_0xf55c('0x2b'),require('./api/mailInteraction'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x2c'),require(_0xf55c('0x2d')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x2e'),require(_0xf55c('0x2f')));_0x41b702[_0xf55c('0x9')]('/api/mail/reports/queue',require(_0xf55c('0x30')));_0x41b702[_0xf55c('0x9')]('/api/dashboards',require(_0xf55c('0x31')));_0x41b702['use'](_0xf55c('0x32'),require(_0xf55c('0x33')));_0x41b702['use'](_0xf55c('0x34'),require(_0xf55c('0x35')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x36'),require(_0xf55c('0x37')));_0x41b702['use']('/api/fax/interactions',require(_0xf55c('0x38')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x39'),require(_0xf55c('0x3a')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x3b'),require('./api/faxQueue'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x3c'),require('./api/faxQueueReport'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x3d'),require('./api/smsAccount'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x3e'),require(_0xf55c('0x3f')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x40'),require(_0xf55c('0x41')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x42'),require(_0xf55c('0x43')));_0x41b702['use'](_0xf55c('0x44'),require('./api/smsQueue'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x45'),require(_0xf55c('0x46')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x47'),require('./api/openchannelApplication'));_0x41b702['use']('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x48'),require('./api/openchannelMessage'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x49'),require('./api/openchannelQueue'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x4a'),require(_0xf55c('0x4b')));_0x41b702['use'](_0xf55c('0x4c'),require('./api/openchannelQueueReport'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x4d'),require(_0xf55c('0x4e')));_0x41b702['use'](_0xf55c('0x4f'),require(_0xf55c('0x50')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x51'),require(_0xf55c('0x52')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x53'),require('./api/chatOfflineMessage'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x54'),require('./api/chatQueue'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x55'),require(_0xf55c('0x56')));_0x41b702[_0xf55c('0x9')]('/api/chat/proactive_actions',require(_0xf55c('0x57')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x58'),require(_0xf55c('0x59')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x5a'),require('./api/cmContact'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x5b'),require(_0xf55c('0x5c')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x5d'),require('./api/cmHopperBlack'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x5e'),require(_0xf55c('0x5f')));_0x41b702[_0xf55c('0x9')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x41b702['use'](_0xf55c('0x60'),require(_0xf55c('0x61')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x62'),require(_0xf55c('0x63')));_0x41b702['use'](_0xf55c('0x64'),require('./api/automation'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x65'),require(_0xf55c('0x66')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x67'),require(_0xf55c('0x68')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x69'),require(_0xf55c('0x6a')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x6b'),require(_0xf55c('0x6c')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x6d'),require('./api/pause'));_0x41b702['use'](_0xf55c('0x6e'),require(_0xf55c('0x6f')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x70'),require('./api/voiceQueuesLog'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x71'),require(_0xf55c('0x72')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x73'),require(_0xf55c('0x74')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x75'),require('./api/tag'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x76'),require(_0xf55c('0x77')));_0x41b702['use'](_0xf55c('0x78'),require(_0xf55c('0x79')));_0x41b702[_0xf55c('0x9')]('/api/cm_hopper_additional_phones',require(_0xf55c('0x7a')));_0x41b702['use'](_0xf55c('0x7b'),require(_0xf55c('0x7c')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x7d'),require(_0xf55c('0x7e')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x7f'),require(_0xf55c('0x80')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x81'),require(_0xf55c('0x82')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x83'),require(_0xf55c('0x84')));_0x41b702['use'](_0xf55c('0x85'),require('./api/analyticCustomReport'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x86'),require(_0xf55c('0x87')));_0x41b702[_0xf55c('0x9')]('/api/analytics/extracted_reports',require(_0xf55c('0x88')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x89'),require(_0xf55c('0x8a')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x8b'),require(_0xf55c('0x8c')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x8d'),require(_0xf55c('0x8e')));_0x41b702[_0xf55c('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x8f'),require(_0xf55c('0x90')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x91'),require('./api/intSalesforceField'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x92'),require(_0xf55c('0x93')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x94'),require(_0xf55c('0x95')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x96'),require(_0xf55c('0x97')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x98'),require(_0xf55c('0x99')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x9a'),require(_0xf55c('0x9b')));_0x41b702['use']('/api/integrations/desk/fields',require(_0xf55c('0x9c')));_0x41b702['use'](_0xf55c('0x9d'),require('./api/intZohoAccount'));_0x41b702['use']('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x41b702[_0xf55c('0x9')](_0xf55c('0x9e'),require('./api/intZohoField'));_0x41b702['use'](_0xf55c('0x9f'),require(_0xf55c('0xa0')));_0x41b702[_0xf55c('0x9')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xa1'),require('./api/intZendeskField'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xa2'),require(_0xf55c('0xa3')));_0x41b702['use'](_0xf55c('0xa4'),require(_0xf55c('0xa5')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xa6'),require('./api/intFreshdeskField'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xa7'),require('./api/intVtigerAccount'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xa8'),require(_0xf55c('0xa9')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xaa'),require(_0xf55c('0xab')));_0x41b702['use'](_0xf55c('0xac'),require('./api/intServicenowAccount'));_0x41b702['use']('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x41b702['use'](_0xf55c('0xad'),require('./api/intServicenowField'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xae'),require(_0xf55c('0xaf')));_0x41b702['use'](_0xf55c('0xb0'),require(_0xf55c('0xb1')));_0x41b702['use']('/api/integrations/dynamics365/fields',require(_0xf55c('0xb2')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xb3'),require('./api/intFreshsalesAccount'));_0x41b702['use'](_0xf55c('0xb4'),require('./api/intFreshsalesConfiguration'));_0x41b702[_0xf55c('0x9')]('/api/integrations/freshsales/fields',require(_0xf55c('0xb5')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xb6'),require(_0xf55c('0xb7')));_0x41b702[_0xf55c('0x9')]('/api/chat/reports/queue',require(_0xf55c('0xb8')));_0x41b702[_0xf55c('0x9')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xb9'),require(_0xf55c('0xba')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xbb'),require('./api/jscriptyQuestionReport'));_0x41b702['use'](_0xf55c('0xbc'),require('./api/jscriptySessionReport'));_0x41b702['use'](_0xf55c('0xbd'),require(_0xf55c('0xbe')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xbf'),require('./api/squareReport'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xc0'),require(_0xf55c('0xc1')));_0x41b702['use'](_0xf55c('0xc2'),require(_0xf55c('0xc3')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xc4'),require('./api/setting'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xc5'),require('./api/squareOdbc'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xc6'),require(_0xf55c('0xc7')));_0x41b702[_0xf55c('0x9')]('/api/square/recordings',require(_0xf55c('0xc8')));_0x41b702[_0xf55c('0x9')]('/api/square/messages',require('./api/squareMessage'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xc9'),require(_0xf55c('0xca')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xcb'),require(_0xf55c('0xcc')));_0x41b702[_0xf55c('0x9')]('/api/campaigns',require(_0xf55c('0xcd')));_0x41b702[_0xf55c('0x9')]('/api/migrations',require(_0xf55c('0xce')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xcf'),require(_0xf55c('0xd0')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xd1'),require('./api/plugin'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xd2'),require('./api/mailTransferReport'));_0x41b702[_0xf55c('0x9')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xd3'),require('./api/faxTransferReport'));_0x41b702['use']('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xd4'),require('./api/smsTransferReport'));_0x41b702['use'](_0xf55c('0xd5'),require(_0xf55c('0xd6')));_0x41b702['use'](_0xf55c('0xd7'),require(_0xf55c('0xd8')));_0x41b702[_0xf55c('0x9')]('/api/userProfiles',require(_0xf55c('0xd9')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xda'),require(_0xf55c('0xdb')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xdc'),require(_0xf55c('0xdd')));_0x41b702[_0xf55c('0x9')]('/api/userNotifications',require(_0xf55c('0xde')));_0x41b702['use'](_0xf55c('0xdf'),require(_0xf55c('0xe0')));_0x41b702['use'](_0xf55c('0xe1'),require('./api/whatsappApplication'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xe2'),require(_0xf55c('0xe3')));_0x41b702['use'](_0xf55c('0xe4'),require(_0xf55c('0xe5')));_0x41b702['use'](_0xf55c('0xe6'),require(_0xf55c('0xe7')));_0x41b702['use'](_0xf55c('0xe8'),require(_0xf55c('0xe9')));_0x41b702[_0xf55c('0x9')]('/api/whatsapp/queues',require(_0xf55c('0xea')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xeb'),require(_0xf55c('0xec')));_0x41b702['use'](_0xf55c('0xed'),require('./api/realtime'));_0x41b702['use'](_0xf55c('0xee'),require(_0xf55c('0xef')));_0x41b702['use'](_0xf55c('0xf0'),require(_0xf55c('0xf1')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xf2'),require(_0xf55c('0xf3')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xf4'),require(_0xf55c('0xf5')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xf6'),require(_0xf55c('0xf7')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xf8'),require(_0xf55c('0xf9')));_0x41b702['use']('/api/version',require(_0xf55c('0xfa')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xfb'),require(_0xf55c('0xfc')));_0x41b702[_0xf55c('0x9')](_0xf55c('0xfd'),require('./api/pm2'));_0x41b702[_0xf55c('0x9')](_0xf55c('0xfe'),require(_0xf55c('0xff')));_0x41b702[_0xf55c('0x9')](_0xf55c('0x100'),clientSideLogs);_0x41b702[_0xf55c('0x9')](_0xf55c('0x101'),express[_0xf55c('0x102')](path[_0xf55c('0x103')](config[_0xf55c('0x104')],_0xf55c('0x101'))));_0x41b702[_0xf55c('0x9')](_0xf55c('0x105'),express[_0xf55c('0x102')](path[_0xf55c('0x103')](config[_0xf55c('0x104')],_0xf55c('0x105'))));_0x41b702[_0xf55c('0x9')]('/demo',express[_0xf55c('0x102')](path[_0xf55c('0x103')](config[_0xf55c('0x104')],_0xf55c('0x106'))));_0x41b702[_0xf55c('0x9')](_0xf55c('0x107'),express[_0xf55c('0x102')](path['join'](config[_0xf55c('0x104')],_0xf55c('0x108'),'3.8.0')));_0x41b702[_0xf55c('0x9')]('/plugins',express[_0xf55c('0x102')](path[_0xf55c('0x103')](config[_0xf55c('0x104')],'/server/files/plugins')));_0x41b702[_0xf55c('0x109')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x41b702[_0xf55c('0x109')]('/*')[_0xf55c('0x10a')](function(_0x31c2e5,_0x37107b){_0x37107b['sendFile'](path[_0xf55c('0x10b')](_0x41b702[_0xf55c('0x10a')](_0xf55c('0x10c'))+_0xf55c('0x10d')));});return _0x41b702;});}; \ No newline at end of file +var _0x2da4=['/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/user-settings','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','3.8.1','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','appPath','path','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field'];(function(_0x278fe8,_0x205678){var _0x57e9b7=function(_0xb30c36){while(--_0xb30c36){_0x278fe8['push'](_0x278fe8['shift']());}};_0x57e9b7(++_0x205678);}(_0x2da4,0x161));var _0x42da=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2da4[_0x5b644e];return _0x49c6bf;};'use strict';var path=require(_0x42da('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0x42da('0x1'));var setupLoggers=require(_0x42da('0x2'))[_0x42da('0x3')];var clientSideLogs=require(_0x42da('0x4'));exports[_0x42da('0x5')]=function(_0x582d3f){return setupLoggers(_0x582d3f)[_0x42da('0x6')](function(){_0x582d3f[_0x42da('0x7')](_0x42da('0x8'),require(_0x42da('0x9')));_0x582d3f[_0x42da('0x7')]('/api/voice/chanspy',require(_0x42da('0xa')));_0x582d3f[_0x42da('0x7')](_0x42da('0xb'),require(_0x42da('0xc')));_0x582d3f['use'](_0x42da('0xd'),require(_0x42da('0xe')));_0x582d3f[_0x42da('0x7')](_0x42da('0xf'),require('./api/voiceMusicOnHold'));_0x582d3f['use'](_0x42da('0x10'),require(_0x42da('0x11')));_0x582d3f[_0x42da('0x7')](_0x42da('0x12'),require(_0x42da('0x13')));_0x582d3f[_0x42da('0x7')]('/api/screen/recordings',require(_0x42da('0x14')));_0x582d3f[_0x42da('0x7')](_0x42da('0x15'),require(_0x42da('0x16')));_0x582d3f[_0x42da('0x7')](_0x42da('0x17'),require(_0x42da('0x18')));_0x582d3f[_0x42da('0x7')](_0x42da('0x19'),require(_0x42da('0x1a')));_0x582d3f['use']('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x582d3f[_0x42da('0x7')](_0x42da('0x1b'),require(_0x42da('0x1c')));_0x582d3f[_0x42da('0x7')](_0x42da('0x1d'),require('./api/voiceQueueReport'));_0x582d3f[_0x42da('0x7')](_0x42da('0x1e'),require(_0x42da('0x1f')));_0x582d3f[_0x42da('0x7')]('/api/trunks',require('./api/trunk'));_0x582d3f['use'](_0x42da('0x20'),require('./api/voiceTransferReport'));_0x582d3f[_0x42da('0x7')](_0x42da('0x21'),require('./api/mailServerOut'));_0x582d3f['use'](_0x42da('0x22'),require(_0x42da('0x23')));_0x582d3f[_0x42da('0x7')](_0x42da('0x24'),require(_0x42da('0x25')));_0x582d3f[_0x42da('0x7')]('/api/mail/substatuses',require(_0x42da('0x26')));_0x582d3f['use'](_0x42da('0x27'),require('./api/mailInteraction'));_0x582d3f[_0x42da('0x7')]('/api/mail/messages',require('./api/mailMessage'));_0x582d3f[_0x42da('0x7')]('/api/mail/applications',require(_0x42da('0x28')));_0x582d3f['use'](_0x42da('0x29'),require(_0x42da('0x2a')));_0x582d3f[_0x42da('0x7')](_0x42da('0x2b'),require('./api/dashboard'));_0x582d3f['use'](_0x42da('0x2c'),require(_0x42da('0x2d')));_0x582d3f[_0x42da('0x7')]('/api/fax/accounts',require(_0x42da('0x2e')));_0x582d3f[_0x42da('0x7')](_0x42da('0x2f'),require(_0x42da('0x30')));_0x582d3f[_0x42da('0x7')]('/api/fax/interactions',require(_0x42da('0x31')));_0x582d3f[_0x42da('0x7')](_0x42da('0x32'),require(_0x42da('0x33')));_0x582d3f[_0x42da('0x7')](_0x42da('0x34'),require(_0x42da('0x35')));_0x582d3f[_0x42da('0x7')](_0x42da('0x36'),require(_0x42da('0x37')));_0x582d3f['use'](_0x42da('0x38'),require('./api/smsAccount'));_0x582d3f[_0x42da('0x7')](_0x42da('0x39'),require(_0x42da('0x3a')));_0x582d3f['use'](_0x42da('0x3b'),require(_0x42da('0x3c')));_0x582d3f[_0x42da('0x7')](_0x42da('0x3d'),require('./api/smsMessage'));_0x582d3f[_0x42da('0x7')](_0x42da('0x3e'),require('./api/smsQueue'));_0x582d3f[_0x42da('0x7')](_0x42da('0x3f'),require('./api/openchannelAccount'));_0x582d3f[_0x42da('0x7')](_0x42da('0x40'),require(_0x42da('0x41')));_0x582d3f['use'](_0x42da('0x42'),require('./api/openchannelInteraction'));_0x582d3f[_0x42da('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x582d3f[_0x42da('0x7')](_0x42da('0x43'),require(_0x42da('0x44')));_0x582d3f[_0x42da('0x7')](_0x42da('0x45'),require(_0x42da('0x46')));_0x582d3f[_0x42da('0x7')](_0x42da('0x47'),require(_0x42da('0x48')));_0x582d3f['use']('/api/chat/applications',require(_0x42da('0x49')));_0x582d3f[_0x42da('0x7')](_0x42da('0x4a'),require(_0x42da('0x4b')));_0x582d3f[_0x42da('0x7')](_0x42da('0x4c'),require(_0x42da('0x4d')));_0x582d3f[_0x42da('0x7')](_0x42da('0x4e'),require(_0x42da('0x4f')));_0x582d3f[_0x42da('0x7')]('/api/chat/queues',require('./api/chatQueue'));_0x582d3f[_0x42da('0x7')](_0x42da('0x50'),require(_0x42da('0x51')));_0x582d3f[_0x42da('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x582d3f[_0x42da('0x7')]('/api/cm/companies',require(_0x42da('0x52')));_0x582d3f['use'](_0x42da('0x53'),require(_0x42da('0x54')));_0x582d3f['use'](_0x42da('0x55'),require('./api/cmHopper'));_0x582d3f[_0x42da('0x7')](_0x42da('0x56'),require(_0x42da('0x57')));_0x582d3f[_0x42da('0x7')]('/api/cm/hopper_final',require(_0x42da('0x58')));_0x582d3f['use'](_0x42da('0x59'),require(_0x42da('0x5a')));_0x582d3f[_0x42da('0x7')]('/api/cm/custom_fields',require(_0x42da('0x5b')));_0x582d3f[_0x42da('0x7')](_0x42da('0x5c'),require(_0x42da('0x5d')));_0x582d3f['use'](_0x42da('0x5e'),require('./api/automation'));_0x582d3f[_0x42da('0x7')](_0x42da('0x5f'),require(_0x42da('0x60')));_0x582d3f[_0x42da('0x7')](_0x42da('0x61'),require('./api/disposition'));_0x582d3f[_0x42da('0x7')]('/api/conditions',require('./api/condition'));_0x582d3f[_0x42da('0x7')]('/api/intervals',require(_0x42da('0x62')));_0x582d3f['use'](_0x42da('0x63'),require(_0x42da('0x64')));_0x582d3f['use'](_0x42da('0x65'),require('./api/cdr'));_0x582d3f[_0x42da('0x7')](_0x42da('0x66'),require(_0x42da('0x67')));_0x582d3f[_0x42da('0x7')]('/api/schedules',require(_0x42da('0x68')));_0x582d3f[_0x42da('0x7')]('/api/sounds',require(_0x42da('0x69')));_0x582d3f[_0x42da('0x7')]('/api/tags',require(_0x42da('0x6a')));_0x582d3f[_0x42da('0x7')](_0x42da('0x6b'),require(_0x42da('0x6c')));_0x582d3f[_0x42da('0x7')](_0x42da('0x6d'),require(_0x42da('0x6e')));_0x582d3f[_0x42da('0x7')](_0x42da('0x6f'),require(_0x42da('0x70')));_0x582d3f[_0x42da('0x7')](_0x42da('0x71'),require('./api/template'));_0x582d3f[_0x42da('0x7')]('/api/triggers',require('./api/trigger'));_0x582d3f[_0x42da('0x7')]('/api/variables',require(_0x42da('0x72')));_0x582d3f[_0x42da('0x7')](_0x42da('0x73'),require(_0x42da('0x74')));_0x582d3f[_0x42da('0x7')](_0x42da('0x75'),require(_0x42da('0x76')));_0x582d3f[_0x42da('0x7')](_0x42da('0x77'),require(_0x42da('0x78')));_0x582d3f['use']('/api/analytics/default_reports',require(_0x42da('0x79')));_0x582d3f['use']('/api/analytics/extracted_reports',require(_0x42da('0x7a')));_0x582d3f[_0x42da('0x7')](_0x42da('0x7b'),require('./api/analyticMetric'));_0x582d3f[_0x42da('0x7')](_0x42da('0x7c'),require(_0x42da('0x7d')));_0x582d3f[_0x42da('0x7')](_0x42da('0x7e'),require(_0x42da('0x7f')));_0x582d3f[_0x42da('0x7')](_0x42da('0x80'),require('./api/intSalesforceAccount'));_0x582d3f[_0x42da('0x7')]('/api/integrations/salesforce/configurations',require(_0x42da('0x81')));_0x582d3f[_0x42da('0x7')](_0x42da('0x82'),require(_0x42da('0x83')));_0x582d3f[_0x42da('0x7')](_0x42da('0x84'),require(_0x42da('0x85')));_0x582d3f['use'](_0x42da('0x86'),require(_0x42da('0x87')));_0x582d3f[_0x42da('0x7')]('/api/integrations/sugarcrm/fields',require(_0x42da('0x88')));_0x582d3f[_0x42da('0x7')]('/api/integrations/desk/accounts',require(_0x42da('0x89')));_0x582d3f[_0x42da('0x7')](_0x42da('0x8a'),require(_0x42da('0x8b')));_0x582d3f[_0x42da('0x7')](_0x42da('0x8c'),require('./api/intDeskField'));_0x582d3f[_0x42da('0x7')](_0x42da('0x8d'),require(_0x42da('0x8e')));_0x582d3f[_0x42da('0x7')](_0x42da('0x8f'),require('./api/intZohoConfiguration'));_0x582d3f['use'](_0x42da('0x90'),require(_0x42da('0x91')));_0x582d3f[_0x42da('0x7')](_0x42da('0x92'),require(_0x42da('0x93')));_0x582d3f[_0x42da('0x7')](_0x42da('0x94'),require(_0x42da('0x95')));_0x582d3f[_0x42da('0x7')]('/api/integrations/zendesk/fields',require(_0x42da('0x96')));_0x582d3f['use']('/api/integrations/freshdesk/accounts',require(_0x42da('0x97')));_0x582d3f[_0x42da('0x7')](_0x42da('0x98'),require(_0x42da('0x99')));_0x582d3f[_0x42da('0x7')](_0x42da('0x9a'),require(_0x42da('0x9b')));_0x582d3f['use'](_0x42da('0x9c'),require(_0x42da('0x9d')));_0x582d3f[_0x42da('0x7')]('/api/integrations/vtiger/configurations',require(_0x42da('0x9e')));_0x582d3f[_0x42da('0x7')]('/api/integrations/vtiger/fields',require(_0x42da('0x9f')));_0x582d3f[_0x42da('0x7')]('/api/integrations/servicenow/accounts',require(_0x42da('0xa0')));_0x582d3f[_0x42da('0x7')](_0x42da('0xa1'),require('./api/intServicenowConfiguration'));_0x582d3f['use']('/api/integrations/servicenow/fields',require(_0x42da('0xa2')));_0x582d3f['use'](_0x42da('0xa3'),require(_0x42da('0xa4')));_0x582d3f[_0x42da('0x7')](_0x42da('0xa5'),require(_0x42da('0xa6')));_0x582d3f['use'](_0x42da('0xa7'),require(_0x42da('0xa8')));_0x582d3f[_0x42da('0x7')](_0x42da('0xa9'),require(_0x42da('0xaa')));_0x582d3f[_0x42da('0x7')](_0x42da('0xab'),require('./api/intFreshsalesConfiguration'));_0x582d3f[_0x42da('0x7')](_0x42da('0xac'),require(_0x42da('0xad')));_0x582d3f['use'](_0x42da('0xae'),require(_0x42da('0xaf')));_0x582d3f[_0x42da('0x7')](_0x42da('0xb0'),require(_0x42da('0xb1')));_0x582d3f['use'](_0x42da('0xb2'),require(_0x42da('0xb3')));_0x582d3f[_0x42da('0x7')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x582d3f[_0x42da('0x7')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x582d3f[_0x42da('0x7')]('/api/jscripty/sessions/reports',require(_0x42da('0xb4')));_0x582d3f[_0x42da('0x7')]('/api/sms/reports/queue',require(_0x42da('0xb5')));_0x582d3f[_0x42da('0x7')](_0x42da('0xb6'),require('./api/squareReport'));_0x582d3f['use'](_0x42da('0xb7'),require(_0x42da('0xb8')));_0x582d3f['use'](_0x42da('0xb9'),require(_0x42da('0xba')));_0x582d3f['use'](_0x42da('0xbb'),require('./api/setting'));_0x582d3f[_0x42da('0x7')]('/api/square/odbc',require(_0x42da('0xbc')));_0x582d3f[_0x42da('0x7')](_0x42da('0xbd'),require(_0x42da('0xbe')));_0x582d3f[_0x42da('0x7')](_0x42da('0xbf'),require(_0x42da('0xc0')));_0x582d3f[_0x42da('0x7')](_0x42da('0xc1'),require(_0x42da('0xc2')));_0x582d3f['use']('/api/teams',require('./api/team'));_0x582d3f[_0x42da('0x7')](_0x42da('0xc3'),require(_0x42da('0xc4')));_0x582d3f['use']('/api/campaigns',require(_0x42da('0xc5')));_0x582d3f['use'](_0x42da('0xc6'),require(_0x42da('0xc7')));_0x582d3f[_0x42da('0x7')]('/api/attachments',require('./api/attachment'));_0x582d3f[_0x42da('0x7')](_0x42da('0xc8'),require(_0x42da('0xc9')));_0x582d3f[_0x42da('0x7')](_0x42da('0xca'),require(_0x42da('0xcb')));_0x582d3f[_0x42da('0x7')]('/api/chat/reports/transfer',require(_0x42da('0xcc')));_0x582d3f['use'](_0x42da('0xcd'),require('./api/faxTransferReport'));_0x582d3f[_0x42da('0x7')]('/api/openchannel/reports/transfer',require(_0x42da('0xce')));_0x582d3f[_0x42da('0x7')](_0x42da('0xcf'),require(_0x42da('0xd0')));_0x582d3f[_0x42da('0x7')]('/api/cm/lists',require(_0x42da('0xd1')));_0x582d3f[_0x42da('0x7')](_0x42da('0xd2'),require('./api/voicePrefix'));_0x582d3f[_0x42da('0x7')](_0x42da('0xd3'),require(_0x42da('0xd4')));_0x582d3f[_0x42da('0x7')](_0x42da('0xd5'),require(_0x42da('0xd6')));_0x582d3f[_0x42da('0x7')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x582d3f[_0x42da('0x7')](_0x42da('0xd7'),require(_0x42da('0xd8')));_0x582d3f[_0x42da('0x7')](_0x42da('0xd9'),require(_0x42da('0xda')));_0x582d3f[_0x42da('0x7')](_0x42da('0xdb'),require(_0x42da('0xdc')));_0x582d3f['use'](_0x42da('0xdd'),require(_0x42da('0xde')));_0x582d3f['use'](_0x42da('0xdf'),require(_0x42da('0xe0')));_0x582d3f[_0x42da('0x7')](_0x42da('0xe1'),require(_0x42da('0xe2')));_0x582d3f['use'](_0x42da('0xe3'),require('./api/whatsappTransferReport'));_0x582d3f[_0x42da('0x7')](_0x42da('0xe4'),require(_0x42da('0xe5')));_0x582d3f[_0x42da('0x7')]('/api/cloudProviders',require(_0x42da('0xe6')));_0x582d3f[_0x42da('0x7')]('/api/realtime',require(_0x42da('0xe7')));_0x582d3f[_0x42da('0x7')](_0x42da('0xe8'),require('./api/user-setting'));_0x582d3f[_0x42da('0x7')]('/api/auth/local',require(_0x42da('0xe9')));_0x582d3f[_0x42da('0x7')](_0x42da('0xea'),require('./api/authGoogle'));_0x582d3f['use'](_0x42da('0xeb'),require(_0x42da('0xec')));_0x582d3f[_0x42da('0x7')](_0x42da('0xed'),require('./api/jira'));_0x582d3f[_0x42da('0x7')](_0x42da('0xee'),require(_0x42da('0xef')));_0x582d3f[_0x42da('0x7')](_0x42da('0xf0'),require('./api/version'));_0x582d3f[_0x42da('0x7')](_0x42da('0xf1'),require(_0x42da('0xf2')));_0x582d3f['use'](_0x42da('0xf3'),require('./api/pm2'));_0x582d3f['use'](_0x42da('0xf4'),require(_0x42da('0xf5')));_0x582d3f[_0x42da('0x7')](_0x42da('0xf6'),clientSideLogs);_0x582d3f['use'](_0x42da('0xf7'),express[_0x42da('0xf8')](path[_0x42da('0xf9')](config[_0x42da('0xfa')],_0x42da('0xf7'))));_0x582d3f[_0x42da('0x7')](_0x42da('0xfb'),express[_0x42da('0xf8')](path[_0x42da('0xf9')](config['root'],_0x42da('0xfb'))));_0x582d3f[_0x42da('0x7')]('/demo',express[_0x42da('0xf8')](path[_0x42da('0xf9')](config['root'],_0x42da('0xfc'))));_0x582d3f[_0x42da('0x7')]('/snippet',express[_0x42da('0xf8')](path[_0x42da('0xf9')](config[_0x42da('0xfa')],_0x42da('0xfd'),_0x42da('0xfe'))));_0x582d3f[_0x42da('0x7')]('/plugins',express[_0x42da('0xf8')](path['join'](config[_0x42da('0xfa')],_0x42da('0xff'))));_0x582d3f['route'](_0x42da('0x100'))['get'](errors[0x194]);_0x582d3f[_0x42da('0x101')]('/*')[_0x42da('0x102')](function(_0x553451,_0xb5f72f){_0xb5f72f[_0x42da('0x103')](path['resolve'](_0x582d3f['get'](_0x42da('0x104'))+'/index.html'));});return _0x582d3f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 798e2d7..b1aadf6 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe155=['Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log'];(function(_0xd480c2,_0x17e60e){var _0x119409=function(_0x441097){while(--_0x441097){_0xd480c2['push'](_0xd480c2['shift']());}};_0x119409(++_0x17e60e);}(_0xe155,0xcf));var _0x5e15=function(_0x2f04ec,_0x27ba37){_0x2f04ec=_0x2f04ec-0x0;var _0xbf1b25=_0xe155[_0x2f04ec];return _0xbf1b25;};'use strict';var jayson=require(_0x5e15('0x0'));var _=require(_0x5e15('0x1'));var config=require(_0x5e15('0x2'));exports[_0x5e15('0x3')]=function(){return new Promise(function(_0x2820ea,_0x4084da){var _0xe6a679={};_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x5')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x6')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x7')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x8')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x9')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0xa')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0xb')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0xc')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0xd')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0xe')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0xf')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/mailServerIn/mailServerIn.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x10')));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x11')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/mailInteraction/mailInteraction.rpc'));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x12')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x13')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x14')));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x15')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x16')));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x17')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x18')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x19')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x1a')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x1b')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/smsInteraction/smsInteraction.rpc'));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x1c')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x1d')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x1e')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x1f')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x20')));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x21')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x22')));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x23')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x24')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/cmHopper/cmHopper.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x25')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x26')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x27')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x28')));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x29')));_0xe6a679=_['merge'](_0xe6a679,require('../api/pause/pause.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/sound/sound.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x2a')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x2b')));_0xe6a679=_['merge'](_0xe6a679,require('../api/trigger/trigger.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x2c')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x2d')));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x2e')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x2f')));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x30')));_0xe6a679=_['merge'](_0xe6a679,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x31')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x32')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xe6a679=_['merge'](_0xe6a679,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x33')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x34')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x35')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/setting/setting.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x36')));_0xe6a679=_['merge'](_0xe6a679,require('../api/squareProject/squareProject.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/squareRecording/squareRecording.rpc'));_0xe6a679=_['merge'](_0xe6a679,require(_0x5e15('0x37')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x38')));_0xe6a679=_['merge'](_0xe6a679,require('../api/attachment/attachment.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x39')));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xe6a679=_[_0x5e15('0x4')](_0xe6a679,require(_0x5e15('0x3a')));var _0x2d29cb=jayson['server'](_0xe6a679)[_0x5e15('0x3b')]();var _0x1a64f4=config[_0x5e15('0x3c')][_0x5e15('0x3d')]||config[_0x5e15('0x3d')]+0x1;var _0x1a9ad3=config[_0x5e15('0x3c')]['ip']||_0x5e15('0x3e');_0x2d29cb['on'](_0x5e15('0x3f'),function(_0x150c28){return _0x4084da(_0x150c28);});_0x2d29cb['listen'](_0x1a64f4,_0x1a9ad3,function(){console[_0x5e15('0x40')](_0x5e15('0x41'),_0x1a9ad3,_0x1a64f4);require('../config/triggers')[_0x5e15('0x42')]();return _0x2820ea(_0x5e15('0x43')+_0x1a9ad3+':'+_0x1a64f4);});});}; \ No newline at end of file +var _0xe108=['../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc'];(function(_0x498468,_0x4558db){var _0x57cb61=function(_0x2322d8){while(--_0x2322d8){_0x498468['push'](_0x498468['shift']());}};_0x57cb61(++_0x4558db);}(_0xe108,0x6b));var _0x8e10=function(_0x235ad6,_0x5e4437){_0x235ad6=_0x235ad6-0x0;var _0x2885d9=_0xe108[_0x235ad6];return _0x2885d9;};'use strict';var jayson=require('jayson/promise');var _=require(_0x8e10('0x0'));var config=require('../config/environment');exports[_0x8e10('0x1')]=function(){return new Promise(function(_0x4d2291,_0x1d78b3){var _0x18b22b={};_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/user/user.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x3')));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x4')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x5')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x6')));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x7')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x18b22b=_['merge'](_0x18b22b,require('../api/memberReport/memberReport.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/trunk/trunk.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x8')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x9')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/mailServerIn/mailServerIn.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0xa')));_0x18b22b=_['merge'](_0x18b22b,require('../api/mailQueue/mailQueue.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/mailInteraction/mailInteraction.rpc'));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0xb')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0xc')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0xd')));_0x18b22b=_['merge'](_0x18b22b,require('../api/faxAccount/faxAccount.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0xe')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0xf')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x10')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/faxQueue/faxQueue.rpc'));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x11')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/smsAccount/smsAccount.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/smsInteraction/smsInteraction.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x12')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x13')));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x14')));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x15')));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x16')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x18b22b=_['merge'](_0x18b22b,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x17')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x18')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/chatQueue/chatQueue.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/cmContact/cmContact.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x19')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x1a')));_0x18b22b=_['merge'](_0x18b22b,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x1b')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x1c')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x1d')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x1e')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x1f')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/variable/variable.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x18b22b=_['merge'](_0x18b22b,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x20')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x21')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x22')));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x23')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x24')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x25')));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x26')));_0x18b22b=_['merge'](_0x18b22b,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/setting/setting.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require('../api/squareOdbc/squareOdbc.rpc'));_0x18b22b=_['merge'](_0x18b22b,require(_0x8e10('0x27')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x28')));_0x18b22b=_['merge'](_0x18b22b,require('../api/squareMessage/squareMessage.rpc'));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x29')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x2a')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x2b')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x2c')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x2d')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x2e')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x2f')));_0x18b22b=_[_0x8e10('0x2')](_0x18b22b,require(_0x8e10('0x30')));var _0x3b088d=jayson[_0x8e10('0x31')](_0x18b22b)[_0x8e10('0x32')]();var _0x239403=config[_0x8e10('0x33')][_0x8e10('0x34')]||config[_0x8e10('0x34')]+0x1;var _0x44ff6a=config[_0x8e10('0x33')]['ip']||_0x8e10('0x35');_0x3b088d['on'](_0x8e10('0x36'),function(_0x3a545d){return _0x1d78b3(_0x3a545d);});_0x3b088d[_0x8e10('0x1')](_0x239403,_0x44ff6a,function(){console[_0x8e10('0x37')](_0x8e10('0x38'),_0x44ff6a,_0x239403);require('../config/triggers')[_0x8e10('0x39')]();return _0x4d2291(_0x8e10('0x3a')+_0x44ff6a+':'+_0x239403);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d519922..3b75aa5 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe225=['headers','emit','ready','line','hangup','substring','520-Invalid','search','function','no\x20code','result=','indexOf','substr','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','replace','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','exec','wait','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','setEncoding','utf8','setTimeout'];(function(_0x3cfa33,_0x5a26bf){var _0xcec34c=function(_0x32c7bf){while(--_0x32c7bf){_0x3cfa33['push'](_0x3cfa33['shift']());}};_0xcec34c(++_0x5a26bf);}(_0xe225,0x1bd));var _0x5e22=function(_0x874709,_0x20b492){_0x874709=_0x874709-0x0;var _0x351b20=_0xe225[_0x874709];return _0x351b20;};'use strict';var util=require('util');var _=require(_0x5e22('0x0'));var EventEmitter=require(_0x5e22('0x1'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x39f972){var _0x5ca6b5=this,_0x45790b=new AGIReply(),_0x4e0d42=![],_0x50df23={};EventEmitter['call'](_0x5ca6b5);_0x39f972[_0x5e22('0x2')](_0x5e22('0x3'));_0x39f972[_0x5e22('0x4')](0x8*0x3c*0x3c*0x3e8);_0x45790b[_0x5e22('0x2')](_0x5e22('0x3'));_0x45790b['on'](_0x5e22('0x5'),function(_0x11f5c5){for(var _0x1b4871 in _0x11f5c5){_0x5ca6b5[_0x1b4871]=_0x11f5c5[_0x1b4871];}_0x5ca6b5[_0x5e22('0x6')](_0x5e22('0x7'));});_0x45790b['on'](_0x5e22('0x8'),function(_0x1fa72a){if(_0x1fa72a['toLowerCase']()==_0x5e22('0x9')){_0x5ca6b5['emit'](_0x5e22('0x9'));return;}if(_0x1fa72a[_0x5e22('0xa')](0x0,0xb)==_0x5e22('0xb')){_0x4e0d42=!![];}if(_0x4e0d42){_0x50df23['rx']+=_0x1fa72a+'\x0a';if(_0x1fa72a[_0x5e22('0xc')]('520\x20End\x20of\x20proper')!=-0x1){_0x4e0d42=![];}}else{_0x50df23['rx']=_0x1fa72a;}if(_0x4e0d42){return;}if(typeof _0x50df23['cb']==_0x5e22('0xd')){var _0x5e8b51=_0x50df23['rx'][_0x5e22('0xa')](0x0,0x3),_0x3f96be=null,_0x3dd24c=null;_0x5e8b51=parseInt(_0x5e8b51);if(isNaN(_0x5e8b51)){_0x50df23['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5e22('0xe')});return;}if(_0x5e8b51!=0xc8){_0x50df23['cb'](null,{'code':_0x5e8b51,'result':-0x1,'extra':'KO'});return;}_0x3f96be=_0x50df23['rx'][_0x5e22('0xa')](0x4)['replace'](_0x5e22('0xf'),'');if(_0x3f96be[_0x5e22('0x10')]('\x20')!=-0x1){_0x3f96be=_0x3f96be[_0x5e22('0x11')](0x0,_0x3f96be[_0x5e22('0x10')]('\x20'));}if(_[_0x5e22('0x12')](_0x3f96be,'-1')){_0x3f96be=parseInt(_0x3f96be);}_0x3dd24c=_0x50df23['rx'][_0x5e22('0x13')]('\x20');if(_0x3dd24c[_0x5e22('0x14')]==0x3){_0x3dd24c=_0x3dd24c[0x2][_0x5e22('0xa')](0x1,_0x3dd24c[0x2][_0x5e22('0x14')]-0x1);}else if(_0x3dd24c[_0x5e22('0x14')]>0x3){var _0x3de7c2=/\((.+)\)/;var _0x260007=_0x50df23['rx'][_0x5e22('0x15')](_0x3de7c2);if(_0x260007){_0x3dd24c=_0x260007[0x1];}else{_0x3dd24c=null;}}else{_0x3dd24c=null;}_0x50df23['cb'](null,{'code':_0x5e8b51,'result':_0x3f96be,'extra':_0x3dd24c});}});_0x39f972['on']('error',function(_0x545723){_0x5ca6b5[_0x5e22('0x6')]('error',new AGIError(_0x5e22('0x16'),_0x545723[_0x5e22('0x17')]));});_0x39f972['on'](_0x5e22('0x18'),function(){_0x5ca6b5[_0x5e22('0x6')](_0x5e22('0x18'),new AGIError(_0x5e22('0x19')));});_0x39f972['on'](_0x5e22('0x1a'),function(){_0x5ca6b5[_0x5e22('0x6')](_0x5e22('0x1a'),new AGIError(_0x5e22('0x1b')));_0x39f972['destroy']();});_0x39f972[_0x5e22('0x1c')](_0x45790b);this[_0x5e22('0x1d')]=function(_0xf6515a,_0x303f19){var _0xf6515a=_0xf6515a||'',_0x303f19=typeof _0x303f19==_0x5e22('0xd')?_0x303f19:new Function();_0x50df23={'tx':_0xf6515a,'rx':'','cb':_0x303f19};_0x39f972[_0x5e22('0x1e')](_0xf6515a+'\x0a');},this[_0x5e22('0x18')]=function(){_0x39f972['destroy']();};}util[_0x5e22('0x1f')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x5e22('0x20')]=function(_0x2f3dda){return this[_0x5e22('0x1d')][_0x5e22('0x21')](this,_0x2f3dda);};AGIChannel[_0x5e22('0x22')][_0x5e22('0x23')]=function(){return this['sendRequest'](_0x5e22('0x24'));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x25')]=function(_0xf7c5e6,_0x10c67c,_0x3ba9db){_0xf7c5e6=_0xf7c5e6===undefined?_0x5e22('0x26'):_0xf7c5e6;_0x10c67c=_0x10c67c===undefined?'5':_0x10c67c;_0x3ba9db=_0x3ba9db===undefined?'1':_0x3ba9db;return this['sendRequest'](util['format'](_0x5e22('0x27'),_0xf7c5e6,_0x10c67c*0x3e8,_0x3ba9db));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x28')]=function(_0x53d5d5){_0x53d5d5=_0x53d5d5||_0x5e22('0x29');return this['sendRequest'](util[_0x5e22('0x2a')](_0x5e22('0x2b'),_0x53d5d5));};AGIChannel[_0x5e22('0x22')]['exec']=function(_0x3227b4,_0x537574){if(_['isArray'](_0x537574)){return this['sendRequest'](util[_0x5e22('0x2a')](_0x5e22('0x2c'),_0x3227b4,_0x537574[_0x5e22('0x2d')](',')));}return this['sendRequest'](util[_0x5e22('0x2a')](_0x5e22('0x2c'),_0x3227b4,_0x537574));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x2e')]=function(_0xab35a7){return this[_0x5e22('0x20')](util[_0x5e22('0x2a')]('SET\x20CONTEXT\x20%s',_0xab35a7));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x2f')]=function(_0x4496cb){return this[_0x5e22('0x20')](util[_0x5e22('0x2a')](_0x5e22('0x30'),_0x4496cb));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x31')]=function(_0xc4bb7d){return this['sendRequest'](util[_0x5e22('0x2a')](_0x5e22('0x32'),_0xc4bb7d));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x9')]=function(){return this[_0x5e22('0x20')](_0x5e22('0x33'));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x34')]=function(_0x21d474,_0x5e2519){var _0x15289d=_[_0x5e22('0x35')](_0x5e2519)||_[_0x5e22('0x36')](_0x5e2519)?_0x5e2519['toString']():_0x5e2519;return this[_0x5e22('0x20')](util[_0x5e22('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x21d474,_0x15289d?_0x15289d['toString']()[_0x5e22('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x38')]=function(_0x2d142f,_0xa88e60){return this[_0x5e22('0x20')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x2d142f,_0xa88e60));};AGIChannel['prototype'][_0x5e22('0x39')]=function(_0x5a3a3c,_0x33b83a){return this[_0x5e22('0x20')](util['format'](_0x5e22('0x3a'),_0x5a3a3c,_0x33b83a));};AGIChannel['prototype'][_0x5e22('0x3b')]=function(_0x21f509,_0x4d1970){return this[_0x5e22('0x20')](util[_0x5e22('0x2a')](_0x5e22('0x3c'),_0x21f509,_0x4d1970));};AGIChannel[_0x5e22('0x22')]['continueAt']=function(_0x58d289,_0xd20728,_0x399ac7){_0xd20728=_0xd20728||this[_0x5e22('0x3d')];_0x399ac7=_0x399ac7||0x1;this['setContext'](_0x58d289);this[_0x5e22('0x2f')](_0xd20728);this[_0x5e22('0x31')](_0x399ac7);return this['noop'](util['format'](_0x5e22('0x3e'),_0x58d289,_0xd20728,_0x399ac7));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x3f')]=function(_0x235b65){return this['sendRequest'](util['format'](_0x5e22('0x40'),_0x235b65));};AGIChannel[_0x5e22('0x22')][_0x5e22('0x41')]=function(_0x5d3b9a,_0x1d36af,_0x37fedf,_0x463770,_0x75a4c9,_0x5f53a6){_0x1d36af=_0x1d36af||_0x5e22('0x42');_0x37fedf=_0x37fedf||'';_0x463770=_0x463770===undefined?-0x1:_0x463770==='-1'?-0x1:_0x463770*0x3e8;_0x75a4c9=_0x75a4c9===undefined?'':'s='+_0x75a4c9;_0x5f53a6=_0x5f53a6?_0x5e22('0x43'):'';return this['sendRequest'](util['format'](_0x5e22('0x44'),_0x5d3b9a,_0x1d36af,_0x37fedf,_0x463770,_0x5f53a6,_0x75a4c9));};AGIChannel['prototype'][_0x5e22('0x45')]=function(_0x4ebc55,_0x1d518d){_0x1d518d=_0x1d518d||'';return this[_0x5e22('0x20')](util[_0x5e22('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4ebc55,_0x1d518d));};AGIChannel[_0x5e22('0x22')]['agi']=function(_0x219799){return this[_0x5e22('0x46')]('AGI',_0x219799);};AGIChannel['prototype'][_0x5e22('0x47')]=function(_0x2efe3b){return this[_0x5e22('0x46')]('WAIT',_0x2efe3b);};AGIChannel[_0x5e22('0x22')][_0x5e22('0x48')]=function(_0x409f62,_0x23f854){this[_0x5e22('0x28')](util[_0x5e22('0x2a')](_0x5e22('0x49'),_0x409f62['id'],_0x409f62['label'],_0x23f854));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5e22('0x4a')]=AGIChannel; \ No newline at end of file +var _0x2544=['SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','AGI','wait','exec','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','EventEmitter','./reply','setEncoding','utf8','setTimeout','headers','emit','ready','line','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sync','answer','sendRequest','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x2544,0x1ec));var _0x4254=function(_0xee8aee,_0x2b6997){_0xee8aee=_0xee8aee-0x0;var _0x25baba=_0x2544[_0xee8aee];return _0x25baba;};'use strict';var util=require('util');var _=require(_0x4254('0x0'));var EventEmitter=require(_0x4254('0x1'))[_0x4254('0x2')];var AGIReply=require(_0x4254('0x3'));var AGIError=require('./error');function AGIChannel(_0x448916){var _0x31e585=this,_0x483d09=new AGIReply(),_0x5b263c=![],_0x8aa018={};EventEmitter['call'](_0x31e585);_0x448916[_0x4254('0x4')](_0x4254('0x5'));_0x448916[_0x4254('0x6')](0x8*0x3c*0x3c*0x3e8);_0x483d09[_0x4254('0x4')](_0x4254('0x5'));_0x483d09['on'](_0x4254('0x7'),function(_0x1caf13){for(var _0x214894 in _0x1caf13){_0x31e585[_0x214894]=_0x1caf13[_0x214894];}_0x31e585[_0x4254('0x8')](_0x4254('0x9'));});_0x483d09['on'](_0x4254('0xa'),function(_0x286b2d){if(_0x286b2d['toLowerCase']()=='hangup'){_0x31e585['emit']('hangup');return;}if(_0x286b2d['substring'](0x0,0xb)==_0x4254('0xb')){_0x5b263c=!![];}if(_0x5b263c){_0x8aa018['rx']+=_0x286b2d+'\x0a';if(_0x286b2d[_0x4254('0xc')](_0x4254('0xd'))!=-0x1){_0x5b263c=![];}}else{_0x8aa018['rx']=_0x286b2d;}if(_0x5b263c){return;}if(typeof _0x8aa018['cb']==_0x4254('0xe')){var _0x3ce95b=_0x8aa018['rx'][_0x4254('0xf')](0x0,0x3),_0x52285a=null,_0x3fab44=null;_0x3ce95b=parseInt(_0x3ce95b);if(isNaN(_0x3ce95b)){_0x8aa018['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3ce95b!=0xc8){_0x8aa018['cb'](null,{'code':_0x3ce95b,'result':-0x1,'extra':'KO'});return;}_0x52285a=_0x8aa018['rx'][_0x4254('0xf')](0x4)[_0x4254('0x10')]('result=','');if(_0x52285a[_0x4254('0x11')]('\x20')!=-0x1){_0x52285a=_0x52285a['substr'](0x0,_0x52285a[_0x4254('0x11')]('\x20'));}if(_[_0x4254('0x12')](_0x52285a,'-1')){_0x52285a=parseInt(_0x52285a);}_0x3fab44=_0x8aa018['rx'][_0x4254('0x13')]('\x20');if(_0x3fab44['length']==0x3){_0x3fab44=_0x3fab44[0x2][_0x4254('0xf')](0x1,_0x3fab44[0x2]['length']-0x1);}else if(_0x3fab44[_0x4254('0x14')]>0x3){var _0x1dd188=/\((.+)\)/;var _0x2e371d=_0x8aa018['rx'][_0x4254('0x15')](_0x1dd188);if(_0x2e371d){_0x3fab44=_0x2e371d[0x1];}else{_0x3fab44=null;}}else{_0x3fab44=null;}_0x8aa018['cb'](null,{'code':_0x3ce95b,'result':_0x52285a,'extra':_0x3fab44});}});_0x448916['on'](_0x4254('0x16'),function(_0x18fbe9){_0x31e585['emit'](_0x4254('0x16'),new AGIError(_0x4254('0x17'),_0x18fbe9[_0x4254('0x18')]));});_0x448916['on']('close',function(){_0x31e585[_0x4254('0x8')](_0x4254('0x19'),new AGIError(_0x4254('0x1a')));});_0x448916['on'](_0x4254('0x1b'),function(){_0x31e585['emit']('timeout',new AGIError(_0x4254('0x1c')));_0x448916[_0x4254('0x1d')]();});_0x448916[_0x4254('0x1e')](_0x483d09);this[_0x4254('0x1f')]=function(_0xf3b761,_0x44e6a8){var _0xf3b761=_0xf3b761||'',_0x44e6a8=typeof _0x44e6a8=='function'?_0x44e6a8:new Function();_0x8aa018={'tx':_0xf3b761,'rx':'','cb':_0x44e6a8};_0x448916[_0x4254('0x20')](_0xf3b761+'\x0a');},this[_0x4254('0x19')]=function(){_0x448916['destroy']();};}util[_0x4254('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x4254('0x22')]['sendRequest']=function(_0x1af8cd){return this[_0x4254('0x1f')][_0x4254('0x23')](this,_0x1af8cd);};AGIChannel[_0x4254('0x22')][_0x4254('0x24')]=function(){return this[_0x4254('0x25')](_0x4254('0x26'));};AGIChannel[_0x4254('0x22')]['getData']=function(_0x49fc90,_0x2426be,_0x3991fa){_0x49fc90=_0x49fc90===undefined?_0x4254('0x27'):_0x49fc90;_0x2426be=_0x2426be===undefined?'5':_0x2426be;_0x3991fa=_0x3991fa===undefined?'1':_0x3991fa;return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x29'),_0x49fc90,_0x2426be*0x3e8,_0x3991fa));};AGIChannel['prototype'][_0x4254('0x2a')]=function(_0x1600cf){_0x1600cf=_0x1600cf||_0x4254('0x2b');return this[_0x4254('0x25')](util['format'](_0x4254('0x2c'),_0x1600cf));};AGIChannel['prototype']['exec']=function(_0x3dd104,_0x186644){if(_[_0x4254('0x2d')](_0x186644)){return this[_0x4254('0x25')](util['format'](_0x4254('0x2e'),_0x3dd104,_0x186644[_0x4254('0x2f')](',')));}return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x2e'),_0x3dd104,_0x186644));};AGIChannel[_0x4254('0x22')][_0x4254('0x30')]=function(_0x3e76d3){return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x31'),_0x3e76d3));};AGIChannel[_0x4254('0x22')][_0x4254('0x32')]=function(_0x20f2ee){return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x33'),_0x20f2ee));};AGIChannel[_0x4254('0x22')][_0x4254('0x34')]=function(_0x1b90b6){return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x35'),_0x1b90b6));};AGIChannel[_0x4254('0x22')][_0x4254('0x36')]=function(){return this[_0x4254('0x25')](_0x4254('0x37'));};AGIChannel[_0x4254('0x22')][_0x4254('0x38')]=function(_0x1b5aff,_0x4db986){var _0x335775=_[_0x4254('0x39')](_0x4db986)||_[_0x4254('0x3a')](_0x4db986)?_0x4db986[_0x4254('0x3b')]():_0x4db986;return this[_0x4254('0x25')](util[_0x4254('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1b5aff,_0x335775?_0x335775[_0x4254('0x3b')]()[_0x4254('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x4254('0x3c')]=function(_0x5bdc9d,_0x60c046){return this[_0x4254('0x25')](util['format'](_0x4254('0x3d'),_0x5bdc9d,_0x60c046));};AGIChannel['prototype'][_0x4254('0x3e')]=function(_0x2a9626,_0x335ef3){return this[_0x4254('0x25')](util[_0x4254('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x2a9626,_0x335ef3));};AGIChannel[_0x4254('0x22')][_0x4254('0x3f')]=function(_0x1647b5,_0xc6e36b){return this[_0x4254('0x25')](util['format'](_0x4254('0x40'),_0x1647b5,_0xc6e36b));};AGIChannel['prototype'][_0x4254('0x41')]=function(_0x5c9d2b,_0x527321,_0x1c4486){_0x527321=_0x527321||this[_0x4254('0x42')];_0x1c4486=_0x1c4486||0x1;this[_0x4254('0x30')](_0x5c9d2b);this[_0x4254('0x32')](_0x527321);this['setPriority'](_0x1c4486);return this[_0x4254('0x2a')](util[_0x4254('0x28')](_0x4254('0x43'),_0x5c9d2b,_0x527321,_0x1c4486));};AGIChannel[_0x4254('0x22')]['getVariable']=function(_0x415f00){return this['sendRequest'](util[_0x4254('0x28')](_0x4254('0x44'),_0x415f00));};AGIChannel[_0x4254('0x22')][_0x4254('0x45')]=function(_0x580588,_0x31b953,_0x25572f,_0x3b8fb1,_0x26fbfd,_0x600caa){_0x31b953=_0x31b953||_0x4254('0x46');_0x25572f=_0x25572f||'';_0x3b8fb1=_0x3b8fb1===undefined?-0x1:_0x3b8fb1==='-1'?-0x1:_0x3b8fb1*0x3e8;_0x26fbfd=_0x26fbfd===undefined?'':'s='+_0x26fbfd;_0x600caa=_0x600caa?_0x4254('0x47'):'';return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x48'),_0x580588,_0x31b953,_0x25572f,_0x3b8fb1,_0x600caa,_0x26fbfd));};AGIChannel['prototype']['streamFile']=function(_0x6e42,_0x353ed5){_0x353ed5=_0x353ed5||'';return this[_0x4254('0x25')](util[_0x4254('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x6e42,_0x353ed5));};AGIChannel[_0x4254('0x22')][_0x4254('0x49')]=function(_0x308159){return this['exec'](_0x4254('0x4a'),_0x308159);};AGIChannel[_0x4254('0x22')][_0x4254('0x4b')]=function(_0x44c195){return this[_0x4254('0x4c')]('WAIT',_0x44c195);};AGIChannel['prototype'][_0x4254('0x16')]=function(_0x871608,_0x488fbc){this[_0x4254('0x2a')](util[_0x4254('0x28')](_0x4254('0x4d'),_0x871608['id'],_0x871608[_0x4254('0x4e')],_0x488fbc));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 028aee5..8bf56e6 100644 --- a/server/services/agi/error.js +++ b/server/services/agi/error.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01c6=['format','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x507cfc,_0x227d00){var _0x3a2062=function(_0x5f3cb8){while(--_0x5f3cb8){_0x507cfc['push'](_0x507cfc['shift']());}};_0x3a2062(++_0x227d00);}(_0x01c6,0x1e3));var _0x601c=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0x01c6[_0x541a67];return _0x45da2a;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x601c('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x601c('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x601c('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x601c('0x3'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x601c('0x4'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x601c('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x601c('0x6')};function AGIError(_0x59186b){var _0x59186b=_0x59186b||null,_0x52d7e1=_0x52d7e1||[],_0x4206c5=0x1,_0x79834c='';if(!error[_0x59186b]){_0x59186b=_0x601c('0x7');}_0x52d7e1[_0x601c('0x8')](error[_0x59186b]);while(arguments[_0x4206c5]){_0x52d7e1[_0x601c('0x8')](arguments[_0x4206c5]);_0x4206c5++;}_0x79834c=util[_0x601c('0x9')]['apply'](util,_0x52d7e1);this['message']=_0x79834c;this[_0x601c('0xa')]=_0x59186b;}module[_0x601c('0xb')]=AGIError; \ No newline at end of file +var _0xdb74=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xdb74,0x198));var _0x4db7=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xdb74[_0x3ff085];return _0x2b68c3;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x4db7('0x0'),'E_AGI_ARGUMENT_PORT':_0x4db7('0x1'),'E_AGI_SERVER_ERROR':_0x4db7('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x4db7('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x4db7('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x4db7('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x4db7('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4db7('0x7'),'E_AGI_IVR_ENTRY':_0x4db7('0x8')};function AGIError(_0x39e589){var _0x39e589=_0x39e589||null,_0x16fa0f=_0x16fa0f||[],_0x5b039c=0x1,_0x56db98='';if(!error[_0x39e589]){_0x39e589=_0x4db7('0x9');}_0x16fa0f[_0x4db7('0xa')](error[_0x39e589]);while(arguments[_0x5b039c]){_0x16fa0f[_0x4db7('0xa')](arguments[_0x5b039c]);_0x5b039c++;}_0x56db98=util['format'][_0x4db7('0xb')](util,_0x16fa0f);this['message']=_0x56db98;this[_0x4db7('0xc')]=_0x39e589;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index df7d55a..6ab6176 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0309=['agi','E_AGI_SERVER_ERROR','message','parse','projectUpdate','emit','error','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe'];(function(_0x97435b,_0x3972c7){var _0x30feb9=function(_0x43d373){while(--_0x43d373){_0x97435b['push'](_0x97435b['shift']());}};_0x30feb9(++_0x3972c7);}(_0x0309,0xbd));var _0x9030=function(_0x57fa05,_0x237e6f){_0x57fa05=_0x57fa05-0x0;var _0x22a475=_0x0309[_0x57fa05];return _0x22a475;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x9030('0x0')];var Redis=require(_0x9030('0x1'));var AGIError=require(_0x9030('0x2'));var config=require(_0x9030('0x3'));config[_0x9030('0x4')]=_['defaults'](config['redis'],{'host':_0x9030('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x9030('0x6')](_0x9030('0x7'),function(_0x2df4c4){if(_0x2df4c4)return eventEmitter['emit']('error',new AGIError(_0x9030('0x8'),_0x2df4c4));});sub['on'](_0x9030('0x9'),function(_0x329f91,_0x2faf67){if(_0x329f91!==_0x9030('0x7'))return;try{var _0x2b3de7=JSON[_0x9030('0xa')](_0x2faf67);eventEmitter['emit'](_0x9030('0xb'),_0x2b3de7);}catch(_0x2e21d7){eventEmitter[_0x9030('0xc')](_0x9030('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x2e21d7));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xe29f=['E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error'];(function(_0x37cbcb,_0x255cd8){var _0x655dce=function(_0x30f2d4){while(--_0x30f2d4){_0x37cbcb['push'](_0x37cbcb['shift']());}};_0x655dce(++_0x255cd8);}(_0xe29f,0xd7));var _0xfe29=function(_0x59ae81,_0x765f20){_0x59ae81=_0x59ae81-0x0;var _0x5bc4ae=_0xe29f[_0x59ae81];return _0x5bc4ae;};'use strict';var _=require(_0xfe29('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0xfe29('0x1'));var config=require(_0xfe29('0x2'));config[_0xfe29('0x3')]=_[_0xfe29('0x4')](config[_0xfe29('0x3')],{'host':_0xfe29('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xfe29('0x3')]);sub[_0xfe29('0x6')]('agi',function(_0x47a1e1){if(_0x47a1e1)return eventEmitter[_0xfe29('0x7')](_0xfe29('0x8'),new AGIError(_0xfe29('0x9'),_0x47a1e1));});sub['on'](_0xfe29('0xa'),function(_0x1b171e,_0x32c019){if(_0x1b171e!=='agi')return;try{var _0x57c090=JSON[_0xfe29('0xb')](_0x32c019);eventEmitter[_0xfe29('0x7')](_0xfe29('0xc'),_0x57c090);}catch(_0x5519ec){eventEmitter[_0xfe29('0x7')](_0xfe29('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x5519ec));}});module[_0xfe29('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c07af77..c0b1107 100644 --- a/server/services/agi/graph/index.js +++ b/server/services/agi/graph/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaada=['stop\x20traverse','length','condition','target','default','agicommand','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xaada,0x1d7));var _0xaaad=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xaada[_0x45f951];return _0x24756c;};'use strict';var _=require(_0xaaad('0x0'));var logger=require('../../../config/logger')(_0xaaad('0x1'));var verticesWithRetry=[_0xaaad('0x2'),_0xaaad('0x3'),_0xaaad('0x4')];var Graph=function(){this[_0xaaad('0x5')]={};this[_0xaaad('0x6')]={};this[_0xaaad('0x7')]=0x0;};Graph[_0xaaad('0x8')]['addVertex']=function(_0x2e5c64){this[_0xaaad('0x5')][_0x2e5c64['id']]=_0x2e5c64;this['edges'][_0x2e5c64['id']]=[];};Graph[_0xaaad('0x8')]['addEdge']=function(_0x2712fd,_0x49e817,_0xbe3bc4){this['edges'][_0x2712fd]['push']({'target':_0x49e817,'condition':_0xbe3bc4});this[_0xaaad('0x7')]+=0x1;};Graph[_0xaaad('0x8')]['size']=function(){return _[_0xaaad('0x9')](this['vertices']);};Graph[_0xaaad('0x8')][_0xaaad('0xa')]=function(){return this[_0xaaad('0x7')];};Graph[_0xaaad('0x8')][_0xaaad('0xb')]=function(_0x25e310){return this['vertices'][_0x25e310];};Graph[_0xaaad('0x8')][_0xaaad('0xc')]=function(_0x21e45d,_0xd5dbb9){if(!this[_0xaaad('0x5')][_0x21e45d]){return logger[_0xaaad('0xd')](_0xaaad('0xe'));}var _0x268088=_0xd5dbb9(this['vertices'][_0x21e45d]);if(!_0x268088){return logger['info'](_0xaaad('0xf'));}if(this[_0xaaad('0x6')][_0x21e45d][_0xaaad('0x10')]===0x0){return logger[_0xaaad('0xd')]('no\x20edge/s\x20available');}for(var _0x258152=0x0,_0x3e90b6=[],_0x21f708=![];_0x258152\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','production','handleUnpublished','initialize'];(function(_0x2e5baf,_0x4b77a1){var _0x4c0797=function(_0x32f4fc){while(--_0x32f4fc){_0x2e5baf['push'](_0x2e5baf['shift']());}};_0x4c0797(++_0x4b77a1);}(_0x7456,0xab));var _0x6745=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x7456[_0x3203a1];return _0x24215e;};'use strict';var _=require(_0x6745('0x0'));var syncho=require(_0x6745('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6745('0x2'));var utilLicense=require(_0x6745('0x3'));var rpc=require(_0x6745('0x4'));var Project=require(_0x6745('0x5'));var AGIEmitter=require(_0x6745('0x6'))['EventEmitter'];var projects=[];config[_0x6745('0x2')]=_[_0x6745('0x7')](config[_0x6745('0x2')],{'ip':_0x6745('0x8'),'port':0x11dd});AGIEmitter['on'](_0x6745('0x9'),projectUpdateHandler);function connectionHandler(_0x5ef786){process[_0x6745('0xa')](function(){syncho(function(){try{setChannelVariables(_0x5ef786);agiHandler(_0x5ef786);}catch(_0x2c07ef){logger[_0x6745('0xb')](_0x2c07ef[_0x6745('0xc')]);}});});}function projectUpdateHandler(_0x14cc8e){try{var _0x29c3e0=_[_0x6745('0xd')](projects,['id',_0x14cc8e['id']]);if(_0x29c3e0>-0x1){if(_0x14cc8e[_0x6745('0xe')]===!![]){projects[_0x6745('0xf')](_0x29c3e0,0x1);}else{projects[_0x29c3e0]=_0x14cc8e;}}else{projects['push'](_0x14cc8e);}}catch(_0x45f274){logger[_0x6745('0xb')](_0x45f274[_0x6745('0xc')]);}}function listeningHandler(){console[_0x6745('0x10')](_0x6745('0x11'),config[_0x6745('0x2')][_0x6745('0x12')]);logger[_0x6745('0x13')](util[_0x6745('0x14')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x6745('0x2')]['ip'],config[_0x6745('0x2')][_0x6745('0x12')]));}function errorHandler(_0x535812){if(_0x535812&&_0x535812[_0x6745('0x15')]&&_0x535812[_0x6745('0x16')]){logger[_0x6745('0xb')](util['format']('[%s]\x20%s',_0x535812[_0x6745('0x15')],_0x535812[_0x6745('0x16')]));}else{logger[_0x6745('0xb')](util[_0x6745('0x14')]('[ERROR]\x20%s',_0x535812[_0x6745('0xc')]));}}function closeHandler(){logger[_0x6745('0x13')](util[_0x6745('0x14')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6745('0x17')],this[_0x6745('0x18')],this[_0x6745('0x19')],this[_0x6745('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x52dd25){logger['error'](_0x52dd25['stack']);}}function timeoutHandler(){logger[_0x6745('0x13')](util[_0x6745('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x6745('0x18')],this[_0x6745('0x19')],this[_0x6745('0x1a')],this[_0x6745('0x1b')]));}function hangupHandler(){logger[_0x6745('0x13')](util[_0x6745('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6745('0x17')],this[_0x6745('0x18')],this[_0x6745('0x19')],this[_0x6745('0x1a')],this[_0x6745('0x1b')]));this[_0x6745('0x1c')]=!![];}function createSquareReport(_0x45eb9a,_0x2a3533){rpc[_0x6745('0x1d')](_0x45eb9a)[_0x6745('0x1e')](function(_0x1017ca){if(_0x2a3533){_0x2a3533(null,_0x1017ca);}})[_0x6745('0x1f')](function(_0x357d9f){if(_0x2a3533){_0x2a3533(null,_0x357d9f);}});}function setChannelVariables(_0x4f6ff5){for(var _0x5ac596 in _0x4f6ff5){if(_0x4f6ff5[_0x6745('0x20')](_0x5ac596)){if(_0x5ac596[_0x6745('0x21')]('agi_')===0x0){_0x4f6ff5[_0x5ac596[_0x6745('0x22')](0x4)]=_0x4f6ff5[_0x5ac596];delete _0x4f6ff5[_0x5ac596];}}}}function agiHandler(_0x5699b6){logger[_0x6745('0x23')]('variables',JSON[_0x6745('0x24')](_0x5699b6,null,0x2));logger['info'](util[_0x6745('0x14')](_0x6745('0x25'),_0x5699b6[_0x6745('0x17')],_0x5699b6[_0x6745('0x18')],_0x5699b6[_0x6745('0x19')],_0x5699b6[_0x6745('0x1a')],_0x5699b6[_0x6745('0x1b')]));_0x5699b6['on']('error',errorHandler);_0x5699b6['on'](_0x6745('0x26'),closeHandler);_0x5699b6['on']('timeout',timeoutHandler);_0x5699b6[_0x6745('0x1c')]=![];_0x5699b6['on'](_0x6745('0x27'),hangupHandler);var _0x1c15bb=_[_0x6745('0x28')](projects,[_0x6745('0x15'),_0x5699b6[_0x6745('0x17')]]);if(!_0x1c15bb)return Project[_0x6745('0x29')](_0x5699b6);if(!_0x1c15bb[_0x6745('0x2a')])return Project[_0x6745('0x2b')](_0x5699b6);return Project[_0x6745('0x2c')](_0x1c15bb,_0x5699b6);}function main(){var _0x1b303c;return utilLicense[_0x6745('0x2d')]()['then'](function(_0x24c318){if(!_0x24c318)return;if(_0x24c318['voice']){if(_0x24c318[_0x6745('0x2e')]&&_0x24c318[_0x6745('0x2e')]>0x0){logger[_0x6745('0x13')](util['format'](_0x6745('0x2f'),_0x24c318[_0x6745('0x2e')]));_0x1b303c=_0x24c318['callysquare'];}else{logger['info'](_0x6745('0x30'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1b303c=-0x1;}})[_0x6745('0x1e')](function(){return Project[_0x6745('0x31')]();})[_0x6745('0x1e')](function(_0x4329f6){projects=_0x4329f6;return;})[_0x6745('0x1f')](function(_0x5b1f52){logger['error'](_0x6745('0x32'),_0x5b1f52[_0x6745('0xc')]);})[_0x6745('0x33')](function(){var _0x197ba1=require('./server')(config[_0x6745('0x2')][_0x6745('0x12')],config[_0x6745('0x2')]['ip'],_0x1b303c);_0x197ba1['on'](_0x6745('0xb'),errorHandler);_0x197ba1['on'](_0x6745('0x34'),listeningHandler);_0x197ba1['on'](_0x6745('0x35'),connectionHandler);_0x197ba1['on'](_0x6745('0x26'),closeHandler);});}main(); \ No newline at end of file +var _0x9d1e=['[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','hasOwnProperty','substring','variables','stringify','timeout','hangup','find','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','catch','[LICENSE]','finally','listening','close','lodash','syncho','util','../../config/logger','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','error','stack','findIndex','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','name','message','[%s]\x20%s','format'];(function(_0xf98ec1,_0x4c73b8){var _0x514b6a=function(_0x3dbc32){while(--_0x3dbc32){_0xf98ec1['push'](_0xf98ec1['shift']());}};_0x514b6a(++_0x4c73b8);}(_0x9d1e,0x93));var _0xe9d1=function(_0x1916ad,_0x1d4f7a){_0x1916ad=_0x1916ad-0x0;var _0x2c6396=_0x9d1e[_0x1916ad];return _0x2c6396;};'use strict';var _=require(_0xe9d1('0x0'));var syncho=require(_0xe9d1('0x1'));var util=require(_0xe9d1('0x2'));var config=require('../../config/environment');var logger=require(_0xe9d1('0x3'))(_0xe9d1('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0xe9d1('0x5'));var Project=require(_0xe9d1('0x6'));var AGIEmitter=require(_0xe9d1('0x7'))[_0xe9d1('0x8')];var projects=[];config[_0xe9d1('0x4')]=_[_0xe9d1('0x9')](config[_0xe9d1('0x4')],{'ip':_0xe9d1('0xa'),'port':0x11dd});AGIEmitter['on'](_0xe9d1('0xb'),projectUpdateHandler);function connectionHandler(_0x1da2d1){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x1da2d1);agiHandler(_0x1da2d1);}catch(_0x5ee55a){logger[_0xe9d1('0xc')](_0x5ee55a[_0xe9d1('0xd')]);}});});}function projectUpdateHandler(_0x311756){try{var _0x38a39d=_[_0xe9d1('0xe')](projects,['id',_0x311756['id']]);if(_0x38a39d>-0x1){if(_0x311756[_0xe9d1('0xf')]===!![]){projects[_0xe9d1('0x10')](_0x38a39d,0x1);}else{projects[_0x38a39d]=_0x311756;}}else{projects['push'](_0x311756);}}catch(_0x497d08){logger[_0xe9d1('0xc')](_0x497d08[_0xe9d1('0xd')]);}}function listeningHandler(){console[_0xe9d1('0x11')](_0xe9d1('0x12'),config[_0xe9d1('0x4')]['port']);logger[_0xe9d1('0x13')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xe9d1('0x4')]['ip'],config['agi']['port']));}function errorHandler(_0x3dc23b){if(_0x3dc23b&&_0x3dc23b[_0xe9d1('0x14')]&&_0x3dc23b[_0xe9d1('0x15')]){logger[_0xe9d1('0xc')](util['format'](_0xe9d1('0x16'),_0x3dc23b[_0xe9d1('0x14')],_0x3dc23b['message']));}else{logger['error'](util[_0xe9d1('0x17')](_0xe9d1('0x18'),_0x3dc23b[_0xe9d1('0xd')]));}}function closeHandler(){logger[_0xe9d1('0x13')](util[_0xe9d1('0x17')](_0xe9d1('0x19'),this[_0xe9d1('0x1a')],this[_0xe9d1('0x1b')],this['callerid'],this[_0xe9d1('0x1c')],this[_0xe9d1('0x1d')]));try{createSquareReport(this);}catch(_0xfff8d7){logger['error'](_0xfff8d7[_0xe9d1('0xd')]);}}function timeoutHandler(){logger[_0xe9d1('0x13')](util['format'](_0xe9d1('0x1e'),this[_0xe9d1('0x1a')],this[_0xe9d1('0x1b')],this[_0xe9d1('0x1f')],this[_0xe9d1('0x1c')],this[_0xe9d1('0x1d')]));}function hangupHandler(){logger[_0xe9d1('0x13')](util[_0xe9d1('0x17')](_0xe9d1('0x20'),this[_0xe9d1('0x1a')],this['calleridname'],this[_0xe9d1('0x1f')],this[_0xe9d1('0x1c')],this[_0xe9d1('0x1d')]));this[_0xe9d1('0x21')]=!![];}function createSquareReport(_0x1329da,_0x47b6dd){rpc[_0xe9d1('0x22')](_0x1329da)['then'](function(_0xaf46da){if(_0x47b6dd){_0x47b6dd(null,_0xaf46da);}})['catch'](function(_0x1e7b2a){if(_0x47b6dd){_0x47b6dd(null,_0x1e7b2a);}});}function setChannelVariables(_0xed0bc8){for(var _0x37d783 in _0xed0bc8){if(_0xed0bc8[_0xe9d1('0x23')](_0x37d783)){if(_0x37d783['indexOf']('agi_')===0x0){_0xed0bc8[_0x37d783[_0xe9d1('0x24')](0x4)]=_0xed0bc8[_0x37d783];delete _0xed0bc8[_0x37d783];}}}}function agiHandler(_0x423acd){logger['debug'](_0xe9d1('0x25'),JSON[_0xe9d1('0x26')](_0x423acd,null,0x2));logger['info'](util[_0xe9d1('0x17')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x423acd[_0xe9d1('0x1a')],_0x423acd[_0xe9d1('0x1b')],_0x423acd[_0xe9d1('0x1f')],_0x423acd['dnid'],_0x423acd['uniqueid']));_0x423acd['on'](_0xe9d1('0xc'),errorHandler);_0x423acd['on']('close',closeHandler);_0x423acd['on'](_0xe9d1('0x27'),timeoutHandler);_0x423acd[_0xe9d1('0x21')]=![];_0x423acd['on'](_0xe9d1('0x28'),hangupHandler);var _0x3ffb3e=_[_0xe9d1('0x29')](projects,['name',_0x423acd[_0xe9d1('0x1a')]]);if(!_0x3ffb3e)return Project['handleNotFound'](_0x423acd);if(!_0x3ffb3e[_0xe9d1('0x2a')])return Project[_0xe9d1('0x2b')](_0x423acd);return Project[_0xe9d1('0x2c')](_0x3ffb3e,_0x423acd);}function main(){var _0xd49c96;return utilLicense[_0xe9d1('0x2d')]()['then'](function(_0x28bed0){if(!_0x28bed0)return;if(_0x28bed0[_0xe9d1('0x2e')]){if(_0x28bed0[_0xe9d1('0x2f')]&&_0x28bed0[_0xe9d1('0x2f')]>0x0){logger[_0xe9d1('0x13')](util[_0xe9d1('0x17')]('[LICENSE]\x20CHANNELS:\x20%s',_0x28bed0[_0xe9d1('0x2f')]));_0xd49c96=_0x28bed0[_0xe9d1('0x2f')];}else{logger[_0xe9d1('0x13')](_0xe9d1('0x30'));}}else{logger[_0xe9d1('0x13')](_0xe9d1('0x31'));_0xd49c96=-0x1;}})[_0xe9d1('0x32')](function(){return Project[_0xe9d1('0x33')]();})[_0xe9d1('0x32')](function(_0x74a428){projects=_0x74a428;return;})[_0xe9d1('0x34')](function(_0x1b8b85){logger[_0xe9d1('0xc')](_0xe9d1('0x35'),_0x1b8b85[_0xe9d1('0xd')]);})[_0xe9d1('0x36')](function(){var _0x501cd7=require('./server')(config[_0xe9d1('0x4')]['port'],config[_0xe9d1('0x4')]['ip'],_0xd49c96);_0x501cd7['on'](_0xe9d1('0xc'),errorHandler);_0x501cd7['on'](_0xe9d1('0x37'),listeningHandler);_0x501cd7['on']('connection',connectionHandler);_0x501cd7['on'](_0xe9d1('0x38'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 1100f60..5b2c94e 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81a5=['client','request','then','error','message','result','catch','sendMailMessage','bluebird'];(function(_0x24bbd5,_0x34a7c4){var _0x8fb737=function(_0xda751f){while(--_0xda751f){_0x24bbd5['push'](_0x24bbd5['shift']());}};_0x8fb737(++_0x34a7c4);}(_0x81a5,0x131));var _0x581a=function(_0x5d2b1d,_0x177386){_0x5d2b1d=_0x5d2b1d-0x0;var _0xef2d1d=_0x81a5[_0x5d2b1d];return _0xef2d1d;};'use strict';var BPromise=require(_0x581a('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x581a('0x1')]['http']({'port':0x232b});function request(_0xefff14,_0x2c72ed){return new BPromise(function(_0x201fd7,_0x1e60f8){return client[_0x581a('0x2')](_0xefff14,_0x2c72ed)[_0x581a('0x3')](function(_0x44d171){if(_0x44d171[_0x581a('0x4')]){return _0x1e60f8(_0x44d171[_0x581a('0x4')][_0x581a('0x5')]);}else{return _0x201fd7(_0x44d171[_0x581a('0x6')]);}})[_0x581a('0x7')](function(_0x5a1625){return _0x1e60f8(_0x5a1625);});});}exports[_0x581a('0x8')]=function(_0x3308fd,_0x4ff5f5){return request('SendMail',{'account':_0x3308fd,'message':_0x4ff5f5});}; \ No newline at end of file +var _0x7392=['message','result','sendMailMessage','bluebird','jayson/promise','client','request','then'];(function(_0x67d4ca,_0x455f15){var _0xc53c24=function(_0x3645e4){while(--_0x3645e4){_0x67d4ca['push'](_0x67d4ca['shift']());}};_0xc53c24(++_0x455f15);}(_0x7392,0x1cb));var _0x2739=function(_0xcc9217,_0x4e4518){_0xcc9217=_0xcc9217-0x0;var _0x1a256c=_0x7392[_0xcc9217];return _0x1a256c;};'use strict';var BPromise=require(_0x2739('0x0'));var jayson=require(_0x2739('0x1'));var client=jayson[_0x2739('0x2')]['http']({'port':0x232b});function request(_0x3739e1,_0x54a77e){return new BPromise(function(_0x3e7a4f,_0xe354a){return client[_0x2739('0x3')](_0x3739e1,_0x54a77e)[_0x2739('0x4')](function(_0x547d7d){if(_0x547d7d['error']){return _0xe354a(_0x547d7d['error'][_0x2739('0x5')]);}else{return _0x3e7a4f(_0x547d7d[_0x2739('0x6')]);}})['catch'](function(_0x292129){return _0xe354a(_0x292129);});});}exports[_0x2739('0x7')]=function(_0x2c3157,_0x27c9c4){return request('SendMail',{'account':_0x2c3157,'message':_0x27c9c4});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 66e3010..5e80e5a 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f80=['Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','agi','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','target','addEdge','source','value','toJson','mxGraphModel','root','production','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','stringify','toString','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close'];(function(_0xdb0cc,_0x2e6853){var _0x549538=function(_0x4599d1){while(--_0x4599d1){_0xdb0cc['push'](_0xdb0cc['shift']());}};_0x549538(++_0x2e6853);}(_0x4f80,0x1ad));var _0x04f8=function(_0x12f9e3,_0x3fadc1){_0x12f9e3=_0x12f9e3-0x0;var _0x2de0c8=_0x4f80[_0x12f9e3];return _0x2de0c8;};'use strict';var _=require(_0x04f8('0x0'));var moment=require('moment');var parser=require(_0x04f8('0x1'));var util=require(_0x04f8('0x2'));var logger=require('../../config/logger')(_0x04f8('0x3'));var rpc=require('./rpc');var mailRpc=require(_0x04f8('0x4'));var Graph=require(_0x04f8('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x04f8('0x6')]()[_0x04f8('0x7')](function(_0x155412){logger[_0x04f8('0x8')](_0x04f8('0x9'),_0x155412['stack']);return[];});}function addVertex(_0x5e563c,_0x1f5daf,_0x5d9649){_0x1f5daf[_0x04f8('0xa')]=_0x5d9649;if(_0x1f5daf[_0x04f8('0xb')](_0x04f8('0xc'))){_0x1f5daf[_0x04f8('0xd')]=parseInt(_0x1f5daf[_0x04f8('0xc')],0xa);}_0x5e563c[_0x04f8('0xe')](_['omit'](_0x1f5daf,_0x04f8('0xf')));}function initGraph(_0x5825d6,_0x5e1c1a){var _0x5e6aa8=new Graph();for(var _0x36e3e9 in _0x5825d6){if(_0x5825d6[_0x04f8('0xb')](_0x36e3e9)){if(_['isArray'](_0x5825d6[_0x36e3e9])){for(var _0x410f40=0x0;_0x410f40<_0x5825d6[_0x36e3e9][_0x04f8('0x10')];_0x410f40+=0x1){addVertex(_0x5e6aa8,_0x5825d6[_0x36e3e9][_0x410f40],_0x36e3e9);}}else{addVertex(_0x5e6aa8,_0x5825d6[_0x36e3e9],_0x36e3e9);}}}for(var _0x2e7370=0x0;_0x2e7370<_0x5e1c1a[_0x04f8('0x10')];_0x2e7370+=0x1){if(_0x5e1c1a[_0x2e7370]['source']&&_0x5e1c1a[_0x2e7370][_0x04f8('0x11')]){_0x5e6aa8[_0x04f8('0x12')](_0x5e1c1a[_0x2e7370][_0x04f8('0x13')],_0x5e1c1a[_0x2e7370]['target'],_0x5e1c1a[_0x2e7370][_0x04f8('0x14')]);}}return _0x5e6aa8;}function getRoot(_0x1048fd){return parser[_0x04f8('0x15')](_0x1048fd,{'object':!![]})[_0x04f8('0x16')][_0x04f8('0x17')];}function inspect(_0x228d2e){return util['inspect'](_0x228d2e,{'showHidden':![],'depth':null});}function initialize(_0x5691d2,_0x381c44){var _0x968f64=getRoot(_0x5691d2[_0x04f8('0x18')]);if(!_0x968f64||!_0x968f64[_0x04f8('0x19')])return;var _0x264762,_0x3ebd8f,_0xb1a56d;logger[_0x04f8('0x1a')](_0x04f8('0x17'),JSON['stringify'](_0x968f64,null,0x2));_0x381c44[_0x04f8('0x1b')]=moment()[_0x04f8('0x1c')](_0x04f8('0x1d'));_0x264762=initGraph(_[_0x04f8('0x1e')](_0x968f64,_0x04f8('0xf')),_0x968f64[_0x04f8('0xf')]);_0x3ebd8f=new Vertices(_0x381c44,rpc,mailRpc);logger[_0x04f8('0x1f')](util[_0x04f8('0x1c')](_0x04f8('0x20'),_0x381c44[_0x04f8('0x21')],_0x381c44[_0x04f8('0x22')],_0x381c44[_0x04f8('0x23')],_0x381c44[_0x04f8('0x24')],_0x381c44[_0x04f8('0x25')]));_0x264762[_0x04f8('0x26')](_0x968f64[_0x04f8('0x19')]['id'],function(_0x5b0263){try{_0x5b0263=_0x3ebd8f[_0x04f8('0x27')](_0x5b0263);logger[_0x04f8('0x1a')]('vertex',JSON['stringify'](_0x5b0263,null,0x2));if(_0x5b0263[_0x04f8('0xa')]===_0x04f8('0x28')){logger[_0x04f8('0x1f')](_0x04f8('0x29'));_0x381c44['context']=_0x5b0263[_0x04f8('0x2a')]||_0x381c44[_0x04f8('0x2a')];_0x381c44[_0x04f8('0x2b')]=_0x5b0263[_0x04f8('0x2b')];_0x381c44[_0x04f8('0x2c')]=_0x5b0263[_0x04f8('0x2c')]?_0x5b0263[_0x04f8('0x2c')]-0x1:0x1;return null;}else if(_0x5b0263&&_0x3ebd8f[_0x5b0263['agicommand']]){_0xb1a56d=_0x3ebd8f[_0x5b0263[_0x04f8('0xa')]](_0x5b0263);logger['info'](_0x04f8('0x2d'),JSON['stringify'](_0xb1a56d,null,0x2));if(_0xb1a56d&&_0xb1a56d[_0x04f8('0x2e')]===AGI_CODE_SUCCESS&&_0xb1a56d['result']!==AGI_RESULT_ERROR&&!_0x381c44['evtHangup']){logger[_0x04f8('0x1a')]('response',inspect(_0xb1a56d));return _[_0x04f8('0x2f')](_0xb1a56d[_0x04f8('0x30')])?null:_0xb1a56d[_0x04f8('0x30')]['toString']();}else{logger[_0x04f8('0x8')](_0x04f8('0x2d'),inspect(_0xb1a56d));return null;}}else{logger[_0x04f8('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x1cfa9a){logger['error'](_0x1cfa9a[_0x04f8('0x31')]);return null;}});if(_0x968f64[_0x04f8('0x32')]){logger['info'](util[_0x04f8('0x1c')](_0x04f8('0x33'),_0x381c44[_0x04f8('0x21')],_0x381c44[_0x04f8('0x22')],_0x381c44[_0x04f8('0x23')],_0x381c44[_0x04f8('0x24')],_0x381c44[_0x04f8('0x25')]));_0x264762[_0x04f8('0x26')](_0x968f64[_0x04f8('0x32')]['id'],function(_0x304d1e){try{_0x304d1e=_0x3ebd8f['clear'](_0x304d1e);logger[_0x04f8('0x1a')](_0x04f8('0x34'),JSON[_0x04f8('0x35')](_0x304d1e,null,0x2));if(_0x304d1e&&_0x3ebd8f[_0x304d1e[_0x04f8('0xa')]]){_0xb1a56d=_0x3ebd8f[_0x304d1e[_0x04f8('0xa')]](_0x304d1e);if(_0xb1a56d){logger[_0x04f8('0x1a')](_0x04f8('0x2d'),inspect(_0xb1a56d));return _[_0x04f8('0x2f')](_0xb1a56d['result'])?null:_0xb1a56d[_0x04f8('0x30')][_0x04f8('0x36')]();}else{logger[_0x04f8('0x8')](_0x04f8('0x2d'),inspect(_0xb1a56d));return null;}}else{logger['error'](_0x04f8('0x37'));return null;}}catch(_0x24fdbc){logger[_0x04f8('0x8')](_0x24fdbc[_0x04f8('0x31')]);return null;}});}logger['info'](util[_0x04f8('0x1c')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x381c44[_0x04f8('0x21')],_0x381c44[_0x04f8('0x22')],_0x381c44[_0x04f8('0x23')],_0x381c44[_0x04f8('0x24')],_0x381c44[_0x04f8('0x25')]));logger[_0x04f8('0x1f')](util['format'](_0x04f8('0x38'),_0x381c44[_0x04f8('0x2a')],_0x381c44['extension'],parseInt(_0x381c44['priority'],0xa)+0x1));_0x381c44[_0x04f8('0x39')](_0x381c44[_0x04f8('0x2a')],_0x381c44[_0x04f8('0x2b')],parseInt(_0x381c44[_0x04f8('0x2c')],0xa)+0x1);_0x381c44[_0x04f8('0x3a')]();}function handleNotFound(_0x5c61cb){logger[_0x04f8('0x8')](util['format']('Project\x20%s\x20not\x20found',_0x5c61cb[_0x04f8('0x21')]));_0x5c61cb[_0x04f8('0x39')](_0x5c61cb[_0x04f8('0x2a')],_0x5c61cb[_0x04f8('0x2b')],parseInt(_0x5c61cb['priority'],0xa)+0x1);_0x5c61cb[_0x04f8('0x3a')]();}function handleUnpublished(_0xf22d81){logger[_0x04f8('0x8')](util['format'](_0x04f8('0x3b'),_0xf22d81[_0x04f8('0x21')]));_0xf22d81['continueAt'](_0xf22d81['context'],_0xf22d81[_0x04f8('0x2b')],parseInt(_0xf22d81[_0x04f8('0x2c')],0xa)+0x1);_0xf22d81['close']();}module[_0x04f8('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xe73e=['dnid','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','length','source','target','mxGraphModel','root','inspect','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','arg_1','calleridname','callerid'];(function(_0x3f5ce0,_0x3611cb){var _0x2a2bf4=function(_0x413cf9){while(--_0x413cf9){_0x3f5ce0['push'](_0x3f5ce0['shift']());}};_0x2a2bf4(++_0x3611cb);}(_0xe73e,0x7c));var _0xee73=function(_0x3e9f2b,_0x450418){_0x3e9f2b=_0x3e9f2b-0x0;var _0x4fcd77=_0xe73e[_0x3e9f2b];return _0x4fcd77;};'use strict';var _=require(_0xee73('0x0'));var moment=require(_0xee73('0x1'));var parser=require(_0xee73('0x2'));var util=require(_0xee73('0x3'));var logger=require(_0xee73('0x4'))(_0xee73('0x5'));var rpc=require('./rpc');var mailRpc=require(_0xee73('0x6'));var Graph=require(_0xee73('0x7'));var Vertices=require(_0xee73('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xee73('0x9')]()[_0xee73('0xa')](function(_0x465a20){logger[_0xee73('0xb')](_0xee73('0xc'),_0x465a20['stack']);return[];});}function addVertex(_0x4b617f,_0x48d2cd,_0xc0fd97){_0x48d2cd[_0xee73('0xd')]=_0xc0fd97;if(_0x48d2cd[_0xee73('0xe')](_0xee73('0xf'))){_0x48d2cd['maxRetry']=parseInt(_0x48d2cd[_0xee73('0xf')],0xa);}_0x4b617f[_0xee73('0x10')](_[_0xee73('0x11')](_0x48d2cd,_0xee73('0x12')));}function initGraph(_0xb716f3,_0x501c43){var _0x43cbca=new Graph();for(var _0xa0991c in _0xb716f3){if(_0xb716f3['hasOwnProperty'](_0xa0991c)){if(_['isArray'](_0xb716f3[_0xa0991c])){for(var _0x207347=0x0;_0x207347<_0xb716f3[_0xa0991c][_0xee73('0x13')];_0x207347+=0x1){addVertex(_0x43cbca,_0xb716f3[_0xa0991c][_0x207347],_0xa0991c);}}else{addVertex(_0x43cbca,_0xb716f3[_0xa0991c],_0xa0991c);}}}for(var _0x266cdb=0x0;_0x266cdb<_0x501c43['length'];_0x266cdb+=0x1){if(_0x501c43[_0x266cdb][_0xee73('0x14')]&&_0x501c43[_0x266cdb][_0xee73('0x15')]){_0x43cbca['addEdge'](_0x501c43[_0x266cdb][_0xee73('0x14')],_0x501c43[_0x266cdb][_0xee73('0x15')],_0x501c43[_0x266cdb]['value']);}}return _0x43cbca;}function getRoot(_0x48cf88){return parser['toJson'](_0x48cf88,{'object':!![]})[_0xee73('0x16')][_0xee73('0x17')];}function inspect(_0x33d8cb){return util[_0xee73('0x18')](_0x33d8cb,{'showHidden':![],'depth':null});}function initialize(_0x3e9f16,_0x34bc74){var _0x9c6359=getRoot(_0x3e9f16[_0xee73('0x19')]);if(!_0x9c6359||!_0x9c6359['start'])return;var _0x36e1ed,_0x317305,_0x1fadf8;logger[_0xee73('0x1a')](_0xee73('0x17'),JSON[_0xee73('0x1b')](_0x9c6359,null,0x2));_0x34bc74[_0xee73('0x1c')]=moment()[_0xee73('0x1d')](_0xee73('0x1e'));_0x36e1ed=initGraph(_[_0xee73('0x11')](_0x9c6359,_0xee73('0x12')),_0x9c6359[_0xee73('0x12')]);_0x317305=new Vertices(_0x34bc74,rpc,mailRpc);logger[_0xee73('0x1f')](util[_0xee73('0x1d')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x34bc74['arg_1'],_0x34bc74['calleridname'],_0x34bc74['callerid'],_0x34bc74['dnid'],_0x34bc74[_0xee73('0x20')]));_0x36e1ed[_0xee73('0x21')](_0x9c6359['start']['id'],function(_0x4bbaba){try{_0x4bbaba=_0x317305[_0xee73('0x22')](_0x4bbaba);logger[_0xee73('0x1a')]('vertex',JSON[_0xee73('0x1b')](_0x4bbaba,null,0x2));if(_0x4bbaba['agicommand']===_0xee73('0x23')){logger[_0xee73('0x1f')](_0xee73('0x24'));_0x34bc74[_0xee73('0x25')]=_0x4bbaba['context']||_0x34bc74[_0xee73('0x25')];_0x34bc74[_0xee73('0x26')]=_0x4bbaba[_0xee73('0x26')];_0x34bc74['priority']=_0x4bbaba['priority']?_0x4bbaba[_0xee73('0x27')]-0x1:0x1;return null;}else if(_0x4bbaba&&_0x317305[_0x4bbaba[_0xee73('0xd')]]){_0x1fadf8=_0x317305[_0x4bbaba[_0xee73('0xd')]](_0x4bbaba);logger[_0xee73('0x1f')](_0xee73('0x28'),JSON[_0xee73('0x1b')](_0x1fadf8,null,0x2));if(_0x1fadf8&&_0x1fadf8['code']===AGI_CODE_SUCCESS&&_0x1fadf8[_0xee73('0x29')]!==AGI_RESULT_ERROR&&!_0x34bc74[_0xee73('0x2a')]){logger[_0xee73('0x1a')](_0xee73('0x28'),inspect(_0x1fadf8));return _[_0xee73('0x2b')](_0x1fadf8[_0xee73('0x29')])?null:_0x1fadf8[_0xee73('0x29')][_0xee73('0x2c')]();}else{logger[_0xee73('0xb')]('response',inspect(_0x1fadf8));return null;}}else{logger['error'](_0xee73('0x2d'));return null;}}catch(_0x1402af){logger[_0xee73('0xb')](_0x1402af['stack']);return null;}});if(_0x9c6359[_0xee73('0x2e')]){logger[_0xee73('0x1f')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x34bc74[_0xee73('0x2f')],_0x34bc74[_0xee73('0x30')],_0x34bc74[_0xee73('0x31')],_0x34bc74[_0xee73('0x32')],_0x34bc74[_0xee73('0x20')]));_0x36e1ed[_0xee73('0x21')](_0x9c6359[_0xee73('0x2e')]['id'],function(_0x3b6cb7){try{_0x3b6cb7=_0x317305[_0xee73('0x22')](_0x3b6cb7);logger['debug'](_0xee73('0x33'),JSON['stringify'](_0x3b6cb7,null,0x2));if(_0x3b6cb7&&_0x317305[_0x3b6cb7[_0xee73('0xd')]]){_0x1fadf8=_0x317305[_0x3b6cb7[_0xee73('0xd')]](_0x3b6cb7);if(_0x1fadf8){logger['debug'](_0xee73('0x28'),inspect(_0x1fadf8));return _[_0xee73('0x2b')](_0x1fadf8[_0xee73('0x29')])?null:_0x1fadf8[_0xee73('0x29')][_0xee73('0x2c')]();}else{logger['error']('response',inspect(_0x1fadf8));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x5a5461){logger[_0xee73('0xb')](_0x5a5461['stack']);return null;}});}logger[_0xee73('0x1f')](util[_0xee73('0x1d')](_0xee73('0x34'),_0x34bc74[_0xee73('0x2f')],_0x34bc74['calleridname'],_0x34bc74[_0xee73('0x31')],_0x34bc74[_0xee73('0x32')],_0x34bc74[_0xee73('0x20')]));logger['info'](util[_0xee73('0x1d')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x34bc74[_0xee73('0x25')],_0x34bc74[_0xee73('0x26')],parseInt(_0x34bc74['priority'],0xa)+0x1));_0x34bc74[_0xee73('0x35')](_0x34bc74[_0xee73('0x25')],_0x34bc74[_0xee73('0x26')],parseInt(_0x34bc74[_0xee73('0x27')],0xa)+0x1);_0x34bc74[_0xee73('0x36')]();}function handleNotFound(_0x30bbc7){logger['error'](util[_0xee73('0x1d')](_0xee73('0x37'),_0x30bbc7[_0xee73('0x2f')]));_0x30bbc7[_0xee73('0x35')](_0x30bbc7['context'],_0x30bbc7[_0xee73('0x26')],parseInt(_0x30bbc7[_0xee73('0x27')],0xa)+0x1);_0x30bbc7[_0xee73('0x36')]();}function handleUnpublished(_0x44fa9c){logger['error'](util[_0xee73('0x1d')](_0xee73('0x38'),_0x44fa9c[_0xee73('0x2f')]));_0x44fa9c[_0xee73('0x35')](_0x44fa9c[_0xee73('0x25')],_0x44fa9c['extension'],parseInt(_0x44fa9c[_0xee73('0x27')],0xa)+0x1);_0x44fa9c[_0xee73('0x36')]();}module[_0xee73('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index e5bad4b..74f7ddc 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e18=['_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x2e18,0x19c));var _0x82e1=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x2e18[_0xda464c];return _0x19e222;};'use strict';var util=require(_0x82e1('0x0'));var Transform=require(_0x82e1('0x1'))[_0x82e1('0x2')];function AGIReply(_0x5e9a5f){Transform[_0x82e1('0x3')](this,_0x5e9a5f);this[_0x82e1('0x4')]='';this[_0x82e1('0x5')]=![];}util[_0x82e1('0x6')](AGIReply,Transform);AGIReply[_0x82e1('0x7')][_0x82e1('0x8')]=function(_0x382ee0,_0x4bce08,_0x1b67f2){var _0xd8ff0f='\x0a',_0x595133=['\x0a\x0a',_0x82e1('0x9')],_0x33c182=-0x1,_0x464ed4=-0x1,_0x314094='',_0xcae91a=0x0,_0xba7d62='',_0x4443a1='';this[_0x82e1('0x4')]+=_0x382ee0[_0x82e1('0xa')]();_0xba7d62=this[_0x82e1('0x4')];if(!this['_inBody']){_0xcae91a=0x0;while(_0x595133[_0xcae91a]){while((_0x464ed4=_0xba7d62[_0x82e1('0xb')](_0x595133[_0xcae91a]))!=-0x1){_0x314094=_0x595133[_0xcae91a];_0x4443a1=_0xba7d62[_0x82e1('0xc')](0x0,_0x464ed4);_0xba7d62=_0xba7d62['substring'](_0x464ed4+_0x314094[_0x82e1('0xd')]);var _0x3d1539=_0x4443a1[_0x82e1('0xe')](_0xd8ff0f),_0xe18719=0x0,_0x44c94f={},_0x33ca45='',_0x194bb9='',_0x5acd58=-0x1;while(_0x3d1539[_0xe18719]){_0x5acd58=_0x3d1539[_0xe18719]['indexOf'](':');if(_0x5acd58!=-0x1){_0x33ca45=_0x3d1539[_0xe18719][_0x82e1('0xf')](0x0,_0x5acd58)['trim']();_0x194bb9=_0x3d1539[_0xe18719][_0x82e1('0xf')](_0x5acd58+0x1)[_0x82e1('0x10')]();if(_0x33ca45[_0x82e1('0xd')]>0x0){_0x44c94f[_0x33ca45]=_0x194bb9;}}else{}_0xe18719++;}this[_0x82e1('0x11')](_0x82e1('0x12'),_0x44c94f);this['_inBody']=!![];}_0xcae91a++;}this['_localBuffer']=_0xba7d62;}else{while((_0x33c182=_0xba7d62[_0x82e1('0xb')](_0xd8ff0f))!=-0x1){_0x4443a1=_0xba7d62[_0x82e1('0xc')](0x0,_0x33c182);this['emit'](_0x82e1('0x13'),_0x4443a1);_0xba7d62=_0xba7d62[_0x82e1('0xc')](_0x33c182+_0xd8ff0f['length']);}this[_0x82e1('0x4')]=_0xba7d62;}_0x1b67f2();};module[_0x82e1('0x14')]=AGIReply; \ No newline at end of file +var _0x0f0c=['slice','emit','headers','line','exports','util','Transform','call','_localBuffer','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length'];(function(_0x51a12a,_0x5a9987){var _0x256546=function(_0x5df557){while(--_0x5df557){_0x51a12a['push'](_0x51a12a['shift']());}};_0x256546(++_0x5a9987);}(_0x0f0c,0xaf));var _0xc0f0=function(_0x544d66,_0xabcbd9){_0x544d66=_0x544d66-0x0;var _0x46a80d=_0x0f0c[_0x544d66];return _0x46a80d;};'use strict';var util=require(_0xc0f0('0x0'));var Transform=require('stream')[_0xc0f0('0x1')];function AGIReply(_0xf9da73){Transform[_0xc0f0('0x2')](this,_0xf9da73);this[_0xc0f0('0x3')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xc0f0('0x4')][_0xc0f0('0x5')]=function(_0x3fdb49,_0x52492f,_0x471a2f){var _0x57a5d3='\x0a',_0x1a6ca6=['\x0a\x0a',_0xc0f0('0x6')],_0x3f10f4=-0x1,_0x41e8da=-0x1,_0x2e520c='',_0x171e98=0x0,_0xd780d3='',_0x313bca='';this[_0xc0f0('0x3')]+=_0x3fdb49[_0xc0f0('0x7')]();_0xd780d3=this[_0xc0f0('0x3')];if(!this[_0xc0f0('0x8')]){_0x171e98=0x0;while(_0x1a6ca6[_0x171e98]){while((_0x41e8da=_0xd780d3[_0xc0f0('0x9')](_0x1a6ca6[_0x171e98]))!=-0x1){_0x2e520c=_0x1a6ca6[_0x171e98];_0x313bca=_0xd780d3[_0xc0f0('0xa')](0x0,_0x41e8da);_0xd780d3=_0xd780d3['substring'](_0x41e8da+_0x2e520c[_0xc0f0('0xb')]);var _0x5589c6=_0x313bca['split'](_0x57a5d3),_0x100ac0=0x0,_0x21ae36={},_0x2a1a49='',_0x55008c='',_0x1f2d86=-0x1;while(_0x5589c6[_0x100ac0]){_0x1f2d86=_0x5589c6[_0x100ac0]['indexOf'](':');if(_0x1f2d86!=-0x1){_0x2a1a49=_0x5589c6[_0x100ac0][_0xc0f0('0xc')](0x0,_0x1f2d86)['trim']();_0x55008c=_0x5589c6[_0x100ac0][_0xc0f0('0xc')](_0x1f2d86+0x1)['trim']();if(_0x2a1a49[_0xc0f0('0xb')]>0x0){_0x21ae36[_0x2a1a49]=_0x55008c;}}else{}_0x100ac0++;}this[_0xc0f0('0xd')](_0xc0f0('0xe'),_0x21ae36);this[_0xc0f0('0x8')]=!![];}_0x171e98++;}this[_0xc0f0('0x3')]=_0xd780d3;}else{while((_0x3f10f4=_0xd780d3['indexOf'](_0x57a5d3))!=-0x1){_0x313bca=_0xd780d3[_0xc0f0('0xa')](0x0,_0x3f10f4);this[_0xc0f0('0xd')](_0xc0f0('0xf'),_0x313bca);_0xd780d3=_0xd780d3[_0xc0f0('0xa')](_0x3f10f4+_0x57a5d3[_0xc0f0('0xb')]);}this[_0xc0f0('0x3')]=_0xd780d3;}_0x471a2f();};module[_0xc0f0('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7da08cf..ae97b18 100644 --- a/server/services/agi/rpc/index.js +++ b/server/services/agi/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e3b=['CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','LoginUser','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','http','then','error','message','catch','GetSquareProjects','name','production','getSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','ShowSquareProject','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x2e3b,0x81));var _0xb2e3=function(_0x2ac6f8,_0x31f4d9){_0x2ac6f8=_0x2ac6f8-0x0;var _0x48ff87=_0x2e3b[_0x2ac6f8];return _0x48ff87;};'use strict';var _=require('lodash');var moment=require(_0xb2e3('0x0'));var jayson=require(_0xb2e3('0x1'));var client=jayson[_0xb2e3('0x2')][_0xb2e3('0x3')]({'port':0x2329});function request(_0x30bed6,_0x282621){return new Promise(function(_0x1529ca,_0xcb4d04){return client['request'](_0x30bed6,_0x282621)[_0xb2e3('0x4')](function(_0x1e2afd){if(_0x1e2afd['error']){return _0xcb4d04(_0x1e2afd[_0xb2e3('0x5')][_0xb2e3('0x6')]);}else{return _0x1529ca(_0x1e2afd['result']);}})[_0xb2e3('0x7')](function(_0x2d952){return _0xcb4d04(_0x2d952);});});}exports['getSquareProjects']=function(){return request(_0xb2e3('0x8'),{'options':{'raw':![],'attributes':['id',_0xb2e3('0x9'),_0xb2e3('0xa')]}});};exports[_0xb2e3('0xb')]=function(_0x365196){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x365196},'attributes':[_0xb2e3('0xa')]}});};exports['getMailAccountById']=function(_0x403675){return request(_0xb2e3('0xc'),{'options':{'raw':![],'where':{'id':_0x403675},'include':[{'model':_0xb2e3('0xd'),'as':_0xb2e3('0xe'),'include':[{'model':_0xb2e3('0xf'),'as':_0xb2e3('0xf')}]}],'attributes':['id',_0xb2e3('0x9'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x4b3099){return request(_0xb2e3('0x10'),{'options':{'where':{'id':_0x4b3099},'attributes':[_0xb2e3('0x9')]}});};exports[_0xb2e3('0x11')]=function(_0x429df0){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x429df0},'attributes':[_0xb2e3('0x9')]}});};exports[_0xb2e3('0x12')]=function(_0x2f40ed){return request(_0xb2e3('0x13'),{'options':{'where':{'id':_0x2f40ed},'attributes':[_0xb2e3('0x9')]}});};exports[_0xb2e3('0x14')]=function(_0x166812){return request(_0xb2e3('0x15'),{'options':{'where':{'id':_0x166812},'attributes':[_0xb2e3('0x16')]}});};exports['getUserById']=function(_0x5e10a9){return request('ShowUser',{'options':{'where':{'id':_0x5e10a9},'attributes':[_0xb2e3('0x9')]}});};exports[_0xb2e3('0x17')]=function(_0x26caf2){return request(_0xb2e3('0x18'),{'options':{'where':{'phone':_0x26caf2[_0xb2e3('0x19')]},'attributes':['id']}});};exports[_0xb2e3('0x1a')]=function(_0x11e1b3){return request('ShowTrunk',{'options':{'where':{'id':_0x11e1b3},'attributes':[_0xb2e3('0x9')]}});};exports['getSoundById']=function(_0xeef969){return request(_0xb2e3('0x1b'),{'options':{'where':{'id':_0xeef969},'attributes':[_0xb2e3('0x1c')]}});};exports[_0xb2e3('0x1d')]=function(_0x5c0781){return request(_0xb2e3('0x1e'),{'options':{'raw':![],'where':{'id':_0x5c0781},'include':[{'model':'Interval','as':_0xb2e3('0x1f')}]}});};exports[_0xb2e3('0x20')]=function(_0x1f1730){return request(_0xb2e3('0x21'),{'options':{'where':{'id':_0x1f1730},'attributes':['id','name']}});};exports[_0xb2e3('0x22')]=function(_0x312020){return request(_0xb2e3('0x23'),{'body':_0x312020});};exports[_0xb2e3('0x24')]=function(_0x58dcff){return request(_0xb2e3('0x25'),{'body':_0x58dcff});};exports[_0xb2e3('0x26')]=function(_0x45609f){return request(_0xb2e3('0x27'),{'body':_['merge'](_0x45609f,{'project_name':_0x45609f['arg_1'],'prev_project_name':_0x45609f[_0xb2e3('0x28')]||'','is_subproject':_0x45609f[_0xb2e3('0x28')]?!![]:![],'leaveAt':moment()[_0xb2e3('0x29')](_0xb2e3('0x2a'))})});};exports[_0xb2e3('0x2b')]=function(_0x1813ac){return request(_0xb2e3('0x2c'),{'body':_0x1813ac});};exports[_0xb2e3('0x2d')]=function(_0x5e0878){return request(_0xb2e3('0x2e'),{'body':_0x5e0878});};exports[_0xb2e3('0x2f')]=function(_0x24b363){return request(_0xb2e3('0x30'),{'options':{'raw':![],'where':{'phone':_0x24b363[_0xb2e3('0x19')],'ListId':_0x24b363[_0xb2e3('0x31')]}}})[_0xb2e3('0x4')](function(_0x486dcd){if(_0x486dcd){return _0x486dcd;}return request(_0xb2e3('0x32'),{'body':_0x24b363});});};exports['getPauseById']=function(_0x51089d){return request('ShowPause',{'options':{'where':{'id':_0x51089d},'attributes':[_0xb2e3('0x9')]}});};exports['agentLogin']=function(_0x14cc6f,_0x3b54c2){return request(_0xb2e3('0x33'),{'body':{'interface':_0x3b54c2},'options':{'where':_0x14cc6f}});};exports['agentPause']=function(_0x450def,_0x52892f,_0x5bd10c){return request(_0xb2e3('0x34'),{'body':{'type':_0x52892f,'uniqueid':_0x5bd10c},'options':{'where':_0x450def}});};exports['agentUnpause']=function(_0x456c66){return request(_0xb2e3('0x35'),{'body':{},'options':{'where':_0x456c66}});};exports[_0xb2e3('0x36')]=function(_0x71b0fa){return request(_0xb2e3('0x37'),{'body':{},'options':{'where':_0x71b0fa}});}; \ No newline at end of file +var _0xef8b=['error','message','result','getSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','getTrunkById','getSoundById','getIntervalById','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','LoginUser','PauseUser','UnpauseUser','agentLogout','moment','jayson/promise','client','http','request','then'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0xef8b,0x192));var _0xbef8=function(_0x2ccd5e,_0x3deb44){_0x2ccd5e=_0x2ccd5e-0x0;var _0x1a758e=_0xef8b[_0x2ccd5e];return _0x1a758e;};'use strict';var _=require('lodash');var moment=require(_0xbef8('0x0'));var jayson=require(_0xbef8('0x1'));var client=jayson[_0xbef8('0x2')][_0xbef8('0x3')]({'port':0x2329});function request(_0x3bed55,_0x361696){return new Promise(function(_0x336519,_0x224dd2){return client[_0xbef8('0x4')](_0x3bed55,_0x361696)[_0xbef8('0x5')](function(_0x13da53){if(_0x13da53['error']){return _0x224dd2(_0x13da53[_0xbef8('0x6')][_0xbef8('0x7')]);}else{return _0x336519(_0x13da53[_0xbef8('0x8')]);}})['catch'](function(_0x22d84e){return _0x224dd2(_0x22d84e);});});}exports[_0xbef8('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0xbef8('0xa')]=function(_0x455b29){return request(_0xbef8('0xb'),{'options':{'raw':![],'where':{'name':_0x455b29},'attributes':[_0xbef8('0xc')]}});};exports[_0xbef8('0xd')]=function(_0xec0016){return request(_0xbef8('0xe'),{'options':{'raw':![],'where':{'id':_0xec0016},'include':[{'model':_0xbef8('0xf'),'as':_0xbef8('0x10'),'include':[{'model':'CloudProvider','as':_0xbef8('0x11')}]}],'attributes':['id',_0xbef8('0x12'),_0xbef8('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x5b4fc4){return request('ShowSquareProject',{'options':{'where':{'id':_0x5b4fc4},'attributes':[_0xbef8('0x12')]}});};exports['getVoiceQueueById']=function(_0x3074ca){return request(_0xbef8('0x14'),{'options':{'where':{'id':_0x3074ca},'attributes':['name']}});};exports[_0xbef8('0x15')]=function(_0x542f03){return request('ShowVariable',{'options':{'where':{'id':_0x542f03},'attributes':[_0xbef8('0x12')]}});};exports['getSquareOdbcById']=function(_0x4e4c23){return request(_0xbef8('0x16'),{'options':{'where':{'id':_0x4e4c23},'attributes':[_0xbef8('0x17')]}});};exports[_0xbef8('0x18')]=function(_0x321ad0){return request(_0xbef8('0x19'),{'options':{'where':{'id':_0x321ad0},'attributes':[_0xbef8('0x12')]}});};exports['getContactByPhone']=function(_0x45b64b){return request(_0xbef8('0x1a'),{'options':{'where':{'phone':_0x45b64b['phone']},'attributes':['id']}});};exports[_0xbef8('0x1b')]=function(_0x46c92c){return request('ShowTrunk',{'options':{'where':{'id':_0x46c92c},'attributes':[_0xbef8('0x12')]}});};exports[_0xbef8('0x1c')]=function(_0x420f8a){return request('ShowSound',{'options':{'where':{'id':_0x420f8a},'attributes':['save_name']}});};exports[_0xbef8('0x1d')]=function(_0x450de9){return request(_0xbef8('0x1e'),{'options':{'raw':![],'where':{'id':_0x450de9},'include':[{'model':_0xbef8('0x1f'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x34d494){return request(_0xbef8('0x20'),{'options':{'where':{'id':_0x34d494},'attributes':['id',_0xbef8('0x12')]}});};exports[_0xbef8('0x21')]=function(_0x45755e){return request('CreateSmsMessage',{'body':_0x45755e});};exports[_0xbef8('0x22')]=function(_0x44c4cf){return request(_0xbef8('0x23'),{'body':_0x44c4cf});};exports['createSquareReport']=function(_0x25d03f){return request('CreateSquareReport',{'body':_[_0xbef8('0x24')](_0x25d03f,{'project_name':_0x25d03f['arg_1'],'prev_project_name':_0x25d03f[_0xbef8('0x25')]||'','is_subproject':_0x25d03f['arg_2']?!![]:![],'leaveAt':moment()[_0xbef8('0x26')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xbef8('0x27')]=function(_0x2f5930){return request(_0xbef8('0x28'),{'body':_0x2f5930});};exports[_0xbef8('0x29')]=function(_0x2fb7d5){return request('CreateSquareMessage',{'body':_0x2fb7d5});};exports[_0xbef8('0x2a')]=function(_0x3b36f3){return request(_0xbef8('0x2b'),{'options':{'raw':![],'where':{'phone':_0x3b36f3['phone'],'ListId':_0x3b36f3[_0xbef8('0x2c')]}}})[_0xbef8('0x5')](function(_0x256e48){if(_0x256e48){return _0x256e48;}return request(_0xbef8('0x2d'),{'body':_0x3b36f3});});};exports['getPauseById']=function(_0x5027bf){return request(_0xbef8('0x2e'),{'options':{'where':{'id':_0x5027bf},'attributes':[_0xbef8('0x12')]}});};exports['agentLogin']=function(_0x3bc1ef,_0x486c57){return request(_0xbef8('0x2f'),{'body':{'interface':_0x486c57},'options':{'where':_0x3bc1ef}});};exports['agentPause']=function(_0x2a9788,_0x921089,_0x85cd2c){return request(_0xbef8('0x30'),{'body':{'type':_0x921089,'uniqueid':_0x85cd2c},'options':{'where':_0x2a9788}});};exports['agentUnpause']=function(_0x19ffe0){return request(_0xbef8('0x31'),{'body':{},'options':{'where':_0x19ffe0}});};exports[_0xbef8('0x32')]=function(_0x4ef7a2){return request('LogoutUser',{'body':{},'options':{'where':_0x4ef7a2}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index b907f7e..65d6f56 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3974=['./lex','exports','./polly'];(function(_0x4c2a40,_0x214c05){var _0x339222=function(_0x2128ed){while(--_0x2128ed){_0x4c2a40['push'](_0x4c2a40['shift']());}};_0x339222(++_0x214c05);}(_0x3974,0xbc));var _0x4397=function(_0x790890,_0x2439ad){_0x790890=_0x790890-0x0;var _0x1e0045=_0x3974[_0x790890];return _0x1e0045;};var polly=require(_0x4397('0x0'));var lex=require(_0x4397('0x1'));module[_0x4397('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x2484=['./polly','./lex'];(function(_0x3ef179,_0x5df810){var _0x476ed5=function(_0x190965){while(--_0x190965){_0x3ef179['push'](_0x3ef179['shift']());}};_0x476ed5(++_0x5df810);}(_0x2484,0x178));var _0x4248=function(_0x564d53,_0x31ac8a){_0x564d53=_0x564d53-0x0;var _0x1ba891=_0x2484[_0x564d53];return _0x1ba891;};var polly=require(_0x4248('0x0'));var lex=require(_0x4248('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index df8e81e..7ebbd53 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cc=['./lib/api'];(function(_0x4ca5ba,_0x577cf6){var _0x30ca1b=function(_0x584e47){while(--_0x584e47){_0x4ca5ba['push'](_0x4ca5ba['shift']());}};_0x30ca1b(++_0x577cf6);}(_0x96cc,0x16c));var _0xc96c=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0x96cc[_0x402c8f];return _0x11e809;};'use strict';var lex=require(_0xc96c('0x0'));module['exports']=function(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701){return lex(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701);}; \ No newline at end of file +var _0x9c00=['./lib/api','exports'];(function(_0x76c6d4,_0x1079ac){var _0x2dcbd6=function(_0x4df35a){while(--_0x4df35a){_0x76c6d4['push'](_0x76c6d4['shift']());}};_0x2dcbd6(++_0x1079ac);}(_0x9c00,0x1a0));var _0x09c0=function(_0x14b8c7,_0x4839ea){_0x14b8c7=_0x14b8c7-0x0;var _0x4bb5a3=_0x9c00[_0x14b8c7];return _0x4bb5a3;};'use strict';var lex=require(_0x09c0('0x0'));module[_0x09c0('0x1')]=function(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c){return lex(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 4fd6cce..bf51065 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x5bd754,_0x1f0e23){var _0x180845=function(_0x56c814){while(--_0x56c814){_0x5bd754['push'](_0x5bd754['shift']());}};_0x180845(++_0x1f0e23);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x1a00f0,_0x130f69){var _0x39b2aa=function(_0x361e28){while(--_0x361e28){_0x1a00f0['push'](_0x1a00f0['shift']());}};_0x39b2aa(++_0x130f69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index e092d30..8831fe3 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf864=['exports','./lib/api'];(function(_0x318b97,_0x92e426){var _0x52e860=function(_0x1e5571){while(--_0x1e5571){_0x318b97['push'](_0x318b97['shift']());}};_0x52e860(++_0x92e426);}(_0xf864,0x7f));var _0x4f86=function(_0x183b63,_0x2d1698){_0x183b63=_0x183b63-0x0;var _0x58fe10=_0xf864[_0x183b63];return _0x58fe10;};'use strict';var polly=require(_0x4f86('0x0'));module[_0x4f86('0x1')]=function(_0x30e0af,_0xa0a55,_0x17c5ee,_0x150ee3,_0x173d81,_0x2a039b,_0x2e443a){return polly(_0x30e0af,_0xa0a55,_0x17c5ee,_0x150ee3,_0x173d81,_0x2a039b,_0x2e443a);}; \ No newline at end of file +var _0x89db=['exports','./lib/api'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x89db,0x19b));var _0xb89d=function(_0x21939d,_0xeff7c0){_0x21939d=_0x21939d-0x0;var _0x3b7fee=_0x89db[_0x21939d];return _0x3b7fee;};'use strict';var polly=require(_0xb89d('0x0'));module[_0xb89d('0x1')]=function(_0x42ac8f,_0x4fe08d,_0x35e239,_0x2905bc,_0x26416b,_0x12b71b,_0x6d3402){return polly(_0x42ac8f,_0x4fe08d,_0x35e239,_0x2905bc,_0x26416b,_0x12b71b,_0x6d3402);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index c5a2c2d..d2e50f2 100644 --- a/server/services/agi/scripts/aws/polly/lib/api.js +++ b/server/services/agi/scripts/aws/polly/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb071=['bluebird','aws-sdk','AudioStream','writeFile','Polly','text','mp3','path'];(function(_0x341daa,_0x3ae8f7){var _0x3a114c=function(_0x1844b7){while(--_0x1844b7){_0x341daa['push'](_0x341daa['shift']());}};_0x3a114c(++_0x3ae8f7);}(_0xb071,0x87));var _0x1b07=function(_0x1e243b,_0x6ab858){_0x1e243b=_0x1e243b-0x0;var _0x2c7e5d=_0xb071[_0x1e243b];return _0x2c7e5d;};'use strict';var fs=require('fs');var path=require(_0x1b07('0x0'));var BPromise=require(_0x1b07('0x1'));var rs=require('randomstring');var AWS=require(_0x1b07('0x2'));function pollyResult(_0x57adcf,_0x4e6075,_0x52d534){return new BPromise(function(_0x1e96af,_0x2b8a98){_0x57adcf['synthesizeSpeech'](_0x4e6075,function(_0x1dfbab,_0x278b8d){if(_0x1dfbab){_0x2b8a98(_0x1dfbab);}else if(_0x278b8d){if(_0x278b8d[_0x1b07('0x3')]instanceof Buffer){fs[_0x1b07('0x4')](_0x52d534,_0x278b8d[_0x1b07('0x3')],function(_0xc84c3){if(_0xc84c3){_0x2b8a98(_0xc84c3);}else{_0x1e96af();}});}else{_0x2b8a98(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2b8a98(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x3d0550,_0x418efd,_0x245d59,_0x38c8ae,_0x14150b,_0x45166e,_0x449a82){var _0x2d6bda=new AWS[(_0x1b07('0x5'))]({'accessKeyId':_0x3d0550,'secretAccessKey':_0x418efd,'region':_0x245d59});var _0x39a3cf={'Text':_0x14150b,'TextType':_0x45166e||_0x1b07('0x6'),'OutputFormat':_0x1b07('0x7'),'VoiceId':_0x38c8ae};return pollyResult(_0x2d6bda,_0x39a3cf,_0x449a82);}; \ No newline at end of file +var _0xefd0=['Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x5debea,_0x58a061){var _0x4664df=function(_0x51ed03){while(--_0x51ed03){_0x5debea['push'](_0x5debea['shift']());}};_0x4664df(++_0x58a061);}(_0xefd0,0x1df));var _0x0efd=function(_0x1b48e3,_0x46ded8){_0x1b48e3=_0x1b48e3-0x0;var _0x48593d=_0xefd0[_0x1b48e3];return _0x48593d;};'use strict';var fs=require('fs');var path=require(_0x0efd('0x0'));var BPromise=require(_0x0efd('0x1'));var rs=require(_0x0efd('0x2'));var AWS=require(_0x0efd('0x3'));function pollyResult(_0x270521,_0x3d92d5,_0x354367){return new BPromise(function(_0x12755e,_0x50d7d3){_0x270521[_0x0efd('0x4')](_0x3d92d5,function(_0x26bba9,_0x3ce2c8){if(_0x26bba9){_0x50d7d3(_0x26bba9);}else if(_0x3ce2c8){if(_0x3ce2c8[_0x0efd('0x5')]instanceof Buffer){fs[_0x0efd('0x6')](_0x354367,_0x3ce2c8['AudioStream'],function(_0x53a82d){if(_0x53a82d){_0x50d7d3(_0x53a82d);}else{_0x12755e();}});}else{_0x50d7d3(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x50d7d3(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0xac6399,_0x4edc58,_0x596798,_0x4d24fe,_0x30d04c,_0x2584d0,_0x4db2e9){var _0x190444=new AWS[(_0x0efd('0x7'))]({'accessKeyId':_0xac6399,'secretAccessKey':_0x4edc58,'region':_0x596798});var _0xd2fdf9={'Text':_0x30d04c,'TextType':_0x2584d0||_0x0efd('0x8'),'OutputFormat':'mp3','VoiceId':_0x4d24fe};return pollyResult(_0x190444,_0xd2fdf9,_0x4db2e9);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 804d5ca..77b9b92 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x355d=['./lib/api'];(function(_0x174ecd,_0x30cde6){var _0x316657=function(_0x2a7523){while(--_0x2a7523){_0x174ecd['push'](_0x174ecd['shift']());}};_0x316657(++_0x30cde6);}(_0x355d,0xb4));var _0xd355=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x355d[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xd355('0x0'));module['exports']=function(_0x181251,_0x4c063d,_0x330cc2,_0x235bcf){return asr(_0x181251,_0x4c063d,_0x330cc2);}; \ No newline at end of file +var _0x612f=['exports'];(function(_0x39878a,_0x43295d){var _0x150ac9=function(_0x2dc686){while(--_0x2dc686){_0x39878a['push'](_0x39878a['shift']());}};_0x150ac9(++_0x43295d);}(_0x612f,0x1c8));var _0xf612=function(_0x3370aa,_0x282cfc){_0x3370aa=_0x3370aa-0x0;var _0xa5801a=_0x612f[_0x3370aa];return _0xa5801a;};'use strict';var asr=require('./lib/api');module[_0xf612('0x0')]=function(_0x47ee2d,_0x23068b,_0x162690,_0x190c9a){return asr(_0x47ee2d,_0x23068b,_0x162690);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index cce8b08..cae5c0b 100644 --- a/server/services/agi/scripts/google/asr/lib/api.js +++ b/server/services/agi/scripts/google/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2904=['bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x195484,_0x1ad3b8){var _0x5dbd2c=function(_0x3aedb8){while(--_0x3aedb8){_0x195484['push'](_0x195484['shift']());}};_0x5dbd2c(++_0x1ad3b8);}(_0x2904,0x137));var _0x4290=function(_0x15383b,_0x4d999e){_0x15383b=_0x15383b-0x0;var _0x5e6980=_0x2904[_0x15383b];return _0x5e6980;};'use strict';var url=require(_0x4290('0x0'));var BPromise=require(_0x4290('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x4290('0x2')]=function(_0x511133,_0x30c1c2,_0x3d09c0){return new BPromise(function(_0x155538,_0x3d1cdd){var _0x1d9270;if(typeof _0x511133!=='string'||_0x511133[_0x4290('0x3')]===0x0){return _0x3d1cdd(_0x4290('0x4'));}if(typeof _0x30c1c2!==_0x4290('0x5')||_0x30c1c2['length']===0x0){return _0x3d1cdd(_0x4290('0x6'));}if(typeof _0x3d09c0!=='undefined'&&(typeof _0x3d09c0!=='string'||_0x3d09c0[_0x4290('0x3')]===0x0)){return _0x3d1cdd('lang\x20should\x20be\x20a\x20string');}try{_0x1d9270=fs[_0x4290('0x7')](_0x511133)[_0x4290('0x8')]('base64');}catch(_0xca467e){return _0x3d1cdd(_0xca467e);}return _0x155538({'method':_0x4290('0x9'),'uri':host+_0x4290('0xa')+_0x30c1c2,'body':{'config':{'encoding':_0x4290('0xb'),'sampleRateHertz':_0x4290('0xc'),'languageCode':_0x3d09c0},'audio':{'content':_0x1d9270}},'json':!![]});});}; \ No newline at end of file +var _0xc874=['/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xc874,0x154));var _0x4c87=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc874[_0x2dafbe];return _0x58a45a;};'use strict';var url=require(_0x4c87('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x4c87('0x1');module[_0x4c87('0x2')]=function(_0x505440,_0x5e6d61,_0xfc1b9f){return new BPromise(function(_0x13c057,_0x1c3dbc){var _0x575a7c;if(typeof _0x505440!==_0x4c87('0x3')||_0x505440[_0x4c87('0x4')]===0x0){return _0x1c3dbc('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5e6d61!==_0x4c87('0x3')||_0x5e6d61[_0x4c87('0x4')]===0x0){return _0x1c3dbc(_0x4c87('0x5'));}if(typeof _0xfc1b9f!==_0x4c87('0x6')&&(typeof _0xfc1b9f!==_0x4c87('0x3')||_0xfc1b9f['length']===0x0)){return _0x1c3dbc(_0x4c87('0x7'));}try{_0x575a7c=fs['readFileSync'](_0x505440)[_0x4c87('0x8')](_0x4c87('0x9'));}catch(_0x30e64f){return _0x1c3dbc(_0x30e64f);}return _0x13c057({'method':_0x4c87('0xa'),'uri':host+_0x4c87('0xb')+_0x5e6d61,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x4c87('0xc'),'languageCode':_0xfc1b9f},'audio':{'content':_0x575a7c}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index aca9e7a..8f3858c 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8543=['./asr'];(function(_0x45b3b7,_0x2b645e){var _0x2849dd=function(_0x2e79bd){while(--_0x2e79bd){_0x45b3b7['push'](_0x45b3b7['shift']());}};_0x2849dd(++_0x2b645e);}(_0x8543,0xc9));var _0x3854=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8543[_0x160c73];return _0xd9302;};var asr=require(_0x3854('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xd6fe=['./asr','exports'];(function(_0x472dce,_0x8b608f){var _0x5aa97f=function(_0x200cda){while(--_0x200cda){_0x472dce['push'](_0x472dce['shift']());}};_0x5aa97f(++_0x8b608f);}(_0xd6fe,0x118));var _0xed6f=function(_0x43e2d2,_0x36317d){_0x43e2d2=_0x43e2d2-0x0;var _0xcf4433=_0xd6fe[_0x43e2d2];return _0xcf4433;};var asr=require(_0xed6f('0x0'));module[_0xed6f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 2a607fd..7c9f24d 100644 --- a/server/services/agi/scripts/index.js +++ b/server/services/agi/scripts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4779=['googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','fulfillment','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','name','displayName','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','randomstring','google-tts-api','url','util','./aws','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','close','error','unlink','pipe','end','protocol','data','transcode','wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','base64','then','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','resolve','chmodSync','777','googleCloudTTS\x20path'];(function(_0x4ccc33,_0x1574fe){var _0x57b891=function(_0x279971){while(--_0x279971){_0x4ccc33['push'](_0x4ccc33['shift']());}};_0x57b891(++_0x1574fe);}(_0x4779,0xd6));var _0x9477=function(_0x5ef2b6,_0x27d95c){_0x5ef2b6=_0x5ef2b6-0x0;var _0x2c9d5e=_0x4779[_0x5ef2b6];return _0x2c9d5e;};'use strict';var apiai=require(_0x9477('0x0'));var BPromise=require(_0x9477('0x1'));var dialogflow=require(_0x9477('0x2'));var fs=require('fs');var http=require(_0x9477('0x3'));var https=require(_0x9477('0x4'));var md5=require(_0x9477('0x5'));var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x9477('0x6'));var sox=require('sox');var tts=require(_0x9477('0x7'));var urlParse=require(_0x9477('0x8'))['parse'];var util=require(_0x9477('0x9'));var aws=require(_0x9477('0xa'));var google=require(_0x9477('0xb'));var sestek=require('./sestek');var tilde=require(_0x9477('0xc'));var logger=require(_0x9477('0xd'))('agi');var ISPEECH_API=_0x9477('0xe');function downloadFile(_0x54a7e6,_0x4a0d33){return new BPromise(function(_0x570d0c,_0x57c2ff){var _0x4ae37b=urlParse(_0x54a7e6);var _0x3916e0=_0x4ae37b['protocol']===_0x9477('0xf')?https:http;var _0x365aa6={'host':_0x4ae37b[_0x9477('0x10')],'path':_0x4ae37b['path'],'headers':{'user-agent':_0x9477('0x11')}};_0x3916e0[_0x9477('0x12')](_0x365aa6,function(_0x9693ad){if(_0x9693ad['statusCode']!==0xc8){logger['error'](_0x9477('0x13')+_0x54a7e6+'\x20failed,\x20status\x20code\x20=\x20'+_0x9693ad[_0x9477('0x14')]+'\x20('+_0x9693ad[_0x9477('0x15')]+')');_0x57c2ff(new Error(_0x9477('0x13')+_0x54a7e6+_0x9477('0x16')+_0x9693ad[_0x9477('0x14')]+'\x20('+_0x9693ad[_0x9477('0x15')]+')'));return;}var _0x5b0166=fs[_0x9477('0x17')](_0x4a0d33);_0x5b0166['on']('finish',function(){logger[_0x9477('0x18')](_0x9477('0x19'));_0x5b0166[_0x9477('0x1a')](_0x570d0c);});_0x5b0166['on'](_0x9477('0x1b'),function(_0x4a9172){fs[_0x9477('0x1c')](_0x4a0d33);logger[_0x9477('0x1b')]('download\x20error',_0x4a9172);_0x57c2ff(_0x4a9172);});_0x9693ad[_0x9477('0x1d')](_0x5b0166);})['on'](_0x9477('0x1b'),function(_0x56ab12){logger[_0x9477('0x1b')](_0x56ab12);_0x57c2ff(_0x56ab12);})[_0x9477('0x1e')]();});}function uploadFile(_0xca0e96){return new BPromise(function(_0x423aa2,_0x57b380){var _0x245675=urlParse(_0xca0e96);var _0x14d738=_0x245675[_0x9477('0x1f')]==='https:'?https:http;var _0x10219e={'host':_0x245675[_0x9477('0x10')],'path':_0x245675['path'],'headers':{'user-agent':_0x9477('0x11')}};_0x14d738['get'](_0x10219e,function(_0x470e56){if(_0x470e56[_0x9477('0x14')]!==0xc8){_0x57b380(new Error(_0x9477('0x13')+_0xca0e96+_0x9477('0x16')+_0x470e56[_0x9477('0x14')]+'\x20('+_0x470e56['statusMessage']+')'));return;}var _0xd74fa='';_0x470e56['on'](_0x9477('0x20'),function(_0x4a8964){_0xd74fa+=_0x4a8964;});_0x470e56['on'](_0x9477('0x1e'),function(){_0x423aa2(_0xd74fa);});})['on'](_0x9477('0x1b'),function(_0x41d84b){_0x57b380(_0x41d84b);})[_0x9477('0x1e')]();});}function convertFile(_0x36bd8f,_0x6f567f){return new BPromise(function(_0x403ba6,_0x28f5c7){var _0x245bcd=sox[_0x9477('0x21')](_0x36bd8f,_0x6f567f,{'sampleRate':0x1f40,'format':_0x9477('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x245bcd['on']('error',function(_0x2f30d9){logger[_0x9477('0x1b')](_0x9477('0x23'),_0x2f30d9);_0x28f5c7(_0x2f30d9);});_0x245bcd['on']('end',function(){logger[_0x9477('0x18')](_0x9477('0x24'));_0x403ba6();});_0x245bcd['start']();});}function base64Decode(_0x2f6d0b,_0x555862){var _0x2821c8=path['resolve'](__dirname,_0x9477('0x25'),rs[_0x9477('0x26')](0x4)+_0x9477('0x27'));fs[_0x9477('0x28')](_0x2821c8,_0x2f6d0b,_0x9477('0x29'));return convertFile(_0x2821c8,_0x555862)[_0x9477('0x2a')](function(){try{fs[_0x9477('0x1c')](_0x2821c8);fs['chmodSync'](_0x555862,'777');}catch(_0x4360b2){logger[_0x9477('0x1b')](_0x4360b2);}return _0x555862[_0x9477('0x2b')]('.')[0x0];});}function base64Encode(_0x344fd9){var _0x421e33=fs[_0x9477('0x2c')](_0x344fd9);return new Buffer(_0x421e33)['toString'](_0x9477('0x29'));}exports[_0x9477('0x2d')]=function(_0x529d72,_0x34d8ad,_0x2b2e0a,_0x6d4a8d,_0xa8b42e,_0x48c83b){var _0x11900e,_0x4146fa;var _0x14fcc1=_0x9477('0x2e');var _0x229a1a='?key='+_0x529d72;var _0xa15c3a={};if(_0x34d8ad==='ssml'){_0xa15c3a[_0x9477('0x2f')]={'ssml':_0x2b2e0a};}else{_0xa15c3a[_0x9477('0x2f')]={'text':_0x2b2e0a};};_0xa15c3a[_0x9477('0x30')]={'languageCode':_0x6d4a8d,'ssmlGender':_0xa8b42e};_0xa15c3a['audioConfig']={'audioEncoding':_0x9477('0x31'),'sampleRateHertz':0x1f40};var _0xbd2b4c={'url':_0x14fcc1+_0x9477('0x32')+_0x229a1a,'method':_0x9477('0x33'),'json':!![],'body':_0xa15c3a};return rp(_0xbd2b4c)[_0x9477('0x2a')](function(_0xc0cb00){return new BPromise(function(_0x3d1f73,_0x35d418){_0x11900e=path['resolve'](__dirname,_0x9477('0x25'),rs[_0x9477('0x26')](0x4)+_0x9477('0x34'));var _0x11860d=Buffer[_0x9477('0x35')](_0xc0cb00[_0x9477('0x36')],_0x9477('0x29'));return fs[_0x9477('0x37')](_0x11900e,_0x11860d,function(_0x5289bc){_0x35d418(_0x5289bc);},function(_0x1fe36c){fs['chmodSync'](_0x11900e,'777');_0x3d1f73(_0x1fe36c);});});})[_0x9477('0x2a')](function(_0x7df236){_0x4146fa=path[_0x9477('0x38')](__dirname,_0x9477('0x25'),rs[_0x9477('0x26')](0x4)+_0x9477('0x27'));return convertFile(_0x11900e,_0x4146fa);})[_0x9477('0x2a')](function(){try{fs[_0x9477('0x1c')](_0x11900e);fs[_0x9477('0x39')](_0x4146fa,_0x9477('0x3a'));}catch(_0x1eb941){logger['error'](_0x1eb941);}logger['info'](_0x9477('0x3b'),_0x4146fa[_0x9477('0x2b')]('.')[0x0]);return _0x4146fa[_0x9477('0x2b')]('.')[0x0];});};exports[_0x9477('0x3c')]=function(_0x27018f,_0x142eba){var _0x248a71=_0x9477('0x3d');var _0x7f58b2,_0x368a4b;var _0x3782b9;var _0x298cfd={'encoding':_0x9477('0x3e'),'method':_0x9477('0x33'),'timeout':0x2710,'url':_0x248a71,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x9477('0x3f')]([_0x27018f,_0x142eba||'en',![],_0x9477('0x40')]),null,_0x9477('0x41')]]]))};return rp(_0x298cfd)[_0x9477('0x2a')](function(_0xee4a88){try{_0x3782b9=eval(_0xee4a88[_0x9477('0x42')](0x5))[0x0][0x2];}catch(_0x26f41f){throw new Error(_0x9477('0x43')+_0xee4a88['data']);}if(!_0x3782b9){if(_0x27018f[_0x9477('0x44')]>0xc8){throw new Error(_0x9477('0x45'));}else{throw new Error('lang\x20\x22'+_0x142eba+_0x9477('0x46'));}}try{_0x3782b9=eval(_0x3782b9)[0x0];}catch(_0x5e79a1){throw new Error(_0x9477('0x43')+res['data']);}const _0x5ee5d0=_0x3782b9;_0x7f58b2=path[_0x9477('0x38')](__dirname,_0x9477('0x25'),rs['generate'](0x4)+_0x9477('0x34'));fs['writeFileSync'](_0x7f58b2,_0x3782b9,{'encoding':'base64'});_0x368a4b=path[_0x9477('0x38')](__dirname,'tmp',rs[_0x9477('0x26')](0x4)+'.wav');return convertFile(_0x7f58b2,_0x368a4b);})[_0x9477('0x2a')](function(){try{fs['unlink'](_0x7f58b2);fs[_0x9477('0x39')](_0x368a4b,'777');}catch(_0x47158d){logger[_0x9477('0x1b')](_0x47158d);}logger[_0x9477('0x18')](_0x9477('0x47'),_0x368a4b[_0x9477('0x2b')]('.')[0x0]);return _0x368a4b[_0x9477('0x2b')]('.')[0x0];});};exports[_0x9477('0x48')]=function(_0x5e2c03,_0x10bf74,_0x1958b4){return google[_0x9477('0x49')](_0x5e2c03,_0x10bf74,_0x1958b4)[_0x9477('0x2a')](function(_0x443a8a){logger[_0x9477('0x18')](_0x443a8a[_0x9477('0x4a')]);return rp(_0x443a8a);})[_0x9477('0x2a')](function(_0xc40caa){var _0x4dacba='';var _0x39d46e=0x0;try{fs[_0x9477('0x1c')](_0x5e2c03);}catch(_0x409b19){logger[_0x9477('0x1b')](_0x409b19);}if(_0xc40caa&&_0xc40caa[_0x9477('0x4b')]){_0x4dacba=_0xc40caa['results'][_0x9477('0x4c')](function(_0x1f2d21){return _0x1f2d21&&_0x1f2d21['alternatives'][0x0]&&_0x1f2d21[_0x9477('0x4d')][0x0][_0x9477('0x4e')]?_0x1f2d21[_0x9477('0x4d')][0x0][_0x9477('0x4e')]:'';})[_0x9477('0x4f')]('\x0a');_0x39d46e=_0xc40caa[_0x9477('0x4b')][_0x9477('0x4c')](function(_0xddc781){return _0xddc781&&_0xddc781[_0x9477('0x4d')][0x0]&&_0xddc781[_0x9477('0x4d')][0x0][_0x9477('0x50')]?_0xddc781[_0x9477('0x4d')][0x0][_0x9477('0x50')]:0x0;})[_0x9477('0x4f')]('\x0a');}logger[_0x9477('0x18')](_0x9477('0x51'),_0x4dacba);logger['info'](_0x9477('0x52'),_0x39d46e);return{'transcript':_0x4dacba,'confidence':_0x39d46e};})[_0x9477('0x53')](function(_0x5d9e26){logger[_0x9477('0x1b')](_0x9477('0x54'),_0x5d9e26[_0x9477('0x14')],_0x5d9e26['name'],_0x5d9e26[_0x9477('0x55')]);});};exports[_0x9477('0x56')]=function(_0x33ce8c,_0x4f9241,_0x3919df,_0x45ed9f){var _0x3730e3=apiai(_0x4f9241,{'language':_0x45ed9f||'en'});return _0x3730e3[_0x9477('0x57')](_0x3919df,{'sessionId':md5(_0x33ce8c)})['then'](function(_0x3faa24){logger['info'](JSON[_0x9477('0x3f')](_0x3faa24));return{'source':_0x3faa24[_0x9477('0x58')][_0x9477('0x59')],'resolvedQuery':_0x3faa24[_0x9477('0x58')][_0x9477('0x5a')],'action':_0x3faa24[_0x9477('0x58')][_0x9477('0x5b')],'actionIncomplete':_0x3faa24[_0x9477('0x58')]['actionIncomplete'],'speech':_0x3faa24[_0x9477('0x58')][_0x9477('0x5c')]['speech'],'score':_0x3faa24[_0x9477('0x58')][_0x9477('0x5d')],'statusCode':_0x3faa24[_0x9477('0x5e')][_0x9477('0x5f')],'endConversation':_0x3faa24[_0x9477('0x58')]['metadata'][_0x9477('0x60')]||![],'isFallbackIntent':_0x3faa24[_0x9477('0x58')][_0x9477('0x61')][_0x9477('0x62')]};});};exports[_0x9477('0x63')]=function(_0x58d918,_0x5a4f23,_0x58ad6d,_0x161b86,_0x7183b1,_0x167ab6){var _0x53c812=_0x161b86[_0x9477('0x64')](/\\n/g,'\x0a');var _0x1bdd87={'credentials':{'private_key':_0x53c812,'client_email':_0x58ad6d}};var _0x1fefeb=new dialogflow[(_0x9477('0x65'))](_0x1bdd87);var _0x20666a=_0x1fefeb[_0x9477('0x66')](_0x5a4f23,md5(_0x58d918));var _0x3ec46a={'session':_0x20666a,'queryInput':{'text':{'text':_0x7183b1,'languageCode':_0x167ab6}}};return _0x1fefeb[_0x9477('0x67')](_0x3ec46a)[_0x9477('0x2a')](function(_0x423f6a){if(_0x423f6a&&_0x423f6a['length']){logger[_0x9477('0x18')]('Dialogflow\x20V2\x20response:',JSON[_0x9477('0x3f')](_0x423f6a));var _0x52bf09=_0x423f6a[0x0];if(_0x52bf09){var _0x288f29={'action':_0x52bf09['queryResult'][_0x9477('0x5b')],'allRequiredParamsPresent':_0x52bf09[_0x9477('0x68')][_0x9477('0x69')],'endConversation':_0x52bf09['queryResult'][_0x9477('0x6a')]&&_0x52bf09[_0x9477('0x68')][_0x9477('0x6a')][_0x9477('0x6b')]?_0x52bf09[_0x9477('0x68')][_0x9477('0x6a')][_0x9477('0x6b')][_0x9477('0x6c')][_0x9477('0x6d')]:![],'fulfillmentText':_0x52bf09[_0x9477('0x68')]['fulfillmentText'],'intentName':_0x52bf09[_0x9477('0x68')][_0x9477('0x6e')][_0x9477('0x6f')],'intentDisplayName':_0x52bf09[_0x9477('0x68')][_0x9477('0x6e')][_0x9477('0x70')],'isFallbackIntent':_0x52bf09[_0x9477('0x68')][_0x9477('0x6e')][_0x9477('0x71')],'languageCode':_0x52bf09['queryResult']['languageCode'],'queryText':_0x52bf09[_0x9477('0x68')][_0x9477('0x72')],'responseId':_0x52bf09[_0x9477('0x73')],'score':_0x52bf09['queryResult'][_0x9477('0x74')],'speech':_0x52bf09['queryResult'][_0x9477('0x75')],'providerResponse':JSON['stringify'](_0x423f6a)};return _0x288f29;}}});};exports[_0x9477('0x76')]=function(_0x2cbe65,_0x2f7d8b,_0x36e086,_0x1d768e){return tilde[_0x9477('0x49')](_0x2cbe65,_0x2f7d8b,_0x36e086,_0x1d768e)[_0x9477('0x2a')](function(_0x826f85){try{fs[_0x9477('0x1c')](_0x2cbe65);}catch(_0x47f914){logger[_0x9477('0x1b')](_0x47f914);}logger['info'](_0x9477('0x77'),_0x826f85[_0x9477('0x4e')]);logger[_0x9477('0x18')](_0x9477('0x78'),_0x826f85['confidence']);return _0x826f85;});};exports[_0x9477('0x79')]=function(_0x39819f,_0x25f87b,_0x3eeb91,_0x32c9db,_0x2e3ca,_0x164626){var _0x19a924=path[_0x9477('0x38')](__dirname,'tmp',rs['generate'](0x4)+_0x9477('0x34'));var _0x3674c5;return aws['polly'](_0x39819f,_0x25f87b,_0x3eeb91,_0x32c9db,_0x2e3ca,_0x164626,_0x19a924)['then'](function(){_0x3674c5=path[_0x9477('0x38')](__dirname,_0x9477('0x25'),rs['generate'](0x4)+_0x9477('0x27'));return convertFile(_0x19a924,_0x3674c5);})[_0x9477('0x2a')](function(){try{fs[_0x9477('0x1c')](_0x19a924);fs[_0x9477('0x39')](_0x3674c5,_0x9477('0x3a'));}catch(_0x835ed8){logger['error'](_0x835ed8);}return _0x3674c5['split']('.')[0x0];});};exports['awsLex']=function(_0x484032,_0x5e0f6a,_0x2b8efc,_0xfede37,_0x3765c4,_0x1924e3){return aws['lex'](_0x484032,_0x5e0f6a,_0x2b8efc,_0xfede37,_0x3765c4,_0x1924e3)[_0x9477('0x2a')](function(_0x2eec78){logger[_0x9477('0x18')](JSON[_0x9477('0x3f')](_0x2eec78));return _0x2eec78;});};exports[_0x9477('0x7a')]=function(_0x1f913e,_0x58a281,_0xcc4c7d,_0x196c19){var _0x3d3f84=util['format'](_0x9477('0x7b'),ISPEECH_API,_0x1f913e,encodeURIComponent(_0x58a281),_0xcc4c7d,_0x196c19);var _0x89c101=path[_0x9477('0x38')](__dirname,_0x9477('0x25'),rs[_0x9477('0x26')](0x4)+'.mp3');var _0x477e16;return downloadFile(_0x3d3f84,_0x89c101)['then'](function(){_0x477e16=path[_0x9477('0x38')](__dirname,_0x9477('0x25'),rs[_0x9477('0x26')](0x4)+_0x9477('0x27'));return convertFile(_0x89c101,_0x477e16);})[_0x9477('0x2a')](function(){try{fs['unlink'](_0x89c101);fs[_0x9477('0x39')](_0x477e16,'777');}catch(_0x18cb81){logger['error'](_0x18cb81);}return _0x477e16[_0x9477('0x2b')]('.')[0x0];});};exports[_0x9477('0x7c')]=function(_0x1d93ce,_0x1f0bfe,_0x50261d,_0x2fede6){var _0x4f70ca=util[_0x9477('0x7d')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1f0bfe,_0x50261d,base64Encode(_0x1d93ce),_0x2fede6?util[_0x9477('0x7d')](_0x9477('0x7e'),encodeURIComponent(_0x2fede6)):_0x9477('0x7f'));return uploadFile(_0x4f70ca)[_0x9477('0x2a')](function(_0x4b2c8b){return querystring[_0x9477('0x80')](_0x4b2c8b);});};exports[_0x9477('0x81')]=function(_0x513381,_0x4e5d8d){return sestek[_0x9477('0x82')](_0x513381,_0x4e5d8d)['then'](function(_0x11c04c){logger[_0x9477('0x18')](JSON[_0x9477('0x3f')](_0x11c04c));var _0x1e7836={'speech':_0x11c04c[_0x9477('0x83')],'action':_0x11c04c[_0x9477('0x84')]?_0x11c04c['channelData'][_0x9477('0x85')]:undefined,'actiondata':_0x11c04c[_0x9477('0x84')]?_0x11c04c[_0x9477('0x84')][_0x9477('0x86')]:undefined};if(_0x11c04c[_0x9477('0x84')]&&_0x11c04c[_0x9477('0x84')][_0x9477('0x87')]){return base64Decode(_0x11c04c['channelData'][_0x9477('0x87')]['Data'],path[_0x9477('0x38')](__dirname,_0x9477('0x25'),rs[_0x9477('0x26')](0x4)+_0x9477('0x27')))[_0x9477('0x2a')](function(_0xf02acf){_0x1e7836[_0x9477('0x88')]=_0xf02acf;return _0x1e7836;});}return _0x1e7836;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xc761=['download\x20error','pipe','end','https:','path','data','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','chmodSync','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','message','googleDialogflow','result','source','action','actionIncomplete','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','channelData','AudioFromTts','audiofile','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc761,0xf2));var _0x1c76=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xc761[_0x31a576];return _0x30b1d3;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x1c76('0x0'));var dialogflow=require(_0x1c76('0x1'));var fs=require('fs');var http=require(_0x1c76('0x2'));var https=require(_0x1c76('0x3'));var md5=require(_0x1c76('0x4'));var path=require('path');var querystring=require(_0x1c76('0x5'));var rp=require(_0x1c76('0x6'));var rs=require(_0x1c76('0x7'));var sox=require(_0x1c76('0x8'));var tts=require(_0x1c76('0x9'));var urlParse=require(_0x1c76('0xa'))[_0x1c76('0xb')];var util=require('util');var aws=require('./aws');var google=require(_0x1c76('0xc'));var sestek=require(_0x1c76('0xd'));var tilde=require(_0x1c76('0xe'));var logger=require('../../../config/logger')(_0x1c76('0xf'));var ISPEECH_API=_0x1c76('0x10');function downloadFile(_0x1cf69d,_0x2d49a6){return new BPromise(function(_0x21dfdb,_0x3c8d5e){var _0x10c57c=urlParse(_0x1cf69d);var _0x40e931=_0x10c57c[_0x1c76('0x11')]==='https:'?https:http;var _0x2e89ae={'host':_0x10c57c[_0x1c76('0x12')],'path':_0x10c57c['path'],'headers':{'user-agent':_0x1c76('0x13')}};_0x40e931[_0x1c76('0x14')](_0x2e89ae,function(_0x3fed66){if(_0x3fed66[_0x1c76('0x15')]!==0xc8){logger[_0x1c76('0x16')](_0x1c76('0x17')+_0x1cf69d+_0x1c76('0x18')+_0x3fed66[_0x1c76('0x15')]+'\x20('+_0x3fed66[_0x1c76('0x19')]+')');_0x3c8d5e(new Error(_0x1c76('0x17')+_0x1cf69d+'\x20failed,\x20status\x20code\x20=\x20'+_0x3fed66[_0x1c76('0x15')]+'\x20('+_0x3fed66[_0x1c76('0x19')]+')'));return;}var _0x21261c=fs[_0x1c76('0x1a')](_0x2d49a6);_0x21261c['on'](_0x1c76('0x1b'),function(){logger[_0x1c76('0x1c')](_0x1c76('0x1d'));_0x21261c[_0x1c76('0x1e')](_0x21dfdb);});_0x21261c['on']('error',function(_0x1ef1be){fs[_0x1c76('0x1f')](_0x2d49a6);logger[_0x1c76('0x16')](_0x1c76('0x20'),_0x1ef1be);_0x3c8d5e(_0x1ef1be);});_0x3fed66[_0x1c76('0x21')](_0x21261c);})['on'](_0x1c76('0x16'),function(_0x365dbe){logger[_0x1c76('0x16')](_0x365dbe);_0x3c8d5e(_0x365dbe);})[_0x1c76('0x22')]();});}function uploadFile(_0x58c3af){return new BPromise(function(_0x26e5de,_0x3c50ff){var _0x2f924d=urlParse(_0x58c3af);var _0x23e5ce=_0x2f924d[_0x1c76('0x11')]===_0x1c76('0x23')?https:http;var _0x5ea419={'host':_0x2f924d[_0x1c76('0x12')],'path':_0x2f924d[_0x1c76('0x24')],'headers':{'user-agent':_0x1c76('0x13')}};_0x23e5ce[_0x1c76('0x14')](_0x5ea419,function(_0x12e9d8){if(_0x12e9d8['statusCode']!==0xc8){_0x3c50ff(new Error(_0x1c76('0x17')+_0x58c3af+_0x1c76('0x18')+_0x12e9d8['statusCode']+'\x20('+_0x12e9d8[_0x1c76('0x19')]+')'));return;}var _0x596cad='';_0x12e9d8['on'](_0x1c76('0x25'),function(_0x4c9140){_0x596cad+=_0x4c9140;});_0x12e9d8['on'](_0x1c76('0x22'),function(){_0x26e5de(_0x596cad);});})['on'](_0x1c76('0x16'),function(_0x2484a9){_0x3c50ff(_0x2484a9);})[_0x1c76('0x22')]();});}function convertFile(_0x2c0da3,_0x25dea5){return new BPromise(function(_0x597381,_0x218ed4){var _0x362bfe=sox['transcode'](_0x2c0da3,_0x25dea5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x362bfe['on'](_0x1c76('0x16'),function(_0x586532){logger[_0x1c76('0x16')](_0x1c76('0x26'),_0x586532);_0x218ed4(_0x586532);});_0x362bfe['on']('end',function(){logger[_0x1c76('0x1c')](_0x1c76('0x27'));_0x597381();});_0x362bfe[_0x1c76('0x28')]();});}function base64Decode(_0x36c6ea,_0x260bbf){var _0x46f599=path[_0x1c76('0x29')](__dirname,'tmp',rs[_0x1c76('0x2a')](0x4)+_0x1c76('0x2b'));fs[_0x1c76('0x2c')](_0x46f599,_0x36c6ea,_0x1c76('0x2d'));return convertFile(_0x46f599,_0x260bbf)[_0x1c76('0x2e')](function(){try{fs[_0x1c76('0x1f')](_0x46f599);fs['chmodSync'](_0x260bbf,_0x1c76('0x2f'));}catch(_0x2ee5d6){logger[_0x1c76('0x16')](_0x2ee5d6);}return _0x260bbf[_0x1c76('0x30')]('.')[0x0];});}function base64Encode(_0x4128a0){var _0x2f0050=fs['readFileSync'](_0x4128a0);return new Buffer(_0x2f0050)[_0x1c76('0x31')]('base64');}exports['googleCloudTTS']=function(_0x1b89d9,_0x4ab7e5,_0x15e65e,_0x455954,_0x37c048,_0x215cac){var _0x595053,_0x4cfcfa;var _0x585d4c=_0x1c76('0x32');var _0x5157b2=_0x1c76('0x33')+_0x1b89d9;var _0x3c5d50={};if(_0x4ab7e5===_0x1c76('0x34')){_0x3c5d50[_0x1c76('0x35')]={'ssml':_0x15e65e};}else{_0x3c5d50['input']={'text':_0x15e65e};};_0x3c5d50[_0x1c76('0x36')]={'languageCode':_0x455954,'ssmlGender':_0x37c048};_0x3c5d50[_0x1c76('0x37')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x544c30={'url':_0x585d4c+_0x1c76('0x38')+_0x5157b2,'method':_0x1c76('0x39'),'json':!![],'body':_0x3c5d50};return rp(_0x544c30)[_0x1c76('0x2e')](function(_0x69bc0c){return new BPromise(function(_0x117cc4,_0x56be09){_0x595053=path[_0x1c76('0x29')](__dirname,_0x1c76('0x3a'),rs[_0x1c76('0x2a')](0x4)+_0x1c76('0x3b'));var _0x2a3bf1=Buffer[_0x1c76('0x3c')](_0x69bc0c[_0x1c76('0x3d')],_0x1c76('0x2d'));return fs[_0x1c76('0x3e')](_0x595053,_0x2a3bf1,function(_0x375863){_0x56be09(_0x375863);},function(_0x40037f){fs[_0x1c76('0x3f')](_0x595053,_0x1c76('0x2f'));_0x117cc4(_0x40037f);});});})[_0x1c76('0x2e')](function(_0x556290){_0x4cfcfa=path['resolve'](__dirname,'tmp',rs[_0x1c76('0x2a')](0x4)+_0x1c76('0x2b'));return convertFile(_0x595053,_0x4cfcfa);})[_0x1c76('0x2e')](function(){try{fs[_0x1c76('0x1f')](_0x595053);fs[_0x1c76('0x3f')](_0x4cfcfa,_0x1c76('0x2f'));}catch(_0x3e735b){logger['error'](_0x3e735b);}logger[_0x1c76('0x1c')]('googleCloudTTS\x20path',_0x4cfcfa[_0x1c76('0x30')]('.')[0x0]);return _0x4cfcfa['split']('.')[0x0];});};exports[_0x1c76('0x40')]=function(_0x2b9586,_0x2d870d){var _0x325a93=_0x1c76('0x41');var _0x27f6fc,_0x37a0c4;var _0x4bac93;var _0x452274={'encoding':_0x1c76('0x42'),'method':_0x1c76('0x39'),'timeout':0x2710,'url':_0x325a93,'headers':{'Content-Type':_0x1c76('0x43')},'body':_0x1c76('0x44')+encodeURIComponent(JSON[_0x1c76('0x45')]([[['jQ1olc',JSON[_0x1c76('0x45')]([_0x2b9586,_0x2d870d||'en',![],_0x1c76('0x46')]),null,_0x1c76('0x47')]]]))};return rp(_0x452274)[_0x1c76('0x2e')](function(_0x24fc20){try{_0x4bac93=eval(_0x24fc20[_0x1c76('0x48')](0x5))[0x0][0x2];}catch(_0x25260f){throw new Error('parse\x20response\x20failed:\x0a'+_0x24fc20[_0x1c76('0x25')]);}if(!_0x4bac93){if(_0x2b9586[_0x1c76('0x49')]>0xc8){throw new Error(_0x1c76('0x4a'));}else{throw new Error(_0x1c76('0x4b')+_0x2d870d+_0x1c76('0x4c'));}}try{_0x4bac93=eval(_0x4bac93)[0x0];}catch(_0x11496e){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x1c76('0x25')]);}const _0x129d93=_0x4bac93;_0x27f6fc=path['resolve'](__dirname,'tmp',rs[_0x1c76('0x2a')](0x4)+_0x1c76('0x3b'));fs[_0x1c76('0x2c')](_0x27f6fc,_0x4bac93,{'encoding':_0x1c76('0x2d')});_0x37a0c4=path[_0x1c76('0x29')](__dirname,_0x1c76('0x3a'),rs[_0x1c76('0x2a')](0x4)+_0x1c76('0x2b'));return convertFile(_0x27f6fc,_0x37a0c4);})['then'](function(){try{fs['unlink'](_0x27f6fc);fs[_0x1c76('0x3f')](_0x37a0c4,_0x1c76('0x2f'));}catch(_0x5b0e72){logger[_0x1c76('0x16')](_0x5b0e72);}logger[_0x1c76('0x1c')](_0x1c76('0x4d'),_0x37a0c4['split']('.')[0x0]);return _0x37a0c4['split']('.')[0x0];});};exports[_0x1c76('0x4e')]=function(_0x32a7a6,_0x5de4b3,_0x11999d){return google[_0x1c76('0x4f')](_0x32a7a6,_0x5de4b3,_0x11999d)['then'](function(_0x350d85){logger[_0x1c76('0x1c')](_0x350d85[_0x1c76('0x50')]);return rp(_0x350d85);})[_0x1c76('0x2e')](function(_0xcbbaee){var _0x4c2cb3='';var _0x15fa93=0x0;try{fs[_0x1c76('0x1f')](_0x32a7a6);}catch(_0xad4f14){logger['error'](_0xad4f14);}if(_0xcbbaee&&_0xcbbaee[_0x1c76('0x51')]){_0x4c2cb3=_0xcbbaee[_0x1c76('0x51')][_0x1c76('0x52')](function(_0x3f4933){return _0x3f4933&&_0x3f4933[_0x1c76('0x53')][0x0]&&_0x3f4933[_0x1c76('0x53')][0x0][_0x1c76('0x54')]?_0x3f4933[_0x1c76('0x53')][0x0][_0x1c76('0x54')]:'';})[_0x1c76('0x55')]('\x0a');_0x15fa93=_0xcbbaee[_0x1c76('0x51')][_0x1c76('0x52')](function(_0x4a95af){return _0x4a95af&&_0x4a95af[_0x1c76('0x53')][0x0]&&_0x4a95af[_0x1c76('0x53')][0x0][_0x1c76('0x56')]?_0x4a95af[_0x1c76('0x53')][0x0][_0x1c76('0x56')]:0x0;})[_0x1c76('0x55')]('\x0a');}logger[_0x1c76('0x1c')](_0x1c76('0x57'),_0x4c2cb3);logger[_0x1c76('0x1c')](_0x1c76('0x58'),_0x15fa93);return{'transcript':_0x4c2cb3,'confidence':_0x15fa93};})[_0x1c76('0x59')](function(_0x237871){logger['error']('[%s]\x20%s:%s',_0x237871[_0x1c76('0x15')],_0x237871['name'],_0x237871[_0x1c76('0x5a')]);});};exports[_0x1c76('0x5b')]=function(_0x5b1b4d,_0x529e88,_0xa4c0b7,_0x1e0434){var _0x555d39=apiai(_0x529e88,{'language':_0x1e0434||'en'});return _0x555d39['textRequest'](_0xa4c0b7,{'sessionId':md5(_0x5b1b4d)})[_0x1c76('0x2e')](function(_0x26265d){logger[_0x1c76('0x1c')](JSON['stringify'](_0x26265d));return{'source':_0x26265d[_0x1c76('0x5c')][_0x1c76('0x5d')],'resolvedQuery':_0x26265d[_0x1c76('0x5c')]['resolvedQuery'],'action':_0x26265d[_0x1c76('0x5c')][_0x1c76('0x5e')],'actionIncomplete':_0x26265d[_0x1c76('0x5c')][_0x1c76('0x5f')],'speech':_0x26265d[_0x1c76('0x5c')]['fulfillment'][_0x1c76('0x60')],'score':_0x26265d['result'][_0x1c76('0x61')],'statusCode':_0x26265d[_0x1c76('0x62')][_0x1c76('0x63')],'endConversation':_0x26265d[_0x1c76('0x5c')][_0x1c76('0x64')][_0x1c76('0x65')]||![],'isFallbackIntent':_0x26265d[_0x1c76('0x5c')]['metadata']['isFallbackIntent']};});};exports[_0x1c76('0x66')]=function(_0x1bbbad,_0x365cff,_0x2ab5e3,_0x2417a9,_0x319d03,_0x3340df){var _0x36d084=_0x2417a9[_0x1c76('0x67')](/\\n/g,'\x0a');var _0x55e2f7={'credentials':{'private_key':_0x36d084,'client_email':_0x2ab5e3}};var _0x19abc0=new dialogflow[(_0x1c76('0x68'))](_0x55e2f7);var _0x126d0b=_0x19abc0['sessionPath'](_0x365cff,md5(_0x1bbbad));var _0x1a0f86={'session':_0x126d0b,'queryInput':{'text':{'text':_0x319d03,'languageCode':_0x3340df}}};return _0x19abc0['detectIntent'](_0x1a0f86)['then'](function(_0x4d1276){if(_0x4d1276&&_0x4d1276['length']){logger[_0x1c76('0x1c')](_0x1c76('0x69'),JSON[_0x1c76('0x45')](_0x4d1276));var _0x536a25=_0x4d1276[0x0];if(_0x536a25){var _0x1d83a8={'action':_0x536a25[_0x1c76('0x6a')][_0x1c76('0x5e')],'allRequiredParamsPresent':_0x536a25[_0x1c76('0x6a')][_0x1c76('0x6b')],'endConversation':_0x536a25['queryResult'][_0x1c76('0x6c')]&&_0x536a25[_0x1c76('0x6a')]['diagnosticInfo'][_0x1c76('0x6d')]?_0x536a25[_0x1c76('0x6a')][_0x1c76('0x6c')][_0x1c76('0x6d')][_0x1c76('0x6e')][_0x1c76('0x6f')]:![],'fulfillmentText':_0x536a25[_0x1c76('0x6a')][_0x1c76('0x70')],'intentName':_0x536a25[_0x1c76('0x6a')][_0x1c76('0x71')]['name'],'intentDisplayName':_0x536a25['queryResult'][_0x1c76('0x71')][_0x1c76('0x72')],'isFallbackIntent':_0x536a25['queryResult'][_0x1c76('0x71')][_0x1c76('0x73')],'languageCode':_0x536a25[_0x1c76('0x6a')][_0x1c76('0x74')],'queryText':_0x536a25['queryResult'][_0x1c76('0x75')],'responseId':_0x536a25[_0x1c76('0x76')],'score':_0x536a25['queryResult']['intentDetectionConfidence'],'speech':_0x536a25['queryResult'][_0x1c76('0x70')],'providerResponse':JSON[_0x1c76('0x45')](_0x4d1276)};return _0x1d83a8;}}});};exports[_0x1c76('0x77')]=function(_0x45487a,_0x437bd8,_0x3be4d3,_0x56acde){return tilde[_0x1c76('0x4f')](_0x45487a,_0x437bd8,_0x3be4d3,_0x56acde)[_0x1c76('0x2e')](function(_0x12698d){try{fs[_0x1c76('0x1f')](_0x45487a);}catch(_0x2e7c22){logger[_0x1c76('0x16')](_0x2e7c22);}logger[_0x1c76('0x1c')](_0x1c76('0x78'),_0x12698d[_0x1c76('0x54')]);logger[_0x1c76('0x1c')](_0x1c76('0x79'),_0x12698d[_0x1c76('0x56')]);return _0x12698d;});};exports[_0x1c76('0x7a')]=function(_0x2e0dfd,_0xe3139a,_0x1c2b8d,_0x50fa60,_0x49a163,_0x3920a1){var _0x3965b3=path[_0x1c76('0x29')](__dirname,_0x1c76('0x3a'),rs[_0x1c76('0x2a')](0x4)+_0x1c76('0x3b'));var _0x436116;return aws[_0x1c76('0x7b')](_0x2e0dfd,_0xe3139a,_0x1c2b8d,_0x50fa60,_0x49a163,_0x3920a1,_0x3965b3)[_0x1c76('0x2e')](function(){_0x436116=path['resolve'](__dirname,_0x1c76('0x3a'),rs['generate'](0x4)+'.wav');return convertFile(_0x3965b3,_0x436116);})[_0x1c76('0x2e')](function(){try{fs[_0x1c76('0x1f')](_0x3965b3);fs[_0x1c76('0x3f')](_0x436116,_0x1c76('0x2f'));}catch(_0x4e9ed2){logger[_0x1c76('0x16')](_0x4e9ed2);}return _0x436116[_0x1c76('0x30')]('.')[0x0];});};exports[_0x1c76('0x7c')]=function(_0x490778,_0x53b63c,_0x23e7ab,_0x25dadb,_0x247cbc,_0x4f94a5){return aws[_0x1c76('0x7d')](_0x490778,_0x53b63c,_0x23e7ab,_0x25dadb,_0x247cbc,_0x4f94a5)['then'](function(_0xb5aad){logger[_0x1c76('0x1c')](JSON[_0x1c76('0x45')](_0xb5aad));return _0xb5aad;});};exports[_0x1c76('0x7e')]=function(_0x3c2a90,_0x59c926,_0x1689e0,_0x43905a){var _0x2cd6d5=util[_0x1c76('0x7f')](_0x1c76('0x80'),ISPEECH_API,_0x3c2a90,encodeURIComponent(_0x59c926),_0x1689e0,_0x43905a);var _0x48c37e=path[_0x1c76('0x29')](__dirname,'tmp',rs[_0x1c76('0x2a')](0x4)+'.mp3');var _0x154edf;return downloadFile(_0x2cd6d5,_0x48c37e)[_0x1c76('0x2e')](function(){_0x154edf=path[_0x1c76('0x29')](__dirname,'tmp',rs[_0x1c76('0x2a')](0x4)+_0x1c76('0x2b'));return convertFile(_0x48c37e,_0x154edf);})['then'](function(){try{fs[_0x1c76('0x1f')](_0x48c37e);fs['chmodSync'](_0x154edf,_0x1c76('0x2f'));}catch(_0x1972dd){logger[_0x1c76('0x16')](_0x1972dd);}return _0x154edf[_0x1c76('0x30')]('.')[0x0];});};exports[_0x1c76('0x81')]=function(_0x3dcf30,_0x351454,_0x533bdb,_0x2d8ba8){var _0x36f23b=util['format'](_0x1c76('0x82'),ISPEECH_API,_0x351454,_0x533bdb,base64Encode(_0x3dcf30),_0x2d8ba8?util[_0x1c76('0x7f')](_0x1c76('0x83'),encodeURIComponent(_0x2d8ba8)):_0x1c76('0x84'));return uploadFile(_0x36f23b)[_0x1c76('0x2e')](function(_0x21bcde){return querystring[_0x1c76('0xb')](_0x21bcde);});};exports['sestekNDA']=function(_0x32f120,_0x149dc8){return sestek['nda'](_0x32f120,_0x149dc8)['then'](function(_0x285bc5){logger[_0x1c76('0x1c')](JSON[_0x1c76('0x45')](_0x285bc5));var _0xdb4714={'speech':_0x285bc5[_0x1c76('0x85')],'action':_0x285bc5[_0x1c76('0x86')]?_0x285bc5['channelData']['CustomAction']:undefined,'actiondata':_0x285bc5[_0x1c76('0x86')]?_0x285bc5[_0x1c76('0x86')]['CustomActionData']:undefined};if(_0x285bc5['channelData']&&_0x285bc5[_0x1c76('0x86')][_0x1c76('0x87')]){return base64Decode(_0x285bc5['channelData'][_0x1c76('0x87')]['Data'],path['resolve'](__dirname,_0x1c76('0x3a'),rs[_0x1c76('0x2a')](0x4)+'.wav'))[_0x1c76('0x2e')](function(_0x36e4e1){_0xdb4714[_0x1c76('0x88')]=_0x36e4e1;return _0xdb4714;});}return _0xdb4714;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 88bf59b..8b621cd 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecec=['./nda','exports'];(function(_0x35386c,_0x1b3f15){var _0x6cc822=function(_0x35427d){while(--_0x35427d){_0x35386c['push'](_0x35386c['shift']());}};_0x6cc822(++_0x1b3f15);}(_0xecec,0xee));var _0xcece=function(_0x24a68b,_0x1a05b6){_0x24a68b=_0x24a68b-0x0;var _0x246ab6=_0xecec[_0x24a68b];return _0x246ab6;};var nda=require(_0xcece('0x0'));module[_0xcece('0x1')]={'nda':nda}; \ No newline at end of file +var _0x3b31=['exports','./nda'];(function(_0x428277,_0x29ae79){var _0x93e55b=function(_0x1fa43a){while(--_0x1fa43a){_0x428277['push'](_0x428277['shift']());}};_0x93e55b(++_0x29ae79);}(_0x3b31,0xeb));var _0x13b3=function(_0x1f5817,_0xd5dd60){_0x1f5817=_0x1f5817-0x0;var _0x45f3b2=_0x3b31[_0x1f5817];return _0x45f3b2;};var nda=require(_0x13b3('0x0'));module[_0x13b3('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 5b77fba..b89f738 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x702d=['message','Nda','uniqueid','callerid','calleridname','dnid','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','audio/wav','custom_action','custom_action_data','CustomActionData','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x5717fa,_0x4c0526){var _0xcfcaa3=function(_0x239180){while(--_0x239180){_0x5717fa['push'](_0x5717fa['shift']());}};_0xcfcaa3(++_0x4c0526);}(_0x702d,0x147));var _0xd702=function(_0x50f0b8,_0x326c38){_0x50f0b8=_0x50f0b8-0x0;var _0x325121=_0x702d[_0x50f0b8];return _0x325121;};'use strict';var rp=require(_0xd702('0x0'));var url=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));module[_0xd702('0x4')]=function(_0x5c2b9e,_0x20c11a){var _0xebbd7c={'method':_0xd702('0x5'),'uri':url[_0xd702('0x6')](_0x20c11a['ndauth_url'],_0xd702('0x7')),'form':{'grant_type':'password','username':_0x20c11a[_0xd702('0x8')],'password':_0x20c11a[_0xd702('0x9')]},'json':!![]};return rp(_0xebbd7c)[_0xd702('0xa')](function(_0x5af246){var _0x12bb75={'method':'POST','uri':url[_0xd702('0x6')](_0x20c11a[_0xd702('0xb')],_0xd702('0xc')),'body':{'type':_0x20c11a[_0xd702('0xd')]||_0xd702('0xe'),'channelId':_0xd702('0xf'),'conversation':{'id':_0x5c2b9e[_0xd702('0x10')]},'from':{'id':_0x5c2b9e[_0xd702('0x11')],'name':_0x5c2b9e[_0xd702('0x12')]},'recipient':{'id':_0x5c2b9e[_0xd702('0x13')],'name':_0x5c2b9e['extension']},'text':_0x20c11a['text'],'channelData':{}},'headers':{'Authorization':_0xd702('0x14')+_0x5af246[_0xd702('0x15')]},'json':!![]};if(_0x20c11a[_0xd702('0x16')]){_0x12bb75['body'][_0xd702('0x17')][_0xd702('0x18')]=_0x20c11a[_0xd702('0x16')];}if(_0x20c11a[_0xd702('0x19')]=='1'){_0x12bb75[_0xd702('0x1a')][_0xd702('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd702('0x1b')};}if(_0x20c11a[_0xd702('0x1c')]){_0x12bb75['body'][_0xd702('0x17')]['CustomAction']=_0x20c11a[_0xd702('0x1c')];if(_0x20c11a[_0xd702('0x1d')]){_0x12bb75['body'][_0xd702('0x17')][_0xd702('0x1e')]=_0x20c11a[_0xd702('0x1d')];}}logger['info'](JSON['stringify'](_0x12bb75));return rp(_0x12bb75);});}; \ No newline at end of file +var _0x01d3=['ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','agi','exports','POST','resolve'];(function(_0x58ac34,_0x5b5bfb){var _0x3921ab=function(_0x172dd5){while(--_0x172dd5){_0x58ac34['push'](_0x58ac34['shift']());}};_0x3921ab(++_0x5b5bfb);}(_0x01d3,0xdb));var _0x301d=function(_0x262e6f,_0x2b29aa){_0x262e6f=_0x262e6f-0x0;var _0x44b895=_0x01d3[_0x262e6f];return _0x44b895;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x301d('0x0'))(_0x301d('0x1'));module[_0x301d('0x2')]=function(_0x5912f4,_0x33a51f){var _0x27dc62={'method':_0x301d('0x3'),'uri':url[_0x301d('0x4')](_0x33a51f[_0x301d('0x5')],'/token'),'form':{'grant_type':_0x301d('0x6'),'username':_0x33a51f[_0x301d('0x7')],'password':_0x33a51f[_0x301d('0x6')]},'json':!![]};return rp(_0x27dc62)[_0x301d('0x8')](function(_0x12b21b){var _0x49a253={'method':_0x301d('0x3'),'uri':url[_0x301d('0x4')](_0x33a51f[_0x301d('0x9')],_0x301d('0xa')),'body':{'type':_0x33a51f[_0x301d('0xb')]||_0x301d('0xc'),'channelId':_0x301d('0xd'),'conversation':{'id':_0x5912f4[_0x301d('0xe')]},'from':{'id':_0x5912f4[_0x301d('0xf')],'name':_0x5912f4['calleridname']},'recipient':{'id':_0x5912f4[_0x301d('0x10')],'name':_0x5912f4[_0x301d('0x11')]},'text':_0x33a51f['text'],'channelData':{}},'headers':{'Authorization':_0x301d('0x12')+_0x12b21b[_0x301d('0x13')]},'json':!![]};if(_0x33a51f[_0x301d('0x14')]){_0x49a253[_0x301d('0x15')]['channelData'][_0x301d('0x16')]=_0x33a51f[_0x301d('0x14')];}if(_0x33a51f[_0x301d('0x17')]=='1'){_0x49a253[_0x301d('0x15')][_0x301d('0x18')][_0x301d('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x301d('0x1a')};}if(_0x33a51f['custom_action']){_0x49a253[_0x301d('0x15')][_0x301d('0x18')]['CustomAction']=_0x33a51f[_0x301d('0x1b')];if(_0x33a51f[_0x301d('0x1c')]){_0x49a253[_0x301d('0x15')][_0x301d('0x18')][_0x301d('0x1d')]=_0x33a51f[_0x301d('0x1c')];}}logger[_0x301d('0x1e')](JSON[_0x301d('0x1f')](_0x49a253));return rp(_0x49a253);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index b66fa65..d70d247 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaab5=['exports'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xaab5,0x85));var _0x5aab=function(_0x4a35fb,_0x4f1028){_0x4a35fb=_0x4a35fb-0x0;var _0x266703=_0xaab5[_0x4a35fb];return _0x266703;};'use strict';var asr=require('./lib/api');module[_0x5aab('0x0')]=function(_0x513771,_0x556eaf,_0x50db94,_0x159ad7){return asr(_0x513771,_0x556eaf,_0x50db94,_0x159ad7);}; \ No newline at end of file +var _0x8ef7=['./lib/api'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x8ef7,0x1c6));var _0x78ef=function(_0x374abf,_0x240510){_0x374abf=_0x374abf-0x0;var _0x27f5a8=_0x8ef7[_0x374abf];return _0x27f5a8;};'use strict';var asr=require(_0x78ef('0x0'));module['exports']=function(_0x48cef8,_0x4ee689,_0x53d17a,_0x255cc4){return asr(_0x48cef8,_0x4ee689,_0x53d17a,_0x255cc4);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index b973a61..c95cea9 100644 --- a/server/services/agi/scripts/tilde/asr/lib/api.js +++ b/server/services/agi/scripts/tilde/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e06=['hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0x7e06,0xa0));var _0x67e0=function(_0x5b4063,_0x592e8a){_0x5b4063=_0x5b4063-0x0;var _0x2795c0=_0x7e06[_0x5b4063];return _0x2795c0;};'use strict';var BPromise=require(_0x67e0('0x0'));var _=require(_0x67e0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x67e0('0x2'));var crypto=require(_0x67e0('0x3'));var logger=require(_0x67e0('0x4'))(_0x67e0('0x5'));module[_0x67e0('0x6')]=function(_0x164238,_0x238dc4,_0x2cebb2,_0x124168){return new BPromise(function(_0xf869fc,_0x40397e){logger[_0x67e0('0x7')](_0x67e0('0x8'),_0x124168||_0x67e0('0x9'));var _0x346cad=new WebSocket(_0x124168||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x3d3fa6='';var _0x3d304b='0';var _0xc4b790='1';var _0x43f56a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3a91e6(_0x23a65c){var _0x2d6746=crypto['createHash'](_0x67e0('0xa'));_0x2d6746[_0x67e0('0xb')](_0x23a65c);return _0x2d6746['digest'](_0x67e0('0xc'));}function _0x5f4dc0(){try{logger['info'](_0x67e0('0xd'));var _0x4fc5ab=moment()['unix']();var _0x3b3b10=_0x3a91e6(_0x4fc5ab+_0x238dc4+_0x2cebb2);_0x346cad[_0x67e0('0xe')](JSON[_0x67e0('0xf')]({'appID':_0x238dc4,'timestamp':_0x4fc5ab,'appKey':_0x3b3b10}));var _0x1b1db2=fs[_0x67e0('0x10')](_0x164238);_0x1b1db2['on'](_0x67e0('0x11'),function(_0x2dc282){_0x346cad[_0x67e0('0xe')](_0x2dc282);});_0x1b1db2['on'](_0x67e0('0x12'),function(){_0x346cad[_0x67e0('0xe')](_0x67e0('0x13'));});}catch(_0x337d7a){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x67e0('0xf')](_0x337d7a));_0x346cad[_0x67e0('0x14')]();}}function _0x16e79d(_0x2f87f9){try{if(_0x2f87f9){var _0x30fc30=JSON[_0x67e0('0x15')](_0x2f87f9);switch(_0x30fc30[_0x67e0('0x16')]){case 0x0:if(_0x30fc30[_0x67e0('0x17')]){if(_0x30fc30['result']['final']){logger['info'](_0x67e0('0x18'),JSON[_0x67e0('0xf')](_0x30fc30[_0x67e0('0x17')][_0x67e0('0x19')]));_0x3d3fa6=_0x30fc30['result']['hypotheses'][0x0]['transcript'];_0x3d304b=_0x30fc30[_0x67e0('0x17')]['hypotheses'][0x0][_0x67e0('0x1a')];_0xc4b790='0';_0x43f56a=_0x67e0('0x1b');_0x346cad['terminate']();}}break;case 0x1:logger[_0x67e0('0x7')](_0x67e0('0x1c'));_0xc4b790='1';_0x43f56a=_0x67e0('0x1c');break;case 0x2:logger['info'](_0x67e0('0x1d'));_0xc4b790='2';_0x43f56a=_0x67e0('0x1d');break;case 0x9:logger[_0x67e0('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0xc4b790='9';_0x43f56a='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x67e0('0x7')](_0x67e0('0x1e'));_0xc4b790='10';_0x43f56a='Authentication\x20failed.';break;case 0xb:logger[_0x67e0('0x7')](_0x67e0('0x1f'));_0xc4b790='11';_0x43f56a=_0x67e0('0x1f');}}}catch(_0x308c1f){logger[_0x67e0('0x20')](_0x67e0('0x21'),JSON[_0x67e0('0xf')](_0x308c1f));_0x346cad[_0x67e0('0x14')]();}}function _0xae0ed(){logger[_0x67e0('0x7')](_0x67e0('0x22'));_0xf869fc({'transcript':_0x3d3fa6,'confidence':_0x3d304b,'status':_0xc4b790,'status_message':_0x43f56a});}function _0x4f473d(_0x387b3f){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x67e0('0x23')](_0x387b3f)){logger['error'](_[_0x67e0('0x24')](_0x387b3f)?JSON[_0x67e0('0xf')](_0x387b3f):_0x387b3f);}}_0x346cad['on']('open',_0x5f4dc0);_0x346cad['on']('message',_0x16e79d);_0x346cad['on'](_0x67e0('0x12'),_0xae0ed);_0x346cad['on'](_0x67e0('0x20'),_0x4f473d);});}; \ No newline at end of file +var _0xa29d=['Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','moment','../../../../../../config/logger','agi','exports','info'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0xa29d,0x1c2));var _0xda29=function(_0x5a0180,_0xd81d1){_0x5a0180=_0x5a0180-0x0;var _0x491dcd=_0xa29d[_0x5a0180];return _0x491dcd;};'use strict';var BPromise=require(_0xda29('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xda29('0x1'));var crypto=require('crypto');var logger=require(_0xda29('0x2'))(_0xda29('0x3'));module[_0xda29('0x4')]=function(_0xc792ae,_0x81b6b4,_0x3c10d0,_0x30e083){return new BPromise(function(_0x4aeb24,_0x302365){logger[_0xda29('0x5')](_0xda29('0x6'),_0x30e083||_0xda29('0x7'));var _0x7eb04=new WebSocket(_0x30e083||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x36fccd='';var _0x1165fd='0';var _0x37633e='1';var _0x2549dd=_0xda29('0x8');function _0x582bc0(_0x3ddf1e){var _0x276e6a=crypto[_0xda29('0x9')](_0xda29('0xa'));_0x276e6a[_0xda29('0xb')](_0x3ddf1e);return _0x276e6a[_0xda29('0xc')](_0xda29('0xd'));}function _0x53159d(){try{logger[_0xda29('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x48f21e=moment()[_0xda29('0xe')]();var _0x5c7958=_0x582bc0(_0x48f21e+_0x81b6b4+_0x3c10d0);_0x7eb04[_0xda29('0xf')](JSON[_0xda29('0x10')]({'appID':_0x81b6b4,'timestamp':_0x48f21e,'appKey':_0x5c7958}));var _0x2ac773=fs[_0xda29('0x11')](_0xc792ae);_0x2ac773['on'](_0xda29('0x12'),function(_0x34d8ec){_0x7eb04['send'](_0x34d8ec);});_0x2ac773['on'](_0xda29('0x13'),function(){_0x7eb04[_0xda29('0xf')](_0xda29('0x14'));});}catch(_0xd2fd60){logger[_0xda29('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0xda29('0x10')](_0xd2fd60));_0x7eb04[_0xda29('0x16')]();}}function _0x5e5863(_0xceea9b){try{if(_0xceea9b){var _0x5b62b9=JSON[_0xda29('0x17')](_0xceea9b);switch(_0x5b62b9[_0xda29('0x18')]){case 0x0:if(_0x5b62b9[_0xda29('0x19')]){if(_0x5b62b9['result'][_0xda29('0x1a')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x5b62b9[_0xda29('0x19')][_0xda29('0x1b')]));_0x36fccd=_0x5b62b9['result']['hypotheses'][0x0][_0xda29('0x1c')];_0x1165fd=_0x5b62b9[_0xda29('0x19')][_0xda29('0x1b')][0x0][_0xda29('0x1d')];_0x37633e='0';_0x2549dd=_0xda29('0x1e');_0x7eb04[_0xda29('0x16')]();}}break;case 0x1:logger[_0xda29('0x5')](_0xda29('0x8'));_0x37633e='1';_0x2549dd=_0xda29('0x8');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x37633e='2';_0x2549dd='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xda29('0x5')](_0xda29('0x1f'));_0x37633e='9';_0x2549dd=_0xda29('0x1f');break;case 0xa:logger[_0xda29('0x5')](_0xda29('0x20'));_0x37633e='10';_0x2549dd=_0xda29('0x20');break;case 0xb:logger['info'](_0xda29('0x21'));_0x37633e='11';_0x2549dd=_0xda29('0x21');}}}catch(_0x556f22){logger[_0xda29('0x15')](_0xda29('0x22'),JSON['stringify'](_0x556f22));_0x7eb04[_0xda29('0x16')]();}}function _0x1bd527(){logger[_0xda29('0x5')](_0xda29('0x23'));_0x4aeb24({'transcript':_0x36fccd,'confidence':_0x1165fd,'status':_0x37633e,'status_message':_0x2549dd});}function _0x3b47fb(_0x384d11){logger[_0xda29('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x384d11)){logger[_0xda29('0x15')](_[_0xda29('0x24')](_0x384d11)?JSON['stringify'](_0x384d11):_0x384d11);}}_0x7eb04['on'](_0xda29('0x25'),_0x53159d);_0x7eb04['on']('message',_0x5e5863);_0x7eb04['on']('close',_0x1bd527);_0x7eb04['on']('error',_0x3b47fb);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index c58b9b0..4f66432 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2aa=['exports','./asr'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0xb2aa,0x125));var _0xab2a=function(_0x1c5a20,_0x502192){_0x1c5a20=_0x1c5a20-0x0;var _0x4e9e95=_0xb2aa[_0x1c5a20];return _0x4e9e95;};var asr=require(_0xab2a('0x0'));module[_0xab2a('0x1')]={'asr':asr}; \ No newline at end of file +var _0x2237=['exports'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x2237,0x1b2));var _0x7223=function(_0x3fa3d2,_0x464f20){_0x3fa3d2=_0x3fa3d2-0x0;var _0x40e0b6=_0x2237[_0x3fa3d2];return _0x40e0b6;};var asr=require('./asr');module[_0x7223('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f722a5a..9e0fb41 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x4557dc,_0x3687b2){var _0x1377aa=function(_0x41c62a){while(--_0x41c62a){_0x4557dc['push'](_0x4557dc['shift']());}};_0x1377aa(++_0x3687b2);}(_0xe706,0xa3));var _0x6e70=function(_0x2b8810,_0x55efdb){_0x2b8810=_0x2b8810-0x0;var _0x4c0f41=_0xe706[_0x2b8810];return _0x4c0f41;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index f7268a8..a5ae261 100644 --- a/server/services/agi/vertices.js +++ b/server/services/agi/vertices.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe181=['Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','email','Smtp','bcc','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','open','error','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','uniqueid','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','agicommand','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','true','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','streamFile','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set'];(function(_0x2f76fb,_0x2bd6ff){var _0x35b1af=function(_0x317c1e){while(--_0x317c1e){_0x2f76fb['push'](_0x2f76fb['shift']());}};_0x35b1af(++_0x2bd6ff);}(_0xe181,0x68));var _0x1e18=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xe181[_0x4849f6];return _0x1a3dcd;};'use strict';var fs=require('fs');var util=require(_0x1e18('0x0'));var _=require('lodash');var sh=require(_0x1e18('0x1'));var odbc=require(_0x1e18('0x2'))();var rs=require(_0x1e18('0x3'));var moment=require(_0x1e18('0x4'));var Mustache=require(_0x1e18('0x5'));var rp=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('agi');var config=require(_0x1e18('0x8'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x1e18('0x9'),_0x1e18('0xa')];var verticesWithRetry=[_0x1e18('0xb'),_0x1e18('0xc'),_0x1e18('0xd')];var AGIVertices=function(_0x398f77,_0x5e6cd3,_0x2c95a2){this[_0x1e18('0xe')]=_0x398f77;this[_0x1e18('0xf')]=_0x5e6cd3;this[_0x1e18('0x10')]=_0x2c95a2;};AGIVertices[_0x1e18('0x11')][_0x1e18('0x12')]=function(_0x56f13a,_0x13f018){this[_0x1e18('0xf')][_0x1e18('0x13')](_0x56f13a)[_0x1e18('0x14')](function(_0xf643ab){_0x13f018(null,_0xf643ab?_0xf643ab[_0x1e18('0x15')]:![]);})[_0x1e18('0x16')](function(_0x33a98d){_0x13f018(_0x33a98d);});};AGIVertices['prototype'][_0x1e18('0x17')]=function(_0x5ce0f2,_0x45ba05){this['rpc'][_0x1e18('0x18')](_0x5ce0f2)[_0x1e18('0x14')](function(_0x162744){_0x45ba05(null,_0x162744?_0x162744[_0x1e18('0x15')]:![]);})[_0x1e18('0x16')](function(_0x1e1ce6){_0x45ba05(_0x1e1ce6);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x19')]=function(_0x134863,_0x3f5f61){this[_0x1e18('0xf')][_0x1e18('0x1a')](_0x134863)[_0x1e18('0x14')](function(_0x4033da){_0x3f5f61(null,_0x4033da?_0x4033da[_0x1e18('0x15')]:![]);})['catch'](function(_0x1c91d2){_0x3f5f61(_0x1c91d2);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x1b')]=function(_0x16fa70,_0x2834ee){this[_0x1e18('0xf')][_0x1e18('0x1c')](_0x16fa70)[_0x1e18('0x14')](function(_0x2e849d){_0x2834ee(null,_0x2e849d?_0x2e849d[_0x1e18('0x1d')]:![]);})[_0x1e18('0x16')](function(_0x8ca08d){_0x2834ee(_0x8ca08d);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x1e')]=function(_0x190fd9,_0x975df0){this[_0x1e18('0xf')]['getUserById'](_0x190fd9)[_0x1e18('0x14')](function(_0xdf07d0){_0x975df0(null,_0xdf07d0?_0xdf07d0[_0x1e18('0x15')]:![]);})['catch'](function(_0xf74622){_0x975df0(_0xf74622);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x1f')]=function(_0x395e7e,_0x4c4309){this['rpc'][_0x1e18('0x20')](_0x395e7e)['then'](function(_0x5bb03c){_0x4c4309(null,_0x5bb03c?_0x5bb03c['name']:![]);})[_0x1e18('0x16')](function(_0x29cac0){_0x4c4309(_0x29cac0);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x21')]=function(_0x3a95c1,_0x38fca8){var _0x167f67=this;this[_0x1e18('0xf')][_0x1e18('0x22')](_0x3a95c1)[_0x1e18('0x14')](function(_0x1015a3){_0x38fca8(null,_0x1015a3?_0x167f67[_0x1e18('0x23')](_0x1015a3[_0x1e18('0x24')]):![]);})[_0x1e18('0x16')](function(_0x558d01){_0x38fca8(_0x558d01);});};AGIVertices[_0x1e18('0x11')]['getMailAccount']=function(_0x441f85,_0x1baf4f){this[_0x1e18('0xf')][_0x1e18('0x25')](_0x441f85)[_0x1e18('0x14')](function(_0x93dd11){_0x1baf4f(null,_0x93dd11?_0x93dd11:![]);})[_0x1e18('0x16')](function(_0x799f2){_0x1baf4f(_0x799f2);});};AGIVertices['prototype'][_0x1e18('0x26')]=function(_0xc7afe2,_0x5d4df9,_0xd83059){this[_0x1e18('0x10')][_0x1e18('0x26')](_0xc7afe2,_0x5d4df9)['then'](function(){_0xd83059(null);})[_0x1e18('0x16')](function(_0x5597ab){_0xd83059(_0x5597ab);});};AGIVertices['prototype']['getIntervals']=function(_0xa4fe9e,_0x48b89f){this[_0x1e18('0xf')][_0x1e18('0x27')](_0xa4fe9e)[_0x1e18('0x14')](function(_0x5c7d0f){if(_0x5c7d0f){if(_0x5c7d0f['IntervalId']){_0x48b89f(null,[_0x5c7d0f[_0x1e18('0x28')]]);}else{_0x48b89f(null,_[_0x1e18('0x29')](_0x5c7d0f[_0x1e18('0x2a')],_0x1e18('0x28')));}}else{_0x48b89f(null,![]);}})[_0x1e18('0x16')](function(_0x9e2c67){_0x48b89f(_0x9e2c67);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x23')]=function(_0x8cc8b0){return util[_0x1e18('0x2b')](_0x1e18('0x2c'),FILES_PATH,_0x8cc8b0);};AGIVertices[_0x1e18('0x11')]['getQueryOdbc']=function(_0x51d59f,_0x3a007e,_0x267213){odbc[_0x1e18('0x2d')](_0x51d59f,function(_0x5725e5){if(_0x5725e5){logger[_0x1e18('0x2e')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5725e5);_0x267213(_0x5725e5);}else{logger[_0x1e18('0x2f')]('ODBC\x20connection\x20successfully');odbc['query'](_0x3a007e,function(_0x3e8641,_0x11e13d){if(_0x3e8641){logger[_0x1e18('0x2f')](_0x1e18('0x30'),_0x3a007e);_0x267213(_0x3e8641);}else{logger[_0x1e18('0x2f')](_0x1e18('0x31'),_0x3a007e);odbc['close'](function(_0x2f228f){if(_0x2f228f){logger[_0x1e18('0x2e')](_0x1e18('0x32'),_0x2f228f);}_0x267213(null,_0x11e13d);});}});}});};AGIVertices[_0x1e18('0x11')]['getSmsAccount']=function(_0x11f839,_0x560696){this[_0x1e18('0xf')][_0x1e18('0x33')](_0x11f839)['then'](function(_0x41c2bd){_0x560696(null,_0x41c2bd?_0x41c2bd:![]);})[_0x1e18('0x16')](function(_0x4e47ee){_0x560696(_0x4e47ee);});};AGIVertices['prototype']['createSmsMessage']=function(_0x35ae99,_0x3b3771){this[_0x1e18('0xf')][_0x1e18('0x34')](_0x35ae99)[_0x1e18('0x14')](function(_0x173812){_0x3b3771(null,_0x173812);})[_0x1e18('0x16')](function(_0x145e03){_0x3b3771(_0x145e03);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x35')]=function(_0x16ee40,_0x4821f9,_0x228ca1){this['rpc'][_0x1e18('0x35')]({'uniqueid':this[_0x1e18('0xe')]['uniqueid'],'node':_0x16ee40['label'],'application':_0x16ee40['agicommand'],'data':_0x4821f9||null,'project_name':this[_0x1e18('0xe')][_0x1e18('0x36')],'callerid':this['channel'][_0x1e18('0x37')]})[_0x1e18('0x14')](function(_0x4b0a74){if(_0x228ca1){_0x228ca1(null,_0x4b0a74);}})['catch'](function(_0x171f7f){if(_0x228ca1){_0x228ca1(_0x171f7f);}});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x38')]=function(_0x1d6ab5,_0x3e8af3,_0x132ea5,_0x12e589){this[_0x1e18('0xf')][_0x1e18('0x38')]({'uniqueid':this[_0x1e18('0xe')]['uniqueid'],'callerid':this['channel'][_0x1e18('0x37')],'calleridname':this[_0x1e18('0xe')][_0x1e18('0x39')],'context':this[_0x1e18('0xe')][_0x1e18('0x3a')],'extension':this[_0x1e18('0xe')][_0x1e18('0x3b')],'priority':this['channel']['priority'],'accountcode':this['channel'][_0x1e18('0x3c')],'dnid':this[_0x1e18('0xe')][_0x1e18('0x3d')],'projectName':this[_0x1e18('0xe')][_0x1e18('0x36')],'saveName':_0x3e8af3,'filename':_0x1d6ab5[_0x1e18('0x3e')]||_0x3e8af3,'savePath':_0x132ea5})[_0x1e18('0x14')](function(_0x190af4){_0x12e589(null,_0x190af4);})[_0x1e18('0x16')](function(_0x181ad9){_0x12e589(_0x181ad9);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x3f')]=function(_0x46f264,_0x222794,_0x6b0367,_0x45ed61,_0x45363c){this[_0x1e18('0xf')][_0x1e18('0x3f')]({'uniqueid':this[_0x1e18('0xe')]['uniqueid'],'body':_0x46f264,'direction':_0x222794,'providerName':_0x6b0367,'providerResponse':_0x45ed61})[_0x1e18('0x14')](function(_0x17a8ac){if(_0x45363c){_0x45363c(null,_0x17a8ac);}})[_0x1e18('0x16')](function(_0x24ad42){if(_0x45363c){_0x45363c(_0x24ad42);}});};AGIVertices[_0x1e18('0x11')]['createCmContact']=function(_0x4d2c96,_0x16b51a){this[_0x1e18('0xf')]['createCmContact']({'firstName':_[_0x1e18('0x40')](_0x4d2c96[_0x1e18('0x15')])||_[_0x1e18('0x41')](_0x4d2c96['name'])?_0x1e18('0x42')+Math[_0x1e18('0x43')]():_0x4d2c96[_0x1e18('0x15')],'lastName':_[_0x1e18('0x40')](_0x4d2c96[_0x1e18('0x44')])||_['isNil'](_0x4d2c96[_0x1e18('0x44')])?null:_0x4d2c96['lastName'],'phone':_0x4d2c96['phone'],'ListId':_0x4d2c96[_0x1e18('0x45')],'scheduledat':_0x4d2c96[_0x1e18('0x46')],'callbackUniqueid':this[_0x1e18('0xe')][_0x1e18('0x47')],'tags':_0x1e18('0x48'),'description':_0x1e18('0x49')+_0x4d2c96['scheduledAt'][_0x1e18('0x4a')](),'priority':_0x4d2c96[_0x1e18('0x4b')]})[_0x1e18('0x14')](function(_0x503427){_0x16b51a(null,_0x503427);})[_0x1e18('0x16')](function(_0x939d13){_0x16b51a(_0x939d13);});};AGIVertices['prototype'][_0x1e18('0x4c')]=function(_0x5d92f3,_0x3483e7){this[_0x1e18('0xf')][_0x1e18('0x4d')](_0x5d92f3)[_0x1e18('0x14')](function(_0x127af3){_0x3483e7(null,_0x127af3?_0x127af3[_0x1e18('0x15')]:![]);})[_0x1e18('0x16')](function(_0x4135ad){_0x3483e7(_0x4135ad);});};AGIVertices['prototype'][_0x1e18('0x4e')]=function(_0x3baa8d,_0x5a5881,_0x380dd5){var _0x57418e={'role':'agent'};_0x57418e[_0x3baa8d]=this[_0x1e18('0xe')][_0x1e18('0x37')];this[_0x1e18('0xf')][_0x1e18('0x4e')](_0x57418e,_0x5a5881,this['channel'][_0x1e18('0x47')])[_0x1e18('0x14')](function(_0x27def7){_0x380dd5(null,_['isNil'](_0x27def7)?![]:!![]);})['catch'](function(_0x19590a){logger['error'](_0x19590a);_0x380dd5(null,![]);});};AGIVertices['prototype'][_0x1e18('0x4f')]=function(_0x21f20c,_0x16b888){var _0x1cc94c={'role':_0x1e18('0x50')};_0x1cc94c[_0x21f20c]=this[_0x1e18('0xe')][_0x1e18('0x37')];this[_0x1e18('0xf')][_0x1e18('0x4f')](_0x1cc94c)[_0x1e18('0x14')](function(_0xdaa50d){_0x16b888(null,_[_0x1e18('0x41')](_0xdaa50d)?![]:!![]);})[_0x1e18('0x16')](function(_0x2edcf3){logger[_0x1e18('0x2e')](_0x2edcf3);_0x16b888(null,![]);});};AGIVertices[_0x1e18('0x11')]['agentLogout']=function(_0x27a98a,_0x5d54b5){var _0xcfb619={'role':_0x1e18('0x50')};_0xcfb619[_0x27a98a]=this[_0x1e18('0xe')][_0x1e18('0x37')];this['rpc'][_0x1e18('0x51')](_0xcfb619)['then'](function(_0x57a472){_0x5d54b5(null,_['isNil'](_0x57a472)?![]:!![]);})['catch'](function(_0x35d509){logger[_0x1e18('0x2e')](_0x35d509);_0x5d54b5(null,![]);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x52')]=function(_0x3651ff,_0x2f39d5){var _0x359b0c={'role':'agent'};_0x359b0c[_0x3651ff]=this[_0x1e18('0xe')][_0x1e18('0x37')];var _0x803c8e=_0x3651ff!='internal'?util['format']('%s/%s@from-sip/n',_0x1e18('0x53'),this[_0x1e18('0xe')][_0x1e18('0x37')]):undefined;this['rpc'][_0x1e18('0x52')](_0x359b0c,_0x803c8e)[_0x1e18('0x14')](function(_0x28f1ff){_0x2f39d5(null,_[_0x1e18('0x41')](_0x28f1ff)?![]:!![]);})['catch'](function(_0x60c240){logger['error'](_0x60c240);_0x2f39d5(null,![]);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x54')]=function(_0x48cc14,_0x2f39a4){sh[_0x1e18('0x55')](_[_0x1e18('0x56')](_0x48cc14),function(_0xf6809a,_0x3a3430){var _0x22d89c=_0x3a3430[_0x1e18('0x57')](/(\r\n|\n|\r)/gm,'');_0x2f39a4(null,_0x22d89c);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x58')]=function(_0x3f4c9f,_0x51ac88){scripts['googleCloudTTS'](_0x3f4c9f[_0x1e18('0x59')],_0x3f4c9f['google_cloud_tts_text_type']||'text',_0x3f4c9f[_0x1e18('0x5a')],_0x3f4c9f[_0x1e18('0x5b')]||_0x1e18('0x5c'),_0x3f4c9f[_0x1e18('0x5d')]||_0x1e18('0x5e'),_0x3f4c9f['audioEncoding']||_0x1e18('0x5f'))[_0x1e18('0x14')](function(_0x295b88){_0x51ac88(null,_0x295b88);})['catch'](function(_0x3a574e){_0x51ac88(_0x3a574e);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x60')]=function(_0x452306,_0x185bd9){scripts['googleTTS'](_0x452306[_0x1e18('0x5a')],_0x452306[_0x1e18('0x61')]||'en',0x1)[_0x1e18('0x14')](function(_0x6f0277){_0x185bd9(null,_0x6f0277);})['catch'](function(_0x3706ce){_0x185bd9(_0x3706ce);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x62')]=function(_0x2075b8,_0x24c46c){var _0x3b0870={'uri':_0x2075b8[_0x1e18('0x63')],'method':_0x2075b8[_0x1e18('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2075b8[_0x1e18('0x65')])==='number'&&parseInt(_0x2075b8[_0x1e18('0x65')])>=0x1?parseInt(_0x2075b8[_0x1e18('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x1e18('0x66')](['POST',_0x1e18('0x67')],_0x3b0870[_0x1e18('0x64')]['toUpperCase']())){try{_0x3b0870[_0x1e18('0x68')]=_0x2075b8['rawBody']?JSON[_0x1e18('0x69')](_0x2075b8['rawBody']):{};}catch(_0x15e099){logger[_0x1e18('0x2e')](_0x1e18('0x6a'),_0x15e099);}}try{_0x3b0870['headers']=_0x2075b8[_0x1e18('0x9')]?JSON[_0x1e18('0x69')](_0x2075b8[_0x1e18('0x9')]):{};}catch(_0x4c9bf8){logger[_0x1e18('0x2e')](_0x1e18('0x6b'),_0x4c9bf8);}if(_0x2075b8[_0x1e18('0x6c')]){try{var _0x40e300=require(_0x2075b8[_0x1e18('0x6c')])[_0x1e18('0x6d')](this,_0x3b0870);_0x3b0870['uri']=Mustache[_0x1e18('0x6e')](_0x2075b8[_0x1e18('0x63')],_0x40e300,{},['$$','$$']);if(_0x3b0870[_0x1e18('0x6f')]){_0x3b0870[_0x1e18('0x6f')]=JSON[_0x1e18('0x69')](Mustache[_0x1e18('0x6e')](JSON[_0x1e18('0x70')](_0x3b0870[_0x1e18('0x6f')]),_0x40e300,{},['$$','$$']));}if(_0x3b0870[_0x1e18('0x68')]){_0x3b0870[_0x1e18('0x68')]=JSON[_0x1e18('0x69')](Mustache[_0x1e18('0x6e')](JSON[_0x1e18('0x70')](_0x3b0870['body']),_0x40e300,{},['$$','$$']));}}catch(_0xa5086){logger[_0x1e18('0x2e')](_0x1e18('0x71'),_0xa5086);}}rp(_0x3b0870)[_0x1e18('0x14')](function(_0x3c4670){var _0x36959a={'statusCode':_0x3c4670[_0x1e18('0x72')]||0xc8,'statusMessage':_0x3c4670[_0x1e18('0x73')]||'OK','headers':_0x3c4670[_0x1e18('0x6f')]||{},'body':_0x3c4670[_0x1e18('0x68')]||{}};_0x24c46c(null,_0x36959a);})[_0x1e18('0x16')](function(_0xdeb197){var _0x56baf1={'statusCode':_0xdeb197[_0x1e18('0x72')]||0x1f4,'statusMessage':_0xdeb197[_0x1e18('0x74')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0xdeb197[_0x1e18('0x75')][_0x1e18('0x6f')]||{},'body':_0xdeb197['options'][_0x1e18('0x68')]||{}};_0x24c46c(null,_0x56baf1);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x76')]=function(_0x511109,_0x33e464){scripts[_0x1e18('0x76')](this[_0x1e18('0xe')][_0x1e18('0x47')],_0x511109[_0x1e18('0x77')],_0x511109[_0x1e18('0x5a')],_0x511109[_0x1e18('0x78')]||'en')[_0x1e18('0x14')](function(_0x2c3d3b){_0x33e464(null,_0x2c3d3b);})[_0x1e18('0x16')](function(_0xd4c48d){_0x33e464(_0xd4c48d);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x79')]=function(_0x38bba5,_0x54c6a6){scripts[_0x1e18('0x79')](this['channel'][_0x1e18('0x47')],_0x38bba5[_0x1e18('0x7a')],_0x38bba5[_0x1e18('0x7b')],_0x38bba5['private_key'],_0x38bba5[_0x1e18('0x5a')],_0x38bba5[_0x1e18('0x7c')]||'en')[_0x1e18('0x14')](function(_0x1f520d){_0x54c6a6(null,_0x1f520d);})[_0x1e18('0x16')](function(_0x5082d0){_0x54c6a6(_0x5082d0);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x7d')]=function(_0x31944a,_0x1b6d8e){scripts['sestekNDA'](this[_0x1e18('0xe')],_0x31944a)['then'](function(_0x44bd99){_0x1b6d8e(null,_0x44bd99);})[_0x1e18('0x16')](function(_0x379dcf){_0x1b6d8e(_0x379dcf);});};AGIVertices[_0x1e18('0x11')]['ispeechTTS']=function(_0x5c5cd2,_0x50b2c7){scripts['ispeechTTS'](_0x5c5cd2[_0x1e18('0x77')],_0x5c5cd2[_0x1e18('0x5a')],_0x5c5cd2[_0x1e18('0x7e')]||'en-US',_0x5c5cd2[_0x1e18('0x7f')])['then'](function(_0x563974){_0x50b2c7(null,_0x563974);})['catch'](function(_0x57934c){_0x50b2c7(_0x57934c);});};AGIVertices['prototype']['ispeechASR']=function(_0x33c4bf,_0x18a71a,_0x196b16){scripts[_0x1e18('0x80')](_0x18a71a,_0x33c4bf[_0x1e18('0x77')],_0x33c4bf[_0x1e18('0x81')]||_0x1e18('0x5c'),this[_0x1e18('0x82')](_0x33c4bf['model'])?_0x33c4bf[_0x1e18('0x83')]:undefined)[_0x1e18('0x14')](function(_0xd53a90){_0x196b16(null,_0xd53a90);})[_0x1e18('0x16')](function(_0x29bd6c){_0x196b16(_0x29bd6c);});};AGIVertices[_0x1e18('0x11')]['awsPolly']=function(_0x165bf7,_0x1b9f06){scripts[_0x1e18('0x84')](_0x165bf7[_0x1e18('0x85')],_0x165bf7[_0x1e18('0x86')],_0x165bf7[_0x1e18('0x87')],_0x165bf7[_0x1e18('0x88')]||_0x1e18('0x89'),_0x165bf7[_0x1e18('0x5a')],_0x165bf7[_0x1e18('0x8a')]||_0x1e18('0x5a'))[_0x1e18('0x14')](function(_0x561946){_0x1b9f06(null,_0x561946);})['catch'](function(_0x3693f1){_0x1b9f06(_0x3693f1);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x8b')]=function(_0x2ce7a7,_0x6483fe){scripts[_0x1e18('0x8b')](this[_0x1e18('0xe')][_0x1e18('0x47')],_0x2ce7a7[_0x1e18('0x85')],_0x2ce7a7[_0x1e18('0x86')],_0x2ce7a7['aws_lex_region'],_0x2ce7a7[_0x1e18('0x5a')],_0x2ce7a7[_0x1e18('0x8c')])[_0x1e18('0x14')](function(_0x3b431a){_0x6483fe(null,_0x3b431a);})[_0x1e18('0x16')](function(_0x10b4ad){_0x6483fe(_0x10b4ad);});};AGIVertices[_0x1e18('0x11')][_0x1e18('0x8d')]=function(_0x3372ad,_0x284d1c,_0x37e4f0){scripts[_0x1e18('0x8d')](_0x284d1c,_0x3372ad[_0x1e18('0x77')],_0x3372ad[_0x1e18('0x8e')]||_0x1e18('0x5c'))[_0x1e18('0x14')](function(_0x4659f1){_0x37e4f0(null,_0x4659f1);})[_0x1e18('0x16')](function(_0x42a123){_0x37e4f0(_0x42a123);});};AGIVertices[_0x1e18('0x11')]['tildeASR']=function(_0x1e384d,_0x15bb32,_0x49ee04){scripts[_0x1e18('0x8f')](_0x15bb32,_0x1e384d[_0x1e18('0x90')],_0x1e384d[_0x1e18('0x91')],_0x1e384d['uri'])[_0x1e18('0x14')](function(_0x5b9c49){_0x49ee04(null,_0x5b9c49);})[_0x1e18('0x16')](function(_0x5d91c6){_0x49ee04(_0x5d91c6);});};AGIVertices[_0x1e18('0x11')]['clear']=function(_0x40651b){var _0x14879c=_['includes'](verticesWithRetry,_0x40651b[_0x1e18('0x92')])?_0x40651b:_['clone'](_0x40651b);for(var _0x5a877a in _0x14879c){if(_0x14879c[_0x1e18('0x93')](_0x5a877a)){if(_0x14879c[_0x5a877a]&&_['isString'](_0x14879c[_0x5a877a])){if(_[_0x1e18('0x66')](recursiveMapAttributes,_0x5a877a)){_0x14879c[_0x5a877a]=this[_0x1e18('0x94')](_0x14879c[_0x5a877a]);}else{_0x14879c[_0x5a877a]=this[_0x1e18('0x95')](_0x14879c[_0x5a877a]);}}}}return _0x14879c;};AGIVertices[_0x1e18('0x11')][_0x1e18('0x96')]=function(_0x1fe425){for(var _0x185318 in _0x1fe425){if(_0x1fe425[_0x1e18('0x93')](_0x185318)){if(_[_0x1e18('0x97')](_0x1fe425[_0x185318])){this[_0x1e18('0x96')](_0x1fe425[_0x185318]);}else if(_[_0x1e18('0x98')](_0x1fe425[_0x185318])){for(var _0x12fcfe=0x0;_0x12fcfe<_0x1fe425[_0x185318][_0x1e18('0x99')];_0x12fcfe++){this[_0x1e18('0x96')](_0x1fe425[_0x185318][_0x12fcfe]);}}else if(_[_0x1e18('0x9a')](_0x1fe425[_0x185318])){_0x1fe425[_0x185318]=this[_0x1e18('0x95')](_0x1fe425[_0x185318]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x44f8f7,_0x311179){for(var _0x292c32 in _0x44f8f7){if(_0x44f8f7[_0x1e18('0x93')](_0x292c32)){if(_[_0x1e18('0x97')](_0x44f8f7[_0x292c32])){if(!_[_0x1e18('0x40')](_0x44f8f7[_0x292c32])){this[_0x1e18('0x9b')](_0x44f8f7[_0x292c32],util[_0x1e18('0x2b')](_0x1e18('0x9c'),_0x311179,_0x292c32));}}else if(_[_0x1e18('0x98')](_0x44f8f7[_0x292c32])){for(var _0x280bc6=0x0;_0x280bc6<_0x44f8f7[_0x292c32][_0x1e18('0x99')];_0x280bc6++){this['saveRestApiResult'](_0x44f8f7[_0x292c32][_0x280bc6],util[_0x1e18('0x2b')]('%s.%s',_0x311179,_0x292c32+'['+_0x280bc6+']'));}}else{if(!_[_0x1e18('0x41')](_0x44f8f7[_0x292c32])){this[_0x1e18('0xe')]['setVariable'](util[_0x1e18('0x2b')](_0x1e18('0x9c'),_0x311179,_0x292c32),_0x44f8f7[_0x292c32]);}}}}};AGIVertices[_0x1e18('0x11')]['replaceObjectAllVariables']=function(_0x1c7119){try{var _0x477918=JSON[_0x1e18('0x69')](_0x1c7119);this[_0x1e18('0x96')](_0x477918);return JSON[_0x1e18('0x70')](_0x477918);}catch(_0x24d86c){return this[_0x1e18('0x95')](_0x1c7119);}};AGIVertices[_0x1e18('0x11')][_0x1e18('0x95')]=function(_0x9a3df0){var _0x149814=_0x9a3df0[_0x1e18('0x9d')]('{');for(var _0x38b10d=0x1;_0x38b10d<_0x149814[_0x1e18('0x99')];_0x38b10d+=0x1){var _0x129f13=_0x149814[_0x38b10d]['split']('}');if(_0x129f13[_0x1e18('0x99')]>0x1){_0x9a3df0=_0x9a3df0['replaceAll']('{'+_0x129f13[0x0]+'}',this['channel'][_0x1e18('0x12')](_0x129f13[0x0])[_0x1e18('0x9e')]||_0x129f13[0x0]);}}if(_0x149814[_0x1e18('0x99')]===0x1){return _0x9a3df0[_0x1e18('0x4a')]();}return this[_0x1e18('0x95')](_0x9a3df0);};AGIVertices[_0x1e18('0x11')][_0x1e18('0x9f')]=function(_0x4ba3b7,_0x52ecfa){var _0x25d3a6=this[_0x1e18('0xe')][_0x1e18('0x12')](_0x4ba3b7);if(_0x25d3a6[_0x1e18('0xa0')]===-0x1){return _0x25d3a6;}logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0xa1'),_0x52ecfa,_0x25d3a6[_0x1e18('0x9e')]));return this[_0x1e18('0xe')][_0x1e18('0xa2')](_0x52ecfa,_0x25d3a6[_0x1e18('0x9e')]);};AGIVertices[_0x1e18('0x11')][_0x1e18('0x82')]=function(_0x51eb1d){return _0x51eb1d&&_0x51eb1d!=='0'&&_0x51eb1d!=='-1'&&_0x51eb1d!=='';};AGIVertices[_0x1e18('0x11')][_0x1e18('0xa3')]=function(_0x47a0fa){this['createSquareDetailsReport']['sync'](this,_0x47a0fa,'-');_0x47a0fa[_0x1e18('0xa4')]=_0x47a0fa['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1e18('0x11')][_0x1e18('0xa5')]=function(_0x333064){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x333064[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x333064['text'])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xa8'));}var _0x3065ca='\x22'+_0x333064['text']+'\x22';if(this[_0x1e18('0x82')](_0x333064[_0x1e18('0x75')])){_0x3065ca+=','+_0x333064[_0x1e18('0x75')];}var _0x3ae985=this['channel'][_0x1e18('0x55')](_0x1e18('0xa9'),_0x3065ca);if(_0x3ae985[_0x1e18('0xa0')]===-0x1){return _0x3ae985;}return this[_0x1e18('0xe')]['noop'](util['format'](_0x1e18('0xaa'),_0x3065ca));};AGIVertices[_0x1e18('0x11')][_0x1e18('0xab')]=function(_0x54ab77){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0xac'),_0x54ab77[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x54ab77[_0x1e18('0xad')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20grammar\x20configured');}var _0x107e18=_0x54ab77[_0x1e18('0xad')];if(this['isConfigured'](_0x54ab77[_0x1e18('0x75')])){_0x107e18+=','+_0x54ab77[_0x1e18('0x75')];}var _0x47c989=this['channel'][_0x1e18('0x55')]('MRCPRecog',_0x107e18);if(_0x47c989[_0x1e18('0xa0')]===-0x1){return _0x47c989;}var _0x1a638a=this[_0x1e18('0x9f')]('RECOG_CONFIDENCE()',_0x1e18('0xae'));if(_0x1a638a[_0x1e18('0xa0')]===-0x1){return _0x1a638a;}var _0x50f9d3=this[_0x1e18('0x9f')](_0x1e18('0xaf'),_0x1e18('0xb0'));if(_0x50f9d3[_0x1e18('0xa0')]===-0x1){return _0x50f9d3;}var _0x1956b0=this[_0x1e18('0x9f')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x1956b0[_0x1e18('0xa0')]===-0x1){return _0x1956b0;}return this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0xb1'),_0x107e18));};AGIVertices['prototype'][_0x1e18('0xb2')]=function(_0x5cb95a){logger[_0x1e18('0x2f')](util['format'](_0x1e18('0xb3'),_0x5cb95a[_0x1e18('0xa6')]));return this[_0x1e18('0xe')][_0x1e18('0xb2')]([_0x5cb95a['command'],_0x5cb95a[_0x1e18('0xb4')]]);};AGIVertices[_0x1e18('0x11')][_0x1e18('0xb5')]=function(_0xf7e7d3){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0xb6'),_0xf7e7d3['label']));if(this[_0x1e18('0x82')](_0xf7e7d3[_0x1e18('0x65')])){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0xb7'),_0xf7e7d3[_0x1e18('0x65')]));var _0x12a5db=this[_0x1e18('0xe')][_0x1e18('0xb8')](_0xf7e7d3[_0x1e18('0x65')]);if(_0x12a5db[_0x1e18('0xa0')]===-0x1){return _0x12a5db;}}return this[_0x1e18('0xe')][_0x1e18('0xb5')]();};AGIVertices['prototype'][_0x1e18('0x48')]=function(_0x581e70){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0xb9'),_0x581e70[_0x1e18('0xa6')]));if(!this['isConfigured'](_0x581e70['list_id'])){return this['channel'][_0x1e18('0x2e')](_0x581e70,_0x1e18('0xba'));}_0x581e70[_0x1e18('0x46')]=moment();if(this[_0x1e18('0x82')](_0x581e70[_0x1e18('0xbb')])){_0x581e70[_0x1e18('0x46')]=moment()[_0x1e18('0xbc')](_0x581e70[_0x1e18('0xbb')],_0x1e18('0xbd'));}if(!this[_0x1e18('0x82')](_0x581e70[_0x1e18('0x4b')])){_0x581e70[_0x1e18('0x4b')]=0x2;}this['createCmContact'][_0x1e18('0x6d')](this,_0x581e70);return this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0xbe'),_0x581e70[_0x1e18('0xbf')],_0x581e70[_0x1e18('0x45')],_0x581e70[_0x1e18('0x46')]));};AGIVertices[_0x1e18('0x11')][_0x1e18('0xc0')]=function(_0x18d041){logger['info'](util['format'](_0x1e18('0xc1'),_0x18d041[_0x1e18('0xa6')]));var _0x54ee40=this[_0x1e18('0xe')]['exec'](_0x18d041[_0x1e18('0xc2')],_0x18d041[_0x1e18('0x75')]);if(_0x54ee40['result']===-0x1){return _0x54ee40;}return this['channel']['noop'](util[_0x1e18('0x2b')](_0x1e18('0xc3'),_0x18d041[_0x1e18('0xc2')],_0x18d041[_0x1e18('0x75')]));};AGIVertices[_0x1e18('0x11')]['lumenvoxtts']=function(_0x2de0f0){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2de0f0['label']));if(!this[_0x1e18('0x82')](_0x2de0f0[_0x1e18('0x5a')])){return this[_0x1e18('0xe')]['noop'](_0x1e18('0xa8'));}var _0x5c102d='\x22'+_0x2de0f0[_0x1e18('0x5a')]+'\x22';if(this['isConfigured'](_0x2de0f0['options'])){_0x5c102d+=','+_0x2de0f0[_0x1e18('0x75')];}var _0x3b0377=this[_0x1e18('0xe')]['exec'](_0x1e18('0xa9'),_0x5c102d);if(_0x3b0377[_0x1e18('0xa0')]===-0x1){return _0x3b0377;}return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0xaa'),_0x5c102d));};AGIVertices[_0x1e18('0x11')]['sestektts']=function(_0xe75d1e){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0xc4'),_0xe75d1e['label']));if(!this['isConfigured'](_0xe75d1e[_0x1e18('0x5a')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xa8'));}var _0x30534e='\x22'+_0xe75d1e[_0x1e18('0x5a')]+'\x22';if(this['isConfigured'](_0xe75d1e[_0x1e18('0x75')])){_0x30534e+=','+_0xe75d1e['options'];}var _0x4bf4f4=this[_0x1e18('0xe')]['exec'](_0x1e18('0xa9'),_0x30534e);if(_0x4bf4f4[_0x1e18('0xa0')]===-0x1){return _0x4bf4f4;}return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0xaa'),_0x30534e));};AGIVertices[_0x1e18('0x11')][_0x1e18('0xc5')]=function(_0xfa1b62){logger['info'](util[_0x1e18('0x2b')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0xfa1b62['label']));if(!this['isConfigured'](_0xfa1b62[_0x1e18('0xad')])){return this['channel']['noop'](_0x1e18('0xc6'));}var _0x14986b=_0xfa1b62[_0x1e18('0xad')];if(this[_0x1e18('0x82')](_0xfa1b62[_0x1e18('0x75')])){_0x14986b+=','+_0xfa1b62['options'];}var _0x20d2f4=this['channel'][_0x1e18('0x55')]('MRCPRecog',_0x14986b);if(_0x20d2f4['result']===-0x1){return _0x20d2f4;}var _0x304a34=this[_0x1e18('0x9f')](_0x1e18('0xc7'),_0x1e18('0xc8'));if(_0x304a34[_0x1e18('0xa0')]===-0x1){return _0x304a34;}var _0x50a3de=this['getAndSetVariable'](_0x1e18('0xaf'),_0x1e18('0xc9'));if(_0x50a3de['result']===-0x1){return _0x50a3de;}var _0x153f81=this[_0x1e18('0x9f')](_0x1e18('0xca'),_0x1e18('0xcb'));if(_0x153f81['result']===-0x1){return _0x153f81;}return this[_0x1e18('0xe')][_0x1e18('0xa7')](util['format'](_0x1e18('0xb1'),_0x14986b));};AGIVertices['prototype'][_0x1e18('0xcc')]=function(_0x5355d5){logger[_0x1e18('0x2f')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5355d5[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x5355d5['grammar'])){return this['channel'][_0x1e18('0xa7')]('no\x20grammar\x20configured');}var _0x5a4ec5=_0x5355d5[_0x1e18('0xad')];if(this[_0x1e18('0x82')](_0x5355d5[_0x1e18('0x75')])){_0x5a4ec5+=','+_0x5355d5[_0x1e18('0x75')];}var _0x3c34fa=this['channel'][_0x1e18('0x55')]('MRCPRecog',_0x5a4ec5);if(_0x3c34fa['result']===-0x1){return _0x3c34fa;}var _0x16d7a9=this[_0x1e18('0x9f')](_0x1e18('0xc7'),_0x1e18('0xcd'));if(_0x16d7a9[_0x1e18('0xa0')]===-0x1){return _0x16d7a9;}var _0x2a9567=this['getAndSetVariable'](_0x1e18('0xaf'),_0x1e18('0xce'));if(_0x2a9567[_0x1e18('0xa0')]===-0x1){return _0x2a9567;}var _0x565314=this[_0x1e18('0x9f')]('RECOG_INSTANCE()',_0x1e18('0xcf'));if(_0x565314[_0x1e18('0xa0')]===-0x1){return _0x565314;}return this['channel'][_0x1e18('0xa7')](util['format'](_0x1e18('0xb1'),_0x5a4ec5));};AGIVertices[_0x1e18('0x11')][_0x1e18('0xd0')]=function(_0x536cff){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0xd1'),_0x536cff['label']));if(!this[_0x1e18('0x82')](_0x536cff[_0x1e18('0xd2')])){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x536cff,_0x1e18('0xd3'));}var _0x2b896e=this[_0x1e18('0x1b')][_0x1e18('0x6d')](this,_0x536cff[_0x1e18('0xd2')]);if(!_0x2b896e){return this['channel'][_0x1e18('0x2e')](_0x536cff,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x536cff[_0x1e18('0xd4')])){return this[_0x1e18('0xe')]['error'](_0x536cff,_0x1e18('0xd5'));}var _0x13f0c9=_0x536cff[_0x1e18('0xd4')][_0x1e18('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1e18('0xe')][_0x1e18('0xa7')](util['format']('query:\x20%s',_0x13f0c9));var _0x24cfae=this[_0x1e18('0xd6')][_0x1e18('0x6d')](this,_0x2b896e,_0x13f0c9);this[_0x1e18('0x35')]['sync'](this,_0x536cff,_0x13f0c9);if(!this['isConfigured'](_0x536cff[_0x1e18('0xd7')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x21f0e7=this[_0x1e18('0x12')]['sync'](this,_0x536cff[_0x1e18('0xd7')]);if(!_0x21f0e7){return this[_0x1e18('0xe')]['error'](_0x536cff,_0x1e18('0xd8'));}var _0x11207d=this;_0x24cfae[_0x1e18('0xd9')](function(_0x2e75c9,_0x5dc8c2){Object['keys'](_0x2e75c9)['forEach'](function(_0x567f11){_0x11207d[_0x1e18('0xe')][_0x1e18('0xa2')](util['format'](_0x1e18('0xda'),_0x21f0e7,_0x5dc8c2,_0x567f11),_0x2e75c9[_0x567f11]);});});this[_0x1e18('0xe')]['setVariable'](util[_0x1e18('0x2b')]('%s_ROWS_COUNT',_0x21f0e7),_0x24cfae[_0x1e18('0x99')]);return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0xdb'),_0x21f0e7));};AGIVertices[_0x1e18('0x11')][_0x1e18('0xdc')]=function(_0x483b64){logger[_0x1e18('0xdd')](util[_0x1e18('0x2b')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x483b64[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x483b64[_0x1e18('0xde')])){return this['channel'][_0x1e18('0x2e')](_0x483b64,'no\x20user\x20selected');}var _0x59eb44=this[_0x1e18('0x1e')][_0x1e18('0x6d')](this,_0x483b64[_0x1e18('0xde')]);if(!_0x59eb44){return this[_0x1e18('0xe')]['error'](_0x483b64,_0x1e18('0xdf'));}var _0x34df96=this['channel'][_0x1e18('0x55')](_0x1e18('0xe0'),[util[_0x1e18('0x2b')](_0x1e18('0xe1'),_0x59eb44),_0x483b64[_0x1e18('0x65')],_0x483b64[_0x1e18('0xe2')],_0x483b64[_0x1e18('0x63')]]);if(_0x34df96[_0x1e18('0xa0')]===-0x1){return _0x34df96;}return this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')]('Executed\x20command\x20%s',_0x1e18('0xe0')));};AGIVertices[_0x1e18('0x11')][_0x1e18('0xe3')]=function(_0x32f228){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0xe4'),_0x32f228[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x32f228['key'])){return this[_0x1e18('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0x1e18('0x82')](_0x32f228[_0x1e18('0x5a')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20text\x20configured');}this[_0x1e18('0xe')][_0x1e18('0xe5')]=!![];this[_0x1e18('0x35')](_0x32f228);this[_0x1e18('0x3f')](_0x32f228['text'],'in','','');this['channel']['noop'](util[_0x1e18('0x2b')](_0x1e18('0xe6'),_0x32f228[_0x1e18('0x5a')]));var _0x5d008b=this[_0x1e18('0x76')][_0x1e18('0x6d')](this,_0x32f228);if(_0x5d008b){for(var _0xf4ed2d in _0x5d008b){if(_0x5d008b[_0x1e18('0x93')](_0xf4ed2d)){this[_0x1e18('0xe')][_0x1e18('0xa2')](util[_0x1e18('0x2b')](_0x1e18('0xe7'),_0xf4ed2d[_0x1e18('0xe8')]()),_0x5d008b[_0xf4ed2d]);}}this[_0x1e18('0x3f')](_0x5d008b[_0x1e18('0xe9')],_0x1e18('0xea'),_0x1e18('0xe3'),'');return this[_0x1e18('0xe')][_0x1e18('0xa7')](util['format'](_0x1e18('0xeb'),_0x5d008b[_0x1e18('0xe9')]));}return this['channel'][_0x1e18('0x2e')](_0x32f228,_0x1e18('0xec'));};AGIVertices['prototype'][_0x1e18('0xed')]=function(_0x19a414){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0xee'),_0x19a414[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x19a414[_0x1e18('0x7a')])){return this[_0x1e18('0xe')]['noop'](_0x1e18('0xef'));}if(!this[_0x1e18('0x82')](_0x19a414[_0x1e18('0x7b')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xf0'));}if(!this[_0x1e18('0x82')](_0x19a414[_0x1e18('0xf1')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xf2'));}if(!this['isConfigured'](_0x19a414['dialogflowV2_language'])){return this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20anguage\x20configured');}if(!this[_0x1e18('0x82')](_0x19a414[_0x1e18('0x5a')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xa8'));}this[_0x1e18('0xe')][_0x1e18('0xe5')]=!![];this['createSquareDetailsReport'](_0x19a414);this[_0x1e18('0x3f')](_0x19a414[_0x1e18('0x5a')],'in','','');this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0xf3'),_0x19a414['text']));var _0x5375fc=this[_0x1e18('0x79')]['sync'](this,_0x19a414);if(_0x5375fc){for(var _0x1d9b04 in _0x5375fc){if(_0x5375fc[_0x1e18('0x93')](_0x1d9b04)){if(_0x1d9b04!==_0x1e18('0xf4')){this[_0x1e18('0xe')]['setVariable'](util[_0x1e18('0x2b')](_0x1e18('0xe7'),_0x1d9b04[_0x1e18('0xe8')]()),_0x5375fc[_0x1d9b04]);}}}this['createSquareMessage'](_0x5375fc['speech'],_0x1e18('0xea'),_0x1e18('0xed'),_0x5375fc[_0x1e18('0xf4')]);return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')]('DialogflowV2\x20Result\x20%s',_0x5375fc[_0x1e18('0xe9')]));}return this['channel'][_0x1e18('0x2e')](_0x19a414,_0x1e18('0xf5'));};AGIVertices[_0x1e18('0x11')][_0x1e18('0xf6')]=function(_0x3cbac0){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0xf7'),_0x3cbac0[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x3cbac0[_0x1e18('0xf8')])){return this['channel']['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x3cbac0[_0x1e18('0xf9')])){return this[_0x1e18('0xe')]['noop'](_0x1e18('0xfa'));}if(!this[_0x1e18('0x82')](_0x3cbac0[_0x1e18('0xfb')])){return this['channel'][_0x1e18('0xa7')]('no\x20password\x20configured');}if(!this[_0x1e18('0x82')](_0x3cbac0[_0x1e18('0xfc')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xa8'));}this[_0x1e18('0xe')]['bot']=!![];this[_0x1e18('0x35')](_0x3cbac0);this[_0x1e18('0x3f')](_0x3cbac0[_0x1e18('0x5a')],'in','','');this['channel']['noop'](util[_0x1e18('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x3cbac0['text']));var _0x211ca4=this['sestekNDA'][_0x1e18('0x6d')](this,_0x3cbac0);if(_0x211ca4){for(var _0x5402bd in _0x211ca4){if(_0x211ca4[_0x1e18('0x93')](_0x5402bd)){this[_0x1e18('0xe')][_0x1e18('0xa2')](util[_0x1e18('0x2b')](_0x1e18('0xfd'),_0x5402bd['toUpperCase']()),_0x211ca4[_0x5402bd]);}}this['createSquareMessage'](_0x211ca4[_0x1e18('0xe9')],_0x1e18('0xea'),_0x1e18('0xf6'),'');if(_0x211ca4[_0x1e18('0xfe')]){this[_0x1e18('0xe')][_0x1e18('0xa7')](util['format'](_0x1e18('0xff'),_0x211ca4['audiofile']));var _0x4de951=this[_0x1e18('0xe')]['streamFile'](_0x211ca4[_0x1e18('0xfe')]);try{fs[_0x1e18('0x100')](_0x211ca4[_0x1e18('0xfe')]+_0x1e18('0x101'));}catch(_0x156a06){logger[_0x1e18('0x2e')](_0x156a06);}return _0x4de951;}else{return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x102'),_0x211ca4[_0x1e18('0xe9')]));}}return this[_0x1e18('0xe')]['error'](_0x3cbac0,_0x1e18('0x103'));};AGIVertices[_0x1e18('0x11')]['end']=function(_0x4e1d21){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x104'),_0x4e1d21['label']));return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x105'));};AGIVertices[_0x1e18('0x11')][_0x1e18('0x106')]=function(_0x3ea366){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x107'),_0x3ea366[_0x1e18('0xa6')]));var _0x2f926c='';if(_0x3ea366[_0x1e18('0x108')]){if(!this[_0x1e18('0x82')](_0x3ea366[_0x1e18('0x108')])){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x3ea366,_0x1e18('0x109'));}else{var _0x4bf619=parseInt(_0x3ea366['trunk_id'],0xa);if(isNaN(_0x4bf619)){_0x2f926c=_0x3ea366[_0x1e18('0x108')];}else{_0x2f926c=this[_0x1e18('0x1f')][_0x1e18('0x6d')](this,_0x3ea366[_0x1e18('0x108')]);if(!_0x2f926c){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x3ea366,_0x1e18('0x10a'));}}}}else if(_0x3ea366['trunk_name']){_0x2f926c=_0x3ea366[_0x1e18('0x10b')];}else{return this['channel'][_0x1e18('0x2e')](_0x3ea366,_0x1e18('0x109'));}var _0x4b8c8a=this[_0x1e18('0xe')][_0x1e18('0x55')](_0x1e18('0xe0'),[util[_0x1e18('0x2b')]('SIP/%s/%s',_0x2f926c,_0x3ea366['phone']),_0x3ea366['timeout'],_0x3ea366[_0x1e18('0xe2')],_0x3ea366[_0x1e18('0x63')]]);if(_0x4b8c8a[_0x1e18('0xa0')]===-0x1){return _0x4b8c8a;}return this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x10c'),_0x1e18('0xe0')));};AGIVertices['prototype'][_0x1e18('0x10d')]=function(_0x5976d7){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x10e'),_0x5976d7[_0x1e18('0xa6')]));return this['channel'][_0x1e18('0xa7')](_0x1e18('0x10d'));};AGIVertices[_0x1e18('0x11')][_0x1e18('0xc')]=function(_0x1f3ce2){logger['info'](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1f3ce2[_0x1e18('0xa6')]));if(_0x1f3ce2[_0x1e18('0xa4')]===0x0){return this[_0x1e18('0xa3')](_0x1f3ce2);}_0x1f3ce2[_0x1e18('0xa4')]-=0x1;if(!this[_0x1e18('0x82')](_0x1f3ce2[_0x1e18('0x10f')])){return this['channel']['error'](_0x1f3ce2,_0x1e18('0x110'));}var _0x129132=this[_0x1e18('0x21')][_0x1e18('0x6d')](this,_0x1f3ce2[_0x1e18('0x10f')]);if(!_0x129132){return this[_0x1e18('0xe')]['error'](_0x1f3ce2,_0x1e18('0x111'));}if(!this[_0x1e18('0x82')](_0x1f3ce2[_0x1e18('0xd7')])){return this[_0x1e18('0xe')]['error'](_0x1e18('0x112'));}var _0x2bcb87=this[_0x1e18('0xe')][_0x1e18('0x113')](_0x129132,_0x1f3ce2[_0x1e18('0x114')],_0x1f3ce2[_0x1e18('0x115')]);var _0x1cc5c9=_0x2bcb87[_0x1e18('0xa0')]?_0x2bcb87[_0x1e18('0xa0')][_0x1e18('0x4a')]():'';logger[_0x1e18('0x2f')](_0x1e18('0x116'),JSON[_0x1e18('0x70')](_0x2bcb87));if(_0x2bcb87['result']===-0x1){this[_0x1e18('0x35')]['sync'](this,_0x1f3ce2,_0x1cc5c9);return _0x2bcb87;}else if(_0x2bcb87[_0x1e18('0x9e')]===_0x1e18('0x65')){_0x2bcb87['result']=_0x1cc5c9[_0x1e18('0x99')]>=parseInt(_0x1f3ce2[_0x1e18('0x117')])?'x':'i';}else{_0x2bcb87[_0x1e18('0xa0')]=_0x1cc5c9[_0x1e18('0x99')]>=parseInt(_0x1f3ce2['mindigit'])&&_0x1cc5c9[_0x1e18('0x99')]<=parseInt(_0x1f3ce2[_0x1e18('0x115')])?'x':'i';}var _0x3a5464=this['getVariable'][_0x1e18('0x6d')](this,_0x1f3ce2[_0x1e18('0xd7')]);if(!_0x3a5464){return this['channel']['error'](_0x1f3ce2,_0x1e18('0xd8'));}this[_0x1e18('0xe')]['setVariable'](_0x3a5464,_0x1cc5c9);if(this[_0x1e18('0x82')](_0x1f3ce2['hiddendigitsnum'])){var _0x79a9cf=parseInt(_0x1f3ce2[_0x1e18('0x118')],0xa);var _0x43ab79=rs[_0x1e18('0x119')]({'charset':'*','length':_0x79a9cf});var _0x5c2916=_0x1cc5c9[_0x1e18('0x99')];if(_0x5c2916>0x0){if(_0x5c2916>_0x79a9cf){this[_0x1e18('0x35')][_0x1e18('0x6d')](this,_0x1f3ce2,_0x1f3ce2['hiddendigitspos']===_0x1e18('0x11a')?_0x43ab79+_0x1cc5c9['substr'](_0x79a9cf):_0x1cc5c9[_0x1e18('0x11b')](0x0,_0x5c2916-_0x79a9cf)+_0x43ab79);}else{this[_0x1e18('0x35')][_0x1e18('0x6d')](this,_0x1f3ce2,rs[_0x1e18('0x119')]({'charset':'*','length':_0x5c2916}));}}else{this['createSquareDetailsReport'][_0x1e18('0x6d')](this,_0x1f3ce2,'');}}else{this[_0x1e18('0x35')][_0x1e18('0x6d')](this,_0x1f3ce2,_0x1cc5c9);}return _0x2bcb87;};AGIVertices[_0x1e18('0x11')][_0x1e18('0xd')]=function(_0x551c0b){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x11c'),_0x551c0b[_0x1e18('0xa6')]));return this['getdigits'](_0x551c0b);};AGIVertices['prototype'][_0x1e18('0x11d')]=function(_0x2c14f9){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2c14f9['label']));this[_0x1e18('0x35')][_0x1e18('0x6d')](this,_0x2c14f9,_0x2c14f9[_0x1e18('0x11e')]);return this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')]('GOAL\x20%s',_0x2c14f9['goalname']));};AGIVertices[_0x1e18('0x11')][_0x1e18('0x11f')]=function(_0xad69ff){logger[_0x1e18('0x2f')](util['format'](_0x1e18('0x120'),_0xad69ff[_0x1e18('0xa6')]));if(!this['isConfigured'](_0xad69ff[_0x1e18('0x85')])||!this[_0x1e18('0x82')](_0xad69ff[_0x1e18('0x86')])){return this['channel'][_0x1e18('0xa7')](_0x1e18('0x121'));}if(!this[_0x1e18('0x82')](_0xad69ff[_0x1e18('0x5a')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xa8'));}this[_0x1e18('0xe')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0xad69ff[_0x1e18('0x5a')]));var _0x8d33b0=this['awsPolly'][_0x1e18('0x6d')](this,_0xad69ff);if(_0x8d33b0){this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x122'),_0x8d33b0));var _0x38e916=this['channel']['streamFile'](_0x8d33b0);try{fs[_0x1e18('0x100')](_0x8d33b0+'.wav');}catch(_0x42bf51){logger[_0x1e18('0x2e')](_0x42bf51);}return _0x38e916;}return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0xad69ff,_0x1e18('0x123'));};AGIVertices[_0x1e18('0x11')][_0x1e18('0x124')]=function(_0x34ff6b){logger[_0x1e18('0x2f')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x34ff6b['label']));if(!this[_0x1e18('0x82')](_0x34ff6b[_0x1e18('0x85')])||!this['isConfigured'](_0x34ff6b[_0x1e18('0x86')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x121'));}if(!this[_0x1e18('0x82')](_0x34ff6b['aws_bot_name'])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x125'));}if(!this[_0x1e18('0x82')](_0x34ff6b[_0x1e18('0x5a')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xa8'));}this[_0x1e18('0xe')][_0x1e18('0xe5')]=!![];this[_0x1e18('0x35')](_0x34ff6b);this['createSquareMessage'](_0x34ff6b[_0x1e18('0x5a')],'in','','');this['channel']['noop'](util['format'](_0x1e18('0x126'),_0x34ff6b['text']));var _0x115d22=this[_0x1e18('0x8b')][_0x1e18('0x6d')](this,_0x34ff6b);if(_0x115d22){for(var _0x325b2a in _0x115d22){if(_0x115d22['hasOwnProperty'](_0x325b2a)&&_[_0x1e18('0x9a')](_0x115d22[_0x325b2a])){this[_0x1e18('0xe')][_0x1e18('0xa2')](util[_0x1e18('0x2b')](_0x1e18('0x127'),_0x325b2a['toUpperCase']()),_0x115d22[_0x325b2a]);}}if(_[_0x1e18('0x41')](_0x115d22[_0x1e18('0x74')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x128'));}else{this['createSquareMessage'](_0x115d22['message'],_0x1e18('0xea'),_0x1e18('0x129'),'');return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')]('Amazon\x20Lex\x20Result\x20%s',_0x115d22[_0x1e18('0x74')]));}}return this['channel'][_0x1e18('0x2e')](_0x34ff6b,_0x1e18('0x12a'));};AGIVertices[_0x1e18('0x11')]['googleasr']=function(_0x28f0c1){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x12b'),_0x28f0c1[_0x1e18('0xa6')],_0x28f0c1[_0x1e18('0x65')]));if(!this[_0x1e18('0x82')](_0x28f0c1[_0x1e18('0x77')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20key\x20configured');}var _0xd2cc9=_0x1e18('0x12c');var _0xa0f34a=util[_0x1e18('0x2b')](_0x1e18('0x12d'),FILES_PATH,rs[_0x1e18('0x119')](0x4));var _0x4e825d=util['format'](_0x1e18('0x9c'),_0xa0f34a,_0xd2cc9);var _0x517c7e=!![];if(_0x28f0c1['beep']===_0x1e18('0x12e')){_0x517c7e=![];}var _0xe8336f=this[_0x1e18('0xe')][_0x1e18('0x12f')](_0xa0f34a,_0xd2cc9,_0x28f0c1[_0x1e18('0x130')],_0x28f0c1['timeout'],undefined,_0x517c7e);if(_0xe8336f[_0x1e18('0xa0')]!==-0x1){this['channel'][_0x1e18('0xa7')](util['format']('google\x20%s\x20file\x20created',_0x4e825d));var _0x1c0a21=this['googleASR'][_0x1e18('0x6d')](this,_0x28f0c1,_0x4e825d);if(_0x1c0a21){for(var _0x46001f in _0x1c0a21){if(_0x1c0a21['hasOwnProperty'](_0x46001f)){this[_0x1e18('0xe')][_0x1e18('0xa2')](util[_0x1e18('0x2b')](_0x1e18('0x131'),_0x46001f['toUpperCase']()),_0x1c0a21[_0x46001f]);}}return this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0x132'),JSON['stringify'](_0x1c0a21)));}}return _0xe8336f;};AGIVertices[_0x1e18('0x11')][_0x1e18('0x133')]=function(_0x58a08c){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x134'),_0x58a08c[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x58a08c[_0x1e18('0x90')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x135'));}if(!this[_0x1e18('0x82')](_0x58a08c[_0x1e18('0x91')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x136'));}var _0x3a6773=_0x1e18('0x12c');var _0x1423f8=util[_0x1e18('0x2b')](_0x1e18('0x12d'),FILES_PATH,rs[_0x1e18('0x119')](0x4));var _0x273c=util[_0x1e18('0x2b')](_0x1e18('0x9c'),_0x1423f8,_0x3a6773);var _0x292436=!![];if(_0x58a08c[_0x1e18('0x137')]==='NOBEEP'){_0x292436=![];}var _0x1298f5=this[_0x1e18('0xe')][_0x1e18('0x12f')](_0x1423f8,_0x3a6773,_0x58a08c['intKey'],_0x58a08c[_0x1e18('0x65')],undefined,_0x292436);if(_0x1298f5[_0x1e18('0xa0')]!==-0x1){this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0x138'),_0x273c));var _0xe862ed=this[_0x1e18('0x8f')][_0x1e18('0x6d')](this,_0x58a08c,_0x273c);if(_0xe862ed){for(var _0x4f8edf in _0xe862ed){if(_0xe862ed[_0x1e18('0x93')](_0x4f8edf)){this[_0x1e18('0xe')][_0x1e18('0xa2')](util[_0x1e18('0x2b')](_0x1e18('0x139'),_0x4f8edf[_0x1e18('0xe8')]()),_0xe862ed[_0x4f8edf]);}}return this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x13a'),JSON[_0x1e18('0x70')](_0xe862ed)));}}return _0x1298f5;};AGIVertices[_0x1e18('0x11')][_0x1e18('0x13b')]=function(_0x552b66){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x13c'),_0x552b66[_0x1e18('0xa6')]));return this[_0x1e18('0xe')][_0x1e18('0x13d')](_0x552b66[_0x1e18('0x3a')],_0x552b66[_0x1e18('0x3b')],_0x552b66[_0x1e18('0x13e')]);};AGIVertices[_0x1e18('0x11')][_0x1e18('0x13f')]=function(_0x1be1de){logger['info'](util['format'](_0x1e18('0x140'),_0x1be1de[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x1be1de['condition'])){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x1be1de,_0x1e18('0x141'));}try{var _0x5fd014=eval(_0x1be1de[_0x1e18('0x142')])?'true':_0x1e18('0x143');this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x144'),_0x1be1de['condition'],_0x5fd014));return{'code':0xc8,'result':_0x5fd014};}catch(_0x69aaae){return{'code':0xc8,'result':_0x1e18('0x143')};}};AGIVertices['prototype']['gotoiftime']=function(_0x109a28){logger['info'](util[_0x1e18('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x109a28['label']));if(!this[_0x1e18('0x82')](_0x109a28[_0x1e18('0x145')])){return this['channel'][_0x1e18('0x2e')](_0x109a28,_0x1e18('0x146'));}var _0x1b2be4=this[_0x1e18('0x147')][_0x1e18('0x6d')](this,_0x109a28[_0x1e18('0x145')]);if(!_0x1b2be4){return this['channel'][_0x1e18('0x2e')](_0x109a28,_0x1e18('0x148'));}for(var _0x41cb40=0x0;_0x41cb40<_0x1b2be4[_0x1e18('0x99')];_0x41cb40+=0x1){var _0x407c85=this[_0x1e18('0xe')][_0x1e18('0x12')](util[_0x1e18('0x2b')]('IFTIME(%s?true:false)',_0x1b2be4[_0x41cb40]));if(_0x407c85[_0x1e18('0xa0')]===-0x1){return _0x407c85;}logger[_0x1e18('0x2f')](util['format']('IFTIME\x20%s\x20%s',_0x1b2be4[_0x41cb40],_0x407c85[_0x1e18('0x9e')]));if(_0x407c85[_0x1e18('0x9e')]==='true'){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')]('IFTIME\x20%s\x20%s',_0x1b2be4[_0x41cb40],_0x1e18('0x149')));this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x14a'),_0x1b2be4[_0x41cb40],_0x1e18('0x149')));return{'code':0xc8,'result':_0x1e18('0x149')};}else{logger[_0x1e18('0x2f')](util['format'](_0x1e18('0x14a'),_0x1b2be4[_0x41cb40],_0x1e18('0x143')));this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0x14a'),_0x1b2be4[_0x41cb40],_0x1e18('0x143')));}}return{'code':0xc8,'result':_0x1e18('0x143')};};AGIVertices[_0x1e18('0x11')]['hangup']=function(_0x209f73){logger[_0x1e18('0x2f')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x209f73[_0x1e18('0xa6')]));return this[_0x1e18('0xe')][_0x1e18('0x14b')]();};AGIVertices[_0x1e18('0x11')][_0x1e18('0x14c')]=function(_0xc4d195){logger[_0x1e18('0x2f')](util['format'](_0x1e18('0x14d'),_0xc4d195[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0xc4d195[_0x1e18('0x77')])){return this[_0x1e18('0xe')]['noop']('no\x20key\x20configured');}var _0x6006d2=_0x1e18('0x12c');var _0x3289c5=util[_0x1e18('0x2b')](_0x1e18('0x12d'),FILES_PATH,rs[_0x1e18('0x119')](0x4));var _0x27eead=util[_0x1e18('0x2b')](_0x1e18('0x9c'),_0x3289c5,_0x6006d2);var _0x3ffceb=!![];if(_0xc4d195[_0x1e18('0x137')]===_0x1e18('0x12e')){_0x3ffceb=![];}var _0x4de763=this['channel']['recordFile'](_0x3289c5,_0x6006d2,_0xc4d195[_0x1e18('0x130')],_0xc4d195[_0x1e18('0x65')],undefined,_0x3ffceb);if(_0x4de763[_0x1e18('0xa0')]!==-0x1){this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x14e'),_0x27eead));var _0x3df15d=this[_0x1e18('0x80')][_0x1e18('0x6d')](this,_0xc4d195,_0x27eead);if(_0x3df15d){for(var _0x214668 in _0x3df15d){if(_0x3df15d[_0x1e18('0x93')](_0x214668)){this[_0x1e18('0xe')][_0x1e18('0xa2')](util[_0x1e18('0x2b')]('ISPEECH_ASR_%s',_0x214668[_0x1e18('0xe8')]()),_0x3df15d[_0x214668]);}}return this[_0x1e18('0xe')][_0x1e18('0xa7')](util['format'](_0x1e18('0x14f'),JSON[_0x1e18('0x70')](_0x3df15d)));}}return _0x4de763;};AGIVertices['prototype']['ispeechtts']=function(_0x3207e3){logger[_0x1e18('0x2f')](util['format'](_0x1e18('0x150'),_0x3207e3['label']));if(!this[_0x1e18('0x82')](_0x3207e3[_0x1e18('0x77')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20key\x20configured');}if(!this[_0x1e18('0x82')](_0x3207e3[_0x1e18('0x5a')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20text\x20configured');}this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x151'),_0x3207e3['text']));var _0x40ea32=this[_0x1e18('0x152')]['sync'](this,_0x3207e3);if(_0x40ea32){this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')]('ispeech\x20%s\x20file\x20created',_0x40ea32));var _0x28948d=this[_0x1e18('0xe')][_0x1e18('0x153')](_0x40ea32,_0x3207e3['intKey']);try{fs[_0x1e18('0x100')](_0x40ea32+_0x1e18('0x101'));}catch(_0x47b97f){logger[_0x1e18('0x2e')](_0x47b97f);}return _0x28948d;}return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x3207e3,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x1e18('0x11')]['login']=function(_0x4135ab){logger['info'](util['format'](_0x1e18('0x154'),_0x4135ab[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x4135ab[_0x1e18('0x155')])){return this['channel'][_0x1e18('0x2e')](_0x4135ab,_0x1e18('0x156'));}logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x157'),this[_0x1e18('0xe')]['callerid'],_0x4135ab[_0x1e18('0x155')]));var _0x3bd667=this[_0x1e18('0x52')][_0x1e18('0x6d')](this,_0x4135ab['findBy']);if(_0x3bd667){logger[_0x1e18('0x2f')](util['format'](_0x1e18('0x158'),this['channel'][_0x1e18('0x37')],_0x4135ab[_0x1e18('0x155')]));this[_0x1e18('0xe')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x1e18('0xe')][_0x1e18('0x37')],_0x4135ab[_0x1e18('0x155')]));return{'code':0xc8,'result':_0x1e18('0x159')};}else{logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1e18('0xe')]['callerid'],_0x4135ab[_0x1e18('0x155')]));this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x15a'),this[_0x1e18('0xe')][_0x1e18('0x37')],_0x4135ab[_0x1e18('0x155')]));return{'code':0xc8,'result':_0x1e18('0x15b')};}};AGIVertices[_0x1e18('0x11')][_0x1e18('0x15c')]=function(_0x1ad13c){logger[_0x1e18('0x2f')](util['format'](_0x1e18('0x15d'),_0x1ad13c['label']));if(!this[_0x1e18('0x82')](_0x1ad13c[_0x1e18('0x155')])){return this['channel'][_0x1e18('0x2e')](_0x1ad13c,_0x1e18('0x156'));}logger[_0x1e18('0x2f')](util['format'](_0x1e18('0x157'),this[_0x1e18('0xe')][_0x1e18('0x37')],_0x1ad13c[_0x1e18('0x155')]));var _0x17d9de=this[_0x1e18('0x51')]['sync'](this,_0x1ad13c[_0x1e18('0x155')]);if(_0x17d9de){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x158'),this[_0x1e18('0xe')]['callerid'],_0x1ad13c['findBy']));this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1ad13c[_0x1e18('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x15a'),this['channel'][_0x1e18('0x37')],_0x1ad13c[_0x1e18('0x155')]));this['channel'][_0x1e18('0xa7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1e18('0xe')][_0x1e18('0x37')],_0x1ad13c[_0x1e18('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1e18('0x11')][_0x1e18('0x15e')]=function(_0x2a0a89){logger[_0x1e18('0x2f')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2a0a89[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x2a0a89[_0x1e18('0x15f')])){return this['channel'][_0x1e18('0x2e')](_0x2a0a89,_0x1e18('0x160'));}this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x161'),_0x2a0a89[_0x1e18('0x15f')]));var _0x17e0b3=eval(_0x2a0a89[_0x1e18('0x15f')]);if(!this['isConfigured'](_0x2a0a89[_0x1e18('0xd7')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x112'));}var _0x3f909b=this[_0x1e18('0x12')][_0x1e18('0x6d')](this,_0x2a0a89[_0x1e18('0xd7')]);if(!_0x3f909b){return this[_0x1e18('0xe')]['error'](_0x2a0a89,_0x1e18('0xd8'));}if(_['isArray'](_0x17e0b3)){var _0x43b1fb=this;_0x17e0b3[_0x1e18('0xd9')](function(_0x4f571b,_0x419d92){_0x43b1fb[_0x1e18('0xe')][_0x1e18('0xa2')](util[_0x1e18('0x2b')](_0x1e18('0x162'),_0x3f909b,_0x419d92),_0x4f571b);});return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x163'),_0x3f909b));}else{return this['channel']['setVariable'](_0x3f909b,_0x17e0b3);}};AGIVertices[_0x1e18('0x11')]['menu']=function(_0x3a71b3){logger[_0x1e18('0x2f')](util['format'](_0x1e18('0x164'),_0x3a71b3[_0x1e18('0xa6')]));if(_0x3a71b3['retry']===0x0){return this[_0x1e18('0xa3')](_0x3a71b3);}_0x3a71b3[_0x1e18('0xa4')]-=0x1;if(!this[_0x1e18('0x82')](_0x3a71b3['file_id'])){return this[_0x1e18('0xe')]['error'](_0x3a71b3,_0x1e18('0x110'));}var _0x48b2c9=this[_0x1e18('0x21')][_0x1e18('0x6d')](this,_0x3a71b3[_0x1e18('0x10f')]);if(!_0x48b2c9){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x3a71b3,_0x1e18('0x111'));}var _0x526846=this['channel'][_0x1e18('0x113')](_0x48b2c9,_0x3a71b3[_0x1e18('0x114')],_0x3a71b3[_0x1e18('0x165')]);var _0x8609be=_0x526846[_0x1e18('0xa0')];if(_0x526846[_0x1e18('0xa0')]===-0x1){this[_0x1e18('0x35')]['sync'](this,_0x3a71b3,'-1');return _0x526846;}else if(_0x526846[_0x1e18('0x9e')]===_0x1e18('0x65')){_0x526846[_0x1e18('0xa0')]=_0x526846[_0x1e18('0xa0')][_0x1e18('0x99')]>0x0?_0x526846[_0x1e18('0xa0')]:'t';}else if(_[_0x1e18('0x40')](_0x526846[_0x1e18('0xa0')])){_0x526846[_0x1e18('0xa0')]='#';_0x8609be='#';}if(!this['isConfigured'](_0x3a71b3['variable_id'])){this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x45a5ab=this[_0x1e18('0x12')][_0x1e18('0x6d')](this,_0x3a71b3[_0x1e18('0xd7')]);if(!_0x45a5ab){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x3a71b3,_0x1e18('0xd8'));}this['channel'][_0x1e18('0xa2')](_0x45a5ab,_0x8609be);}this[_0x1e18('0x35')][_0x1e18('0x6d')](this,_0x3a71b3,_0x8609be);return _0x526846;};AGIVertices[_0x1e18('0x11')][_0x1e18('0xa7')]=function(_0x4c7936){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4c7936[_0x1e18('0xa6')]));return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x4c7936[_0x1e18('0x166')]||_0x4c7936[_0x1e18('0xa6')]);};AGIVertices[_0x1e18('0x11')][_0x1e18('0x167')]=function(_0x3b705e){logger['info'](util[_0x1e18('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3b705e[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x3b705e[_0x1e18('0x155')])){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x3b705e,_0x1e18('0x156'));}logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x1e18('0x37')],_0x3b705e[_0x1e18('0x155')]));var _0x101fbe=this[_0x1e18('0x4c')][_0x1e18('0x6d')](this,_0x3b705e['pause_id']);var _0x81bc86=this[_0x1e18('0x4e')]['sync'](this,_0x3b705e[_0x1e18('0x155')],_0x101fbe);if(_0x81bc86){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x158'),this['channel']['callerid'],_0x3b705e[_0x1e18('0x155')]));this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x158'),this[_0x1e18('0xe')][_0x1e18('0x37')],_0x3b705e[_0x1e18('0x155')]));return{'code':0xc8,'result':_0x1e18('0x159')};}else{logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x15a'),this[_0x1e18('0xe')][_0x1e18('0x37')],_0x3b705e['findBy']));this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x158'),this[_0x1e18('0xe')][_0x1e18('0x37')],_0x3b705e[_0x1e18('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x1e18('0x168')]=function(_0x4ed0ee){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x169'),_0x4ed0ee[_0x1e18('0xa6')]));if(!this['isConfigured'](_0x4ed0ee['file_id'])){return this['channel'][_0x1e18('0x2e')](_0x4ed0ee,_0x1e18('0x110'));}var _0x286ba0=this['getSound'][_0x1e18('0x6d')](this,_0x4ed0ee['file_id']);if(!_0x286ba0){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x4ed0ee,_0x1e18('0x111'));}var _0x5c45f7=this['channel']['exec'](_0x1e18('0x16a'),[_0x286ba0,_0x4ed0ee['opts']]);if(_0x5c45f7[_0x1e18('0xa0')]===-0x1){return _0x5c45f7;}return this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0xc3'),_0x1e18('0x16a'),_0x286ba0));};AGIVertices[_0x1e18('0x11')][_0x1e18('0x16b')]=function(_0x4fabb8){logger[_0x1e18('0x2f')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4fabb8['label']));if(!this['isConfigured'](_0x4fabb8['queue_id'])){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x4fabb8,_0x1e18('0x16c'));}var _0x25052a='';var _0x4a55a9=parseInt(_0x4fabb8[_0x1e18('0x16d')],0xa);if(isNaN(_0x4a55a9)){_0x25052a=_0x4fabb8[_0x1e18('0x16d')];}else{_0x25052a=this[_0x1e18('0x17')]['sync'](this,_0x4fabb8['queue_id']);if(!_0x25052a){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x4fabb8,_0x1e18('0x16e'));}}var _0x1077eb='';if(this['isConfigured'](_0x4fabb8[_0x1e18('0x10f')])){var _0x18d3ef=this[_0x1e18('0x21')][_0x1e18('0x6d')](this,_0x4fabb8[_0x1e18('0x10f')]);if(_0x18d3ef){_0x1077eb=_0x18d3ef;}}this['createSquareDetailsReport'][_0x1e18('0x6d')](this,_0x4fabb8,_0x25052a);if(_0x4fabb8[_0x1e18('0xe2')][_0x1e18('0x16f')]('x')<0x0){_0x4fabb8['opts']+='x';}if(_0x4fabb8[_0x1e18('0xe2')][_0x1e18('0x16f')]('X')<0x0){_0x4fabb8['opts']+='X';}this[_0x1e18('0xe')][_0x1e18('0xa2')](_0x1e18('0x170'),_0x25052a?_0x25052a[_0x1e18('0x171')]():'');var _0x29833d=this[_0x1e18('0xe')][_0x1e18('0x55')](_0x1e18('0x172'),[_0x25052a,_0x4fabb8[_0x1e18('0xe2')],_0x4fabb8['url'],_0x1077eb,_0x4fabb8[_0x1e18('0x65')],_0x4fabb8['agi'],_0x4fabb8[_0x1e18('0x173')],_0x4fabb8[_0x1e18('0x174')],'',_0x4fabb8[_0x1e18('0x175')]]);if(_0x29833d['result']===-0x1){return _0x29833d;}return this[_0x1e18('0xe')][_0x1e18('0xa7')](util['format'](_0x1e18('0xc3'),_0x1e18('0x172'),_0x25052a));};AGIVertices[_0x1e18('0x11')][_0x1e18('0x176')]=function(_0x11909b){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x177'),_0x11909b[_0x1e18('0xa6')]));var _0x8dd3d0=_0x11909b[_0x1e18('0x178')]||_0x1e18('0x12c');var _0x405992=util[_0x1e18('0x2b')](_0x1e18('0x179'),this[_0x1e18('0xe')][_0x1e18('0x47')],rs['generate'](0x5));var _0x24d92b=util[_0x1e18('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x405992,_0x8dd3d0);var _0x28608f=util['format'](_0x1e18('0x12d'),FILES_PATH,_0x405992);this[_0x1e18('0x38')][_0x1e18('0x6d')](this,_0x11909b,_0x405992,_0x24d92b);this[_0x1e18('0xe')][_0x1e18('0xa2')](_0x1e18('0x17a'),_0x405992);logger[_0x1e18('0x2f')](_0x1e18('0x17b'),_0x28608f,_0x8dd3d0,_0x11909b[_0x1e18('0x17c')],_0x11909b[_0x1e18('0x65')]);return this[_0x1e18('0xe')]['recordFile'](_0x28608f,_0x8dd3d0,_0x11909b[_0x1e18('0x17c')],_0x11909b[_0x1e18('0x65')],undefined,!![]);};AGIVertices['prototype'][_0x1e18('0x17d')]=function(_0x36fb90){logger['info'](util['format'](_0x1e18('0x17e'),_0x36fb90[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x36fb90['url'])){return this[_0x1e18('0xe')]['noop'](_0x1e18('0x17f'));}var _0x5d2868=this[_0x1e18('0x62')][_0x1e18('0x6d')](this,_0x36fb90);logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x180'),util[_0x1e18('0x181')](_0x5d2868,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x36fb90[_0x1e18('0xd7')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x22d44a=this[_0x1e18('0x12')][_0x1e18('0x6d')](this,_0x36fb90[_0x1e18('0xd7')]);if(!_0x22d44a){return this['channel'][_0x1e18('0x2e')](_0x36fb90,_0x1e18('0xd8'));}this[_0x1e18('0xe')]['setVariable'](util['format'](_0x1e18('0x182'),_0x22d44a),_0x5d2868[_0x1e18('0x72')]?_0x5d2868[_0x1e18('0x72')]:_0x1e18('0x183'));this[_0x1e18('0xe')][_0x1e18('0xa2')](util[_0x1e18('0x2b')](_0x1e18('0x184'),_0x22d44a),_0x5d2868[_0x1e18('0x73')]?_0x5d2868[_0x1e18('0x73')]:'OK');if(_0x5d2868[_0x1e18('0x68')]){try{this['saveRestApiResult'](_0x5d2868[_0x1e18('0x68')],_0x22d44a);}catch(_0x569891){logger[_0x1e18('0x2e')](util[_0x1e18('0x2b')](_0x1e18('0x185'),_0x22d44a));}}return this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')]('variable\x20%s\x20set',_0x22d44a));};AGIVertices[_0x1e18('0x11')][_0x1e18('0x186')]=function(_0x3d7b14){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x187'),_0x3d7b14[_0x1e18('0xa6')]));return this[_0x1e18('0xe')][_0x1e18('0x188')](_0x3d7b14[_0x1e18('0x189')]['replace'](/\s+/g,''),_0x3d7b14[_0x1e18('0x17c')]);};AGIVertices[_0x1e18('0x11')][_0x1e18('0x18a')]=function(_0x2cd453){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x18b'),_0x2cd453[_0x1e18('0xa6')]));return this[_0x1e18('0xe')][_0x1e18('0x18c')](_0x2cd453[_0x1e18('0x18d')][_0x1e18('0x57')](/\s+/g,''),_0x2cd453[_0x1e18('0x17c')]);};AGIVertices[_0x1e18('0x11')]['sayphonetic']=function(_0x22058e){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x18e'),_0x22058e[_0x1e18('0xa6')]));return this['channel']['sayPhonetic'](_0x22058e['text'],_0x22058e[_0x1e18('0x17c')]);};AGIVertices[_0x1e18('0x11')][_0x1e18('0x18f')]=function(_0x3c5953){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x190'),_0x3c5953[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x3c5953[_0x1e18('0x191')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x192'));}var _0x58d305=this[_0x1e18('0x193')][_0x1e18('0x6d')](this,_0x3c5953[_0x1e18('0x191')]);if(!_0x58d305||!_0x58d305['Smtp']){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x3c5953,_0x1e18('0x194'));}var _0x467512={'from':util[_0x1e18('0x2b')]('\x22%s\x22\x20<%s>',_0x58d305['name'],_0x58d305[_0x1e18('0x195')]||_0x58d305[_0x1e18('0x196')]['user']),'to':_0x3c5953['to']||'','cc':_0x3c5953['cc']||'','bcc':_0x3c5953[_0x1e18('0x197')]||'','subject':_0x3c5953['subject'],'html':_0x3c5953[_0x1e18('0x5a')],'text':_0x3c5953[_0x1e18('0x5a')]};if(this['isConfigured'](_0x3c5953['template_id'])){}logger['debug']('sendMail\x20message',JSON['stringify'](_0x467512));this[_0x1e18('0x35')][_0x1e18('0x6d')](this,_0x3c5953,_0x3c5953[_0x1e18('0x191')]);this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x198'),_0x58d305['name']));this['sendMailMessage'][_0x1e18('0x6d')](this,_0x58d305['smtpOptions'],_0x467512);return this[_0x1e18('0xe')]['noop'](_0x1e18('0x199'));};AGIVertices['prototype']['sendFax']=function(_0x2dff69){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2dff69['label']));return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x19a'));};AGIVertices['prototype'][_0x1e18('0x19b')]=function(_0x2a1006){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x19c'),_0x2a1006[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x2a1006[_0x1e18('0x19d')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x19e'));}var _0x75d2e2=this[_0x1e18('0x19f')][_0x1e18('0x6d')](this,_0x2a1006[_0x1e18('0x19d')]);if(!_0x75d2e2){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x2a1006,_0x1e18('0x1a0'));}var _0x1292d5={'body':_0x2a1006[_0x1e18('0x1a1')],'phone':_0x2a1006['to']||'','SmsAccountId':_0x75d2e2['id']};logger['debug'](_0x1e18('0x1a2'),JSON['stringify'](_0x1292d5));this[_0x1e18('0x35')]['sync'](this,_0x2a1006,_0x2a1006[_0x1e18('0x19d')]);this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x1a3'),_0x75d2e2['name']));this[_0x1e18('0x34')][_0x1e18('0x6d')](this,_0x1292d5);return this['channel'][_0x1e18('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x1e18('0x11')][_0x1e18('0x1a4')]=function(_0x34764e){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x1a5'),_0x34764e['label']));if(!this[_0x1e18('0x82')](_0x34764e[_0x1e18('0xd7')])){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x34764e,_0x1e18('0x1a6'));}var _0x27803b=this['getVariable'][_0x1e18('0x6d')](this,_0x34764e[_0x1e18('0xd7')]);if(!_0x27803b){return this[_0x1e18('0xe')]['error'](_0x34764e,_0x1e18('0xd8'));}return this['channel'][_0x1e18('0xa2')](_0x27803b,_0x34764e[_0x1e18('0x1a7')]);};AGIVertices[_0x1e18('0x11')][_0x1e18('0x1a8')]=function(_0x2c3c02){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x1a9'),_0x2c3c02['label']));this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x1aa'));var _0x88b52=this[_0x1e18('0xe')]['getVariable']('XMCS-UNIQUEID');if(!_[_0x1e18('0x40')](_0x88b52[_0x1e18('0x9e')])){this[_0x1e18('0xe')][_0x1e18('0x47')]=_0x88b52['extra'];}if(_0x2c3c02['answer']===_0x1e18('0x1ab')){this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x1ac'));return this[_0x1e18('0xe')]['answer']();}return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x1ad'));};AGIVertices['prototype'][_0x1e18('0x1ae')]=function(_0x35023d){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x1af'),_0x35023d[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x35023d[_0x1e18('0x1b0')])){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x35023d,'no\x20subproject\x20selected');}var _0x3644c8=this[_0x1e18('0x19')][_0x1e18('0x6d')](this,_0x35023d[_0x1e18('0x1b0')]);if(!this['isConfigured'](_0x3644c8)){return this['channel']['error'](_0x35023d,util['format'](_0x1e18('0x1b1'),_0x35023d[_0x1e18('0x1b0')]));}if(_0x3644c8===this['channel'][_0x1e18('0x36')]){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x35023d,_0x1e18('0x1b2'));}this[_0x1e18('0x35')][_0x1e18('0x6d')](this,_0x35023d,_0x3644c8);var _0x47bf32=this[_0x1e18('0xe')][_0x1e18('0x55')]('AGI',util['format'](_0x1e18('0x1b3'),config[_0x1e18('0xb2')][_0x1e18('0x1b4')]||_0x1e18('0x1b5'),_0x3644c8,this[_0x1e18('0xe')]['arg_1']));if(_0x47bf32['result']===-0x1){return _0x47bf32;}return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0xc3'),_0x1e18('0x1b6'),_0x3644c8));};AGIVertices['prototype'][_0x1e18('0x1b7')]=function(_0x3c941a){logger['info'](util[_0x1e18('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3c941a[_0x1e18('0xa6')]));var _0x1c9dae=this[_0x1e18('0x54')]['sync'](this,_0x3c941a[_0x1e18('0x1b8')]);this['createSquareDetailsReport']['sync'](this,_0x3c941a,_0x3c941a[_0x1e18('0x1b8')]);if(this[_0x1e18('0x82')](_0x3c941a[_0x1e18('0xd7')])){var _0xacf73b=this['getVariable'][_0x1e18('0x6d')](this,_0x3c941a['variable_id']);if(_0xacf73b){this[_0x1e18('0xe')][_0x1e18('0xa2')](_0xacf73b,_0x1c9dae);return this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x1b9'),_0x3c941a[_0x1e18('0x1b8')],_0xacf73b));}}return this[_0x1e18('0xe')][_0x1e18('0xa7')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x3c941a[_0x1e18('0x1b8')]));};AGIVertices[_0x1e18('0x11')]['google_cloud_tts']=function(_0x9bb132){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x1ba'),_0x9bb132['label']));_0x9bb132[_0x1e18('0x5a')]=_0x9bb132['text'][_0x1e18('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x9bb132[_0x1e18('0x59')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0x1bb'));}if(!this[_0x1e18('0x82')](_0x9bb132[_0x1e18('0x5a')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xa8'));}this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x1bc'),_0x9bb132[_0x1e18('0x5a')]));var _0x29b96e=this[_0x1e18('0x58')][_0x1e18('0x6d')](this,_0x9bb132);if(_0x29b96e){this[_0x1e18('0xe')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0x1bd'),_0x29b96e));var _0x3d00cb=this['channel'][_0x1e18('0x153')](_0x29b96e);try{fs[_0x1e18('0x100')](_0x29b96e+'.wav');}catch(_0x4f23cc){logger[_0x1e18('0x2e')](_0x4f23cc);}return _0x3d00cb;}return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x9bb132,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x1e18('0x11')][_0x1e18('0x1be')]=function(_0x764203){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x1bf'),_0x764203['label']));_0x764203['text']=_0x764203[_0x1e18('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x764203[_0x1e18('0x5a')])){return this[_0x1e18('0xe')][_0x1e18('0xa7')](_0x1e18('0xa8'));}this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x1c0'),_0x764203[_0x1e18('0x5a')]));var _0x58cc02=this['googleTTS'][_0x1e18('0x6d')](this,_0x764203);if(_0x58cc02){this['channel'][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x1c1'),_0x58cc02));var _0x25087a=this[_0x1e18('0xe')]['streamFile'](_0x58cc02);try{fs[_0x1e18('0x100')](_0x58cc02+_0x1e18('0x101'));}catch(_0x328ad3){logger[_0x1e18('0x2e')](_0x328ad3);}return _0x25087a;}return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x764203,_0x1e18('0x1c2'));};AGIVertices[_0x1e18('0x11')][_0x1e18('0x1c3')]=function(_0x2d801b){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x1c4'),_0x2d801b[_0x1e18('0xa6')]));if(!this['isConfigured'](_0x2d801b['findBy'])){return this['channel'][_0x1e18('0x2e')](_0x2d801b,_0x1e18('0x156'));}logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x157'),this['channel'][_0x1e18('0x37')],_0x2d801b[_0x1e18('0x155')]));var _0x5e6caf=this[_0x1e18('0x4f')][_0x1e18('0x6d')](this,_0x2d801b['findBy']);if(_0x5e6caf){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x158'),this['channel'][_0x1e18('0x37')],_0x2d801b[_0x1e18('0x155')]));this['channel'][_0x1e18('0xa7')](util['format'](_0x1e18('0x158'),this[_0x1e18('0xe')][_0x1e18('0x37')],_0x2d801b[_0x1e18('0x155')]));return{'code':0xc8,'result':_0x1e18('0x159')};}else{logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x15a'),this['channel'][_0x1e18('0x37')],_0x2d801b[_0x1e18('0x155')]));this[_0x1e18('0xe')][_0x1e18('0xa7')](util[_0x1e18('0x2b')](_0x1e18('0x15a'),this[_0x1e18('0xe')][_0x1e18('0x37')],_0x2d801b[_0x1e18('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x185fa7){logger[_0x1e18('0x2f')](util[_0x1e18('0x2b')](_0x1e18('0x1c5'),_0x185fa7['label']));var _0x50cb01=this['channel'][_0x1e18('0x55')](_0x1e18('0x1c6'),[_0x185fa7[_0x1e18('0x1c7')],_0x185fa7[_0x1e18('0x75')]]);if(_0x50cb01[_0x1e18('0xa0')]===-0x1){return _0x50cb01;}return this[_0x1e18('0xe')][_0x1e18('0xa7')](util['format'](_0x1e18('0xc3'),_0x1e18('0x1c6'),_0x185fa7[_0x1e18('0x1c7')]));};AGIVertices[_0x1e18('0x11')][_0x1e18('0x1c8')]=function(_0x2cdf99){logger['info'](util['format'](_0x1e18('0x1c9'),_0x2cdf99[_0x1e18('0xa6')]));if(!this[_0x1e18('0x82')](_0x2cdf99['variable_id'])){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x2cdf99,'no\x20variable\x20selected');}var _0x5cc8a9=this[_0x1e18('0x12')][_0x1e18('0x6d')](this,_0x2cdf99[_0x1e18('0xd7')]);if(!_0x5cc8a9){return this[_0x1e18('0xe')][_0x1e18('0x2e')](_0x2cdf99,_0x1e18('0xd8'));}var _0x23d688=this[_0x1e18('0xe')][_0x1e18('0x12')](_0x5cc8a9);return{'code':0xc8,'result':_0x23d688[_0x1e18('0x9e')]?_0x23d688['extra']:'-'};};String[_0x1e18('0x11')]['replaceAll']=function(_0x1bd944,_0x55ed35){return this[_0x1e18('0x9d')](_0x1bd944)[_0x1e18('0x1ca')](_0x55ed35);};module[_0x1e18('0x1cb')]=AGIVertices; \ No newline at end of file +var _0x7f42=['system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','shelljs','odbc','moment','request-promise','agi','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','arg_1','callerid','context','extension','accountcode','dnid','file','createSquareMessage','uniqueid','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','agent','agentPause','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','includes','agicommand','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','add','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','createSquareRecording','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','AGI','host','127.0.0.1'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0x7f42,0x1dd));var _0x27f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f42[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var util=require(_0x27f4('0x0'));var _=require('lodash');var sh=require(_0x27f4('0x1'));var odbc=require(_0x27f4('0x2'))();var rs=require('randomstring');var moment=require(_0x27f4('0x3'));var Mustache=require('mustache');var rp=require(_0x27f4('0x4'));var logger=require('../../config/logger')(_0x27f4('0x5'));var config=require('../../config/environment');var scripts=require(_0x27f4('0x6'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x27f4('0x7'),_0x27f4('0x8')];var verticesWithRetry=[_0x27f4('0x9'),_0x27f4('0xa'),_0x27f4('0xb')];var AGIVertices=function(_0x9bc56e,_0x458687,_0x11ca32){this[_0x27f4('0xc')]=_0x9bc56e;this[_0x27f4('0xd')]=_0x458687;this[_0x27f4('0xe')]=_0x11ca32;};AGIVertices[_0x27f4('0xf')][_0x27f4('0x10')]=function(_0x247c47,_0x3b1d50){this[_0x27f4('0xd')][_0x27f4('0x11')](_0x247c47)[_0x27f4('0x12')](function(_0x49b49a){_0x3b1d50(null,_0x49b49a?_0x49b49a['name']:![]);})[_0x27f4('0x13')](function(_0x1347ea){_0x3b1d50(_0x1347ea);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x14')]=function(_0x30b667,_0x20c4ea){this[_0x27f4('0xd')][_0x27f4('0x15')](_0x30b667)['then'](function(_0x4a8ff6){_0x20c4ea(null,_0x4a8ff6?_0x4a8ff6[_0x27f4('0x16')]:![]);})[_0x27f4('0x13')](function(_0x10f24a){_0x20c4ea(_0x10f24a);});};AGIVertices[_0x27f4('0xf')]['getSquareProject']=function(_0x185ed6,_0x1ecb85){this[_0x27f4('0xd')]['getSquareProjectById'](_0x185ed6)[_0x27f4('0x12')](function(_0x11b6f7){_0x1ecb85(null,_0x11b6f7?_0x11b6f7[_0x27f4('0x16')]:![]);})['catch'](function(_0x4f4c1d){_0x1ecb85(_0x4f4c1d);});};AGIVertices[_0x27f4('0xf')]['getSquareOdbc']=function(_0x5aa662,_0x3c287a){this[_0x27f4('0xd')][_0x27f4('0x17')](_0x5aa662)[_0x27f4('0x12')](function(_0xd335ee){_0x3c287a(null,_0xd335ee?_0xd335ee[_0x27f4('0x18')]:![]);})[_0x27f4('0x13')](function(_0x16dd8a){_0x3c287a(_0x16dd8a);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x19')]=function(_0x1dd547,_0x23f465){this[_0x27f4('0xd')][_0x27f4('0x1a')](_0x1dd547)[_0x27f4('0x12')](function(_0x52ef43){_0x23f465(null,_0x52ef43?_0x52ef43[_0x27f4('0x16')]:![]);})[_0x27f4('0x13')](function(_0x202e8f){_0x23f465(_0x202e8f);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x1b')]=function(_0x3da4c8,_0x2a31c7){this[_0x27f4('0xd')][_0x27f4('0x1c')](_0x3da4c8)[_0x27f4('0x12')](function(_0x2fe71b){_0x2a31c7(null,_0x2fe71b?_0x2fe71b[_0x27f4('0x16')]:![]);})[_0x27f4('0x13')](function(_0x400d8d){_0x2a31c7(_0x400d8d);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x1d')]=function(_0x2add99,_0x56b2c6){var _0xf9a11d=this;this['rpc'][_0x27f4('0x1e')](_0x2add99)[_0x27f4('0x12')](function(_0x9c39b9){_0x56b2c6(null,_0x9c39b9?_0xf9a11d['getSoundPath'](_0x9c39b9[_0x27f4('0x1f')]):![]);})[_0x27f4('0x13')](function(_0x4874f2){_0x56b2c6(_0x4874f2);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x20')]=function(_0x5c0c79,_0x3654f2){this[_0x27f4('0xd')]['getMailAccountById'](_0x5c0c79)[_0x27f4('0x12')](function(_0x11b1c2){_0x3654f2(null,_0x11b1c2?_0x11b1c2:![]);})['catch'](function(_0x312faf){_0x3654f2(_0x312faf);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x21')]=function(_0x511d1f,_0x5d3bc6,_0x50e6be){this['mailRpc'][_0x27f4('0x21')](_0x511d1f,_0x5d3bc6)[_0x27f4('0x12')](function(){_0x50e6be(null);})[_0x27f4('0x13')](function(_0x28f319){_0x50e6be(_0x28f319);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x22')]=function(_0x237f44,_0x1b3beb){this[_0x27f4('0xd')][_0x27f4('0x23')](_0x237f44)[_0x27f4('0x12')](function(_0x4b32fa){if(_0x4b32fa){if(_0x4b32fa[_0x27f4('0x24')]){_0x1b3beb(null,[_0x4b32fa[_0x27f4('0x25')]]);}else{_0x1b3beb(null,_[_0x27f4('0x26')](_0x4b32fa['Intervals'],_0x27f4('0x25')));}}else{_0x1b3beb(null,![]);}})[_0x27f4('0x13')](function(_0x192d7a){_0x1b3beb(_0x192d7a);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x27')]=function(_0x2c453c){return util[_0x27f4('0x28')](_0x27f4('0x29'),FILES_PATH,_0x2c453c);};AGIVertices[_0x27f4('0xf')][_0x27f4('0x2a')]=function(_0x43544b,_0x7f86dd,_0x63c4f2){odbc[_0x27f4('0x2b')](_0x43544b,function(_0x2426d5){if(_0x2426d5){logger[_0x27f4('0x2c')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x2426d5);_0x63c4f2(_0x2426d5);}else{logger['info'](_0x27f4('0x2d'));odbc[_0x27f4('0x2e')](_0x7f86dd,function(_0x2a3e34,_0x5bcc71){if(_0x2a3e34){logger[_0x27f4('0x2f')](_0x27f4('0x30'),_0x7f86dd);_0x63c4f2(_0x2a3e34);}else{logger[_0x27f4('0x2f')]('Query\x20executed\x20correctly\x20%s',_0x7f86dd);odbc[_0x27f4('0x31')](function(_0x187ab8){if(_0x187ab8){logger['error'](_0x27f4('0x32'),_0x187ab8);}_0x63c4f2(null,_0x5bcc71);});}});}});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x33')]=function(_0x1dbe8b,_0x1f1a9e){this['rpc'][_0x27f4('0x34')](_0x1dbe8b)[_0x27f4('0x12')](function(_0x441a1b){_0x1f1a9e(null,_0x441a1b?_0x441a1b:![]);})[_0x27f4('0x13')](function(_0x55e748){_0x1f1a9e(_0x55e748);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x35')]=function(_0x1ce9dd,_0x5a32bb){this[_0x27f4('0xd')]['createSmsMessage'](_0x1ce9dd)[_0x27f4('0x12')](function(_0x221192){_0x5a32bb(null,_0x221192);})[_0x27f4('0x13')](function(_0x27c1f6){_0x5a32bb(_0x27c1f6);});};AGIVertices['prototype'][_0x27f4('0x36')]=function(_0x3f7051,_0x28fc2d,_0xbbcd3){this[_0x27f4('0xd')]['createSquareDetailsReport']({'uniqueid':this[_0x27f4('0xc')]['uniqueid'],'node':_0x3f7051['label'],'application':_0x3f7051['agicommand'],'data':_0x28fc2d||null,'project_name':this[_0x27f4('0xc')][_0x27f4('0x37')],'callerid':this[_0x27f4('0xc')][_0x27f4('0x38')]})['then'](function(_0xa4bcaa){if(_0xbbcd3){_0xbbcd3(null,_0xa4bcaa);}})[_0x27f4('0x13')](function(_0xfaf9f){if(_0xbbcd3){_0xbbcd3(_0xfaf9f);}});};AGIVertices[_0x27f4('0xf')]['createSquareRecording']=function(_0x4dacdd,_0x19e3b8,_0x5663fa,_0x1092ae){this[_0x27f4('0xd')]['createSquareRecording']({'uniqueid':this[_0x27f4('0xc')]['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this[_0x27f4('0xc')]['calleridname'],'context':this[_0x27f4('0xc')][_0x27f4('0x39')],'extension':this['channel'][_0x27f4('0x3a')],'priority':this[_0x27f4('0xc')]['priority'],'accountcode':this[_0x27f4('0xc')][_0x27f4('0x3b')],'dnid':this[_0x27f4('0xc')][_0x27f4('0x3c')],'projectName':this[_0x27f4('0xc')][_0x27f4('0x37')],'saveName':_0x19e3b8,'filename':_0x4dacdd[_0x27f4('0x3d')]||_0x19e3b8,'savePath':_0x5663fa})[_0x27f4('0x12')](function(_0x505d5a){_0x1092ae(null,_0x505d5a);})[_0x27f4('0x13')](function(_0x5e78ce){_0x1092ae(_0x5e78ce);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x3e')]=function(_0x4590dd,_0x5b4da8,_0x51c07c,_0x69497b,_0x26cbf4){this['rpc'][_0x27f4('0x3e')]({'uniqueid':this['channel'][_0x27f4('0x3f')],'body':_0x4590dd,'direction':_0x5b4da8,'providerName':_0x51c07c,'providerResponse':_0x69497b})[_0x27f4('0x12')](function(_0x7fa822){if(_0x26cbf4){_0x26cbf4(null,_0x7fa822);}})[_0x27f4('0x13')](function(_0x3f3fc5){if(_0x26cbf4){_0x26cbf4(_0x3f3fc5);}});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x40')]=function(_0x5614d8,_0x4ef06c){this[_0x27f4('0xd')]['createCmContact']({'firstName':_[_0x27f4('0x41')](_0x5614d8[_0x27f4('0x16')])||_['isNil'](_0x5614d8[_0x27f4('0x16')])?_0x27f4('0x42')+Math[_0x27f4('0x43')]():_0x5614d8[_0x27f4('0x16')],'lastName':_[_0x27f4('0x41')](_0x5614d8[_0x27f4('0x44')])||_[_0x27f4('0x45')](_0x5614d8[_0x27f4('0x44')])?null:_0x5614d8[_0x27f4('0x44')],'phone':_0x5614d8[_0x27f4('0x46')],'ListId':_0x5614d8[_0x27f4('0x47')],'scheduledat':_0x5614d8[_0x27f4('0x48')],'callbackUniqueid':this[_0x27f4('0xc')][_0x27f4('0x3f')],'tags':_0x27f4('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x5614d8[_0x27f4('0x48')][_0x27f4('0x4a')](),'priority':_0x5614d8['callback_priority']})[_0x27f4('0x12')](function(_0x4a3640){_0x4ef06c(null,_0x4a3640);})['catch'](function(_0x2de7ac){_0x4ef06c(_0x2de7ac);});};AGIVertices['prototype']['getPause']=function(_0x5eb467,_0x5251eb){this[_0x27f4('0xd')]['getPauseById'](_0x5eb467)[_0x27f4('0x12')](function(_0x5d239a){_0x5251eb(null,_0x5d239a?_0x5d239a[_0x27f4('0x16')]:![]);})[_0x27f4('0x13')](function(_0x32c901){_0x5251eb(_0x32c901);});};AGIVertices[_0x27f4('0xf')]['agentPause']=function(_0xcf003d,_0x22ae68,_0x5ecdae){var _0x2aff02={'role':_0x27f4('0x4b')};_0x2aff02[_0xcf003d]=this['channel']['callerid'];this[_0x27f4('0xd')][_0x27f4('0x4c')](_0x2aff02,_0x22ae68,this['channel'][_0x27f4('0x3f')])['then'](function(_0x3c3a78){_0x5ecdae(null,_[_0x27f4('0x45')](_0x3c3a78)?![]:!![]);})[_0x27f4('0x13')](function(_0x232ad3){logger[_0x27f4('0x2c')](_0x232ad3);_0x5ecdae(null,![]);});};AGIVertices['prototype'][_0x27f4('0x4d')]=function(_0x5e355c,_0x1d9c99){var _0x2b602a={'role':_0x27f4('0x4b')};_0x2b602a[_0x5e355c]=this['channel'][_0x27f4('0x38')];this[_0x27f4('0xd')]['agentUnpause'](_0x2b602a)[_0x27f4('0x12')](function(_0xf3c1d7){_0x1d9c99(null,_[_0x27f4('0x45')](_0xf3c1d7)?![]:!![]);})[_0x27f4('0x13')](function(_0x1913ab){logger[_0x27f4('0x2c')](_0x1913ab);_0x1d9c99(null,![]);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x4e')]=function(_0x23ca05,_0xffcdea){var _0x155e80={'role':'agent'};_0x155e80[_0x23ca05]=this[_0x27f4('0xc')][_0x27f4('0x38')];this[_0x27f4('0xd')][_0x27f4('0x4e')](_0x155e80)[_0x27f4('0x12')](function(_0x2051a9){_0xffcdea(null,_[_0x27f4('0x45')](_0x2051a9)?![]:!![]);})['catch'](function(_0x1728b7){logger['error'](_0x1728b7);_0xffcdea(null,![]);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x4f')]=function(_0xa4a655,_0x49be26){var _0x37e4f1={'role':_0x27f4('0x4b')};_0x37e4f1[_0xa4a655]=this[_0x27f4('0xc')][_0x27f4('0x38')];var _0x42d0cc=_0xa4a655!='internal'?util[_0x27f4('0x28')](_0x27f4('0x50'),_0x27f4('0x51'),this[_0x27f4('0xc')][_0x27f4('0x38')]):undefined;this[_0x27f4('0xd')][_0x27f4('0x4f')](_0x37e4f1,_0x42d0cc)[_0x27f4('0x12')](function(_0x1e19c4){_0x49be26(null,_['isNil'](_0x1e19c4)?![]:!![]);})[_0x27f4('0x13')](function(_0x2e10f3){logger[_0x27f4('0x2c')](_0x2e10f3);_0x49be26(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x271f9e,_0x17bc43){sh[_0x27f4('0x52')](_[_0x27f4('0x53')](_0x271f9e),function(_0x592a1b,_0x476bc0){var _0x574a1b=_0x476bc0[_0x27f4('0x54')](/(\r\n|\n|\r)/gm,'');_0x17bc43(null,_0x574a1b);});};AGIVertices[_0x27f4('0xf')]['googleCloudTTS']=function(_0x4fdcf6,_0x210e90){scripts[_0x27f4('0x55')](_0x4fdcf6['apiKey'],_0x4fdcf6[_0x27f4('0x56')]||_0x27f4('0x57'),_0x4fdcf6[_0x27f4('0x57')],_0x4fdcf6[_0x27f4('0x58')]||_0x27f4('0x59'),_0x4fdcf6[_0x27f4('0x5a')]||_0x27f4('0x5b'),_0x4fdcf6['audioEncoding']||_0x27f4('0x5c'))[_0x27f4('0x12')](function(_0x4744ef){_0x210e90(null,_0x4744ef);})[_0x27f4('0x13')](function(_0x38177c){_0x210e90(_0x38177c);});};AGIVertices['prototype']['googleTTS']=function(_0x39e9e4,_0x5b9ed3){scripts[_0x27f4('0x5d')](_0x39e9e4[_0x27f4('0x57')],_0x39e9e4[_0x27f4('0x5e')]||'en',0x1)['then'](function(_0xa7810c){_0x5b9ed3(null,_0xa7810c);})[_0x27f4('0x13')](function(_0x500480){_0x5b9ed3(_0x500480);});};AGIVertices['prototype'][_0x27f4('0x5f')]=function(_0x286a51,_0xd9d68c){var _0xcf7c3b={'uri':_0x286a51[_0x27f4('0x60')],'method':_0x286a51[_0x27f4('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x286a51['timeout'])===_0x27f4('0x62')&&parseInt(_0x286a51[_0x27f4('0x63')])>=0x1?parseInt(_0x286a51[_0x27f4('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x27f4('0x64'),_0x27f4('0x65')],_0xcf7c3b['method']['toUpperCase']())){try{_0xcf7c3b[_0x27f4('0x66')]=_0x286a51[_0x27f4('0x8')]?JSON[_0x27f4('0x67')](_0x286a51[_0x27f4('0x8')]):{};}catch(_0x1c8657){logger[_0x27f4('0x2c')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1c8657);}}try{_0xcf7c3b[_0x27f4('0x68')]=_0x286a51[_0x27f4('0x7')]?JSON[_0x27f4('0x67')](_0x286a51[_0x27f4('0x7')]):{};}catch(_0x5a244b){logger[_0x27f4('0x2c')](_0x27f4('0x69'),_0x5a244b);}if(_0x286a51[_0x27f4('0x6a')]){try{var _0x13c095=require(_0x286a51[_0x27f4('0x6a')])[_0x27f4('0x6b')](this,_0xcf7c3b);_0xcf7c3b[_0x27f4('0x6c')]=Mustache[_0x27f4('0x6d')](_0x286a51['url'],_0x13c095,{},['$$','$$']);if(_0xcf7c3b[_0x27f4('0x68')]){_0xcf7c3b['headers']=JSON[_0x27f4('0x67')](Mustache['render'](JSON[_0x27f4('0x6e')](_0xcf7c3b[_0x27f4('0x68')]),_0x13c095,{},['$$','$$']));}if(_0xcf7c3b[_0x27f4('0x66')]){_0xcf7c3b['body']=JSON['parse'](Mustache[_0x27f4('0x6d')](JSON[_0x27f4('0x6e')](_0xcf7c3b[_0x27f4('0x66')]),_0x13c095,{},['$$','$$']));}}catch(_0x4bf284){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4bf284);}}rp(_0xcf7c3b)['then'](function(_0x565511){var _0x503ab8={'statusCode':_0x565511[_0x27f4('0x6f')]||0xc8,'statusMessage':_0x565511[_0x27f4('0x70')]||'OK','headers':_0x565511[_0x27f4('0x68')]||{},'body':_0x565511[_0x27f4('0x66')]||{}};_0xd9d68c(null,_0x503ab8);})[_0x27f4('0x13')](function(_0x16d029){var _0x47f5b7={'statusCode':_0x16d029[_0x27f4('0x6f')]||0x1f4,'statusMessage':_0x16d029['message']||_0x27f4('0x71'),'headers':_0x16d029[_0x27f4('0x72')][_0x27f4('0x68')]||{},'body':_0x16d029[_0x27f4('0x72')][_0x27f4('0x66')]||{}};_0xd9d68c(null,_0x47f5b7);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x73')]=function(_0x4fe730,_0x30cf66){scripts['googleDialogflow'](this[_0x27f4('0xc')]['uniqueid'],_0x4fe730[_0x27f4('0x74')],_0x4fe730[_0x27f4('0x57')],_0x4fe730[_0x27f4('0x75')]||'en')[_0x27f4('0x12')](function(_0x299a66){_0x30cf66(null,_0x299a66);})['catch'](function(_0x266c2c){_0x30cf66(_0x266c2c);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x76')]=function(_0x4b894c,_0x17f85e){scripts[_0x27f4('0x76')](this[_0x27f4('0xc')][_0x27f4('0x3f')],_0x4b894c[_0x27f4('0x77')],_0x4b894c[_0x27f4('0x78')],_0x4b894c[_0x27f4('0x79')],_0x4b894c['text'],_0x4b894c[_0x27f4('0x7a')]||'en')[_0x27f4('0x12')](function(_0x51ccd2){_0x17f85e(null,_0x51ccd2);})['catch'](function(_0x598ddf){_0x17f85e(_0x598ddf);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x7b')]=function(_0x128ff9,_0x139c6e){scripts[_0x27f4('0x7b')](this[_0x27f4('0xc')],_0x128ff9)[_0x27f4('0x12')](function(_0x174834){_0x139c6e(null,_0x174834);})[_0x27f4('0x13')](function(_0x1dfc30){_0x139c6e(_0x1dfc30);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x7c')]=function(_0x1f5529,_0x4eb387){scripts[_0x27f4('0x7c')](_0x1f5529[_0x27f4('0x74')],_0x1f5529[_0x27f4('0x57')],_0x1f5529['ispeech_tts_language']||_0x27f4('0x59'),_0x1f5529[_0x27f4('0x7d')])[_0x27f4('0x12')](function(_0x337811){_0x4eb387(null,_0x337811);})[_0x27f4('0x13')](function(_0x173dd4){_0x4eb387(_0x173dd4);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x7e')]=function(_0x4ea92a,_0x28daf8,_0x4b920a){scripts[_0x27f4('0x7e')](_0x28daf8,_0x4ea92a[_0x27f4('0x74')],_0x4ea92a['ispeech_asr_language']||_0x27f4('0x59'),this['isConfigured'](_0x4ea92a[_0x27f4('0x7f')])?_0x4ea92a[_0x27f4('0x7f')]:undefined)[_0x27f4('0x12')](function(_0x1eebe4){_0x4b920a(null,_0x1eebe4);})[_0x27f4('0x13')](function(_0x240708){_0x4b920a(_0x240708);});};AGIVertices[_0x27f4('0xf')]['awsPolly']=function(_0x1fb947,_0x5cb651){scripts[_0x27f4('0x80')](_0x1fb947['aws_access_key_id'],_0x1fb947[_0x27f4('0x81')],_0x1fb947[_0x27f4('0x82')],_0x1fb947[_0x27f4('0x83')]||'Amy',_0x1fb947[_0x27f4('0x57')],_0x1fb947[_0x27f4('0x84')]||_0x27f4('0x57'))[_0x27f4('0x12')](function(_0x550f13){_0x5cb651(null,_0x550f13);})[_0x27f4('0x13')](function(_0x3f7b15){_0x5cb651(_0x3f7b15);});};AGIVertices[_0x27f4('0xf')]['awsLex']=function(_0x30607f,_0x28a6de){scripts[_0x27f4('0x85')](this[_0x27f4('0xc')][_0x27f4('0x3f')],_0x30607f[_0x27f4('0x86')],_0x30607f[_0x27f4('0x81')],_0x30607f[_0x27f4('0x87')],_0x30607f['text'],_0x30607f[_0x27f4('0x88')])['then'](function(_0x1ae882){_0x28a6de(null,_0x1ae882);})[_0x27f4('0x13')](function(_0x3b861b){_0x28a6de(_0x3b861b);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x89')]=function(_0x171699,_0x23b5fa,_0x5e368c){scripts[_0x27f4('0x89')](_0x23b5fa,_0x171699[_0x27f4('0x74')],_0x171699[_0x27f4('0x8a')]||_0x27f4('0x59'))[_0x27f4('0x12')](function(_0x3b4d7c){_0x5e368c(null,_0x3b4d7c);})['catch'](function(_0x3716e1){_0x5e368c(_0x3716e1);});};AGIVertices['prototype'][_0x27f4('0x8b')]=function(_0x4e96aa,_0x2a6a90,_0x4bb880){scripts['tildeASR'](_0x2a6a90,_0x4e96aa[_0x27f4('0x8c')],_0x4e96aa['appsecret'],_0x4e96aa[_0x27f4('0x6c')])[_0x27f4('0x12')](function(_0x4d9ce6){_0x4bb880(null,_0x4d9ce6);})[_0x27f4('0x13')](function(_0x52e638){_0x4bb880(_0x52e638);});};AGIVertices[_0x27f4('0xf')][_0x27f4('0x8d')]=function(_0x22fb3c){var _0x2fa829=_[_0x27f4('0x8e')](verticesWithRetry,_0x22fb3c[_0x27f4('0x8f')])?_0x22fb3c:_['clone'](_0x22fb3c);for(var _0x431959 in _0x2fa829){if(_0x2fa829[_0x27f4('0x90')](_0x431959)){if(_0x2fa829[_0x431959]&&_[_0x27f4('0x91')](_0x2fa829[_0x431959])){if(_[_0x27f4('0x8e')](recursiveMapAttributes,_0x431959)){_0x2fa829[_0x431959]=this[_0x27f4('0x92')](_0x2fa829[_0x431959]);}else{_0x2fa829[_0x431959]=this[_0x27f4('0x93')](_0x2fa829[_0x431959]);}}}}return _0x2fa829;};AGIVertices[_0x27f4('0xf')][_0x27f4('0x94')]=function(_0x5b62e9){for(var _0x3f53c2 in _0x5b62e9){if(_0x5b62e9[_0x27f4('0x90')](_0x3f53c2)){if(_[_0x27f4('0x95')](_0x5b62e9[_0x3f53c2])){this[_0x27f4('0x94')](_0x5b62e9[_0x3f53c2]);}else if(_[_0x27f4('0x96')](_0x5b62e9[_0x3f53c2])){for(var _0x1e8d1b=0x0;_0x1e8d1b<_0x5b62e9[_0x3f53c2][_0x27f4('0x97')];_0x1e8d1b++){this[_0x27f4('0x94')](_0x5b62e9[_0x3f53c2][_0x1e8d1b]);}}else if(_[_0x27f4('0x91')](_0x5b62e9[_0x3f53c2])){_0x5b62e9[_0x3f53c2]=this[_0x27f4('0x93')](_0x5b62e9[_0x3f53c2]);}}}};AGIVertices['prototype'][_0x27f4('0x98')]=function(_0x2b4c9f,_0x36dc6a){for(var _0x26ab34 in _0x2b4c9f){if(_0x2b4c9f['hasOwnProperty'](_0x26ab34)){if(_[_0x27f4('0x95')](_0x2b4c9f[_0x26ab34])){if(!_[_0x27f4('0x41')](_0x2b4c9f[_0x26ab34])){this[_0x27f4('0x98')](_0x2b4c9f[_0x26ab34],util[_0x27f4('0x28')](_0x27f4('0x99'),_0x36dc6a,_0x26ab34));}}else if(_[_0x27f4('0x96')](_0x2b4c9f[_0x26ab34])){for(var _0x1fbbb7=0x0;_0x1fbbb7<_0x2b4c9f[_0x26ab34]['length'];_0x1fbbb7++){this[_0x27f4('0x98')](_0x2b4c9f[_0x26ab34][_0x1fbbb7],util[_0x27f4('0x28')]('%s.%s',_0x36dc6a,_0x26ab34+'['+_0x1fbbb7+']'));}}else{if(!_['isNil'](_0x2b4c9f[_0x26ab34])){this['channel'][_0x27f4('0x9a')](util['format'](_0x27f4('0x99'),_0x36dc6a,_0x26ab34),_0x2b4c9f[_0x26ab34]);}}}}};AGIVertices[_0x27f4('0xf')][_0x27f4('0x92')]=function(_0x55afc5){try{var _0x4e72df=JSON[_0x27f4('0x67')](_0x55afc5);this[_0x27f4('0x94')](_0x4e72df);return JSON[_0x27f4('0x6e')](_0x4e72df);}catch(_0x59f32a){return this[_0x27f4('0x93')](_0x55afc5);}};AGIVertices[_0x27f4('0xf')][_0x27f4('0x93')]=function(_0x9dec22){var _0x64b5dd=_0x9dec22['split']('{');for(var _0x1dd898=0x1;_0x1dd898<_0x64b5dd[_0x27f4('0x97')];_0x1dd898+=0x1){var _0x48f925=_0x64b5dd[_0x1dd898][_0x27f4('0x9b')]('}');if(_0x48f925[_0x27f4('0x97')]>0x1){_0x9dec22=_0x9dec22[_0x27f4('0x9c')]('{'+_0x48f925[0x0]+'}',this[_0x27f4('0xc')]['getVariable'](_0x48f925[0x0])[_0x27f4('0x9d')]||_0x48f925[0x0]);}}if(_0x64b5dd[_0x27f4('0x97')]===0x1){return _0x9dec22[_0x27f4('0x4a')]();}return this[_0x27f4('0x93')](_0x9dec22);};AGIVertices['prototype']['getAndSetVariable']=function(_0x338a6d,_0x2e171f){var _0x585975=this[_0x27f4('0xc')][_0x27f4('0x10')](_0x338a6d);if(_0x585975[_0x27f4('0x9e')]===-0x1){return _0x585975;}logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x9f'),_0x2e171f,_0x585975[_0x27f4('0x9d')]));return this[_0x27f4('0xc')]['setVariable'](_0x2e171f,_0x585975[_0x27f4('0x9d')]);};AGIVertices['prototype'][_0x27f4('0xa0')]=function(_0x46527d){return _0x46527d&&_0x46527d!=='0'&&_0x46527d!=='-1'&&_0x46527d!=='';};AGIVertices[_0x27f4('0xf')][_0x27f4('0xa1')]=function(_0x2ca0cf){this['createSquareDetailsReport'][_0x27f4('0x6b')](this,_0x2ca0cf,'-');_0x2ca0cf[_0x27f4('0xa2')]=_0x2ca0cf[_0x27f4('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x27f4('0xf')][_0x27f4('0xa3')]=function(_0xb34ed9){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0xa4'),_0xb34ed9[_0x27f4('0xa5')]));if(!this['isConfigured'](_0xb34ed9['text'])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}var _0x217653='\x22'+_0xb34ed9[_0x27f4('0x57')]+'\x22';if(this[_0x27f4('0xa0')](_0xb34ed9['options'])){_0x217653+=','+_0xb34ed9['options'];}var _0x1668f9=this[_0x27f4('0xc')][_0x27f4('0x52')](_0x27f4('0xa8'),_0x217653);if(_0x1668f9['result']===-0x1){return _0x1668f9;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0xa9'),_0x217653));};AGIVertices[_0x27f4('0xf')]['mrcprecog']=function(_0x4872d5){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0xaa'),_0x4872d5[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x4872d5[_0x27f4('0xab')])){return this[_0x27f4('0xc')]['noop'](_0x27f4('0xac'));}var _0x408875=_0x4872d5[_0x27f4('0xab')];if(this[_0x27f4('0xa0')](_0x4872d5['options'])){_0x408875+=','+_0x4872d5[_0x27f4('0x72')];}var _0x447cde=this[_0x27f4('0xc')]['exec']('MRCPRecog',_0x408875);if(_0x447cde['result']===-0x1){return _0x447cde;}var _0x1a92df=this[_0x27f4('0xad')](_0x27f4('0xae'),_0x27f4('0xaf'));if(_0x1a92df['result']===-0x1){return _0x1a92df;}var _0x51bca0=this['getAndSetVariable']('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x51bca0[_0x27f4('0x9e')]===-0x1){return _0x51bca0;}var _0x281efe=this['getAndSetVariable']('RECOG_INSTANCE()',_0x27f4('0xb0'));if(_0x281efe[_0x27f4('0x9e')]===-0x1){return _0x281efe;}return this['channel'][_0x27f4('0xa6')](util['format'](_0x27f4('0xb1'),_0x408875));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x5')]=function(_0x5b1b4f){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0xb2'),_0x5b1b4f[_0x27f4('0xa5')]));return this['channel'][_0x27f4('0x5')]([_0x5b1b4f['command'],_0x5b1b4f[_0x27f4('0xb3')]]);};AGIVertices[_0x27f4('0xf')]['answer']=function(_0x1e431e){logger['info'](util[_0x27f4('0x28')](_0x27f4('0xb4'),_0x1e431e[_0x27f4('0xa5')]));if(this['isConfigured'](_0x1e431e[_0x27f4('0x63')])){logger['info'](util['format'](_0x27f4('0xb5'),_0x1e431e[_0x27f4('0x63')]));var _0x110320=this[_0x27f4('0xc')][_0x27f4('0xb6')](_0x1e431e[_0x27f4('0x63')]);if(_0x110320[_0x27f4('0x9e')]===-0x1){return _0x110320;}}return this[_0x27f4('0xc')]['answer']();};AGIVertices[_0x27f4('0xf')]['callback']=function(_0x4299bd){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4299bd[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x4299bd[_0x27f4('0x47')])){return this[_0x27f4('0xc')]['error'](_0x4299bd,'no\x20list\x20selected');}_0x4299bd[_0x27f4('0x48')]=moment();if(this[_0x27f4('0xa0')](_0x4299bd[_0x27f4('0xb7')])){_0x4299bd[_0x27f4('0x48')]=moment()[_0x27f4('0xb8')](_0x4299bd[_0x27f4('0xb7')],'minutes');}if(!this[_0x27f4('0xa0')](_0x4299bd['callback_priority'])){_0x4299bd[_0x27f4('0xb9')]=0x2;}this[_0x27f4('0x40')][_0x27f4('0x6b')](this,_0x4299bd);return this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4299bd[_0x27f4('0x46')],_0x4299bd['list_id'],_0x4299bd[_0x27f4('0x48')]));};AGIVertices[_0x27f4('0xf')][_0x27f4('0xba')]=function(_0x2fbeff){logger['info'](util[_0x27f4('0x28')](_0x27f4('0xbb'),_0x2fbeff[_0x27f4('0xa5')]));var _0x494834=this['channel'][_0x27f4('0x52')](_0x2fbeff[_0x27f4('0xbc')],_0x2fbeff[_0x27f4('0x72')]);if(_0x494834[_0x27f4('0x9e')]===-0x1){return _0x494834;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0xbd'),_0x2fbeff['application'],_0x2fbeff['options']));};AGIVertices[_0x27f4('0xf')][_0x27f4('0xbe')]=function(_0x3c1cc3){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0xbf'),_0x3c1cc3[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x3c1cc3[_0x27f4('0x57')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}var _0x1f89e0='\x22'+_0x3c1cc3['text']+'\x22';if(this[_0x27f4('0xa0')](_0x3c1cc3[_0x27f4('0x72')])){_0x1f89e0+=','+_0x3c1cc3[_0x27f4('0x72')];}var _0x3b3058=this[_0x27f4('0xc')][_0x27f4('0x52')]('MRCPSynth',_0x1f89e0);if(_0x3b3058['result']===-0x1){return _0x3b3058;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0xa9'),_0x1f89e0));};AGIVertices[_0x27f4('0xf')][_0x27f4('0xc0')]=function(_0x20b83c){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0xc1'),_0x20b83c[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x20b83c[_0x27f4('0x57')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}var _0x127d6c='\x22'+_0x20b83c[_0x27f4('0x57')]+'\x22';if(this[_0x27f4('0xa0')](_0x20b83c['options'])){_0x127d6c+=','+_0x20b83c[_0x27f4('0x72')];}var _0x26e61e=this[_0x27f4('0xc')][_0x27f4('0x52')](_0x27f4('0xa8'),_0x127d6c);if(_0x26e61e[_0x27f4('0x9e')]===-0x1){return _0x26e61e;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0xa9'),_0x127d6c));};AGIVertices[_0x27f4('0xf')][_0x27f4('0xc2')]=function(_0x32c37c){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x32c37c['label']));if(!this[_0x27f4('0xa0')](_0x32c37c['grammar'])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xac'));}var _0x45ecb3=_0x32c37c['grammar'];if(this['isConfigured'](_0x32c37c[_0x27f4('0x72')])){_0x45ecb3+=','+_0x32c37c[_0x27f4('0x72')];}var _0xf1d6ea=this[_0x27f4('0xc')][_0x27f4('0x52')](_0x27f4('0xc3'),_0x45ecb3);if(_0xf1d6ea[_0x27f4('0x9e')]===-0x1){return _0xf1d6ea;}var _0x50ea13=this[_0x27f4('0xad')](_0x27f4('0xae'),_0x27f4('0xc4'));if(_0x50ea13['result']===-0x1){return _0x50ea13;}var _0x43a51c=this['getAndSetVariable'](_0x27f4('0xc5'),_0x27f4('0xc6'));if(_0x43a51c[_0x27f4('0x9e')]===-0x1){return _0x43a51c;}var _0x4629b5=this['getAndSetVariable'](_0x27f4('0xc7'),_0x27f4('0xc8'));if(_0x4629b5[_0x27f4('0x9e')]===-0x1){return _0x4629b5;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0xb1'),_0x45ecb3));};AGIVertices[_0x27f4('0xf')][_0x27f4('0xc9')]=function(_0x1333de){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1333de['label']));if(!this[_0x27f4('0xa0')](_0x1333de[_0x27f4('0xab')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xac'));}var _0x13852c=_0x1333de[_0x27f4('0xab')];if(this[_0x27f4('0xa0')](_0x1333de[_0x27f4('0x72')])){_0x13852c+=','+_0x1333de[_0x27f4('0x72')];}var _0x34fe6e=this[_0x27f4('0xc')][_0x27f4('0x52')](_0x27f4('0xc3'),_0x13852c);if(_0x34fe6e[_0x27f4('0x9e')]===-0x1){return _0x34fe6e;}var _0x3c8312=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x27f4('0xca'));if(_0x3c8312[_0x27f4('0x9e')]===-0x1){return _0x3c8312;}var _0xa23964=this[_0x27f4('0xad')](_0x27f4('0xc5'),_0x27f4('0xcb'));if(_0xa23964[_0x27f4('0x9e')]===-0x1){return _0xa23964;}var _0x1e794b=this['getAndSetVariable'](_0x27f4('0xc7'),_0x27f4('0xcc'));if(_0x1e794b[_0x27f4('0x9e')]===-0x1){return _0x1e794b;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0xb1'),_0x13852c));};AGIVertices[_0x27f4('0xf')][_0x27f4('0xcd')]=function(_0x3d0677){logger[_0x27f4('0x2f')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3d0677[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x3d0677[_0x27f4('0xce')])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x3d0677,'no\x20database\x20selected');}var _0x3a5940=this[_0x27f4('0xcf')]['sync'](this,_0x3d0677['odbc_id']);if(!_0x3a5940){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x3d0677,_0x27f4('0xd0'));}if(!this['isConfigured'](_0x3d0677[_0x27f4('0x2e')])){return this['channel'][_0x27f4('0x2c')](_0x3d0677,'no\x20query\x20configured');}var _0x53c07c=_0x3d0677['query'][_0x27f4('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')]('query:\x20%s',_0x53c07c));var _0x10a9f0=this[_0x27f4('0x2a')][_0x27f4('0x6b')](this,_0x3a5940,_0x53c07c);this[_0x27f4('0x36')]['sync'](this,_0x3d0677,_0x53c07c);if(!this[_0x27f4('0xa0')](_0x3d0677['variable_id'])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xd1'));}var _0x2b2260=this['getVariable'][_0x27f4('0x6b')](this,_0x3d0677[_0x27f4('0xd2')]);if(!_0x2b2260){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x3d0677,_0x27f4('0xd3'));}var _0xf73637=this;_0x10a9f0[_0x27f4('0xd4')](function(_0x4dbb8a,_0x22f2c0){Object[_0x27f4('0xd5')](_0x4dbb8a)[_0x27f4('0xd4')](function(_0x45395e){_0xf73637[_0x27f4('0xc')]['setVariable'](util[_0x27f4('0x28')](_0x27f4('0xd6'),_0x2b2260,_0x22f2c0,_0x45395e),_0x4dbb8a[_0x45395e]);});});this[_0x27f4('0xc')][_0x27f4('0x9a')](util[_0x27f4('0x28')](_0x27f4('0xd7'),_0x2b2260),_0x10a9f0[_0x27f4('0x97')]);return this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')](_0x27f4('0xd8'),_0x2b2260));};AGIVertices[_0x27f4('0xf')][_0x27f4('0xd9')]=function(_0x3ffe72){logger[_0x27f4('0xda')](util[_0x27f4('0x28')](_0x27f4('0xdb'),_0x3ffe72[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x3ffe72[_0x27f4('0xdc')])){return this[_0x27f4('0xc')]['error'](_0x3ffe72,_0x27f4('0xdd'));}var _0x3b750c=this[_0x27f4('0x19')][_0x27f4('0x6b')](this,_0x3ffe72['sip_id']);if(!_0x3b750c){return this[_0x27f4('0xc')]['error'](_0x3ffe72,_0x27f4('0xde'));}var _0x3db207=this[_0x27f4('0xc')][_0x27f4('0x52')](_0x27f4('0xdf'),[util[_0x27f4('0x28')](_0x27f4('0xe0'),_0x3b750c),_0x3ffe72[_0x27f4('0x63')],_0x3ffe72[_0x27f4('0xe1')],_0x3ffe72[_0x27f4('0x60')]]);if(_0x3db207[_0x27f4('0x9e')]===-0x1){return _0x3db207;}return this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')](_0x27f4('0xe2'),_0x27f4('0xdf')));};AGIVertices[_0x27f4('0xf')][_0x27f4('0xe3')]=function(_0x31292e){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0xe4'),_0x31292e['label']));if(!this[_0x27f4('0xa0')](_0x31292e[_0x27f4('0x74')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xe5'));}if(!this[_0x27f4('0xa0')](_0x31292e[_0x27f4('0x57')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}this[_0x27f4('0xc')]['bot']=!![];this[_0x27f4('0x36')](_0x31292e);this['createSquareMessage'](_0x31292e['text'],'in','','');this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0xe6'),_0x31292e[_0x27f4('0x57')]));var _0x38ce14=this[_0x27f4('0x73')][_0x27f4('0x6b')](this,_0x31292e);if(_0x38ce14){for(var _0x393e96 in _0x38ce14){if(_0x38ce14[_0x27f4('0x90')](_0x393e96)){this['channel']['setVariable'](util[_0x27f4('0x28')](_0x27f4('0xe7'),_0x393e96[_0x27f4('0xe8')]()),_0x38ce14[_0x393e96]);}}this['createSquareMessage'](_0x38ce14['speech'],'out',_0x27f4('0xe3'),'');return this[_0x27f4('0xc')]['noop'](util['format']('Dialogflow\x20Result\x20%s',_0x38ce14[_0x27f4('0xe9')]));}return this['channel']['error'](_0x31292e,_0x27f4('0xea'));};AGIVertices['prototype'][_0x27f4('0xeb')]=function(_0x200df5){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0xec'),_0x200df5[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x200df5[_0x27f4('0x77')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xed'));}if(!this[_0x27f4('0xa0')](_0x200df5['client_email'])){return this[_0x27f4('0xc')][_0x27f4('0xa6')]('no\x20client_email\x20configured');}if(!this[_0x27f4('0xa0')](_0x200df5[_0x27f4('0x79')])){return this[_0x27f4('0xc')]['noop'](_0x27f4('0xee'));}if(!this[_0x27f4('0xa0')](_0x200df5['dialogflowV2_language'])){return this[_0x27f4('0xc')]['noop'](_0x27f4('0xef'));}if(!this['isConfigured'](_0x200df5['text'])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}this['channel']['bot']=!![];this[_0x27f4('0x36')](_0x200df5);this[_0x27f4('0x3e')](_0x200df5[_0x27f4('0x57')],'in','','');this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0xf0'),_0x200df5[_0x27f4('0x57')]));var _0x2a03e7=this[_0x27f4('0x76')][_0x27f4('0x6b')](this,_0x200df5);if(_0x2a03e7){for(var _0x38943d in _0x2a03e7){if(_0x2a03e7[_0x27f4('0x90')](_0x38943d)){if(_0x38943d!==_0x27f4('0xf1')){this[_0x27f4('0xc')][_0x27f4('0x9a')](util[_0x27f4('0x28')](_0x27f4('0xe7'),_0x38943d[_0x27f4('0xe8')]()),_0x2a03e7[_0x38943d]);}}}this[_0x27f4('0x3e')](_0x2a03e7[_0x27f4('0xe9')],_0x27f4('0xf2'),_0x27f4('0xeb'),_0x2a03e7[_0x27f4('0xf1')]);return this['channel'][_0x27f4('0xa6')](util['format'](_0x27f4('0xf3'),_0x2a03e7[_0x27f4('0xe9')]));}return this[_0x27f4('0xc')]['error'](_0x200df5,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x27f4('0xf')][_0x27f4('0xf4')]=function(_0x161258){logger[_0x27f4('0x2f')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x161258[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x161258['ndauth_url'])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xf5'));}if(!this[_0x27f4('0xa0')](_0x161258[_0x27f4('0xf6')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xf7'));}if(!this['isConfigured'](_0x161258[_0x27f4('0xf8')])){return this['channel'][_0x27f4('0xa6')](_0x27f4('0xf9'));}if(!this[_0x27f4('0xa0')](_0x161258[_0x27f4('0xfa')])){return this['channel']['noop'](_0x27f4('0xa7'));}this[_0x27f4('0xc')][_0x27f4('0xfb')]=!![];this['createSquareDetailsReport'](_0x161258);this[_0x27f4('0x3e')](_0x161258[_0x27f4('0x57')],'in','','');this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')](_0x27f4('0xfc'),_0x161258[_0x27f4('0x57')]));var _0x2a0061=this['sestekNDA'][_0x27f4('0x6b')](this,_0x161258);if(_0x2a0061){for(var _0x201875 in _0x2a0061){if(_0x2a0061[_0x27f4('0x90')](_0x201875)){this['channel'][_0x27f4('0x9a')](util[_0x27f4('0x28')](_0x27f4('0xfd'),_0x201875[_0x27f4('0xe8')]()),_0x2a0061[_0x201875]);}}this[_0x27f4('0x3e')](_0x2a0061['speech'],'out','sesteknda','');if(_0x2a0061[_0x27f4('0xfe')]){this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0xff'),_0x2a0061[_0x27f4('0xfe')]));var _0x4e5847=this[_0x27f4('0xc')][_0x27f4('0x100')](_0x2a0061[_0x27f4('0xfe')]);try{fs[_0x27f4('0x101')](_0x2a0061[_0x27f4('0xfe')]+_0x27f4('0x102'));}catch(_0x5f21c1){logger['error'](_0x5f21c1);}return _0x4e5847;}else{return this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')](_0x27f4('0x103'),_0x2a0061[_0x27f4('0xe9')]));}}return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x161258,_0x27f4('0x104'));};AGIVertices[_0x27f4('0xf')]['end']=function(_0xb6fc46){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0xb6fc46['label']));return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x105'));};AGIVertices['prototype'][_0x27f4('0x106')]=function(_0xe20c74){logger['info'](util[_0x27f4('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe20c74[_0x27f4('0xa5')]));var _0x2c456d='';if(_0xe20c74[_0x27f4('0x107')]){if(!this['isConfigured'](_0xe20c74['trunk_id'])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0xe20c74,_0x27f4('0x108'));}else{var _0x49f107=parseInt(_0xe20c74[_0x27f4('0x107')],0xa);if(isNaN(_0x49f107)){_0x2c456d=_0xe20c74[_0x27f4('0x107')];}else{_0x2c456d=this[_0x27f4('0x1b')][_0x27f4('0x6b')](this,_0xe20c74['trunk_id']);if(!_0x2c456d){return this['channel']['error'](_0xe20c74,_0x27f4('0x109'));}}}}else if(_0xe20c74[_0x27f4('0x10a')]){_0x2c456d=_0xe20c74[_0x27f4('0x10a')];}else{return this['channel'][_0x27f4('0x2c')](_0xe20c74,_0x27f4('0x108'));}var _0x2612db=this[_0x27f4('0xc')][_0x27f4('0x52')]('DIAL',[util[_0x27f4('0x28')](_0x27f4('0x10b'),_0x2c456d,_0xe20c74[_0x27f4('0x46')]),_0xe20c74['timeout'],_0xe20c74[_0x27f4('0xe1')],_0xe20c74['url']]);if(_0x2612db[_0x27f4('0x9e')]===-0x1){return _0x2612db;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0xe2'),_0x27f4('0xdf')));};AGIVertices['prototype']['finally']=function(_0x5a6760){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x10c'),_0x5a6760[_0x27f4('0xa5')]));return this[_0x27f4('0xc')]['noop']('finally');};AGIVertices[_0x27f4('0xf')][_0x27f4('0xa')]=function(_0x284d92){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x10d'),_0x284d92[_0x27f4('0xa5')]));if(_0x284d92[_0x27f4('0xa2')]===0x0){return this[_0x27f4('0xa1')](_0x284d92);}_0x284d92[_0x27f4('0xa2')]-=0x1;if(!this[_0x27f4('0xa0')](_0x284d92[_0x27f4('0x10e')])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x284d92,_0x27f4('0x10f'));}var _0xa3f282=this[_0x27f4('0x1d')][_0x27f4('0x6b')](this,_0x284d92[_0x27f4('0x10e')]);if(!_0xa3f282){return this[_0x27f4('0xc')]['error'](_0x284d92,'no\x20file\x20audio\x20found');}if(!this[_0x27f4('0xa0')](_0x284d92[_0x27f4('0xd2')])){return this['channel'][_0x27f4('0x2c')](_0x27f4('0xd1'));}var _0x434403=this['channel']['getData'](_0xa3f282,_0x284d92[_0x27f4('0x110')],_0x284d92[_0x27f4('0x111')]);var _0x52c39f=_0x434403[_0x27f4('0x9e')]?_0x434403['result'][_0x27f4('0x4a')]():'';logger[_0x27f4('0x2f')](_0x27f4('0x112'),JSON[_0x27f4('0x6e')](_0x434403));if(_0x434403['result']===-0x1){this[_0x27f4('0x36')]['sync'](this,_0x284d92,_0x52c39f);return _0x434403;}else if(_0x434403[_0x27f4('0x9d')]===_0x27f4('0x63')){_0x434403['result']=_0x52c39f[_0x27f4('0x97')]>=parseInt(_0x284d92[_0x27f4('0x113')])?'x':'i';}else{_0x434403[_0x27f4('0x9e')]=_0x52c39f[_0x27f4('0x97')]>=parseInt(_0x284d92[_0x27f4('0x113')])&&_0x52c39f[_0x27f4('0x97')]<=parseInt(_0x284d92[_0x27f4('0x111')])?'x':'i';}var _0x11a521=this[_0x27f4('0x10')][_0x27f4('0x6b')](this,_0x284d92[_0x27f4('0xd2')]);if(!_0x11a521){return this['channel']['error'](_0x284d92,_0x27f4('0xd3'));}this['channel'][_0x27f4('0x9a')](_0x11a521,_0x52c39f);if(this[_0x27f4('0xa0')](_0x284d92[_0x27f4('0x114')])){var _0xb12f5c=parseInt(_0x284d92[_0x27f4('0x114')],0xa);var _0x55039c=rs[_0x27f4('0x115')]({'charset':'*','length':_0xb12f5c});var _0x57ac37=_0x52c39f[_0x27f4('0x97')];if(_0x57ac37>0x0){if(_0x57ac37>_0xb12f5c){this[_0x27f4('0x36')][_0x27f4('0x6b')](this,_0x284d92,_0x284d92[_0x27f4('0x116')]===_0x27f4('0x117')?_0x55039c+_0x52c39f[_0x27f4('0x118')](_0xb12f5c):_0x52c39f[_0x27f4('0x118')](0x0,_0x57ac37-_0xb12f5c)+_0x55039c);}else{this['createSquareDetailsReport'][_0x27f4('0x6b')](this,_0x284d92,rs[_0x27f4('0x115')]({'charset':'*','length':_0x57ac37}));}}else{this[_0x27f4('0x36')][_0x27f4('0x6b')](this,_0x284d92,'');}}else{this[_0x27f4('0x36')][_0x27f4('0x6b')](this,_0x284d92,_0x52c39f);}return _0x434403;};AGIVertices[_0x27f4('0xf')]['getsecretdigits']=function(_0x47b2ae){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x119'),_0x47b2ae[_0x27f4('0xa5')]));return this[_0x27f4('0xa')](_0x47b2ae);};AGIVertices[_0x27f4('0xf')]['goal']=function(_0x42d442){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x42d442['label']));this[_0x27f4('0x36')][_0x27f4('0x6b')](this,_0x42d442,_0x42d442[_0x27f4('0x11a')]);return this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')]('GOAL\x20%s',_0x42d442['goalname']));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x11b')]=function(_0x38e997){logger['info'](util[_0x27f4('0x28')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x38e997[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x38e997[_0x27f4('0x86')])||!this[_0x27f4('0xa0')](_0x38e997[_0x27f4('0x81')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x11c'));}if(!this[_0x27f4('0xa0')](_0x38e997[_0x27f4('0x57')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}this[_0x27f4('0xc')]['noop'](util['format'](_0x27f4('0x11d'),_0x38e997[_0x27f4('0x57')]));var _0x3eef6f=this[_0x27f4('0x80')][_0x27f4('0x6b')](this,_0x38e997);if(_0x3eef6f){this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x3eef6f));var _0xddcebd=this[_0x27f4('0xc')]['streamFile'](_0x3eef6f);try{fs['unlink'](_0x3eef6f+'.wav');}catch(_0x2bd6ee){logger[_0x27f4('0x2c')](_0x2bd6ee);}return _0xddcebd;}return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x38e997,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x27f4('0x11e')]=function(_0xce972b){logger['info'](util['format'](_0x27f4('0x11f'),_0xce972b['label']));if(!this[_0x27f4('0xa0')](_0xce972b[_0x27f4('0x86')])||!this[_0x27f4('0xa0')](_0xce972b['aws_secret_access_key'])){return this[_0x27f4('0xc')][_0x27f4('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x27f4('0xa0')](_0xce972b[_0x27f4('0x88')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x120'));}if(!this['isConfigured'](_0xce972b[_0x27f4('0x57')])){return this['channel'][_0x27f4('0xa6')](_0x27f4('0xa7'));}this[_0x27f4('0xc')][_0x27f4('0xfb')]=!![];this[_0x27f4('0x36')](_0xce972b);this[_0x27f4('0x3e')](_0xce972b[_0x27f4('0x57')],'in','','');this['channel']['noop'](util[_0x27f4('0x28')](_0x27f4('0x121'),_0xce972b[_0x27f4('0x57')]));var _0x36fa54=this['awsLex'][_0x27f4('0x6b')](this,_0xce972b);if(_0x36fa54){for(var _0x88b927 in _0x36fa54){if(_0x36fa54[_0x27f4('0x90')](_0x88b927)&&_[_0x27f4('0x91')](_0x36fa54[_0x88b927])){this['channel']['setVariable'](util[_0x27f4('0x28')](_0x27f4('0x122'),_0x88b927[_0x27f4('0xe8')]()),_0x36fa54[_0x88b927]);}}if(_[_0x27f4('0x45')](_0x36fa54[_0x27f4('0x123')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x27f4('0x3e')](_0x36fa54[_0x27f4('0x123')],_0x27f4('0xf2'),_0x27f4('0x124'),'');return this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x36fa54[_0x27f4('0x123')]));}}return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0xce972b,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x27f4('0xf')][_0x27f4('0x125')]=function(_0x473e12){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x126'),_0x473e12['label'],_0x473e12[_0x27f4('0x63')]));if(!this[_0x27f4('0xa0')](_0x473e12[_0x27f4('0x74')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xe5'));}var _0x1950c0=_0x27f4('0x127');var _0x3f6cad=util[_0x27f4('0x28')](_0x27f4('0x128'),FILES_PATH,rs[_0x27f4('0x115')](0x4));var _0x2345c3=util[_0x27f4('0x28')](_0x27f4('0x99'),_0x3f6cad,_0x1950c0);var _0x1e69d1=!![];if(_0x473e12['beep']===_0x27f4('0x129')){_0x1e69d1=![];}var _0x4d8cc3=this[_0x27f4('0xc')][_0x27f4('0x12a')](_0x3f6cad,_0x1950c0,_0x473e12[_0x27f4('0x12b')],_0x473e12[_0x27f4('0x63')],undefined,_0x1e69d1);if(_0x4d8cc3[_0x27f4('0x9e')]!==-0x1){this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')]('google\x20%s\x20file\x20created',_0x2345c3));var _0x1adc5e=this['googleASR'][_0x27f4('0x6b')](this,_0x473e12,_0x2345c3);if(_0x1adc5e){for(var _0x216858 in _0x1adc5e){if(_0x1adc5e[_0x27f4('0x90')](_0x216858)){this[_0x27f4('0xc')][_0x27f4('0x9a')](util[_0x27f4('0x28')](_0x27f4('0x12c'),_0x216858[_0x27f4('0xe8')]()),_0x1adc5e[_0x216858]);}}return this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x12d'),JSON[_0x27f4('0x6e')](_0x1adc5e)));}}return _0x4d8cc3;};AGIVertices[_0x27f4('0xf')]['tildeasr']=function(_0x501b2f){logger['info'](util['format'](_0x27f4('0x12e'),_0x501b2f[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x501b2f[_0x27f4('0x8c')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x12f'));}if(!this[_0x27f4('0xa0')](_0x501b2f[_0x27f4('0x130')])){return this[_0x27f4('0xc')]['noop']('no\x20appsecret\x20configured');}var _0x215b9d=_0x27f4('0x127');var _0x8ac1f4=util[_0x27f4('0x28')](_0x27f4('0x128'),FILES_PATH,rs[_0x27f4('0x115')](0x4));var _0x1a829d=util[_0x27f4('0x28')](_0x27f4('0x99'),_0x8ac1f4,_0x215b9d);var _0x573082=!![];if(_0x501b2f['beep']===_0x27f4('0x129')){_0x573082=![];}var _0x47b729=this['channel']['recordFile'](_0x8ac1f4,_0x215b9d,_0x501b2f[_0x27f4('0x12b')],_0x501b2f[_0x27f4('0x63')],undefined,_0x573082);if(_0x47b729[_0x27f4('0x9e')]!==-0x1){this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x131'),_0x1a829d));var _0x30b0da=this['tildeASR'][_0x27f4('0x6b')](this,_0x501b2f,_0x1a829d);if(_0x30b0da){for(var _0x519151 in _0x30b0da){if(_0x30b0da[_0x27f4('0x90')](_0x519151)){this[_0x27f4('0xc')][_0x27f4('0x9a')](util[_0x27f4('0x28')]('TILDE_ASR_%s',_0x519151[_0x27f4('0xe8')]()),_0x30b0da[_0x519151]);}}return this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')]('TildeASR\x20Result\x20%s',JSON[_0x27f4('0x6e')](_0x30b0da)));}}return _0x47b729;};AGIVertices['prototype'][_0x27f4('0x132')]=function(_0x4066ab){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x133'),_0x4066ab[_0x27f4('0xa5')]));return this[_0x27f4('0xc')]['continueAt'](_0x4066ab[_0x27f4('0x39')],_0x4066ab['extension'],_0x4066ab['priority']);};AGIVertices['prototype'][_0x27f4('0x134')]=function(_0x1119a7){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x135'),_0x1119a7[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x1119a7[_0x27f4('0x136')])){return this['channel']['error'](_0x1119a7,_0x27f4('0x137'));}try{var _0x45d7f3=eval(_0x1119a7['condition'])?_0x27f4('0x138'):_0x27f4('0x139');this['channel']['noop'](util[_0x27f4('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x1119a7[_0x27f4('0x136')],_0x45d7f3));return{'code':0xc8,'result':_0x45d7f3};}catch(_0x4feccb){return{'code':0xc8,'result':_0x27f4('0x139')};}};AGIVertices[_0x27f4('0xf')][_0x27f4('0x13a')]=function(_0x54b9fe){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x13b'),_0x54b9fe[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x54b9fe[_0x27f4('0x13c')])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x54b9fe,_0x27f4('0x13d'));}var _0x889164=this[_0x27f4('0x22')]['sync'](this,_0x54b9fe[_0x27f4('0x13c')]);if(!_0x889164){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x54b9fe,_0x27f4('0x13e'));}for(var _0x67c011=0x0;_0x67c011<_0x889164[_0x27f4('0x97')];_0x67c011+=0x1){var _0x3de4d6=this['channel'][_0x27f4('0x10')](util[_0x27f4('0x28')](_0x27f4('0x13f'),_0x889164[_0x67c011]));if(_0x3de4d6[_0x27f4('0x9e')]===-0x1){return _0x3de4d6;}logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x140'),_0x889164[_0x67c011],_0x3de4d6[_0x27f4('0x9d')]));if(_0x3de4d6['extra']==='true'){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('IFTIME\x20%s\x20%s',_0x889164[_0x67c011],'true'));this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x140'),_0x889164[_0x67c011],'true'));return{'code':0xc8,'result':_0x27f4('0x138')};}else{logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x140'),_0x889164[_0x67c011],'false'));this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')]('IFTIME\x20%s\x20%s',_0x889164[_0x67c011],_0x27f4('0x139')));}}return{'code':0xc8,'result':_0x27f4('0x139')};};AGIVertices[_0x27f4('0xf')][_0x27f4('0x141')]=function(_0x5b8ca1){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x142'),_0x5b8ca1[_0x27f4('0xa5')]));return this[_0x27f4('0xc')][_0x27f4('0x141')]();};AGIVertices[_0x27f4('0xf')]['ispeechasr']=function(_0x2692c8){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x2692c8['label']));if(!this[_0x27f4('0xa0')](_0x2692c8[_0x27f4('0x74')])){return this['channel'][_0x27f4('0xa6')]('no\x20key\x20configured');}var _0x3f18b5='wav';var _0x97b5b2=util[_0x27f4('0x28')](_0x27f4('0x128'),FILES_PATH,rs[_0x27f4('0x115')](0x4));var _0x4f225e=util[_0x27f4('0x28')](_0x27f4('0x99'),_0x97b5b2,_0x3f18b5);var _0x2cf39c=!![];if(_0x2692c8['beep']===_0x27f4('0x129')){_0x2cf39c=![];}var _0x425c38=this['channel']['recordFile'](_0x97b5b2,_0x3f18b5,_0x2692c8[_0x27f4('0x12b')],_0x2692c8['timeout'],undefined,_0x2cf39c);if(_0x425c38[_0x27f4('0x9e')]!==-0x1){this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')]('ispeech\x20%s\x20file\x20created',_0x4f225e));var _0x250720=this[_0x27f4('0x7e')][_0x27f4('0x6b')](this,_0x2692c8,_0x4f225e);if(_0x250720){for(var _0x1010dc in _0x250720){if(_0x250720[_0x27f4('0x90')](_0x1010dc)){this[_0x27f4('0xc')][_0x27f4('0x9a')](util[_0x27f4('0x28')](_0x27f4('0x143'),_0x1010dc[_0x27f4('0xe8')]()),_0x250720[_0x1010dc]);}}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0x144'),JSON['stringify'](_0x250720)));}}return _0x425c38;};AGIVertices['prototype'][_0x27f4('0x145')]=function(_0x59f505){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x146'),_0x59f505[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x59f505[_0x27f4('0x74')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xe5'));}if(!this[_0x27f4('0xa0')](_0x59f505[_0x27f4('0x57')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x147'),_0x59f505['text']));var _0x18c893=this[_0x27f4('0x7c')][_0x27f4('0x6b')](this,_0x59f505);if(_0x18c893){this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')]('ispeech\x20%s\x20file\x20created',_0x18c893));var _0x56f4a9=this[_0x27f4('0xc')][_0x27f4('0x100')](_0x18c893,_0x59f505[_0x27f4('0x12b')]);try{fs['unlink'](_0x18c893+'.wav');}catch(_0x384873){logger['error'](_0x384873);}return _0x56f4a9;}return this[_0x27f4('0xc')]['error'](_0x59f505,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x27f4('0xf')][_0x27f4('0x148')]=function(_0x2f8ad7){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x149'),_0x2f8ad7['label']));if(!this[_0x27f4('0xa0')](_0x2f8ad7[_0x27f4('0x14a')])){return this['channel']['error'](_0x2f8ad7,_0x27f4('0x14b'));}logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x14c'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x2f8ad7['findBy']));var _0x382ff0=this[_0x27f4('0x4f')][_0x27f4('0x6b')](this,_0x2f8ad7['findBy']);if(_0x382ff0){logger['info'](util[_0x27f4('0x28')](_0x27f4('0x14d'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x2f8ad7[_0x27f4('0x14a')]));this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0x14d'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x2f8ad7['findBy']));return{'code':0xc8,'result':_0x27f4('0x14e')};}else{logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x14f'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x2f8ad7[_0x27f4('0x14a')]));this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')](_0x27f4('0x14f'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x2f8ad7[_0x27f4('0x14a')]));return{'code':0xc8,'result':_0x27f4('0x150')};}};AGIVertices[_0x27f4('0xf')][_0x27f4('0x151')]=function(_0x2c520f){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x152'),_0x2c520f[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x2c520f[_0x27f4('0x14a')])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x2c520f,_0x27f4('0x14b'));}logger['info'](util[_0x27f4('0x28')](_0x27f4('0x14c'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x2c520f[_0x27f4('0x14a')]));var _0x2248ca=this[_0x27f4('0x4e')]['sync'](this,_0x2c520f[_0x27f4('0x14a')]);if(_0x2248ca){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x14d'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x2c520f['findBy']));this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0x14d'),this[_0x27f4('0xc')]['callerid'],_0x2c520f[_0x27f4('0x14a')]));return{'code':0xc8,'result':_0x27f4('0x14e')};}else{logger['info'](util[_0x27f4('0x28')](_0x27f4('0x14f'),this['channel']['callerid'],_0x2c520f[_0x27f4('0x14a')]));this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0x14f'),this[_0x27f4('0xc')]['callerid'],_0x2c520f[_0x27f4('0x14a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x27f4('0x153')]=function(_0x2b06c6){logger[_0x27f4('0x2f')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2b06c6[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x2b06c6[_0x27f4('0x154')])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x2b06c6,_0x27f4('0x155'));}this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x156'),_0x2b06c6[_0x27f4('0x154')]));var _0x10f213=eval(_0x2b06c6['operation']);if(!this[_0x27f4('0xa0')](_0x2b06c6[_0x27f4('0xd2')])){return this[_0x27f4('0xc')]['noop'](_0x27f4('0xd1'));}var _0x536775=this[_0x27f4('0x10')][_0x27f4('0x6b')](this,_0x2b06c6['variable_id']);if(!_0x536775){return this[_0x27f4('0xc')]['error'](_0x2b06c6,_0x27f4('0xd3'));}if(_['isArray'](_0x10f213)){var _0xd14183=this;_0x10f213[_0x27f4('0xd4')](function(_0x56a865,_0x5f3791){_0xd14183[_0x27f4('0xc')][_0x27f4('0x9a')](util[_0x27f4('0x28')](_0x27f4('0x157'),_0x536775,_0x5f3791),_0x56a865);});return this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')](_0x27f4('0x158'),_0x536775));}else{return this['channel'][_0x27f4('0x9a')](_0x536775,_0x10f213);}};AGIVertices[_0x27f4('0xf')]['menu']=function(_0x555005){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x159'),_0x555005[_0x27f4('0xa5')]));if(_0x555005[_0x27f4('0xa2')]===0x0){return this[_0x27f4('0xa1')](_0x555005);}_0x555005[_0x27f4('0xa2')]-=0x1;if(!this[_0x27f4('0xa0')](_0x555005['file_id'])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x555005,'no\x20file\x20audio\x20selected');}var _0x25c1df=this[_0x27f4('0x1d')][_0x27f4('0x6b')](this,_0x555005['file_id']);if(!_0x25c1df){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x555005,_0x27f4('0x15a'));}var _0x4d4639=this['channel'][_0x27f4('0x15b')](_0x25c1df,_0x555005[_0x27f4('0x110')],_0x555005['digit']);var _0x20b3a4=_0x4d4639[_0x27f4('0x9e')];if(_0x4d4639['result']===-0x1){this['createSquareDetailsReport'][_0x27f4('0x6b')](this,_0x555005,'-1');return _0x4d4639;}else if(_0x4d4639[_0x27f4('0x9d')]==='timeout'){_0x4d4639['result']=_0x4d4639[_0x27f4('0x9e')][_0x27f4('0x97')]>0x0?_0x4d4639['result']:'t';}else if(_[_0x27f4('0x41')](_0x4d4639[_0x27f4('0x9e')])){_0x4d4639[_0x27f4('0x9e')]='#';_0x20b3a4='#';}if(!this[_0x27f4('0xa0')](_0x555005[_0x27f4('0xd2')])){this[_0x27f4('0xc')]['noop'](_0x27f4('0xd1'));}else{var _0x4dd15f=this[_0x27f4('0x10')]['sync'](this,_0x555005[_0x27f4('0xd2')]);if(!_0x4dd15f){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x555005,'no\x20variable\x20found');}this[_0x27f4('0xc')][_0x27f4('0x9a')](_0x4dd15f,_0x20b3a4);}this[_0x27f4('0x36')][_0x27f4('0x6b')](this,_0x555005,_0x20b3a4);return _0x4d4639;};AGIVertices[_0x27f4('0xf')][_0x27f4('0xa6')]=function(_0x2e1a8f){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x15c'),_0x2e1a8f[_0x27f4('0xa5')]));return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x2e1a8f[_0x27f4('0x15d')]||_0x2e1a8f[_0x27f4('0xa5')]);};AGIVertices['prototype'][_0x27f4('0x15e')]=function(_0x1014c0){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x1014c0[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x1014c0['findBy'])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x1014c0,_0x27f4('0x14b'));}logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x14c'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x1014c0[_0x27f4('0x14a')]));var _0x23e45e=this[_0x27f4('0x15f')][_0x27f4('0x6b')](this,_0x1014c0[_0x27f4('0x160')]);var _0x566310=this[_0x27f4('0x4c')]['sync'](this,_0x1014c0[_0x27f4('0x14a')],_0x23e45e);if(_0x566310){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x14d'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x1014c0[_0x27f4('0x14a')]));this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0x14d'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x1014c0[_0x27f4('0x14a')]));return{'code':0xc8,'result':_0x27f4('0x14e')};}else{logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x14f'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x1014c0[_0x27f4('0x14a')]));this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')](_0x27f4('0x14d'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0x1014c0[_0x27f4('0x14a')]));return{'code':0xc8,'result':_0x27f4('0x150')};}};AGIVertices['prototype'][_0x27f4('0x161')]=function(_0x24d287){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x162'),_0x24d287[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x24d287[_0x27f4('0x10e')])){return this['channel'][_0x27f4('0x2c')](_0x24d287,_0x27f4('0x10f'));}var _0xa80877=this[_0x27f4('0x1d')][_0x27f4('0x6b')](this,_0x24d287[_0x27f4('0x10e')]);if(!_0xa80877){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x24d287,_0x27f4('0x15a'));}var _0x8060d2=this[_0x27f4('0xc')][_0x27f4('0x52')](_0x27f4('0x163'),[_0xa80877,_0x24d287[_0x27f4('0xe1')]]);if(_0x8060d2[_0x27f4('0x9e')]===-0x1){return _0x8060d2;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')]('Executed\x20command\x20%s\x20%s',_0x27f4('0x163'),_0xa80877));};AGIVertices['prototype'][_0x27f4('0x164')]=function(_0x978eb){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x165'),_0x978eb[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x978eb[_0x27f4('0x166')])){return this['channel'][_0x27f4('0x2c')](_0x978eb,'no\x20queue\x20selected');}var _0x4170cb='';var _0x3df65f=parseInt(_0x978eb[_0x27f4('0x166')],0xa);if(isNaN(_0x3df65f)){_0x4170cb=_0x978eb[_0x27f4('0x166')];}else{_0x4170cb=this[_0x27f4('0x14')]['sync'](this,_0x978eb['queue_id']);if(!_0x4170cb){return this['channel'][_0x27f4('0x2c')](_0x978eb,_0x27f4('0x167'));}}var _0x1944c8='';if(this[_0x27f4('0xa0')](_0x978eb['file_id'])){var _0x4b5e63=this[_0x27f4('0x1d')]['sync'](this,_0x978eb[_0x27f4('0x10e')]);if(_0x4b5e63){_0x1944c8=_0x4b5e63;}}this['createSquareDetailsReport']['sync'](this,_0x978eb,_0x4170cb);if(_0x978eb[_0x27f4('0xe1')]['indexOf']('x')<0x0){_0x978eb['opts']+='x';}if(_0x978eb[_0x27f4('0xe1')][_0x27f4('0x168')]('X')<0x0){_0x978eb[_0x27f4('0xe1')]+='X';}this['channel'][_0x27f4('0x9a')](_0x27f4('0x169'),_0x4170cb?_0x4170cb['toLowerCase']():'');var _0x4418a2=this[_0x27f4('0xc')]['exec'](_0x27f4('0x16a'),[_0x4170cb,_0x978eb[_0x27f4('0xe1')],_0x978eb[_0x27f4('0x60')],_0x1944c8,_0x978eb[_0x27f4('0x63')],_0x978eb[_0x27f4('0x5')],_0x978eb[_0x27f4('0x16b')],_0x978eb[_0x27f4('0x16c')],'',_0x978eb[_0x27f4('0x16d')]]);if(_0x4418a2[_0x27f4('0x9e')]===-0x1){return _0x4418a2;}return this[_0x27f4('0xc')][_0x27f4('0xa6')](util['format'](_0x27f4('0xbd'),_0x27f4('0x16a'),_0x4170cb));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x16e')]=function(_0xc49492){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x16f'),_0xc49492['label']));var _0x397d7d=_0xc49492['recordingFormat']||_0x27f4('0x127');var _0x30700a=util[_0x27f4('0x28')](_0x27f4('0x170'),this[_0x27f4('0xc')][_0x27f4('0x3f')],rs[_0x27f4('0x115')](0x5));var _0x154ab7=util[_0x27f4('0x28')]('%s/recordings/%s.%s',FILES_PATH,_0x30700a,_0x397d7d);var _0x42406d=util[_0x27f4('0x28')](_0x27f4('0x128'),FILES_PATH,_0x30700a);this[_0x27f4('0x171')][_0x27f4('0x6b')](this,_0xc49492,_0x30700a,_0x154ab7);this[_0x27f4('0xc')][_0x27f4('0x9a')](_0x27f4('0x172'),_0x30700a);logger[_0x27f4('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x42406d,_0x397d7d,_0xc49492['escape_digits'],_0xc49492[_0x27f4('0x63')]);return this[_0x27f4('0xc')][_0x27f4('0x12a')](_0x42406d,_0x397d7d,_0xc49492[_0x27f4('0x173')],_0xc49492[_0x27f4('0x63')],undefined,!![]);};AGIVertices[_0x27f4('0xf')][_0x27f4('0x174')]=function(_0x8da05d){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x175'),_0x8da05d['label']));if(!this[_0x27f4('0xa0')](_0x8da05d[_0x27f4('0x60')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x176'));}var _0x5d7f29=this[_0x27f4('0x5f')][_0x27f4('0x6b')](this,_0x8da05d);logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Response:',util[_0x27f4('0x177')](_0x5d7f29,{'showHidden':![],'depth':null})));if(!this[_0x27f4('0xa0')](_0x8da05d[_0x27f4('0xd2')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x178'));}var _0x48390e=this['getVariable'][_0x27f4('0x6b')](this,_0x8da05d[_0x27f4('0xd2')]);if(!_0x48390e){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x8da05d,_0x27f4('0xd3'));}this[_0x27f4('0xc')][_0x27f4('0x9a')](util[_0x27f4('0x28')](_0x27f4('0x179'),_0x48390e),_0x5d7f29['statusCode']?_0x5d7f29[_0x27f4('0x6f')]:_0x27f4('0x17a'));this[_0x27f4('0xc')][_0x27f4('0x9a')](util[_0x27f4('0x28')](_0x27f4('0x17b'),_0x48390e),_0x5d7f29[_0x27f4('0x70')]?_0x5d7f29[_0x27f4('0x70')]:'OK');if(_0x5d7f29[_0x27f4('0x66')]){try{this[_0x27f4('0x98')](_0x5d7f29['body'],_0x48390e);}catch(_0x28d414){logger[_0x27f4('0x2c')](util[_0x27f4('0x28')](_0x27f4('0x17c'),_0x48390e));}}return this['channel']['noop'](util[_0x27f4('0x28')](_0x27f4('0xd8'),_0x48390e));};AGIVertices['prototype'][_0x27f4('0x17d')]=function(_0x572cae){logger['info'](util['format'](_0x27f4('0x17e'),_0x572cae[_0x27f4('0xa5')]));return this[_0x27f4('0xc')][_0x27f4('0x17f')](_0x572cae[_0x27f4('0x180')][_0x27f4('0x54')](/\s+/g,''),_0x572cae[_0x27f4('0x173')]);};AGIVertices[_0x27f4('0xf')][_0x27f4('0x181')]=function(_0x4693cf){logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x182'),_0x4693cf[_0x27f4('0xa5')]));return this[_0x27f4('0xc')]['sayNumber'](_0x4693cf[_0x27f4('0x62')][_0x27f4('0x54')](/\s+/g,''),_0x4693cf[_0x27f4('0x173')]);};AGIVertices['prototype']['sayphonetic']=function(_0x1fe5ea){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1fe5ea[_0x27f4('0xa5')]));return this[_0x27f4('0xc')][_0x27f4('0x183')](_0x1fe5ea['text'],_0x1fe5ea[_0x27f4('0x173')]);};AGIVertices[_0x27f4('0xf')][_0x27f4('0x184')]=function(_0x45a1e1){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x185'),_0x45a1e1[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x45a1e1[_0x27f4('0x186')])){return this['channel'][_0x27f4('0xa6')](_0x27f4('0x187'));}var _0x395e80=this[_0x27f4('0x20')][_0x27f4('0x6b')](this,_0x45a1e1['account_id']);if(!_0x395e80||!_0x395e80[_0x27f4('0x188')]){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x45a1e1,_0x27f4('0x189'));}var _0x260a47={'from':util['format']('\x22%s\x22\x20<%s>',_0x395e80[_0x27f4('0x16')],_0x395e80[_0x27f4('0x18a')]||_0x395e80[_0x27f4('0x188')][_0x27f4('0x18b')]),'to':_0x45a1e1['to']||'','cc':_0x45a1e1['cc']||'','bcc':_0x45a1e1[_0x27f4('0x18c')]||'','subject':_0x45a1e1[_0x27f4('0x18d')],'html':_0x45a1e1[_0x27f4('0x57')],'text':_0x45a1e1[_0x27f4('0x57')]};if(this['isConfigured'](_0x45a1e1['template_id'])){}logger[_0x27f4('0xda')](_0x27f4('0x18e'),JSON[_0x27f4('0x6e')](_0x260a47));this['createSquareDetailsReport'][_0x27f4('0x6b')](this,_0x45a1e1,_0x45a1e1[_0x27f4('0x186')]);this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x395e80['name']));this[_0x27f4('0x21')][_0x27f4('0x6b')](this,_0x395e80[_0x27f4('0x18f')],_0x260a47);return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x190'));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x191')]=function(_0x28d086){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x192'),_0x28d086[_0x27f4('0xa5')]));return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x193'));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x194')]=function(_0x3092bc){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x195'),_0x3092bc[_0x27f4('0xa5')]));if(!this[_0x27f4('0xa0')](_0x3092bc['sms_account_id'])){return this[_0x27f4('0xc')]['noop'](_0x27f4('0x196'));}var _0x3012d3=this[_0x27f4('0x33')][_0x27f4('0x6b')](this,_0x3092bc[_0x27f4('0x197')]);if(!_0x3012d3){return this[_0x27f4('0xc')]['error'](_0x3092bc,'no\x20sms\x20account\x20found');}var _0x41821a={'body':_0x3092bc['sms_text'],'phone':_0x3092bc['to']||'','SmsAccountId':_0x3012d3['id']};logger[_0x27f4('0xda')](_0x27f4('0x198'),JSON['stringify'](_0x41821a));this[_0x27f4('0x36')]['sync'](this,_0x3092bc,_0x3092bc[_0x27f4('0x197')]);this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x199'),_0x3012d3[_0x27f4('0x16')]));this[_0x27f4('0x35')][_0x27f4('0x6b')](this,_0x41821a);return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0x19a'));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x19b')]=function(_0x44862b){logger['info'](util[_0x27f4('0x28')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x44862b[_0x27f4('0xa5')]));if(!this['isConfigured'](_0x44862b[_0x27f4('0xd2')])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x44862b,'no\x20variable\x20selected');}var _0x5b02cb=this[_0x27f4('0x10')][_0x27f4('0x6b')](this,_0x44862b[_0x27f4('0xd2')]);if(!_0x5b02cb){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x44862b,'no\x20variable\x20found');}return this[_0x27f4('0xc')][_0x27f4('0x9a')](_0x5b02cb,_0x44862b[_0x27f4('0x19c')]);};AGIVertices[_0x27f4('0xf')]['start']=function(_0x47c4a1){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x19d'),_0x47c4a1[_0x27f4('0xa5')]));this[_0x27f4('0xc')]['noop'](_0x27f4('0x19e'));var _0x4e6be8=this[_0x27f4('0xc')][_0x27f4('0x10')](_0x27f4('0x19f'));if(!_['isEmpty'](_0x4e6be8[_0x27f4('0x9d')])){this['channel'][_0x27f4('0x3f')]=_0x4e6be8[_0x27f4('0x9d')];}if(_0x47c4a1['answer']===_0x27f4('0x1a0')){this['channel'][_0x27f4('0xa6')](_0x27f4('0x1a1'));return this[_0x27f4('0xc')]['answer']();}return this[_0x27f4('0xc')]['noop'](_0x27f4('0x1a2'));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x1a3')]=function(_0x57db8c){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x1a4'),_0x57db8c['label']));if(!this[_0x27f4('0xa0')](_0x57db8c[_0x27f4('0x1a5')])){return this['channel'][_0x27f4('0x2c')](_0x57db8c,_0x27f4('0x1a6'));}var _0x19fa07=this[_0x27f4('0x1a7')][_0x27f4('0x6b')](this,_0x57db8c[_0x27f4('0x1a5')]);if(!this[_0x27f4('0xa0')](_0x19fa07)){return this[_0x27f4('0xc')]['error'](_0x57db8c,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x57db8c[_0x27f4('0x1a5')]));}if(_0x19fa07===this[_0x27f4('0xc')][_0x27f4('0x37')]){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x57db8c,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x27f4('0x6b')](this,_0x57db8c,_0x19fa07);var _0x13a7ef=this[_0x27f4('0xc')][_0x27f4('0x52')](_0x27f4('0x1a8'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x27f4('0x5')][_0x27f4('0x1a9')]||_0x27f4('0x1aa'),_0x19fa07,this[_0x27f4('0xc')][_0x27f4('0x37')]));if(_0x13a7ef[_0x27f4('0x9e')]===-0x1){return _0x13a7ef;}return this['channel'][_0x27f4('0xa6')](util['format'](_0x27f4('0xbd'),'AGI',_0x19fa07));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x1ab')]=function(_0x2997d1){logger['info'](util[_0x27f4('0x28')](_0x27f4('0x1ac'),_0x2997d1[_0x27f4('0xa5')]));var _0x4b1f62=this['shellCommand']['sync'](this,_0x2997d1[_0x27f4('0x1ad')]);this['createSquareDetailsReport'][_0x27f4('0x6b')](this,_0x2997d1,_0x2997d1['command']);if(this[_0x27f4('0xa0')](_0x2997d1[_0x27f4('0xd2')])){var _0x3c8f5f=this['getVariable']['sync'](this,_0x2997d1[_0x27f4('0xd2')]);if(_0x3c8f5f){this[_0x27f4('0xc')][_0x27f4('0x9a')](_0x3c8f5f,_0x4b1f62);return this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x1ae'),_0x2997d1[_0x27f4('0x1ad')],_0x3c8f5f));}}return this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x1af'),_0x2997d1[_0x27f4('0x1ad')]));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x1b0')]=function(_0x5a5f0d){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x1b1'),_0x5a5f0d[_0x27f4('0xa5')]));_0x5a5f0d[_0x27f4('0x57')]=_0x5a5f0d[_0x27f4('0x57')][_0x27f4('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x27f4('0xa0')](_0x5a5f0d[_0x27f4('0x1b2')])){return this[_0x27f4('0xc')]['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x5a5f0d['text'])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x1b3'),_0x5a5f0d['text']));var _0x419009=this[_0x27f4('0x55')][_0x27f4('0x6b')](this,_0x5a5f0d);if(_0x419009){this[_0x27f4('0xc')]['noop'](util[_0x27f4('0x28')](_0x27f4('0x1b4'),_0x419009));var _0x210d34=this['channel'][_0x27f4('0x100')](_0x419009);try{fs[_0x27f4('0x101')](_0x419009+_0x27f4('0x102'));}catch(_0x403620){logger['error'](_0x403620);}return _0x210d34;}return this[_0x27f4('0xc')]['error'](_0x5a5f0d,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x27f4('0x1b5')]=function(_0x1a2f67){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x1b6'),_0x1a2f67[_0x27f4('0xa5')]));_0x1a2f67[_0x27f4('0x57')]=_0x1a2f67['text'][_0x27f4('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1a2f67[_0x27f4('0x57')])){return this[_0x27f4('0xc')][_0x27f4('0xa6')](_0x27f4('0xa7'));}this['channel'][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x1b7'),_0x1a2f67[_0x27f4('0x57')]));var _0x4d5d4f=this[_0x27f4('0x5d')]['sync'](this,_0x1a2f67);if(_0x4d5d4f){this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x1b8'),_0x4d5d4f));var _0x57f132=this[_0x27f4('0xc')][_0x27f4('0x100')](_0x4d5d4f);try{fs[_0x27f4('0x101')](_0x4d5d4f+_0x27f4('0x102'));}catch(_0x372e8c){logger[_0x27f4('0x2c')](_0x372e8c);}return _0x57f132;}return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x1a2f67,_0x27f4('0x1b9'));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x1ba')]=function(_0xa9c463){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x1bb'),_0xa9c463['label']));if(!this[_0x27f4('0xa0')](_0xa9c463[_0x27f4('0x14a')])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0xa9c463,_0x27f4('0x14b'));}logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x14c'),this['channel'][_0x27f4('0x38')],_0xa9c463[_0x27f4('0x14a')]));var _0xb08eee=this['agentUnpause']['sync'](this,_0xa9c463['findBy']);if(_0xb08eee){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x14d'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0xa9c463['findBy']));this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x27f4('0xc')][_0x27f4('0x38')],_0xa9c463[_0x27f4('0x14a')]));return{'code':0xc8,'result':_0x27f4('0x14e')};}else{logger[_0x27f4('0x2f')](util['format'](_0x27f4('0x14f'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0xa9c463[_0x27f4('0x14a')]));this[_0x27f4('0xc')][_0x27f4('0xa6')](util[_0x27f4('0x28')](_0x27f4('0x14f'),this[_0x27f4('0xc')][_0x27f4('0x38')],_0xa9c463[_0x27f4('0x14a')]));return{'code':0xc8,'result':_0x27f4('0x150')};}};AGIVertices[_0x27f4('0xf')][_0x27f4('0x1bc')]=function(_0x1c8590){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1c8590[_0x27f4('0xa5')]));var _0x519527=this[_0x27f4('0xc')]['exec'](_0x27f4('0x1bd'),[_0x1c8590[_0x27f4('0x1be')],_0x1c8590['options']]);if(_0x519527['result']===-0x1){return _0x519527;}return this['channel']['noop'](util[_0x27f4('0x28')](_0x27f4('0xbd'),'VOICEMAIL',_0x1c8590[_0x27f4('0x1be')]));};AGIVertices[_0x27f4('0xf')][_0x27f4('0x1bf')]=function(_0x4c4d21){logger[_0x27f4('0x2f')](util[_0x27f4('0x28')](_0x27f4('0x1c0'),_0x4c4d21['label']));if(!this[_0x27f4('0xa0')](_0x4c4d21[_0x27f4('0xd2')])){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x4c4d21,_0x27f4('0x1c1'));}var _0x2bb078=this[_0x27f4('0x10')][_0x27f4('0x6b')](this,_0x4c4d21[_0x27f4('0xd2')]);if(!_0x2bb078){return this[_0x27f4('0xc')][_0x27f4('0x2c')](_0x4c4d21,_0x27f4('0xd3'));}var _0x1c41c5=this[_0x27f4('0xc')][_0x27f4('0x10')](_0x2bb078);return{'code':0xc8,'result':_0x1c41c5[_0x27f4('0x9d')]?_0x1c41c5[_0x27f4('0x9d')]:'-'};};String[_0x27f4('0xf')][_0x27f4('0x9c')]=function(_0x2bf97f,_0x14dcd0){return this[_0x27f4('0x9b')](_0x2bf97f)[_0x27f4('0x1c2')](_0x14dcd0);};module[_0x27f4('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 4fa4115..d27586e 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d67=['ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','uniqueid','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','updateAcw','lastPauseAt','timer','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','interface','queue'];(function(_0x39ef2a,_0x5b17ab){var _0x2fe3b2=function(_0x3625ff){while(--_0x3625ff){_0x39ef2a['push'](_0x39ef2a['shift']());}};_0x2fe3b2(++_0x5b17ab);}(_0x1d67,0x1e9));var _0x71d6=function(_0x9df49e,_0x5d3596){_0x9df49e=_0x9df49e-0x0;var _0x5a59e8=_0x1d67[_0x9df49e];return _0x5a59e8;};'use strict';var _=require('lodash');var moment=require(_0x71d6('0x0'));var ami=require('../ami');var logger=require(_0x71d6('0x1'))(_0x71d6('0x2'));var RpcUser=require(_0x71d6('0x3'));var RpcVoiceAgentReport=require(_0x71d6('0x4'));function Acw(_0x4a7779){this[_0x71d6('0x5')]=_0x4a7779[_0x71d6('0x5')];this[_0x71d6('0x6')]=_0x4a7779[_0x71d6('0x6')];this[_0x71d6('0x7')]=_0x4a7779[_0x71d6('0x7')];this[_0x71d6('0x8')]={};ami['on']('agentconnect',this[_0x71d6('0x9')][_0x71d6('0xa')](this));ami['on'](_0x71d6('0xb'),this[_0x71d6('0xc')][_0x71d6('0xa')](this));ami['on'](_0x71d6('0xd'),this[_0x71d6('0xe')]['bind'](this));ami['on'](_0x71d6('0xf'),this[_0x71d6('0x10')][_0x71d6('0xa')](this));ami['on'](_0x71d6('0x11'),this[_0x71d6('0x12')][_0x71d6('0xa')](this));ami['on'](_0x71d6('0x13'),this[_0x71d6('0x14')][_0x71d6('0xa')](this));ami['on'](_0x71d6('0x15'),this[_0x71d6('0x16')]['bind'](this));}function getDiff(_0x471e37){var _0x445fd0=moment()[_0x71d6('0x17')](0x0);var _0x315673=moment(_0x471e37)['milliseconds'](0x0);return _0x445fd0[_0x71d6('0x18')](_0x315673,'seconds');}Acw['prototype'][_0x71d6('0x19')]=function(_0x17c10b,_0x388fad){var _0x374d69=this;var _0x588ecd=getDiff(_0x374d69[_0x71d6('0x7')][_0x17c10b][_0x71d6('0x1a')]);clearTimeout(_0x374d69['timers'][_0x17c10b][_0x71d6('0x1b')]);_0x374d69[_0x71d6('0x7')][_0x17c10b]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x588ecd},_0x374d69[_0x71d6('0x7')][_0x17c10b]['uniqueid'],_0x17c10b)[_0x71d6('0x1c')](function(_0x230844){logger[_0x71d6('0x1d')](_0x71d6('0x1e'),_0x388fad,_0x588ecd,_0x230844);})[_0x71d6('0x1f')](function(_0x4fa679){logger[_0x71d6('0x20')](_0x71d6('0x21'),_0x388fad,_0x4fa679);})[_0x71d6('0x22')](function(){delete _0x374d69[_0x71d6('0x7')][_0x17c10b];});};Acw[_0x71d6('0x23')][_0x71d6('0x24')]=function(_0x26d549){try{var _0x414f9c=this;var _0x57a4fa=this[_0x71d6('0x8')][_0x26d549][_0x71d6('0x25')];var _0x1d7bfa=this[_0x71d6('0x8')][_0x26d549][_0x71d6('0x26')];var _0xde98d0=this[_0x71d6('0x5')][_0x1d7bfa];var _0x358b76=![];var _0x4d727b=_0x71d6('0x27');if(_0xde98d0[_0x71d6('0x28')]&&_0xde98d0[_0x71d6('0x29')][_0x71d6('0x2a')]){_0x358b76=!![];_0x4d727b=_0xde98d0['mandatoryDispositionPause'][_0x71d6('0x2a')];}if(!_0x414f9c[_0x71d6('0x6')][_0x57a4fa]){return Promise[_0x71d6('0x2b')]();}return RpcUser[_0x71d6('0x2c')](_0x414f9c[_0x71d6('0x6')][_0x57a4fa]['id'])[_0x71d6('0x1c')](function(_0x5e2501){if(!_0x5e2501||_0x5e2501[_0x71d6('0x2d')]){logger[_0x71d6('0x1d')](_0x71d6('0x2e'),_0x26d549,_0x57a4fa,_0x1d7bfa);return;}logger[_0x71d6('0x1d')](_0x71d6('0x2f'),_0x26d549,_0x57a4fa,_0x1d7bfa);var _0x35f5a0=_0x414f9c['channels'][_0x26d549][_0x71d6('0x30')]&&_0x414f9c[_0x71d6('0x8')][_0x26d549][_0x71d6('0x31')]?_0x414f9c['channels'][_0x26d549][_0x71d6('0x31')]:_0x26d549;return RpcUser[_0x71d6('0x32')](_0x414f9c[_0x71d6('0x6')][_0x57a4fa],_0x4d727b,_0x35f5a0)[_0x71d6('0x1c')](function(_0x4745d3){_0x414f9c[_0x71d6('0x5')][_0x1d7bfa][_0x71d6('0x33')]-=0x1;_0x414f9c['voiceQueues'][_0x1d7bfa][_0x71d6('0x34')]+=0x1;return _0x4745d3;});})[_0x71d6('0x1c')](function(_0x328323){if(_0x358b76||!_0x328323){return;}_0x414f9c['timers'][_0x57a4fa]={};logger[_0x71d6('0x1d')](_0x71d6('0x35'),_0x26d549,_0x414f9c['voiceQueues'][_0x1d7bfa][_0x71d6('0x36')],_0x57a4fa,_0x1d7bfa);_0x414f9c['timers'][_0x57a4fa][_0x71d6('0x1b')]=setTimeout(_0x414f9c[_0x71d6('0x37')][_0x71d6('0xa')](_0x414f9c,_0x57a4fa),_0x414f9c[_0x71d6('0x5')][_0x1d7bfa][_0x71d6('0x36')]*0x3e8);_0x414f9c[_0x71d6('0x7')][_0x57a4fa]['lastPauseAt']=moment()[_0x71d6('0x38')]('YYYY-MM-DD\x20HH:mm:ss');_0x414f9c[_0x71d6('0x7')][_0x57a4fa]['uniqueid']=_0x26d549;_0x414f9c['timers'][_0x57a4fa][_0x71d6('0x26')]=_0x1d7bfa;_0x414f9c[_0x71d6('0x7')][_0x57a4fa]['updateAcw']=_0x414f9c[_0x71d6('0x19')]['bind'](_0x414f9c,_0x57a4fa,_0x26d549);})[_0x71d6('0x1f')](function(){logger[_0x71d6('0x20')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x26d549,_0x414f9c[_0x71d6('0x5')][_0x1d7bfa]['acwTimeout'],_0x57a4fa,_0x1d7bfa);})[_0x71d6('0x22')](function(){delete _0x414f9c[_0x71d6('0x8')][_0x26d549];});}catch(_0x2ebf65){logger['error'](_0x71d6('0x39'),_0x2ebf65[_0x71d6('0x3a')]);}};Acw[_0x71d6('0x23')][_0x71d6('0x37')]=function(_0x3e8b5c){try{var _0x4cb825=this;if(_0x4cb825[_0x71d6('0x7')][_0x3e8b5c]){_0x4cb825['timers'][_0x3e8b5c]['timer']=![];var _0x38035e=_0x4cb825[_0x71d6('0x7')][_0x3e8b5c]['uniqueid'];var _0x59b004=_0x4cb825[_0x71d6('0x7')][_0x3e8b5c]['queue'];var _0x51e275=_0x4cb825[_0x71d6('0x5')][_0x59b004][_0x71d6('0x36')];logger[_0x71d6('0x1d')](_0x71d6('0x3b'),_0x38035e,_0x3e8b5c);RpcUser[_0x71d6('0x2c')](this[_0x71d6('0x6')][_0x3e8b5c]['id'])[_0x71d6('0x1c')](function(_0xeb3597){if(_0xeb3597[_0x71d6('0x3c')]==='ACW'){return RpcUser['saveUnpause'](_0x4cb825[_0x71d6('0x6')][_0x3e8b5c]);}});RpcVoiceAgentReport[_0x71d6('0x3d')]({'acwtime':_0x51e275,'agentacw':!![]},_0x38035e,_0x3e8b5c)['then'](function(_0x11db84){logger[_0x71d6('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x38035e,_0x51e275,_0x11db84);})[_0x71d6('0x1f')](function(_0x3d340d){logger['error'](_0x71d6('0x21'),_0x38035e,_0x3d340d);});}else{logger[_0x71d6('0x20')](_0x71d6('0x3e'),_0x3e8b5c);if(_0x4cb825[_0x71d6('0x7')]){logger[_0x71d6('0x1d')](_0x71d6('0x3f'),JSON[_0x71d6('0x40')](_0x4cb825[_0x71d6('0x7')]));}}}catch(_0x7052c3){logger[_0x71d6('0x20')]('[ACW][STOP]\x20%s',_0x7052c3[_0x71d6('0x3a')]);}};Acw[_0x71d6('0x23')][_0x71d6('0x9')]=function(_0x24627a){try{if(this[_0x71d6('0x5')][_0x24627a[_0x71d6('0x26')]]&&(this['voiceQueues'][_0x24627a[_0x71d6('0x26')]][_0x71d6('0x2')]||this[_0x71d6('0x5')][_0x24627a[_0x71d6('0x26')]]['mandatoryDisposition'])){if(this[_0x71d6('0x6')][_0x24627a['interface']]){this['channels'][_0x24627a['uniqueid']]={'queue':_0x24627a[_0x71d6('0x26')],'interface':_0x24627a['interface'],'destlinkedid':_0x24627a[_0x71d6('0x31')]};}}}catch(_0x4ebc6f){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x4ebc6f['message']);}};Acw[_0x71d6('0x23')][_0x71d6('0x16')]=function(_0x5112a8){try{if(this[_0x71d6('0x5')][_0x5112a8['queue']]&&(this[_0x71d6('0x5')][_0x5112a8[_0x71d6('0x26')]][_0x71d6('0x2')]||this[_0x71d6('0x5')][_0x5112a8[_0x71d6('0x26')]]['mandatoryDisposition'])){if(this['agents'][_0x5112a8[_0x71d6('0x25')]]){this['channels'][_0x5112a8['uniqueid']]={'queue':_0x5112a8[_0x71d6('0x26')],'interface':_0x5112a8['interface']};}}}catch(_0x221667){logger[_0x71d6('0x20')](_0x71d6('0x41'),_0x221667[_0x71d6('0x3a')]);}};Acw[_0x71d6('0x23')][_0x71d6('0xc')]=function(_0x42d04f){try{if(this[_0x71d6('0x8')][_0x42d04f[_0x71d6('0x42')]]&&_[_0x71d6('0x43')](this[_0x71d6('0x8')][_0x42d04f[_0x71d6('0x42')]][_0x71d6('0x30')])){logger[_0x71d6('0x1d')](_0x71d6('0x44'),_0x42d04f[_0x71d6('0x42')]);this[_0x71d6('0x24')](_0x42d04f[_0x71d6('0x42')]);}else if(this[_0x71d6('0x8')][_0x42d04f['linkedid']]&&_[_0x71d6('0x43')](this[_0x71d6('0x8')][_0x42d04f[_0x71d6('0x45')]]['attended'])){logger['info'](_0x71d6('0x46'),_0x42d04f[_0x71d6('0x45')]);this[_0x71d6('0x24')](_0x42d04f[_0x71d6('0x45')]);}}catch(_0x4ed698){logger['error'](_0x71d6('0x47'),_0x4ed698['message']);}};Acw[_0x71d6('0x23')][_0x71d6('0xe')]=function(_0x48dda4){try{if(this[_0x71d6('0x8')][_0x48dda4['uniqueid']]&&this[_0x71d6('0x8')][_0x48dda4[_0x71d6('0x42')]][_0x71d6('0x30')]){logger[_0x71d6('0x1d')](_0x71d6('0x48'),_0x48dda4['uniqueid']);this[_0x71d6('0x24')](_0x48dda4[_0x71d6('0x42')]);}else if(this['channels'][_0x48dda4[_0x71d6('0x45')]]&&this[_0x71d6('0x8')][_0x48dda4[_0x71d6('0x45')]][_0x71d6('0x30')]){logger[_0x71d6('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x48dda4['linkedid']);this[_0x71d6('0x24')](_0x48dda4[_0x71d6('0x45')]);}}catch(_0x49da3e){logger[_0x71d6('0x20')]('[ACW][syncHangup]\x20%s',_0x49da3e[_0x71d6('0x3a')]);}};Acw[_0x71d6('0x23')][_0x71d6('0x12')]=function(_0x18e9b4){try{if(!_['isNil'](this[_0x71d6('0x8')][_0x18e9b4[_0x71d6('0x49')]])){this['startAcw'](_0x18e9b4[_0x71d6('0x49')]);if(this[_0x71d6('0x8')][_0x18e9b4[_0x71d6('0x4a')]]){this[_0x71d6('0x8')][_0x18e9b4[_0x71d6('0x4a')]]['attended']=!![];this[_0x71d6('0x8')][_0x18e9b4[_0x71d6('0x4b')]]=this[_0x71d6('0x8')][_0x18e9b4['secondtransfereruniqueid']];delete this[_0x71d6('0x8')][_0x18e9b4['secondtransfereruniqueid']];}}else if(!_[_0x71d6('0x4c')](this['channels'][_0x18e9b4[_0x71d6('0x4b')]])){this[_0x71d6('0x24')](_0x18e9b4[_0x71d6('0x4b')]);if(this[_0x71d6('0x8')][_0x18e9b4['origtransfereruniqueid']]){this[_0x71d6('0x8')][_0x18e9b4[_0x71d6('0x4d')]][_0x71d6('0x30')]=!![];this[_0x71d6('0x8')][_0x18e9b4['transfereeuniqueid']]=this[_0x71d6('0x8')][_0x18e9b4[_0x71d6('0x4d')]];delete this[_0x71d6('0x8')][_0x18e9b4['origtransfereruniqueid']];}}}catch(_0x428e2f){logger[_0x71d6('0x20')](_0x71d6('0x4e'),_0x428e2f[_0x71d6('0x3a')]);}};Acw[_0x71d6('0x23')][_0x71d6('0x14')]=function(_0x199557){try{if(this[_0x71d6('0x8')][_0x199557['transfereruniqueid']]){logger['info'](_0x71d6('0x4f'),JSON[_0x71d6('0x40')](_0x199557[_0x71d6('0x50')]));this[_0x71d6('0x24')](_0x199557[_0x71d6('0x50')]);}else if(this[_0x71d6('0x8')][_0x199557['transfererlinkedid']]){logger[_0x71d6('0x1d')](_0x71d6('0x51'),JSON[_0x71d6('0x40')](_0x199557[_0x71d6('0x52')]));this['startAcw'](_0x199557['transfererlinkedid']);}}catch(_0x52e4c3){logger[_0x71d6('0x20')](_0x71d6('0x53'),_0x52e4c3[_0x71d6('0x3a')]);}};Acw[_0x71d6('0x23')][_0x71d6('0x10')]=function(_0x1d6b57){try{if(this['voiceQueues'][_0x1d6b57[_0x71d6('0x26')]]&&this[_0x71d6('0x5')][_0x1d6b57[_0x71d6('0x26')]][_0x71d6('0x54')]==='all'){if(this[_0x71d6('0x6')][_0x1d6b57[_0x71d6('0x25')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1d6b57[_0x71d6('0x42')],_0x1d6b57[_0x71d6('0x25')],_0x1d6b57[_0x71d6('0x26')]);return RpcUser['savePause'](this[_0x71d6('0x6')][_0x1d6b57[_0x71d6('0x25')]],_0x71d6('0x55'),_0x1d6b57[_0x71d6('0x42')]);}}}catch(_0x10e038){logger['error'](_0x71d6('0x56'),_0x10e038[_0x71d6('0x3a')]);}};module[_0x71d6('0x57')]=Acw; \ No newline at end of file +var _0x5d09=['agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','available','paused','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hangup','syncHangup'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5d09,0x1a3));var _0x95d0=function(_0x5d2a31,_0x4920fb){_0x5d2a31=_0x5d2a31-0x0;var _0x577a7e=_0x5d09[_0x5d2a31];return _0x577a7e;};'use strict';var _=require('lodash');var moment=require(_0x95d0('0x0'));var ami=require(_0x95d0('0x1'));var logger=require(_0x95d0('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x95d0('0x3'));function Acw(_0x562101){this[_0x95d0('0x4')]=_0x562101['voiceQueues'];this['agents']=_0x562101[_0x95d0('0x5')];this[_0x95d0('0x6')]=_0x562101[_0x95d0('0x6')];this['channels']={};ami['on']('agentconnect',this[_0x95d0('0x7')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x95d0('0x8')](this));ami['on'](_0x95d0('0x9'),this[_0x95d0('0xa')]['bind'](this));ami['on'](_0x95d0('0xb'),this['syncAgentRingNoAnswer'][_0x95d0('0x8')](this));ami['on'](_0x95d0('0xc'),this['syncAttendedTransfer'][_0x95d0('0x8')](this));ami['on'](_0x95d0('0xd'),this[_0x95d0('0xe')][_0x95d0('0x8')](this));ami['on'](_0x95d0('0xf'),this[_0x95d0('0x10')][_0x95d0('0x8')](this));}function getDiff(_0x58b287){var _0x156f31=moment()['milliseconds'](0x0);var _0x4f8836=moment(_0x58b287)['milliseconds'](0x0);return _0x156f31[_0x95d0('0x11')](_0x4f8836,_0x95d0('0x12'));}Acw[_0x95d0('0x13')]['updateAcw']=function(_0x213a8b,_0x49e5c8){var _0x404361=this;var _0x46d5db=getDiff(_0x404361['timers'][_0x213a8b][_0x95d0('0x14')]);clearTimeout(_0x404361[_0x95d0('0x6')][_0x213a8b][_0x95d0('0x15')]);_0x404361[_0x95d0('0x6')][_0x213a8b]['timer']=![];return RpcVoiceAgentReport[_0x95d0('0x16')]({'acwtime':_0x46d5db},_0x404361[_0x95d0('0x6')][_0x213a8b][_0x95d0('0x17')],_0x213a8b)[_0x95d0('0x18')](function(_0x49fcc6){logger['info'](_0x95d0('0x19'),_0x49e5c8,_0x46d5db,_0x49fcc6);})[_0x95d0('0x1a')](function(_0x240061){logger['error'](_0x95d0('0x1b'),_0x49e5c8,_0x240061);})['finally'](function(){delete _0x404361[_0x95d0('0x6')][_0x213a8b];});};Acw[_0x95d0('0x13')][_0x95d0('0x1c')]=function(_0x11c2aa){try{var _0x167415=this;var _0x2a1e45=this[_0x95d0('0x1d')][_0x11c2aa][_0x95d0('0x1e')];var _0x50865e=this[_0x95d0('0x1d')][_0x11c2aa][_0x95d0('0x1f')];var _0xaedb85=this[_0x95d0('0x4')][_0x50865e];var _0xea8e37=![];var _0x3a97c1=_0x95d0('0x20');if(_0xaedb85[_0x95d0('0x21')]&&_0xaedb85[_0x95d0('0x22')]['name']){_0xea8e37=!![];_0x3a97c1=_0xaedb85['mandatoryDispositionPause'][_0x95d0('0x23')];}if(!_0x167415[_0x95d0('0x5')][_0x2a1e45]){return Promise[_0x95d0('0x24')]();}return RpcUser[_0x95d0('0x25')](_0x167415[_0x95d0('0x5')][_0x2a1e45]['id'])[_0x95d0('0x18')](function(_0x254556){if(!_0x254556||_0x254556[_0x95d0('0x26')]){logger[_0x95d0('0x27')](_0x95d0('0x28'),_0x11c2aa,_0x2a1e45,_0x50865e);return;}logger[_0x95d0('0x27')](_0x95d0('0x29'),_0x11c2aa,_0x2a1e45,_0x50865e);var _0x5b74ad=_0x167415[_0x95d0('0x1d')][_0x11c2aa]['attended']&&_0x167415[_0x95d0('0x1d')][_0x11c2aa][_0x95d0('0x2a')]?_0x167415['channels'][_0x11c2aa][_0x95d0('0x2a')]:_0x11c2aa;return RpcUser['savePause'](_0x167415[_0x95d0('0x5')][_0x2a1e45],_0x3a97c1,_0x5b74ad)[_0x95d0('0x18')](function(_0x50be34){_0x167415[_0x95d0('0x4')][_0x50865e][_0x95d0('0x2b')]-=0x1;_0x167415[_0x95d0('0x4')][_0x50865e][_0x95d0('0x2c')]+=0x1;return _0x50be34;});})[_0x95d0('0x18')](function(_0x38f588){if(_0xea8e37||!_0x38f588){return;}_0x167415[_0x95d0('0x6')][_0x2a1e45]={};logger[_0x95d0('0x27')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x11c2aa,_0x167415[_0x95d0('0x4')][_0x50865e][_0x95d0('0x2d')],_0x2a1e45,_0x50865e);_0x167415[_0x95d0('0x6')][_0x2a1e45]['timer']=setTimeout(_0x167415[_0x95d0('0x2e')][_0x95d0('0x8')](_0x167415,_0x2a1e45),_0x167415[_0x95d0('0x4')][_0x50865e]['acwTimeout']*0x3e8);_0x167415[_0x95d0('0x6')][_0x2a1e45][_0x95d0('0x14')]=moment()[_0x95d0('0x2f')](_0x95d0('0x30'));_0x167415[_0x95d0('0x6')][_0x2a1e45][_0x95d0('0x17')]=_0x11c2aa;_0x167415[_0x95d0('0x6')][_0x2a1e45][_0x95d0('0x1f')]=_0x50865e;_0x167415[_0x95d0('0x6')][_0x2a1e45]['updateAcw']=_0x167415['updateAcw'][_0x95d0('0x8')](_0x167415,_0x2a1e45,_0x11c2aa);})[_0x95d0('0x1a')](function(){logger[_0x95d0('0x31')](_0x95d0('0x32'),_0x11c2aa,_0x167415[_0x95d0('0x4')][_0x50865e][_0x95d0('0x2d')],_0x2a1e45,_0x50865e);})[_0x95d0('0x33')](function(){delete _0x167415[_0x95d0('0x1d')][_0x11c2aa];});}catch(_0x1c2320){logger['error'](_0x95d0('0x34'),_0x1c2320[_0x95d0('0x35')]);}};Acw[_0x95d0('0x13')][_0x95d0('0x2e')]=function(_0x23a8e2){try{var _0x5ac397=this;if(_0x5ac397[_0x95d0('0x6')][_0x23a8e2]){_0x5ac397['timers'][_0x23a8e2][_0x95d0('0x15')]=![];var _0x269f92=_0x5ac397['timers'][_0x23a8e2][_0x95d0('0x17')];var _0x34c514=_0x5ac397[_0x95d0('0x6')][_0x23a8e2]['queue'];var _0x551fb8=_0x5ac397['voiceQueues'][_0x34c514]['acwTimeout'];logger[_0x95d0('0x27')](_0x95d0('0x36'),_0x269f92,_0x23a8e2);RpcUser[_0x95d0('0x25')](this[_0x95d0('0x5')][_0x23a8e2]['id'])[_0x95d0('0x18')](function(_0x200807){if(_0x200807['pauseType']===_0x95d0('0x20')){return RpcUser[_0x95d0('0x37')](_0x5ac397[_0x95d0('0x5')][_0x23a8e2]);}});RpcVoiceAgentReport['update']({'acwtime':_0x551fb8,'agentacw':!![]},_0x269f92,_0x23a8e2)[_0x95d0('0x18')](function(_0x32d792){logger[_0x95d0('0x27')](_0x95d0('0x19'),_0x269f92,_0x551fb8,_0x32d792);})[_0x95d0('0x1a')](function(_0x5060e4){logger['error'](_0x95d0('0x1b'),_0x269f92,_0x5060e4);});}else{logger['error'](_0x95d0('0x38'),_0x23a8e2);if(_0x5ac397[_0x95d0('0x6')]){logger[_0x95d0('0x27')](_0x95d0('0x39'),JSON[_0x95d0('0x3a')](_0x5ac397[_0x95d0('0x6')]));}}}catch(_0x424e21){logger['error'](_0x95d0('0x3b'),_0x424e21[_0x95d0('0x35')]);}};Acw[_0x95d0('0x13')][_0x95d0('0x7')]=function(_0x3fb320){try{if(this[_0x95d0('0x4')][_0x3fb320[_0x95d0('0x1f')]]&&(this[_0x95d0('0x4')][_0x3fb320['queue']][_0x95d0('0x3c')]||this[_0x95d0('0x4')][_0x3fb320[_0x95d0('0x1f')]][_0x95d0('0x21')])){if(this['agents'][_0x3fb320[_0x95d0('0x1e')]]){this[_0x95d0('0x1d')][_0x3fb320[_0x95d0('0x17')]]={'queue':_0x3fb320[_0x95d0('0x1f')],'interface':_0x3fb320[_0x95d0('0x1e')],'destlinkedid':_0x3fb320[_0x95d0('0x2a')]};}}}catch(_0x18de8f){logger[_0x95d0('0x31')](_0x95d0('0x3d'),_0x18de8f[_0x95d0('0x35')]);}};Acw[_0x95d0('0x13')]['syncAgentConnectPreview']=function(_0x307f2d){try{if(this['voiceQueues'][_0x307f2d['queue']]&&(this[_0x95d0('0x4')][_0x307f2d['queue']][_0x95d0('0x3c')]||this['voiceQueues'][_0x307f2d[_0x95d0('0x1f')]][_0x95d0('0x21')])){if(this[_0x95d0('0x5')][_0x307f2d['interface']]){this[_0x95d0('0x1d')][_0x307f2d[_0x95d0('0x17')]]={'queue':_0x307f2d[_0x95d0('0x1f')],'interface':_0x307f2d['interface']};}}}catch(_0x3da5fe){logger[_0x95d0('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x3da5fe[_0x95d0('0x35')]);}};Acw[_0x95d0('0x13')][_0x95d0('0x3e')]=function(_0x53e943){try{if(this[_0x95d0('0x1d')][_0x53e943['uniqueid']]&&_[_0x95d0('0x3f')](this[_0x95d0('0x1d')][_0x53e943[_0x95d0('0x17')]][_0x95d0('0x40')])){logger[_0x95d0('0x27')](_0x95d0('0x41'),_0x53e943['uniqueid']);this[_0x95d0('0x1c')](_0x53e943[_0x95d0('0x17')]);}else if(this[_0x95d0('0x1d')][_0x53e943[_0x95d0('0x42')]]&&_[_0x95d0('0x3f')](this[_0x95d0('0x1d')][_0x53e943[_0x95d0('0x42')]]['attended'])){logger['info'](_0x95d0('0x43'),_0x53e943['linkedid']);this[_0x95d0('0x1c')](_0x53e943['linkedid']);}}catch(_0x47a0c5){logger[_0x95d0('0x31')](_0x95d0('0x44'),_0x47a0c5['message']);}};Acw[_0x95d0('0x13')]['syncHangup']=function(_0x162e8c){try{if(this[_0x95d0('0x1d')][_0x162e8c[_0x95d0('0x17')]]&&this[_0x95d0('0x1d')][_0x162e8c['uniqueid']]['attended']){logger[_0x95d0('0x27')](_0x95d0('0x45'),_0x162e8c[_0x95d0('0x17')]);this[_0x95d0('0x1c')](_0x162e8c[_0x95d0('0x17')]);}else if(this[_0x95d0('0x1d')][_0x162e8c['linkedid']]&&this['channels'][_0x162e8c[_0x95d0('0x42')]][_0x95d0('0x40')]){logger[_0x95d0('0x27')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x162e8c['linkedid']);this[_0x95d0('0x1c')](_0x162e8c[_0x95d0('0x42')]);}}catch(_0x4ca509){logger[_0x95d0('0x31')](_0x95d0('0x46'),_0x4ca509[_0x95d0('0x35')]);}};Acw[_0x95d0('0x13')][_0x95d0('0x47')]=function(_0xbcdc8d){try{if(!_[_0x95d0('0x48')](this[_0x95d0('0x1d')][_0xbcdc8d[_0x95d0('0x49')]])){this[_0x95d0('0x1c')](_0xbcdc8d[_0x95d0('0x49')]);if(this[_0x95d0('0x1d')][_0xbcdc8d[_0x95d0('0x4a')]]){this[_0x95d0('0x1d')][_0xbcdc8d['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0xbcdc8d[_0x95d0('0x4b')]]=this['channels'][_0xbcdc8d['secondtransfereruniqueid']];delete this[_0x95d0('0x1d')][_0xbcdc8d[_0x95d0('0x4a')]];}}else if(!_[_0x95d0('0x48')](this['channels'][_0xbcdc8d[_0x95d0('0x4b')]])){this[_0x95d0('0x1c')](_0xbcdc8d[_0x95d0('0x4b')]);if(this[_0x95d0('0x1d')][_0xbcdc8d[_0x95d0('0x4c')]]){this[_0x95d0('0x1d')][_0xbcdc8d[_0x95d0('0x4c')]][_0x95d0('0x40')]=!![];this[_0x95d0('0x1d')][_0xbcdc8d[_0x95d0('0x49')]]=this['channels'][_0xbcdc8d['origtransfereruniqueid']];delete this['channels'][_0xbcdc8d[_0x95d0('0x4c')]];}}}catch(_0xe9c8af){logger[_0x95d0('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0xe9c8af['message']);}};Acw[_0x95d0('0x13')][_0x95d0('0xe')]=function(_0x4aec5c){try{if(this[_0x95d0('0x1d')][_0x4aec5c[_0x95d0('0x4d')]]){logger[_0x95d0('0x27')](_0x95d0('0x4e'),JSON[_0x95d0('0x3a')](_0x4aec5c['transfereruniqueid']));this[_0x95d0('0x1c')](_0x4aec5c['transfereruniqueid']);}else if(this[_0x95d0('0x1d')][_0x4aec5c[_0x95d0('0x4f')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x95d0('0x3a')](_0x4aec5c['transfererlinkedid']));this[_0x95d0('0x1c')](_0x4aec5c[_0x95d0('0x4f')]);}}catch(_0x113eeb){logger[_0x95d0('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x113eeb[_0x95d0('0x35')]);}};Acw[_0x95d0('0x13')][_0x95d0('0x50')]=function(_0x316461){try{if(this[_0x95d0('0x4')][_0x316461['queue']]&&this[_0x95d0('0x4')][_0x316461[_0x95d0('0x1f')]]['autopause']===_0x95d0('0x51')){if(this['agents'][_0x316461[_0x95d0('0x1e')]]){logger['info'](_0x95d0('0x52'),_0x316461[_0x95d0('0x17')],_0x316461[_0x95d0('0x1e')],_0x316461[_0x95d0('0x1f')]);return RpcUser['savePause'](this['agents'][_0x316461[_0x95d0('0x1e')]],_0x95d0('0x53'),_0x316461[_0x95d0('0x17')]);}}}catch(_0x4322ca){logger[_0x95d0('0x31')](_0x95d0('0x54'),_0x4322ca[_0x95d0('0x35')]);}};module[_0x95d0('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 43bfe1f..ea1308f 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd785=['password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username'];(function(_0x43349b,_0x4a436b){var _0x1f5c25=function(_0x4baf10){while(--_0x4baf10){_0x43349b['push'](_0x43349b['shift']());}};_0x1f5c25(++_0x4a436b);}(_0xd785,0x18f));var _0x5d78=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0xd785[_0x593752];return _0x4612be;};'use strict';var Manager=require(_0x5d78('0x0'));var BPromise=require(_0x5d78('0x1'));var util=require(_0x5d78('0x2'));var logger=require(_0x5d78('0x3'))('ami');var config=require(_0x5d78('0x4'));var ami=new Manager(config[_0x5d78('0x5')][_0x5d78('0x6')],config[_0x5d78('0x5')]['ip'],config['asterisk'][_0x5d78('0x7')],config[_0x5d78('0x5')][_0x5d78('0x8')],!![]);ami[_0x5d78('0x9')]();ami[_0x5d78('0xa')]=BPromise['promisify'](ami[_0x5d78('0xb')]);function error(_0x156107){logger[_0x5d78('0xc')](util[_0x5d78('0xd')](_0x5d78('0xe'),config[_0x5d78('0x5')][_0x5d78('0x7')],config['asterisk']['ip'],config[_0x5d78('0x5')][_0x5d78('0x6')],util[_0x5d78('0xf')](_0x156107,![],null)));}function close(){logger[_0x5d78('0xc')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x5d78('0x7')],config[_0x5d78('0x5')]['ip'],config['asterisk']['port']));}ami[_0x5d78('0x10')]=function(){return function(){return ami[_0x5d78('0xa')]({'action':_0x5d78('0x11')});};};ami[_0x5d78('0x12')]=function(){return function(){return ami[_0x5d78('0xa')]({'action':_0x5d78('0x13')});};};ami[_0x5d78('0x14')]=function(){return function(){return ami[_0x5d78('0xa')]({'action':_0x5d78('0x15')});};};ami[_0x5d78('0x16')]=function(){return function(){return ami[_0x5d78('0xa')]({'action':_0x5d78('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x5d78('0xa')]({'action':_0x5d78('0x18')});};};function connect(){logger[_0x5d78('0x19')](util[_0x5d78('0xd')](_0x5d78('0x1a'),config[_0x5d78('0x5')][_0x5d78('0x7')],config[_0x5d78('0x5')]['ip'],config[_0x5d78('0x5')][_0x5d78('0x6')]));ami[_0x5d78('0x1b')]('error',error);ami[_0x5d78('0x1b')](_0x5d78('0x1c'),close);}ami['on']('connect',connect);ami['on'](_0x5d78('0x1d'),function(_0x3af1e4){logger[_0x5d78('0x19')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5d78('0x5')]['username'],config[_0x5d78('0x5')]['ip'],config[_0x5d78('0x5')][_0x5d78('0x6')],util['inspect'](_0x3af1e4,![],null)));});ami['on'](_0x5d78('0x1e'),function(){logger[_0x5d78('0x19')](util['format'](_0x5d78('0x1f'),config[_0x5d78('0x5')][_0x5d78('0x7')],config[_0x5d78('0x5')]['ip'],config['asterisk'][_0x5d78('0x6')]));return Promise[_0x5d78('0x20')]()[_0x5d78('0x21')](ami[_0x5d78('0x10')]())[_0x5d78('0x21')](ami[_0x5d78('0x12')]())[_0x5d78('0x21')](ami[_0x5d78('0x14')]())[_0x5d78('0x21')](ami[_0x5d78('0x16')]())[_0x5d78('0x21')](ami[_0x5d78('0x22')]())[_0x5d78('0x23')](function(_0x1c5383){logger[_0x5d78('0xc')]('[ami.js][fullybooted]',util['inspect'](_0x1c5383,{'showHidden':![],'depth':null}));});});ami[_0x5d78('0x1b')](_0x5d78('0xc'),error);ami[_0x5d78('0x1b')](_0x5d78('0x1c'),close);module[_0x5d78('0x24')]=ami; \ No newline at end of file +var _0x7c51=['actionSipShowRegistry','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','username','password','promisify','error','format','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x7c51,0x1d3));var _0x17c5=function(_0x17721b,_0x2c960f){_0x17721b=_0x17721b-0x0;var _0x556927=_0x7c51[_0x17721b];return _0x556927;};'use strict';var Manager=require(_0x17c5('0x0'));var BPromise=require(_0x17c5('0x1'));var util=require('util');var logger=require(_0x17c5('0x2'))(_0x17c5('0x3'));var config=require(_0x17c5('0x4'));var ami=new Manager(config[_0x17c5('0x5')]['port'],config[_0x17c5('0x5')]['ip'],config['asterisk'][_0x17c5('0x6')],config[_0x17c5('0x5')][_0x17c5('0x7')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x17c5('0x8')](ami['action']);function error(_0x27b863){logger[_0x17c5('0x9')](util[_0x17c5('0xa')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x17c5('0x5')][_0x17c5('0x6')],config['asterisk']['ip'],config[_0x17c5('0x5')][_0x17c5('0xb')],util[_0x17c5('0xc')](_0x27b863,![],null)));}function close(){logger[_0x17c5('0x9')](util[_0x17c5('0xa')](_0x17c5('0xd'),config[_0x17c5('0x5')][_0x17c5('0x6')],config['asterisk']['ip'],config[_0x17c5('0x5')]['port']));}ami[_0x17c5('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x17c5('0xf')]({'action':_0x17c5('0x10')});};};ami[_0x17c5('0x11')]=function(){return function(){return ami[_0x17c5('0xf')]({'action':_0x17c5('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x17c5('0xf')]({'action':'queuesummary'});};};ami[_0x17c5('0x13')]=function(){return function(){return ami[_0x17c5('0xf')]({'action':_0x17c5('0x14')});};};function connect(){logger[_0x17c5('0x15')](util[_0x17c5('0xa')](_0x17c5('0x16'),config[_0x17c5('0x5')][_0x17c5('0x6')],config['asterisk']['ip'],config[_0x17c5('0x5')][_0x17c5('0xb')]));ami[_0x17c5('0x17')](_0x17c5('0x9'),error);ami[_0x17c5('0x17')](_0x17c5('0x18'),close);}ami['on'](_0x17c5('0x19'),connect);ami['on'](_0x17c5('0x1a'),function(_0x43d08c){logger[_0x17c5('0x15')](util[_0x17c5('0xa')](_0x17c5('0x1b'),config[_0x17c5('0x5')][_0x17c5('0x6')],config[_0x17c5('0x5')]['ip'],config[_0x17c5('0x5')][_0x17c5('0xb')],util[_0x17c5('0xc')](_0x43d08c,![],null)));});ami['on'](_0x17c5('0x1c'),function(){logger[_0x17c5('0x15')](util['format'](_0x17c5('0x1d'),config['asterisk'][_0x17c5('0x6')],config[_0x17c5('0x5')]['ip'],config[_0x17c5('0x5')][_0x17c5('0xb')]));return Promise[_0x17c5('0x1e')]()[_0x17c5('0x1f')](ami[_0x17c5('0xe')]())['then'](ami[_0x17c5('0x20')]())['then'](ami[_0x17c5('0x11')]())[_0x17c5('0x1f')](ami[_0x17c5('0x21')]())['then'](ami[_0x17c5('0x13')]())[_0x17c5('0x22')](function(_0x8ea36f){logger[_0x17c5('0x9')](_0x17c5('0x23'),util[_0x17c5('0xc')](_0x8ea36f,{'showHidden':![],'depth':null}));});});ami[_0x17c5('0x17')](_0x17c5('0x9'),error);ami['once'](_0x17c5('0x18'),close);module[_0x17c5('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index f20e20d..1ad9dc4 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x580f33,_0x4d524d){var _0x4f9e76=function(_0x5222da){while(--_0x5222da){_0x580f33['push'](_0x580f33['shift']());}};_0x4f9e76(++_0x4d524d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0xac4a,0x13f));var _0xaac4=function(_0x498d94,_0x36cba0){_0x498d94=_0x498d94-0x0;var _0x5ac5e8=_0xac4a[_0x498d94];return _0x5ac5e8;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 50a4d31..0f55409 100644 --- a/server/services/ami/dialer/index.js +++ b/server/services/ami/dialer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb49a=['\x20Interval\x20is\x20overtime:\x20','isGlobal','uniqueid','ivr','updateOriginated','answertime','syncAgentComplete','queue','type','agent','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','additional','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','rescheduleContact','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','locked','paused','stateinterface','rrmemory','isNil','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','preview','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','AMD','emit','custom:amd','buildObj','amd','MACHINE','Machine','membername','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','dialGlobalMaxRetry','stateGlobal','reason\x2019\x20machine....','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Normal\x20Clearing','[syncAgentComplete]','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','online','reachable','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalAvailable','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','outbound','debug','inspect','format','name','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','CAMPAIGN_STATUS','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isEmpty','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','status','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','Action','timezones','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime'];(function(_0x43bcf2,_0x423b68){var _0x450ed9=function(_0xe6a759){while(--_0xe6a759){_0x43bcf2['push'](_0x43bcf2['shift']());}};_0x450ed9(++_0x423b68);}(_0xb49a,0x168));var _0xab49=function(_0x5a4ad5,_0x4d83a7){_0x5a4ad5=_0x5a4ad5-0x0;var _0x44ebda=_0xb49a[_0x5a4ad5];return _0x44ebda;};'use strict';var util=require(_0xab49('0x0'));var _=require(_0xab49('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0xab49('0x2'));var utils=require(_0xab49('0x3'));var hopperUtils=require(_0xab49('0x4'));var ut=require(_0xab49('0x5'));var config=require(_0xab49('0x6'));var logger=require(_0xab49('0x7'))(_0xab49('0x8'));var loggerBooked=require(_0xab49('0x7'))(_0xab49('0x9'));var loggerPredictive=require(_0xab49('0x7'))(_0xab49('0xa'));var loggerPredictiveCalls=require(_0xab49('0x7'))(_0xab49('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xab49('0xc'));var ami=require(_0xab49('0xd'));config['redis']=_[_0xab49('0xe')](config[_0xab49('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0xab49('0x10'))(new Redis(config['redis']));var cmHopper=require(_0xab49('0x11'));var voiceQueueRt=require(_0xab49('0x12'));var RpcSetting=require(_0xab49('0x13'));var Interval=require(_0xab49('0x14'));var Action=require(_0xab49('0x15'));var History=require(_0xab49('0x16'));var Final=require('./models/final');var AgentComplete=require(_0xab49('0x17'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xab49('0x18'));var ipAgi=process['env'][_0xab49('0x19')]||_0xab49('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xab49('0x1b')]['enqueue']=function(_0x54acb3){this['tail']=this[_0xab49('0x1c')]?this['tail'][_0xab49('0x1d')](_0x54acb3):_0x54acb3();};function Dialer(_0x11a7aa,_0x927298){this[_0xab49('0x1e')]=new Sequence();this['preview']=_0x927298;this[_0xab49('0x1f')]=_0x11a7aa[_0xab49('0x1f')];this[_0xab49('0x20')]=_0x11a7aa[_0xab49('0x20')];this[_0xab49('0x21')]=_0x11a7aa[_0xab49('0x21')];this[_0xab49('0x22')]=_0x11a7aa['trunks'];this[_0xab49('0x23')]=config[_0xab49('0x23')]||0x2;this[_0xab49('0x24')]={};this[_0xab49('0x25')]={};this[_0xab49('0x26')]={};this[_0xab49('0x27')]={};this[_0xab49('0x28')]={};this[_0xab49('0x29')]={};this['startProgressive']={};this[_0xab49('0x2a')]={};this[_0xab49('0x2b')]={};this[_0xab49('0x2c')]={};this[_0xab49('0x2d')]={};ami['on'](_0xab49('0x2e'),this[_0xab49('0x2f')][_0xab49('0x30')](this));ami['on'](_0xab49('0x31'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xab49('0x32'),this['syncOriginateResponse'][_0xab49('0x30')](this));ami['on'](_0xab49('0x33'),this['syncAgentComplete'][_0xab49('0x30')](this));ami['on'](_0xab49('0x34'),this[_0xab49('0xc')]['bind'](this));ami['on'](_0xab49('0x35'),this[_0xab49('0x36')][_0xab49('0x30')](this));ami['on'](_0xab49('0x37'),this['syncHangup'][_0xab49('0x30')](this));ami['on'](_0xab49('0x38'),this[_0xab49('0x39')][_0xab49('0x30')](this));ami['on'](_0xab49('0x3a'),this[_0xab49('0x3b')][_0xab49('0x30')](this));ami['on'](_0xab49('0x3c'),this[_0xab49('0x3d')][_0xab49('0x30')](this));ami['on'](_0xab49('0x3e'),this[_0xab49('0x3f')][_0xab49('0x30')](this));this['loopCampaigns']();this[_0xab49('0x40')]();RpcSetting[_0xab49('0x41')]()['then'](function(_0x488d81){previewRecallmeReminderInterval=_0x488d81[_0xab49('0x42')];});}function isNotNull(_0x3b6912){return _0x3b6912!==null&&!_[_0xab49('0x43')](_0x3b6912);}function msgResponse(_0x3c3222,_0x2205d6,_0x4fa275){return{'action':_0x3c3222,'response':_0x2205d6,'message':_0x4fa275,'stack':_0x4fa275};}function emit(_0x2eeba4,_0x29a8cc,_0x3da576){io['to'](_0x2eeba4)['emit'](_0x29a8cc,_0x3da576);}function emitOutboundVoiceQueueSummary(_0x17f8f8){if(_0x17f8f8['type']===_0xab49('0x44')){logger[_0xab49('0x45')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xab49('0x46')](_0x17f8f8,{'showHidden':![],'depth':null}));emit(util[_0xab49('0x47')]('voice:queue:%s',_0x17f8f8[_0xab49('0x48')]),'voice_queue:save',_0x17f8f8);}}function checkGetDataPredictive(_0x31a8a7){if(isNotNull(_0x31a8a7)&&!_['isEmpty'](_0x31a8a7)){loggerPredictive['info'](_0xab49('0x49'));loggerPredictive[_0xab49('0x4a')](_0xab49('0x4b'),_0x31a8a7[_0xab49('0x4c')]);loggerPredictive['info'](_0xab49('0x4d'),_0x31a8a7[_0xab49('0x4e')]);loggerPredictive[_0xab49('0x4a')](_0xab49('0x4f'),_0x31a8a7[_0xab49('0x50')]);loggerPredictive[_0xab49('0x4a')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31a8a7[_0xab49('0x51')]);loggerPredictive['info'](_0xab49('0x52'),_0x31a8a7[_0xab49('0x53')]);loggerPredictive[_0xab49('0x4a')](_0xab49('0x54'),_0x31a8a7[_0xab49('0x55')]);loggerPredictive[_0xab49('0x4a')](_0xab49('0x56'));if(_0x31a8a7['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x31a8a7[_0xab49('0x55')])&&_0x31a8a7[_0xab49('0x55')]>0x0){return!![];}loggerPredictive['info'](_0xab49('0x57'));if(!_[_0xab49('0x43')](_0x31a8a7[_0xab49('0x53')])&&_0x31a8a7[_0xab49('0x53')]>0x0){return!![];}loggerPredictive[_0xab49('0x4a')](_0xab49('0x58'));}else{loggerPredictive['info'](_0xab49('0x59'));}}else{loggerPredictive[_0xab49('0x4a')](_0xab49('0x5a'));}return![];}function mergeDataErlangB(_0xd85f73){return function(_0x228dc6){loggerPredictive[_0xab49('0x4a')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xab49('0x4a')](_0xab49('0x5b'),_0x228dc6['erlangCalls']);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x228dc6[_0xab49('0x5c')]);loggerPredictive[_0xab49('0x4a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x228dc6[_0xab49('0x5d')]);loggerPredictive['info'](_0xab49('0x5e'),_0x228dc6[_0xab49('0x5f')]);loggerPredictive[_0xab49('0x4a')](_0xab49('0x60'),_0x228dc6[_0xab49('0x5d')]);loggerPredictive[_0xab49('0x4a')](_0xab49('0x56'));_[_0xab49('0x61')](_0xd85f73,_0x228dc6);};}function ifInterval(_0x2d2588,_0x40f79b){if(_[_0xab49('0x43')](_0x40f79b)){return![];}return utils[_0xab49('0x62')](undefined,_0x40f79b)<_0x2d2588*0x3c;}function clearPredictiveAttributes(_0x285ef3){if(_0x285ef3[_0xab49('0x63')]){_0x285ef3[_0xab49('0x63')]=undefined;loggerPredictive[_0xab49('0x45')](_0x285ef3[_0xab49('0x48')],_0xab49('0x64'));}if(_0x285ef3[_0xab49('0x29')]){_0x285ef3['startPredictive']=undefined;loggerPredictive['debug'](_0x285ef3[_0xab49('0x48')],_0xab49('0x65'));}if(_0x285ef3[_0xab49('0x66')]){clearInterval(_0x285ef3[_0xab49('0x66')]);_0x285ef3[_0xab49('0x66')]=undefined;loggerPredictive[_0xab49('0x45')](_0x285ef3['name'],_0xab49('0x67'));}}function loggerCatchPredictive(_0x49ec33,_0x5ed165){return function(_0x504f43){loggerPredictive['error'](_0x5ed165[_0xab49('0x48')],_0x49ec33);loggerPredictive['error'](_0x504f43['stack']);clearPredictiveAttributes(_0x5ed165);};}function loggerCatch(_0x425881){return function(_0x4a61fb){logger[_0xab49('0x68')](_0x425881,util[_0xab49('0x46')](_0x4a61fb,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1e88e0,_0x1d094f,_0x38d82a){return function(_0x34122c){utils[_0xab49('0x69')](_0x1d094f,_0x38d82a,0x0);_0x1d094f[_0xab49('0x6a')]=0x0;logger[_0xab49('0x68')](_0x1e88e0,util['inspect'](_0x34122c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x12fba5){return function(_0x1bc253){if(isNotNull(_0x1bc253)&&isNotNull(_0x1bc253[0x0])){if(_0x1bc253[0x0][_0xab49('0x6b')]>0x0){_0x12fba5[_0xab49('0x6c')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger[_0xab49('0x4a')](_0xab49('0x6d')+_0x12fba5[_0xab49('0x48')],_0x1bc253[0x0]['contactsRescheduled'],_0xab49('0x6e'));}else{_0x12fba5[_0xab49('0x6c')]=utils['CAMPAIGN_STATUS'][_0xab49('0x6f')];logger[_0xab49('0x4a')]('[getContactDialer2][Empty]'+_0x12fba5[_0xab49('0x48')]);}}};}function createObjHistory(_0x1dd59d,_0x35017b,_0x52c1bd,_0x41c560,_0x5149ec){_0x1dd59d['message']=_0x52c1bd;var _0x3e9cf4=new Action(_0x1dd59d,_0x35017b);var _0x536c40=new History(_0x3e9cf4);_0x536c40[_0xab49('0x70')]=_0x41c560;_0x536c40[_0xab49('0x71')]=_0x5149ec;_0x536c40[_0xab49('0x72')]=_0x3e9cf4[_0xab49('0x73')];return _0x536c40;}function unlockQueueStatus(_0x5dfc61,_0x2ee211){setTimeout(function(){if(_[_0xab49('0x43')](_0x5dfc61[_0xab49('0x74')])){loggerBooked[_0xab49('0x68')](_0xab49('0x75'),_0x2ee211);}_0x5dfc61[_0xab49('0x74')]=!![];loggerBooked[_0xab49('0x4a')](_0xab49('0x76'),_0x2ee211,JSON[_0xab49('0x77')](_[_0xab49('0x78')](_0x5dfc61,[_0xab49('0x48'),_0xab49('0x74')])));},0x1f3);}function checkInterval(_0x35a90d){return function(){if(!isNotNull(_0x35a90d[_0xab49('0x79')])){_0x35a90d[_0xab49('0x6c')]=utils[_0xab49('0x7a')]['NULL_INTERVAL'];throw _0x35a90d[_0xab49('0x48')]+_0xab49('0x7b');}if(!isNotNull(_0x35a90d[_0xab49('0x79')][_0xab49('0x7c')])){_0x35a90d[_0xab49('0x6c')]=utils[_0xab49('0x7a')][_0xab49('0x7d')];throw _0x35a90d['name']+_0xab49('0x7b');}if(!isNotNull(_[_0xab49('0x7e')](_0x35a90d[_0xab49('0x79')][_0xab49('0x7c')]))){_0x35a90d[_0xab49('0x6c')]=utils[_0xab49('0x7a')][_0xab49('0x7d')];throw _0x35a90d[_0xab49('0x48')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x39c4b6){return function(){if(!utils['isIVRCampaignActive'](_0x39c4b6)){_0x39c4b6['message']=utils[_0xab49('0x7a')][_0xab49('0x7f')];throw _0x39c4b6['name']+_0xab49('0x80');}};}function emitCampaignSummary(_0x12d6ad){if(utils[_0xab49('0x81')](_0x12d6ad)){emit(util[_0xab49('0x47')](_0xab49('0x82'),_0x12d6ad[_0xab49('0x48')]),'campaign:save',_0x12d6ad);}}function loggerCatchQueueSummary(_0x602aee,_0x34af97){return function(_0x4a77d7){clearPredictiveAttributes(_0x34af97);emitCampaignSummary(_0x34af97);loggerSyncQueueSummary[_0xab49('0x45')](_0x602aee,util['inspect'](_0x4a77d7,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x262db7){if(_0x262db7[_0xab49('0x83')]){if(_0x262db7[_0xab49('0x84')]===0x0){_0x262db7[_0xab49('0x83')]=![];_0x262db7[_0xab49('0x6c')]=utils[_0xab49('0x7a')][_0xab49('0x7f')];loggerSyncQueueSummary[_0xab49('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x262db7['name'],_0xab49('0x85'));}else{_0x262db7[_0xab49('0x6c')]=utils[_0xab49('0x7a')][_0xab49('0x86')];loggerSyncQueueSummary[_0xab49('0x45')](_0xab49('0x87'),_0x262db7[_0xab49('0x48')],_0xab49('0x88'));}emitCampaignSummary(_0x262db7);}}function myreject(_0x11c047){return function(_0x10608b){return _0x11c047(msgResponse(_0xab49('0x89'),_0xab49('0x8a'),JSON[_0xab49('0x77')](_0x10608b)));};}Dialer[_0xab49('0x1b')][_0xab49('0x8b')]=function(_0x5ac5dd){return!_[_0xab49('0x43')](_0x5ac5dd)&&_0x5ac5dd&&!_[_0xab49('0x43')](_0x5ac5dd[_0xab49('0x48')])&&!_['isUndefined'](_0x5ac5dd[_0xab49('0x8c')])&&_0x5ac5dd[_0xab49('0x8c')]&&(this[_0xab49('0x22')][util[_0xab49('0x47')]('SIP/%s',_0x5ac5dd['name'])][_0xab49('0x8d')]==='reachable'||this[_0xab49('0x22')][util['format'](_0xab49('0x8e'),_0x5ac5dd['name'])][_0xab49('0x8d')]===_0xab49('0x8f'));};Dialer['prototype'][_0xab49('0x90')]=function(_0x1f6e4b){var _0x22af5e=this;return function(){if(!_0x22af5e[_0xab49('0x8b')](_0x1f6e4b[_0xab49('0x91')])){if(!_0x22af5e[_0xab49('0x8b')](_0x1f6e4b[_0xab49('0x92')])){_0x1f6e4b[_0xab49('0x6c')]=utils['CAMPAIGN_STATUS'][_0xab49('0x93')];throw _0x1f6e4b['name']+_0xab49('0x94');}}};};Dialer[_0xab49('0x1b')][_0xab49('0x95')]=function(_0x29dde9,_0x2db47e,_0x535faf,_0x574382){var _0x79ac40=this;return function(){var _0x238fa7=!![];return _0x79ac40[_0xab49('0x96')](_0x29dde9,_0x2db47e,_0x535faf,_0x574382,_0x238fa7);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x32fea1,_0x3c020b,_0x14032a,_0x3f54fd){var _0x17089c=this;return function(){var _0x57f8b5=![];return _0x17089c[_0xab49('0x96')](_0x32fea1[_0xab49('0x7c')],_0x3c020b,_0x14032a,_0x3f54fd,_0x57f8b5);};};Dialer[_0xab49('0x1b')][_0xab49('0x96')]=function(_0x42e2c1,_0x33b37e,_0x26f3b9,_0x44f723,_0x2e858e){var _0x364423=[];return new Promise(function(_0x167ddd,_0x3b10c9){if(!isNotNull(_0x42e2c1)){_0x44f723['message']=utils['CAMPAIGN_STATUS'][_0xab49('0x7d')];return _0x3b10c9(msgResponse(_0xab49('0x97'),'Failure',_0x26f3b9+_0xab49('0x98')));}if(_[_0xab49('0x7e')](_0x42e2c1)){_0x44f723['message']=utils[_0xab49('0x7a')][_0xab49('0x99')];return _0x3b10c9(msgResponse(_0xab49('0x97'),_0xab49('0x9a'),_0x26f3b9+'\x20Intervals\x20is\x20empty\x20'));}if(_0x33b37e&&_[_0xab49('0x43')](config['timezones'][_0x33b37e])){_0x44f723[_0xab49('0x6c')]=utils[_0xab49('0x7a')]['UNKNOWN_TIMEZONE'];return _0x3b10c9(msgResponse(_0xab49('0x97'),_0xab49('0x9a'),_0x26f3b9+_0xab49('0x9b')+_0x33b37e));}if(_[_0xab49('0x9c')](_0x42e2c1)){for(var _0x4b0877=0x0;_0x4b0877<_0x42e2c1[_0xab49('0x9d')];_0x4b0877+=0x1){_0x364423[_0xab49('0x9e')](ami['Action']({'action':_0xab49('0x9f'),'command':util[_0xab49('0x47')](_0xab49('0xa0'),_0x42e2c1[_0x4b0877][_0xab49('0xa1')],!_['isUndefined'](config['timezones'][_0x33b37e])?_0x33b37e:'')})[_0xab49('0xa2')](function(_0x11211d){return _0x11211d[_0xab49('0xa3')][_0xab49('0xa4')](_0xab49('0xa5'))>=0x0;})[_0xab49('0xa6')](myreject(_0x3b10c9)));}}else{_0x364423[_0xab49('0x9e')](ami[_0xab49('0xa7')]({'action':_0xab49('0x9f'),'command':util[_0xab49('0x47')](_0xab49('0xa0'),_0x42e2c1,!_[_0xab49('0x43')](config[_0xab49('0xa8')][_0x33b37e])?_0x33b37e:'')})[_0xab49('0xa2')](function(_0x4fa4d3){return _0x4fa4d3[_0xab49('0xa3')][_0xab49('0xa4')](_0xab49('0xa5'))>=0x0;})[_0xab49('0xa6')](myreject(_0x3b10c9)));}Promise[_0xab49('0xa9')](_0x364423)[_0xab49('0xa2')](function(_0x38feb4){var _0x577c8d=_[_0xab49('0xaa')](_0x38feb4);if(_0x577c8d){return _0x167ddd(_0x577c8d);}else{_0x44f723[_0xab49('0x6c')]=_0x2e858e?utils['CAMPAIGN_STATUS'][_0xab49('0xab')]:utils[_0xab49('0x7a')][_0xab49('0xac')];return _0x3b10c9(msgResponse(_0xab49('0xad'),_0xab49('0x9a'),_0xab49('0xae')+_0x2e858e+'\x20'+_0x26f3b9+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x42e2c1,{'showHidden':![],'depth':null})+_0xab49('0xaf')+_0x33b37e));}})[_0xab49('0xa6')](function(_0x4329bf){return _0x3b10c9(msgResponse(_0xab49('0x97'),_0xab49('0x9a'),JSON[_0xab49('0x77')](_0x4329bf)));});});};Dialer[_0xab49('0x1b')]['loopCampaigns']=function(){var _0x46955c=this;return cmHopper[_0xab49('0xb0')]({'active':![]},{'where':{'active':!![]}})[_0xab49('0xa2')](function(){setInterval(function(){_0x46955c[_0xab49('0xb1')]();},0x3e8);});};Dialer[_0xab49('0x1b')][_0xab49('0xb1')]=function(){var _0x2b923e=this;var _0xd5dfd2;for(var _0x2aa8f1 in this[_0xab49('0x20')]){if(typeof this[_0xab49('0x20')][_0x2aa8f1]!==_0xab49('0xb2')){_0xd5dfd2=this['campaigns'][_0x2aa8f1];if(utils[_0xab49('0x81')](_0xd5dfd2)&&utils[_0xab49('0xb3')](_0xd5dfd2)){_0xd5dfd2[_0xab49('0x83')]=!![];Promise['resolve']()[_0xab49('0xa2')](checkIsIVRCampaignActive(_0xd5dfd2))[_0xab49('0xa2')](checkInterval(_0xd5dfd2))['then'](_0x2b923e[_0xab49('0x90')](_0xd5dfd2))[_0xab49('0xa2')](_0x2b923e[_0xab49('0x95')](_0xd5dfd2[_0xab49('0xb4')],_0xd5dfd2[_0xab49('0xb5')],_0xd5dfd2[_0xab49('0x48')],_0xd5dfd2))[_0xab49('0xa2')](_0x2b923e[_0xab49('0xb6')](_0xd5dfd2[_0xab49('0x79')],_0xd5dfd2[_0xab49('0xb5')],_0xd5dfd2[_0xab49('0x48')],_0xd5dfd2))['then'](_0x2b923e['launchHandleIvr'](_0xd5dfd2))['catch'](loggerCatchQueueSummary(_0xab49('0xb7'),_0xd5dfd2));}else{notSendMessagesCampaign(_0xd5dfd2);}}}};Dialer['prototype'][_0xab49('0xb8')]=function(_0x34d761){if(_0x34d761[_0xab49('0xb9')]!==_0xab49('0xa')){clearPredictiveAttributes(_0x34d761);}switch(_0x34d761[_0xab49('0xb9')]){case _0xab49('0xba'):this[_0xab49('0xbb')](_0x34d761,0x1);break;case _0xab49('0xbc'):this['handlePower'](_0x34d761,_0x34d761[_0xab49('0xbd')]);break;case'predictive':this[_0xab49('0xa')](_0x34d761);break;case _0xab49('0x9'):this[_0xab49('0xbb')](_0x34d761,0x1);break;default:logger['error'](_0xab49('0xbe'),_0x34d761[_0xab49('0x48')],'method\x20not\x20recognized');}};Dialer[_0xab49('0x1b')][_0xab49('0x97')]=function(_0x41783f,_0x9d2bd9){var _0x279604=_0x41783f[_0xab49('0xb5')];var _0x3c2224=_0x9d2bd9?_0x41783f[_0xab49('0xb4')]:_0x41783f[_0xab49('0x79')][_0xab49('0x7c')];logger[_0xab49('0xbf')](_0xab49('0xc0'),_0x3c2224,_0x279604,_0x41783f[_0xab49('0x48')],util[_0xab49('0x47')](_0xab49('0xc1'),_0x41783f[_0xab49('0x48')],_0x41783f['id']));var _0xf5cca8=null;return Interval[_0xab49('0xc2')](_0x3c2224,_0x279604)[_0xab49('0xa2')](function(_0x2cd1c4){if(_0x2cd1c4===!![]){return _0x2cd1c4;}else{_0x41783f[_0xab49('0x6c')]=_0x9d2bd9?utils[_0xab49('0x7a')][_0xab49('0xab')]:utils['CAMPAIGN_STATUS'][_0xab49('0xac')];_0xf5cca8=msgResponse('[ifTime][promiseAll]','Failure',_0xab49('0xae')+_0x9d2bd9+'\x20'+_0x41783f[_0xab49('0x48')]+_0xab49('0xc3')+util['inspect'](_0x3c2224,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x279604);}if(_0xf5cca8!==null){logger[_0xab49('0xbf')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0xf5cca8);_0xf5cca8[_0xab49('0xc4')]=_0x9d2bd9;throw _0xf5cca8;}})[_0xab49('0xa6')](function(_0x1ff04d){logger['error']('AMI\x20IfTime',_0x1ff04d);throw msgResponse(_0xab49('0x89'),_0xab49('0x8a'),util[_0xab49('0x46')](_0x1ff04d,{'showHidden':![],'depth':null}));});};Dialer[_0xab49('0x1b')][_0xab49('0x2f')]=function(_0x3568e6){if(this[_0xab49('0x1f')][_0x3568e6['queue']]){if(this[_0xab49('0x27')][_0x3568e6[_0xab49('0xc5')]]&&this[_0xab49('0x27')][_0x3568e6['uniqueid']]['type']!==_0xab49('0xc6')){this[_0xab49('0xc7')](this[_0xab49('0x1f')][_0x3568e6['queue']]);this[_0xab49('0x27')][_0x3568e6['uniqueid']][_0xab49('0xc8')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xab49('0x1b')][_0xab49('0xc9')]=function(_0x46476b){var _0x9777f5=this['uniqueId'][_0x46476b[_0xab49('0xc5')]];if(this[_0xab49('0x1f')][_0x46476b[_0xab49('0xca')]]){if(_0x9777f5&&_0x9777f5[_0xab49('0xcb')]!==_0xab49('0xc6')){delete this[_0xab49('0x27')][_0x46476b[_0xab49('0xc5')]];this[_0xab49('0x1f')][_0x46476b[_0xab49('0xca')]]['outboundAnswerCallsDay']+=0x1;var _0x8b3fbb=new AgentComplete(_0x9777f5,_0x46476b);if(_0x46476b['reason']===_0xab49('0xcc')){_0x8b3fbb[_0xab49('0xcd')]=this[_0xab49('0x1f')][_0x46476b[_0xab49('0xca')]]['dialQueueProject2']&&this[_0xab49('0x1f')][_0x46476b[_0xab49('0xca')]][_0xab49('0xce')]?moment()[_0xab49('0x47')](_0xab49('0xcf')):undefined;}hopperUtils[_0xab49('0xd0')](_0x8b3fbb)[_0xab49('0xa6')](loggerCatch(_0xab49('0xd1')));hopperUtils[_0xab49('0xd2')](_0x8b3fbb)[_0xab49('0xa6')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xab49('0x1b')][_0xab49('0xd3')]=function(_0x3e55ab){var _0x5f163e=this[_0xab49('0x27')][_0x3e55ab[_0xab49('0xc5')]];var _0x16a471=this;var _0x338e0b=![];var _0x7fd4a2;var _0x55e23a;if(this['voiceQueues'][_0x3e55ab[_0xab49('0xca')]]){if(_0x5f163e&&_0x5f163e[_0xab49('0xcb')]!==_0xab49('0xc6')){delete this[_0xab49('0x27')][_0x3e55ab['uniqueid']];this['updateOriginated'](this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]]);_0x5f163e[_0xab49('0xd4')]=moment()[_0xab49('0x47')](_0xab49('0xcf'));var _0x2ff84c=new QueueCallerAbandon(_0x5f163e,_0x3e55ab);if(utils[_0xab49('0x62')](_0x5f163e[_0xab49('0xd4')],_0x5f163e[_0xab49('0xd5')])>=_0x5f163e[_0xab49('0xd6')]){this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]][_0xab49('0x50')]+=0x1;this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]][_0xab49('0xd7')]+=0x1;this[_0xab49('0x1f')][_0x3e55ab['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2ff84c[_0xab49('0x70')]=0xa;_0x2ff84c[_0xab49('0x71')]=_0xab49('0xd8');_0x2ff84c[_0xab49('0xd9')]=_0xab49('0xda');_0x2ff84c[_0xab49('0xcd')]=this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]][_0xab49('0xdb')]?moment()[_0xab49('0x47')](_0xab49('0xcf')):undefined;_0x2ff84c['countdropretry']+=0x1;_0x2ff84c[_0xab49('0xdc')]+=0x1;_0x7fd4a2=this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]]['dialDropRetryFrequency'];_0x55e23a=this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]][_0xab49('0xdd')];hopperUtils[_0xab49('0xde')](_0x2ff84c,_0x2ff84c[_0xab49('0x70')],_0x5f163e[_0xab49('0xdf')])[_0xab49('0xa2')](function(_0x11c200){_0x338e0b=_0x11c200['additional']==0x1;if(_0x2ff84c[_0xab49('0xe0')]>=_0x16a471[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]][_0xab49('0xe1')]){_0x16a471[_0xab49('0xe2')](_0x2ff84c,_0x11c200[_0xab49('0xe3')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2ff84c[_0xab49('0xe0')],'scheduledat':moment()[_0xab49('0xe4')](_0x16a471[_0xab49('0x1f')][_0x3e55ab['queue']][_0xab49('0xe5')],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x5f163e[_0xab49('0xe7')],'ListId':_0x5f163e[_0xab49('0xe8')],'VoiceQueueId':_0x5f163e[_0xab49('0xe9')]||undefined,'CampaignId':_0x5f163e['CampaignId']||undefined})[_0xab49('0xa6')](loggerCatch('[rescheduleContact][Drop]'));var _0xf14c1e=new History(_0x2ff84c);_0xf14c1e[_0xab49('0x70')]=0xa;_0xf14c1e[_0xab49('0x71')]=_0xab49('0xd8');_0xf14c1e[_0xab49('0x73')]=moment()['format'](_0xab49('0xcf'));_0xf14c1e['endtime']=_0xf14c1e['starttime'];_0xf14c1e[_0xab49('0xea')]=_0x2ff84c[_0xab49('0xea')];_0xf14c1e[_0xab49('0xeb')]=_0x2ff84c[_0xab49('0xeb')];hopperUtils[_0xab49('0xd0')](_0xf14c1e)['catch'](loggerCatch(_0xab49('0xec')));}})['then'](function(){if(_0x338e0b)hopperUtils[_0xab49('0xed')](_0x2ff84c,_0x7fd4a2,_0x55e23a)[_0xab49('0xa2')](function(){return 0x1;});});}else{this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]][_0xab49('0x51')]+=0x1;this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]][_0xab49('0xee')]+=0x1;_0x2ff84c['state']=0xb;_0x2ff84c[_0xab49('0x71')]=_0xab49('0xef');_0x2ff84c['dropreason']=_0xab49('0xf0');_0x2ff84c[_0xab49('0xf1')]+=0x1;_0x2ff84c['countglobal']+=0x1;_0x7fd4a2=this[_0xab49('0x1f')][_0x3e55ab[_0xab49('0xca')]][_0xab49('0xf2')];_0x55e23a=this['voiceQueues'][_0x3e55ab[_0xab49('0xca')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xab49('0xde')](_0x2ff84c,_0x2ff84c[_0xab49('0x70')],_0x5f163e['voiceQueue'])['then'](function(_0x15cdf3){if(_0x2ff84c[_0xab49('0xf1')]>=_0x16a471['voiceQueues'][_0x3e55ab[_0xab49('0xca')]][_0xab49('0xf3')]){_0x16a471[_0xab49('0xe2')](_0x2ff84c,_0x15cdf3[_0xab49('0xe3')]);}else{hopperUtils[_0xab49('0xf4')]({'active':![],'countabandonedretry':_0x2ff84c[_0xab49('0xf1')],'scheduledat':moment()[_0xab49('0xe4')](_0x16a471[_0xab49('0x1f')][_0x3e55ab['queue']]['dialAbandonedRetryFrequency'],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x5f163e[_0xab49('0xe7')],'ListId':_0x5f163e[_0xab49('0xe8')],'VoiceQueueId':_0x5f163e[_0xab49('0xe9')]||undefined,'CampaignId':_0x5f163e[_0xab49('0xf5')]||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0xf6')));var _0x30d27f=new History(_0x2ff84c);_0x30d27f[_0xab49('0x70')]=0xb;_0x30d27f[_0xab49('0x71')]=_0xab49('0xef');_0x30d27f['starttime']=moment()[_0xab49('0x47')](_0xab49('0xcf'));_0x30d27f[_0xab49('0x72')]=_0x30d27f[_0xab49('0x73')];_0x30d27f[_0xab49('0xea')]=_0x2ff84c[_0xab49('0xea')];_0x30d27f['calleridnum']=_0x2ff84c[_0xab49('0xeb')];hopperUtils[_0xab49('0xd0')](_0x30d27f)[_0xab49('0xa6')](loggerCatch(_0xab49('0xf7')));}})[_0xab49('0xa2')](function(){if(_0x338e0b)hopperUtils[_0xab49('0xed')](_0x2ff84c,_0x7fd4a2,_0x55e23a)['then'](function(){return 0x1;});});}}}};Dialer[_0xab49('0x1b')]['syncNewExten']=function(_0x4a4943){if(this['actions'][_0x4a4943[_0xab49('0xc5')]]){this['actions'][_0x4a4943['uniqueid']][_0xab49('0xf8')]=_0x4a4943[_0xab49('0xf8')];}if(this[_0xab49('0x27')][_0x4a4943[_0xab49('0xc5')]]){this[_0xab49('0x27')][_0x4a4943[_0xab49('0xc5')]]['channel']=_0x4a4943[_0xab49('0xf8')];}};Dialer[_0xab49('0x1b')][_0xab49('0x3d')]=function(_0x36e86d){if(!this['actions'][_0x36e86d[_0xab49('0xf9')]]){return;}var _0x3ede74=this['voiceQueues'][this[_0xab49('0x25')][_0x36e86d['actionid']][_0xab49('0xca')]][_0xab49('0xfa')]||'rrmemory';if(_0x3ede74===_0xab49('0xfb')){if(this[_0xab49('0x25')][_0x36e86d[_0xab49('0xf9')]]&&_['isNil'](this[_0xab49('0x25')][_0x36e86d['actionid']][_0xab49('0xfc')])&&_0x36e86d[_0xab49('0x8d')]==='1'&&_0x36e86d[_0xab49('0xfd')]==='0'){if(this['agents'][_0x36e86d[_0xab49('0xfe')]]){if(!this[_0xab49('0x21')][_0x36e86d[_0xab49('0xfe')]][_0xab49('0xfc')]){this[_0xab49('0x21')][_0x36e86d[_0xab49('0xfe')]][_0xab49('0xfc')]=!![];this[_0xab49('0x25')][_0x36e86d['actionid']][_0xab49('0xfc')]=!![];this[_0xab49('0x25')][_0x36e86d[_0xab49('0xf9')]][_0xab49('0xfe')]=_0x36e86d[_0xab49('0xfe')];}}}}else if(_0x3ede74===_0xab49('0xff')){if(this[_0xab49('0x25')][_0x36e86d[_0xab49('0xf9')]]){if(this[_0xab49('0x21')][_0x36e86d[_0xab49('0xfe')]]){this['actions'][_0x36e86d['actionid']][_0xab49('0xfe')]=_0x36e86d[_0xab49('0xfe')];if(_[_0xab49('0x100')](this[_0xab49('0x2b')][this[_0xab49('0x25')][_0x36e86d['actionid']][_0xab49('0xca')]])){this[_0xab49('0x2b')][this[_0xab49('0x25')][_0x36e86d[_0xab49('0xf9')]][_0xab49('0xca')]]=[];}this[_0xab49('0x2b')][this[_0xab49('0x25')][_0x36e86d['actionid']][_0xab49('0xca')]]['push'](_[_0xab49('0x61')](_[_0xab49('0x78')](this['actions'][_0x36e86d[_0xab49('0xf9')]],[_0xab49('0x101'),_0xab49('0xfe')]),{'status':_0x36e86d['status'],'paused':_0x36e86d[_0xab49('0xfd')]}));}}}};Dialer[_0xab49('0x1b')][_0xab49('0x3f')]=function(_0x4b9f8f){if(!this['actions'][_0x4b9f8f[_0xab49('0xf9')]]){return;}var _0x402e16=this;var _0x44f247=this['voiceQueues'][this['actions'][_0x4b9f8f[_0xab49('0xf9')]][_0xab49('0xca')]];var _0x39fecf=_0x44f247[_0xab49('0xfa')]||_0xab49('0xff');if(_0x39fecf===_0xab49('0xfb')){if(this['actions'][_0x4b9f8f['actionid']]&&this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]][_0xab49('0xfe')]){this['preview'][_0xab49('0x102')](this[_0xab49('0x25')][_0x4b9f8f['actionid']][_0xab49('0x101')],this[_0xab49('0x25')][_0x4b9f8f['actionid']][_0xab49('0xfe')])[_0xab49('0xa6')](function(_0x2a808b){logger[_0xab49('0x68')](_0xab49('0x103'),util['inspect'](_0x2a808b,{'showHidden':![],'depth':null}));})['finally'](function(){_0x402e16[_0xab49('0xc7')](_0x402e16[_0xab49('0x1f')][_0x402e16[_0xab49('0x25')][_0x4b9f8f['actionid']][_0xab49('0xca')]]);_0x402e16[_0xab49('0x21')][_0x402e16[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]][_0xab49('0xfe')]][_0xab49('0xfc')]=![];delete _0x402e16[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]];unlockQueueStatus(_0x44f247);});}else{this[_0xab49('0xc7')](this['voiceQueues'][this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]]['queue']]);hopperUtils[_0xab49('0xf4')]({'active':![],'ContactId':this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]][_0xab49('0xe7')],'ListId':this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]]['ListId'],'VoiceQueueId':this['actions'][_0x4b9f8f['actionid']][_0xab49('0xe9')]||undefined,'CampaignId':this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]][_0xab49('0xf5')]||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0x104')));delete this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]];unlockQueueStatus(_0x44f247);}}else if(_0x39fecf===_0xab49('0xff')){var _0x50efe9;if(this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]]&&!_[_0xab49('0x7e')](this['queueBooked'][this[_0xab49('0x25')][_0x4b9f8f['actionid']][_0xab49('0xca')]])){if(this[_0xab49('0x2c')][_0x402e16[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]][_0xab49('0xca')]]){this[_0xab49('0x2c')][_0x402e16[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]][_0xab49('0xca')]]=this[_0xab49('0x2c')][this['actions'][_0x4b9f8f[_0xab49('0xf9')]]['queue']]?this['queueBookedRR'][this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]]['queue']]:this[_0xab49('0x2b')][this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]]['queue']]?this[_0xab49('0x2b')][this[_0xab49('0x25')][_0x4b9f8f[_0xab49('0xf9')]]['queue']]['_rr']||0x0:0x0;}this[_0xab49('0x2b')][this['actions'][_0x4b9f8f[_0xab49('0xf9')]][_0xab49('0xca')]][_0xab49('0x105')]=this['queueBookedRR'][this[_0xab49('0x25')][_0x4b9f8f['actionid']][_0xab49('0xca')]];for(var _0x1ce1d0=0x0;_0x1ce1d0=_0x4d593f['dialGlobalMaxRetry']){_0x4784b1['stateGlobal'](_0x18954c,_0x3b4ddc,_0x489f90,'reason19\x20machine....');}else{if(_0x18954c[_0xab49('0x12d')]>=_0x4d593f[_0xab49('0x12f')]){_0x4784b1[_0xab49('0x130')](_0x18954c,_0x3b4ddc,_0x489f90,'reason\x2019\x20machine....');}else{hopperUtils[_0xab49('0xf4')]({'active':![],'countmachineretry':_0x18954c[_0xab49('0x12d')],'scheduledat':moment()[_0xab49('0xe4')](_0x4d593f[_0xab49('0x131')],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x18954c['ContactId'],'ListId':_0x18954c[_0xab49('0xe8')],'VoiceQueueId':_0x18954c[_0xab49('0xe9')]||undefined,'CampaignId':_0x18954c[_0xab49('0xf5')]||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0x132')));_0x3b4ddc({'reschedule':0x1});}}});}if(_0x326084[_0xab49('0xcb')]==='ivr'&&this[_0xab49('0x20')][_0x326084['queue']]['dialAMDActive']&&_0x2693c4[_0xab49('0x11c')]==='HANGUP'){delete this[_0xab49('0x27')][_0x2693c4[_0xab49('0xc5')]];this['updateOriginated'](this[_0xab49('0x20')][_0x326084['queue']]);_0x1b521d=new Hangup(_0x326084,_0x2693c4);_0x1b521d['state']=0x12;_0x1b521d[_0xab49('0x71')]=_0xab49('0x120');_0x1b521d[_0xab49('0x128')]=_0xab49('0x121');ami[_0xab49('0x122')](_0xab49('0x123'),ut[_0xab49('0x124')](_0x1b521d,_0xab49('0x125')));this['saveInDb'](_0x1b521d,'[syncHangupInAMDIvr][createHistory]',_0xab49('0x133'));}if(_0x326084[_0xab49('0xcb')]===_0xab49('0xc6')&&this['campaigns'][_0x326084[_0xab49('0xca')]][_0xab49('0x11b')]&&_0x2693c4[_0xab49('0x11c')]===_0xab49('0x126')){return new Promise(function(_0x5e66be,_0x203ef7){delete _0x4784b1[_0xab49('0x27')][_0x2693c4[_0xab49('0xc5')]];_0x4784b1[_0xab49('0xc7')](_0x4784b1[_0xab49('0x20')][_0x326084['queue']]);_0x4784b1[_0xab49('0x20')][_0x326084[_0xab49('0xca')]][_0xab49('0x11e')]+=0x1;_0x4784b1['campaigns'][_0x326084['queue']][_0xab49('0x11f')]+=0x1;var _0x17bdb7=_0x4784b1[_0xab49('0x20')][_0x326084[_0xab49('0xca')]];var _0x130e20=new Hangup(_0x326084,_0x2693c4);_0x130e20[_0xab49('0x70')]=0x13;_0x130e20['statedesc']=_0xab49('0x127');_0x130e20['membername']=_0xab49('0x121');_0x130e20['countmachineretry']+=0x1;_0x130e20['countglobal']+=0x1;_0x130e20[_0xab49('0x125')]=!![];ami['emit']('custom:amd',ut[_0xab49('0x124')](_0x130e20,'amd'));hopperUtils[_0xab49('0xd0')](_0x130e20)['catch'](loggerCatch(_0xab49('0x134')));if(_0x130e20['countbusyretry']+_0x130e20[_0xab49('0x12a')]+_0x130e20['countnoanswerretry']+_0x130e20[_0xab49('0x12c')]+_0x130e20[_0xab49('0xe0')]+_0x130e20['countabandonedretry']+_0x130e20[_0xab49('0x12d')]+_0x130e20[_0xab49('0x12e')]>=_0x17bdb7[_0xab49('0x135')]){_0x4784b1[_0xab49('0x136')](_0x130e20,_0x5e66be,_0x203ef7,'reason19\x20machine....');}else{if(_0x130e20[_0xab49('0x12d')]>=_0x17bdb7['dialMachineMaxRetry']){_0x4784b1['createStateFinal'](_0x130e20,_0x5e66be,_0x203ef7,_0xab49('0x137'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x130e20[_0xab49('0x12d')],'scheduledat':moment()[_0xab49('0xe4')](_0x17bdb7[_0xab49('0x131')],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x130e20[_0xab49('0xe7')],'ListId':_0x130e20[_0xab49('0xe8')],'VoiceQueueId':_0x130e20['VoiceQueueId']||undefined,'CampaignId':_0x130e20[_0xab49('0xf5')]||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0x132')));_0x5e66be({'reschedule':0x1});}}});}}};Dialer[_0xab49('0x1b')][_0xab49('0x138')]=function(_0x34619b){var _0x1625f7=this[_0xab49('0x27')][_0x34619b['uniqueid']];var _0x1825da;if(_0x1625f7&&_0x1625f7['type']===_0xab49('0xc6')){delete this[_0xab49('0x27')][_0x34619b['uniqueid']];this[_0xab49('0xc7')](this[_0xab49('0x20')][_0x1625f7['queue']]);this[_0xab49('0x20')][_0x1625f7[_0xab49('0xca')]][_0xab49('0x139')]+=0x1;_0x1825da=new Hangup(_0x1625f7,_0x34619b);hopperUtils[_0xab49('0xd0')](_0x1825da)[_0xab49('0xa6')](loggerCatch(_0xab49('0x13a')));hopperUtils[_0xab49('0xd2')](_0x1825da)[_0xab49('0xa6')](loggerCatch(_0xab49('0x13b')));}if(_0x1625f7&&_0x1625f7[_0xab49('0xcb')]!==_0xab49('0xc6')&&isNotNull(this['voiceQueues'][_0x1625f7['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x34619b[_0xab49('0xc5')]];this['updateOriginated'](this[_0xab49('0x1f')][_0x1625f7[_0xab49('0xca')]]);this[_0xab49('0x1f')][_0x1625f7['queue']][_0xab49('0x11e')]+=0x1;this[_0xab49('0x1f')][_0x1625f7[_0xab49('0xca')]][_0xab49('0x11f')]+=0x1;_0x1825da=new Hangup(_0x1625f7,_0x34619b);_0x1825da[_0xab49('0x70')]=0x10;_0x1825da[_0xab49('0x71')]=_0xab49('0x13c');_0x1825da[_0xab49('0x128')]=_0xab49('0x13d');hopperUtils[_0xab49('0xd0')](_0x1825da)['catch'](loggerCatch(_0xab49('0x13a')));hopperUtils[_0xab49('0xd2')](_0x1825da)[_0xab49('0xa6')](loggerCatch(_0xab49('0x13b')));}if(_0x1625f7&&_0x1625f7[_0xab49('0xcb')]!==_0xab49('0xc6')&&!isNotNull(this[_0xab49('0x1f')][_0x1625f7[_0xab49('0xca')]][_0xab49('0x13e')])){if(_0x34619b[_0xab49('0x13f')]===_0xab49('0x140')){delete this['uniqueId'][_0x34619b[_0xab49('0xc5')]];this[_0xab49('0x1f')][_0x1625f7[_0xab49('0xca')]][_0xab49('0x11e')]+=0x1;const _0x5626ac=new AgentComplete(_0x1625f7,_0x34619b);_0x5626ac['CampaignId']=this[_0xab49('0x1f')][_0x1625f7['queue']]['id'];hopperUtils[_0xab49('0xd0')](_0x5626ac)[_0xab49('0xa6')](loggerCatch(_0xab49('0xd1')));hopperUtils['moveContactManagedDialer'](_0x5626ac)[_0xab49('0xa6')](loggerCatch(_0xab49('0x141')));}else{delete this[_0xab49('0x27')][_0x34619b[_0xab49('0xc5')]];this['updateOriginated'](this[_0xab49('0x1f')][_0x1625f7['queue']]);this[_0xab49('0x1f')][_0x1625f7['queue']][_0xab49('0x142')]+=0x1;_0x1825da=new Hangup(_0x1625f7,_0x34619b);_0x1825da[_0xab49('0x70')]=0xc;_0x1825da['statedesc']=_0x34619b[_0xab49('0x13f')];_0x1825da['membername']=_0xab49('0x143');hopperUtils[_0xab49('0xd0')](_0x1825da)[_0xab49('0xa6')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x1825da)[_0xab49('0xa6')](loggerCatch(_0xab49('0x13b')));}}};Dialer['prototype'][_0xab49('0xc')]=function(_0x3ea88c){var _0x4134f3=this;if(!_0x4134f3[_0xab49('0x2d')][_0x3ea88c[_0xab49('0x48')]]){_0x4134f3['queuesSummary'][_0x3ea88c[_0xab49('0x48')]]={'running':![]};}else if(_0x4134f3['queuesSummary'][_0x3ea88c[_0xab49('0x48')]][_0xab49('0x144')]===!![]){return;}else if(_0x4134f3[_0xab49('0x2d')][_0x3ea88c[_0xab49('0x48')]][_0xab49('0x144')]===![]){_0x4134f3[_0xab49('0x2d')][_0x3ea88c['name']][_0xab49('0x144')]=!![];}var _0x222246=_0x4134f3['voiceQueues'][_0x3ea88c['name']];var _0x42c39d=_0x222246['message']!==utils['CAMPAIGN_STATUS'][_0xab49('0x7f')];var _0x14fc53=utils[_0xab49('0x145')](_0x222246);_0x222246[_0xab49('0x146')]=utils[_0xab49('0x147')](_0x222246,_0x4134f3['trunks']);Promise[_0xab49('0x148')]()[_0xab49('0xa2')](function(){if(_0x222246['statusMessage']===utils[_0xab49('0x7a')][_0xab49('0x7f')]){if(_0x42c39d){clearPredictiveAttributes(_0x222246);_0x3ea88c['startPredictive']=undefined;_0x3ea88c[_0xab49('0x63')]=undefined;}if(_0x222246[_0xab49('0x146')]===utils['CAMPAIGN_STATUS'][_0xab49('0x7f')]){_0x3ea88c[_0xab49('0x149')]=0x0;_0x3ea88c[_0xab49('0xfd')]=0x0;_0x3ea88c[_0xab49('0x14a')]=0x0;_0x3ea88c[_0xab49('0x14b')]=0x0;_0x3ea88c['pTalking']=0x0;}}else if(_0x222246[_0xab49('0x146')]===utils[_0xab49('0x7a')][_0xab49('0x14c')]&&!_0x14fc53){return _0x4134f3[_0xab49('0x97')](_0x222246,!![])[_0xab49('0xa2')](function(){return _0x4134f3['ifTime'](_0x222246,![]);})[_0xab49('0xa2')](function(){return _0x4134f3[_0xab49('0xb8')](_0x222246);})['catch'](function(_0x178463){loggerSyncQueueSummary[_0xab49('0x45')](_0xab49('0x14d'),util['inspect'](_0x178463,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x222246);});}else{clearPredictiveAttributes(_0x222246);}})[_0xab49('0xa2')](function(){var _0x585d14=_0x3ea88c[_0xab49('0x14e')](_0x222246);if(_0x585d14||_0x222246[_0xab49('0x14f')]){_0x222246[_0xab49('0x14f')]=![];_0x3ea88c[_0xab49('0x150')](_0x222246);Object['assign'](_0x222246,_0x3ea88c);emitOutboundVoiceQueueSummary(_0x3ea88c);}_0x4134f3[_0xab49('0x2d')][_0x222246[_0xab49('0x48')]]['running']=![];})[_0xab49('0xa6')](function(_0x854853){logger[_0xab49('0x68')]('[syncQueueSummary]',util[_0xab49('0x46')](_0x854853,{'showHidden':![],'depth':null}));_0x4134f3['queuesSummary'][_0x222246[_0xab49('0x48')]][_0xab49('0x144')]=![];});};Dialer['prototype'][_0xab49('0x36')]=_[_0xab49('0x151')](function(){var _0x55571b=_[_0xab49('0x152')](this[_0xab49('0x1f')],function(_0xb5a999){return _0xb5a999['dialPreviewRecallmeReminder'];});var _0x2253e9=_[_0xab49('0x152')](this['agents'],function(_0x444ae4){return _0x444ae4[_0xab49('0x153')]&&_0x444ae4[_0xab49('0x8d')]===_0xab49('0x154');});if(_0x55571b['length']>0x0&&_0x2253e9[_0xab49('0x9d')]>0x0){return Promise[_0xab49('0x148')]()['then'](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x55571b,'id'),previewRecallmeReminderInterval,_['map'](_0x2253e9,'id')))[_0xab49('0xa2')](function(_0x3e4971){for(var _0x1df59a=0x0;_0x1df59a<_0x3e4971['length'];_0x1df59a++){var _0x10424a=_0x3e4971[_0x1df59a][_0xab49('0x155')][_0xab49('0x48')];if(_0x10424a)io['to'](util[_0xab49('0x47')](_0xab49('0x156'),_0x10424a))['emit'](_0xab49('0x157'),{'hopper':_0x3e4971[_0x1df59a]});}})[_0xab49('0xa6')](function(_0x4f1066){logger[_0xab49('0x68')](_0xab49('0x158'),_0x4f1066);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xab49('0x40')]=function(){var _0x1e7dbf=this;setInterval(function(){_0x1e7dbf[_0xab49('0x159')](_0x1e7dbf['uniqueId'],_0xab49('0x15a'));_0x1e7dbf[_0xab49('0x159')](_0x1e7dbf['actions'],_0xab49('0x15b'));},0x32c8);};Dialer['prototype'][_0xab49('0x159')]=function(_0x3165ed,_0x4f5d4e){var _0x5c1cf7=this;for(var _0x2c0209 in _0x3165ed){if(typeof _0x3165ed[_0x2c0209]!==_0xab49('0xb2')){this[_0xab49('0x1e')][_0xab49('0x15c')](function(){if(!_[_0xab49('0x100')](_0x3165ed[_0x2c0209])){return ami[_0xab49('0xa7')]({'action':_0xab49('0x8d'),'channel':_0x3165ed[_0x2c0209][_0xab49('0xf8')]})[_0xab49('0xa6')](function(_0x29b5fd){if(_0x29b5fd[_0xab49('0x6c')]===_0xab49('0x15d')){setTimeout(function(){if(_0x3165ed[_0x2c0209]&&_0x3165ed[_0x2c0209]['type']!==_0xab49('0xc6')){_0x5c1cf7[_0xab49('0xc7')](_0x5c1cf7[_0xab49('0x1f')][_0x3165ed[_0x2c0209][_0xab49('0xca')]]);logger[_0xab49('0x68')](_0xab49('0x15e'),_0x4f5d4e,_0x2c0209,_0x3165ed[_0x2c0209][_0xab49('0xca')]);delete _0x3165ed[_0x2c0209];}if(_0x3165ed[_0x2c0209]&&_0x3165ed[_0x2c0209][_0xab49('0xcb')]==='ivr'){_0x5c1cf7[_0xab49('0xc7')](_0x5c1cf7[_0xab49('0x20')][_0x3165ed[_0x2c0209][_0xab49('0xca')]]);logger[_0xab49('0x68')]('[Dialer][checkChannel][ivr]',_0x4f5d4e,_0x2c0209,_0x3165ed[_0x2c0209][_0xab49('0xca')]);delete _0x3165ed[_0x2c0209];}},0x2328);}});}});}}};Dialer[_0xab49('0x1b')][_0xab49('0x15f')]=function(_0x5ced11){return Promise[_0xab49('0x148')]()[_0xab49('0xa2')](voiceQueueRt[_0xab49('0x15f')](_0x5ced11))[_0xab49('0xa6')](loggerCatch(_0xab49('0x160')));};Dialer[_0xab49('0x1b')][_0xab49('0xc7')]=function(_0x2aa1d9){if(!_[_0xab49('0x43')](_0x2aa1d9)&&_0x2aa1d9!==null){if(typeof _0x2aa1d9['originated']!==_0xab49('0xb2')){if(_0x2aa1d9[_0xab49('0x84')]>0x0){_0x2aa1d9[_0xab49('0x84')]-=0x1;}else{logger[_0xab49('0x68')](_0xab49('0x161'));}}}else{logger[_0xab49('0x68')](_0xab49('0x162'));}};Dialer['prototype'][_0xab49('0x163')]=function(_0x37ff82,_0x450cb2){var _0x5aa501=this;return function(_0x1f2034){_0x5aa501[_0xab49('0xc7')](_0x450cb2);logger[_0xab49('0x68')](_0x37ff82,util[_0xab49('0x46')](_0x1f2034,{'showHidden':![],'depth':null}));};};Dialer[_0xab49('0x1b')][_0xab49('0x164')]=function(_0x5921a5,_0x115873,_0x3dc75f){var _0x37a244={'state':0x19,'statedesc':_0xab49('0x165')};this[_0xab49('0xc7')](_0x115873);this[_0xab49('0x166')](_[_0xab49('0x61')](_0x37a244,_[_0xab49('0x78')](_0x3dc75f,[_0xab49('0xe7'),_0xab49('0xe8'),_0xab49('0x167'),'VoiceQueueId',_0xab49('0xf5')])),'[emptyContact][createHistory]',_0xab49('0x168'));logger[_0xab49('0x68')](_0x5921a5);};Dialer[_0xab49('0x1b')][_0xab49('0x166')]=function(_0x2795bf,_0x4c12dc,_0x54b925){hopperUtils[_0xab49('0xd0')](_0x2795bf)[_0xab49('0xa6')](loggerCatch(_0x4c12dc));hopperUtils[_0xab49('0xd2')](_0x2795bf)[_0xab49('0xa6')](loggerCatch(_0x54b925));};Dialer[_0xab49('0x1b')]['queueCallerAbandonCreateState']=function(_0x1fe8f9,_0x4a1560){hopperUtils['createHistory'](_0x1fe8f9)['catch'](loggerCatch(_0xab49('0xd1')));if(_0x4a1560==0x0){hopperUtils[_0xab49('0xd2')](_0x1fe8f9)['catch'](loggerCatch(_0xab49('0x169')));}};Dialer[_0xab49('0x1b')][_0xab49('0x158')]=function(_0x326949){return Promise['resolve']()[_0xab49('0xa2')](cmHopper[_0xab49('0x16a')](_0x326949['id'],previewRecallmeReminderInterval))['then'](function(_0x304b72){for(var _0x10f3ee=0x0;_0x10f3ee<_0x304b72[_0xab49('0x9d')];_0x10f3ee++){var _0xdd8c94=_0x304b72[_0x10f3ee][_0xab49('0x155')][_0xab49('0x48')];if(_0xdd8c94)io['to'](util[_0xab49('0x47')]('user:%s',_0xdd8c94))[_0xab49('0x122')](_0xab49('0x157'),{'hopper':_0x304b72[_0x10f3ee]});}})[_0xab49('0xa6')](function(){});};Dialer['prototype'][_0xab49('0x16b')]=function(_0x58b5a4){var _0x128a02=this;return function(){_0x128a02[_0xab49('0x16c')](_0x58b5a4);};};Dialer[_0xab49('0x1b')][_0xab49('0x16d')]=function(_0x21abb9,_0x3e2d10){var _0x41c083=this;var _0x5dad66=uuid['v4']();this[_0xab49('0x25')][_0x5dad66]=new Action(_0x21abb9,_0x3e2d10,_0x5dad66);return new Promise(function(_0x196113,_0x3f4020){if(_['isUndefined'](_0x21abb9)&&typeof _0x21abb9!==_0xab49('0x16e')){return _0x3f4020(msgResponse(_0xab49('0x16f'),_0xab49('0x9a'),_0xab49('0x170')));}if(_[_0xab49('0x43')](_0x3e2d10['phone'])||_0x3e2d10[_0xab49('0x171')]===null){return _0x3f4020(msgResponse(_0xab49('0x16f'),_0xab49('0x9a'),_0xab49('0x172')));}var _0x3970db={'XMD-CALLERID':_0x41c083[_0xab49('0x25')][_0x5dad66][_0xab49('0x173')](),'XMD-AGI':_0x21abb9[_0xab49('0x13e')]?util[_0xab49('0x47')](_0xab49('0x174'),ipAgi,_0x21abb9[_0xab49('0x13e')]):_0xab49('0x175'),'XMD-AGIAFTER':_0x21abb9[_0xab49('0xdb')]?util['format'](_0xab49('0x174'),ipAgi,_0x21abb9[_0xab49('0xdb')]):_0xab49('0x175'),'XMD-QUEUE':utils[_0xab49('0x176')](_0x21abb9)?util[_0xab49('0x47')](_0xab49('0x177'),_0x21abb9[_0xab49('0x48')],_0x21abb9['dialQueueOptions']||'',_0x21abb9[_0xab49('0xce')]?'c':'',_0x21abb9[_0xab49('0xd6')]||0x3):_0xab49('0x175'),'XMD-CONTACTID':_0x3e2d10[_0xab49('0xe7')],'XMD-CDRTYPE':_0xab49('0x8'),'CALLERID(all)':_0x41c083[_0xab49('0x25')][_0x5dad66][_0xab49('0x173')](),'XMD-AMD':_0x21abb9['dialAMDActive']?_0xab49('0x14c'):_0xab49('0x175'),'XMD-DESTINATION':_0xab49('0x11a')};if(_0x21abb9['dialAMDActive']){_0x3970db[_0xab49('0x178')]=_0x21abb9[_0xab49('0x179')]||0x9c4;_0x3970db[_0xab49('0x17a')]=_0x21abb9[_0xab49('0x17b')]||0x5dc;_0x3970db[_0xab49('0x17c')]=_0x21abb9[_0xab49('0x17d')]||0x320;_0x3970db[_0xab49('0x17e')]=_0x21abb9[_0xab49('0x17f')]||0x1388;_0x3970db[_0xab49('0x180')]=_0x21abb9['dialAMDMinWordLength']||0x64;_0x3970db['XMD-AMDBETWEENWORDSSILENCE']=_0x21abb9['dialAMDBetweenWordsSilence']||0x32;_0x3970db[_0xab49('0x181')]=_0x21abb9[_0xab49('0x182')]||0x3;_0x3970db[_0xab49('0x183')]=_0x21abb9[_0xab49('0x184')]||0x100;_0x3970db['XMD-AMDMAXIMUMWORDLENGTH']=_0x21abb9[_0xab49('0x185')]||0x1388;}if(utils[_0xab49('0x176')](_0x21abb9)){_0x3970db[_0xab49('0x186')]=_0x3e2d10[_0xab49('0xe9')];}else{_0x3970db['XMD-CAMPAIGNID']=_0x3e2d10['CampaignId'];}var _0x50088d=utils['setXMDContactVariables'](_0x3e2d10[_0xab49('0x187')]);Object[_0xab49('0x188')](_0x3970db,_0x50088d);var _0x49f582=_0x41c083[_0xab49('0x8b')](_0x21abb9[_0xab49('0x91')])?utils[_0xab49('0x189')](_0x21abb9[_0xab49('0x91')][_0xab49('0x18a')],_0x21abb9[_0xab49('0x18b')],_0x21abb9[_0xab49('0x18c')]>0x0?utils['getCallerIdRandom'](_0x21abb9['dialOriginateCallerIdNumber'],_0x21abb9[_0xab49('0x18c')]):_0x21abb9[_0xab49('0x18d')]):utils['getCallerId'](_['isNil'](_0x21abb9['TrunkBackup'])?_0x21abb9['Trunk'][_0xab49('0x18a')]:_0x21abb9[_0xab49('0x92')]['callerid'],_0x21abb9[_0xab49('0x18b')],_0x21abb9[_0xab49('0x18c')]>0x0?utils[_0xab49('0x18e')](_0x21abb9['dialOriginateCallerIdNumber'],_0x21abb9['dialRandomLastDigitCallerIdNumber']):_0x21abb9[_0xab49('0x18d')]);if(_0x49f582){_0x3970db[_0xab49('0x18f')]=_0x41c083[_0xab49('0x25')][_0x5dad66][_0xab49('0x190')]=utils[_0xab49('0x191')](_0x49f582);_0x3970db[_0xab49('0x192')]=_0x3e2d10[_0xab49('0x171')];}_0x21abb9[_0xab49('0x193')]=_0x3970db;return ami[_0xab49('0xa7')]({'actionid':_0x5dad66,'action':_0xab49('0x16f'),'channel':_0x41c083[_0xab49('0x8b')](_0x21abb9['Trunk'])?util[_0xab49('0x47')](_0xab49('0x194'),_0x21abb9[_0xab49('0x91')]['name'],isNotNull(_0x21abb9['dialPrefix'])?_0x21abb9[_0xab49('0x195')][_0xab49('0x196')]()||'':'',_0x21abb9[_0xab49('0x197')]>0x0?_0x3e2d10[_0xab49('0x171')][_0xab49('0x198')](_0x21abb9[_0xab49('0x197')]):_0x3e2d10[_0xab49('0x171')]):util[_0xab49('0x47')](_0xab49('0x194'),_[_0xab49('0x100')](_0x21abb9['TrunkBackup'])?_0x21abb9[_0xab49('0x91')]['name']:_0x21abb9[_0xab49('0x92')]['name'],isNotNull(_0x21abb9[_0xab49('0x195')])?_0x21abb9[_0xab49('0x195')][_0xab49('0x196')]()||'':'',_0x21abb9[_0xab49('0x197')]>0x0?_0x3e2d10[_0xab49('0x171')]['substring'](_0x21abb9[_0xab49('0x197')]):_0x3e2d10[_0xab49('0x171')]),'callerid':_0x49f582,'Exten':_0xab49('0x11a'),'Context':_0xab49('0x199'),'Priority':'1','variable':_0x3970db,'timeout':(_0x21abb9[_0xab49('0x19a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5dad66})[_0xab49('0xa2')](function(_0xabf51){return _0x196113(_0xabf51);})['catch'](function(_0x14912f){_0x21abb9[_0xab49('0x19b')]+=0x1;var _0xac7153=new History(_0x41c083['actions'][_0x5dad66]);logger['error'](util[_0xab49('0x47')](_0xab49('0x19c'),JSON[_0xab49('0x77')](_0x14912f)));_0xac7153[_0xab49('0x70')]=0xe;_0xac7153[_0xab49('0x71')]=_0xab49('0x19d');_0xac7153[_0xab49('0x73')]=moment()['format'](_0xab49('0xcf'));_0xac7153[_0xab49('0x72')]=_0xac7153[_0xab49('0x73')];hopperUtils['createHistory'](_0xac7153)[_0xab49('0xa6')](loggerCatch(_0xab49('0x19e')));_0x41c083[_0xab49('0xd2')](_0xac7153)['catch'](loggerCatch(_0xab49('0x19e')))[_0xab49('0x1d')](function(){delete _0x41c083['actions'][_0x5dad66];return _0x3f4020(msgResponse(_0xab49('0x16f'),_0xab49('0x8a'),_0xab49('0x19f')));});});});};Dialer[_0xab49('0x1b')][_0xab49('0x1a0')]=function(_0x407db9,_0x3160b9,_0x4dd9c4){var _0x2090dc=new History(_0x3160b9);if(_0x2090dc[_0xab49('0x129')]+_0x2090dc[_0xab49('0x12a')]+_0x2090dc[_0xab49('0x12b')]+_0x2090dc[_0xab49('0x12c')]+_0x2090dc[_0xab49('0xe0')]+_0x2090dc[_0xab49('0xf1')]+_0x2090dc[_0xab49('0x12d')]+_0x2090dc[_0xab49('0x12e')]>=_0x4dd9c4['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x407db9){case 0x3:if(_0x2090dc[_0xab49('0x12b')]>=_0x4dd9c4['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2090dc[_0xab49('0x12b')]+=0x1,'scheduledat':moment()['add'](_0x4dd9c4['dialNoAnswerRetryFrequency'],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x2090dc[_0xab49('0xe7')],'ListId':_0x2090dc[_0xab49('0xe8')],'VoiceQueueId':_0x2090dc[_0xab49('0xe9')]||undefined,'CampaignId':_0x2090dc[_0xab49('0xf5')]||undefined})['catch'](loggerCatch(_0xab49('0x1a1')));break;case 0x5:if(_0x2090dc[_0xab49('0x129')]>=_0x4dd9c4[_0xab49('0x1a2')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x2090dc[_0xab49('0x129')]+=0x1,'scheduledat':moment()[_0xab49('0xe4')](_0x4dd9c4['dialBusyRetryFrequency'],_0xab49('0xe6'))[_0xab49('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2090dc['ContactId'],'ListId':_0x2090dc['ListId'],'VoiceQueueId':_0x2090dc[_0xab49('0xe9')]||undefined,'CampaignId':_0x2090dc[_0xab49('0xf5')]||undefined})['catch'](loggerCatch(_0xab49('0x1a3')));break;case 0x8:if(_0x2090dc['countcongestionretry']>=_0x4dd9c4[_0xab49('0x1a4')]-0x1){return!![];}hopperUtils[_0xab49('0xf4')]({'active':![],'countcongestionretry':_0x2090dc['countcongestionretry']+=0x1,'scheduledat':moment()[_0xab49('0xe4')](_0x4dd9c4[_0xab49('0x1a5')],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x2090dc[_0xab49('0xe7')],'ListId':_0x2090dc[_0xab49('0xe8')],'VoiceQueueId':_0x2090dc[_0xab49('0xe9')]||undefined,'CampaignId':_0x2090dc[_0xab49('0xf5')]||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0x1a6')));break;case 0x0:if(_0x2090dc[_0xab49('0x12c')]>=_0x4dd9c4[_0xab49('0x1a7')]-0x1){return!![];}else{hopperUtils[_0xab49('0xf4')]({'active':![],'countnosuchnumberretry':_0x2090dc[_0xab49('0x12c')]+=0x1,'scheduledat':moment()[_0xab49('0xe4')](_0x4dd9c4[_0xab49('0x1a8')],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x2090dc[_0xab49('0xe7')],'ListId':_0x2090dc[_0xab49('0xe8')],'VoiceQueueId':_0x2090dc[_0xab49('0xe9')]||undefined,'CampaignId':_0x2090dc[_0xab49('0xf5')]||undefined})['catch'](loggerCatch(_0xab49('0x1a9')));}break;case 0xa:if(_0x2090dc['countdropretry']>=_0x4dd9c4[_0xab49('0xe1')]-0x1){return!![];}hopperUtils[_0xab49('0xf4')]({'active':![],'countdropretry':_0x2090dc[_0xab49('0xe0')]+=0x1,'scheduledat':moment()[_0xab49('0xe4')](_0x4dd9c4[_0xab49('0xe5')],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x2090dc[_0xab49('0xe7')],'ListId':_0x2090dc[_0xab49('0xe8')],'VoiceQueueId':_0x2090dc[_0xab49('0xe9')]||undefined,'CampaignId':_0x2090dc['CampaignId']||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0x1aa')));break;case 0xb:if(_0x2090dc[_0xab49('0xf1')]>=_0x4dd9c4[_0xab49('0xf3')]-0x1){return!![];}hopperUtils[_0xab49('0xf4')]({'active':![],'countabandonedretry':_0x2090dc[_0xab49('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x4dd9c4['dialAbandonedRetryFrequency'],_0xab49('0xe6'))['format'](_0xab49('0xcf')),'ContactId':_0x2090dc[_0xab49('0xe7')],'ListId':_0x2090dc[_0xab49('0xe8')],'VoiceQueueId':_0x2090dc['VoiceQueueId']||undefined,'CampaignId':_0x2090dc[_0xab49('0xf5')]||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0xf6')));break;case 0x13:if(_0x2090dc[_0xab49('0x12d')]>=_0x4dd9c4[_0xab49('0x12f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2090dc[_0xab49('0x12d')]+=0x1,'scheduledat':moment()[_0xab49('0xe4')](_0x4dd9c4[_0xab49('0x131')],'minutes')['format'](_0xab49('0xcf')),'ContactId':_0x2090dc['ContactId'],'ListId':_0x2090dc[_0xab49('0xe8')],'VoiceQueueId':_0x2090dc[_0xab49('0xe9')]||undefined,'CampaignId':_0x2090dc['CampaignId']||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0x132')));break;case 0x14:if(_0x2090dc[_0xab49('0x12e')]>=_0x4dd9c4['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xab49('0xf4')]({'active':![],'countagentrejectretry':_0x2090dc['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xab49('0xe4')](_0x4dd9c4['dialAgentRejectRetryFrequency'],_0xab49('0xe6'))[_0xab49('0x47')](_0xab49('0xcf')),'ContactId':_0x2090dc[_0xab49('0xe7')],'ListId':_0x2090dc['ListId'],'VoiceQueueId':_0x2090dc['VoiceQueueId']||undefined,'CampaignId':_0x2090dc[_0xab49('0xf5')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xab49('0x1b')]['callProgressDetecting']=function(_0x4b0255,_0x3688ca,_0x167cf4){var _0x3bf875=this;var _0x12f919=new History(_0x4b0255);var _0x2539c9=![];var _0x3cc48c;var _0xd65f34;return new Promise(function(_0x324ac7,_0x424f49){if(_['isUndefined'](_0x3688ca)&&typeof _0x3688ca!==_0xab49('0x16e')){return _0x424f49(msgResponse(_0xab49('0x1ab'),_0xab49('0x9a'),_0xab49('0x1ac')));}if(_[_0xab49('0x43')](_0x167cf4)&&typeof _0x167cf4!==_0xab49('0x16e')){return _0x424f49(msgResponse(_0xab49('0x1ab'),'Failure',_0xab49('0x1ad')));}hopperUtils[_0xab49('0xde')](_0x12f919,_0x167cf4['reason'],_0x3688ca)['then'](function(_0x259ecc){if(_0x259ecc[_0xab49('0xe3')]==0x1)_0x2539c9=!![];switch(_0x167cf4[_0xab49('0x1ae')]){case'0':_0x3688ca[_0xab49('0x1af')]+=0x1;_0x12f919[_0xab49('0x70')]=0x0;_0x12f919['statedesc']=_0xab49('0x1b0');_0x12f919[_0xab49('0x12c')]+=0x1;_0x12f919['countglobal']+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x4b0255,_0xab49('0x1b1')));_0x3cc48c=_0x3688ca[_0xab49('0x1a8')];_0xd65f34=_0x3688ca[_0xab49('0xdd')];hopperUtils[_0xab49('0xd0')](_0x12f919)[_0xab49('0xa6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3bf875[_0xab49('0x1a0')](0x0,_0x4b0255,_0x3688ca)&&!_0x2539c9){if(_0x12f919['countnosuchnumberretry']>=_0x3688ca[_0xab49('0x1a7')]){_0x3bf875[_0xab49('0x130')](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1b2'));}else{_0x3bf875[_0xab49('0x136')](_0x12f919,_0x324ac7,_0x424f49,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3688ca[_0xab49('0x1b3')]+=0x1;_0x12f919['state']=0x3;_0x12f919[_0xab49('0x71')]=_0xab49('0x1b4');_0x12f919[_0xab49('0x12b')]+=0x1;_0x12f919['countglobal']+=0x1;var _0x278f67=ut['buildNoAnswerEventPayload'](_0x4b0255,_0x3688ca);ami['emit'](_0xab49('0x1b5'),_0x278f67);_0x3cc48c=_0x3688ca['dialNoAnswerRetryFrequency'];_0xd65f34=_0x3688ca[_0xab49('0xdd')];hopperUtils[_0xab49('0xd0')](_0x12f919)[_0xab49('0xa6')](loggerCatch(_0xab49('0x1b6')));if(_0x3bf875[_0xab49('0x1a0')](0x3,_0x4b0255,_0x3688ca)&&!_0x2539c9){if(_0x12f919[_0xab49('0x12b')]>=_0x3688ca['dialNoAnswerMaxRetry']){_0x3bf875['createStateFinal'](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1b7'));}else{_0x3bf875[_0xab49('0x136')](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1b7'));}}break;case'5':_0x3688ca[_0xab49('0x1b8')]+=0x1;_0x12f919[_0xab49('0x70')]=0x5;_0x12f919['statedesc']='Busy';_0x12f919['countbusyretry']+=0x1;_0x12f919[_0xab49('0xdc')]+=0x1;ami[_0xab49('0x122')](_0xab49('0x1b9'),ut['buildObj'](_0x4b0255,_0xab49('0x1ba')));_0x3cc48c=_0x3688ca['dialBusyRetryFrequency'];_0xd65f34=_0x3688ca['callAdditionalPhoneAfterMin'];hopperUtils[_0xab49('0xd0')](_0x12f919)[_0xab49('0xa6')](loggerCatch(_0xab49('0x1bb')));if(_0x3bf875[_0xab49('0x1a0')](0x5,_0x4b0255,_0x3688ca)&&!_0x2539c9){if(_0x12f919[_0xab49('0x129')]>=_0x3688ca[_0xab49('0x1a2')]){_0x3bf875[_0xab49('0x130')](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1bc'));}else{_0x3bf875['stateGlobal'](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1bc'));}}break;case'8':_0x3688ca[_0xab49('0x1bd')]+=0x1;_0x12f919[_0xab49('0x70')]=0x8;_0x12f919[_0xab49('0x71')]='Congestion';_0x12f919[_0xab49('0x12a')]+=0x1;_0x12f919[_0xab49('0xdc')]+=0x1;_0x3cc48c=_0x3688ca[_0xab49('0x1a5')];_0xd65f34=_0x3688ca[_0xab49('0xdd')];ami[_0xab49('0x122')]('custom:agentcongestion',ut[_0xab49('0x124')](_0x4b0255,_0xab49('0x1be')));hopperUtils[_0xab49('0xd0')](_0x12f919)[_0xab49('0xa6')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x3bf875[_0xab49('0x1a0')](0x8,_0x4b0255,_0x3688ca)&&!_0x2539c9){if(_0x12f919[_0xab49('0x12a')]>=_0x3688ca[_0xab49('0x1a4')]){_0x3bf875['createStateFinal'](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1bf'));}else{_0x3bf875[_0xab49('0x136')](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1bf'));}}break;case'11':_0x3688ca[_0xab49('0x1c0')]+=0x1;_0x12f919[_0xab49('0x70')]=0xb;_0x12f919[_0xab49('0x71')]=_0xab49('0xef');_0x12f919[_0xab49('0xf1')]+=0x1;_0x12f919[_0xab49('0xdc')]+=0x1;_0x3cc48c=_0x3688ca[_0xab49('0xf2')];_0xd65f34=_0x3688ca[_0xab49('0xdd')];hopperUtils[_0xab49('0xd0')](_0x12f919)[_0xab49('0xa6')](loggerCatch(_0xab49('0xf7')));if(_0x3bf875[_0xab49('0x1a0')](0xb,_0x4b0255,_0x3688ca)&&!_0x2539c9){if(_0x12f919[_0xab49('0xf1')]>=_0x3688ca[_0xab49('0xf3')]){_0x3bf875[_0xab49('0x130')](_0x12f919,_0x324ac7,_0x424f49,'reason\x2011\x20abandoned');}else{_0x3bf875['stateGlobal'](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1c1'));}}break;case'20':_0x3688ca[_0xab49('0x1c2')]+=0x1;_0x12f919[_0xab49('0x70')]=0x14;_0x12f919['statedesc']='AgentReject';_0x12f919[_0xab49('0x12e')]+=0x1;_0x12f919[_0xab49('0xdc')]+=0x1;_0x3cc48c=_0x3688ca[_0xab49('0x1c3')];_0xd65f34=_0x3688ca[_0xab49('0xdd')];ami[_0xab49('0x122')](_0xab49('0x1c4'),ut[_0xab49('0x124')](_0x4b0255,'agentreject'));hopperUtils[_0xab49('0xd0')](_0x12f919)[_0xab49('0xa6')](loggerCatch(_0xab49('0x1c5')));if(_0x3bf875[_0xab49('0x1a0')](0x14,_0x4b0255,_0x3688ca)&&!_0x2539c9){if(_0x12f919[_0xab49('0x12e')]>=_0x3688ca[_0xab49('0x1c6')]){_0x3bf875[_0xab49('0x130')](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1c7'));}else{_0x3bf875[_0xab49('0x136')](_0x12f919,_0x324ac7,_0x424f49,_0xab49('0x1c7'));}}break;default:_0x3688ca['outboundUnknownCallsDay']+=0x1;_0x12f919['state']=0xc;_0x12f919[_0xab49('0x71')]=_0x167cf4[_0xab49('0x1ae')];_0x3cc48c=_0x3688ca['dialAgentRejectRetryFrequency'];_0xd65f34=_0x3688ca[_0xab49('0xdd')];hopperUtils[_0xab49('0xd0')](_0x12f919)[_0xab49('0xa6')](loggerCatch(_0xab49('0x1c8')));if(_0x3bf875[_0xab49('0x1a0')](_0x167cf4[_0xab49('0x1ae')],_0x4b0255,_0x3688ca)&&!_0x2539c9){if(_0x12f919[_0xab49('0x129')]+_0x12f919[_0xab49('0x12a')]+_0x12f919['countnoanswerretry']+_0x12f919[_0xab49('0x12c')]+_0x12f919['countdropretry']+_0x12f919[_0xab49('0xf1')]+_0x12f919[_0xab49('0x12d')]+_0x12f919[_0xab49('0x12e')]>=_0x3688ca[_0xab49('0x135')]){_0x3bf875[_0xab49('0x136')](_0x12f919,_0x324ac7,_0x424f49,_0x167cf4[_0xab49('0x1ae')]);}else{_0x3bf875['createStateFinal'](_0x12f919,_0x324ac7,_0x424f49,_0x167cf4[_0xab49('0x1ae')]);}}}})['then'](function(){if(_0x2539c9){hopperUtils[_0xab49('0xed')](_0x12f919,_0x3cc48c,_0xd65f34)['then'](function(){return _0x324ac7(0x1);});}});});};Dialer[_0xab49('0x1b')][_0xab49('0x136')]=function(_0x216e16,_0x420681,_0x5093ed,_0x38706c){var _0x2ce267=new Final(_0x216e16);_0x2ce267['state']=0xf;_0x2ce267[_0xab49('0x71')]=_0xab49('0x1c9');this[_0xab49('0x130')](_0x2ce267,_0x420681,_0x5093ed,_0x38706c);};Dialer['prototype'][_0xab49('0x130')]=function(_0x1aab26,_0x2d6492,_0x367fcd,_0x4fa9a2){hopperUtils[_0xab49('0xd2')](_0x1aab26)[_0xab49('0xa2')](function(){return _0x2d6492(msgResponse('[callProgressDetecting]',_0xab49('0x114'),_0x4fa9a2));})[_0xab49('0xa6')](function(){return _0x367fcd(msgResponse(_0xab49('0x1ca'),_0xab49('0x9a'),_0xab49('0x1cb')));});};Dialer['prototype']['predictive']=function(_0x469027){var _0x5abbce=_0x469027[_0xab49('0x1cc')]/0x64;var _0xf6a51=_0x469027[_0xab49('0xd7')]/(_0x469027['outboundDropCallsDayTimeout']+_0x469027[_0xab49('0x11e')]);var _0x1ae131=Math['round'](_0x469027['predictiveIntervalAvailable']*(_0x469027[_0xab49('0x1cd')]/0x64));var _0x42ae88=Math[_0xab49('0x1ce')](_0x469027[_0xab49('0x1cf')]*(_0x469027['predictiveIntervalMinThreshold']/0x64));var _0xd64fa9=_0x469027[_0xab49('0x149')]+_0x469027[_0xab49('0x14b')];var _0x68c68f=Math[_0xab49('0x1d0')](_0x469027[_0xab49('0x1d1')]*_0x469027[_0xab49('0x5d')]*_0x469027[_0xab49('0x1d2')]*_0x469027['predictiveIntervalMultiplicativeFactor']);if(_[_0xab49('0x43')](_0x469027['startProgressive'])){if(!_[_0xab49('0x43')](_0x469027[_0xab49('0x29')])){_0x469027['startPredictive']=undefined;loggerPredictive[_0xab49('0x68')](_0xab49('0x1d3'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xab49('0x43')](_0x469027['handlePredictive'])){loggerPredictive[_0xab49('0x68')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x469027[_0xab49('0x66')]);_0x469027[_0xab49('0x66')]=undefined;}_0x469027[_0xab49('0x63')]=moment()[_0xab49('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xab49('0x4a')](_0x469027['name'],'collection\x20data\x20in\x20progressive\x20at',_0x469027[_0xab49('0x63')]);this[_0xab49('0xbb')](_0x469027,0x1);}else if(ifInterval(_0x469027[_0xab49('0x1d4')],_0x469027[_0xab49('0x63')])){this[_0xab49('0xbb')](_0x469027,0x1);loggerPredictiveCalls[_0xab49('0x4a')](_0xab49('0x1d5'),_0x469027['startProgressive'],_0x469027[_0xab49('0x48')]);_0x469027[_0xab49('0x1d1')]=0x0;_0x469027[_0xab49('0x1d6')]=0x0;}else if(_0x5abbce<_0xf6a51&&_0x469027[_0xab49('0x1d7')]===_0xab49('0x1d8')){clearPredictiveAttributes(_0x469027);loggerPredictive[_0xab49('0x4a')](_0xab49('0x1d9'),'Dropped\x20calls\x20day',_0xf6a51,_0xab49('0x63'),_0x469027[_0xab49('0x48')]);}else if(_0x68c68f<_0x469027[_0xab49('0x1d6')]&&_0x469027[_0xab49('0x1d7')]==='dropRate'){clearPredictiveAttributes(_0x469027);loggerPredictive['info'](_0xab49('0x1da'),'Max\x20Drop\x20',_0x68c68f,_0xab49('0x1db'),_0x469027[_0xab49('0x1d6')],_0xab49('0x63'),_0x469027[_0xab49('0x48')]);}else if(!ifInterval(_0x469027[_0xab49('0x1d4')],_0x469027[_0xab49('0x63')])&&_['isUndefined'](_0x469027[_0xab49('0x29')])&&!_[_0xab49('0x43')](_0x469027[_0xab49('0x63')])){_0x469027['startPredictive']=moment()[_0xab49('0x47')](_0xab49('0xcf'));loggerPredictive['info'](_0x469027['name'],_0xab49('0x1dc'),_0x469027[_0xab49('0x29')]);hopperUtils[_0xab49('0x1dd')](_0x469027[_0xab49('0x1d4')])['then'](this['getDataPredictive'](_0x469027))[_0xab49('0xa2')](mergeDataErlangB(_0x469027))['then'](this[_0xab49('0x1de')](_0x469027))['catch'](loggerCatchPredictive(_0xab49('0x1df'),_0x469027));}else if(!ifInterval(_0x469027[_0xab49('0x1d4')],_0x469027['startPredictive'])){_0x469027[_0xab49('0x1d6')]=0x0;_0x469027[_0xab49('0x29')]=moment()[_0xab49('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x469027[_0xab49('0x48')],_0xab49('0x1e0'),_0x469027['startPredictive']);clearInterval(_0x469027['handlePredictive']);_0x469027[_0xab49('0x66')]=undefined;hopperUtils[_0xab49('0x1dd')](_0x469027[_0xab49('0x1d4')])[_0xab49('0xa2')](this[_0xab49('0x1e1')](_0x469027))['then'](mergeDataErlangB(_0x469027))[_0xab49('0xa2')](this[_0xab49('0x1de')](_0x469027))[_0xab49('0xa6')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x469027));}else if(_0x469027[_0xab49('0x1cf')]&&_0xd64fa9<_0x469027[_0xab49('0x1cf')]-_0x42ae88){clearPredictiveAttributes(_0x469027);loggerPredictive[_0xab49('0x4a')](_0x469027[_0xab49('0x48')],_0xab49('0x1e2'),_0xd64fa9,')\x20are\x20less\x20than\x20threshold\x20(',_0x469027['predictiveIntervalAvailable'],'-',_0x42ae88,'=',_0x469027[_0xab49('0x1cf')]-_0x42ae88,')');}else if(_0x469027['predictiveIntervalAvailable']&&_0xd64fa9>_0x469027[_0xab49('0x1cf')]+_0x1ae131){clearPredictiveAttributes(_0x469027);loggerPredictive[_0xab49('0x4a')](_0x469027['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xd64fa9,_0xab49('0x1e3'),_0x469027['predictiveIntervalAvailable'],'+',_0x1ae131,'=',_0x469027['predictiveIntervalAvailable']+_0x1ae131,')');}};Dialer[_0xab49('0x1b')][_0xab49('0x1e1')]=function(_0x1e260d){var _0x289dcf=this;return function(_0x364f26){return new Promise(function(_0x53513d,_0x5476ab){_[_0xab49('0x61')](_0x1e260d,_0x364f26[0x0]);if(checkGetDataPredictive(_0x364f26[0x0])){var _0x1df271=_0x1e260d[_0xab49('0x1cf')]=_0x1e260d[_0xab49('0x14b')]+_0x1e260d[_0xab49('0x149')];var _0xc17d35=_0x1e260d[_0xab49('0x1d4')]*0x3c;var _0x492a66=_0x364f26[0x0][_0xab49('0x55')]+_0x364f26[0x0][_0xab49('0x53')];var _0x17a3e6=(_0x364f26[0x0][_0xab49('0x4e')]+_0x364f26[0x0][_0xab49('0x50')]+_0x364f26[0x0][_0xab49('0x51')])/_0x364f26[0x0]['predictiveIntervalTotalCalls'];_0x1e260d[_0xab49('0x1d2')]=_0x17a3e6>0x0?_0x17a3e6:0x1;switch(_0x1e260d[_0xab49('0x1d7')]){case _0xab49('0x1d8'):var _0x359872=_0x1e260d[_0xab49('0x1cc')]/0x64;return _0x289dcf[_0xab49('0x1e4')](_0x1df271,_0xc17d35,_0x492a66,_0x17a3e6,_0x359872)[_0xab49('0xa2')](function(_0x5e78ae){return _0x53513d(_0x5e78ae);});case _0xab49('0x1e5'):var _0x6b4a54=_0x1e260d[_0xab49('0x1cc')]/0x64;return _0x289dcf[_0xab49('0x1e6')](_0x1df271,_0xc17d35,_0x492a66,_0x17a3e6,_0x6b4a54)[_0xab49('0xa2')](function(_0x5095a3){return _0x53513d(_0x5095a3);});default:return _0x5476ab(msgResponse('[getDataPredictive]',_0xab49('0x9a'),_0xab49('0x1e7')));}}else{return _0x5476ab(msgResponse(_0xab49('0x1e8'),_0xab49('0x9a'),_0xab49('0x1e9')));}});};};Dialer[_0xab49('0x1b')]['getDataPredictiveOld']=function(_0x5f56f1){var _0x204183=this;return function(_0x6dc9f5){return new Promise(function(_0x182495,_0x1e9466){_[_0xab49('0x61')](_0x5f56f1,_0x6dc9f5[0x0]);if(checkGetDataPredictive(_0x6dc9f5[0x0])){loggerPredictive[_0xab49('0x4a')](JSON[_0xab49('0x77')](_0x6dc9f5[0x0]));if(_0x5f56f1['dialPredictiveOptimization']===_0xab49('0x1d8')){return _0x204183[_0xab49('0x15f')](_0x5f56f1['id'])[_0xab49('0xa2')](function(_0x2ebbb6){var _0x46dd8f=_0x5f56f1['loggedIn']-_0x2ebbb6[0x0][_0xab49('0x1ea')];var _0x57e458=_0x5f56f1[_0xab49('0x1d4')]*0x3c;var _0x49694d=_0x6dc9f5[0x0]['predictiveIntervalAvgTalktime']+_0x6dc9f5[0x0]['predictiveIntervalAvgHoldtime'];var _0x195210=(_0x6dc9f5[0x0][_0xab49('0x4e')]+_0x6dc9f5[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x6dc9f5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x6dc9f5[0x0][_0xab49('0x4c')];var _0x3c3fb2=_0x5f56f1[_0xab49('0x1cc')]/0x64;_0x5f56f1[_0xab49('0x1eb')]=_0x2ebbb6[0x0][_0xab49('0x1ea')]||0x0;_0x5f56f1[_0xab49('0x1d2')]=_0x195210>0x0?_0x195210:0x1;return _0x204183['abandonmentRate'](_0x46dd8f,_0x57e458,_0x49694d,_0x195210,_0x3c3fb2);})['then'](function(_0x3b8692){return _0x182495(_0x3b8692);})['catch'](function(_0x10df83){return _0x1e9466(msgResponse(_0xab49('0x1ec'),_0xab49('0x9a'),JSON['stringify'](_0x10df83)));});}if(_0x5f56f1['dialPredictiveOptimization']===_0xab49('0x1e5')){return _0x204183['getVoiceQueueRtPauses'](_0x5f56f1['id'])['then'](function(_0xbf066e){var _0x427722=_0x5f56f1['loggedIn']-_0xbf066e[0x0][_0xab49('0x1ea')];var _0xa06bd4=_0x5f56f1[_0xab49('0x1d4')]*0x3c;var _0xa14c11=_0x6dc9f5[0x0][_0xab49('0x55')]+_0x6dc9f5[0x0][_0xab49('0x53')];var _0xbba201=(_0x6dc9f5[0x0][_0xab49('0x4e')]+_0x6dc9f5[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x6dc9f5[0x0][_0xab49('0x51')])/_0x6dc9f5[0x0]['predictiveIntervalTotalCalls'];var _0x362658=_0x5f56f1['dialPredictiveOptimizationPercentage']/0x64;_0x5f56f1[_0xab49('0x1eb')]=_0xbf066e[0x0][_0xab49('0x1ea')]||0x0;_0x5f56f1[_0xab49('0x1d2')]=_0xbba201>0x0?_0xbba201:0x1;return _0x204183[_0xab49('0x1e6')](_0x427722,_0xa06bd4,_0xa14c11,_0xbba201,_0x362658);})['then'](function(_0x5aacf6){return _0x182495(_0x5aacf6);})['catch'](function(_0x4cd136){return _0x1e9466(msgResponse(_0xab49('0x1ec'),'Failure',JSON[_0xab49('0x77')](_0x4cd136)));});}}else{return _0x1e9466(msgResponse(_0xab49('0x1e8'),'Failure',_0xab49('0x1e9')));}});};};Dialer['prototype'][_0xab49('0x1de')]=function(_0x2e232f){var _0x5ca987=this;return function(){var _0x324be6=0x0;var _0x4a5960=Math[_0xab49('0x1d0')](_0x2e232f[_0xab49('0x5c')]*0x3e8);if(_0x4a5960>0x0){_0x4a5960=_0x4a5960<0x64?0x64:_0x4a5960;loggerPredictive[_0xab49('0x4a')](_0x2e232f[_0xab49('0x48')],'one\x20call\x20every:',_0x4a5960,_0xab49('0x1ed'));_0x2e232f['handlePredictive']=setInterval(function(){_0x5ca987[_0xab49('0x66')](_0x2e232f);loggerPredictiveCalls['info']('[handlePredictive]',_0x324be6+=0x1);},_0x4a5960);}else{loggerPredictive[_0xab49('0x4a')](_0x2e232f[_0xab49('0x48')],_0xab49('0x1ee'));}};};Dialer['prototype'][_0xab49('0x1ef')]=function(_0x22d58d,_0x940fd){var _0x384589=this;return function(_0x5a1895){if(_[_0xab49('0x7e')](_0x5a1895)){if(_['isNil'](_0x940fd[_0xab49('0x167')])||!_0x940fd[_0xab49('0x1f0')]){if(_0x22d58d[_0xab49('0xb9')]===_0xab49('0x9')){_0x22d58d[_0xab49('0x74')]=_[_0xab49('0x43')](_0x22d58d['queueStatusComplete'])?!![]:_0x22d58d[_0xab49('0x74')];var _0x118ef3=uuid['v4']();_0x384589[_0xab49('0x25')][_0x118ef3]=new Action(_0x22d58d,_0x940fd,_0x118ef3);loggerBooked[_0xab49('0x4a')](_0xab49('0x1f1'),_0x118ef3,_0xab49('0x1f2'),JSON['stringify'](_0x22d58d['queueStatusComplete']),'Queue:\x20',_0x22d58d[_0xab49('0x48')]);if(_0x22d58d[_0xab49('0x74')]){_0x22d58d[_0xab49('0x74')]=![];_0x384589['queueBooked'][_0x384589[_0xab49('0x25')][_0x118ef3][_0xab49('0xca')]]=[];ami['Action']({'actionid':_0x118ef3,'action':_0xab49('0x1f3'),'queue':_0x22d58d['name']})[_0xab49('0xa6')](function(){_0x384589[_0xab49('0xc7')](_0x22d58d);hopperUtils[_0xab49('0xf4')]({'active':![],'ContactId':_0x384589['actions'][_0x118ef3]['ContactId'],'ListId':_0x384589[_0xab49('0x25')][_0x118ef3][_0xab49('0xe8')],'VoiceQueueId':_0x384589[_0xab49('0x25')][_0x118ef3][_0xab49('0xe9')]||undefined,'CampaignId':_0x384589[_0xab49('0x25')][_0x118ef3][_0xab49('0xf5')]||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0x1f4')));delete _0x384589[_0xab49('0x25')][_0x118ef3];});}else{loggerBooked[_0xab49('0x4a')](_0xab49('0x1f5'),JSON[_0xab49('0x77')](_0x22d58d['queueStatusComplete']),_0xab49('0x1f6'),_0x22d58d['name']);_0x384589[_0xab49('0xc7')](_0x22d58d);hopperUtils[_0xab49('0xf4')]({'active':![],'ContactId':_0x384589[_0xab49('0x25')][_0x118ef3]['ContactId'],'ListId':_0x384589[_0xab49('0x25')][_0x118ef3][_0xab49('0xe8')],'VoiceQueueId':_0x384589[_0xab49('0x25')][_0x118ef3]['VoiceQueueId']||undefined,'CampaignId':_0x384589[_0xab49('0x25')][_0x118ef3][_0xab49('0xf5')]||undefined})['catch'](loggerCatch(_0xab49('0x1f4')));delete _0x384589[_0xab49('0x25')][_0x118ef3];}}else{return _0x384589[_0xab49('0x16d')](_0x22d58d,_0x940fd);}}else{if(utils[_0xab49('0x62')](undefined,_0x940fd[_0xab49('0x1f7')])<_0x22d58d['dialRecallMeTimeout']*0x3c){if(_0x940fd[_0xab49('0x155')]&&!_0x940fd[_0xab49('0x155')][_0xab49('0x1f8')]){_0x384589['preview'][_0xab49('0x102')](_0x940fd['id'])[_0xab49('0x1d')](function(){_0x384589[_0xab49('0xc7')](_0x22d58d);});}else{hopperUtils[_0xab49('0x1f9')]({'active':![]},_0x940fd['id'],0x1)[_0xab49('0x1d')](function(){_0x384589['updateOriginated'](_0x22d58d);});}}else{_0x22d58d[_0xab49('0x1fa')]+=0x1;_0x384589[_0xab49('0xc7')](_0x22d58d);if(_0x22d58d['dialRecallInQueue']){hopperUtils[_0xab49('0xf4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x940fd['ContactId'],'ListId':_0x940fd[_0xab49('0xe8')],'VoiceQueueId':_0x940fd['VoiceQueueId']||undefined,'CampaignId':_0x940fd[_0xab49('0xf5')]||undefined})[_0xab49('0xa6')](loggerCatch(_0xab49('0x1fb')));hopperUtils[_0xab49('0xd0')](createObjHistory(_0x22d58d,_0x940fd,utils['CAMPAIGN_STATUS'][_0xab49('0x1fc')],0x17,_0xab49('0x1fd')))['catch'](loggerCatch(_0xab49('0x1fe')));}else{_0x384589['saveInDb'](createObjHistory(_0x22d58d,_0x940fd,utils[_0xab49('0x7a')][_0xab49('0x1ff')],0x16,_0xab49('0x200')),_0xab49('0x201'),_0xab49('0x202'));}}}}else{_0x22d58d['outboundBlacklistCallsDay']+=0x1;_0x384589['saveInDb'](createObjHistory(_0x22d58d,_0x940fd,utils['CAMPAIGN_STATUS'][_0xab49('0x203')],0xd,_0xab49('0x204')),_0xab49('0x205'),'[Originate][MoveBlacklist]');throw _0xab49('0x206');}};};Dialer[_0xab49('0x1b')][_0xab49('0x16c')]=function(_0x4b74ae){var _0x454868=this;var _0x29c22e=_0x4b74ae[_0xab49('0x207')]-_0x4b74ae['originated'];emitCampaignSummary(_0x4b74ae);if(_0x29c22e>0x0&&_0x4b74ae[_0xab49('0x6a')]==0x0){if(_0x29c22e>this[_0xab49('0x23')]){_0x29c22e=this[_0xab49('0x23')];}_0x4b74ae['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x4b74ae,_0x29c22e)[_0xab49('0xa2')](function(_0x42e5f1){_0x4b74ae[_0xab49('0x6a')]=0x0;if(_0x42e5f1){if(!utils[_0xab49('0x208')](_0x42e5f1)){_0x4b74ae[_0xab49('0x6c')]=utils[_0xab49('0x7a')][_0xab49('0x6f')];logger['info'](_0xab49('0x209')+_0x4b74ae[_0xab49('0x48')]);}else{_0x4b74ae['originated']+=_0x42e5f1[_0xab49('0x9d')];_0x4b74ae[_0xab49('0x6c')]=utils['CAMPAIGN_STATUS'][_0xab49('0x20a')];for(var _0x4682ea=0x0;_0x4682ea<_0x42e5f1['length'];_0x4682ea+=0x1){_0x4b74ae[_0xab49('0x20b')]+=0x1;if(_[_0xab49('0x100')](_0x42e5f1[_0x4682ea])||_[_0xab49('0x100')](_0x42e5f1[_0x4682ea][_0xab49('0x187')])||_[_0xab49('0x100')](_0x42e5f1[_0x4682ea]['phone'])){_0x454868[_0xab49('0x164')](_0xab49('0x20c'),_0x4b74ae,_0x42e5f1[_0x4682ea]);}else{hopperUtils[_0xab49('0x20d')](_[_0xab49('0x78')](_0x42e5f1[_0x4682ea],[_0xab49('0xf5'),_0xab49('0x171')]))[_0xab49('0xa2')](_0x454868[_0xab49('0x1ef')](_0x4b74ae,_0x42e5f1[_0x4682ea]))[_0xab49('0xa6')](_0x454868['loggerHandler'](_0xab49('0x20e'),_0x4b74ae));}}}}})['catch'](loggerGetContactDialer(_0xab49('0x20f'),_0x4b74ae,_0x29c22e));}};Dialer[_0xab49('0x1b')][_0xab49('0xbb')]=function(_0x570d71,_0x3eff4a){var _0xd4050b=this;var _0x526733=[];if(_0x3eff4a<0x1||_0x570d71[_0xab49('0xb9')]===_0xab49('0x9')){_0x3eff4a=0x1;}var _0x21a8e1=Math['floor'](_0x570d71[_0xab49('0x149')]*_0x3eff4a)-_0x570d71[_0xab49('0x84')];if(_0x570d71['dialLimitQueue']>0x0){var _0x5d728b=_0x570d71[_0xab49('0x210')]-_0x570d71['originated']-_0x570d71[_0xab49('0x14b')]-_0x570d71['pTalking'];if(_0x21a8e1>_0x5d728b){_0x21a8e1=_0x5d728b;}}if(_0x21a8e1>0x0&&_0x570d71[_0xab49('0x6a')]==0x0){if(_0x570d71[_0xab49('0xb9')]===_0xab49('0x9')){_0x21a8e1=0x1;}if(_0x21a8e1>this[_0xab49('0x23')]){_0x21a8e1=this[_0xab49('0x23')];}for(var _0x301d2a in this[_0xab49('0x21')]){if(typeof this[_0xab49('0x21')][_0x301d2a]!==_0xab49('0xb2')){if(this[_0xab49('0x21')][_0x301d2a]['state']===_0xab49('0x211')&&this['agents'][_0x301d2a]['status']===_0xab49('0x154')){_0x526733[_0xab49('0x9e')](this[_0xab49('0x21')][_0x301d2a]['id']);}}}_0x570d71[_0xab49('0x6a')]=0x1;hopperUtils[_0xab49('0x212')](_0x570d71,_0x526733,_0x21a8e1)['then'](function(_0x332092){_0x570d71[_0xab49('0x6a')]=0x0;if(_0x332092){if(!utils[_0xab49('0x208')](_0x332092)){hopperUtils[_0xab49('0x213')](_0x570d71)[_0xab49('0xa2')](sendMessageReschedule(_0x570d71))[_0xab49('0xa6')](loggerCatch(_0xab49('0x214')));}else{_0x570d71['originated']+=_0x332092['length'];_0x570d71['message']=_0x570d71[_0xab49('0xb9')]===_0xab49('0x9')?utils['CAMPAIGN_STATUS'][_0xab49('0x14c')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x55b051=0x0;_0x55b051<_0x332092[_0xab49('0x9d')];_0x55b051+=0x1){if(_['isNil'](_0x332092[_0x55b051])||_[_0xab49('0x100')](_0x332092[_0x55b051][_0xab49('0x187')])||_[_0xab49('0x100')](_0x332092[_0x55b051]['phone'])){_0xd4050b[_0xab49('0x164')](_0xab49('0x20c'),_0x570d71,_0x332092[_0x55b051]);}else{hopperUtils[_0xab49('0x215')](_[_0xab49('0x78')](_0x332092[_0x55b051],[_0xab49('0xe9'),_0xab49('0x171')]))[_0xab49('0xa2')](_0xd4050b[_0xab49('0x1ef')](_0x570d71,_0x332092[_0x55b051]))[_0xab49('0xa6')](_0xd4050b[_0xab49('0x163')](_0xab49('0x20c'),_0x570d71));}}}}})[_0xab49('0xa6')](loggerGetContactDialer(_0xab49('0x216'),_0x570d71,_0x21a8e1));}};Dialer[_0xab49('0x1b')][_0xab49('0x66')]=function(_0x4f4d4c){if(_0x4f4d4c[_0xab49('0x210')]>0x0){var _0xc44667=_0x4f4d4c[_0xab49('0x210')]-_0x4f4d4c[_0xab49('0x84')]-_0x4f4d4c[_0xab49('0x14b')];if(_0xc44667>0x0&&_0x4f4d4c['temp']==0x0){this[_0xab49('0x217')](_0x4f4d4c);}else{loggerPredictiveCalls[_0xab49('0x4a')](_0xab49('0x218'));}}else{this[_0xab49('0x217')](_0x4f4d4c);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x4ce1c1){var _0x513c4e=this;var _0x22ec72=[];_0x4ce1c1[_0xab49('0x84')]+=0x1;for(var _0x1e8e2a in this['agents']){if(typeof this[_0xab49('0x21')][_0x1e8e2a]!=='undefined'){if(this[_0xab49('0x21')][_0x1e8e2a]['state']===_0xab49('0x211')&&this[_0xab49('0x21')][_0x1e8e2a][_0xab49('0x8d')]==='reachable'){_0x22ec72['push'](this[_0xab49('0x21')][_0x1e8e2a]['id']);}}}_0x4ce1c1['temp']=0x1;return this[_0xab49('0x212')](_0x4ce1c1['id'],_0x22ec72,0x1,_0x4ce1c1['dialOrderByScheduledAt'],_0x4ce1c1)[_0xab49('0xa2')](function(_0x2a08fd){_0x4ce1c1[_0xab49('0x6a')]=0x1;if(_0x2a08fd){if(!utils[_0xab49('0x208')](_0x2a08fd)){utils[_0xab49('0x69')](_0x4ce1c1,0x1,0x0);return hopperUtils[_0xab49('0x213')](_0x4ce1c1)['then'](sendMessageReschedule(_0x4ce1c1))[_0xab49('0xa6')](loggerCatch(_0xab49('0x214')));}else{_0x4ce1c1['message']=utils[_0xab49('0x7a')][_0xab49('0x20a')];if(_['isNil'](_0x2a08fd[0x0])||_[_0xab49('0x100')](_0x2a08fd[0x0][_0xab49('0x187')])||_[_0xab49('0x100')](_0x2a08fd[0x0][_0xab49('0x171')])){_0x513c4e['emptyContact'](_0xab49('0x20c'),_0x4ce1c1,_0x2a08fd[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xab49('0x78')](_0x2a08fd[0x0],[_0xab49('0xe9'),_0xab49('0x171')]))[_0xab49('0xa2')](_0x513c4e[_0xab49('0x1ef')](_0x4ce1c1,_0x2a08fd[0x0]))['catch'](_0x513c4e[_0xab49('0x163')](_0xab49('0x219'),_0x4ce1c1));}}}})[_0xab49('0xa6')](loggerGetContactDialer(_0xab49('0x21a'),_0x4ce1c1,0x1));};Dialer[_0xab49('0x1b')][_0xab49('0x1e4')]=function(_0x2d4cec,_0x2ef911,_0x21b012,_0x3616e8,_0xec4453,_0x1c4c57){loggerPredictive[_0xab49('0x4a')](_0xab49('0x21b'));loggerPredictive[_0xab49('0x4a')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d4cec);loggerPredictive[_0xab49('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ef911);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21b012);loggerPredictive[_0xab49('0x4a')](_0xab49('0x21c'),_0x3616e8);loggerPredictive[_0xab49('0x4a')](_0xab49('0x21d'),_0xec4453);loggerPredictive[_0xab49('0x4a')](_0xab49('0x56'));return new Promise(function(_0x6f8a60,_0x264052){if(_0x2d4cec<=0x0||isNaN(_0x2d4cec)){return _0x264052(msgResponse(_0xab49('0x21e'),_0xab49('0x8a'),'m\x20=\x20'+_0x2d4cec));}if(_0x21b012<=0x0||isNaN(_0x21b012)){return _0x264052(msgResponse(_0xab49('0x21e'),_0xab49('0x8a'),'Ts\x20=\x20'+_0x21b012));}if(_0x3616e8<=0x0||isNaN(_0x3616e8)){return _0x264052(msgResponse('[abandonmentRate]',_0xab49('0x8a'),_0xab49('0x21f')+_0x3616e8));}if(_0x2ef911<=0x0||isNaN(_0x2ef911)){return _0x264052(msgResponse(_0xab49('0x21e'),_0xab49('0x8a'),'interval\x20=\x20'+_0x2ef911));}if(_0xec4453<=0x0||isNaN(_0xec4453)){return _0x264052(msgResponse(_0xab49('0x21e'),_0xab49('0x8a'),'Amax\x20=\x20'+_0xec4453));}_0x1c4c57=_0x1c4c57||0x0;var _0x44345a=0x1/_0x21b012;var _0x5590b6=0x0;var _0x86b9fc=0x0;var _0x19e1fb=0x0;var _0x589a13=0x0;for(var _0x5900f9=0x0;_0x19e1fb<_0xec4453;_0x5900f9+=0x1){_0x86b9fc=_0x5900f9/_0x2ef911;_0x5590b6=(_0x3616e8*_0x86b9fc+_0x1c4c57)/_0x44345a;_0x19e1fb=utils[_0xab49('0x220')](_0x5590b6,_0x2d4cec);_0x589a13=_0x5590b6/_0x2d4cec*(0x1-utils[_0xab49('0x220')](_0x5590b6,_0x2d4cec));}return _0x6f8a60({'erlangCalls':_0x5900f9,'erlangCallToSecond':_0x2ef911/_0x5900f9,'erlangAbandonmentRate':_0x19e1fb,'erlangBusyFactor':_0x589a13});});};Dialer[_0xab49('0x1b')][_0xab49('0x1e6')]=function(_0x1533ea,_0xea7bfb,_0x4168d4,_0x4011d6,_0x12a9ed,_0x2df344){loggerPredictive[_0xab49('0x4a')](_0xab49('0x221'));loggerPredictive[_0xab49('0x4a')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1533ea);loggerPredictive[_0xab49('0x4a')](_0xab49('0x222'),_0xea7bfb);loggerPredictive[_0xab49('0x4a')](_0xab49('0x223'),_0x4168d4);loggerPredictive[_0xab49('0x4a')](_0xab49('0x21c'),_0x4011d6);loggerPredictive['info'](_0xab49('0x224'),_0x12a9ed);loggerPredictive['info'](_0xab49('0x56'));return new Promise(function(_0x1aff7a,_0x504f2f){if(_0x1533ea<=0x0||isNaN(_0x1533ea)){return _0x504f2f(msgResponse('[busyFactor]','Error',_0xab49('0x225')+_0x1533ea));}if(_0x4168d4<=0x0||isNaN(_0x4168d4)){return _0x504f2f(msgResponse(_0xab49('0x226'),_0xab49('0x8a'),_0xab49('0x227')+_0x4168d4));}if(_0x4011d6<=0x0||isNaN(_0x4011d6)){return _0x504f2f(msgResponse('[busyFactor]',_0xab49('0x8a'),_0xab49('0x21f')+_0x4011d6));}if(_0xea7bfb<=0x0||isNaN(_0xea7bfb)){return _0x504f2f(msgResponse(_0xab49('0x226'),'Error',_0xab49('0x228')+_0xea7bfb));}if(_0x12a9ed<=0x0||isNaN(_0x12a9ed)){return _0x504f2f(msgResponse(_0xab49('0x226'),_0xab49('0x8a'),_0xab49('0x229')+_0x12a9ed));}_0x2df344=_0x2df344||0x0;var _0x35a043=0x1/_0x4168d4;var _0x82266d=0x0;var _0x4b8334=0x0;var _0x5300f3=0x0;var _0x4e9fb5=0x0;for(var _0x364d3f=0x0;_0x4e9fb5<_0x12a9ed;_0x364d3f+=0x1){_0x4b8334=_0x364d3f/_0xea7bfb;_0x82266d=(_0x4011d6*_0x4b8334+_0x2df344)/_0x35a043;_0x5300f3=utils[_0xab49('0x220')](_0x82266d,_0x1533ea);_0x4e9fb5=_0x82266d/_0x1533ea*(0x1-utils[_0xab49('0x220')](_0x82266d,_0x1533ea));}return _0x1aff7a({'erlangCalls':_0x364d3f,'erlangCallToSecond':_0xea7bfb/_0x364d3f,'erlangAbandonmentRate':_0x5300f3,'erlangBusyFactor':_0x4e9fb5});});};module[_0xab49('0x22a')]=Dialer; \ No newline at end of file +var _0xb48d=['[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialMachineRetryFrequency','[syncHangupIvr]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','available','inUse','talking','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','checkPreviewRecallReminder','[actions]','clearZombieChannels','sequence','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:%s','user:dialPreviewRecallReminder','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','dialOriginateCallerIdName','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','dialPrefix','trim','dialCutDigit','substring','xcally-motion-dialer','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','erlangCalls','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalHitRate','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','RUNNING','[actionOriginate]\x20','checkIsBlackList','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','p\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','booked','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','finally','preview','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','originateresponse','syncOriginateResponse','agentcomplete','bind','custom:queuesummary','syncQueueSummaryComplete','syncHangup','syncNewExten','varset','queuemember','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','stringify','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','prototype','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','command','iftime\x20%s,%s','interval','then','indexOf','true','catch','Action','content','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','predictive','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','[ifTime][Action]','Error','voiceQueues','queue','uniqueId','uniqueid','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','callAdditionalPhoneAfterMin','verifyAdditionalPhones','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','swapAdditionalPhones','channel','syncQueueMember','actionid','rrmemory','isNil','stateinterface','locked','push','pick','idHopper','paused','syncQueueStatusComplete','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','Success','callProgressDetecting','syncVarSet','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','saveInDb'];(function(_0x49dda8,_0xe26b9e){var _0x53a9ef=function(_0x30792c){while(--_0x30792c){_0x49dda8['push'](_0x49dda8['shift']());}};_0x53a9ef(++_0xe26b9e);}(_0xb48d,0xfe));var _0xdb48=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb48d[_0x9cd4c3];return _0x4c9025;};'use strict';var util=require(_0xdb48('0x0'));var _=require(_0xdb48('0x1'));var uuid=require(_0xdb48('0x2'));var moment=require(_0xdb48('0x3'));var rr=require('rr');var Redis=require(_0xdb48('0x4'));var utils=require(_0xdb48('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0xdb48('0x6'));var config=require(_0xdb48('0x7'));var logger=require(_0xdb48('0x8'))('dialer');var loggerBooked=require(_0xdb48('0x8'))(_0xdb48('0x9'));var loggerPredictive=require(_0xdb48('0x8'))('predictive');var loggerPredictiveCalls=require(_0xdb48('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xdb48('0x8'))(_0xdb48('0xa'));var ami=require('../ami');config[_0xdb48('0xb')]=_['defaults'](config['redis'],{'host':_0xdb48('0xc'),'port':0x18eb});var io=require(_0xdb48('0xd'))(new Redis(config['redis']));var cmHopper=require(_0xdb48('0xe'));var voiceQueueRt=require(_0xdb48('0xf'));var RpcSetting=require(_0xdb48('0x10'));var Interval=require(_0xdb48('0x11'));var Action=require(_0xdb48('0x12'));var History=require(_0xdb48('0x13'));var Final=require(_0xdb48('0x14'));var AgentComplete=require(_0xdb48('0x15'));var QueueCallerAbandon=require(_0xdb48('0x16'));var Hangup=require(_0xdb48('0x17'));var ipAgi=process[_0xdb48('0x18')][_0xdb48('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xdb48('0x1a')]=function(_0x354169){this[_0xdb48('0x1b')]=this[_0xdb48('0x1b')]?this[_0xdb48('0x1b')][_0xdb48('0x1c')](_0x354169):_0x354169();};function Dialer(_0x12a296,_0x52bb30){this['sequence']=new Sequence();this[_0xdb48('0x1d')]=_0x52bb30;this['voiceQueues']=_0x12a296['voiceQueues'];this[_0xdb48('0x1e')]=_0x12a296[_0xdb48('0x1e')];this['agents']=_0x12a296[_0xdb48('0x1f')];this['trunks']=_0x12a296[_0xdb48('0x20')];this[_0xdb48('0x21')]=config[_0xdb48('0x21')]||0x2;this['channels']={};this[_0xdb48('0x22')]={};this[_0xdb48('0x23')]={};this['uniqueId']={};this[_0xdb48('0x24')]={};this['startPredictive']={};this[_0xdb48('0x25')]={};this[_0xdb48('0x26')]={};this[_0xdb48('0x27')]={};this[_0xdb48('0x28')]={};this['queuesSummary']={};ami['on'](_0xdb48('0x29'),this[_0xdb48('0x2a')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xdb48('0x2b'),this[_0xdb48('0x2c')]['bind'](this));ami['on'](_0xdb48('0x2d'),this['syncAgentComplete'][_0xdb48('0x2e')](this));ami['on'](_0xdb48('0x2f'),this[_0xdb48('0xa')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0xdb48('0x30')][_0xdb48('0x2e')](this));ami['on']('hangup',this[_0xdb48('0x31')][_0xdb48('0x2e')](this));ami['on']('newexten',this[_0xdb48('0x32')][_0xdb48('0x2e')](this));ami['on'](_0xdb48('0x33'),this['syncVarSet']['bind'](this));ami['on'](_0xdb48('0x34'),this['syncQueueMember'][_0xdb48('0x2e')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xdb48('0x2e')](this));this[_0xdb48('0x35')]();this[_0xdb48('0x36')]();RpcSetting[_0xdb48('0x37')]()['then'](function(_0x57c705){previewRecallmeReminderInterval=_0x57c705[_0xdb48('0x38')];});}function isNotNull(_0x2b8a12){return _0x2b8a12!==null&&!_[_0xdb48('0x39')](_0x2b8a12);}function msgResponse(_0x2e1fc7,_0x2f52b2,_0x3c8d74){return{'action':_0x2e1fc7,'response':_0x2f52b2,'message':_0x3c8d74,'stack':_0x3c8d74};}function emit(_0x3dbf84,_0x3cfc9d,_0x47a9fc){io['to'](_0x3dbf84)[_0xdb48('0x3a')](_0x3cfc9d,_0x47a9fc);}function emitOutboundVoiceQueueSummary(_0x31ddfa){if(_0x31ddfa['type']===_0xdb48('0x3b')){logger['debug'](_0xdb48('0x3c'),util[_0xdb48('0x3d')](_0x31ddfa,{'showHidden':![],'depth':null}));emit(util[_0xdb48('0x3e')]('voice:queue:%s',_0x31ddfa[_0xdb48('0x3f')]),_0xdb48('0x40'),_0x31ddfa);}}function checkGetDataPredictive(_0x30d12b){if(isNotNull(_0x30d12b)&&!_[_0xdb48('0x41')](_0x30d12b)){loggerPredictive[_0xdb48('0x42')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xdb48('0x42')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30d12b[_0xdb48('0x43')]);loggerPredictive[_0xdb48('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30d12b[_0xdb48('0x44')]);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x45'),_0x30d12b[_0xdb48('0x46')]);loggerPredictive['info'](_0xdb48('0x47'),_0x30d12b[_0xdb48('0x48')]);loggerPredictive[_0xdb48('0x42')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30d12b[_0xdb48('0x49')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30d12b['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xdb48('0x4a'));if(_0x30d12b[_0xdb48('0x43')]>0x0){if(!_['isUndefined'](_0x30d12b['predictiveIntervalAvgTalktime'])&&_0x30d12b[_0xdb48('0x4b')]>0x0){return!![];}loggerPredictive[_0xdb48('0x42')](_0xdb48('0x4c'));if(!_[_0xdb48('0x39')](_0x30d12b[_0xdb48('0x49')])&&_0x30d12b[_0xdb48('0x49')]>0x0){return!![];}loggerPredictive[_0xdb48('0x42')](_0xdb48('0x4d'));}else{loggerPredictive[_0xdb48('0x42')](_0xdb48('0x4e'));}}else{loggerPredictive[_0xdb48('0x42')](_0xdb48('0x4f'));}return![];}function mergeDataErlangB(_0x565004){return function(_0x5d1087){loggerPredictive[_0xdb48('0x42')](_0xdb48('0x50'));loggerPredictive[_0xdb48('0x42')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d1087['erlangCalls']);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x51'),_0x5d1087[_0xdb48('0x52')]);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x53'),_0x5d1087[_0xdb48('0x54')]);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x55'),_0x5d1087['erlangBusyFactor']);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x53'),_0x5d1087[_0xdb48('0x54')]);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x4a'));_[_0xdb48('0x56')](_0x565004,_0x5d1087);};}function ifInterval(_0x543a6e,_0x3dc59e){if(_[_0xdb48('0x39')](_0x3dc59e)){return![];}return utils['getSeconds'](undefined,_0x3dc59e)<_0x543a6e*0x3c;}function clearPredictiveAttributes(_0x262f94){if(_0x262f94[_0xdb48('0x25')]){_0x262f94[_0xdb48('0x25')]=undefined;loggerPredictive[_0xdb48('0x57')](_0x262f94['name'],_0xdb48('0x58'));}if(_0x262f94['startPredictive']){_0x262f94[_0xdb48('0x59')]=undefined;loggerPredictive['debug'](_0x262f94['name'],_0xdb48('0x5a'));}if(_0x262f94[_0xdb48('0x5b')]){clearInterval(_0x262f94[_0xdb48('0x5b')]);_0x262f94[_0xdb48('0x5b')]=undefined;loggerPredictive[_0xdb48('0x57')](_0x262f94[_0xdb48('0x3f')],_0xdb48('0x5c'));}}function loggerCatchPredictive(_0xd8b49a,_0x532e96){return function(_0x39681f){loggerPredictive['error'](_0x532e96[_0xdb48('0x3f')],_0xd8b49a);loggerPredictive[_0xdb48('0x5d')](_0x39681f[_0xdb48('0x5e')]);clearPredictiveAttributes(_0x532e96);};}function loggerCatch(_0x50b54a){return function(_0x4e7001){logger[_0xdb48('0x5d')](_0x50b54a,util[_0xdb48('0x3d')](_0x4e7001,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xae195f,_0xa32f14,_0x38adc6){return function(_0x2ed102){utils[_0xdb48('0x5f')](_0xa32f14,_0x38adc6,0x0);_0xa32f14[_0xdb48('0x60')]=0x0;logger[_0xdb48('0x5d')](_0xae195f,util['inspect'](_0x2ed102,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x104952){return function(_0x2d89c0){if(isNotNull(_0x2d89c0)&&isNotNull(_0x2d89c0[0x0])){if(_0x2d89c0[0x0][_0xdb48('0x61')]>0x0){_0x104952[_0xdb48('0x62')]=utils[_0xdb48('0x63')]['CONTACTS_RESCHEDULED'];logger['info'](_0xdb48('0x64')+_0x104952[_0xdb48('0x3f')],_0x2d89c0[0x0]['contactsRescheduled'],_0xdb48('0x65'));}else{_0x104952[_0xdb48('0x62')]=utils[_0xdb48('0x63')][_0xdb48('0x66')];logger[_0xdb48('0x42')](_0xdb48('0x67')+_0x104952[_0xdb48('0x3f')]);}}};}function createObjHistory(_0x4b0d5b,_0x2d77e5,_0x1f7d25,_0x42bfdf,_0x5cdfe3){_0x4b0d5b[_0xdb48('0x62')]=_0x1f7d25;var _0x127c93=new Action(_0x4b0d5b,_0x2d77e5);var _0x36cbaf=new History(_0x127c93);_0x36cbaf[_0xdb48('0x68')]=_0x42bfdf;_0x36cbaf[_0xdb48('0x69')]=_0x5cdfe3;_0x36cbaf[_0xdb48('0x6a')]=_0x127c93[_0xdb48('0x6b')];return _0x36cbaf;}function unlockQueueStatus(_0x50f97c,_0x171c82){setTimeout(function(){if(_[_0xdb48('0x39')](_0x50f97c[_0xdb48('0x6c')])){loggerBooked[_0xdb48('0x5d')](_0xdb48('0x6d'),_0x171c82);}_0x50f97c[_0xdb48('0x6c')]=!![];loggerBooked[_0xdb48('0x42')](_0xdb48('0x6e'),_0x171c82,JSON['stringify'](_['pick'](_0x50f97c,[_0xdb48('0x3f'),_0xdb48('0x6c')])));},0x1f3);}function checkInterval(_0x5ca2ae){return function(){if(!isNotNull(_0x5ca2ae['Interval'])){_0x5ca2ae[_0xdb48('0x62')]=utils['CAMPAIGN_STATUS'][_0xdb48('0x6f')];throw _0x5ca2ae[_0xdb48('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x5ca2ae[_0xdb48('0x70')][_0xdb48('0x71')])){_0x5ca2ae['message']=utils[_0xdb48('0x63')][_0xdb48('0x6f')];throw _0x5ca2ae[_0xdb48('0x3f')]+_0xdb48('0x72');}if(!isNotNull(_[_0xdb48('0x41')](_0x5ca2ae[_0xdb48('0x70')]['Intervals']))){_0x5ca2ae['message']=utils[_0xdb48('0x63')]['NULL_INTERVAL'];throw _0x5ca2ae[_0xdb48('0x3f')]+_0xdb48('0x72');}};}function checkIsIVRCampaignActive(_0x588c46){return function(){if(!utils['isIVRCampaignActive'](_0x588c46)){_0x588c46[_0xdb48('0x62')]=utils['CAMPAIGN_STATUS'][_0xdb48('0x73')];throw _0x588c46['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x120d70){if(utils[_0xdb48('0x74')](_0x120d70)){emit(util[_0xdb48('0x3e')](_0xdb48('0x75'),_0x120d70[_0xdb48('0x3f')]),_0xdb48('0x76'),_0x120d70);}}function loggerCatchQueueSummary(_0x3f5db7,_0x343306){return function(_0x55aba0){clearPredictiveAttributes(_0x343306);emitCampaignSummary(_0x343306);loggerSyncQueueSummary[_0xdb48('0x57')](_0x3f5db7,util[_0xdb48('0x3d')](_0x55aba0,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xbb47c7){if(_0xbb47c7['sendMessageOneNotActive']){if(_0xbb47c7[_0xdb48('0x77')]===0x0){_0xbb47c7[_0xdb48('0x78')]=![];_0xbb47c7['message']=utils[_0xdb48('0x63')]['INACTIVE'];loggerSyncQueueSummary[_0xdb48('0x57')](_0xdb48('0x79'),_0xbb47c7[_0xdb48('0x3f')],_0xdb48('0x7a'));}else{_0xbb47c7[_0xdb48('0x62')]=utils[_0xdb48('0x63')]['DISACTIVED'];loggerSyncQueueSummary[_0xdb48('0x57')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xbb47c7[_0xdb48('0x3f')],_0xdb48('0x7b'));}emitCampaignSummary(_0xbb47c7);}}function myreject(_0x5330e1){return function(_0x21af88){return _0x5330e1(msgResponse('[ifTime][Action]','Error',JSON[_0xdb48('0x7c')](_0x21af88)));};}Dialer['prototype'][_0xdb48('0x7d')]=function(_0x5d24b6){return!_[_0xdb48('0x39')](_0x5d24b6)&&_0x5d24b6&&!_[_0xdb48('0x39')](_0x5d24b6['name'])&&!_[_0xdb48('0x39')](_0x5d24b6[_0xdb48('0x7e')])&&_0x5d24b6[_0xdb48('0x7e')]&&(this[_0xdb48('0x20')][util[_0xdb48('0x3e')](_0xdb48('0x7f'),_0x5d24b6[_0xdb48('0x3f')])][_0xdb48('0x80')]==='reachable'||this['trunks'][util[_0xdb48('0x3e')](_0xdb48('0x7f'),_0x5d24b6[_0xdb48('0x3f')])][_0xdb48('0x80')]===_0xdb48('0x81'));};Dialer['prototype'][_0xdb48('0x82')]=function(_0x2c2df4){var _0x2b4218=this;return function(){if(!_0x2b4218['isTrunkReachable'](_0x2c2df4[_0xdb48('0x83')])){if(!_0x2b4218['isTrunkReachable'](_0x2c2df4['TrunkBackup'])){_0x2c2df4['message']=utils[_0xdb48('0x63')][_0xdb48('0x84')];throw _0x2c2df4['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xdb48('0x85')][_0xdb48('0x86')]=function(_0x382827,_0x5eac43,_0x2352c5,_0x1bc06d){var _0x5607a3=this;return function(){var _0x4bd9d3=!![];return _0x5607a3['ifTimeIvr'](_0x382827,_0x5eac43,_0x2352c5,_0x1bc06d,_0x4bd9d3);};};Dialer[_0xdb48('0x85')][_0xdb48('0x87')]=function(_0x22b6c5,_0x2deb86,_0x458372,_0x2b70cc){var _0x22aa57=this;return function(){var _0x3b7ef7=![];return _0x22aa57[_0xdb48('0x88')](_0x22b6c5[_0xdb48('0x71')],_0x2deb86,_0x458372,_0x2b70cc,_0x3b7ef7);};};Dialer['prototype'][_0xdb48('0x88')]=function(_0x32b07a,_0x37a12,_0x5046a1,_0x2e7893,_0x1e5096){var _0x2f70a4=[];return new Promise(function(_0xa71082,_0x3eea84){if(!isNotNull(_0x32b07a)){_0x2e7893[_0xdb48('0x62')]=utils[_0xdb48('0x63')][_0xdb48('0x6f')];return _0x3eea84(msgResponse(_0xdb48('0x89'),_0xdb48('0x8a'),_0x5046a1+_0xdb48('0x8b')));}if(_[_0xdb48('0x41')](_0x32b07a)){_0x2e7893[_0xdb48('0x62')]=utils[_0xdb48('0x63')][_0xdb48('0x8c')];return _0x3eea84(msgResponse(_0xdb48('0x89'),_0xdb48('0x8a'),_0x5046a1+_0xdb48('0x8d')));}if(_0x37a12&&_[_0xdb48('0x39')](config[_0xdb48('0x8e')][_0x37a12])){_0x2e7893[_0xdb48('0x62')]=utils[_0xdb48('0x63')][_0xdb48('0x8f')];return _0x3eea84(msgResponse(_0xdb48('0x89'),_0xdb48('0x8a'),_0x5046a1+_0xdb48('0x90')+_0x37a12));}if(_['isArray'](_0x32b07a)){for(var _0x5913c2=0x0;_0x5913c2<_0x32b07a[_0xdb48('0x91')];_0x5913c2+=0x1){_0x2f70a4['push'](ami['Action']({'action':_0xdb48('0x92'),'command':util['format'](_0xdb48('0x93'),_0x32b07a[_0x5913c2][_0xdb48('0x94')],!_[_0xdb48('0x39')](config['timezones'][_0x37a12])?_0x37a12:'')})[_0xdb48('0x95')](function(_0x4f13ad){return _0x4f13ad['content'][_0xdb48('0x96')](_0xdb48('0x97'))>=0x0;})[_0xdb48('0x98')](myreject(_0x3eea84)));}}else{_0x2f70a4['push'](ami[_0xdb48('0x99')]({'action':_0xdb48('0x92'),'command':util[_0xdb48('0x3e')](_0xdb48('0x93'),_0x32b07a,!_[_0xdb48('0x39')](config['timezones'][_0x37a12])?_0x37a12:'')})[_0xdb48('0x95')](function(_0x254a72){return _0x254a72[_0xdb48('0x9a')][_0xdb48('0x96')](_0xdb48('0x97'))>=0x0;})['catch'](myreject(_0x3eea84)));}Promise[_0xdb48('0x9b')](_0x2f70a4)[_0xdb48('0x95')](function(_0x280b1c){var _0x72bd3d=_['some'](_0x280b1c);if(_0x72bd3d){return _0xa71082(_0x72bd3d);}else{_0x2e7893[_0xdb48('0x62')]=_0x1e5096?utils[_0xdb48('0x63')][_0xdb48('0x9c')]:utils[_0xdb48('0x63')][_0xdb48('0x9d')];return _0x3eea84(msgResponse('[ifTime][promiseAll]',_0xdb48('0x8a'),'Global:\x20'+_0x1e5096+'\x20'+_0x5046a1+_0xdb48('0x9e')+util[_0xdb48('0x3d')](_0x32b07a,{'showHidden':![],'depth':null})+_0xdb48('0x9f')+_0x37a12));}})[_0xdb48('0x98')](function(_0x4021e2){return _0x3eea84(msgResponse(_0xdb48('0x89'),_0xdb48('0x8a'),JSON['stringify'](_0x4021e2)));});});};Dialer[_0xdb48('0x85')][_0xdb48('0x35')]=function(){var _0x4318c7=this;return cmHopper[_0xdb48('0xa0')]({'active':![]},{'where':{'active':!![]}})[_0xdb48('0x95')](function(){setInterval(function(){_0x4318c7[_0xdb48('0xa1')]();},0x3e8);});};Dialer[_0xdb48('0x85')][_0xdb48('0xa1')]=function(){var _0x538e17=this;var _0x4b1290;for(var _0x12c77a in this[_0xdb48('0x1e')]){if(typeof this['campaigns'][_0x12c77a]!==_0xdb48('0xa2')){_0x4b1290=this[_0xdb48('0x1e')][_0x12c77a];if(utils['isIVRCampaign'](_0x4b1290)&&utils[_0xdb48('0xa3')](_0x4b1290)){_0x4b1290[_0xdb48('0x78')]=!![];Promise[_0xdb48('0xa4')]()['then'](checkIsIVRCampaignActive(_0x4b1290))['then'](checkInterval(_0x4b1290))['then'](_0x538e17[_0xdb48('0x82')](_0x4b1290))[_0xdb48('0x95')](_0x538e17[_0xdb48('0x86')](_0x4b1290[_0xdb48('0xa5')],_0x4b1290['dialTimezone'],_0x4b1290['name'],_0x4b1290))[_0xdb48('0x95')](_0x538e17[_0xdb48('0x87')](_0x4b1290[_0xdb48('0x70')],_0x4b1290[_0xdb48('0xa6')],_0x4b1290['name'],_0x4b1290))[_0xdb48('0x95')](_0x538e17[_0xdb48('0xa7')](_0x4b1290))[_0xdb48('0x98')](loggerCatchQueueSummary(_0xdb48('0xa8'),_0x4b1290));}else{notSendMessagesCampaign(_0x4b1290);}}}};Dialer['prototype'][_0xdb48('0xa9')]=function(_0x12fb3c){if(_0x12fb3c['dialMethod']!==_0xdb48('0xaa')){clearPredictiveAttributes(_0x12fb3c);}switch(_0x12fb3c[_0xdb48('0xab')]){case _0xdb48('0xac'):this[_0xdb48('0xad')](_0x12fb3c,0x1);break;case _0xdb48('0xae'):this['handlePower'](_0x12fb3c,_0x12fb3c[_0xdb48('0xaf')]);break;case _0xdb48('0xaa'):this['predictive'](_0x12fb3c);break;case _0xdb48('0x9'):this[_0xdb48('0xad')](_0x12fb3c,0x1);break;default:logger['error'](_0xdb48('0xb0'),_0x12fb3c[_0xdb48('0x3f')],_0xdb48('0xb1'));}};Dialer[_0xdb48('0x85')][_0xdb48('0x89')]=function(_0x88447d,_0x125952){var _0x30e2fd=_0x88447d[_0xdb48('0xa6')];var _0x4ab782=_0x125952?_0x88447d['dialGlobalInterval']:_0x88447d['Interval']['Intervals'];logger[_0xdb48('0xb2')]('Dialer::ifTime()',_0x4ab782,_0x30e2fd,_0x88447d[_0xdb48('0x3f')],util['format'](_0xdb48('0xb3'),_0x88447d[_0xdb48('0x3f')],_0x88447d['id']));var _0x5adfea=null;return Interval[_0xdb48('0xb4')](_0x4ab782,_0x30e2fd)[_0xdb48('0x95')](function(_0x513158){if(_0x513158===!![]){return _0x513158;}else{_0x88447d[_0xdb48('0x62')]=_0x125952?utils[_0xdb48('0x63')][_0xdb48('0x9c')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x5adfea=msgResponse(_0xdb48('0xb5'),_0xdb48('0x8a'),'Global:\x20'+_0x125952+'\x20'+_0x88447d['name']+_0xdb48('0x9e')+util['inspect'](_0x4ab782,{'showHidden':![],'depth':null})+_0xdb48('0x9f')+_0x30e2fd);}if(_0x5adfea!==null){logger[_0xdb48('0xb2')](_0xdb48('0xb6'),_0x5adfea);_0x5adfea['isGlobal']=_0x125952;throw _0x5adfea;}})[_0xdb48('0x98')](function(_0x125764){logger[_0xdb48('0x5d')](_0xdb48('0xb7'),_0x125764);throw msgResponse(_0xdb48('0xb8'),_0xdb48('0xb9'),util[_0xdb48('0x3d')](_0x125764,{'showHidden':![],'depth':null}));});};Dialer[_0xdb48('0x85')][_0xdb48('0x2a')]=function(_0x33f9b8){if(this[_0xdb48('0xba')][_0x33f9b8[_0xdb48('0xbb')]]){if(this[_0xdb48('0xbc')][_0x33f9b8[_0xdb48('0xbd')]]&&this[_0xdb48('0xbc')][_0x33f9b8[_0xdb48('0xbd')]][_0xdb48('0xbe')]!==_0xdb48('0xbf')){this[_0xdb48('0xc0')](this[_0xdb48('0xba')][_0x33f9b8[_0xdb48('0xbb')]]);this[_0xdb48('0xbc')][_0x33f9b8[_0xdb48('0xbd')]][_0xdb48('0xc1')]=moment()[_0xdb48('0x3e')](_0xdb48('0xc2'));}}};Dialer[_0xdb48('0x85')][_0xdb48('0xc3')]=function(_0x19493f){var _0x4e68f0=this['uniqueId'][_0x19493f['uniqueid']];if(this[_0xdb48('0xba')][_0x19493f[_0xdb48('0xbb')]]){if(_0x4e68f0&&_0x4e68f0['type']!==_0xdb48('0xbf')){delete this[_0xdb48('0xbc')][_0x19493f[_0xdb48('0xbd')]];this[_0xdb48('0xba')][_0x19493f[_0xdb48('0xbb')]][_0xdb48('0xc4')]+=0x1;var _0x3ba09c=new AgentComplete(_0x4e68f0,_0x19493f);if(_0x19493f[_0xdb48('0xc5')]===_0xdb48('0xc6')){_0x3ba09c[_0xdb48('0xc7')]=this['voiceQueues'][_0x19493f['queue']]['dialQueueProject2']&&this[_0xdb48('0xba')][_0x19493f['queue']][_0xdb48('0xc8')]?moment()['format'](_0xdb48('0xc2')):undefined;}hopperUtils['createHistory'](_0x3ba09c)[_0xdb48('0x98')](loggerCatch(_0xdb48('0xc9')));hopperUtils[_0xdb48('0xca')](_0x3ba09c)[_0xdb48('0x98')](loggerCatch(_0xdb48('0xcb')));}}};Dialer[_0xdb48('0x85')][_0xdb48('0xcc')]=function(_0x3b4dca){var _0xacdd28=this[_0xdb48('0xbc')][_0x3b4dca[_0xdb48('0xbd')]];var _0x273b14=this;var _0x113ed5=![];var _0x4830ce;var _0x1ba3e3;if(this['voiceQueues'][_0x3b4dca['queue']]){if(_0xacdd28&&_0xacdd28[_0xdb48('0xbe')]!=='ivr'){delete this[_0xdb48('0xbc')][_0x3b4dca[_0xdb48('0xbd')]];this[_0xdb48('0xc0')](this['voiceQueues'][_0x3b4dca[_0xdb48('0xbb')]]);_0xacdd28[_0xdb48('0xcd')]=moment()[_0xdb48('0x3e')](_0xdb48('0xc2'));var _0x557f38=new QueueCallerAbandon(_0xacdd28,_0x3b4dca);if(utils[_0xdb48('0xce')](_0xacdd28[_0xdb48('0xcd')],_0xacdd28[_0xdb48('0xcf')])>=_0xacdd28[_0xdb48('0xd0')]){this[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]][_0xdb48('0x46')]+=0x1;this[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]][_0xdb48('0xd1')]+=0x1;this[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]][_0xdb48('0xd2')]+=0x1;_0x557f38[_0xdb48('0x68')]=0xa;_0x557f38[_0xdb48('0x69')]=_0xdb48('0xd3');_0x557f38[_0xdb48('0xd4')]=_0xdb48('0xd5');_0x557f38['agiafterat']=this[_0xdb48('0xba')][_0x3b4dca['queue']][_0xdb48('0xd6')]?moment()[_0xdb48('0x3e')](_0xdb48('0xc2')):undefined;_0x557f38[_0xdb48('0xd7')]+=0x1;_0x557f38[_0xdb48('0xd8')]+=0x1;_0x4830ce=this[_0xdb48('0xba')][_0x3b4dca['queue']][_0xdb48('0xd9')];_0x1ba3e3=this[_0xdb48('0xba')][_0x3b4dca['queue']]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x557f38,_0x557f38[_0xdb48('0x68')],_0xacdd28[_0xdb48('0xda')])[_0xdb48('0x95')](function(_0x21c3e6){_0x113ed5=_0x21c3e6[_0xdb48('0xdb')]==0x1;if(_0x557f38[_0xdb48('0xd7')]>=_0x273b14[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]][_0xdb48('0xdc')]){_0x273b14[_0xdb48('0xdd')](_0x557f38,_0x21c3e6[_0xdb48('0xdb')]);}else{hopperUtils[_0xdb48('0xde')]({'active':![],'countdropretry':_0x557f38[_0xdb48('0xd7')],'scheduledat':moment()['add'](_0x273b14[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]][_0xdb48('0xd9')],_0xdb48('0xdf'))[_0xdb48('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xacdd28[_0xdb48('0xe0')],'ListId':_0xacdd28[_0xdb48('0xe1')],'VoiceQueueId':_0xacdd28[_0xdb48('0xe2')]||undefined,'CampaignId':_0xacdd28[_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0xe4')));var _0xf8ffc1=new History(_0x557f38);_0xf8ffc1['state']=0xa;_0xf8ffc1['statedesc']=_0xdb48('0xd3');_0xf8ffc1['starttime']=moment()[_0xdb48('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0xf8ffc1[_0xdb48('0x6a')]=_0xf8ffc1[_0xdb48('0x6b')];_0xf8ffc1['calleridname']=_0x557f38['calleridname'];_0xf8ffc1['calleridnum']=_0x557f38[_0xdb48('0xe5')];hopperUtils[_0xdb48('0xe6')](_0xf8ffc1)['catch'](loggerCatch(_0xdb48('0xe7')));}})['then'](function(){if(_0x113ed5)hopperUtils['swapAdditionalPhones'](_0x557f38,_0x4830ce,_0x1ba3e3)[_0xdb48('0x95')](function(){return 0x1;});});}else{this[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]][_0xdb48('0x48')]+=0x1;this[_0xdb48('0xba')][_0x3b4dca['queue']][_0xdb48('0xe8')]+=0x1;_0x557f38[_0xdb48('0x68')]=0xb;_0x557f38['statedesc']=_0xdb48('0xe9');_0x557f38['dropreason']=_0xdb48('0xea');_0x557f38[_0xdb48('0xeb')]+=0x1;_0x557f38[_0xdb48('0xd8')]+=0x1;_0x4830ce=this[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]]['dialAbandonedRetryFrequency'];_0x1ba3e3=this[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]][_0xdb48('0xec')];hopperUtils[_0xdb48('0xed')](_0x557f38,_0x557f38[_0xdb48('0x68')],_0xacdd28[_0xdb48('0xda')])['then'](function(_0x3d6e6b){if(_0x557f38['countabandonedretry']>=_0x273b14[_0xdb48('0xba')][_0x3b4dca['queue']]['dialAbandonedMaxRetry']){_0x273b14[_0xdb48('0xdd')](_0x557f38,_0x3d6e6b['additional']);}else{hopperUtils[_0xdb48('0xde')]({'active':![],'countabandonedretry':_0x557f38['countabandonedretry'],'scheduledat':moment()['add'](_0x273b14[_0xdb48('0xba')][_0x3b4dca[_0xdb48('0xbb')]][_0xdb48('0xee')],_0xdb48('0xdf'))[_0xdb48('0x3e')](_0xdb48('0xc2')),'ContactId':_0xacdd28[_0xdb48('0xe0')],'ListId':_0xacdd28[_0xdb48('0xe1')],'VoiceQueueId':_0xacdd28['VoiceQueueId']||undefined,'CampaignId':_0xacdd28['CampaignId']||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0xef')));var _0x53a365=new History(_0x557f38);_0x53a365[_0xdb48('0x68')]=0xb;_0x53a365[_0xdb48('0x69')]='Abandoned';_0x53a365[_0xdb48('0x6b')]=moment()[_0xdb48('0x3e')](_0xdb48('0xc2'));_0x53a365[_0xdb48('0x6a')]=_0x53a365[_0xdb48('0x6b')];_0x53a365[_0xdb48('0xf0')]=_0x557f38[_0xdb48('0xf0')];_0x53a365[_0xdb48('0xe5')]=_0x557f38['calleridnum'];hopperUtils[_0xdb48('0xe6')](_0x53a365)[_0xdb48('0x98')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xdb48('0x95')](function(){if(_0x113ed5)hopperUtils[_0xdb48('0xf1')](_0x557f38,_0x4830ce,_0x1ba3e3)[_0xdb48('0x95')](function(){return 0x1;});});}}}};Dialer[_0xdb48('0x85')][_0xdb48('0x32')]=function(_0x5800b6){if(this['actions'][_0x5800b6[_0xdb48('0xbd')]]){this[_0xdb48('0x22')][_0x5800b6[_0xdb48('0xbd')]][_0xdb48('0xf2')]=_0x5800b6[_0xdb48('0xf2')];}if(this[_0xdb48('0xbc')][_0x5800b6[_0xdb48('0xbd')]]){this[_0xdb48('0xbc')][_0x5800b6[_0xdb48('0xbd')]][_0xdb48('0xf2')]=_0x5800b6['channel'];}};Dialer[_0xdb48('0x85')][_0xdb48('0xf3')]=function(_0x328d33){if(!this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]]){return;}var _0x14f178=this[_0xdb48('0xba')][this[_0xdb48('0x22')][_0x328d33['actionid']][_0xdb48('0xbb')]]['strategy']||_0xdb48('0xf5');if(_0x14f178==='roundrobin'){if(this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]]&&_[_0xdb48('0xf6')](this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]]['locked'])&&_0x328d33[_0xdb48('0x80')]==='1'&&_0x328d33['paused']==='0'){if(this['agents'][_0x328d33[_0xdb48('0xf7')]]){if(!this[_0xdb48('0x1f')][_0x328d33[_0xdb48('0xf7')]][_0xdb48('0xf8')]){this[_0xdb48('0x1f')][_0x328d33[_0xdb48('0xf7')]]['locked']=!![];this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]][_0xdb48('0xf8')]=!![];this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]]['stateinterface']=_0x328d33[_0xdb48('0xf7')];}}}}else if(_0x14f178===_0xdb48('0xf5')){if(this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]]){if(this['agents'][_0x328d33[_0xdb48('0xf7')]]){this['actions'][_0x328d33['actionid']][_0xdb48('0xf7')]=_0x328d33['stateinterface'];if(_[_0xdb48('0xf6')](this[_0xdb48('0x27')][this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]][_0xdb48('0xbb')]])){this[_0xdb48('0x27')][this['actions'][_0x328d33[_0xdb48('0xf4')]][_0xdb48('0xbb')]]=[];}this[_0xdb48('0x27')][this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]][_0xdb48('0xbb')]][_0xdb48('0xf9')](_[_0xdb48('0x56')](_[_0xdb48('0xfa')](this[_0xdb48('0x22')][_0x328d33[_0xdb48('0xf4')]],[_0xdb48('0xfb'),_0xdb48('0xf7')]),{'status':_0x328d33[_0xdb48('0x80')],'paused':_0x328d33[_0xdb48('0xfc')]}));}}}};Dialer['prototype'][_0xdb48('0xfd')]=function(_0x2ad59c){if(!this['actions'][_0x2ad59c[_0xdb48('0xf4')]]){return;}var _0x38992a=this;var _0x2d1533=this['voiceQueues'][this[_0xdb48('0x22')][_0x2ad59c['actionid']][_0xdb48('0xbb')]];var _0x16164f=_0x2d1533['strategy']||_0xdb48('0xf5');if(_0x16164f===_0xdb48('0xfe')){if(this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]]&&this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]]['stateinterface']){this[_0xdb48('0x1d')][_0xdb48('0xff')](this['actions'][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xfb')],this['actions'][_0x2ad59c[_0xdb48('0xf4')]]['stateinterface'])[_0xdb48('0x98')](function(_0x4579b2){logger[_0xdb48('0x5d')](_0xdb48('0x100'),util[_0xdb48('0x3d')](_0x4579b2,{'showHidden':![],'depth':null}));})[_0xdb48('0x1c')](function(){_0x38992a['updateOriginated'](_0x38992a[_0xdb48('0xba')][_0x38992a[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xbb')]]);_0x38992a['agents'][_0x38992a[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]]['stateinterface']][_0xdb48('0xf8')]=![];delete _0x38992a[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]];unlockQueueStatus(_0x2d1533);});}else{this[_0xdb48('0xc0')](this[_0xdb48('0xba')][this[_0xdb48('0x22')][_0x2ad59c['actionid']][_0xdb48('0xbb')]]);hopperUtils[_0xdb48('0xde')]({'active':![],'ContactId':this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xe0')],'ListId':this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xe1')],'VoiceQueueId':this[_0xdb48('0x22')][_0x2ad59c['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x101')));delete this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]];unlockQueueStatus(_0x2d1533);}}else if(_0x16164f===_0xdb48('0xf5')){var _0xfbb3d2;if(this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]]&&!_['isEmpty'](this[_0xdb48('0x27')][this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xbb')]])){if(this[_0xdb48('0x28')][_0x38992a['actions'][_0x2ad59c[_0xdb48('0xf4')]]['queue']]){this[_0xdb48('0x28')][_0x38992a[_0xdb48('0x22')][_0x2ad59c['actionid']][_0xdb48('0xbb')]]=this[_0xdb48('0x28')][this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xbb')]]?this[_0xdb48('0x28')][this[_0xdb48('0x22')][_0x2ad59c['actionid']][_0xdb48('0xbb')]]:this[_0xdb48('0x27')][this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xbb')]]?this[_0xdb48('0x27')][this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]]['queue']][_0xdb48('0x102')]||0x0:0x0;}this['queueBooked'][this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]][_0xdb48('0xbb')]][_0xdb48('0x102')]=this[_0xdb48('0x28')][this[_0xdb48('0x22')][_0x2ad59c[_0xdb48('0xf4')]]['queue']];for(var _0x3e6f99=0x0;_0x3e6f99=_0x41d052[_0xdb48('0x128')]){_0x372d83['stateGlobal'](_0x49a169,_0x4f2aee,_0x24f287,_0xdb48('0x129'));}else{if(_0x49a169['countmachineretry']>=_0x41d052['dialMachineMaxRetry']){_0x372d83[_0xdb48('0x12a')](_0x49a169,_0x4f2aee,_0x24f287,_0xdb48('0x12b'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x49a169[_0xdb48('0x121')],'scheduledat':moment()[_0xdb48('0x12c')](_0x41d052['dialMachineRetryFrequency'],_0xdb48('0xdf'))[_0xdb48('0x3e')](_0xdb48('0xc2')),'ContactId':_0x49a169[_0xdb48('0xe0')],'ListId':_0x49a169[_0xdb48('0xe1')],'VoiceQueueId':_0x49a169[_0xdb48('0xe2')]||undefined,'CampaignId':_0x49a169[_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x12d')));_0x4f2aee({'reschedule':0x1});}}});}if(_0x3e3a57[_0xdb48('0xbe')]===_0xdb48('0xbf')&&this['campaigns'][_0x3e3a57[_0xdb48('0xbb')]]['dialAMDActive']&&_0x4c5f58[_0xdb48('0x115')]===_0xdb48('0x116')){delete this[_0xdb48('0xbc')][_0x4c5f58[_0xdb48('0xbd')]];this[_0xdb48('0xc0')](this[_0xdb48('0x1e')][_0x3e3a57[_0xdb48('0xbb')]]);_0x1031ff=new Hangup(_0x3e3a57,_0x4c5f58);_0x1031ff[_0xdb48('0x68')]=0x12;_0x1031ff[_0xdb48('0x69')]='HangupInAMD';_0x1031ff[_0xdb48('0x118')]='AMD';ami[_0xdb48('0x3a')](_0xdb48('0x11a'),ut[_0xdb48('0x11b')](_0x1031ff,'amd'));this[_0xdb48('0x11c')](_0x1031ff,_0xdb48('0x12e'),_0xdb48('0x12f'));}if(_0x3e3a57['type']===_0xdb48('0xbf')&&this[_0xdb48('0x1e')][_0x3e3a57[_0xdb48('0xbb')]][_0xdb48('0x114')]&&_0x4c5f58[_0xdb48('0x115')]===_0xdb48('0x11f')){return new Promise(function(_0x10fcb5,_0x26356a){delete _0x372d83[_0xdb48('0xbc')][_0x4c5f58[_0xdb48('0xbd')]];_0x372d83[_0xdb48('0xc0')](_0x372d83[_0xdb48('0x1e')][_0x3e3a57[_0xdb48('0xbb')]]);_0x372d83[_0xdb48('0x1e')][_0x3e3a57[_0xdb48('0xbb')]][_0xdb48('0xc4')]+=0x1;_0x372d83[_0xdb48('0x1e')][_0x3e3a57[_0xdb48('0xbb')]][_0xdb48('0x117')]+=0x1;var _0x39035a=_0x372d83['campaigns'][_0x3e3a57['queue']];var _0x173427=new Hangup(_0x3e3a57,_0x4c5f58);_0x173427[_0xdb48('0x68')]=0x13;_0x173427[_0xdb48('0x69')]='Machine';_0x173427[_0xdb48('0x118')]=_0xdb48('0x119');_0x173427[_0xdb48('0x121')]+=0x1;_0x173427[_0xdb48('0xd8')]+=0x1;_0x173427['amd']=!![];ami[_0xdb48('0x3a')]('custom:amd',ut[_0xdb48('0x11b')](_0x173427,_0xdb48('0x122')));hopperUtils[_0xdb48('0xe6')](_0x173427)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x123')));if(_0x173427[_0xdb48('0x124')]+_0x173427[_0xdb48('0x125')]+_0x173427[_0xdb48('0x126')]+_0x173427['countnosuchnumberretry']+_0x173427[_0xdb48('0xd7')]+_0x173427[_0xdb48('0xeb')]+_0x173427['countmachineretry']+_0x173427['countagentrejectretry']>=_0x39035a[_0xdb48('0x128')]){_0x372d83['stateGlobal'](_0x173427,_0x10fcb5,_0x26356a,'reason19\x20machine....');}else{if(_0x173427['countmachineretry']>=_0x39035a['dialMachineMaxRetry']){_0x372d83[_0xdb48('0x12a')](_0x173427,_0x10fcb5,_0x26356a,_0xdb48('0x12b'));}else{hopperUtils[_0xdb48('0xde')]({'active':![],'countmachineretry':_0x173427[_0xdb48('0x121')],'scheduledat':moment()[_0xdb48('0x12c')](_0x39035a[_0xdb48('0x130')],'minutes')[_0xdb48('0x3e')](_0xdb48('0xc2')),'ContactId':_0x173427['ContactId'],'ListId':_0x173427[_0xdb48('0xe1')],'VoiceQueueId':_0x173427[_0xdb48('0xe2')]||undefined,'CampaignId':_0x173427[_0xdb48('0xe3')]||undefined})['catch'](loggerCatch(_0xdb48('0x12d')));_0x10fcb5({'reschedule':0x1});}}});}}};Dialer[_0xdb48('0x85')][_0xdb48('0x31')]=function(_0x5f490f){var _0x187120=this[_0xdb48('0xbc')][_0x5f490f[_0xdb48('0xbd')]];var _0x4f12f8;if(_0x187120&&_0x187120[_0xdb48('0xbe')]===_0xdb48('0xbf')){delete this['uniqueId'][_0x5f490f[_0xdb48('0xbd')]];this['updateOriginated'](this[_0xdb48('0x1e')][_0x187120[_0xdb48('0xbb')]]);this[_0xdb48('0x1e')][_0x187120['queue']]['ivrAnswerCallsDay']+=0x1;_0x4f12f8=new Hangup(_0x187120,_0x5f490f);hopperUtils[_0xdb48('0xe6')](_0x4f12f8)[_0xdb48('0x98')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xdb48('0xca')](_0x4f12f8)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x131')));}if(_0x187120&&_0x187120[_0xdb48('0xbe')]!==_0xdb48('0xbf')&&isNotNull(this[_0xdb48('0xba')][_0x187120[_0xdb48('0xbb')]]['dialQueueProject'])){delete this[_0xdb48('0xbc')][_0x5f490f[_0xdb48('0xbd')]];this[_0xdb48('0xc0')](this[_0xdb48('0xba')][_0x187120[_0xdb48('0xbb')]]);this['voiceQueues'][_0x187120['queue']][_0xdb48('0xc4')]+=0x1;this[_0xdb48('0xba')][_0x187120[_0xdb48('0xbb')]][_0xdb48('0x117')]+=0x1;_0x4f12f8=new Hangup(_0x187120,_0x5f490f);_0x4f12f8['state']=0x10;_0x4f12f8[_0xdb48('0x69')]=_0xdb48('0x132');_0x4f12f8[_0xdb48('0x118')]=_0xdb48('0x133');hopperUtils[_0xdb48('0xe6')](_0x4f12f8)['catch'](loggerCatch(_0xdb48('0x134')));hopperUtils['moveContactManagedDialer'](_0x4f12f8)[_0xdb48('0x98')](loggerCatch('[syncHangupIvr]'));}if(_0x187120&&_0x187120['type']!==_0xdb48('0xbf')&&!isNotNull(this['voiceQueues'][_0x187120[_0xdb48('0xbb')]]['dialQueueProject'])){if(_0x5f490f[_0xdb48('0x135')]==='Normal\x20Clearing'){delete this[_0xdb48('0xbc')][_0x5f490f['uniqueid']];this[_0xdb48('0xba')][_0x187120['queue']][_0xdb48('0xc4')]+=0x1;const _0x232314=new AgentComplete(_0x187120,_0x5f490f);_0x232314['CampaignId']=this['voiceQueues'][_0x187120[_0xdb48('0xbb')]]['id'];hopperUtils[_0xdb48('0xe6')](_0x232314)[_0xdb48('0x98')](loggerCatch(_0xdb48('0xc9')));hopperUtils[_0xdb48('0xca')](_0x232314)[_0xdb48('0x98')](loggerCatch(_0xdb48('0xcb')));}else{delete this[_0xdb48('0xbc')][_0x5f490f[_0xdb48('0xbd')]];this[_0xdb48('0xc0')](this['voiceQueues'][_0x187120['queue']]);this['voiceQueues'][_0x187120[_0xdb48('0xbb')]]['outboundUnknownCallsDay']+=0x1;_0x4f12f8=new Hangup(_0x187120,_0x5f490f);_0x4f12f8[_0xdb48('0x68')]=0xc;_0x4f12f8[_0xdb48('0x69')]=_0x5f490f[_0xdb48('0x135')];_0x4f12f8[_0xdb48('0x118')]=_0xdb48('0x136');hopperUtils[_0xdb48('0xe6')](_0x4f12f8)['catch'](loggerCatch(_0xdb48('0x134')));hopperUtils[_0xdb48('0xca')](_0x4f12f8)[_0xdb48('0x98')](loggerCatch('[syncHangupIvr]'));}}};Dialer[_0xdb48('0x85')][_0xdb48('0xa')]=function(_0x485d3d){var _0x16c7a0=this;if(!_0x16c7a0['queuesSummary'][_0x485d3d[_0xdb48('0x3f')]]){_0x16c7a0[_0xdb48('0x137')][_0x485d3d['name']]={'running':![]};}else if(_0x16c7a0[_0xdb48('0x137')][_0x485d3d[_0xdb48('0x3f')]][_0xdb48('0x138')]===!![]){return;}else if(_0x16c7a0['queuesSummary'][_0x485d3d[_0xdb48('0x3f')]][_0xdb48('0x138')]===![]){_0x16c7a0[_0xdb48('0x137')][_0x485d3d['name']][_0xdb48('0x138')]=!![];}var _0x13246b=_0x16c7a0[_0xdb48('0xba')][_0x485d3d[_0xdb48('0x3f')]];var _0x499bd1=_0x13246b[_0xdb48('0x62')]!==utils[_0xdb48('0x63')][_0xdb48('0x73')];var _0x5d38a1=utils[_0xdb48('0x139')](_0x13246b);_0x13246b[_0xdb48('0x13a')]=utils['getQueueCampaignStatusMessage'](_0x13246b,_0x16c7a0['trunks']);Promise['resolve']()[_0xdb48('0x95')](function(){if(_0x13246b[_0xdb48('0x13a')]===utils[_0xdb48('0x63')]['INACTIVE']){if(_0x499bd1){clearPredictiveAttributes(_0x13246b);_0x485d3d['startPredictive']=undefined;_0x485d3d['startProgressive']=undefined;}if(_0x13246b[_0xdb48('0x13a')]===utils['CAMPAIGN_STATUS'][_0xdb48('0x73')]){_0x485d3d[_0xdb48('0x13b')]=0x0;_0x485d3d[_0xdb48('0xfc')]=0x0;_0x485d3d[_0xdb48('0x13c')]=0x0;_0x485d3d[_0xdb48('0x13d')]=0x0;_0x485d3d['pTalking']=0x0;}}else if(_0x13246b['statusMessage']===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x5d38a1){return _0x16c7a0[_0xdb48('0x89')](_0x13246b,!![])[_0xdb48('0x95')](function(){return _0x16c7a0[_0xdb48('0x89')](_0x13246b,![]);})[_0xdb48('0x95')](function(){return _0x16c7a0[_0xdb48('0xa9')](_0x13246b);})[_0xdb48('0x98')](function(_0x771909){loggerSyncQueueSummary[_0xdb48('0x57')]('[syncQueueSummary]',util['inspect'](_0x771909,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x13246b);});}else{clearPredictiveAttributes(_0x13246b);}})[_0xdb48('0x95')](function(){var _0x270e7e=_0x485d3d[_0xdb48('0x13e')](_0x13246b);if(_0x270e7e||_0x13246b[_0xdb48('0x13f')]){_0x13246b['queueSummaryCountersUpdated']=![];_0x485d3d[_0xdb48('0x140')](_0x13246b);Object[_0xdb48('0x141')](_0x13246b,_0x485d3d);emitOutboundVoiceQueueSummary(_0x485d3d);}_0x16c7a0[_0xdb48('0x137')][_0x13246b[_0xdb48('0x3f')]][_0xdb48('0x138')]=![];})[_0xdb48('0x98')](function(_0x1f7d2e){logger[_0xdb48('0x5d')]('[syncQueueSummary]',util[_0xdb48('0x3d')](_0x1f7d2e,{'showHidden':![],'depth':null}));_0x16c7a0[_0xdb48('0x137')][_0x13246b[_0xdb48('0x3f')]]['running']=![];});};Dialer[_0xdb48('0x85')][_0xdb48('0x30')]=_['throttle'](function(){var _0x4e9edd=_[_0xdb48('0x142')](this[_0xdb48('0xba')],function(_0x421497){return _0x421497[_0xdb48('0x143')];});var _0x6c0155=_[_0xdb48('0x142')](this[_0xdb48('0x1f')],function(_0x4c6c42){return _0x4c6c42[_0xdb48('0x144')]&&_0x4c6c42[_0xdb48('0x80')]===_0xdb48('0x145');});if(_0x4e9edd[_0xdb48('0x91')]>0x0&&_0x6c0155[_0xdb48('0x91')]>0x0){return Promise[_0xdb48('0xa4')]()[_0xdb48('0x95')](cmHopper[_0xdb48('0x146')](_[_0xdb48('0x147')](_0x4e9edd,'id'),previewRecallmeReminderInterval,_[_0xdb48('0x147')](_0x6c0155,'id')))['then'](function(_0x37be2c){for(var _0x1584b0=0x0;_0x1584b0<_0x37be2c['length'];_0x1584b0++){var _0x378bbb=_0x37be2c[_0x1584b0][_0xdb48('0x148')]['name'];if(_0x378bbb)io['to'](util[_0xdb48('0x3e')]('user:%s',_0x378bbb))[_0xdb48('0x3a')]('user:dialPreviewRecallReminder',{'hopper':_0x37be2c[_0x1584b0]});}})[_0xdb48('0x98')](function(_0x9add32){logger[_0xdb48('0x5d')](_0xdb48('0x149'),_0x9add32);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xdb48('0x85')][_0xdb48('0x36')]=function(){var _0x40ae65=this;setInterval(function(){_0x40ae65['clearZombieChannels'](_0x40ae65[_0xdb48('0xbc')],'[uniqueid]');_0x40ae65['clearZombieChannels'](_0x40ae65['actions'],_0xdb48('0x14a'));},0x32c8);};Dialer[_0xdb48('0x85')][_0xdb48('0x14b')]=function(_0x391db3,_0x5a254b){var _0x5068d2=this;for(var _0x551ba2 in _0x391db3){if(typeof _0x391db3[_0x551ba2]!==_0xdb48('0xa2')){this[_0xdb48('0x14c')]['enqueue'](function(){if(!_[_0xdb48('0xf6')](_0x391db3[_0x551ba2])){return ami[_0xdb48('0x99')]({'action':_0xdb48('0x80'),'channel':_0x391db3[_0x551ba2]['channel']})[_0xdb48('0x98')](function(_0x4a5095){if(_0x4a5095['message']===_0xdb48('0x14d')){setTimeout(function(){if(_0x391db3[_0x551ba2]&&_0x391db3[_0x551ba2][_0xdb48('0xbe')]!=='ivr'){_0x5068d2['updateOriginated'](_0x5068d2['voiceQueues'][_0x391db3[_0x551ba2][_0xdb48('0xbb')]]);logger['error']('[Dialer][checkChannel]',_0x5a254b,_0x551ba2,_0x391db3[_0x551ba2][_0xdb48('0xbb')]);delete _0x391db3[_0x551ba2];}if(_0x391db3[_0x551ba2]&&_0x391db3[_0x551ba2][_0xdb48('0xbe')]===_0xdb48('0xbf')){_0x5068d2[_0xdb48('0xc0')](_0x5068d2[_0xdb48('0x1e')][_0x391db3[_0x551ba2][_0xdb48('0xbb')]]);logger['error'](_0xdb48('0x14e'),_0x5a254b,_0x551ba2,_0x391db3[_0x551ba2][_0xdb48('0xbb')]);delete _0x391db3[_0x551ba2];}},0x2328);}});}});}}};Dialer[_0xdb48('0x85')][_0xdb48('0x14f')]=function(_0x170383){return Promise[_0xdb48('0xa4')]()[_0xdb48('0x95')](voiceQueueRt[_0xdb48('0x14f')](_0x170383))['catch'](loggerCatch(_0xdb48('0x150')));};Dialer[_0xdb48('0x85')][_0xdb48('0xc0')]=function(_0x50030d){if(!_[_0xdb48('0x39')](_0x50030d)&&_0x50030d!==null){if(typeof _0x50030d[_0xdb48('0x77')]!==_0xdb48('0xa2')){if(_0x50030d['originated']>0x0){_0x50030d[_0xdb48('0x77')]-=0x1;}else{logger[_0xdb48('0x5d')](_0xdb48('0x151'));}}}else{logger['error'](_0xdb48('0x152'));}};Dialer[_0xdb48('0x85')][_0xdb48('0x153')]=function(_0x5162c0,_0x4b05e1){var _0x1e8527=this;return function(_0x430fa0){_0x1e8527[_0xdb48('0xc0')](_0x4b05e1);logger[_0xdb48('0x5d')](_0x5162c0,util[_0xdb48('0x3d')](_0x430fa0,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xdb48('0x154')]=function(_0x39bd4d,_0x4f4364,_0x1be212){var _0xfe53ac={'state':0x19,'statedesc':_0xdb48('0x155')};this[_0xdb48('0xc0')](_0x4f4364);this[_0xdb48('0x11c')](_[_0xdb48('0x56')](_0xfe53ac,_['pick'](_0x1be212,[_0xdb48('0xe0'),_0xdb48('0xe1'),_0xdb48('0x156'),_0xdb48('0xe2'),_0xdb48('0xe3')])),_0xdb48('0x157'),'[emptyContact]');logger[_0xdb48('0x5d')](_0x39bd4d);};Dialer[_0xdb48('0x85')][_0xdb48('0x11c')]=function(_0x217bad,_0x12f1d4,_0xd5c43e){hopperUtils[_0xdb48('0xe6')](_0x217bad)['catch'](loggerCatch(_0x12f1d4));hopperUtils[_0xdb48('0xca')](_0x217bad)[_0xdb48('0x98')](loggerCatch(_0xd5c43e));};Dialer['prototype'][_0xdb48('0xdd')]=function(_0x12de74,_0x4561f5){hopperUtils[_0xdb48('0xe6')](_0x12de74)[_0xdb48('0x98')](loggerCatch(_0xdb48('0xc9')));if(_0x4561f5==0x0){hopperUtils[_0xdb48('0xca')](_0x12de74)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x158')));}};Dialer[_0xdb48('0x85')][_0xdb48('0x149')]=function(_0x5b719f){return Promise[_0xdb48('0xa4')]()[_0xdb48('0x95')](cmHopper[_0xdb48('0x146')](_0x5b719f['id'],previewRecallmeReminderInterval))[_0xdb48('0x95')](function(_0x530a57){for(var _0x21f53f=0x0;_0x21f53f<_0x530a57[_0xdb48('0x91')];_0x21f53f++){var _0x4d88ad=_0x530a57[_0x21f53f]['Agent'][_0xdb48('0x3f')];if(_0x4d88ad)io['to'](util[_0xdb48('0x3e')](_0xdb48('0x159'),_0x4d88ad))[_0xdb48('0x3a')](_0xdb48('0x15a'),{'hopper':_0x530a57[_0x21f53f]});}})['catch'](function(){});};Dialer[_0xdb48('0x85')][_0xdb48('0xa7')]=function(_0x248d2f){var _0x51dc92=this;return function(){_0x51dc92[_0xdb48('0x15b')](_0x248d2f);};};Dialer['prototype'][_0xdb48('0x15c')]=function(_0x2ff567,_0x28796d){var _0x3146a8=this;var _0x5dd732=uuid['v4']();this[_0xdb48('0x22')][_0x5dd732]=new Action(_0x2ff567,_0x28796d,_0x5dd732);return new Promise(function(_0x470cbb,_0x588711){if(_[_0xdb48('0x39')](_0x2ff567)&&typeof _0x2ff567!==_0xdb48('0x15d')){return _0x588711(msgResponse(_0xdb48('0x15e'),_0xdb48('0x8a'),_0xdb48('0x15f')));}if(_[_0xdb48('0x39')](_0x28796d[_0xdb48('0x160')])||_0x28796d[_0xdb48('0x160')]===null){return _0x588711(msgResponse(_0xdb48('0x15e'),_0xdb48('0x8a'),_0xdb48('0x161')));}var _0x8edda7={'XMD-CALLERID':_0x3146a8[_0xdb48('0x22')][_0x5dd732][_0xdb48('0x162')](),'XMD-AGI':_0x2ff567[_0xdb48('0x163')]?util[_0xdb48('0x3e')](_0xdb48('0x164'),ipAgi,_0x2ff567[_0xdb48('0x163')]):_0xdb48('0x165'),'XMD-AGIAFTER':_0x2ff567[_0xdb48('0xd6')]?util[_0xdb48('0x3e')](_0xdb48('0x164'),ipAgi,_0x2ff567[_0xdb48('0xd6')]):_0xdb48('0x165'),'XMD-QUEUE':utils[_0xdb48('0x166')](_0x2ff567)?util[_0xdb48('0x3e')]('\x22%s,%s%s,,,%s\x22',_0x2ff567[_0xdb48('0x3f')],_0x2ff567['dialQueueOptions']||'',_0x2ff567[_0xdb48('0xc8')]?'c':'',_0x2ff567['dialQueueTimeout']||0x3):_0xdb48('0x165'),'XMD-CONTACTID':_0x28796d[_0xdb48('0xe0')],'XMD-CDRTYPE':_0xdb48('0x167'),'CALLERID(all)':_0x3146a8[_0xdb48('0x22')][_0x5dd732]['getCaller'](),'XMD-AMD':_0x2ff567[_0xdb48('0x114')]?_0xdb48('0x168'):_0xdb48('0x165'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2ff567[_0xdb48('0x114')]){_0x8edda7[_0xdb48('0x169')]=_0x2ff567[_0xdb48('0x16a')]||0x9c4;_0x8edda7['XMD-AMDGREETING']=_0x2ff567[_0xdb48('0x16b')]||0x5dc;_0x8edda7[_0xdb48('0x16c')]=_0x2ff567['dialAMDAfterGreetingSilence']||0x320;_0x8edda7[_0xdb48('0x16d')]=_0x2ff567[_0xdb48('0x16e')]||0x1388;_0x8edda7['XMD-AMDMINWORDLENGTH']=_0x2ff567[_0xdb48('0x16f')]||0x64;_0x8edda7[_0xdb48('0x170')]=_0x2ff567[_0xdb48('0x171')]||0x32;_0x8edda7[_0xdb48('0x172')]=_0x2ff567['dialAMDMaximumNumberOfWords']||0x3;_0x8edda7['XMD-AMDSILENCETHRESHOLD']=_0x2ff567[_0xdb48('0x173')]||0x100;_0x8edda7[_0xdb48('0x174')]=_0x2ff567[_0xdb48('0x175')]||0x1388;}if(utils[_0xdb48('0x166')](_0x2ff567)){_0x8edda7[_0xdb48('0x176')]=_0x28796d['VoiceQueueId'];}else{_0x8edda7['XMD-CAMPAIGNID']=_0x28796d[_0xdb48('0xe3')];}var _0x2786d8=utils['setXMDContactVariables'](_0x28796d[_0xdb48('0x177')]);Object[_0xdb48('0x141')](_0x8edda7,_0x2786d8);var _0x51a1a9=_0x3146a8[_0xdb48('0x7d')](_0x2ff567[_0xdb48('0x83')])?utils[_0xdb48('0x178')](_0x2ff567[_0xdb48('0x83')][_0xdb48('0x179')],_0x2ff567['dialOriginateCallerIdName'],_0x2ff567[_0xdb48('0x17a')]>0x0?utils['getCallerIdRandom'](_0x2ff567[_0xdb48('0x17b')],_0x2ff567[_0xdb48('0x17a')]):_0x2ff567[_0xdb48('0x17b')]):utils['getCallerId'](_[_0xdb48('0xf6')](_0x2ff567[_0xdb48('0x17c')])?_0x2ff567[_0xdb48('0x83')][_0xdb48('0x179')]:_0x2ff567[_0xdb48('0x17c')][_0xdb48('0x179')],_0x2ff567[_0xdb48('0x17d')],_0x2ff567[_0xdb48('0x17a')]>0x0?utils[_0xdb48('0x17e')](_0x2ff567[_0xdb48('0x17b')],_0x2ff567[_0xdb48('0x17a')]):_0x2ff567[_0xdb48('0x17b')]);if(_0x51a1a9){_0x8edda7[_0xdb48('0x17f')]=_0x3146a8[_0xdb48('0x22')][_0x5dd732][_0xdb48('0x180')]=utils['extractCalleridName'](_0x51a1a9);_0x8edda7['XMD-ORIGINATECALLERIDNUM']=_0x28796d[_0xdb48('0x160')];}_0x2ff567[_0xdb48('0x181')]=_0x8edda7;return ami[_0xdb48('0x99')]({'actionid':_0x5dd732,'action':_0xdb48('0x15e'),'channel':_0x3146a8['isTrunkReachable'](_0x2ff567['Trunk'])?util[_0xdb48('0x3e')]('SIP/%s/%s%s',_0x2ff567[_0xdb48('0x83')][_0xdb48('0x3f')],isNotNull(_0x2ff567[_0xdb48('0x182')])?_0x2ff567['dialPrefix'][_0xdb48('0x183')]()||'':'',_0x2ff567[_0xdb48('0x184')]>0x0?_0x28796d[_0xdb48('0x160')]['substring'](_0x2ff567[_0xdb48('0x184')]):_0x28796d[_0xdb48('0x160')]):util[_0xdb48('0x3e')]('SIP/%s/%s%s',_['isNil'](_0x2ff567[_0xdb48('0x17c')])?_0x2ff567[_0xdb48('0x83')][_0xdb48('0x3f')]:_0x2ff567[_0xdb48('0x17c')][_0xdb48('0x3f')],isNotNull(_0x2ff567[_0xdb48('0x182')])?_0x2ff567[_0xdb48('0x182')][_0xdb48('0x183')]()||'':'',_0x2ff567[_0xdb48('0x184')]>0x0?_0x28796d[_0xdb48('0x160')][_0xdb48('0x185')](_0x2ff567[_0xdb48('0x184')]):_0x28796d[_0xdb48('0x160')]),'callerid':_0x51a1a9,'Exten':_0xdb48('0x186'),'Context':_0xdb48('0x187'),'Priority':'1','variable':_0x8edda7,'timeout':(_0x2ff567[_0xdb48('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5dd732})[_0xdb48('0x95')](function(_0x345415){return _0x470cbb(_0x345415);})[_0xdb48('0x98')](function(_0x212afe){_0x2ff567[_0xdb48('0x189')]+=0x1;var _0xf39544=new History(_0x3146a8[_0xdb48('0x22')][_0x5dd732]);logger[_0xdb48('0x5d')](util[_0xdb48('0x3e')](_0xdb48('0x18a'),JSON[_0xdb48('0x7c')](_0x212afe)));_0xf39544['state']=0xe;_0xf39544['statedesc']=_0xdb48('0x18b');_0xf39544[_0xdb48('0x6b')]=moment()['format'](_0xdb48('0xc2'));_0xf39544[_0xdb48('0x6a')]=_0xf39544[_0xdb48('0x6b')];hopperUtils[_0xdb48('0xe6')](_0xf39544)[_0xdb48('0x98')](loggerCatch('[originate][error]'));_0x3146a8[_0xdb48('0xca')](_0xf39544)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x18c')))[_0xdb48('0x1c')](function(){delete _0x3146a8[_0xdb48('0x22')][_0x5dd732];return _0x588711(msgResponse(_0xdb48('0x15e'),_0xdb48('0xb9'),_0xdb48('0x18d')));});});});};Dialer['prototype'][_0xdb48('0x18e')]=function(_0x2e1f3d,_0x43e09c,_0x51bb38){var _0x4e4181=new History(_0x43e09c);if(_0x4e4181[_0xdb48('0x124')]+_0x4e4181[_0xdb48('0x125')]+_0x4e4181[_0xdb48('0x126')]+_0x4e4181['countnosuchnumberretry']+_0x4e4181[_0xdb48('0xd7')]+_0x4e4181[_0xdb48('0xeb')]+_0x4e4181[_0xdb48('0x121')]+_0x4e4181[_0xdb48('0x18f')]>=_0x51bb38[_0xdb48('0x128')]-0x1){return!![];}switch(_0x2e1f3d){case 0x3:if(_0x4e4181[_0xdb48('0x126')]>=_0x51bb38[_0xdb48('0x190')]-0x1){return!![];}hopperUtils[_0xdb48('0xde')]({'active':![],'countnoanswerretry':_0x4e4181['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xdb48('0x12c')](_0x51bb38[_0xdb48('0x191')],_0xdb48('0xdf'))[_0xdb48('0x3e')](_0xdb48('0xc2')),'ContactId':_0x4e4181[_0xdb48('0xe0')],'ListId':_0x4e4181['ListId'],'VoiceQueueId':_0x4e4181['VoiceQueueId']||undefined,'CampaignId':_0x4e4181[_0xdb48('0xe3')]||undefined})['catch'](loggerCatch(_0xdb48('0x192')));break;case 0x5:if(_0x4e4181['countbusyretry']>=_0x51bb38['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x4e4181[_0xdb48('0x124')]+=0x1,'scheduledat':moment()['add'](_0x51bb38[_0xdb48('0x193')],'minutes')[_0xdb48('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e4181[_0xdb48('0xe0')],'ListId':_0x4e4181['ListId'],'VoiceQueueId':_0x4e4181[_0xdb48('0xe2')]||undefined,'CampaignId':_0x4e4181[_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x194')));break;case 0x8:if(_0x4e4181[_0xdb48('0x125')]>=_0x51bb38[_0xdb48('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x4e4181[_0xdb48('0x125')]+=0x1,'scheduledat':moment()[_0xdb48('0x12c')](_0x51bb38[_0xdb48('0x196')],_0xdb48('0xdf'))['format'](_0xdb48('0xc2')),'ContactId':_0x4e4181[_0xdb48('0xe0')],'ListId':_0x4e4181[_0xdb48('0xe1')],'VoiceQueueId':_0x4e4181[_0xdb48('0xe2')]||undefined,'CampaignId':_0x4e4181[_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x197')));break;case 0x0:if(_0x4e4181[_0xdb48('0x127')]>=_0x51bb38[_0xdb48('0x198')]-0x1){return!![];}else{hopperUtils[_0xdb48('0xde')]({'active':![],'countnosuchnumberretry':_0x4e4181[_0xdb48('0x127')]+=0x1,'scheduledat':moment()[_0xdb48('0x12c')](_0x51bb38['dialNoSuchNumberRetryFrequency'],_0xdb48('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e4181[_0xdb48('0xe0')],'ListId':_0x4e4181['ListId'],'VoiceQueueId':_0x4e4181['VoiceQueueId']||undefined,'CampaignId':_0x4e4181[_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x199')));}break;case 0xa:if(_0x4e4181[_0xdb48('0xd7')]>=_0x51bb38[_0xdb48('0xdc')]-0x1){return!![];}hopperUtils[_0xdb48('0xde')]({'active':![],'countdropretry':_0x4e4181[_0xdb48('0xd7')]+=0x1,'scheduledat':moment()[_0xdb48('0x12c')](_0x51bb38['dialDropRetryFrequency'],_0xdb48('0xdf'))[_0xdb48('0x3e')](_0xdb48('0xc2')),'ContactId':_0x4e4181[_0xdb48('0xe0')],'ListId':_0x4e4181[_0xdb48('0xe1')],'VoiceQueueId':_0x4e4181[_0xdb48('0xe2')]||undefined,'CampaignId':_0x4e4181[_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0xe4')));break;case 0xb:if(_0x4e4181[_0xdb48('0xeb')]>=_0x51bb38[_0xdb48('0x19a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4e4181['countabandonedretry']+=0x1,'scheduledat':moment()[_0xdb48('0x12c')](_0x51bb38['dialAbandonedRetryFrequency'],'minutes')['format'](_0xdb48('0xc2')),'ContactId':_0x4e4181[_0xdb48('0xe0')],'ListId':_0x4e4181[_0xdb48('0xe1')],'VoiceQueueId':_0x4e4181[_0xdb48('0xe2')]||undefined,'CampaignId':_0x4e4181['CampaignId']||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0xef')));break;case 0x13:if(_0x4e4181[_0xdb48('0x121')]>=_0x51bb38[_0xdb48('0x19b')]-0x1){return!![];}hopperUtils[_0xdb48('0xde')]({'active':![],'countmachineretry':_0x4e4181[_0xdb48('0x121')]+=0x1,'scheduledat':moment()[_0xdb48('0x12c')](_0x51bb38['dialMachineRetryFrequency'],_0xdb48('0xdf'))[_0xdb48('0x3e')](_0xdb48('0xc2')),'ContactId':_0x4e4181[_0xdb48('0xe0')],'ListId':_0x4e4181[_0xdb48('0xe1')],'VoiceQueueId':_0x4e4181['VoiceQueueId']||undefined,'CampaignId':_0x4e4181[_0xdb48('0xe3')]||undefined})['catch'](loggerCatch(_0xdb48('0x12d')));break;case 0x14:if(_0x4e4181[_0xdb48('0x18f')]>=_0x51bb38[_0xdb48('0x19c')]-0x1){return!![];}hopperUtils[_0xdb48('0xde')]({'active':![],'countagentrejectretry':_0x4e4181['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x51bb38[_0xdb48('0x19d')],'minutes')[_0xdb48('0x3e')](_0xdb48('0xc2')),'ContactId':_0x4e4181[_0xdb48('0xe0')],'ListId':_0x4e4181['ListId'],'VoiceQueueId':_0x4e4181['VoiceQueueId']||undefined,'CampaignId':_0x4e4181[_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x19e')));break;default:return!![];}};Dialer[_0xdb48('0x85')][_0xdb48('0x10f')]=function(_0x1c216c,_0x10f0ec,_0x26391a){var _0x52c5b4=this;var _0x384c6f=new History(_0x1c216c);var _0x87622d=![];var _0x17f01a;var _0x10bd5d;return new Promise(function(_0x2a4f02,_0x1fa0db){if(_[_0xdb48('0x39')](_0x10f0ec)&&typeof _0x10f0ec!==_0xdb48('0x15d')){return _0x1fa0db(msgResponse(_0xdb48('0x19f'),_0xdb48('0x8a'),_0xdb48('0x1a0')));}if(_[_0xdb48('0x39')](_0x26391a)&&typeof _0x26391a!==_0xdb48('0x15d')){return _0x1fa0db(msgResponse('[callProgressDetecting]',_0xdb48('0x8a'),_0xdb48('0x1a1')));}hopperUtils[_0xdb48('0xed')](_0x384c6f,_0x26391a[_0xdb48('0xc5')],_0x10f0ec)['then'](function(_0x590d8a){if(_0x590d8a['additional']==0x1)_0x87622d=!![];switch(_0x26391a[_0xdb48('0xc5')]){case'0':_0x10f0ec['outboundNoSuchCallsDay']+=0x1;_0x384c6f[_0xdb48('0x68')]=0x0;_0x384c6f[_0xdb48('0x69')]='NoSuchNumber';_0x384c6f[_0xdb48('0x127')]+=0x1;_0x384c6f['countglobal']+=0x1;ami[_0xdb48('0x3a')](_0xdb48('0x1a2'),ut['buildObj'](_0x1c216c,'nosuchnumber'));_0x17f01a=_0x10f0ec['dialNoSuchNumberRetryFrequency'];_0x10bd5d=_0x10f0ec[_0xdb48('0xec')];hopperUtils['createHistory'](_0x384c6f)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x123')));if(_0x52c5b4['checkRetriveMax'](0x0,_0x1c216c,_0x10f0ec)&&!_0x87622d){if(_0x384c6f[_0xdb48('0x127')]>=_0x10f0ec[_0xdb48('0x198')]){_0x52c5b4[_0xdb48('0x12a')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1a3'));}else{_0x52c5b4[_0xdb48('0x1a4')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1a3'));}}break;case'3':_0x10f0ec[_0xdb48('0x1a5')]+=0x1;_0x384c6f[_0xdb48('0x68')]=0x3;_0x384c6f[_0xdb48('0x69')]=_0xdb48('0x1a6');_0x384c6f[_0xdb48('0x126')]+=0x1;_0x384c6f[_0xdb48('0xd8')]+=0x1;var _0x10edf7=ut['buildNoAnswerEventPayload'](_0x1c216c,_0x10f0ec);ami['emit'](_0xdb48('0x1a7'),_0x10edf7);_0x17f01a=_0x10f0ec['dialNoAnswerRetryFrequency'];_0x10bd5d=_0x10f0ec['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x384c6f)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x1a8')));if(_0x52c5b4[_0xdb48('0x18e')](0x3,_0x1c216c,_0x10f0ec)&&!_0x87622d){if(_0x384c6f[_0xdb48('0x126')]>=_0x10f0ec[_0xdb48('0x190')]){_0x52c5b4['createStateFinal'](_0x384c6f,_0x2a4f02,_0x1fa0db,'reason\x203\x20ringing\x20no\x20answer');}else{_0x52c5b4[_0xdb48('0x1a4')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1a9'));}}break;case'5':_0x10f0ec[_0xdb48('0x1aa')]+=0x1;_0x384c6f['state']=0x5;_0x384c6f[_0xdb48('0x69')]=_0xdb48('0x1ab');_0x384c6f['countbusyretry']+=0x1;_0x384c6f['countglobal']+=0x1;ami['emit'](_0xdb48('0x1ac'),ut['buildObj'](_0x1c216c,_0xdb48('0x1ad')));_0x17f01a=_0x10f0ec[_0xdb48('0x193')];_0x10bd5d=_0x10f0ec[_0xdb48('0xec')];hopperUtils['createHistory'](_0x384c6f)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x52c5b4[_0xdb48('0x18e')](0x5,_0x1c216c,_0x10f0ec)&&!_0x87622d){if(_0x384c6f['countbusyretry']>=_0x10f0ec[_0xdb48('0x1ae')]){_0x52c5b4[_0xdb48('0x12a')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1af'));}else{_0x52c5b4['stateGlobal'](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1af'));}}break;case'8':_0x10f0ec[_0xdb48('0x1b0')]+=0x1;_0x384c6f[_0xdb48('0x68')]=0x8;_0x384c6f[_0xdb48('0x69')]='Congestion';_0x384c6f[_0xdb48('0x125')]+=0x1;_0x384c6f[_0xdb48('0xd8')]+=0x1;_0x17f01a=_0x10f0ec['dialCongestionRetryFrequency'];_0x10bd5d=_0x10f0ec[_0xdb48('0xec')];ami[_0xdb48('0x3a')]('custom:agentcongestion',ut[_0xdb48('0x11b')](_0x1c216c,_0xdb48('0x1b1')));hopperUtils[_0xdb48('0xe6')](_0x384c6f)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x1b2')));if(_0x52c5b4[_0xdb48('0x18e')](0x8,_0x1c216c,_0x10f0ec)&&!_0x87622d){if(_0x384c6f[_0xdb48('0x125')]>=_0x10f0ec[_0xdb48('0x195')]){_0x52c5b4[_0xdb48('0x12a')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1b3'));}else{_0x52c5b4['stateGlobal'](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1b3'));}}break;case'11':_0x10f0ec[_0xdb48('0x1b4')]+=0x1;_0x384c6f[_0xdb48('0x68')]=0xb;_0x384c6f['statedesc']=_0xdb48('0xe9');_0x384c6f[_0xdb48('0xeb')]+=0x1;_0x384c6f[_0xdb48('0xd8')]+=0x1;_0x17f01a=_0x10f0ec[_0xdb48('0xee')];_0x10bd5d=_0x10f0ec['callAdditionalPhoneAfterMin'];hopperUtils[_0xdb48('0xe6')](_0x384c6f)[_0xdb48('0x98')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x52c5b4['checkRetriveMax'](0xb,_0x1c216c,_0x10f0ec)&&!_0x87622d){if(_0x384c6f[_0xdb48('0xeb')]>=_0x10f0ec['dialAbandonedMaxRetry']){_0x52c5b4['createStateFinal'](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1b5'));}else{_0x52c5b4[_0xdb48('0x1a4')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1b5'));}}break;case'20':_0x10f0ec[_0xdb48('0x1b6')]+=0x1;_0x384c6f[_0xdb48('0x68')]=0x14;_0x384c6f[_0xdb48('0x69')]=_0xdb48('0x1b7');_0x384c6f[_0xdb48('0x18f')]+=0x1;_0x384c6f[_0xdb48('0xd8')]+=0x1;_0x17f01a=_0x10f0ec[_0xdb48('0x19d')];_0x10bd5d=_0x10f0ec[_0xdb48('0xec')];ami[_0xdb48('0x3a')](_0xdb48('0x1b8'),ut[_0xdb48('0x11b')](_0x1c216c,_0xdb48('0x1b9')));hopperUtils[_0xdb48('0xe6')](_0x384c6f)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x1ba')));if(_0x52c5b4['checkRetriveMax'](0x14,_0x1c216c,_0x10f0ec)&&!_0x87622d){if(_0x384c6f[_0xdb48('0x18f')]>=_0x10f0ec[_0xdb48('0x19c')]){_0x52c5b4[_0xdb48('0x12a')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1bb'));}else{_0x52c5b4[_0xdb48('0x1a4')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0xdb48('0x1bb'));}}break;default:_0x10f0ec[_0xdb48('0x1bc')]+=0x1;_0x384c6f[_0xdb48('0x68')]=0xc;_0x384c6f[_0xdb48('0x69')]=_0x26391a[_0xdb48('0xc5')];_0x17f01a=_0x10f0ec[_0xdb48('0x19d')];_0x10bd5d=_0x10f0ec[_0xdb48('0xec')];hopperUtils[_0xdb48('0xe6')](_0x384c6f)[_0xdb48('0x98')](loggerCatch(_0xdb48('0x1bd')));if(_0x52c5b4['checkRetriveMax'](_0x26391a[_0xdb48('0xc5')],_0x1c216c,_0x10f0ec)&&!_0x87622d){if(_0x384c6f['countbusyretry']+_0x384c6f[_0xdb48('0x125')]+_0x384c6f[_0xdb48('0x126')]+_0x384c6f[_0xdb48('0x127')]+_0x384c6f['countdropretry']+_0x384c6f[_0xdb48('0xeb')]+_0x384c6f[_0xdb48('0x121')]+_0x384c6f[_0xdb48('0x18f')]>=_0x10f0ec['dialGlobalMaxRetry']){_0x52c5b4[_0xdb48('0x1a4')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0x26391a['reason']);}else{_0x52c5b4[_0xdb48('0x12a')](_0x384c6f,_0x2a4f02,_0x1fa0db,_0x26391a[_0xdb48('0xc5')]);}}}})[_0xdb48('0x95')](function(){if(_0x87622d){hopperUtils[_0xdb48('0xf1')](_0x384c6f,_0x17f01a,_0x10bd5d)[_0xdb48('0x95')](function(){return _0x2a4f02(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x25754e,_0x4f25ee,_0x3e1ad5,_0x151e72){var _0x272b92=new Final(_0x25754e);_0x272b92[_0xdb48('0x68')]=0xf;_0x272b92[_0xdb48('0x69')]=_0xdb48('0x1be');this[_0xdb48('0x12a')](_0x272b92,_0x4f25ee,_0x3e1ad5,_0x151e72);};Dialer[_0xdb48('0x85')]['createStateFinal']=function(_0x432913,_0x5386a8,_0x3c09ad,_0x99a031){hopperUtils[_0xdb48('0xca')](_0x432913)[_0xdb48('0x95')](function(){return _0x5386a8(msgResponse('[callProgressDetecting]','Success',_0x99a031));})['catch'](function(){return _0x3c09ad(msgResponse(_0xdb48('0x1bf'),'Failure','contact\x20not\x20moved'));});};Dialer[_0xdb48('0x85')][_0xdb48('0xaa')]=function(_0xf1922f){var _0x185b01=_0xf1922f[_0xdb48('0x1c0')]/0x64;var _0x1f8c92=_0xf1922f[_0xdb48('0xd1')]/(_0xf1922f[_0xdb48('0xd1')]+_0xf1922f[_0xdb48('0xc4')]);var _0x34bbd7=Math[_0xdb48('0x1c1')](_0xf1922f[_0xdb48('0x1c2')]*(_0xf1922f[_0xdb48('0x1c3')]/0x64));var _0x3307fb=Math[_0xdb48('0x1c1')](_0xf1922f[_0xdb48('0x1c2')]*(_0xf1922f['predictiveIntervalMinThreshold']/0x64));var _0x1ecff6=_0xf1922f['available']+_0xf1922f['talking'];var _0x622739=Math[_0xdb48('0x1c4')](_0xf1922f[_0xdb48('0x1c5')]*_0xf1922f['erlangAbandonmentRate']*_0xf1922f['predictiveIntervalHitRate']*_0xf1922f[_0xdb48('0x1c6')]);if(_[_0xdb48('0x39')](_0xf1922f[_0xdb48('0x25')])){if(!_[_0xdb48('0x39')](_0xf1922f['startPredictive'])){_0xf1922f[_0xdb48('0x59')]=undefined;loggerPredictive[_0xdb48('0x5d')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xdb48('0x39')](_0xf1922f['handlePredictive'])){loggerPredictive[_0xdb48('0x5d')](_0xdb48('0x1c7'),_0xdb48('0x1c8'));clearInterval(_0xf1922f[_0xdb48('0x5b')]);_0xf1922f[_0xdb48('0x5b')]=undefined;}_0xf1922f['startProgressive']=moment()[_0xdb48('0x3e')](_0xdb48('0xc2'));loggerPredictive[_0xdb48('0x42')](_0xf1922f[_0xdb48('0x3f')],'collection\x20data\x20in\x20progressive\x20at',_0xf1922f[_0xdb48('0x25')]);this[_0xdb48('0xad')](_0xf1922f,0x1);}else if(ifInterval(_0xf1922f[_0xdb48('0x1c9')],_0xf1922f[_0xdb48('0x25')])){this[_0xdb48('0xad')](_0xf1922f,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0xf1922f['startProgressive'],_0xf1922f['name']);_0xf1922f[_0xdb48('0x1c5')]=0x0;_0xf1922f[_0xdb48('0xd2')]=0x0;}else if(_0x185b01<_0x1f8c92&&_0xf1922f[_0xdb48('0x1ca')]===_0xdb48('0x1cb')){clearPredictiveAttributes(_0xf1922f);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x1cc'),_0xdb48('0x1cd'),_0x1f8c92,_0xdb48('0x25'),_0xf1922f[_0xdb48('0x3f')]);}else if(_0x622739<_0xf1922f['predictiveIntervalErlangCallsDroppedCalls']&&_0xf1922f[_0xdb48('0x1ca')]==='dropRate'){clearPredictiveAttributes(_0xf1922f);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x622739,'Drop\x20in\x20this\x20interval',_0xf1922f['predictiveIntervalErlangCallsDroppedCalls'],_0xdb48('0x25'),_0xf1922f[_0xdb48('0x3f')]);}else if(!ifInterval(_0xf1922f[_0xdb48('0x1c9')],_0xf1922f[_0xdb48('0x25')])&&_[_0xdb48('0x39')](_0xf1922f[_0xdb48('0x59')])&&!_['isUndefined'](_0xf1922f[_0xdb48('0x25')])){_0xf1922f['startPredictive']=moment()[_0xdb48('0x3e')](_0xdb48('0xc2'));loggerPredictive['info'](_0xf1922f[_0xdb48('0x3f')],'started\x20in\x20predictive\x20at',_0xf1922f[_0xdb48('0x59')]);hopperUtils[_0xdb48('0x1ce')](_0xf1922f['dialPredictiveInterval'])['then'](this[_0xdb48('0x1cf')](_0xf1922f))['then'](mergeDataErlangB(_0xf1922f))[_0xdb48('0x95')](this[_0xdb48('0x1d0')](_0xf1922f))[_0xdb48('0x98')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0xf1922f));}else if(!ifInterval(_0xf1922f[_0xdb48('0x1c9')],_0xf1922f[_0xdb48('0x59')])){_0xf1922f[_0xdb48('0xd2')]=0x0;_0xf1922f['startPredictive']=moment()['format'](_0xdb48('0xc2'));loggerPredictive[_0xdb48('0x42')](_0xf1922f[_0xdb48('0x3f')],_0xdb48('0x1d1'),_0xf1922f[_0xdb48('0x59')]);clearInterval(_0xf1922f['handlePredictive']);_0xf1922f[_0xdb48('0x5b')]=undefined;hopperUtils[_0xdb48('0x1ce')](_0xf1922f['dialPredictiveInterval'])[_0xdb48('0x95')](this[_0xdb48('0x1cf')](_0xf1922f))[_0xdb48('0x95')](mergeDataErlangB(_0xf1922f))[_0xdb48('0x95')](this[_0xdb48('0x1d0')](_0xf1922f))[_0xdb48('0x98')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xf1922f));}else if(_0xf1922f[_0xdb48('0x1c2')]&&_0x1ecff6<_0xf1922f[_0xdb48('0x1c2')]-_0x3307fb){clearPredictiveAttributes(_0xf1922f);loggerPredictive[_0xdb48('0x42')](_0xf1922f[_0xdb48('0x3f')],_0xdb48('0x1d2'),_0x1ecff6,')\x20are\x20less\x20than\x20threshold\x20(',_0xf1922f['predictiveIntervalAvailable'],'-',_0x3307fb,'=',_0xf1922f[_0xdb48('0x1c2')]-_0x3307fb,')');}else if(_0xf1922f['predictiveIntervalAvailable']&&_0x1ecff6>_0xf1922f[_0xdb48('0x1c2')]+_0x34bbd7){clearPredictiveAttributes(_0xf1922f);loggerPredictive[_0xdb48('0x42')](_0xf1922f[_0xdb48('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1ecff6,_0xdb48('0x1d3'),_0xf1922f[_0xdb48('0x1c2')],'+',_0x34bbd7,'=',_0xf1922f[_0xdb48('0x1c2')]+_0x34bbd7,')');}};Dialer[_0xdb48('0x85')][_0xdb48('0x1cf')]=function(_0x427ecd){var _0x3a225a=this;return function(_0x216391){return new Promise(function(_0x32ca3e,_0x26bd4e){_[_0xdb48('0x56')](_0x427ecd,_0x216391[0x0]);if(checkGetDataPredictive(_0x216391[0x0])){var _0x5ee66d=_0x427ecd[_0xdb48('0x1c2')]=_0x427ecd[_0xdb48('0x13d')]+_0x427ecd[_0xdb48('0x13b')];var _0x4de319=_0x427ecd[_0xdb48('0x1c9')]*0x3c;var _0x564357=_0x216391[0x0][_0xdb48('0x4b')]+_0x216391[0x0][_0xdb48('0x49')];var _0x8529a0=(_0x216391[0x0][_0xdb48('0x44')]+_0x216391[0x0][_0xdb48('0x46')]+_0x216391[0x0][_0xdb48('0x48')])/_0x216391[0x0][_0xdb48('0x43')];_0x427ecd['predictiveIntervalHitRate']=_0x8529a0>0x0?_0x8529a0:0x1;switch(_0x427ecd['dialPredictiveOptimization']){case _0xdb48('0x1cb'):var _0x221e14=_0x427ecd[_0xdb48('0x1c0')]/0x64;return _0x3a225a[_0xdb48('0x1d4')](_0x5ee66d,_0x4de319,_0x564357,_0x8529a0,_0x221e14)[_0xdb48('0x95')](function(_0x460d50){return _0x32ca3e(_0x460d50);});case _0xdb48('0x1d5'):var _0x226002=_0x427ecd[_0xdb48('0x1c0')]/0x64;return _0x3a225a[_0xdb48('0x1d6')](_0x5ee66d,_0x4de319,_0x564357,_0x8529a0,_0x226002)[_0xdb48('0x95')](function(_0x3f08c7){return _0x32ca3e(_0x3f08c7);});default:return _0x26bd4e(msgResponse('[getDataPredictive]',_0xdb48('0x8a'),_0xdb48('0x1d7')));}}else{return _0x26bd4e(msgResponse(_0xdb48('0x1d8'),_0xdb48('0x8a'),_0xdb48('0x1d9')));}});};};Dialer[_0xdb48('0x85')][_0xdb48('0x1da')]=function(_0x4a2433){var _0x125314=this;return function(_0x505068){return new Promise(function(_0x3377e0,_0x41c78e){_[_0xdb48('0x56')](_0x4a2433,_0x505068[0x0]);if(checkGetDataPredictive(_0x505068[0x0])){loggerPredictive['info'](JSON[_0xdb48('0x7c')](_0x505068[0x0]));if(_0x4a2433[_0xdb48('0x1ca')]==='dropRate'){return _0x125314[_0xdb48('0x14f')](_0x4a2433['id'])[_0xdb48('0x95')](function(_0x2ffd1e){var _0x439207=_0x4a2433[_0xdb48('0x1db')]-_0x2ffd1e[0x0][_0xdb48('0x1dc')];var _0x1cb3ac=_0x4a2433['dialPredictiveInterval']*0x3c;var _0x1f46d6=_0x505068[0x0][_0xdb48('0x4b')]+_0x505068[0x0][_0xdb48('0x49')];var _0x34a486=(_0x505068[0x0][_0xdb48('0x44')]+_0x505068[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x505068[0x0][_0xdb48('0x48')])/_0x505068[0x0][_0xdb48('0x43')];var _0x5d9028=_0x4a2433[_0xdb48('0x1c0')]/0x64;_0x4a2433['predictiveIntervalPauses']=_0x2ffd1e[0x0][_0xdb48('0x1dc')]||0x0;_0x4a2433[_0xdb48('0x1dd')]=_0x34a486>0x0?_0x34a486:0x1;return _0x125314[_0xdb48('0x1d4')](_0x439207,_0x1cb3ac,_0x1f46d6,_0x34a486,_0x5d9028);})[_0xdb48('0x95')](function(_0x11adfe){return _0x3377e0(_0x11adfe);})[_0xdb48('0x98')](function(_0x167e58){return _0x41c78e(msgResponse('[CatchErlangB]','Failure',JSON[_0xdb48('0x7c')](_0x167e58)));});}if(_0x4a2433[_0xdb48('0x1ca')]===_0xdb48('0x1d5')){return _0x125314[_0xdb48('0x14f')](_0x4a2433['id'])[_0xdb48('0x95')](function(_0x553ffe){var _0x241911=_0x4a2433[_0xdb48('0x1db')]-_0x553ffe[0x0]['outboundQueuePauses'];var _0x132e01=_0x4a2433[_0xdb48('0x1c9')]*0x3c;var _0x33a02a=_0x505068[0x0][_0xdb48('0x4b')]+_0x505068[0x0][_0xdb48('0x49')];var _0x253d0d=(_0x505068[0x0][_0xdb48('0x44')]+_0x505068[0x0][_0xdb48('0x46')]+_0x505068[0x0][_0xdb48('0x48')])/_0x505068[0x0][_0xdb48('0x43')];var _0x52d93d=_0x4a2433[_0xdb48('0x1c0')]/0x64;_0x4a2433[_0xdb48('0x1de')]=_0x553ffe[0x0][_0xdb48('0x1dc')]||0x0;_0x4a2433['predictiveIntervalHitRate']=_0x253d0d>0x0?_0x253d0d:0x1;return _0x125314[_0xdb48('0x1d6')](_0x241911,_0x132e01,_0x33a02a,_0x253d0d,_0x52d93d);})[_0xdb48('0x95')](function(_0x3d16c5){return _0x3377e0(_0x3d16c5);})[_0xdb48('0x98')](function(_0x5e8122){return _0x41c78e(msgResponse(_0xdb48('0x1df'),_0xdb48('0x8a'),JSON['stringify'](_0x5e8122)));});}}else{return _0x41c78e(msgResponse(_0xdb48('0x1d8'),'Failure',_0xdb48('0x1d9')));}});};};Dialer[_0xdb48('0x85')]['startMethodPredictive']=function(_0x4a4d69){var _0x376bd4=this;return function(){var _0x437a32=0x0;var _0x3c7e1f=Math['floor'](_0x4a4d69[_0xdb48('0x52')]*0x3e8);if(_0x3c7e1f>0x0){_0x3c7e1f=_0x3c7e1f<0x64?0x64:_0x3c7e1f;loggerPredictive[_0xdb48('0x42')](_0x4a4d69[_0xdb48('0x3f')],_0xdb48('0x1e0'),_0x3c7e1f,_0xdb48('0x1e1'));_0x4a4d69[_0xdb48('0x5b')]=setInterval(function(){_0x376bd4[_0xdb48('0x5b')](_0x4a4d69);loggerPredictiveCalls['info'](_0xdb48('0x1e2'),_0x437a32+=0x1);},_0x3c7e1f);}else{loggerPredictive[_0xdb48('0x42')](_0x4a4d69['name'],_0xdb48('0x1e3'));}};};Dialer[_0xdb48('0x85')][_0xdb48('0x1e4')]=function(_0x404922,_0x2d9fdb){var _0x2b4428=this;return function(_0x2ddcca){if(_[_0xdb48('0x41')](_0x2ddcca)){if(_[_0xdb48('0xf6')](_0x2d9fdb['UserId'])||!_0x2d9fdb[_0xdb48('0x1e5')]){if(_0x404922[_0xdb48('0xab')]===_0xdb48('0x9')){_0x404922['queueStatusComplete']=_['isUndefined'](_0x404922[_0xdb48('0x6c')])?!![]:_0x404922[_0xdb48('0x6c')];var _0x8332ac=uuid['v4']();_0x2b4428[_0xdb48('0x22')][_0x8332ac]=new Action(_0x404922,_0x2d9fdb,_0x8332ac);loggerBooked[_0xdb48('0x42')](_0xdb48('0x1e6'),_0x8332ac,_0xdb48('0x1e7'),JSON[_0xdb48('0x7c')](_0x404922[_0xdb48('0x6c')]),_0xdb48('0x1e8'),_0x404922[_0xdb48('0x3f')]);if(_0x404922[_0xdb48('0x6c')]){_0x404922['queueStatusComplete']=![];_0x2b4428[_0xdb48('0x27')][_0x2b4428['actions'][_0x8332ac][_0xdb48('0xbb')]]=[];ami[_0xdb48('0x99')]({'actionid':_0x8332ac,'action':_0xdb48('0x1e9'),'queue':_0x404922[_0xdb48('0x3f')]})[_0xdb48('0x98')](function(){_0x2b4428[_0xdb48('0xc0')](_0x404922);hopperUtils[_0xdb48('0xde')]({'active':![],'ContactId':_0x2b4428[_0xdb48('0x22')][_0x8332ac][_0xdb48('0xe0')],'ListId':_0x2b4428[_0xdb48('0x22')][_0x8332ac][_0xdb48('0xe1')],'VoiceQueueId':_0x2b4428['actions'][_0x8332ac][_0xdb48('0xe2')]||undefined,'CampaignId':_0x2b4428['actions'][_0x8332ac][_0xdb48('0xe3')]||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x1ea')));delete _0x2b4428[_0xdb48('0x22')][_0x8332ac];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xdb48('0x7c')](_0x404922['queueStatusComplete']),_0xdb48('0x1e8'),_0x404922['name']);_0x2b4428[_0xdb48('0xc0')](_0x404922);hopperUtils[_0xdb48('0xde')]({'active':![],'ContactId':_0x2b4428[_0xdb48('0x22')][_0x8332ac][_0xdb48('0xe0')],'ListId':_0x2b4428['actions'][_0x8332ac][_0xdb48('0xe1')],'VoiceQueueId':_0x2b4428[_0xdb48('0x22')][_0x8332ac][_0xdb48('0xe2')]||undefined,'CampaignId':_0x2b4428[_0xdb48('0x22')][_0x8332ac]['CampaignId']||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x1ea')));delete _0x2b4428['actions'][_0x8332ac];}}else{return _0x2b4428[_0xdb48('0x15c')](_0x404922,_0x2d9fdb);}}else{if(utils[_0xdb48('0xce')](undefined,_0x2d9fdb[_0xdb48('0x1eb')])<_0x404922['dialRecallMeTimeout']*0x3c){if(_0x2d9fdb[_0xdb48('0x148')]&&!_0x2d9fdb[_0xdb48('0x148')][_0xdb48('0x1ec')]){_0x2b4428[_0xdb48('0x1d')][_0xdb48('0xff')](_0x2d9fdb['id'])[_0xdb48('0x1c')](function(){_0x2b4428['updateOriginated'](_0x404922);});}else{hopperUtils[_0xdb48('0x1ed')]({'active':![]},_0x2d9fdb['id'],0x1)[_0xdb48('0x1c')](function(){_0x2b4428[_0xdb48('0xc0')](_0x404922);});}}else{_0x404922[_0xdb48('0x1ee')]+=0x1;_0x2b4428[_0xdb48('0xc0')](_0x404922);if(_0x404922['dialRecallInQueue']){hopperUtils[_0xdb48('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2d9fdb['ContactId'],'ListId':_0x2d9fdb[_0xdb48('0xe1')],'VoiceQueueId':_0x2d9fdb[_0xdb48('0xe2')]||undefined,'CampaignId':_0x2d9fdb['CampaignId']||undefined})[_0xdb48('0x98')](loggerCatch(_0xdb48('0x1ef')));hopperUtils[_0xdb48('0xe6')](createObjHistory(_0x404922,_0x2d9fdb,utils['CAMPAIGN_STATUS'][_0xdb48('0x1f0')],0x17,_0xdb48('0x1f1')))[_0xdb48('0x98')](loggerCatch(_0xdb48('0x1f2')));}else{_0x2b4428[_0xdb48('0x11c')](createObjHistory(_0x404922,_0x2d9fdb,utils[_0xdb48('0x63')]['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),_0xdb48('0x1f3'),'[Originate][HistoryRecallClose]');}}}}else{_0x404922[_0xdb48('0x1f4')]+=0x1;_0x2b4428[_0xdb48('0x11c')](createObjHistory(_0x404922,_0x2d9fdb,utils['CAMPAIGN_STATUS'][_0xdb48('0x1f5')],0xd,_0xdb48('0x1f6')),_0xdb48('0x1f7'),_0xdb48('0x1f8'));throw _0xdb48('0x1f9');}};};Dialer[_0xdb48('0x85')]['handleIvr']=function(_0x28ca60){var _0x386d28=this;var _0x178652=_0x28ca60[_0xdb48('0x1fa')]-_0x28ca60[_0xdb48('0x77')];emitCampaignSummary(_0x28ca60);if(_0x178652>0x0&&_0x28ca60['temp']==0x0){if(_0x178652>this[_0xdb48('0x21')]){_0x178652=this[_0xdb48('0x21')];}_0x28ca60[_0xdb48('0x60')]=0x1;hopperUtils[_0xdb48('0x1fb')](_0x28ca60,_0x178652)[_0xdb48('0x95')](function(_0x1b7003){_0x28ca60[_0xdb48('0x60')]=0x0;if(_0x1b7003){if(!utils['checkContactEmpty'](_0x1b7003)){_0x28ca60[_0xdb48('0x62')]=utils[_0xdb48('0x63')][_0xdb48('0x66')];logger['info'](_0xdb48('0x1fc')+_0x28ca60['name']);}else{_0x28ca60['originated']+=_0x1b7003['length'];_0x28ca60['message']=utils[_0xdb48('0x63')]['RUNNING'];for(var _0x144664=0x0;_0x144664<_0x1b7003['length'];_0x144664+=0x1){_0x28ca60[_0xdb48('0x1fd')]+=0x1;if(_['isNil'](_0x1b7003[_0x144664])||_[_0xdb48('0xf6')](_0x1b7003[_0x144664][_0xdb48('0x177')])||_[_0xdb48('0xf6')](_0x1b7003[_0x144664][_0xdb48('0x160')])){_0x386d28[_0xdb48('0x154')]('[actionOriginate]\x20',_0x28ca60,_0x1b7003[_0x144664]);}else{hopperUtils[_0xdb48('0x1fe')](_[_0xdb48('0xfa')](_0x1b7003[_0x144664],[_0xdb48('0xe3'),_0xdb48('0x160')]))['then'](_0x386d28[_0xdb48('0x1e4')](_0x28ca60,_0x1b7003[_0x144664]))['catch'](_0x386d28[_0xdb48('0x153')](_0xdb48('0x1ff'),_0x28ca60));}}}}})[_0xdb48('0x98')](loggerGetContactDialer(_0xdb48('0x200'),_0x28ca60,_0x178652));}};Dialer[_0xdb48('0x85')][_0xdb48('0xad')]=function(_0x17a5ce,_0x413dca){var _0x47b186=this;var _0x1757be=[];if(_0x413dca<0x1||_0x17a5ce[_0xdb48('0xab')]===_0xdb48('0x9')){_0x413dca=0x1;}var _0x2edca8=Math['floor'](_0x17a5ce[_0xdb48('0x13b')]*_0x413dca)-_0x17a5ce[_0xdb48('0x77')];if(_0x17a5ce['dialLimitQueue']>0x0){var _0x4fa93f=_0x17a5ce['dialLimitQueue']-_0x17a5ce[_0xdb48('0x77')]-_0x17a5ce[_0xdb48('0x13d')]-_0x17a5ce['pTalking'];if(_0x2edca8>_0x4fa93f){_0x2edca8=_0x4fa93f;}}if(_0x2edca8>0x0&&_0x17a5ce[_0xdb48('0x60')]==0x0){if(_0x17a5ce[_0xdb48('0xab')]===_0xdb48('0x9')){_0x2edca8=0x1;}if(_0x2edca8>this[_0xdb48('0x21')]){_0x2edca8=this[_0xdb48('0x21')];}for(var _0x489990 in this[_0xdb48('0x1f')]){if(typeof this['agents'][_0x489990]!==_0xdb48('0xa2')){if(this['agents'][_0x489990][_0xdb48('0x68')]===_0xdb48('0x201')&&this[_0xdb48('0x1f')][_0x489990]['status']===_0xdb48('0x145')){_0x1757be[_0xdb48('0xf9')](this[_0xdb48('0x1f')][_0x489990]['id']);}}}_0x17a5ce[_0xdb48('0x60')]=0x1;hopperUtils[_0xdb48('0x202')](_0x17a5ce,_0x1757be,_0x2edca8)[_0xdb48('0x95')](function(_0x20360f){_0x17a5ce['temp']=0x0;if(_0x20360f){if(!utils[_0xdb48('0x203')](_0x20360f)){hopperUtils[_0xdb48('0x204')](_0x17a5ce)[_0xdb48('0x95')](sendMessageReschedule(_0x17a5ce))[_0xdb48('0x98')](loggerCatch('[countReScheduled]\x20'));}else{_0x17a5ce[_0xdb48('0x77')]+=_0x20360f[_0xdb48('0x91')];_0x17a5ce[_0xdb48('0x62')]=_0x17a5ce[_0xdb48('0xab')]==='booked'?utils[_0xdb48('0x63')][_0xdb48('0x168')]:utils[_0xdb48('0x63')][_0xdb48('0x205')];for(var _0x5f10d2=0x0;_0x5f10d2<_0x20360f[_0xdb48('0x91')];_0x5f10d2+=0x1){if(_[_0xdb48('0xf6')](_0x20360f[_0x5f10d2])||_[_0xdb48('0xf6')](_0x20360f[_0x5f10d2][_0xdb48('0x177')])||_[_0xdb48('0xf6')](_0x20360f[_0x5f10d2][_0xdb48('0x160')])){_0x47b186[_0xdb48('0x154')](_0xdb48('0x206'),_0x17a5ce,_0x20360f[_0x5f10d2]);}else{hopperUtils[_0xdb48('0x207')](_['pick'](_0x20360f[_0x5f10d2],[_0xdb48('0xe2'),_0xdb48('0x160')]))[_0xdb48('0x95')](_0x47b186[_0xdb48('0x1e4')](_0x17a5ce,_0x20360f[_0x5f10d2]))['catch'](_0x47b186[_0xdb48('0x153')]('[actionOriginate]\x20',_0x17a5ce));}}}}})[_0xdb48('0x98')](loggerGetContactDialer('[getContactDialer2]',_0x17a5ce,_0x2edca8));}};Dialer[_0xdb48('0x85')][_0xdb48('0x5b')]=function(_0x207260){if(_0x207260[_0xdb48('0x208')]>0x0){var _0x141c04=_0x207260[_0xdb48('0x208')]-_0x207260[_0xdb48('0x77')]-_0x207260[_0xdb48('0x13d')];if(_0x141c04>0x0&&_0x207260[_0xdb48('0x60')]==0x0){this[_0xdb48('0x209')](_0x207260);}else{loggerPredictiveCalls['info'](_0xdb48('0x20a'));}}else{this['tryOriginatePredictive'](_0x207260);}};Dialer[_0xdb48('0x85')][_0xdb48('0x209')]=function(_0x39c776){var _0x432dba=this;var _0xdd6a8e=[];_0x39c776['originated']+=0x1;for(var _0x5c7f59 in this['agents']){if(typeof this[_0xdb48('0x1f')][_0x5c7f59]!=='undefined'){if(this[_0xdb48('0x1f')][_0x5c7f59][_0xdb48('0x68')]===_0xdb48('0x201')&&this[_0xdb48('0x1f')][_0x5c7f59]['status']===_0xdb48('0x145')){_0xdd6a8e[_0xdb48('0xf9')](this[_0xdb48('0x1f')][_0x5c7f59]['id']);}}}_0x39c776['temp']=0x1;return this['getContactDialer'](_0x39c776['id'],_0xdd6a8e,0x1,_0x39c776[_0xdb48('0x20b')],_0x39c776)[_0xdb48('0x95')](function(_0x592c5c){_0x39c776[_0xdb48('0x60')]=0x1;if(_0x592c5c){if(!utils['checkContactEmpty'](_0x592c5c)){utils[_0xdb48('0x5f')](_0x39c776,0x1,0x0);return hopperUtils['countReScheduled'](_0x39c776)[_0xdb48('0x95')](sendMessageReschedule(_0x39c776))[_0xdb48('0x98')](loggerCatch('[countReScheduled]\x20'));}else{_0x39c776['message']=utils[_0xdb48('0x63')]['RUNNING'];if(_[_0xdb48('0xf6')](_0x592c5c[0x0])||_[_0xdb48('0xf6')](_0x592c5c[0x0][_0xdb48('0x177')])||_[_0xdb48('0xf6')](_0x592c5c[0x0][_0xdb48('0x160')])){_0x432dba[_0xdb48('0x154')](_0xdb48('0x206'),_0x39c776,_0x592c5c[0x0]);}else{return hopperUtils[_0xdb48('0x207')](_['pick'](_0x592c5c[0x0],[_0xdb48('0xe2'),_0xdb48('0x160')]))['then'](_0x432dba[_0xdb48('0x1e4')](_0x39c776,_0x592c5c[0x0]))[_0xdb48('0x98')](_0x432dba[_0xdb48('0x153')](_0xdb48('0x20c'),_0x39c776));}}}})[_0xdb48('0x98')](loggerGetContactDialer(_0xdb48('0x20d'),_0x39c776,0x1));};Dialer[_0xdb48('0x85')][_0xdb48('0x1d4')]=function(_0x7c7474,_0x5204b0,_0x11f6a2,_0x4d2983,_0x5446b2,_0x5bd5bd){loggerPredictive[_0xdb48('0x42')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xdb48('0x42')](_0xdb48('0x20e'),_0x7c7474);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x20f'),_0x5204b0);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x210'),_0x11f6a2);loggerPredictive[_0xdb48('0x42')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d2983);loggerPredictive[_0xdb48('0x42')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5446b2);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x4a'));return new Promise(function(_0x34c349,_0x1c88d8){if(_0x7c7474<=0x0||isNaN(_0x7c7474)){return _0x1c88d8(msgResponse('[abandonmentRate]',_0xdb48('0xb9'),_0xdb48('0x211')+_0x7c7474));}if(_0x11f6a2<=0x0||isNaN(_0x11f6a2)){return _0x1c88d8(msgResponse('[abandonmentRate]',_0xdb48('0xb9'),'Ts\x20=\x20'+_0x11f6a2));}if(_0x4d2983<=0x0||isNaN(_0x4d2983)){return _0x1c88d8(msgResponse(_0xdb48('0x212'),'Error','p\x20=\x20'+_0x4d2983));}if(_0x5204b0<=0x0||isNaN(_0x5204b0)){return _0x1c88d8(msgResponse(_0xdb48('0x212'),_0xdb48('0xb9'),_0xdb48('0x213')+_0x5204b0));}if(_0x5446b2<=0x0||isNaN(_0x5446b2)){return _0x1c88d8(msgResponse(_0xdb48('0x212'),_0xdb48('0xb9'),'Amax\x20=\x20'+_0x5446b2));}_0x5bd5bd=_0x5bd5bd||0x0;var _0x3c198d=0x1/_0x11f6a2;var _0x592f89=0x0;var _0x15b4b9=0x0;var _0x181cfe=0x0;var _0x36b582=0x0;for(var _0x407729=0x0;_0x181cfe<_0x5446b2;_0x407729+=0x1){_0x15b4b9=_0x407729/_0x5204b0;_0x592f89=(_0x4d2983*_0x15b4b9+_0x5bd5bd)/_0x3c198d;_0x181cfe=utils[_0xdb48('0x214')](_0x592f89,_0x7c7474);_0x36b582=_0x592f89/_0x7c7474*(0x1-utils[_0xdb48('0x214')](_0x592f89,_0x7c7474));}return _0x34c349({'erlangCalls':_0x407729,'erlangCallToSecond':_0x5204b0/_0x407729,'erlangAbandonmentRate':_0x181cfe,'erlangBusyFactor':_0x36b582});});};Dialer[_0xdb48('0x85')][_0xdb48('0x1d6')]=function(_0x42d404,_0x31cc51,_0x5d93c4,_0x173e7d,_0x15e7f3,_0x4dd0a5){loggerPredictive[_0xdb48('0x42')](_0xdb48('0x215'));loggerPredictive[_0xdb48('0x42')](_0xdb48('0x20e'),_0x42d404);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x20f'),_0x31cc51);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x210'),_0x5d93c4);loggerPredictive[_0xdb48('0x42')](_0xdb48('0x216'),_0x173e7d);loggerPredictive[_0xdb48('0x42')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x15e7f3);loggerPredictive[_0xdb48('0x42')]('---------------------------');return new Promise(function(_0xafdb29,_0x423976){if(_0x42d404<=0x0||isNaN(_0x42d404)){return _0x423976(msgResponse(_0xdb48('0x217'),'Error','m\x20=\x20'+_0x42d404));}if(_0x5d93c4<=0x0||isNaN(_0x5d93c4)){return _0x423976(msgResponse(_0xdb48('0x217'),_0xdb48('0xb9'),_0xdb48('0x218')+_0x5d93c4));}if(_0x173e7d<=0x0||isNaN(_0x173e7d)){return _0x423976(msgResponse('[busyFactor]',_0xdb48('0xb9'),_0xdb48('0x219')+_0x173e7d));}if(_0x31cc51<=0x0||isNaN(_0x31cc51)){return _0x423976(msgResponse(_0xdb48('0x217'),_0xdb48('0xb9'),'interval\x20=\x20'+_0x31cc51));}if(_0x15e7f3<=0x0||isNaN(_0x15e7f3)){return _0x423976(msgResponse(_0xdb48('0x217'),_0xdb48('0xb9'),_0xdb48('0x21a')+_0x15e7f3));}_0x4dd0a5=_0x4dd0a5||0x0;var _0x1e6315=0x1/_0x5d93c4;var _0x59ce5e=0x0;var _0x29ea94=0x0;var _0x523abd=0x0;var _0x1ad359=0x0;for(var _0x202942=0x0;_0x1ad359<_0x15e7f3;_0x202942+=0x1){_0x29ea94=_0x202942/_0x31cc51;_0x59ce5e=(_0x173e7d*_0x29ea94+_0x4dd0a5)/_0x1e6315;_0x523abd=utils[_0xdb48('0x214')](_0x59ce5e,_0x42d404);_0x1ad359=_0x59ce5e/_0x42d404*(0x1-utils['erlangb'](_0x59ce5e,_0x42d404));}return _0xafdb29({'erlangCalls':_0x202942,'erlangCallToSecond':_0x31cc51/_0x202942,'erlangAbandonmentRate':_0x523abd,'erlangBusyFactor':_0x1ad359});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 75bca1a..c9a2125 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97ec=['ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x730686,_0x574da8){var _0x1576f1=function(_0x5876f3){while(--_0x5876f3){_0x730686['push'](_0x730686['shift']());}};_0x1576f1(++_0x574da8);}(_0x97ec,0x6f));var _0xc97e=function(_0x10f18e,_0x35e787){_0x10f18e=_0x10f18e-0x0;var _0xc350f0=_0x97ec[_0x10f18e];return _0xc350f0;};'use strict';var util=require(_0xc97e('0x0'));var _=require(_0xc97e('0x1'));var moment=require(_0xc97e('0x2'));function checkNameSurname(_0x3bc43e,_0x6d463a,_0x35b4d6){var _0x2b012b='';if(!_['isNil'](_0x6d463a)&&'string'===typeof _0x6d463a){_0x2b012b+=_0x6d463a;}if(!_[_0xc97e('0x3')](_0x35b4d6)&&_0xc97e('0x4')===typeof _0x35b4d6){_0x2b012b+='\x20'+_0x35b4d6;}if(_0x2b012b!==''){return _0x2b012b;}return _0x3bc43e;}function Action(_0x1889b1,_0x581ab7,_0x41e6ca){this[_0xc97e('0x5')]=_0x1889b1;this[_0xc97e('0x6')]=_0x41e6ca||undefined;this[_0xc97e('0x7')]=checkNameSurname(_0x581ab7[_0xc97e('0x8')][_0xc97e('0x9')],_0x581ab7[_0xc97e('0x8')][_0xc97e('0xa')],_0x581ab7['Contact'][_0xc97e('0xb')]);this[_0xc97e('0xc')]=_0x581ab7['phone'];this[_0xc97e('0xd')]=_0x1889b1['name'];this[_0xc97e('0xe')]=_0x581ab7[_0xc97e('0xe')]||![];this[_0xc97e('0xf')]=_0x1889b1[_0xc97e('0xf')];this[_0xc97e('0x10')]=_0x1889b1[_0xc97e('0x10')]||0x3;this['scheduledat']=_0x581ab7[_0xc97e('0x11')];this[_0xc97e('0x12')]=_0x581ab7[_0xc97e('0x12')];this[_0xc97e('0x13')]=_0x581ab7[_0xc97e('0x13')];this[_0xc97e('0x14')]=_0x581ab7['countnoanswerretry'];this[_0xc97e('0x15')]=_0x581ab7[_0xc97e('0x15')];this[_0xc97e('0x16')]=_0x581ab7['countdropretry'];this[_0xc97e('0x17')]=_0x581ab7[_0xc97e('0x17')];this['countmachineretry']=_0x581ab7[_0xc97e('0x18')];this[_0xc97e('0x19')]=_0x581ab7[_0xc97e('0x19')];this[_0xc97e('0x1a')]=_0x581ab7[_0xc97e('0x1a')];this['ListId']=_0x581ab7[_0xc97e('0x1b')];this[_0xc97e('0x1c')]=_0x581ab7[_0xc97e('0x1c')];this['VoiceQueueId']=_0x581ab7[_0xc97e('0x1d')];this[_0xc97e('0x1e')]=_0x581ab7[_0xc97e('0x1e')];this[_0xc97e('0x1f')]=_0x581ab7['id'];this['ContactFirstName']=_0x581ab7['Contact'][_0xc97e('0xa')]||'';this[_0xc97e('0x20')]=moment()['format'](_0xc97e('0x21'));this[_0xc97e('0x22')]=_0x581ab7[_0xc97e('0x22')];this[_0xc97e('0x23')]=_0x581ab7['callbackuniqueid'];this[_0xc97e('0x24')]=_0x581ab7['callbackat'];this[_0xc97e('0x25')]=_0x581ab7['recallme'];this['originatecalleridnum']='';this[_0xc97e('0x26')]='';}Action[_0xc97e('0x27')][_0xc97e('0x28')]=function(){return util[_0xc97e('0x29')](_0xc97e('0x2a'),this[_0xc97e('0x7')],this[_0xc97e('0x5')][_0xc97e('0x2b')]>0x0?this[_0xc97e('0xc')][_0xc97e('0x2c')](this['voiceQueue']['dialCutDigit']):this[_0xc97e('0xc')]);};Action[_0xc97e('0x27')][_0xc97e('0x2d')]=function(){return this[_0xc97e('0xd')];};module['exports']=Action; \ No newline at end of file +var _0x7b48=['firstName','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','number','substring','util','lodash','moment','isNil','voiceQueue','Contact'];(function(_0x487b00,_0x25186c){var _0x3b9ecb=function(_0x1a6bdb){while(--_0x1a6bdb){_0x487b00['push'](_0x487b00['shift']());}};_0x3b9ecb(++_0x25186c);}(_0x7b48,0xc7));var _0x87b4=function(_0x5b8155,_0x51c636){_0x5b8155=_0x5b8155-0x0;var _0x1d6f07=_0x7b48[_0x5b8155];return _0x1d6f07;};'use strict';var util=require(_0x87b4('0x0'));var _=require(_0x87b4('0x1'));var moment=require(_0x87b4('0x2'));function checkNameSurname(_0x368dca,_0x4c7ec3,_0xd03fb9){var _0x2832a7='';if(!_[_0x87b4('0x3')](_0x4c7ec3)&&'string'===typeof _0x4c7ec3){_0x2832a7+=_0x4c7ec3;}if(!_[_0x87b4('0x3')](_0xd03fb9)&&'string'===typeof _0xd03fb9){_0x2832a7+='\x20'+_0xd03fb9;}if(_0x2832a7!==''){return _0x2832a7;}return _0x368dca;}function Action(_0x540eda,_0x274b2f,_0x1b4f45){this[_0x87b4('0x4')]=_0x540eda;this['uniqueid']=_0x1b4f45||undefined;this['name']=checkNameSurname(_0x274b2f['Contact']['phone'],_0x274b2f[_0x87b4('0x5')][_0x87b4('0x6')],_0x274b2f['Contact']['lastName']);this['number']=_0x274b2f[_0x87b4('0x7')];this[_0x87b4('0x8')]=_0x540eda[_0x87b4('0x9')];this[_0x87b4('0xa')]=_0x274b2f['active']||![];this[_0x87b4('0xb')]=_0x540eda['type'];this['dialQueueTimeout']=_0x540eda[_0x87b4('0xc')]||0x3;this[_0x87b4('0xd')]=_0x274b2f[_0x87b4('0xd')];this[_0x87b4('0xe')]=_0x274b2f[_0x87b4('0xe')];this['countcongestionretry']=_0x274b2f[_0x87b4('0xf')];this['countnoanswerretry']=_0x274b2f[_0x87b4('0x10')];this[_0x87b4('0x11')]=_0x274b2f[_0x87b4('0x11')];this[_0x87b4('0x12')]=_0x274b2f[_0x87b4('0x12')];this[_0x87b4('0x13')]=_0x274b2f[_0x87b4('0x13')];this['countmachineretry']=_0x274b2f['countmachineretry'];this[_0x87b4('0x14')]=_0x274b2f[_0x87b4('0x14')];this[_0x87b4('0x15')]=_0x274b2f[_0x87b4('0x15')];this[_0x87b4('0x16')]=_0x274b2f[_0x87b4('0x16')];this[_0x87b4('0x17')]=_0x274b2f[_0x87b4('0x17')];this[_0x87b4('0x18')]=_0x274b2f[_0x87b4('0x18')];this['CampaignId']=_0x274b2f[_0x87b4('0x19')];this[_0x87b4('0x1a')]=_0x274b2f['id'];this['ContactFirstName']=_0x274b2f['Contact'][_0x87b4('0x6')]||'';this[_0x87b4('0x1b')]=moment()[_0x87b4('0x1c')](_0x87b4('0x1d'));this['callback']=_0x274b2f[_0x87b4('0x1e')];this['callbackuniqueid']=_0x274b2f[_0x87b4('0x1f')];this[_0x87b4('0x20')]=_0x274b2f[_0x87b4('0x20')];this[_0x87b4('0x21')]=_0x274b2f[_0x87b4('0x21')];this[_0x87b4('0x22')]='';this[_0x87b4('0x23')]='';}Action[_0x87b4('0x24')][_0x87b4('0x25')]=function(){return util[_0x87b4('0x1c')]('\x22%s\x22\x20<%s>',this[_0x87b4('0x9')],this[_0x87b4('0x4')][_0x87b4('0x26')]>0x0?this[_0x87b4('0x27')][_0x87b4('0x28')](this['voiceQueue'][_0x87b4('0x26')]):this['number']);};Action['prototype']['getQueue']=function(){return this[_0x87b4('0x8')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 856b6ea..af3b046 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x816f=['countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','reason','callback','callbackat','recallme','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry'];(function(_0x25280c,_0x2edec1){var _0x3a58c3=function(_0x5292a0){while(--_0x5292a0){_0x25280c['push'](_0x25280c['shift']());}};_0x3a58c3(++_0x2edec1);}(_0x816f,0x12b));var _0xf816=function(_0x3eaf4e,_0x1e0d77){_0x3eaf4e=_0x3eaf4e-0x0;var _0x48d45e=_0x816f[_0x3eaf4e];return _0x48d45e;};'use strict';var moment=require('moment');var utils=require(_0xf816('0x0'));function AgentComplete(_0x34395f,_0x211a75){this[_0xf816('0x1')]=0x4;this[_0xf816('0x2')]='Answer';this[_0xf816('0x3')]=_0x34395f[_0xf816('0x3')];this[_0xf816('0x4')]=_0x34395f['type'];this['campaigntype']=_0x34395f[_0xf816('0x4')]===_0xf816('0x5')?_0xf816('0x6'):_0x34395f['type'];this[_0xf816('0x7')]=_0x34395f[_0xf816('0x7')];this[_0xf816('0x8')]=_0x34395f['countcongestionretry'];this[_0xf816('0x9')]=_0x34395f[_0xf816('0x9')];this[_0xf816('0xa')]=_0x34395f[_0xf816('0x7')]+_0x34395f[_0xf816('0x8')]+_0x34395f[_0xf816('0x9')]+_0x34395f[_0xf816('0xb')]+_0x34395f['countdropretry']+_0x34395f[_0xf816('0xc')]+_0x34395f[_0xf816('0xd')]+_0x34395f[_0xf816('0xe')];this['countnosuchnumberretry']=_0x34395f[_0xf816('0xb')];this[_0xf816('0xf')]=_0x34395f[_0xf816('0xf')];this['countabandonedretry']=_0x34395f['countabandonedretry'];this[_0xf816('0xd')]=_0x34395f[_0xf816('0xd')];this['countagentrejectretry']=_0x34395f['countagentrejectretry'];this[_0xf816('0x10')]=_0x211a75[_0xf816('0x10')];this['calleridname']=_0x34395f[_0xf816('0x11')];this[_0xf816('0x12')]=_0x34395f[_0xf816('0x13')];this[_0xf816('0x14')]=_0x34395f['starttime'];this[_0xf816('0x15')]=_0x34395f[_0xf816('0x15')];this[_0xf816('0x16')]=_0x34395f[_0xf816('0x16')];this[_0xf816('0x17')]=moment()['format'](_0xf816('0x18'));this['ringtime']=utils[_0xf816('0x19')](_0x34395f[_0xf816('0x15')],_0x34395f[_0xf816('0x14')]);this[_0xf816('0x1a')]=utils[_0xf816('0x19')](_0x34395f['answertime'],_0x34395f[_0xf816('0x15')]);this[_0xf816('0x1b')]=utils[_0xf816('0x19')](this[_0xf816('0x17')],_0x34395f[_0xf816('0x16')]);this['queue']=_0x211a75[_0xf816('0x6')];this[_0xf816('0x1c')]=_0x211a75[_0xf816('0x1c')];this[_0xf816('0x1d')]=_0x211a75['reason'];this[_0xf816('0x1e')]=_0x34395f[_0xf816('0x1e')];this['callbackuniqueid']=_0x34395f['callbackuniqueid'];this[_0xf816('0x1f')]=_0x34395f[_0xf816('0x1f')];this[_0xf816('0x20')]=_0x34395f['recallme'];this['ContactId']=_0x34395f['ContactId'];this['ListId']=_0x34395f['ListId'];this['UserId']=_0x34395f['UserId'];this[_0xf816('0x21')]=_0x34395f[_0xf816('0x21')];this[_0xf816('0x22')]=_0x34395f[_0xf816('0x22')];this['originatecalleridnum']=_0x34395f[_0xf816('0x23')]||'';this[_0xf816('0x24')]=_0x34395f[_0xf816('0x24')]||'';this[_0xf816('0x25')]=_0x34395f[_0xf816('0x25')];}module[_0xf816('0x26')]=AgentComplete; \ No newline at end of file +var _0xefb7=['scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer'];(function(_0x2dc0e5,_0x4a77ca){var _0x5c0ea5=function(_0x312c86){while(--_0x312c86){_0x2dc0e5['push'](_0x2dc0e5['shift']());}};_0x5c0ea5(++_0x4a77ca);}(_0xefb7,0x1b4));var _0x7efb=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0xefb7[_0x3ec122];return _0x4ecf41;};'use strict';var moment=require('moment');var utils=require(_0x7efb('0x0'));function AgentComplete(_0x5c0b70,_0x175bf5){this[_0x7efb('0x1')]=0x4;this[_0x7efb('0x2')]=_0x7efb('0x3');this['scheduledat']=_0x5c0b70[_0x7efb('0x4')];this[_0x7efb('0x5')]=_0x5c0b70[_0x7efb('0x5')];this[_0x7efb('0x6')]=_0x5c0b70[_0x7efb('0x5')]==='outbound'?'queue':_0x5c0b70[_0x7efb('0x5')];this[_0x7efb('0x7')]=_0x5c0b70[_0x7efb('0x7')];this[_0x7efb('0x8')]=_0x5c0b70[_0x7efb('0x8')];this['countnoanswerretry']=_0x5c0b70[_0x7efb('0x9')];this['countglobal']=_0x5c0b70['countbusyretry']+_0x5c0b70['countcongestionretry']+_0x5c0b70[_0x7efb('0x9')]+_0x5c0b70[_0x7efb('0xa')]+_0x5c0b70[_0x7efb('0xb')]+_0x5c0b70[_0x7efb('0xc')]+_0x5c0b70[_0x7efb('0xd')]+_0x5c0b70[_0x7efb('0xe')];this[_0x7efb('0xa')]=_0x5c0b70[_0x7efb('0xa')];this[_0x7efb('0xb')]=_0x5c0b70[_0x7efb('0xb')];this[_0x7efb('0xc')]=_0x5c0b70[_0x7efb('0xc')];this[_0x7efb('0xd')]=_0x5c0b70['countmachineretry'];this['countagentrejectretry']=_0x5c0b70[_0x7efb('0xe')];this[_0x7efb('0xf')]=_0x175bf5[_0x7efb('0xf')];this[_0x7efb('0x10')]=_0x5c0b70[_0x7efb('0x11')];this[_0x7efb('0x12')]=_0x5c0b70['number'];this[_0x7efb('0x13')]=_0x5c0b70[_0x7efb('0x13')];this[_0x7efb('0x14')]=_0x5c0b70['responsetime'];this[_0x7efb('0x15')]=_0x5c0b70['answertime'];this[_0x7efb('0x16')]=moment()['format'](_0x7efb('0x17'));this[_0x7efb('0x18')]=utils['getSeconds'](_0x5c0b70['responsetime'],_0x5c0b70['starttime']);this[_0x7efb('0x19')]=utils[_0x7efb('0x1a')](_0x5c0b70[_0x7efb('0x15')],_0x5c0b70[_0x7efb('0x14')]);this[_0x7efb('0x1b')]=utils['getSeconds'](this[_0x7efb('0x16')],_0x5c0b70[_0x7efb('0x15')]);this[_0x7efb('0x1c')]=_0x175bf5[_0x7efb('0x1c')];this[_0x7efb('0x1d')]=_0x175bf5[_0x7efb('0x1d')];this[_0x7efb('0x1e')]=_0x175bf5[_0x7efb('0x1e')];this[_0x7efb('0x1f')]=_0x5c0b70[_0x7efb('0x1f')];this[_0x7efb('0x20')]=_0x5c0b70[_0x7efb('0x20')];this[_0x7efb('0x21')]=_0x5c0b70['callbackat'];this[_0x7efb('0x22')]=_0x5c0b70['recallme'];this[_0x7efb('0x23')]=_0x5c0b70[_0x7efb('0x23')];this['ListId']=_0x5c0b70[_0x7efb('0x24')];this[_0x7efb('0x25')]=_0x5c0b70['UserId'];this[_0x7efb('0x26')]=_0x5c0b70[_0x7efb('0x26')];this[_0x7efb('0x27')]=_0x5c0b70[_0x7efb('0x27')];this[_0x7efb('0x28')]=_0x5c0b70[_0x7efb('0x28')]||'';this[_0x7efb('0x29')]=_0x5c0b70[_0x7efb('0x29')]||'';this[_0x7efb('0x2a')]=_0x5c0b70['agiafterat'];}module[_0x7efb('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index eb236f3..b18316a 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc52b=['statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state'];(function(_0x4e7980,_0x13ed4a){var _0x44e399=function(_0x1558e6){while(--_0x1558e6){_0x4e7980['push'](_0x4e7980['shift']());}};_0x44e399(++_0x13ed4a);}(_0xc52b,0x71));var _0xbc52=function(_0x15253f,_0x17a573){_0x15253f=_0x15253f-0x0;var _0x2e95a3=_0xc52b[_0x15253f];return _0x2e95a3;};'use strict';function Final(_0x5e9687){this[_0xbc52('0x0')]=_0x5e9687[_0xbc52('0x0')];this[_0xbc52('0x1')]=_0x5e9687[_0xbc52('0x1')];this['type']=_0x5e9687[_0xbc52('0x2')];this[_0xbc52('0x3')]=_0x5e9687[_0xbc52('0x2')]===_0xbc52('0x4')?_0xbc52('0x5'):_0x5e9687[_0xbc52('0x2')];this[_0xbc52('0x6')]=_0x5e9687[_0xbc52('0x6')];this[_0xbc52('0x7')]=_0x5e9687[_0xbc52('0x7')];this[_0xbc52('0x8')]=_0x5e9687[_0xbc52('0x8')];this[_0xbc52('0x9')]=_0x5e9687['countbusyretry']+_0x5e9687['countcongestionretry']+_0x5e9687['countnoanswerretry']+_0x5e9687[_0xbc52('0xa')]+_0x5e9687['countdropretry']+_0x5e9687[_0xbc52('0xb')]+_0x5e9687[_0xbc52('0xc')]+_0x5e9687['countagentrejectretry'];this[_0xbc52('0xa')]=_0x5e9687[_0xbc52('0xa')];this[_0xbc52('0xd')]=_0x5e9687[_0xbc52('0xd')];this[_0xbc52('0xb')]=_0x5e9687[_0xbc52('0xb')];this[_0xbc52('0xc')]=_0x5e9687[_0xbc52('0xc')];this[_0xbc52('0xe')]=_0x5e9687[_0xbc52('0xe')];this[_0xbc52('0x5')]=_0x5e9687[_0xbc52('0x5')];this[_0xbc52('0xf')]=_0x5e9687[_0xbc52('0xf')];this['calleridnum']=_0x5e9687[_0xbc52('0x10')];this[_0xbc52('0x11')]=_0x5e9687[_0xbc52('0x11')];this['responsetime']=_0x5e9687[_0xbc52('0x12')];this[_0xbc52('0x13')]=_0x5e9687[_0xbc52('0x12')];this[_0xbc52('0x14')]=_0x5e9687[_0xbc52('0x14')]||0x0;this[_0xbc52('0x15')]=_0x5e9687[_0xbc52('0x15')]||0x0;this[_0xbc52('0x16')]=_0x5e9687['talktime']||0x0;this['callback']=_0x5e9687[_0xbc52('0x17')];this[_0xbc52('0x18')]=_0x5e9687[_0xbc52('0x18')];this['callbackat']=_0x5e9687[_0xbc52('0x19')];this[_0xbc52('0x1a')]=_0x5e9687['recallme'];this[_0xbc52('0x1b')]=_0x5e9687[_0xbc52('0x1b')];this[_0xbc52('0x1c')]=_0x5e9687[_0xbc52('0x1c')];this[_0xbc52('0x1d')]=_0x5e9687[_0xbc52('0x1d')];this['VoiceQueueId']=_0x5e9687[_0xbc52('0x1e')];this['CampaignId']=_0x5e9687[_0xbc52('0x1f')];this[_0xbc52('0x20')]=_0x5e9687[_0xbc52('0x20')]||'';this[_0xbc52('0x21')]=_0x5e9687[_0xbc52('0x21')]||'';this[_0xbc52('0x22')]=_0x5e9687['state'];this[_0xbc52('0x23')]=_0x5e9687[_0xbc52('0x23')];}module[_0xbc52('0x24')]=Final; \ No newline at end of file +var _0x481f=['countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry'];(function(_0x17aef9,_0x3b6599){var _0x5d0fb5=function(_0x2a38b6){while(--_0x2a38b6){_0x17aef9['push'](_0x17aef9['shift']());}};_0x5d0fb5(++_0x3b6599);}(_0x481f,0x87));var _0xf481=function(_0x1d19ee,_0x29793b){_0x1d19ee=_0x1d19ee-0x0;var _0x40b1d1=_0x481f[_0x1d19ee];return _0x40b1d1;};'use strict';function Final(_0x31c6c6){this[_0xf481('0x0')]=_0x31c6c6['uniqueid'];this[_0xf481('0x1')]=_0x31c6c6[_0xf481('0x1')];this[_0xf481('0x2')]=_0x31c6c6[_0xf481('0x2')];this[_0xf481('0x3')]=_0x31c6c6[_0xf481('0x2')]===_0xf481('0x4')?_0xf481('0x5'):_0x31c6c6[_0xf481('0x2')];this[_0xf481('0x6')]=_0x31c6c6[_0xf481('0x6')];this[_0xf481('0x7')]=_0x31c6c6['countcongestionretry'];this['countnoanswerretry']=_0x31c6c6[_0xf481('0x8')];this[_0xf481('0x9')]=_0x31c6c6[_0xf481('0x6')]+_0x31c6c6[_0xf481('0x7')]+_0x31c6c6[_0xf481('0x8')]+_0x31c6c6[_0xf481('0xa')]+_0x31c6c6['countdropretry']+_0x31c6c6[_0xf481('0xb')]+_0x31c6c6[_0xf481('0xc')]+_0x31c6c6['countagentrejectretry'];this[_0xf481('0xa')]=_0x31c6c6[_0xf481('0xa')];this['countdropretry']=_0x31c6c6[_0xf481('0xd')];this['countabandonedretry']=_0x31c6c6[_0xf481('0xb')];this[_0xf481('0xc')]=_0x31c6c6[_0xf481('0xc')];this['countagentrejectretry']=_0x31c6c6[_0xf481('0xe')];this[_0xf481('0x5')]=_0x31c6c6[_0xf481('0x5')];this[_0xf481('0xf')]=_0x31c6c6[_0xf481('0xf')];this[_0xf481('0x10')]=_0x31c6c6[_0xf481('0x10')];this[_0xf481('0x11')]=_0x31c6c6[_0xf481('0x11')];this[_0xf481('0x12')]=_0x31c6c6[_0xf481('0x12')];this[_0xf481('0x13')]=_0x31c6c6[_0xf481('0x12')];this[_0xf481('0x14')]=_0x31c6c6[_0xf481('0x14')]||0x0;this[_0xf481('0x15')]=_0x31c6c6['holdtime']||0x0;this[_0xf481('0x16')]=_0x31c6c6[_0xf481('0x16')]||0x0;this[_0xf481('0x17')]=_0x31c6c6['callback'];this[_0xf481('0x18')]=_0x31c6c6[_0xf481('0x18')];this['callbackat']=_0x31c6c6[_0xf481('0x19')];this[_0xf481('0x1a')]=_0x31c6c6[_0xf481('0x1a')];this[_0xf481('0x1b')]=_0x31c6c6[_0xf481('0x1b')];this['ListId']=_0x31c6c6[_0xf481('0x1c')];this[_0xf481('0x1d')]=_0x31c6c6['UserId'];this['VoiceQueueId']=_0x31c6c6[_0xf481('0x1e')];this[_0xf481('0x1f')]=_0x31c6c6['CampaignId'];this[_0xf481('0x20')]=_0x31c6c6['originatecalleridnum']||'';this[_0xf481('0x21')]=_0x31c6c6[_0xf481('0x21')]||'';this[_0xf481('0x22')]=_0x31c6c6['state'];this[_0xf481('0x23')]=_0x31c6c6['statedesc'];}module[_0xf481('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 510c5a4..8408dd8 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc61=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','scheduledat','type','campaigntype','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat'];(function(_0x11dfd9,_0xcb009c){var _0x363ce6=function(_0x4f44d7){while(--_0x4f44d7){_0x11dfd9['push'](_0x11dfd9['shift']());}};_0x363ce6(++_0xcb009c);}(_0xdc61,0xd9));var _0x1dc6=function(_0x5ded13,_0x3ead28){_0x5ded13=_0x5ded13-0x0;var _0x1c35bf=_0xdc61[_0x5ded13];return _0x1c35bf;};'use strict';var moment=require(_0x1dc6('0x0'));var utils=require(_0x1dc6('0x1'));function Hangup(_0x4e5833,_0x918bdf){this[_0x1dc6('0x2')]=0x4;this[_0x1dc6('0x3')]='Answer';this['scheduledat']=_0x4e5833[_0x1dc6('0x4')];this['type']=_0x4e5833[_0x1dc6('0x5')];this[_0x1dc6('0x6')]=_0x4e5833[_0x1dc6('0x5')]==='outbound'?'queue':_0x4e5833[_0x1dc6('0x5')];this[_0x1dc6('0x7')]=_0x4e5833[_0x1dc6('0x7')]||![];this[_0x1dc6('0x8')]=_0x4e5833['countbusyretry'];this['countcongestionretry']=_0x4e5833[_0x1dc6('0x9')];this['countnoanswerretry']=_0x4e5833[_0x1dc6('0xa')];this[_0x1dc6('0xb')]=_0x4e5833[_0x1dc6('0x8')]+_0x4e5833[_0x1dc6('0x9')]+_0x4e5833[_0x1dc6('0xa')]+_0x4e5833[_0x1dc6('0xc')]+_0x4e5833[_0x1dc6('0xd')]+_0x4e5833[_0x1dc6('0xe')]+_0x4e5833['countmachineretry']+_0x4e5833['countagentrejectretry'];this[_0x1dc6('0xc')]=_0x4e5833[_0x1dc6('0xc')];this[_0x1dc6('0xd')]=_0x4e5833['countdropretry'];this['countabandonedretry']=_0x4e5833[_0x1dc6('0xe')];this[_0x1dc6('0xf')]=_0x4e5833[_0x1dc6('0xf')];this[_0x1dc6('0x10')]=_0x4e5833[_0x1dc6('0x10')];this['uniqueid']=_0x918bdf[_0x1dc6('0x11')];this[_0x1dc6('0x12')]=_0x4e5833['name'];this[_0x1dc6('0x13')]=_0x4e5833['number'];this[_0x1dc6('0x14')]=_0x4e5833[_0x1dc6('0x14')];this[_0x1dc6('0x15')]=_0x4e5833[_0x1dc6('0x15')];this[_0x1dc6('0x16')]=moment()[_0x1dc6('0x17')](_0x1dc6('0x18'));this[_0x1dc6('0x19')]=utils[_0x1dc6('0x1a')](_0x4e5833[_0x1dc6('0x15')],_0x4e5833[_0x1dc6('0x14')]);this[_0x1dc6('0x1b')]=0x0;this['talktime']=utils[_0x1dc6('0x1a')](this['endtime'],_0x4e5833[_0x1dc6('0x15')]);this[_0x1dc6('0x1c')]=_0x4e5833['queue'];this[_0x1dc6('0x1d')]=_0x1dc6('0x1e');this[_0x1dc6('0x1f')]=_0x918bdf['cause-txt'];this[_0x1dc6('0x20')]=_0x4e5833['callback'];this[_0x1dc6('0x21')]=_0x4e5833[_0x1dc6('0x21')];this[_0x1dc6('0x22')]=_0x4e5833[_0x1dc6('0x22')];this[_0x1dc6('0x23')]=_0x4e5833[_0x1dc6('0x23')];this[_0x1dc6('0x24')]=_0x4e5833[_0x1dc6('0x24')];this[_0x1dc6('0x25')]=_0x4e5833[_0x1dc6('0x25')];this[_0x1dc6('0x26')]=_0x4e5833[_0x1dc6('0x26')];this['VoiceQueueId']=_0x4e5833[_0x1dc6('0x27')];this[_0x1dc6('0x28')]=_0x4e5833[_0x1dc6('0x28')];}module[_0x1dc6('0x29')]=Hangup; \ No newline at end of file +var _0x5f19=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','IVR','reason','cause-txt','callback','callbackat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f19,0x87));var _0x95f1=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5f19[_0x465a0c];return _0x1e202e;};'use strict';var moment=require(_0x95f1('0x0'));var utils=require(_0x95f1('0x1'));function Hangup(_0xf15562,_0xd6c96a){this[_0x95f1('0x2')]=0x4;this[_0x95f1('0x3')]=_0x95f1('0x4');this[_0x95f1('0x5')]=_0xf15562['scheduledat'];this[_0x95f1('0x6')]=_0xf15562[_0x95f1('0x6')];this[_0x95f1('0x7')]=_0xf15562[_0x95f1('0x6')]===_0x95f1('0x8')?_0x95f1('0x9'):_0xf15562['type'];this[_0x95f1('0xa')]=_0xf15562[_0x95f1('0xa')]||![];this['countbusyretry']=_0xf15562[_0x95f1('0xb')];this['countcongestionretry']=_0xf15562['countcongestionretry'];this[_0x95f1('0xc')]=_0xf15562[_0x95f1('0xc')];this[_0x95f1('0xd')]=_0xf15562['countbusyretry']+_0xf15562[_0x95f1('0xe')]+_0xf15562[_0x95f1('0xc')]+_0xf15562[_0x95f1('0xf')]+_0xf15562[_0x95f1('0x10')]+_0xf15562[_0x95f1('0x11')]+_0xf15562[_0x95f1('0x12')]+_0xf15562['countagentrejectretry'];this[_0x95f1('0xf')]=_0xf15562[_0x95f1('0xf')];this[_0x95f1('0x10')]=_0xf15562[_0x95f1('0x10')];this['countabandonedretry']=_0xf15562[_0x95f1('0x11')];this[_0x95f1('0x12')]=_0xf15562[_0x95f1('0x12')];this[_0x95f1('0x13')]=_0xf15562[_0x95f1('0x13')];this[_0x95f1('0x14')]=_0xd6c96a[_0x95f1('0x14')];this[_0x95f1('0x15')]=_0xf15562[_0x95f1('0x16')];this['calleridnum']=_0xf15562['number'];this[_0x95f1('0x17')]=_0xf15562[_0x95f1('0x17')];this[_0x95f1('0x18')]=_0xf15562['responsetime'];this['endtime']=moment()[_0x95f1('0x19')](_0x95f1('0x1a'));this[_0x95f1('0x1b')]=utils[_0x95f1('0x1c')](_0xf15562['responsetime'],_0xf15562[_0x95f1('0x17')]);this[_0x95f1('0x1d')]=0x0;this[_0x95f1('0x1e')]=utils[_0x95f1('0x1c')](this[_0x95f1('0x1f')],_0xf15562[_0x95f1('0x18')]);this['queue']=_0xf15562[_0x95f1('0x9')];this['membername']=_0x95f1('0x20');this[_0x95f1('0x21')]=_0xd6c96a[_0x95f1('0x22')];this['callback']=_0xf15562[_0x95f1('0x23')];this['callbackuniqueid']=_0xf15562['callbackuniqueid'];this[_0x95f1('0x24')]=_0xf15562[_0x95f1('0x24')];this['recallme']=_0xf15562[_0x95f1('0x25')];this[_0x95f1('0x26')]=_0xf15562['ContactId'];this[_0x95f1('0x27')]=_0xf15562[_0x95f1('0x27')];this[_0x95f1('0x28')]=_0xf15562['UserId'];this['VoiceQueueId']=_0xf15562[_0x95f1('0x29')];this['CampaignId']=_0xf15562[_0x95f1('0x2a')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index fc8e236..9a44959 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b67=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','talktime'];(function(_0x502b8c,_0x456eed){var _0x1514bd=function(_0x500677){while(--_0x500677){_0x502b8c['push'](_0x502b8c['shift']());}};_0x1514bd(++_0x456eed);}(_0x0b67,0x1af));var _0x70b6=function(_0x3131bd,_0x38e0e5){_0x3131bd=_0x3131bd-0x0;var _0x596ca4=_0x0b67[_0x3131bd];return _0x596ca4;};'use strict';var utils=require(_0x70b6('0x0'));function History(_0x4299de){this[_0x70b6('0x1')]=_0x4299de['uniqueid'];this[_0x70b6('0x2')]=_0x4299de[_0x70b6('0x2')]||undefined;this[_0x70b6('0x3')]=_0x4299de[_0x70b6('0x3')];this[_0x70b6('0x4')]=_0x4299de[_0x70b6('0x3')]===_0x70b6('0x5')?'queue':_0x4299de['type'];this['countbusyretry']=_0x4299de[_0x70b6('0x6')];this[_0x70b6('0x7')]=_0x4299de['countcongestionretry'];this['countnoanswerretry']=_0x4299de['countnoanswerretry'];this[_0x70b6('0x8')]=_0x4299de[_0x70b6('0x6')]+_0x4299de[_0x70b6('0x7')]+_0x4299de[_0x70b6('0x9')]+_0x4299de[_0x70b6('0xa')]+_0x4299de[_0x70b6('0xb')]+_0x4299de['countabandonedretry']+_0x4299de[_0x70b6('0xc')]+_0x4299de[_0x70b6('0xd')];this['countnosuchnumberretry']=_0x4299de[_0x70b6('0xa')];this[_0x70b6('0xb')]=_0x4299de[_0x70b6('0xb')];this['countabandonedretry']=_0x4299de[_0x70b6('0xe')];this[_0x70b6('0xc')]=_0x4299de['countmachineretry'];this[_0x70b6('0xd')]=_0x4299de[_0x70b6('0xd')];this[_0x70b6('0xf')]=_0x4299de[_0x70b6('0xf')];this[_0x70b6('0x10')]=_0x4299de[_0x70b6('0x11')];this[_0x70b6('0x12')]=_0x4299de[_0x70b6('0x13')];this[_0x70b6('0x14')]=_0x4299de[_0x70b6('0x14')];this[_0x70b6('0x15')]=_0x4299de[_0x70b6('0x15')];this['endtime']=_0x4299de[_0x70b6('0x15')];this[_0x70b6('0x16')]=utils[_0x70b6('0x17')](_0x4299de[_0x70b6('0x15')],_0x4299de[_0x70b6('0x14')]);this['holdtime']=0x0;this[_0x70b6('0x18')]=0x0;this[_0x70b6('0x19')]=_0x4299de[_0x70b6('0x19')];this['callbackuniqueid']=_0x4299de['callbackuniqueid'];this[_0x70b6('0x1a')]=_0x4299de['callbackat'];this[_0x70b6('0x1b')]=_0x4299de[_0x70b6('0x1b')];this['ContactId']=_0x4299de[_0x70b6('0x1c')];this[_0x70b6('0x1d')]=_0x4299de[_0x70b6('0x1d')];this['UserId']=_0x4299de[_0x70b6('0x1e')];this[_0x70b6('0x1f')]=_0x4299de['VoiceQueueId'];this['CampaignId']=_0x4299de[_0x70b6('0x20')];this['originatecalleridnum']=_0x4299de[_0x70b6('0x21')]||'';this[_0x70b6('0x22')]=_0x4299de['originatecalleridname']||'';this['state']=_0x4299de[_0x70b6('0x23')];this[_0x70b6('0x24')]=_0x4299de['statedesc'];}module[_0x70b6('0x25')]=History; \ No newline at end of file +var _0xfb10=['exports','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc'];(function(_0x26d235,_0xcb48ff){var _0xb65ce2=function(_0x470155){while(--_0x470155){_0x26d235['push'](_0x26d235['shift']());}};_0xb65ce2(++_0xcb48ff);}(_0xfb10,0x1bb));var _0x0fb1=function(_0x5228a0,_0x316df7){_0x5228a0=_0x5228a0-0x0;var _0x5391eb=_0xfb10[_0x5228a0];return _0x5391eb;};'use strict';var utils=require('../utils');function History(_0x14b52e){this['uniqueid']=_0x14b52e[_0x0fb1('0x0')];this[_0x0fb1('0x1')]=_0x14b52e[_0x0fb1('0x1')]||undefined;this[_0x0fb1('0x2')]=_0x14b52e[_0x0fb1('0x2')];this['campaigntype']=_0x14b52e['type']==='outbound'?_0x0fb1('0x3'):_0x14b52e[_0x0fb1('0x2')];this[_0x0fb1('0x4')]=_0x14b52e[_0x0fb1('0x4')];this[_0x0fb1('0x5')]=_0x14b52e[_0x0fb1('0x5')];this['countnoanswerretry']=_0x14b52e[_0x0fb1('0x6')];this[_0x0fb1('0x7')]=_0x14b52e['countbusyretry']+_0x14b52e[_0x0fb1('0x5')]+_0x14b52e[_0x0fb1('0x6')]+_0x14b52e[_0x0fb1('0x8')]+_0x14b52e['countdropretry']+_0x14b52e['countabandonedretry']+_0x14b52e[_0x0fb1('0x9')]+_0x14b52e[_0x0fb1('0xa')];this[_0x0fb1('0x8')]=_0x14b52e[_0x0fb1('0x8')];this[_0x0fb1('0xb')]=_0x14b52e[_0x0fb1('0xb')];this['countabandonedretry']=_0x14b52e[_0x0fb1('0xc')];this['countmachineretry']=_0x14b52e[_0x0fb1('0x9')];this['countagentrejectretry']=_0x14b52e[_0x0fb1('0xa')];this[_0x0fb1('0x3')]=_0x14b52e[_0x0fb1('0x3')];this['calleridname']=_0x14b52e[_0x0fb1('0xd')];this[_0x0fb1('0xe')]=_0x14b52e[_0x0fb1('0xf')];this[_0x0fb1('0x10')]=_0x14b52e['starttime'];this[_0x0fb1('0x11')]=_0x14b52e[_0x0fb1('0x11')];this['endtime']=_0x14b52e['responsetime'];this[_0x0fb1('0x12')]=utils[_0x0fb1('0x13')](_0x14b52e[_0x0fb1('0x11')],_0x14b52e['starttime']);this['holdtime']=0x0;this[_0x0fb1('0x14')]=0x0;this[_0x0fb1('0x15')]=_0x14b52e['callback'];this[_0x0fb1('0x16')]=_0x14b52e[_0x0fb1('0x16')];this['callbackat']=_0x14b52e[_0x0fb1('0x17')];this[_0x0fb1('0x18')]=_0x14b52e['recallme'];this[_0x0fb1('0x19')]=_0x14b52e['ContactId'];this[_0x0fb1('0x1a')]=_0x14b52e[_0x0fb1('0x1a')];this['UserId']=_0x14b52e[_0x0fb1('0x1b')];this[_0x0fb1('0x1c')]=_0x14b52e[_0x0fb1('0x1c')];this[_0x0fb1('0x1d')]=_0x14b52e[_0x0fb1('0x1d')];this['originatecalleridnum']=_0x14b52e[_0x0fb1('0x1e')]||'';this['originatecalleridname']=_0x14b52e['originatecalleridname']||'';this[_0x0fb1('0x1f')]=_0x14b52e[_0x0fb1('0x1f')];this[_0x0fb1('0x20')]=_0x14b52e[_0x0fb1('0x20')];}module[_0x0fb1('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index ca059e2..2826bb1 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ab1=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x9ab1,0x16b));var _0x19ab=function(_0x430b85,_0x14ebef){_0x430b85=_0x430b85-0x0;var _0x1c8625=_0x9ab1[_0x430b85];return _0x1c8625;};'use strict';var utils=require(_0x19ab('0x0'));function QueueCallerAbandon(_0x1cb5db,_0xfee1c){this[_0x19ab('0x1')]=_0x1cb5db[_0x19ab('0x1')];this['type']=_0x1cb5db[_0x19ab('0x2')];this[_0x19ab('0x3')]=_0x1cb5db['type']===_0x19ab('0x4')?'queue':_0x1cb5db[_0x19ab('0x2')];this[_0x19ab('0x5')]=_0x1cb5db[_0x19ab('0x5')];this[_0x19ab('0x6')]=_0x1cb5db[_0x19ab('0x6')];this['countnoanswerretry']=_0x1cb5db[_0x19ab('0x7')];this[_0x19ab('0x8')]=_0x1cb5db[_0x19ab('0x5')]+_0x1cb5db['countcongestionretry']+_0x1cb5db['countnoanswerretry']+_0x1cb5db['countnosuchnumberretry']+_0x1cb5db['countdropretry']+_0x1cb5db[_0x19ab('0x9')]+_0x1cb5db[_0x19ab('0xa')]+_0x1cb5db[_0x19ab('0xb')];this[_0x19ab('0xc')]=_0x1cb5db[_0x19ab('0xc')];this[_0x19ab('0xd')]=_0x1cb5db[_0x19ab('0xd')];this[_0x19ab('0x9')]=_0x1cb5db['countabandonedretry'];this[_0x19ab('0xa')]=_0x1cb5db[_0x19ab('0xa')];this[_0x19ab('0xb')]=_0x1cb5db['countagentrejectretry'];this[_0x19ab('0xe')]=_0xfee1c[_0x19ab('0xe')];this['calleridname']=_0x1cb5db[_0x19ab('0xf')];this[_0x19ab('0x10')]=_0x1cb5db[_0x19ab('0x11')];this[_0x19ab('0x12')]=_0x1cb5db[_0x19ab('0x12')];this[_0x19ab('0x13')]=_0x1cb5db['responsetime'];this[_0x19ab('0x14')]=_0x1cb5db[_0x19ab('0x14')];this['dropreason']=_0x1cb5db[_0x19ab('0x15')];this[_0x19ab('0x16')]=this[_0x19ab('0x14')];this[_0x19ab('0x17')]=utils[_0x19ab('0x18')](_0x1cb5db[_0x19ab('0x13')],_0x1cb5db[_0x19ab('0x12')]);this[_0x19ab('0x19')]=utils[_0x19ab('0x18')](this[_0x19ab('0x14')],_0x1cb5db[_0x19ab('0x13')]);this['talktime']=0x0;this[_0x19ab('0x1a')]=_0xfee1c[_0x19ab('0x1a')];this[_0x19ab('0x1b')]=_0xfee1c[_0x19ab('0x1c')];this[_0x19ab('0x1d')]=_0xfee1c[_0x19ab('0x1d')];this[_0x19ab('0x1e')]=_0x1cb5db[_0x19ab('0x1e')];this[_0x19ab('0x1f')]=_0x1cb5db[_0x19ab('0x1f')];this[_0x19ab('0x20')]=_0x1cb5db[_0x19ab('0x20')];this[_0x19ab('0x21')]=_0x1cb5db[_0x19ab('0x21')];this['ContactId']=_0x1cb5db[_0x19ab('0x22')];this[_0x19ab('0x23')]=_0x1cb5db[_0x19ab('0x23')];this[_0x19ab('0x24')]=_0x1cb5db[_0x19ab('0x24')];this[_0x19ab('0x25')]=_0x1cb5db[_0x19ab('0x25')];this['CampaignId']=_0x1cb5db[_0x19ab('0x26')];this[_0x19ab('0x27')]=_0x1cb5db[_0x19ab('0x27')]||'';this['originatecalleridname']=_0x1cb5db[_0x19ab('0x28')]||'';this[_0x19ab('0x29')]=_0x1cb5db[_0x19ab('0x29')];this[_0x19ab('0x2a')]=_0x1cb5db[_0x19ab('0x2a')];this['statedesc']=_0x1cb5db['statedesc'];}module[_0x19ab('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xd81e=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','droptime','dropreason','ringtime','getSeconds','starttime','holdtime','responsetime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','exports','../utils','scheduledat','type'];(function(_0x9664b9,_0x51d10e){var _0x420c36=function(_0x131a18){while(--_0x131a18){_0x9664b9['push'](_0x9664b9['shift']());}};_0x420c36(++_0x51d10e);}(_0xd81e,0x7b));var _0xed81=function(_0x4e8c25,_0x9ec7ad){_0x4e8c25=_0x4e8c25-0x0;var _0x4872cf=_0xd81e[_0x4e8c25];return _0x4872cf;};'use strict';var utils=require(_0xed81('0x0'));function QueueCallerAbandon(_0x5a1083,_0x16c121){this[_0xed81('0x1')]=_0x5a1083[_0xed81('0x1')];this[_0xed81('0x2')]=_0x5a1083['type'];this['campaigntype']=_0x5a1083[_0xed81('0x2')]===_0xed81('0x3')?_0xed81('0x4'):_0x5a1083['type'];this[_0xed81('0x5')]=_0x5a1083['countbusyretry'];this[_0xed81('0x6')]=_0x5a1083['countcongestionretry'];this[_0xed81('0x7')]=_0x5a1083[_0xed81('0x7')];this[_0xed81('0x8')]=_0x5a1083['countbusyretry']+_0x5a1083[_0xed81('0x6')]+_0x5a1083[_0xed81('0x7')]+_0x5a1083['countnosuchnumberretry']+_0x5a1083['countdropretry']+_0x5a1083[_0xed81('0x9')]+_0x5a1083[_0xed81('0xa')]+_0x5a1083[_0xed81('0xb')];this[_0xed81('0xc')]=_0x5a1083[_0xed81('0xc')];this[_0xed81('0xd')]=_0x5a1083[_0xed81('0xd')];this[_0xed81('0x9')]=_0x5a1083[_0xed81('0x9')];this[_0xed81('0xa')]=_0x5a1083[_0xed81('0xa')];this[_0xed81('0xb')]=_0x5a1083[_0xed81('0xb')];this['uniqueid']=_0x16c121[_0xed81('0xe')];this[_0xed81('0xf')]=_0x5a1083[_0xed81('0x10')];this['calleridnum']=_0x5a1083['number'];this['starttime']=_0x5a1083['starttime'];this['responsetime']=_0x5a1083['responsetime'];this['droptime']=_0x5a1083[_0xed81('0x11')];this['dropreason']=_0x5a1083[_0xed81('0x12')];this['endtime']=this['droptime'];this[_0xed81('0x13')]=utils[_0xed81('0x14')](_0x5a1083['responsetime'],_0x5a1083[_0xed81('0x15')]);this[_0xed81('0x16')]=utils[_0xed81('0x14')](this[_0xed81('0x11')],_0x5a1083[_0xed81('0x17')]);this[_0xed81('0x18')]=0x0;this[_0xed81('0x4')]=_0x16c121[_0xed81('0x4')];this[_0xed81('0x19')]=_0x16c121[_0xed81('0x1a')];this[_0xed81('0x1b')]=_0x16c121[_0xed81('0x1b')];this[_0xed81('0x1c')]=_0x5a1083['callback'];this[_0xed81('0x1d')]=_0x5a1083[_0xed81('0x1d')];this['callbackat']=_0x5a1083[_0xed81('0x1e')];this['recallme']=_0x5a1083[_0xed81('0x1f')];this['ContactId']=_0x5a1083[_0xed81('0x20')];this['ListId']=_0x5a1083[_0xed81('0x21')];this['UserId']=_0x5a1083[_0xed81('0x22')];this['VoiceQueueId']=_0x5a1083[_0xed81('0x23')];this[_0xed81('0x24')]=_0x5a1083[_0xed81('0x24')];this[_0xed81('0x25')]=_0x5a1083['originatecalleridnum']||'';this[_0xed81('0x26')]=_0x5a1083['originatecalleridname']||'';this['agiafterat']=_0x5a1083[_0xed81('0x27')];this[_0xed81('0x28')]=_0x5a1083[_0xed81('0x28')];this['statedesc']=_0x5a1083['statedesc'];}module[_0xed81('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 34f6cc0..66e5ea9 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['catch','[getContactDialerIvr]','countReScheduled','error','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt'];(function(_0x327439,_0x2d042c){var _0x96dd59=function(_0x54cc33){while(--_0x54cc33){_0x327439['push'](_0x327439['shift']());}};_0x96dd59(++_0x2d042c);}(_0x32f4,0x154));var _0x432f=function(_0x510f94,_0x1f1c50){_0x510f94=_0x510f94-0x0;var _0x22977b=_0x32f4[_0x510f94];return _0x22977b;};'use strict';var util=require(_0x432f('0x0'));var logger=require(_0x432f('0x1'))(_0x432f('0x2'));var cmHopper=require(_0x432f('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x432f('0x4'));var cmHopperHistory=require(_0x432f('0x5'));function inspectError(_0x51a71a){return util[_0x432f('0x6')](_0x51a71a,{'showHidden':![],'depth':null});}function getContactDialer(_0x1eabac,_0x344a29,_0x355b02){return cmHopper[_0x432f('0x7')](_0x1eabac['id'],_0x344a29,_0x355b02,_0x1eabac['dialOrderByScheduledAt'])['catch'](function(_0x2f66fd){_0x1eabac[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0x9'),inspectError(_0x2f66fd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1cdcfd,_0x340fe9){return cmHopper[_0x432f('0xa')](_0x1cdcfd['id'],_0x340fe9,_0x1cdcfd[_0x432f('0xb')])[_0x432f('0xc')](function(_0x5d0155){_0x1cdcfd[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0xd'),inspectError(_0x5d0155));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x138967){return cmHopper[_0x432f('0xe')](_0x138967)['catch'](function(_0x457389){logger[_0x432f('0xf')]('[countReScheduled]',inspectError(_0x457389));});}exports[_0x432f('0xe')]=countReScheduled;function rescheduleContact(_0x26aa9a){return cmHopper['rescheduleContact'](_0x26aa9a)['catch'](function(_0x28d9e9){logger[_0x432f('0xf')](_0x432f('0x10'),inspectError(_0x28d9e9));});}exports[_0x432f('0x11')]=rescheduleContact;function unlockContact(_0x419bfe,_0x4f91c5,_0x175ba7){return cmHopper[_0x432f('0x12')](_0x419bfe,_0x4f91c5,_0x175ba7)[_0x432f('0xc')](function(_0x1504db){logger['error'](_0x432f('0x13'),inspectError(_0x1504db));});}exports[_0x432f('0x12')]=unlockContact;function moveContactManagedDialer(_0x42c2d2){return cmHopper[_0x432f('0x14')](_0x42c2d2)[_0x432f('0xc')](function(_0x129582){logger['error'](_0x432f('0x15'),inspectError(_0x129582));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3d545d){return cmHopperBlack[_0x432f('0x16')](_0x3d545d)[_0x432f('0xc')](function(_0x391fd8){logger[_0x432f('0xf')](_0x432f('0x17'),inspectError(_0x391fd8));});}exports[_0x432f('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x1899e6){return cmHopperBlack[_0x432f('0x18')](_0x1899e6)[_0x432f('0xc')](function(_0x40176d){logger[_0x432f('0xf')]('[checkIsBlackListIvr]',inspectError(_0x40176d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x343d13,_0x5c4deb,_0x28968e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x343d13,_0x5c4deb,_0x28968e)[_0x432f('0xc')](function(_0x175d1b){logger[_0x432f('0xf')](_0x432f('0x19'),inspectError(_0x175d1b));});}exports[_0x432f('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1e347a,_0x59f352,_0x252b3b){return cmHopperAdditionalPhone[_0x432f('0x1b')](_0x1e347a,_0x59f352,_0x252b3b)['catch'](function(_0x2cbde9){logger[_0x432f('0xf')](_0x432f('0x1c'),inspectError(_0x2cbde9));});}exports[_0x432f('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x44839){return cmHopperHistory[_0x432f('0x1d')](_0x44839)[_0x432f('0xc')](function(_0x5a3d18){logger[_0x432f('0xf')]('[avgHandleTime]',inspectError(_0x5a3d18));});}exports[_0x432f('0x1d')]=avgHandleTime;function createHistory(_0x573cc5){return cmHopperHistory[_0x432f('0x1e')](_0x573cc5)['catch'](function(_0x3f768b){logger['error'](_0x432f('0x1f'),inspectError(_0x3f768b));});}exports[_0x432f('0x1e')]=createHistory; \ No newline at end of file +var _0x741c=['temp','[getContactDialer]','error','[getContactDialerIvr]','getContactDialerIvr','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','dialOrderByScheduledAt','catch'];(function(_0x1bf622,_0x31ee48){var _0x490ca6=function(_0x3da2ef){while(--_0x3da2ef){_0x1bf622['push'](_0x1bf622['shift']());}};_0x490ca6(++_0x31ee48);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0xc741('0x0'));var logger=require(_0xc741('0x1'))(_0xc741('0x2'));var cmHopper=require(_0xc741('0x3'));var cmHopperAdditionalPhone=require(_0xc741('0x4'));var cmHopperBlack=require(_0xc741('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x5cee2e){return util[_0xc741('0x6')](_0x5cee2e,{'showHidden':![],'depth':null});}function getContactDialer(_0x4ccc27,_0xc80e99,_0x1935b4){return cmHopper[_0xc741('0x7')](_0x4ccc27['id'],_0xc80e99,_0x1935b4,_0x4ccc27[_0xc741('0x8')])[_0xc741('0x9')](function(_0x216e60){_0x4ccc27[_0xc741('0xa')]=0x0;logger['error'](_0xc741('0xb'),inspectError(_0x216e60));});}exports[_0xc741('0x7')]=getContactDialer;function getContactDialerIvr(_0x47e0c0,_0xc6555){return cmHopper['getContactDialerIvr'](_0x47e0c0['id'],_0xc6555,_0x47e0c0['dialOrderByScheduledAt'])[_0xc741('0x9')](function(_0x264cb9){_0x47e0c0[_0xc741('0xa')]=0x0;logger[_0xc741('0xc')](_0xc741('0xd'),inspectError(_0x264cb9));});}exports[_0xc741('0xe')]=getContactDialerIvr;function countReScheduled(_0x312684){return cmHopper['countReScheduled'](_0x312684)['catch'](function(_0x51bc33){logger[_0xc741('0xc')](_0xc741('0xf'),inspectError(_0x51bc33));});}exports[_0xc741('0x10')]=countReScheduled;function rescheduleContact(_0x17e34d){return cmHopper[_0xc741('0x11')](_0x17e34d)['catch'](function(_0xde1da){logger[_0xc741('0xc')]('[rescheduleContact]',inspectError(_0xde1da));});}exports[_0xc741('0x11')]=rescheduleContact;function unlockContact(_0x3c7569,_0xd92df7,_0x450179){return cmHopper[_0xc741('0x12')](_0x3c7569,_0xd92df7,_0x450179)['catch'](function(_0x4dcf16){logger[_0xc741('0xc')]('[unlockContact]',inspectError(_0x4dcf16));});}exports[_0xc741('0x12')]=unlockContact;function moveContactManagedDialer(_0x3903c6){return cmHopper['moveContactManagedDialer'](_0x3903c6)['catch'](function(_0xebabc8){logger[_0xc741('0xc')](_0xc741('0x13'),inspectError(_0xebabc8));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x19d598){return cmHopperBlack[_0xc741('0x14')](_0x19d598)[_0xc741('0x9')](function(_0x82ce9d){logger[_0xc741('0xc')](_0xc741('0x15'),inspectError(_0x82ce9d));});}exports[_0xc741('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x30b7ea){return cmHopperBlack[_0xc741('0x16')](_0x30b7ea)['catch'](function(_0x26bf01){logger['error'](_0xc741('0x17'),inspectError(_0x26bf01));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0xd498b,_0x3c3497,_0x38e752){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0xd498b,_0x3c3497,_0x38e752)[_0xc741('0x9')](function(_0x5a89bd){logger[_0xc741('0xc')](_0xc741('0x18'),inspectError(_0x5a89bd));});}exports[_0xc741('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x58af82,_0x53bdad,_0x4ac9e3){return cmHopperAdditionalPhone[_0xc741('0x1a')](_0x58af82,_0x53bdad,_0x4ac9e3)[_0xc741('0x9')](function(_0x42461a){logger[_0xc741('0xc')](_0xc741('0x1b'),inspectError(_0x42461a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x4f63db){return cmHopperHistory[_0xc741('0x1c')](_0x4f63db)[_0xc741('0x9')](function(_0x102408){logger[_0xc741('0xc')](_0xc741('0x1d'),inspectError(_0x102408));});}exports[_0xc741('0x1c')]=avgHandleTime;function createHistory(_0x4a4ad2){return cmHopperHistory[_0xc741('0x1e')](_0x4a4ad2)[_0xc741('0x9')](function(_0x4cd23c){logger[_0xc741('0xc')](_0xc741('0x1f'),inspectError(_0x4cd23c));});}exports[_0xc741('0x1e')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index eb46d25..f303998 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7487=['RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','NULL_INTERVAL','Intervals','EMPTY_INTERVAL','SIP/','reachable','unmonitored','includes','status','TrunkBackup','talking','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','XMD-','toUpperCase','toString','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE'];(function(_0x153663,_0x3ef313){var _0xfcdd26=function(_0x5b4cc7){while(--_0x5b4cc7){_0x153663['push'](_0x153663['shift']());}};_0xfcdd26(++_0x3ef313);}(_0x7487,0xab));var _0x7748=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x7487[_0xd13a88];return _0x1c993c;};'use strict';var _=require(_0x7748('0x0'));var moment=require(_0x7748('0x1'));var util=require(_0x7748('0x2'));var logger=require(_0x7748('0x3'))(_0x7748('0x4'));var timezones=require(_0x7748('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x7748('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x7748('0x7'),'DEACTIVATED':_0x7748('0x8'),'DISACTIVED':_0x7748('0x9'),'EMPTY_INTERVAL':_0x7748('0xa'),'INACTIVE':_0x7748('0xb'),'NO_AGENTS_LOGGED':_0x7748('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x7748('0xd'),'OVERTIME_INTERVAL':_0x7748('0xe'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x7748('0xf'),'RECALL_TIMEOUT':_0x7748('0x10'),'RUNNING':_0x7748('0x11'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x7748('0x12')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1753be){return _0x1753be['dialMethod']===_0x7748('0x13');}exports[_0x7748('0x14')]=isPreviewCampaign;function isIVRCampaign(_0xb413a0){return _0xb413a0[_0x7748('0x15')]===_0x7748('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x11acdd){return _0x11acdd[_0x7748('0x15')]===_0x7748('0x17');}exports[_0x7748('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0xa316d5){return _0xa316d5[_0x7748('0x19')];}exports[_0x7748('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4dc8d9){return _0x4dc8d9[_0x7748('0x1b')];}exports[_0x7748('0x1c')]=isIVRCampaignActive;function getSeconds(_0x4cd024,_0x5d6c3f){var _0x4a7d05=moment(_0x4cd024)[_0x7748('0x1d')](0x0);var _0xc9253b=moment(_0x5d6c3f)[_0x7748('0x1d')](0x0);return _0x4a7d05[_0x7748('0x1e')](_0xc9253b,_0x7748('0x1f'));}exports[_0x7748('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x14cfd6,_0x31deb1){var _0x47c58f=![];var _0x429787=_0x14cfd6['dialMethod']!==_0x31deb1['dialMethod']||_0x14cfd6[_0x7748('0x19')]!==_0x31deb1['dialActive']||_0x14cfd6['message']!==_0x31deb1[_0x7748('0x21')];var _0xa1fdd9=_0x14cfd6[_0x7748('0x22')]!==_0x31deb1[_0x7748('0x22')]||_0x14cfd6[_0x7748('0x23')]!==_0x31deb1[_0x7748('0x23')]||_0x14cfd6[_0x7748('0x24')]!==_0x31deb1[_0x7748('0x24')]||_0x14cfd6['paused']!==_0x31deb1[_0x7748('0x25')]||_0x14cfd6['talking']!==_0x31deb1['talking']||_0x14cfd6[_0x7748('0x26')]!==_0x31deb1['pTalking']||_0x14cfd6[_0x7748('0x27')]!==_0x31deb1[_0x7748('0x27')]||_0x14cfd6[_0x7748('0x28')]!==_0x31deb1['inUse']||_0x14cfd6['originated']!==_0x31deb1[_0x7748('0x29')];if(_0x14cfd6['Trunk']&&_0x31deb1[_0x7748('0x2a')]){_0x47c58f=_0x14cfd6['Trunk'][_0x7748('0x2b')]!==_0x31deb1[_0x7748('0x2a')][_0x7748('0x2b')]||_0x14cfd6[_0x7748('0x2a')][_0x7748('0x1b')]!==_0x31deb1[_0x7748('0x2a')][_0x7748('0x1b')];}return _0x429787||_0xa1fdd9||_0x47c58f;}exports[_0x7748('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2f3a11){var _0x2ad930=null;var _0x560eae=_0x2f3a11[_0x7748('0x2d')];if(_['isNil'](_0x2f3a11[_0x7748('0x2e')])||_[_0x7748('0x2f')](_0x2f3a11[_0x7748('0x30')])||_[_0x7748('0x2f')](_0x2f3a11[_0x7748('0x30')]['Intervals'])){_0x2ad930=CAMPAIGN_STATUS[_0x7748('0x31')];}else if(_['isEmpty'](_0x2f3a11['dialGlobalInterval'])||_['isEmpty'](_0x2f3a11[_0x7748('0x30')][_0x7748('0x32')])){_0x2ad930=CAMPAIGN_STATUS[_0x7748('0x33')];}else if(_0x560eae&&!timezones[_0x560eae]){_0x2ad930=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x2ad930;}function checkAnyValidTrunk(_0x42d547,_0x454650){var _0x561ece=null;var _0x157aca=_0x7748('0x34');var _0x497327=[_0x7748('0x35'),_0x7748('0x36')];var _0x32d3c1=!![];if(_0x42d547[_0x7748('0x2a')]&&_0x42d547[_0x7748('0x2a')][_0x7748('0x1b')]){_0x157aca+=_0x42d547['Trunk'][_0x7748('0x2b')];_0x561ece=_0x454650[_0x157aca];_0x32d3c1=_0x497327[_0x7748('0x37')](_0x561ece[_0x7748('0x38')]);}else if(_0x42d547[_0x7748('0x39')]&&_0x42d547['TrunkBackup'][_0x7748('0x1b')]){_0x157aca+=_0x42d547['TrunkBackup'][_0x7748('0x2b')];_0x561ece=_0x454650[_0x157aca];_0x32d3c1=_0x497327[_0x7748('0x37')](_0x561ece[_0x7748('0x38')]);}return _0x32d3c1;}function getQueueCampaignStatusMessage(_0x4e7e8c,_0x5292a1){var _0xf390cb=CAMPAIGN_STATUS['ACTIVE'];var _0x2ab22f=isPreviewCampaign(_0x4e7e8c);if(!isQueueCampaignActive(_0x4e7e8c)){if(_0x2ab22f){_0xf390cb=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x4e7e8c['originated']===0x0&&_0x4e7e8c[_0x7748('0x3a')]===0x0&&_0x4e7e8c[_0x7748('0x27')]===0x0&&(_0x4e7e8c[_0x7748('0x26')]||0x0)===0x0){_0xf390cb=CAMPAIGN_STATUS[_0x7748('0x3b')];}else{_0xf390cb=CAMPAIGN_STATUS[_0x7748('0x3c')];}}}else if(_0x4e7e8c[_0x7748('0x23')]===0x0){_0xf390cb=CAMPAIGN_STATUS[_0x7748('0x3d')];}else if(!checkAnyValidTrunk(_0x4e7e8c,_0x5292a1)){_0xf390cb=CAMPAIGN_STATUS[_0x7748('0x3e')];}else if(!isPreviewCampaign(_0x4e7e8c)){var _0x2e0342=checkAnyValidQueueCampaignInterval(_0x4e7e8c);if(_0x2e0342){_0xf390cb=_0x2e0342;}}return _0xf390cb;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1bc260){var _0x556383=CAMPAIGN_STATUS[_0x7748('0x3c')];if(_0x1bc260['originated']===0x0&&_0x1bc260[_0x7748('0x3a')]===0x0&&_0x1bc260[_0x7748('0x27')]===0x0&&(_0x1bc260[_0x7748('0x26')]||0x0)===0x0){_0x556383=CAMPAIGN_STATUS[_0x7748('0x3b')];}return _0x556383;}exports[_0x7748('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3be2c8){var _0x4a7619=_0x3be2c8['match'](/"(.*?)"/);return _0x4a7619?_0x4a7619[0x1]:_0x3be2c8;}exports[_0x7748('0x40')]=extractCalleridName;function getCallerId(_0x9f9381,_0x280f6f,_0xb4163){if(!_[_0x7748('0x41')](_0xb4163)&&typeof _0xb4163==='string'&&!_[_0x7748('0x42')](_0xb4163)){if(!_[_0x7748('0x41')](_0x280f6f)&&typeof _0x280f6f===_0x7748('0x43')&&!_[_0x7748('0x42')](_0x280f6f)){return util[_0x7748('0x44')](_0x7748('0x45'),_0x280f6f,_0xb4163);}return util[_0x7748('0x44')](_0x7748('0x45'),_0xb4163,_0xb4163);}if(!_[_0x7748('0x41')](_0x9f9381)&&typeof _0x9f9381==='string'&&!_['isEmpty'](_0x9f9381)){return _0x9f9381;}return'\x22\x22\x20<>';}exports[_0x7748('0x46')]=getCallerId;function getCallerIdRandom(_0x84a1c4,_0x1ec05e){var _0x405eeb;var _0x3e2188;var _0x5c4e9d;if(_0x1ec05e<=0x0){_0x1ec05e=0x1;}_0x405eeb=new RegExp(_0x7748('0x47')+_0x1ec05e+'}$');_0x3e2188=Math[_0x7748('0x48')](0xa,_0x1ec05e-0x1);_0x5c4e9d=Math[_0x7748('0x48')](0xa,_0x1ec05e)-0x1;return util['format']('%s',_[_0x7748('0x49')](_0x84a1c4,_0x405eeb,_['random'](_0x3e2188,_0x5c4e9d)['toString']()));}exports[_0x7748('0x4a')]=getCallerIdRandom;function decrementOriginate(_0xb7dd90){if(_0xb7dd90['originated']&&_0xb7dd90[_0x7748('0x29')]>0x0){_0xb7dd90[_0x7748('0x29')]-=0x1;}else{logger['error'](_0x7748('0x4b'));}}exports[_0x7748('0x4c')]=decrementOriginate;function checkContactEmpty(_0xdfd5df){return _0xdfd5df&&_0xdfd5df[_0x7748('0x4d')]>0x0;}exports[_0x7748('0x4e')]=checkContactEmpty;function erlangb(_0x20950b,_0x24c369){if(_0x24c369===0x0){return 0x0;}var _0x5bfcd5=0x1;for(var _0x25f122=0x1;_0x25f122<=_0x24c369;_0x25f122+=0x1){_0x5bfcd5=0x1+_0x5bfcd5*_0x25f122/_0x20950b;}return 0x1/_0x5bfcd5;}exports[_0x7748('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x28c4c0,_0x51c727,_0x4275a4){if(_0x51c727>_0x4275a4){for(var _0x416383=0x0;_0x416383<_0x51c727-_0x4275a4;_0x416383+=0x1){decrementOriginate(_0x28c4c0);}}}exports[_0x7748('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1e5a3e){var _0x368321={};var _0x5ef6fa=['id',_0x7748('0x51'),'tags',_0x7748('0x52')];const _0x4f29b8=0xfa;if(_0x1e5a3e){for(var _0x429cab in _0x1e5a3e){if(typeof _0x1e5a3e[_0x429cab]!==_0x7748('0x53')){if(!_[_0x7748('0x2f')](_0x1e5a3e[_0x429cab])&&!_0x5ef6fa[_0x7748('0x37')](_0x429cab)){if(_0x429cab==='description'&&_0x1e5a3e[_0x429cab][_0x7748('0x4d')]>_0x4f29b8){_0x368321[_0x7748('0x54')+_0x429cab[_0x7748('0x55')]()]=_0x1e5a3e[_0x429cab][_0x7748('0x56')]()[_0x7748('0x57')](0x0,_0x4f29b8);}else{_0x368321['XMD-'+_0x429cab[_0x7748('0x55')]()]=_0x1e5a3e[_0x429cab];}}}}}return _0x368321;}exports[_0x7748('0x58')]=setXMDContactVariables; \ No newline at end of file +var _0x54eb=['undefined','description','toUpperCase','substring','XMD-','setXMDContactVariables','lodash','util','dialer','../../../../config/environment/shared','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','milliseconds','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','TrunkBackup','status','ACTIVE','originated','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','string','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt'];(function(_0x1ed363,_0xc3f9c6){var _0xd83a9=function(_0x16bbe6){while(--_0x16bbe6){_0x1ed363['push'](_0x1ed363['shift']());}};_0xd83a9(++_0xc3f9c6);}(_0x54eb,0x1c8));var _0xb54e=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x54eb[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xb54e('0x0'));var moment=require('moment');var util=require(_0xb54e('0x1'));var logger=require('../../../../config/logger')(_0xb54e('0x2'));var timezones=require(_0xb54e('0x3'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xb54e('0x4'),'CONTACTS_RESCHEDULED':_0xb54e('0x5'),'DEACTIVATED':_0xb54e('0x6'),'DISACTIVED':_0xb54e('0x7'),'EMPTY_INTERVAL':_0xb54e('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xb54e('0x9'),'NO_AVAILABLE_CONTACTS':_0xb54e('0xa'),'NULL_INTERVAL':_0xb54e('0xb'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xb54e('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xb54e('0xd'),'RUNNING':_0xb54e('0xe'),'UNKNOWN_TIMEZONE':_0xb54e('0xf'),'UNREACHABLE_TRUNK':_0xb54e('0x10')};exports[_0xb54e('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x487a4c){return _0x487a4c['dialMethod']===_0xb54e('0x12');}exports[_0xb54e('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x4ecc2a){return _0x4ecc2a[_0xb54e('0x14')]===_0xb54e('0x15');}exports[_0xb54e('0x16')]=isIVRCampaign;function isOutboundQueue(_0x260b6d){return _0x260b6d[_0xb54e('0x14')]===_0xb54e('0x17');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x227f77){return _0x227f77[_0xb54e('0x18')];}exports[_0xb54e('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1d6557){return _0x1d6557[_0xb54e('0x1a')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x1a94b0,_0x4b6e9c){var _0x4cf805=moment(_0x1a94b0)['milliseconds'](0x0);var _0x7bbd=moment(_0x4b6e9c)[_0xb54e('0x1b')](0x0);return _0x4cf805['diff'](_0x7bbd,_0xb54e('0x1c'));}exports[_0xb54e('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x3855a4,_0x4851c3){var _0x2dd041=![];var _0x1f8647=_0x3855a4['dialMethod']!==_0x4851c3[_0xb54e('0x1e')]||_0x3855a4['dialActive']!==_0x4851c3['dialActive']||_0x3855a4[_0xb54e('0x1f')]!==_0x4851c3[_0xb54e('0x1f')];var _0x6872ae=_0x3855a4[_0xb54e('0x20')]!==_0x4851c3[_0xb54e('0x20')]||_0x3855a4[_0xb54e('0x21')]!==_0x4851c3[_0xb54e('0x21')]||_0x3855a4[_0xb54e('0x22')]!==_0x4851c3['loggedInDb']||_0x3855a4['paused']!==_0x4851c3[_0xb54e('0x23')]||_0x3855a4[_0xb54e('0x24')]!==_0x4851c3[_0xb54e('0x24')]||_0x3855a4[_0xb54e('0x25')]!==_0x4851c3[_0xb54e('0x25')]||_0x3855a4[_0xb54e('0x26')]!==_0x4851c3['waiting']||_0x3855a4['inUse']!==_0x4851c3[_0xb54e('0x27')]||_0x3855a4['originated']!==_0x4851c3['originated'];if(_0x3855a4[_0xb54e('0x28')]&&_0x4851c3['Trunk']){_0x2dd041=_0x3855a4[_0xb54e('0x28')][_0xb54e('0x29')]!==_0x4851c3[_0xb54e('0x28')]['name']||_0x3855a4['Trunk'][_0xb54e('0x1a')]!==_0x4851c3[_0xb54e('0x28')][_0xb54e('0x1a')];}return _0x1f8647||_0x6872ae||_0x2dd041;}exports[_0xb54e('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3734c9){var _0x1a4a94=null;var _0xf8f4b6=_0x3734c9['dialTimezone'];if(_[_0xb54e('0x2b')](_0x3734c9[_0xb54e('0x2c')])||_[_0xb54e('0x2b')](_0x3734c9['Interval'])||_[_0xb54e('0x2b')](_0x3734c9[_0xb54e('0x2d')][_0xb54e('0x2e')])){_0x1a4a94=CAMPAIGN_STATUS[_0xb54e('0x2f')];}else if(_[_0xb54e('0x30')](_0x3734c9[_0xb54e('0x2c')])||_[_0xb54e('0x30')](_0x3734c9[_0xb54e('0x2d')]['Intervals'])){_0x1a4a94=CAMPAIGN_STATUS[_0xb54e('0x31')];}else if(_0xf8f4b6&&!timezones[_0xf8f4b6]){_0x1a4a94=CAMPAIGN_STATUS[_0xb54e('0x32')];}return _0x1a4a94;}function checkAnyValidTrunk(_0x36c996,_0x2d5825){var _0x2bcdc7=null;var _0x1052a2=_0xb54e('0x33');var _0x553f1d=[_0xb54e('0x34'),_0xb54e('0x35')];var _0x59c4d4=!![];if(_0x36c996[_0xb54e('0x28')]&&_0x36c996[_0xb54e('0x28')][_0xb54e('0x1a')]){_0x1052a2+=_0x36c996['Trunk']['name'];_0x2bcdc7=_0x2d5825[_0x1052a2];_0x59c4d4=_0x553f1d[_0xb54e('0x36')](_0x2bcdc7['status']);}else if(_0x36c996[_0xb54e('0x37')]&&_0x36c996['TrunkBackup'][_0xb54e('0x1a')]){_0x1052a2+=_0x36c996[_0xb54e('0x37')][_0xb54e('0x29')];_0x2bcdc7=_0x2d5825[_0x1052a2];_0x59c4d4=_0x553f1d[_0xb54e('0x36')](_0x2bcdc7[_0xb54e('0x38')]);}return _0x59c4d4;}function getQueueCampaignStatusMessage(_0x20be95,_0x4a4907){var _0x3fda0b=CAMPAIGN_STATUS[_0xb54e('0x39')];var _0x4d5d51=isPreviewCampaign(_0x20be95);if(!isQueueCampaignActive(_0x20be95)){if(_0x4d5d51){_0x3fda0b=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x20be95[_0xb54e('0x3a')]===0x0&&_0x20be95['talking']===0x0&&_0x20be95[_0xb54e('0x26')]===0x0&&(_0x20be95[_0xb54e('0x25')]||0x0)===0x0){_0x3fda0b=CAMPAIGN_STATUS['INACTIVE'];}else{_0x3fda0b=CAMPAIGN_STATUS[_0xb54e('0x3b')];}}}else if(_0x20be95['loggedIn']===0x0){_0x3fda0b=CAMPAIGN_STATUS[_0xb54e('0x3c')];}else if(!checkAnyValidTrunk(_0x20be95,_0x4a4907)){_0x3fda0b=CAMPAIGN_STATUS[_0xb54e('0x3d')];}else if(!isPreviewCampaign(_0x20be95)){var _0x1d2521=checkAnyValidQueueCampaignInterval(_0x20be95);if(_0x1d2521){_0x3fda0b=_0x1d2521;}}return _0x3fda0b;}exports[_0xb54e('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4d9495){var _0x37f114=CAMPAIGN_STATUS[_0xb54e('0x3b')];if(_0x4d9495['originated']===0x0&&_0x4d9495[_0xb54e('0x24')]===0x0&&_0x4d9495[_0xb54e('0x26')]===0x0&&(_0x4d9495['pTalking']||0x0)===0x0){_0x37f114=CAMPAIGN_STATUS['INACTIVE'];}return _0x37f114;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x397d6a){var _0x2510f0=_0x397d6a['match'](/"(.*?)"/);return _0x2510f0?_0x2510f0[0x1]:_0x397d6a;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x16bd92,_0xdb75c,_0x5254f4){if(!_['isUndefined'](_0x5254f4)&&typeof _0x5254f4===_0xb54e('0x3f')&&!_[_0xb54e('0x30')](_0x5254f4)){if(!_['isUndefined'](_0xdb75c)&&typeof _0xdb75c===_0xb54e('0x3f')&&!_['isEmpty'](_0xdb75c)){return util[_0xb54e('0x40')]('\x22%s\x22\x20<%s>',_0xdb75c,_0x5254f4);}return util[_0xb54e('0x40')](_0xb54e('0x41'),_0x5254f4,_0x5254f4);}if(!_[_0xb54e('0x42')](_0x16bd92)&&typeof _0x16bd92===_0xb54e('0x3f')&&!_[_0xb54e('0x30')](_0x16bd92)){return _0x16bd92;}return _0xb54e('0x43');}exports[_0xb54e('0x44')]=getCallerId;function getCallerIdRandom(_0x311b46,_0x2ad320){var _0x263dd2;var _0x4076ac;var _0x1fbf9e;if(_0x2ad320<=0x0){_0x2ad320=0x1;}_0x263dd2=new RegExp(_0xb54e('0x45')+_0x2ad320+'}$');_0x4076ac=Math[_0xb54e('0x46')](0xa,_0x2ad320-0x1);_0x1fbf9e=Math['pow'](0xa,_0x2ad320)-0x1;return util[_0xb54e('0x40')]('%s',_['replace'](_0x311b46,_0x263dd2,_[_0xb54e('0x47')](_0x4076ac,_0x1fbf9e)[_0xb54e('0x48')]()));}exports[_0xb54e('0x49')]=getCallerIdRandom;function decrementOriginate(_0x3f96cc){if(_0x3f96cc['originated']&&_0x3f96cc[_0xb54e('0x3a')]>0x0){_0x3f96cc[_0xb54e('0x3a')]-=0x1;}else{logger[_0xb54e('0x4a')](_0xb54e('0x4b'));}}exports[_0xb54e('0x4c')]=decrementOriginate;function checkContactEmpty(_0x57f58f){return _0x57f58f&&_0x57f58f[_0xb54e('0x4d')]>0x0;}exports[_0xb54e('0x4e')]=checkContactEmpty;function erlangb(_0x20976c,_0x384767){if(_0x384767===0x0){return 0x0;}var _0x37b794=0x1;for(var _0x2c9ec7=0x1;_0x2c9ec7<=_0x384767;_0x2c9ec7+=0x1){_0x37b794=0x1+_0x37b794*_0x2c9ec7/_0x20976c;}return 0x1/_0x37b794;}exports[_0xb54e('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x4f7d7a,_0xf8c776,_0x3e66c5){if(_0xf8c776>_0x3e66c5){for(var _0x2d3e91=0x0;_0x2d3e91<_0xf8c776-_0x3e66c5;_0x2d3e91+=0x1){decrementOriginate(_0x4f7d7a);}}}exports[_0xb54e('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x9dd496){var _0x5a0603={};var _0x93237=['id',_0xb54e('0x51'),_0xb54e('0x52'),_0xb54e('0x53')];const _0x3212de=0xfa;if(_0x9dd496){for(var _0x5518d1 in _0x9dd496){if(typeof _0x9dd496[_0x5518d1]!==_0xb54e('0x54')){if(!_[_0xb54e('0x2b')](_0x9dd496[_0x5518d1])&&!_0x93237[_0xb54e('0x36')](_0x5518d1)){if(_0x5518d1===_0xb54e('0x55')&&_0x9dd496[_0x5518d1][_0xb54e('0x4d')]>_0x3212de){_0x5a0603['XMD-'+_0x5518d1[_0xb54e('0x56')]()]=_0x9dd496[_0x5518d1][_0xb54e('0x48')]()[_0xb54e('0x57')](0x0,_0x3212de);}else{_0x5a0603[_0xb54e('0x58')+_0x5518d1[_0xb54e('0x56')]()]=_0x9dd496[_0x5518d1];}}}}}return _0x5a0603;}exports[_0xb54e('0x59')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 86f2fc3..e530f46 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x4d24aa,_0x3a7a85){var _0x95309=function(_0x5906b7){while(--_0x5906b7){_0x4d24aa['push'](_0x4d24aa['shift']());}};_0x95309(++_0x3a7a85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5850e0,_0x2c3e9a){var _0x3d0697=function(_0xfef92){while(--_0xfef92){_0x5850e0['push'](_0x5850e0['shift']());}};_0x3d0697(++_0x2c3e9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ba6c1dd..6e0d0da 100644 --- a/server/services/ami/fax/index.js +++ b/server/services/ami/fax/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed21=['checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','uuid','moment','path','tiff2pdf','./util/gs','fax','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored'];(function(_0x5c0142,_0x562138){var _0x426a82=function(_0x3e79e1){while(--_0x3e79e1){_0x5c0142['push'](_0x5c0142['shift']());}};_0x426a82(++_0x562138);}(_0xed21,0x16c));var _0x1ed2=function(_0x4bf1bc,_0x2f9647){_0x4bf1bc=_0x4bf1bc-0x0;var _0xfa0c7b=_0xed21[_0x4bf1bc];return _0xfa0c7b;};'use strict';var util=require(_0x1ed2('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x1ed2('0x1'));var moment=require(_0x1ed2('0x2'));var path=require(_0x1ed2('0x3'));var tiff2pdf=require(_0x1ed2('0x4'));var gs=require(_0x1ed2('0x5'));var logger=require('../../../config/logger')(_0x1ed2('0x6'));var ami=require('../ami');var rpcDb=require(_0x1ed2('0x7'));var Channel=require('./channel');var ut=require(_0x1ed2('0x8'));var Action=require(_0x1ed2('0x9'));var faxAccount=require(_0x1ed2('0xa'));var attachment=require(_0x1ed2('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5546aa){this['channels']={};this['faxAccounts']=_0x5546aa[_0x1ed2('0xc')];this['trunks']=_0x5546aa[_0x1ed2('0xd')];this[_0x1ed2('0xe')]={};ami['on'](_0x1ed2('0xf'),this[_0x1ed2('0x10')][_0x1ed2('0x11')](this));ami['on']('varset',this[_0x1ed2('0x12')][_0x1ed2('0x11')](this));ami['on'](_0x1ed2('0x13'),this[_0x1ed2('0x14')]['bind'](this));ami['on'](_0x1ed2('0x15'),this['syncNewExten'][_0x1ed2('0x11')](this));ami['on'](_0x1ed2('0x16'),this[_0x1ed2('0x17')][_0x1ed2('0x11')](this));ami['on'](_0x1ed2('0x18'),this[_0x1ed2('0x19')][_0x1ed2('0x11')](this));ami['on'](_0x1ed2('0x1a'),this['syncHangup'][_0x1ed2('0x11')](this));ami['on']('originateresponse',this[_0x1ed2('0x1b')]['bind'](this));}Fax[_0x1ed2('0x1c')][_0x1ed2('0x10')]=function(_0x30caa4){if(_0x30caa4[_0x1ed2('0x1d')]===_0x1ed2('0x1e')){for(var _0x3e2cdc in this[_0x1ed2('0xc')]){if(this[_0x1ed2('0xc')][_0x1ed2('0x1f')](_0x3e2cdc)){if(_0x30caa4[_0x1ed2('0x20')]===this[_0x1ed2('0xc')][_0x3e2cdc][_0x1ed2('0x21')]){this[_0x1ed2('0x22')][_0x30caa4[_0x1ed2('0x23')]]={};this[_0x1ed2('0x22')][_0x30caa4[_0x1ed2('0x23')]]['channel']=_0x30caa4[_0x1ed2('0x24')];this[_0x1ed2('0x22')][_0x30caa4[_0x1ed2('0x23')]]['id']=this['faxAccounts'][_0x3e2cdc]['id'];this[_0x1ed2('0x22')][_0x30caa4[_0x1ed2('0x23')]]['name']=this[_0x1ed2('0xc')][_0x3e2cdc][_0x1ed2('0x25')];logger[_0x1ed2('0x26')](_0x30caa4['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x1ed2('0xe')][_0x30caa4[_0x1ed2('0x23')]]){this[_0x1ed2('0x22')][_0x30caa4[_0x1ed2('0x23')]]={};this['channels'][_0x30caa4['uniqueid']][_0x1ed2('0x24')]=_0x30caa4[_0x1ed2('0x24')];logger[_0x1ed2('0x26')](_0x30caa4['uniqueid'],_0x1ed2('0x27'));}};Fax[_0x1ed2('0x1c')][_0x1ed2('0x12')]=function(_0x5ba981){if(this[_0x1ed2('0x22')][_0x5ba981[_0x1ed2('0x23')]]){for(var _0x13ad02 in _0x5ba981[_0x1ed2('0x28')]){if(_0x5ba981[_0x1ed2('0x28')][_0x1ed2('0x1f')](_0x13ad02)){this[_0x1ed2('0x22')][_0x5ba981[_0x1ed2('0x23')]][_0x13ad02]=_0x5ba981[_0x1ed2('0x29')];}}}};Fax[_0x1ed2('0x1c')]['syncNewState']=function(_0x324423){if(this[_0x1ed2('0x22')][_0x324423['uniqueid']]){this['channels'][_0x324423[_0x1ed2('0x23')]][_0x1ed2('0x2a')]=_0x324423[_0x1ed2('0x2a')];this['channels'][_0x324423[_0x1ed2('0x23')]]['channelstatedesc']=_0x324423[_0x1ed2('0x2b')];}};Fax[_0x1ed2('0x1c')]['syncNewExten']=function(_0x5c88d2){if(this['channels'][_0x5c88d2[_0x1ed2('0x23')]]){for(var _0x4d46d7 in _0x5c88d2[_0x1ed2('0x28')]){if(_0x5c88d2[_0x1ed2('0x28')]['hasOwnProperty'](_0x4d46d7)){this['channels'][_0x5c88d2[_0x1ed2('0x23')]][_0x4d46d7]=_0x5c88d2[_0x1ed2('0x29')];}}}};Fax[_0x1ed2('0x1c')][_0x1ed2('0x17')]=function(_0x13aca3){if(this[_0x1ed2('0x22')][_0x13aca3[_0x1ed2('0x23')]]){this[_0x1ed2('0x22')][_0x13aca3['uniqueid']]['operation']=_0x13aca3[_0x1ed2('0x2c')];this['channels'][_0x13aca3[_0x1ed2('0x23')]][_0x1ed2('0x2d')]=_0x13aca3[_0x1ed2('0x2d')];this[_0x1ed2('0x22')][_0x13aca3[_0x1ed2('0x23')]][_0x1ed2('0x21')]=_0x13aca3[_0x1ed2('0x21')];this[_0x1ed2('0x22')][_0x13aca3[_0x1ed2('0x23')]][_0x1ed2('0x2e')]=_0x13aca3[_0x1ed2('0x2e')];logger[_0x1ed2('0x26')](_0x13aca3['uniqueid'],_0x1ed2('0x2f'));}};Fax[_0x1ed2('0x1c')][_0x1ed2('0x19')]=function(_0xfcbb34){var _0x166df2=this;if(this['channels'][_0xfcbb34[_0x1ed2('0x23')]]){var _0x295895=this[_0x1ed2('0x22')][_0xfcbb34[_0x1ed2('0x23')]]['id'];this[_0x1ed2('0x22')][_0xfcbb34[_0x1ed2('0x23')]][_0x1ed2('0x30')]=_0xfcbb34[_0x1ed2('0x30')];this[_0x1ed2('0x22')][_0xfcbb34[_0x1ed2('0x23')]][_0x1ed2('0x31')]=_0xfcbb34[_0x1ed2('0x31')];this[_0x1ed2('0x22')][_0xfcbb34['uniqueid']][_0x1ed2('0x21')]=_0xfcbb34[_0x1ed2('0x21')];this[_0x1ed2('0x22')][_0xfcbb34[_0x1ed2('0x23')]]['resolution']=_0xfcbb34[_0x1ed2('0x32')];this[_0x1ed2('0x22')][_0xfcbb34['uniqueid']][_0x1ed2('0x33')]=_0xfcbb34[_0x1ed2('0x33')];this['channels'][_0xfcbb34[_0x1ed2('0x23')]][_0x1ed2('0x2e')]=_0xfcbb34[_0x1ed2('0x2e')];this[_0x1ed2('0x22')][_0xfcbb34[_0x1ed2('0x23')]][_0x1ed2('0x34')]=_0xfcbb34[_0x1ed2('0x34')];if(this[_0x1ed2('0x22')][_0xfcbb34[_0x1ed2('0x23')]][_0x1ed2('0x31')]>0x0){tiff2pdf(_0xfcbb34[_0x1ed2('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x2c9d03){logger[_0x1ed2('0x26')](_0xfcbb34[_0x1ed2('0x23')],_0x1ed2('0x35'),_0x2c9d03[_0x1ed2('0x36')]);attachment['create']({'name':path[_0x1ed2('0x37')](_0xfcbb34['filename'])[_0x1ed2('0x25')],'basename':path[_0x1ed2('0x37')](_0xfcbb34['filename'])[_0x1ed2('0x25')]+_0x1ed2('0x38'),'type':_0x1ed2('0x39')})[_0x1ed2('0x3a')](function(_0x474d03){faxAccount[_0x1ed2('0x3b')](_0x295895,{'from':_0xfcbb34[_0x1ed2('0x34')],'mapKey':_0x1ed2('0x6'),'body':path[_0x1ed2('0x37')](_0xfcbb34[_0x1ed2('0x2e')])[_0x1ed2('0x25')]+_0x1ed2('0x38'),'AttachmentId':_0x474d03['id']})[_0x1ed2('0x3c')](function(_0x33f9f5){logger['error'](_0xfcbb34[_0x1ed2('0x23')],_0x1ed2('0x3d'),JSON[_0x1ed2('0x3e')](_0x33f9f5));});})[_0x1ed2('0x3c')](function(_0x106246){logger[_0x1ed2('0x3f')](_0xfcbb34[_0x1ed2('0x23')],_0x1ed2('0x40'),JSON[_0x1ed2('0x3e')](_0x106246));});});}logger['info'](_0xfcbb34['uniqueid'],_0x1ed2('0x40'));}};Fax[_0x1ed2('0x1c')]['syncOriginateResponse']=function(_0x59524b){if(this[_0x1ed2('0xe')][_0x59524b['uniqueid']]){_[_0x1ed2('0x41')](this['channels'][_0x59524b[_0x1ed2('0x23')]],_[_0x1ed2('0x42')](_0x59524b,[_0x1ed2('0x43'),_0x1ed2('0x44')]));}};function updateStatus(_0x2a6bc8){if(_0x2a6bc8[_0x1ed2('0x45')]){faxMessage[_0x1ed2('0x46')](_0x2a6bc8['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x1ed2('0x3a')](function(_0x50f1bb){ut[_0x1ed2('0x47')](_0x1ed2('0x48'),_0x50f1bb);})['catch'](function(_0x5dc504){ut[_0x1ed2('0x47')](_0x1ed2('0x49'),_0x5dc504);});}else{ut['logger'](_0x1ed2('0x4a'));}}Fax[_0x1ed2('0x1c')]['updateStatus']=function(_0x35cb19,_0x4f9878,_0x2e94e4){var _0x1307f9=this;var _0x157e81={};if(_0x4f9878){_0x157e81={'read':_0x4f9878};}else{_0x157e81={'failMessage':_0x2e94e4};}if(this[_0x1ed2('0xe')][_0x35cb19][_0x1ed2('0x45')]){faxMessage[_0x1ed2('0x46')](this[_0x1ed2('0xe')][_0x35cb19][_0x1ed2('0x45')],_0x157e81)['then'](function(_0xd10302){ut['logger'](_0x1ed2('0x4b'),_0xd10302);})[_0x1ed2('0x3c')](function(_0x3cbc23){ut['logger']('[Fax][Message][NoUpdate1]',_0x3cbc23);})[_0x1ed2('0x4c')](function(){delete _0x1307f9[_0x1ed2('0x22')][_0x35cb19];delete _0x1307f9[_0x1ed2('0xe')][_0x35cb19];});}else{ut[_0x1ed2('0x47')](_0x1ed2('0x4d'));delete this[_0x1ed2('0x22')][_0x35cb19];delete this[_0x1ed2('0xe')][_0x35cb19];}};Fax[_0x1ed2('0x1c')][_0x1ed2('0x4e')]=function(_0x24bbcb){var _0xaf6990=this;if(this[_0x1ed2('0x22')][_0x24bbcb[_0x1ed2('0x23')]]){if(this[_0x1ed2('0xe')][_0x24bbcb['uniqueid']]){this[_0x1ed2('0x22')][_0x24bbcb[_0x1ed2('0x23')]]['id']=this[_0x1ed2('0xe')][_0x24bbcb[_0x1ed2('0x23')]]['id'];this[_0x1ed2('0x22')][_0x24bbcb[_0x1ed2('0x23')]][_0x1ed2('0x25')]=this[_0x1ed2('0xe')][_0x24bbcb['uniqueid']]['name'];}logger[_0x1ed2('0x26')](_0x24bbcb['uniqueid'],this[_0x1ed2('0xe')][_0x24bbcb[_0x1ed2('0x23')]]?_0x1ed2('0x4f'):_0x1ed2('0x50'),JSON[_0x1ed2('0x3e')](this[_0x1ed2('0x22')][_0x24bbcb[_0x1ed2('0x23')]]));if(this[_0x1ed2('0xe')][_0x24bbcb[_0x1ed2('0x23')]]){if(this[_0x1ed2('0x22')][_0x24bbcb[_0x1ed2('0x23')]]['faxpages']>0x0&&this[_0x1ed2('0x22')][_0x24bbcb[_0x1ed2('0x23')]]['faxstatus']===_0x1ed2('0x51')){this['updateStatus'](_0x24bbcb['uniqueid'],!![]);}else{this[_0x1ed2('0x52')](_0x24bbcb[_0x1ed2('0x23')],![],this['channels'][_0x24bbcb['uniqueid']][_0x1ed2('0x53')]?_0x1ed2('0x54')+this['channels'][_0x24bbcb['uniqueid']][_0x1ed2('0x53')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x1ed2('0x55')]=function(_0xb41df2){var _0x30053e=this;return new BPromise(function(_0x2d2e4b,_0x2aab70){_0x30053e[_0x1ed2('0x56')](_0xb41df2,_0x30053e[_0x1ed2('0xc')][_0xb41df2['FaxAccountId']])[_0x1ed2('0x3a')](function(_0x42ed0d){ut[_0x1ed2('0x47')](_0x1ed2('0x57'),_0x42ed0d);_0x2d2e4b(ut['message'](_0x1ed2('0x58')));})[_0x1ed2('0x3c')](function(_0x499a74){ut['logger']('[Fax][execOriginate][failure]',_0x499a74);updateStatus(_0xb41df2);_0x2aab70(ut['message'](_0x1ed2('0x59')));});});};Fax['prototype'][_0x1ed2('0x5a')]=function(_0x41a924){var _0xdbb4ad=this;return new BPromise(function(_0xb20b22,_0x30e774){var _0x484721=_0xdbb4ad['checkTrunk'](_0xdbb4ad[_0x1ed2('0xc')][_0x41a924[_0x1ed2('0x5b')]][_0x1ed2('0x5c')],_0x41a924);if(_0x484721['isValid']){_0xb20b22(ut['message']('Trunk\x20Reachable'));}else{_0x30e774(ut[_0x1ed2('0x36')](_0x484721[_0x1ed2('0x36')]));}});};function originate(_0x442694,_0x30a529,_0x21e599){return new BPromise(function(_0x594c2a,_0xda7c6){if(_0x21e599){var _0x5df769=util[_0x1ed2('0x5d')](_0x1ed2('0x5e'),path[_0x1ed2('0x37')](_0x442694['path'])[_0x1ed2('0x25')],_0x442694[_0x1ed2('0x3')]);gs[_0x1ed2('0x5f')](_0x5df769)[_0x1ed2('0x3a')](function(){_0x442694['path']=util[_0x1ed2('0x5d')](_0x1ed2('0x60'),path['parse'](_0x442694[_0x1ed2('0x3')])[_0x1ed2('0x61')],path['parse'](_0x442694[_0x1ed2('0x3')])['name']);_0x30a529[_0x1ed2('0x62')]=_0x442694[_0x1ed2('0x3')];ut[_0x1ed2('0x47')](_0x1ed2('0x63'),'');ami[_0x1ed2('0x64')](ut[_0x1ed2('0x65')](_0x442694,_0x30a529))['then'](function(_0x21d072){_0x594c2a(_0x21d072);})[_0x1ed2('0x3c')](function(_0x7ec8f5){_0xda7c6(_0x7ec8f5);});})[_0x1ed2('0x3c')](function(_0x2a7fd9){_0xda7c6(_0x2a7fd9);});}else{ami['Action'](ut[_0x1ed2('0x65')](_0x442694,_0x30a529))['then'](function(_0xad18e3){_0x594c2a(_0xad18e3);})[_0x1ed2('0x3c')](function(_0x1e9905){_0xda7c6(_0x1e9905);});}});}Fax[_0x1ed2('0x1c')][_0x1ed2('0x56')]=function(_0x384b7a,_0x516994){var _0x1cc985=this;return new BPromise(function(_0xa34c77,_0x9fe19){var _0x24db3f=uuid['v4']();var _0x2de689=ut[_0x1ed2('0x66')](_0x384b7a,_0x516994);_0x1cc985[_0x1ed2('0xe')][_0x24db3f]=new Action(_0x24db3f,_0x516994,_0x384b7a);var _0x36b3d8=_0x1cc985['actions'][_0x24db3f];if(path['parse'](_0x384b7a[_0x1ed2('0x3')])['ext']===_0x1ed2('0x38')){originate(_0x36b3d8,_0x2de689,!![])[_0x1ed2('0x3a')](function(_0x219895){_0xa34c77(_0x219895);})['catch'](function(_0x458b53){_0x9fe19(_0x458b53);});}else{originate(_0x36b3d8,_0x2de689,![])[_0x1ed2('0x3a')](function(_0x5f2235){_0xa34c77(_0x5f2235);})[_0x1ed2('0x3c')](function(_0x3f5dc3){_0x9fe19(_0x3f5dc3);});}});};Fax['prototype'][_0x1ed2('0x67')]=function(_0x21ce8f){return!_[_0x1ed2('0x68')](_0x21ce8f)&&!_[_0x1ed2('0x68')](_0x21ce8f[_0x1ed2('0x25')])&&!_[_0x1ed2('0x68')](_0x21ce8f[_0x1ed2('0x69')])&&_0x21ce8f['active']&&!_[_0x1ed2('0x68')](this[_0x1ed2('0xd')][util['format']('SIP/%s',_0x21ce8f[_0x1ed2('0x25')])])&&!_['isNil'](this[_0x1ed2('0xd')][util[_0x1ed2('0x5d')](_0x1ed2('0x6a'),_0x21ce8f[_0x1ed2('0x25')])][_0x1ed2('0x2d')])&&(this[_0x1ed2('0xd')][util[_0x1ed2('0x5d')](_0x1ed2('0x6a'),_0x21ce8f[_0x1ed2('0x25')])][_0x1ed2('0x2d')]==='reachable'||this[_0x1ed2('0xd')][util[_0x1ed2('0x5d')](_0x1ed2('0x6a'),_0x21ce8f[_0x1ed2('0x25')])][_0x1ed2('0x2d')]===_0x1ed2('0x6b'));};Fax[_0x1ed2('0x1c')][_0x1ed2('0x6c')]=function(_0x1dce1d,_0xc60e8a){if(!this[_0x1ed2('0x67')](_0x1dce1d)){ut[_0x1ed2('0x47')](_0x1ed2('0x6d'),_[_0x1ed2('0x68')](_0x1dce1d)?'':_0x1dce1d[_0x1ed2('0x25')]+_0x1ed2('0x6e'));return{'isValid':![],'message':_0x1ed2('0x6f')};}if(_[_0x1ed2('0x68')](_0xc60e8a[_0x1ed2('0x6')])){ut[_0x1ed2('0x47')](_0x1ed2('0x70'),JSON['stringify'](_0xc60e8a));return{'isValid':![],'message':_0x1ed2('0x71')};}if(_[_0x1ed2('0x68')](_0xc60e8a[_0x1ed2('0x3')])){ut[_0x1ed2('0x47')](_0x1ed2('0x72'),JSON[_0x1ed2('0x3e')](_0xc60e8a));return{'isValid':![],'message':_0x1ed2('0x73')};}return{'isValid':!![],'message':_0x1ed2('0x74')};};module[_0x1ed2('0x75')]=Fax; \ No newline at end of file +var _0xce25=['syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','then','logger','[Fax][Message][Error][Updated]','updateStatus','update','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','tiff2pdf','./util/gs','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','faxstatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xce25,0x196));var _0x5ce2=function(_0x522f40,_0x326507){_0x522f40=_0x522f40-0x0;var _0x33dbb4=_0xce25[_0x522f40];return _0x33dbb4;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x5ce2('0x0'));var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x5ce2('0x1'));var gs=require(_0x5ce2('0x2'));var logger=require('../../../config/logger')(_0x5ce2('0x3'));var ami=require(_0x5ce2('0x4'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x5ce2('0x5'));var Action=require(_0x5ce2('0x6'));var faxAccount=require(_0x5ce2('0x7'));var attachment=require(_0x5ce2('0x8'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2ccf81){this[_0x5ce2('0x9')]={};this[_0x5ce2('0xa')]=_0x2ccf81['faxAccounts'];this[_0x5ce2('0xb')]=_0x2ccf81[_0x5ce2('0xb')];this[_0x5ce2('0xc')]={};ami['on'](_0x5ce2('0xd'),this[_0x5ce2('0xe')][_0x5ce2('0xf')](this));ami['on']('varset',this[_0x5ce2('0x10')]['bind'](this));ami['on'](_0x5ce2('0x11'),this[_0x5ce2('0x12')]['bind'](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x5ce2('0x13'),this['syncFaxStatus']['bind'](this));ami['on'](_0x5ce2('0x14'),this['syncReceiveFax'][_0x5ce2('0xf')](this));ami['on'](_0x5ce2('0x15'),this[_0x5ce2('0x16')]['bind'](this));ami['on'](_0x5ce2('0x17'),this[_0x5ce2('0x18')][_0x5ce2('0xf')](this));}Fax['prototype']['syncNewchannel']=function(_0x27065e){if(_0x27065e[_0x5ce2('0x19')]===_0x5ce2('0x1a')){for(var _0x5369e7 in this[_0x5ce2('0xa')]){if(this[_0x5ce2('0xa')][_0x5ce2('0x1b')](_0x5369e7)){if(_0x27065e[_0x5ce2('0x1c')]===this[_0x5ce2('0xa')][_0x5369e7][_0x5ce2('0x1d')]){this[_0x5ce2('0x9')][_0x27065e[_0x5ce2('0x1e')]]={};this[_0x5ce2('0x9')][_0x27065e[_0x5ce2('0x1e')]][_0x5ce2('0x1f')]=_0x27065e[_0x5ce2('0x1f')];this[_0x5ce2('0x9')][_0x27065e[_0x5ce2('0x1e')]]['id']=this[_0x5ce2('0xa')][_0x5369e7]['id'];this[_0x5ce2('0x9')][_0x27065e[_0x5ce2('0x1e')]][_0x5ce2('0x20')]=this[_0x5ce2('0xa')][_0x5369e7]['name'];logger['info'](_0x27065e[_0x5ce2('0x1e')],_0x5ce2('0x21'));}}}}if(this[_0x5ce2('0xc')][_0x27065e['uniqueid']]){this['channels'][_0x27065e[_0x5ce2('0x1e')]]={};this[_0x5ce2('0x9')][_0x27065e['uniqueid']][_0x5ce2('0x1f')]=_0x27065e[_0x5ce2('0x1f')];logger[_0x5ce2('0x22')](_0x27065e[_0x5ce2('0x1e')],_0x5ce2('0x21'));}};Fax[_0x5ce2('0x23')][_0x5ce2('0x10')]=function(_0x19e637){if(this[_0x5ce2('0x9')][_0x19e637[_0x5ce2('0x1e')]]){for(var _0x2f4ccd in _0x19e637[_0x5ce2('0x24')]){if(_0x19e637[_0x5ce2('0x24')][_0x5ce2('0x1b')](_0x2f4ccd)){this[_0x5ce2('0x9')][_0x19e637[_0x5ce2('0x1e')]][_0x2f4ccd]=_0x19e637[_0x5ce2('0x25')];}}}};Fax[_0x5ce2('0x23')][_0x5ce2('0x12')]=function(_0x127a83){if(this[_0x5ce2('0x9')][_0x127a83[_0x5ce2('0x1e')]]){this[_0x5ce2('0x9')][_0x127a83[_0x5ce2('0x1e')]][_0x5ce2('0x26')]=_0x127a83[_0x5ce2('0x26')];this[_0x5ce2('0x9')][_0x127a83[_0x5ce2('0x1e')]][_0x5ce2('0x27')]=_0x127a83[_0x5ce2('0x27')];}};Fax[_0x5ce2('0x23')][_0x5ce2('0x28')]=function(_0x4f55c8){if(this[_0x5ce2('0x9')][_0x4f55c8[_0x5ce2('0x1e')]]){for(var _0x1d19e4 in _0x4f55c8['variable']){if(_0x4f55c8['variable'][_0x5ce2('0x1b')](_0x1d19e4)){this[_0x5ce2('0x9')][_0x4f55c8[_0x5ce2('0x1e')]][_0x1d19e4]=_0x4f55c8['value'];}}}};Fax['prototype'][_0x5ce2('0x29')]=function(_0x132b48){if(this['channels'][_0x132b48[_0x5ce2('0x1e')]]){this[_0x5ce2('0x9')][_0x132b48[_0x5ce2('0x1e')]][_0x5ce2('0x2a')]=_0x132b48[_0x5ce2('0x2a')];this[_0x5ce2('0x9')][_0x132b48[_0x5ce2('0x1e')]][_0x5ce2('0x2b')]=_0x132b48[_0x5ce2('0x2b')];this[_0x5ce2('0x9')][_0x132b48[_0x5ce2('0x1e')]]['localstationid']=_0x132b48['localstationid'];this['channels'][_0x132b48['uniqueid']][_0x5ce2('0x2c')]=_0x132b48[_0x5ce2('0x2c')];logger[_0x5ce2('0x22')](_0x132b48[_0x5ce2('0x1e')],_0x5ce2('0x2d'));}};Fax[_0x5ce2('0x23')][_0x5ce2('0x2e')]=function(_0xe5a066){var _0x31c0c5=this;if(this[_0x5ce2('0x9')][_0xe5a066[_0x5ce2('0x1e')]]){var _0x2f8dff=this['channels'][_0xe5a066[_0x5ce2('0x1e')]]['id'];this[_0x5ce2('0x9')][_0xe5a066['uniqueid']][_0x5ce2('0x2f')]=_0xe5a066[_0x5ce2('0x2f')];this[_0x5ce2('0x9')][_0xe5a066[_0x5ce2('0x1e')]]['pagestransferred']=_0xe5a066[_0x5ce2('0x30')];this[_0x5ce2('0x9')][_0xe5a066[_0x5ce2('0x1e')]][_0x5ce2('0x1d')]=_0xe5a066[_0x5ce2('0x1d')];this[_0x5ce2('0x9')][_0xe5a066['uniqueid']][_0x5ce2('0x31')]=_0xe5a066[_0x5ce2('0x31')];this['channels'][_0xe5a066[_0x5ce2('0x1e')]][_0x5ce2('0x32')]=_0xe5a066['transferrate'];this[_0x5ce2('0x9')][_0xe5a066[_0x5ce2('0x1e')]][_0x5ce2('0x2c')]=_0xe5a066[_0x5ce2('0x2c')];this[_0x5ce2('0x9')][_0xe5a066[_0x5ce2('0x1e')]][_0x5ce2('0x33')]=_0xe5a066[_0x5ce2('0x33')];if(this[_0x5ce2('0x9')][_0xe5a066['uniqueid']][_0x5ce2('0x30')]>0x0){tiff2pdf(_0xe5a066[_0x5ce2('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x44675f){logger['info'](_0xe5a066[_0x5ce2('0x1e')],_0x5ce2('0x34'),_0x44675f[_0x5ce2('0x35')]);attachment[_0x5ce2('0x36')]({'name':path[_0x5ce2('0x37')](_0xe5a066[_0x5ce2('0x2c')])[_0x5ce2('0x20')],'basename':path['parse'](_0xe5a066[_0x5ce2('0x2c')])[_0x5ce2('0x20')]+_0x5ce2('0x38'),'type':_0x5ce2('0x39')})['then'](function(_0x139233){faxAccount[_0x5ce2('0x3a')](_0x2f8dff,{'from':_0xe5a066[_0x5ce2('0x33')],'mapKey':_0x5ce2('0x3'),'body':path['parse'](_0xe5a066[_0x5ce2('0x2c')])[_0x5ce2('0x20')]+_0x5ce2('0x38'),'AttachmentId':_0x139233['id']})[_0x5ce2('0x3b')](function(_0x50c6f9){logger[_0x5ce2('0x3c')](_0xe5a066[_0x5ce2('0x1e')],_0x5ce2('0x3d'),JSON[_0x5ce2('0x3e')](_0x50c6f9));});})[_0x5ce2('0x3b')](function(_0x5e8686){logger[_0x5ce2('0x3c')](_0xe5a066[_0x5ce2('0x1e')],_0x5ce2('0x3f'),JSON[_0x5ce2('0x3e')](_0x5e8686));});});}logger[_0x5ce2('0x22')](_0xe5a066[_0x5ce2('0x1e')],_0x5ce2('0x3f'));}};Fax[_0x5ce2('0x23')][_0x5ce2('0x18')]=function(_0x215d5){if(this['actions'][_0x215d5[_0x5ce2('0x1e')]]){_[_0x5ce2('0x40')](this[_0x5ce2('0x9')][_0x215d5['uniqueid']],_[_0x5ce2('0x41')](_0x215d5,['response',_0x5ce2('0x42')]));}};function updateStatus(_0x52345c){if(_0x52345c[_0x5ce2('0x43')]){faxMessage['update'](_0x52345c['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x5ce2('0x44')](function(_0x3f4b0f){ut[_0x5ce2('0x45')](_0x5ce2('0x46'),_0x3f4b0f);})[_0x5ce2('0x3b')](function(_0x2f7c04){ut[_0x5ce2('0x45')]('[Fax][Message][Error][NoUpdate1]',_0x2f7c04);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x5ce2('0x47')]=function(_0x49f7e6,_0x1d9eed,_0x296ea8){var _0x33039f=this;var _0x682f24={};if(_0x1d9eed){_0x682f24={'read':_0x1d9eed};}else{_0x682f24={'failMessage':_0x296ea8};}if(this['actions'][_0x49f7e6][_0x5ce2('0x43')]){faxMessage[_0x5ce2('0x48')](this[_0x5ce2('0xc')][_0x49f7e6][_0x5ce2('0x43')],_0x682f24)[_0x5ce2('0x44')](function(_0x2b5fc5){ut[_0x5ce2('0x45')]('[Fax][Message][Updated]',_0x2b5fc5);})[_0x5ce2('0x3b')](function(_0x2880cf){ut[_0x5ce2('0x45')](_0x5ce2('0x49'),_0x2880cf);})['finally'](function(){delete _0x33039f[_0x5ce2('0x9')][_0x49f7e6];delete _0x33039f[_0x5ce2('0xc')][_0x49f7e6];});}else{ut['logger'](_0x5ce2('0x4a'));delete this[_0x5ce2('0x9')][_0x49f7e6];delete this[_0x5ce2('0xc')][_0x49f7e6];}};Fax[_0x5ce2('0x23')][_0x5ce2('0x16')]=function(_0x25e55c){var _0x1ae89d=this;if(this[_0x5ce2('0x9')][_0x25e55c[_0x5ce2('0x1e')]]){if(this[_0x5ce2('0xc')][_0x25e55c['uniqueid']]){this[_0x5ce2('0x9')][_0x25e55c['uniqueid']]['id']=this[_0x5ce2('0xc')][_0x25e55c[_0x5ce2('0x1e')]]['id'];this[_0x5ce2('0x9')][_0x25e55c['uniqueid']][_0x5ce2('0x20')]=this['actions'][_0x25e55c['uniqueid']][_0x5ce2('0x20')];}logger[_0x5ce2('0x22')](_0x25e55c[_0x5ce2('0x1e')],this['actions'][_0x25e55c[_0x5ce2('0x1e')]]?_0x5ce2('0x4b'):_0x5ce2('0x4c'),JSON[_0x5ce2('0x3e')](this[_0x5ce2('0x9')][_0x25e55c['uniqueid']]));if(this[_0x5ce2('0xc')][_0x25e55c[_0x5ce2('0x1e')]]){if(this[_0x5ce2('0x9')][_0x25e55c[_0x5ce2('0x1e')]][_0x5ce2('0x4d')]>0x0&&this[_0x5ce2('0x9')][_0x25e55c[_0x5ce2('0x1e')]][_0x5ce2('0x13')]===_0x5ce2('0x4e')){this['updateStatus'](_0x25e55c['uniqueid'],!![]);}else{this[_0x5ce2('0x47')](_0x25e55c[_0x5ce2('0x1e')],![],this['channels'][_0x25e55c['uniqueid']][_0x5ce2('0x4f')]?_0x5ce2('0x50')+this[_0x5ce2('0x9')][_0x25e55c['uniqueid']]['faxstatusstring']:_0x5ce2('0x51'));}}}};Fax[_0x5ce2('0x23')][_0x5ce2('0x52')]=function(_0x1fe0a2){var _0x2268d8=this;return new BPromise(function(_0x191d62,_0x1514e8){_0x2268d8[_0x5ce2('0x53')](_0x1fe0a2,_0x2268d8[_0x5ce2('0xa')][_0x1fe0a2['FaxAccountId']])['then'](function(_0x2ad78c){ut[_0x5ce2('0x45')](_0x5ce2('0x54'),_0x2ad78c);_0x191d62(ut[_0x5ce2('0x35')](_0x5ce2('0x55')));})['catch'](function(_0x285528){ut[_0x5ce2('0x45')](_0x5ce2('0x56'),_0x285528);updateStatus(_0x1fe0a2);_0x1514e8(ut[_0x5ce2('0x35')](_0x5ce2('0x57')));});});};Fax[_0x5ce2('0x23')][_0x5ce2('0x58')]=function(_0x54e72f){var _0x466a8b=this;return new BPromise(function(_0x3167cc,_0x48d415){var _0x156c58=_0x466a8b[_0x5ce2('0x59')](_0x466a8b[_0x5ce2('0xa')][_0x54e72f[_0x5ce2('0x5a')]][_0x5ce2('0x5b')],_0x54e72f);if(_0x156c58['isValid']){_0x3167cc(ut[_0x5ce2('0x35')]('Trunk\x20Reachable'));}else{_0x48d415(ut['message'](_0x156c58[_0x5ce2('0x35')]));}});};function originate(_0x151507,_0x46bd13,_0x1ae5ae){return new BPromise(function(_0xacc9b9,_0x2549ea){if(_0x1ae5ae){var _0x4555ef=util[_0x5ce2('0x5c')](_0x5ce2('0x5d'),path[_0x5ce2('0x37')](_0x151507['path'])[_0x5ce2('0x20')],_0x151507[_0x5ce2('0x5e')]);gs['execute'](_0x4555ef)[_0x5ce2('0x44')](function(){_0x151507['path']=util[_0x5ce2('0x5c')](_0x5ce2('0x5f'),path[_0x5ce2('0x37')](_0x151507[_0x5ce2('0x5e')])['dir'],path['parse'](_0x151507[_0x5ce2('0x5e')])['name']);_0x46bd13['XMF-PATH']=_0x151507[_0x5ce2('0x5e')];ut[_0x5ce2('0x45')](_0x5ce2('0x60'),'');ami[_0x5ce2('0x61')](ut[_0x5ce2('0x62')](_0x151507,_0x46bd13))[_0x5ce2('0x44')](function(_0x5132d7){_0xacc9b9(_0x5132d7);})[_0x5ce2('0x3b')](function(_0x3a38be){_0x2549ea(_0x3a38be);});})['catch'](function(_0x2f5bf0){_0x2549ea(_0x2f5bf0);});}else{ami[_0x5ce2('0x61')](ut[_0x5ce2('0x62')](_0x151507,_0x46bd13))['then'](function(_0x20a50f){_0xacc9b9(_0x20a50f);})[_0x5ce2('0x3b')](function(_0x5ea4ca){_0x2549ea(_0x5ea4ca);});}});}Fax['prototype']['execOriginate']=function(_0x5ed0af,_0x27aaef){var _0xda1e47=this;return new BPromise(function(_0x220870,_0x177337){var _0x14ab0c=uuid['v4']();var _0x2af55d=ut['addVariables'](_0x5ed0af,_0x27aaef);_0xda1e47[_0x5ce2('0xc')][_0x14ab0c]=new Action(_0x14ab0c,_0x27aaef,_0x5ed0af);var _0x5d11ab=_0xda1e47[_0x5ce2('0xc')][_0x14ab0c];if(path[_0x5ce2('0x37')](_0x5ed0af[_0x5ce2('0x5e')])[_0x5ce2('0x63')]==='.pdf'){originate(_0x5d11ab,_0x2af55d,!![])[_0x5ce2('0x44')](function(_0x1bfe8e){_0x220870(_0x1bfe8e);})['catch'](function(_0x216e46){_0x177337(_0x216e46);});}else{originate(_0x5d11ab,_0x2af55d,![])['then'](function(_0x18489e){_0x220870(_0x18489e);})['catch'](function(_0x37249c){_0x177337(_0x37249c);});}});};Fax['prototype'][_0x5ce2('0x64')]=function(_0x11a75a){return!_[_0x5ce2('0x65')](_0x11a75a)&&!_[_0x5ce2('0x65')](_0x11a75a[_0x5ce2('0x20')])&&!_['isNil'](_0x11a75a[_0x5ce2('0x66')])&&_0x11a75a[_0x5ce2('0x66')]&&!_[_0x5ce2('0x65')](this[_0x5ce2('0xb')][util['format'](_0x5ce2('0x67'),_0x11a75a[_0x5ce2('0x20')])])&&!_['isNil'](this[_0x5ce2('0xb')][util[_0x5ce2('0x5c')](_0x5ce2('0x67'),_0x11a75a[_0x5ce2('0x20')])][_0x5ce2('0x2b')])&&(this[_0x5ce2('0xb')][util[_0x5ce2('0x5c')](_0x5ce2('0x67'),_0x11a75a[_0x5ce2('0x20')])][_0x5ce2('0x2b')]===_0x5ce2('0x68')||this[_0x5ce2('0xb')][util['format'](_0x5ce2('0x67'),_0x11a75a[_0x5ce2('0x20')])]['status']==='unmonitored');};Fax[_0x5ce2('0x23')]['checkTrunk']=function(_0x1ff9f4,_0x16f4bd){if(!this[_0x5ce2('0x64')](_0x1ff9f4)){ut['logger'](_0x5ce2('0x69'),_['isNil'](_0x1ff9f4)?'':_0x1ff9f4[_0x5ce2('0x20')]+_0x5ce2('0x6a'));return{'isValid':![],'message':_0x5ce2('0x6b')};}if(_[_0x5ce2('0x65')](_0x16f4bd[_0x5ce2('0x3')])){ut[_0x5ce2('0x45')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x5ce2('0x3e')](_0x16f4bd));return{'isValid':![],'message':_0x5ce2('0x6c')};}if(_[_0x5ce2('0x65')](_0x16f4bd['path'])){ut[_0x5ce2('0x45')](_0x5ce2('0x6d'),JSON[_0x5ce2('0x3e')](_0x16f4bd));return{'isValid':![],'message':_0x5ce2('0x6e')};}return{'isValid':!![],'message':_0x5ce2('0x6f')};};module[_0x5ce2('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f89ba5e..71f0cbc 100644 --- a/server/services/ami/fax/rpcDb.js +++ b/server/services/ami/fax/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71e7=['util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','then','notify','catch','[Notify]\x20'];(function(_0x5109d3,_0x5e72bb){var _0x7905cd=function(_0x18515c){while(--_0x18515c){_0x5109d3['push'](_0x5109d3['shift']());}};_0x7905cd(++_0x5e72bb);}(_0x71e7,0x181));var _0x771e=function(_0x2cbb8f,_0x58f2d9){_0x2cbb8f=_0x2cbb8f-0x0;var _0x9f7644=_0x71e7[_0x2cbb8f];return _0x9f7644;};'use strict';var util=require(_0x771e('0x0'));var BPromise=require(_0x771e('0x1'));var logger=require(_0x771e('0x2'))(_0x771e('0x3'));var _=require('lodash');var faxAccount=require(_0x771e('0x4'));function loggerCatch(_0x585744){return function(_0x400726){logger[_0x771e('0x5')](_0x585744,util[_0x771e('0x6')](_0x400726,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x57ced7,_0x5e3a71){return BPromise['resolve']()[_0x771e('0x7')](faxAccount[_0x771e('0x8')](_0x57ced7,_0x5e3a71))[_0x771e('0x9')](loggerCatch(_0x771e('0xa')));}; \ No newline at end of file +var _0x7115=['resolve','catch','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify'];(function(_0x4ed947,_0x25b022){var _0x5635d7=function(_0x335645){while(--_0x335645){_0x4ed947['push'](_0x4ed947['shift']());}};_0x5635d7(++_0x25b022);}(_0x7115,0xdf));var _0x5711=function(_0xb09208,_0x375996){_0xb09208=_0xb09208-0x0;var _0x58f8e2=_0x7115[_0xb09208];return _0x58f8e2;};'use strict';var util=require(_0x5711('0x0'));var BPromise=require('bluebird');var logger=require(_0x5711('0x1'))(_0x5711('0x2'));var _=require(_0x5711('0x3'));var faxAccount=require(_0x5711('0x4'));function loggerCatch(_0x345fba){return function(_0x32349b){logger[_0x5711('0x5')](_0x345fba,util['inspect'](_0x32349b,{'showHidden':![],'depth':null}));};}exports[_0x5711('0x6')]=function(_0x3150e6,_0x1ff2b9){return BPromise[_0x5711('0x7')]()['then'](faxAccount[_0x5711('0x6')](_0x3150e6,_0x1ff2b9))[_0x5711('0x8')](loggerCatch(_0x5711('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 37838d7..dc2f6e7 100644 --- a/server/services/ami/fax/util/gs.js +++ b/server/services/ami/fax/util/gs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9c5=['util','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc9c5,0x17c));var _0x5c9c=function(_0x21f3c3,_0x42e32c){_0x21f3c3=_0x21f3c3-0x0;var _0x15957=_0xc9c5[_0x21f3c3];return _0x15957;};'use strict';var util=require(_0x5c9c('0x0'));var logger=require('../../../../config/logger')(_0x5c9c('0x1'));var BPromise=require(_0x5c9c('0x2'));var exec=require(_0x5c9c('0x3'))[_0x5c9c('0x4')];exports[_0x5c9c('0x5')]=function(_0x55744b){return new BPromise(function(_0x277f88,_0x58ac2b){exec(_0x55744b,function(_0x2c8192,_0x23a6c1,_0x5defcc){logger[_0x5c9c('0x6')]('Exec\x20gs',_0x23a6c1);if(_0x2c8192){logger[_0x5c9c('0x6')](_0x5c9c('0x7'),_0x5c9c('0x8'),util[_0x5c9c('0x9')](_0x2c8192,{'showHidden':![],'depth':null}),_0x23a6c1,_0x5defcc);_0x58ac2b(_0x2c8192);}_0x277f88(_0x23a6c1);});});}; \ No newline at end of file +var _0xae6f=['bluebird','exec','execute','info','Exec\x20gs','\x20Error\x20:','../../../../config/logger','fax'];(function(_0x92b4dc,_0x20f18a){var _0xe68d92=function(_0x707cc1){while(--_0x707cc1){_0x92b4dc['push'](_0x92b4dc['shift']());}};_0xe68d92(++_0x20f18a);}(_0xae6f,0x1de));var _0xfae6=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xae6f[_0x49b207];return _0x2dc8fa;};'use strict';var util=require('util');var logger=require(_0xfae6('0x0'))(_0xfae6('0x1'));var BPromise=require(_0xfae6('0x2'));var exec=require('child_process')[_0xfae6('0x3')];exports[_0xfae6('0x4')]=function(_0x2efc74){return new BPromise(function(_0x33fc23,_0x4d3d31){exec(_0x2efc74,function(_0xb9ed7a,_0x1e9a9c,_0x4cb436){logger[_0xfae6('0x5')](_0xfae6('0x6'),_0x1e9a9c);if(_0xb9ed7a){logger[_0xfae6('0x5')](_0xfae6('0x6'),_0xfae6('0x7'),util['inspect'](_0xb9ed7a,{'showHidden':![],'depth':null}),_0x1e9a9c,_0x4cb436);_0x4d3d31(_0xb9ed7a);}_0x33fc23(_0x1e9a9c);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index c115766..3c25770 100644 --- a/server/services/ami/fax/util/util.js +++ b/server/services/ami/fax/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa23a=['path','variablesAction','uniqueid','channel','from-sip','format','\x22%s\x22\x20<%s>','util','message','logger','inspect','addVariables','ecm','headerinfo','maxrate','modem','faxdetect','localstationid'];(function(_0x43df87,_0x59bac7){var _0x49caaf=function(_0x3d356c){while(--_0x3d356c){_0x43df87['push'](_0x43df87['shift']());}};_0x49caaf(++_0x59bac7);}(_0xa23a,0x85));var _0xaa23=function(_0x44714c,_0x2ac454){_0x44714c=_0x44714c-0x0;var _0x57d4d5=_0xa23a[_0x44714c];return _0x57d4d5;};'use strict';var util=require(_0xaa23('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')('fax');exports[_0xaa23('0x1')]=function(_0x1330aa){return{'message':_0x1330aa};};exports[_0xaa23('0x2')]=function(_0x11407d,_0x2a4262){logger['info'](_0x11407d,util[_0xaa23('0x3')](_0x2a4262,{'showHidden':![],'depth':null}));};exports[_0xaa23('0x4')]=function(_0x11b4ef,_0x16becd){var _0x212965={'XMF-ECM':_0x16becd[_0xaa23('0x5')],'XMF-HEADERINFO':_0x16becd[_0xaa23('0x6')],'XMF-MINRATE':_0x16becd['minrate'],'XMF-MAXRATE':_0x16becd[_0xaa23('0x7')],'XMF-MODEM':util['format']('\x22%s\x22',_0x16becd[_0xaa23('0x8')]),'XMF-GATEWAY':_0x16becd['gateway'],'XMF-FAXDETECT':_0x16becd[_0xaa23('0x9')],'XMF-T38TIMEOUT':_0x16becd['t38timeout'],'XMF-LOCALSTATIONID':_0x16becd[_0xaa23('0xa')],'XMF-PATH':_0x11b4ef[_0xaa23('0xb')]};return _0x212965;};exports[_0xaa23('0xc')]=function(_0x259d31,_0x2810de){return{'actionid':_0x259d31[_0xaa23('0xd')],'action':'originate','channel':_0x259d31[_0xaa23('0xe')],'Exten':'xcally-motion-fax','Context':_0xaa23('0xf'),'Priority':'1','callerid':util[_0xaa23('0x10')](_0xaa23('0x11'),_0x259d31['headerinfo']?_0x259d31['headerinfo']:'',_0x259d31[_0xaa23('0xa')]),'variable':_0x2810de,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x259d31['uniqueid']};}; \ No newline at end of file +var _0x8082=['maxrate','gateway','t38timeout','localstationid','path','variablesAction','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','inspect','addVariables','ecm','headerinfo','minrate'];(function(_0x29a95c,_0x3aa280){var _0x246a8c=function(_0x4545ff){while(--_0x4545ff){_0x29a95c['push'](_0x29a95c['shift']());}};_0x246a8c(++_0x3aa280);}(_0x8082,0xdb));var _0x2808=function(_0x270b61,_0x326a42){_0x270b61=_0x270b61-0x0;var _0x34e89e=_0x8082[_0x270b61];return _0x34e89e;};'use strict';var util=require(_0x2808('0x0'));var _=require(_0x2808('0x1'));var moment=require(_0x2808('0x2'));var logger=require(_0x2808('0x3'))(_0x2808('0x4'));exports[_0x2808('0x5')]=function(_0x5b6111){return{'message':_0x5b6111};};exports['logger']=function(_0x5280d5,_0x2ec8fe){logger['info'](_0x5280d5,util[_0x2808('0x6')](_0x2ec8fe,{'showHidden':![],'depth':null}));};exports[_0x2808('0x7')]=function(_0x2afb60,_0x27523a){var _0x40e721={'XMF-ECM':_0x27523a[_0x2808('0x8')],'XMF-HEADERINFO':_0x27523a[_0x2808('0x9')],'XMF-MINRATE':_0x27523a[_0x2808('0xa')],'XMF-MAXRATE':_0x27523a[_0x2808('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0x27523a['modem']),'XMF-GATEWAY':_0x27523a[_0x2808('0xc')],'XMF-FAXDETECT':_0x27523a['faxdetect'],'XMF-T38TIMEOUT':_0x27523a[_0x2808('0xd')],'XMF-LOCALSTATIONID':_0x27523a[_0x2808('0xe')],'XMF-PATH':_0x2afb60[_0x2808('0xf')]};return _0x40e721;};exports[_0x2808('0x10')]=function(_0x358e2f,_0x1839db){return{'actionid':_0x358e2f['uniqueid'],'action':'originate','channel':_0x358e2f[_0x2808('0x11')],'Exten':_0x2808('0x12'),'Context':_0x2808('0x13'),'Priority':'1','callerid':util[_0x2808('0x14')](_0x2808('0x15'),_0x358e2f[_0x2808('0x9')]?_0x358e2f['headerinfo']:'',_0x358e2f[_0x2808('0xe')]),'variable':_0x1839db,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x358e2f[_0x2808('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index cf9171b..0ed2a1d 100644 --- a/server/services/ami/index.js +++ b/server/services/ami/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ff9=['./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','catch','[index.js][main]','util','./server','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales'];(function(_0x1abd3b,_0x3d6314){var _0x2914af=function(_0xc207f3){while(--_0xc207f3){_0x1abd3b['push'](_0x1abd3b['shift']());}};_0x2914af(++_0x3d6314);}(_0x0ff9,0x80));var _0x90ff=function(_0x4f1d89,_0x43edf6){_0x4f1d89=_0x4f1d89-0x0;var _0x4e80da=_0x0ff9[_0x4f1d89];return _0x4e80da;};'use strict';var util=require(_0x90ff('0x0'));var moment=require('moment');var server=require(_0x90ff('0x1'));var Realtime=require('./realtime');var Report=require(_0x90ff('0x2'));var Acw=require(_0x90ff('0x3'));var Trigger=require(_0x90ff('0x4'));var Dialer=require('./dialer');var Preview=require(_0x90ff('0x5'));var Fax=require(_0x90ff('0x6'));var user=require(_0x90ff('0x7'));var voiceQueue=require(_0x90ff('0x8'));var voiceQueueReport=require(_0x90ff('0x9'));var voiceCallReport=require(_0x90ff('0xa'));var trunk=require(_0x90ff('0xb'));var trigger=require(_0x90ff('0xc'));var template=require(_0x90ff('0xd'));var cmHopperHistory=require(_0x90ff('0xe'));var campaign=require(_0x90ff('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x90ff('0x10'));var zendesk=require(_0x90ff('0x11'));var salesforce=require(_0x90ff('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x90ff('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x90ff('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x90ff('0x15'));var servicenow=require(_0x90ff('0x16'));var dynamics365=require(_0x90ff('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x90ff('0x18')](_0x90ff('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x90ff('0x18')](_0x90ff('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x90ff('0x1a')]()[_0x90ff('0x1b')](user[_0x90ff('0x1c')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x1d')]())[_0x90ff('0x1b')](user[_0x90ff('0x1e')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x1f')]())[_0x90ff('0x1b')](trunk['getTrunks']())[_0x90ff('0x1b')](realtime[_0x90ff('0x20')]())['then'](voiceQueue[_0x90ff('0x21')]())[_0x90ff('0x1b')](realtime['initVoiceQueues']())['then'](trigger[_0x90ff('0x22')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x23')]())[_0x90ff('0x1b')](template[_0x90ff('0x24')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x25')]())[_0x90ff('0x1b')](zendesk[_0x90ff('0x26')]())[_0x90ff('0x1b')](realtime['initZendeskAccounts']())[_0x90ff('0x1b')](salesforce[_0x90ff('0x27')]())['then'](realtime[_0x90ff('0x28')]())[_0x90ff('0x1b')](sugarcrm[_0x90ff('0x29')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x2a')]())[_0x90ff('0x1b')](freshdesk[_0x90ff('0x2b')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x2c')]())['then'](desk[_0x90ff('0x2d')]())['then'](realtime[_0x90ff('0x2e')]())['then'](zoho[_0x90ff('0x2f')]())['then'](realtime[_0x90ff('0x30')]())[_0x90ff('0x1b')](vtiger['getVtigerAccounts']())[_0x90ff('0x1b')](realtime[_0x90ff('0x31')]())[_0x90ff('0x1b')](freshsales[_0x90ff('0x32')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x33')]())[_0x90ff('0x1b')](servicenow[_0x90ff('0x34')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x35')]())[_0x90ff('0x1b')](dynamics365[_0x90ff('0x36')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x37')]())[_0x90ff('0x1b')](campaign[_0x90ff('0x38')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x39')]())['then'](voiceExtension[_0x90ff('0x3a')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x3b')]())['then'](faxAccount[_0x90ff('0x3c')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x3d')]())[_0x90ff('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x90ff('0x1a')]()['then'](voiceQueueReport[_0x90ff('0x3e')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x3f')]())[_0x90ff('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x90ff('0x1b')](realtime[_0x90ff('0x40')]())['then'](cmHopperHistory[_0x90ff('0x41')]())[_0x90ff('0x1b')](realtime[_0x90ff('0x42')]())[_0x90ff('0x1b')](voiceCallReport[_0x90ff('0x43')]())['then'](realtime['initVoiceCallReports']())['catch'](function(_0x52c679){logger[_0x90ff('0x44')](_0x90ff('0x45'),util[_0x90ff('0x46')](_0x52c679,{'showHidden':![],'depth':null}));});}function main(){return server[_0x90ff('0x47')](realtime,preview,fax)[_0x90ff('0x1b')](function(){return initRealtime();})[_0x90ff('0x1b')](function(){return initParams();})[_0x90ff('0x1b')](function(){report[_0x90ff('0x48')]();setInterval(initRealtime,0x1388);})[_0x90ff('0x49')](function(_0x3e4272){logger[_0x90ff('0x44')](_0x90ff('0x4a'),util[_0x90ff('0x46')](_0x3e4272,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x69a2=['../../config/logger','ami','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365'];(function(_0x111acb,_0x54e4ff){var _0xdd1e7b=function(_0x6ad66a){while(--_0x6ad66a){_0x111acb['push'](_0x111acb['shift']());}};_0xdd1e7b(++_0x54e4ff);}(_0x69a2,0x7f));var _0x269a=function(_0x4a5c11,_0x204ec0){_0x4a5c11=_0x4a5c11-0x0;var _0x230f14=_0x69a2[_0x4a5c11];return _0x230f14;};'use strict';var util=require(_0x269a('0x0'));var moment=require(_0x269a('0x1'));var server=require(_0x269a('0x2'));var Realtime=require(_0x269a('0x3'));var Report=require(_0x269a('0x4'));var Acw=require(_0x269a('0x5'));var Trigger=require(_0x269a('0x6'));var Dialer=require(_0x269a('0x7'));var Preview=require(_0x269a('0x8'));var Fax=require('./fax');var user=require(_0x269a('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x269a('0xa'));var voiceCallReport=require(_0x269a('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x269a('0xc'));var template=require(_0x269a('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x269a('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x269a('0xf'));var zendesk=require(_0x269a('0x10'));var salesforce=require(_0x269a('0x11'));var sugarcrm=require(_0x269a('0x12'));var freshdesk=require(_0x269a('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x269a('0x14'));var vtiger=require(_0x269a('0x15'));var freshsales=require(_0x269a('0x16'));var servicenow=require(_0x269a('0x17'));var dynamics365=require(_0x269a('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x269a('0x19'))(_0x269a('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x269a('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x269a('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x269a('0x1c')]()[_0x269a('0x1d')](user['getAgents']())[_0x269a('0x1d')](realtime[_0x269a('0x1e')]())[_0x269a('0x1d')](user[_0x269a('0x1f')]())[_0x269a('0x1d')](realtime[_0x269a('0x20')]())[_0x269a('0x1d')](trunk[_0x269a('0x21')]())[_0x269a('0x1d')](realtime[_0x269a('0x22')]())['then'](voiceQueue[_0x269a('0x23')]())[_0x269a('0x1d')](realtime[_0x269a('0x24')]())['then'](trigger['getTriggers']())[_0x269a('0x1d')](realtime[_0x269a('0x25')]())[_0x269a('0x1d')](template[_0x269a('0x26')]())[_0x269a('0x1d')](realtime[_0x269a('0x27')]())['then'](zendesk[_0x269a('0x28')]())[_0x269a('0x1d')](realtime[_0x269a('0x29')]())[_0x269a('0x1d')](salesforce[_0x269a('0x2a')]())['then'](realtime[_0x269a('0x2b')]())[_0x269a('0x1d')](sugarcrm[_0x269a('0x2c')]())['then'](realtime['initSugarcrmAccounts']())[_0x269a('0x1d')](freshdesk[_0x269a('0x2d')]())[_0x269a('0x1d')](realtime['initFreshdeskAccounts']())[_0x269a('0x1d')](desk[_0x269a('0x2e')]())[_0x269a('0x1d')](realtime[_0x269a('0x2f')]())[_0x269a('0x1d')](zoho[_0x269a('0x30')]())['then'](realtime[_0x269a('0x31')]())[_0x269a('0x1d')](vtiger[_0x269a('0x32')]())[_0x269a('0x1d')](realtime[_0x269a('0x33')]())[_0x269a('0x1d')](freshsales[_0x269a('0x34')]())[_0x269a('0x1d')](realtime[_0x269a('0x35')]())[_0x269a('0x1d')](servicenow[_0x269a('0x36')]())[_0x269a('0x1d')](realtime[_0x269a('0x37')]())[_0x269a('0x1d')](dynamics365[_0x269a('0x38')]())[_0x269a('0x1d')](realtime[_0x269a('0x39')]())[_0x269a('0x1d')](campaign['getCampaigns']())['then'](realtime[_0x269a('0x3a')]())['then'](voiceExtension['getVoiceExtensions']())[_0x269a('0x1d')](realtime[_0x269a('0x3b')]())[_0x269a('0x1d')](faxAccount[_0x269a('0x3c')]())[_0x269a('0x1d')](realtime[_0x269a('0x3d')]())[_0x269a('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x269a('0x1c')]()[_0x269a('0x1d')](voiceQueueReport[_0x269a('0x3e')]())[_0x269a('0x1d')](realtime[_0x269a('0x3f')]())[_0x269a('0x1d')](cmHopperHistory[_0x269a('0x40')]())[_0x269a('0x1d')](realtime[_0x269a('0x41')]())[_0x269a('0x1d')](cmHopperHistory[_0x269a('0x42')]())[_0x269a('0x1d')](realtime['initCampaignHopperHistory']())[_0x269a('0x1d')](voiceCallReport[_0x269a('0x43')]())[_0x269a('0x1d')](realtime[_0x269a('0x44')]())[_0x269a('0x45')](function(_0x562377){logger[_0x269a('0x46')](_0x269a('0x47'),util['inspect'](_0x562377,{'showHidden':![],'depth':null}));});}function main(){return server[_0x269a('0x48')](realtime,preview,fax)[_0x269a('0x1d')](function(){return initRealtime();})[_0x269a('0x1d')](function(){return initParams();})[_0x269a('0x1d')](function(){report[_0x269a('0x49')]();setInterval(initRealtime,0x1388);})[_0x269a('0x45')](function(_0x2ad274){logger[_0x269a('0x46')](_0x269a('0x4a'),util[_0x269a('0x4b')](_0x2ad274,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 87a5807..befc1fb 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e35=['redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','idle','inuse','voiceStatus','statePause','voiceStatusTime','toNumber','format','status','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','../../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8e35,0x67));var _0x58e3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8e35[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x58e3('0x0'));var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x58e3('0x1'));config[_0x58e3('0x2')]=_['defaults'](config[_0x58e3('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x58e3('0x3'))(new Redis(config[_0x58e3('0x2')]));function Agent(_0x329a4c){this['id']=_0x329a4c['id']||0x0;this[_0x58e3('0x4')]=_0x329a4c[_0x58e3('0x4')]||'';this[_0x58e3('0x5')]=_0x329a4c[_0x58e3('0x5')]||'';this[_0x58e3('0x6')]=_0x329a4c[_0x58e3('0x6')]||'';this[_0x58e3('0x7')]=_0x329a4c['fullname']||'';this[_0x58e3('0x8')]=_0x58e3('0x9');this[_0x58e3('0xa')]=0x0;this['status']=_0x58e3('0x9');this[_0x58e3('0xb')]='';this[_0x58e3('0xc')]='';this['mobile']='';this[_0x58e3('0xd')]='';this[_0x58e3('0xe')]=_0x329a4c[_0x58e3('0xe')]||![];this['voiceStatus']=_0x58e3('0x9');this['voiceStatusTime']=0x0;this[_0x58e3('0xf')]='';this[_0x58e3('0x10')]='';this[_0x58e3('0x11')]=![];this[_0x58e3('0x12')]=![];this[_0x58e3('0x13')]='';}Agent[_0x58e3('0x14')]['updateStatusRealtime']=function(_0x52b416){var _0x5d6434;if(_0x52b416&&_0x52b416[_0x58e3('0x8')]){_0x5d6434=_0x52b416[_0x58e3('0x8')]['toLowerCase']();switch(_0x5d6434){case'not_inuse':_0x5d6434=_0x58e3('0x15');break;case _0x58e3('0x16'):_0x5d6434='talking';break;}}if(_0x5d6434&&this[_0x58e3('0x17')]!==_0x5d6434||_0x52b416[_0x58e3('0x18')]){this[_0x58e3('0x19')]=_[_0x58e3('0x1a')](moment()[_0x58e3('0x1b')]('x'));}if(_0x5d6434){this['voiceStatus']=_0x5d6434;}var _0xb19f29={'id':this['id'],'name':this[_0x58e3('0x4')],'email':this[_0x58e3('0x5')],'accountcode':this[_0x58e3('0x6')],'fullname':this[_0x58e3('0x7')],'state':this['state'],'stateTime':this[_0x58e3('0xa')],'status':this[_0x58e3('0x1c')],'address':this['address'],'online':this[_0x58e3('0xe')],'voiceStatus':this[_0x58e3('0x17')],'voiceStatusTime':this[_0x58e3('0x19')],'voiceStatusCallerIdNumber':this[_0x58e3('0xf')],'voiceStatusQueue':this[_0x58e3('0x10')],'interface':this['interface'],'onhold':this[_0x58e3('0x11')]};var _0x3b42ab=md5(JSON['stringify'](_0xb19f29));if(this[_0x58e3('0x13')]!==_0x3b42ab){this[_0x58e3('0x13')]=_0x3b42ab;io['to'](util[_0x58e3('0x1b')](_0x58e3('0x1d'),_0xb19f29[_0x58e3('0x4')]))[_0x58e3('0x1e')](_0x58e3('0x1f'),_[_0x58e3('0x20')](_0xb19f29,[_0x58e3('0xe')]));io[_0x58e3('0x1e')](_0x58e3('0x21'),_0xb19f29);}};module[_0x58e3('0x22')]=Agent; \ No newline at end of file +var _0xd176=['stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','toLowerCase','not_inuse','talking','toNumber','format','onhold','stringify','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown'];(function(_0x414220,_0x2eef8c){var _0xece164=function(_0x1000e2){while(--_0x1000e2){_0x414220['push'](_0x414220['shift']());}};_0xece164(++_0x2eef8c);}(_0xd176,0xab));var _0x6d17=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0xd176[_0x586fa2];return _0x515be9;};'use strict';var _=require(_0x6d17('0x0'));var util=require(_0x6d17('0x1'));var moment=require(_0x6d17('0x2'));var md5=require(_0x6d17('0x3'));var Redis=require('ioredis');var config=require(_0x6d17('0x4'));config[_0x6d17('0x5')]=_['defaults'](config['redis'],{'host':_0x6d17('0x6'),'port':0x18eb});var io=require(_0x6d17('0x7'))(new Redis(config[_0x6d17('0x5')]));function Agent(_0x4e5ba3){this['id']=_0x4e5ba3['id']||0x0;this[_0x6d17('0x8')]=_0x4e5ba3[_0x6d17('0x8')]||'';this[_0x6d17('0x9')]=_0x4e5ba3[_0x6d17('0x9')]||'';this[_0x6d17('0xa')]=_0x4e5ba3[_0x6d17('0xa')]||'';this[_0x6d17('0xb')]=_0x4e5ba3[_0x6d17('0xb')]||'';this[_0x6d17('0xc')]=_0x6d17('0xd');this[_0x6d17('0xe')]=0x0;this[_0x6d17('0xf')]='unknown';this[_0x6d17('0x10')]='';this['phone']='';this[_0x6d17('0x11')]='';this[_0x6d17('0x12')]='';this[_0x6d17('0x13')]=_0x4e5ba3[_0x6d17('0x13')]||![];this[_0x6d17('0x14')]='unknown';this[_0x6d17('0x15')]=0x0;this[_0x6d17('0x16')]='';this[_0x6d17('0x17')]='';this['onhold']=![];this['local']=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x348018){var _0x15932d;if(_0x348018&&_0x348018[_0x6d17('0xc')]){_0x15932d=_0x348018['state'][_0x6d17('0x18')]();switch(_0x15932d){case _0x6d17('0x19'):_0x15932d='idle';break;case'inuse':_0x15932d=_0x6d17('0x1a');break;}}if(_0x15932d&&this[_0x6d17('0x14')]!==_0x15932d||_0x348018['statePause']){this[_0x6d17('0x15')]=_[_0x6d17('0x1b')](moment()[_0x6d17('0x1c')]('x'));}if(_0x15932d){this['voiceStatus']=_0x15932d;}var _0x12ba3d={'id':this['id'],'name':this[_0x6d17('0x8')],'email':this[_0x6d17('0x9')],'accountcode':this[_0x6d17('0xa')],'fullname':this[_0x6d17('0xb')],'state':this[_0x6d17('0xc')],'stateTime':this[_0x6d17('0xe')],'status':this[_0x6d17('0xf')],'address':this['address'],'online':this[_0x6d17('0x13')],'voiceStatus':this[_0x6d17('0x14')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x6d17('0x16')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x6d17('0x12')],'onhold':this[_0x6d17('0x1d')]};var _0x3c7a96=md5(JSON[_0x6d17('0x1e')](_0x12ba3d));if(this['md5']!==_0x3c7a96){this[_0x6d17('0x3')]=_0x3c7a96;io['to'](util['format'](_0x6d17('0x1f'),_0x12ba3d[_0x6d17('0x8')]))[_0x6d17('0x20')](_0x6d17('0x21'),_[_0x6d17('0x22')](_0x12ba3d,[_0x6d17('0x13')]));io[_0x6d17('0x20')](_0x6d17('0x23'),_0x12ba3d);}};module[_0x6d17('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index db3ceb4..d7b61d5 100644 --- a/server/services/ami/model/campaign.js +++ b/server/services/ami/model/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54a9=['dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x278424,_0x2e49bb){var _0x5247e4=function(_0x160ca0){while(--_0x160ca0){_0x278424['push'](_0x278424['shift']());}};_0x5247e4(++_0x2e49bb);}(_0x54a9,0x1a5));var _0x954a=function(_0x462385,_0x1bb12f){_0x462385=_0x462385-0x0;var _0x589185=_0x54a9[_0x462385];return _0x589185;};'use strict';function Campaign(_0x4e0144){this['id']=_0x4e0144['id']||0x0;this[_0x954a('0x0')]=_0x4e0144[_0x954a('0x0')]||'';this[_0x954a('0x1')]=_0x4e0144['type']||_0x954a('0x2');this[_0x954a('0x3')]=0x0;this[_0x954a('0x4')]=0x0;this[_0x954a('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x954a('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x954a('0x7')]=_0x4e0144[_0x954a('0x7')];this[_0x954a('0x8')]=_0x4e0144[_0x954a('0x8')];this[_0x954a('0x9')]=_0x4e0144[_0x954a('0x9')]||null;this['dialGlobalInterval']=_0x4e0144['dialGlobalInterval']?_0x4e0144[_0x954a('0xa')]:null;this[_0x954a('0xb')]=_0x4e0144[_0x954a('0xb')];this[_0x954a('0xc')]=_0x4e0144[_0x954a('0xc')];this['dialOriginateTimeout']=_0x4e0144[_0x954a('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x4e0144['dialCongestionMaxRetry'];this[_0x954a('0xe')]=_0x4e0144[_0x954a('0xe')];this['dialBusyMaxRetry']=_0x4e0144[_0x954a('0xf')];this[_0x954a('0x10')]=_0x4e0144[_0x954a('0x10')];this[_0x954a('0x11')]=_0x4e0144[_0x954a('0x11')];this[_0x954a('0x12')]=_0x4e0144[_0x954a('0x12')];this[_0x954a('0x13')]=_0x4e0144[_0x954a('0x13')];this['dialNoSuchNumberMaxRetry']=_0x4e0144[_0x954a('0x14')]||0x3;this[_0x954a('0x15')]=_0x4e0144['dialNoSuchNumberRetryFrequency']||0x96;this[_0x954a('0x16')]=_0x4e0144[_0x954a('0x16')]||0x3;this['dialDropRetryFrequency']=_0x4e0144[_0x954a('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x4e0144['dialAbandonedMaxRetry']||0x3;this[_0x954a('0x18')]=_0x4e0144['dialAbandonedRetryFrequency']||0x96;this[_0x954a('0x19')]=_0x4e0144[_0x954a('0x19')]||0x3;this[_0x954a('0x1a')]=_0x4e0144['dialMachineRetryFrequency']||0x96;this[_0x954a('0x1b')]=_0x4e0144[_0x954a('0x1b')]||0x3;this[_0x954a('0x1c')]=_0x4e0144[_0x954a('0x1c')]||0x96;this[_0x954a('0x1d')]=_0x4e0144['dialOrderByScheduledAt']||_0x954a('0x1e');this[_0x954a('0x1f')]=_0x4e0144[_0x954a('0x1f')]||undefined;this[_0x954a('0x20')]=_0x4e0144[_0x954a('0x20')]||undefined;this[_0x954a('0x21')]=_0x4e0144[_0x954a('0x21')]||undefined;this[_0x954a('0x22')]=_0x4e0144[_0x954a('0x22')]?_0x4e0144[_0x954a('0x22')]:undefined;this[_0x954a('0x23')]=_0x4e0144['Trunk']?_0x4e0144[_0x954a('0x23')]:undefined;this['Interval']=_0x4e0144['Interval']?_0x4e0144[_0x954a('0x24')]:undefined;this[_0x954a('0x25')]=_0x4e0144[_0x954a('0x25')]?_0x4e0144[_0x954a('0x25')]:undefined;this[_0x954a('0x26')]=_0x4e0144['SquareProject']?_0x4e0144[_0x954a('0x25')]['name']:undefined;this[_0x954a('0x27')]=_0x4e0144[_0x954a('0x27')]||![];this[_0x954a('0x28')]=_0x4e0144[_0x954a('0x28')];this[_0x954a('0x29')]=_0x4e0144[_0x954a('0x29')];this['dialAMDAfterGreetingSilence']=_0x4e0144[_0x954a('0x2a')];this[_0x954a('0x2b')]=_0x4e0144[_0x954a('0x2b')];this[_0x954a('0x2c')]=_0x4e0144[_0x954a('0x2c')];this[_0x954a('0x2d')]=_0x4e0144[_0x954a('0x2d')];this[_0x954a('0x2e')]=_0x4e0144[_0x954a('0x2e')];this['dialAMDSilenceThreshold']=_0x4e0144[_0x954a('0x2f')];this[_0x954a('0x30')]=_0x4e0144[_0x954a('0x30')];}module[_0x954a('0x31')]=Campaign; \ No newline at end of file +var _0x91df=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x3830bd,_0x1b3c1f){var _0x252aff=function(_0x3856b8){while(--_0x3856b8){_0x3830bd['push'](_0x3830bd['shift']());}};_0x252aff(++_0x1b3c1f);}(_0x91df,0x115));var _0xf91d=function(_0x24c5f3,_0x3fb6d1){_0x24c5f3=_0x24c5f3-0x0;var _0x5535f6=_0x91df[_0x24c5f3];return _0x5535f6;};'use strict';function Campaign(_0x1edbe3){this['id']=_0x1edbe3['id']||0x0;this['name']=_0x1edbe3['name']||'';this['type']=_0x1edbe3[_0xf91d('0x0')]||'campaign';this['originated']=0x0;this[_0xf91d('0x1')]=0x0;this[_0xf91d('0x2')]=0x0;this[_0xf91d('0x3')]=0x0;this[_0xf91d('0x4')]='';this[_0xf91d('0x5')]=!![];this[_0xf91d('0x6')]=_0x1edbe3[_0xf91d('0x6')];this[_0xf91d('0x7')]=_0x1edbe3['limitCalls'];this['dialTimezone']=_0x1edbe3['dialTimezone']||null;this[_0xf91d('0x8')]=_0x1edbe3['dialGlobalInterval']?_0x1edbe3[_0xf91d('0x8')]:null;this['dialOriginateCallerIdName']=_0x1edbe3[_0xf91d('0x9')];this[_0xf91d('0xa')]=_0x1edbe3['dialOriginateCallerIdNumber'];this[_0xf91d('0xb')]=_0x1edbe3['dialOriginateTimeout']||0x1e;this[_0xf91d('0xc')]=_0x1edbe3[_0xf91d('0xc')];this[_0xf91d('0xd')]=_0x1edbe3[_0xf91d('0xd')];this[_0xf91d('0xe')]=_0x1edbe3[_0xf91d('0xe')];this['dialBusyRetryFrequency']=_0x1edbe3[_0xf91d('0xf')];this[_0xf91d('0x10')]=_0x1edbe3[_0xf91d('0x10')];this[_0xf91d('0x11')]=_0x1edbe3[_0xf91d('0x11')];this['dialGlobalMaxRetry']=_0x1edbe3[_0xf91d('0x12')];this[_0xf91d('0x13')]=_0x1edbe3['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1edbe3[_0xf91d('0x14')]||0x96;this[_0xf91d('0x15')]=_0x1edbe3['dialDropMaxRetry']||0x3;this[_0xf91d('0x16')]=_0x1edbe3[_0xf91d('0x16')]||0x96;this[_0xf91d('0x17')]=_0x1edbe3['dialAbandonedMaxRetry']||0x3;this[_0xf91d('0x18')]=_0x1edbe3[_0xf91d('0x18')]||0x96;this[_0xf91d('0x19')]=_0x1edbe3['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x1edbe3[_0xf91d('0x1a')]||0x96;this[_0xf91d('0x1b')]=_0x1edbe3[_0xf91d('0x1b')]||0x3;this[_0xf91d('0x1c')]=_0x1edbe3[_0xf91d('0x1c')]||0x96;this[_0xf91d('0x1d')]=_0x1edbe3[_0xf91d('0x1d')]||'DESC';this['dialPrefix']=_0x1edbe3[_0xf91d('0x1e')]||undefined;this[_0xf91d('0x1f')]=_0x1edbe3['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf91d('0x20')]=_0x1edbe3[_0xf91d('0x20')]||undefined;this[_0xf91d('0x21')]=_0x1edbe3[_0xf91d('0x21')]?_0x1edbe3[_0xf91d('0x21')]:undefined;this[_0xf91d('0x22')]=_0x1edbe3[_0xf91d('0x22')]?_0x1edbe3[_0xf91d('0x22')]:undefined;this[_0xf91d('0x23')]=_0x1edbe3[_0xf91d('0x23')]?_0x1edbe3[_0xf91d('0x23')]:undefined;this['SquareProject']=_0x1edbe3['SquareProject']?_0x1edbe3[_0xf91d('0x24')]:undefined;this['dialQueueProject']=_0x1edbe3[_0xf91d('0x24')]?_0x1edbe3['SquareProject'][_0xf91d('0x25')]:undefined;this[_0xf91d('0x26')]=_0x1edbe3[_0xf91d('0x26')]||![];this[_0xf91d('0x27')]=_0x1edbe3[_0xf91d('0x27')];this[_0xf91d('0x28')]=_0x1edbe3[_0xf91d('0x28')];this[_0xf91d('0x29')]=_0x1edbe3[_0xf91d('0x29')];this[_0xf91d('0x2a')]=_0x1edbe3[_0xf91d('0x2a')];this[_0xf91d('0x2b')]=_0x1edbe3[_0xf91d('0x2b')];this[_0xf91d('0x2c')]=_0x1edbe3[_0xf91d('0x2c')];this[_0xf91d('0x2d')]=_0x1edbe3['dialAMDMaximumNumberOfWords'];this[_0xf91d('0x2e')]=_0x1edbe3[_0xf91d('0x2e')];this[_0xf91d('0x2f')]=_0x1edbe3['dialAMDMaximumWordLength'];}module[_0xf91d('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index cf4c7a8..16181e7 100644 --- a/server/services/ami/model/channel.js +++ b/server/services/ami/model/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c19=['lastdata','duration','billableseconds','type','tag','monitor','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication'];(function(_0x55371f,_0x3e9342){var _0x2278d3=function(_0x2f4945){while(--_0x2f4945){_0x55371f['push'](_0x55371f['shift']());}};_0x2278d3(++_0x3e9342);}(_0x0c19,0xf5));var _0x90c1=function(_0x3dd005,_0x5e77f7){_0x3dd005=_0x3dd005-0x0;var _0x2642fb=_0x0c19[_0x3dd005];return _0x2642fb;};'use strict';function Channel(){this[_0x90c1('0x0')]=null;this[_0x90c1('0x1')]='';this[_0x90c1('0x2')]='';this[_0x90c1('0x3')]=0x0;this[_0x90c1('0x4')]='';this[_0x90c1('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x90c1('0x6')]=0x0;this[_0x90c1('0x7')]='';this[_0x90c1('0x8')]=0x0;this['linkedid']=0x0;this[_0x90c1('0x9')]=0x0;this[_0x90c1('0xa')]=![];this['answertime']=null;this[_0x90c1('0xb')]=null;this[_0x90c1('0xc')]=![];this[_0x90c1('0xd')]=![];this[_0x90c1('0xe')]='';this[_0x90c1('0xf')]='';this[_0x90c1('0x10')]=0x0;this[_0x90c1('0x11')]=0x0;this['holdtime']=0x0;this[_0x90c1('0x12')]=null;this[_0x90c1('0x13')]=null;this['disposition']=null;this[_0x90c1('0x14')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x90c1('0x15')]=[];this['transfercalleridnum']=undefined;this[_0x90c1('0x16')]=undefined;this[_0x90c1('0x17')]=undefined;this[_0x90c1('0x18')]=0x0;}module[_0x90c1('0x19')]=Channel; \ No newline at end of file +var _0xb477=['lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned'];(function(_0x3418e8,_0xa115a1){var _0x15cf4e=function(_0x41cb28){while(--_0x41cb28){_0x3418e8['push'](_0x3418e8['shift']());}};_0x15cf4e(++_0xa115a1);}(_0xb477,0x8f));var _0x7b47=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb477[_0x2641f9];return _0x585741;};'use strict';function Channel(){this['starttime']=null;this[_0x7b47('0x0')]='';this[_0x7b47('0x1')]='';this[_0x7b47('0x2')]=0x0;this['calleridname']='';this[_0x7b47('0x3')]=undefined;this[_0x7b47('0x4')]=undefined;this[_0x7b47('0x5')]=0x0;this['context']='';this[_0x7b47('0x6')]=0x0;this[_0x7b47('0x7')]=0x0;this[_0x7b47('0x8')]=0x0;this[_0x7b47('0x9')]=![];this[_0x7b47('0xa')]=null;this['endtime']=null;this[_0x7b47('0xb')]=![];this[_0x7b47('0xc')]=![];this['lastapplication']='';this[_0x7b47('0xd')]='';this[_0x7b47('0xe')]=0x0;this[_0x7b47('0xf')]=0x0;this[_0x7b47('0x10')]=0x0;this[_0x7b47('0x11')]=null;this[_0x7b47('0x12')]=null;this[_0x7b47('0x13')]=null;this[_0x7b47('0x14')]=![];this[_0x7b47('0x15')]=null;this[_0x7b47('0x16')]=null;this[_0x7b47('0x17')]=[];this[_0x7b47('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x7b47('0x19')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 67c8ef0..28594c7 100644 --- a/server/services/ami/model/deskAccount.js +++ b/server/services/ami/model/deskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1bb=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0xd1bb,0x1ae));var _0xbd1b=function(_0xdab5bc,_0x551aed){_0xdab5bc=_0xdab5bc-0x0;var _0x4ce069=_0xd1bb[_0xdab5bc];return _0x4ce069;};'use strict';function DeskAccount(_0x485fb3){this['id']=_0x485fb3['id']||0x0;this[_0xbd1b('0x0')]=_0x485fb3[_0xbd1b('0x0')]||'';this[_0xbd1b('0x1')]=_0x485fb3[_0xbd1b('0x1')]||'';this[_0xbd1b('0x2')]=_0x485fb3[_0xbd1b('0x2')]||'';this[_0xbd1b('0x3')]=_0x485fb3[_0xbd1b('0x3')]||'';this[_0xbd1b('0x4')]=_0x485fb3[_0xbd1b('0x4')]||'';this['consumerKey']=_0x485fb3[_0xbd1b('0x5')]||'';this[_0xbd1b('0x6')]=_0x485fb3[_0xbd1b('0x6')]||'';this[_0xbd1b('0x7')]=_0x485fb3['token']||'';this['tokenSecret']=_0x485fb3[_0xbd1b('0x8')]||'';this['type']=_0x485fb3['type']||'';this[_0xbd1b('0x9')]=_0x485fb3[_0xbd1b('0x9')]||'';this[_0xbd1b('0xa')]=_0x485fb3[_0xbd1b('0xa')]||{};}module[_0xbd1b('0xb')]=DeskAccount; \ No newline at end of file +var _0x56ec=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x5d86f5,_0x39b63f){var _0x35462e=function(_0x347559){while(--_0x347559){_0x5d86f5['push'](_0x5d86f5['shift']());}};_0x35462e(++_0x39b63f);}(_0x56ec,0x1f2));var _0xc56e=function(_0x4fc1a4,_0x259690){_0x4fc1a4=_0x4fc1a4-0x0;var _0x9bc381=_0x56ec[_0x4fc1a4];return _0x9bc381;};'use strict';function DeskAccount(_0x2c8c27){this['id']=_0x2c8c27['id']||0x0;this[_0xc56e('0x0')]=_0x2c8c27['name']||'';this[_0xc56e('0x1')]=_0x2c8c27[_0xc56e('0x1')]||'';this[_0xc56e('0x2')]=_0x2c8c27[_0xc56e('0x2')]||'';this[_0xc56e('0x3')]=_0x2c8c27[_0xc56e('0x3')]||'';this[_0xc56e('0x4')]=_0x2c8c27[_0xc56e('0x4')]||'';this[_0xc56e('0x5')]=_0x2c8c27[_0xc56e('0x5')]||'';this[_0xc56e('0x6')]=_0x2c8c27[_0xc56e('0x6')]||'';this[_0xc56e('0x7')]=_0x2c8c27[_0xc56e('0x7')]||'';this['tokenSecret']=_0x2c8c27[_0xc56e('0x8')]||'';this[_0xc56e('0x9')]=_0x2c8c27[_0xc56e('0x9')]||'';this[_0xc56e('0xa')]=_0x2c8c27[_0xc56e('0xa')]||'';this['Configurations']=_0x2c8c27[_0xc56e('0xb')]||{};}module[_0xc56e('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 152f1f0..1d039e6 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c4e=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','password','remoteUri','tenantId'];(function(_0xa8b370,_0x2b77db){var _0x643e37=function(_0x1486eb){while(--_0x1486eb){_0xa8b370['push'](_0xa8b370['shift']());}};_0x643e37(++_0x2b77db);}(_0x3c4e,0x128));var _0xe3c4=function(_0xa0ed9f,_0x4f90f7){_0xa0ed9f=_0xa0ed9f-0x0;var _0x50c7b2=_0x3c4e[_0xa0ed9f];return _0x50c7b2;};'use strict';function Dynamics365Account(_0x2ec53b){this['id']=_0x2ec53b['id']||0x0;this[_0xe3c4('0x0')]=_0x2ec53b[_0xe3c4('0x0')]||'';this['username']=_0x2ec53b['username']||'';this[_0xe3c4('0x1')]=_0x2ec53b['password']||'';this[_0xe3c4('0x2')]=_0x2ec53b[_0xe3c4('0x2')]||'';this[_0xe3c4('0x3')]=_0x2ec53b[_0xe3c4('0x3')]||'';this[_0xe3c4('0x4')]=_0x2ec53b[_0xe3c4('0x4')]||'';this[_0xe3c4('0x5')]=_0x2ec53b['clientSecret']||{};this[_0xe3c4('0x6')]=_0x2ec53b[_0xe3c4('0x6')]||'';this[_0xe3c4('0x7')]=_0x2ec53b['modernAuthentication']||![];this[_0xe3c4('0x8')]=_0x2ec53b[_0xe3c4('0x8')]||{};this['CloudProvider']=_0x2ec53b[_0xe3c4('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x741d=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x4289a8,_0x2f4f7e){var _0x8cfc1=function(_0xa5d131){while(--_0xa5d131){_0x4289a8['push'](_0x4289a8['shift']());}};_0x8cfc1(++_0x2f4f7e);}(_0x741d,0x1e5));var _0xd741=function(_0x22703d,_0x3c43be){_0x22703d=_0x22703d-0x0;var _0x1de81b=_0x741d[_0x22703d];return _0x1de81b;};'use strict';function Dynamics365Account(_0x274230){this['id']=_0x274230['id']||0x0;this[_0xd741('0x0')]=_0x274230[_0xd741('0x0')]||'';this[_0xd741('0x1')]=_0x274230[_0xd741('0x1')]||'';this[_0xd741('0x2')]=_0x274230[_0xd741('0x2')]||'';this[_0xd741('0x3')]=_0x274230[_0xd741('0x3')]||'';this[_0xd741('0x4')]=_0x274230['tenantId']||'';this[_0xd741('0x5')]=_0x274230[_0xd741('0x5')]||'';this[_0xd741('0x6')]=_0x274230[_0xd741('0x6')]||{};this[_0xd741('0x7')]=_0x274230[_0xd741('0x7')]||'';this[_0xd741('0x8')]=_0x274230[_0xd741('0x8')]||![];this['Configurations']=_0x274230[_0xd741('0x9')]||{};this[_0xd741('0xa')]=_0x274230[_0xd741('0xa')]||{};}module[_0xd741('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ec590f0..bbc4a2b 100644 --- a/server/services/ami/model/faxAccount.js +++ b/server/services/ami/model/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10d1=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x10d1,0xb4));var _0x110d=function(_0x32759d,_0x42fae9){_0x32759d=_0x32759d-0x0;var _0xf1b695=_0x10d1[_0x32759d];return _0xf1b695;};'use strict';function FaxAccount(_0x4cd52a){this['id']=_0x4cd52a['id']||0x0;this['name']=_0x4cd52a[_0x110d('0x0')]||'';this[_0x110d('0x1')]=_0x4cd52a['description'];this[_0x110d('0x2')]=_0x4cd52a[_0x110d('0x2')];this[_0x110d('0x3')]=_0x4cd52a['headerinfo'];this[_0x110d('0x4')]=_0x4cd52a[_0x110d('0x4')];this[_0x110d('0x5')]=_0x4cd52a[_0x110d('0x5')]||0x960;this[_0x110d('0x6')]=_0x4cd52a['maxrate']||0x3840;this['modem']=_0x4cd52a['modem']||'v17,v27,v29';this[_0x110d('0x7')]=_0x4cd52a[_0x110d('0x7')]||'no';this['faxdetect']=_0x4cd52a[_0x110d('0x8')]||'no';this[_0x110d('0x9')]=_0x4cd52a['t38timeout']||0x1388;this[_0x110d('0xa')]=_0x4cd52a['tech']||_0x110d('0xb');this[_0x110d('0xc')]=_0x4cd52a['Trunk']?_0x4cd52a[_0x110d('0xc')]:undefined;this[_0x110d('0xd')]=_0x4cd52a[_0x110d('0xd')];this[_0x110d('0xe')]=_0x4cd52a['key'];}module[_0x110d('0xf')]=FaxAccount; \ No newline at end of file +var _0x8bfe=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x7a2540,_0x1454aa){var _0x3e6f43=function(_0x566237){while(--_0x566237){_0x7a2540['push'](_0x7a2540['shift']());}};_0x3e6f43(++_0x1454aa);}(_0x8bfe,0x197));var _0xe8bf=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x8bfe[_0x5ba549];return _0x36e3a1;};'use strict';function FaxAccount(_0x15d4f1){this['id']=_0x15d4f1['id']||0x0;this[_0xe8bf('0x0')]=_0x15d4f1[_0xe8bf('0x0')]||'';this[_0xe8bf('0x1')]=_0x15d4f1[_0xe8bf('0x1')];this[_0xe8bf('0x2')]=_0x15d4f1[_0xe8bf('0x2')];this[_0xe8bf('0x3')]=_0x15d4f1[_0xe8bf('0x3')];this[_0xe8bf('0x4')]=_0x15d4f1[_0xe8bf('0x4')];this[_0xe8bf('0x5')]=_0x15d4f1[_0xe8bf('0x5')]||0x960;this[_0xe8bf('0x6')]=_0x15d4f1[_0xe8bf('0x6')]||0x3840;this[_0xe8bf('0x7')]=_0x15d4f1[_0xe8bf('0x7')]||_0xe8bf('0x8');this['gateway']=_0x15d4f1[_0xe8bf('0x9')]||'no';this[_0xe8bf('0xa')]=_0x15d4f1[_0xe8bf('0xa')]||'no';this['t38timeout']=_0x15d4f1[_0xe8bf('0xb')]||0x1388;this[_0xe8bf('0xc')]=_0x15d4f1[_0xe8bf('0xc')]||_0xe8bf('0xd');this['Trunk']=_0x15d4f1['Trunk']?_0x15d4f1[_0xe8bf('0xe')]:undefined;this[_0xe8bf('0xf')]=_0x15d4f1[_0xe8bf('0xf')];this[_0xe8bf('0x10')]=_0x15d4f1[_0xe8bf('0x10')];}module[_0xe8bf('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 86441bb..5ca5918 100644 --- a/server/services/ami/model/freshdeskAccount.js +++ b/server/services/ami/model/freshdeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x428d=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x5cbe8a,_0x41c132){var _0x4b07a1=function(_0x112ff9){while(--_0x112ff9){_0x5cbe8a['push'](_0x5cbe8a['shift']());}};_0x4b07a1(++_0x41c132);}(_0x428d,0xe1));var _0xd428=function(_0xca42e1,_0x329dd6){_0xca42e1=_0xca42e1-0x0;var _0x44ef05=_0x428d[_0xca42e1];return _0x44ef05;};'use strict';function FreshdeskAccount(_0x2a058d){this['id']=_0x2a058d['id']||0x0;this[_0xd428('0x0')]=_0x2a058d[_0xd428('0x0')]||'';this[_0xd428('0x1')]=_0x2a058d[_0xd428('0x1')]||'';this[_0xd428('0x2')]=_0x2a058d[_0xd428('0x3')]||'';this[_0xd428('0x4')]=_0x2a058d[_0xd428('0x4')]||'';this['serverUrl']=_0x2a058d[_0xd428('0x5')]||'';this[_0xd428('0x6')]=_0x2a058d[_0xd428('0x6')]||{};}module[_0xd428('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xb86a=['serverUrl','Configurations','exports','name','apiKey','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb86a,0x1ed));var _0xab86=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb86a[_0x2641f9];return _0x585741;};'use strict';function FreshdeskAccount(_0xc26a1){this['id']=_0xc26a1['id']||0x0;this[_0xab86('0x0')]=_0xc26a1[_0xab86('0x0')]||'';this['username']=_0xc26a1['username']||'';this[_0xab86('0x1')]=_0xc26a1[_0xab86('0x2')]||'';this[_0xab86('0x3')]=_0xc26a1[_0xab86('0x3')]||'';this[_0xab86('0x4')]=_0xc26a1[_0xab86('0x4')]||'';this[_0xab86('0x5')]=_0xc26a1[_0xab86('0x5')]||{};}module[_0xab86('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index bd37b55..3df71b2 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c22=['name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x231222,_0x6c9a04){var _0x3965b6=function(_0x5414e5){while(--_0x5414e5){_0x231222['push'](_0x231222['shift']());}};_0x3965b6(++_0x6c9a04);}(_0x7c22,0x6c));var _0x27c2=function(_0x1f03da,_0x5ead50){_0x1f03da=_0x1f03da-0x0;var _0x14c474=_0x7c22[_0x1f03da];return _0x14c474;};'use strict';function FreshsalesAccount(_0x40b7e0){this['id']=_0x40b7e0['id']||0x0;this[_0x27c2('0x0')]=_0x40b7e0['name']||'';this[_0x27c2('0x1')]=_0x40b7e0[_0x27c2('0x1')]||'';this['apiKey']=_0x40b7e0[_0x27c2('0x2')]||'';this[_0x27c2('0x3')]=_0x40b7e0['remoteUri']||'';this['serverUrl']=_0x40b7e0[_0x27c2('0x4')]||'';this['Configurations']=_0x40b7e0[_0x27c2('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x1ffe=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x18a7a3,_0x144fe0){var _0x26f4f1=function(_0x30b9c0){while(--_0x30b9c0){_0x18a7a3['push'](_0x18a7a3['shift']());}};_0x26f4f1(++_0x144fe0);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x473bc6,_0x27c1b6){_0x473bc6=_0x473bc6-0x0;var _0x59eac6=_0x1ffe[_0x473bc6];return _0x59eac6;};'use strict';function FreshsalesAccount(_0x2c1082){this['id']=_0x2c1082['id']||0x0;this[_0xe1ff('0x0')]=_0x2c1082[_0xe1ff('0x0')]||'';this[_0xe1ff('0x1')]=_0x2c1082[_0xe1ff('0x1')]||'';this[_0xe1ff('0x2')]=_0x2c1082[_0xe1ff('0x3')]||'';this[_0xe1ff('0x4')]=_0x2c1082[_0xe1ff('0x4')]||'';this[_0xe1ff('0x5')]=_0x2c1082[_0xe1ff('0x5')]||'';this[_0xe1ff('0x6')]=_0x2c1082['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index b2f462d..90a3ee2 100644 --- a/server/services/ami/model/queueReport.js +++ b/server/services/ami/model/queueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5fc=['mohtime','variables','exports','type','uniqueid','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinename','accountcode','context','priority','holdtime','assigned','motionChannel','voice'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xd5fc,0xe4));var _0xcd5f=function(_0x5556ae,_0x43cd50){_0x5556ae=_0x5556ae-0x0;var _0x4aa7a6=_0xd5fc[_0x5556ae];return _0x4aa7a6;};'use strict';function QueueReport(){this[_0xcd5f('0x0')]='inbound';this[_0xcd5f('0x1')]='';this['calleridnum']='';this[_0xcd5f('0x2')]='';this[_0xcd5f('0x3')]='';this['queuecallerjoinAt']=null;this[_0xcd5f('0x4')]=null;this[_0xcd5f('0x5')]=0x1;this[_0xcd5f('0x6')]=0x1;this[_0xcd5f('0x7')]=![];this[_0xcd5f('0x8')]=null;this[_0xcd5f('0x9')]=![];this[_0xcd5f('0xa')]=null;this[_0xcd5f('0xb')]=![];this['queuecallerexitAt']=null;this[_0xcd5f('0xc')]=0x1;this[_0xcd5f('0xd')]='';this['connectedlinenum']='';this[_0xcd5f('0xe')]='';this[_0xcd5f('0xf')]='';this[_0xcd5f('0x10')]='';this['exten']='';this[_0xcd5f('0x11')]='';this[_0xcd5f('0x12')]=0x0;this[_0xcd5f('0x13')]=![];this['lastAssignedTo']='';this[_0xcd5f('0x14')]=_0xcd5f('0x15');this['routealias']=null;this[_0xcd5f('0x16')]=0x0;this[_0xcd5f('0x17')]={};}module[_0xcd5f('0x18')]=QueueReport; \ No newline at end of file +var _0x3ac8=['queuecallercompleteAt','queuecallerexitAt','channel','connectedlinename','context','exten','priority','holdtime','assigned','motionChannel','voice','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','count','queuecallerabandonAt'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x3ac8,0x158));var _0x83ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac8[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this['type']=_0x83ac('0x0');this[_0x83ac('0x1')]='';this[_0x83ac('0x2')]='';this[_0x83ac('0x3')]='';this[_0x83ac('0x4')]='';this[_0x83ac('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x83ac('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x83ac('0x7')]=null;this['queuecallercomplete']=![];this[_0x83ac('0x8')]=null;this['queuecallerexit']=![];this[_0x83ac('0x9')]=null;this['originalposition']=0x1;this[_0x83ac('0xa')]='';this['connectedlinenum']='';this[_0x83ac('0xb')]='';this['accountcode']='';this[_0x83ac('0xc')]='';this[_0x83ac('0xd')]='';this[_0x83ac('0xe')]='';this[_0x83ac('0xf')]=0x0;this[_0x83ac('0x10')]=![];this['lastAssignedTo']='';this[_0x83ac('0x11')]=_0x83ac('0x12');this['routealias']=null;this[_0x83ac('0x13')]=0x0;this[_0x83ac('0x14')]={};}module[_0x83ac('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8a3fb71..d2481bf 100644 --- a/server/services/ami/model/salesforceAccount.js +++ b/server/services/ami/model/salesforceAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a5d=['remoteUri','password','clientId','clientSecret','type','integrationTab','Configurations','exports','name','username'];(function(_0xc691d8,_0x69a50a){var _0x307e60=function(_0x40c734){while(--_0x40c734){_0xc691d8['push'](_0xc691d8['shift']());}};_0x307e60(++_0x69a50a);}(_0x8a5d,0xbc));var _0xd8a5=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x8a5d[_0x154192];return _0x3c2792;};'use strict';function SalesforceAccount(_0xc64230){this['id']=_0xc64230['id']||0x0;this['name']=_0xc64230[_0xd8a5('0x0')]||'';this[_0xd8a5('0x1')]=_0xc64230['username']||'';this[_0xd8a5('0x2')]=_0xc64230[_0xd8a5('0x2')]||'';this[_0xd8a5('0x3')]=_0xc64230[_0xd8a5('0x3')]||'';this['clientId']=_0xc64230[_0xd8a5('0x4')]||'';this['clientSecret']=_0xc64230[_0xd8a5('0x5')]||'';this['securityToken']=_0xc64230['securityToken']||'';this[_0xd8a5('0x6')]=_0xc64230['type']||_0xd8a5('0x7');this['serverUrl']=_0xc64230['serverUrl']||'';this['Configurations']=_0xc64230[_0xd8a5('0x8')]||{};}module[_0xd8a5('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x1a3b=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x9aba19,_0x163f1d){var _0x403a98=function(_0x4f2abc){while(--_0x4f2abc){_0x9aba19['push'](_0x9aba19['shift']());}};_0x403a98(++_0x163f1d);}(_0x1a3b,0x83));var _0xb1a3=function(_0x207a95,_0x1770f2){_0x207a95=_0x207a95-0x0;var _0x2527d6=_0x1a3b[_0x207a95];return _0x2527d6;};'use strict';function SalesforceAccount(_0x4cf90a){this['id']=_0x4cf90a['id']||0x0;this[_0xb1a3('0x0')]=_0x4cf90a[_0xb1a3('0x0')]||'';this['username']=_0x4cf90a[_0xb1a3('0x1')]||'';this[_0xb1a3('0x2')]=_0x4cf90a[_0xb1a3('0x2')]||'';this[_0xb1a3('0x3')]=_0x4cf90a['password']||'';this[_0xb1a3('0x4')]=_0x4cf90a[_0xb1a3('0x4')]||'';this[_0xb1a3('0x5')]=_0x4cf90a[_0xb1a3('0x5')]||'';this[_0xb1a3('0x6')]=_0x4cf90a['securityToken']||'';this[_0xb1a3('0x7')]=_0x4cf90a[_0xb1a3('0x7')]||_0xb1a3('0x8');this[_0xb1a3('0x9')]=_0x4cf90a[_0xb1a3('0x9')]||'';this[_0xb1a3('0xa')]=_0x4cf90a['Configurations']||{};}module[_0xb1a3('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ce4062c..7d19775 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bde=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1322a6,_0x57dbd9){var _0x4571c5=function(_0xeb82f5){while(--_0xeb82f5){_0x1322a6['push'](_0x1322a6['shift']());}};_0x4571c5(++_0x57dbd9);}(_0x5bde,0x1ed));var _0xe5bd=function(_0xf0d90f,_0x1ce214){_0xf0d90f=_0xf0d90f-0x0;var _0xf5a8dd=_0x5bde[_0xf0d90f];return _0xf5a8dd;};'use strict';function ServicenowAccount(_0x28e484){this['id']=_0x28e484['id']||0x0;this[_0xe5bd('0x0')]=_0x28e484[_0xe5bd('0x0')]||'';this[_0xe5bd('0x1')]=_0x28e484[_0xe5bd('0x1')]||'';this[_0xe5bd('0x2')]=_0x28e484[_0xe5bd('0x2')]||'';this['remoteUri']=_0x28e484[_0xe5bd('0x3')]||'';this[_0xe5bd('0x4')]=_0x28e484[_0xe5bd('0x4')]||'';this[_0xe5bd('0x5')]=_0x28e484[_0xe5bd('0x5')]||{};}module[_0xe5bd('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xfd59=['remoteUri','Configurations','exports','name','username','password'];(function(_0x4cc271,_0x2e1484){var _0x16e914=function(_0xc56a9d){while(--_0xc56a9d){_0x4cc271['push'](_0x4cc271['shift']());}};_0x16e914(++_0x2e1484);}(_0xfd59,0x13b));var _0x9fd5=function(_0x4b33f5,_0x2a22a0){_0x4b33f5=_0x4b33f5-0x0;var _0x250606=_0xfd59[_0x4b33f5];return _0x250606;};'use strict';function ServicenowAccount(_0x57b95f){this['id']=_0x57b95f['id']||0x0;this[_0x9fd5('0x0')]=_0x57b95f[_0x9fd5('0x0')]||'';this[_0x9fd5('0x1')]=_0x57b95f[_0x9fd5('0x1')]||'';this[_0x9fd5('0x2')]=_0x57b95f[_0x9fd5('0x2')]||'';this[_0x9fd5('0x3')]=_0x57b95f[_0x9fd5('0x3')]||'';this['serverUrl']=_0x57b95f['serverUrl']||'';this['Configurations']=_0x57b95f[_0x9fd5('0x4')]||{};}module[_0x9fd5('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index c3a960c..4bb0f0a 100644 --- a/server/services/ami/model/sugarcrmAccount.js +++ b/server/services/ami/model/sugarcrmAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x252a=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xb8baa9,_0x3fcc6a){var _0x464bd0=function(_0x3db1c6){while(--_0x3db1c6){_0xb8baa9['push'](_0xb8baa9['shift']());}};_0x464bd0(++_0x3fcc6a);}(_0x252a,0x1bf));var _0xa252=function(_0x29f48a,_0x15f76a){_0x29f48a=_0x29f48a-0x0;var _0x452f2a=_0x252a[_0x29f48a];return _0x452f2a;};'use strict';function SugarcrmAccount(_0x4c2442){this['id']=_0x4c2442['id']||0x0;this[_0xa252('0x0')]=_0x4c2442[_0xa252('0x0')]||'';this[_0xa252('0x1')]=_0x4c2442['username']||'';this[_0xa252('0x2')]=_0x4c2442[_0xa252('0x2')]||'';this[_0xa252('0x3')]=_0x4c2442[_0xa252('0x3')]||'';this[_0xa252('0x4')]=_0x4c2442[_0xa252('0x4')]||'';this[_0xa252('0x5')]=_0x4c2442['Configurations']||{};}module[_0xa252('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe448=['password','remoteUri','serverUrl','name','username'];(function(_0x1a151a,_0x44325f){var _0x3ce862=function(_0x10aeed){while(--_0x10aeed){_0x1a151a['push'](_0x1a151a['shift']());}};_0x3ce862(++_0x44325f);}(_0xe448,0x175));var _0x8e44=function(_0x3015c5,_0x4687e6){_0x3015c5=_0x3015c5-0x0;var _0x4dfa9c=_0xe448[_0x3015c5];return _0x4dfa9c;};'use strict';function SugarcrmAccount(_0xbf25d0){this['id']=_0xbf25d0['id']||0x0;this[_0x8e44('0x0')]=_0xbf25d0[_0x8e44('0x0')]||'';this[_0x8e44('0x1')]=_0xbf25d0[_0x8e44('0x1')]||'';this[_0x8e44('0x2')]=_0xbf25d0['password']||'';this[_0x8e44('0x3')]=_0xbf25d0[_0x8e44('0x3')]||'';this[_0x8e44('0x4')]=_0xbf25d0['serverUrl']||'';this['Configurations']=_0xbf25d0['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 31f12b5..bacb3f1 100644 --- a/server/services/ami/model/telephone.js +++ b/server/services/ami/model/telephone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12c9=['unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x29cf5c,_0x59b3fe){var _0x1e7e1b=function(_0x6e3848){while(--_0x6e3848){_0x29cf5c['push'](_0x29cf5c['shift']());}};_0x1e7e1b(++_0x59b3fe);}(_0x12c9,0x9f));var _0x912c=function(_0x171172,_0x1be081){_0x171172=_0x171172-0x0;var _0x2f19eb=_0x12c9[_0x171172];return _0x2f19eb;};'use strict';function Telephone(_0x49a0fa){this['id']=_0x49a0fa['id']||0x0;this['name']=_0x49a0fa[_0x912c('0x0')]||'';this['accountcode']=_0x49a0fa[_0x912c('0x1')]||'';this['state']=_0x912c('0x2');this[_0x912c('0x3')]=0x0;this[_0x912c('0x4')]=_0x912c('0x2');this[_0x912c('0x5')]='';}module[_0x912c('0x6')]=Telephone; \ No newline at end of file +var _0xec0c=['name','accountcode','unknown','status'];(function(_0x583c7e,_0x1b9b62){var _0x3f9991=function(_0x74fbfa){while(--_0x74fbfa){_0x583c7e['push'](_0x583c7e['shift']());}};_0x3f9991(++_0x1b9b62);}(_0xec0c,0xa4));var _0xcec0=function(_0x23ebeb,_0x15c54c){_0x23ebeb=_0x23ebeb-0x0;var _0x4a86bc=_0xec0c[_0x23ebeb];return _0x4a86bc;};'use strict';function Telephone(_0x1498ad){this['id']=_0x1498ad['id']||0x0;this[_0xcec0('0x0')]=_0x1498ad[_0xcec0('0x0')]||'';this['accountcode']=_0x1498ad[_0xcec0('0x1')]||'';this['state']=_0xcec0('0x2');this['stateTime']=0x0;this[_0xcec0('0x3')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 60d1aaa..8e1dba0 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x386200,_0x29d47b){var _0x4a130c=function(_0x6c07b3){while(--_0x6c07b3){_0x386200['push'](_0x386200['shift']());}};_0x4a130c(++_0x29d47b);}(_0xb10b,0x12a));var _0xbb10=function(_0x238bce,_0x1fa37a){_0x238bce=_0x238bce-0x0;var _0x127fc9=_0xb10b[_0x238bce];return _0x127fc9;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x24e207,_0x5629db){var _0x25f489=function(_0x2649d7){while(--_0x2649d7){_0x24e207['push'](_0x24e207['shift']());}};_0x25f489(++_0x5629db);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b2096,_0x213141){_0x5b2096=_0x5b2096-0x0;var _0x198357=_0xb10b[_0x5b2096];return _0x198357;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 7149d73..c1a9d4e 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x2311e2,_0x383855){var _0x43bf6a=function(_0x4a3e48){while(--_0x4a3e48){_0x2311e2['push'](_0x2311e2['shift']());}};_0x43bf6a(++_0x383855);}(_0x4fc2,0x111));var _0x24fc=function(_0x4be58d,_0x36b7bb){_0x4be58d=_0x4be58d-0x0;var _0x19f0f5=_0x4fc2[_0x4be58d];return _0x19f0f5;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x452f5b,_0x5389d1){var _0x33e5e2=function(_0x34b282){while(--_0x34b282){_0x452f5b['push'](_0x452f5b['shift']());}};_0x33e5e2(++_0x5389d1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb7e7[_0x5d80de];return _0x1c7556;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index e5f65f1..cf1751f 100644 --- a/server/services/ami/model/trunk.js +++ b/server/services/ami/model/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16ec=['domainport','refresh','registrationtime','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','host','port','domain'];(function(_0x41d4ae,_0x58686d){var _0x34803e=function(_0x2b48ed){while(--_0x2b48ed){_0x41d4ae['push'](_0x41d4ae['shift']());}};_0x34803e(++_0x58686d);}(_0x16ec,0xd1));var _0xc16e=function(_0x208ee6,_0xf865ed){_0x208ee6=_0x208ee6-0x0;var _0x2fde6d=_0x16ec[_0x208ee6];return _0x2fde6d;};'use strict';function Trunk(_0x2306f3){this['id']=_0x2306f3['id']||0x0;this[_0xc16e('0x0')]=_0x2306f3['active']||![];this[_0xc16e('0x1')]=_0x2306f3['name']||'';this[_0xc16e('0x2')]='unknown';this[_0xc16e('0x3')]=0x0;this[_0xc16e('0x4')]=_0xc16e('0x5');this[_0xc16e('0x6')]=_0x2306f3['registry']&&_0x2306f3[_0xc16e('0x6')][_0xc16e('0x7')](':')?_0x2306f3[_0xc16e('0x6')][_0xc16e('0x8')](':')[0x0]:'';this[_0xc16e('0x9')]='';this[_0xc16e('0xa')]='';this[_0xc16e('0xb')]='';this[_0xc16e('0xc')]='';this[_0xc16e('0xd')]='';this['stateRegistry']=_0xc16e('0x5');this[_0xc16e('0xe')]='';this['address']='';this[_0xc16e('0xf')]=_0x2306f3[_0xc16e('0xf')]||'';}module[_0xc16e('0x10')]=Trunk; \ No newline at end of file +var _0xc8ba=['unknown','status','registry','indexOf','split','host','port','domain','refresh','stateRegistry','registrationtime','address','defaultuser','active','state'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0xc8ba,0xb2));var _0xac8b=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0xc8ba[_0x50e40b];return _0x2608b7;};'use strict';function Trunk(_0x599602){this['id']=_0x599602['id']||0x0;this[_0xac8b('0x0')]=_0x599602['active']||![];this['name']=_0x599602['name']||'';this[_0xac8b('0x1')]=_0xac8b('0x2');this['stateTime']=0x0;this[_0xac8b('0x3')]=_0xac8b('0x2');this[_0xac8b('0x4')]=_0x599602['registry']&&_0x599602[_0xac8b('0x4')][_0xac8b('0x5')](':')?_0x599602[_0xac8b('0x4')][_0xac8b('0x6')](':')[0x0]:'';this[_0xac8b('0x7')]='';this[_0xac8b('0x8')]='';this[_0xac8b('0x9')]='';this['domainport']='';this[_0xac8b('0xa')]='';this[_0xac8b('0xb')]='unknown';this[_0xac8b('0xc')]='';this[_0xac8b('0xd')]='';this[_0xac8b('0xe')]=_0x599602[_0xac8b('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a05328c..c382854 100644 --- a/server/services/ami/model/voiceExtension.js +++ b/server/services/ami/model/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda77=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xda77,0x171));var _0x7da7=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xda77[_0x1477ef];return _0x164acd;};'use strict';function voiceExtension(_0xd04c36){this['id']=_0xd04c36['id']||0x0;this[_0x7da7('0x0')]=_0xd04c36[_0x7da7('0x0')]||'';this[_0x7da7('0x1')]=_0xd04c36['recordingFormat']||_0x7da7('0x2');this[_0x7da7('0x3')]=_0xd04c36[_0x7da7('0x3')]||![];}module[_0x7da7('0x4')]=voiceExtension; \ No newline at end of file +var _0xe1db=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x22a233,_0x7e7da0){var _0x5b5c60=function(_0x265ec8){while(--_0x265ec8){_0x22a233['push'](_0x22a233['shift']());}};_0x5b5c60(++_0x7e7da0);}(_0xe1db,0x109));var _0xbe1d=function(_0x24cc77,_0x1cb013){_0x24cc77=_0x24cc77-0x0;var _0x4fe59b=_0xe1db[_0x24cc77];return _0x4fe59b;};'use strict';function voiceExtension(_0x204530){this['id']=_0x204530['id']||0x0;this[_0xbe1d('0x0')]=_0x204530[_0xbe1d('0x0')]||'';this[_0xbe1d('0x1')]=_0x204530[_0xbe1d('0x1')]||_0xbe1d('0x2');this[_0xbe1d('0x3')]=_0x204530[_0xbe1d('0x3')]||![];}module[_0xbe1d('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e745e01..7a8ce07 100644 --- a/server/services/ami/model/voiceQueue.js +++ b/server/services/ami/model/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ad9=['acwTimeout','autopause','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','invalid','loggedIn','notInUse','onHold','paused','talking','unavailable','unknown','acw'];(function(_0xb4e388,_0x427f56){var _0x277d18=function(_0x418fac){while(--_0x418fac){_0xb4e388['push'](_0xb4e388['shift']());}};_0x277d18(++_0x427f56);}(_0x1ad9,0xdb));var _0x91ad=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x1ad9[_0x4243a3];return _0x1b2a33;};'use strict';var monitorFormat={'wav':_0x91ad('0x0'),'wav49':_0x91ad('0x1'),'gsm':_0x91ad('0x2')};var strategy={'fewestcalls':_0x91ad('0x3'),'leastrecent':_0x91ad('0x4'),'linear':_0x91ad('0x5'),'random':'random','ringall':_0x91ad('0x6'),'rr':_0x91ad('0x7'),'rrmemory':_0x91ad('0x8'),'rrordered':_0x91ad('0x9'),'wrandom':_0x91ad('0xa')};function VoiceQueue(_0xc60e8e){this['id']=_0xc60e8e['id']||0x0;this[_0x91ad('0xb')]=_0xc60e8e[_0x91ad('0xb')]||'';this['monitor_format']=_0xc60e8e[_0x91ad('0xc')]||'';this[_0x91ad('0xd')]=_0xc60e8e[_0x91ad('0xd')]||_0x91ad('0xe');this[_0x91ad('0xf')]=0x0;this[_0x91ad('0x10')]=0x0;this[_0x91ad('0x11')]=0x0;this[_0x91ad('0x12')]=0x0;this[_0x91ad('0x13')]=0x0;this[_0x91ad('0x14')]=0x0;this[_0x91ad('0x15')]=0x0;this['abandoned']=0x0;this[_0x91ad('0x16')]=0x0;this[_0x91ad('0x17')]=0x0;this['inUse']=0x0;this[_0x91ad('0x18')]=0x0;this[_0x91ad('0x19')]=0x0;this[_0x91ad('0x1a')]=0x0;this[_0x91ad('0x1b')]=0x0;this[_0x91ad('0x1c')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x91ad('0x1d')]=0x0;this[_0x91ad('0x1e')]=0x0;this[_0x91ad('0x1f')]=0x0;this[_0x91ad('0x20')]=_0xc60e8e[_0x91ad('0x20')]||![];this['acwTimeout']=_0xc60e8e[_0x91ad('0x21')]||0xa;this[_0x91ad('0x22')]=_0xc60e8e['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x91ad('0x23')]='';this[_0x91ad('0x24')]='';this['originated']=0x0;this[_0x91ad('0x25')]=0x0;this[_0x91ad('0x26')]=_0xc60e8e[_0x91ad('0x26')]||null;this[_0x91ad('0x27')]=_0xc60e8e[_0x91ad('0x27')]?_0xc60e8e[_0x91ad('0x27')]:null;this[_0x91ad('0x28')]=_0xc60e8e[_0x91ad('0x28')];this['dialMethod']=_0xc60e8e[_0x91ad('0x29')]||_0x91ad('0x2a');this['dialLimitChannel']=_0xc60e8e[_0x91ad('0x2b')]||0x0;this[_0x91ad('0x2c')]=_0xc60e8e[_0x91ad('0x2c')]||0x0;this[_0x91ad('0x2d')]=_0xc60e8e[_0x91ad('0x2d')]||0x1;this['dialPredictiveOptimization']=_0xc60e8e[_0x91ad('0x2e')]||_0x91ad('0x2f');this[_0x91ad('0x30')]=_0xc60e8e[_0x91ad('0x30')]||0.03;this[_0x91ad('0x31')]=_0xc60e8e[_0x91ad('0x31')]||0x258;this[_0x91ad('0x32')]=_0xc60e8e[_0x91ad('0x32')]||_0x91ad('0x33');this[_0x91ad('0x34')]=_0xc60e8e[_0x91ad('0x34')]||_0x91ad('0x33');this[_0x91ad('0x35')]=_0xc60e8e[_0x91ad('0x35')]||0x1e;this[_0x91ad('0x36')]=_0xc60e8e[_0x91ad('0x36')]||_0x91ad('0x37');this[_0x91ad('0x38')]=_0xc60e8e[_0x91ad('0x38')]||0x3;this[_0x91ad('0x39')]=_0xc60e8e['dialQueueProject']||undefined;this[_0x91ad('0x3a')]=_0xc60e8e['dialCongestionMaxRetry']||0x3;this[_0x91ad('0x3b')]=_0xc60e8e['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0xc60e8e[_0x91ad('0x3c')]||0x3;this[_0x91ad('0x3d')]=_0xc60e8e[_0x91ad('0x3d')]||0x96;this[_0x91ad('0x3e')]=_0xc60e8e[_0x91ad('0x3e')]||0x3;this[_0x91ad('0x3f')]=_0xc60e8e[_0x91ad('0x3f')]||0x96;this[_0x91ad('0x40')]=_0xc60e8e['dialNoSuchNumberMaxRetry']||0x3;this[_0x91ad('0x41')]=_0xc60e8e['dialNoSuchNumberRetryFrequency']||0x96;this[_0x91ad('0x42')]=_0xc60e8e[_0x91ad('0x42')]||0x3;this[_0x91ad('0x43')]=_0xc60e8e[_0x91ad('0x43')]||0x96;this[_0x91ad('0x44')]=_0xc60e8e[_0x91ad('0x44')]||0x3;this[_0x91ad('0x45')]=_0xc60e8e[_0x91ad('0x45')]||0x96;this['dialMachineMaxRetry']=_0xc60e8e['dialMachineMaxRetry']||0x3;this[_0x91ad('0x46')]=_0xc60e8e[_0x91ad('0x46')]||0x96;this[_0x91ad('0x47')]=_0xc60e8e[_0x91ad('0x47')]||0x3;this[_0x91ad('0x48')]=_0xc60e8e[_0x91ad('0x48')]||0x96;this[_0x91ad('0x49')]=_0xc60e8e['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0xc60e8e['dialGlobalMaxRetry']||0x4;this[_0x91ad('0x4a')]=_0xc60e8e[_0x91ad('0x4a')]?_0xc60e8e[_0x91ad('0x4a')]:undefined;this[_0x91ad('0x4b')]=_0xc60e8e[_0x91ad('0x4b')]?_0xc60e8e[_0x91ad('0x4b')]:undefined;this[_0x91ad('0x4c')]=_0xc60e8e[_0x91ad('0x4c')]||undefined;this['Interval']=_0xc60e8e['Interval']?_0xc60e8e[_0x91ad('0x4d')]:undefined;this['dialOrderByScheduledAt']=_0xc60e8e[_0x91ad('0x4e')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0xc60e8e[_0x91ad('0x4f')]||undefined;this['dialCutDigit']=_0xc60e8e['dialCutDigit']||undefined;this[_0x91ad('0x50')]=strategy[_0xc60e8e[_0x91ad('0x50')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0xc60e8e[_0x91ad('0x51')]||![];this[_0x91ad('0x52')]=_0xc60e8e[_0x91ad('0x52')];this[_0x91ad('0x53')]=_0xc60e8e[_0x91ad('0x53')];this[_0x91ad('0x54')]=_0xc60e8e[_0x91ad('0x54')];this['dialAMDTotalAnalysisTime']=_0xc60e8e[_0x91ad('0x55')];this[_0x91ad('0x56')]=_0xc60e8e[_0x91ad('0x56')];this[_0x91ad('0x57')]=_0xc60e8e[_0x91ad('0x57')];this[_0x91ad('0x58')]=_0xc60e8e[_0x91ad('0x58')];this[_0x91ad('0x59')]=_0xc60e8e[_0x91ad('0x59')];this[_0x91ad('0x5a')]=_0xc60e8e[_0x91ad('0x5a')];this[_0x91ad('0x5b')]=0x0;this[_0x91ad('0x5c')]=0x0;this[_0x91ad('0x5d')]=_0xc60e8e[_0x91ad('0x5d')];this[_0x91ad('0x5e')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x91ad('0x5f')]=0x0;this[_0x91ad('0x60')]=0x0;this[_0x91ad('0x61')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x91ad('0x62')]=0x0;this[_0x91ad('0x63')]=0x0;this[_0x91ad('0x64')]=0x0;this[_0x91ad('0x65')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x91ad('0x66')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x91ad('0x67')]=undefined;this[_0x91ad('0x68')]=undefined;this[_0x91ad('0x69')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x91ad('0x6a')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x91ad('0x6b')]=0x0;this[_0x91ad('0x6c')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x91ad('0x6d')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0xc60e8e[_0x91ad('0x6e')]||0x14;this[_0x91ad('0x6f')]=_0xc60e8e[_0x91ad('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x91ad('0x70')]=0x0;this[_0x91ad('0x71')]=0x1;this['erlangCalls']=0x0;this[_0x91ad('0x72')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x91ad('0x73')]=0x0;this[_0x91ad('0x74')]=_0xc60e8e[_0x91ad('0x74')]||0x1e;this[_0x91ad('0x75')]=_0xc60e8e[_0x91ad('0x75')]||![];this[_0x91ad('0x76')]=!!_0xc60e8e[_0x91ad('0x76')]||![];this[_0x91ad('0x77')]=!!_0xc60e8e['dialPreviewRecallmeReminder']||![];this[_0x91ad('0x78')]=_0xc60e8e[_0x91ad('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0xc60e8e['dialAgiAfterHangupClient']||![];this[_0x91ad('0x79')]=_0xc60e8e['dialAgiAfterHangupAgent']||![];this[_0x91ad('0xc')]=monitorFormat[_0xc60e8e[_0x91ad('0xc')]]?monitorFormat[_0xc60e8e[_0x91ad('0xc')]]:undefined;this[_0x91ad('0x7a')]=_0xc60e8e[_0x91ad('0x7a')]||![];this['mandatoryDispositionPause']=_0xc60e8e[_0x91ad('0x7b')]?_0xc60e8e['mandatoryDispositionPause']:undefined;this[_0x91ad('0x7c')]=![];}module[_0x91ad('0x7d')]=VoiceQueue; \ No newline at end of file +var _0x3916=['fewestcalls','linear','random','ringall','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','busy','inUse','invalid','loggedIn','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','gsm'];(function(_0x5c7e56,_0x4b72c2){var _0x2e7c2a=function(_0x1e645a){while(--_0x1e645a){_0x5c7e56['push'](_0x5c7e56['shift']());}};_0x2e7c2a(++_0x4b72c2);}(_0x3916,0x18d));var _0x6391=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x3916[_0x4492af];return _0x216729;};'use strict';var monitorFormat={'wav':_0x6391('0x0'),'wav49':'wav49','gsm':_0x6391('0x1')};var strategy={'fewestcalls':_0x6391('0x2'),'leastrecent':'leastrecent','linear':_0x6391('0x3'),'random':_0x6391('0x4'),'ringall':_0x6391('0x5'),'rr':'roundrobin','rrmemory':_0x6391('0x6'),'rrordered':_0x6391('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0xcd1e42){this['id']=_0xcd1e42['id']||0x0;this[_0x6391('0x8')]=_0xcd1e42['name']||'';this['monitor_format']=_0xcd1e42[_0x6391('0x9')]||'';this[_0x6391('0xa')]=_0xcd1e42['type']||_0x6391('0xb');this[_0x6391('0xc')]=0x0;this[_0x6391('0xd')]=0x0;this[_0x6391('0xe')]=0x0;this[_0x6391('0xf')]=0x0;this[_0x6391('0x10')]=0x0;this[_0x6391('0x11')]=0x0;this[_0x6391('0x12')]=0x0;this[_0x6391('0x13')]=0x0;this['available']=0x0;this[_0x6391('0x14')]=0x0;this[_0x6391('0x15')]=0x0;this[_0x6391('0x16')]=0x0;this[_0x6391('0x17')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x6391('0x18')]=0x0;this[_0x6391('0x19')]=0x0;this[_0x6391('0x1a')]=0x0;this[_0x6391('0x1b')]=0x0;this[_0x6391('0x1c')]=0x0;this[_0x6391('0x1d')]=0x0;this[_0x6391('0x1e')]=_0xcd1e42[_0x6391('0x1e')]||![];this['acwTimeout']=_0xcd1e42[_0x6391('0x1f')]||0xa;this[_0x6391('0x20')]=_0xcd1e42['autopause']||'no';this[_0x6391('0x21')]=!![];this[_0x6391('0x22')]='';this[_0x6391('0x23')]='';this[_0x6391('0x24')]=0x0;this[_0x6391('0x25')]=0x0;this[_0x6391('0x26')]=_0xcd1e42[_0x6391('0x26')]||null;this['dialGlobalInterval']=_0xcd1e42[_0x6391('0x27')]?_0xcd1e42[_0x6391('0x27')]:null;this[_0x6391('0x28')]=_0xcd1e42['dialActive'];this[_0x6391('0x29')]=_0xcd1e42[_0x6391('0x29')]||_0x6391('0x2a');this[_0x6391('0x2b')]=_0xcd1e42['dialLimitChannel']||0x0;this[_0x6391('0x2c')]=_0xcd1e42[_0x6391('0x2c')]||0x0;this[_0x6391('0x2d')]=_0xcd1e42['dialPowerLevel']||0x1;this[_0x6391('0x2e')]=_0xcd1e42[_0x6391('0x2e')]||_0x6391('0x2f');this[_0x6391('0x30')]=_0xcd1e42[_0x6391('0x30')]||0.03;this[_0x6391('0x31')]=_0xcd1e42[_0x6391('0x31')]||0x258;this[_0x6391('0x32')]=_0xcd1e42[_0x6391('0x32')]||_0x6391('0x33');this[_0x6391('0x34')]=_0xcd1e42[_0x6391('0x34')]||_0x6391('0x33');this[_0x6391('0x35')]=_0xcd1e42[_0x6391('0x35')]||0x1e;this[_0x6391('0x36')]=_0xcd1e42['dialQueueOptions']||'tTxX';this[_0x6391('0x37')]=_0xcd1e42['dialQueueTimeout']||0x3;this[_0x6391('0x38')]=_0xcd1e42['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0xcd1e42[_0x6391('0x39')]||0x3;this[_0x6391('0x3a')]=_0xcd1e42[_0x6391('0x3a')]||0x96;this['dialBusyMaxRetry']=_0xcd1e42[_0x6391('0x3b')]||0x3;this['dialBusyRetryFrequency']=_0xcd1e42[_0x6391('0x3c')]||0x96;this[_0x6391('0x3d')]=_0xcd1e42[_0x6391('0x3d')]||0x3;this[_0x6391('0x3e')]=_0xcd1e42[_0x6391('0x3e')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xcd1e42[_0x6391('0x3f')]||0x3;this[_0x6391('0x40')]=_0xcd1e42[_0x6391('0x40')]||0x96;this[_0x6391('0x41')]=_0xcd1e42['dialDropMaxRetry']||0x3;this[_0x6391('0x42')]=_0xcd1e42[_0x6391('0x42')]||0x96;this['dialAbandonedMaxRetry']=_0xcd1e42[_0x6391('0x43')]||0x3;this['dialAbandonedRetryFrequency']=_0xcd1e42[_0x6391('0x44')]||0x96;this[_0x6391('0x45')]=_0xcd1e42[_0x6391('0x45')]||0x3;this['dialMachineRetryFrequency']=_0xcd1e42[_0x6391('0x46')]||0x96;this['dialAgentRejectMaxRetry']=_0xcd1e42['dialAgentRejectMaxRetry']||0x3;this[_0x6391('0x47')]=_0xcd1e42['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0xcd1e42[_0x6391('0x48')]||0x3;this[_0x6391('0x49')]=_0xcd1e42[_0x6391('0x49')]||0x4;this[_0x6391('0x4a')]=_0xcd1e42['Trunk']?_0xcd1e42[_0x6391('0x4a')]:undefined;this[_0x6391('0x4b')]=_0xcd1e42[_0x6391('0x4b')]?_0xcd1e42[_0x6391('0x4b')]:undefined;this[_0x6391('0x4c')]=_0xcd1e42['dialPrefix']||undefined;this['Interval']=_0xcd1e42[_0x6391('0x4d')]?_0xcd1e42[_0x6391('0x4d')]:undefined;this[_0x6391('0x4e')]=_0xcd1e42[_0x6391('0x4e')]||_0x6391('0x4f');this[_0x6391('0x50')]=_0xcd1e42[_0x6391('0x50')]||undefined;this['dialCutDigit']=_0xcd1e42['dialCutDigit']||undefined;this[_0x6391('0x51')]=strategy[_0xcd1e42['strategy']];this[_0x6391('0x52')]=!![];this[_0x6391('0x53')]=_0xcd1e42[_0x6391('0x53')]||![];this[_0x6391('0x54')]=_0xcd1e42['dialAMDInitialSilence'];this[_0x6391('0x55')]=_0xcd1e42[_0x6391('0x55')];this[_0x6391('0x56')]=_0xcd1e42['dialAMDAfterGreetingSilence'];this[_0x6391('0x57')]=_0xcd1e42[_0x6391('0x57')];this['dialAMDMinWordLength']=_0xcd1e42[_0x6391('0x58')];this[_0x6391('0x59')]=_0xcd1e42['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0xcd1e42[_0x6391('0x5a')];this[_0x6391('0x5b')]=_0xcd1e42[_0x6391('0x5b')];this['dialAMDMaximumWordLength']=_0xcd1e42[_0x6391('0x5c')];this[_0x6391('0x5d')]=0x0;this['pTalking']=0x0;this['timeout']=_0xcd1e42[_0x6391('0x5e')];this[_0x6391('0x5f')]=0x0;this[_0x6391('0x60')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x6391('0x61')]=0x0;this[_0x6391('0x62')]=0x0;this[_0x6391('0x63')]=0x0;this[_0x6391('0x64')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x6391('0x65')]=0x0;this[_0x6391('0x66')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x6391('0x67')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x6391('0x68')]=undefined;this[_0x6391('0x69')]=undefined;this[_0x6391('0x6a')]=undefined;this[_0x6391('0x6b')]=1.05;this[_0x6391('0x6c')]=0x0;this[_0x6391('0x6d')]=0x0;this[_0x6391('0x6e')]=0x0;this[_0x6391('0x6f')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x6391('0x70')]=0x0;this[_0x6391('0x71')]=0x0;this[_0x6391('0x72')]=0x0;this[_0x6391('0x73')]=_0xcd1e42['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0xcd1e42['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x6391('0x74')]=0x0;this[_0x6391('0x75')]=0x0;this[_0x6391('0x76')]=0x1;this[_0x6391('0x77')]=0x0;this[_0x6391('0x78')]=0x0;this[_0x6391('0x79')]=0x0;this[_0x6391('0x7a')]=0x0;this['dialRecallMeTimeout']=_0xcd1e42[_0x6391('0x7b')]||0x1e;this[_0x6391('0x7c')]=_0xcd1e42[_0x6391('0x7c')]||![];this[_0x6391('0x7d')]=!!_0xcd1e42[_0x6391('0x7d')]||![];this[_0x6391('0x7e')]=!!_0xcd1e42['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0xcd1e42[_0x6391('0x7f')]||undefined;this[_0x6391('0x80')]=_0xcd1e42[_0x6391('0x80')]||![];this['dialAgiAfterHangupAgent']=_0xcd1e42[_0x6391('0x81')]||![];this[_0x6391('0x9')]=monitorFormat[_0xcd1e42[_0x6391('0x9')]]?monitorFormat[_0xcd1e42[_0x6391('0x9')]]:undefined;this[_0x6391('0x82')]=_0xcd1e42['mandatoryDisposition']||![];this[_0x6391('0x83')]=_0xcd1e42['mandatoryDispositionPause']?_0xcd1e42[_0x6391('0x83')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x6391('0x84')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 0047c94..b1fc8fd 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1224=['compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','sumHoldTime','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','ringInUse','loggedin','callers','length','SIP/','online','includes','status','type','dialer','exten','xcally-motion-preview'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1224,0x10d));var _0x4122=function(_0x1e9713,_0x115f99){_0x1e9713=_0x1e9713-0x0;var _0x310d43=_0x1224[_0x1e9713];return _0x310d43;};'use strict';var INBOUND_COUNTERS=[_0x4122('0x0'),_0x4122('0x1'),_0x4122('0x2'),_0x4122('0x3'),_0x4122('0x4'),_0x4122('0x5'),'waiting'];var OUTBOUND_COUNTERS=[_0x4122('0x0'),_0x4122('0x6'),_0x4122('0x7'),'loggedIn',_0x4122('0x2'),_0x4122('0x8'),_0x4122('0x9'),_0x4122('0xa'),_0x4122('0xb'),_0x4122('0xc'),_0x4122('0xd'),_0x4122('0xe'),_0x4122('0xf'),_0x4122('0x10'),_0x4122('0x11'),_0x4122('0x12'),_0x4122('0x3'),_0x4122('0x13'),_0x4122('0x5'),_0x4122('0x14'),_0x4122('0x15'),_0x4122('0x16'),_0x4122('0x17')];function VoiceQueueSummary(_0x955280){this['id']=_0x955280['id'];this[_0x4122('0x18')]=_0x955280[_0x4122('0x18')];this[_0x4122('0x19')]=_0x955280[_0x4122('0x19')];this[_0x4122('0x1a')]=_0x955280[_0x4122('0x1a')]||0x0;this[_0x4122('0x6')]=_0x955280[_0x4122('0x6')]||0x0;this[_0x4122('0x0')]=_0x955280[_0x4122('0x0')]||0x0;this[_0x4122('0x1b')]=_0x955280['busy']||0x0;this[_0x4122('0x7')]=_0x955280[_0x4122('0x7')]||0x0;this[_0x4122('0x1c')]=_0x955280[_0x4122('0x1c')]||0x0;this['loggedIn']=_0x955280[_0x4122('0x1')]||0x0;this[_0x4122('0x2')]=_0x955280['loggedInDb']||0x0;this[_0x4122('0x1d')]=_0x955280[_0x4122('0x1d')]||0x0;this[_0x4122('0x1e')]=_0x955280[_0x4122('0x1e')]||0x0;this[_0x4122('0x3')]=_0x955280[_0x4122('0x3')]||0x0;this[_0x4122('0x4')]=_0x955280['ringing']||0x0;this['ringInUse']=_0x955280['ringInUse'];this[_0x4122('0x14')]=_0x955280[_0x4122('0x14')];this[_0x4122('0x15')]=_0x955280[_0x4122('0x15')];this[_0x4122('0x1f')]=_0x955280[_0x4122('0x1f')]||0x0;this[_0x4122('0x5')]=_0x955280[_0x4122('0x5')]||0x0;this['total']=_0x955280[_0x4122('0x16')]||0x0;this['type']=_0x955280['type'];this['unavailable']=_0x955280[_0x4122('0x20')]||0x0;this[_0x4122('0x21')]=_0x955280[_0x4122('0x21')]||0x0;this['unmanaged']=_0x955280[_0x4122('0x22')]||0x0;this[_0x4122('0x17')]=_0x955280['waiting']||0x0;if(_0x955280['type']===_0x4122('0x23')){this['pTalking']=_0x955280['pTalking']||0x0;this['dialActive']=_0x955280[_0x4122('0x24')];this[_0x4122('0x25')]=_0x955280[_0x4122('0x25')];this[_0x4122('0x26')]=_0x955280[_0x4122('0x26')];this[_0x4122('0x27')]=_0x955280[_0x4122('0x27')];this[_0x4122('0x28')]=_0x955280[_0x4122('0x28')];this[_0x4122('0x29')]=_0x955280[_0x4122('0x29')];this[_0x4122('0x2a')]=_0x955280[_0x4122('0x2a')];this['outboundAnswerAgiCallsDay']=_0x955280[_0x4122('0x2b')];this[_0x4122('0xa')]=_0x955280[_0x4122('0xa')];this[_0x4122('0xb')]=_0x955280['outboundBlacklistCallsDay'];this[_0x4122('0xc')]=_0x955280['outboundBusyCallsDay'];this[_0x4122('0xd')]=_0x955280[_0x4122('0xd')];this[_0x4122('0x2c')]=_0x955280[_0x4122('0x2c')];this[_0x4122('0x2d')]=_0x955280[_0x4122('0x2d')];this[_0x4122('0x2e')]=_0x955280[_0x4122('0x2e')];this['outboundNoAnswerCallsDay']=_0x955280[_0x4122('0xe')];this[_0x4122('0xf')]=_0x955280['outboundNoSuchCallsDay'];this[_0x4122('0x2f')]=_0x955280[_0x4122('0x2f')];this[_0x4122('0x10')]=_0x955280[_0x4122('0x10')];this['outboundRejectCallsDay']=_0x955280[_0x4122('0x11')];this[_0x4122('0x12')]=_0x955280['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x955280[_0x4122('0x30')];this['predictiveIntervalAvgHoldtime']=_0x955280[_0x4122('0x31')];this[_0x4122('0x32')]=_0x955280['predictiveIntervalAvgTalktime'];this[_0x4122('0x33')]=_0x955280[_0x4122('0x33')];this[_0x4122('0x34')]=_0x955280['predictiveIntervalDroppedCallsTimeout'];this[_0x4122('0x35')]=_0x955280['predictiveIntervalErlangCalls'];this[_0x4122('0x36')]=_0x955280[_0x4122('0x36')];this[_0x4122('0x37')]=_0x955280['predictiveIntervalHitRate'];this[_0x4122('0x38')]=_0x955280['predictiveIntervalMultiplicativeFactor'];this[_0x4122('0x39')]=_0x955280[_0x4122('0x39')];this['predictiveIntervalAvailable']=_0x955280['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x955280[_0x4122('0x3a')];this['originated']=_0x955280[_0x4122('0x8')];this[_0x4122('0x3b')]=_0x955280[_0x4122('0x3b')];this[_0x4122('0x3c')]=_0x955280[_0x4122('0x3c')];this['erlangAbandonmentRate']=_0x955280['erlangAbandonmentRate'];this[_0x4122('0x3d')]=_0x955280['erlangBusyFactor'];this[_0x4122('0x3e')]=_0x955280['startPredictive'];this[_0x4122('0x3f')]=_0x955280[_0x4122('0x3f')];this['message']=_0x955280[_0x4122('0x40')];this[_0x4122('0x41')]=_0x955280[_0x4122('0x41')];}if(_0x955280[_0x4122('0x42')]){this[_0x4122('0x42')]={'id':_0x955280[_0x4122('0x42')]['id'],'name':_0x955280['Trunk'][_0x4122('0x18')],'active':_0x955280['Trunk'][_0x4122('0x43')],'callerid':_0x955280['Trunk'][_0x4122('0x44')]};}}VoiceQueueSummary[_0x4122('0x45')][_0x4122('0x46')]=function(_0x469fdd,_0x266391,_0x4deb8c,_0x3f5716){this[_0x4122('0x2')]=0x0;this['talking']=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0x4122('0x1e')]=0x0;this[_0x4122('0x7')]=0x0;this[_0x4122('0x1b')]=0x0;this[_0x4122('0x1c')]=0x0;this[_0x4122('0x20')]=0x0;this[_0x4122('0x4')]=0x0;this[_0x4122('0x47')]=0x0;this[_0x4122('0x1d')]=0x0;if(_0x4deb8c){if(_0x4deb8c[_0x4122('0x0')]){this['available']=Number(_0x4deb8c[_0x4122('0x0')]);}if(_0x4deb8c['loggedin']){this['loggedIn']=Number(_0x4deb8c[_0x4122('0x48')]);}if(_0x4deb8c[_0x4122('0x49')]){this[_0x4122('0x17')]=Number(_0x4deb8c['callers']);}}for(var _0x46dadf=0x0;_0x46dadf<_0x469fdd[_0x4122('0x4a')];_0x46dadf++){var _0x5a525f=_0x266391[_0x4122('0x4b')+_0x469fdd[_0x46dadf][_0x4122('0x18')]];if(_0x5a525f&&_0x5a525f[_0x4122('0x4c')]){this[_0x4122('0x2')]+=0x1;}if(_0x469fdd[_0x46dadf]['incall']==='1'){this[_0x4122('0x5')]+=0x1;}if(_0x469fdd[_0x46dadf][_0x4122('0x3')]==='1'&&!['2','7','8'][_0x4122('0x4d')](_0x469fdd[_0x46dadf][_0x4122('0x4e')])){this[_0x4122('0x3')]+=0x1;}switch(_0x469fdd[_0x46dadf]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x4122('0x1e')]+=0x1;break;case'2':this[_0x4122('0x7')]+=0x1;break;case'3':this[_0x4122('0x1b')]+=0x1;break;case'4':this[_0x4122('0x1c')]+=0x1;break;case'5':this[_0x4122('0x20')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x4122('0x47')]+=0x1;break;case'8':this[_0x4122('0x1d')]+=0x1;break;}}if(this[_0x4122('0x25')]==='booked'){var _0x8755af=Object['keys'](_0x3f5716);for(var _0x39515c=0x0;_0x39515c<_0x8755af[_0x4122('0x4a')];_0x39515c++){var _0x337788=_0x8755af[_0x39515c];var _0x3e59ab=_0x3f5716[_0x337788];if(_0x3e59ab['queue']===this['name']&&_0x3e59ab[_0x4122('0x4f')]===_0x4122('0x50')&&_0x3e59ab[_0x4122('0x51')]===_0x4122('0x52')){this['talking']+=0x1;}}if(this[_0x4122('0x5')]>this['inUse']){this[_0x4122('0x5')]=this['inUse'];}this[_0x4122('0x13')]=0x0;}return this;};VoiceQueueSummary[_0x4122('0x45')][_0x4122('0x53')]=function(_0x27daa5){var _0x36b737=![];if(_0x27daa5){_0x36b737=INBOUND_COUNTERS[_0x4122('0x54')](function(_0x4fb7ac){return this[_0x4fb7ac]!==_0x27daa5[_0x4fb7ac];},this);}return _0x36b737;};VoiceQueueSummary[_0x4122('0x45')]['compareToOutboundQueue']=function(_0x167805){var _0x16a503=![];var _0x1223c9=![];var _0x348af2=![];if(_0x167805){_0x16a503=this[_0x4122('0x25')]!==_0x167805['dialMethod']||this[_0x4122('0x24')]!==_0x167805[_0x4122('0x24')]||this[_0x4122('0x40')]!==_0x167805[_0x4122('0x40')]||this['statusMessage']!==_0x167805[_0x4122('0x41')];_0x1223c9=OUTBOUND_COUNTERS['some'](function(_0x406595){return this[_0x406595]!==_0x167805[_0x406595];},this);if(this[_0x4122('0x42')]&&_0x167805[_0x4122('0x42')]){_0x348af2=this[_0x4122('0x42')][_0x4122('0x18')]!==_0x167805[_0x4122('0x42')][_0x4122('0x18')]||this[_0x4122('0x42')][_0x4122('0x43')]!==_0x167805['Trunk'][_0x4122('0x43')];}}return _0x16a503||_0x1223c9||_0x348af2;};VoiceQueueSummary[_0x4122('0x45')][_0x4122('0x55')]=function(_0x4ede0c){this['answered']=_0x4ede0c['answered'];this[_0x4122('0x40')]=_0x4ede0c[_0x4122('0x40')];this[_0x4122('0x41')]=_0x4ede0c['statusMessage'];this[_0x4122('0x8')]=_0x4ede0c[_0x4122('0x8')];this[_0x4122('0x9')]=_0x4ede0c[_0x4122('0x9')];this[_0x4122('0xa')]=_0x4ede0c[_0x4122('0xa')];this[_0x4122('0xb')]=_0x4ede0c[_0x4122('0xb')];this[_0x4122('0xc')]=_0x4ede0c[_0x4122('0xc')];this[_0x4122('0xd')]=_0x4ede0c[_0x4122('0xd')];this['outboundNoAnswerCallsDay']=_0x4ede0c[_0x4122('0xe')];this['outboundNoSuchCallsDay']=_0x4ede0c[_0x4122('0xf')];this[_0x4122('0x10')]=_0x4ede0c[_0x4122('0x10')];this[_0x4122('0x11')]=_0x4ede0c[_0x4122('0x11')];this[_0x4122('0x12')]=_0x4ede0c['outboundUnknownCallsDay'];this[_0x4122('0x14')]=_0x4ede0c['sumBillable'];this[_0x4122('0x15')]=_0x4ede0c[_0x4122('0x15')];this[_0x4122('0x16')]=_0x4ede0c['total'];if(this[_0x4122('0x25')]===_0x4122('0x56')){this['pTalking']=_0x4ede0c[_0x4122('0x13')];}};module[_0x4122('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x85d0=['callerid','prototype','loggedin','callers','length','SIP/','status','booked','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','exports','ringing','talking','waiting','available','answered','inUse','loggedInDb','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','unavailable','unknown','unmanaged','type','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk'];(function(_0x45e5f1,_0x5ac3ee){var _0x448018=function(_0x115b44){while(--_0x115b44){_0x45e5f1['push'](_0x45e5f1['shift']());}};_0x448018(++_0x5ac3ee);}(_0x85d0,0x164));var _0x085d=function(_0x419477,_0xc6491f){_0x419477=_0x419477-0x0;var _0x363f44=_0x85d0[_0x419477];return _0x363f44;};'use strict';var INBOUND_COUNTERS=['available','loggedIn','loggedInDb','paused',_0x085d('0x0'),_0x085d('0x1'),_0x085d('0x2')];var OUTBOUND_COUNTERS=[_0x085d('0x3'),_0x085d('0x4'),_0x085d('0x5'),'loggedIn',_0x085d('0x6'),'originated',_0x085d('0x7'),_0x085d('0x8'),_0x085d('0x9'),'outboundBusyCallsDay',_0x085d('0xa'),_0x085d('0xb'),_0x085d('0xc'),_0x085d('0xd'),_0x085d('0xe'),_0x085d('0xf'),_0x085d('0x10'),_0x085d('0x11'),_0x085d('0x1'),'sumBillable',_0x085d('0x12'),_0x085d('0x13'),_0x085d('0x2')];function VoiceQueueSummary(_0x1e043a){this['id']=_0x1e043a['id'];this['name']=_0x1e043a[_0x085d('0x14')];this[_0x085d('0x15')]=_0x1e043a['strategy'];this[_0x085d('0x16')]=_0x1e043a[_0x085d('0x16')]||0x0;this[_0x085d('0x4')]=_0x1e043a[_0x085d('0x4')]||0x0;this['available']=_0x1e043a[_0x085d('0x3')]||0x0;this[_0x085d('0x17')]=_0x1e043a['busy']||0x0;this['inUse']=_0x1e043a[_0x085d('0x5')]||0x0;this[_0x085d('0x18')]=_0x1e043a[_0x085d('0x18')]||0x0;this[_0x085d('0x19')]=_0x1e043a[_0x085d('0x19')]||0x0;this['loggedInDb']=_0x1e043a[_0x085d('0x6')]||0x0;this[_0x085d('0x1a')]=_0x1e043a[_0x085d('0x1a')]||0x0;this[_0x085d('0x1b')]=_0x1e043a[_0x085d('0x1b')]||0x0;this[_0x085d('0x10')]=_0x1e043a[_0x085d('0x10')]||0x0;this[_0x085d('0x0')]=_0x1e043a[_0x085d('0x0')]||0x0;this['ringInUse']=_0x1e043a[_0x085d('0x1c')];this[_0x085d('0x1d')]=_0x1e043a[_0x085d('0x1d')];this[_0x085d('0x12')]=_0x1e043a[_0x085d('0x12')];this['sumHoldTime']=_0x1e043a[_0x085d('0x1e')]||0x0;this[_0x085d('0x1')]=_0x1e043a[_0x085d('0x1')]||0x0;this[_0x085d('0x13')]=_0x1e043a['total']||0x0;this['type']=_0x1e043a['type'];this[_0x085d('0x1f')]=_0x1e043a[_0x085d('0x1f')]||0x0;this[_0x085d('0x20')]=_0x1e043a[_0x085d('0x20')]||0x0;this[_0x085d('0x21')]=_0x1e043a[_0x085d('0x21')]||0x0;this['waiting']=_0x1e043a[_0x085d('0x2')]||0x0;if(_0x1e043a[_0x085d('0x22')]===_0x085d('0x23')){this['pTalking']=_0x1e043a[_0x085d('0x11')]||0x0;this[_0x085d('0x24')]=_0x1e043a[_0x085d('0x24')];this[_0x085d('0x25')]=_0x1e043a[_0x085d('0x25')];this['dialOriginateCallerIdName']=_0x1e043a['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x1e043a[_0x085d('0x26')];this[_0x085d('0x27')]=_0x1e043a[_0x085d('0x27')];this['dialPrefix']=_0x1e043a[_0x085d('0x28')];this[_0x085d('0x29')]=_0x1e043a[_0x085d('0x29')];this['outboundAnswerAgiCallsDay']=_0x1e043a[_0x085d('0x2a')];this[_0x085d('0x8')]=_0x1e043a[_0x085d('0x8')];this[_0x085d('0x9')]=_0x1e043a['outboundBlacklistCallsDay'];this[_0x085d('0x2b')]=_0x1e043a[_0x085d('0x2b')];this['outboundCongestionCallsDay']=_0x1e043a[_0x085d('0xa')];this[_0x085d('0x2c')]=_0x1e043a['outboundDropCallsDayACS'];this[_0x085d('0x2d')]=_0x1e043a[_0x085d('0x2d')];this[_0x085d('0x2e')]=_0x1e043a['outboundDropCallsDayTimeout'];this[_0x085d('0xb')]=_0x1e043a[_0x085d('0xb')];this[_0x085d('0xc')]=_0x1e043a['outboundNoSuchCallsDay'];this[_0x085d('0x2f')]=_0x1e043a['outboundOriginateFailureCallsDay'];this[_0x085d('0xd')]=_0x1e043a[_0x085d('0xd')];this[_0x085d('0xe')]=_0x1e043a[_0x085d('0xe')];this['outboundUnknownCallsDay']=_0x1e043a[_0x085d('0xf')];this[_0x085d('0x30')]=_0x1e043a[_0x085d('0x30')];this[_0x085d('0x31')]=_0x1e043a['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x1e043a[_0x085d('0x32')];this[_0x085d('0x33')]=_0x1e043a[_0x085d('0x33')];this[_0x085d('0x34')]=_0x1e043a[_0x085d('0x34')];this[_0x085d('0x35')]=_0x1e043a[_0x085d('0x35')];this[_0x085d('0x36')]=_0x1e043a[_0x085d('0x36')];this['predictiveIntervalHitRate']=_0x1e043a[_0x085d('0x37')];this[_0x085d('0x38')]=_0x1e043a['predictiveIntervalMultiplicativeFactor'];this[_0x085d('0x39')]=_0x1e043a['predictiveIntervalPauses'];this[_0x085d('0x3a')]=_0x1e043a[_0x085d('0x3a')];this['predictiveIntervalTotalCalls']=_0x1e043a[_0x085d('0x3b')];this[_0x085d('0x3c')]=_0x1e043a[_0x085d('0x3c')];this[_0x085d('0x3d')]=_0x1e043a[_0x085d('0x3d')];this['erlangCallToSecond']=_0x1e043a[_0x085d('0x3e')];this['erlangAbandonmentRate']=_0x1e043a['erlangAbandonmentRate'];this[_0x085d('0x3f')]=_0x1e043a[_0x085d('0x3f')];this[_0x085d('0x40')]=_0x1e043a[_0x085d('0x40')];this[_0x085d('0x41')]=_0x1e043a['startProgressive'];this[_0x085d('0x42')]=_0x1e043a['message'];this[_0x085d('0x43')]=_0x1e043a[_0x085d('0x43')];}if(_0x1e043a[_0x085d('0x44')]){this['Trunk']={'id':_0x1e043a[_0x085d('0x44')]['id'],'name':_0x1e043a['Trunk'][_0x085d('0x14')],'active':_0x1e043a[_0x085d('0x44')]['active'],'callerid':_0x1e043a[_0x085d('0x44')][_0x085d('0x45')]};}}VoiceQueueSummary[_0x085d('0x46')]['createReport']=function(_0x56428e,_0x25e8cb,_0x1f1e1f,_0x360d25){this[_0x085d('0x6')]=0x0;this[_0x085d('0x1')]=0x0;this[_0x085d('0x10')]=0x0;this[_0x085d('0x20')]=0x0;this[_0x085d('0x1b')]=0x0;this[_0x085d('0x5')]=0x0;this[_0x085d('0x17')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this[_0x085d('0x0')]=0x0;this[_0x085d('0x1c')]=0x0;this[_0x085d('0x1a')]=0x0;if(_0x1f1e1f){if(_0x1f1e1f[_0x085d('0x3')]){this[_0x085d('0x3')]=Number(_0x1f1e1f[_0x085d('0x3')]);}if(_0x1f1e1f[_0x085d('0x47')]){this[_0x085d('0x19')]=Number(_0x1f1e1f[_0x085d('0x47')]);}if(_0x1f1e1f[_0x085d('0x48')]){this[_0x085d('0x2')]=Number(_0x1f1e1f['callers']);}}for(var _0xa17a89=0x0;_0xa17a89<_0x56428e[_0x085d('0x49')];_0xa17a89++){var _0x1df88b=_0x25e8cb[_0x085d('0x4a')+_0x56428e[_0xa17a89][_0x085d('0x14')]];if(_0x1df88b&&_0x1df88b['online']){this[_0x085d('0x6')]+=0x1;}if(_0x56428e[_0xa17a89]['incall']==='1'){this[_0x085d('0x1')]+=0x1;}if(_0x56428e[_0xa17a89]['paused']==='1'&&!['2','7','8']['includes'](_0x56428e[_0xa17a89][_0x085d('0x4b')])){this[_0x085d('0x10')]+=0x1;}switch(_0x56428e[_0xa17a89][_0x085d('0x4b')]){case'0':this[_0x085d('0x20')]+=0x1;break;case'1':this[_0x085d('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x085d('0x1c')]+=0x1;break;case'8':this[_0x085d('0x1a')]+=0x1;break;}}if(this['dialMethod']===_0x085d('0x4c')){var _0x555ed8=Object['keys'](_0x360d25);for(var _0x415a4b=0x0;_0x415a4b<_0x555ed8[_0x085d('0x49')];_0x415a4b++){var _0x1da4b8=_0x555ed8[_0x415a4b];var _0x25dc19=_0x360d25[_0x1da4b8];if(_0x25dc19['queue']===this[_0x085d('0x14')]&&_0x25dc19['type']===_0x085d('0x4d')&&_0x25dc19[_0x085d('0x4e')]==='xcally-motion-preview'){this[_0x085d('0x1')]+=0x1;}}if(this[_0x085d('0x1')]>this[_0x085d('0x5')]){this[_0x085d('0x1')]=this['inUse'];}this[_0x085d('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x085d('0x4f')]=function(_0x5431a5){var _0x5516bb=![];if(_0x5431a5){_0x5516bb=INBOUND_COUNTERS[_0x085d('0x50')](function(_0x41e3e0){return this[_0x41e3e0]!==_0x5431a5[_0x41e3e0];},this);}return _0x5516bb;};VoiceQueueSummary[_0x085d('0x46')][_0x085d('0x51')]=function(_0x1572bb){var _0xa820b0=![];var _0x1c3081=![];var _0x1bac21=![];if(_0x1572bb){_0xa820b0=this['dialMethod']!==_0x1572bb['dialMethod']||this['dialActive']!==_0x1572bb[_0x085d('0x24')]||this['message']!==_0x1572bb[_0x085d('0x42')]||this['statusMessage']!==_0x1572bb[_0x085d('0x43')];_0x1c3081=OUTBOUND_COUNTERS[_0x085d('0x50')](function(_0x2e85e2){return this[_0x2e85e2]!==_0x1572bb[_0x2e85e2];},this);if(this[_0x085d('0x44')]&&_0x1572bb['Trunk']){_0x1bac21=this['Trunk'][_0x085d('0x14')]!==_0x1572bb[_0x085d('0x44')]['name']||this[_0x085d('0x44')][_0x085d('0x52')]!==_0x1572bb[_0x085d('0x44')][_0x085d('0x52')];}}return _0xa820b0||_0x1c3081||_0x1bac21;};VoiceQueueSummary[_0x085d('0x46')][_0x085d('0x53')]=function(_0x2a2eb4){this[_0x085d('0x4')]=_0x2a2eb4['answered'];this[_0x085d('0x42')]=_0x2a2eb4['message'];this[_0x085d('0x43')]=_0x2a2eb4['statusMessage'];this[_0x085d('0x3c')]=_0x2a2eb4['originated'];this[_0x085d('0x7')]=_0x2a2eb4[_0x085d('0x7')];this['outboundAnswerCallsDay']=_0x2a2eb4['outboundAnswerCallsDay'];this[_0x085d('0x9')]=_0x2a2eb4[_0x085d('0x9')];this[_0x085d('0x2b')]=_0x2a2eb4[_0x085d('0x2b')];this[_0x085d('0xa')]=_0x2a2eb4[_0x085d('0xa')];this[_0x085d('0xb')]=_0x2a2eb4[_0x085d('0xb')];this[_0x085d('0xc')]=_0x2a2eb4[_0x085d('0xc')];this[_0x085d('0xd')]=_0x2a2eb4[_0x085d('0xd')];this[_0x085d('0xe')]=_0x2a2eb4[_0x085d('0xe')];this['outboundUnknownCallsDay']=_0x2a2eb4['outboundUnknownCallsDay'];this[_0x085d('0x1d')]=_0x2a2eb4[_0x085d('0x1d')];this['sumDuration']=_0x2a2eb4['sumDuration'];this['total']=_0x2a2eb4[_0x085d('0x13')];if(this[_0x085d('0x25')]==='preview'){this[_0x085d('0x11')]=_0x2a2eb4[_0x085d('0x11')];}};module[_0x085d('0x54')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5eefe8c..540ccd8 100644 --- a/server/services/ami/model/vtigerAccount.js +++ b/server/services/ami/model/vtigerAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40a9=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x40a9,0x98));var _0x940a=function(_0x1d656e,_0x345062){_0x1d656e=_0x1d656e-0x0;var _0x4eee26=_0x40a9[_0x1d656e];return _0x4eee26;};'use strict';function VtigerAccount(_0x1618bd){this['id']=_0x1618bd['id']||0x0;this[_0x940a('0x0')]=_0x1618bd[_0x940a('0x0')]||'';this[_0x940a('0x1')]=_0x1618bd[_0x940a('0x1')]||'';this[_0x940a('0x2')]=_0x1618bd[_0x940a('0x2')]||'';this[_0x940a('0x3')]=_0x1618bd[_0x940a('0x3')]||'';this['serverUrl']=_0x1618bd[_0x940a('0x4')]||'';this[_0x940a('0x5')]=_0x1618bd[_0x940a('0x5')]||{};}module[_0x940a('0x6')]=VtigerAccount; \ No newline at end of file +var _0xec64=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x4f63fe,_0xc1efaf){var _0x2c7706=function(_0x596314){while(--_0x596314){_0x4f63fe['push'](_0x4f63fe['shift']());}};_0x2c7706(++_0xc1efaf);}(_0xec64,0x150));var _0x4ec6=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xec64[_0x1ee351];return _0x245aaf;};'use strict';function VtigerAccount(_0x93ec46){this['id']=_0x93ec46['id']||0x0;this['name']=_0x93ec46[_0x4ec6('0x0')]||'';this[_0x4ec6('0x1')]=_0x93ec46[_0x4ec6('0x1')]||'';this['accessKey']=_0x93ec46['accessKey']||'';this[_0x4ec6('0x2')]=_0x93ec46[_0x4ec6('0x2')]||'';this['serverUrl']=_0x93ec46[_0x4ec6('0x3')]||'';this[_0x4ec6('0x4')]=_0x93ec46['Configurations']||{};}module[_0x4ec6('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e57a8db..4205f40 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x147e=['password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name','username'];(function(_0x534d06,_0x2ad1ed){var _0x364256=function(_0x5caf23){while(--_0x5caf23){_0x534d06['push'](_0x534d06['shift']());}};_0x364256(++_0x2ad1ed);}(_0x147e,0x1f2));var _0xe147=function(_0x2c3337,_0x379fe4){_0x2c3337=_0x2c3337-0x0;var _0x520450=_0x147e[_0x2c3337];return _0x520450;};'use strict';function ZendeskAccount(_0x4ca587){this['id']=_0x4ca587['id']||0x0;this[_0xe147('0x0')]=_0x4ca587['name']||'';this[_0xe147('0x1')]=_0x4ca587[_0xe147('0x1')]||'';this[_0xe147('0x2')]=_0x4ca587[_0xe147('0x2')]||'';this[_0xe147('0x3')]=_0x4ca587['token']||'';this[_0xe147('0x4')]=_0x4ca587[_0xe147('0x4')]||'';this['authType']=_0x4ca587[_0xe147('0x5')]||'';this[_0xe147('0x6')]=_0x4ca587[_0xe147('0x6')]||'integrationTab';this[_0xe147('0x7')]=_0x4ca587[_0xe147('0x7')]||'';this['Configurations']=_0x4ca587[_0xe147('0x8')]||{};}module[_0xe147('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xc845=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc845,0x7f));var _0x5c84=function(_0x315d82,_0x15ebf8){_0x315d82=_0x315d82-0x0;var _0x20fca3=_0xc845[_0x315d82];return _0x20fca3;};'use strict';function ZendeskAccount(_0x49ca57){this['id']=_0x49ca57['id']||0x0;this['name']=_0x49ca57[_0x5c84('0x0')]||'';this[_0x5c84('0x1')]=_0x49ca57[_0x5c84('0x1')]||'';this[_0x5c84('0x2')]=_0x49ca57[_0x5c84('0x2')]||'';this[_0x5c84('0x3')]=_0x49ca57[_0x5c84('0x3')]||'';this[_0x5c84('0x4')]=_0x49ca57[_0x5c84('0x4')]||'';this[_0x5c84('0x5')]=_0x49ca57[_0x5c84('0x5')]||'';this[_0x5c84('0x6')]=_0x49ca57[_0x5c84('0x6')]||_0x5c84('0x7');this[_0x5c84('0x8')]=_0x49ca57[_0x5c84('0x8')]||'';this[_0x5c84('0x9')]=_0x49ca57[_0x5c84('0x9')]||{};}module[_0x5c84('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c0c99a6..df5c0d4 100644 --- a/server/services/ami/model/zohoAccount.js +++ b/server/services/ami/model/zohoAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a17=['code','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x2426eb,_0x20eff2){var _0x1569ee=function(_0x9e3c5f){while(--_0x9e3c5f){_0x2426eb['push'](_0x2426eb['shift']());}};_0x1569ee(++_0x20eff2);}(_0x6a17,0x7b));var _0x76a1=function(_0x405ee5,_0x377abf){_0x405ee5=_0x405ee5-0x0;var _0x320bd2=_0x6a17[_0x405ee5];return _0x320bd2;};'use strict';function ZohoAccount(_0x53dab3){this['id']=_0x53dab3['id']||0x0;this[_0x76a1('0x0')]=_0x53dab3[_0x76a1('0x0')]||'';this[_0x76a1('0x1')]=_0x53dab3['description']||'';this[_0x76a1('0x2')]=_0x53dab3[_0x76a1('0x2')]||'';this[_0x76a1('0x3')]=_0x53dab3['zone']||'';this['clientId']=_0x53dab3[_0x76a1('0x4')]||'';this[_0x76a1('0x5')]=_0x53dab3[_0x76a1('0x5')]||'';this[_0x76a1('0x6')]=_0x53dab3['serverUrl']||'';this[_0x76a1('0x7')]=_0x53dab3['code']||'';this['refreshToken']=_0x53dab3['refreshToken']||'';this[_0x76a1('0x8')]=_0x53dab3['Configurations']||{};}module[_0x76a1('0x9')]=ZohoAccount; \ No newline at end of file +var _0x972c=['zone','clientId','clientSecret','serverUrl','refreshToken','Configurations','exports','name','description','host'];(function(_0x26090d,_0x85909b){var _0x147bbc=function(_0x4efc5a){while(--_0x4efc5a){_0x26090d['push'](_0x26090d['shift']());}};_0x147bbc(++_0x85909b);}(_0x972c,0xe3));var _0xc972=function(_0x54ba16,_0x1bfbf2){_0x54ba16=_0x54ba16-0x0;var _0x1dc66b=_0x972c[_0x54ba16];return _0x1dc66b;};'use strict';function ZohoAccount(_0x44f848){this['id']=_0x44f848['id']||0x0;this[_0xc972('0x0')]=_0x44f848[_0xc972('0x0')]||'';this[_0xc972('0x1')]=_0x44f848['description']||'';this[_0xc972('0x2')]=_0x44f848['host']||'';this[_0xc972('0x3')]=_0x44f848[_0xc972('0x3')]||'';this[_0xc972('0x4')]=_0x44f848[_0xc972('0x4')]||'';this[_0xc972('0x5')]=_0x44f848[_0xc972('0x5')]||'';this[_0xc972('0x6')]=_0x44f848[_0xc972('0x6')]||'';this['code']=_0x44f848['code']||'';this[_0xc972('0x7')]=_0x44f848['refreshToken']||'';this[_0xc972('0x8')]=_0x44f848[_0xc972('0x8')]||{};}module[_0xc972('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index af9915c..18f42e7 100644 --- a/server/services/ami/preview/action.js +++ b/server/services/ami/preview/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abf=['callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','moment','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','Agent','channelAgent','membername','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback'];(function(_0x1e2252,_0x2c0021){var _0x2fa4db=function(_0x1ca079){while(--_0x1ca079){_0x1e2252['push'](_0x1e2252['shift']());}};_0x2fa4db(++_0x2c0021);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0xf0ab('0x0'));var _=require('lodash');var moment=require(_0xf0ab('0x1'));function checkNameSurname(_0x27c8c9,_0x528ef7,_0x598001){var _0x313b14='';if(!_['isNil'](_0x528ef7)&&_0xf0ab('0x2')===typeof _0x528ef7){_0x313b14+=_0x528ef7;}if(!_[_0xf0ab('0x3')](_0x598001)&&_0xf0ab('0x2')===typeof _0x598001){_0x313b14+='\x20'+_0x598001;}if(_0x313b14!==''){return _0x313b14;}return _0x27c8c9;}function Action(_0xbb1f91,_0x2ab7d6,_0x4d2ea8,_0x233afe,_0x57ff3b){this[_0xf0ab('0x4')]=_0x4d2ea8||undefined;this[_0xf0ab('0x5')]=_0xbb1f91['id'];this[_0xf0ab('0x6')]=_0x2ab7d6[_0xf0ab('0x7')];this['type']=_0x2ab7d6[_0xf0ab('0x8')];this[_0xf0ab('0x9')]=_0xf0ab('0x6');this['dialAnswer']=![];this['membername']=_[_0xf0ab('0x3')](_0xbb1f91['Agent'])?undefined:_0xbb1f91[_0xf0ab('0xa')][_0xf0ab('0x7')];this[_0xf0ab('0xb')]=this[_0xf0ab('0xc')]?util[_0xf0ab('0xd')](_0xf0ab('0xe'),this[_0xf0ab('0xc')]):_0x233afe||undefined;this['calleridname']=checkNameSurname(_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x10')],_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x11')],_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x12')]);this[_0xf0ab('0x13')]=_0xbb1f91[_0xf0ab('0x13')]||![];this[_0xf0ab('0x14')]=_0xbb1f91[_0xf0ab('0x10')];this[_0xf0ab('0x15')]=_0xbb1f91[_0xf0ab('0x15')];this[_0xf0ab('0x16')]=_0xbb1f91[_0xf0ab('0x16')]||0x0;this[_0xf0ab('0x17')]=_0xbb1f91['countcongestionretry']||0x0;this[_0xf0ab('0x18')]=_0xbb1f91[_0xf0ab('0x18')]||0x0;this[_0xf0ab('0x19')]=(_0xbb1f91[_0xf0ab('0x16')]||0x0)+(_0xbb1f91[_0xf0ab('0x17')]||0x0)+(_0xbb1f91[_0xf0ab('0x18')]||0x0)+(_0xbb1f91[_0xf0ab('0x1a')]||0x0)+(_0xbb1f91[_0xf0ab('0x1b')]||0x0)+(_0xbb1f91[_0xf0ab('0x1c')]||0x0)+(_0xbb1f91[_0xf0ab('0x1d')]||0x0)+(_0xbb1f91[_0xf0ab('0x1e')]||0x0);this[_0xf0ab('0x1a')]=_0xbb1f91[_0xf0ab('0x1a')]||0x0;this[_0xf0ab('0x1b')]=_0xbb1f91[_0xf0ab('0x1b')]||0x0;this[_0xf0ab('0x1c')]=_0xbb1f91['countabandonedretry']||0x0;this[_0xf0ab('0x1d')]=_0xbb1f91[_0xf0ab('0x1d')]||0x0;this[_0xf0ab('0x1e')]=_0xbb1f91[_0xf0ab('0x1e')]||0x0;this[_0xf0ab('0x1f')]=_0xbb1f91[_0xf0ab('0x1f')];this[_0xf0ab('0x20')]=_0xbb1f91[_0xf0ab('0x20')];this[_0xf0ab('0x21')]=_0xbb1f91[_0xf0ab('0x21')];this[_0xf0ab('0x22')]=_0xbb1f91['recallme'];this['ContactId']=_0xbb1f91['ContactId'];this[_0xf0ab('0x23')]=_0xbb1f91['ListId'];this[_0xf0ab('0x24')]=_[_0xf0ab('0x3')](_0xbb1f91['Agent'])?_0xbb1f91[_0xf0ab('0x24')]:_0xbb1f91[_0xf0ab('0xa')]['id'];this[_0xf0ab('0x25')]=_0xbb1f91[_0xf0ab('0x25')];this[_0xf0ab('0x26')]='';this['originatecalleridname']='';}Action[_0xf0ab('0x27')]['getCaller']=function(){return util['format'](_0xf0ab('0x28'),this[_0xf0ab('0x29')],this[_0xf0ab('0x2a')]);};module[_0xf0ab('0x2b')]=Action; \ No newline at end of file +var _0x36ee=['callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','exports','moment','isNil','string','idContact','name','type','queue','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe36e('0x0'));function checkNameSurname(_0x521ff3,_0xf6b517,_0x4018bf){var _0x36c9f6='';if(!_[_0xe36e('0x1')](_0xf6b517)&&_0xe36e('0x2')===typeof _0xf6b517){_0x36c9f6+=_0xf6b517;}if(!_[_0xe36e('0x1')](_0x4018bf)&&_0xe36e('0x2')===typeof _0x4018bf){_0x36c9f6+='\x20'+_0x4018bf;}if(_0x36c9f6!==''){return _0x36c9f6;}return _0x521ff3;}function Action(_0x3f29e1,_0x25a07d,_0x190404,_0x21be0b,_0x1aa596){this['uniqueid']=_0x190404||undefined;this[_0xe36e('0x3')]=_0x3f29e1['id'];this['queue']=_0x25a07d[_0xe36e('0x4')];this[_0xe36e('0x5')]=_0x25a07d[_0xe36e('0x5')];this['campaigntype']=_0xe36e('0x6');this['dialAnswer']=![];this[_0xe36e('0x7')]=_[_0xe36e('0x1')](_0x3f29e1[_0xe36e('0x8')])?undefined:_0x3f29e1[_0xe36e('0x8')][_0xe36e('0x4')];this[_0xe36e('0x9')]=this[_0xe36e('0x7')]?util[_0xe36e('0xa')]('SIP/%s',this[_0xe36e('0x7')]):_0x21be0b||undefined;this[_0xe36e('0xb')]=checkNameSurname(_0x3f29e1[_0xe36e('0xc')][_0xe36e('0xd')],_0x3f29e1['Contact'][_0xe36e('0xe')],_0x3f29e1['Contact']['lastName']);this[_0xe36e('0xf')]=_0x3f29e1[_0xe36e('0xf')]||![];this[_0xe36e('0x10')]=_0x3f29e1[_0xe36e('0xd')];this[_0xe36e('0x11')]=_0x3f29e1[_0xe36e('0x11')];this[_0xe36e('0x12')]=_0x3f29e1[_0xe36e('0x12')]||0x0;this[_0xe36e('0x13')]=_0x3f29e1[_0xe36e('0x13')]||0x0;this['countnoanswerretry']=_0x3f29e1[_0xe36e('0x14')]||0x0;this[_0xe36e('0x15')]=(_0x3f29e1['countbusyretry']||0x0)+(_0x3f29e1[_0xe36e('0x13')]||0x0)+(_0x3f29e1['countnoanswerretry']||0x0)+(_0x3f29e1[_0xe36e('0x16')]||0x0)+(_0x3f29e1[_0xe36e('0x17')]||0x0)+(_0x3f29e1['countabandonedretry']||0x0)+(_0x3f29e1[_0xe36e('0x18')]||0x0)+(_0x3f29e1[_0xe36e('0x19')]||0x0);this[_0xe36e('0x16')]=_0x3f29e1['countnosuchnumberretry']||0x0;this[_0xe36e('0x17')]=_0x3f29e1[_0xe36e('0x17')]||0x0;this[_0xe36e('0x1a')]=_0x3f29e1[_0xe36e('0x1a')]||0x0;this[_0xe36e('0x18')]=_0x3f29e1[_0xe36e('0x18')]||0x0;this['countagentrejectretry']=_0x3f29e1[_0xe36e('0x19')]||0x0;this[_0xe36e('0x1b')]=_0x3f29e1[_0xe36e('0x1b')];this[_0xe36e('0x1c')]=_0x3f29e1[_0xe36e('0x1c')];this['callbackat']=_0x3f29e1['callbackat'];this[_0xe36e('0x1d')]=_0x3f29e1[_0xe36e('0x1d')];this[_0xe36e('0x1e')]=_0x3f29e1[_0xe36e('0x1e')];this[_0xe36e('0x1f')]=_0x3f29e1[_0xe36e('0x1f')];this[_0xe36e('0x20')]=_['isNil'](_0x3f29e1[_0xe36e('0x8')])?_0x3f29e1[_0xe36e('0x20')]:_0x3f29e1[_0xe36e('0x8')]['id'];this[_0xe36e('0x21')]=_0x3f29e1['VoiceQueueId'];this[_0xe36e('0x22')]='';this['originatecalleridname']='';}Action[_0xe36e('0x23')]['getCaller']=function(){return util[_0xe36e('0xa')]('\x22%s\x22\x20<%s>',this[_0xe36e('0xb')],this['number']);};module[_0xe36e('0x24')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3ef0a20..b297e14 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x558190,_0x243357){var _0x4cce59=function(_0x1b31e0){while(--_0x1b31e0){_0x558190['push'](_0x558190['shift']());}};_0x4cce59(++_0x243357);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x5147c3,_0x2f2875){var _0x3383c1=function(_0x5488f6){while(--_0x5488f6){_0x5147c3['push'](_0x5147c3['shift']());}};_0x3383c1(++_0x2f2875);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 086f805..c9d8b30 100644 --- a/server/services/ami/preview/rpcDb.js +++ b/server/services/ami/preview/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d66=['answertime','queuecallercompleteAt','endtime','connectedlinename','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','catch','resolve','then','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x9d66,0x133));var _0x69d6=function(_0x4fa3b2,_0x55dd32){_0x4fa3b2=_0x4fa3b2-0x0;var _0xc56ca6=_0x9d66[_0x4fa3b2];return _0xc56ca6;};'use strict';var util=require(_0x69d6('0x0'));var BPromise=require('bluebird');var logger=require(_0x69d6('0x1'))('preview');var cmHopper=require(_0x69d6('0x2'));var cmHopperHistory=require(_0x69d6('0x3'));var cmHopperBlack=require(_0x69d6('0x4'));var agentReportPreview=require(_0x69d6('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x17b73a){return function(_0x1673de){logger[_0x69d6('0x6')](_0x17b73a,util[_0x69d6('0x7')](_0x1673de,{'showHidden':![],'depth':null}));};}function create(_0x1c71b0){return cmHopperHistory[_0x69d6('0x8')](_0x1c71b0)[_0x69d6('0x9')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x7662b9){return BPromise[_0x69d6('0xa')]()[_0x69d6('0xb')](agentReportPreview[_0x69d6('0x8')](_0x7662b9))[_0x69d6('0x9')](loggerCatch(_0x69d6('0xc')));}function moveContact(_0xdc6a20){return cmHopper[_0x69d6('0xd')](_0xdc6a20,!![])['catch'](loggerCatch(_0x69d6('0xe')));}exports['checkIsBlackList']=function(_0x53e062){return cmHopperBlack[_0x69d6('0xf')](_0x53e062)[_0x69d6('0x9')](loggerCatch(_0x69d6('0x10')));};exports[_0x69d6('0x11')]=function(_0x313123){return BPromise[_0x69d6('0xa')]()[_0x69d6('0xb')](cmHopper[_0x69d6('0x11')](_0x313123))[_0x69d6('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x69d6('0x8')]=function(_0x11cbc5,_0x1915d8){create(_0x11cbc5)[_0x69d6('0x9')](loggerCatch(_0x1915d8));moveContact(_0x11cbc5)[_0x69d6('0x9')](loggerCatch(_0x1915d8));};exports[_0x69d6('0x12')]=function(_0x1d5f48,_0x2f2df7){createAgent(_0x1d5f48)[_0x69d6('0x9')](loggerCatch(_0x2f2df7));};exports['createCustomerHistory']=function(_0x5309cf,_0x2fc214){create(_0x5309cf)[_0x69d6('0x9')](loggerCatch(_0x2fc214));};exports['createCustomerFinal']=function(_0x69cd65,_0x1d4e07){moveContact(_0x69cd65)['catch'](loggerCatch(_0x1d4e07));};exports[_0x69d6('0x13')]=function(_0x115378,_0x59002e,_0x1f0ffe){if(_0x59002e){_0x115378[_0x69d6('0x14')]=null;}if(_0x1f0ffe){_0x115378[_0x69d6('0x15')]=![];}return cmHopper['rescheduleContact'](_0x115378)[_0x69d6('0x9')](loggerCatch(_0x69d6('0x16')));};exports[_0x69d6('0x17')]=function(_0x2136a5){return cmHopper['countReScheduled'](_0x2136a5)['catch'](loggerCatch(_0x69d6('0x18')));};exports['unlockContact']=function(_0x2d4c09){return cmHopper[_0x69d6('0x19')]({'UserId':null},_0x2d4c09,0x1)[_0x69d6('0x9')](loggerCatch(_0x69d6('0x1a')));};exports['disableContact']=function(_0x3dff77){return cmHopper[_0x69d6('0x19')]({'active':![]},_0x3dff77,0x1)[_0x69d6('0x9')](loggerCatch(_0x69d6('0x1b')));};exports[_0x69d6('0x1c')]=function(_0x38d78f){var _0x111caa={};_0x111caa[_0x69d6('0x1d')]=_0x38d78f[_0x69d6('0x1d')];_0x111caa[_0x69d6('0x1e')]=_0x38d78f[_0x69d6('0x1e')];_0x111caa[_0x69d6('0x1f')]=_0x38d78f['calleridnum'];_0x111caa[_0x69d6('0x20')]=_0x38d78f[_0x69d6('0x20')];_0x111caa[_0x69d6('0x21')]=_0x38d78f[_0x69d6('0x21')];_0x111caa[_0x69d6('0x22')]=_0x38d78f['answertime'];_0x111caa[_0x69d6('0x23')]=_0x38d78f[_0x69d6('0x24')];_0x111caa['queuecallercomplete']=0x1;_0x111caa[_0x69d6('0x25')]=_0x38d78f[_0x69d6('0x26')];_0x111caa[_0x69d6('0x27')]=_0x38d78f['membername'];_0x111caa['context']='from-sip';_0x111caa[_0x69d6('0x28')]=_0x69d6('0x29');_0x111caa[_0x69d6('0x2a')]=0x0;_0x111caa[_0x69d6('0x2b')]=0x1;_0x111caa[_0x69d6('0x2c')]=_0x38d78f[_0x69d6('0x2d')];_0x111caa['queuecallerexitreason']='COMPLETED';return BPromise['resolve']()[_0x69d6('0xb')](voiceQueueReport['create'](_0x111caa))[_0x69d6('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x69d6('0x2e')]=function(_0x31c8f2,_0x3d56b1){return BPromise[_0x69d6('0xa')]()[_0x69d6('0xb')](cmHopper[_0x69d6('0x2e')](_0x31c8f2,_0x3d56b1))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x69d6('0x2f')]=function(_0x233dcf){return cmHopper[_0x69d6('0x13')](_0x233dcf,!![],!![])[_0x69d6('0x9')](loggerCatch(_0x69d6('0x30')));}; \ No newline at end of file +var _0x6781=['createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','preview','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','[createHistory]\x20','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','then'];(function(_0x59aac9,_0x5d9a2c){var _0x2f6639=function(_0x135c09){while(--_0x135c09){_0x59aac9['push'](_0x59aac9['shift']());}};_0x2f6639(++_0x5d9a2c);}(_0x6781,0xe7));var _0x1678=function(_0x2d1cb3,_0x53c0b0){_0x2d1cb3=_0x2d1cb3-0x0;var _0x31c8a6=_0x6781[_0x2d1cb3];return _0x31c8a6;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x1678('0x0'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x1678('0x1'));var agentReportPreview=require(_0x1678('0x2'));var voiceQueueReport=require(_0x1678('0x3'));function loggerCatch(_0x5591b8){return function(_0x4f8258){logger['error'](_0x5591b8,util[_0x1678('0x4')](_0x4f8258,{'showHidden':![],'depth':null}));};}function create(_0x2c1095){return cmHopperHistory[_0x1678('0x5')](_0x2c1095)['catch'](loggerCatch(_0x1678('0x6')));}function createAgent(_0x41436e){return BPromise['resolve']()['then'](agentReportPreview[_0x1678('0x5')](_0x41436e))[_0x1678('0x7')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3a4469){return cmHopper['moveContactManagedDialer'](_0x3a4469,!![])[_0x1678('0x7')](loggerCatch(_0x1678('0x8')));}exports[_0x1678('0x9')]=function(_0x224bd5){return cmHopperBlack[_0x1678('0x9')](_0x224bd5)[_0x1678('0x7')](loggerCatch(_0x1678('0xa')));};exports[_0x1678('0xb')]=function(_0x19875e){return BPromise[_0x1678('0xc')]()[_0x1678('0xd')](cmHopper[_0x1678('0xb')](_0x19875e))[_0x1678('0x7')](loggerCatch('[getContactPreview]\x20'));};exports[_0x1678('0x5')]=function(_0x4349e2,_0x4f546a){create(_0x4349e2)['catch'](loggerCatch(_0x4f546a));moveContact(_0x4349e2)[_0x1678('0x7')](loggerCatch(_0x4f546a));};exports[_0x1678('0xe')]=function(_0x15f1a6,_0x1f8134){createAgent(_0x15f1a6)['catch'](loggerCatch(_0x1f8134));};exports[_0x1678('0xf')]=function(_0x3b9125,_0x51aa92){create(_0x3b9125)[_0x1678('0x7')](loggerCatch(_0x51aa92));};exports[_0x1678('0x10')]=function(_0x10b9a5,_0x2bf2f3){moveContact(_0x10b9a5)[_0x1678('0x7')](loggerCatch(_0x2bf2f3));};exports[_0x1678('0x11')]=function(_0x2a54fe,_0x5071e4,_0x9f7841){if(_0x5071e4){_0x2a54fe[_0x1678('0x12')]=null;}if(_0x9f7841){_0x2a54fe[_0x1678('0x13')]=![];}return cmHopper['rescheduleContact'](_0x2a54fe)[_0x1678('0x7')](loggerCatch(_0x1678('0x14')));};exports['countReScheduled']=function(_0x3081d1){return cmHopper[_0x1678('0x15')](_0x3081d1)[_0x1678('0x7')](loggerCatch(_0x1678('0x16')));};exports[_0x1678('0x17')]=function(_0x2b444d){return cmHopper[_0x1678('0x17')]({'UserId':null},_0x2b444d,0x1)[_0x1678('0x7')](loggerCatch(_0x1678('0x18')));};exports[_0x1678('0x19')]=function(_0x41b268){return cmHopper['unlockContact']({'active':![]},_0x41b268,0x1)[_0x1678('0x7')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x45f8c9){var _0x379dd4={};_0x379dd4[_0x1678('0x1a')]=_0x45f8c9[_0x1678('0x1a')];_0x379dd4[_0x1678('0x1b')]=_0x45f8c9[_0x1678('0x1b')];_0x379dd4['calleridnum']=_0x45f8c9[_0x1678('0x1c')];_0x379dd4[_0x1678('0x1d')]=_0x45f8c9[_0x1678('0x1d')];_0x379dd4[_0x1678('0x1e')]=_0x45f8c9[_0x1678('0x1e')];_0x379dd4['queuecallerjoinAt']=_0x45f8c9[_0x1678('0x1f')];_0x379dd4[_0x1678('0x20')]=_0x45f8c9[_0x1678('0x1f')];_0x379dd4['queuecallercomplete']=0x1;_0x379dd4['queuecallercompleteAt']=_0x45f8c9[_0x1678('0x21')];_0x379dd4[_0x1678('0x22')]=_0x45f8c9[_0x1678('0x23')];_0x379dd4[_0x1678('0x24')]=_0x1678('0x25');_0x379dd4[_0x1678('0x26')]='xcally-motion-preview';_0x379dd4[_0x1678('0x27')]=0x0;_0x379dd4[_0x1678('0x28')]=0x1;_0x379dd4[_0x1678('0x29')]=_0x45f8c9[_0x1678('0x23')];_0x379dd4[_0x1678('0x2a')]=_0x1678('0x2b');return BPromise[_0x1678('0xc')]()[_0x1678('0xd')](voiceQueueReport[_0x1678('0x2c')](_0x379dd4))[_0x1678('0x7')](loggerCatch(_0x1678('0x2d')));};exports[_0x1678('0x2e')]=function(_0x94ef0b,_0x167e3d){return BPromise[_0x1678('0xc')]()[_0x1678('0xd')](cmHopper[_0x1678('0x2e')](_0x94ef0b,_0x167e3d))[_0x1678('0x7')](loggerCatch(_0x1678('0x2f')));};exports['rescheduleContactInQueue']=function(_0x22502c){return cmHopper['rescheduleContact'](_0x22502c,!![],!![])[_0x1678('0x7')](loggerCatch(_0x1678('0x30')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 181fccb..7b72b45 100644 --- a/server/services/ami/preview/util/util.js +++ b/server/services/ami/preview/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x433f=['xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','starttime','logAgent','responsetime','ringtime','getSeconds','membername','UserId','logCustomer','YYYY-MM-DD\x20HH:mm:ss','endtime','talktime','answertime','Failure','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','channelAgent','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','loggerError','logger2','info','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname'];(function(_0x58274b,_0x41522e){var _0x6d315=function(_0x5db81e){while(--_0x5db81e){_0x58274b['push'](_0x58274b['shift']());}};_0x6d315(++_0x41522e);}(_0x433f,0x68));var _0xf433=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x433f[_0xfae23b];return _0x200640;};'use strict';var util=require(_0xf433('0x0'));var _=require(_0xf433('0x1'));var moment=require(_0xf433('0x2'));var logger=require('../../../../config/logger')(_0xf433('0x3'));var ipAgi=process[_0xf433('0x4')][_0xf433('0x5')]||_0xf433('0x6');var utils=require(_0xf433('0x7'));exports[_0xf433('0x8')]=function(_0x17ada9){return function(_0x5aa9fc){logger[_0xf433('0x9')](_0x17ada9,util['inspect'](_0x5aa9fc,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2b982a,_0x46647e){logger['info'](_0x2b982a,util[_0xf433('0xa')](_0x46647e,{'showHidden':![],'depth':null}));};exports[_0xf433('0xb')]=function(_0x46fdc,_0x1b6deb){logger[_0xf433('0x9')](_0x46fdc,util['inspect'](_0x1b6deb,{'showHidden':![],'depth':null}));};exports[_0xf433('0xc')]=function(_0x52f14b){return function(_0x52d49e){logger[_0xf433('0xd')](_0x52f14b,util[_0xf433('0xa')](_0x52d49e,{'showHidden':![],'depth':null}));};};exports[_0xf433('0xe')]=function(_0x216f53,_0x4763ad,_0x3abc04){return{'message':_0x216f53,'unlock':_0x4763ad,'active':_0x3abc04};};exports['getCallerId']=function(_0x1a2f03,_0x2db6cf,_0x4c7aa8){if(!_[_0xf433('0xf')](_0x4c7aa8)&&_0xf433('0x10')===typeof _0x4c7aa8&&!_[_0xf433('0x11')](_0x4c7aa8)){if(!_[_0xf433('0xf')](_0x2db6cf)&&_0xf433('0x10')===typeof _0x2db6cf&&!_['isEmpty'](_0x2db6cf)){return util[_0xf433('0x12')](_0xf433('0x13'),_0x2db6cf,_0x4c7aa8);}return util[_0xf433('0x12')]('\x22%s\x22\x20<%s>',_0x4c7aa8,_0x4c7aa8);}if(!_[_0xf433('0xf')](_0x1a2f03)&&'string'===typeof _0x1a2f03&&!_[_0xf433('0x11')](_0x1a2f03)){return _0x1a2f03;}return _0xf433('0x14');};exports[_0xf433('0x15')]=function(_0x1bdd7d){if(_['isNil'](_0x1bdd7d)){return![];}return _0x1bdd7d;};exports[_0xf433('0x16')]=function(_0x40a2e9,_0x4b9f85,_0xdedf68,_0x75a2b5,_0x1bba8b,_0x325d3e){var _0x167ddc={'XMD-QUEUE':_0x4b9f85[_0xf433('0x17')]?_0x4b9f85[_0xf433('0x17')]['name']:'','XMD-CALLERID':_0x75a2b5,'XMD-CALLERID-PREVIEW':_0x325d3e?util['format'](_0xf433('0x13'),_0x325d3e[_0xf433('0x18')],_0x325d3e[_0xf433('0x19')]):_0x75a2b5,'XMD-DIALID':_0x1bba8b,'XMD-CONTACTID':_0x4b9f85[_0xf433('0x1a')],'XMD-CDRTYPE':_0xf433('0x1b'),'CALLERID(all)':_0x75a2b5,'XMD-VOICEQUEUEID':_0x4b9f85['VoiceQueueId'],'XMD-DIALCHANNEL':_0xdedf68,'XMD-DIALTIMEOUT':_0x40a2e9[_0xf433('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xf433('0x1d'),_0x40a2e9[_0xf433('0x1e')]?'g':'',_[_0xf433('0x11')](_0x40a2e9[_0xf433('0x1f')])?'':_0xf433('0x20')),'XMD-DIALURL':_0x40a2e9[_0xf433('0x21')]||'','XMD-AGI':_0x40a2e9[_0xf433('0x22')]?util['format'](_0xf433('0x23'),ipAgi,_0x40a2e9[_0xf433('0x22')]):_0xf433('0x24'),'XMD-AGIAFTER':_0x40a2e9['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x40a2e9[_0xf433('0x1e')]):_0xf433('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x325d3e?_0x325d3e[_0xf433('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x325d3e?_0x325d3e[_0xf433('0x26')]:'','XMD-DESTINATION':_0xf433('0x27'),'SIPADDHEADER':_0xf433('0x28')};if(!_[_0xf433('0x11')](_0x40a2e9['monitor_format'])){_0x167ddc[util[_0xf433('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x40a2e9[_0xf433('0x1f')];_0x167ddc[util[_0xf433('0x12')]('%s',_0xf433('0x29'))]=_0x1bba8b;}return _0x167ddc;};exports[_0xf433('0x2a')]=function(_0x26b010){var _0x5d42dd={};for(var _0x245410 in _0x26b010){if(_0x26b010[_0xf433('0x2b')](_0x245410)){_0x5d42dd[util[_0xf433('0x12')]('%s',_[_0xf433('0x2c')](_0x245410))]=_0x26b010[_0x245410];}}return{'variables':_0x5d42dd};};exports[_0xf433('0x2d')]=function(_0x3e1dfe,_0x4a1f5f){if(!_[_0xf433('0x2e')](_0x3e1dfe)){if(_0x3e1dfe[_0xf433('0x2b')](_0xf433('0x2f'))){if(_0x3e1dfe[_0xf433('0x2f')]>0x0){_0x3e1dfe['originated']-=0x1;}else{logger[_0xf433('0x9')](_0xf433('0x30'),_0x4a1f5f);}}}else{logger[_0xf433('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4a1f5f);}};exports[_0xf433('0x31')]=function(_0x1f58c9){var _0x5e7bdb=moment()[_0xf433('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f58c9[_0xf433('0x32')]=0xd;_0x1f58c9[_0xf433('0x33')]='Blacklist';_0x1f58c9[_0xf433('0x34')]=_0x5e7bdb;_0x1f58c9['responsetime']=_0x5e7bdb;_0x1f58c9['endtime']=_0x5e7bdb;};exports[_0xf433('0x35')]=function(_0x11f4b5,_0x3e5b26,_0x58e186){var _0x12e629=moment()[_0xf433('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x11f4b5['state']=_0x3e5b26;_0x11f4b5[_0xf433('0x33')]=_0x58e186;_0x11f4b5[_0xf433('0x36')]=_0x12e629;_0x11f4b5[_0xf433('0x37')]=utils[_0xf433('0x38')](_0x11f4b5[_0xf433('0x36')],_0x11f4b5['starttime']);};exports['logLookAgent']=function(_0x132a1f,_0xed5f8,_0x4efcd2){_0x132a1f[_0xf433('0x39')]=_0xed5f8;_0x132a1f[_0xf433('0x3a')]=_0x4efcd2;};exports[_0xf433('0x3b')]=function(_0x9f6f21,_0x2fe36b,_0xb81b44){var _0x475d1f=moment()['format'](_0xf433('0x3c'));_0x9f6f21[_0xf433('0x32')]=_0x2fe36b;_0x9f6f21['statedesc']=_0xb81b44;_0x9f6f21[_0xf433('0x36')]=_0x9f6f21[_0xf433('0x36')]?_0x9f6f21['responsetime']:_0x475d1f;_0x9f6f21[_0xf433('0x3d')]=_0x9f6f21[_0xf433('0x3d')]?_0x9f6f21[_0xf433('0x3d')]:_0x475d1f;_0x9f6f21[_0xf433('0x37')]=utils[_0xf433('0x38')](_0x9f6f21[_0xf433('0x36')]||0x0,_0x9f6f21['starttime']||0x0);_0x9f6f21[_0xf433('0x3e')]=_0x9f6f21[_0xf433('0x3f')]?utils[_0xf433('0x38')](_0x9f6f21[_0xf433('0x3d')],_0x9f6f21[_0xf433('0x3f')]):0x0;};exports['isFailure']=function(_0x3ddf07){return _0x3ddf07===_0xf433('0x40');};exports['variablesAction']=function(_0x20844e,_0x48fb20,_0x504d4d,_0x1743b5,_0x55adda){var _0x35bb81=_0x1743b5?_0xf433('0x41'):_0x20844e[_0xf433('0x18')];_0x35bb81=_0x55adda?_0xf433('0x42'):_0x35bb81;return{'actionid':_0x20844e[_0xf433('0x43')],'action':_0xf433('0x44'),'channel':_0x20844e['channelAgent'],'callerid':util[_0xf433('0x12')](_0xf433('0x13'),_0x35bb81,_0x20844e['calleridnum']),'Exten':_0xf433('0x27'),'Context':_0xf433('0x45'),'Priority':'1','variable':_0x504d4d,'timeout':(_0x48fb20[_0xf433('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20844e['uniqueid']};};exports[_0xf433('0x47')]=function(_0x5f1553){return _0x5f1553[_0xf433('0x48')]+_0x5f1553['countcongestionretry']+_0x5f1553[_0xf433('0x49')]+_0x5f1553[_0xf433('0x4a')]+_0x5f1553[_0xf433('0x4b')];};exports['cloneAction']=function(_0x2caa02){var _0x341968=_['clone'](_0x2caa02);_0x341968[_0xf433('0x32')]=0xf;_0x341968['statedesc']=_0xf433('0x4c');return _0x341968;};exports[_0xf433('0x4d')]=function(_0x1704cd,_0x2ca396,_0x559764){var _0x40f8c0={};_0x40f8c0[_0x2ca396]=_0x1704cd[_0x2ca396];_0x40f8c0[_0xf433('0x4e')]=![];_0x40f8c0[_0xf433('0x4f')]=moment()['add'](_0x559764,_0xf433('0x50'))[_0xf433('0x12')](_0xf433('0x3c'));_0x40f8c0['ContactId']=_0x1704cd[_0xf433('0x1a')];_0x40f8c0['ListId']=_0x1704cd[_0xf433('0x51')];_0x40f8c0['VoiceQueueId']=_0x1704cd[_0xf433('0x52')]||undefined;return _0x40f8c0;};exports[_0xf433('0x53')]=function(_0x5697db,_0x3ba2c9){if(!_[_0xf433('0x2e')](_0x5697db)){if(_0x5697db[_0xf433('0x54')]>0x0){_0x5697db[_0xf433('0x54')]-=0x1;}else{logger['error'](_0x3ba2c9,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x3ba2c9,_0xf433('0x55'));}};exports['IsNotLoggedIn']=function(_0x277f3a){if(_0x277f3a<=0x0){return!![];}return![];};function buildObj(_0x310c9f,_0x1c2078,_0x3e7c6e){_0x310c9f[_0xf433('0x56')]=_0x1c2078;_0x310c9f[_0xf433('0x57')]=_0x310c9f[_0xf433('0x58')];_0x310c9f['interface']=_0x310c9f[_0xf433('0x59')];_0x310c9f[_0xf433('0x5a')]='voice';if(_0x3e7c6e){_0x310c9f[_0xf433('0x5b')]=_0x3e7c6e['mandatoryDisposition'];}return _0x310c9f;}exports[_0xf433('0x5c')]=buildObj;exports[_0xf433('0x5d')]=function(_0x4aa500){var _0xeb893a=[];for(var _0x5ee6c3 in _0x4aa500){if(_0x4aa500[_0xf433('0x2b')](_0x5ee6c3)){if(!_[_0xf433('0x2e')](_0x4aa500[_0x5ee6c3])&&_0x4aa500[_0x5ee6c3][_0xf433('0x32')]===_0xf433('0x5e')&&_0x4aa500[_0x5ee6c3][_0xf433('0x5f')]===_0xf433('0x60')){_0xeb893a[_0xf433('0x61')](_0x4aa500[_0x5ee6c3]['id']);}}}return _0xeb893a;};exports[_0xf433('0x62')]=function(_0x50cef5){var _0x1e2b72=moment()[_0xf433('0x63')](0x0);var _0x4dc83b=moment(_0x50cef5)['milliseconds'](0x0);return _0x1e2b72['diff'](_0x4dc83b,_0xf433('0x64'));};exports[_0xf433('0x65')]=function(_0x1a2fa7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a2fa7[_0xf433('0x1a')],'ListId':_0x1a2fa7[_0xf433('0x51')],'VoiceQueueId':_0x1a2fa7[_0xf433('0x52')]||undefined,'CampaignId':_0x1a2fa7[_0xf433('0x66')]||undefined};};exports[_0xf433('0x67')]=function(_0x1b956a){if(_0x1b956a===_0xf433('0x43')||_0x1b956a===_0xf433('0x68')||_0x1b956a==='queue'||_0x1b956a===_0xf433('0x69')||_0x1b956a===_0xf433('0x6a')||_0x1b956a==='dialAnswer'||_0x1b956a==='membername'||_0x1b956a===_0xf433('0x59')||_0x1b956a===_0xf433('0x18')||_0x1b956a===_0xf433('0x4e')||_0x1b956a===_0xf433('0x19')||_0x1b956a===_0xf433('0x4f')||_0x1b956a===_0xf433('0x48')||_0x1b956a==='countcongestionretry'||_0x1b956a===_0xf433('0x49')||_0x1b956a==='countglobal'||_0x1b956a==='callback'||_0x1b956a===_0xf433('0x6b')||_0x1b956a===_0xf433('0x6c')||_0x1b956a===_0xf433('0x6d')||_0x1b956a===_0xf433('0x1a')||_0x1b956a===_0xf433('0x51')||_0x1b956a==='UserId'||_0x1b956a===_0xf433('0x52')||_0x1b956a==='sipcallid'||_0x1b956a===_0xf433('0x6e')||_0x1b956a===_0xf433('0x6f')||_0x1b956a===_0xf433('0x70')||_0x1b956a===_0xf433('0x71')||_0x1b956a==='xmd-dialurl'||_0x1b956a===_0xf433('0x72')||_0x1b956a===_0xf433('0x73')||_0x1b956a===_0xf433('0x74')||_0x1b956a===_0xf433('0x75')||_0x1b956a===_0xf433('0x76')||_0x1b956a===_0xf433('0x77')||_0x1b956a===_0xf433('0x78')||_0x1b956a===_0xf433('0x79')||_0x1b956a==='xmd-agi'||_0x1b956a===_0xf433('0x7a')||_0x1b956a===_0xf433('0x7b')||_0x1b956a===_0xf433('0x7c')||_0x1b956a===_0xf433('0x7d')||_0x1b956a===_0xf433('0x7e')||_0x1b956a==='rtpaudioqoslossbridged'||_0x1b956a===_0xf433('0x7f')||_0x1b956a===_0xf433('0x80')||_0x1b956a===_0xf433('0x7a')||_0x1b956a===_0xf433('0x7b')||_0x1b956a===_0xf433('0x7c')||_0x1b956a==='rtpaudioqosjitterbridged'||_0x1b956a==='rtpaudioqosloss'||_0x1b956a===_0xf433('0x81')||_0x1b956a===_0xf433('0x7f')||_0x1b956a===_0xf433('0x80')||_0x1b956a===_0xf433('0x82')||_0x1b956a===_0xf433('0x83')||_0x1b956a===_0xf433('0x32')||_0x1b956a===_0xf433('0x33')){return![];}return!![];};exports[_0xf433('0x84')]=function(_0x39b97d,_0x4097e1){var _0x495b13,_0x4c8198,_0x3adcfe;if(_0x4097e1<=0x0){_0x4097e1=0x1;}_0x495b13=new RegExp(_0xf433('0x85')+_0x4097e1+'}$');_0x4c8198=Math['pow'](0xa,_0x4097e1-0x1);_0x3adcfe=Math[_0xf433('0x86')](0xa,_0x4097e1)-0x1;return util[_0xf433('0x12')]('%s',_['replace'](_0x39b97d,_0x495b13,_[_0xf433('0x87')](_0x4c8198,_0x3adcfe)));};exports[_0xf433('0x88')]=function(_0x2edbe4){var _0x125873=_0x2edbe4[_0xf433('0x89')](/"(.*?)"/);return _0x125873?_0x125873[0x1]:_0x2edbe4;};exports['extractCalleridNumber']=function(_0xb1425){var _0x5ba1db=_0xb1425[_0xf433('0x89')](/<(.*?)>/);return _0x5ba1db?_0x5ba1db[0x1]:_0xb1425;};function buildNoAnswerEventPayload(_0x4fbec6,_0x5f5c24){var _0x3cf033=buildObj(_0x4fbec6,_0xf433('0x8a'));if(!_['isEmpty'](_0x5f5c24[_0xf433('0x8b')])){Object['keys'](_0x5f5c24[_0xf433('0x8b')])[_0xf433('0x8c')](function(_0x3ca71c){_0x3cf033[_0x3ca71c[_0xf433('0x8d')]()]=_0x5f5c24['variables'][_0x3ca71c];});}return _0x3cf033;}exports[_0xf433('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x56f9=['extractCalleridName','match','keys','variables','toLowerCase','buildNoAnswerEventPayload','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildObj','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','queue','type','campaigntype','active','countbusyretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','statedesc','getCallerIdRandom','\x5cw{0,','pow'];(function(_0x33d519,_0x5235e3){var _0x2f83ef=function(_0x3af9d6){while(--_0x3af9d6){_0x33d519['push'](_0x33d519['shift']());}};_0x2f83ef(++_0x5235e3);}(_0x56f9,0x97));var _0x956f=function(_0x6ba79c,_0x59bfdb){_0x6ba79c=_0x6ba79c-0x0;var _0x29ff3e=_0x56f9[_0x6ba79c];return _0x29ff3e;};'use strict';var util=require('util');var _=require(_0x956f('0x0'));var moment=require('moment');var logger=require(_0x956f('0x1'))(_0x956f('0x2'));var ipAgi=process['env'][_0x956f('0x3')]||_0x956f('0x4');var utils=require(_0x956f('0x5'));exports[_0x956f('0x6')]=function(_0x1c9692){return function(_0x45c10c){logger[_0x956f('0x7')](_0x1c9692,util[_0x956f('0x8')](_0x45c10c,{'showHidden':![],'depth':null}));};};exports[_0x956f('0x9')]=function(_0x24be2e,_0x59df45){logger[_0x956f('0xa')](_0x24be2e,util[_0x956f('0x8')](_0x59df45,{'showHidden':![],'depth':null}));};exports[_0x956f('0xb')]=function(_0x34b100,_0x2880bd){logger[_0x956f('0x7')](_0x34b100,util[_0x956f('0x8')](_0x2880bd,{'showHidden':![],'depth':null}));};exports[_0x956f('0xc')]=function(_0x448ae2){return function(_0x459af1){logger['info'](_0x448ae2,util[_0x956f('0x8')](_0x459af1,{'showHidden':![],'depth':null}));};};exports[_0x956f('0xd')]=function(_0x659b8d,_0x19f3db,_0xe22a19){return{'message':_0x659b8d,'unlock':_0x19f3db,'active':_0xe22a19};};exports[_0x956f('0xe')]=function(_0x38fa84,_0x5e1731,_0x204a52){if(!_[_0x956f('0xf')](_0x204a52)&&_0x956f('0x10')===typeof _0x204a52&&!_[_0x956f('0x11')](_0x204a52)){if(!_[_0x956f('0xf')](_0x5e1731)&&_0x956f('0x10')===typeof _0x5e1731&&!_[_0x956f('0x11')](_0x5e1731)){return util['format'](_0x956f('0x12'),_0x5e1731,_0x204a52);}return util[_0x956f('0x13')](_0x956f('0x12'),_0x204a52,_0x204a52);}if(!_['isUndefined'](_0x38fa84)&&_0x956f('0x10')===typeof _0x38fa84&&!_[_0x956f('0x11')](_0x38fa84)){return _0x38fa84;}return _0x956f('0x14');};exports['isActive']=function(_0x5e808f){if(_[_0x956f('0x15')](_0x5e808f)){return![];}return _0x5e808f;};exports[_0x956f('0x16')]=function(_0x3bfc14,_0x262645,_0x3bce06,_0x375c36,_0x5b8a5d,_0x3d9b85){var _0x4d2054={'XMD-QUEUE':_0x262645[_0x956f('0x17')]?_0x262645['Queue'][_0x956f('0x18')]:'','XMD-CALLERID':_0x375c36,'XMD-CALLERID-PREVIEW':_0x3d9b85?util[_0x956f('0x13')](_0x956f('0x12'),_0x3d9b85[_0x956f('0x19')],_0x3d9b85['calleridnum']):_0x375c36,'XMD-DIALID':_0x5b8a5d,'XMD-CONTACTID':_0x262645[_0x956f('0x1a')],'XMD-CDRTYPE':_0x956f('0x1b'),'CALLERID(all)':_0x375c36,'XMD-VOICEQUEUEID':_0x262645[_0x956f('0x1c')],'XMD-DIALCHANNEL':_0x3bce06,'XMD-DIALTIMEOUT':_0x3bfc14[_0x956f('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x956f('0x13')](_0x956f('0x1e'),_0x3bfc14[_0x956f('0x1f')]?'g':'',_[_0x956f('0x11')](_0x3bfc14[_0x956f('0x20')])?'':_0x956f('0x21')),'XMD-DIALURL':_0x3bfc14[_0x956f('0x22')]||'','XMD-AGI':_0x3bfc14[_0x956f('0x23')]?util[_0x956f('0x13')](_0x956f('0x24'),ipAgi,_0x3bfc14[_0x956f('0x23')]):_0x956f('0x25'),'XMD-AGIAFTER':_0x3bfc14[_0x956f('0x1f')]?util[_0x956f('0x13')](_0x956f('0x24'),ipAgi,_0x3bfc14[_0x956f('0x1f')]):_0x956f('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x3d9b85?_0x3d9b85['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3d9b85?_0x3d9b85['originatecalleridname']:'','XMD-DESTINATION':_0x956f('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x956f('0x11')](_0x3bfc14[_0x956f('0x20')])){_0x4d2054[util[_0x956f('0x13')]('%s',_0x956f('0x27'))]=_0x3bfc14['monitor_format'];_0x4d2054[util[_0x956f('0x13')]('%s',_0x956f('0x28'))]=_0x5b8a5d;}return _0x4d2054;};exports[_0x956f('0x29')]=function(_0x3b7e56){var _0x276d92={};for(var _0x2e199d in _0x3b7e56){if(_0x3b7e56[_0x956f('0x2a')](_0x2e199d)){_0x276d92[util[_0x956f('0x13')]('%s',_[_0x956f('0x2b')](_0x2e199d))]=_0x3b7e56[_0x2e199d];}}return{'variables':_0x276d92};};exports['updateOriginated']=function(_0x40ed4b,_0x2a67da){if(!_['isNil'](_0x40ed4b)){if(_0x40ed4b[_0x956f('0x2a')](_0x956f('0x2c'))){if(_0x40ed4b['originated']>0x0){_0x40ed4b[_0x956f('0x2c')]-=0x1;}else{logger['error'](_0x956f('0x2d'),_0x2a67da);}}}else{logger[_0x956f('0x7')](_0x956f('0x2e'),_0x2a67da);}};exports['logBlacklist']=function(_0x47abde){var _0x449fa3=moment()[_0x956f('0x13')](_0x956f('0x2f'));_0x47abde[_0x956f('0x30')]=0xd;_0x47abde['statedesc']='Blacklist';_0x47abde[_0x956f('0x31')]=_0x449fa3;_0x47abde[_0x956f('0x32')]=_0x449fa3;_0x47abde[_0x956f('0x33')]=_0x449fa3;};exports[_0x956f('0x34')]=function(_0x1adf5d,_0x21088b,_0x3235d0){var _0x865b16=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1adf5d[_0x956f('0x30')]=_0x21088b;_0x1adf5d['statedesc']=_0x3235d0;_0x1adf5d[_0x956f('0x32')]=_0x865b16;_0x1adf5d[_0x956f('0x35')]=utils[_0x956f('0x36')](_0x1adf5d[_0x956f('0x32')],_0x1adf5d[_0x956f('0x31')]);};exports[_0x956f('0x37')]=function(_0x312706,_0x280045,_0x5790e7){_0x312706[_0x956f('0x38')]=_0x280045;_0x312706[_0x956f('0x39')]=_0x5790e7;};exports['logCustomer']=function(_0x505c47,_0x454b30,_0x2b5591){var _0x2c41eb=moment()[_0x956f('0x13')](_0x956f('0x2f'));_0x505c47[_0x956f('0x30')]=_0x454b30;_0x505c47['statedesc']=_0x2b5591;_0x505c47[_0x956f('0x32')]=_0x505c47[_0x956f('0x32')]?_0x505c47[_0x956f('0x32')]:_0x2c41eb;_0x505c47['endtime']=_0x505c47['endtime']?_0x505c47[_0x956f('0x33')]:_0x2c41eb;_0x505c47['ringtime']=utils['getSeconds'](_0x505c47['responsetime']||0x0,_0x505c47[_0x956f('0x31')]||0x0);_0x505c47[_0x956f('0x3a')]=_0x505c47[_0x956f('0x3b')]?utils[_0x956f('0x36')](_0x505c47[_0x956f('0x33')],_0x505c47[_0x956f('0x3b')]):0x0;};exports['isFailure']=function(_0x18f4b8){return _0x18f4b8===_0x956f('0x3c');};exports[_0x956f('0x3d')]=function(_0xba228,_0x1d8a43,_0x2841ae,_0x4fc830,_0x1a399b){var _0x774c31=_0x4fc830?_0x956f('0x3e'):_0xba228[_0x956f('0x19')];_0x774c31=_0x1a399b?_0x956f('0x3f'):_0x774c31;return{'actionid':_0xba228[_0x956f('0x40')],'action':_0x956f('0x41'),'channel':_0xba228[_0x956f('0x42')],'callerid':util[_0x956f('0x13')](_0x956f('0x12'),_0x774c31,_0xba228[_0x956f('0x43')]),'Exten':_0x956f('0x26'),'Context':_0x956f('0x44'),'Priority':'1','variable':_0x2841ae,'timeout':(_0x1d8a43[_0x956f('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0xba228['uniqueid']};};exports['totalGlobal']=function(_0x27a5f5){return _0x27a5f5['countbusyretry']+_0x27a5f5[_0x956f('0x46')]+_0x27a5f5[_0x956f('0x47')]+_0x27a5f5[_0x956f('0x48')]+_0x27a5f5[_0x956f('0x49')];};exports[_0x956f('0x4a')]=function(_0xefbfc2){var _0x3c3501=_[_0x956f('0x4b')](_0xefbfc2);_0x3c3501['state']=0xf;_0x3c3501['statedesc']=_0x956f('0x4c');return _0x3c3501;};exports[_0x956f('0x4d')]=function(_0x3caa5b,_0x4e436b,_0x6fdbc7){var _0x4b4fed={};_0x4b4fed[_0x4e436b]=_0x3caa5b[_0x4e436b];_0x4b4fed['active']=![];_0x4b4fed[_0x956f('0x4e')]=moment()['add'](_0x6fdbc7,'minutes')[_0x956f('0x13')](_0x956f('0x2f'));_0x4b4fed[_0x956f('0x1a')]=_0x3caa5b[_0x956f('0x1a')];_0x4b4fed[_0x956f('0x4f')]=_0x3caa5b[_0x956f('0x4f')];_0x4b4fed['VoiceQueueId']=_0x3caa5b[_0x956f('0x1c')]||undefined;return _0x4b4fed;};exports[_0x956f('0x50')]=function(_0x38b5db,_0xfa8b97){if(!_[_0x956f('0x15')](_0x38b5db)){if(_0x38b5db[_0x956f('0x51')]>0x0){_0x38b5db[_0x956f('0x51')]-=0x1;}else{logger['error'](_0xfa8b97,_0x956f('0x52'));}}else{logger[_0x956f('0x7')](_0xfa8b97,_0x956f('0x53'));}};exports['IsNotLoggedIn']=function(_0xdc77ea){if(_0xdc77ea<=0x0){return!![];}return![];};function buildObj(_0x13df61,_0xf8ae80,_0x20fbbd){_0x13df61[_0x956f('0x54')]=_0xf8ae80;_0x13df61[_0x956f('0x18')]=_0x13df61['queue'];_0x13df61[_0x956f('0x55')]=_0x13df61[_0x956f('0x42')];_0x13df61[_0x956f('0x56')]=_0x956f('0x57');if(_0x20fbbd){_0x13df61[_0x956f('0x58')]=_0x20fbbd[_0x956f('0x58')];}return _0x13df61;}exports[_0x956f('0x59')]=buildObj;exports['agentReadyId']=function(_0x2c7dd0){var _0x528dac=[];for(var _0x92ff5b in _0x2c7dd0){if(_0x2c7dd0[_0x956f('0x2a')](_0x92ff5b)){if(!_[_0x956f('0x15')](_0x2c7dd0[_0x92ff5b])&&_0x2c7dd0[_0x92ff5b]['state']===_0x956f('0x5a')&&_0x2c7dd0[_0x92ff5b][_0x956f('0x5b')]===_0x956f('0x5c')){_0x528dac[_0x956f('0x5d')](_0x2c7dd0[_0x92ff5b]['id']);}}}return _0x528dac;};exports[_0x956f('0x5e')]=function(_0x6a02e7){var _0x3d48da=moment()[_0x956f('0x5f')](0x0);var _0xf0c8=moment(_0x6a02e7)[_0x956f('0x5f')](0x0);return _0x3d48da[_0x956f('0x60')](_0xf0c8,_0x956f('0x61'));};exports[_0x956f('0x62')]=function(_0x8c9a56){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x8c9a56[_0x956f('0x1a')],'ListId':_0x8c9a56[_0x956f('0x4f')],'VoiceQueueId':_0x8c9a56[_0x956f('0x1c')]||undefined,'CampaignId':_0x8c9a56[_0x956f('0x63')]||undefined};};exports[_0x956f('0x64')]=function(_0x14b17e){if(_0x14b17e===_0x956f('0x40')||_0x14b17e===_0x956f('0x65')||_0x14b17e===_0x956f('0x66')||_0x14b17e===_0x956f('0x67')||_0x14b17e===_0x956f('0x68')||_0x14b17e==='dialAnswer'||_0x14b17e===_0x956f('0x38')||_0x14b17e===_0x956f('0x42')||_0x14b17e===_0x956f('0x19')||_0x14b17e===_0x956f('0x69')||_0x14b17e===_0x956f('0x43')||_0x14b17e===_0x956f('0x4e')||_0x14b17e===_0x956f('0x6a')||_0x14b17e===_0x956f('0x46')||_0x14b17e===_0x956f('0x47')||_0x14b17e==='countglobal'||_0x14b17e===_0x956f('0x6b')||_0x14b17e===_0x956f('0x6c')||_0x14b17e===_0x956f('0x6d')||_0x14b17e===_0x956f('0x6e')||_0x14b17e==='ContactId'||_0x14b17e==='ListId'||_0x14b17e===_0x956f('0x39')||_0x14b17e===_0x956f('0x1c')||_0x14b17e===_0x956f('0x6f')||_0x14b17e===_0x956f('0x70')||_0x14b17e===_0x956f('0x71')||_0x14b17e===_0x956f('0x72')||_0x14b17e===_0x956f('0x73')||_0x14b17e==='xmd-dialurl'||_0x14b17e===_0x956f('0x74')||_0x14b17e===_0x956f('0x75')||_0x14b17e===_0x956f('0x76')||_0x14b17e===_0x956f('0x77')||_0x14b17e===_0x956f('0x78')||_0x14b17e===_0x956f('0x79')||_0x14b17e===_0x956f('0x7a')||_0x14b17e===_0x956f('0x7b')||_0x14b17e===_0x956f('0x7c')||_0x14b17e===_0x956f('0x7d')||_0x14b17e===_0x956f('0x7e')||_0x14b17e==='rtpaudioqosjitter'||_0x14b17e===_0x956f('0x7f')||_0x14b17e===_0x956f('0x80')||_0x14b17e==='rtpaudioqoslossbridged'||_0x14b17e===_0x956f('0x81')||_0x14b17e==='rtpaudioqosrttbridged'||_0x14b17e==='rtpaudioqos'||_0x14b17e===_0x956f('0x7e')||_0x14b17e===_0x956f('0x82')||_0x14b17e===_0x956f('0x7f')||_0x14b17e===_0x956f('0x80')||_0x14b17e===_0x956f('0x83')||_0x14b17e===_0x956f('0x81')||_0x14b17e===_0x956f('0x84')||_0x14b17e===_0x956f('0x85')||_0x14b17e===_0x956f('0x86')||_0x14b17e===_0x956f('0x30')||_0x14b17e===_0x956f('0x87')){return![];}return!![];};exports[_0x956f('0x88')]=function(_0x217df5,_0x27d96d){var _0x5dde68,_0x15a076,_0x50bb18;if(_0x27d96d<=0x0){_0x27d96d=0x1;}_0x5dde68=new RegExp(_0x956f('0x89')+_0x27d96d+'}$');_0x15a076=Math[_0x956f('0x8a')](0xa,_0x27d96d-0x1);_0x50bb18=Math[_0x956f('0x8a')](0xa,_0x27d96d)-0x1;return util[_0x956f('0x13')]('%s',_['replace'](_0x217df5,_0x5dde68,_['random'](_0x15a076,_0x50bb18)));};exports[_0x956f('0x8b')]=function(_0x413008){var _0x93a01d=_0x413008['match'](/"(.*?)"/);return _0x93a01d?_0x93a01d[0x1]:_0x413008;};exports['extractCalleridNumber']=function(_0x4c64e6){var _0x265f29=_0x4c64e6[_0x956f('0x8c')](/<(.*?)>/);return _0x265f29?_0x265f29[0x1]:_0x4c64e6;};function buildNoAnswerEventPayload(_0x5c5579,_0x39b9f8){var _0x46fdde=buildObj(_0x5c5579,'noanswer');if(!_[_0x956f('0x11')](_0x39b9f8['variables'])){Object[_0x956f('0x8d')](_0x39b9f8[_0x956f('0x8e')])['forEach'](function(_0x2af077){_0x46fdde[_0x2af077[_0x956f('0x8f')]()]=_0x39b9f8[_0x956f('0x8e')][_0x2af077];});}return _0x46fdde;}exports[_0x956f('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4d52cbb..06b5eb0 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f5b=['queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x549c91,_0x43e7d4){var _0x5cb61c=function(_0x486d63){while(--_0x486d63){_0x549c91['push'](_0x549c91['shift']());}};_0x5cb61c(++_0x43e7d4);}(_0x3f5b,0x18c));var _0xb3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5b[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0xb3f5('0x0')]={'queue':{'type':_0xb3f5('0x1'),'required':!![]},'interface':{'type':_0xb3f5('0x1'),'required':!![]},'membername':{'type':_0xb3f5('0x1'),'required':!![]},'penalty':{'type':_0xb3f5('0x2'),'required':![]},'paused':{'type':_0xb3f5('0x3'),'required':![]}};exports[_0xb3f5('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xb3f5('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xb3f5('0x3')},'reason':{'type':'string','required':![]}};exports[_0xb3f5('0x6')]={'module':{'type':'string','required':![]}};exports[_0xb3f5('0x7')]={'uniqueid':{'type':_0xb3f5('0x1'),'required':!![]}};exports[_0xb3f5('0x8')]={'uniqueid':{'type':_0xb3f5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xb3f5('0x1')},'mixmonitorid':{'type':_0xb3f5('0x1')}};exports[_0xb3f5('0x9')]={'uniqueid':{'type':_0xb3f5('0x1'),'required':!![]}};exports[_0xb3f5('0xa')]={'uniqueid':{'type':_0xb3f5('0x1'),'required':!![]},'exten':{'type':_0xb3f5('0x1'),'required':!![]},'context':{'type':_0xb3f5('0x1')}}; \ No newline at end of file +var _0x1030=['number','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x20c6f1,_0x25197e){var _0x2c50c4=function(_0x5f5d19){while(--_0x5f5d19){_0x20c6f1['push'](_0x20c6f1['shift']());}};_0x2c50c4(++_0x25197e);}(_0x1030,0x116));var _0x0103=function(_0x2a95e9,_0x50901e){_0x2a95e9=_0x2a95e9-0x0;var _0x4929fa=_0x1030[_0x2a95e9];return _0x4929fa;};'use strict';exports[_0x0103('0x0')]={'queue':{'type':_0x0103('0x1'),'required':!![]},'interface':{'type':_0x0103('0x1'),'required':!![]},'membername':{'type':_0x0103('0x1'),'required':!![]},'penalty':{'type':_0x0103('0x2'),'required':![]},'paused':{'type':_0x0103('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x0103('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x0103('0x3')},'reason':{'type':_0x0103('0x1'),'required':![]}};exports[_0x0103('0x4')]={'module':{'type':_0x0103('0x1'),'required':![]}};exports[_0x0103('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x0103('0x6')]={'uniqueid':{'type':_0x0103('0x1'),'required':!![]},'filename':{'type':_0x0103('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0103('0x1')}};exports[_0x0103('0x7')]={'uniqueid':{'type':_0x0103('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0103('0x1'),'required':!![]},'exten':{'type':_0x0103('0x1'),'required':!![]},'context':{'type':_0x0103('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 5610a24..cac9af2 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x5c4256,_0x286bce){var _0xe98254=function(_0x3ea876){while(--_0x3ea876){_0x5c4256['push'](_0x5c4256['shift']());}};_0xe98254(++_0x286bce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0x18baa4,_0x5e35f2){var _0x370834=function(_0x32b687){while(--_0x32b687){_0x18baa4['push'](_0x18baa4['shift']());}};_0x370834(++_0x5e35f2);}(_0x757a,0xde));var _0xa757=function(_0x15f0a8,_0x1dd467){_0x15f0a8=_0x15f0a8-0x0;var _0x5b6735=_0x757a[_0x15f0a8];return _0x5b6735;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 233e3df..bed4134 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf322=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xf322,0x124));var _0x2f32=function(_0x3e626f,_0x3d1461){_0x3e626f=_0x3e626f-0x0;var _0x1faa63=_0xf322[_0x3e626f];return _0x1faa63;};'use strict';function mergeDBDataToRealtime(_0xf8e593,_0x13e65d){var _0x476d5d=Object[_0x2f32('0x0')]({},_0xf8e593);for(var _0x1ec3d0 in _0x13e65d){if(_0x476d5d[_0x2f32('0x1')](_0x1ec3d0)){_0x476d5d[_0x1ec3d0]=_0x13e65d[_0x1ec3d0];}}return _0x476d5d;}exports[_0x2f32('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x989c=['mergeDBDataToRealtime'];(function(_0x3600a9,_0x4a3cbb){var _0x4532fd=function(_0x1e66aa){while(--_0x1e66aa){_0x3600a9['push'](_0x3600a9['shift']());}};_0x4532fd(++_0x4a3cbb);}(_0x989c,0x68));var _0xc989=function(_0x447ccf,_0x46b852){_0x447ccf=_0x447ccf-0x0;var _0x46055d=_0x989c[_0x447ccf];return _0x46055d;};'use strict';function mergeDBDataToRealtime(_0x16f69c,_0x5cbad2){var _0xc4c256=Object['assign']({},_0x16f69c);for(var _0x5e9d3d in _0x5cbad2){if(_0xc4c256['hasOwnProperty'](_0x5e9d3d)){_0xc4c256[_0x5e9d3d]=_0x5cbad2[_0x5e9d3d];}}return _0xc4c256;}exports[_0xc989('0x0')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 4583678..0967e03 100644 --- a/server/services/ami/report/index.js +++ b/server/services/ami/report/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dc1=['destinationchannel','callerid','calleridpreview','disposition','ANSWERED','calleridname','transfers','linkedid','uniqueid','getAgentByInternal','UserId','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','isArray','forEach','indexOf','mobile','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','isNil','find','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','name','interface','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','create','match','keys','getCallType','channel','split','calleridnum','internal','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','originatecalleridnum'];(function(_0x204a28,_0x428d7d){var _0x49d073=function(_0x199d51){while(--_0x199d51){_0x204a28['push'](_0x204a28['shift']());}};_0x49d073(++_0x428d7d);}(_0x2dc1,0xc4));var _0x12dc=function(_0x45cb4c,_0x2f908d){_0x45cb4c=_0x45cb4c-0x0;var _0xf3edf5=_0x2dc1[_0x45cb4c];return _0xf3edf5;};'use strict';var _=require(_0x12dc('0x0'));var moment=require(_0x12dc('0x1'));var util=require(_0x12dc('0x2'));var config=require(_0x12dc('0x3'));var ami=require(_0x12dc('0x4'));var RpcVoiceAgentReport=require(_0x12dc('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x12dc('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x12dc('0x7'));var RpcVoiceRecording=require(_0x12dc('0x8'));var RpcVoiceTransferReport=require(_0x12dc('0x9'));var VoiceQueueReport=require(_0x12dc('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x12dc('0xb'));var VoiceDialReport=require(_0x12dc('0xc'));var UserReport=require(_0x12dc('0xd'));function Report(_0x16bf0c){this['realtime']=_0x16bf0c;this[_0x12dc('0xe')]=_0x16bf0c[_0x12dc('0xe')];this['telephones']=_0x16bf0c[_0x12dc('0xf')];}Report[_0x12dc('0x10')]['sync']=function(_0x23e162){var _0x370020=new VoiceQueueReport(this[_0x12dc('0x11')]);var _0x10b99a=new VoiceAgentReport(this['realtime']);var _0x34ce44=new VoiceDialReport(this[_0x12dc('0x11')]);var _0x617e8d=new VoiceCallReport(this[_0x12dc('0x11')]);var _0x36c5f8=new UserReport(this[_0x12dc('0x11')]);if(config[_0x12dc('0x12')]&&config[_0x12dc('0x12')][_0x12dc('0x13')]){ami['on'](_0x12dc('0x14'),this[_0x12dc('0x15')][_0x12dc('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x12dc('0x17')][_0x12dc('0x16')](this));ami['on'](_0x12dc('0x18'),this[_0x12dc('0x19')][_0x12dc('0x16')](this));ami['on'](_0x12dc('0x1a'),this[_0x12dc('0x1b')][_0x12dc('0x16')](this));ami['on']('blindtransfer',this[_0x12dc('0x1c')][_0x12dc('0x16')](this));ami['on'](_0x12dc('0x1d'),this[_0x12dc('0x1e')][_0x12dc('0x16')](this));}};Report[_0x12dc('0x10')][_0x12dc('0x1f')]=function(_0x540356){var _0x2691a5;_0x2691a5=_['find'](this[_0x12dc('0xe')],function(_0xe055cd){return _0xe055cd[_0x12dc('0x20')]==_0x540356||_0xe055cd['name']==_0x540356;});if(_[_0x12dc('0x21')](_0x2691a5)){var _0x3e0980=_[_0x12dc('0x22')](this['telephones'],function(_0x14bb7a){return _0x14bb7a[_0x12dc('0x20')]==_0x540356||_0x14bb7a['name']==_0x540356;});if(_0x3e0980){_0x2691a5=_[_0x12dc('0x22')](this[_0x12dc('0xe')],function(_0x5072af){return _0x5072af['interface']==util[_0x12dc('0x23')](_0x12dc('0x24'),_0x3e0980['name']);});}}return _0x2691a5;};Report['prototype'][_0x12dc('0x15')]=function(_0x21b37e){for(var _0x24ae8e=0x0;_0x24ae8e<_0x21b37e[_0x12dc('0x25')];_0x24ae8e+=0x1){var _0x3d2977=this[_0x12dc('0x1f')](_0x21b37e[_0x24ae8e][_0x12dc('0x26')]);if(_0x3d2977){_0x21b37e[_0x24ae8e][_0x12dc('0x20')]=_0x3d2977[_0x12dc('0x20')];_0x21b37e[_0x24ae8e][_0x12dc('0x27')]=!![];_0x21b37e[_0x24ae8e][_0x12dc('0x28')]=_0x3d2977[_0x12dc('0x29')];_0x21b37e[_0x24ae8e][_0x12dc('0x2a')]=_[_0x12dc('0x21')](_0x3d2977[_0x12dc('0x2a')])?util[_0x12dc('0x23')]('SIP/%s',_0x3d2977['name']):_0x3d2977[_0x12dc('0x2a')];if(_0x21b37e[_0x24ae8e]['queuecallercomplete']){_0x21b37e[_0x24ae8e][_0x12dc('0x2b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x21b37e[_0x24ae8e][_0x12dc('0x2c')]){_0x21b37e[_0x24ae8e][_0x12dc('0x2d')]=moment()[_0x12dc('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x12dc('0x15')](_0x21b37e[_0x24ae8e]);}RpcVoiceQueueReport[_0x12dc('0x2e')](_0x21b37e[_0x24ae8e]);}};function extractCalleridNumber(_0x5e861d){var _0x49a4df=_0x5e861d[_0x12dc('0x2f')](/<(.*?)>/);return _0x49a4df?_0x49a4df[0x1]:_0x5e861d;}Report[_0x12dc('0x10')]['getAgentByInternal']=function(_0x387de6){for(var _0x393282=0x0;_0x393282',_0x263a2c[_0x12dc('0x46')],_0x263a2c[_0x12dc('0x34')]);}if(RpcVoiceTransferReport[_0x12dc('0x47')][_0x263a2c[_0x12dc('0x48')]]){var _0x54b9ef=RpcVoiceTransferReport[_0x12dc('0x47')][_0x263a2c['linkedid']];_0x54b9ef['transfereelinkedid']=_0x263a2c[_0x12dc('0x49')];RpcVoiceTransferReport['blindTransfer'](_0x54b9ef);delete RpcVoiceTransferReport[_0x12dc('0x47')][_0x263a2c['linkedid']];}if(_[_0x12dc('0x21')](_0x263a2c[_0x12dc('0x38')])){_0x263a2c['type']=this['getCallType'](_0x263a2c);}if(_[_0x12dc('0x21')](_0x263a2c['UserId'])){var _0xac771d=_0x263a2c[_0x12dc('0x32')]['split']('-')[0x0];var _0x3a1338=this[_0x12dc('0xe')][_0xac771d];if(!_0x3a1338)_0x3a1338=this[_0x12dc('0x4a')](_0x263a2c[_0x12dc('0x20')]);if(_0x3a1338){_0x263a2c[_0x12dc('0x4b')]=_0x3a1338['id'];_0x263a2c['membername']=_0x3a1338[_0x12dc('0x29')];}}RpcVoiceCallReport['create'](_0x263a2c);if(_0x263a2c[_0x12dc('0x4c')]){for(var _0x5ee26a=0x0;_0x5ee26a<_0x263a2c[_0x12dc('0x4d')][_0x12dc('0x25')];_0x5ee26a+=0x1){_0x263a2c[_0x12dc('0x4e')]=_0x263a2c[_0x12dc('0x4d')][_0x5ee26a]['filename'];_0x263a2c[_0x12dc('0x4f')]=_0x263a2c[_0x12dc('0x4d')][_0x5ee26a][_0x12dc('0x4f')];if(_0x263a2c['exten']=='xcally-motion-preview'){_0x263a2c[_0x12dc('0x34')]=_0x263a2c[_0x12dc('0x26')];_0x263a2c[_0x12dc('0x46')]=_0x263a2c[_0x12dc('0x50')];_0x263a2c[_0x12dc('0x26')]=_0x263a2c[_0x12dc('0x20')];_0x263a2c[_0x12dc('0x50')]=_0x263a2c[_0x12dc('0x51')];_0x263a2c[_0x12dc('0x37')]=_0x263a2c[_0x12dc('0x40')];}else if(_0x263a2c[_0x12dc('0x37')]=='xcally-motion-dialer'){_0x263a2c[_0x12dc('0x34')]=_0x263a2c['destination'];_0x263a2c[_0x12dc('0x37')]=_0x263a2c[_0x12dc('0x40')];}RpcVoiceRecording['create'](_0x263a2c);}}};Report[_0x12dc('0x10')][_0x12dc('0x19')]=function(_0x19863c){if(_[_0x12dc('0x52')](_0x19863c)){_0x19863c[_0x12dc('0x53')](function(_0x402f08){RpcVoiceAgentReport['create'](_0x402f08);});}else{RpcVoiceAgentReport[_0x12dc('0x2e')](_0x19863c);}};Report[_0x12dc('0x10')][_0x12dc('0x1b')]=function(_0x29476f){RpcVoiceDialReport[_0x12dc('0x2e')](_0x29476f);var _0x2c7d3e;var _0x5dc888;var _0x16ad96=_0x29476f[_0x12dc('0x32')];if(_['startsWith'](_0x16ad96,'Local')){_0x5dc888=_0x16ad96['substring'](_0x16ad96[_0x12dc('0x54')]('/')+0x1,_0x16ad96[_0x12dc('0x54')]('@'));_0x2c7d3e=_[_0x12dc('0x22')](this[_0x12dc('0xe')],function(_0x259661){return _0x259661[_0x12dc('0x55')]==_0x5dc888||_0x259661['phone']==_0x5dc888||_0x259661['accountcode']==_0x5dc888;});}else{_0x5dc888=_0x16ad96['substring'](_0x16ad96[_0x12dc('0x54')]('/')+0x1,_0x16ad96['lastIndexOf']('-'));_0x2c7d3e=this['findAgent'](_0x5dc888);}if(_0x2c7d3e){_0x29476f[_0x12dc('0x2a')]=_['isNil'](_0x2c7d3e[_0x12dc('0x2a')])?util[_0x12dc('0x23')]('SIP/%s',_0x2c7d3e[_0x12dc('0x29')]):_0x2c7d3e[_0x12dc('0x2a')];_0x29476f['membername']=_0x2c7d3e[_0x12dc('0x29')];_0x29476f[_0x12dc('0x20')]=_0x2c7d3e['accountcode'];RpcMemberReport[_0x12dc('0x1b')](_0x29476f);}};Report[_0x12dc('0x10')][_0x12dc('0x1c')]=function(_0x7b56f9){RpcVoiceTransferReport[_0x12dc('0x47')][_0x7b56f9[_0x12dc('0x56')]]=_0x7b56f9;};Report[_0x12dc('0x10')][_0x12dc('0x1e')]=function(_0x539272){RpcVoiceTransferReport[_0x12dc('0x1e')](_0x539272);};module['exports']=Report; \ No newline at end of file +var _0xbbdf=['custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','length','connectedlinenum','assigned','lastAssignedTo','interface','isNil','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','destination','exten','dialer','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','destinationchannel','calleridpreview','originatecalleridnum','disposition','ANSWERED','calleridname','linkedid','transfereelinkedid','uniqueid','type','UserId','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','transfers','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport'];(function(_0x25dddb,_0x3f912f){var _0x14f98b=function(_0x358565){while(--_0x358565){_0x25dddb['push'](_0x25dddb['shift']());}};_0x14f98b(++_0x3f912f);}(_0xbbdf,0xa0));var _0xfbbd=function(_0x2f2a2e,_0x5be219){_0x2f2a2e=_0x2f2a2e-0x0;var _0x3d0e31=_0xbbdf[_0x2f2a2e];return _0x3d0e31;};'use strict';var _=require(_0xfbbd('0x0'));var moment=require(_0xfbbd('0x1'));var util=require(_0xfbbd('0x2'));var config=require(_0xfbbd('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xfbbd('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xfbbd('0x5'));var RpcVoiceQueueReport=require(_0xfbbd('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xfbbd('0x7'));var VoiceQueueReport=require(_0xfbbd('0x8'));var VoiceCallReport=require(_0xfbbd('0x9'));var VoiceAgentReport=require(_0xfbbd('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0xd954b7){this[_0xfbbd('0xb')]=_0xd954b7;this['agents']=_0xd954b7[_0xfbbd('0xc')];this[_0xfbbd('0xd')]=_0xd954b7[_0xfbbd('0xd')];}Report[_0xfbbd('0xe')][_0xfbbd('0xf')]=function(_0x17aacb){var _0x58796e=new VoiceQueueReport(this[_0xfbbd('0xb')]);var _0x2a7b25=new VoiceAgentReport(this[_0xfbbd('0xb')]);var _0x8513a5=new VoiceDialReport(this[_0xfbbd('0xb')]);var _0x583cbd=new VoiceCallReport(this[_0xfbbd('0xb')]);var _0x3bd1c1=new UserReport(this['realtime']);if(config['xdr']&&config['xdr'][_0xfbbd('0x10')]){ami['on'](_0xfbbd('0x11'),this[_0xfbbd('0x12')][_0xfbbd('0x13')](this));ami['on'](_0xfbbd('0x14'),this[_0xfbbd('0x15')][_0xfbbd('0x13')](this));ami['on'](_0xfbbd('0x16'),this[_0xfbbd('0x17')][_0xfbbd('0x13')](this));ami['on'](_0xfbbd('0x18'),this[_0xfbbd('0x19')]['bind'](this));ami['on'](_0xfbbd('0x1a'),this[_0xfbbd('0x1b')][_0xfbbd('0x13')](this));ami['on'](_0xfbbd('0x1c'),this[_0xfbbd('0x1d')][_0xfbbd('0x13')](this));}};Report['prototype'][_0xfbbd('0x1e')]=function(_0x4f2bc7){var _0x48c26d;_0x48c26d=_[_0xfbbd('0x1f')](this[_0xfbbd('0xc')],function(_0x53dc9c){return _0x53dc9c[_0xfbbd('0x20')]==_0x4f2bc7||_0x53dc9c[_0xfbbd('0x21')]==_0x4f2bc7;});if(_['isNil'](_0x48c26d)){var _0x34804c=_[_0xfbbd('0x1f')](this[_0xfbbd('0xd')],function(_0x4fcdf9){return _0x4fcdf9[_0xfbbd('0x20')]==_0x4f2bc7||_0x4fcdf9[_0xfbbd('0x21')]==_0x4f2bc7;});if(_0x34804c){_0x48c26d=_['find'](this[_0xfbbd('0xc')],function(_0x899c15){return _0x899c15['interface']==util['format']('SIP/%s',_0x34804c['name']);});}}return _0x48c26d;};Report[_0xfbbd('0xe')]['voiceQueueReport']=function(_0x3572d2){for(var _0x2b4bc9=0x0;_0x2b4bc9<_0x3572d2[_0xfbbd('0x22')];_0x2b4bc9+=0x1){var _0x1d75f3=this[_0xfbbd('0x1e')](_0x3572d2[_0x2b4bc9][_0xfbbd('0x23')]);if(_0x1d75f3){_0x3572d2[_0x2b4bc9]['accountcode']=_0x1d75f3[_0xfbbd('0x20')];_0x3572d2[_0x2b4bc9][_0xfbbd('0x24')]=!![];_0x3572d2[_0x2b4bc9][_0xfbbd('0x25')]=_0x1d75f3[_0xfbbd('0x21')];_0x3572d2[_0x2b4bc9][_0xfbbd('0x26')]=_[_0xfbbd('0x27')](_0x1d75f3[_0xfbbd('0x26')])?util[_0xfbbd('0x28')](_0xfbbd('0x29'),_0x1d75f3[_0xfbbd('0x21')]):_0x1d75f3[_0xfbbd('0x26')];if(_0x3572d2[_0x2b4bc9][_0xfbbd('0x2a')]){_0x3572d2[_0x2b4bc9][_0xfbbd('0x2b')]=moment()['format'](_0xfbbd('0x2c'));}if(_0x3572d2[_0x2b4bc9]['queuecallerexit']){_0x3572d2[_0x2b4bc9][_0xfbbd('0x2d')]=moment()[_0xfbbd('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xfbbd('0x12')](_0x3572d2[_0x2b4bc9]);}RpcVoiceQueueReport[_0xfbbd('0x2e')](_0x3572d2[_0x2b4bc9]);}};function extractCalleridNumber(_0x5041ce){var _0x1075b0=_0x5041ce['match'](/<(.*?)>/);return _0x1075b0?_0x1075b0[0x1]:_0x5041ce;}Report[_0xfbbd('0xe')][_0xfbbd('0x2f')]=function(_0x1c255){for(var _0x13d355=0x0;_0x13d355',_0x1bd853[_0xfbbd('0x44')],_0x1bd853[_0xfbbd('0x34')]);}if(RpcVoiceTransferReport['transfers'][_0x1bd853['linkedid']]){var _0x3fd6b4=RpcVoiceTransferReport['transfers'][_0x1bd853[_0xfbbd('0x45')]];_0x3fd6b4[_0xfbbd('0x46')]=_0x1bd853[_0xfbbd('0x47')];RpcVoiceTransferReport[_0xfbbd('0x1b')](_0x3fd6b4);delete RpcVoiceTransferReport['transfers'][_0x1bd853[_0xfbbd('0x45')]];}if(_[_0xfbbd('0x27')](_0x1bd853[_0xfbbd('0x48')])){_0x1bd853[_0xfbbd('0x48')]=this['getCallType'](_0x1bd853);}if(_[_0xfbbd('0x27')](_0x1bd853['UserId'])){var _0x34ffc2=_0x1bd853[_0xfbbd('0x32')][_0xfbbd('0x33')]('-')[0x0];var _0x36ca1b=this[_0xfbbd('0xc')][_0x34ffc2];if(!_0x36ca1b)_0x36ca1b=this['getAgentByInternal'](_0x1bd853[_0xfbbd('0x20')]);if(_0x36ca1b){_0x1bd853[_0xfbbd('0x49')]=_0x36ca1b['id'];_0x1bd853['membername']=_0x36ca1b[_0xfbbd('0x21')];}}RpcVoiceCallReport[_0xfbbd('0x2e')](_0x1bd853);if(_0x1bd853[_0xfbbd('0x4a')]){for(var _0x40f13d=0x0;_0x40f13d<_0x1bd853[_0xfbbd('0x4b')][_0xfbbd('0x22')];_0x40f13d+=0x1){_0x1bd853[_0xfbbd('0x4c')]=_0x1bd853['monitors'][_0x40f13d][_0xfbbd('0x4d')];_0x1bd853[_0xfbbd('0x4e')]=_0x1bd853[_0xfbbd('0x4b')][_0x40f13d][_0xfbbd('0x4e')];if(_0x1bd853[_0xfbbd('0x37')]=='xcally-motion-preview'){_0x1bd853[_0xfbbd('0x34')]=_0x1bd853[_0xfbbd('0x23')];_0x1bd853['calleridname']=_0x1bd853['connectedlinename'];_0x1bd853['connectedlinenum']=_0x1bd853[_0xfbbd('0x20')];_0x1bd853[_0xfbbd('0x4f')]=_0x1bd853[_0xfbbd('0x50')];_0x1bd853[_0xfbbd('0x37')]=_0x1bd853[_0xfbbd('0x41')];}else if(_0x1bd853['exten']==_0xfbbd('0x51')){_0x1bd853[_0xfbbd('0x34')]=_0x1bd853[_0xfbbd('0x36')];_0x1bd853['exten']=_0x1bd853[_0xfbbd('0x41')];}RpcVoiceRecording['create'](_0x1bd853);}}};Report['prototype'][_0xfbbd('0x17')]=function(_0x21e220){if(_['isArray'](_0x21e220)){_0x21e220[_0xfbbd('0x52')](function(_0x5a54e6){RpcVoiceAgentReport[_0xfbbd('0x2e')](_0x5a54e6);});}else{RpcVoiceAgentReport['create'](_0x21e220);}};Report[_0xfbbd('0xe')][_0xfbbd('0x19')]=function(_0x3fbbea){RpcVoiceDialReport[_0xfbbd('0x2e')](_0x3fbbea);var _0x2e75b2;var _0x24f0ba;var _0x4de80d=_0x3fbbea['channel'];if(_[_0xfbbd('0x53')](_0x4de80d,'Local')){_0x24f0ba=_0x4de80d[_0xfbbd('0x54')](_0x4de80d['indexOf']('/')+0x1,_0x4de80d[_0xfbbd('0x55')]('@'));_0x2e75b2=_[_0xfbbd('0x1f')](this[_0xfbbd('0xc')],function(_0x55ae08){return _0x55ae08[_0xfbbd('0x56')]==_0x24f0ba||_0x55ae08[_0xfbbd('0x57')]==_0x24f0ba||_0x55ae08['accountcode']==_0x24f0ba;});}else{_0x24f0ba=_0x4de80d[_0xfbbd('0x54')](_0x4de80d['indexOf']('/')+0x1,_0x4de80d['lastIndexOf']('-'));_0x2e75b2=this[_0xfbbd('0x1e')](_0x24f0ba);}if(_0x2e75b2){_0x3fbbea[_0xfbbd('0x26')]=_['isNil'](_0x2e75b2[_0xfbbd('0x26')])?util[_0xfbbd('0x28')](_0xfbbd('0x29'),_0x2e75b2[_0xfbbd('0x21')]):_0x2e75b2['interface'];_0x3fbbea[_0xfbbd('0x50')]=_0x2e75b2['name'];_0x3fbbea[_0xfbbd('0x20')]=_0x2e75b2[_0xfbbd('0x20')];RpcMemberReport[_0xfbbd('0x19')](_0x3fbbea);}};Report[_0xfbbd('0xe')][_0xfbbd('0x1b')]=function(_0x3a45fd){RpcVoiceTransferReport[_0xfbbd('0x58')][_0x3a45fd[_0xfbbd('0x59')]]=_0x3a45fd;};Report[_0xfbbd('0xe')][_0xfbbd('0x1d')]=function(_0x3c94ce){RpcVoiceTransferReport['attendedTransfer'](_0x3c94ce);};module[_0xfbbd('0x5a')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 50872c8..3eca06a 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8fb=['agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','emit','isNotNull','info','state','debug','[userReport][registry]','find','username','merge','event','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','stateTime','toNumber','toLowerCase','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','bluebird','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb8fb,0x153));var _0xbb8f=function(_0x218e21,_0x418dee){_0x218e21=_0x218e21-0x0;var _0x546683=_0xb8fb[_0x218e21];return _0x546683;};'use strict';var _=require(_0xbb8f('0x0'));var moment=require(_0xbb8f('0x1'));var util=require(_0xbb8f('0x2'));var Redis=require('ioredis');var BPromise=require(_0xbb8f('0x3'));var config=require('../../../config/environment');var logger=require(_0xbb8f('0x4'))(_0xbb8f('0x5'));var ami=require(_0xbb8f('0x6'));config[_0xbb8f('0x7')]=_[_0xbb8f('0x8')](config[_0xbb8f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xbb8f('0x9'))(new Redis(config['redis']));function UserReport(_0x41b8ff){this[_0xbb8f('0xa')]=_0x41b8ff['trunks'];this['agents']=_0x41b8ff[_0xbb8f('0xb')];this[_0xbb8f('0xc')]=_0x41b8ff[_0xbb8f('0xc')];ami['on'](_0xbb8f('0xd'),this[_0xbb8f('0xe')][_0xbb8f('0xf')](this));ami['on']('registry',this[_0xbb8f('0xe')][_0xbb8f('0xf')](this));ami['on'](_0xbb8f('0x10'),this[_0xbb8f('0x11')][_0xbb8f('0xf')](this));ami['on'](_0xbb8f('0x12'),this[_0xbb8f('0x13')][_0xbb8f('0xf')](this));return this[_0xbb8f('0x14')]();}function showSipRegistrations(){Promise[_0xbb8f('0x15')]()[_0xbb8f('0x16')](ami[_0xbb8f('0x17')]())[_0xbb8f('0x18')](function(_0x41bdc5){logger[_0xbb8f('0x19')](_0xbb8f('0x1a'),util['inspect'](_0x41bdc5,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xbb8f('0x15')]()['then'](ami[_0xbb8f('0x1b')]())[_0xbb8f('0x18')](function(_0x416692){logger[_0xbb8f('0x19')](_0xbb8f('0x1c'),util[_0xbb8f('0x1d')](_0x416692,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xbb8f('0x15')]()['then'](ami[_0xbb8f('0x1e')]())[_0xbb8f('0x18')](function(_0x371c16){logger[_0xbb8f('0x19')](_0xbb8f('0x1f'),util[_0xbb8f('0x1d')](_0x371c16,{'showHidden':![],'depth':null}));});}UserReport[_0xbb8f('0x20')][_0xbb8f('0x14')]=function(){setInterval(function(){BPromise[_0xbb8f('0x15')]()[_0xbb8f('0x16')](showSipRegistrations())[_0xbb8f('0x16')](listDeviceStates())[_0xbb8f('0x16')](showPeersStatus());},0x32c8);};UserReport[_0xbb8f('0x20')]['isNotNull']=function(_0x43cae8){return _0x43cae8!==null&&!_['isUndefined'](_0x43cae8);};UserReport['prototype'][_0xbb8f('0x21')]=function(_0x2b60da,_0x4f1d04,_0x3a4cb4){io['to'](_0x2b60da)[_0xbb8f('0x21')](_0x4f1d04,_0x3a4cb4);};UserReport[_0xbb8f('0x20')]['syncRegistry']=function(_0x2a06d9){try{if(this[_0xbb8f('0x22')](_0x2a06d9)){logger[_0xbb8f('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x2a06d9['username'],_0x2a06d9[_0xbb8f('0x24')]);logger[_0xbb8f('0x25')](_0xbb8f('0x26'),util[_0xbb8f('0x1d')](_0x2a06d9,{'showHidden':![],'depth':null}));var _0x553c3a=_[_0xbb8f('0x27')](this[_0xbb8f('0xa')],{'defaultuser':_0x2a06d9[_0xbb8f('0x28')]});if(_0x553c3a){_0x2a06d9['stateRegistry']=_0x2a06d9[_0xbb8f('0x24')];_[_0xbb8f('0x29')](_0x553c3a,_['omit'](_0x2a06d9,[_0xbb8f('0x2a'),'actionid','username',_0xbb8f('0x24')]));logger[_0xbb8f('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xbb8f('0x1d')](_0x553c3a,{'showHidden':![],'depth':null}));this['emit'](util[_0xbb8f('0x2b')](_0xbb8f('0x2c'),_0x553c3a[_0xbb8f('0x2d')]),_0xbb8f('0x2e'),_0x553c3a);}}}catch(_0x31eb6b){logger['error'](_0xbb8f('0x26'),util[_0xbb8f('0x1d')](_0x31eb6b,{'showHidden':![],'depth':null}));}};UserReport[_0xbb8f('0x20')][_0xbb8f('0x11')]=function(_0x1133b5){try{if(this[_0xbb8f('0x22')](_0x1133b5)){logger[_0xbb8f('0x23')](_0xbb8f('0x2f'),_0x1133b5['device'],_0x1133b5[_0xbb8f('0x24')]);logger['debug'](_0xbb8f('0x30'),util['inspect'](_0x1133b5,{'showHidden':![],'depth':null}));if(this[_0xbb8f('0xb')][_0x1133b5[_0xbb8f('0x31')]]){if(!this[_0xbb8f('0xb')][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x32')]||_0x1133b5[_0xbb8f('0x24')]['toLowerCase']()=='inuse'){this[_0xbb8f('0xb')][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x32')]=![];if(this[_0xbb8f('0xb')][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x24')]!==_0x1133b5['state']['toLowerCase']()){this['agents'][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x33')]=_[_0xbb8f('0x34')](moment()[_0xbb8f('0x2b')]('x'));}this[_0xbb8f('0xb')][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x24')]=_0x1133b5['state'][_0xbb8f('0x35')]();this[_0xbb8f('0xb')][_0x1133b5['device']][_0xbb8f('0x36')](_0x1133b5);}}else if(this[_0xbb8f('0xc')][_0x1133b5[_0xbb8f('0x31')]]){if(this[_0xbb8f('0xc')][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x24')]!==_0x1133b5[_0xbb8f('0x24')]['toLowerCase']()){this[_0xbb8f('0xc')][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x33')]=_[_0xbb8f('0x34')](moment()['format']('x'));}this[_0xbb8f('0xc')][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x24')]=_0x1133b5[_0xbb8f('0x24')]['toLowerCase']();logger[_0xbb8f('0x25')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x1133b5['device']],{'showHidden':![],'depth':null}));this[_0xbb8f('0x21')](util[_0xbb8f('0x2b')](_0xbb8f('0x37'),this['telephones'][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x2d')]),_0xbb8f('0x38'),this['telephones'][_0x1133b5[_0xbb8f('0x31')]]);}else if(this[_0xbb8f('0xa')][_0x1133b5[_0xbb8f('0x31')]]){if(this['trunks'][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x24')]!==_0x1133b5['state']['toLowerCase']()){this[_0xbb8f('0xa')][_0x1133b5['device']]['stateTime']=_[_0xbb8f('0x34')](moment()[_0xbb8f('0x2b')]('x'));}this[_0xbb8f('0xa')][_0x1133b5['device']][_0xbb8f('0x24')]=_0x1133b5[_0xbb8f('0x24')]['toLowerCase']();logger[_0xbb8f('0x25')](_0xbb8f('0x39'),util[_0xbb8f('0x1d')](this[_0xbb8f('0xa')][_0x1133b5[_0xbb8f('0x31')]],{'showHidden':![],'depth':null}));this[_0xbb8f('0x21')](util[_0xbb8f('0x2b')](_0xbb8f('0x2c'),this[_0xbb8f('0xa')][_0x1133b5[_0xbb8f('0x31')]][_0xbb8f('0x2d')]),_0xbb8f('0x2e'),this['trunks'][_0x1133b5[_0xbb8f('0x31')]]);}else if(_[_0xbb8f('0x3a')](_0x1133b5[_0xbb8f('0x31')],_0xbb8f('0x3b'))){var _0x37edd9=_0x1133b5[_0xbb8f('0x31')];var _0x24db62=_0x37edd9['substring'](_0x37edd9[_0xbb8f('0x3c')]('/')+0x1,_0x37edd9[_0xbb8f('0x3c')]('@'));var _0x23576b=_['find'](this[_0xbb8f('0xb')],function(_0x3de70d){return _0x3de70d['mobile']==_0x24db62||_0x3de70d[_0xbb8f('0x3d')]==_0x24db62||_0x3de70d[_0xbb8f('0x3e')]==_0x24db62;});if(_0x23576b){if(_0x23576b[_0xbb8f('0x24')]!==_0x1133b5['state'][_0xbb8f('0x35')]()){_0x23576b[_0xbb8f('0x33')]=_[_0xbb8f('0x34')](moment()[_0xbb8f('0x2b')]('x'));}_0x23576b[_0xbb8f('0x24')]=_0x1133b5[_0xbb8f('0x24')][_0xbb8f('0x35')]();_0x23576b['local']=!![];_0x23576b[_0xbb8f('0x36')](_0x1133b5);}}}}catch(_0x34f044){logger[_0xbb8f('0x19')](_0xbb8f('0x30'),util[_0xbb8f('0x1d')](_0x34f044,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x378335){try{if(this[_0xbb8f('0x22')](_0x378335)&&this[_0xbb8f('0x22')](_0x378335['peerstatus'])){logger[_0xbb8f('0x23')](_0xbb8f('0x3f'),_0x378335['peer'],_0x378335[_0xbb8f('0x40')],_0x378335['peerstatus']);logger['debug']('[userReport][peerstatus]',util[_0xbb8f('0x1d')](_0x378335,{'showHidden':![],'depth':null}));if(this[_0xbb8f('0xb')][_0x378335[_0xbb8f('0x41')]]){if(!this['agents'][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x32')]||_0x378335[_0xbb8f('0x12')]['toLowerCase']()==_0xbb8f('0x42')){this['agents'][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x32')]=![];this[_0xbb8f('0xb')][_0x378335['peer']][_0xbb8f('0x43')]=_0x378335[_0xbb8f('0x12')][_0xbb8f('0x35')]();this['agents'][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x40')]=_0x378335[_0xbb8f('0x40')];this[_0xbb8f('0xb')][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x36')](_0x378335);}}else if(this[_0xbb8f('0xc')][_0x378335[_0xbb8f('0x41')]]){this['telephones'][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x43')]=_0x378335[_0xbb8f('0x12')]['toLowerCase']();this[_0xbb8f('0xc')][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x40')]=_0x378335[_0xbb8f('0x40')];logger[_0xbb8f('0x25')](_0xbb8f('0x44'),util['inspect'](this[_0xbb8f('0xc')][_0x378335['peer']],{'showHidden':![],'depth':null}));this[_0xbb8f('0x21')](util[_0xbb8f('0x2b')](_0xbb8f('0x37'),this[_0xbb8f('0xc')][_0x378335['peer']][_0xbb8f('0x2d')]),'telephone:save',this[_0xbb8f('0xc')][_0x378335[_0xbb8f('0x41')]]);}else if(this[_0xbb8f('0xa')][_0x378335[_0xbb8f('0x41')]]){this[_0xbb8f('0xa')][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x43')]=_0x378335[_0xbb8f('0x12')][_0xbb8f('0x35')]();this[_0xbb8f('0xa')][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x40')]=_0x378335[_0xbb8f('0x40')];logger[_0xbb8f('0x25')](_0xbb8f('0x45'),util[_0xbb8f('0x1d')](this[_0xbb8f('0xa')][_0x378335[_0xbb8f('0x41')]],{'showHidden':![],'depth':null}));this[_0xbb8f('0x21')](util[_0xbb8f('0x2b')](_0xbb8f('0x2c'),this[_0xbb8f('0xa')][_0x378335[_0xbb8f('0x41')]][_0xbb8f('0x2d')]),'trunk:save',this['trunks'][_0x378335[_0xbb8f('0x41')]]);}}}catch(_0x2143e7){logger['error']('[userReport][peerstatus]',util[_0xbb8f('0x1d')](_0x2143e7,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xca2d=['resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','toNumber','stateTime','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','error','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','registry','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','[userReport][devicestatelist]'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xca2d,0xd0));var _0xdca2=function(_0x1c6a76,_0x5087e2){_0x1c6a76=_0x1c6a76-0x0;var _0x44933c=_0xca2d[_0x1c6a76];return _0x44933c;};'use strict';var _=require(_0xdca2('0x0'));var moment=require(_0xdca2('0x1'));var util=require(_0xdca2('0x2'));var Redis=require('ioredis');var BPromise=require(_0xdca2('0x3'));var config=require(_0xdca2('0x4'));var logger=require(_0xdca2('0x5'))(_0xdca2('0x6'));var ami=require(_0xdca2('0x7'));config[_0xdca2('0x8')]=_['defaults'](config[_0xdca2('0x8')],{'host':_0xdca2('0x9'),'port':0x18eb});var io=require(_0xdca2('0xa'))(new Redis(config[_0xdca2('0x8')]));function UserReport(_0x481c78){this[_0xdca2('0xb')]=_0x481c78[_0xdca2('0xb')];this[_0xdca2('0xc')]=_0x481c78[_0xdca2('0xc')];this['telephones']=_0x481c78[_0xdca2('0xd')];ami['on'](_0xdca2('0xe'),this['syncRegistry']['bind'](this));ami['on'](_0xdca2('0xf'),this[_0xdca2('0x10')][_0xdca2('0x11')](this));ami['on'](_0xdca2('0x12'),this[_0xdca2('0x13')][_0xdca2('0x11')](this));ami['on']('peerstatus',this[_0xdca2('0x14')][_0xdca2('0x11')](this));return this[_0xdca2('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0xdca2('0x16')](ami[_0xdca2('0x17')]())['catch'](function(_0x40af43){logger['error'](_0xdca2('0x18'),util[_0xdca2('0x19')](_0x40af43,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xdca2('0x16')](ami[_0xdca2('0x1a')]())[_0xdca2('0x1b')](function(_0x2614a4){logger['error'](_0xdca2('0x1c'),util[_0xdca2('0x19')](_0x2614a4,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xdca2('0x1d')]()[_0xdca2('0x16')](ami[_0xdca2('0x1e')]())['catch'](function(_0x252c40){logger['error'](_0xdca2('0x1f'),util[_0xdca2('0x19')](_0x252c40,{'showHidden':![],'depth':null}));});}UserReport[_0xdca2('0x20')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0xdca2('0x16')](showSipRegistrations())[_0xdca2('0x16')](listDeviceStates())[_0xdca2('0x16')](showPeersStatus());},0x32c8);};UserReport[_0xdca2('0x20')][_0xdca2('0x21')]=function(_0x885a95){return _0x885a95!==null&&!_[_0xdca2('0x22')](_0x885a95);};UserReport[_0xdca2('0x20')][_0xdca2('0x23')]=function(_0x43f9b1,_0x88b1bc,_0x1824a8){io['to'](_0x43f9b1)['emit'](_0x88b1bc,_0x1824a8);};UserReport['prototype'][_0xdca2('0x10')]=function(_0x25fdd7){try{if(this['isNotNull'](_0x25fdd7)){logger[_0xdca2('0x24')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x25fdd7[_0xdca2('0x25')],_0x25fdd7[_0xdca2('0x26')]);logger[_0xdca2('0x27')](_0xdca2('0x28'),util[_0xdca2('0x19')](_0x25fdd7,{'showHidden':![],'depth':null}));var _0x5aa7af=_[_0xdca2('0x29')](this[_0xdca2('0xb')],{'defaultuser':_0x25fdd7[_0xdca2('0x25')]});if(_0x5aa7af){_0x25fdd7[_0xdca2('0x2a')]=_0x25fdd7[_0xdca2('0x26')];_[_0xdca2('0x2b')](_0x5aa7af,_[_0xdca2('0x2c')](_0x25fdd7,[_0xdca2('0x2d'),'actionid',_0xdca2('0x25'),_0xdca2('0x26')]));logger[_0xdca2('0x27')](_0xdca2('0x2e'),util[_0xdca2('0x19')](_0x5aa7af,{'showHidden':![],'depth':null}));this[_0xdca2('0x23')](util[_0xdca2('0x2f')]('trunk:%s',_0x5aa7af['name']),_0xdca2('0x30'),_0x5aa7af);}}}catch(_0x3b0d41){logger['error']('[userReport][registry]',util[_0xdca2('0x19')](_0x3b0d41,{'showHidden':![],'depth':null}));}};UserReport[_0xdca2('0x20')][_0xdca2('0x13')]=function(_0x1f4fb1){try{if(this[_0xdca2('0x21')](_0x1f4fb1)){logger[_0xdca2('0x24')](_0xdca2('0x31'),_0x1f4fb1[_0xdca2('0x32')],_0x1f4fb1[_0xdca2('0x26')]);logger[_0xdca2('0x27')](_0xdca2('0x33'),util['inspect'](_0x1f4fb1,{'showHidden':![],'depth':null}));if(this[_0xdca2('0xc')][_0x1f4fb1[_0xdca2('0x32')]]){if(!this[_0xdca2('0xc')][_0x1f4fb1['device']][_0xdca2('0x34')]||_0x1f4fb1[_0xdca2('0x26')][_0xdca2('0x35')]()==_0xdca2('0x36')){this[_0xdca2('0xc')][_0x1f4fb1[_0xdca2('0x32')]][_0xdca2('0x34')]=![];if(this['agents'][_0x1f4fb1['device']][_0xdca2('0x26')]!==_0x1f4fb1[_0xdca2('0x26')][_0xdca2('0x35')]()){this['agents'][_0x1f4fb1[_0xdca2('0x32')]]['stateTime']=_[_0xdca2('0x37')](moment()[_0xdca2('0x2f')]('x'));}this[_0xdca2('0xc')][_0x1f4fb1[_0xdca2('0x32')]]['state']=_0x1f4fb1['state'][_0xdca2('0x35')]();this[_0xdca2('0xc')][_0x1f4fb1[_0xdca2('0x32')]]['updateStatusRealtime'](_0x1f4fb1);}}else if(this[_0xdca2('0xd')][_0x1f4fb1['device']]){if(this['telephones'][_0x1f4fb1[_0xdca2('0x32')]][_0xdca2('0x26')]!==_0x1f4fb1[_0xdca2('0x26')]['toLowerCase']()){this[_0xdca2('0xd')][_0x1f4fb1[_0xdca2('0x32')]][_0xdca2('0x38')]=_['toNumber'](moment()[_0xdca2('0x2f')]('x'));}this[_0xdca2('0xd')][_0x1f4fb1[_0xdca2('0x32')]][_0xdca2('0x26')]=_0x1f4fb1[_0xdca2('0x26')][_0xdca2('0x35')]();logger[_0xdca2('0x27')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xdca2('0x19')](this[_0xdca2('0xd')][_0x1f4fb1[_0xdca2('0x32')]],{'showHidden':![],'depth':null}));this[_0xdca2('0x23')](util['format']('telephone:%s',this['telephones'][_0x1f4fb1[_0xdca2('0x32')]][_0xdca2('0x39')]),_0xdca2('0x3a'),this[_0xdca2('0xd')][_0x1f4fb1[_0xdca2('0x32')]]);}else if(this[_0xdca2('0xb')][_0x1f4fb1[_0xdca2('0x32')]]){if(this[_0xdca2('0xb')][_0x1f4fb1[_0xdca2('0x32')]]['state']!==_0x1f4fb1['state']['toLowerCase']()){this[_0xdca2('0xb')][_0x1f4fb1[_0xdca2('0x32')]]['stateTime']=_[_0xdca2('0x37')](moment()[_0xdca2('0x2f')]('x'));}this[_0xdca2('0xb')][_0x1f4fb1[_0xdca2('0x32')]][_0xdca2('0x26')]=_0x1f4fb1[_0xdca2('0x26')]['toLowerCase']();logger[_0xdca2('0x27')](_0xdca2('0x3b'),util[_0xdca2('0x19')](this[_0xdca2('0xb')][_0x1f4fb1[_0xdca2('0x32')]],{'showHidden':![],'depth':null}));this[_0xdca2('0x23')](util[_0xdca2('0x2f')]('trunk:%s',this[_0xdca2('0xb')][_0x1f4fb1[_0xdca2('0x32')]][_0xdca2('0x39')]),_0xdca2('0x30'),this[_0xdca2('0xb')][_0x1f4fb1[_0xdca2('0x32')]]);}else if(_[_0xdca2('0x3c')](_0x1f4fb1['device'],_0xdca2('0x3d'))){var _0x4df1da=_0x1f4fb1['device'];var _0x3e0aac=_0x4df1da[_0xdca2('0x3e')](_0x4df1da[_0xdca2('0x3f')]('/')+0x1,_0x4df1da[_0xdca2('0x3f')]('@'));var _0x30a7ba=_[_0xdca2('0x29')](this[_0xdca2('0xc')],function(_0x3203a2){return _0x3203a2[_0xdca2('0x40')]==_0x3e0aac||_0x3203a2[_0xdca2('0x41')]==_0x3e0aac||_0x3203a2[_0xdca2('0x42')]==_0x3e0aac;});if(_0x30a7ba){if(_0x30a7ba[_0xdca2('0x26')]!==_0x1f4fb1[_0xdca2('0x26')][_0xdca2('0x35')]()){_0x30a7ba[_0xdca2('0x38')]=_[_0xdca2('0x37')](moment()[_0xdca2('0x2f')]('x'));}_0x30a7ba[_0xdca2('0x26')]=_0x1f4fb1['state'][_0xdca2('0x35')]();_0x30a7ba[_0xdca2('0x34')]=!![];_0x30a7ba[_0xdca2('0x43')](_0x1f4fb1);}}}}catch(_0xf83646){logger['error'](_0xdca2('0x33'),util[_0xdca2('0x19')](_0xf83646,{'showHidden':![],'depth':null}));}};UserReport[_0xdca2('0x20')][_0xdca2('0x14')]=function(_0x4cf901){try{if(this[_0xdca2('0x21')](_0x4cf901)&&this[_0xdca2('0x21')](_0x4cf901[_0xdca2('0x44')])){logger[_0xdca2('0x24')](_0xdca2('0x45'),_0x4cf901['peer'],_0x4cf901[_0xdca2('0x46')],_0x4cf901[_0xdca2('0x44')]);logger['debug'](_0xdca2('0x47'),util[_0xdca2('0x19')](_0x4cf901,{'showHidden':![],'depth':null}));if(this['agents'][_0x4cf901[_0xdca2('0x48')]]){if(!this['agents'][_0x4cf901[_0xdca2('0x48')]]['local']||_0x4cf901['peerstatus'][_0xdca2('0x35')]()==_0xdca2('0x49')){this[_0xdca2('0xc')][_0x4cf901[_0xdca2('0x48')]][_0xdca2('0x34')]=![];this[_0xdca2('0xc')][_0x4cf901[_0xdca2('0x48')]][_0xdca2('0x4a')]=_0x4cf901[_0xdca2('0x44')][_0xdca2('0x35')]();this['agents'][_0x4cf901[_0xdca2('0x48')]][_0xdca2('0x46')]=_0x4cf901[_0xdca2('0x46')];this[_0xdca2('0xc')][_0x4cf901[_0xdca2('0x48')]][_0xdca2('0x43')](_0x4cf901);}}else if(this[_0xdca2('0xd')][_0x4cf901[_0xdca2('0x48')]]){this['telephones'][_0x4cf901[_0xdca2('0x48')]][_0xdca2('0x4a')]=_0x4cf901[_0xdca2('0x44')][_0xdca2('0x35')]();this[_0xdca2('0xd')][_0x4cf901[_0xdca2('0x48')]][_0xdca2('0x46')]=_0x4cf901[_0xdca2('0x46')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0xdca2('0xd')][_0x4cf901[_0xdca2('0x48')]],{'showHidden':![],'depth':null}));this[_0xdca2('0x23')](util['format'](_0xdca2('0x4b'),this[_0xdca2('0xd')][_0x4cf901['peer']][_0xdca2('0x39')]),_0xdca2('0x3a'),this['telephones'][_0x4cf901[_0xdca2('0x48')]]);}else if(this[_0xdca2('0xb')][_0x4cf901['peer']]){this[_0xdca2('0xb')][_0x4cf901[_0xdca2('0x48')]][_0xdca2('0x4a')]=_0x4cf901[_0xdca2('0x44')][_0xdca2('0x35')]();this[_0xdca2('0xb')][_0x4cf901[_0xdca2('0x48')]]['address']=_0x4cf901['address'];logger[_0xdca2('0x27')](_0xdca2('0x4c'),util[_0xdca2('0x19')](this[_0xdca2('0xb')][_0x4cf901['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xdca2('0x2f')](_0xdca2('0x4d'),this[_0xdca2('0xb')][_0x4cf901['peer']][_0xdca2('0x39')]),_0xdca2('0x30'),this[_0xdca2('0xb')][_0x4cf901[_0xdca2('0x48')]]);}}}catch(_0x1b1c44){logger[_0xdca2('0x4e')]('[userReport][peerstatus]',util[_0xdca2('0x19')](_0x1b1c44,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 47166df..91deece 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac48=['lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','bind','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','syncAgentCalled','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','isUndefined','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','assign','omit','event','privilege','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','error','hasOwnProperty','info','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','merge','pick','name','accountcode','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','user:%s','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xac48,0x1e9));var _0x8ac4=function(_0x58b29d,_0x202065){_0x58b29d=_0x58b29d-0x0;var _0x49594e=_0xac48[_0x58b29d];return _0x49594e;};'use strict';var _=require(_0x8ac4('0x0'));var moment=require('moment');var util=require(_0x8ac4('0x1'));var Redis=require(_0x8ac4('0x2'));var config=require(_0x8ac4('0x3'));var logger=require(_0x8ac4('0x4'))(_0x8ac4('0x5'));var ami=require(_0x8ac4('0x6'));config[_0x8ac4('0x7')]=_[_0x8ac4('0x8')](config[_0x8ac4('0x7')],{'host':_0x8ac4('0x9'),'port':0x18eb});var io=require(_0x8ac4('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x3efc03){this[_0x8ac4('0xb')]={};this[_0x8ac4('0xc')]=_0x3efc03[_0x8ac4('0xb')];this[_0x8ac4('0xd')]=_0x3efc03['voiceQueues'];this['agents']=_0x3efc03[_0x8ac4('0xe')];this[_0x8ac4('0xf')]={};ami['on'](_0x8ac4('0x10'),this['syncAgentCalled']['bind'](this));ami['on'](_0x8ac4('0x11'),this[_0x8ac4('0x12')]['bind'](this));ami['on'](_0x8ac4('0x13'),this[_0x8ac4('0x14')]['bind'](this));ami['on'](_0x8ac4('0x15'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x8ac4('0x16'),this[_0x8ac4('0x17')][_0x8ac4('0x18')](this));ami['on']('varset',this[_0x8ac4('0x19')][_0x8ac4('0x18')](this));ami['on'](_0x8ac4('0x1a'),this[_0x8ac4('0x1b')]['bind'](this));ami['on'](_0x8ac4('0x1c'),this[_0x8ac4('0x1d')][_0x8ac4('0x18')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x8ac4('0x1e'),this['syncAttendedTransfer'][_0x8ac4('0x18')](this));ami['on'](_0x8ac4('0x1f'),this[_0x8ac4('0x20')][_0x8ac4('0x18')](this));}VoiceAgentReport[_0x8ac4('0x21')][_0x8ac4('0x22')]=function(_0x2bcc37,_0x25513c,_0x4ffad4){io['to'](_0x2bcc37)[_0x8ac4('0x22')](_0x25513c,_0x4ffad4);};VoiceAgentReport['prototype'][_0x8ac4('0x23')]=function(_0x3eeef5){return _0x3eeef5!==null&&!_['isUndefined'](_0x3eeef5);};VoiceAgentReport['prototype'][_0x8ac4('0x24')]=function(_0x587a55){try{if(this[_0x8ac4('0x23')](_0x587a55)){logger['info'](_0x8ac4('0x25'),_0x587a55['uniqueid'],_0x587a55[_0x8ac4('0x26')],_0x587a55[_0x8ac4('0x27')]);logger[_0x8ac4('0x28')](_0x8ac4('0x29'),_0x587a55[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x587a55,{'showHidden':![],'depth':null}));if(_[_0x8ac4('0x2c')](this['channels'][_0x587a55[_0x8ac4('0x2a')]])){this['channels'][_0x587a55[_0x8ac4('0x2a')]]={};}var _0x513f9e=this['agents'][_0x587a55[_0x8ac4('0x2d')]];var _0x3ffdc5=this['channels'][_0x587a55['uniqueid']][_0x587a55[_0x8ac4('0x27')]];var _0x3eec42=this[_0x8ac4('0xd')][_0x587a55[_0x8ac4('0x2e')]];var _0x16426d=this[_0x8ac4('0xf')][_0x587a55[_0x8ac4('0x2a')]];if(_['isUndefined'](_0x3ffdc5)){_0x3ffdc5={'agentcalledAt':moment()[_0x8ac4('0x2f')](_0x8ac4('0x30')),'lastevent':_0x8ac4('0x31'),'mandatoryDisposition':_0x3eec42&&_0x3eec42[_0x8ac4('0x32')]?_0x3eec42[_0x8ac4('0x32')]:![],'type':_0x3eec42&&_0x3eec42[_0x8ac4('0x33')]?_0x3eec42['type']:_0x8ac4('0x34'),'variables':_0x16426d,'motionChannel':'voice'};}Object[_0x8ac4('0x35')](_0x3ffdc5,_[_0x8ac4('0x36')](_0x587a55,[_0x8ac4('0x37'),_0x8ac4('0x38')]));this[_0x8ac4('0xb')][_0x587a55[_0x8ac4('0x2a')]][_0x587a55['destuniqueid']]=_0x3ffdc5;logger[_0x8ac4('0x28')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x587a55[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x3ffdc5,{'showHidden':![],'depth':null}));ami[_0x8ac4('0x22')](_0x8ac4('0x39'),_0x3ffdc5);var _0x16c402={'id':_0x513f9e['id'],'calleridnum':_0x3ffdc5[_0x8ac4('0x3a')],'queue':_0x3ffdc5[_0x8ac4('0x2e')],'variables':_0x3ffdc5[_0x8ac4('0xf')],'uniqueid':_0x587a55['uniqueid']};logger[_0x8ac4('0x28')](_0x8ac4('0x3b'),_0x587a55[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x16c402,{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x587a55[_0x8ac4('0x26')]),'user:called',_0x16c402);}}catch(_0x1dc5ce){logger[_0x8ac4('0x3c')]('[%s][voiceAgentReport][agentcalled]',_0x587a55['uniqueid'],util[_0x8ac4('0x2b')](_0x1dc5ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8ac4('0x21')][_0x8ac4('0x12')]=function(_0xdb87e5){try{if(this['isNotNull'](_0xdb87e5)){if(this['channels'][_0xdb87e5[_0x8ac4('0x2a')]]){for(var _0x43ca79 in this['channels'][_0xdb87e5['uniqueid']]){if(this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x8ac4('0x3d')](_0x43ca79)){if(_0xdb87e5[_0x8ac4('0x27')]===_0x43ca79){logger[_0x8ac4('0x3e')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0xdb87e5[_0x8ac4('0x2a')],_0xdb87e5[_0x8ac4('0x26')],_0xdb87e5[_0x8ac4('0x27')]);this['channels'][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x3f')]=moment()[_0x8ac4('0x2f')](_0x8ac4('0x30'));this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x40')]=_0xdb87e5[_0x8ac4('0x40')];this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x41')]=_0xdb87e5[_0x8ac4('0x41')];this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x42')]=_0xdb87e5[_0x8ac4('0x42')];this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x43')]=_0xdb87e5[_0x8ac4('0x43')];this[_0x8ac4('0xb')][_0xdb87e5['uniqueid']][_0x43ca79][_0x8ac4('0x44')]=_0xdb87e5['holdtime'];this[_0x8ac4('0xb')][_0xdb87e5['uniqueid']][_0x43ca79]['lastevent']=_0x8ac4('0x45');if(this['voiceChannels'][this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x2a')]]){var _0x58789d=this[_0x8ac4('0xc')][this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x2a')]]['routealias'];this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x46')]=_0x58789d;_0xdb87e5[_0x8ac4('0x46')]=_0x58789d;}_[_0x8ac4('0x47')](this[_0x8ac4('0xe')][_0xdb87e5[_0x8ac4('0x2d')]],_[_0x8ac4('0x48')](_0xdb87e5,[_0x8ac4('0x2e'),'destconnectedlinenum',_0x8ac4('0x46')]));var _0x14fd2b=this[_0x8ac4('0xe')][_0xdb87e5[_0x8ac4('0x2d')]];var _0x305d7b={'id':_0x14fd2b['id'],'name':_0x14fd2b[_0x8ac4('0x49')],'agentconnected':!![],'destaccountcode':_0x14fd2b[_0x8ac4('0x4a')],'destconnectedlinenum':this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0xdb87e5['destuniqueid']]['exten'],'queue':this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0xdb87e5['destuniqueid']][_0x8ac4('0x2e')],'routealias':this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0xdb87e5[_0x8ac4('0x27')]][_0x8ac4('0x46')],'uniqueid':this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0xdb87e5['destuniqueid']][_0x8ac4('0x2a')]};ami[_0x8ac4('0x22')](_0x8ac4('0x4b'),this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0xdb87e5[_0x8ac4('0x27')]]);this[_0x8ac4('0x22')](util['format']('user:%s',_0xdb87e5[_0x8ac4('0x26')]),_0x8ac4('0x4c'),_0x305d7b);}else if(!this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79]['agentringnoanswer']&&!this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x16')]){logger[_0x8ac4('0x3e')](_0x8ac4('0x4d'),_0xdb87e5[_0x8ac4('0x2a')],this[_0x8ac4('0xb')][_0xdb87e5['uniqueid']][_0x43ca79][_0x8ac4('0x26')],_0x43ca79);this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x13')]=!![];this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79]['agentringnoanswerAt']=moment()['format'](_0x8ac4('0x30'));this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x4e')]=_0xdb87e5[_0x8ac4('0x27')];this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79]['answeredelsewheremembername']=_0xdb87e5[_0x8ac4('0x26')];this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x4f')]=_0x8ac4('0x50');this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79][_0x8ac4('0x51')]='answered_elsewhere';logger[_0x8ac4('0x28')](_0x8ac4('0x52'),_0xdb87e5[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](this[_0x8ac4('0xb')][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79],{'showHidden':![],'depth':null}));ami[_0x8ac4('0x22')](_0x8ac4('0x53'),this['channels'][_0xdb87e5[_0x8ac4('0x2a')]][_0x43ca79]);}else{logger[_0x8ac4('0x28')](_0x8ac4('0x54'),_0xdb87e5['uniqueid']);}}}}}}catch(_0x2dff89){logger[_0x8ac4('0x3c')](_0x8ac4('0x55'),_0xdb87e5['uniqueid'],util['inspect'](_0x2dff89,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x2e00ca){try{if(this[_0x8ac4('0x23')](_0x2e00ca)){logger[_0x8ac4('0x28')](_0x8ac4('0x56'),_0x2e00ca[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x2e00ca,{'showHidden':![],'depth':null}));if(this[_0x8ac4('0xb')][_0x2e00ca[_0x8ac4('0x2a')]]&&this[_0x8ac4('0xb')][_0x2e00ca[_0x8ac4('0x2a')]][_0x2e00ca[_0x8ac4('0x27')]]){logger[_0x8ac4('0x3e')](_0x8ac4('0x57'),_0x2e00ca['uniqueid'],_0x2e00ca['membername'],_0x2e00ca[_0x8ac4('0x27')]);var _0x58278a=this['agents'][_0x2e00ca[_0x8ac4('0x2d')]];var _0x4d8b5a=this[_0x8ac4('0xb')][_0x2e00ca[_0x8ac4('0x2a')]][_0x2e00ca[_0x8ac4('0x27')]];_0x4d8b5a['agentringnoanswer']=!![];_0x4d8b5a[_0x8ac4('0x58')]=moment()[_0x8ac4('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d8b5a[_0x8ac4('0x4f')]=_0x8ac4('0x59');_0x4d8b5a[_0x8ac4('0x51')]=_0x8ac4('0x59');var _0x230791={'id':_0x58278a['id'],'name':_0x58278a[_0x8ac4('0x49')],'queue':_0x4d8b5a[_0x8ac4('0x2e')],'uniqueid':_0x4d8b5a[_0x8ac4('0x2a')]};logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x2e00ca['uniqueid'],util[_0x8ac4('0x2b')](_0x230791,{'showHidden':![],'depth':null}));this[_0x8ac4('0x22')](util[_0x8ac4('0x2f')](_0x8ac4('0x5a'),_0x58278a[_0x8ac4('0x49')]),_0x8ac4('0x5b'),_0x230791);ami[_0x8ac4('0x22')]('custom:agentringnoanswer',_0x4d8b5a);this[_0x8ac4('0xb')][_0x2e00ca['uniqueid']][_0x2e00ca[_0x8ac4('0x27')]]=Object['assign']({},_0x4d8b5a);}}}catch(_0x28deff){logger[_0x8ac4('0x3c')](_0x8ac4('0x5c'),_0x2e00ca['uniqueid'],util[_0x8ac4('0x2b')](_0x28deff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8ac4('0x21')][_0x8ac4('0x5d')]=function(_0x5550c2){try{if(this['isNotNull'](_0x5550c2)){logger[_0x8ac4('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x5550c2[_0x8ac4('0x2a')],util['inspect'](_0x5550c2,{'showHidden':![],'depth':null}));if(this[_0x8ac4('0xb')][_0x5550c2['uniqueid']]){for(var _0x157055 in this['channels'][_0x5550c2[_0x8ac4('0x2a')]]){if(this['channels'][_0x5550c2[_0x8ac4('0x2a')]][_0x8ac4('0x3d')](_0x157055)&&!this[_0x8ac4('0xb')][_0x5550c2[_0x8ac4('0x2a')]][_0x157055][_0x8ac4('0x13')]&&!this[_0x8ac4('0xb')][_0x5550c2[_0x8ac4('0x2a')]][_0x157055]['agentcomplete']){logger[_0x8ac4('0x3e')](_0x8ac4('0x5e'),_0x5550c2[_0x8ac4('0x2a')],this['channels'][_0x5550c2['uniqueid']][_0x157055]['membername'],_0x157055);this[_0x8ac4('0xb')][_0x5550c2[_0x8ac4('0x2a')]][_0x157055]['agentringnoanswer']=!![];this[_0x8ac4('0xb')][_0x5550c2[_0x8ac4('0x2a')]][_0x157055]['agentringnoanswerAt']=moment()[_0x8ac4('0x2f')](_0x8ac4('0x30'));this[_0x8ac4('0xb')][_0x5550c2[_0x8ac4('0x2a')]][_0x157055]['lastevent']=_0x8ac4('0x5f');this[_0x8ac4('0xb')][_0x5550c2[_0x8ac4('0x2a')]][_0x157055][_0x8ac4('0x51')]='abandoned';logger['debug'](_0x8ac4('0x60'),_0x5550c2[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](this[_0x8ac4('0xb')][_0x5550c2[_0x8ac4('0x2a')]][_0x157055],{'showHidden':![],'depth':null}));ami[_0x8ac4('0x22')](_0x8ac4('0x61'),this['channels'][_0x5550c2[_0x8ac4('0x2a')]][_0x157055]);}}}}}catch(_0x2c6398){logger[_0x8ac4('0x3c')](_0x8ac4('0x62'),_0x5550c2['uniqueid'],util['inspect'](_0x2c6398,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8ac4('0x21')][_0x8ac4('0x17')]=function(_0x4c2364){try{if(this['isNotNull'](_0x4c2364)){logger[_0x8ac4('0x28')](_0x8ac4('0x63'),_0x4c2364[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x4c2364,{'showHidden':![],'depth':null}));if(this[_0x8ac4('0xb')][_0x4c2364['uniqueid']]){for(var _0x506ea4 in this[_0x8ac4('0xb')][_0x4c2364[_0x8ac4('0x2a')]]){if(this[_0x8ac4('0xb')][_0x4c2364[_0x8ac4('0x2a')]][_0x8ac4('0x3d')](_0x506ea4)){if(this[_0x8ac4('0xb')][_0x4c2364['uniqueid']][_0x506ea4]['agentconnectAt']&&!this['channels'][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4]['agentcomplete']){logger[_0x8ac4('0x3e')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4c2364[_0x8ac4('0x2a')],this[_0x8ac4('0xb')][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4]['membername'],_0x506ea4);this[_0x8ac4('0xb')][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4]['agentcomplete']=!![];this['channels'][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4][_0x8ac4('0x64')]=moment()[_0x8ac4('0x2f')](_0x8ac4('0x30'));this['channels'][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4][_0x8ac4('0x4f')]=_0x8ac4('0x65');this[_0x8ac4('0xb')][_0x4c2364['uniqueid']][_0x506ea4][_0x8ac4('0x51')]=_0x4c2364[_0x8ac4('0x51')]==_0x8ac4('0x66')?_0x8ac4('0x67'):_0x4c2364['reason'];this[_0x8ac4('0xb')][_0x4c2364['uniqueid']][_0x506ea4][_0x8ac4('0x68')]=_0x4c2364[_0x8ac4('0x68')];if(this['voiceQueues'][_0x4c2364['queue']]&&this[_0x8ac4('0xd')][_0x4c2364[_0x8ac4('0x2e')]][_0x8ac4('0x69')]){this['channels'][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4][_0x8ac4('0x6a')]=this['voiceQueues'][_0x4c2364[_0x8ac4('0x2e')]]['acwTimeout'];this[_0x8ac4('0xb')][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4][_0x8ac4('0x6b')]=!![];}this[_0x8ac4('0xe')][_0x4c2364[_0x8ac4('0x2d')]]=_[_0x8ac4('0x36')](this[_0x8ac4('0xe')][_0x4c2364[_0x8ac4('0x2d')]],['queue','destconnectedlinenum']);logger[_0x8ac4('0x28')](_0x8ac4('0x6c'),_0x4c2364[_0x8ac4('0x2a')],util['inspect'](this[_0x8ac4('0xb')][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x8ac4('0xb')][_0x4c2364[_0x8ac4('0x2a')]][_0x506ea4]);logger['debug'](_0x8ac4('0x6d'),_0x4c2364[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')]({'id':this['agents'][_0x4c2364[_0x8ac4('0x2d')]]['id'],'destaccountcode':_0x4c2364['destaccountcode']},{'showHidden':![],'depth':null}));this[_0x8ac4('0x22')](util[_0x8ac4('0x2f')]('user:%s',_0x4c2364[_0x8ac4('0x26')]),_0x8ac4('0x6e'),{'id':this['agents'][_0x4c2364[_0x8ac4('0x2d')]]['id'],'destaccountcode':Number(_0x4c2364[_0x8ac4('0x6f')])});}}}}}}catch(_0x358462){logger[_0x8ac4('0x3c')](_0x8ac4('0x70'),_0x4c2364[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x358462,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8ac4('0x21')][_0x8ac4('0x19')]=function(_0x3736b2){try{if(this[_0x8ac4('0x23')](_0x3736b2)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x3736b2[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x3736b2,{'showHidden':![],'depth':null}));this[_0x8ac4('0x71')](_0x3736b2['uniqueid'],_[_0x8ac4('0x72')](_0x3736b2['variable'])[0x0],_0x3736b2['value']);if(this[_0x8ac4('0xb')][_0x3736b2['uniqueid']]){for(var _0x245b30 in this[_0x8ac4('0xb')][_0x3736b2[_0x8ac4('0x2a')]]){if(this[_0x8ac4('0xb')][_0x3736b2[_0x8ac4('0x2a')]][_0x8ac4('0x3d')](_0x245b30)){logger['info'](_0x8ac4('0x73'),_0x3736b2[_0x8ac4('0x2a')],_0x245b30,_[_0x8ac4('0x72')](_0x3736b2[_0x8ac4('0x74')])[0x0],_0x3736b2[_0x8ac4('0x75')]);if(_[_0x8ac4('0x2c')](this[_0x8ac4('0xb')][_0x3736b2[_0x8ac4('0x2a')]][_0x245b30][_0x8ac4('0xf')])){this[_0x8ac4('0xb')][_0x3736b2[_0x8ac4('0x2a')]][_0x245b30][_0x8ac4('0xf')]={};}this[_0x8ac4('0xb')][_0x3736b2['uniqueid']][_0x245b30]['variables']=this[_0x8ac4('0xf')][_0x3736b2[_0x8ac4('0x2a')]];}}}}}catch(_0x270ba7){logger[_0x8ac4('0x3c')](_0x8ac4('0x76'),_0x3736b2['uniqueid'],util[_0x8ac4('0x2b')](_0x270ba7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8ac4('0x21')]['addVariable']=function(_0x5c8183,_0x55fe61,_0x1e9982){var _0x44af9f=[_0x8ac4('0x77'),_0x8ac4('0x78'),_0x8ac4('0x79'),_0x8ac4('0x7a'),_0x8ac4('0x7b'),_0x8ac4('0x7c'),_0x8ac4('0x7d'),_0x8ac4('0x7e'),_0x8ac4('0x7f'),'sipuri',_0x8ac4('0x80'),_0x8ac4('0x81'),_0x8ac4('0x82'),_0x8ac4('0x83'),'memberinterface','memberlastcall',_0x8ac4('0x26'),_0x8ac4('0x84'),_0x8ac4('0x85')];if(!_[_0x8ac4('0x86')](_0x55fe61)&&!_[_0x8ac4('0x87')](_0x44af9f,_0x55fe61)){if(_['isUndefined'](this['variables'][_0x5c8183])){this['variables'][_0x5c8183]={};}this[_0x8ac4('0xf')][_0x5c8183][_0x55fe61]=_0x1e9982;}};VoiceAgentReport[_0x8ac4('0x21')]['syncHangup']=function(_0x365d40){try{if(this[_0x8ac4('0x23')](_0x365d40)){logger[_0x8ac4('0x28')](_0x8ac4('0x88'),_0x365d40[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x365d40,{'showHidden':![],'depth':null}));if(this[_0x8ac4('0xb')][_0x365d40[_0x8ac4('0x2a')]]){for(var _0x700103 in this[_0x8ac4('0xb')][_0x365d40[_0x8ac4('0x2a')]]){if(this[_0x8ac4('0xb')][_0x365d40[_0x8ac4('0x2a')]]['hasOwnProperty'](_0x700103)){if(this[_0x8ac4('0xb')][_0x365d40['uniqueid']][_0x700103][_0x8ac4('0x51')]==_0x8ac4('0x66')&&this[_0x8ac4('0xb')][_0x365d40[_0x8ac4('0x2a')]][_0x700103]['agentcomplete']){logger['info'](_0x8ac4('0x89'),_0x365d40['uniqueid'],_0x700103);this['channels'][_0x365d40[_0x8ac4('0x2a')]][_0x700103][_0x8ac4('0x64')]=moment()[_0x8ac4('0x2f')](_0x8ac4('0x30'));}}}logger[_0x8ac4('0x28')](_0x8ac4('0x8a'),_0x365d40[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_[_0x8ac4('0x8b')](this[_0x8ac4('0xb')][_0x365d40[_0x8ac4('0x2a')]]),{'showHidden':![],'depth':null}));ami[_0x8ac4('0x22')](_0x8ac4('0x8c'),_[_0x8ac4('0x8b')](this['channels'][_0x365d40['uniqueid']]));delete this[_0x8ac4('0xb')][_0x365d40[_0x8ac4('0x2a')]];}if(this[_0x8ac4('0xf')][_0x365d40['uniqueid']]){delete this['variables'][_0x365d40[_0x8ac4('0x2a')]];}}}catch(_0x520eb5){logger[_0x8ac4('0x3c')](_0x8ac4('0x8d'),_0x365d40[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x520eb5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8ac4('0x21')][_0x8ac4('0x8e')]=function(_0x468051){try{if(this[_0x8ac4('0x23')](_0x468051)){logger[_0x8ac4('0x28')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x468051[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x468051,{'showHidden':![],'depth':null}));if(this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x8f')]]){for(var _0x3c397c in this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x8f')]]){if(this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x8f')]][_0x8ac4('0x3d')](_0x3c397c)){if(_0x468051['origtransfereruniqueid']===_0x3c397c){logger[_0x8ac4('0x3e')](_0x8ac4('0x90'),_0x468051[_0x8ac4('0x2a')],this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x8f')]][_0x3c397c][_0x8ac4('0x26')],_0x3c397c);var _0x4eaa74=moment();this[_0x8ac4('0xb')][_0x468051['transfereeuniqueid']][_0x3c397c][_0x8ac4('0x16')]=!![];this['channels'][_0x468051['transfereeuniqueid']][_0x3c397c][_0x8ac4('0x64')]=moment()[_0x8ac4('0x2f')](_0x8ac4('0x30'));this[_0x8ac4('0xb')][_0x468051['transfereeuniqueid']][_0x3c397c][_0x8ac4('0x4f')]='complete';this[_0x8ac4('0xb')][_0x468051['transfereeuniqueid']][_0x3c397c][_0x8ac4('0x51')]=_0x8ac4('0x66');this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x8f')]][_0x3c397c][_0x8ac4('0x68')]=_0x4eaa74[_0x8ac4('0x91')](this['channels'][_0x468051[_0x8ac4('0x8f')]][_0x3c397c]['agentconnectAt'],_0x8ac4('0x92'));}}}}if(this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x93')]]){var _0x55b261=this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x93')]];this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x93')]]=this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x8f')]];this[_0x8ac4('0xb')][_0x468051[_0x8ac4('0x8f')]]=_0x55b261;}}}catch(_0x302516){logger[_0x8ac4('0x3c')](_0x8ac4('0x94'),_0x468051[_0x8ac4('0x2a')],util['inspect'](_0x302516,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8ac4('0x21')][_0x8ac4('0x20')]=function(_0x276ad1){try{if(this['isNotNull'](_0x276ad1)){logger[_0x8ac4('0x28')](_0x8ac4('0x95'),_0x276ad1[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x276ad1,{'showHidden':![],'depth':null}));if(this[_0x8ac4('0xb')][_0x276ad1['transfereeuniqueid']]){for(var _0x5b619b in this[_0x8ac4('0xb')][_0x276ad1[_0x8ac4('0x8f')]]){if(this['channels'][_0x276ad1['transfereeuniqueid']][_0x8ac4('0x3d')](_0x5b619b)){if(_0x276ad1[_0x8ac4('0x96')]===_0x5b619b){logger[_0x8ac4('0x3e')](_0x8ac4('0x97'),_0x276ad1[_0x8ac4('0x2a')],this[_0x8ac4('0xb')][_0x276ad1[_0x8ac4('0x8f')]][_0x5b619b][_0x8ac4('0x26')],_0x5b619b);var _0x19989c=moment();this[_0x8ac4('0xb')][_0x276ad1[_0x8ac4('0x8f')]][_0x5b619b][_0x8ac4('0x16')]=!![];this['channels'][_0x276ad1[_0x8ac4('0x8f')]][_0x5b619b][_0x8ac4('0x64')]=_0x19989c;this[_0x8ac4('0xb')][_0x276ad1['transfereeuniqueid']][_0x5b619b][_0x8ac4('0x4f')]=_0x8ac4('0x65');this[_0x8ac4('0xb')][_0x276ad1['transfereeuniqueid']][_0x5b619b][_0x8ac4('0x51')]=_0x8ac4('0x66');this[_0x8ac4('0xb')][_0x276ad1['transfereeuniqueid']][_0x5b619b][_0x8ac4('0x68')]=_0x19989c[_0x8ac4('0x91')](this[_0x8ac4('0xb')][_0x276ad1[_0x8ac4('0x8f')]][_0x5b619b][_0x8ac4('0x3f')],_0x8ac4('0x92'));}}}}}}catch(_0x492195){logger[_0x8ac4('0x3c')](_0x8ac4('0x98'),_0x276ad1[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x492195,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x4cf509){var _0x154ba4='';try{if(this[_0x8ac4('0x23')](_0x4cf509)){logger['debug'](_0x8ac4('0x99'),_0x4cf509[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x4cf509,{'showHidden':![],'depth':null}));if(_0x4cf509[_0x8ac4('0x9a')]){_0x154ba4=_0x4cf509[_0x8ac4('0x9a')]['substring'](0x0,_0x4cf509[_0x8ac4('0x9a')][_0x8ac4('0x9b')]('-'));if(this['agents'][_0x154ba4]){logger[_0x8ac4('0x3e')](_0x8ac4('0x9c'),_0x4cf509[_0x8ac4('0x2a')],_0x154ba4);this['agents'][_0x154ba4][_0x8ac4('0x9d')]=!![];}}}}catch(_0x4fd099){logger['error'](_0x8ac4('0x9e'),_0x4cf509[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x4fd099,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8ac4('0x21')][_0x8ac4('0x9f')]=function(_0x2e9604){var _0x269937='';try{if(this[_0x8ac4('0x23')](_0x2e9604)){logger[_0x8ac4('0x28')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x2e9604[_0x8ac4('0x2a')],util['inspect'](_0x2e9604,{'showHidden':![],'depth':null}));if(_0x2e9604[_0x8ac4('0x9a')]){_0x269937=_0x2e9604['channel'][_0x8ac4('0xa0')](0x0,_0x2e9604[_0x8ac4('0x9a')][_0x8ac4('0x9b')]('-'));if(this['agents'][_0x269937]){logger[_0x8ac4('0x3e')](_0x8ac4('0xa1'),_0x2e9604[_0x8ac4('0x2a')],_0x269937);this[_0x8ac4('0xe')][_0x269937][_0x8ac4('0x9d')]=![];}}}}catch(_0x28126b){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x2e9604[_0x8ac4('0x2a')],util[_0x8ac4('0x2b')](_0x28126b,{'showHidden':![],'depth':null}));}};module[_0x8ac4('0xa2')]=VoiceAgentReport; \ No newline at end of file +var _0xf32c=['[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','talktime','diff','secondtransfereruniqueid','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/logger','../ami','defaults','localhost','socket.io-emitter','redis','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','destuniqueid','debug','uniqueid','inspect','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','privilege','custom:agentcalled','calleridnum','user:%s','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','membername','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','agentcomplete','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value'];(function(_0x48a1dc,_0x3421dd){var _0x5c079e=function(_0x4bbe1b){while(--_0x4bbe1b){_0x48a1dc['push'](_0x48a1dc['shift']());}};_0x5c079e(++_0x3421dd);}(_0xf32c,0xcc));var _0xcf32=function(_0x6bfeff,_0x490227){_0x6bfeff=_0x6bfeff-0x0;var _0x24cd33=_0xf32c[_0x6bfeff];return _0x24cd33;};'use strict';var _=require(_0xcf32('0x0'));var moment=require(_0xcf32('0x1'));var util=require(_0xcf32('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xcf32('0x3'))('ami');var ami=require(_0xcf32('0x4'));config['redis']=_[_0xcf32('0x5')](config['redis'],{'host':_0xcf32('0x6'),'port':0x18eb});var io=require(_0xcf32('0x7'))(new Redis(config[_0xcf32('0x8')]));function VoiceAgentReport(_0x379ac9){this[_0xcf32('0x9')]={};this['voiceChannels']=_0x379ac9[_0xcf32('0x9')];this['voiceQueues']=_0x379ac9[_0xcf32('0xa')];this[_0xcf32('0xb')]=_0x379ac9[_0xcf32('0xb')];this[_0xcf32('0xc')]={};ami['on'](_0xcf32('0xd'),this['syncAgentCalled'][_0xcf32('0xe')](this));ami['on'](_0xcf32('0xf'),this[_0xcf32('0x10')]['bind'](this));ami['on'](_0xcf32('0x11'),this[_0xcf32('0x12')]['bind'](this));ami['on'](_0xcf32('0x13'),this[_0xcf32('0x14')][_0xcf32('0xe')](this));ami['on']('agentcomplete',this[_0xcf32('0x15')]['bind'](this));ami['on']('varset',this[_0xcf32('0x16')]['bind'](this));ami['on'](_0xcf32('0x17'),this[_0xcf32('0x18')][_0xcf32('0xe')](this));ami['on'](_0xcf32('0x19'),this[_0xcf32('0x1a')][_0xcf32('0xe')](this));ami['on'](_0xcf32('0x1b'),this[_0xcf32('0x1c')][_0xcf32('0xe')](this));ami['on'](_0xcf32('0x1d'),this[_0xcf32('0x1e')][_0xcf32('0xe')](this));ami['on'](_0xcf32('0x1f'),this['syncBlindTransfer'][_0xcf32('0xe')](this));}VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x21')]=function(_0x4814be,_0x4407e4,_0xb046dc){io['to'](_0x4814be)['emit'](_0x4407e4,_0xb046dc);};VoiceAgentReport[_0xcf32('0x20')]['isNotNull']=function(_0x5595c4){return _0x5595c4!==null&&!_[_0xcf32('0x22')](_0x5595c4);};VoiceAgentReport[_0xcf32('0x20')]['syncAgentCalled']=function(_0x218586){try{if(this[_0xcf32('0x23')](_0x218586)){logger[_0xcf32('0x24')](_0xcf32('0x25'),_0x218586['uniqueid'],_0x218586['membername'],_0x218586[_0xcf32('0x26')]);logger[_0xcf32('0x27')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x218586[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x218586,{'showHidden':![],'depth':null}));if(_[_0xcf32('0x22')](this[_0xcf32('0x9')][_0x218586[_0xcf32('0x28')]])){this[_0xcf32('0x9')][_0x218586[_0xcf32('0x28')]]={};}var _0x1b3073=this[_0xcf32('0xb')][_0x218586[_0xcf32('0x2a')]];var _0x5d76fb=this[_0xcf32('0x9')][_0x218586[_0xcf32('0x28')]][_0x218586[_0xcf32('0x26')]];var _0x55e3cd=this[_0xcf32('0xa')][_0x218586[_0xcf32('0x2b')]];var _0x32a7cc=this[_0xcf32('0xc')][_0x218586[_0xcf32('0x28')]];if(_['isUndefined'](_0x5d76fb)){_0x5d76fb={'agentcalledAt':moment()[_0xcf32('0x2c')](_0xcf32('0x2d')),'lastevent':_0xcf32('0x2e'),'mandatoryDisposition':_0x55e3cd&&_0x55e3cd[_0xcf32('0x2f')]?_0x55e3cd['mandatoryDisposition']:![],'type':_0x55e3cd&&_0x55e3cd[_0xcf32('0x30')]?_0x55e3cd[_0xcf32('0x30')]:_0xcf32('0x31'),'variables':_0x32a7cc,'motionChannel':_0xcf32('0x32')};}Object[_0xcf32('0x33')](_0x5d76fb,_[_0xcf32('0x34')](_0x218586,['event',_0xcf32('0x35')]));this[_0xcf32('0x9')][_0x218586[_0xcf32('0x28')]][_0x218586[_0xcf32('0x26')]]=_0x5d76fb;logger[_0xcf32('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x218586[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x5d76fb,{'showHidden':![],'depth':null}));ami['emit'](_0xcf32('0x36'),_0x5d76fb);var _0x2cc83a={'id':_0x1b3073['id'],'calleridnum':_0x5d76fb[_0xcf32('0x37')],'queue':_0x5d76fb[_0xcf32('0x2b')],'variables':_0x5d76fb[_0xcf32('0xc')],'uniqueid':_0x218586[_0xcf32('0x28')]};logger[_0xcf32('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x218586[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x2cc83a,{'showHidden':![],'depth':null}));this[_0xcf32('0x21')](util['format'](_0xcf32('0x38'),_0x218586['membername']),'user:called',_0x2cc83a);}}catch(_0x207c93){logger[_0xcf32('0x39')](_0xcf32('0x3a'),_0x218586[_0xcf32('0x28')],util['inspect'](_0x207c93,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x10')]=function(_0x1096bb){try{if(this['isNotNull'](_0x1096bb)){if(this['channels'][_0x1096bb['uniqueid']]){for(var _0x256c6a in this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]]){if(this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]]['hasOwnProperty'](_0x256c6a)){if(_0x1096bb[_0xcf32('0x26')]===_0x256c6a){logger[_0xcf32('0x24')](_0xcf32('0x3b'),_0x1096bb[_0xcf32('0x28')],_0x1096bb[_0xcf32('0x3c')],_0x1096bb[_0xcf32('0x26')]);this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x3d')]=moment()[_0xcf32('0x2c')](_0xcf32('0x2d'));this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x3e')]=_0x1096bb[_0xcf32('0x3e')];this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x3f')]=_0x1096bb[_0xcf32('0x3f')];this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x40')]=_0x1096bb[_0xcf32('0x40')];this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x41')]=_0x1096bb[_0xcf32('0x41')];this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x42')]=_0x1096bb[_0xcf32('0x42')];this[_0xcf32('0x9')][_0x1096bb['uniqueid']][_0x256c6a][_0xcf32('0x43')]=_0xcf32('0x44');if(this[_0xcf32('0x45')][this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x28')]]){var _0x38b740=this['voiceChannels'][this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x28')]][_0xcf32('0x46')];this['channels'][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x46')]=_0x38b740;_0x1096bb[_0xcf32('0x46')]=_0x38b740;}_[_0xcf32('0x47')](this[_0xcf32('0xb')][_0x1096bb[_0xcf32('0x2a')]],_[_0xcf32('0x48')](_0x1096bb,[_0xcf32('0x2b'),_0xcf32('0x49'),_0xcf32('0x46')]));var _0x16411d=this[_0xcf32('0xb')][_0x1096bb[_0xcf32('0x2a')]];var _0x53ad83={'id':_0x16411d['id'],'name':_0x16411d[_0xcf32('0x4a')],'agentconnected':!![],'destaccountcode':_0x16411d[_0xcf32('0x4b')],'destconnectedlinenum':this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x1096bb[_0xcf32('0x26')]][_0xcf32('0x4c')],'queue':this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x1096bb['destuniqueid']][_0xcf32('0x2b')],'routealias':this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x1096bb['destuniqueid']][_0xcf32('0x46')],'uniqueid':this[_0xcf32('0x9')][_0x1096bb['uniqueid']][_0x1096bb[_0xcf32('0x26')]]['uniqueid']};ami[_0xcf32('0x21')](_0xcf32('0x4d'),this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x1096bb['destuniqueid']]);this[_0xcf32('0x21')](util[_0xcf32('0x2c')](_0xcf32('0x38'),_0x1096bb[_0xcf32('0x3c')]),_0xcf32('0x4e'),_0x53ad83);}else if(!this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a]['agentringnoanswer']&&!this[_0xcf32('0x9')][_0x1096bb['uniqueid']][_0x256c6a]['agentcomplete']){logger[_0xcf32('0x24')](_0xcf32('0x4f'),_0x1096bb[_0xcf32('0x28')],this[_0xcf32('0x9')][_0x1096bb['uniqueid']][_0x256c6a][_0xcf32('0x3c')],_0x256c6a);this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a]['agentringnoanswer']=!![];this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x50')]=moment()['format'](_0xcf32('0x2d'));this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x51')]=_0x1096bb['destuniqueid'];this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x52')]=_0x1096bb[_0xcf32('0x3c')];this['channels'][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x43')]='answered_elsewhere';this['channels'][_0x1096bb[_0xcf32('0x28')]][_0x256c6a][_0xcf32('0x53')]=_0xcf32('0x54');logger[_0xcf32('0x27')](_0xcf32('0x55'),_0x1096bb['uniqueid'],util[_0xcf32('0x29')](this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a],{'showHidden':![],'depth':null}));ami[_0xcf32('0x21')]('custom:agentansweredelsewhere',this[_0xcf32('0x9')][_0x1096bb[_0xcf32('0x28')]][_0x256c6a]);}else{logger[_0xcf32('0x27')](_0xcf32('0x56'),_0x1096bb['uniqueid']);}}}}}}catch(_0x24aa77){logger[_0xcf32('0x39')]('[%s][voiceAgentReport][agentconnect]',_0x1096bb['uniqueid'],util[_0xcf32('0x29')](_0x24aa77,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x12')]=function(_0x49962c){try{if(this[_0xcf32('0x23')](_0x49962c)){logger[_0xcf32('0x27')](_0xcf32('0x57'),_0x49962c[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x49962c,{'showHidden':![],'depth':null}));if(this['channels'][_0x49962c[_0xcf32('0x28')]]&&this[_0xcf32('0x9')][_0x49962c[_0xcf32('0x28')]][_0x49962c['destuniqueid']]){logger[_0xcf32('0x24')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x49962c[_0xcf32('0x28')],_0x49962c[_0xcf32('0x3c')],_0x49962c[_0xcf32('0x26')]);var _0x139f29=this[_0xcf32('0xb')][_0x49962c['interface']];var _0x2aed3a=this[_0xcf32('0x9')][_0x49962c[_0xcf32('0x28')]][_0x49962c['destuniqueid']];_0x2aed3a['agentringnoanswer']=!![];_0x2aed3a[_0xcf32('0x50')]=moment()[_0xcf32('0x2c')](_0xcf32('0x2d'));_0x2aed3a[_0xcf32('0x43')]=_0xcf32('0x58');_0x2aed3a[_0xcf32('0x53')]=_0xcf32('0x58');var _0x5b3021={'id':_0x139f29['id'],'name':_0x139f29[_0xcf32('0x4a')],'queue':_0x2aed3a[_0xcf32('0x2b')],'uniqueid':_0x2aed3a[_0xcf32('0x28')]};logger[_0xcf32('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x49962c[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x5b3021,{'showHidden':![],'depth':null}));this[_0xcf32('0x21')](util[_0xcf32('0x2c')](_0xcf32('0x38'),_0x139f29[_0xcf32('0x4a')]),'user:agentringnoanswer',_0x5b3021);ami[_0xcf32('0x21')](_0xcf32('0x59'),_0x2aed3a);this[_0xcf32('0x9')][_0x49962c[_0xcf32('0x28')]][_0x49962c[_0xcf32('0x26')]]=Object[_0xcf32('0x33')]({},_0x2aed3a);}}}catch(_0x351043){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x49962c[_0xcf32('0x28')],util['inspect'](_0x351043,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x14')]=function(_0x17601c){try{if(this[_0xcf32('0x23')](_0x17601c)){logger[_0xcf32('0x27')](_0xcf32('0x5a'),_0x17601c[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x17601c,{'showHidden':![],'depth':null}));if(this[_0xcf32('0x9')][_0x17601c[_0xcf32('0x28')]]){for(var _0x2ba667 in this[_0xcf32('0x9')][_0x17601c[_0xcf32('0x28')]]){if(this[_0xcf32('0x9')][_0x17601c[_0xcf32('0x28')]][_0xcf32('0x5b')](_0x2ba667)&&!this['channels'][_0x17601c[_0xcf32('0x28')]][_0x2ba667][_0xcf32('0x11')]&&!this[_0xcf32('0x9')][_0x17601c['uniqueid']][_0x2ba667][_0xcf32('0x5c')]){logger[_0xcf32('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x17601c[_0xcf32('0x28')],this['channels'][_0x17601c[_0xcf32('0x28')]][_0x2ba667][_0xcf32('0x3c')],_0x2ba667);this[_0xcf32('0x9')][_0x17601c['uniqueid']][_0x2ba667]['agentringnoanswer']=!![];this[_0xcf32('0x9')][_0x17601c[_0xcf32('0x28')]][_0x2ba667][_0xcf32('0x50')]=moment()[_0xcf32('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x17601c[_0xcf32('0x28')]][_0x2ba667][_0xcf32('0x43')]=_0xcf32('0x5d');this[_0xcf32('0x9')][_0x17601c[_0xcf32('0x28')]][_0x2ba667][_0xcf32('0x53')]='abandoned';logger[_0xcf32('0x27')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x17601c[_0xcf32('0x28')],util[_0xcf32('0x29')](this[_0xcf32('0x9')][_0x17601c[_0xcf32('0x28')]][_0x2ba667],{'showHidden':![],'depth':null}));ami[_0xcf32('0x21')](_0xcf32('0x5e'),this[_0xcf32('0x9')][_0x17601c[_0xcf32('0x28')]][_0x2ba667]);}}}}}catch(_0x58aa24){logger['error'](_0xcf32('0x5f'),_0x17601c['uniqueid'],util[_0xcf32('0x29')](_0x58aa24,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')]['syncAgentComplete']=function(_0x269b23){try{if(this[_0xcf32('0x23')](_0x269b23)){logger[_0xcf32('0x27')](_0xcf32('0x60'),_0x269b23[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x269b23,{'showHidden':![],'depth':null}));if(this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]]){for(var _0x3f53e9 in this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]]){if(this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]][_0xcf32('0x5b')](_0x3f53e9)){if(this[_0xcf32('0x9')][_0x269b23['uniqueid']][_0x3f53e9][_0xcf32('0x3d')]&&!this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]][_0x3f53e9]['agentcomplete']){logger[_0xcf32('0x24')](_0xcf32('0x61'),_0x269b23[_0xcf32('0x28')],this[_0xcf32('0x9')][_0x269b23['uniqueid']][_0x3f53e9]['membername'],_0x3f53e9);this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]][_0x3f53e9][_0xcf32('0x5c')]=!![];this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]][_0x3f53e9]['agentcompleteAt']=moment()['format'](_0xcf32('0x2d'));this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]][_0x3f53e9]['lastevent']=_0xcf32('0x62');this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]][_0x3f53e9][_0xcf32('0x53')]=_0x269b23['reason']==_0xcf32('0x63')?_0xcf32('0x64'):_0x269b23[_0xcf32('0x53')];this[_0xcf32('0x9')][_0x269b23[_0xcf32('0x28')]][_0x3f53e9]['talktime']=_0x269b23['talktime'];if(this['voiceQueues'][_0x269b23[_0xcf32('0x2b')]]&&this[_0xcf32('0xa')][_0x269b23[_0xcf32('0x2b')]]['acw']){this['channels'][_0x269b23['uniqueid']][_0x3f53e9][_0xcf32('0x65')]=this[_0xcf32('0xa')][_0x269b23[_0xcf32('0x2b')]]['acwTimeout'];this[_0xcf32('0x9')][_0x269b23['uniqueid']][_0x3f53e9][_0xcf32('0x66')]=!![];}this[_0xcf32('0xb')][_0x269b23[_0xcf32('0x2a')]]=_[_0xcf32('0x34')](this[_0xcf32('0xb')][_0x269b23[_0xcf32('0x2a')]],[_0xcf32('0x2b'),'destconnectedlinenum']);logger[_0xcf32('0x27')](_0xcf32('0x67'),_0x269b23[_0xcf32('0x28')],util[_0xcf32('0x29')](this[_0xcf32('0x9')][_0x269b23['uniqueid']][_0x3f53e9],{'showHidden':![],'depth':null}));ami[_0xcf32('0x21')](_0xcf32('0x68'),this['channels'][_0x269b23[_0xcf32('0x28')]][_0x3f53e9]);logger[_0xcf32('0x27')](_0xcf32('0x69'),_0x269b23[_0xcf32('0x28')],util[_0xcf32('0x29')]({'id':this[_0xcf32('0xb')][_0x269b23[_0xcf32('0x2a')]]['id'],'destaccountcode':_0x269b23[_0xcf32('0x6a')]},{'showHidden':![],'depth':null}));this[_0xcf32('0x21')](util['format']('user:%s',_0x269b23[_0xcf32('0x3c')]),_0xcf32('0x6b'),{'id':this['agents'][_0x269b23[_0xcf32('0x2a')]]['id'],'destaccountcode':Number(_0x269b23[_0xcf32('0x6a')])});}}}}}}catch(_0xe20843){logger['error'](_0xcf32('0x6c'),_0x269b23[_0xcf32('0x28')],util[_0xcf32('0x29')](_0xe20843,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x16')]=function(_0x661c18){try{if(this[_0xcf32('0x23')](_0x661c18)){logger['debug'](_0xcf32('0x6d'),_0x661c18['uniqueid'],util['inspect'](_0x661c18,{'showHidden':![],'depth':null}));this[_0xcf32('0x6e')](_0x661c18[_0xcf32('0x28')],_[_0xcf32('0x6f')](_0x661c18[_0xcf32('0x70')])[0x0],_0x661c18[_0xcf32('0x71')]);if(this[_0xcf32('0x9')][_0x661c18[_0xcf32('0x28')]]){for(var _0x32577a in this['channels'][_0x661c18[_0xcf32('0x28')]]){if(this['channels'][_0x661c18['uniqueid']][_0xcf32('0x5b')](_0x32577a)){logger[_0xcf32('0x24')](_0xcf32('0x72'),_0x661c18[_0xcf32('0x28')],_0x32577a,_[_0xcf32('0x6f')](_0x661c18['variable'])[0x0],_0x661c18[_0xcf32('0x71')]);if(_[_0xcf32('0x22')](this[_0xcf32('0x9')][_0x661c18[_0xcf32('0x28')]][_0x32577a][_0xcf32('0xc')])){this[_0xcf32('0x9')][_0x661c18[_0xcf32('0x28')]][_0x32577a][_0xcf32('0xc')]={};}this['channels'][_0x661c18[_0xcf32('0x28')]][_0x32577a][_0xcf32('0xc')]=this[_0xcf32('0xc')][_0x661c18['uniqueid']];}}}}}catch(_0x734dbb){logger[_0xcf32('0x39')](_0xcf32('0x73'),_0x661c18['uniqueid'],util[_0xcf32('0x29')](_0x734dbb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x6e')]=function(_0x27c140,_0x3f5c57,_0xf4784f){var _0x589dc6=[_0xcf32('0x74'),_0xcf32('0x75'),_0xcf32('0x76'),'rtpaudioqosjitterbridged',_0xcf32('0x77'),_0xcf32('0x78'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xcf32('0x79'),_0xcf32('0x7a'),'bridgepeer',_0xcf32('0x7b'),'membercalls',_0xcf32('0x7c'),_0xcf32('0x7d'),_0xcf32('0x7e'),_0xcf32('0x3c'),_0xcf32('0x7f'),_0xcf32('0x80')];if(!_[_0xcf32('0x81')](_0x3f5c57)&&!_['includes'](_0x589dc6,_0x3f5c57)){if(_['isUndefined'](this[_0xcf32('0xc')][_0x27c140])){this[_0xcf32('0xc')][_0x27c140]={};}this[_0xcf32('0xc')][_0x27c140][_0x3f5c57]=_0xf4784f;}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x18')]=function(_0x204dc3){try{if(this[_0xcf32('0x23')](_0x204dc3)){logger[_0xcf32('0x27')](_0xcf32('0x82'),_0x204dc3['uniqueid'],util[_0xcf32('0x29')](_0x204dc3,{'showHidden':![],'depth':null}));if(this[_0xcf32('0x9')][_0x204dc3[_0xcf32('0x28')]]){for(var _0x8faf4b in this[_0xcf32('0x9')][_0x204dc3['uniqueid']]){if(this[_0xcf32('0x9')][_0x204dc3[_0xcf32('0x28')]][_0xcf32('0x5b')](_0x8faf4b)){if(this[_0xcf32('0x9')][_0x204dc3[_0xcf32('0x28')]][_0x8faf4b][_0xcf32('0x53')]==_0xcf32('0x63')&&this[_0xcf32('0x9')][_0x204dc3[_0xcf32('0x28')]][_0x8faf4b]['agentcomplete']){logger[_0xcf32('0x24')](_0xcf32('0x83'),_0x204dc3[_0xcf32('0x28')],_0x8faf4b);this[_0xcf32('0x9')][_0x204dc3[_0xcf32('0x28')]][_0x8faf4b][_0xcf32('0x84')]=moment()['format'](_0xcf32('0x2d'));}}}logger[_0xcf32('0x27')](_0xcf32('0x85'),_0x204dc3[_0xcf32('0x28')],util[_0xcf32('0x29')](_[_0xcf32('0x86')](this[_0xcf32('0x9')][_0x204dc3['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xcf32('0x21')](_0xcf32('0x87'),_[_0xcf32('0x86')](this[_0xcf32('0x9')][_0x204dc3[_0xcf32('0x28')]]));delete this[_0xcf32('0x9')][_0x204dc3[_0xcf32('0x28')]];}if(this[_0xcf32('0xc')][_0x204dc3[_0xcf32('0x28')]]){delete this[_0xcf32('0xc')][_0x204dc3['uniqueid']];}}}catch(_0x5f35ac){logger[_0xcf32('0x39')](_0xcf32('0x88'),_0x204dc3[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x5f35ac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')]['syncAttendedTransfer']=function(_0xac03ea){try{if(this[_0xcf32('0x23')](_0xac03ea)){logger[_0xcf32('0x27')](_0xcf32('0x89'),_0xac03ea[_0xcf32('0x28')],util[_0xcf32('0x29')](_0xac03ea,{'showHidden':![],'depth':null}));if(this[_0xcf32('0x9')][_0xac03ea[_0xcf32('0x8a')]]){for(var _0x594b5a in this[_0xcf32('0x9')][_0xac03ea['transfereeuniqueid']]){if(this[_0xcf32('0x9')][_0xac03ea[_0xcf32('0x8a')]][_0xcf32('0x5b')](_0x594b5a)){if(_0xac03ea[_0xcf32('0x8b')]===_0x594b5a){logger[_0xcf32('0x24')](_0xcf32('0x8c'),_0xac03ea[_0xcf32('0x28')],this['channels'][_0xac03ea[_0xcf32('0x8a')]][_0x594b5a]['membername'],_0x594b5a);var _0x54d07e=moment();this[_0xcf32('0x9')][_0xac03ea['transfereeuniqueid']][_0x594b5a]['agentcomplete']=!![];this[_0xcf32('0x9')][_0xac03ea[_0xcf32('0x8a')]][_0x594b5a][_0xcf32('0x84')]=moment()['format'](_0xcf32('0x2d'));this[_0xcf32('0x9')][_0xac03ea['transfereeuniqueid']][_0x594b5a][_0xcf32('0x43')]=_0xcf32('0x62');this[_0xcf32('0x9')][_0xac03ea[_0xcf32('0x8a')]][_0x594b5a]['reason']='transfer';this[_0xcf32('0x9')][_0xac03ea[_0xcf32('0x8a')]][_0x594b5a][_0xcf32('0x8d')]=_0x54d07e[_0xcf32('0x8e')](this['channels'][_0xac03ea['transfereeuniqueid']][_0x594b5a][_0xcf32('0x3d')],'seconds');}}}}if(this[_0xcf32('0x9')][_0xac03ea[_0xcf32('0x8f')]]){var _0x1e7c64=this[_0xcf32('0x9')][_0xac03ea[_0xcf32('0x8f')]];this['channels'][_0xac03ea[_0xcf32('0x8f')]]=this['channels'][_0xac03ea[_0xcf32('0x8a')]];this[_0xcf32('0x9')][_0xac03ea[_0xcf32('0x8a')]]=_0x1e7c64;}}}catch(_0x4db02e){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0xac03ea[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x4db02e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x90')]=function(_0x487336){try{if(this[_0xcf32('0x23')](_0x487336)){logger[_0xcf32('0x27')](_0xcf32('0x91'),_0x487336[_0xcf32('0x28')],util['inspect'](_0x487336,{'showHidden':![],'depth':null}));if(this[_0xcf32('0x9')][_0x487336[_0xcf32('0x8a')]]){for(var _0x223595 in this[_0xcf32('0x9')][_0x487336[_0xcf32('0x8a')]]){if(this[_0xcf32('0x9')][_0x487336['transfereeuniqueid']]['hasOwnProperty'](_0x223595)){if(_0x487336[_0xcf32('0x92')]===_0x223595){logger[_0xcf32('0x24')](_0xcf32('0x93'),_0x487336[_0xcf32('0x28')],this[_0xcf32('0x9')][_0x487336[_0xcf32('0x8a')]][_0x223595][_0xcf32('0x3c')],_0x223595);var _0xcad774=moment();this[_0xcf32('0x9')][_0x487336['transfereeuniqueid']][_0x223595][_0xcf32('0x5c')]=!![];this[_0xcf32('0x9')][_0x487336[_0xcf32('0x8a')]][_0x223595][_0xcf32('0x84')]=_0xcad774;this['channels'][_0x487336['transfereeuniqueid']][_0x223595]['lastevent']=_0xcf32('0x62');this['channels'][_0x487336[_0xcf32('0x8a')]][_0x223595][_0xcf32('0x53')]=_0xcf32('0x63');this[_0xcf32('0x9')][_0x487336[_0xcf32('0x8a')]][_0x223595][_0xcf32('0x8d')]=_0xcad774[_0xcf32('0x8e')](this[_0xcf32('0x9')][_0x487336[_0xcf32('0x8a')]][_0x223595][_0xcf32('0x3d')],'seconds');}}}}}}catch(_0x30f5f1){logger[_0xcf32('0x39')](_0xcf32('0x94'),_0x487336['uniqueid'],util[_0xcf32('0x29')](_0x30f5f1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x1a')]=function(_0x15e003){var _0x43996f='';try{if(this['isNotNull'](_0x15e003)){logger['debug'](_0xcf32('0x95'),_0x15e003[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x15e003,{'showHidden':![],'depth':null}));if(_0x15e003[_0xcf32('0x96')]){_0x43996f=_0x15e003[_0xcf32('0x96')][_0xcf32('0x97')](0x0,_0x15e003[_0xcf32('0x96')][_0xcf32('0x98')]('-'));if(this[_0xcf32('0xb')][_0x43996f]){logger[_0xcf32('0x24')](_0xcf32('0x99'),_0x15e003['uniqueid'],_0x43996f);this['agents'][_0x43996f][_0xcf32('0x9a')]=!![];}}}}catch(_0x4566ab){logger[_0xcf32('0x39')]('[%s][voiceAgentReport][musiconholdstart]',_0x15e003[_0xcf32('0x28')],util['inspect'](_0x4566ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcf32('0x20')][_0xcf32('0x1c')]=function(_0x30da51){var _0x2de075='';try{if(this[_0xcf32('0x23')](_0x30da51)){logger[_0xcf32('0x27')](_0xcf32('0x9b'),_0x30da51[_0xcf32('0x28')],util[_0xcf32('0x29')](_0x30da51,{'showHidden':![],'depth':null}));if(_0x30da51[_0xcf32('0x96')]){_0x2de075=_0x30da51['channel'][_0xcf32('0x97')](0x0,_0x30da51[_0xcf32('0x96')][_0xcf32('0x98')]('-'));if(this[_0xcf32('0xb')][_0x2de075]){logger[_0xcf32('0x24')](_0xcf32('0x9c'),_0x30da51['uniqueid'],_0x2de075);this[_0xcf32('0xb')][_0x2de075][_0xcf32('0x9a')]=![];}}}}catch(_0x54d74e){logger[_0xcf32('0x39')](_0xcf32('0x9d'),_0x30da51['uniqueid'],util[_0xcf32('0x29')](_0x54d74e,{'showHidden':![],'depth':null}));}};module[_0xcf32('0x9e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 18b7216..634d76e 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25c3=['application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','lastapplication','lastdata','cdr(','type','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','connectedlinename','destinationchannel','disposition','holdtime','UserId','membername','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][varset]\x20event:','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','variable','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','undefined','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','webbar:stopmonitors','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','some','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','lodash','moment','path','ioredis','../../../config/environment','../model/channel','../rpc/setting','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','agents','blindTransfers','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','uniqueid','linkedid','channels','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','user:%s','name','[%s][voiceCallReport][newexten]\x20event:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x25c3,0x12e));var _0x325c=function(_0x3210e4,_0x16bcee){_0x3210e4=_0x3210e4-0x0;var _0x2b33e5=_0x25c3[_0x3210e4];return _0x2b33e5;};'use strict';var _=require(_0x325c('0x0'));var moment=require(_0x325c('0x1'));var util=require('util');var path=require(_0x325c('0x2'));var Redis=require(_0x325c('0x3'));var config=require(_0x325c('0x4'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');var Channel=require(_0x325c('0x5'));var RpcSetting=require(_0x325c('0x6'));var applications=[_0x325c('0x7'),_0x325c('0x8'),_0x325c('0x9'),_0x325c('0xa'),'playback',_0x325c('0xb')];var dispositions=[_0x325c('0xc'),'FAILED',_0x325c('0xd'),_0x325c('0xc'),_0x325c('0xc'),_0x325c('0xc'),'ANSWERED',_0x325c('0xe'),_0x325c('0xd'),_0x325c('0xd'),'FAILED'];config[_0x325c('0xf')]=_[_0x325c('0x10')](config[_0x325c('0xf')],{'host':_0x325c('0x11'),'port':0x18eb});var io=require(_0x325c('0x12'))(new Redis(config[_0x325c('0xf')]));function VoiceCallReport(_0x540891){this['channels']=_0x540891['channels'];this[_0x325c('0x13')]=_0x540891[_0x325c('0x13')];this[_0x325c('0x14')]={};ami['on']('coreshowchannel',this[_0x325c('0x15')]['bind'](this));ami['on'](_0x325c('0x16'),this[_0x325c('0x15')][_0x325c('0x17')](this));ami['on'](_0x325c('0x18'),this[_0x325c('0x19')][_0x325c('0x17')](this));ami['on'](_0x325c('0x1a'),this[_0x325c('0x1b')][_0x325c('0x17')](this));ami['on']('varset',this[_0x325c('0x1c')][_0x325c('0x17')](this));ami['on'](_0x325c('0x1d'),this[_0x325c('0x1e')]['bind'](this));ami['on'](_0x325c('0x1f'),this[_0x325c('0x20')]['bind'](this));ami['on'](_0x325c('0x21'),this[_0x325c('0x22')][_0x325c('0x17')](this));ami['on']('blindtransfer',this[_0x325c('0x23')][_0x325c('0x17')](this));ami['on'](_0x325c('0x24'),this[_0x325c('0x25')][_0x325c('0x17')](this));ami['on'](_0x325c('0x26'),this['syncMusicOnHoldStop'][_0x325c('0x17')](this));try{logger[_0x325c('0x27')](_0x325c('0x28'));ami[_0x325c('0x29')]();}catch(_0x30ec11){logger[_0x325c('0x2a')](_0x325c('0x2b'),util[_0x325c('0x2c')](_0x30ec11,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x325c('0x2d')]['isNotNull']=function(_0x153795){return _0x153795!==null&&!_[_0x325c('0x2e')](_0x153795);};VoiceCallReport[_0x325c('0x2d')][_0x325c('0x2f')]=function(_0x2137e5,_0x1158ba,_0x8da15c){io['to'](_0x2137e5)[_0x325c('0x2f')](_0x1158ba,_0x8da15c);};VoiceCallReport[_0x325c('0x2d')][_0x325c('0x20')]=function(_0x11eecb){try{if(this[_0x325c('0x30')](_0x11eecb)){logger[_0x325c('0x27')](_0x325c('0x31'),_0x11eecb['uniqueid'],_0x11eecb[_0x325c('0x32')],_0x11eecb[_0x325c('0x33')]);logger['debug']('[%s][voiceCallReport][newcallerid]\x20event:',_0x11eecb['uniqueid'],util[_0x325c('0x2c')](_0x11eecb,{'showHidden':![],'depth':null}));if(_0x11eecb[_0x325c('0x34')]===_0x11eecb[_0x325c('0x35')]){if(!_[_0x325c('0x2e')](this[_0x325c('0x36')][_0x11eecb[_0x325c('0x34')]])){_[_0x325c('0x37')](this['channels'][_0x11eecb[_0x325c('0x34')]],_[_0x325c('0x38')](_0x11eecb,_[_0x325c('0x39')](this[_0x325c('0x36')][_0x11eecb[_0x325c('0x34')]])));}}if(_0x11eecb[_0x325c('0x3a')]===_0x325c('0x3b')){var _0x262a63=this[_0x325c('0x13')][_0x11eecb[_0x325c('0x3c')][_0x325c('0x3d')]('-')[0x0]];if(_0x262a63){if(_0x11eecb[_0x325c('0x3e')]==_0x325c('0x3f')){_0x262a63[_0x325c('0x40')]=_0x11eecb[_0x325c('0x41')];this[_0x325c('0x2f')](util[_0x325c('0x42')]('user:%s',_0x262a63['name']),_0x325c('0x43'),{'id':_0x262a63['id'],'destaccountcode':_0x262a63[_0x325c('0x44')],'destconnectedlinenum':_0x11eecb[_0x325c('0x41')]});}}}}}catch(_0x247292){logger['error'](_0x325c('0x45'),_0x11eecb[_0x325c('0x34')],util[_0x325c('0x2c')](_0x247292,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x325c('0x19')]=function(_0x1d5db5){try{if(this[_0x325c('0x30')](_0x1d5db5)){logger[_0x325c('0x46')](_0x325c('0x47'),_0x1d5db5['uniqueid'],util[_0x325c('0x2c')](_0x1d5db5,{'showHidden':![],'depth':null}));if(this[_0x325c('0x36')][_0x1d5db5[_0x325c('0x34')]]){return;}if(_0x1d5db5[_0x325c('0x3c')]===_0x325c('0x48')){return;}if(_0x1d5db5[_0x325c('0x34')]!==_0x1d5db5['linkedid']&&!this[_0x325c('0x14')][_0x1d5db5['linkedid']]){return;}logger[_0x325c('0x27')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x1d5db5[_0x325c('0x34')],_0x1d5db5[_0x325c('0x3a')],_0x1d5db5[_0x325c('0x3e')]);this['channels'][_0x1d5db5[_0x325c('0x34')]]=new Channel();this[_0x325c('0x36')][_0x1d5db5[_0x325c('0x34')]][_0x325c('0x49')]=moment()[_0x325c('0x42')](_0x325c('0x4a'));this[_0x325c('0x36')][_0x1d5db5[_0x325c('0x34')]]['disposition']=dispositions[_[_0x325c('0x4b')](_0x1d5db5[_0x325c('0x4c')])];_[_0x325c('0x37')](this[_0x325c('0x36')][_0x1d5db5[_0x325c('0x34')]],_['pick'](_0x1d5db5,_[_0x325c('0x39')](this['channels'][_0x1d5db5[_0x325c('0x34')]])));if(_0x1d5db5[_0x325c('0x3a')]===_0x325c('0x3b')){var _0x3848e8=this['agents'][_0x1d5db5['channel'][_0x325c('0x3d')]('-')[0x0]];if(_0x3848e8&&typeof _0x3848e8[_0x325c('0x40')]==='undefined'){_0x3848e8[_0x325c('0x40')]=_0x1d5db5[_0x325c('0x3e')];logger[_0x325c('0x46')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x1d5db5['uniqueid'],util[_0x325c('0x2c')]({'id':_0x3848e8['id'],'destaccountcode':_0x3848e8[_0x325c('0x44')],'destconnectedlinenum':_0x1d5db5[_0x325c('0x3e')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x325c('0x42')](_0x325c('0x4d'),_0x3848e8[_0x325c('0x4e')]),_0x325c('0x43'),{'id':_0x3848e8['id'],'destaccountcode':_0x3848e8[_0x325c('0x44')],'destconnectedlinenum':_0x1d5db5['exten']});}}}}catch(_0x1cb045){logger[_0x325c('0x2a')]('[%s][voiceCallReport][newchannel]',_0x1d5db5[_0x325c('0x34')],util['inspect'](_0x1cb045,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325c('0x2d')][_0x325c('0x15')]=function(_0x2223a2){try{if(this[_0x325c('0x30')](_0x2223a2)){logger['debug'](_0x325c('0x4f'),_0x2223a2[_0x325c('0x34')],util[_0x325c('0x2c')](_0x2223a2,{'showHidden':![],'depth':null}));if(_0x2223a2[_0x325c('0x3c')]==='OutgoingSpoolFailed'||_0x2223a2[_0x325c('0x3e')]==='h')return;if(_0x2223a2['uniqueid']===_0x2223a2[_0x325c('0x35')]||this[_0x325c('0x14')][_0x2223a2[_0x325c('0x35')]]){_0x2223a2['application']=_0x2223a2['application']?_0x2223a2[_0x325c('0x50')][_0x325c('0x51')]():undefined;_0x2223a2[_0x325c('0x52')]=_0x2223a2[_0x325c('0x53')]||_0x2223a2[_0x325c('0x52')];if(_0x2223a2['appdata']&&!_0x2223a2['appdata'][_0x325c('0x54')](_0x325c('0x55'))&&_0x2223a2[_0x325c('0x50')]!=='queue'){_0x2223a2[_0x325c('0x52')]=_0x2223a2[_0x325c('0x52')][_0x325c('0x51')]();}logger[_0x325c('0x27')](_0x325c('0x56'),_0x2223a2['uniqueid'],_0x2223a2[_0x325c('0x50')],_0x2223a2[_0x325c('0x52')]);if(_[_0x325c('0x2e')](this[_0x325c('0x36')][_0x2223a2[_0x325c('0x34')]])){this[_0x325c('0x36')][_0x2223a2[_0x325c('0x34')]]=new Channel();this[_0x325c('0x36')][_0x2223a2[_0x325c('0x34')]][_0x325c('0x49')]=_0x2223a2[_0x325c('0x57')]?moment()[_0x325c('0x58')](moment['duration'](_0x2223a2[_0x325c('0x57')])[_0x325c('0x59')](),_0x325c('0x59'))[_0x325c('0x42')](_0x325c('0x4a')):moment()[_0x325c('0x42')](_0x325c('0x4a'));this['channels'][_0x2223a2['uniqueid']]['disposition']=_0x325c('0xc');}_[_0x325c('0x37')](this[_0x325c('0x36')][_0x2223a2['uniqueid']],_[_0x325c('0x38')](_0x2223a2,_[_0x325c('0x39')](this[_0x325c('0x36')][_0x2223a2[_0x325c('0x34')]])));if(_['includes'](applications,_0x2223a2[_0x325c('0x50')])){this[_0x325c('0x36')][_0x2223a2[_0x325c('0x34')]][_0x325c('0x5a')]=_0x2223a2['application'];this[_0x325c('0x36')][_0x2223a2[_0x325c('0x34')]][_0x325c('0x5b')]=_0x2223a2['applicationdata'];if(_0x2223a2['application']===_0x325c('0x7')&&_['startsWith'](_0x2223a2[_0x325c('0x52')][_0x325c('0x51')](),_0x325c('0x5c'))){var _0x4cce86=_0x2223a2[_0x325c('0x52')][_0x325c('0x3d')]('=');var _0x2c52fc=_0x4cce86[0x0][_0x325c('0x51')]()['match'](/cdr\((.*)\)/);if(_0x2c52fc){if(_0x2c52fc[0x1]===_0x325c('0x5d')&&!_['isNil'](this[_0x325c('0x36')][_0x2223a2[_0x325c('0x34')]][_0x2c52fc[0x1]]))return;this[_0x325c('0x36')][_0x2223a2['uniqueid']][_0x2c52fc[0x1]]=_0x4cce86[0x1];}}else if(_0x2223a2['application']===_0x325c('0x8')){this[_0x325c('0x36')][_0x2223a2[_0x325c('0x34')]][_0x325c('0x8')]=_0x2223a2[_0x325c('0x52')]['split'](',')[0x0];}}}}}catch(_0x39c23e){logger[_0x325c('0x2a')]('[%s][voiceCallReport][newexten]',_0x2223a2[_0x325c('0x34')],util['inspect'](_0x39c23e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325c('0x2d')]['syncNewState']=function(_0x375020){try{if(this[_0x325c('0x30')](_0x375020)){logger[_0x325c('0x27')](_0x325c('0x5e'),_0x375020[_0x325c('0x34')],_0x375020[_0x325c('0x35')],_0x375020[_0x325c('0x32')],_0x375020[_0x325c('0x33')]);logger[_0x325c('0x46')](_0x325c('0x5f'),_0x375020['uniqueid'],util[_0x325c('0x2c')](_0x375020,{'showHidden':![],'depth':null}));if(_0x375020['channelstate']!=='6')return;var _0x2fe7d6=this['agents'][_0x375020['channel'][_0x325c('0x3d')]('-')[0x0]];if(_0x375020[_0x325c('0x34')]!==_0x375020['linkedid']){var _0x466e29=moment();if(this[_0x325c('0x36')][_0x375020['linkedid']]){if(!this['channels'][_0x375020[_0x325c('0x35')]]['answered']){this[_0x325c('0x36')][_0x375020['linkedid']][_0x325c('0x60')]=!![];this[_0x325c('0x36')][_0x375020['linkedid']][_0x325c('0x61')]=_0x466e29['format'](_0x325c('0x4a'));if(this[_0x325c('0x36')][_0x375020['linkedid']][_0x325c('0x49')]){this[_0x325c('0x36')][_0x375020[_0x325c('0x35')]]['holdtime']=_0x466e29[_0x325c('0x62')](this[_0x325c('0x36')][_0x375020[_0x325c('0x35')]][_0x325c('0x49')],_0x325c('0x59'));}}this[_0x325c('0x36')][_0x375020[_0x325c('0x35')]][_0x325c('0x35')]=_0x375020[_0x325c('0x34')];if(_0x375020[_0x325c('0x33')]!==_0x325c('0x3f')){this[_0x325c('0x36')][_0x375020['linkedid']][_0x325c('0x41')]=_0x375020['calleridnum'];}this[_0x325c('0x36')][_0x375020[_0x325c('0x35')]][_0x325c('0x63')]=_0x375020[_0x325c('0x32')];this['channels'][_0x375020[_0x325c('0x35')]][_0x325c('0x64')]=_0x375020[_0x325c('0x3c')];this[_0x325c('0x36')][_0x375020[_0x325c('0x35')]][_0x325c('0x65')]=dispositions[_[_0x325c('0x4b')](_0x375020[_0x325c('0x4c')])];if(_0x2fe7d6){this['channels'][_0x375020[_0x325c('0x35')]]['UserId']=_0x2fe7d6['id'];this[_0x325c('0x36')][_0x375020['linkedid']]['membername']=_0x2fe7d6['name'];}}if(this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]]){if(!this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]][_0x325c('0x60')]){this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]][_0x325c('0x60')]=!![];this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]][_0x325c('0x61')]=_0x466e29[_0x325c('0x42')](_0x325c('0x4a'));if(this[_0x325c('0x36')][_0x375020['uniqueid']][_0x325c('0x49')]){this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]][_0x325c('0x66')]=_0x466e29['diff'](this[_0x325c('0x36')][_0x375020['uniqueid']][_0x325c('0x49')],_0x325c('0x59'));}}if(_0x375020[_0x325c('0x33')]!==_0x325c('0x3f')){this[_0x325c('0x36')][_0x375020['uniqueid']][_0x325c('0x41')]=_0x375020[_0x325c('0x33')];}this['channels'][_0x375020['uniqueid']][_0x325c('0x63')]=_0x375020[_0x325c('0x32')];this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]]['destinationchannel']=_0x375020[_0x325c('0x3c')];this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]][_0x325c('0x65')]=dispositions[_['toNumber'](_0x375020[_0x325c('0x4c')])];}}else{if(this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]]){if(_0x2fe7d6){this[_0x325c('0x36')][_0x375020['uniqueid']][_0x325c('0x67')]=_0x2fe7d6['id'];this[_0x325c('0x36')][_0x375020['uniqueid']][_0x325c('0x68')]=_0x2fe7d6[_0x325c('0x4e')];}}}if(_0x375020[_0x325c('0x3a')]===_0x325c('0x3b')){if(_0x2fe7d6){_0x2fe7d6[_0x325c('0x40')]=_0x375020[_0x325c('0x3e')];var _0x185c5e,_0x3c2510;if(this[_0x325c('0x36')][_0x375020[_0x325c('0x34')]]){_0x185c5e=this['channels'][_0x375020[_0x325c('0x34')]][_0x325c('0x69')];_0x3c2510=this['channels'][_0x375020['uniqueid']][_0x325c('0x8')];}else if(this[_0x325c('0x36')][_0x375020['linkedid']]){_0x185c5e=this[_0x325c('0x36')][_0x375020[_0x325c('0x35')]][_0x325c('0x69')];_0x3c2510=this['channels'][_0x375020[_0x325c('0x35')]]['queue'];}_0x2fe7d6[_0x325c('0x8')]=_0x3c2510;_0x2fe7d6[_0x325c('0x69')]=_0x185c5e;var _0x478425={'id':_0x2fe7d6['id'],'name':_0x2fe7d6[_0x325c('0x4e')],'agentconnected':!![],'destaccountcode':_0x2fe7d6['accountcode'],'destconnectedlinenum':_0x375020[_0x325c('0x3e')],'queue':_0x3c2510||undefined,'routealias':_0x185c5e,'uniqueid':_0x375020[_0x325c('0x35')]};logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x375020[_0x325c('0x34')],util[_0x325c('0x2c')](_0x478425,{'showHidden':![],'depth':null}));this[_0x325c('0x2f')](util[_0x325c('0x42')](_0x325c('0x4d'),_0x2fe7d6['name']),_0x325c('0x43'),_0x478425);}}}}catch(_0x109690){logger[_0x325c('0x2a')](_0x325c('0x6a'),_0x375020[_0x325c('0x34')],util['inspect'](_0x109690,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x325c('0x6b')]=function(_0x4f0dc9,_0x4d9026){try{if(this[_0x325c('0x36')][_0x4f0dc9]){logger[_0x325c('0x27')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x4f0dc9,_0x4d9026);this[_0x325c('0x36')][_0x4f0dc9][_0x325c('0x6c')]=!![];if(_[_0x325c('0x6d')](_0x4d9026,_0x325c('0x6e'))){_0x4d9026=_0x4d9026[_0x325c('0x6f')]('.wav49',_0x325c('0x70'));}this[_0x325c('0x36')][_0x4f0dc9][_0x325c('0x71')]=_0x4d9026;var _0x3c6c64=_['find'](this[_0x325c('0x36')][_0x4f0dc9][_0x325c('0x72')],{'filename':_0x4d9026});if(_[_0x325c('0x73')](_0x3c6c64)){this[_0x325c('0x36')][_0x4f0dc9][_0x325c('0x72')][_0x325c('0x74')]({'filename':_0x4d9026,'createdAt':moment()[_0x325c('0x42')](_0x325c('0x4a')),'mixmonitorid':'','status':_0x325c('0x75')});}}}catch(_0x360542){logger[_0x325c('0x2a')]('[%s][voiceCallReport][mixMonitorFilename]',_0x4f0dc9,util['inspect'](_0x360542,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x325c('0x1c')]=function(_0x37cf3a){try{if(this[_0x325c('0x30')](_0x37cf3a)){logger[_0x325c('0x46')](_0x325c('0x76'),_0x37cf3a[_0x325c('0x34')],util['inspect'](_0x37cf3a,{'showHidden':![],'depth':null}));if(this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x34')]]&&_0x37cf3a[_0x325c('0x3c')]!=_0x325c('0x48')){if(this[_0x325c('0x30')](_0x37cf3a['variable'])){if(this[_0x325c('0x30')](_0x37cf3a['variable']['mixmonitor_filename'])){logger[_0x325c('0x27')](_0x325c('0x77'),_0x37cf3a['uniqueid'],_0x37cf3a[_0x325c('0x78')]);this[_0x325c('0x6b')](_0x37cf3a[_0x325c('0x34')],_0x37cf3a[_0x325c('0x78')]);}else if(this['isNotNull'](_0x37cf3a[_0x325c('0x79')][_0x325c('0x7a')])){logger[_0x325c('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x37cf3a[_0x325c('0x34')],_0x37cf3a[_0x325c('0x78')]);this['channels'][_0x37cf3a[_0x325c('0x34')]]['calleridnum']=_0x37cf3a[_0x325c('0x78')];}else if(this[_0x325c('0x30')](_0x37cf3a['variable'][_0x325c('0x7b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x37cf3a[_0x325c('0x34')],_0x37cf3a[_0x325c('0x78')]);this['channels'][_0x37cf3a[_0x325c('0x34')]]['callerid']=_0x37cf3a[_0x325c('0x78')];}else if(this[_0x325c('0x30')](_0x37cf3a[_0x325c('0x79')]['xmd-cdrtype'])){logger['info'](_0x325c('0x7c'),_0x37cf3a[_0x325c('0x34')],_0x37cf3a[_0x325c('0x78')]);this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x34')]][_0x325c('0x5d')]=_0x37cf3a[_0x325c('0x78')];}else if(this[_0x325c('0x30')](_0x37cf3a['variable'][_0x325c('0x7d')])){logger[_0x325c('0x27')](_0x325c('0x7e'),_0x37cf3a[_0x325c('0x34')],_0x37cf3a['value'][_0x325c('0x3d')](',')[0x0]);this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x34')]]['queue']=_0x37cf3a['value'][_0x325c('0x3d')](',')[0x0];}else if(this[_0x325c('0x30')](_0x37cf3a[_0x325c('0x79')][_0x325c('0x7f')])){logger[_0x325c('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x37cf3a[_0x325c('0x34')],_0x37cf3a[_0x325c('0x78')]);this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x34')]][_0x325c('0x80')]=_0x37cf3a[_0x325c('0x78')];}else if(this[_0x325c('0x30')](_0x37cf3a['variable'][_0x325c('0x81')])){logger[_0x325c('0x27')](_0x325c('0x82'),_0x37cf3a[_0x325c('0x34')],_0x37cf3a['value']);this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x34')]][_0x325c('0x83')]=_0x37cf3a['value'];}else if(this[_0x325c('0x30')](_0x37cf3a[_0x325c('0x79')][_0x325c('0x84')])){logger[_0x325c('0x27')](_0x325c('0x85'),_0x37cf3a[_0x325c('0x34')],_0x37cf3a[_0x325c('0x78')]);this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x34')]]['calleridpreview']=_0x37cf3a[_0x325c('0x78')];}else if(this[_0x325c('0x30')](_0x37cf3a[_0x325c('0x79')]['xmcs-queue'])){logger[_0x325c('0x27')](_0x325c('0x86'),_0x37cf3a[_0x325c('0x34')],_0x37cf3a['value']);this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x34')]]['queue']=_0x37cf3a[_0x325c('0x78')];}else if(this[_0x325c('0x30')](_0x37cf3a['variable'][_0x325c('0x87')])){logger[_0x325c('0x27')](_0x325c('0x88'),_0x37cf3a['uniqueid'],_0x37cf3a['value']);this['channels'][_0x37cf3a[_0x325c('0x34')]][_0x325c('0x89')]=_0x37cf3a[_0x325c('0x78')];}}}else if(this[_0x325c('0x30')](_0x37cf3a['variable']['mixmonitor_filename'])){if(_0x37cf3a[_0x325c('0x78')]){var _0x36122c=path[_0x325c('0x8a')](_0x37cf3a[_0x325c('0x78')])[_0x325c('0x4e')];logger['info'](_0x325c('0x77'),_0x36122c,_0x37cf3a[_0x325c('0x78')]);this[_0x325c('0x6b')](_0x36122c,_0x37cf3a[_0x325c('0x78')]);}}else if(this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x35')]]){if(this[_0x325c('0x30')](_0x37cf3a[_0x325c('0x79')])){if(this[_0x325c('0x30')](_0x37cf3a[_0x325c('0x79')][_0x325c('0x87')])){logger[_0x325c('0x27')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x37cf3a['linkedid'],_0x37cf3a[_0x325c('0x78')]);this[_0x325c('0x36')][_0x37cf3a[_0x325c('0x35')]][_0x325c('0x8b')]=_0x37cf3a[_0x325c('0x78')];}}}}}catch(_0x11267f){logger['error'](_0x325c('0x8c'),_0x37cf3a[_0x325c('0x34')],util[_0x325c('0x2c')](_0x11267f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x325c('0x1e')]=function(_0x1b1662){try{if(this[_0x325c('0x30')](_0x1b1662)){logger['debug'](_0x325c('0x8d'),_0x1b1662[_0x325c('0x34')],util[_0x325c('0x2c')](_0x1b1662,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x1b1662['linkedid']]){if(this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x35')]]){this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662['linkedid']][_0x325c('0x35')]][_0x325c('0x34')]=_0x1b1662[_0x325c('0x34')];this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]]['linkedid']]['answered']=this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]][_0x325c('0x60')];this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662['linkedid']][_0x325c('0x35')]]['answertime']=this[_0x325c('0x36')][_0x1b1662['uniqueid']]['answertime'];this[_0x325c('0x36')][this['blindTransfers'][_0x1b1662[_0x325c('0x35')]][_0x325c('0x35')]][_0x325c('0x64')]=this['channels'][this['blindTransfers'][_0x1b1662['linkedid']]['linkedid']][_0x325c('0x3c')];this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x35')]][_0x325c('0x65')]=this['channels'][_0x1b1662[_0x325c('0x34')]][_0x325c('0x65')];this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]]=this['channels'][this['blindTransfers'][_0x1b1662[_0x325c('0x35')]][_0x325c('0x35')]];delete this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x35')]];}else if(this['channels'][this['blindTransfers'][_0x1b1662[_0x325c('0x35')]][_0x325c('0x34')]]){this[_0x325c('0x36')][this['blindTransfers'][_0x1b1662[_0x325c('0x35')]][_0x325c('0x34')]][_0x325c('0x34')]=[this['channels'][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x34')]]['linkedid'],this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x34')]][_0x325c('0x35')]=this[_0x325c('0x36')][this['blindTransfers'][_0x1b1662['linkedid']]['uniqueid']][_0x325c('0x34')]][0x0];this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x34')]][_0x325c('0x60')]=this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]]['answered'];this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x34')]]['answertime']=this[_0x325c('0x36')][_0x1b1662['uniqueid']]['answertime'];this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662['linkedid']][_0x325c('0x34')]]['destinationchannel']=this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x34')]][_0x325c('0x3c')];this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662['linkedid']][_0x325c('0x34')]]['disposition']=this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]][_0x325c('0x65')];this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]]=this[_0x325c('0x36')][this['blindTransfers'][_0x1b1662[_0x325c('0x35')]]['uniqueid']];delete this[_0x325c('0x36')][this[_0x325c('0x14')][_0x1b1662[_0x325c('0x35')]][_0x325c('0x34')]];}}if(this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]]){logger[_0x325c('0x27')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x1b1662[_0x325c('0x34')],_0x1b1662[_0x325c('0x8e')]);var _0x306dd5=moment();this[_0x325c('0x36')][_0x1b1662['uniqueid']][_0x325c('0x8f')]=_0x306dd5[_0x325c('0x42')](_0x325c('0x4a'));this['channels'][_0x1b1662['uniqueid']]['duration']=_0x306dd5[_0x325c('0x62')](this['channels'][_0x1b1662[_0x325c('0x34')]][_0x325c('0x49')],_0x325c('0x59'));if(this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]][_0x325c('0x60')]){this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]][_0x325c('0x90')]=_0x306dd5[_0x325c('0x62')](this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]]['answertime'],_0x325c('0x59'));this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]][_0x325c('0x66')]=this['channels'][_0x1b1662[_0x325c('0x34')]]['duration']-this[_0x325c('0x36')][_0x1b1662[_0x325c('0x34')]]['billableseconds'];}if(_0x1b1662[_0x325c('0x3a')]===_0x325c('0x3b')){if(this[_0x325c('0x13')][_0x1b1662[_0x325c('0x3c')][_0x325c('0x3d')]('-')[0x0]]){this[_0x325c('0x13')][_0x1b1662[_0x325c('0x3c')][_0x325c('0x3d')]('-')[0x0]]=_['omit'](this[_0x325c('0x13')][_0x1b1662[_0x325c('0x3c')]['split']('-')[0x0]],[_0x325c('0x40')]);logger[_0x325c('0x46')](_0x325c('0x91'),_0x1b1662[_0x325c('0x34')],util[_0x325c('0x2c')]({'id':this[_0x325c('0x13')][_0x1b1662[_0x325c('0x3c')][_0x325c('0x3d')]('-')[0x0]]['id'],'destaccountcode':this[_0x325c('0x13')][_0x1b1662[_0x325c('0x3c')]['split']('-')[0x0]][_0x325c('0x44')]},{'showHidden':![],'depth':null}));this[_0x325c('0x2f')](util['format'](_0x325c('0x4d'),this[_0x325c('0x13')][_0x1b1662['channel']['split']('-')[0x0]][_0x325c('0x4e')]),_0x325c('0x92'),{'id':this[_0x325c('0x13')][_0x1b1662[_0x325c('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x325c('0x13')][_0x1b1662[_0x325c('0x3c')][_0x325c('0x3d')]('-')[0x0]][_0x325c('0x44')]});for(var _0x2b9ca5=0x0;_0x2b9ca50x0?!![]:![];if(!_0x326593){return this['syncQueueSummaryComplete'](this[_0x7534('0x41')]['completeEvent']);}};VoiceQueueReport[_0x7534('0xb')][_0x7534('0x67')]=function(_0x5566ec){var _0x5c5e12=this[_0x7534('0x41')]['id'];if(this['summary']['queuestatus'][_0x5c5e12]&&this['summary'][_0x7534('0x5c')][_0x5c5e12][_0x5566ec[_0x7534('0x64')]]){this[_0x7534('0x41')][_0x7534('0x5c')][_0x5c5e12][_0x5566ec['actionid']][_0x7534('0x10')][_0x7534('0x68')](_0x5566ec);}};VoiceQueueReport[_0x7534('0xb')]['syncQueueSummary']=function(_0x5b1383){var _0x3bd259=this;try{if(this[_0x7534('0x56')](_0x5b1383)&&this[_0x7534('0x56')](_0x5b1383[_0x7534('0x4a')])){logger[_0x7534('0x46')](_0x7534('0x69'),util[_0x7534('0x3f')](_0x5b1383,{'showHidden':![],'depth':null}));var _0x502b15=this[_0x7534('0x12')][_0x5b1383['queue']];if(_0x502b15){logger['debug'](_0x7534('0x6a'),_0x502b15[_0x7534('0x55')]);this[_0x7534('0x41')][_0x7534('0x58')][_0x502b15[_0x7534('0x55')]]={'summaryEvent':_0x5b1383};this['summary'][_0x7534('0x66')]+=0x1;return ami[_0x7534('0x37')]({'action':'queuestatus','queue':_0x502b15[_0x7534('0x55')]})['then'](function(_0x1eaf35){if(!_0x3bd259[_0x7534('0x41')][_0x7534('0x5c')][_0x5b1383[_0x7534('0x64')]]){_0x3bd259[_0x7534('0x41')][_0x7534('0x5c')][_0x5b1383[_0x7534('0x64')]]={};}_0x3bd259[_0x7534('0x41')][_0x7534('0x5c')][_0x5b1383[_0x7534('0x64')]][_0x1eaf35[_0x7534('0x64')]]={'queue':_0x502b15[_0x7534('0x55')],'agents':[]};})[_0x7534('0x3a')](function(_0x46cd1e){throw _0x46cd1e;});}}}catch(_0x361ffc){logger[_0x7534('0x3b')]('[voiceQueueReport][queuesummary]',util[_0x7534('0x3f')](_0x361ffc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7534('0xb')]['syncQueueSummaryComplete']=function(_0x21f732){if(this[_0x7534('0x41')][_0x7534('0x66')]>0x0){this['summary'][_0x7534('0x6b')]=_0x21f732;return;}logger[_0x7534('0x46')](_0x7534('0x6c'),util['inspect'](_0x21f732,{'showHidden':![],'depth':null}));this[_0x7534('0x41')]=initializeSummary();ami[_0x7534('0x44')](_0x7534('0x6d'),{});};VoiceQueueReport['prototype'][_0x7534('0x6e')]=function(_0x46a52f){try{if(this[_0x7534('0x56')](_0x46a52f)){logger['debug'](_0x7534('0x6f'),_0x46a52f[_0x7534('0x48')],util[_0x7534('0x3f')](_0x46a52f,{'showHidden':![],'depth':null}));if(_[_0x7534('0x57')](this[_0x7534('0x3d')][_0x46a52f[_0x7534('0x48')]])){this[_0x7534('0x3d')][_0x46a52f['uniqueid']]=[];}if(_['isUndefined'](this[_0x7534('0x34')][_0x46a52f['uniqueid']])){this[_0x7534('0x34')][_0x46a52f[_0x7534('0x48')]]={};}var _0x132899=new QueueReport();_0x132899['queue']=_0x46a52f[_0x7534('0x4a')];_0x132899[_0x7534('0x53')]=this['voiceQueues'][_0x132899['queue']]&&this['voiceQueues'][_0x132899['queue']][_0x7534('0x53')]?this[_0x7534('0x12')][_0x132899[_0x7534('0x4a')]]['type']||_0x7534('0x54'):_0x7534('0x54');_0x132899[_0x7534('0x70')]=moment()[_0x7534('0x49')](_0x7534('0x71'));_0x132899[_0x7534('0x72')]=_0x46a52f[_0x7534('0x72')];_0x132899[_0x7534('0x73')]=_0x46a52f[_0x7534('0x73')];_0x132899[_0x7534('0x48')]=_0x46a52f[_0x7534('0x48')];_0x132899['routealias']=this['channels'][_0x46a52f['uniqueid']][_0x7534('0x74')];logger[_0x7534('0x75')](_0x7534('0x76'),_0x132899[_0x7534('0x4a')],_0x132899[_0x7534('0x53')]);Object[_0x7534('0x77')](_0x132899,_[_0x7534('0x78')](_0x46a52f,_[_0x7534('0x79')](_0x132899)));this[_0x7534('0x3d')][_0x46a52f['uniqueid']][_0x7534('0x68')](_0x132899);this['channels'][_0x46a52f[_0x7534('0x48')]]=_0x132899;this[_0x7534('0x45')](_0x132899,_0x7534('0x7a'));}}catch(_0x5281dc){logger[_0x7534('0x3b')]('[%s][voiceQueueReport][queuecallerjoin]',_0x46a52f['uniqueid'],util[_0x7534('0x3f')](_0x5281dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7534('0xb')][_0x7534('0x1c')]=function(_0x3504a6){try{if(this[_0x7534('0x56')](_0x3504a6)){logger[_0x7534('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3504a6['uniqueid'],util[_0x7534('0x3f')](_0x3504a6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3504a6['uniqueid']]){var _0x523b2b=_[_0x7534('0x7b')](this[_0x7534('0x3d')][_0x3504a6['uniqueid']]);_0x523b2b[_0x7534('0x7c')]=![];_0x523b2b[_0x7534('0x7d')]=null;_0x523b2b[_0x7534('0x7e')]=_0x3504a6[_0x7534('0x7e')];_0x523b2b[_0x7534('0x7f')]=_0x3504a6[_0x7534('0x7f')];_0x523b2b[_0x7534('0x33')]=!![];_0x523b2b[_0x7534('0x80')]=moment()[_0x7534('0x49')](_0x7534('0x71'));_0x523b2b[_0x7534('0x4d')]='ABANDONED';_0x523b2b[_0x7534('0x81')]=null;logger['info'](_0x7534('0x82'),_0x523b2b[_0x7534('0x4a')],_0x523b2b[_0x7534('0x53')]);this['channels'][_0x3504a6[_0x7534('0x48')]]=_0x523b2b;this[_0x7534('0x42')](_0x523b2b,_0x7534('0x33'));}}}catch(_0x3024f9){logger[_0x7534('0x3b')](_0x7534('0x83'),_0x3504a6[_0x7534('0x48')],util[_0x7534('0x3f')](_0x3024f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7534('0xb')]['syncQueueCallerLeave']=function(_0x200cea){try{if(this['isNotNull'](_0x200cea)){logger[_0x7534('0x46')](_0x7534('0x84'),_0x200cea[_0x7534('0x48')],util['inspect'](_0x200cea,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x200cea[_0x7534('0x48')]]){var _0x3901d9=_['last'](this[_0x7534('0x3d')][_0x200cea[_0x7534('0x48')]]);_0x3901d9[_0x7534('0x85')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3901d9[_0x7534('0x86')]=_0x200cea[_0x7534('0x86')];_0x3901d9['connectedlinename']=_0x200cea['connectedlinename'];logger[_0x7534('0x75')](_0x7534('0x87'),_0x3901d9[_0x7534('0x4a')],_0x3901d9['type'],_0x200cea['connectedlinenum'],_0x200cea[_0x7534('0x88')]);this[_0x7534('0x34')][_0x200cea['uniqueid']]=_0x3901d9;this[_0x7534('0x45')](_0x3901d9,'queuecallerleave');}}}catch(_0x191866){logger[_0x7534('0x3b')]('[%s][voiceQueueReport][queuecallerleave]',_0x200cea[_0x7534('0x48')],util['inspect'](_0x191866,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7534('0xb')][_0x7534('0x20')]=function(_0x2ff928){try{if(this[_0x7534('0x56')](_0x2ff928)){logger[_0x7534('0x46')](_0x7534('0x89'),_0x2ff928['uniqueid'],util[_0x7534('0x3f')](_0x2ff928,{'showHidden':![],'depth':null}));if(this[_0x7534('0x3d')][_0x2ff928[_0x7534('0x48')]]){var _0x7f00fd=_['last'](this[_0x7534('0x3d')][_0x2ff928['uniqueid']]);_0x7f00fd[_0x7534('0x7c')]=!![];_0x7f00fd[_0x7534('0x4d')]='COMPLETEDBYAGENT';logger[_0x7534('0x75')](_0x7534('0x8a'),_0x7f00fd['queue'],_0x7f00fd['type']);}}}catch(_0x43c5d9){logger[_0x7534('0x3b')]('[%s][voiceQueueReport][agentconnect]',_0x2ff928[_0x7534('0x48')],util[_0x7534('0x3f')](_0x43c5d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7534('0xb')][_0x7534('0x8b')]=function(_0x16dff2){try{if(this[_0x7534('0x56')](_0x16dff2)){logger['debug'](_0x7534('0x8c'),_0x16dff2['uniqueid'],util[_0x7534('0x3f')](_0x16dff2,{'showHidden':![],'depth':null}));if(this[_0x7534('0x3d')][_0x16dff2[_0x7534('0x48')]]){var _0xecfb48=_[_0x7534('0x7b')](this['queueReports'][_0x16dff2['uniqueid']]);_0xecfb48[_0x7534('0x33')]=![];_0xecfb48['queuecallerabandonAt']=null;_0xecfb48[_0x7534('0x8d')]=!![];_0xecfb48['lastAssignedTo']=_0x16dff2[_0x7534('0x8e')];_0xecfb48[_0x7534('0x7e')]=_0x16dff2[_0x7534('0x7e')];_0xecfb48[_0x7534('0x7c')]=!![];_0xecfb48['queuecallerexit']=![];_0xecfb48[_0x7534('0x8f')]=null;if(!_0xecfb48['transfer']){if(_0x16dff2[_0x7534('0x90')]==_0x7534('0x91')){_0xecfb48[_0x7534('0x4d')]=_0x7534('0x92');logger[_0x7534('0x75')](_0x7534('0x93'),_0xecfb48['queue'],_0xecfb48[_0x7534('0x53')]);}else{if(_[_0x7534('0x94')](_0x16dff2['channel'][_0x7534('0x95')](),'local/')){if(this[_0x7534('0x3d')][_0x16dff2[_0x7534('0x96')]]){var _0x68cb2a=_['last'](this['queueReports'][_0x16dff2[_0x7534('0x96')]]);_0x68cb2a[_0x7534('0x7c')]=![];_0x68cb2a[_0x7534('0x97')]=!![];_0x68cb2a[_0x7534('0x8f')]=moment(_0xecfb48[_0x7534('0x70')])[_0x7534('0x98')](_0x16dff2[_0x7534('0x7e')],_0x7534('0x99'))[_0x7534('0x49')](_0x7534('0x71'));_0x68cb2a[_0x7534('0x4d')]='FORWARDTRANSFER';_0x68cb2a[_0x7534('0x91')]=!![];_0x68cb2a[_0x7534('0x9a')]=_0x7534('0x9b');_0x68cb2a[_0x7534('0x9c')]=_0x16dff2[_0x7534('0x9d')];_0x68cb2a['transferuniqueid']=_0x16dff2[_0x7534('0x48')];logger['info'](_0x7534('0x9e'),_0x68cb2a['queue'],_0x68cb2a['type']);var _0x587b1a=this[_0x7534('0x3d')][_0x16dff2[_0x7534('0x96')]];this[_0x7534('0x3d')][_0x16dff2[_0x7534('0x96')]]=this[_0x7534('0x3d')][_0x16dff2[_0x7534('0x48')]];this[_0x7534('0x3d')][_0x16dff2[_0x7534('0x48')]]=_0x587b1a;}}else{_0xecfb48[_0x7534('0x4d')]=_0x7534('0x9f')+_0x16dff2[_0x7534('0x90')][_0x7534('0xa0')]();logger[_0x7534('0x75')](_0x7534('0xa1'),_0xecfb48[_0x7534('0x4a')],_0xecfb48[_0x7534('0x53')],_0xecfb48[_0x7534('0x4d')]);}}}this[_0x7534('0x34')][_0x16dff2[_0x7534('0x48')]]=_0xecfb48;}}}catch(_0x148a65){logger[_0x7534('0x3b')]('[%s][voiceQueueReport][agentcomplete]',_0x16dff2[_0x7534('0x48')],util[_0x7534('0x3f')](_0x148a65,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7534('0xb')][_0x7534('0xa2')]=function(_0x1b7245){try{if(this[_0x7534('0x56')](_0x1b7245)){logger[_0x7534('0x46')]('[%s][voiceQueueReport][varset]',_0x1b7245[_0x7534('0x48')],util[_0x7534('0x3f')](_0x1b7245,{'showHidden':![],'depth':null}));this['addVariable'](_0x1b7245[_0x7534('0x48')],_[_0x7534('0x79')](_0x1b7245[_0x7534('0xa3')])[0x0],_0x1b7245['value']);if(this[_0x7534('0x3d')][_0x1b7245[_0x7534('0x48')]]){var _0x36def2=_['last'](this['queueReports'][_0x1b7245[_0x7534('0x48')]]);if(_0x36def2){if(this['isNotNull'](_0x1b7245[_0x7534('0xa3')])&&this[_0x7534('0x56')](_0x1b7245['variable']['queuestatus'])){switch(_0x1b7245[_0x7534('0xa4')]){case _0x7534('0xa5'):_0x36def2[_0x7534('0x97')]=![];_0x36def2[_0x7534('0x8f')]=null;break;case'TIMEOUT':_0x36def2[_0x7534('0xa6')]=_0x7534('0xa7');_0x36def2['queuecallerexit']=!![];_0x36def2[_0x7534('0x8f')]=moment()[_0x7534('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x36def2['queuecallerleaveAt']=moment()[_0x7534('0x49')](_0x7534('0x71'));logger[_0x7534('0x46')](_0x7534('0xa8'),_0x1b7245['uniqueid'],util[_0x7534('0x3f')](_0x36def2,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x36def2);break;default:_0x36def2[_0x7534('0x97')]=!![];_0x36def2[_0x7534('0x8f')]=moment()[_0x7534('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x36def2['queuecallerleaveAt']=moment()[_0x7534('0x49')](_0x7534('0x71'));}_0x36def2[_0x7534('0x33')]=![];_0x36def2[_0x7534('0x80')]=null;_0x36def2[_0x7534('0x4d')]=_0x1b7245[_0x7534('0xa4')];this[_0x7534('0x34')][_0x1b7245[_0x7534('0x48')]]=_0x36def2;this[_0x7534('0x42')](_0x36def2,_0x7534('0x21'));}else if(this['isNotNull'](_0x1b7245['variable'])&&this['isNotNull'](_0x1b7245[_0x7534('0xa3')][_0x7534('0xa9')])){if(!_0x36def2[_0x7534('0x33')]){_0x36def2[_0x7534('0x97')]=!![];_0x36def2[_0x7534('0x8f')]=moment()[_0x7534('0x49')](_0x7534('0x71'));_0x36def2[_0x7534('0x4d')]=_0x7534('0xaa');_0x36def2[_0x7534('0x85')]=moment()[_0x7534('0x49')](_0x7534('0x71'));this['channels'][_0x1b7245[_0x7534('0x48')]]=_0x36def2;}}logger['info'](_0x7534('0xab'),_0x1b7245['uniqueid'],_0x36def2[_0x7534('0x4a')],_0x36def2['type'],_[_0x7534('0x79')](_0x1b7245[_0x7534('0xa3')])[0x0],_0x1b7245[_0x7534('0xa4')]);_0x36def2[_0x7534('0x14')]=this['variables'][_0x1b7245['uniqueid']];}}}}catch(_0x5e5515){logger[_0x7534('0x3b')](_0x7534('0xac'),_0x1b7245[_0x7534('0x48')],util[_0x7534('0x3f')](_0x5e5515,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7534('0xb')]['addVariable']=function(_0x20ceb8,_0x6500a8,_0x5a0966){var _0x4a9723=[_0x7534('0xad'),_0x7534('0xae'),_0x7534('0xaf'),_0x7534('0xb0'),_0x7534('0xb1'),_0x7534('0xb2'),_0x7534('0xb3'),_0x7534('0xb4'),_0x7534('0xb5'),_0x7534('0xb6'),'bridgepeer',_0x7534('0xb7'),_0x7534('0xb8'),_0x7534('0xb9'),_0x7534('0xba'),_0x7534('0xbb'),_0x7534('0x8e'),_0x7534('0xbc'),_0x7534('0xbd')];if(!_['isNil'](_0x6500a8)&&!_[_0x7534('0xbe')](_0x4a9723,_0x6500a8)){if(_[_0x7534('0x57')](this[_0x7534('0x14')][_0x20ceb8])){this[_0x7534('0x14')][_0x20ceb8]={};}this[_0x7534('0x14')][_0x20ceb8][_0x6500a8]=_0x5a0966;}};VoiceQueueReport[_0x7534('0xb')][_0x7534('0xbf')]=function(_0x55d7fb,_0x5ae1d2,_0x2e754c){try{var _0x1f3ea2={};if(this[_0x7534('0x3d')][_0x55d7fb]){for(var _0x28f940=0x0;_0x28f9400x0?!![]:![];if(!_0x59237b){return this[_0x0469('0x19')](this['summary'][_0x0469('0x68')]);}};VoiceQueueReport[_0x0469('0x9')][_0x0469('0x1b')]=function(_0xd5eb92){var _0x40fb8a=this[_0x0469('0x3e')]['id'];if(this['summary']['queuestatus'][_0x40fb8a]&&this[_0x0469('0x3e')][_0x0469('0x65')][_0x40fb8a][_0xd5eb92['actionid']]){this['summary'][_0x0469('0x65')][_0x40fb8a][_0xd5eb92[_0x0469('0x5c')]][_0x0469('0xf')][_0x0469('0x69')](_0xd5eb92);}};VoiceQueueReport['prototype'][_0x0469('0x16')]=function(_0x2d3081){var _0x1cd0c3=this;try{if(this['isNotNull'](_0x2d3081)&&this[_0x0469('0x55')](_0x2d3081[_0x0469('0x48')])){logger[_0x0469('0x43')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x0469('0x3a')](_0x2d3081,{'showHidden':![],'depth':null}));var _0x1e7400=this[_0x0469('0x12')][_0x2d3081[_0x0469('0x48')]];if(_0x1e7400){logger[_0x0469('0x43')](_0x0469('0x6a'),_0x1e7400[_0x0469('0x5f')]);this['summary'][_0x0469('0x56')][_0x1e7400[_0x0469('0x5f')]]={'summaryEvent':_0x2d3081};this[_0x0469('0x3e')][_0x0469('0x67')]+=0x1;return ami[_0x0469('0x5a')]({'action':_0x0469('0x65'),'queue':_0x1e7400[_0x0469('0x5f')]})['then'](function(_0x526d1c){if(!_0x1cd0c3[_0x0469('0x3e')][_0x0469('0x65')][_0x2d3081['actionid']]){_0x1cd0c3[_0x0469('0x3e')][_0x0469('0x65')][_0x2d3081[_0x0469('0x5c')]]={};}_0x1cd0c3[_0x0469('0x3e')]['queuestatus'][_0x2d3081[_0x0469('0x5c')]][_0x526d1c[_0x0469('0x5c')]]={'queue':_0x1e7400[_0x0469('0x5f')],'agents':[]};})[_0x0469('0x57')](function(_0x3cb2a0){throw _0x3cb2a0;});}}}catch(_0x743b4a){logger[_0x0469('0x39')]('[voiceQueueReport][queuesummary]',util[_0x0469('0x3a')](_0x743b4a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0469('0x9')][_0x0469('0x19')]=function(_0x103ef0){if(this[_0x0469('0x3e')][_0x0469('0x67')]>0x0){this[_0x0469('0x3e')][_0x0469('0x68')]=_0x103ef0;return;}logger[_0x0469('0x43')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x0469('0x3a')](_0x103ef0,{'showHidden':![],'depth':null}));this[_0x0469('0x3e')]=initializeSummary();ami['emit'](_0x0469('0x6b'),{});};VoiceQueueReport[_0x0469('0x9')][_0x0469('0x1d')]=function(_0xac9a96){try{if(this[_0x0469('0x55')](_0xac9a96)){logger[_0x0469('0x43')](_0x0469('0x6c'),_0xac9a96[_0x0469('0x4c')],util['inspect'](_0xac9a96,{'showHidden':![],'depth':null}));if(_[_0x0469('0x6d')](this[_0x0469('0xe')][_0xac9a96[_0x0469('0x4c')]])){this['queueReports'][_0xac9a96['uniqueid']]=[];}if(_[_0x0469('0x6d')](this['channels'][_0xac9a96[_0x0469('0x4c')]])){this[_0x0469('0x10')][_0xac9a96['uniqueid']]={};}var _0x12e48b=new QueueReport();_0x12e48b[_0x0469('0x48')]=_0xac9a96['queue'];_0x12e48b['type']=this[_0x0469('0x12')][_0x12e48b[_0x0469('0x48')]]&&this['voiceQueues'][_0x12e48b[_0x0469('0x48')]][_0x0469('0x51')]?this[_0x0469('0x12')][_0x12e48b[_0x0469('0x48')]][_0x0469('0x51')]||'inbound':_0x0469('0x52');_0x12e48b[_0x0469('0x6e')]=moment()[_0x0469('0x46')](_0x0469('0x6f'));_0x12e48b['position']=_0xac9a96[_0x0469('0x70')];_0x12e48b[_0x0469('0x71')]=_0xac9a96[_0x0469('0x71')];_0x12e48b[_0x0469('0x4c')]=_0xac9a96[_0x0469('0x4c')];_0x12e48b[_0x0469('0x72')]=this[_0x0469('0x10')][_0xac9a96[_0x0469('0x4c')]][_0x0469('0x72')];logger['info'](_0x0469('0x73'),_0x12e48b['queue'],_0x12e48b[_0x0469('0x51')]);Object[_0x0469('0x63')](_0x12e48b,_[_0x0469('0x74')](_0xac9a96,_['keys'](_0x12e48b)));this[_0x0469('0xe')][_0xac9a96['uniqueid']][_0x0469('0x69')](_0x12e48b);this[_0x0469('0x10')][_0xac9a96[_0x0469('0x4c')]]=_0x12e48b;this[_0x0469('0x42')](_0x12e48b,_0x0469('0x75'));}}catch(_0x4f276e){logger[_0x0469('0x39')](_0x0469('0x6c'),_0xac9a96[_0x0469('0x4c')],util[_0x0469('0x3a')](_0x4f276e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0469('0x9')][_0x0469('0x1e')]=function(_0x12058b){try{if(this['isNotNull'](_0x12058b)){logger[_0x0469('0x43')](_0x0469('0x76'),_0x12058b[_0x0469('0x4c')],util['inspect'](_0x12058b,{'showHidden':![],'depth':null}));if(this[_0x0469('0xe')][_0x12058b[_0x0469('0x4c')]]){var _0x383e31=_[_0x0469('0x77')](this[_0x0469('0xe')][_0x12058b['uniqueid']]);_0x383e31['queuecallercomplete']=![];_0x383e31[_0x0469('0x78')]=null;_0x383e31[_0x0469('0x79')]=_0x12058b[_0x0469('0x79')];_0x383e31[_0x0469('0x7a')]=_0x12058b[_0x0469('0x7a')];_0x383e31[_0x0469('0x7b')]=!![];_0x383e31[_0x0469('0x7c')]=moment()[_0x0469('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x383e31[_0x0469('0x7d')]=_0x0469('0x7e');_0x383e31['lastAssignedTo']=null;logger['info'](_0x0469('0x7f'),_0x383e31[_0x0469('0x48')],_0x383e31[_0x0469('0x51')]);this[_0x0469('0x10')][_0x12058b[_0x0469('0x4c')]]=_0x383e31;this[_0x0469('0x3f')](_0x383e31,_0x0469('0x7b'));}}}catch(_0xfe3c1f){logger[_0x0469('0x39')](_0x0469('0x76'),_0x12058b[_0x0469('0x4c')],util['inspect'](_0xfe3c1f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0469('0x9')][_0x0469('0x80')]=function(_0x17709b){try{if(this[_0x0469('0x55')](_0x17709b)){logger[_0x0469('0x43')](_0x0469('0x81'),_0x17709b[_0x0469('0x4c')],util['inspect'](_0x17709b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x17709b[_0x0469('0x4c')]]){var _0x10a592=_[_0x0469('0x77')](this[_0x0469('0xe')][_0x17709b[_0x0469('0x4c')]]);_0x10a592[_0x0469('0x82')]=moment()[_0x0469('0x46')](_0x0469('0x6f'));_0x10a592[_0x0469('0x83')]=_0x17709b[_0x0469('0x83')];_0x10a592['connectedlinename']=_0x17709b[_0x0469('0x84')];logger[_0x0469('0x85')](_0x0469('0x86'),_0x10a592['queue'],_0x10a592[_0x0469('0x51')],_0x17709b[_0x0469('0x83')],_0x17709b[_0x0469('0x84')]);this[_0x0469('0x10')][_0x17709b[_0x0469('0x4c')]]=_0x10a592;this[_0x0469('0x42')](_0x10a592,_0x0469('0x1f'));}}}catch(_0x2583d0){logger[_0x0469('0x39')](_0x0469('0x81'),_0x17709b[_0x0469('0x4c')],util['inspect'](_0x2583d0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0469('0x9')][_0x0469('0x23')]=function(_0x463386){try{if(this['isNotNull'](_0x463386)){logger[_0x0469('0x43')](_0x0469('0x87'),_0x463386[_0x0469('0x4c')],util['inspect'](_0x463386,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x463386[_0x0469('0x4c')]]){var _0x1aa59a=_[_0x0469('0x77')](this[_0x0469('0xe')][_0x463386[_0x0469('0x4c')]]);_0x1aa59a[_0x0469('0x88')]=!![];_0x1aa59a[_0x0469('0x7d')]='COMPLETEDBYAGENT';logger[_0x0469('0x85')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x1aa59a['queue'],_0x1aa59a[_0x0469('0x51')]);}}}catch(_0x4e28e6){logger[_0x0469('0x39')](_0x0469('0x87'),_0x463386[_0x0469('0x4c')],util[_0x0469('0x3a')](_0x4e28e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0469('0x9')][_0x0469('0x21')]=function(_0x44fbbf){try{if(this['isNotNull'](_0x44fbbf)){logger[_0x0469('0x43')](_0x0469('0x89'),_0x44fbbf['uniqueid'],util[_0x0469('0x3a')](_0x44fbbf,{'showHidden':![],'depth':null}));if(this[_0x0469('0xe')][_0x44fbbf[_0x0469('0x4c')]]){var _0x208cd6=_[_0x0469('0x77')](this[_0x0469('0xe')][_0x44fbbf[_0x0469('0x4c')]]);_0x208cd6['queuecallerabandon']=![];_0x208cd6[_0x0469('0x7c')]=null;_0x208cd6[_0x0469('0x8a')]=!![];_0x208cd6[_0x0469('0x8b')]=_0x44fbbf[_0x0469('0x8c')];_0x208cd6[_0x0469('0x79')]=_0x44fbbf[_0x0469('0x79')];_0x208cd6[_0x0469('0x88')]=!![];_0x208cd6[_0x0469('0x8d')]=![];_0x208cd6[_0x0469('0x8e')]=null;if(!_0x208cd6['transfer']){if(_0x44fbbf[_0x0469('0x8f')]==_0x0469('0x90')){_0x208cd6[_0x0469('0x7d')]=_0x0469('0x91');logger[_0x0469('0x85')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x208cd6[_0x0469('0x48')],_0x208cd6[_0x0469('0x51')]);}else{if(_[_0x0469('0x92')](_0x44fbbf[_0x0469('0x37')]['toLowerCase'](),_0x0469('0x93'))){if(this['queueReports'][_0x44fbbf[_0x0469('0x94')]]){var _0x299d21=_[_0x0469('0x77')](this[_0x0469('0xe')][_0x44fbbf[_0x0469('0x94')]]);_0x299d21[_0x0469('0x88')]=![];_0x299d21[_0x0469('0x8d')]=!![];_0x299d21['queuecallerexitAt']=moment(_0x208cd6[_0x0469('0x6e')])[_0x0469('0x95')](_0x44fbbf[_0x0469('0x79')],_0x0469('0x96'))['format'](_0x0469('0x6f'));_0x299d21[_0x0469('0x7d')]='FORWARDTRANSFER';_0x299d21[_0x0469('0x90')]=!![];_0x299d21[_0x0469('0x97')]=_0x0469('0x98');_0x299d21[_0x0469('0x99')]=_0x44fbbf[_0x0469('0x9a')];_0x299d21[_0x0469('0x9b')]=_0x44fbbf[_0x0469('0x4c')];logger[_0x0469('0x85')](_0x0469('0x9c'),_0x299d21[_0x0469('0x48')],_0x299d21['type']);var _0x486d43=this[_0x0469('0xe')][_0x44fbbf[_0x0469('0x94')]];this[_0x0469('0xe')][_0x44fbbf['linkedid']]=this[_0x0469('0xe')][_0x44fbbf['uniqueid']];this[_0x0469('0xe')][_0x44fbbf[_0x0469('0x4c')]]=_0x486d43;}}else{_0x208cd6['queuecallerexitreason']='COMPLETEDBY'+_0x44fbbf[_0x0469('0x8f')]['toUpperCase']();logger[_0x0469('0x85')](_0x0469('0x9d'),_0x208cd6[_0x0469('0x48')],_0x208cd6['type'],_0x208cd6['queuecallerexitreason']);}}}this['channels'][_0x44fbbf[_0x0469('0x4c')]]=_0x208cd6;}}}catch(_0x3dee43){logger[_0x0469('0x39')](_0x0469('0x89'),_0x44fbbf['uniqueid'],util[_0x0469('0x3a')](_0x3dee43,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0469('0x9')][_0x0469('0x9e')]=function(_0x1fde20){try{if(this['isNotNull'](_0x1fde20)){logger[_0x0469('0x43')]('[%s][voiceQueueReport][varset]',_0x1fde20['uniqueid'],util[_0x0469('0x3a')](_0x1fde20,{'showHidden':![],'depth':null}));this[_0x0469('0x9f')](_0x1fde20[_0x0469('0x4c')],_['keys'](_0x1fde20['variable'])[0x0],_0x1fde20[_0x0469('0xa0')]);if(this['queueReports'][_0x1fde20[_0x0469('0x4c')]]){var _0x33247d=_['last'](this[_0x0469('0xe')][_0x1fde20['uniqueid']]);if(_0x33247d){if(this['isNotNull'](_0x1fde20[_0x0469('0xa1')])&&this[_0x0469('0x55')](_0x1fde20[_0x0469('0xa1')][_0x0469('0x65')])){switch(_0x1fde20[_0x0469('0xa0')]){case _0x0469('0xa2'):_0x33247d['queuecallerexit']=![];_0x33247d['queuecallerexitAt']=null;break;case _0x0469('0xa3'):_0x33247d[_0x0469('0xa4')]='timeout';_0x33247d[_0x0469('0x8d')]=!![];_0x33247d[_0x0469('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x33247d[_0x0469('0x82')]=moment()['format'](_0x0469('0x6f'));logger['debug'](_0x0469('0xa5'),_0x1fde20[_0x0469('0x4c')],util[_0x0469('0x3a')](_0x33247d,{'showHidden':![],'depth':null}));ami[_0x0469('0x41')](_0x0469('0xa6'),_0x33247d);break;default:_0x33247d[_0x0469('0x8d')]=!![];_0x33247d[_0x0469('0x8e')]=moment()['format'](_0x0469('0x6f'));_0x33247d['queuecallerleaveAt']=moment()[_0x0469('0x46')](_0x0469('0x6f'));}_0x33247d[_0x0469('0x7b')]=![];_0x33247d['queuecallerabandonAt']=null;_0x33247d['queuecallerexitreason']=_0x1fde20[_0x0469('0xa0')];this[_0x0469('0x10')][_0x1fde20[_0x0469('0x4c')]]=_0x33247d;this[_0x0469('0x3f')](_0x33247d,_0x0469('0x24'));}else if(this['isNotNull'](_0x1fde20[_0x0469('0xa1')])&&this[_0x0469('0x55')](_0x1fde20[_0x0469('0xa1')][_0x0469('0xa7')])){if(!_0x33247d[_0x0469('0x7b')]){_0x33247d[_0x0469('0x8d')]=!![];_0x33247d[_0x0469('0x8e')]=moment()[_0x0469('0x46')](_0x0469('0x6f'));_0x33247d[_0x0469('0x7d')]='EXITWITHKEY';_0x33247d['queuecallerleaveAt']=moment()[_0x0469('0x46')](_0x0469('0x6f'));this[_0x0469('0x10')][_0x1fde20[_0x0469('0x4c')]]=_0x33247d;}}logger[_0x0469('0x85')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x1fde20[_0x0469('0x4c')],_0x33247d[_0x0469('0x48')],_0x33247d[_0x0469('0x51')],_[_0x0469('0xa8')](_0x1fde20[_0x0469('0xa1')])[0x0],_0x1fde20[_0x0469('0xa0')]);_0x33247d[_0x0469('0x14')]=this[_0x0469('0x14')][_0x1fde20['uniqueid']];}}}}catch(_0x8e3ab){logger['error'](_0x0469('0xa9'),_0x1fde20['uniqueid'],util[_0x0469('0x3a')](_0x8e3ab,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0469('0x9f')]=function(_0x46945f,_0x10b4a0,_0x5c7242){var _0x1f3913=[_0x0469('0xaa'),'rtpaudioqosbridged',_0x0469('0xab'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x0469('0xac'),_0x0469('0xad'),'rtpaudioqosrttbridged',_0x0469('0xae'),_0x0469('0xaf'),_0x0469('0xb0'),'bridgepvtcallid','membercalls',_0x0469('0xb1'),'memberinterface',_0x0469('0xb2'),_0x0469('0x8c'),'memberpenalty',_0x0469('0xb3')];if(!_['isNil'](_0x10b4a0)&&!_[_0x0469('0xb4')](_0x1f3913,_0x10b4a0)){if(_[_0x0469('0x6d')](this[_0x0469('0x14')][_0x46945f])){this[_0x0469('0x14')][_0x46945f]={};}this[_0x0469('0x14')][_0x46945f][_0x10b4a0]=_0x5c7242;}};VoiceQueueReport['prototype'][_0x0469('0xb5')]=function(_0x7933fb,_0x3c8b40,_0x583345){try{var _0x50be9c={};if(this[_0x0469('0xe')][_0x7933fb]){for(var _0x29846b=0x0;_0x29846b=0x0?moment(_0x4abc11[_0xcb4d('0x19')])['diff'](_0x4abc11[_0xcb4d('0x18')],_0xcb4d('0xe')):null,'data1':_0xcb4d('0x1a'),'data2':_0x4abc11[_0xcb4d('0x13')],'data3':_0x4abc11[_0xcb4d('0x10')],'data4':_0x4abc11[_0xcb4d('0x1b')]||null,'role':_0xcb4d('0x12'),'internal':_0x4abc11[_0xcb4d('0x13')]?_[_0xcb4d('0x14')](_0x4abc11[_0xcb4d('0x13')]):undefined,'uniqueid':_0x4abc11[_0xcb4d('0x1c')]},'log':_0xcb4d('0x5')});}; \ No newline at end of file +var _0x4244=['voiceDialReport','membername','starttime','endtime','seconds','dialstring','agent','toNumber','moment','util','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','exten','queue','accountcode','uniqueid'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x4244,0x140));var _0x4424=function(_0x2c6f5a,_0x73289a){_0x2c6f5a=_0x2c6f5a-0x0;var _0xeb5181=_0x4244[_0x2c6f5a];return _0xeb5181;};'use strict';var moment=require(_0x4424('0x0'));var _=require('lodash');var util=require(_0x4424('0x1'));var client=require('../client');exports[_0x4424('0x2')]=function(_0x5ec581){var _0x3ccf6e=_0x5ec581[_0x4424('0x3')]||_0x5ec581['queuecallerexitAt'];return client[_0x4424('0x4')](_0x4424('0x5'),{'body':{'channel':'voice','membername':_0x5ec581[_0x4424('0x6')],'interface':_[_0x4424('0x7')](_0x5ec581[_0x4424('0x8')])?util[_0x4424('0x9')](_0x4424('0xa'),_0x5ec581[_0x4424('0x6')]):_0x5ec581[_0x4424('0x8')],'type':_0x4424('0xb'),'enterAt':_0x5ec581[_0x4424('0xc')],'exitAt':_0x3ccf6e,'duration':moment(_0x3ccf6e)[_0x4424('0xd')](_0x5ec581['queuecallerleaveAt'],'seconds'),'data1':'inbound','data2':_0x5ec581['calleridnum'],'data3':_0x5ec581[_0x4424('0xe')],'data4':null,'data5':_0x5ec581[_0x4424('0xf')],'role':'agent','internal':_0x5ec581['accountcode']?_['toNumber'](_0x5ec581[_0x4424('0x10')]):undefined,'uniqueid':_0x5ec581[_0x4424('0x11')]},'log':_0x4424('0x5')});};exports[_0x4424('0x12')]=function(_0xa7fe86){return client[_0x4424('0x4')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0xa7fe86[_0x4424('0x13')],'interface':_0xa7fe86[_0x4424('0x8')],'type':'TALKING','enterAt':_0xa7fe86[_0x4424('0x14')],'exitAt':_0xa7fe86[_0x4424('0x15')],'duration':moment(_0xa7fe86[_0x4424('0x15')])[_0x4424('0xd')](_0xa7fe86[_0x4424('0x14')],_0x4424('0x16'))>=0x0?moment(_0xa7fe86[_0x4424('0x15')])[_0x4424('0xd')](_0xa7fe86[_0x4424('0x14')],'seconds'):null,'data1':'outbound','data2':_0xa7fe86[_0x4424('0x10')],'data3':_0xa7fe86[_0x4424('0xe')],'data4':_0xa7fe86[_0x4424('0x17')]||null,'role':_0x4424('0x18'),'internal':_0xa7fe86[_0x4424('0x10')]?_[_0x4424('0x19')](_0xa7fe86['accountcode']):undefined,'uniqueid':_0xa7fe86[_0x4424('0x11')]},'log':_0x4424('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4e8259d..856c6e3 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaf3=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request','ShowSetting'];(function(_0x1af87a,_0x342b21){var _0x3d9a5f=function(_0x133b80){while(--_0x133b80){_0x1af87a['push'](_0x1af87a['shift']());}};_0x3d9a5f(++_0x342b21);}(_0xfaf3,0x93));var _0x3faf=function(_0x3b10e0,_0x50109b){_0x3b10e0=_0x3b10e0-0x0;var _0x580a69=_0xfaf3[_0x3b10e0];return _0x580a69;};'use strict';var client=require(_0x3faf('0x0'));exports['getSettings']=function(){return client[_0x3faf('0x1')](_0x3faf('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3faf('0x3'),_0x3faf('0x4')]},'log':_0x3faf('0x5')});}; \ No newline at end of file +var _0x6b72=['ShowSetting','previewRecallmeReminderInterval','GetSettings','../client','Request'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0x6b72,0x19d));var _0x26b7=function(_0x44dfdd,_0x964120){_0x44dfdd=_0x44dfdd-0x0;var _0x443ccc=_0x6b72[_0x44dfdd];return _0x443ccc;};'use strict';var client=require(_0x26b7('0x0'));exports['getSettings']=function(){return client[_0x26b7('0x1')](_0x26b7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x26b7('0x3')]},'log':_0x26b7('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 53e7477..9863bd3 100644 --- a/server/services/ami/rpc/template.js +++ b/server/services/ami/rpc/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5bd=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x1ac6ed,_0x2d7b1e){var _0x4e6e79=function(_0x3447a5){while(--_0x3447a5){_0x1ac6ed['push'](_0x1ac6ed['shift']());}};_0x4e6e79(++_0x2d7b1e);}(_0xc5bd,0x9a));var _0xdc5b=function(_0x3f65c9,_0x4ebe8f){_0x3f65c9=_0x3f65c9-0x0;var _0x2798ec=_0xc5bd[_0x3f65c9];return _0x2798ec;};'use strict';var client=require(_0xdc5b('0x0'));exports[_0xdc5b('0x1')]=function(_0x395ae2){return function(_0x182c54){return client[_0xdc5b('0x2')](_0xdc5b('0x3'),{'options':{'raw':!![],'attributes':['id',_0xdc5b('0x4'),_0xdc5b('0x5')]},'log':_0xdc5b('0x3')});};}; \ No newline at end of file +var _0xdb51=['../client','getTemplates','Request','GetTemplate','html'];(function(_0x52b149,_0x442347){var _0x282909=function(_0x231aab){while(--_0x231aab){_0x52b149['push'](_0x52b149['shift']());}};_0x282909(++_0x442347);}(_0xdb51,0x145));var _0x1db5=function(_0x2803af,_0x2bb475){_0x2803af=_0x2803af-0x0;var _0x5cd13a=_0xdb51[_0x2803af];return _0x5cd13a;};'use strict';var client=require(_0x1db5('0x0'));exports[_0x1db5('0x1')]=function(_0x26e6fc){return function(_0x5966e7){return client[_0x1db5('0x2')](_0x1db5('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x1db5('0x4')]},'log':_0x1db5('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index a30131e..9527635 100644 --- a/server/services/ami/rpc/trigger.js +++ b/server/services/ami/rpc/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb06=['operator','AnyConditions','value','Actions','data1','data2','data4','data6','data7','../client','Request','GetTrigger','name','channel','Condition','field'];(function(_0xc45596,_0x5c410e){var _0x425ffe=function(_0x3c327d){while(--_0x3c327d){_0xc45596['push'](_0xc45596['shift']());}};_0x425ffe(++_0x5c410e);}(_0xfb06,0x1e9));var _0x6fb0=function(_0x284240,_0x555b56){_0x284240=_0x284240-0x0;var _0x390667=_0xfb06[_0x284240];return _0x390667;};'use strict';var client=require(_0x6fb0('0x0'));exports['getTriggers']=function(_0xb85e12){return function(_0x3ddf41){return client[_0x6fb0('0x1')](_0x6fb0('0x2'),{'options':{'raw':![],'attributes':['id',_0x6fb0('0x3'),_0x6fb0('0x4'),'status'],'include':[{'model':_0x6fb0('0x5'),'as':'AllConditions','attributes':['id',_0x6fb0('0x6'),_0x6fb0('0x7'),'value']},{'model':'Condition','as':_0x6fb0('0x8'),'attributes':['id',_0x6fb0('0x6'),_0x6fb0('0x7'),_0x6fb0('0x9')]},{'model':'Action','as':_0x6fb0('0xa'),'attributes':['id','action',_0x6fb0('0xb'),_0x6fb0('0xc'),'data3',_0x6fb0('0xd'),'data5',_0x6fb0('0xe'),_0x6fb0('0xf')]}]},'log':_0x6fb0('0x2')});};}; \ No newline at end of file +var _0x81c5=['data7','../client','getTriggers','Request','GetTrigger','name','channel','field','operator','value','Condition','action','data2','data3','data5','data6'];(function(_0x5e838f,_0x400e3b){var _0x50c078=function(_0x45ba64){while(--_0x45ba64){_0x5e838f['push'](_0x5e838f['shift']());}};_0x50c078(++_0x400e3b);}(_0x81c5,0x141));var _0x581c=function(_0xc1e5be,_0x270b0b){_0xc1e5be=_0xc1e5be-0x0;var _0x2e9623=_0x81c5[_0xc1e5be];return _0x2e9623;};'use strict';var client=require(_0x581c('0x0'));exports[_0x581c('0x1')]=function(_0x38b610){return function(_0xe6f8bc){return client[_0x581c('0x2')](_0x581c('0x3'),{'options':{'raw':![],'attributes':['id',_0x581c('0x4'),_0x581c('0x5'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x581c('0x6'),_0x581c('0x7'),_0x581c('0x8')]},{'model':_0x581c('0x9'),'as':'AnyConditions','attributes':['id',_0x581c('0x6'),_0x581c('0x7'),_0x581c('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x581c('0xa'),'data1',_0x581c('0xb'),_0x581c('0xc'),'data4',_0x581c('0xd'),_0x581c('0xe'),_0x581c('0xf')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f9752d3..cab8f13 100644 --- a/server/services/ami/rpc/trunk.js +++ b/server/services/ami/rpc/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b0c=['registry','defaultuser','../client','GetTrunk','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b0c,0x138));var _0xc4b0=function(_0x4ffe3a,_0x2fe0b1){_0x4ffe3a=_0x4ffe3a-0x0;var _0x4e72a3=_0x4b0c[_0x4ffe3a];return _0x4e72a3;};'use strict';var client=require(_0xc4b0('0x0'));exports['getTrunks']=function(_0x25f2ec){return function(_0x2a288e){return client['Request'](_0xc4b0('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc4b0('0x2'),_0xc4b0('0x3'),_0xc4b0('0x4')]},'log':_0xc4b0('0x1')});};}; \ No newline at end of file +var _0xa482=['defaultuser','../client','getTrunks','Request','GetTrunk','registry'];(function(_0x4b59d3,_0xc65b6e){var _0x1e64fa=function(_0x306966){while(--_0x306966){_0x4b59d3['push'](_0x4b59d3['shift']());}};_0x1e64fa(++_0xc65b6e);}(_0xa482,0x181));var _0x2a48=function(_0x2b34e,_0xefbbc3){_0x2b34e=_0x2b34e-0x0;var _0x2392d4=_0xa482[_0x2b34e];return _0x2392d4;};'use strict';var client=require(_0x2a48('0x0'));exports[_0x2a48('0x1')]=function(_0x2e1bbe){return function(_0x161ad4){return client[_0x2a48('0x2')](_0x2a48('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x2a48('0x4'),_0x2a48('0x5')]},'log':_0x2a48('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2c5f250..dffac17 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x1afbb0,_0x30c8a3){var _0x327735=function(_0x2c252d){while(--_0x2c252d){_0x1afbb0['push'](_0x1afbb0['shift']());}};_0x327735(++_0x30c8a3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0xcb91[_0x2d61ac];return _0x3f7d3c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x146168,_0x198364){var _0x21cc2c=function(_0x3f3548){while(--_0x3f3548){_0x146168['push'](_0x146168['shift']());}};_0x21cc2c(++_0x198364);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 40fa48e..641b98b 100644 --- a/server/services/ami/rpc/voiceAgentReport.js +++ b/server/services/ami/rpc/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5520=['Request','../client','create','CreateVoiceAgentReport','update'];(function(_0x5ba649,_0x2836d9){var _0x57afa9=function(_0x41b0e6){while(--_0x41b0e6){_0x5ba649['push'](_0x5ba649['shift']());}};_0x57afa9(++_0x2836d9);}(_0x5520,0xd3));var _0x0552=function(_0x1c9134,_0x3f4069){_0x1c9134=_0x1c9134-0x0;var _0x51df18=_0x5520[_0x1c9134];return _0x51df18;};'use strict';var client=require(_0x0552('0x0'));exports[_0x0552('0x1')]=function(_0x102a65){return client['Request'](_0x0552('0x2'),{'body':_0x102a65,'log':_0x0552('0x2')});};exports[_0x0552('0x3')]=function(_0x19d8db,_0x23ec94,_0x5d3291){return client[_0x0552('0x4')]('UpdateVoiceAgentReport',{'body':_0x19d8db,'options':{'where':{'uniqueid':_0x23ec94,'interface':_0x5d3291,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x5055=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport','update'];(function(_0x32668d,_0x36c1c9){var _0x993df=function(_0x1a5131){while(--_0x1a5131){_0x32668d['push'](_0x32668d['shift']());}};_0x993df(++_0x36c1c9);}(_0x5055,0x1b4));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x5505('0x0')]=function(_0x2fa17b){return client[_0x5505('0x1')](_0x5505('0x2'),{'body':_0x2fa17b,'log':_0x5505('0x2')});};exports[_0x5505('0x3')]=function(_0x205596,_0x4865b8,_0x310c65){return client['Request'](_0x5505('0x4'),{'body':_0x205596,'options':{'where':{'uniqueid':_0x4865b8,'interface':_0x310c65,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 4ce1225..be64531 100644 --- a/server/services/ami/rpc/voiceCallReport.js +++ b/server/services/ami/rpc/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd494=['context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','calleridnum'];(function(_0x2fa142,_0x4470ac){var _0x61c531=function(_0x1188ba){while(--_0x1188ba){_0x2fa142['push'](_0x2fa142['shift']());}};_0x61c531(++_0x4470ac);}(_0xd494,0x18a));var _0x4d49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd494[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x4d49('0x0'));var util=require(_0x4d49('0x1'));var _=require(_0x4d49('0x2'));var client=require(_0x4d49('0x3'));exports[_0x4d49('0x4')]=function(_0x269113){return client['Request']('CreateVoiceCallReport',{'body':_['merge'](_0x269113,{'source':_0x269113[_0x4d49('0x5')],'destinationcontext':_0x269113[_0x4d49('0x6')],'callerid':_0x269113[_0x4d49('0x7')],'amaflags':_0x4d49('0x8')}),'log':_0x4d49('0x9')});};exports[_0x4d49('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x4d49('0xb')](_0x4d49('0xc'))[_0x4d49('0xd')](_0x4d49('0xe')),moment()['endOf'](_0x4d49('0xc'))[_0x4d49('0xd')](_0x4d49('0xe'))]}},'attributes':[_0x4d49('0xf'),_0x4d49('0x10'),_0x4d49('0x11'),_0x4d49('0x12')]},'log':_0x4d49('0x13')});};}; \ No newline at end of file +var _0x727e=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','GetVoiceCallReport','outbound'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x727e,0x96));var _0xe727=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x727e[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xe727('0x0'));var util=require(_0xe727('0x1'));var _=require('lodash');var client=require(_0xe727('0x2'));exports[_0xe727('0x3')]=function(_0x4a0950){return client[_0xe727('0x4')](_0xe727('0x5'),{'body':_[_0xe727('0x6')](_0x4a0950,{'source':_0x4a0950[_0xe727('0x7')],'destinationcontext':_0x4a0950[_0xe727('0x8')],'callerid':_0x4a0950['callerid'],'amaflags':_0xe727('0x9')}),'log':_0xe727('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xe727('0x4')](_0xe727('0xa'),{'options':{'where':{'type':[_0xe727('0xb')],'createdAt':{'$between':[moment()[_0xe727('0xc')](_0xe727('0xd'))[_0xe727('0xe')](_0xe727('0xf')),moment()['endOf'](_0xe727('0xd'))[_0xe727('0xe')](_0xe727('0xf'))]}},'attributes':[_0xe727('0x10'),_0xe727('0x11'),'duration','billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index feee6d0..f360fce 100644 --- a/server/services/ami/rpc/voiceDialReport.js +++ b/server/services/ami/rpc/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ae4=['../client','create','CreateVoiceDialReport'];(function(_0x168c60,_0x539d96){var _0x29bea4=function(_0x1f7f4e){while(--_0x1f7f4e){_0x168c60['push'](_0x168c60['shift']());}};_0x29bea4(++_0x539d96);}(_0x3ae4,0x165));var _0x43ae=function(_0x5ee750,_0x142508){_0x5ee750=_0x5ee750-0x0;var _0x317088=_0x3ae4[_0x5ee750];return _0x317088;};'use strict';var client=require(_0x43ae('0x0'));exports[_0x43ae('0x1')]=function(_0x139bbd){return client['Request'](_0x43ae('0x2'),{'body':_0x139bbd,'log':_0x43ae('0x2')});}; \ No newline at end of file +var _0x4803=['../client','create','Request','CreateVoiceDialReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4803,0xf8));var _0x3480=function(_0x2b6808,_0x2e8ce8){_0x2b6808=_0x2b6808-0x0;var _0x1d073b=_0x4803[_0x2b6808];return _0x1d073b;};'use strict';var client=require(_0x3480('0x0'));exports[_0x3480('0x1')]=function(_0x292cd6){return client[_0x3480('0x2')]('CreateVoiceDialReport',{'body':_0x292cd6,'log':_0x3480('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 93951a9..7e35733 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4746=['GetVoiceExtension','recordingFormat','../client','getVoiceExtensions'];(function(_0x3018eb,_0x570c63){var _0x23131f=function(_0x33656f){while(--_0x33656f){_0x3018eb['push'](_0x3018eb['shift']());}};_0x23131f(++_0x570c63);}(_0x4746,0xc6));var _0x6474=function(_0x10895e,_0x24e3f7){_0x10895e=_0x10895e-0x0;var _0x3b87d=_0x4746[_0x10895e];return _0x3b87d;};'use strict';var client=require(_0x6474('0x0'));exports[_0x6474('0x1')]=function(){return function(){return client['Request'](_0x6474('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x6474('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x6474('0x1')});};}; \ No newline at end of file +var _0x87ae=['recordingFormat','getVoiceExtensions','Request'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0x87ae,0xf5));var _0xe87a=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x87ae[_0x3ff085];return _0x2b68c3;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xe87a('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xe87a('0x1')],'where':{'VoiceExtensionId':null}},'log':_0xe87a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 431b01a..17de977 100644 --- a/server/services/ami/rpc/voiceQueue.js +++ b/server/services/ami/rpc/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x321e=['dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','TrunkBackup','active','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialGlobalInterval'];(function(_0xa2e9fd,_0x420e13){var _0xf8210e=function(_0x422e83){while(--_0x422e83){_0xa2e9fd['push'](_0xa2e9fd['shift']());}};_0xf8210e(++_0x420e13);}(_0x321e,0x11d));var _0xe321=function(_0x1452db,_0x4c1af4){_0x1452db=_0x1452db-0x0;var _0x24e5f0=_0x321e[_0x1452db];return _0x24e5f0;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0xe321('0x0')](_0xe321('0x1'),{'options':{'raw':![],'attributes':['id',_0xe321('0x2'),_0xe321('0x3'),'acwTimeout',_0xe321('0x4'),_0xe321('0x5'),_0xe321('0x6'),'dialActive',_0xe321('0x7'),_0xe321('0x8'),_0xe321('0x9'),_0xe321('0xa'),_0xe321('0xb'),_0xe321('0xc'),'dialPredictiveInterval',_0xe321('0xd'),_0xe321('0xe'),'dialOriginateTimeout',_0xe321('0xf'),_0xe321('0x10'),'dialQueueProject','dialCongestionMaxRetry',_0xe321('0x11'),_0xe321('0x12'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0xe321('0x13'),_0xe321('0x14'),_0xe321('0x15'),_0xe321('0x16'),_0xe321('0x17'),_0xe321('0x18'),_0xe321('0x19'),'dialAMDTotalAnalysisTime',_0xe321('0x1a'),_0xe321('0x1b'),_0xe321('0x1c'),_0xe321('0x1d'),_0xe321('0x1e'),_0xe321('0x1f'),_0xe321('0x20'),_0xe321('0x21'),_0xe321('0x22'),_0xe321('0x23'),_0xe321('0x24'),_0xe321('0x25'),'monitor_format',_0xe321('0x26'),_0xe321('0x27'),'dialCutDigit',_0xe321('0x28'),_0xe321('0x29'),_0xe321('0x2a'),_0xe321('0x2b'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0xe321('0x2c'),_0xe321('0x2d'),_0xe321('0x2e'),_0xe321('0x2f'),_0xe321('0x30'),_0xe321('0x31'),_0xe321('0x32'),_0xe321('0x33'),_0xe321('0x34')],'include':[{'model':'Trunk','as':_0xe321('0x35'),'attributes':['id',_0xe321('0x2'),_0xe321('0x36'),'active']},{'model':_0xe321('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0xe321('0x2')]},{'model':_0xe321('0x35'),'as':_0xe321('0x38'),'attributes':['id',_0xe321('0x2'),'callerid',_0xe321('0x39')]},{'model':_0xe321('0x3a'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0xe321('0x3a'),'as':_0xe321('0x3b'),'attributes':['id','name','interval']}]}]},'log':_0xe321('0x3c')});};}; \ No newline at end of file +var _0x3767=['dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod'];(function(_0x20d81d,_0xe5667e){var _0x4242e8=function(_0x2987c8){while(--_0x2987c8){_0x20d81d['push'](_0x20d81d['shift']());}};_0x4242e8(++_0xe5667e);}(_0x3767,0x1d7));var _0x7376=function(_0x2489f2,_0x5a0568){_0x2489f2=_0x2489f2-0x0;var _0x1cebd4=_0x3767[_0x2489f2];return _0x1cebd4;};'use strict';var client=require('../client');exports[_0x7376('0x0')]=function(){return function(){return client['Request'](_0x7376('0x1'),{'options':{'raw':![],'attributes':['id',_0x7376('0x2'),_0x7376('0x3'),_0x7376('0x4'),_0x7376('0x5'),_0x7376('0x6'),_0x7376('0x7'),'dialActive',_0x7376('0x8'),_0x7376('0x9'),'dialLimitQueue',_0x7376('0xa'),'dialPredictiveOptimization',_0x7376('0xb'),_0x7376('0xc'),_0x7376('0xd'),_0x7376('0xe'),_0x7376('0xf'),_0x7376('0x10'),_0x7376('0x11'),'dialQueueProject','dialCongestionMaxRetry',_0x7376('0x12'),_0x7376('0x13'),_0x7376('0x14'),'dialNoAnswerMaxRetry',_0x7376('0x15'),_0x7376('0x16'),_0x7376('0x17'),'dialGlobalInterval',_0x7376('0x18'),_0x7376('0x19'),_0x7376('0x1a'),_0x7376('0x1b'),_0x7376('0x1c'),_0x7376('0x1d'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x7376('0x1e'),_0x7376('0x1f'),'dialAMDSilenceThreshold',_0x7376('0x20'),_0x7376('0x21'),'dialRecallMeTimeout','dialRecallInQueue',_0x7376('0x22'),_0x7376('0x23'),_0x7376('0x24'),_0x7376('0x25'),_0x7376('0x6'),_0x7376('0x26'),_0x7376('0x27'),_0x7376('0x28'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x7376('0x29'),_0x7376('0x2a'),_0x7376('0x2b'),_0x7376('0x2c'),'dialMachineMaxRetry',_0x7376('0x2d'),_0x7376('0x2e'),_0x7376('0x2f'),'mandatoryDisposition',_0x7376('0x30'),_0x7376('0x31'),_0x7376('0x32'),_0x7376('0x33')],'include':[{'model':_0x7376('0x34'),'as':_0x7376('0x34'),'attributes':['id','name',_0x7376('0x35'),_0x7376('0x36')]},{'model':_0x7376('0x37'),'as':_0x7376('0x38'),'attributes':['id',_0x7376('0x2')]},{'model':'Trunk','as':_0x7376('0x39'),'attributes':['id',_0x7376('0x2'),_0x7376('0x35'),_0x7376('0x36')]},{'model':_0x7376('0x3a'),'as':'Interval','attributes':['id',_0x7376('0x2')],'include':[{'model':_0x7376('0x3a'),'as':'Intervals','attributes':['id',_0x7376('0x2'),_0x7376('0x3b')]}]}]},'log':_0x7376('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ed45bf8..1022976 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x571d46,_0x48fa80){var _0x1286b7=function(_0x5182ec){while(--_0x5182ec){_0x571d46['push'](_0x571d46['shift']());}};_0x1286b7(++_0x48fa80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x125655,_0x878175){var _0x35fdf9=function(_0x27c1ca){while(--_0x27c1ca){_0x125655['push'](_0x125655['shift']());}};_0x35fdf9(++_0x878175);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 5758b47..77bb62d 100644 --- a/server/services/ami/rpc/voiceQueueRt.js +++ b/server/services/ami/rpc/voiceQueueRt.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49e9=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x397097,_0x27b9c5){var _0x33856d=function(_0x3d2304){while(--_0x3d2304){_0x397097['push'](_0x397097['shift']());}};_0x33856d(++_0x27b9c5);}(_0x49e9,0x128));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x949e('0x0'));exports['getVoiceQueueRtPauses']=function(_0xbeb1e7){return function(){return client['Request'](_0x949e('0x1'),{'options':{'where':{'VoiceQueueId':_0xbeb1e7,'paused':!![]},'raw':!![]},'log':_0x949e('0x2')});};}; \ No newline at end of file +var _0x1802=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x1802,0x144));var _0x2180=function(_0x2408ed,_0x3db9c0){_0x2408ed=_0x2408ed-0x0;var _0x3bd326=_0x1802[_0x2408ed];return _0x3bd326;};'use strict';var client=require(_0x2180('0x0'));exports[_0x2180('0x1')]=function(_0x5550fc){return function(){return client[_0x2180('0x2')](_0x2180('0x3'),{'options':{'where':{'VoiceQueueId':_0x5550fc,'paused':!![]},'raw':!![]},'log':_0x2180('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index da3516e..9c38958 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3ae1b4,_0x567d0){var _0x3a430a=function(_0x1dcfe7){while(--_0x1dcfe7){_0x3ae1b4['push'](_0x3ae1b4['shift']());}};_0x3a430a(++_0x567d0);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3ff36a,_0x54e596){var _0x28ba2a=function(_0x27c285){while(--_0x27c285){_0x3ff36a['push'](_0x3ff36a['shift']());}};_0x28ba2a(++_0x54e596);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 026c6f3..5184b98 100644 --- a/server/services/ami/rpc/voiceTransferReport.js +++ b/server/services/ami/rpc/voiceTransferReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc4c=['transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransfererexten','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','context','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xcc4c,0x171));var _0xccc4=function(_0x34b763,_0x49cbf9){_0x34b763=_0x34b763-0x0;var _0x4126bf=_0xcc4c[_0x34b763];return _0x4126bf;};'use strict';var client=require(_0xccc4('0x0'));exports[_0xccc4('0x1')]={};exports['blindTransfer']=function(_0x3f0fc4){return client[_0xccc4('0x2')](_0xccc4('0x3'),{'body':{'result':_0x3f0fc4[_0xccc4('0x4')],'transfererchannel':_0x3f0fc4[_0xccc4('0x5')],'transferercalleridnum':_0x3f0fc4[_0xccc4('0x6')],'transferercalleridname':_0x3f0fc4['transferercalleridname'],'transfererconnectedlinenum':_0x3f0fc4[_0xccc4('0x7')],'transfererconnectedlinename':_0x3f0fc4[_0xccc4('0x8')],'transfereraccountcode':_0x3f0fc4['transfereraccountcode'],'transferercontext':_0x3f0fc4[_0xccc4('0x9')],'transfererexten':_0x3f0fc4[_0xccc4('0xa')],'transfererlinkedid':_0x3f0fc4[_0xccc4('0xb')],'transfereechannel':_0x3f0fc4[_0xccc4('0xc')],'transfereecalleridnum':_0x3f0fc4[_0xccc4('0xd')],'transfereecalleridname':_0x3f0fc4[_0xccc4('0xe')],'transfereeconnectedlinenum':_0x3f0fc4[_0xccc4('0xf')],'transfereeconnectedlinename':_0x3f0fc4['transfereeconnectedlinename'],'transfereeaccountcode':_0x3f0fc4[_0xccc4('0x10')],'transfereecontext':_0x3f0fc4[_0xccc4('0x11')],'transfereeexten':_0x3f0fc4['transfereeexten'],'transfereelinkedid':_0x3f0fc4[_0xccc4('0x12')],'isexternal':_0x3f0fc4['isexternal'],'context':_0x3f0fc4[_0xccc4('0x13')],'extension':_0x3f0fc4['extension'],'type':_0xccc4('0x14')},'log':_0xccc4('0x3')});};exports[_0xccc4('0x15')]=function(_0x502fe9){return client[_0xccc4('0x2')](_0xccc4('0x3'),{'body':{'result':_0x502fe9['result'],'transfererchannel':_0x502fe9['origtransfererchannel'],'transferercalleridnum':_0x502fe9[_0xccc4('0x16')],'transferercalleridname':_0x502fe9[_0xccc4('0x17')],'transfererconnectedlinenum':_0x502fe9[_0xccc4('0x18')],'transfererconnectedlinename':_0x502fe9[_0xccc4('0x19')],'transfereraccountcode':_0x502fe9[_0xccc4('0x1a')],'transferercontext':_0x502fe9[_0xccc4('0x1b')],'transfererexten':_0x502fe9[_0xccc4('0x1c')],'transfererlinkedid':_0x502fe9[_0xccc4('0x1d')],'transfereechannel':_0x502fe9[_0xccc4('0x1e')],'transfereecalleridnum':_0x502fe9[_0xccc4('0x1f')],'transfereecalleridname':_0x502fe9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x502fe9[_0xccc4('0x20')],'transfereeconnectedlinename':_0x502fe9[_0xccc4('0x21')],'transfereeaccountcode':_0x502fe9[_0xccc4('0x22')],'transfereecontext':_0x502fe9[_0xccc4('0x23')],'transfereeexten':_0x502fe9[_0xccc4('0x24')],'transfereelinkedid':_0x502fe9[_0xccc4('0x25')],'isexternal':_0x502fe9[_0xccc4('0x26')],'context':_0x502fe9['origtransferercontext'],'extension':_0x502fe9[_0xccc4('0x27')],'type':'attended'},'log':_0xccc4('0x3')});}; \ No newline at end of file +var _0x0e61=['transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','../client','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0e61,0x1e3));var _0x10e6=function(_0x47f719,_0x2e559d){_0x47f719=_0x47f719-0x0;var _0x407f4e=_0x0e61[_0x47f719];return _0x407f4e;};'use strict';var client=require(_0x10e6('0x0'));exports['transfers']={};exports[_0x10e6('0x1')]=function(_0x7508b0){return client[_0x10e6('0x2')](_0x10e6('0x3'),{'body':{'result':_0x7508b0['result'],'transfererchannel':_0x7508b0['transfererchannel'],'transferercalleridnum':_0x7508b0[_0x10e6('0x4')],'transferercalleridname':_0x7508b0['transferercalleridname'],'transfererconnectedlinenum':_0x7508b0[_0x10e6('0x5')],'transfererconnectedlinename':_0x7508b0['transfererconnectedlinename'],'transfereraccountcode':_0x7508b0[_0x10e6('0x6')],'transferercontext':_0x7508b0[_0x10e6('0x7')],'transfererexten':_0x7508b0['transfererexten'],'transfererlinkedid':_0x7508b0[_0x10e6('0x8')],'transfereechannel':_0x7508b0[_0x10e6('0x9')],'transfereecalleridnum':_0x7508b0['transfereecalleridnum'],'transfereecalleridname':_0x7508b0['transfereecalleridname'],'transfereeconnectedlinenum':_0x7508b0[_0x10e6('0xa')],'transfereeconnectedlinename':_0x7508b0[_0x10e6('0xb')],'transfereeaccountcode':_0x7508b0['transfereeaccountcode'],'transfereecontext':_0x7508b0[_0x10e6('0xc')],'transfereeexten':_0x7508b0[_0x10e6('0xd')],'transfereelinkedid':_0x7508b0[_0x10e6('0xe')],'isexternal':_0x7508b0[_0x10e6('0xf')],'context':_0x7508b0[_0x10e6('0x10')],'extension':_0x7508b0[_0x10e6('0x11')],'type':_0x10e6('0x12')},'log':'CreateVoiceTransferReport'});};exports[_0x10e6('0x13')]=function(_0x1dc627){return client['Request'](_0x10e6('0x3'),{'body':{'result':_0x1dc627[_0x10e6('0x14')],'transfererchannel':_0x1dc627[_0x10e6('0x15')],'transferercalleridnum':_0x1dc627[_0x10e6('0x16')],'transferercalleridname':_0x1dc627[_0x10e6('0x17')],'transfererconnectedlinenum':_0x1dc627['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1dc627['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1dc627[_0x10e6('0x18')],'transferercontext':_0x1dc627['secondtransferercontext'],'transfererexten':_0x1dc627[_0x10e6('0x19')],'transfererlinkedid':_0x1dc627[_0x10e6('0x1a')],'transfereechannel':_0x1dc627['transfertargetchannel'],'transfereecalleridnum':_0x1dc627[_0x10e6('0x1b')],'transfereecalleridname':_0x1dc627['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1dc627[_0x10e6('0x1c')],'transfereeconnectedlinename':_0x1dc627[_0x10e6('0x1d')],'transfereeaccountcode':_0x1dc627[_0x10e6('0x1e')],'transfereecontext':_0x1dc627[_0x10e6('0x1f')],'transfereeexten':_0x1dc627[_0x10e6('0x20')],'transfereelinkedid':_0x1dc627[_0x10e6('0x21')],'isexternal':_0x1dc627['isexternal'],'context':_0x1dc627[_0x10e6('0x22')],'extension':_0x1dc627['origtransfererexten'],'type':'attended'},'log':_0x10e6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7c12033..4ff1229 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x1bcd25,_0x2fa779){var _0x16848e=function(_0x30b074){while(--_0x30b074){_0x1bcd25['push'](_0x1bcd25['shift']());}};_0x16848e(++_0x2fa779);}(_0xb10b,0x12a));var _0xbb10=function(_0x7e8ffb,_0x272fcc){_0x7e8ffb=_0x7e8ffb-0x0;var _0x1756f6=_0xb10b[_0x7e8ffb];return _0x1756f6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x57c5db,_0xb6c08c){var _0x266a63=function(_0x3707be){while(--_0x3707be){_0x57c5db['push'](_0x57c5db['shift']());}};_0x266a63(++_0xb6c08c);}(_0x7a54,0x106));var _0x47a5=function(_0x3adde7,_0x5e482c){_0x3adde7=_0x3adde7-0x0;var _0x2495a1=_0x7a54[_0x3adde7];return _0x2495a1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index bf11422..31f2fdc 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb1e=['[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','destcalleridname','','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','uniqueid'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbb1e,0x7c));var _0xebb1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbb1e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xebb1('0x0'));var BPromise=require(_0xebb1('0x1'));var Redis=require(_0xebb1('0x2'));var util=require(_0xebb1('0x3'));var config=require(_0xebb1('0x4'));var logger=require(_0xebb1('0x5'))(_0xebb1('0x6'));var cmContactRpc=require(_0xebb1('0x7'));config[_0xebb1('0x8')]=_[_0xebb1('0x9')](config[_0xebb1('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xebb1('0xa'))(new Redis(config[_0xebb1('0x8')]));function emit(_0x3809af,_0x2aedd5,_0x2faa4c,_0x560088,_0x3751d4){logger[_0xebb1('0xb')](_0xebb1('0xc'),_0x3809af,_0x2aedd5['id'],_0x2faa4c,_0x560088,JSON[_0xebb1('0xd')](_0x3751d4));io['to'](_0x2faa4c)['emit'](_0x560088,_0x3751d4);}exports[_0xebb1('0xe')]=function(_0x34c2d4,_0x456936,_0x13ea0e,_0x3d71d6){var _0x184f85,_0x27d2c3;var _0xba261={};var _0x40a4af;var _0x59b1c7=Number(_0x13ea0e[_0xebb1('0xf')]);var _0x595294=_0x13ea0e[_0xebb1('0x10')]?Boolean(Number(_0x13ea0e[_0xebb1('0x10')])):![];var _0x2cf467;var _0x1efb01=![];if(!_[_0xebb1('0x11')](_0x13ea0e[_0xebb1('0x12')])){if(_0x13ea0e[_0xebb1('0x12')]=='1')_0x1efb01=!![];}if(!_0x1efb01){if(_0x3d71d6[_0xebb1('0x13')]){_0xba261['id']=_0x3d71d6[_0xebb1('0x13')];}}if(!_0xba261['id']){_0xba261[_0xebb1('0x14')]=_0x59b1c7;_0x2cf467=_0x13ea0e['data3']&&_0x13ea0e[_0xebb1('0x15')]!=='0'?_0x13ea0e['data3'][_0xebb1('0x16')](','):[_0xebb1('0x17')];_0xba261[_0xebb1('0x18')]=_['map'](_0x2cf467,function(_0x46ff80){var _0x34f821={};_0x34f821[_0x46ff80]=_0x3d71d6[_0xebb1('0x19')]?_0x3d71d6['destcalleridnum']:_0x3d71d6['calleridnum'];return _0x34f821;});_0x40a4af=_0x3d71d6[_0xebb1('0x19')]?_0x3d71d6[_0xebb1('0x1a')]:_0x3d71d6[_0xebb1('0x1b')];}var _0x4916b4=['id',_0xebb1('0x1c'),_0xebb1('0x1d'),'phone','mobile','fax',_0xebb1('0x14'),'createdAt',_0xebb1('0x1e'),_0xebb1('0x1f')];var _0x1998d4=_['union'](_0x4916b4,_0x2cf467);BPromise[_0xebb1('0x20')]()[_0xebb1('0x21')](cmContactRpc[_0xebb1('0x22')]({'attributes':_0x1998d4,'where':_0xba261,'phone':_0x40a4af}))[_0xebb1('0x21')](function(_0x6ee371){_0x27d2c3=_0x6ee371;if(!_[_0xebb1('0x23')](_0x27d2c3)){if(_0x27d2c3[_0xebb1('0x24')]===0x1){_0x184f85=_0x27d2c3[0x0];logger[_0xebb1('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x3d71d6[_0xebb1('0x25')],_0x456936['id'],_0x184f85['id']);}else{logger['info'](_0xebb1('0x26'),_0x3d71d6[_0xebb1('0x25')],_0x456936['id'],_['map'](_0x27d2c3,'id')[_0xebb1('0x27')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x3d71d6['uniqueid'],_0x456936['id']);var _0xf96dc0={'ListId':_0x59b1c7};var _0x50a126=_0x13ea0e[_0xebb1('0x28')]&&_0x13ea0e[_0xebb1('0x28')]!=='0'?_0x13ea0e[_0xebb1('0x28')]:'phone';if(_0x595294){logger[_0xebb1('0xb')](_0xebb1('0x29'),_0x3d71d6[_0xebb1('0x25')],_0x456936['id']);_0xf96dc0[_0x50a126]=_[_0xebb1('0x11')](_0x3d71d6[_0xebb1('0x19')])?_0x3d71d6[_0xebb1('0x1b')]:_0x3d71d6[_0xebb1('0x1a')];if(_[_0xebb1('0x11')](_0x3d71d6[_0xebb1('0x19')])){_0xf96dc0['firstName']=_0x3d71d6[_0xebb1('0x2a')]&&_0x3d71d6[_0xebb1('0x2a')]!==''?_0x3d71d6[_0xebb1('0x2a')]:'Unknown';}else{_0xf96dc0[_0xebb1('0x1c')]=_0x3d71d6[_0xebb1('0x2b')]&&_0x3d71d6[_0xebb1('0x2b')]!==_0xebb1('0x2c')?_0x3d71d6['destcalleridname']:'Unknown';}return BPromise[_0xebb1('0x20')]()[_0xebb1('0x21')](cmContactRpc[_0xebb1('0x2d')](_0xf96dc0))[_0xebb1('0x21')](function(_0x5794c7){_0x184f85=_0x5794c7;_0x27d2c3['push'](_0x5794c7);if(_0x184f85){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x3d71d6[_0xebb1('0x25')],_0x456936['id'],_0x184f85['id']);}return;});}else{logger['info'](_0xebb1('0x2e'),_0x3d71d6[_0xebb1('0x25')],_0x456936['id']);_0xf96dc0[_0x50a126]=_['isNil'](_0x3d71d6[_0xebb1('0x19')])?_0x3d71d6[_0xebb1('0x1b')]:_0x3d71d6[_0xebb1('0x1a')];if(_['isNil'](_0x3d71d6[_0xebb1('0x19')])){_0xf96dc0[_0xebb1('0x1c')]=_0x3d71d6['calleridname']&&_0x3d71d6['calleridname']!==''?_0x3d71d6[_0xebb1('0x2a')]:'Unknown';}else{_0xf96dc0[_0xebb1('0x1c')]=_0x3d71d6[_0xebb1('0x2b')]&&_0x3d71d6[_0xebb1('0x2b')]!==_0xebb1('0x2c')?_0x3d71d6['destcalleridname']:_0xebb1('0x2f');}_0x184f85=_0xf96dc0;_0x27d2c3['push'](_0xf96dc0);return;}}})[_0xebb1('0x21')](function(){if(_0x34c2d4){emit(_0x3d71d6['uniqueid'],_0x456936,util[_0xebb1('0x30')](_0xebb1('0x31'),_0x34c2d4[_0xebb1('0x32')]),util[_0xebb1('0x30')](_0xebb1('0x33'),_0x13ea0e['action'][_0xebb1('0x34')]()),{'evt':_[_0xebb1('0x35')](_0x3d71d6,{'autoCreate':_0x595294}),'contact':_0x184f85===undefined?{}:_0x184f85,'contacts':_0x27d2c3[_0xebb1('0x24')]===0x0?undefined:_0x27d2c3});}});}; \ No newline at end of file +var _0x3dd4=['resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dd4,0xfc));var _0x43dd=function(_0x19580c,_0xa42ceb){_0x19580c=_0x19580c-0x0;var _0x268443=_0x3dd4[_0x19580c];return _0x268443;};'use strict';var _=require(_0x43dd('0x0'));var BPromise=require('bluebird');var Redis=require(_0x43dd('0x1'));var util=require(_0x43dd('0x2'));var config=require(_0x43dd('0x3'));var logger=require(_0x43dd('0x4'))(_0x43dd('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x43dd('0x6')]=_['defaults'](config[_0x43dd('0x6')],{'host':_0x43dd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43dd('0x6')]));function emit(_0x4c4284,_0x1cdd59,_0x2d8058,_0x3a338b,_0x240234){logger[_0x43dd('0x8')](_0x43dd('0x9'),_0x4c4284,_0x1cdd59['id'],_0x2d8058,_0x3a338b,JSON[_0x43dd('0xa')](_0x240234));io['to'](_0x2d8058)['emit'](_0x3a338b,_0x240234);}exports[_0x43dd('0xb')]=function(_0x3c01f9,_0x15aa75,_0x1b9876,_0x2e2193){var _0x2e46a9,_0x4683b6;var _0x194110={};var _0xc83c14;var _0x5c0951=Number(_0x1b9876[_0x43dd('0xc')]);var _0x5a1260=_0x1b9876[_0x43dd('0xd')]?Boolean(Number(_0x1b9876[_0x43dd('0xd')])):![];var _0x53fd8e;var _0x5a7332=![];if(!_[_0x43dd('0xe')](_0x1b9876[_0x43dd('0xf')])){if(_0x1b9876['data5']=='1')_0x5a7332=!![];}if(!_0x5a7332){if(_0x2e2193['xmd-contactid']){_0x194110['id']=_0x2e2193[_0x43dd('0x10')];}}if(!_0x194110['id']){_0x194110[_0x43dd('0x11')]=_0x5c0951;_0x53fd8e=_0x1b9876[_0x43dd('0x12')]&&_0x1b9876[_0x43dd('0x12')]!=='0'?_0x1b9876[_0x43dd('0x12')][_0x43dd('0x13')](','):[_0x43dd('0x14')];_0x194110['$or']=_[_0x43dd('0x15')](_0x53fd8e,function(_0x110d17){var _0x3ff36c={};_0x3ff36c[_0x110d17]=_0x2e2193[_0x43dd('0x16')]?_0x2e2193['destcalleridnum']:_0x2e2193[_0x43dd('0x17')];return _0x3ff36c;});_0xc83c14=_0x2e2193['routeId']?_0x2e2193[_0x43dd('0x18')]:_0x2e2193[_0x43dd('0x17')];}var _0xca5b8e=['id',_0x43dd('0x19'),_0x43dd('0x1a'),_0x43dd('0x14'),_0x43dd('0x1b'),_0x43dd('0x1c'),_0x43dd('0x11'),_0x43dd('0x1d'),_0x43dd('0x1e'),_0x43dd('0x1f')];var _0x14d654=_[_0x43dd('0x20')](_0xca5b8e,_0x53fd8e);BPromise[_0x43dd('0x21')]()['then'](cmContactRpc['getContacts']({'attributes':_0x14d654,'where':_0x194110,'phone':_0xc83c14}))[_0x43dd('0x22')](function(_0x49d9c7){_0x4683b6=_0x49d9c7;if(!_[_0x43dd('0x23')](_0x4683b6)){if(_0x4683b6[_0x43dd('0x24')]===0x1){_0x2e46a9=_0x4683b6[0x0];logger[_0x43dd('0x8')](_0x43dd('0x25'),_0x2e2193[_0x43dd('0x26')],_0x15aa75['id'],_0x2e46a9['id']);}else{logger[_0x43dd('0x8')](_0x43dd('0x27'),_0x2e2193['uniqueid'],_0x15aa75['id'],_[_0x43dd('0x15')](_0x4683b6,'id')['join'](','));}return;}else{logger['info'](_0x43dd('0x28'),_0x2e2193[_0x43dd('0x26')],_0x15aa75['id']);var _0x1eb741={'ListId':_0x5c0951};var _0x1d0494=_0x1b9876['data4']&&_0x1b9876[_0x43dd('0x29')]!=='0'?_0x1b9876[_0x43dd('0x29')]:_0x43dd('0x14');if(_0x5a1260){logger[_0x43dd('0x8')](_0x43dd('0x2a'),_0x2e2193['uniqueid'],_0x15aa75['id']);_0x1eb741[_0x1d0494]=_['isNil'](_0x2e2193[_0x43dd('0x16')])?_0x2e2193['calleridnum']:_0x2e2193[_0x43dd('0x18')];if(_[_0x43dd('0xe')](_0x2e2193['routeId'])){_0x1eb741[_0x43dd('0x19')]=_0x2e2193[_0x43dd('0x2b')]&&_0x2e2193[_0x43dd('0x2b')]!==_0x43dd('0x2c')?_0x2e2193[_0x43dd('0x2b')]:'Unknown';}else{_0x1eb741[_0x43dd('0x19')]=_0x2e2193['destcalleridname']&&_0x2e2193[_0x43dd('0x2d')]!==_0x43dd('0x2c')?_0x2e2193[_0x43dd('0x2d')]:_0x43dd('0x2e');}return BPromise[_0x43dd('0x21')]()[_0x43dd('0x22')](cmContactRpc[_0x43dd('0x2f')](_0x1eb741))[_0x43dd('0x22')](function(_0x5b1ec1){_0x2e46a9=_0x5b1ec1;_0x4683b6[_0x43dd('0x30')](_0x5b1ec1);if(_0x2e46a9){logger['info'](_0x43dd('0x31'),_0x2e2193[_0x43dd('0x26')],_0x15aa75['id'],_0x2e46a9['id']);}return;});}else{logger[_0x43dd('0x8')](_0x43dd('0x32'),_0x2e2193[_0x43dd('0x26')],_0x15aa75['id']);_0x1eb741[_0x1d0494]=_[_0x43dd('0xe')](_0x2e2193['routeId'])?_0x2e2193[_0x43dd('0x17')]:_0x2e2193[_0x43dd('0x18')];if(_[_0x43dd('0xe')](_0x2e2193['routeId'])){_0x1eb741[_0x43dd('0x19')]=_0x2e2193[_0x43dd('0x2b')]&&_0x2e2193[_0x43dd('0x2b')]!==''?_0x2e2193['calleridname']:_0x43dd('0x2e');}else{_0x1eb741[_0x43dd('0x19')]=_0x2e2193[_0x43dd('0x2d')]&&_0x2e2193[_0x43dd('0x2d')]!==_0x43dd('0x2c')?_0x2e2193[_0x43dd('0x2d')]:_0x43dd('0x2e');}_0x2e46a9=_0x1eb741;_0x4683b6[_0x43dd('0x30')](_0x1eb741);return;}}})[_0x43dd('0x22')](function(){if(_0x3c01f9){emit(_0x2e2193[_0x43dd('0x26')],_0x15aa75,util[_0x43dd('0x33')](_0x43dd('0x34'),_0x3c01f9[_0x43dd('0x35')]),util[_0x43dd('0x33')](_0x43dd('0x36'),_0x1b9876[_0x43dd('0x37')][_0x43dd('0x38')]()),{'evt':_['merge'](_0x2e2193,{'autoCreate':_0x5a1260}),'contact':_0x2e46a9===undefined?{}:_0x2e46a9,'contacts':_0x4683b6[_0x43dd('0x24')]===0x0?undefined:_0x4683b6});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2342db5..ad1be23 100644 --- a/server/services/ami/trigger/index.js +++ b/server/services/ami/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5f1=['user:%s','trigger:%s:%s','data1','merge','name','trigger:%s','exec','integration','queue','urlforward','script','parse','query','replace','channel','AllConditions','every','AnyConditions','some','checkConditions','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','value','upperFirst','interaction','message','event','operator','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','undefined','created','equals','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','emit','clone','motionChannel','voice','debug','inspect','checkTriggers','interface','status','checkTrigger','Actions','length','action','toLowerCase','contactmanager','browser','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','uriLocation','windowWidth','data5','800','data6','600','winApplication','winArguments','format'];(function(_0x4bef40,_0x2270d7){var _0x23b5e2=function(_0x58cb40){while(--_0x58cb40){_0x4bef40['push'](_0x4bef40['shift']());}};_0x23b5e2(++_0x2270d7);}(_0xd5f1,0x1b1));var _0x1d5f=function(_0x32d19b,_0xa3dcd){_0x32d19b=_0x32d19b-0x0;var _0x2b3139=_0xd5f1[_0x32d19b];return _0x2b3139;};'use strict';var util=require(_0x1d5f('0x0'));var _=require(_0x1d5f('0x1'));var url=require(_0x1d5f('0x2'));var Mustache=require(_0x1d5f('0x3'));var Redis=require('ioredis');var urlforward=require(_0x1d5f('0x4'));var integration=require(_0x1d5f('0x5'));var cmContact=require(_0x1d5f('0x6'));var script=require('./script');var config=require('../../../config/environment');var logger=require('../../../config/logger')('trigger');var ami=require(_0x1d5f('0x7'));config['redis']=_['defaults'](config[_0x1d5f('0x8')],{'host':_0x1d5f('0x9'),'port':0x18eb});var io=require(_0x1d5f('0xa'))(new Redis(config[_0x1d5f('0x8')]));var operators={'equals':function(_0x4bc7e0,_0x5c254d){return _0x4bc7e0==_0x5c254d;},'not_equals':function(_0xb30838,_0x1d0ba7){return _0xb30838!=_0x1d0ba7;}};var barAndWebActions=[_0x1d5f('0xb'),_0x1d5f('0x2'),_0x1d5f('0xc')];function Trigger(_0x37594a){this['triggers']=_0x37594a[_0x1d5f('0xd')];this[_0x1d5f('0xe')]=_0x37594a[_0x1d5f('0xe')];this[_0x1d5f('0xf')]=_0x37594a[_0x1d5f('0xf')];this[_0x1d5f('0x10')]=_0x37594a['templates'];this[_0x1d5f('0x11')]=_0x37594a['voiceExtensions'];this[_0x1d5f('0x12')]=_0x37594a[_0x1d5f('0x12')];this[_0x1d5f('0x13')]=_0x37594a[_0x1d5f('0x13')];this[_0x1d5f('0x14')]=_0x37594a[_0x1d5f('0x14')];this[_0x1d5f('0x15')]=_0x37594a[_0x1d5f('0x15')];this['zohoAccounts']=_0x37594a['zohoAccounts'];this['deskAccounts']=_0x37594a['deskAccounts'];this[_0x1d5f('0x16')]=_0x37594a[_0x1d5f('0x16')];this[_0x1d5f('0x17')]=_0x37594a[_0x1d5f('0x17')];this[_0x1d5f('0x18')]=_0x37594a[_0x1d5f('0x18')];this['freshsalesAccounts']=_0x37594a[_0x1d5f('0x19')];this[_0x1d5f('0x1a')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x1d5f('0x14')],'freshdesk':this[_0x1d5f('0x13')],'sugarcrm':this[_0x1d5f('0x15')],'zoho':this[_0x1d5f('0x1b')],'desk':this['deskAccounts'],'vtiger':this[_0x1d5f('0x16')],'dynamics365':this[_0x1d5f('0x18')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0x1d5f('0x1c'),this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x1d5f('0x20'),this['syncCustomEvent'][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x21'),this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0x1d5f('0x23'),this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on']('custom:agentbusy',this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on']('custom:agentcongestion',this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x24'),this[_0x1d5f('0x1d')]['bind'](this));ami['on'](_0x1d5f('0x25'),this[_0x1d5f('0x1d')]['bind'](this));ami['on'](_0x1d5f('0x26'),this['syncCustomEvent'][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x27'),this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x28'),this[_0x1d5f('0x29')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x2a'),this[_0x1d5f('0x29')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x2b'),this[_0x1d5f('0x29')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x2c'),this['syncCustomEvent']['bind'](this));ami['on'](_0x1d5f('0x2d'),this['syncCustomEvent'][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x2e'),this[_0x1d5f('0x1d')]['bind'](this));ami['on'](_0x1d5f('0x2f'),this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x30'),this[_0x1d5f('0x1d')]['bind'](this));ami['on'](_0x1d5f('0x31'),this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on'](_0x1d5f('0x32'),this[_0x1d5f('0x1d')][_0x1d5f('0x1e')](this));ami['on']('custom:offlineMessage',this['syncCustomEvent']['bind'](this));}Trigger[_0x1d5f('0x33')]['emit']=function(_0x1aa988,_0x2badfa,_0x26a671){logger[_0x1d5f('0x34')](_0x1aa988,_0x2badfa,JSON['stringify'](_0x26a671));io['to'](_0x1aa988)[_0x1d5f('0x35')](_0x2badfa,_0x26a671);};Trigger['prototype']['syncCustomEvent']=function(_0x1f6bc7){var _0x26dcec=_[_0x1d5f('0x36')](_0x1f6bc7);if(typeof _0x26dcec[_0x1d5f('0x37')]==='undefined'){_0x26dcec[_0x1d5f('0x37')]=_0x1d5f('0x38');}logger[_0x1d5f('0x39')]('syncCustomEvent',util[_0x1d5f('0x3a')](_0x26dcec,{'showHidden':!![],'depth':null}));this[_0x1d5f('0x3b')](_0x26dcec);};Trigger['prototype'][_0x1d5f('0x29')]=function(_0x1e2f5e){if(this[_0x1d5f('0xe')][_0x1e2f5e[_0x1d5f('0x3c')]]){this[_0x1d5f('0x1d')](_0x1e2f5e);}};Trigger[_0x1d5f('0x33')][_0x1d5f('0x3b')]=function(_0x1f960d){var _0x1a7ecd;for(var _0x3806a5 in this['triggers']){if(this['triggers']['hasOwnProperty'](_0x3806a5)){if(this[_0x1d5f('0xd')][_0x3806a5][_0x1d5f('0x3d')]){_0x1a7ecd=this[_0x1d5f('0x3e')](this[_0x1d5f('0xd')][_0x3806a5],_0x1f960d);if(_0x1a7ecd){_['merge'](_0x1f960d,_0x1f960d['variables']);for(var _0x3e4013=0x0,_0x1dedd6,_0x5e2e36,_0x22b87e;_0x3e40130x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x50fdae,_0x3c4406){var _0x200e1d=function(_0x181a2a){while(--_0x181a2a){_0x50fdae['push'](_0x50fdae['shift']());}};_0x200e1d(++_0x3c4406);}(_0x3e74,0x175));var _0x43e7=function(_0x516599,_0x1d5623){_0x516599=_0x516599-0x0;var _0x206d28=_0x3e74[_0x516599];return _0x206d28;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 77ebb43..e3b9a0d 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb765=['Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','POST','clientId','username','password','clientSecret','access_token','error','toUpperCase','message','then','GET','Bearer\x20','value','isNil','validateEmail','email','length','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','userId','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','replace','4.0','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format'];(function(_0x15574c,_0x44373d){var _0x323d16=function(_0x246ba5){while(--_0x246ba5){_0x15574c['push'](_0x15574c['shift']());}};_0x323d16(++_0x44373d);}(_0xb765,0x151));var _0x5b76=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb765[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5b76('0x0'));var rp=require(_0x5b76('0x1'));var util=require(_0x5b76('0x2'));var intUtil=require(_0x5b76('0x3'));var md5=require('md5');var Redis=require(_0x5b76('0x4'));var logger=require(_0x5b76('0x5'))(_0x5b76('0x6'));var config=require(_0x5b76('0x7'));config[_0x5b76('0x8')]=_[_0x5b76('0x9')](config[_0x5b76('0x8')],{'host':_0x5b76('0xa'),'port':0x18eb});var io=require(_0x5b76('0xb'))(new Redis(config['redis']));function getAuthToken(_0x1cd410,_0x5a401b,_0x462bc4){if(_0x1cd410[_0x5b76('0xc')]){_0x1cd410[_0x5b76('0xd')]=_0x1cd410[_0x5b76('0xe')][_0x5b76('0xf')];_0x1cd410['tenantId']=_0x1cd410[_0x5b76('0xe')][_0x5b76('0x10')];return Promise[_0x5b76('0x11')](_0x1cd410['CloudProvider']['data5']);}var _0x5d6f9c={'method':_0x5b76('0x12'),'uri':_0x5a401b,'form':{'client_id':_0x1cd410[_0x5b76('0x13')],'resource':_0x1cd410[_0x5b76('0xd')],'username':_0x1cd410[_0x5b76('0x14')],'password':_0x1cd410[_0x5b76('0x15')],'grant_type':'password','client_secret':_0x1cd410[_0x5b76('0x16')]},'json':!![]};return rp(_0x5d6f9c)['then'](function(_0x275907){return _0x275907[_0x5b76('0x17')];})['catch'](function(_0x575be5){logger[_0x5b76('0x18')]('['+[_0x462bc4[_0x5b76('0x19')]()]+']\x20Wrong\x20credentials!');return _0x575be5[_0x5b76('0x1a')];});}function getUser(_0x11b36b,_0x4f3994,_0x4fd428,_0x1072b7,_0x3ee824,_0x2961b1){return new Promise(function(_0x66ebb7,_0x243ffe){return getAuthToken(_0x4f3994,_0x1072b7,_0x2961b1)[_0x5b76('0x1b')](function(_0x438c45){var _0x4458ab={'method':_0x5b76('0x1c'),'uri':_0x3ee824+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x5b76('0x1d')+_0x438c45,'OData-Version':'4.0'},'json':!![]};return rp(_0x4458ab);})[_0x5b76('0x1b')](function(_0x271402){var _0x1048b9=_0x271402[_0x5b76('0x1e')];var _0x26d8a2=![];var _0x1f2369=null;if(!_[_0x5b76('0x1f')](_0x4fd428)){if(intUtil[_0x5b76('0x20')](_0x4fd428[_0x5b76('0x21')])){_0x11b36b['userEmail']=_0x4fd428[_0x5b76('0x21')];for(_0x1f2369=0x0;_0x1f2369<_0x1048b9[_0x5b76('0x22')];_0x1f2369++){if(_0x1048b9[_0x1f2369]['internalemailaddress']===_0x4fd428[_0x5b76('0x21')]&&!_0x1048b9[_0x1f2369]['isdisabled']){_0x26d8a2=!![];logger[_0x5b76('0x23')]('['+[_0x2961b1[_0x5b76('0x19')]()]+_0x5b76('0x24')+_0x1048b9[_0x1f2369][_0x5b76('0x25')]+'!');_0x11b36b['userId']=_0x1048b9[_0x1f2369][_0x5b76('0x25')];}}}}if(!_0x26d8a2){logger[_0x5b76('0x23')]('['+[_0x2961b1[_0x5b76('0x19')]()]+_0x5b76('0x26'));_0x11b36b[_0x5b76('0x27')]=_0x4f3994['username'];for(_0x1f2369=0x0;_0x1f2369<_0x1048b9[_0x5b76('0x22')];_0x1f2369++){if(_0x1048b9[_0x1f2369]['internalemailaddress']===_0x4f3994['username']){_0x11b36b['userId']=_0x1048b9[_0x1f2369][_0x5b76('0x25')];}}}_0x66ebb7(_0x11b36b);})[_0x5b76('0x28')](function(_0x2c3ac1){_0x243ffe(_0x2c3ac1[_0x5b76('0x1a')]);});});}function createEndUser(_0x5c61a2,_0x3c0672,_0x2b7bb1,_0xcc6ae,_0x5aa939,_0x3fbd23,_0x356c44){return new Promise(function(_0x905958,_0x1396db){return getAuthToken(_0x3c0672,_0x2b7bb1,_0x3fbd23)[_0x5b76('0x1b')](function(_0x292f96){var _0xb2187c=_0x3fbd23[_0x5b76('0x29')]()===_0x5b76('0x2a')?_0x5aa939[_0x5b76('0x2b')]:_0x5aa939[_0x5b76('0x2c')];var _0x41758d={'method':_0x5b76('0x12'),'uri':_0xcc6ae+_0x5b76('0x2d'),'body':{'fullname':_0xb2187c,'firstname':_0xb2187c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5b76('0x2e')+_0x5c61a2[_0x5b76('0x2f')]+')'},'headers':{'Authorization':_0x5b76('0x1d')+_0x292f96,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x41758d['body'][_0x356c44]=_0xb2187c;return rp(_0x41758d);})[_0x5b76('0x1b')](function(_0x1ef16c){var _0xd5edc5=_0x1ef16c[_0x5b76('0x30')][_0x5b76('0x31')];var _0x496495=_0xd5edc5[_0x5b76('0x32')](_0xd5edc5[_0x5b76('0x33')]('(')+0x1,_0xd5edc5[_0x5b76('0x33')](')'));_0x5c61a2[_0x5b76('0x34')]=_0x496495;_0x905958(_0x5c61a2);})[_0x5b76('0x28')](function(_0x279dd8){_0x1396db(_0x279dd8[_0x5b76('0x1a')]);});});}function getEndUser(_0x1cba68,_0x36ab4a,_0x5a675b,_0x1f717d,_0x1bbedb,_0x47ff8a,_0x29ed25,_0x3f6f34){var _0x956a91=_0x47ff8a['toLowerCase']()===_0x5b76('0x2a')?_0x1bbedb['destcalleridnum']:_0x1bbedb[_0x5b76('0x2c')];return getAuthToken(_0x36ab4a,_0x5a675b,_0x47ff8a)[_0x5b76('0x1b')](function(_0x1c4d02){_0x3f6f34=_0x3f6f34?_0x3f6f34:_0x5b76('0x35');var _0x14e8bc={'method':_0x5b76('0x1c'),'uri':_0x1f717d+_0x5b76('0x36')+_0x3f6f34+_0x5b76('0x37')+_0x3f6f34+'\x20eq\x20\x27'+_0x956a91[_0x5b76('0x38')]('+','%2b')+'\x27','headers':{'Authorization':_0x5b76('0x1d')+_0x1c4d02,'If-None-Match':null,'OData-Version':_0x5b76('0x39')},'json':!![]};return rp(_0x14e8bc);})[_0x5b76('0x1b')](function(_0x393097){var _0x28e0e6=![];if(!_0x393097)return _0x28e0e6;var _0x9a0d02=_0x393097[_0x5b76('0x1e')];for(var _0x5ca9b7=0x0;_0x5ca9b7<_0x9a0d02[_0x5b76('0x22')];_0x5ca9b7++){if(_0x9a0d02[_0x5ca9b7][_0x3f6f34]===_0x956a91){_0x28e0e6=!![];_0x1cba68[_0x5b76('0x34')]=_0x9a0d02[_0x5ca9b7][_0x5b76('0x3a')];}}return _0x28e0e6;})['then'](function(_0x4740bb){if(_0x4740bb)return _0x1cba68;if(_0x29ed25===_0x5b76('0x3b')){logger[_0x5b76('0x23')]('['+[_0x47ff8a[_0x5b76('0x19')]()]+_0x5b76('0x3c'));return _0x1cba68;}return createEndUser(_0x1cba68,_0x36ab4a,_0x5a675b,_0x1f717d,_0x1bbedb,_0x47ff8a,_0x3f6f34)['then'](function(_0x56f53c){logger[_0x5b76('0x23')]('['+[_0x47ff8a[_0x5b76('0x19')]()]+']\x20Enduser\x20created!',_0x56f53c['enduserId']);return _0x56f53c;});});}function getCustomFields(_0x433913,_0x3530ce,_0x1b43d2){var _0x224ab7={};if(_0x433913[_0x5b76('0x22')]>0x0){_[_0x5b76('0x3d')](_0x433913,function(_0x4bf29f){if(_[_0x5b76('0x3e')]([_0x5b76('0x3f'),_0x5b76('0x40')],_0x4bf29f[_0x5b76('0x41')])&&_0x4bf29f[_0x5b76('0x42')]&&!_0x4bf29f[_0x5b76('0x43')]){var _0x19f590=_0x4bf29f[_0x5b76('0x44')][_0x5b76('0x29')]();var _0x418e8b=_0x19f590[_0x5b76('0x32')](0x0,_0x19f590[_0x5b76('0x45')]('_'));var _0x445aa5=_0x19f590[_0x5b76('0x32')](_0x19f590['indexOf']('_')+0x1);if(_0x418e8b===_0x1b43d2){_0x224ab7[_0x445aa5]=_0x4bf29f['content'];}}});}return _0x224ab7;}function getTicket(_0x51dcf8,_0x199418,_0x5a1e03,_0x13dab8,_0x4bc06c,_0x266c6b,_0x5a494f){return new Promise(function(_0x2ba36c,_0x4a81f1){var _0x507d3d;return getAuthToken(_0x199418,_0x5a1e03,_0x5a494f)[_0x5b76('0x1b')](function(_0x4f7529){if(_0x266c6b[_0x5b76('0x46')]===_0x5b76('0x47')){_0x507d3d={'method':_0x5b76('0x12'),'uri':_0x13dab8+_0x5b76('0x48'),'body':Object[_0x5b76('0x49')]({},{'title':intUtil[_0x5b76('0x4a')](_0x266c6b[_0x5b76('0x4b')],_0x4bc06c,'\x20'),'description':intUtil[_0x5b76('0x4a')](_0x266c6b[_0x5b76('0x4c')],_0x4bc06c,'\x0a'),'customerid_contact@odata.bind':_0x51dcf8[_0x5b76('0x34')]?_0x5b76('0x4d')+_0x51dcf8[_0x5b76('0x34')]+')':undefined,'ownerid@odata.bind':_0x5b76('0x2e')+_0x51dcf8[_0x5b76('0x2f')]+')','caseorigincode':'1'},getCustomFields(_0x266c6b[_0x5b76('0x4e')],_0x4bc06c,_0x266c6b[_0x5b76('0x46')])),'headers':{'Authorization':_0x5b76('0x1d')+_0x4f7529,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x266c6b[_0x5b76('0x46')]===_0x5b76('0x4f')){var _0x16877=_0x51dcf8[_0x5b76('0x34')]?[{'partyid_systemuser@odata.bind':_0x5b76('0x2e')+_0x51dcf8['userId']+')','participationtypemask':_0x51dcf8[_0x5b76('0x50')]===_0x5b76('0x51')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x51dcf8[_0x5b76('0x34')]+')','participationtypemask':_0x51dcf8[_0x5b76('0x50')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5b76('0x2e')+_0x51dcf8[_0x5b76('0x2f')]+')','participationtypemask':_0x51dcf8[_0x5b76('0x50')]==='queue'?0x2:0x1}];_0x507d3d={'method':_0x5b76('0x12'),'uri':_0x13dab8+_0x5b76('0x52'),'body':Object[_0x5b76('0x49')]({},{'subject':intUtil[_0x5b76('0x4a')](_0x266c6b[_0x5b76('0x4b')],_0x4bc06c,'\x20'),'phonenumber':String(_0x4bc06c[_0x5b76('0x2c')]),'description':intUtil[_0x5b76('0x4a')](_0x266c6b[_0x5b76('0x4c')],_0x4bc06c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x51dcf8[_0x5b76('0x34')]?_0x5b76('0x4d')+_0x51dcf8[_0x5b76('0x34')]+')':undefined,'ownerid@odata.bind':_0x5b76('0x2e')+_0x51dcf8[_0x5b76('0x2f')]+')','directioncode':_0x51dcf8[_0x5b76('0x50')]==='queue'?![]:!![],'phonecall_activity_parties':_0x16877},getCustomFields(_0x266c6b[_0x5b76('0x4e')],_0x4bc06c,_0x266c6b['ticketType'])),'headers':{'Authorization':_0x5b76('0x1d')+_0x4f7529,'OData-Version':_0x5b76('0x39')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x507d3d);})[_0x5b76('0x1b')](function(_0x1aa708){var _0xaa25ef=_0x1aa708[_0x5b76('0x30')]['odata-entityid'];var _0x20c0e2=_0xaa25ef[_0x5b76('0x32')](_0xaa25ef[_0x5b76('0x33')]('(')+0x1,_0xaa25ef[_0x5b76('0x33')](')'));_0x51dcf8['ticketId']=_0x20c0e2;_0x2ba36c(_0x51dcf8);})[_0x5b76('0x28')](function(_0x191f4b){_0x4a81f1(_0x191f4b['message']);});});}function emit(_0x1b28fe,_0x100952,_0xa9d777,_0x5c5470){var _0x1b6824={'uri':util[_0x5b76('0x53')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1b28fe,_0xa9d777,_0x5c5470)};io['to'](util[_0x5b76('0x53')]('user:%s',_0x100952))[_0x5b76('0x54')](_0x5b76('0x55'),_0x1b6824);}exports['cs']=function(_0x3dc97c,_0x4a93fb,_0x20b7dd,_0x47c7d1,_0x2fb534,_0x5b3501,_0x245103,_0x5bfda1){var _0x4b1cfe={};_0x5b3501['remoteUri']=_0x5b3501[_0x5b76('0xc')]?intUtil['stripTrailingSlash'](_0x5b3501[_0x5b76('0xe')][_0x5b76('0xf')]):intUtil[_0x5b76('0x56')](_0x5b3501[_0x5b76('0xd')]);_0x5b3501[_0x5b76('0x57')]=intUtil[_0x5b76('0x56')](_0x5b3501[_0x5b76('0x57')]);_0x4b1cfe['callDirection']=_0x5bfda1===_0x5b76('0x51')||_0x5bfda1===_0x5b76('0x58')?_0x5b76('0x51'):_0x5b76('0x2a');var _0x16c0e8=_0x5b3501[_0x5b76('0xc')]?util[_0x5b76('0x53')]('%s/api/data/v9.0/',_0x5b3501[_0x5b76('0xe')]['data7']):util['format']('%s/api/data/v9.0/',_0x5b3501[_0x5b76('0xd')]);var _0x4f8813=util[_0x5b76('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5b3501['tenantId']);var _0x32ac63=util[_0x5b76('0x53')](_0x5b76('0x59'),_0x5b3501['serverUrl'],_0x4a93fb['uniqueid'],md5(_0x4a93fb['uniqueid']));if(_0x2fb534&&_0x2fb534[_0x5b76('0x5a')]){logger[_0x5b76('0x23')]('[QUEUE]',_0x5b76('0x5b'));_0x4a93fb[_0x5b76('0x5c')]=_0x32ac63;}else if(_0x245103&&_0x245103['recordingFormat']&&_0x245103[_0x5b76('0x5d')]!=='none'){logger[_0x5b76('0x23')](_0x5b76('0x5e'),_0x5b76('0x5b'));_0x4a93fb['recordingURL']=_0x32ac63;}else{_0x4a93fb['recordingURL']='';}return getUser(_0x4b1cfe,_0x5b3501,_0x47c7d1,_0x4f8813,_0x16c0e8,_0x5bfda1)[_0x5b76('0x1b')](function(_0xe5237f){logger[_0x5b76('0x23')]('['+_0x5bfda1[_0x5b76('0x19')]()+']\x20The\x20User\x20ID\x20is:',_0xe5237f[_0x5b76('0x2f')]);logger[_0x5b76('0x23')]('['+_0x5bfda1['toUpperCase']()+_0x5b76('0x5f'),_0xe5237f['userEmail']);return getEndUser(_0xe5237f,_0x5b3501,_0x4f8813,_0x16c0e8,_0x4a93fb,_0x5bfda1,_0x20b7dd[_0x5b76('0x60')],_0x20b7dd[_0x5b76('0x61')]);})['then'](function(_0x53fe6c){logger[_0x5b76('0x23')]('['+_0x5bfda1['toUpperCase']()+_0x5b76('0x62'),_0x53fe6c[_0x5b76('0x34')]);logger[_0x5b76('0x23')]('['+_0x5bfda1[_0x5b76('0x19')]()+_0x5b76('0x63'),_0x4a93fb[_0x5b76('0x2c')]);return getTicket(_0x53fe6c,_0x5b3501,_0x4f8813,_0x16c0e8,_0x4a93fb,_0x20b7dd,_0x5bfda1);})[_0x5b76('0x1b')](function(_0x356def){logger['info'](util[_0x5b76('0x53')]('['+_0x5bfda1[_0x5b76('0x19')]()+_0x5b76('0x64'),_0x20b7dd[_0x5b76('0x46')],_0x356def[_0x5b76('0x65')]));logger['info'](util[_0x5b76('0x53')]('['+_0x5bfda1[_0x5b76('0x19')]()+']\x20Call\x20direction:\x20%s',_0x5bfda1));if(_0x5bfda1!==_0x5b76('0x58')&&_0x20b7dd[_0x5b76('0x66')]){logger[_0x5b76('0x23')]('['+_0x5bfda1[_0x5b76('0x19')]()+']',_0x5b76('0x67'));emit(_0x5b3501[_0x5b76('0xd')],_0x47c7d1[_0x5b76('0x68')],_0x20b7dd[_0x5b76('0x46')],_0x356def['ticketId']);}})['catch'](function(_0x5ee4e9){logger['error']('['+_0x5bfda1[_0x5b76('0x19')]()+_0x5b76('0x69'),_0x5ee4e9[_0x5b76('0x1a')]);console[_0x5b76('0x18')](_0x5b76('0x6a'),_0x5ee4e9);});}; \ No newline at end of file +var _0x0ca3=['phonecalls','Subjects','lastIndexOf','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','userId','toLowerCase','outbound','destcalleridnum','calleridnum','4.0','headers','odata-entityid','substring','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Descriptions','/contacts(','/systemusers(','phonecall','callDirection','queue'];(function(_0x437731,_0x2c5693){var _0x3572d7=function(_0x3b917d){while(--_0x3b917d){_0x437731['push'](_0x437731['shift']());}};_0x3572d7(++_0x2c5693);}(_0x0ca3,0x1c3));var _0x30ca=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x0ca3[_0x4c2623];return _0x2be431;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require(_0x30ca('0x0'));var intUtil=require(_0x30ca('0x1'));var md5=require(_0x30ca('0x2'));var Redis=require(_0x30ca('0x3'));var logger=require(_0x30ca('0x4'))(_0x30ca('0x5'));var config=require(_0x30ca('0x6'));config['redis']=_[_0x30ca('0x7')](config[_0x30ca('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x30ca('0x9'))(new Redis(config[_0x30ca('0x8')]));function getAuthToken(_0xff2fe2,_0x359842,_0x17d811){if(_0xff2fe2[_0x30ca('0xa')]){_0xff2fe2[_0x30ca('0xb')]=_0xff2fe2[_0x30ca('0xc')][_0x30ca('0xd')];_0xff2fe2[_0x30ca('0xe')]=_0xff2fe2['CloudProvider'][_0x30ca('0xf')];return Promise[_0x30ca('0x10')](_0xff2fe2[_0x30ca('0xc')][_0x30ca('0x11')]);}var _0x1d50df={'method':_0x30ca('0x12'),'uri':_0x359842,'form':{'client_id':_0xff2fe2[_0x30ca('0x13')],'resource':_0xff2fe2[_0x30ca('0xb')],'username':_0xff2fe2[_0x30ca('0x14')],'password':_0xff2fe2['password'],'grant_type':_0x30ca('0x15'),'client_secret':_0xff2fe2['clientSecret']},'json':!![]};return rp(_0x1d50df)[_0x30ca('0x16')](function(_0x59dbb8){return _0x59dbb8[_0x30ca('0x17')];})[_0x30ca('0x18')](function(_0x110f06){logger[_0x30ca('0x19')]('['+[_0x17d811[_0x30ca('0x1a')]()]+_0x30ca('0x1b'));return _0x110f06[_0x30ca('0x1c')];});}function getUser(_0x5aa41d,_0x4865b1,_0x38a06a,_0x549392,_0x3959ba,_0x2a0e56){return new Promise(function(_0x5143a4,_0x19b090){return getAuthToken(_0x4865b1,_0x549392,_0x2a0e56)[_0x30ca('0x16')](function(_0x3ba8ad){var _0x45c598={'method':_0x30ca('0x1d'),'uri':_0x3959ba+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x30ca('0x1e')+_0x3ba8ad,'OData-Version':'4.0'},'json':!![]};return rp(_0x45c598);})['then'](function(_0x2a395c){var _0x3d5598=_0x2a395c[_0x30ca('0x1f')];var _0x3b43da=![];var _0x4f72fc=null;if(!_[_0x30ca('0x20')](_0x38a06a)){if(intUtil[_0x30ca('0x21')](_0x38a06a[_0x30ca('0x22')])){_0x5aa41d['userEmail']=_0x38a06a['email'];for(_0x4f72fc=0x0;_0x4f72fc<_0x3d5598[_0x30ca('0x23')];_0x4f72fc++){if(_0x3d5598[_0x4f72fc][_0x30ca('0x24')]===_0x38a06a['email']&&!_0x3d5598[_0x4f72fc][_0x30ca('0x25')]){_0x3b43da=!![];logger[_0x30ca('0x26')]('['+[_0x2a0e56[_0x30ca('0x1a')]()]+_0x30ca('0x27')+_0x3d5598[_0x4f72fc][_0x30ca('0x28')]+'!');_0x5aa41d['userId']=_0x3d5598[_0x4f72fc][_0x30ca('0x28')];}}}}if(!_0x3b43da){logger[_0x30ca('0x26')]('['+[_0x2a0e56[_0x30ca('0x1a')]()]+_0x30ca('0x29'));_0x5aa41d[_0x30ca('0x2a')]=_0x4865b1['username'];for(_0x4f72fc=0x0;_0x4f72fc<_0x3d5598['length'];_0x4f72fc++){if(_0x3d5598[_0x4f72fc][_0x30ca('0x24')]===_0x4865b1[_0x30ca('0x14')]){_0x5aa41d[_0x30ca('0x2b')]=_0x3d5598[_0x4f72fc][_0x30ca('0x28')];}}}_0x5143a4(_0x5aa41d);})[_0x30ca('0x18')](function(_0xe8c46b){_0x19b090(_0xe8c46b[_0x30ca('0x1c')]);});});}function createEndUser(_0x317863,_0x557761,_0x1f4fa0,_0x1206bf,_0x22e89e,_0x298138,_0x194227){return new Promise(function(_0x2bbd74,_0x4e7819){return getAuthToken(_0x557761,_0x1f4fa0,_0x298138)[_0x30ca('0x16')](function(_0x118e17){var _0x33d671=_0x298138[_0x30ca('0x2c')]()===_0x30ca('0x2d')?_0x22e89e[_0x30ca('0x2e')]:_0x22e89e[_0x30ca('0x2f')];var _0x233ece={'method':_0x30ca('0x12'),'uri':_0x1206bf+'contacts','body':{'fullname':_0x33d671,'firstname':_0x33d671,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x317863[_0x30ca('0x2b')]+')'},'headers':{'Authorization':_0x30ca('0x1e')+_0x118e17,'OData-Version':_0x30ca('0x30')},'json':!![],'resolveWithFullResponse':!![]};_0x233ece['body'][_0x194227]=_0x33d671;return rp(_0x233ece);})['then'](function(_0xadc73e){var _0xab918=_0xadc73e[_0x30ca('0x31')][_0x30ca('0x32')];var _0x18eae2=_0xab918[_0x30ca('0x33')](_0xab918['lastIndexOf']('(')+0x1,_0xab918['lastIndexOf'](')'));_0x317863[_0x30ca('0x34')]=_0x18eae2;_0x2bbd74(_0x317863);})['catch'](function(_0x54263e){_0x4e7819(_0x54263e['message']);});});}function getEndUser(_0x4aad94,_0x1038a8,_0x47343c,_0x2f498b,_0x40fc30,_0x4da716,_0x307f0c,_0x5c832a){var _0x5486aa=_0x4da716['toLowerCase']()===_0x30ca('0x2d')?_0x40fc30[_0x30ca('0x2e')]:_0x40fc30[_0x30ca('0x2f')];return getAuthToken(_0x1038a8,_0x47343c,_0x4da716)[_0x30ca('0x16')](function(_0x25250b){_0x5c832a=_0x5c832a?_0x5c832a:_0x30ca('0x35');var _0x23c1e7={'method':_0x30ca('0x1d'),'uri':_0x2f498b+_0x30ca('0x36')+_0x5c832a+_0x30ca('0x37')+_0x5c832a+_0x30ca('0x38')+_0x5486aa[_0x30ca('0x39')]('+',_0x30ca('0x3a'))+'\x27','headers':{'Authorization':_0x30ca('0x1e')+_0x25250b,'If-None-Match':null,'OData-Version':_0x30ca('0x30')},'json':!![]};return rp(_0x23c1e7);})[_0x30ca('0x16')](function(_0x17d07a){var _0x48541e=![];if(!_0x17d07a)return _0x48541e;var _0x5bbc5d=_0x17d07a[_0x30ca('0x1f')];for(var _0x1db70c=0x0;_0x1db70c<_0x5bbc5d[_0x30ca('0x23')];_0x1db70c++){if(_0x5bbc5d[_0x1db70c][_0x5c832a]===_0x5486aa){_0x48541e=!![];_0x4aad94[_0x30ca('0x34')]=_0x5bbc5d[_0x1db70c][_0x30ca('0x3b')];}}return _0x48541e;})['then'](function(_0x2fc35e){if(_0x2fc35e)return _0x4aad94;if(_0x307f0c==='nothing'){logger[_0x30ca('0x26')]('['+[_0x4da716['toUpperCase']()]+_0x30ca('0x3c'));return _0x4aad94;}return createEndUser(_0x4aad94,_0x1038a8,_0x47343c,_0x2f498b,_0x40fc30,_0x4da716,_0x5c832a)[_0x30ca('0x16')](function(_0x48ade9){logger[_0x30ca('0x26')]('['+[_0x4da716[_0x30ca('0x1a')]()]+_0x30ca('0x3d'),_0x48ade9[_0x30ca('0x34')]);return _0x48ade9;});});}function getCustomFields(_0x5471bd,_0x870fd0,_0x324c5d){var _0x4bba06={};if(_0x5471bd['length']>0x0){_[_0x30ca('0x3e')](_0x5471bd,function(_0x475f1b){if(_[_0x30ca('0x3f')](['string','picklist'],_0x475f1b['type'])&&_0x475f1b[_0x30ca('0x40')]&&!_0x475f1b[_0x30ca('0x41')]){var _0x1eedc2=_0x475f1b[_0x30ca('0x42')][_0x30ca('0x2c')]();var _0x36ebd2=_0x1eedc2[_0x30ca('0x33')](0x0,_0x1eedc2['indexOf']('_'));var _0x271e35=_0x1eedc2[_0x30ca('0x33')](_0x1eedc2[_0x30ca('0x43')]('_')+0x1);if(_0x36ebd2===_0x324c5d){_0x4bba06[_0x271e35]=_0x475f1b[_0x30ca('0x44')];}}});}return _0x4bba06;}function getTicket(_0xe0f4b2,_0x5b3c63,_0x4fa397,_0x100e97,_0x4ab0d3,_0x46dcd1,_0x357123){return new Promise(function(_0x5b647d,_0x3c0e08){var _0x13b072;return getAuthToken(_0x5b3c63,_0x4fa397,_0x357123)[_0x30ca('0x16')](function(_0x2ec130){if(_0x46dcd1[_0x30ca('0x45')]===_0x30ca('0x46')){_0x13b072={'method':_0x30ca('0x12'),'uri':_0x100e97+'incidents','body':Object[_0x30ca('0x47')]({},{'title':intUtil[_0x30ca('0x48')](_0x46dcd1['Subjects'],_0x4ab0d3,'\x20'),'description':intUtil[_0x30ca('0x48')](_0x46dcd1[_0x30ca('0x49')],_0x4ab0d3,'\x0a'),'customerid_contact@odata.bind':_0xe0f4b2['enduserId']?_0x30ca('0x4a')+_0xe0f4b2[_0x30ca('0x34')]+')':undefined,'ownerid@odata.bind':_0x30ca('0x4b')+_0xe0f4b2['userId']+')','caseorigincode':'1'},getCustomFields(_0x46dcd1['Fields'],_0x4ab0d3,_0x46dcd1[_0x30ca('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x2ec130,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x46dcd1['ticketType']===_0x30ca('0x4c')){var _0x2ff5d0=_0xe0f4b2[_0x30ca('0x34')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0xe0f4b2[_0x30ca('0x2b')]+')','participationtypemask':_0xe0f4b2[_0x30ca('0x4d')]===_0x30ca('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0xe0f4b2[_0x30ca('0x34')]+')','participationtypemask':_0xe0f4b2[_0x30ca('0x4d')]===_0x30ca('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x30ca('0x4b')+_0xe0f4b2[_0x30ca('0x2b')]+')','participationtypemask':_0xe0f4b2[_0x30ca('0x4d')]==='queue'?0x2:0x1}];_0x13b072={'method':'POST','uri':_0x100e97+_0x30ca('0x4f'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x46dcd1[_0x30ca('0x50')],_0x4ab0d3,'\x20'),'phonenumber':String(_0x4ab0d3[_0x30ca('0x2f')]),'description':intUtil[_0x30ca('0x48')](_0x46dcd1['Descriptions'],_0x4ab0d3,'\x0a'),'regardingobjectid_contact@odata.bind':_0xe0f4b2[_0x30ca('0x34')]?_0x30ca('0x4a')+_0xe0f4b2[_0x30ca('0x34')]+')':undefined,'ownerid@odata.bind':_0x30ca('0x4b')+_0xe0f4b2[_0x30ca('0x2b')]+')','directioncode':_0xe0f4b2[_0x30ca('0x4d')]===_0x30ca('0x4e')?![]:!![],'phonecall_activity_parties':_0x2ff5d0},getCustomFields(_0x46dcd1['Fields'],_0x4ab0d3,_0x46dcd1['ticketType'])),'headers':{'Authorization':_0x30ca('0x1e')+_0x2ec130,'OData-Version':_0x30ca('0x30')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x13b072);})[_0x30ca('0x16')](function(_0x17e39e){var _0x20bc2a=_0x17e39e[_0x30ca('0x31')]['odata-entityid'];var _0x20de2e=_0x20bc2a[_0x30ca('0x33')](_0x20bc2a[_0x30ca('0x51')]('(')+0x1,_0x20bc2a[_0x30ca('0x51')](')'));_0xe0f4b2['ticketId']=_0x20de2e;_0x5b647d(_0xe0f4b2);})[_0x30ca('0x18')](function(_0x2b3f15){_0x3c0e08(_0x2b3f15[_0x30ca('0x1c')]);});});}function emit(_0x2732eb,_0x36d5bf,_0x38995a,_0x75efa8){var _0x3e1bfc={'uri':util[_0x30ca('0x52')](_0x30ca('0x53'),_0x2732eb,_0x38995a,_0x75efa8)};io['to'](util[_0x30ca('0x52')]('user:%s',_0x36d5bf))[_0x30ca('0x54')]('trigger:browser:url',_0x3e1bfc);}exports['cs']=function(_0x213098,_0x38f1eb,_0x48b0f7,_0x3a4a1d,_0x3255e3,_0x3d889f,_0x629366,_0xfd267f){var _0x5e983f={};_0x3d889f['remoteUri']=_0x3d889f[_0x30ca('0xa')]?intUtil['stripTrailingSlash'](_0x3d889f[_0x30ca('0xc')]['data7']):intUtil['stripTrailingSlash'](_0x3d889f['remoteUri']);_0x3d889f[_0x30ca('0x55')]=intUtil['stripTrailingSlash'](_0x3d889f[_0x30ca('0x55')]);_0x5e983f[_0x30ca('0x4d')]=_0xfd267f===_0x30ca('0x4e')||_0xfd267f===_0x30ca('0x56')?_0x30ca('0x4e'):'outbound';var _0x3211d0=_0x3d889f[_0x30ca('0xa')]?util['format'](_0x30ca('0x57'),_0x3d889f[_0x30ca('0xc')][_0x30ca('0xd')]):util[_0x30ca('0x52')](_0x30ca('0x57'),_0x3d889f['remoteUri']);var _0x557033=util['format'](_0x30ca('0x58'),_0x3d889f[_0x30ca('0xe')]);var _0x31111a=util[_0x30ca('0x52')](_0x30ca('0x59'),_0x3d889f[_0x30ca('0x55')],_0x38f1eb[_0x30ca('0x5a')],md5(_0x38f1eb[_0x30ca('0x5a')]));if(_0x3255e3&&_0x3255e3[_0x30ca('0x5b')]){logger[_0x30ca('0x26')](_0x30ca('0x5c'),_0x30ca('0x5d'));_0x38f1eb['recordingURL']=_0x31111a;}else if(_0x629366&&_0x629366[_0x30ca('0x5e')]&&_0x629366[_0x30ca('0x5e')]!=='none'){logger[_0x30ca('0x26')](_0x30ca('0x5f'),'Recording\x20is\x20enabled!');_0x38f1eb[_0x30ca('0x60')]=_0x31111a;}else{_0x38f1eb[_0x30ca('0x60')]='';}return getUser(_0x5e983f,_0x3d889f,_0x3a4a1d,_0x557033,_0x3211d0,_0xfd267f)[_0x30ca('0x16')](function(_0x2f0c93){logger[_0x30ca('0x26')]('['+_0xfd267f[_0x30ca('0x1a')]()+_0x30ca('0x61'),_0x2f0c93[_0x30ca('0x2b')]);logger[_0x30ca('0x26')]('['+_0xfd267f[_0x30ca('0x1a')]()+']\x20The\x20User\x20email\x20is:',_0x2f0c93[_0x30ca('0x2a')]);return getEndUser(_0x2f0c93,_0x3d889f,_0x557033,_0x3211d0,_0x38f1eb,_0xfd267f,_0x48b0f7[_0x30ca('0x62')],_0x48b0f7['additionalSearchContact']);})[_0x30ca('0x16')](function(_0x13a1e9){logger[_0x30ca('0x26')]('['+_0xfd267f[_0x30ca('0x1a')]()+_0x30ca('0x63'),_0x13a1e9[_0x30ca('0x34')]);logger[_0x30ca('0x26')]('['+_0xfd267f['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x38f1eb[_0x30ca('0x2f')]);return getTicket(_0x13a1e9,_0x3d889f,_0x557033,_0x3211d0,_0x38f1eb,_0x48b0f7,_0xfd267f);})[_0x30ca('0x16')](function(_0x13786a){logger['info'](util[_0x30ca('0x52')]('['+_0xfd267f[_0x30ca('0x1a')]()+_0x30ca('0x64'),_0x48b0f7[_0x30ca('0x45')],_0x13786a[_0x30ca('0x65')]));logger[_0x30ca('0x26')](util[_0x30ca('0x52')]('['+_0xfd267f['toUpperCase']()+_0x30ca('0x66'),_0xfd267f));if(_0xfd267f!==_0x30ca('0x56')&&_0x48b0f7['openNewTab']){logger[_0x30ca('0x26')]('['+_0xfd267f[_0x30ca('0x1a')]()+']',_0x30ca('0x67'));emit(_0x3d889f[_0x30ca('0xb')],_0x3a4a1d[_0x30ca('0x68')],_0x48b0f7[_0x30ca('0x45')],_0x13786a['ticketId']);}})['catch'](function(_0xffca43){logger[_0x30ca('0x19')]('['+_0xfd267f[_0x30ca('0x1a')]()+_0x30ca('0x69'),_0xffca43[_0x30ca('0x1c')]);console[_0x30ca('0x19')]('Error\x20running\x20Dynamics365\x20integration',_0xffca43);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index f245f31..00024fb 100644 --- a/server/services/ami/trigger/integration/freshdesk.js +++ b/server/services/ami/trigger/integration/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67dd=['catch','lastevent','calleridname','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','Tags','name','Fields','custom_fields','keyBy','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','customVariable','Variable','push','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','email','The\x20User\x20ID\x20is:','destcalleridnum'];(function(_0x5c6ceb,_0x4ed099){var _0x28821b=function(_0x391add){while(--_0x391add){_0x5c6ceb['push'](_0x5c6ceb['shift']());}};_0x28821b(++_0x4ed099);}(_0x67dd,0xbc));var _0xd67d=function(_0x8a1c6e,_0x470f43){_0x8a1c6e=_0x8a1c6e-0x0;var _0x188d1c=_0x67dd[_0x8a1c6e];return _0x188d1c;};'use strict';var _=require(_0xd67d('0x0'));var rp=require(_0xd67d('0x1'));var md5=require(_0xd67d('0x2'));var util=require(_0xd67d('0x3'));var Redis=require('ioredis');var intUtil=require(_0xd67d('0x4'));var config=require('../../../../config/environment');var logger=require(_0xd67d('0x5'))(_0xd67d('0x6'));config[_0xd67d('0x7')]=_['defaults'](config[_0xd67d('0x7')],{'host':_0xd67d('0x8'),'port':0x18eb});var io=require(_0xd67d('0x9'))(new Redis(config[_0xd67d('0x7')]));var headers={'Content-Type':_0xd67d('0xa'),'Accept':_0xd67d('0xa')};function emit(_0xa8e9b0,_0x587f8f,_0x15efdb){io['to'](_0xa8e9b0)[_0xd67d('0xb')](_0x587f8f,_0x15efdb);}function getTicket(_0xcbf2f0,_0xf1386e,_0x13f2fd,_0x3452d1,_0x439d5e){logger[_0xd67d('0xc')](_0xd67d('0xd'));var _0x3199ec=_[_0xd67d('0xe')]({'responder_id':_0xf1386e['id'],'requester_id':_0x13f2fd['id'],'name':util['format'](_0xd67d('0xf'),_0x439d5e['calleridname']),'phone':_0x439d5e[_0xd67d('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3452d1[_0xd67d('0x11')],_0x439d5e,'\x20'),'description':intUtil[_0xd67d('0x12')](_0x3452d1[_0xd67d('0x13')],_0x439d5e,'
'),'tags':getTags(_0x3452d1[_0xd67d('0x14')],_0xd67d('0x15'))},getCustomFields(_0x3452d1[_0xd67d('0x16')],_0x439d5e));_0x3199ec[_0xd67d('0x17')]=_['mapValues'](_[_0xd67d('0x18')](_0x3199ec['custom_fields'],'id'),'value');return request({'uri':util[_0xd67d('0x19')](_0xd67d('0x1a'),_0xcbf2f0[_0xd67d('0x1b')]),'method':_0xd67d('0x1c'),'body':_0x3199ec})[_0xd67d('0x1d')](function(_0x8e499d){logger[_0xd67d('0xc')](_0xd67d('0x1e'));return _0x8e499d;});}function getUser(_0x52d62b,_0x1fd875){if(intUtil[_0xd67d('0x1f')](_0x1fd875)){return request({'uri':util[_0xd67d('0x19')]('%s/api/v2/agents',_0x52d62b['remoteUri']),'qs':{'email':_0x1fd875}})['then'](function(_0x1190c4){if(_0x1190c4[_0xd67d('0x20')]){logger[_0xd67d('0xc')](_0xd67d('0x21'));return _[_0xd67d('0x22')](_0x1190c4,function(_0x4e39be){return _0x4e39be[_0xd67d('0x23')]['email']===_0x1fd875;});}else{logger[_0xd67d('0xc')](_0xd67d('0x24'));return request({'uri':util[_0xd67d('0x19')](_0xd67d('0x25'),_0x52d62b[_0xd67d('0x1b')])})[_0xd67d('0x1d')](function(_0x55c5a2){logger['info'](_0xd67d('0x26'));return _0x55c5a2;});}});}else{logger[_0xd67d('0xc')](_0xd67d('0x27'));return request({'uri':util[_0xd67d('0x19')](_0xd67d('0x25'),_0x52d62b[_0xd67d('0x1b')])})[_0xd67d('0x1d')](function(_0x69b992){logger[_0xd67d('0xc')](_0xd67d('0x26'));return _0x69b992;});}}function getEndUser(_0x3b94ca,_0x4b12f2,_0xefc656){logger[_0xd67d('0xc')]('Searching\x20enduser\x20with\x20phone',_0xefc656);return request({'uri':util[_0xd67d('0x19')]('%s/api/v2/contacts',_0x3b94ca[_0xd67d('0x1b')]),'qs':{'phone':_0xefc656}})[_0xd67d('0x1d')](function(_0x36c893){if(_0x36c893['length']){logger[_0xd67d('0xc')]('Enduser\x20found!');return _[_0xd67d('0x22')](_0x36c893,{'phone':_0xefc656});}else{logger[_0xd67d('0xc')](_0xd67d('0x28'));return request({'uri':util[_0xd67d('0x19')](_0xd67d('0x29'),_0x3b94ca[_0xd67d('0x1b')]),'method':_0xd67d('0x1c'),'body':{'name':_0x4b12f2,'phone':_0xefc656}})[_0xd67d('0x1d')](function(_0x474585){logger[_0xd67d('0xc')]('Enduser\x20created.');return _0x474585;});}});}function getAuth(_0x10c49d){return util[_0xd67d('0x19')](_0xd67d('0x2a'),new Buffer(_0x10c49d[_0xd67d('0x2b')]+':X')[_0xd67d('0x2c')]('base64'));}function request(_0x4b0af4){logger[_0xd67d('0x2d')](_0xd67d('0x2e'),JSON[_0xd67d('0x2f')](_0x4b0af4));return rp(_['defaults'](_0x4b0af4,{'method':_0xd67d('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x28e41d,_0xb0b2ad){var _0x51f341=[];if(_0x28e41d&&_0x28e41d[_0xd67d('0x20')]>0x0){_0x51f341=_['map'](_0x28e41d,_0xb0b2ad);}return _0x51f341;}function getCustomFields(_0x47920d,_0x5b78e1){var _0xf0ffe1=[];var _0x2b0679={'custom_fields':[]};if(_0x47920d[_0xd67d('0x20')]>0x0){_[_0xd67d('0x31')](_0x47920d,function(_0x5c9841){if(_[_0xd67d('0x32')]([_0xd67d('0x33'),_0xd67d('0x34')],_0x5c9841[_0xd67d('0x35')])&&_0x5c9841[_0xd67d('0x36')]&&!_0x5c9841[_0xd67d('0x37')]){_0x2b0679[_0x5c9841[_0xd67d('0x36')][_0xd67d('0x38')]()]=_0x5c9841[_0xd67d('0x39')][_0xd67d('0x2c')]();}else if(_[_0xd67d('0x32')]([_0xd67d('0x33'),_0xd67d('0x34')],_0x5c9841[_0xd67d('0x35')])&&_0x5c9841[_0xd67d('0x3a')]&&_0x5c9841[_0xd67d('0x37')]){_0x2b0679[_0xd67d('0x17')]['push']({'id':_0x5c9841[_0xd67d('0x3a')],'value':_0x5c9841[_0xd67d('0x39')][_0xd67d('0x2c')]()});}else if(_0x5c9841[_0xd67d('0x35')]===_0xd67d('0x3b')&&_0x5c9841[_0xd67d('0x3c')]&&_0x5c9841['idField']&&_0x5c9841[_0xd67d('0x37')]){_0x5b78e1[_0x5c9841[_0xd67d('0x3c')]]&&_0x2b0679[_0xd67d('0x17')]['push']({'id':_0x5c9841[_0xd67d('0x3a')],'value':_0x5b78e1[_0x5c9841[_0xd67d('0x3c')]][_0xd67d('0x2c')]()});}else if(_0x5c9841[_0xd67d('0x35')]===_0xd67d('0x3d')&&_0x5c9841[_0xd67d('0x3e')]&&_0x5c9841[_0xd67d('0x3e')][_0xd67d('0x15')]&&_0x5c9841[_0xd67d('0x3a')]&&_0x5c9841[_0xd67d('0x37')]){_0x5b78e1[_0x5c9841[_0xd67d('0x3e')]['name'][_0xd67d('0x38')]()]&&_0x2b0679[_0xd67d('0x17')][_0xd67d('0x3f')]({'id':_0x5c9841['idField'],'value':_0x5b78e1[_0x5c9841[_0xd67d('0x3e')]['name'][_0xd67d('0x38')]()][_0xd67d('0x2c')]()});}});}return _0x2b0679;}exports[_0xd67d('0x40')]=function(_0x3c6b69,_0x1f923a,_0x2f215a,_0x3a837a,_0x1bbb93,_0x5d49d9){var _0x11f937,_0x1f1e2d;_0x5d49d9[_0xd67d('0x1b')]=intUtil['stripTrailingSlash'](_0x5d49d9[_0xd67d('0x1b')]);_0x5d49d9[_0xd67d('0x41')]=intUtil[_0xd67d('0x42')](_0x5d49d9['serverUrl']);if(_0x1bbb93&&_0x1bbb93[_0xd67d('0x43')]){logger[_0xd67d('0xc')](_0xd67d('0x44'),'Recording\x20is\x20enabled!');_0x1f923a[_0xd67d('0x45')]=util[_0xd67d('0x19')](_0xd67d('0x46'),_0x5d49d9[_0xd67d('0x41')],_0x1f923a['uniqueid'],md5(_0x1f923a[_0xd67d('0x47')]));}else{_0x1f923a[_0xd67d('0x45')]='';}headers['Authorization']=getAuth(_0x5d49d9);return getUser(_0x5d49d9,_0x3a837a['email'])[_0xd67d('0x1d')](function(_0x4e206a){_0x11f937=_0x4e206a;logger[_0xd67d('0xc')]('The\x20User\x20ID\x20is:',_0x11f937['id']);return getEndUser(_0x5d49d9,_0x1f923a['calleridname'],_0x1f923a[_0xd67d('0x10')]);})[_0xd67d('0x1d')](function(_0x1b8a20){_0x1f1e2d=_0x1b8a20;logger[_0xd67d('0xc')](_0xd67d('0x48'),_0x1f1e2d['id']);return getTicket(_0x5d49d9,_0x11f937,_0x1f1e2d,_0x2f215a,_0x1f923a);})[_0xd67d('0x1d')](function(_0x87fc75){if(_0x87fc75&&_0x87fc75['id']){logger['info']('Ticket\x20created!');logger[_0xd67d('0xc')](_0xd67d('0x49'),_0x87fc75['id']);logger[_0xd67d('0xc')](_0xd67d('0x44'),_0xd67d('0x4a'));emit(util[_0xd67d('0x19')](_0xd67d('0x4b'),_0x3a837a[_0xd67d('0x15')]),_0xd67d('0x4c'),{'uri':util[_0xd67d('0x19')](_0xd67d('0x4d'),_0x5d49d9[_0xd67d('0x1b')],_0x87fc75['id'])});}})['catch'](function(_0x20fa1a){logger[_0xd67d('0x4e')]('[QUEUE]',JSON[_0xd67d('0x2f')](_0x20fa1a));});};exports[_0xd67d('0x4f')]=function(_0x5aaa65,_0x228f72,_0x10499a,_0x1e0273,_0x399034,_0x7d6f0a,_0x40f18d){var _0x4dbde3,_0x57e8cd;_0x7d6f0a[_0xd67d('0x1b')]=intUtil[_0xd67d('0x42')](_0x7d6f0a['remoteUri']);_0x7d6f0a[_0xd67d('0x41')]=intUtil[_0xd67d('0x42')](_0x7d6f0a['serverUrl']);if(_0x40f18d&&_0x40f18d[_0xd67d('0x50')]&&_0x40f18d[_0xd67d('0x50')]!==_0xd67d('0x51')){logger[_0xd67d('0xc')](_0xd67d('0x52'),_0xd67d('0x53'));_0x228f72[_0xd67d('0x45')]=util[_0xd67d('0x19')](_0xd67d('0x46'),_0x7d6f0a[_0xd67d('0x41')],_0x228f72[_0xd67d('0x47')],md5(_0x228f72[_0xd67d('0x47')]));}headers[_0xd67d('0x54')]=getAuth(_0x7d6f0a);return getUser(_0x7d6f0a,_0x1e0273[_0xd67d('0x55')])['then'](function(_0x3fbd95){_0x4dbde3=_0x3fbd95;logger['info'](_0xd67d('0x56'),_0x4dbde3['id']);return getEndUser(_0x7d6f0a,_0x228f72['destcalleridname'],_0x228f72[_0xd67d('0x57')]);})['then'](function(_0x50fc6d){_0x57e8cd=_0x50fc6d;logger['info'](_0xd67d('0x48'),_0x57e8cd['id']);return getTicket(_0x7d6f0a,_0x4dbde3,_0x57e8cd,_0x10499a,_0x228f72);})[_0xd67d('0x1d')](function(_0xd90811){if(_0xd90811&&_0xd90811['id']){logger[_0xd67d('0xc')](_0xd67d('0x1e'));logger[_0xd67d('0xc')]('The\x20Ticket\x20ID\x20is:',_0xd90811['id']);logger[_0xd67d('0xc')](_0xd67d('0x52'),_0xd67d('0x4a'));emit(util[_0xd67d('0x19')]('user:%s',_0x1e0273['name']),_0xd67d('0x4c'),{'uri':util[_0xd67d('0x19')](_0xd67d('0x4d'),_0x7d6f0a[_0xd67d('0x1b')],_0xd90811['id'])});}})[_0xd67d('0x58')](function(_0x28fc4b){logger[_0xd67d('0x4e')]('[OUTBOUND]',JSON[_0xd67d('0x2f')](_0x28fc4b));});};exports['unmanaged']=function(_0x5369a1,_0x5b03e1,_0x57e04c,_0x16e67d,_0x20d020,_0x36ccb1){var _0x577553,_0x45505f;_0x36ccb1[_0xd67d('0x1b')]=intUtil[_0xd67d('0x42')](_0x36ccb1['remoteUri']);_0x36ccb1['serverUrl']=intUtil['stripTrailingSlash'](_0x36ccb1[_0xd67d('0x41')]);if(_0x20d020&&_0x20d020['monitor_format']){logger[_0xd67d('0xc')]('['+_0x5b03e1[_0xd67d('0x59')]['toUpperCase']()+']',_0xd67d('0x53'));_0x5b03e1['recordingURL']=util['format'](_0xd67d('0x46'),_0x36ccb1['serverUrl'],_0x5b03e1[_0xd67d('0x47')],md5(_0x5b03e1[_0xd67d('0x47')]));}else{_0x5b03e1[_0xd67d('0x45')]='';}headers['Authorization']=getAuth(_0x36ccb1);return getUser(_0x36ccb1,'')[_0xd67d('0x1d')](function(_0x31d069){_0x577553=_0x31d069;logger[_0xd67d('0xc')]('The\x20User\x20ID\x20is:',_0x577553['id']);return getEndUser(_0x36ccb1,_0x5b03e1[_0xd67d('0x5a')],_0x5b03e1[_0xd67d('0x10')]);})[_0xd67d('0x1d')](function(_0x7259fd){_0x45505f=_0x7259fd;logger['info'](_0xd67d('0x48'),_0x45505f['id']);return getTicket(_0x36ccb1,_0x577553,_0x45505f,_0x57e04c,_0x5b03e1);})[_0xd67d('0x1d')](function(_0x35988e){if(_0x35988e){logger[_0xd67d('0xc')](_0xd67d('0x1e'));logger[_0xd67d('0xc')](_0xd67d('0x49'),_0x35988e['id']);}})['catch'](function(_0x2d364f){logger[_0xd67d('0x4e')]('['+_0x5b03e1[_0xd67d('0x59')][_0xd67d('0x5b')]()+']',JSON[_0xd67d('0x2f')](_0x2d364f));});}; \ No newline at end of file +var _0x1784=['%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','debug','[HTTP]','GET','map','forEach','picklist','type','nameField','toLowerCase','content','toString','string','idField','customField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','unmanaged','error','toUpperCase','lodash','request-promise','util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Caller\x20-\x20%s','calleridnum','Subjects','
','Tags','name','custom_fields','mapValues','value','format','%s/api/v2/tickets','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone'];(function(_0x34e0d2,_0x59c6a4){var _0x40fd0c=function(_0x30e24d){while(--_0x30e24d){_0x34e0d2['push'](_0x34e0d2['shift']());}};_0x40fd0c(++_0x59c6a4);}(_0x1784,0x142));var _0x4178=function(_0x5e3115,_0x540600){_0x5e3115=_0x5e3115-0x0;var _0x5a1dc6=_0x1784[_0x5e3115];return _0x5a1dc6;};'use strict';var _=require(_0x4178('0x0'));var rp=require(_0x4178('0x1'));var md5=require('md5');var util=require(_0x4178('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4178('0x3'));var logger=require('../../../../config/logger')('freshdesk');config['redis']=_[_0x4178('0x4')](config[_0x4178('0x5')],{'host':_0x4178('0x6'),'port':0x18eb});var io=require(_0x4178('0x7'))(new Redis(config[_0x4178('0x5')]));var headers={'Content-Type':_0x4178('0x8'),'Accept':'application/json'};function emit(_0xd0ab81,_0x3050d8,_0x37dc2e){io['to'](_0xd0ab81)[_0x4178('0x9')](_0x3050d8,_0x37dc2e);}function getTicket(_0xcb1f0d,_0x3d1fb4,_0x29680b,_0x31ad56,_0x367724){logger[_0x4178('0xa')]('Creating\x20new\x20ticket...');var _0xaffc04=_['merge']({'responder_id':_0x3d1fb4['id'],'requester_id':_0x29680b['id'],'name':util['format'](_0x4178('0xb'),_0x367724['calleridname']),'phone':_0x367724[_0x4178('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x31ad56[_0x4178('0xd')],_0x367724,'\x20'),'description':intUtil['getString'](_0x31ad56['Descriptions'],_0x367724,_0x4178('0xe')),'tags':getTags(_0x31ad56[_0x4178('0xf')],_0x4178('0x10'))},getCustomFields(_0x31ad56['Fields'],_0x367724));_0xaffc04[_0x4178('0x11')]=_[_0x4178('0x12')](_['keyBy'](_0xaffc04[_0x4178('0x11')],'id'),_0x4178('0x13'));return request({'uri':util[_0x4178('0x14')](_0x4178('0x15'),_0xcb1f0d['remoteUri']),'method':'POST','body':_0xaffc04})['then'](function(_0x1a3c10){logger['info'](_0x4178('0x16'));return _0x1a3c10;});}function getUser(_0x24b79e,_0x311c4d){if(intUtil[_0x4178('0x17')](_0x311c4d)){return request({'uri':util[_0x4178('0x14')](_0x4178('0x18'),_0x24b79e[_0x4178('0x19')]),'qs':{'email':_0x311c4d}})['then'](function(_0x3b479d){if(_0x3b479d[_0x4178('0x1a')]){logger[_0x4178('0xa')]('Agent\x20found!');return _[_0x4178('0x1b')](_0x3b479d,function(_0x2cd5c3){return _0x2cd5c3['contact']['email']===_0x311c4d;});}else{logger[_0x4178('0xa')](_0x4178('0x1c'));return request({'uri':util[_0x4178('0x14')]('%s/api/v2/agents/me',_0x24b79e[_0x4178('0x19')])})[_0x4178('0x1d')](function(_0x27a623){logger[_0x4178('0xa')](_0x4178('0x1e'));return _0x27a623;});}});}else{logger[_0x4178('0xa')](_0x4178('0x1f'));return request({'uri':util[_0x4178('0x14')](_0x4178('0x20'),_0x24b79e[_0x4178('0x19')])})[_0x4178('0x1d')](function(_0x54fda6){logger[_0x4178('0xa')]('Admin\x20account\x20selected.');return _0x54fda6;});}}function getEndUser(_0xc872ab,_0x586183,_0x4c447f){logger[_0x4178('0xa')](_0x4178('0x21'),_0x4c447f);return request({'uri':util[_0x4178('0x14')](_0x4178('0x22'),_0xc872ab[_0x4178('0x19')]),'qs':{'phone':_0x4c447f}})[_0x4178('0x1d')](function(_0x51978f){if(_0x51978f['length']){logger[_0x4178('0xa')](_0x4178('0x23'));return _[_0x4178('0x1b')](_0x51978f,{'phone':_0x4c447f});}else{logger[_0x4178('0xa')](_0x4178('0x24'));return request({'uri':util[_0x4178('0x14')](_0x4178('0x22'),_0xc872ab[_0x4178('0x19')]),'method':_0x4178('0x25'),'body':{'name':_0x586183,'phone':_0x4c447f}})[_0x4178('0x1d')](function(_0x340f1c){logger['info'](_0x4178('0x26'));return _0x340f1c;});}});}function getAuth(_0x3347fd){return util['format'](_0x4178('0x27'),new Buffer(_0x3347fd[_0x4178('0x28')]+':X')['toString']('base64'));}function request(_0x2e19d6){logger[_0x4178('0x29')](_0x4178('0x2a'),JSON['stringify'](_0x2e19d6));return rp(_['defaults'](_0x2e19d6,{'method':_0x4178('0x2b'),'headers':headers,'json':!![]}));}function getTags(_0xd9fec,_0x5113dc){var _0x3fb085=[];if(_0xd9fec&&_0xd9fec[_0x4178('0x1a')]>0x0){_0x3fb085=_[_0x4178('0x2c')](_0xd9fec,_0x5113dc);}return _0x3fb085;}function getCustomFields(_0x5ab134,_0x33e6ca){var _0x48071c=[];var _0x55bb47={'custom_fields':[]};if(_0x5ab134[_0x4178('0x1a')]>0x0){_[_0x4178('0x2d')](_0x5ab134,function(_0x137b46){if(_['includes'](['string',_0x4178('0x2e')],_0x137b46[_0x4178('0x2f')])&&_0x137b46[_0x4178('0x30')]&&!_0x137b46['customField']){_0x55bb47[_0x137b46[_0x4178('0x30')][_0x4178('0x31')]()]=_0x137b46[_0x4178('0x32')][_0x4178('0x33')]();}else if(_['includes']([_0x4178('0x34'),_0x4178('0x2e')],_0x137b46[_0x4178('0x2f')])&&_0x137b46[_0x4178('0x35')]&&_0x137b46[_0x4178('0x36')]){_0x55bb47[_0x4178('0x11')][_0x4178('0x37')]({'id':_0x137b46[_0x4178('0x35')],'value':_0x137b46[_0x4178('0x32')]['toString']()});}else if(_0x137b46[_0x4178('0x2f')]===_0x4178('0x38')&&_0x137b46[_0x4178('0x39')]&&_0x137b46[_0x4178('0x35')]&&_0x137b46[_0x4178('0x36')]){_0x33e6ca[_0x137b46[_0x4178('0x39')]]&&_0x55bb47[_0x4178('0x11')][_0x4178('0x37')]({'id':_0x137b46[_0x4178('0x35')],'value':_0x33e6ca[_0x137b46[_0x4178('0x39')]][_0x4178('0x33')]()});}else if(_0x137b46[_0x4178('0x2f')]==='customVariable'&&_0x137b46['Variable']&&_0x137b46['Variable'][_0x4178('0x10')]&&_0x137b46[_0x4178('0x35')]&&_0x137b46[_0x4178('0x36')]){_0x33e6ca[_0x137b46[_0x4178('0x3a')][_0x4178('0x10')][_0x4178('0x31')]()]&&_0x55bb47[_0x4178('0x11')]['push']({'id':_0x137b46[_0x4178('0x35')],'value':_0x33e6ca[_0x137b46[_0x4178('0x3a')][_0x4178('0x10')][_0x4178('0x31')]()][_0x4178('0x33')]()});}});}return _0x55bb47;}exports[_0x4178('0x3b')]=function(_0x2ff2a5,_0x1f06b7,_0x92ff11,_0x3caef6,_0xbdaced,_0x4cf180){var _0x2d9899,_0x42e6d9;_0x4cf180[_0x4178('0x19')]=intUtil[_0x4178('0x3c')](_0x4cf180[_0x4178('0x19')]);_0x4cf180['serverUrl']=intUtil[_0x4178('0x3c')](_0x4cf180[_0x4178('0x3d')]);if(_0xbdaced&&_0xbdaced[_0x4178('0x3e')]){logger[_0x4178('0xa')](_0x4178('0x3f'),_0x4178('0x40'));_0x1f06b7[_0x4178('0x41')]=util[_0x4178('0x14')](_0x4178('0x42'),_0x4cf180[_0x4178('0x3d')],_0x1f06b7[_0x4178('0x43')],md5(_0x1f06b7[_0x4178('0x43')]));}else{_0x1f06b7[_0x4178('0x41')]='';}headers[_0x4178('0x44')]=getAuth(_0x4cf180);return getUser(_0x4cf180,_0x3caef6['email'])[_0x4178('0x1d')](function(_0x55b2e0){_0x2d9899=_0x55b2e0;logger['info']('The\x20User\x20ID\x20is:',_0x2d9899['id']);return getEndUser(_0x4cf180,_0x1f06b7[_0x4178('0x45')],_0x1f06b7[_0x4178('0xc')]);})['then'](function(_0x542d08){_0x42e6d9=_0x542d08;logger[_0x4178('0xa')](_0x4178('0x46'),_0x42e6d9['id']);return getTicket(_0x4cf180,_0x2d9899,_0x42e6d9,_0x92ff11,_0x1f06b7);})[_0x4178('0x1d')](function(_0x39270a){if(_0x39270a&&_0x39270a['id']){logger[_0x4178('0xa')](_0x4178('0x16'));logger[_0x4178('0xa')](_0x4178('0x47'),_0x39270a['id']);logger[_0x4178('0xa')](_0x4178('0x3f'),_0x4178('0x48'));emit(util['format'](_0x4178('0x49'),_0x3caef6['name']),_0x4178('0x4a'),{'uri':util['format'](_0x4178('0x4b'),_0x4cf180['remoteUri'],_0x39270a['id'])});}})[_0x4178('0x4c')](function(_0x50f7cc){logger['error'](_0x4178('0x3f'),JSON[_0x4178('0x4d')](_0x50f7cc));});};exports[_0x4178('0x4e')]=function(_0x330f90,_0x37e166,_0x40bc39,_0x5242cf,_0x574144,_0x34a5b3,_0x16643f){var _0x3b09dd,_0x5a72a2;_0x34a5b3[_0x4178('0x19')]=intUtil['stripTrailingSlash'](_0x34a5b3[_0x4178('0x19')]);_0x34a5b3[_0x4178('0x3d')]=intUtil['stripTrailingSlash'](_0x34a5b3[_0x4178('0x3d')]);if(_0x16643f&&_0x16643f[_0x4178('0x4f')]&&_0x16643f[_0x4178('0x4f')]!==_0x4178('0x50')){logger['info'](_0x4178('0x51'),_0x4178('0x40'));_0x37e166[_0x4178('0x41')]=util[_0x4178('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34a5b3[_0x4178('0x3d')],_0x37e166[_0x4178('0x43')],md5(_0x37e166[_0x4178('0x43')]));}headers[_0x4178('0x44')]=getAuth(_0x34a5b3);return getUser(_0x34a5b3,_0x5242cf[_0x4178('0x52')])[_0x4178('0x1d')](function(_0xc99f3a){_0x3b09dd=_0xc99f3a;logger[_0x4178('0xa')](_0x4178('0x53'),_0x3b09dd['id']);return getEndUser(_0x34a5b3,_0x37e166[_0x4178('0x54')],_0x37e166[_0x4178('0x55')]);})['then'](function(_0x54854a){_0x5a72a2=_0x54854a;logger[_0x4178('0xa')](_0x4178('0x46'),_0x5a72a2['id']);return getTicket(_0x34a5b3,_0x3b09dd,_0x5a72a2,_0x40bc39,_0x37e166);})[_0x4178('0x1d')](function(_0x586ea4){if(_0x586ea4&&_0x586ea4['id']){logger[_0x4178('0xa')](_0x4178('0x16'));logger[_0x4178('0xa')]('The\x20Ticket\x20ID\x20is:',_0x586ea4['id']);logger['info'](_0x4178('0x51'),_0x4178('0x48'));emit(util[_0x4178('0x14')](_0x4178('0x49'),_0x5242cf[_0x4178('0x10')]),_0x4178('0x4a'),{'uri':util[_0x4178('0x14')]('%s/helpdesk/tickets/%d',_0x34a5b3[_0x4178('0x19')],_0x586ea4['id'])});}})['catch'](function(_0x5430ec){logger['error'](_0x4178('0x51'),JSON[_0x4178('0x4d')](_0x5430ec));});};exports[_0x4178('0x56')]=function(_0x5333dd,_0xd90325,_0x5b5009,_0x1c05e9,_0xd43cc2,_0x1870b5){var _0x2dcce7,_0x21b545;_0x1870b5[_0x4178('0x19')]=intUtil[_0x4178('0x3c')](_0x1870b5[_0x4178('0x19')]);_0x1870b5[_0x4178('0x3d')]=intUtil[_0x4178('0x3c')](_0x1870b5['serverUrl']);if(_0xd43cc2&&_0xd43cc2[_0x4178('0x3e')]){logger[_0x4178('0xa')]('['+_0xd90325['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xd90325['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1870b5[_0x4178('0x3d')],_0xd90325['uniqueid'],md5(_0xd90325[_0x4178('0x43')]));}else{_0xd90325[_0x4178('0x41')]='';}headers[_0x4178('0x44')]=getAuth(_0x1870b5);return getUser(_0x1870b5,'')[_0x4178('0x1d')](function(_0x5af1ab){_0x2dcce7=_0x5af1ab;logger['info'](_0x4178('0x53'),_0x2dcce7['id']);return getEndUser(_0x1870b5,_0xd90325[_0x4178('0x45')],_0xd90325[_0x4178('0xc')]);})['then'](function(_0x44408f){_0x21b545=_0x44408f;logger[_0x4178('0xa')](_0x4178('0x46'),_0x21b545['id']);return getTicket(_0x1870b5,_0x2dcce7,_0x21b545,_0x5b5009,_0xd90325);})[_0x4178('0x1d')](function(_0x13c7f6){if(_0x13c7f6){logger[_0x4178('0xa')]('Ticket\x20created!');logger[_0x4178('0xa')]('The\x20Ticket\x20ID\x20is:',_0x13c7f6['id']);}})[_0x4178('0x4c')](function(_0x533e56){logger[_0x4178('0x57')]('['+_0xd90325['lastevent'][_0x4178('0x58')]()+']',JSON[_0x4178('0x4d')](_0x533e56));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index fe6fc74..adbfda9 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x146b=['Requested\x20Resource\x20not\x20Found','error','toUpperCase','users','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','catch','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','format','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','Admin\x20found:','adminId'];(function(_0x2a36de,_0x5a60fd){var _0x35b5d4=function(_0x348270){while(--_0x348270){_0x2a36de['push'](_0x2a36de['shift']());}};_0x35b5d4(++_0x5a60fd);}(_0x146b,0x192));var _0xb146=function(_0x22ad0c,_0x56e8a1){_0x22ad0c=_0x22ad0c-0x0;var _0x3787a9=_0x146b[_0x22ad0c];return _0x3787a9;};'use strict';var _=require(_0xb146('0x0'));var rp=require(_0xb146('0x1'));var md5=require(_0xb146('0x2'));var util=require(_0xb146('0x3'));var moment=require('moment');var Promise=require(_0xb146('0x4'));var Redis=require(_0xb146('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xb146('0x6'))(_0xb146('0x7'));config[_0xb146('0x8')]=_[_0xb146('0x9')](config[_0xb146('0x8')],{'host':_0xb146('0xa'),'port':0x18eb});var io=require(_0xb146('0xb'))(new Redis(config['redis']));function getAdminId(_0x452815,_0x50fe09,_0x2bb437,_0x16dbea){return new Promise(function(_0x2c563b,_0x54fb39){var _0x330069=![];var _0x22bc13={'method':_0xb146('0xc'),'uri':_0x16dbea+_0xb146('0xd'),'json':!![]};_0x22bc13[_0xb146('0xe')]=_0x2bb437;logger[_0xb146('0xf')](_0xb146('0x10'));return rp(_0x22bc13)[_0xb146('0x11')](function(_0x2fcf99){if(_0x2fcf99){var _0x5057f9=_0x2fcf99['users'];var _0x5a6e9f=null;for(_0x5a6e9f=0x0;_0x5a6e9f<_0x5057f9[_0xb146('0x12')];_0x5a6e9f++){if(_0x5057f9[_0x5a6e9f][_0xb146('0x13')]===_0x452815[_0xb146('0x14')]){_0x452815['adminId']=_0x5057f9[_0x5a6e9f]['id'];_0x330069=!![];}}if(_0x330069){logger[_0xb146('0xf')](_0xb146('0x15'),_0x452815[_0xb146('0x16')]);_0x2c563b(_0x452815);}else{_0x54fb39({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x54fb39({'statusCode':0x194,'message':_0xb146('0x17')});}})['catch'](function(_0x500da4){logger[_0xb146('0x18')]('['+[_0x50fe09[_0xb146('0x19')]()]+']',_0x500da4['message']);_0x54fb39(_0x500da4);});});}function getUser(_0x582ea5,_0x270db9,_0x239248){return function(_0x49d343){return new Promise(function(_0x3bdb56,_0x30d8e3){var _0x6ca725={'method':_0xb146('0xc'),'uri':_0x239248+_0xb146('0xd'),'json':!![]};_0x6ca725[_0xb146('0xe')]=_0x270db9;logger[_0xb146('0xf')]('Getting\x20user\x20list');return rp(_0x6ca725)[_0xb146('0x11')](function(_0x374ef3){if(_0x374ef3){var _0x10ffaf=_0x374ef3[_0xb146('0x1a')];var _0x30579d=![];var _0x6c227d=null;if(_0x49d343[_0xb146('0x1b')]!==null){logger[_0xb146('0xf')]('Getting\x20user\x20with\x20email',_0x49d343[_0xb146('0x1b')]);_0x49d343[_0xb146('0x1c')]=_0x49d343[_0xb146('0x1b')];for(_0x6c227d=0x0;_0x6c227d<_0x10ffaf[_0xb146('0x12')];_0x6c227d++){if(_0x10ffaf[_0x6c227d][_0xb146('0x13')]===_0x49d343['agentEmail']){_0x30579d=!![];_0x49d343[_0xb146('0x1d')]=_0x10ffaf[_0x6c227d]['id'];logger['info'](_0xb146('0x1e'),_0x49d343['userId']);}}}if(!_0x30579d){logger[_0xb146('0xf')](_0xb146('0x1f'));_0x49d343[_0xb146('0x1c')]=_0x49d343[_0xb146('0x14')];_0x49d343['userId']=_0x49d343['adminId'];_0x30579d=!![];}if(_0x30579d){_0x3bdb56(_0x49d343);}else{_0x30d8e3({'statusCode':0x194,'message':_0xb146('0x17')});}}else{_0x30d8e3({'statusCode':0x194,'message':_0xb146('0x17')});}})[_0xb146('0x20')](function(_0x41c5f5){logger['error']('['+[_0x582ea5[_0xb146('0x19')]()]+']',_0x41c5f5[_0xb146('0x21')]);_0x30d8e3(_0x41c5f5);});});};}function searchContact(_0x592d65,_0x160855,_0x2fccb7,_0x2aa281){return new Promise(function(_0xe9042b,_0x442100){var _0x125a7e={'method':_0xb146('0xc'),'headers':_0x160855,'uri':_0x592d65+_0xb146('0x22')+_0x2aa281+_0xb146('0x23')+_0x2fccb7+_0xb146('0x24'),'json':!![]};rp(_0x125a7e)[_0xb146('0x11')](function(_0x43c1f2){var _0x31750a=_[_0xb146('0x25')](_0x43c1f2[_0xb146('0x26')][_0xb146('0x26')],[_0x2fccb7,_0x2aa281]);_0xe9042b(_0x31750a);})[_0xb146('0x20')](function(_0xb5745e){_0x442100(_0xb5745e);});});}function getEndUser(_0x296da2,_0x2277f9,_0x21432){return function(_0x20ba78){return new Promise(function(_0x3cbf74,_0x24b9f6){logger[_0xb146('0xf')](util['format'](_0xb146('0x27'),_0x20ba78[_0xb146('0x28')]));searchContact(_0x21432,_0x2277f9,_0xb146('0x29'),_0x20ba78[_0xb146('0x28')])[_0xb146('0x11')](function(_0x94302c){if(_0x94302c){_0x20ba78[_0xb146('0x2a')]=_0x94302c['id'];logger[_0xb146('0xf')](_0xb146('0x2b'),_0x20ba78[_0xb146('0x2a')]);return _0x3cbf74(_0x20ba78);}searchContact(_0x21432,_0x2277f9,_0xb146('0x2c'),_0x20ba78['contactNumber'])[_0xb146('0x11')](function(_0x50ca30){if(_0x50ca30){_0x20ba78[_0xb146('0x2a')]=_0x50ca30['id'];logger['info'](_0xb146('0x2d'),_0x20ba78[_0xb146('0x2a')]);return _0x3cbf74(_0x20ba78);}createEndUser(_0x20ba78,_0x296da2,_0x2277f9,_0x21432)[_0xb146('0x11')](function(_0x211c5e){logger[_0xb146('0xf')](_0xb146('0x2e'),_0x211c5e['endUserId']);return _0x3cbf74(_0x211c5e);});});})[_0xb146('0x20')](function(_0x432592){_0x24b9f6(_0x432592);});});};}function createEndUser(_0x938eed,_0x1fe4c2,_0x3f76a5,_0x109567){return new Promise(function(_0x2f687c,_0x5184a9){var _0x595f2e=moment();var _0x38a836={'method':_0xb146('0x2f'),'uri':_0x109567+_0xb146('0x30'),'body':{'contact':{'last_name':_0x938eed['contactNumber'],'work_number':_0x938eed['contactNumber'],'mobile_number':_0x938eed[_0xb146('0x28')],'owner_id':_0x938eed[_0xb146('0x1d')],'created_at':_0x595f2e['format'](_0xb146('0x31'))}},'json':!![]};_0x38a836[_0xb146('0xe')]=_0x3f76a5;logger[_0xb146('0xf')](_0xb146('0x32'));return rp(_0x38a836)[_0xb146('0x11')](function(_0x2b5b5a){_0x938eed['endUserId']=_0x2b5b5a[_0xb146('0x33')]['id'];_0x2f687c(_0x938eed);})[_0xb146('0x20')](function(_0x154ce1){logger[_0xb146('0x18')]('['+[_0x1fe4c2[_0xb146('0x19')]()]+']',_0x154ce1[_0xb146('0x21')]);_0x5184a9(_0x154ce1[_0xb146('0x21')]);});});}function getTicket(_0x270dea,_0x4376c8,_0x1a1cca,_0x2327c3,_0x4052b2){return function(_0x3202c2){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x22a5da,_0x4aa62f){var _0x15534d=moment();var _0x355e2c={'method':_0xb146('0x2f'),'uri':_0x1a1cca+_0xb146('0x34'),'body':{'title':intUtil[_0xb146('0x35')](_0x2327c3[_0xb146('0x36')],_0x4052b2,'\x20'),'description':intUtil['getString'](_0x2327c3[_0xb146('0x37')],_0x4052b2,'\x0a'),'owner_id':_0x3202c2[_0xb146('0x1d')],'creater_id':_0x3202c2[_0xb146('0x16')],'targetable_id':_0x3202c2[_0xb146('0x2a')],'targetable_type':'Contact','created_at':_0x15534d[_0xb146('0x38')](_0xb146('0x31')),'due_date':_0x15534d[_0xb146('0x39')](0x1e,'m')[_0xb146('0x38')](_0xb146('0x31'))},'json':!![]};_0x355e2c[_0xb146('0xe')]=_0x4376c8;return rp(_0x355e2c)[_0xb146('0x11')](function(_0x53944d){_0x3202c2['ticketId']=_0x53944d['task']['id'];logger[_0xb146('0xf')]('Task\x20created:',_0x3202c2[_0xb146('0x3a')]);_0x22a5da(_0x3202c2);})['catch'](function(_0x2371af){logger['error']('['+[_0x270dea[_0xb146('0x19')]()]+']',_0x2371af[_0xb146('0x21')]);_0x4aa62f(_0x2371af[_0xb146('0x21')]);});});};}function emit(_0x1031f3,_0x1d2187,_0x16d00a){var _0x51a27a={'uri':_0x1031f3+_0xb146('0x3b')+_0x16d00a};io['to'](util['format'](_0xb146('0x3c'),_0x1d2187))[_0xb146('0x3d')](_0xb146('0x3e'),_0x51a27a);}exports['cs']=function(_0x3fda53,_0x5c5192,_0x29ab35,_0x8a44e8,_0x53822a,_0x32f2aa,_0x203ff0,_0x5435d3){var _0x4a47c8={};var _0x198955={'Authorization':_0xb146('0x3f')+_0x32f2aa[_0xb146('0x40')]};_0x32f2aa[_0xb146('0x41')]=intUtil[_0xb146('0x42')](_0x32f2aa[_0xb146('0x41')]);_0x32f2aa['serverUrl']=intUtil[_0xb146('0x42')](_0x32f2aa[_0xb146('0x43')]);var _0x1a7e79=_0x32f2aa[_0xb146('0x41')];_0x4a47c8[_0xb146('0x14')]=_0x32f2aa[_0xb146('0x44')];_0x4a47c8[_0xb146('0x28')]=_0x5435d3['toLowerCase']()===_0xb146('0x45')?_0x5c5192[_0xb146('0x46')]:_0x5c5192[_0xb146('0x47')];_0x4a47c8[_0xb146('0x48')]=_0x5435d3===_0xb146('0x49')||_0x5435d3===_0xb146('0x4a')?_0xb146('0x49'):'outbound';if(_0x8a44e8){_0x4a47c8[_0xb146('0x1b')]=_0x8a44e8['email'];}var _0x3a5162=util['format'](_0xb146('0x4b'),_0x32f2aa[_0xb146('0x43')],_0x5c5192[_0xb146('0x4c')],md5(_0x5c5192[_0xb146('0x4c')]));if(_0x53822a&&_0x53822a[_0xb146('0x4d')]){logger['info'](_0xb146('0x4e'),_0xb146('0x4f'));_0x5c5192[_0xb146('0x50')]=_0x3a5162;}else if(_0x203ff0&&_0x203ff0[_0xb146('0x51')]&&_0x203ff0[_0xb146('0x51')]!=='none'){logger[_0xb146('0xf')](_0xb146('0x52'),'Recording\x20is\x20enabled!');_0x5c5192['recordingURL']=_0x3a5162;}else{_0x5c5192[_0xb146('0x50')]='';}return getAdminId(_0x4a47c8,_0x5435d3,_0x198955,_0x1a7e79)[_0xb146('0x11')](getUser(_0x5435d3,_0x198955,_0x1a7e79))[_0xb146('0x11')](getEndUser(_0x5435d3,_0x198955,_0x1a7e79))['then'](getTicket(_0x5435d3,_0x198955,_0x1a7e79,_0x29ab35,_0x5c5192))[_0xb146('0x11')](function(_0x333c15){logger[_0xb146('0xf')](util[_0xb146('0x38')](_0xb146('0x53'),_0x333c15[_0xb146('0x3a')]));if(_0x5435d3!==_0xb146('0x4a')){logger[_0xb146('0xf')]('['+[_0x5435d3[_0xb146('0x19')]()]+']',_0xb146('0x54'));emit(_0x1a7e79,_0x8a44e8['name'],_0x333c15[_0xb146('0x2a')]);}})[_0xb146('0x20')](function(_0x3e749e){logger[_0xb146('0x18')]('['+[_0x5435d3[_0xb146('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x3e749e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1494=['contactNumber','endUserId','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','Subjects','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','ioredis','./util','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','User\x20found:','Admin\x20selected','userEmail','Requested\x20Resource\x20not\x20Found','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s'];(function(_0x4a87f9,_0x1b8201){var _0x51a8ee=function(_0x5a9b25){while(--_0x5a9b25){_0x4a87f9['push'](_0x4a87f9['shift']());}};_0x51a8ee(++_0x1b8201);}(_0x1494,0x10f));var _0x4149=function(_0x3e8b25,_0x20dee4){_0x3e8b25=_0x3e8b25-0x0;var _0x12d928=_0x1494[_0x3e8b25];return _0x12d928;};'use strict';var _=require(_0x4149('0x0'));var rp=require(_0x4149('0x1'));var md5=require('md5');var util=require(_0x4149('0x2'));var moment=require('moment');var Promise=require(_0x4149('0x3'));var Redis=require(_0x4149('0x4'));var intUtil=require(_0x4149('0x5'));var config=require('../../../../config/environment');var logger=require(_0x4149('0x6'))(_0x4149('0x7'));config['redis']=_[_0x4149('0x8')](config[_0x4149('0x9')],{'host':_0x4149('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x2b4cc8,_0x473af4,_0x39ae5d,_0x4ba3d9){return new Promise(function(_0x510c61,_0xcfabfc){var _0x10c56a=![];var _0x4b369c={'method':_0x4149('0xb'),'uri':_0x4ba3d9+_0x4149('0xc'),'json':!![]};_0x4b369c[_0x4149('0xd')]=_0x39ae5d;logger[_0x4149('0xe')](_0x4149('0xf'));return rp(_0x4b369c)[_0x4149('0x10')](function(_0x2b807a){if(_0x2b807a){var _0xd12e15=_0x2b807a[_0x4149('0x11')];var _0x27dd76=null;for(_0x27dd76=0x0;_0x27dd76<_0xd12e15[_0x4149('0x12')];_0x27dd76++){if(_0xd12e15[_0x27dd76][_0x4149('0x13')]===_0x2b4cc8[_0x4149('0x14')]){_0x2b4cc8[_0x4149('0x15')]=_0xd12e15[_0x27dd76]['id'];_0x10c56a=!![];}}if(_0x10c56a){logger['info'](_0x4149('0x16'),_0x2b4cc8[_0x4149('0x15')]);_0x510c61(_0x2b4cc8);}else{_0xcfabfc({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xcfabfc({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4149('0x17')](function(_0x239280){logger[_0x4149('0x18')]('['+[_0x473af4[_0x4149('0x19')]()]+']',_0x239280[_0x4149('0x1a')]);_0xcfabfc(_0x239280);});});}function getUser(_0x442d89,_0x4c56a2,_0x2bb46e){return function(_0x613c64){return new Promise(function(_0x45ba84,_0x18c6d7){var _0xfc53f1={'method':_0x4149('0xb'),'uri':_0x2bb46e+_0x4149('0xc'),'json':!![]};_0xfc53f1['headers']=_0x4c56a2;logger[_0x4149('0xe')](_0x4149('0x1b'));return rp(_0xfc53f1)[_0x4149('0x10')](function(_0x1ca3e0){if(_0x1ca3e0){var _0x22ed3c=_0x1ca3e0[_0x4149('0x11')];var _0x8fbc9e=![];var _0x4fd251=null;if(_0x613c64['agentEmail']!==null){logger['info']('Getting\x20user\x20with\x20email',_0x613c64[_0x4149('0x1c')]);_0x613c64['userEmail']=_0x613c64[_0x4149('0x1c')];for(_0x4fd251=0x0;_0x4fd251<_0x22ed3c[_0x4149('0x12')];_0x4fd251++){if(_0x22ed3c[_0x4fd251][_0x4149('0x13')]===_0x613c64[_0x4149('0x1c')]){_0x8fbc9e=!![];_0x613c64[_0x4149('0x1d')]=_0x22ed3c[_0x4fd251]['id'];logger[_0x4149('0xe')](_0x4149('0x1e'),_0x613c64[_0x4149('0x1d')]);}}}if(!_0x8fbc9e){logger[_0x4149('0xe')](_0x4149('0x1f'));_0x613c64[_0x4149('0x20')]=_0x613c64[_0x4149('0x14')];_0x613c64[_0x4149('0x1d')]=_0x613c64['adminId'];_0x8fbc9e=!![];}if(_0x8fbc9e){_0x45ba84(_0x613c64);}else{_0x18c6d7({'statusCode':0x194,'message':_0x4149('0x21')});}}else{_0x18c6d7({'statusCode':0x194,'message':_0x4149('0x21')});}})[_0x4149('0x17')](function(_0x503478){logger[_0x4149('0x18')]('['+[_0x442d89[_0x4149('0x19')]()]+']',_0x503478[_0x4149('0x1a')]);_0x18c6d7(_0x503478);});});};}function searchContact(_0x210fb8,_0x3f6764,_0x738dad,_0x141e4d){return new Promise(function(_0x2cacf5,_0x4dbadd){var _0x2fe84e={'method':'GET','headers':_0x3f6764,'uri':_0x210fb8+_0x4149('0x22')+_0x141e4d+_0x4149('0x23')+_0x738dad+_0x4149('0x24'),'json':!![]};rp(_0x2fe84e)['then'](function(_0x149a94){var _0x1d3602=_[_0x4149('0x25')](_0x149a94[_0x4149('0x26')]['contacts'],[_0x738dad,_0x141e4d]);_0x2cacf5(_0x1d3602);})[_0x4149('0x17')](function(_0x50ce0a){_0x4dbadd(_0x50ce0a);});});}function getEndUser(_0x4d1225,_0x158e56,_0x145647){return function(_0x41a1f8){return new Promise(function(_0x1f6bc7,_0x216b66){logger['info'](util[_0x4149('0x27')](_0x4149('0x28'),_0x41a1f8[_0x4149('0x29')]));searchContact(_0x145647,_0x158e56,'mobile_number',_0x41a1f8['contactNumber'])[_0x4149('0x10')](function(_0x4e2424){if(_0x4e2424){_0x41a1f8[_0x4149('0x2a')]=_0x4e2424['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x41a1f8['endUserId']);return _0x1f6bc7(_0x41a1f8);}searchContact(_0x145647,_0x158e56,'work_number',_0x41a1f8['contactNumber'])[_0x4149('0x10')](function(_0x17d881){if(_0x17d881){_0x41a1f8[_0x4149('0x2a')]=_0x17d881['id'];logger[_0x4149('0xe')]('Contact\x20found\x20work_number:',_0x41a1f8[_0x4149('0x2a')]);return _0x1f6bc7(_0x41a1f8);}createEndUser(_0x41a1f8,_0x4d1225,_0x158e56,_0x145647)[_0x4149('0x10')](function(_0x316cb7){logger[_0x4149('0xe')]('Contact\x20created:',_0x316cb7[_0x4149('0x2a')]);return _0x1f6bc7(_0x316cb7);});});})['catch'](function(_0xb37f36){_0x216b66(_0xb37f36);});});};}function createEndUser(_0xd4d438,_0x1c4445,_0x5e07db,_0x2112a7){return new Promise(function(_0x12bdcd,_0x746242){var _0x302504=moment();var _0x1d43f2={'method':'POST','uri':_0x2112a7+'/api/contacts','body':{'contact':{'last_name':_0xd4d438[_0x4149('0x29')],'work_number':_0xd4d438[_0x4149('0x29')],'mobile_number':_0xd4d438[_0x4149('0x29')],'owner_id':_0xd4d438[_0x4149('0x1d')],'created_at':_0x302504[_0x4149('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1d43f2[_0x4149('0xd')]=_0x5e07db;logger['info'](_0x4149('0x2b'));return rp(_0x1d43f2)[_0x4149('0x10')](function(_0x3d4af6){_0xd4d438[_0x4149('0x2a')]=_0x3d4af6[_0x4149('0x2c')]['id'];_0x12bdcd(_0xd4d438);})['catch'](function(_0x4e2733){logger[_0x4149('0x18')]('['+[_0x1c4445[_0x4149('0x19')]()]+']',_0x4e2733[_0x4149('0x1a')]);_0x746242(_0x4e2733['message']);});});}function getTicket(_0xf0e346,_0x207849,_0x1d2026,_0x571313,_0x40a040){return function(_0x2eaf42){logger[_0x4149('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x5973a7,_0x448c9f){var _0x20feb3=moment();var _0x4fc2f0={'method':_0x4149('0x2d'),'uri':_0x1d2026+'/api/tasks','body':{'title':intUtil['getString'](_0x571313[_0x4149('0x2e')],_0x40a040,'\x20'),'description':intUtil[_0x4149('0x2f')](_0x571313[_0x4149('0x30')],_0x40a040,'\x0a'),'owner_id':_0x2eaf42[_0x4149('0x1d')],'creater_id':_0x2eaf42[_0x4149('0x15')],'targetable_id':_0x2eaf42[_0x4149('0x2a')],'targetable_type':_0x4149('0x31'),'created_at':_0x20feb3[_0x4149('0x27')](_0x4149('0x32')),'due_date':_0x20feb3[_0x4149('0x33')](0x1e,'m')[_0x4149('0x27')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4fc2f0[_0x4149('0xd')]=_0x207849;return rp(_0x4fc2f0)[_0x4149('0x10')](function(_0x5ad437){_0x2eaf42[_0x4149('0x34')]=_0x5ad437[_0x4149('0x35')]['id'];logger[_0x4149('0xe')](_0x4149('0x36'),_0x2eaf42[_0x4149('0x34')]);_0x5973a7(_0x2eaf42);})[_0x4149('0x17')](function(_0x2c4403){logger[_0x4149('0x18')]('['+[_0xf0e346[_0x4149('0x19')]()]+']',_0x2c4403[_0x4149('0x1a')]);_0x448c9f(_0x2c4403['message']);});});};}function emit(_0x35a611,_0x464119,_0x6896db){var _0x1c085c={'uri':_0x35a611+_0x4149('0x37')+_0x6896db};io['to'](util[_0x4149('0x27')]('user:%s',_0x464119))['emit'](_0x4149('0x38'),_0x1c085c);}exports['cs']=function(_0x11d0c3,_0x13023f,_0x2601dd,_0x48c523,_0xa50a7e,_0x13f38a,_0x5cb836,_0x1ba249){var _0x144a45={};var _0x15cc83={'Authorization':'Token\x20token='+_0x13f38a[_0x4149('0x39')]};_0x13f38a[_0x4149('0x3a')]=intUtil[_0x4149('0x3b')](_0x13f38a[_0x4149('0x3a')]);_0x13f38a[_0x4149('0x3c')]=intUtil[_0x4149('0x3b')](_0x13f38a[_0x4149('0x3c')]);var _0x8d0d16=_0x13f38a[_0x4149('0x3a')];_0x144a45[_0x4149('0x14')]=_0x13f38a[_0x4149('0x3d')];_0x144a45[_0x4149('0x29')]=_0x1ba249[_0x4149('0x3e')]()===_0x4149('0x3f')?_0x13023f[_0x4149('0x40')]:_0x13023f[_0x4149('0x41')];_0x144a45['callDirection']=_0x1ba249===_0x4149('0x42')||_0x1ba249===_0x4149('0x43')?_0x4149('0x42'):_0x4149('0x3f');if(_0x48c523){_0x144a45[_0x4149('0x1c')]=_0x48c523[_0x4149('0x13')];}var _0x554727=util[_0x4149('0x27')](_0x4149('0x44'),_0x13f38a[_0x4149('0x3c')],_0x13023f[_0x4149('0x45')],md5(_0x13023f['uniqueid']));if(_0xa50a7e&&_0xa50a7e[_0x4149('0x46')]){logger['info']('[QUEUE]',_0x4149('0x47'));_0x13023f[_0x4149('0x48')]=_0x554727;}else if(_0x5cb836&&_0x5cb836[_0x4149('0x49')]&&_0x5cb836[_0x4149('0x49')]!=='none'){logger[_0x4149('0xe')]('[OUTBOUND]',_0x4149('0x47'));_0x13023f[_0x4149('0x48')]=_0x554727;}else{_0x13023f[_0x4149('0x48')]='';}return getAdminId(_0x144a45,_0x1ba249,_0x15cc83,_0x8d0d16)[_0x4149('0x10')](getUser(_0x1ba249,_0x15cc83,_0x8d0d16))[_0x4149('0x10')](getEndUser(_0x1ba249,_0x15cc83,_0x8d0d16))[_0x4149('0x10')](getTicket(_0x1ba249,_0x15cc83,_0x8d0d16,_0x2601dd,_0x13023f))[_0x4149('0x10')](function(_0x25227e){logger['info'](util[_0x4149('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x25227e['ticketId']));if(_0x1ba249!==_0x4149('0x43')){logger[_0x4149('0xe')]('['+[_0x1ba249['toUpperCase']()]+']',_0x4149('0x4a'));emit(_0x8d0d16,_0x48c523[_0x4149('0x4b')],_0x25227e[_0x4149('0x2a')]);}})[_0x4149('0x17')](function(_0x18ad95){logger[_0x4149('0x18')]('['+[_0x1ba249[_0x4149('0x19')]()]+_0x4149('0x4c'),util[_0x4149('0x4d')](_0x18ad95,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 748ab1f..755d5a4 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x355a=['desk','vtiger','servicenow','exec','includes','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','toLowerCase','freshdesk','zoho','freshsales','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x355a,0xf7));var _0xa355=function(_0x57f838,_0x525a96){_0x57f838=_0x57f838-0x0;var _0x227730=_0x355a[_0x57f838];return _0x227730;};'use strict';var _=require(_0xa355('0x0'));var util=require(_0xa355('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xa355('0x2'));var sugarcrm=require(_0xa355('0x3'));var freshdesk=require(_0xa355('0x4'));var zoho=require(_0xa355('0x5'));var desk=require('./desk');var vtiger=require(_0xa355('0x6'));var servicenow=require(_0xa355('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xa355('0x8'));var integrations=[_0xa355('0x9'),_0xa355('0xa'),_0xa355('0xb'),'freshdesk','zoho',_0xa355('0xc'),_0xa355('0xd'),'dynamics365','freshsales',_0xa355('0xe')];exports[_0xa355('0xf')]=function(_0x9aa05,_0x22d302,_0x31d2d3,_0x159832,_0x8a0a6e,_0x239394){if(_0x31d2d3){if(_[_0xa355('0x10')](integrations,_0x9aa05[_0xa355('0x11')]['toLowerCase']())){try{var _0x4a8d54=null;var _0x2e619b='';var _0x4b1481=_0x31d2d3[_0x9aa05[_0xa355('0x11')]['toLowerCase']()];if(_0x4b1481){var _0x58e6ab=_0x4b1481[_0x9aa05[_0xa355('0x12')]];if(_0x58e6ab){var _0x26ddd7=_[_0xa355('0x13')](_0x58e6ab[_0xa355('0x14')],{'id':parseInt(_0x9aa05[_0xa355('0x15')],0xa)});if(_0x26ddd7){if(_0x159832){if(_0x8a0a6e&&_0x22d302[_0xa355('0x16')]){_0x2e619b=_0xa355('0x16');}else if(_0x22d302[_0xa355('0x17')]){_0x2e619b=_0xa355('0x18');}else{console[_0xa355('0x19')](_0xa355('0x1a'),_0x22d302);}}else{_0x2e619b=_0xa355('0x1b');}switch(_0x9aa05[_0xa355('0x11')][_0xa355('0x1c')]()){case _0xa355('0x9'):zendesk[_0x2e619b](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394);break;case'salesforce':salesforce[_0x2e619b](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394);break;case'sugarcrm':sugarcrm[_0x2e619b](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394);break;case _0xa355('0x1d'):freshdesk[_0x2e619b](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394);break;case _0xa355('0x1e'):zoho[_0x2e619b](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394);break;case'desk':desk[_0x2e619b](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394);break;case'vtiger':vtiger[_0x2e619b](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394);break;case _0xa355('0x1f'):freshsales['cs'](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394,_0x2e619b);break;case'servicenow':servicenow['cs'](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394,_0x2e619b);break;case'dynamics365':dynamics365['cs'](_0x9aa05,_0x22d302,_0x26ddd7,_0x159832,_0x8a0a6e,_0x58e6ab,_0x239394,_0x2e619b);break;default:console[_0xa355('0x19')](_0xa355('0x20'));}}else{_0x4a8d54=require(_0xa355('0x21'))(_0x9aa05['data1']['toLowerCase']());_0x4a8d54[_0xa355('0x22')]('[EXEC]',util[_0xa355('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x9aa05[_0xa355('0x11')][_0xa355('0x1c')](),_0x9aa05[_0xa355('0x15')]));}}else{_0x4a8d54=require(_0xa355('0x21'))(_0x9aa05['data1'][_0xa355('0x1c')]());_0x4a8d54[_0xa355('0x22')](_0xa355('0x24'),util[_0xa355('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x9aa05[_0xa355('0x11')]['toLowerCase'](),_0x9aa05[_0xa355('0x12')]));}}else{}}catch(_0x28de26){console[_0xa355('0x22')](_0x28de26);}}}}; \ No newline at end of file +var _0xb32e=['./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','data3','routeId','outbound','log','EVENT\x20UNKNOWN','unknown\x20integration','error','../../../../config/logger','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./desk','./vtiger'];(function(_0x315aea,_0x384a09){var _0x589262=function(_0x538289){while(--_0x538289){_0x315aea['push'](_0x315aea['shift']());}};_0x589262(++_0x384a09);}(_0xb32e,0x14f));var _0xeb32=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb32e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xeb32('0x0'));var util=require('util');var zendesk=require(_0xeb32('0x1'));var salesforce=require(_0xeb32('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0xeb32('0x3'));var vtiger=require(_0xeb32('0x4'));var servicenow=require(_0xeb32('0x5'));var dynamics365=require(_0xeb32('0x6'));var freshsales=require(_0xeb32('0x7'));var integrations=[_0xeb32('0x8'),_0xeb32('0x9'),_0xeb32('0xa'),_0xeb32('0xb'),_0xeb32('0xc'),_0xeb32('0xd'),_0xeb32('0xe'),_0xeb32('0xf'),'freshsales',_0xeb32('0x10')];exports[_0xeb32('0x11')]=function(_0x4fb0dc,_0x11a0ec,_0x31296c,_0x57abe4,_0xdc00ba,_0x4a1c04){if(_0x31296c){if(_[_0xeb32('0x12')](integrations,_0x4fb0dc[_0xeb32('0x13')][_0xeb32('0x14')]())){try{var _0x9f37d9=null;var _0x489d27='';var _0x34f8cb=_0x31296c[_0x4fb0dc[_0xeb32('0x13')][_0xeb32('0x14')]()];if(_0x34f8cb){var _0x3eb67e=_0x34f8cb[_0x4fb0dc[_0xeb32('0x15')]];if(_0x3eb67e){var _0xbbdebc=_[_0xeb32('0x16')](_0x3eb67e['Configurations'],{'id':parseInt(_0x4fb0dc[_0xeb32('0x17')],0xa)});if(_0xbbdebc){if(_0x57abe4){if(_0xdc00ba&&_0x11a0ec['queue']){_0x489d27='queue';}else if(_0x11a0ec[_0xeb32('0x18')]){_0x489d27=_0xeb32('0x19');}else{console[_0xeb32('0x1a')](_0xeb32('0x1b'),_0x11a0ec);}}else{_0x489d27='unmanaged';}switch(_0x4fb0dc[_0xeb32('0x13')]['toLowerCase']()){case'zendesk':zendesk[_0x489d27](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04);break;case _0xeb32('0x9'):salesforce[_0x489d27](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04);break;case _0xeb32('0xa'):sugarcrm[_0x489d27](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04);break;case _0xeb32('0xb'):freshdesk[_0x489d27](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04);break;case _0xeb32('0xc'):zoho[_0x489d27](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04);break;case _0xeb32('0xd'):desk[_0x489d27](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04);break;case'vtiger':vtiger[_0x489d27](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04);break;case'freshsales':freshsales['cs'](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04,_0x489d27);break;case _0xeb32('0x10'):servicenow['cs'](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04,_0x489d27);break;case _0xeb32('0xf'):dynamics365['cs'](_0x4fb0dc,_0x11a0ec,_0xbbdebc,_0x57abe4,_0xdc00ba,_0x3eb67e,_0x4a1c04,_0x489d27);break;default:console[_0xeb32('0x1a')](_0xeb32('0x1c'));}}else{_0x9f37d9=require('../../../../config/logger')(_0x4fb0dc[_0xeb32('0x13')][_0xeb32('0x14')]());_0x9f37d9[_0xeb32('0x1d')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x4fb0dc[_0xeb32('0x13')][_0xeb32('0x14')](),_0x4fb0dc[_0xeb32('0x17')]));}}else{_0x9f37d9=require(_0xeb32('0x1e'))(_0x4fb0dc[_0xeb32('0x13')]['toLowerCase']());_0x9f37d9[_0xeb32('0x1d')](_0xeb32('0x1f'),util[_0xeb32('0x20')](_0xeb32('0x21'),_0x4fb0dc['data1'][_0xeb32('0x14')](),_0x4fb0dc[_0xeb32('0x15')]));}}else{}}catch(_0x47b720){console[_0xeb32('0x1d')](_0x47b720);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 144bd7d..49095fb 100644 --- a/server/services/ami/trigger/integration/salesforce.js +++ b/server/services/ami/trigger/integration/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ee3=['getString','Subjects','Descriptions','ticketType','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','sobject','User','execute','length','find','Email','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','merge','$or','Contact','account_contact_lead','additionalSearchAccount','Account','additionalSearchContact','additionalSearchLead','Lead','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','defaults','localhost','socket.io-emitter','emit','assign'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x9ee3,0x164));var _0x39ee=function(_0x1adfa6,_0x19db85){_0x1adfa6=_0x1adfa6-0x0;var _0x79e012=_0x9ee3[_0x1adfa6];return _0x79e012;};'use strict';var _=require('lodash');var rp=require(_0x39ee('0x0'));var moment=require(_0x39ee('0x1'));var BPromise=require(_0x39ee('0x2'));var md5=require('md5');var jsforce=require(_0x39ee('0x3'));var util=require(_0x39ee('0x4'));var Redis=require(_0x39ee('0x5'));var intUtil=require(_0x39ee('0x6'));var config=require(_0x39ee('0x7'));var logger=require('../../../../config/logger')('salesforce');config['redis']=_[_0x39ee('0x8')](config['redis'],{'host':_0x39ee('0x9'),'port':0x18eb});var io=require(_0x39ee('0xa'))(new Redis(config['redis']));function emit(_0x5e0962,_0x3c9c7e,_0x4538af){io['to'](_0x5e0962)[_0x39ee('0xb')](_0x3c9c7e,_0x4538af);}function getTicket(_0x3bca4e,_0x5ae454,_0x257e5a,_0x453173,_0x1fd7a5,_0x5b92d9,_0x103a36,_0x2126d3){var _0x178798=Object[_0x39ee('0xc')]({},{'OwnerId':_0x5ae454['id'],'Subject':intUtil[_0x39ee('0xd')](_0x453173[_0x39ee('0xe')],_0x1fd7a5,'\x20'),'Description':intUtil[_0x39ee('0xd')](_0x453173[_0x39ee('0xf')],_0x1fd7a5,'\x0a')},getCustomFields(_0x5b92d9,_0x1fd7a5));if(_0x257e5a){if(_0x453173[_0x39ee('0x10')]==='Task'){_0x178798['ActivityDate']=moment['utc']();_0x178798['IsReminderSet']=![];_0x178798[_0x39ee('0x11')]=![];if(_0x257e5a[_0x39ee('0x12')]===_0x39ee('0x13')||_0x257e5a[_0x39ee('0x12')]===_0x39ee('0x14')){_0x178798[_0x39ee('0x15')]=_0x257e5a['id'];}else if(_0x257e5a[_0x39ee('0x12')]===_0x39ee('0x16')){_0x178798[_0x39ee('0x17')]=_0x257e5a['id'];}}else if(_0x453173['ticketType']==='Case'){if(_0x257e5a[_0x39ee('0x12')]===_0x39ee('0x13')){_0x178798[_0x39ee('0x18')]=_0x257e5a['id'];}else if(_0x257e5a[_0x39ee('0x12')]===_0x39ee('0x16')){_0x178798[_0x39ee('0x19')]=_0x257e5a['id'];}else if(_0x257e5a[_0x39ee('0x12')]===_0x39ee('0x14')&&_0x453173[_0x39ee('0x1a')]){_0x178798[_0x453173[_0x39ee('0x1a')]]=_0x257e5a['id'];}else{logger['info'](_0x39ee('0x1b'));}}}return _0x103a36['sobject'](_0x453173['ticketType'])[_0x39ee('0x1c')](_0x178798);}function getUser(_0x2f0d7d,_0x21124f,_0x271cdc){if(!_['isNil'](_0x21124f)&&intUtil[_0x39ee('0x1d')](_0x21124f)){var _0x2e9b79={'Email':_0x21124f};var _0x4188ff={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x271cdc[_0x39ee('0x1e')](_0x39ee('0x1f'))['find'](_0x2e9b79,_0x4188ff)[_0x39ee('0x20')]()['then'](function(_0x590cd4){if(_0x590cd4[_0x39ee('0x21')]){var _0x1acd7d=_[_0x39ee('0x22')](_0x590cd4,function(_0x300373){return _0x300373[_0x39ee('0x23')]===_0x21124f;});if(_0x1acd7d){logger[_0x39ee('0x24')](_0x39ee('0x25'),_0x21124f);return BPromise[_0x39ee('0x26')]({'id':_0x1acd7d['Id'],'name':_0x1acd7d['Name']});}}else{logger[_0x39ee('0x24')](_0x39ee('0x27'),_0x21124f);return _0x271cdc[_0x39ee('0x28')]()[_0x39ee('0x29')](function(_0x2fe340){return BPromise[_0x39ee('0x26')]({'id':_0x2fe340[_0x39ee('0x2a')],'name':_0x2fe340[_0x39ee('0x2b')]});});}});}else{logger[_0x39ee('0x24')](_0x39ee('0x27'),_0x21124f);return _0x271cdc[_0x39ee('0x28')]()[_0x39ee('0x29')](function(_0x49ded0){return BPromise[_0x39ee('0x26')]({'id':_0x49ded0[_0x39ee('0x2a')],'name':_0x49ded0['display_name']});});}}function getEndUser(_0x55357e,_0x359168,_0x2ec6ae,_0x2871cc,_0x57d402){var _0x5b3d1a={'$or':{'Phone':_0x2871cc}};var _0x3b8b03={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x39ee('0x29')](function(){logger['info'](_0x39ee('0x2c'),_0x2871cc,_0x359168['moduleSearch']);switch(_0x359168[_0x39ee('0x2d')]){case _0x39ee('0x2e'):var _0x52688d=_[_0x39ee('0x2f')](_0x5b3d1a);if(_0x359168['additionalSearchContact']){var _0x38e786={};_0x38e786[_0x359168['additionalSearchContact']]=_0x2871cc;_[_0x39ee('0x30')](_0x52688d[_0x39ee('0x31')],_0x38e786);}return _0x57d402[_0x39ee('0x1e')](_0x39ee('0x32'))[_0x39ee('0x22')](_0x52688d,_0x3b8b03)[_0x39ee('0x20')]()[_0x39ee('0x29')](function(_0xfa884){if(_0xfa884&&_0xfa884[_0x39ee('0x21')]){return _0xfa884;}else{var _0x61fa71=_[_0x39ee('0x2f')](_0x5b3d1a);if(_0x359168['additionalSearchLead']){var _0x3790f6={};_0x3790f6[_0x359168['additionalSearchLead']]=_0x2871cc;_[_0x39ee('0x30')](_0x61fa71['$or'],_0x3790f6);}return _0x57d402[_0x39ee('0x1e')]('Lead')[_0x39ee('0x22')](_0x61fa71,_0x3b8b03);}});case _0x39ee('0x33'):var _0x3ad955=_[_0x39ee('0x2f')](_0x5b3d1a);if(_0x359168[_0x39ee('0x34')]){var _0x38e786={};_0x38e786[_0x359168[_0x39ee('0x34')]]=_0x2871cc;_[_0x39ee('0x30')](_0x3ad955[_0x39ee('0x31')],_0x38e786);}return _0x57d402[_0x39ee('0x1e')](_0x39ee('0x35'))[_0x39ee('0x22')](_0x3ad955,_0x3b8b03)['execute']()[_0x39ee('0x29')](function(_0x1ca77b){if(_0x1ca77b&&_0x1ca77b['length']){return _0x1ca77b;}else{var _0x5e46a2=_['cloneDeep'](_0x5b3d1a);if(_0x359168[_0x39ee('0x36')]){var _0x35374b={};_0x35374b[_0x359168['additionalSearchContact']]=_0x2871cc;_[_0x39ee('0x30')](_0x5e46a2['$or'],_0x35374b);}return _0x57d402[_0x39ee('0x1e')](_0x39ee('0x32'))[_0x39ee('0x22')](_0x5e46a2,_0x3b8b03)['then'](function(_0x28118d){if(_0x28118d&&_0x28118d[_0x39ee('0x21')]){return _0x28118d;}else{var _0x26f2da=_['cloneDeep'](_0x5b3d1a);if(_0x359168[_0x39ee('0x37')]){var _0x380f25={};_0x380f25[_0x359168['additionalSearchLead']]=_0x2871cc;_[_0x39ee('0x30')](_0x26f2da[_0x39ee('0x31')],_0x380f25);}return _0x57d402['sobject'](_0x39ee('0x38'))[_0x39ee('0x22')](_0x26f2da,_0x3b8b03);}});}});case'contact':var _0x52688d=_[_0x39ee('0x2f')](_0x5b3d1a);if(_0x359168[_0x39ee('0x36')]){var _0x38e786={};_0x38e786[_0x359168[_0x39ee('0x36')]]=_0x2871cc;_['merge'](_0x52688d[_0x39ee('0x31')],_0x38e786);}return _0x57d402['sobject'](_0x39ee('0x32'))[_0x39ee('0x22')](_0x52688d,_0x3b8b03)['execute']();case _0x39ee('0x14'):var _0x2fca4a=_[_0x39ee('0x2f')](_0x5b3d1a);if(_0x359168['additionalSearchLead']){var _0x38e786={};_0x38e786[_0x359168['additionalSearchLead']]=_0x2871cc;_[_0x39ee('0x30')](_0x2fca4a['$or'],_0x38e786);}return _0x57d402[_0x39ee('0x1e')]('Lead')['find'](_0x2fca4a,_0x3b8b03);case'account':var _0x3ad955=_['cloneDeep'](_0x5b3d1a);if(_0x359168[_0x39ee('0x34')]){var _0x38e786={};_0x38e786[_0x359168[_0x39ee('0x34')]]=_0x2871cc;_[_0x39ee('0x30')](_0x3ad955['$or'],_0x38e786);}return _0x57d402[_0x39ee('0x1e')](_0x39ee('0x35'))[_0x39ee('0x22')](_0x3ad955,_0x3b8b03);default:return null;}})['then'](function(_0x51f410){if(_0x51f410&&_0x51f410[_0x39ee('0x21')]){var _0x24e156=_['first'](_0x51f410);if(_0x24e156){return BPromise[_0x39ee('0x26')]({'id':_0x24e156['Id'],'name':_0x24e156['Name'],'phone':_0x24e156['Phone'],'endUserType':_0x24e156['attributes'][_0x39ee('0x39')][_0x39ee('0x3a')]()});}}})['then'](function(_0x21de8d){if(_0x21de8d){logger[_0x39ee('0x24')](_0x39ee('0x3b'),_0x21de8d[_0x39ee('0x12')],_0x2871cc);return BPromise['resolve'](_0x21de8d);}else{logger[_0x39ee('0x24')](_0x39ee('0x3c'),_0x2871cc);var _0x277032={'Phone':_0x2871cc};if(_0x359168['moduleCreate']){if(_0x359168[_0x39ee('0x3d')]===_0x39ee('0x13')){logger['info'](_0x39ee('0x3e'),_0x2871cc,_0x359168[_0x39ee('0x3d')]);_0x277032[_0x39ee('0x3f')]=_0x2ec6ae!==_0x39ee('0x40')?_0x2ec6ae:util[_0x39ee('0x41')](_0x39ee('0x42'),_0x2871cc);}else if(_0x359168['moduleCreate']===_0x39ee('0x14')){logger['info'](_0x39ee('0x3e'),_0x2871cc,_0x359168[_0x39ee('0x3d')]);_0x277032[_0x39ee('0x3f')]=_0x2ec6ae!==_0x39ee('0x40')?_0x2ec6ae:util['format'](_0x39ee('0x42'),_0x2871cc);_0x277032[_0x39ee('0x43')]='No\x20Company';}else if(_0x359168[_0x39ee('0x3d')]==='account'){logger[_0x39ee('0x24')](_0x39ee('0x3e'),_0x2871cc,_0x359168[_0x39ee('0x3d')]);_0x277032['Name']=_0x2ec6ae!==_0x39ee('0x40')?_0x2ec6ae:util[_0x39ee('0x41')](_0x39ee('0x42'),_0x2871cc);}else{return null;}}return _0x57d402[_0x39ee('0x1e')](_[_0x39ee('0x44')](_0x359168[_0x39ee('0x3d')]))[_0x39ee('0x1c')](_0x277032)[_0x39ee('0x29')](function(_0x2cc1fd){return BPromise[_0x39ee('0x26')]({'id':_0x2cc1fd['id'],'endUserType':_0x359168[_0x39ee('0x3d')]});});}});}function getCustomFields(_0x2e76fe,_0x55ea94){var _0x2948df={};if(_0x2e76fe[_0x39ee('0x21')]>0x0){_[_0x39ee('0x45')](_0x2e76fe,function(_0x3a5486){if(_[_0x39ee('0x46')]([_0x39ee('0x47'),_0x39ee('0x48')],_0x3a5486[_0x39ee('0x39')])&&_0x3a5486[_0x39ee('0x49')]){_0x2948df[_0x3a5486['idField']]=_0x3a5486[_0x39ee('0x4a')][_0x39ee('0x4b')]();}else if(_0x3a5486[_0x39ee('0x39')]==='variable'&&_0x3a5486[_0x39ee('0x4c')]&&_0x3a5486['idField']){_0x55ea94[_0x3a5486[_0x39ee('0x4c')]]&&(_0x2948df[_0x3a5486['idField']]=_0x55ea94[_0x3a5486[_0x39ee('0x4c')]][_0x39ee('0x4b')]());}else if(_0x3a5486[_0x39ee('0x39')]===_0x39ee('0x4d')&&_0x3a5486[_0x39ee('0x4e')]&&_0x3a5486['Variable']['name']&&_0x3a5486['idField']){_0x55ea94[_0x3a5486[_0x39ee('0x4e')][_0x39ee('0x4f')]['toLowerCase']()]&&(_0x2948df[_0x3a5486[_0x39ee('0x49')]]=_0x55ea94[_0x3a5486[_0x39ee('0x4e')]['name']['toLowerCase']()][_0x39ee('0x4b')]());}});}return _0x2948df;}function getConnection(_0x16ea45){var _0x37c4c2=_0x16ea45[_0x39ee('0x50')]['concat'](_0x16ea45[_0x39ee('0x51')]);var _0x354954=new jsforce[(_0x39ee('0x52'))]({'oauth2':{'loginUrl':_0x16ea45[_0x39ee('0x53')]||_0x39ee('0x54'),'clientId':_0x16ea45['clientId'],'clientSecret':_0x16ea45['clientSecret']}});return _0x354954[_0x39ee('0x55')](_0x16ea45[_0x39ee('0x56')],_0x37c4c2)[_0x39ee('0x29')](function(){logger[_0x39ee('0x24')]('Connection\x20established.');return _0x354954;});}exports[_0x39ee('0x57')]=function(_0x1e9038,_0x2449f7,_0x6db649,_0x3bed1e,_0x16a8d1,_0x996de7){var _0x32a8e8,_0x21dd5f,_0x324ca6,_0x239d3a;_0x996de7['serverUrl']=intUtil['stripTrailingSlash'](_0x996de7[_0x39ee('0x58')]);_0x996de7[_0x39ee('0x53')]=intUtil[_0x39ee('0x59')](_0x996de7[_0x39ee('0x53')]);if(_0x16a8d1&&_0x16a8d1[_0x39ee('0x5a')]){logger[_0x39ee('0x24')](_0x39ee('0x5b'),'Recording\x20is\x20enabled!');_0x2449f7['recordingURL']=util[_0x39ee('0x41')](_0x39ee('0x5c'),_0x996de7[_0x39ee('0x58')],_0x2449f7['uniqueid'],md5(_0x2449f7[_0x39ee('0x5d')]));}else{_0x2449f7['recordingURL']='';}return getConnection(_0x996de7)['then'](function(_0xe1ec3c){_0x239d3a=_0xe1ec3c;return getUser(_0x996de7,_0x3bed1e[_0x39ee('0x5e')],_0x239d3a);})['then'](function(_0x1e0ab7){_0x32a8e8=_0x1e0ab7;return getEndUser(_0x996de7,_0x6db649,_0x2449f7[_0x39ee('0x5f')],_0x2449f7['calleridnum'],_0x239d3a);})[_0x39ee('0x29')](function(_0x4e7beb){_0x21dd5f=_0x4e7beb;return getTicket(_0x996de7,_0x32a8e8,_0x21dd5f,_0x6db649,_0x2449f7,_0x6db649[_0x39ee('0x60')],_0x239d3a,'queue');})[_0x39ee('0x29')](function(_0x13f6e4){_0x324ca6=_0x13f6e4;logger[_0x39ee('0x24')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x324ca6['id']);logger[_0x39ee('0x24')](_0x39ee('0x61'),_0x324ca6['id'],_0x3bed1e[_0x39ee('0x4f')],_0x996de7['type']);switch(_0x996de7[_0x39ee('0x39')]){case'integrationTab':emit(util[_0x39ee('0x41')](_0x39ee('0x62'),_0x3bed1e['name']),_0x39ee('0x63'),{'recordId':_0x324ca6['id']});break;case _0x39ee('0x64'):emit(util[_0x39ee('0x41')](_0x39ee('0x62'),_0x3bed1e[_0x39ee('0x4f')]),_0x39ee('0x65'),{'uri':util[_0x39ee('0x41')]('%s/%s/e',_0x239d3a[_0x39ee('0x66')],_0x324ca6['id'])});break;default:logger[_0x39ee('0x67')](_0x39ee('0x68'));}})[_0x39ee('0x69')](function(_0x593e07){logger[_0x39ee('0x67')](_0x39ee('0x5b'),_0x593e07);});};exports[_0x39ee('0x6a')]=function(_0x4de49c,_0x59cbff,_0xa86a27,_0x699cf6,_0xd07107,_0x551953,_0x7e4544){var _0x45b58c,_0x2387ee,_0x36a147,_0x58cb9e;_0x551953[_0x39ee('0x58')]=intUtil['stripTrailingSlash'](_0x551953[_0x39ee('0x58')]);_0x551953['remoteUri']=intUtil['stripTrailingSlash'](_0x551953[_0x39ee('0x53')]);if(_0x7e4544&&_0x7e4544[_0x39ee('0x6b')]&&_0x7e4544['recordingFormat']!==_0x39ee('0x6c')){logger[_0x39ee('0x24')](_0x39ee('0x6d'),_0x39ee('0x6e'));_0x59cbff[_0x39ee('0x6f')]=util['format'](_0x39ee('0x5c'),_0x551953[_0x39ee('0x58')],_0x59cbff[_0x39ee('0x5d')],md5(_0x59cbff[_0x39ee('0x5d')]));}return getConnection(_0x551953)[_0x39ee('0x29')](function(_0x4cd864){_0x58cb9e=_0x4cd864;return getUser(_0x551953,_0x699cf6[_0x39ee('0x5e')],_0x58cb9e);})[_0x39ee('0x29')](function(_0x561c67){_0x45b58c=_0x561c67;return getEndUser(_0x551953,_0xa86a27,_0x59cbff[_0x39ee('0x70')],_0x59cbff['destcalleridnum'],_0x58cb9e);})['then'](function(_0x2a2a62){_0x2387ee=_0x2a2a62;return getTicket(_0x551953,_0x45b58c,_0x2387ee,_0xa86a27,_0x59cbff,_0xa86a27[_0x39ee('0x60')],_0x58cb9e,_0x39ee('0x6a'));})[_0x39ee('0x29')](function(_0x8e4888){_0x36a147=_0x8e4888;logger[_0x39ee('0x24')](_0x39ee('0x71'),_0x36a147['id']);logger['info'](_0x39ee('0x72'),_0x36a147['id'],_0x699cf6[_0x39ee('0x4f')],_0x551953['type']);switch(_0x551953['type']){case _0x39ee('0x73'):emit(util[_0x39ee('0x41')](_0x39ee('0x62'),_0x699cf6['name']),_0x39ee('0x63'),{'recordId':_0x36a147['id']});break;case'newTab':emit(util[_0x39ee('0x41')](_0x39ee('0x62'),_0x699cf6[_0x39ee('0x4f')]),_0x39ee('0x65'),{'uri':util[_0x39ee('0x41')](_0x39ee('0x74'),_0x58cb9e[_0x39ee('0x66')],_0x36a147['id'])});break;default:logger[_0x39ee('0x67')](_0x39ee('0x6d'),_0x39ee('0x75'));}})[_0x39ee('0x69')](function(_0x25c303){logger[_0x39ee('0x67')](_0x39ee('0x6d'),_0x25c303);});};exports[_0x39ee('0x76')]=function(_0x1d1ddf,_0x43f4ad,_0x3335ab,_0xddce46,_0x4ad588,_0x3ef9bb){var _0x2418c0,_0x46c557,_0x31903b,_0x4fa6e0;_0x3ef9bb[_0x39ee('0x58')]=intUtil[_0x39ee('0x59')](_0x3ef9bb['serverUrl']);_0x3ef9bb[_0x39ee('0x53')]=intUtil[_0x39ee('0x59')](_0x3ef9bb['remoteUri']);if(_0x4ad588&&_0x4ad588[_0x39ee('0x5a')]){logger[_0x39ee('0x24')]('['+_0x43f4ad[_0x39ee('0x77')][_0x39ee('0x78')]()+']',_0x39ee('0x6e'));_0x43f4ad['recordingURL']=util[_0x39ee('0x41')](_0x39ee('0x5c'),_0x3ef9bb[_0x39ee('0x58')],_0x43f4ad['uniqueid'],md5(_0x43f4ad['uniqueid']));}else{_0x43f4ad['recordingURL']='';}return getConnection(_0x3ef9bb)[_0x39ee('0x29')](function(_0x56bb78){_0x4fa6e0=_0x56bb78;if(!_[_0x39ee('0x79')](_0xddce46)){return getUser(_0x3ef9bb,_0xddce46['name'],_0x4fa6e0);}else{return getUser(_0x3ef9bb,null,_0x4fa6e0);}})[_0x39ee('0x29')](function(_0x4643a5){_0x2418c0=_0x4643a5;return getEndUser(_0x3ef9bb,_0x3335ab,_0x43f4ad['calleridname'],_0x43f4ad['calleridnum'],_0x4fa6e0);})[_0x39ee('0x29')](function(_0x249c24){_0x46c557=_0x249c24;return getTicket(_0x3ef9bb,_0x2418c0,_0x46c557,_0x3335ab,_0x43f4ad,_0x3335ab[_0x39ee('0x60')],_0x4fa6e0);})[_0x39ee('0x29')](function(_0x545b70){_0x31903b=_0x545b70;logger[_0x39ee('0x24')]('['+_0x43f4ad['lastevent'][_0x39ee('0x78')]()+']\x20Ticket\x20%s\x20created.',_0x31903b['id']);logger['info']('['+_0x43f4ad[_0x39ee('0x77')][_0x39ee('0x78')]()+_0x39ee('0x7a'),_0x3ef9bb[_0x39ee('0x39')]);})['catch'](function(_0x156eea){logger[_0x39ee('0x67')]('['+_0x43f4ad[_0x39ee('0x77')]['toUpperCase']()+']',_0x156eea);});}; \ No newline at end of file +var _0xd88d=['./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','contact','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','validateEmail','sobject','User','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','find','execute','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','first','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xd88d,0x1ed));var _0xdd88=function(_0x21eb18,_0x3e1813){_0x21eb18=_0x21eb18-0x0;var _0x3d4666=_0xd88d[_0x21eb18];return _0x3d4666;};'use strict';var _=require(_0xdd88('0x0'));var rp=require(_0xdd88('0x1'));var moment=require('moment');var BPromise=require(_0xdd88('0x2'));var md5=require(_0xdd88('0x3'));var jsforce=require(_0xdd88('0x4'));var util=require(_0xdd88('0x5'));var Redis=require(_0xdd88('0x6'));var intUtil=require(_0xdd88('0x7'));var config=require(_0xdd88('0x8'));var logger=require(_0xdd88('0x9'))('salesforce');config['redis']=_[_0xdd88('0xa')](config[_0xdd88('0xb')],{'host':_0xdd88('0xc'),'port':0x18eb});var io=require(_0xdd88('0xd'))(new Redis(config[_0xdd88('0xb')]));function emit(_0x2d7e37,_0x51feb8,_0x35a639){io['to'](_0x2d7e37)['emit'](_0x51feb8,_0x35a639);}function getTicket(_0x14c3bc,_0x271a90,_0x1d65ae,_0x1d100a,_0x1ae405,_0x4673b8,_0x20be7e,_0x5682c0){var _0x5078bd=Object[_0xdd88('0xe')]({},{'OwnerId':_0x271a90['id'],'Subject':intUtil[_0xdd88('0xf')](_0x1d100a['Subjects'],_0x1ae405,'\x20'),'Description':intUtil[_0xdd88('0xf')](_0x1d100a[_0xdd88('0x10')],_0x1ae405,'\x0a')},getCustomFields(_0x4673b8,_0x1ae405));if(_0x1d65ae){if(_0x1d100a[_0xdd88('0x11')]===_0xdd88('0x12')){_0x5078bd[_0xdd88('0x13')]=moment[_0xdd88('0x14')]();_0x5078bd[_0xdd88('0x15')]=![];_0x5078bd[_0xdd88('0x16')]=![];if(_0x1d65ae[_0xdd88('0x17')]==='contact'||_0x1d65ae[_0xdd88('0x17')]===_0xdd88('0x18')){_0x5078bd[_0xdd88('0x19')]=_0x1d65ae['id'];}else if(_0x1d65ae['endUserType']===_0xdd88('0x1a')){_0x5078bd['WhatId']=_0x1d65ae['id'];}}else if(_0x1d100a[_0xdd88('0x11')]==='Case'){if(_0x1d65ae[_0xdd88('0x17')]===_0xdd88('0x1b')){_0x5078bd['ContactId']=_0x1d65ae['id'];}else if(_0x1d65ae[_0xdd88('0x17')]===_0xdd88('0x1a')){_0x5078bd[_0xdd88('0x1c')]=_0x1d65ae['id'];}else if(_0x1d65ae[_0xdd88('0x17')]==='lead'&&_0x1d100a[_0xdd88('0x1d')]){_0x5078bd[_0x1d100a[_0xdd88('0x1d')]]=_0x1d65ae['id'];}else{logger['info'](_0xdd88('0x1e'));}}}return _0x20be7e['sobject'](_0x1d100a[_0xdd88('0x11')])['create'](_0x5078bd);}function getUser(_0x180ae9,_0x3e9dd7,_0x695ad2){if(!_[_0xdd88('0x1f')](_0x3e9dd7)&&intUtil[_0xdd88('0x20')](_0x3e9dd7)){var _0x3ee60c={'Email':_0x3e9dd7};var _0x597026={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x695ad2[_0xdd88('0x21')](_0xdd88('0x22'))['find'](_0x3ee60c,_0x597026)['execute']()['then'](function(_0x4e8054){if(_0x4e8054['length']){var _0x45a35d=_['find'](_0x4e8054,function(_0x1785cc){return _0x1785cc['Email']===_0x3e9dd7;});if(_0x45a35d){logger[_0xdd88('0x23')](_0xdd88('0x24'),_0x3e9dd7);return BPromise[_0xdd88('0x25')]({'id':_0x45a35d['Id'],'name':_0x45a35d[_0xdd88('0x26')]});}}else{logger[_0xdd88('0x23')](_0xdd88('0x27'),_0x3e9dd7);return _0x695ad2[_0xdd88('0x28')]()[_0xdd88('0x29')](function(_0x52fd5d){return BPromise[_0xdd88('0x25')]({'id':_0x52fd5d[_0xdd88('0x2a')],'name':_0x52fd5d['display_name']});});}});}else{logger[_0xdd88('0x23')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3e9dd7);return _0x695ad2[_0xdd88('0x28')]()['then'](function(_0x5d45dc){return BPromise['resolve']({'id':_0x5d45dc[_0xdd88('0x2a')],'name':_0x5d45dc[_0xdd88('0x2b')]});});}}function getEndUser(_0x1db458,_0xc60711,_0x39da4d,_0x24c0bb,_0x4eaea0){var _0x49c49c={'$or':{'Phone':_0x24c0bb}};var _0x17c01a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdd88('0x25')]()[_0xdd88('0x29')](function(){logger[_0xdd88('0x23')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x24c0bb,_0xc60711[_0xdd88('0x2c')]);switch(_0xc60711['moduleSearch']){case'contact_lead':var _0x23c74d=_[_0xdd88('0x2d')](_0x49c49c);if(_0xc60711[_0xdd88('0x2e')]){var _0x28a254={};_0x28a254[_0xc60711[_0xdd88('0x2e')]]=_0x24c0bb;_[_0xdd88('0x2f')](_0x23c74d[_0xdd88('0x30')],_0x28a254);}return _0x4eaea0[_0xdd88('0x21')](_0xdd88('0x31'))[_0xdd88('0x32')](_0x23c74d,_0x17c01a)[_0xdd88('0x33')]()[_0xdd88('0x29')](function(_0x24aa01){if(_0x24aa01&&_0x24aa01[_0xdd88('0x34')]){return _0x24aa01;}else{var _0x5eb643=_['cloneDeep'](_0x49c49c);if(_0xc60711['additionalSearchLead']){var _0x4b2ec1={};_0x4b2ec1[_0xc60711[_0xdd88('0x35')]]=_0x24c0bb;_[_0xdd88('0x2f')](_0x5eb643[_0xdd88('0x30')],_0x4b2ec1);}return _0x4eaea0[_0xdd88('0x21')]('Lead')[_0xdd88('0x32')](_0x5eb643,_0x17c01a);}});case _0xdd88('0x36'):var _0x53c5db=_[_0xdd88('0x2d')](_0x49c49c);if(_0xc60711['additionalSearchAccount']){var _0x28a254={};_0x28a254[_0xc60711[_0xdd88('0x37')]]=_0x24c0bb;_[_0xdd88('0x2f')](_0x53c5db['$or'],_0x28a254);}return _0x4eaea0[_0xdd88('0x21')](_0xdd88('0x38'))[_0xdd88('0x32')](_0x53c5db,_0x17c01a)[_0xdd88('0x33')]()['then'](function(_0x144188){if(_0x144188&&_0x144188[_0xdd88('0x34')]){return _0x144188;}else{var _0x341ac6=_[_0xdd88('0x2d')](_0x49c49c);if(_0xc60711['additionalSearchContact']){var _0x1a0fd5={};_0x1a0fd5[_0xc60711['additionalSearchContact']]=_0x24c0bb;_[_0xdd88('0x2f')](_0x341ac6[_0xdd88('0x30')],_0x1a0fd5);}return _0x4eaea0[_0xdd88('0x21')](_0xdd88('0x31'))['find'](_0x341ac6,_0x17c01a)[_0xdd88('0x29')](function(_0x2e76e0){if(_0x2e76e0&&_0x2e76e0[_0xdd88('0x34')]){return _0x2e76e0;}else{var _0x155670=_['cloneDeep'](_0x49c49c);if(_0xc60711[_0xdd88('0x35')]){var _0xe62382={};_0xe62382[_0xc60711['additionalSearchLead']]=_0x24c0bb;_[_0xdd88('0x2f')](_0x155670['$or'],_0xe62382);}return _0x4eaea0[_0xdd88('0x21')](_0xdd88('0x39'))[_0xdd88('0x32')](_0x155670,_0x17c01a);}});}});case _0xdd88('0x1b'):var _0x23c74d=_[_0xdd88('0x2d')](_0x49c49c);if(_0xc60711[_0xdd88('0x2e')]){var _0x28a254={};_0x28a254[_0xc60711[_0xdd88('0x2e')]]=_0x24c0bb;_[_0xdd88('0x2f')](_0x23c74d[_0xdd88('0x30')],_0x28a254);}return _0x4eaea0[_0xdd88('0x21')](_0xdd88('0x31'))['find'](_0x23c74d,_0x17c01a)[_0xdd88('0x33')]();case _0xdd88('0x18'):var _0x2ef4c5=_[_0xdd88('0x2d')](_0x49c49c);if(_0xc60711[_0xdd88('0x35')]){var _0x28a254={};_0x28a254[_0xc60711[_0xdd88('0x35')]]=_0x24c0bb;_[_0xdd88('0x2f')](_0x2ef4c5[_0xdd88('0x30')],_0x28a254);}return _0x4eaea0[_0xdd88('0x21')](_0xdd88('0x39'))[_0xdd88('0x32')](_0x2ef4c5,_0x17c01a);case _0xdd88('0x1a'):var _0x53c5db=_[_0xdd88('0x2d')](_0x49c49c);if(_0xc60711[_0xdd88('0x37')]){var _0x28a254={};_0x28a254[_0xc60711['additionalSearchAccount']]=_0x24c0bb;_[_0xdd88('0x2f')](_0x53c5db['$or'],_0x28a254);}return _0x4eaea0[_0xdd88('0x21')]('Account')[_0xdd88('0x32')](_0x53c5db,_0x17c01a);default:return null;}})[_0xdd88('0x29')](function(_0x52a1c8){if(_0x52a1c8&&_0x52a1c8['length']){var _0x2fe387=_[_0xdd88('0x3a')](_0x52a1c8);if(_0x2fe387){return BPromise[_0xdd88('0x25')]({'id':_0x2fe387['Id'],'name':_0x2fe387[_0xdd88('0x26')],'phone':_0x2fe387['Phone'],'endUserType':_0x2fe387['attributes']['type'][_0xdd88('0x3b')]()});}}})[_0xdd88('0x29')](function(_0x4fdcfc){if(_0x4fdcfc){logger[_0xdd88('0x23')](_0xdd88('0x3c'),_0x4fdcfc[_0xdd88('0x17')],_0x24c0bb);return BPromise[_0xdd88('0x25')](_0x4fdcfc);}else{logger[_0xdd88('0x23')](_0xdd88('0x3d'),_0x24c0bb);var _0x269f63={'Phone':_0x24c0bb};if(_0xc60711[_0xdd88('0x3e')]){if(_0xc60711['moduleCreate']===_0xdd88('0x1b')){logger['info'](_0xdd88('0x3f'),_0x24c0bb,_0xc60711['moduleCreate']);_0x269f63[_0xdd88('0x40')]=_0x39da4d!==_0xdd88('0x41')?_0x39da4d:util[_0xdd88('0x42')](_0xdd88('0x43'),_0x24c0bb);}else if(_0xc60711['moduleCreate']===_0xdd88('0x18')){logger[_0xdd88('0x23')](_0xdd88('0x3f'),_0x24c0bb,_0xc60711[_0xdd88('0x3e')]);_0x269f63[_0xdd88('0x40')]=_0x39da4d!==_0xdd88('0x41')?_0x39da4d:util[_0xdd88('0x42')](_0xdd88('0x43'),_0x24c0bb);_0x269f63[_0xdd88('0x44')]=_0xdd88('0x45');}else if(_0xc60711['moduleCreate']===_0xdd88('0x1a')){logger[_0xdd88('0x23')](_0xdd88('0x3f'),_0x24c0bb,_0xc60711[_0xdd88('0x3e')]);_0x269f63[_0xdd88('0x26')]=_0x39da4d!==_0xdd88('0x41')?_0x39da4d:util[_0xdd88('0x42')](_0xdd88('0x43'),_0x24c0bb);}else{return null;}}return _0x4eaea0[_0xdd88('0x21')](_[_0xdd88('0x46')](_0xc60711[_0xdd88('0x3e')]))['create'](_0x269f63)['then'](function(_0x4862d1){return BPromise[_0xdd88('0x25')]({'id':_0x4862d1['id'],'endUserType':_0xc60711[_0xdd88('0x3e')]});});}});}function getCustomFields(_0xc2283e,_0x25351a){var _0x69b05e={};if(_0xc2283e[_0xdd88('0x34')]>0x0){_[_0xdd88('0x47')](_0xc2283e,function(_0x31030a){if(_[_0xdd88('0x48')]([_0xdd88('0x49'),'picklist'],_0x31030a[_0xdd88('0x4a')])&&_0x31030a[_0xdd88('0x4b')]){_0x69b05e[_0x31030a[_0xdd88('0x4b')]]=_0x31030a[_0xdd88('0x4c')][_0xdd88('0x4d')]();}else if(_0x31030a[_0xdd88('0x4a')]===_0xdd88('0x4e')&&_0x31030a[_0xdd88('0x4f')]&&_0x31030a[_0xdd88('0x4b')]){_0x25351a[_0x31030a[_0xdd88('0x4f')]]&&(_0x69b05e[_0x31030a[_0xdd88('0x4b')]]=_0x25351a[_0x31030a['variableName']][_0xdd88('0x4d')]());}else if(_0x31030a[_0xdd88('0x4a')]===_0xdd88('0x50')&&_0x31030a[_0xdd88('0x51')]&&_0x31030a['Variable'][_0xdd88('0x52')]&&_0x31030a[_0xdd88('0x4b')]){_0x25351a[_0x31030a[_0xdd88('0x51')][_0xdd88('0x52')][_0xdd88('0x3b')]()]&&(_0x69b05e[_0x31030a[_0xdd88('0x4b')]]=_0x25351a[_0x31030a[_0xdd88('0x51')][_0xdd88('0x52')][_0xdd88('0x3b')]()][_0xdd88('0x4d')]());}});}return _0x69b05e;}function getConnection(_0xcd53c2){var _0x57719e=_0xcd53c2[_0xdd88('0x53')][_0xdd88('0x54')](_0xcd53c2['securityToken']);var _0xf07066=new jsforce[(_0xdd88('0x55'))]({'oauth2':{'loginUrl':_0xcd53c2[_0xdd88('0x56')]||_0xdd88('0x57'),'clientId':_0xcd53c2[_0xdd88('0x58')],'clientSecret':_0xcd53c2[_0xdd88('0x59')]}});return _0xf07066[_0xdd88('0x5a')](_0xcd53c2[_0xdd88('0x5b')],_0x57719e)[_0xdd88('0x29')](function(){logger[_0xdd88('0x23')](_0xdd88('0x5c'));return _0xf07066;});}exports[_0xdd88('0x5d')]=function(_0x221f77,_0x578076,_0x16c7dc,_0x101c3f,_0x47e0d5,_0x13f57d){var _0x294817,_0x3115d0,_0x286c00,_0x4cb092;_0x13f57d[_0xdd88('0x5e')]=intUtil[_0xdd88('0x5f')](_0x13f57d[_0xdd88('0x5e')]);_0x13f57d[_0xdd88('0x56')]=intUtil[_0xdd88('0x5f')](_0x13f57d[_0xdd88('0x56')]);if(_0x47e0d5&&_0x47e0d5[_0xdd88('0x60')]){logger[_0xdd88('0x23')](_0xdd88('0x61'),_0xdd88('0x62'));_0x578076[_0xdd88('0x63')]=util[_0xdd88('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13f57d['serverUrl'],_0x578076['uniqueid'],md5(_0x578076[_0xdd88('0x64')]));}else{_0x578076[_0xdd88('0x63')]='';}return getConnection(_0x13f57d)['then'](function(_0x36346b){_0x4cb092=_0x36346b;return getUser(_0x13f57d,_0x101c3f[_0xdd88('0x65')],_0x4cb092);})[_0xdd88('0x29')](function(_0x57a6fc){_0x294817=_0x57a6fc;return getEndUser(_0x13f57d,_0x16c7dc,_0x578076[_0xdd88('0x66')],_0x578076[_0xdd88('0x67')],_0x4cb092);})['then'](function(_0x23b498){_0x3115d0=_0x23b498;return getTicket(_0x13f57d,_0x294817,_0x3115d0,_0x16c7dc,_0x578076,_0x16c7dc[_0xdd88('0x68')],_0x4cb092,_0xdd88('0x5d'));})[_0xdd88('0x29')](function(_0x427bf3){_0x286c00=_0x427bf3;logger[_0xdd88('0x23')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x286c00['id']);logger[_0xdd88('0x23')](_0xdd88('0x69'),_0x286c00['id'],_0x101c3f[_0xdd88('0x52')],_0x13f57d[_0xdd88('0x4a')]);switch(_0x13f57d['type']){case _0xdd88('0x6a'):emit(util[_0xdd88('0x42')](_0xdd88('0x6b'),_0x101c3f[_0xdd88('0x52')]),_0xdd88('0x6c'),{'recordId':_0x286c00['id']});break;case'newTab':emit(util[_0xdd88('0x42')](_0xdd88('0x6b'),_0x101c3f[_0xdd88('0x52')]),'trigger:browser:url',{'uri':util[_0xdd88('0x42')](_0xdd88('0x6d'),_0x4cb092[_0xdd88('0x6e')],_0x286c00['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xdd88('0x6f')](function(_0x3f4069){logger[_0xdd88('0x70')](_0xdd88('0x61'),_0x3f4069);});};exports[_0xdd88('0x71')]=function(_0x31afae,_0x26c129,_0x52791b,_0x19f07a,_0x47194e,_0x4dd246,_0x27e867){var _0x2b47c2,_0x5b50f8,_0xdadd07,_0x5121ec;_0x4dd246[_0xdd88('0x5e')]=intUtil['stripTrailingSlash'](_0x4dd246['serverUrl']);_0x4dd246[_0xdd88('0x56')]=intUtil[_0xdd88('0x5f')](_0x4dd246['remoteUri']);if(_0x27e867&&_0x27e867['recordingFormat']&&_0x27e867[_0xdd88('0x72')]!==_0xdd88('0x73')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x26c129[_0xdd88('0x63')]=util[_0xdd88('0x42')](_0xdd88('0x74'),_0x4dd246[_0xdd88('0x5e')],_0x26c129[_0xdd88('0x64')],md5(_0x26c129['uniqueid']));}return getConnection(_0x4dd246)['then'](function(_0x3b2681){_0x5121ec=_0x3b2681;return getUser(_0x4dd246,_0x19f07a[_0xdd88('0x65')],_0x5121ec);})[_0xdd88('0x29')](function(_0x157661){_0x2b47c2=_0x157661;return getEndUser(_0x4dd246,_0x52791b,_0x26c129['destcalleridname'],_0x26c129[_0xdd88('0x75')],_0x5121ec);})[_0xdd88('0x29')](function(_0x141bac){_0x5b50f8=_0x141bac;return getTicket(_0x4dd246,_0x2b47c2,_0x5b50f8,_0x52791b,_0x26c129,_0x52791b['Fields'],_0x5121ec,_0xdd88('0x71'));})[_0xdd88('0x29')](function(_0x1d3f1b){_0xdadd07=_0x1d3f1b;logger[_0xdd88('0x23')](_0xdd88('0x76'),_0xdadd07['id']);logger[_0xdd88('0x23')](_0xdd88('0x77'),_0xdadd07['id'],_0x19f07a[_0xdd88('0x52')],_0x4dd246[_0xdd88('0x4a')]);switch(_0x4dd246['type']){case'integrationTab':emit(util[_0xdd88('0x42')](_0xdd88('0x6b'),_0x19f07a[_0xdd88('0x52')]),_0xdd88('0x6c'),{'recordId':_0xdadd07['id']});break;case _0xdd88('0x78'):emit(util[_0xdd88('0x42')](_0xdd88('0x6b'),_0x19f07a[_0xdd88('0x52')]),_0xdd88('0x79'),{'uri':util['format'](_0xdd88('0x6d'),_0x5121ec[_0xdd88('0x6e')],_0xdadd07['id'])});break;default:logger[_0xdd88('0x70')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xdd88('0x6f')](function(_0x30a97e){logger[_0xdd88('0x70')]('[OUTBOUND]',_0x30a97e);});};exports['unmanaged']=function(_0x13da4b,_0x484a01,_0x2f215e,_0x367f98,_0x50b9c6,_0xcd1c26){var _0x2845f4,_0x5d623d,_0x4d9d4d,_0x32a862;_0xcd1c26[_0xdd88('0x5e')]=intUtil['stripTrailingSlash'](_0xcd1c26[_0xdd88('0x5e')]);_0xcd1c26[_0xdd88('0x56')]=intUtil['stripTrailingSlash'](_0xcd1c26['remoteUri']);if(_0x50b9c6&&_0x50b9c6['monitor_format']){logger[_0xdd88('0x23')]('['+_0x484a01[_0xdd88('0x7a')][_0xdd88('0x7b')]()+']',_0xdd88('0x62'));_0x484a01[_0xdd88('0x63')]=util[_0xdd88('0x42')](_0xdd88('0x74'),_0xcd1c26['serverUrl'],_0x484a01['uniqueid'],md5(_0x484a01[_0xdd88('0x64')]));}else{_0x484a01['recordingURL']='';}return getConnection(_0xcd1c26)[_0xdd88('0x29')](function(_0x3508f6){_0x32a862=_0x3508f6;if(!_['isNil'](_0x367f98)){return getUser(_0xcd1c26,_0x367f98[_0xdd88('0x52')],_0x32a862);}else{return getUser(_0xcd1c26,null,_0x32a862);}})[_0xdd88('0x29')](function(_0xe44b2){_0x2845f4=_0xe44b2;return getEndUser(_0xcd1c26,_0x2f215e,_0x484a01[_0xdd88('0x66')],_0x484a01['calleridnum'],_0x32a862);})[_0xdd88('0x29')](function(_0x27ea87){_0x5d623d=_0x27ea87;return getTicket(_0xcd1c26,_0x2845f4,_0x5d623d,_0x2f215e,_0x484a01,_0x2f215e[_0xdd88('0x68')],_0x32a862);})[_0xdd88('0x29')](function(_0x371d0c){_0x4d9d4d=_0x371d0c;logger[_0xdd88('0x23')]('['+_0x484a01[_0xdd88('0x7a')][_0xdd88('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x4d9d4d['id']);logger['info']('['+_0x484a01[_0xdd88('0x7a')][_0xdd88('0x7b')]()+_0xdd88('0x7c'),_0xcd1c26['type']);})[_0xdd88('0x6f')](function(_0x2660c3){logger[_0xdd88('0x70')]('['+_0x484a01[_0xdd88('0x7a')][_0xdd88('0x7b')]()+']',_0x2660c3);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 83f3f2a..c9b1408 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c16=['content','picklist','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','Subjects','getString','Descriptions','Fields','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','username','password','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','util','md5','ioredis','redis','defaults','localhost','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','error',']\x20using\x20admin\x20profile','adminEmail','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase'];(function(_0x398b85,_0x16aa5c){var _0x30cfd6=function(_0x1f6c5c){while(--_0x1f6c5c){_0x398b85['push'](_0x398b85['shift']());}};_0x30cfd6(++_0x16aa5c);}(_0x6c16,0x110));var _0x66c1=function(_0x5b8b5b,_0x1073c0){_0x5b8b5b=_0x5b8b5b-0x0;var _0x2d20b5=_0x6c16[_0x5b8b5b];return _0x2d20b5;};'use strict';var _=require(_0x66c1('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x66c1('0x1'));var md5=require(_0x66c1('0x2'));var Redis=require(_0x66c1('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0x66c1('0x4')]=_[_0x66c1('0x5')](config[_0x66c1('0x4')],{'host':_0x66c1('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x66c1('0x4')]));function getAdminUser(_0x528322,_0xd6d48,_0x41383,_0x517450,_0x3b168a,_0x233c6b){return new Promise(function(_0x2963f2,_0x4e0c66){var _0x595cb7={'method':'GET','uri':_0x517450+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3b168a+'&'+_0x233c6b,'auth':_0xd6d48,'json':!![]};return rp(_0x595cb7)[_0x66c1('0x7')](function(_0x1b2b10){if(_0x1b2b10[_0x66c1('0x8')][_0x66c1('0x9')]>0x0){_0x41383[_0x66c1('0xa')]=_0x1b2b10['result'][0x0][_0x66c1('0xb')];}logger[_0x66c1('0xc')]('['+[_0x528322[_0x66c1('0xd')]()]+_0x66c1('0xe'),_0x41383);_0x2963f2(_0x41383);})[_0x66c1('0xf')](function(_0x3b92ce){logger['error']('['+[_0x528322[_0x66c1('0xd')]()]+']',_0x3b92ce[_0x66c1('0x10')]);_0x4e0c66(_0x3b92ce['message']);});});}function getUser(_0x2eeb3e,_0x2e539f,_0x15eb2b,_0x5f061c,_0x185660){return function(_0x1230b9){logger['info']('['+[_0x2eeb3e[_0x66c1('0xd')]()]+_0x66c1('0x11'),_0x1230b9);return new Promise(function(_0x5cf8e5,_0x2c6ef4){if(intUtil['validateEmail'](_0x1230b9[_0x66c1('0x12')])){var _0x379f35={'method':_0x66c1('0x13'),'uri':_0x15eb2b+_0x66c1('0x14')+_0x1230b9['userEmail']+'&'+_0x5f061c+'&'+_0x185660,'auth':_0x2e539f,'json':!![]};logger[_0x66c1('0xc')]('['+[_0x2eeb3e[_0x66c1('0xd')]()]+_0x66c1('0x15'),_0x379f35);return rp(_0x379f35)[_0x66c1('0x7')](function(_0x5d155e){logger[_0x66c1('0xc')]('['+[_0x2eeb3e['toUpperCase']()]+_0x66c1('0x16'),_0x5d155e);if(_0x5d155e[_0x66c1('0x8')][_0x66c1('0x9')]>0x0&&String(_0x5d155e[_0x66c1('0x8')][0x0][_0x66c1('0x17')])===_0x66c1('0x18')){_0x1230b9[_0x66c1('0x19')]=_0x5d155e['result'][0x0][_0x66c1('0xb')];}else{_0x1230b9[_0x66c1('0x19')]=_0x1230b9[_0x66c1('0xa')];_0x1230b9[_0x66c1('0x12')]=_0x1230b9['adminEmail'];}logger[_0x66c1('0xc')]('['+[_0x2eeb3e[_0x66c1('0xd')]()]+'],\x20getUser\x20crm',_0x1230b9);_0x5cf8e5(_0x1230b9);})['catch'](function(_0x95a3da){logger[_0x66c1('0x1a')]('['+[_0x2eeb3e['toUpperCase']()]+']',_0x95a3da['message']);_0x2c6ef4(_0x95a3da[_0x66c1('0x10')]);});}else{logger[_0x66c1('0xc')]('['+[_0x2eeb3e[_0x66c1('0xd')]()]+_0x66c1('0x1b'));_0x1230b9[_0x66c1('0x19')]=_0x1230b9[_0x66c1('0xa')];_0x1230b9['userEmail']=_0x1230b9[_0x66c1('0x1c')];_0x5cf8e5(_0x1230b9);}});};}function createEndUser(_0x402a69,_0x444d72,_0x2e75fe,_0x28d45b,_0xea15cc){logger[_0x66c1('0xc')]('['+[_0x402a69['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x2e75fe);return new Promise(function(_0x45a8ae,_0x2efc30){var _0xd121ce={'method':'POST','uri':_0x28d45b+_0x66c1('0x1d')+_0xea15cc,'body':{'user_name':_0x2e75fe[_0x66c1('0x1e')],'roles':_0x66c1('0x1f'),'first_name':_0x2e75fe[_0x66c1('0x1e')],'active':'true','date_format':_0x66c1('0x20'),'phone':_0x2e75fe['endUserNumber']},'auth':_0x444d72,'json':!![]};return rp(_0xd121ce)['then'](function(_0x2a67e9){logger[_0x66c1('0xc')]('['+[_0x402a69['toUpperCase']()]+_0x66c1('0x21'),_0x2a67e9[_0x66c1('0x8')]);_0x2e75fe[_0x66c1('0x22')]=_0x2a67e9[_0x66c1('0x8')]['sys_id'];_0x45a8ae(_0x2e75fe);})[_0x66c1('0xf')](function(_0x98c57b){logger[_0x66c1('0x1a')]('['+[_0x402a69['toUpperCase']()]+']',_0x98c57b[_0x66c1('0x10')]);_0x2efc30(_0x98c57b[_0x66c1('0x10')]);});});}function getEndUser(_0x5c6b13,_0x172518,_0x2091c9,_0x25fc9b,_0x4455af){return function(_0x5d60f8){logger[_0x66c1('0xc')]('['+[_0x5c6b13[_0x66c1('0xd')]()]+_0x66c1('0x23'),_0x5d60f8);return new Promise(function(_0x461ad6,_0x396cb3){var _0x3eaebd={'method':_0x66c1('0x13'),'uri':_0x2091c9+_0x66c1('0x24')+_0x5d60f8[_0x66c1('0x1e')]+'&'+_0x25fc9b+'&'+_0x4455af,'auth':_0x172518,'json':!![]};return rp(_0x3eaebd)[_0x66c1('0x7')](function(_0x2ed18b){if(_0x2ed18b[_0x66c1('0x8')][_0x66c1('0x9')]>0x0){_0x5d60f8[_0x66c1('0x22')]=_0x2ed18b[_0x66c1('0x8')][0x0]['sys_id'];logger[_0x66c1('0xc')]('['+[_0x5c6b13[_0x66c1('0xd')]()]+_0x66c1('0x25'),_0x5d60f8);_0x461ad6(_0x5d60f8);}else{return createEndUser(_0x5c6b13,_0x172518,_0x5d60f8,_0x2091c9,_0x25fc9b)['then'](function(_0x7bd6c1){logger[_0x66c1('0xc')]('['+[_0x5c6b13[_0x66c1('0xd')]()]+_0x66c1('0x26'),_0x7bd6c1);_0x461ad6(_0x7bd6c1);});}})[_0x66c1('0xf')](function(_0x523031){logger[_0x66c1('0x1a')]('['+[_0x5c6b13[_0x66c1('0xd')]()]+']',_0x523031['message']);_0x396cb3(_0x523031[_0x66c1('0x10')]);});});};}function getCustomFields(_0x3e42c8,_0x38a1a6){var _0x3d99de={};if(_0x3e42c8[_0x66c1('0x9')]>0x0){_[_0x66c1('0x27')](_0x3e42c8,function(_0x1a72f3){if(_[_0x66c1('0x28')]([_0x66c1('0x29'),'picklist'],_0x1a72f3[_0x66c1('0x2a')])&&_0x1a72f3[_0x66c1('0x2b')]&&!_0x1a72f3[_0x66c1('0x2c')]){_0x3d99de[_0x1a72f3[_0x66c1('0x2b')][_0x66c1('0x2d')]()]=_0x1a72f3[_0x66c1('0x2e')]['toString']();}else if(_[_0x66c1('0x28')]([_0x66c1('0x29'),_0x66c1('0x2f')],_0x1a72f3[_0x66c1('0x2a')])&&_0x1a72f3[_0x66c1('0x30')]&&_0x1a72f3[_0x66c1('0x2c')]){_0x3d99de[_0x1a72f3[_0x66c1('0x30')][_0x66c1('0x2d')]()]=_0x1a72f3[_0x66c1('0x2e')][_0x66c1('0x31')]();}else if(_0x1a72f3[_0x66c1('0x2a')]===_0x66c1('0x32')&&_0x1a72f3[_0x66c1('0x33')]&&_0x1a72f3[_0x66c1('0x30')]&&_0x1a72f3[_0x66c1('0x2c')]){_0x3d99de[_0x1a72f3[_0x66c1('0x30')]['toLowerCase']()]=_0x38a1a6[_0x1a72f3[_0x66c1('0x33')]][_0x66c1('0x31')]();}else if(_0x1a72f3[_0x66c1('0x2a')]===_0x66c1('0x34')&&_0x1a72f3['Variable']&&_0x1a72f3[_0x66c1('0x35')][_0x66c1('0x36')]&&_0x1a72f3[_0x66c1('0x30')]&&_0x1a72f3[_0x66c1('0x2c')]){_0x3d99de[_0x1a72f3[_0x66c1('0x30')][_0x66c1('0x2d')]()]=_0x38a1a6[_0x1a72f3[_0x66c1('0x35')][_0x66c1('0x36')][_0x66c1('0x2d')]()][_0x66c1('0x31')]();}});}return _0x3d99de;}function getTicket(_0x438b70,_0x4b607a,_0x5d5f89,_0x174ac4,_0x21a08f,_0x14afda){return function(_0x2a9888){logger[_0x66c1('0xc')]('['+[_0x438b70[_0x66c1('0xd')]()]+_0x66c1('0x37'),_0x2a9888);return new Promise(function(_0x32ac84,_0x106496){var _0x5afb6f=_0x438b70[_0x66c1('0x2d')]()===_0x66c1('0x38')?_0x2a9888[_0x66c1('0x19')]:_0x2a9888[_0x66c1('0x22')];var _0x350028={'method':'POST','uri':_0x5d5f89+'incident'+'?'+_0x14afda,'body':Object[_0x66c1('0x39')]({},{'active':'true','caller_id':_0x5afb6f,'assigned_to':_0x2a9888[_0x66c1('0x19')],'short_description':intUtil['getString'](_0x174ac4[_0x66c1('0x3a')],_0x21a08f,'\x20'),'description':intUtil[_0x66c1('0x3b')](_0x174ac4[_0x66c1('0x3c')],_0x21a08f,'\x0a')},getCustomFields(_0x174ac4[_0x66c1('0x3d')],_0x21a08f)),'auth':_0x4b607a,'json':!![]};return rp(_0x350028)[_0x66c1('0x7')](function(_0x45fd68){logger[_0x66c1('0xc')]('['+[_0x438b70['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x45fd68['result']);_0x2a9888[_0x66c1('0x3e')]=_0x45fd68[_0x66c1('0x8')][_0x66c1('0xb')];_0x2a9888['ticketNumber']=_0x45fd68['result'][_0x66c1('0x3f')];logger['info']('['+[_0x438b70[_0x66c1('0xd')]()]+_0x66c1('0x40'),_0x2a9888);_0x32ac84(_0x2a9888);})['catch'](function(_0x5ae053){logger[_0x66c1('0x1a')]('['+[_0x438b70['toUpperCase']()]+']',_0x5ae053[_0x66c1('0x10')]);_0x106496(_0x5ae053[_0x66c1('0x10')]);});});};}function createRemoteTag(_0x4e9149,_0x14e5a1,_0x58177d,_0x48bf99){return new Promise(function(_0x2abece,_0xb7cefb){var _0x59ad01={'method':'POST','uri':_0x58177d+_0x66c1('0x41')+'?'+_0x48bf99,'body':{'short_description':_0x4e9149,'global':!![],'active':!![],'name':_0x4e9149},'auth':_0x14e5a1,'json':!![]};return rp(_0x59ad01)[_0x66c1('0x7')](function(_0x29605a){var _0x19e057=_0x29605a[_0x66c1('0x8')][_0x66c1('0xb')];_0x2abece(_0x19e057);});});}function getRemoteTag(_0x39207b,_0x371340,_0x28241e,_0x466176,_0x3510fa){return new Promise(function(_0x531c52,_0x17716a){var _0x5f7c71={'method':'GET','uri':_0x28241e+'label'+_0x66c1('0x42')+_0x39207b+'&'+_0x466176,'auth':_0x371340,'json':!![]};return rp(_0x5f7c71)['then'](function(_0x1910ab){if(_0x1910ab[_0x66c1('0x8')][_0x66c1('0x9')]>0x0){var _0x3aac26=_0x1910ab[_0x66c1('0x8')][0x0][_0x66c1('0xb')];_0x531c52(_0x3aac26);}else{return createRemoteTag(_0x39207b,_0x371340,_0x28241e,_0x466176)[_0x66c1('0x7')](function(_0x2d2729){_0x531c52(_0x2d2729);});}});});}function assignTagToIncident(_0x3dd7c4,_0x217d56,_0x4aa39b,_0x11087b,_0x56809d){return new Promise(function(_0x2fc0cb,_0x52e4f7){var _0x503226={'method':'POST','uri':_0x4aa39b+_0x66c1('0x43')+'?'+_0x56809d,'body':{'label':_0x3dd7c4,'table':'incident','id_type':_0x66c1('0x44'),'table_key':_0x11087b[_0x66c1('0x3e')],'title':_0x66c1('0x45')+_0x11087b['ticketNumber'],'id_display':_0x11087b['ticketNumber']},'auth':_0x217d56,'json':!![]};return rp(_0x503226)['then'](function(_0x2baf6d){_0x2fc0cb();})[_0x66c1('0xf')](function(){_0x2fc0cb();});});}function manageTags(_0x428340,_0x24d1c1,_0x38756e,_0x4b99c9,_0x2a54ca,_0x53b067,_0x3807c5){return new Promise(function(_0x51650a,_0x5dcf1a){var _0x4c3270=[];_0x24d1c1['forEach'](function(_0x1588df){_0x4c3270[_0x66c1('0x46')](getRemoteTag(_0x1588df,_0x38756e,_0x4b99c9,_0x53b067,_0x3807c5));});return Promise['all'](_0x4c3270)[_0x66c1('0x7')](function(_0x3b7a19){if(_0x3b7a19[_0x66c1('0x9')]){logger[_0x66c1('0xc')]('['+[_0x428340[_0x66c1('0xd')]()]+_0x66c1('0x47'),_0x3b7a19);var _0x4706db=[];_0x3b7a19['forEach'](function(_0x2a708a){_0x4706db[_0x66c1('0x46')](assignTagToIncident(_0x2a708a,_0x38756e,_0x4b99c9,_0x2a54ca,_0x53b067));});return Promise[_0x66c1('0x48')](_0x4706db)[_0x66c1('0x7')](function(){_0x51650a();})[_0x66c1('0xf')](function(){_0x51650a();});}else{_0x51650a();}});});}function getTags(_0x325a88,_0x45c538,_0x1cfa2c,_0x162c6a,_0x1602e7,_0x4a52bd){return function(_0x430c21){return new Promise(function(_0x21236f,_0x5de8c0){var _0x4ce23b=[];var _0x21af00=_0x162c6a['Tags'];if(_0x21af00&&_0x21af00[_0x66c1('0x9')]>0x0){_0x4ce23b=_[_0x66c1('0x49')](_0x21af00,'name');}if(_0x4ce23b[_0x66c1('0x9')]>0x0){return manageTags(_0x325a88,_0x4ce23b,_0x45c538,_0x1cfa2c,_0x430c21,_0x1602e7,_0x4a52bd)[_0x66c1('0x7')](function(){_0x21236f(_0x430c21);});}else{_0x21236f(_0x430c21);}});};}function emit(_0x1650f4,_0x1a7529,_0x69f4b5){var _0x3a414c=_0x66c1('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x66c1('0x4b')+_0x66c1('0x4c');var _0xa9b707={'uri':_0x1650f4+_0x66c1('0x4d')+_0x69f4b5+_0x3a414c};io['to'](util['format']('user:%s',_0x1a7529))[_0x66c1('0x4e')](_0x66c1('0x4f'),_0xa9b707);}exports['cs']=function(_0x319a87,_0x32886b,_0x1327d9,_0x43759e,_0x21a859,_0x60c4e2,_0x35b0a4,_0x142d09){var _0x1effde={};var _0x8c92af={'user':_0x60c4e2[_0x66c1('0x50')],'pass':_0x60c4e2[_0x66c1('0x51')]};var _0x7a1ea0='sysparm_limit=1';var _0x33e095=_0x66c1('0x52');_0x60c4e2['remoteUri']=intUtil[_0x66c1('0x53')](_0x60c4e2[_0x66c1('0x54')]);_0x60c4e2[_0x66c1('0x55')]=intUtil[_0x66c1('0x53')](_0x60c4e2[_0x66c1('0x55')]);var _0x2f240d=util[_0x66c1('0x56')](_0x66c1('0x57'),_0x60c4e2[_0x66c1('0x54')]);_0x1effde['userEmail']=!_[_0x66c1('0x58')](_0x43759e)?_0x43759e[_0x66c1('0x59')]:null;_0x1effde[_0x66c1('0x1c')]=_0x60c4e2['email'];_0x1effde[_0x66c1('0x1e')]=_0x142d09[_0x66c1('0x2d')]()==='outbound'?_0x32886b[_0x66c1('0x5a')]:_0x32886b[_0x66c1('0x5b')];_0x1effde['callDirection']=_0x142d09===_0x66c1('0x5c')||_0x142d09===_0x66c1('0x5d')?_0x66c1('0x5c'):_0x66c1('0x38');var _0x4bf90a=util['format'](_0x66c1('0x5e'),_0x60c4e2['serverUrl'],_0x32886b[_0x66c1('0x5f')],md5(_0x32886b[_0x66c1('0x5f')]));if(_0x21a859&&_0x21a859[_0x66c1('0x60')]){logger['info'](_0x66c1('0x61'),'Recording\x20is\x20enabled!');_0x32886b[_0x66c1('0x62')]=_0x4bf90a;}else if(_0x35b0a4&&_0x35b0a4[_0x66c1('0x63')]&&_0x35b0a4['recordingFormat']!==_0x66c1('0x64')){logger[_0x66c1('0xc')](_0x66c1('0x65'),'Recording\x20is\x20enabled!');_0x32886b['recordingURL']=_0x4bf90a;}else{_0x32886b[_0x66c1('0x62')]='';}return getAdminUser(_0x142d09,_0x8c92af,_0x1effde,_0x2f240d,_0x33e095,_0x7a1ea0)[_0x66c1('0x7')](getUser(_0x142d09,_0x8c92af,_0x2f240d,_0x33e095,_0x7a1ea0))[_0x66c1('0x7')](getEndUser(_0x142d09,_0x8c92af,_0x2f240d,_0x33e095,_0x7a1ea0))['then'](getTicket(_0x142d09,_0x8c92af,_0x2f240d,_0x1327d9,_0x32886b,_0x33e095))[_0x66c1('0x7')](function(_0x327ca6){logger[_0x66c1('0xc')](util[_0x66c1('0x56')](_0x66c1('0x66'),_0x327ca6[_0x66c1('0x3e')]));logger[_0x66c1('0xc')](util['format'](_0x66c1('0x67'),_0x142d09));if(_0x142d09!==_0x66c1('0x5d')){logger[_0x66c1('0xc')]('['+[_0x142d09[_0x66c1('0xd')]()]+']',_0x66c1('0x68'));emit(_0x60c4e2[_0x66c1('0x54')],_0x43759e['name'],_0x327ca6[_0x66c1('0x3e')]);}})['catch'](function(_0x48859d){logger[_0x66c1('0x1a')]('['+[_0x142d09['toUpperCase']()]+_0x66c1('0x69'),util['inspect'](_0x48859d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xee0c=['util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminId','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','string','picklist','type','customField','nameField','toLowerCase','content','includes','idField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','email','outbound','destcalleridnum','calleridnum','queue','format','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise'];(function(_0x540850,_0x173416){var _0x57be6d=function(_0x5f1fa7){while(--_0x5f1fa7){_0x540850['push'](_0x540850['shift']());}};_0x57be6d(++_0x173416);}(_0xee0c,0x13f));var _0xcee0=function(_0x27c8ca,_0x436c96){_0x27c8ca=_0x27c8ca-0x0;var _0x5212c3=_0xee0c[_0x27c8ca];return _0x5212c3;};'use strict';var _=require(_0xcee0('0x0'));var Promise=require('bluebird');var rp=require(_0xcee0('0x1'));var util=require(_0xcee0('0x2'));var md5=require(_0xcee0('0x3'));var Redis=require('ioredis');var intUtil=require(_0xcee0('0x4'));var config=require(_0xcee0('0x5'));var logger=require(_0xcee0('0x6'))(_0xcee0('0x7'));config[_0xcee0('0x8')]=_[_0xcee0('0x9')](config['redis'],{'host':_0xcee0('0xa'),'port':0x18eb});var io=require(_0xcee0('0xb'))(new Redis(config[_0xcee0('0x8')]));function getAdminUser(_0x1a43a,_0x17b644,_0x15c9e6,_0x1c6586,_0x2d2c7a,_0x2ba97a){return new Promise(function(_0x1c6b79,_0x49e7cd){var _0x2abbea={'method':'GET','uri':_0x1c6586+_0xcee0('0xc')+'&'+_0x2d2c7a+'&'+_0x2ba97a,'auth':_0x17b644,'json':!![]};return rp(_0x2abbea)[_0xcee0('0xd')](function(_0x49c907){if(_0x49c907[_0xcee0('0xe')][_0xcee0('0xf')]>0x0){_0x15c9e6['adminId']=_0x49c907['result'][0x0][_0xcee0('0x10')];}logger[_0xcee0('0x11')]('['+[_0x1a43a[_0xcee0('0x12')]()]+_0xcee0('0x13'),_0x15c9e6);_0x1c6b79(_0x15c9e6);})['catch'](function(_0x2d2186){logger[_0xcee0('0x14')]('['+[_0x1a43a[_0xcee0('0x12')]()]+']',_0x2d2186[_0xcee0('0x15')]);_0x49e7cd(_0x2d2186['message']);});});}function getUser(_0x1f5f7a,_0x8863e8,_0x331677,_0x1184b6,_0x20109a){return function(_0x44e9b5){logger[_0xcee0('0x11')]('['+[_0x1f5f7a[_0xcee0('0x12')]()]+_0xcee0('0x16'),_0x44e9b5);return new Promise(function(_0x265ebe,_0xbf9e5){if(intUtil[_0xcee0('0x17')](_0x44e9b5[_0xcee0('0x18')])){var _0x9f61e3={'method':_0xcee0('0x19'),'uri':_0x331677+'sys_user?sysparm_query=email%3D'+_0x44e9b5[_0xcee0('0x18')]+'&'+_0x1184b6+'&'+_0x20109a,'auth':_0x8863e8,'json':!![]};logger['info']('['+[_0x1f5f7a[_0xcee0('0x12')]()]+_0xcee0('0x1a'),_0x9f61e3);return rp(_0x9f61e3)[_0xcee0('0xd')](function(_0x17d8ef){logger[_0xcee0('0x11')]('['+[_0x1f5f7a[_0xcee0('0x12')]()]+'],\x20getUser\x20entity',_0x17d8ef);if(_0x17d8ef[_0xcee0('0xe')][_0xcee0('0xf')]>0x0&&String(_0x17d8ef[_0xcee0('0xe')][0x0][_0xcee0('0x1b')])===_0xcee0('0x1c')){_0x44e9b5[_0xcee0('0x1d')]=_0x17d8ef[_0xcee0('0xe')][0x0][_0xcee0('0x10')];}else{_0x44e9b5[_0xcee0('0x1d')]=_0x44e9b5['adminId'];_0x44e9b5[_0xcee0('0x18')]=_0x44e9b5[_0xcee0('0x1e')];}logger['info']('['+[_0x1f5f7a[_0xcee0('0x12')]()]+_0xcee0('0x1f'),_0x44e9b5);_0x265ebe(_0x44e9b5);})[_0xcee0('0x20')](function(_0x52dee9){logger[_0xcee0('0x14')]('['+[_0x1f5f7a[_0xcee0('0x12')]()]+']',_0x52dee9[_0xcee0('0x15')]);_0xbf9e5(_0x52dee9[_0xcee0('0x15')]);});}else{logger[_0xcee0('0x11')]('['+[_0x1f5f7a[_0xcee0('0x12')]()]+_0xcee0('0x21'));_0x44e9b5['userId']=_0x44e9b5[_0xcee0('0x22')];_0x44e9b5['userEmail']=_0x44e9b5['adminEmail'];_0x265ebe(_0x44e9b5);}});};}function createEndUser(_0x28f4cc,_0x57d0b4,_0x4734ed,_0xa1358e,_0x83dbbc){logger[_0xcee0('0x11')]('['+[_0x28f4cc['toUpperCase']()]+_0xcee0('0x23'),_0x4734ed);return new Promise(function(_0x8b64b3,_0x38a09d){var _0x2f146a={'method':_0xcee0('0x24'),'uri':_0xa1358e+_0xcee0('0x25')+_0x83dbbc,'body':{'user_name':_0x4734ed[_0xcee0('0x26')],'roles':'user','first_name':_0x4734ed[_0xcee0('0x26')],'active':'true','date_format':_0xcee0('0x27'),'phone':_0x4734ed[_0xcee0('0x26')]},'auth':_0x57d0b4,'json':!![]};return rp(_0x2f146a)[_0xcee0('0xd')](function(_0x136d44){logger[_0xcee0('0x11')]('['+[_0x28f4cc[_0xcee0('0x12')]()]+_0xcee0('0x28'),_0x136d44[_0xcee0('0xe')]);_0x4734ed[_0xcee0('0x29')]=_0x136d44[_0xcee0('0xe')][_0xcee0('0x10')];_0x8b64b3(_0x4734ed);})[_0xcee0('0x20')](function(_0x4df828){logger[_0xcee0('0x14')]('['+[_0x28f4cc[_0xcee0('0x12')]()]+']',_0x4df828[_0xcee0('0x15')]);_0x38a09d(_0x4df828[_0xcee0('0x15')]);});});}function getEndUser(_0x3d3538,_0x205691,_0x424de9,_0x2914c6,_0x35bc06){return function(_0x4005bd){logger['info']('['+[_0x3d3538['toUpperCase']()]+_0xcee0('0x2a'),_0x4005bd);return new Promise(function(_0x1132a7,_0x41bc0e){var _0x2e73d9={'method':_0xcee0('0x19'),'uri':_0x424de9+_0xcee0('0x2b')+_0x4005bd[_0xcee0('0x26')]+'&'+_0x2914c6+'&'+_0x35bc06,'auth':_0x205691,'json':!![]};return rp(_0x2e73d9)[_0xcee0('0xd')](function(_0x13551e){if(_0x13551e[_0xcee0('0xe')][_0xcee0('0xf')]>0x0){_0x4005bd['endUserId']=_0x13551e[_0xcee0('0xe')][0x0]['sys_id'];logger[_0xcee0('0x11')]('['+[_0x3d3538[_0xcee0('0x12')]()]+_0xcee0('0x2c'),_0x4005bd);_0x1132a7(_0x4005bd);}else{return createEndUser(_0x3d3538,_0x205691,_0x4005bd,_0x424de9,_0x2914c6)[_0xcee0('0xd')](function(_0xc80add){logger[_0xcee0('0x11')]('['+[_0x3d3538['toUpperCase']()]+'],\x20createEndUser\x20crm',_0xc80add);_0x1132a7(_0xc80add);});}})[_0xcee0('0x20')](function(_0x183c79){logger['error']('['+[_0x3d3538[_0xcee0('0x12')]()]+']',_0x183c79[_0xcee0('0x15')]);_0x41bc0e(_0x183c79[_0xcee0('0x15')]);});});};}function getCustomFields(_0x346589,_0x4d7eef){var _0x39d267={};if(_0x346589[_0xcee0('0xf')]>0x0){_[_0xcee0('0x2d')](_0x346589,function(_0x3f5273){if(_['includes']([_0xcee0('0x2e'),_0xcee0('0x2f')],_0x3f5273[_0xcee0('0x30')])&&_0x3f5273['nameField']&&!_0x3f5273[_0xcee0('0x31')]){_0x39d267[_0x3f5273[_0xcee0('0x32')][_0xcee0('0x33')]()]=_0x3f5273[_0xcee0('0x34')]['toString']();}else if(_[_0xcee0('0x35')](['string',_0xcee0('0x2f')],_0x3f5273[_0xcee0('0x30')])&&_0x3f5273[_0xcee0('0x36')]&&_0x3f5273['customField']){_0x39d267[_0x3f5273[_0xcee0('0x36')][_0xcee0('0x33')]()]=_0x3f5273['content'][_0xcee0('0x37')]();}else if(_0x3f5273[_0xcee0('0x30')]==='variable'&&_0x3f5273[_0xcee0('0x38')]&&_0x3f5273[_0xcee0('0x36')]&&_0x3f5273[_0xcee0('0x31')]){_0x39d267[_0x3f5273[_0xcee0('0x36')][_0xcee0('0x33')]()]=_0x4d7eef[_0x3f5273[_0xcee0('0x38')]][_0xcee0('0x37')]();}else if(_0x3f5273[_0xcee0('0x30')]===_0xcee0('0x39')&&_0x3f5273[_0xcee0('0x3a')]&&_0x3f5273['Variable']['name']&&_0x3f5273['idField']&&_0x3f5273[_0xcee0('0x31')]){_0x39d267[_0x3f5273[_0xcee0('0x36')]['toLowerCase']()]=_0x4d7eef[_0x3f5273[_0xcee0('0x3a')][_0xcee0('0x3b')][_0xcee0('0x33')]()][_0xcee0('0x37')]();}});}return _0x39d267;}function getTicket(_0x1e1996,_0x4bd9bd,_0x1c4929,_0x3d787f,_0x175137,_0x47670e){return function(_0x46b81c){logger[_0xcee0('0x11')]('['+[_0x1e1996['toUpperCase']()]+_0xcee0('0x3c'),_0x46b81c);return new Promise(function(_0x27db86,_0x3a05fb){var _0x5cebc7=_0x1e1996[_0xcee0('0x33')]()==='outbound'?_0x46b81c[_0xcee0('0x1d')]:_0x46b81c[_0xcee0('0x29')];var _0x8b2fc={'method':_0xcee0('0x24'),'uri':_0x1c4929+_0xcee0('0x3d')+'?'+_0x47670e,'body':Object['assign']({},{'active':_0xcee0('0x1c'),'caller_id':_0x5cebc7,'assigned_to':_0x46b81c['userId'],'short_description':intUtil[_0xcee0('0x3e')](_0x3d787f[_0xcee0('0x3f')],_0x175137,'\x20'),'description':intUtil[_0xcee0('0x3e')](_0x3d787f[_0xcee0('0x40')],_0x175137,'\x0a')},getCustomFields(_0x3d787f[_0xcee0('0x41')],_0x175137)),'auth':_0x4bd9bd,'json':!![]};return rp(_0x8b2fc)[_0xcee0('0xd')](function(_0x34e58d){logger[_0xcee0('0x11')]('['+[_0x1e1996[_0xcee0('0x12')]()]+_0xcee0('0x42'),_0x34e58d['result']);_0x46b81c['ticketId']=_0x34e58d[_0xcee0('0xe')]['sys_id'];_0x46b81c[_0xcee0('0x43')]=_0x34e58d[_0xcee0('0xe')][_0xcee0('0x44')];logger[_0xcee0('0x11')]('['+[_0x1e1996[_0xcee0('0x12')]()]+']\x20getTicket\x20crm',_0x46b81c);_0x27db86(_0x46b81c);})[_0xcee0('0x20')](function(_0x14bb7b){logger['error']('['+[_0x1e1996[_0xcee0('0x12')]()]+']',_0x14bb7b[_0xcee0('0x15')]);_0x3a05fb(_0x14bb7b[_0xcee0('0x15')]);});});};}function createRemoteTag(_0xad9a8a,_0x25ae36,_0x3c8dbd,_0x2935e1){return new Promise(function(_0x382ad3,_0x20d877){var _0x264836={'method':_0xcee0('0x24'),'uri':_0x3c8dbd+_0xcee0('0x45')+'?'+_0x2935e1,'body':{'short_description':_0xad9a8a,'global':!![],'active':!![],'name':_0xad9a8a},'auth':_0x25ae36,'json':!![]};return rp(_0x264836)['then'](function(_0x21189e){var _0x355bc3=_0x21189e[_0xcee0('0xe')][_0xcee0('0x10')];_0x382ad3(_0x355bc3);});});}function getRemoteTag(_0x2ef14b,_0x3a1cde,_0x3af4eb,_0x1b0cca,_0x2facd8){return new Promise(function(_0x159027,_0x44d97c){var _0x5da23a={'method':_0xcee0('0x19'),'uri':_0x3af4eb+_0xcee0('0x45')+_0xcee0('0x46')+_0x2ef14b+'&'+_0x1b0cca,'auth':_0x3a1cde,'json':!![]};return rp(_0x5da23a)[_0xcee0('0xd')](function(_0x407335){if(_0x407335['result'][_0xcee0('0xf')]>0x0){var _0xb629ec=_0x407335[_0xcee0('0xe')][0x0][_0xcee0('0x10')];_0x159027(_0xb629ec);}else{return createRemoteTag(_0x2ef14b,_0x3a1cde,_0x3af4eb,_0x1b0cca)[_0xcee0('0xd')](function(_0x10d1b5){_0x159027(_0x10d1b5);});}});});}function assignTagToIncident(_0x3f5fe6,_0x64aed4,_0x58d201,_0x2efa17,_0x1fc689){return new Promise(function(_0x3d09aa,_0x11a53d){var _0x235dc5={'method':_0xcee0('0x24'),'uri':_0x58d201+_0xcee0('0x47')+'?'+_0x1fc689,'body':{'label':_0x3f5fe6,'table':_0xcee0('0x3d'),'id_type':_0xcee0('0x48'),'table_key':_0x2efa17[_0xcee0('0x49')],'title':_0xcee0('0x4a')+_0x2efa17[_0xcee0('0x43')],'id_display':_0x2efa17[_0xcee0('0x43')]},'auth':_0x64aed4,'json':!![]};return rp(_0x235dc5)[_0xcee0('0xd')](function(_0x1d5b00){_0x3d09aa();})[_0xcee0('0x20')](function(){_0x3d09aa();});});}function manageTags(_0x36e551,_0x2b3873,_0x5c16f4,_0x481c84,_0x536bb5,_0x13345e,_0x546db6){return new Promise(function(_0x534bf0,_0x3b4326){var _0x14d93e=[];_0x2b3873[_0xcee0('0x2d')](function(_0x5cfe02){_0x14d93e[_0xcee0('0x4b')](getRemoteTag(_0x5cfe02,_0x5c16f4,_0x481c84,_0x13345e,_0x546db6));});return Promise[_0xcee0('0x4c')](_0x14d93e)[_0xcee0('0xd')](function(_0x55aba1){if(_0x55aba1[_0xcee0('0xf')]){logger[_0xcee0('0x11')]('['+[_0x36e551['toUpperCase']()]+_0xcee0('0x4d'),_0x55aba1);var _0x29bbda=[];_0x55aba1[_0xcee0('0x2d')](function(_0xecebba){_0x29bbda[_0xcee0('0x4b')](assignTagToIncident(_0xecebba,_0x5c16f4,_0x481c84,_0x536bb5,_0x13345e));});return Promise[_0xcee0('0x4c')](_0x29bbda)[_0xcee0('0xd')](function(){_0x534bf0();})[_0xcee0('0x20')](function(){_0x534bf0();});}else{_0x534bf0();}});});}function getTags(_0x42f393,_0x5aca6a,_0x29bf38,_0x1ad138,_0x2be55f,_0x2fb483){return function(_0x366da8){return new Promise(function(_0x35e138,_0x33151f){var _0xe54045=[];var _0x1b70dd=_0x1ad138[_0xcee0('0x4e')];if(_0x1b70dd&&_0x1b70dd[_0xcee0('0xf')]>0x0){_0xe54045=_[_0xcee0('0x4f')](_0x1b70dd,_0xcee0('0x3b'));}if(_0xe54045[_0xcee0('0xf')]>0x0){return manageTags(_0x42f393,_0xe54045,_0x5aca6a,_0x29bf38,_0x366da8,_0x2be55f,_0x2fb483)[_0xcee0('0xd')](function(){_0x35e138(_0x366da8);});}else{_0x35e138(_0x366da8);}});};}function emit(_0x26839f,_0x1b04ff,_0x5ceb90){var _0x147f56='%26sysparm_record_target%3Dincident'+_0xcee0('0x50')+_0xcee0('0x51')+_0xcee0('0x52');var _0x1e2e83={'uri':_0x26839f+_0xcee0('0x53')+_0x5ceb90+_0x147f56};io['to'](util['format'](_0xcee0('0x54'),_0x1b04ff))['emit'](_0xcee0('0x55'),_0x1e2e83);}exports['cs']=function(_0x45c434,_0x29da21,_0x5c7295,_0x23e92a,_0x5b021c,_0x5c18ae,_0x2572d6,_0x1eef3f){var _0x52ef89={};var _0x2ec2f7={'user':_0x5c18ae['username'],'pass':_0x5c18ae['password']};var _0xf50286='sysparm_limit=1';var _0x5cc456='sysparm_display_value=true';_0x5c18ae[_0xcee0('0x56')]=intUtil[_0xcee0('0x57')](_0x5c18ae[_0xcee0('0x56')]);_0x5c18ae[_0xcee0('0x58')]=intUtil[_0xcee0('0x57')](_0x5c18ae['serverUrl']);var _0x312e97=util['format']('%s/api/now/table/',_0x5c18ae['remoteUri']);_0x52ef89['userEmail']=!_['isNil'](_0x23e92a)?_0x23e92a[_0xcee0('0x59')]:null;_0x52ef89[_0xcee0('0x1e')]=_0x5c18ae[_0xcee0('0x59')];_0x52ef89[_0xcee0('0x26')]=_0x1eef3f['toLowerCase']()===_0xcee0('0x5a')?_0x29da21[_0xcee0('0x5b')]:_0x29da21[_0xcee0('0x5c')];_0x52ef89['callDirection']=_0x1eef3f===_0xcee0('0x5d')||_0x1eef3f==='unmanaged'?_0xcee0('0x5d'):_0xcee0('0x5a');var _0x421ec6=util[_0xcee0('0x5e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c18ae[_0xcee0('0x58')],_0x29da21[_0xcee0('0x5f')],md5(_0x29da21[_0xcee0('0x5f')]));if(_0x5b021c&&_0x5b021c[_0xcee0('0x60')]){logger['info']('[QUEUE]',_0xcee0('0x61'));_0x29da21[_0xcee0('0x62')]=_0x421ec6;}else if(_0x2572d6&&_0x2572d6[_0xcee0('0x63')]&&_0x2572d6[_0xcee0('0x63')]!=='none'){logger[_0xcee0('0x11')](_0xcee0('0x64'),_0xcee0('0x61'));_0x29da21[_0xcee0('0x62')]=_0x421ec6;}else{_0x29da21[_0xcee0('0x62')]='';}return getAdminUser(_0x1eef3f,_0x2ec2f7,_0x52ef89,_0x312e97,_0x5cc456,_0xf50286)[_0xcee0('0xd')](getUser(_0x1eef3f,_0x2ec2f7,_0x312e97,_0x5cc456,_0xf50286))[_0xcee0('0xd')](getEndUser(_0x1eef3f,_0x2ec2f7,_0x312e97,_0x5cc456,_0xf50286))['then'](getTicket(_0x1eef3f,_0x2ec2f7,_0x312e97,_0x5c7295,_0x29da21,_0x5cc456))[_0xcee0('0xd')](function(_0x910eed){logger['info'](util[_0xcee0('0x5e')](_0xcee0('0x65'),_0x910eed[_0xcee0('0x49')]));logger['info'](util[_0xcee0('0x5e')](_0xcee0('0x66'),_0x1eef3f));if(_0x1eef3f!==_0xcee0('0x67')){logger['info']('['+[_0x1eef3f[_0xcee0('0x12')]()]+']',_0xcee0('0x68'));emit(_0x5c18ae[_0xcee0('0x56')],_0x23e92a['name'],_0x910eed['ticketId']);}})[_0xcee0('0x20')](function(_0x2fd0d6){logger[_0xcee0('0x14')]('['+[_0x1eef3f['toUpperCase']()]+_0xcee0('0x69'),util[_0xcee0('0x6a')](_0x2fd0d6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 1564b1d..1cfa9f9 100644 --- a/server/services/ami/trigger/integration/sugarcrm.js +++ b/server/services/ami/trigger/integration/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa78a=['%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','Ticket\x20created!','contacts','version','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','md5','util','ioredis','./util','sugarcrm','defaults','redis','socket.io-emitter','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','map','type','nameField','customField','toLowerCase','content','toString','custom_fields','variable','customVariable','Variable','POST','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x506a61,_0x5155ee){var _0x2c5b08=function(_0x110856){while(--_0x110856){_0x506a61['push'](_0x506a61['shift']());}};_0x2c5b08(++_0x5155ee);}(_0xa78a,0x95));var _0xaa78=function(_0x42f060,_0x3ba33c){_0x42f060=_0x42f060-0x0;var _0x584d82=_0xa78a[_0x42f060];return _0x584d82;};'use strict';var _=require(_0xaa78('0x0'));var rp=require(_0xaa78('0x1'));var BPromise=require('bluebird');var md5=require(_0xaa78('0x2'));var util=require(_0xaa78('0x3'));var Redis=require(_0xaa78('0x4'));var intUtil=require(_0xaa78('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xaa78('0x6'));config['redis']=_[_0xaa78('0x7')](config[_0xaa78('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xaa78('0x9'))(new Redis(config[_0xaa78('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x521138,_0x436cc3,_0xc36e40){io['to'](_0x521138)['emit'](_0x436cc3,_0xc36e40);}function getTicket(_0x33e54b,_0x5d866f,_0x4ff6d7,_0x2f3a29,_0x2c786b,_0x111168,_0x1e07f9,_0x3397ae){logger[_0xaa78('0xa')](_0xaa78('0xb'));var _0x286db7=new Date();var _0xc0bcb4=[{'name':_0xaa78('0xc'),'value':intUtil[_0xaa78('0xd')](_0x2f3a29['Subjects'],_0x2c786b,'\x20')},{'name':_0xaa78('0xe'),'value':_0x5d866f['id']},{'name':_0xaa78('0xf'),'value':_0x5d866f['id']},{'name':'description','value':intUtil[_0xaa78('0xd')](_0x2f3a29['Descriptions'],_0x2c786b,'\x0a')},{'name':'date_start','value':_0x286db7['toISOString']()[_0xaa78('0x10')](0x0,0x13)[_0xaa78('0x11')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xaa78('0x12'),'value':'15'},{'name':_0xaa78('0x13'),'value':_0x4ff6d7['id']},{'name':_0xaa78('0x14'),'value':_0xaa78('0x15')},{'name':_0xaa78('0x16'),'value':_0x4ff6d7['name']},{'name':_0xaa78('0x17'),'value':_0x3397ae}];if(_0x111168[_0xaa78('0x18')]){_[_0xaa78('0x19')](_0x111168,function(_0x551604){if(_0x2c786b[_0x551604[_0xaa78('0x1a')]]){_0xc0bcb4[_0xaa78('0x1b')]({'name':_0x551604[_0xaa78('0x1c')],'value':_0x2c786b[_0x551604['variableName']]});}});}return request({'form':{'method':_0xaa78('0x1d'),'input_type':'JSON','response_type':_0xaa78('0x1e'),'rest_data':JSON['stringify']({'session':_0x1e07f9['id'],'module_name':_0xaa78('0x1f'),'name_value_list':_0xc0bcb4})}});}function getAuth(_0xa4175e){return util[_0xaa78('0x20')](_0xaa78('0x21'),new Buffer(_0xa4175e[_0xaa78('0x22')]+':X')['toString']('base64'));}function getServerInfo(_0x332ab6){return request({'form':{'method':_0xaa78('0x23'),'input_type':_0xaa78('0x1e'),'response_type':'JSON','rest_data':JSON[_0xaa78('0x24')]({'session':_0x332ab6['id']})}});}function getUser(_0x4353f3,_0xebd2ac,_0x36e3b4){if(!_[_0xaa78('0x25')](_0xebd2ac)){logger[_0xaa78('0xa')](_0xaa78('0x26'),_0xebd2ac);return request({'form':{'method':_0xaa78('0x27'),'input_type':_0xaa78('0x1e'),'response_type':_0xaa78('0x1e'),'rest_data':JSON[_0xaa78('0x24')]({'session':_0x36e3b4['id'],'module_name':_0xaa78('0x28'),'query':util[_0xaa78('0x20')](_0xaa78('0x29'),_0xebd2ac),'order_by':'','offset':'0','select_fields':['id','name',_0xaa78('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaa78('0x2b')](function(_0x466e5a){if(_0x466e5a['entry_list'][_0xaa78('0x18')]){var _0x4ffa4d=_[_0xaa78('0x2c')](_0x466e5a[_0xaa78('0x2d')],function(_0x1f12df){return _0x1f12df[_0xaa78('0x2e')][_0xaa78('0x2a')][_0xaa78('0x2f')]===_0xebd2ac;});if(_0x4ffa4d){logger[_0xaa78('0xa')]('Agent\x20found!');return BPromise[_0xaa78('0x30')]({'id':_0x4ffa4d['name_value_list']['id'][_0xaa78('0x2f')],'name':_0x4ffa4d[_0xaa78('0x2e')][_0xaa78('0xc')][_0xaa78('0x2f')]});}}logger['info'](_0xaa78('0x31'));return BPromise['resolve']({'id':_0x36e3b4[_0xaa78('0x2e')][_0xaa78('0x32')][_0xaa78('0x2f')],'name':_0x36e3b4[_0xaa78('0x2e')][_0xaa78('0x2a')][_0xaa78('0x2f')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x36e3b4[_0xaa78('0x2e')][_0xaa78('0x32')][_0xaa78('0x2f')],'name':_0x36e3b4[_0xaa78('0x2e')][_0xaa78('0x2a')][_0xaa78('0x2f')]});}}function getEndUser(_0x62008f,_0x95ecd6,_0x8130a9,_0xcb43a6){logger[_0xaa78('0xa')](_0xaa78('0x33'),_0x8130a9);return request({'form':{'method':_0xaa78('0x27'),'input_type':_0xaa78('0x1e'),'response_type':_0xaa78('0x1e'),'rest_data':JSON['stringify']({'session':_0xcb43a6['id'],'module_name':_0xaa78('0x15'),'query':util[_0xaa78('0x20')](_0xaa78('0x34'),_0x8130a9),'order_by':'','offset':'0','select_fields':['id','name',_0xaa78('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaa78('0x2b')](function(_0x458cb9){if(_0x458cb9['entry_list'][_0xaa78('0x18')]){var _0x1578ab=_[_0xaa78('0x2c')](_0x458cb9[_0xaa78('0x2d')],function(_0x334514){return _0x334514[_0xaa78('0x2e')]['phone_home']['value']===_0x8130a9;});if(_0x1578ab){logger['info'](_0xaa78('0x36'));return BPromise[_0xaa78('0x30')]({'id':_0x1578ab[_0xaa78('0x2e')]['id'][_0xaa78('0x2f')],'name':_0x1578ab[_0xaa78('0x2e')][_0xaa78('0xc')][_0xaa78('0x2f')],'phone':_0x1578ab[_0xaa78('0x2e')][_0xaa78('0x35')][_0xaa78('0x2f')]});}}else{logger['info'](_0xaa78('0x37'));return request({'form':{'method':_0xaa78('0x1d'),'input_type':_0xaa78('0x1e'),'response_type':_0xaa78('0x1e'),'rest_data':JSON['stringify']({'session':_0xcb43a6['id'],'module_name':_0xaa78('0x15'),'name_value_list':[{'name':'first_name','value':_0x95ecd6!==_0xaa78('0x38')?_0x95ecd6:util[_0xaa78('0x20')](_0xaa78('0x39'),_0x8130a9)},{'name':_0xaa78('0x35'),'value':_0x8130a9}]})}})[_0xaa78('0x2b')](function(_0x1414df){logger[_0xaa78('0xa')](_0xaa78('0x3a'));return BPromise[_0xaa78('0x30')]({'id':_0x1414df['id'],'name':_0x1414df['entry_list'][_0xaa78('0x3b')][_0xaa78('0x2f')],'phone':_0x1414df['entry_list'][_0xaa78('0x35')]['value']});});}});}function request(_0x310e44){logger[_0xaa78('0x3c')](_0xaa78('0x3d'),JSON['stringify'](_0x310e44));return rp(_['merge'](def,_0x310e44));}function getTags(_0x438c95,_0x50778a){var _0xc9611d=[];if(_0x438c95&&_0x438c95['length']>0x0){_0xc9611d=_[_0xaa78('0x3e')](_0x438c95,_0x50778a);}return _0xc9611d;}function getCustomFields(_0x39fba4,_0x1722a0){var _0x1d65d4=[];var _0x44d2ba={'custom_fields':[]};if(_0x39fba4[_0xaa78('0x18')]>0x0){_[_0xaa78('0x19')](_0x39fba4,function(_0x464933){if(_0x464933[_0xaa78('0x3f')]==='string'&&_0x464933[_0xaa78('0x40')]&&!_0x464933[_0xaa78('0x41')]){_0x44d2ba[_0x464933[_0xaa78('0x40')][_0xaa78('0x42')]()]=_0x464933[_0xaa78('0x43')][_0xaa78('0x44')]();}else if(_0x464933[_0xaa78('0x3f')]==='string'&&_0x464933[_0xaa78('0x1c')]&&_0x464933[_0xaa78('0x41')]){_0x44d2ba[_0xaa78('0x45')]['push']({'id':_0x464933['idField'],'value':_0x464933[_0xaa78('0x43')][_0xaa78('0x44')]()});}else if(_0x464933['type']===_0xaa78('0x46')&&_0x464933[_0xaa78('0x1a')]&&_0x464933[_0xaa78('0x1c')]&&_0x464933['customField']){_0x1722a0[_0x464933['variableName']]&&_0x44d2ba[_0xaa78('0x45')][_0xaa78('0x1b')]({'id':_0x464933['idField'],'value':_0x1722a0[_0x464933['variableName']][_0xaa78('0x44')]()});}else if(_0x464933[_0xaa78('0x3f')]===_0xaa78('0x47')&&_0x464933['Variable']&&_0x464933[_0xaa78('0x48')][_0xaa78('0xc')]&&_0x464933[_0xaa78('0x1c')]&&_0x464933[_0xaa78('0x41')]){_0x1722a0[_0x464933[_0xaa78('0x48')][_0xaa78('0xc')]['toLowerCase']()]&&_0x44d2ba['custom_fields'][_0xaa78('0x1b')]({'id':_0x464933[_0xaa78('0x1c')],'value':_0x1722a0[_0x464933[_0xaa78('0x48')][_0xaa78('0xc')]['toLowerCase']()]['toString']()});}});}return _0x44d2ba;}function getConnection(_0x106444){return request({'method':_0xaa78('0x49'),'form':{'method':_0xaa78('0x4a'),'input_type':_0xaa78('0x1e'),'response_type':'JSON','rest_data':JSON[_0xaa78('0x24')]({'user_auth':{'user_name':_0x106444[_0xaa78('0x4b')],'password':_0x106444['password'],'encryption':_0xaa78('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x284629){var _0x397a62=_0x284629;if(_0x397a62['id']){def[_0xaa78('0x4d')]=_0x397a62['id'];return BPromise['resolve'](_0x397a62);}else{throw new Error(util[_0xaa78('0x20')](_0xaa78('0x4e'),_0x106444['id']));}});}function setRelationship(_0x558c60,_0x99c0c2,_0x4a05a1,_0x42a645){return request({'form':{'method':_0xaa78('0x4f'),'input_type':'JSON','response_type':_0xaa78('0x1e'),'rest_data':JSON[_0xaa78('0x24')]({'session':_0x558c60['id'],'module_name':_0xaa78('0x1f'),'module_id':_0x4a05a1['id'],'link_field_name':_0x42a645,'related_ids':[_0x99c0c2['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2c4b22,_0x14b97e,_0x23f106,_0x3f63c5,_0x117716,_0xfb2b0b){var _0xc885cd,_0x28ecff,_0xf60e72,_0x53825a;_0xfb2b0b[_0xaa78('0x50')]=intUtil[_0xaa78('0x51')](_0xfb2b0b[_0xaa78('0x50')]);_0xfb2b0b['serverUrl']=intUtil[_0xaa78('0x51')](_0xfb2b0b[_0xaa78('0x52')]);def['uri']=util[_0xaa78('0x20')](_0xaa78('0x53'),_0xfb2b0b[_0xaa78('0x50')]);if(_0x117716&&_0x117716[_0xaa78('0x54')]){logger[_0xaa78('0xa')](_0xaa78('0x55'),_0xaa78('0x56'));_0x14b97e[_0xaa78('0x57')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfb2b0b[_0xaa78('0x52')],_0x14b97e['uniqueid'],md5(_0x14b97e[_0xaa78('0x58')]));}else{_0x14b97e[_0xaa78('0x57')]='';}return getConnection(_0xfb2b0b)['then'](function(_0x2912f5){_0x53825a=_0x2912f5;return getUser(_0xfb2b0b,_0x3f63c5['name'],_0x53825a);})[_0xaa78('0x2b')](function(_0x3decb9){_0xc885cd=_0x3decb9;logger['info'](_0xaa78('0x59'),_0xc885cd['id']);return getEndUser(_0xfb2b0b,_0x14b97e[_0xaa78('0x5a')],_0x14b97e[_0xaa78('0x5b')],_0x53825a);})['then'](function(_0x271c2f){_0x28ecff=_0x271c2f;logger[_0xaa78('0xa')]('The\x20Enduser\x20ID\x20is:',_0x28ecff['id']);return getTicket(_0xfb2b0b,_0xc885cd,_0x28ecff,_0x23f106,_0x14b97e,_0x23f106[_0xaa78('0x5c')],_0x53825a,_0xaa78('0x5d'));})[_0xaa78('0x2b')](function(_0x3c72cc){_0xf60e72=_0x3c72cc;logger['info']('Ticket\x20created!');logger[_0xaa78('0xa')](_0xaa78('0x5e'),_0xf60e72['id']);return setRelationship(_0x53825a,_0xc885cd,_0xf60e72,_0xaa78('0x5f'));})[_0xaa78('0x2b')](function(){return setRelationship(_0x53825a,_0x28ecff,_0xf60e72,'contacts');})['then'](function(){return getServerInfo(_0x53825a);})[_0xaa78('0x2b')](function(_0x49c173){var _0x5e41ba=parseInt(_0x49c173['version'][_0xaa78('0x60')](0x0));var _0x5015e2=util[_0xaa78('0x20')](_0xaa78('0x61'),_0xfb2b0b[_0xaa78('0x50')],_0xf60e72['id']);if(_0x5e41ba>0x6){_0x5015e2=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xfb2b0b[_0xaa78('0x50')],_0xf60e72['id']);}logger[_0xaa78('0xa')](_0xaa78('0x55'),_0xaa78('0x62'));emit(util[_0xaa78('0x20')](_0xaa78('0x63'),_0x3f63c5['name']),'trigger:browser:url',{'uri':_0x5015e2});})[_0xaa78('0x64')](function(_0x117896){logger[_0xaa78('0x65')]('[QUEUE]',JSON['stringify'](_0x117896));});};exports[_0xaa78('0x66')]=function(_0x3ff64c,_0x34f8fd,_0x2ada70,_0x3efa15,_0x54bd0d,_0x3f9e9f,_0x4a6e66){var _0x44e4cd,_0x5cb3ea,_0x1a1dfe,_0x361dce;_0x3f9e9f[_0xaa78('0x50')]=intUtil['stripTrailingSlash'](_0x3f9e9f[_0xaa78('0x50')]);_0x3f9e9f[_0xaa78('0x52')]=intUtil[_0xaa78('0x51')](_0x3f9e9f[_0xaa78('0x52')]);def[_0xaa78('0x67')]=util['format'](_0xaa78('0x53'),_0x3f9e9f[_0xaa78('0x50')]);if(_0x4a6e66&&_0x4a6e66[_0xaa78('0x68')]&&_0x4a6e66[_0xaa78('0x68')]!==_0xaa78('0x69')){logger[_0xaa78('0xa')](_0xaa78('0x6a'),_0xaa78('0x56'));_0x34f8fd['recordingURL']=util[_0xaa78('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f9e9f[_0xaa78('0x52')],_0x34f8fd[_0xaa78('0x58')],md5(_0x34f8fd[_0xaa78('0x58')]));}return getConnection(_0x3f9e9f)[_0xaa78('0x2b')](function(_0x51d230){_0x361dce=_0x51d230;return getUser(_0x3f9e9f,_0x3efa15[_0xaa78('0xc')],_0x361dce);})['then'](function(_0x2c1996){_0x44e4cd=_0x2c1996;logger[_0xaa78('0xa')](_0xaa78('0x59'),_0x44e4cd['id']);return getEndUser(_0x3f9e9f,_0x34f8fd[_0xaa78('0x6b')],_0x34f8fd['destcalleridnum'],_0x361dce);})[_0xaa78('0x2b')](function(_0x23e2a3){_0x5cb3ea=_0x23e2a3;logger[_0xaa78('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5cb3ea['id']);return getTicket(_0x3f9e9f,_0x44e4cd,_0x5cb3ea,_0x2ada70,_0x34f8fd,_0x2ada70[_0xaa78('0x5c')],_0x361dce,_0xaa78('0x6c'));})[_0xaa78('0x2b')](function(_0x3f6fae){_0x1a1dfe=_0x3f6fae;logger[_0xaa78('0xa')](_0xaa78('0x6d'));logger[_0xaa78('0xa')](_0xaa78('0x5e'),_0x1a1dfe['id']);return setRelationship(_0x361dce,_0x44e4cd,_0x1a1dfe,'users');})[_0xaa78('0x2b')](function(){return setRelationship(_0x361dce,_0x5cb3ea,_0x1a1dfe,_0xaa78('0x6e'));})['then'](function(){return getServerInfo(_0x361dce);})[_0xaa78('0x2b')](function(_0x2b7525){var _0xcb5385=parseInt(_0x2b7525[_0xaa78('0x6f')][_0xaa78('0x60')](0x0));var _0x580d7e=util[_0xaa78('0x20')](_0xaa78('0x61'),_0x3f9e9f[_0xaa78('0x50')],_0x1a1dfe['id']);if(_0xcb5385>0x6){_0x580d7e=util[_0xaa78('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3f9e9f['remoteUri'],_0x1a1dfe['id']);}logger[_0xaa78('0xa')](_0xaa78('0x6a'),_0xaa78('0x62'));emit(util['format']('user:%s',_0x3efa15[_0xaa78('0xc')]),'trigger:browser:url',{'uri':_0x580d7e});})[_0xaa78('0x64')](function(_0x180ff3){logger['error'](_0xaa78('0x6a'),JSON[_0xaa78('0x24')](_0x180ff3));});};exports[_0xaa78('0x70')]=function(_0x4d279e,_0x3e7edf,_0x57a550,_0x5c5952,_0x5580bd,_0x3244d3){var _0x5c4e24,_0x265080,_0x32f99e,_0x150810;_0x3244d3[_0xaa78('0x50')]=intUtil['stripTrailingSlash'](_0x3244d3[_0xaa78('0x50')]);_0x3244d3[_0xaa78('0x52')]=intUtil[_0xaa78('0x51')](_0x3244d3[_0xaa78('0x52')]);def[_0xaa78('0x67')]=util[_0xaa78('0x20')](_0xaa78('0x53'),_0x3244d3[_0xaa78('0x50')]);if(_0x5580bd&&_0x5580bd['monitor_format']){logger[_0xaa78('0xa')]('['+_0x3e7edf[_0xaa78('0x71')][_0xaa78('0x72')]()+']',_0xaa78('0x56'));_0x3e7edf[_0xaa78('0x57')]=util['format'](_0xaa78('0x73'),_0x3244d3['serverUrl'],_0x3e7edf[_0xaa78('0x58')],md5(_0x3e7edf[_0xaa78('0x58')]));}else{_0x3e7edf['recordingURL']='';}return getConnection(_0x3244d3)['then'](function(_0x444b55){_0x150810=_0x444b55;if(!_['isNil'](_0x5c5952)){return getUser(_0x3244d3,_0x5c5952[_0xaa78('0xc')],_0x150810);}else{return getUser(_0x3244d3,null,_0x150810);}})['then'](function(_0x2d142d){_0x5c4e24=_0x2d142d;logger[_0xaa78('0xa')](_0xaa78('0x59'),_0x5c4e24['id']);return getEndUser(_0x3244d3,_0x3e7edf[_0xaa78('0x5a')],_0x3e7edf['calleridnum'],_0x150810);})[_0xaa78('0x2b')](function(_0x416289){_0x265080=_0x416289;logger[_0xaa78('0xa')]('The\x20Enduser\x20ID\x20is:',_0x265080['id']);return getTicket(_0x3244d3,_0x5c4e24,_0x265080,_0x57a550,_0x3e7edf,_0x57a550[_0xaa78('0x5c')],_0x150810,_0xaa78('0x5d'));})[_0xaa78('0x2b')](function(_0x3f3ecb){_0x32f99e=_0x3f3ecb;logger[_0xaa78('0xa')]('Ticket\x20created!');logger[_0xaa78('0xa')]('The\x20Ticket\x20ID\x20is:',_0x32f99e['id']);return setRelationship(_0x150810,_0x5c4e24,_0x32f99e,_0xaa78('0x5f'));})[_0xaa78('0x2b')](function(){return setRelationship(_0x150810,_0x265080,_0x32f99e,_0xaa78('0x6e'));})['then'](function(){return getServerInfo(_0x150810);})[_0xaa78('0x64')](function(_0x375f86){logger[_0xaa78('0x65')]('['+_0x3e7edf['lastevent'][_0xaa78('0x72')]()+']',JSON[_0xaa78('0x24')](_0x375f86));});}; \ No newline at end of file +var _0x38f3=['[HTTP]','merge','map','forEach','type','string','nameField','content','customField','variable','custom_fields','customVariable','Variable','toLowerCase','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','users','version','[OUTBOUND]','trigger:browser:url','error','unmanaged','monitor_format','toUpperCase','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','push','idField','variableName','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','first_name','debug'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x38f3,0x1b2));var _0x338f=function(_0xe323e3,_0x110473){_0xe323e3=_0xe323e3-0x0;var _0x208a43=_0x38f3[_0xe323e3];return _0x208a43;};'use strict';var _=require('lodash');var rp=require(_0x338f('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x338f('0x1'));var Redis=require(_0x338f('0x2'));var intUtil=require(_0x338f('0x3'));var config=require(_0x338f('0x4'));var logger=require(_0x338f('0x5'))(_0x338f('0x6'));config[_0x338f('0x7')]=_[_0x338f('0x8')](config['redis'],{'host':_0x338f('0x9'),'port':0x18eb});var io=require(_0x338f('0xa'))(new Redis(config[_0x338f('0x7')]));var def={'method':_0x338f('0xb'),'json':!![]};function emit(_0x104a75,_0x475b71,_0x39c2ea){io['to'](_0x104a75)['emit'](_0x475b71,_0x39c2ea);}function getTicket(_0x36aef4,_0x46ac1d,_0x348e61,_0x4821c5,_0x8d8bb3,_0x63d024,_0x47f8fc,_0x1b49c4){logger[_0x338f('0xc')]('Creating\x20new\x20ticket...');var _0x3a7113=new Date();var _0xb5d77a=[{'name':_0x338f('0xd'),'value':intUtil[_0x338f('0xe')](_0x4821c5[_0x338f('0xf')],_0x8d8bb3,'\x20')},{'name':_0x338f('0x10'),'value':_0x46ac1d['id']},{'name':_0x338f('0x11'),'value':_0x46ac1d['id']},{'name':_0x338f('0x12'),'value':intUtil[_0x338f('0xe')](_0x4821c5[_0x338f('0x13')],_0x8d8bb3,'\x0a')},{'name':_0x338f('0x14'),'value':_0x3a7113[_0x338f('0x15')]()['slice'](0x0,0x13)[_0x338f('0x16')]('T','\x20')},{'name':_0x338f('0x17'),'value':'0'},{'name':_0x338f('0x18'),'value':'15'},{'name':_0x338f('0x19'),'value':_0x348e61['id']},{'name':_0x338f('0x1a'),'value':_0x338f('0x1b')},{'name':_0x338f('0x1c'),'value':_0x348e61[_0x338f('0xd')]},{'name':_0x338f('0x1d'),'value':_0x1b49c4}];if(_0x63d024[_0x338f('0x1e')]){_['forEach'](_0x63d024,function(_0x5111b4){if(_0x8d8bb3[_0x5111b4['variableName']]){_0xb5d77a[_0x338f('0x1f')]({'name':_0x5111b4[_0x338f('0x20')],'value':_0x8d8bb3[_0x5111b4[_0x338f('0x21')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x338f('0x22'),'response_type':_0x338f('0x22'),'rest_data':JSON[_0x338f('0x23')]({'session':_0x47f8fc['id'],'module_name':_0x338f('0x24'),'name_value_list':_0xb5d77a})}});}function getAuth(_0x59c7a0){return util[_0x338f('0x25')](_0x338f('0x26'),new Buffer(_0x59c7a0['apiKey']+':X')[_0x338f('0x27')]('base64'));}function getServerInfo(_0x30ed54){return request({'form':{'method':_0x338f('0x28'),'input_type':_0x338f('0x22'),'response_type':_0x338f('0x22'),'rest_data':JSON[_0x338f('0x23')]({'session':_0x30ed54['id']})}});}function getUser(_0xea98a0,_0xa2b2d2,_0x1d751d){if(!_[_0x338f('0x29')](_0xa2b2d2)){logger[_0x338f('0xc')](_0x338f('0x2a'),_0xa2b2d2);return request({'form':{'method':_0x338f('0x2b'),'input_type':_0x338f('0x22'),'response_type':_0x338f('0x22'),'rest_data':JSON['stringify']({'session':_0x1d751d['id'],'module_name':_0x338f('0x2c'),'query':util[_0x338f('0x25')](_0x338f('0x2d'),_0xa2b2d2),'order_by':'','offset':'0','select_fields':['id','name',_0x338f('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x338f('0x2f')](function(_0x510889){if(_0x510889['entry_list'][_0x338f('0x1e')]){var _0x390fc5=_[_0x338f('0x30')](_0x510889['entry_list'],function(_0x487e6c){return _0x487e6c[_0x338f('0x31')][_0x338f('0x2e')][_0x338f('0x32')]===_0xa2b2d2;});if(_0x390fc5){logger[_0x338f('0xc')](_0x338f('0x33'));return BPromise['resolve']({'id':_0x390fc5[_0x338f('0x31')]['id'][_0x338f('0x32')],'name':_0x390fc5[_0x338f('0x31')][_0x338f('0xd')][_0x338f('0x32')]});}}logger['info'](_0x338f('0x34'));return BPromise[_0x338f('0x35')]({'id':_0x1d751d[_0x338f('0x31')][_0x338f('0x36')][_0x338f('0x32')],'name':_0x1d751d[_0x338f('0x31')][_0x338f('0x2e')][_0x338f('0x32')]});});}else{logger[_0x338f('0xc')](_0x338f('0x37'));return BPromise[_0x338f('0x35')]({'id':_0x1d751d[_0x338f('0x31')]['user_id'][_0x338f('0x32')],'name':_0x1d751d[_0x338f('0x31')][_0x338f('0x2e')]['value']});}}function getEndUser(_0x41f16d,_0x4bda2b,_0x181912,_0x17ed00){logger[_0x338f('0xc')](_0x338f('0x38'),_0x181912);return request({'form':{'method':_0x338f('0x2b'),'input_type':_0x338f('0x22'),'response_type':_0x338f('0x22'),'rest_data':JSON['stringify']({'session':_0x17ed00['id'],'module_name':'Contacts','query':util[_0x338f('0x25')](_0x338f('0x39'),_0x181912),'order_by':'','offset':'0','select_fields':['id','name',_0x338f('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x338f('0x2f')](function(_0x6d0ae9){if(_0x6d0ae9[_0x338f('0x3b')]['length']){var _0x28cc5d=_[_0x338f('0x30')](_0x6d0ae9[_0x338f('0x3b')],function(_0x3828a2){return _0x3828a2[_0x338f('0x31')][_0x338f('0x3a')][_0x338f('0x32')]===_0x181912;});if(_0x28cc5d){logger['info'](_0x338f('0x3c'));return BPromise['resolve']({'id':_0x28cc5d[_0x338f('0x31')]['id'][_0x338f('0x32')],'name':_0x28cc5d[_0x338f('0x31')]['name'][_0x338f('0x32')],'phone':_0x28cc5d[_0x338f('0x31')]['phone_home'][_0x338f('0x32')]});}}else{logger['info'](_0x338f('0x3d'));return request({'form':{'method':_0x338f('0x3e'),'input_type':'JSON','response_type':_0x338f('0x22'),'rest_data':JSON[_0x338f('0x23')]({'session':_0x17ed00['id'],'module_name':_0x338f('0x1b'),'name_value_list':[{'name':'first_name','value':_0x4bda2b!==_0x338f('0x3f')?_0x4bda2b:util[_0x338f('0x25')]('Caller\x20-\x20%s',_0x181912)},{'name':'phone_home','value':_0x181912}]})}})[_0x338f('0x2f')](function(_0x56b75f){logger[_0x338f('0xc')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x56b75f['id'],'name':_0x56b75f['entry_list'][_0x338f('0x40')][_0x338f('0x32')],'phone':_0x56b75f['entry_list'][_0x338f('0x3a')]['value']});});}});}function request(_0x3f15cc){logger[_0x338f('0x41')](_0x338f('0x42'),JSON[_0x338f('0x23')](_0x3f15cc));return rp(_[_0x338f('0x43')](def,_0x3f15cc));}function getTags(_0x48bfd6,_0x6dd7ff){var _0x17bcfa=[];if(_0x48bfd6&&_0x48bfd6[_0x338f('0x1e')]>0x0){_0x17bcfa=_[_0x338f('0x44')](_0x48bfd6,_0x6dd7ff);}return _0x17bcfa;}function getCustomFields(_0x52e416,_0x37a59a){var _0x58512c=[];var _0x291edd={'custom_fields':[]};if(_0x52e416['length']>0x0){_[_0x338f('0x45')](_0x52e416,function(_0x12f156){if(_0x12f156[_0x338f('0x46')]===_0x338f('0x47')&&_0x12f156[_0x338f('0x48')]&&!_0x12f156['customField']){_0x291edd[_0x12f156[_0x338f('0x48')]['toLowerCase']()]=_0x12f156[_0x338f('0x49')][_0x338f('0x27')]();}else if(_0x12f156['type']===_0x338f('0x47')&&_0x12f156[_0x338f('0x20')]&&_0x12f156[_0x338f('0x4a')]){_0x291edd['custom_fields'][_0x338f('0x1f')]({'id':_0x12f156[_0x338f('0x20')],'value':_0x12f156[_0x338f('0x49')]['toString']()});}else if(_0x12f156[_0x338f('0x46')]===_0x338f('0x4b')&&_0x12f156[_0x338f('0x21')]&&_0x12f156[_0x338f('0x20')]&&_0x12f156[_0x338f('0x4a')]){_0x37a59a[_0x12f156[_0x338f('0x21')]]&&_0x291edd[_0x338f('0x4c')]['push']({'id':_0x12f156[_0x338f('0x20')],'value':_0x37a59a[_0x12f156[_0x338f('0x21')]][_0x338f('0x27')]()});}else if(_0x12f156['type']===_0x338f('0x4d')&&_0x12f156[_0x338f('0x4e')]&&_0x12f156[_0x338f('0x4e')]['name']&&_0x12f156[_0x338f('0x20')]&&_0x12f156[_0x338f('0x4a')]){_0x37a59a[_0x12f156[_0x338f('0x4e')][_0x338f('0xd')][_0x338f('0x4f')]()]&&_0x291edd[_0x338f('0x4c')][_0x338f('0x1f')]({'id':_0x12f156[_0x338f('0x20')],'value':_0x37a59a[_0x12f156[_0x338f('0x4e')]['name'][_0x338f('0x4f')]()][_0x338f('0x27')]()});}});}return _0x291edd;}function getConnection(_0xa471df){return request({'method':'POST','form':{'method':_0x338f('0x50'),'input_type':'JSON','response_type':_0x338f('0x22'),'rest_data':JSON[_0x338f('0x23')]({'user_auth':{'user_name':_0xa471df['username'],'password':_0xa471df[_0x338f('0x51')],'encryption':'PLAIN'},'application':_0x338f('0x52')})}})[_0x338f('0x2f')](function(_0x2562d0){var _0x50eac8=_0x2562d0;if(_0x50eac8['id']){def[_0x338f('0x53')]=_0x50eac8['id'];return BPromise['resolve'](_0x50eac8);}else{throw new Error(util[_0x338f('0x25')](_0x338f('0x54'),_0xa471df['id']));}});}function setRelationship(_0x271851,_0x12100f,_0x4346f8,_0xb186ef){return request({'form':{'method':_0x338f('0x55'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x338f('0x23')]({'session':_0x271851['id'],'module_name':_0x338f('0x24'),'module_id':_0x4346f8['id'],'link_field_name':_0xb186ef,'related_ids':[_0x12100f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x338f('0x56')]=function(_0x458536,_0x1fcbfe,_0x2cd5ad,_0x3e487b,_0x1abbc8,_0x4a9cf2){var _0x3e73cf,_0x5f50b3,_0x343960,_0x3346c6;_0x4a9cf2[_0x338f('0x57')]=intUtil[_0x338f('0x58')](_0x4a9cf2[_0x338f('0x57')]);_0x4a9cf2[_0x338f('0x59')]=intUtil[_0x338f('0x58')](_0x4a9cf2['serverUrl']);def[_0x338f('0x5a')]=util[_0x338f('0x25')]('%s/service/v4_1/rest.php',_0x4a9cf2[_0x338f('0x57')]);if(_0x1abbc8&&_0x1abbc8['monitor_format']){logger[_0x338f('0xc')]('[QUEUE]',_0x338f('0x5b'));_0x1fcbfe['recordingURL']=util[_0x338f('0x25')](_0x338f('0x5c'),_0x4a9cf2[_0x338f('0x59')],_0x1fcbfe['uniqueid'],md5(_0x1fcbfe[_0x338f('0x5d')]));}else{_0x1fcbfe[_0x338f('0x5e')]='';}return getConnection(_0x4a9cf2)[_0x338f('0x2f')](function(_0x45e520){_0x3346c6=_0x45e520;return getUser(_0x4a9cf2,_0x3e487b[_0x338f('0xd')],_0x3346c6);})[_0x338f('0x2f')](function(_0x3a0975){_0x3e73cf=_0x3a0975;logger['info']('The\x20User\x20ID\x20is:',_0x3e73cf['id']);return getEndUser(_0x4a9cf2,_0x1fcbfe[_0x338f('0x5f')],_0x1fcbfe[_0x338f('0x60')],_0x3346c6);})['then'](function(_0x523dec){_0x5f50b3=_0x523dec;logger[_0x338f('0xc')](_0x338f('0x61'),_0x5f50b3['id']);return getTicket(_0x4a9cf2,_0x3e73cf,_0x5f50b3,_0x2cd5ad,_0x1fcbfe,_0x2cd5ad[_0x338f('0x62')],_0x3346c6,_0x338f('0x63'));})[_0x338f('0x2f')](function(_0x4110c8){_0x343960=_0x4110c8;logger[_0x338f('0xc')]('Ticket\x20created!');logger['info'](_0x338f('0x64'),_0x343960['id']);return setRelationship(_0x3346c6,_0x3e73cf,_0x343960,'users');})[_0x338f('0x2f')](function(){return setRelationship(_0x3346c6,_0x5f50b3,_0x343960,_0x338f('0x65'));})[_0x338f('0x2f')](function(){return getServerInfo(_0x3346c6);})['then'](function(_0x2ba6bc){var _0x4b089f=parseInt(_0x2ba6bc['version'][_0x338f('0x66')](0x0));var _0x365c0d=util['format'](_0x338f('0x67'),_0x4a9cf2[_0x338f('0x57')],_0x343960['id']);if(_0x4b089f>0x6){_0x365c0d=util[_0x338f('0x25')](_0x338f('0x68'),_0x4a9cf2[_0x338f('0x57')],_0x343960['id']);}logger['info'](_0x338f('0x69'),_0x338f('0x6a'));emit(util[_0x338f('0x25')]('user:%s',_0x3e487b[_0x338f('0xd')]),'trigger:browser:url',{'uri':_0x365c0d});})[_0x338f('0x6b')](function(_0x3ce49d){logger['error'](_0x338f('0x69'),JSON[_0x338f('0x23')](_0x3ce49d));});};exports[_0x338f('0x6c')]=function(_0x447f1e,_0x352744,_0x414746,_0x46b038,_0xe2731d,_0xfa2adf,_0x2868af){var _0x97d73d,_0x1e33be,_0x118baa,_0x24dbf7;_0xfa2adf['remoteUri']=intUtil[_0x338f('0x58')](_0xfa2adf[_0x338f('0x57')]);_0xfa2adf[_0x338f('0x59')]=intUtil[_0x338f('0x58')](_0xfa2adf[_0x338f('0x59')]);def['uri']=util['format'](_0x338f('0x6d'),_0xfa2adf['remoteUri']);if(_0x2868af&&_0x2868af[_0x338f('0x6e')]&&_0x2868af['recordingFormat']!==_0x338f('0x6f')){logger[_0x338f('0xc')]('[OUTBOUND]',_0x338f('0x5b'));_0x352744[_0x338f('0x5e')]=util[_0x338f('0x25')](_0x338f('0x5c'),_0xfa2adf[_0x338f('0x59')],_0x352744[_0x338f('0x5d')],md5(_0x352744[_0x338f('0x5d')]));}return getConnection(_0xfa2adf)[_0x338f('0x2f')](function(_0x309d66){_0x24dbf7=_0x309d66;return getUser(_0xfa2adf,_0x46b038[_0x338f('0xd')],_0x24dbf7);})[_0x338f('0x2f')](function(_0x2d290e){_0x97d73d=_0x2d290e;logger[_0x338f('0xc')](_0x338f('0x70'),_0x97d73d['id']);return getEndUser(_0xfa2adf,_0x352744[_0x338f('0x71')],_0x352744[_0x338f('0x72')],_0x24dbf7);})[_0x338f('0x2f')](function(_0x7a113d){_0x1e33be=_0x7a113d;logger[_0x338f('0xc')](_0x338f('0x61'),_0x1e33be['id']);return getTicket(_0xfa2adf,_0x97d73d,_0x1e33be,_0x414746,_0x352744,_0x414746[_0x338f('0x62')],_0x24dbf7,_0x338f('0x73'));})[_0x338f('0x2f')](function(_0x343ad8){_0x118baa=_0x343ad8;logger[_0x338f('0xc')](_0x338f('0x74'));logger[_0x338f('0xc')]('The\x20Ticket\x20ID\x20is:',_0x118baa['id']);return setRelationship(_0x24dbf7,_0x97d73d,_0x118baa,_0x338f('0x75'));})['then'](function(){return setRelationship(_0x24dbf7,_0x1e33be,_0x118baa,_0x338f('0x65'));})[_0x338f('0x2f')](function(){return getServerInfo(_0x24dbf7);})[_0x338f('0x2f')](function(_0x3ccff9){var _0x10577c=parseInt(_0x3ccff9[_0x338f('0x76')][_0x338f('0x66')](0x0));var _0x36c0e2=util[_0x338f('0x25')](_0x338f('0x67'),_0xfa2adf[_0x338f('0x57')],_0x118baa['id']);if(_0x10577c>0x6){_0x36c0e2=util[_0x338f('0x25')](_0x338f('0x68'),_0xfa2adf['remoteUri'],_0x118baa['id']);}logger[_0x338f('0xc')](_0x338f('0x77'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x338f('0x25')]('user:%s',_0x46b038[_0x338f('0xd')]),_0x338f('0x78'),{'uri':_0x36c0e2});})[_0x338f('0x6b')](function(_0x47785d){logger[_0x338f('0x79')](_0x338f('0x77'),JSON['stringify'](_0x47785d));});};exports[_0x338f('0x7a')]=function(_0x3c0abc,_0x33556e,_0x297a81,_0xb01556,_0x4b368c,_0x5164f2){var _0x30848c,_0x6dcef3,_0x4cf07e,_0x26927f;_0x5164f2[_0x338f('0x57')]=intUtil['stripTrailingSlash'](_0x5164f2['remoteUri']);_0x5164f2['serverUrl']=intUtil[_0x338f('0x58')](_0x5164f2[_0x338f('0x59')]);def[_0x338f('0x5a')]=util['format']('%s/service/v4_1/rest.php',_0x5164f2[_0x338f('0x57')]);if(_0x4b368c&&_0x4b368c[_0x338f('0x7b')]){logger[_0x338f('0xc')]('['+_0x33556e['lastevent']['toUpperCase']()+']',_0x338f('0x5b'));_0x33556e[_0x338f('0x5e')]=util[_0x338f('0x25')](_0x338f('0x5c'),_0x5164f2[_0x338f('0x59')],_0x33556e[_0x338f('0x5d')],md5(_0x33556e['uniqueid']));}else{_0x33556e[_0x338f('0x5e')]='';}return getConnection(_0x5164f2)[_0x338f('0x2f')](function(_0x4bacef){_0x26927f=_0x4bacef;if(!_[_0x338f('0x29')](_0xb01556)){return getUser(_0x5164f2,_0xb01556[_0x338f('0xd')],_0x26927f);}else{return getUser(_0x5164f2,null,_0x26927f);}})[_0x338f('0x2f')](function(_0x3286b0){_0x30848c=_0x3286b0;logger[_0x338f('0xc')](_0x338f('0x70'),_0x30848c['id']);return getEndUser(_0x5164f2,_0x33556e['calleridname'],_0x33556e[_0x338f('0x60')],_0x26927f);})[_0x338f('0x2f')](function(_0x455bbc){_0x6dcef3=_0x455bbc;logger[_0x338f('0xc')](_0x338f('0x61'),_0x6dcef3['id']);return getTicket(_0x5164f2,_0x30848c,_0x6dcef3,_0x297a81,_0x33556e,_0x297a81[_0x338f('0x62')],_0x26927f,'Inbound');})[_0x338f('0x2f')](function(_0x348cbf){_0x4cf07e=_0x348cbf;logger[_0x338f('0xc')](_0x338f('0x74'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4cf07e['id']);return setRelationship(_0x26927f,_0x30848c,_0x4cf07e,_0x338f('0x75'));})['then'](function(){return setRelationship(_0x26927f,_0x6dcef3,_0x4cf07e,'contacts');})[_0x338f('0x2f')](function(){return getServerInfo(_0x26927f);})[_0x338f('0x6b')](function(_0x55856c){logger[_0x338f('0x79')]('['+_0x33556e['lastevent'][_0x338f('0x7c')]()+']',JSON[_0x338f('0x23')](_0x55856c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 35b2e09..10b453d 100644 --- a/server/services/ami/trigger/integration/util.js +++ b/server/services/ami/trigger/integration/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea26=['keyType','substring','lastIndexOf','isNil','test','lodash','util','length','sortBy','string','push','variable','variableName','toString','type','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent'];(function(_0x100acd,_0x5b8665){var _0x2729ca=function(_0x1696c2){while(--_0x1696c2){_0x100acd['push'](_0x100acd['shift']());}};_0x2729ca(++_0x5b8665);}(_0xea26,0x1b5));var _0x6ea2=function(_0x4532d0,_0x3853aa){_0x4532d0=_0x4532d0-0x0;var _0x3e52c1=_0xea26[_0x4532d0];return _0x3e52c1;};'use strict';var _=require(_0x6ea2('0x0'));var util=require(_0x6ea2('0x1'));exports['getString']=function(_0x436406,_0x33a448,_0x5bcd3f){var _0x315fde=[];if(_0x436406[_0x6ea2('0x2')]>0x0){var _0x3d19f1=_[_0x6ea2('0x3')](_0x436406,['id']);for(var _0x23a25a=0x0;_0x23a25a<_0x3d19f1[_0x6ea2('0x2')];_0x23a25a++){var _0x51d52b=_0x3d19f1[_0x23a25a];if(_0x51d52b['type']===_0x6ea2('0x4')){_0x315fde[_0x6ea2('0x5')](_0x51d52b['content']);}else if(_0x51d52b['type']===_0x6ea2('0x6')&&_0x51d52b[_0x6ea2('0x7')]){_0x33a448[_0x51d52b['variableName']]&&_0x315fde[_0x6ea2('0x5')](_0x33a448[_0x51d52b[_0x6ea2('0x7')]][_0x6ea2('0x8')]());}else if(_0x51d52b[_0x6ea2('0x9')]===_0x6ea2('0xa')&&_0x51d52b[_0x6ea2('0xb')]&&_0x51d52b[_0x6ea2('0xb')]['name']){_0x33a448[_0x51d52b['Variable'][_0x6ea2('0xc')]['toLowerCase']()]&&_0x315fde[_0x6ea2('0x5')](_0x33a448[_0x51d52b[_0x6ea2('0xb')]['name'][_0x6ea2('0xd')]()][_0x6ea2('0x8')]());}else if(_0x51d52b[_0x6ea2('0x9')]===_0x6ea2('0xe')){if(_0x51d52b['keyType']===_0x6ea2('0x4')&&_0x51d52b[_0x6ea2('0xf')]){_0x315fde[_0x6ea2('0x5')](util[_0x6ea2('0x10')](_0x6ea2('0x11'),_0x51d52b[_0x6ea2('0xf')],_0x51d52b[_0x6ea2('0x12')]));}else if(_0x51d52b[_0x6ea2('0x13')]===_0x6ea2('0x6')&&_0x51d52b[_0x6ea2('0x7')]&&_0x51d52b[_0x6ea2('0xf')]){_0x33a448[_0x51d52b['variableName']]&&_0x315fde['push'](util[_0x6ea2('0x10')](_0x6ea2('0x11'),_0x51d52b[_0x6ea2('0xf')],_0x33a448[_0x51d52b[_0x6ea2('0x7')]]));}else if(_0x51d52b['keyType']===_0x6ea2('0xa')&&_0x51d52b['Variable']&&_0x51d52b[_0x6ea2('0xb')]['name']&&_0x51d52b[_0x6ea2('0xf')]){_0x33a448[_0x51d52b[_0x6ea2('0xb')]['name'][_0x6ea2('0xd')]()]&&_0x315fde[_0x6ea2('0x5')](util[_0x6ea2('0x10')]('%s:\x20%s',_0x51d52b[_0x6ea2('0xf')],_0x33a448[_0x51d52b['Variable'][_0x6ea2('0xc')][_0x6ea2('0xd')]()]));}}}}return _0x315fde['join'](_0x5bcd3f);};exports['stripTrailingSlash']=function(_0x5e24e2){var _0x4feb1f=_0x5e24e2['slice'](-0x1);if(_0x4feb1f==='/'){_0x5e24e2=_0x5e24e2[_0x6ea2('0x14')](0x0,_0x5e24e2[_0x6ea2('0x15')](_0x4feb1f));}return _0x5e24e2;};exports['validateEmail']=function(_0x272cac){if(!_[_0x6ea2('0x16')](_0x272cac)&&_0x272cac!==''){var _0x250f73=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x250f73[_0x6ea2('0x17')](String(_0x272cac)[_0x6ea2('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xb2ba=['toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','customVariable','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','lodash','getString','length','string','push','content','type','variable','variableName','toString','Variable','name'];(function(_0x460e1a,_0x2dd339){var _0x12306d=function(_0x4a8359){while(--_0x4a8359){_0x460e1a['push'](_0x460e1a['shift']());}};_0x12306d(++_0x2dd339);}(_0xb2ba,0x71));var _0xab2b=function(_0x4d02d2,_0x488709){_0x4d02d2=_0x4d02d2-0x0;var _0xd61f09=_0xb2ba[_0x4d02d2];return _0xd61f09;};'use strict';var _=require(_0xab2b('0x0'));var util=require('util');exports[_0xab2b('0x1')]=function(_0x799534,_0x3b9a59,_0x59d5d1){var _0x5dc564=[];if(_0x799534[_0xab2b('0x2')]>0x0){var _0x4248b9=_['sortBy'](_0x799534,['id']);for(var _0x43d83b=0x0;_0x43d83b<_0x4248b9[_0xab2b('0x2')];_0x43d83b++){var _0x48992b=_0x4248b9[_0x43d83b];if(_0x48992b['type']===_0xab2b('0x3')){_0x5dc564[_0xab2b('0x4')](_0x48992b[_0xab2b('0x5')]);}else if(_0x48992b[_0xab2b('0x6')]===_0xab2b('0x7')&&_0x48992b[_0xab2b('0x8')]){_0x3b9a59[_0x48992b[_0xab2b('0x8')]]&&_0x5dc564['push'](_0x3b9a59[_0x48992b['variableName']][_0xab2b('0x9')]());}else if(_0x48992b[_0xab2b('0x6')]==='customVariable'&&_0x48992b[_0xab2b('0xa')]&&_0x48992b['Variable']['name']){_0x3b9a59[_0x48992b[_0xab2b('0xa')][_0xab2b('0xb')][_0xab2b('0xc')]()]&&_0x5dc564[_0xab2b('0x4')](_0x3b9a59[_0x48992b[_0xab2b('0xa')][_0xab2b('0xb')][_0xab2b('0xc')]()][_0xab2b('0x9')]());}else if(_0x48992b[_0xab2b('0x6')]===_0xab2b('0xd')){if(_0x48992b['keyType']===_0xab2b('0x3')&&_0x48992b[_0xab2b('0xe')]){_0x5dc564['push'](util[_0xab2b('0xf')](_0xab2b('0x10'),_0x48992b[_0xab2b('0xe')],_0x48992b[_0xab2b('0x11')]));}else if(_0x48992b['keyType']===_0xab2b('0x7')&&_0x48992b['variableName']&&_0x48992b['key']){_0x3b9a59[_0x48992b[_0xab2b('0x8')]]&&_0x5dc564[_0xab2b('0x4')](util[_0xab2b('0xf')](_0xab2b('0x10'),_0x48992b[_0xab2b('0xe')],_0x3b9a59[_0x48992b[_0xab2b('0x8')]]));}else if(_0x48992b[_0xab2b('0x12')]===_0xab2b('0x13')&&_0x48992b[_0xab2b('0xa')]&&_0x48992b['Variable']['name']&&_0x48992b[_0xab2b('0xe')]){_0x3b9a59[_0x48992b['Variable'][_0xab2b('0xb')][_0xab2b('0xc')]()]&&_0x5dc564['push'](util[_0xab2b('0xf')](_0xab2b('0x10'),_0x48992b[_0xab2b('0xe')],_0x3b9a59[_0x48992b[_0xab2b('0xa')][_0xab2b('0xb')][_0xab2b('0xc')]()]));}}}}return _0x5dc564[_0xab2b('0x14')](_0x59d5d1);};exports[_0xab2b('0x15')]=function(_0x3f0e17){var _0x443ff3=_0x3f0e17[_0xab2b('0x16')](-0x1);if(_0x443ff3==='/'){_0x3f0e17=_0x3f0e17['substring'](0x0,_0x3f0e17[_0xab2b('0x17')](_0x443ff3));}return _0x3f0e17;};exports[_0xab2b('0x18')]=function(_0x4fa8bc){if(!_['isNil'](_0x4fa8bc)&&_0x4fa8bc!==''){var _0x4eea64=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x4eea64['test'](String(_0x4fa8bc)[_0xab2b('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 729a6a6..305f975 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x2e9113,_0xb5c9aa){var _0x16bf85=function(_0x4f788c){while(--_0x4f788c){_0x2e9113['push'](_0x2e9113['shift']());}};_0x16bf85(++_0xb5c9aa);}(_0x34e8,0x12c));var _0x834e=function(_0xe49138,_0x14b56f){_0xe49138=_0xe49138-0x0;var _0x294793=_0x34e8[_0xe49138];return _0x294793;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x2a3969,_0x241d30){var _0x4af0b6=function(_0x298a46){while(--_0x298a46){_0x2a3969['push'](_0x2a3969['shift']());}};_0x4af0b6(++_0x241d30);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index f16c0b3..3dc3ce7 100644 --- a/server/services/ami/trigger/integration/zendesk.js +++ b/server/services/ami/trigger/integration/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe76=['Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','redis','defaults','socket.io-emitter','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','custom_fields','variable','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error'];(function(_0x1111b6,_0x406ede){var _0x2b4945=function(_0x31ec4f){while(--_0x31ec4f){_0x1111b6['push'](_0x1111b6['shift']());}};_0x2b4945(++_0x406ede);}(_0xfe76,0x84));var _0x6fe7=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xfe76[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x6fe7('0x0'));var rp=require(_0x6fe7('0x1'));var md5=require(_0x6fe7('0x2'));var util=require(_0x6fe7('0x3'));var Redis=require(_0x6fe7('0x4'));var intUtil=require('./util');var config=require(_0x6fe7('0x5'));var logger=require('../../../../config/logger')('zendesk');config[_0x6fe7('0x6')]=_[_0x6fe7('0x7')](config[_0x6fe7('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6fe7('0x8'))(new Redis(config[_0x6fe7('0x6')]));function emit(_0x47525e,_0x1bc37c,_0x496a6c){io['to'](_0x47525e)['emit'](_0x1bc37c,_0x496a6c);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x18b022,_0x25094e,_0x2386b9,_0x589019,_0x11714b){logger['info'](_0x6fe7('0x9'));return request({'uri':util[_0x6fe7('0xa')](_0x6fe7('0xb'),_0x18b022['remoteUri']),'method':_0x6fe7('0xc'),'body':{'ticket':_[_0x6fe7('0xd')]({'requester_id':_0x2386b9['id'],'submitter_id':_0x25094e?_0x25094e['id']:undefined,'assignee_id':_0x25094e?_0x25094e['id']:undefined,'tags':getTags(_0x589019['Tags'],_0x6fe7('0xe')),'subject':intUtil[_0x6fe7('0xf')](_0x589019[_0x6fe7('0x10')],_0x11714b,'\x20'),'description':intUtil[_0x6fe7('0xf')](_0x589019[_0x6fe7('0x11')],_0x11714b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6fe7('0xf')](_0x589019['Descriptions'],_0x11714b,'\x0a')}},getCustomFields(_0x589019[_0x6fe7('0x12')],_0x11714b))}})[_0x6fe7('0x13')](function(_0x315446){logger[_0x6fe7('0x14')](_0x6fe7('0x15'));return _0x315446[_0x6fe7('0x16')];});}function getUser(_0x550398,_0x18f81c){if(intUtil[_0x6fe7('0x17')](_0x18f81c)){logger[_0x6fe7('0x14')](_0x6fe7('0x18'),_0x18f81c);return request({'uri':util[_0x6fe7('0xa')]('%s/search.json',_0x550398['remoteUri']),'qs':{'query':util[_0x6fe7('0xa')](_0x6fe7('0x19'),_0x18f81c)}})['then'](function(_0x4e3927){if(_0x4e3927[_0x6fe7('0x1a')]){logger[_0x6fe7('0x14')](_0x6fe7('0x1b'));return _['find'](_0x4e3927['results'],{'email':_0x18f81c,'role':_0x6fe7('0x1c')});}else{logger['info'](_0x6fe7('0x1d'));return request({'uri':util[_0x6fe7('0xa')](_0x6fe7('0x1e'),_0x550398[_0x6fe7('0x1f')])})[_0x6fe7('0x13')](function(_0x3ecc1c){logger['info'](_0x6fe7('0x20'));return _0x3ecc1c[_0x6fe7('0x21')];});}});}else{logger['info'](_0x6fe7('0x1d'));return request({'uri':util[_0x6fe7('0xa')](_0x6fe7('0x1e'),_0x550398[_0x6fe7('0x1f')])})[_0x6fe7('0x13')](function(_0x47d22e){logger[_0x6fe7('0x14')](_0x6fe7('0x20'));return _0x47d22e['user'];});}}function getEndUser(_0x9c281f,_0xd0e679,_0x1cc13e){logger[_0x6fe7('0x14')](_0x6fe7('0x22'),_0x1cc13e);return request({'uri':util['format'](_0x6fe7('0x23'),_0x9c281f[_0x6fe7('0x1f')]),'qs':{'query':util[_0x6fe7('0xa')](_0x6fe7('0x24'),_0x1cc13e)}})[_0x6fe7('0x13')](function(_0x3a82c4){var _0x6b3f6f;if(_0x3a82c4[_0x6fe7('0x25')][_0x6fe7('0x26')]){_0x3a82c4[_0x6fe7('0x25')]=_[_0x6fe7('0x27')](_0x3a82c4['results'],{'suspended':![],'role':_0x6fe7('0x28')});if(_0x3a82c4[_0x6fe7('0x25')][_0x6fe7('0x26')]){_0x6b3f6f=_[_0x6fe7('0x29')](_0x3a82c4[_0x6fe7('0x25')]);}}if(_0x6b3f6f){logger[_0x6fe7('0x14')](_0x6fe7('0x2a'));return _0x6b3f6f;}else{logger[_0x6fe7('0x14')](_0x6fe7('0x2b'));return request({'uri':util[_0x6fe7('0xa')](_0x6fe7('0x2c'),_0x9c281f[_0x6fe7('0x1f')]),'method':_0x6fe7('0xc'),'body':{'user':{'role':_0x6fe7('0x28'),'name':util[_0x6fe7('0xa')](_0x6fe7('0x2d'),_0xd0e679||_0x1cc13e),'phone':_0x1cc13e}}})['then'](function(_0x2d28b9){logger['info'](_0x6fe7('0x2e'));return _0x2d28b9[_0x6fe7('0x21')];});}});}function getAuth(_0x419f01){var _0x39e142;if(_0x419f01[_0x6fe7('0x2f')]===_0x6fe7('0x30')){_0x39e142=util['format'](_0x6fe7('0x31'),_0x419f01['username'],_0x419f01['password']);}else if(_0x419f01[_0x6fe7('0x2f')]===_0x6fe7('0x32')){_0x39e142=util[_0x6fe7('0xa')](_0x6fe7('0x33'),_0x419f01[_0x6fe7('0x34')],_0x419f01[_0x6fe7('0x32')]);}return util['format'](_0x6fe7('0x35'),new Buffer(_0x39e142)[_0x6fe7('0x36')](_0x6fe7('0x37')));}function request(_0xa2aa4b){logger['debug'](_0x6fe7('0x38'),JSON[_0x6fe7('0x39')](_0xa2aa4b));return rp(_[_0x6fe7('0x7')](_0xa2aa4b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x574963,_0x48d626){var _0x2512da=[];if(_0x574963&&_0x574963[_0x6fe7('0x26')]>0x0){_0x2512da=_[_0x6fe7('0x3a')](_0x574963,_0x48d626);}return _0x2512da;}function getCustomFields(_0x323bdd,_0x3f704c){var _0x522739=[];var _0x28be6d={'custom_fields':[]};if(_0x323bdd['length']>0x0){_[_0x6fe7('0x3b')](_0x323bdd,function(_0x149df3){if(_[_0x6fe7('0x3c')]([_0x6fe7('0x3d'),_0x6fe7('0x3e')],_0x149df3[_0x6fe7('0x3f')])&&_0x149df3['nameField']&&!_0x149df3[_0x6fe7('0x40')]){_0x28be6d[_0x149df3[_0x6fe7('0x41')][_0x6fe7('0x42')]()]=_0x149df3[_0x6fe7('0x43')][_0x6fe7('0x36')]();}else if(_['includes']([_0x6fe7('0x3d'),_0x6fe7('0x3e')],_0x149df3[_0x6fe7('0x3f')])&&_0x149df3[_0x6fe7('0x44')]&&_0x149df3['customField']){_0x28be6d[_0x6fe7('0x45')]['push']({'id':_0x149df3['idField'],'value':_0x149df3['content']['toString']()});}else if(_0x149df3[_0x6fe7('0x3f')]===_0x6fe7('0x46')&&_0x149df3[_0x6fe7('0x47')]&&_0x149df3[_0x6fe7('0x44')]&&_0x149df3['customField']){_0x3f704c[_0x149df3[_0x6fe7('0x47')]]&&_0x28be6d[_0x6fe7('0x45')]['push']({'id':_0x149df3[_0x6fe7('0x44')],'value':_0x3f704c[_0x149df3[_0x6fe7('0x47')]][_0x6fe7('0x36')]()});}else if(_0x149df3[_0x6fe7('0x3f')]===_0x6fe7('0x48')&&_0x149df3[_0x6fe7('0x49')]&&_0x149df3['Variable'][_0x6fe7('0xe')]&&_0x149df3[_0x6fe7('0x44')]&&_0x149df3[_0x6fe7('0x40')]){_0x3f704c[_0x149df3[_0x6fe7('0x49')][_0x6fe7('0xe')][_0x6fe7('0x42')]()]&&_0x28be6d['custom_fields'][_0x6fe7('0x4a')]({'id':_0x149df3[_0x6fe7('0x44')],'value':_0x3f704c[_0x149df3[_0x6fe7('0x49')]['name'][_0x6fe7('0x42')]()]['toString']()});}});}return _0x28be6d;}exports[_0x6fe7('0x4b')]=function(_0x10881b,_0x50bc48,_0x290d62,_0x28df60,_0x25337e,_0x2ac5d7){var _0x1ae872,_0x536410;_0x2ac5d7[_0x6fe7('0x1f')]=intUtil['stripTrailingSlash'](_0x2ac5d7[_0x6fe7('0x1f')]);_0x2ac5d7['serverUrl']=intUtil[_0x6fe7('0x4c')](_0x2ac5d7[_0x6fe7('0x4d')]);if(_0x25337e&&_0x25337e[_0x6fe7('0x4e')]){logger['info'](_0x6fe7('0x4f'),_0x6fe7('0x50'));_0x50bc48[_0x6fe7('0x51')]=util[_0x6fe7('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ac5d7[_0x6fe7('0x4d')],_0x50bc48[_0x6fe7('0x52')],md5(_0x50bc48[_0x6fe7('0x52')]));}else{_0x50bc48['recordingURL']='';}headers[_0x6fe7('0x53')]=getAuth(_0x2ac5d7);return getUser(_0x2ac5d7,_0x28df60[_0x6fe7('0x54')])[_0x6fe7('0x13')](function(_0x3fae11){_0x1ae872=_0x3fae11;logger[_0x6fe7('0x14')](_0x6fe7('0x55'),_0x1ae872['id']);return getEndUser(_0x2ac5d7,_0x50bc48[_0x6fe7('0x56')],_0x50bc48['calleridnum']);})[_0x6fe7('0x13')](function(_0x22e7c9){_0x536410=_0x22e7c9;logger[_0x6fe7('0x14')](_0x6fe7('0x57'),_0x536410['id']);return getTicket(_0x2ac5d7,_0x1ae872,_0x536410,_0x290d62,_0x50bc48);})[_0x6fe7('0x13')](function(_0x2321ac){if(_0x2321ac){logger[_0x6fe7('0x14')]('The\x20Ticket\x20ID\x20is:',_0x2321ac['id']);switch(_0x2ac5d7[_0x6fe7('0x3f')]){case _0x6fe7('0x58'):logger[_0x6fe7('0x14')]('[QUEUE]',_0x6fe7('0x59'));return request({'uri':util[_0x6fe7('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2ac5d7[_0x6fe7('0x1f')],_0x1ae872['id'],_0x2321ac['id']),'method':'POST'});case _0x6fe7('0x5a'):logger['info'](_0x6fe7('0x4f'),_0x6fe7('0x5b'));emit(util[_0x6fe7('0xa')](_0x6fe7('0x5c'),_0x28df60[_0x6fe7('0xe')]),_0x6fe7('0x5d'),{'uri':util[_0x6fe7('0xa')](_0x6fe7('0x5e'),_0x2ac5d7['remoteUri'][_0x6fe7('0x5f')](_0x6fe7('0x60'),''),_0x2321ac['id'])});break;default:logger[_0x6fe7('0x61')](_0x6fe7('0x4f'),_0x6fe7('0x62'));}}})[_0x6fe7('0x63')](function(_0x3e753d){logger[_0x6fe7('0x61')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x6fe7('0x64')](_0x3e753d,{'showHidden':!![],'depth':null}));});};exports[_0x6fe7('0x65')]=function(_0x3ed3f6,_0x3993e3,_0x10fd02,_0x5de72f,_0x5478b4,_0x251f7a,_0x341e46){var _0x10f1ac,_0x5ba5dc;_0x251f7a[_0x6fe7('0x1f')]=intUtil[_0x6fe7('0x4c')](_0x251f7a[_0x6fe7('0x1f')]);_0x251f7a[_0x6fe7('0x4d')]=intUtil['stripTrailingSlash'](_0x251f7a[_0x6fe7('0x4d')]);if(_0x341e46&&_0x341e46[_0x6fe7('0x66')]&&_0x341e46['recordingFormat']!==_0x6fe7('0x67')){logger[_0x6fe7('0x14')](_0x6fe7('0x68'),_0x6fe7('0x50'));_0x3993e3[_0x6fe7('0x51')]=util['format'](_0x6fe7('0x69'),_0x251f7a[_0x6fe7('0x4d')],_0x3993e3['uniqueid'],md5(_0x3993e3[_0x6fe7('0x52')]));}headers['Authorization']=getAuth(_0x251f7a);return getUser(_0x251f7a,_0x5de72f[_0x6fe7('0x54')])[_0x6fe7('0x13')](function(_0x450a0f){_0x10f1ac=_0x450a0f;logger['info'](_0x6fe7('0x55'),_0x10f1ac['id']);return getEndUser(_0x251f7a,_0x3993e3[_0x6fe7('0x6a')],_0x3993e3[_0x6fe7('0x6b')]);})['then'](function(_0x4ce8a0){_0x5ba5dc=_0x4ce8a0;logger[_0x6fe7('0x14')](_0x6fe7('0x57'),_0x5ba5dc['id']);return getTicket(_0x251f7a,_0x10f1ac,_0x5ba5dc,_0x10fd02,_0x3993e3);})[_0x6fe7('0x13')](function(_0x3442ae){if(_0x3442ae){logger[_0x6fe7('0x14')](_0x6fe7('0x6c'),_0x3442ae['id']);switch(_0x251f7a[_0x6fe7('0x3f')]){case _0x6fe7('0x58'):logger['info'](_0x6fe7('0x68'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x6fe7('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x251f7a[_0x6fe7('0x1f')],_0x10f1ac['id'],_0x3442ae['id']),'method':_0x6fe7('0xc')});case _0x6fe7('0x5a'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x6fe7('0x5c'),_0x5de72f[_0x6fe7('0xe')]),_0x6fe7('0x5d'),{'uri':util[_0x6fe7('0xa')](_0x6fe7('0x5e'),_0x251f7a[_0x6fe7('0x1f')][_0x6fe7('0x5f')]('/api/v2',''),_0x3442ae['id'])});break;default:logger[_0x6fe7('0x61')](_0x6fe7('0x68'),_0x6fe7('0x62'));}}})[_0x6fe7('0x63')](function(_0x839eb3){logger[_0x6fe7('0x61')](_0x6fe7('0x6d'),util[_0x6fe7('0x64')](_0x839eb3,{'showHidden':!![],'depth':null}));});};exports[_0x6fe7('0x6e')]=function(_0x46e3fd,_0x1fd249,_0xe5e15f,_0x584b20,_0x108a11,_0xc26489){var _0x306359,_0x1ee6e1;_0xc26489[_0x6fe7('0x1f')]=intUtil['stripTrailingSlash'](_0xc26489[_0x6fe7('0x1f')]);_0xc26489[_0x6fe7('0x4d')]=intUtil[_0x6fe7('0x4c')](_0xc26489['serverUrl']);if(_0x108a11&&_0x108a11[_0x6fe7('0x4e')]){logger['info']('['+_0x1fd249[_0x6fe7('0x6f')][_0x6fe7('0x70')]()+']',_0x6fe7('0x50'));_0x1fd249[_0x6fe7('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc26489['serverUrl'],_0x1fd249['uniqueid'],md5(_0x1fd249[_0x6fe7('0x52')]));}else{_0x1fd249[_0x6fe7('0x51')]='';}headers[_0x6fe7('0x53')]=getAuth(_0xc26489);return getUser(_0xc26489)[_0x6fe7('0x13')](function(_0xf0f2bb){_0x306359=_0xf0f2bb;logger[_0x6fe7('0x14')]('The\x20User\x20ID\x20is:',_0x306359['id']);return getEndUser(_0xc26489,_0x1fd249[_0x6fe7('0x56')],_0x1fd249[_0x6fe7('0x71')]);})[_0x6fe7('0x13')](function(_0x4bd6e4){_0x1ee6e1=_0x4bd6e4;logger[_0x6fe7('0x14')]('The\x20Enduser\x20ID\x20is:',_0x1ee6e1['id']);return getTicket(_0xc26489,_0x306359,_0x1ee6e1,_0xe5e15f,_0x1fd249);})[_0x6fe7('0x13')](function(_0x1e24ec){if(_0x1e24ec){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1e24ec['id']);}})['catch'](function(_0x267da2){logger['error']('['+_0x1fd249[_0x6fe7('0x6f')][_0x6fe7('0x70')]()+']'+_0x6fe7('0x72'),util[_0x6fe7('0x64')](_0x267da2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1395=['outbound','serverUrl','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','GET','map','forEach','picklist','type','customField','toLowerCase','includes','string','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect'];(function(_0x24070d,_0x1904a2){var _0x101395=function(_0x1ed711){while(--_0x1ed711){_0x24070d['push'](_0x24070d['shift']());}};_0x101395(++_0x1904a2);}(_0x1395,0xf9));var _0x5139=function(_0x2e4a31,_0x3a20ee){_0x2e4a31=_0x2e4a31-0x0;var _0x1da64b=_0x1395[_0x2e4a31];return _0x1da64b;};'use strict';var _=require('lodash');var rp=require(_0x5139('0x0'));var md5=require(_0x5139('0x1'));var util=require(_0x5139('0x2'));var Redis=require('ioredis');var intUtil=require(_0x5139('0x3'));var config=require(_0x5139('0x4'));var logger=require(_0x5139('0x5'))('zendesk');config[_0x5139('0x6')]=_['defaults'](config[_0x5139('0x6')],{'host':_0x5139('0x7'),'port':0x18eb});var io=require(_0x5139('0x8'))(new Redis(config[_0x5139('0x6')]));function emit(_0xf6722d,_0x2f65a2,_0x4d2d98){io['to'](_0xf6722d)[_0x5139('0x9')](_0x2f65a2,_0x4d2d98);}var headers={'Content-Type':_0x5139('0xa'),'Accept':_0x5139('0xa')};function getTicket(_0x125644,_0x107dd5,_0x49a81e,_0xd0ac2e,_0x1b1762){logger[_0x5139('0xb')](_0x5139('0xc'));return request({'uri':util[_0x5139('0xd')]('%s/tickets.json',_0x125644[_0x5139('0xe')]),'method':'POST','body':{'ticket':_[_0x5139('0xf')]({'requester_id':_0x49a81e['id'],'submitter_id':_0x107dd5?_0x107dd5['id']:undefined,'assignee_id':_0x107dd5?_0x107dd5['id']:undefined,'tags':getTags(_0xd0ac2e[_0x5139('0x10')],_0x5139('0x11')),'subject':intUtil[_0x5139('0x12')](_0xd0ac2e[_0x5139('0x13')],_0x1b1762,'\x20'),'description':intUtil[_0x5139('0x12')](_0xd0ac2e[_0x5139('0x14')],_0x1b1762,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5139('0x12')](_0xd0ac2e[_0x5139('0x14')],_0x1b1762,'\x0a')}},getCustomFields(_0xd0ac2e[_0x5139('0x15')],_0x1b1762))}})['then'](function(_0x4c3f76){logger[_0x5139('0xb')](_0x5139('0x16'));return _0x4c3f76['ticket'];});}function getUser(_0x129cd9,_0x3a5981){if(intUtil[_0x5139('0x17')](_0x3a5981)){logger['info'](_0x5139('0x18'),_0x3a5981);return request({'uri':util['format'](_0x5139('0x19'),_0x129cd9[_0x5139('0xe')]),'qs':{'query':util[_0x5139('0xd')](_0x5139('0x1a'),_0x3a5981)}})[_0x5139('0x1b')](function(_0x30a418){if(_0x30a418[_0x5139('0x1c')]){logger[_0x5139('0xb')](_0x5139('0x1d'));return _[_0x5139('0x1e')](_0x30a418[_0x5139('0x1f')],{'email':_0x3a5981,'role':_0x5139('0x20')});}else{logger['info'](_0x5139('0x21'));return request({'uri':util[_0x5139('0xd')](_0x5139('0x22'),_0x129cd9[_0x5139('0xe')])})[_0x5139('0x1b')](function(_0x429783){logger[_0x5139('0xb')](_0x5139('0x23'));return _0x429783[_0x5139('0x24')];});}});}else{logger[_0x5139('0xb')](_0x5139('0x21'));return request({'uri':util[_0x5139('0xd')](_0x5139('0x22'),_0x129cd9['remoteUri'])})[_0x5139('0x1b')](function(_0x4ae9ab){logger[_0x5139('0xb')](_0x5139('0x23'));return _0x4ae9ab[_0x5139('0x24')];});}}function getEndUser(_0x536a6f,_0x177831,_0x34119c){logger[_0x5139('0xb')](_0x5139('0x25'),_0x34119c);return request({'uri':util[_0x5139('0xd')](_0x5139('0x19'),_0x536a6f[_0x5139('0xe')]),'qs':{'query':util[_0x5139('0xd')](_0x5139('0x26'),_0x34119c)}})[_0x5139('0x1b')](function(_0x5309af){var _0x23ffa3;if(_0x5309af[_0x5139('0x1f')][_0x5139('0x27')]){_0x5309af[_0x5139('0x1f')]=_[_0x5139('0x28')](_0x5309af[_0x5139('0x1f')],{'suspended':![],'role':'end-user'});if(_0x5309af[_0x5139('0x1f')][_0x5139('0x27')]){_0x23ffa3=_[_0x5139('0x29')](_0x5309af[_0x5139('0x1f')]);}}if(_0x23ffa3){logger[_0x5139('0xb')](_0x5139('0x2a'));return _0x23ffa3;}else{logger[_0x5139('0xb')](_0x5139('0x2b'));return request({'uri':util[_0x5139('0xd')](_0x5139('0x2c'),_0x536a6f[_0x5139('0xe')]),'method':_0x5139('0x2d'),'body':{'user':{'role':'end-user','name':util[_0x5139('0xd')](_0x5139('0x2e'),_0x177831||_0x34119c),'phone':_0x34119c}}})['then'](function(_0x240d10){logger['info'](_0x5139('0x2f'));return _0x240d10[_0x5139('0x24')];});}});}function getAuth(_0x3acb67){var _0x5815cd;if(_0x3acb67[_0x5139('0x30')]===_0x5139('0x31')){_0x5815cd=util[_0x5139('0xd')](_0x5139('0x32'),_0x3acb67[_0x5139('0x33')],_0x3acb67['password']);}else if(_0x3acb67[_0x5139('0x30')]==='token'){_0x5815cd=util['format']('%s/token:%s',_0x3acb67[_0x5139('0x33')],_0x3acb67[_0x5139('0x34')]);}return util['format'](_0x5139('0x35'),new Buffer(_0x5815cd)[_0x5139('0x36')]('base64'));}function request(_0x34af0b){logger[_0x5139('0x37')](_0x5139('0x38'),JSON[_0x5139('0x39')](_0x34af0b));return rp(_[_0x5139('0x3a')](_0x34af0b,{'method':_0x5139('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x5c67f7,_0x34c927){var _0x14a801=[];if(_0x5c67f7&&_0x5c67f7[_0x5139('0x27')]>0x0){_0x14a801=_[_0x5139('0x3c')](_0x5c67f7,_0x34c927);}return _0x14a801;}function getCustomFields(_0x5226e1,_0x271514){var _0x3794a0=[];var _0x5b4b12={'custom_fields':[]};if(_0x5226e1['length']>0x0){_[_0x5139('0x3d')](_0x5226e1,function(_0x5c6fe2){if(_['includes'](['string',_0x5139('0x3e')],_0x5c6fe2[_0x5139('0x3f')])&&_0x5c6fe2['nameField']&&!_0x5c6fe2[_0x5139('0x40')]){_0x5b4b12[_0x5c6fe2['nameField'][_0x5139('0x41')]()]=_0x5c6fe2['content'][_0x5139('0x36')]();}else if(_[_0x5139('0x42')]([_0x5139('0x43'),_0x5139('0x3e')],_0x5c6fe2['type'])&&_0x5c6fe2[_0x5139('0x44')]&&_0x5c6fe2['customField']){_0x5b4b12[_0x5139('0x45')][_0x5139('0x46')]({'id':_0x5c6fe2[_0x5139('0x44')],'value':_0x5c6fe2[_0x5139('0x47')][_0x5139('0x36')]()});}else if(_0x5c6fe2[_0x5139('0x3f')]===_0x5139('0x48')&&_0x5c6fe2[_0x5139('0x49')]&&_0x5c6fe2['idField']&&_0x5c6fe2[_0x5139('0x40')]){_0x271514[_0x5c6fe2[_0x5139('0x49')]]&&_0x5b4b12[_0x5139('0x45')]['push']({'id':_0x5c6fe2[_0x5139('0x44')],'value':_0x271514[_0x5c6fe2[_0x5139('0x49')]]['toString']()});}else if(_0x5c6fe2[_0x5139('0x3f')]===_0x5139('0x4a')&&_0x5c6fe2[_0x5139('0x4b')]&&_0x5c6fe2[_0x5139('0x4b')][_0x5139('0x11')]&&_0x5c6fe2[_0x5139('0x44')]&&_0x5c6fe2['customField']){_0x271514[_0x5c6fe2[_0x5139('0x4b')][_0x5139('0x11')][_0x5139('0x41')]()]&&_0x5b4b12[_0x5139('0x45')][_0x5139('0x46')]({'id':_0x5c6fe2[_0x5139('0x44')],'value':_0x271514[_0x5c6fe2['Variable']['name'][_0x5139('0x41')]()][_0x5139('0x36')]()});}});}return _0x5b4b12;}exports[_0x5139('0x4c')]=function(_0x44de62,_0x3bc178,_0x5adc7b,_0x31bdba,_0x2f9f77,_0x356b3a){var _0x58c15c,_0x590466;_0x356b3a[_0x5139('0xe')]=intUtil[_0x5139('0x4d')](_0x356b3a[_0x5139('0xe')]);_0x356b3a['serverUrl']=intUtil[_0x5139('0x4d')](_0x356b3a['serverUrl']);if(_0x2f9f77&&_0x2f9f77['monitor_format']){logger[_0x5139('0xb')](_0x5139('0x4e'),_0x5139('0x4f'));_0x3bc178[_0x5139('0x50')]=util[_0x5139('0xd')](_0x5139('0x51'),_0x356b3a['serverUrl'],_0x3bc178[_0x5139('0x52')],md5(_0x3bc178[_0x5139('0x52')]));}else{_0x3bc178[_0x5139('0x50')]='';}headers[_0x5139('0x53')]=getAuth(_0x356b3a);return getUser(_0x356b3a,_0x31bdba['email'])[_0x5139('0x1b')](function(_0x4635dc){_0x58c15c=_0x4635dc;logger['info'](_0x5139('0x54'),_0x58c15c['id']);return getEndUser(_0x356b3a,_0x3bc178[_0x5139('0x55')],_0x3bc178[_0x5139('0x56')]);})['then'](function(_0x716513){_0x590466=_0x716513;logger[_0x5139('0xb')](_0x5139('0x57'),_0x590466['id']);return getTicket(_0x356b3a,_0x58c15c,_0x590466,_0x5adc7b,_0x3bc178);})[_0x5139('0x1b')](function(_0x17ddb1){if(_0x17ddb1){logger[_0x5139('0xb')]('The\x20Ticket\x20ID\x20is:',_0x17ddb1['id']);switch(_0x356b3a[_0x5139('0x3f')]){case _0x5139('0x58'):logger[_0x5139('0xb')](_0x5139('0x4e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x5139('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x356b3a['remoteUri'],_0x58c15c['id'],_0x17ddb1['id']),'method':_0x5139('0x2d')});case'newTab':logger['info'](_0x5139('0x4e'),_0x5139('0x59'));emit(util[_0x5139('0xd')](_0x5139('0x5a'),_0x31bdba[_0x5139('0x11')]),_0x5139('0x5b'),{'uri':util[_0x5139('0xd')]('%s/agent/tickets/%s',_0x356b3a[_0x5139('0xe')][_0x5139('0x5c')](_0x5139('0x5d'),''),_0x17ddb1['id'])});break;default:logger['error']('[QUEUE]',_0x5139('0x5e'));}}})[_0x5139('0x5f')](function(_0x2a6d13){logger[_0x5139('0x60')](_0x5139('0x61'),util[_0x5139('0x62')](_0x2a6d13,{'showHidden':!![],'depth':null}));});};exports[_0x5139('0x63')]=function(_0x58e3e5,_0x452ca5,_0x253958,_0x40ae09,_0x13d67f,_0x252485,_0x2c6f6c){var _0x2615d3,_0x1687f2;_0x252485[_0x5139('0xe')]=intUtil[_0x5139('0x4d')](_0x252485['remoteUri']);_0x252485['serverUrl']=intUtil['stripTrailingSlash'](_0x252485[_0x5139('0x64')]);if(_0x2c6f6c&&_0x2c6f6c[_0x5139('0x65')]&&_0x2c6f6c['recordingFormat']!=='none'){logger['info'](_0x5139('0x66'),_0x5139('0x4f'));_0x452ca5[_0x5139('0x50')]=util[_0x5139('0xd')](_0x5139('0x51'),_0x252485[_0x5139('0x64')],_0x452ca5['uniqueid'],md5(_0x452ca5['uniqueid']));}headers[_0x5139('0x53')]=getAuth(_0x252485);return getUser(_0x252485,_0x40ae09[_0x5139('0x67')])['then'](function(_0x7e783b){_0x2615d3=_0x7e783b;logger[_0x5139('0xb')](_0x5139('0x54'),_0x2615d3['id']);return getEndUser(_0x252485,_0x452ca5[_0x5139('0x68')],_0x452ca5[_0x5139('0x69')]);})[_0x5139('0x1b')](function(_0x5a0474){_0x1687f2=_0x5a0474;logger[_0x5139('0xb')](_0x5139('0x57'),_0x1687f2['id']);return getTicket(_0x252485,_0x2615d3,_0x1687f2,_0x253958,_0x452ca5);})[_0x5139('0x1b')](function(_0x4622dc){if(_0x4622dc){logger[_0x5139('0xb')](_0x5139('0x6a'),_0x4622dc['id']);switch(_0x252485[_0x5139('0x3f')]){case _0x5139('0x58'):logger['info'](_0x5139('0x66'),_0x5139('0x6b'));return request({'uri':util[_0x5139('0xd')](_0x5139('0x6c'),_0x252485['remoteUri'],_0x2615d3['id'],_0x4622dc['id']),'method':'POST'});case _0x5139('0x6d'):logger[_0x5139('0xb')](_0x5139('0x66'),_0x5139('0x59'));emit(util[_0x5139('0xd')](_0x5139('0x5a'),_0x40ae09[_0x5139('0x11')]),_0x5139('0x5b'),{'uri':util[_0x5139('0xd')](_0x5139('0x6e'),_0x252485[_0x5139('0xe')][_0x5139('0x5c')](_0x5139('0x5d'),''),_0x4622dc['id'])});break;default:logger[_0x5139('0x60')](_0x5139('0x66'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5139('0x5f')](function(_0x10f16d){logger[_0x5139('0x60')](_0x5139('0x6f'),util['inspect'](_0x10f16d,{'showHidden':!![],'depth':null}));});};exports[_0x5139('0x70')]=function(_0x516857,_0x5f20a3,_0x45888d,_0x2219b3,_0x52707a,_0x20ca9b){var _0x569152,_0x2873ab;_0x20ca9b[_0x5139('0xe')]=intUtil[_0x5139('0x4d')](_0x20ca9b[_0x5139('0xe')]);_0x20ca9b[_0x5139('0x64')]=intUtil['stripTrailingSlash'](_0x20ca9b[_0x5139('0x64')]);if(_0x52707a&&_0x52707a['monitor_format']){logger[_0x5139('0xb')]('['+_0x5f20a3['lastevent'][_0x5139('0x71')]()+']',_0x5139('0x4f'));_0x5f20a3['recordingURL']=util[_0x5139('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20ca9b[_0x5139('0x64')],_0x5f20a3[_0x5139('0x52')],md5(_0x5f20a3[_0x5139('0x52')]));}else{_0x5f20a3[_0x5139('0x50')]='';}headers[_0x5139('0x53')]=getAuth(_0x20ca9b);return getUser(_0x20ca9b)['then'](function(_0x59b35c){_0x569152=_0x59b35c;logger[_0x5139('0xb')](_0x5139('0x54'),_0x569152['id']);return getEndUser(_0x20ca9b,_0x5f20a3[_0x5139('0x55')],_0x5f20a3['calleridnum']);})[_0x5139('0x1b')](function(_0x2057d8){_0x2873ab=_0x2057d8;logger['info'](_0x5139('0x57'),_0x2873ab['id']);return getTicket(_0x20ca9b,_0x569152,_0x2873ab,_0x45888d,_0x5f20a3);})[_0x5139('0x1b')](function(_0x576fd8){if(_0x576fd8){logger['info'](_0x5139('0x6a'),_0x576fd8['id']);}})['catch'](function(_0x117042){logger[_0x5139('0x60')]('['+_0x5f20a3[_0x5139('0x72')]['toUpperCase']()+']'+_0x5139('0x73'),util[_0x5139('0x62')](_0x117042,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 11ba522..5349794 100644 --- a/server/services/ami/trigger/integration/zoho.js +++ b/server/services/ami/trigger/integration/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc28f=['lastevent','Call_Result','Called','complete','Answered','rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','email','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','The\x20User\x20ID\x20is:','calleridnum','lodash','request-promise','md5','./util','moment','ioredis','bluebird','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','add','catch','error','Failing\x20creating\x20the\x20access_token','info','format','https://www.zohoapis.%s/crm/v2/users','then','users','isArrayLikeObject','isNil','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','Last_Name','First_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0xc28f,0xcf));var _0xfc28=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xc28f[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xfc28('0x0'));var rp=require(_0xfc28('0x1'));var md5=require(_0xfc28('0x2'));var util=require('util');var intUtil=require(_0xfc28('0x3'));var moment=require(_0xfc28('0x4'));var Redis=require(_0xfc28('0x5'));var BPromise=require(_0xfc28('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xfc28('0x7'));config[_0xfc28('0x8')]=_[_0xfc28('0x9')](config[_0xfc28('0x8')],{'host':_0xfc28('0xa'),'port':0x18eb});var io=require(_0xfc28('0xb'))(new Redis(config[_0xfc28('0x8')]));function emit(_0x43bf52,_0x43581b,_0x44b539){io['to'](_0x43bf52)[_0xfc28('0xc')](_0x43581b,_0x44b539);}function request(_0x307ee2){logger[_0xfc28('0xd')](_0xfc28('0xe'),JSON[_0xfc28('0xf')](_0x307ee2));return rp(_0x307ee2);}function getCustomFields(_0x33ba33,_0x1dd89d){var _0x1d6ecb={};if(_0x33ba33[_0xfc28('0x10')]>0x0){_[_0xfc28('0x11')](_0x33ba33,function(_0x56953e){if(_[_0xfc28('0x12')]([_0xfc28('0x13'),_0xfc28('0x14')],_0x56953e[_0xfc28('0x15')])&&_0x56953e[_0xfc28('0x16')]){_0x1d6ecb[_0x56953e[_0xfc28('0x16')]]=_0x56953e[_0xfc28('0x17')]['toString']();}else if(_0x56953e['type']===_0xfc28('0x18')&&_0x56953e[_0xfc28('0x19')]&&_0x56953e[_0xfc28('0x16')]&&_0x1dd89d[_0x56953e[_0xfc28('0x19')]]){_0x1d6ecb[_0x56953e[_0xfc28('0x16')]]=_0x1dd89d[_0x56953e[_0xfc28('0x19')]][_0xfc28('0x1a')]();}else if(_0x56953e[_0xfc28('0x15')]===_0xfc28('0x1b')&&_0x56953e[_0xfc28('0x1c')]&&_0x56953e[_0xfc28('0x1c')][_0xfc28('0x1d')]&&_0x56953e[_0xfc28('0x16')]&&_0x1dd89d[_0x56953e[_0xfc28('0x1c')][_0xfc28('0x1d')]['toLowerCase']()]){_0x1d6ecb[_0x56953e[_0xfc28('0x16')]]=_0x1dd89d[_0x56953e[_0xfc28('0x1c')][_0xfc28('0x1d')][_0xfc28('0x1e')]()][_0xfc28('0x1a')]();}});}return _0x1d6ecb;}function getName(_0x3e64d4){if(_0x3e64d4[_0xfc28('0x1f')]('\x20')>0x0){var _0x510b35=_0x3e64d4['split'](/ (.+)/);if(_0x510b35[0x1]){return _0x510b35;}}return[_0x3e64d4,_0x3e64d4];}var accountsTokens={};function getAccessToken(_0x37e4d8){return new Promise(function(_0x5e23f9,_0x31020e){if(!_['isNil'](accountsTokens[_0x37e4d8['id']])&&!_['isNil'](accountsTokens[_0x37e4d8['id']][_0xfc28('0x20')])){if(moment()[_0xfc28('0x21')](accountsTokens[_0x37e4d8['id']][_0xfc28('0x22')])){_0x5e23f9(accountsTokens[_0x37e4d8['id']][_0xfc28('0x20')]);}}var _0x45d65d;switch(_0x37e4d8[_0xfc28('0x23')]){case'US':_0x45d65d=_0xfc28('0x24');break;case'AU':_0x45d65d=_0xfc28('0x25');break;case'EU':_0x45d65d=_0xfc28('0x26');break;case'IN':_0x45d65d=_0xfc28('0x27');break;case'CN':_0x45d65d=_0xfc28('0x28');break;default:_0x45d65d=_0xfc28('0x26');break;}var _0x240240={'method':_0xfc28('0x29'),'uri':_0x45d65d+_0xfc28('0x2a'),'qs':{'refresh_token':_0x37e4d8['refreshToken'],'client_id':_0x37e4d8['clientId'],'client_secret':_0x37e4d8['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x240240)['then'](function(_0x26e032){accountsTokens[_0x37e4d8['id']]={'access_token':_0x26e032[_0xfc28('0x20')],'expires_in':moment()[_0xfc28('0x2b')](_0x26e032[_0xfc28('0x22')],'seconds')};_0x5e23f9(_0x26e032[_0xfc28('0x20')]);})[_0xfc28('0x2c')](function(_0x39815a){logger[_0xfc28('0x2d')](_0xfc28('0x2e'),_0x39815a['stack']);_0x31020e(_0x39815a);});});}function getUser(_0x3f3f74,_0x26205b,_0x408475,_0x259c1a){logger[_0xfc28('0x2f')]('Search\x20user');return request({'method':'GET','uri':util[_0xfc28('0x30')](_0xfc28('0x31'),_0x26205b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3f3f74},'json':!![]})[_0xfc28('0x32')](function(_0x5b405f){if(_0x5b405f[_0xfc28('0x33')]){var _0x188a8a=-0x1;if(_[_0xfc28('0x34')](_0x5b405f[_0xfc28('0x33')])){if(!_[_0xfc28('0x35')](_0x259c1a)){_0x188a8a=_[_0xfc28('0x36')](_0x5b405f[_0xfc28('0x33')],function(_0x485514){return _0x485514['email']===_0x259c1a;});}if(_0x188a8a>=0x0){logger[_0xfc28('0x2f')](_0xfc28('0x37'));}else{logger[_0xfc28('0x2f')](_0xfc28('0x38'));_0x188a8a=_[_0xfc28('0x36')](_0x5b405f[_0xfc28('0x33')],function(_0x3544bc){return _0x3544bc[_0xfc28('0x39')][_0xfc28('0x1d')]===_0xfc28('0x3a');});}return _0x5b405f[_0xfc28('0x33')][_0x188a8a];}else{if(_0x5b405f['user'][_0xfc28('0x39')]['name']==='Administrator'){logger[_0xfc28('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x5b405f['user'];return user;}else{logger[_0xfc28('0x2d')](_0xfc28('0x3b'),JSON[_0xfc28('0xf')](_0x5b405f));throw new Error(_0xfc28('0x3c')+JSON[_0xfc28('0xf')](_0x5b405f));}}}else{logger['error'](_0xfc28('0x3b'),JSON['stringify'](_0x5b405f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5b405f));}})[_0xfc28('0x2c')](function(_0xc68132){console[_0xfc28('0x2d')](_0xc68132);});}function getZohoUser(_0xa7cb0b,_0x5706d9){return new BPromise(function(_0x26058c,_0x5334f3){request(_0xa7cb0b)[_0xfc28('0x32')](function(_0x58c937){var _0xef0b9a=null;if(_0x58c937){_0xef0b9a=_0x58c937[_0xfc28('0x3d')][0x0];_0xef0b9a[_0xfc28('0x3e')]=_0x5706d9;}_0x26058c(_0xef0b9a);})[_0xfc28('0x2c')](function(_0x172d0d){_0x5334f3(_0x172d0d);});});}function createEndUser(_0x14df6b,_0x3d98ad,_0x12bad2,_0x4567d4,_0x4b591a,_0x545523){var _0x12bad2=getName(_0x12bad2);return request({'method':_0xfc28('0x29'),'uri':_0xfc28('0x3f')+_0x3d98ad+_0xfc28('0x40')+_[_0xfc28('0x41')](_0x545523[_0xfc28('0x42')])+'s','body':{'data':[{'Last_Name':_0x12bad2[0x1],'First_Name':_0x12bad2[0x0],'Phone':_0x4567d4,'Owner':{'name':!_[_0xfc28('0x35')](_0x4b591a[_0xfc28('0x43')][_0xfc28('0x1d')])?_0x4b591a[_0xfc28('0x43')][_0xfc28('0x1d')]:!_[_0xfc28('0x35')](_0x4b591a[_0xfc28('0x44')])?_0x4b591a[_0xfc28('0x44')]+'\x20'+_0x4b591a[_0xfc28('0x45')]:_0x4b591a['last_name'],'id':_0x4b591a['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x14df6b},'json':!![]})[_0xfc28('0x32')](function(_0x384797){if(_0x384797&&_0x384797[_0xfc28('0x3d')][0x0][_0xfc28('0x46')]===_0xfc28('0x47')){var _0x4c4147=_0x384797[_0xfc28('0x3d')][0x0][_0xfc28('0x48')];_0x4c4147[_0xfc28('0x3e')]=_[_0xfc28('0x41')](_0x545523[_0xfc28('0x42')])+'s';return _0x4c4147;}logger[_0xfc28('0x2d')](_0xfc28('0x3b'),JSON[_0xfc28('0xf')](data));throw new Error(_0xfc28('0x49')+JSON['stringify'](data));})[_0xfc28('0x2c')](function(_0x2f59ed){console[_0xfc28('0x4a')](_0xfc28('0x4b'),_0x2f59ed);});}function getEndUser(_0x6793de,_0x33d991,_0x32cebf,_0x147c26,_0x444701,_0x2634b6,_0x3282a8){var _0x899c58={'method':_0xfc28('0x4c'),'uri':'','headers':{'Authorization':_0xfc28('0x4d')+_0x6793de},'json':!![]};switch(_0x3282a8[_0xfc28('0x4e')]){case _0xfc28('0x4f'):_0x899c58[_0xfc28('0x50')]=_0xfc28('0x3f')+_0x33d991+_0xfc28('0x51')+_0x444701+'))';return getZohoUser(_0x899c58,_0xfc28('0x52'))['then'](function(_0x272e27){if(_0x272e27)return _0x272e27;_0x899c58[_0xfc28('0x50')]=_0xfc28('0x3f')+_0x33d991+_0xfc28('0x53')+_0x444701+'))';return getZohoUser(_0x899c58,'Leads')[_0xfc28('0x32')](function(_0x32abc4){if(_0x32abc4)return _0x32abc4;if(_0x3282a8[_0xfc28('0x42')]!=_0xfc28('0x54')){return createEndUser(_0x6793de,_0x33d991,_0x147c26,_0x444701,_0x2634b6,_0x3282a8);}else{return{};}});});break;case _0xfc28('0x55'):_0x899c58[_0xfc28('0x50')]='https://www.zohoapis.'+_0x33d991+_0xfc28('0x51')+_0x444701+'))';return getZohoUser(_0x899c58,'Contacts')[_0xfc28('0x32')](function(_0x1f572a){if(_0x1f572a)return _0x1f572a;if(_0x3282a8[_0xfc28('0x42')]!=_0xfc28('0x54')){return createEndUser(_0x6793de,_0x33d991,_0x147c26,_0x444701,_0x2634b6,_0x3282a8);}else{return{};}});break;case _0xfc28('0x56'):_0x899c58[_0xfc28('0x50')]=_0xfc28('0x3f')+_0x33d991+_0xfc28('0x53')+_0x444701+'))';return getZohoUser(_0x899c58,_0xfc28('0x57'))[_0xfc28('0x32')](function(_0x1f90df){if(_0x1f90df)return _0x1f90df;if(_0x3282a8[_0xfc28('0x42')]!=_0xfc28('0x54')){return createEndUser(_0x6793de,_0x33d991,_0x147c26,_0x444701,_0x2634b6,_0x3282a8);}else{return{};}});break;}}function getCall(_0x50d60e,_0x2c723b,_0x3204a2,_0x5c28bc,_0x351e1a,_0x498318,_0x2a6106,_0x363272){logger['info'](_0xfc28('0x58'));var _0x3eb208={};_0x3eb208[_0xfc28('0x59')]={'name':!_[_0xfc28('0x35')](_0x5c28bc['role']['name'])&&!_[_0xfc28('0x35')](_0x5c28bc[_0xfc28('0x39')]['name'])&&_0x5c28bc[_0xfc28('0x39')][_0xfc28('0x1d')]===_0xfc28('0x5a')?_0x5c28bc[_0xfc28('0x43')][_0xfc28('0x1d')]:!_['isNil'](_0x5c28bc[_0xfc28('0x44')])?_0x5c28bc[_0xfc28('0x44')]+'\x20'+_0x5c28bc['last_name']:_0x5c28bc[_0xfc28('0x45')],'id':_0x5c28bc['id']};_0x3eb208['Subject']=intUtil[_0xfc28('0x5b')](_0x498318[_0xfc28('0x5c')],_0x2a6106,'\x20');_0x3eb208[_0xfc28('0x5d')]=intUtil[_0xfc28('0x5b')](_0x498318[_0xfc28('0x5e')],_0x2a6106,'\x0a');if(_0x351e1a[_0xfc28('0x3e')]==='Contacts'){_0x3eb208[_0xfc28('0x5f')]={'name':!_[_0xfc28('0x35')](_0x351e1a[_0xfc28('0x60')])?_0x351e1a[_0xfc28('0x60')]:!_['isNil'](_0x351e1a['First_Name'])?_0x351e1a['First_Name']+'\x20'+_0x351e1a[_0xfc28('0x61')]:_0x351e1a[_0xfc28('0x61')],'id':_0x351e1a['id']};}if(_0x351e1a[_0xfc28('0x3e')]===_0xfc28('0x57')){_0x3eb208['What_Id']={'name':!_[_0xfc28('0x35')](_0x351e1a['Full_Name'])?_0x351e1a[_0xfc28('0x60')]:!_[_0xfc28('0x35')](_0x351e1a['First_Name'])?_0x351e1a[_0xfc28('0x62')]+'\x20'+_0x351e1a[_0xfc28('0x61')]:_0x351e1a[_0xfc28('0x61')],'id':_0x351e1a['id']};_0x3eb208[_0xfc28('0x63')]=_[_0xfc28('0x41')](_0x351e1a[_0xfc28('0x3e')]);}if(_0x2a6106['talktime']){_0x3eb208[_0xfc28('0x64')]=moment[_0xfc28('0x65')](parseInt(_0x2a6106[_0xfc28('0x66')])*0x3e8)[_0xfc28('0x30')](_0xfc28('0x67'));}else if(_0x2a6106[_0xfc28('0x68')]&&_0x2a6106[_0xfc28('0x69')]){_0x3eb208['Call_Duration']=moment[_0xfc28('0x65')](moment(_0x2a6106['endtime'],_0xfc28('0x6a'))[_0xfc28('0x6b')](moment(_0x2a6106[_0xfc28('0x6c')],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0x2a6106[_0xfc28('0x6d')]){case'called':_0x3eb208[_0xfc28('0x6e')]=_0xfc28('0x6f');break;case _0xfc28('0x70'):case'connect':_0x3eb208['Call_Result']=_0xfc28('0x71');break;case _0xfc28('0x72'):_0x3eb208[_0xfc28('0x6e')]='Rejected';break;case _0xfc28('0x73'):_0x3eb208[_0xfc28('0x6e')]=_0xfc28('0x74');break;case _0xfc28('0x75'):_0x3eb208['Call_Result']='Timeout';default:}_0x3eb208[_0xfc28('0x76')]=(_0x363272===_0xfc28('0x77')?moment(_0x2a6106[_0xfc28('0x6c')])['format'](_0xfc28('0x6a')):moment(_0x2a6106[_0xfc28('0x78')])[_0xfc28('0x30')](_0xfc28('0x6a')))||moment()[_0xfc28('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x3eb208[_0xfc28('0x79')]=_0x363272||_0xfc28('0x7a');_0x3eb208=_[_0xfc28('0x7b')](_0x3eb208,getCustomFields(_0x498318[_0xfc28('0x7c')],_0x2a6106));return request({'method':_0xfc28('0x29'),'uri':_0xfc28('0x3f')+_0x2c723b+_0xfc28('0x7d'),'headers':{'Authorization':_0xfc28('0x4d')+_0x50d60e},'body':{'data':[_0x3eb208]},'json':!![]})[_0xfc28('0x32')](function(_0x3b7b4c){if(_0x3b7b4c&&_0x3b7b4c[_0xfc28('0x3d')][0x0][_0xfc28('0x46')]===_0xfc28('0x47')){logger[_0xfc28('0x2f')]('Call\x20created!');return{'id':_0x3b7b4c[_0xfc28('0x3d')][0x0][_0xfc28('0x48')]['id']};}})[_0xfc28('0x2c')](function(_0x11e778){logger[_0xfc28('0x2f')](_0xfc28('0x7e'),_0x11e778[_0xfc28('0x7f')]);console[_0xfc28('0x4a')](_0xfc28('0x7e'),_0x11e778);});}exports[_0xfc28('0x80')]=function(_0xcbea2d,_0x14657e,_0x406db3,_0xdc98ee,_0x1b05a3,_0x33be9a){var _0x4f9a63,_0x8f4f8a,_0x3767e2;_0x33be9a[_0xfc28('0x81')]=intUtil[_0xfc28('0x82')](_0x33be9a[_0xfc28('0x81')]);_0x33be9a[_0xfc28('0x83')]=intUtil[_0xfc28('0x82')](_0x33be9a['serverUrl']);if(_0x1b05a3&&_0x1b05a3[_0xfc28('0x84')]){logger['info']('[QUEUE]',_0xfc28('0x85'));_0x14657e[_0xfc28('0x86')]=_0x33be9a[_0xfc28('0x83')]+_0xfc28('0x87')+_0x14657e[_0xfc28('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x14657e['uniqueid']);}else{_0x14657e[_0xfc28('0x86')]='';}var _0xdeb365=_0x33be9a[_0xfc28('0x81')]===_0xfc28('0x89')?'eu':_0xfc28('0x8a');return getAccessToken(_0x33be9a)[_0xfc28('0x32')](function(_0x2d37db){_0x3767e2=_0x2d37db;return getUser(_0x3767e2,_0xdeb365,_0x33be9a,_0xdc98ee[_0xfc28('0x8b')]);})[_0xfc28('0x32')](function(_0x2f6eba){_0x4f9a63=_0x2f6eba;logger[_0xfc28('0x2f')]('The\x20User\x20ID\x20is:',_0x4f9a63['id']);return getEndUser(_0x3767e2,_0xdeb365,_0x33be9a,_0x14657e[_0xfc28('0x8c')],_0x14657e['calleridnum'],_0x4f9a63,_0x406db3);})[_0xfc28('0x32')](function(_0x30c77a){_0x8f4f8a=_0x30c77a;return getCall(_0x3767e2,_0xdeb365,_0x33be9a,_0x4f9a63,_0x8f4f8a,_0x406db3,_0x14657e,_0xfc28('0x7a'));})[_0xfc28('0x32')](function(_0xe5f9d2){if(_0xe5f9d2){logger[_0xfc28('0x2f')](_0xfc28('0x8d'),_0xe5f9d2['id']);logger['info'](_0xfc28('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfc28('0x30')](_0xfc28('0x8f'),_0xdc98ee[_0xfc28('0x1d')]),_0xfc28('0x90'),{'uri':_0xfc28('0x91')+_0x33be9a['host']+_0xfc28('0x92')+_0xe5f9d2['id']});}})[_0xfc28('0x2c')](function(_0x23ce29){logger[_0xfc28('0x2d')](_0xfc28('0x8e'),JSON[_0xfc28('0xf')](_0x23ce29));});};exports['outbound']=function(_0x381f13,_0x135fc5,_0x53043f,_0xeda39a,_0x3d2b23,_0x16e468,_0x51cb03){var _0x2802c3,_0x24efc7,_0x37a008;_0x16e468[_0xfc28('0x81')]=intUtil[_0xfc28('0x82')](_0x16e468['host']);_0x16e468['serverUrl']=intUtil[_0xfc28('0x82')](_0x16e468[_0xfc28('0x83')]);if(_0x51cb03&&_0x51cb03['recordingFormat']&&_0x51cb03[_0xfc28('0x93')]!==_0xfc28('0x94')){logger[_0xfc28('0x2f')](_0xfc28('0x95'),_0xfc28('0x85'));_0x135fc5[_0xfc28('0x86')]=_0x16e468[_0xfc28('0x83')]+_0xfc28('0x87')+_0x135fc5[_0xfc28('0x88')]+_0xfc28('0x96')+md5(_0x135fc5[_0xfc28('0x88')]);}var _0x2c8aaf=_0x16e468[_0xfc28('0x81')]===_0xfc28('0x89')?'eu':_0xfc28('0x8a');return getAccessToken(_0x16e468)[_0xfc28('0x32')](function(_0x22c241){_0x37a008=_0x22c241;return getUser(_0x37a008,_0x2c8aaf,_0x16e468,_0xeda39a[_0xfc28('0x8b')]);})[_0xfc28('0x32')](function(_0x4a79a6){_0x2802c3=_0x4a79a6;logger[_0xfc28('0x2f')]('The\x20User\x20ID\x20is:',_0x2802c3['id']);return getEndUser(_0x37a008,_0x2c8aaf,_0x16e468,_0x135fc5[_0xfc28('0x97')],_0x135fc5['destcalleridnum'],_0x2802c3,_0x53043f);})[_0xfc28('0x32')](function(_0xc54678){_0x24efc7=_0xc54678;return getCall(_0x37a008,_0x2c8aaf,_0x16e468,_0x2802c3,_0x24efc7,_0x53043f,_0x135fc5,_0xfc28('0x98'));})['then'](function(_0x390e42){if(_0x390e42){logger['info'](_0xfc28('0x8d'),_0x390e42['id']);logger['info'](_0xfc28('0x95'),_0xfc28('0x99'));emit(util[_0xfc28('0x30')](_0xfc28('0x8f'),_0xeda39a['name']),'trigger:browser:url',{'uri':_0xfc28('0x91')+_0x16e468['host']+_0xfc28('0x92')+_0x390e42['id']});}})[_0xfc28('0x2c')](function(_0x46514c){logger[_0xfc28('0x2d')](_0xfc28('0x95'),JSON[_0xfc28('0xf')](_0x46514c));});};exports[_0xfc28('0x9a')]=function(_0x632751,_0x571bfc,_0x367c08,_0x178195,_0x2ed495,_0x4092df){var _0x204cb1,_0x26c2f1,_0x207c21;_0x4092df[_0xfc28('0x81')]=intUtil[_0xfc28('0x82')](_0x4092df['host']);_0x4092df['serverUrl']=intUtil[_0xfc28('0x82')](_0x4092df[_0xfc28('0x83')]);if(_0x2ed495&&_0x2ed495[_0xfc28('0x84')]){logger[_0xfc28('0x2f')]('['+_0x571bfc[_0xfc28('0x6d')][_0xfc28('0x9b')]()+']',_0xfc28('0x85'));_0x571bfc[_0xfc28('0x86')]=_0x4092df['serverUrl']+_0xfc28('0x87')+_0x571bfc['uniqueid']+_0xfc28('0x96')+md5(_0x571bfc[_0xfc28('0x88')]);}else{_0x571bfc['recordingURL']='';}var _0x15af62=_0x4092df[_0xfc28('0x81')]==='zoho.eu'?'eu':_0xfc28('0x8a');return getAccessToken(_0x4092df)[_0xfc28('0x32')](function(_0x657336){_0x207c21=_0x657336;return getUser(_0x207c21,_0x15af62,_0x4092df);})[_0xfc28('0x32')](function(_0x37c1d6){_0x204cb1=_0x37c1d6;logger['info'](_0xfc28('0x9c'),_0x204cb1['id']);return getEndUser(_0x207c21,_0x15af62,_0x4092df,_0x571bfc[_0xfc28('0x8c')],_0x571bfc[_0xfc28('0x9d')],_0x204cb1,_0x367c08);})[_0xfc28('0x32')](function(_0x27f0a4){_0x26c2f1=_0x27f0a4;return getCall(_0x207c21,_0x15af62,_0x4092df,_0x204cb1,_0x26c2f1,_0x367c08,_0x571bfc,_0xfc28('0x7a'));})[_0xfc28('0x32')](function(_0x549316){if(_0x549316){logger[_0xfc28('0x2f')](_0xfc28('0x8d'),_0x549316['id']);}})[_0xfc28('0x2c')](function(_0x4d54c6){logger[_0xfc28('0x2d')]('['+_0x571bfc[_0xfc28('0x6d')][_0xfc28('0x9b')]()+']',JSON[_0xfc28('0xf')](_0x4d54c6));});}; \ No newline at end of file +var _0xfe58=['trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','Outbound','unmanaged','monitor_format','toUpperCase','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','debug','[HTTP]','picklist','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','lastevent','called','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x5a0b03,_0x30f4ff){var _0x23f9f7=function(_0x41336d){while(--_0x41336d){_0x5a0b03['push'](_0x5a0b03['shift']());}};_0x23f9f7(++_0x30f4ff);}(_0xfe58,0x1cf));var _0x8fe5=function(_0x36bf73,_0x38b67e){_0x36bf73=_0x36bf73-0x0;var _0x4a4d84=_0xfe58[_0x36bf73];return _0x4a4d84;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x8fe5('0x0'));var util=require(_0x8fe5('0x1'));var intUtil=require(_0x8fe5('0x2'));var moment=require(_0x8fe5('0x3'));var Redis=require('ioredis');var BPromise=require(_0x8fe5('0x4'));var config=require(_0x8fe5('0x5'));var logger=require(_0x8fe5('0x6'))(_0x8fe5('0x7'));config[_0x8fe5('0x8')]=_['defaults'](config['redis'],{'host':_0x8fe5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8fe5('0x8')]));function emit(_0x5aaafe,_0x3b53a1,_0x4445b9){io['to'](_0x5aaafe)['emit'](_0x3b53a1,_0x4445b9);}function request(_0x35ffe2){logger[_0x8fe5('0xa')](_0x8fe5('0xb'),JSON['stringify'](_0x35ffe2));return rp(_0x35ffe2);}function getCustomFields(_0x4106c9,_0x313cd1){var _0x1fbe35={};if(_0x4106c9['length']>0x0){_['forEach'](_0x4106c9,function(_0xa199cb){if(_['includes'](['string',_0x8fe5('0xc')],_0xa199cb[_0x8fe5('0xd')])&&_0xa199cb[_0x8fe5('0xe')]){_0x1fbe35[_0xa199cb['idField']]=_0xa199cb[_0x8fe5('0xf')]['toString']();}else if(_0xa199cb[_0x8fe5('0xd')]===_0x8fe5('0x10')&&_0xa199cb[_0x8fe5('0x11')]&&_0xa199cb['idField']&&_0x313cd1[_0xa199cb[_0x8fe5('0x11')]]){_0x1fbe35[_0xa199cb[_0x8fe5('0xe')]]=_0x313cd1[_0xa199cb['variableName']][_0x8fe5('0x12')]();}else if(_0xa199cb[_0x8fe5('0xd')]==='customVariable'&&_0xa199cb[_0x8fe5('0x13')]&&_0xa199cb[_0x8fe5('0x13')][_0x8fe5('0x14')]&&_0xa199cb['idField']&&_0x313cd1[_0xa199cb[_0x8fe5('0x13')][_0x8fe5('0x14')]['toLowerCase']()]){_0x1fbe35[_0xa199cb[_0x8fe5('0xe')]]=_0x313cd1[_0xa199cb[_0x8fe5('0x13')][_0x8fe5('0x14')][_0x8fe5('0x15')]()][_0x8fe5('0x12')]();}});}return _0x1fbe35;}function getName(_0x3e0ab8){if(_0x3e0ab8[_0x8fe5('0x16')]('\x20')>0x0){var _0x2b1f5e=_0x3e0ab8['split'](/ (.+)/);if(_0x2b1f5e[0x1]){return _0x2b1f5e;}}return[_0x3e0ab8,_0x3e0ab8];}var accountsTokens={};function getAccessToken(_0x2fe4f2){return new Promise(function(_0x2fbdc2,_0x3641e2){if(!_[_0x8fe5('0x17')](accountsTokens[_0x2fe4f2['id']])&&!_[_0x8fe5('0x17')](accountsTokens[_0x2fe4f2['id']]['access_token'])){if(moment()[_0x8fe5('0x18')](accountsTokens[_0x2fe4f2['id']][_0x8fe5('0x19')])){_0x2fbdc2(accountsTokens[_0x2fe4f2['id']][_0x8fe5('0x1a')]);}}var _0x1cd8c9;switch(_0x2fe4f2[_0x8fe5('0x1b')]){case'US':_0x1cd8c9=_0x8fe5('0x1c');break;case'AU':_0x1cd8c9=_0x8fe5('0x1d');break;case'EU':_0x1cd8c9='https://accounts.zoho.eu';break;case'IN':_0x1cd8c9=_0x8fe5('0x1e');break;case'CN':_0x1cd8c9=_0x8fe5('0x1f');break;default:_0x1cd8c9='https://accounts.zoho.eu';break;}var _0x1efddd={'method':_0x8fe5('0x20'),'uri':_0x1cd8c9+_0x8fe5('0x21'),'qs':{'refresh_token':_0x2fe4f2[_0x8fe5('0x22')],'client_id':_0x2fe4f2[_0x8fe5('0x23')],'client_secret':_0x2fe4f2[_0x8fe5('0x24')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1efddd)[_0x8fe5('0x25')](function(_0x2916b8){accountsTokens[_0x2fe4f2['id']]={'access_token':_0x2916b8['access_token'],'expires_in':moment()[_0x8fe5('0x26')](_0x2916b8[_0x8fe5('0x19')],_0x8fe5('0x27'))};_0x2fbdc2(_0x2916b8[_0x8fe5('0x1a')]);})[_0x8fe5('0x28')](function(_0x2768da){logger[_0x8fe5('0x29')]('Failing\x20creating\x20the\x20access_token',_0x2768da['stack']);_0x3641e2(_0x2768da);});});}function getUser(_0x49e236,_0x6b00e9,_0x4424a5,_0x10e7f7){logger[_0x8fe5('0x2a')](_0x8fe5('0x2b'));return request({'method':_0x8fe5('0x2c'),'uri':util[_0x8fe5('0x2d')](_0x8fe5('0x2e'),_0x6b00e9),'qs':{'type':_0x8fe5('0x2f')},'headers':{'Authorization':_0x8fe5('0x30')+_0x49e236},'json':!![]})[_0x8fe5('0x25')](function(_0x582ef4){if(_0x582ef4[_0x8fe5('0x31')]){var _0xd9358d=-0x1;if(_[_0x8fe5('0x32')](_0x582ef4[_0x8fe5('0x31')])){if(!_[_0x8fe5('0x17')](_0x10e7f7)){_0xd9358d=_[_0x8fe5('0x33')](_0x582ef4[_0x8fe5('0x31')],function(_0x55bf08){return _0x55bf08[_0x8fe5('0x34')]===_0x10e7f7;});}if(_0xd9358d>=0x0){logger['info']('Agent\x20found!');}else{logger['info'](_0x8fe5('0x35'));_0xd9358d=_[_0x8fe5('0x33')](_0x582ef4[_0x8fe5('0x31')],function(_0x333a9b){return _0x333a9b[_0x8fe5('0x36')]['name']===_0x8fe5('0x37');});}return _0x582ef4[_0x8fe5('0x31')][_0xd9358d];}else{if(_0x582ef4[_0x8fe5('0x38')]['profile'][_0x8fe5('0x14')]==='Administrator'){logger['info'](_0x8fe5('0x35'));user=_0x582ef4[_0x8fe5('0x38')];return user;}else{logger[_0x8fe5('0x29')](_0x8fe5('0x39'),JSON[_0x8fe5('0x3a')](_0x582ef4));throw new Error(_0x8fe5('0x3b')+JSON['stringify'](_0x582ef4));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x8fe5('0x3a')](_0x582ef4));throw new Error(_0x8fe5('0x3b')+JSON[_0x8fe5('0x3a')](_0x582ef4));}})[_0x8fe5('0x28')](function(_0xd08498){console[_0x8fe5('0x29')](_0xd08498);});}function getZohoUser(_0x465611,_0x2b9cad){return new BPromise(function(_0x1ae244,_0x371c47){request(_0x465611)[_0x8fe5('0x25')](function(_0x2a2b13){var _0x56acd7=null;if(_0x2a2b13){_0x56acd7=_0x2a2b13[_0x8fe5('0x3c')][0x0];_0x56acd7[_0x8fe5('0x3d')]=_0x2b9cad;}_0x1ae244(_0x56acd7);})[_0x8fe5('0x28')](function(_0x5d2fbd){_0x371c47(_0x5d2fbd);});});}function createEndUser(_0x5a7095,_0x4eafff,_0xd03942,_0x59259d,_0x4c6250,_0x5823b8){var _0xd03942=getName(_0xd03942);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x4eafff+_0x8fe5('0x3e')+_[_0x8fe5('0x3f')](_0x5823b8[_0x8fe5('0x40')])+'s','body':{'data':[{'Last_Name':_0xd03942[0x1],'First_Name':_0xd03942[0x0],'Phone':_0x59259d,'Owner':{'name':!_[_0x8fe5('0x17')](_0x4c6250['role'][_0x8fe5('0x14')])?_0x4c6250[_0x8fe5('0x41')][_0x8fe5('0x14')]:!_[_0x8fe5('0x17')](_0x4c6250[_0x8fe5('0x42')])?_0x4c6250[_0x8fe5('0x42')]+'\x20'+_0x4c6250[_0x8fe5('0x43')]:_0x4c6250['last_name'],'id':_0x4c6250['id']}}]},'headers':{'Authorization':_0x8fe5('0x30')+_0x5a7095},'json':!![]})['then'](function(_0x34d6d6){if(_0x34d6d6&&_0x34d6d6[_0x8fe5('0x3c')][0x0]['code']===_0x8fe5('0x44')){var _0x2f800a=_0x34d6d6['data'][0x0][_0x8fe5('0x45')];_0x2f800a[_0x8fe5('0x3d')]=_['startCase'](_0x5823b8[_0x8fe5('0x40')])+'s';return _0x2f800a;}logger[_0x8fe5('0x29')](_0x8fe5('0x39'),JSON[_0x8fe5('0x3a')](data));throw new Error(_0x8fe5('0x46')+JSON[_0x8fe5('0x3a')](data));})['catch'](function(_0xec92f1){console['log'](_0x8fe5('0x47'),_0xec92f1);});}function getEndUser(_0x1c31d6,_0x12f59f,_0x50cc12,_0x5b1434,_0x25a8fe,_0x2d0acd,_0x52bd87){var _0x3f7bfe={'method':_0x8fe5('0x2c'),'uri':'','headers':{'Authorization':_0x8fe5('0x30')+_0x1c31d6},'json':!![]};switch(_0x52bd87[_0x8fe5('0x48')]){case _0x8fe5('0x49'):_0x3f7bfe[_0x8fe5('0x4a')]=_0x8fe5('0x4b')+_0x12f59f+_0x8fe5('0x4c')+_0x25a8fe+'))';return getZohoUser(_0x3f7bfe,_0x8fe5('0x4d'))[_0x8fe5('0x25')](function(_0x49c778){if(_0x49c778)return _0x49c778;_0x3f7bfe[_0x8fe5('0x4a')]='https://www.zohoapis.'+_0x12f59f+_0x8fe5('0x4e')+_0x25a8fe+'))';return getZohoUser(_0x3f7bfe,_0x8fe5('0x4f'))[_0x8fe5('0x25')](function(_0x471d71){if(_0x471d71)return _0x471d71;if(_0x52bd87[_0x8fe5('0x40')]!='nothing'){return createEndUser(_0x1c31d6,_0x12f59f,_0x5b1434,_0x25a8fe,_0x2d0acd,_0x52bd87);}else{return{};}});});break;case'contact':_0x3f7bfe[_0x8fe5('0x4a')]=_0x8fe5('0x4b')+_0x12f59f+_0x8fe5('0x4c')+_0x25a8fe+'))';return getZohoUser(_0x3f7bfe,'Contacts')[_0x8fe5('0x25')](function(_0x17cf6a){if(_0x17cf6a)return _0x17cf6a;if(_0x52bd87[_0x8fe5('0x40')]!=_0x8fe5('0x50')){return createEndUser(_0x1c31d6,_0x12f59f,_0x5b1434,_0x25a8fe,_0x2d0acd,_0x52bd87);}else{return{};}});break;case'lead':_0x3f7bfe[_0x8fe5('0x4a')]='https://www.zohoapis.'+_0x12f59f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x25a8fe+'))';return getZohoUser(_0x3f7bfe,'Leads')[_0x8fe5('0x25')](function(_0x45e8a9){if(_0x45e8a9)return _0x45e8a9;if(_0x52bd87[_0x8fe5('0x40')]!=_0x8fe5('0x50')){return createEndUser(_0x1c31d6,_0x12f59f,_0x5b1434,_0x25a8fe,_0x2d0acd,_0x52bd87);}else{return{};}});break;}}function getCall(_0x490db2,_0x56264d,_0xab6c08,_0x358552,_0x1f87d3,_0x2f8fc5,_0xa207c4,_0xcc6cc8){logger[_0x8fe5('0x2a')](_0x8fe5('0x51'));var _0x40f0f2={};_0x40f0f2[_0x8fe5('0x52')]={'name':!_[_0x8fe5('0x17')](_0x358552[_0x8fe5('0x41')][_0x8fe5('0x14')])&&!_['isNil'](_0x358552[_0x8fe5('0x36')][_0x8fe5('0x14')])&&_0x358552[_0x8fe5('0x36')]['name']==='administrator'?_0x358552['role']['name']:!_['isNil'](_0x358552[_0x8fe5('0x42')])?_0x358552[_0x8fe5('0x42')]+'\x20'+_0x358552[_0x8fe5('0x43')]:_0x358552[_0x8fe5('0x43')],'id':_0x358552['id']};_0x40f0f2['Subject']=intUtil['getString'](_0x2f8fc5[_0x8fe5('0x53')],_0xa207c4,'\x20');_0x40f0f2[_0x8fe5('0x54')]=intUtil['getString'](_0x2f8fc5[_0x8fe5('0x55')],_0xa207c4,'\x0a');if(_0x1f87d3[_0x8fe5('0x3d')]===_0x8fe5('0x4d')){_0x40f0f2[_0x8fe5('0x56')]={'name':!_[_0x8fe5('0x17')](_0x1f87d3[_0x8fe5('0x57')])?_0x1f87d3['Full_Name']:!_[_0x8fe5('0x17')](_0x1f87d3['First_Name'])?_0x1f87d3[_0x8fe5('0x58')]+'\x20'+_0x1f87d3[_0x8fe5('0x59')]:_0x1f87d3[_0x8fe5('0x59')],'id':_0x1f87d3['id']};}if(_0x1f87d3[_0x8fe5('0x3d')]==='Leads'){_0x40f0f2[_0x8fe5('0x5a')]={'name':!_[_0x8fe5('0x17')](_0x1f87d3[_0x8fe5('0x57')])?_0x1f87d3[_0x8fe5('0x57')]:!_[_0x8fe5('0x17')](_0x1f87d3['First_Name'])?_0x1f87d3[_0x8fe5('0x58')]+'\x20'+_0x1f87d3['Last_Name']:_0x1f87d3[_0x8fe5('0x59')],'id':_0x1f87d3['id']};_0x40f0f2[_0x8fe5('0x5b')]=_[_0x8fe5('0x3f')](_0x1f87d3[_0x8fe5('0x3d')]);}if(_0xa207c4[_0x8fe5('0x5c')]){_0x40f0f2[_0x8fe5('0x5d')]=moment[_0x8fe5('0x5e')](parseInt(_0xa207c4['talktime'])*0x3e8)[_0x8fe5('0x2d')]('mm:ss');}else if(_0xa207c4[_0x8fe5('0x5f')]&&_0xa207c4['endtime']){_0x40f0f2['Call_Duration']=moment[_0x8fe5('0x5e')](moment(_0xa207c4[_0x8fe5('0x60')],_0x8fe5('0x61'))[_0x8fe5('0x62')](moment(_0xa207c4['starttime'],_0x8fe5('0x61'))))['format'](_0x8fe5('0x63'));}switch(_0xa207c4[_0x8fe5('0x64')]){case _0x8fe5('0x65'):_0x40f0f2[_0x8fe5('0x66')]='Called';break;case'complete':case'connect':_0x40f0f2['Call_Result']=_0x8fe5('0x67');break;case _0x8fe5('0x68'):_0x40f0f2['Call_Result']=_0x8fe5('0x69');break;case _0x8fe5('0x6a'):_0x40f0f2[_0x8fe5('0x66')]=_0x8fe5('0x6b');break;case _0x8fe5('0x6c'):_0x40f0f2[_0x8fe5('0x66')]=_0x8fe5('0x6d');default:}_0x40f0f2['Call_Start_Time']=(_0xcc6cc8==='outbound'?moment(_0xa207c4[_0x8fe5('0x6e')])[_0x8fe5('0x2d')]('YYYY-MM-DDTHH:mm:ss'):moment(_0xa207c4[_0x8fe5('0x6f')])['format'](_0x8fe5('0x61')))||moment()[_0x8fe5('0x2d')](_0x8fe5('0x61'));_0x40f0f2[_0x8fe5('0x70')]=_0xcc6cc8||_0x8fe5('0x71');_0x40f0f2=_['merge'](_0x40f0f2,getCustomFields(_0x2f8fc5[_0x8fe5('0x72')],_0xa207c4));return request({'method':_0x8fe5('0x20'),'uri':_0x8fe5('0x4b')+_0x56264d+_0x8fe5('0x73'),'headers':{'Authorization':_0x8fe5('0x30')+_0x490db2},'body':{'data':[_0x40f0f2]},'json':!![]})[_0x8fe5('0x25')](function(_0xb0de31){if(_0xb0de31&&_0xb0de31[_0x8fe5('0x3c')][0x0][_0x8fe5('0x74')]==='SUCCESS'){logger['info'](_0x8fe5('0x75'));return{'id':_0xb0de31['data'][0x0][_0x8fe5('0x45')]['id']};}})[_0x8fe5('0x28')](function(_0x5139ff){logger[_0x8fe5('0x2a')](_0x8fe5('0x76'),_0x5139ff['stack']);console[_0x8fe5('0x77')]('err',_0x5139ff);});}exports[_0x8fe5('0x78')]=function(_0x34b2b9,_0x317bb4,_0x1aa811,_0x528d72,_0x994f82,_0x2215df){var _0x151559,_0x29ce20,_0x3d32f8;_0x2215df[_0x8fe5('0x79')]=intUtil['stripTrailingSlash'](_0x2215df['host']);_0x2215df['serverUrl']=intUtil[_0x8fe5('0x7a')](_0x2215df[_0x8fe5('0x7b')]);if(_0x994f82&&_0x994f82['monitor_format']){logger[_0x8fe5('0x2a')]('[QUEUE]',_0x8fe5('0x7c'));_0x317bb4[_0x8fe5('0x7d')]=_0x2215df[_0x8fe5('0x7b')]+_0x8fe5('0x7e')+_0x317bb4[_0x8fe5('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x317bb4[_0x8fe5('0x7f')]);}else{_0x317bb4[_0x8fe5('0x7d')]='';}var _0x773e3b=_0x2215df['host']===_0x8fe5('0x80')?'eu':_0x8fe5('0x81');return getAccessToken(_0x2215df)['then'](function(_0x54cfda){_0x3d32f8=_0x54cfda;return getUser(_0x3d32f8,_0x773e3b,_0x2215df,_0x528d72['email']);})['then'](function(_0x445477){_0x151559=_0x445477;logger[_0x8fe5('0x2a')](_0x8fe5('0x82'),_0x151559['id']);return getEndUser(_0x3d32f8,_0x773e3b,_0x2215df,_0x317bb4[_0x8fe5('0x83')],_0x317bb4[_0x8fe5('0x84')],_0x151559,_0x1aa811);})['then'](function(_0x1876ed){_0x29ce20=_0x1876ed;return getCall(_0x3d32f8,_0x773e3b,_0x2215df,_0x151559,_0x29ce20,_0x1aa811,_0x317bb4,'Inbound');})[_0x8fe5('0x25')](function(_0x55ed52){if(_0x55ed52){logger[_0x8fe5('0x2a')](_0x8fe5('0x85'),_0x55ed52['id']);logger[_0x8fe5('0x2a')](_0x8fe5('0x86'),_0x8fe5('0x87'));emit(util[_0x8fe5('0x2d')](_0x8fe5('0x88'),_0x528d72[_0x8fe5('0x14')]),_0x8fe5('0x89'),{'uri':_0x8fe5('0x8a')+_0x2215df[_0x8fe5('0x79')]+_0x8fe5('0x8b')+_0x55ed52['id']});}})[_0x8fe5('0x28')](function(_0x1a10bc){logger[_0x8fe5('0x29')](_0x8fe5('0x86'),JSON['stringify'](_0x1a10bc));});};exports[_0x8fe5('0x8c')]=function(_0x27beb1,_0x36b35a,_0xfa2ed7,_0x13ae68,_0x15f941,_0xdcd7ae,_0x5e9491){var _0xaef08a,_0x79b167,_0x291b71;_0xdcd7ae[_0x8fe5('0x79')]=intUtil['stripTrailingSlash'](_0xdcd7ae[_0x8fe5('0x79')]);_0xdcd7ae[_0x8fe5('0x7b')]=intUtil[_0x8fe5('0x7a')](_0xdcd7ae['serverUrl']);if(_0x5e9491&&_0x5e9491[_0x8fe5('0x8d')]&&_0x5e9491[_0x8fe5('0x8d')]!==_0x8fe5('0x8e')){logger['info'](_0x8fe5('0x8f'),_0x8fe5('0x7c'));_0x36b35a['recordingURL']=_0xdcd7ae['serverUrl']+_0x8fe5('0x7e')+_0x36b35a[_0x8fe5('0x7f')]+_0x8fe5('0x90')+md5(_0x36b35a[_0x8fe5('0x7f')]);}var _0x20befc=_0xdcd7ae[_0x8fe5('0x79')]===_0x8fe5('0x80')?'eu':_0x8fe5('0x81');return getAccessToken(_0xdcd7ae)[_0x8fe5('0x25')](function(_0x5c41d8){_0x291b71=_0x5c41d8;return getUser(_0x291b71,_0x20befc,_0xdcd7ae,_0x13ae68[_0x8fe5('0x34')]);})[_0x8fe5('0x25')](function(_0x5ca41e){_0xaef08a=_0x5ca41e;logger['info'](_0x8fe5('0x82'),_0xaef08a['id']);return getEndUser(_0x291b71,_0x20befc,_0xdcd7ae,_0x36b35a[_0x8fe5('0x91')],_0x36b35a['destcalleridnum'],_0xaef08a,_0xfa2ed7);})['then'](function(_0x5d3910){_0x79b167=_0x5d3910;return getCall(_0x291b71,_0x20befc,_0xdcd7ae,_0xaef08a,_0x79b167,_0xfa2ed7,_0x36b35a,_0x8fe5('0x92'));})[_0x8fe5('0x25')](function(_0x2f6439){if(_0x2f6439){logger[_0x8fe5('0x2a')](_0x8fe5('0x85'),_0x2f6439['id']);logger[_0x8fe5('0x2a')](_0x8fe5('0x8f'),_0x8fe5('0x87'));emit(util[_0x8fe5('0x2d')](_0x8fe5('0x88'),_0x13ae68[_0x8fe5('0x14')]),_0x8fe5('0x89'),{'uri':_0x8fe5('0x8a')+_0xdcd7ae[_0x8fe5('0x79')]+_0x8fe5('0x8b')+_0x2f6439['id']});}})['catch'](function(_0x307b25){logger['error']('[OUTBOUND]',JSON[_0x8fe5('0x3a')](_0x307b25));});};exports[_0x8fe5('0x93')]=function(_0x1a723b,_0x20571f,_0x3afab2,_0x3c6875,_0x2df77a,_0x3772a2){var _0x16c123,_0x225ff5,_0x3e7e4d;_0x3772a2[_0x8fe5('0x79')]=intUtil[_0x8fe5('0x7a')](_0x3772a2[_0x8fe5('0x79')]);_0x3772a2[_0x8fe5('0x7b')]=intUtil[_0x8fe5('0x7a')](_0x3772a2[_0x8fe5('0x7b')]);if(_0x2df77a&&_0x2df77a[_0x8fe5('0x94')]){logger[_0x8fe5('0x2a')]('['+_0x20571f[_0x8fe5('0x64')][_0x8fe5('0x95')]()+']','Recording\x20is\x20enabled!');_0x20571f[_0x8fe5('0x7d')]=_0x3772a2[_0x8fe5('0x7b')]+_0x8fe5('0x7e')+_0x20571f[_0x8fe5('0x7f')]+_0x8fe5('0x90')+md5(_0x20571f[_0x8fe5('0x7f')]);}else{_0x20571f[_0x8fe5('0x7d')]='';}var _0x35ebed=_0x3772a2['host']===_0x8fe5('0x80')?'eu':_0x8fe5('0x81');return getAccessToken(_0x3772a2)[_0x8fe5('0x25')](function(_0x2eda55){_0x3e7e4d=_0x2eda55;return getUser(_0x3e7e4d,_0x35ebed,_0x3772a2);})['then'](function(_0x2834c1){_0x16c123=_0x2834c1;logger[_0x8fe5('0x2a')](_0x8fe5('0x82'),_0x16c123['id']);return getEndUser(_0x3e7e4d,_0x35ebed,_0x3772a2,_0x20571f[_0x8fe5('0x83')],_0x20571f[_0x8fe5('0x84')],_0x16c123,_0x3afab2);})['then'](function(_0x7208d1){_0x225ff5=_0x7208d1;return getCall(_0x3e7e4d,_0x35ebed,_0x3772a2,_0x16c123,_0x225ff5,_0x3afab2,_0x20571f,_0x8fe5('0x71'));})['then'](function(_0x4ca691){if(_0x4ca691){logger[_0x8fe5('0x2a')]('The\x20Call\x20ID\x20is:',_0x4ca691['id']);}})['catch'](function(_0x3837b8){logger[_0x8fe5('0x29')]('['+_0x20571f[_0x8fe5('0x64')][_0x8fe5('0x95')]()+']',JSON[_0x8fe5('0x3a')](_0x3837b8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index f2f3b60..ebd58c5 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e1b=['shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3','render','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x3ae89c,_0x4bc1d3){var _0x54df34=function(_0x196622){while(--_0x196622){_0x3ae89c['push'](_0x3ae89c['shift']());}};_0x54df34(++_0x4bc1d3);}(_0x3e1b,0xfd));var _0xb3e1=function(_0x16c8c3,_0xf6e313){_0x16c8c3=_0x16c8c3-0x0;var _0x45e5bd=_0x3e1b[_0x16c8c3];return _0x45e5bd;};'use strict';var util=require('util');var sh=require(_0xb3e1('0x0'));var Mustache=require(_0xb3e1('0x1'));var logger=require(_0xb3e1('0x2'))(_0xb3e1('0x3'));exports[_0xb3e1('0x4')]=function(_0x339eb9,_0x3ced63){var _0x8458fa=_0x339eb9['data2']?_0x339eb9[_0xb3e1('0x5')]:'Script';var _0x5566f6=_0x339eb9[_0xb3e1('0x6')]?Mustache[_0xb3e1('0x7')](_0x339eb9[_0xb3e1('0x6')],_0x3ced63):_0x3ced63;sh[_0xb3e1('0x4')](_0x5566f6,function(_0x49a94b,_0x1ba7fd,_0x5ba24b){if(_0x49a94b!==0x0){logger['error'](util['format'](_0xb3e1('0x8'),_0x8458fa,_0x5566f6,_0x49a94b,_0x5ba24b));}else{logger[_0xb3e1('0x9')](util['format'](_0xb3e1('0xa'),_0x8458fa,_0x5566f6,_0x1ba7fd));}});}; \ No newline at end of file +var _0xe87b=['error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec'];(function(_0x107546,_0x1ebc88){var _0x548fbb=function(_0x3bd8a2){while(--_0x3bd8a2){_0x107546['push'](_0x107546['shift']());}};_0x548fbb(++_0x1ebc88);}(_0xe87b,0x1d2));var _0xbe87=function(_0x489d6b,_0x3610ec){_0x489d6b=_0x489d6b-0x0;var _0x19ea67=_0xe87b[_0x489d6b];return _0x19ea67;};'use strict';var util=require(_0xbe87('0x0'));var sh=require(_0xbe87('0x1'));var Mustache=require(_0xbe87('0x2'));var logger=require(_0xbe87('0x3'))(_0xbe87('0x4'));exports['exec']=function(_0xb67e52,_0x5a4a47){var _0x1c0e14=_0xb67e52[_0xbe87('0x5')]?_0xb67e52[_0xbe87('0x5')]:_0xbe87('0x6');var _0x11d79f=_0xb67e52[_0xbe87('0x7')]?Mustache[_0xbe87('0x8')](_0xb67e52[_0xbe87('0x7')],_0x5a4a47):_0x5a4a47;sh[_0xbe87('0x9')](_0x11d79f,function(_0x4ddff5,_0xc27bba,_0x5d5c02){if(_0x4ddff5!==0x0){logger[_0xbe87('0xa')](util[_0xbe87('0xb')](_0xbe87('0xc'),_0x1c0e14,_0x11d79f,_0x4ddff5,_0x5d5c02));}else{logger[_0xbe87('0xd')](util[_0xbe87('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1c0e14,_0x11d79f,_0xc27bba));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index a529b78..f597afc 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6401=['request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','error','stack','GET','DELETE','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','message'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x6401,0x1d1));var _0x1640=function(_0x3e7e16,_0x41b32c){_0x3e7e16=_0x3e7e16-0x0;var _0xc7c395=_0x6401[_0x3e7e16];return _0xc7c395;};'use strict';var rp=require(_0x1640('0x0'));var util=require(_0x1640('0x1'));var _=require(_0x1640('0x2'));var Mustache=require(_0x1640('0x3'));var logger=require('../../../../config/logger')(_0x1640('0x4'));exports[_0x1640('0x5')]=function(_0x57d0b9,_0xcef349){var _0x4a6c1b,_0x217db2;var _0x4f4942={'method':_0x57d0b9[_0x1640('0x6')][_0x1640('0x7')](),'uri':Mustache[_0x1640('0x8')](_0x57d0b9[_0x1640('0x9')],_0xcef349),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x57d0b9[_0x1640('0xa')])===_0x1640('0xb')&&parseInt(_0x57d0b9[_0x1640('0xa')])>=0x1&&parseInt(_0x57d0b9[_0x1640('0xa')])<=0xa?parseInt(_0x57d0b9['data5'])*0x3e8:0x5*0x3e8};try{_0x4f4942[_0x1640('0xc')]=_0x57d0b9['data6']?JSON['parse'](Mustache[_0x1640('0x8')](_0x57d0b9['data6'],_0xcef349)):{};}catch(_0xea69b0){logger[_0x1640('0xd')](_0xea69b0[_0x1640('0xe')]);}switch(_0x57d0b9[_0x1640('0x6')][_0x1640('0x7')]()){case _0x1640('0xf'):case _0x1640('0x10'):_0x4a6c1b=null;_0x4f4942['qs']=_0xcef349;break;case'POST':case'PUT':if(_0x57d0b9['data7']){try{_0x4a6c1b=JSON[_0x1640('0x11')](Mustache[_0x1640('0x8')](_0x57d0b9[_0x1640('0x12')],_0xcef349));_0x4f4942[_0x1640('0x13')]=_0x4a6c1b;}catch(_0x58bfe1){logger['error'](_0x58bfe1[_0x1640('0xe')]);logger[_0x1640('0xd')](_0x1640('0x14'));}}else{_0x4a6c1b=_0xcef349;_0x4f4942['body']=_0x4a6c1b;}break;}logger[_0x1640('0x15')](util[_0x1640('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x57d0b9[_0x1640('0x6')],_0x57d0b9[_0x1640('0x9')],JSON[_0x1640('0x17')](_0x4f4942)));rp(_0x4f4942)[_0x1640('0x18')](function(_0x2a051e){_0x4a6c1b=!_[_0x1640('0x19')](_0x4a6c1b)?_0x1640('0x1a')+_0x4a6c1b:'';_0x217db2=typeof _0x2a051e[_0x1640('0x13')]==='object'?JSON[_0x1640('0x17')](_0x2a051e[_0x1640('0x13')]):_0x2a051e[_0x1640('0x13')];logger[_0x1640('0x15')](util[_0x1640('0x16')](_0x1640('0x1b'),_0x57d0b9[_0x1640('0x6')],_0x57d0b9[_0x1640('0x9')],_0x2a051e[_0x1640('0x1c')],_0x217db2));})['catch'](function(_0x596001){logger['error'](util[_0x1640('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x57d0b9[_0x1640('0x6')],_0x57d0b9[_0x1640('0x9')],_0x596001[_0x1640('0x1c')],_0x596001[_0x1640('0x1d')],_0x596001[_0x1640('0x1e')]));});}; \ No newline at end of file +var _0xa684=['render','data2','data5','number','parse','data6','error','data1','toUpperCase','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','catch','name','request-promise','util','lodash','trigger','exec'];(function(_0x58768,_0x59c62a){var _0x374179=function(_0x42e28e){while(--_0x42e28e){_0x58768['push'](_0x58768['shift']());}};_0x374179(++_0x59c62a);}(_0xa684,0xfb));var _0x4a68=function(_0x4ad917,_0x446f0e){_0x4ad917=_0x4ad917-0x0;var _0x7515e6=_0xa684[_0x4ad917];return _0x7515e6;};'use strict';var rp=require(_0x4a68('0x0'));var util=require(_0x4a68('0x1'));var _=require(_0x4a68('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x4a68('0x3'));exports[_0x4a68('0x4')]=function(_0x42f4fd,_0x5affce){var _0x4503a3,_0x4add69;var _0x80b2ff={'method':_0x42f4fd['data1']['toUpperCase'](),'uri':Mustache[_0x4a68('0x5')](_0x42f4fd[_0x4a68('0x6')],_0x5affce),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x42f4fd[_0x4a68('0x7')])===_0x4a68('0x8')&&parseInt(_0x42f4fd[_0x4a68('0x7')])>=0x1&&parseInt(_0x42f4fd[_0x4a68('0x7')])<=0xa?parseInt(_0x42f4fd['data5'])*0x3e8:0x5*0x3e8};try{_0x80b2ff['headers']=_0x42f4fd['data6']?JSON[_0x4a68('0x9')](Mustache[_0x4a68('0x5')](_0x42f4fd[_0x4a68('0xa')],_0x5affce)):{};}catch(_0x27883b){logger[_0x4a68('0xb')](_0x27883b['stack']);}switch(_0x42f4fd[_0x4a68('0xc')][_0x4a68('0xd')]()){case _0x4a68('0xe'):case _0x4a68('0xf'):_0x4503a3=null;_0x80b2ff['qs']=_0x5affce;break;case _0x4a68('0x10'):case _0x4a68('0x11'):if(_0x42f4fd['data7']){try{_0x4503a3=JSON[_0x4a68('0x9')](Mustache[_0x4a68('0x5')](_0x42f4fd[_0x4a68('0x12')],_0x5affce));_0x80b2ff[_0x4a68('0x13')]=_0x4503a3;}catch(_0x74aac){logger[_0x4a68('0xb')](_0x74aac['stack']);logger[_0x4a68('0xb')](_0x4a68('0x14'));}}else{_0x4503a3=_0x5affce;_0x80b2ff['body']=_0x4503a3;}break;}logger[_0x4a68('0x15')](util[_0x4a68('0x16')](_0x4a68('0x17'),_0x42f4fd['data1'],_0x42f4fd[_0x4a68('0x6')],JSON[_0x4a68('0x18')](_0x80b2ff)));rp(_0x80b2ff)[_0x4a68('0x19')](function(_0x5580fd){_0x4503a3=!_[_0x4a68('0x1a')](_0x4503a3)?_0x4a68('0x1b')+_0x4503a3:'';_0x4add69=typeof _0x5580fd[_0x4a68('0x13')]===_0x4a68('0x1c')?JSON[_0x4a68('0x18')](_0x5580fd[_0x4a68('0x13')]):_0x5580fd['body'];logger[_0x4a68('0x15')](util[_0x4a68('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x42f4fd['data1'],_0x42f4fd[_0x4a68('0x6')],_0x5580fd[_0x4a68('0x1d')],_0x4add69));})[_0x4a68('0x1e')](function(_0xfcbf65){logger[_0x4a68('0xb')](util[_0x4a68('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x42f4fd['data1'],_0x42f4fd['data2'],_0xfcbf65[_0x4a68('0x1d')],_0xfcbf65[_0x4a68('0x1f')],_0xfcbf65['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 0cbedc0..6a54557 100644 --- a/server/services/email/client.js +++ b/server/services/email/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8034=['error','message','result','catch','exports','routing','client','then','rpc'];(function(_0xe50e1,_0x30bf72){var _0x441f9a=function(_0x40ac92){while(--_0x40ac92){_0xe50e1['push'](_0xe50e1['shift']());}};_0x441f9a(++_0x30bf72);}(_0x8034,0x9e));var _0x4803=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8034[_0x160c73];return _0xd9302;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x4803('0x0'));var client=jayson[_0x4803('0x1')]['http']({'port':0x2329});client['Request']=function(_0x4e5821,_0x5ba27b){return new BPromise(function(_0x8cf5e8,_0x21399f){return client['request'](_0x4e5821,_0x5ba27b)[_0x4803('0x2')](function(_0x571c33){logger['debug'](_0x4803('0x3'),'routing',_0x4e5821,_0x5ba27b,_0x571c33);if(_0x571c33['error']){logger[_0x4803('0x4')](_0x4803('0x3'),'routing',_0x4e5821,_0x571c33['error'][_0x4803('0x5')],_0x5ba27b);return _0x21399f(_0x571c33[_0x4803('0x4')]['message']);}else{return _0x8cf5e8(_0x571c33[_0x4803('0x6')]);}})[_0x4803('0x7')](function(_0x565867){logger[_0x4803('0x4')](_0x4803('0x3'),_0x4803('0x0'),_0x4e5821,_0x565867,_0x5ba27b);return _0x21399f(_0x565867);});});};module[_0x4803('0x8')]=client; \ No newline at end of file +var _0x271f=['catch','exports','jayson/promise','../../config/logger','client','http','Request','request','then','rpc','routing','error','message','result'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x271f,0x1d0));var _0xf271=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x271f[_0x5ddb1c];return _0x354adc;};'use strict';var jayson=require(_0xf271('0x0'));var BPromise=require('bluebird');var logger=require(_0xf271('0x1'))('routing');var client=jayson[_0xf271('0x2')][_0xf271('0x3')]({'port':0x2329});client[_0xf271('0x4')]=function(_0x238d8e,_0x4facdf){return new BPromise(function(_0x64e4e9,_0x1ebe20){return client[_0xf271('0x5')](_0x238d8e,_0x4facdf)[_0xf271('0x6')](function(_0xbd8fa0){logger['debug'](_0xf271('0x7'),_0xf271('0x8'),_0x238d8e,_0x4facdf,_0xbd8fa0);if(_0xbd8fa0[_0xf271('0x9')]){logger[_0xf271('0x9')](_0xf271('0x7'),_0xf271('0x8'),_0x238d8e,_0xbd8fa0[_0xf271('0x9')][_0xf271('0xa')],_0x4facdf);return _0x1ebe20(_0xbd8fa0['error'][_0xf271('0xa')]);}else{return _0x64e4e9(_0xbd8fa0[_0xf271('0xb')]);}})[_0xf271('0xc')](function(_0xf38ec1){logger['error'](_0xf271('0x7'),_0xf271('0x8'),_0x238d8e,_0xf38ec1,_0x4facdf);return _0x1ebe20(_0xf38ec1);});});};module[_0xf271('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 42c4dd8..1d4e9e0 100644 --- a/server/services/email/index.js +++ b/server/services/email/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ada=['getSettings','./server','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','refresh','mailAccounts','listen'];(function(_0x27cf79,_0x37585c){var _0x2d31d0=function(_0x1b5901){while(--_0x1b5901){_0x27cf79['push'](_0x27cf79['shift']());}};_0x2d31d0(++_0x37585c);}(_0x3ada,0xfe));var _0xa3ad=function(_0x4475f1,_0x28bf37){_0x4475f1=_0x4475f1-0x0;var _0x10eb6f=_0x3ada[_0x4475f1];return _0x10eb6f;};'use strict';var server=require(_0xa3ad('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xa3ad('0x1'));var mailAccount=require(_0xa3ad('0x2'));var setting=require('./rpc/setting');var logger=require(_0xa3ad('0x3'))(_0xa3ad('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa3ad('0x5')]()[_0xa3ad('0x6')](mailAccount['getMailAccounts']())[_0xa3ad('0x6')](realtime['initMailAccounts']())['then'](function(){email[_0xa3ad('0x7')](realtime[_0xa3ad('0x8')]);return realtime;});}function main(){return server[_0xa3ad('0x9')](realtime,email)[_0xa3ad('0x6')](function(){return initRealtime();})[_0xa3ad('0x6')](function(){return setting[_0xa3ad('0xa')]();})['then'](function(_0x4d6c41){return setInterval(initRealtime,_0x4d6c41['loginMailFrequency']*0x3e8);})['catch'](function(_0x56e6ae){logger['error']('Email\x20service\x20initialization',_0x56e6ae);});}main(); \ No newline at end of file +var _0x7b8f=['error','Email\x20service\x20initialization','./server','./realtime','./rpc/setting','../../config/logger','email','then','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b8f,0x72));var _0xf7b8=function(_0x111d44,_0x169f7e){_0x111d44=_0x111d44-0x0;var _0x53e96b=_0x7b8f[_0x111d44];return _0x53e96b;};'use strict';var server=require(_0xf7b8('0x0'));var Realtime=require(_0xf7b8('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0xf7b8('0x2'));var logger=require(_0xf7b8('0x3'))(_0xf7b8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xf7b8('0x5')](mailAccount['getMailAccounts']())[_0xf7b8('0x5')](realtime[_0xf7b8('0x6')]())[_0xf7b8('0x5')](function(){email['refresh'](realtime[_0xf7b8('0x7')]);return realtime;});}function main(){return server[_0xf7b8('0x8')](realtime,email)[_0xf7b8('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0xf7b8('0x9')]();})[_0xf7b8('0x5')](function(_0x2b155a){return setInterval(initRealtime,_0x2b155a[_0xf7b8('0xa')]*0x3e8);})[_0xf7b8('0xb')](function(_0x7422ac){logger[_0xf7b8('0xc')](_0xf7b8('0xd'),_0x7422ac);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 5252367..895a1ea 100644 --- a/server/services/email/lib/email.js +++ b/server/services/email/lib/email.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07a0=['Imap','status','total','isNil','stringify','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','messageStatus','connected','messages','info','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','verifySmtp','Smtp','verify','verified','catch','exports','lodash','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active'];(function(_0x41e229,_0x37beef){var _0x45dd0a=function(_0x34fd44){while(--_0x34fd44){_0x41e229['push'](_0x41e229['shift']());}};_0x45dd0a(++_0x37beef);}(_0x07a0,0x8d));var _0x007a=function(_0x49b546,_0x194e37){_0x49b546=_0x49b546-0x0;var _0x354390=_0x07a0[_0x49b546];return _0x354390;};'use strict';var _=require(_0x007a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x007a('0x1'));var Redis=require(_0x007a('0x2'));var config=require(_0x007a('0x3'));var logger=require(_0x007a('0x4'))(_0x007a('0x5'));config[_0x007a('0x6')]=_['defaults'](config[_0x007a('0x6')],{'host':_0x007a('0x7'),'port':0x18eb});var io=require(_0x007a('0x8'))(new Redis(config[_0x007a('0x6')]));var EmailImap=require(_0x007a('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x77a1b9){logger['info']('start\x20email\x20channel');this[_0x007a('0xa')]=_0x77a1b9['mailAccounts'];this[_0x007a('0xb')]={};this[_0x007a('0xc')]=new EmailSmtp();}EmailChannel[_0x007a('0xd')][_0x007a('0xe')]=function(_0x45dce0){var _0xb03a31=this[_0x007a('0xa')][_0x45dce0];var _0x4e7c89={'id':_0xb03a31['id'],'name':_0xb03a31[_0x007a('0xf')],'key':_0xb03a31[_0x007a('0x10')],'active':_0xb03a31[_0x007a('0x11')],'Imap':{'status':_0xb03a31[_0x007a('0x12')][_0x007a('0x13')],'messageStatus':_0xb03a31[_0x007a('0x12')]['messageStatus'],'total':_0xb03a31[_0x007a('0x12')][_0x007a('0x14')]}};if(_[_0x007a('0x15')](md5Accounts[_0x45dce0])){md5Accounts[_0x45dce0]={};}var _0x1d52b6=md5(JSON[_0x007a('0x16')](_0x4e7c89));if(md5Accounts[_0x45dce0][_0x007a('0x1')]!==_0x1d52b6){md5Accounts[_0x45dce0][_0x007a('0x1')]=_0x1d52b6;io[_0x007a('0xe')]('mailAccount:update',_0x4e7c89);}};EmailChannel['prototype'][_0x007a('0x17')]=function(_0x1e2f97){for(var _0x54debc in _0x1e2f97){if(_0x1e2f97[_0x007a('0x18')](_0x54debc)){if(_0x1e2f97[_0x54debc][_0x007a('0x12')]&&_0x1e2f97[_0x54debc]['active']){var _0x25ddc3=_0x1e2f97[_0x54debc]['Imap'];if(!_0x25ddc3[_0x007a('0x19')]&&_0x1e2f97[_0x54debc][_0x007a('0x1a')]!==_0x007a('0x1b'))_0x25ddc3[_0x007a('0x19')]=_0x1e2f97[_0x54debc][_0x007a('0x1a')];if(!this[_0x007a('0xb')]['hasOwnProperty'](_0x25ddc3['id'])){this[_0x007a('0xb')][_0x25ddc3['id']]=new EmailImap(_0x25ddc3,_0x1e2f97[_0x54debc][_0x007a('0x5')]);this[_0x007a('0xb')][_0x25ddc3['id']]['on'](_0x007a('0x1c'),this[_0x007a('0x1d')]['bind'](this,_0x54debc));this['imapAccounts'][_0x25ddc3['id']]['on'](_0x007a('0x5'),this[_0x007a('0x1e')][_0x007a('0x1f')](this,_0x54debc));this[_0x007a('0xb')][_0x25ddc3['id']]['on'](_0x007a('0x20'),this[_0x007a('0x21')][_0x007a('0x1f')](this,_0x54debc));this[_0x007a('0xb')][_0x25ddc3['id']]['on'](_0x007a('0x22'),this[_0x007a('0x23')][_0x007a('0x1f')](this,_0x54debc));}}else{if(_['isNil'](this[_0x007a('0xa')][_0x54debc][_0x007a('0x12')])){this[_0x007a('0xa')][_0x54debc]['Imap']={};}this[_0x007a('0xa')][_0x54debc]['Imap'][_0x007a('0x13')]='disabled';this['mailAccounts'][_0x54debc][_0x007a('0x12')][_0x007a('0x24')]='';this[_0x007a('0xe')](_0x54debc);}}}};EmailChannel[_0x007a('0xd')][_0x007a('0x1d')]=function(_0x2a9083,_0x59ca18){if(this[_0x007a('0xa')][_0x2a9083]){this['mailAccounts'][_0x2a9083]['Imap'][_0x007a('0x13')]=_0x007a('0x25');this[_0x007a('0xa')][_0x2a9083][_0x007a('0x12')]['messageStatus']=_0x59ca18[_0x007a('0xf')];if(_0x59ca18[_0x007a('0x26')]){this[_0x007a('0xa')][_0x2a9083]['Imap']['total']=_0x59ca18[_0x007a('0x26')][_0x007a('0x14')];}return this[_0x007a('0xe')](_0x2a9083);}};EmailChannel[_0x007a('0xd')][_0x007a('0x1e')]=function(_0x4819bc,_0x3e2fa6){logger[_0x007a('0x27')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3e2fa6[_0x007a('0x28')],_0x3e2fa6[_0x007a('0x29')],_0x3e2fa6[_0x007a('0x2a')],_0x4819bc);if(this[_0x007a('0xa')][_0x4819bc]){return mailAccount['notify'](_0x4819bc,_0x3e2fa6)[_0x007a('0x2b')](function(_0x465932){if(_0x465932){logger[_0x007a('0x27')](_0x007a('0x2c'));}})['catch'](function(_0x3586f0){logger['error'](_0x007a('0x2d'),JSON[_0x007a('0x16')](_0x3586f0));});}};EmailChannel[_0x007a('0xd')][_0x007a('0x21')]=function(_0x1d3660){if(this[_0x007a('0xa')][_0x1d3660]&&this['mailAccounts'][_0x1d3660][_0x007a('0x12')]){if(this[_0x007a('0xb')][this[_0x007a('0xa')][_0x1d3660][_0x007a('0x12')]['id']]){delete this[_0x007a('0xb')][this[_0x007a('0xa')][_0x1d3660][_0x007a('0x12')]['id']];}this[_0x007a('0xa')][_0x1d3660][_0x007a('0x12')][_0x007a('0x2e')]=moment();this['emit'](_0x1d3660);}};EmailChannel[_0x007a('0xd')][_0x007a('0x23')]=function(_0x188825,_0x51948e){if(this[_0x007a('0xa')][_0x188825]){this[_0x007a('0xa')][_0x188825][_0x007a('0x12')][_0x007a('0x13')]=_0x007a('0x22');this[_0x007a('0xa')][_0x188825][_0x007a('0x12')][_0x007a('0x24')]=_0x51948e;return this[_0x007a('0xe')](_0x188825);}};EmailChannel['prototype']['sendMail']=function(_0x22abb3,_0x497b5c){return this['smtp']['send'](_0x22abb3,_0x497b5c);};EmailChannel[_0x007a('0xd')][_0x007a('0x2f')]=function(_0x11eca4){var _0x22217e=this;if(this['mailAccounts'][_0x11eca4['id']]){if(_['isNil'](this[_0x007a('0xa')][_0x11eca4['id']]['Smtp'])){this[_0x007a('0xa')][_0x11eca4['id']][_0x007a('0x30')]={};}this[_0x007a('0xa')][_0x11eca4['id']][_0x007a('0x30')][_0x007a('0x2e')]=moment();return new BPromise(function(_0x5e26c4,_0x152c40){return _0x22217e[_0x007a('0xc')][_0x007a('0x31')](_0x11eca4)['then'](function(_0x587c6e){_0x22217e['mailAccounts'][_0x11eca4['id']][_0x007a('0x30')]['status']=_0x007a('0x32');_0x22217e['mailAccounts'][_0x11eca4['id']][_0x007a('0x30')][_0x007a('0x24')]='';_0x22217e[_0x007a('0xe')](_0x11eca4['id']);_0x5e26c4(_0x587c6e);})[_0x007a('0x33')](function(_0x8b8d11){_0x22217e[_0x007a('0xa')][_0x11eca4['id']][_0x007a('0x30')][_0x007a('0x13')]='error';_0x22217e[_0x007a('0xa')][_0x11eca4['id']]['Smtp'][_0x007a('0x24')]=_0x8b8d11;_0x22217e[_0x007a('0xe')](_0x11eca4['id']);_0x152c40(_0x8b8d11);});});}return this[_0x007a('0xc')][_0x007a('0x31')](_0x11eca4);};module[_0x007a('0x34')]=EmailChannel; \ No newline at end of file +var _0x6aa2=['active','Imap','status','messageStatus','isNil','emit','mailAccount:update','hasOwnProperty','service','provider','custom','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','moment','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x6aa2,0x1f0));var _0x26aa=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x6aa2[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require('lodash');var moment=require(_0x26aa('0x0'));var BPromise=require('bluebird');var md5=require(_0x26aa('0x1'));var Redis=require(_0x26aa('0x2'));var config=require(_0x26aa('0x3'));var logger=require(_0x26aa('0x4'))('email');config[_0x26aa('0x5')]=_[_0x26aa('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x26aa('0x7'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x26aa('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x507ed9){logger[_0x26aa('0x9')](_0x26aa('0xa'));this[_0x26aa('0xb')]=_0x507ed9[_0x26aa('0xb')];this[_0x26aa('0xc')]={};this[_0x26aa('0xd')]=new EmailSmtp();}EmailChannel[_0x26aa('0xe')]['emit']=function(_0x535e72){var _0x81b004=this[_0x26aa('0xb')][_0x535e72];var _0x546a21={'id':_0x81b004['id'],'name':_0x81b004[_0x26aa('0xf')],'key':_0x81b004[_0x26aa('0x10')],'active':_0x81b004[_0x26aa('0x11')],'Imap':{'status':_0x81b004[_0x26aa('0x12')][_0x26aa('0x13')],'messageStatus':_0x81b004[_0x26aa('0x12')][_0x26aa('0x14')],'total':_0x81b004['Imap']['total']}};if(_[_0x26aa('0x15')](md5Accounts[_0x535e72])){md5Accounts[_0x535e72]={};}var _0x4e5894=md5(JSON['stringify'](_0x546a21));if(md5Accounts[_0x535e72][_0x26aa('0x1')]!==_0x4e5894){md5Accounts[_0x535e72][_0x26aa('0x1')]=_0x4e5894;io[_0x26aa('0x16')](_0x26aa('0x17'),_0x546a21);}};EmailChannel[_0x26aa('0xe')]['refresh']=function(_0x2e28bf){for(var _0x397df0 in _0x2e28bf){if(_0x2e28bf[_0x26aa('0x18')](_0x397df0)){if(_0x2e28bf[_0x397df0][_0x26aa('0x12')]&&_0x2e28bf[_0x397df0][_0x26aa('0x11')]){var _0x4dd5c7=_0x2e28bf[_0x397df0][_0x26aa('0x12')];if(!_0x4dd5c7[_0x26aa('0x19')]&&_0x2e28bf[_0x397df0][_0x26aa('0x1a')]!==_0x26aa('0x1b'))_0x4dd5c7['service']=_0x2e28bf[_0x397df0][_0x26aa('0x1a')];if(!this['imapAccounts'][_0x26aa('0x18')](_0x4dd5c7['id'])){this['imapAccounts'][_0x4dd5c7['id']]=new EmailImap(_0x4dd5c7,_0x2e28bf[_0x397df0][_0x26aa('0x1c')]);this[_0x26aa('0xc')][_0x4dd5c7['id']]['on'](_0x26aa('0x1d'),this[_0x26aa('0x1e')][_0x26aa('0x1f')](this,_0x397df0));this['imapAccounts'][_0x4dd5c7['id']]['on']('email',this[_0x26aa('0x20')]['bind'](this,_0x397df0));this[_0x26aa('0xc')][_0x4dd5c7['id']]['on'](_0x26aa('0x21'),this[_0x26aa('0x22')]['bind'](this,_0x397df0));this[_0x26aa('0xc')][_0x4dd5c7['id']]['on'](_0x26aa('0x23'),this[_0x26aa('0x24')][_0x26aa('0x1f')](this,_0x397df0));}}else{if(_['isNil'](this[_0x26aa('0xb')][_0x397df0]['Imap'])){this['mailAccounts'][_0x397df0][_0x26aa('0x12')]={};}this['mailAccounts'][_0x397df0]['Imap'][_0x26aa('0x13')]=_0x26aa('0x25');this[_0x26aa('0xb')][_0x397df0][_0x26aa('0x12')]['messageStatus']='';this[_0x26aa('0x16')](_0x397df0);}}}};EmailChannel[_0x26aa('0xe')]['handleImapBox']=function(_0x19852c,_0x17cca8){if(this[_0x26aa('0xb')][_0x19852c]){this['mailAccounts'][_0x19852c][_0x26aa('0x12')][_0x26aa('0x13')]='connected';this[_0x26aa('0xb')][_0x19852c][_0x26aa('0x12')][_0x26aa('0x14')]=_0x17cca8[_0x26aa('0xf')];if(_0x17cca8[_0x26aa('0x26')]){this[_0x26aa('0xb')][_0x19852c][_0x26aa('0x12')]['total']=_0x17cca8['messages'][_0x26aa('0x27')];}return this[_0x26aa('0x16')](_0x19852c);}};EmailChannel[_0x26aa('0xe')][_0x26aa('0x20')]=function(_0x110c2f,_0x5e65e1){logger['info'](_0x26aa('0x28'),_0x5e65e1[_0x26aa('0x29')],_0x5e65e1['lastName'],_0x5e65e1[_0x26aa('0x2a')],_0x110c2f);if(this[_0x26aa('0xb')][_0x110c2f]){return mailAccount[_0x26aa('0x2b')](_0x110c2f,_0x5e65e1)[_0x26aa('0x2c')](function(_0x36f6fb){if(_0x36f6fb){logger['info'](_0x26aa('0x2d'));}})['catch'](function(_0x1a4e01){logger[_0x26aa('0x23')](_0x26aa('0x2e'),JSON[_0x26aa('0x2f')](_0x1a4e01));});}};EmailChannel['prototype'][_0x26aa('0x22')]=function(_0xf958){if(this[_0x26aa('0xb')][_0xf958]&&this[_0x26aa('0xb')][_0xf958][_0x26aa('0x12')]){if(this[_0x26aa('0xc')][this[_0x26aa('0xb')][_0xf958][_0x26aa('0x12')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0xf958][_0x26aa('0x12')]['id']];}this[_0x26aa('0xb')][_0xf958][_0x26aa('0x12')][_0x26aa('0x30')]=moment();this[_0x26aa('0x16')](_0xf958);}};EmailChannel['prototype'][_0x26aa('0x24')]=function(_0x19ab91,_0xf907e8){if(this[_0x26aa('0xb')][_0x19ab91]){this[_0x26aa('0xb')][_0x19ab91][_0x26aa('0x12')][_0x26aa('0x13')]='error';this[_0x26aa('0xb')][_0x19ab91][_0x26aa('0x12')][_0x26aa('0x14')]=_0xf907e8;return this[_0x26aa('0x16')](_0x19ab91);}};EmailChannel[_0x26aa('0xe')][_0x26aa('0x31')]=function(_0x776412,_0x6ea242){return this[_0x26aa('0xd')][_0x26aa('0x32')](_0x776412,_0x6ea242);};EmailChannel[_0x26aa('0xe')][_0x26aa('0x33')]=function(_0x5758ff){var _0x6b79ca=this;if(this['mailAccounts'][_0x5758ff['id']]){if(_[_0x26aa('0x15')](this['mailAccounts'][_0x5758ff['id']][_0x26aa('0x34')])){this['mailAccounts'][_0x5758ff['id']]['Smtp']={};}this['mailAccounts'][_0x5758ff['id']][_0x26aa('0x34')][_0x26aa('0x30')]=moment();return new BPromise(function(_0x4d5fbe,_0x38cd8a){return _0x6b79ca[_0x26aa('0xd')][_0x26aa('0x35')](_0x5758ff)[_0x26aa('0x2c')](function(_0x1d2f68){_0x6b79ca['mailAccounts'][_0x5758ff['id']]['Smtp']['status']=_0x26aa('0x36');_0x6b79ca[_0x26aa('0xb')][_0x5758ff['id']][_0x26aa('0x34')]['messageStatus']='';_0x6b79ca[_0x26aa('0x16')](_0x5758ff['id']);_0x4d5fbe(_0x1d2f68);})[_0x26aa('0x37')](function(_0x3928c1){_0x6b79ca[_0x26aa('0xb')][_0x5758ff['id']]['Smtp'][_0x26aa('0x13')]=_0x26aa('0x23');_0x6b79ca[_0x26aa('0xb')][_0x5758ff['id']][_0x26aa('0x34')]['messageStatus']=_0x3928c1;_0x6b79ca[_0x26aa('0x16')](_0x5758ff['id']);_0x38cd8a(_0x3928c1);});});}return this['smtp']['verify'](_0x5758ff);};module[_0x26aa('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b02688b..c6c5e23 100644 --- a/server/services/email/lib/imap.js +++ b/server/services/email/lib/imap.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eb3=['inherits','prototype','connTimeout','authTimeout','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','authentication','password','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleError','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','bind','end','handleEnd','error','connect'];(function(_0x554b62,_0x15513b){var _0x444988=function(_0x51dccf){while(--_0x51dccf){_0x554b62['push'](_0x554b62['shift']());}};_0x444988(++_0x15513b);}(_0x1eb3,0x6a));var _0x31eb=function(_0x39bfe7,_0x1cb10c){_0x39bfe7=_0x39bfe7-0x0;var _0x45d8f7=_0x1eb3[_0x39bfe7];return _0x45d8f7;};'use strict';var _=require(_0x31eb('0x0'));var util=require(_0x31eb('0x1'));var Imap=require(_0x31eb('0x2'));var simpleParser=require(_0x31eb('0x3'))[_0x31eb('0x4')];var Iconv=require(_0x31eb('0x5'))[_0x31eb('0x6')];var EventEmitter=require(_0x31eb('0x7'))[_0x31eb('0x8')];var utils=require('./utils');var logger=require(_0x31eb('0x9'))(_0x31eb('0xa'));function EmailImap(_0x4d954e,_0x194605){this[_0x31eb('0xb')]=_0x4d954e['mailbox'];this[_0x31eb('0xc')]=this[_0x31eb('0xd')](_0x4d954e,_0x194605);this[_0x31eb('0x2')]=new Imap(this[_0x31eb('0xc')]);this[_0x31eb('0x2')][_0x31eb('0xe')]('ready',this['handleReady'][_0x31eb('0xf')](this));this[_0x31eb('0x2')][_0x31eb('0xe')](_0x31eb('0x10'),this[_0x31eb('0x11')]['bind'](this));this[_0x31eb('0x2')]['on'](_0x31eb('0x12'),this['handleError'][_0x31eb('0xf')](this));this['imap'][_0x31eb('0x13')]();}util[_0x31eb('0x14')](EmailImap,EventEmitter);EmailImap[_0x31eb('0x15')][_0x31eb('0xd')]=function(_0x11df60,_0x2d6f03){var _0xaabfb8={'connTimeout':_0x11df60[_0x31eb('0x16')]?_0x11df60[_0x31eb('0x16')]*0x3e8:0x2710,'authTimeout':_0x11df60[_0x31eb('0x17')]?_0x11df60[_0x31eb('0x17')]*0x3e8:0x1388};if(_0x11df60['service']){_0xaabfb8[_0x31eb('0x18')]=_0x11df60[_0x31eb('0x18')];if(_0x11df60['modernAuthentication']){_0xaabfb8[_0x31eb('0x19')]=utils[_0x31eb('0x1a')](_0x11df60[_0x31eb('0x1b')][_0x31eb('0x1c')],_0x11df60[_0x31eb('0x18')]);}else{_0xaabfb8['password']=_0x11df60['password'];}}else{if(_0x11df60[_0x31eb('0x1d')]){_0xaabfb8['user']=_0x11df60[_0x31eb('0x18')];_0xaabfb8[_0x31eb('0x1e')]=_0x11df60[_0x31eb('0x1e')];}}_0xaabfb8['email']=_0x2d6f03||_0x11df60[_0x31eb('0x18')]||_0x31eb('0x1f');_0xaabfb8[_0x31eb('0x20')]=_0x11df60[_0x31eb('0x20')];_0xaabfb8[_0x31eb('0x21')]=_0x11df60[_0x31eb('0x21')]||0x3e1;if(_0x11df60[_0x31eb('0x22')]){_0xaabfb8[_0x31eb('0x22')]=!![];}else{_0xaabfb8[_0x31eb('0x22')]=![];_0xaabfb8[_0x31eb('0x23')]=_0x31eb('0x24');}return _0xaabfb8;};EmailImap[_0x31eb('0x15')]['handleReady']=function(){this[_0x31eb('0x2')][_0x31eb('0x25')](this[_0x31eb('0xb')],![],this[_0x31eb('0x26')][_0x31eb('0xf')](this));};EmailImap['prototype'][_0x31eb('0x26')]=function(_0x41f697,_0x1518ab){if(_0x41f697){this['handleError'](_0x41f697,!![]);}else{this[_0x31eb('0x27')](_0x31eb('0x28'),_0x1518ab);this[_0x31eb('0x29')]();}};EmailImap[_0x31eb('0x15')][_0x31eb('0x2a')]=function(_0x5881b8){if(_0x5881b8){this[_0x31eb('0x2b')](_0x5881b8,!![]);}else{this['imap']['end']();}};EmailImap[_0x31eb('0x15')][_0x31eb('0x29')]=function(){this[_0x31eb('0x2')][_0x31eb('0x2c')]([_0x31eb('0x2d')],this[_0x31eb('0x2e')][_0x31eb('0xf')](this));};EmailImap[_0x31eb('0x15')]['handleReadUnseen']=function(_0x4c9f05,_0x53a8c7){if(_0x4c9f05){this[_0x31eb('0x2b')](_0x4c9f05,!![]);}else{if(_0x53a8c7[_0x31eb('0x2f')]){try{var _0x123cef=this['imap'][_0x31eb('0x30')](_0x53a8c7,{'bodies':'','markSeen':!![]});_0x123cef['on']('message',this[_0x31eb('0x31')][_0x31eb('0xf')](this));_0x123cef[_0x31eb('0xe')](_0x31eb('0x12'),this[_0x31eb('0x32')][_0x31eb('0xf')](this));_0x123cef[_0x31eb('0xe')](_0x31eb('0x10'),this['handleFetchEnd'][_0x31eb('0xf')](this));}catch(_0x554662){logger[_0x31eb('0x12')](_0x554662);}}else{this['imap'][_0x31eb('0x33')](!![],this[_0x31eb('0x2a')][_0x31eb('0xf')](this));}}};EmailImap[_0x31eb('0x15')]['handleFetchMessage']=function(_0x37ad91){_0x37ad91['on'](_0x31eb('0x34'),this[_0x31eb('0x35')][_0x31eb('0xf')](this));_0x37ad91[_0x31eb('0xe')]('attributes',this[_0x31eb('0x36')][_0x31eb('0xf')](this));_0x37ad91['once'](_0x31eb('0x10'),this[_0x31eb('0x37')][_0x31eb('0xf')](this));};EmailImap[_0x31eb('0x15')][_0x31eb('0x35')]=function(_0x1236e){simpleParser(_0x1236e,{'Iconv':Iconv},this[_0x31eb('0x38')][_0x31eb('0xf')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x31eb('0x37')]=function(){};EmailImap[_0x31eb('0x15')][_0x31eb('0x38')]=function(_0x4a5eac,_0x409b63){if(_0x4a5eac){logger['error'](_0x4a5eac);}else{var _0x43c3ce=this;utils['parser'](this[_0x31eb('0xc')],_0x409b63,function(_0xb500b5){_0x43c3ce[_0x31eb('0x27')](_0x31eb('0xa'),_0xb500b5);});}};EmailImap[_0x31eb('0x15')][_0x31eb('0x39')]=function(){this[_0x31eb('0x2')][_0x31eb('0x33')](!![],this[_0x31eb('0x2a')][_0x31eb('0xf')](this));};EmailImap['prototype'][_0x31eb('0x32')]=function(_0x4a798b){this[_0x31eb('0x2b')](_0x4a798b);this[_0x31eb('0x2')]['closeBox'](!![],this[_0x31eb('0x2a')]['bind'](this));};EmailImap['prototype'][_0x31eb('0x11')]=function(){this[_0x31eb('0x27')](_0x31eb('0x10'));};EmailImap[_0x31eb('0x15')][_0x31eb('0x2b')]=function(_0x5ac010,_0x458b41){logger[_0x31eb('0x12')](_0x31eb('0x2b'),this[_0x31eb('0xc')][_0x31eb('0xa')],JSON[_0x31eb('0x3a')](_0x5ac010));var _0x42d45a='';if(_0x5ac010){if(_0x5ac010[_0x31eb('0x3b')]){_0x42d45a=_0x5ac010['textCode'];}else{for(var _0x4cd7ee in _0x5ac010){if(_0x5ac010[_0x31eb('0x3c')](_0x4cd7ee)){_0x42d45a+=_[_0x31eb('0x3d')](_0x4cd7ee)+':\x20'+_0x5ac010[_0x4cd7ee]+'\x0a';}}}}if(_0x458b41){this['imap']['end']();}else{this[_0x31eb('0x27')](_0x31eb('0x12'),_0x42d45a);this[_0x31eb('0x27')](_0x31eb('0x10'));}};module[_0x31eb('0x3e')]=EmailImap; \ No newline at end of file +var _0x663e=['connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','password','authentication','anonymous@xcally.com','host','port','tls','required','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchEnd','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleMessageAttributes','handleSimpleParser','handleFetchError','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','iconv','Iconv','events','EventEmitter','email','mailbox','account','getAccount','once','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype'];(function(_0x5b1743,_0x4be383){var _0x829e76=function(_0x5c6818){while(--_0x5c6818){_0x5b1743['push'](_0x5b1743['shift']());}};_0x829e76(++_0x4be383);}(_0x663e,0x182));var _0xe663=function(_0x384264,_0x1ea0c7){_0x384264=_0x384264-0x0;var _0x227b65=_0x663e[_0x384264];return _0x227b65;};'use strict';var _=require(_0xe663('0x0'));var util=require(_0xe663('0x1'));var Imap=require(_0xe663('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0xe663('0x3'))[_0xe663('0x4')];var EventEmitter=require(_0xe663('0x5'))[_0xe663('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')(_0xe663('0x7'));function EmailImap(_0x59de56,_0x595e72){this[_0xe663('0x8')]=_0x59de56['mailbox'];this[_0xe663('0x9')]=this[_0xe663('0xa')](_0x59de56,_0x595e72);this[_0xe663('0x2')]=new Imap(this[_0xe663('0x9')]);this[_0xe663('0x2')][_0xe663('0xb')]('ready',this[_0xe663('0xc')][_0xe663('0xd')](this));this[_0xe663('0x2')][_0xe663('0xb')](_0xe663('0xe'),this[_0xe663('0xf')][_0xe663('0xd')](this));this[_0xe663('0x2')]['on']('error',this[_0xe663('0x10')][_0xe663('0xd')](this));this[_0xe663('0x2')][_0xe663('0x11')]();}util[_0xe663('0x12')](EmailImap,EventEmitter);EmailImap[_0xe663('0x13')][_0xe663('0xa')]=function(_0x8fdf0d,_0xcebc29){var _0x422361={'connTimeout':_0x8fdf0d['connTimeout']?_0x8fdf0d[_0xe663('0x14')]*0x3e8:0x2710,'authTimeout':_0x8fdf0d[_0xe663('0x15')]?_0x8fdf0d[_0xe663('0x15')]*0x3e8:0x1388};if(_0x8fdf0d['service']){_0x422361['user']=_0x8fdf0d[_0xe663('0x16')];if(_0x8fdf0d[_0xe663('0x17')]){_0x422361[_0xe663('0x18')]=utils[_0xe663('0x19')](_0x8fdf0d['CloudProvider']['data5'],_0x8fdf0d[_0xe663('0x16')]);}else{_0x422361['password']=_0x8fdf0d[_0xe663('0x1a')];}}else{if(_0x8fdf0d[_0xe663('0x1b')]){_0x422361[_0xe663('0x16')]=_0x8fdf0d[_0xe663('0x16')];_0x422361['password']=_0x8fdf0d[_0xe663('0x1a')];}}_0x422361[_0xe663('0x7')]=_0xcebc29||_0x8fdf0d[_0xe663('0x16')]||_0xe663('0x1c');_0x422361['host']=_0x8fdf0d[_0xe663('0x1d')];_0x422361[_0xe663('0x1e')]=_0x8fdf0d['port']||0x3e1;if(_0x8fdf0d[_0xe663('0x1f')]){_0x422361[_0xe663('0x1f')]=!![];}else{_0x422361[_0xe663('0x1f')]=![];_0x422361['autotls']=_0xe663('0x20');}return _0x422361;};EmailImap[_0xe663('0x13')]['handleReady']=function(){this[_0xe663('0x2')]['openBox'](this['mailbox'],![],this['handleOpenBox'][_0xe663('0xd')](this));};EmailImap['prototype'][_0xe663('0x21')]=function(_0x2181ea,_0x143b3e){if(_0x2181ea){this[_0xe663('0x10')](_0x2181ea,!![]);}else{this[_0xe663('0x22')](_0xe663('0x23'),_0x143b3e);this['readUnseen']();}};EmailImap[_0xe663('0x13')][_0xe663('0x24')]=function(_0x387a76){if(_0x387a76){this[_0xe663('0x10')](_0x387a76,!![]);}else{this[_0xe663('0x2')]['end']();}};EmailImap[_0xe663('0x13')][_0xe663('0x25')]=function(){this['imap'][_0xe663('0x26')](['UNSEEN'],this[_0xe663('0x27')]['bind'](this));};EmailImap[_0xe663('0x13')]['handleReadUnseen']=function(_0xd026fe,_0x2b2025){if(_0xd026fe){this[_0xe663('0x10')](_0xd026fe,!![]);}else{if(_0x2b2025[_0xe663('0x28')]){try{var _0xea0b68=this[_0xe663('0x2')][_0xe663('0x29')](_0x2b2025,{'bodies':'','markSeen':!![]});_0xea0b68['on'](_0xe663('0x2a'),this[_0xe663('0x2b')][_0xe663('0xd')](this));_0xea0b68[_0xe663('0xb')](_0xe663('0x2c'),this['handleFetchError'][_0xe663('0xd')](this));_0xea0b68[_0xe663('0xb')](_0xe663('0xe'),this[_0xe663('0x2d')][_0xe663('0xd')](this));}catch(_0x2fa985){logger[_0xe663('0x2c')](_0x2fa985);}}else{this[_0xe663('0x2')][_0xe663('0x2e')](!![],this[_0xe663('0x24')][_0xe663('0xd')](this));}}};EmailImap['prototype'][_0xe663('0x2b')]=function(_0x51edcd){_0x51edcd['on'](_0xe663('0x2f'),this['handleMessageBody']['bind'](this));_0x51edcd[_0xe663('0xb')](_0xe663('0x30'),this['handleMessageAttributes'][_0xe663('0xd')](this));_0x51edcd[_0xe663('0xb')](_0xe663('0xe'),this[_0xe663('0x31')]['bind'](this));};EmailImap['prototype'][_0xe663('0x32')]=function(_0x5bc99e){simpleParser(_0x5bc99e,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0xe663('0x13')][_0xe663('0x33')]=function(){};EmailImap[_0xe663('0x13')][_0xe663('0x31')]=function(){};EmailImap[_0xe663('0x13')][_0xe663('0x34')]=function(_0xbc3c78,_0x18fdb9){if(_0xbc3c78){logger[_0xe663('0x2c')](_0xbc3c78);}else{var _0x51452b=this;utils['parser'](this[_0xe663('0x9')],_0x18fdb9,function(_0x47dbfa){_0x51452b[_0xe663('0x22')](_0xe663('0x7'),_0x47dbfa);});}};EmailImap[_0xe663('0x13')][_0xe663('0x2d')]=function(){this[_0xe663('0x2')]['closeBox'](!![],this[_0xe663('0x24')][_0xe663('0xd')](this));};EmailImap[_0xe663('0x13')][_0xe663('0x35')]=function(_0x42b043){this[_0xe663('0x10')](_0x42b043);this[_0xe663('0x2')][_0xe663('0x2e')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xe663('0x13')][_0xe663('0xf')]=function(){this[_0xe663('0x22')](_0xe663('0xe'));};EmailImap['prototype']['handleError']=function(_0x500e5f,_0x3c72b3){logger[_0xe663('0x2c')](_0xe663('0x10'),this[_0xe663('0x9')][_0xe663('0x7')],JSON['stringify'](_0x500e5f));var _0x156e76='';if(_0x500e5f){if(_0x500e5f[_0xe663('0x36')]){_0x156e76=_0x500e5f[_0xe663('0x36')];}else{for(var _0x301503 in _0x500e5f){if(_0x500e5f[_0xe663('0x37')](_0x301503)){_0x156e76+=_[_0xe663('0x38')](_0x301503)+':\x20'+_0x500e5f[_0x301503]+'\x0a';}}}}if(_0x3c72b3){this[_0xe663('0x2')][_0xe663('0xe')]();}else{this[_0xe663('0x22')](_0xe663('0x2c'),_0x156e76);this[_0xe663('0x22')]('end');}};module[_0xe663('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 9749077..81e497f 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x217a=['send','createTransport','use','sendMail','toString','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x211065,_0x3b4a05){var _0x2fba60=function(_0x184e02){while(--_0x184e02){_0x211065['push'](_0x211065['shift']());}};_0x2fba60(++_0x3b4a05);}(_0x217a,0x1d6));var _0xa217=function(_0x5b5813,_0x5a7b19){_0x5b5813=_0x5b5813-0x0;var _0x4f4f85=_0x217a[_0x5b5813];return _0x4f4f85;};'use strict';var nodemailer=require(_0xa217('0x0'));var inlineBase64=require(_0xa217('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xa217('0x2')]=function(_0x2f014a,_0x151fc4){return new Promise(function(_0x5089cb,_0x4aa9da){var _0x27310d=nodemailer[_0xa217('0x3')](_0x2f014a);_0x27310d[_0xa217('0x4')]('compile',inlineBase64());_0x27310d[_0xa217('0x5')](_0x151fc4,function(_0x152156,_0x421d01){if(_0x152156){_0x4aa9da(_0x152156[_0xa217('0x6')]());}else{_0x5089cb(_0x421d01);}});});};EmailSmtp['prototype']['verify']=function(_0x403f7f){return new Promise(function(_0x4876e7,_0x274a3d){var _0x4d3824=nodemailer[_0xa217('0x3')](_0x403f7f);_0x4d3824['verify'](function(_0x41e388,_0x3a1b9d){if(_0x41e388){_0x274a3d(_0x41e388[_0xa217('0x6')]());}else{if(_0x3a1b9d){_0x4876e7(_0x3a1b9d);}else{_0x274a3d(_0xa217('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x1e6b=['toString','verify','createTransport','exports','prototype','send','use','sendMail'];(function(_0x5772f0,_0xb39a92){var _0x25bdfc=function(_0x1208e6){while(--_0x1208e6){_0x5772f0['push'](_0x5772f0['shift']());}};_0x25bdfc(++_0xb39a92);}(_0x1e6b,0x18c));var _0xb1e6=function(_0x222fad,_0x38e20c){_0x222fad=_0x222fad-0x0;var _0x503ae0=_0x1e6b[_0x222fad];return _0x503ae0;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xb1e6('0x0')][_0xb1e6('0x1')]=function(_0x16de38,_0x5140c7){return new Promise(function(_0x51c686,_0x581681){var _0x1b6580=nodemailer['createTransport'](_0x16de38);_0x1b6580[_0xb1e6('0x2')]('compile',inlineBase64());_0x1b6580[_0xb1e6('0x3')](_0x5140c7,function(_0x478d69,_0x12bd53){if(_0x478d69){_0x581681(_0x478d69[_0xb1e6('0x4')]());}else{_0x51c686(_0x12bd53);}});});};EmailSmtp[_0xb1e6('0x0')][_0xb1e6('0x5')]=function(_0x30ed0b){return new Promise(function(_0x2c531a,_0x995c60){var _0x52c5f0=nodemailer[_0xb1e6('0x6')](_0x30ed0b);_0x52c5f0[_0xb1e6('0x5')](function(_0x757017,_0x10ae73){if(_0x757017){_0x995c60(_0x757017[_0xb1e6('0x4')]());}else{if(_0x10ae73){_0x2c531a(_0x10ae73);}else{_0x995c60('Not\x20verifired');}}});});};module[_0xb1e6('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1958c2d..65ecd30 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf200=['

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','head','value','address','anonymous','generate','@xcally.com','name','indexOf','split','length','slice','join','Anonymous','pop','html','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x3192ab[_0x0f20('0x10')](0x0,-0x1)[_0x0f20('0x11')]('\x20'):_0x11f0d1['name'];}return _0x0f20('0x12');}function getLastName(_0x359ef3){var _0x83e0c5=_[_0x0f20('0x6')](_0x359ef3['value']);if(_0x83e0c5&&_0x83e0c5[_0x0f20('0xc')]){var _0x38dbbc=_0x83e0c5['name'][_0x0f20('0xe')](/\s+/);return _0x38dbbc[_0x0f20('0xf')]>0x1?_0x38dbbc[_0x0f20('0x13')]():'';}return'';}function getMails(_0x5106d4,_0x217c0b){var _0x273bd1='';for(var _0x196650=0x0;_0x196650<_0x217c0b['value']['length'];_0x196650+=0x1){if(_0x217c0b[_0x0f20('0x7')][_0x196650][_0x0f20('0x8')]!==_0x5106d4){if(!_['isEmpty'](_0x273bd1)){_0x273bd1+=',';}_0x273bd1+=_0x217c0b[_0x0f20('0x7')][_0x196650][_0x0f20('0xc')]||_0x217c0b[_0x0f20('0x7')][_0x196650][_0x0f20('0x8')]||'';_0x273bd1+='\x20<';_0x273bd1+=_0x217c0b[_0x0f20('0x7')][_0x196650][_0x0f20('0x8')]?_0x217c0b['value'][_0x196650][_0x0f20('0x8')]:_0x0f20('0x9')+random['generate'](0x6)+'@xcally.com';_0x273bd1+='>';}}return _0x273bd1;}function parseEmail(_0x3a597a,_0x297d49,_0x1bafbd){if(_0x297d49['html']){var _0x5ae011=/)<[^<]*)*<\/script>/gi;while(_0x5ae011['test'](_0x297d49[_0x0f20('0x14')])){_0x297d49[_0x0f20('0x14')]=_0x297d49[_0x0f20('0x14')]['replace'](_0x5ae011,'');}if(_0x297d49[_0x0f20('0x14')][_0x0f20('0x15')](_0x0f20('0x16'))){var _0x4a3f3d=[];_0x297d49[_0x0f20('0x17')][_0x0f20('0x18')](_0x55e77b=>{_0x4a3f3d[_0x0f20('0x19')](_0x55e77b[_0x0f20('0x1a')]);});var _0x2b7f14=/]+>/g;var _0x59bcbe=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4971ad=_0x297d49['html'][_0x0f20('0x1b')](_0x59bcbe,_0x0f20('0x1c'));var _0x356e8d=_0x4971ad['replace'](_0x2b7f14,_0x0f20('0x1d'));for(let _0xd27a0e=0x0;_0xd27a0e<_0x4a3f3d[_0x0f20('0xf')];_0xd27a0e++){var _0x522871=_0x356e8d['replace'](_0x0f20('0x1d'),_0x0f20('0x1e')+_0x4a3f3d[_0xd27a0e]+_0x0f20('0x1f'));_0x356e8d=_0x522871;}_0x297d49[_0x0f20('0x14')]=_0x356e8d;}_0x1bafbd[_0x0f20('0x20')]=_0x297d49[_0x0f20('0x14')];}else{_0x1bafbd[_0x0f20('0x20')]=_0x297d49[_0x0f20('0x21')];}if(_0x1bafbd['body']){_0x1bafbd['body']=_0x1bafbd[_0x0f20('0x20')][_0x0f20('0x1b')](/0x0){var _0x30864c=['Auto-Submitted:\x20auto-replied',_0x0f20('0x32'),_0x0f20('0x33')];for(var _0x58515a=0x0;_0x58515a<_0x297d49['headerLines']['length'];_0x58515a++){var _0x26fcd1=_[_0x0f20('0xd')](_0x30864c,_0x297d49[_0x0f20('0x31')][_0x58515a][_0x0f20('0x34')]);if(_0x26fcd1>=0x0){_0x1bafbd['isAutoreply']=!![];}}}return _0x1bafbd;}exports['parser']=function(_0x42e98,_0x268c73,_0x250314){var _0x51ba54={'from':getAddress(_0x268c73['from']),'firstName':getFirstName(_0x268c73[_0x0f20('0x35')]),'lastName':getLastName(_0x268c73[_0x0f20('0x35')]),'mapKey':_0x0f20('0x25'),'message':{'from':getMails(_0x42e98[_0x0f20('0x25')],_0x268c73[_0x0f20('0x35')]),'to':_0x42e98[_0x0f20('0x25')],'cc':'','subject':_0x268c73['subject']||'','messageId':_0x268c73['messageId'],'inReplyTo':_0x268c73[_0x0f20('0x36')],'sentAt':moment(_0x268c73[_0x0f20('0x37')])['format'](_0x0f20('0x38')),'attach':![],'attachments':[]}};if(!_0x268c73[_0x0f20('0x14')]&&!_0x268c73[_0x0f20('0x21')]){var _0x49a954=_['filter'](_0x268c73[_0x0f20('0x17')],{'contentType':'application/ms-tnef'});if(_0x49a954[_0x0f20('0xf')]){logger[_0x0f20('0x39')](util[_0x0f20('0x2c')](_0x0f20('0x3a'),_0x268c73[_0x0f20('0x3b')]));tnef[_0x0f20('0x3c')](_[_0x0f20('0x3d')](_0x49a954)['content'],function(_0x1c8f8e,_0x256004){if(_0x256004){_0x268c73[_0x0f20('0x14')]=_0x256004[_0x0f20('0x3e')]||_0x0f20('0x3f');if(_0x256004[_0x0f20('0x40')]){for(var _0x144e0e=0x0;_0x144e0e<_0x256004[_0x0f20('0x40')][_0x0f20('0xf')];_0x144e0e++){var _0x10c253=_0x256004['Attachments'][_0x144e0e];_0x51ba54[_0x0f20('0x23')][_0x0f20('0x17')][_0x0f20('0x19')]({'filename':_0x10c253[_0x0f20('0x41')],'content':Buffer['from'](_0x10c253[_0x0f20('0x42')])});}}}_0x250314(parseEmail(_0x42e98,_0x268c73,_0x51ba54));});}else{_0x268c73[_0x0f20('0x14')]=_0x0f20('0x3f');_0x250314(parseEmail(_0x42e98,_0x268c73,_0x51ba54));}}else{_0x250314(parseEmail(_0x42e98,_0x268c73,_0x51ba54));}};exports[_0x0f20('0x43')]=function(_0x4f03c3,_0x369afe){var _0x144ebb=[_0x0f20('0x44')+(_0x369afe||''),'auth=Bearer\x20'+_0x4f03c3,'',''];return Buffer[_0x0f20('0x35')](_0x144ebb[_0x0f20('0x11')](''),_0x0f20('0x45'))[_0x0f20('0x46')](_0x0f20('0x47'));}; \ No newline at end of file +var _0x2a10=['date','format','textAsHtml','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','utf-8','toString','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','slice','Anonymous','split','pop','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x4750a2[_0x02a1('0x11')](0x0,-0x1)['join']('\x20'):_0x4a9bee[_0x02a1('0xd')];}return _0x02a1('0x12');}function getLastName(_0x26ace7){var _0x5cdb7d=_['head'](_0x26ace7[_0x02a1('0x8')]);if(_0x5cdb7d&&_0x5cdb7d[_0x02a1('0xd')]){var _0x479f5e=_0x5cdb7d[_0x02a1('0xd')][_0x02a1('0x13')](/\s+/);return _0x479f5e[_0x02a1('0x10')]>0x1?_0x479f5e[_0x02a1('0x14')]():'';}return'';}function getMails(_0x37a74a,_0x3bb159){var _0x45da70='';for(var _0x27297d=0x0;_0x27297d<_0x3bb159[_0x02a1('0x8')]['length'];_0x27297d+=0x1){if(_0x3bb159[_0x02a1('0x8')][_0x27297d]['address']!==_0x37a74a){if(!_[_0x02a1('0x15')](_0x45da70)){_0x45da70+=',';}_0x45da70+=_0x3bb159[_0x02a1('0x8')][_0x27297d][_0x02a1('0xd')]||_0x3bb159[_0x02a1('0x8')][_0x27297d][_0x02a1('0x9')]||'';_0x45da70+='\x20<';_0x45da70+=_0x3bb159['value'][_0x27297d][_0x02a1('0x9')]?_0x3bb159[_0x02a1('0x8')][_0x27297d][_0x02a1('0x9')]:'anonymous'+random[_0x02a1('0xb')](0x6)+_0x02a1('0xc');_0x45da70+='>';}}return _0x45da70;}function parseEmail(_0x26832d,_0x14ea07,_0x32b181){if(_0x14ea07[_0x02a1('0x16')]){var _0x5d4d1c=/)<[^<]*)*<\/script>/gi;while(_0x5d4d1c['test'](_0x14ea07[_0x02a1('0x16')])){_0x14ea07['html']=_0x14ea07[_0x02a1('0x16')][_0x02a1('0x17')](_0x5d4d1c,'');}if(_0x14ea07[_0x02a1('0x16')][_0x02a1('0x18')](_0x02a1('0x19'))){var _0x3a182e=[];_0x14ea07[_0x02a1('0x1a')][_0x02a1('0x1b')](_0x34ffb7=>{_0x3a182e[_0x02a1('0x1c')](_0x34ffb7[_0x02a1('0x1d')]);});var _0x2dbca0=/]+>/g;var _0x10f5ec=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x52dcb6=_0x14ea07['html'][_0x02a1('0x17')](_0x10f5ec,'_SRC');var _0xf80c4e=_0x52dcb6[_0x02a1('0x17')](_0x2dbca0,_0x02a1('0x1e'));for(let _0x4fb716=0x0;_0x4fb716<_0x3a182e[_0x02a1('0x10')];_0x4fb716++){var _0x56b40e=_0xf80c4e[_0x02a1('0x17')]('_IMG',_0x02a1('0x1f')+_0x3a182e[_0x4fb716]+_0x02a1('0x20'));_0xf80c4e=_0x56b40e;}_0x14ea07[_0x02a1('0x16')]=_0xf80c4e;}_0x32b181[_0x02a1('0x21')]=_0x14ea07[_0x02a1('0x16')];}else{_0x32b181[_0x02a1('0x21')]=_0x14ea07['textAsHtml'];}if(_0x32b181[_0x02a1('0x21')]){_0x32b181[_0x02a1('0x21')]=_0x32b181[_0x02a1('0x21')][_0x02a1('0x17')](/0x0){var _0x533c2f=['Auto-Submitted:\x20auto-replied',_0x02a1('0x32'),_0x02a1('0x33')];for(var _0x1857b7=0x0;_0x1857b7<_0x14ea07[_0x02a1('0x31')]['length'];_0x1857b7++){var _0x160b7e=_[_0x02a1('0xf')](_0x533c2f,_0x14ea07[_0x02a1('0x31')][_0x1857b7][_0x02a1('0x34')]);if(_0x160b7e>=0x0){_0x32b181['isAutoreply']=!![];}}}return _0x32b181;}exports[_0x02a1('0x35')]=function(_0x15664c,_0x1772db,_0x355293){var _0x59362a={'from':getAddress(_0x1772db[_0x02a1('0x36')]),'firstName':getFirstName(_0x1772db['from']),'lastName':getLastName(_0x1772db[_0x02a1('0x36')]),'mapKey':_0x02a1('0x6'),'message':{'from':getMails(_0x15664c[_0x02a1('0x6')],_0x1772db[_0x02a1('0x36')]),'to':_0x15664c[_0x02a1('0x6')],'cc':'','subject':_0x1772db[_0x02a1('0x37')]||'','messageId':_0x1772db[_0x02a1('0x38')],'inReplyTo':_0x1772db[_0x02a1('0x39')],'sentAt':moment(_0x1772db[_0x02a1('0x3a')])[_0x02a1('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1772db['html']&&!_0x1772db[_0x02a1('0x3c')]){var _0x4699bc=_['filter'](_0x1772db['attachments'],{'contentType':_0x02a1('0x3d')});if(_0x4699bc[_0x02a1('0x10')]){logger[_0x02a1('0x3e')](util[_0x02a1('0x3b')](_0x02a1('0x3f'),_0x1772db[_0x02a1('0x38')]));tnef[_0x02a1('0x40')](_[_0x02a1('0x41')](_0x4699bc)[_0x02a1('0x2f')],function(_0x1d41a9,_0x461e36){if(_0x461e36){_0x1772db[_0x02a1('0x16')]=_0x461e36[_0x02a1('0x42')]||_0x02a1('0x43');if(_0x461e36['Attachments']){for(var _0x55eaa1=0x0;_0x55eaa1<_0x461e36[_0x02a1('0x44')]['length'];_0x55eaa1++){var _0x42ba65=_0x461e36[_0x02a1('0x44')][_0x55eaa1];_0x59362a['message'][_0x02a1('0x1a')][_0x02a1('0x1c')]({'filename':_0x42ba65[_0x02a1('0x45')],'content':Buffer[_0x02a1('0x36')](_0x42ba65[_0x02a1('0x46')])});}}}_0x355293(parseEmail(_0x15664c,_0x1772db,_0x59362a));});}else{_0x1772db[_0x02a1('0x16')]=_0x02a1('0x43');_0x355293(parseEmail(_0x15664c,_0x1772db,_0x59362a));}}else{_0x355293(parseEmail(_0x15664c,_0x1772db,_0x59362a));}};exports['generateXOAuth2Token']=function(_0x28d50c,_0x12c867){var _0x336cf9=['user='+(_0x12c867||''),'auth=Bearer\x20'+_0x28d50c,'',''];return Buffer['from'](_0x336cf9['join'](''),_0x02a1('0x47'))[_0x02a1('0x48')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d60d426..e1abb7a 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3e6=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x4e7d88,_0x232457){var _0x2730f7=function(_0x2868d){while(--_0x2868d){_0x4e7d88['push'](_0x4e7d88['shift']());}};_0x2730f7(++_0x232457);}(_0xa3e6,0xf9));var _0x6a3e=function(_0x4c8f7a,_0x4830dd){_0x4c8f7a=_0x4c8f7a-0x0;var _0x525e60=_0xa3e6[_0x4c8f7a];return _0x525e60;};'use strict';var _=require(_0x6a3e('0x0'));function MailAccount(_0x3b5c09){this['id']=_0x3b5c09['id']||0x0;this[_0x6a3e('0x1')]=_0x3b5c09['name']||_0x6a3e('0x2');this[_0x6a3e('0x3')]=_0x3b5c09[_0x6a3e('0x3')]||_0x6a3e('0x4');this[_0x6a3e('0x5')]=_0x3b5c09[_0x6a3e('0x5')]||![];this[_0x6a3e('0x6')]=_0x3b5c09[_0x6a3e('0x6')]||[];this[_0x6a3e('0x7')]=_0x3b5c09[_0x6a3e('0x7')]||[];}module[_0x6a3e('0x8')]=MailAccount; \ No newline at end of file +var _0x8248=['key','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x344429,_0x48c8db){var _0x4187e7=function(_0x47a8ca){while(--_0x47a8ca){_0x344429['push'](_0x344429['shift']());}};_0x4187e7(++_0x48c8db);}(_0x8248,0x7d));var _0x8824=function(_0x47265c,_0x1bba5a){_0x47265c=_0x47265c-0x0;var _0x153ee2=_0x8248[_0x47265c];return _0x153ee2;};'use strict';var _=require(_0x8824('0x0'));function MailAccount(_0x4d8421){this['id']=_0x4d8421['id']||0x0;this['name']=_0x4d8421[_0x8824('0x1')]||_0x8824('0x2');this[_0x8824('0x3')]=_0x4d8421[_0x8824('0x3')]||'SERV';this[_0x8824('0x4')]=_0x4d8421[_0x8824('0x4')]||![];this['Imap']=_0x4d8421[_0x8824('0x5')]||[];this[_0x8824('0x6')]=_0x4d8421['Smtp']||[];}module[_0x8824('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c707304..188229e 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bec=['mergeFromDatabase','initMailAccounts','mailAccounts','length','isUndefined','merge','exports','lodash','hasOwnProperty','prototype'];(function(_0x5c05c2,_0x2b37e6){var _0x4c7135=function(_0x2d110c){while(--_0x2d110c){_0x5c05c2['push'](_0x5c05c2['shift']());}};_0x4c7135(++_0x2b37e6);}(_0x6bec,0x1e7));var _0xc6be=function(_0x56f884,_0x399c03){_0x56f884=_0x56f884-0x0;var _0x5b7b23=_0x6bec[_0x56f884];return _0x5b7b23;};'use strict';var _=require(_0xc6be('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4758f5,_0x364edc,_0x47f04e){var _0x253956=_['mapKeys'](_0x4758f5,function(_0x3c05c1,_0x465766){return _0x3c05c1[_0x47f04e];});for(var _0x5551dd in _0x364edc){if(_0x364edc[_0xc6be('0x1')](_0x5551dd)){if(!_0x253956[_0x5551dd]){delete _0x364edc[_0x5551dd];}}}}Realtime[_0xc6be('0x2')][_0xc6be('0x3')]=function(_0x55f982,_0x77c55d){for(var _0x1f5649 in _0x77c55d){if(_0x55f982['hasOwnProperty'](_0x1f5649)){_0x55f982[_0x1f5649]=_0x77c55d[_0x1f5649];}}};Realtime[_0xc6be('0x2')][_0xc6be('0x4')]=function(){var _0x1a7ccb=this;return function(_0xf8ceac){if(_0xf8ceac){freeIsNotKey(_0xf8ceac,_0x1a7ccb[_0xc6be('0x5')],'id');for(var _0x2e1f77=0x0,_0x3d971a={},_0x586785={};_0x2e1f77<_0xf8ceac[_0xc6be('0x6')];_0x2e1f77+=0x1){_0x3d971a=_0xf8ceac[_0x2e1f77];if(_[_0xc6be('0x7')](_0x1a7ccb['mailAccounts'][_0x3d971a['id']])){_0x1a7ccb['mailAccounts'][_0x3d971a['id']]=new MailAccount(_0x3d971a);}else{_[_0xc6be('0x8')](_0x1a7ccb[_0xc6be('0x5')][_0x3d971a['id']],_0x3d971a);}}}return _0x1a7ccb[_0xc6be('0x5')];};};module[_0xc6be('0x9')]=Realtime; \ No newline at end of file +var _0x75e0=['hasOwnProperty','prototype','isUndefined','merge','exports','lodash','mailAccounts','mapKeys'];(function(_0x43ad16,_0x2f7646){var _0x27ab07=function(_0x760b83){while(--_0x760b83){_0x43ad16['push'](_0x43ad16['shift']());}};_0x27ab07(++_0x2f7646);}(_0x75e0,0xfd));var _0x075e=function(_0xfd8130,_0x53bf47){_0xfd8130=_0xfd8130-0x0;var _0x3a13bf=_0x75e0[_0xfd8130];return _0x3a13bf;};'use strict';var _=require(_0x075e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x075e('0x1')]={};};function freeIsNotKey(_0x419551,_0x2864dd,_0x33da46){var _0x453e0d=_[_0x075e('0x2')](_0x419551,function(_0x438e40,_0xec450c){return _0x438e40[_0x33da46];});for(var _0x19f73a in _0x2864dd){if(_0x2864dd[_0x075e('0x3')](_0x19f73a)){if(!_0x453e0d[_0x19f73a]){delete _0x2864dd[_0x19f73a];}}}}Realtime[_0x075e('0x4')]['mergeFromDatabase']=function(_0x3763d1,_0x24155c){for(var _0x213b37 in _0x24155c){if(_0x3763d1[_0x075e('0x3')](_0x213b37)){_0x3763d1[_0x213b37]=_0x24155c[_0x213b37];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x1d80c4=this;return function(_0xffadda){if(_0xffadda){freeIsNotKey(_0xffadda,_0x1d80c4[_0x075e('0x1')],'id');for(var _0x36ac10=0x0,_0x238ae3={},_0x32bda0={};_0x36ac10<_0xffadda['length'];_0x36ac10+=0x1){_0x238ae3=_0xffadda[_0x36ac10];if(_[_0x075e('0x5')](_0x1d80c4[_0x075e('0x1')][_0x238ae3['id']])){_0x1d80c4[_0x075e('0x1')][_0x238ae3['id']]=new MailAccount(_0x238ae3);}else{_[_0x075e('0x6')](_0x1d80c4[_0x075e('0x1')][_0x238ae3['id']],_0x238ae3);}}}return _0x1d80c4[_0x075e('0x1')];};};module[_0x075e('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3fadced..acaf6d4 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c1a=['data5','MailServerOut','service','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','active','ListId','MailServerIn','Imap','CloudProvider'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x7c1a,0x159));var _0xa7c1=function(_0x35ac82,_0x369599){_0x35ac82=_0x35ac82-0x0;var _0x5a6528=_0x7c1a[_0x35ac82];return _0x5a6528;};'use strict';var client=require(_0xa7c1('0x0'));exports[_0xa7c1('0x1')]=function(){return function(){return client[_0xa7c1('0x2')](_0xa7c1('0x3'),{'options':{'attributes':['id',_0xa7c1('0x4'),_0xa7c1('0x5'),'service',_0xa7c1('0x6'),_0xa7c1('0x7'),'key',_0xa7c1('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0xa7c1('0x9'),'as':_0xa7c1('0xa'),'include':[{'model':_0xa7c1('0xb'),'attributes':['id',_0xa7c1('0x4'),'service','type',_0xa7c1('0xc')],'as':_0xa7c1('0xb')}]},{'model':_0xa7c1('0xd'),'as':'Smtp','include':[{'model':_0xa7c1('0xb'),'attributes':['id',_0xa7c1('0x4'),_0xa7c1('0xe'),'type',_0xa7c1('0xc')],'as':_0xa7c1('0xb')}]}]},'log':'getMailAccount'});};};exports[_0xa7c1('0xf')]=function(_0x1548ea,_0x53a994){return client[_0xa7c1('0x2')](_0xa7c1('0x10'),{'account':{'id':_0x1548ea},'body':_0x53a994,'log':_0xa7c1('0x10')});}; \ No newline at end of file +var _0x9de5=['NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','key','Imap','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9de5,0xbc));var _0x59de=function(_0x37a3aa,_0x297a99){_0x37a3aa=_0x37a3aa-0x0;var _0x2f1132=_0x9de5[_0x37a3aa];return _0x2f1132;};'use strict';var client=require(_0x59de('0x0'));exports[_0x59de('0x1')]=function(){return function(){return client[_0x59de('0x2')](_0x59de('0x3'),{'options':{'attributes':['id',_0x59de('0x4'),_0x59de('0x5'),_0x59de('0x6'),'email','active',_0x59de('0x7'),'ListId','TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x59de('0x8'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x59de('0x6'),_0x59de('0x9'),_0x59de('0xa')],'as':_0x59de('0xb')}]},{'model':_0x59de('0xc'),'as':_0x59de('0xd'),'include':[{'model':'CloudProvider','attributes':['id',_0x59de('0x4'),'service','type',_0x59de('0xa')],'as':'CloudProvider'}]}]},'log':_0x59de('0xe')});};};exports[_0x59de('0xf')]=function(_0x580e13,_0x127c7a){return client[_0x59de('0x2')](_0x59de('0x10'),{'account':{'id':_0x580e13},'body':_0x127c7a,'log':_0x59de('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 36a4903..13b5a5b 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3d8=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x33723f,_0x2b68ca){var _0x58ee65=function(_0x2886aa){while(--_0x2886aa){_0x33723f['push'](_0x33723f['shift']());}};_0x58ee65(++_0x2b68ca);}(_0xe3d8,0xaf));var _0x8e3d=function(_0x21b3d4,_0x17309){_0x21b3d4=_0x21b3d4-0x0;var _0x188e69=_0xe3d8[_0x21b3d4];return _0x188e69;};'use strict';var client=require(_0x8e3d('0x0'));exports[_0x8e3d('0x1')]=function(){return client[_0x8e3d('0x2')](_0x8e3d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8e3d('0x4')]},'log':_0x8e3d('0x5')});}; \ No newline at end of file +var _0xa0f4=['getSettings','loginMailFrequency','GetSettings','../client'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa0f4,0x103));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4a0f('0x0'));exports[_0x4a0f('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x4a0f('0x2')]},'log':_0x4a0f('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d9c44c5..73f338d 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 3597293..4a7440d 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde04=['http','express','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xde04,0x11e));var _0x4de0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xde04[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var http=require(_0x4de0('0x0'));var express=require(_0x4de0('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x4de0('0x2'));var app=express();var server=http[_0x4de0('0x3')](app);server[_0x4de0('0x4')]=0xdbba0;if(sticky[_0x4de0('0x5')](server,config[_0x4de0('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x4de0('0x7'),_0x4de0('0x8')]});config[_0x4de0('0x9')]=_[_0x4de0('0xa')](config['redis'],{'host':_0x4de0('0xb'),'port':0x18eb});socketio[_0x4de0('0xc')](require(_0x4de0('0xd'))({'pubClient':new Redis(config[_0x4de0('0x9')]),'subClient':new Redis(config[_0x4de0('0x9')])}));require('../../config/triggers')[_0x4de0('0xe')]();require('../../config/socketio')[_0x4de0('0xe')](socketio);require(_0x4de0('0xf'))[_0x4de0('0xe')](app);require(_0x4de0('0x10'))[_0x4de0('0xe')](app);}else{server[_0x4de0('0x11')](_0x4de0('0x12'),function(){console[_0x4de0('0x13')](_0x4de0('0x14'),config['port']);});}exports=module[_0x4de0('0x15')]=app; \ No newline at end of file +var _0x236b=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','../../config/socketio','default','../../config/express','../../routes','once','listening'];(function(_0x5bdf15,_0x39f070){var _0x1c7939=function(_0x2895e9){while(--_0x2895e9){_0x5bdf15['push'](_0x5bdf15['shift']());}};_0x1c7939(++_0x39f070);}(_0x236b,0x178));var _0xb236=function(_0x4f85ac,_0x417ef0){_0x4f85ac=_0x4f85ac-0x0;var _0x4ebdfb=_0x236b[_0x4f85ac];return _0x4ebdfb;};'use strict';var _=require(_0xb236('0x0'));var http=require('http');var express=require('express');var sticky=require(_0xb236('0x1'));var Redis=require(_0xb236('0x2'));var config=require(_0xb236('0x3'));var app=express();var server=http[_0xb236('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0xb236('0x5')](server,config[_0xb236('0x6')])){var socketio=require(_0xb236('0x7'))(server,{'transports':[_0xb236('0x8'),_0xb236('0x9')]});config[_0xb236('0xa')]=_[_0xb236('0xb')](config[_0xb236('0xa')],{'host':_0xb236('0xc'),'port':0x18eb});socketio[_0xb236('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0xb236('0xa')]),'subClient':new Redis(config[_0xb236('0xa')])}));require('../../config/triggers')['default']();require(_0xb236('0xe'))[_0xb236('0xf')](socketio);require(_0xb236('0x10'))[_0xb236('0xf')](app);require(_0xb236('0x11'))[_0xb236('0xf')](app);}else{server[_0xb236('0x12')](_0xb236('0x13'),function(){console[_0xb236('0x14')](_0xb236('0x15'),config[_0xb236('0x6')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 77271c5..f2443e5 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9777=['bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x9777,0x13a));var _0x7977=function(_0x1608ae,_0x3ed04a){_0x1608ae=_0x1608ae-0x0;var _0x1c85d2=_0x9777[_0x1608ae];return _0x1c85d2;};'use strict';var jayson=require(_0x7977('0x0'));var BPromise=require(_0x7977('0x1'));var logger=require(_0x7977('0x2'))(_0x7977('0x3'));var client=jayson[_0x7977('0x4')][_0x7977('0x5')]({'port':0x2329});client['Request']=function(_0x479351,_0x1f6b89){return new BPromise(function(_0x6650d0,_0x3ae316){return client[_0x7977('0x6')](_0x479351,_0x1f6b89)[_0x7977('0x7')](function(_0x17be9b){logger[_0x7977('0x8')](_0x7977('0x9'),_0x7977('0x3'),_0x479351,_0x1f6b89,_0x17be9b);if(_0x17be9b[_0x7977('0xa')]){logger[_0x7977('0xa')](_0x7977('0x9'),_0x7977('0x3'),_0x479351,_0x17be9b[_0x7977('0xa')][_0x7977('0xb')],_0x1f6b89);return _0x3ae316(_0x17be9b['error'][_0x7977('0xb')]);}else{return _0x6650d0(_0x17be9b[_0x7977('0xc')]);}})[_0x7977('0xd')](function(_0x46a360){logger['error'](_0x7977('0x9'),_0x7977('0x3'),_0x479351,_0x46a360,_0x1f6b89);return _0x3ae316(_0x46a360);});});};module[_0x7977('0xe')]=client; \ No newline at end of file +var _0xf258=['Request','request','then','rpc','error','message','result','catch','exports','routing','client','http'];(function(_0x191815,_0x489ebc){var _0x2418fb=function(_0x125928){while(--_0x125928){_0x191815['push'](_0x191815['shift']());}};_0x2418fb(++_0x489ebc);}(_0xf258,0xc9));var _0x8f25=function(_0x171e79,_0x1f8f18){_0x171e79=_0x171e79-0x0;var _0xe94700=_0xf258[_0x171e79];return _0xe94700;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x8f25('0x0'));var client=jayson[_0x8f25('0x1')][_0x8f25('0x2')]({'port':0x2329});client[_0x8f25('0x3')]=function(_0x507ef0,_0x49ee3b){return new BPromise(function(_0x570e53,_0x413c91){return client[_0x8f25('0x4')](_0x507ef0,_0x49ee3b)[_0x8f25('0x5')](function(_0x55d480){logger['debug'](_0x8f25('0x6'),_0x8f25('0x0'),_0x507ef0,_0x49ee3b,_0x55d480);if(_0x55d480[_0x8f25('0x7')]){logger[_0x8f25('0x7')]('rpc','routing',_0x507ef0,_0x55d480['error'][_0x8f25('0x8')],_0x49ee3b);return _0x413c91(_0x55d480['error'][_0x8f25('0x8')]);}else{return _0x570e53(_0x55d480[_0x8f25('0x9')]);}})[_0x8f25('0xa')](function(_0x47ccf8){logger[_0x8f25('0x7')](_0x8f25('0x6'),_0x8f25('0x0'),_0x507ef0,_0x47ccf8,_0x49ee3b);return _0x413c91(_0x47ccf8);});});};module[_0x8f25('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index b258b76..0640f75 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4bb=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','initAgents','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x20e65c,_0x231b2e){var _0x13277c=function(_0x755341){while(--_0x755341){_0x20e65c['push'](_0x20e65c['shift']());}};_0x13277c(++_0x231b2e);}(_0xf4bb,0x119));var _0xbf4b=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xf4bb[_0x2dea24];return _0x309d58;};'use strict';var BPromise=require(_0xbf4b('0x0'));var server=require('./server');var Realtime=require(_0xbf4b('0x1'));var user=require('./rpc/user');var interval=require(_0xbf4b('0x2'));var openchannelQueue=require(_0xbf4b('0x3'));var chatQueue=require(_0xbf4b('0x4'));var smsQueue=require(_0xbf4b('0x5'));var mailQueue=require(_0xbf4b('0x6'));var faxQueue=require(_0xbf4b('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xbf4b('0x8')]()[_0xbf4b('0x9')](user['getAgents']())[_0xbf4b('0x9')](realtime[_0xbf4b('0xa')]())[_0xbf4b('0x9')](interval['getIntervals']())[_0xbf4b('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0xbf4b('0xb')]())[_0xbf4b('0x9')](realtime[_0xbf4b('0xc')]())[_0xbf4b('0x9')](chatQueue[_0xbf4b('0xd')]())[_0xbf4b('0x9')](realtime[_0xbf4b('0xe')]())[_0xbf4b('0x9')](smsQueue[_0xbf4b('0xf')]())[_0xbf4b('0x9')](realtime[_0xbf4b('0x10')]())[_0xbf4b('0x9')](mailQueue[_0xbf4b('0x11')]())[_0xbf4b('0x9')](realtime[_0xbf4b('0x12')]())[_0xbf4b('0x9')](faxQueue[_0xbf4b('0x13')]())[_0xbf4b('0x9')](realtime[_0xbf4b('0x14')]())[_0xbf4b('0x9')](whatsappQueue[_0xbf4b('0x15')]())[_0xbf4b('0x9')](realtime[_0xbf4b('0x16')]())[_0xbf4b('0x9')](function(){return realtime;});}function main(){return server[_0xbf4b('0x17')](realtime)['then'](function(_0x91eb7e){return initRealtime();})[_0xbf4b('0x9')](function(_0x5a0ff2){return setInterval(initRealtime,0x1388);})[_0xbf4b('0x18')](function(_0x238947){console[_0xbf4b('0x19')](_0x238947);});}main(); \ No newline at end of file +var _0xf8c3=['bluebird','./server','./realtime','./rpc/user','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','getIntervals','initIntervals','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0xf8c3,0x84));var _0x3f8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8c3[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x3f8c('0x0'));var server=require(_0x3f8c('0x1'));var Realtime=require(_0x3f8c('0x2'));var user=require(_0x3f8c('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x3f8c('0x4'));var faxQueue=require(_0x3f8c('0x5'));var whatsappQueue=require(_0x3f8c('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x3f8c('0x7')](user[_0x3f8c('0x8')]())[_0x3f8c('0x7')](realtime['initAgents']())[_0x3f8c('0x7')](interval[_0x3f8c('0x9')]())[_0x3f8c('0x7')](realtime[_0x3f8c('0xa')]())[_0x3f8c('0x7')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x3f8c('0xb')]())['then'](chatQueue['getChatQueues']())[_0x3f8c('0x7')](realtime[_0x3f8c('0xc')]())['then'](smsQueue[_0x3f8c('0xd')]())[_0x3f8c('0x7')](realtime[_0x3f8c('0xe')]())[_0x3f8c('0x7')](mailQueue[_0x3f8c('0xf')]())['then'](realtime[_0x3f8c('0x10')]())[_0x3f8c('0x7')](faxQueue[_0x3f8c('0x11')]())[_0x3f8c('0x7')](realtime[_0x3f8c('0x12')]())[_0x3f8c('0x7')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x3f8c('0x13')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x3f8c('0x7')](function(_0x3bad01){return initRealtime();})[_0x3f8c('0x7')](function(_0x11020e){return setInterval(initRealtime,0x1388);})[_0x3f8c('0x14')](function(_0xdff585){console[_0x3f8c('0x15')](_0xdff585);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 55af515..48da8d3 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x2ff791,_0x4ebe78){var _0x2fd61b=function(_0x4070dc){while(--_0x4070dc){_0x2ff791['push'](_0x2ff791['shift']());}};_0x2fd61b(++_0x4ebe78);}(_0x5fc3,0xa8));var _0x35fc=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x5fc3[_0x27e811];return _0x1627fa;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x233fe5,_0x522375){var _0x2a2829=function(_0x3085d2){while(--_0x3085d2){_0x233fe5['push'](_0x233fe5['shift']());}};_0x2a2829(++_0x522375);}(_0x7a54,0x106));var _0x47a5=function(_0x1fc136,_0x3b2fbf){_0x1fc136=_0x1fc136-0x0;var _0x44c4c6=_0x7a54[_0x1fc136];return _0x44c4c6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 88109e6..5847fd9 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f98=['error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client','http','request','then'];(function(_0x4e33a1,_0x2ddafe){var _0x185516=function(_0x39b75b){while(--_0x39b75b){_0x4e33a1['push'](_0x4e33a1['shift']());}};_0x185516(++_0x2ddafe);}(_0x9f98,0x1bd));var _0x89f9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9f98[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0x89f9('0x0'));var jayson=require(_0x89f9('0x1'));var client=jayson[_0x89f9('0x2')][_0x89f9('0x3')]({'port':0x232b});function request(_0x29efcb,_0x5aa572){return new BPromise(function(_0x1288b0,_0x3d2180){return client[_0x89f9('0x4')](_0x29efcb,_0x5aa572)[_0x89f9('0x5')](function(_0x4de947){if(_0x4de947['error']){return _0x3d2180(_0x4de947[_0x89f9('0x6')][_0x89f9('0x7')]);}else{return _0x1288b0(_0x4de947[_0x89f9('0x8')]);}})[_0x89f9('0x9')](function(_0x972ecd){return _0x3d2180(_0x972ecd);});});}exports[_0x89f9('0xa')]=function(_0x2d22a8,_0x45bccf){return request('SendMail',{'account':_0x2d22a8,'message':_0x45bccf});}; \ No newline at end of file +var _0xdf54=['sendMailMessage','bluebird','client','http','request','error','message','catch'];(function(_0x2d6c14,_0x510cb8){var _0x2b9926=function(_0x1416fc){while(--_0x1416fc){_0x2d6c14['push'](_0x2d6c14['shift']());}};_0x2b9926(++_0x510cb8);}(_0xdf54,0x129));var _0x4df5=function(_0x46043e,_0x5bf56c){_0x46043e=_0x46043e-0x0;var _0x2c795b=_0xdf54[_0x46043e];return _0x2c795b;};'use strict';var BPromise=require(_0x4df5('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x4df5('0x1')][_0x4df5('0x2')]({'port':0x232b});function request(_0x5a8d92,_0x4052de){return new BPromise(function(_0x11e649,_0x2d9642){return client[_0x4df5('0x3')](_0x5a8d92,_0x4052de)['then'](function(_0x54852d){if(_0x54852d['error']){return _0x2d9642(_0x54852d[_0x4df5('0x4')][_0x4df5('0x5')]);}else{return _0x11e649(_0x54852d['result']);}})[_0x4df5('0x6')](function(_0x2d6db5){return _0x2d9642(_0x2d6db5);});});}exports[_0x4df5('0x7')]=function(_0x3a0c5d,_0x3ef48d){return request('SendMail',{'account':_0x3a0c5d,'message':_0x3ef48d});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3b373d3..3bc631b 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32b6=['format','faxPause','mailStatusTime','faxStatus','busy','chatWaitingInteractions','stringify','emit','user:routing:update','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','StatusTime'];(function(_0x25b8b1,_0xe0b951){var _0x2d04f7=function(_0x1a45b8){while(--_0x1a45b8){_0x25b8b1['push'](_0x25b8b1['shift']());}};_0x2d04f7(++_0xe0b951);}(_0x32b6,0x1d1));var _0x632b=function(_0x225b6a,_0x3f7128){_0x225b6a=_0x225b6a-0x0;var _0x5bf320=_0x32b6[_0x225b6a];return _0x5bf320;};'use strict';var _=require(_0x632b('0x0'));var md5=require(_0x632b('0x1'));var moment=require('moment');var Redis=require(_0x632b('0x2'));var config=require(_0x632b('0x3'));config['redis']=_['defaults'](config[_0x632b('0x4')],{'host':_0x632b('0x5'),'port':0x18eb});var io=require(_0x632b('0x6'))(new Redis(config[_0x632b('0x4')]));function Agent(_0x1adfe6){this['id']=_0x1adfe6['id']||0x0;this[_0x632b('0x7')]=_0x1adfe6[_0x632b('0x7')]||'';this[_0x632b('0x8')]=_0x1adfe6[_0x632b('0x8')]||!![];this[_0x632b('0x9')]=_0x1adfe6['voicePause']||![];this[_0x632b('0xa')]=_0x1adfe6[_0x632b('0xa')]||![];this[_0x632b('0xb')]=_0x1adfe6[_0x632b('0xb')]||![];this['faxPause']=_0x1adfe6['faxPause']||![];this['smsPause']=_0x1adfe6[_0x632b('0xc')]||![];this['openchannelPause']=_0x1adfe6[_0x632b('0xd')]||![];this[_0x632b('0xe')]=_0x632b('0xf');this[_0x632b('0x10')]=0x0;this[_0x632b('0x11')]=_0x1adfe6[_0x632b('0x11')]||0x0;this[_0x632b('0x12')]=0x0;this[_0x632b('0x13')]=_0x632b('0xf');this['mailStatusTime']=0x0;this[_0x632b('0x14')]=_0x1adfe6[_0x632b('0x14')]||0x0;this[_0x632b('0x15')]=0x0;this['faxStatus']=_0x632b('0xf');this[_0x632b('0x16')]=0x0;this[_0x632b('0x17')]=_0x1adfe6[_0x632b('0x17')]||0x0;this[_0x632b('0x18')]=0x0;this[_0x632b('0x19')]='unknown';this[_0x632b('0x1a')]=0x0;this['smsCapacity']=_0x1adfe6['smsCapacity']||0x0;this[_0x632b('0x1b')]=0x0;this['whatsappStatus']=_0x632b('0xf');this[_0x632b('0x1c')]=0x0;this[_0x632b('0x1d')]=_0x1adfe6['whatsappCapacity']||0x0;this[_0x632b('0x1e')]=0x0;this[_0x632b('0x1f')]=_0x632b('0xf');this[_0x632b('0x20')]=0x0;this['openchannelCapacity']=_0x1adfe6[_0x632b('0x21')]||0x0;this[_0x632b('0x22')]=0x0;this['busy']=![];this[_0x632b('0x23')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0x632b('0x24')]={};this['mailWaitingInteractions']={};this[_0x632b('0x25')]={};this[_0x632b('0x26')]={};this[_0x632b('0x27')]={};this['updateRealtime']();}Agent[_0x632b('0x28')][_0x632b('0x29')]=function(_0x59d83a){if(this[_0x59d83a+_0x632b('0x2a')]>0x0){if(this[_0x59d83a+_0x632b('0x2b')]>0x0&&this[_0x59d83a+_0x632b('0x2a')]>=this[_0x59d83a+_0x632b('0x2b')]){return _0x632b('0x2c');}else{return _0x632b('0x2d');}}else{return'idle';}};Agent['prototype'][_0x632b('0x2e')]=function(){var _0x4d3a70=[_0x632b('0x2f'),_0x632b('0x30'),'openchannel',_0x632b('0x31'),_0x632b('0x32'),_0x632b('0x33')];for(var _0x18dc8c=0x0;_0x18dc8c<_0x4d3a70[_0x632b('0x34')];_0x18dc8c+=0x1){var _0x515d74=this[_0x632b('0x29')](_0x4d3a70[_0x18dc8c]);if(this[_0x4d3a70[_0x18dc8c]+_0x632b('0x35')]!==_0x515d74){this[_0x4d3a70[_0x18dc8c]+_0x632b('0x36')]=_['toNumber'](moment()[_0x632b('0x37')]('x'));}this[_0x4d3a70[_0x18dc8c]+_0x632b('0x35')]=_0x515d74;}var _0x1819fa={'id':this['id'],'name':this[_0x632b('0x7')],'online':this[_0x632b('0x8')],'voicePause':this[_0x632b('0x9')],'chatPause':this[_0x632b('0xa')],'mailPause':this[_0x632b('0xb')],'smsPause':this[_0x632b('0xc')],'faxPause':this[_0x632b('0x38')],'openchannelPause':this[_0x632b('0xd')],'chatStatus':this[_0x632b('0xe')],'chatStatusTime':this[_0x632b('0x10')],'chatCapacity':this[_0x632b('0x11')],'chatCurrentCapacity':this[_0x632b('0x12')],'mailStatus':this[_0x632b('0x13')],'mailStatusTime':this[_0x632b('0x39')],'mailCapacity':this[_0x632b('0x14')],'mailCurrentCapacity':this[_0x632b('0x15')],'faxStatus':this[_0x632b('0x3a')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x632b('0x17')],'faxCurrentCapacity':this[_0x632b('0x18')],'smsStatus':this[_0x632b('0x19')],'smsStatusTime':this[_0x632b('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x632b('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x632b('0x1c')],'whatsappCapacity':this[_0x632b('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x632b('0x1f')],'openchannelStatusTime':this[_0x632b('0x20')],'openchannelCapacity':this[_0x632b('0x21')],'openchannelCurrentCapacity':this[_0x632b('0x22')],'busy':this[_0x632b('0x3b')],'busyQueue':this[_0x632b('0x23')],'chatWaitingInteractions':this[_0x632b('0x3c')],'faxWaitingInteractions':this[_0x632b('0x24')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x632b('0x26')],'whatsappWaitingInteractions':this[_0x632b('0x27')]};var _0x52872a=md5(JSON[_0x632b('0x3d')](_0x1819fa));if(this[_0x632b('0x1')]!==_0x52872a){this[_0x632b('0x1')]=_0x52872a;io[_0x632b('0x3e')](_0x632b('0x3f'),_['omit'](_0x1819fa,['online']));}};module[_0x632b('0x40')]=Agent; \ No newline at end of file +var _0x5430=['mailWaitingInteractions','stringify','emit','omit','lodash','md5','moment','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','mailCurrentCapacity','faxStatusTime','busy'];(function(_0x461b52,_0x20b9ed){var _0x2c3811=function(_0xba555c){while(--_0xba555c){_0x461b52['push'](_0x461b52['shift']());}};_0x2c3811(++_0x20b9ed);}(_0x5430,0x10c));var _0x0543=function(_0x2e0b68,_0x6c356){_0x2e0b68=_0x2e0b68-0x0;var _0x1966c1=_0x5430[_0x2e0b68];return _0x1966c1;};'use strict';var _=require(_0x0543('0x0'));var md5=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var Redis=require(_0x0543('0x3'));var config=require(_0x0543('0x4'));config[_0x0543('0x5')]=_['defaults'](config['redis'],{'host':_0x0543('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0xce0b65){this['id']=_0xce0b65['id']||0x0;this[_0x0543('0x7')]=_0xce0b65[_0x0543('0x7')]||'';this[_0x0543('0x8')]=_0xce0b65[_0x0543('0x8')]||!![];this['voicePause']=_0xce0b65[_0x0543('0x9')]||![];this[_0x0543('0xa')]=_0xce0b65[_0x0543('0xa')]||![];this[_0x0543('0xb')]=_0xce0b65[_0x0543('0xb')]||![];this[_0x0543('0xc')]=_0xce0b65['faxPause']||![];this[_0x0543('0xd')]=_0xce0b65[_0x0543('0xd')]||![];this['openchannelPause']=_0xce0b65[_0x0543('0xe')]||![];this[_0x0543('0xf')]=_0x0543('0x10');this[_0x0543('0x11')]=0x0;this[_0x0543('0x12')]=_0xce0b65[_0x0543('0x12')]||0x0;this[_0x0543('0x13')]=0x0;this[_0x0543('0x14')]=_0x0543('0x10');this[_0x0543('0x15')]=0x0;this[_0x0543('0x16')]=_0xce0b65[_0x0543('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x0543('0x17')]=_0x0543('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0xce0b65[_0x0543('0x18')]||0x0;this[_0x0543('0x19')]=0x0;this[_0x0543('0x1a')]=_0x0543('0x10');this[_0x0543('0x1b')]=0x0;this['smsCapacity']=_0xce0b65[_0x0543('0x1c')]||0x0;this[_0x0543('0x1d')]=0x0;this[_0x0543('0x1e')]=_0x0543('0x10');this[_0x0543('0x1f')]=0x0;this[_0x0543('0x20')]=_0xce0b65[_0x0543('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x0543('0x21')]='unknown';this['openchannelStatusTime']=0x0;this[_0x0543('0x22')]=_0xce0b65[_0x0543('0x22')]||0x0;this[_0x0543('0x23')]=0x0;this['busy']=![];this[_0x0543('0x24')]=undefined;this['md5']='';this[_0x0543('0x25')]={};this[_0x0543('0x26')]={};this['mailWaitingInteractions']={};this[_0x0543('0x27')]={};this[_0x0543('0x28')]={};this[_0x0543('0x29')]={};this[_0x0543('0x2a')]();}Agent[_0x0543('0x2b')][_0x0543('0x2c')]=function(_0x4adba7){if(this[_0x4adba7+'CurrentCapacity']>0x0){if(this[_0x4adba7+'Capacity']>0x0&&this[_0x4adba7+_0x0543('0x2d')]>=this[_0x4adba7+_0x0543('0x2e')]){return _0x0543('0x2f');}else{return _0x0543('0x30');}}else{return _0x0543('0x31');}};Agent[_0x0543('0x2b')][_0x0543('0x2a')]=function(){var _0x17a3de=[_0x0543('0x32'),_0x0543('0x33'),_0x0543('0x34'),_0x0543('0x35'),'sms',_0x0543('0x36')];for(var _0x153bda=0x0;_0x153bda<_0x17a3de[_0x0543('0x37')];_0x153bda+=0x1){var _0x4f2592=this[_0x0543('0x2c')](_0x17a3de[_0x153bda]);if(this[_0x17a3de[_0x153bda]+_0x0543('0x38')]!==_0x4f2592){this[_0x17a3de[_0x153bda]+_0x0543('0x39')]=_[_0x0543('0x3a')](moment()['format']('x'));}this[_0x17a3de[_0x153bda]+_0x0543('0x38')]=_0x4f2592;}var _0x10b9f3={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x0543('0x9')],'chatPause':this[_0x0543('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x0543('0xd')],'faxPause':this[_0x0543('0xc')],'openchannelPause':this[_0x0543('0xe')],'chatStatus':this[_0x0543('0xf')],'chatStatusTime':this[_0x0543('0x11')],'chatCapacity':this[_0x0543('0x12')],'chatCurrentCapacity':this[_0x0543('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x0543('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x0543('0x3b')],'faxStatus':this[_0x0543('0x17')],'faxStatusTime':this[_0x0543('0x3c')],'faxCapacity':this[_0x0543('0x18')],'faxCurrentCapacity':this[_0x0543('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0543('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0543('0x1d')],'whatsappStatus':this[_0x0543('0x1e')],'whatsappStatusTime':this[_0x0543('0x1f')],'whatsappCapacity':this[_0x0543('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x0543('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x0543('0x22')],'openchannelCurrentCapacity':this[_0x0543('0x23')],'busy':this[_0x0543('0x3d')],'busyQueue':this[_0x0543('0x24')],'chatWaitingInteractions':this[_0x0543('0x25')],'faxWaitingInteractions':this[_0x0543('0x26')],'mailWaitingInteractions':this[_0x0543('0x3e')],'openchannelWaitingInteractions':this[_0x0543('0x27')],'smsWaitingInteractions':this[_0x0543('0x28')],'whatsappWaitingInteractions':this[_0x0543('0x29')]};var _0x55eeba=md5(JSON[_0x0543('0x3f')](_0x10b9f3));if(this[_0x0543('0x1')]!==_0x55eeba){this['md5']=_0x55eeba;io[_0x0543('0x40')]('user:routing:update',_[_0x0543('0x41')](_0x10b9f3,[_0x0543('0x8')]));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 3068970..8ec2848 100644 --- a/server/services/routing/model/chatQueue.js +++ b/server/services/routing/model/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b12=['length','online','loggedIn','chatPause','paused','available','stringify','format','emit','lodash','md5','util','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map'];(function(_0x4b978a,_0x472e65){var _0x2dbd2c=function(_0x18be84){while(--_0x18be84){_0x4b978a['push'](_0x4b978a['shift']());}};_0x2dbd2c(++_0x472e65);}(_0x0b12,0x175));var _0x20b1=function(_0x1ff98f,_0x31ecea){_0x1ff98f=_0x1ff98f-0x0;var _0x3fc23a=_0x0b12[_0x1ff98f];return _0x3fc23a;};'use strict';var _=require(_0x20b1('0x0'));var md5=require(_0x20b1('0x1'));var util=require(_0x20b1('0x2'));var Redis=require(_0x20b1('0x3'));var config=require(_0x20b1('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x20b1('0x5'),'port':0x18eb});var io=require(_0x20b1('0x6'))(new Redis(config[_0x20b1('0x7')]));function ChatQueue(_0x2546d5){this['id']=_0x2546d5['id']||0x0;this[_0x20b1('0x8')]=_0x2546d5['name']||'';this[_0x20b1('0x9')]=_0x2546d5['timeout']||0xa;this[_0x20b1('0xa')]=_0x2546d5[_0x20b1('0xa')]||'beepall';this[_0x20b1('0xb')]=_0x2546d5[_0x20b1('0xb')];this[_0x20b1('0xc')]={};this[_0x20b1('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x20b1('0xe')]();}ChatQueue[_0x20b1('0xf')][_0x20b1('0x10')]=function(){var _0xb0ea97=this['mapAgentsId'][_0x20b1('0x11')];this[_0x20b1('0xc')]=_[_0x20b1('0x12')](this['Agents'],'id');this[_0x20b1('0xc')][_0x20b1('0x11')]=_0xb0ea97;};ChatQueue['prototype'][_0x20b1('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1bbf0a=0x0;_0x1bbf0a=0x0?this[_0x20b1('0x18')]:0x0;var _0x3cf85a={'id':this['id'],'available':this[_0x20b1('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x20b1('0x17')],'waiting':this[_0x20b1('0xd')]};var _0x20dab6=md5(JSON[_0x20b1('0x19')](_0x3cf85a));if(this[_0x20b1('0x1')]!==_0x20dab6){this[_0x20b1('0x1')]=_0x20dab6;io['to'](util[_0x20b1('0x1a')]('chat:queue:%s',_0x3cf85a[_0x20b1('0x8')]))[_0x20b1('0x1b')]('chat_queue:save',_0x3cf85a);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xd1a0=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','format','emit','md5','../../../config/environment','redis','localhost','name'];(function(_0x3e8974,_0x599df){var _0x3f549b=function(_0x1d0248){while(--_0x1d0248){_0x3e8974['push'](_0x3e8974['shift']());}};_0x3f549b(++_0x599df);}(_0xd1a0,0x103));var _0x0d1a=function(_0x390111,_0x29668f){_0x390111=_0x390111-0x0;var _0x203522=_0xd1a0[_0x390111];return _0x203522;};'use strict';var _=require('lodash');var md5=require(_0x0d1a('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x0d1a('0x1'));config[_0x0d1a('0x2')]=_['defaults'](config[_0x0d1a('0x2')],{'host':_0x0d1a('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0d1a('0x2')]));function ChatQueue(_0x19bb5b){this['id']=_0x19bb5b['id']||0x0;this['name']=_0x19bb5b[_0x0d1a('0x4')]||'';this[_0x0d1a('0x5')]=_0x19bb5b[_0x0d1a('0x5')]||0xa;this[_0x0d1a('0x6')]=_0x19bb5b[_0x0d1a('0x6')]||_0x0d1a('0x7');this[_0x0d1a('0x8')]=_0x19bb5b[_0x0d1a('0x8')];this[_0x0d1a('0x9')]={};this[_0x0d1a('0xa')]=0x0;this[_0x0d1a('0x0')]='';this[_0x0d1a('0xb')]();this[_0x0d1a('0xc')]();}ChatQueue[_0x0d1a('0xd')][_0x0d1a('0xb')]=function(){var _0x36b444=this['mapAgentsId'][_0x0d1a('0xe')];this[_0x0d1a('0x9')]=_[_0x0d1a('0xf')](this[_0x0d1a('0x8')],'id');this[_0x0d1a('0x9')][_0x0d1a('0xe')]=_0x36b444;};ChatQueue[_0x0d1a('0xd')]['updateRealtime']=function(){this[_0x0d1a('0x10')]=0x0;this[_0x0d1a('0x11')]=0x0;for(var _0x3aae6c=0x0;_0x3aae6c=0x0?this['available']:0x0;var _0x14ca39={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x0d1a('0x4')],'paused':this[_0x0d1a('0x11')],'waiting':this[_0x0d1a('0xa')]};var _0x3d777e=md5(JSON['stringify'](_0x14ca39));if(this['md5']!==_0x3d777e){this[_0x0d1a('0x0')]=_0x3d777e;io['to'](util[_0x0d1a('0x16')]('chat:queue:%s',_0x14ca39['name']))[_0x0d1a('0x17')]('chat_queue:save',_0x14ca39);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 9273e73..9d4f8d7 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27e2=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','online','loggedIn','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','../../../config/environment','defaults'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x27e2,0x158));var _0x227e=function(_0x2bab95,_0x15f1a8){_0x2bab95=_0x2bab95-0x0;var _0x5b31cd=_0x27e2[_0x2bab95];return _0x5b31cd;};'use strict';var _=require(_0x227e('0x0'));var md5=require(_0x227e('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x227e('0x2'));config['redis']=_[_0x227e('0x3')](config[_0x227e('0x4')],{'host':_0x227e('0x5'),'port':0x18eb});var io=require(_0x227e('0x6'))(new Redis(config[_0x227e('0x4')]));function FaxQueue(_0x11171a){this['id']=_0x11171a['id']||0x0;this['name']=_0x11171a[_0x227e('0x7')]||'';this[_0x227e('0x8')]=_0x11171a['timeout']||0xa;this['strategy']=_0x11171a[_0x227e('0x9')]||_0x227e('0xa');this[_0x227e('0xb')]=_0x11171a['Agents'];this[_0x227e('0xc')]={};this[_0x227e('0xd')]=0x0;this[_0x227e('0x1')]='';this[_0x227e('0xe')]();this[_0x227e('0xf')]();}FaxQueue[_0x227e('0x10')]['updateRouting']=function(){var _0xec1a1f=this['mapAgentsId'][_0x227e('0x11')];this[_0x227e('0xc')]=_[_0x227e('0x12')](this['Agents'],'id');this[_0x227e('0xc')][_0x227e('0x11')]=_0xec1a1f;};FaxQueue[_0x227e('0x10')][_0x227e('0xf')]=function(){this['loggedIn']=0x0;this[_0x227e('0x13')]=0x0;for(var _0x3f4620=0x0;_0x3f4620=0x0?this[_0x227e('0x16')]:0x0;var _0x40a36e={'id':this['id'],'available':this[_0x227e('0x16')],'loggedIn':this[_0x227e('0x15')],'name':this['name'],'paused':this[_0x227e('0x13')],'waiting':this[_0x227e('0xd')]};var _0xda461=md5(JSON[_0x227e('0x17')](_0x40a36e));if(this[_0x227e('0x1')]!==_0xda461){this[_0x227e('0x1')]=_0xda461;io['to'](util[_0x227e('0x18')](_0x227e('0x19'),_0x40a36e[_0x227e('0x7')]))[_0x227e('0x1a')](_0x227e('0x1b'),_0x40a36e);}};module[_0x227e('0x1c')]=FaxQueue; \ No newline at end of file +var _0xebc9=['updateRouting','map','_rr','updateRealtime','loggedIn','length','faxPause','paused','available','stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype'];(function(_0x3f7154,_0x57def0){var _0x2baa0=function(_0x20b9ce){while(--_0x20b9ce){_0x3f7154['push'](_0x3f7154['shift']());}};_0x2baa0(++_0x57def0);}(_0xebc9,0xd9));var _0x9ebc=function(_0x50c2ec,_0x4b189d){_0x50c2ec=_0x50c2ec-0x0;var _0x1d349e=_0xebc9[_0x50c2ec];return _0x1d349e;};'use strict';var _=require(_0x9ebc('0x0'));var md5=require(_0x9ebc('0x1'));var util=require(_0x9ebc('0x2'));var Redis=require('ioredis');var config=require(_0x9ebc('0x3'));config[_0x9ebc('0x4')]=_[_0x9ebc('0x5')](config[_0x9ebc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x9ebc('0x6'))(new Redis(config[_0x9ebc('0x4')]));function FaxQueue(_0xe6b53){this['id']=_0xe6b53['id']||0x0;this[_0x9ebc('0x7')]=_0xe6b53[_0x9ebc('0x7')]||'';this[_0x9ebc('0x8')]=_0xe6b53[_0x9ebc('0x8')]||0xa;this[_0x9ebc('0x9')]=_0xe6b53[_0x9ebc('0x9')]||_0x9ebc('0xa');this[_0x9ebc('0xb')]=_0xe6b53['Agents'];this[_0x9ebc('0xc')]={};this[_0x9ebc('0xd')]=0x0;this[_0x9ebc('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x9ebc('0xe')][_0x9ebc('0xf')]=function(){var _0x513760=this['mapAgentsId']['_rr'];this[_0x9ebc('0xc')]=_[_0x9ebc('0x10')](this[_0x9ebc('0xb')],'id');this[_0x9ebc('0xc')][_0x9ebc('0x11')]=_0x513760;};FaxQueue[_0x9ebc('0xe')][_0x9ebc('0x12')]=function(){this[_0x9ebc('0x13')]=0x0;this['paused']=0x0;for(var _0x388fa1=0x0;_0x388fa1=0x0?this[_0x9ebc('0x17')]:0x0;var _0x48be07={'id':this['id'],'available':this[_0x9ebc('0x17')],'loggedIn':this[_0x9ebc('0x13')],'name':this[_0x9ebc('0x7')],'paused':this[_0x9ebc('0x16')],'waiting':this[_0x9ebc('0xd')]};var _0x23a2ca=md5(JSON[_0x9ebc('0x18')](_0x48be07));if(this['md5']!==_0x23a2ca){this['md5']=_0x23a2ca;io['to'](util[_0x9ebc('0x19')](_0x9ebc('0x1a'),_0x48be07[_0x9ebc('0x7')]))[_0x9ebc('0x1b')]('fax_queue:save',_0x48be07);}};module[_0x9ebc('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d893a42..7967d75 100644 --- a/server/services/routing/model/interval.js +++ b/server/services/routing/model/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x542e=['exports','name','Intervals'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x542e,0x1de));var _0xe542=function(_0x124fb4,_0x4e1b88){_0x124fb4=_0x124fb4-0x0;var _0x3e9e1a=_0x542e[_0x124fb4];return _0x3e9e1a;};'use strict';function Interval(_0x489bb2){this['id']=_0x489bb2['id']||0x0;this[_0xe542('0x0')]=_0x489bb2[_0xe542('0x0')]||'';this[_0xe542('0x1')]=_0x489bb2[_0xe542('0x1')]||{};}module[_0xe542('0x2')]=Interval; \ No newline at end of file +var _0xe8c3=['Intervals','name'];(function(_0xd5d4ed,_0x2355e9){var _0x57d1ad=function(_0x321a79){while(--_0x321a79){_0xd5d4ed['push'](_0xd5d4ed['shift']());}};_0x57d1ad(++_0x2355e9);}(_0xe8c3,0xf9));var _0x3e8c=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0xe8c3[_0x5e3a45];return _0x13419f;};'use strict';function Interval(_0x44f8c0){this['id']=_0x44f8c0['id']||0x0;this[_0x3e8c('0x0')]=_0x44f8c0[_0x3e8c('0x0')]||'';this['Intervals']=_0x44f8c0[_0x3e8c('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b0d9987..42bf38d 100644 --- a/server/services/routing/model/mailQueue.js +++ b/server/services/routing/model/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd3d=['lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','available','stringify','format','mail:queue:%s','emit','exports'];(function(_0x2d7941,_0x51436d){var _0x138b3d=function(_0x1a0a83){while(--_0x1a0a83){_0x2d7941['push'](_0x2d7941['shift']());}};_0x138b3d(++_0x51436d);}(_0xbd3d,0x6c));var _0xdbd3=function(_0x305b88,_0xde6600){_0x305b88=_0x305b88-0x0;var _0x32fb95=_0xbd3d[_0x305b88];return _0x32fb95;};'use strict';var _=require(_0xdbd3('0x0'));var md5=require(_0xdbd3('0x1'));var util=require(_0xdbd3('0x2'));var Redis=require(_0xdbd3('0x3'));var config=require('../../../config/environment');config[_0xdbd3('0x4')]=_[_0xdbd3('0x5')](config[_0xdbd3('0x4')],{'host':_0xdbd3('0x6'),'port':0x18eb});var io=require(_0xdbd3('0x7'))(new Redis(config['redis']));function MailQueue(_0x122674){this['id']=_0x122674['id']||0x0;this[_0xdbd3('0x8')]=_0x122674[_0xdbd3('0x8')]||'';this[_0xdbd3('0x9')]=_0x122674['timeout']||0xa;this[_0xdbd3('0xa')]=_0x122674['strategy']||_0xdbd3('0xb');this[_0xdbd3('0xc')]=_0x122674['Agents'];this[_0xdbd3('0xd')]={};this[_0xdbd3('0xe')]=0x0;this[_0xdbd3('0x1')]='';this[_0xdbd3('0xf')]();this[_0xdbd3('0x10')]();}MailQueue[_0xdbd3('0x11')][_0xdbd3('0xf')]=function(){var _0x31b5f1=this['mapAgentsId']['_rr'];this[_0xdbd3('0xd')]=_[_0xdbd3('0x12')](this['Agents'],'id');this[_0xdbd3('0xd')]['_rr']=_0x31b5f1;};MailQueue['prototype'][_0xdbd3('0x10')]=function(){this[_0xdbd3('0x13')]=0x0;this[_0xdbd3('0x14')]=0x0;for(var _0x3aa5d3=0x0;_0x3aa5d3=0x0?this[_0xdbd3('0x15')]:0x0;var _0xbda519={'id':this['id'],'available':this[_0xdbd3('0x15')],'loggedIn':this[_0xdbd3('0x13')],'name':this['name'],'paused':this[_0xdbd3('0x14')],'waiting':this['waiting']};var _0x12c23e=md5(JSON[_0xdbd3('0x16')](_0xbda519));if(this['md5']!==_0x12c23e){this[_0xdbd3('0x1')]=_0x12c23e;io['to'](util[_0xdbd3('0x17')](_0xdbd3('0x18'),_0xbda519['name']))[_0xdbd3('0x19')]('mail_queue:save',_0xbda519);}};module[_0xdbd3('0x1a')]=MailQueue; \ No newline at end of file +var _0x6e94=['waiting','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','online','mailPause','paused','available'];(function(_0x4a010b,_0x3523b3){var _0xe0b19b=function(_0x68b0bb){while(--_0x68b0bb){_0x4a010b['push'](_0x4a010b['shift']());}};_0xe0b19b(++_0x3523b3);}(_0x6e94,0xd1));var _0x46e9=function(_0x3eb94b,_0x563ff4){_0x3eb94b=_0x3eb94b-0x0;var _0x2e6e32=_0x6e94[_0x3eb94b];return _0x2e6e32;};'use strict';var _=require(_0x46e9('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x46e9('0x1'));var config=require(_0x46e9('0x2'));config['redis']=_[_0x46e9('0x3')](config[_0x46e9('0x4')],{'host':_0x46e9('0x5'),'port':0x18eb});var io=require(_0x46e9('0x6'))(new Redis(config[_0x46e9('0x4')]));function MailQueue(_0x38ccbc){this['id']=_0x38ccbc['id']||0x0;this[_0x46e9('0x7')]=_0x38ccbc[_0x46e9('0x7')]||'';this[_0x46e9('0x8')]=_0x38ccbc[_0x46e9('0x8')]||0xa;this[_0x46e9('0x9')]=_0x38ccbc[_0x46e9('0x9')]||'beepall';this['Agents']=_0x38ccbc[_0x46e9('0xa')];this[_0x46e9('0xb')]={};this['waiting']=0x0;this[_0x46e9('0xc')]='';this[_0x46e9('0xd')]();this['updateRealtime']();}MailQueue['prototype'][_0x46e9('0xd')]=function(){var _0x49386b=this[_0x46e9('0xb')][_0x46e9('0xe')];this[_0x46e9('0xb')]=_[_0x46e9('0xf')](this[_0x46e9('0xa')],'id');this['mapAgentsId']['_rr']=_0x49386b;};MailQueue[_0x46e9('0x10')][_0x46e9('0x11')]=function(){this[_0x46e9('0x12')]=0x0;this['paused']=0x0;for(var _0x42ed66=0x0;_0x42ed66=0x0?this[_0x46e9('0x16')]:0x0;var _0x28f2c2={'id':this['id'],'available':this[_0x46e9('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x46e9('0x7')],'paused':this[_0x46e9('0x15')],'waiting':this[_0x46e9('0x17')]};var _0x303af7=md5(JSON['stringify'](_0x28f2c2));if(this[_0x46e9('0xc')]!==_0x303af7){this[_0x46e9('0xc')]=_0x303af7;io['to'](util[_0x46e9('0x18')](_0x46e9('0x19'),_0x28f2c2[_0x46e9('0x7')]))[_0x46e9('0x1a')](_0x46e9('0x1b'),_0x28f2c2);}};module[_0x46e9('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 17c28c9..93a4785 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x38f3d5,_0x106e77){var _0x45344f=function(_0x5582b4){while(--_0x5582b4){_0x38f3d5['push'](_0x38f3d5['shift']());}};_0x45344f(++_0x106e77);}(_0x814b,0x1a2));var _0xb814=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x814b[_0x5b34c0];return _0x242bd3;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x3db91a,_0x425740){var _0x54c81c=function(_0x4ccf10){while(--_0x4ccf10){_0x3db91a['push'](_0x3db91a['shift']());}};_0x54c81c(++_0x425740);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x5fc3[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d05fa81..e96d296 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2ea=['online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2ea,0x15f));var _0xad2e=function(_0x26e0c6,_0x121234){_0x26e0c6=_0x26e0c6-0x0;var _0x590da4=_0xd2ea[_0x26e0c6];return _0x590da4;};'use strict';var _=require(_0xad2e('0x0'));var md5=require(_0xad2e('0x1'));var util=require(_0xad2e('0x2'));var Redis=require(_0xad2e('0x3'));var config=require(_0xad2e('0x4'));config['redis']=_[_0xad2e('0x5')](config[_0xad2e('0x6')],{'host':_0xad2e('0x7'),'port':0x18eb});var io=require(_0xad2e('0x8'))(new Redis(config[_0xad2e('0x6')]));function SmsQueue(_0x2fd28e){this['id']=_0x2fd28e['id']||0x0;this[_0xad2e('0x9')]=_0x2fd28e['name']||'';this[_0xad2e('0xa')]=_0x2fd28e[_0xad2e('0xa')]||0xa;this[_0xad2e('0xb')]=_0x2fd28e['strategy']||_0xad2e('0xc');this[_0xad2e('0xd')]=_0x2fd28e['Agents'];this[_0xad2e('0xe')]={};this['waiting']=0x0;this[_0xad2e('0x1')]='';this[_0xad2e('0xf')]();this[_0xad2e('0x10')]();}SmsQueue[_0xad2e('0x11')]['updateRouting']=function(){var _0x7df3c6=this['mapAgentsId'][_0xad2e('0x12')];this[_0xad2e('0xe')]=_[_0xad2e('0x13')](this[_0xad2e('0xd')],'id');this['mapAgentsId'][_0xad2e('0x12')]=_0x7df3c6;};SmsQueue['prototype'][_0xad2e('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4a812b=0x0;_0x4a812b=0x0?this[_0xad2e('0x19')]:0x0;var _0x1b4889={'id':this['id'],'available':this[_0xad2e('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xad2e('0x9')],'paused':this[_0xad2e('0x18')],'waiting':this['waiting']};var _0x50eb1a=md5(JSON['stringify'](_0x1b4889));if(this['md5']!==_0x50eb1a){this[_0xad2e('0x1')]=_0x50eb1a;io['to'](util[_0xad2e('0x1a')](_0xad2e('0x1b'),_0x1b4889[_0xad2e('0x9')]))[_0xad2e('0x1c')](_0xad2e('0x1d'),_0x1b4889);}};module[_0xad2e('0x1e')]=SmsQueue; \ No newline at end of file +var _0x0e85=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','localhost','redis','name','timeout','strategy','beepall','Agents'];(function(_0x248aca,_0x548ce6){var _0x369c59=function(_0x4f3600){while(--_0x4f3600){_0x248aca['push'](_0x248aca['shift']());}};_0x369c59(++_0x548ce6);}(_0x0e85,0x7c));var _0x50e8=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x0e85[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x50e8('0x0'));var md5=require(_0x50e8('0x1'));var util=require('util');var Redis=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x50e8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x50e8('0x5')]));function SmsQueue(_0x2401b2){this['id']=_0x2401b2['id']||0x0;this[_0x50e8('0x6')]=_0x2401b2[_0x50e8('0x6')]||'';this['timeout']=_0x2401b2[_0x50e8('0x7')]||0xa;this[_0x50e8('0x8')]=_0x2401b2[_0x50e8('0x8')]||_0x50e8('0x9');this[_0x50e8('0xa')]=_0x2401b2[_0x50e8('0xa')];this['mapAgentsId']={};this[_0x50e8('0xb')]=0x0;this[_0x50e8('0x1')]='';this[_0x50e8('0xc')]();this[_0x50e8('0xd')]();}SmsQueue[_0x50e8('0xe')][_0x50e8('0xc')]=function(){var _0x45dc6f=this[_0x50e8('0xf')]['_rr'];this['mapAgentsId']=_[_0x50e8('0x10')](this[_0x50e8('0xa')],'id');this['mapAgentsId']['_rr']=_0x45dc6f;};SmsQueue[_0x50e8('0xe')][_0x50e8('0xd')]=function(){this[_0x50e8('0x11')]=0x0;this[_0x50e8('0x12')]=0x0;for(var _0x54efd3=0x0;_0x54efd3=0x0?this[_0x50e8('0x15')]:0x0;var _0xc97063={'id':this['id'],'available':this[_0x50e8('0x15')],'loggedIn':this[_0x50e8('0x11')],'name':this[_0x50e8('0x6')],'paused':this[_0x50e8('0x12')],'waiting':this[_0x50e8('0xb')]};var _0x53e0a1=md5(JSON[_0x50e8('0x16')](_0xc97063));if(this['md5']!==_0x53e0a1){this[_0x50e8('0x1')]=_0x53e0a1;io['to'](util[_0x50e8('0x17')](_0x50e8('0x18'),_0xc97063[_0x50e8('0x6')]))[_0x50e8('0x19')]('sms_queue:save',_0xc97063);}};module[_0x50e8('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 488731c..1fcb19c 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2743=['lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','updateRealtime','mapAgentsId','_rr','map','loggedIn','paused','length','whatsappPause','available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save'];(function(_0x979309,_0x1c0fba){var _0x165d8a=function(_0x4b4283){while(--_0x4b4283){_0x979309['push'](_0x979309['shift']());}};_0x165d8a(++_0x1c0fba);}(_0x2743,0x1cb));var _0x3274=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2743[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3274('0x0'));var md5=require(_0x3274('0x1'));var util=require(_0x3274('0x2'));var Redis=require('ioredis');var config=require(_0x3274('0x3'));config['redis']=_['defaults'](config[_0x3274('0x4')],{'host':_0x3274('0x5'),'port':0x18eb});var io=require(_0x3274('0x6'))(new Redis(config[_0x3274('0x4')]));function WhatsappQueue(_0x17f2e1){this['id']=_0x17f2e1['id']||0x0;this[_0x3274('0x7')]=_0x17f2e1['name']||'';this[_0x3274('0x8')]=_0x17f2e1[_0x3274('0x8')]||0xa;this[_0x3274('0x9')]=_0x17f2e1[_0x3274('0x9')]||'beepall';this[_0x3274('0xa')]=_0x17f2e1['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x3274('0x1')]='';this[_0x3274('0xb')]();this[_0x3274('0xc')]();}WhatsappQueue['prototype'][_0x3274('0xb')]=function(){var _0x150e94=this[_0x3274('0xd')][_0x3274('0xe')];this['mapAgentsId']=_[_0x3274('0xf')](this[_0x3274('0xa')],'id');this[_0x3274('0xd')]['_rr']=_0x150e94;};WhatsappQueue['prototype'][_0x3274('0xc')]=function(){this[_0x3274('0x10')]=0x0;this[_0x3274('0x11')]=0x0;for(var _0x54ec1a=0x0;_0x54ec1a=0x0?this[_0x3274('0x14')]:0x0;var _0x35cac5={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3274('0x10')],'name':this[_0x3274('0x7')],'paused':this[_0x3274('0x11')],'waiting':this[_0x3274('0x15')]};var _0x425278=md5(JSON[_0x3274('0x16')](_0x35cac5));if(this[_0x3274('0x1')]!==_0x425278){this['md5']=_0x425278;io['to'](util[_0x3274('0x17')](_0x3274('0x18'),_0x35cac5[_0x3274('0x7')]))[_0x3274('0x19')](_0x3274('0x1a'),_0x35cac5);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xd4d5=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util'];(function(_0x5ccfdd,_0x482cf7){var _0x5560a=function(_0x4536c3){while(--_0x4536c3){_0x5ccfdd['push'](_0x5ccfdd['shift']());}};_0x5560a(++_0x482cf7);}(_0xd4d5,0xd6));var _0x5d4d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xd4d5[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x5d4d('0x0'));var md5=require(_0x5d4d('0x1'));var util=require(_0x5d4d('0x2'));var Redis=require(_0x5d4d('0x3'));var config=require(_0x5d4d('0x4'));config[_0x5d4d('0x5')]=_[_0x5d4d('0x6')](config[_0x5d4d('0x5')],{'host':_0x5d4d('0x7'),'port':0x18eb});var io=require(_0x5d4d('0x8'))(new Redis(config[_0x5d4d('0x5')]));function WhatsappQueue(_0x25dfed){this['id']=_0x25dfed['id']||0x0;this[_0x5d4d('0x9')]=_0x25dfed[_0x5d4d('0x9')]||'';this[_0x5d4d('0xa')]=_0x25dfed['timeout']||0xa;this['strategy']=_0x25dfed[_0x5d4d('0xb')]||_0x5d4d('0xc');this[_0x5d4d('0xd')]=_0x25dfed['Agents'];this[_0x5d4d('0xe')]={};this[_0x5d4d('0xf')]=0x0;this[_0x5d4d('0x1')]='';this[_0x5d4d('0x10')]();this[_0x5d4d('0x11')]();}WhatsappQueue[_0x5d4d('0x12')][_0x5d4d('0x10')]=function(){var _0x4b88fe=this[_0x5d4d('0xe')][_0x5d4d('0x13')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x5d4d('0xe')][_0x5d4d('0x13')]=_0x4b88fe;};WhatsappQueue[_0x5d4d('0x12')][_0x5d4d('0x11')]=function(){this[_0x5d4d('0x14')]=0x0;this[_0x5d4d('0x15')]=0x0;for(var _0x5e005a=0x0;_0x5e005a=0x0?this[_0x5d4d('0x19')]:0x0;var _0xdd582a={'id':this['id'],'available':this[_0x5d4d('0x19')],'loggedIn':this[_0x5d4d('0x14')],'name':this['name'],'paused':this[_0x5d4d('0x15')],'waiting':this[_0x5d4d('0xf')]};var _0x5d9fd9=md5(JSON['stringify'](_0xdd582a));if(this[_0x5d4d('0x1')]!==_0x5d9fd9){this[_0x5d4d('0x1')]=_0x5d9fd9;io['to'](util[_0x5d4d('0x1a')](_0x5d4d('0x1b'),_0xdd582a[_0x5d4d('0x9')]))[_0x5d4d('0x1c')](_0x5d4d('0x1d'),_0xdd582a);}};module[_0x5d4d('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 57948f1..682ad79 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0xaa515e,_0xcb3f90){var _0xb15478=function(_0xfa1193){while(--_0xfa1193){_0xaa515e['push'](_0xaa515e['shift']());}};_0xb15478(++_0xcb3f90);}(_0xb10b,0x12a));var _0xbb10=function(_0x1df473,_0x1a6931){_0x1df473=_0x1df473-0x0;var _0x1bdd49=_0xb10b[_0x1df473];return _0x1bdd49;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 27d3287..3da8806 100644 --- a/server/services/routing/rpc/chatInteraction.js +++ b/server/services/routing/rpc/chatInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a1d=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x1a1d,0x1aa));var _0xd1a1=function(_0x5be745,_0x47a5e2){_0x5be745=_0x5be745-0x0;var _0x4c7662=_0x1a1d[_0x5be745];return _0x4c7662;};'use strict';var client=require('../client');exports[_0xd1a1('0x0')]=function(_0x4d3346,_0x58cb77){return client[_0xd1a1('0x1')](_0xd1a1('0x2'),{'body':_0x58cb77,'options':{'where':{'id':_0x4d3346}},'log':_0xd1a1('0x3')});};exports[_0xd1a1('0x4')]=function(_0x4453a7,_0x1f5467){return client['Request'](_0xd1a1('0x5'),{'body':_0x1f5467,'options':{'where':{'id':_0x4453a7}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x0112=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x1b677e,_0x5bc7e8){var _0x548f30=function(_0x591ca2){while(--_0x591ca2){_0x1b677e['push'](_0x1b677e['shift']());}};_0x548f30(++_0x5bc7e8);}(_0x0112,0x8a));var _0x2011=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x0112[_0x21549c];return _0x426cbd;};'use strict';var client=require(_0x2011('0x0'));exports[_0x2011('0x1')]=function(_0x123023,_0xc6a998){return client[_0x2011('0x2')](_0x2011('0x3'),{'body':_0xc6a998,'options':{'where':{'id':_0x123023}},'log':'updateChatInteraction'});};exports[_0x2011('0x4')]=function(_0x50fc07,_0x279145){return client[_0x2011('0x2')](_0x2011('0x5'),{'body':_0x279145,'options':{'where':{'id':_0x50fc07}},'log':_0x2011('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3e87d06..60e6d5e 100644 --- a/server/services/routing/rpc/chatMessage.js +++ b/server/services/routing/rpc/chatMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x321a=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x357255,_0x339d2d){var _0x39124a=function(_0x2389ab){while(--_0x2389ab){_0x357255['push'](_0x357255['shift']());}};_0x39124a(++_0x339d2d);}(_0x321a,0x7b));var _0xa321=function(_0x116240,_0x5949fc){_0x116240=_0x116240-0x0;var _0x1095a9=_0x321a[_0x116240];return _0x1095a9;};'use strict';var client=require(_0xa321('0x0'));exports[_0xa321('0x1')]=function(_0x5f23af){return client[_0xa321('0x2')](_0xa321('0x3'),{'body':_0x5f23af,'log':_0xa321('0x4')});}; \ No newline at end of file +var _0x51cb=['Request','createChatMessage','create'];(function(_0xc6e719,_0x1174b5){var _0x4ff4ba=function(_0x37f180){while(--_0x37f180){_0xc6e719['push'](_0xc6e719['shift']());}};_0x4ff4ba(++_0x1174b5);}(_0x51cb,0x15b));var _0xb51c=function(_0x5c5331,_0x51b47c){_0x5c5331=_0x5c5331-0x0;var _0x369f12=_0x51cb[_0x5c5331];return _0x369f12;};'use strict';var client=require('../client');exports[_0xb51c('0x0')]=function(_0xdd924c){return client[_0xb51c('0x1')]('CreateChatMessage',{'body':_0xdd924c,'log':_0xb51c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0665b8b..8a05860 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ec6=['chatPause','getChatQueues','../client','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0xc25389,_0x4d62c4){var _0x4c5850=function(_0x1c4792){while(--_0x1c4792){_0xc25389['push'](_0xc25389['shift']());}};_0x4c5850(++_0x4d62c4);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x5b4aa9,_0x4e45ec){_0x5b4aa9=_0x5b4aa9-0x0;var _0xbb2923=_0x0ec6[_0x5b4aa9];return _0xbb2923;};'use strict';var client=require(_0x60ec('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x60ec('0x1'),{'options':{'raw':![],'attributes':['id',_0x60ec('0x2'),_0x60ec('0x3'),_0x60ec('0x4')],'include':[{'model':_0x60ec('0x5'),'as':_0x60ec('0x6'),'attributes':['id',_0x60ec('0x2'),'online',_0x60ec('0x7')]}]},'log':_0x60ec('0x8')});};}; \ No newline at end of file +var _0xbacb=['getChatQueues','GetChatQueue','name','timeout','strategy','User','Agents','chatPause','../client'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xbacb,0x1a6));var _0xbbac=function(_0x193dd0,_0x51de11){_0x193dd0=_0x193dd0-0x0;var _0x39b6e2=_0xbacb[_0x193dd0];return _0x39b6e2;};'use strict';var client=require(_0xbbac('0x0'));exports[_0xbbac('0x1')]=function(){return function(){return client['Request'](_0xbbac('0x2'),{'options':{'raw':![],'attributes':['id',_0xbbac('0x3'),_0xbbac('0x4'),_0xbbac('0x5')],'include':[{'model':_0xbbac('0x6'),'as':_0xbbac('0x7'),'attributes':['id','name','online',_0xbbac('0x8')]}]},'log':_0xbbac('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 5618943..d0a2bbe 100644 --- a/server/services/routing/rpc/chatQueueReport.js +++ b/server/services/routing/rpc/chatQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9234=['../client','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x89626a,_0x454f21){var _0xf630b4=function(_0x5cbcf3){while(--_0x5cbcf3){_0x89626a['push'](_0x89626a['shift']());}};_0xf630b4(++_0x454f21);}(_0x9234,0x1bd));var _0x4923=function(_0xdbb6cb,_0x3b8fda){_0xdbb6cb=_0xdbb6cb-0x0;var _0x476b50=_0x9234[_0xdbb6cb];return _0x476b50;};'use strict';var client=require(_0x4923('0x0'));exports['create']=function(_0x1ece6e){return client[_0x4923('0x1')](_0x4923('0x2'),{'body':_0x1ece6e,'log':_0x4923('0x2')});};exports['update']=function(_0x1ca221,_0x436ce1){return client['Request'](_0x4923('0x3'),{'body':_0x436ce1,'options':{'where':{'uniqueid':_0x1ca221},'order':[['id',_0x4923('0x4')]],'limit':0x1},'log':_0x4923('0x3')});}; \ No newline at end of file +var _0x8c38=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x2eadae,_0x5dd8b4){var _0x3fd843=function(_0x1bb455){while(--_0x1bb455){_0x2eadae['push'](_0x2eadae['shift']());}};_0x3fd843(++_0x5dd8b4);}(_0x8c38,0x83));var _0x88c3=function(_0x309cbe,_0x5701fb){_0x309cbe=_0x309cbe-0x0;var _0x38603b=_0x8c38[_0x309cbe];return _0x38603b;};'use strict';var client=require(_0x88c3('0x0'));exports[_0x88c3('0x1')]=function(_0x51a0df){return client[_0x88c3('0x2')](_0x88c3('0x3'),{'body':_0x51a0df,'log':_0x88c3('0x3')});};exports[_0x88c3('0x4')]=function(_0x4ac99a,_0x147c39){return client[_0x88c3('0x2')](_0x88c3('0x5'),{'body':_0x147c39,'options':{'where':{'uniqueid':_0x4ac99a},'order':[['id',_0x88c3('0x6')]],'limit':0x1},'log':_0x88c3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 913098e..253ec36 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x24a91b,_0x195217){var _0x131eb3=function(_0x5acc44){while(--_0x5acc44){_0x24a91b['push'](_0x24a91b['shift']());}};_0x131eb3(++_0x195217);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x7a54,0x106));var _0x47a5=function(_0x1b8213,_0xe28eec){_0x1b8213=_0x1b8213-0x0;var _0x4bf448=_0x7a54[_0x1b8213];return _0x4bf448;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 3e98c50..b0d61dd 100644 --- a/server/services/routing/rpc/faxMessage.js +++ b/server/services/routing/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6490=['create','createFaxMessage','../client'];(function(_0x1f0048,_0x44d099){var _0x2c2a44=function(_0x3742bd){while(--_0x3742bd){_0x1f0048['push'](_0x1f0048['shift']());}};_0x2c2a44(++_0x44d099);}(_0x6490,0x1be));var _0x0649=function(_0x3b7fb0,_0x553e21){_0x3b7fb0=_0x3b7fb0-0x0;var _0x3b7fc5=_0x6490[_0x3b7fb0];return _0x3b7fc5;};'use strict';var client=require(_0x0649('0x0'));exports[_0x0649('0x1')]=function(_0x571880){return client['Request']('CreateFaxMessage',{'body':_0x571880,'log':_0x0649('0x2')});}; \ No newline at end of file +var _0x9009=['create','Request','createFaxMessage','../client'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x9009,0xa7));var _0x9900=function(_0x39c657,_0x5c2b74){_0x39c657=_0x39c657-0x0;var _0x2e42f8=_0x9009[_0x39c657];return _0x2e42f8;};'use strict';var client=require(_0x9900('0x0'));exports[_0x9900('0x1')]=function(_0x242df1){return client[_0x9900('0x2')]('CreateFaxMessage',{'body':_0x242df1,'log':_0x9900('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 6b8670a..e9ac3ff 100644 --- a/server/services/routing/rpc/faxQueue.js +++ b/server/services/routing/rpc/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22a9=['../client','getFaxQueues','Request','timeout','strategy','User','Agents','online','faxPause'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0x22a9,0x18c));var _0x922a=function(_0x5350bd,_0x4a280f){_0x5350bd=_0x5350bd-0x0;var _0xe31113=_0x22a9[_0x5350bd];return _0xe31113;};'use strict';var client=require(_0x922a('0x0'));exports[_0x922a('0x1')]=function(){return function(){return client[_0x922a('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x922a('0x3'),_0x922a('0x4')],'include':[{'model':_0x922a('0x5'),'as':_0x922a('0x6'),'attributes':['id','name',_0x922a('0x7'),_0x922a('0x8')]}]},'log':_0x922a('0x1')});};}; \ No newline at end of file +var _0x2ac5=['Agents','online','../client','getFaxQueues','Request','name','User'];(function(_0x24655a,_0x7fa437){var _0x5f4ad4=function(_0x5a3f70){while(--_0x5a3f70){_0x24655a['push'](_0x24655a['shift']());}};_0x5f4ad4(++_0x7fa437);}(_0x2ac5,0x1de));var _0x52ac=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0x2ac5[_0x328ac9];return _0x2b3a0a;};'use strict';var client=require(_0x52ac('0x0'));exports[_0x52ac('0x1')]=function(){return function(){return client[_0x52ac('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x52ac('0x3'),'timeout','strategy'],'include':[{'model':_0x52ac('0x4'),'as':_0x52ac('0x5'),'attributes':['id',_0x52ac('0x3'),_0x52ac('0x6'),'faxPause']}]},'log':_0x52ac('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 06f5a90..d3c0d68 100644 --- a/server/services/routing/rpc/faxQueueReport.js +++ b/server/services/routing/rpc/faxQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23bc=['DESC','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x545150,_0x2c2b6c){var _0xff7fd6=function(_0x18bb22){while(--_0x18bb22){_0x545150['push'](_0x545150['shift']());}};_0xff7fd6(++_0x2c2b6c);}(_0x23bc,0xc1));var _0xc23b=function(_0x3a2cb3,_0x459186){_0x3a2cb3=_0x3a2cb3-0x0;var _0xf95300=_0x23bc[_0x3a2cb3];return _0xf95300;};'use strict';var client=require('../client');exports['create']=function(_0x14b939){return client[_0xc23b('0x0')](_0xc23b('0x1'),{'body':_0x14b939,'log':_0xc23b('0x1')});};exports['update']=function(_0x5d099f,_0x12e53e){return client[_0xc23b('0x0')](_0xc23b('0x2'),{'body':_0x12e53e,'options':{'where':{'uniqueid':_0x5d099f},'order':[['id',_0xc23b('0x3')]],'limit':0x1},'log':_0xc23b('0x2')});}; \ No newline at end of file +var _0xcebf=['DESC','UpdateFaxQueueReport','create','Request','CreateFaxQueueReport','update'];(function(_0x565bc5,_0x587f70){var _0x40094e=function(_0x126888){while(--_0x126888){_0x565bc5['push'](_0x565bc5['shift']());}};_0x40094e(++_0x587f70);}(_0xcebf,0x1a0));var _0xfceb=function(_0x115d1f,_0x28e745){_0x115d1f=_0x115d1f-0x0;var _0x5a1663=_0xcebf[_0x115d1f];return _0x5a1663;};'use strict';var client=require('../client');exports[_0xfceb('0x0')]=function(_0x119307){return client[_0xfceb('0x1')](_0xfceb('0x2'),{'body':_0x119307,'log':_0xfceb('0x2')});};exports[_0xfceb('0x3')]=function(_0x33c215,_0x44476d){return client['Request']('UpdateFaxQueueReport',{'body':_0x44476d,'options':{'where':{'uniqueid':_0x33c215},'order':[['id',_0xfceb('0x4')]],'limit':0x1},'log':_0xfceb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 15033f5..2ce5d8f 100644 --- a/server/services/routing/rpc/interval.js +++ b/server/services/routing/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2c3=['Intervals','name','../client','getIntervals','Request','Interval'];(function(_0x37ef38,_0x2cfe4e){var _0x499daa=function(_0x18d0f5){while(--_0x18d0f5){_0x37ef38['push'](_0x37ef38['shift']());}};_0x499daa(++_0x2cfe4e);}(_0xc2c3,0x12e));var _0x3c2c=function(_0x55414a,_0x3216bc){_0x55414a=_0x55414a-0x0;var _0x5ae6c9=_0xc2c3[_0x55414a];return _0x5ae6c9;};'use strict';var client=require(_0x3c2c('0x0'));exports[_0x3c2c('0x1')]=function(){return function(){return client[_0x3c2c('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x3c2c('0x3'),'as':_0x3c2c('0x4'),'attributes':['id',_0x3c2c('0x5'),'interval']}]},'log':_0x3c2c('0x1')});};}; \ No newline at end of file +var _0x91d4=['name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x78272c,_0x490cfd){var _0x3a97a8=function(_0x4817f8){while(--_0x4817f8){_0x78272c['push'](_0x78272c['shift']());}};_0x3a97a8(++_0x490cfd);}(_0x91d4,0x190));var _0x491d=function(_0x42183e,_0x3b3353){_0x42183e=_0x42183e-0x0;var _0x4c1315=_0x91d4[_0x42183e];return _0x4c1315;};'use strict';var client=require(_0x491d('0x0'));exports[_0x491d('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x491d('0x2')],'include':[{'model':_0x491d('0x3'),'as':_0x491d('0x4'),'attributes':['id',_0x491d('0x2'),_0x491d('0x5')]}]},'log':_0x491d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 134b290..640e7d0 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b84=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x11d7c6,_0x149bc1){var _0x1be54c=function(_0x1c5e49){while(--_0x1c5e49){_0x11d7c6['push'](_0x11d7c6['shift']());}};_0x1be54c(++_0x149bc1);}(_0x7b84,0x17c));var _0x47b8=function(_0x1271a5,_0x38806b){_0x1271a5=_0x1271a5-0x0;var _0x249b19=_0x7b84[_0x1271a5];return _0x249b19;};'use strict';var client=require(_0x47b8('0x0'));exports[_0x47b8('0x1')]=function(_0x186f89,_0xda244a){return client[_0x47b8('0x2')](_0x47b8('0x3'),{'body':_0xda244a,'options':{'where':{'id':_0x186f89}},'log':_0x47b8('0x4')});};exports['addTags']=function(_0x445a5f,_0x1fa41a){return client[_0x47b8('0x2')](_0x47b8('0x5'),{'body':_0x1fa41a,'options':{'where':{'id':_0x445a5f}},'log':_0x47b8('0x6')});}; \ No newline at end of file +var _0xf2e3=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x569998,_0x361b8d){var _0x2f8256=function(_0x3354f1){while(--_0x3354f1){_0x569998['push'](_0x569998['shift']());}};_0x2f8256(++_0x361b8d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xf2e3[_0x4b7895];return _0x264180;};'use strict';var client=require(_0x3f2e('0x0'));exports['update']=function(_0x143e9e,_0x231b2b){return client[_0x3f2e('0x1')](_0x3f2e('0x2'),{'body':_0x231b2b,'options':{'where':{'id':_0x143e9e}},'log':_0x3f2e('0x3')});};exports[_0x3f2e('0x4')]=function(_0x3938e2,_0xabcf5c){return client[_0x3f2e('0x1')]('AddTagsToMailInteraction',{'body':_0xabcf5c,'options':{'where':{'id':_0x3938e2}},'log':_0x3f2e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index c309eca..ad56f91 100644 --- a/server/services/routing/rpc/mailMessage.js +++ b/server/services/routing/rpc/mailMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc209=['Request','createMailMessage','../client'];(function(_0x13ccd0,_0x19b56a){var _0x493818=function(_0x59bae4){while(--_0x59bae4){_0x13ccd0['push'](_0x13ccd0['shift']());}};_0x493818(++_0x19b56a);}(_0xc209,0xcb));var _0x9c20=function(_0xacbb12,_0x59bb99){_0xacbb12=_0xacbb12-0x0;var _0x3010c9=_0xc209[_0xacbb12];return _0x3010c9;};'use strict';var client=require(_0x9c20('0x0'));exports['create']=function(_0x3813ed){return client[_0x9c20('0x1')]('CreateMailMessage',{'body':_0x3813ed,'log':_0x9c20('0x2')});}; \ No newline at end of file +var _0x4aba=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4aba,0x99));var _0xa4ab=function(_0x3c6706,_0xf79616){_0x3c6706=_0x3c6706-0x0;var _0x376ad9=_0x4aba[_0x3c6706];return _0x376ad9;};'use strict';var client=require(_0xa4ab('0x0'));exports[_0xa4ab('0x1')]=function(_0x39334e){return client[_0xa4ab('0x2')](_0xa4ab('0x3'),{'body':_0x39334e,'log':_0xa4ab('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9638498..93ef4ad 100644 --- a/server/services/routing/rpc/mailQueue.js +++ b/server/services/routing/rpc/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd260=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd260,0xf1));var _0x0d26=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0xd260[_0x414655];return _0x237884;};'use strict';var client=require(_0x0d26('0x0'));exports[_0x0d26('0x1')]=function(){return function(){return client[_0x0d26('0x2')](_0x0d26('0x3'),{'options':{'raw':![],'attributes':['id',_0x0d26('0x4'),_0x0d26('0x5'),_0x0d26('0x6')],'include':[{'model':_0x0d26('0x7'),'as':_0x0d26('0x8'),'attributes':['id',_0x0d26('0x4'),_0x0d26('0x9'),_0x0d26('0xa')]}]},'log':_0x0d26('0x1')});};}; \ No newline at end of file +var _0xa74e=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','online','../client'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xa74e,0x179));var _0xea74=function(_0x92c827,_0xdc87e2){_0x92c827=_0x92c827-0x0;var _0x2e9011=_0xa74e[_0x92c827];return _0x2e9011;};'use strict';var client=require(_0xea74('0x0'));exports[_0xea74('0x1')]=function(){return function(){return client[_0xea74('0x2')](_0xea74('0x3'),{'options':{'raw':![],'attributes':['id',_0xea74('0x4'),_0xea74('0x5'),_0xea74('0x6')],'include':[{'model':_0xea74('0x7'),'as':'Agents','attributes':['id',_0xea74('0x4'),_0xea74('0x8'),'mailPause']}]},'log':_0xea74('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index efab815..832214f 100644 --- a/server/services/routing/rpc/mailQueueReport.js +++ b/server/services/routing/rpc/mailQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f1c=['UpdateMailQueueReport','DESC','CreateMailQueueReport','update','Request'];(function(_0x3005f4,_0x1de400){var _0x1fd800=function(_0x1629a8){while(--_0x1629a8){_0x3005f4['push'](_0x3005f4['shift']());}};_0x1fd800(++_0x1de400);}(_0x9f1c,0xfc));var _0xc9f1=function(_0x548f84,_0x170c38){_0x548f84=_0x548f84-0x0;var _0x4448c2=_0x9f1c[_0x548f84];return _0x4448c2;};'use strict';var client=require('../client');exports['create']=function(_0x50fb2a){return client['Request'](_0xc9f1('0x0'),{'body':_0x50fb2a,'log':_0xc9f1('0x0')});};exports[_0xc9f1('0x1')]=function(_0x3f78ce,_0x16afb8){return client[_0xc9f1('0x2')](_0xc9f1('0x3'),{'body':_0x16afb8,'options':{'where':{'uniqueid':_0x3f78ce},'order':[['id',_0xc9f1('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x4ada=['create','Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client'];(function(_0x1ae444,_0x459593){var _0x693a48=function(_0x246753){while(--_0x246753){_0x1ae444['push'](_0x1ae444['shift']());}};_0x693a48(++_0x459593);}(_0x4ada,0x1e9));var _0xa4ad=function(_0x1f5bdc,_0x159d4f){_0x1f5bdc=_0x1f5bdc-0x0;var _0x51de3d=_0x4ada[_0x1f5bdc];return _0x51de3d;};'use strict';var client=require(_0xa4ad('0x0'));exports[_0xa4ad('0x1')]=function(_0x129780){return client[_0xa4ad('0x2')](_0xa4ad('0x3'),{'body':_0x129780,'log':_0xa4ad('0x3')});};exports[_0xa4ad('0x4')]=function(_0x20ac23,_0x430a4e){return client[_0xa4ad('0x2')]('UpdateMailQueueReport',{'body':_0x430a4e,'options':{'where':{'uniqueid':_0x20ac23},'order':[['id',_0xa4ad('0x5')]],'limit':0x1},'log':_0xa4ad('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 95aad99..4ed7db7 100644 --- a/server/services/routing/rpc/openchannelInteraction.js +++ b/server/services/routing/rpc/openchannelInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bb1=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','addTags','Request'];(function(_0x51215f,_0x1ceed5){var _0x15cf2d=function(_0x3aa81a){while(--_0x3aa81a){_0x51215f['push'](_0x51215f['shift']());}};_0x15cf2d(++_0x1ceed5);}(_0x3bb1,0xb0));var _0x13bb=function(_0x4261c,_0x1eee55){_0x4261c=_0x4261c-0x0;var _0x3a6d0b=_0x3bb1[_0x4261c];return _0x3a6d0b;};'use strict';var client=require(_0x13bb('0x0'));exports[_0x13bb('0x1')]=function(_0x387eb7,_0x337fcf){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x337fcf,'options':{'where':{'id':_0x387eb7}},'log':'updateOpenchannelInteraction'});};exports[_0x13bb('0x2')]=function(_0x678ae2,_0x3bab2e){return client[_0x13bb('0x3')](_0x13bb('0x4'),{'body':_0x3bab2e,'options':{'where':{'id':_0x678ae2}},'log':_0x13bb('0x5')});}; \ No newline at end of file +var _0xc7d3=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x43deb1,_0x72fc7e){var _0x1aa346=function(_0x5c7dd3){while(--_0x5c7dd3){_0x43deb1['push'](_0x43deb1['shift']());}};_0x1aa346(++_0x72fc7e);}(_0xc7d3,0x1b3));var _0x3c7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7d3[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3c7d('0x0'));exports['update']=function(_0x114786,_0x2cc793){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x2cc793,'options':{'where':{'id':_0x114786}},'log':'updateOpenchannelInteraction'});};exports[_0x3c7d('0x1')]=function(_0x57fae7,_0x28965e){return client['Request'](_0x3c7d('0x2'),{'body':_0x28965e,'options':{'where':{'id':_0x57fae7}},'log':_0x3c7d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 95c3a1a..6c8add8 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc59b=['../client','create','CreateOpenchannelMessage'];(function(_0x466999,_0x231a3a){var _0x33f2e8=function(_0x422563){while(--_0x422563){_0x466999['push'](_0x466999['shift']());}};_0x33f2e8(++_0x231a3a);}(_0xc59b,0x93));var _0xbc59=function(_0x2b5f19,_0x3b0f04){_0x2b5f19=_0x2b5f19-0x0;var _0x359582=_0xc59b[_0x2b5f19];return _0x359582;};'use strict';var client=require(_0xbc59('0x0'));exports[_0xbc59('0x1')]=function(_0x31b250){return client['Request'](_0xbc59('0x2'),{'body':_0x31b250,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x352a=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x25e10c,_0x49596a){var _0x5dfd94=function(_0x2f4bfb){while(--_0x2f4bfb){_0x25e10c['push'](_0x25e10c['shift']());}};_0x5dfd94(++_0x49596a);}(_0x352a,0x122));var _0xa352=function(_0x111b26,_0xf76620){_0x111b26=_0x111b26-0x0;var _0x3a0a1e=_0x352a[_0x111b26];return _0x3a0a1e;};'use strict';var client=require(_0xa352('0x0'));exports[_0xa352('0x1')]=function(_0x283b9c){return client[_0xa352('0x2')](_0xa352('0x3'),{'body':_0x283b9c,'log':_0xa352('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index c32d676..45c63ce 100644 --- a/server/services/routing/rpc/openchannelQueue.js +++ b/server/services/routing/rpc/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f60=['name','timeout','User','Agents','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x610ea6,_0x37304a){var _0x2aaabe=function(_0x50d248){while(--_0x50d248){_0x610ea6['push'](_0x610ea6['shift']());}};_0x2aaabe(++_0x37304a);}(_0x1f60,0x12d));var _0x01f6=function(_0x5e4c1c,_0x2737f7){_0x5e4c1c=_0x5e4c1c-0x0;var _0xe1a97c=_0x1f60[_0x5e4c1c];return _0xe1a97c;};'use strict';var client=require(_0x01f6('0x0'));exports[_0x01f6('0x1')]=function(){return function(){return client[_0x01f6('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x01f6('0x3'),_0x01f6('0x4'),'strategy'],'include':[{'model':_0x01f6('0x5'),'as':_0x01f6('0x6'),'attributes':['id','name','online',_0x01f6('0x7')]}]},'log':_0x01f6('0x1')});};}; \ No newline at end of file +var _0x0b71=['Request','GetOpenchannelQueue','timeout','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x0b71,0x1ef));var _0x10b7=function(_0x1132c7,_0x4a733d){_0x1132c7=_0x1132c7-0x0;var _0x56b032=_0x0b71[_0x1132c7];return _0x56b032;};'use strict';var client=require(_0x10b7('0x0'));exports[_0x10b7('0x1')]=function(){return function(){return client[_0x10b7('0x2')](_0x10b7('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x10b7('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x10b7('0x5'),_0x10b7('0x6')]}]},'log':_0x10b7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 9858155..9b69580 100644 --- a/server/services/routing/rpc/openchannelQueueReport.js +++ b/server/services/routing/rpc/openchannelQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe499=['create','Request','update','DESC','UpdateOpenchannelQueueReport','../client'];(function(_0x22aacc,_0x552dac){var _0x321ee9=function(_0x274329){while(--_0x274329){_0x22aacc['push'](_0x22aacc['shift']());}};_0x321ee9(++_0x552dac);}(_0xe499,0xfb));var _0x9e49=function(_0x399e3b,_0x5dd3d2){_0x399e3b=_0x399e3b-0x0;var _0x28c6a4=_0xe499[_0x399e3b];return _0x28c6a4;};'use strict';var client=require(_0x9e49('0x0'));exports[_0x9e49('0x1')]=function(_0x24a013){return client[_0x9e49('0x2')]('CreateOpenchannelQueueReport',{'body':_0x24a013,'log':'CreateOpenchannelQueueReport'});};exports[_0x9e49('0x3')]=function(_0x169b6e,_0x403a94){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x403a94,'options':{'where':{'uniqueid':_0x169b6e},'order':[['id',_0x9e49('0x4')]],'limit':0x1},'log':_0x9e49('0x5')});}; \ No newline at end of file +var _0x36f7=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x36f7,0x154));var _0x736f=function(_0x12beb7,_0x5a8f91){_0x12beb7=_0x12beb7-0x0;var _0x346f15=_0x36f7[_0x12beb7];return _0x346f15;};'use strict';var client=require(_0x736f('0x0'));exports[_0x736f('0x1')]=function(_0x4d526c){return client[_0x736f('0x2')](_0x736f('0x3'),{'body':_0x4d526c,'log':_0x736f('0x3')});};exports[_0x736f('0x4')]=function(_0x16278b,_0x5df473){return client[_0x736f('0x2')](_0x736f('0x5'),{'body':_0x5df473,'options':{'where':{'uniqueid':_0x16278b},'order':[['id',_0x736f('0x6')]],'limit':0x1},'log':_0x736f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ceb269f..b07e7f2 100644 --- a/server/services/routing/rpc/smsInteraction.js +++ b/server/services/routing/rpc/smsInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d2=['Request','updateSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x5a92df,_0x52d6b7){var _0xf0183f=function(_0x4866f9){while(--_0x4866f9){_0x5a92df['push'](_0x5a92df['shift']());}};_0xf0183f(++_0x52d6b7);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x46c930,_0x49079b){_0x46c930=_0x46c930-0x0;var _0x269f7d=_0xd6d2[_0x46c930];return _0x269f7d;};'use strict';var client=require(_0x2d6d('0x0'));exports[_0x2d6d('0x1')]=function(_0x4963d6,_0x19be1a){return client[_0x2d6d('0x2')]('UpdateSmsInteraction',{'body':_0x19be1a,'options':{'where':{'id':_0x4963d6}},'log':_0x2d6d('0x3')});};exports['addTags']=function(_0x1c5e54,_0x3ee519){return client[_0x2d6d('0x2')]('AddTagsToSmsInteraction',{'body':_0x3ee519,'options':{'where':{'id':_0x1c5e54}},'log':_0x2d6d('0x4')});}; \ No newline at end of file +var _0xf483=['addTags','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x329d31,_0x403869){var _0x5b7e7d=function(_0x7b39e3){while(--_0x7b39e3){_0x329d31['push'](_0x329d31['shift']());}};_0x5b7e7d(++_0x403869);}(_0xf483,0xf2));var _0x3f48=function(_0x432fd2,_0x3c7dcc){_0x432fd2=_0x432fd2-0x0;var _0x2e7437=_0xf483[_0x432fd2];return _0x2e7437;};'use strict';var client=require('../client');exports[_0x3f48('0x0')]=function(_0x4fa0f8,_0x37d0f3){return client[_0x3f48('0x1')](_0x3f48('0x2'),{'body':_0x37d0f3,'options':{'where':{'id':_0x4fa0f8}},'log':_0x3f48('0x3')});};exports[_0x3f48('0x4')]=function(_0x312d9c,_0x5deb61){return client['Request']('AddTagsToSmsInteraction',{'body':_0x5deb61,'options':{'where':{'id':_0x312d9c}},'log':_0x3f48('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 40e14d8..de23505 100644 --- a/server/services/routing/rpc/smsMessage.js +++ b/server/services/routing/rpc/smsMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7d6=['createSmsMessage','../client','create'];(function(_0x1fd9d0,_0x5691a0){var _0x487c29=function(_0x375c09){while(--_0x375c09){_0x1fd9d0['push'](_0x1fd9d0['shift']());}};_0x487c29(++_0x5691a0);}(_0xa7d6,0x1ba));var _0x6a7d=function(_0x2f3510,_0x3b740a){_0x2f3510=_0x2f3510-0x0;var _0x1dbccc=_0xa7d6[_0x2f3510];return _0x1dbccc;};'use strict';var client=require(_0x6a7d('0x0'));exports[_0x6a7d('0x1')]=function(_0x2db32a){return client['Request']('CreateSmsMessage',{'body':_0x2db32a,'log':_0x6a7d('0x2')});}; \ No newline at end of file +var _0xcc40=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0xcc40,0xf6));var _0x0cc4=function(_0x4c650a,_0x57c476){_0x4c650a=_0x4c650a-0x0;var _0x1ac9dc=_0xcc40[_0x4c650a];return _0x1ac9dc;};'use strict';var client=require(_0x0cc4('0x0'));exports[_0x0cc4('0x1')]=function(_0x5471df){return client[_0x0cc4('0x2')](_0x0cc4('0x3'),{'body':_0x5471df,'log':_0x0cc4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 57d015c..a3a1209 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x1e51ec,_0x47449a){var _0x18239e=function(_0x3cb217){while(--_0x3cb217){_0x1e51ec['push'](_0x1e51ec['shift']());}};_0x18239e(++_0x47449a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x35fb6c,_0x3f1c1a){var _0x5a30a3=function(_0x256049){while(--_0x256049){_0x35fb6c['push'](_0x35fb6c['shift']());}};_0x5a30a3(++_0x3f1c1a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e2350e1..f161cf3 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2a7066,_0x279e23){var _0x21814e=function(_0x3925a5){while(--_0x3925a5){_0x2a7066['push'](_0x2a7066['shift']());}};_0x21814e(++_0x279e23);}(_0x008c,0x188));var _0xc008=function(_0x3b76ae,_0x1f110e){_0x3b76ae=_0x3b76ae-0x0;var _0x11ab0f=_0x008c[_0x3b76ae];return _0x11ab0f;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x008c,0x188));var _0xc008=function(_0x6d3491,_0x399cf8){_0x6d3491=_0x6d3491-0x0;var _0x5494b1=_0x008c[_0x6d3491];return _0x5494b1;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index c839e0f..53550b2 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x5bfeb7,_0x47e51d){var _0x4ff3a8=function(_0x40ccd1){while(--_0x40ccd1){_0x5bfeb7['push'](_0x5bfeb7['shift']());}};_0x4ff3a8(++_0x47e51d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x3105e7,_0xcebb1b){var _0x574c1c=function(_0x2502d4){while(--_0x2502d4){_0x3105e7['push'](_0x3105e7['shift']());}};_0x574c1c(++_0xcebb1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index fba5aca..bc46b37 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89fb=['AddTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x1bac1e,_0x7cdbc9){var _0x3e92d9=function(_0x3f39de){while(--_0x3f39de){_0x1bac1e['push'](_0x1bac1e['shift']());}};_0x3e92d9(++_0x7cdbc9);}(_0x89fb,0x14b));var _0xb89f=function(_0x1bac43,_0x36d42d){_0x1bac43=_0x1bac43-0x0;var _0x633e2f=_0x89fb[_0x1bac43];return _0x633e2f;};'use strict';var client=require('../client');exports[_0xb89f('0x0')]=function(_0x770148,_0x915ea6){return client[_0xb89f('0x1')](_0xb89f('0x2'),{'body':_0x915ea6,'options':{'where':{'id':_0x770148}},'log':'updateWhatsappInteraction'});};exports[_0xb89f('0x3')]=function(_0xa626e8,_0x3d0629){return client[_0xb89f('0x1')](_0xb89f('0x4'),{'body':_0x3d0629,'options':{'where':{'id':_0xa626e8}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xf03a=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','updateWhatsappInteraction','addTags'];(function(_0x427e9d,_0x6a2c98){var _0x4fc009=function(_0x11d6fb){while(--_0x11d6fb){_0x427e9d['push'](_0x427e9d['shift']());}};_0x4fc009(++_0x6a2c98);}(_0xf03a,0x1a0));var _0xaf03=function(_0x441aeb,_0x23ffcf){_0x441aeb=_0x441aeb-0x0;var _0x17fc37=_0xf03a[_0x441aeb];return _0x17fc37;};'use strict';var client=require('../client');exports[_0xaf03('0x0')]=function(_0x116ce0,_0x389761){return client[_0xaf03('0x1')]('UpdateWhatsappInteraction',{'body':_0x389761,'options':{'where':{'id':_0x116ce0}},'log':_0xaf03('0x2')});};exports[_0xaf03('0x3')]=function(_0x4f13f3,_0x3aa47d){return client[_0xaf03('0x1')](_0xaf03('0x4'),{'body':_0x3aa47d,'options':{'where':{'id':_0x4f13f3}},'log':_0xaf03('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2aabf8a..70a1600 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc833=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x1ba2cf,_0x577823){var _0x16b70e=function(_0x2e1639){while(--_0x2e1639){_0x1ba2cf['push'](_0x1ba2cf['shift']());}};_0x16b70e(++_0x577823);}(_0xc833,0x1d1));var _0x3c83=function(_0x2d5b8e,_0x1d949c){_0x2d5b8e=_0x2d5b8e-0x0;var _0x511dd4=_0xc833[_0x2d5b8e];return _0x511dd4;};'use strict';var client=require(_0x3c83('0x0'));exports[_0x3c83('0x1')]=function(_0xb852fc){return client['Request'](_0x3c83('0x2'),{'body':_0xb852fc,'log':_0x3c83('0x3')});}; \ No newline at end of file +var _0xc638=['CreateWhatsappMessage','createWhatsappMessage'];(function(_0x9f75b5,_0x4bc37c){var _0x1beb39=function(_0x3c9d8c){while(--_0x3c9d8c){_0x9f75b5['push'](_0x9f75b5['shift']());}};_0x1beb39(++_0x4bc37c);}(_0xc638,0x134));var _0x8c63=function(_0x16af01,_0x9c623c){_0x16af01=_0x16af01-0x0;var _0x4d4b9a=_0xc638[_0x16af01];return _0x4d4b9a;};'use strict';var client=require('../client');exports['create']=function(_0x10e4f8){return client['Request'](_0x8c63('0x0'),{'body':_0x10e4f8,'log':_0x8c63('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 5bfa900..d71cabc 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5b9=['timeout','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','name'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xc5b9,0x1ac));var _0x9c5b=function(_0x534f9f,_0x3f82cf){_0x534f9f=_0x534f9f-0x0;var _0x5ea68f=_0xc5b9[_0x534f9f];return _0x5ea68f;};'use strict';var client=require(_0x9c5b('0x0'));exports[_0x9c5b('0x1')]=function(){return function(){return client[_0x9c5b('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x9c5b('0x3'),_0x9c5b('0x4'),'strategy'],'include':[{'model':_0x9c5b('0x5'),'as':_0x9c5b('0x6'),'attributes':['id',_0x9c5b('0x3'),_0x9c5b('0x7'),_0x9c5b('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x5e8a=['strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0xc46667,_0xc45fc8){var _0x168849=function(_0x16f6eb){while(--_0x16f6eb){_0xc46667['push'](_0xc46667['shift']());}};_0x168849(++_0xc45fc8);}(_0x5e8a,0xcb));var _0xa5e8=function(_0x78929c,_0x529d2f){_0x78929c=_0x78929c-0x0;var _0x1c1c5c=_0x5e8a[_0x78929c];return _0x1c1c5c;};'use strict';var client=require(_0xa5e8('0x0'));exports[_0xa5e8('0x1')]=function(){return function(){return client[_0xa5e8('0x2')](_0xa5e8('0x3'),{'options':{'raw':![],'attributes':['id',_0xa5e8('0x4'),_0xa5e8('0x5'),_0xa5e8('0x6')],'include':[{'model':_0xa5e8('0x7'),'as':_0xa5e8('0x8'),'attributes':['id',_0xa5e8('0x4'),_0xa5e8('0x9'),_0xa5e8('0xa')]}]},'log':_0xa5e8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 4af110b..06bf189 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad71=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xad71,0x11e));var _0x1ad7=function(_0x1e2d55,_0x2029a6){_0x1e2d55=_0x1e2d55-0x0;var _0x26b998=_0xad71[_0x1e2d55];return _0x26b998;};'use strict';var client=require(_0x1ad7('0x0'));exports[_0x1ad7('0x1')]=function(_0x3d4a92){return client[_0x1ad7('0x2')]('CreateWhatsappQueueReport',{'body':_0x3d4a92,'log':_0x1ad7('0x3')});};exports[_0x1ad7('0x4')]=function(_0x181a87,_0x1be72f){return client['Request'](_0x1ad7('0x5'),{'body':_0x1be72f,'options':{'where':{'uniqueid':_0x181a87},'order':[['id',_0x1ad7('0x6')]],'limit':0x1},'log':_0x1ad7('0x5')});}; \ No newline at end of file +var _0x7c6d=['DESC','../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7c6d,0x85));var _0xd7c6=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x7c6d[_0x288f5e];return _0x476cc9;};'use strict';var client=require(_0xd7c6('0x0'));exports['create']=function(_0xfd768a){return client[_0xd7c6('0x1')](_0xd7c6('0x2'),{'body':_0xfd768a,'log':_0xd7c6('0x2')});};exports[_0xd7c6('0x3')]=function(_0x18abc8,_0x2a691a){return client[_0xd7c6('0x1')](_0xd7c6('0x4'),{'body':_0x2a691a,'options':{'where':{'uniqueid':_0x18abc8},'order':[['id',_0xd7c6('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 07ecc9a..5e8385b 100644 --- a/server/services/routing/server/applications/agent.js +++ b/server/services/routing/server/applications/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8826=['map','join','stop','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','log','[%s][QUEUE]\x20%s','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s'];(function(_0xcac530,_0x539784){var _0x1d42f6=function(_0x22faa5){while(--_0x22faa5){_0xcac530['push'](_0xcac530['shift']());}};_0x1d42f6(++_0x539784);}(_0x8826,0x139));var _0x6882=function(_0x502e73,_0x5e1c95){_0x502e73=_0x502e73-0x0;var _0x5af3f4=_0x8826[_0x502e73];return _0x5af3f4;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x6882('0x0'));var seqqueue=require(_0x6882('0x1'));var logger=require(_0x6882('0x2'))(_0x6882('0x3'));var strategy=require(_0x6882('0x4'));var queue=schema({'name':{'type':_0x6882('0x5'),'required':!![],'message':_0x6882('0x6')},'timeout':{'type':'number','message':_0x6882('0x7')}});function writeLog(_0x30d9f8,_0x5779a8,_0x21798e){return logger[_0x6882('0x8')](util[_0x6882('0x9')](_0x6882('0xa'),_0x30d9f8,_0x5779a8[_0x6882('0xb')],_0x21798e));}function handleFindAgent(_0x17a4cb){return function(_0x53f8e5){return _0x53f8e5[_0x6882('0xb')]['toLowerCase']()===_0x17a4cb[_0x6882('0xc')]();};}exports[_0x6882('0xd')]=function(_0x3fcc2f,_0x965c04,_0x4284a3,_0x28ae7e){return function(_0x2bdc68){try{var _0x215d4f={'name':_0x965c04[0x0],'timeout':_0x965c04[0x1]};var _0x4ad6f8=queue['validate'](_0x215d4f,{'typecast':!![]});if(_0x4ad6f8[_0x6882('0xe')]){logger[_0x6882('0xf')](_0x6882('0x10'),_0x3fcc2f,_[_0x6882('0x11')](_0x4ad6f8,'message')[_0x6882('0x12')](',\x20'));_0x2bdc68[_0x6882('0x13')]();}else{var _0xeb1516=_['find'](_0x4284a3['agents'],handleFindAgent(_0x215d4f[_0x6882('0xb')]));if(_0xeb1516){var _0x561bad=(_0x215d4f[_0x6882('0x14')]||0xa)*0x3e8;var _0x20719f,_0x1244f6;var _0x4ec17b=seqqueue[_0x6882('0x15')](_0x561bad);_0x4ec17b['id']=_0x3fcc2f;_0x4ec17b['atimeout']=_0x561bad;_0x4ec17b[_0x6882('0x16')]=_0x28ae7e[_0x6882('0x16')];writeLog(_0x3fcc2f,_0xeb1516,util['format'](_0x6882('0x17'),_0x561bad));_0x4284a3[_0x6882('0x18')][_0x3fcc2f]['on'](_0x6882('0x19'),function(){logger['info'](_0x6882('0x1a'),_0x3fcc2f);clearTimeout(_0x1244f6);_0x1244f6=undefined;_0x4ec17b[_0x6882('0x1b')]();if(_0x4284a3['rules'][_0x3fcc2f]){delete _0x4284a3[_0x6882('0x18')][_0x3fcc2f];}_0x2bdc68[_0x6882('0x13')]();});_0x4284a3[_0x6882('0x18')][_0x3fcc2f]['on'](_0x6882('0x1c'),function(){if(_0x4284a3['rules'][_0x3fcc2f]){delete _0x4284a3[_0x6882('0x18')][_0x3fcc2f];}});_0x1244f6=setTimeout(function(){logger[_0x6882('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x3fcc2f);clearTimeout(_0x1244f6);_0x4ec17b[_0x6882('0x1b')]();_0x2bdc68[_0x6882('0x1d')]();},_0x561bad);strategy[_0x6882('0x1e')](_0x4ec17b,_0xeb1516,_0x4284a3,_0x28ae7e);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3fcc2f,_0x215d4f[_0x6882('0xb')]);_0x2bdc68[_0x6882('0x13')]();}}}catch(_0x4ba1bb){console[_0x6882('0x1f')](_0x4ba1bb);logger['error'](_0x6882('0x20'),_0x3fcc2f,_0x4ba1bb['stack']);_0x2bdc68[_0x6882('0x13')]();}};}; \ No newline at end of file +var _0x6078=['routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','timeout','createQueue','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue'];(function(_0xbbc0bb,_0x1ec934){var _0x47534d=function(_0x1137cc){while(--_0x1137cc){_0xbbc0bb['push'](_0xbbc0bb['shift']());}};_0x47534d(++_0x1ec934);}(_0x6078,0x17d));var _0x8607=function(_0x5a2162,_0x5a90a3){_0x5a2162=_0x5a2162-0x0;var _0x4561a7=_0x6078[_0x5a2162];return _0x4561a7;};'use strict';var schema=require(_0x8607('0x0'));var _=require(_0x8607('0x1'));var util=require(_0x8607('0x2'));var seqqueue=require(_0x8607('0x3'));var logger=require('../../../../config/logger')(_0x8607('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x8607('0x5'),'required':!![],'message':_0x8607('0x6')},'timeout':{'type':_0x8607('0x7'),'message':_0x8607('0x8')}});function writeLog(_0x4ef603,_0x818abe,_0x3a4867){return logger[_0x8607('0x9')](util['format'](_0x8607('0xa'),_0x4ef603,_0x818abe[_0x8607('0xb')],_0x3a4867));}function handleFindAgent(_0x2eb0fd){return function(_0x46626d){return _0x46626d[_0x8607('0xb')]['toLowerCase']()===_0x2eb0fd[_0x8607('0xc')]();};}exports[_0x8607('0xd')]=function(_0x467020,_0x48df17,_0x148345,_0x1a0672){return function(_0x30db2c){try{var _0x3bfecb={'name':_0x48df17[0x0],'timeout':_0x48df17[0x1]};var _0xdc2c=queue[_0x8607('0x0')](_0x3bfecb,{'typecast':!![]});if(_0xdc2c[_0x8607('0xe')]){logger[_0x8607('0xf')](_0x8607('0x10'),_0x467020,_[_0x8607('0x11')](_0xdc2c,_0x8607('0x12'))[_0x8607('0x13')](',\x20'));_0x30db2c['stop']();}else{var _0x3db6a7=_['find'](_0x148345['agents'],handleFindAgent(_0x3bfecb[_0x8607('0xb')]));if(_0x3db6a7){var _0x2f7b78=(_0x3bfecb[_0x8607('0x14')]||0xa)*0x3e8;var _0x302a4e,_0x5ed7b5;var _0x43294d=seqqueue[_0x8607('0x15')](_0x2f7b78);_0x43294d['id']=_0x467020;_0x43294d[_0x8607('0x16')]=_0x2f7b78;_0x43294d[_0x8607('0x17')]=_0x1a0672[_0x8607('0x17')];writeLog(_0x467020,_0x3db6a7,util['format']('START:%s',_0x2f7b78));_0x148345[_0x8607('0x18')][_0x467020]['on']('end',function(){logger[_0x8607('0x9')](_0x8607('0x19'),_0x467020);clearTimeout(_0x5ed7b5);_0x5ed7b5=undefined;_0x43294d['close']();if(_0x148345[_0x8607('0x18')][_0x467020]){delete _0x148345['rules'][_0x467020];}_0x30db2c[_0x8607('0x1a')]();});_0x148345[_0x8607('0x18')][_0x467020]['on'](_0x8607('0x1b'),function(){if(_0x148345[_0x8607('0x18')][_0x467020]){delete _0x148345[_0x8607('0x18')][_0x467020];}});_0x5ed7b5=setTimeout(function(){logger[_0x8607('0x9')](_0x8607('0x1c'),_0x467020);clearTimeout(_0x5ed7b5);_0x43294d['close']();_0x30db2c[_0x8607('0x1d')]();},_0x2f7b78);strategy[_0x8607('0x1e')](_0x43294d,_0x3db6a7,_0x148345,_0x1a0672);}else{logger[_0x8607('0xf')](_0x8607('0x1f'),_0x467020,_0x3bfecb[_0x8607('0xb')]);_0x30db2c[_0x8607('0x1a')]();}}}catch(_0x4da51d){console[_0x8607('0x20')](_0x4da51d);logger[_0x8607('0xf')](_0x8607('0x21'),_0x467020,_0x4da51d[_0x8607('0x22')]);_0x30db2c[_0x8607('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 68b9695..86e5401 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cc4=['channel','sms','whatsapp','phone','interaction','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','then','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','next','amazonlex','providerName','stringify','create','Failed','catch','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x8cc4,0xf0));var _0x48cc=function(_0x49ee70,_0x115b1e){_0x49ee70=_0x49ee70-0x0;var _0x3a7254=_0x8cc4[_0x49ee70];return _0x3a7254;};'use strict';var _=require(_0x48cc('0x0'));var moment=require('moment');var AWS=require(_0x48cc('0x1'));var utils=require(_0x48cc('0x2'));var logger=require(_0x48cc('0x3'))('routing');var rpc={'chatMessage':require(_0x48cc('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x48cc('0x5')),'smsMessage':require(_0x48cc('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x48cc('0x7'))};exports['consequence']=function(_0x146699,_0x44984b){return function(_0x359ceb){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x48cc('0x8')](_0x48cc('0x9'),_0x146699,_0x48cc('0xa'));return _0x359ceb['next']();}var _0x271638={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x48cc('0xb')),'direction':'out'};if(this[_0x48cc('0xc')]===_0x48cc('0xd')||this[_0x48cc('0xc')]===_0x48cc('0xe')){_0x271638[_0x48cc('0xf')]=this[_0x48cc('0x10')][_0x48cc('0xf')];}var _0xd42d00=this[_0x48cc('0xc')];if(_0xd42d00===_0x48cc('0x11')){_0x271638['ChatWebsiteId']=this[_0x48cc('0x12')]['id'];}else{_0x271638[_[_0x48cc('0x13')](_0xd42d00)+_0x48cc('0x14')]=this[_0x48cc('0x12')]['id'];}_0x271638[_[_0x48cc('0x13')](_0xd42d00)+_0x48cc('0x15')]=this['interaction']['id'];if(this[_0x48cc('0x10')][_0x48cc('0x16')]){var _0x1b309a=_0x44984b[0x4];if(!_['isEmpty'](_0x1b309a)){_0x271638[_0x48cc('0x17')]=utils[_0x48cc('0x18')](_0x1b309a,this);return rpc[_0xd42d00+_0x48cc('0x19')]['create'](_0x271638)[_0x48cc('0x1a')](function(_0x2bd06e){logger[_0x48cc('0x8')](_0x48cc('0x9'),_0x146699,_0x271638['body']);})['catch'](function(_0x41e88d){logger[_0x48cc('0x1b')](_0x48cc('0x9'),_0x146699,JSON['stringify'](_0x41e88d));})[_0x48cc('0x1c')](function(){logger[_0x48cc('0x8')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x146699);_0x359ceb[_0x48cc('0x1d')]();});}else{logger[_0x48cc('0x8')](_0x48cc('0x1e'),_0x146699);_0x359ceb[_0x48cc('0x1d')]();}}else{var _0x1b0676=this;var _0xf80e63=new AWS[(_0x48cc('0x1f'))]({'accessKeyId':_0x44984b[0x0],'secretAccessKey':_0x44984b[0x1],'region':_0x44984b[0x2]});var _0x281edc={'botAlias':_0x48cc('0x20'),'botName':_0x44984b[0x3],'inputText':this[_0x48cc('0x21')][_0x48cc('0x17')],'userId':this[_0x48cc('0xc')]+':'+this[_0x48cc('0x10')]['id']['toString']()};_0xf80e63[_0x48cc('0x22')](_0x281edc,function(_0x3a948f,_0x23fa4d){if(_0x3a948f){logger['error'](_0x48cc('0x9'),_0x146699,_0x3a948f[_0x48cc('0x21')]);_0x359ceb[_0x48cc('0x23')]();}else if(_0x23fa4d&&_0x23fa4d[_0x48cc('0x21')]){_0x1b0676[_0x48cc('0x17')][_0x48cc('0x24')]=_0x23fa4d;_0x271638['body']=_0x23fa4d['message'];_0x271638[_0x48cc('0x25')]='amazonlex';_0x271638['providerResponse']=JSON[_0x48cc('0x26')](_0x23fa4d);return rpc[_0xd42d00+_0x48cc('0x19')][_0x48cc('0x27')](_0x271638)['then'](function(_0x3e2e3a){logger['info'](_0x48cc('0x9'),_0x146699,_0x271638['body']);if(_0x23fa4d['dialogState']==_0x48cc('0x28')){_0x359ceb[_0x48cc('0x23')]();}else{_0x359ceb[_0x48cc('0x1d')]();}})[_0x48cc('0x29')](function(_0x5c0af0){logger[_0x48cc('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x146699,JSON[_0x48cc('0x26')](_0x5c0af0));_0x359ceb[_0x48cc('0x23')]();});}else{_0x359ceb['next']();}});}}catch(_0x570e09){logger[_0x48cc('0x1b')](_0x48cc('0x9'),_0x146699,JSON[_0x48cc('0x26')](_0x570e09));_0x359ceb[_0x48cc('0x1d')]();}};}; \ No newline at end of file +var _0x39bc=['../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','providerResponse','create','Failed','lodash','moment','aws-sdk','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39bc,0x169));var _0xc39b=function(_0x55b3e9,_0x56e9af){_0x55b3e9=_0x55b3e9-0x0;var _0x190d52=_0x39bc[_0x55b3e9];return _0x190d52;};'use strict';var _=require(_0xc39b('0x0'));var moment=require(_0xc39b('0x1'));var AWS=require(_0xc39b('0x2'));var utils=require(_0xc39b('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc39b('0x4')),'mailMessage':require(_0xc39b('0x5')),'smsMessage':require(_0xc39b('0x6')),'faxMessage':require(_0xc39b('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc39b('0x8')]=function(_0x204f6c,_0x2a25e9){return function(_0x307a84){try{if(!_['isNil'](this[_0xc39b('0x9')][_0xc39b('0xa')])){logger[_0xc39b('0xb')](_0xc39b('0xc'),_0x204f6c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x307a84[_0xc39b('0xd')]();}var _0x4c4902={'ContactId':this[_0xc39b('0xe')]['id'],'sentAt':moment()[_0xc39b('0xf')](_0xc39b('0x10')),'direction':_0xc39b('0x11')};if(this[_0xc39b('0x12')]==='sms'||this['channel']===_0xc39b('0x13')){_0x4c4902['phone']=this[_0xc39b('0x9')]['phone'];}var _0x114b94=this[_0xc39b('0x12')];if(_0x114b94===_0xc39b('0x14')){_0x4c4902[_0xc39b('0x15')]=this['account']['id'];}else{_0x4c4902[_[_0xc39b('0x16')](_0x114b94)+_0xc39b('0x17')]=this[_0xc39b('0x18')]['id'];}_0x4c4902[_[_0xc39b('0x16')](_0x114b94)+_0xc39b('0x19')]=this[_0xc39b('0x9')]['id'];if(this[_0xc39b('0x9')][_0xc39b('0x1a')]){var _0x55b3c5=_0x2a25e9[0x4];if(!_[_0xc39b('0x1b')](_0x55b3c5)){_0x4c4902[_0xc39b('0x1c')]=utils[_0xc39b('0x1d')](_0x55b3c5,this);return rpc[_0x114b94+_0xc39b('0x1e')]['create'](_0x4c4902)[_0xc39b('0x1f')](function(_0x96b699){logger[_0xc39b('0xb')]('[%s][AMAZONLEX]\x20%s',_0x204f6c,_0x4c4902[_0xc39b('0x1c')]);})[_0xc39b('0x20')](function(_0x3d6ce7){logger[_0xc39b('0x21')](_0xc39b('0xc'),_0x204f6c,JSON[_0xc39b('0x22')](_0x3d6ce7));})['finally'](function(){logger[_0xc39b('0xb')](_0xc39b('0x23'),_0x204f6c);_0x307a84[_0xc39b('0x24')]();});}else{logger[_0xc39b('0xb')](_0xc39b('0x25'),_0x204f6c);_0x307a84[_0xc39b('0x24')]();}}else{var _0x43c801=this;var _0x128baa=new AWS['LexRuntime']({'accessKeyId':_0x2a25e9[0x0],'secretAccessKey':_0x2a25e9[0x1],'region':_0x2a25e9[0x2]});var _0x3a57e8={'botAlias':_0xc39b('0x26'),'botName':_0x2a25e9[0x3],'inputText':this[_0xc39b('0x27')][_0xc39b('0x1c')],'userId':this[_0xc39b('0x12')]+':'+this[_0xc39b('0x9')]['id'][_0xc39b('0x28')]()};_0x128baa[_0xc39b('0x29')](_0x3a57e8,function(_0x257cb3,_0x373d3b){if(_0x257cb3){logger[_0xc39b('0x21')](_0xc39b('0xc'),_0x204f6c,_0x257cb3[_0xc39b('0x27')]);_0x307a84[_0xc39b('0xd')]();}else if(_0x373d3b&&_0x373d3b[_0xc39b('0x27')]){_0x43c801['body'][_0xc39b('0x2a')]=_0x373d3b;_0x4c4902[_0xc39b('0x1c')]=_0x373d3b[_0xc39b('0x27')];_0x4c4902['providerName']=_0xc39b('0x2a');_0x4c4902[_0xc39b('0x2b')]=JSON['stringify'](_0x373d3b);return rpc[_0x114b94+_0xc39b('0x1e')][_0xc39b('0x2c')](_0x4c4902)[_0xc39b('0x1f')](function(_0x3fbd84){logger[_0xc39b('0xb')]('[%s][AMAZONLEX]\x20%s',_0x204f6c,_0x4c4902[_0xc39b('0x1c')]);if(_0x373d3b['dialogState']==_0xc39b('0x2d')){_0x307a84[_0xc39b('0xd')]();}else{_0x307a84[_0xc39b('0x24')]();}})[_0xc39b('0x20')](function(_0x2fdca5){logger['error']('[%s][AMAZONLEX]\x20%s',_0x204f6c,JSON[_0xc39b('0x22')](_0x2fdca5));_0x307a84[_0xc39b('0xd')]();});}else{_0x307a84[_0xc39b('0xd')]();}});}}catch(_0x871404){logger[_0xc39b('0x21')](_0xc39b('0xc'),_0x204f6c,JSON[_0xc39b('0x22')](_0x871404));_0x307a84[_0xc39b('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 44f94d7..279d9bb 100644 --- a/server/services/routing/server/applications/autoreply.js +++ b/server/services/routing/server/applications/autoreply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ea9=['sendMailMessage','smtpOptions','then','create','[%s][AUTOREPLY]\x20%s','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','mail','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html','','replace','','headers','auto-replied','All','auto_reply'];(function(_0x15ddf8,_0x341cfa){var _0x306fd7=function(_0x1ba4bd){while(--_0x1ba4bd){_0x15ddf8['push'](_0x15ddf8['shift']());}};_0x306fd7(++_0x341cfa);}(_0x2ea9,0x162));var _0x92ea=function(_0x54d16e,_0x2fb752){_0x54d16e=_0x54d16e-0x0;var _0x3de59a=_0x2ea9[_0x54d16e];return _0x3de59a;};'use strict';var _=require(_0x92ea('0x0'));var moment=require(_0x92ea('0x1'));var utils=require('./utils');var logger=require(_0x92ea('0x2'))(_0x92ea('0x3'));var rpc={'chatMessage':require(_0x92ea('0x4')),'openchannelMessage':require(_0x92ea('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x92ea('0x6')),'faxMessage':require(_0x92ea('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x92ea('0x8')),'openchannelInteraction':require(_0x92ea('0x9')),'mailInteraction':require(_0x92ea('0xa')),'smsInteraction':require(_0x92ea('0xb')),'faxInteraction':require(_0x92ea('0xc')),'whatsappInteraction':require(_0x92ea('0xd'))};var mailRpc=require('../../mailRpc');exports[_0x92ea('0xe')]=function(_0x1dcdbd,_0x215ded,_0x1afabc,_0x55d16c){return function(_0x2d73b3){try{var _0x29b835=this[_0x92ea('0xf')];if(_0x29b835===_0x92ea('0x10')&&_0x55d16c[_0x92ea('0x11')]['isAutoreply']){logger[_0x92ea('0x12')]('[%s][AUTOREPLY]\x20%s',_0x1dcdbd,_0x92ea('0x13'));return _0x2d73b3['next']();}if(_0x215ded[0x0]==='1'&&(_[_0x92ea('0x14')](this[_0x92ea('0x15')][_0x92ea('0x16')])||!this[_0x92ea('0x15')][_0x92ea('0x16')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x1dcdbd,'Autoreply\x20already\x20sent');return _0x2d73b3[_0x92ea('0x17')]();}if(_0x215ded[0x0]==='2'&&this[_0x92ea('0x15')]['autoreplyExecuted']){logger[_0x92ea('0x12')](_0x92ea('0x18'),_0x1dcdbd,_0x92ea('0x19'));return _0x2d73b3[_0x92ea('0x17')]();}var _0x3c98ff={'ContactId':this[_0x92ea('0x1a')]['id'],'sentAt':moment()[_0x92ea('0x1b')](_0x92ea('0x1c')),'direction':_0x92ea('0x1d')};if(this[_0x92ea('0xf')]==='mail'){_0x3c98ff[_0x92ea('0x11')]=utils[_0x92ea('0x1e')](_0x215ded[0x2],this);}else{_0x3c98ff[_0x92ea('0x11')]=utils[_0x92ea('0x1e')](_0x215ded[0x1],this);}if(this['message']){_0x3c98ff['to']=this['message']['from']||'';if(this['channel']===_0x92ea('0x10')&&_0x215ded[0x1]==='1'){_0x3c98ff['cc']=this[_0x92ea('0x1f')]['cc']||'';}_0x3c98ff[_0x92ea('0x20')]=this[_0x92ea('0x1f')]['to']||'';_0x3c98ff['phone']=this['message'][_0x92ea('0x21')]||'';_0x3c98ff[_0x92ea('0x22')]=!![];if(this[_0x92ea('0x1f')][_0x92ea('0x23')]){_0x3c98ff[_0x92ea('0x23')]='';_0x3c98ff[_0x92ea('0x23')]+=_[_0x92ea('0x24')](this[_0x92ea('0x1f')][_0x92ea('0x23')],'Re:')?'':'Re:\x20';_0x3c98ff[_0x92ea('0x23')]+=this['message'][_0x92ea('0x23')];}}if(this['channel']===_0x92ea('0x25')){_0x3c98ff[_0x92ea('0x26')]=this[_0x92ea('0x27')]['id'];}else{_0x3c98ff[_[_0x92ea('0x28')](this['channel'])+_0x92ea('0x29')]=this[_0x92ea('0x27')]['id'];}_0x3c98ff[_[_0x92ea('0x28')](this[_0x92ea('0xf')])+_0x92ea('0x2a')]=this['interaction']['id'];var _0x533c89=this['interaction'];if(rpc[this[_0x92ea('0xf')]+_0x92ea('0x2b')]){if(this[_0x92ea('0xf')]===_0x92ea('0x10')){_0x3c98ff['inReplyTo']=this[_0x92ea('0x1f')][_0x92ea('0x2c')];_0x3c98ff[_0x92ea('0x2d')]=_0x92ea('0x2e')+_[_0x92ea('0x2f')](_0x3c98ff[_0x92ea('0x11')],_0x92ea('0x30'),'','replace','','headers','All'];(function(_0x55f213,_0x24990b){var _0x450944=function(_0x170bff){while(--_0x170bff){_0x55f213['push'](_0x55f213['shift']());}};_0x450944(++_0x24990b);}(_0xb5a5,0xd4));var _0x5b5a=function(_0x2dbeeb,_0x564375){_0x2dbeeb=_0x2dbeeb-0x0;var _0x34c8cf=_0xb5a5[_0x2dbeeb];return _0x34c8cf;};'use strict';var _=require('lodash');var moment=require(_0x5b5a('0x0'));var utils=require(_0x5b5a('0x1'));var logger=require(_0x5b5a('0x2'))(_0x5b5a('0x3'));var rpc={'chatMessage':require(_0x5b5a('0x4')),'openchannelMessage':require(_0x5b5a('0x5')),'mailMessage':require(_0x5b5a('0x6')),'smsMessage':require(_0x5b5a('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5b5a('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5b5a('0x9')),'mailInteraction':require(_0x5b5a('0xa')),'smsInteraction':require(_0x5b5a('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5b5a('0xc'))};var mailRpc=require('../../mailRpc');exports[_0x5b5a('0xd')]=function(_0x1cadd1,_0x29cc5a,_0x3f0116,_0x4772c0){return function(_0x38f74e){try{var _0x20e7eb=this[_0x5b5a('0xe')];if(_0x20e7eb===_0x5b5a('0xf')&&_0x4772c0[_0x5b5a('0x10')]['isAutoreply']){logger[_0x5b5a('0x11')](_0x5b5a('0x12'),_0x1cadd1,_0x5b5a('0x13'));return _0x38f74e[_0x5b5a('0x14')]();}if(_0x29cc5a[0x0]==='1'&&(_['isNil'](this[_0x5b5a('0x15')][_0x5b5a('0x16')])||!this[_0x5b5a('0x15')][_0x5b5a('0x16')])){logger[_0x5b5a('0x11')]('[%s][AUTOREPLY]\x20%s',_0x1cadd1,'Autoreply\x20already\x20sent');return _0x38f74e[_0x5b5a('0x14')]();}if(_0x29cc5a[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x5b5a('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1cadd1,_0x5b5a('0x17'));return _0x38f74e[_0x5b5a('0x14')]();}var _0x3cbdf1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5b5a('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5b5a('0x19')};if(this['channel']===_0x5b5a('0xf')){_0x3cbdf1[_0x5b5a('0x10')]=utils[_0x5b5a('0x1a')](_0x29cc5a[0x2],this);}else{_0x3cbdf1[_0x5b5a('0x10')]=utils[_0x5b5a('0x1a')](_0x29cc5a[0x1],this);}if(this[_0x5b5a('0x1b')]){_0x3cbdf1['to']=this[_0x5b5a('0x1b')][_0x5b5a('0x1c')]||'';if(this[_0x5b5a('0xe')]==='mail'&&_0x29cc5a[0x1]==='1'){_0x3cbdf1['cc']=this['message']['cc']||'';}_0x3cbdf1[_0x5b5a('0x1c')]=this[_0x5b5a('0x1b')]['to']||'';_0x3cbdf1[_0x5b5a('0x1d')]=this[_0x5b5a('0x1b')][_0x5b5a('0x1d')]||'';_0x3cbdf1[_0x5b5a('0x1e')]=!![];if(this['message'][_0x5b5a('0x1f')]){_0x3cbdf1[_0x5b5a('0x1f')]='';_0x3cbdf1[_0x5b5a('0x1f')]+=_[_0x5b5a('0x20')](this[_0x5b5a('0x1b')][_0x5b5a('0x1f')],_0x5b5a('0x21'))?'':_0x5b5a('0x22');_0x3cbdf1[_0x5b5a('0x1f')]+=this[_0x5b5a('0x1b')][_0x5b5a('0x1f')];}}if(this['channel']==='chat'){_0x3cbdf1[_0x5b5a('0x23')]=this[_0x5b5a('0x24')]['id'];}else{_0x3cbdf1[_[_0x5b5a('0x25')](this['channel'])+'AccountId']=this[_0x5b5a('0x24')]['id'];}_0x3cbdf1[_[_0x5b5a('0x25')](this['channel'])+_0x5b5a('0x26')]=this[_0x5b5a('0x15')]['id'];var _0x5a19d1=this['interaction'];if(rpc[this['channel']+_0x5b5a('0x27')]){if(this[_0x5b5a('0xe')]===_0x5b5a('0xf')){_0x3cbdf1[_0x5b5a('0x28')]=this[_0x5b5a('0x1b')][_0x5b5a('0x29')];_0x3cbdf1['html']=_0x5b5a('0x2a')+_[_0x5b5a('0x2b')](_0x3cbdf1['body'],_0x5b5a('0x2c'),']+(>|$)/g,''),'priorityTrue':_0x7506c2[0x1],'priorityFalse':_0x7506c2[0x2]};var _0x30e158=gotoif[_0xe2d2('0x0')](_0x3054d8,{'typecast':!![]});if(_0x30e158[_0xe2d2('0xb')]){logger['error'](_0xe2d2('0xc'),_0x4cc8c0,_['map'](_0x30e158,_0xe2d2('0xd'))[_0xe2d2('0xe')](',\x20'));_0x277a89[_0xe2d2('0xf')]();}else{try{var _0x1e8026=eval('('+_0x3054d8[_0xe2d2('0x10')]+')');var _0xdc3a0d=_0x1e8026?_0x3054d8['priorityTrue']:_0x3054d8['priorityFalse'];logger[_0xe2d2('0x11')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4cc8c0,_0x3054d8[_0xe2d2('0x10')],_0x1e8026,_0xdc3a0d||_0xe2d2('0x12'));if(_0xdc3a0d){var _0x3cd9fa=_[_0xe2d2('0x13')](_0x277a89[_0xe2d2('0x14')](),{'p':_0xdc3a0d});if(_0x3cd9fa>=0x0){logger[_0xe2d2('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4cc8c0,_0xdc3a0d||_0xe2d2('0x12'),_0x3cd9fa);_0x277a89['next'](_0x3cd9fa);}else{logger['info'](_0xe2d2('0x15'),_0x4cc8c0,_0xdc3a0d||'next');_0x277a89[_0xe2d2('0xf')]();}}else{_0x277a89[_0xe2d2('0x12')]();}}catch(_0x3561d4){logger[_0xe2d2('0x16')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4cc8c0,_0x3561d4['message']);_0x277a89[_0xe2d2('0xf')]();}}}catch(_0x13194b){logger[_0xe2d2('0x16')]('[%s][GOTOIF]\x20%s',_0x4cc8c0,JSON['stringify'](_0x13194b));_0x277a89['stop']();}};}; \ No newline at end of file +var _0x35c4=['join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','error','map','message'];(function(_0x27c776,_0x43f204){var _0x440280=function(_0x3db0f2){while(--_0x3db0f2){_0x27c776['push'](_0x27c776['shift']());}};_0x440280(++_0x43f204);}(_0x35c4,0x151));var _0x435c=function(_0x228c0a,_0x432c68){_0x228c0a=_0x228c0a-0x0;var _0x260357=_0x35c4[_0x228c0a];return _0x260357;};'use strict';var schema=require(_0x435c('0x0'));var _=require(_0x435c('0x1'));var htmlToText=require(_0x435c('0x2'));var utils=require(_0x435c('0x3'));var logger=require(_0x435c('0x4'))(_0x435c('0x5'));var gotoif=schema({'condition':{'type':_0x435c('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x435c('0x7'),'message':_0x435c('0x8')},'priorityFalse':{'type':_0x435c('0x7'),'message':_0x435c('0x9')}});exports['consequence']=function(_0x569e8e,_0x32a46c){return function(_0x3a9001){try{var _0x27355d={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x32a46c[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x32a46c[0x1],'priorityFalse':_0x32a46c[0x2]};var _0x5ca774=gotoif[_0x435c('0x0')](_0x27355d,{'typecast':!![]});if(_0x5ca774['length']){logger[_0x435c('0xa')]('[%s][GOTOIF]\x20%s',_0x569e8e,_[_0x435c('0xb')](_0x5ca774,_0x435c('0xc'))[_0x435c('0xd')](',\x20'));_0x3a9001[_0x435c('0xe')]();}else{try{var _0x4adc8b=eval('('+_0x27355d[_0x435c('0xf')]+')');var _0x2653cb=_0x4adc8b?_0x27355d[_0x435c('0x10')]:_0x27355d[_0x435c('0x11')];logger[_0x435c('0x12')](_0x435c('0x13'),_0x569e8e,_0x27355d[_0x435c('0xf')],_0x4adc8b,_0x2653cb||_0x435c('0x14'));if(_0x2653cb){var _0x25ed0f=_['findIndex'](_0x3a9001[_0x435c('0x15')](),{'p':_0x2653cb});if(_0x25ed0f>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x569e8e,_0x2653cb||_0x435c('0x14'),_0x25ed0f);_0x3a9001[_0x435c('0x14')](_0x25ed0f);}else{logger[_0x435c('0x12')](_0x435c('0x16'),_0x569e8e,_0x2653cb||'next');_0x3a9001[_0x435c('0xe')]();}}else{_0x3a9001[_0x435c('0x14')]();}}catch(_0x3b6657){logger['error'](_0x435c('0x17'),_0x569e8e,_0x3b6657[_0x435c('0xc')]);_0x3a9001['stop']();}}}catch(_0x19e6ee){logger[_0x435c('0xa')](_0x435c('0x18'),_0x569e8e,JSON['stringify'](_0x19e6ee));_0x3a9001[_0x435c('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 431dc1f..d84f551 100644 --- a/server/services/routing/server/applications/gotop.js +++ b/server/services/routing/server/applications/gotop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a5b=['number','length','error','[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing'];(function(_0x314ae9,_0x9132c4){var _0x584121=function(_0x474b3d){while(--_0x474b3d){_0x314ae9['push'](_0x314ae9['shift']());}};_0x584121(++_0x9132c4);}(_0x8a5b,0x183));var _0xb8a5=function(_0x1b04e6,_0x257b26){_0x1b04e6=_0x1b04e6-0x0;var _0x54b637=_0x8a5b[_0x1b04e6];return _0x54b637;};'use strict';var schema=require(_0xb8a5('0x0'));var _=require(_0xb8a5('0x1'));var logger=require(_0xb8a5('0x2'))(_0xb8a5('0x3'));var gotop=schema({'priority':{'type':_0xb8a5('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x530971,_0x559230){return function(_0xb3f740){try{var _0x4cddb8={'priority':_0x559230[0x0]};var _0x366c78=gotop[_0xb8a5('0x0')](_0x4cddb8,{'typecast':!![]});if(_0x366c78[_0xb8a5('0x5')]){logger[_0xb8a5('0x6')](_0xb8a5('0x7'),_0x530971,_[_0xb8a5('0x8')](_0x366c78,'message')['join'](',\x20'));_0xb3f740[_0xb8a5('0x9')]();}else{logger[_0xb8a5('0xa')](_0xb8a5('0xb'),_0x530971,_0x4cddb8[_0xb8a5('0xc')]);if(_0x4cddb8['priority']){var _0x3e5361=_['findIndex'](_0xb3f740[_0xb8a5('0xd')](),{'p':_0x4cddb8['priority']});if(_0x3e5361>=0x0){logger[_0xb8a5('0xa')](_0xb8a5('0xe'),_0x530971,_0x4cddb8[_0xb8a5('0xc')]||_0xb8a5('0xf'),_0x3e5361);_0xb3f740[_0xb8a5('0xf')](_0x3e5361);}else{logger[_0xb8a5('0xa')](_0xb8a5('0x10'),_0x530971,_0x4cddb8[_0xb8a5('0xc')]||_0xb8a5('0xf'));_0xb3f740[_0xb8a5('0x9')]();}}else{_0xb3f740[_0xb8a5('0xf')]();}}}catch(_0x510446){logger[_0xb8a5('0x6')](_0xb8a5('0x7'),_0x530971,JSON['stringify'](_0x510446));_0xb3f740[_0xb8a5('0x9')]();}};}; \ No newline at end of file +var _0x1e18=['consequence','error','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','../../../../config/logger','routing','number'];(function(_0x49c5ca,_0x1c2ae0){var _0x301e8f=function(_0xe6e202){while(--_0xe6e202){_0x49c5ca['push'](_0x49c5ca['shift']());}};_0x301e8f(++_0x1c2ae0);}(_0x1e18,0x182));var _0x81e1=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x1e18[_0x2d34d6];return _0x1d3d12;};'use strict';var schema=require(_0x81e1('0x0'));var _=require('lodash');var logger=require(_0x81e1('0x1'))(_0x81e1('0x2'));var gotop=schema({'priority':{'type':_0x81e1('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x81e1('0x4')]=function(_0x4348ba,_0x44c0fa){return function(_0x2091a8){try{var _0x492505={'priority':_0x44c0fa[0x0]};var _0x590aa1=gotop[_0x81e1('0x0')](_0x492505,{'typecast':!![]});if(_0x590aa1['length']){logger[_0x81e1('0x5')](_0x81e1('0x6'),_0x4348ba,_['map'](_0x590aa1,'message')[_0x81e1('0x7')](',\x20'));_0x2091a8[_0x81e1('0x8')]();}else{logger[_0x81e1('0x9')](_0x81e1('0xa'),_0x4348ba,_0x492505[_0x81e1('0xb')]);if(_0x492505[_0x81e1('0xb')]){var _0x3cfd66=_['findIndex'](_0x2091a8[_0x81e1('0xc')](),{'p':_0x492505[_0x81e1('0xb')]});if(_0x3cfd66>=0x0){logger[_0x81e1('0x9')](_0x81e1('0xd'),_0x4348ba,_0x492505[_0x81e1('0xb')]||'next',_0x3cfd66);_0x2091a8[_0x81e1('0xe')](_0x3cfd66);}else{logger[_0x81e1('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x4348ba,_0x492505[_0x81e1('0xb')]||_0x81e1('0xe'));_0x2091a8[_0x81e1('0x8')]();}}else{_0x2091a8[_0x81e1('0xe')]();}}}catch(_0x48e935){logger['error'](_0x81e1('0x6'),_0x4348ba,JSON['stringify'](_0x48e935));_0x2091a8[_0x81e1('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index c4db18f..661247f 100644 --- a/server/services/routing/server/applications/message.js +++ b/server/services/routing/server/applications/message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc924=['Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','account','upperFirst','InteractionId'];(function(_0xc8d111,_0x5bf92b){var _0x40b6e4=function(_0x284761){while(--_0x284761){_0xc8d111['push'](_0xc8d111['shift']());}};_0x40b6e4(++_0x5bf92b);}(_0xc924,0x136));var _0x4c92=function(_0x2b710e,_0x24da1e){_0x2b710e=_0x2b710e-0x0;var _0x38e747=_0xc924[_0x2b710e];return _0x38e747;};'use strict';var _=require(_0x4c92('0x0'));var utils=require(_0x4c92('0x1'));var logger=require(_0x4c92('0x2'))(_0x4c92('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4c92('0x4')),'smsMessage':require(_0x4c92('0x5')),'faxMessage':require(_0x4c92('0x6')),'whatsappMessage':require(_0x4c92('0x7'))};exports[_0x4c92('0x8')]=function(_0x5ca736,_0x2bab35){return function(_0x5be124){try{var _0x40ba45={'body':utils['getMustacheRender'](_0x2bab35[0x0],this),'ContactId':this[_0x4c92('0x9')]['id']};if(this[_0x4c92('0xa')]===_0x4c92('0xb')){_0x40ba45['ChatWebsiteId']=this[_0x4c92('0xc')]['id'];}else{_0x40ba45[_['upperFirst'](this[_0x4c92('0xa')])+'AccountId']=this['account']['id'];}_0x40ba45[_[_0x4c92('0xd')](this[_0x4c92('0xa')])+_0x4c92('0xe')]=this['interaction']['id'];if(rpc[this[_0x4c92('0xa')]+_0x4c92('0xf')]){return rpc[this[_0x4c92('0xa')]+_0x4c92('0xf')][_0x4c92('0x10')](_0x40ba45)[_0x4c92('0x11')](function(_0x1b45ea){logger[_0x4c92('0x12')](_0x4c92('0x13'),_0x5ca736,_0x40ba45[_0x4c92('0x14')]);_0x5be124[_0x4c92('0x15')]();})['catch'](function(_0x411855){logger[_0x4c92('0x16')]('[%s][MESSAGE]\x20%s',_0x5ca736,JSON[_0x4c92('0x17')](_0x411855));_0x5be124[_0x4c92('0x18')]();});}}catch(_0x22a150){logger[_0x4c92('0x16')]('[%s][MESSAGE]\x20%s',_0x5ca736,JSON[_0x4c92('0x17')](_0x22a150));_0x5be124[_0x4c92('0x18')]();}};}; \ No newline at end of file +var _0xaebe=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','ChatWebsiteId','upperFirst','AccountId','account','channel','InteractionId','interaction','then','info','[%s][MESSAGE]\x20%s','body','next','error','stop','stringify','lodash','./utils','../../../../config/logger'];(function(_0x3e0b01,_0x17e12a){var _0x5b7dbd=function(_0x6dab67){while(--_0x6dab67){_0x3e0b01['push'](_0x3e0b01['shift']());}};_0x5b7dbd(++_0x17e12a);}(_0xaebe,0xed));var _0xeaeb=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xaebe[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xeaeb('0x0'));var utils=require(_0xeaeb('0x1'));var logger=require(_0xeaeb('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xeaeb('0x3')),'mailMessage':require(_0xeaeb('0x4')),'smsMessage':require(_0xeaeb('0x5')),'faxMessage':require(_0xeaeb('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xeaeb('0x7')]=function(_0x39ef28,_0x2d542c){return function(_0x1a1a6c){try{var _0x21fd10={'body':utils['getMustacheRender'](_0x2d542c[0x0],this),'ContactId':this[_0xeaeb('0x8')]['id']};if(this['channel']==='chat'){_0x21fd10[_0xeaeb('0x9')]=this['account']['id'];}else{_0x21fd10[_[_0xeaeb('0xa')](this['channel'])+_0xeaeb('0xb')]=this[_0xeaeb('0xc')]['id'];}_0x21fd10[_[_0xeaeb('0xa')](this[_0xeaeb('0xd')])+_0xeaeb('0xe')]=this[_0xeaeb('0xf')]['id'];if(rpc[this[_0xeaeb('0xd')]+'Message']){return rpc[this[_0xeaeb('0xd')]+'Message']['create'](_0x21fd10)[_0xeaeb('0x10')](function(_0x512483){logger[_0xeaeb('0x11')](_0xeaeb('0x12'),_0x39ef28,_0x21fd10[_0xeaeb('0x13')]);_0x1a1a6c[_0xeaeb('0x14')]();})['catch'](function(_0x1d674a){logger[_0xeaeb('0x15')]('[%s][MESSAGE]\x20%s',_0x39ef28,JSON['stringify'](_0x1d674a));_0x1a1a6c[_0xeaeb('0x16')]();});}}catch(_0x256ff2){logger['error'](_0xeaeb('0x12'),_0x39ef28,JSON[_0xeaeb('0x17')](_0x256ff2));_0x1a1a6c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 0cf2810..cb85280 100644 --- a/server/services/routing/server/applications/noop.js +++ b/server/services/routing/server/applications/noop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2969=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x5e7073,_0x567aa5){var _0x1fd08e=function(_0x247faf){while(--_0x247faf){_0x5e7073['push'](_0x5e7073['shift']());}};_0x1fd08e(++_0x567aa5);}(_0x2969,0x13e));var _0x9296=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2969[_0x2dafbe];return _0x58a45a;};'use strict';var utils=require(_0x9296('0x0'));var logger=require(_0x9296('0x1'))('routing');exports[_0x9296('0x2')]=function(_0x453477,_0x5649d4){return function(_0x319842){try{logger[_0x9296('0x3')](_0x9296('0x4'),_0x453477,utils[_0x9296('0x5')](_0x5649d4[0x0],this));_0x319842[_0x9296('0x6')]();}catch(_0x4c6b1f){logger[_0x9296('0x7')](_0x9296('0x4'),_0x453477,JSON[_0x9296('0x8')](_0x4c6b1f));_0x319842[_0x9296('0x9')]();}};}; \ No newline at end of file +var _0x84e9=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','stringify','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84e9,0x1aa));var _0x984e=function(_0x2ebf8c,_0x268c7d){_0x2ebf8c=_0x2ebf8c-0x0;var _0x247935=_0x84e9[_0x2ebf8c];return _0x247935;};'use strict';var utils=require(_0x984e('0x0'));var logger=require(_0x984e('0x1'))(_0x984e('0x2'));exports[_0x984e('0x3')]=function(_0x105d8e,_0x4a6e61){return function(_0x158ea0){try{logger[_0x984e('0x4')](_0x984e('0x5'),_0x105d8e,utils['getMustacheRender'](_0x4a6e61[0x0],this));_0x158ea0['next']();}catch(_0x1ca42b){logger['error']('[%s][NOOP]\x20%s',_0x105d8e,JSON[_0x984e('0x6')](_0x1ca42b));_0x158ea0['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 510e22d..49259e9 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf26b=['YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','emit','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf26b,0x133));var _0xbf26=function(_0x3a0213,_0x6452a){_0x3a0213=_0x3a0213-0x0;var _0x4a1ac1=_0xf26b[_0x3a0213];return _0x4a1ac1;};'use strict';var schema=require(_0xbf26('0x0'));var _=require(_0xbf26('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0xbf26('0x2'));var Redis=require(_0xbf26('0x3'));var config=require(_0xbf26('0x4'));var logger=require(_0xbf26('0x5'))(_0xbf26('0x6'));var strategy=require(_0xbf26('0x7'));config[_0xbf26('0x8')]=_[_0xbf26('0x9')](config['redis'],{'host':_0xbf26('0xa'),'port':0x18eb});var io=require(_0xbf26('0xb'))(new Redis(config['redis']));var attributes=['id',_0xbf26('0xc'),_0xbf26('0xd'),_0xbf26('0xe'),_0xbf26('0xf'),'joinAt'];function emit(_0xcc15b0,_0x2b030a,_0x179cab){io['to'](_0xcc15b0)[_0xbf26('0x10')](_0x2b030a,_0x179cab);}function emitChannelQueueInteraction(_0x42407d,_0x15b550,_0x306f3c,_0x392e6a,_0x240bdf,_0x2b00d8,_0x417d77,_0x28d787){var _0x2e2412=_['clone'](_0x306f3c);_0x2e2412['queue_id']=_0x28d787;_0x2e2412[_0xbf26('0xe')]=_0x15b550;_0x2e2412['account']=_0x392e6a;_0x2e2412['id']=_0x240bdf;if(_0x2b00d8){attributes[_0xbf26('0x11')](_[_0xbf26('0x12')](_0x42407d)+_0xbf26('0x13'));_0x417d77[util[_0xbf26('0x14')](_0xbf26('0x15'),_0x42407d)][_0x240bdf]=_[_0xbf26('0x16')](_0x2e2412,attributes);}else{delete _0x417d77[util[_0xbf26('0x14')](_0xbf26('0x15'),_0x42407d)][_0x240bdf];}emit(util[_0xbf26('0x14')](_0xbf26('0x17'),_0x42407d,_0x15b550),util[_0xbf26('0x14')](_0xbf26('0x18'),_0x42407d,_0x2b00d8?_0xbf26('0x19'):'remove'),_['pick'](_0x2e2412,attributes));}var rpc={'openchannelQueueReport':require(_0xbf26('0x1a')),'mailQueueReport':require(_0xbf26('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xbf26('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbf26('0x1d')),'chatInteraction':require(_0xbf26('0x1e')),'faxInteraction':require(_0xbf26('0x1f')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0xbf26('0x20')),'smsInteraction':require(_0xbf26('0x21')),'whatsappInteraction':require(_0xbf26('0x22'))};var queue=schema({'name':{'type':_0xbf26('0x23'),'required':!![],'message':_0xbf26('0x24')},'timeout':{'type':_0xbf26('0x25'),'message':_0xbf26('0x26')}});function startRouting(_0x35ec8d,_0x3ac622,_0x27c8bc,_0x56d712){if(_0x35ec8d&&_0x3ac622&&_0x27c8bc){_0x3ac622[_0xbf26('0x27')]+=0x1;var _0x11080e={'uniqueid':_0x35ec8d,'from':_0x27c8bc[_0xbf26('0x28')]?_0x27c8bc[_0xbf26('0x28')][_0xbf26('0xf')]:'','joinAt':moment()['format'](_0xbf26('0x29')),'ContactId':_0x27c8bc[_0xbf26('0x2a')]?_0x27c8bc[_0xbf26('0x2a')]['id']:null,'ListId':_0x27c8bc[_0xbf26('0x2b')]?_0x27c8bc[_0xbf26('0x2b')]['id']:null};_0x11080e[_[_0xbf26('0x2c')](_0x27c8bc[_0xbf26('0x2d')])+_0xbf26('0x2e')]=_0x3ac622['id']||null;_0x11080e[_[_0xbf26('0x2c')](_0x27c8bc[_0xbf26('0x2d')])+_0xbf26('0x13')]=_0x27c8bc[_0xbf26('0x2f')]?_0x27c8bc[_0xbf26('0x2f')]['id']:null;_0x11080e[_['upperFirst'](_0x27c8bc[_0xbf26('0x2d')])+_0xbf26('0x30')]=_0x27c8bc[_0xbf26('0x31')]?_0x27c8bc['message']['id']:null;_0x11080e[_[_0xbf26('0x2c')](_0x27c8bc[_0xbf26('0x2d')])+(_0x27c8bc[_0xbf26('0x2d')]!=='chat'?_0xbf26('0x32'):_0xbf26('0x33'))]=_0x27c8bc[_0xbf26('0xd')]?_0x27c8bc[_0xbf26('0xd')]['id']:null;logger[_0xbf26('0x34')](util[_0xbf26('0x14')](_0xbf26('0x35'),_0x35ec8d,_0x3ac622[_0xbf26('0x36')]));emitChannelQueueInteraction(_0x27c8bc[_0xbf26('0x2d')],_0x3ac622['name'],_0x11080e,_0x27c8bc['account'][_0xbf26('0x36')],_0x27c8bc[_0xbf26('0x31')]['id'],!![],_0x56d712,_0x3ac622['id']);if(rpc[_0x27c8bc[_0xbf26('0x2d')]+'QueueReport']){return rpc[_0x27c8bc['channel']+_0xbf26('0x37')]['create'](_0x11080e)[_0xbf26('0x38')](function(_0x4192a9){logger[_0xbf26('0x39')](_0xbf26('0x3a'),_0x4192a9);});}}}function stopRouting(_0xac14f3,_0x45845a,_0x17e8eb,_0x19b180){if(_0xac14f3&&_0x45845a){_0x45845a[_0xbf26('0x27')]-=0x1;var _0x1eceb1={'leaveAt':moment()[_0xbf26('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xbf26('0x14')](_0xbf26('0x29')),'reason':_0xbf26('0x3b')};logger['info'](util[_0xbf26('0x14')](_0xbf26('0x3c'),_0xac14f3,_0x45845a[_0xbf26('0x36')]));emitChannelQueueInteraction(_0x17e8eb[_0xbf26('0x2d')],_0x45845a[_0xbf26('0x36')],_0x17e8eb[_0xbf26('0x28')],_0x17e8eb['account']['name'],_0x17e8eb[_0xbf26('0x31')]['id'],![],_0x19b180,_0x45845a['id']);return rpc[_0x17e8eb[_0xbf26('0x2d')]+_0xbf26('0x3d')][_0xbf26('0x3e')](_0x17e8eb[_0xbf26('0x2f')]['id'],{'queueId':_0x45845a['id']})[_0xbf26('0x3f')](function(){if(rpc[_0x17e8eb[_0xbf26('0x2d')]+_0xbf26('0x37')]){return rpc[_0x17e8eb['channel']+_0xbf26('0x37')][_0xbf26('0x3e')](_0xac14f3,_0x1eceb1)[_0xbf26('0x38')](function(_0x405633){logger[_0xbf26('0x39')](_0xbf26('0x40'),_0x405633);});}});}}function endRouting(_0x1a39d2,_0x3f4dbf,_0x5c3558,_0x2b7854){if(_0x1a39d2&&_0x3f4dbf){_0x3f4dbf[_0xbf26('0x27')]-=0x1;var _0x5e8e18={'leaveAt':moment()[_0xbf26('0x14')](_0xbf26('0x29')),'exitAt':moment()[_0xbf26('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xbf26('0x41')};logger['info'](util['format'](_0xbf26('0x42'),_0x1a39d2,_0x3f4dbf['name']));emitChannelQueueInteraction(_0x5c3558[_0xbf26('0x2d')],_0x3f4dbf[_0xbf26('0x36')],_0x5c3558[_0xbf26('0x28')],_0x5c3558['account'][_0xbf26('0x36')],_0x5c3558['message']['id'],![],_0x2b7854);if(rpc[_0x5c3558['channel']+_0xbf26('0x37')]){return rpc[_0x5c3558[_0xbf26('0x2d')]+_0xbf26('0x37')][_0xbf26('0x3e')](_0x1a39d2,_0x5e8e18)[_0xbf26('0x38')](function(_0x287ddb){logger[_0xbf26('0x39')](_0xbf26('0x40'),_0x287ddb);});}}}function handleFindQueue(_0x44e8b1){return function(_0x5eef8c){return _0x5eef8c[_0xbf26('0x36')][_0xbf26('0x43')]()===_0x44e8b1[_0xbf26('0x43')]();};}exports[_0xbf26('0x44')]=function(_0x2b2e1e,_0x178578,_0x4d8d41,_0x1dc707){return function(_0x57b537){try{var _0x397904={'name':_0x178578[0x0],'timeout':_0x178578[0x1]};var _0x3e9a8b=queue['validate'](_0x397904,{'typecast':!![]});if(_0x3e9a8b[_0xbf26('0x45')]){logger[_0xbf26('0x39')]('[%s][QUEUE]\x20%s',_0x2b2e1e,_[_0xbf26('0x46')](_0x3e9a8b,_0xbf26('0x31'))[_0xbf26('0x47')](',\x20'));_0x57b537[_0xbf26('0x48')]();}else{var _0x11c61e=_['find'](_0x4d8d41[_0x1dc707[_0xbf26('0x2d')]+_0xbf26('0x49')],handleFindQueue(_0x397904[_0xbf26('0x36')]));if(_0x11c61e){startRouting(_0x2b2e1e,_0x11c61e,_0x1dc707,_0x4d8d41);var _0xaa125d=(_0x11c61e[_0xbf26('0x41')]||0xa)*0x3e8;var _0x2f1c24=(_0x397904['timeout']||0x14)*0x3e8;var _0x120de7;if(_0xaa125d>_0x2f1c24){_0x2f1c24=_0xaa125d;}var _0x13fe5e=seqqueue[_0xbf26('0x4a')](_0xaa125d);_0x13fe5e['id']=_0x2b2e1e;_0x13fe5e[_0xbf26('0x4b')]=_0xaa125d;_0x13fe5e[_0xbf26('0x4c')]=_0x2f1c24;_0x13fe5e[_0xbf26('0x2d')]=_0x1dc707[_0xbf26('0x2d')];_0x4d8d41[_0xbf26('0x4d')][_0x2b2e1e]['on'](_0xbf26('0x4e'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2b2e1e);stopRouting(_0x2b2e1e,_0x11c61e,_0x1dc707,_0x4d8d41);clearTimeout(_0x120de7);_0x120de7=undefined;_0x13fe5e[_0xbf26('0x4f')](!![]);if(_0x4d8d41['rules'][_0x2b2e1e]){delete _0x4d8d41['rules'][_0x2b2e1e];}_0x57b537['stop']();});_0x4d8d41['rules'][_0x2b2e1e]['on']('complete',function(){if(_0x4d8d41[_0xbf26('0x4d')][_0x2b2e1e]){delete _0x4d8d41['rules'][_0x2b2e1e];}});_0x120de7=setTimeout(function(){logger[_0xbf26('0x34')](_0xbf26('0x50'),_0x2b2e1e);endRouting(_0x2b2e1e,_0x11c61e,_0x1dc707,_0x4d8d41);clearTimeout(_0x120de7);_0x13fe5e[_0xbf26('0x4f')](!![]);_0x57b537[_0xbf26('0x51')]();},_0x2f1c24);switch(_0x11c61e['strategy']){case _0xbf26('0x52'):strategy['rrmemory'](_0x13fe5e,_0x11c61e,_0x4d8d41,_0x1dc707);break;default:strategy[_0xbf26('0x53')](_0x13fe5e,_0x11c61e,_0x4d8d41,_0x1dc707);}}else{logger[_0xbf26('0x39')](_0xbf26('0x54'),_0x2b2e1e,_0x397904[_0xbf26('0x36')]);_0x57b537[_0xbf26('0x48')]();}}}catch(_0x13286e){logger[_0xbf26('0x39')](_0xbf26('0x55'),_0x2b2e1e,_0x13286e[_0xbf26('0x56')]);_0x57b537['stop']();}};}; \ No newline at end of file +var _0xad26=['QueueReport','catch','create\x20queue\x20report','accepted','info','Interaction','update','then','update\x20queue\x20report','timeout','error','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','atimeout','qtimeout','rules','end','close','complete','next','rrmemory','beepall','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','message','AccountId','name'];(function(_0x197b3b,_0x4beb55){var _0x18a817=function(_0x584285){while(--_0x584285){_0x197b3b['push'](_0x197b3b['shift']());}};_0x18a817(++_0x4beb55);}(_0xad26,0x1b1));var _0x6ad2=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xad26[_0x1969a7];return _0x3d665f;};'use strict';var schema=require(_0x6ad2('0x0'));var _=require(_0x6ad2('0x1'));var util=require(_0x6ad2('0x2'));var seqqueue=require(_0x6ad2('0x3'));var moment=require(_0x6ad2('0x4'));var Redis=require('ioredis');var config=require(_0x6ad2('0x5'));var logger=require(_0x6ad2('0x6'))(_0x6ad2('0x7'));var strategy=require(_0x6ad2('0x8'));config['redis']=_[_0x6ad2('0x9')](config[_0x6ad2('0xa')],{'host':_0x6ad2('0xb'),'port':0x18eb});var io=require(_0x6ad2('0xc'))(new Redis(config[_0x6ad2('0xa')]));var attributes=['id',_0x6ad2('0xd'),_0x6ad2('0xe'),_0x6ad2('0xf'),_0x6ad2('0x10'),'joinAt'];function emit(_0x3c6335,_0x5cd744,_0x149f8c){io['to'](_0x3c6335)['emit'](_0x5cd744,_0x149f8c);}function emitChannelQueueInteraction(_0x2cf794,_0x203926,_0x295358,_0x4c5a23,_0xb0d59b,_0x1f8cca,_0x3170f9,_0x2f134f){var _0x573fdb=_[_0x6ad2('0x11')](_0x295358);_0x573fdb[_0x6ad2('0xd')]=_0x2f134f;_0x573fdb[_0x6ad2('0xf')]=_0x203926;_0x573fdb['account']=_0x4c5a23;_0x573fdb['id']=_0xb0d59b;if(_0x1f8cca){attributes[_0x6ad2('0x12')](_[_0x6ad2('0x13')](_0x2cf794)+_0x6ad2('0x14'));_0x3170f9[util[_0x6ad2('0x15')](_0x6ad2('0x16'),_0x2cf794)][_0xb0d59b]=_['pick'](_0x573fdb,attributes);}else{delete _0x3170f9[util['format'](_0x6ad2('0x16'),_0x2cf794)][_0xb0d59b];}emit(util[_0x6ad2('0x15')](_0x6ad2('0x17'),_0x2cf794,_0x203926),util[_0x6ad2('0x15')](_0x6ad2('0x18'),_0x2cf794,_0x1f8cca?_0x6ad2('0x19'):_0x6ad2('0x1a')),_[_0x6ad2('0x1b')](_0x573fdb,attributes));}var rpc={'openchannelQueueReport':require(_0x6ad2('0x1c')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x6ad2('0x1d')),'smsQueueReport':require(_0x6ad2('0x1e')),'faxQueueReport':require(_0x6ad2('0x1f')),'whatsappQueueReport':require(_0x6ad2('0x20')),'chatInteraction':require(_0x6ad2('0x21')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x6ad2('0x22')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6ad2('0x23')),'whatsappInteraction':require(_0x6ad2('0x24'))};var queue=schema({'name':{'type':_0x6ad2('0x25'),'required':!![],'message':_0x6ad2('0x26')},'timeout':{'type':_0x6ad2('0x27'),'message':_0x6ad2('0x28')}});function startRouting(_0x3ab3b0,_0x47c94b,_0x169531,_0x10f3b9){if(_0x3ab3b0&&_0x47c94b&&_0x169531){_0x47c94b[_0x6ad2('0x29')]+=0x1;var _0x5c36dc={'uniqueid':_0x3ab3b0,'from':_0x169531[_0x6ad2('0x2a')]?_0x169531['body'][_0x6ad2('0x10')]:'','joinAt':moment()[_0x6ad2('0x15')](_0x6ad2('0x2b')),'ContactId':_0x169531[_0x6ad2('0x2c')]?_0x169531[_0x6ad2('0x2c')]['id']:null,'ListId':_0x169531[_0x6ad2('0x2d')]?_0x169531[_0x6ad2('0x2d')]['id']:null};_0x5c36dc[_['upperFirst'](_0x169531[_0x6ad2('0x2e')])+_0x6ad2('0x2f')]=_0x47c94b['id']||null;_0x5c36dc[_[_0x6ad2('0x30')](_0x169531['channel'])+_0x6ad2('0x14')]=_0x169531[_0x6ad2('0x31')]?_0x169531['interaction']['id']:null;_0x5c36dc[_[_0x6ad2('0x30')](_0x169531[_0x6ad2('0x2e')])+'MessageId']=_0x169531[_0x6ad2('0x32')]?_0x169531[_0x6ad2('0x32')]['id']:null;_0x5c36dc[_[_0x6ad2('0x30')](_0x169531[_0x6ad2('0x2e')])+(_0x169531[_0x6ad2('0x2e')]!=='chat'?_0x6ad2('0x33'):'WebsiteId')]=_0x169531['account']?_0x169531[_0x6ad2('0xe')]['id']:null;logger['info'](util[_0x6ad2('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x3ab3b0,_0x47c94b[_0x6ad2('0x34')]));emitChannelQueueInteraction(_0x169531[_0x6ad2('0x2e')],_0x47c94b[_0x6ad2('0x34')],_0x5c36dc,_0x169531[_0x6ad2('0xe')][_0x6ad2('0x34')],_0x169531[_0x6ad2('0x32')]['id'],!![],_0x10f3b9,_0x47c94b['id']);if(rpc[_0x169531[_0x6ad2('0x2e')]+_0x6ad2('0x35')]){return rpc[_0x169531[_0x6ad2('0x2e')]+_0x6ad2('0x35')]['create'](_0x5c36dc)[_0x6ad2('0x36')](function(_0x1177a5){logger['error'](_0x6ad2('0x37'),_0x1177a5);});}}}function stopRouting(_0x1e1440,_0x454ccb,_0x23a7ee,_0x2444ea){if(_0x1e1440&&_0x454ccb){_0x454ccb['waiting']-=0x1;var _0x54d532={'leaveAt':moment()[_0x6ad2('0x15')](_0x6ad2('0x2b')),'acceptAt':moment()['format'](_0x6ad2('0x2b')),'reason':_0x6ad2('0x38')};logger[_0x6ad2('0x39')](util[_0x6ad2('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x1e1440,_0x454ccb[_0x6ad2('0x34')]));emitChannelQueueInteraction(_0x23a7ee['channel'],_0x454ccb[_0x6ad2('0x34')],_0x23a7ee[_0x6ad2('0x2a')],_0x23a7ee[_0x6ad2('0xe')][_0x6ad2('0x34')],_0x23a7ee['message']['id'],![],_0x2444ea,_0x454ccb['id']);return rpc[_0x23a7ee['channel']+_0x6ad2('0x3a')][_0x6ad2('0x3b')](_0x23a7ee['interaction']['id'],{'queueId':_0x454ccb['id']})[_0x6ad2('0x3c')](function(){if(rpc[_0x23a7ee[_0x6ad2('0x2e')]+_0x6ad2('0x35')]){return rpc[_0x23a7ee[_0x6ad2('0x2e')]+'QueueReport'][_0x6ad2('0x3b')](_0x1e1440,_0x54d532)[_0x6ad2('0x36')](function(_0x392c20){logger['error'](_0x6ad2('0x3d'),_0x392c20);});}});}}function endRouting(_0x55ae76,_0x89efe2,_0x256467,_0x5b887b){if(_0x55ae76&&_0x89efe2){_0x89efe2[_0x6ad2('0x29')]-=0x1;var _0x115cf1={'leaveAt':moment()[_0x6ad2('0x15')](_0x6ad2('0x2b')),'exitAt':moment()[_0x6ad2('0x15')](_0x6ad2('0x2b')),'reason':_0x6ad2('0x3e')};logger[_0x6ad2('0x39')](util[_0x6ad2('0x15')]('[%s][END:QUEUE][NAME:%s]',_0x55ae76,_0x89efe2[_0x6ad2('0x34')]));emitChannelQueueInteraction(_0x256467[_0x6ad2('0x2e')],_0x89efe2[_0x6ad2('0x34')],_0x256467['body'],_0x256467['account'][_0x6ad2('0x34')],_0x256467[_0x6ad2('0x32')]['id'],![],_0x5b887b);if(rpc[_0x256467[_0x6ad2('0x2e')]+_0x6ad2('0x35')]){return rpc[_0x256467[_0x6ad2('0x2e')]+_0x6ad2('0x35')][_0x6ad2('0x3b')](_0x55ae76,_0x115cf1)[_0x6ad2('0x36')](function(_0x74a047){logger[_0x6ad2('0x3f')](_0x6ad2('0x3d'),_0x74a047);});}}}function handleFindQueue(_0xb7dbe9){return function(_0x41bc14){return _0x41bc14[_0x6ad2('0x34')][_0x6ad2('0x40')]()===_0xb7dbe9['toLowerCase']();};}exports[_0x6ad2('0x41')]=function(_0x4f06d2,_0x39bfe7,_0x11d3de,_0x480d2d){return function(_0x343e6b){try{var _0x4cd550={'name':_0x39bfe7[0x0],'timeout':_0x39bfe7[0x1]};var _0x169610=queue[_0x6ad2('0x0')](_0x4cd550,{'typecast':!![]});if(_0x169610[_0x6ad2('0x42')]){logger[_0x6ad2('0x3f')](_0x6ad2('0x43'),_0x4f06d2,_[_0x6ad2('0x44')](_0x169610,'message')[_0x6ad2('0x45')](',\x20'));_0x343e6b[_0x6ad2('0x46')]();}else{var _0x2f515a=_['find'](_0x11d3de[_0x480d2d[_0x6ad2('0x2e')]+'Queues'],handleFindQueue(_0x4cd550[_0x6ad2('0x34')]));if(_0x2f515a){startRouting(_0x4f06d2,_0x2f515a,_0x480d2d,_0x11d3de);var _0x8b16bf=(_0x2f515a[_0x6ad2('0x3e')]||0xa)*0x3e8;var _0x55d063=(_0x4cd550[_0x6ad2('0x3e')]||0x14)*0x3e8;var _0x24b129;if(_0x8b16bf>_0x55d063){_0x55d063=_0x8b16bf;}var _0x21ba4b=seqqueue['createQueue'](_0x8b16bf);_0x21ba4b['id']=_0x4f06d2;_0x21ba4b[_0x6ad2('0x47')]=_0x8b16bf;_0x21ba4b[_0x6ad2('0x48')]=_0x55d063;_0x21ba4b['channel']=_0x480d2d['channel'];_0x11d3de[_0x6ad2('0x49')][_0x4f06d2]['on'](_0x6ad2('0x4a'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4f06d2);stopRouting(_0x4f06d2,_0x2f515a,_0x480d2d,_0x11d3de);clearTimeout(_0x24b129);_0x24b129=undefined;_0x21ba4b[_0x6ad2('0x4b')](!![]);if(_0x11d3de['rules'][_0x4f06d2]){delete _0x11d3de[_0x6ad2('0x49')][_0x4f06d2];}_0x343e6b['stop']();});_0x11d3de[_0x6ad2('0x49')][_0x4f06d2]['on'](_0x6ad2('0x4c'),function(){if(_0x11d3de[_0x6ad2('0x49')][_0x4f06d2]){delete _0x11d3de['rules'][_0x4f06d2];}});_0x24b129=setTimeout(function(){logger[_0x6ad2('0x39')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4f06d2);endRouting(_0x4f06d2,_0x2f515a,_0x480d2d,_0x11d3de);clearTimeout(_0x24b129);_0x21ba4b[_0x6ad2('0x4b')](!![]);_0x343e6b[_0x6ad2('0x4d')]();},_0x55d063);switch(_0x2f515a['strategy']){case _0x6ad2('0x4e'):strategy['rrmemory'](_0x21ba4b,_0x2f515a,_0x11d3de,_0x480d2d);break;default:strategy[_0x6ad2('0x4f')](_0x21ba4b,_0x2f515a,_0x11d3de,_0x480d2d);}}else{logger[_0x6ad2('0x3f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4f06d2,_0x4cd550[_0x6ad2('0x34')]);_0x343e6b[_0x6ad2('0x46')]();}}}catch(_0x25ff87){logger[_0x6ad2('0x3f')](_0x6ad2('0x43'),_0x4f06d2,_0x25ff87[_0x6ad2('0x50')]);_0x343e6b[_0x6ad2('0x46')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 0189e25..9749caf 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb903=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','handleRun','bind','handleTimeout','handleDrained','push','debug','isNil','realtime','agents','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','RINGING',':FORCED'];(function(_0x25cf99,_0x5e5af6){var _0x3f0813=function(_0x2ab189){while(--_0x2ab189){_0x25cf99['push'](_0x25cf99['shift']());}};_0x3f0813(++_0x5e5af6);}(_0xb903,0x185));var _0x3b90=function(_0x5a074c,_0x6e15f6){_0x5a074c=_0x5a074c-0x0;var _0x2c568e=_0xb903[_0x5a074c];return _0x2c568e;};'use strict';var _=require(_0x3b90('0x0'));var uuid=require(_0x3b90('0x1'));var util=require(_0x3b90('0x2'));var logger=require(_0x3b90('0x3'))('routing');var Agent=function(_0x3312ca,_0xf414f4,_0x3b024a,_0x1cd5d8){this[_0x3b90('0x4')]=uuid['v4']();this[_0x3b90('0x5')]=_0x3312ca;this[_0x3b90('0x6')]=_0xf414f4;this['realtime']=_0x3b024a;this[_0x3b90('0x7')]=_0x1cd5d8;this['squeue']['push'](this[_0x3b90('0x8')][_0x3b90('0x9')](this),this[_0x3b90('0xa')][_0x3b90('0x9')](this));this['squeue']['on']('timeout',this['handleTimeout']['bind'](this));this['squeue']['on']('drained',this[_0x3b90('0xb')][_0x3b90('0x9')](this));};Agent['prototype'][_0x3b90('0xc')]=function(){this[_0x3b90('0x5')]['push'](this[_0x3b90('0x8')][_0x3b90('0x9')](this),this[_0x3b90('0xa')]['bind'](this));};Agent['prototype'][_0x3b90('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x3b90('0x8')]=function(){logger[_0x3b90('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x3b90('0x6')]['id']);if(_[_0x3b90('0xe')](this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);setTimeout(this['push'][_0x3b90('0x9')](this),0x3e8);}else{if(this[_0x3b90('0x7')][_0x3b90('0x11')]||util[_0x3b90('0x12')](this['squeue']['id'],this[_0x3b90('0xf')]['agents'][this[_0x3b90('0x6')]['id']],this[_0x3b90('0x5')]['channel'],![])){this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x13')]=!![];this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x14')]=undefined;util[_0x3b90('0x15')](this[_0x3b90('0xf')],this['routing'],this[_0x3b90('0x6')],this[_0x3b90('0x5')][_0x3b90('0x16')]);util[_0x3b90('0x17')](this[_0x3b90('0x4')],this[_0x3b90('0x5')]['id'],this['realtime']['agents'][this[_0x3b90('0x6')]['id']],null,this[_0x3b90('0x7')]);util[_0x3b90('0x18')](this[_0x3b90('0x5')]['id'],this['realtime'][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']],_0x3b90('0x19')+(this['routing'][_0x3b90('0x11')]?_0x3b90('0x1a'):''));}else{logger[_0x3b90('0xd')](_0x3b90('0x1b'),this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);setTimeout(this['push'][_0x3b90('0x9')](this),0x3e8);}}};Agent['prototype'][_0x3b90('0xa')]=function(_0x9891e4){if(_[_0x3b90('0xe')](this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']])){return logger[_0x3b90('0xd')](_0x3b90('0x1c'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x3b90('0xd')](_0x3b90('0x1d'),this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x3b90('0x5')]['id'],this[_0x3b90('0xf')][_0x3b90('0x10')][this['agent']['id']],null,this[_0x3b90('0x7')]);this['realtime']['agents'][this[_0x3b90('0x6')]['id']][_0x3b90('0x13')]=![];this['realtime'][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x14')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x3b90('0x7')],this[_0x3b90('0x6')],this[_0x3b90('0x5')][_0x3b90('0x16')]);util['writeLog'](this['squeue']['id'],this[_0x3b90('0xf')][_0x3b90('0x10')][this['agent']['id']],_0x9891e4?'STOP':_0x3b90('0x1e'));}if(!_0x9891e4){setTimeout(this[_0x3b90('0xc')][_0x3b90('0x9')](this),0x3e8);}};function agent(_0x298df6,_0x5a3266,_0x2154e2,_0x583842){return new Agent(_0x298df6,_0x5a3266,_0x2154e2,_0x583842);}module[_0x3b90('0x1f')]=agent; \ No newline at end of file +var _0x4b19=['agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','agent','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','debug','realtime'];(function(_0x206147,_0x5814d4){var _0x499a80=function(_0x1d3052){while(--_0x1d3052){_0x206147['push'](_0x206147['shift']());}};_0x499a80(++_0x5814d4);}(_0x4b19,0x195));var _0x94b1=function(_0x53936c,_0xe0b01e){_0x53936c=_0x53936c-0x0;var _0x358501=_0x4b19[_0x53936c];return _0x358501;};'use strict';var _=require(_0x94b1('0x0'));var uuid=require('uuid');var util=require(_0x94b1('0x1'));var logger=require(_0x94b1('0x2'))(_0x94b1('0x3'));var Agent=function(_0x577f52,_0x1ffdb7,_0x3648ad,_0x2240b9){this['notificationId']=uuid['v4']();this[_0x94b1('0x4')]=_0x577f52;this[_0x94b1('0x5')]=_0x1ffdb7;this['realtime']=_0x3648ad;this[_0x94b1('0x3')]=_0x2240b9;this[_0x94b1('0x4')]['push'](this[_0x94b1('0x6')][_0x94b1('0x7')](this),this[_0x94b1('0x8')]['bind'](this));this[_0x94b1('0x4')]['on']('timeout',this['handleTimeout'][_0x94b1('0x7')](this));this[_0x94b1('0x4')]['on'](_0x94b1('0x9'),this[_0x94b1('0xa')][_0x94b1('0x7')](this));};Agent[_0x94b1('0xb')]['push']=function(){this[_0x94b1('0x4')][_0x94b1('0xc')](this[_0x94b1('0x6')][_0x94b1('0x7')](this),this['handleTimeout']['bind'](this));};Agent[_0x94b1('0xb')][_0x94b1('0xa')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x94b1('0x6')]=function(){logger[_0x94b1('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x94b1('0x4')]['id'],this['agent']['id']);if(_['isNil'](this[_0x94b1('0xe')][_0x94b1('0xf')][this[_0x94b1('0x5')]['id']])){logger[_0x94b1('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x94b1('0x4')]['id'],this[_0x94b1('0x5')]['id']);setTimeout(this[_0x94b1('0xc')][_0x94b1('0x7')](this),0x3e8);}else{if(this[_0x94b1('0x3')][_0x94b1('0x10')]||util[_0x94b1('0x11')](this['squeue']['id'],this[_0x94b1('0xe')][_0x94b1('0xf')][this[_0x94b1('0x5')]['id']],this['squeue'][_0x94b1('0x12')],![])){this[_0x94b1('0xe')]['agents'][this[_0x94b1('0x5')]['id']][_0x94b1('0x13')]=!![];this[_0x94b1('0xe')][_0x94b1('0xf')][this[_0x94b1('0x5')]['id']][_0x94b1('0x14')]=undefined;util[_0x94b1('0x15')](this[_0x94b1('0xe')],this[_0x94b1('0x3')],this[_0x94b1('0x5')],this['squeue'][_0x94b1('0x12')]);util[_0x94b1('0x16')](this[_0x94b1('0x17')],this['squeue']['id'],this[_0x94b1('0xe')]['agents'][this[_0x94b1('0x5')]['id']],null,this[_0x94b1('0x3')]);util[_0x94b1('0x18')](this[_0x94b1('0x4')]['id'],this['realtime']['agents'][this[_0x94b1('0x5')]['id']],'RINGING'+(this[_0x94b1('0x3')]['forcedOwnership']?_0x94b1('0x19'):''));}else{logger[_0x94b1('0xd')](_0x94b1('0x1a'),this['squeue']['id'],this[_0x94b1('0x5')]['id']);setTimeout(this[_0x94b1('0xc')][_0x94b1('0x7')](this),0x3e8);}}};Agent[_0x94b1('0xb')][_0x94b1('0x8')]=function(_0x43b67c){if(_[_0x94b1('0x1b')](this[_0x94b1('0xe')][_0x94b1('0xf')][this['agent']['id']])){return logger[_0x94b1('0xd')](_0x94b1('0x1c'),this['squeue']['id'],this[_0x94b1('0x5')]['id']);}else{logger[_0x94b1('0xd')](_0x94b1('0x1d'),this[_0x94b1('0x4')]['id'],this[_0x94b1('0x5')]['id']);util[_0x94b1('0x1e')](this['notificationId'],this[_0x94b1('0x4')]['id'],this['realtime'][_0x94b1('0xf')][this['agent']['id']],null,this['routing']);this[_0x94b1('0xe')][_0x94b1('0xf')][this[_0x94b1('0x5')]['id']][_0x94b1('0x13')]=![];this[_0x94b1('0xe')][_0x94b1('0xf')][this[_0x94b1('0x5')]['id']][_0x94b1('0x14')]=undefined;util[_0x94b1('0x1f')](this[_0x94b1('0xe')],this[_0x94b1('0x3')],this[_0x94b1('0x5')],this['squeue']['channel']);util[_0x94b1('0x18')](this[_0x94b1('0x4')]['id'],this[_0x94b1('0xe')][_0x94b1('0xf')][this[_0x94b1('0x5')]['id']],_0x43b67c?_0x94b1('0x20'):_0x94b1('0x21'));}if(!_0x43b67c){setTimeout(this[_0x94b1('0xc')][_0x94b1('0x7')](this),0x3e8);}};function agent(_0x586eaa,_0x173bec,_0x4d18e8,_0x1e759a){return new Agent(_0x586eaa,_0x173bec,_0x4d18e8,_0x1e759a);}module[_0x94b1('0x22')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 5b7499d..270fdba 100644 --- a/server/services/routing/server/applications/strategy/beepall.js +++ b/server/services/routing/server/applications/strategy/beepall.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e38=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','writeLog','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','uuid','./util','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','isNil','Agents','length','debug'];(function(_0x4dc7eb,_0xde9423){var _0x3c6bbf=function(_0x524b8d){while(--_0x524b8d){_0x4dc7eb['push'](_0x4dc7eb['shift']());}};_0x3c6bbf(++_0xde9423);}(_0x0e38,0xe7));var _0x80e3=function(_0x5c45bb,_0x3b3d5a){_0x5c45bb=_0x5c45bb-0x0;var _0x367a30=_0x0e38[_0x5c45bb];return _0x367a30;};'use strict';var _=require('lodash');var uuid=require(_0x80e3('0x0'));var util=require(_0x80e3('0x1'));var logger=require('../../../../../config/logger')(_0x80e3('0x2'));var Beepall=function(_0x58e0e1,_0x259fb6,_0x4b3eb5,_0x3af33a){this[_0x80e3('0x3')]=uuid['v4']();this[_0x80e3('0x4')]=_0x58e0e1;this[_0x80e3('0x5')]=_0x259fb6;this[_0x80e3('0x6')]=_0x4b3eb5;this[_0x80e3('0x2')]=_0x3af33a;this['squeue'][_0x80e3('0x7')](this[_0x80e3('0x8')][_0x80e3('0x9')](this),this[_0x80e3('0xa')]['bind'](this));this[_0x80e3('0x4')]['on'](_0x80e3('0xb'),this[_0x80e3('0xa')]['bind'](this));this['squeue']['on']('drained',this['handleDrained']['bind'](this));};Beepall[_0x80e3('0xc')][_0x80e3('0x7')]=function(){this[_0x80e3('0x4')]['push'](this['handleRun']['bind'](this),this[_0x80e3('0xa')][_0x80e3('0x9')](this));};Beepall['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0x80e3('0x8')]=function(){var _0x4d0d02=!![];if(!_[_0x80e3('0xd')](this[_0x80e3('0x5')])&&!_['isNil'](this[_0x80e3('0x5')][_0x80e3('0xe')])&&this[_0x80e3('0x5')][_0x80e3('0xe')]['length']>0x0){for(var _0x30ae1c=0x0,_0x55fe62;_0x30ae1c0x0){for(var _0x91f28d=0x0,_0x4a98a3;_0x91f28d0x0&&_0x2b0594[_0x5d69e2+_0x1e8b('0x24')]>=_0x2b0594[_0x5d69e2+'Capacity']){writeLog(_0x4b5b99,_0x2b0594,_0x5d69e2[_0x1e8b('0x25')]()+_0x1e8b('0x26'));return![];}}return!![];};exports[_0x1e8b('0x27')]=function(_0x2a19de,_0x30752e,_0x11c47d,_0xf87247,_0x3ec8cc){return sendNotification(!![],_0x2a19de,_0x30752e,_0x11c47d,_0xf87247,_0x3ec8cc);};exports['hideNotification']=function(_0x310632,_0x578c80,_0x1a10ff,_0xee783a,_0x3a04f0){return sendNotification(![],_0x310632,_0x578c80,_0x1a10ff,_0xee783a,_0x3a04f0);};exports['checkWaitingNotifications']=function(_0x30bcfd,_0x3d9908,_0x5e1699){var _0x960fa0=_0x3d9908[_0x1e8b('0x28')]['UserId'];if(!_0x960fa0&&_0x5e1699){_0x960fa0=_0x5e1699['id'];}var _0x58704b=_[_0x1e8b('0x29')](_0x30bcfd[_0x3d9908['channel']+'QueuesWaitingInteractions'],function(_0x50ba3f){var _0x57f017=_[_0x1e8b('0x2a')](_0x3d9908[_0x1e8b('0x2b')])+_0x1e8b('0x2c');return _0x50ba3f[_0x57f017]===_0x3d9908[_0x1e8b('0x28')]['id'];});if(!_0x58704b&&_0x960fa0&&_0x30bcfd['agents'][_0x960fa0]){_0x58704b=_[_0x1e8b('0x29')](_0x30bcfd[_0x1e8b('0x2d')][_0x960fa0][_0x3d9908[_0x1e8b('0x2b')]+_0x1e8b('0x2e')],function(_0xcb76ad){return _0xcb76ad['id']===_0x3d9908[_0x1e8b('0x28')]['id'];});}return _0x58704b;};exports['saveWaitingNotification']=function(_0x53ffff,_0x5b8088,_0x1532ca,_0x5e8098){if(_0x1532ca&&_0x1532ca['id']&&_0x53ffff[_0x1e8b('0x2d')]&&_0x53ffff[_0x1e8b('0x2d')][_0x1532ca['id']]){_0x53ffff['agents'][_0x1532ca['id']][_0x5e8098+'WaitingInteractions'][_0x5b8088['message']['id']]={'id':_0x5b8088['interaction']['id']};}};exports[_0x1e8b('0x2f')]=function(_0x2531a2,_0x704af6,_0x40a0f3,_0x5d8e82){if(_0x40a0f3&&_0x40a0f3['id']&&_0x2531a2['agents']&&_0x2531a2[_0x1e8b('0x2d')][_0x40a0f3['id']]){delete _0x2531a2[_0x1e8b('0x2d')][_0x40a0f3['id']][_0x5d8e82+_0x1e8b('0x2e')][_0x704af6[_0x1e8b('0x15')]['id']];}};exports[_0x1e8b('0x30')]=writeLog; \ No newline at end of file +var _0x3f2e=['saveWaitingNotification','removeWaitingNotification','WaitingInteractions','writeLog','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','message','user:%s','emit','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','some','capitalize','agents'];(function(_0x315898,_0x49adc8){var _0x41272b=function(_0x568162){while(--_0x568162){_0x315898['push'](_0x315898['shift']());}};_0x41272b(++_0x49adc8);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x27efcf,_0x320952){_0x27efcf=_0x27efcf-0x0;var _0xdb0237=_0x3f2e[_0x27efcf];return _0xdb0237;};'use strict';var _=require(_0xe3f2('0x0'));var util=require('util');var utils=require(_0xe3f2('0x1'));var Redis=require(_0xe3f2('0x2'));var config=require(_0xe3f2('0x3'));var logger=require(_0xe3f2('0x4'))(_0xe3f2('0x5'));config[_0xe3f2('0x6')]=_[_0xe3f2('0x7')](config['redis'],{'host':_0xe3f2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe3f2('0x6')]));function sendNotification(_0x2d6460,_0x4fc4d9,_0x48aafe,_0x55e8f8,_0x1840c1,_0x42771b){var _0x970d48=_0x42771b||{};var _0x342b60=_0x48aafe['split']('.');var _0x47a12e={'uniqueid':_0x4fc4d9,'channel':_0x342b60[0x0],'id':_0x342b60[0x1],'title':_0x342b60[0x0]+_0xe3f2('0x9'),'interactionId':_0x342b60[0x2],'queue':_0x1840c1?_0x1840c1[_0xe3f2('0xa')]:null,'sound':_0x970d48[_0xe3f2('0xb')][_0xe3f2('0xc')],'shake':_0x970d48[_0xe3f2('0xb')][_0xe3f2('0xd')]};try{if(!_0x970d48[_0xe3f2('0xe')]){_0x970d48[_0xe3f2('0xe')]={};}if(_0x1840c1){_0x970d48[_0xe3f2('0xe')][_0xe3f2('0xf')]=_0x1840c1;}else if(_0x970d48[_0xe3f2('0xe')][_0xe3f2('0xf')]){delete _0x970d48[_0xe3f2('0xe')]['queue'];}_0x47a12e[_0xe3f2('0x10')]=utils[_0xe3f2('0x11')](_0x970d48[_0xe3f2('0xb')]['notificationTemplate'],_0x970d48);}catch(_0x5492e7){_0x47a12e['msg']=_0xe3f2('0x12');logger['error'](util[_0xe3f2('0x13')](_0xe3f2('0x14'),_0x4fc4d9,_0x5492e7[_0xe3f2('0x15')]));}io['to'](util['format'](_0xe3f2('0x16'),_0x55e8f8[_0xe3f2('0xa')]))[_0xe3f2('0x17')](util[_0xe3f2('0x13')](_0xe3f2('0x18'),_0x2d6460?_0xe3f2('0x19'):'remove'),_0x47a12e);}function writeLog(_0x1ba0f2,_0x43086c,_0x317451){return logger[_0xe3f2('0x1a')](util[_0xe3f2('0x13')](_0xe3f2('0x1b'),_0x1ba0f2,_0x43086c[_0xe3f2('0xa')],_0x317451));}exports[_0xe3f2('0x1c')]=function(_0x175ce8,_0x5c0d1e,_0x4d39a3,_0x5e2200){if(_0x5c0d1e[_0xe3f2('0x1d')]){writeLog(_0x175ce8,_0x5c0d1e,_0xe3f2('0x1e'));return![];}if(!_0x5c0d1e[_0xe3f2('0x1f')]){writeLog(_0x175ce8,_0x5c0d1e,_0xe3f2('0x20'));return![];}if(_0x5c0d1e[_0x4d39a3+_0xe3f2('0x21')]){writeLog(_0x175ce8,_0x5c0d1e,_0xe3f2('0x22'));return![];}if(_0x5e2200&&_0x5c0d1e[_0xe3f2('0x23')](_0x4d39a3+_0xe3f2('0x24'))&&_0x5c0d1e[_0xe3f2('0x23')](_0x4d39a3+_0xe3f2('0x25'))){if(_0x5c0d1e[_0x4d39a3+'Capacity']>0x0&&_0x5c0d1e[_0x4d39a3+'CurrentCapacity']>=_0x5c0d1e[_0x4d39a3+'Capacity']){writeLog(_0x175ce8,_0x5c0d1e,_0x4d39a3[_0xe3f2('0x26')]()+_0xe3f2('0x27'));return![];}}return!![];};exports[_0xe3f2('0x28')]=function(_0x707e52,_0x501563,_0x2a185e,_0x4a19ba,_0x1e2865){return sendNotification(!![],_0x707e52,_0x501563,_0x2a185e,_0x4a19ba,_0x1e2865);};exports[_0xe3f2('0x29')]=function(_0x3ae9d7,_0x19784f,_0x5def04,_0x2d1bce,_0xc72a6){return sendNotification(![],_0x3ae9d7,_0x19784f,_0x5def04,_0x2d1bce,_0xc72a6);};exports[_0xe3f2('0x2a')]=function(_0x31b25a,_0x193ad6,_0x3735ca){var _0x4d9ee7=_0x193ad6[_0xe3f2('0x2b')]['UserId'];if(!_0x4d9ee7&&_0x3735ca){_0x4d9ee7=_0x3735ca['id'];}var _0x26b671=_[_0xe3f2('0x2c')](_0x31b25a[_0x193ad6['channel']+'QueuesWaitingInteractions'],function(_0x3b6d00){var _0x533649=_[_0xe3f2('0x2d')](_0x193ad6['channel'])+'InteractionId';return _0x3b6d00[_0x533649]===_0x193ad6[_0xe3f2('0x2b')]['id'];});if(!_0x26b671&&_0x4d9ee7&&_0x31b25a['agents'][_0x4d9ee7]){_0x26b671=_[_0xe3f2('0x2c')](_0x31b25a[_0xe3f2('0x2e')][_0x4d9ee7][_0x193ad6['channel']+'WaitingInteractions'],function(_0x12d644){return _0x12d644['id']===_0x193ad6[_0xe3f2('0x2b')]['id'];});}return _0x26b671;};exports[_0xe3f2('0x2f')]=function(_0x107a91,_0x5f6657,_0x671a41,_0x344295){if(_0x671a41&&_0x671a41['id']&&_0x107a91[_0xe3f2('0x2e')]&&_0x107a91['agents'][_0x671a41['id']]){_0x107a91[_0xe3f2('0x2e')][_0x671a41['id']][_0x344295+'WaitingInteractions'][_0x5f6657['message']['id']]={'id':_0x5f6657[_0xe3f2('0x2b')]['id']};}};exports[_0xe3f2('0x30')]=function(_0xa07aac,_0x7f3bb,_0x8ff806,_0x16cbd7){if(_0x8ff806&&_0x8ff806['id']&&_0xa07aac[_0xe3f2('0x2e')]&&_0xa07aac[_0xe3f2('0x2e')][_0x8ff806['id']]){delete _0xa07aac[_0xe3f2('0x2e')][_0x8ff806['id']][_0x16cbd7+_0xe3f2('0x31')][_0x7f3bb[_0xe3f2('0x15')]['id']];}};exports[_0xe3f2('0x32')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index bec49f3..c0a8630 100644 --- a/server/services/routing/server/applications/system.js +++ b/server/services/routing/server/applications/system.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdff5=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join'];(function(_0x450536,_0x18f463){var _0x359f6f=function(_0x578b6e){while(--_0x578b6e){_0x450536['push'](_0x450536['shift']());}};_0x359f6f(++_0x18f463);}(_0xdff5,0x100));var _0x5dff=function(_0x25e65d,_0x522103){_0x25e65d=_0x25e65d-0x0;var _0x309fc4=_0xdff5[_0x25e65d];return _0x309fc4;};'use strict';var schema=require('validate');var sh=require(_0x5dff('0x0'));var _=require(_0x5dff('0x1'));var utils=require(_0x5dff('0x2'));var logger=require(_0x5dff('0x3'))(_0x5dff('0x4'));var system=schema({'command':{'type':_0x5dff('0x5'),'required':!![],'message':_0x5dff('0x6')}});exports[_0x5dff('0x7')]=function(_0x2b7fd2,_0x16cff8){return function(_0x307342){try{var _0x490fdd={'command':_0x16cff8[0x0]};var _0x5999bc=system[_0x5dff('0x8')](_0x490fdd,{'typecast':!![]});if(_0x5999bc['length']){logger[_0x5dff('0x9')](_0x5dff('0xa'),_0x2b7fd2,_[_0x5dff('0xb')](_0x5999bc,_0x5dff('0xc'))[_0x5dff('0xd')](',\x20'));logger['info'](_0x5dff('0xe'),_0x2b7fd2);_0x307342[_0x5dff('0xf')]();}else{var _0x5895ff=this;var _0xc9d0f8=utils['getMustacheRender'](_0x16cff8[0x0],this);logger[_0x5dff('0x10')](_0x5dff('0x11'),_0x2b7fd2,_0xc9d0f8);sh[_0x5dff('0x12')](_[_0x5dff('0x13')](_0xc9d0f8),function(_0x30bf47,_0x3e7a95){logger[_0x5dff('0x10')](_0x5dff('0x14'),_0x2b7fd2,_0x30bf47);if(_0x30bf47==0x0){var _0xa68b46=_0x3e7a95[_0x5dff('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x5dff('0x16')](_0x16cff8[0x1])||_['isEmpty'](_0x16cff8[0x1])){logger[_0x5dff('0x10')](_0x5dff('0x17'),_0x2b7fd2);_0x5895ff['body'][_0x16cff8[0x1]]=_0xa68b46;}else{logger[_0x5dff('0x10')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2b7fd2,_0x16cff8[0x1],_0xa68b46);_0x5895ff[_0x5dff('0x18')][_0x16cff8[0x1]]=_0xa68b46;}}_0x307342['next']();});}}catch(_0x383c9c){logger[_0x5dff('0x9')]('[%s][SYSTEM]\x20%s',_0x2b7fd2,_[_0x5dff('0x19')](_0x383c9c)?JSON[_0x5dff('0x1a')](_0x383c9c):_0x383c9c);logger[_0x5dff('0x10')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2b7fd2);_0x307342[_0x5dff('0xf')]();}};}; \ No newline at end of file +var _0xb821=['[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','routing','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb821,0xa7));var _0x1b82=function(_0x922da8,_0x2e355c){_0x922da8=_0x922da8-0x0;var _0x572242=_0xb821[_0x922da8];return _0x572242;};'use strict';var schema=require('validate');var sh=require(_0x1b82('0x0'));var _=require(_0x1b82('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x1b82('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1b82('0x3')]=function(_0x1403ab,_0x3fadf0){return function(_0x26db32){try{var _0x597ca7={'command':_0x3fadf0[0x0]};var _0x3e27c4=system[_0x1b82('0x4')](_0x597ca7,{'typecast':!![]});if(_0x3e27c4[_0x1b82('0x5')]){logger[_0x1b82('0x6')](_0x1b82('0x7'),_0x1403ab,_[_0x1b82('0x8')](_0x3e27c4,_0x1b82('0x9'))[_0x1b82('0xa')](',\x20'));logger[_0x1b82('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1403ab);_0x26db32[_0x1b82('0xc')]();}else{var _0x30c6ee=this;var _0x44dfd4=utils[_0x1b82('0xd')](_0x3fadf0[0x0],this);logger[_0x1b82('0xb')](_0x1b82('0xe'),_0x1403ab,_0x44dfd4);sh[_0x1b82('0xf')](_[_0x1b82('0x10')](_0x44dfd4),function(_0x5f521f,_0x46007e){logger[_0x1b82('0xb')](_0x1b82('0x11'),_0x1403ab,_0x5f521f);if(_0x5f521f==0x0){var _0x61b6eb=_0x46007e['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x1b82('0x12')](_0x3fadf0[0x1])||_['isEmpty'](_0x3fadf0[0x1])){logger['info'](_0x1b82('0x13'),_0x1403ab);_0x30c6ee['body'][_0x3fadf0[0x1]]=_0x61b6eb;}else{logger[_0x1b82('0xb')](_0x1b82('0x14'),_0x1403ab,_0x3fadf0[0x1],_0x61b6eb);_0x30c6ee['body'][_0x3fadf0[0x1]]=_0x61b6eb;}}_0x26db32[_0x1b82('0xc')]();});}}catch(_0x5dab7d){logger['error'](_0x1b82('0x7'),_0x1403ab,_['isObject'](_0x5dab7d)?JSON[_0x1b82('0x15')](_0x5dab7d):_0x5dab7d);logger[_0x1b82('0xb')](_0x1b82('0x16'),_0x1403ab);_0x26db32['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index eb1ba0f..b8601bd 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb4d=['length','error','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x826377,_0x5916ec){var _0x19563b=function(_0x327b00){while(--_0x327b00){_0x826377['push'](_0x826377['shift']());}};_0x19563b(++_0x5916ec);}(_0xcb4d,0x109));var _0xdcb4=function(_0x53e21e,_0x3f1178){_0x53e21e=_0x53e21e-0x0;var _0x459d4b=_0xcb4d[_0x53e21e];return _0x459d4b;};'use strict';var schema=require(_0xdcb4('0x0'));var _=require(_0xdcb4('0x1'));var rpc={'chatInteraction':require(_0xdcb4('0x2')),'openchannelInteraction':require(_0xdcb4('0x3')),'smsInteraction':require(_0xdcb4('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xdcb4('0x5')),'whatsappInteraction':require(_0xdcb4('0x6'))};var logger=require('../../../../config/logger')(_0xdcb4('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xdcb4('0x8')}});exports[_0xdcb4('0x9')]=function(_0x42164a,_0x2e3ca4,_0x4a7c2f,_0x1f93d8){return function(_0x282277){try{var _0x395607={'tag':_0x2e3ca4[0x0]};var _0x15a251=tag['validate'](_0x395607,{'typecast':!![]});if(_0x15a251[_0xdcb4('0xa')]){logger[_0xdcb4('0xb')]('[%s][TAG]\x20%s',_0x42164a,_['map'](_0x15a251,_0xdcb4('0xc'))['join'](',\x20'));logger['info'](_0xdcb4('0xd'),_0x42164a);_0x282277[_0xdcb4('0xe')]();}else{var _0x451c66={'ids':[_0x2e3ca4[0x0]]};if(rpc[_0x1f93d8[_0xdcb4('0xf')]+_0xdcb4('0x10')]){rpc[_0x1f93d8[_0xdcb4('0xf')]+'Interaction'][_0xdcb4('0x11')](_0x1f93d8[_0xdcb4('0x12')]['id'],_0x451c66)['then'](function(_0x3d3a12){logger[_0xdcb4('0x13')](_0xdcb4('0x14'),_0x42164a,_0x2e3ca4[0x1],_0x1f93d8[_0xdcb4('0xf')],_0x1f93d8['interaction']['id']);})[_0xdcb4('0x15')](function(_0x4a0bf5){logger[_0xdcb4('0xb')](_0xdcb4('0x16'),_0x42164a,JSON[_0xdcb4('0x17')](_0x4a0bf5));logger[_0xdcb4('0x13')](_0xdcb4('0xd'),_0x42164a);})['finally'](function(){_0x282277[_0xdcb4('0xe')]();});}}}catch(_0x358bbc){logger['error'](_0xdcb4('0x16'),_0x42164a,_[_0xdcb4('0x18')](_0x358bbc)?JSON[_0xdcb4('0x17')](_0x358bbc):_0x358bbc);logger[_0xdcb4('0x13')](_0xdcb4('0xd'),_0x42164a);_0x282277[_0xdcb4('0xe')]();}};}; \ No newline at end of file +var _0xfd59=['routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x28e601,_0x2fb321){var _0x3857df=function(_0x5628c7){while(--_0x5628c7){_0x28e601['push'](_0x28e601['shift']());}};_0x3857df(++_0x2fb321);}(_0xfd59,0xe8));var _0x9fd5=function(_0x5c8f94,_0x3d264a){_0x5c8f94=_0x5c8f94-0x0;var _0x4cc523=_0xfd59[_0x5c8f94];return _0x4cc523;};'use strict';var schema=require(_0x9fd5('0x0'));var _=require(_0x9fd5('0x1'));var rpc={'chatInteraction':require(_0x9fd5('0x2')),'openchannelInteraction':require(_0x9fd5('0x3')),'smsInteraction':require(_0x9fd5('0x4')),'mailInteraction':require(_0x9fd5('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x9fd5('0x6'))};var logger=require(_0x9fd5('0x7'))(_0x9fd5('0x8'));var tag=schema({'tag':{'type':_0x9fd5('0x9'),'required':!![],'message':_0x9fd5('0xa')}});exports[_0x9fd5('0xb')]=function(_0x5b7f84,_0x1c2c67,_0x2546cd,_0x22384e){return function(_0x306e3f){try{var _0x15f199={'tag':_0x1c2c67[0x0]};var _0x31c48e=tag[_0x9fd5('0x0')](_0x15f199,{'typecast':!![]});if(_0x31c48e[_0x9fd5('0xc')]){logger[_0x9fd5('0xd')](_0x9fd5('0xe'),_0x5b7f84,_[_0x9fd5('0xf')](_0x31c48e,_0x9fd5('0x10'))[_0x9fd5('0x11')](',\x20'));logger[_0x9fd5('0x12')](_0x9fd5('0x13'),_0x5b7f84);_0x306e3f[_0x9fd5('0x14')]();}else{var _0x631717={'ids':[_0x1c2c67[0x0]]};if(rpc[_0x22384e[_0x9fd5('0x15')]+_0x9fd5('0x16')]){rpc[_0x22384e['channel']+_0x9fd5('0x16')][_0x9fd5('0x17')](_0x22384e[_0x9fd5('0x18')]['id'],_0x631717)[_0x9fd5('0x19')](function(_0x1d739b){logger['info'](_0x9fd5('0x1a'),_0x5b7f84,_0x1c2c67[0x1],_0x22384e['channel'],_0x22384e[_0x9fd5('0x18')]['id']);})['catch'](function(_0x133b0f){logger[_0x9fd5('0xd')]('[%s][TAG]\x20%s',_0x5b7f84,JSON['stringify'](_0x133b0f));logger[_0x9fd5('0x12')](_0x9fd5('0x13'),_0x5b7f84);})[_0x9fd5('0x1b')](function(){_0x306e3f[_0x9fd5('0x14')]();});}}}catch(_0x592ec1){logger[_0x9fd5('0xd')](_0x9fd5('0xe'),_0x5b7f84,_[_0x9fd5('0x1c')](_0x592ec1)?JSON[_0x9fd5('0x1d')](_0x592ec1):_0x592ec1);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5b7f84);_0x306e3f[_0x9fd5('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 7b42d9f..e2b38ec 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd32a=['channelId=','&serviceId=','&data=','then','info','stop','error','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login','params','POST','application/json-rpc','parse','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0xd32a,0x19e));var _0xad32=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xd32a[_0x36884e];return _0x1cc367;};'use strict';var rp=require(_0xad32('0x0'));var logger=require('../../../../config/logger')(_0xad32('0x1'));var _=require(_0xad32('0x2'));var arr=[];exports[_0xad32('0x3')]=function(_0x42380e,_0xb0df33){return function(_0x2df2ce){var _0x1e01b7=_0xb0df33[0xa];var _0x473ad1=_0xb0df33[0xb];var _0x822289=_0xb0df33[0xc];var _0x1d6f84=_0xb0df33[0xd];var _0x2c9801=_0xb0df33[0xe];var _0x38b468=_0xb0df33[0xf]['replace'](/\n/g,_0xad32('0x4'));var _0xdfc5dc=_0xb0df33[0x10][_0xad32('0x5')](/\n/g,'\x20');if(!arr[_0xad32('0x6')](_0x473ad1)){arr[_0xad32('0x7')](_0x473ad1);var _0x21806f=_0xb0df33[0x3];var _0x49b62a=_0xb0df33[0x4];var _0x535324=_0xb0df33[0x1];var _0xebf857=_0xb0df33[0x0];var _0x319392={};_0x319392[_0xad32('0x8')]=_0xb0df33[0x8]+_0xad32('0x9')+_0x822289+'|'+_0x1e01b7+'|'+_0x1d6f84+'|'+_0x473ad1+'|'+_0x2c9801;_0x319392[_0xad32('0xa')]=_0xb0df33[0x7]+'?params='+_0x822289+'|'+_0x1e01b7+'|'+_0x1d6f84+'|'+_0x473ad1+'|'+_0x2c9801+'|'+_0x38b468+'|'+_0xdfc5dc;_0x319392['title']=_0xb0df33[0x9];var _0x3d5c12={};_0x3d5c12[_0xad32('0xb')]=_0xad32('0xc');_0x3d5c12[_0xad32('0xd')]=_0xad32('0xe');var _0x29055b=[];_0x29055b[_0xad32('0x7')](_0xb0df33[0x2]);_0x29055b[_0xad32('0x7')](_0xb0df33[0x5]);_0x29055b['push'](_0xb0df33[0x6]);_0x3d5c12[_0xad32('0xf')]=_0x29055b;_0x3d5c12['id']=0x1;var _0x51ffdf=JSON['stringify'](_0x3d5c12);var _0x556326={'encoding':'utf8','method':_0xad32('0x10'),'timeout':0x2710,'url':_0x21806f,'headers':{'Content-Type':_0xad32('0x11')},'body':_0x51ffdf};return rp(_0x556326)['then'](function(_0x323aa7){const _0x4ddc10=JSON[_0xad32('0x12')](_0x323aa7);if(!_0x4ddc10['result']['logged']){throw new Error(_0xad32('0x13'));}var _0x3d0f30=_0x473ad1;var _0x691979=_0xad32('0x14')+_0x535324+_0xad32('0x15')+_0xebf857+'&sessionId='+_0x3d0f30+_0xad32('0x16')+JSON['stringify'](_0x319392);var _0x390338=_0x49b62a+'?'+_0x691979;return rp(_0x390338);})[_0xad32('0x17')](function(_0x1c9a77){logger[_0xad32('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x42380e,_0x1c9a77);_0x2df2ce[_0xad32('0x19')]();})['catch'](function(_0x321b9c){logger[_0xad32('0x1a')]('[%s][TVOX]\x20%s',_0x42380e,_[_0xad32('0x1b')](_0x321b9c)?JSON[_0xad32('0x1c')](_0x321b9c):_0x321b9c);_0x2df2ce[_0xad32('0x19')]();});}else{logger[_0xad32('0x18')](_0xad32('0x1d'),_0x42380e);_0x2df2ce[_0xad32('0x1e')]();}};}; \ No newline at end of file +var _0x47ad=['stop','catch','error','isObject','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','?params=','urlOnRing','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s'];(function(_0x153537,_0x277d38){var _0x42b5cd=function(_0x16f18a){while(--_0x16f18a){_0x153537['push'](_0x153537['shift']());}};_0x42b5cd(++_0x277d38);}(_0x47ad,0x10d));var _0xd47a=function(_0x483e77,_0x433e9b){_0x483e77=_0x483e77-0x0;var _0x359df0=_0x47ad[_0x483e77];return _0x359df0;};'use strict';var rp=require(_0xd47a('0x0'));var logger=require(_0xd47a('0x1'))(_0xd47a('0x2'));var _=require(_0xd47a('0x3'));var arr=[];exports['consequence']=function(_0x1a640a,_0x23a9eb){return function(_0x528afc){var _0x40eb70=_0x23a9eb[0xa];var _0x4301b8=_0x23a9eb[0xb];var _0xf3b882=_0x23a9eb[0xc];var _0xe674f4=_0x23a9eb[0xd];var _0x283a9b=_0x23a9eb[0xe];var _0x4dd762=_0x23a9eb[0xf][_0xd47a('0x4')](/\n/g,_0xd47a('0x5'));var _0x117eac=_0x23a9eb[0x10][_0xd47a('0x4')](/\n/g,'\x20');if(!arr[_0xd47a('0x6')](_0x4301b8)){arr[_0xd47a('0x7')](_0x4301b8);var _0x5da41d=_0x23a9eb[0x3];var _0x5d85fc=_0x23a9eb[0x4];var _0x4b5868=_0x23a9eb[0x1];var _0x2ee543=_0x23a9eb[0x0];var _0xd72165={};_0xd72165['urlOnAnswer']=_0x23a9eb[0x8]+_0xd47a('0x8')+_0xf3b882+'|'+_0x40eb70+'|'+_0xe674f4+'|'+_0x4301b8+'|'+_0x283a9b;_0xd72165[_0xd47a('0x9')]=_0x23a9eb[0x7]+_0xd47a('0x8')+_0xf3b882+'|'+_0x40eb70+'|'+_0xe674f4+'|'+_0x4301b8+'|'+_0x283a9b+'|'+_0x4dd762+'|'+_0x117eac;_0xd72165['title']=_0x23a9eb[0x9];var _0x574ec6={};_0x574ec6['jsonrpc']=_0xd47a('0xa');_0x574ec6[_0xd47a('0xb')]=_0xd47a('0xc');var _0x2053b8=[];_0x2053b8['push'](_0x23a9eb[0x2]);_0x2053b8['push'](_0x23a9eb[0x5]);_0x2053b8[_0xd47a('0x7')](_0x23a9eb[0x6]);_0x574ec6[_0xd47a('0xd')]=_0x2053b8;_0x574ec6['id']=0x1;var _0x38cdff=JSON[_0xd47a('0xe')](_0x574ec6);var _0x1268d3={'encoding':_0xd47a('0xf'),'method':_0xd47a('0x10'),'timeout':0x2710,'url':_0x5da41d,'headers':{'Content-Type':_0xd47a('0x11')},'body':_0x38cdff};return rp(_0x1268d3)[_0xd47a('0x12')](function(_0x97f51e){const _0xc2212e=JSON[_0xd47a('0x13')](_0x97f51e);if(!_0xc2212e[_0xd47a('0x14')][_0xd47a('0x15')]){throw new Error(_0xd47a('0x16'));}var _0x9866cf=_0x4301b8;var _0x217b9d=_0xd47a('0x17')+_0x4b5868+_0xd47a('0x18')+_0x2ee543+'&sessionId='+_0x9866cf+_0xd47a('0x19')+JSON[_0xd47a('0xe')](_0xd72165);var _0x261349=_0x5d85fc+'?'+_0x217b9d;return rp(_0x261349);})['then'](function(_0x2b1bc2){logger[_0xd47a('0x1a')](_0xd47a('0x1b'),_0x1a640a,_0x2b1bc2);_0x528afc[_0xd47a('0x1c')]();})[_0xd47a('0x1d')](function(_0x555847){logger[_0xd47a('0x1e')]('[%s][TVOX]\x20%s',_0x1a640a,_[_0xd47a('0x1f')](_0x555847)?JSON['stringify'](_0x555847):_0x555847);_0x528afc['stop']();});}else{logger[_0xd47a('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x1a640a);_0x528afc[_0xd47a('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 17ea867..c1c8352 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x5359a1,_0x59042d){var _0x3f389d=function(_0x10c652){while(--_0x10c652){_0x5359a1['push'](_0x5359a1['shift']());}};_0x3f389d(++_0x59042d);}(_0xe706,0xa3));var _0x6e70=function(_0x551906,_0x569941){_0x551906=_0x551906-0x0;var _0x58bfb6=_0xe706[_0x551906];return _0x58bfb6;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x118e89,_0x23c2f4){var _0x6f77f7=function(_0x178550){while(--_0x178550){_0x118e89['push'](_0x118e89['shift']());}};_0x6f77f7(++_0x23c2f4);}(_0xe706,0xa3));var _0x6e70=function(_0xecc93b,_0xc0dab9){_0xecc93b=_0xecc93b-0x0;var _0x5b1795=_0xe706[_0xecc93b];return _0x5b1795;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 46347e4..5db57fc 100644 --- a/server/services/routing/server/index.js +++ b/server/services/routing/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27fb=['condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','catch','stack','busy','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','push','slice','dialogflow','dialogflowv2','split','amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval'];(function(_0x507e70,_0xffb184){var _0x2dee23=function(_0x3cd7c9){while(--_0x3cd7c9){_0x507e70['push'](_0x507e70['shift']());}};_0x2dee23(++_0xffb184);}(_0x27fb,0x1de));var _0xb27f=function(_0x58fa9f,_0x5a4566){_0x58fa9f=_0x58fa9f-0x0;var _0x239fc5=_0x27fb[_0x58fa9f];return _0x239fc5;};'use strict';var _=require(_0xb27f('0x0'));var util=require(_0xb27f('0x1'));var path=require(_0xb27f('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xb27f('0x3'));var utils=require('./applications/utils');var sUtils=require(_0xb27f('0x4'));var logger=require(_0xb27f('0x5'))(_0xb27f('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xb27f('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xb27f('0x8')),'faxQueueReport':require(_0xb27f('0x9')),'whatsappQueueReport':require(_0xb27f('0xa'))};var RuleEngine=require(_0xb27f('0xb'));function getId(_0x608e92,_0x4da129,_0xb18d3b){return util[_0xb27f('0xc')]('%s.%s.%s',_0x608e92,_0x4da129||0x0,_0xb18d3b||0x0);}function getIntervals(_0x338393,_0x1f0c1d){var _0x76123b=[];if(!_[_0xb27f('0xd')](_0x1f0c1d['IntervalId'])&&!_[_0xb27f('0xd')](_0x338393[_0x1f0c1d[_0xb27f('0xe')]])&&!_['isNil'](_0x338393[_0x1f0c1d[_0xb27f('0xe')]][_0xb27f('0xf')])){_0x76123b=_['map'](_0x338393[_0x1f0c1d[_0xb27f('0xe')]][_0xb27f('0xf')],_0xb27f('0x10'));}else if(!_[_0xb27f('0xd')](_0x1f0c1d[_0xb27f('0x10')])){_0x76123b=[_0x1f0c1d[_0xb27f('0x10')]];}return _0x76123b;}exports['listen']=function(_0x434e15){_0x434e15['rules']={};return new BPromise(function(_0x1bc3b3,_0x511af3){var _0x35cb70={'Start':function(_0x2c9fb9){var _0x24dd7b=this;return new Promise(function(_0x11155b,_0x33520b){if(_0x2c9fb9){try{var _0x5eb8e5=[];var _0x2d179c=getId(_0x2c9fb9[_0xb27f('0x11')],_0x2c9fb9[_0xb27f('0x12')]?_0x2c9fb9[_0xb27f('0x12')]['id']:0x0,_0x2c9fb9[_0xb27f('0x13')]?_0x2c9fb9[_0xb27f('0x13')]['id']:0x0);var _0x428a86=sUtils['checkWaitingNotifications'](_0x434e15,_0x2c9fb9);if(_0x2c9fb9[_0xb27f('0x14')]||!_0x428a86&&_0x2c9fb9[_0xb27f('0x15')]&&_[_0xb27f('0x16')](_0x2c9fb9['applications'])&&_0x2c9fb9[_0xb27f('0x15')][_0xb27f('0x17')]){for(var _0x5930d8=0x0;_0x5930d8<_0x2c9fb9[_0xb27f('0x15')][_0xb27f('0x17')];_0x5930d8+=0x1){var _0x34b5ae=_0x2c9fb9[_0xb27f('0x15')][_0x5930d8];if(fs[_0xb27f('0x18')](path[_0xb27f('0x19')](__dirname,_0xb27f('0x15'),_0x34b5ae['app']+_0xb27f('0x1a')))){var _0x5303ac=[];switch(_0x34b5ae[_0xb27f('0x1b')][_0xb27f('0x1c')]()){case _0xb27f('0x1d'):var _0x56e3cd=_0x34b5ae[_0xb27f('0x1e')]['split'](',');if(_0x2c9fb9[_0xb27f('0x11')]==='mail'){_0x5303ac['push'](_0x56e3cd[0x0]);_0x5303ac[_0xb27f('0x1f')](_0x56e3cd[0x1]);_0x5303ac[_0xb27f('0x1f')](_0x56e3cd[_0xb27f('0x20')](0x2,_0x56e3cd[_0xb27f('0x17')])['join'](','));}else{_0x5303ac[_0xb27f('0x1f')](_0x56e3cd[0x0]);_0x5303ac[_0xb27f('0x1f')](_0x56e3cd[_0xb27f('0x20')](0x1,_0x56e3cd['length'])[_0xb27f('0x19')](','));}break;case _0xb27f('0x21'):var _0x432a75=_0x34b5ae[_0xb27f('0x1e')]['split'](',');_0x5303ac[_0xb27f('0x1f')](_0x432a75[0x0]);_0x5303ac['push'](_0x432a75[0x1]);_0x5303ac[_0xb27f('0x1f')](_0x432a75[_0xb27f('0x20')](0x2,_0x432a75['length'])['join'](','));break;case _0xb27f('0x22'):var _0x4a3f05=_0x34b5ae[_0xb27f('0x1e')][_0xb27f('0x23')](',');_0x5303ac[_0xb27f('0x1f')](_0x4a3f05[0x0]);_0x5303ac[_0xb27f('0x1f')](_0x4a3f05[0x1]);_0x5303ac['push'](_0x4a3f05[0x2]);_0x5303ac[_0xb27f('0x1f')](_0x4a3f05[0x3]);_0x5303ac[_0xb27f('0x1f')](_0x4a3f05[_0xb27f('0x20')](0x4,_0x4a3f05[_0xb27f('0x17')])[_0xb27f('0x19')](','));break;case _0xb27f('0x24'):var _0x1b0e69=_0x34b5ae[_0xb27f('0x1e')][_0xb27f('0x23')](',');_0x5303ac[_0xb27f('0x1f')](_0x1b0e69[0x0]);_0x5303ac[_0xb27f('0x1f')](_0x1b0e69[0x1]);_0x5303ac[_0xb27f('0x1f')](_0x1b0e69[0x2]);_0x5303ac[_0xb27f('0x1f')](_0x1b0e69[0x3]);_0x5303ac[_0xb27f('0x1f')](_0x1b0e69[_0xb27f('0x20')](0x4,_0x1b0e69[_0xb27f('0x17')])['join'](','));break;case'message':_0x5303ac[_0xb27f('0x1f')](_0x34b5ae['appdata']);break;case _0xb27f('0x25'):_0x5303ac['push'](_0x34b5ae[_0xb27f('0x26')]);_0x5303ac['push'](_0x34b5ae[_0xb27f('0x1e')]);break;case _0xb27f('0x27'):var _0xa0441e=utils['getMustacheRender'](_0x2c9fb9[_0xb27f('0x28')][_0xb27f('0x29')],_0x2c9fb9);var _0x5c5153=_0x34b5ae[_0xb27f('0x1e')][_0xb27f('0x23')](',');_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0x0]);_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0x1]);_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0x2]);_0x5303ac['push'](_0x5c5153[0x3]);_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0x4]);_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0x5]);_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0x6]);_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0x7]);_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0x8]);_0x5303ac['push'](_0x5c5153[0x9]);_0x5303ac[_0xb27f('0x1f')](_0x5c5153[0xa]);_0x5303ac['push'](_0x2c9fb9[_0xb27f('0x13')]['id']);_0x5303ac[_0xb27f('0x1f')](_0x2c9fb9[_0xb27f('0x12')]['id']);_0x5303ac['push'](_0x34b5ae[_0xb27f('0x2a')]);_0x5303ac[_0xb27f('0x1f')](_0x2c9fb9['interaction'][_0xb27f('0x2b')]);_0x5303ac['push'](_0x2c9fb9[_0xb27f('0x2c')]['body']);_0x5303ac[_0xb27f('0x1f')](_0xa0441e);break;default:_0x5303ac=_['isNil'](_0x34b5ae['appdata'])?[]:_0x34b5ae[_0xb27f('0x1e')][_0xb27f('0x23')](',');}var _0x43a054={'id':util[_0xb27f('0xc')](_0xb27f('0x2d'),_0x2d179c,_0x34b5ae['id'],_0x34b5ae[_0xb27f('0x1b')]),'condition':require(_0xb27f('0x2e'))[_0xb27f('0x2f')](_0x2d179c,getIntervals(_0x434e15['intervals'],_0x34b5ae),_0x434e15),'consequence':require(_0xb27f('0x30')+_0x34b5ae[_0xb27f('0x1b')])[_0xb27f('0x31')](_0x2d179c,_0x5303ac,_0x434e15,_0x2c9fb9),'p':_0x34b5ae[_0xb27f('0x32')]||0x0};logger[_0xb27f('0x33')](_0xb27f('0x34'),_0x43a054['id'],_0xb27f('0x35'),getIntervals(_0x434e15['intervals'],_0x34b5ae)['join'](_0xb27f('0x36')));_0x5eb8e5['push'](_0x43a054);}else{logger['error'](_0xb27f('0x37'),path['join'](__dirname,_0xb27f('0x15'),_0x34b5ae['app']+_0xb27f('0x1a')));}}_0x434e15[_0xb27f('0x38')][_0x2d179c]=new RuleEngine(_0x5eb8e5);_0x434e15[_0xb27f('0x38')][_0x2d179c][_0xb27f('0x39')](_0x2c9fb9,function(_0x54a51d){logger[_0xb27f('0x33')](_0xb27f('0x3a'),JSON[_0xb27f('0x3b')](_0x54a51d[_0xb27f('0x3c')]));if(_0x434e15[_0xb27f('0x38')][_0x2d179c]){_0x434e15[_0xb27f('0x38')][_0x2d179c][_0xb27f('0x3d')](_0xb27f('0x3e'));}});return _0x11155b({'code':0xc8,'message':_0x2c9fb9});}else{if(_0x428a86){logger[_0xb27f('0x33')](util[_0xb27f('0xc')](_0xb27f('0x3f'),_0x2d179c));}else{logger['info'](_0xb27f('0x40'));}return _0x11155b({'code':0xc8,'message':_0x2c9fb9});}}catch(_0x59ca7d){logger[_0xb27f('0x41')](_0x59ca7d['stack']);return _0x33520b(_0x24dd7b['error'](0x1f4,_0x59ca7d));}}return _0x33520b(_0xb27f('0x42'));});},'AcceptMessage':function(_0x492c7b){var _0x1e1712=this;return new Promise(function(_0x2f503d,_0x417f44){if(_0x492c7b[_0xb27f('0x43')]&&_0x492c7b['agent']['id']){if(_0x434e15[_0xb27f('0x44')][_0x492c7b[_0xb27f('0x43')]['id']]){_0x434e15[_0xb27f('0x44')][_0x492c7b[_0xb27f('0x43')]['id']]['busy']=![];_0x434e15[_0xb27f('0x44')][_0x492c7b[_0xb27f('0x43')]['id']]['busyQueue']=undefined;}}if(_0x492c7b[_0xb27f('0x12')]&&_0x492c7b[_0xb27f('0x12')]['id']){try{var _0x3d2fe1=getId(_0x492c7b[_0xb27f('0x11')],_0x492c7b[_0xb27f('0x12')]?_0x492c7b[_0xb27f('0x12')]['id']:0x0,_0x492c7b[_0xb27f('0x13')]?_0x492c7b[_0xb27f('0x13')]['id']:0x0);if(_0x434e15['rules'][_0x3d2fe1]){_0x434e15[_0xb27f('0x38')][_0x3d2fe1][_0xb27f('0x3d')](_0xb27f('0x45'));if(rpc[_0x492c7b[_0xb27f('0x11')]+_0xb27f('0x46')]){rpc[_0x492c7b[_0xb27f('0x11')]+_0xb27f('0x46')][_0xb27f('0x47')](_0x3d2fe1,{'UserId':_0x492c7b[_0xb27f('0x12')][_0xb27f('0x48')]})[_0xb27f('0x49')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x2f503d({'code':0xc8,'message':_0x492c7b});}catch(_0x1dfafa){logger['error'](_0x1dfafa[_0xb27f('0x4a')]);return _0x417f44(_0x1e1712[_0xb27f('0x41')](0x1f4,_0x1dfafa));}}logger[_0xb27f('0x41')]('message\x20is\x20empty');return _0x417f44(_0x1e1712['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5f2960){var _0x117533=this;return new Promise(function(_0x207d46,_0x3d1af9){if(_0x5f2960['agent']&&_0x5f2960[_0xb27f('0x43')]['id']){try{if(_0x434e15[_0xb27f('0x44')][_0x5f2960['agent']['id']]){_0x434e15[_0xb27f('0x44')][_0x5f2960['agent']['id']][_0xb27f('0x4b')]=![];_0x434e15[_0xb27f('0x44')][_0x5f2960[_0xb27f('0x43')]['id']][_0xb27f('0x4c')]=undefined;}return _0x207d46({'code':0xc8,'message':_0x5f2960});}catch(_0x314f81){logger[_0xb27f('0x41')](_0x314f81['stack']);return _0x3d1af9(_0x117533[_0xb27f('0x41')](0x1f4,_0x314f81));}}logger[_0xb27f('0x41')]('message\x20is\x20empty');return _0x3d1af9(_0x117533[_0xb27f('0x41')](0x1f4,_0xb27f('0x4d')));});},'AbandonInteraction':function(_0x2faa4c){var _0x4ee051=this;return new Promise(function(_0x134a2e,_0x41997d){if(_0x2faa4c['channel']&&_0x2faa4c['interaction']&&_0x2faa4c[_0xb27f('0x13')]['id']){try{var _0x502d3c=getId(_0x2faa4c[_0xb27f('0x11')],_0x2faa4c['message']?_0x2faa4c[_0xb27f('0x12')]['id']:0x0,_0x2faa4c[_0xb27f('0x13')]?_0x2faa4c[_0xb27f('0x13')]['id']:0x0);if(_0x434e15[_0xb27f('0x38')][_0x502d3c]){_0x434e15[_0xb27f('0x38')][_0x502d3c][_0xb27f('0x3d')](_0xb27f('0x45'));}return _0x134a2e({'code':0xc8,'message':_0x2faa4c});}catch(_0x158e68){logger[_0xb27f('0x41')](_0x158e68[_0xb27f('0x4a')]);return _0x41997d(_0x4ee051[_0xb27f('0x41')](0x1f4,_0x158e68));}}logger[_0xb27f('0x41')](_0xb27f('0x4d'));return _0x41997d(_0x4ee051['error'](0x1f4,_0xb27f('0x4d')));});},'AgentCapacity':function(_0x35a47f){var _0x47f7b9=this;return new Promise(function(_0x5488ef,_0x4e8680){if(_0x434e15[_0xb27f('0x44')][_0xb27f('0x4e')](_0x35a47f['id'])){for(var _0x1163e0 in _0x35a47f[_0xb27f('0x4f')]){if(_0x35a47f[_0xb27f('0x4f')][_0xb27f('0x4e')](_0x1163e0)){if(_0x434e15[_0xb27f('0x44')][_0x35a47f['id']][_0xb27f('0x4e')](_0x1163e0+_0xb27f('0x50'))){_0x434e15['agents'][_0x35a47f['id']][_0x1163e0+_0xb27f('0x50')]=parseInt(_0x35a47f[_0xb27f('0x4f')][_0x1163e0],0xa);}}}_0x434e15['agents'][_0x35a47f['id']][_0xb27f('0x51')]();return _0x5488ef({'code':0xc8,'message':_0x434e15['agents'][_0x35a47f['id']]});}else{return _0x4e8680(_0x47f7b9[_0xb27f('0x41')](0x1f4,_0xb27f('0x52')));}});},'Agents':function(_0xd072c5){return new Promise(function(_0x5f4356){var _0x2e8d45=_['values'](_0x434e15['agents']);if(_0xd072c5&&_0xd072c5['id']){var _0x58b359=_[_0xb27f('0x53')](_0x2e8d45,function(_0x2c133e){return _0x2c133e['id']===_0xd072c5['id'];});_0x5f4356(_0x58b359);}else{_0x5f4356({'count':_0x2e8d45[_0xb27f('0x17')],'rows':_0x2e8d45});}});},'ChatQueues':function(){return new Promise(function(_0x4033c2){var _0x17019d=[];for(var _0x36dea0 in _0x434e15[_0xb27f('0x54')]){if(_0x434e15[_0xb27f('0x54')]['hasOwnProperty'](_0x36dea0)){var _0x23a805=_0x434e15[_0xb27f('0x54')][_0x36dea0];var _0x57e946={'id':_0x23a805['id'],'available':_0x23a805[_0xb27f('0x55')],'loggedIn':_0x23a805['loggedIn'],'name':_0x23a805[_0xb27f('0x56')],'paused':_0x23a805[_0xb27f('0x57')],'waiting':_0x23a805['waiting']};_0x17019d['push'](_0x57e946);}}_0x4033c2({'count':_0x17019d['length'],'rows':_0x17019d});});},'MailQueues':function(){return new Promise(function(_0x2b199a){var _0x540b4b=[];for(var _0x1d38de in _0x434e15[_0xb27f('0x58')]){if(_0x434e15[_0xb27f('0x58')][_0xb27f('0x4e')](_0x1d38de)){var _0x362a59=_0x434e15[_0xb27f('0x58')][_0x1d38de];var _0x4e7a42={'id':_0x362a59['id'],'available':_0x362a59[_0xb27f('0x55')],'loggedIn':_0x362a59[_0xb27f('0x59')],'name':_0x362a59[_0xb27f('0x56')],'paused':_0x362a59['paused'],'waiting':_0x362a59[_0xb27f('0x5a')]};_0x540b4b[_0xb27f('0x1f')](_0x4e7a42);}}_0x2b199a({'count':_0x540b4b[_0xb27f('0x17')],'rows':_0x540b4b});});},'OpenchannelQueues':function(){return new Promise(function(_0x3d9d10){var _0xae2c3a=[];for(var _0x526c07 in _0x434e15[_0xb27f('0x5b')]){if(_0x434e15[_0xb27f('0x5b')][_0xb27f('0x4e')](_0x526c07)){var _0x5ae301=_0x434e15['openchannelQueues'][_0x526c07];var _0x5bbbf7={'id':_0x5ae301['id'],'available':_0x5ae301[_0xb27f('0x55')],'loggedIn':_0x5ae301[_0xb27f('0x59')],'name':_0x5ae301[_0xb27f('0x56')],'paused':_0x5ae301['paused'],'waiting':_0x5ae301[_0xb27f('0x5a')]};_0xae2c3a['push'](_0x5bbbf7);}}_0x3d9d10({'count':_0xae2c3a['length'],'rows':_0xae2c3a});});},'SmsQueues':function(){return new Promise(function(_0x250eb7){var _0x4f083c=[];for(var _0xa55cd0 in _0x434e15['smsQueues']){if(_0x434e15[_0xb27f('0x5c')][_0xb27f('0x4e')](_0xa55cd0)){var _0x16a5f8=_0x434e15[_0xb27f('0x5c')][_0xa55cd0];var _0x5bc1b3={'id':_0x16a5f8['id'],'available':_0x16a5f8['available'],'loggedIn':_0x16a5f8[_0xb27f('0x59')],'name':_0x16a5f8['name'],'paused':_0x16a5f8[_0xb27f('0x57')],'waiting':_0x16a5f8['waiting']};_0x4f083c[_0xb27f('0x1f')](_0x5bc1b3);}}_0x250eb7({'count':_0x4f083c[_0xb27f('0x17')],'rows':_0x4f083c});});},'FaxQueues':function(){return new Promise(function(_0x32312a){var _0x18eb75=[];for(var _0x421ffc in _0x434e15['faxQueues']){if(_0x434e15[_0xb27f('0x5d')][_0xb27f('0x4e')](_0x421ffc)){var _0x16ae58=_0x434e15[_0xb27f('0x5d')][_0x421ffc];var _0x3343d6={'id':_0x16ae58['id'],'available':_0x16ae58[_0xb27f('0x55')],'loggedIn':_0x16ae58[_0xb27f('0x59')],'name':_0x16ae58['name'],'paused':_0x16ae58[_0xb27f('0x57')],'waiting':_0x16ae58[_0xb27f('0x5a')]};_0x18eb75[_0xb27f('0x1f')](_0x3343d6);}}_0x32312a({'count':_0x18eb75['length'],'rows':_0x18eb75});});},'WhatsappQueues':function(){return new Promise(function(_0x4c9260){var _0x495e63=[];for(var _0x575325 in _0x434e15[_0xb27f('0x5e')]){if(_0x434e15[_0xb27f('0x5e')][_0xb27f('0x4e')](_0x575325)){var _0x565dc7=_0x434e15[_0xb27f('0x5e')][_0x575325];var _0x4d02f0={'id':_0x565dc7['id'],'available':_0x565dc7['available'],'loggedIn':_0x565dc7[_0xb27f('0x59')],'name':_0x565dc7[_0xb27f('0x56')],'paused':_0x565dc7[_0xb27f('0x57')],'waiting':_0x565dc7[_0xb27f('0x5a')]};_0x495e63[_0xb27f('0x1f')](_0x4d02f0);}}_0x4c9260({'count':_0x495e63[_0xb27f('0x17')],'rows':_0x495e63});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x199b18){var _0x5a0f64=_['values'](_0x434e15[_0xb27f('0x5f')]);_0x199b18({'count':_0x5a0f64[_0xb27f('0x17')],'rows':_0x5a0f64});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2303ab){var _0x5134bd=_[_0xb27f('0x60')](_0x434e15[_0xb27f('0x61')]);_0x2303ab({'count':_0x5134bd[_0xb27f('0x17')],'rows':_0x5134bd});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xd2ddd4){var _0x2e91ee=_['values'](_0x434e15['openchannelQueuesWaitingInteractions']);_0xd2ddd4({'count':_0x2e91ee[_0xb27f('0x17')],'rows':_0x2e91ee});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2be9f1){var _0x41d020=_[_0xb27f('0x60')](_0x434e15[_0xb27f('0x62')]);_0x2be9f1({'count':_0x41d020[_0xb27f('0x17')],'rows':_0x41d020});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4e1a12){var _0x55b472=_[_0xb27f('0x60')](_0x434e15[_0xb27f('0x63')]);_0x4e1a12({'count':_0x55b472['length'],'rows':_0x55b472});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x54bb5c){var _0x495b29=_[_0xb27f('0x60')](_0x434e15[_0xb27f('0x64')]);_0x54bb5c({'count':_0x495b29[_0xb27f('0x17')],'rows':_0x495b29});});}};var _0x16dde6=jayson[_0xb27f('0x65')](_0x35cb70)['http']();_0x16dde6['on']('error',function(_0x3c0a6a){logger[_0xb27f('0x41')](JSON[_0xb27f('0x3b')](_0x3c0a6a));return _0x511af3(_0x3c0a6a);});_0x16dde6[_0xb27f('0x66')](0x232c,_0xb27f('0x67'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x1bc3b3(_0xb27f('0x68')+0x232c);});});}; \ No newline at end of file +var _0xd85e=['chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','routing','../rpc/openchannelQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','notificationTemplate','ContactId','body','./interval','condition','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','emit','complete','format','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find'];(function(_0x595e06,_0x5e5a1c){var _0x2f9795=function(_0x360c39){while(--_0x360c39){_0x595e06['push'](_0x595e06['shift']());}};_0x2f9795(++_0x5e5a1c);}(_0xd85e,0x72));var _0xed85=function(_0x40e0ff,_0x5ad439){_0x40e0ff=_0x40e0ff-0x0;var _0x3f9c24=_0xd85e[_0x40e0ff];return _0x3f9c24;};'use strict';var _=require(_0xed85('0x0'));var util=require(_0xed85('0x1'));var path=require(_0xed85('0x2'));var fs=require('fs');var jayson=require(_0xed85('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')(_0xed85('0x4'));var rpc={'openchannelQueueReport':require(_0xed85('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xed85('0x6')),'whatsappQueueReport':require(_0xed85('0x7'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x801c9c,_0x1c1543,_0x25fe72){return util['format'](_0xed85('0x8'),_0x801c9c,_0x1c1543||0x0,_0x25fe72||0x0);}function getIntervals(_0x4c1f31,_0x4b6a4a){var _0x3cc7fb=[];if(!_[_0xed85('0x9')](_0x4b6a4a[_0xed85('0xa')])&&!_['isNil'](_0x4c1f31[_0x4b6a4a['IntervalId']])&&!_[_0xed85('0x9')](_0x4c1f31[_0x4b6a4a['IntervalId']][_0xed85('0xb')])){_0x3cc7fb=_['map'](_0x4c1f31[_0x4b6a4a[_0xed85('0xa')]][_0xed85('0xb')],_0xed85('0xc'));}else if(!_[_0xed85('0x9')](_0x4b6a4a[_0xed85('0xc')])){_0x3cc7fb=[_0x4b6a4a[_0xed85('0xc')]];}return _0x3cc7fb;}exports[_0xed85('0xd')]=function(_0x381602){_0x381602[_0xed85('0xe')]={};return new BPromise(function(_0x192793,_0x296a1c){var _0x252005={'Start':function(_0x483df6){var _0x5d1e72=this;return new Promise(function(_0x22d294,_0x428469){if(_0x483df6){try{var _0x54d71a=[];var _0x31212d=getId(_0x483df6[_0xed85('0xf')],_0x483df6[_0xed85('0x10')]?_0x483df6[_0xed85('0x10')]['id']:0x0,_0x483df6[_0xed85('0x11')]?_0x483df6[_0xed85('0x11')]['id']:0x0);var _0x234c55=sUtils[_0xed85('0x12')](_0x381602,_0x483df6);if(_0x483df6[_0xed85('0x13')]||!_0x234c55&&_0x483df6['applications']&&_['isArray'](_0x483df6[_0xed85('0x14')])&&_0x483df6['applications'][_0xed85('0x15')]){for(var _0x2396cb=0x0;_0x2396cb<_0x483df6['applications'][_0xed85('0x15')];_0x2396cb+=0x1){var _0x322fb2=_0x483df6['applications'][_0x2396cb];if(fs['existsSync'](path[_0xed85('0x16')](__dirname,_0xed85('0x14'),_0x322fb2[_0xed85('0x17')]+_0xed85('0x18')))){var _0x32663f=[];switch(_0x322fb2[_0xed85('0x17')][_0xed85('0x19')]()){case _0xed85('0x1a'):var _0x4769fb=_0x322fb2[_0xed85('0x1b')][_0xed85('0x1c')](',');if(_0x483df6['channel']===_0xed85('0x1d')){_0x32663f[_0xed85('0x1e')](_0x4769fb[0x0]);_0x32663f[_0xed85('0x1e')](_0x4769fb[0x1]);_0x32663f[_0xed85('0x1e')](_0x4769fb[_0xed85('0x1f')](0x2,_0x4769fb[_0xed85('0x15')])['join'](','));}else{_0x32663f[_0xed85('0x1e')](_0x4769fb[0x0]);_0x32663f[_0xed85('0x1e')](_0x4769fb[_0xed85('0x1f')](0x1,_0x4769fb[_0xed85('0x15')])['join'](','));}break;case _0xed85('0x20'):var _0x2e4e7e=_0x322fb2[_0xed85('0x1b')]['split'](',');_0x32663f[_0xed85('0x1e')](_0x2e4e7e[0x0]);_0x32663f[_0xed85('0x1e')](_0x2e4e7e[0x1]);_0x32663f[_0xed85('0x1e')](_0x2e4e7e['slice'](0x2,_0x2e4e7e[_0xed85('0x15')])[_0xed85('0x16')](','));break;case _0xed85('0x21'):var _0x2e36b8=_0x322fb2[_0xed85('0x1b')][_0xed85('0x1c')](',');_0x32663f['push'](_0x2e36b8[0x0]);_0x32663f[_0xed85('0x1e')](_0x2e36b8[0x1]);_0x32663f[_0xed85('0x1e')](_0x2e36b8[0x2]);_0x32663f[_0xed85('0x1e')](_0x2e36b8[0x3]);_0x32663f[_0xed85('0x1e')](_0x2e36b8['slice'](0x4,_0x2e36b8['length'])[_0xed85('0x16')](','));break;case _0xed85('0x22'):var _0x312a21=_0x322fb2[_0xed85('0x1b')][_0xed85('0x1c')](',');_0x32663f[_0xed85('0x1e')](_0x312a21[0x0]);_0x32663f[_0xed85('0x1e')](_0x312a21[0x1]);_0x32663f[_0xed85('0x1e')](_0x312a21[0x2]);_0x32663f[_0xed85('0x1e')](_0x312a21[0x3]);_0x32663f[_0xed85('0x1e')](_0x312a21[_0xed85('0x1f')](0x4,_0x312a21[_0xed85('0x15')])[_0xed85('0x16')](','));break;case _0xed85('0x10'):_0x32663f[_0xed85('0x1e')](_0x322fb2[_0xed85('0x1b')]);break;case _0xed85('0x23'):_0x32663f['push'](_0x322fb2[_0xed85('0x24')]);_0x32663f[_0xed85('0x1e')](_0x322fb2['appdata']);break;case _0xed85('0x25'):var _0x39e98b=utils[_0xed85('0x26')](_0x483df6['account'][_0xed85('0x27')],_0x483df6);var _0xe33f8d=_0x322fb2[_0xed85('0x1b')][_0xed85('0x1c')](',');_0x32663f[_0xed85('0x1e')](_0xe33f8d[0x0]);_0x32663f[_0xed85('0x1e')](_0xe33f8d[0x1]);_0x32663f[_0xed85('0x1e')](_0xe33f8d[0x2]);_0x32663f['push'](_0xe33f8d[0x3]);_0x32663f['push'](_0xe33f8d[0x4]);_0x32663f[_0xed85('0x1e')](_0xe33f8d[0x5]);_0x32663f[_0xed85('0x1e')](_0xe33f8d[0x6]);_0x32663f[_0xed85('0x1e')](_0xe33f8d[0x7]);_0x32663f[_0xed85('0x1e')](_0xe33f8d[0x8]);_0x32663f[_0xed85('0x1e')](_0xe33f8d[0x9]);_0x32663f['push'](_0xe33f8d[0xa]);_0x32663f[_0xed85('0x1e')](_0x483df6[_0xed85('0x11')]['id']);_0x32663f[_0xed85('0x1e')](_0x483df6[_0xed85('0x10')]['id']);_0x32663f[_0xed85('0x1e')](_0x322fb2['ChatWebsiteId']);_0x32663f[_0xed85('0x1e')](_0x483df6[_0xed85('0x11')][_0xed85('0x28')]);_0x32663f[_0xed85('0x1e')](_0x483df6[_0xed85('0x29')][_0xed85('0x29')]);_0x32663f[_0xed85('0x1e')](_0x39e98b);break;default:_0x32663f=_[_0xed85('0x9')](_0x322fb2[_0xed85('0x1b')])?[]:_0x322fb2['appdata'][_0xed85('0x1c')](',');}var _0x3ca990={'id':util['format']('%s:%s:%s',_0x31212d,_0x322fb2['id'],_0x322fb2[_0xed85('0x17')]),'condition':require(_0xed85('0x2a'))[_0xed85('0x2b')](_0x31212d,getIntervals(_0x381602['intervals'],_0x322fb2),_0x381602),'consequence':require('./applications/'+_0x322fb2[_0xed85('0x17')])['consequence'](_0x31212d,_0x32663f,_0x381602,_0x483df6),'p':_0x322fb2['priority']||0x0};logger[_0xed85('0x2c')](_0xed85('0x2d'),_0x3ca990['id'],_0xed85('0x2e'),getIntervals(_0x381602[_0xed85('0x2f')],_0x322fb2)[_0xed85('0x16')](_0xed85('0x30')));_0x54d71a[_0xed85('0x1e')](_0x3ca990);}else{logger[_0xed85('0x31')](_0xed85('0x32'),path[_0xed85('0x16')](__dirname,_0xed85('0x14'),_0x322fb2['app']+'.js'));}}_0x381602[_0xed85('0xe')][_0x31212d]=new RuleEngine(_0x54d71a);_0x381602[_0xed85('0xe')][_0x31212d][_0xed85('0x33')](_0x483df6,function(_0x92526f){logger[_0xed85('0x2c')](_0xed85('0x34'),JSON['stringify'](_0x92526f['matchPath']));if(_0x381602['rules'][_0x31212d]){_0x381602[_0xed85('0xe')][_0x31212d][_0xed85('0x35')](_0xed85('0x36'));}});return _0x22d294({'code':0xc8,'message':_0x483df6});}else{if(_0x234c55){logger[_0xed85('0x2c')](util[_0xed85('0x37')](_0xed85('0x38'),_0x31212d));}else{logger[_0xed85('0x2c')](_0xed85('0x39'));}return _0x22d294({'code':0xc8,'message':_0x483df6});}}catch(_0x5851c0){logger['error'](_0x5851c0[_0xed85('0x3a')]);return _0x428469(_0x5d1e72['error'](0x1f4,_0x5851c0));}}return _0x428469(_0xed85('0x3b'));});},'AcceptMessage':function(_0x24d17b){var _0x30722f=this;return new Promise(function(_0x4cb9f3,_0x4eba35){if(_0x24d17b[_0xed85('0x3c')]&&_0x24d17b[_0xed85('0x3c')]['id']){if(_0x381602['agents'][_0x24d17b['agent']['id']]){_0x381602[_0xed85('0x3d')][_0x24d17b[_0xed85('0x3c')]['id']][_0xed85('0x3e')]=![];_0x381602['agents'][_0x24d17b['agent']['id']]['busyQueue']=undefined;}}if(_0x24d17b[_0xed85('0x10')]&&_0x24d17b[_0xed85('0x10')]['id']){try{var _0x2c8a71=getId(_0x24d17b['channel'],_0x24d17b[_0xed85('0x10')]?_0x24d17b['message']['id']:0x0,_0x24d17b[_0xed85('0x11')]?_0x24d17b[_0xed85('0x11')]['id']:0x0);if(_0x381602[_0xed85('0xe')][_0x2c8a71]){_0x381602[_0xed85('0xe')][_0x2c8a71][_0xed85('0x35')](_0xed85('0x3f'));if(rpc[_0x24d17b['channel']+_0xed85('0x40')]){rpc[_0x24d17b['channel']+'QueueReport']['update'](_0x2c8a71,{'UserId':_0x24d17b[_0xed85('0x10')][_0xed85('0x41')]})['catch'](function(){logger['error'](_0xed85('0x42'));});}}return _0x4cb9f3({'code':0xc8,'message':_0x24d17b});}catch(_0x5a2176){logger[_0xed85('0x31')](_0x5a2176[_0xed85('0x3a')]);return _0x4eba35(_0x30722f[_0xed85('0x31')](0x1f4,_0x5a2176));}}logger[_0xed85('0x31')]('message\x20is\x20empty');return _0x4eba35(_0x30722f[_0xed85('0x31')](0x1f4,_0xed85('0x43')));});},'RejectMessage':function(_0x122d11){var _0x4765e0=this;return new Promise(function(_0x100d01,_0x1cb5bd){if(_0x122d11[_0xed85('0x3c')]&&_0x122d11[_0xed85('0x3c')]['id']){try{if(_0x381602[_0xed85('0x3d')][_0x122d11[_0xed85('0x3c')]['id']]){_0x381602[_0xed85('0x3d')][_0x122d11['agent']['id']][_0xed85('0x3e')]=![];_0x381602[_0xed85('0x3d')][_0x122d11['agent']['id']][_0xed85('0x44')]=undefined;}return _0x100d01({'code':0xc8,'message':_0x122d11});}catch(_0x4cdb5b){logger[_0xed85('0x31')](_0x4cdb5b[_0xed85('0x3a')]);return _0x1cb5bd(_0x4765e0[_0xed85('0x31')](0x1f4,_0x4cdb5b));}}logger[_0xed85('0x31')](_0xed85('0x43'));return _0x1cb5bd(_0x4765e0[_0xed85('0x31')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2e8653){var _0x4609e8=this;return new Promise(function(_0x28a1d1,_0x34efcf){if(_0x2e8653[_0xed85('0xf')]&&_0x2e8653[_0xed85('0x11')]&&_0x2e8653[_0xed85('0x11')]['id']){try{var _0xbef5c0=getId(_0x2e8653[_0xed85('0xf')],_0x2e8653[_0xed85('0x10')]?_0x2e8653[_0xed85('0x10')]['id']:0x0,_0x2e8653[_0xed85('0x11')]?_0x2e8653[_0xed85('0x11')]['id']:0x0);if(_0x381602['rules'][_0xbef5c0]){_0x381602[_0xed85('0xe')][_0xbef5c0][_0xed85('0x35')](_0xed85('0x3f'));}return _0x28a1d1({'code':0xc8,'message':_0x2e8653});}catch(_0xda85b){logger[_0xed85('0x31')](_0xda85b[_0xed85('0x3a')]);return _0x34efcf(_0x4609e8['error'](0x1f4,_0xda85b));}}logger[_0xed85('0x31')](_0xed85('0x43'));return _0x34efcf(_0x4609e8['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4a577f){var _0x3fba0a=this;return new Promise(function(_0x29def7,_0x52f473){if(_0x381602[_0xed85('0x3d')][_0xed85('0x45')](_0x4a577f['id'])){for(var _0x31963c in _0x4a577f[_0xed85('0x46')]){if(_0x4a577f[_0xed85('0x46')][_0xed85('0x45')](_0x31963c)){if(_0x381602[_0xed85('0x3d')][_0x4a577f['id']]['hasOwnProperty'](_0x31963c+_0xed85('0x47'))){_0x381602['agents'][_0x4a577f['id']][_0x31963c+_0xed85('0x47')]=parseInt(_0x4a577f['capacity'][_0x31963c],0xa);}}}_0x381602[_0xed85('0x3d')][_0x4a577f['id']][_0xed85('0x48')]();return _0x29def7({'code':0xc8,'message':_0x381602[_0xed85('0x3d')][_0x4a577f['id']]});}else{return _0x52f473(_0x3fba0a['error'](0x1f4,_0xed85('0x49')));}});},'Agents':function(_0x384687){return new Promise(function(_0x323ee9){var _0x3a5873=_[_0xed85('0x4a')](_0x381602[_0xed85('0x3d')]);if(_0x384687&&_0x384687['id']){var _0x51f603=_[_0xed85('0x4b')](_0x3a5873,function(_0x45ac5d){return _0x45ac5d['id']===_0x384687['id'];});_0x323ee9(_0x51f603);}else{_0x323ee9({'count':_0x3a5873[_0xed85('0x15')],'rows':_0x3a5873});}});},'ChatQueues':function(){return new Promise(function(_0x1b255b){var _0x5265a6=[];for(var _0x34f0bd in _0x381602[_0xed85('0x4c')]){if(_0x381602['chatQueues'][_0xed85('0x45')](_0x34f0bd)){var _0x105746=_0x381602[_0xed85('0x4c')][_0x34f0bd];var _0x1b70c9={'id':_0x105746['id'],'available':_0x105746[_0xed85('0x4d')],'loggedIn':_0x105746[_0xed85('0x4e')],'name':_0x105746['name'],'paused':_0x105746[_0xed85('0x4f')],'waiting':_0x105746[_0xed85('0x50')]};_0x5265a6[_0xed85('0x1e')](_0x1b70c9);}}_0x1b255b({'count':_0x5265a6[_0xed85('0x15')],'rows':_0x5265a6});});},'MailQueues':function(){return new Promise(function(_0x15d13c){var _0x4a37e0=[];for(var _0x57d77e in _0x381602[_0xed85('0x51')]){if(_0x381602['mailQueues'][_0xed85('0x45')](_0x57d77e)){var _0x41567d=_0x381602[_0xed85('0x51')][_0x57d77e];var _0x5cb4d3={'id':_0x41567d['id'],'available':_0x41567d[_0xed85('0x4d')],'loggedIn':_0x41567d[_0xed85('0x4e')],'name':_0x41567d[_0xed85('0x52')],'paused':_0x41567d['paused'],'waiting':_0x41567d[_0xed85('0x50')]};_0x4a37e0[_0xed85('0x1e')](_0x5cb4d3);}}_0x15d13c({'count':_0x4a37e0[_0xed85('0x15')],'rows':_0x4a37e0});});},'OpenchannelQueues':function(){return new Promise(function(_0x5960f3){var _0x4c3c94=[];for(var _0x51da84 in _0x381602[_0xed85('0x53')]){if(_0x381602[_0xed85('0x53')]['hasOwnProperty'](_0x51da84)){var _0xb30ac0=_0x381602[_0xed85('0x53')][_0x51da84];var _0x5d9206={'id':_0xb30ac0['id'],'available':_0xb30ac0[_0xed85('0x4d')],'loggedIn':_0xb30ac0[_0xed85('0x4e')],'name':_0xb30ac0[_0xed85('0x52')],'paused':_0xb30ac0[_0xed85('0x4f')],'waiting':_0xb30ac0['waiting']};_0x4c3c94['push'](_0x5d9206);}}_0x5960f3({'count':_0x4c3c94[_0xed85('0x15')],'rows':_0x4c3c94});});},'SmsQueues':function(){return new Promise(function(_0x1cb70e){var _0x265633=[];for(var _0xa19949 in _0x381602[_0xed85('0x54')]){if(_0x381602[_0xed85('0x54')][_0xed85('0x45')](_0xa19949)){var _0x4c6a0d=_0x381602[_0xed85('0x54')][_0xa19949];var _0xc36ef6={'id':_0x4c6a0d['id'],'available':_0x4c6a0d[_0xed85('0x4d')],'loggedIn':_0x4c6a0d[_0xed85('0x4e')],'name':_0x4c6a0d[_0xed85('0x52')],'paused':_0x4c6a0d[_0xed85('0x4f')],'waiting':_0x4c6a0d['waiting']};_0x265633[_0xed85('0x1e')](_0xc36ef6);}}_0x1cb70e({'count':_0x265633[_0xed85('0x15')],'rows':_0x265633});});},'FaxQueues':function(){return new Promise(function(_0x5567f8){var _0x12c2d0=[];for(var _0x38ab00 in _0x381602[_0xed85('0x55')]){if(_0x381602[_0xed85('0x55')][_0xed85('0x45')](_0x38ab00)){var _0x4d0ac2=_0x381602['faxQueues'][_0x38ab00];var _0x4c7834={'id':_0x4d0ac2['id'],'available':_0x4d0ac2[_0xed85('0x4d')],'loggedIn':_0x4d0ac2[_0xed85('0x4e')],'name':_0x4d0ac2[_0xed85('0x52')],'paused':_0x4d0ac2[_0xed85('0x4f')],'waiting':_0x4d0ac2[_0xed85('0x50')]};_0x12c2d0[_0xed85('0x1e')](_0x4c7834);}}_0x5567f8({'count':_0x12c2d0[_0xed85('0x15')],'rows':_0x12c2d0});});},'WhatsappQueues':function(){return new Promise(function(_0x2ec3e8){var _0x37de34=[];for(var _0x3968d9 in _0x381602[_0xed85('0x56')]){if(_0x381602[_0xed85('0x56')][_0xed85('0x45')](_0x3968d9)){var _0x1e8cf3=_0x381602['whatsappQueues'][_0x3968d9];var _0x11bc66={'id':_0x1e8cf3['id'],'available':_0x1e8cf3[_0xed85('0x4d')],'loggedIn':_0x1e8cf3[_0xed85('0x4e')],'name':_0x1e8cf3[_0xed85('0x52')],'paused':_0x1e8cf3['paused'],'waiting':_0x1e8cf3[_0xed85('0x50')]};_0x37de34['push'](_0x11bc66);}}_0x2ec3e8({'count':_0x37de34['length'],'rows':_0x37de34});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3bf2c5){var _0x387021=_[_0xed85('0x4a')](_0x381602[_0xed85('0x57')]);_0x3bf2c5({'count':_0x387021[_0xed85('0x15')],'rows':_0x387021});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4cd5c8){var _0x535444=_[_0xed85('0x4a')](_0x381602[_0xed85('0x58')]);_0x4cd5c8({'count':_0x535444[_0xed85('0x15')],'rows':_0x535444});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1bc1ec){var _0x5493e2=_[_0xed85('0x4a')](_0x381602[_0xed85('0x59')]);_0x1bc1ec({'count':_0x5493e2[_0xed85('0x15')],'rows':_0x5493e2});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4a77c4){var _0x906562=_[_0xed85('0x4a')](_0x381602[_0xed85('0x5a')]);_0x4a77c4({'count':_0x906562[_0xed85('0x15')],'rows':_0x906562});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x481c9b){var _0x2e8ea1=_['values'](_0x381602[_0xed85('0x5b')]);_0x481c9b({'count':_0x2e8ea1[_0xed85('0x15')],'rows':_0x2e8ea1});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x338fce){var _0x32b3b4=_[_0xed85('0x4a')](_0x381602['whatsappQueuesWaitingInteractions']);_0x338fce({'count':_0x32b3b4[_0xed85('0x15')],'rows':_0x32b3b4});});}};var _0x3bf03b=jayson[_0xed85('0x5c')](_0x252005)['http']();_0x3bf03b['on'](_0xed85('0x31'),function(_0x4bd5dd){logger[_0xed85('0x31')](JSON['stringify'](_0x4bd5dd));return _0x296a1c(_0x4bd5dd);});_0x3bf03b[_0xed85('0xd')](0x232c,'127.0.0.1',function(){console[_0xed85('0x5d')](_0xed85('0x5e'),0x232c);return _0x192793('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9b28e0f..69cdf6b 100644 --- a/server/services/routing/server/interval.js +++ b/server/services/routing/server/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a3a=['when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','../../../utils/iftime','../../../config/logger','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0x7a3a,0x10c));var _0xa7a3=function(_0x32b89f,_0x5112c2){_0x32b89f=_0x32b89f-0x0;var _0x430564=_0x7a3a[_0x32b89f];return _0x430564;};'use strict';var _=require(_0xa7a3('0x0'));var iftime=require(_0xa7a3('0x1'))['iftime'];var logger=require(_0xa7a3('0x2'))('routing');exports[_0xa7a3('0x3')]=function(_0x1d7a4c,_0x47cb53,_0x171f43){return function(_0x1d9cd5){if(_0x171f43[_0xa7a3('0x4')]&&!_0x171f43[_0xa7a3('0x4')][_0x1d7a4c]){logger[_0xa7a3('0x5')](_0xa7a3('0x6'),_0x1d7a4c);return _0x1d9cd5[_0xa7a3('0x7')]();}var _0x2a7c89=_0x47cb53[_0xa7a3('0x8')](function(_0x2b7326){return iftime(_0x2b7326);});var _0x257b81=_[_0xa7a3('0x9')](_0x2a7c89);if(_0x257b81){logger['info'](_0xa7a3('0xa'),_0x1d7a4c,_0x47cb53[_0xa7a3('0xb')]('\x20|\x20'),_0x257b81);_0x1d9cd5[_0xa7a3('0xc')](_0x257b81);}else{logger[_0xa7a3('0x5')](_0xa7a3('0xd'),_0x1d7a4c,_0x47cb53[_0xa7a3('0xb')]('\x20|\x20'));_0x1d9cd5['stop']();}};}; \ No newline at end of file +var _0xeaec=['stop','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','\x20|\x20','../../../utils/iftime','iftime','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x2020f8,_0x19ee63){var _0x4a9350=function(_0x176ed2){while(--_0x176ed2){_0x2020f8['push'](_0x2020f8['shift']());}};_0x4a9350(++_0x19ee63);}(_0xeaec,0x157));var _0xceae=function(_0x2ddbe5,_0x279dd9){_0x2ddbe5=_0x2ddbe5-0x0;var _0x175a7e=_0xeaec[_0x2ddbe5];return _0x175a7e;};'use strict';var _=require('lodash');var iftime=require(_0xceae('0x0'))[_0xceae('0x1')];var logger=require('../../../config/logger')(_0xceae('0x2'));exports[_0xceae('0x3')]=function(_0x2ee486,_0x49c136,_0x3a2ee3){return function(_0x10f564){if(_0x3a2ee3['rules']&&!_0x3a2ee3[_0xceae('0x4')][_0x2ee486]){logger[_0xceae('0x5')](_0xceae('0x6'),_0x2ee486);return _0x10f564[_0xceae('0x7')]();}var _0x2c3ca2=_0x49c136['map'](function(_0x5f49a2){return iftime(_0x5f49a2);});var _0x522b12=_[_0xceae('0x8')](_0x2c3ca2);if(_0x522b12){logger[_0xceae('0x5')](_0xceae('0x9'),_0x2ee486,_0x49c136[_0xceae('0xa')]('\x20|\x20'),_0x522b12);_0x10f564[_0xceae('0xb')](_0x522b12);}else{logger[_0xceae('0x5')](_0xceae('0xc'),_0x2ee486,_0x49c136[_0xceae('0xa')](_0xceae('0xd')));_0x10f564[_0xceae('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c75e190..85068f5 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe57=['agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','agentconnect','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','CreateVoiceAgentReport','request','agentcalled','destuniqueid','agentcalledAt','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x127911,_0x3e5a43){var _0x3a6c47=function(_0x595371){while(--_0x595371){_0x127911['push'](_0x127911['shift']());}};_0x3a6c47(++_0x3e5a43);}(_0xfe57,0x195));var _0x7fe5=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xfe57[_0x240261];return _0x45c332;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x581f71,_0x3f7dca){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x4'),_0x581f71[_0x7fe5('0x5')],_0x581f71[_0x7fe5('0x6')],_0x581f71[_0x7fe5('0x7')],_0x581f71[_0x7fe5('0x8')],_0x581f71[_0x7fe5('0x9')],_0x581f71[_0x7fe5('0xa')],_0x581f71[_0x7fe5('0xb')],_0x581f71[_0x7fe5('0xc')]));if(_0x581f71[_0x7fe5('0x7')]){utils['getVoiceQueueByName'](_0x581f71[_0x7fe5('0x7')])['then'](function(_0x3564f1){if(_0x3564f1){_0x581f71[_0x7fe5('0xd')]=_0x3564f1['type'];_0x581f71['agentacw']=_0x581f71[_0x7fe5('0xe')]?_0x3564f1[_0x7fe5('0xf')]:![];_0x581f71['acwtime']=_0x581f71[_0x7fe5('0x10')]?_0x3564f1['acwTimeout']:0x0;}utils['request'](_0x7fe5('0x11'),_0x581f71);});}else{utils[_0x7fe5('0x12')](_0x7fe5('0x11'),_0x581f71);}if(_0x3f7dca){delete transfers[_0x581f71[_0x7fe5('0x5')]];}else{delete agents[_0x581f71['destuniqueid']];}}exports[_0x7fe5('0x13')]=function(_0x16bed9){try{utils['debug'](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9[_0x7fe5('0x5')]),_0x16bed9);agents[_0x16bed9[_0x7fe5('0x14')]]=_0x16bed9;agents[_0x16bed9['destuniqueid']][_0x7fe5('0x15')]=utils['now']();agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x16');agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xb')]=null;agents[_0x16bed9[_0x7fe5('0x14')]]['connectedlinename']=null;utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x17'),_0x16bed9[_0x7fe5('0x5')],agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x16bed9[_0x7fe5('0x14')]));}catch(_0x29b0bd){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9['uniqueid']),_0x29b0bd);}};exports[_0x7fe5('0x19')]=function(_0x459c2d){try{if(!_[_0x7fe5('0x1a')](agents[_0x459c2d[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x459c2d);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x1d'),_0x459c2d[_0x7fe5('0x5')],agents[_0x459c2d['destuniqueid']][_0x7fe5('0x8')],_0x459c2d[_0x7fe5('0x14')]));agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswer']=!![];agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswerAt']=utils[_0x7fe5('0x1e')]();agents[_0x459c2d['destuniqueid']][_0x7fe5('0xc')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x20')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]]['holdtime']=_0x459c2d['ringtime']?parseInt(_0x459c2d[_0x7fe5('0x21')])/0x3e8:0x0;agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x22')]=0x0;unanswered[_0x7fe5('0x23')](_0x459c2d['destuniqueid']);}}catch(_0x46f816){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x46f816);}};exports[_0x7fe5('0x24')]=function(_0x1f8572){try{_[_0x7fe5('0x25')](agents,function(_0x5c07f0,_0xe521c6){if(_0x5c07f0[_0x7fe5('0x5')]==_0x1f8572['uniqueid']&&!_[_0x7fe5('0x26')](unanswered,_0x5c07f0[_0x7fe5('0x14')])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x1f8572);utils['info'](util[_0x7fe5('0x3')](_0x7fe5('0x28'),_0x1f8572[_0x7fe5('0x5')],_0x5c07f0[_0x7fe5('0x8')],_0x5c07f0['destuniqueid']));_0x5c07f0[_0x7fe5('0x19')]=!![];_0x5c07f0[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x5c07f0[_0x7fe5('0xc')]=_0x7fe5('0x2a');_0x5c07f0[_0x7fe5('0x20')]='abandoned';_0x5c07f0[_0x7fe5('0x2b')]=_0x1f8572[_0x7fe5('0x2b')];_0x5c07f0[_0x7fe5('0x22')]=0x0;writeDB(_0x5c07f0);}});}catch(_0x39cfe9){utils['error'](util['format'](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x39cfe9);}};exports[_0x7fe5('0x2c')]=function(_0x513680){try{if(agents[_0x513680[_0x7fe5('0x14')]]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x513680['uniqueid']),_0x513680);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x513680[_0x7fe5('0x5')],agents[_0x513680[_0x7fe5('0x14')]]['membername'],_0x513680[_0x7fe5('0x14')]));agents[_0x513680['destuniqueid']]['agentconnectAt']=utils[_0x7fe5('0x1e')]();agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xb')]=_0x513680[_0x7fe5('0xb')];agents[_0x513680[_0x7fe5('0x14')]]['connectedlinename']=_0x513680[_0x7fe5('0x2d')];agents[_0x513680[_0x7fe5('0x14')]]['holdtime']=_0x513680[_0x7fe5('0x21')];agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x2e');_[_0x7fe5('0x25')](agents,function(_0x1c81c8,_0x1a14e3){if(_0x1c81c8['destuniqueid']!=_0x513680['destuniqueid']&&_0x1c81c8[_0x7fe5('0x5')]==_0x513680['uniqueid']){_0x1c81c8[_0x7fe5('0x22')]=0x0;_0x1c81c8[_0x7fe5('0x2b')]=_0x513680['ringtime'];_0x1c81c8[_0x7fe5('0x19')]=!![];_0x1c81c8[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x1c81c8[_0x7fe5('0xc')]=_0x7fe5('0x2f');_0x1c81c8[_0x7fe5('0x20')]=_0x7fe5('0x2f');_0x1c81c8['answeredelsewheredestinationuniqueid']=_0x513680['destuniqueid'];_0x1c81c8[_0x7fe5('0x30')]=_0x513680['membername'];writeDB(_0x1c81c8);}});}}catch(_0xad0b05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x31'),_0x513680['uniqueid']),_0xad0b05);}};exports[_0x7fe5('0xe')]=function(_0x5439bc){try{if(!_['isNil'](agents[_0x5439bc[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x5439bc);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x33'),_0x5439bc['uniqueid'],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x5439bc['destuniqueid']));agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0xe')]=!![];agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x34')]=utils['now']();agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x5439bc['destuniqueid']][_0x7fe5('0x34')],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x36')]);agents[_0x5439bc['destuniqueid']][_0x7fe5('0x20')]=_0x5439bc[_0x7fe5('0x20')];agents[_0x5439bc[_0x7fe5('0x14')]]['lastevent']=_0x7fe5('0x37');writeDB(agents[_0x5439bc[_0x7fe5('0x14')]]);}}catch(_0x1ac93a){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x1ac93a);}};exports[_0x7fe5('0x38')]=function(_0x446f01){try{if(!_[_0x7fe5('0x1a')](agents[_0x446f01[_0x7fe5('0x39')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x446f01['uniqueid']),_0x446f01);utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x3a'),_0x446f01[_0x7fe5('0x5')],agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x8')],agents[_0x446f01[_0x7fe5('0x39')]]['uniqueid']));agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3b')]=!![];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3c')]=_0x7fe5('0x3d');agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3e')]=_0x446f01[_0x7fe5('0x3f')];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x40')]=agents[_0x446f01['transfereruniqueid']][_0x7fe5('0x5')];}}catch(_0x401d05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x41'),_0x446f01[_0x7fe5('0x5')]),_0x401d05);}};exports['attendedtransfer']=function(_0x31a196){try{utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x31a196);if(_0x31a196[_0x7fe5('0x43')]==_0x31a196[_0x7fe5('0x44')]){if(!_['isNil'](agents[_0x31a196[_0x7fe5('0x45')]])){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3b')]=!![];agents[_0x31a196[_0x7fe5('0x45')]]['transfertype']=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x48')];agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x40')]=_0x31a196[_0x7fe5('0x43')];}if(_0x31a196[_0x7fe5('0x49')]&&agents[_0x31a196[_0x7fe5('0x49')]]){agents[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196['transfereeuniqueid']]=_[_0x7fe5('0x4b')](agents[_0x31a196[_0x7fe5('0x49')]]);transfers[_0x31a196[_0x7fe5('0x49')]]['calleridnum']=agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfereeuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x45')]]['calleridname'];transfers[_0x31a196[_0x7fe5('0x49')]]['agentcalledAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x36')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x2b')]=0x0;transfers[_0x31a196['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x31a196[_0x7fe5('0x45')]==_0x31a196[_0x7fe5('0x4d')]){if(!_[_0x7fe5('0x1a')](agents[_0x31a196[_0x7fe5('0x43')]])){utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x43')]]['transfer']=!![];agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3c')]=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x4e')];agents[_0x31a196[_0x7fe5('0x43')]]['transferuniqueid']=_0x31a196[_0x7fe5('0x45')];}if(_0x31a196[_0x7fe5('0x4f')]&&agents[_0x31a196[_0x7fe5('0x4f')]]){agents[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196[_0x7fe5('0x4f')]]=_[_0x7fe5('0x4b')](agents[_0x31a196['transfertargetuniqueid']]);transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0xa')]=agents[_0x31a196['origtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x4c')];transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x15')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x36')]=utils['now']();transfers[_0x31a196[_0x7fe5('0x4f')]]['holdtime']=0x0;transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x2;}}}catch(_0x36ac40){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x36ac40);}};exports[_0x7fe5('0x50')]=function(_0x31404b){try{utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x51'),_0x31404b[_0x7fe5('0x5')]),_0x31404b);if(agents[_0x31404b['uniqueid']]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]==='timeout'){if(_0x31404b[_0x7fe5('0x52')]==='21'){agents[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x53');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x53');}utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]]['reason'],agents[_0x31404b[_0x7fe5('0x5')]]['lastevent']));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);var _0x2e3b94=unanswered['indexOf'](_0x31404b[_0x7fe5('0x5')]);if(_0x2e3b94>-0x1){unanswered[_0x7fe5('0x54')](_0x2e3b94,0x1);}}if(transfers[_0x31404b['uniqueid']]){transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31404b[_0x7fe5('0x5')]]['talktime']=utils[_0x7fe5('0x35')](transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt'],transfers[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);transfers[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x55');transfers[_0x31404b['uniqueid']]['lastevent']=_0x7fe5('0x37');utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],transfers[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(transfers[_0x31404b[_0x7fe5('0x5')]],!![]);}if(agents[_0x31404b[_0x7fe5('0x5')]]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x36')]){agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')]=utils[_0x7fe5('0x1e')]();agents[_0x31404b['uniqueid']][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')],agents[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]=agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x3b')]?_0x7fe5('0x3b'):_0x7fe5('0x55');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x37');utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],agents[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);}}catch(_0x226ada){utils['error'](util['format']('[%s][agents][hangup]',_0x31404b[_0x7fe5('0x5')]),_0x226ada);}}; \ No newline at end of file +var _0x2bc6=['lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum'];(function(_0x340812,_0x46e6e8){var _0x21d2cc=function(_0x155c29){while(--_0x155c29){_0x340812['push'](_0x340812['shift']());}};_0x21d2cc(++_0x46e6e8);}(_0x2bc6,0x163));var _0x62bc=function(_0x4a92c2,_0x28ed8b){_0x4a92c2=_0x4a92c2-0x0;var _0x7b52f1=_0x2bc6[_0x4a92c2];return _0x7b52f1;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var utils=require(_0x62bc('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x56939b,_0x4b4e73){utils['info'](util['format'](_0x62bc('0x3'),_0x56939b['uniqueid'],_0x56939b[_0x62bc('0x4')],_0x56939b[_0x62bc('0x5')],_0x56939b['membername'],_0x56939b[_0x62bc('0x6')],_0x56939b[_0x62bc('0x7')],_0x56939b[_0x62bc('0x8')],_0x56939b[_0x62bc('0x9')]));if(_0x56939b[_0x62bc('0x5')]){utils[_0x62bc('0xa')](_0x56939b['queue'])[_0x62bc('0xb')](function(_0x762c71){if(_0x762c71){_0x56939b[_0x62bc('0xc')]=_0x762c71[_0x62bc('0xc')];_0x56939b['agentacw']=_0x56939b[_0x62bc('0xd')]?_0x762c71[_0x62bc('0xe')]:![];_0x56939b[_0x62bc('0xf')]=_0x56939b['agentacw']?_0x762c71[_0x62bc('0x10')]:0x0;}utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);});}else{utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);}if(_0x4b4e73){delete transfers[_0x56939b[_0x62bc('0x13')]];}else{delete agents[_0x56939b[_0x62bc('0x14')]];}}exports['agentcalled']=function(_0x2a96ae){try{utils[_0x62bc('0x15')](util['format'](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x2a96ae);agents[_0x2a96ae[_0x62bc('0x14')]]=_0x2a96ae;agents[_0x2a96ae['destuniqueid']][_0x62bc('0x17')]=utils[_0x62bc('0x18')]();agents[_0x2a96ae['destuniqueid']]['lastevent']=_0x62bc('0x19');agents[_0x2a96ae[_0x62bc('0x14')]]['connectedlinenum']=null;agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1a')]=null;utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1d'),_0x2a96ae[_0x62bc('0x13')],agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x2a96ae[_0x62bc('0x14')]));}catch(_0x5ed51c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x5ed51c);}};exports['agentringnoanswer']=function(_0x380621){try{if(!_['isNil'](agents[_0x380621[_0x62bc('0x14')]])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')]('[%s][agents][agentringnoanswer]',_0x380621[_0x62bc('0x13')]),_0x380621);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1f'),_0x380621[_0x62bc('0x13')],agents[_0x380621[_0x62bc('0x14')]]['membername'],_0x380621[_0x62bc('0x14')]));agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x20')]=!![];agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x21')]=utils['now']();agents[_0x380621['destuniqueid']][_0x62bc('0x9')]='timeout';agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x22')]=_0x62bc('0x23');agents[_0x380621['destuniqueid']][_0x62bc('0x24')]=_0x380621[_0x62bc('0x25')]?parseInt(_0x380621[_0x62bc('0x25')])/0x3e8:0x0;agents[_0x380621['destuniqueid']]['talktime']=0x0;unanswered[_0x62bc('0x26')](_0x380621[_0x62bc('0x14')]);}}catch(_0x23817c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x27'),_0x380621[_0x62bc('0x13')]),_0x23817c);}};exports[_0x62bc('0x28')]=function(_0x5a9302){try{_[_0x62bc('0x29')](agents,function(_0x5e4491,_0x26701b){if(_0x5e4491[_0x62bc('0x13')]==_0x5a9302[_0x62bc('0x13')]&&!_[_0x62bc('0x2a')](unanswered,_0x5e4491[_0x62bc('0x14')])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x2b'),_0x5a9302[_0x62bc('0x13')]),_0x5a9302);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x2c'),_0x5a9302[_0x62bc('0x13')],_0x5e4491[_0x62bc('0x1e')],_0x5e4491[_0x62bc('0x14')]));_0x5e4491[_0x62bc('0x20')]=!![];_0x5e4491[_0x62bc('0x21')]=utils['now']();_0x5e4491[_0x62bc('0x9')]='abandoned';_0x5e4491['reason']=_0x62bc('0x2d');_0x5e4491['holdtime']=_0x5a9302['holdtime'];_0x5e4491['talktime']=0x0;writeDB(_0x5e4491);}});}catch(_0x3f22c1){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][queuecallerabandon]',_0x5a9302['uniqueid']),_0x3f22c1);}};exports['agentconnect']=function(_0x3c938d){try{if(agents[_0x3c938d[_0x62bc('0x14')]]){utils['debug'](util['format'](_0x62bc('0x2f'),_0x3c938d[_0x62bc('0x13')]),_0x3c938d);utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x30'),_0x3c938d[_0x62bc('0x13')],agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x3c938d['destuniqueid']));agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x31')]=utils['now']();agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x8')]=_0x3c938d[_0x62bc('0x8')];agents[_0x3c938d[_0x62bc('0x14')]]['connectedlinename']=_0x3c938d[_0x62bc('0x1a')];agents[_0x3c938d['destuniqueid']][_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x9')]='connect';_[_0x62bc('0x29')](agents,function(_0x5c806b,_0x392550){if(_0x5c806b[_0x62bc('0x14')]!=_0x3c938d[_0x62bc('0x14')]&&_0x5c806b[_0x62bc('0x13')]==_0x3c938d[_0x62bc('0x13')]){_0x5c806b[_0x62bc('0x32')]=0x0;_0x5c806b[_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];_0x5c806b[_0x62bc('0x20')]=!![];_0x5c806b['agentringnoanswerAt']=utils['now']();_0x5c806b[_0x62bc('0x9')]=_0x62bc('0x33');_0x5c806b['reason']=_0x62bc('0x33');_0x5c806b[_0x62bc('0x34')]=_0x3c938d[_0x62bc('0x14')];_0x5c806b[_0x62bc('0x35')]=_0x3c938d[_0x62bc('0x1e')];writeDB(_0x5c806b);}});}}catch(_0x5f3752){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][agentconnect]',_0x3c938d['uniqueid']),_0x5f3752);}};exports[_0x62bc('0xd')]=function(_0xdbd9ee){try{if(!_[_0x62bc('0x36')](agents[_0xdbd9ee['destuniqueid']])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0xdbd9ee);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xdbd9ee[_0x62bc('0x13')],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x1e')],_0xdbd9ee[_0x62bc('0x14')]));agents[_0xdbd9ee[_0x62bc('0x14')]]['agentcomplete']=!![];agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt']=utils[_0x62bc('0x18')]();agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt'],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x31')]);agents[_0xdbd9ee[_0x62bc('0x14')]][_0x62bc('0x22')]=_0xdbd9ee[_0x62bc('0x22')];agents[_0xdbd9ee[_0x62bc('0x14')]]['lastevent']=_0x62bc('0x39');writeDB(agents[_0xdbd9ee[_0x62bc('0x14')]]);}}catch(_0x4859fc){utils[_0x62bc('0x2e')](util['format'](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0x4859fc);}};exports[_0x62bc('0x3a')]=function(_0xca6190){try{if(!_[_0x62bc('0x36')](agents[_0xca6190[_0x62bc('0x3b')]])){utils[_0x62bc('0x15')](util['format'](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0xca6190);utils['info'](util[_0x62bc('0x1c')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0xca6190[_0x62bc('0x13')],agents[_0xca6190[_0x62bc('0x3b')]]['membername'],agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')]));agents[_0xca6190[_0x62bc('0x3b')]]['transfer']=!![];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3d')]=_0x62bc('0x3e');agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3f')]=_0xca6190[_0x62bc('0x40')];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x41')]=agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')];}}catch(_0x44d2a2){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0x44d2a2);}};exports[_0x62bc('0x42')]=function(_0x5b0e9b){try{utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x5b0e9b);if(_0x5b0e9b[_0x62bc('0x44')]==_0x5b0e9b[_0x62bc('0x45')]){if(!_[_0x62bc('0x36')](agents[_0x5b0e9b[_0x62bc('0x46')]])){utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x47'),_0x5b0e9b[_0x62bc('0x44')],agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x1e')]));agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3f')]=_0x5b0e9b[_0x62bc('0x4a')];agents[_0x5b0e9b[_0x62bc('0x46')]]['transferuniqueid']=_0x5b0e9b['origtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x4b')]&&agents[_0x5b0e9b[_0x62bc('0x4b')]]){agents[_0x5b0e9b[_0x62bc('0x4b')]]['agententerreason']=0x1;transfers[_0x5b0e9b[_0x62bc('0x4b')]]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x4b')]]);transfers[_0x5b0e9b[_0x62bc('0x4b')]]['calleridnum']=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x7')];transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4d')]=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x4b')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b['transfereeuniqueid']][_0x62bc('0x24')]=0x0;transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4e')]=0x2;}}else if(_0x5b0e9b['secondtransfereruniqueid']==_0x5b0e9b[_0x62bc('0x4f')]){if(!_['isNil'](agents[_0x5b0e9b[_0x62bc('0x44')]])){utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x47'),_0x5b0e9b['origtransfereruniqueid'],agents[_0x5b0e9b[_0x62bc('0x44')]]['membername']));agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x44')]]['transferexten']=_0x5b0e9b[_0x62bc('0x50')];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x41')]=_0x5b0e9b['secondtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x51')]&&agents[_0x5b0e9b[_0x62bc('0x51')]]){agents[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x1;transfers[_0x5b0e9b['transfertargetuniqueid']]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x51')]]);transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x7')]=agents[_0x5b0e9b[_0x62bc('0x44')]]['calleridnum'];transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x4d')]=agents[_0x5b0e9b['origtransfereruniqueid']][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x51')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b[_0x62bc('0x51')]]['holdtime']=0x0;transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x2;}}}catch(_0x6bb64b){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x6bb64b);}};exports[_0x62bc('0x52')]=function(_0x177fba){try{utils['debug'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba[_0x62bc('0x13')]),_0x177fba);if(agents[_0x177fba[_0x62bc('0x13')]]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]===_0x62bc('0x23')){if(_0x177fba[_0x62bc('0x54')]==='21'){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]=_0x62bc('0x55');agents[_0x177fba['uniqueid']][_0x62bc('0x9')]=_0x62bc('0x55');}utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);var _0x5698a4=unanswered[_0x62bc('0x56')](_0x177fba[_0x62bc('0x13')]);if(_0x5698a4>-0x1){unanswered[_0x62bc('0x57')](_0x5698a4,0x1);}}if(transfers[_0x177fba[_0x62bc('0x13')]]){transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](transfers[_0x177fba['uniqueid']][_0x62bc('0x58')],transfers[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);transfers[_0x177fba[_0x62bc('0x13')]]['reason']=_0x62bc('0x59');transfers[_0x177fba[_0x62bc('0x13')]]['lastevent']=_0x62bc('0x39');utils['info'](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],transfers[_0x177fba['uniqueid']][_0x62bc('0x1e')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(transfers[_0x177fba[_0x62bc('0x13')]],!![]);}if(agents[_0x177fba['uniqueid']]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x31')]){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')],agents[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);agents[_0x177fba['uniqueid']]['reason']=agents[_0x177fba[_0x62bc('0x13')]]['transfer']?_0x62bc('0x48'):_0x62bc('0x59');agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]=_0x62bc('0x39');utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x5a'),_0x177fba['uniqueid'],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]]['reason'],agents[_0x177fba[_0x62bc('0x13')]]['lastevent']));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);}}catch(_0x3aa295){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba['uniqueid']),_0x3aa295);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9a3c554..19ded5b 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe2d=['attendedtransfer','localtwolinkedid','origtransfereruniqueid','secondtransfererchannel','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','lastIndexOf','hangup','noop','execif','lastapplication','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','newstate','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','channel','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][newstate]','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','cause-txt','endtime','duration','diffTime','starttime'];(function(_0x52382b,_0x469771){var _0x47f436=function(_0x1f9dcf){while(--_0x1f9dcf){_0x52382b['push'](_0x52382b['shift']());}};_0x47f436(++_0x469771);}(_0xbe2d,0x1dd));var _0xdbe2=function(_0x424687,_0x150927){_0x424687=_0x424687-0x0;var _0x17cd5a=_0xbe2d[_0x424687];return _0x17cd5a;};'use strict';var _=require(_0xdbe2('0x0'));var util=require(_0xdbe2('0x1'));var utils=require(_0xdbe2('0x2'));var dispositions=[_0xdbe2('0x3'),_0xdbe2('0x4'),'FAILED',_0xdbe2('0x3'),'NO\x20ANSWER',_0xdbe2('0x3'),_0xdbe2('0x5'),_0xdbe2('0x6'),_0xdbe2('0x4'),_0xdbe2('0x4'),_0xdbe2('0x4')];var channels={};function writeDB(_0x2e4368){utils[_0xdbe2('0x7')](util['format'](_0xdbe2('0x8'),_0x2e4368[_0xdbe2('0x9')],_0x2e4368['channel'],_0x2e4368[_0xdbe2('0xa')],_0x2e4368[_0xdbe2('0xb')],_0x2e4368['interface'],_0x2e4368[_0xdbe2('0xc')],_0x2e4368[_0xdbe2('0xd')],_0x2e4368['lastevent']));if(_0x2e4368['accountcode']){utils[_0xdbe2('0xe')](_0x2e4368[_0xdbe2('0xf')])[_0xdbe2('0x10')](function(_0x143597){if(_0x143597){_0x2e4368[_0xdbe2('0x11')]=_0x143597['id'];}utils[_0xdbe2('0x12')](_0xdbe2('0x13'),_0x2e4368);});}else{utils[_0xdbe2('0x12')](_0xdbe2('0x13'),_0x2e4368);}if(channels[_0x2e4368[_0xdbe2('0x9')]]){delete channels[_0x2e4368['uniqueid']];}}exports[_0xdbe2('0x14')]=function(_0x5ee6c9){try{utils[_0xdbe2('0x15')](util[_0xdbe2('0x16')](_0xdbe2('0x17'),_0x5ee6c9[_0xdbe2('0x9')]),_0x5ee6c9);if(_0x5ee6c9['uniqueid']==_0x5ee6c9[_0xdbe2('0x18')]&&_0x5ee6c9['channel']!=_0xdbe2('0x19')){utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x1a'),_0x5ee6c9['uniqueid'],_0x5ee6c9['context'],_0x5ee6c9['exten']));channels[_0x5ee6c9[_0xdbe2('0x9')]]={'uniqueid':_0x5ee6c9[_0xdbe2('0x9')],'accountcode':_0x5ee6c9[_0xdbe2('0xf')],'source':_0x5ee6c9[_0xdbe2('0xc')],'destination':_0x5ee6c9[_0xdbe2('0x1b')],'destinationcontext':_0x5ee6c9[_0xdbe2('0x1c')],'channel':_0x5ee6c9['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xdbe2('0x1d')};}}catch(_0x1fbcec){utils['error'](util['format']('[%s][calls][newchannel]',_0x5ee6c9[_0xdbe2('0x9')]),_0x1fbcec);}};exports[_0xdbe2('0x1e')]=function(_0x300da1){try{utils[_0xdbe2('0x15')](util[_0xdbe2('0x16')]('[%s][calls][newstate]',_0x300da1[_0xdbe2('0x9')]),_0x300da1);if(!_[_0xdbe2('0x1f')](channels[_0x300da1[_0xdbe2('0x9')]])&&_0x300da1['channelstate']==0x6){utils[_0xdbe2('0x7')](util['format'](_0xdbe2('0x20'),_0x300da1[_0xdbe2('0x9')],_0x300da1[_0xdbe2('0x1c')],_0x300da1[_0xdbe2('0x21')]));if(_['isNil'](channels[_0x300da1[_0xdbe2('0x9')]]['systemanswertime'])){channels[_0x300da1[_0xdbe2('0x9')]][_0xdbe2('0x22')]=utils[_0xdbe2('0x23')]();}}else if(!_[_0xdbe2('0x1f')](channels[_0x300da1[_0xdbe2('0x18')]])&&_0x300da1['channelstate']==0x6&&_0x300da1[_0xdbe2('0x1c')]!=_0xdbe2('0x24')){utils['info'](util[_0xdbe2('0x16')](_0xdbe2('0x25'),_0x300da1['uniqueid'],_0x300da1['linkedid'],_0x300da1['context'],_0x300da1['channel']));channels[_0x300da1[_0xdbe2('0x18')]][_0xdbe2('0xf')]=_0x300da1[_0xdbe2('0xf')];channels[_0x300da1[_0xdbe2('0x18')]][_0xdbe2('0x26')]=_0x300da1[_0xdbe2('0x21')];if(_[_0xdbe2('0x1f')](channels[_0x300da1['linkedid']][_0xdbe2('0x27')])){channels[_0x300da1['linkedid']]['answertime']=utils['now']();}channels[_0x300da1[_0xdbe2('0x18')]][_0xdbe2('0x28')]=dispositions[_[_0xdbe2('0x29')](_0x300da1['channelstate'])]||_0xdbe2('0x5');}}catch(_0xc48b8b){utils[_0xdbe2('0x2a')](util[_0xdbe2('0x16')](_0xdbe2('0x2b'),_0x300da1[_0xdbe2('0x9')]),_0xc48b8b);}};exports['hangup']=function(_0x474757){try{if(!_[_0xdbe2('0x1f')](channels[_0x474757[_0xdbe2('0x9')]])){utils['debug'](util[_0xdbe2('0x16')](_0xdbe2('0x2c'),_0x474757[_0xdbe2('0x9')]),_0x474757);if(_[_0xdbe2('0x1f')](channels[_0x474757['uniqueid']]['callerid'])){channels[_0x474757[_0xdbe2('0x9')]]['callerid']=_0x474757[_0xdbe2('0x2d')]+'\x20<'+_0x474757[_0xdbe2('0xc')]+'>';}utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x2e'),_0x474757[_0xdbe2('0x9')],channels[_0x474757[_0xdbe2('0x9')]][_0xdbe2('0x2f')],_0x474757[_0xdbe2('0x30')]));channels[_0x474757['uniqueid']][_0xdbe2('0x31')]=utils[_0xdbe2('0x23')]();channels[_0x474757[_0xdbe2('0x9')]][_0xdbe2('0x32')]=utils[_0xdbe2('0x33')](channels[_0x474757['uniqueid']][_0xdbe2('0x31')],channels[_0x474757[_0xdbe2('0x9')]][_0xdbe2('0x34')]);channels[_0x474757['uniqueid']]['billableseconds']=channels[_0x474757[_0xdbe2('0x9')]][_0xdbe2('0x27')]?utils['diffTime'](channels[_0x474757['uniqueid']][_0xdbe2('0x31')],channels[_0x474757[_0xdbe2('0x9')]][_0xdbe2('0x27')]):0x0;writeDB(channels[_0x474757[_0xdbe2('0x9')]]);}}catch(_0x534baf){utils[_0xdbe2('0x2a')](util[_0xdbe2('0x16')](_0xdbe2('0x2c'),_0x474757[_0xdbe2('0x9')]),_0x534baf);}};exports[_0xdbe2('0x35')]=function(_0xb4942){try{if(!_[_0xdbe2('0x1f')](channels[_0xb4942[_0xdbe2('0x36')]])){utils[_0xdbe2('0x15')](util[_0xdbe2('0x16')]('[%s][calls][attendedtransfer]',_0xb4942[_0xdbe2('0x37')]),_0xb4942);if(channels[_0xb4942[_0xdbe2('0x36')]]['channel']==_0xb4942['transfereechannel']){utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xb4942[_0xdbe2('0x37')],_0xb4942[_0xdbe2('0x36')],_0xb4942[_0xdbe2('0x38')]));channels[_0xb4942[_0xdbe2('0x36')]][_0xdbe2('0x26')]=_0xb4942[_0xdbe2('0x38')];channels[_0xb4942[_0xdbe2('0x36')]]['userfield']=_0xdbe2('0x39');}else if(channels[_0xb4942[_0xdbe2('0x36')]][_0xdbe2('0x21')]=_0xb4942['transfertargetchannel']){utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x3a'),_0xb4942[_0xdbe2('0x37')],_0xb4942[_0xdbe2('0x36')],_0xb4942['origtransfererchannel']));channels[_0xb4942[_0xdbe2('0x36')]]['destinationchannel']=_0xb4942[_0xdbe2('0x3b')];channels[_0xb4942[_0xdbe2('0x36')]][_0xdbe2('0x3c')]=_0xdbe2('0x39');}}}catch(_0x56d3dd){utils[_0xdbe2('0x2a')](util['format'](_0xdbe2('0x3d'),_0xb4942['origtransfereruniqueid']),_0x56d3dd);}};exports[_0xdbe2('0x3e')]=function(_0x166481){try{if(!_[_0xdbe2('0x1f')](channels[_0x166481[_0xdbe2('0x9')]])){utils[_0xdbe2('0x15')](util['format'](_0xdbe2('0x3f'),_0x166481['uniqueid']),_0x166481);channels[_0x166481[_0xdbe2('0x9')]]['musiconholdstartAt']=utils['now']();utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x40'),_0x166481[_0xdbe2('0x9')],channels[_0x166481[_0xdbe2('0x9')]]['musiconholdstartAt']));}}catch(_0x590014){utils['error'](util[_0xdbe2('0x16')](_0xdbe2('0x3f'),_0x166481['uniqueid']),_0x590014);}};exports[_0xdbe2('0x41')]=function(_0x5de5db){try{if(!_[_0xdbe2('0x1f')](channels[_0x5de5db[_0xdbe2('0x9')]])){utils['debug'](util[_0xdbe2('0x16')]('[%s][calls][musiconholdstop]',_0x5de5db[_0xdbe2('0x9')]),_0x5de5db);if(!_[_0xdbe2('0x1f')](channels[_0x5de5db[_0xdbe2('0x9')]]['musiconholdstartAt'])){channels[_0x5de5db[_0xdbe2('0x9')]][_0xdbe2('0x42')]+=utils[_0xdbe2('0x33')](utils[_0xdbe2('0x23')](),channels[_0x5de5db[_0xdbe2('0x9')]][_0xdbe2('0x43')]);utils[_0xdbe2('0x7')](util['format'](_0xdbe2('0x44'),_0x5de5db[_0xdbe2('0x9')],channels[_0x5de5db[_0xdbe2('0x9')]]['mohtime']));delete channels[_0x5de5db[_0xdbe2('0x9')]][_0xdbe2('0x43')];}}}catch(_0x5651ae){utils[_0xdbe2('0x2a')](util[_0xdbe2('0x16')](_0xdbe2('0x45'),_0x5de5db[_0xdbe2('0x9')]),_0x5651ae);}};exports['varset']=function(_0x6bc679){try{if(!_['isNil'](channels[_0x6bc679[_0xdbe2('0x9')]])){utils['debug'](util[_0xdbe2('0x16')](_0xdbe2('0x46'),_0x6bc679[_0xdbe2('0x9')]),_0x6bc679);if(!_[_0xdbe2('0x1f')](_0x6bc679[_0xdbe2('0x47')]['xmd-originatecalleridnum'])){utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x48'),_0x6bc679[_0xdbe2('0x9')],_0x6bc679[_0xdbe2('0x49')]));channels[_0x6bc679['uniqueid']][_0xdbe2('0x4a')]=_0x6bc679[_0xdbe2('0x49')];}if(!_[_0xdbe2('0x1f')](_0x6bc679[_0xdbe2('0x47')][_0xdbe2('0x4b')])){utils['info'](util[_0xdbe2('0x16')](_0xdbe2('0x4c'),_0x6bc679[_0xdbe2('0x9')],_0x6bc679[_0xdbe2('0x49')]));channels[_0x6bc679[_0xdbe2('0x9')]][_0xdbe2('0x4d')]=_0x6bc679[_0xdbe2('0x49')];channels[_0x6bc679[_0xdbe2('0x9')]][_0xdbe2('0x2f')]='\x22'+_0x6bc679[_0xdbe2('0x49')]+'\x22\x20<'+_0x6bc679[_0xdbe2('0x49')]+'>';}if(!_[_0xdbe2('0x1f')](_0x6bc679[_0xdbe2('0x47')][_0xdbe2('0x4e')])||!_['isNil'](_0x6bc679[_0xdbe2('0x47')]['xmd-callerid'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x6bc679[_0xdbe2('0x9')],!_[_0xdbe2('0x1f')](_0x6bc679[_0xdbe2('0x47')][_0xdbe2('0x4e')])?'xmd-callerid-preview':_0xdbe2('0x4f'),_0x6bc679['value']));channels[_0x6bc679[_0xdbe2('0x9')]][_0xdbe2('0x2f')]=_0x6bc679[_0xdbe2('0x49')];}if(!_['isNil'](_0x6bc679[_0xdbe2('0x47')][_0xdbe2('0x50')])||!_['isNil'](_0x6bc679[_0xdbe2('0x47')][_0xdbe2('0x51')])){utils['info'](util[_0xdbe2('0x16')](_0xdbe2('0x52'),_0x6bc679[_0xdbe2('0x9')],!_['isNil'](_0x6bc679['variable'][_0xdbe2('0x50')])?_0xdbe2('0x50'):_0xdbe2('0x51'),_0x6bc679[_0xdbe2('0x49')]));channels[_0x6bc679[_0xdbe2('0x9')]]['lastapplication']=_0xdbe2('0x53');channels[_0x6bc679[_0xdbe2('0x9')]]['lastdata']=_0x6bc679[_0xdbe2('0x49')];channels[_0x6bc679['uniqueid']][_0xdbe2('0xa')]=!![];}if(!_[_0xdbe2('0x1f')](_0x6bc679[_0xdbe2('0x47')][_0xdbe2('0x54')])){utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x55'),_0x6bc679[_0xdbe2('0x9')],_0x6bc679[_0xdbe2('0x49')]));channels[_0x6bc679[_0xdbe2('0x9')]][_0xdbe2('0x56')]=_0x6bc679[_0xdbe2('0x49')];}if(!_['isNil'](_0x6bc679[_0xdbe2('0x47')]['xmd-cdrtype'])){utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x57'),_0x6bc679[_0xdbe2('0x9')],_0x6bc679[_0xdbe2('0x49')]));channels[_0x6bc679[_0xdbe2('0x9')]][_0xdbe2('0x58')]=_0x6bc679[_0xdbe2('0x49')];}if(!_[_0xdbe2('0x1f')](_0x6bc679[_0xdbe2('0x47')]['outboundrouteid'])){utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x59'),_0x6bc679[_0xdbe2('0x9')],_0x6bc679['value']));channels[_0x6bc679[_0xdbe2('0x9')]]['routeid']=_0x6bc679['value'];}if(!_['isNil'](_0x6bc679[_0xdbe2('0x47')][_0xdbe2('0x5a')])){utils[_0xdbe2('0x7')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x6bc679[_0xdbe2('0x9')],_0x6bc679[_0xdbe2('0x49')]));channels[_0x6bc679[_0xdbe2('0x9')]][_0xdbe2('0x5a')]=_0x6bc679[_0xdbe2('0x49')];}}}catch(_0x3eca92){utils['error'](util[_0xdbe2('0x16')]('[%s][calls][varset]',_0x6bc679[_0xdbe2('0x9')]),_0x3eca92);}};exports['newexten']=function(_0x29b70d){try{if(!_['isNil'](channels[_0x29b70d[_0xdbe2('0x9')]])){utils[_0xdbe2('0x15')](util['format'](_0xdbe2('0x5b'),_0x29b70d[_0xdbe2('0x9')]),_0x29b70d);utils[_0xdbe2('0x7')](util[_0xdbe2('0x16')](_0xdbe2('0x5c'),_0x29b70d[_0xdbe2('0x9')],_0x29b70d[_0xdbe2('0x5d')],_0x29b70d[_0xdbe2('0x5e')]));if(_0x29b70d['application']['toLowerCase']()==_0xdbe2('0x5f')&&_[_0xdbe2('0x60')](_0x29b70d['appdata'][_0xdbe2('0x61')](),_0xdbe2('0x62'))){var _0x4a1d77=_0x29b70d['appdata'][_0xdbe2('0x63')]('=');var _0x5d4abd=_0x4a1d77[0x0]['substring'](_0x4a1d77[0x0][_0xdbe2('0x64')]('(')+0x1,_0x4a1d77[0x0]['lastIndexOf'](')'));var _0x1168cc=_0x4a1d77[0x1];channels[_0x29b70d['uniqueid']][_0x5d4abd]=_0x1168cc;}if(!_['includes']([_0xdbe2('0x65'),_0xdbe2('0x66'),_0xdbe2('0x67'),'set','gotoif'],_0x29b70d[_0xdbe2('0x5d')][_0xdbe2('0x61')]())){channels[_0x29b70d[_0xdbe2('0x9')]][_0xdbe2('0x68')]=_0x29b70d[_0xdbe2('0x5d')];channels[_0x29b70d['uniqueid']][_0xdbe2('0x69')]=_0x29b70d[_0xdbe2('0x5e')];}}}catch(_0x58b945){utils['error'](util['format']('[%s][calls][newexten]',_0x29b70d[_0xdbe2('0x9')]),_0x58b945);}}; \ No newline at end of file +var _0x43ad=['application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','disposition','toNumber','error','debug','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','starttime','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0x43ad,0xf0));var _0xd43a=function(_0xd0ad7d,_0x5ba18f){_0xd0ad7d=_0xd0ad7d-0x0;var _0x42612d=_0x43ad[_0xd0ad7d];return _0x42612d;};'use strict';var _=require(_0xd43a('0x0'));var util=require(_0xd43a('0x1'));var utils=require(_0xd43a('0x2'));var dispositions=['NO\x20ANSWER',_0xd43a('0x3'),_0xd43a('0x3'),_0xd43a('0x4'),_0xd43a('0x4'),_0xd43a('0x4'),_0xd43a('0x5'),_0xd43a('0x6'),_0xd43a('0x3'),_0xd43a('0x3'),_0xd43a('0x3')];var channels={};function writeDB(_0x19aa54){utils[_0xd43a('0x7')](util[_0xd43a('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x19aa54[_0xd43a('0x9')],_0x19aa54[_0xd43a('0xa')],_0x19aa54[_0xd43a('0xb')],_0x19aa54[_0xd43a('0xc')],_0x19aa54[_0xd43a('0xd')],_0x19aa54[_0xd43a('0xe')],_0x19aa54[_0xd43a('0xf')],_0x19aa54['lastevent']));if(_0x19aa54[_0xd43a('0x10')]){utils[_0xd43a('0x11')](_0x19aa54[_0xd43a('0x10')])['then'](function(_0x435725){if(_0x435725){_0x19aa54[_0xd43a('0x12')]=_0x435725['id'];}utils[_0xd43a('0x13')]('CreateVoiceCallReport',_0x19aa54);});}else{utils[_0xd43a('0x13')](_0xd43a('0x14'),_0x19aa54);}if(channels[_0x19aa54[_0xd43a('0x9')]]){delete channels[_0x19aa54[_0xd43a('0x9')]];}}exports[_0xd43a('0x15')]=function(_0x1ac4f6){try{utils['debug'](util['format']('[%s][calls][newchannel]',_0x1ac4f6[_0xd43a('0x9')]),_0x1ac4f6);if(_0x1ac4f6[_0xd43a('0x9')]==_0x1ac4f6[_0xd43a('0x16')]&&_0x1ac4f6[_0xd43a('0xa')]!=_0xd43a('0x17')){utils[_0xd43a('0x7')](util[_0xd43a('0x8')](_0xd43a('0x18'),_0x1ac4f6['uniqueid'],_0x1ac4f6[_0xd43a('0x19')],_0x1ac4f6[_0xd43a('0x1a')]));channels[_0x1ac4f6[_0xd43a('0x9')]]={'uniqueid':_0x1ac4f6['uniqueid'],'accountcode':_0x1ac4f6[_0xd43a('0x10')],'source':_0x1ac4f6[_0xd43a('0xe')],'destination':_0x1ac4f6['exten'],'destinationcontext':_0x1ac4f6[_0xd43a('0x19')],'channel':_0x1ac4f6[_0xd43a('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd43a('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x2eb391){utils['error'](util['format'](_0xd43a('0x1b'),_0x1ac4f6[_0xd43a('0x9')]),_0x2eb391);}};exports[_0xd43a('0x1c')]=function(_0x25be7d){try{utils['debug'](util[_0xd43a('0x8')](_0xd43a('0x1d'),_0x25be7d['uniqueid']),_0x25be7d);if(!_['isNil'](channels[_0x25be7d[_0xd43a('0x9')]])&&_0x25be7d[_0xd43a('0x1e')]==0x6){utils[_0xd43a('0x7')](util[_0xd43a('0x8')](_0xd43a('0x1f'),_0x25be7d['uniqueid'],_0x25be7d[_0xd43a('0x19')],_0x25be7d[_0xd43a('0xa')]));if(_[_0xd43a('0x20')](channels[_0x25be7d[_0xd43a('0x9')]][_0xd43a('0x21')])){channels[_0x25be7d['uniqueid']][_0xd43a('0x21')]=utils['now']();}}else if(!_[_0xd43a('0x20')](channels[_0x25be7d['linkedid']])&&_0x25be7d[_0xd43a('0x1e')]==0x6&&_0x25be7d[_0xd43a('0x19')]!=_0xd43a('0x22')){utils[_0xd43a('0x7')](util['format'](_0xd43a('0x23'),_0x25be7d['uniqueid'],_0x25be7d[_0xd43a('0x16')],_0x25be7d[_0xd43a('0x19')],_0x25be7d[_0xd43a('0xa')]));channels[_0x25be7d[_0xd43a('0x16')]][_0xd43a('0x10')]=_0x25be7d['accountcode'];channels[_0x25be7d[_0xd43a('0x16')]][_0xd43a('0x24')]=_0x25be7d[_0xd43a('0xa')];if(_[_0xd43a('0x20')](channels[_0x25be7d[_0xd43a('0x16')]][_0xd43a('0x25')])){channels[_0x25be7d['linkedid']][_0xd43a('0x25')]=utils[_0xd43a('0x26')]();}channels[_0x25be7d[_0xd43a('0x16')]][_0xd43a('0x27')]=dispositions[_[_0xd43a('0x28')](_0x25be7d[_0xd43a('0x1e')])]||'ANSWERED';}}catch(_0x32e9a5){utils[_0xd43a('0x29')](util[_0xd43a('0x8')](_0xd43a('0x1d'),_0x25be7d[_0xd43a('0x9')]),_0x32e9a5);}};exports['hangup']=function(_0x232694){try{if(!_[_0xd43a('0x20')](channels[_0x232694[_0xd43a('0x9')]])){utils[_0xd43a('0x2a')](util[_0xd43a('0x8')]('[%s][calls][hangup]',_0x232694[_0xd43a('0x9')]),_0x232694);if(_[_0xd43a('0x20')](channels[_0x232694[_0xd43a('0x9')]][_0xd43a('0x2b')])){channels[_0x232694[_0xd43a('0x9')]][_0xd43a('0x2b')]=_0x232694[_0xd43a('0x2c')]+'\x20<'+_0x232694['calleridnum']+'>';}utils[_0xd43a('0x7')](util[_0xd43a('0x8')](_0xd43a('0x2d'),_0x232694['uniqueid'],channels[_0x232694[_0xd43a('0x9')]][_0xd43a('0x2b')],_0x232694[_0xd43a('0x2e')]));channels[_0x232694[_0xd43a('0x9')]]['endtime']=utils[_0xd43a('0x26')]();channels[_0x232694[_0xd43a('0x9')]][_0xd43a('0x2f')]=utils['diffTime'](channels[_0x232694[_0xd43a('0x9')]][_0xd43a('0x30')],channels[_0x232694[_0xd43a('0x9')]][_0xd43a('0x31')]);channels[_0x232694[_0xd43a('0x9')]]['billableseconds']=channels[_0x232694[_0xd43a('0x9')]]['answertime']?utils['diffTime'](channels[_0x232694[_0xd43a('0x9')]]['endtime'],channels[_0x232694[_0xd43a('0x9')]][_0xd43a('0x25')]):0x0;writeDB(channels[_0x232694['uniqueid']]);}}catch(_0x2845ca){utils[_0xd43a('0x29')](util[_0xd43a('0x8')](_0xd43a('0x32'),_0x232694[_0xd43a('0x9')]),_0x2845ca);}};exports[_0xd43a('0x33')]=function(_0x2d83b0){try{if(!_[_0xd43a('0x20')](channels[_0x2d83b0['localtwolinkedid']])){utils['debug'](util[_0xd43a('0x8')](_0xd43a('0x34'),_0x2d83b0[_0xd43a('0x35')]),_0x2d83b0);if(channels[_0x2d83b0[_0xd43a('0x36')]][_0xd43a('0xa')]==_0x2d83b0[_0xd43a('0x37')]){utils['info'](util['format'](_0xd43a('0x38'),_0x2d83b0[_0xd43a('0x35')],_0x2d83b0[_0xd43a('0x36')],_0x2d83b0['secondtransfererchannel']));channels[_0x2d83b0[_0xd43a('0x36')]][_0xd43a('0x24')]=_0x2d83b0[_0xd43a('0x39')];channels[_0x2d83b0[_0xd43a('0x36')]][_0xd43a('0x3a')]=_0xd43a('0x3b');}else if(channels[_0x2d83b0[_0xd43a('0x36')]][_0xd43a('0xa')]=_0x2d83b0[_0xd43a('0x3c')]){utils[_0xd43a('0x7')](util[_0xd43a('0x8')](_0xd43a('0x38'),_0x2d83b0[_0xd43a('0x35')],_0x2d83b0[_0xd43a('0x36')],_0x2d83b0[_0xd43a('0x3d')]));channels[_0x2d83b0[_0xd43a('0x36')]]['destinationchannel']=_0x2d83b0[_0xd43a('0x3d')];channels[_0x2d83b0['localtwolinkedid']][_0xd43a('0x3a')]=_0xd43a('0x3b');}}}catch(_0x537eac){utils['error'](util['format']('[%s][calls][attendedtransfer]',_0x2d83b0[_0xd43a('0x35')]),_0x537eac);}};exports['musiconholdstart']=function(_0x188065){try{if(!_[_0xd43a('0x20')](channels[_0x188065[_0xd43a('0x9')]])){utils[_0xd43a('0x2a')](util[_0xd43a('0x8')](_0xd43a('0x3e'),_0x188065[_0xd43a('0x9')]),_0x188065);channels[_0x188065['uniqueid']][_0xd43a('0x3f')]=utils[_0xd43a('0x26')]();utils[_0xd43a('0x7')](util[_0xd43a('0x8')](_0xd43a('0x40'),_0x188065[_0xd43a('0x9')],channels[_0x188065['uniqueid']][_0xd43a('0x3f')]));}}catch(_0x163e87){utils[_0xd43a('0x29')](util[_0xd43a('0x8')]('[%s][calls][musiconholdstart]',_0x188065[_0xd43a('0x9')]),_0x163e87);}};exports[_0xd43a('0x41')]=function(_0x46f85f){try{if(!_[_0xd43a('0x20')](channels[_0x46f85f['uniqueid']])){utils['debug'](util['format'](_0xd43a('0x42'),_0x46f85f[_0xd43a('0x9')]),_0x46f85f);if(!_[_0xd43a('0x20')](channels[_0x46f85f['uniqueid']][_0xd43a('0x3f')])){channels[_0x46f85f[_0xd43a('0x9')]][_0xd43a('0x43')]+=utils[_0xd43a('0x44')](utils[_0xd43a('0x26')](),channels[_0x46f85f['uniqueid']][_0xd43a('0x3f')]);utils[_0xd43a('0x7')](util[_0xd43a('0x8')](_0xd43a('0x45'),_0x46f85f[_0xd43a('0x9')],channels[_0x46f85f[_0xd43a('0x9')]][_0xd43a('0x43')]));delete channels[_0x46f85f['uniqueid']][_0xd43a('0x3f')];}}}catch(_0x1971bc){utils['error'](util[_0xd43a('0x8')](_0xd43a('0x42'),_0x46f85f['uniqueid']),_0x1971bc);}};exports[_0xd43a('0x46')]=function(_0xbc6224){try{if(!_[_0xd43a('0x20')](channels[_0xbc6224[_0xd43a('0x9')]])){utils[_0xd43a('0x2a')](util[_0xd43a('0x8')](_0xd43a('0x47'),_0xbc6224[_0xd43a('0x9')]),_0xbc6224);if(!_['isNil'](_0xbc6224[_0xd43a('0x48')][_0xd43a('0x49')])){utils[_0xd43a('0x7')](util['format'](_0xd43a('0x4a'),_0xbc6224[_0xd43a('0x9')],_0xbc6224['value']));channels[_0xbc6224[_0xd43a('0x9')]][_0xd43a('0x4b')]=_0xbc6224[_0xd43a('0x4c')];}if(!_[_0xd43a('0x20')](_0xbc6224[_0xd43a('0x48')][_0xd43a('0x4d')])){utils['info'](util[_0xd43a('0x8')](_0xd43a('0x4e'),_0xbc6224[_0xd43a('0x9')],_0xbc6224[_0xd43a('0x4c')]));channels[_0xbc6224['uniqueid']][_0xd43a('0x4f')]=_0xbc6224[_0xd43a('0x4c')];channels[_0xbc6224[_0xd43a('0x9')]][_0xd43a('0x2b')]='\x22'+_0xbc6224[_0xd43a('0x4c')]+_0xd43a('0x50')+_0xbc6224[_0xd43a('0x4c')]+'>';}if(!_[_0xd43a('0x20')](_0xbc6224[_0xd43a('0x48')]['xmd-callerid-preview'])||!_[_0xd43a('0x20')](_0xbc6224['variable']['xmd-callerid'])){utils[_0xd43a('0x7')](util['format'](_0xd43a('0x51'),_0xbc6224['uniqueid'],!_['isNil'](_0xbc6224[_0xd43a('0x48')][_0xd43a('0x52')])?_0xd43a('0x52'):_0xd43a('0x53'),_0xbc6224['value']));channels[_0xbc6224['uniqueid']][_0xd43a('0x2b')]=_0xbc6224[_0xd43a('0x4c')];}if(!_['isNil'](_0xbc6224[_0xd43a('0x48')]['xmd-queue'])||!_[_0xd43a('0x20')](_0xbc6224[_0xd43a('0x48')]['xmcs-queue'])){utils[_0xd43a('0x7')](util[_0xd43a('0x8')](_0xd43a('0x51'),_0xbc6224[_0xd43a('0x9')],!_[_0xd43a('0x20')](_0xbc6224[_0xd43a('0x48')]['xmd-queue'])?_0xd43a('0x54'):'xmcs-queue',_0xbc6224[_0xd43a('0x4c')]));channels[_0xbc6224[_0xd43a('0x9')]][_0xd43a('0x55')]=_0xd43a('0x56');channels[_0xbc6224['uniqueid']][_0xd43a('0x57')]=_0xbc6224[_0xd43a('0x4c')];channels[_0xbc6224['uniqueid']][_0xd43a('0xb')]=!![];}if(!_['isNil'](_0xbc6224[_0xd43a('0x48')][_0xd43a('0x58')])){utils[_0xd43a('0x7')](util[_0xd43a('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xbc6224[_0xd43a('0x9')],_0xbc6224['value']));channels[_0xbc6224[_0xd43a('0x9')]]['ContactId']=_0xbc6224[_0xd43a('0x4c')];}if(!_[_0xd43a('0x20')](_0xbc6224[_0xd43a('0x48')][_0xd43a('0x59')])){utils['info'](util['format'](_0xd43a('0x5a'),_0xbc6224[_0xd43a('0x9')],_0xbc6224[_0xd43a('0x4c')]));channels[_0xbc6224['uniqueid']][_0xd43a('0x5b')]=_0xbc6224[_0xd43a('0x4c')];}if(!_[_0xd43a('0x20')](_0xbc6224[_0xd43a('0x48')][_0xd43a('0x5c')])){utils[_0xd43a('0x7')](util[_0xd43a('0x8')](_0xd43a('0x5d'),_0xbc6224[_0xd43a('0x9')],_0xbc6224[_0xd43a('0x4c')]));channels[_0xbc6224[_0xd43a('0x9')]][_0xd43a('0x5e')]=_0xbc6224[_0xd43a('0x4c')];}if(!_[_0xd43a('0x20')](_0xbc6224['variable'][_0xd43a('0x5f')])){utils['info'](util[_0xd43a('0x8')](_0xd43a('0x60'),_0xbc6224[_0xd43a('0x9')],_0xbc6224['value']));channels[_0xbc6224[_0xd43a('0x9')]]['sipcallid']=_0xbc6224[_0xd43a('0x4c')];}}}catch(_0x144cff){utils[_0xd43a('0x29')](util['format']('[%s][calls][varset]',_0xbc6224['uniqueid']),_0x144cff);}};exports[_0xd43a('0x61')]=function(_0x346ed8){try{if(!_['isNil'](channels[_0x346ed8[_0xd43a('0x9')]])){utils[_0xd43a('0x2a')](util[_0xd43a('0x8')](_0xd43a('0x62'),_0x346ed8[_0xd43a('0x9')]),_0x346ed8);utils[_0xd43a('0x7')](util[_0xd43a('0x8')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x346ed8[_0xd43a('0x9')],_0x346ed8[_0xd43a('0x63')],_0x346ed8[_0xd43a('0x64')]));if(_0x346ed8[_0xd43a('0x63')]['toLowerCase']()==_0xd43a('0x65')&&_[_0xd43a('0x66')](_0x346ed8['appdata'][_0xd43a('0x67')](),_0xd43a('0x68'))){var _0x79268a=_0x346ed8[_0xd43a('0x64')][_0xd43a('0x69')]('=');var _0x1546bf=_0x79268a[0x0][_0xd43a('0x6a')](_0x79268a[0x0][_0xd43a('0x6b')]('(')+0x1,_0x79268a[0x0][_0xd43a('0x6b')](')'));var _0x537be4=_0x79268a[0x1];channels[_0x346ed8[_0xd43a('0x9')]][_0x1546bf]=_0x537be4;}if(!_[_0xd43a('0x6c')]([_0xd43a('0x6d'),_0xd43a('0x6e'),_0xd43a('0x6f'),_0xd43a('0x65'),_0xd43a('0x70')],_0x346ed8[_0xd43a('0x63')][_0xd43a('0x67')]())){channels[_0x346ed8[_0xd43a('0x9')]]['lastapplication']=_0x346ed8[_0xd43a('0x63')];channels[_0x346ed8['uniqueid']][_0xd43a('0x57')]=_0x346ed8[_0xd43a('0x64')];}}}catch(_0x233c96){utils['error'](util[_0xd43a('0x8')](_0xd43a('0x62'),_0x346ed8['uniqueid']),_0x233c96);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ffbfbc2..66eeb3b 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d82=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','error','close','[core]\x20close'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x8d82,0x65));var _0x28d8=function(_0x532da2,_0xc1faa6){_0x532da2=_0x532da2-0x0;var _0x923dde=_0x8d82[_0x532da2];return _0x923dde;};'use strict';var utils=require(_0x28d8('0x0'));exports[_0x28d8('0x1')]=function(){utils[_0x28d8('0x2')](_0x28d8('0x3'));};exports[_0x28d8('0x4')]=function(){utils[_0x28d8('0x2')](_0x28d8('0x5'));};exports['fullybooted']=function(){utils[_0x28d8('0x2')]('[core]\x20fullybooted');};exports[_0x28d8('0x6')]=function(_0x24eac7){utils[_0x28d8('0x6')]('[core]\x20error',_0x24eac7);};exports[_0x28d8('0x7')]=function(){utils['info'](_0x28d8('0x8'));};exports[_0x28d8('0x9')]=function(_0xea4202){}; \ No newline at end of file +var _0x576b=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','info','[core]\x20close','managerevent'];(function(_0x85fbb2,_0x55d447){var _0x2c94e5=function(_0x3bd403){while(--_0x3bd403){_0x85fbb2['push'](_0x85fbb2['shift']());}};_0x2c94e5(++_0x55d447);}(_0x576b,0x1d9));var _0xb576=function(_0x33769b,_0x221281){_0x33769b=_0x33769b-0x0;var _0x4d1cfa=_0x576b[_0x33769b];return _0x4d1cfa;};'use strict';var utils=require('./utils');exports['connect']=function(){utils['info'](_0xb576('0x0'));};exports[_0xb576('0x1')]=function(){utils['info'](_0xb576('0x2'));};exports[_0xb576('0x3')]=function(){utils['info'](_0xb576('0x4'));};exports[_0xb576('0x5')]=function(_0x5b70f5){utils[_0xb576('0x5')](_0xb576('0x6'),_0x5b70f5);};exports[_0xb576('0x7')]=function(){utils[_0xb576('0x8')](_0xb576('0x9'));};exports[_0xb576('0xa')]=function(_0x450f16){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index fe45a81..7ee78ec 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddc2=['holdtime','diffTime','billableseconds','endtime','util','info','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr(routeid)','appdata','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','starttime','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','duration'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0xddc2,0x136));var _0x2ddc=function(_0xf6a0cd,_0x232aa6){_0xf6a0cd=_0xf6a0cd-0x0;var _0x536a56=_0xddc2[_0xf6a0cd];return _0x536a56;};'use strict';var _=require('lodash');var util=require(_0x2ddc('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x18baa7){utils[_0x2ddc('0x1')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x18baa7[_0x2ddc('0x2')],_0x18baa7[_0x2ddc('0x3')],_0x18baa7[_0x2ddc('0x4')],_0x18baa7['calleridnum'],_0x18baa7[_0x2ddc('0x5')],_0x18baa7[_0x2ddc('0x6')]));utils[_0x2ddc('0x7')](_0x2ddc('0x8'),_0x18baa7);delete dials[_0x18baa7[_0x2ddc('0x2')]];}exports[_0x2ddc('0x9')]=function(_0x22013f){try{utils[_0x2ddc('0xa')](util['format']('[%s][dials][newexten]',_0x22013f[_0x2ddc('0x2')]),_0x22013f);utils[_0x2ddc('0x1')](util[_0x2ddc('0xb')](_0x2ddc('0xc'),_0x22013f[_0x2ddc('0x2')],_0x22013f[_0x2ddc('0xd')],_0x22013f['appdata']));if(_0x22013f[_0x2ddc('0xd')][_0x2ddc('0xe')]()==_0x2ddc('0xf')&&_[_0x2ddc('0x10')](_0x22013f['appdata']['toLowerCase'](),_0x2ddc('0x11'))){var _0x9e50af=_0x22013f[_0x2ddc('0x12')][_0x2ddc('0x13')]('=');dials[_0x22013f['uniqueid']]={'routeId':_0x9e50af[0x1]};}}catch(_0x24429d){utils[_0x2ddc('0x14')](util['format'](_0x2ddc('0x15'),_0x22013f['uniqueid']),_0x24429d);}};exports[_0x2ddc('0x16')]=function(_0x5522af){try{utils[_0x2ddc('0xa')](util[_0x2ddc('0xb')](_0x2ddc('0x17'),_0x5522af[_0x2ddc('0x2')]),_0x5522af);if(!_[_0x2ddc('0x18')](_0x5522af[_0x2ddc('0x19')][_0x2ddc('0x1a')])){utils[_0x2ddc('0x1')](util[_0x2ddc('0xb')](_0x2ddc('0x1b'),_0x5522af[_0x2ddc('0x2')],_0x5522af[_0x2ddc('0x1c')]));dials[_0x5522af[_0x2ddc('0x2')]]={'routeId':_0x5522af[_0x2ddc('0x1c')]};}}catch(_0x2bce25){utils[_0x2ddc('0x14')](util[_0x2ddc('0xb')]('[%s][dials][varset]',_0x5522af[_0x2ddc('0x2')]),_0x2bce25);}};exports[_0x2ddc('0x1d')]=function(_0x564db2){try{if(!_[_0x2ddc('0x18')](dials[_0x564db2[_0x2ddc('0x2')]])){utils[_0x2ddc('0xa')](util[_0x2ddc('0xb')](_0x2ddc('0x1e'),_0x564db2['uniqueid']),_0x564db2);dials[_0x564db2['uniqueid']]=_['assign'](dials[_0x564db2[_0x2ddc('0x2')]],_0x564db2);dials[_0x564db2[_0x2ddc('0x2')]]['starttime']=utils[_0x2ddc('0x1f')]();dials[_0x564db2[_0x2ddc('0x2')]][_0x2ddc('0x20')]=_0x2ddc('0x21');utils['info'](util[_0x2ddc('0xb')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x564db2[_0x2ddc('0x2')],dials[_0x564db2[_0x2ddc('0x2')]][_0x2ddc('0x22')]));}}catch(_0x21b50e){utils[_0x2ddc('0x14')](util[_0x2ddc('0xb')](_0x2ddc('0x1e'),_0x564db2[_0x2ddc('0x2')]),_0x21b50e);}};exports[_0x2ddc('0x23')]=function(_0x2fc3dd){try{if(!_[_0x2ddc('0x18')](dials[_0x2fc3dd[_0x2ddc('0x2')]])){utils[_0x2ddc('0xa')](util[_0x2ddc('0xb')](_0x2ddc('0x24'),_0x2fc3dd[_0x2ddc('0x2')]),_0x2fc3dd);dials[_0x2fc3dd[_0x2ddc('0x2')]][_0x2ddc('0x6')]=_0x2fc3dd[_0x2ddc('0x6')];if(_0x2fc3dd['dialstatus']==_0x2ddc('0x25')){dials[_0x2fc3dd[_0x2ddc('0x2')]]=_[_0x2ddc('0x26')](dials[_0x2fc3dd['uniqueid']],_0x2fc3dd);dials[_0x2fc3dd['uniqueid']][_0x2ddc('0x27')]=utils[_0x2ddc('0x1f')]();dials[_0x2fc3dd[_0x2ddc('0x2')]][_0x2ddc('0x20')]='connect';utils[_0x2ddc('0x1')](util[_0x2ddc('0xb')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x2fc3dd['uniqueid'],_0x2fc3dd[_0x2ddc('0x6')],dials[_0x2fc3dd[_0x2ddc('0x2')]]['answertime']));}else{utils[_0x2ddc('0x1')](util[_0x2ddc('0xb')](_0x2ddc('0x28'),_0x2fc3dd[_0x2ddc('0x2')],_0x2fc3dd[_0x2ddc('0x6')]));}}}catch(_0x16e05d){utils[_0x2ddc('0x14')](util[_0x2ddc('0xb')](_0x2ddc('0x24'),_0x2fc3dd[_0x2ddc('0x2')]),_0x16e05d);}};exports[_0x2ddc('0x29')]=function(_0x3bb76d){try{if(!_[_0x2ddc('0x18')](dials[_0x3bb76d['uniqueid']])){utils[_0x2ddc('0xa')](util['format']('[%s][dials][hangup]',_0x3bb76d['uniqueid']),_0x3bb76d);utils[_0x2ddc('0x1')](util[_0x2ddc('0xb')](_0x2ddc('0x2a'),_0x3bb76d[_0x2ddc('0x2')],_0x3bb76d[_0x2ddc('0x2b')],_0x3bb76d['calleridname'],_0x3bb76d[_0x2ddc('0x2c')]));dials[_0x3bb76d[_0x2ddc('0x2')]]=_[_0x2ddc('0x26')](dials[_0x3bb76d[_0x2ddc('0x2')]],{'endtime':utils['now'](),'lastevent':_0x2ddc('0x2d')});dials[_0x3bb76d[_0x2ddc('0x2')]][_0x2ddc('0x2e')]=utils['diffTime'](dials[_0x3bb76d[_0x2ddc('0x2')]]['endtime'],dials[_0x3bb76d[_0x2ddc('0x2')]]['starttime']);dials[_0x3bb76d['uniqueid']][_0x2ddc('0x2f')]=utils[_0x2ddc('0x30')](dials[_0x3bb76d['uniqueid']][_0x2ddc('0x27')]||dials[_0x3bb76d[_0x2ddc('0x2')]]['endtime'],dials[_0x3bb76d[_0x2ddc('0x2')]][_0x2ddc('0x22')]);dials[_0x3bb76d['uniqueid']][_0x2ddc('0x31')]=dials[_0x3bb76d[_0x2ddc('0x2')]][_0x2ddc('0x27')]?utils[_0x2ddc('0x30')](dials[_0x3bb76d[_0x2ddc('0x2')]][_0x2ddc('0x32')],dials[_0x3bb76d[_0x2ddc('0x2')]]['answertime']):0x0;writeDB(dials[_0x3bb76d[_0x2ddc('0x2')]]);}}catch(_0x241acd){utils[_0x2ddc('0x14')](util[_0x2ddc('0xb')]('[%s][dials][hangup]',_0x3bb76d[_0x2ddc('0x2')]),_0x241acd);}}; \ No newline at end of file +var _0xf582=['dialstatus','request','CreateVoiceDialReport','newexten','debug','format','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum'];(function(_0xbd464a,_0x2bb0de){var _0x56af45=function(_0x49ceae){while(--_0x49ceae){_0xbd464a['push'](_0xbd464a['shift']());}};_0x56af45(++_0x2bb0de);}(_0xf582,0x1ca));var _0x2f58=function(_0x41b48a,_0x387179){_0x41b48a=_0x41b48a-0x0;var _0xf06357=_0xf582[_0x41b48a];return _0xf06357;};'use strict';var _=require(_0x2f58('0x0'));var util=require(_0x2f58('0x1'));var utils=require(_0x2f58('0x2'));var dials={};function writeDB(_0x486424){utils[_0x2f58('0x3')](util['format'](_0x2f58('0x4'),_0x486424[_0x2f58('0x5')],_0x486424[_0x2f58('0x6')],_0x486424[_0x2f58('0x7')],_0x486424[_0x2f58('0x8')],_0x486424[_0x2f58('0x9')],_0x486424[_0x2f58('0xa')]));utils[_0x2f58('0xb')](_0x2f58('0xc'),_0x486424);delete dials[_0x486424[_0x2f58('0x5')]];}exports[_0x2f58('0xd')]=function(_0x3fa375){try{utils[_0x2f58('0xe')](util[_0x2f58('0xf')]('[%s][dials][newexten]',_0x3fa375[_0x2f58('0x5')]),_0x3fa375);utils['info'](util[_0x2f58('0xf')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3fa375[_0x2f58('0x5')],_0x3fa375[_0x2f58('0x10')],_0x3fa375[_0x2f58('0x11')]));if(_0x3fa375['application'][_0x2f58('0x12')]()=='set'&&_[_0x2f58('0x13')](_0x3fa375[_0x2f58('0x11')][_0x2f58('0x12')](),_0x2f58('0x14'))){var _0x3f27c5=_0x3fa375['appdata']['split']('=');dials[_0x3fa375[_0x2f58('0x5')]]={'routeId':_0x3f27c5[0x1]};}}catch(_0x33ebfe){utils[_0x2f58('0x15')](util['format']('[%s][dials][newexten]',_0x3fa375['uniqueid']),_0x33ebfe);}};exports[_0x2f58('0x16')]=function(_0x1d5b25){try{utils['debug'](util[_0x2f58('0xf')](_0x2f58('0x17'),_0x1d5b25['uniqueid']),_0x1d5b25);if(!_['isNil'](_0x1d5b25[_0x2f58('0x18')][_0x2f58('0x19')])){utils[_0x2f58('0x3')](util[_0x2f58('0xf')](_0x2f58('0x1a'),_0x1d5b25['uniqueid'],_0x1d5b25[_0x2f58('0x1b')]));dials[_0x1d5b25[_0x2f58('0x5')]]={'routeId':_0x1d5b25['value']};}}catch(_0x402df2){utils[_0x2f58('0x15')](util[_0x2f58('0xf')](_0x2f58('0x17'),_0x1d5b25[_0x2f58('0x5')]),_0x402df2);}};exports[_0x2f58('0x1c')]=function(_0x10f8a4){try{if(!_[_0x2f58('0x1d')](dials[_0x10f8a4[_0x2f58('0x5')]])){utils[_0x2f58('0xe')](util[_0x2f58('0xf')](_0x2f58('0x1e'),_0x10f8a4[_0x2f58('0x5')]),_0x10f8a4);dials[_0x10f8a4[_0x2f58('0x5')]]=_[_0x2f58('0x1f')](dials[_0x10f8a4['uniqueid']],_0x10f8a4);dials[_0x10f8a4['uniqueid']][_0x2f58('0x20')]=utils[_0x2f58('0x21')]();dials[_0x10f8a4['uniqueid']][_0x2f58('0x22')]=_0x2f58('0x23');utils['info'](util[_0x2f58('0xf')](_0x2f58('0x24'),_0x10f8a4[_0x2f58('0x5')],dials[_0x10f8a4[_0x2f58('0x5')]][_0x2f58('0x20')]));}}catch(_0x54957b){utils[_0x2f58('0x15')](util[_0x2f58('0xf')](_0x2f58('0x1e'),_0x10f8a4['uniqueid']),_0x54957b);}};exports[_0x2f58('0x25')]=function(_0x5586af){try{if(!_[_0x2f58('0x1d')](dials[_0x5586af[_0x2f58('0x5')]])){utils[_0x2f58('0xe')](util[_0x2f58('0xf')](_0x2f58('0x26'),_0x5586af[_0x2f58('0x5')]),_0x5586af);dials[_0x5586af[_0x2f58('0x5')]][_0x2f58('0xa')]=_0x5586af[_0x2f58('0xa')];if(_0x5586af[_0x2f58('0xa')]==_0x2f58('0x27')){dials[_0x5586af[_0x2f58('0x5')]]=_[_0x2f58('0x1f')](dials[_0x5586af['uniqueid']],_0x5586af);dials[_0x5586af[_0x2f58('0x5')]][_0x2f58('0x28')]=utils[_0x2f58('0x21')]();dials[_0x5586af[_0x2f58('0x5')]][_0x2f58('0x22')]=_0x2f58('0x29');utils[_0x2f58('0x3')](util[_0x2f58('0xf')](_0x2f58('0x2a'),_0x5586af[_0x2f58('0x5')],_0x5586af[_0x2f58('0xa')],dials[_0x5586af[_0x2f58('0x5')]]['answertime']));}else{utils[_0x2f58('0x3')](util[_0x2f58('0xf')](_0x2f58('0x2b'),_0x5586af[_0x2f58('0x5')],_0x5586af[_0x2f58('0xa')]));}}}catch(_0x6d705){utils[_0x2f58('0x15')](util['format'](_0x2f58('0x26'),_0x5586af[_0x2f58('0x5')]),_0x6d705);}};exports['hangup']=function(_0x4ae74d){try{if(!_[_0x2f58('0x1d')](dials[_0x4ae74d[_0x2f58('0x5')]])){utils['debug'](util['format'](_0x2f58('0x2c'),_0x4ae74d[_0x2f58('0x5')]),_0x4ae74d);utils['info'](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4ae74d['uniqueid'],_0x4ae74d['calleridnum'],_0x4ae74d['calleridname'],_0x4ae74d[_0x2f58('0x2d')]));dials[_0x4ae74d['uniqueid']]=_['assign'](dials[_0x4ae74d[_0x2f58('0x5')]],{'endtime':utils[_0x2f58('0x21')](),'lastevent':_0x2f58('0x2e')});dials[_0x4ae74d['uniqueid']][_0x2f58('0x2f')]=utils[_0x2f58('0x30')](dials[_0x4ae74d[_0x2f58('0x5')]][_0x2f58('0x31')],dials[_0x4ae74d[_0x2f58('0x5')]][_0x2f58('0x20')]);dials[_0x4ae74d[_0x2f58('0x5')]][_0x2f58('0x32')]=utils[_0x2f58('0x30')](dials[_0x4ae74d[_0x2f58('0x5')]][_0x2f58('0x28')]||dials[_0x4ae74d[_0x2f58('0x5')]][_0x2f58('0x31')],dials[_0x4ae74d[_0x2f58('0x5')]]['starttime']);dials[_0x4ae74d['uniqueid']][_0x2f58('0x33')]=dials[_0x4ae74d[_0x2f58('0x5')]][_0x2f58('0x28')]?utils['diffTime'](dials[_0x4ae74d[_0x2f58('0x5')]][_0x2f58('0x31')],dials[_0x4ae74d[_0x2f58('0x5')]][_0x2f58('0x28')]):0x0;writeDB(dials[_0x4ae74d[_0x2f58('0x5')]]);}}catch(_0x2adab8){utils[_0x2f58('0x15')](util[_0x2f58('0xf')](_0x2f58('0x2c'),_0x4ae74d[_0x2f58('0x5')]),_0x2adab8);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 148af7d..f986112 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42c8=['[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x42c8,0x96));var _0x842c=function(_0x500812,_0x296a3c){_0x500812=_0x500812-0x0;var _0x4add02=_0x42c8[_0x500812];return _0x4add02;};var AsteriskManager=require(_0x842c('0x0'));var config=require(_0x842c('0x1'));var utils=require(_0x842c('0x2'));var util=require(_0x842c('0x3'));var isXDREnabled=config[_0x842c('0x4')]&&config[_0x842c('0x4')][_0x842c('0x5')]?!config['xdr'][_0x842c('0x5')]:!![];var isProduction=config[_0x842c('0x6')]==='production'||![];var isLocalAsterisk=config[_0x842c('0x4')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x842c('0x7')][_0x842c('0x8')],config[_0x842c('0x7')]['ip'],config[_0x842c('0x7')]['username'],config['asterisk'][_0x842c('0x9')],!![]);ami[_0x842c('0xa')]();if(!isXDREnabled){utils[_0x842c('0xb')](_0x842c('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x842c('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x842c('0xd'));var calls=require('./calls.controller');var queues=require(_0x842c('0xe'));var recordings=require(_0x842c('0xf'));var members=require(_0x842c('0x10'));var dials=require(_0x842c('0x11'));var transfers=require(_0x842c('0x12'));var core=require('./core.controller');ami['on'](_0x842c('0x13'),core[_0x842c('0x13')]);ami['on'](_0x842c('0x14'),core['shutdown']);ami['on'](_0x842c('0x15'),core[_0x842c('0x15')]);ami['on'](_0x842c('0x16'),core[_0x842c('0x16')]);ami['on']('close',core['close']);ami['on'](_0x842c('0x17'),core[_0x842c('0x17')]);ami['on'](_0x842c('0x18'),function(_0x150649){try{utils['debug'](util[_0x842c('0x19')](_0x842c('0x1a'),_0x150649[_0x842c('0x1b')]),_0x150649);members[_0x842c('0x18')](_0x150649);}catch(_0x52c007){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x1a'),_0x150649['device']),_0x52c007);}});ami['on'](_0x842c('0x1c'),function(_0x594f5b){try{utils[_0x842c('0x1d')](util[_0x842c('0x19')]('[%s][index][agentcalled]',_0x594f5b[_0x842c('0x1e')]),_0x594f5b);agents['agentcalled'](_0x594f5b);}catch(_0x3e1fb7){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x1f'),_0x594f5b[_0x842c('0x1e')]),_0x3e1fb7);}});ami['on'](_0x842c('0x20'),function(_0x59a883){try{utils['debug'](util[_0x842c('0x19')](_0x842c('0x21'),_0x59a883[_0x842c('0x1e')]),_0x59a883);agents[_0x842c('0x20')](_0x59a883);}catch(_0x5dbbfb){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x21'),_0x59a883[_0x842c('0x1e')]),_0x5dbbfb);}});ami['on']('agentconnect',function(_0x568328){try{utils[_0x842c('0x1d')](util[_0x842c('0x19')](_0x842c('0x22'),_0x568328['uniqueid']),_0x568328);agents[_0x842c('0x23')](_0x568328);queues['agentconnect'](_0x568328);}catch(_0x5356e5){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x22'),_0x568328[_0x842c('0x1e')]),_0x5356e5);}});ami['on'](_0x842c('0x24'),function(_0x1364a0){try{utils[_0x842c('0x1d')](util[_0x842c('0x19')](_0x842c('0x25'),_0x1364a0[_0x842c('0x1e')]),_0x1364a0);agents[_0x842c('0x24')](_0x1364a0);queues['agentcomplete'](_0x1364a0);members[_0x842c('0x24')](_0x1364a0);}catch(_0x4a9da3){utils[_0x842c('0x16')](util[_0x842c('0x19')]('[%s][index][agentcomplete]',_0x1364a0[_0x842c('0x1e')]),_0x4a9da3);}});ami['on'](_0x842c('0x26'),function(_0x1d4698){try{utils['debug'](util['format']('[%s][index][queuecallerabandon]',_0x1d4698[_0x842c('0x1e')]),_0x1d4698);agents['queuecallerabandon'](_0x1d4698);queues['queuecallerabandon'](_0x1d4698);}catch(_0x608bf3){utils['error'](util['format'](_0x842c('0x27'),_0x1d4698[_0x842c('0x1e')]),_0x608bf3);}});ami['on'](_0x842c('0x28'),function(_0x3fc109){try{utils['debug'](util[_0x842c('0x19')](_0x842c('0x29'),_0x3fc109[_0x842c('0x1e')]),_0x3fc109);queues[_0x842c('0x28')](_0x3fc109);recordings['queuecallerjoin'](_0x3fc109);}catch(_0x331d99){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x29'),_0x3fc109['uniqueid']),_0x331d99);}});ami['on'](_0x842c('0x2a'),function(_0x598889){try{utils[_0x842c('0x1d')](util['format'](_0x842c('0x2b'),_0x598889[_0x842c('0x1e')]),_0x598889);queues[_0x842c('0x2a')](_0x598889);}catch(_0x5f4270){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x2b'),_0x598889[_0x842c('0x1e')]),_0x5f4270);}});ami['on'](_0x842c('0x2c'),function(_0x520c0b){try{utils[_0x842c('0x1d')](util[_0x842c('0x19')]('[%s][index][musiconholdstart]',_0x520c0b[_0x842c('0x1e')]),_0x520c0b);queues[_0x842c('0x2c')](_0x520c0b);calls[_0x842c('0x2c')](_0x520c0b);}catch(_0x4b6dd5){utils['error'](util['format'](_0x842c('0x2d'),_0x520c0b[_0x842c('0x1e')]),_0x4b6dd5);}});ami['on'](_0x842c('0x2e'),function(_0x547f97){try{utils[_0x842c('0x1d')](util[_0x842c('0x19')](_0x842c('0x2f'),_0x547f97[_0x842c('0x1e')]),_0x547f97);queues['musiconholdstop'](_0x547f97);calls['musiconholdstop'](_0x547f97);}catch(_0x557a31){utils[_0x842c('0x16')](util['format'](_0x842c('0x2f'),_0x547f97[_0x842c('0x1e')]),_0x557a31);}});ami['on'](_0x842c('0x30'),function(_0x36f38b){try{utils['debug'](util['format']('[%s][index][newstate]',_0x36f38b[_0x842c('0x1e')]),_0x36f38b);calls[_0x842c('0x30')](_0x36f38b);recordings[_0x842c('0x30')](_0x36f38b);}catch(_0x498858){utils['error'](util[_0x842c('0x19')](_0x842c('0x31'),_0x36f38b[_0x842c('0x1e')]),_0x498858);}});ami['on'](_0x842c('0x32'),function(_0x632ac2){try{utils['debug'](util[_0x842c('0x19')](_0x842c('0x33'),_0x632ac2[_0x842c('0x1e')]),_0x632ac2);calls[_0x842c('0x32')](_0x632ac2);recordings[_0x842c('0x32')](_0x632ac2);dials[_0x842c('0x32')](_0x632ac2);agents[_0x842c('0x32')](_0x632ac2);queues[_0x842c('0x32')](_0x632ac2);}catch(_0x88fcd){utils[_0x842c('0x16')](util[_0x842c('0x19')]('[%s][index][hangup]',_0x632ac2[_0x842c('0x1e')]),_0x88fcd);}});ami['on'](_0x842c('0x34'),function(_0x169443){try{utils[_0x842c('0x1d')](util['format'](_0x842c('0x35'),_0x169443[_0x842c('0x1e')]),_0x169443);members[_0x842c('0x34')](_0x169443);}catch(_0x54ca08){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x35'),_0x169443['uniqueid']),_0x54ca08);}});ami['on'](_0x842c('0x36'),function(_0x38240f){try{utils['debug'](util['format'](_0x842c('0x37'),_0x38240f[_0x842c('0x1e')]),_0x38240f);queues[_0x842c('0x36')](_0x38240f);agents['blindtransfer'](_0x38240f);transfers['blindtransfer'](_0x38240f);}catch(_0x33ec53){utils[_0x842c('0x16')](util['format'](_0x842c('0x37'),_0x38240f['uniqueid']),_0x33ec53);}});ami['on'](_0x842c('0x38'),function(_0x6a3f32){try{utils[_0x842c('0x1d')](util['format'](_0x842c('0x39'),_0x6a3f32[_0x842c('0x3a')]),_0x6a3f32);queues[_0x842c('0x38')](_0x6a3f32);transfers[_0x842c('0x38')](_0x6a3f32);agents[_0x842c('0x38')](_0x6a3f32);calls['attendedtransfer'](_0x6a3f32);}catch(_0x35691f){utils['error'](util[_0x842c('0x19')](_0x842c('0x39'),_0x6a3f32[_0x842c('0x3a')]),_0x35691f);}});ami['on'](_0x842c('0x3b'),function(_0x552cd8){try{utils[_0x842c('0x1d')](util[_0x842c('0x19')](_0x842c('0x3c'),_0x552cd8[_0x842c('0x1e')]),_0x552cd8);queues[_0x842c('0x3b')](_0x552cd8);recordings['varset'](_0x552cd8);calls[_0x842c('0x3b')](_0x552cd8);dials[_0x842c('0x3b')](_0x552cd8);}catch(_0x373418){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x3c'),_0x552cd8[_0x842c('0x1e')]),_0x373418);}});ami['on'](_0x842c('0x3d'),function(_0x1b67ad){try{utils[_0x842c('0x1d')](util[_0x842c('0x19')]('[%s][index][newexten]',_0x1b67ad['uniqueid']),_0x1b67ad);calls[_0x842c('0x3d')](_0x1b67ad);recordings[_0x842c('0x3d')](_0x1b67ad);dials[_0x842c('0x3d')](_0x1b67ad);}catch(_0x517806){utils[_0x842c('0x16')](util['format'](_0x842c('0x3e'),_0x1b67ad[_0x842c('0x1e')]),_0x517806);}});ami['on'](_0x842c('0x3f'),function(_0x5dbd88){try{utils[_0x842c('0x1d')](util[_0x842c('0x19')]('[%s][index][newchannel]',_0x5dbd88[_0x842c('0x1e')]),_0x5dbd88);calls[_0x842c('0x3f')](_0x5dbd88);recordings[_0x842c('0x3f')](_0x5dbd88);}catch(_0x17cad7){utils['error'](util[_0x842c('0x19')](_0x842c('0x40'),_0x5dbd88[_0x842c('0x1e')]),_0x17cad7);}});ami['on'](_0x842c('0x41'),function(_0x2412ee){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0x2412ee[_0x842c('0x1e')]),_0x2412ee);dials[_0x842c('0x41')](_0x2412ee);}catch(_0x39b9c9){utils[_0x842c('0x16')](util[_0x842c('0x19')](_0x842c('0x42'),_0x2412ee[_0x842c('0x1e')]),_0x39b9c9);}});ami['on'](_0x842c('0x43'),function(_0x50322a){try{utils['debug'](util[_0x842c('0x19')](_0x842c('0x44'),_0x50322a[_0x842c('0x1e')]),_0x50322a);dials[_0x842c('0x43')](_0x50322a);}catch(_0x19363f){utils[_0x842c('0x16')](util[_0x842c('0x19')]('[%s][index][dialend]',_0x50322a[_0x842c('0x1e')]),_0x19363f);}});} \ No newline at end of file +var _0x89d6=['[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','device','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','debug','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','varset'];(function(_0x5a3018,_0xe6f19a){var _0x53399d=function(_0x5e1b34){while(--_0x5e1b34){_0x5a3018['push'](_0x5a3018['shift']());}};_0x53399d(++_0xe6f19a);}(_0x89d6,0x1ad));var _0x689d=function(_0x2a4065,_0x5b3c44){_0x2a4065=_0x2a4065-0x0;var _0x2c1917=_0x89d6[_0x2a4065];return _0x2c1917;};var AsteriskManager=require(_0x689d('0x0'));var config=require(_0x689d('0x1'));var utils=require(_0x689d('0x2'));var util=require(_0x689d('0x3'));var isXDREnabled=config[_0x689d('0x4')]&&config[_0x689d('0x4')][_0x689d('0x5')]?!config[_0x689d('0x4')][_0x689d('0x5')]:!![];var isProduction=config['env']===_0x689d('0x6')||![];var isLocalAsterisk=config[_0x689d('0x4')]&&config[_0x689d('0x4')][_0x689d('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x689d('0x8')][_0x689d('0x9')],config[_0x689d('0x8')]['ip'],config[_0x689d('0x8')][_0x689d('0xa')],config[_0x689d('0x8')][_0x689d('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x689d('0xc')](_0x689d('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x689d('0xc')](_0x689d('0xe'));}else{var agents=require(_0x689d('0xf'));var calls=require(_0x689d('0x10'));var queues=require(_0x689d('0x11'));var recordings=require(_0x689d('0x12'));var members=require(_0x689d('0x13'));var dials=require(_0x689d('0x14'));var transfers=require(_0x689d('0x15'));var core=require(_0x689d('0x16'));ami['on'](_0x689d('0x17'),core[_0x689d('0x17')]);ami['on'](_0x689d('0x18'),core[_0x689d('0x18')]);ami['on']('fullybooted',core[_0x689d('0x19')]);ami['on'](_0x689d('0x1a'),core[_0x689d('0x1a')]);ami['on'](_0x689d('0x1b'),core['close']);ami['on']('managerevent',core[_0x689d('0x1c')]);ami['on']('devicestatechange',function(_0x2373af){try{utils['debug'](util['format']('[%s][index][devicestatechange]',_0x2373af[_0x689d('0x1d')]),_0x2373af);members['devicestatechange'](_0x2373af);}catch(_0x294196){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x1f'),_0x2373af[_0x689d('0x1d')]),_0x294196);}});ami['on'](_0x689d('0x20'),function(_0x504f52){try{utils['debug'](util['format'](_0x689d('0x21'),_0x504f52[_0x689d('0x22')]),_0x504f52);agents[_0x689d('0x20')](_0x504f52);}catch(_0x18c570){utils[_0x689d('0x1a')](util['format'](_0x689d('0x21'),_0x504f52[_0x689d('0x22')]),_0x18c570);}});ami['on']('agentringnoanswer',function(_0x41be29){try{utils['debug'](util[_0x689d('0x1e')](_0x689d('0x23'),_0x41be29['uniqueid']),_0x41be29);agents[_0x689d('0x24')](_0x41be29);}catch(_0x198eb3){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x23'),_0x41be29[_0x689d('0x22')]),_0x198eb3);}});ami['on'](_0x689d('0x25'),function(_0x28742e){try{utils[_0x689d('0x26')](util['format'](_0x689d('0x27'),_0x28742e[_0x689d('0x22')]),_0x28742e);agents[_0x689d('0x25')](_0x28742e);queues[_0x689d('0x25')](_0x28742e);}catch(_0xeb938f){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x27'),_0x28742e[_0x689d('0x22')]),_0xeb938f);}});ami['on']('agentcomplete',function(_0x52aeaa){try{utils[_0x689d('0x26')](util['format']('[%s][index][agentcomplete]',_0x52aeaa['uniqueid']),_0x52aeaa);agents[_0x689d('0x28')](_0x52aeaa);queues[_0x689d('0x28')](_0x52aeaa);members[_0x689d('0x28')](_0x52aeaa);}catch(_0x3bb0fc){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x29'),_0x52aeaa[_0x689d('0x22')]),_0x3bb0fc);}});ami['on'](_0x689d('0x2a'),function(_0x14a3ba){try{utils[_0x689d('0x26')](util[_0x689d('0x1e')](_0x689d('0x2b'),_0x14a3ba[_0x689d('0x22')]),_0x14a3ba);agents['queuecallerabandon'](_0x14a3ba);queues['queuecallerabandon'](_0x14a3ba);}catch(_0x51fb81){utils['error'](util['format'](_0x689d('0x2b'),_0x14a3ba[_0x689d('0x22')]),_0x51fb81);}});ami['on'](_0x689d('0x2c'),function(_0x40492c){try{utils[_0x689d('0x26')](util[_0x689d('0x1e')](_0x689d('0x2d'),_0x40492c[_0x689d('0x22')]),_0x40492c);queues[_0x689d('0x2c')](_0x40492c);recordings[_0x689d('0x2c')](_0x40492c);}catch(_0x1a6fac){utils[_0x689d('0x1a')](util['format'](_0x689d('0x2d'),_0x40492c[_0x689d('0x22')]),_0x1a6fac);}});ami['on']('queuecallerleave',function(_0x626a84){try{utils[_0x689d('0x26')](util[_0x689d('0x1e')](_0x689d('0x2e'),_0x626a84[_0x689d('0x22')]),_0x626a84);queues['queuecallerleave'](_0x626a84);}catch(_0x24a269){utils[_0x689d('0x1a')](util[_0x689d('0x1e')]('[%s][index][queuecallerleave]',_0x626a84['uniqueid']),_0x24a269);}});ami['on'](_0x689d('0x2f'),function(_0x59079b){try{utils[_0x689d('0x26')](util['format'](_0x689d('0x30'),_0x59079b['uniqueid']),_0x59079b);queues[_0x689d('0x2f')](_0x59079b);calls['musiconholdstart'](_0x59079b);}catch(_0x330434){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x30'),_0x59079b['uniqueid']),_0x330434);}});ami['on'](_0x689d('0x31'),function(_0x40a0b3){try{utils[_0x689d('0x26')](util[_0x689d('0x1e')]('[%s][index][musiconholdstop]',_0x40a0b3[_0x689d('0x22')]),_0x40a0b3);queues['musiconholdstop'](_0x40a0b3);calls[_0x689d('0x31')](_0x40a0b3);}catch(_0x2d16e8){utils['error'](util['format']('[%s][index][musiconholdstop]',_0x40a0b3[_0x689d('0x22')]),_0x2d16e8);}});ami['on'](_0x689d('0x32'),function(_0x2b9412){try{utils['debug'](util[_0x689d('0x1e')](_0x689d('0x33'),_0x2b9412['uniqueid']),_0x2b9412);calls[_0x689d('0x32')](_0x2b9412);recordings[_0x689d('0x32')](_0x2b9412);}catch(_0x5b776c){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x33'),_0x2b9412[_0x689d('0x22')]),_0x5b776c);}});ami['on'](_0x689d('0x34'),function(_0x2d0209){try{utils['debug'](util[_0x689d('0x1e')](_0x689d('0x35'),_0x2d0209[_0x689d('0x22')]),_0x2d0209);calls[_0x689d('0x34')](_0x2d0209);recordings[_0x689d('0x34')](_0x2d0209);dials['hangup'](_0x2d0209);agents['hangup'](_0x2d0209);queues['hangup'](_0x2d0209);}catch(_0x507430){utils[_0x689d('0x1a')](util['format'](_0x689d('0x35'),_0x2d0209[_0x689d('0x22')]),_0x507430);}});ami['on']('cdr',function(_0x34de92){try{utils[_0x689d('0x26')](util[_0x689d('0x1e')](_0x689d('0x36'),_0x34de92[_0x689d('0x22')]),_0x34de92);members[_0x689d('0x37')](_0x34de92);}catch(_0x281be3){utils[_0x689d('0x1a')](util['format'](_0x689d('0x36'),_0x34de92[_0x689d('0x22')]),_0x281be3);}});ami['on'](_0x689d('0x38'),function(_0x535faa){try{utils[_0x689d('0x26')](util[_0x689d('0x1e')]('[%s][index][blindtransfer]',_0x535faa[_0x689d('0x22')]),_0x535faa);queues[_0x689d('0x38')](_0x535faa);agents[_0x689d('0x38')](_0x535faa);transfers[_0x689d('0x38')](_0x535faa);}catch(_0x567744){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x39'),_0x535faa[_0x689d('0x22')]),_0x567744);}});ami['on']('attendedtransfer',function(_0x29312b){try{utils['debug'](util['format']('[%s][index][attendedtransfer]',_0x29312b[_0x689d('0x3a')]),_0x29312b);queues[_0x689d('0x3b')](_0x29312b);transfers[_0x689d('0x3b')](_0x29312b);agents['attendedtransfer'](_0x29312b);calls['attendedtransfer'](_0x29312b);}catch(_0x20e66b){utils[_0x689d('0x1a')](util[_0x689d('0x1e')]('[%s][index][attendedtransfer]',_0x29312b['origtransfereruniqueid']),_0x20e66b);}});ami['on'](_0x689d('0x3c'),function(_0x2823be){try{utils[_0x689d('0x26')](util['format'](_0x689d('0x3d'),_0x2823be[_0x689d('0x22')]),_0x2823be);queues['varset'](_0x2823be);recordings[_0x689d('0x3c')](_0x2823be);calls[_0x689d('0x3c')](_0x2823be);dials[_0x689d('0x3c')](_0x2823be);}catch(_0x18902b){utils['error'](util['format'](_0x689d('0x3d'),_0x2823be[_0x689d('0x22')]),_0x18902b);}});ami['on'](_0x689d('0x3e'),function(_0x102535){try{utils['debug'](util['format']('[%s][index][newexten]',_0x102535[_0x689d('0x22')]),_0x102535);calls['newexten'](_0x102535);recordings[_0x689d('0x3e')](_0x102535);dials[_0x689d('0x3e')](_0x102535);}catch(_0x28472b){utils['error'](util['format'](_0x689d('0x3f'),_0x102535[_0x689d('0x22')]),_0x28472b);}});ami['on'](_0x689d('0x40'),function(_0x4f4ddb){try{utils[_0x689d('0x26')](util['format'](_0x689d('0x41'),_0x4f4ddb['uniqueid']),_0x4f4ddb);calls[_0x689d('0x40')](_0x4f4ddb);recordings[_0x689d('0x40')](_0x4f4ddb);}catch(_0x55f3e){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x41'),_0x4f4ddb[_0x689d('0x22')]),_0x55f3e);}});ami['on']('dialbegin',function(_0x5aaa17){try{utils['debug'](util[_0x689d('0x1e')](_0x689d('0x42'),_0x5aaa17[_0x689d('0x22')]),_0x5aaa17);dials['dialbegin'](_0x5aaa17);}catch(_0x5b1ed2){utils[_0x689d('0x1a')](util[_0x689d('0x1e')](_0x689d('0x43'),_0x5aaa17['uniqueid']),_0x5b1ed2);}});ami['on']('dialend',function(_0x5e3a62){try{utils[_0x689d('0x26')](util[_0x689d('0x1e')](_0x689d('0x44'),_0x5e3a62[_0x689d('0x22')]),_0x5e3a62);dials[_0x689d('0x45')](_0x5e3a62);}catch(_0x5a649b){utils['error'](util['format']('[%s][index][dialend]',_0x5e3a62[_0x689d('0x22')]),_0x5a649b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 452cbd3..caa0f6e 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46cc=['info','format','interface','channel','data2','membername','type','getUserByInterface','internal','request','CreateMemberReport','getUserByName','split','then','name','catch','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','agent','isNil','exitAt','diffTime','enterAt','error','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','data3','destinationchannel','destination','util','./utils','Queue:'];(function(_0x5137e4,_0x2dab6c){var _0x4201e0=function(_0x459410){while(--_0x459410){_0x5137e4['push'](_0x5137e4['shift']());}};_0x4201e0(++_0x2dab6c);}(_0x46cc,0xc1));var _0xc46c=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0x46cc[_0x57fc2a];return _0xa839b;};'use strict';var _=require('lodash');var util=require(_0xc46c('0x0'));var utils=require(_0xc46c('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xc46c('0x2')];function writeDB(_0x36840f){utils[_0xc46c('0x3')](util[_0xc46c('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x36840f['uniqueid'],_0x36840f[_0xc46c('0x5')],_0x36840f[_0xc46c('0x6')],_0x36840f[_0xc46c('0x7')],_0x36840f[_0xc46c('0x8')],_0x36840f[_0xc46c('0x9')]));if(_0x36840f[_0xc46c('0x5')]){utils[_0xc46c('0xa')](_0x36840f[_0xc46c('0x5')])['then'](function(_0x1af0de){if(_0x1af0de){_0x36840f[_0xc46c('0x8')]=_0x1af0de['name'];_0x36840f[_0xc46c('0xb')]=_0x1af0de[_0xc46c('0xb')];utils[_0xc46c('0xc')](_0xc46c('0xd'),_0x36840f);}else{utils[_0xc46c('0xe')](_0x36840f[_0xc46c('0x5')][_0xc46c('0xf')]('/')[0x1])[_0xc46c('0x10')](function(_0x2e49a9){if(_0x2e49a9){_0x36840f[_0xc46c('0x8')]=_0x2e49a9[_0xc46c('0x11')];_0x36840f[_0xc46c('0xb')]=_0x2e49a9[_0xc46c('0xb')];utils[_0xc46c('0xc')](_0xc46c('0xd'),_0x36840f);}});}})[_0xc46c('0x12')](function(_0x2c9766){utils['error'](util[_0xc46c('0x4')](_0xc46c('0x13'),_0x36840f[_0xc46c('0x14')]),_0x2c9766);});}delete members[_0x36840f['interface']];}function startsWith(_0x50190d,_0x26e968){return _[_0xc46c('0x15')](_0x50190d,function(_0x9d913a){return _[_0xc46c('0x16')](_0x26e968,_0x9d913a);});}exports[_0xc46c('0x17')]=function(_0x2df1c4){try{utils['debug'](util[_0xc46c('0x4')](_0xc46c('0x18'),members[_0x2df1c4[_0xc46c('0x19')]]?members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x14')]:_0x2df1c4[_0xc46c('0x19')]),_0x2df1c4);utils[_0xc46c('0x3')](util['format'](_0xc46c('0x1a'),members[_0x2df1c4[_0xc46c('0x19')]]?members[_0x2df1c4['device']][_0xc46c('0x14')]:_0x2df1c4['device'],_0x2df1c4[_0xc46c('0x1b')],_0x2df1c4['device']));switch(_0x2df1c4['state']){case'INUSE':case _0xc46c('0x1c'):if(!startsWith(exclude,_0x2df1c4[_0xc46c('0x19')])){members[_0x2df1c4[_0xc46c('0x19')]]={'channel':_0xc46c('0x1d'),'interface':_0x2df1c4['device'],'type':'TALKING','enterAt':utils[_0xc46c('0x1e')](),'role':_0xc46c('0x1f')};}break;case'NOT_INUSE':if(!_[_0xc46c('0x20')](members[_0x2df1c4['device']])){members[_0x2df1c4['device']][_0xc46c('0x21')]=utils[_0xc46c('0x1e')]();members[_0x2df1c4[_0xc46c('0x19')]]['duration']=utils[_0xc46c('0x22')](members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x21')],members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x23')]);if(members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x14')]){writeDB(members[_0x2df1c4[_0xc46c('0x19')]]);}}break;default:break;}}catch(_0x379a8e){utils[_0xc46c('0x24')](util['format'](_0xc46c('0x18'),members[_0x2df1c4['device']]?members[_0x2df1c4[_0xc46c('0x19')]][_0xc46c('0x14')]:_0x2df1c4[_0xc46c('0x19')]),_0x379a8e);}};exports[_0xc46c('0x25')]=function(_0x539e1c){try{if(!_[_0xc46c('0x20')](members[_0x539e1c[_0xc46c('0x5')]])){utils[_0xc46c('0x26')](util[_0xc46c('0x4')]('[%s][members][agentcomplete]',_0x539e1c[_0xc46c('0x14')]),_0x539e1c);utils[_0xc46c('0x3')](util['format'](_0xc46c('0x27'),_0x539e1c[_0xc46c('0x14')],_0x539e1c[_0xc46c('0x5')],_0x539e1c['queue']));members[_0x539e1c[_0xc46c('0x5')]]=_[_0xc46c('0x28')](members[_0x539e1c[_0xc46c('0x5')]],{'data4':_0x539e1c[_0xc46c('0x29')],'uniqueid':_0x539e1c[_0xc46c('0x14')]});}}catch(_0x499856){utils[_0xc46c('0x24')](util['format'](_0xc46c('0x2a'),_0x539e1c[_0xc46c('0x14')]),_0x499856);}};exports[_0xc46c('0x2b')]=function(_0x4cdfa7){try{utils[_0xc46c('0x26')](util[_0xc46c('0x4')](_0xc46c('0x2c'),_0x4cdfa7[_0xc46c('0x14')]),_0x4cdfa7);if(_0x4cdfa7[_0xc46c('0x6')]){var _0x24e107=_0x4cdfa7[_0xc46c('0x6')][_0xc46c('0xf')]('-')[0x0];if(!_[_0xc46c('0x20')](members[_0x24e107])){members[_0x24e107]=_[_0xc46c('0x28')](members[_0x24e107],{'data1':members[_0x24e107][_0xc46c('0x2d')]||_0x4cdfa7[_0xc46c('0x9')],'data2':members[_0x24e107][_0xc46c('0x7')]||_0x4cdfa7['source'],'data3':members[_0x24e107]['data3']||_0x4cdfa7['destination'],'uniqueid':members[_0x24e107]['uniqueid']||_0x4cdfa7[_0xc46c('0x14')]});utils[_0xc46c('0x3')](util[_0xc46c('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4cdfa7[_0xc46c('0x14')],members[_0x24e107][_0xc46c('0x2d')],members[_0x24e107][_0xc46c('0x7')],members[_0x24e107][_0xc46c('0x2e')]));if(members[_0x24e107][_0xc46c('0x21')]){writeDB(members[_0x24e107]);}}}if(_0x4cdfa7['destinationchannel']){var _0x4348ab=_0x4cdfa7[_0xc46c('0x2f')]['split']('-')[0x0];if(!_[_0xc46c('0x20')](members[_0x4348ab])){members[_0x4348ab]=_[_0xc46c('0x28')](members[_0x4348ab],{'data1':members[_0x4348ab][_0xc46c('0x2d')]||_0x4cdfa7[_0xc46c('0x9')],'data2':members[_0x4348ab]['data2']||_0x4cdfa7['source'],'data3':members[_0x4348ab]['data3']||_0x4cdfa7[_0xc46c('0x30')],'uniqueid':members[_0x4348ab][_0xc46c('0x14')]||_0x4cdfa7[_0xc46c('0x14')]});utils[_0xc46c('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4cdfa7[_0xc46c('0x14')],members[_0x4348ab][_0xc46c('0x2d')],members[_0x4348ab][_0xc46c('0x7')],members[_0x4348ab][_0xc46c('0x2e')]));if(members[_0x4348ab][_0xc46c('0x21')]){writeDB(members[_0x4348ab]);}}}}catch(_0x1afa3a){utils[_0xc46c('0x24')](util[_0xc46c('0x4')](_0xc46c('0x2c'),_0x4cdfa7['uniqueid']),_0x1afa3a);}}; \ No newline at end of file +var _0x5f10=['INUSE','BUSY','voice','TALKING','NOT_INUSE','isNil','exitAt','duration','enterAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','[%s][members][cdr]','channel','assign','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5f10,0xd5));var _0x05f1=function(_0xba0502,_0x2fb75b){_0xba0502=_0xba0502-0x0;var _0x5ed16d=_0x5f10[_0xba0502];return _0x5ed16d;};'use strict';var _=require(_0x05f1('0x0'));var util=require(_0x05f1('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x2f700c){utils[_0x05f1('0x2')](util[_0x05f1('0x3')](_0x05f1('0x4'),_0x2f700c[_0x05f1('0x5')],_0x2f700c[_0x05f1('0x6')],_0x2f700c['channel'],_0x2f700c[_0x05f1('0x7')],_0x2f700c[_0x05f1('0x8')],_0x2f700c[_0x05f1('0x9')]));if(_0x2f700c['interface']){utils[_0x05f1('0xa')](_0x2f700c[_0x05f1('0x6')])[_0x05f1('0xb')](function(_0x17baf8){if(_0x17baf8){_0x2f700c[_0x05f1('0x8')]=_0x17baf8[_0x05f1('0xc')];_0x2f700c['internal']=_0x17baf8[_0x05f1('0xd')];utils[_0x05f1('0xe')](_0x05f1('0xf'),_0x2f700c);}else{utils[_0x05f1('0x10')](_0x2f700c[_0x05f1('0x6')][_0x05f1('0x11')]('/')[0x1])['then'](function(_0x17f078){if(_0x17f078){_0x2f700c['membername']=_0x17f078[_0x05f1('0xc')];_0x2f700c[_0x05f1('0xd')]=_0x17f078[_0x05f1('0xd')];utils[_0x05f1('0xe')](_0x05f1('0xf'),_0x2f700c);}});}})[_0x05f1('0x12')](function(_0x1367de){utils[_0x05f1('0x13')](util[_0x05f1('0x3')]('[%s][members][writeDB]',_0x2f700c[_0x05f1('0x5')]),_0x1367de);});}delete members[_0x2f700c[_0x05f1('0x6')]];}function startsWith(_0x12c403,_0x238e75){return _['some'](_0x12c403,function(_0x3d1cd6){return _[_0x05f1('0x14')](_0x238e75,_0x3d1cd6);});}exports[_0x05f1('0x15')]=function(_0x16a6b5){try{utils[_0x05f1('0x16')](util[_0x05f1('0x3')](_0x05f1('0x17'),members[_0x16a6b5[_0x05f1('0x18')]]?members[_0x16a6b5[_0x05f1('0x18')]][_0x05f1('0x5')]:_0x16a6b5[_0x05f1('0x18')]),_0x16a6b5);utils[_0x05f1('0x2')](util[_0x05f1('0x3')](_0x05f1('0x19'),members[_0x16a6b5['device']]?members[_0x16a6b5[_0x05f1('0x18')]][_0x05f1('0x5')]:_0x16a6b5[_0x05f1('0x18')],_0x16a6b5[_0x05f1('0x1a')],_0x16a6b5[_0x05f1('0x18')]));switch(_0x16a6b5['state']){case _0x05f1('0x1b'):case _0x05f1('0x1c'):if(!startsWith(exclude,_0x16a6b5['device'])){members[_0x16a6b5[_0x05f1('0x18')]]={'channel':_0x05f1('0x1d'),'interface':_0x16a6b5[_0x05f1('0x18')],'type':_0x05f1('0x1e'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x05f1('0x1f'):if(!_[_0x05f1('0x20')](members[_0x16a6b5[_0x05f1('0x18')]])){members[_0x16a6b5[_0x05f1('0x18')]][_0x05f1('0x21')]=utils['now']();members[_0x16a6b5[_0x05f1('0x18')]][_0x05f1('0x22')]=utils['diffTime'](members[_0x16a6b5[_0x05f1('0x18')]]['exitAt'],members[_0x16a6b5['device']][_0x05f1('0x23')]);if(members[_0x16a6b5[_0x05f1('0x18')]][_0x05f1('0x5')]){writeDB(members[_0x16a6b5[_0x05f1('0x18')]]);}}break;default:break;}}catch(_0x6a37c5){utils[_0x05f1('0x13')](util['format'](_0x05f1('0x17'),members[_0x16a6b5[_0x05f1('0x18')]]?members[_0x16a6b5[_0x05f1('0x18')]]['uniqueid']:_0x16a6b5['device']),_0x6a37c5);}};exports['agentcomplete']=function(_0xcda2b){try{if(!_[_0x05f1('0x20')](members[_0xcda2b[_0x05f1('0x6')]])){utils[_0x05f1('0x16')](util[_0x05f1('0x3')]('[%s][members][agentcomplete]',_0xcda2b['uniqueid']),_0xcda2b);utils['info'](util[_0x05f1('0x3')](_0x05f1('0x24'),_0xcda2b[_0x05f1('0x5')],_0xcda2b[_0x05f1('0x6')],_0xcda2b[_0x05f1('0x25')]));members[_0xcda2b[_0x05f1('0x6')]]=_['assign'](members[_0xcda2b[_0x05f1('0x6')]],{'data4':_0xcda2b[_0x05f1('0x25')],'uniqueid':_0xcda2b['uniqueid']});}}catch(_0x1bd03a){utils[_0x05f1('0x13')](util['format'](_0x05f1('0x26'),_0xcda2b[_0x05f1('0x5')]),_0x1bd03a);}};exports['cdr']=function(_0x2b2951){try{utils['debug'](util['format'](_0x05f1('0x27'),_0x2b2951[_0x05f1('0x5')]),_0x2b2951);if(_0x2b2951[_0x05f1('0x28')]){var _0xe37340=_0x2b2951[_0x05f1('0x28')][_0x05f1('0x11')]('-')[0x0];if(!_[_0x05f1('0x20')](members[_0xe37340])){members[_0xe37340]=_[_0x05f1('0x29')](members[_0xe37340],{'data1':members[_0xe37340][_0x05f1('0x2a')]||_0x2b2951[_0x05f1('0x9')],'data2':members[_0xe37340][_0x05f1('0x7')]||_0x2b2951['source'],'data3':members[_0xe37340][_0x05f1('0x2b')]||_0x2b2951[_0x05f1('0x2c')],'uniqueid':members[_0xe37340][_0x05f1('0x5')]||_0x2b2951[_0x05f1('0x5')]});utils[_0x05f1('0x2')](util[_0x05f1('0x3')](_0x05f1('0x2d'),_0x2b2951['uniqueid'],members[_0xe37340]['data1'],members[_0xe37340]['data2'],members[_0xe37340][_0x05f1('0x2b')]));if(members[_0xe37340][_0x05f1('0x21')]){writeDB(members[_0xe37340]);}}}if(_0x2b2951[_0x05f1('0x2e')]){var _0x9fcd3e=_0x2b2951[_0x05f1('0x2e')][_0x05f1('0x11')]('-')[0x0];if(!_[_0x05f1('0x20')](members[_0x9fcd3e])){members[_0x9fcd3e]=_['assign'](members[_0x9fcd3e],{'data1':members[_0x9fcd3e][_0x05f1('0x2a')]||_0x2b2951[_0x05f1('0x9')],'data2':members[_0x9fcd3e][_0x05f1('0x7')]||_0x2b2951[_0x05f1('0x2f')],'data3':members[_0x9fcd3e]['data3']||_0x2b2951[_0x05f1('0x2c')],'uniqueid':members[_0x9fcd3e][_0x05f1('0x5')]||_0x2b2951[_0x05f1('0x5')]});utils[_0x05f1('0x2')](util[_0x05f1('0x3')](_0x05f1('0x2d'),_0x2b2951[_0x05f1('0x5')],members[_0x9fcd3e][_0x05f1('0x2a')],members[_0x9fcd3e][_0x05f1('0x7')],members[_0x9fcd3e][_0x05f1('0x2b')]));if(members[_0x9fcd3e]['exitAt']){writeDB(members[_0x9fcd3e]);}}}}catch(_0x5c5f68){utils['error'](util[_0x05f1('0x3')]('[%s][members][cdr]',_0x2b2951[_0x05f1('0x5')]),_0x5c5f68);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c31a864..e39d807 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x292e=['queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','isNil','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','destaccountcode','assigned','lastAssignedTo','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferexten','transferuniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name'];(function(_0x1286dd,_0x5eb8d7){var _0x470acf=function(_0x5a3d7a){while(--_0x5a3d7a){_0x1286dd['push'](_0x1286dd['shift']());}};_0x470acf(++_0x5eb8d7);}(_0x292e,0x190));var _0xe292=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x292e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xe292('0x0'));var util=require('util');var utils=require(_0xe292('0x1'));var queues={};function writeDB(_0x28c46b){utils['info'](util[_0xe292('0x2')](_0xe292('0x3'),_0x28c46b[_0xe292('0x4')],_0x28c46b['channel'],_0x28c46b[_0xe292('0x5')],_0x28c46b['lastAssignedTo'],_0x28c46b['calleridnum'],_0x28c46b[_0xe292('0x6')],_0x28c46b[_0xe292('0x7')]));if(_0x28c46b[_0xe292('0x5')]){utils[_0xe292('0x8')](_0x28c46b[_0xe292('0x5')])[_0xe292('0x9')](function(_0x1bfaf2){if(_0x1bfaf2){_0x28c46b[_0xe292('0xa')]=_0x1bfaf2[_0xe292('0xa')];}utils[_0xe292('0xb')](_0xe292('0xc'),_0x28c46b);});}else{utils[_0xe292('0xb')](_0xe292('0xc'),_0x28c46b);}if(_0x28c46b[_0xe292('0xd')]){delete queues[_0x28c46b[_0xe292('0xd')]];}else{delete queues[_0x28c46b['uniqueid']];}}exports[_0xe292('0xe')]=function(_0x19a5cd){try{utils[_0xe292('0xf')](util[_0xe292('0x2')](_0xe292('0x10'),_0x19a5cd[_0xe292('0x4')]),_0x19a5cd);utils[_0xe292('0x11')](util['format'](_0xe292('0x12'),_0x19a5cd[_0xe292('0x4')],_0x19a5cd[_0xe292('0x5')],_0x19a5cd[_0xe292('0x13')]));queues[_0x19a5cd[_0xe292('0x4')]]=_[_0xe292('0x14')](_0x19a5cd,{'originalposition':_0x19a5cd[_0xe292('0x13')],'queuecallerjoinAt':utils[_0xe292('0x15')](),'mohtime':0x0});}catch(_0x5c51f4){utils[_0xe292('0x16')](util[_0xe292('0x2')](_0xe292('0x10'),_0x19a5cd['uniqueid']),_0x5c51f4);}};exports[_0xe292('0x17')]=function(_0x1c5750){try{if(!_['isNil'](queues[_0x1c5750[_0xe292('0x4')]])){utils[_0xe292('0xf')](util['format'](_0xe292('0x18'),_0x1c5750['uniqueid']),_0x1c5750);if(queues[_0x1c5750[_0xe292('0x4')]]['queuecallerleaveAt']){if(!queues[_0x1c5750[_0xe292('0x4')]][_0xe292('0x19')]&&!queues[_0x1c5750[_0xe292('0x4')]][_0xe292('0x1a')]){queues[_0x1c5750[_0xe292('0x4')]][_0xe292('0x1b')]=!![];queues[_0x1c5750[_0xe292('0x4')]][_0xe292('0x1c')]=utils[_0xe292('0x15')]();queues[_0x1c5750[_0xe292('0x4')]][_0xe292('0x7')]=_0xe292('0x1d');}utils[_0xe292('0x11')](util[_0xe292('0x2')](_0xe292('0x1e'),_0x1c5750[_0xe292('0x4')],queues[_0x1c5750[_0xe292('0x4')]][_0xe292('0x1f')],queues[_0x1c5750[_0xe292('0x4')]][_0xe292('0x7')]));writeDB(queues[_0x1c5750['uniqueid']]);}else if(queues[_0x1c5750[_0xe292('0x4')]]['transfereduniqueid']){utils[_0xe292('0x11')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x1c5750[_0xe292('0x4')],queues[_0x1c5750[_0xe292('0x4')]][_0xe292('0x1f')],queues[_0x1c5750['uniqueid']][_0xe292('0xd')]));queues[queues[_0x1c5750['uniqueid']][_0xe292('0xd')]]=queues[_0x1c5750['uniqueid']];queues[queues[_0x1c5750['uniqueid']][_0xe292('0xd')]][_0xe292('0x20')]=0x2;delete queues[_0x1c5750['uniqueid']];}}}catch(_0x581f0b){utils['error'](util[_0xe292('0x2')](_0xe292('0x18'),_0x1c5750[_0xe292('0x4')]),_0x581f0b);}};exports[_0xe292('0x21')]=function(_0x2ac2eb){try{utils[_0xe292('0xf')](util[_0xe292('0x2')](_0xe292('0x22'),_0x2ac2eb['uniqueid']),_0x2ac2eb);if(!_['isNil'](_0x2ac2eb[_0xe292('0x23')][_0xe292('0x24')])&&_0x2ac2eb[_0xe292('0x25')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xe292('0x26')](queues[_0x2ac2eb['uniqueid']])){queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x19')]=![];queues[_0x2ac2eb['uniqueid']][_0xe292('0x27')]=null;queues[_0x2ac2eb['uniqueid']][_0xe292('0x1a')]=!![];queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x28')]=utils[_0xe292('0x15')]();queues[_0x2ac2eb['uniqueid']]['queuecallerexitreason']=_0x2ac2eb[_0xe292('0x25')][_0xe292('0x29')]();utils['info'](util[_0xe292('0x2')](_0xe292('0x2a'),_0x2ac2eb[_0xe292('0x4')],queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x1f')],_0x2ac2eb[_0xe292('0x25')],queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x7')]));writeDB(queues[_0x2ac2eb[_0xe292('0x4')]]);}}else if(!_[_0xe292('0x26')](_0x2ac2eb[_0xe292('0x23')][_0xe292('0x2b')])){if(!_['isNil'](queues[_0x2ac2eb[_0xe292('0x4')]])&&!queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x19')]){queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x19')]=![];queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x27')]=null;queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x1a')]=!![];queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x28')]=utils[_0xe292('0x15')]();queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x7')]=_0xe292('0x2c');utils[_0xe292('0x11')](util[_0xe292('0x2')](_0xe292('0x2d'),_0x2ac2eb['uniqueid'],queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x1f')],_0x2ac2eb[_0xe292('0x25')],queues[_0x2ac2eb[_0xe292('0x4')]][_0xe292('0x7')]));}}}catch(_0xc7b05a){utils[_0xe292('0x16')](util['format']('[%s][queues][varset]',_0x2ac2eb['uniqueid']),_0xc7b05a);}};exports[_0xe292('0x19')]=function(_0x22cf7e){try{if(!_['isNil'](queues[_0x22cf7e[_0xe292('0x4')]])){utils[_0xe292('0xf')](util[_0xe292('0x2')](_0xe292('0x2e'),_0x22cf7e[_0xe292('0x4')]),_0x22cf7e);queues[_0x22cf7e['uniqueid']]['queuecallerexit']=![];queues[_0x22cf7e[_0xe292('0x4')]][_0xe292('0x28')]=null;queues[_0x22cf7e['uniqueid']][_0xe292('0x19')]=!![];queues[_0x22cf7e[_0xe292('0x4')]]['queuecallerabandonAt']=utils[_0xe292('0x15')]();queues[_0x22cf7e[_0xe292('0x4')]]['queuecallerexitreason']=_0xe292('0x2f');utils['info'](util[_0xe292('0x2')](_0xe292('0x30'),_0x22cf7e['uniqueid'],queues[_0x22cf7e[_0xe292('0x4')]][_0xe292('0x1f')],queues[_0x22cf7e[_0xe292('0x4')]][_0xe292('0x7')]));}}catch(_0x17ff15){utils[_0xe292('0x16')](util[_0xe292('0x2')](_0xe292('0x2e'),_0x22cf7e[_0xe292('0x4')]),_0x17ff15);}};exports[_0xe292('0x31')]=function(_0xfe2905){try{if(!_[_0xe292('0x26')](queues[_0xfe2905[_0xe292('0x4')]])){utils[_0xe292('0xf')](util[_0xe292('0x2')](_0xe292('0x32'),_0xfe2905[_0xe292('0x4')]),_0xfe2905);utils[_0xe292('0x11')](util[_0xe292('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xfe2905[_0xe292('0x4')],queues[_0xfe2905[_0xe292('0x4')]]['name'],_0xfe2905[_0xe292('0x33')],_0xfe2905[_0xe292('0x34')]));queues[_0xfe2905['uniqueid']][_0xe292('0x31')]=!![];queues[_0xfe2905[_0xe292('0x4')]][_0xe292('0x35')]=utils['now']();queues[_0xfe2905[_0xe292('0x4')]][_0xe292('0x36')]=utils[_0xe292('0x37')](queues[_0xfe2905[_0xe292('0x4')]][_0xe292('0x35')],queues[_0xfe2905[_0xe292('0x4')]][_0xe292('0x38')]);queues[_0xfe2905[_0xe292('0x4')]][_0xe292('0x13')]=_0xfe2905['position'];queues[_0xfe2905[_0xe292('0x4')]][_0xe292('0x39')]=_0xfe2905[_0xe292('0x39')];queues[_0xfe2905[_0xe292('0x4')]][_0xe292('0x33')]=_0xfe2905['connectedlinenum'];queues[_0xfe2905[_0xe292('0x4')]]['connectedlinename']=_0xfe2905[_0xe292('0x34')];}}catch(_0x21c527){utils[_0xe292('0x16')](util[_0xe292('0x2')]('[%s][queues][queuecallerleave]',_0xfe2905[_0xe292('0x4')]),_0x21c527);}};exports['agentconnect']=function(_0x231733){try{if(!_[_0xe292('0x26')](queues[_0x231733[_0xe292('0x4')]])){utils[_0xe292('0xf')](util['format'](_0xe292('0x3a'),_0x231733[_0xe292('0x4')]),_0x231733);utils[_0xe292('0x11')](util[_0xe292('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x231733['uniqueid'],queues[_0x231733[_0xe292('0x4')]][_0xe292('0x1f')],_0x231733['membername'],_0x231733[_0xe292('0x3b')]));queues[_0x231733[_0xe292('0x4')]][_0xe292('0x19')]=![];queues[_0x231733[_0xe292('0x4')]][_0xe292('0x19')]=![];queues[_0x231733['uniqueid']][_0xe292('0x27')]=null;queues[_0x231733[_0xe292('0x4')]][_0xe292('0x1a')]=![];queues[_0x231733[_0xe292('0x4')]][_0xe292('0x7')]=null;queues[_0x231733['uniqueid']][_0xe292('0x28')]=null;queues[_0x231733['uniqueid']][_0xe292('0x3c')]=!![];queues[_0x231733[_0xe292('0x4')]]['accountcode']=_0x231733[_0xe292('0x3b')];queues[_0x231733[_0xe292('0x4')]][_0xe292('0x3d')]=_0x231733[_0xe292('0x3e')];}}catch(_0x528b7f){utils[_0xe292('0x16')](util[_0xe292('0x2')](_0xe292('0x3a'),_0x231733['uniqueid']),_0x528b7f);}};exports[_0xe292('0x3f')]=function(_0x4f5f02){try{if(!_[_0xe292('0x26')](queues[_0x4f5f02['uniqueid']])){if(queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x35')]){utils[_0xe292('0xf')](util[_0xe292('0x2')](_0xe292('0x40'),_0x4f5f02[_0xe292('0x4')]),_0x4f5f02);queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x19')]=![];queues[_0x4f5f02['uniqueid']][_0xe292('0x19')]=![];queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x27')]=null;queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x1a')]=![];queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x28')]=null;queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x3c')]=!![];queues[_0x4f5f02['uniqueid']][_0xe292('0x3d')]=_0x4f5f02['membername'];queues[_0x4f5f02[_0xe292('0x4')]]['queuecallercomplete']=!![];queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x1c')]=utils[_0xe292('0x15')]();if(_0x4f5f02[_0xe292('0x41')]==_0xe292('0x42')){if(!queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x42')]){queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x7')]=_0xe292('0x43');}}else{queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x7')]=_0xe292('0x44')+_0x4f5f02[_0xe292('0x41')][_0xe292('0x29')]();}utils[_0xe292('0x11')](util[_0xe292('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x4f5f02[_0xe292('0x4')],queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x1f')],_0x4f5f02['membername'],queues[_0x4f5f02[_0xe292('0x4')]][_0xe292('0x7')]));writeDB(queues[_0x4f5f02[_0xe292('0x4')]]);}}}catch(_0x2ddbb5){utils[_0xe292('0x16')](util[_0xe292('0x2')](_0xe292('0x40'),_0x4f5f02[_0xe292('0x4')]),_0x2ddbb5);}};exports[_0xe292('0x45')]=function(_0xa6ad39){try{if(!_['isNil'](queues[_0xa6ad39[_0xe292('0x46')]])){utils[_0xe292('0xf')](util[_0xe292('0x2')](_0xe292('0x47'),_0xa6ad39[_0xe292('0x4')]),_0xa6ad39);queues[_0xa6ad39[_0xe292('0x46')]][_0xe292('0x42')]=!![];queues[_0xa6ad39[_0xe292('0x46')]][_0xe292('0x48')]=_0xe292('0x49');queues[_0xa6ad39[_0xe292('0x46')]]['transferexten']=_0xa6ad39[_0xe292('0x4a')];queues[_0xa6ad39[_0xe292('0x46')]]['transferuniqueid']=_0xa6ad39['transfereeuniqueid'];queues[_0xa6ad39['transfereeuniqueid']][_0xe292('0x7')]=_0xe292('0x4b');utils[_0xe292('0x11')](util[_0xe292('0x2')](_0xe292('0x4c'),_0xa6ad39[_0xe292('0x4')],queues[_0xa6ad39[_0xe292('0x46')]][_0xe292('0x1f')],_0xa6ad39[_0xe292('0x46')],_0xa6ad39[_0xe292('0x4a')]));}}catch(_0x262ad6){utils[_0xe292('0x16')](util[_0xe292('0x2')](_0xe292('0x47'),_0xa6ad39[_0xe292('0x4')]),_0x262ad6);}};exports[_0xe292('0x4d')]=function(_0x15601b){try{utils[_0xe292('0xf')](util[_0xe292('0x2')](_0xe292('0x4e'),_0x15601b['origtransfereruniqueid']),_0x15601b);if(_0x15601b['origtransfereruniqueid']==_0x15601b['origtransfererlinkedid']){if(!_[_0xe292('0x26')](queues[_0x15601b['secondtransfererlinkedid']])){utils['info'](util['format'](_0xe292('0x4f'),_0x15601b[_0xe292('0x50')],queues[_0x15601b[_0xe292('0x51')]][_0xe292('0x1f')],_0x15601b[_0xe292('0x52')]));queues[_0x15601b[_0xe292('0x51')]][_0xe292('0x42')]=!![];queues[_0x15601b['secondtransfererlinkedid']][_0xe292('0x48')]=_0xe292('0x53');queues[_0x15601b[_0xe292('0x51')]]['transferexten']=_0x15601b[_0xe292('0x52')];queues[_0x15601b['secondtransfererlinkedid']]['transferuniqueid']=_0x15601b[_0xe292('0x50')];queues[_0x15601b[_0xe292('0x51')]][_0xe292('0x7')]=_0xe292('0x54');}if(!_['isNil'](queues[_0x15601b[_0xe292('0x55')]])){if(_0x15601b[_0xe292('0x56')]&&queues[_0x15601b[_0xe292('0x56')]]){queues[_0x15601b['transfereelinkedid']][_0xe292('0x20')]=0x1;queues[_0x15601b['transfereeuniqueid']]=_[_0xe292('0x57')](queues[_0x15601b['transfereelinkedid']]);queues[_0x15601b[_0xe292('0x46')]][_0xe292('0xd')]=_0x15601b['transfertargetuniqueid'];queues[_0x15601b['transfereeuniqueid']][_0xe292('0x20')]=0x2;queues[_0x15601b['transfereeuniqueid']][_0xe292('0x58')]=queues[_0x15601b[_0xe292('0x51')]][_0xe292('0x58')];queues[_0x15601b[_0xe292('0x46')]][_0xe292('0x59')]=queues[_0x15601b[_0xe292('0x51')]][_0xe292('0x59')];queues[_0x15601b[_0xe292('0x46')]][_0xe292('0x38')]=utils[_0xe292('0x15')]();queues[_0x15601b['transfereeuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x15601b[_0xe292('0x46')]][_0xe292('0x36')]=0x0;queues[_0x15601b[_0xe292('0x46')]][_0xe292('0x5a')]=0x0;utils['info'](util[_0xe292('0x2')](_0xe292('0x5b'),_0x15601b[_0xe292('0x50')],queues[_0x15601b[_0xe292('0x46')]][_0xe292('0x1f')],queues[_0x15601b[_0xe292('0x46')]][_0xe292('0x58')],queues[_0x15601b['transfereeuniqueid']][_0xe292('0x59')]));}else{utils[_0xe292('0x11')](util[_0xe292('0x2')](_0xe292('0x5c'),_0x15601b[_0xe292('0x50')],queues[_0x15601b[_0xe292('0x55')]][_0xe292('0x1f')],_0x15601b[_0xe292('0x51')]));queues[_0x15601b[_0xe292('0x55')]][_0xe292('0xd')]=_0x15601b['secondtransfererlinkedid'];}}}else if(_0x15601b[_0xe292('0x5d')]==_0x15601b[_0xe292('0x51')]){if(!_['isNil'](queues[_0x15601b[_0xe292('0x55')]])){utils['info'](util['format'](_0xe292('0x5e'),_0x15601b[_0xe292('0x50')],queues[_0x15601b[_0xe292('0x55')]][_0xe292('0x1f')],_0x15601b[_0xe292('0x5d')],_0x15601b[_0xe292('0x5f')]));queues[_0x15601b[_0xe292('0x55')]][_0xe292('0x42')]=!![];queues[_0x15601b['origtransfererlinkedid']][_0xe292('0x48')]=_0xe292('0x53');queues[_0x15601b[_0xe292('0x55')]][_0xe292('0x60')]=_0x15601b[_0xe292('0x5f')];queues[_0x15601b[_0xe292('0x55')]][_0xe292('0x61')]=_0x15601b[_0xe292('0x5d')];queues[_0x15601b[_0xe292('0x55')]][_0xe292('0x7')]='ATTENDEDTRANSFER';}if(!_[_0xe292('0x26')](queues[_0x15601b[_0xe292('0x51')]])){if(_0x15601b['transfertargetlinkedid']&&queues[_0x15601b[_0xe292('0x62')]]){queues[_0x15601b[_0xe292('0x62')]][_0xe292('0x20')]=0x1;queues[_0x15601b[_0xe292('0x63')]]=_['clone'](queues[_0x15601b[_0xe292('0x62')]]);queues[_0x15601b[_0xe292('0x63')]][_0xe292('0xd')]=_0x15601b[_0xe292('0x63')];queues[_0x15601b[_0xe292('0x63')]][_0xe292('0x20')]=0x2;queues[_0x15601b['transfertargetuniqueid']]['calleridnum']=queues[_0x15601b[_0xe292('0x55')]]['calleridnum'];queues[_0x15601b[_0xe292('0x63')]][_0xe292('0x59')]=queues[_0x15601b['origtransfererlinkedid']]['calleridname'];queues[_0x15601b[_0xe292('0x63')]][_0xe292('0x38')]=utils[_0xe292('0x15')]();queues[_0x15601b['transfertargetuniqueid']][_0xe292('0x35')]=utils[_0xe292('0x15')]();queues[_0x15601b['transfertargetuniqueid']][_0xe292('0x36')]=0x0;queues[_0x15601b[_0xe292('0x63')]][_0xe292('0x5a')]=0x0;utils[_0xe292('0x11')](util['format'](_0xe292('0x64'),_0x15601b[_0xe292('0x50')],queues[_0x15601b[_0xe292('0x63')]][_0xe292('0x1f')],queues[_0x15601b[_0xe292('0x63')]][_0xe292('0xd')],queues[_0x15601b[_0xe292('0x63')]]['calleridnum'],queues[_0x15601b[_0xe292('0x63')]][_0xe292('0x59')]));}else{utils['info'](util[_0xe292('0x2')](_0xe292('0x5c'),_0x15601b[_0xe292('0x50')],queues[_0x15601b['secondtransfererlinkedid']][_0xe292('0x1f')],_0x15601b[_0xe292('0x55')]));queues[_0x15601b[_0xe292('0x51')]][_0xe292('0xd')]=_0x15601b['origtransfererlinkedid'];}}}}catch(_0x42ad93){utils[_0xe292('0x16')](util[_0xe292('0x2')](_0xe292('0x4e'),_0x15601b[_0xe292('0x50')]),_0x42ad93);}};exports[_0xe292('0x65')]=function(_0xb88a66){try{if(!_[_0xe292('0x26')](queues[_0xb88a66[_0xe292('0x4')]])){utils['debug'](util[_0xe292('0x2')](_0xe292('0x66'),_0xb88a66['uniqueid']),_0xb88a66);queues[_0xb88a66[_0xe292('0x4')]][_0xe292('0x67')]=utils[_0xe292('0x15')]();utils[_0xe292('0x11')](util[_0xe292('0x2')](_0xe292('0x68'),_0xb88a66[_0xe292('0x4')],queues[_0xb88a66[_0xe292('0x4')]][_0xe292('0x1f')],queues[_0xb88a66[_0xe292('0x4')]][_0xe292('0x67')]));}}catch(_0x4d4ed3){utils[_0xe292('0x16')](util['format'](_0xe292('0x66'),_0xb88a66[_0xe292('0x4')]),_0x4d4ed3);}};exports[_0xe292('0x69')]=function(_0x46eab2){try{if(!_[_0xe292('0x26')](queues[_0x46eab2[_0xe292('0x4')]])){if(!_[_0xe292('0x26')](queues[_0x46eab2[_0xe292('0x4')]][_0xe292('0x67')])){utils[_0xe292('0xf')](util[_0xe292('0x2')](_0xe292('0x6a'),_0x46eab2[_0xe292('0x4')]),_0x46eab2);queues[_0x46eab2['uniqueid']][_0xe292('0x5a')]+=utils[_0xe292('0x37')](utils[_0xe292('0x15')](),queues[_0x46eab2[_0xe292('0x4')]][_0xe292('0x67')]);utils[_0xe292('0x11')](util['format'](_0xe292('0x6b'),_0x46eab2[_0xe292('0x4')],queues[_0x46eab2[_0xe292('0x4')]][_0xe292('0x1f')],queues[_0x46eab2[_0xe292('0x4')]][_0xe292('0x5a')]));delete queues[_0x46eab2[_0xe292('0x4')]][_0xe292('0x67')];}}}catch(_0x28ce46){utils['error'](util['format']('[%s][queues][musiconholdstop]',_0x46eab2[_0xe292('0x4')]),_0x28ce46);}}; \ No newline at end of file +var _0x40fd=['[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','position','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','debug','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandon','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x40fd,0x163));var _0xd40f=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x40fd[_0x27beea];return _0x122645;};'use strict';var _=require(_0xd40f('0x0'));var util=require(_0xd40f('0x1'));var utils=require(_0xd40f('0x2'));var queues={};function writeDB(_0x35cbbc){utils[_0xd40f('0x3')](util[_0xd40f('0x4')](_0xd40f('0x5'),_0x35cbbc[_0xd40f('0x6')],_0x35cbbc[_0xd40f('0x7')],_0x35cbbc['queue'],_0x35cbbc[_0xd40f('0x8')],_0x35cbbc['calleridnum'],_0x35cbbc['accountcode'],_0x35cbbc[_0xd40f('0x9')]));if(_0x35cbbc[_0xd40f('0xa')]){utils[_0xd40f('0xb')](_0x35cbbc[_0xd40f('0xa')])['then'](function(_0x16b4f1){if(_0x16b4f1){_0x35cbbc['type']=_0x16b4f1[_0xd40f('0xc')];}utils[_0xd40f('0xd')]('CreateVoiceQueueReport',_0x35cbbc);});}else{utils['request'](_0xd40f('0xe'),_0x35cbbc);}if(_0x35cbbc[_0xd40f('0xf')]){delete queues[_0x35cbbc['transfereduniqueid']];}else{delete queues[_0x35cbbc[_0xd40f('0x6')]];}}exports[_0xd40f('0x10')]=function(_0x5ea52b){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x5ea52b[_0xd40f('0x6')]),_0x5ea52b);utils[_0xd40f('0x3')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5ea52b[_0xd40f('0x6')],_0x5ea52b[_0xd40f('0xa')],_0x5ea52b[_0xd40f('0x11')]));queues[_0x5ea52b['uniqueid']]=_['assign'](_0x5ea52b,{'originalposition':_0x5ea52b[_0xd40f('0x11')],'queuecallerjoinAt':utils[_0xd40f('0x12')](),'mohtime':0x0});}catch(_0x950fc4){utils[_0xd40f('0x13')](util['format'](_0xd40f('0x14'),_0x5ea52b[_0xd40f('0x6')]),_0x950fc4);}};exports[_0xd40f('0x15')]=function(_0x10600e){try{if(!_[_0xd40f('0x16')](queues[_0x10600e[_0xd40f('0x6')]])){utils['debug'](util['format'](_0xd40f('0x17'),_0x10600e[_0xd40f('0x6')]),_0x10600e);if(queues[_0x10600e['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x10600e['uniqueid']]['queuecallerabandon']&&!queues[_0x10600e[_0xd40f('0x6')]][_0xd40f('0x18')]){queues[_0x10600e[_0xd40f('0x6')]][_0xd40f('0x19')]=!![];queues[_0x10600e['uniqueid']]['queuecallercompleteAt']=utils[_0xd40f('0x12')]();queues[_0x10600e[_0xd40f('0x6')]]['queuecallerexitreason']=_0xd40f('0x1a');}utils[_0xd40f('0x3')](util[_0xd40f('0x4')](_0xd40f('0x1b'),_0x10600e[_0xd40f('0x6')],queues[_0x10600e[_0xd40f('0x6')]][_0xd40f('0x1c')],queues[_0x10600e[_0xd40f('0x6')]][_0xd40f('0x9')]));writeDB(queues[_0x10600e[_0xd40f('0x6')]]);}else if(queues[_0x10600e[_0xd40f('0x6')]][_0xd40f('0xf')]){utils[_0xd40f('0x3')](util[_0xd40f('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x10600e[_0xd40f('0x6')],queues[_0x10600e[_0xd40f('0x6')]][_0xd40f('0x1c')],queues[_0x10600e[_0xd40f('0x6')]]['transfereduniqueid']));queues[queues[_0x10600e[_0xd40f('0x6')]][_0xd40f('0xf')]]=queues[_0x10600e[_0xd40f('0x6')]];queues[queues[_0x10600e['uniqueid']][_0xd40f('0xf')]][_0xd40f('0x1d')]=0x2;delete queues[_0x10600e[_0xd40f('0x6')]];}}}catch(_0x23a346){utils[_0xd40f('0x13')](util[_0xd40f('0x4')](_0xd40f('0x17'),_0x10600e['uniqueid']),_0x23a346);}};exports[_0xd40f('0x1e')]=function(_0x210076){try{utils[_0xd40f('0x1f')](util['format'](_0xd40f('0x20'),_0x210076['uniqueid']),_0x210076);if(!_[_0xd40f('0x16')](_0x210076[_0xd40f('0x21')][_0xd40f('0x22')])&&_0x210076[_0xd40f('0x23')]['toUpperCase']()!==_0xd40f('0x24')){if(!_[_0xd40f('0x16')](queues[_0x210076[_0xd40f('0x6')]])){queues[_0x210076['uniqueid']]['queuecallerabandon']=![];queues[_0x210076['uniqueid']][_0xd40f('0x25')]=null;queues[_0x210076['uniqueid']][_0xd40f('0x18')]=!![];queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x26')]=utils['now']();queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x9')]=_0x210076[_0xd40f('0x23')][_0xd40f('0x27')]();utils['info'](util['format'](_0xd40f('0x28'),_0x210076['uniqueid'],queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x1c')],_0x210076[_0xd40f('0x23')],queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x9')]));writeDB(queues[_0x210076[_0xd40f('0x6')]]);}}else if(!_[_0xd40f('0x16')](_0x210076[_0xd40f('0x21')][_0xd40f('0x29')])){if(!_[_0xd40f('0x16')](queues[_0x210076[_0xd40f('0x6')]])&&!queues[_0x210076[_0xd40f('0x6')]]['queuecallerabandon']){queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x2a')]=![];queues[_0x210076['uniqueid']][_0xd40f('0x25')]=null;queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x18')]=!![];queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x26')]=utils[_0xd40f('0x12')]();queues[_0x210076[_0xd40f('0x6')]]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0xd40f('0x4')](_0xd40f('0x2b'),_0x210076[_0xd40f('0x6')],queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x1c')],_0x210076['value'],queues[_0x210076[_0xd40f('0x6')]][_0xd40f('0x9')]));}}}catch(_0x21fde9){utils[_0xd40f('0x13')](util['format'](_0xd40f('0x20'),_0x210076[_0xd40f('0x6')]),_0x21fde9);}};exports[_0xd40f('0x2a')]=function(_0x26dd87){try{if(!_['isNil'](queues[_0x26dd87['uniqueid']])){utils['debug'](util[_0xd40f('0x4')](_0xd40f('0x2c'),_0x26dd87[_0xd40f('0x6')]),_0x26dd87);queues[_0x26dd87[_0xd40f('0x6')]]['queuecallerexit']=![];queues[_0x26dd87['uniqueid']][_0xd40f('0x26')]=null;queues[_0x26dd87[_0xd40f('0x6')]][_0xd40f('0x2a')]=!![];queues[_0x26dd87[_0xd40f('0x6')]]['queuecallerabandonAt']=utils['now']();queues[_0x26dd87[_0xd40f('0x6')]]['queuecallerexitreason']=_0xd40f('0x2d');utils[_0xd40f('0x3')](util[_0xd40f('0x4')](_0xd40f('0x2e'),_0x26dd87['uniqueid'],queues[_0x26dd87[_0xd40f('0x6')]][_0xd40f('0x1c')],queues[_0x26dd87['uniqueid']][_0xd40f('0x9')]));}}catch(_0x35e5c6){utils[_0xd40f('0x13')](util[_0xd40f('0x4')](_0xd40f('0x2c'),_0x26dd87[_0xd40f('0x6')]),_0x35e5c6);}};exports[_0xd40f('0x2f')]=function(_0x2a1e61){try{if(!_[_0xd40f('0x16')](queues[_0x2a1e61[_0xd40f('0x6')]])){utils[_0xd40f('0x1f')](util[_0xd40f('0x4')]('[%s][queues][queuecallerleave]',_0x2a1e61[_0xd40f('0x6')]),_0x2a1e61);utils[_0xd40f('0x3')](util[_0xd40f('0x4')](_0xd40f('0x30'),_0x2a1e61[_0xd40f('0x6')],queues[_0x2a1e61[_0xd40f('0x6')]][_0xd40f('0x1c')],_0x2a1e61[_0xd40f('0x31')],_0x2a1e61[_0xd40f('0x32')]));queues[_0x2a1e61[_0xd40f('0x6')]][_0xd40f('0x2f')]=!![];queues[_0x2a1e61['uniqueid']][_0xd40f('0x33')]=utils[_0xd40f('0x12')]();queues[_0x2a1e61[_0xd40f('0x6')]][_0xd40f('0x34')]=utils[_0xd40f('0x35')](queues[_0x2a1e61['uniqueid']][_0xd40f('0x33')],queues[_0x2a1e61['uniqueid']][_0xd40f('0x36')]);queues[_0x2a1e61['uniqueid']][_0xd40f('0x11')]=_0x2a1e61[_0xd40f('0x11')];queues[_0x2a1e61[_0xd40f('0x6')]]['count']=_0x2a1e61[_0xd40f('0x37')];queues[_0x2a1e61[_0xd40f('0x6')]][_0xd40f('0x31')]=_0x2a1e61[_0xd40f('0x31')];queues[_0x2a1e61[_0xd40f('0x6')]][_0xd40f('0x32')]=_0x2a1e61['connectedlinename'];}}catch(_0x58c288){utils[_0xd40f('0x13')](util[_0xd40f('0x4')]('[%s][queues][queuecallerleave]',_0x2a1e61[_0xd40f('0x6')]),_0x58c288);}};exports[_0xd40f('0x38')]=function(_0x5253c5){try{if(!_['isNil'](queues[_0x5253c5[_0xd40f('0x6')]])){utils[_0xd40f('0x1f')](util['format'](_0xd40f('0x39'),_0x5253c5[_0xd40f('0x6')]),_0x5253c5);utils[_0xd40f('0x3')](util[_0xd40f('0x4')](_0xd40f('0x3a'),_0x5253c5['uniqueid'],queues[_0x5253c5[_0xd40f('0x6')]][_0xd40f('0x1c')],_0x5253c5['membername'],_0x5253c5[_0xd40f('0x3b')]));queues[_0x5253c5['uniqueid']]['queuecallerabandon']=![];queues[_0x5253c5[_0xd40f('0x6')]]['queuecallerabandon']=![];queues[_0x5253c5['uniqueid']]['queuecallerabandonAt']=null;queues[_0x5253c5[_0xd40f('0x6')]]['queuecallerexit']=![];queues[_0x5253c5[_0xd40f('0x6')]][_0xd40f('0x9')]=null;queues[_0x5253c5[_0xd40f('0x6')]]['queuecallerexitAt']=null;queues[_0x5253c5[_0xd40f('0x6')]][_0xd40f('0x3c')]=!![];queues[_0x5253c5[_0xd40f('0x6')]]['accountcode']=_0x5253c5['destaccountcode'];queues[_0x5253c5[_0xd40f('0x6')]][_0xd40f('0x8')]=_0x5253c5[_0xd40f('0x3d')];}}catch(_0x32c010){utils[_0xd40f('0x13')](util[_0xd40f('0x4')](_0xd40f('0x39'),_0x5253c5[_0xd40f('0x6')]),_0x32c010);}};exports[_0xd40f('0x3e')]=function(_0x5c3b4e){try{if(!_['isNil'](queues[_0x5c3b4e['uniqueid']])){if(queues[_0x5c3b4e[_0xd40f('0x6')]]['queuecallerleaveAt']){utils[_0xd40f('0x1f')](util[_0xd40f('0x4')](_0xd40f('0x3f'),_0x5c3b4e[_0xd40f('0x6')]),_0x5c3b4e);queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x2a')]=![];queues[_0x5c3b4e['uniqueid']][_0xd40f('0x2a')]=![];queues[_0x5c3b4e['uniqueid']]['queuecallerabandonAt']=null;queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x18')]=![];queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x26')]=null;queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x3c')]=!![];queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x8')]=_0x5c3b4e['membername'];queues[_0x5c3b4e[_0xd40f('0x6')]]['queuecallercomplete']=!![];queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x40')]=utils['now']();if(_0x5c3b4e['reason']=='transfer'){if(!queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x41')]){queues[_0x5c3b4e[_0xd40f('0x6')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x9')]=_0xd40f('0x42')+_0x5c3b4e[_0xd40f('0x43')][_0xd40f('0x27')]();}utils['info'](util[_0xd40f('0x4')](_0xd40f('0x44'),_0x5c3b4e['uniqueid'],queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x1c')],_0x5c3b4e[_0xd40f('0x3d')],queues[_0x5c3b4e[_0xd40f('0x6')]][_0xd40f('0x9')]));writeDB(queues[_0x5c3b4e[_0xd40f('0x6')]]);}}}catch(_0x37377a){utils[_0xd40f('0x13')](util[_0xd40f('0x4')](_0xd40f('0x3f'),_0x5c3b4e['uniqueid']),_0x37377a);}};exports['blindtransfer']=function(_0x14a61b){try{if(!_[_0xd40f('0x16')](queues[_0x14a61b['transfereeuniqueid']])){utils['debug'](util['format'](_0xd40f('0x45'),_0x14a61b[_0xd40f('0x6')]),_0x14a61b);queues[_0x14a61b[_0xd40f('0x46')]][_0xd40f('0x41')]=!![];queues[_0x14a61b[_0xd40f('0x46')]][_0xd40f('0x47')]=_0xd40f('0x48');queues[_0x14a61b[_0xd40f('0x46')]][_0xd40f('0x49')]=_0x14a61b[_0xd40f('0x4a')];queues[_0x14a61b[_0xd40f('0x46')]][_0xd40f('0x4b')]=_0x14a61b[_0xd40f('0x46')];queues[_0x14a61b[_0xd40f('0x46')]][_0xd40f('0x9')]=_0xd40f('0x4c');utils[_0xd40f('0x3')](util[_0xd40f('0x4')](_0xd40f('0x4d'),_0x14a61b[_0xd40f('0x6')],queues[_0x14a61b[_0xd40f('0x46')]][_0xd40f('0x1c')],_0x14a61b[_0xd40f('0x46')],_0x14a61b[_0xd40f('0x4a')]));}}catch(_0x2db419){utils['error'](util['format'](_0xd40f('0x45'),_0x14a61b[_0xd40f('0x6')]),_0x2db419);}};exports[_0xd40f('0x4e')]=function(_0x3662dc){try{utils[_0xd40f('0x1f')](util[_0xd40f('0x4')]('[%s][queues][attendedtransfer]',_0x3662dc[_0xd40f('0x4f')]),_0x3662dc);if(_0x3662dc[_0xd40f('0x4f')]==_0x3662dc[_0xd40f('0x50')]){if(!_[_0xd40f('0x16')](queues[_0x3662dc[_0xd40f('0x51')]])){utils['info'](util[_0xd40f('0x4')](_0xd40f('0x52'),_0x3662dc[_0xd40f('0x4f')],queues[_0x3662dc[_0xd40f('0x51')]][_0xd40f('0x1c')],_0x3662dc[_0xd40f('0x53')]));queues[_0x3662dc[_0xd40f('0x51')]][_0xd40f('0x41')]=!![];queues[_0x3662dc['secondtransfererlinkedid']]['transfertype']=_0xd40f('0x54');queues[_0x3662dc[_0xd40f('0x51')]][_0xd40f('0x49')]=_0x3662dc['origtransfererexten'];queues[_0x3662dc[_0xd40f('0x51')]][_0xd40f('0x4b')]=_0x3662dc[_0xd40f('0x4f')];queues[_0x3662dc[_0xd40f('0x51')]][_0xd40f('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xd40f('0x16')](queues[_0x3662dc[_0xd40f('0x50')]])){if(_0x3662dc[_0xd40f('0x55')]&&queues[_0x3662dc['transfereelinkedid']]){queues[_0x3662dc[_0xd40f('0x55')]][_0xd40f('0x1d')]=0x1;queues[_0x3662dc[_0xd40f('0x46')]]=_[_0xd40f('0x56')](queues[_0x3662dc[_0xd40f('0x55')]]);queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0xf')]=_0x3662dc[_0xd40f('0x57')];queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0x1d')]=0x2;queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0x58')]=queues[_0x3662dc[_0xd40f('0x51')]][_0xd40f('0x58')];queues[_0x3662dc['transfereeuniqueid']]['calleridname']=queues[_0x3662dc[_0xd40f('0x51')]][_0xd40f('0x59')];queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0x36')]=utils[_0xd40f('0x12')]();queues[_0x3662dc[_0xd40f('0x46')]]['queuecallerleaveAt']=utils['now']();queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0x34')]=0x0;queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0x5a')]=0x0;utils[_0xd40f('0x3')](util['format'](_0xd40f('0x5b'),_0x3662dc[_0xd40f('0x4f')],queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0x1c')],queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0x58')],queues[_0x3662dc[_0xd40f('0x46')]][_0xd40f('0x59')]));}else{utils['info'](util[_0xd40f('0x4')](_0xd40f('0x5c'),_0x3662dc['origtransfereruniqueid'],queues[_0x3662dc[_0xd40f('0x50')]][_0xd40f('0x1c')],_0x3662dc[_0xd40f('0x51')]));queues[_0x3662dc[_0xd40f('0x50')]][_0xd40f('0xf')]=_0x3662dc[_0xd40f('0x51')];}}}else if(_0x3662dc[_0xd40f('0x5d')]==_0x3662dc[_0xd40f('0x51')]){if(!_[_0xd40f('0x16')](queues[_0x3662dc[_0xd40f('0x50')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3662dc['origtransfereruniqueid'],queues[_0x3662dc['origtransfererlinkedid']][_0xd40f('0x1c')],_0x3662dc['secondtransfereruniqueid'],_0x3662dc[_0xd40f('0x5e')]));queues[_0x3662dc['origtransfererlinkedid']][_0xd40f('0x41')]=!![];queues[_0x3662dc[_0xd40f('0x50')]][_0xd40f('0x47')]=_0xd40f('0x54');queues[_0x3662dc['origtransfererlinkedid']][_0xd40f('0x49')]=_0x3662dc[_0xd40f('0x5e')];queues[_0x3662dc[_0xd40f('0x50')]][_0xd40f('0x4b')]=_0x3662dc[_0xd40f('0x5d')];queues[_0x3662dc[_0xd40f('0x50')]][_0xd40f('0x9')]=_0xd40f('0x5f');}if(!_[_0xd40f('0x16')](queues[_0x3662dc[_0xd40f('0x51')]])){if(_0x3662dc[_0xd40f('0x60')]&&queues[_0x3662dc['transfertargetlinkedid']]){queues[_0x3662dc['transfertargetlinkedid']][_0xd40f('0x1d')]=0x1;queues[_0x3662dc['transfertargetuniqueid']]=_['clone'](queues[_0x3662dc[_0xd40f('0x60')]]);queues[_0x3662dc['transfertargetuniqueid']][_0xd40f('0xf')]=_0x3662dc['transfertargetuniqueid'];queues[_0x3662dc[_0xd40f('0x57')]][_0xd40f('0x1d')]=0x2;queues[_0x3662dc[_0xd40f('0x57')]][_0xd40f('0x58')]=queues[_0x3662dc[_0xd40f('0x50')]][_0xd40f('0x58')];queues[_0x3662dc['transfertargetuniqueid']][_0xd40f('0x59')]=queues[_0x3662dc[_0xd40f('0x50')]][_0xd40f('0x59')];queues[_0x3662dc[_0xd40f('0x57')]][_0xd40f('0x36')]=utils[_0xd40f('0x12')]();queues[_0x3662dc[_0xd40f('0x57')]]['queuecallerleaveAt']=utils[_0xd40f('0x12')]();queues[_0x3662dc[_0xd40f('0x57')]][_0xd40f('0x34')]=0x0;queues[_0x3662dc[_0xd40f('0x57')]][_0xd40f('0x5a')]=0x0;utils[_0xd40f('0x3')](util[_0xd40f('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x3662dc[_0xd40f('0x4f')],queues[_0x3662dc['transfertargetuniqueid']][_0xd40f('0x1c')],queues[_0x3662dc[_0xd40f('0x57')]][_0xd40f('0xf')],queues[_0x3662dc[_0xd40f('0x57')]][_0xd40f('0x58')],queues[_0x3662dc[_0xd40f('0x57')]][_0xd40f('0x59')]));}else{utils[_0xd40f('0x3')](util[_0xd40f('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3662dc[_0xd40f('0x4f')],queues[_0x3662dc[_0xd40f('0x51')]]['name'],_0x3662dc['origtransfererlinkedid']));queues[_0x3662dc[_0xd40f('0x51')]][_0xd40f('0xf')]=_0x3662dc[_0xd40f('0x50')];}}}}catch(_0x1632cd){utils[_0xd40f('0x13')](util[_0xd40f('0x4')]('[%s][queues][attendedtransfer]',_0x3662dc[_0xd40f('0x4f')]),_0x1632cd);}};exports[_0xd40f('0x61')]=function(_0x56331e){try{if(!_[_0xd40f('0x16')](queues[_0x56331e[_0xd40f('0x6')]])){utils[_0xd40f('0x1f')](util[_0xd40f('0x4')](_0xd40f('0x62'),_0x56331e[_0xd40f('0x6')]),_0x56331e);queues[_0x56331e[_0xd40f('0x6')]][_0xd40f('0x63')]=utils[_0xd40f('0x12')]();utils[_0xd40f('0x3')](util[_0xd40f('0x4')](_0xd40f('0x64'),_0x56331e[_0xd40f('0x6')],queues[_0x56331e[_0xd40f('0x6')]][_0xd40f('0x1c')],queues[_0x56331e[_0xd40f('0x6')]][_0xd40f('0x63')]));}}catch(_0x40b502){utils['error'](util[_0xd40f('0x4')](_0xd40f('0x62'),_0x56331e['uniqueid']),_0x40b502);}};exports['musiconholdstop']=function(_0x5f5d44){try{if(!_[_0xd40f('0x16')](queues[_0x5f5d44[_0xd40f('0x6')]])){if(!_[_0xd40f('0x16')](queues[_0x5f5d44[_0xd40f('0x6')]][_0xd40f('0x63')])){utils['debug'](util[_0xd40f('0x4')](_0xd40f('0x65'),_0x5f5d44[_0xd40f('0x6')]),_0x5f5d44);queues[_0x5f5d44[_0xd40f('0x6')]][_0xd40f('0x5a')]+=utils[_0xd40f('0x35')](utils['now'](),queues[_0x5f5d44['uniqueid']][_0xd40f('0x63')]);utils[_0xd40f('0x3')](util['format'](_0xd40f('0x66'),_0x5f5d44[_0xd40f('0x6')],queues[_0x5f5d44[_0xd40f('0x6')]][_0xd40f('0x1c')],queues[_0x5f5d44[_0xd40f('0x6')]][_0xd40f('0x5a')]));delete queues[_0x5f5d44[_0xd40f('0x6')]][_0xd40f('0x63')];}}}catch(_0x3c5bc1){utils[_0xd40f('0x13')](util[_0xd40f('0x4')]('[%s][queues][musiconholdstop]',_0x5f5d44[_0xd40f('0x6')]),_0x3c5bc1);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a38d589..36631e2 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02a7=['calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','monitors','forEach','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','cdr','split','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x02a7,0xf4));var _0x702a=function(_0x4ba8a4,_0x3202ca){_0x4ba8a4=_0x4ba8a4-0x0;var _0x139cc0=_0x02a7[_0x4ba8a4];return _0x139cc0;};'use strict';var _=require(_0x702a('0x0'));var util=require('util');var utils=require(_0x702a('0x1'));var recordings={};function writeDB(_0x2f6577){utils[_0x702a('0x2')](util[_0x702a('0x3')](_0x702a('0x4'),_0x2f6577[_0x702a('0x5')]));if(_0x2f6577[_0x702a('0x6')]){utils['getUserByInternal'](_0x2f6577['accountcode'])['then'](function(_0x329329){if(_0x329329){_0x2f6577['membername']=_0x329329[_0x702a('0x7')];_0x2f6577[_0x702a('0x8')]=_0x329329['id'];}utils[_0x702a('0x9')]('CreateVoiceRecording',_0x2f6577);});}else{utils[_0x702a('0x9')](_0x702a('0xa'),_0x2f6577);}}exports['newchannel']=function(_0x1fe1aa){try{utils[_0x702a('0xb')](util['format'](_0x702a('0xc'),_0x1fe1aa[_0x702a('0x5')]),_0x1fe1aa);if(_0x1fe1aa[_0x702a('0x5')]==_0x1fe1aa['linkedid']){utils[_0x702a('0x2')](util[_0x702a('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1fe1aa['uniqueid'],_0x1fe1aa[_0x702a('0xd')],_0x1fe1aa[_0x702a('0xe')]));recordings[_0x1fe1aa[_0x702a('0x5')]]={'uniqueid':_0x1fe1aa[_0x702a('0x5')],'accountcode':_0x1fe1aa[_0x702a('0x6')],'exten':_0x1fe1aa[_0x702a('0xe')],'context':_0x1fe1aa[_0x702a('0xd')],'channel':_0x1fe1aa[_0x702a('0xf')],'monitors':[]};}}catch(_0x4ffbfb){utils[_0x702a('0x10')](util['format'](_0x702a('0xc'),_0x1fe1aa[_0x702a('0x5')]),_0x4ffbfb);}};exports[_0x702a('0x11')]=function(_0x35d0d2){try{utils['debug'](util[_0x702a('0x3')]('[%s][recordings][newstate]',_0x35d0d2['uniqueid']),_0x35d0d2);if(!_[_0x702a('0x12')](recordings[_0x35d0d2[_0x702a('0x5')]])&&_0x35d0d2[_0x702a('0x13')]==0x6){utils['info'](util[_0x702a('0x3')](_0x702a('0x14'),_0x35d0d2[_0x702a('0x5')],_0x35d0d2[_0x702a('0xd')],_0x35d0d2[_0x702a('0xf')]));}else if(!_['isNil'](recordings[_0x35d0d2[_0x702a('0x15')]])&&_0x35d0d2[_0x702a('0x13')]==0x6&&_0x35d0d2[_0x702a('0xd')]!=_0x702a('0x16')){utils[_0x702a('0x2')](util['format'](_0x702a('0x17'),_0x35d0d2[_0x702a('0x5')],_0x35d0d2[_0x702a('0x15')],_0x35d0d2[_0x702a('0xd')],_0x35d0d2[_0x702a('0xf')]));recordings[_0x35d0d2[_0x702a('0x15')]][_0x702a('0x6')]=_0x35d0d2['accountcode'];}}catch(_0x487c07){utils[_0x702a('0x10')](util[_0x702a('0x3')](_0x702a('0x18'),_0x35d0d2[_0x702a('0x5')]),_0x487c07);}};exports['varset']=function(_0x2557f5){try{if(!_[_0x702a('0x12')](_0x2557f5[_0x702a('0x19')])&&!_[_0x702a('0x12')](_0x2557f5[_0x702a('0x19')]['mixmonitor_filename'])){utils[_0x702a('0xb')](util[_0x702a('0x3')]('[%s][recordings][varset]',_0x2557f5[_0x702a('0x5')]),_0x2557f5);utils[_0x702a('0x2')](util['format'](_0x702a('0x1a'),_0x2557f5[_0x702a('0x5')],_0x2557f5[_0x702a('0x19')],_0x2557f5[_0x702a('0x1b')]));if(_[_0x702a('0x1c')](_0x2557f5[_0x702a('0x1b')],_0x702a('0x1d'))){_0x2557f5[_0x702a('0x1b')]=_0x2557f5['value']['replace']('.wav49',_0x702a('0x1e'));}if(recordings[_0x2557f5[_0x702a('0x15')]]){var _0x2942c3=_[_0x702a('0x1f')](recordings[_0x2557f5[_0x702a('0x15')]]['monitors'],{'value':_0x2557f5[_0x702a('0x1b')]});if(_[_0x702a('0x12')](_0x2942c3)){recordings[_0x2557f5[_0x702a('0x15')]]['monitors'][_0x702a('0x20')]({'value':_0x2557f5[_0x702a('0x1b')]});}}}}catch(_0x5f45bf){utils[_0x702a('0x10')](util['format'](_0x702a('0x21'),_0x2557f5[_0x702a('0x5')]),_0x5f45bf);}};exports[_0x702a('0x22')]=function(_0x1a06aa){try{if(!_['isNil'](recordings[_0x1a06aa[_0x702a('0x5')]])){utils[_0x702a('0xb')](util[_0x702a('0x3')](_0x702a('0x23'),_0x1a06aa[_0x702a('0x5')]),_0x1a06aa);utils[_0x702a('0x2')](util[_0x702a('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1a06aa['uniqueid'],_0x1a06aa[_0x702a('0x24')],_0x1a06aa[_0x702a('0x25')],_0x1a06aa[_0x702a('0x26')]));recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x24')]=_0x1a06aa[_0x702a('0x24')];recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x25')]=_0x1a06aa[_0x702a('0x25')];recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x27')]=_0x1a06aa[_0x702a('0x27')];recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x28')]=_0x1a06aa[_0x702a('0x28')];if(recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x29')]==_0x702a('0x2a')&&recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x6')]){recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x27')]=recordings[_0x1a06aa[_0x702a('0x5')]]['accountcode'];recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x28')]='';}recordings[_0x1a06aa[_0x702a('0x5')]][_0x702a('0x2b')][_0x702a('0x2c')](function(_0x26820e){var _0x393a94=_['clone'](recordings[_0x1a06aa['uniqueid']]);_0x393a94[_0x702a('0x1b')]=_0x26820e['value'];writeDB(_0x393a94);});delete recordings[_0x1a06aa[_0x702a('0x5')]];}}catch(_0x177fe8){utils[_0x702a('0x10')](util['format'](_0x702a('0x23'),_0x1a06aa[_0x702a('0x5')]),_0x177fe8);}};exports['newexten']=function(_0x285f00){try{if(!_[_0x702a('0x12')](recordings[_0x285f00['uniqueid']])){utils[_0x702a('0xb')](util[_0x702a('0x3')](_0x702a('0x2d'),_0x285f00[_0x702a('0x5')]),_0x285f00);utils['info'](util[_0x702a('0x3')](_0x702a('0x2e'),_0x285f00[_0x702a('0x5')],_0x285f00['application'],_0x285f00[_0x702a('0x2f')]));if(_0x285f00[_0x702a('0x30')]['toLowerCase']()=='set'&&_['startsWith'](_0x285f00[_0x702a('0x2f')][_0x702a('0x31')](),_0x702a('0x32'))){var _0x25203a=_0x285f00['appdata'][_0x702a('0x33')]('=');var _0x16b8c4=_0x25203a[0x0]['substring'](_0x25203a[0x0]['lastIndexOf']('(')+0x1,_0x25203a[0x0]['lastIndexOf'](')'));var _0x584299=_0x25203a[0x1];recordings[_0x285f00[_0x702a('0x5')]][_0x16b8c4]=_0x584299;}}}catch(_0x2cc425){utils[_0x702a('0x10')](util[_0x702a('0x3')](_0x702a('0x2d'),_0x285f00[_0x702a('0x5')]),_0x2cc425);}};exports[_0x702a('0x34')]=function(_0x34216e){try{if(!_[_0x702a('0x12')](recordings[_0x34216e['uniqueid']])){utils[_0x702a('0xb')](util[_0x702a('0x3')](_0x702a('0x35'),_0x34216e['uniqueid']),_0x34216e);utils['info'](util['format'](_0x702a('0x36'),_0x34216e['uniqueid'],_0x34216e['queue']));recordings[_0x34216e['uniqueid']][_0x702a('0x37')]=_0x34216e[_0x702a('0x37')];}}catch(_0x1fc252){utils[_0x702a('0x10')](util['format'](_0x702a('0x35'),_0x34216e[_0x702a('0x5')]),_0x1fc252);}}; \ No newline at end of file +var _0x994d=['appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','format','uniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x287fc8,_0x4c7b43){var _0x585b3d=function(_0x2fbbea){while(--_0x2fbbea){_0x287fc8['push'](_0x287fc8['shift']());}};_0x585b3d(++_0x4c7b43);}(_0x994d,0x90));var _0xd994=function(_0x4f694e,_0x86a2a9){_0x4f694e=_0x4f694e-0x0;var _0x4219af=_0x994d[_0x4f694e];return _0x4219af;};'use strict';var _=require(_0xd994('0x0'));var util=require('util');var utils=require(_0xd994('0x1'));var recordings={};function writeDB(_0x5ca1c0){utils['info'](util[_0xd994('0x2')]('[%s][recordings][writeDB]',_0x5ca1c0[_0xd994('0x3')]));if(_0x5ca1c0['accountcode']){utils[_0xd994('0x4')](_0x5ca1c0[_0xd994('0x5')])[_0xd994('0x6')](function(_0x321d5e){if(_0x321d5e){_0x5ca1c0[_0xd994('0x7')]=_0x321d5e[_0xd994('0x8')];_0x5ca1c0[_0xd994('0x9')]=_0x321d5e['id'];}utils[_0xd994('0xa')](_0xd994('0xb'),_0x5ca1c0);});}else{utils['request'](_0xd994('0xb'),_0x5ca1c0);}}exports[_0xd994('0xc')]=function(_0x51afe4){try{utils[_0xd994('0xd')](util['format'](_0xd994('0xe'),_0x51afe4[_0xd994('0x3')]),_0x51afe4);if(_0x51afe4[_0xd994('0x3')]==_0x51afe4[_0xd994('0xf')]){utils[_0xd994('0x10')](util['format'](_0xd994('0x11'),_0x51afe4[_0xd994('0x3')],_0x51afe4[_0xd994('0x12')],_0x51afe4[_0xd994('0x13')]));recordings[_0x51afe4[_0xd994('0x3')]]={'uniqueid':_0x51afe4['uniqueid'],'accountcode':_0x51afe4[_0xd994('0x5')],'exten':_0x51afe4[_0xd994('0x13')],'context':_0x51afe4['context'],'channel':_0x51afe4['channel'],'monitors':[]};}}catch(_0x41ebcf){utils[_0xd994('0x14')](util[_0xd994('0x2')]('[%s][recordings][newchannel]',_0x51afe4[_0xd994('0x3')]),_0x41ebcf);}};exports['newstate']=function(_0x1574f7){try{utils[_0xd994('0xd')](util[_0xd994('0x2')](_0xd994('0x15'),_0x1574f7[_0xd994('0x3')]),_0x1574f7);if(!_[_0xd994('0x16')](recordings[_0x1574f7['uniqueid']])&&_0x1574f7['channelstate']==0x6){utils[_0xd994('0x10')](util[_0xd994('0x2')](_0xd994('0x17'),_0x1574f7[_0xd994('0x3')],_0x1574f7['context'],_0x1574f7[_0xd994('0x18')]));}else if(!_[_0xd994('0x16')](recordings[_0x1574f7[_0xd994('0xf')]])&&_0x1574f7[_0xd994('0x19')]==0x6&&_0x1574f7[_0xd994('0x12')]!=_0xd994('0x1a')){utils[_0xd994('0x10')](util[_0xd994('0x2')](_0xd994('0x1b'),_0x1574f7[_0xd994('0x3')],_0x1574f7['linkedid'],_0x1574f7[_0xd994('0x12')],_0x1574f7['channel']));recordings[_0x1574f7[_0xd994('0xf')]]['accountcode']=_0x1574f7[_0xd994('0x5')];}}catch(_0xb7d353){utils['error'](util[_0xd994('0x2')](_0xd994('0x15'),_0x1574f7['uniqueid']),_0xb7d353);}};exports[_0xd994('0x1c')]=function(_0x40ba13){try{if(!_[_0xd994('0x16')](_0x40ba13[_0xd994('0x1d')])&&!_['isNil'](_0x40ba13[_0xd994('0x1d')][_0xd994('0x1e')])){utils['debug'](util[_0xd994('0x2')](_0xd994('0x1f'),_0x40ba13['uniqueid']),_0x40ba13);utils['info'](util['format'](_0xd994('0x20'),_0x40ba13[_0xd994('0x3')],_0x40ba13[_0xd994('0x1d')],_0x40ba13[_0xd994('0x21')]));if(_['endsWith'](_0x40ba13[_0xd994('0x21')],_0xd994('0x22'))){_0x40ba13[_0xd994('0x21')]=_0x40ba13[_0xd994('0x21')][_0xd994('0x23')]('.wav49',_0xd994('0x24'));}if(recordings[_0x40ba13[_0xd994('0xf')]]){var _0x24612c=_[_0xd994('0x25')](recordings[_0x40ba13[_0xd994('0xf')]][_0xd994('0x26')],{'value':_0x40ba13[_0xd994('0x21')]});if(_[_0xd994('0x16')](_0x24612c)){recordings[_0x40ba13[_0xd994('0xf')]][_0xd994('0x26')][_0xd994('0x27')]({'value':_0x40ba13[_0xd994('0x21')]});}}}}catch(_0xf3a4e4){utils[_0xd994('0x14')](util['format'](_0xd994('0x1f'),_0x40ba13['uniqueid']),_0xf3a4e4);}};exports[_0xd994('0x28')]=function(_0x37a2f7){try{if(!_['isNil'](recordings[_0x37a2f7[_0xd994('0x3')]])){utils[_0xd994('0xd')](util[_0xd994('0x2')](_0xd994('0x29'),_0x37a2f7[_0xd994('0x3')]),_0x37a2f7);utils[_0xd994('0x10')](util[_0xd994('0x2')](_0xd994('0x2a'),_0x37a2f7['uniqueid'],_0x37a2f7[_0xd994('0x2b')],_0x37a2f7[_0xd994('0x2c')],_0x37a2f7[_0xd994('0x2d')]));recordings[_0x37a2f7['uniqueid']]['calleridnum']=_0x37a2f7['calleridnum'];recordings[_0x37a2f7[_0xd994('0x3')]][_0xd994('0x2c')]=_0x37a2f7[_0xd994('0x2c')];recordings[_0x37a2f7[_0xd994('0x3')]][_0xd994('0x2e')]=_0x37a2f7[_0xd994('0x2e')];recordings[_0x37a2f7[_0xd994('0x3')]][_0xd994('0x2f')]=_0x37a2f7['connectedlinename'];if(recordings[_0x37a2f7[_0xd994('0x3')]][_0xd994('0x30')]=='outbound'&&recordings[_0x37a2f7[_0xd994('0x3')]][_0xd994('0x5')]){recordings[_0x37a2f7['uniqueid']][_0xd994('0x2e')]=recordings[_0x37a2f7[_0xd994('0x3')]][_0xd994('0x5')];recordings[_0x37a2f7[_0xd994('0x3')]]['connectedlinename']='';}recordings[_0x37a2f7[_0xd994('0x3')]][_0xd994('0x26')]['forEach'](function(_0x2ca221){var _0x3d7ebb=_[_0xd994('0x31')](recordings[_0x37a2f7['uniqueid']]);_0x3d7ebb[_0xd994('0x21')]=_0x2ca221['value'];writeDB(_0x3d7ebb);});delete recordings[_0x37a2f7[_0xd994('0x3')]];}}catch(_0x5f0224){utils[_0xd994('0x14')](util[_0xd994('0x2')](_0xd994('0x29'),_0x37a2f7[_0xd994('0x3')]),_0x5f0224);}};exports[_0xd994('0x32')]=function(_0x355d86){try{if(!_[_0xd994('0x16')](recordings[_0x355d86[_0xd994('0x3')]])){utils['debug'](util[_0xd994('0x2')](_0xd994('0x33'),_0x355d86[_0xd994('0x3')]),_0x355d86);utils[_0xd994('0x10')](util['format'](_0xd994('0x34'),_0x355d86[_0xd994('0x3')],_0x355d86[_0xd994('0x35')],_0x355d86[_0xd994('0x36')]));if(_0x355d86[_0xd994('0x35')][_0xd994('0x37')]()==_0xd994('0x38')&&_[_0xd994('0x39')](_0x355d86[_0xd994('0x36')][_0xd994('0x37')](),_0xd994('0x3a'))){var _0x170b82=_0x355d86[_0xd994('0x36')][_0xd994('0x3b')]('=');var _0x364879=_0x170b82[0x0][_0xd994('0x3c')](_0x170b82[0x0][_0xd994('0x3d')]('(')+0x1,_0x170b82[0x0][_0xd994('0x3d')](')'));var _0x4b9d2b=_0x170b82[0x1];recordings[_0x355d86[_0xd994('0x3')]][_0x364879]=_0x4b9d2b;}}}catch(_0x2c8951){utils[_0xd994('0x14')](util[_0xd994('0x2')](_0xd994('0x33'),_0x355d86[_0xd994('0x3')]),_0x2c8951);}};exports[_0xd994('0x3e')]=function(_0x4b6184){try{if(!_[_0xd994('0x16')](recordings[_0x4b6184[_0xd994('0x3')]])){utils[_0xd994('0xd')](util[_0xd994('0x2')](_0xd994('0x3f'),_0x4b6184[_0xd994('0x3')]),_0x4b6184);utils['info'](util[_0xd994('0x2')](_0xd994('0x40'),_0x4b6184['uniqueid'],_0x4b6184[_0xd994('0x41')]));recordings[_0x4b6184[_0xd994('0x3')]][_0xd994('0x41')]=_0x4b6184[_0xd994('0x41')];}}catch(_0x4e7ae9){utils['error'](util['format'](_0xd994('0x3f'),_0x4b6184[_0xd994('0x3')]),_0x4e7ae9);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 42c07bf..1dd221a 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf905=['request','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid'];(function(_0x5a52ea,_0x36fb63){var _0xbbbaaa=function(_0x3ca52e){while(--_0x3ca52e){_0x5a52ea['push'](_0x5a52ea['shift']());}};_0xbbbaaa(++_0x36fb63);}(_0xf905,0x15a));var _0x5f90=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf905[_0x101e7b];return _0x4995c0;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');function writeDB(_0x89783d){utils[_0x5f90('0x0')](util['format'](_0x5f90('0x1'),_0x89783d[_0x5f90('0x2')]===_0x5f90('0x3')?_0x89783d[_0x5f90('0x4')]:_0x89783d['uniqueid'],_0x89783d[_0x5f90('0x2')]));utils[_0x5f90('0x5')](_0x5f90('0x6'),_0x89783d);}exports['blindtransfer']=function(_0x1d5ce3){try{utils[_0x5f90('0x7')](util[_0x5f90('0x8')]('[%s][transfers][blindtransfer]',_0x1d5ce3['uniqueid']),_0x1d5ce3);utils[_0x5f90('0x0')](util[_0x5f90('0x8')](_0x5f90('0x9'),_0x1d5ce3[_0x5f90('0xa')],_0x1d5ce3[_0x5f90('0xb')],_0x1d5ce3[_0x5f90('0xc')],_0x1d5ce3[_0x5f90('0xd')],_0x1d5ce3[_0x5f90('0xe')]));_0x1d5ce3[_0x5f90('0x2')]=_0x5f90('0xf');writeDB(_0x1d5ce3);}catch(_0x2a97c9){utils[_0x5f90('0x10')](util[_0x5f90('0x8')](_0x5f90('0x11'),_0x1d5ce3['uniqueid']),_0x2a97c9);}};exports[_0x5f90('0x12')]=function(_0x5d8154){try{utils[_0x5f90('0x7')](util[_0x5f90('0x8')](_0x5f90('0x13'),_0x5d8154['origtransfereruniqueid']),_0x5d8154);utils[_0x5f90('0x0')](util[_0x5f90('0x8')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5d8154[_0x5f90('0x4')],_0x5d8154[_0x5f90('0x14')],_0x5d8154[_0x5f90('0x15')],_0x5d8154['transfertargetcalleridnum'],_0x5d8154[_0x5f90('0x16')]));_0x5d8154=_[_0x5f90('0x17')](_0x5d8154,{'transfererchannel':_0x5d8154[_0x5f90('0x18')],'transferercalleridnum':_0x5d8154[_0x5f90('0x14')],'transferercalleridname':_0x5d8154[_0x5f90('0x15')],'transfererconnectedlinenum':_0x5d8154[_0x5f90('0x19')],'transfererconnectedlinename':_0x5d8154[_0x5f90('0x1a')],'transfereraccountcode':_0x5d8154['origtransfereraccountcode'],'transferercontext':_0x5d8154[_0x5f90('0x1b')],'transfererexten':_0x5d8154[_0x5f90('0x1c')],'transfererlinkedid':_0x5d8154['origtransfererlinkedid'],'context':_0x5d8154[_0x5f90('0x1d')],'extension':_0x5d8154[_0x5f90('0x1e')],'type':_0x5f90('0x3')});if(_[_0x5f90('0x1f')](_0x5d8154[_0x5f90('0x20')])){_0x5d8154=_['assign'](_0x5d8154,{'transfereechannel':_0x5d8154[_0x5f90('0x21')],'transfereecalleridnum':_0x5d8154[_0x5f90('0x22')],'transfereecalleridname':_0x5d8154[_0x5f90('0x16')],'transfereeconnectedlinenum':_0x5d8154[_0x5f90('0x23')],'transfereeconnectedlinename':_0x5d8154[_0x5f90('0x24')],'transfereeaccountcode':_0x5d8154['transfertargetaccountcode'],'transfereecontext':_0x5d8154[_0x5f90('0x25')],'transfereeexten':_0x5d8154['transfertargetexten'],'transfereelinkedid':_0x5d8154[_0x5f90('0x26')]});}writeDB(_0x5d8154);}catch(_0x5ccf62){utils[_0x5f90('0x10')](util[_0x5f90('0x8')]('[%s][transfers][attendedtransfer]',_0x5d8154[_0x5f90('0x4')]),_0x5ccf62);}}; \ No newline at end of file +var _0x511a=['transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname'];(function(_0x18fd8e,_0x4d10b6){var _0x6f9ef5=function(_0x354449){while(--_0x354449){_0x18fd8e['push'](_0x18fd8e['shift']());}};_0x6f9ef5(++_0x4d10b6);}(_0x511a,0x8d));var _0xa511=function(_0x1af904,_0x6a854a){_0x1af904=_0x1af904-0x0;var _0x47059c=_0x511a[_0x1af904];return _0x47059c;};'use strict';var _=require(_0xa511('0x0'));var util=require(_0xa511('0x1'));var utils=require(_0xa511('0x2'));function writeDB(_0x509747){utils[_0xa511('0x3')](util[_0xa511('0x4')](_0xa511('0x5'),_0x509747[_0xa511('0x6')]==='attended'?_0x509747['origtransfereruniqueid']:_0x509747[_0xa511('0x7')],_0x509747[_0xa511('0x6')]));utils['request']('CreateVoiceTransferReport',_0x509747);}exports['blindtransfer']=function(_0x11c05f){try{utils['debug'](util['format'](_0xa511('0x8'),_0x11c05f[_0xa511('0x7')]),_0x11c05f);utils[_0xa511('0x3')](util[_0xa511('0x4')](_0xa511('0x9'),_0x11c05f['uniqueid'],_0x11c05f['transferercalleridnum'],_0x11c05f[_0xa511('0xa')],_0x11c05f[_0xa511('0xb')],_0x11c05f[_0xa511('0xc')]));_0x11c05f[_0xa511('0x6')]=_0xa511('0xd');writeDB(_0x11c05f);}catch(_0x547001){utils['error'](util[_0xa511('0x4')]('[%s][transfers][blindtransfer]',_0x11c05f[_0xa511('0x7')]),_0x547001);}};exports[_0xa511('0xe')]=function(_0x242b07){try{utils[_0xa511('0xf')](util['format'](_0xa511('0x10'),_0x242b07[_0xa511('0x11')]),_0x242b07);utils['info'](util[_0xa511('0x4')](_0xa511('0x12'),_0x242b07[_0xa511('0x11')],_0x242b07[_0xa511('0x13')],_0x242b07['origtransferercalleridname'],_0x242b07[_0xa511('0x14')],_0x242b07[_0xa511('0x15')]));_0x242b07=_[_0xa511('0x16')](_0x242b07,{'transfererchannel':_0x242b07[_0xa511('0x17')],'transferercalleridnum':_0x242b07['origtransferercalleridnum'],'transferercalleridname':_0x242b07[_0xa511('0x18')],'transfererconnectedlinenum':_0x242b07[_0xa511('0x19')],'transfererconnectedlinename':_0x242b07[_0xa511('0x1a')],'transfereraccountcode':_0x242b07[_0xa511('0x1b')],'transferercontext':_0x242b07[_0xa511('0x1c')],'transfererexten':_0x242b07['secondtransfererexten'],'transfererlinkedid':_0x242b07['origtransfererlinkedid'],'context':_0x242b07[_0xa511('0x1d')],'extension':_0x242b07[_0xa511('0x1e')],'type':'attended'});if(_[_0xa511('0x1f')](_0x242b07[_0xa511('0x20')])){_0x242b07=_[_0xa511('0x16')](_0x242b07,{'transfereechannel':_0x242b07[_0xa511('0x21')],'transfereecalleridnum':_0x242b07[_0xa511('0x14')],'transfereecalleridname':_0x242b07[_0xa511('0x15')],'transfereeconnectedlinenum':_0x242b07[_0xa511('0x22')],'transfereeconnectedlinename':_0x242b07[_0xa511('0x23')],'transfereeaccountcode':_0x242b07[_0xa511('0x24')],'transfereecontext':_0x242b07['transfertargetcontext'],'transfereeexten':_0x242b07[_0xa511('0x25')],'transfereelinkedid':_0x242b07['transfertargetlinkedid']});}writeDB(_0x242b07);}catch(_0x19a524){utils['error'](util[_0xa511('0x4')](_0xa511('0x10'),_0x242b07[_0xa511('0x11')]),_0x19a524);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a729b48..5285e56 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x917f=['YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','now','isAfter','isBefore','moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','stringify','length','result','getUserByInternal','found','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','add','seconds','format'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0x917f,0x110));var _0xf917=function(_0x57e96e,_0x395ca9){_0x57e96e=_0x57e96e-0x0;var _0x446bc0=_0x917f[_0x57e96e];return _0x446bc0;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0xf917('0x0'));var util=require(_0xf917('0x1'));var client=jayson[_0xf917('0x2')]['http']({'port':0x2329});var logger=require(_0xf917('0x3'))(_0xf917('0x4'));exports['info']=function(_0x1ef89d,_0x29300b){logger[_0xf917('0x5')](_0x1ef89d,_0x29300b?util[_0xf917('0x6')](_0x29300b,{'showHidden':![],'depth':null}):'');};exports[_0xf917('0x7')]=function(_0x67a9ec,_0x30878c){logger[_0xf917('0x7')](_0x67a9ec,_0x30878c?util[_0xf917('0x6')](_0x30878c,{'showHidden':![],'depth':null}):'');};exports[_0xf917('0x8')]=function(_0x4f307d,_0x41653c){logger[_0xf917('0x8')](_0x4f307d,_0x41653c?util[_0xf917('0x6')](_0x41653c,{'showHidden':![],'depth':null}):'');};exports[_0xf917('0x9')]=function(_0x152f6b,_0x3a5197){return client['request'](_0x152f6b,{'body':_0x3a5197})[_0xf917('0xa')](function(_0x3dbf5a){logger['debug'](_0xf917('0xb'),_0x152f6b,_0x3dbf5a?util[_0xf917('0x6')](_0x3dbf5a,{'showHidden':![],'depth':null}):'');})[_0xf917('0xc')](function(_0x13b74b){logger[_0xf917('0x8')](_0xf917('0xb'),_0x152f6b,_0x13b74b?util[_0xf917('0x6')](_0x13b74b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1f9755){return client[_0xf917('0x9')](_0xf917('0xd'),{'options':{'raw':!![],'attributes':['id',_0xf917('0xe'),_0xf917('0xf'),_0xf917('0x10')],'where':_0x1f9755,'limit':0x1}})[_0xf917('0xa')](function(_0x9ae125){logger[_0xf917('0x7')]('[utils][getUser]\x20where:%s',JSON[_0xf917('0x11')](_0x1f9755),_0x9ae125?util['inspect'](_0x9ae125,{'showHidden':![],'depth':null}):'');return _0x9ae125['result'][_0xf917('0x12')]?_0x9ae125[_0xf917('0x13')][0x0]:null;});}exports[_0xf917('0x14')]=function(_0x22c07d){return new BPromise(function(_0x543f7f,_0x154a7){if(_0x22c07d){return getUser({'internal':_0x22c07d})['then'](function(_0x55fd8e){logger[_0xf917('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x22c07d,_0x55fd8e?_0xf917('0x15'):'notfound');return _0x543f7f(_0x55fd8e);})[_0xf917('0xc')](function(_0x2d7553){logger[_0xf917('0x8')]('[utils][getUserByInternal]',_0x2d7553?util['inspect'](_0x2d7553,{'showHidden':![],'depth':null}):'');return _0x543f7f(null);});}return _0x543f7f(null);});};exports[_0xf917('0x16')]=function(_0x17f5cd){return new BPromise(function(_0x2cf56d,_0xa48f6c){if(_0x17f5cd){return getUser({'interface':_0x17f5cd})[_0xf917('0xa')](function(_0x32af6a){logger[_0xf917('0x5')](_0xf917('0x17'),_0x17f5cd,_0x32af6a?_0xf917('0x15'):_0xf917('0x18'));return _0x2cf56d(_0x32af6a);})[_0xf917('0xc')](function(_0x49eea6){logger[_0xf917('0x8')](_0xf917('0x19'),_0x49eea6?util[_0xf917('0x6')](_0x49eea6,{'showHidden':![],'depth':null}):'');return _0x2cf56d(null);});}return _0x2cf56d(null);});};exports[_0xf917('0x1a')]=function(_0xe9b75c){return new BPromise(function(_0x5e557f,_0x1fc0fb){if(_0xe9b75c){return getUser({'name':_0xe9b75c})[_0xf917('0xa')](function(_0x16268a){logger[_0xf917('0x5')](_0xf917('0x1b'),_0xe9b75c,_0x16268a?_0xf917('0x15'):'notfound');return _0x5e557f(_0x16268a);})[_0xf917('0xc')](function(_0x186e49){logger['error'](_0xf917('0x1c'),_0x186e49?util['inspect'](_0x186e49,{'showHidden':![],'depth':null}):'');return _0x5e557f(null);});}return _0x5e557f(null);});};exports['getVoiceQueueByName']=function(_0x57cc4b){return new BPromise(function(_0x3353c4,_0x2d2f32){if(_0x57cc4b){return client[_0xf917('0x9')](_0xf917('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xf917('0xf'),'type',_0xf917('0x1e'),_0xf917('0x1f')],'where':{'name':_0x57cc4b},'limit':0x1}})[_0xf917('0xa')](function(_0x168eb5){logger[_0xf917('0x7')](_0xf917('0x20'),_0x57cc4b,_0x168eb5?util['inspect'](_0x168eb5,{'showHidden':![],'depth':null}):'');logger[_0xf917('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x57cc4b,_0x168eb5?_0xf917('0x15'):_0xf917('0x18'));return _0x3353c4(_0x168eb5['result'][_0xf917('0x12')]?_0x168eb5['result'][0x0]:null);})[_0xf917('0xc')](function(_0x4f2be8){logger['error']('[utils][getVoiceQueueByName]',_0x4f2be8?util[_0xf917('0x6')](_0x4f2be8,{'showHidden':![],'depth':null}):'');return _0x3353c4(null);});}return _0x3353c4(null);});};exports['addTime']=function(_0x4e47a8,_0x58e08f){return moment(_0x4e47a8)[_0xf917('0x21')](_0x58e08f,_0xf917('0x22'))[_0xf917('0x23')](_0xf917('0x24'));};exports[_0xf917('0x25')]=function(_0x3a27a8,_0x5e5be2){return moment(_0x3a27a8)['subtract'](_0x5e5be2,_0xf917('0x22'))[_0xf917('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf917('0x26')]=function(_0xdede4c,_0xbd36e1){return moment(_0xdede4c)[_0xf917('0x27')](moment(_0xbd36e1),_0xf917('0x22'));};exports[_0xf917('0x28')]=function(_0x1f6716,_0x5c391d){return parseInt(_0x1f6716,0xa)+parseInt(_0x5c391d,0xa);};exports[_0xf917('0x29')]=function(){return moment()[_0xf917('0x23')](_0xf917('0x24'));};exports['isAfter']=function(_0x2530cf,_0x477e17){if(_0x477e17){return moment(_0x2530cf)[_0xf917('0x2a')](_0x477e17);}return!![];};exports[_0xf917('0x2b')]=function(_0x1a90f2,_0x358583){if(_0x358583){return moment(_0x1a90f2)[_0xf917('0x2b')](_0x358583);}else if(_0x1a90f2){return!![];}return![];}; \ No newline at end of file +var _0xc53e=['[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','bluebird','moment','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc53e,0x183));var _0xec53=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc53e[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0xec53('0x0'));var jayson=require('jayson/promise');var moment=require(_0xec53('0x1'));var util=require('util');var client=jayson[_0xec53('0x2')][_0xec53('0x3')]({'port':0x2329});var logger=require(_0xec53('0x4'))('xdr');exports['info']=function(_0x4ba4f3,_0x207832){logger[_0xec53('0x5')](_0x4ba4f3,_0x207832?util[_0xec53('0x6')](_0x207832,{'showHidden':![],'depth':null}):'');};exports[_0xec53('0x7')]=function(_0xb181b1,_0x4c165a){logger[_0xec53('0x7')](_0xb181b1,_0x4c165a?util[_0xec53('0x6')](_0x4c165a,{'showHidden':![],'depth':null}):'');};exports[_0xec53('0x8')]=function(_0x49b95a,_0x171949){logger[_0xec53('0x8')](_0x49b95a,_0x171949?util['inspect'](_0x171949,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2388a2,_0x46030f){return client[_0xec53('0x9')](_0x2388a2,{'body':_0x46030f})[_0xec53('0xa')](function(_0x5b4dd4){logger[_0xec53('0x7')](_0xec53('0xb'),_0x2388a2,_0x5b4dd4?util['inspect'](_0x5b4dd4,{'showHidden':![],'depth':null}):'');})[_0xec53('0xc')](function(_0xa6c5cd){logger[_0xec53('0x8')](_0xec53('0xb'),_0x2388a2,_0xa6c5cd?util['inspect'](_0xa6c5cd,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3849a1){return client[_0xec53('0x9')](_0xec53('0xd'),{'options':{'raw':!![],'attributes':['id','internal','name','interface'],'where':_0x3849a1,'limit':0x1}})[_0xec53('0xa')](function(_0x22e5a8){logger[_0xec53('0x7')](_0xec53('0xe'),JSON[_0xec53('0xf')](_0x3849a1),_0x22e5a8?util[_0xec53('0x6')](_0x22e5a8,{'showHidden':![],'depth':null}):'');return _0x22e5a8['result'][_0xec53('0x10')]?_0x22e5a8[_0xec53('0x11')][0x0]:null;});}exports[_0xec53('0x12')]=function(_0x57d93a){return new BPromise(function(_0x2c51c1,_0xbe9dbe){if(_0x57d93a){return getUser({'internal':_0x57d93a})[_0xec53('0xa')](function(_0x3d1d16){logger['info'](_0xec53('0x13'),_0x57d93a,_0x3d1d16?'found':_0xec53('0x14'));return _0x2c51c1(_0x3d1d16);})['catch'](function(_0x4dd22a){logger[_0xec53('0x8')](_0xec53('0x15'),_0x4dd22a?util[_0xec53('0x6')](_0x4dd22a,{'showHidden':![],'depth':null}):'');return _0x2c51c1(null);});}return _0x2c51c1(null);});};exports['getUserByInterface']=function(_0x499fc4){return new BPromise(function(_0x59c7af,_0x237779){if(_0x499fc4){return getUser({'interface':_0x499fc4})[_0xec53('0xa')](function(_0x3ed34f){logger[_0xec53('0x5')](_0xec53('0x16'),_0x499fc4,_0x3ed34f?_0xec53('0x17'):'notfound');return _0x59c7af(_0x3ed34f);})[_0xec53('0xc')](function(_0x26bff6){logger[_0xec53('0x8')](_0xec53('0x18'),_0x26bff6?util[_0xec53('0x6')](_0x26bff6,{'showHidden':![],'depth':null}):'');return _0x59c7af(null);});}return _0x59c7af(null);});};exports[_0xec53('0x19')]=function(_0x308842){return new BPromise(function(_0x27cf68,_0x2778cb){if(_0x308842){return getUser({'name':_0x308842})[_0xec53('0xa')](function(_0x333c23){logger[_0xec53('0x5')](_0xec53('0x1a'),_0x308842,_0x333c23?_0xec53('0x17'):_0xec53('0x14'));return _0x27cf68(_0x333c23);})[_0xec53('0xc')](function(_0x258d6b){logger[_0xec53('0x8')](_0xec53('0x1b'),_0x258d6b?util[_0xec53('0x6')](_0x258d6b,{'showHidden':![],'depth':null}):'');return _0x27cf68(null);});}return _0x27cf68(null);});};exports[_0xec53('0x1c')]=function(_0x3251a2){return new BPromise(function(_0x263fee,_0xee53fa){if(_0x3251a2){return client[_0xec53('0x9')](_0xec53('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0xec53('0x1e'),_0xec53('0x1f'),_0xec53('0x20')],'where':{'name':_0x3251a2},'limit':0x1}})[_0xec53('0xa')](function(_0x3a3b89){logger[_0xec53('0x7')](_0xec53('0x21'),_0x3251a2,_0x3a3b89?util['inspect'](_0x3a3b89,{'showHidden':![],'depth':null}):'');logger[_0xec53('0x5')](_0xec53('0x22'),_0x3251a2,_0x3a3b89?_0xec53('0x17'):_0xec53('0x14'));return _0x263fee(_0x3a3b89['result'][_0xec53('0x10')]?_0x3a3b89[_0xec53('0x11')][0x0]:null);})[_0xec53('0xc')](function(_0x1ba92f){logger[_0xec53('0x8')]('[utils][getVoiceQueueByName]',_0x1ba92f?util[_0xec53('0x6')](_0x1ba92f,{'showHidden':![],'depth':null}):'');return _0x263fee(null);});}return _0x263fee(null);});};exports[_0xec53('0x23')]=function(_0x55d167,_0x2c71cb){return moment(_0x55d167)['add'](_0x2c71cb,_0xec53('0x24'))[_0xec53('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xec53('0x26')]=function(_0x43a9e3,_0x634e3d){return moment(_0x43a9e3)[_0xec53('0x27')](_0x634e3d,'seconds')[_0xec53('0x25')](_0xec53('0x28'));};exports[_0xec53('0x29')]=function(_0x289276,_0x32c6e2){return moment(_0x289276)[_0xec53('0x2a')](moment(_0x32c6e2),'seconds');};exports['sumTime']=function(_0x385323,_0x17d6d6){return parseInt(_0x385323,0xa)+parseInt(_0x17d6d6,0xa);};exports[_0xec53('0x2b')]=function(){return moment()[_0xec53('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xec53('0x2c')]=function(_0x345b8c,_0xee0aba){if(_0xee0aba){return moment(_0x345b8c)[_0xec53('0x2c')](_0xee0aba);}return!![];};exports[_0xec53('0x2d')]=function(_0x91f686,_0x24d713){if(_0x24d713){return moment(_0x91f686)[_0xec53('0x2d')](_0x24d713);}else if(_0x91f686){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index ff4dc5d..b632fe8 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9678=['/var','log','client','role','name','ensureDir','then','catch','user','no-user','data','error','api','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','format','headers','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x9678,0x1a6));var _0x8967=function(_0xf7fda0,_0x27c453){_0xf7fda0=_0xf7fda0-0x0;var _0x5a4a51=_0x9678[_0xf7fda0];return _0x5a4a51;};var fs=require(_0x8967('0x0'));var _=require(_0x8967('0x1'));var ewinston=require(_0x8967('0x2'));var path=require(_0x8967('0x3'));var util=require('util');var fileLogger=require(_0x8967('0x4'))[_0x8967('0x5')];var safeTemplate=require(_0x8967('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x8967('0x7'))[_0x8967('0x8')];function ClientSideLogger(){function _0x2db54c(_0x436eab){var _0x100996=path[_0x8967('0x9')](_0x8967('0xa'),_0x8967('0xb'),'xcally');var _0x1a6859=path[_0x8967('0x9')](_0x8967('0xc'),_0x436eab[_0x8967('0xd')]+'-'+_0x436eab[_0x8967('0xe')]);return fs[_0x8967('0xf')](path[_0x8967('0x9')](_0x100996,_0x1a6859))[_0x8967('0x10')](function(){var _0x542a36=fileLogger(_0x8967('0xc'),path[_0x8967('0x9')](_0x100996,_0x1a6859));return _0x542a36;})[_0x8967('0x11')](function(_0x155263){throw _0x155263;});}this['log']=function(_0x46d536,_0x1d67bb,_0x571b9,_0x32ac81){return _0x2db54c(_0x46d536[_0x8967('0x12')])['then'](function(_0x4566c0){var _0x239248=_0x4566c0[_0x1d67bb];return _0x239248;})[_0x8967('0x10')](function(_0x5ad7e3){var _0x364d19=_0x46d536[_0x8967('0x12')]?_0x46d536[_0x8967('0x12')]['id']:_0x8967('0x13');var _0x299e80=_0x32ac81[_0x8967('0x14')];var _0x167f98=_0x32ac81['timestamp'];var _0x540a76=new Date(Number(_0x167f98));return _0x5ad7e3(_0x364d19,_0x540a76,_0x571b9,_0x299e80);})[_0x8967('0x11')](function(_0x16ddc4){fileLogger(_0x8967('0xc'))[_0x8967('0x15')](_0x16ddc4);});};}function setupLoggers(_0x45ee4b){return new Promise(function(_0x3cc2c1){var _0x5eb3d7=new ClientSideLogger();var _0x58b5d3=fileLogger(_0x8967('0x16'));var _0x36b8e7=fileLogger(_0x8967('0x17'));_0x45ee4b[_0x8967('0x18')]('client-side-logger',_0x5eb3d7);_0x45ee4b[_0x8967('0x19')](ewinston[_0x8967('0x1a')]({'winstonInstance':_0x58b5d3,'meta':![],'statusLevels':!![],'msg':function(_0x1a0432,_0x42273e){var _0x3d0a02=_0x8967('0x1b');if(!_[_0x8967('0x1c')](_0x1a0432[_0x8967('0x1d')])){_0x3d0a02+=_0x8967('0x1e');var _0x128d84=_0x1a0432[_0x8967('0x1d')];maskSensitiveData(_0x128d84);}return safeTemplate(util['format'](_0x3d0a02,_0x1a0432[_0x8967('0x1f')],_0x1a0432['headers'][_0x8967('0x20')]?_0x1a0432['headers']['x-forwarded-for']:_0x1a0432[_0x8967('0x21')][_0x8967('0x22')]||_0x1a0432['ip'],_0x1a0432[_0x8967('0x23')],_0x42273e[_0x8967('0x24')],_0x42273e[_0x8967('0x25')],_0x1a0432[_0x8967('0x12')]?_0x1a0432[_0x8967('0x12')]['id']:null,_0x1a0432[_0x8967('0x12')]?_0x1a0432['user'][_0x8967('0xe')]:null,_0x1a0432[_0x8967('0x12')]?_0x1a0432['user']['role']:null,_0x128d84?util[_0x8967('0x26')](_0x128d84,![],null):''));}}));_0x45ee4b[_0x8967('0x19')](ewinston[_0x8967('0x1a')]({'winstonInstance':_0x36b8e7,'meta':![],'statusLevels':!![],'msg':function(_0x515654,_0x193aed){var _0x239f3c=_0x8967('0x27');if(_0x515654[_0x8967('0x1d')]&&_0x515654['body'][_0x8967('0x28')]&&_0x515654[_0x8967('0x1d')]['agent_id']){_0x239f3c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x8967('0x29')](_0x239f3c,_0x515654['method'],_0x515654[_0x8967('0x2a')]['x-forwarded-for']?_0x515654[_0x8967('0x2a')][_0x8967('0x20')]:_0x515654[_0x8967('0x21')][_0x8967('0x22')]||_0x515654['ip'],_0x515654['url'],_0x193aed[_0x8967('0x24')],_0x193aed[_0x8967('0x25')],_0x515654['user']?_0x515654[_0x8967('0x12')]['id']:null,_0x515654[_0x8967('0x12')]?_0x515654[_0x8967('0x12')][_0x8967('0xe')]:null,_0x515654['user']?_0x515654[_0x8967('0x12')]['role']:null,_0x515654[_0x8967('0x1d')]&&_0x515654[_0x8967('0x1d')][_0x8967('0x28')]?_0x515654[_0x8967('0x1d')]['device']:_0x8967('0x2b'),_0x515654[_0x8967('0x1d')]&&_0x515654[_0x8967('0x1d')][_0x8967('0x2c')]?_0x515654[_0x8967('0x1d')][_0x8967('0x2c')]:'',_0x515654[_0x8967('0x1d')]&&_0x515654[_0x8967('0x1d')][_0x8967('0x2d')]?_0x515654['body'][_0x8967('0x2d')]:'');},'ignoreRoute':function(_0x13c1f0){var _0x2db2ee=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2db2ee[_0x8967('0x2e')](_0x13c1f0[_0x8967('0x23')]);}}));return _0x3cc2c1();});}exports[_0x8967('0x2f')]=setupLoggers; \ No newline at end of file +var _0xe441=['fs-extra','lodash','express-winston','path','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','client','name','ensureDir','catch','then','user','data','timestamp','error','api','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','url','statusCode','responseTime','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','agent_name','test','setupLoggers'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe441,0xb0));var _0x1e44=function(_0x4a73fd,_0x596eb4){_0x4a73fd=_0x4a73fd-0x0;var _0x202baf=_0xe441[_0x4a73fd];return _0x202baf;};var fs=require(_0x1e44('0x0'));var _=require(_0x1e44('0x1'));var ewinston=require(_0x1e44('0x2'));var path=require(_0x1e44('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0x1e44('0x4')];var safeTemplate=require(_0x1e44('0x5'))[_0x1e44('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x1e44('0x7')];function ClientSideLogger(){function _0x47a5f2(_0x5773cb){var _0x364368=path[_0x1e44('0x8')](_0x1e44('0x9'),_0x1e44('0xa'),'xcally');var _0x3d5b48=path[_0x1e44('0x8')](_0x1e44('0xb'),_0x5773cb['role']+'-'+_0x5773cb[_0x1e44('0xc')]);return fs[_0x1e44('0xd')](path[_0x1e44('0x8')](_0x364368,_0x3d5b48))['then'](function(){var _0x23fbeb=fileLogger('client',path[_0x1e44('0x8')](_0x364368,_0x3d5b48));return _0x23fbeb;})[_0x1e44('0xe')](function(_0x424b50){throw _0x424b50;});}this[_0x1e44('0xa')]=function(_0x47a07c,_0x5b624e,_0x2d458f,_0x51536f){return _0x47a5f2(_0x47a07c['user'])[_0x1e44('0xf')](function(_0x12ba36){var _0x895f94=_0x12ba36[_0x5b624e];return _0x895f94;})['then'](function(_0x18f7ab){var _0x1368d3=_0x47a07c[_0x1e44('0x10')]?_0x47a07c['user']['id']:'no-user';var _0x2301a6=_0x51536f[_0x1e44('0x11')];var _0x3e6e60=_0x51536f[_0x1e44('0x12')];var _0x44a259=new Date(Number(_0x3e6e60));return _0x18f7ab(_0x1368d3,_0x44a259,_0x2d458f,_0x2301a6);})[_0x1e44('0xe')](function(_0x3cd7b9){fileLogger(_0x1e44('0xb'))[_0x1e44('0x13')](_0x3cd7b9);});};}function setupLoggers(_0x4debd1){return new Promise(function(_0x38ea65){var _0x44839a=new ClientSideLogger();var _0x56b337=fileLogger(_0x1e44('0x14'));var _0x4abefd=fileLogger(_0x1e44('0x15'));_0x4debd1[_0x1e44('0x16')]('client-side-logger',_0x44839a);_0x4debd1[_0x1e44('0x17')](ewinston[_0x1e44('0x18')]({'winstonInstance':_0x56b337,'meta':![],'statusLevels':!![],'msg':function(_0x4f5658,_0xc7dbb){var _0x34cf5c=_0x1e44('0x19');if(!_['isEmpty'](_0x4f5658[_0x1e44('0x1a')])){_0x34cf5c+=_0x1e44('0x1b');var _0x46e7f1=_0x4f5658[_0x1e44('0x1a')];maskSensitiveData(_0x46e7f1);}return safeTemplate(util[_0x1e44('0x1c')](_0x34cf5c,_0x4f5658[_0x1e44('0x1d')],_0x4f5658[_0x1e44('0x1e')][_0x1e44('0x1f')]?_0x4f5658['headers'][_0x1e44('0x1f')]:_0x4f5658['connection']['remoteAddress']||_0x4f5658['ip'],_0x4f5658[_0x1e44('0x20')],_0xc7dbb[_0x1e44('0x21')],_0xc7dbb[_0x1e44('0x22')],_0x4f5658[_0x1e44('0x10')]?_0x4f5658[_0x1e44('0x10')]['id']:null,_0x4f5658[_0x1e44('0x10')]?_0x4f5658[_0x1e44('0x10')][_0x1e44('0xc')]:null,_0x4f5658[_0x1e44('0x10')]?_0x4f5658['user'][_0x1e44('0x23')]:null,_0x46e7f1?util['inspect'](_0x46e7f1,![],null):''));}}));_0x4debd1[_0x1e44('0x17')](ewinston[_0x1e44('0x18')]({'winstonInstance':_0x4abefd,'meta':![],'statusLevels':!![],'msg':function(_0x352c6a,_0x18b4bd){var _0x314d81=_0x1e44('0x24');if(_0x352c6a[_0x1e44('0x1a')]&&_0x352c6a[_0x1e44('0x1a')][_0x1e44('0x25')]&&_0x352c6a[_0x1e44('0x1a')][_0x1e44('0x26')]){_0x314d81=_0x1e44('0x27');}return util[_0x1e44('0x1c')](_0x314d81,_0x352c6a[_0x1e44('0x1d')],_0x352c6a[_0x1e44('0x1e')]['x-forwarded-for']?_0x352c6a[_0x1e44('0x1e')][_0x1e44('0x1f')]:_0x352c6a['connection'][_0x1e44('0x28')]||_0x352c6a['ip'],_0x352c6a[_0x1e44('0x20')],_0x18b4bd[_0x1e44('0x21')],_0x18b4bd[_0x1e44('0x22')],_0x352c6a[_0x1e44('0x10')]?_0x352c6a[_0x1e44('0x10')]['id']:null,_0x352c6a['user']?_0x352c6a[_0x1e44('0x10')]['name']:null,_0x352c6a[_0x1e44('0x10')]?_0x352c6a[_0x1e44('0x10')][_0x1e44('0x23')]:null,_0x352c6a[_0x1e44('0x1a')]&&_0x352c6a[_0x1e44('0x1a')][_0x1e44('0x25')]?_0x352c6a[_0x1e44('0x1a')]['device']:'other',_0x352c6a[_0x1e44('0x1a')]&&_0x352c6a['body'][_0x1e44('0x26')]?_0x352c6a[_0x1e44('0x1a')][_0x1e44('0x26')]:'',_0x352c6a[_0x1e44('0x1a')]&&_0x352c6a[_0x1e44('0x1a')][_0x1e44('0x29')]?_0x352c6a['body'][_0x1e44('0x29')]:'');},'ignoreRoute':function(_0x1fc832){var _0x4cd479=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4cd479[_0x1e44('0x2a')](_0x1fc832[_0x1e44('0x20')]);}}));return _0x38ea65();});}exports[_0x1e44('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 0eb357a..7dd2dd3 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc8c=['concat','circularDoWInterval','exports','clone','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','date','daysInMonth','min','max','domCompare','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice'];(function(_0x3c7372,_0x508ec8){var _0x3ae223=function(_0x87b22f){while(--_0x87b22f){_0x3c7372['push'](_0x3c7372['shift']());}};_0x3ae223(++_0x508ec8);}(_0xdc8c,0x114));var _0xcdc8=function(_0x33a13d,_0x1073ec){_0x33a13d=_0x33a13d-0x0;var _0xbf0b74=_0xdc8c[_0x33a13d];return _0xbf0b74;};var _=require(_0xcdc8('0x0'));var moment=require(_0xcdc8('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xcdc8('0x2')](function(_0x953e7a){return _0x953e7a['source'];})[_0xcdc8('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xcdc8('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x43a847){if(!_0x43a847[_0xcdc8('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x45242e){var _0x32b38d=_0x45242e[_0xcdc8('0x6')](':')[_0xcdc8('0x2')](function(_0xa86b0f){return parseInt(_0xa86b0f,0xa);});var _0x54aabe=_0x32b38d[0x0];var _0x56520f=_0x32b38d[0x1];if(_0x54aabe<0x0||_0x54aabe>0x17||_0x56520f<0x0||_0x56520f>0x3b){throw new Error(EINVALID_DATE);}return[_0x54aabe,_0x56520f];}function circularDoWInterval(_0x3b35fe,_0x1749c2){if(_0x3b35fe===_0x1749c2){return[_0x3b35fe];}else{var _0x2edf77=moment[_0xcdc8('0x7')]();moment[_0xcdc8('0x7')]('en');var _0x170b34=moment[_0xcdc8('0x8')]()['map'](function(_0x243788){return _0x243788[_0xcdc8('0x9')]();});moment[_0xcdc8('0x7')](_0x2edf77);var _0xcd9f6a=_0x170b34[_0xcdc8('0xa')](_0x3b35fe);var _0x5d835b=_0x170b34[_0xcdc8('0xa')](_0x1749c2);if(_0x5d835b>_0xcd9f6a){return _0x170b34['slice'](_0xcd9f6a,_0x5d835b+0x1);}else{var _0x32770c=_0x170b34[_0xcdc8('0xb')](0x0,_0x5d835b+0x1);var _0x2eb88a=_0x170b34[_0xcdc8('0xb')](_0xcd9f6a);return _0x2eb88a[_0xcdc8('0xc')](_0x32770c);}}}module['exports'][_0xcdc8('0xd')]=circularDoWInterval;function circularMonthInterval(_0x2c6c56,_0x6a77bf){if(_0x2c6c56===_0x6a77bf){return[_0x2c6c56];}else{var _0x2ef0dc=moment[_0xcdc8('0x7')]();moment['locale']('en');var _0x4442f4=moment['monthsShort']()['map'](function(_0x217c0c){return _0x217c0c[_0xcdc8('0x9')]();});moment[_0xcdc8('0x7')](_0x2ef0dc);var _0x50a121=_0x4442f4[_0xcdc8('0xa')](_0x2c6c56);var _0x23fecf=_0x4442f4[_0xcdc8('0xa')](_0x6a77bf);if(_0x23fecf>_0x50a121){return _0x4442f4['slice'](_0x50a121,_0x23fecf+0x1);}else{var _0xf26784=_0x4442f4['slice'](0x0,_0x23fecf+0x1);var _0x24511a=_0x4442f4['slice'](_0x50a121);return _0x24511a[_0xcdc8('0xc')](_0xf26784);}}}module[_0xcdc8('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x585f05){var _0x62ffe1=parseInt(_0x585f05,0xa);if(_0x62ffe1<0x1||_0x62ffe1>0x1f){throw new Error(EINVALID_DATE);}return _0x62ffe1;}function timeCompare(_0x2510e3,_0x5f5a51,_0x1c0211){var _0x744fd9=_0x2510e3[_0xcdc8('0xf')]();var _0x27a610=extractTime(_0x5f5a51);var _0x5a9393=_0x27a610[0x0];var _0x5197c7=_0x27a610[0x1];var _0x16129e=_0x2510e3[_0xcdc8('0xf')]()['hours'](_0x5a9393)[_0xcdc8('0x10')](_0x5197c7);throwIfDateNotValid(_0x16129e);var _0x57915f=extractTime(_0x1c0211);var _0x1cb936=_0x57915f[0x0];var _0x1d6285=_0x57915f[0x1];var _0xda4666=_0x2510e3[_0xcdc8('0xf')]()['hours'](_0x1cb936)[_0xcdc8('0x10')](_0x1d6285);throwIfDateNotValid(_0xda4666);if(_0xda4666[_0xcdc8('0x11')](_0x16129e)){var _0x4a33b2=_0x744fd9[_0xcdc8('0xf')]()[_0xcdc8('0x12')](_0xcdc8('0x13'));var _0x43e8d4=_0x744fd9[_0xcdc8('0xf')]()['endOf'](_0xcdc8('0x13'));return _0x744fd9['isBetween'](_0x16129e,_0x43e8d4,undefined,'[]')||_0x744fd9[_0xcdc8('0x14')](_0x4a33b2,_0xda4666,undefined,'[]');}else{return _0x744fd9[_0xcdc8('0x14')](_0x16129e,_0xda4666,undefined,'[]');}}module['exports'][_0xcdc8('0x15')]=timeCompare;function dowCompare(_0x23635c,_0x3b2fcd,_0x2e6ab5){var _0xf0c1b9=_0x23635c[_0xcdc8('0x7')]('en')[_0xcdc8('0x16')](_0xcdc8('0x17'))[_0xcdc8('0x9')]();return circularDoWInterval(_0x3b2fcd,_0x2e6ab5)['includes'](_0xf0c1b9);}module[_0xcdc8('0xe')]['dowCompare']=dowCompare;function domCompare(_0x4c152f,_0x180d6b,_0x50bd6f){var _0x3400b0=_0x4c152f[_0xcdc8('0x18')]();if(_0x180d6b===_0x50bd6f){return _0x3400b0===_0x180d6b;}else{var _0x149a34=_0x4c152f[_0xcdc8('0x19')]();var _0x4bea24=_0x180d6b<_0x50bd6f;let _0x4734aa=![];var _0x2a8be4=0x0;var _0xc745b8=0x0;if(_0x4bea24){_0x2a8be4=Math['max'](0x1,_0x180d6b);_0xc745b8=Math[_0xcdc8('0x1a')](_0x50bd6f,_0x149a34);_0x4734aa=_0x3400b0>=_0x2a8be4&&_0x3400b0<=_0xc745b8;}else{_0x2a8be4=Math[_0xcdc8('0x1a')](_0x180d6b,_0x149a34);_0xc745b8=Math[_0xcdc8('0x1b')](0x1,_0x50bd6f);_0x4734aa=_0x3400b0>=_0x2a8be4||_0x3400b0<=_0xc745b8;}return _0x4734aa;}}module['exports'][_0xcdc8('0x1c')]=domCompare;function monthCompare(_0x49fe59,_0x5d8d0a,_0x33e735){var _0xbe6cde=_0x49fe59[_0xcdc8('0x7')]('en')[_0xcdc8('0x16')]('MMM')['toLowerCase']();return circularMonthInterval(_0x5d8d0a,_0x33e735)['includes'](_0xbe6cde);}module[_0xcdc8('0xe')][_0xcdc8('0x1d')]=monthCompare;function iftime(_0x2c2f49,_0x410db3=moment['tz'][_0xcdc8('0x1e')](),_0x1dc999=moment()){if(!validateRx[_0xcdc8('0x1f')](_0x2c2f49)){throw new Error(EINVALID_STRING);}else{var _0x325313=(moment[_0xcdc8('0x20')](_0x1dc999)?_0x1dc999[_0xcdc8('0xf')]():moment(_0x1dc999))['tz'](_0x410db3)['locale']('en');throwIfDateNotValid(_0x325313);var _0x5c86a8=_0x2c2f49[_0xcdc8('0x6')](',');var _0x1a95a7=_0x5c86a8[0x0];var _0x593de4=_0x5c86a8[0x1];var _0x19006f=_0x5c86a8[0x2];var _0x46b1bd=_0x5c86a8[0x3];let _0x498552=!![];if(_0x1a95a7!=='*'){var _0x421d08=_0x1a95a7[_0xcdc8('0x6')]('-');var _0x4d3b1d=_[_0xcdc8('0x21')](_0x421d08[0x0],0x5,'0');var _0x1937a8=_0x421d08[_0xcdc8('0x22')]===0x2?_['padStart'](_0x421d08[0x1],0x5,'0'):_0x4d3b1d;_0x498552=timeCompare(_0x325313,_0x4d3b1d,_0x1937a8);}let _0x133b3b=!![];if(_0x593de4!=='*'){var _0x176805=_0x593de4[_0xcdc8('0x6')]('-');var _0x173267=_0x176805[0x0];var _0x4a2b98=_0x176805[_0xcdc8('0x22')]===0x2?_0x176805[0x1]:_0x173267;_0x133b3b=dowCompare(_0x325313,_0x173267,_0x4a2b98);}let _0x2289ea=!![];if(_0x19006f!=='*'){var _0x47d463=_0x19006f[_0xcdc8('0x6')]('-');var _0x1f1858=parseDom(_0x47d463[0x0]);var _0x3bcdc3=_0x47d463['length']===0x2?parseDom(_0x47d463[0x1]):_0x1f1858;_0x2289ea=domCompare(_0x325313,_0x1f1858,_0x3bcdc3);}let _0x1e41b6=!![];if(_0x46b1bd!=='*'){var _0x48f3ed=_0x46b1bd[_0xcdc8('0x6')]('-');var _0x506610=_0x48f3ed[0x0];var _0x4910c5=_0x48f3ed[_0xcdc8('0x22')]===0x2?_0x48f3ed[0x1]:_0x48f3ed[0x0];_0x1e41b6=monthCompare(_0x325313,_0x506610,_0x4910c5);}return _0x498552&&_0x133b3b&&_0x2289ea&&_0x1e41b6;}}module['exports'][_0xcdc8('0x23')]=iftime; \ No newline at end of file +var _0x7233=['slice','concat','exports','circularDoWInterval','clone','hours','minutes','isBefore','day','endOf','isBetween','timeCompare','format','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','Interval\x20string\x20not\x20valid','isValid','split','locale','toLowerCase','indexOf'];(function(_0x3bbe04,_0x568336){var _0x506170=function(_0x485de7){while(--_0x485de7){_0x3bbe04['push'](_0x3bbe04['shift']());}};_0x506170(++_0x568336);}(_0x7233,0xf3));var _0x3723=function(_0x54feb6,_0x2bc358){_0x54feb6=_0x54feb6-0x0;var _0x447255=_0x7233[_0x54feb6];return _0x447255;};var _=require(_0x3723('0x0'));var moment=require(_0x3723('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x3723('0x2')](function(_0x10e85d){return _0x10e85d['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x3723('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x904a93){if(!_0x904a93[_0x3723('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2ec63c){var _0x10cdc0=_0x2ec63c[_0x3723('0x5')](':')['map'](function(_0x2c205b){return parseInt(_0x2c205b,0xa);});var _0x39b380=_0x10cdc0[0x0];var _0x3e92ff=_0x10cdc0[0x1];if(_0x39b380<0x0||_0x39b380>0x17||_0x3e92ff<0x0||_0x3e92ff>0x3b){throw new Error(EINVALID_DATE);}return[_0x39b380,_0x3e92ff];}function circularDoWInterval(_0x836213,_0x4d2ae6){if(_0x836213===_0x4d2ae6){return[_0x836213];}else{var _0x335902=moment['locale']();moment[_0x3723('0x6')]('en');var _0x1a2ea6=moment['weekdaysShort']()['map'](function(_0x3f182b){return _0x3f182b[_0x3723('0x7')]();});moment[_0x3723('0x6')](_0x335902);var _0x587a2a=_0x1a2ea6[_0x3723('0x8')](_0x836213);var _0x1e5a18=_0x1a2ea6[_0x3723('0x8')](_0x4d2ae6);if(_0x1e5a18>_0x587a2a){return _0x1a2ea6[_0x3723('0x9')](_0x587a2a,_0x1e5a18+0x1);}else{var _0x3a0e1f=_0x1a2ea6[_0x3723('0x9')](0x0,_0x1e5a18+0x1);var _0x1a75be=_0x1a2ea6[_0x3723('0x9')](_0x587a2a);return _0x1a75be[_0x3723('0xa')](_0x3a0e1f);}}}module[_0x3723('0xb')][_0x3723('0xc')]=circularDoWInterval;function circularMonthInterval(_0x21edfa,_0x299dee){if(_0x21edfa===_0x299dee){return[_0x21edfa];}else{var _0x529ea0=moment[_0x3723('0x6')]();moment[_0x3723('0x6')]('en');var _0x327921=moment['monthsShort']()[_0x3723('0x2')](function(_0x345c92){return _0x345c92[_0x3723('0x7')]();});moment[_0x3723('0x6')](_0x529ea0);var _0x3ce3fe=_0x327921[_0x3723('0x8')](_0x21edfa);var _0x4cc963=_0x327921[_0x3723('0x8')](_0x299dee);if(_0x4cc963>_0x3ce3fe){return _0x327921['slice'](_0x3ce3fe,_0x4cc963+0x1);}else{var _0x13a968=_0x327921[_0x3723('0x9')](0x0,_0x4cc963+0x1);var _0xbf8bab=_0x327921[_0x3723('0x9')](_0x3ce3fe);return _0xbf8bab[_0x3723('0xa')](_0x13a968);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0xc0d9b2){var _0x53455f=parseInt(_0xc0d9b2,0xa);if(_0x53455f<0x1||_0x53455f>0x1f){throw new Error(EINVALID_DATE);}return _0x53455f;}function timeCompare(_0x45fda7,_0x344144,_0xdbbb9c){var _0x32142a=_0x45fda7['clone']();var _0x5a8a73=extractTime(_0x344144);var _0x593798=_0x5a8a73[0x0];var _0x184e16=_0x5a8a73[0x1];var _0x33e211=_0x45fda7[_0x3723('0xd')]()[_0x3723('0xe')](_0x593798)[_0x3723('0xf')](_0x184e16);throwIfDateNotValid(_0x33e211);var _0x5e3721=extractTime(_0xdbbb9c);var _0x55a295=_0x5e3721[0x0];var _0x228bcd=_0x5e3721[0x1];var _0x936381=_0x45fda7['clone']()[_0x3723('0xe')](_0x55a295)[_0x3723('0xf')](_0x228bcd);throwIfDateNotValid(_0x936381);if(_0x936381[_0x3723('0x10')](_0x33e211)){var _0x90f284=_0x32142a[_0x3723('0xd')]()['startOf'](_0x3723('0x11'));var _0x85e78=_0x32142a['clone']()[_0x3723('0x12')](_0x3723('0x11'));return _0x32142a[_0x3723('0x13')](_0x33e211,_0x85e78,undefined,'[]')||_0x32142a[_0x3723('0x13')](_0x90f284,_0x936381,undefined,'[]');}else{return _0x32142a[_0x3723('0x13')](_0x33e211,_0x936381,undefined,'[]');}}module[_0x3723('0xb')][_0x3723('0x14')]=timeCompare;function dowCompare(_0x575ced,_0x286be6,_0x2192f4){var _0x13e723=_0x575ced['locale']('en')[_0x3723('0x15')]('ddd')[_0x3723('0x7')]();return circularDoWInterval(_0x286be6,_0x2192f4)[_0x3723('0x16')](_0x13e723);}module[_0x3723('0xb')][_0x3723('0x17')]=dowCompare;function domCompare(_0x439f82,_0x28ec64,_0x2ff7c7){var _0x437a77=_0x439f82['date']();if(_0x28ec64===_0x2ff7c7){return _0x437a77===_0x28ec64;}else{var _0x55f89b=_0x439f82[_0x3723('0x18')]();var _0x530ef4=_0x28ec64<_0x2ff7c7;let _0x4f727e=![];var _0x4414f6=0x0;var _0x24d3c7=0x0;if(_0x530ef4){_0x4414f6=Math[_0x3723('0x19')](0x1,_0x28ec64);_0x24d3c7=Math['min'](_0x2ff7c7,_0x55f89b);_0x4f727e=_0x437a77>=_0x4414f6&&_0x437a77<=_0x24d3c7;}else{_0x4414f6=Math[_0x3723('0x1a')](_0x28ec64,_0x55f89b);_0x24d3c7=Math[_0x3723('0x19')](0x1,_0x2ff7c7);_0x4f727e=_0x437a77>=_0x4414f6||_0x437a77<=_0x24d3c7;}return _0x4f727e;}}module[_0x3723('0xb')][_0x3723('0x1b')]=domCompare;function monthCompare(_0x11d0f3,_0x56d935,_0x23af5e){var _0x567e61=_0x11d0f3[_0x3723('0x6')]('en')[_0x3723('0x15')](_0x3723('0x1c'))['toLowerCase']();return circularMonthInterval(_0x56d935,_0x23af5e)[_0x3723('0x16')](_0x567e61);}module['exports'][_0x3723('0x1d')]=monthCompare;function iftime(_0x3c0164,_0x27b73b=moment['tz'][_0x3723('0x1e')](),_0x31e79a=moment()){if(!validateRx[_0x3723('0x1f')](_0x3c0164)){throw new Error(EINVALID_STRING);}else{var _0xbbf21f=(moment[_0x3723('0x20')](_0x31e79a)?_0x31e79a[_0x3723('0xd')]():moment(_0x31e79a))['tz'](_0x27b73b)[_0x3723('0x6')]('en');throwIfDateNotValid(_0xbbf21f);var _0x5cd006=_0x3c0164['split'](',');var _0x344874=_0x5cd006[0x0];var _0x3d51be=_0x5cd006[0x1];var _0xc076dc=_0x5cd006[0x2];var _0x187d58=_0x5cd006[0x3];let _0x289cc5=!![];if(_0x344874!=='*'){var _0x2a70ca=_0x344874['split']('-');var _0x2679fa=_[_0x3723('0x21')](_0x2a70ca[0x0],0x5,'0');var _0x4afa1e=_0x2a70ca[_0x3723('0x22')]===0x2?_[_0x3723('0x21')](_0x2a70ca[0x1],0x5,'0'):_0x2679fa;_0x289cc5=timeCompare(_0xbbf21f,_0x2679fa,_0x4afa1e);}let _0x918afe=!![];if(_0x3d51be!=='*'){var _0x189290=_0x3d51be['split']('-');var _0x3875bd=_0x189290[0x0];var _0x29bd9=_0x189290[_0x3723('0x22')]===0x2?_0x189290[0x1]:_0x3875bd;_0x918afe=dowCompare(_0xbbf21f,_0x3875bd,_0x29bd9);}let _0x9d4edc=!![];if(_0xc076dc!=='*'){var _0x29e67c=_0xc076dc[_0x3723('0x5')]('-');var _0x3f69f3=parseDom(_0x29e67c[0x0]);var _0x302eba=_0x29e67c[_0x3723('0x22')]===0x2?parseDom(_0x29e67c[0x1]):_0x3f69f3;_0x9d4edc=domCompare(_0xbbf21f,_0x3f69f3,_0x302eba);}let _0x422111=!![];if(_0x187d58!=='*'){var _0x47790d=_0x187d58[_0x3723('0x5')]('-');var _0x31bebd=_0x47790d[0x0];var _0x4bf065=_0x47790d[_0x3723('0x22')]===0x2?_0x47790d[0x1]:_0x47790d[0x0];_0x422111=monthCompare(_0xbbf21f,_0x31bebd,_0x4bf065);}return _0x289cc5&&_0x918afe&&_0x9d4edc&&_0x422111;}}module[_0x3723('0xb')][_0x3723('0x23')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 70ddef8..128f333 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9f8=['toUpperCase','keys','length','stringify','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','File','%s-%s','error','fileLogger','moment','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xf9f8,0x7e));var _0x8f9f=function(_0x339d2b,_0x1f930a){_0x339d2b=_0x339d2b-0x0;var _0xd155af=_0xf9f8[_0x339d2b];return _0xd155af;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x8f9f('0x0'));var winston=require(_0x8f9f('0x1'));var config=require(_0x8f9f('0x2'));var debugLevel=config[_0x8f9f('0x3')]?config[_0x8f9f('0x3')]['toLowerCase']():_0x8f9f('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x8f9f('0x5'),'error':_0x8f9f('0x6'),'warn':_0x8f9f('0x7'),'info':'white','print':_0x8f9f('0x8'),'success':_0x8f9f('0x9'),'http':_0x8f9f('0xa'),'verbose':_0x8f9f('0xb'),'debug':_0x8f9f('0xc'),'silly':'bold\x20cyan'};winston[_0x8f9f('0xd')](XC_LOG_COLORS);function getLogFileName(_0x341113,_0x45f930,_0x29225f){var _0x1c175a=_0x341113||'/var/log/xcally';return path['join'](_0x1c175a,util[_0x8f9f('0xe')](_0x8f9f('0xf'),_0x45f930,_0x29225f));}function formatter(_0x13ecac,_0x7eb702){_0x7eb702['message']=_0x7eb702[_0x8f9f('0x10')][_0x8f9f('0x11')](/@@{/g,_0x8f9f('0x12'))['replace'](/}@@/g,_0x8f9f('0x13'))[_0x8f9f('0x11')](/@{/g,'{{')[_0x8f9f('0x11')](/}@/g,'}}');return util[_0x8f9f('0xe')](_0x8f9f('0x14'),moment()[_0x8f9f('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),_0x7eb702[_0x8f9f('0x15')][_0x8f9f('0x16')](),_0x13ecac,_0x7eb702[_0x8f9f('0x10')]);}function fileFormat(_0x47fd8a,_0xddcd7e){_0xddcd7e[_0x8f9f('0x10')]=_0xddcd7e['message'][_0x8f9f('0x11')](/@@{/g,_0x8f9f('0x12'))[_0x8f9f('0x11')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x8f9f('0x11')](/}@/g,'}}');var _0x5cadba=_0xddcd7e['meta']&&Object[_0x8f9f('0x17')](_0xddcd7e['meta'])[_0x8f9f('0x18')]?'\x0a\x09'+JSON[_0x8f9f('0x19')](_0xddcd7e[_0x8f9f('0x1a')]):'';return util['format'](_0x8f9f('0x1b'),moment()[_0x8f9f('0xe')](_0x8f9f('0x1c')),_0xddcd7e[_0x8f9f('0x15')][_0x8f9f('0x16')](),_0x47fd8a,_0xddcd7e[_0x8f9f('0x10')],_0x5cadba);}function consoleLogger(){var _0x4abd1b=new winston[(_0x8f9f('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8f9f('0x1e'))][(_0x8f9f('0x1f'))]({'level':_0x8f9f('0x20'),'json':![],'formatter':function(_0x3d0853){return formatter('',_0x3d0853);}})]});return _0x4abd1b;}function fileLogger(_0x27a34b,_0x5082b6){var _0x3b6e04=new winston[(_0x8f9f('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8f9f('0x1e'))][(_0x8f9f('0x21'))]({'name':util['format'](_0x8f9f('0x22'),_0x27a34b,_0x8f9f('0x23')),'filename':getLogFileName(_0x5082b6,_0x27a34b,'error'),'level':_0x8f9f('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4f08f8){return fileFormat(_0x27a34b,_0x4f08f8);}}),new winston['transports'][(_0x8f9f('0x21'))]({'name':util[_0x8f9f('0xe')]('%s-%s',_0x27a34b,debugLevel),'filename':getLogFileName(_0x5082b6,_0x27a34b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x55b633){return fileFormat(_0x27a34b,_0x55b633);}}),new winston[(_0x8f9f('0x1e'))][(_0x8f9f('0x1f'))]({'level':_0x8f9f('0x20'),'json':![],'formatter':function(_0x41d2ea){return fileFormat(_0x27a34b,_0x41d2ea);}})]});return _0x3b6e04;}exports['consoleLogger']=consoleLogger;exports[_0x8f9f('0x24')]=fileLogger; \ No newline at end of file +var _0x45c6=['bold\x20blue','/var/log/xcally','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','warn','File','%s-%s','error','Console','consoleLogger','fileLogger','util','moment','../config/environment','debugLevel','redBG\x20white','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x45c6,0x82));var _0x645c=function(_0x11989b,_0x54de80){_0x11989b=_0x11989b-0x0;var _0x477de0=_0x45c6[_0x11989b];return _0x477de0;};'use strict';var path=require('path');var util=require(_0x645c('0x0'));var moment=require(_0x645c('0x1'));var winston=require('winston');var config=require(_0x645c('0x2'));var debugLevel=config['debugLevel']?config[_0x645c('0x3')]['toLowerCase']():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x645c('0x4'),'error':'red','warn':_0x645c('0x5'),'info':_0x645c('0x6'),'print':'bold\x20white','success':_0x645c('0x7'),'http':_0x645c('0x8'),'verbose':_0x645c('0x9'),'debug':_0x645c('0xa'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x7ad7d2,_0x40a5fe,_0x53f9a4){var _0x3e5fd0=_0x7ad7d2||_0x645c('0xb');return path[_0x645c('0xc')](_0x3e5fd0,util[_0x645c('0xd')]('%s-%s.log',_0x40a5fe,_0x53f9a4));}function formatter(_0x2c45a5,_0x51e1d1){_0x51e1d1[_0x645c('0xe')]=_0x51e1d1[_0x645c('0xe')][_0x645c('0xf')](/@@{/g,_0x645c('0x10'))['replace'](/}@@/g,_0x645c('0x11'))['replace'](/@{/g,'{{')[_0x645c('0xf')](/}@/g,'}}');return util[_0x645c('0xd')](_0x645c('0x12'),moment()[_0x645c('0xd')](_0x645c('0x13')),_0x51e1d1[_0x645c('0x14')]['toUpperCase'](),_0x2c45a5,_0x51e1d1[_0x645c('0xe')]);}function fileFormat(_0x799661,_0x4b90a8){_0x4b90a8[_0x645c('0xe')]=_0x4b90a8[_0x645c('0xe')][_0x645c('0xf')](/@@{/g,'{{{')[_0x645c('0xf')](/}@@/g,'}}}')[_0x645c('0xf')](/@{/g,'{{')[_0x645c('0xf')](/}@/g,'}}');var _0x1f4e19=_0x4b90a8[_0x645c('0x15')]&&Object[_0x645c('0x16')](_0x4b90a8[_0x645c('0x15')])[_0x645c('0x17')]?'\x0a\x09'+JSON[_0x645c('0x18')](_0x4b90a8[_0x645c('0x15')]):'';return util[_0x645c('0xd')](_0x645c('0x19'),moment()[_0x645c('0xd')](_0x645c('0x13')),_0x4b90a8[_0x645c('0x14')]['toUpperCase'](),_0x799661,_0x4b90a8[_0x645c('0xe')],_0x1f4e19);}function consoleLogger(){var _0x3d54ca=new winston[(_0x645c('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x645c('0x1b'))]['Console']({'level':_0x645c('0x1c'),'json':![],'formatter':function(_0x4c1d7b){return formatter('',_0x4c1d7b);}})]});return _0x3d54ca;}function fileLogger(_0x2bd4cb,_0x4e7a87){var _0x223074=new winston[(_0x645c('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x645c('0x1b'))][(_0x645c('0x1d'))]({'name':util['format'](_0x645c('0x1e'),_0x2bd4cb,_0x645c('0x1f')),'filename':getLogFileName(_0x4e7a87,_0x2bd4cb,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf44ccf){return fileFormat(_0x2bd4cb,_0xf44ccf);}}),new winston['transports'][(_0x645c('0x1d'))]({'name':util['format'](_0x645c('0x1e'),_0x2bd4cb,debugLevel),'filename':getLogFileName(_0x4e7a87,_0x2bd4cb,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5bbb97){return fileFormat(_0x2bd4cb,_0x5bbb97);}}),new winston[(_0x645c('0x1b'))][(_0x645c('0x20'))]({'level':'warn','json':![],'formatter':function(_0xdc0b76){return fileFormat(_0x2bd4cb,_0xdc0b76);}})]});return _0x223074;}exports[_0x645c('0x21')]=consoleLogger;exports[_0x645c('0x22')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 2b04032..7615f67 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x37a8df,_0x4ddb0d){var _0x38f4c8=function(_0x378bec){while(--_0x378bec){_0x37a8df['push'](_0x37a8df['shift']());}};_0x38f4c8(++_0x4ddb0d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24c793,_0xe8f9fe){_0x24c793=_0x24c793-0x0;var _0x2b40c5=_0x5f2f[_0x24c793];return _0x2b40c5;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x27ed06,_0x390241){var _0x49079a=function(_0x4fd8ef){while(--_0x4fd8ef){_0x27ed06['push'](_0x27ed06['shift']());}};_0x49079a(++_0x390241);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e232b,_0x444436){_0x5e232b=_0x5e232b-0x0;var _0xcaace=_0x5f2f[_0x5e232b];return _0xcaace;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 23c0dc3..f8346d9 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3266=['\x20}\x20}','string','replace','isArray','keys','reduce','exports','lodash','{\x20{\x20'];(function(_0x453576,_0x19ec50){var _0x321e85=function(_0x4135ce){while(--_0x4135ce){_0x453576['push'](_0x453576['shift']());}};_0x321e85(++_0x19ec50);}(_0x3266,0x6a));var _0x6326=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x3266[_0x119d5a];return _0x15bff4;};var _=require(_0x6326('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b328d){return _0x2b328d==='{{'?_0x6326('0x1'):_0x6326('0x2');}function safeTemplate(_0x545df7){var _0x6b67c0=_0x545df7;if(typeof _0x545df7===_0x6326('0x3')){_0x6b67c0=_0x545df7[_0x6326('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x6326('0x5')](_0x545df7)){_0x6b67c0=_0x545df7['map'](function(_0x30b22e){return safeTemplate(_0x30b22e);});}else if(_['isPlainObject'](_0x545df7)){_0x6b67c0=Object[_0x6326('0x6')](_0x545df7)[_0x6326('0x7')](function(_0x14208e,_0x5402e5){_0x14208e[_0x5402e5]=safeTemplate(_0x545df7[_0x5402e5]);return _0x14208e;},{});}return _0x6b67c0;}module[_0x6326('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x5d0fb9,_0x418705){var _0x220f0b=function(_0x570f91){while(--_0x570f91){_0x5d0fb9['push'](_0x5d0fb9['shift']());}};_0x220f0b(++_0x418705);}(_0x9354,0x96));var _0x4935=function(_0x403db1,_0x59018e){_0x403db1=_0x403db1-0x0;var _0x47c48f=_0x9354[_0x403db1];return _0x47c48f;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index d9a6730..e30546f 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bf7=['isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','then','updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','resolve','server/app.json','legacy-libs'];(function(_0xf15551,_0x292575){var _0x357db4=function(_0x7a9059){while(--_0x7a9059){_0xf15551['push'](_0xf15551['shift']());}};_0x357db4(++_0x292575);}(_0x6bf7,0x109));var _0x76bf=function(_0x123e42,_0x4286cb){_0x123e42=_0x123e42-0x0;var _0x325144=_0x6bf7[_0x123e42];return _0x325144;};var fs=require(_0x76bf('0x0'));var path=require(_0x76bf('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0x76bf('0x2')](root,_0x76bf('0x3'));var NODEPATH=path[_0x76bf('0x2')](root,_0x76bf('0x4'));function setLegacyLibsNodeEnvPath(_0x2bd360){let _0x45d96a=![];if(Array[_0x76bf('0x5')](_0x2bd360[_0x76bf('0x6')])){var _0x5a5bed=_0x2bd360['apps'][_0x76bf('0x7')](function(_0x10c6c8){return _0x10c6c8[_0x76bf('0x8')]===_0x76bf('0x9');});if(_0x5a5bed>-0x1){var _0x1580d4=_0x2bd360[_0x76bf('0x6')][_0x5a5bed];if(typeof _0x1580d4['env'][_0x76bf('0xa')]!==_0x76bf('0xb')){_0x1580d4[_0x76bf('0xc')]['NODE_PATH']=NODEPATH;_0x45d96a=!![];}}return{'appConfig':_0x2bd360,'updated':_0x45d96a};}}function updateAppConfig(_0x5ad78a){return fs['pathExists'](APP_JSON_PATH)[_0x76bf('0xd')](function(_0x323552){if(_0x323552){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x104f00){var _0x1f5faf=setLegacyLibsNodeEnvPath(_0x104f00);if(_0x1f5faf[_0x76bf('0xe')]){_0x5ad78a['info'](_0x76bf('0xf'));return fs[_0x76bf('0x10')](APP_JSON_PATH,_0x104f00,{'spaces':0x2});}else{return Promise[_0x76bf('0x2')]();}});}else{return Promise['resolve']();}});}module[_0x76bf('0x11')]=updateAppConfig; \ No newline at end of file +var _0x5af9=['legacy-libs','isArray','apps','name','motion2','env','NODE_PATH','string','pathExists','readJSON','then','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','resolve','server/app.json'];(function(_0x4dd909,_0x407b30){var _0x73872=function(_0x2eb115){while(--_0x2eb115){_0x4dd909['push'](_0x4dd909['shift']());}};_0x73872(++_0x407b30);}(_0x5af9,0xf7));var _0x95af=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x5af9[_0x4d8ed9];return _0x1e2140;};var fs=require(_0x95af('0x0'));var path=require(_0x95af('0x1'));var config=require('../config/environment');var root=config[_0x95af('0x2')];var APP_JSON_PATH=path[_0x95af('0x3')](root,_0x95af('0x4'));var NODEPATH=path[_0x95af('0x3')](root,_0x95af('0x5'));function setLegacyLibsNodeEnvPath(_0x3fb6c4){let _0x528d72=![];if(Array[_0x95af('0x6')](_0x3fb6c4['apps'])){var _0x52bd98=_0x3fb6c4[_0x95af('0x7')]['findIndex'](function(_0x389058){return _0x389058[_0x95af('0x8')]===_0x95af('0x9');});if(_0x52bd98>-0x1){var _0x10c707=_0x3fb6c4[_0x95af('0x7')][_0x52bd98];if(typeof _0x10c707[_0x95af('0xa')][_0x95af('0xb')]!==_0x95af('0xc')){_0x10c707['env']['NODE_PATH']=NODEPATH;_0x528d72=!![];}}return{'appConfig':_0x3fb6c4,'updated':_0x528d72};}}function updateAppConfig(_0x5f07ac){return fs[_0x95af('0xd')](APP_JSON_PATH)['then'](function(_0xc86d81){if(_0xc86d81){return fs[_0x95af('0xe')](APP_JSON_PATH)[_0x95af('0xf')](function(_0x1f22f3){var _0x15b8a8=setLegacyLibsNodeEnvPath(_0x1f22f3);if(_0x15b8a8[_0x95af('0x10')]){_0x5f07ac[_0x95af('0x11')](_0x95af('0x12'));return fs[_0x95af('0x13')](APP_JSON_PATH,_0x1f22f3,{'spaces':0x2});}else{return Promise[_0x95af('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x95af('0x14')]=updateAppConfig; \ No newline at end of file diff --git a/snippet/3.8.0/index.html b/snippet/3.8.0/index.html deleted file mode 100644 index 9db4726..0000000 --- a/snippet/3.8.0/index.html +++ /dev/null @@ -1,29 +0,0 @@ -xCally Motion Chat
{{ actualTitle }}
diff --git a/snippet/3.8.0/scripts/app.js b/snippet/3.8.0/scripts/app.js deleted file mode 100644 index 9ca88e0..0000000 --- a/snippet/3.8.0/scripts/app.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see app.js.LICENSE.txt */ -"use strict";(self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["app"],{"./src/styles/app.scss":()=>{}},e=>{e.O(0,["vendor","vendor-index","vendor-angular-76f2ed34","vendor-angular-58d021f3","vendor-ng-embed","vendor-moment","vendor-jquery","vendor-jquery.textcomplete","vendor-emojionearea","vendor-emojione","vendor-angular-sanitize","vendor-angular-resource","vendor-angular-messages","vendor-angular-material","vendor-angular-local-storage","vendor-angular-animate","vendor-urlMatcher","vendor-transition","vendor-stateService","vendor-stateDirectives","vendor-flow","chat-e96e9bea","chat-fecd0807"],(()=>("./src/styles/app.scss",e(e.s="./src/styles/app.scss")))),e.O()}]); \ No newline at end of file diff --git a/snippet/3.8.0/scripts/app.js.LICENSE.txt b/snippet/3.8.0/scripts/app.js.LICENSE.txt deleted file mode 100644 index 15c6a44..0000000 --- a/snippet/3.8.0/scripts/app.js.LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * ************************************************************************* - * * * - * * xCALLY Motion - The Omnichannel Contact Center * - * * Copyright (c) Xenialab s.r.l. All Rights Reserved * - * * * - * ************************************************************************* - * * * - * * Email: info@xcally.com * - * * Website: https://www.xcally.com * - * * * - * ************************************************************************* - * * * - * * The SOFTWARE PRODUCT is protected by copyright laws and international * - * * copyright treaties, as well as other intellectual property laws and * - * * treaties. The SOFTWARE PRODUCT is licensed, not sold. * - * * * - * ************************************************************************* - */ diff --git a/snippet/3.8.0/scripts/chat-e96e9bea.js b/snippet/3.8.0/scripts/chat-e96e9bea.js deleted file mode 100644 index 58df155..0000000 --- a/snippet/3.8.0/scripts/chat-e96e9bea.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see chat-e96e9bea.js.LICENSE.txt */ -(self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["chat-e96e9bea"],{"./node_modules/@flowjs/ng-flow/dist/ng-flow.js":(e,t,n)=>{var o=n("./node_modules/@flowjs/flow.js/src/flow.js");angular.module("flow.provider",[]).provider("flowFactory",(function(){"use strict";this.defaults={},this.factory=function(e){return new o(e)},this.events=[],this.on=function(e,t){this.events.push([e,t])},this.$get=function(){var e=this.factory,t=this.defaults,n=this.events;return{create:function(o){var r=e(angular.extend({},t,o));return angular.forEach(n,(function(e){r.on(e[0],e[1])})),r}}}})),angular.module("flow.init",["flow.provider"]).controller("flowCtrl",["$scope","$attrs","$parse","flowFactory",function(e,t,n,o){var r=angular.extend({},e.$eval(t.flowInit)),s=e.$eval(t.flowObject)||o.create(r),a=function(t){var n=Array.prototype.slice.call(arguments);n.shift();var o=e.$broadcast.apply(e,["flow::"+t,s].concat(n));if({progress:1,filesSubmitted:1,fileSuccess:1,fileError:1,complete:1}[t]&&e.$applyAsync(),o.defaultPrevented)return!1};s.on("catchAll",a),e.$on("$destroy",(function(){s.off("catchAll",a)})),e.$flow=s,t.hasOwnProperty("flowName")&&(n(t.flowName).assign(e,s),e.$on("$destroy",(function(){n(t.flowName).assign(e)})))}]).directive("flowInit",[function(){return{scope:!0,controller:"flowCtrl"}}]),angular.module("flow.btn",["flow.init"]).directive("flowBtn",[function(){return{restrict:"EA",scope:!1,require:"^flowInit",link:function(e,t,n){var o=n.hasOwnProperty("flowDirectory"),r=n.hasOwnProperty("flowSingleFile"),s=n.hasOwnProperty("flowAttrs")&&e.$eval(n.flowAttrs);e.$flow.assignBrowse(t,o,r,s)}}}]),angular.module("flow.dragEvents",["flow.init"]).directive("flowPreventDrop",(function(){return{scope:!1,link:function(e,t,n){t.bind("drop dragover",(function(e){e.preventDefault()}))}}})).directive("flowDragEnter",["$timeout",function(e){return{scope:!1,link:function(t,n,o){var r,s=!1;n.bind("dragover",(function(n){var a,i,d;i=!1,d=(a=n).dataTransfer||a.originalEvent.dataTransfer,angular.forEach(d&&d.types,(function(e){"Files"===e&&(i=!0)})),i&&(s||(t.$apply(o.flowDragEnter),s=!0),e.cancel(r),n.preventDefault())})),n.bind("dragleave drop",(function(n){e.cancel(r),r=e((function(){t.$eval(o.flowDragLeave),r=null,s=!1}),100)}))}}}]),angular.module("flow.drop",["flow.init"]).directive("flowDrop",(function(){return{scope:!1,require:"^flowInit",link:function(e,t,n){function o(){e.$flow.assignDrop(t)}n.flowDropEnabled?e.$watch(n.flowDropEnabled,(function(n){n?o():e.$flow.unAssignDrop(t)})):o()}}})),function(e){"use strict";var t=e.module("flow.events",["flow.init"]);e.forEach({fileSuccess:["$file","$message"],fileProgress:["$file"],fileAdded:["$file","$event"],filesAdded:["$files","$event"],filesSubmitted:["$files","$event"],fileRetry:["$file"],fileRemoved:["$file"],fileError:["$file","$message"],uploadStart:[],complete:[],progress:[],error:["$message","$file"]},(function(n,o){var r,s="flow"+((r=o).charAt(0).toUpperCase()+r.slice(1));"flowUploadStart"==s&&(s="flowUploadStarted"),t.directive(s,[function(){return{require:"^flowInit",controller:["$scope","$attrs",function(t,r){t.$on("flow::"+o,(function(){var o=Array.prototype.slice.call(arguments),a=o.shift();if(t.$flow===o.shift()){var i={};e.forEach(n,(function(e,t){i[e]=o[t]})),!1===t.$eval(r[s],i)&&a.preventDefault()}}))}]}}])}))}(angular),angular.module("flow.img",["flow.init"]).directive("flowImg",[function(){return{scope:!1,require:"^flowInit",link:function(e,t,n){var o=n.flowImg;e.$watch(o,(function(t){if(t){var o=new FileReader;o.readAsDataURL(t.file),o.onload=function(t){e.$apply((function(){n.$set("src",t.target.result)}))}}}))}}}]),angular.module("flow.transfers",["flow.init"]).directive("flowTransfers",[function(){return{scope:!0,require:"^flowInit",link:function(e){e.transfers=e.$flow.files}}}]),angular.module("flow",["flow.provider","flow.init","flow.events","flow.btn","flow.drop","flow.transfers","flow.img","flow.dragEvents"])},"./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js":(e,t,n)=>{"use strict";var o,r=n("./node_modules/@uirouter/core/lib-esm/index.js"),s=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js"),a=n("./node_modules/@uirouter/angularjs/lib-esm/services.js"),i=n("./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js");function d(e,t,n,o,i){var d=(0,r.parse)("viewDecl.controllerAs"),u=(0,r.parse)("viewDecl.resolveAs");return{restrict:"ECA",priority:-400,compile:function(o){var m=o.html();return o.empty(),function(o,_){var c=_.data("$uiView");if(!c)return _.html(m),void e(_.contents())(o);var h=c.$cfg||{viewDecl:{},getTemplate:r.noop},f=h.path&&new r.ResolveContext(h.path);_.html(h.getTemplate(_,f)||m),r.trace.traceUIViewFill(c.$uiView,_.html());var p=e(_.contents()),M=h.controller,y=d(h),L=u(h),g=f&&(0,a.D)(f);if(o[L]=g,M){var Y=t(M,(0,r.extend)({},g,{$scope:o,$element:_}));y&&(o[y]=Y,o[y][L]=g),_.data("$ngControllerController",Y),_.children().data("$ngControllerController",Y),l(i,n,Y,o,h)}if((0,r.isString)(h.component))var v=(0,r.kebobString)(h.component),j=new RegExp("^(x-|data-)?"+v+"$","i"),k=o.$watch((function(){var e=[].slice.call(_[0].children).filter((function(e){return e&&e.tagName&&j.exec(e.tagName)}));return e&&s.ng.element(e).data("$"+h.component+"Controller")}),(function(e){e&&(l(i,n,e,o,h),k())}));p(o)}}}}o=["$view","$animate","$uiViewScroll","$interpolate","$q",function(e,t,n,o,a){var d={$cfg:{viewDecl:{$context:e._pluginapi._rootViewContext()}},$uiView:{}},u={count:0,restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(m,l,_){return function(m,l,c){var h,f,p,M,y=c.onload||"",L=c.autoscroll,g=function(e,n,o){s.ng.version.minor>2?t.enter(e,null,n).then(o):t.enter(e,null,n,o)},Y=function(e,n){s.ng.version.minor>2?t.leave(e).then(n):t.leave(e,n)},v=l.inheritedData("$uiView")||d,j=o(c.uiView||c.name||"")(m)||"$default",k={$type:"ng1",id:u.count++,name:j,fqn:v.$uiView.fqn?v.$uiView.fqn+"."+j:j,config:null,configUpdated:function(e){(!e||e instanceof i.qO)&&(M!==e&&(r.trace.traceUIViewConfigUpdated(k,e&&e.viewDecl&&e.viewDecl.$context),M=e,b(e)))},get creationContext(){var e=(0,r.parse)("$cfg.viewDecl.$context")(v),t=(0,r.parse)("$uiView.creationContext")(v);return e||t}};r.trace.traceUIViewEvent("Linking",k),l.data("$uiView",{$uiView:k}),b();var w=e.registerUIView(k);function b(e){var t=m.$new(),o=a.defer(),s=a.defer(),i={$cfg:e,$uiView:k},d={$animEnter:o.promise,$animLeave:s.promise,$$animLeave:s};t.$emit("$viewContentLoading",j);var u=_(t,(function(e){e.data("$uiViewAnim",d),e.data("$uiView",i),g(e,l,(function(){o.resolve(),p&&p.$emit("$viewContentAnimationEnded"),((0,r.isDefined)(L)&&!L||m.$eval(L))&&n(e)})),function(){if(h&&(r.trace.traceUIViewEvent("Removing (previous) el",h.data("$uiView")),h.remove(),h=null),p&&(r.trace.traceUIViewEvent("Destroying scope",k),p.$destroy(),p=null),f){var e=f.data("$uiViewAnim");r.trace.traceUIViewEvent("Animate out",e),Y(f,(function(){e.$$animLeave.resolve(),h=null})),h=f,f=null}}()}));f=u,(p=t).$emit("$viewContentLoaded",e||M),p.$eval(y)}m.$on("$destroy",(function(){r.trace.traceUIViewEvent("Destroying/Unregistering",k),w()}))}}};return u}],d.$inject=["$compile","$controller","$transitions","$view","$q"];var u="function"==typeof s.ng.module("ui.router").component,m=0;function l(e,t,n,o,s){!(0,r.isFunction)(n.$onInit)||(s.viewDecl.component||s.viewDecl.componentProvider)&&u||n.$onInit();var a=(0,r.tail)(s.path).state.self,i={bind:n};if((0,r.isFunction)(n.uiOnParamsChanged)){var d=new r.ResolveContext(s.path).getResolvable("$transition$").data;o.$on("$destroy",t.onSuccess({},(function(e){if(e!==d&&-1===e.exiting().indexOf(a)){var t=e.params("to"),o=e.params("from"),s=function(e){return e.paramSchema},i=e.treeChanges("to").map(s).reduce(r.unnestR,[]),u=e.treeChanges("from").map(s).reduce(r.unnestR,[]),m=i.filter((function(e){var n=u.indexOf(e);return-1===n||!u[n].type.equals(t[e.id],o[e.id])}));if(m.length){var l=m.map((function(e){return e.id})),_=(0,r.filter)(t,(function(e,t){return-1!==l.indexOf(t)}));n.uiOnParamsChanged(_,e)}}}),i))}if((0,r.isFunction)(n.uiCanExit)){var l=m++,_="_uiCanExitIds",c=function(e){return!!e&&(e[_]&&!0===e[_][l]||c(e.redirectedFrom()))},h={exiting:a.name};o.$on("$destroy",t.onBefore(h,(function(t){var o,r=t[_]=t[_]||{};return c(t)||(o=e.when(n.uiCanExit(t))).then((function(e){return r[l]=!1!==e})),o}),i))}}s.ng.module("ui.router.state").directive("uiView",o),s.ng.module("ui.router.state").directive("uiView",d)},"./node_modules/@uirouter/angularjs/lib-esm/interface.js":()=>{},"./node_modules/@uirouter/angularjs/lib-esm/services.js":(e,t,n)=>{"use strict";n.d(t,{D:()=>j});var o=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js"),r=n("./node_modules/@uirouter/core/lib-esm/index.js"),s=n("./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"),a=function(){function e(){var e=this;this._useHttp=o.ng.version.minor<3,this.$get=["$http","$templateCache","$injector",function(t,n,o){return e.$templateRequest=o.has&&o.has("$templateRequest")&&o.get("$templateRequest"),e.$http=t,e.$templateCache=n,e}]}return e.prototype.useHttpService=function(e){this._useHttp=e},e.prototype.fromConfig=function(e,t,n){var o=function(e){return r.services.$q.when(e).then((function(e){return{template:e}}))},s=function(e){return r.services.$q.when(e).then((function(e){return{component:e}}))};return(0,r.isDefined)(e.template)?o(this.fromString(e.template,t)):(0,r.isDefined)(e.templateUrl)?o(this.fromUrl(e.templateUrl,t)):(0,r.isDefined)(e.templateProvider)?o(this.fromProvider(e.templateProvider,t,n)):(0,r.isDefined)(e.component)?s(e.component):(0,r.isDefined)(e.componentProvider)?s(this.fromComponentProvider(e.componentProvider,t,n)):o("")},e.prototype.fromString=function(e,t){return(0,r.isFunction)(e)?e(t):e},e.prototype.fromUrl=function(e,t){return(0,r.isFunction)(e)&&(e=e(t)),null==e?null:this._useHttp?this.$http.get(e,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then((function(e){return e.data})):this.$templateRequest(e)},e.prototype.fromProvider=function(e,t,n){var o=r.services.$injector.annotate(e),s=(0,r.isArray)(e)?(0,r.tail)(e):e;return new r.Resolvable("",s,o).get(n)},e.prototype.fromComponentProvider=function(e,t,n){var o=r.services.$injector.annotate(e),s=(0,r.isArray)(e)?(0,r.tail)(e):e;return new r.Resolvable("",s,o).get(n)},e.prototype.makeComponentTemplate=function(e,t,n,s){s=s||{};var a=o.ng.version.minor>=3?"::":"",d=function(e){var t=(0,r.kebobString)(e);return/^(x|data)-/.exec(t)?"x-"+t:t},u=function(e){var t=r.services.$injector.get(e+"Directive");if(!t||!t.length)throw new Error("Unable to find component named '"+e+"'");return t.map(i).reduce(r.unnestR,[])}(n).map((function(n){var o=n.name,i=n.type,u=d(o);if(e.attr(u)&&!s[o])return u+"='"+e.attr(u)+"'";var m=s[o]||o;if("@"===i)return u+"='{{"+a+"$resolve."+m+"}}'";if("&"===i){var l=t.getResolvable(m),_=l&&l.data,c=_&&r.services.$injector.annotate(_)||[];return u+"='$resolve."+m+((0,r.isArray)(_)?"["+(_.length-1)+"]":"")+"("+c.join(",")+")'"}return u+"='"+a+"$resolve."+m+"'"})).join(" "),m=d(n);return"<"+m+" "+u+">"},e}(),i=function(e){return(0,r.isObject)(e.bindToController)?d(e.bindToController):d(e.scope)},d=function(e){return Object.keys(e||{}).map((function(t){return[t,/^([=<@&])[?]?(.*)/.exec(e[t])]})).filter((function(e){return(0,r.isDefined)(e)&&(0,r.isArray)(e[1])})).map((function(e){return{name:e[1][2]||e[0],type:e[1][1]}}))},u=n("./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"),m=function(e){return function(t){var n=t[e],o="onExit"===e?"from":"to";return n?function(e,t){var s=new r.ResolveContext(e.treeChanges(o)).subContext(t.$$state()),a=(0,r.extend)(j(s),{$state$:t,$transition$:e});return r.services.$injector.invoke(n,this,a)}:void 0}},l=function(){function e(e){this._urlListeners=[],this.$locationProvider=e;var t=(0,r.val)(e);(0,r.createProxyFunctions)(t,this,t,["hashPrefix"])}return e.monkeyPatchPathParameterType=function(e){var t=e.urlMatcherFactory.type("path");t.encode=function(e){return null!=e?e.toString().replace(/(~|\/)/g,(function(e){return{"~":"~~","/":"~2F"}[e]})):e},t.decode=function(e){return null!=e?e.toString().replace(/(~~|~2F)/g,(function(e){return{"~~":"~","~2F":"/"}[e]})):e}},e.prototype.dispose=function(){},e.prototype.onChange=function(e){var t=this;return this._urlListeners.push(e),function(){return(0,r.removeFrom)(t._urlListeners)(e)}},e.prototype.html5Mode=function(){var e=this.$locationProvider.html5Mode();return(e=(0,r.isObject)(e)?e.enabled:e)&&this.$sniffer.history},e.prototype.baseHref=function(){return this._baseHref||(this._baseHref=this.$browser.baseHref()||this.$window.location.pathname)},e.prototype.url=function(e,t,n){return void 0===t&&(t=!1),(0,r.isDefined)(e)&&this.$location.url(e),t&&this.$location.replace(),n&&this.$location.state(n),this.$location.url()},e.prototype._runtimeServices=function(e,t,n,o,s){var a=this;this.$location=t,this.$sniffer=n,this.$browser=o,this.$window=s,e.$on("$locationChangeSuccess",(function(e){return a._urlListeners.forEach((function(t){return t(e)}))}));var i=(0,r.val)(t);(0,r.createProxyFunctions)(i,this,i,["replace","path","search","hash"]),(0,r.createProxyFunctions)(i,this,i,["port","protocol","host"])},e}(),_=n("./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js");o.ng.module("ui.router.angular1",[]);var c=o.ng.module("ui.router.init",["ng"]),h=o.ng.module("ui.router.util",["ui.router.init"]),f=o.ng.module("ui.router.router",["ui.router.util"]),p=o.ng.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),M=o.ng.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),y=(o.ng.module("ui.router.compat",["ui.router"]),null);function L(e){(y=this.router=new r.UIRouter).stateProvider=new u.X(y.stateRegistry,y.stateService),y.stateRegistry.decorator("views",s.LB),y.stateRegistry.decorator("onExit",m("onExit")),y.stateRegistry.decorator("onRetain",m("onRetain")),y.stateRegistry.decorator("onEnter",m("onEnter")),y.viewService._pluginapi._viewConfigFactory("ng1",(0,s.OB)()),y.urlService.config._decodeParams=!1;var t=y.locationService=y.locationConfig=new l(e);function n(e,n,o,r,s,a,i){return t._runtimeServices(s,e,r,n,o),delete y.router,delete y.$get,y}return l.monkeyPatchPathParameterType(y),y.router=y,y.$get=n,n.$inject=["$location","$browser","$window","$sniffer","$rootScope","$http","$templateCache"],y}L.$inject=["$locationProvider"];var g=function(e){return["$uiRouterProvider",function(t){var n=t.router[e];return n.$get=function(){return n},n}]};function Y(e,t,n){if(r.services.$injector=e,r.services.$q=t,!Object.prototype.hasOwnProperty.call(e,"strictDi"))try{e.invoke((function(e){}))}catch(t){e.strictDi=!!/strict mode/.exec(t&&t.toString())}n.stateRegistry.get().map((function(e){return e.$$state().resolvables})).reduce(r.unnestR,[]).filter((function(e){return"deferred"===e.deps})).forEach((function(t){return t.deps=e.annotate(t.resolveFn,e.strictDi)}))}function v(e){e.$watch((function(){r.trace.approximateDigests++}))}Y.$inject=["$injector","$q","$uiRouter"],v.$inject=["$rootScope"],c.provider("$uiRouter",L),f.provider("$urlRouter",["$uiRouterProvider",function(e){return e.urlRouterProvider=new _.L(e)}]),h.provider("$urlService",g("urlService")),h.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return y.urlMatcherFactory}]),h.provider("$templateFactory",(function(){return new a})),p.provider("$stateRegistry",g("stateRegistry")),p.provider("$uiRouterGlobals",g("globals")),p.provider("$transitions",g("transitionService")),p.provider("$state",["$uiRouterProvider",function(){return(0,r.extend)(y.stateProvider,{$get:function(){return y.stateService}})}]),p.factory("$stateParams",["$uiRouter",function(e){return e.globals.params}]),M.factory("$view",(function(){return y.viewService})),M.service("$trace",(function(){return r.trace})),M.run(v),h.run(["$urlMatcherFactory",function(e){}]),p.run(["$state",function(e){}]),f.run(["$urlRouter",function(e){}]),c.run(Y);var j=function(e){return e.getTokens().filter(r.isString).map((function(t){var n=e.getResolvable(t);return[t,"NOWAIT"===e.getPolicy(n).async?n.promise:n.data]})).reduce(r.applyPairs,{})}},"./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js":(e,t,n)=>{"use strict";var o=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js");function r(e){var t=function(t,n,o){return e.is(t,n,o)};return t.$stateful=!0,t}function s(e){var t=function(t,n,o){return e.includes(t,n,o)};return t.$stateful=!0,t}r.$inject=["$state"],s.$inject=["$state"],o.ng.module("ui.router.state").filter("isState",r).filter("includedByState",s)},"./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js":(e,t,n)=>{"use strict";n.d(t,{X:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/index.js"),r=function(){function e(t,n){this.stateRegistry=t,this.stateService=n,(0,o.createProxyFunctions)((0,o.val)(e.prototype),this,(0,o.val)(this))}return e.prototype.decorator=function(e,t){return this.stateRegistry.decorator(e,t)||this},e.prototype.state=function(e,t){return(0,o.isObject)(e)?t=e:t.name=e,this.stateRegistry.register(t),this},e.prototype.onInvalid=function(e){return this.stateService.onInvalid(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js":(e,t,n)=>{"use strict";n.d(t,{OB:()=>r,LB:()=>a,qO:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/index.js");function r(){var e=null;return function(t,n){return e=e||o.services.$injector.get("$templateFactory"),[new d(t,n,e)]}}var s=function(e,t){return e.reduce((function(e,n){return e||(0,o.isDefined)(t[n])}),!1)};function a(e){if(!e.parent)return{};var t=["component","bindings","componentProvider"],n=["templateProvider","templateUrl","template","notify","async"].concat(["controller","controllerProvider","controllerAs","resolveAs"]),r=t.concat(n);if((0,o.isDefined)(e.views)&&s(r,e))throw new Error("State '"+e.name+"' has a 'views' object. It cannot also have \"view properties\" at the state level. Move the following properties into a view (in the 'views' object): "+r.filter((function(t){return(0,o.isDefined)(e[t])})).join(", "));var a={},i=e.views||{$default:(0,o.pick)(e,r)};return(0,o.forEach)(i,(function(r,i){if(i=i||"$default",(0,o.isString)(r)&&(r={component:r}),r=(0,o.extend)({},r),s(t,r)&&s(n,r))throw new Error("Cannot combine: "+t.join("|")+" with: "+n.join("|")+" in stateview: '"+i+"@"+e.name+"'");r.resolveAs=r.resolveAs||"$resolve",r.$type="ng1",r.$context=e,r.$name=i;var d=o.ViewService.normalizeUIViewTarget(r.$context,r.$name);r.$uiViewName=d.uiViewName,r.$uiViewContextAnchor=d.uiViewContextAnchor,a[i]=r})),a}var i=0,d=function(){function e(e,t,n){var o=this;this.path=e,this.viewDecl=t,this.factory=n,this.$id=i++,this.loaded=!1,this.getTemplate=function(e,t){return o.component?o.factory.makeComponentTemplate(e,t,o.component,o.viewDecl.bindings):o.template}}return e.prototype.load=function(){var e=this,t=o.services.$q,n=new o.ResolveContext(this.path),r=this.path.reduce((function(e,t){return(0,o.extend)(e,t.paramValues)}),{}),s={template:t.when(this.factory.fromConfig(this.viewDecl,r,n)),controller:t.when(this.getController(n))};return t.all(s).then((function(t){return o.trace.traceViewServiceEvent("Loaded",e),e.controller=t.controller,(0,o.extend)(e,t.template),e}))},e.prototype.getController=function(e){var t=this.viewDecl.controllerProvider;if(!(0,o.isInjectable)(t))return this.viewDecl.controller;var n=o.services.$injector.annotate(t),r=(0,o.isArray)(t)?(0,o.tail)(t):t;return new o.Resolvable("",r,n).get(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/index.js"),r=function(){function e(e){this.router=e}return e.injectableHandler=function(e,t){return function(n){return o.services.$injector.invoke(t,null,{$match:n,$stateParams:e.globals.params})}},e.prototype.$get=function(){var e=this.router.urlService;return this.router.urlRouter.update(!0),e.interceptDeferred||e.listen(),this.router.urlRouter},e.prototype.rule=function(e){var t=this;if(!(0,o.isFunction)(e))throw new Error("'rule' must be a function");var n=new o.BaseUrlRule((function(){return e(o.services.$injector,t.router.locationService)}),o.identity);return this.router.urlService.rules.rule(n),this},e.prototype.otherwise=function(e){var t=this,n=this.router.urlService.rules;if((0,o.isString)(e))n.otherwise(e);else{if(!(0,o.isFunction)(e))throw new Error("'rule' must be a string or function");n.otherwise((function(){return e(o.services.$injector,t.router.locationService)}))}return this},e.prototype.when=function(t,n){return((0,o.isArray)(n)||(0,o.isFunction)(n))&&(n=e.injectableHandler(this.router,n)),this.router.urlService.rules.when(t,n),this},e.prototype.deferIntercept=function(e){this.router.urlService.deferIntercept(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js":(e,t,n)=>{"use strict";n("./node_modules/@uirouter/angularjs/lib-esm/angular.js").ng.module("ui.router.state").provider("$uiViewScroll",(function(){var e=!1;this.useAnchorScroll=function(){e=!0},this.$get=["$anchorScroll","$timeout",function(t,n){return e?t:function(e){return n((function(){e[0].scrollIntoView()}),0,!1)}}]}))},"./node_modules/@uirouter/core/lib-esm/common/common.js":(e,t,n)=>{"use strict";n.d(t,{Jz:()=>i,xZ:()=>u,Qs:()=>m,Ed:()=>l,l7:()=>_,fS:()=>c,yR:()=>h,ZT:()=>f,WR:()=>p,ED:()=>M,d3:()=>y,nA:()=>L,LH:()=>g,Wk:()=>Y,ce:()=>v,LQ:()=>j,mX:()=>k,ei:()=>w,CE:()=>b,hX:()=>D,sE:()=>T,js:()=>S,UI:()=>H,VO:()=>x,XC:()=>E,o8:()=>P,M7:()=>O,FN:()=>A,Ez:()=>$,v_:()=>R,UW:()=>F,sp:()=>W,ym:()=>C,bb:()=>I,Gb:()=>z,JG:()=>J,HX:()=>V,jv:()=>U});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),a=function(){for(var e=0,t=0,n=arguments.length;t=0&&e.splice(n,1),e})),g=(0,r.WA)((function(e,t){return e.push(t),t})),Y=function(e){return e.slice().forEach((function(t){"function"==typeof t&&t(),L(e,t)}))};function v(e){for(var t=[],n=1;n{"use strict";n.d(t,{H:()=>o,u:()=>r});var o=function(e,t){return t.reduce((function(t,n){return t[n]=(o=e+"."+n+"()",function(){throw new Error("No implementation for "+o+". The framework specific code did not implement this method.")}),t;var o}),{})},r={$q:void 0,$injector:void 0}},"./node_modules/@uirouter/core/lib-esm/common/glob.js":(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var o=function(){function e(e){this.text=e,this.glob=e.split(".");var t=this.text.split(".").map((function(e){return"**"===e?"(?:|(?:\\.[^.]*)*)":"*"===e?"\\.[^.]*":"\\."+e})).join("");this.regexp=new RegExp("^"+t+"$")}return e.is=function(e){return!!/[!,*]+/.exec(e)},e.fromString=function(t){return e.is(t)?new e(t):null},e.prototype.matches=function(e){return this.regexp.test("."+e)},e}()},"./node_modules/@uirouter/core/lib-esm/common/hof.js":(e,t,n)=>{"use strict";n.d(t,{WA:()=>r,zG:()=>a,vg:()=>i,OH:()=>d,Qc:()=>u,ff:()=>m,xD:()=>l,or:()=>_,$6:()=>c,Yj:()=>h,is:()=>f,P0:()=>p,uj:()=>M});var o=function(){for(var e=0,t=0,n=arguments.length;t=e.length)return e.apply(this,arguments);var n=Array.prototype.slice.call(arguments);return t.bind.apply(t,o([this],n))}}function s(){var e=arguments,t=e.length-1;return function(){for(var n=t,o=e[t].apply(this,arguments);n--;)o=e[n].call(this,o);return o}}function a(){for(var e=[],t=0;t{"use strict";n.d(t,{o8:()=>a,$K:()=>i,Ft:()=>d,le:()=>u,mf:()=>m,hj:()=>l,HD:()=>_,Kn:()=>c,kJ:()=>h,J_:()=>f,Kj:()=>p,Qh:()=>M,tI:()=>y});var o=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),r=Object.prototype.toString,s=function(e){return function(t){return typeof t===e}},a=s("undefined"),i=(0,o.ff)(a),d=function(e){return null===e},u=(0,o.or)(d,a),m=s("function"),l=s("number"),_=s("string"),c=function(e){return null!==e&&"object"==typeof e},h=Array.isArray,f=function(e){return"[object Date]"===r.call(e)},p=function(e){return"[object RegExp]"===r.call(e)};function M(e){if(h(e)&&e.length){var t=e.slice(0,-1),n=e.slice(-1);return!(t.filter((0,o.ff)(_)).length||n.filter((0,o.ff)(m)).length)}return m(e)}var y=(0,o.xD)(c,(0,o.zG)((0,o.vg)("then"),m))},"./node_modules/@uirouter/core/lib-esm/common/queue.js":(e,t,n)=>{"use strict";n.d(t,{c:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=function(){function e(e,t){void 0===e&&(e=[]),void 0===t&&(t=null),this._items=e,this._limit=t,this._evictListeners=[],this.onEvict=(0,o.LH)(this._evictListeners)}return e.prototype.enqueue=function(e){var t=this._items;return t.push(e),this._limit&&t.length>this._limit&&this.evict(),e},e.prototype.evict=function(){var e=this._items.shift();return this._evictListeners.forEach((function(t){return t(e)})),e},e.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},e.prototype.clear=function(){var e=this._items;return this._items=[],e},e.prototype.size=function(){return this._items.length},e.prototype.remove=function(e){var t=this._items.indexOf(e);return t>-1&&this._items.splice(t,1)[0]},e.prototype.peekTail=function(){return this._items[this._items.length-1]},e.prototype.peekHead=function(){if(this.size())return this._items[0]},e}()},"./node_modules/@uirouter/core/lib-esm/common/safeConsole.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r={log:o.ZT,error:o.ZT,table:o.ZT},s="undefined"!=typeof document&&document.documentMode&&9===document.documentMode?window&&window.console?function(e){var t=function(t){return Function.prototype.bind.call(t,e)};return{log:t(e.log),error:t(e.log),table:t(e.log)}}(window.console):r:console.table&&console.error?console:function(e){var t=e.log.bind(e);return{log:t,error:e.error?e.error.bind(e):t,table:e.table?e.table.bind(e):t}}(console)},"./node_modules/@uirouter/core/lib-esm/common/strings.js":(e,t,n)=>{"use strict";n.d(t,{BS:()=>i,NE:()=>d,L$:()=>u,XF:()=>m,iC:()=>l,Pz:()=>h,Lb:()=>p,cW:()=>M,C7:()=>y,Fb:()=>L,HV:()=>g,PX:()=>Y,iV:()=>v});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js");function i(e,t){return t.length<=e?t:t.substr(0,e-3)+"..."}function d(e,t){for(;t.length{"use strict";n.d(t,{g4:()=>c});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/safeConsole.js");function d(e){if(!e)return"ui-view (defunct)";var t=e.creationContext?e.creationContext.name||"(root)":"(none)";return"[ui-view#"+e.id+" "+e.$type+":"+e.fqn+" ("+e.name+"@"+t+")]"}function u(e){return(0,s.hj)(e)?o[e]:o[o[e]]}!function(e){e[e.RESOLVE=0]="RESOLVE",e[e.TRANSITION=1]="TRANSITION",e[e.HOOK=2]="HOOK",e[e.UIVIEW=3]="UIVIEW",e[e.VIEWCONFIG=4]="VIEWCONFIG"}(o||(o={}));var m=(0,r.Qc)("$id"),l=(0,r.Qc)("router.$id"),_=function(e){return"Transition #"+m(e)+"-"+l(e)},c=new(function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,t){var n=this;t.length||(t=Object.keys(o).map((function(e){return parseInt(e,10)})).filter((function(e){return!isNaN(e)})).map((function(e){return o[e]}))),t.map(u).forEach((function(t){return n._enabled[t]=e}))},e.prototype.enable=function(){for(var e=[],t=0;t "+(0,a.Pz)(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(o.TRANSITION)&&i.L.log(_(e)+": Ignored <> "+(0,a.Pz)(e))},e.prototype.traceHookInvocation=function(e,t,n){if(this.enabled(o.HOOK)){var s=(0,r.Qc)("traceData.hookType")(n)||"internal",d=(0,r.Qc)("traceData.context.state.name")(n)||(0,r.Qc)("traceData.context")(n)||"unknown",u=(0,a.XF)(e.registeredHook.callback);i.L.log(_(t)+": Hook -> "+s+" context: "+d+", "+(0,a.BS)(200,u))}},e.prototype.traceHookResult=function(e,t,n){this.enabled(o.HOOK)&&i.L.log(_(t)+": <- Hook returned: "+(0,a.BS)(200,(0,a.Pz)(e)))},e.prototype.traceResolvePath=function(e,t,n){this.enabled(o.RESOLVE)&&i.L.log(_(n)+": Resolving "+e+" ("+t+")")},e.prototype.traceResolvableResolved=function(e,t){this.enabled(o.RESOLVE)&&i.L.log(_(t)+": <- Resolved "+e+" to: "+(0,a.BS)(200,(0,a.Pz)(e.data)))},e.prototype.traceError=function(e,t){this.enabled(o.TRANSITION)&&i.L.log(_(t)+": <- Rejected "+(0,a.Pz)(t)+", reason: "+e)},e.prototype.traceSuccess=function(e,t){this.enabled(o.TRANSITION)&&i.L.log(_(t)+": <- Success "+(0,a.Pz)(t)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,t,n){void 0===n&&(n=""),this.enabled(o.UIVIEW)&&i.L.log("ui-view: "+(0,a.NE)(30,e)+" "+d(t)+n)},e.prototype.traceUIViewConfigUpdated=function(e,t){this.enabled(o.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+t+"'")},e.prototype.traceUIViewFill=function(e,t){this.enabled(o.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+(0,a.BS)(200,t))},e.prototype.traceViewSync=function(e){if(this.enabled(o.VIEWCONFIG)){var t="uiview component fqn",n=e.map((function(e){var n,o=e.uiView,r=e.viewConfig,s=o&&o.fqn,a=r&&r.viewDecl.$context.name+": ("+r.viewDecl.$name+")";return(n={})[t]=s,n["view config state (view name)"]=a,n})).sort((function(e,n){return(e[t]||"").localeCompare(n[t]||"")}));i.L.table(n)}},e.prototype.traceViewServiceEvent=function(e,t){this.enabled(o.VIEWCONFIG)&&i.L.log("VIEWCONFIG: "+e+" "+function(e){var t=e.viewDecl,n=t.$context.name||"(root)";return"[View#"+e.$id+" from '"+n+"' state]: target ui-view: '"+t.$uiViewName+"@"+t.$uiViewContextAnchor+"'"}(t))},e.prototype.traceViewServiceUIViewEvent=function(e,t){this.enabled(o.VIEWCONFIG)&&i.L.log("VIEWCONFIG: "+e+" "+d(t))},e}())},"./node_modules/@uirouter/core/lib-esm/globals.js":(e,t,n)=>{"use strict";n.d(t,{k:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/params/stateParams.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/queue.js"),s=function(){function e(){this.params=new o.i,this.lastStartedTransitionId=-1,this.transitionHistory=new r.c([],1),this.successfulTransitions=new r.c([],1)}return e.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},e}()},"./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js":(e,t,n)=>{"use strict";n.d(t,{v:()=>s,A:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),r=function(e){var t=e.router,n=e.entering().filter((function(e){return!!e.$$state().lazyLoad})).map((function(t){return a(e,t)}));return o.u.$q.all(n).then((function(){if("url"!==e.originalTransition().options().source){var n=e.targetState();return t.stateService.target(n.identifier(),n.params(),n.options())}var o=t.urlService,r=o.match(o.parts()),s=r&&r.rule;if(s&&"STATE"===s.type){var a=s.state,i=r.match;return t.stateService.target(a,i,e.options())}t.urlService.sync()}))},s=function(e){return e.onBefore({entering:function(e){return!!e.lazyLoad}},r)};function a(e,t){var n=t.$$state().lazyLoad,r=n._promise;return r||(r=n._promise=o.u.$q.when(n(e,t)).then((function(t){return t&&Array.isArray(t.states)&&t.states.forEach((function(t){return e.router.stateRegistry.register(t)})),t})).then((function(e){return delete t.lazyLoad,delete t.$$state().lazyLoad,delete n._promise,e}),(function(e){return delete n._promise,o.u.$q.reject(e)}))),r}},"./node_modules/@uirouter/core/lib-esm/interface.js":(e,t,n)=>{},"./node_modules/@uirouter/core/lib-esm/params/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/params/param.js":(e,t,n)=>{"use strict";n.d(t,{_:()=>o,d:()=>m});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),d=n("./node_modules/@uirouter/core/lib-esm/params/paramType.js"),u=Object.prototype.hasOwnProperty;!function(e){e[e.PATH=0]="PATH",e[e.SEARCH=1]="SEARCH",e[e.CONFIG=2]="CONFIG"}(o||(o={}));var m=function(){function e(e,t,n,i,m){var l=function(e,t,n){var s=!1===n.reloadOnSearch&&t===o.SEARCH||void 0,i=(0,r.sE)([n.dynamic,s],a.$K),d=(0,a.$K)(i)?{dynamic:i}:{},m=function(e){function t(){return e.value}e=function(e){return 0===["value","type","squash","array","dynamic"].filter(u.bind(e||{})).length}(e)?{value:e}:e,t.__cacheable=!0;var n=(0,a.Qh)(e.value)?e.value:t;return(0,r.l7)(e,{$$fn:n})}(n&&n.params&&n.params[e]);return(0,r.l7)(d,m)}(e,n,m);t=function(e,t,n,r,s){if(e.type&&t&&"string"!==t.name)throw new Error("Param '"+r+"' has two type configurations.");if(e.type&&t&&"string"===t.name&&s.type(e.type))return s.type(e.type);if(t)return t;if(!e.type){var a=n===o.CONFIG?"any":n===o.PATH?"path":n===o.SEARCH?"query":"string";return s.type(a)}return e.type instanceof d._?e.type:s.type(e.type)}(l,t,n,e,i.paramTypes);var _,c,h=(_={array:n===o.SEARCH&&"auto"},c=e.match(/\[\]$/)?{array:!0}:{},(0,r.l7)(_,c,l).array);t=h?t.$asArray(h,n===o.SEARCH):t;var f=void 0!==l.value||n===o.SEARCH,p=(0,a.$K)(l.dynamic)?!!l.dynamic:!!t.dynamic,M=(0,a.$K)(l.raw)?!!l.raw:!!t.raw,y=function(e,t,n){var o=e.squash;if(!t||!1===o)return!1;if(!(0,a.$K)(o)||null==o)return n;if(!0===o||(0,a.HD)(o))return o;throw new Error("Invalid squash policy: '"+o+"'. Valid policies: false, true, or arbitrary string")}(l,f,i.defaultSquashPolicy()),L=function(e,t,n,o){var i=[{from:"",to:n||t?void 0:""},{from:null,to:n||t?void 0:""}],d=(0,a.kJ)(e.replace)?e.replace:[];(0,a.HD)(o)&&d.push({from:o,to:void 0});var u=(0,r.UI)(d,(0,s.vg)("from"));return(0,r.hX)(i,(function(e){return-1===u.indexOf(e.from)})).concat(d)}(l,h,f,y),g=(0,a.$K)(l.inherit)?!!l.inherit:!!t.inherit;(0,r.l7)(this,{id:e,type:t,location:n,isOptional:f,dynamic:p,raw:M,squash:y,replace:L,inherit:g,array:h,config:l})}return e.values=function(e,t){void 0===t&&(t={});for(var n={},o=0,r=e;o{"use strict";n.d(t,{_:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=function(){function e(e){this.pattern=/.*/,this.inherit=!0,(0,o.l7)(this,e)}return e.prototype.is=function(e,t){return!0},e.prototype.encode=function(e,t){return e},e.prototype.decode=function(e,t){return e},e.prototype.equals=function(e,t){return e==t},e.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},e.prototype.toString=function(){return"{ParamType:"+this.name+"}"},e.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},e.prototype.$asArray=function(e,t){if(!e)return this;if("auto"===e&&!t)throw new Error("'auto' array mode is for query parameters only");return new a(this,e)},e}();function a(e,t){var n=this;function s(e){return(0,r.kJ)(e)?e:(0,r.$K)(e)?[e]:[]}function a(e,n){return function(a){if((0,r.kJ)(a)&&0===a.length)return a;var i=s(a),d=(0,o.UI)(i,e);return!0===n?0===(0,o.hX)(d,(function(e){return!e})).length:function(e){switch(e.length){case 0:return;case 1:return"auto"===t?e[0]:e;default:return e}}(d)}}function i(e){return function(t,n){var o=s(t),r=s(n);if(o.length!==r.length)return!1;for(var a=0;a{"use strict";n.d(t,{p:()=>u});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),d=n("./node_modules/@uirouter/core/lib-esm/params/paramType.js"),u=function(){function e(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=(0,r.ei)(e.prototype,["hash","string","query","path","int","bool","date","json","any"]),this.types=(0,r.ED)((0,r.UI)(this.defaultTypes,(function(e,t){return new d._((0,r.l7)({name:t},e))})),{})}return e.prototype.dispose=function(){this.types={}},e.prototype.type=function(e,t,n){if(!(0,s.$K)(t))return this.types[e];if(this.types.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return this.types[e]=new d._((0,r.l7)({name:e},t)),n&&(this.typeQueue.push({name:e,def:n}),this.enqueue||this._flushTypeQueue()),this},e.prototype._flushTypeQueue=function(){for(;this.typeQueue.length;){var e=this.typeQueue.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");(0,r.l7)(this.types[e.name],i.u.$injector.invoke(e.def))}},e}();o=function(e){var t=function(e){return null!=e?e.toString():e},n={encode:t,decode:t,is:(0,a.is)(String),pattern:/.*/,equals:function(e,t){return e==t}};return(0,r.l7)({},n,e)},(0,r.l7)(u.prototype,{string:o({}),path:o({pattern:/[^/]*/}),query:o({}),hash:o({inherit:!1}),int:o({decode:function(e){return parseInt(e,10)},is:function(e){return!(0,s.le)(e)&&this.decode(e.toString())===e},pattern:/-?\d+/}),bool:o({encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:(0,a.is)(Boolean),pattern:/0|1/}),date:o({encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):void 0},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):void 0},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return["getFullYear","getMonth","getDate"].reduce((function(n,o){return n&&e[o]()===t[o]()}),!0)},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/}),json:o({encode:r.Qs,decode:r.xZ,is:(0,a.is)(Object),equals:r.fS,pattern:/[^/]*/}),any:o({encode:r.yR,decode:r.yR,is:function(){return!0},equals:r.fS})})},"./node_modules/@uirouter/core/lib-esm/params/stateParams.js":(e,t,n)=>{"use strict";n.d(t,{i:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=function(){function e(e){void 0===e&&(e={}),(0,o.l7)(this,e)}return e.prototype.$inherit=function(e,t,n){var r,s=(0,o.mX)(t,n),a={},i=[];for(var d in s)if(s[d]&&s[d].params&&(r=Object.keys(s[d].params)).length)for(var u in r)i.indexOf(r[u])>=0||(i.push(r[u]),a[r[u]]=this[r[u]]);return(0,o.l7)({},a,e)},e}()},"./node_modules/@uirouter/core/lib-esm/path/pathNode.js":(e,t,n)=>{"use strict";n.d(t,{V:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/params/param.js"),a=function(){function e(t){if(t instanceof e){var n=t;this.state=n.state,this.paramSchema=n.paramSchema.slice(),this.paramValues=(0,o.l7)({},n.paramValues),this.resolvables=n.resolvables.slice(),this.views=n.views&&n.views.slice()}else{var r=t;this.state=r,this.paramSchema=r.parameters({inherit:!1}),this.paramValues={},this.resolvables=r.resolvables.map((function(e){return e.clone()}))}}return e.prototype.clone=function(){return new e(this)},e.prototype.applyRawParams=function(e){return this.paramValues=this.paramSchema.reduce((function(t,n){return(0,o.bb)(t,[(r=n).id,r.value(e[r.id])]);var r}),{}),this},e.prototype.parameter=function(e){return(0,o.sE)(this.paramSchema,(0,r.OH)("id",e))},e.prototype.equals=function(e,t){var n=this.diff(e,t);return n&&0===n.length},e.prototype.diff=function(e,t){if(this.state!==e.state)return!1;var n=t?t(this):this.paramSchema;return s.d.changed(n,this.paramValues,e.paramValues)},e.clone=function(e){return e.clone()},e}()},"./node_modules/@uirouter/core/lib-esm/path/pathUtils.js":(e,t,n)=>{"use strict";n.d(t,{C:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),a=n("./node_modules/@uirouter/core/lib-esm/path/pathNode.js"),i=function(){function e(){}return e.makeTargetState=function(e,t){var n=(0,o.Gb)(t).state;return new s.F(e,n,t.map((0,r.vg)("paramValues")).reduce(o.LQ,{}),{})},e.buildPath=function(e){var t=e.params();return e.$state().path.map((function(e){return new a.V(e).applyRawParams(t)}))},e.buildToPath=function(t,n){var o=e.buildPath(n);return n.options().inherit?e.inheritParams(t,o,Object.keys(n.params())):o},e.applyViewConfigs=function(t,n,r){n.filter((function(e){return(0,o.d3)(r,e.state)})).forEach((function(r){var s=(0,o.VO)(r.state.views||{}),a=e.subPath(n,(function(e){return e===r})),i=s.map((function(e){return t.createViewConfig(a,e)}));r.views=i.reduce(o.M7,[])}))},e.inheritParams=function(e,t,n){void 0===n&&(n=[]);var s=e.map((function(e){return e.paramSchema})).reduce(o.M7,[]).filter((function(e){return!e.inherit})).map((0,r.vg)("id"));return t.map((function(t){var i=(0,o.l7)({},t&&t.paramValues),d=(0,o.ei)(i,n);i=(0,o.CE)(i,n);var u,m,l,_=(0,o.CE)((u=e,m=t.state,l=(0,o.sE)(u,(0,r.OH)("state",m)),(0,o.l7)({},l&&l.paramValues)||{}),s),c=(0,o.l7)(i,_,d);return new a.V(t.state).applyRawParams(c)}))},e.treeChanges=function(t,n,o){for(var r,s,a,i,d,u,m=Math.min(t.length,n.length),l=0;l{"use strict";n.d(t,{u:()=>o});var o={when:{LAZY:"LAZY",EAGER:"EAGER"},async:{WAIT:"WAIT",NOWAIT:"NOWAIT"}}},"./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js":(e,t,n)=>{"use strict";n.d(t,{X:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),d=function(){function e(t,n,s,a,d){if(this.resolved=!1,this.promise=void 0,t instanceof e)(0,o.l7)(this,t);else if((0,i.mf)(n)){if((0,i.le)(t))throw new Error("new Resolvable(): token argument is required");if(!(0,i.mf)(n))throw new Error("new Resolvable(): resolveFn argument must be a function");this.token=t,this.policy=a,this.resolveFn=n,this.deps=s||[],this.data=d,this.resolved=void 0!==d,this.promise=this.resolved?r.u.$q.when(this.data):void 0}else if((0,i.Kn)(t)&&t.token&&(t.hasOwnProperty("resolveFn")||t.hasOwnProperty("data"))){var u=t;return new e(u.token,u.resolveFn,u.deps,u.policy,u.data)}}return e.prototype.getPolicy=function(e){var t=this.policy||{},n=e&&e.resolvePolicy||{};return{when:t.when||n.when||"LAZY",async:t.async||n.async||"WAIT"}},e.prototype.resolve=function(e,t){var n=this,a=r.u.$q,d=e.findNode(this),u=d&&d.state,m=this.getPolicy(u).async,l=(0,i.mf)(m)?m:o.yR;return this.promise=a.when().then((function(){return a.all(e.getDependencies(n).map((function(n){return n.get(e,t)})))})).then((function(e){return n.resolveFn.apply(null,e)})).then(l).then((function(e){return n.data=e,n.resolved=!0,n.resolveFn=null,s.g4.traceResolvableResolved(n,t),n.data}))},e.prototype.get=function(e,t){return this.promise||this.resolve(e,t)},e.prototype.toString=function(){return"Resolvable(token: "+(0,a.Pz)(this.token)+", requires: ["+this.deps.map(a.Pz)+"])"},e.prototype.clone=function(){return new e(this)},e.fromData=function(t,n){return new e(t,(function(){return n}),null,null,n)},e}()},"./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js":(e,t,n)=>{"use strict";n.d(t,{l:()=>f});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/interface.js"),d=n("./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"),u=n("./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"),m=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),l=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),_=i.u.when,c=[_.EAGER,_.LAZY],h=[_.EAGER],f=function(){function e(e){this._path=e}return e.prototype.getTokens=function(){return this._path.reduce((function(e,t){return e.concat(t.resolvables.map((function(e){return e.token})))}),[]).reduce(o.v_,[])},e.prototype.getResolvable=function(e){var t=this._path.map((function(e){return e.resolvables})).reduce(o.M7,[]).filter((function(t){return t.token===e}));return(0,o.Gb)(t)},e.prototype.getPolicy=function(e){var t=this.findNode(e);return e.getPolicy(t.state)},e.prototype.subContext=function(t){return new e(u.C.subPath(this._path,(function(e){return e.state===t})))},e.prototype.addResolvables=function(e,t){var n=(0,o.sE)(this._path,(0,r.OH)("state",t)),s=e.map((function(e){return e.token}));n.resolvables=n.resolvables.filter((function(e){return-1===s.indexOf(e.token)})).concat(e)},e.prototype.resolvePath=function(e,t){var n=this;void 0===e&&(e="LAZY");var d=((0,o.d3)(c,e)?e:"LAZY")===i.u.when.EAGER?h:c;s.g4.traceResolvePath(this._path,e,t);var u=function(e,t){return function(r){return(0,o.d3)(e,n.getPolicy(r)[t])}},m=this._path.reduce((function(e,o){var s=o.resolvables.filter(u(d,"when")),a=s.filter(u(["NOWAIT"],"async")),i=s.filter((0,r.ff)(u(["NOWAIT"],"async"))),m=n.subContext(o.state),l=function(e){return e.get(m,t).then((function(t){return{token:e.token,value:t}}))};return a.forEach(l),e.concat(i.map(l))}),[]);return a.u.$q.all(m)},e.prototype.injector=function(){return this._injector||(this._injector=new p(this))},e.prototype.findNode=function(e){return(0,o.sE)(this._path,(function(t){return(0,o.d3)(t.resolvables,e)}))},e.prototype.getDependencies=function(e){var t=this,n=this.findNode(e),r=(u.C.subPath(this._path,(function(e){return e===n}))||this._path).reduce((function(e,t){return e.concat(t.resolvables)}),[]).filter((function(t){return t!==e}));return e.deps.map((function(e){var n=r.filter((function(t){return t.token===e}));if(n.length)return(0,o.Gb)(n);var s=t.injector().getNative(e);if((0,l.wV)(s))throw new Error("Could not find Dependency Injection token: "+(0,m.Pz)(e));return new d.X(e,(function(){return s}),[],s)}))},e}(),p=function(){function e(e){this.context=e,this.native=this.get("Native Injector")||a.u.$injector}return e.prototype.get=function(e){var t=this.context.getResolvable(e);if(t){if("NOWAIT"===this.context.getPolicy(t).async)return t.get(this.context);if(!t.resolved)throw new Error("Resolvable async .get() not complete:"+(0,m.Pz)(t.token));return t.data}return this.getNative(e)},e.prototype.getAsync=function(e){var t=this.context.getResolvable(e);return t?t.get(this.context):a.u.$q.when(this.native.get(e))},e.prototype.getNative=function(e){return this.native&&this.native.get(e)},e}()},"./node_modules/@uirouter/core/lib-esm/router.js":(e,t,n)=>{"use strict";n.d(t,{a:()=>y});var o=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"),a=n("./node_modules/@uirouter/core/lib-esm/view/view.js"),i=n("./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"),d=n("./node_modules/@uirouter/core/lib-esm/state/stateService.js"),u=n("./node_modules/@uirouter/core/lib-esm/globals.js"),m=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),l=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),_=n("./node_modules/@uirouter/core/lib-esm/url/urlService.js"),c=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),h=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),f=0,p=(0,h.HV)("LocationServices",["url","path","search","hash","onChange"]),M=(0,h.HV)("LocationConfig",["port","protocol","host","baseHref","html5Mode","hashPrefix"]),y=function(){function e(e,t){void 0===e&&(e=p),void 0===t&&(t=M),this.locationService=e,this.locationConfig=t,this.$id=f++,this._disposed=!1,this._disposables=[],this.trace=c.g4,this.viewService=new a.s(this),this.globals=new u.k,this.transitionService=new s.Z(this),this.urlMatcherFactory=new o.y(this),this.urlRouter=new r.g(this),this.urlService=new _.i(this),this.stateRegistry=new i.q(this),this.stateService=new d.b(this),this._plugins={},this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()),this.globals.$current=this.stateRegistry.root(),this.globals.current=this.globals.$current.self,this.disposable(this.globals),this.disposable(this.stateService),this.disposable(this.stateRegistry),this.disposable(this.transitionService),this.disposable(this.urlService),this.disposable(e),this.disposable(t)}return e.prototype.disposable=function(e){this._disposables.push(e)},e.prototype.dispose=function(e){var t=this;e&&(0,l.mf)(e.dispose)?e.dispose(this):(this._disposed=!0,this._disposables.slice().forEach((function(e){try{"function"==typeof e.dispose&&e.dispose(t),(0,m.nA)(t._disposables,e)}catch(e){}})))},e.prototype.plugin=function(e,t){void 0===t&&(t={});var n=new e(this,t);if(!n.name)throw new Error("Required property `name` missing on plugin: "+n);return this._disposables.push(n),this._plugins[n.name]=n},e.prototype.getPlugin=function(e){return e?this._plugins[e]:(0,m.VO)(this._plugins)},e}()},"./node_modules/@uirouter/core/lib-esm/state/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js":(e,t,n)=>{"use strict";n.d(t,{t:()=>M});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js");function u(e){return e.name}function m(e){return e.self.$$state=function(){return e},e.self}function l(e){return e.parent&&e.parent.data&&(e.data=e.self.data=(0,o.ED)(e.parent.data,e.data)),e.data}var _=function(e,t){return function(n){var s=n.self;if(s&&s.url&&s.name&&s.name.match(/\.\*\*$/)){var a={};(0,o.JG)(s,a),a.url+="{remainder:any}",s=a}var i=n.parent,d=function(e){if(!(0,r.HD)(e))return!1;var t="^"===e.charAt(0);return{val:t?e.substring(1):e,root:t}}(s.url),u=d?e.compile(d.val,{state:s}):s.url;if(!u)return null;if(!e.isMatcher(u))throw new Error("Invalid url '"+u+"' in state '"+n+"'");return d&&d.root?u:(i&&i.navigable||t()).url.append(u)}},c=function(e){return function(t){return!e(t)&&t.url?t:t.parent?t.parent.navigable:null}};function h(e){return e.parent?e.parent.path.concat(e):[e]}function f(e){var t=e.parent?(0,o.l7)({},e.parent.includes):{};return t[e.name]=!0,t}function p(e){var t,n,u=function(e){return e.provide||e.token},m=(0,a.uj)([[(0,a.vg)("resolveFn"),function(e){return new i.X(u(e),e.resolveFn,e.deps,e.policy)}],[(0,a.vg)("useFactory"),function(e){return new i.X(u(e),e.useFactory,e.deps||e.dependencies,e.policy)}],[(0,a.vg)("useClass"),function(e){return new i.X(u(e),(function(){return new e.useClass}),[],e.policy)}],[(0,a.vg)("useValue"),function(e){return new i.X(u(e),(function(){return e.useValue}),[],e.policy,e.useValue)}],[(0,a.vg)("useExisting"),function(e){return new i.X(u(e),o.yR,[e.useExisting],e.policy)}]]),l=(0,a.uj)([[(0,a.zG)((0,a.vg)("val"),r.HD),function(e){return new i.X(e.token,o.yR,[e.val],e.policy)}],[(0,a.zG)((0,a.vg)("val"),r.kJ),function(e){return new i.X(e.token,(0,o.Gb)(e.val),e.val.slice(0,-1),e.policy)}],[(0,a.zG)((0,a.vg)("val"),r.mf),function(e){return new i.X(e.token,e.val,(t=e.val,n=d.u.$injector,t.$inject||n&&n.annotate(t,n.strictDi)||"deferred"),e.policy);var t,n}]]),_=(0,a.uj)([[(0,a.is)(i.X),function(e){return e}],[function(e){return!(!e.token||!e.resolveFn)},m],[function(e){return!(!e.provide&&!e.token||!(e.useValue||e.useFactory||e.useExisting||e.useClass))},m],[function(e){return!!(e&&e.val&&((0,r.HD)(e.val)||(0,r.kJ)(e.val)||(0,r.mf)(e.val)))},l],[(0,a.P0)(!0),function(e){throw new Error("Invalid resolve value: "+(0,s.Pz)(e))}]]),c=e.resolve;return((0,r.kJ)(c)?c:(t=c,n=e.resolvePolicy||{},Object.keys(t||{}).map((function(e){return{token:e,val:t[e],deps:void 0,policy:n[e]}})))).map(_)}var M=function(){function e(e,t){this.matcher=e;var n,r=this,s=function(){return e.find("")},i=function(e){return""===e.name};this.builders={name:[u],self:[m],parent:[function(t){return i(t)?null:e.find(r.parentName(t))||s()}],data:[l],url:[_(t,s)],navigable:[c(i)],params:[(n=t.paramFactory,function(e){var t=e.url&&e.url.parameters({inherit:!1})||[],r=(0,o.VO)((0,o.js)((0,o.CE)(e.params||{},t.map((0,a.vg)("id"))),(function(t,o){return n.fromConfig(o,null,e.self)})));return t.concat(r).map((function(e){return[e.id,e]})).reduce(o.bb,{})})],views:[],path:[h],includes:[f],resolvables:[p]}}return e.prototype.builder=function(e,t){var n=this.builders,o=n[e]||[];return(0,r.HD)(e)&&!(0,r.$K)(t)?o.length>1?o:o[0]:(0,r.HD)(e)&&(0,r.mf)(t)?(n[e]=o,n[e].push(t),function(){return n[e].splice(n[e].indexOf(t,1))&&null}):void 0},e.prototype.build=function(e){var t=this.matcher,n=this.builders,r=this.parentName(e);if(r&&!t.find(r,void 0,!1))return null;for(var s in n)if(n.hasOwnProperty(s)){var a=n[s].reduce((function(e,t){return function(n){return t(n,e)}}),o.ZT);e[s]=a(e)}return e},e.prototype.parentName=function(e){var t=e.name||"",n=t.split(".");if("**"===n.pop()&&n.pop(),n.length){if(e.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name ("+t+")");return n.join(".")}return e.parent?(0,r.HD)(e.parent)?e.parent:e.parent.name:""},e.prototype.name=function(e){var t=e.name;if(-1!==t.indexOf(".")||!e.parent)return t;var n=(0,r.HD)(e.parent)?e.parent:e.parent.name;return n?n+"."+t:t},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js":(e,t,n)=>{"use strict";n.d(t,{Q:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"),a=function(){function e(e){this._states=e}return e.prototype.isRelative=function(e){return 0===(e=e||"").indexOf(".")||0===e.indexOf("^")},e.prototype.find=function(e,t,n){if(void 0===n&&(n=!0),e||""===e){var a=(0,o.HD)(e),i=a?e:e.name;this.isRelative(i)&&(i=this.resolvePath(i,t));var d=this._states[i];if(d&&(a||!(a||d!==e&&d.self!==e)))return d;if(a&&n){var u=(0,r.VO)(this._states).filter((function(e){return e.__stateObjectCache.nameGlob&&e.__stateObjectCache.nameGlob.matches(i)}));return u.length>1&&s.L.error("stateMatcher.find: Found multiple matches for "+i+" using glob: ",u.map((function(e){return e.name}))),u[0]}}},e.prototype.resolvePath=function(e,t){if(!t)throw new Error("No reference point given for path '"+e+"'");for(var n=this.find(t),o=e.split("."),r=o.length,s=0,a=n;s{"use strict";n.d(t,{l:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/glob.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=function(){function e(t){return e.create(t||{})}return e.create=function(t){t=e.isStateClass(t)?new t:t;var n=(0,o.ED)((0,o.ED)(t,e.prototype));return t.$$state=function(){return n},n.self=t,n.__stateObjectCache={nameGlob:s.r.fromString(n.name)},n},e.prototype.is=function(e){return this===e||this.self===e||this.fqn()===e},e.prototype.fqn=function(){if(!(this.parent&&this.parent instanceof this.constructor))return this.name;var e=this.parent.fqn();return e?e+"."+this.name:this.name},e.prototype.root=function(){return this.parent&&this.parent.root()||this},e.prototype.parameters=function(e){return((e=(0,o.ce)(e,{inherit:!0,matchingKeys:null})).inherit&&this.parent&&this.parent.parameters()||[]).concat((0,o.VO)(this.params)).filter((function(t){return!e.matchingKeys||e.matchingKeys.hasOwnProperty(t.id)}))},e.prototype.parameter=function(e,t){return void 0===t&&(t={}),this.url&&this.url.parameter(e,t)||(0,o.sE)((0,o.VO)(this.params),(0,r.OH)("id",e))||t.inherit&&this.parent&&this.parent.parameter(e)},e.prototype.toString=function(){return this.fqn()},e.isStateClass=function(e){return(0,a.mf)(e)&&!0===e.__uiRouterState},e.isStateDeclaration=function(e){return(0,a.mf)(e.$$state)},e.isState=function(e){return(0,a.Kn)(e.__stateObjectCache)},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/state/stateObject.js"),s=function(){function e(e,t,n,o){this.router=e,this.states=t,this.builder=n,this.listeners=o,this.queue=[]}return e.prototype.dispose=function(){this.queue=[]},e.prototype.register=function(e){var t=this.queue,n=r.l.create(e),s=n.name;if(!(0,o.HD)(s))throw new Error("State must have a valid name");if(this.states.hasOwnProperty(s)||(0,o.d3)(t.map((0,o.vg)("name")),s))throw new Error("State '"+s+"' is already defined");return t.push(n),this.flush(),n},e.prototype.flush=function(){for(var e=this,t=this,n=t.queue,o=t.states,r=t.builder,s=[],a=[],i={},d=function(t){return e.states.hasOwnProperty(t)&&e.states[t]},u=function(){s.length&&e.listeners.forEach((function(e){return e("registered",s.map((function(e){return e.self})))}))};n.length>0;){var m=n.shift(),l=m.name,_=r.build(m),c=a.indexOf(m);if(_){var h=d(l);if(h&&h.name===l)throw new Error("State '"+l+"' is already defined");var f=d(l+".**");f&&this.router.stateRegistry.deregister(f),o[l]=m,this.attachRoute(m),c>=0&&a.splice(c,1),s.push(m)}else{var p=i[l];if(i[l]=n.length,c>=0&&p===n.length)return n.push(m),u(),o;c<0&&a.push(m),n.push(m)}}return u(),o},e.prototype.attachRoute=function(e){if(!e.abstract&&e.url){var t=this.router.urlService.rules;t.rule(t.urlRuleFactory.create(e))}},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js":(e,t,n)=>{"use strict";n.d(t,{q:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"),r=n("./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"),s=n("./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),d=function(){function e(e){this.router=e,this.states={},this.listeners=[],this.matcher=new o.Q(this.states),this.builder=new r.t(this.matcher,e.urlMatcherFactory),this.stateQueue=new s.L(e,this.states,this.builder,this.listeners),this._registerRoot()}return e.prototype._registerRoot=function(){(this._root=this.stateQueue.register({name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0})).navigable=null},e.prototype.dispose=function(){var e=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach((function(t){return e.get(t)&&e.deregister(t)}))},e.prototype.onStatesChanged=function(e){return this.listeners.push(e),function(){(0,a.nA)(this.listeners)(e)}.bind(this)},e.prototype.root=function(){return this._root},e.prototype.register=function(e){return this.stateQueue.register(e)},e.prototype._deregisterTree=function(e){var t=this,n=this.get().map((function(e){return e.$$state()})),o=function(e){var t=n.filter((function(t){return-1!==e.indexOf(t.parent)}));return 0===t.length?t:t.concat(o(t))},r=o([e]),s=[e].concat(r).reverse();return s.forEach((function(e){var n=t.router.urlService.rules;n.rules().filter((0,i.OH)("state",e)).forEach((function(e){return n.removeRule(e)})),delete t.states[e.name]})),s},e.prototype.deregister=function(e){var t=this.get(e);if(!t)throw new Error("Can't deregister state; not found: "+e);var n=this._deregisterTree(t.$$state());return this.listeners.forEach((function(e){return e("deregistered",n.map((function(e){return e.self})))})),n},e.prototype.get=function(e,t){var n=this;if(0===arguments.length)return Object.keys(this.states).map((function(e){return n.states[e].self}));var o=this.matcher.find(e,t);return o&&o.self||null},e.prototype.decorator=function(e,t){return this.builder.builder(e,t)},e}()},"./node_modules/@uirouter/core/lib-esm/state/targetState.js":(e,t,n)=>{"use strict";n.d(t,{F:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),a=function(){function e(e,t,n,o){this._stateRegistry=e,this._identifier=t,this._identifier=t,this._params=(0,s.l7)({},n||{}),this._options=(0,s.l7)({},o||{}),this._definition=e.matcher.find(t,this._options.relative)}return e.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},e.prototype.identifier=function(){return this._identifier},e.prototype.params=function(){return this._params},e.prototype.$state=function(){return this._definition},e.prototype.state=function(){return this._definition&&this._definition.self},e.prototype.options=function(){return this._options},e.prototype.exists=function(){return!(!this._definition||!this._definition.self)},e.prototype.valid=function(){return!this.error()},e.prototype.error=function(){var e=this.options().relative;if(!this._definition&&e){var t=e.name?e.name:e;return"Could not resolve '"+this.name()+"' from state '"+t+"'"}return this._definition?this._definition.self?void 0:"State '"+this.name()+"' has an invalid definition":"No such state '"+this.name()+"'"},e.prototype.toString=function(){return"'"+this.name()+"'"+(0,r.Pz)(this.params())},e.prototype.withState=function(t){return new e(this._stateRegistry,t,this._params,this._options)},e.prototype.withParams=function(t,n){void 0===n&&(n=!1);var o=n?t:(0,s.l7)({},this._params,t);return new e(this._stateRegistry,this._identifier,o,this._options)},e.prototype.withOptions=function(t,n){void 0===n&&(n=!1);var o=n?t:(0,s.l7)({},this._options,t);return new e(this._stateRegistry,this._identifier,this._params,o)},e.isDef=function(e){return e&&e.state&&((0,o.HD)(e.state)||(0,o.Kn)(e.state)&&(0,o.HD)(e.state.name))},e}()},"./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js":(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),a=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),i=function(){function e(e){this.transition=e}return e.prototype.buildHooksForPhase=function(e){var t=this;return this.transition.router.transitionService._pluginapi._getEvents(e).map((function(e){return t.buildHooks(e)})).reduce(o.M7,[]).filter(o.yR)},e.prototype.buildHooks=function(e){var t=this.transition,n=t.treeChanges(),r=this.getMatchingHooks(e,n,t);if(!r)return[];var i,d={transition:t,current:t.options().current};return r.map((function(r){return r.matches(n,t)[e.criteriaMatchPath.name].map((function(n){var i=(0,o.l7)({bind:r.bind,traceData:{hookType:e.name,context:n}},d),u=e.criteriaMatchPath.scope===s.c.STATE?n.state.self:null,m=new a.I(t,u,r,i);return{hook:r,node:n,transitionHook:m}}))})).reduce(o.M7,[]).sort((i=e.reverseSort,void 0===i&&(i=!1),function(e,t){var n=i?-1:1,o=(e.node.state.path.length-t.node.state.path.length)*n;return 0!==o?o:t.hook.priority-e.hook.priority})).map((function(e){return e.transitionHook}))},e.prototype.getMatchingHooks=function(e,t,n){var a=e.hookPhase===s.k.CREATE,i=this.transition.router.transitionService;return(a?[i]:[this.transition,i]).map((function(t){return t.getHooks(e.name)})).filter((0,o.sp)(r.kJ,"broken event named: "+e.name)).reduce(o.M7,[]).filter((function(e){return e.matches(t,n)}))},e}()},"./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js":(e,t,n)=>{"use strict";n.d(t,{cN:()=>s,BU:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js");function s(e,t,n){var r=(0,o.HD)(t)?[t]:t;return!!((0,o.mf)(r)?r:function(e){for(var t=r,n=0;n{"use strict";var o,r;n.d(t,{k:()=>o,c:()=>r}),function(e){e[e.CREATE=0]="CREATE",e[e.BEFORE=1]="BEFORE",e[e.RUN=2]="RUN",e[e.SUCCESS=3]="SUCCESS",e[e.ERROR=4]="ERROR"}(o||(o={})),function(e){e[e.TRANSITION=0]="TRANSITION",e[e.STATE=1]="STATE"}(r||(r={}))},"./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js":(e,t,n)=>{"use strict";n.d(t,{K:()=>o,i:()=>d});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js");!function(e){e[e.SUPERSEDED=2]="SUPERSEDED",e[e.ABORTED=3]="ABORTED",e[e.INVALID=4]="INVALID",e[e.IGNORED=5]="IGNORED",e[e.ERROR=6]="ERROR"}(o||(o={}));var i=0,d=function(){function e(e,t,n){this.$id=i++,this.type=e,this.message=t,this.detail=n}return e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&(0,a.is)(e)(t._transitionRejection)},e.superseded=function(t,n){var r=new e(o.SUPERSEDED,"The transition has been superseded by a different transition",t);return n&&n.redirected&&(r.redirected=!0),r},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(t){return new e(o.INVALID,"This transition is invalid",t)},e.ignored=function(t){return new e(o.IGNORED,"The transition was ignored",t)},e.aborted=function(t){return new e(o.ABORTED,"The transition has been aborted",t)},e.errored=function(t){return new e(o.ERROR,"The transition errored",t)},e.normalize=function(t){return(0,a.is)(e)(t)?t:e.errored(t)},e.prototype.toString=function(){var e,t=(e=this.detail)&&e.toString!==Object.prototype.toString?e.toString():(0,s.Pz)(e),n=this;return"Transition Rejection($id: "+n.$id+" type: "+n.type+", message: "+n.message+", detail: "+t+")"},e.prototype.toPromise=function(){return(0,r.l7)((0,r.jv)(this),{_transitionRejection:this})},e}()},"./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js":(e,t,n)=>{"use strict";n.d(t,{t:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),r=function(e,t,n,r,s,a,i,d){void 0===s&&(s=!1),void 0===a&&(a=o.I.HANDLE_RESULT),void 0===i&&(i=o.I.REJECT_ERROR),void 0===d&&(d=!1),this.name=e,this.hookPhase=t,this.hookOrder=n,this.criteriaMatchPath=r,this.reverseSort=s,this.getResultHandler=a,this.getErrorHandler=i,this.synchronous=d}},"./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>c});var o=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),u=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),m=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"),l=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),_={current:r.ZT,transition:null,traceData:{},bind:null},c=function(){function e(e,t,n,s){var a=this;this.transition=e,this.stateContext=t,this.registeredHook=n,this.options=s,this.isSuperseded=function(){return a.type.hookPhase===o.k.RUN&&!a.options.transition.isActive()},this.options=(0,r.ce)(s,_),this.type=n.eventType}return e.chain=function(e,t){return e.reduce((function(e,t){return e.then((function(){return t.invokeHook()}))}),t||u.u.$q.when())},e.invokeHooks=function(t,n){for(var o=0;o=t.invokeLimit&&t.deregister()}}},e.prototype.handleHookResult=function(e){var t=this;return this.getNotCurrentRejection()||((0,a.tI)(e)?e.then((function(e){return t.handleHookResult(e)})):(d.g4.traceHookResult(e,this.transition,this.options),!1===e?m.i.aborted("Hook aborted transition").toPromise():(0,i.is)(l.F)(e)?m.i.redirected(e).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var e=this.transition.router;return e._disposed?m.i.aborted("UIRouter instance #"+e.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?m.i.aborted().toPromise():this.isSuperseded()?m.i.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var e=this.options,t=this.registeredHook,n=(0,i.Qc)("traceData.hookType")(e)||"internal",o=(0,i.Qc)("traceData.context.state.name")(e)||(0,i.Qc)("traceData.context")(e)||"unknown",r=(0,s.iC)(t.callback);return n+" context: "+o+", "+(0,s.BS)(200,r)},e.HANDLE_RESULT=function(e){return function(t){return e.handleHookResult(t)}},e.LOG_REJECTED_RESULT=function(e){return function(t){(0,a.tI)(t)&&t.catch((function(t){return e.logError(m.i.normalize(t))}))}},e.LOG_ERROR=function(e){return function(t){return e.logError(t)}},e.REJECT_ERROR=function(e){return function(e){return(0,r.jv)(e)}},e.THROW_ERROR=function(e){return function(e){throw e}},e}()},"./node_modules/@uirouter/core/lib-esm/transition/transitionService.js":(e,t,n)=>{"use strict";n.d(t,{Z:()=>C,q:()=>W});var o=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/transition.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"),a=n("./node_modules/@uirouter/core/lib-esm/router.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/index.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/index.js");function u(e){e.addResolvable(i.XU.fromData(a.a,e.router),""),e.addResolvable(i.XU.fromData(r.u,e),""),e.addResolvable(i.XU.fromData("$transition$",e),""),e.addResolvable(i.XU.fromData("$stateParams",e.params()),""),e.entering().forEach((function(t){e.addResolvable(i.XU.fromData("$state$",t),t)}))}var m=["$transition$",r.u],l=(0,d.d3)(m),_=function(e){var t=(0,d.VO)(e.treeChanges()).reduce(d.M7,[]).reduce(d.v_,[]),n=function(e){return l(e.token)?i.XU.fromData(e.token,null):e};t.forEach((function(e){e.resolvables=e.resolvables.map(n)}))},c=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),h=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),f=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),p=function(e){var t=e.to().redirectTo;if(t){var n=e.router.stateService;return(0,c.mf)(t)?h.u.$q.when(t(e)).then(o):o(t)}function o(t){if(t)return t instanceof f.F?t:(0,c.HD)(t)?n.target(t,e.params(),e.options()):t.state||t.params?n.target(t.state||e.to(),t.params||e.params(),e.options()):void 0}};function M(e){return function(t,n){return(0,n.$$state()[e])(t,n)}}var y=M("onExit"),L=M("onRetain"),g=M("onEnter"),Y=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),v=n("./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"),j=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),k=1e3,w=function(e){return new v.l(e.treeChanges().to).resolvePath("EAGER",e).then(Y.ZT)},b=function(e,t){return new v.l(e.treeChanges().to).subContext(t.$$state()).resolvePath("LAZY",e).then(Y.ZT)},D=function(e){return new v.l(e.treeChanges().to).resolvePath("LAZY",e).then(Y.ZT)},T=function(e){var t=h.u.$q,n=e.views("entering");if(n.length)return t.all(n.map((function(e){return t.when(e.load())}))).then(Y.ZT)},S=function(e){var t=e.views("entering"),n=e.views("exiting");if(t.length||n.length){var o=e.router.viewService;n.forEach((function(e){return o.deactivateViewConfig(e)})),t.forEach((function(e){return o.activateViewConfig(e)})),o.sync()}},H=function(e){var t=e.router.globals,n=function(){t.transition===e&&(t.transition=null)};e.onSuccess({},(function(){t.successfulTransitions.enqueue(e),t.$current=e.$to(),t.current=t.$current.self,(0,Y.JG)(e.params(),t.params)}),{priority:1e4}),e.promise.then(n,n)},x=function(e){var t=e.options(),n=e.router.stateService,o=e.router.urlRouter;if("url"!==t.source&&t.location&&n.$current.navigable){var r={replace:"replace"===t.location};o.push(n.$current.navigable.url,n.params,r)}o.update(!0)},E=n("./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"),P=n("./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"),O=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),A=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),$=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js");function R(e){var t=e._ignoredReason();if(t){A.g4.traceTransitionIgnored(e);var n=e.router.globals.transition;return"SameAsCurrent"===t&&n&&n.abort(),$.i.ignored().toPromise()}}function F(e){if(!e.valid())throw new Error(e.error().toString())}var W={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,supercede:!0,custom:{},current:function(){return null},source:"unknown"},C=function(){function e(e){this._transitionCount=0,this._eventTypes=[],this._registeredHooks={},this._criteriaPaths={},this._router=e,this.$view=e.viewService,this._deregisterHookFns={},this._pluginapi=(0,Y.WR)((0,j.P0)(this),{},(0,j.P0)(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks(),e.globals.successfulTransitions.onEvict(_)}return e.prototype.onCreate=function(e,t,n){},e.prototype.onBefore=function(e,t,n){},e.prototype.onStart=function(e,t,n){},e.prototype.onExit=function(e,t,n){},e.prototype.onRetain=function(e,t,n){},e.prototype.onEnter=function(e,t,n){},e.prototype.onFinish=function(e,t,n){},e.prototype.onSuccess=function(e,t,n){},e.prototype.onError=function(e,t,n){},e.prototype.dispose=function(e){(0,Y.VO)(this._registeredHooks).forEach((function(e){return e.forEach((function(t){t._deregistered=!0,(0,Y.nA)(e,t)}))}))},e.prototype.create=function(e,t){return new r.u(e,t,this._router)},e.prototype._defineCoreEvents=function(){var e=o.k,t=O.I,n=this._criteriaPaths,r=!1,s=!0;this._defineEvent("onCreate",e.CREATE,0,n.to,r,t.LOG_REJECTED_RESULT,t.THROW_ERROR,s),this._defineEvent("onBefore",e.BEFORE,0,n.to),this._defineEvent("onStart",e.RUN,0,n.to),this._defineEvent("onExit",e.RUN,100,n.exiting,!0),this._defineEvent("onRetain",e.RUN,200,n.retained),this._defineEvent("onEnter",e.RUN,300,n.entering),this._defineEvent("onFinish",e.RUN,400,n.to),this._defineEvent("onSuccess",e.SUCCESS,0,n.to,r,t.LOG_REJECTED_RESULT,t.LOG_ERROR,s),this._defineEvent("onError",e.ERROR,0,n.to,r,t.LOG_REJECTED_RESULT,t.LOG_ERROR,s)},e.prototype._defineCorePaths=function(){var e=o.c.STATE,t=o.c.TRANSITION;this._definePathType("to",t),this._definePathType("from",t),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(e,t,n,o,r,a,i,d){void 0===r&&(r=!1),void 0===a&&(a=O.I.HANDLE_RESULT),void 0===i&&(i=O.I.REJECT_ERROR),void 0===d&&(d=!1);var u=new P.t(e,t,n,o,r,a,i,d);this._eventTypes.push(u),(0,s.BU)(this,this,u)},e.prototype._getEvents=function(e){return((0,c.$K)(e)?this._eventTypes.filter((function(t){return t.hookPhase===e})):this._eventTypes.slice()).sort((function(e,t){var n=e.hookPhase-t.hookPhase;return 0===n?e.hookOrder-t.hookOrder:n}))},e.prototype._definePathType=function(e,t){this._criteriaPaths[e]={name:e,scope:t}},e.prototype._getPathTypes=function(){return this._criteriaPaths},e.prototype.getHooks=function(e){return this._registeredHooks[e]},e.prototype._registerCoreTransitionHooks=function(){var e=this._deregisterHookFns;e.addCoreResolves=this.onCreate({},u),e.ignored=this.onBefore({},R,{priority:-9999}),e.invalid=function(e){return e.onBefore({},F,{priority:-1e4})}(this),e.redirectTo=function(e){return e.onStart({to:function(e){return!!e.redirectTo}},p)}(this),e.onExit=function(e){return e.onExit({exiting:function(e){return!!e.onExit}},y)}(this),e.onRetain=function(e){return e.onRetain({retained:function(e){return!!e.onRetain}},L)}(this),e.onEnter=function(e){return e.onEnter({entering:function(e){return!!e.onEnter}},g)}(this),e.eagerResolve=function(e){return e.onStart({},w,{priority:k})}(this),e.lazyResolve=function(e){return e.onEnter({entering:(0,j.P0)(!0)},b,{priority:k})}(this),e.resolveAll=function(e){return e.onFinish({},D,{priority:k})}(this),e.loadViews=function(e){return e.onFinish({},T)}(this),e.activateViews=function(e){return e.onSuccess({},S)}(this),e.updateGlobals=function(e){return e.onCreate({},H)}(this),e.updateUrl=function(e){return e.onSuccess({},x,{priority:9999})}(this),e.lazyLoad=(0,E.v)(this)},e}()},"./node_modules/@uirouter/core/lib-esm/url/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/url/urlConfig.js":(e,t,n)=>{"use strict";n.d(t,{F:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/params/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),s=function(){function e(e){var t=this;this.router=e,this.paramTypes=new o.ParamTypes,this._decodeParams=!0,this._isCaseInsensitive=!1,this._isStrictMode=!0,this._defaultSquashPolicy=!1,this.dispose=function(){return t.paramTypes.dispose()},this.baseHref=function(){return t.router.locationConfig.baseHref()},this.hashPrefix=function(e){return t.router.locationConfig.hashPrefix(e)},this.host=function(){return t.router.locationConfig.host()},this.html5Mode=function(){return t.router.locationConfig.html5Mode()},this.port=function(){return t.router.locationConfig.port()},this.protocol=function(){return t.router.locationConfig.protocol()}}return e.prototype.caseInsensitive=function(e){return this._isCaseInsensitive=(0,r.$K)(e)?e:this._isCaseInsensitive},e.prototype.defaultSquashPolicy=function(e){if((0,r.$K)(e)&&!0!==e&&!1!==e&&!(0,r.HD)(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return this._defaultSquashPolicy=(0,r.$K)(e)?e:this._defaultSquashPolicy},e.prototype.strictMode=function(e){return this._isStrictMode=(0,r.$K)(e)?e:this._isStrictMode},e.prototype.type=function(e,t,n){var o=this.paramTypes.type(e,t,n);return(0,r.$K)(t)?this:o},e}()},"./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js":(e,t,n)=>{"use strict";n.d(t,{y:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),s=n("./node_modules/@uirouter/core/lib-esm/params/index.js"),a=function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n{"use strict";n.d(t,{g:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRule.js"),s=function(){function e(e){var t=this;this.router=e,this.sync=function(e){return t.router.urlService.sync(e)},this.listen=function(e){return t.router.urlService.listen(e)},this.deferIntercept=function(e){return t.router.urlService.deferIntercept(e)},this.match=function(e){return t.router.urlService.match(e)},this.initial=function(e){return t.router.urlService.rules.initial(e)},this.otherwise=function(e){return t.router.urlService.rules.otherwise(e)},this.removeRule=function(e){return t.router.urlService.rules.removeRule(e)},this.rule=function(e){return t.router.urlService.rules.rule(e)},this.rules=function(){return t.router.urlService.rules.rules()},this.sort=function(e){return t.router.urlService.rules.sort(e)},this.when=function(e,n,o){return t.router.urlService.rules.when(e,n,o)},this.urlRuleFactory=new r.I(e)}return e.prototype.update=function(e){var t=this.router.locationService;e?this.location=t.url():t.url()!==this.location&&t.url(this.location,!0)},e.prototype.push=function(e,t,n){var o=n&&!!n.replace;this.router.urlService.url(e.format(t||{}),o)},e.prototype.href=function(e,t,n){var r=e.format(t);if(null==r)return null;n=n||{absolute:!1};var s=this.router.urlService.config,a=s.html5Mode();if(a||null===r||(r="#"+s.hashPrefix()+r),r=function(e,t,n,r){return"/"===r?e:t?(0,o.Lb)(r)+e:n?r.slice(1)+e:e}(r,a,n.absolute,s.baseHref()),!n.absolute||!r)return r;var i=!a&&r?"/":"",d=s.port(),u=80===d||443===d?"":":"+d;return[s.protocol(),"://",s.host(),u,i,r].join("")},Object.defineProperty(e.prototype,"interceptDeferred",{get:function(){return this.router.urlService.interceptDeferred},enumerable:!1,configurable:!0}),e}()},"./node_modules/@uirouter/core/lib-esm/url/urlRule.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>d,n:()=>u});var o=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/state/stateObject.js"),d=function(){function e(e){this.router=e}return e.prototype.compile=function(e){return this.router.urlMatcherFactory.compile(e)},e.prototype.create=function(e,t){var n=this,s=i.l.isState,d=i.l.isStateDeclaration,m=(0,a.uj)([[r.HD,function(e){return m(n.compile(e))}],[(0,a.is)(o.x),function(e){return n.fromUrlMatcher(e,t)}],[(0,a.or)(s,d),function(e){return n.fromState(e,n.router)}],[(0,a.is)(RegExp),function(e){return n.fromRegExp(e,t)}],[r.mf,function(e){return new u(e,t)}]]),l=m(e);if(!l)throw new Error("invalid 'what' in when()");return l},e.prototype.fromUrlMatcher=function(e,t){var n=t;(0,r.HD)(t)&&(t=this.router.urlMatcherFactory.compile(t)),(0,a.is)(o.x)(t)&&(n=function(e){return t.format(e)});var i={urlMatcher:e,matchPriority:function(t){var n=e.parameters().filter((function(e){return e.isOptional}));return n.length?n.filter((function(e){return t[e.id]})).length/n.length:1e-6},type:"URLMATCHER"};return(0,s.l7)(new u((function(t){var n=e.exec(t.path,t.search,t.hash);return e.validates(n)&&n}),n),i)},e.prototype.fromState=function(e,t){var n=i.l.isStateDeclaration(e)?e.$$state():e,o={state:n,type:"STATE"};return(0,s.l7)(this.fromUrlMatcher(n.url,(function(e){var o=t.stateService,r=t.globals;o.href(n,e)!==o.href(r.current,r.params)&&o.transitionTo(n,e,{inherit:!0,source:"url"})})),o)},e.prototype.fromRegExp=function(e,t){if(e.global||e.sticky)throw new Error("Rule RegExp must not be global or sticky");var n=(0,r.HD)(t)?function(e){return t.replace(/\$(\$|\d{1,2})/,(function(t,n){return e["$"===n?0:Number(n)]}))}:t,o={regexp:e,type:"REGEXP"};return(0,s.l7)(new u((function(t){return e.exec(t.path)}),n),o)},e.isUrlRule=function(e){return e&&["type","match","handler"].every((function(t){return(0,r.$K)(e[t])}))},e}(),u=function(e,t){var n=this;this.match=e,this.type="RAW",this.matchPriority=function(e){return 0-n.$id},this.handler=t||s.yR}},"./node_modules/@uirouter/core/lib-esm/url/urlRules.js":(e,t,n)=>{"use strict";n.d(t,{h:()=>u});var o,r=n("./node_modules/@uirouter/core/lib-esm/state/index.js"),s=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),i=n("./node_modules/@uirouter/core/lib-esm/url/urlRule.js");function d(e){if(!((0,a.mf)(e)||(0,a.HD)(e)||(0,a.is)(r.TargetState)(e)||r.TargetState.isDef(e)))throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property");return(0,a.mf)(e)?e:(0,a.P0)(e)}o=function(e,t){var n=function(e,t){return(t.priority||0)-(e.priority||0)}(e,t);return 0!==n||0!==(n=function(e,t){var n={STATE:4,URLMATCHER:4,REGEXP:3,RAW:2,OTHER:1};return(n[e.type]||0)-(n[t.type]||0)}(e,t))||0!==(n=function(e,t){return e.urlMatcher&&t.urlMatcher?s.x.compare(e.urlMatcher,t.urlMatcher):0}(e,t))?n:function(e,t){var n={STATE:!0,URLMATCHER:!0};return n[e.type]&&n[t.type]?0:(e.$id||0)-(t.$id||0)}(e,t)};var u=function(){function e(e){this.router=e,this._sortFn=o,this._rules=[],this._id=0,this.urlRuleFactory=new i.I(e)}return e.prototype.dispose=function(e){this._rules=[],delete this._otherwiseFn},e.prototype.initial=function(e){var t=d(e);this.rule(this.urlRuleFactory.create((function(e,t){return 0===t.globals.transitionHistory.size()&&!!/^\/?$/.exec(e.path)}),t))},e.prototype.otherwise=function(e){var t=d(e);this._otherwiseFn=this.urlRuleFactory.create((0,a.P0)(!0),t),this._sorted=!1},e.prototype.removeRule=function(e){(0,a.nA)(this._rules,e)},e.prototype.rule=function(e){var t=this;if(!i.I.isUrlRule(e))throw new Error("invalid rule");return e.$id=this._id++,e.priority=e.priority||0,this._rules.push(e),this._sorted=!1,function(){return t.removeRule(e)}},e.prototype.rules=function(){return this.ensureSorted(),this._rules.concat(this._otherwiseFn?[this._otherwiseFn]:[])},e.prototype.sort=function(e){for(var t=this.stableSort(this._rules,this._sortFn=e||this._sortFn),n=0,o=0;o{"use strict";n.d(t,{i:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRules.js"),s=n("./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"),a=n("./node_modules/@uirouter/core/lib-esm/state/index.js"),i=function(){function e(e){var t=this;this.router=e,this.interceptDeferred=!1,this.rules=new r.h(this.router),this.config=new s.F(this.router),this.url=function(e,n,o){return t.router.locationService.url(e,n,o)},this.path=function(){return t.router.locationService.path()},this.search=function(){return t.router.locationService.search()},this.hash=function(){return t.router.locationService.hash()},this.onChange=function(e){return t.router.locationService.onChange(e)}}return e.prototype.dispose=function(){this.listen(!1),this.rules.dispose()},e.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},e.prototype.sync=function(e){if(!e||!e.defaultPrevented){var t=this.router,n=t.urlService,r=t.stateService,s={path:n.path(),search:n.search(),hash:n.hash()},i=this.match(s);(0,o.uj)([[o.HD,function(e){return n.url(e,!0)}],[a.TargetState.isDef,function(e){return r.go(e.state,e.params,e.options)}],[(0,o.is)(a.TargetState),function(e){return r.go(e.state(),e.params(),e.options())}]])(i&&i.rule.handler(i.match,s,this.router))}},e.prototype.listen=function(e){var t=this;if(!1!==e)return this._stopListeningFn=this._stopListeningFn||this.router.urlService.onChange((function(e){return t.sync(e)}));this._stopListeningFn&&this._stopListeningFn(),delete this._stopListeningFn},e.prototype.deferIntercept=function(e){void 0===e&&(e=!0),this.interceptDeferred=e},e.prototype.match=function(e){e=(0,o.l7)({path:"",search:{},hash:""},e);for(var t,n,r,s=this.rules.rules(),a=0;at.weight?i:t}return t},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla.js":(e,t,n)=>{"use strict";n.d(t,{$q:()=>o.$q});var o=n("./node_modules/@uirouter/core/lib-esm/vanilla/index.js")},"./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js":(e,t,n)=>{"use strict";n.d(t,{U:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"),s=function(){function e(e,t){var n=this;this.fireAfterUpdate=t,this._listeners=[],this._listener=function(e){return n._listeners.forEach((function(t){return t(e)}))},this.hash=function(){return(0,r.en)(n._get()).hash},this.path=function(){return(0,r.en)(n._get()).path},this.search=function(){return(0,r.Qf)((0,r.en)(n._get()).search)},this._location=o.Jz.location,this._history=o.Jz.history}return e.prototype.url=function(e,t){return void 0===t&&(t=!0),(0,o.$K)(e)&&e!==this._get()&&(this._set(null,null,e,t),this.fireAfterUpdate&&this._listeners.forEach((function(t){return t({url:e})}))),(0,r.Q2)(this)},e.prototype.onChange=function(e){var t=this;return this._listeners.push(e),function(){return(0,o.nA)(t._listeners,e)}},e.prototype.dispose=function(e){(0,o.Wk)(this._listeners)},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js":(e,t,n)=>{"use strict";n.d(t,{u:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=function(){function e(e,t){void 0===t&&(t=!1),this._isHtml5=t,this._baseHref=void 0,this._hashPrefix=""}return e.prototype.port=function(){return location.port?Number(location.port):"https"===this.protocol()?443:80},e.prototype.protocol=function(){return location.protocol.replace(/:/g,"")},e.prototype.host=function(){return location.hostname},e.prototype.html5Mode=function(){return this._isHtml5},e.prototype.hashPrefix=function(e){return(0,o.$K)(e)?this._hashPrefix=e:this._hashPrefix},e.prototype.baseHref=function(e){return(0,o.$K)(e)&&(this._baseHref=e),(0,o.o8)(this._baseHref)&&(this._baseHref=this.getBaseHref()),this._baseHref},e.prototype.getBaseHref=function(){var e=document.getElementsByTagName("base")[0];return e&&e.href?e.href.replace(/^([^/:]*:)?\/\/[^/]*/,""):this._isHtml5?"/":location.pathname||"/"},e.prototype.dispose=function(){},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js":(e,t,n)=>{"use strict";n.d(t,{R:()=>i});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),s=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),a=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t){var n=e.call(this,t,!1)||this;return r.Jz.addEventListener("hashchange",n._listener,!1),n}return a(t,e),t.prototype._get=function(){return(0,r.Ld)(this._location.hash)},t.prototype._set=function(e,t,n,o){this._location.hash=n},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),r.Jz.removeEventListener("hashchange",this._listener)},t}(s.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/injector.js":(e,t,n)=>{"use strict";n("./node_modules/@uirouter/core/lib-esm/common/index.js")},"./node_modules/@uirouter/core/lib-esm/vanilla/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js":(e,t,n)=>{"use strict";n.d(t,{W:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=function(){var e=this;this.dispose=r.ZT,this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return e._port},this.protocol=function(){return e._protocol},this.host=function(){return e._host},this.baseHref=function(){return e._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(t){return(0,o.$K)(t)?e._hashPrefix=t:e._hashPrefix}}},"./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>a});var o,r=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),s=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(e){function t(t){return e.call(this,t,!0)||this}return s(t,e),t.prototype._get=function(){return this._url},t.prototype._set=function(e,t,n,o){this._url=n},t}(r.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js":(e,t,n)=>{"use strict";var o=n("./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"),r=n("./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"),s=n("./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"),a=n("./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"),i=n("./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"),d=n("./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js");n("./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"),n("./node_modules/@uirouter/core/lib-esm/vanilla/q.js"),n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),(0,s._D)("vanilla.hashBangLocation",!1,r.R,o.u),(0,s._D)("vanilla.pushStateLocation",!0,a.h,o.u),(0,s._D)("vanilla.memoryLocation",!1,i.I,d.W)},"./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js":(e,t,n)=>{"use strict";n.d(t,{h:()=>i});var o,r=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),a=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t){var n=e.call(this,t,!0)||this;return n._config=t.urlService.config,s.Jz.addEventListener("popstate",n._listener,!1),n}return a(t,e),t.prototype._getBasePrefix=function(){return(0,s.Lb)(this._config.baseHref())},t.prototype._get=function(){var e=this._location,t=e.pathname,n=e.hash,o=e.search;o=(0,s.C7)(o)[1],n=(0,s.cW)(n)[1];var r=this._getBasePrefix(),a=t===this._config.baseHref(),i=t.substr(0,r.length)===r;return(t=a?"/":i?t.substring(r.length):t)+(o?"?"+o:"")+(n?"#"+n:"")},t.prototype._set=function(e,t,n,o){var r=this._getBasePrefix(),s=n&&"/"!==n[0]?"/":"",a=""===n||"/"===n?this._config.baseHref():r+s+n;o?this._history.replaceState(e,t,a):this._history.pushState(e,t,a)},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),s.Jz.removeEventListener("popstate",this._listener)},t}(r.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/q.js":(e,t,n)=>{"use strict";n.d(t,{$q:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r={when:function(e){return new Promise((function(t,n){return t(e)}))},reject:function(e){return new Promise((function(t,n){n(e)}))},defer:function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},all:function(e){if((0,o.kJ)(e))return Promise.all(e);if((0,o.Kn)(e)){var t=Object.keys(e).map((function(t){return e[t].then((function(e){return{key:t,val:e}}))}));return r.all(t).then((function(e){return e.reduce((function(e,t){return e[t.key]=t.val,e}),{})}))}}}},"./node_modules/@uirouter/core/lib-esm/vanilla/utils.js":(e,t,n)=>{"use strict";n.d(t,{Qf:()=>s,en:()=>a,Q2:()=>i,_D:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=function(e,t){var n=t[0],r=t[1];return e.hasOwnProperty(n)?(0,o.kJ)(e[n])?e[n].push(r):e[n]=[e[n],r]:e[n]=r,e},s=function(e){return e.split("&").filter(o.yR).map(o.Fb).reduce(r,{})};function a(e){var t=function(e){return e||""},n=(0,o.cW)(e).map(t),r=n[0],s=n[1],a=(0,o.C7)(r).map(t);return{path:a[0],search:a[1],hash:s,url:e}}var i=function(e){var t=e.path(),n=e.search(),r=e.hash(),s=Object.keys(n).map((function(e){var t=n[e];return((0,o.kJ)(t)?t:[t]).map((function(t){return e+"="+t}))})).reduce(o.M7,[]).join("&");return t+(s?"?"+s:"")+(r?"#"+r:"")};function d(e,t,n,o){return function(r){var s=r.locationService=new n(r),a=r.locationConfig=new o(r,t);return{name:e,service:s,configuration:a,dispose:function(e){e.dispose(s),e.dispose(a)}}}}},"./node_modules/@uirouter/core/lib-esm/view/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/view/view.js":(e,t,n)=>{"use strict";n.d(t,{s:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),i=function(){function e(e){var t=this;this.router=e,this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._listeners=[],this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIView:function(e){return(0,o.sE)(t._uiViews,(function(n){return t.router.$id+"."+n.id===e}))},_registeredUIViews:function(){return t._uiViews},_activeViewConfigs:function(){return t._viewConfigs},_onSync:function(e){return t._listeners.push(e),function(){return(0,o.nA)(t._listeners,e)}}}}return e.normalizeUIViewTarget=function(e,t){void 0===t&&(t="");var n=t.split("@"),o=n[0]||"$default",r=(0,s.HD)(n[1])?n[1]:"^",a=/^(\^(?:\.\^)*)\.(.*$)/.exec(o);if(a&&(r=a[1],o=a[2]),"!"===o.charAt(0)&&(o=o.substr(1),r=""),/^(\^(?:\.\^)*)$/.exec(r)){var i=r.split(".").reduce((function(e,t){return e.parent}),e);r=i.name}else"."===r&&(r=e.name);return{uiViewName:o,uiViewContextAnchor:r}},e.prototype._rootViewContext=function(e){return this._rootContext=e||this._rootContext},e.prototype._viewConfigFactory=function(e,t){this._viewConfigFactories[e]=t},e.prototype.createViewConfig=function(e,t){var n=this._viewConfigFactories[t.$type];if(!n)throw new Error("ViewService: No view config factory registered for type "+t.$type);var o=n(e,t);return(0,s.kJ)(o)?o:[o]},e.prototype.deactivateViewConfig=function(e){a.g4.traceViewServiceEvent("<- Removing",e),(0,o.nA)(this._viewConfigs,e)},e.prototype.activateViewConfig=function(e){a.g4.traceViewServiceEvent("-> Registering",e),this._viewConfigs.push(e)},e.prototype.sync=function(){var t=this,n=this._uiViews.map((function(e){return[e.fqn,e]})).reduce(o.bb,{});function s(e){for(var t=e.viewDecl.$context,n=0;++n&&t.parent;)t=t.parent;return n}var i=(0,r.WA)((function(e,t,n,o){return t*(e(n)-e(o))})),d=this._uiViews.sort(i((function(e){var t=function(e){return e&&e.parent?t(e.parent)+1:1};return 1e4*e.fqn.split(".").length+t(e.creationContext)}),1)).map((function(o){var r=t._viewConfigs.filter(e.matches(n,o));return r.length>1&&r.sort(i(s,-1)),{uiView:o,viewConfig:r[0]}})),u=d.map((function(e){return e.viewConfig})),m=this._viewConfigs.filter((function(e){return!(0,o.d3)(u,e)})).map((function(e){return{uiView:void 0,viewConfig:e}}));d.forEach((function(e){-1!==t._uiViews.indexOf(e.uiView)&&e.uiView.configUpdated(e.viewConfig)}));var l=d.concat(m);this._listeners.forEach((function(e){return e(l)})),a.g4.traceViewSync(l)},e.prototype.registerUIView=function(e){a.g4.traceViewServiceUIViewEvent("-> Registering",e);var t=this._uiViews;return t.filter((function(t){return t.fqn===e.fqn&&t.$type===e.$type})).length&&a.g4.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",e),t.push(e),this.sync(),function(){-1!==t.indexOf(e)?(a.g4.traceViewServiceUIViewEvent("<- Deregistering",e),(0,o.nA)(t)(e)):a.g4.traceViewServiceUIViewEvent("Tried removing non-registered uiView",e)}},e.prototype.available=function(){return this._uiViews.map((0,r.vg)("fqn"))},e.prototype.active=function(){return this._uiViews.filter((0,r.vg)("$config")).map((0,r.vg)("name"))},e.matches=function(e,t){return function(n){if(t.$type!==n.viewDecl.$type)return!1;var r=n.viewDecl,s=r.$uiViewName.split("."),a=t.fqn.split(".");if(!(0,o.fS)(s,a.slice(0-s.length)))return!1;var i=1-s.length||void 0,d=a.slice(0,i).join("."),u=e[d].creationContext;return r.$uiViewContextAnchor===(u&&u.name)}},e}()},"./node_modules/angular-aria/angular-aria.js":()=>{!function(e,t){"use strict";var n="ngAriaDisable",o=t.module("ngAria",["ng"]).info({angularVersion:"1.8.2"}).provider("$aria",(function(){var e={ariaHidden:!0,ariaChecked:!0,ariaReadonly:!0,ariaDisabled:!0,ariaRequired:!0,ariaInvalid:!0,ariaValue:!0,tabindex:!0,bindKeydown:!0,bindRoleForClick:!0};function o(t,o,r,a){return function(i,d,u){if(!u.hasOwnProperty(n)){var m=u.$normalize(o);!e[m]||s(d,r)||u[m]||i.$watch(u[t],(function(e){e=a?!e:!!e,d.attr(o,e)}))}}}this.config=function(n){e=t.extend(e,n)},this.$get=function(){return{config:function(t){return e[t]},$$watchExpr:o}}})),r=["BUTTON","A","INPUT","TEXTAREA","SELECT","DETAILS","SUMMARY"],s=function(e,t){if(-1!==t.indexOf(e[0].nodeName))return!0};o.directive("ngShow",["$aria",function(e){return e.$$watchExpr("ngShow","aria-hidden",[],!0)}]).directive("ngHide",["$aria",function(e){return e.$$watchExpr("ngHide","aria-hidden",[],!1)}]).directive("ngValue",["$aria",function(e){return e.$$watchExpr("ngValue","aria-checked",r,!1)}]).directive("ngChecked",["$aria",function(e){return e.$$watchExpr("ngChecked","aria-checked",r,!1)}]).directive("ngReadonly",["$aria",function(e){return e.$$watchExpr("ngReadonly","aria-readonly",r,!1)}]).directive("ngRequired",["$aria",function(e){return e.$$watchExpr("ngRequired","aria-required",r,!1)}]).directive("ngModel",["$aria",function(e){function t(t,n,o,a){return e.config(n)&&!o.attr(t)&&(a||!s(o,r))&&("hidden"!==o.attr("type")||"INPUT"!==o[0].nodeName)}function o(e,t){return!t.attr("role")&&t.attr("type")===e&&!s(t,r)}return{restrict:"A",require:"ngModel",priority:200,compile:function(r,s){if(!s.hasOwnProperty(n)){var a=function(e,t){var n=e.type,o=e.role;return"checkbox"===(n||o)||"menuitemcheckbox"===o?"checkbox":"radio"===(n||o)||"menuitemradio"===o?"radio":"range"===n||"progressbar"===o||"slider"===o?"range":""}(s);return{post:function(n,r,s,i){var d=t("tabindex","tabindex",r,!1);function u(){return i.$modelValue}switch(a){case"radio":case"checkbox":o(a,r)&&r.attr("role",a),t("aria-checked","ariaChecked",r,!1)&&n.$watch(u,"radio"===a?function(e){var t=s.value==i.$viewValue;r.attr("aria-checked",t)}:function(){r.attr("aria-checked",!i.$isEmpty(i.$viewValue))}),d&&r.attr("tabindex",0);break;case"range":if(o(a,r)&&r.attr("role","slider"),e.config("ariaValue")){var m=!r.attr("aria-valuemin")&&(s.hasOwnProperty("min")||s.hasOwnProperty("ngMin")),l=!r.attr("aria-valuemax")&&(s.hasOwnProperty("max")||s.hasOwnProperty("ngMax")),_=!r.attr("aria-valuenow");m&&s.$observe("min",(function(e){r.attr("aria-valuemin",e)})),l&&s.$observe("max",(function(e){r.attr("aria-valuemax",e)})),_&&n.$watch(u,(function(e){r.attr("aria-valuenow",e)}))}d&&r.attr("tabindex",0)}!s.hasOwnProperty("ngRequired")&&i.$validators.required&&t("aria-required","ariaRequired",r,!1)&&s.$observe("required",(function(){r.attr("aria-required",!!s.required)})),t("aria-invalid","ariaInvalid",r,!0)&&n.$watch((function(){return i.$invalid}),(function(e){r.attr("aria-invalid",!!e)}))}}}}}}]).directive("ngDisabled",["$aria",function(e){return e.$$watchExpr("ngDisabled","aria-disabled",r,!1)}]).directive("ngMessages",(function(){return{restrict:"A",require:"?ngMessages",link:function(e,t,o,r){o.hasOwnProperty(n)||t.attr("aria-live")||t.attr("aria-live","assertive")}}})).directive("ngClick",["$aria","$parse",function(e,t){return{restrict:"A",compile:function(o,a){if(!a.hasOwnProperty(n)){var i=t(a.ngClick);return function(t,n,o){s(n,r)||(e.config("bindRoleForClick")&&!n.attr("role")&&n.attr("role","button"),e.config("tabindex")&&!n.attr("tabindex")&&n.attr("tabindex",0),!e.config("bindKeydown")||o.ngKeydown||o.ngKeypress||o.ngKeyup||n.on("keydown",(function(e){var n=e.which||e.keyCode;13!==n&&32!==n||(-1!==r.indexOf(e.target.nodeName)||e.target.isContentEditable||e.preventDefault(),t.$apply((function(){i(t,{$event:e})})))})))}}}}}]).directive("ngDblclick",["$aria",function(e){return function(t,o,a){a.hasOwnProperty(n)||!e.config("tabindex")||o.attr("tabindex")||s(o,r)||o.attr("tabindex",0)}}])}(window,window.angular)},"./node_modules/angular-rateit/dist/ng-rateit.js":()=>{angular.module("ngRateIt",["ng"]).directive("ngRateIt",["$q",function(e){"use strict";return{scope:{ngModel:"=",min:"=?min",max:"=?max",step:"=?step",readOnly:"&?readOnly",pristine:"=?pristine",resetable:"&?resetable",starWidth:"=?starWidth",starHeight:"=?starHeight",canelWidth:"=?canelWidth",cancelHeight:"=?cancelHeight",rated:"&?rated",reset:"&?reset",beforeRated:"&?beforeRated",beforeReset:"&?beforeReset"},templateUrl:"ngRateIt/ng-rate-it.html",require:"ngModel",replace:!0,link:function(t,n,o){o.readOnly||(t.readOnly=function(){return!1}),o.resetable||(t.resetable=function(){return!0}),o.beforeRated||(t.beforeRated=function(){var t=e.defer();return t.resolve(),t.promise}),o.rated||(t.rated=function(){}),o.beforeReset||(t.beforeReset=function(){var t=e.defer();return t.resolve(),t.promise}),o.reset||(t.reset=function(){})},controller:"ngRateItController"}}]).controller("ngRateItController",["$scope","$timeout",function(e,t){"use strict";e.isTouch=!!window.hasOwnProperty("ontouchstart")||window.navigator.msMaxTouchPoints>0,e.orgValue=angular.copy(e.ngModel),e.min=e.min||0,e.max=e.max||5,e.step=e.step||.5,e.pristine=e.orgValue===e.ngModel,e.starWidth=e.starWidth||16,e.starPartWidth=e.starWidth*e.step,e.starHeight=e.starHeight||16,e.canelWidth=e.canelWidth||e.starWidth,e.cancelHeight=e.cancelHeight||e.starHeight;var n=e.max-e.min,o=n/e.step,r=e.$watch("ngModel",(function(){e.pristine=e.orgValue===e.ngModel})),s=function(e){return(e+1)/o*n};e.getStartParts=function(){return new Array(o)},e.getStarOffset=function(t){var n=1/e.step;return-e.starWidth/n*(t%n)},e.isSelected=function(t){return s(t)<=e.ngModel-e.min},e.removeRating=function(){e.resetable()&&!e.readOnly()&&e.beforeReset({rating:e.ngModel}).then((function(){e.ngModel=e.min,e.reset({rating:e.ngModel})}))},e.setValue=function(n){if(!e.readOnly()){var o=angular.copy(e.min+s(n));e.beforeRated({rating:o}).then((function(){e.ngModel=o,t((function(){e.rated({rating:e.ngModel})}))}))}},e.$on("$destroy",(function(){r()}))}]).run(["$templateCache",function(e){"use strict";e.put("ngRateIt/ng-rate-it.html",'
')}])},"./src/js/index.module.js":(e,t,n)=>{"use strict";n("./node_modules/angular-animate/index.js"),n("./node_modules/angular-aria/index.js"),n("./node_modules/angular-messages/index.js"),n("./node_modules/angular-material/index.js"),n("./node_modules/angular-resource/index.js"),n("./node_modules/angular-sanitize/index.js"),n("./node_modules/ng-csv/build/ng-csv.min.js"),n("./node_modules/ng-embed/src/ng-embed.js");var o=n("./node_modules/@uirouter/angularjs/lib-esm/index.js"),r=(n("./node_modules/angular-local-storage/index.js"),n("./node_modules/angular-rateit/dist/ng-rateit.js"),n("./node_modules/@flowjs/ng-flow/dist/ng-flow.js"),n("./node_modules/emojionearea/dist/emojionearea.js"),n("./node_modules/jquery-textcomplete/dist/jquery.textcomplete.js"),n("./node_modules/moment/moment.js")),s=n.n(r),a=n("./node_modules/lodash.map/index.js"),i=n.n(a);function d(e,t,n,o,r,a,d,u,m,l){const _=this;function c(n){a.updateStorage(u,{up:n}).then((o=>{var r;e.layout=o,r=!0===n?"show":"hide",t.parent.postMessage({cmd:r},"*"),l((()=>{e.$apply()}))})).catch(a.onStorageError)}_.$onInit=function(){console.debug("IndexController::onInit() VISITOR",e.visitor),e.status="init";const o=e.settings.color,s=e.settings.textColor,i=e.settings.textButtonColor||e.settings.textColor,d=e.settings.color_button,l=e.settings.backgroundColor,_=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=document.documentElement.clientWidth;document.documentElement.style.setProperty("--xc-ws-div-color",o),document.documentElement.style.setProperty("--xc-ws-text-color",s),document.documentElement.style.setProperty("--xc-ws-text-button-color",i),document.documentElement.style.setProperty("--xc-ws-button-color",d),document.documentElement.style.setProperty("--xc-ws-background-color",l),document.documentElement.style.setProperty("--xc-ws-client-height",_),document.documentElement.style.setProperty("--xc-ws-client-width",h);let f=!1;const p=t=>null!==t&&t[e.location]||{},M=a.getItem(m).then(p),y=a.getItem(u).then(p);r.all([M,y]).then((r=>{let[a,i]=r;e.visitor=a,e.layout=i,e.visitor.interaction&&e.layout.up?f=!0:e.layout.up=!0,"bottom_right"===e.settings.alignment&&c(f),n.go(function(){var t,n;const o=e.settings.online,r=!(null==e||null===(t=e.visitor)||void 0===t||null===(n=t.interaction)||void 0===n||!n.id),s=Number(e.settings.maxInteractions)&&Number(e.settings.openedInteractions)>=Number(e.settings.maxInteractions);return!!(r||!s&&o)}()?"app.online":"app.offline",null,{location:"replace"});let d="";d=e.settings.online||!e.settings.hideWhenOffline?"init":"offline",t.parent.postMessage({cmd:d,div_color:o,text_color:s,client_height:_,client_width:h},"*");const u=document.createElement("style");document.head.appendChild(u),u.sheet.insertRule(".mdi-send:before {color:"+e.settings.color+"!important}")})).catch(a.onStorageError)},_.close=function(){const t=e.visitor.interaction;if(t&&t.id){const r=o.confirm().parent(angular.element(document.querySelector("#chat-app"))).clickOutsideToClose(!0).title(e.settings.closingQuestion||"Do you want to close the interaction?").ok("Ok").cancel("Cancel");o.show(r).then((function(){return d.chatInteraction.customUpdate({id:t.id,closed:!0,closeReason:"contact"}).$promise})).then((function(){n.go("app.closing",null,{location:"replace"})})).catch((function(e){console.error("keep open",e)}))}},_.toggle=c,_.download=function(){const t=r.defer(),n=e.visitor.interaction;return n&&n.id&&d.chatInteraction.getMessages({intid:n.id,includeAll:!0,forceDownload:!0}).$promise.then((function(n){t.resolve(i()(n.rows.slice(1),(function(t){let n;if("in"===t.direction&&(n=e.settings.customerAlias||e.visitor.from||"Visitor"+t.ContactId),"out"===t.direction)switch(e.settings.agentIdentifier){case"website_alias":n=t.UserId?e.settings.agentAlias+t.UserId:"System";break;case"agent_alias":n=t.UserId?t.User.alias||t.User.fullname:"System";break;case"agent_fullname":n=t.UserId?t.User.fullname:"System";break;default:n=t.UserId?e.settings.agentAlias+t.UserId:"System"}return{sender:n,message:t.body,createdAt:s()(t.createdAt).format("MM/DD/YYYY HH:mm:ss")}})))})).catch((function(e){console.error(e)})),t.promise},_.getHeaderShape=function(){return"rounded"===e.settings.header_shape?"15px":"0px"};const h={online:["online","chat","waiting","closing","unmanaged"],offline:["offline"]};Object.defineProperty(e,"actualTitle",{get(){let t=e.settings.defaultTitle;return h.online.includes(e.status)?t=e.settings.header_online:h.offline.includes(e.status)&&(t=e.settings.header_offline),t}}),window.addEventListener("message",(function(e){"show"===e.data.evt?c(!0):"hide"===e.data.evt&&c(!1)}),!1)}d.$inject=["$rootScope","$window","$state","$mdDialog","$q","RemoteStorageService","api","STORAGE_LAYOUT","STORAGE_VISITOR","$timeout"];var u=n("./node_modules/lodash.forin/index.js"),m=n.n(u),l=n("./node_modules/lodash.isnil/index.js"),_=n.n(l),c=n("./src/js/chat/chat.tpl.html"),h=n("./src/js/closing/closing.tpl.html"),f=n("./src/js/offline/offline.tpl.html"),p=n("./src/js/online/online.tpl.html"),M=n("./src/js/unmanaged/unmanaged.tpl.html"),y=n("./src/js/waiting/waiting.tpl.html");function L(e,t){const n=t.search();e.settings={cursor:"pointer",hide:!0},m()(n,(function(t,n){""===t||_()(t)||("true"===t&&(t=!0),"false"===t&&(t=!1),e.settings[n]=t)})),e.location=e.settings.location,e.layout={up:!1},e.visitor={}}function g(e,t,n,o,r){t.html5Mode(!0),n.defaults.headers.get||(n.defaults.headers.get={}),n.defaults.headers.get["If-Modified-Since"]="Mon, 26 Jul 1997 05:00:00 GMT",n.defaults.headers.get["Cache-Control"]="no-cache",n.defaults.headers.get.Pragma="no-cache",o.setPrefix(r),e.state("app",{abstract:!0}).state("app.waiting",{url:"/waiting",templateUrl:y,controller:"WaitingController as vm"}).state("app.online",{url:"/online",templateUrl:p,controller:"OnlineController as vm"}).state("app.offline",{url:"/offline",templateUrl:f,controller:"OfflineController as vm"}).state("app.chat",{url:"/chat",templateUrl:c,controller:"ChatController as vm"}).state("app.unmanaged",{url:"/unmanaged",templateUrl:M,controller:"UnmanagedController as vm"}).state("app.closing",{url:"/closing",templateUrl:h,controller:"ClosingController as vm"})}g.$inject=["$stateProvider","$locationProvider","$httpProvider","localStorageServiceProvider","STORAGE_PREFIX"],L.$inject=["$rootScope","$location"];var Y=n("./node_modules/lodash.merge/index.js"),v=n.n(Y);function j(e,t,n,o,r,s,a,i){const d=this;function u(t){return function(o){d.errors[t]=o.data;const r=n.simple().textContent(e.settings.formSubmitFailureMessage||"Form submission error").toastClass("md-failure-toast").position("top");n.show(r)}}function m(){e.loading=!1}function l(){e.settings.online?t.go("app.online",null,{location:"replace"}):t.go("app.offline",null,{location:"replace"})}function _(){d.form={},d.upColor=null,d.downColor=null,d.userForm.$setPristine(),d.userForm.$setUntouched(),delete e.visitor.interaction,e.enableDownload=!1}d.$onInit=function(){console.debug("ClosingController::onInit() VISITOR",e.visitor),e.status="closing",r.all([s.removeItem(a).then((()=>console.debug("STORAGE_VISITOR cleared"))).catch(s.onStorageError),s.removeItem(i).then((()=>console.debug("STORAGE_LAYOUT cleared"))).catch(s.onStorageError)]).then((()=>e.loading=!1))},d.submit=function(){e.loading=!0,e.visitor.interaction&&e.visitor.interaction.id?o.chatInteraction.close(v()({id:e.visitor.interaction.id,ratingType:e.settings.ratingType,customer:e.settings.customerAlias||e.visitor.from},d.form)).$promise.then((function(){delete d.errors.submit;const t=n.simple().textContent(e.settings.formSubmitSuccessMessage||"Form properly submitted").toastClass("md-success-toast").parent(angular.element(document.querySelector("#chat-toolbar")));n.show(t)})).then(_).then(l).catch(u("submit")).finally(m):(m(),u("submit"))},d.skip=function(){_(),l()},d.form={},d.errors={}}function k(e,t){const n={id:"@id",token:e.settings.token},o={};return o.baseUrl=e.settings.remote+"/api/",o.chatWebsite=t(o.baseUrl+"chat/websites/:id",n,{notify:{method:"POST",url:o.baseUrl+"chat/websites/:id/notify"},offline:{method:"POST",url:o.baseUrl+"chat/websites/:id/offline"},getFields:{method:"GET",url:o.baseUrl+"chat/websites/:id/fields"}}),o.chatInteraction=t(o.baseUrl+"chat/interactions/:id",n,{update:{method:"PUT",url:o.baseUrl+"chat/interactions/:id"},customUpdate:{method:"PUT",url:o.baseUrl+"chat/interactions/:id/custom_update"},close:{method:"PUT",url:o.baseUrl+"chat/interactions/:id/close"},getMessages:{method:"GET",url:o.baseUrl+"chat/interactions/:intid/my_messages"},uploadAttachment:{method:"POST",url:o.baseUrl+"chat/interactions/:id/attachment_upload",headers:{"Content-Type":void 0},transformRequest:angular.identity},downloadAttachment:{method:"GET",url:o.baseUrl+"chat/interactions/:id/attachment_download"},abandon:{method:"PUT",url:o.baseUrl+"chat/interactions/:id/abandon"}}),o.chatMessage=t(o.baseUrl+"chat/messages/:id",n,{update:{method:"PUT",url:o.baseUrl+"chat/messages/:id"}}),o}j.$inject=["$rootScope","$state","$mdToast","api","$q","RemoteStorageService","STORAGE_VISITOR","STORAGE_LAYOUT"],k.$inject=["$rootScope","$resource"],n("./node_modules/core-js/modules/esnext.typed-array.at.js"),n("./node_modules/core-js/modules/es.typed-array.sort.js");var w=n("./node_modules/lodash.find/index.js"),b=n.n(w),D=n("./node_modules/lodash.values/index.js"),T=n.n(D),S=n("./node_modules/jquery/dist/jquery.js");function H(e,t,n,r,s,a,i,d,u,m,l,c,h){const f=this;let p,M,y,L,g=!1;function Y(){o.$q.all([m.removeItem(l).then((()=>console.debug("STORAGE_VISITOR cleared"))).catch(m.onStorageError),m.removeItem(c).then((()=>console.debug("STORAGE_LAYOUT cleared"))).catch(m.onStorageError)]).then((()=>{t.settings.online?a.go("app.online",null,{location:"replace"}):a.go("app.offline",null,{location:"replace"})}))}function j(){n((function(){const e=s[0].getElementsByClassName("chat-messages")[0];e&&(e.scrollTop=e.scrollHeight)}))}function k(e){const n=d.simple().textContent(e).toastClass("md-warning-toast size "+t.settings.header_shape).parent(angular.element(document.querySelector("#chat-toolbar")));d.show(n)}function w(){f.errors={},k("FILE TOO BIG: The max allowed size is 16MB")}function D(e){return function(n){var o,r,s;403===(null===(o=n.data)||void 0===o?void 0:o.code)&&"OutOfInterval"===(null===(r=n.data)||void 0===r||null===(s=r.details)||void 0===s?void 0:s.type)?(t.settings.online=!1,t.settings.outOfInterval=!0,a.go("app.offline",null,{location:"replace"})):(f.errors[e]=n.data,f.errors={},k("Message not delivered"),j())}}function H(e){g||(g=!0,u.chatWebsite.notify(e).$promise.then((function(e){f.errors={};let n=!1;_()(t.visitor.interaction)&&(t.visitor.interaction={id:e.interaction.id},n=!0),t.visitor.interactionStarted||(t.visitor.interactionStarted=!0,n=!0),n&&m.updateStorage(l,t.visitor).then((e=>{t.visitor=e})).catch(m.onStorageError),p[0].emojioneArea.setText(""),j()})).catch(D("chatMessageError")).finally((()=>{g=!1})))}function x(){t.visitor&&t.visitor.interaction&&t.visitor.interaction.id&&u.chatInteraction.get({id:t.visitor.interaction.id}).$promise.then((function(e){delete f.errors.getInteraction,e.closed&&(t.visitor.interaction.closed=!0,m.updateStorage(l,t.visitor).then((e=>{t.visitor=e})).catch(m.onStorageError),"unmanaged"===e.disposition?a.go("app.unmanaged",null,{location:"replace"}):a.go("app.closing",null,{location:"replace"}))})).catch((function(e){switch(e.status){case 403:a.go("app.closing",null,{location:"replace"});break;case 404:Y();break;case 405:a.go("app.unmanaged",null,{location:"replace"});break;default:console.error(e)}}))}function E(e){const n=p[0].emojioneArea.getText();e&&13===e.keyCode&&e.shiftKey||e&&13!==e.keyCode||""!==n&&H(v()({body:n},t.visitor))}function P(){var e,n;null!=t&&null!==(e=t.visitor)&&void 0!==e&&null!==(n=e.interaction)&&void 0!==n&&n.id&&u.chatInteraction.getMessages({intid:t.visitor.interaction.id,includeAgent:!0,id:L||void 0}).$promise.then((function(e){if(delete f.errors.interaction,e.count){let o=!1,r=0;for(r=0,o=!1;r{t.visitor=e}))}var n})).catch((function(e){switch(e.status){case 403:a.go("app.closing",null,{location:"replace"});break;case 405:a.go("app.unmanaged",null,{location:"replace"});break;default:console.error(e)}}))}f.errors={},t.messages=[],f.emojiOptions={watchEmbedData:!1,fontSmiley:!1,emoji:!0,link:!0,linkTarget:"_blank"},f.InputRecorderService=h,f.ngFlow={flow:{}},f.ngFlowOptions={allowDuplicateUploads:!0},f.$onInit=function(){console.debug("ChatController::onInit() VISITOR",t.visitor),t.status="chat",t.loading=!1,t.settings.showMenu=!0,f.replyMessage="",t.visitor.interaction&&t.visitor.interaction.closed?Y():(x(),M=r(P,2e3),y=r(x,3e3)),p=S("#emojionearea").emojioneArea({placeholder:t.settings.placeholderMessage||"Type a message",events:{keyup:function(e,t){E(t)},ready:function(){this.setFocus()}}})},f.reply=E,f.reply_button=function(){const e=p[0].emojioneArea.getText();""!==e&&(H(v()({body:e},t.visitor)),p[0].emojioneArea.setFocus())},f.fileAdded=function(e){if(e.size>16777216)return void w();const n=new FormData;n.append("file",e.file),i.post(t.settings.remote+"/api/chat/interactions/"+t.visitor.interaction.id+"/attachment_upload?token="+t.settings.token,n,{transformRequest:angular.identity,headers:{"Content-Type":void 0}}).then((function(e){(e=e.data).id?(f.errors={},H(v()({body:''+e.name+"",AttachmentId:e.id},t.visitor))):D("sendAttachment")}),D("sendAttachment"))},f.recording=!1,f.recordingStopped=!1,f.recordedAudioUrl="",f.onRecordingStart=function(){f.recording?console.error("recording already started"):(console.log("start recording"),f.recording=!0,f.InputRecorderService.init().then((()=>{f.InputRecorderService.startRecording();const e=Date.now();f.recordingStopped=!1;const t=f.InputRecorderService.mediaStream,n=new AudioContext,o=n.createMediaStreamSource(t),r=n.createAnalyser();o.connect(r),r.fftSize=64;const s=new Uint8Array(r.frequencyBinCount),a=255*s.length,i=angular.element(document.getElementsByClassName("record-ripple"))[0],d=angular.element(document.getElementsByClassName("record-time"))[0],u=()=>{if(!f.recording||f.recordingStopped)return i.style.transform="",void(d.innerText="00:00,00");requestAnimationFrame(u),r.getByteFrequencyData(s);let t=0;s.forEach((e=>{t+=e}));const n=Math.min(1,t/a+.36);i.style.transform="scale("+n+")";const o=Date.now()-e,m=o%1e3,l=f.InputRecorderService.toHHMMSS(o/1e3)+","+("00"+Math.round(m/10)).slice(-2);d.innerText=l};u()})).catch((e=>{console.error(e),f.recording=!1})))},f.onRecordingStop=function(){const e=f.stopRecording(),t=URL.createObjectURL(e);f.recordedAudioUrl=t},f.onRecordingSend=function(){const e=f.stopRecording();f.recording=!1,f.recordingStopped=!1,f.InputRecorderService.clear(),f.ngFlow.flow.addFile(e)},f.onRecordingDelete=function(){f.stopRecording(),f.recording=!1,f.recordingStopped=!1,f.InputRecorderService.clear()},f.stopRecording=function(){return f.recordingStopped||(console.log("stoping recording"),f.recordingStopped=!0,f.InputRecorderService.stopRecording()),f.InputRecorderService.download()},f.handleSizeError=w,e.$on("$destroy",(function(){r.cancel(M),r.cancel(y),f.stopRecording(),M=null,y=null})),t.$on("$download",(function(e,n){n&&n(T()(t.messages))}))}H.$inject=["$scope","$rootScope","$timeout","$interval","$document","$state","$http","$mdToast","api","RemoteStorageService","STORAGE_VISITOR","STORAGE_LAYOUT","InputRecorderService"];var x=n("./src/js/offline/offline.controller.js"),E=n("./src/js/online/online.controller.js"),P=n("./src/js/unmanaged/unmanaged.controller.js"),O=n("./src/js/waiting/waiting.controller.js");function A(e,t){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.add(e)}function $(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}var R=new WeakSet,F=new WeakSet;class W{constructor(e,t,n){A(this,F),A(this,R),this.remoteAddress=new URL(t.settings.address).origin,this.location=t.settings.location,this.$q=n,this.$window=e}setItem(e,t){const n="setItem";return this.$q((o=>{$(this,R,C).call(this,n,e,(()=>{o()})),this.$window.parent.postMessage({action:n,key:e,value:t},this.remoteAddress)}))}getItem(e){const t="getItem";return this.$q((n=>{$(this,R,C).call(this,t,e,((e,t)=>{n(t)})),this.$window.parent.postMessage({action:t,key:e},this.remoteAddress)}))}removeItem(e){const t="removeItem";return this.$q((n=>{$(this,R,C).call(this,t,e,(()=>{n()})),this.$window.parent.postMessage({action:t,key:e},this.remoteAddress)}))}updateStorage(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.getItem(e).then((o=>{const r=$(this,F,I).call(this,o)||{};return n?delete r[this.location]:r[this.location]=t,this.setItem(e,r).then((()=>r[this.location]))}))}onStorageError(e){console.error("Storage Error",e)}}function C(e,t,n){const o=r=>{const s=`${e}Result`;if(r.origin===this.remoteAddress&&t===r.data.key&&s===r.data.action){const{action:e,item:s}=r.data;switch(console.debug(`[Key = ${t}] Action "${e}" event from parent`,r),e){case"setItemResult":n(t);break;case"getItemResult":n(t,s);break;case"removeItemResult":n(t);break;default:console.debug("Unsupported action",e)}this.$window.removeEventListener("message",o,!1)}};this.$window.addEventListener("message",o,!1)}function I(e){let t=e;if("string"==typeof t)try{t=JSON.parse(e)}catch(n){console.warn(`Could not parse "${e}"`,n),t=e}return t}W.$inject=["$window","$rootScope","$q"];var z=n("./src/js/input-recorder/input-recorder.service.js");function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class V{constructor(e,t){J(this,"source",""),J(this,"options",{showCurrentTime:!0}),J(this,"loading",!0),J(this,"playPause","play_arrow"),J(this,"currentTime","0:00"),J(this,"sliderTime",0),J(this,"totalTime","0:00"),J(this,"progress","0%"),J(this,"type","audio/webm"),this.$scope=e,this.$scope.$onDestroy=this.$onDestroy,this.$element=t}$onInit(){console.debug("AudioPlayerController.onInit"),"audio/wave"===this.type&&(this.type="audio/webm")}$postLink(){console.debug("AudioPlayerController.postLink");const e=this;this.draggableClasses=["pin"],this.currentlyDragged=null,this.handleMethodOnMouseMove=()=>!1,this.audio=this.$element.find("audio")[0]||{},this.audio.onloadedmetadata=()=>{e.audio.duration===1/0?(e.audio.currentTime=1e101,e.audio.ontimeupdate=()=>{e.audio.ontimeupdate=()=>{e.audio.duration!==1/0&&(e.audio.currentTime=0,e.audio.ontimeupdate=()=>{e.timeupdate()})}}):(e.audio.currentTime=0,e.audio.ontimeupdate=()=>{e.timeupdate()})},this.audio.onloadeddata=()=>{console.log("onloadeddata")},this.audio.oncanplay=()=>{this.makePlay()},this.audio.onended=()=>{this.playPause="play_arrow",this.$scope.$digest(),this.audio.currentTime=0},this.audio.load()}togglePlay(){this.audio.paused?(this.audio.currentTime===this.audio.duration&&(this.audio.currentTime=0),this.playPause="pause",this.audio.play()):(this.playPause="play_arrow",this.audio.pause())}makePlay(){this.loading=!1}timeupdate(){this.updateProgress(),this.$scope.$digest()}updateProgress(){const e=this.audio.currentTime,t=e/this.audio.duration*100;this.progress=t+"%",this.sliderTime=t,this.currentTime=this.formatTime(e)}formatTime(e){const t=Math.floor(e/60),n=Math.floor(e%60);return t+":"+(n<10?"0"+n:n)}onSliderTimeChanged(){this.audio.currentTime=this.audio.duration*(this.sliderTime/100)}$onDestroy(){console.debug("AudioPlayerController.destroy"),this.disposeSource&&!1===this.disposeSource&&URL.revokeObjectURL(this.source)}}V.$inject=["$scope","$element"];var U=n("./src/js/audio-player/audio-player.tpl.html");const N=function(){return function(e){if(!e||"string"!=typeof e)return;const t=e.match(/(?\w*)\/(?([\w-]+\.)+)?(?[\w-]+)(\+(?[\w\-.]+))?(; (?[\w+-.=]+))?/i);return t&&t.groups?t.groups.type:""}};var q=n("./src/js/media-viewer/media-viewer.controller.js"),G=n("./src/js/media-viewer/media-viewer.tpl.html");function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class K{constructor(){B(this,"documentExtension",""),B(this,"documentClassExtension",""),B(this,"documentName",void 0),B(this,"source",void 0)}$onInit(){const e=this.documentName.split(".");1===e.length?this.documentExtension="unkn":this.documentExtension=e.pop(),this.documentExtension.length>4&&(this.documentExtension=this.documentExtension.substring(0,4)+".."),this.documentClassExtension="ext-"+this.documentExtension}downloadDocument(){const e=document.createElement("a"),t=this.source;e.href=t,e.target="_self",e.download=this.documentName,document.body.appendChild(e),e.click()}}K.$inject=[];const Q=K;var X=n("./src/js/document-wrapper/document-wrapper.tpl.html");function Z(e){return function(t){return e.trustAsHtml(t)}}Z.$inject=["$sce"],angular.module("motion-chat",["ngAnimate","ngAria","ngMessages","ngMaterial","ngResource","ngSanitize","ngCsv","ngEmbed","ui.router","LocalStorageModule","ngRateIt","flow"]).filter("toTrusted",Z).constant("STORAGE_PREFIX","motion_chat").constant("STORAGE_VISITOR","visitor").constant("STORAGE_LAYOUT","layout").service("RemoteStorageService",W).service("InputRecorderService",z.t).directive("ngEnter",(function(){return function(e,t,n){t.bind("keydown keypress",(function(t){13===t.which&&(e.$apply((function(){e.$eval(n.ngEnter)})),t.preventDefault())}))}})).directive("ngPrint",(function(){return{link:function(e,t){t.on("click",(function(){e.messages.length>0&&function(e){const t=document.createElement("div"),n=e.visitor,o=e.settings;let r;for(let a=0;a"+document.title+""),a.document.write(""),a.document.write("

Website: "+o.referer+"

"),a.document.write("

Start Time: "+s()(r).format("YYYY-MM-DD HH:mm:ss")+"

"),a.document.write("

Print Time: "+s()().format("YYYY-MM-DD HH:mm:ss")+"

"),a.document.write(t.innerHTML),a.document.write(""),a.document.close(),a.focus(),a.print(),a.close()}(e)}))},restrict:"A"}})).controller("ChatController",H).controller("ClosingController",j).config(["$mdGestureProvider",function(e){e.skipClickHijack()}]).controller("IndexController",d).factory("api",k).config(g).run(L).controller("OfflineController",x.v).config(["$mdGestureProvider",function(e){e.skipClickHijack()}]).controller("OnlineController",E.E).controller("UnmanagedController",P.g).controller("WaitingController",O.H).component("audioPlayer",{templateUrl:U,controller:V,controllerAs:"$ctrl",bindings:{source:"<",type:"<",disposeSource:"<"}}).controller("audioPlayerController",V).filter("typeFromMimeType",N).service("typeFromMimeType",N).component("mediaViewer",{templateUrl:G,controller:q.Z,controllerAs:"$ctrl",bindings:{source:"<",type:"<"}}).component("documentWrapper",{templateUrl:X,controller:Q,controllerAs:"$ctrl",bindings:{source:"<",documentName:"<"}}).directive("adjustImgSize",(function(){return{controller:q.Z,controllerAs:"mediaViewerController",link:function(e,t){e.mediaViewerController.adjustImgSize(t)}}})).directive("adjustVideoSize",(function(){return{controller:q.Z,controllerAs:"mediaViewerController",link:function(e,t){e.mediaViewerController.adjustImgSize(t)}}}))},"./node_modules/core-js/internals/a-function.js":e=>{e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},"./node_modules/core-js/internals/a-possible-prototype.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/is-object.js");e.exports=function(e){if(!o(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},"./node_modules/core-js/internals/an-object.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/is-object.js");e.exports=function(e){if(!o(e))throw TypeError(String(e)+" is not an object");return e}},"./node_modules/core-js/internals/array-buffer-native.js":e=>{e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},"./node_modules/core-js/internals/array-buffer-view-core.js":(e,t,n)=>{"use strict";var o,r,s,a=n("./node_modules/core-js/internals/array-buffer-native.js"),i=n("./node_modules/core-js/internals/descriptors.js"),d=n("./node_modules/core-js/internals/global.js"),u=n("./node_modules/core-js/internals/is-object.js"),m=n("./node_modules/core-js/internals/has.js"),l=n("./node_modules/core-js/internals/classof.js"),_=n("./node_modules/core-js/internals/create-non-enumerable-property.js"),c=n("./node_modules/core-js/internals/redefine.js"),h=n("./node_modules/core-js/internals/object-define-property.js").f,f=n("./node_modules/core-js/internals/object-get-prototype-of.js"),p=n("./node_modules/core-js/internals/object-set-prototype-of.js"),M=n("./node_modules/core-js/internals/well-known-symbol.js"),y=n("./node_modules/core-js/internals/uid.js"),L=d.Int8Array,g=L&&L.prototype,Y=d.Uint8ClampedArray,v=Y&&Y.prototype,j=L&&f(L),k=g&&f(g),w=Object.prototype,b=w.isPrototypeOf,D=M("toStringTag"),T=y("TYPED_ARRAY_TAG"),S=y("TYPED_ARRAY_CONSTRUCTOR"),H=a&&!!p&&"Opera"!==l(d.opera),x=!1,E={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},P={BigInt64Array:8,BigUint64Array:8},O=function(e){if(!u(e))return!1;var t=l(e);return m(E,t)||m(P,t)};for(o in E)(s=(r=d[o])&&r.prototype)?_(s,S,r):H=!1;for(o in P)(s=(r=d[o])&&r.prototype)&&_(s,S,r);if((!H||"function"!=typeof j||j===Function.prototype)&&(j=function(){throw TypeError("Incorrect invocation")},H))for(o in E)d[o]&&p(d[o],j);if((!H||!k||k===w)&&(k=j.prototype,H))for(o in E)d[o]&&p(d[o].prototype,k);if(H&&f(v)!==k&&p(v,k),i&&!m(k,D))for(o in x=!0,h(k,D,{get:function(){return u(this)?this[T]:void 0}}),E)d[o]&&_(d[o],T,o);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:H,TYPED_ARRAY_CONSTRUCTOR:S,TYPED_ARRAY_TAG:x&&T,aTypedArray:function(e){if(O(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor:function(e){if(p&&!b.call(j,e))throw TypeError("Target is not a typed array constructor");return e},exportTypedArrayMethod:function(e,t,n){if(i){if(n)for(var o in E){var r=d[o];if(r&&m(r.prototype,e))try{delete r.prototype[e]}catch(e){}}k[e]&&!n||c(k,e,n?t:H&&g[e]||t)}},exportTypedArrayStaticMethod:function(e,t,n){var o,r;if(i){if(p){if(n)for(o in E)if((r=d[o])&&m(r,e))try{delete r[e]}catch(e){}if(j[e]&&!n)return;try{return c(j,e,n?t:H&&j[e]||t)}catch(e){}}for(o in E)!(r=d[o])||r[e]&&!n||c(r,e,t)}},isView:function(e){if(!u(e))return!1;var t=l(e);return"DataView"===t||m(E,t)||m(P,t)},isTypedArray:O,TypedArray:j,TypedArrayPrototype:k}},"./node_modules/core-js/internals/array-sort.js":e=>{var t=Math.floor,n=function(e,s){var a=e.length,i=t(a/2);return a<8?o(e,s):r(n(e.slice(0,i),s),n(e.slice(i),s),s)},o=function(e,t){for(var n,o,r=e.length,s=1;s0;)e[o]=e[--o];o!==s++&&(e[o]=n)}return e},r=function(e,t,n){for(var o=e.length,r=t.length,s=0,a=0,i=[];s{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/to-string-tag-support.js"),r=n("./node_modules/core-js/internals/classof-raw.js"),s=n("./node_modules/core-js/internals/well-known-symbol.js")("toStringTag"),a="Arguments"==r(function(){return arguments}());e.exports=o?r:function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),s))?n:a?r(t):"Object"==(o=r(t))&&"function"==typeof t.callee?"Arguments":o}},"./node_modules/core-js/internals/correct-prototype-getter.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/fails.js");e.exports=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},"./node_modules/core-js/internals/create-non-enumerable-property.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/descriptors.js"),r=n("./node_modules/core-js/internals/object-define-property.js"),s=n("./node_modules/core-js/internals/create-property-descriptor.js");e.exports=o?function(e,t,n){return r.f(e,t,s(1,n))}:function(e,t,n){return e[t]=n,e}},"./node_modules/core-js/internals/create-property-descriptor.js":e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},"./node_modules/core-js/internals/descriptors.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/fails.js");e.exports=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},"./node_modules/core-js/internals/document-create-element.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/global.js"),r=n("./node_modules/core-js/internals/is-object.js"),s=o.document,a=r(s)&&r(s.createElement);e.exports=function(e){return a?s.createElement(e):{}}},"./node_modules/core-js/internals/engine-ff-version.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/engine-user-agent.js").match(/firefox\/(\d+)/i);e.exports=!!o&&+o[1]},"./node_modules/core-js/internals/engine-is-ie-or-edge.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/engine-user-agent.js");e.exports=/MSIE|Trident/.test(o)},"./node_modules/core-js/internals/engine-user-agent.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/get-built-in.js");e.exports=o("navigator","userAgent")||""},"./node_modules/core-js/internals/engine-v8-version.js":(e,t,n)=>{var o,r,s=n("./node_modules/core-js/internals/global.js"),a=n("./node_modules/core-js/internals/engine-user-agent.js"),i=s.process,d=s.Deno,u=i&&i.versions||d&&d.version,m=u&&u.v8;m?r=(o=m.split("."))[0]<4?1:o[0]+o[1]:a&&(!(o=a.match(/Edge\/(\d+)/))||o[1]>=74)&&(o=a.match(/Chrome\/(\d+)/))&&(r=o[1]),e.exports=r&&+r},"./node_modules/core-js/internals/engine-webkit-version.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/engine-user-agent.js").match(/AppleWebKit\/(\d+)\./);e.exports=!!o&&+o[1]},"./node_modules/core-js/internals/fails.js":e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},"./node_modules/core-js/internals/get-built-in.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/global.js"),r=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?r(o[e]):o[e]&&o[e][t]}},"./node_modules/core-js/internals/global.js":(e,t,n)=>{var o=function(e){return e&&e.Math==Math&&e};e.exports=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},"./node_modules/core-js/internals/has.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/to-object.js"),r={}.hasOwnProperty;e.exports=Object.hasOwn||function(e,t){return r.call(o(e),t)}},"./node_modules/core-js/internals/hidden-keys.js":e=>{e.exports={}},"./node_modules/core-js/internals/ie8-dom-define.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/descriptors.js"),r=n("./node_modules/core-js/internals/fails.js"),s=n("./node_modules/core-js/internals/document-create-element.js");e.exports=!o&&!r((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},"./node_modules/core-js/internals/inspect-source.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/shared-store.js"),r=Function.toString;"function"!=typeof o.inspectSource&&(o.inspectSource=function(e){return r.call(e)}),e.exports=o.inspectSource},"./node_modules/core-js/internals/internal-state.js":(e,t,n)=>{var o,r,s,a=n("./node_modules/core-js/internals/native-weak-map.js"),i=n("./node_modules/core-js/internals/global.js"),d=n("./node_modules/core-js/internals/is-object.js"),u=n("./node_modules/core-js/internals/create-non-enumerable-property.js"),m=n("./node_modules/core-js/internals/has.js"),l=n("./node_modules/core-js/internals/shared-store.js"),_=n("./node_modules/core-js/internals/shared-key.js"),c=n("./node_modules/core-js/internals/hidden-keys.js"),h="Object already initialized",f=i.WeakMap;if(a||l.state){var p=l.state||(l.state=new f),M=p.get,y=p.has,L=p.set;o=function(e,t){if(y.call(p,e))throw new TypeError(h);return t.facade=e,L.call(p,e,t),t},r=function(e){return M.call(p,e)||{}},s=function(e){return y.call(p,e)}}else{var g=_("state");c[g]=!0,o=function(e,t){if(m(e,g))throw new TypeError(h);return t.facade=e,u(e,g,t),t},r=function(e){return m(e,g)?e[g]:{}},s=function(e){return m(e,g)}}e.exports={set:o,get:r,has:s,enforce:function(e){return s(e)?r(e):o(e,{})},getterFor:function(e){return function(t){var n;if(!d(t)||(n=r(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},"./node_modules/core-js/internals/is-object.js":e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},"./node_modules/core-js/internals/is-pure.js":e=>{e.exports=!1},"./node_modules/core-js/internals/is-symbol.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/get-built-in.js"),r=n("./node_modules/core-js/internals/use-symbol-as-uid.js");e.exports=r?function(e){return"symbol"==typeof e}:function(e){var t=o("Symbol");return"function"==typeof t&&Object(e)instanceof t}},"./node_modules/core-js/internals/native-symbol.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/engine-v8-version.js"),r=n("./node_modules/core-js/internals/fails.js");e.exports=!!Object.getOwnPropertySymbols&&!r((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&o&&o<41}))},"./node_modules/core-js/internals/native-weak-map.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/global.js"),r=n("./node_modules/core-js/internals/inspect-source.js"),s=o.WeakMap;e.exports="function"==typeof s&&/native code/.test(r(s))},"./node_modules/core-js/internals/object-define-property.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/descriptors.js"),r=n("./node_modules/core-js/internals/ie8-dom-define.js"),s=n("./node_modules/core-js/internals/an-object.js"),a=n("./node_modules/core-js/internals/to-property-key.js"),i=Object.defineProperty;t.f=o?i:function(e,t,n){if(s(e),t=a(t),s(n),r)try{return i(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},"./node_modules/core-js/internals/object-get-prototype-of.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/has.js"),r=n("./node_modules/core-js/internals/to-object.js"),s=n("./node_modules/core-js/internals/shared-key.js"),a=n("./node_modules/core-js/internals/correct-prototype-getter.js"),i=s("IE_PROTO"),d=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=r(e),o(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?d:null}},"./node_modules/core-js/internals/object-set-prototype-of.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/an-object.js"),r=n("./node_modules/core-js/internals/a-possible-prototype.js");e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(e){}return function(n,s){return o(n),r(s),t?e.call(n,s):n.__proto__=s,n}}():void 0)},"./node_modules/core-js/internals/ordinary-to-primitive.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/is-object.js");e.exports=function(e,t){var n,r;if("string"===t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!o(r=n.call(e)))return r;if("string"!==t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},"./node_modules/core-js/internals/redefine.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/global.js"),r=n("./node_modules/core-js/internals/create-non-enumerable-property.js"),s=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/set-global.js"),i=n("./node_modules/core-js/internals/inspect-source.js"),d=n("./node_modules/core-js/internals/internal-state.js"),u=d.get,m=d.enforce,l=String(String).split("String");(e.exports=function(e,t,n,i){var d,u=!!i&&!!i.unsafe,_=!!i&&!!i.enumerable,c=!!i&&!!i.noTargetGet;"function"==typeof n&&("string"!=typeof t||s(n,"name")||r(n,"name",t),(d=m(n)).source||(d.source=l.join("string"==typeof t?t:""))),e!==o?(u?!c&&e[t]&&(_=!0):delete e[t],_?e[t]=n:r(e,t,n)):_?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||i(this)}))},"./node_modules/core-js/internals/require-object-coercible.js":e=>{e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},"./node_modules/core-js/internals/set-global.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/global.js");e.exports=function(e,t){try{Object.defineProperty(o,e,{value:t,configurable:!0,writable:!0})}catch(n){o[e]=t}return t}},"./node_modules/core-js/internals/shared-key.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/shared.js"),r=n("./node_modules/core-js/internals/uid.js"),s=o("keys");e.exports=function(e){return s[e]||(s[e]=r(e))}},"./node_modules/core-js/internals/shared-store.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/global.js"),r=n("./node_modules/core-js/internals/set-global.js"),s="__core-js_shared__",a=o[s]||r(s,{});e.exports=a},"./node_modules/core-js/internals/shared.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/is-pure.js"),r=n("./node_modules/core-js/internals/shared-store.js");(e.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.17.1",mode:o?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},"./node_modules/core-js/internals/to-integer.js":e=>{var t=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:t)(e)}},"./node_modules/core-js/internals/to-length.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/to-integer.js"),r=Math.min;e.exports=function(e){return e>0?r(o(e),9007199254740991):0}},"./node_modules/core-js/internals/to-object.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/require-object-coercible.js");e.exports=function(e){return Object(o(e))}},"./node_modules/core-js/internals/to-primitive.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/is-object.js"),r=n("./node_modules/core-js/internals/is-symbol.js"),s=n("./node_modules/core-js/internals/ordinary-to-primitive.js"),a=n("./node_modules/core-js/internals/well-known-symbol.js")("toPrimitive");e.exports=function(e,t){if(!o(e)||r(e))return e;var n,i=e[a];if(void 0!==i){if(void 0===t&&(t="default"),n=i.call(e,t),!o(n)||r(n))return n;throw TypeError("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},"./node_modules/core-js/internals/to-property-key.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/to-primitive.js"),r=n("./node_modules/core-js/internals/is-symbol.js");e.exports=function(e){var t=o(e,"string");return r(t)?t:String(t)}},"./node_modules/core-js/internals/to-string-tag-support.js":(e,t,n)=>{var o={};o[n("./node_modules/core-js/internals/well-known-symbol.js")("toStringTag")]="z",e.exports="[object z]"===String(o)},"./node_modules/core-js/internals/uid.js":e=>{var t=0,n=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++t+n).toString(36)}},"./node_modules/core-js/internals/use-symbol-as-uid.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/native-symbol.js");e.exports=o&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},"./node_modules/core-js/internals/well-known-symbol.js":(e,t,n)=>{var o=n("./node_modules/core-js/internals/global.js"),r=n("./node_modules/core-js/internals/shared.js"),s=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/uid.js"),i=n("./node_modules/core-js/internals/native-symbol.js"),d=n("./node_modules/core-js/internals/use-symbol-as-uid.js"),u=r("wks"),m=o.Symbol,l=d?m:m&&m.withoutSetter||a;e.exports=function(e){return s(u,e)&&(i||"string"==typeof u[e])||(i&&s(m,e)?u[e]=m[e]:u[e]=l("Symbol."+e)),u[e]}},"./node_modules/core-js/modules/es.typed-array.at.js":(e,t,n)=>{"use strict";var o=n("./node_modules/core-js/internals/array-buffer-view-core.js"),r=n("./node_modules/core-js/internals/to-length.js"),s=n("./node_modules/core-js/internals/to-integer.js"),a=o.aTypedArray;(0,o.exportTypedArrayMethod)("at",(function(e){var t=a(this),n=r(t.length),o=s(e),i=o>=0?o:n+o;return i<0||i>=n?void 0:t[i]}))},"./node_modules/core-js/modules/es.typed-array.sort.js":(e,t,n)=>{"use strict";var o=n("./node_modules/core-js/internals/array-buffer-view-core.js"),r=n("./node_modules/core-js/internals/global.js"),s=n("./node_modules/core-js/internals/fails.js"),a=n("./node_modules/core-js/internals/a-function.js"),i=n("./node_modules/core-js/internals/to-length.js"),d=n("./node_modules/core-js/internals/array-sort.js"),u=n("./node_modules/core-js/internals/engine-ff-version.js"),m=n("./node_modules/core-js/internals/engine-is-ie-or-edge.js"),l=n("./node_modules/core-js/internals/engine-v8-version.js"),_=n("./node_modules/core-js/internals/engine-webkit-version.js"),c=o.aTypedArray,h=o.exportTypedArrayMethod,f=r.Uint16Array,p=f&&f.prototype.sort,M=!!p&&!s((function(){var e=new f(2);e.sort(null),e.sort({})})),y=!!p&&!s((function(){if(l)return l<74;if(u)return u<67;if(m)return!0;if(_)return _<602;var e,t,n=new f(516),o=Array(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,o[e]=e-2*t+3;for(n.sort((function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==o[e])return!0}));h("sort",(function(e){var t=this;if(void 0!==e&&a(e),y)return p.call(t,e);c(t);var n,o=i(t.length),r=Array(o);for(n=0;n0&&1/n<0?1:-1:t>n}}(e)),n=0;n{n("./node_modules/core-js/modules/es.typed-array.at.js")},"./node_modules/expose-loader/dist/runtime/getGlobalThis.js":(e,t,n)=>{"use strict";e.exports=function(){if("object"==typeof globalThis)return globalThis;var e;try{e=this||new Function("return this")()}catch(e){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==n.g)return n.g}return e}()},"./node_modules/json-form-data/src/jsonToFormData.js":function(e,t){var n,o;(o=this)||(o={}),void 0===(n=function(){return o.jsonToFormData=function(){function e(e){return"[object Array]"==={}.toString.call(e)}function t(t){return!(e(t)||"object"!=typeof t||!t||t instanceof Blob||t instanceof Date)}function n(){return"function"==typeof FormData}function o(){if(n())return new FormData}function r(n,o,s,a){var i=0;for(var d in n){if(n.hasOwnProperty(d)){var u=a||d,m=o.mapping(n[d]);if(a&&t(n)&&(u=a+"["+d+"]"),a&&e(n)&&(u=e(m)||o.showLeafArrayIndexes?a+"["+i+"]":a+"[]"),e(m)||t(m))r(m,o,s,u);else if(m instanceof FileList)for(var l=0;l=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-dz.js":function(e,t,n){!function(e){"use strict";var t=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},n={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},o=function(e){return function(o,r,s,a){var i=t(o),d=n[e][t(o)];return 2===i&&(d=d[r?0:1]),d.replace(/%d/i,o)}},r=["جانفي","فيفري","مارس","أفريل","ماي","جوان","جويلية","أوت","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar-dz",{months:r,monthsShort:r,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:o("s"),ss:o("s"),m:o("m"),mm:o("m"),h:o("h"),hh:o("h"),d:o("d"),dd:o("d"),M:o("M"),MM:o("M"),y:o("y"),yy:o("y")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:0,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-kw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-kw",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:0,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-ly.js":function(e,t,n){!function(e){"use strict";var t={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},n=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},o={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},r=function(e){return function(t,r,s,a){var i=n(t),d=o[e][n(t)];return 2===i&&(d=d[r?0:1]),d.replace(/%d/i,t)}},s=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar-ly",{months:s,monthsShort:s,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:r("s"),ss:r("s"),m:r("m"),mm:r("m"),h:r("h"),hh:r("h"),d:r("d"),dd:r("d"),M:r("M"),MM:r("M"),y:r("y"),yy:r("y")},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-ma.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-sa.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};e.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-tn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-tn",{months:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},o=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},r={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},s=function(e){return function(t,n,s,a){var i=o(t),d=r[e][o(t)];return 2===i&&(d=d[n?0:1]),d.replace(/%d/i,t)}},a=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar",{months:a,monthsShort:a,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:s("s"),ss:s("s"),m:s("m"),mm:s("m"),h:s("h"),hh:s("h"),d:s("d"),dd:s("d"),M:s("M"),MM:s("M"),y:s("y"),yy:s("y")},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/az.js":function(e,t,n){!function(e){"use strict";var t={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-üncü",4:"-üncü",100:"-üncü",6:"-ncı",9:"-uncu",10:"-uncu",30:"-uncu",60:"-ıncı",90:"-ıncı"};e.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),weekdaysShort:"Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),weekdaysMin:"Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[gələn həftə] dddd [saat] LT",lastDay:"[dünən] LT",lastWeek:"[keçən həftə] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s əvvəl",s:"bir neçə saniyə",ss:"%d saniyə",m:"bir dəqiqə",mm:"%d dəqiqə",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gecə|səhər|gündüz|axşam/,isPM:function(e){return/^(gündüz|axşam)$/.test(e)},meridiem:function(e,t,n){return e<4?"gecə":e<12?"səhər":e<17?"gündüz":"axşam"},dayOfMonthOrdinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(e){if(0===e)return e+"-ıncı";var n=e%10;return e+(t[n]||t[e%100-n]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/be.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"хвіліна":"хвіліну":"h"===n?t?"гадзіна":"гадзіну":e+" "+(o=+e,r={ss:t?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:t?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:t?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}e.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:t,mm:t,h:t,hh:t,d:"дзень",dd:t,M:"месяц",MM:t,y:"год",yy:t},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(e){return/^(дня|вечара)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночы":e<12?"раніцы":e<17?"дня":"вечара"},dayOfMonthOrdinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e%10!=2&&e%10!=3||e%100==12||e%100==13?e+"-ы":e+"-і";case"D":return e+"-га";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bg.js":function(e,t,n){!function(e){"use strict";e.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Миналата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[Миналия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",ss:"%d секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",w:"седмица",ww:"%d седмици",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(e){var t=e%10,n=e%100;return 0===e?e+"-ев":0===n?e+"-ен":n>10&&n<20?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bm.js":function(e,t,n){!function(e){"use strict";e.defineLocale("bm",{months:"Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo".split("_"),monthsShort:"Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des".split("_"),weekdays:"Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri".split("_"),weekdaysShort:"Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib".split("_"),weekdaysMin:"Ka_Nt_Ta_Ar_Al_Ju_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"MMMM [tile] D [san] YYYY",LLL:"MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm",LLLL:"dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm"},calendar:{sameDay:"[Bi lɛrɛ] LT",nextDay:"[Sini lɛrɛ] LT",nextWeek:"dddd [don lɛrɛ] LT",lastDay:"[Kunu lɛrɛ] LT",lastWeek:"dddd [tɛmɛnen lɛrɛ] LT",sameElse:"L"},relativeTime:{future:"%s kɔnɔ",past:"a bɛ %s bɔ",s:"sanga dama dama",ss:"sekondi %d",m:"miniti kelen",mm:"miniti %d",h:"lɛrɛ kelen",hh:"lɛrɛ %d",d:"tile kelen",dd:"tile %d",M:"kalo kelen",MM:"kalo %d",y:"san kelen",yy:"san %d"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bn-bd.js":function(e,t,n){!function(e){"use strict";var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};e.defineLocale("bn-bd",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(e){return e.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/রাত|ভোর|সকাল|দুপুর|বিকাল|সন্ধ্যা|রাত/,meridiemHour:function(e,t){return 12===e&&(e=0),"রাত"===t?e<4?e:e+12:"ভোর"===t||"সকাল"===t?e:"দুপুর"===t?e>=3?e:e+12:"বিকাল"===t||"সন্ধ্যা"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"রাত":e<6?"ভোর":e<12?"সকাল":e<15?"দুপুর":e<18?"বিকাল":e<20?"সন্ধ্যা":"রাত"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bn.js":function(e,t,n){!function(e){"use strict";var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};e.defineLocale("bn",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(e){return e.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(e,t){return 12===e&&(e=0),"রাত"===t&&e>=4||"দুপুর"===t&&e<5||"বিকাল"===t?e+12:e},meridiem:function(e,t,n){return e<4?"রাত":e<10?"সকাল":e<17?"দুপুর":e<20?"বিকাল":"রাত"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bo.js":function(e,t,n){!function(e){"use strict";var t={1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"},n={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"};e.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12".split("_"),monthsShortRegex:/^(ཟླ་\d{1,2})/,monthsParseExact:!0,weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",ss:"%d སྐར་ཆ།",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(e){return e.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(e,t){return 12===e&&(e=0),"མཚན་མོ"===t&&e>=4||"ཉིན་གུང"===t&&e<5||"དགོང་དག"===t?e+12:e},meridiem:function(e,t,n){return e<4?"མཚན་མོ":e<10?"ཞོགས་ཀས":e<17?"ཉིན་གུང":e<20?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/br.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return e+" "+function(e,t){return 2===t?function(e){var t={m:"v",b:"v",d:"z"};return void 0===t[e.charAt(0)]?e:t[e.charAt(0)]+e.substring(1)}(e):e}({mm:"munutenn",MM:"miz",dd:"devezh"}[n],e)}function n(e){return e>9?n(e%10):e}var o=[/^gen/i,/^c[ʼ\']hwe/i,/^meu/i,/^ebr/i,/^mae/i,/^(mez|eve)/i,/^gou/i,/^eos/i,/^gwe/i,/^her/i,/^du/i,/^ker/i],r=/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,s=[/^Su/i,/^Lu/i,/^Me([^r]|$)/i,/^Mer/i,/^Ya/i,/^Gw/i,/^Sa/i];e.defineLocale("br",{months:"Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParse:s,fullWeekdaysParse:[/^sul/i,/^lun/i,/^meurzh/i,/^merc[ʼ\']her/i,/^yaou/i,/^gwener/i,/^sadorn/i],shortWeekdaysParse:[/^Sul/i,/^Lun/i,/^Meu/i,/^Mer/i,/^Yao/i,/^Gwe/i,/^Sad/i],minWeekdaysParse:s,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,monthsShortStrictRegex:/^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY HH:mm",LLLL:"dddd, D [a viz] MMMM YYYY HH:mm"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warcʼhoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Decʼh da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s ʼzo",s:"un nebeud segondennoù",ss:"%d eilenn",m:"ur vunutenn",mm:t,h:"un eur",hh:"%d eur",d:"un devezh",dd:t,M:"ur miz",MM:t,y:"ur bloaz",yy:function(e){switch(n(e)){case 1:case 3:case 4:case 5:case 9:return e+" bloaz";default:return e+" vloaz"}}},dayOfMonthOrdinalParse:/\d{1,2}(añ|vet)/,ordinal:function(e){return e+(1===e?"añ":"vet")},week:{dow:1,doy:4},meridiemParse:/a.m.|g.m./,isPM:function(e){return"g.m."===e},meridiem:function(e,t,n){return e<12?"a.m.":"g.m."}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bs.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=e+" ";switch(n){case"ss":return o+(1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi");case"m":return t?"jedna minuta":"jedne minute";case"mm":return o+(1===e?"minuta":2===e||3===e||4===e?"minute":"minuta");case"h":return t?"jedan sat":"jednog sata";case"hh":return o+(1===e?"sat":2===e||3===e||4===e?"sata":"sati");case"dd":return o+(1===e?"dan":"dana");case"MM":return o+(1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci");case"yy":return o+(1===e?"godina":2===e||3===e||4===e?"godine":"godina")}}e.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:t,m:t,mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ca",{months:{standalone:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),format:"de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dt_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a les] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a les] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"uns segons",ss:"%d segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(e,t){var n=1===e?"r":2===e?"n":3===e?"r":4===e?"t":"è";return"w"!==t&&"W"!==t||(n="a"),e+n},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cs.js":function(e,t,n){!function(e){"use strict";var t="leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),n="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),o=[/^led/i,/^úno/i,/^bře/i,/^dub/i,/^kvě/i,/^(čvn|červen$|června)/i,/^(čvc|červenec|července)/i,/^srp/i,/^zář/i,/^říj/i,/^lis/i,/^pro/i],r=/^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;function s(e){return e>1&&e<5&&1!=~~(e/10)}function a(e,t,n,o){var r=e+" ";switch(n){case"s":return t||o?"pár sekund":"pár sekundami";case"ss":return t||o?r+(s(e)?"sekundy":"sekund"):r+"sekundami";case"m":return t?"minuta":o?"minutu":"minutou";case"mm":return t||o?r+(s(e)?"minuty":"minut"):r+"minutami";case"h":return t?"hodina":o?"hodinu":"hodinou";case"hh":return t||o?r+(s(e)?"hodiny":"hodin"):r+"hodinami";case"d":return t||o?"den":"dnem";case"dd":return t||o?r+(s(e)?"dny":"dní"):r+"dny";case"M":return t||o?"měsíc":"měsícem";case"MM":return t||o?r+(s(e)?"měsíce":"měsíců"):r+"měsíci";case"y":return t||o?"rok":"rokem";case"yy":return t||o?r+(s(e)?"roky":"let"):r+"lety"}}e.defineLocale("cs",{months:t,monthsShort:n,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:a,ss:a,m:a,mm:a,h:a,hh:a,d:a,dd:a,M:a,MM:a,y:a,yy:a},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("cv",{months:"кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),monthsShort:"кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кҫ_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",LLL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",LLLL:"dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ӗнер] LT [сехетре]",nextWeek:"[Ҫитес] dddd LT [сехетре]",lastWeek:"[Иртнӗ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(e){return e+(/сехет$/i.exec(e)?"рен":/ҫул$/i.exec(e)?"тан":"ран")},past:"%s каялла",s:"пӗр-ик ҫеккунт",ss:"%d ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},dayOfMonthOrdinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cy.js":function(e,t,n){!function(e){"use strict";e.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",ss:"%d eiliad",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},dayOfMonthOrdinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(e){var t="";return e>20?t=40===e||50===e||60===e||80===e||100===e?"fed":"ain":e>0&&(t=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"][e]),e+t},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/da.js":function(e,t,n){!function(e){"use strict";e.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"på dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[i] dddd[s kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",ss:"%d sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de-at.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de-ch.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de-ch",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/dv.js":function(e,t,n){!function(e){"use strict";var t=["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"],n=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"];e.defineLocale("dv",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:"އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/މކ|މފ/,isPM:function(e){return"މފ"===e},meridiem:function(e,t,n){return e<12?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] LT",lastWeek:"[ފާއިތުވި] dddd LT",sameElse:"L"},relativeTime:{future:"ތެރޭގައި %s",past:"ކުރިން %s",s:"ސިކުންތުކޮޅެއް",ss:"d% ސިކުންތު",m:"މިނިޓެއް",mm:"މިނިޓު %d",h:"ގަޑިއިރެއް",hh:"ގަޑިއިރު %d",d:"ދުވަހެއް",dd:"ދުވަސް %d",M:"މަހެއް",MM:"މަސް %d",y:"އަހަރެއް",yy:"އަހަރު %d"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:7,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/el.js":function(e,t,n){!function(e){"use strict";e.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(e,t){return e?"string"==typeof t&&/D/.test(t.substring(0,t.indexOf("MMMM")))?this._monthsGenitiveEl[e.month()]:this._monthsNominativeEl[e.month()]:this._monthsNominativeEl},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(e,t,n){return e>11?n?"μμ":"ΜΜ":n?"πμ":"ΠΜ"},isPM:function(e){return"μ"===(e+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){switch(this.day()){case 6:return"[το προηγούμενο] dddd [{}] LT";default:return"[την προηγούμενη] dddd [{}] LT"}},sameElse:"L"},calendar:function(e,t){var n,o=this._calendarEl[e],r=t&&t.hours();return n=o,("undefined"!=typeof Function&&n instanceof Function||"[object Function]"===Object.prototype.toString.call(n))&&(o=o.apply(t)),o.replace("{}",r%12==1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",ss:"%d δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},dayOfMonthOrdinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-au.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:0,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-gb.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-ie.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-ie",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-il.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-il",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-in.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-in",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-nz.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-nz",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-sg.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-sg",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/eo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec".split("_"),weekdays:"dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato".split("_"),weekdaysShort:"dim_lun_mard_merk_ĵaŭ_ven_sab".split("_"),weekdaysMin:"di_lu_ma_me_ĵa_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"[la] D[-an de] MMMM, YYYY",LLL:"[la] D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd[n], [la] D[-an de] MMMM, YYYY HH:mm",llll:"ddd, [la] D[-an de] MMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(e){return"p"===e.charAt(0).toLowerCase()},meridiem:function(e,t,n){return e>11?n?"p.t.m.":"P.T.M.":n?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd[n je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasintan] dddd[n je] LT",sameElse:"L"},relativeTime:{future:"post %s",past:"antaŭ %s",s:"kelkaj sekundoj",ss:"%d sekundoj",m:"unu minuto",mm:"%d minutoj",h:"unu horo",hh:"%d horoj",d:"unu tago",dd:"%d tagoj",M:"unu monato",MM:"%d monatoj",y:"unu jaro",yy:"%d jaroj"},dayOfMonthOrdinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-do.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-do",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-mx.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-mx",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:4},invalidDate:"Fecha inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-us.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-us",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"MM/DD/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4},invalidDate:"Fecha inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/et.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["mõne sekundi","mõni sekund","paar sekundit"],ss:[e+"sekundi",e+"sekundit"],m:["ühe minuti","üks minut"],mm:[e+" minuti",e+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[e+" tunni",e+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[e+" kuu",e+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[e+" aasta",e+" aastat"]};return t?r[n][2]?r[n][2]:r[n][1]:o?r[n][0]:r[n][1]}e.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:"%d päeva",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/eu.js":function(e,t,n){!function(e){"use strict";e.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",ss:"%d segundo",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fa.js":function(e,t,n){!function(e){"use strict";var t={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},n={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};e.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(e){return/بعد از ظهر/.test(e)},meridiem:function(e,t,n){return e<12?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",ss:"%d ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(e){return e.replace(/[۰-۹]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},dayOfMonthOrdinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fi.js":function(e,t,n){!function(e){"use strict";var t="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),n=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",t[7],t[8],t[9]];function o(e,o,r,s){var a="";switch(r){case"s":return s?"muutaman sekunnin":"muutama sekunti";case"ss":a=s?"sekunnin":"sekuntia";break;case"m":return s?"minuutin":"minuutti";case"mm":a=s?"minuutin":"minuuttia";break;case"h":return s?"tunnin":"tunti";case"hh":a=s?"tunnin":"tuntia";break;case"d":return s?"päivän":"päivä";case"dd":a=s?"päivän":"päivää";break;case"M":return s?"kuukauden":"kuukausi";case"MM":a=s?"kuukauden":"kuukautta";break;case"y":return s?"vuoden":"vuosi";case"yy":a=s?"vuoden":"vuotta"}return function(e,o){return e<10?o?n[e]:t[e]:e}(e,s)+" "+a}e.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:o,ss:o,m:o,mm:o,h:o,hh:o,d:o,dd:o,M:o,MM:o,y:o,yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fil.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fil",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",ss:"%d sekundir",m:"ein minuttur",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaður",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr-ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(e,t){switch(t){default:case"M":case"Q":case"D":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr-ch.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fr-ch",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(e,t){switch(t){default:case"M":case"Q":case"D":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr.js":function(e,t,n){!function(e){"use strict";var t=/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,n=[/^janv/i,/^févr/i,/^mars/i,/^avr/i,/^mai/i,/^juin/i,/^juil/i,/^août/i,/^sept/i,/^oct/i,/^nov/i,/^déc/i];e.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsRegex:t,monthsShortRegex:t,monthsStrictRegex:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,monthsShortStrictRegex:/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",w:"une semaine",ww:"%d semaines",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|)/,ordinal:function(e,t){switch(t){case"D":return e+(1===e?"er":"");default:case"M":case"Q":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fy.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_"),n="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_");e.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsParseExact:!0,weekdays:"snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),weekdaysShort:"si._mo._ti._wo._to._fr._so.".split("_"),weekdaysMin:"Si_Mo_Ti_Wo_To_Fr_So".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[hjoed om] LT",nextDay:"[moarn om] LT",nextWeek:"dddd [om] LT",lastDay:"[juster om] LT",lastWeek:"[ôfrûne] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oer %s",past:"%s lyn",s:"in pear sekonden",ss:"%d sekonden",m:"ien minút",mm:"%d minuten",h:"ien oere",hh:"%d oeren",d:"ien dei",dd:"%d dagen",M:"ien moanne",MM:"%d moannen",y:"ien jier",yy:"%d jierren"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ga.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ga",{months:["Eanáir","Feabhra","Márta","Aibreán","Bealtaine","Meitheamh","Iúil","Lúnasa","Meán Fómhair","Deireadh Fómhair","Samhain","Nollaig"],monthsShort:["Ean","Feabh","Márt","Aib","Beal","Meith","Iúil","Lún","M.F.","D.F.","Samh","Noll"],monthsParseExact:!0,weekdays:["Dé Domhnaigh","Dé Luain","Dé Máirt","Dé Céadaoin","Déardaoin","Dé hAoine","Dé Sathairn"],weekdaysShort:["Domh","Luan","Máirt","Céad","Déar","Aoine","Sath"],weekdaysMin:["Do","Lu","Má","Cé","Dé","A","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Inniu ag] LT",nextDay:"[Amárach ag] LT",nextWeek:"dddd [ag] LT",lastDay:"[Inné ag] LT",lastWeek:"dddd [seo caite] [ag] LT",sameElse:"L"},relativeTime:{future:"i %s",past:"%s ó shin",s:"cúpla soicind",ss:"%d soicind",m:"nóiméad",mm:"%d nóiméad",h:"uair an chloig",hh:"%d uair an chloig",d:"lá",dd:"%d lá",M:"mí",MM:"%d míonna",y:"bliain",yy:"%d bliain"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(e){return e+(1===e?"d":e%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gd.js":function(e,t,n){!function(e){"use strict";e.defineLocale("gd",{months:["Am Faoilleach","An Gearran","Am Màrt","An Giblean","An Cèitean","An t-Ògmhios","An t-Iuchar","An Lùnastal","An t-Sultain","An Dàmhair","An t-Samhain","An Dùbhlachd"],monthsShort:["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],monthsParseExact:!0,weekdays:["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],weekdaysShort:["Did","Dil","Dim","Dic","Dia","Dih","Dis"],weekdaysMin:["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-màireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-dè aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",ss:"%d diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"mìos",MM:"%d mìosan",y:"bliadhna",yy:"%d bliadhna"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(e){return e+(1===e?"d":e%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gl.js":function(e,t,n){!function(e){"use strict";e.defineLocale("gl",{months:"xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro".split("_"),monthsShort:"xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"domingo_luns_martes_mércores_xoves_venres_sábado".split("_"),weekdaysShort:"dom._lun._mar._mér._xov._ven._sáb.".split("_"),weekdaysMin:"do_lu_ma_mé_xo_ve_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(e){return 0===e.indexOf("un")?"n"+e:"en "+e},past:"hai %s",s:"uns segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gom-deva.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["थोडया सॅकंडांनी","थोडे सॅकंड"],ss:[e+" सॅकंडांनी",e+" सॅकंड"],m:["एका मिणटान","एक मिनूट"],mm:[e+" मिणटांनी",e+" मिणटां"],h:["एका वरान","एक वर"],hh:[e+" वरांनी",e+" वरां"],d:["एका दिसान","एक दीस"],dd:[e+" दिसांनी",e+" दीस"],M:["एका म्हयन्यान","एक म्हयनो"],MM:[e+" म्हयन्यानी",e+" म्हयने"],y:["एका वर्सान","एक वर्स"],yy:[e+" वर्सांनी",e+" वर्सां"]};return o?r[n][0]:r[n][1]}e.defineLocale("gom-deva",{months:{standalone:"जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),format:"जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार".split("_"),weekdaysShort:"आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.".split("_"),weekdaysMin:"आ_सो_मं_बु_ब्रे_सु_शे".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [वाजतां]",LTS:"A h:mm:ss [वाजतां]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [वाजतां]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [वाजतां]",llll:"ddd, D MMM YYYY, A h:mm [वाजतां]"},calendar:{sameDay:"[आयज] LT",nextDay:"[फाल्यां] LT",nextWeek:"[फुडलो] dddd[,] LT",lastDay:"[काल] LT",lastWeek:"[फाटलो] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s आदीं",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}(वेर)/,ordinal:function(e,t){switch(t){case"D":return e+"वेर";default:case"M":case"Q":case"DDD":case"d":case"w":case"W":return e}},week:{dow:0,doy:3},meridiemParse:/राती|सकाळीं|दनपारां|सांजे/,meridiemHour:function(e,t){return 12===e&&(e=0),"राती"===t?e<4?e:e+12:"सकाळीं"===t?e:"दनपारां"===t?e>12?e:e+12:"सांजे"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"राती":e<12?"सकाळीं":e<16?"दनपारां":e<20?"सांजे":"राती"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gom-latn.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["thoddea sekondamni","thodde sekond"],ss:[e+" sekondamni",e+" sekond"],m:["eka mintan","ek minut"],mm:[e+" mintamni",e+" mintam"],h:["eka voran","ek vor"],hh:[e+" voramni",e+" voram"],d:["eka disan","ek dis"],dd:[e+" disamni",e+" dis"],M:["eka mhoinean","ek mhoino"],MM:[e+" mhoineamni",e+" mhoine"],y:["eka vorsan","ek voros"],yy:[e+" vorsamni",e+" vorsam"]};return o?r[n][0]:r[n][1]}e.defineLocale("gom-latn",{months:{standalone:"Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr".split("_"),format:"Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split("_"),weekdaysShort:"Ait._Som._Mon._Bud._Bre._Suk._Son.".split("_"),weekdaysMin:"Ai_Sm_Mo_Bu_Br_Su_Sn".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [vazta]",LTS:"A h:mm:ss [vazta]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [vazta]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [vazta]",llll:"ddd, D MMM YYYY, A h:mm [vazta]"},calendar:{sameDay:"[Aiz] LT",nextDay:"[Faleam] LT",nextWeek:"[Fuddlo] dddd[,] LT",lastDay:"[Kal] LT",lastWeek:"[Fattlo] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s adim",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}(er)/,ordinal:function(e,t){switch(t){case"D":return e+"er";default:case"M":case"Q":case"DDD":case"d":case"w":case"W":return e}},week:{dow:0,doy:3},meridiemParse:/rati|sokallim|donparam|sanje/,meridiemHour:function(e,t){return 12===e&&(e=0),"rati"===t?e<4?e:e+12:"sokallim"===t?e:"donparam"===t?e>12?e:e+12:"sanje"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"rati":e<12?"sokallim":e<16?"donparam":e<20?"sanje":"rati"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gu.js":function(e,t,n){!function(e){"use strict";var t={1:"૧",2:"૨",3:"૩",4:"૪",5:"૫",6:"૬",7:"૭",8:"૮",9:"૯",0:"૦"},n={"૧":"1","૨":"2","૩":"3","૪":"4","૫":"5","૬":"6","૭":"7","૮":"8","૯":"9","૦":"0"};e.defineLocale("gu",{months:"જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર".split("_"),monthsShort:"જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.".split("_"),monthsParseExact:!0,weekdays:"રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર".split("_"),weekdaysShort:"રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ".split("_"),weekdaysMin:"ર_સો_મં_બુ_ગુ_શુ_શ".split("_"),longDateFormat:{LT:"A h:mm વાગ્યે",LTS:"A h:mm:ss વાગ્યે",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm વાગ્યે",LLLL:"dddd, D MMMM YYYY, A h:mm વાગ્યે"},calendar:{sameDay:"[આજ] LT",nextDay:"[કાલે] LT",nextWeek:"dddd, LT",lastDay:"[ગઇકાલે] LT",lastWeek:"[પાછલા] dddd, LT",sameElse:"L"},relativeTime:{future:"%s મા",past:"%s પહેલા",s:"અમુક પળો",ss:"%d સેકંડ",m:"એક મિનિટ",mm:"%d મિનિટ",h:"એક કલાક",hh:"%d કલાક",d:"એક દિવસ",dd:"%d દિવસ",M:"એક મહિનો",MM:"%d મહિનો",y:"એક વર્ષ",yy:"%d વર્ષ"},preparse:function(e){return e.replace(/[૧૨૩૪૫૬૭૮૯૦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/રાત|બપોર|સવાર|સાંજ/,meridiemHour:function(e,t){return 12===e&&(e=0),"રાત"===t?e<4?e:e+12:"સવાર"===t?e:"બપોર"===t?e>=10?e:e+12:"સાંજ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"રાત":e<10?"સવાર":e<17?"બપોર":e<20?"સાંજ":"રાત"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/he.js":function(e,t,n){!function(e){"use strict";e.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",ss:"%d שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(e){return 2===e?"שעתיים":e+" שעות"},d:"יום",dd:function(e){return 2===e?"יומיים":e+" ימים"},M:"חודש",MM:function(e){return 2===e?"חודשיים":e+" חודשים"},y:"שנה",yy:function(e){return 2===e?"שנתיים":e%10==0&&10!==e?e+" שנה":e+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(e){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(e)},meridiem:function(e,t,n){return e<5?"לפנות בוקר":e<10?"בבוקר":e<12?n?'לפנה"צ':"לפני הצהריים":e<18?n?'אחה"צ':"אחרי הצהריים":"בערב"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hi.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},o=[/^जन/i,/^फ़र|फर/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सितं|सित/i,/^अक्टू/i,/^नव|नवं/i,/^दिसं|दिस/i];e.defineLocale("hi",{months:{format:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),standalone:"जनवरी_फरवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितंबर_अक्टूबर_नवंबर_दिसंबर".split("_")},monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",LTS:"A h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm बजे",LLLL:"dddd, D MMMM YYYY, A h:mm बजे"},monthsParse:o,longMonthsParse:o,shortMonthsParse:[/^जन/i,/^फ़र/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सित/i,/^अक्टू/i,/^नव/i,/^दिस/i],monthsRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsShortRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsStrictRegex:/^(जनवरी?|फ़रवरी|फरवरी?|मार्च?|अप्रैल?|मई?|जून?|जुलाई?|अगस्त?|सितम्बर|सितंबर|सित?\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर?|दिसम्बर|दिसंबर?)/i,monthsShortStrictRegex:/^(जन\.?|फ़र\.?|मार्च?|अप्रै\.?|मई?|जून?|जुल\.?|अग\.?|सित\.?|अक्टू\.?|नव\.?|दिस\.?)/i,calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",ss:"%d सेकंड",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(e,t){return 12===e&&(e=0),"रात"===t?e<4?e:e+12:"सुबह"===t?e:"दोपहर"===t?e>=10?e:e+12:"शाम"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"रात":e<10?"सुबह":e<17?"दोपहर":e<20?"शाम":"रात"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hr.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=e+" ";switch(n){case"ss":return o+(1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi");case"m":return t?"jedna minuta":"jedne minute";case"mm":return o+(1===e?"minuta":2===e||3===e||4===e?"minute":"minuta");case"h":return t?"jedan sat":"jednog sata";case"hh":return o+(1===e?"sat":2===e||3===e||4===e?"sata":"sati");case"dd":return o+(1===e?"dan":"dana");case"MM":return o+(1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci");case"yy":return o+(1===e?"godina":2===e||3===e||4===e?"godine":"godina")}}e.defineLocale("hr",{months:{format:"siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),standalone:"siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")},monthsShort:"sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"Do MMMM YYYY",LLL:"Do MMMM YYYY H:mm",LLLL:"dddd, Do MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:return"[prošlu] [nedjelju] [u] LT";case 3:return"[prošlu] [srijedu] [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:t,m:t,mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hu.js":function(e,t,n){!function(e){"use strict";var t="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");function n(e,t,n,o){var r=e;switch(n){case"s":return o||t?"néhány másodperc":"néhány másodperce";case"ss":return r+(o||t)?" másodperc":" másodperce";case"m":return"egy"+(o||t?" perc":" perce");case"mm":return r+(o||t?" perc":" perce");case"h":return"egy"+(o||t?" óra":" órája");case"hh":return r+(o||t?" óra":" órája");case"d":return"egy"+(o||t?" nap":" napja");case"dd":return r+(o||t?" nap":" napja");case"M":return"egy"+(o||t?" hónap":" hónapja");case"MM":return r+(o||t?" hónap":" hónapja");case"y":return"egy"+(o||t?" év":" éve");case"yy":return r+(o||t?" év":" éve")}return""}function o(e){return(e?"":"[múlt] ")+"["+t[this.day()]+"] LT[-kor]"}e.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(e){return"u"===e.charAt(1).toLowerCase()},meridiem:function(e,t,n){return e<12?!0===n?"de":"DE":!0===n?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return o.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return o.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:n,ss:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hy-am.js":function(e,t,n){!function(e){"use strict";e.defineLocale("hy-am",{months:{format:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_"),standalone:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_")},monthsShort:"հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_"),weekdays:"կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_"),weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., HH:mm",LLLL:"dddd, D MMMM YYYY թ., HH:mm"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",ss:"%d վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(e){return/^(ցերեկվա|երեկոյան)$/.test(e)},meridiem:function(e){return e<4?"գիշերվա":e<12?"առավոտվա":e<17?"ցերեկվա":"երեկոյան"},dayOfMonthOrdinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(e,t){switch(t){case"DDD":case"w":case"W":case"DDDo":return 1===e?e+"-ին":e+"-րդ";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/id.js":function(e,t,n){!function(e){"use strict";e.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"siang"===t?e>=11?e:e+12:"sore"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"siang":e<19?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",ss:"%d detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/is.js":function(e,t,n){!function(e){"use strict";function t(e){return e%100==11||e%10!=1}function n(e,n,o,r){var s=e+" ";switch(o){case"s":return n||r?"nokkrar sekúndur":"nokkrum sekúndum";case"ss":return t(e)?s+(n||r?"sekúndur":"sekúndum"):s+"sekúnda";case"m":return n?"mínúta":"mínútu";case"mm":return t(e)?s+(n||r?"mínútur":"mínútum"):n?s+"mínúta":s+"mínútu";case"hh":return t(e)?s+(n||r?"klukkustundir":"klukkustundum"):s+"klukkustund";case"d":return n?"dagur":r?"dag":"degi";case"dd":return t(e)?n?s+"dagar":s+(r?"daga":"dögum"):n?s+"dagur":s+(r?"dag":"degi");case"M":return n?"mánuður":r?"mánuð":"mánuði";case"MM":return t(e)?n?s+"mánuðir":s+(r?"mánuði":"mánuðum"):n?s+"mánuður":s+(r?"mánuð":"mánuði");case"y":return n||r?"ár":"ári";case"yy":return t(e)?s+(n||r?"ár":"árum"):s+(n||r?"ár":"ári")}}e.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:n,ss:n,m:n,mm:n,h:"klukkustund",hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/it-ch.js":function(e,t,n){!function(e){"use strict";e.defineLocale("it-ch",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){switch(this.day()){case 0:return"[la scorsa] dddd [alle] LT";default:return"[lo scorso] dddd [alle] LT"}},sameElse:"L"},relativeTime:{future:function(e){return(/^[0-9].+$/.test(e)?"tra":"in")+" "+e},past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/it.js":function(e,t,n){!function(e){"use strict";e.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:function(){return"[Oggi a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextDay:function(){return"[Domani a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextWeek:function(){return"dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastDay:function(){return"[Ieri a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastWeek:function(){switch(this.day()){case 0:return"[La scorsa] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT";default:return"[Lo scorso] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"}},sameElse:"L"},relativeTime:{future:"tra %s",past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",w:"una settimana",ww:"%d settimane",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ja.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"令和",narrow:"㋿",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"平成",narrow:"㍻",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"昭和",narrow:"㍼",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"大正",narrow:"㍽",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"明治",narrow:"㍾",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"西暦",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"紀元前",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(元|\d+)年/,eraYearOrdinalParse:function(e,t){return"元"===t[1]?1:parseInt(t[1]||e,10)},months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日(ddd) HH:mm"},meridiemParse:/午前|午後/i,isPM:function(e){return"午後"===e},meridiem:function(e,t,n){return e<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:function(e){return e.week()!==this.week()?"[来週]dddd LT":"dddd LT"},lastDay:"[昨日] LT",lastWeek:function(e){return this.week()!==e.week()?"[先週]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}日/,ordinal:function(e,t){switch(t){case"y":return 1===e?"元年":e+"年";case"d":case"D":case"DDD":return e+"日";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",ss:"%d秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/jv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("jv",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),weekdays:"Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),weekdaysShort:"Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/enjing|siyang|sonten|ndalu/,meridiemHour:function(e,t){return 12===e&&(e=0),"enjing"===t?e:"siyang"===t?e>=11?e:e+12:"sonten"===t||"ndalu"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"enjing":e<15?"siyang":e<19?"sonten":"ndalu"},calendar:{sameDay:"[Dinten puniko pukul] LT",nextDay:"[Mbenjang pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kala wingi pukul] LT",lastWeek:"dddd [kepengker pukul] LT",sameElse:"L"},relativeTime:{future:"wonten ing %s",past:"%s ingkang kepengker",s:"sawetawis detik",ss:"%d detik",m:"setunggal menit",mm:"%d menit",h:"setunggal jam",hh:"%d jam",d:"sedinten",dd:"%d dinten",M:"sewulan",MM:"%d wulan",y:"setaun",yy:"%d taun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ka.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ka",{months:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:{standalone:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),format:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),isFormat:/(წინა|შემდეგ)/},weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(e){return e.replace(/(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,(function(e,t,n){return"ი"===n?t+"ში":t+n+"ში"}))},past:function(e){return/(წამი|წუთი|საათი|დღე|თვე)/.test(e)?e.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(e)?e.replace(/წელი$/,"წლის წინ"):e},s:"რამდენიმე წამი",ss:"%d წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},dayOfMonthOrdinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(e){return 0===e?e:1===e?e+"-ლი":e<20||e<=100&&e%20==0||e%100==0?"მე-"+e:e+"-ე"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/kk.js":function(e,t,n){!function(e){"use strict";var t={0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"};e.defineLocale("kk",{months:"қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан".split("_"),monthsShort:"қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел".split("_"),weekdays:"жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі".split("_"),weekdaysShort:"жек_дүй_сей_сәр_бей_жұм_сен".split("_"),weekdaysMin:"жк_дй_сй_ср_бй_жм_сн".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгін сағат] LT",nextDay:"[Ертең сағат] LT",nextWeek:"dddd [сағат] LT",lastDay:"[Кеше сағат] LT",lastWeek:"[Өткен аптаның] dddd [сағат] LT",sameElse:"L"},relativeTime:{future:"%s ішінде",past:"%s бұрын",s:"бірнеше секунд",ss:"%d секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/km.js":function(e,t,n){!function(e){"use strict";var t={1:"១",2:"២",3:"៣",4:"៤",5:"៥",6:"៦",7:"៧",8:"៨",9:"៩",0:"០"},n={"១":"1","២":"2","៣":"3","៤":"4","៥":"5","៦":"6","៧":"7","៨":"8","៩":"9","០":"0"};e.defineLocale("km",{months:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysMin:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ព្រឹក|ល្ងាច/,isPM:function(e){return"ល្ងាច"===e},meridiem:function(e,t,n){return e<12?"ព្រឹក":"ល្ងាច"},calendar:{sameDay:"[ថ្ងៃនេះ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",ss:"%d វិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},dayOfMonthOrdinalParse:/ទី\d{1,2}/,ordinal:"ទី%d",preparse:function(e){return e.replace(/[១២៣៤៥៦៧៨៩០]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/kn.js":function(e,t,n){!function(e){"use strict";var t={1:"೧",2:"೨",3:"೩",4:"೪",5:"೫",6:"೬",7:"೭",8:"೮",9:"೯",0:"೦"},n={"೧":"1","೨":"2","೩":"3","೪":"4","೫":"5","೬":"6","೭":"7","೮":"8","೯":"9","೦":"0"};e.defineLocale("kn",{months:"ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್".split("_"),monthsShort:"ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ".split("_"),monthsParseExact:!0,weekdays:"ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ".split("_"),weekdaysShort:"ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ".split("_"),weekdaysMin:"ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[ಇಂದು] LT",nextDay:"[ನಾಳೆ] LT",nextWeek:"dddd, LT",lastDay:"[ನಿನ್ನೆ] LT",lastWeek:"[ಕೊನೆಯ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ನಂತರ",past:"%s ಹಿಂದೆ",s:"ಕೆಲವು ಕ್ಷಣಗಳು",ss:"%d ಸೆಕೆಂಡುಗಳು",m:"ಒಂದು ನಿಮಿಷ",mm:"%d ನಿಮಿಷ",h:"ಒಂದು ಗಂಟೆ",hh:"%d ಗಂಟೆ",d:"ಒಂದು ದಿನ",dd:"%d ದಿನ",M:"ಒಂದು ತಿಂಗಳು",MM:"%d ತಿಂಗಳು",y:"ಒಂದು ವರ್ಷ",yy:"%d ವರ್ಷ"},preparse:function(e){return e.replace(/[೧೨೩೪೫೬೭೮೯೦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,meridiemHour:function(e,t){return 12===e&&(e=0),"ರಾತ್ರಿ"===t?e<4?e:e+12:"ಬೆಳಿಗ್ಗೆ"===t?e:"ಮಧ್ಯಾಹ್ನ"===t?e>=10?e:e+12:"ಸಂಜೆ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"ರಾತ್ರಿ":e<10?"ಬೆಳಿಗ್ಗೆ":e<17?"ಮಧ್ಯಾಹ್ನ":e<20?"ಸಂಜೆ":"ರಾತ್ರಿ"},dayOfMonthOrdinalParse:/\d{1,2}(ನೇ)/,ordinal:function(e){return e+"ನೇ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ko.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h:mm",LLLL:"YYYY년 MMMM D일 dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY년 MMMM D일",lll:"YYYY년 MMMM D일 A h:mm",llll:"YYYY년 MMMM D일 dddd A h:mm"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"1분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},dayOfMonthOrdinalParse:/\d{1,2}(일|월|주)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"일";case"M":return e+"월";case"w":case"W":return e+"주";default:return e}},meridiemParse:/오전|오후/,isPM:function(e){return"오후"===e},meridiem:function(e,t,n){return e<12?"오전":"오후"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ku.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},o=["کانونی دووەم","شوبات","ئازار","نیسان","ئایار","حوزەیران","تەمموز","ئاب","ئەیلوول","تشرینی یەكەم","تشرینی دووەم","كانونی یەکەم"];e.defineLocale("ku",{months:o,monthsShort:o,weekdays:"یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌".split("_"),weekdaysShort:"یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌".split("_"),weekdaysMin:"ی_د_س_چ_پ_ه_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ئێواره‌|به‌یانی/,isPM:function(e){return/ئێواره‌/.test(e)},meridiem:function(e,t,n){return e<12?"به‌یانی":"ئێواره‌"},calendar:{sameDay:"[ئه‌مرۆ كاتژمێر] LT",nextDay:"[به‌یانی كاتژمێر] LT",nextWeek:"dddd [كاتژمێر] LT",lastDay:"[دوێنێ كاتژمێر] LT",lastWeek:"dddd [كاتژمێر] LT",sameElse:"L"},relativeTime:{future:"له‌ %s",past:"%s",s:"چه‌ند چركه‌یه‌ك",ss:"چركه‌ %d",m:"یه‌ك خوله‌ك",mm:"%d خوله‌ك",h:"یه‌ك كاتژمێر",hh:"%d كاتژمێر",d:"یه‌ك ڕۆژ",dd:"%d ڕۆژ",M:"یه‌ك مانگ",MM:"%d مانگ",y:"یه‌ك ساڵ",yy:"%d ساڵ"},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ky.js":function(e,t,n){!function(e){"use strict";var t={0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"};e.defineLocale("ky",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),weekdays:"Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),weekdaysShort:"Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),weekdaysMin:"Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгүн саат] LT",nextDay:"[Эртең саат] LT",nextWeek:"dddd [саат] LT",lastDay:"[Кечээ саат] LT",lastWeek:"[Өткөн аптанын] dddd [күнү] [саат] LT",sameElse:"L"},relativeTime:{future:"%s ичинде",past:"%s мурун",s:"бирнече секунд",ss:"%d секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lb.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return t?r[n][0]:r[n][1]}function n(e){if(e=parseInt(e,10),isNaN(e))return!1;if(e<0)return!0;if(e<10)return 4<=e&&e<=7;if(e<100){var t=e%10;return n(0===t?e/10:t)}if(e<1e4){for(;e>=10;)e/=10;return n(e)}return n(e/=1e3)}e.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:function(e){return n(e.substr(0,e.indexOf(" ")))?"a "+e:"an "+e},past:function(e){return n(e.substr(0,e.indexOf(" ")))?"viru "+e:"virun "+e},s:"e puer Sekonnen",ss:"%d Sekonnen",m:t,mm:"%d Minutten",h:t,hh:"%d Stonnen",d:t,dd:"%d Deeg",M:t,MM:"%d Méint",y:t,yy:"%d Joer"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("lo",{months:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),monthsShort:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),weekdays:"ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysShort:"ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysMin:"ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"ວັນdddd D MMMM YYYY HH:mm"},meridiemParse:/ຕອນເຊົ້າ|ຕອນແລງ/,isPM:function(e){return"ຕອນແລງ"===e},meridiem:function(e,t,n){return e<12?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",ss:"%d ວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},dayOfMonthOrdinalParse:/(ທີ່)\d{1,2}/,ordinal:function(e){return"ທີ່"+e}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lt.js":function(e,t,n){!function(e){"use strict";var t={ss:"sekundė_sekundžių_sekundes",m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"};function n(e,t,n,o){return t?r(n)[0]:o?r(n)[1]:r(n)[2]}function o(e){return e%10==0||e>10&&e<20}function r(e){return t[e].split("_")}function s(e,t,s,a){var i=e+" ";return 1===e?i+n(0,t,s[0],a):t?i+(o(e)?r(s)[1]:r(s)[0]):a?i+r(s)[1]:i+(o(e)?r(s)[1]:r(s)[2])}e.defineLocale("lt",{months:{format:"sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),standalone:"sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis".split("_"),isFormat:/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/},monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:{format:"sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį".split("_"),standalone:"sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_"),isFormat:/dddd HH:mm/},weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], HH:mm [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], HH:mm [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:function(e,t,n,o){return t?"kelios sekundės":o?"kelių sekundžių":"kelias sekundes"},ss:s,m:n,mm:s,h:n,hh:s,d:n,dd:s,M:n,MM:s,y:n,yy:s},dayOfMonthOrdinalParse:/\d{1,2}-oji/,ordinal:function(e){return e+"-oji"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lv.js":function(e,t,n){!function(e){"use strict";var t={ss:"sekundes_sekundēm_sekunde_sekundes".split("_"),m:"minūtes_minūtēm_minūte_minūtes".split("_"),mm:"minūtes_minūtēm_minūte_minūtes".split("_"),h:"stundas_stundām_stunda_stundas".split("_"),hh:"stundas_stundām_stunda_stundas".split("_"),d:"dienas_dienām_diena_dienas".split("_"),dd:"dienas_dienām_diena_dienas".split("_"),M:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),MM:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")};function n(e,t,n){return n?t%10==1&&t%100!=11?e[2]:e[3]:t%10==1&&t%100!=11?e[0]:e[1]}function o(e,o,r){return e+" "+n(t[r],e,o)}function r(e,o,r){return n(t[r],e,o)}e.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"pēc %s",past:"pirms %s",s:function(e,t){return t?"dažas sekundes":"dažām sekundēm"},ss:o,m:r,mm:o,h:r,hh:o,d:r,dd:o,M:r,MM:o,y:r,yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/me.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["sekund","sekunda","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mjesec","mjeseca","mjeseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("me",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sjutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedjelje] [u] LT","[prošlog] [ponedjeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srijede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"dan",dd:t.translate,M:"mjesec",MM:t.translate,y:"godinu",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mi.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mi",{months:"Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea".split("_"),monthsShort:"Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki".split("_"),monthsRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,weekdays:"Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei".split("_"),weekdaysShort:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),weekdaysMin:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [i] HH:mm",LLLL:"dddd, D MMMM YYYY [i] HH:mm"},calendar:{sameDay:"[i teie mahana, i] LT",nextDay:"[apopo i] LT",nextWeek:"dddd [i] LT",lastDay:"[inanahi i] LT",lastWeek:"dddd [whakamutunga i] LT",sameElse:"L"},relativeTime:{future:"i roto i %s",past:"%s i mua",s:"te hēkona ruarua",ss:"%d hēkona",m:"he meneti",mm:"%d meneti",h:"te haora",hh:"%d haora",d:"he ra",dd:"%d ra",M:"he marama",MM:"%d marama",y:"he tau",yy:"%d tau"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mk.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"[Во] dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"за %s",past:"пред %s",s:"неколку секунди",ss:"%d секунди",m:"една минута",mm:"%d минути",h:"еден час",hh:"%d часа",d:"еден ден",dd:"%d дена",M:"еден месец",MM:"%d месеци",y:"една година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(e){var t=e%10,n=e%100;return 0===e?e+"-ев":0===n?e+"-ен":n>10&&n<20?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ml.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),monthsParseExact:!0,weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",LTS:"A h:mm:ss -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm -നു",LLLL:"dddd, D MMMM YYYY, A h:mm -നു"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",ss:"%d സെക്കൻഡ്",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(e,t){return 12===e&&(e=0),"രാത്രി"===t&&e>=4||"ഉച്ച കഴിഞ്ഞ്"===t||"വൈകുന്നേരം"===t?e+12:e},meridiem:function(e,t,n){return e<4?"രാത്രി":e<12?"രാവിലെ":e<17?"ഉച്ച കഴിഞ്ഞ്":e<20?"വൈകുന്നേരം":"രാത്രി"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mn.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){switch(n){case"s":return t?"хэдхэн секунд":"хэдхэн секундын";case"ss":return e+(t?" секунд":" секундын");case"m":case"mm":return e+(t?" минут":" минутын");case"h":case"hh":return e+(t?" цаг":" цагийн");case"d":case"dd":return e+(t?" өдөр":" өдрийн");case"M":case"MM":return e+(t?" сар":" сарын");case"y":case"yy":return e+(t?" жил":" жилийн");default:return e}}e.defineLocale("mn",{months:"Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар".split("_"),monthsShort:"1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар".split("_"),monthsParseExact:!0,weekdays:"Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба".split("_"),weekdaysShort:"Ням_Дав_Мяг_Лха_Пүр_Баа_Бям".split("_"),weekdaysMin:"Ня_Да_Мя_Лх_Пү_Ба_Бя".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY оны MMMMын D",LLL:"YYYY оны MMMMын D HH:mm",LLLL:"dddd, YYYY оны MMMMын D HH:mm"},meridiemParse:/ҮӨ|ҮХ/i,isPM:function(e){return"ҮХ"===e},meridiem:function(e,t,n){return e<12?"ҮӨ":"ҮХ"},calendar:{sameDay:"[Өнөөдөр] LT",nextDay:"[Маргааш] LT",nextWeek:"[Ирэх] dddd LT",lastDay:"[Өчигдөр] LT",lastWeek:"[Өнгөрсөн] dddd LT",sameElse:"L"},relativeTime:{future:"%s дараа",past:"%s өмнө",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2} өдөр/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+" өдөр";default:return e}}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mr.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};function o(e,t,n,o){var r="";if(t)switch(n){case"s":r="काही सेकंद";break;case"ss":r="%d सेकंद";break;case"m":r="एक मिनिट";break;case"mm":r="%d मिनिटे";break;case"h":r="एक तास";break;case"hh":r="%d तास";break;case"d":r="एक दिवस";break;case"dd":r="%d दिवस";break;case"M":r="एक महिना";break;case"MM":r="%d महिने";break;case"y":r="एक वर्ष";break;case"yy":r="%d वर्षे"}else switch(n){case"s":r="काही सेकंदां";break;case"ss":r="%d सेकंदां";break;case"m":r="एका मिनिटा";break;case"mm":r="%d मिनिटां";break;case"h":r="एका तासा";break;case"hh":r="%d तासां";break;case"d":r="एका दिवसा";break;case"dd":r="%d दिवसां";break;case"M":r="एका महिन्या";break;case"MM":r="%d महिन्यां";break;case"y":r="एका वर्षा";break;case"yy":r="%d वर्षां"}return r.replace(/%d/i,e)}e.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",LTS:"A h:mm:ss वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm वाजता",LLLL:"dddd, D MMMM YYYY, A h:mm वाजता"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%sमध्ये",past:"%sपूर्वी",s:o,ss:o,m:o,mm:o,h:o,hh:o,d:o,dd:o,M:o,MM:o,y:o,yy:o},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/,meridiemHour:function(e,t){return 12===e&&(e=0),"पहाटे"===t||"सकाळी"===t?e:"दुपारी"===t||"सायंकाळी"===t||"रात्री"===t?e>=12?e:e+12:void 0},meridiem:function(e,t,n){return e>=0&&e<6?"पहाटे":e<12?"सकाळी":e<17?"दुपारी":e<20?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ms-my.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"tengahari"===t?e>=11?e:e+12:"petang"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"tengahari":e<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ms.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"tengahari"===t?e>=11?e:e+12:"petang"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"tengahari":e<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mt.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mt",{months:"Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru".split("_"),monthsShort:"Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ".split("_"),weekdays:"Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt".split("_"),weekdaysShort:"Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib".split("_"),weekdaysMin:"Ħa_Tn_Tl_Er_Ħa_Ġi_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Illum fil-]LT",nextDay:"[Għada fil-]LT",nextWeek:"dddd [fil-]LT",lastDay:"[Il-bieraħ fil-]LT",lastWeek:"dddd [li għadda] [fil-]LT",sameElse:"L"},relativeTime:{future:"f’ %s",past:"%s ilu",s:"ftit sekondi",ss:"%d sekondi",m:"minuta",mm:"%d minuti",h:"siegħa",hh:"%d siegħat",d:"ġurnata",dd:"%d ġranet",M:"xahar",MM:"%d xhur",y:"sena",yy:"%d sni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/my.js":function(e,t,n){!function(e){"use strict";var t={1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"},n={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"};e.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",ss:"%d စက္ကန့်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(e){return e.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nb.js":function(e,t,n){!function(e){"use strict";e.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",ss:"%d sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",w:"en uke",ww:"%d uker",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ne.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};e.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),monthsParseExact:!0,weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आ._सो._मं._बु._बि._शु._श.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"Aको h:mm बजे",LTS:"Aको h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, Aको h:mm बजे",LLLL:"dddd, D MMMM YYYY, Aको h:mm बजे"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(e,t){return 12===e&&(e=0),"राति"===t?e<4?e:e+12:"बिहान"===t?e:"दिउँसो"===t?e>=10?e:e+12:"साँझ"===t?e+12:void 0},meridiem:function(e,t,n){return e<3?"राति":e<12?"बिहान":e<16?"दिउँसो":e<20?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडि",s:"केही क्षण",ss:"%d सेकेण्ड",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nl-be.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),o=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl-be",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nl.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),o=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",w:"één week",ww:"%d weken",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"su._må._ty._on._to._fr._lau.".split("_"),weekdaysMin:"su_må_ty_on_to_fr_la".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",ss:"%d sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",w:"ei veke",ww:"%d veker",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/oc-lnc.js":function(e,t,n){!function(e){"use strict";e.defineLocale("oc-lnc",{months:{standalone:"genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre".split("_"),format:"de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dm._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dm_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:"[uèi a] LT",nextDay:"[deman a] LT",nextWeek:"dddd [a] LT",lastDay:"[ièr a] LT",lastWeek:"dddd [passat a] LT",sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"unas segondas",ss:"%d segondas",m:"una minuta",mm:"%d minutas",h:"una ora",hh:"%d oras",d:"un jorn",dd:"%d jorns",M:"un mes",MM:"%d meses",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(e,t){var n=1===e?"r":2===e?"n":3===e?"r":4===e?"t":"è";return"w"!==t&&"W"!==t||(n="a"),e+n},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pa-in.js":function(e,t,n){!function(e){"use strict";var t={1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"},n={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"};e.defineLocale("pa-in",{months:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),monthsShort:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),weekdays:"ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ".split("_"),weekdaysShort:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),weekdaysMin:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),longDateFormat:{LT:"A h:mm ਵਜੇ",LTS:"A h:mm:ss ਵਜੇ",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm ਵਜੇ",LLLL:"dddd, D MMMM YYYY, A h:mm ਵਜੇ"},calendar:{sameDay:"[ਅਜ] LT",nextDay:"[ਕਲ] LT",nextWeek:"[ਅਗਲਾ] dddd, LT",lastDay:"[ਕਲ] LT",lastWeek:"[ਪਿਛਲੇ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ਵਿੱਚ",past:"%s ਪਿਛਲੇ",s:"ਕੁਝ ਸਕਿੰਟ",ss:"%d ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(e){return e.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(e,t){return 12===e&&(e=0),"ਰਾਤ"===t?e<4?e:e+12:"ਸਵੇਰ"===t?e:"ਦੁਪਹਿਰ"===t?e>=10?e:e+12:"ਸ਼ਾਮ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"ਰਾਤ":e<10?"ਸਵੇਰ":e<17?"ਦੁਪਹਿਰ":e<20?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pl.js":function(e,t,n){!function(e){"use strict";var t="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),n="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),o=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^paź/i,/^lis/i,/^gru/i];function r(e){return e%10<5&&e%10>1&&~~(e/10)%10!=1}function s(e,t,n){var o=e+" ";switch(n){case"ss":return o+(r(e)?"sekundy":"sekund");case"m":return t?"minuta":"minutę";case"mm":return o+(r(e)?"minuty":"minut");case"h":return t?"godzina":"godzinę";case"hh":return o+(r(e)?"godziny":"godzin");case"ww":return o+(r(e)?"tygodnie":"tygodni");case"MM":return o+(r(e)?"miesiące":"miesięcy");case"yy":return o+(r(e)?"lata":"lat")}}e.defineLocale("pl",{months:function(e,o){return e?/D MMMM/.test(o)?n[e.month()]:t[e.month()]:t},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_śr_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedzielę o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W środę o] LT";case 6:return"[W sobotę o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:s,m:s,mm:s,h:s,hh:s,d:"1 dzień",dd:"%d dni",w:"tydzień",ww:s,M:"miesiąc",MM:s,y:"rok",yy:s},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pt-br.js":function(e,t,n){!function(e){"use strict";e.defineLocale("pt-br",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"do_2ª_3ª_4ª_5ª_6ª_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"poucos segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",invalidDate:"Data inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pt.js":function(e,t,n){!function(e){"use strict";e.defineLocale("pt",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",w:"uma semana",ww:"%d semanas",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ro.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=" ";return(e%100>=20||e>=100&&e%100==0)&&(o=" de "),e+o+{ss:"secunde",mm:"minute",hh:"ore",dd:"zile",ww:"săptămâni",MM:"luni",yy:"ani"}[n]}e.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",ss:t,m:"un minut",mm:t,h:"o oră",hh:t,d:"o zi",dd:t,w:"o săptămână",ww:t,M:"o lună",MM:t,y:"un an",yy:t},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ru.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"минута":"минуту":e+" "+(o=+e,r={ss:t?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:t?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",ww:"неделя_недели_недель",MM:"месяц_месяца_месяцев",yy:"год_года_лет"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}var n=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i];e.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:n,longMonthsParse:n,shortMonthsParse:n,monthsRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsShortRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsStrictRegex:/^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,monthsShortStrictRegex:/^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},calendar:{sameDay:"[Сегодня, в] LT",nextDay:"[Завтра, в] LT",lastDay:"[Вчера, в] LT",nextWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В следующее] dddd, [в] LT";case 1:case 2:case 4:return"[В следующий] dddd, [в] LT";case 3:case 5:case 6:return"[В следующую] dddd, [в] LT"}},lastWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd, [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd, [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd, [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",ss:t,m:t,mm:t,h:"час",hh:t,d:"день",dd:t,w:"неделя",ww:t,M:"месяц",MM:t,y:"год",yy:t},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(e){return/^(дня|вечера)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночи":e<12?"утра":e<17?"дня":"вечера"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":return e+"-й";case"D":return e+"-го";case"w":case"W":return e+"-я";default:return e}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sd.js":function(e,t,n){!function(e){"use strict";var t=["جنوري","فيبروري","مارچ","اپريل","مئي","جون","جولاءِ","آگسٽ","سيپٽمبر","آڪٽوبر","نومبر","ڊسمبر"],n=["آچر","سومر","اڱارو","اربع","خميس","جمع","ڇنڇر"];e.defineLocale("sd",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,n){return e<12?"صبح":"شام"},calendar:{sameDay:"[اڄ] LT",nextDay:"[سڀاڻي] LT",nextWeek:"dddd [اڳين هفتي تي] LT",lastDay:"[ڪالهه] LT",lastWeek:"[گزريل هفتي] dddd [تي] LT",sameElse:"L"},relativeTime:{future:"%s پوء",past:"%s اڳ",s:"چند سيڪنڊ",ss:"%d سيڪنڊ",m:"هڪ منٽ",mm:"%d منٽ",h:"هڪ ڪلاڪ",hh:"%d ڪلاڪ",d:"هڪ ڏينهن",dd:"%d ڏينهن",M:"هڪ مهينو",MM:"%d مهينا",y:"هڪ سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/se.js":function(e,t,n){!function(e){"use strict";e.defineLocale("se",{months:"ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu".split("_"),monthsShort:"ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov".split("_"),weekdays:"sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat".split("_"),weekdaysShort:"sotn_vuos_maŋ_gask_duor_bear_láv".split("_"),weekdaysMin:"s_v_m_g_d_b_L".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"MMMM D. [b.] YYYY",LLL:"MMMM D. [b.] YYYY [ti.] HH:mm",LLLL:"dddd, MMMM D. [b.] YYYY [ti.] HH:mm"},calendar:{sameDay:"[otne ti] LT",nextDay:"[ihttin ti] LT",nextWeek:"dddd [ti] LT",lastDay:"[ikte ti] LT",lastWeek:"[ovddit] dddd [ti] LT",sameElse:"L"},relativeTime:{future:"%s geažes",past:"maŋit %s",s:"moadde sekunddat",ss:"%d sekunddat",m:"okta minuhta",mm:"%d minuhtat",h:"okta diimmu",hh:"%d diimmut",d:"okta beaivi",dd:"%d beaivvit",M:"okta mánnu",MM:"%d mánut",y:"okta jahki",yy:"%d jagit"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/si.js":function(e,t,n){!function(e){"use strict";e.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),weekdays:"ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),weekdaysShort:"ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන".split("_"),weekdaysMin:"ඉ_ස_අ_බ_බ්‍ර_සි_සෙ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"a h:mm",LTS:"a h:mm:ss",L:"YYYY/MM/DD",LL:"YYYY MMMM D",LLL:"YYYY MMMM D, a h:mm",LLLL:"YYYY MMMM D [වැනි] dddd, a h:mm:ss"},calendar:{sameDay:"[අද] LT[ට]",nextDay:"[හෙට] LT[ට]",nextWeek:"dddd LT[ට]",lastDay:"[ඊයේ] LT[ට]",lastWeek:"[පසුගිය] dddd LT[ට]",sameElse:"L"},relativeTime:{future:"%sකින්",past:"%sකට පෙර",s:"තත්පර කිහිපය",ss:"තත්පර %d",m:"මිනිත්තුව",mm:"මිනිත්තු %d",h:"පැය",hh:"පැය %d",d:"දිනය",dd:"දින %d",M:"මාසය",MM:"මාස %d",y:"වසර",yy:"වසර %d"},dayOfMonthOrdinalParse:/\d{1,2} වැනි/,ordinal:function(e){return e+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(e){return"ප.ව."===e||"පස් වරු"===e},meridiem:function(e,t,n){return e>11?n?"ප.ව.":"පස් වරු":n?"පෙ.ව.":"පෙර වරු"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sk.js":function(e,t,n){!function(e){"use strict";var t="január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),n="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");function o(e){return e>1&&e<5}function r(e,t,n,r){var s=e+" ";switch(n){case"s":return t||r?"pár sekúnd":"pár sekundami";case"ss":return t||r?s+(o(e)?"sekundy":"sekúnd"):s+"sekundami";case"m":return t?"minúta":r?"minútu":"minútou";case"mm":return t||r?s+(o(e)?"minúty":"minút"):s+"minútami";case"h":return t?"hodina":r?"hodinu":"hodinou";case"hh":return t||r?s+(o(e)?"hodiny":"hodín"):s+"hodinami";case"d":return t||r?"deň":"dňom";case"dd":return t||r?s+(o(e)?"dni":"dní"):s+"dňami";case"M":return t||r?"mesiac":"mesiacom";case"MM":return t||r?s+(o(e)?"mesiace":"mesiacov"):s+"mesiacmi";case"y":return t||r?"rok":"rokom";case"yy":return t||r?s+(o(e)?"roky":"rokov"):s+"rokmi"}}e.defineLocale("sk",{months:t,monthsShort:n,weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sl.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r=e+" ";switch(n){case"s":return t||o?"nekaj sekund":"nekaj sekundami";case"ss":return r+(1===e?t?"sekundo":"sekundi":2===e?t||o?"sekundi":"sekundah":e<5?t||o?"sekunde":"sekundah":"sekund");case"m":return t?"ena minuta":"eno minuto";case"mm":return r+(1===e?t?"minuta":"minuto":2===e?t||o?"minuti":"minutama":e<5?t||o?"minute":"minutami":t||o?"minut":"minutami");case"h":return t?"ena ura":"eno uro";case"hh":return r+(1===e?t?"ura":"uro":2===e?t||o?"uri":"urama":e<5?t||o?"ure":"urami":t||o?"ur":"urami");case"d":return t||o?"en dan":"enim dnem";case"dd":return r+(1===e?t||o?"dan":"dnem":2===e?t||o?"dni":"dnevoma":t||o?"dni":"dnevi");case"M":return t||o?"en mesec":"enim mesecem";case"MM":return r+(1===e?t||o?"mesec":"mesecem":2===e?t||o?"meseca":"mesecema":e<5?t||o?"mesece":"meseci":t||o?"mesecev":"meseci");case"y":return t||o?"eno leto":"enim letom";case"yy":return r+(1===e?t||o?"leto":"letom":2===e?t||o?"leti":"letoma":e<5?t||o?"leta":"leti":t||o?"let":"leti")}}e.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prejšnjo] [nedeljo] [ob] LT";case 3:return"[prejšnjo] [sredo] [ob] LT";case 6:return"[prejšnjo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"pred %s",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sq.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),weekdaysParseExact:!0,meridiemParse:/PD|MD/,isPM:function(e){return"M"===e.charAt(0)},meridiem:function(e,t,n){return e<12?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",ss:"%d sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sr-cyrl.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["секунда","секунде","секунди"],m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){return["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"дан",dd:t.translate,M:"месец",MM:t.translate,y:"годину",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sr.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["sekunda","sekunde","sekundi"],m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"dan",dd:t.translate,M:"mesec",MM:t.translate,y:"godinu",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ss.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",ss:"%d mzuzwana",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(e,t,n){return e<11?"ekuseni":e<15?"emini":e<19?"entsambama":"ebusuku"},meridiemHour:function(e,t){return 12===e&&(e=0),"ekuseni"===t?e:"emini"===t?e>=11?e:e+12:"entsambama"===t||"ebusuku"===t?0===e?0:e+12:void 0},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",ss:"%d sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}(\:e|\:a)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?":e":1===t||2===t?":a":":e")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"hh:mm A",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",ss:"sekunde %d",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"siku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ta.js":function(e,t,n){!function(e){"use strict";var t={1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"},n={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"};e.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",ss:"%d விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},dayOfMonthOrdinalParse:/\d{1,2}வது/,ordinal:function(e){return e+"வது"},preparse:function(e){return e.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(e,t,n){return e<2?" யாமம்":e<6?" வைகறை":e<10?" காலை":e<14?" நண்பகல்":e<18?" எற்பாடு":e<22?" மாலை":" யாமம்"},meridiemHour:function(e,t){return 12===e&&(e=0),"யாமம்"===t?e<2?e:e+12:"வைகறை"===t||"காலை"===t||"நண்பகல்"===t&&e>=10?e:e+12},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/te.js":function(e,t,n){!function(e){"use strict";e.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,weekdays:"ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),weekdaysShort:"ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),weekdaysMin:"ఆ_సో_మం_బు_గు_శు_శ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[నేడు] LT",nextDay:"[రేపు] LT",nextWeek:"dddd, LT",lastDay:"[నిన్న] LT",lastWeek:"[గత] dddd, LT",sameElse:"L"},relativeTime:{future:"%s లో",past:"%s క్రితం",s:"కొన్ని క్షణాలు",ss:"%d సెకన్లు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},dayOfMonthOrdinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(e,t){return 12===e&&(e=0),"రాత్రి"===t?e<4?e:e+12:"ఉదయం"===t?e:"మధ్యాహ్నం"===t?e>=10?e:e+12:"సాయంత్రం"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"రాత్రి":e<10?"ఉదయం":e<17?"మధ్యాహ్నం":e<20?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tet.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tet",{months:"Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu".split("_"),weekdaysShort:"Dom_Seg_Ters_Kua_Kint_Sest_Sab".split("_"),weekdaysMin:"Do_Seg_Te_Ku_Ki_Ses_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Ohin iha] LT",nextDay:"[Aban iha] LT",nextWeek:"dddd [iha] LT",lastDay:"[Horiseik iha] LT",lastWeek:"dddd [semana kotuk] [iha] LT",sameElse:"L"},relativeTime:{future:"iha %s",past:"%s liuba",s:"segundu balun",ss:"segundu %d",m:"minutu ida",mm:"minutu %d",h:"oras ida",hh:"oras %d",d:"loron ida",dd:"loron %d",M:"fulan ida",MM:"fulan %d",y:"tinan ida",yy:"tinan %d"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tg.js":function(e,t,n){!function(e){"use strict";var t={0:"-ум",1:"-ум",2:"-юм",3:"-юм",4:"-ум",5:"-ум",6:"-ум",7:"-ум",8:"-ум",9:"-ум",10:"-ум",12:"-ум",13:"-ум",20:"-ум",30:"-юм",40:"-ум",50:"-ум",60:"-ум",70:"-ум",80:"-ум",90:"-ум",100:"-ум"};e.defineLocale("tg",{months:{format:"январи_феврали_марти_апрели_майи_июни_июли_августи_сентябри_октябри_ноябри_декабри".split("_"),standalone:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_")},monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе".split("_"),weekdaysShort:"яшб_дшб_сшб_чшб_пшб_ҷум_шнб".split("_"),weekdaysMin:"яш_дш_сш_чш_пш_ҷм_шб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Имрӯз соати] LT",nextDay:"[Фардо соати] LT",lastDay:"[Дирӯз соати] LT",nextWeek:"dddd[и] [ҳафтаи оянда соати] LT",lastWeek:"dddd[и] [ҳафтаи гузашта соати] LT",sameElse:"L"},relativeTime:{future:"баъди %s",past:"%s пеш",s:"якчанд сония",m:"як дақиқа",mm:"%d дақиқа",h:"як соат",hh:"%d соат",d:"як рӯз",dd:"%d рӯз",M:"як моҳ",MM:"%d моҳ",y:"як сол",yy:"%d сол"},meridiemParse:/шаб|субҳ|рӯз|бегоҳ/,meridiemHour:function(e,t){return 12===e&&(e=0),"шаб"===t?e<4?e:e+12:"субҳ"===t?e:"рӯз"===t?e>=11?e:e+12:"бегоҳ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"шаб":e<11?"субҳ":e<16?"рӯз":e<19?"бегоҳ":"шаб"},dayOfMonthOrdinalParse:/\d{1,2}-(ум|юм)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/th.js":function(e,t,n){!function(e){"use strict";e.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.".split("_"),monthsParseExact:!0,weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H:mm",LLLL:"วันddddที่ D MMMM YYYY เวลา H:mm"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(e){return"หลังเที่ยง"===e},meridiem:function(e,t,n){return e<12?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",ss:"%d วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",w:"1 สัปดาห์",ww:"%d สัปดาห์",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tk.js":function(e,t,n){!function(e){"use strict";var t={1:"'inji",5:"'inji",8:"'inji",70:"'inji",80:"'inji",2:"'nji",7:"'nji",20:"'nji",50:"'nji",3:"'ünji",4:"'ünji",100:"'ünji",6:"'njy",9:"'unjy",10:"'unjy",30:"'unjy",60:"'ynjy",90:"'ynjy"};e.defineLocale("tk",{months:"Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr".split("_"),monthsShort:"Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek".split("_"),weekdays:"Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe".split("_"),weekdaysShort:"Ýek_Duş_Siş_Çar_Pen_Ann_Şen".split("_"),weekdaysMin:"Ýk_Dş_Sş_Çr_Pn_An_Şn".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün sagat] LT",nextDay:"[ertir sagat] LT",nextWeek:"[indiki] dddd [sagat] LT",lastDay:"[düýn] LT",lastWeek:"[geçen] dddd [sagat] LT",sameElse:"L"},relativeTime:{future:"%s soň",past:"%s öň",s:"birnäçe sekunt",m:"bir minut",mm:"%d minut",h:"bir sagat",hh:"%d sagat",d:"bir gün",dd:"%d gün",M:"bir aý",MM:"%d aý",y:"bir ýyl",yy:"%d ýyl"},ordinal:function(e,n){switch(n){case"d":case"D":case"Do":case"DD":return e;default:if(0===e)return e+"'unjy";var o=e%10;return e+(t[o]||t[e%100-o]||t[e>=100?100:null])}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tl-ph.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tlh.js":function(e,t,n){!function(e){"use strict";var t="pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_");function n(e,n,o,r){var s=function(e){var n=Math.floor(e%1e3/100),o=Math.floor(e%100/10),r=e%10,s="";return n>0&&(s+=t[n]+"vatlh"),o>0&&(s+=(""!==s?" ":"")+t[o]+"maH"),r>0&&(s+=(""!==s?" ":"")+t[r]),""===s?"pagh":s}(e);switch(o){case"ss":return s+" lup";case"mm":return s+" tup";case"hh":return s+" rep";case"dd":return s+" jaj";case"MM":return s+" jar";case"yy":return s+" DIS"}}e.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:function(e){var t=e;return-1!==e.indexOf("jaj")?t.slice(0,-3)+"leS":-1!==e.indexOf("jar")?t.slice(0,-3)+"waQ":-1!==e.indexOf("DIS")?t.slice(0,-3)+"nem":t+" pIq"},past:function(e){var t=e;return-1!==e.indexOf("jaj")?t.slice(0,-3)+"Hu’":-1!==e.indexOf("jar")?t.slice(0,-3)+"wen":-1!==e.indexOf("DIS")?t.slice(0,-3)+"ben":t+" ret"},s:"puS lup",ss:n,m:"wa’ tup",mm:n,h:"wa’ rep",hh:n,d:"wa’ jaj",dd:n,M:"wa’ jar",MM:n,y:"wa’ DIS",yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tr.js":function(e,t,n){!function(e){"use strict";var t={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"};e.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),meridiem:function(e,t,n){return e<12?n?"öö":"ÖÖ":n?"ös":"ÖS"},meridiemParse:/öö|ÖÖ|ös|ÖS/,isPM:function(e){return"ös"===e||"ÖS"===e},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[gelecek] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",ss:"%d saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",w:"bir hafta",ww:"%d hafta",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(e,n){switch(n){case"d":case"D":case"Do":case"DD":return e;default:if(0===e)return e+"'ıncı";var o=e%10;return e+(t[o]||t[e%100-o]||t[e>=100?100:null])}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzl.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["viensas secunds","'iensas secunds"],ss:[e+" secunds",e+" secunds"],m:["'n míut","'iens míut"],mm:[e+" míuts",e+" míuts"],h:["'n þora","'iensa þora"],hh:[e+" þoras",e+" þoras"],d:["'n ziua","'iensa ziua"],dd:[e+" ziuas",e+" ziuas"],M:["'n mes","'iens mes"],MM:[e+" mesen",e+" mesen"],y:["'n ar","'iens ar"],yy:[e+" ars",e+" ars"]};return o||t?r[n][0]:r[n][1]}e.defineLocale("tzl",{months:"Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),weekdaysShort:"Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),weekdaysMin:"Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(e){return"d'o"===e.toLowerCase()},meridiem:function(e,t,n){return e>11?n?"d'o":"D'O":n?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzm-latn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",ss:"%d imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzm.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",ss:"%d ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ug-cn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ug-cn",{months:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),monthsShort:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),weekdays:"يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە".split("_"),weekdaysShort:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),weekdaysMin:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY-يىلىM-ئاينىڭD-كۈنى",LLL:"YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm",LLLL:"dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm"},meridiemParse:/يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/,meridiemHour:function(e,t){return 12===e&&(e=0),"يېرىم كېچە"===t||"سەھەر"===t||"چۈشتىن بۇرۇن"===t?e:"چۈشتىن كېيىن"===t||"كەچ"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,n){var o=100*e+t;return o<600?"يېرىم كېچە":o<900?"سەھەر":o<1130?"چۈشتىن بۇرۇن":o<1230?"چۈش":o<1800?"چۈشتىن كېيىن":"كەچ"},calendar:{sameDay:"[بۈگۈن سائەت] LT",nextDay:"[ئەتە سائەت] LT",nextWeek:"[كېلەركى] dddd [سائەت] LT",lastDay:"[تۆنۈگۈن] LT",lastWeek:"[ئالدىنقى] dddd [سائەت] LT",sameElse:"L"},relativeTime:{future:"%s كېيىن",past:"%s بۇرۇن",s:"نەچچە سېكونت",ss:"%d سېكونت",m:"بىر مىنۇت",mm:"%d مىنۇت",h:"بىر سائەت",hh:"%d سائەت",d:"بىر كۈن",dd:"%d كۈن",M:"بىر ئاي",MM:"%d ئاي",y:"بىر يىل",yy:"%d يىل"},dayOfMonthOrdinalParse:/\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"-كۈنى";case"w":case"W":return e+"-ھەپتە";default:return e}},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uk.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"хвилина":"хвилину":"h"===n?t?"година":"годину":e+" "+(o=+e,r={ss:t?"секунда_секунди_секунд":"секунду_секунди_секунд",mm:t?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:t?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}function n(e){return function(){return e+"о"+(11===this.hours()?"б":"")+"] LT"}}e.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:function(e,t){var n={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")};return!0===e?n.nominative.slice(1,7).concat(n.nominative.slice(0,1)):e?n[/(\[[ВвУу]\]) ?dddd/.test(t)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(t)?"genitive":"nominative"][e.day()]:n.nominative},weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:n("[Сьогодні "),nextDay:n("[Завтра "),lastDay:n("[Вчора "),nextWeek:n("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return n("[Минулої] dddd [").call(this);case 1:case 2:case 4:return n("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",ss:t,m:t,mm:t,h:"годину",hh:t,d:"день",dd:t,M:"місяць",MM:t,y:"рік",yy:t},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(e){return/^(дня|вечора)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночі":e<12?"ранку":e<17?"дня":"вечора"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e+"-й";case"D":return e+"-го";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ur.js":function(e,t,n){!function(e){"use strict";var t=["جنوری","فروری","مارچ","اپریل","مئی","جون","جولائی","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],n=["اتوار","پیر","منگل","بدھ","جمعرات","جمعہ","ہفتہ"];e.defineLocale("ur",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,n){return e<12?"صبح":"شام"},calendar:{sameDay:"[آج بوقت] LT",nextDay:"[کل بوقت] LT",nextWeek:"dddd [بوقت] LT",lastDay:"[گذشتہ روز بوقت] LT",lastWeek:"[گذشتہ] dddd [بوقت] LT",sameElse:"L"},relativeTime:{future:"%s بعد",past:"%s قبل",s:"چند سیکنڈ",ss:"%d سیکنڈ",m:"ایک منٹ",mm:"%d منٹ",h:"ایک گھنٹہ",hh:"%d گھنٹے",d:"ایک دن",dd:"%d دن",M:"ایک ماہ",MM:"%d ماہ",y:"ایک سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uz-latn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uz.js":function(e,t,n){!function(e){"use strict";e.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",ss:"%d фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/vi.js":function(e,t,n){!function(e){"use strict";e.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(e){return/^ch$/i.test(e)},meridiem:function(e,t,n){return e<12?n?"sa":"SA":n?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần trước lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",ss:"%d giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",w:"một tuần",ww:"%d tuần",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/x-pseudo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",ss:"%d s~écóñ~ds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/yo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("yo",{months:"Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),monthsShort:"Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),weekdays:"Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),weekdaysShort:"Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),weekdaysMin:"Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Ònì ni] LT",nextDay:"[Ọ̀la ni] LT",nextWeek:"dddd [Ọsẹ̀ tón'bọ] [ni] LT",lastDay:"[Àna ni] LT",lastWeek:"dddd [Ọsẹ̀ tólọ́] [ni] LT",sameElse:"L"},relativeTime:{future:"ní %s",past:"%s kọjá",s:"ìsẹjú aayá die",ss:"aayá %d",m:"ìsẹjú kan",mm:"ìsẹjú %d",h:"wákati kan",hh:"wákati %d",d:"ọjọ́ kan",dd:"ọjọ́ %d",M:"osù kan",MM:"osù %d",y:"ọdún kan",yy:"ọdún %d"},dayOfMonthOrdinalParse:/ọjọ́\s\d{1,2}/,ordinal:"ọjọ́ %d",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-cn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"下午"===t||"晚上"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:function(e){return e.week()!==this.week()?"[下]dddLT":"[本]dddLT"},lastDay:"[昨天]LT",lastWeek:function(e){return this.week()!==e.week()?"[上]dddLT":"[本]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"周";default:return e}},relativeTime:{future:"%s后",past:"%s前",s:"几秒",ss:"%d 秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",w:"1 周",ww:"%d 周",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-hk.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1200?"上午":1200===o?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-mo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-tw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale sync recursive ^\\.\\/.*$":(e,t,n)=>{var o={"./af":"./node_modules/moment/locale/af.js","./af.js":"./node_modules/moment/locale/af.js","./ar":"./node_modules/moment/locale/ar.js","./ar-dz":"./node_modules/moment/locale/ar-dz.js","./ar-dz.js":"./node_modules/moment/locale/ar-dz.js","./ar-kw":"./node_modules/moment/locale/ar-kw.js","./ar-kw.js":"./node_modules/moment/locale/ar-kw.js","./ar-ly":"./node_modules/moment/locale/ar-ly.js","./ar-ly.js":"./node_modules/moment/locale/ar-ly.js","./ar-ma":"./node_modules/moment/locale/ar-ma.js","./ar-ma.js":"./node_modules/moment/locale/ar-ma.js","./ar-sa":"./node_modules/moment/locale/ar-sa.js","./ar-sa.js":"./node_modules/moment/locale/ar-sa.js","./ar-tn":"./node_modules/moment/locale/ar-tn.js","./ar-tn.js":"./node_modules/moment/locale/ar-tn.js","./ar.js":"./node_modules/moment/locale/ar.js","./az":"./node_modules/moment/locale/az.js","./az.js":"./node_modules/moment/locale/az.js","./be":"./node_modules/moment/locale/be.js","./be.js":"./node_modules/moment/locale/be.js","./bg":"./node_modules/moment/locale/bg.js","./bg.js":"./node_modules/moment/locale/bg.js","./bm":"./node_modules/moment/locale/bm.js","./bm.js":"./node_modules/moment/locale/bm.js","./bn":"./node_modules/moment/locale/bn.js","./bn-bd":"./node_modules/moment/locale/bn-bd.js","./bn-bd.js":"./node_modules/moment/locale/bn-bd.js","./bn.js":"./node_modules/moment/locale/bn.js","./bo":"./node_modules/moment/locale/bo.js","./bo.js":"./node_modules/moment/locale/bo.js","./br":"./node_modules/moment/locale/br.js","./br.js":"./node_modules/moment/locale/br.js","./bs":"./node_modules/moment/locale/bs.js","./bs.js":"./node_modules/moment/locale/bs.js","./ca":"./node_modules/moment/locale/ca.js","./ca.js":"./node_modules/moment/locale/ca.js","./cs":"./node_modules/moment/locale/cs.js","./cs.js":"./node_modules/moment/locale/cs.js","./cv":"./node_modules/moment/locale/cv.js","./cv.js":"./node_modules/moment/locale/cv.js","./cy":"./node_modules/moment/locale/cy.js","./cy.js":"./node_modules/moment/locale/cy.js","./da":"./node_modules/moment/locale/da.js","./da.js":"./node_modules/moment/locale/da.js","./de":"./node_modules/moment/locale/de.js","./de-at":"./node_modules/moment/locale/de-at.js","./de-at.js":"./node_modules/moment/locale/de-at.js","./de-ch":"./node_modules/moment/locale/de-ch.js","./de-ch.js":"./node_modules/moment/locale/de-ch.js","./de.js":"./node_modules/moment/locale/de.js","./dv":"./node_modules/moment/locale/dv.js","./dv.js":"./node_modules/moment/locale/dv.js","./el":"./node_modules/moment/locale/el.js","./el.js":"./node_modules/moment/locale/el.js","./en-au":"./node_modules/moment/locale/en-au.js","./en-au.js":"./node_modules/moment/locale/en-au.js","./en-ca":"./node_modules/moment/locale/en-ca.js","./en-ca.js":"./node_modules/moment/locale/en-ca.js","./en-gb":"./node_modules/moment/locale/en-gb.js","./en-gb.js":"./node_modules/moment/locale/en-gb.js","./en-ie":"./node_modules/moment/locale/en-ie.js","./en-ie.js":"./node_modules/moment/locale/en-ie.js","./en-il":"./node_modules/moment/locale/en-il.js","./en-il.js":"./node_modules/moment/locale/en-il.js","./en-in":"./node_modules/moment/locale/en-in.js","./en-in.js":"./node_modules/moment/locale/en-in.js","./en-nz":"./node_modules/moment/locale/en-nz.js","./en-nz.js":"./node_modules/moment/locale/en-nz.js","./en-sg":"./node_modules/moment/locale/en-sg.js","./en-sg.js":"./node_modules/moment/locale/en-sg.js","./eo":"./node_modules/moment/locale/eo.js","./eo.js":"./node_modules/moment/locale/eo.js","./es":"./node_modules/moment/locale/es.js","./es-do":"./node_modules/moment/locale/es-do.js","./es-do.js":"./node_modules/moment/locale/es-do.js","./es-mx":"./node_modules/moment/locale/es-mx.js","./es-mx.js":"./node_modules/moment/locale/es-mx.js","./es-us":"./node_modules/moment/locale/es-us.js","./es-us.js":"./node_modules/moment/locale/es-us.js","./es.js":"./node_modules/moment/locale/es.js","./et":"./node_modules/moment/locale/et.js","./et.js":"./node_modules/moment/locale/et.js","./eu":"./node_modules/moment/locale/eu.js","./eu.js":"./node_modules/moment/locale/eu.js","./fa":"./node_modules/moment/locale/fa.js","./fa.js":"./node_modules/moment/locale/fa.js","./fi":"./node_modules/moment/locale/fi.js","./fi.js":"./node_modules/moment/locale/fi.js","./fil":"./node_modules/moment/locale/fil.js","./fil.js":"./node_modules/moment/locale/fil.js","./fo":"./node_modules/moment/locale/fo.js","./fo.js":"./node_modules/moment/locale/fo.js","./fr":"./node_modules/moment/locale/fr.js","./fr-ca":"./node_modules/moment/locale/fr-ca.js","./fr-ca.js":"./node_modules/moment/locale/fr-ca.js","./fr-ch":"./node_modules/moment/locale/fr-ch.js","./fr-ch.js":"./node_modules/moment/locale/fr-ch.js","./fr.js":"./node_modules/moment/locale/fr.js","./fy":"./node_modules/moment/locale/fy.js","./fy.js":"./node_modules/moment/locale/fy.js","./ga":"./node_modules/moment/locale/ga.js","./ga.js":"./node_modules/moment/locale/ga.js","./gd":"./node_modules/moment/locale/gd.js","./gd.js":"./node_modules/moment/locale/gd.js","./gl":"./node_modules/moment/locale/gl.js","./gl.js":"./node_modules/moment/locale/gl.js","./gom-deva":"./node_modules/moment/locale/gom-deva.js","./gom-deva.js":"./node_modules/moment/locale/gom-deva.js","./gom-latn":"./node_modules/moment/locale/gom-latn.js","./gom-latn.js":"./node_modules/moment/locale/gom-latn.js","./gu":"./node_modules/moment/locale/gu.js","./gu.js":"./node_modules/moment/locale/gu.js","./he":"./node_modules/moment/locale/he.js","./he.js":"./node_modules/moment/locale/he.js","./hi":"./node_modules/moment/locale/hi.js","./hi.js":"./node_modules/moment/locale/hi.js","./hr":"./node_modules/moment/locale/hr.js","./hr.js":"./node_modules/moment/locale/hr.js","./hu":"./node_modules/moment/locale/hu.js","./hu.js":"./node_modules/moment/locale/hu.js","./hy-am":"./node_modules/moment/locale/hy-am.js","./hy-am.js":"./node_modules/moment/locale/hy-am.js","./id":"./node_modules/moment/locale/id.js","./id.js":"./node_modules/moment/locale/id.js","./is":"./node_modules/moment/locale/is.js","./is.js":"./node_modules/moment/locale/is.js","./it":"./node_modules/moment/locale/it.js","./it-ch":"./node_modules/moment/locale/it-ch.js","./it-ch.js":"./node_modules/moment/locale/it-ch.js","./it.js":"./node_modules/moment/locale/it.js","./ja":"./node_modules/moment/locale/ja.js","./ja.js":"./node_modules/moment/locale/ja.js","./jv":"./node_modules/moment/locale/jv.js","./jv.js":"./node_modules/moment/locale/jv.js","./ka":"./node_modules/moment/locale/ka.js","./ka.js":"./node_modules/moment/locale/ka.js","./kk":"./node_modules/moment/locale/kk.js","./kk.js":"./node_modules/moment/locale/kk.js","./km":"./node_modules/moment/locale/km.js","./km.js":"./node_modules/moment/locale/km.js","./kn":"./node_modules/moment/locale/kn.js","./kn.js":"./node_modules/moment/locale/kn.js","./ko":"./node_modules/moment/locale/ko.js","./ko.js":"./node_modules/moment/locale/ko.js","./ku":"./node_modules/moment/locale/ku.js","./ku.js":"./node_modules/moment/locale/ku.js","./ky":"./node_modules/moment/locale/ky.js","./ky.js":"./node_modules/moment/locale/ky.js","./lb":"./node_modules/moment/locale/lb.js","./lb.js":"./node_modules/moment/locale/lb.js","./lo":"./node_modules/moment/locale/lo.js","./lo.js":"./node_modules/moment/locale/lo.js","./lt":"./node_modules/moment/locale/lt.js","./lt.js":"./node_modules/moment/locale/lt.js","./lv":"./node_modules/moment/locale/lv.js","./lv.js":"./node_modules/moment/locale/lv.js","./me":"./node_modules/moment/locale/me.js","./me.js":"./node_modules/moment/locale/me.js","./mi":"./node_modules/moment/locale/mi.js","./mi.js":"./node_modules/moment/locale/mi.js","./mk":"./node_modules/moment/locale/mk.js","./mk.js":"./node_modules/moment/locale/mk.js","./ml":"./node_modules/moment/locale/ml.js","./ml.js":"./node_modules/moment/locale/ml.js","./mn":"./node_modules/moment/locale/mn.js","./mn.js":"./node_modules/moment/locale/mn.js","./mr":"./node_modules/moment/locale/mr.js","./mr.js":"./node_modules/moment/locale/mr.js","./ms":"./node_modules/moment/locale/ms.js","./ms-my":"./node_modules/moment/locale/ms-my.js","./ms-my.js":"./node_modules/moment/locale/ms-my.js","./ms.js":"./node_modules/moment/locale/ms.js","./mt":"./node_modules/moment/locale/mt.js","./mt.js":"./node_modules/moment/locale/mt.js","./my":"./node_modules/moment/locale/my.js","./my.js":"./node_modules/moment/locale/my.js","./nb":"./node_modules/moment/locale/nb.js","./nb.js":"./node_modules/moment/locale/nb.js","./ne":"./node_modules/moment/locale/ne.js","./ne.js":"./node_modules/moment/locale/ne.js","./nl":"./node_modules/moment/locale/nl.js","./nl-be":"./node_modules/moment/locale/nl-be.js","./nl-be.js":"./node_modules/moment/locale/nl-be.js","./nl.js":"./node_modules/moment/locale/nl.js","./nn":"./node_modules/moment/locale/nn.js","./nn.js":"./node_modules/moment/locale/nn.js","./oc-lnc":"./node_modules/moment/locale/oc-lnc.js","./oc-lnc.js":"./node_modules/moment/locale/oc-lnc.js","./pa-in":"./node_modules/moment/locale/pa-in.js","./pa-in.js":"./node_modules/moment/locale/pa-in.js","./pl":"./node_modules/moment/locale/pl.js","./pl.js":"./node_modules/moment/locale/pl.js","./pt":"./node_modules/moment/locale/pt.js","./pt-br":"./node_modules/moment/locale/pt-br.js","./pt-br.js":"./node_modules/moment/locale/pt-br.js","./pt.js":"./node_modules/moment/locale/pt.js","./ro":"./node_modules/moment/locale/ro.js","./ro.js":"./node_modules/moment/locale/ro.js","./ru":"./node_modules/moment/locale/ru.js","./ru.js":"./node_modules/moment/locale/ru.js","./sd":"./node_modules/moment/locale/sd.js","./sd.js":"./node_modules/moment/locale/sd.js","./se":"./node_modules/moment/locale/se.js","./se.js":"./node_modules/moment/locale/se.js","./si":"./node_modules/moment/locale/si.js","./si.js":"./node_modules/moment/locale/si.js","./sk":"./node_modules/moment/locale/sk.js","./sk.js":"./node_modules/moment/locale/sk.js","./sl":"./node_modules/moment/locale/sl.js","./sl.js":"./node_modules/moment/locale/sl.js","./sq":"./node_modules/moment/locale/sq.js","./sq.js":"./node_modules/moment/locale/sq.js","./sr":"./node_modules/moment/locale/sr.js","./sr-cyrl":"./node_modules/moment/locale/sr-cyrl.js","./sr-cyrl.js":"./node_modules/moment/locale/sr-cyrl.js","./sr.js":"./node_modules/moment/locale/sr.js","./ss":"./node_modules/moment/locale/ss.js","./ss.js":"./node_modules/moment/locale/ss.js","./sv":"./node_modules/moment/locale/sv.js","./sv.js":"./node_modules/moment/locale/sv.js","./sw":"./node_modules/moment/locale/sw.js","./sw.js":"./node_modules/moment/locale/sw.js","./ta":"./node_modules/moment/locale/ta.js","./ta.js":"./node_modules/moment/locale/ta.js","./te":"./node_modules/moment/locale/te.js","./te.js":"./node_modules/moment/locale/te.js","./tet":"./node_modules/moment/locale/tet.js","./tet.js":"./node_modules/moment/locale/tet.js","./tg":"./node_modules/moment/locale/tg.js","./tg.js":"./node_modules/moment/locale/tg.js","./th":"./node_modules/moment/locale/th.js","./th.js":"./node_modules/moment/locale/th.js","./tk":"./node_modules/moment/locale/tk.js","./tk.js":"./node_modules/moment/locale/tk.js","./tl-ph":"./node_modules/moment/locale/tl-ph.js","./tl-ph.js":"./node_modules/moment/locale/tl-ph.js","./tlh":"./node_modules/moment/locale/tlh.js","./tlh.js":"./node_modules/moment/locale/tlh.js","./tr":"./node_modules/moment/locale/tr.js","./tr.js":"./node_modules/moment/locale/tr.js","./tzl":"./node_modules/moment/locale/tzl.js","./tzl.js":"./node_modules/moment/locale/tzl.js","./tzm":"./node_modules/moment/locale/tzm.js","./tzm-latn":"./node_modules/moment/locale/tzm-latn.js","./tzm-latn.js":"./node_modules/moment/locale/tzm-latn.js","./tzm.js":"./node_modules/moment/locale/tzm.js","./ug-cn":"./node_modules/moment/locale/ug-cn.js","./ug-cn.js":"./node_modules/moment/locale/ug-cn.js","./uk":"./node_modules/moment/locale/uk.js","./uk.js":"./node_modules/moment/locale/uk.js","./ur":"./node_modules/moment/locale/ur.js","./ur.js":"./node_modules/moment/locale/ur.js","./uz":"./node_modules/moment/locale/uz.js","./uz-latn":"./node_modules/moment/locale/uz-latn.js","./uz-latn.js":"./node_modules/moment/locale/uz-latn.js","./uz.js":"./node_modules/moment/locale/uz.js","./vi":"./node_modules/moment/locale/vi.js","./vi.js":"./node_modules/moment/locale/vi.js","./x-pseudo":"./node_modules/moment/locale/x-pseudo.js","./x-pseudo.js":"./node_modules/moment/locale/x-pseudo.js","./yo":"./node_modules/moment/locale/yo.js","./yo.js":"./node_modules/moment/locale/yo.js","./zh-cn":"./node_modules/moment/locale/zh-cn.js","./zh-cn.js":"./node_modules/moment/locale/zh-cn.js","./zh-hk":"./node_modules/moment/locale/zh-hk.js","./zh-hk.js":"./node_modules/moment/locale/zh-hk.js","./zh-mo":"./node_modules/moment/locale/zh-mo.js","./zh-mo.js":"./node_modules/moment/locale/zh-mo.js","./zh-tw":"./node_modules/moment/locale/zh-tw.js","./zh-tw.js":"./node_modules/moment/locale/zh-tw.js"};function r(e){var t=s(e);return n(t)}function s(e){if(!n.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}r.keys=function(){return Object.keys(o)},r.resolve=s,e.exports=r,r.id="./node_modules/moment/locale sync recursive ^\\.\\/.*$"},"./node_modules/ng-csv/build/ng-csv.min.js":(e,t)=>{var n;n=window,document,angular.module("ngCsv.config",[]).value("ngCsv.config",{debug:!0}).config(["$compileProvider",function(e){angular.isDefined(e.urlSanitizationWhitelist)?e.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|data):/):e.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|data):/)}]),angular.module("ngCsv.directives",["ngCsv.services"]),angular.module("ngCsv.services",[]),angular.module("ngCsv",["ngCsv.config","ngCsv.services","ngCsv.directives","ngSanitize"]),e.exports===t&&(e.exports="ngCsv"),angular.module("ngCsv.services").service("CSV",["$q",function(e){var t="\r\n",n={"\\t":"\t","\\b":"\b","\\v":"\v","\\f":"\f","\\r":"\r"};this.stringifyField=function(e,t){return"locale"===t.decimalSep&&this.isFloat(e)?e.toLocaleString():"."!==t.decimalSep&&this.isFloat(e)?e.toString().replace(".",t.decimalSep):"string"==typeof e?(e=e.replace(/"/g,'""'),(t.quoteStrings||e.indexOf(",")>-1||e.indexOf("\n")>-1||e.indexOf("\r")>-1)&&(e=t.txtDelim+e+t.txtDelim),e):"boolean"==typeof e?e?"TRUE":"FALSE":e},this.isFloat=function(e){return+e===e&&(!isFinite(e)||Boolean(e%1))},this.stringify=function(n,o){var r=e.defer(),s=this,a="",i="",d=e.when(n).then((function(e){var n,d;angular.isDefined(o.header)&&o.header&&(n=[],angular.forEach(o.header,(function(e){this.push(s.stringifyField(e,o))}),n),d=n.join(o.fieldSep?o.fieldSep:","),i+=d+t);var u,m,l=[];angular.isArray(e)?l=e:angular.isFunction(e)&&(l=e()),angular.isDefined(o.label)&&o.label&&"boolean"==typeof o.label&&(u=[],angular.forEach(l[0],(function(e,t){this.push(s.stringifyField(t,o))}),u),m=u.join(o.fieldSep?o.fieldSep:","),i+=m+t),angular.forEach(l,(function(e,n){var r,a,d=angular.copy(l[n]);a=[];var u=o.columnOrder?o.columnOrder:d;angular.forEach(u,(function(e){var t=o.columnOrder?d[e]:e;this.push(s.stringifyField(t,o))}),a),r=a.join(o.fieldSep?o.fieldSep:","),i+=n'),i=angular.element(a.children()[0]);i.attr("href",n.URL.createObjectURL(o)),i.attr("download",e.getFilename()),i.attr("target","_blank"),r.find("body").append(a),s((function(){i[0].click(),i.remove()}),null)}}()})),e.$apply()}))}}}])},"./src/js/audio-player/audio-player.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/fe333c40841e29976a89.html"},"./src/js/chat/chat.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/591bf8c202d03863c86d.html"},"./src/js/closing/closing.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/2444367602029f7ce07b.html"},"./src/js/document-wrapper/document-wrapper.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/7b7643d87e862e440656.html"}}]); -//# sourceMappingURL=chat-e96e9bea.js.map \ No newline at end of file diff --git a/snippet/3.8.0/scripts/chat-e96e9bea.js.LICENSE.txt b/snippet/3.8.0/scripts/chat-e96e9bea.js.LICENSE.txt deleted file mode 100644 index 0c56e30..0000000 --- a/snippet/3.8.0/scripts/chat-e96e9bea.js.LICENSE.txt +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @license AngularJS v1.8.2 - * (c) 2010-2020 Google LLC. http://angularjs.org - * License: MIT - */ - -//! moment.js locale configuration diff --git a/snippet/3.8.0/scripts/chat-e96e9bea.js.map b/snippet/3.8.0/scripts/chat-e96e9bea.js.map deleted file mode 100644 index dae47cd..0000000 --- a/snippet/3.8.0/scripts/chat-e96e9bea.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scripts/chat-e96e9bea.js","mappings":";0MAOAA,QAAQC,OAAO,gBAAiB,IAC/BC,SAAS,eAAe,WACvB,aAMAC,KAAKC,SAAW,GAQhBD,KAAKE,QAAU,SAAUC,GACvB,OAAO,IAAIC,EAAKD,IASlBH,KAAKK,OAAS,GASdL,KAAKM,GAAK,SAAUC,EAAOC,GACzBR,KAAKK,OAAOI,KAAK,CAACF,EAAOC,KAG3BR,KAAKU,KAAO,WACV,IAAIC,EAAKX,KAAKE,QACVD,EAAWD,KAAKC,SAChBI,EAASL,KAAKK,OAClB,MAAO,CACL,OAAU,SAASO,GAEjB,IAAIC,EAAOF,EAAGd,QAAQiB,OAAO,GAAIb,EAAUW,IAI3C,OAHAf,QAAQkB,QAAQV,GAAQ,SAAUE,GAChCM,EAAKP,GAAGC,EAAM,GAAIA,EAAM,OAEnBM,QAKfhB,QAAQC,OAAO,YAAa,CAAC,kBAC1BkB,WAAW,WAAY,CAAC,SAAU,SAAU,SAAU,cACvD,SAAUC,EAAQC,EAAQC,EAAQC,GAEhC,IAAIjB,EAAUN,QAAQiB,OAAO,GAAIG,EAAOI,MAAMH,EAAOI,WAGjDT,EAAQI,EAAOI,MAAMH,EAAOK,aAAeH,EAAYI,OAAOrB,GAE9DsB,EAAkB,SAASC,GAC7B,IAAIC,EAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,EAAKM,QACL,IAAI1B,EAAQU,EAAOiB,WAAWC,MAAMlB,EAAQ,CAAC,SAAWS,EAAWb,GAAMuB,OAAOT,IAMhF,GALI,CACF,SAAW,EAAG,eAAiB,EAAG,YAAe,EAAG,UAAa,EAAG,SAAY,GAChFD,IACAT,EAAOoB,cAEL9B,EAAM+B,iBACR,OAAO,GAIXzB,EAAKP,GAAG,WAAYmB,GACpBR,EAAOsB,IAAI,YAAY,WACnB1B,EAAK2B,IAAI,WAAYf,MAGzBR,EAAOwB,MAAQ5B,EAEXK,EAAOwB,eAAe,cACxBvB,EAAOD,EAAOyB,UAAUC,OAAO3B,EAAQJ,GACvCI,EAAOsB,IAAI,YAAY,WACrBpB,EAAOD,EAAOyB,UAAUC,OAAO3B,UAIpC4B,UAAU,WAAY,CAAC,WACtB,MAAO,CACLC,OAAO,EACP9B,WAAY,eAGlBnB,QAAQC,OAAO,WAAY,CAAC,cAC3B+C,UAAU,UAAW,CAAC,WACrB,MAAO,CACL,SAAY,KACZ,OAAS,EACT,QAAW,YACX,KAAQ,SAASC,EAAOC,EAASC,GAC/B,IAAIC,EAAcD,EAAMN,eAAe,iBACnCQ,EAAeF,EAAMN,eAAe,kBACpCS,EAAaH,EAAMN,eAAe,cAAgBI,EAAMzB,MAAM2B,EAAMI,WACxEN,EAAML,MAAMY,aAAaN,EAASE,EAAaC,EAAcC,QAInEtD,QAAQC,OAAO,kBAAmB,CAAC,cAKhC+C,UAAU,mBAAmB,WAC5B,MAAO,CACL,OAAS,EACT,KAAQ,SAASC,EAAOC,EAASC,GAC/BD,EAAQO,KAAK,iBAAiB,SAAU/C,GACtCA,EAAMgD,yBASbV,UAAU,gBAAiB,CAAC,WAAY,SAASW,GAChD,MAAO,CACL,OAAS,EACT,KAAQ,SAASV,EAAOC,EAASC,GAC/B,IAAIS,EACAC,GAAQ,EACZX,EAAQO,KAAK,YAAY,SAAU/C,GAmBnC,IAAoBoD,EACdC,EACAC,EADAD,GAAW,EACXC,GAFcF,EAlBFpD,GAoBasD,cAAgBF,EAAUG,cAAcD,aACrEhE,QAAQkB,QAAQ8C,GAAgBA,EAAaE,OAAO,SAASC,GAC/C,UAARA,IACFJ,GAAW,MAGRA,IAvBFF,IACHZ,EAAMmB,OAAOjB,EAAMkB,eACnBR,GAAQ,GAEVF,EAASW,OAAOV,GAChBlD,EAAMgD,qBAERR,EAAQO,KAAK,kBAAkB,SAAU/C,GACvCiD,EAASW,OAAOV,GAChBA,EAAUD,GAAS,WACjBV,EAAMzB,MAAM2B,EAAMoB,eAClBX,EAAU,KACVC,GAAQ,IACP,aAgBb7D,QAAQC,OAAO,YAAa,CAAC,cAC5B+C,UAAU,YAAY,WACrB,MAAO,CACL,OAAS,EACT,QAAW,YACX,KAAQ,SAASC,EAAOC,EAASC,GAY/B,SAASqB,IACPvB,EAAML,MAAM4B,WAAWtB,GAZrBC,EAAMsB,gBACRxB,EAAMyB,OAAOvB,EAAMsB,iBAAiB,SAAUE,GACxCA,EACFH,IAYJvB,EAAML,MAAMgC,aAAa1B,MANzBsB,SAYP,SAAUxE,GAAU,aACnB,IAAIC,EAASD,EAAQC,OAAO,cAAe,CAAC,cAgB5CD,EAAQkB,QAfK,CACX2D,YAAa,CAAC,QAAS,YACvBC,aAAc,CAAC,SACfC,UAAW,CAAC,QAAS,UACrBC,WAAY,CAAC,SAAU,UACvBC,eAAgB,CAAC,SAAU,UAC3BC,UAAW,CAAC,SACZC,YAAa,CAAC,SACdC,UAAW,CAAC,QAAS,YACrBC,YAAa,GACbC,SAAU,GACVC,SAAU,GACVC,MAAO,CAAC,WAAY,WAGE,SAAUC,EAAW5D,GAC3C,IA4B6B6D,EA5BzBC,EAAO,SA4BkBD,EA5Ba7D,GA6B5B+D,OAAO,GAAGC,cAAgBH,EAAOzD,MAAM,IA5BzC,mBAAR0D,IACFA,EAAO,qBAET1F,EAAO+C,UAAU2C,EAAM,CAAC,WACtB,MAAO,CACLG,QAAS,YACT3E,WAAY,CAAC,SAAU,SAAU,SAAUC,EAAQC,GACjDD,EAAOsB,IAAI,SAAWb,GAAW,WAC/B,IAAIkE,EAAWhE,MAAMC,UAAUC,MAAMC,KAAKC,WACtCzB,EAAQqF,EAAS3D,QAErB,GAAIhB,EAAOwB,QAAUmD,EAAS3D,QAA9B,CAGA,IAAIN,EAAO,GACX9B,EAAQkB,QAAQuE,GAAW,SAASd,EAAOqB,GACzClE,EAAK6C,GAASoB,EAASC,OAEgB,IAArC5E,EAAOI,MAAMH,EAAOsE,GAAO7D,IAC7BpB,EAAMgD,8BAtCnB,CAiDC1D,SAEFA,QAAQC,OAAO,WAAY,CAAC,cAC3B+C,UAAU,UAAW,CAAC,WACrB,MAAO,CACL,OAAS,EACT,QAAW,YACX,KAAQ,SAASC,EAAOC,EAASC,GAC/B,IAAI8C,EAAO9C,EAAM+C,QACjBjD,EAAMyB,OAAOuB,GAAM,SAAUA,GAC3B,GAAKA,EAAL,CAGA,IAAIE,EAAa,IAAIC,WACrBD,EAAWE,cAAcJ,EAAKA,MAC9BE,EAAWG,OAAS,SAAU5F,GAC5BuC,EAAMmB,QAAO,WACXjB,EAAMoD,KAAK,MAAO7F,EAAM8F,OAAOC,qBAO3CzG,QAAQC,OAAO,iBAAkB,CAAC,cACjC+C,UAAU,gBAAiB,CAAC,WAC3B,MAAO,CACL,OAAS,EACT,QAAW,YACX,KAAQ,SAASC,GACfA,EAAMyD,UAAYzD,EAAML,MAAM+D,WAIpC3G,QAAQC,OAAO,OAAQ,CAAC,gBAAiB,YAAa,cAAe,WACnE,YAAa,iBAAkB,WAAY,yHC9JlC2G,4PAkKX,SAASC,EAAmBC,EAAUC,EAAaC,EAAcC,EAAOC,GACpE,IAAIC,GAAkB,IAAAC,OAAM,yBACxBC,GAAe,IAAAD,OAAM,sBACzB,MAAO,CACHE,SAAU,MACVC,UAAW,IACXC,QAAS,SAAUC,GACf,IAAIC,EAAUD,EAASE,OAEvB,OADAF,EAASG,QACF,SAAU3E,EAAO4E,GACpB,IAAIC,EAAOD,EAASC,KAAK,WACzB,IAAKA,EAGD,OAFAD,EAASF,KAAKD,QACdZ,EAASe,EAASE,WAAlBjB,CAA8B7D,GAGlC,IAAI+E,EAAMF,EAAKG,MAAQ,CAAEC,SAAU,GAAIC,YAAa,EAAAC,MAChDC,EAAaL,EAAIM,MAAQ,IAAI,EAAAC,eAAeP,EAAIM,MACpDT,EAASF,KAAKK,EAAIG,YAAYN,EAAUQ,IAAeX,GACvD,EAAAc,MAAA,gBAAsBV,EAAKW,QAASZ,EAASF,QAC7C,IAAIe,EAAO5B,EAASe,EAASE,YACzB5G,EAAa6G,EAAI7G,WACjBwH,EAAexB,EAAgBa,GAC/BY,EAAYvB,EAAaW,GACzBa,EAASR,IAAc,OAAUA,GAErC,GADApF,EAAM2F,GAAaC,EACf1H,EAAY,CACZ,IAAI2H,EAAsB/B,EAAY5F,GAAY,IAAAF,QAAO,GAAI4H,EAAQ,CAAEzH,OAAQ6B,EAAO4E,SAAUA,KAC5Fc,IACA1F,EAAM0F,GAAgBG,EACtB7F,EAAM0F,GAAcC,GAAaC,GAMrChB,EAASC,KAAK,0BAA2BgB,GACzCjB,EAASkB,WAAWjB,KAAK,0BAA2BgB,GACpDE,EAA4B9B,EAAIF,EAAc8B,EAAoB7F,EAAO+E,GAG7E,IAAI,IAAAiB,UAASjB,EAAIkB,WACb,IAAIC,GAAY,IAAAC,aAAYpB,EAAIkB,WAC5BG,EAAc,IAAIC,OAAO,eAAiBH,EAAY,IAAK,KAO3DI,EAAoBtG,EAAMyB,QAND,WACzB,IAAI8E,EAAc,GAAGvH,MAChBC,KAAK2F,EAAS,GAAGkB,UACjBU,QAAO,SAAUC,GAAM,OAAOA,GAAMA,EAAGC,SAAWN,EAAYO,KAAKF,EAAGC,YAC3E,OAAOH,GAAe,aAAgBA,GAAa1B,KAAK,IAAME,EAAIkB,UAAY,iBAErB,SAAUW,GAC9DA,IAELb,EAA4B9B,EAAIF,EAAc6C,EAAc5G,EAAO+E,GACnEuB,QAGRb,EAAKzF,MAzNrB2D,EAAS,CACL,QACA,WACA,gBACA,eACA,KACA,SAAwBK,EAAO6C,EAAUC,EAAeC,EAAc9C,GAwBlE,IAAI+C,EAAW,CACXhC,KAAM,CAAEC,SAAU,CAAEgC,SAAUjD,EAAMkD,WAAWC,qBAC/C3B,QAAS,IAETzF,EAAY,CACZqH,MAAO,EACP/C,SAAU,MACVgD,UAAU,EACV/C,SAAU,IACVgD,WAAY,UACZ/C,QAAS,SAAUC,EAAU+C,EAAQC,GACjC,OAAO,SAAUxH,EAAO4E,EAAU1E,GAC9B,IACIuH,EAAYC,EAAWC,EAAcC,EADrCC,EAAY3H,EAAc,QAAK,GAAI4H,EAAgB5H,EAAkB,WAAG6H,EAjCzE,SAAU9H,EAASsD,EAAQyE,GAC1B,mBAAwB,EACxBnB,EAASjG,MAAMX,EAAS,KAAMsD,GAAQ0E,KAAKD,GAG3CnB,EAASjG,MAAMX,EAAS,KAAMsD,EAAQyE,IA4BkCD,EAzBzE,SAAU9H,EAAS+H,GAClB,mBAAwB,EACxBnB,EAASqB,MAAMjI,GAASgI,KAAKD,GAG7BnB,EAASqB,MAAMjI,EAAS+H,IAoB0EG,EAAYvD,EAASwD,cAAc,YAAcpB,EAAUtE,EAAOqE,EAAa7G,EAAc,QAAKA,EAAY,MAAK,GAAjD6G,CAAqD/G,IAAU,WAEnOqI,EAAe,CACfC,MAAO,MACPC,GAAIxI,EAAUqH,QACd1E,KAAMA,EACN8F,IAAKL,EAAU3C,QAAQgD,IAAML,EAAU3C,QAAQgD,IAAM,IAAM9F,EAAOA,EAClE+F,OAAQ,KACRC,cAWJ,SAA+BD,KACvBA,GAAYA,aAAkB,QAEjBb,IAAYa,IAE7B,EAAAlD,MAAA,yBAA+B8C,EAAcI,GAAUA,EAAOxD,UAAYwD,EAAOxD,SAASgC,UAC1FW,EAAaa,EACbE,EAAWF,MAjBX,sBAEI,IAAIG,GAAsB,IAAAzE,OAAM,yBAAN,CAAgCgE,GAGtDU,GAAgB,IAAA1E,OAAM,0BAAN,CAAiCgE,GACrD,OAAOS,GAAuBC,IAGtC,EAAAtD,MAAA,iBAAuB,UAAW8C,GAUlCzD,EAASC,KAAK,UAAW,CAAEW,QAAS6C,IACpCM,IACA,IAAIG,EAAa9E,EAAM+E,eAAeV,GA2BtC,SAASM,EAAWF,GAChB,IAAIO,EAAWhJ,EAAMiJ,OACjBC,EAAYjF,EAAGkF,QAASC,EAAYnF,EAAGkF,QACvCE,EAAc,CACdrE,KAAMyD,EACNjD,QAAS6C,GAETiB,EAAc,CACdC,WAAYL,EAAUvI,QACtB6I,WAAYJ,EAAUzI,QACtB8I,YAAaL,GAcjBJ,EAASU,MAAM,sBAAuBhH,GACtC,IAAIiH,EAASnC,EAAYwB,GAAU,SAAUY,GACzCA,EAAM/E,KAAK,cAAeyE,GAC1BM,EAAM/E,KAAK,UAAWwE,GACtBtB,EAAe6B,EAAOhF,GAAU,WAC5BsE,EAAUW,UACNlC,GACAA,EAAa+B,MAAM,gCAClB,IAAAI,WAAUhC,KAAmBA,GAAkB9H,EAAMzB,MAAMuJ,KAC5DhB,EAAc8C,MAvD9B,WAWI,GAVInC,IACA,EAAAlC,MAAA,iBAAuB,yBAA0BkC,EAAW5C,KAAK,YACjE4C,EAAWsC,SACXtC,EAAa,MAEbE,IACA,EAAApC,MAAA,iBAAuB,mBAAoB8C,GAC3CV,EAAaqC,WACbrC,EAAe,MAEfD,EAAW,CACX,IAAIuC,EAAcvC,EAAU7C,KAAK,eACjC,EAAAU,MAAA,iBAAuB,cAAe0E,GACtClC,EAAeL,GAAW,WACtBuC,EAAYR,YAAYI,UACxBpC,EAAa,QAEjBA,EAAaC,EACbA,EAAY,MAuCZwC,MAEJxC,EAAYiC,GACZhC,EAAeqB,GAWFU,MAAM,qBAAsBjB,GAAUb,GACnDD,EAAapJ,MAAMsJ,GA7EvB7H,EAAMP,IAAI,YAAY,WAClB,EAAA8F,MAAA,iBAAuB,2BAA4B8C,GACnDS,UAgFhB,OAAO/I,IAGf6D,EAAmBuG,QAAU,CAAC,WAAY,cAAe,eAAgB,QAAS,MAiElF,IAAIC,EAAuE,mBAA7C,YAAe,aAAwB,UAEjEC,EAAe,EAEnB,SAAStE,EAA4B9B,EAAIF,EAAc8B,EAAoB1H,EAAQ4G,KAE3E,IAAAuF,YAAWzE,EAAmB0E,WAC3BxF,EAAIE,SAASgB,WAAalB,EAAIE,SAASuF,oBAAsBJ,GAChEvE,EAAmB0E,UAEvB,IAAIE,GAAY,IAAAC,MAAK3F,EAAIM,MAAMsF,MAAMC,KACjCC,EAAc,CAAErK,KAAMqF,GAE1B,IAAI,IAAAyE,YAAWzE,EAAmBiF,mBAAoB,CAClD,IACIC,EADiB,IAAI,EAAAzF,eAAeP,EAAIM,MACH2F,cAAc,gBAAgBnG,KAyBvE1G,EAAOsB,IAAI,WAAYsE,EAAakH,UAAU,IAvB1B,SAAUC,GAG1B,GAAIA,IAAiBH,IAAsE,IAA/CG,EAAaC,UAAUC,QAAQX,GAA3E,CAEA,IAAIY,EAAWH,EAAaI,OAAO,MAC/BC,EAAaL,EAAaI,OAAO,QACjCE,EAAgB,SAAUC,GAAQ,OAAOA,EAAKC,aAC9CC,EAAWT,EAAaU,YAAY,MAAMC,IAAIL,GAAeM,OAAO,EAAAC,QAAS,IAC7EC,EAAad,EAAaU,YAAY,QAAQC,IAAIL,GAAeM,OAAO,EAAAC,QAAS,IAEjFE,EAAkBN,EAASnF,QAAO,SAAU0F,GAC5C,IAAIC,EAAMH,EAAWZ,QAAQc,GAC7B,OAAgB,IAATC,IAAeH,EAAWG,GAAKC,KAAKC,OAAOhB,EAASa,EAAM3D,IAAKgD,EAAWW,EAAM3D,QAG3F,GAAI0D,EAAgBK,OAAQ,CACxB,IAAIC,EAAgBN,EAAgBJ,KAAI,SAAUW,GAAK,OAAOA,EAAEjE,MAE5DkE,GAAY,IAAAjG,QAAO6E,GAAU,SAAUnK,EAAK6B,GAAO,OAAuC,IAAhCwJ,EAAcnB,QAAQrI,MACpF8C,EAAmBiF,kBAAkB2B,EAAWvB,OAGSL,IAGrE,IAAI,IAAAP,YAAWzE,EAAmB6G,WAAY,CAC1C,IAAIC,EAAOtC,IACPuC,EAAc,gBAEdC,EAAqB,SAAUC,GAC/B,QAASA,IAAWA,EAAMF,KAA6C,IAA7BE,EAAMF,GAAaD,IAAmBE,EAAmBC,EAAMC,oBAYzGC,EAAW,CAAE7B,QAASV,EAAU/H,MACpCvE,EAAOsB,IAAI,WAAYsE,EAAakJ,SAASD,GAV3B,SAAUF,GACxB,IAAInM,EACAuM,EAAOJ,EAAMF,GAAeE,EAAMF,IAAgB,GAKtD,OAJKC,EAAmBC,KACpBnM,EAAUsD,EAAGkJ,KAAKtH,EAAmB6G,UAAUI,KACvC7E,MAAK,SAAU/G,GAAO,OAAQgM,EAAIP,IAAgB,IAARzL,KAE/CP,IAGyDkK,KAG5E,YAAe,mBAAmB9K,UAAU,SAAU4D,GACtD,YAAe,mBAAmB5D,UAAU,SAAU6D,sWC9ZlDwJ,EAAiC,WACjC,SAASA,IACL,IAAIC,EAAQnQ,KACGA,KAAKoQ,SAAWvQ,EAAQ,GAAR,cAAwB,EACxCG,KAAKU,KAAO,CACvB,QACA,iBACA,YACA,SAAU2P,EAAOC,EAAgBC,GAI7B,OAHAJ,EAAMK,iBAAmBD,EAAUE,KAAOF,EAAUE,IAAI,qBAAuBF,EAAUG,IAAI,oBAC7FP,EAAME,MAAQA,EACdF,EAAMG,eAAiBA,EAChBH,IAyJnB,OApJAD,EAAgBrO,UAAU8O,eAAiB,SAAUnM,GACjDxE,KAAKoQ,SAAW5L,GAepB0L,EAAgBrO,UAAU+O,WAAa,SAAUrF,EAAQ6C,EAAQyC,GAC7D,IACIC,EAAa,SAAUxK,GAAU,OAAO,EAAAyK,SAAA,QAAiBzK,GAAQyE,MAAK,SAAUiG,GAAO,MAAO,CAAGC,SAAUD,OAC3GE,EAAc,SAAU5K,GAAU,OAAO,EAAAyK,SAAA,QAAiBzK,GAAQyE,MAAK,SAAUiG,GAAO,MAAO,CAAGjI,UAAWiI,OACjH,OAAO,IAAApE,WAAUrB,EAAO0F,UAClBH,EAAW9Q,KAAKmR,WAAW5F,EAAO0F,SAAU7C,KAC5C,IAAAxB,WAAUrB,EAAO6F,aACbN,EAAW9Q,KAAKqR,QAAQ9F,EAAO6F,YAAahD,KAC5C,IAAAxB,WAAUrB,EAAO+F,kBACbR,EAAW9Q,KAAKuR,aAAahG,EAAO+F,iBAAkBlD,EAAQyC,KAC9D,IAAAjE,WAAUrB,EAAOxC,WACbmI,EAAY3F,EAAOxC,YACnB,IAAA6D,WAAUrB,EAAO+B,mBACb4D,EAAYlR,KAAKwR,sBAAsBjG,EAAO+B,kBAAmBc,EAAQyC,IACzEC,EAbA,wBAwB1BZ,EAAgBrO,UAAUsP,WAAa,SAAUF,EAAU7C,GACvD,OAAO,IAAAhB,YAAW6D,GAAYA,EAAS7C,GAAU6C,GAWrDf,EAAgBrO,UAAUwP,QAAU,SAAUI,EAAKrD,GAG/C,OAFI,IAAAhB,YAAWqE,KACXA,EAAMA,EAAIrD,IACH,MAAPqD,EACO,KACPzR,KAAKoQ,SACEpQ,KAAKqQ,MACPK,IAAIe,EAAK,CAAEC,MAAO1R,KAAKsQ,eAAgBqB,QAAS,CAAEC,OAAQ,eAC1D7G,MAAK,SAAU8G,GAChB,OAAOA,EAASlK,QAGjB3H,KAAKwQ,iBAAiBiB,IAUjCvB,EAAgBrO,UAAU0P,aAAe,SAAUxR,EAAUqO,EAAQyC,GACjE,IAAIiB,EAAO,EAAAf,SAAA,mBAA4BhR,GACnCgS,GAAa,IAAAC,SAAQjS,IAAY,IAAAyN,MAAKzN,GAAYA,EAEtD,OADiB,IAAI,EAAAkS,WAAW,GAAIF,EAAYD,GAC9BpB,IAAIG,IAS1BX,EAAgBrO,UAAU2P,sBAAwB,SAAUzR,EAAUqO,EAAQyC,GAC1E,IAAIiB,EAAO,EAAAf,SAAA,mBAA4BhR,GACnCgS,GAAa,IAAAC,SAAQjS,IAAY,IAAAyN,MAAKzN,GAAYA,EAEtD,OADiB,IAAI,EAAAkS,WAAW,GAAIF,EAAYD,GAC9BpB,IAAIG,IAgB1BX,EAAgBrO,UAAUqQ,sBAAwB,SAAUzL,EAAQoK,EAAS9H,EAAWoJ,GACpFA,EAAWA,GAAY,GAEvB,IAAIC,EAASvS,EAAQ,GAAR,eAAyB,EAAI,KAAO,GAE7CwS,EAAQ,SAAUC,GAClB,IAAIC,GAAU,IAAAtJ,aAAYqJ,GAC1B,MAAO,aAAa7I,KAAK8I,GAAW,KAAOA,EAAUA,GA6BrDvP,EAQZ,SAA8BwC,GAC1B,IAAIgN,EAAU,EAAAzB,SAAA,cAAuBvL,EAAO,aAC5C,IAAKgN,IAAYA,EAAQpD,OACrB,MAAM,IAAIqD,MAAM,mCAAqCjN,EAAO,KAChE,OAAOgN,EAAQ7D,IAAI+D,GAAa9D,OAAO,EAAAC,QAAS,IAZhC8D,CAAqB5J,GAAW4F,KA3BzB,SAAUiE,GACzB,IAAIpN,EAAOoN,EAAMpN,KAAM0J,EAAO0D,EAAM1D,KAChC2D,EAAWR,EAAM7M,GAIrB,GAAIiB,EAAOqM,KAAKD,KAAcV,EAAS3M,GACnC,OAAOqN,EAAW,KAAOpM,EAAOqM,KAAKD,GAAY,IACrD,IAAIE,EAAcZ,EAAS3M,IAASA,EAGpC,GAAa,MAAT0J,EACA,OAAO2D,EAAW,OAAST,EAAS,YAAcW,EAAc,MAIpE,GAAa,MAAT7D,EAAc,CACd,IAAI8D,EAAMnC,EAAQ/C,cAAciF,GAC5BpS,EAAKqS,GAAOA,EAAIrL,KAChBhG,EAAQhB,GAAM,EAAAoQ,SAAA,mBAA4BpQ,IAAQ,GAGtD,OAAOkS,EAAW,cAAgBE,IADhB,IAAAf,SAAQrR,GAAM,KAAOA,EAAGyO,OAAS,GAAK,IAAM,IACA,IAAMzN,EAAKsR,KAAK,KAAO,KAGzF,OAAOJ,EAAW,KAAOT,EAAS,YAAcW,EAAc,OAEJE,KAAK,KAC/DjK,EAAYqJ,EAAMtJ,GACtB,MAAO,IAAMC,EAAY,IAAMhG,EAAQ,MAAQgG,EAAY,KAExDkH,EArKyB,GAiLhCwC,EAAc,SAAUQ,GACxB,OAAI,IAAAC,UAASD,EAAIE,kBACNC,EAAcH,EAAIE,kBACtBC,EAAcH,EAAIpQ,QAIzBuQ,EAAgB,SAAUC,GAC1B,OAAOC,OAAOC,KAAKF,GAAe,IAE7B3E,KAAI,SAAU9I,GAAO,MAAO,CAACA,EAAK,oBAAoB4D,KAAK6J,EAAYzN,QAEvEyD,QAAO,SAAUmK,GAAS,OAAO,IAAA7G,WAAU6G,KAAU,IAAAzB,SAAQyB,EAAM,OAEnE9E,KAAI,SAAU8E,GAAS,MAAO,CAAGjO,KAAMiO,EAAM,GAAG,IAAMA,EAAM,GAAIvE,KAAMuE,EAAM,GAAG,2ECzL7EC,EAAsB,SAAUC,GACvC,OAAO,SAA0BC,GAC7B,IAAIC,EAAOD,EAAYD,GACnBG,EAAwB,WAAbH,EAAwB,OAAS,KAOhD,OAAOE,EANP,SAA0BjE,EAAOnC,GAC7B,IACIsG,EADiB,IAAI,EAAA3L,eAAewH,EAAMlB,YAAYoF,IAC1BC,WAAWtG,EAAMuG,WAC7CtL,GAAS,IAAA5H,QAAOmT,EAAUF,GAAa,CAAEG,QAASzG,EAAOO,aAAc4B,IAC3E,OAAO,EAAAmB,SAAA,iBAA0B8C,EAAM7T,KAAM0I,SAEhByL,ICfrCC,EAAqC,WACrC,SAASA,EAAoBC,GAEzBrU,KAAKsU,cAAgB,GACrBtU,KAAKqU,kBAAoBA,EACzB,IAAIE,GAAM,IAAAvQ,KAAIqQ,IACd,IAAAG,sBAAqBD,EAAKvU,KAAMuU,EAAK,CAAC,eA8D1C,OAhDAH,EAAoBK,6BAA+B,SAAUC,GACzD,IAAIC,EAAWD,EAAOE,kBAAkB1F,KAAK,QAC7CyF,EAASE,OAAS,SAAUvF,GACxB,OAAY,MAALA,EAAYA,EAAEwF,WAAWC,QAAQ,WAAW,SAAUC,GAAK,MAAQ,CAAE,IAAK,KAAM,IAAK,OAAQA,MAAU1F,GAElHqF,EAASM,OAAS,SAAU3F,GACxB,OAAY,MAALA,EAAYA,EAAEwF,WAAWC,QAAQ,aAAa,SAAUC,GAAK,MAAQ,CAAE,KAAM,IAAK,MAAO,KAAMA,MAAU1F,IAIxH8E,EAAoBvS,UAAUqT,QAAU,aACxCd,EAAoBvS,UAAUsT,SAAW,SAAU3U,GAC/C,IAAI2P,EAAQnQ,KAEZ,OADAA,KAAKsU,cAAc7T,KAAKD,GACjB,WAAc,OAAO,IAAA4U,YAAWjF,EAAMmE,cAAjB,CAAgC9T,KAEhE4T,EAAoBvS,UAAUwT,UAAY,WACtC,IAAIA,EAAYrV,KAAKqU,kBAAkBgB,YAEvC,OADAA,GAAY,IAAAlC,UAASkC,GAAaA,EAAUC,QAAUD,IAClCrV,KAAKuV,SAASC,SAEtCpB,EAAoBvS,UAAU4T,SAAW,WACrC,OAAOzV,KAAK0V,YAAc1V,KAAK0V,UAAY1V,KAAK2V,SAASF,YAAczV,KAAK4V,QAAQC,SAAS/B,WAEjGM,EAAoBvS,UAAU4P,IAAM,SAAUqE,EAAQf,EAAStH,GAQ3D,YAPgB,IAAZsH,IAAsBA,GAAU,IAChC,IAAAnI,WAAUkJ,IACV9V,KAAK+V,UAAUtE,IAAIqE,GACnBf,GACA/U,KAAK+V,UAAUhB,UACftH,GACAzN,KAAK+V,UAAUtI,MAAMA,GAClBzN,KAAK+V,UAAUtE,OAE1B2C,EAAoBvS,UAAUmU,iBAAmB,SAAUC,EAAYF,EAAWR,EAAUI,EAAUC,GAClG,IAAIzF,EAAQnQ,KACZA,KAAK+V,UAAYA,EACjB/V,KAAKuV,SAAWA,EAChBvV,KAAK2V,SAAWA,EAChB3V,KAAK4V,QAAUA,EAEfK,EAAW1T,IAAI,0BAA0B,SAAU2T,GAAO,OAAO/F,EAAMmE,cAAcvT,SAAQ,SAAUJ,GAAM,OAAOA,EAAGuV,SACvH,IAAIC,GAAO,IAAAnS,KAAI+R,IAEf,IAAAvB,sBAAqB2B,EAAMnW,KAAMmW,EAAM,CAAC,UAAW,OAAQ,SAAU,UAErE,IAAA3B,sBAAqB2B,EAAMnW,KAAMmW,EAAM,CAAC,OAAQ,WAAY,UAEzD/B,EApE6B,0ECaxCvU,EAAQ,GAAR,OAAe,qBAAsB,IACrC,IAAIuW,EAAWvW,EAAQ,GAAR,OAAe,iBAAkB,CAAC,OAC7CwW,EAAWxW,EAAQ,GAAR,OAAe,iBAAkB,CAAC,mBAC7CyW,EAAUzW,EAAQ,GAAR,OAAe,mBAAoB,CAAC,mBAC9C0W,EAAY1W,EAAQ,GAAR,OAAe,kBAAmB,CAAC,mBAAoB,iBAAkB,uBACrF2W,EAAW3W,EAAQ,GAAR,OAAe,YAAa,CAAC,iBAAkB,kBAAmB,uBAE7E6U,GADW7U,EAAQ,GAAR,OAAe,mBAAoB,CAAC,cACtC,MAGb,SAAS4W,EAAkBpC,IAEvBK,EAAS1U,KAAK0U,OAAS,IAAI,EAAAgC,UACpBC,cAAgB,IAAI,IAAcjC,EAAOkC,cAAelC,EAAOmC,cAEtEnC,EAAOkC,cAAcE,UAAU,QAAS,MACxCpC,EAAOkC,cAAcE,UAAU,SAAUpD,EAAoB,WAC7DgB,EAAOkC,cAAcE,UAAU,WAAYpD,EAAoB,aAC/DgB,EAAOkC,cAAcE,UAAU,UAAWpD,EAAoB,YAC9DgB,EAAOqC,YAAY/M,WAAWgN,mBAAmB,OAAO,WAExDtC,EAAOuC,WAAW1L,OAAO2L,eAAgB,EACzC,IAAIC,EAAsBzC,EAAO0C,gBAAkB1C,EAAO2C,eAAiB,IAAIjD,EAAoBC,GAMnG,SAAS3T,EAAKqV,EAAWJ,EAAUC,EAASL,EAAUU,EAAY5F,EAAOC,GAIrE,OAHA6G,EAAmBnB,iBAAiBC,EAAYF,EAAWR,EAAUI,EAAUC,UACxElB,EAAe,cACfA,EAAa,KACbA,EAEX,OAXAN,EAAoBK,6BAA6BC,GAEjDA,EAAe,OAAIA,EACnBA,EAAa,KAAIhU,EACjBA,EAAKuM,QAAU,CAAC,YAAa,WAAY,UAAW,WAAY,aAAc,QAAS,kBAOhFyH,EA1BX+B,EAAkBxJ,QAAU,CAAC,qBA4B7B,IAAIqK,EAAiB,SAAUC,GAAe,MAAO,CACjD,oBACA,SAAUC,GACN,IAAIC,EAAUD,EAAK9C,OAAO6C,GAE1B,OADAE,EAAc,KAAI,WAAc,OAAOA,GAChCA,KAKf,SAASC,EAASnH,EAAWxJ,EAAI4Q,GAI7B,GAHA,EAAA5G,SAAA,UAAqBR,EACrB,EAAAQ,SAAA,GAAchK,GAETwM,OAAO1R,UAAUa,eAAeX,KAAKwO,EAAW,YACjD,IACIA,EAAUqH,QAAO,SAAUC,OAE/B,MAAOxS,GACHkL,EAAUuH,WAAa,cAAcrO,KAAKpE,GAASA,EAAMyP,YAKjE6C,EAAUf,cACLlG,MACA/B,KAAI,SAAUW,GAAK,OAAOA,EAAE0E,UAAU+D,eACtCnJ,OAAO,EAAAC,QAAS,IAChBvF,QAAO,SAAUgG,GAAK,MAAkB,aAAXA,EAAEwC,QAC/B/Q,SAAQ,SAAUiX,GAAc,OAAQA,EAAWlG,KAAOvB,EAAU0H,SAASD,EAAWE,UAAW3H,EAAUuH,aAQ/G,SAASK,EAAalC,GACzBA,EAAW1R,QAAO,WACd,EAAA8D,MAAA,wBA9BRqP,EAASzK,QAAU,CAAC,YAAa,KAAM,aA2BvCkL,EAAalL,QAAU,CAAC,cAMxBmJ,EAASrW,SAAS,YAAa0W,GAC/BH,EAAQvW,SAAS,aAAc,CAAC,oBAXL,SAAUqY,GAAY,OAAQA,EAASC,kBAAoB,IAAI,IAAkBD,MAY5G/B,EAAStW,SAAS,cAAeuX,EAAe,eAChDjB,EAAStW,SAAS,qBAAsB,CAAC,oBAAqB,WAAc,OAAO2U,EAAOE,qBAC1FyB,EAAStW,SAAS,oBAAoB,WAAc,OAAO,IAAImQ,KAC/DqG,EAAUxW,SAAS,iBAAkBuX,EAAe,kBACpDf,EAAUxW,SAAS,mBAAoBuX,EAAe,YACtDf,EAAUxW,SAAS,eAAgBuX,EAAe,sBAClDf,EAAUxW,SAAS,SAAU,CAAC,oBAfP,WAAc,OAAO,IAAAe,QAAO4T,EAAOiC,cAAe,CAAEjW,KAAM,WAAc,OAAOgU,EAAOmC,mBAgB7GN,EAAUrW,QAAQ,eAAgB,CAAC,YAAa,SAAUyX,GAAa,OAAOA,EAAUW,QAAQlK,UAChGoI,EAAStW,QAAQ,SAAS,WAAc,OAAOwU,EAAOqC,eACtDP,EAASiB,QAAQ,UAAU,WAAc,OAAO,EAAApP,SAChDmO,EAAS+B,IAAIJ,GACb9B,EAASkC,IAAI,CAAC,qBAAsB,SAAUC,OAC9CjC,EAAUgC,IAAI,CAAC,SAAU,SAAUE,OACnCnC,EAAQiC,IAAI,CAAC,aAAc,SAAUG,OACrCtC,EAASmC,IAAIb,GAEN,IAAIzD,EAAY,SAAU0E,GAO7B,OANaA,EAAIC,YAAYtP,OAAO,EAAAR,UAChB6F,KAAI,SAAU9I,GAC9B,IAAImS,EAAaW,EAAI7K,cAAcjI,GAEnC,MAAO,CAACA,EAAoB,WADX8S,EAAIE,UAAUb,GAAYc,MACJd,EAAWvU,QAAUuU,EAAWrQ,SAE7DiH,OAAO,EAAAmK,WAAY,2JC9GrC,SAASC,EAAeP,GACpB,IAAIQ,EAAW,SAAUxL,EAAOW,EAAQjO,GACpC,OAAOsY,EAAOS,GAAGzL,EAAOW,EAAQjO,IAGpC,OADA8Y,EAASE,WAAY,EACdF,EAaX,SAASG,EAAuBX,GAC5B,IAAIY,EAAiB,SAAU5L,EAAOW,EAAQjO,GAC1C,OAAOsY,EAAOa,SAAS7L,EAAOW,EAAQjO,IAG1C,OADAkZ,EAAeF,WAAY,EACpBE,EAxBXL,EAAe/L,QAAU,CAAC,UAkB1BmM,EAAuBnM,QAAU,CAAC,UAQlC,YAAe,mBAAmB3D,OAAO,UAAW0P,GAAgB1P,OAAO,kBAAmB8P,oKCpB1FG,EAA+B,WAC/B,SAASA,EAAc3C,EAAeC,GAClC7W,KAAK4W,cAAgBA,EACrB5W,KAAK6W,aAAeA,GACpB,IAAArC,uBAAqB,IAAAxQ,KAAIuV,EAAc1X,WAAY7B,MAAM,IAAAgE,KAAIhE,OAgHjE,OArBAuZ,EAAc1X,UAAUiV,UAAY,SAAUtR,EAAMgU,GAChD,OAAOxZ,KAAK4W,cAAcE,UAAUtR,EAAMgU,IAASxZ,MAEvDuZ,EAAc1X,UAAU4L,MAAQ,SAAUjI,EAAMiU,GAQ5C,OAPI,IAAAtG,UAAS3N,GACTiU,EAAajU,EAGbiU,EAAWjU,KAAOA,EAEtBxF,KAAK4W,cAAc8C,SAASD,GACrBzZ,MAOXuZ,EAAc1X,UAAU8X,UAAY,SAAUnZ,GAC1C,OAAOR,KAAK6W,aAAa8C,UAAUnZ,IAEhC+Y,EApHuB,6LCf3B,SAASK,IACZ,IAAIC,EAAkB,KACtB,OAAO,SAAU1R,EAAM2R,GAEnB,OADAD,EAAkBA,GAAmB,EAAA9I,SAAA,cAAuB,oBACrD,CAAC,IAAIgJ,EAAc5R,EAAM2R,EAAMD,KAI9C,IAAIG,EAAY,SAAUxG,EAAMyG,GAAO,OAAOzG,EAAK5E,QAAO,SAAUsL,EAAKrU,GAAO,OAAOqU,IAAO,IAAAtN,WAAUqN,EAAIpU,OAAU,IAY/G,SAASsU,EAAgB1M,GAE5B,IAAKA,EAAM2M,OACP,MAAO,GACX,IAAgKC,EAAW,CAAC,YAAa,WAAY,qBAAsBC,EAA7M,CAAC,mBAAoB,cAAe,WAAY,SAAU,SAAyKlY,OAApJ,CAAC,aAAc,qBAAsB,eAAgB,cAAiHmY,EAAcF,EAASjY,OAAOkY,GAIjS,IAAI,IAAA1N,WAAUa,EAAM+M,QAAUR,EAAUO,EAAa9M,GACjD,MAAM,IAAIgF,MAAM,UAAYhF,EAAMjI,KAAlB,4JAGL+U,EAAYjR,QAAO,SAAUzD,GAAO,OAAO,IAAA+G,WAAUa,EAAM5H,OAAUoN,KAAK,OAEzF,IAAIuH,EAAQ,GAAIC,EAAchN,EAAM+M,OAAS,CAAEE,UAAU,IAAAC,MAAKlN,EAAO8M,IAsBrE,OArBA,IAAAxZ,SAAQ0Z,GAAa,SAAUlP,EAAQ/F,GASnC,GAPAA,EAAOA,GAAQ,YAEX,IAAAsD,UAASyC,KACTA,EAAS,CAAExC,UAAWwC,IAE1BA,GAAS,IAAAzK,QAAO,GAAIyK,GAEhByO,EAAUK,EAAU9O,IAAWyO,EAAUM,EAAa/O,GACtD,MAAM,IAAIkH,MAAM,mBAAqB4H,EAASpH,KAAK,KAAO,UAAYqH,EAAYrH,KAAK,KAAO,mBAAqBzN,EAAO,IAAMiI,EAAMjI,KAAO,KAEjJ+F,EAAO9C,UAAY8C,EAAO9C,WAAa,WACvC8C,EAAOH,MAAQ,MACfG,EAAOxB,SAAW0D,EAClBlC,EAAOqP,MAAQpV,EACf,IAAIqV,EAAa,EAAAC,YAAA,sBAAkCvP,EAAOxB,SAAUwB,EAAOqP,OAC3ErP,EAAOwP,YAAcF,EAAWG,WAChCzP,EAAO0P,qBAAuBJ,EAAWK,oBACzCV,EAAMhV,GAAQ+F,KAEXiP,EAGX,IAAInP,EAAK,EAEL0O,EAA+B,WAC/B,SAASA,EAAc5R,EAAMJ,EAAU7H,GACnC,IAAIiQ,EAAQnQ,KACZA,KAAKmI,KAAOA,EACZnI,KAAK+H,SAAWA,EAChB/H,KAAKE,QAAUA,EACfF,KAAKmb,IAAM9P,IACXrL,KAAKob,QAAS,EACdpb,KAAKgI,YAAc,SAAUvB,EAAQoK,GACjC,OAAOV,EAAMpH,UACPoH,EAAMjQ,QAAQgS,sBAAsBzL,EAAQoK,EAASV,EAAMpH,UAAWoH,EAAMpI,SAASoK,UACrFhC,EAAMc,UAiCpB,OA9BA8I,EAAclY,UAAUwZ,KAAO,WAC3B,IAAIlL,EAAQnQ,KACR+G,EAAK,EAAAgK,SAAA,GACLF,EAAU,IAAI,EAAAzI,eAAepI,KAAKmI,MAClCiG,EAASpO,KAAKmI,KAAKyG,QAAO,SAAUsL,EAAK3L,GAAQ,OAAO,IAAAzN,QAAOoZ,EAAK3L,EAAK+M,eAAiB,IAC1FC,EAAW,CACXtK,SAAUlK,EAAGkJ,KAAKjQ,KAAKE,QAAQ0Q,WAAW5Q,KAAK+H,SAAUqG,EAAQyC,IACjE7P,WAAY+F,EAAGkJ,KAAKjQ,KAAKwb,cAAc3K,KAE3C,OAAO9J,EAAG0U,IAAIF,GAAUxQ,MAAK,SAAU2Q,GAInC,OAHA,EAAArT,MAAA,sBAA4B,SAAU8H,GACtCA,EAAMnP,WAAa0a,EAAQ1a,YAC3B,IAAAF,QAAOqP,EAAOuL,EAAQzK,UACfd,MAQf4J,EAAclY,UAAU2Z,cAAgB,SAAU3K,GAC9C,IAAI9Q,EAAWC,KAAK+H,SAAS4T,mBAC7B,KAAK,IAAAC,cAAa7b,GACd,OAAOC,KAAK+H,SAAS/G,WACzB,IAAI8Q,EAAO,EAAAf,SAAA,mBAA4BhR,GACnCgS,GAAa,IAAAC,SAAQjS,IAAY,IAAAyN,MAAKzN,GAAYA,EAEtD,OADiB,IAAI,EAAAkS,WAAW,GAAIF,EAAYD,GAC9BpB,IAAIG,IAEnBkJ,EA5CuB,wKC9C9B8B,EAAmC,WAEnC,SAASA,EAAiCnH,GACtC1U,KAAK0U,OAASA,EA2KlB,OAzKAmH,EAAkBC,kBAAoB,SAAUpH,EAAQqH,GACpD,OAAO,SAAUC,GAAS,OAAO,EAAAjL,SAAA,iBAA0BgL,EAAS,KAAM,CAAEE,OAAQD,EAAOE,aAAcxH,EAAO4D,QAAQlK,WAG5HyN,EAAkBha,UAAUnB,KAAO,WAC/B,IAAIuW,EAAajX,KAAK0U,OAAOuC,WAI7B,OAHAjX,KAAK0U,OAAOyH,UAAUC,QAAO,GACxBnF,EAAWoF,mBACZpF,EAAWqF,SACRtc,KAAK0U,OAAOyH,WAiCvBN,EAAkBha,UAAU0a,KAAO,SAAUC,GACzC,IAAIrM,EAAQnQ,KACZ,KAAK,IAAAoN,YAAWoP,GACZ,MAAM,IAAI/J,MAAM,6BACpB,IACI8J,EAAO,IAAI,EAAAE,aADH,WAAc,OAAOD,EAAO,EAAAzL,SAAA,UAAoBZ,EAAMuE,OAAO0C,mBACvC,EAAAsF,UAElC,OADA1c,KAAK0U,OAAOuC,WAAW0F,MAAMJ,KAAKA,GAC3Bvc,MA4BX6b,EAAkBha,UAAU+a,UAAY,SAAUL,GAC9C,IAAIpM,EAAQnQ,KACR6c,EAAW7c,KAAK0U,OAAOuC,WAAW0F,MACtC,IAAI,IAAA7T,UAASyT,GACTM,EAASD,UAAUL,OAElB,MAAI,IAAAnP,YAAWmP,GAIhB,MAAM,IAAI9J,MAAM,uCAHhBoK,EAASD,WAAU,WAAc,OAAOL,EAAK,EAAAxL,SAAA,UAAoBZ,EAAMuE,OAAO0C,oBAKlF,OAAOpX,MAwCX6b,EAAkBha,UAAUoO,KAAO,SAAU6M,EAAMf,GAK/C,QAJI,IAAA/J,SAAQ+J,KAAY,IAAA3O,YAAW2O,MAC/BA,EAAUF,EAAkBC,kBAAkB9b,KAAK0U,OAAQqH,IAE/D/b,KAAK0U,OAAOuC,WAAW0F,MAAM1M,KAAK6M,EAAMf,GACjC/b,MAgCX6b,EAAkBha,UAAUkb,eAAiB,SAAU9Q,GACnDjM,KAAK0U,OAAOuC,WAAW8F,eAAe9Q,IAEnC4P,EA9K2B,iJCKtC,UAAe,mBAAmB9b,SAAS,iBApB3C,WACI,IAAIid,GAAkB,EACtBhd,KAAKgd,gBAAkB,WACnBA,GAAkB,GAEtBhd,KAAKU,KAAO,CACR,gBACA,WACA,SAAUuc,EAAezZ,GACrB,OAAIwZ,EACOC,EAEJ,SAAUvV,GACb,OAAOlE,GAAS,WACZkE,EAAS,GAAGwV,mBACb,GAAG,8nBClBlBC,EAAkD,WAClD,IAAK,IAAIC,EAAI,EAAGC,EAAI,EAAGC,EAAKtb,UAAUoN,OAAQiO,EAAIC,EAAID,IAAKD,GAAKpb,UAAUqb,GAAGjO,OACxE,IAAImO,EAAI3b,MAAMwb,GAAII,EAAI,EAA3B,IAA8BH,EAAI,EAAGA,EAAIC,EAAID,IACzC,IAAK,IAAII,EAAIzb,UAAUqb,GAAIK,EAAI,EAAGC,EAAKF,EAAErO,OAAQsO,EAAIC,EAAID,IAAKF,IAC1DD,EAAEC,GAAKC,EAAEC,GACjB,OAAOH,GAaAK,EAAwB,iBAATlQ,MAAqBA,KAAKA,OAASA,MAAQA,MAC9C,iBAAX,EAAAmQ,GAAuB,EAAAA,EAAOC,SAAW,EAAAD,GAAU,EAAAA,QAC3D,EACAhe,EAAU+d,EAAK/d,SAAW,GACnBke,EAAWle,EAAQke,UAAYC,KAAK/W,MAAM3D,KAAK0a,MAC/CC,EAASpe,EAAQoe,QAAUD,KAAKE,UAAU5a,KAAK0a,MAC/Cjd,EAAUlB,EAAQkB,SAqc7B,SAAkBkZ,EAAKnP,EAAIqF,GACvB,IAAI,QAAQ8J,GACR,OAAOA,EAAIlZ,QAAQ+J,EAAIqF,GAC3BoD,OAAOC,KAAKyG,GAAKlZ,SAAQ,SAAU8E,GAAO,OAAOiF,EAAGmP,EAAIpU,GAAMA,OAvcvD/E,EAASyS,OAAO3Q,QAycpB,SAAiBub,GACpB,IAAK,IAAId,EAAI,EAAGA,EAAIrb,UAAUoN,OAAQiO,IAAK,CACvC,IAAIpD,EAAMjY,UAAUqb,GACpB,GAAKpD,EAGL,IADA,IAAIzG,EAAOD,OAAOC,KAAKyG,GACdyD,EAAI,EAAGA,EAAIlK,EAAKpE,OAAQsO,IAC7BS,EAAM3K,EAAKkK,IAAMzD,EAAIzG,EAAKkK,IAGlC,OAAOS,GAldAhP,EAAStP,EAAQsP,QAod5B,SAASiP,EAAQC,EAAIC,GACjB,GAAID,IAAOC,EACP,OAAO,EACX,GAAW,OAAPD,GAAsB,OAAPC,EACf,OAAO,EACX,GAAID,GAAOA,GAAMC,GAAOA,EACpB,OAAO,EACX,IAAIC,SAAYF,EAChB,GAAIE,WAD4BD,GACR,WAAPC,EACb,OAAO,EACX,IAyBeC,EAAIC,EAzBfC,EAAM,CAACL,EAAIC,GACf,IAAI,QAAI,KAAJ,CAAaI,GACb,OAuBeD,EAvBMH,GAuBVE,EAvBMH,GAwBdjP,SAAWqP,EAAGrP,QAEduP,EAAYH,EAAIC,GAAI7P,QAAO,SAAUgQ,EAAGC,GAAK,OAAOD,GAAKR,EAAQS,EAAE,GAAIA,EAAE,OAAQ,GAzBxF,IAAI,QAAI,KAAJ,CAAYH,GACZ,OAAOL,EAAGS,YAAcR,EAAGQ,UAC/B,IAAI,QAAI,KAAJ,CAAcJ,GACd,OAAOL,EAAGvJ,aAAewJ,EAAGxJ,WAChC,IAAI,QAAI,KAAJ,CAAgB4J,GAChB,OAAO,EAEX,GADiB,CAAC,KAAY,KAAS,KAAQ,MAChC/P,IAAI,MAAKC,QAAO,SAAUgQ,EAAGje,GAAM,OAAOie,KAAOje,EAAG+d,MAAS,GACxE,OAAO,EACX,IAAIlL,EAAO,GAEX,IAAK,IAAI3N,KAAOwY,EAAI,CAChB,IAAKD,EAAQC,EAAGxY,GAAMyY,EAAGzY,IACrB,OAAO,EACX2N,EAAK3N,IAAO,EAEhB,IAAK,IAAIA,KAAOyY,EACZ,IAAK9K,EAAK3N,GACN,OAAO,EAEf,OAAO,GApfJ,SAAS6W,EAASpN,GACrB,OAAOA,EAEJ,SAASrH,KAyDT,SAASuM,EAAqBuK,EAAQ1Y,EAAQ/C,EAAM0b,EAASC,QAC/C,IAAbA,IAAuBA,GAAW,GACtC,IAAIC,EAAe,SAAUC,GAAU,OAAOJ,IAASI,GAAQ7b,KAAKA,MAQpE,OADA0b,EAAUA,GAAWzL,OAAOC,KAAKuL,MAClBnQ,QAAO,SAAUsL,EAAK1U,GAPd,IAAU2Z,EAS7B,OADAjF,EAAI1U,GAAQyZ,GARiBE,EAQW3Z,EAPjC,WAEH,OADAa,EAAO8Y,GAAUD,EAAaC,GACvB9Y,EAAO8Y,GAAQhd,MAAM,KAAMH,aAKUkd,EAAa1Z,GACtD0U,IACR7T,GAMA,IAAI+Y,EAAU,SAAUhF,EAAQiF,GAAS,OAAOve,EAAOyS,OAAO/R,OAAO4Y,GAASiF,IAE1EC,GAAU,SACd,SAAkBC,EAAOtF,GAC5B,OAA+B,IAAxBsF,EAAMrR,QAAQ+L,MAMd7E,GAAa,SACjB,SAAqBmK,EAAOtF,GAC/B,IAAIhL,EAAMsQ,EAAMrR,QAAQ+L,GAGxB,OAFIhL,GAAO,GACPsQ,EAAMC,OAAOvQ,EAAK,GACfsQ,KAGAE,GAAS,SACb,SAAiBC,EAAK1b,GACzB,OAAO0b,EAAIjf,KAAKuD,GAAMA,KAGf2b,EAAW,SAAUC,GAC5B,OAAOA,EAAU9d,QAAQf,SAAQ,SAAUJ,GACzB,mBAAPA,GAAqBA,IAC5ByU,EAAWwK,EAAWjf,OAQvB,SAASV,EAASW,GAErB,IADA,IAAIif,EAAe,GACVC,EAAK,EAAGA,EAAK9d,UAAUoN,OAAQ0Q,IACpCD,EAAaC,EAAK,GAAK9d,UAAU8d,GAErC,IAAIC,EAAcjf,EAAOqB,WAAM,EAAQgb,EAAe,CAAC,IAAK0C,EAAaG,YACzE,OAAOlf,EAAOif,EAAapF,EAAK/Z,GAAQ,GAAI2S,OAAOC,KAAKuM,KAGrD,IAAIE,EAAS,SAAUC,EAAMC,GAAQ,OAAOrf,EAAOof,EAAMC,IAQzD,SAASC,EAAUC,EAAOC,GAC7B,IAAInY,EAAO,GAEX,IAAK,IAAIoY,KAAKF,EAAMlY,KAAM,CACtB,GAAIkY,EAAMlY,KAAKoY,KAAOD,EAAOnY,KAAKoY,GAC9B,MACJpY,EAAK1H,KAAK4f,EAAMlY,KAAKoY,IAEzB,OAAOpY,EAaJ,SAASwS,EAAKV,EAAKuG,GACtB,IAAIC,EAAU,GACd,IAAK,IAAIC,KAASzG,GACoB,IAA9BuG,EAAUtS,QAAQwS,KAClBD,EAAQC,GAASzG,EAAIyG,IAG7B,OAAOD,EAcJ,SAASE,EAAK1G,EAAKuG,GACtB,OAAOjN,OAAOC,KAAKyG,GACd3Q,QAAO,QAAIgW,EAAQkB,KACnB5R,QAAO,SAAUsL,EAAKrU,GAAO,OAASqU,EAAIrU,GAAOoU,EAAIpU,GAAOqU,IAAS,IASvE,SAAS5Q,EAAOsX,EAAYpgB,GAC/B,IAAIkf,GAAM,QAAQkB,GAAata,EAASoZ,EAAM,GAAK,GAC/CmB,EAASnB,EAAM,SAAUpQ,GAAK,OAAOhJ,EAAO7F,KAAK6O,IAAQ,SAAUA,EAAGzJ,GAAO,OAAQS,EAAOT,GAAOyJ,GAKvG,OAJAvO,EAAQ6f,GAAY,SAAUT,EAAM9C,GAC5B7c,EAAS2f,EAAM9C,IACfwD,EAAOV,EAAM9C,MAEd/W,EAGJ,SAASwa,EAAKF,EAAYpgB,GAC7B,IAAI8F,EAOJ,OANAvF,EAAQ6f,GAAY,SAAUT,EAAM9C,GAC5B/W,GAEA9F,EAAS2f,EAAM9C,KACf/W,EAAS6Z,MAEV7Z,EAGJ,IAAIya,EAASpS,EAEb,SAASA,EAAIiS,EAAYpgB,EAAU6F,GAGtC,OAFAA,EAASA,KAAW,QAAQua,GAAc,GAAK,IAC/C7f,EAAQ6f,GAAY,SAAUT,EAAM9C,GAAK,OAAQhX,EAAOgX,GAAK7c,EAAS2f,EAAM9C,MACrEhX,EAYJ,IAAI2a,EAAS,SAAU/G,GAAO,OAAO1G,OAAOC,KAAKyG,GAAKtL,KAAI,SAAU9I,GAAO,OAAOoU,EAAIpU,OAclFob,EAAW,SAAUf,EAAMgB,GAAQ,OAAOhB,GAAQgB,GAclDC,EAAW,SAAUjB,EAAMgB,GAAQ,OAAOhB,GAAQgB,GAUlDrS,EAAU,SAAUqR,EAAMgB,GAAQ,OAAOhB,EAAK9d,OAAO8e,IAWrDE,EAAW,SAAUlB,EAAMgB,GAClC,OAAO,QAAQA,GAAQhB,EAAK9d,OAAO8e,EAAKtS,OAAOwS,EAAU,KAAOC,EAAMnB,EAAMgB,IAMzE,SAASG,EAAM3B,EAAKzF,GAEvB,OADAyF,EAAIjf,KAAKwZ,GACFyF,EAGJ,IAAI4B,EAAQ,SAAUpH,EAAKqH,GAAS,OAAQjC,EAAQpF,EAAKqH,GAASrH,EAAMmH,EAAMnH,EAAKqH,IAW/EC,EAAS,SAAU9B,GAAO,OAAOA,EAAI9Q,OAAOC,EAAS,KAyBrD4S,EAkBJ,SAAkBC,EAAgBC,GAErC,YADe,IAAXA,IAAqBA,EAAS,kBAC3B,SAAU1H,GACb,IAAI3T,EAASob,EAAezH,GAC5B,IAAK3T,EACD,MAAM,IAAImM,OAAM,QAAWkP,GAAUA,EAAO1H,GAAO0H,GAEvD,OAAOrb,IA2BR,SAASqY,IAEZ,IADA,IAAIhd,EAAO,GACFme,EAAK,EAAGA,EAAK9d,UAAUoN,OAAQ0Q,IACpCne,EAAKme,GAAM9d,UAAU8d,GAEzB,GAAoB,IAAhBne,EAAKyN,OACL,MAAO,GAwBX,IAvBA,IAAIwS,EAAcjgB,EAAKiN,QAAO,SAAUiT,EAAKnC,GAAO,OAAOoC,KAAKD,IAAInC,EAAItQ,OAAQyS,KAAS,kBACrFvb,EAAS,GACTyb,EAAU,SAAU1E,GAGpB,OAAQ1b,EAAKyN,QACT,KAAK,EACD9I,EAAO7F,KAAK,CAACkB,EAAK,GAAG0b,KACrB,MACJ,KAAK,EACD/W,EAAO7F,KAAK,CAACkB,EAAK,GAAG0b,GAAI1b,EAAK,GAAG0b,KACjC,MACJ,KAAK,EACD/W,EAAO7F,KAAK,CAACkB,EAAK,GAAG0b,GAAI1b,EAAK,GAAG0b,GAAI1b,EAAK,GAAG0b,KAC7C,MACJ,KAAK,EACD/W,EAAO7F,KAAK,CAACkB,EAAK,GAAG0b,GAAI1b,EAAK,GAAG0b,GAAI1b,EAAK,GAAG0b,GAAI1b,EAAK,GAAG0b,KACzD,MACJ,QACI/W,EAAO7F,KAAKkB,EAAKgN,KAAI,SAAU4Q,GAAS,OAAOA,EAAMlC,SAIxDA,EAAI,EAAGA,EAAIuE,EAAavE,IAC7B0E,EAAQ1E,GAEZ,OAAO/W,EAsBJ,SAASyS,EAAWmH,EAAM8B,GAC7B,IAAInc,EAAKrB,EAGT,IAFI,QAAQwd,KACRnc,EAAMmc,EAAY,GAAIxd,EAAQwd,EAAY,MACzC,QAASnc,GACV,MAAM,IAAI4M,MAAM,oCAEpB,OADAyN,EAAKra,GAAOrB,EACL0b,EAGJ,SAAS1S,EAAKkS,GACjB,OAAQA,EAAItQ,QAAUsQ,EAAIA,EAAItQ,OAAS,SAAO+E,EAK3C,SAAS8N,EAAKC,EAAKC,GAKtB,OAJIA,GACA5O,OAAOC,KAAK2O,GAAMphB,SAAQ,SAAU8E,GAAO,cAAcsc,EAAKtc,MAC7Dsc,IACDA,EAAO,IACJrhB,EAAOqhB,EAAMD,GA6DjB,IAAIE,EAA2B,SAAU3e,GAAW,OAAOA,EAAQ4e,OAAM,SAAUC,GAAK,OAAO,MAAS7e,GACpG8e,EAAkB,SAAUld,GAAS,OAAO+c,EAAyB,cAAmB/c,qHCxhBnG,IAGWmd,EAAW,SAAU/K,EAASgL,GACrC,OAAOA,EAAQ7T,QAAO,SAAUsL,EAAKrU,GAAO,OAASqU,EAAIrU,IAJtC6c,EAIoDjL,EAAU,IAAM5R,EAAM,KAJzD,WACpC,MAAM,IAAI4M,MAAM,yBAA2BiQ,EAAS,kEAGiDxI,EAJ5F,IAAUwI,IAI2F,KAE9G3R,EAAW,CACXhK,QAAIoN,EACJ5D,eAAW4D,mGCyCf,IAAIwO,EAAsB,WACtB,SAASA,EAAKC,GACV5iB,KAAK4iB,KAAOA,EACZ5iB,KAAK6iB,KAAOD,EAAKE,MAAM,KACvB,IAAIC,EAAe/iB,KAAK4iB,KACnBE,MAAM,KACNnU,KAAI,SAAUqU,GACf,MAAY,OAARA,EACO,qBACC,MAARA,EACO,WACJ,MAAQA,KAEd/P,KAAK,IACVjT,KAAKijB,OAAS,IAAI9Z,OAAO,IAAM4Z,EAAe,KAalD,OAVAJ,EAAKzJ,GAAK,SAAU0J,GAChB,QAAS,SAASnZ,KAAKmZ,IAG3BD,EAAKxR,WAAa,SAAUyR,GACxB,OAAOD,EAAKzJ,GAAG0J,GAAQ,IAAID,EAAKC,GAAQ,MAE5CD,EAAK9gB,UAAUqhB,QAAU,SAAU1d,GAC/B,OAAOxF,KAAKijB,OAAOE,KAAK,IAAM3d,IAE3Bmd,EA3Bc,+MC1CzB,IAAIxF,EAAkD,WAClD,IAAK,IAAIC,EAAI,EAAGC,EAAI,EAAGC,EAAKtb,UAAUoN,OAAQiO,EAAIC,EAAID,IAAKD,GAAKpb,UAAUqb,GAAGjO,OACxE,IAAImO,EAAI3b,MAAMwb,GAAII,EAAI,EAA3B,IAA8BH,EAAI,EAAGA,EAAIC,EAAID,IACzC,IAAK,IAAII,EAAIzb,UAAUqb,GAAIK,EAAI,EAAGC,EAAKF,EAAErO,OAAQsO,EAAIC,EAAID,IAAKF,IAC1DD,EAAEC,GAAKC,EAAEC,GACjB,OAAOH,GA2CJ,SAAS6F,EAAMziB,GAClB,OAAO,SAAS0iB,IACZ,GAAIrhB,UAAUoN,QAAUzO,EAAGyO,OACvB,OAAOzO,EAAGwB,MAAMnC,KAAMgC,WAE1B,IAAIL,EAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtC,OAAOqhB,EAAQ/f,KAAKnB,MAAMkhB,EAASlG,EAAe,CAACnd,MAAO2B,KAS3D,SAAS2hB,IACZ,IAAI3hB,EAAOK,UACPuhB,EAAQ5hB,EAAKyN,OAAS,EAC1B,OAAO,WAEH,IADA,IAAIiO,EAAIkG,EAAOjd,EAAS3E,EAAK4hB,GAAOphB,MAAMnC,KAAMgC,WACzCqb,KACH/W,EAAS3E,EAAK0b,GAAGtb,KAAK/B,KAAMsG,GAChC,OAAOA,GASR,SAASkd,IAEZ,IADA,IAAIC,EAAQ,GACH3D,EAAK,EAAGA,EAAK9d,UAAUoN,OAAQ0Q,IACpC2D,EAAM3D,GAAM9d,UAAU8d,GAE1B,OAAOwD,EAAQnhB,MAAM,KAAM,GAAGL,MAAMC,KAAKC,WAAWge,WAQjD,IAAI0D,EAAO,SAAUle,GAAQ,OAAO,SAAUyU,GAAO,OAAOA,GAAOA,EAAIzU,KAQnEme,EAASP,GAAM,SAAU5d,EAAMoe,EAAM3J,GAAO,OAAOA,GAAOA,EAAIzU,KAAUoe,KASxE3c,EAAQ,SAAUzB,GAAQ,OAAOge,EAAKrhB,MAAM,KAAMqD,EAAKsd,MAAM,KAAKnU,IAAI+U,KAKtEG,EAAM,SAAUljB,GAAM,OAAO,WAEpC,IADA,IAAIgB,EAAO,GACFme,EAAK,EAAGA,EAAK9d,UAAUoN,OAAQ0Q,IACpCne,EAAKme,GAAM9d,UAAU8d,GAEzB,OAAQnf,EAAGwB,MAAM,KAAMR,KAMpB,SAASmiB,EAAIC,EAAKC,GACrB,OAAO,WAEH,IADA,IAAIriB,EAAO,GACFme,EAAK,EAAGA,EAAK9d,UAAUoN,OAAQ0Q,IACpCne,EAAKme,GAAM9d,UAAU8d,GAEzB,OAAOiE,EAAI5hB,MAAM,KAAMR,IAASqiB,EAAI7hB,MAAM,KAAMR,IAOjD,SAASsiB,EAAGF,EAAKC,GACpB,OAAO,WAEH,IADA,IAAIriB,EAAO,GACFme,EAAK,EAAGA,EAAK9d,UAAUoN,OAAQ0Q,IACpCne,EAAKme,GAAM9d,UAAU8d,GAEzB,OAAOiE,EAAI5hB,MAAM,KAAMR,IAASqiB,EAAI7hB,MAAM,KAAMR,IASjD,IAAI8Z,EAAM,SAAUsI,GAAO,OAAO,SAAUrE,GAAO,OAAOA,EAAI9Q,QAAO,SAAUgQ,EAAGtP,GAAK,OAAOsP,KAAOmF,EAAIzU,MAAO,KAE5G4U,EAAM,SAAUH,GAAO,OAAO,SAAUrE,GAAO,OAAOA,EAAI9Q,QAAO,SAAUgQ,EAAGtP,GAAK,OAAOsP,KAAOmF,EAAIzU,MAAO,KAE5G4J,EAAK,SAAUiL,GAAQ,OAAO,SAAUlK,GAC/C,OAAe,MAAPA,GAAeA,EAAImK,cAAgBD,GAASlK,aAAekK,IAK5DngB,EAAM,SAAUqgB,GAAK,OAAO,WAAc,OAAOA,IA4CrD,SAASC,EAAQC,GACpB,OAAO,SAAUjV,GACb,IAAK,IAAI+N,EAAI,EAAGA,EAAIkH,EAAOnV,OAAQiO,IAC/B,GAAIkH,EAAOlH,GAAG,GAAG/N,GACb,OAAOiV,EAAOlH,GAAG,GAAG/N,uRCjNhCkV,EAAQjR,OAAO1R,UAAUiT,SACzB2P,EAAM,SAAU5F,GAAK,OAAO,SAAUvP,GAAK,cAAcA,IAAMuP,IACxD6F,EAAcD,EAAI,aAClB7X,GAAY,QAAI8X,GAChBC,EAAS,SAAUC,GAAK,OAAa,OAANA,GAC/BC,GAAoB,IAAAZ,IAAGU,EAAQD,GAC/BtX,EAAaqX,EAAI,YACjBK,EAAWL,EAAI,UACf3b,EAAW2b,EAAI,UACftR,EAAW,SAAU7D,GAAK,OAAa,OAANA,GAA2B,iBAANA,GACtD0C,EAAUpQ,MAAMoQ,QAChB+S,EAAS,SAAWzV,GAAK,MAAyB,kBAAlBkV,EAAMziB,KAAKuN,IAC3C0V,EAAW,SAAW1V,GAAK,MAAyB,oBAAlBkV,EAAMziB,KAAKuN,IAOjD,SAASsM,EAAa5X,GACzB,GAAIgO,EAAQhO,IAAQA,EAAIoL,OAAQ,CAC5B,IAAI6V,EAAOjhB,EAAIlC,MAAM,GAAI,GAAI0L,EAAOxJ,EAAIlC,OAAO,GAC/C,QAASmjB,EAAK3b,QAAO,QAAIR,IAAWsG,QAAU5B,EAAKlE,QAAO,QAAI8D,IAAagC,QAE/E,OAAOhC,EAAWpJ,GAOf,IAAIkhB,GAAY,QAAI/R,GAAU,SAAK,QAAK,QAAS/F,uKCvCpD+X,EAAuB,WACvB,SAASA,EAAMC,EAAQC,QACJ,IAAXD,IAAqBA,EAAS,SACnB,IAAXC,IAAqBA,EAAS,MAClCrlB,KAAKolB,OAASA,EACdplB,KAAKqlB,OAASA,EACdrlB,KAAKslB,gBAAkB,GACvBtlB,KAAKulB,SAAU,QAAOvlB,KAAKslB,iBAqC/B,OAnCAH,EAAMtjB,UAAU2jB,QAAU,SAAUrF,GAChC,IAAIsF,EAAQzlB,KAAKolB,OAIjB,OAHAK,EAAMhlB,KAAK0f,GACPngB,KAAKqlB,QAAUI,EAAMrW,OAASpP,KAAKqlB,QACnCrlB,KAAK0lB,QACFvF,GAEXgF,EAAMtjB,UAAU6jB,MAAQ,WACpB,IAAIvF,EAAOngB,KAAKolB,OAAOnjB,QAEvB,OADAjC,KAAKslB,gBAAgBvkB,SAAQ,SAAUJ,GAAM,OAAOA,EAAGwf,MAChDA,GAEXgF,EAAMtjB,UAAU8jB,QAAU,WACtB,GAAI3lB,KAAK4lB,OACL,OAAO5lB,KAAKolB,OAAO5F,OAAO,EAAG,GAAG,IAExC2F,EAAMtjB,UAAUgkB,MAAQ,WACpB,IAAIC,EAAU9lB,KAAKolB,OAEnB,OADAplB,KAAKolB,OAAS,GACPU,GAEXX,EAAMtjB,UAAU+jB,KAAO,WACnB,OAAO5lB,KAAKolB,OAAOhW,QAEvB+V,EAAMtjB,UAAUgL,OAAS,SAAUsT,GAC/B,IAAIlR,EAAMjP,KAAKolB,OAAOlX,QAAQiS,GAC9B,OAAOlR,GAAO,GAAKjP,KAAKolB,OAAO5F,OAAOvQ,EAAK,GAAG,IAElDkW,EAAMtjB,UAAUkkB,SAAW,WACvB,OAAO/lB,KAAKolB,OAAOplB,KAAKolB,OAAOhW,OAAS,IAE5C+V,EAAMtjB,UAAUmkB,SAAW,WACvB,GAAIhmB,KAAK4lB,OACL,OAAO5lB,KAAKolB,OAAO,IAEpBD,EA5Ce,4KCKtBc,EAAkB,CAAEC,IAAK,KAAM7gB,MAAO,KAAM8gB,MAAO,MA4B5CC,EAXyB,oBAAbC,UAA4BA,SAASC,cAA0C,IAA1BD,SAASC,aAEtEC,QAAUA,OAAOC,QAlBhC,SAAoBA,GAChB,IAAIC,EAAQ,SAAU9lB,GAAM,OAAO+lB,SAAS7kB,UAAUyB,KAAKvB,KAAKpB,EAAI6lB,IACpE,MAAO,CACHN,IAAKO,EAAMD,EAAQN,KACnB7gB,MAAOohB,EAAMD,EAAQN,KACrBC,MAAOM,EAAMD,EAAQN,MAaaS,CAAWJ,OAAOC,SAAWP,EAEzDO,QAAQL,OAAUK,QAAQnhB,MAIzBmhB,QAhBf,SAAyBA,GACrB,IAAIN,EAAMM,EAAQN,IAAI5iB,KAAKkjB,GAG3B,MAAO,CAAEN,IAAKA,EAAK7gB,MAFPmhB,EAAQnhB,MAAQmhB,EAAQnhB,MAAM/B,KAAKkjB,GAAWN,EAEzBC,MADrBK,EAAQL,MAAQK,EAAQL,MAAM7iB,KAAKkjB,GAAWN,GAU/CU,CAAgBJ,ieCRxB,SAASK,EAAUC,EAAK9V,GAC3B,OAAIA,EAAI5B,QAAU0X,EACP9V,EACJA,EAAI+V,OAAO,EAAGD,EAAM,GAAK,MAW7B,SAASE,EAAU5X,EAAQ4B,GAC9B,KAAOA,EAAI5B,OAASA,GAChB4B,GAAO,IACX,OAAOA,EAEJ,SAAS/H,EAAYqJ,GACxB,OAAOA,EACFyC,QAAQ,YAAY,SAAUkS,GAAM,OAAOA,EAAGC,iBAC9CnS,QAAQ,YAAY,SAAUkS,GAAM,MAAO,IAAMA,EAAGC,iBAEtD,SAASC,EAAiBxmB,GAC7B,IAAIymB,EAAQC,EAAW1mB,GACnB2mB,EAAqBF,EAAMpL,MAAM,8BACjCwI,EAAQ8C,EAAqBA,EAAmB,GAAKF,EACrDjI,EAASxe,EAAS,MAAK,GAC3B,OAAIwe,GAAUqF,EAAMxI,MAAM,eACf,YAAcmD,EAASqF,EAAMuC,OAAO,GAExCvC,EAEJ,SAAS6C,EAAW1mB,GACvB,IAAI4mB,GAAM,QAAQ5mB,GAAMA,EAAGmB,OAAO,GAAG,GAAKnB,EAC1C,OAAQ4mB,GAAOA,EAAIzS,YAAe,YAEtC,IAAI0S,EAAc,uBAIdC,GAAmB,QAAQ,CAC3B,CAAC,MAAa,QAAI,cAClB,CAAC,MAAQ,QAAI,SACb,CAAC,MAAW,QAAI,cAChB,CAACD,EAAa,SAAUlY,GAAK,OAAOA,EAAEoY,qBAAqB5S,aAC3D,CARc,SAAUmF,GACxB,OAAO,QAASA,MAAS,QAAQA,IAAQA,EAAImK,cAAgB7Q,SAAU,QAAW0G,EAAInF,WAOxE,SAAUxF,GAAK,OAAOA,EAAEwF,aACtC,CAAC,KAAcqS,GACf,EAAC,SAAI,GAAO,QAET,SAASjJ,EAAU0G,GACtB,IAAI+C,EAAO,GACX,SAASC,EAAOpjB,GACZ,IAAI,QAASA,GAAQ,CACjB,IAA6B,IAAzBmjB,EAAKzZ,QAAQ1J,GACb,MAAO,iBACXmjB,EAAKlnB,KAAK+D,GAEd,OAAOijB,EAAiBjjB,GAE5B,OAAI,QAAYogB,GAILgD,EAAOhD,GAEX5G,KAAKE,UAAU0G,GAAG,SAAU/e,EAAKrB,GAAS,OAAOojB,EAAOpjB,MAAWuQ,QAAQ,OAAQ,KAGvF,IAAI8S,EAAoB,SAAUC,GAAQ,OAAO,SAAU9W,GAC9D,IAAKA,EACD,MAAO,CAAC,GAAI,IAChB,IAAI/B,EAAM+B,EAAI9C,QAAQ4Z,GACtB,OAAa,IAAT7Y,EACO,CAAC+B,EAAK,IACV,CAACA,EAAI+V,OAAO,EAAG9X,GAAM+B,EAAI+V,OAAO9X,EAAM,MAGtC8Y,EAAuB,SAAU/W,GAAO,OAAOA,EAAI+D,QAAQ,WAAY,KACvEiT,EAAYH,EAAkB,KAC9BI,EAAaJ,EAAkB,KAC/BK,EAAaL,EAAkB,KAC/BM,EAAc,SAAUnX,GAAO,OAAQA,EAAMA,EAAI+D,QAAQ,KAAM,IAAM,IAWzE,SAASqT,EAAaC,GACzB,IAAIC,EAAK,IAAInf,OAAO,IAAMkf,EAAQ,IAAK,KACvC,OAAO,SAAUrX,GAAO,OAAOA,EAAI8R,MAAMwF,GAAIhf,OAAO,OAcjD,SAASif,EAAerO,EAAK5K,GAChC,OAAI,SAAS,QAAK4K,MAAS,QAAS5K,GACzB4K,EAAIpY,MAAM,GAAI,GAAGM,QAAO,QAAK8X,GAAO5K,IACxC,QAAM4K,EAAK5K,0GCpElBkZ,iQA3BJ,SAASC,EAAaC,GAClB,IAAKA,EACD,MAAO,oBACX,IAAIjb,EAAQib,EAAOC,gBAAkBD,EAAOC,gBAAgBnjB,MAAQ,SAAW,SAC/E,MAAO,YAAckjB,EAAOrd,GAAK,IAAMqd,EAAOtd,MAAQ,IAAMsd,EAAOpd,IAAM,KAAOod,EAAOljB,KAAO,IAAMiI,EAAQ,KAOhH,SAASmb,EAAchW,GACnB,OAAO,QAASA,GAAS4V,EAAS5V,GAAS4V,EAASA,EAAS5V,KAgBjE,SAAW4V,GACPA,EAASA,EAAkB,QAAI,GAAK,UACpCA,EAASA,EAAqB,WAAI,GAAK,aACvCA,EAASA,EAAe,KAAI,GAAK,OACjCA,EAASA,EAAiB,OAAI,GAAK,SACnCA,EAASA,EAAqB,WAAI,GAAK,aAL3C,CAMGA,IAAaA,EAAW,KAE3B,IAAIK,GAAO,QAAM,OACbC,GAAO,QAAM,cACbC,EAAW,SAAUnZ,GAAS,MAAO,eAAiBiZ,EAAKjZ,GAAS,IAAMkZ,EAAKlZ,IA6J/EvH,EAAQ,IAzJe,WAEvB,SAAS2gB,IAELhpB,KAAKipB,SAAW,GAChBjpB,KAAKkpB,mBAAqB,EAwI9B,OArIAF,EAAMnnB,UAAUsnB,KAAO,SAAU7T,EAAS8T,GACtC,IAAIjZ,EAAQnQ,KACPopB,EAAWha,SACZga,EAAa7V,OAAOC,KAAKgV,GACpB7Z,KAAI,SAAU6O,GAAK,OAAO6L,SAAS7L,EAAG,OACtClU,QAAO,SAAUkU,GAAK,OAAQ8L,MAAM9L,MACpC7O,KAAI,SAAU9I,GAAO,OAAO2iB,EAAS3iB,OAE9CujB,EAAWza,IAAIia,GAAe7nB,SAAQ,SAAUwoB,GAAY,OAAQpZ,EAAM8Y,SAASM,GAAYjU,MAEnG0T,EAAMnnB,UAAU2nB,OAAS,WAErB,IADA,IAAIJ,EAAa,GACRtJ,EAAK,EAAGA,EAAK9d,UAAUoN,OAAQ0Q,IACpCsJ,EAAWtJ,GAAM9d,UAAU8d,GAE/B9f,KAAKmpB,MAAK,EAAMC,IAEpBJ,EAAMnnB,UAAU4nB,QAAU,WAEtB,IADA,IAAIL,EAAa,GACRtJ,EAAK,EAAGA,EAAK9d,UAAUoN,OAAQ0Q,IACpCsJ,EAAWtJ,GAAM9d,UAAU8d,GAE/B9f,KAAKmpB,MAAK,EAAOC,IAWrBJ,EAAMnnB,UAAUyT,QAAU,SAAUiU,GAChC,QAASvpB,KAAKipB,SAASL,EAAcW,KAGzCP,EAAMnnB,UAAU6nB,qBAAuB,SAAU9Z,GACxC5P,KAAKsV,QAAQkT,EAASmB,aAE3B,QAAgBZ,EAASnZ,GAAS,kBAAmB,QAAUA,KAGnEoZ,EAAMnnB,UAAU+nB,uBAAyB,SAAUha,GAC1C5P,KAAKsV,QAAQkT,EAASmB,aAE3B,QAAgBZ,EAASnZ,GAAS,kBAAmB,QAAUA,KAGnEoZ,EAAMnnB,UAAUgoB,oBAAsB,SAAUC,EAAMla,EAAOzP,GACzD,GAAKH,KAAKsV,QAAQkT,EAASuB,MAA3B,CAEA,IAAIxpB,GAAQ,QAAM,qBAAN,CAA4BJ,IAAY,WAAY0Q,GAAU,QAAM,+BAAN,CAAsC1Q,KAAY,QAAM,oBAAN,CAA2BA,IAAY,UAAWqF,GAAO,QAAiBskB,EAAKE,eAAexpB,UAC1N,QAAgBuoB,EAASnZ,GAAS,eAAiBrP,EAAQ,aAAesQ,EAAU,MAAO,QAAU,IAAKrL,MAG9GwjB,EAAMnnB,UAAUooB,gBAAkB,SAAUC,EAAYta,EAAOua,GACtDnqB,KAAKsV,QAAQkT,EAASuB,OAE3B,QAAgBhB,EAASnZ,GAAS,0BAA2B,QAAU,KAAK,QAAUsa,MAG1FlB,EAAMnnB,UAAUuoB,iBAAmB,SAAUjiB,EAAM8H,EAAML,GAChD5P,KAAKsV,QAAQkT,EAAS6B,UAE3B,QAAgBtB,EAASnZ,GAAS,uBAAyBzH,EAAO,KAAO8H,EAAO,MAGpF+Y,EAAMnnB,UAAUyoB,wBAA0B,SAAUtS,EAAYpI,GACvD5P,KAAKsV,QAAQkT,EAAS6B,UAE3B,QAAgBtB,EAASnZ,GAAS,gCAAkCoI,EAAa,SAAU,QAAU,KAAK,QAAUA,EAAWrQ,SAGnIqhB,EAAMnnB,UAAU0oB,WAAa,SAAUC,EAAQ5a,GACtC5P,KAAKsV,QAAQkT,EAASmB,aAE3B,QAAgBZ,EAASnZ,GAAS,kBAAmB,QAAUA,GAAS,aAAe4a,IAG3FxB,EAAMnnB,UAAU4oB,aAAe,SAAUC,EAAY9a,GAC5C5P,KAAKsV,QAAQkT,EAASmB,aAE3B,QAAgBZ,EAASnZ,GAAS,kBAAmB,QAAUA,GAAS,kBAAoB8a,EAAWllB,OAG3GwjB,EAAMnnB,UAAU8oB,iBAAmB,SAAUpqB,EAAOqqB,EAAUvL,QAC5C,IAAVA,IAAoBA,EAAQ,IAC3Brf,KAAKsV,QAAQkT,EAASqC,SAE3B,QAAgB,aAAc,QAAU,GAAItqB,GAAS,IAAMkoB,EAAamC,GAAYvL,IAGxF2J,EAAMnnB,UAAUipB,yBAA2B,SAAUF,EAAU/Z,GACtD7Q,KAAKsV,QAAQkT,EAASqC,SAE3B7qB,KAAK2qB,iBAAiB,WAAYC,EAAU,kCAAoC/Z,EAAU,MAG9FmY,EAAMnnB,UAAUkpB,gBAAkB,SAAUH,EAAUpjB,GAC7CxH,KAAKsV,QAAQkT,EAASqC,SAE3B7qB,KAAK2qB,iBAAiB,OAAQC,EAAU,WAAY,QAAU,IAAKpjB,KAGvEwhB,EAAMnnB,UAAUmpB,cAAgB,SAAUC,GACtC,GAAKjrB,KAAKsV,QAAQkT,EAAS0C,YAA3B,CAEA,IAAIC,EAAY,uBAEZC,EAAUH,EACTtc,KAAI,SAAU0c,GACf,IAAIC,EACA7kB,EAAS4kB,EAAG5kB,OAAQiE,EAAa2gB,EAAG3gB,WACpC6gB,EAAM9kB,GAAUA,EAAO6E,IACvBzD,EAAM6C,GAAcA,EAAW3C,SAASgC,SAASvE,KAAO,MAAQkF,EAAW3C,SAAS6S,MAAQ,IAChG,OAAO0Q,EAAK,IAAOH,GAAaI,EAAKD,EAPzB,iCAOyCzjB,EAAKyjB,KAEzDE,MAAK,SAAU/N,EAAGmB,GAAK,OAAQnB,EAAE0N,IAAc,IAAIM,cAAc7M,EAAEuM,IAAc,OACtF,UAAkBC,KAGtBpC,EAAMnnB,UAAU6pB,sBAAwB,SAAUnrB,EAAOmK,GAChD1K,KAAKsV,QAAQkT,EAAS0C,aAE3B,QAAgB,eAAiB3qB,EAAQ,IAzK1B,SAAUmK,GAC7B,IAAIoP,EAAOpP,EAAW3C,SAClB0F,EAAQqM,EAAK/P,SAASvE,MAAQ,SAClC,MAAO,SAAWkF,EAAWyQ,IAAM,UAAY1N,EAAQ,8BAAgCqM,EAAKiB,YAAc,IAAMjB,EAAKmB,qBAAuB,IAsKzF0Q,CAAiBjhB,KAGpEse,EAAMnnB,UAAU+pB,4BAA8B,SAAUrrB,EAAOqqB,GACtD5qB,KAAKsV,QAAQkT,EAAS0C,aAE3B,QAAgB,eAAiB3qB,EAAQ,IAAMkoB,EAAamC,KAEzD5B,EA7Ie,oOCxEtB6C,EAAiC,WACjC,SAASA,IAML7rB,KAAKoO,OAAS,IAAI,IAElBpO,KAAK8rB,yBAA2B,EAEhC9rB,KAAK+rB,kBAAoB,IAAI,IAAM,GAAI,GAEvC/rB,KAAKgsB,sBAAwB,IAAI,IAAM,GAAI,GAO/C,OALAH,EAAgBhqB,UAAUqT,QAAU,WAChClV,KAAK+rB,kBAAkBlG,QACvB7lB,KAAKgsB,sBAAsBnG,QAC3B7lB,KAAKisB,WAAa,MAEfJ,EApByB,sLCiBhCK,EAAe,SAAUD,GACzB,IAAIvX,EAASuX,EAAWvX,OAuBpB6G,EAAW0Q,EACVE,WACA7iB,QAAO,SAAUmE,GAAS,QAASA,EAAMuG,UAAUoY,YACnDzd,KAAI,SAAUlB,GAAS,OAAO4e,EAAcJ,EAAYxe,MAC7D,OAAO,WAAgB8N,GAAUxQ,MA1BjC,WACI,GAAyD,QAArDkhB,EAAWK,qBAAqBnsB,UAAU4e,OAAkB,CAG5D,IAAIwN,EAAON,EAAWO,cACtB,OAAO9X,EAAOmC,aAAaxQ,OAAOkmB,EAAKE,aAAcF,EAAKne,SAAUme,EAAKpsB,WAI7E,IAAIusB,EAAOhY,EAAOuC,WACd3Q,EAASomB,EAAK1Q,MAAM0Q,EAAKC,SACzBpQ,EAAOjW,GAAUA,EAAOiW,KAG5B,GAAIA,GAAsB,UAAdA,EAAKrN,KAAkB,CAC/B,IAAIzB,EAAQ8O,EAAK9O,MACbW,EAAS9H,EAAO0V,MACpB,OAAOtH,EAAOmC,aAAaxQ,OAAOoH,EAAOW,EAAQ6d,EAAW9rB,WAGhEuU,EAAOuC,WAAW2V,WAQfC,EAAuB,SAAUC,GACxC,OAAOA,EAAkB/c,SAAS,CAAEoc,SAAU,SAAU1e,GAAS,QAASA,EAAM2e,WAAeF,IAS5F,SAASG,EAAcJ,EAAYxe,GACtC,IAAIsf,EAAatf,EAAMuG,UAAUoY,SAE7B3oB,EAAUspB,EAAqB,SAwBnC,OAvBKtpB,IAWDA,EAAUspB,EAAqB,SAAI,YACzBA,EAAWd,EAAYxe,IAC5B1C,MAIT,SAA6BzE,GAIzB,OAHIA,GAAU1E,MAAMoQ,QAAQ1L,EAAO0mB,SAC/B1mB,EAAO0mB,OAAOjsB,SAAQ,SAAUksB,GAAU,OAAOhB,EAAWvX,OAAOkC,cAAc8C,SAASuT,MAEvF3mB,KAPFyE,MAbS,SAAUzE,GAIpB,cAHOmH,EAAM2e,gBACN3e,EAAMuG,UAAUoY,gBAChBW,EAAqB,SACrBzmB,KAEC,SAAU4mB,GAElB,cADOH,EAAqB,SACrB,cAAmBG,OAc3BzpB,oPCnFP0pB,kUAJAC,EAAS7Z,OAAO1R,UAAUa,gBAK9B,SAAWyqB,GACPA,EAAQA,EAAc,KAAI,GAAK,OAC/BA,EAAQA,EAAgB,OAAI,GAAK,SACjCA,EAAQA,EAAgB,OAAI,GAAK,SAHrC,CAIGA,IAAYA,EAAU,KA2DzB,IAAIE,EAAuB,WACvB,SAASA,EAAMhiB,EAAI6D,EAAM2G,EAAUyX,EAAW7f,GAC1C,IAAIlC,EA3DZ,SAA6BgiB,EAAW1X,EAAUpI,GAC9C,IAAI+f,GAA6C,IAAzB/f,EAAMggB,gBAA4B5X,IAAasX,EAAQO,aAAWvZ,EACtFwZ,GAAU,QAAK,CAAClgB,EAAMkgB,QAASH,GAAmB,MAClDI,GAAgB,QAAUD,GAAW,CAAEA,QAASA,GAAY,GAC5DE,EAGR,SAAyBhmB,GAGrB,SAASimB,IACL,OAAOjmB,EAAIrD,MAHfqD,EAlBc,SAAUA,GACxB,OAAiG,IAA1F,CAAC,QAAS,OAAQ,SAAU,QAAS,WAAWyB,OAAO8jB,EAAO9pB,KAAKuE,GAAO,KAAKuH,OAiBhF2e,CAAYlmB,GAAO,CAAErD,MAAOqD,GAAQA,EAC1CimB,EAAmC,aAAI,EAIvC,IAAIE,GAAO,QAAanmB,EAAIrD,OAASqD,EAAIrD,MAAQspB,EACjD,OAAO,QAAOjmB,EAAK,CAAEmmB,KAAMA,IAVTC,CAAgBxgB,GAASA,EAAMW,QAAUX,EAAMW,OAAOmf,IACxE,OAAO,QAAOK,EAAeC,GAsDZK,CAAoB7iB,EAAIwK,EAAUpI,GAC/CyB,EA5CR,SAAiBrH,EAAKsmB,EAAStY,EAAUxK,EAAI+iB,GACzC,GAAIvmB,EAAIqH,MAAQif,GAA4B,WAAjBA,EAAQ3oB,KAC/B,MAAM,IAAIiN,MAAM,UAAYpH,EAAK,kCACrC,GAAIxD,EAAIqH,MAAQif,GAA4B,WAAjBA,EAAQ3oB,MAAqB4oB,EAAWlf,KAAKrH,EAAIqH,MACxE,OAAOkf,EAAWlf,KAAKrH,EAAIqH,MAC/B,GAAIif,EACA,OAAOA,EACX,IAAKtmB,EAAIqH,KAAM,CACX,IAAIA,EAAO2G,IAAasX,EAAQkB,OAC1B,MACAxY,IAAasX,EAAQmB,KACjB,OACAzY,IAAasX,EAAQO,OACjB,QACA,SACd,OAAOU,EAAWlf,KAAKA,GAE3B,OAAOrH,EAAIqH,gBAAgB,IAAYrH,EAAIqH,KAAOkf,EAAWlf,KAAKrH,EAAIqH,MA2B3Dqf,CAAQhjB,EAAQ2D,EAAM2G,EAAUxK,EAAIiiB,EAAUc,YACrD,IAUQI,EACAC,EAXJC,GAUIF,EAAgB,CAAEjP,MAAO1J,IAAasX,EAAQO,QAAS,QACvDe,EAAyBpjB,EAAG2Q,MAAM,SAAW,CAAEuD,OAAO,GAAS,IAC5D,QAAOiP,EAAeC,EAAwBljB,GAAQgU,OAXjErQ,EAAOwf,EAAYxf,EAAKyf,SAASD,EAAW7Y,IAAasX,EAAQO,QAAUxe,EAC3E,IAAI0f,OAA8Bza,IAAjB5I,EAAO/G,OAAuBqR,IAAasX,EAAQO,OAChEC,GAAU,QAAUpiB,EAAOoiB,WAAapiB,EAAOoiB,UAAYze,EAAKye,QAChEkB,GAAM,QAAUtjB,EAAOsjB,OAAStjB,EAAOsjB,MAAQ3f,EAAK2f,IACpDC,EA9BZ,SAAyBvjB,EAAQqjB,EAAYG,GACzC,IAAID,EAASvjB,EAAOujB,OACpB,IAAKF,IAAyB,IAAXE,EACf,OAAO,EACX,KAAK,QAAUA,IAAqB,MAAVA,EACtB,OAAOC,EACX,IAAe,IAAXD,IAAmB,QAASA,GAC5B,OAAOA,EACX,MAAM,IAAIrc,MAAM,2BAA6Bqc,EAAS,uDAsBrCE,CAAgBzjB,EAAQqjB,EAAYtB,EAAU2B,uBACvDla,EArBZ,SAAoBxJ,EAAQmjB,EAAWE,EAAYE,GAC/C,IAAIC,EAAgB,CAChB,CAAEG,KAAM,GAAIC,GAAIP,GAAcF,OAAYva,EAAY,IACtD,CAAE+a,KAAM,KAAMC,GAAIP,GAAcF,OAAYva,EAAY,KAExDY,GAAU,QAAQxJ,EAAOwJ,SAAWxJ,EAAOwJ,QAAU,IACrD,QAAS+Z,IACT/Z,EAAQtU,KAAK,CAAEyuB,KAAMJ,EAAQK,QAAIhb,IACrC,IAAIib,GAAiB,QAAIra,GAAS,QAAK,SACvC,OAAO,QAAOga,GAAe,SAAU5O,GAAQ,OAA8C,IAAvCiP,EAAelhB,QAAQiS,EAAK+O,SAAiB9sB,OAAO2S,GAYxFsa,CAAW9jB,EAAQmjB,EAAWE,EAAYE,GACpD1P,GAAU,QAAU7T,EAAO6T,WAAa7T,EAAO6T,UAAYlQ,EAAKkQ,SAOpE,QAAOpf,KAAM,CAAEqL,GAAIA,EAAI6D,KAAMA,EAAM2G,SAAUA,EAAU+Y,WAAYA,EAAYjB,QAASA,EAASkB,IAAKA,EAAKC,OAAQA,EAAQ/Z,QAASA,EAASqK,QAASA,EAASG,MAAOmP,EAAWnjB,OAAQA,IAoG7L,OAlGA8hB,EAAMrM,OAAS,SAAU5S,EAAQ4S,QACd,IAAXA,IAAqBA,EAAS,IAElC,IADA,IAAI1F,EAAc,GACTwE,EAAK,EAAGwP,EAAWlhB,EAAQ0R,EAAKwP,EAASlgB,OAAQ0Q,IAAM,CAC5D,IAAI9Q,EAAQsgB,EAASxP,GACrBxE,EAAYtM,EAAM3D,IAAM2D,EAAMxK,MAAMwc,EAAOhS,EAAM3D,KAErD,OAAOiQ,GAaX+R,EAAMkC,QAAU,SAAUnhB,EAAQohB,EAASC,GAGvC,YAFgB,IAAZD,IAAsBA,EAAU,SACpB,IAAZC,IAAsBA,EAAU,IAC7BrhB,EAAO9E,QAAO,SAAU0F,GAAS,OAAQA,EAAME,KAAKC,OAAOqgB,EAAQxgB,EAAM3D,IAAKokB,EAAQzgB,EAAM3D,SAWvGgiB,EAAMle,OAAS,SAAUf,EAAQohB,EAASC,GAGtC,YAFgB,IAAZD,IAAsBA,EAAU,SACpB,IAAZC,IAAsBA,EAAU,IACsB,IAAnDpC,EAAMkC,QAAQnhB,EAAQohB,EAASC,GAASrgB,QAGnDie,EAAMqC,UAAY,SAAUthB,EAAQ4S,GAEhC,YADe,IAAXA,IAAqBA,EAAS,IAC3B5S,EAAOO,KAAI,SAAUK,GAAS,OAAOA,EAAM0gB,UAAU1O,EAAOhS,EAAM3D,QAASuD,OAAO,MAAU,IAEvGye,EAAMxrB,UAAU8tB,eAAiB,SAAUnrB,GACvC,OAAOxE,KAAK4uB,YAAc5uB,KAAKkP,KAAKC,OAAOnP,KAAKwE,QAASA,IAM7D6oB,EAAMxrB,UAAU2C,MAAQ,SAAUA,GAC9B,IAAI2L,EAAQnQ,KA0BZ,OADAwE,EAR2B,SAAUR,GACjC,IAAK,IAAI8b,EAAK,EAAGuL,EAAKlb,EAAM4E,QAAS+K,EAAKuL,EAAGjc,OAAQ0Q,IAAM,CACvD,IAAIrM,EAAQ4X,EAAGvL,GACf,GAAIrM,EAAMyb,OAASlrB,EACf,OAAOyP,EAAM0b,GAErB,OAAOnrB,EAEH4rB,CAAqBprB,IACtB,QAAYA,GAtBG,WAClB,GAAI2L,EAAM0f,mBACN,OAAO1f,EAAM0f,mBAAmBC,aACpC,IAAK,cACD,MAAM,IAAIrd,MAAM,+DACpB,IAAIqd,EAAe,qBAA0B3f,EAAM5E,OAAOyiB,MAC1D,GAAI8B,MAAAA,IAAwD3f,EAAMjB,KAAKgK,GAAG4W,GACtE,MAAM,IAAIrd,MAAM,kBAAoBqd,EAAe,oBAAsB3f,EAAM9E,GAAK,sCAAwC8E,EAAMjB,KAAK1J,KAAO,KAIlJ,OAHI2K,EAAM5E,OAAOyiB,KAAkB,cAC/B7d,EAAM0f,mBAAqB,CAAEC,aAAcA,IAExCA,EAWiBC,GAAoB/vB,KAAKkP,KAAK8gB,WAAWxrB,IAEzE6oB,EAAMxrB,UAAUouB,SAAW,WACvB,OAAOjwB,KAAK6V,WAAasX,EAAQO,QAErCL,EAAMxrB,UAAU6tB,UAAY,SAAUlrB,GAElC,KAAK,QAAYA,IAAoB,OAAVA,IAAmBxE,KAAK4uB,WAC/C,OAAO,EAEX,IAAI/T,EAAa7a,KAAKkP,KAAK8gB,WAAWxrB,GACtC,IAAKxE,KAAKkP,KAAKgK,GAAG2B,GACd,OAAO,EAEX,IAAIqV,EAAUlwB,KAAKkP,KAAK2F,OAAOgG,GAC/B,SAAS,QAASqV,KAAalwB,KAAKkP,KAAKoV,QAAQ7a,KAAKymB,KAE1D7C,EAAMxrB,UAAUiT,SAAW,WACvB,MAAO,UAAY9U,KAAKqL,GAAK,IAAMrL,KAAKkP,KAAO,aAAelP,KAAK8uB,OAAS,eAAiB9uB,KAAK4uB,WAAa,KAE5GvB,EAtHe,4OChDtB8C,EAA2B,WAM3B,SAASA,EAAUjd,GAEflT,KAAKskB,QAAU,KAEftkB,KAAKof,SAAU,GACf,QAAOpf,KAAMkT,GAgDjB,OA5CAid,EAAUtuB,UAAUqX,GAAK,SAAUlV,EAAK6B,GACpC,OAAO,GAGXsqB,EAAUtuB,UAAUgT,OAAS,SAAU7Q,EAAK6B,GACxC,OAAO7B,GAGXmsB,EAAUtuB,UAAUoT,OAAS,SAAUjR,EAAK6B,GACxC,OAAO7B,GAGXmsB,EAAUtuB,UAAUsN,OAAS,SAAUsO,EAAGmB,GAEtC,OAAOnB,GAAKmB,GAEhBuR,EAAUtuB,UAAUuuB,YAAc,WAC9B,IAAIC,EAAMrwB,KAAKskB,QAAQxP,WACvB,OAAOub,EAAItJ,OAAO,EAAGsJ,EAAIjhB,OAAS,IAEtC+gB,EAAUtuB,UAAUiT,SAAW,WAC3B,MAAO,cAAgB9U,KAAKwF,KAAO,KAGvC2qB,EAAUtuB,UAAUmuB,WAAa,SAAUhsB,GACvC,OAAOhE,KAAKkZ,GAAGlV,GAAOA,EAAMhE,KAAKiV,OAAOjR,IAY5CmsB,EAAUtuB,UAAU8sB,SAAW,SAAU2B,EAAML,GAC3C,IAAKK,EACD,OAAOtwB,KACX,GAAa,SAATswB,IAAoBL,EACpB,MAAM,IAAIxd,MAAM,kDACpB,OAAO,IAAI8d,EAAUvwB,KAAMswB,IAExBH,EA3DmB,GA+D9B,SAASI,EAAUrhB,EAAMohB,GACrB,IAAIngB,EAAQnQ,KAEZ,SAASwwB,EAAUxsB,GACf,OAAO,QAAQA,GAAOA,GAAM,QAAUA,GAAO,CAACA,GAAO,GAczD,SAASysB,EAAajwB,EAAUkwB,GAC5B,OAAO,SAAqB1sB,GACxB,IAAI,QAAQA,IAAuB,IAAfA,EAAIoL,OACpB,OAAOpL,EACX,IAAI0b,EAAM8Q,EAAUxsB,GAChBsC,GAAS,QAAIoZ,EAAKlf,GACtB,OAAyB,IAAlBkwB,EAAgF,KAAvD,QAAOpqB,GAAQ,SAAUgJ,GAAK,OAAQA,KAAMF,OAjBpF,SAAqBpL,GACjB,OAAQA,EAAIoL,QACR,KAAK,EACD,OACJ,KAAK,EACD,MAAgB,SAATkhB,EAAkBtsB,EAAI,GAAKA,EACtC,QACI,OAAOA,GAUgF2sB,CAAYrqB,IAI/G,SAASsqB,EAAmBpwB,GACxB,OAAO,SAAqBqwB,EAAMC,GAC9B,IAAIC,EAAOP,EAAUK,GAAOG,EAAQR,EAAUM,GAC9C,GAAIC,EAAK3hB,SAAW4hB,EAAM5hB,OACtB,OAAO,EACX,IAAK,IAAIiO,EAAI,EAAGA,EAAI0T,EAAK3hB,OAAQiO,IAC7B,IAAK7c,EAASuwB,EAAK1T,GAAI2T,EAAM3T,IACzB,OAAO,EAEf,OAAO,GAGf,CAAC,SAAU,SAAU,SAAU,cAActc,SAAQ,SAAUyE,GAC3D,IAAIyrB,EAAc/hB,EAAK1J,GAAMlC,KAAK4L,GAC9BgiB,EAAqB,WAAT1rB,EAAoBorB,EAAqBH,EACzDtgB,EAAM3K,GAAQ0rB,EAAUD,OAE5B,QAAOjxB,KAAM,CACT2tB,QAASze,EAAKye,QACdnoB,KAAM0J,EAAK1J,KACX8e,QAASpV,EAAKoV,QACdlF,QAASlQ,EAAKkQ,QACdyP,IAAK3f,EAAK2f,IACV3V,GAAIuX,EAAavhB,EAAKgK,GAAG5V,KAAK4L,IAAO,GACrCiiB,WAAYb,+GC5DZc,kUApDJC,EAA4B,WAC5B,SAASA,IACLrxB,KAAKwlB,SAAU,EACfxlB,KAAKsxB,UAAY,GACjBtxB,KAAKuxB,cAAe,QAAKF,EAAWxvB,UAAW,CAC3C,OACA,SACA,QACA,OACA,MACA,OACA,OACA,OACA,QAIJ7B,KAAK+D,OAAQ,SAAQ,QAAI/D,KAAKuxB,cADf,SAAU9X,EAAYjU,GAAQ,OAAO,IAAI,KAAU,QAAO,CAAEA,KAAMA,GAAQiU,OAClC,IA+B3D,OA7BA4X,EAAWxvB,UAAUqT,QAAU,WAC3BlV,KAAK+D,MAAQ,IAOjBstB,EAAWxvB,UAAUqN,KAAO,SAAU1J,EAAMiU,EAAY+X,GACpD,KAAK,QAAU/X,GACX,OAAOzZ,KAAK+D,MAAMyB,GACtB,GAAIxF,KAAK+D,MAAMrB,eAAe8C,GAC1B,MAAM,IAAIiN,MAAM,iBAAmBjN,EAAO,+BAO9C,OANAxF,KAAK+D,MAAMyB,GAAQ,IAAI,KAAU,QAAO,CAAEA,KAAMA,GAAQiU,IACpD+X,IACAxxB,KAAKsxB,UAAU7wB,KAAK,CAAE+E,KAAMA,EAAM0N,IAAKse,IAClCxxB,KAAKwlB,SACNxlB,KAAKyxB,mBAENzxB,MAEXqxB,EAAWxvB,UAAU4vB,gBAAkB,WACnC,KAAOzxB,KAAKsxB,UAAUliB,QAAQ,CAC1B,IAAIF,EAAOlP,KAAKsxB,UAAUrvB,QAC1B,GAAIiN,EAAKoV,QACL,MAAM,IAAI7R,MAAM,sDACpB,QAAOzS,KAAK+D,MAAMmL,EAAK1J,MAAO,qBAA0B0J,EAAKgE,QAG9Dme,EAhDoB,GAoDvBD,EAAkB,SAAUle,GAC5B,IAAIwe,EAAc,SAAU1tB,GAAO,OAAe,MAAPA,EAAcA,EAAI8Q,WAAa9Q,GACtE2tB,EAAkB,CAClB9c,OAAQ6c,EACRzc,OAAQyc,EACRxY,IAAI,IAAAA,IAAG0Y,QACPtN,QAAS,KAETnV,OAAQ,SAAUsO,EAAGmB,GAAK,OAAOnB,GAAKmB,IAE1C,OAAO,QAAO,GAAI+S,EAAiBze,KAGvC,QAAOme,EAAWxvB,UAAW,CACzB0D,OAAQ6rB,EAAgB,IACxBjpB,KAAMipB,EAAgB,CAClB9M,QAAS,UAEbuN,MAAOT,EAAgB,IACvBU,KAAMV,EAAgB,CAClBhS,SAAS,IAEb2S,IAAKX,EAAgB,CACjBnc,OAAQ,SAAUjR,GAAO,OAAOqlB,SAASrlB,EAAK,KAC9CkV,GAAI,SAAUlV,GACV,QAAQ,QAAkBA,IAAQhE,KAAKiV,OAAOjR,EAAI8Q,cAAgB9Q,GAEtEsgB,QAAS,UAEb0N,KAAMZ,EAAgB,CAClBvc,OAAQ,SAAU7Q,GAAO,OAAQA,EAAO,EAAM,GAC9CiR,OAAQ,SAAUjR,GAAO,OAA6B,IAAtBqlB,SAASrlB,EAAK,KAC9CkV,IAAI,IAAAA,IAAG+Y,SACP3N,QAAS,QAEb4N,KAAMd,EAAgB,CAClBvc,OAAQ,SAAU7Q,GACd,OAAQhE,KAAKkZ,GAAGlV,GAEV,CAACA,EAAImuB,eAAgB,KAAOnuB,EAAIouB,WAAa,IAAItwB,OAAO,IAAK,IAAMkC,EAAIquB,WAAWvwB,OAAO,IAAImR,KAAK,UADlGkB,GAGVc,OAAQ,SAAUjR,GACd,GAAIhE,KAAKkZ,GAAGlV,GACR,OAAOA,EACX,IAAIgY,EAAQhc,KAAKsyB,QAAQ7oB,KAAKzF,GAC9B,OAAOgY,EAAQ,IAAIuW,KAAKvW,EAAM,GAAIA,EAAM,GAAK,EAAGA,EAAM,SAAM7H,GAEhE+E,GAAI,SAAUlV,GAAO,OAAOA,aAAeuuB,OAASjJ,MAAMtlB,EAAIwuB,YAC9DrjB,OAAQ,SAAUsjB,EAAGlV,GACjB,MAAO,CAAC,cAAe,WAAY,WAAW3O,QAAO,SAAUsL,EAAKvZ,GAAM,OAAOuZ,GAAOuY,EAAE9xB,OAAU4c,EAAE5c,QAAU,IAEpH2jB,QAAS,0DACTgO,QAAS,0DAEbI,KAAMtB,EAAgB,CAClBvc,OAAQ,KACRI,OAAQ,KACRiE,IAAI,IAAAA,IAAG3F,QACPpE,OAAQ,KACRmV,QAAS,UAGbJ,IAAKkN,EAAgB,CACjBvc,OAAQ,KACRI,OAAQ,KACRiE,GAAI,WAAc,OAAO,GACzB/J,OAAQ,kLCjJhBwjB,EAA6B,WAC7B,SAASA,EAAYvkB,QACF,IAAXA,IAAqBA,EAAS,KAClC,QAAOpO,KAAMoO,GA4BjB,OAlBAukB,EAAY9wB,UAAU+wB,SAAW,SAAUC,EAAWC,EAAUC,GAC5D,IAAIC,EACAC,GAAU,QAAUH,EAAUC,GAAM9nB,EAAY,GAAIioB,EAAc,GACtE,IAAK,IAAI7V,KAAK4V,EACV,GAAKA,EAAQ5V,IAAO4V,EAAQ5V,GAAGjP,SAE/B4kB,EAAezf,OAAOC,KAAKyf,EAAQ5V,GAAGjP,SACpBgB,OAElB,IAAK,IAAIsO,KAAKsV,EACNE,EAAYhlB,QAAQ8kB,EAAatV,KAAO,IAE5CwV,EAAYzyB,KAAKuyB,EAAatV,IAC9BzS,EAAU+nB,EAAatV,IAAM1d,KAAKgzB,EAAatV,KAGvD,OAAO,QAAO,GAAIzS,EAAW4nB,IAE1BF,EA/BqB,+RCS5BQ,EAA0B,WAC1B,SAASA,EAASC,GACd,GAAIA,aAAuBD,EAAU,CACjC,IAAI5kB,EAAO6kB,EACXpzB,KAAKyN,MAAQc,EAAKd,MAClBzN,KAAKwO,YAAcD,EAAKC,YAAY1M,QACpC9B,KAAKsb,aAAc,QAAO,GAAI/M,EAAK+M,aACnCtb,KAAK+X,YAAcxJ,EAAKwJ,YAAYjW,QACpC9B,KAAKwa,MAAQjM,EAAKiM,OAASjM,EAAKiM,MAAM1Y,YAErC,CACD,IAAI2L,EAAQ2lB,EACZpzB,KAAKyN,MAAQA,EACbzN,KAAKwO,YAAcf,EAAM4lB,WAAW,CAAEjU,SAAS,IAC/Cpf,KAAKsb,YAAc,GACnBtb,KAAK+X,YAActK,EAAMsK,YAAYpJ,KAAI,SAAUqE,GAAO,OAAOA,EAAItG,YA+C7E,OA5CAymB,EAAStxB,UAAU6K,MAAQ,WACvB,OAAO,IAAIymB,EAASnzB,OAGxBmzB,EAAStxB,UAAUyxB,eAAiB,SAAUllB,GAG1C,OADApO,KAAKsb,YAActb,KAAKwO,YAAYI,QAAO,SAAUsR,EAAMqT,GAAQ,OAAO,QAAWrT,EADtC,EAAnBsT,EAC2ED,GAD9CloB,GAAImoB,EAAShvB,MAAM4J,EAAOolB,EAASnoB,OAA1E,IAAUmoB,IACsF,IAC3GxzB,MAGXmzB,EAAStxB,UAAU4xB,UAAY,SAAUjuB,GACrC,OAAO,QAAKxF,KAAKwO,aAAa,QAAO,KAAMhJ,KAM/C2tB,EAAStxB,UAAUsN,OAAS,SAAUZ,EAAMmlB,GACxC,IAAIC,EAAO3zB,KAAK2zB,KAAKplB,EAAMmlB,GAC3B,OAAOC,GAAwB,IAAhBA,EAAKvkB,QAcxB+jB,EAAStxB,UAAU8xB,KAAO,SAAUplB,EAAMmlB,GACtC,GAAI1zB,KAAKyN,QAAUc,EAAKd,MACpB,OAAO,EACX,IAAIW,EAASslB,EAAWA,EAAS1zB,MAAQA,KAAKwO,YAC9C,OAAO,YAAcJ,EAAQpO,KAAKsb,YAAa/M,EAAK+M,cAMxD6X,EAASzmB,MAAQ,SAAU6B,GAAQ,OAAOA,EAAK7B,SACxCymB,EA9DkB,mWCHzBS,EAA2B,WAC3B,SAASA,KA4JT,OAzJAA,EAAUC,gBAAkB,SAAUC,EAAU3rB,GAC5C,IAAIsF,GAAQ,QAAKtF,GAAMsF,MACvB,OAAO,IAAI,IAAYqmB,EAAUrmB,EAAOtF,EAAKwG,KAAI,QAAK,gBAAgBC,OAAO,KAAQ,IAAK,KAE9FglB,EAAUG,UAAY,SAAUvH,GAC5B,IAAIre,EAAWqe,EAAYpe,SAC3B,OAAOoe,EAAY/T,SAAStQ,KAAKwG,KAAI,SAAUlB,GAAS,OAAO,IAAI,IAASA,GAAO6lB,eAAenlB,OAGtGylB,EAAUI,YAAc,SAAUC,EAAUzH,GACxC,IAAI0H,EAASN,EAAUG,UAAUvH,GACjC,OAAIA,EAAYrsB,UAAUif,QACfwU,EAAUO,cAAcF,EAAUC,EAAQ3gB,OAAOC,KAAKgZ,EAAYpe,WAEtE8lB,GAOXN,EAAUQ,iBAAmB,SAAUttB,EAAOqB,EAAM6kB,GAEhD7kB,EACKmB,QAAO,SAAUiF,GAAQ,OAAO,QAAQye,EAAQze,EAAKd,UACrD1M,SAAQ,SAAUwN,GACnB,IAAI8lB,GAAY,QAAO9lB,EAAKd,MAAM+M,OAAS,IACvC8Z,EAAUV,EAAUU,QAAQnsB,GAAM,SAAUoY,GAAK,OAAOA,IAAMhS,KAC9DgmB,EAAcF,EAAU1lB,KAAI,SAAUmL,GAAQ,OAAOhT,EAAM0tB,iBAAiBF,EAASxa,MACzFvL,EAAKiM,MAAQ+Z,EAAY3lB,OAAO,KAAS,QAcjDglB,EAAUO,cAAgB,SAAUF,EAAUC,EAAQO,QACnC,IAAXA,IAAqBA,EAAS,IAKlC,IAAIC,EAAYT,EACXtlB,KAAI,SAAUJ,GAAQ,OAAOA,EAAKC,eAClCI,OAAO,KAAS,IAChBtF,QAAO,SAAU0F,GAAS,OAAQA,EAAMoQ,WACxCzQ,KAAI,QAAK,OAiBd,OAAOulB,EAAOvlB,KAZd,SAAiCgmB,GAE7B,IAAIC,GAAc,QAAO,GAAID,GAAUA,EAAOrZ,aAE1CuZ,GAAoB,QAAKD,EAAaH,GAC1CG,GAAc,QAAKA,EAAaH,GAChC,IAnBmBtsB,EAAMsF,EACrBc,EAkBAumB,GAAgB,SAnBD3sB,EAmBoB8rB,EAnBdxmB,EAmBwBknB,EAAOlnB,MAlBpDc,GAAO,QAAKpG,GAAM,QAAO,QAASsF,KAC/B,QAAO,GAAIc,GAAQA,EAAK+M,cAiBmC,IAAIoZ,GAElEK,GAAe,QAAOH,EAAaE,EAAeD,GACtD,OAAO,IAAI,IAASF,EAAOlnB,OAAO6lB,eAAeyB,OAQzDnB,EAAUllB,YAAc,SAAUulB,EAAUC,EAAQc,GAIhD,IAHA,IAE2BC,EAAOC,EAU9BhG,EAAMiG,EAAUlnB,EAASke,EAZzBrF,EAAMhF,KAAKD,IAAIoS,EAAS7kB,OAAQ8kB,EAAO9kB,QACvCgmB,EAAO,EAEJA,EAAOtO,GAAOmN,EAASmB,GAAM3nB,QAAUunB,IADnBC,EAC6ChB,EAASmB,GAD/CF,EACsDhB,EAAOkB,GAD7CH,EAAM9lB,OAAO+lB,EAAOtB,EAAUyB,oBAE5ED,IAUJD,GADAjG,EAAO+E,GACSnyB,MAAM,EAAGszB,GACzBnnB,EAAUihB,EAAKptB,MAAMszB,GAErB,IAAIE,EAAuBH,EAASxmB,KAVpC,SAAuB4mB,EAActmB,GACjC,IAAIxC,EAAS8oB,EAAa7oB,QAE1B,OADAD,EAAO6O,YAAc4Y,EAAOjlB,GAAKqM,YAC1B7O,KAUX,OAFA0f,EAAW+H,EAAOpyB,MAAMszB,GAEjB,CAAElG,KAAMA,EAAMC,GADhBmG,EAAqBlzB,OAAO+pB,GACJgJ,SAAUA,EAAUG,qBAAsBA,EAAsBrnB,QAASA,EAASke,SAAUA,IAiB7HyH,EAAU4B,SAAW,SAAUC,EAAOC,EAAOhC,GACzC,IAAIiC,GAAO,EAEX,OADa,QAAYF,EAAOC,GAClB9mB,QAAO,SAAU4mB,EAAUnK,GACrC,IAAIuK,EAAQvK,EAAG,GAAIwK,EAAQxK,EAAG,GAE9B,OADAsK,EAAOA,IAASC,EAAMzmB,OAAO0mB,EAAOnC,IACtB8B,EAAWA,EAASpzB,OAAOwzB,KAC1C,KAUPhC,EAAUzkB,OAAS,SAAUsmB,EAAOC,EAAOhC,GACvC,OAAO+B,EAAMrmB,SAAWsmB,EAAMtmB,QAAUwkB,EAAU4B,SAASC,EAAOC,EAAOhC,GAAUtkB,SAAWqmB,EAAMrmB,QAYxGwkB,EAAUU,QAAU,SAAUnsB,EAAM2tB,GAChC,IAAIvnB,GAAO,QAAKpG,EAAM2tB,GAClBC,EAAa5tB,EAAK+F,QAAQK,GAC9B,OAAuB,IAAhBwnB,OAAoB5hB,EAAYhM,EAAKrG,MAAM,EAAGi0B,EAAa,IAEtEnC,EAAUyB,iBAAmB,SAAU9mB,GACnC,OAAOA,EAAKd,MAAM4lB,WAAW,CAAEjU,SAAS,IAAS9V,QAAO,SAAU0F,GAAS,OAAQA,EAAM2e,YAG7FiG,EAAUtY,YAAc,SAAUnT,GAAQ,OAAOA,EAAKyG,QAAO,SAAUsL,EAAK3L,GAAQ,OAAO,QAAO2L,EAAK3L,EAAK+M,eAAiB,KACtHsY,EA7JmB,yGCPvB,IAAIoC,EAAkB,CACzB/lB,KAAM,CACFgmB,KAAM,OACNC,MAAO,SAEXpd,MAAO,CACHqd,KAAM,OACNC,OAAQ,sbCgBZnkB,EAA4B,WAC5B,SAASA,EAAWokB,EAAMne,EAAWpG,EAAMwkB,EAAQ3uB,GAG/C,GAFA3H,KAAKu2B,UAAW,EAChBv2B,KAAKyD,aAAU0Q,EACXkiB,aAAgBpkB,GAChB,QAAOjS,KAAMq2B,QAEZ,IAAI,QAAWne,GAAY,CAC5B,IAAI,QAAkBme,GAClB,MAAM,IAAI5jB,MAAM,gDACpB,KAAK,QAAWyF,GACZ,MAAM,IAAIzF,MAAM,2DACpBzS,KAAKuhB,MAAQ8U,EACbr2B,KAAKs2B,OAASA,EACdt2B,KAAKkY,UAAYA,EACjBlY,KAAK8R,KAAOA,GAAQ,GACpB9R,KAAK2H,KAAOA,EACZ3H,KAAKu2B,cAAoBpiB,IAATxM,EAChB3H,KAAKyD,QAAUzD,KAAKu2B,SAAW,YAAiBv2B,KAAK2H,WAAQwM,OAE5D,IAAI,QAASkiB,IAASA,EAAK9U,QAAU8U,EAAK3zB,eAAe,cAAgB2zB,EAAK3zB,eAAe,SAAU,CACxG,IAAI8zB,EAAUH,EACd,OAAO,IAAIpkB,EAAWukB,EAAQjV,MAAOiV,EAAQte,UAAWse,EAAQ1kB,KAAM0kB,EAAQF,OAAQE,EAAQ7uB,OA+DtG,OA5DAsK,EAAWpQ,UAAUgX,UAAY,SAAUpL,GACvC,IAAIgpB,EAAaz2B,KAAKs2B,QAAU,GAC5BI,EAAejpB,GAASA,EAAMkpB,eAAkB,GACpD,MAAO,CACH1mB,KAAMwmB,EAAWxmB,MAAQymB,EAAYzmB,MA5CvC,OA6CE6I,MAAO2d,EAAW3d,OAAS4d,EAAY5d,OA5CxC,SAsDP7G,EAAWpQ,UAAU8K,QAAU,SAAUiqB,EAAgBhnB,GACrD,IAAIO,EAAQnQ,KACR+G,EAAK,OAOLwH,EAAOqoB,EAAeC,SAAS72B,MAC/ByN,EAAQc,GAAQA,EAAKd,MACrBqpB,EAAc92B,KAAK6Y,UAAUpL,GAAOqL,MACpCie,GAAoB,QAAWD,GAAeA,EAAc,KAUhE,OAAQ92B,KAAKyD,QAAUsD,EAClBkJ,OACAlF,MApB2B,WAC5B,OAAOhE,EAAG0U,IAAImb,EAAeI,gBAAgB7mB,GAAOxB,KAAI,SAAUqJ,GAAc,OAAOA,EAAWtH,IAAIkmB,EAAgBhnB,UAoBrH7E,MAjBiB,SAAUksB,GAAgB,OAAO9mB,EAAM+H,UAAU/V,MAAM,KAAM80B,MAkB9ElsB,KAAKgsB,GACLhsB,MAboB,SAAUmsB,GAK/B,OAJA/mB,EAAMxI,KAAOuvB,EACb/mB,EAAMomB,UAAW,EACjBpmB,EAAM+H,UAAY,KAClB,6BAA8B/H,EAAOP,GAC9BO,EAAMxI,SAgBrBsK,EAAWpQ,UAAU6O,IAAM,SAAUkmB,EAAgBhnB,GACjD,OAAO5P,KAAKyD,SAAWzD,KAAK2M,QAAQiqB,EAAgBhnB,IAExDqC,EAAWpQ,UAAUiT,SAAW,WAC5B,MAAO,sBAAuB,QAAU9U,KAAKuhB,OAAS,gBAAkBvhB,KAAK8R,KAAKnD,IAAI,MAAa,MAEvGsD,EAAWpQ,UAAU6K,MAAQ,WACzB,OAAO,IAAIuF,EAAWjS,OAE1BiS,EAAWklB,SAAW,SAAU5V,EAAO5Z,GAAQ,OAAO,IAAIsK,EAAWsP,GAAO,WAAc,OAAO5Z,IAAS,KAAM,KAAMA,IAC/GsK,EArFoB,4qBCd3BmlB,EAAQ,SACRC,EAAY,CAACD,EAAMlB,MAAOkB,EAAMnB,MAChCqB,EAAc,CAACF,EAAMlB,OAarB9tB,EAAgC,WAChC,SAASA,EAAemvB,GACpBv3B,KAAKu3B,MAAQA,EA8IjB,OA3IAnvB,EAAevG,UAAU+W,UAAY,WACjC,OAAO5Y,KAAKu3B,MAAM3oB,QAAO,SAAUsL,EAAK3L,GAAQ,OAAO2L,EAAI9X,OAAOmM,EAAKwJ,YAAYpJ,KAAI,SAAU4O,GAAK,OAAOA,EAAEgE,YAAe,IAAI3S,OAAO,KAAO,KAQpJxG,EAAevG,UAAUiM,cAAgB,SAAUyT,GAC/C,IAAIiU,EAAWx1B,KAAKu3B,MACf5oB,KAAI,SAAUJ,GAAQ,OAAOA,EAAKwJ,eAClCnJ,OAAO,KAAS,IAChBtF,QAAO,SAAUiU,GAAK,OAAOA,EAAEgE,QAAUA,KAC9C,OAAO,QAAKiU,IAGhBptB,EAAevG,UAAUgX,UAAY,SAAUb,GAC3C,IAAIzJ,EAAOvO,KAAK62B,SAAS7e,GACzB,OAAOA,EAAWa,UAAUtK,EAAKd,QAyBrCrF,EAAevG,UAAUkS,WAAa,SAAUtG,GAC5C,OAAO,IAAIrF,EAAe,YAAkBpI,KAAKu3B,OAAO,SAAUhpB,GAAQ,OAAOA,EAAKd,QAAUA,OAiBpGrF,EAAevG,UAAU21B,eAAiB,SAAUC,EAAgBhqB,GAChE,IAAIc,GAAO,QAAKvO,KAAKu3B,OAAO,QAAO,QAAS9pB,IACxC+F,EAAOikB,EAAe9oB,KAAI,SAAU4O,GAAK,OAAOA,EAAEgE,SACtDhT,EAAKwJ,YAAcxJ,EAAKwJ,YAAYzO,QAAO,SAAUiU,GAAK,OAAkC,IAA3B/J,EAAKtF,QAAQqP,EAAEgE,UAAkBnf,OAAOq1B,IAS7GrvB,EAAevG,UAAU61B,YAAc,SAAUznB,EAAML,GACnD,IAAIO,EAAQnQ,UACC,IAATiQ,IAAmBA,EAAO,QAE9B,IAGI0nB,IAHa,QAAQN,EAAWpnB,GAAQA,EAAO,UAGjB,eAA6BqnB,EAAcD,EAE7E,sBAAuBr3B,KAAKu3B,MAAOtnB,EAAML,GACzC,IAAIgoB,EAAgB,SAAUC,EAAcC,GAAe,OAAO,SAAU9f,GACxE,OAAO,QAAQ6f,EAAc1nB,EAAM0I,UAAUb,GAAY8f,MAIzDvc,EAAWvb,KAAKu3B,MAAM3oB,QAAO,SAAUsL,EAAK3L,GAC5C,IAAIwpB,EAAkBxpB,EAAKwJ,YAAYzO,OAAOsuB,EAAcD,EAAc,SACtEK,EAASD,EAAgBzuB,OAAOsuB,EAAc,CAAC,UAAW,UAC1DK,EAAOF,EAAgBzuB,QAAO,QAAIsuB,EAAc,CAAC,UAAW,WAE5D7jB,EAAa5D,EAAM4D,WAAWxF,EAAKd,OACnCyqB,EAAY,SAAU3a,GACtB,OAAOA,EACF7M,IAAIqD,EAAYnE,GAEhB7E,MAAK,SAAUvG,GAAS,MAAO,CAAG+c,MAAOhE,EAAEgE,MAAO/c,MAAOA,OAGlE,OADAwzB,EAAOj3B,QAAQm3B,GACRhe,EAAI9X,OAAO61B,EAAKtpB,IAAIupB,MAC5B,IAEH,OAAO,WAAgB3c,IAE3BnT,EAAevG,UAAUs2B,SAAW,WAChC,OAAOn4B,KAAKo4B,YAAcp4B,KAAKo4B,UAAY,IAAIC,EAAer4B,QAElEoI,EAAevG,UAAUg1B,SAAW,SAAU7e,GAC1C,OAAO,QAAKhY,KAAKu3B,OAAO,SAAUhpB,GAAQ,OAAO,QAAQA,EAAKwJ,YAAaC,OAO/E5P,EAAevG,UAAUm1B,gBAAkB,SAAUhf,GACjD,IAAI7H,EAAQnQ,KACRuO,EAAOvO,KAAK62B,SAAS7e,GAIrBsgB,GADU,YAAkBt4B,KAAKu3B,OAAO,SAAUjoB,GAAK,OAAOA,IAAMf,MAAYvO,KAAKu3B,OAEpF3oB,QAAO,SAAUsL,EAAKqe,GAAS,OAAOre,EAAI9X,OAAOm2B,EAAMxgB,eAAiB,IACxEzO,QAAO,SAAU0J,GAAO,OAAOA,IAAQgF,KAW5C,OAAOA,EAAWlG,KAAKnD,KAVH,SAAU4S,GAC1B,IAAIiU,EAAW8C,EAAqBhvB,QAAO,SAAUiU,GAAK,OAAOA,EAAEgE,QAAUA,KAC7E,GAAIiU,EAASpmB,OACT,OAAO,QAAKomB,GAChB,IAAIgD,EAAeroB,EAAMgoB,WAAWM,UAAUlX,GAC9C,IAAI,QAAYiX,GACZ,MAAM,IAAI/lB,MAAM,+CAAgD,QAAU8O,IAE9E,OAAO,IAAI,IAAWA,GAAO,WAAc,OAAOiX,IAAiB,GAAIA,OAIxEpwB,EAhJwB,GAoJ/BiwB,EAAgC,WAChC,SAASA,EAAexnB,GACpB7Q,KAAK6Q,QAAUA,EACf7Q,KAAK04B,OAAS14B,KAAK0Q,IAlKQ,oBAkKsB,cAwBrD,OAtBA2nB,EAAex2B,UAAU6O,IAAM,SAAU6Q,GACrC,IAAIvJ,EAAahY,KAAK6Q,QAAQ/C,cAAcyT,GAC5C,GAAIvJ,EAAY,CACZ,GAAiD,WAA7ChY,KAAK6Q,QAAQgI,UAAUb,GAAYc,MACnC,OAAOd,EAAWtH,IAAI1Q,KAAK6Q,SAE/B,IAAKmH,EAAWue,SACZ,MAAM,IAAI9jB,MAAM,yCAA0C,QAAUuF,EAAWuJ,QAEnF,OAAOvJ,EAAWrQ,KAEtB,OAAO3H,KAAKy4B,UAAUlX,IAE1B8W,EAAex2B,UAAU82B,SAAW,SAAUpX,GAC1C,IAAIvJ,EAAahY,KAAK6Q,QAAQ/C,cAAcyT,GAC5C,OAAIvJ,EACOA,EAAWtH,IAAI1Q,KAAK6Q,SACxB,YAAiB7Q,KAAK04B,OAAOhoB,IAAI6Q,KAE5C8W,EAAex2B,UAAU42B,UAAY,SAAUlX,GAC3C,OAAOvhB,KAAK04B,QAAU14B,KAAK04B,OAAOhoB,IAAI6Q,IAEnC8W,EA3BwB,q2BC/J/BO,EAAkB,EAMlBC,GAAsB,QAAS,mBAJnB,CAAC,MAAO,OAAQ,SAAU,OAAQ,aAM9CC,GAAqB,QAAS,iBAJlB,CAAC,OAAQ,WAAY,OAAQ,WAAY,YAAa,eAUlEpiB,EAA0B,WAQ1B,SAASA,EAASU,EAAiBC,QACP,IAApBD,IAA8BA,EAAkByhB,QAC7B,IAAnBxhB,IAA6BA,EAAiByhB,GAClD94B,KAAKoX,gBAAkBA,EACvBpX,KAAKqX,eAAiBA,EACLrX,KAAKmb,IAAMyd,IACX54B,KAAK+4B,WAAY,EACjB/4B,KAAKg5B,aAAe,GAErCh5B,KAAKqI,MAAQ,KAEbrI,KAAK+W,YAAc,IAAI,IAAY/W,MAEnCA,KAAKsY,QAAU,IAAI,IAEnBtY,KAAK8sB,kBAAoB,IAAI,IAAkB9sB,MAK/CA,KAAK4U,kBAAoB,IAAI,IAAkB5U,MAK/CA,KAAKmc,UAAY,IAAI,IAAUnc,MAE/BA,KAAKiX,WAAa,IAAI,IAAWjX,MAEjCA,KAAK4W,cAAgB,IAAI,IAAc5W,MAEvCA,KAAK6W,aAAe,IAAI,IAAa7W,MAErCA,KAAKi5B,SAAW,GAChBj5B,KAAK+W,YAAY/M,WAAWC,iBAAiBjK,KAAK4W,cAAcgH,QAChE5d,KAAKsY,QAAQwa,SAAW9yB,KAAK4W,cAAcgH,OAC3C5d,KAAKsY,QAAQwN,QAAU9lB,KAAKsY,QAAQwa,SAASplB,KAC7C1N,KAAKk5B,WAAWl5B,KAAKsY,SACrBtY,KAAKk5B,WAAWl5B,KAAK6W,cACrB7W,KAAKk5B,WAAWl5B,KAAK4W,eACrB5W,KAAKk5B,WAAWl5B,KAAK8sB,mBACrB9sB,KAAKk5B,WAAWl5B,KAAKiX,YACrBjX,KAAKk5B,WAAW9hB,GAChBpX,KAAKk5B,WAAW7hB,GAgGpB,OA7FAX,EAAS7U,UAAUq3B,WAAa,SAAUA,GACtCl5B,KAAKg5B,aAAav4B,KAAKy4B,IAa3BxiB,EAAS7U,UAAUqT,QAAU,SAAUgkB,GACnC,IAAI/oB,EAAQnQ,KACRk5B,IAAc,QAAWA,EAAWhkB,SACpCgkB,EAAWhkB,QAAQlV,OAGvBA,KAAK+4B,WAAY,EACjB/4B,KAAKg5B,aAAal3B,QAAQf,SAAQ,SAAUo4B,GACxC,IACyB,mBAAdA,EAAEjkB,SAA0BikB,EAAEjkB,QAAQ/E,IAC7C,QAAWA,EAAM6oB,aAAcG,GAEnC,MAAOC,UAwDf1iB,EAAS7U,UAAUw3B,OAAS,SAAUA,EAAQl5B,QAC1B,IAAZA,IAAsBA,EAAU,IACpC,IAAIm5B,EAAiB,IAAID,EAAOr5B,KAAMG,GACtC,IAAKm5B,EAAe9zB,KAChB,MAAM,IAAIiN,MAAM,+CAAiD6mB,GAErE,OADAt5B,KAAKg5B,aAAav4B,KAAK64B,GACft5B,KAAKi5B,SAASK,EAAe9zB,MAAQ8zB,GAEjD5iB,EAAS7U,UAAU03B,UAAY,SAAUC,GACrC,OAAOA,EAAax5B,KAAKi5B,SAASO,IAAc,QAAOx5B,KAAKi5B,WAEzDviB,EAnJkB,ijBCf7B,SAAS+iB,EAAYhsB,GACjB,OAAOA,EAAMjI,KAEjB,SAASk0B,EAAYjsB,GAEjB,OADAA,EAAMC,KAAKsG,QAAU,WAAc,OAAOvG,GACnCA,EAAMC,KAEjB,SAASisB,EAAYlsB,GAIjB,OAHIA,EAAM2M,QAAU3M,EAAM2M,OAAOzS,OAC7B8F,EAAM9F,KAAO8F,EAAMC,KAAK/F,MAAO,QAAQ8F,EAAM2M,OAAOzS,KAAM8F,EAAM9F,OAE7D8F,EAAM9F,KAEjB,IAAIiyB,EAAgB,SAAUC,EAA4Bjc,GACtD,OAAO,SAAoBhK,GACvB,IAAIkmB,EAAWlmB,EAAYlG,KAG3B,GAAIosB,GAAYA,EAASroB,KAAOqoB,EAASt0B,MAAQs0B,EAASt0B,KAAKwW,MAAM,WAAY,CAC7E,IAAI+d,EAAc,IAClB,QAAKD,EAAUC,GACfA,EAAYtoB,KAAO,kBACnBqoB,EAAWC,EAEf,IAAI3f,EAASxG,EAAYwG,OACrB4f,EA/BG,SAAUvoB,GACrB,KAAK,QAASA,GACV,OAAO,EACX,IAAImM,EAAyB,MAAlBnM,EAAIhM,OAAO,GACtB,MAAO,CAAEzB,IAAK4Z,EAAOnM,EAAIwoB,UAAU,GAAKxoB,EAAKmM,KAAMA,GA2BlCsc,CAASJ,EAASroB,KAC3BA,EAAOuoB,EAAwBH,EAA2BxyB,QAAQ2yB,EAAOh2B,IAAK,CAAEyJ,MAAOqsB,IAAvEA,EAASroB,IAC7B,IAAKA,EACD,OAAO,KACX,IAAKooB,EAA2BM,UAAU1oB,GACtC,MAAM,IAAIgB,MAAM,gBAAkBhB,EAAM,eAAiBmC,EAAc,KAC3E,OAAOomB,GAAUA,EAAOpc,KAAOnM,GAAQ2I,GAAUA,EAAOggB,WAAcxc,KAAQnM,IAAI4oB,OAAO5oB,KAG7F6oB,EAAsB,SAAUC,GAChC,OAAO,SAA0B9sB,GAC7B,OAAQ8sB,EAAO9sB,IAAUA,EAAMgE,IAAMhE,EAAQA,EAAM2M,OAAS3M,EAAM2M,OAAOggB,UAAY,OAc7F,SAASI,EAAY/sB,GACjB,OAAOA,EAAM2M,OAAS3M,EAAM2M,OAAOjS,KAAK/F,OAAOqL,GAAkB,CAACA,GAEtE,SAASgtB,EAAgBhtB,GACrB,IAAI6L,EAAW7L,EAAM2M,QAAS,QAAO,GAAI3M,EAAM2M,OAAOd,UAAY,GAElE,OADAA,EAAS7L,EAAMjI,OAAQ,EAChB8T,EA2CJ,SAASohB,EAAmBjtB,GAE/B,IAA+BktB,EAAY3E,EA2BvC4E,EAAW,SAAUC,GAAK,OAAOA,EAAEC,SAAWD,EAAEtZ,OAEhDwZ,GAAqB,QAAQ,CAC7B,EAAC,QAAK,aAAc,SAAUF,GAAK,OAAO,IAAI,IAAWD,EAASC,GAAIA,EAAE3iB,UAAW2iB,EAAE/oB,KAAM+oB,EAAEvE,UAC7F,EAAC,QAAK,cAAe,SAAUuE,GAAK,OAAO,IAAI,IAAWD,EAASC,GAAIA,EAAEG,WAAYH,EAAE/oB,MAAQ+oB,EAAEI,aAAcJ,EAAEvE,UACjH,EAAC,QAAK,YAAa,SAAUuE,GAAK,OAAO,IAAI,IAAWD,EAASC,IAAI,WAAc,OAAO,IAAIA,EAAEK,WAAe,GAAIL,EAAEvE,UACrH,EAAC,QAAK,YAAa,SAAUuE,GAAK,OAAO,IAAI,IAAWD,EAASC,IAAI,WAAc,OAAOA,EAAEM,WAAa,GAAIN,EAAEvE,OAAQuE,EAAEM,YACzH,EAAC,QAAK,eAAgB,SAAUN,GAAK,OAAO,IAAI,IAAWD,EAASC,GAAI,KAAU,CAACA,EAAEO,aAAcP,EAAEvE,YAGrG+E,GAAmB,QAAQ,CAC3B,EAAC,SAAK,QAAK,OAAQ,MAAW,SAAU5nB,GAAS,OAAO,IAAI,IAAWA,EAAM8N,MAAO,KAAU,CAAC9N,EAAMzP,KAAMyP,EAAM6iB,UACjH,EAAC,SAAK,QAAK,OAAQ,MAAU,SAAU7iB,GAAS,OAAO,IAAI,IAAWA,EAAM8N,OAAO,QAAK9N,EAAMzP,KAAMyP,EAAMzP,IAAIlC,MAAM,GAAI,GAAI2R,EAAM6iB,UAClI,EAAC,SAAK,QAAK,OAAQ,MAAa,SAAU7iB,GAAS,OAAO,IAAI,IAAWA,EAAM8N,MAAO9N,EAAMzP,KA/BvErD,EA+BqF8S,EAAMzP,IA9B5GuM,EAAY,cAIT5P,EAAY,SAAM4P,GAAaA,EAAU0H,SAAStX,EAAI4P,EAAUuH,WAAc,YA0BiCrE,EAAM6iB,QA/BjH,IAAU31B,EACjB4P,MAiCJ+qB,GAAkB,QAAQ,CAC1B,EAAC,IAAApiB,IAAG,KAAa,SAAUqE,GAAK,OAAOA,IACvC,CA5BmB,SAAUtD,GAAO,SAAUA,EAAIsH,QAAStH,EAAI/B,YA4B5C6iB,GACnB,CA3BoB,SAAU9gB,GAC9B,SAAWA,EAAI6gB,UAAW7gB,EAAIsH,SAAWtH,EAAIkhB,UAAYlhB,EAAI+gB,YAAc/gB,EAAImhB,aAAenhB,EAAIihB,YA0B9EH,GACpB,CAxBiB,SAAU9gB,GAC3B,SAAUA,GAAOA,EAAIjW,OAAQ,QAASiW,EAAIjW,OAAQ,QAAQiW,EAAIjW,OAAQ,QAAWiW,EAAIjW,QAuBpEq3B,GACjB,EAAC,SAAI,GAAO,SAAUphB,GAAO,MAAM,IAAIxH,MAAM,2BAA4B,QAAUwH,QAInFshB,EAAO9tB,EAAMd,QAEjB,QADY,QAAQ4uB,GAAQA,GArDGZ,EAqDmBY,EArDPvF,EAqDavoB,EAAMkpB,eAAiB,GApDpEpjB,OAAOC,KAAKmnB,GAAc,IAAIhsB,KAAI,SAAU4S,GAAS,MAAO,CAC/DA,MAAOA,EACPvd,IAAK22B,EAAWpZ,GAChBzP,UAAMqC,EACNmiB,OAAQN,EAAgBzU,SAiDnB5S,IAAI2sB,GAcrB,IAAIE,EAA8B,WAC9B,SAASA,EAAaC,EAAS7mB,GAC3B5U,KAAKy7B,QAAUA,EACf,IArIyBC,EAqIrBhuB,EAAO1N,KACP4d,EAAO,WAAc,OAAO6d,EAAQ3a,KAAK,KACzCyZ,EAAS,SAAU9sB,GAAS,MAAsB,KAAfA,EAAMjI,MAM7CxF,KAAK27B,SAAW,CACZn2B,KAAM,CAACi0B,GACP/rB,KAAM,CAACgsB,GACPtf,OAAQ,CARZ,SAAuB3M,GACnB,OAAI8sB,EAAO9sB,GACA,KACJguB,EAAQ3a,KAAKpT,EAAKkuB,WAAWnuB,KAAWmQ,MAM/CjW,KAAM,CAACgyB,GAEPloB,IAAK,CAACmoB,EAAchlB,EAAmBgJ,IAEvCwc,UAAW,CAACE,EAAoBC,IAChCnsB,OAAQ,EAtJastB,EAsJK9mB,EAAkB8mB,aArJ7C,SAAuBjuB,GAC1B,IACIouB,EAAapuB,EAAMgE,KAAOhE,EAAMgE,IAAI4hB,WAAW,CAAEjU,SAAS,KAAa,GACvE0c,GAAe,SAAO,SAAO,QAAKruB,EAAMW,QAAU,GAAIytB,EAAUltB,KAAI,QAAK,SAFvD,SAAUpD,EAAQF,GAAM,OAAOqwB,EAAa9qB,WAAWvF,EAAI,KAAMoC,EAAMC,UAG7F,OAAOmuB,EACFz5B,OAAO05B,GACPntB,KAAI,SAAUksB,GAAK,MAAO,CAACA,EAAExvB,GAAIwvB,MACjCjsB,OAAO,KAAY,OAiJpB4L,MAAO,GAEPrS,KAAM,CAACqyB,GAEPlhB,SAAU,CAACmhB,GACX1iB,YAAa,CAAC2iB,IAgEtB,OA7DAc,EAAa35B,UAAUk6B,QAAU,SAAUv2B,EAAM7E,GAC7C,IAAIg7B,EAAW37B,KAAK27B,SAChBpc,EAAQoc,EAASn2B,IAAS,GAE9B,OAAI,QAASA,MAAU,QAAU7E,GACtB4e,EAAMnQ,OAAS,EAAImQ,EAAQA,EAAM,IACvC,QAAS/Z,KAAU,QAAW7E,IAEnCg7B,EAASn2B,GAAQ+Z,EACjBoc,EAASn2B,GAAM/E,KAAKE,GACb,WAAc,OAAOg7B,EAASn2B,GAAMga,OAAOmc,EAASn2B,GAAM0I,QAAQvN,EAAI,KAAO,YAJpF,GAaJ66B,EAAa35B,UAAUm6B,MAAQ,SAAUvuB,GACrC,IAAeguB,EAANz7B,KAAmBy7B,QAASE,EAA5B37B,KAA0C27B,SAC/CvhB,EAASpa,KAAK47B,WAAWnuB,GAC7B,GAAI2M,IAAWqhB,EAAQ3a,KAAK1G,OAAQjG,GAAW,GAC3C,OAAO,KAEX,IAAK,IAAItO,KAAO81B,EACZ,GAAKA,EAASj5B,eAAemD,GAA7B,CAEA,IAAIo2B,EAAQN,EAAS91B,GAAK+I,QAAO,SAAUstB,EAAUpS,GAAQ,OAAO,SAAUmD,GAAU,OAAOnD,EAAKmD,EAAQiP,MAAiB,MAC7HzuB,EAAM5H,GAAOo2B,EAAMxuB,GAEvB,OAAOA,GAEX+tB,EAAa35B,UAAU+5B,WAAa,SAAUnuB,GAE1C,IAAIjI,EAAOiI,EAAMjI,MAAQ,GAErB22B,EAAW32B,EAAKsd,MAAM,KAM1B,GAFoB,OAFFqZ,EAASC,OAGvBD,EAASC,MACTD,EAAS/sB,OAAQ,CACjB,GAAI3B,EAAM2M,OACN,MAAM,IAAI3H,MAAM,mFAAqFjN,EAAO,KAGhH,OAAO22B,EAASlpB,KAAK,KAEzB,OAAKxF,EAAM2M,QAEJ,QAAS3M,EAAM2M,QAAU3M,EAAM2M,OAAS3M,EAAM2M,OAAO5U,KADjD,IAGfg2B,EAAa35B,UAAU2D,KAAO,SAAUiI,GACpC,IAAIjI,EAAOiI,EAAMjI,KACjB,IAA2B,IAAvBA,EAAK0I,QAAQ,OAAgBT,EAAM2M,OACnC,OAAO5U,EACX,IAAIo2B,GAAa,QAASnuB,EAAM2M,QAAU3M,EAAM2M,OAAS3M,EAAM2M,OAAO5U,KACtE,OAAOo2B,EAAaA,EAAa,IAAMp2B,EAAOA,GAE3Cg2B,EA5FsB,iTClL7Ba,EAA8B,WAC9B,SAASA,EAAaC,GAClBt8B,KAAKs8B,QAAUA,EAmDnB,OAjDAD,EAAax6B,UAAU06B,WAAa,SAAUC,GAE1C,OAAkC,KADlCA,EAAYA,GAAa,IACRtuB,QAAQ,MAAyC,IAA3BsuB,EAAUtuB,QAAQ,MAE7DmuB,EAAax6B,UAAUif,KAAO,SAAU2b,EAAaC,EAAMC,GAEvD,QADkB,IAAdA,IAAwBA,GAAY,GACnCF,GAA+B,KAAhBA,EAApB,CAEA,IAAIG,GAAQ,QAASH,GACjBj3B,EAAOo3B,EAAQH,EAAcA,EAAYj3B,KACzCxF,KAAKu8B,WAAW/2B,KAChBA,EAAOxF,KAAK03B,YAAYlyB,EAAMk3B,IAClC,IAAIjvB,EAAQzN,KAAKs8B,QAAQ92B,GACzB,GAAIiI,IAAUmvB,KAAWA,GAAUnvB,IAAUgvB,GAAehvB,EAAMC,OAAS+uB,IACvE,OAAOhvB,EAEN,GAAImvB,GAASD,EAAW,CACzB,IACIzZ,GADU,QAAOljB,KAAKs8B,SACJhzB,QAAO,SAAU2jB,GAAU,OAAOA,EAAO4P,mBAAmBC,UAAY7P,EAAO4P,mBAAmBC,SAAS5Z,QAAQ1d,MAIzI,OAHI0d,EAAQ9T,OAAS,GACjB,UAAkB,iDAAmD5J,EAAO,gBAAiB0d,EAAQvU,KAAI,SAAUqN,GAAS,OAAOA,EAAMxW,SAEtI0d,EAAQ,MAIvBmZ,EAAax6B,UAAU61B,YAAc,SAAUlyB,EAAMk3B,GACjD,IAAKA,EACD,MAAM,IAAIjqB,MAAM,sCAAwCjN,EAAO,KAKnE,IAJA,IAAIu3B,EAAY/8B,KAAK8gB,KAAK4b,GACtBM,EAAYx3B,EAAKsd,MAAM,KACvBma,EAAaD,EAAU5tB,OACvBiO,EAAI,EAAGyI,EAAUiX,EACd1f,EAAI4f,EAAY5f,IACnB,GAAqB,KAAjB2f,EAAU3f,IAAmB,IAANA,EAA3B,CAIA,GAAqB,MAAjB2f,EAAU3f,GAMd,MALI,IAAKyI,EAAQ1L,OACT,MAAM,IAAI3H,MAAM,SAAWjN,EAAO,0BAA4Bu3B,EAAUv3B,KAAO,KACnFsgB,EAAUA,EAAQ1L,YANlB0L,EAAUiX,EAWlB,IAAIG,EAAUF,EAAUl7B,MAAMub,GAAGpK,KAAK,KACtC,OAAO6S,EAAQtgB,MAAQsgB,EAAQtgB,MAAQ03B,EAAU,IAAM,IAAMA,GAE1Db,EArDsB,oWCW7Bc,EAA6B,WAE7B,SAASA,EAAY5xB,GACjB,OAAO4xB,EAAY37B,OAAO+J,GAAU,IA4FxC,OAlFA4xB,EAAY37B,OAAS,SAAU47B,GAC3BA,EAAYD,EAAYE,aAAaD,GAAa,IAAIA,EAAcA,EACpE,IAAI3vB,GAAQ,SAAQ,QAAQ2vB,EAAWD,EAAYt7B,YAMnD,OALAu7B,EAAUppB,QAAU,WAAc,OAAOvG,GACzCA,EAAMC,KAAO0vB,EACb3vB,EAAMovB,mBAAqB,CACvBC,SAAU,eAAgBrvB,EAAMjI,OAE7BiI,GAaX0vB,EAAYt7B,UAAUqX,GAAK,SAAUokB,GACjC,OAAOt9B,OAASs9B,GAAOt9B,KAAK0N,OAAS4vB,GAAOt9B,KAAKsL,QAAUgyB,GAM/DH,EAAYt7B,UAAUyJ,IAAM,WACxB,KAAKtL,KAAKoa,QAAYpa,KAAKoa,kBAAkBpa,KAAKokB,aAC9C,OAAOpkB,KAAKwF,KAChB,IAAIA,EAAOxF,KAAKoa,OAAO9O,MACvB,OAAO9F,EAAOA,EAAO,IAAMxF,KAAKwF,KAAOxF,KAAKwF,MAOhD23B,EAAYt7B,UAAU+b,KAAO,WACzB,OAAQ5d,KAAKoa,QAAUpa,KAAKoa,OAAOwD,QAAW5d,MAWlDm9B,EAAYt7B,UAAUwxB,WAAa,SAAUzyB,GAGzC,QAFAA,GAAO,QAASA,EAAM,CAAEwe,SAAS,EAAMme,aAAc,QAC/Bne,SAAWpf,KAAKoa,QAAUpa,KAAKoa,OAAOiZ,cAAiB,IAExEjxB,QAAO,QAAOpC,KAAKoO,SACnB9E,QAAO,SAAU0F,GAAS,OAAQpO,EAAK28B,cAAgB38B,EAAK28B,aAAa76B,eAAesM,EAAM3D,QASvG8xB,EAAYt7B,UAAU4xB,UAAY,SAAUpoB,EAAIzK,GAE5C,YADa,IAATA,IAAmBA,EAAO,IACrBZ,KAAKyR,KAAOzR,KAAKyR,IAAIgiB,UAAUpoB,EAAIzK,KACxC,SAAK,QAAOZ,KAAKoO,SAAS,QAAO,KAAM/C,KACtCzK,EAAKwe,SAAWpf,KAAKoa,QAAUpa,KAAKoa,OAAOqZ,UAAUpoB,IAE9D8xB,EAAYt7B,UAAUiT,SAAW,WAC7B,OAAO9U,KAAKsL,OAGhB6xB,EAAYE,aAAe,SAAUD,GACjC,OAAO,QAAWA,KAA+C,IAAjCA,EAA2B,iBAG/DD,EAAYK,mBAAqB,SAAUvjB,GAAO,OAAO,QAAWA,EAAa,UAEjFkjB,EAAYM,QAAU,SAAUxjB,GAAO,OAAO,QAASA,EAAwB,qBACxEkjB,EA/FqB,kPCZ5BO,EAAmC,WACnC,SAASA,EAAkBhpB,EAAQsY,EAAQ+O,EAAS4B,GAChD39B,KAAK0U,OAASA,EACd1U,KAAKgtB,OAASA,EACdhtB,KAAK+7B,QAAUA,EACf/7B,KAAK29B,UAAYA,EACjB39B,KAAK49B,MAAQ,GA4EjB,OA1EAF,EAAkB77B,UAAUqT,QAAU,WAClClV,KAAK49B,MAAQ,IAEjBF,EAAkB77B,UAAU6X,SAAW,SAAU0jB,GAC7C,IAAIQ,EAAQ59B,KAAK49B,MACbnwB,EAAQ,WAAmB2vB,GAC3B53B,EAAOiI,EAAMjI,KACjB,KAAK,QAASA,GACV,MAAM,IAAIiN,MAAM,gCACpB,GAAIzS,KAAKgtB,OAAOtqB,eAAe8C,KAAS,QAAQo4B,EAAMjvB,KAAI,QAAK,SAAUnJ,GACrE,MAAM,IAAIiN,MAAM,UAAYjN,EAAO,wBAGvC,OAFAo4B,EAAMn9B,KAAKgN,GACXzN,KAAK69B,QACEpwB,GAEXiwB,EAAkB77B,UAAUg8B,MAAQ,WAchC,IAbA,IAAI1tB,EAAQnQ,KACRqrB,EAAKrrB,KAAM49B,EAAQvS,EAAGuS,MAAO5Q,EAAS3B,EAAG2B,OAAQ+O,EAAU1Q,EAAG0Q,QAC9D+B,EAAa,GACjBC,EAAU,GACVC,EAAsB,GAClBC,EAAW,SAAUz4B,GAAQ,OAAO2K,EAAM6c,OAAOtqB,eAAe8C,IAAS2K,EAAM6c,OAAOxnB,IACtF04B,EAAkB,WACdJ,EAAW1uB,QACXe,EAAMwtB,UAAU58B,SAAQ,SAAUo9B,GAC9B,OAAOA,EAAS,aAAcL,EAAWnvB,KAAI,SAAUyO,GAAK,OAAOA,EAAE1P,aAI1EkwB,EAAMxuB,OAAS,GAAG,CACrB,IAAI3B,EAAQmwB,EAAM37B,QACdm8B,EAAS3wB,EAAMjI,KACfc,EAASy1B,EAAQC,MAAMvuB,GACvB4wB,EAAYN,EAAQ7vB,QAAQT,GAChC,GAAInH,EAAJ,CACI,IAAIg4B,EAAgBL,EAASG,GAC7B,GAAIE,GAAiBA,EAAc94B,OAAS44B,EACxC,MAAM,IAAI3rB,MAAM,UAAY2rB,EAAS,wBAEzC,IAAIG,EAAsBN,EAASG,EAAS,OACxCG,GAEAv+B,KAAK0U,OAAOkC,cAAc4nB,WAAWD,GAEzCvR,EAAOoR,GAAU3wB,EACjBzN,KAAKy+B,YAAYhxB,GACb4wB,GAAa,GACbN,EAAQve,OAAO6e,EAAW,GAC9BP,EAAWr9B,KAAKgN,OAdpB,CAiBA,IAAIixB,EAAOV,EAAoBI,GAE/B,GADAJ,EAAoBI,GAAUR,EAAMxuB,OAChCivB,GAAa,GAAKK,IAASd,EAAMxuB,OAKjC,OAFAwuB,EAAMn9B,KAAKgN,GACXywB,IACOlR,EAEFqR,EAAY,GACjBN,EAAQt9B,KAAKgN,GAEjBmwB,EAAMn9B,KAAKgN,IAGf,OADAywB,IACOlR,GAEX0Q,EAAkB77B,UAAU48B,YAAc,SAAUhxB,GAChD,IAAIA,EAAMkxB,UAAalxB,EAAMgE,IAA7B,CAEA,IAAImtB,EAAW5+B,KAAK0U,OAAOuC,WAAW0F,MACtCiiB,EAASriB,KAAKqiB,EAASC,eAAer9B,OAAOiM,MAE1CiwB,EAlF2B,sbCQlCoB,EAA+B,WAE/B,SAASA,EAAcpqB,GACnB1U,KAAK0U,OAASA,EACd1U,KAAKgtB,OAAS,GAEdhtB,KAAK29B,UAAY,GACjB39B,KAAKy7B,QAAU,IAAI,IAAaz7B,KAAKgtB,QACrChtB,KAAK+7B,QAAU,IAAI,IAAa/7B,KAAKy7B,QAAS/mB,EAAOE,mBACrD5U,KAAK++B,WAAa,IAAI,IAAkBrqB,EAAQ1U,KAAKgtB,OAAQhtB,KAAK+7B,QAAS/7B,KAAK29B,WAChF39B,KAAKg/B,gBAmJT,OAhJAF,EAAcj9B,UAAUm9B,cAAgB,YAUvBh/B,KAAKi/B,MAAQj/B,KAAK++B,WAAWrlB,SATvB,CACflU,KAAM,GACNiM,IAAK,IACL+I,MAAO,KACPpM,OAAQ,CACJ,IAAK,CAAE5J,MAAO,KAAM0K,KAAM,OAAQye,SAAS,IAE/CgR,UAAU,KAGRvE,UAAY,MAGtB0E,EAAcj9B,UAAUqT,QAAU,WAC9B,IAAI/E,EAAQnQ,KACZA,KAAK++B,WAAW7pB,UAChBlV,KAAK29B,UAAY,GACjB39B,KAAK0Q,MAAM3P,SAAQ,SAAU0M,GAAS,OAAO0C,EAAMO,IAAIjD,IAAU0C,EAAMquB,WAAW/wB,OAgCtFqxB,EAAcj9B,UAAUq9B,gBAAkB,SAAUf,GAEhD,OADAn+B,KAAK29B,UAAUl9B,KAAK09B,GACb,YACH,QAAWn+B,KAAK29B,UAAhB,CAA2BQ,IAC7B76B,KAAKtD,OAWX8+B,EAAcj9B,UAAU+b,KAAO,WAC3B,OAAO5d,KAAKi/B,OAchBH,EAAcj9B,UAAU6X,SAAW,SAAUylB,GACzC,OAAOn/B,KAAK++B,WAAWrlB,SAASylB,IAGpCL,EAAcj9B,UAAUu9B,gBAAkB,SAAU3xB,GAChD,IAAI0C,EAAQnQ,KACRyb,EAAMzb,KAAK0Q,MAAM/B,KAAI,SAAUyO,GAAK,OAAOA,EAAEpJ,aAC7CqrB,EAAc,SAAUrS,GACxB,IAAIsS,EAAY7jB,EAAInS,QAAO,SAAU8T,GAAK,OAAqC,IAA9B4P,EAAO9e,QAAQkP,EAAEhD,WAClE,OAA4B,IAArBklB,EAAUlwB,OAAekwB,EAAYA,EAAUl9B,OAAOi9B,EAAYC,KAEzE12B,EAAWy2B,EAAY,CAAC5xB,IACxB8xB,EAAe,CAAC9xB,GAAOrL,OAAOwG,GAAUoX,UAW5C,OAVAuf,EAAax+B,SAAQ,SAAUksB,GAC3B,IAAI2R,EAAWzuB,EAAMuE,OAAOuC,WAAW0F,MAEvCiiB,EACKjiB,QACArT,QAAO,QAAO,QAAS2jB,IACvBlsB,SAAQ,SAAUwb,GAAQ,OAAOqiB,EAASY,WAAWjjB,aAEnDpM,EAAM6c,OAAOC,EAAOznB,SAExB+5B,GAWXT,EAAcj9B,UAAU28B,WAAa,SAAU/B,GAC3C,IAAIxP,EAASjtB,KAAK0Q,IAAI+rB,GACtB,IAAKxP,EACD,MAAM,IAAIxa,MAAM,sCAAwCgqB,GAC5D,IAAIgD,EAAqBz/B,KAAKo/B,gBAAgBnS,EAAOjZ,WAIrD,OAHAhU,KAAK29B,UAAU58B,SAAQ,SAAUo9B,GAC7B,OAAOA,EAAS,eAAgBsB,EAAmB9wB,KAAI,SAAUyO,GAAK,OAAOA,EAAE1P,YAE5E+xB,GAEXX,EAAcj9B,UAAU6O,IAAM,SAAU+rB,EAAaC,GACjD,IAAIvsB,EAAQnQ,KACZ,GAAyB,IAArBgC,UAAUoN,OACV,OAAOmE,OAAOC,KAAKxT,KAAKgtB,QAAQre,KAAI,SAAUnJ,GAAQ,OAAO2K,EAAM6c,OAAOxnB,GAAMkI,QACpF,IAAIgyB,EAAQ1/B,KAAKy7B,QAAQ3a,KAAK2b,EAAaC,GAC3C,OAAQgD,GAASA,EAAMhyB,MAAS,MAYpCoxB,EAAcj9B,UAAUiV,UAAY,SAAU6oB,EAAUC,GACpD,OAAO5/B,KAAK+7B,QAAQA,QAAQ4D,EAAUC,IAEnCd,EA7JuB,2SCsB9Be,EAA6B,WAe7B,SAASA,EAAYC,EAAgBC,EAAaC,EAASC,GACvDjgC,KAAK8/B,eAAiBA,EACtB9/B,KAAK+/B,YAAcA,EACnB//B,KAAK+/B,YAAcA,EACnB//B,KAAKggC,SAAU,QAAO,GAAIA,GAAW,IACrChgC,KAAKigC,UAAW,QAAO,GAAIA,GAAY,IACvCjgC,KAAKkgC,YAAcJ,EAAerE,QAAQ3a,KAAKif,EAAa//B,KAAKigC,SAASE,UAsF9E,OAnFAN,EAAYh+B,UAAU2D,KAAO,WACzB,OAAQxF,KAAKkgC,aAAelgC,KAAKkgC,YAAY16B,MAASxF,KAAK+/B,aAG/DF,EAAYh+B,UAAU4qB,WAAa,WAC/B,OAAOzsB,KAAK+/B,aAGhBF,EAAYh+B,UAAUuM,OAAS,WAC3B,OAAOpO,KAAKggC,SAGhBH,EAAYh+B,UAAU4W,OAAS,WAC3B,OAAOzY,KAAKkgC,aAGhBL,EAAYh+B,UAAU4L,MAAQ,WAC1B,OAAOzN,KAAKkgC,aAAelgC,KAAKkgC,YAAYxyB,MAGhDmyB,EAAYh+B,UAAU1B,QAAU,WAC5B,OAAOH,KAAKigC,UAGhBJ,EAAYh+B,UAAUu+B,OAAS,WAC3B,SAAUpgC,KAAKkgC,cAAelgC,KAAKkgC,YAAYxyB,OAGnDmyB,EAAYh+B,UAAUw+B,MAAQ,WAC1B,OAAQrgC,KAAKqF,SAGjBw6B,EAAYh+B,UAAUwD,MAAQ,WAC1B,IAAIq3B,EAAO18B,KAAKG,UAAUggC,SAC1B,IAAKngC,KAAKkgC,aAAiBxD,EAAM,CAC7B,IAAIF,EAAYE,EAAKl3B,KAAOk3B,EAAKl3B,KAAOk3B,EACxC,MAAO,sBAAwB18B,KAAKwF,OAAS,iBAAmBg3B,EAAY,IAEhF,OAAKx8B,KAAKkgC,YAELlgC,KAAKkgC,YAAYxyB,UAAtB,EACW,UAAY1N,KAAKwF,OAAS,8BAF1B,kBAAoBxF,KAAKwF,OAAS,KAIjDq6B,EAAYh+B,UAAUiT,SAAW,WAC7B,MAAO,IAAM9U,KAAKwF,OAAS,KAAM,QAAUxF,KAAKoO,WAQpDyxB,EAAYh+B,UAAUy+B,UAAY,SAAU7yB,GACxC,OAAO,IAAIoyB,EAAY7/B,KAAK8/B,eAAgBryB,EAAOzN,KAAKggC,QAAShgC,KAAKigC,WAS1EJ,EAAYh+B,UAAU0+B,WAAa,SAAUnyB,EAAQ2G,QACjC,IAAZA,IAAsBA,GAAU,GACpC,IAAI8d,EAAY9d,EAAU3G,GAAS,QAAO,GAAIpO,KAAKggC,QAAS5xB,GAC5D,OAAO,IAAIyxB,EAAY7/B,KAAK8/B,eAAgB9/B,KAAK+/B,YAAalN,EAAW7yB,KAAKigC,WASlFJ,EAAYh+B,UAAU2+B,YAAc,SAAUrgC,EAAS4U,QACnC,IAAZA,IAAsBA,GAAU,GACpC,IAAI0rB,EAAU1rB,EAAU5U,GAAU,QAAO,GAAIH,KAAKigC,SAAU9/B,GAC5D,OAAO,IAAI0/B,EAAY7/B,KAAK8/B,eAAgB9/B,KAAK+/B,YAAa//B,KAAKggC,QAASS,IAGhFZ,EAAYa,MAAQ,SAAUzmB,GAC1B,OAAOA,GAAOA,EAAIxM,SAAU,QAASwM,EAAIxM,SAAW,QAASwM,EAAIxM,SAAU,QAASwM,EAAIxM,MAAMjI,QAE3Fq6B,EA3GqB,iYCf5Bc,EAA6B,WAC7B,SAASA,EAAY1U,GACjBjsB,KAAKisB,WAAaA,EA2EtB,OAzEA0U,EAAY9+B,UAAU++B,mBAAqB,SAAUC,GACjD,IAAI1wB,EAAQnQ,KAEZ,OADmBA,KAAKisB,WAAWvX,OAAOoY,kBACtB9iB,WACf82B,WAAWD,GACXlyB,KAAI,SAAUO,GAAQ,OAAOiB,EAAM4wB,WAAW7xB,MAC9CN,OAAO,KAAS,IAChBtF,OAAO,OAWhBq3B,EAAY9+B,UAAUk/B,WAAa,SAAUC,GACzC,IAAI/U,EAAajsB,KAAKisB,WAClBvd,EAAcud,EAAWvd,cAEzBuyB,EAAgBjhC,KAAKkhC,iBAAiBF,EAAUtyB,EAAaud,GACjE,IAAKgV,EACD,MAAO,GACX,IA4DWE,EA5DPC,EAAkB,CAClBnV,WAAYA,EACZnG,QAASmG,EAAW9rB,UAAU2lB,SAkBlC,OAAOmb,EACFtyB,KAjBqB,SAAUkF,GAMhC,OAJcA,EAAKqP,QAAQxU,EAAaud,GAEZ+U,EAASK,kBAAkB77B,MAElCmJ,KAAI,SAAUJ,GAC/B,IAAI0xB,GAAW,QAAO,CAClB38B,KAAMuQ,EAAKvQ,KACXg+B,UAAW,CAAEN,SAAUA,EAASx7B,KAAMqL,QAAStC,IAChD6yB,GACC3zB,EAAQuzB,EAASK,kBAAkBv+B,QAAU,UAA4ByL,EAAKd,MAAMC,KAAO,KAC3F6zB,EAAiB,IAAI,IAAetV,EAAYxe,EAAOoG,EAAMosB,GACjE,MAAO,CAAEpsB,KAAMA,EAAMtF,KAAMA,EAAMgzB,eAAgBA,SAKpD3yB,OAAO,KAAS,IAChB4c,MAqCM2V,EArCSH,EAASQ,iBAsCR,IAArBL,IAA+BA,GAAmB,GAC/C,SAA+B1O,EAAGlV,GACrC,IAAIkkB,EAASN,GAAoB,EAAI,EACjCO,GAAcjP,EAAElkB,KAAKd,MAAMtF,KAAKiH,OAASmO,EAAEhP,KAAKd,MAAMtF,KAAKiH,QAAUqyB,EACzE,OAAsB,IAAfC,EAAmBA,EAAankB,EAAE1J,KAAKzM,SAAWqrB,EAAE5e,KAAKzM,YAzC3DuH,KAAI,SAAU8E,GAAS,OAAOA,EAAM8tB,mBAa7CZ,EAAY9+B,UAAUq/B,iBAAmB,SAAUF,EAAUtyB,EAAaud,GACtE,IAAI0V,EAAWX,EAASY,YAAc,WAElC/6B,EAAe7G,KAAKisB,WAAWvX,OAAOoY,kBAE1C,OADiB6U,EAAW,CAAC96B,GAAgB,CAAC7G,KAAKisB,WAAYplB,IAE1D8H,KAAI,SAAUkzB,GAAO,OAAOA,EAAIC,SAASd,EAASx7B,SAClD8D,QAAO,QAAgB,KAAS,uBAAyB03B,EAASx7B,OAClEoJ,OAAO,KAAS,IAChBtF,QAAO,SAAUuK,GAAQ,OAAOA,EAAKqP,QAAQxU,EAAaud,OAE5D0U,EA7EqB,+PCDzB,SAASoB,EAAWt0B,EAAOu0B,EAAW/V,GACzC,IAAIgW,GAAU,QAASD,GAAa,CAACA,GAAaA,EAYlD,UADe,QAAWC,GAAWA,EAVrC,SAAoBhV,GAEhB,IADA,IAAIiV,EAAcD,EACT5kB,EAAI,EAAGA,EAAI6kB,EAAY9yB,OAAQiO,IAAK,CACzC,IAAIwF,EAAO,IAAI,KAAKqf,EAAY7kB,IAChC,GAAKwF,GAAQA,EAAKK,QAAQ+J,EAAOznB,QAAYqd,GAAQqf,EAAY7kB,KAAO4P,EAAOznB,KAC3E,OAAO,EAGf,OAAO,IAGMiI,EAAOwe,GAK5B,IAAIkW,EAAgC,WAChC,SAASA,EAAeC,EAASC,EAAW7hC,EAAU8hC,EAAeC,EAAwBpiC,QACzE,IAAZA,IAAsBA,EAAU,IACpCH,KAAKoiC,QAAUA,EACfpiC,KAAKqiC,UAAYA,EACjBriC,KAAKQ,SAAWA,EAChBR,KAAKsiC,cAAgBA,EACrBtiC,KAAKuiC,uBAAyBA,EAC9BviC,KAAKwiC,YAAc,EACnBxiC,KAAKyiC,eAAgB,EACrBziC,KAAKoH,SAAWjH,EAAQiH,UAAY,EACpCpH,KAAKsD,KAAOnD,EAAQmD,MAAQ,KAC5BtD,KAAK0iC,YAAcviC,EAAQuiC,YAqF/B,OApEAP,EAAetgC,UAAU8gC,eAAiB,SAAUC,EAAOZ,EAAW/V,GAClE,IAAkB,IAAd+V,EACA,OAAOY,EACX,IAAIpN,EAAWoN,EAAMt5B,QAAO,SAAUiF,GAAQ,OAAOwzB,EAAWxzB,EAAKd,MAAOu0B,EAAW/V,MACvF,OAAOuJ,EAASpmB,OAASomB,EAAW,MAgBxC2M,EAAetgC,UAAUghC,yBAA2B,WAChD,OAAO,QAAO7iC,KAAKoiC,QAAQp4B,WAAW84B,iBAAiB,WAAc,OAAO,MAiBhFX,EAAetgC,UAAUkhC,kBAAoB,SAAUr0B,EAAaud,GAChE,IAAI9b,EAAQnQ,KACR8P,GAAW,QAAO9P,KAAK6iC,2BAA4B7iC,KAAKsiC,eAE5D,OADY,QAAOtiC,KAAKoiC,QAAQp4B,WAAW84B,iBAC9Bl0B,QAAO,SAAUo0B,EAAIC,GAG9B,IAAIC,EAAcD,EAASngC,QAAU,UACjCqF,EAAOuG,EAAYu0B,EAASz9B,OAAS,GACrCo9B,EAAQM,EAAc/6B,EAAO,EAAC,QAAKA,IAEvC,OADA66B,EAAGC,EAASz9B,MAAQ2K,EAAMwyB,eAAeC,EAAO9yB,EAASmzB,EAASz9B,MAAOymB,GAClE+W,IACR,KAQPb,EAAetgC,UAAUqhB,QAAU,SAAUxU,EAAaud,GACtD,IAAI/I,EAAUljB,KAAK+iC,kBAAkBr0B,EAAaud,GAGlD,OADiB,QAAO/I,GAASigB,MAAM,MACnBjgB,EAAU,MAElCif,EAAetgC,UAAU28B,WAAa,WAClCx+B,KAAKuiC,uBAAuBviC,MAC5BA,KAAKyiC,eAAgB,GAElBN,EAjGwB,GAqG5B,SAASiB,EAAUtP,EAAUhH,EAAmBuV,GAEnD,IACIgB,GADoBvP,EAASwP,iBAAmBxP,EAASwP,kBAAoB,IACnDjB,EAAU78B,MAAQ,GAC5C+9B,GAAe,QAAWF,GAG9B,SAASG,EAAmBC,EAAajjC,EAAUL,QAC/B,IAAZA,IAAsBA,EAAU,IACpC,IAAI6pB,EAAiB,IAAImY,EAAerV,EAAmBuV,EAAW7hC,EAAUijC,EAAaF,EAAcpjC,GAE3G,OADAkjC,EAAM5iC,KAAKupB,GACJA,EAAewU,WAAWl7B,KAAK0mB,GAE1C,OAPA8J,EAASuO,EAAU78B,MAAQg+B,EAOpBA,2FCpJX,IAAIE,EAQAC,2BAPJ,SAAWD,GACPA,EAAoBA,EAA4B,OAAI,GAAK,SACzDA,EAAoBA,EAA4B,OAAI,GAAK,SACzDA,EAAoBA,EAAyB,IAAI,GAAK,MACtDA,EAAoBA,EAA6B,QAAI,GAAK,UAC1DA,EAAoBA,EAA2B,MAAI,GAAK,QAL5D,CAMGA,IAAwBA,EAAsB,KAEjD,SAAWC,GACPA,EAAoBA,EAAgC,WAAI,GAAK,aAC7DA,EAAoBA,EAA2B,MAAI,GAAK,QAF5D,CAGGA,IAAwBA,EAAsB,8HCP7CC,2LACJ,SAAWA,GAOPA,EAAWA,EAAuB,WAAI,GAAK,aAM3CA,EAAWA,EAAoB,QAAI,GAAK,UAMxCA,EAAWA,EAAoB,QAAI,GAAK,UAWxCA,EAAWA,EAAoB,QAAI,GAAK,UAMxCA,EAAWA,EAAkB,MAAI,GAAK,QApC1C,CAqCGA,IAAeA,EAAa,KAG/B,IAAIv4B,EAAK,EACLw4B,EAA2B,WAC3B,SAASA,EAAU30B,EAAM40B,EAASC,GAE9B/jC,KAAKmb,IAAM9P,IACXrL,KAAKkP,KAAOA,EACZlP,KAAK8jC,QAAUA,EACf9jC,KAAK+jC,OAASA,EA4DlB,OAzDAF,EAAUG,mBAAqB,SAAU/pB,GACrC,OAAOA,GAA2B,mBAAbA,EAAIlP,OAAuB,IAAAmO,IAAG2qB,EAAH,CAAc5pB,EAAIyN,uBAGtEmc,EAAUI,WAAa,SAAUF,EAAQ5jC,GACrC,IACI+jC,EAAY,IAAIL,EAAUD,EAAWO,WAD3B,+DACgDJ,GAI9D,OAHI5jC,GAAWA,EAAQikC,aACnBF,EAAUE,YAAa,GAEpBF,GAGXL,EAAUO,WAAa,SAAUL,GAC7B,OAAOF,EAAUI,WAAWF,EAAQ,CAAEK,YAAY,KAGtDP,EAAUQ,QAAU,SAAUN,GAE1B,OAAO,IAAIF,EAAUD,EAAWU,QADlB,6BACoCP,IAGtDF,EAAUzK,QAAU,SAAU2K,GAE1B,OAAO,IAAIF,EAAUD,EAAWW,QADlB,6BACoCR,IAGtDF,EAAUW,QAAU,SAAUT,GAE1B,OAAO,IAAIF,EAAUD,EAAWa,QADlB,kCACoCV,IAGtDF,EAAUa,QAAU,SAAUX,GAE1B,OAAO,IAAIF,EAAUD,EAAWe,MADlB,yBACkCZ,IAWpDF,EAAUe,UAAY,SAAUb,GAC5B,OAAO,IAAA7qB,IAAG2qB,EAAH,CAAcE,GAAUA,EAASF,EAAUa,QAAQX,IAE9DF,EAAUhiC,UAAUiT,SAAW,WAC3B,IAA6BqkB,EACzB4K,GADyB5K,EACHn5B,KAAK+jC,SADgB5K,EAAErkB,WAAavB,OAAO1R,UAAUiT,SAAWqkB,EAAErkB,YAAa,QAAUqkB,GAE/G9N,EAAKrrB,KACT,MAAO,6BADcqrB,EAAGlQ,IACoB,UADRkQ,EAAGnc,KACwB,cADRmc,EAAGyY,QAC+B,aAAeC,EAAS,KAErHF,EAAUhiC,UAAUgjC,UAAY,WAC5B,OAAO,SAAO,QAAgB7kC,MAAO,CAAE0nB,qBAAsB1nB,QAE1D6jC,EAlEmB,oMC1C1BiB,EAEA,SAA6Bt/B,EAAMo8B,EAAWmD,EAAW1D,EAAmBG,EAAawD,EAAkBC,EAAiBC,QACpG,IAAhB1D,IAA0BA,GAAc,QACnB,IAArBwD,IAA+BA,EAAmB,wBAC9B,IAApBC,IAA8BA,EAAkB,uBAChC,IAAhBC,IAA0BA,GAAc,GAC5CllC,KAAKwF,KAAOA,EACZxF,KAAK4hC,UAAYA,EACjB5hC,KAAK+kC,UAAYA,EACjB/kC,KAAKqhC,kBAAoBA,EACzBrhC,KAAKwhC,YAAcA,EACnBxhC,KAAKglC,iBAAmBA,EACxBhlC,KAAKilC,gBAAkBA,EACvBjlC,KAAKklC,YAAcA,gsBCVvBC,EAAiB,CACjBrf,QAAS,KACTmG,WAAY,KACZqV,UAAW,GACXh+B,KAAM,MAEN8hC,EAAgC,WAChC,SAASA,EAAenZ,EAAYoZ,EAAcrb,EAAgB7pB,GAC9D,IAAIgQ,EAAQnQ,KACZA,KAAKisB,WAAaA,EAClBjsB,KAAKqlC,aAAeA,EACpBrlC,KAAKgqB,eAAiBA,EACtBhqB,KAAKG,QAAUA,EACfH,KAAKslC,aAAe,WAAc,OAAOn1B,EAAMjB,KAAK0yB,YAAc,UAA4BzxB,EAAMhQ,QAAQ8rB,WAAWsZ,YACvHvlC,KAAKG,SAAU,QAASA,EAASglC,GACjCnlC,KAAKkP,KAAO8a,EAAeqY,UAyK/B,OArJA+C,EAAenJ,MAAQ,SAAUoH,EAAOmC,GAGpC,OAAOnC,EAAMz0B,QADU,SAAU8vB,EAAM+G,GAAY,OAAO/G,EAAK3zB,MAAK,WAAc,OAAO06B,EAASC,kBAC5DF,GAAW,gBAarDJ,EAAeO,YAAc,SAAUtC,EAAOuC,GAC1C,IAAK,IAAI32B,EAAM,EAAGA,EAAMo0B,EAAMj0B,OAAQH,IAAO,CACzC,IAAIib,EAAamZ,EAAMp0B,GAAKy2B,aAC5B,IAAI,QAAUxb,GAAa,CACvB,IAAI2b,EAAiBxC,EAAMvhC,MAAMmN,EAAM,GACvC,OAAOm2B,EAAenJ,MAAM4J,EAAgB3b,GAAYnf,KAAK66B,IAGrE,OAAOA,KAKXR,EAAeU,YAAc,SAAUzC,GACnCA,EAAMtiC,SAAQ,SAAU8S,GAAQ,OAAOA,EAAK6xB,iBAEhDN,EAAevjC,UAAUkkC,SAAW,SAAU7Y,GAC1CltB,KAAKisB,WAAWvX,OAAOmC,aAAamvB,qBAApChmC,CAA0DktB,IAE9DkY,EAAevjC,UAAU6jC,WAAa,WAClC,IAAIv1B,EAAQnQ,KACR6T,EAAO7T,KAAKgqB,eAChB,IAAInW,EAAK4uB,cAAT,CAEA,IAAIwD,EAAajmC,KAAKkmC,yBACtB,GAAID,EACA,OAAOA,EACX,IAAI9lC,EAAUH,KAAKG,QACnB,yBAA0BH,KAAMA,KAAKisB,WAAY9rB,GACjD,IAEIgmC,EAAc,SAAUjZ,GAAO,OAAOrZ,EAAKwuB,UAAU4C,gBAAgB90B,EAA/B0D,CAAsCqZ,IAC5EkZ,EAAe,SAAU9/B,GAAU,OAAOuN,EAAKwuB,UAAU2C,iBAAiB70B,EAAhC0D,CAAuCvN,IACrF,IACI,IAAIA,EALkCuN,EAAKrT,SAASuB,KAAK5B,EAAQmD,KAAM6M,EAAM8b,WAAY9b,EAAMk1B,cAM/F,OAAKrlC,KAAKkP,KAAKg2B,cAAe,QAAU5+B,GAC7BA,EAAO+b,OANH,SAAU6K,GAAO,OAAO,cAAoBA,GAAK2X,eAM1B95B,KAAKq7B,EAAcD,GAG9CC,EAAa9/B,GAG5B,MAAO4mB,GAEH,OAAOiZ,EAAY,cAAoBjZ,IAE3C,QACQrZ,EAAK6uB,eAAiB7uB,EAAK2uB,aAAe3uB,EAAK6uB,aAC/C7uB,EAAK2qB,gBAajB4G,EAAevjC,UAAUwkC,iBAAmB,SAAU//B,GAClD,IAAI6J,EAAQnQ,KAEZ,OADiBA,KAAKkmC,4BAIlB,QAAU5/B,GAEHA,EAAOyE,MAAK,SAAU/G,GAAO,OAAOmM,EAAMk2B,iBAAiBriC,OAEtE,qBAAsBsC,EAAQtG,KAAKisB,WAAYjsB,KAAKG,UAErC,IAAXmG,EAEO,YAAkB,2BAA2Bu+B,aAEpC,IAAA3rB,IAAG,IAEnBotB,CAAchgC,GAEP,eAAqBA,GAAQu+B,iBAFxC,KASJO,EAAevjC,UAAUqkC,uBAAyB,WAC9C,IAAIxxB,EAAS1U,KAAKisB,WAAWvX,OAE7B,OAAIA,EAAOqkB,UACA,YAAkB,sBAAwBrkB,EAAOyG,IAAM,gCAAgC0pB,YAE9F7kC,KAAKisB,WAAWsa,SACT,cAAoB1B,YAI3B7kC,KAAKslC,eAEE,eAAqBtlC,KAAKG,QAAQ2lB,WAAW+e,iBAFxD,GAKJO,EAAevjC,UAAUiT,SAAW,WAChC,IAAe3U,EAANH,KAAmBG,QAAS6pB,EAA5BhqB,KAAgDgqB,eACrDzpB,GAAQ,QAAM,qBAAN,CAA4BJ,IAAY,WAAY0Q,GAAU,QAAM,+BAAN,CAAsC1Q,KAAY,QAAM,oBAAN,CAA2BA,IAAY,UAAWqF,GAAO,QAAWwkB,EAAexpB,UAC/M,OAAOD,EAAQ,aAAesQ,EAAU,MAAO,QAAU,IAAKrL,IAMlE4/B,EAAeoB,cAAgB,SAAU3yB,GAAQ,OAAO,SAAUvN,GAC9D,OAAOuN,EAAKwyB,iBAAiB//B,KAMjC8+B,EAAeqB,oBAAsB,SAAU5yB,GAAQ,OAAO,SAAUvN,IACpE,QAAUA,IAAWA,EAAO+b,OAAM,SAAU6K,GAAO,OAAOrZ,EAAKkyB,SAAS,cAAoB7Y,SAOhGkY,EAAesB,UAAY,SAAU7yB,GAAQ,OAAO,SAAUxO,GAAS,OAAOwO,EAAKkyB,SAAS1gC,KAC5F+/B,EAAeuB,aAAe,SAAU9yB,GAAQ,OAAO,SAAUxO,GAAS,OAAO,QAAgBA,KACjG+/B,EAAewB,YAAc,SAAU/yB,GAAQ,OAAO,SAAUxO,GAC5D,MAAMA,IAEH+/B,EAlLwB,qgBCXnC,SAASyB,EAAmBj3B,GACxBA,EAAMk3B,cAAc,cAAoB,IAAUl3B,EAAM8E,QAAS,IACjE9E,EAAMk3B,cAAc,cAAoB,IAAYl3B,GAAQ,IAC5DA,EAAMk3B,cAAc,cAAoB,eAAgBl3B,GAAQ,IAChEA,EAAMk3B,cAAc,cAAoB,eAAgBl3B,EAAMxB,UAAW,IACzEwB,EAAMuc,WAAWprB,SAAQ,SAAU0M,GAC/BmC,EAAMk3B,cAAc,cAAoB,UAAWr5B,GAAQA,MAG5D,IAGHs5B,EAAoB,CAAC,eAAgB,KACrCC,GAAe,QAAQD,GAKhBE,EAAqB,SAAUr3B,GACtC,IAAIgzB,GAAQ,QAAOhzB,EAAMlB,eAAeE,OAAO,KAAS,IAAIA,OAAO,KAAO,IAEtEs4B,EAA4B,SAAU3pB,GACtC,OAAOypB,EAAazpB,EAAEgE,OAAS,cAAoBhE,EAAEgE,MAAO,MAAQhE,GAExEqlB,EAAM7hC,SAAQ,SAAUwN,GACpBA,EAAKwJ,YAAcxJ,EAAKwJ,YAAYpJ,IAAIu4B,+MCnB5CC,EAAiB,SAAUv3B,GAC3B,IAAIw3B,EAAWx3B,EAAMuf,KAAKkY,WAC1B,GAAKD,EAAL,CAEA,IAAI3uB,EAAS7I,EAAM8E,OAAOmC,aAW1B,OAAI,QAAWuwB,GACJ,YAAiBA,EAASx3B,IAAQ7E,KAAKq7B,GAE3CA,EAAagB,GAbpB,SAAShB,EAAa9/B,GAClB,GAAKA,EAEL,OAAIA,aAAkB,IACXA,GACP,QAASA,GACFmS,EAAOpS,OAAOC,EAAQsJ,EAAMxB,SAAUwB,EAAMzP,WACnDmG,EAAc,OAAKA,EAAe,OAC3BmS,EAAOpS,OAAOC,EAAc,OAAKsJ,EAAMuf,KAAM7oB,EAAe,QAAKsJ,EAAMxB,SAAUwB,EAAMzP,gBADlG,IChBR,SAASmnC,EAAwB3zB,GAC7B,OAAO,SAAUsY,EAAYxe,GAGzB,OAAO85B,EAFM95B,EAAMuG,UACCL,IACNsY,EAAYxe,IAYlC,IAAI+5B,EAAaF,EAAwB,UAarCG,EAAeH,EAAwB,YAavCI,EAAcJ,EAAwB,2MC7C/BK,EAAwB,IAU/BC,EAAmB,SAAUh4B,GAC7B,OAAO,IAAI,IAAeA,EAAMlB,cAAcygB,IAAIuI,YAAY,QAAS9nB,GAAO7E,KAAK,OAcnF88B,EAAmB,SAAUj4B,EAAOnC,GACpC,OAAO,IAAI,IAAemC,EAAMlB,cAAcygB,IAAIpb,WAAWtG,EAAMuG,WAAW0jB,YAAY,OAAQ9nB,GAAO7E,KAAK,OAe9G+8B,EAAmB,SAAUl4B,GAC7B,OAAO,IAAI,IAAeA,EAAMlB,cAAcygB,IAAIuI,YAAY,OAAQ9nB,GAAO7E,KAAK,OCnClFg9B,EAAoB,SAAU9b,GAC9B,IAAIllB,EAAK,OACLihC,EAAgB/b,EAAWzR,MAAM,YACrC,GAAKwtB,EAAc54B,OAEnB,OAAOrI,EAAG0U,IAAIusB,EAAcr5B,KAAI,SAAUmL,GAAQ,OAAO/S,EAAGkJ,KAAK6J,EAAKuB,YAAatQ,KAAK,OAexFk9B,EAAgB,SAAUhc,GAC1B,IAAI+b,EAAgB/b,EAAWzR,MAAM,YACjC0tB,EAAejc,EAAWzR,MAAM,WACpC,GAAKwtB,EAAc54B,QAAW84B,EAAa94B,OAA3C,CAEA,IAAItI,EAAQmlB,EAAWvX,OAAOqC,YAC9BmxB,EAAannC,SAAQ,SAAUonC,GAAM,OAAOrhC,EAAMshC,qBAAqBD,MACvEH,EAAcjnC,SAAQ,SAAUonC,GAAM,OAAOrhC,EAAMuhC,mBAAmBF,MACtErhC,EAAM8lB,SCzBN0b,EAAoB,SAAU14B,GAC9B,IAAI0I,EAAU1I,EAAM8E,OAAO4D,QAOvBiwB,EAAyB,WAErBjwB,EAAQ2T,aAAerc,IACvB0I,EAAQ2T,WAAa,OAE7Brc,EAAM7B,UAAU,IAXW,WACvBuK,EAAQ0T,sBAAsBxG,QAAQ5V,GACtC0I,EAAQwa,SAAWljB,EAAMmjB,MACzBza,EAAQwN,QAAUxN,EAAQwa,SAASplB,MACnC,QAAKkC,EAAMxB,SAAUkK,EAAQlK,UAOS,CAAEhH,SAAU,MACtDwI,EAAMnM,QAAQsH,KAAKw9B,EAAwBA,ICtB3CC,EAAY,SAAUvc,GACtB,IAAI9rB,EAAU8rB,EAAW9rB,UACrBsY,EAASwT,EAAWvX,OAAOmC,aAC3B6B,EAAauT,EAAWvX,OAAOyH,UAKnC,GAAuB,QAAnBhc,EAAQ4e,QAAoB5e,EAAQ0V,UAAY4C,EAAOqa,SAASsH,UAAW,CAC3E,IAAIqO,EAAa,CAAE1zB,QAA8B,YAArB5U,EAAQ0V,UACpC6C,EAAWjY,KAAKgY,EAAOqa,SAASsH,UAAU3oB,IAAKgH,EAAOrK,OAAQq6B,GAElE/vB,EAAW0D,QAAO,kWCPtB,SAASssB,EAAY94B,GACjB,IAAI+4B,EAAgB/4B,EAAMg5B,iBAC1B,GAAKD,EAAL,CAEAtgC,EAAA,0BAA6BuH,GAC7B,IAAIi5B,EAAUj5B,EAAM8E,OAAO4D,QAAQ2T,WAOnC,MAHsB,kBAAlB0c,GAAqCE,GACrCA,EAAQC,QAEL,cAAoBjE,aCf/B,SAASkE,EAAsBn5B,GAC3B,IAAKA,EAAMywB,QACP,MAAM,IAAI5tB,MAAM7C,EAAMvK,QAAQyP,YAG/B,ICaIk0B,EAAmB,CAC1BnzB,UAAU,EACVsqB,SAAU,KACV/gB,SAAS,EACT6pB,QAAQ,EACRC,QAAQ,EACRC,WAAW,EACXC,OAAQ,GACRtjB,QAAS,WAAc,OAAO,MAC9B/G,OAAQ,WAaRsqB,EAAmC,WAEnC,SAASA,EAAkBC,GAEvBtpC,KAAKupC,iBAAmB,EAExBvpC,KAAKwpC,YAAc,GAEnBxpC,KAAKsjC,iBAAmB,GAExBtjC,KAAKypC,eAAiB,GACtBzpC,KAAKspC,QAAUA,EACftpC,KAAK8G,MAAQwiC,EAAQvyB,YACrB/W,KAAK0pC,mBAAqB,GAC1B1pC,KAAKgK,YAAc,SAAqB,QAAIhK,MAAO,IAAI,QAAIA,MAAO,CAC9D,kBACA,eACA,gBACA,aACA,aAEJA,KAAK2pC,mBACL3pC,KAAK4pC,oBACL5pC,KAAK6pC,+BACLP,EAAQhxB,QAAQ0T,sBAAsBzG,QAAQ0hB,GAuLlD,OA9JAoC,EAAkBxnC,UAAUioC,SAAW,SAAUh6B,EAAUtP,EAAUL,KAIrEkpC,EAAkBxnC,UAAUkO,SAAW,SAAUD,EAAUtP,EAAUL,KAIrEkpC,EAAkBxnC,UAAUkoC,QAAU,SAAUj6B,EAAUtP,EAAUL,KAIpEkpC,EAAkBxnC,UAAUmoC,OAAS,SAAUl6B,EAAUtP,EAAUL,KAInEkpC,EAAkBxnC,UAAUooC,SAAW,SAAUn6B,EAAUtP,EAAUL,KAIrEkpC,EAAkBxnC,UAAUqoC,QAAU,SAAUp6B,EAAUtP,EAAUL,KAIpEkpC,EAAkBxnC,UAAUsoC,SAAW,SAAUr6B,EAAUtP,EAAUL,KAIrEkpC,EAAkBxnC,UAAUkM,UAAY,SAAU+B,EAAUtP,EAAUL,KAItEkpC,EAAkBxnC,UAAUuoC,QAAU,SAAUt6B,EAAUtP,EAAUL,KAOpEkpC,EAAkBxnC,UAAUqT,QAAU,SAAUR,IAC5C,QAAO1U,KAAKsjC,kBAAkBviC,SAAQ,SAAUspC,GAC5C,OAAOA,EAAWtpC,SAAQ,SAAU8S,GAChCA,EAAK4uB,eAAgB,GACrB,QAAW4H,EAAYx2B,UAenCw1B,EAAkBxnC,UAAUL,OAAS,SAAUyyB,EAAUzH,GACrD,OAAO,IAAI,IAAWyH,EAAUzH,EAAaxsB,KAAKspC,UAGtDD,EAAkBxnC,UAAU+nC,kBAAoB,WAC5C,IAAIU,EAAQ,IACRC,EAAK,IACLC,EAAQxqC,KAAKypC,eACbgB,GAAc,EACdC,GAAc,EAClB1qC,KAAK2qC,aAAa,WAAYL,EAAMM,OAAQ,EAAGJ,EAAMrb,GAAIsb,EAAaF,EAAG9D,oBAAqB8D,EAAG3D,YAAa8D,GAC9G1qC,KAAK2qC,aAAa,WAAYL,EAAMO,OAAQ,EAAGL,EAAMrb,IACrDnvB,KAAK2qC,aAAa,UAAWL,EAAMQ,IAAK,EAAGN,EAAMrb,IACjDnvB,KAAK2qC,aAAa,SAAUL,EAAMQ,IAAK,IAAKN,EAAMv8B,SALV,GAMxCjO,KAAK2qC,aAAa,WAAYL,EAAMQ,IAAK,IAAKN,EAAMrV,UACpDn1B,KAAK2qC,aAAa,UAAWL,EAAMQ,IAAK,IAAKN,EAAMre,UACnDnsB,KAAK2qC,aAAa,WAAYL,EAAMQ,IAAK,IAAKN,EAAMrb,IACpDnvB,KAAK2qC,aAAa,YAAaL,EAAMS,QAAS,EAAGP,EAAMrb,GAAIsb,EAAaF,EAAG9D,oBAAqB8D,EAAG7D,UAAWgE,GAC9G1qC,KAAK2qC,aAAa,UAAWL,EAAM3F,MAAO,EAAG6F,EAAMrb,GAAIsb,EAAaF,EAAG9D,oBAAqB8D,EAAG7D,UAAWgE,IAG9GrB,EAAkBxnC,UAAU8nC,iBAAmB,WAC3C,IAAIqB,EAAQ,UAA2BrhB,EAAa,eACpD3pB,KAAKirC,gBAAgB,KAAMthB,GAC3B3pB,KAAKirC,gBAAgB,OAAQthB,GAC7B3pB,KAAKirC,gBAAgB,UAAWD,GAChChrC,KAAKirC,gBAAgB,WAAYD,GACjChrC,KAAKirC,gBAAgB,WAAYD,IAGrC3B,EAAkBxnC,UAAU8oC,aAAe,SAAUnlC,EAAMo8B,EAAWmD,EAAW1D,EAAmBG,EAAawD,EAAkBC,EAAiBC,QAC5H,IAAhB1D,IAA0BA,GAAc,QACnB,IAArBwD,IAA+BA,EAAmB,wBAC9B,IAApBC,IAA8BA,EAAkB,uBAChC,IAAhBC,IAA0BA,GAAc,GAC5C,IAAI7C,EAAY,IAAI,IAAoB78B,EAAMo8B,EAAWmD,EAAW1D,EAAmBG,EAAawD,EAAkBC,EAAiBC,GACvIllC,KAAKwpC,YAAY/oC,KAAK4hC,IACtB,QAAUriC,KAAMA,KAAMqiC,IAG1BgH,EAAkBxnC,UAAUi/B,WAAa,SAAUD,GAI/C,QAH0B,QAAUA,GAC9B7gC,KAAKwpC,YAAYlgC,QAAO,SAAU4F,GAAQ,OAAOA,EAAK0yB,YAAcf,KACpE7gC,KAAKwpC,YAAY1nC,SACI0pB,MAAK,SAAUiH,EAAGlV,GACzC,IAAI2tB,EAAazY,EAAEmP,UAAYrkB,EAAEqkB,UACjC,OAAsB,IAAfsJ,EAAmBzY,EAAEsS,UAAYxnB,EAAEwnB,UAAYmG,MAgB9D7B,EAAkBxnC,UAAUopC,gBAAkB,SAAUzlC,EAAM2lC,GAC1DnrC,KAAKypC,eAAejkC,GAAQ,CAAEA,KAAMA,EAAM1C,MAAOqoC,IAIrD9B,EAAkBxnC,UAAUihC,cAAgB,WACxC,OAAO9iC,KAAKypC,gBAGhBJ,EAAkBxnC,UAAUigC,SAAW,SAAUnuB,GAC7C,OAAO3T,KAAKsjC,iBAAiB3vB,IAGjC01B,EAAkBxnC,UAAUgoC,6BAA+B,WACvD,IAAIuB,EAAMprC,KAAK0pC,mBACf0B,EAAIC,gBAA6CrrC,KTzN5B8pC,SAAS,GAAIjD,GS0NlCuE,EAAIhS,QAAwCp5B,KF/MvB+P,SAAS,GAAI24B,EAAa,CAAEthC,UAAW,OEgN5DgkC,EAAI/G,QD7N+B,SAAUvX,GACjD,OAAOA,EAAkB/c,SAAS,GAAIg5B,EAAuB,CAAE3hC,UAAW,MC4NxDkkC,CAA8BtrC,MAE5CorC,EAAI/D,WR7MwB,SAAUva,GAC1C,OAAOA,EAAkBid,QAAQ,CAAE5a,GAAI,SAAU1hB,GAAS,QAASA,EAAM45B,aAAiBF,GQ4MrEoE,CAAuBvrC,MAExCorC,EAAIpB,OPtNoB,SAAUld,GACtC,OAAOA,EAAkBkd,OAAO,CAAE/7B,QAAS,SAAUR,GAAS,QAASA,EAAMu8B,SAAaxC,GOqNzEgE,CAAmBxrC,MAChCorC,EAAInB,SP1MsB,SAAUnd,GACxC,OAAOA,EAAkBmd,SAAS,CAAE9U,SAAU,SAAU1nB,GAAS,QAASA,EAAMw8B,WAAexC,GOyM5EgE,CAAqBzrC,MACpCorC,EAAIlB,QP9LqB,SAAUpd,GACvC,OAAOA,EAAkBod,QAAQ,CAAE/d,SAAU,SAAU1e,GAAS,QAASA,EAAMy8B,UAAcxC,GO6L3EgE,CAAoB1rC,MAElCorC,EAAIO,aNjO0B,SAAU7e,GAC5C,OAAOA,EAAkBid,QAAQ,GAAInC,EAAkB,CAAExgC,SAAUugC,IMgO5CiE,CAAyB5rC,MAC5CorC,EAAIS,YNnN0B,SAAU/e,GAC5C,OAAOA,EAAkBod,QAAQ,CAAE/d,UAAU,SAAI,IAAS0b,EAAkB,CAAEzgC,SAAUugC,IMkNlEmE,CAAyB9rC,MAC3CorC,EAAIW,WNpM0B,SAAUjf,GAC5C,OAAOA,EAAkBqd,SAAS,GAAIrC,EAAkB,CAAE1gC,SAAUugC,IMmM/CqE,CAAyBhsC,MAE1CorC,EAAIa,ULpO2B,SAAUnf,GAC7C,OAAOA,EAAkBqd,SAAS,GAAIpC,GKmOlBmE,CAA0BlsC,MAC1CorC,EAAInD,cL9MuB,SAAUnb,GACzC,OAAOA,EAAkB/e,UAAU,GAAIk6B,GK6MfkE,CAAsBnsC,MAE1CorC,EAAIgB,cJ3N2B,SAAUtf,GAC7C,OAAOA,EAAkBgd,SAAS,GAAIxB,GI0Nd+D,CAA0BrsC,MAE9CorC,EAAI5C,UHvOmB,SAAU1b,GACrC,OAAOA,EAAkB/e,UAAU,GAAIy6B,EAAW,CAAEphC,SAAU,OGsO1CklC,CAAkBtsC,MAElCorC,EAAIhf,UAAW,OAAqBpsB,OAEjCqpC,EA/M2B,mSChClCkD,EAA2B,WACV,SAASA,EAA2B73B,GACjD,IAAIvE,EAAQnQ,KACZA,KAAK0U,OAASA,EACG1U,KAAKouB,WAAa,IAAI,EAAAiD,WACtBrxB,KAAKkX,eAAgB,EACrBlX,KAAKwsC,oBAAqB,EAC1BxsC,KAAKysC,eAAgB,EACrBzsC,KAAK0sC,sBAAuB,EAC5B1sC,KAAKkV,QAAU,WAAc,OAAO/E,EAAMie,WAAWlZ,WAOtElV,KAAKyV,SAAW,WAAc,OAAOtF,EAAMuE,OAAO2C,eAAe5B,YAUjEzV,KAAK2sC,WAAa,SAAUC,GAAa,OAAOz8B,EAAMuE,OAAO2C,eAAes1B,WAAWC,IAMvF5sC,KAAK6sC,KAAO,WAAc,OAAO18B,EAAMuE,OAAO2C,eAAew1B,QAM7D7sC,KAAKqV,UAAY,WAAc,OAAOlF,EAAMuE,OAAO2C,eAAehC,aAMlErV,KAAK8sC,KAAO,WAAc,OAAO38B,EAAMuE,OAAO2C,eAAey1B,QAM7D9sC,KAAK+sC,SAAW,WAAc,OAAO58B,EAAMuE,OAAO2C,eAAe01B,YAwFrE,OA1EAR,EAAU1qC,UAAUmrC,gBAAkB,SAAUxoC,GAC5C,OAAQxE,KAAKwsC,oBAAqB,QAAUhoC,GAASA,EAAQxE,KAAKwsC,oBAmBtED,EAAU1qC,UAAUotB,oBAAsB,SAAUzqB,GAChD,IAAI,QAAUA,KAAoB,IAAVA,IAA4B,IAAVA,KAAoB,QAASA,GACnE,MAAM,IAAIiO,MAAM,0BAA4BjO,EAAQ,mDACxD,OAAQxE,KAAK0sC,sBAAuB,QAAUloC,GAASA,EAAQxE,KAAK0sC,sBAcxEH,EAAU1qC,UAAUorC,WAAa,SAAUzoC,GACvC,OAAQxE,KAAKysC,eAAgB,QAAUjoC,GAASA,EAAQxE,KAAKysC,eAgCjEF,EAAU1qC,UAAUqN,KAAO,SAAU1J,EAAMiU,EAAY+X,GACnD,IAAItiB,EAAOlP,KAAKouB,WAAWlf,KAAK1J,EAAMiU,EAAY+X,GAClD,OAAQ,QAAU/X,GAAqBzZ,KAAPkP,GAE7Bq9B,EA1ImB,0SCf1BW,EAAsC,WAStC,OARAA,EAAW35B,OAAO3Q,QAAU,SAASic,GACjC,IAAK,IAAIzB,EAAGC,EAAI,EAAGkD,EAAIve,UAAUoN,OAAQiO,EAAIkD,EAAGlD,IAE5C,IAAK,IAAIwd,KADTzd,EAAIpb,UAAUqb,GACO9J,OAAO1R,UAAUa,eAAeX,KAAKqb,EAAGyd,KACzDhc,EAAEgc,GAAKzd,EAAEyd,IAEjB,OAAOhc,IAEK1c,MAAMnC,KAAMgC,YAK5BmrC,EAA8B,WAC9B,SAASA,EAAaz4B,GAClB1U,KAAK0U,OAASA,EAWlB,OATAy4B,EAAatrC,UAAU+O,WAAa,SAAUvF,EAAI6D,EAAMzB,GACpD,OAAO,IAAI,EAAA4f,MAAMhiB,EAAI6D,EAAM,EAAAie,QAAA,OAAgBntB,KAAK0U,OAAOuC,WAAW1L,OAAQkC,IAE9E0/B,EAAatrC,UAAUoyB,SAAW,SAAU5oB,EAAI6D,EAAMzB,GAClD,OAAO,IAAI,EAAA4f,MAAMhiB,EAAI6D,EAAM,EAAAie,QAAA,KAAcntB,KAAK0U,OAAOuC,WAAW1L,OAAQkC,IAE5E0/B,EAAatrC,UAAUurC,WAAa,SAAU/hC,EAAI6D,EAAMzB,GACpD,OAAO,IAAI,EAAA4f,MAAMhiB,EAAI6D,EAAM,EAAAie,QAAA,OAAgBntB,KAAK0U,OAAOuC,WAAW1L,OAAQkC,IAEvE0/B,EAbsB,GAsB7BE,EAAmC,WAEnC,SAASA,EAAmC34B,GACxC,IAAIvE,EAAQnQ,KACZA,KAAK0U,OAASA,EAEd1U,KAAK07B,aAAe,IAAIyR,EAAantC,KAAK0U,QAE1C1U,KAAKstC,WAAa,IAClBttC,KAAKqtB,MAAQ,EAAAA,MAEbrtB,KAAKgtC,gBAAkB,SAAUxoC,GAAS,OAAO2L,EAAMuE,OAAOuC,WAAW1L,OAAOyhC,gBAAgBxoC,IAEhGxE,KAAKivB,oBAAsB,SAAUzqB,GAAS,OAAO2L,EAAMuE,OAAOuC,WAAW1L,OAAO0jB,oBAAoBzqB,IAExGxE,KAAKitC,WAAa,SAAUzoC,GAAS,OAAO2L,EAAMuE,OAAOuC,WAAW1L,OAAO0hC,WAAWzoC,IAEtFxE,KAAKkP,KAAO,SAAU1J,EAAMiU,EAAY+X,GACpC,OAAOrhB,EAAMuE,OAAOuC,WAAW1L,OAAO2D,KAAK1J,EAAMiU,EAAY+X,IAAiBrhB,GA+CtF,OArCAk9B,EAAkBxrC,UAAUwF,QAAU,SAAUid,EAAS/Y,GACrD,IAAI+hB,EAAYttB,KAAK0U,OAAOuC,WAAW1L,OAEnC6C,EAAS7C,IAAWA,EAAOkC,OAASlC,EAAO6C,OAC/C7C,EAAS6C,EAAS8+B,EAAS,CAAEz/B,MAAO,CAAEW,OAAQA,IAAY7C,GAAUA,EACpE,IAAIgiC,EAAe,CACfC,OAAQlgB,EAAUmf,cAClBO,gBAAiB1f,EAAUkf,mBAC3BiB,aAAcngB,EAAUpW,eAE5B,OAAO,IAAI,IAAWoN,EAASgJ,EAAUc,WAAYpuB,KAAK07B,cAAc,QAAO6R,EAAchiC,KASjG8hC,EAAkBxrC,UAAUs4B,UAAY,SAAUuT,GAE9C,KAAK,QAASA,GACV,OAAO,EACX,IAAIpnC,GAAS,EAKb,OAJA,QAAQ,eAAsB,SAAUtC,EAAKwB,IACrC,QAAWxB,KACXsC,EAASA,IAAU,QAAUonC,EAAOloC,MAAU,QAAWkoC,EAAOloC,QAEjEc,GAGX+mC,EAAkBxrC,UAAUnB,KAAO,WAC/B,IAAI4sB,EAAYttB,KAAK0U,OAAOuC,WAAW1L,OAGvC,OAFA+hB,EAAUc,WAAW5I,SAAU,EAC/B8H,EAAUc,WAAWqD,kBACdzxB,MAEJqtC,EAjE2B,kOCjBlCM,EAA2B,WAE3B,SAASA,EAA2Bj5B,GAChC,IAAIvE,EAAQnQ,KACZA,KAAK0U,OAASA,EAGd1U,KAAK4sB,KAAO,SAAU1W,GAAO,OAAO/F,EAAMuE,OAAOuC,WAAW2V,KAAK1W,IAEjElW,KAAKsc,OAAS,SAAUhH,GAAW,OAAOnF,EAAMuE,OAAOuC,WAAWqF,OAAOhH,IAEzEtV,KAAK+c,eAAiB,SAAU9Q,GAAS,OAAOkE,EAAMuE,OAAOuC,WAAW8F,eAAe9Q,IAEvFjM,KAAKgc,MAAQ,SAAU4xB,GAAY,OAAOz9B,EAAMuE,OAAOuC,WAAW+E,MAAM4xB,IAGxE5tC,KAAKuH,QAAU,SAAUwU,GACrB,OAAO5L,EAAMuE,OAAOuC,WAAW0F,MAAMpV,QAAQwU,IAGjD/b,KAAK4c,UAAY,SAAUb,GACvB,OAAO5L,EAAMuE,OAAOuC,WAAW0F,MAAMC,UAAUb,IAGnD/b,KAAKw/B,WAAa,SAAUjjB,GAAQ,OAAOpM,EAAMuE,OAAOuC,WAAW0F,MAAM6iB,WAAWjjB,IAEpFvc,KAAKuc,KAAO,SAAUA,GAAQ,OAAOpM,EAAMuE,OAAOuC,WAAW0F,MAAMJ,KAAKA,IAExEvc,KAAK2c,MAAQ,WAAc,OAAOxM,EAAMuE,OAAOuC,WAAW0F,MAAMA,SAEhE3c,KAAKwrB,KAAO,SAAUqiB,GAAa,OAAO19B,EAAMuE,OAAOuC,WAAW0F,MAAM6O,KAAKqiB,IAE7E7tC,KAAKiQ,KAAO,SAAUwrB,EAAS1f,EAAS5b,GAAW,OAAOgQ,EAAMuE,OAAOuC,WAAW0F,MAAM1M,KAAKwrB,EAAS1f,EAAS5b,IAC/GH,KAAK6+B,eAAiB,IAAI,IAAenqB,GAyE7C,OAtEAi5B,EAAU9rC,UAAUua,OAAS,SAAU0xB,GACnC,IAAIphB,EAAO1sB,KAAK0U,OAAO0C,gBACnB02B,EACA9tC,KAAK6V,SAAW6W,EAAKjb,MAGrBib,EAAKjb,QAAUzR,KAAK6V,UAExB6W,EAAKjb,IAAIzR,KAAK6V,UAAU,IAY5B83B,EAAU9rC,UAAUpB,KAAO,SAAUstC,EAAY3/B,EAAQjO,GACrD,IAAI4U,EAAU5U,KAAaA,EAAQ4U,QACnC/U,KAAK0U,OAAOuC,WAAWxF,IAAIs8B,EAAWnmB,OAAOxZ,GAAU,IAAK2G,IAqBhE44B,EAAU9rC,UAAUmsC,KAAO,SAAUD,EAAY3/B,EAAQjO,GACrD,IAAIsR,EAAMs8B,EAAWnmB,OAAOxZ,GAC5B,GAAW,MAAPqD,EACA,OAAO,KACXtR,EAAUA,GAAW,CAAE8tC,UAAU,GACjC,IAAIpmC,EAAM7H,KAAK0U,OAAOuC,WAAW1L,OAC7B2iC,EAAUrmC,EAAIwN,YAKlB,GAJK64B,GAAmB,OAARz8B,IACZA,EAAM,IAAM5J,EAAI8kC,aAAel7B,GAEnCA,EA1GR,SAAwBA,EAAKy8B,EAASD,EAAUx4B,GAC5C,MAAiB,MAAbA,EACOhE,EACPy8B,GACO,QAAqBz4B,GAAYhE,EACxCw8B,EACOx4B,EAAS3T,MAAM,GAAK2P,EACxBA,EAmGG08B,CAAe18B,EAAKy8B,EAAS/tC,EAAQ8tC,SAAUpmC,EAAI4N,aACpDtV,EAAQ8tC,WAAax8B,EACtB,OAAOA,EAEX,IAAI28B,GAASF,GAAWz8B,EAAM,IAAM,GAChC48B,EAAUxmC,EAAIilC,OACdA,EAAoB,KAAZuB,GAA8B,MAAZA,EAAkB,GAAK,IAAMA,EAC3D,MAAO,CAACxmC,EAAIklC,WAAY,MAAOllC,EAAIglC,OAAQC,EAAMsB,EAAO38B,GAAKwB,KAAK,KAEtEM,OAAO+6B,eAAeX,EAAU9rC,UAAW,oBAAqB,CAE5D6O,IAAK,WACD,OAAO1Q,KAAK0U,OAAOuC,WAAWoF,mBAElCkyB,YAAY,EACZC,cAAc,IAEXb,EA1GmB,2aCJ1Bc,EAAgC,WAChC,SAASA,EAAe/5B,GACpB1U,KAAK0U,OAASA,EAiKlB,OA/JA+5B,EAAe5sC,UAAUwF,QAAU,SAAU2J,GACzC,OAAOhR,KAAK0U,OAAOE,kBAAkBvN,QAAQ2J,IAEjDy9B,EAAe5sC,UAAUL,OAAS,SAAUsb,EAAMf,GAC9C,IAAI5L,EAAQnQ,KACRy9B,EAAU,YAAqBD,EAAqB,uBACpDkR,GAAW,QAAQ,CACnB,CAAC,KAAU,SAAUC,GAAS,OAAOD,EAASv+B,EAAM9I,QAAQsnC,MAC5D,EAAC,IAAAz1B,IAAG,KAAa,SAAUy1B,GAAS,OAAOx+B,EAAMy+B,eAAeD,EAAO5yB,KACvE,EAAC,IAAAkI,IAAGwZ,EAASD,GAAqB,SAAUmR,GAAS,OAAOx+B,EAAM0+B,UAAUF,EAAOx+B,EAAMuE,UACzF,EAAC,IAAAwE,IAAG/P,QAAS,SAAUwlC,GAAS,OAAOx+B,EAAM2+B,WAAWH,EAAO5yB,KAC/D,CAAC,KAAY,SAAU4yB,GAAS,OAAO,IAAIlyB,EAAYkyB,EAAO5yB,OAE9DQ,EAAOmyB,EAAS5xB,GACpB,IAAKP,EACD,MAAM,IAAI9J,MAAM,4BACpB,OAAO8J,GAsCXkyB,EAAe5sC,UAAU+sC,eAAiB,SAAUb,EAAYhyB,GAC5D,IAAIgzB,EAAWhzB,GACX,QAASA,KACTA,EAAU/b,KAAK0U,OAAOE,kBAAkBvN,QAAQ0U,KAChD,IAAA7C,IAAG,IAAH,CAAe6C,KACfgzB,EAAW,SAAU/yB,GAAS,OAAOD,EAAQ6L,OAAO5L,KAiBxD,IAAIgzB,EAAU,CAAEjB,WAAYA,EAAYkB,cAPxC,SAAuB7gC,GACnB,IAAI8gC,EAAWnB,EAAW1a,aAAa/pB,QAAO,SAAU0F,GAAS,OAAOA,EAAM4f,cAC9E,OAAKsgB,EAAS9/B,OAEA8/B,EAAS5lC,QAAO,SAAU0F,GAAS,OAAOZ,EAAOY,EAAM3D,OACtD+D,OAAS8/B,EAAS9/B,OAFtB,MAIuDF,KAAM,cAC5E,OAAO,QAAO,IAAIuN,GAjBlB,SAA2BhL,GACvB,IAAIrD,EAAS2/B,EAAWtkC,KAAKgI,EAAItJ,KAAMsJ,EAAI09B,OAAQ19B,EAAIqgB,MACvD,OAAOic,EAAWre,UAAUthB,IAAWA,IAeM2gC,GAAWC,IAahEP,EAAe5sC,UAAUgtC,UAAY,SAAUO,EAAa16B,GACxD,IAAIjH,EAAQ,uBAA+B2hC,GAAeA,EAAYp7B,UAAYo7B,EAe9EJ,EAAU,CAAEvhC,MAAOA,EAAOyB,KAAM,SACpC,OAAO,QAAOlP,KAAK4uC,eAAenhC,EAAMgE,KAR1B,SAAUuK,GACpB,IAAIvD,EAAS/D,EAAOmC,aAChByB,EAAU5D,EAAO4D,QACjBG,EAAOu1B,KAAKvgC,EAAOuO,KAAWvD,EAAOu1B,KAAK11B,EAAQwN,QAASxN,EAAQlK,SACnEqK,EAAO42B,aAAa5hC,EAAOuO,EAAO,CAAEoD,SAAS,EAAML,OAAQ,WAIZiwB,IAkC3DP,EAAe5sC,UAAUitC,WAAa,SAAU7rB,EAAQlH,GACpD,GAAIkH,EAAOnF,QAAUmF,EAAOqsB,OACxB,MAAM,IAAI78B,MAAM,4CAMpB,IAIIs8B,GAAW,QAAShzB,GAJJ,SAAUC,GAE1B,OAAOD,EAAQhH,QAAQ,kBAAkB,SAAUC,EAAG8H,GAAQ,OAAOd,EAAe,MAATc,EAAe,EAAIyyB,OAAOzyB,QAEtDf,EAE/CizB,EAAU,CAAE/rB,OAAQA,EAAQ/T,KAAM,UACtC,OAAO,QAAO,IAAIuN,GAFU,SAAUhL,GAAO,OAAOwR,EAAOxZ,KAAKgI,EAAItJ,QAEf4mC,GAAWC,IAEpEP,EAAee,UAAY,SAAUv1B,GAAO,OAAOA,GAAO,CAAC,OAAQ,QAAS,WAAWkpB,OAAM,SAAUt9B,GAAO,OAAO,QAAUoU,EAAIpU,QAC5H4oC,EAnKwB,GA4K/BhyB,EACA,SAAqBT,EAAOD,GACxB,IAAI5L,EAAQnQ,KACZA,KAAKgc,MAAQA,EACbhc,KAAKkP,KAAO,MACZlP,KAAKivC,cAAgB,SAAUjzB,GAAS,OAAO,EAAI7L,EAAMgL,KACzDnb,KAAK+b,QAAUA,GAAW,2GCnK9B0zB,sPAaJ,SAASC,EAAa3zB,GAClB,MAAK,QAAWA,KAAa,QAASA,KAAa,IAAA7C,IAAG,EAAA2mB,YAAH,CAAgB9jB,IAAa,EAAA8jB,YAAA,MAAkB9jB,IAC9F,MAAM,IAAItJ,MAAM,4FAEpB,OAAO,QAAWsJ,GAAWA,GAAU,QAAIA,GAhB/C0zB,EAAoB,SAAUhyB,EAAGmB,GAC7B,IAAI+wB,EA5BW,SAAUlyB,EAAGmB,GAAK,OAAQA,EAAExX,UAAY,IAAMqW,EAAErW,UAAY,GA4BjEwoC,CAAanyB,EAAGmB,GAC1B,OAAY,IAAR+wB,GAGQ,KADZA,EA9BW,SAAUlyB,EAAGmB,GACxB,IAAIixB,EAAU,CAAE7E,MAAO,EAAG8E,WAAY,EAAGC,OAAQ,EAAGC,IAAK,EAAGC,MAAO,GACnE,OAAQJ,EAAQpyB,EAAEvO,OAAS,IAAM2gC,EAAQjxB,EAAE1P,OAAS,GA4B9CghC,CAASzyB,EAAGmB,KAIN,KADZ+wB,EA7BiB,SAAUlyB,EAAGmB,GAC9B,OAAQnB,EAAEswB,YAAenvB,EAAEmvB,WAAiB,YAAmBtwB,EAAEswB,WAAYnvB,EAAEmvB,YAAvC,EA4BlCoC,CAAe1yB,EAAGmB,IAJb+wB,EAtBF,SAAUlyB,EAAGmB,GAEtB,IAAIwxB,EAAmB,CAAEpF,OAAO,EAAM8E,YAAY,GAElD,OADYM,EAAiB3yB,EAAEvO,OAASkhC,EAAiBxxB,EAAE1P,MAC5C,GAAKuO,EAAEtC,KAAO,IAAMyD,EAAEzD,KAAO,GAyBrCk1B,CAAO5yB,EAAGmB,IAkBrB,IAAI0xB,EAA0B,WAE1B,SAASA,EAA0B57B,GAC/B1U,KAAK0U,OAASA,EACG1U,KAAKuwC,QAAUd,EACfzvC,KAAKwwC,OAAS,GACdxwC,KAAKywC,IAAM,EAC5BzwC,KAAK6+B,eAAiB,IAAI,IAAenqB,GA8Q7C,OA3QA47B,EAASzuC,UAAUqT,QAAU,SAAUR,GACnC1U,KAAKwwC,OAAS,UACPxwC,KAAK0wC,cAqChBJ,EAASzuC,UAAU0F,QAAU,SAAUwU,GACnC,IAAI40B,EAAYjB,EAAa3zB,GAI7B/b,KAAKuc,KAAKvc,KAAK6+B,eAAer9B,QAHhB,SAAUosC,EAAUl5B,GAC9B,OAAmD,IAA5CA,EAAO4D,QAAQyT,kBAAkBnG,UAAkB,QAAQnc,KAAKmkC,EAASzlC,QAEtCwoC,KA6ClDL,EAASzuC,UAAU+a,UAAY,SAAUb,GACrC,IAAI40B,EAAYjB,EAAa3zB,GAC7B/b,KAAK0wC,aAAe1wC,KAAK6+B,eAAer9B,QAAO,SAAI,GAAOmvC,GAC1D3wC,KAAK4wC,SAAU,GAOnBN,EAASzuC,UAAU29B,WAAa,SAAUjjB,IACtC,QAAWvc,KAAKwwC,OAAQj0B,IAc5B+zB,EAASzuC,UAAU0a,KAAO,SAAUA,GAChC,IAAIpM,EAAQnQ,KACZ,IAAK,cAAyBuc,GAC1B,MAAM,IAAI9J,MAAM,gBAKpB,OAJA8J,EAAKpB,IAAMnb,KAAKywC,MAChBl0B,EAAKnV,SAAWmV,EAAKnV,UAAY,EACjCpH,KAAKwwC,OAAO/vC,KAAK8b,GACjBvc,KAAK4wC,SAAU,EACR,WAAc,OAAOzgC,EAAMqvB,WAAWjjB,KAOjD+zB,EAASzuC,UAAU8a,MAAQ,WAEvB,OADA3c,KAAK6wC,eACE7wC,KAAKwwC,OAAOpuC,OAAOpC,KAAK0wC,aAAe,CAAC1wC,KAAK0wC,cAAgB,KA4CxEJ,EAASzuC,UAAU2pB,KAAO,SAAUqiB,GAIhC,IAHA,IAAIiD,EAAS9wC,KAAK+wC,WAAW/wC,KAAKwwC,OAASxwC,KAAKuwC,QAAU1C,GAAa7tC,KAAKuwC,SAExES,EAAQ,EACH3zB,EAAI,EAAGA,EAAIyzB,EAAO1hC,OAAQiO,IAC/ByzB,EAAOzzB,GAAG4zB,OAASD,EACf3zB,EAAIyzB,EAAO1hC,OAAS,GAAgD,IAA3CpP,KAAKuwC,QAAQO,EAAOzzB,GAAIyzB,EAAOzzB,EAAI,KAC5D2zB,IAGRhxC,KAAKwwC,OAASM,EACd9wC,KAAK4wC,SAAU,GAGnBN,EAASzuC,UAAUgvC,aAAe,WAC9B7wC,KAAK4wC,SAAW5wC,KAAKwrB,QAGzB8kB,EAASzuC,UAAUkvC,WAAa,SAAUrxB,EAAKmuB,GAC3C,IAAIqD,EAAexxB,EAAI/Q,KAAI,SAAUuS,EAAMjS,GAAO,MAAO,CAAGiS,KAAMA,EAAMjS,IAAKA,MAK7E,OAJAiiC,EAAa1lB,MAAK,SAAU2lB,EAAUC,GAClC,IAAIC,EAAUxD,EAAUsD,EAASjwB,KAAMkwB,EAASlwB,MAChD,OAAmB,IAAZmwB,EAAgBF,EAASliC,IAAMmiC,EAASniC,IAAMoiC,KAElDH,EAAaviC,KAAI,SAAU2iC,GAAW,OAAOA,EAAQpwB,SA6DhEovB,EAASzuC,UAAUoO,KAAO,SAAUwrB,EAAS1f,EAAS5b,GAClD,IAAIoc,EAAOvc,KAAK6+B,eAAer9B,OAAOi6B,EAAS1f,GAI/C,OAHI,QAAU5b,GAAWA,EAAQiH,YAC7BmV,EAAKnV,SAAWjH,EAAQiH,UAC5BpH,KAAKuc,KAAKA,GACHA,GAEJ+zB,EArRkB,8VCpDzBiB,EAA4B,WAE5B,SAASA,EAA4B78B,GACjC,IAAIvE,EAAQnQ,KACZA,KAAK0U,OAASA,EACG1U,KAAKqc,mBAAoB,EAM1Crc,KAAK2c,MAAQ,IAAI,IAAS3c,KAAK0U,QAM/B1U,KAAKuL,OAAS,IAAI,IAAUvL,KAAK0U,QAsDjC1U,KAAKyR,IAAM,SAAU+/B,EAAQz8B,EAAStH,GAClC,OAAO0C,EAAMuE,OAAO0C,gBAAgB3F,IAAI+/B,EAAQz8B,EAAStH,IAS7DzN,KAAKmI,KAAO,WAAc,OAAOgI,EAAMuE,OAAO0C,gBAAgBjP,QAQ9DnI,KAAKmvC,OAAS,WAAc,OAAOh/B,EAAMuE,OAAO0C,gBAAgB+3B,UAQhEnvC,KAAK8xB,KAAO,WAAc,OAAO3hB,EAAMuE,OAAO0C,gBAAgB0a,QAgB9D9xB,KAAKmV,SAAW,SAAU3U,GAAY,OAAO2P,EAAMuE,OAAO0C,gBAAgBjC,SAAS3U,IA4IvF,OAzIA+wC,EAAW1vC,UAAUqT,QAAU,WAC3BlV,KAAKsc,QAAO,GACZtc,KAAK2c,MAAMzH,WAOfq8B,EAAW1vC,UAAU8qB,MAAQ,WACzB,MAAO,CAAExkB,KAAMnI,KAAKmI,OAAQgnC,OAAQnvC,KAAKmvC,SAAUrd,KAAM9xB,KAAK8xB,SAsBlEyf,EAAW1vC,UAAU+qB,KAAO,SAAU1W,GAClC,IAAIA,IAAOA,EAAI5T,iBAAf,CAEA,IAAI+oB,EAAKrrB,KAAK0U,OAAQuC,EAAaoU,EAAGpU,WAAYJ,EAAewU,EAAGxU,aAChEpF,EAAM,CAAEtJ,KAAM8O,EAAW9O,OAAQgnC,OAAQl4B,EAAWk4B,SAAUrd,KAAM7a,EAAW6a,QAC/E2f,EAAOzxC,KAAKgc,MAAMvK,IACJ,QAAQ,CACtB,CAAC,KAAU,SAAU+/B,GAAU,OAAOv6B,EAAWxF,IAAI+/B,GAAQ,KAC7D,CAAC,EAAA3R,YAAA,MAAmB,SAAU3sB,GAAO,OAAO2D,EAAa66B,GAAGx+B,EAAIzF,MAAOyF,EAAI9E,OAAQ8E,EAAI/S,WACvF,EAAC,IAAA+Y,IAAG,EAAA2mB,aAAc,SAAUx5B,GAAU,OAAOwQ,EAAa66B,GAAGrrC,EAAOoH,QAASpH,EAAO+H,SAAU/H,EAAOlG,cAEzGwxC,CAAYF,GAAQA,EAAKl1B,KAAKR,QAAQ01B,EAAKz1B,MAAOvK,EAAKzR,KAAK0U,WAwBhE68B,EAAW1vC,UAAUya,OAAS,SAAUhH,GACpC,IAAInF,EAAQnQ,KACZ,IAAgB,IAAZsV,EAKA,OAAQtV,KAAK4xC,iBACT5xC,KAAK4xC,kBAAoB5xC,KAAK0U,OAAOuC,WAAW9B,UAAS,SAAUe,GAAO,OAAO/F,EAAMyc,KAAK1W,MALhGlW,KAAK4xC,kBAAoB5xC,KAAK4xC,0BACvB5xC,KAAK4xC,kBA+BpBL,EAAW1vC,UAAUkb,eAAiB,SAAU9Q,QAC9BkI,IAAVlI,IACAA,GAAQ,GACZjM,KAAKqc,kBAAoBpQ,GAQ7BslC,EAAW1vC,UAAUma,MAAQ,SAAUvK,GAEnCA,GAAM,QAAO,CAAEtJ,KAAM,GAAIgnC,OAAQ,GAAIrd,KAAM,IAAMrgB,GAYjD,IAXA,IAUIggC,EARsBl1B,EAClBP,EAHJW,EAAQ3c,KAAK2c,MAAMA,QAWdU,EAAI,EAAGA,EAAIV,EAAMvN,UAElBqiC,GAAQA,EAAKl1B,KAAK00B,SAAWt0B,EAAMU,GAAG4zB,QAFZ5zB,IAAK,CAInC,IAAIyI,QAZA9J,GAAAA,GADkBO,EAaEI,EAAMU,IAZbrB,MAAMvK,EALfzR,KAK0B0U,UAClB,CAAEsH,MAAOA,EAAOO,KAAMA,EAAMs1B,OAAQt1B,EAAK0yB,cAAcjzB,KAavEy1B,GAAQA,GAAS3rB,GAAWA,EAAQ+rB,OAASJ,EAAKI,OAAU/rB,EAAU2rB,EAE1E,OAAOA,GAEJF,EA7PoB,oZCJ3BO,EAAsC,WACtC,SAASA,EAAqBp9B,EAAQq9B,GAClC,IAAI5hC,EAAQnQ,KACZA,KAAK+xC,gBAAkBA,EACvB/xC,KAAKgyC,WAAa,GAClBhyC,KAAKiyC,UAAY,SAAU/7B,GAAO,OAAO/F,EAAM6hC,WAAWjxC,SAAQ,SAAU+J,GAAM,OAAOA,EAAGoL,OAC5FlW,KAAK8xB,KAAO,WAAc,OAAO,QAAS3hB,EAAM+hC,QAAQpgB,MACxD9xB,KAAKmI,KAAO,WAAc,OAAO,QAASgI,EAAM+hC,QAAQ/pC,MACxDnI,KAAKmvC,OAAS,WAAc,OAAO,SAAU,QAASh/B,EAAM+hC,QAAQ/C,SACpEnvC,KAAKmyC,UAAY,cACjBnyC,KAAKoyC,SAAW,aAoBpB,OAlBAN,EAAqBjwC,UAAU4P,IAAM,SAAUA,EAAKsD,GAQhD,YAPgB,IAAZA,IAAsBA,GAAU,IAChC,QAAUtD,IAAQA,IAAQzR,KAAKkyC,SAC/BlyC,KAAKmpB,KAAK,KAAM,KAAM1X,EAAKsD,GACvB/U,KAAK+xC,iBACL/xC,KAAKgyC,WAAWjxC,SAAQ,SAAU+J,GAAM,OAAOA,EAAG,CAAE2G,IAAKA,SAG1D,QAASzR,OAEpB8xC,EAAqBjwC,UAAUsT,SAAW,SAAUrK,GAChD,IAAIqF,EAAQnQ,KAEZ,OADAA,KAAKgyC,WAAWvxC,KAAKqK,GACd,WAAc,OAAO,QAAWqF,EAAM6hC,WAAYlnC,KAE7DgnC,EAAqBjwC,UAAUqT,QAAU,SAAUR,IAC/C,QAAS1U,KAAKgyC,aAEXF,EA9B8B,2LCDrCO,EAAuC,WACvC,SAASA,EAAsB39B,EAAQ49B,QAClB,IAAbA,IAAuBA,GAAW,GACtCtyC,KAAKsyC,SAAWA,EAChBtyC,KAAK0V,eAAYvB,EACjBnU,KAAKuyC,YAAc,GAmCvB,OAjCAF,EAAsBxwC,UAAUirC,KAAO,WACnC,OAAIj3B,SAASi3B,KACFyC,OAAO15B,SAASi3B,MAEA,UAApB9sC,KAAK+sC,WAAyB,IAAM,IAE/CsF,EAAsBxwC,UAAUkrC,SAAW,WACvC,OAAOl3B,SAASk3B,SAASh4B,QAAQ,KAAM,KAE3Cs9B,EAAsBxwC,UAAUgrC,KAAO,WACnC,OAAOh3B,SAAS28B,UAEpBH,EAAsBxwC,UAAUwT,UAAY,WACxC,OAAOrV,KAAKsyC,UAEhBD,EAAsBxwC,UAAU8qC,WAAa,SAAUC,GACnD,OAAO,QAAUA,GAAc5sC,KAAKuyC,YAAc3F,EAAa5sC,KAAKuyC,aAExEF,EAAsBxwC,UAAU4T,SAAW,SAAUu4B,GAKjD,OAJI,QAAUA,KACVhuC,KAAK0V,UAAYs4B,IACjB,QAAYhuC,KAAK0V,aACjB1V,KAAK0V,UAAY1V,KAAKyyC,eACnBzyC,KAAK0V,WAEhB28B,EAAsBxwC,UAAU4wC,YAAc,WAC1C,IAAIC,EAAUrsB,SAASssB,qBAAqB,QAAQ,GACpD,OAAID,GAAWA,EAAQ1E,KACZ0E,EAAQ1E,KAAKj5B,QAAQ,uBAAwB,IAEjD/U,KAAKsyC,SAAW,IAAMz8B,SAAS/B,UAAY,KAEtDu+B,EAAsBxwC,UAAUqT,QAAU,aACnCm9B,EAxC+B,uHCDlCO,2IADJC,GACID,EAAgB,SAAUzZ,EAAGva,GAI7B,OAHAg0B,EAAgBr/B,OAAOu/B,gBAClB,CAAEC,UAAW,cAAgBnxC,OAAS,SAAUu3B,EAAGva,GAAKua,EAAE4Z,UAAYn0B,IACvE,SAAUua,EAAGva,GAAK,IAAK,IAAIic,KAAKjc,EAAOA,EAAElc,eAAem4B,KAAI1B,EAAE0B,GAAKjc,EAAEic,MACpD1B,EAAGva,IAErB,SAAUua,EAAGva,GAEhB,SAASo0B,IAAOhzC,KAAKokB,YAAc+U,EADnCyZ,EAAczZ,EAAGva,GAEjBua,EAAEt3B,UAAkB,OAAN+c,EAAarL,OAAO/R,OAAOod,IAAMo0B,EAAGnxC,UAAY+c,EAAE/c,UAAW,IAAImxC,KAMnFC,EAAqC,SAAUC,GAE/C,SAASD,EAAoBv+B,GACzB,IAAIvE,EAAQ+iC,EAAOnxC,KAAK/B,KAAM0U,GAAQ,IAAU1U,KAEhD,OADA,sBAAsB,aAAcmQ,EAAM8hC,WAAW,GAC9C9hC,EAYX,OAhBA0iC,EAAUI,EAAqBC,GAM/BD,EAAoBpxC,UAAUqwC,KAAO,WACjC,OAAO,QAAYlyC,KAAKmyC,UAAUrgB,OAEtCmhB,EAAoBpxC,UAAUsnB,KAAO,SAAU1b,EAAO0lC,EAAO1hC,EAAKsD,GAC9D/U,KAAKmyC,UAAUrgB,KAAOrgB,GAE1BwhC,EAAoBpxC,UAAUqT,QAAU,SAAUR,GAC9Cw+B,EAAOrxC,UAAUqT,QAAQnT,KAAK/B,KAAM0U,GACpC,yBAAyB,aAAc1U,KAAKiyC,YAEzCgB,EAjB6B,CAkBtC,6cC/BEG,EACA,WACI,IAAIjjC,EAAQnQ,KACZA,KAAKkV,QAAU,KACflV,KAAK0V,UAAY,GACjB1V,KAAKqzC,MAAQ,GACbrzC,KAAKszC,UAAY,OACjBtzC,KAAKuzC,MAAQ,YACbvzC,KAAKuyC,YAAc,GACnBvyC,KAAK8sC,KAAO,WAAc,OAAO38B,EAAMkjC,OACvCrzC,KAAK+sC,SAAW,WAAc,OAAO58B,EAAMmjC,WAC3CtzC,KAAK6sC,KAAO,WAAc,OAAO18B,EAAMojC,OACvCvzC,KAAKyV,SAAW,WAAc,OAAOtF,EAAMuF,WAC3C1V,KAAKqV,UAAY,WAAc,OAAO,GACtCrV,KAAK2sC,WAAa,SAAU6G,GAAU,OAAQ,QAAUA,GAAWrjC,EAAMoiC,YAAciB,EAAUrjC,EAAMoiC,oIChBvGK,8EADJC,GACID,EAAgB,SAAUzZ,EAAGva,GAI7B,OAHAg0B,EAAgBr/B,OAAOu/B,gBAClB,CAAEC,UAAW,cAAgBnxC,OAAS,SAAUu3B,EAAGva,GAAKua,EAAE4Z,UAAYn0B,IACvE,SAAUua,EAAGva,GAAK,IAAK,IAAIic,KAAKjc,EAAOA,EAAElc,eAAem4B,KAAI1B,EAAE0B,GAAKjc,EAAEic,MACpD1B,EAAGva,IAErB,SAAUua,EAAGva,GAEhB,SAASo0B,IAAOhzC,KAAKokB,YAAc+U,EADnCyZ,EAAczZ,EAAGva,GAEjBua,EAAEt3B,UAAkB,OAAN+c,EAAarL,OAAO/R,OAAOod,IAAMo0B,EAAGnxC,UAAY+c,EAAE/c,UAAW,IAAImxC,KAKnFS,EAAuC,SAAUP,GAEjD,SAASO,EAAsB/+B,GAC3B,OAAOw+B,EAAOnxC,KAAK/B,KAAM0U,GAAQ,IAAS1U,KAQ9C,OAVA6yC,EAAUY,EAAuBP,GAIjCO,EAAsB5xC,UAAUqwC,KAAO,WACnC,OAAOlyC,KAAK0zC,MAEhBD,EAAsB5xC,UAAUsnB,KAAO,SAAU1b,EAAO0lC,EAAO1hC,EAAKsD,GAChE/U,KAAK0zC,KAAOjiC,GAETgiC,EAX+B,CAYxC,0tBCZ8B,QAAsB,4BAA4B,EAAO,IAAqB,MAEzE,QAAsB,6BAA6B,EAAM,IAA0B,MAEtF,QAAsB,0BAA0B,EAAO,IAAuB,8HClBxGb,2IADJC,GACID,EAAgB,SAAUzZ,EAAGva,GAI7B,OAHAg0B,EAAgBr/B,OAAOu/B,gBAClB,CAAEC,UAAW,cAAgBnxC,OAAS,SAAUu3B,EAAGva,GAAKua,EAAE4Z,UAAYn0B,IACvE,SAAUua,EAAGva,GAAK,IAAK,IAAIic,KAAKjc,EAAOA,EAAElc,eAAem4B,KAAI1B,EAAE0B,GAAKjc,EAAEic,MACpD1B,EAAGva,IAErB,SAAUua,EAAGva,GAEhB,SAASo0B,IAAOhzC,KAAKokB,YAAc+U,EADnCyZ,EAAczZ,EAAGva,GAEjBua,EAAEt3B,UAAkB,OAAN+c,EAAarL,OAAO/R,OAAOod,IAAMo0B,EAAGnxC,UAAY+c,EAAE/c,UAAW,IAAImxC,KAUnFW,EAA0C,SAAUT,GAEpD,SAASS,EAAyBj/B,GAC9B,IAAIvE,EAAQ+iC,EAAOnxC,KAAK/B,KAAM0U,GAAQ,IAAS1U,KAG/C,OAFAmQ,EAAMyjC,QAAUl/B,EAAOuC,WAAW1L,OAClC,sBAAsB,WAAY4E,EAAM8hC,WAAW,GAC5C9hC,EA8CX,OAnDA0iC,EAAUc,EAA0BT,GAuBpCS,EAAyB9xC,UAAUgyC,eAAiB,WAChD,OAAO,QAAqB7zC,KAAK4zC,QAAQn+B,aAE7Ck+B,EAAyB9xC,UAAUqwC,KAAO,WACtC,IAAI7mB,EAAKrrB,KAAKmyC,UAAWr+B,EAAWuX,EAAGvX,SAAUge,EAAOzG,EAAGyG,KAAMqd,EAAS9jB,EAAG8jB,OAC7EA,GAAS,QAAWA,GAAQ,GAC5Brd,GAAO,QAAUA,GAAM,GACvB,IAAIgiB,EAAa9zC,KAAK6zC,iBAClBE,EAAqBjgC,IAAa9T,KAAK4zC,QAAQn+B,WAC/Cu+B,EAAiBlgC,EAASiT,OAAO,EAAG+sB,EAAW1kC,UAAY0kC,EAE/D,OADAhgC,EAAWigC,EAAqB,IAAMC,EAAiBlgC,EAASmmB,UAAU6Z,EAAW1kC,QAAU0E,IAC5Eq7B,EAAS,IAAMA,EAAS,KAAOrd,EAAO,IAAMA,EAAO,KAE1E6hB,EAAyB9xC,UAAUsnB,KAAO,SAAU1b,EAAO0lC,EAAO1hC,EAAKsD,GACnE,IAAI++B,EAAa9zC,KAAK6zC,iBAClBzF,EAAQ38B,GAAkB,MAAXA,EAAI,GAAa,IAAM,GACtCwiC,EAAkB,KAARxiC,GAAsB,MAARA,EAAczR,KAAK4zC,QAAQn+B,WAAaq+B,EAAa1F,EAAQ38B,EACrFsD,EACA/U,KAAKoyC,SAAS8B,aAAazmC,EAAO0lC,EAAOc,GAGzCj0C,KAAKoyC,SAAS+B,UAAU1mC,EAAO0lC,EAAOc,IAG9CN,EAAyB9xC,UAAUqT,QAAU,SAAUR,GACnDw+B,EAAOrxC,UAAUqT,QAAQnT,KAAK/B,KAAM0U,GACpC,yBAAyB,WAAY1U,KAAKiyC,YAEvC0B,EApDkC,CAqD3C,qKCzDS5sC,EAAK,CAEZkJ,KAAM,SAAUjM,GAAO,OAAO,IAAIowC,SAAQ,SAAUznC,EAAS0nC,GAAU,OAAO1nC,EAAQ3I,OAEtFqwC,OAAQ,SAAUrwC,GACd,OAAO,IAAIowC,SAAQ,SAAUznC,EAAS0nC,GAClCA,EAAOrwC,OAIfiI,MAAO,WACH,IAAIqoC,EAAW,GAKf,OAJAA,EAAS7wC,QAAU,IAAI2wC,SAAQ,SAAUznC,EAAS0nC,GAC9CC,EAAS3nC,QAAUA,EACnB2nC,EAASD,OAASA,KAEfC,GAGX74B,IAAK,SAAUF,GACX,IAAI,QAAQA,GACR,OAAO64B,QAAQ34B,IAAIF,GAEvB,IAAI,QAASA,GAAW,CAGpB,IAAI0gB,EAAQ1oB,OAAOC,KAAK+H,GAAU5M,KAAI,SAAU9I,GAAO,OAAO0V,EAAS1V,GAAKkF,MAAK,SAAU/G,GAAO,MAAO,CAAG6B,IAAKA,EAAK7B,IAAKA,SAE3H,OAAO+C,EAAG0U,IAAIwgB,GAAOlxB,MAAK,SAAUiW,GAChC,OAAOA,EAAOpS,QAAO,SAAUsL,EAAKzG,GAEhC,OADAyG,EAAIzG,EAAM5N,KAAO4N,EAAMzP,IAChBkW,IACR,yMC/CRq6B,EAAmB,SAAUC,EAAOnpB,GAC3C,IAAIxlB,EAAMwlB,EAAG,GAAIrnB,EAAMqnB,EAAG,GAU1B,OATKmpB,EAAM9xC,eAAemD,IAGjB,QAAQ2uC,EAAM3uC,IACnB2uC,EAAM3uC,GAAKpF,KAAKuD,GAGhBwwC,EAAM3uC,GAAO,CAAC2uC,EAAM3uC,GAAM7B,GAN1BwwC,EAAM3uC,GAAO7B,EAQVwwC,GAEAC,EAAY,SAAUC,GAC7B,OAAOA,EAAY5xB,MAAM,KAAKxZ,OAAO,MAAUqF,IAAI,MAAYC,OAAO2lC,EAAkB,KAErF,SAASra,EAASzoB,GACrB,IAAIkjC,EAAgB,SAAUrlC,GAAK,OAAOA,GAAK,IAC3C+b,GAAK,QAAU5Z,GAAK9C,IAAIgmC,GAAgBC,EAAavpB,EAAG,GAAIyG,EAAOzG,EAAG,GACtEC,GAAK,QAAWspB,GAAYjmC,IAAIgmC,GACpC,MAAO,CAAExsC,KADkDmjB,EAAG,GACzC6jB,OADsD7jB,EAAG,GACzCwG,KAAMA,EAAMrgB,IAAKA,GAEnD,IAAIojC,EAAW,SAAUC,GAC5B,IAAI3sC,EAAO2sC,EAAI3sC,OACX4sC,EAAeD,EAAI3F,SACnBrd,EAAOgjB,EAAIhjB,OACXqd,EAAS57B,OAAOC,KAAKuhC,GACpBpmC,KAAI,SAAU9I,GACf,IAAImJ,EAAQ+lC,EAAalvC,GAEzB,QADW,QAAQmJ,GAASA,EAAQ,CAACA,IACzBL,KAAI,SAAU3K,GAAO,OAAO6B,EAAM,IAAM7B,QAEnD4K,OAAO,KAAS,IAChBqE,KAAK,KACV,OAAO9K,GAAQgnC,EAAS,IAAMA,EAAS,KAAOrd,EAAO,IAAMA,EAAO,KAE/D,SAASkjB,EAAsBxvC,EAAM0oC,EAAS+G,EAAcC,GAC/D,OAAO,SAAU98B,GACb,IAAIX,EAAWW,EAAShB,gBAAkB,IAAI69B,EAAa78B,GACvD+8B,EAAiB/8B,EAASf,eAAiB,IAAI69B,EAAmB98B,EAAU81B,GAKhF,MAAO,CAAE1oC,KAAMA,EAAMiS,QAASA,EAAS09B,cAAeA,EAAejgC,QAJrE,SAAiBR,GACbA,EAAOQ,QAAQuC,GACf/C,EAAOQ,QAAQigC,kaCvBvBr6B,EAA6B,WAE7B,SAASA,EAA6BpG,GAClC,IAAIvE,EAAQnQ,KACZA,KAAK0U,OAASA,EACG1U,KAAKo1C,SAAW,GAChBp1C,KAAKq1C,aAAe,GACpBr1C,KAAKs1C,qBAAuB,GAC5Bt1C,KAAKgyC,WAAa,GAEnChyC,KAAKgK,WAAa,CACdC,iBAAkBjK,KAAKiK,iBAAiB3G,KAAKtD,MAC7CgX,mBAAoBhX,KAAKgX,mBAAmB1T,KAAKtD,MACjDu1C,kBAAmB,SAAUlqC,GAAM,OAAO,QAAK8E,EAAMilC,UAAU,SAAUt7B,GAAQ,OAAO3J,EAAMuE,OAAOyG,IAAM,IAAMrB,EAAKzO,KAAOA,MAC7HmqC,mBAAoB,WAAc,OAAOrlC,EAAMilC,UAC/CK,mBAAoB,WAAc,OAAOtlC,EAAMklC,cAC/CK,QAAS,SAAUvX,GAEf,OADAhuB,EAAM6hC,WAAWvxC,KAAK09B,GACf,WAAc,OAAO,QAAWhuB,EAAM6hC,WAAY7T,MAwPrE,OAzOArjB,EAAY66B,sBAAwB,SAAU9kC,EAAS+kC,QAC/B,IAAhBA,IAA0BA,EAAc,IAI5C,IAAIC,EAAgBD,EAAY9yB,MAAM,KAClC9H,EAAa66B,EAAc,IAAM,WACjC36B,GAAsB,QAAS26B,EAAc,IAAMA,EAAc,GAAK,IAGtEC,EAAwB,wBAAwBrsC,KAAKuR,GAYzD,GAXI86B,IAEA56B,EAAsB46B,EAAsB,GAC5C96B,EAAa86B,EAAsB,IAEV,MAAzB96B,EAAWvV,OAAO,KAClBuV,EAAaA,EAAW+L,OAAO,GAC/B7L,EAAsB,IAGN,kBACFzR,KAAKyR,GAAsB,CACzC,IAAI66B,EAAc76B,EAAoB4H,MAAM,KAAKlU,QAAO,SAAUonC,EAAQ1mC,GAAK,OAAO0mC,EAAO57B,SAAWvJ,GACxGqK,EAAsB66B,EAAYvwC,SAEL,MAAxB0V,IACLA,EAAsBrK,EAAQrL,MAElC,MAAO,CAAEwV,WAAYA,EAAYE,oBAAqBA,IAG1DJ,EAAYjZ,UAAUoI,iBAAmB,SAAU4G,GAC/C,OAAQ7Q,KAAKi2C,aAAeplC,GAAW7Q,KAAKi2C,cAGhDn7B,EAAYjZ,UAAUmV,mBAAqB,SAAUk/B,EAAUh2C,GAC3DF,KAAKs1C,qBAAqBY,GAAYh2C,GAE1C4a,EAAYjZ,UAAU2yB,iBAAmB,SAAUrsB,EAAMozB,GACrD,IAAI4a,EAAan2C,KAAKs1C,qBAAqB/Z,EAAKnwB,OAChD,IAAK+qC,EACD,MAAM,IAAI1jC,MAAM,2DAA6D8oB,EAAKnwB,OACtF,IAAIgrC,EAAOD,EAAWhuC,EAAMozB,GAC5B,OAAO,QAAQ6a,GAAQA,EAAO,CAACA,IAUnCt7B,EAAYjZ,UAAUumC,qBAAuB,SAAU19B,GACnD,2BAA4B,cAAeA,IAC3C,QAAW1K,KAAKq1C,aAAc3qC,IAElCoQ,EAAYjZ,UAAUwmC,mBAAqB,SAAU39B,GACjD,2BAA4B,iBAAkBA,GAC9C1K,KAAKq1C,aAAa50C,KAAKiK,IAE3BoQ,EAAYjZ,UAAU+qB,KAAO,WACzB,IAAIzc,EAAQnQ,KACRq2C,EAAer2C,KAAKo1C,SAASzmC,KAAI,SAAU4c,GAAO,MAAO,CAACA,EAAIjgB,IAAKigB,MAAS3c,OAAO,KAAY,IASnG,SAAS0nC,EAAgB/qC,GAErB,IADA,IAAIsF,EAAUtF,EAAOxD,SAASgC,SAAUG,EAAQ,IACvCA,GAAS2G,EAAQuJ,QACtBvJ,EAAUA,EAAQuJ,OACtB,OAAOlQ,EAGX,IAAIqsC,GAAe,SAAM,SAAUC,EAASC,EAAQ1lB,EAAMC,GAAS,OAAOylB,GAAUD,EAAQzlB,GAAQylB,EAAQxlB,OAkBxG0lB,EAAe12C,KAAKo1C,SAAS5pB,KAAK+qB,GA9BtC,SAAqB9vC,GACjB,IAAIkwC,EAAa,SAAU9lC,GAAW,OAAQA,GAAWA,EAAQuJ,OAASu8B,EAAW9lC,EAAQuJ,QAAU,EAAI,GAC3G,OAAsC,IAA/B3T,EAAO6E,IAAIwX,MAAM,KAAK1T,OAAiBunC,EAAWlwC,EAAOkiB,mBA4BJ,IAAIha,KAjB3C,SAAUlI,GAC/B,IAAImwC,EAAkBzmC,EAAMklC,aAAa/rC,OAAOwR,EAAYoI,QAAQmzB,EAAc5vC,IAOlF,OANImwC,EAAgBxnC,OAAS,GAIzBwnC,EAAgBprB,KAAK+qB,EAAaD,GAAkB,IAEjD,CAAE7vC,OAAQA,EAAQiE,WAAYksC,EAAgB,OAUrDC,EAAqBH,EAAa/nC,KAAI,SAAU8E,GAAS,OAAOA,EAAM/I,cACtEosC,EAAwB92C,KAAKq1C,aAC5B/rC,QAAO,SAAUiC,GAAU,QAAQ,QAAQsrC,EAAoBtrC,MAC/DoD,KAAI,SAAUjE,GAAc,MAAO,CAAGjE,YAAQ0N,EAAWzJ,WAAYA,MAC1EgsC,EAAa31C,SAZS,SAAU0S,IAGkB,IAA1CtD,EAAMilC,SAASlnC,QAAQuF,EAAMhN,SAC7BgN,EAAMhN,OAAO+E,cAAciI,EAAM/I,eASzC,IAAIqsC,EAAYL,EAAat0C,OAAO00C,GACpC92C,KAAKgyC,WAAWjxC,SAAQ,SAAU+J,GAAM,OAAOA,EAAGisC,MAClD,mBAAoBA,IAiBxBj8B,EAAYjZ,UAAUgK,eAAiB,SAAUpF,GAC7C,iCAAkC,iBAAkBA,GACpD,IAAIuwC,EAAUh3C,KAAKo1C,SAMnB,OAJI4B,EAAQ1tC,QADY,SAAUiiB,GAAO,OAAOA,EAAIjgB,MAAQ7E,EAAO6E,KAAOigB,EAAIngB,QAAU3E,EAAO2E,SACzDgE,QAClC,iCAAkC,+BAAgC3I,GACtEuwC,EAAQv2C,KAAKgG,GACbzG,KAAK4sB,OACE,YAEU,IADHoqB,EAAQ9oC,QAAQzH,IAK1B,iCAAkC,mBAAoBA,IACtD,QAAWuwC,EAAX,CAAoBvwC,IAJhB,iCAAkC,uCAAwCA,KAYtFqU,EAAYjZ,UAAUo1C,UAAY,WAC9B,OAAOj3C,KAAKo1C,SAASzmC,KAAI,QAAK,SAOlCmM,EAAYjZ,UAAUq1C,OAAS,WAC3B,OAAOl3C,KAAKo1C,SAAS9rC,QAAO,QAAK,YAAYqF,KAAI,QAAK,UA2D1DmM,EAAYoI,QAAU,SAAUmzB,EAAc5vC,GAAU,OAAO,SAAUiE,GAErE,GAAIjE,EAAO2E,QAAUV,EAAW3C,SAASqD,MACrC,OAAO,EAEX,IAAI+8B,EAAKz9B,EAAW3C,SAChBovC,EAAahP,EAAGptB,YAAY+H,MAAM,KAClCs0B,EAAc3wC,EAAO6E,IAAIwX,MAAM,KAGnC,KAAK,QAAOq0B,EAAYC,EAAYt1C,MAAM,EAAIq1C,EAAW/nC,SACrD,OAAO,EAGX,IAAIioC,EAAY,EAAIF,EAAW/nC,aAAU+E,EACrCmjC,EAAoBF,EAAYt1C,MAAM,EAAGu1C,GAAWpkC,KAAK,KACzDskC,EAAgBlB,EAAaiB,GAAmB3uB,gBACpD,OAAOwf,EAAGltB,wBAA0Bs8B,GAAiBA,EAAc/xC,QAEhEsV,EA1QqB,wDCfhC,SAAUyL,EAAQ1mB,GAAU,aAyD5B,IAAI23C,EAAoB,gBAEpBC,EAAe53C,EAAQC,OAAO,SAAU,CAAC,OACrB43C,KAAK,CAAEC,eAAgB,UACvB53C,SAAS,SAkCjC,WACE,IAAIwL,EAAS,CACXqsC,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,cAAc,EACdC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,aAAa,EACbC,kBAAkB,GAgCpB,SAASC,EAAUzlC,EAAU0lC,EAAUC,EAAqBC,GAC1D,OAAO,SAAS31C,EAAOoe,EAAMpO,GAC3B,IAAIA,EAAKpQ,eAAe80C,GAAxB,CAEA,IAAIkB,EAAgB5lC,EAAKkd,WAAWuoB,IAChChtC,EAAOmtC,IAAmBC,EAAYz3B,EAAMs3B,IAAyB1lC,EAAK4lC,IAC5E51C,EAAMyB,OAAOuO,EAAKD,IAAW,SAAS+lC,GAEpCA,EAAUH,GAAUG,IAAYA,EAChC13B,EAAKpO,KAAKylC,EAAUK,QAb5B54C,KAAKuL,OAAS,SAASstC,GACrBttC,EAAS1L,EAAQiB,OAAOyK,EAAQstC,IAkElC74C,KAAKU,KAAO,WACV,MAAO,CACL6K,OAAQ,SAAS1F,GACf,OAAO0F,EAAO1F,IAEhBizC,YAAaR,OA5IfE,EAAsB,CAAC,SAAU,IAAK,QAAS,WAAY,SAAU,UAAW,WAEhFG,EAAc,SAASz3B,EAAM63B,GAC/B,IAAiD,IAA7CA,EAAc7qC,QAAQgT,EAAK,GAAG83B,UAChC,OAAO,GA8IXvB,EAAa50C,UAAU,SAAU,CAAC,QAAS,SAASo2C,GAClD,OAAOA,EAAMH,YAAY,SAAU,cAAe,IAAI,MAEvDj2C,UAAU,SAAU,CAAC,QAAS,SAASo2C,GACtC,OAAOA,EAAMH,YAAY,SAAU,cAAe,IAAI,MAEvDj2C,UAAU,UAAW,CAAC,QAAS,SAASo2C,GACvC,OAAOA,EAAMH,YAAY,UAAW,eAAgBN,GAAqB,MAE1E31C,UAAU,YAAa,CAAC,QAAS,SAASo2C,GACzC,OAAOA,EAAMH,YAAY,YAAa,eAAgBN,GAAqB,MAE5E31C,UAAU,aAAc,CAAC,QAAS,SAASo2C,GAC1C,OAAOA,EAAMH,YAAY,aAAc,gBAAiBN,GAAqB,MAE9E31C,UAAU,aAAc,CAAC,QAAS,SAASo2C,GAC1C,OAAOA,EAAMH,YAAY,aAAc,gBAAiBN,GAAqB,MAE9E31C,UAAU,UAAW,CAAC,QAAS,SAASo2C,GAEvC,SAASC,EAAiBpmC,EAAMqmC,EAAgBj4B,EAAMk4B,GACpD,OAAOH,EAAM1tC,OAAO4tC,KACjBj4B,EAAKpO,KAAKA,KACVsmC,IAAsBT,EAAYz3B,EAAMs3B,MAClB,WAAtBt3B,EAAKpO,KAAK,SAA6C,UAArBoO,EAAK,GAAG83B,UAG/C,SAASK,EAAiBC,EAAMp4B,GAI9B,OAAQA,EAAKpO,KAAK,SAAYoO,EAAKpO,KAAK,UAAYwmC,IAAUX,EAAYz3B,EAAMs3B,GAYlF,MAAO,CACLrxC,SAAU,IACVxB,QAAS,UACTyB,SAAU,IACVC,QAAS,SAAS6Z,EAAMpO,GACtB,IAAIA,EAAKpQ,eAAe80C,GAAxB,CAEA,IAAI+B,EAhBR,SAAkBzmC,EAAMoO,GACtB,IAAIhS,EAAO4D,EAAK5D,KACZoqC,EAAOxmC,EAAKwmC,KAEhB,MAA2B,cAAlBpqC,GAAQoqC,IAAiC,qBAATA,EAA+B,WAC7C,WAAlBpqC,GAAQoqC,IAAiC,kBAATA,EAA4B,QACpD,UAATpqC,GAA0C,gBAAToqC,GAAmC,WAATA,EAAqB,QAAU,GAUpFE,CAAS1mC,GAErB,MAAO,CACL2mC,KAAM,SAAS32C,EAAOoe,EAAMpO,EAAM4mC,GAChC,IAAIC,EAAgBT,EAAiB,WAAY,WAAYh4B,GAAM,GAEnE,SAAS04B,IACP,OAAOF,EAAQG,YAcjB,OAAQN,GACN,IAAK,QACL,IAAK,WACCF,EAAiBE,EAAOr4B,IAC1BA,EAAKpO,KAAK,OAAQymC,GAEhBL,EAAiB,eAAgB,cAAeh4B,GAAM,IACxDpe,EAAMyB,OAAOq1C,EAAiC,UAAVL,EAlB1C,SAA0BO,GAGxB,IAAIlB,EAAW9lC,EAAKtO,OAASk1C,EAAQK,WACrC74B,EAAKpO,KAAK,eAAgB8lC,IAG5B,WACE13B,EAAKpO,KAAK,gBAAiB4mC,EAAQM,SAASN,EAAQK,eAa9CJ,GACFz4B,EAAKpO,KAAK,WAAY,GAExB,MACF,IAAK,QAIH,GAHIumC,EAAiBE,EAAOr4B,IAC1BA,EAAKpO,KAAK,OAAQ,UAEhBmmC,EAAM1tC,OAAO,aAAc,CAC7B,IAAI0uC,GAAqB/4B,EAAKpO,KAAK,mBAC9BA,EAAKpQ,eAAe,QAAUoQ,EAAKpQ,eAAe,UACnDw3C,GAAqBh5B,EAAKpO,KAAK,mBAC9BA,EAAKpQ,eAAe,QAAUoQ,EAAKpQ,eAAe,UACnDy3C,GAAqBj5B,EAAKpO,KAAK,iBAE/BmnC,GACFnnC,EAAKsnC,SAAS,OAAO,SAAgCN,GACnD54B,EAAKpO,KAAK,gBAAiBgnC,MAG3BI,GACFpnC,EAAKsnC,SAAS,OAAO,SAAgCN,GACnD54B,EAAKpO,KAAK,gBAAiBgnC,MAG3BK,GACFr3C,EAAMyB,OAAOq1C,GAAuB,SAAgCE,GAClE54B,EAAKpO,KAAK,gBAAiBgnC,MAI7BH,GACFz4B,EAAKpO,KAAK,WAAY,IAKvBA,EAAKpQ,eAAe,eAAiBg3C,EAAQW,YAAYC,UACzDpB,EAAiB,gBAAiB,eAAgBh4B,GAAM,IAE3DpO,EAAKsnC,SAAS,YAAY,WACxBl5B,EAAKpO,KAAK,kBAAmBA,EAAe,aAI5ComC,EAAiB,eAAgB,cAAeh4B,GAAM,IACxDpe,EAAMyB,QAAO,WACX,OAAOm1C,EAAQa,YACd,SAA+BT,GAChC54B,EAAKpO,KAAK,iBAAkBgnC,cAQzCj3C,UAAU,aAAc,CAAC,QAAS,SAASo2C,GAC1C,OAAOA,EAAMH,YAAY,aAAc,gBAAiBN,GAAqB,MAE9E31C,UAAU,cAAc,WACvB,MAAO,CACLsE,SAAU,IACVxB,QAAS,cACT4C,KAAM,SAASzF,EAAOoe,EAAMpO,EAAM0nC,GAC5B1nC,EAAKpQ,eAAe80C,IAEnBt2B,EAAKpO,KAAK,cACboO,EAAKpO,KAAK,YAAa,kBAK9BjQ,UAAU,UAAU,CAAC,QAAS,SAAU,SAASo2C,EAAO93C,GACvD,MAAO,CACLgG,SAAU,IACVE,QAAS,SAAS6Z,EAAMpO,GACtB,IAAIA,EAAKpQ,eAAe80C,GAAxB,CAEA,IAAI72C,EAAKQ,EAAO2R,EAAK2nC,SACrB,OAAO,SAAS33C,EAAOoe,EAAMpO,GAEtB6lC,EAAYz3B,EAAMs3B,KAEjBS,EAAM1tC,OAAO,sBAAwB2V,EAAKpO,KAAK,SACjDoO,EAAKpO,KAAK,OAAQ,UAGhBmmC,EAAM1tC,OAAO,cAAgB2V,EAAKpO,KAAK,aACzCoO,EAAKpO,KAAK,WAAY,IAGpBmmC,EAAM1tC,OAAO,gBAAmBuH,EAAK4nC,WAAc5nC,EAAK6nC,YAAe7nC,EAAK8nC,SAC9E15B,EAAK5gB,GAAG,WAAW,SAASC,GAC1B,IAAIs6C,EAAUt6C,EAAMu6C,OAASv6C,EAAMs6C,QAEnB,KAAZA,GAA8B,KAAZA,KAEwC,IAAxDrC,EAAoBtqC,QAAQ3N,EAAM8F,OAAO2yC,WAAqBz4C,EAAM8F,OAAO00C,mBAG7Ex6C,EAAMgD,iBAERT,EAAMmB,QAGR,WACEtD,EAAGmC,EAAO,CAAEk4C,OAAQz6C,mBASnCsC,UAAU,aAAc,CAAC,QAAS,SAASo2C,GAC1C,OAAO,SAASn2C,EAAOoe,EAAMpO,GACvBA,EAAKpQ,eAAe80C,KAEpByB,EAAM1tC,OAAO,aAAgB2V,EAAKpO,KAAK,aAAgB6lC,EAAYz3B,EAAMs3B,IAC3Et3B,EAAKpO,KAAK,WAAY,OA9Z5B,CAoaGyT,OAAQA,OAAO1mB,iECzalBA,QAAQC,OAAO,WAAY,CAAC,OAC3B+C,UAAU,WAAY,CAAC,KAAM,SAAUkE,GACvC,aAgCA,MAAO,CACNjE,MAAM,CACL42C,QAAe,IACf73B,IAAe,QACfiF,IAAe,QACfgD,KAAe,SACfmxB,SAAe,aACfC,SAAe,aACfC,UAAe,cACfC,UAAe,cACfC,WAAe,eACfC,WAAe,eACfC,aAAe,iBACfC,MAAe,UACfC,MAAe,UACfC,YAAe,gBACfC,YAAe,iBAEhBvqC,YAAa,2BACPzL,QAAS,UACToP,SAAS,EACTxM,KAlDI,SAAUtH,EAAQyG,EAAUxG,GAElCA,EAAO+5C,WACVh6C,EAAOg6C,SAAW,WAAW,OAAO,IAGjC/5C,EAAOi6C,YACVl6C,EAAOk6C,UAAY,WAAW,OAAO,IAGlCj6C,EAAOw6C,cACVz6C,EAAOy6C,YAAc,WAAW,IAAIviB,EAAIpyB,EAAGkF,QAAsB,OAAbktB,EAAExsB,UAAkBwsB,EAAE11B,UAGvEvC,EAAOs6C,QACVv6C,EAAOu6C,MAAQ,cAGZt6C,EAAOy6C,cACV16C,EAAO06C,YAAc,WAAW,IAAIxiB,EAAIpyB,EAAGkF,QAAsB,OAAbktB,EAAExsB,UAAkBwsB,EAAE11B,UAGvEvC,EAAOu6C,QACVx6C,EAAOw6C,MAAQ,eA4BVz6C,WAAY,yBAInBA,WAAW,qBAAsB,CAAC,SAAU,WAAY,SAAWC,EAAQuC,GAC3E,aAEAvC,EAAO26C,UAAar1B,OAAO7jB,eAAe,iBAAmB6jB,OAAOs1B,UAAUC,iBAAmB,EACjG76C,EAAO86C,SAAWl8C,QAAQoiB,KAAKhhB,EAAOy4C,SAEtCz4C,EAAO4gB,IAAM5gB,EAAO4gB,KAAO,EAC3B5gB,EAAO6lB,IAAM7lB,EAAO6lB,KAAO,EAC3B7lB,EAAO6oB,KAAO7oB,EAAO6oB,MAAQ,GAE7B7oB,EAAOi6C,SAAWj6C,EAAO86C,WAAa96C,EAAOy4C,QAE7Cz4C,EAAOm6C,UAAYn6C,EAAOm6C,WAAa,GACvCn6C,EAAO+6C,cAAgB/6C,EAAOm6C,UAAYn6C,EAAO6oB,KACjD7oB,EAAOo6C,WAAap6C,EAAOo6C,YAAc,GACzCp6C,EAAOq6C,WAAar6C,EAAOq6C,YAAcr6C,EAAOm6C,UAChDn6C,EAAOs6C,aAAet6C,EAAOs6C,cAAgBt6C,EAAOo6C,WAEpD,IAAI1nB,EAAO1yB,EAAO6lB,IAAM7lB,EAAO4gB,IAC/Bo6B,EAAQtoB,EAAO1yB,EAAO6oB,KACtBoyB,EAAUj7C,EAAOsD,OAAO,WAAW,WAClCtD,EAAOi6C,SAAWj6C,EAAO86C,WAAa96C,EAAOy4C,WAG9CyC,EAAW,SAAUC,GACpB,OAAQA,EAAM,GAAKH,EAAQtoB,GAG5B1yB,EAAOo7C,cAAgB,WACtB,OAAO,IAAIz6C,MAAMq6C,IAGlBh7C,EAAOq7C,cAAgB,SAAUF,GAChC,IAAIG,EAAQ,EAAEt7C,EAAO6oB,KAErB,OADW7oB,EAAOm6C,UAAUmB,GAAQH,EAAMG,IAI3Ct7C,EAAOu7C,WAAa,SAAUJ,GAC7B,OAAOD,EAASC,IAAUn7C,EAAOy4C,QAAQz4C,EAAO4gB,KAGjD5gB,EAAOw7C,aAAe,WACjBx7C,EAAOk6C,cAAgBl6C,EAAOg6C,YACjCh6C,EAAO06C,YAAY,CAACe,OAAOz7C,EAAOy4C,UAAU3uC,MAAK,WAChD9J,EAAOy4C,QAAUz4C,EAAO4gB,IACxB5gB,EAAOw6C,MAAM,CAACiB,OAAOz7C,EAAOy4C,cAK/Bz4C,EAAO07C,SAAW,SAAUP,GAC3B,IAAKn7C,EAAOg6C,WAAY,CACvB,IAAI2B,EAAW/8C,QAAQoiB,KAAKhhB,EAAO4gB,IAAMs6B,EAASC,IAElDn7C,EAAOy6C,YAAY,CAACgB,OAAOE,IAAW7xC,MAAK,WAC1C9J,EAAOy4C,QAAUkD,EACjBp5C,GAAS,WACRvC,EAAOu6C,MAAM,CAACkB,OAAOz7C,EAAOy4C,kBAMhCz4C,EAAOsB,IAAI,YAAY,WACtB25C,UAID3jC,IAAI,CAAC,iBAAkB,SAAUjI,GACjC,aAEAA,EAAeusC,IAAI,2BAElB,0iDCtHF,SAASC,EACP7mC,EACAL,EACA6C,EACAskC,EACAh2C,EACAi2C,EACAC,EACAC,EACAC,EACA35C,GAEA,MAAM45C,EAAKp9C,KA4CX,SAASq9C,EAAOC,GAEdN,EAAqBO,cAAcL,EAAgB,CAAEI,GAAAA,IAClDvyC,MAAMvG,IAhBX,IAAqBg5C,EAiBfvnC,EAAWwnC,OAASj5C,EAjBLg5C,GAkBI,IAAPF,EAAc,OAAS,OAjBvC1nC,EAAQwE,OAAOsjC,YACb,CACEF,IAAAA,GAEF,KAcEh6C,GAAS,KACPyS,EAAWhS,eAGdoe,MAAM26B,EAAqBW,gBA8MhCP,EAAG/vC,QArGH,WACEmZ,QAAQo3B,MAAM,oCAAqC3nC,EAAW4nC,SAC9D5nC,EAAW6nC,OAAS,OAEpB,MAAMC,EAAY9nC,EAAW+nC,SAASC,MAChCC,EAAajoC,EAAW+nC,SAASG,UACjCC,EACJnoC,EAAW+nC,SAASK,iBAAmBpoC,EAAW+nC,SAASG,UACvDG,EAAeroC,EAAW+nC,SAASO,aACnCC,EAAmBvoC,EAAW+nC,SAASS,gBACvCC,EAAgB58B,KAAKgF,IACzBT,SAASs4B,gBAAgBC,aACzBr4B,OAAOs4B,aAAe,GAElBC,EAAez4B,SAASs4B,gBAAgBI,YAG9C14B,SAASs4B,gBAAgBK,MAAMC,YAAY,oBAAqBlB,GAChE13B,SAASs4B,gBAAgBK,MAAMC,YAAY,qBAAsBf,GACjE73B,SAASs4B,gBAAgBK,MAAMC,YAC7B,4BACAb,GAEF/3B,SAASs4B,gBAAgBK,MAAMC,YAC7B,uBACAX,GAEFj4B,SAASs4B,gBAAgBK,MAAMC,YAC7B,2BACAT,GAEFn4B,SAASs4B,gBAAgBK,MAAMC,YAC7B,wBACAP,GAEFr4B,SAASs4B,gBAAgBK,MAAMC,YAC7B,uBACAH,GAGF,IAAII,GAAK,EAET,MAAMC,EAA8B36C,GAChB,OAAVA,GAAkBA,EAAMyR,EAAWJ,WAAc,GAGrDupC,EAAwBpC,EAAqBqC,QACjDlC,GACApyC,KAAKo0C,GACDG,EAAuBtC,EAAqBqC,QAChDnC,GACAnyC,KAAKo0C,GACPp4C,EAAG0U,IAAI,CAAC2jC,EAAuBE,IAC5Bv0C,MAAK,IAAiC,IAA/Bw0C,EAAcC,GAAiB,EACrCvpC,EAAW4nC,QAAU0B,EACrBtpC,EAAWwnC,OAAS+B,EAEhBvpC,EAAW4nC,QAAQ4B,aAAexpC,EAAWwnC,OAAOH,GACtD4B,GAAK,EAELjpC,EAAWwnC,OAAOH,IAAK,EAGa,iBAAlCrnC,EAAW+nC,SAAS0B,WACtBrC,EAAO6B,GAzMbzmC,EAAOi5B,GAjBT,WAAoB,QAClB,MAAMiO,EAAS1pC,EAAW+nC,SAAS2B,OAC7B9B,IAAU5nC,MAAAA,GAAA,UAAAA,EAAY4nC,eAAZ,mBAAqB4B,mBAArB,UAAkCp0C,IAE5Cu0C,EACJrQ,OAAOt5B,EAAW+nC,SAAS6B,kBAC3BtQ,OAAOt5B,EAAW+nC,SAAS8B,qBACzBvQ,OAAOt5B,EAAW+nC,SAAS6B,iBAE/B,SAAMhC,IAAa+B,GAAYD,GAQrBI,GAAa,aAAe,cAAe,KAAM,CACzDlqC,SAAU,YA8MR,IAAI2nC,EAAM,GAKRA,EAHAvnC,EAAW+nC,SAAS2B,SACnB1pC,EAAW+nC,SAASgC,gBAEf,OAEA,UAGRpqC,EAAQwE,OAAOsjC,YACb,CACEF,IAAAA,EACAO,UAAAA,EACAG,WAAAA,EACAQ,cAAAA,EACAI,aAAAA,GAEF,KAGF,MAAME,EAAQ34B,SAAS45B,cAAc,SACrC55B,SAASpB,KAAKi7B,YAAYlB,GAC1BA,EAAMmB,MAAMC,WACV,2BAA6BnqC,EAAW+nC,SAASC,MAAQ,kBAG5D57B,MAAM26B,EAAqBW,iBAKhCP,EAAGiD,MA5MH,WACE,MAAMZ,EAAcxpC,EAAW4nC,QAAQ4B,YAEvC,GAAIA,GAAeA,EAAYp0C,GAAI,CAEjC,MAAMi1C,EAAUvD,EACbuD,UACAlmC,OAAOva,QAAQkD,QAAQsjB,SAASk6B,cAAc,eAC9CC,qBAAoB,GACpBrN,MACCl9B,EAAW+nC,SAASyC,iBAClB,yCAEHC,GAAG,MACHv8C,OAAO,UAEV44C,EACG4D,KAAKL,GACLv1C,MAAK,WACJ,OAAOkyC,EAAI2D,gBAAgBC,aAAa,CACtCx1C,GAAIo0C,EAAYp0C,GAChBy1C,QAAQ,EACRC,YAAa,YAEZC,YAEJj2C,MAAK,WACJ0N,EAAOi5B,GAAG,cAAe,KAAM,CAC7B77B,SAAU,eAGbwM,OAAM,SAAU6K,GACf1G,QAAQnhB,MAAM,YAAa6nB,QA6KnCkwB,EAAGC,OAASA,EACZD,EAAG6D,SAzKH,WACE,MAAM3M,EAAWvtC,EAAGkF,QACdwzC,EAAcxpC,EAAW4nC,QAAQ4B,YA4DvC,OA1DIA,GAAeA,EAAYp0C,IAC7B4xC,EAAI2D,gBACDM,YAAY,CACXC,MAAO1B,EAAYp0C,GACnB+1C,YAAY,EACZC,eAAe,IAEhBL,SAASj2C,MAAK,SAAUpD,GACvB2sC,EAAS3nC,QACP20C,GAAAA,CAAK35C,EAAK45C,KAAKz/C,MAAM,IAAI,SAAU0/C,GACjC,IAAIC,EASJ,GAPsB,OAAlBD,EAAIE,YACND,EACExrC,EAAW+nC,SAAS2D,eACpB1rC,EAAW4nC,QAAQ3uB,MACnB,UAAYsyB,EAAII,WAGE,QAAlBJ,EAAIE,UACN,OAAQzrC,EAAW+nC,SAAS6D,iBAC1B,IAAK,gBACHJ,EAASD,EAAIM,OACT7rC,EAAW+nC,SAAS+D,WAAaP,EAAIM,OACrC,SACJ,MAEF,IAAK,cACHL,EAASD,EAAIM,OACTN,EAAIQ,KAAKC,OAAST,EAAIQ,KAAKE,SAC3B,SACJ,MAEF,IAAK,iBACHT,EAASD,EAAIM,OAASN,EAAIQ,KAAKE,SAAW,SAC1C,MAEF,QACET,EAASD,EAAIM,OACT7rC,EAAW+nC,SAAS+D,WAAaP,EAAIM,OACrC,SAKV,MAAO,CACLL,OAAQA,EACR3d,QAAS0d,EAAIW,KACbC,UAAWC,GAAAA,CAAOb,EAAIY,WAAWx6B,OAAO,+BAK/CvF,OAAM,SAAU6K,GACf1G,QAAQnhB,MAAM6nB,MAIbonB,EAAS7wC,SA4GlB25C,EAAGkF,eA7OH,WACE,MAA4C,YAArCrsC,EAAW+nC,SAASuE,aAA6B,OAAS,OA6OnE,MAAMC,EAAgB,CACpB7C,OAAQ,CAAC,SAAU,OAAQ,UAAW,UAAW,aACjD8C,QAAS,CAAC,YAKZlvC,OAAO+6B,eAAer4B,EAAY,cAAe,CAC/CvF,MACE,IAAIpK,EAAS2P,EAAW+nC,SAAS0E,aAMjC,OALIF,EAAc7C,OAAOrmC,SAASrD,EAAW6nC,QAC3Cx3C,EAAS2P,EAAW+nC,SAAS2E,cACpBH,EAAcC,QAAQnpC,SAASrD,EAAW6nC,UACnDx3C,EAAS2P,EAAW+nC,SAAS4E,gBAExBt8C,KAIXigB,OAAOs8B,iBACL,WACA,SAAU3sC,GACa,SAAjBA,EAAIvO,KAAKuO,IACXmnC,GAAO,GACmB,SAAjBnnC,EAAIvO,KAAKuO,KAClBmnC,GAAO,MAGX,2eCvTJ,SAASyF,EAAS7sC,EAAYF,GAE5B,MAAM3H,EAAS2H,EAAUo5B,SAGzBl5B,EAAW+nC,SAAW,CACpB+E,OAAQ,UACRC,MAAM,GAGRC,GAAAA,CAAO70C,GAAQ,SAAU5J,EAAOqB,GAChB,KAAVrB,GAAiB0+C,GAAAA,CAAO1+C,KACZ,SAAVA,IACFA,GAAQ,GAGI,UAAVA,IACFA,GAAQ,GAGVyR,EAAW+nC,SAASn4C,GAAOrB,MAI/ByR,EAAWJ,SAAWI,EAAW+nC,SAASnoC,SAC1CI,EAAWwnC,OAAS,CAAEH,IAAI,GAC1BrnC,EAAW4nC,QAAU,GAWvB,SAASsF,EACPC,EACA/uC,EACAgvC,EACAC,EACAC,GAEAlvC,EAAkBgB,WAAU,GAGvBguC,EAAcpjD,SAAS0R,QAAQjB,MAClC2yC,EAAcpjD,SAAS0R,QAAQjB,IAAM,IAIvC2yC,EAAcpjD,SAAS0R,QAAQjB,IAAI,qBACjC,gCAEF2yC,EAAcpjD,SAAS0R,QAAQjB,IAAI,iBAAmB,WACtD2yC,EAAcpjD,SAAS0R,QAAQjB,IAAI8yC,OAAS,WAG5CF,EAA4BG,UAAUF,GAGtCH,EACG31C,MAAM,MAAO,CACZkxB,UAAU,IAEXlxB,MAAM,cAAe,CACpBgE,IAAK,WACLL,YAAasyC,EACb1iD,WAAY,4BAEbyM,MAAM,aAAc,CACnBgE,IAAK,UACLL,YAAauyC,EACb3iD,WAAY,2BAEbyM,MAAM,cAAe,CACpBgE,IAAK,WACLL,YAAawyC,EACb5iD,WAAY,4BAEbyM,MAAM,WAAY,CACjBgE,IAAK,QACLL,YAAayyC,EACb7iD,WAAY,yBAEbyM,MAAM,gBAAiB,CACtBgE,IAAK,aACLL,YAAa0yC,EACb9iD,WAAY,8BAEbyM,MAAM,cAAe,CACpBgE,IAAK,WACLL,YAAa2yC,EACb/iD,WAAY,0OC3FlB,SAASgjD,EACP/tC,EACAwC,EACAwrC,EACAhH,EACAl2C,EACAi2C,EACAG,EACAD,GAEA,MAAME,EAAKp9C,KAIX,SAASmmC,EAAY3gC,GACnB,OAAO,SAAU0nB,GACfkwB,EAAG8G,OAAO1+C,GAAQ0nB,EAAIvlB,KAEtB,MAAMw8C,EAAQF,EACXG,SACAC,YACCpuC,EAAW+nC,SAASsG,0BAClB,yBAEHC,WAAW,oBACXC,SAAS,OAEZP,EAAStD,KAAKwD,IAIlB,SAASM,IACPxuC,EAAWyuC,SAAU,EAkBvB,SAASC,IACH1uC,EAAW+nC,SAAS2B,OACtBlnC,EAAOi5B,GAAG,aAAc,KAAM,CAAE77B,SAAU,YAE1C4C,EAAOi5B,GAAG,cAAe,KAAM,CAAE77B,SAAU,YAI/C,SAAS4lC,IACP2B,EAAGwH,KAAO,GACVxH,EAAGyH,QAAU,KACbzH,EAAG0H,UAAY,KACf1H,EAAG2H,SAASC,eACZ5H,EAAG2H,SAASE,uBAELhvC,EAAW4nC,QAAQ4B,YAE1BxpC,EAAWivC,gBAAiB,EAiD9B9H,EAAG/vC,QAjFH,WACEmZ,QAAQo3B,MAAM,sCAAuC3nC,EAAW4nC,SAChE5nC,EAAW6nC,OAAS,UAGpB/2C,EAAG0U,IAAI,CACLuhC,EAAqBmI,WAAWhI,GAC7BpyC,MAAK,IAAMyb,QAAQo3B,MAAM,6BACzBv7B,MAAM26B,EAAqBW,gBAC9BX,EAAqBmI,WAAWjI,GAC7BnyC,MAAK,IAAMyb,QAAQo3B,MAAM,4BACzBv7B,MAAM26B,EAAqBW,kBAC7B5yC,MAAK,IAAOkL,EAAWyuC,SAAU,KAsEtCtH,EAAGgI,OA1CH,WACEnvC,EAAWyuC,SAAU,EAEjBzuC,EAAW4nC,QAAQ4B,aAAexpC,EAAW4nC,QAAQ4B,YAAYp0C,GACnE4xC,EAAI2D,gBACDP,MACCgF,GAAAA,CACE,CACEh6C,GAAI4K,EAAW4nC,QAAQ4B,YAAYp0C,GACnCi6C,WAAYrvC,EAAW+nC,SAASsH,WAChCC,SACEtvC,EAAW+nC,SAAS2D,eAAiB1rC,EAAW4nC,QAAQ3uB,MAE5DkuB,EAAGwH,OAGN5D,SAASj2C,MAAK,kBACNqyC,EAAG8G,OAAOkB,OAEjB,MAAMjB,EAAQF,EACXG,SACAC,YACCpuC,EAAW+nC,SAASwH,0BAClB,2BAEHjB,WAAW,oBACXnqC,OAAOva,QAAQkD,QAAQsjB,SAASk6B,cAAc,mBAEjD0D,EAAStD,KAAKwD,MAEfp5C,KAAK0wC,GACL1wC,KAAK45C,GACLtiC,MAAM8jB,EAAY,WAClBsf,QAAQhB,IAEXA,IACAte,EAAY,YAOhBiX,EAAGsI,KAhDH,WACEjK,IACAkJ,KAgDFvH,EAAGwH,KAAO,GACVxH,EAAG8G,OAAS,GCjId,SAASyB,EAAW1vC,EAAY2vC,GAC9B,MAAMC,EAAgB,CACpBx6C,GAAI,MACJkW,MAAOtL,EAAW+nC,SAASz8B,OAGvB07B,EAAM,GAyEZ,OAvEAA,EAAI6I,QAAU7vC,EAAW+nC,SAAS+H,OAAS,QAE3C9I,EAAI+I,YAAcJ,EAChB3I,EAAI6I,QAAU,oBACdD,EACA,CACE5c,OAAQ,CACNgd,OAAQ,OACRx0C,IAAKwrC,EAAI6I,QAAU,4BAErBrD,QAAS,CACPwD,OAAQ,OACRx0C,IAAKwrC,EAAI6I,QAAU,6BAErBI,UAAW,CACTD,OAAQ,MACRx0C,IAAKwrC,EAAI6I,QAAU,8BAKzB7I,EAAI2D,gBAAkBgF,EACpB3I,EAAI6I,QAAU,wBACdD,EACA,CACEzpC,OAAQ,CACN6pC,OAAQ,MACRx0C,IAAKwrC,EAAI6I,QAAU,yBAErBjF,aAAc,CACZoF,OAAQ,MACRx0C,IAAKwrC,EAAI6I,QAAU,uCAErBzF,MAAO,CACL4F,OAAQ,MACRx0C,IAAKwrC,EAAI6I,QAAU,+BAErB5E,YAAa,CACX+E,OAAQ,MACRx0C,IAAKwrC,EAAI6I,QAAU,wCAErBK,iBAAkB,CAChBF,OAAQ,OACRx0C,IAAKwrC,EAAI6I,QAAU,0CACnBn0C,QAAS,CACP,oBAAgBwC,GAElBiyC,iBAAkBvmD,QAAQ6c,UAE5B2pC,mBAAoB,CAClBJ,OAAQ,MACRx0C,IAAKwrC,EAAI6I,QAAU,6CAErBQ,QAAS,CACPL,OAAQ,MACRx0C,IAAKwrC,EAAI6I,QAAU,mCAKzB7I,EAAIsJ,YAAcX,EAChB3I,EAAI6I,QAAU,oBACdD,EACA,CACEzpC,OAAQ,CACN6pC,OAAQ,MACRx0C,IAAKwrC,EAAI6I,QAAU,uBAKlB7I,2aChET,SAASuJ,EACPvlD,EACAgV,EACAzS,EACAijD,EACAC,EACAjuC,EACApI,EACA4zC,EACAhH,EACAD,EACAG,EACAD,EACAyJ,GAEA,MAAMvJ,EAAKp9C,KACX,IAAI4mD,EACAC,EACAC,EACAC,EAIAC,GAAmB,EAkCvB,SAASC,IAEPlgD,EAAAA,GAAAA,IAAO,CACLi2C,EAAqBmI,WAAWhI,GAC7BpyC,MAAK,IAAMyb,QAAQo3B,MAAM,6BACzBv7B,MAAM26B,EAAqBW,gBAC9BX,EAAqBmI,WAAWjI,GAC7BnyC,MAAK,IAAMyb,QAAQo3B,MAAM,4BACzBv7B,MAAM26B,EAAqBW,kBAC7B5yC,MAAK,KAhBJkL,EAAW+nC,SAAS2B,OACtBlnC,EAAOi5B,GAAG,aAAc,KAAM,CAAE77B,SAAU,YAE1C4C,EAAOi5B,GAAG,cAAe,KAAM,CAAE77B,SAAU,eAoB/C,SAASqxC,IACP1jD,GAAS,WACP,MAAMT,EAAU2jD,EAAU,GAAGS,uBAAuB,iBAAiB,GAEjEpkD,IACFA,EAAQqkD,UAAYrkD,EAAQskD,iBAKlC,SAASC,EAAexjB,GACtB,MAAMqgB,EAAQF,EACXG,SACAC,YAAYvgB,GACZygB,WAAW,yBAA2BtuC,EAAW+nC,SAASuE,cAC1DnoC,OAAOva,QAAQkD,QAAQsjB,SAASk6B,cAAc,mBAEjD0D,EAAStD,KAAKwD,GAGhB,SAASoD,IACPnK,EAAG8G,OAAS,GACZoD,EACE,8CAKJ,SAASnhB,EAAY3gC,GACnB,OAAO,SAAU0nB,GAAK,UAEC,OAAnB,UAAAA,EAAIvlB,YAAJ,eAAU6/C,OACkB,mBAA5B,UAAAt6B,EAAIvlB,YAAJ,mBAAUqnC,eAAV,eAAmB9/B,OAEnB+G,EAAW+nC,SAAS2B,QAAS,EAC7B1pC,EAAW+nC,SAASyJ,eAAgB,EACpChvC,EAAOi5B,GAAG,cAAe,KAAM,CAC7B77B,SAAU,cAGZunC,EAAG8G,OAAO1+C,GAAQ0nB,EAAIvlB,KACtBy1C,EAAG8G,OAAS,GACZoD,EAAe,yBACfJ,MAKN,SAASQ,EAAY5jB,GAEfkjB,IAIJA,GAAmB,EACnB/J,EAAI+I,YACD/c,OAAOnF,GACPkd,SAASj2C,MAAK,SAAUpD,GACvBy1C,EAAG8G,OAAS,GACZ,IAAIyD,GAAkB,EAClBzE,GAAAA,CAAOjtC,EAAW4nC,QAAQ4B,eAC5BxpC,EAAW4nC,QAAQ4B,YAAc,CAC/Bp0C,GAAI1D,EAAK83C,YAAYp0C,IAEvBs8C,GAAkB,GAEf1xC,EAAW4nC,QAAQ+J,qBACtB3xC,EAAW4nC,QAAQ+J,oBAAqB,EACxCD,GAAkB,GAGhBA,GACF3K,EAAqBO,cACnBJ,EACAlnC,EAAW4nC,SAEV9yC,MAAMvG,IACLyR,EAAW4nC,QAAUr5C,KAEtB6d,MAAM26B,EAAqBW,gBAEhCiJ,EAAU,GAAGiB,aAAaC,QAAQ,IAElCZ,OAED7kC,MAAM8jB,EAAY,qBAClBsf,SAAQ,KACPuB,GAAmB,MA4EzB,SAASe,IAEL9xC,EAAW4nC,SACX5nC,EAAW4nC,QAAQ4B,aACnBxpC,EAAW4nC,QAAQ4B,YAAYp0C,IAE/B4xC,EAAI2D,gBACDlwC,IAAI,CACHrF,GAAI4K,EAAW4nC,QAAQ4B,YAAYp0C,KAEpC21C,SAASj2C,MAAK,SAAUpD,UAChBy1C,EAAG8G,OAAO6D,eAGbpgD,EAAKm5C,SACP7qC,EAAW4nC,QAAQ4B,YAAYqB,QAAS,EACxC9D,EAAqBO,cACnBJ,EACAlnC,EAAW4nC,SAEV9yC,MAAMvG,IACLyR,EAAW4nC,QAAUr5C,KAEtB6d,MAAM26B,EAAqBW,gBAEL,cAArBh2C,EAAKqgD,YACPvvC,EAAOi5B,GAAG,gBAAiB,KAAM,CAAE77B,SAAU,YAE7C4C,EAAOi5B,GAAG,cAAe,KAAM,CAAE77B,SAAU,gBAIhDwM,OAAM,SAAU6K,GACf,OAAQA,EAAI4wB,QACV,KAAK,IACHrlC,EAAOi5B,GAAG,cAAe,KAAM,CAAE77B,SAAU,YAC3C,MACF,KAAK,IACHoxC,IACA,MACF,KAAK,IACHxuC,EAAOi5B,GAAG,gBAAiB,KAAM,CAAE77B,SAAU,YAC7C,MACF,QACE2Q,QAAQnhB,MAAM6nB,OAQ1B,SAAS+6B,EAAMjN,GACb,MAAMmH,EAAOyE,EAAU,GAAGiB,aAAaK,UAEnClN,GAA6B,KAAnBA,EAAOH,SAAkBG,EAAOmN,UAK1CnN,GAA6B,KAAnBA,EAAOH,SAKR,KAATsH,GAKJuF,EACErC,GAAAA,CACE,CACElD,KAAMA,GAERlsC,EAAW4nC,UAqCjB,SAASqD,IAAc,QACjBjrC,MAAAA,GAAJ,UAAIA,EAAY4nC,eAAhB,iBAAI,EAAqB4B,mBAAzB,OAAI,EAAkCp0C,IACpC4xC,EAAI2D,gBACDM,YAAY,CACXC,MAAOlrC,EAAW4nC,QAAQ4B,YAAYp0C,GACtC+8C,cAAc,EACd/8C,GAAI07C,QAAiB5yC,IAEtB6sC,SAASj2C,MAAK,SAAUpD,GAIvB,UAHOy1C,EAAG8G,OAAOzE,YAGb93C,EAAKuC,MAAO,CACd,IAAIm+C,GAAQ,EACRhrC,EAAI,EACR,IAAKA,EAAI,EAAGgrC,GAAQ,EAAOhrC,EAAI1V,EAAK45C,KAAKnyC,OAAQiO,IAAK,CACpD,MAAMrI,EAAIszC,GAAAA,CAAMryC,EAAWsyC,SAAU,CACnCl9C,GAAI1D,EAAK45C,KAAKlkC,GAAGhS,KAEnB,GAAK2J,EAYMrN,EAAK45C,KAAKlkC,GAAGywB,OACtB94B,EAAE84B,MAAO,OAbH,CACN,MAAMhK,EAAUn8B,EAAK45C,KAAKlkC,GAE1B,GAAIymB,EAAQ0kB,cAAgB1kB,EAAQqe,KAAM,CACxC,MACMnU,EADKnuC,QAAQkD,QAAQ+gC,EAAQqe,MACnBz+B,KAAK,QACjBsqB,EAAKya,WAAW,UAClB3kB,EAAQ4kB,YAAc1a,GAG1Bqa,GAAQ,EACRpyC,EAAWsyC,SAAS9nD,KAAKqjC,GAMI,QAA3Bn8B,EAAK45C,KAAKlkC,GAAGqkC,WAAwB/5C,EAAK45C,KAAKlkC,GAAGywB,OA/C3CziC,EAgDK1D,EAAK45C,KAAKlkC,GAAGhS,GA/ChC4xC,EAAIsJ,YACRnqC,OAAO,CACN/Q,GAAIA,EACJyiC,MAAM,IAEPkT,SAAS3+B,OAAM,SAAU6K,GACxB1G,QAAQnhB,MAAM6nB,OA6CNm7B,GAEFnB,IAGEv/C,EAAK45C,KAAKlkC,EAAI,GAAGywB,OACnBiZ,EAAgBp/C,EAAK45C,KAAKlkC,EAAI,GAAGhS,IAG/B07C,IAAkB9wC,EAAW4nC,QAAQ+J,oBACvC5K,EAAqBO,cAAcJ,EAAiB,IAC/ClnC,EAAW4nC,QACd+J,oBAAoB,IACnB78C,MAAMvG,IACPyR,EAAW4nC,QAAUr5C,KAlEnC,IAAuB6G,KAuEhBgX,OAAM,SAAU6K,GACf,OAAQA,EAAI4wB,QACV,KAAK,IACHrlC,EAAOi5B,GAAG,cAAe,KAAM,CAAE77B,SAAU,YAC3C,MACF,KAAK,IACH4C,EAAOi5B,GAAG,gBAAiB,KAAM,CAAE77B,SAAU,YAC7C,MACF,QACE2Q,QAAQnhB,MAAM6nB,OApY1BkwB,EAAG8G,OAAS,GACZjuC,EAAWsyC,SAAW,GACtBnL,EAAGuL,aAAe,CAChBC,gBAAgB,EAChBC,YAAY,EACZC,OAAO,EACPvgD,MAAM,EACNwgD,WAAY,UAEd3L,EAAGuJ,qBAAuBA,EAE1BvJ,EAAG4L,OAAS,CAEVnoD,KAAM,IAGRu8C,EAAG6L,cAAgB,CACjBC,uBAAuB,GA6gBzB9L,EAAG/vC,QApJH,WACEmZ,QAAQo3B,MAAM,mCAAoC3nC,EAAW4nC,SAC7D5nC,EAAW6nC,OAAS,OACpB7nC,EAAWyuC,SAAU,EACrBzuC,EAAW+nC,SAASmL,UAAW,EAE/B/L,EAAGgM,aAAe,GAGhBnzC,EAAW4nC,QAAQ4B,aACnBxpC,EAAW4nC,QAAQ4B,YAAYqB,OAG/BmG,KAGAc,IAGAlB,EAAsBJ,EAAUvF,EAAa,KAC7C4F,EAAyBL,EAAUsB,EAAgB,MAGrDnB,EAAYyC,EAAE,iBAAiBxB,aAAa,CAC1CyB,YAAarzC,EAAW+nC,SAASuL,oBAAsB,iBACvDlpD,OAAQ,CACNmpD,MAAO,SAAUC,EAAQzO,GACvBiN,EAAMjN,IAER0O,MAAO,WACL1pD,KAAK2pD,gBAuHbvM,EAAG6K,MAAQA,EACX7K,EAAGwM,aAjQH,WACE,MAAMzH,EAAOyE,EAAU,GAAGiB,aAAaK,UAG1B,KAAT/F,IAKJuF,EACErC,GAAAA,CACE,CACElD,KAAMA,GAERlsC,EAAW4nC,UAIf+I,EAAU,GAAGiB,aAAa8B,aAgP5BvM,EAAGx4C,UA1ZH,SAAmB+C,GACjB,GAAIA,EAAKie,KA3ISikC,SA6IhB,YADAtC,IAIF,MAAMuC,EAAK,IAAIC,SAEfD,EAAGzvB,OAAO,OAAQ1yB,EAAK7B,MAEvBuK,EACGopC,KACCxjC,EAAW+nC,SAAS+H,OAClB,0BACA9vC,EAAW4nC,QAAQ4B,YAAYp0C,GAC/B,4BACA4K,EAAW+nC,SAASz8B,MACtBuoC,EACA,CACE1D,iBAAkBvmD,QAAQ6c,SAC1B/K,QAAS,CACP,oBAAgBwC,KAIrBpJ,MAAK,SAAUpD,IACdA,EAAOA,EAAKA,MAEH0D,IACP+xC,EAAG8G,OAAS,GAEZwD,EACErC,GAAAA,CACE,CACElD,KACE,YACAlsC,EAAW+nC,SAAS+H,OACpB,0BACA9vC,EAAW4nC,QAAQ4B,YAAYp0C,GAC/B,iCACA1D,EAAK0D,GACL,UACA4K,EAAW+nC,SAASz8B,MACpB,qBACA5Z,EAAKnC,KACL,OACFgjD,aAAc7gD,EAAK0D,IAErB4K,EAAW4nC,WAIf1X,EAAY,oBAEbA,EAAY,oBAsWnBiX,EAAG4M,WAAY,EACf5M,EAAG6M,kBAAmB,EACtB7M,EAAG8M,iBAAmB,GACtB9M,EAAG+M,iBAxHH,WACO/M,EAAG4M,UAgENxjC,QAAQnhB,MAAM,8BA/DdmhB,QAAQN,IAAI,mBACZk3B,EAAG4M,WAAY,EACf5M,EAAGuJ,qBAAqByD,OACrBr/C,MAAK,KACJqyC,EAAGuJ,qBAAqB0D,iBACxB,MAAMC,EAAkB/3B,KAAKg4B,MAC7BnN,EAAG6M,kBAAmB,EAGtB,MAAMO,EAASpN,EAAGuJ,qBAAqB8D,YACjCC,EAAW,IAAIC,aACf5rC,EAAS2rC,EAASE,wBAAwBJ,GAC1CK,EAAWH,EAASI,iBAC1B/rC,EAAOgsC,QAAQF,GAEfA,EAASG,QAAU,GACnB,MAAMC,EAAgB,IAAIC,WAAWL,EAASM,mBACxCrkC,EAA6B,IAAvBmkC,EAAc77C,OAEpBg8C,EAAiBvrD,QAAQkD,QAC7BsjB,SAAS8gC,uBAAuB,kBAChC,GAEIkE,EAAexrD,QAAQkD,QAC3BsjB,SAAS8gC,uBAAuB,gBAChC,GAEI5pC,EAAI,KAER,IAAK6/B,EAAG4M,WAAa5M,EAAG6M,iBAGtB,OAFAmB,EAAepM,MAAMsM,UAAY,QACjCD,EAAaE,UAAY,YAI3BC,sBAAsBjuC,GAEtBstC,EAASY,qBAAqBR,GAC9B,IAAIS,EAAM,EACVT,EAAclqD,SAASyD,IACrBknD,GAAOlnD,KAET,MAAMmnD,EAAW7pC,KAAKD,IAAI,EAAG6pC,EAAM5kC,EAxBzB,KAyBVskC,EAAepM,MAAMsM,UAAY,SAAWK,EAAW,IAEvD,MAAMh4B,EAAOpB,KAAKg4B,MAAQD,EACpBsB,EAAKj4B,EAAO,IAEZk4B,EACJzO,EAAGuJ,qBAAqBmF,SAASn4B,EAAO,KACxC,KACC,KAAO7R,KAAKiqC,MAAMH,EAAK,KAAK9pD,OAAO,GAEtCupD,EAAaE,UAAYM,GAG3BtuC,OAED8E,OAAO2pC,IACNxlC,QAAQnhB,MAAM2mD,GACd5O,EAAG4M,WAAY,OA2DvB5M,EAAG6O,gBA9BH,WACE,MAAMnmD,EAAOs3C,EAAG8O,gBACVC,EAAWC,IAAIC,gBAAgBvmD,GACrCs3C,EAAG8M,iBAAmBiC,GA4BxB/O,EAAGkP,gBA9CH,WACE,MAAMxmD,EAAOs3C,EAAG8O,gBAChB9O,EAAG4M,WAAY,EACf5M,EAAG6M,kBAAmB,EACtB7M,EAAGuJ,qBAAqB9gC,QAIXu3B,EAAG4L,OAAOnoD,KAIlB0rD,QAAQzmD,IAmCfs3C,EAAGoP,kBAtDH,WACEpP,EAAG8O,gBACH9O,EAAG4M,WAAY,EACf5M,EAAG6M,kBAAmB,EACtB7M,EAAGuJ,qBAAqB9gC,SAmD1Bu3B,EAAG8O,cAvBH,WAOE,OANK9O,EAAG6M,mBACNzjC,QAAQN,IAAI,qBACZk3B,EAAG6M,kBAAmB,EACtB7M,EAAGuJ,qBAAqBuF,iBAEb9O,EAAGuJ,qBAAqB1F,YAkBvC7D,EAAGmK,gBAAkBA,EAGrBtmD,EAAOsB,IAAI,YA9WX,WACEkkD,EAAUtiD,OAAO0iD,GACjBJ,EAAUtiD,OAAO2iD,GACjB1J,EAAG8O,gBAEHrF,EAAsB,KACtBC,EAAyB,QAyW3B7wC,EAAW1T,IAAI,aAtWf,SAAoBoF,EAAMnH,GACpBA,GACFA,EAASisD,GAAAA,CAAQx2C,EAAWsyC,kqBC5PlC,MAAMvL,EAOJ54B,YAAYxO,EAASK,EAAYlP,GAAI,oBACnC/G,KAAK0sD,cAAgB,IAAIN,IAAIn2C,EAAW+nC,SAAS2O,SAASC,OAC1D5sD,KAAK6V,SAAWI,EAAW+nC,SAASnoC,SACpC7V,KAAK+G,GAAKA,EACV/G,KAAK4V,QAAUA,EA4CjBi3C,QAAQhnD,EAAKrB,GACX,MAAMsoD,EAAS,UACf,OAAO9sD,KAAK+G,IAAI4F,IACd,EAAA3M,KAAA,UAAAA,KAAwB8sD,EAAQjnD,GAAK,KACnC8G,OAEF3M,KAAK4V,QAAQwE,OAAOsjC,YAClB,CAAEoP,OAAAA,EAAQjnD,IAAAA,EAAKrB,MAAAA,GACfxE,KAAK0sD,kBASXrN,QAAQx5C,GACN,MAAMinD,EAAS,UACf,OAAO9sD,KAAK+G,IAAI4F,IACd,EAAA3M,KAAA,UAAAA,KAAwB8sD,EAAQjnD,GAAK,CAAC2X,EAAG2C,KACvCxT,EAAQwT,MAEVngB,KAAK4V,QAAQwE,OAAOsjC,YAAY,CAAEoP,OAAAA,EAAQjnD,IAAAA,GAAO7F,KAAK0sD,kBAQ1DvH,WAAWt/C,GACT,MAAMinD,EAAS,aACf,OAAO9sD,KAAK+G,IAAI4F,IACd,EAAA3M,KAAA,UAAAA,KAAwB8sD,EAAQjnD,GAAK,KACnC8G,OAEF3M,KAAK4V,QAAQwE,OAAOsjC,YAAY,CAAEoP,OAAAA,EAAQjnD,IAAAA,GAAO7F,KAAK0sD,kBAuB1DnP,cAAc13C,EAAK8B,GAAsB,IAAhBkF,EAAgB,wDAEvC,OAAO7M,KAAKq/C,QAAQx5C,GAAKkF,MAAMoV,IAC7B,MAAM4sC,EAAU,EAAA/sD,KAAA,UAAAA,KAAgBmgB,IAAS,GAMzC,OALItT,SACKkgD,EAAQ/sD,KAAK6V,UAEpBk3C,EAAQ/sD,KAAK6V,UAAYlO,EAEpB3H,KAAK6sD,QAAQhnD,EAAKknD,GAAShiD,MAAK,IAAMgiD,EAAQ/sD,KAAK6V,eAQ9D8nC,eAAezwB,GACb1G,QAAQnhB,MAAM,gBAAiB6nB,eAnHd4/B,EAAQjnD,EAAKrF,GAE9B,MAAM29B,EAAY7b,IAChB,MAAM0qC,EAAkB,GAAEF,UAC1B,GACExqC,EAAEsqC,SAAW5sD,KAAK0sD,eAClB7mD,IAAQyc,EAAE3a,KAAK9B,KACfmnD,IAAmB1qC,EAAE3a,KAAKmlD,OAC1B,CACA,MAAM,OAAEA,EAAF,KAAU3sC,GAASmC,EAAE3a,KAE3B,OADA6e,QAAQo3B,MAAO,UAAS/3C,cAAgBinD,uBAA6BxqC,GAC7DwqC,GACN,IAAK,gBACHtsD,EAASqF,GACT,MACF,IAAK,gBACHrF,EAASqF,EAAKsa,GACd,MACF,IAAK,mBACH3f,EAASqF,GACT,MACF,QACE2gB,QAAQo3B,MAAM,qBAAsBkP,GAIxC9sD,KAAK4V,QAAQq3C,oBAAoB,UAAW9uB,GAAU,KAG1Dn+B,KAAK4V,QAAQitC,iBAAiB,UAAW1kB,GAAU,cAiD1C+uB,GACT,IAAIlzB,EAASkzB,EACb,GAAsB,iBAAXlzB,EACT,IACEA,EAAShc,KAAK/W,MAAMimD,GACpB,MAAO7nD,GACPmhB,QAAQ2mC,KAAM,oBAAmBD,KAAe7nD,GAChD20B,EAASkzB,EAGb,OAAOlzB,+NCxGX,MAAMozB,EAkBJhpC,YAAYnjB,EAAQyG,GAAU,gBAjBrB,IAiBqB,iBAhBpB,CAGR2lD,iBAAiB,IAaW,kBAXpB,GAWoB,mBAVlB,cAUkB,qBAThB,QASgB,oBARjB,GAQiB,mBAPlB,QAOkB,kBANnB,MAMmB,cALvB,cAMLrtD,KAAKiB,OAASA,EACdjB,KAAKiB,OAAOqsD,WAAattD,KAAKstD,WAC9BttD,KAAK0H,SAAWA,EAGlB2F,UACEmZ,QAAQo3B,MAAM,gCAEI,eAAd59C,KAAKkP,OACPlP,KAAKkP,KAAO,cAIhBq+C,YACE/mC,QAAQo3B,MAAM,kCACd,MAAMR,EAAKp9C,KACXA,KAAKwtD,iBAAmB,CAAC,OACzBxtD,KAAKytD,iBAAmB,KACxBztD,KAAK0tD,wBAA0B,KACtB,EAGT1tD,KAAK2tD,MAAQ3tD,KAAK0H,SAASoZ,KAAK,SAAS,IAAM,GAE/C9gB,KAAK2tD,MAAMC,iBAAmB,KAExBxQ,EAAGuQ,MAAME,WAAaC,EAAAA,GACxB1Q,EAAGuQ,MAAMI,YAAc,MACvB3Q,EAAGuQ,MAAMK,aAAe,KACtB5Q,EAAGuQ,MAAMK,aAAe,KAClB5Q,EAAGuQ,MAAME,WAAaC,EAAAA,IACxB1Q,EAAGuQ,MAAMI,YAAc,EACvB3Q,EAAGuQ,MAAMK,aAAe,KACtB5Q,EAAG6Q,mBAQX7Q,EAAGuQ,MAAMI,YAAc,EACvB3Q,EAAGuQ,MAAMK,aAAe,KACtB5Q,EAAG6Q,gBAKTjuD,KAAK2tD,MAAMO,aAAe,KACxB1nC,QAAQN,IAAI,iBAGdlmB,KAAK2tD,MAAMQ,UAAY,KACrBnuD,KAAKouD,YAGPpuD,KAAK2tD,MAAMU,QAAU,KACnBruD,KAAKsuD,UAAY,aACjBtuD,KAAKiB,OAAOstD,UACZvuD,KAAK2tD,MAAMI,YAAc,GAG3B/tD,KAAK2tD,MAAMtyC,OAGbmzC,aACMxuD,KAAK2tD,MAAMc,QACTzuD,KAAK2tD,MAAMI,cAAgB/tD,KAAK2tD,MAAME,WACxC7tD,KAAK2tD,MAAMI,YAAc,GAE3B/tD,KAAKsuD,UAAY,QACjBtuD,KAAK2tD,MAAMe,SAEX1uD,KAAKsuD,UAAY,aACjBtuD,KAAK2tD,MAAMgB,SAIfP,WACEpuD,KAAK0kD,SAAU,EAGjBuJ,aACEjuD,KAAK4uD,iBACL5uD,KAAKiB,OAAOstD,UAGdK,iBACE,MAAM9oC,EAAU9lB,KAAK2tD,MAAMI,YACrBc,EAAW/oC,EAAU9lB,KAAK2tD,MAAME,SAAY,IAClD7tD,KAAKoF,SAAWypD,EAAU,IAC1B7uD,KAAK8uD,WAAaD,EAClB7uD,KAAK+tD,YAAc/tD,KAAK+uD,WAAWjpC,GAGrCipC,WAAWC,GACT,MAAMntC,EAAMC,KAAKmtC,MAAMD,EAAO,IACxBE,EAAMptC,KAAKmtC,MAAMD,EAAO,IAC9B,OAAOntC,EAAM,KAAOqtC,EAAM,GAAK,IAAMA,EAAMA,GAG7CC,sBACEnvD,KAAK2tD,MAAMI,YAAc/tD,KAAK2tD,MAAME,UAAY7tD,KAAK8uD,WAAa,KAGpExB,aACE9mC,QAAQo3B,MAAM,iCACV59C,KAAKovD,gBAAwC,IAAvBpvD,KAAKovD,eAC7BhD,IAAIiD,gBAAgBrvD,KAAK+e,gGC/G/B,QAjBA,WACE,OAAO,SAAUva,GACf,IAAKA,GAA0B,iBAAVA,EACnB,OAGF,MAAMk7B,EAAQl7B,EAAMwX,MAClB,8GAEF,OAAI0jB,GAASA,EAAM4vB,OACV5vB,EAAM4vB,OAAOpgD,KAEb,4OCXb,MAAMqgD,EASJnrC,cAAc,2BARM,IAQN,gCAPW,IAOX,sDAEd/W,UACE,MAAMsf,EAAQ3sB,KAAKwvD,aAAa1sC,MAAM,KACjB,IAAjB6J,EAAMvd,OACRpP,KAAKyvD,kBAAoB,OAEzBzvD,KAAKyvD,kBAAoB9iC,EAAMyP,MAG7Bp8B,KAAKyvD,kBAAkBrgD,OAAS,IAClCpP,KAAKyvD,kBAAoBzvD,KAAKyvD,kBAAkBx1B,UAAU,EAAG,GAAK,MAEpEj6B,KAAK0vD,uBAAyB,OAAS1vD,KAAKyvD,kBAG9CE,mBACE,MAAMlyC,EAAI4I,SAAS45B,cAAc,KAC3BxuC,EAAMzR,KAAK+e,OACjBtB,EAAEuwB,KAAOv8B,EACTgM,EAAEpX,OAAS,QACXoX,EAAEwjC,SAAWjhD,KAAKwvD,aAClBnpC,SAAS87B,KAAKjC,YAAYziC,GAC1BA,EAAEmyC,sBAIN,yECEA,SAASC,EAAgBC,GACvB,OAAO,SAAUtrD,GACf,OAAOsrD,EAAKC,YAAYvrD,uBAoI5B3E,QACGC,OAFiB,cAEG,CACnB,YACA,SACA,aACA,aACA,aACA,aACA,QACA,UACA,YACA,qBACA,WACA,SAEDwJ,OAAO,YAAaumD,GACpBG,SAAS,iBAAkB,eAC3BA,SAAS,kBAAmB,WAC5BA,SAAS,iBAAkB,UAC3Bv4C,QAAQ,uBAAwBulC,GAChCvlC,QAAQ,uBAAwBkvC,EAAAA,GAChC9jD,UAAU,WApCb,WACE,OAAO,SAAUC,EAAOC,EAASC,GAC/BD,EAAQO,KAAK,oBAAoB,SAAU/C,GACrB,KAAhBA,EAAMu6C,QACRh4C,EAAMmB,QAAO,WACXnB,EAAMzB,MAAM2B,EAAMitD,YAEpB1vD,EAAMgD,yBA8BXV,UAAU,WArJb,WAyGE,MAAO,CACL0F,KATF,SAAczF,EAAOC,GACnBA,EAAQzC,GAAG,SAAS,WACdwC,EAAMylD,SAASn5C,OAAS,GAlGhC,SAAsBtM,GAEpB,MAAMotD,EAAM7pC,SAAS45B,cAAc,OAC7BpC,EAAU/6C,EAAM+6C,QAChBG,EAAWl7C,EAAMk7C,SACvB,IAAImS,EAEJ,IAAK,IAAI9yC,EAAI,EAAGA,EAAIva,EAAMylD,SAASn5C,OAAQiO,IAAK,CAC9C,MAAMymB,EAAUhhC,EAAMylD,SAASlrC,GAC/B,IAAIokC,EAAS,WACb,MAAMU,EAAO,YAAcre,EAAQqe,KAC7BiO,EACJ,YAAc/N,GAAAA,CAAOve,EAAQse,WAAWx6B,OAAO,uBAEjD,GAAU,IAANvK,EAAJ,CAKA,OAAQva,EAAMk7C,SAAS6D,iBACrB,IAAK,gBACHJ,GACwB,QAAtB3d,EAAQ4d,UACJ5d,EAAQge,OACN9D,EAAS+D,WAAaje,EAAQge,OAC9B,SACF9D,EAAS2D,eACT9D,EAAQ3uB,MACR,UAAY4U,EAAQ8d,UAC1B,MAEF,IAAK,cACHH,GACwB,QAAtB3d,EAAQ4d,UACJ5d,EAAQge,OACNhe,EAAQke,KAAKC,OAASne,EAAQke,KAAKE,SACnC,SACFlE,EAAS2D,eACT9D,EAAQ3uB,MACR,UAAY4U,EAAQ8d,UAC1B,MAEF,IAAK,iBACHH,GACwB,QAAtB3d,EAAQ4d,UACJ5d,EAAQge,OACNhe,EAAQke,KAAKE,SACb,SACFlE,EAAS2D,eACT9D,EAAQ3uB,MACR,UAAY4U,EAAQ8d,UAC1B,MAEF,QACEH,GACwB,QAAtB3d,EAAQ4d,UACJ5d,EAAQge,QACL9D,EAAS+D,YAAc,SAAWje,EAAQge,OAC3C,SACF9D,EAAS2D,eACT9D,EAAQ3uB,MACR,UAAY4U,EAAQ8d,UAG9BsO,EAAIhQ,YAAY75B,SAASgqC,eAAe5O,IACxCyO,EAAIhQ,YAAY75B,SAAS45B,cAAc,OACvCiQ,EAAIhQ,YAAY75B,SAASgqC,eAAelO,IACxC+N,EAAIhQ,YAAY75B,SAAS45B,cAAc,OACvCiQ,EAAIhQ,YAAY75B,SAASgqC,eAAeD,IACxCF,EAAIhQ,YAAY75B,SAAS45B,cAAc,OACvCiQ,EAAIhQ,YAAY75B,SAAS45B,cAAc,YAvDrCkQ,EAAYrsB,EAAQse,UA0DxB,MAAMkO,EAAW/pC,OAAOgqC,OAExBD,EAASjqC,SAASmqC,MAAM,sBAAwBnqC,SAAS8sB,MAAQ,YACjEmd,EAASjqC,SAASmqC,MAAM,kBACxBF,EAASjqC,SAASmqC,MAAM,iBAAmBxS,EAASyS,QAAU,SAC9DH,EAASjqC,SAASmqC,MAChB,oBACEnO,GAAAA,CAAO8N,GAAWvoC,OAAO,uBACzB,SAEJ0oC,EAASjqC,SAASmqC,MAChB,oBAAsBnO,GAAAA,GAASz6B,OAAO,uBAAyB,SAEjE0oC,EAASjqC,SAASmqC,MAAMN,EAAIQ,WAC5BJ,EAASjqC,SAASmqC,MAAM,kBAExBF,EAASjqC,SAASg6B,QAClBiQ,EAASK,QAETL,EAASM,QACTN,EAASjQ,QAMLwQ,CAAa/tD,OAOjBqE,SAAU,QA4CXnG,WAAW,iBAAkBwlD,GAE7BxlD,WAAW,oBAAqBgjD,GAEhCz4C,OA5BH,sBA4BU,SAAUulD,GAChBA,EAAmBC,qBAEpB/vD,WAAW,kBAAmB87C,GAE9B58C,QAAQ,MAAOylD,GAEfp6C,OAAO43C,GACP5qC,IAAIuqC,GAEJ9hD,WAAW,oBAAqBgwD,EAAAA,GAEhCzlD,OAxCH,sBAwCU,SAAUulD,GAChBA,EAAmBC,qBAEpB/vD,WAAW,mBAAoBiwD,EAAAA,GAE/BjwD,WAAW,sBAAuBkwD,EAAAA,GAElClwD,WAAW,oBAAqBmwD,EAAAA,GAChCpoD,UAAU,cAAe,CACxBqI,YAAaggD,EACbpwD,WAAYosD,EACZ5kD,aAAc,QACd2J,SAAU,CACR4M,OAAQ,IACR7P,KAAM,IACNkgD,cAAe,OAGlBpuD,WAAW,wBAAyBosD,GACpC9jD,OAAO,mBAAoB+nD,GAC3B55C,QAAQ,mBAAoB45C,GAC5BtoD,UAAU,cAAe,CACxBqI,YAAakgD,EACbtwD,WAAYuwD,EAAAA,EACZ/oD,aAAc,QACd2J,SAAU,CACR4M,OAAQ,IACR7P,KAAM,OAGTnG,UAAU,kBAAmB,CAC5BqI,YAAaogD,EACbxwD,WAAYuuD,EACZ/mD,aAAc,QACd2J,SAAU,CACR4M,OAAQ,IACRywC,aAAc,OAGjB3sD,UAAU,iBAAiB,WAC1B,MAAO,CACL7B,WAAYuwD,EAAAA,EACZ/oD,aAAc,wBACdD,KAAM,SAAUtH,EAAQyG,GACtBzG,EAAOwwD,sBAAsBC,cAAchqD,QAIhD7E,UAAU,mBAAmB,WAC5B,MAAO,CACL7B,WAAYuwD,EAAAA,EACZ/oD,aAAc,wBACdD,KAAM,SAAUtH,EAAQyG,GACtBzG,EAAOwwD,sBAAsBC,cAAchqD,8DC3QnD5H,EAAO6xD,QAAU,SAAUC,GACzB,GAAiB,mBAANA,EACT,MAAMC,UAAUjgC,OAAOggC,GAAM,sBAC7B,OAAOA,yECHX,IAAIz+C,EAAW,EAAQ,iDAEvBrT,EAAO6xD,QAAU,SAAUC,GACzB,IAAKz+C,EAASy+C,IAAc,OAAPA,EACnB,MAAMC,UAAU,aAAejgC,OAAOggC,GAAM,mBAC5C,OAAOA,8DCLX,IAAIz+C,EAAW,EAAQ,iDAEvBrT,EAAO6xD,QAAU,SAAUC,GACzB,IAAKz+C,EAASy+C,GACZ,MAAMC,UAAUjgC,OAAOggC,GAAM,qBAC7B,OAAOA,kECJX9xD,EAAO6xD,QAAiC,oBAAhBG,aAAmD,oBAAbC,8FCA9D,IA6BIC,EAAMC,EAAaC,EA7BnBC,EAAsB,EAAQ,2DAC9BC,EAAc,EAAQ,mDACtBt0C,EAAS,EAAQ,8CACjB3K,EAAW,EAAQ,iDACnB1C,EAAM,EAAQ,2CACd4hD,EAAU,EAAQ,+CAClBC,EAA8B,EAAQ,sEACtCC,EAAW,EAAQ,gDACnBjkB,EAAiB,kEACjBkkB,EAAiB,EAAQ,+DACzB1f,EAAiB,EAAQ,+DACzB2f,EAAkB,EAAQ,yDAC1BC,EAAM,EAAQ,2CAEdC,EAAY70C,EAAO60C,UACnBC,EAAqBD,GAAaA,EAAU9wD,UAC5CgxD,EAAoB/0C,EAAO+0C,kBAC3BC,EAA6BD,GAAqBA,EAAkBhxD,UACpEkxD,EAAaJ,GAAaH,EAAeG,GACzCK,EAAsBJ,GAAsBJ,EAAeI,GAC3DK,EAAkB1/C,OAAO1R,UACzBqxD,EAAgBD,EAAgBC,cAEhCC,EAAgBV,EAAgB,eAChCW,EAAkBV,EAAI,mBACtBW,EAA0BX,EAAI,2BAE9BY,EAA4BnB,KAAyBrf,GAA4C,UAA1Buf,EAAQv0C,EAAOy1C,OACtFC,GAA0B,EAG1BC,EAA6B,CAC/Bd,UAAW,EACXzH,WAAY,EACZ2H,kBAAmB,EACnBa,WAAY,EACZC,YAAa,EACbC,WAAY,EACZC,YAAa,EACbC,aAAc,EACdC,aAAc,GAGZC,EAA8B,CAChCC,cAAe,EACfC,eAAgB,GAWdC,EAAe,SAAUvC,GAC3B,IAAKz+C,EAASy+C,GAAK,OAAO,EAC1B,IAAIwC,EAAQ/B,EAAQT,GACpB,OAAOnhD,EAAIgjD,EAA4BW,IAClC3jD,EAAIujD,EAA6BI,IAqDxC,IAAKpC,KAAQyB,GAEXvB,GADAD,EAAcn0C,EAAOk0C,KACMC,EAAYpwD,WACxBywD,EAA4BJ,EAAWmB,EAAyBpB,GAC1EqB,GAA4B,EAGnC,IAAKtB,KAAQgC,GAEX9B,GADAD,EAAcn0C,EAAOk0C,KACMC,EAAYpwD,YACxBywD,EAA4BJ,EAAWmB,EAAyBpB,GAIjF,KAAKqB,GAAkD,mBAAdP,GAA4BA,IAAersC,SAAS7kB,aAE3FkxD,EAAa,WACX,MAAMlB,UAAU,yBAEdyB,GAA2B,IAAKtB,KAAQyB,EACtC31C,EAAOk0C,IAAOlf,EAAeh1B,EAAOk0C,GAAOe,GAInD,KAAKO,IAA8BN,GAAuBA,IAAwBC,KAChFD,EAAsBD,EAAWlxD,UAC7ByxD,GAA2B,IAAKtB,KAAQyB,EACtC31C,EAAOk0C,IAAOlf,EAAeh1B,EAAOk0C,GAAMnwD,UAAWmxD,GAS7D,GAJIM,GAA6Bd,EAAeM,KAAgCE,GAC9ElgB,EAAeggB,EAA4BE,GAGzCZ,IAAgB3hD,EAAIuiD,EAAqBG,GAK3C,IAAKnB,KAJLwB,GAA0B,EAC1BllB,EAAe0kB,EAAqBG,EAAe,CAAEziD,IAAK,WACxD,OAAOyC,EAASnT,MAAQA,KAAKozD,QAAmBj/C,KAErCs/C,EAAgC31C,EAAOk0C,IAClDM,EAA4Bx0C,EAAOk0C,GAAOoB,EAAiBpB,GAI/DlyD,EAAO6xD,QAAU,CACf2B,0BAA2BA,EAC3BD,wBAAyBA,EACzBD,gBAAiBI,GAA2BJ,EAC5CiB,YApGgB,SAAUzC,GAC1B,GAAIuC,EAAavC,GAAK,OAAOA,EAC7B,MAAMC,UAAU,gCAmGhByC,uBAhG2B,SAAUC,GACrC,GAAIzhB,IAAmBogB,EAAcnxD,KAAKgxD,EAAYwB,GACpD,MAAM1C,UAAU,2CAChB,OAAO0C,GA8FTC,uBA3F2B,SAAUC,EAAK90B,EAAU+0B,GACpD,GAAKtC,EAAL,CACA,GAAIsC,EAAQ,IAAK,IAAIC,KAASlB,EAA4B,CACxD,IAAImB,EAAwB92C,EAAO62C,GACnC,GAAIC,GAAyBnkD,EAAImkD,EAAsB/yD,UAAW4yD,GAAM,WAC/DG,EAAsB/yD,UAAU4yD,GACvC,MAAOpvD,KAEN2tD,EAAoByB,KAAQC,GAC/BnC,EAASS,EAAqByB,EAAKC,EAAS/0B,EACxC2zB,GAA6BV,EAAmB6B,IAAQ90B,KAkF9Dk1B,6BA9EiC,SAAUJ,EAAK90B,EAAU+0B,GAC1D,IAAIC,EAAOC,EACX,GAAKxC,EAAL,CACA,GAAItf,EAAgB,CAClB,GAAI4hB,EAAQ,IAAKC,KAASlB,EAExB,IADAmB,EAAwB92C,EAAO62C,KACFlkD,EAAImkD,EAAuBH,GAAM,WACrDG,EAAsBH,GAC7B,MAAOpvD,IAEX,GAAK0tD,EAAW0B,KAAQC,EAKjB,OAHL,IACE,OAAOnC,EAASQ,EAAY0B,EAAKC,EAAS/0B,EAAW2zB,GAA6BP,EAAW0B,IAAQ90B,GACrG,MAAOt6B,KAGb,IAAKsvD,KAASlB,IACZmB,EAAwB92C,EAAO62C,KACAC,EAAsBH,KAAQC,GAC3DnC,EAASqC,EAAuBH,EAAK90B,KA2DzCm1B,OAvHW,SAAgBlD,GAC3B,IAAKz+C,EAASy+C,GAAK,OAAO,EAC1B,IAAIwC,EAAQ/B,EAAQT,GACpB,MAAiB,aAAVwC,GACF3jD,EAAIgjD,EAA4BW,IAChC3jD,EAAIujD,EAA6BI,IAmHtCD,aAAcA,EACdpB,WAAYA,EACZC,oBAAqBA,yDC1KvB,IAAI/D,EAAQntC,KAAKmtC,MAEb8F,EAAY,SAAUx1C,EAAOy1C,GAC/B,IAAI5lD,EAASmQ,EAAMnQ,OACf6lD,EAAShG,EAAM7/C,EAAS,GAC5B,OAAOA,EAAS,EAAI8lD,EAAc31C,EAAOy1C,GAAaG,EACpDJ,EAAUx1C,EAAMzd,MAAM,EAAGmzD,GAASD,GAClCD,EAAUx1C,EAAMzd,MAAMmzD,GAASD,GAC/BA,IAIAE,EAAgB,SAAU31C,EAAOy1C,GAKnC,IAJA,IAEIjyD,EAAS2a,EAFTtO,EAASmQ,EAAMnQ,OACfiO,EAAI,EAGDA,EAAIjO,GAAQ,CAGjB,IAFAsO,EAAIL,EACJta,EAAUwc,EAAMlC,GACTK,GAAKs3C,EAAUz1C,EAAM7B,EAAI,GAAI3a,GAAW,GAC7Cwc,EAAM7B,GAAK6B,IAAQ7B,GAEjBA,IAAML,MAAKkC,EAAM7B,GAAK3a,GAC1B,OAAOwc,GAGP41C,EAAQ,SAAUpkC,EAAMC,EAAOgkC,GAOjC,IANA,IAAII,EAAUrkC,EAAK3hB,OACfimD,EAAUrkC,EAAM5hB,OAChBkmD,EAAS,EACTC,EAAS,EACTjvD,EAAS,GAENgvD,EAASF,GAAWG,EAASF,GAC9BC,EAASF,GAAWG,EAASF,EAC/B/uD,EAAO7F,KAAKu0D,EAAUjkC,EAAKukC,GAAStkC,EAAMukC,KAAY,EAAIxkC,EAAKukC,KAAYtkC,EAAMukC,MAEjFjvD,EAAO7F,KAAK60D,EAASF,EAAUrkC,EAAKukC,KAAYtkC,EAAMukC,MAExD,OAAOjvD,GAGXxG,EAAO6xD,QAAUoD,yDC5CjB,IAAIjgD,EAAW,GAAGA,SAElBhV,EAAO6xD,QAAU,SAAUC,GACzB,OAAO98C,EAAS/S,KAAK6vD,GAAI9vD,MAAM,GAAI,6DCHrC,IAAI0zD,EAAwB,EAAQ,6DAChCC,EAAa,EAAQ,mDAGrBtC,EAFkB,EAAQ,wDAEVV,CAAgB,eAEhCiD,EAAuE,aAAnDD,EAAW,WAAc,OAAOzzD,UAArB,IAUnClC,EAAO6xD,QAAU6D,EAAwBC,EAAa,SAAU7D,GAC9D,IAAI+D,EAAGC,EAAKtvD,EACZ,YAAc6N,IAAPy9C,EAAmB,YAAqB,OAAPA,EAAc,OAEM,iBAAhDgE,EAXD,SAAUhE,EAAI/rD,GACzB,IACE,OAAO+rD,EAAG/rD,GACV,MAAOR,KAQSwwD,CAAOF,EAAIpiD,OAAOq+C,GAAKuB,IAA8ByC,EAEnEF,EAAoBD,EAAWE,GAEH,WAA3BrvD,EAASmvD,EAAWE,KAAsC,mBAAZA,EAAEG,OAAuB,YAAcxvD,6ECxB5F,IAAIyvD,EAAQ,EAAQ,6CAEpBj2D,EAAO6xD,SAAWoE,GAAM,WACtB,SAASC,KAGT,OAFAA,EAAEn0D,UAAUuiB,YAAc,KAEnB7Q,OAAOi/C,eAAe,IAAIwD,KAASA,EAAEn0D,6FCN9C,IAAIuwD,EAAc,EAAQ,mDACtB6D,EAAuB,EAAQ,8DAC/BC,EAA2B,EAAQ,kEAEvCp2D,EAAO6xD,QAAUS,EAAc,SAAU1kB,EAAQ7nC,EAAKrB,GACpD,OAAOyxD,EAAqBE,EAAEzoB,EAAQ7nC,EAAKqwD,EAAyB,EAAG1xD,KACrE,SAAUkpC,EAAQ7nC,EAAKrB,GAEzB,OADAkpC,EAAO7nC,GAAOrB,EACPkpC,yECRT5tC,EAAO6xD,QAAU,SAAUyE,EAAQ5xD,GACjC,MAAO,CACL+pC,aAAuB,EAAT6nB,GACd5nB,eAAyB,EAAT4nB,GAChBC,WAAqB,EAATD,GACZ5xD,MAAOA,iECLX,IAAIuxD,EAAQ,EAAQ,6CAGpBj2D,EAAO6xD,SAAWoE,GAAM,WAEtB,OAA8E,GAAvExiD,OAAO+6B,eAAe,GAAI,EAAG,CAAE59B,IAAK,WAAc,OAAO,KAAQ,+ECL1E,IAAIoN,EAAS,EAAQ,8CACjB3K,EAAW,EAAQ,iDAEnBkT,EAAWvI,EAAOuI,SAElBiwC,EAASnjD,EAASkT,IAAalT,EAASkT,EAAS45B,eAErDngD,EAAO6xD,QAAU,SAAUC,GACzB,OAAO0E,EAASjwC,EAAS45B,cAAc2R,GAAM,uECR/C,IAEI2E,EAFY,EAAQ,yDAEAv6C,MAAM,mBAE9Blc,EAAO6xD,UAAY4E,IAAYA,EAAQ,yECJvC,IAAIC,EAAK,EAAQ,yDAEjB12D,EAAO6xD,QAAU,eAAexuC,KAAKqzC,sECFrC,IAAIC,EAAa,EAAQ,oDAEzB32D,EAAO6xD,QAAU8E,EAAW,YAAa,cAAgB,sECFzD,IAOIz6C,EAAO06C,EAPP54C,EAAS,EAAQ,8CACjB64C,EAAY,EAAQ,yDAEpBC,EAAU94C,EAAO84C,QACjBC,EAAO/4C,EAAO+4C,KACdC,EAAWF,GAAWA,EAAQE,UAAYD,GAAQA,EAAKH,QACvDK,EAAKD,GAAYA,EAASC,GAG1BA,EAEFL,GADA16C,EAAQ+6C,EAAGj0C,MAAM,MACD,GAAK,EAAI,EAAI9G,EAAM,GAAKA,EAAM,GACrC26C,MACT36C,EAAQ26C,EAAU36C,MAAM,iBACVA,EAAM,IAAM,MACxBA,EAAQ26C,EAAU36C,MAAM,oBACb06C,EAAU16C,EAAM,IAI/Blc,EAAO6xD,QAAU+E,IAAYA,yECpB7B,IAEIM,EAFY,EAAQ,yDAEDh7C,MAAM,wBAE7Blc,EAAO6xD,UAAYqF,IAAWA,EAAO,oDCJrCl3D,EAAO6xD,QAAU,SAAUloD,GACzB,IACE,QAASA,IACT,MAAOpE,GACP,OAAO,kECJX,IAAIyY,EAAS,EAAQ,8CAEjBm5C,EAAY,SAAUC,GACxB,MAA0B,mBAAZA,EAAyBA,OAAW/iD,GAGpDrU,EAAO6xD,QAAU,SAAUwF,EAAWlR,GACpC,OAAOjkD,UAAUoN,OAAS,EAAI6nD,EAAUn5C,EAAOq5C,IAAcr5C,EAAOq5C,IAAcr5C,EAAOq5C,GAAWlR,4DCPtG,IAAImR,EAAQ,SAAUxF,GACpB,OAAOA,GAAMA,EAAG9vC,MAAQA,MAAQ8vC,GAIlC9xD,EAAO6xD,QAELyF,EAA2B,iBAAdC,YAA0BA,aACvCD,EAAuB,iBAAV7wC,QAAsBA,SAEnC6wC,EAAqB,iBAAR1pD,MAAoBA,OACjC0pD,EAAuB,iBAAV,EAAAv5C,GAAsB,EAAAA,IAEnC,WAAe,OAAO7d,KAAtB,IAAoC0mB,SAAS,cAATA,wDCbtC,IAAI4wC,EAAW,EAAQ,iDAEnB50D,EAAiB,GAAGA,eAExB5C,EAAO6xD,QAAUp+C,OAAO6Z,QAAU,SAAgBwkC,EAAI/rD,GACpD,OAAOnD,EAAeX,KAAKu1D,EAAS1F,GAAK/rD,2DCL3C/F,EAAO6xD,QAAU,mECAjB,IAAIS,EAAc,EAAQ,mDACtB2D,EAAQ,EAAQ,6CAChB9V,EAAgB,EAAQ,+DAG5BngD,EAAO6xD,SAAWS,IAAgB2D,GAAM,WAEtC,OAEQ,GAFDxiD,OAAO+6B,eAAe2R,EAAc,OAAQ,IAAK,CACtDvvC,IAAK,WAAc,OAAO,KACzB+M,qECTL,IAAI85C,EAAQ,EAAQ,oDAEhBpwC,EAAmBT,SAAS5R,SAGE,mBAAvByiD,EAAMC,gBACfD,EAAMC,cAAgB,SAAU5F,GAC9B,OAAOzqC,EAAiBplB,KAAK6vD,KAIjC9xD,EAAO6xD,QAAU4F,EAAMC,8ECXvB,IAWIC,EAAK/mD,EAAKD,EAXVinD,EAAkB,EAAQ,uDAC1B55C,EAAS,EAAQ,8CACjB3K,EAAW,EAAQ,iDACnBm/C,EAA8B,EAAQ,sEACtCqF,EAAY,EAAQ,2CACpBC,EAAS,EAAQ,oDACjBC,EAAY,EAAQ,kDACpBC,EAAa,EAAQ,mDAErBC,EAA6B,6BAC7BC,EAAUl6C,EAAOk6C,QAgBrB,GAAIN,GAAmBE,EAAOnqD,MAAO,CACnC,IAAI8pD,EAAQK,EAAOnqD,QAAUmqD,EAAOnqD,MAAQ,IAAIuqD,GAC5CC,EAAQV,EAAM7mD,IACdwnD,EAAQX,EAAM9mD,IACd0nD,EAAQZ,EAAME,IAClBA,EAAM,SAAU7F,EAAIwG,GAClB,GAAIF,EAAMn2D,KAAKw1D,EAAO3F,GAAK,MAAM,IAAIC,UAAUkG,GAG/C,OAFAK,EAASC,OAASzG,EAClBuG,EAAMp2D,KAAKw1D,EAAO3F,EAAIwG,GACfA,GAET1nD,EAAM,SAAUkhD,GACd,OAAOqG,EAAMl2D,KAAKw1D,EAAO3F,IAAO,IAElCnhD,EAAM,SAAUmhD,GACd,OAAOsG,EAAMn2D,KAAKw1D,EAAO3F,QAEtB,CACL,IAAI5mB,EAAQ6sB,EAAU,SACtBC,EAAW9sB,IAAS,EACpBysB,EAAM,SAAU7F,EAAIwG,GAClB,GAAIT,EAAU/F,EAAI5mB,GAAQ,MAAM,IAAI6mB,UAAUkG,GAG9C,OAFAK,EAASC,OAASzG,EAClBU,EAA4BV,EAAI5mB,EAAOotB,GAChCA,GAET1nD,EAAM,SAAUkhD,GACd,OAAO+F,EAAU/F,EAAI5mB,GAAS4mB,EAAG5mB,GAAS,IAE5Cv6B,EAAM,SAAUmhD,GACd,OAAO+F,EAAU/F,EAAI5mB,IAIzBlrC,EAAO6xD,QAAU,CACf8F,IAAKA,EACL/mD,IAAKA,EACLD,IAAKA,EACL6nD,QAnDY,SAAU1G,GACtB,OAAOnhD,EAAImhD,GAAMlhD,EAAIkhD,GAAM6F,EAAI7F,EAAI,KAmDnC2G,UAhDc,SAAUC,GACxB,OAAO,SAAU5G,GACf,IAAInkD,EACJ,IAAK0F,EAASy+C,KAAQnkD,EAAQiD,EAAIkhD,IAAK1iD,OAASspD,EAC9C,MAAM3G,UAAU,0BAA4B2G,EAAO,aACnD,OAAO/qD,0DCtBb3N,EAAO6xD,QAAU,SAAUC,GACzB,MAAqB,iBAAPA,EAAyB,OAAPA,EAA4B,mBAAPA,sDCDvD9xD,EAAO6xD,SAAU,6DCAjB,IAAI8E,EAAa,EAAQ,oDACrBgC,EAAoB,EAAQ,yDAEhC34D,EAAO6xD,QAAU8G,EAAoB,SAAU7G,GAC7C,MAAoB,iBAANA,GACZ,SAAUA,GACZ,IAAI8G,EAAUjC,EAAW,UACzB,MAAyB,mBAAXiC,GAAyBnlD,OAAOq+C,aAAe8G,kECN/D,IAAIC,EAAa,EAAQ,yDACrB5C,EAAQ,EAAQ,6CAGpBj2D,EAAO6xD,UAAYp+C,OAAOqlD,wBAA0B7C,GAAM,WACxD,IAAI8C,EAASC,SAGb,OAAQlnC,OAAOinC,MAAatlD,OAAOslD,aAAmBC,UAEnDA,OAAOC,MAAQJ,GAAcA,EAAa,uECX/C,IAAI76C,EAAS,EAAQ,8CACjB05C,EAAgB,EAAQ,sDAExBQ,EAAUl6C,EAAOk6C,QAErBl4D,EAAO6xD,QAA6B,mBAAZqG,GAA0B,cAAc70C,KAAKq0C,EAAcQ,4ECLnF,IAAI5F,EAAc,EAAQ,mDACtB4G,EAAiB,EAAQ,sDACzBC,EAAW,EAAQ,iDACnBC,EAAgB,EAAQ,uDAGxBC,EAAkB5lD,OAAO+6B,eAI7BqjB,EAAQwE,EAAI/D,EAAc+G,EAAkB,SAAwBxD,EAAGyD,EAAGC,GAIxE,GAHAJ,EAAStD,GACTyD,EAAIF,EAAcE,GAClBH,EAASI,GACLL,EAAgB,IAClB,OAAOG,EAAgBxD,EAAGyD,EAAGC,GAC7B,MAAOh0D,IACT,GAAI,QAASg0D,GAAc,QAASA,EAAY,MAAMxH,UAAU,2BAEhE,MADI,UAAWwH,IAAY1D,EAAEyD,GAAKC,EAAW70D,OACtCmxD,4ECnBT,IAAIllD,EAAM,EAAQ,2CACd6mD,EAAW,EAAQ,iDACnBO,EAAY,EAAQ,kDACpByB,EAA2B,EAAQ,gEAEnCC,EAAW1B,EAAU,YACrB5E,EAAkB1/C,OAAO1R,UAK7B/B,EAAO6xD,QAAU2H,EAA2B/lD,OAAOi/C,eAAiB,SAAUmD,GAE5E,OADAA,EAAI2B,EAAS3B,GACTllD,EAAIklD,EAAG4D,GAAkB5D,EAAE4D,GACH,mBAAjB5D,EAAEvxC,aAA6BuxC,aAAaA,EAAEvxC,YAChDuxC,EAAEvxC,YAAYviB,UACd8zD,aAAapiD,OAAS0/C,EAAkB,+ECfnD,IAAIgG,EAAW,EAAQ,iDACnBO,EAAqB,EAAQ,4DAMjC15D,EAAO6xD,QAAUp+C,OAAOu/B,iBAAmB,aAAe,GAAK,WAC7D,IAEI2mB,EAFAC,GAAiB,EACjBv2C,EAAO,GAEX,KAEEs2C,EAASlmD,OAAOomD,yBAAyBpmD,OAAO1R,UAAW,aAAa41D,KACjE11D,KAAKohB,EAAM,IAClBu2C,EAAiBv2C,aAAgBvhB,MACjC,MAAOyD,IACT,OAAO,SAAwBswD,EAAGiE,GAKhC,OAJAX,EAAStD,GACT6D,EAAmBI,GACfF,EAAgBD,EAAO13D,KAAK4zD,EAAGiE,GAC9BjE,EAAE5iB,UAAY6mB,EACZjE,GAfoD,QAiBzDxhD,0ECzBN,IAAIhB,EAAW,EAAQ,iDAIvBrT,EAAO6xD,QAAU,SAAU/+C,EAAOinD,GAChC,IAAIl5D,EAAIqD,EACR,GAAa,WAAT61D,GAAqD,mBAAxBl5D,EAAKiS,EAAMkC,YAA4B3B,EAASnP,EAAMrD,EAAGoB,KAAK6Q,IAAS,OAAO5O,EAC/G,GAAmC,mBAAvBrD,EAAKiS,EAAM4f,WAA2Brf,EAASnP,EAAMrD,EAAGoB,KAAK6Q,IAAS,OAAO5O,EACzF,GAAa,WAAT61D,GAAqD,mBAAxBl5D,EAAKiS,EAAMkC,YAA4B3B,EAASnP,EAAMrD,EAAGoB,KAAK6Q,IAAS,OAAO5O,EAC/G,MAAM6tD,UAAU,sGCTlB,IAAI/zC,EAAS,EAAQ,8CACjBw0C,EAA8B,EAAQ,sEACtC7hD,EAAM,EAAQ,2CACdqpD,EAAY,EAAQ,kDACpBtC,EAAgB,EAAQ,sDACxBuC,EAAsB,EAAQ,sDAE9BC,EAAmBD,EAAoBrpD,IACvCupD,EAAuBF,EAAoBzB,QAC3C4B,EAAWtoC,OAAOA,QAAQ9O,MAAM,WAEnChjB,EAAO6xD,QAAU,SAAUgE,EAAG9vD,EAAKrB,EAAOrE,GACzC,IAGIsN,EAHA0sD,IAASh6D,KAAYA,EAAQg6D,OAC7B/V,IAASjkD,KAAYA,EAAQouC,WAC7B6rB,IAAcj6D,KAAYA,EAAQi6D,YAElB,mBAAT51D,IACS,iBAAPqB,GAAoB4K,EAAIjM,EAAO,SACxC8tD,EAA4B9tD,EAAO,OAAQqB,IAE7C4H,EAAQwsD,EAAqBz1D,IAClBua,SACTtR,EAAMsR,OAASm7C,EAASjnD,KAAmB,iBAAPpN,EAAkBA,EAAM,MAG5D8vD,IAAM73C,GAIEq8C,GAEAC,GAAezE,EAAE9vD,KAC3Bu+C,GAAS,UAFFuR,EAAE9vD,GAIPu+C,EAAQuR,EAAE9vD,GAAOrB,EAChB8tD,EAA4BqD,EAAG9vD,EAAKrB,IATnC4/C,EAAQuR,EAAE9vD,GAAOrB,EAChBs1D,EAAUj0D,EAAKrB,KAUrBkiB,SAAS7kB,UAAW,YAAY,WACjC,MAAsB,mBAAR7B,MAAsBg6D,EAAiBh6D,MAAM+e,QAAUy4C,EAAcx3D,6ECpCrFF,EAAO6xD,QAAU,SAAUC,GACzB,GAAUz9C,MAANy9C,EAAiB,MAAMC,UAAU,wBAA0BD,GAC/D,OAAOA,+DCJT,IAAI9zC,EAAS,EAAQ,8CAErBhe,EAAO6xD,QAAU,SAAU9rD,EAAKrB,GAC9B,IAEE+O,OAAO+6B,eAAexwB,EAAQjY,EAAK,CAAErB,MAAOA,EAAOgqC,cAAc,EAAM6nB,UAAU,IACjF,MAAOhxD,GACPyY,EAAOjY,GAAOrB,EACd,OAAOA,+DCRX,IAAIozD,EAAS,EAAQ,8CACjBlF,EAAM,EAAQ,2CAEdl/C,EAAOokD,EAAO,QAElB93D,EAAO6xD,QAAU,SAAU9rD,GACzB,OAAO2N,EAAK3N,KAAS2N,EAAK3N,GAAO6sD,EAAI7sD,mECNvC,IAAIiY,EAAS,EAAQ,8CACjBg8C,EAAY,EAAQ,kDAEpBO,EAAS,qBACT9C,EAAQz5C,EAAOu8C,IAAWP,EAAUO,EAAQ,IAEhDv6D,EAAO6xD,QAAU4F,0DCNjB,IAAI+C,EAAU,EAAQ,+CAClB/C,EAAQ,EAAQ,qDAEnBz3D,EAAO6xD,QAAU,SAAU9rD,EAAKrB,GAC/B,OAAO+yD,EAAM1xD,KAAS0xD,EAAM1xD,QAAiBsO,IAAV3P,EAAsBA,EAAQ,MAChE,WAAY,IAAI/D,KAAK,CACtBi2D,QAAS,SACTpmC,KAAMgqC,EAAU,OAAS,SACzBC,UAAW,+FCRb,IAAIC,EAAO14C,KAAK04C,KACZvL,EAAQntC,KAAKmtC,MAIjBnvD,EAAO6xD,QAAU,SAAU8I,GACzB,OAAOnxC,MAAMmxC,GAAYA,GAAY,GAAKA,EAAW,EAAIxL,EAAQuL,GAAMC,+DCNzE,IAAIC,EAAY,EAAQ,kDAEpB74C,EAAMC,KAAKD,IAIf/hB,EAAO6xD,QAAU,SAAU8I,GACzB,OAAOA,EAAW,EAAI54C,EAAI64C,EAAUD,GAAW,kBAAoB,8DCPrE,IAAIE,EAAyB,EAAQ,gEAIrC76D,EAAO6xD,QAAU,SAAU8I,GACzB,OAAOlnD,OAAOonD,EAAuBF,mECLvC,IAAItnD,EAAW,EAAQ,iDACnBynD,EAAW,EAAQ,iDACnBC,EAAsB,EAAQ,6DAG9BC,EAFkB,EAAQ,wDAEXrI,CAAgB,eAInC3yD,EAAO6xD,QAAU,SAAU/+C,EAAOinD,GAChC,IAAK1mD,EAASP,IAAUgoD,EAAShoD,GAAQ,OAAOA,EAChD,IACItM,EADAy0D,EAAenoD,EAAMkoD,GAEzB,QAAqB3mD,IAAjB4mD,EAA4B,CAG9B,QAFa5mD,IAAT0lD,IAAoBA,EAAO,WAC/BvzD,EAASy0D,EAAah5D,KAAK6Q,EAAOinD,IAC7B1mD,EAAS7M,IAAWs0D,EAASt0D,GAAS,OAAOA,EAClD,MAAMurD,UAAU,2CAGlB,YADa19C,IAAT0lD,IAAoBA,EAAO,UACxBgB,EAAoBjoD,EAAOinD,qECpBpC,IAAImB,EAAc,EAAQ,oDACtBJ,EAAW,EAAQ,iDAIvB96D,EAAO6xD,QAAU,SAAU8I,GACzB,IAAI50D,EAAMm1D,EAAYP,EAAU,UAChC,OAAOG,EAAS/0D,GAAOA,EAAM+rB,OAAO/rB,2ECPtC,IAGIsd,EAAO,GAEXA,EALsB,EAAQ,wDAEVsvC,CAAgB,gBAGd,IAEtB3yD,EAAO6xD,QAA2B,eAAjB//B,OAAOzO,kDCPxB,IAAI9X,EAAK,EACL4vD,EAAUn5C,KAAKo5C,SAEnBp7D,EAAO6xD,QAAU,SAAU9rD,GACzB,MAAO,UAAY+rB,YAAezd,IAARtO,EAAoB,GAAKA,GAAO,QAAUwF,EAAK4vD,GAASnmD,SAAS,wECH7F,IAAIqmD,EAAgB,EAAQ,qDAE5Br7D,EAAO6xD,QAAUwJ,IACXrC,OAAOC,MACkB,iBAAnBD,OAAOsC,4ECLnB,IAAIt9C,EAAS,EAAQ,8CACjB85C,EAAS,EAAQ,8CACjBnnD,EAAM,EAAQ,2CACdiiD,EAAM,EAAQ,2CACdyI,EAAgB,EAAQ,qDACxB1C,EAAoB,EAAQ,yDAE5B4C,EAAwBzD,EAAO,OAC/BkB,EAASh7C,EAAOg7C,OAChBwC,EAAwB7C,EAAoBK,EAASA,GAAUA,EAAOyC,eAAiB7I,EAE3F5yD,EAAO6xD,QAAU,SAAUnsD,GAOvB,OANGiL,EAAI4qD,EAAuB71D,KAAW21D,GAAuD,iBAA/BE,EAAsB71D,MACnF21D,GAAiB1qD,EAAIqoD,EAAQtzD,GAC/B61D,EAAsB71D,GAAQszD,EAAOtzD,GAErC61D,EAAsB71D,GAAQ81D,EAAsB,UAAY91D,IAE3D61D,EAAsB71D,kFCjBjC,IAAIg2D,EAAsB,EAAQ,8DAC9BC,EAAW,EAAQ,iDACnBf,EAAY,EAAQ,kDAEpBrG,EAAcmH,EAAoBnH,aAKtCG,EAJ6BgH,EAAoBhH,wBAI1B,MAAM,SAAYpY,GACvC,IAAIuZ,EAAItB,EAAYr0D,MAChB07D,EAAMD,EAAS9F,EAAEvmD,QACjBusD,EAAgBjB,EAAUte,GAC1B5+B,EAAIm+C,GAAiB,EAAIA,EAAgBD,EAAMC,EACnD,OAAQn+C,EAAI,GAAKA,GAAKk+C,OAAOvnD,EAAYwhD,EAAEn4C,sFCd7C,IAAIg+C,EAAsB,EAAQ,8DAC9B19C,EAAS,EAAQ,8CACjBi4C,EAAQ,EAAQ,6CAChBkB,EAAY,EAAQ,kDACpBwE,EAAW,EAAQ,iDACnBG,EAAe,EAAQ,kDACvBC,EAAK,EAAQ,yDACbC,EAAa,EAAQ,4DACrBC,EAAK,EAAQ,yDACbC,EAAS,EAAQ,6DAEjB3H,EAAcmH,EAAoBnH,YAClCG,EAAyBgH,EAAoBhH,uBAC7Cb,EAAc71C,EAAO61C,YACrBsI,EAAatI,GAAeA,EAAY9xD,UAAU2pB,KAGlD0wC,IAA+BD,IAAelG,GAAM,WACtD,IAAIx2C,EAAQ,IAAIo0C,EAAY,GAC5Bp0C,EAAMiM,KAAK,MACXjM,EAAMiM,KAAK,OAGT2wC,IAAgBF,IAAelG,GAAM,WAEvC,GAAIgG,EAAI,OAAOA,EAAK,GACpB,GAAIF,EAAI,OAAOA,EAAK,GACpB,GAAIC,EAAY,OAAO,EACvB,GAAIE,EAAQ,OAAOA,EAAS,IAE5B,IAEI5f,EAAOggB,EAFP78C,EAAQ,IAAIo0C,EAAY,KACxB0I,EAAWz6D,MAAM,KAGrB,IAAKw6C,EAAQ,EAAGA,EAAQ,IAAKA,IAC3BggB,EAAMhgB,EAAQ,EACd78B,EAAM68B,GAAS,IAAMA,EACrBigB,EAASjgB,GAASA,EAAQ,EAAIggB,EAAM,EAOtC,IAJA78C,EAAMiM,MAAK,SAAU/N,EAAGmB,GACtB,OAAQnB,EAAI,EAAI,IAAMmB,EAAI,EAAI,MAG3Bw9B,EAAQ,EAAGA,EAAQ,IAAKA,IAC3B,GAAI78B,EAAM68B,KAAWigB,EAASjgB,GAAQ,OAAO,KAkBjDoY,EAAuB,QAAQ,SAAcQ,GAC3C,IAAIz1C,EAAQvf,KAEZ,QADkBmU,IAAd6gD,GAAyBiC,EAAUjC,GACnCmH,EAAa,OAAOF,EAAWl6D,KAAKwd,EAAOy1C,GAE/CX,EAAY90C,GACZ,IAEI68B,EAFAkgB,EAAcb,EAASl8C,EAAMnQ,QAC7BqW,EAAQ7jB,MAAM06D,GAGlB,IAAKlgB,EAAQ,EAAGA,EAAQkgB,EAAalgB,IACnC32B,EAAM22B,GAAS78B,EAAM68B,GAKvB,IAFA32B,EAAQm2C,EAAar8C,EA5BF,SAAUy1C,GAC7B,OAAO,SAAU1lD,EAAGitD,GAClB,YAAkBpoD,IAAd6gD,GAAiCA,EAAU1lD,EAAGitD,IAAM,EAEpDA,GAAMA,GAAW,EAEjBjtD,GAAMA,EAAU,EACV,IAANA,GAAiB,IAANitD,EAAgB,EAAIjtD,EAAI,GAAK,EAAIitD,EAAI,EAAI,GAAK,EACtDjtD,EAAIitD,GAoBeC,CAAexH,IAEtC5Y,EAAQ,EAAGA,EAAQkgB,EAAalgB,IACnC78B,EAAM68B,GAAS32B,EAAM22B,GAGvB,OAAO78B,KACL48C,GAAeD,wECpFnB,EAAQ,4ICERp8D,EAAO6xD,QAAU,WACf,GAA0B,iBAAf0F,WACT,OAAOA,WAGT,IAAIx5C,EAEJ,IAGEA,EAAI7d,MAAQ,IAAI0mB,SAAS,cAAb,GACZ,MAAOpE,GAEP,GAAsB,iBAAXiE,OACT,OAAOA,OAIT,GAAoB,iBAAT7Y,KACT,OAAOA,KAIT,QAAsB,IAAX,EAAAmQ,EACT,OAAO,EAAAA,EAIX,OAAOA,EA5BQ,wECHjB,WAoBE7d,QAjBM4d,EAAO,SAON,KAFU,EAAF,WACL,OAAQA,EAAK6+C,eAWjB,WAWJ,SAASzqD,EAAQhO,GAEb,MAAmC,mBAA5B,GAAK8Q,SAAS/S,KAAKiC,GAG9B,SAAS04D,EAAa14D,GAElB,QAAQgO,EAAQhO,IAAuB,iBAARA,IAAsBA,GAASA,aAAe24D,MAAW34D,aAAeuuB,MAQ3G,SAASqqC,IAEL,MAA2B,mBAAb7S,SAGlB,SAAS8S,IAEL,GAAID,IACA,OAAO,IAAI7S,SAkCnB,SAAS+S,EAAmBC,EAAY58D,EAAS68D,EAAUC,GAEvD,IAAI7gB,EAAQ,EAEZ,IAAK,IAAIv2C,KAAOk3D,EAAY,CAExB,GAAIA,EAAWr6D,eAAemD,GAAM,CAEhC,IAAIq3D,EAAWD,GAAap3D,EACxBrB,EAAQrE,EAAQirB,QAAQ2xC,EAAWl3D,IAevC,GAbIo3D,GAAaP,EAAaK,KAC1BG,EAAWD,EAAY,IAAMp3D,EAAM,KAGnCo3D,GAAajrD,EAAQ+qD,KAGjBG,EADAlrD,EAAQxN,IAAUrE,EAAQg9D,qBACfF,EAAY,IAAM7gB,EAAQ,IAE1B6gB,EAAY,MAI3BjrD,EAAQxN,IAAUk4D,EAAal4D,GAE/Bs4D,EAAmBt4D,EAAOrE,EAAS68D,EAAUE,QAE1C,GAAI14D,aAAiB44D,SAExB,IAAK,IAAI1/C,EAAI,EAAGA,EAAIlZ,EAAM4K,OAAQsO,IAC9Bs/C,EAAS3iC,OAAO6iC,EAAW,IAAMx/C,EAAI,IAAKlZ,EAAM2b,KAAKzC,SAElDlZ,aAAiBm4D,KAExBK,EAAS3iC,OAAO6iC,EAAU14D,EAAOA,EAAMgB,MAEhChB,aAAiB+tB,KAExByqC,EAAS3iC,OAAO6iC,EAAU14D,EAAM64D,gBAEb,OAAV74D,GAAkBrE,EAAQm9D,mBAAgC,OAAV94D,SAA6B2P,IAAV3P,GAE5Ew4D,EAAS3iC,OAAO6iC,EAAU14D,GAGlC43C,IAEJ,OAAO4gB,EAEX,OAhFA,SAAiBD,EAAY58D,GAEzB,GAAIA,GAAWA,EAAQo9D,iBAEnB,GAnB8B,mBAmBDp9D,EAAQo9D,gBAnBlBljC,OAqBf,KAAM,qDAEP,IAAKuiC,IAER,KAAM,8FA3Bd,IA0CQY,EA5DG,CAgDc,CACjBD,gBAAiBV,IACjBM,sBAAsB,EACtBG,mBAAmB,EACnBlyC,QAAS,SAAS5mB,GACd,MAAqB,kBAAVA,GACCA,EAAQ,IAAK,IAElBA,IAIkCrE,GAAW,IA5DlCyO,QAAO,SAAU6uD,EAAOC,GAI9C,OAHAnqD,OAAOC,KAAKkqD,GAAe38D,SAAQ,SAAU48D,GACzCF,EAAME,GAAaD,EAAcC,MAE9BF,IACR,IAyDH,OAAOX,EAAmBC,EAAYS,EAAeA,EAAcD,kBA5EjCr9D,IACjC,QAFM,OAEN,oECDD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,8FAA8F/6C,MAClG,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,4DAA4Dj7C,MAClE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1Co7C,cAAe,SACfC,KAAM,SAAUvrD,GACZ,MAAO,QAAQuQ,KAAKvQ,IAExBwrD,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACDE,EAAU,KAAO,KAEjBA,EAAU,KAAO,MAGhCC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,eACTC,SAAU,eACVC,QAAS,iBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,YACNpiD,EAAG,mBACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,YACJC,EAAG,SACHC,GAAI,SACJzmC,EAAG,SACH0mC,GAAI,SACJC,EAAG,WACHC,GAAI,YACJxD,EAAG,UACHyD,GAAI,WAERC,uBAAwB,kBACxBC,QAAS,SAAUC,GACf,OACIA,GACY,IAAXA,GAA2B,IAAXA,GAAgBA,GAAU,GAAK,MAAQ,OAGhEC,KAAM,CACFC,IAAK,EACLC,IAAK,KArEyBpgE,CAAQ,EAAQ,8FCOlD,SAAWmiD,GAAU,aAIzB,IAAIke,EAAa,SAAUhgD,GACnB,OAAa,IAANA,EACD,EACM,IAANA,EACA,EACM,IAANA,EACA,EACAA,EAAI,KAAO,GAAKA,EAAI,KAAO,GAC3B,EACAA,EAAI,KAAO,GACX,EACA,GAEVigD,EAAU,CACNpjD,EAAG,CACC,eACA,cACA,CAAC,UAAW,WACZ,UACA,WACA,YAEJpI,EAAG,CACC,eACA,cACA,CAAC,UAAW,WACZ,WACA,WACA,YAEJ2qD,EAAG,CACC,cACA,aACA,CAAC,SAAU,UACX,WACA,UACA,WAEJxmC,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,UACA,WACA,UAEJ2mC,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,UACA,UACA,UAEJvD,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,WACA,WACA,WAGRkE,EAAY,SAAUC,GAClB,OAAO,SAAUP,EAAQQ,EAAep7D,EAAQq7D,GAC5C,IAAIzK,EAAIoK,EAAWJ,GACfnvD,EAAMwvD,EAAQE,GAAGH,EAAWJ,IAIhC,OAHU,IAANhK,IACAnlD,EAAMA,EAAI2vD,EAAgB,EAAI,IAE3B3vD,EAAI+D,QAAQ,MAAOorD,KAGlCtC,EAAS,CACL,QACA,QACA,OACA,QACA,MACA,OACA,SACA,MACA,SACA,SACA,SACA,UAGGxb,EAAOub,aAAa,QAAS,CACpCC,OAAQA,EACRC,YAAaD,EACbE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,wCAAwCl7C,MAAM,KAC7Dm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVZ,cAAe,MACfC,KAAM,SAAUvrD,GACZ,MAAO,MAAQA,GAEnBwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,IAEA,KAGf/B,SAAU,CACNC,QAAS,wBACTC,QAAS,uBACTC,SAAU,uBACVC,QAAS,sBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,SACNpiD,EAAGqjD,EAAU,KACbhB,GAAIgB,EAAU,KACdzrD,EAAGyrD,EAAU,KACbf,GAAIe,EAAU,KACdd,EAAGc,EAAU,KACbb,GAAIa,EAAU,KACdtnC,EAAGsnC,EAAU,KACbZ,GAAIY,EAAU,KACdX,EAAGW,EAAU,KACbV,GAAIU,EAAU,KACdlE,EAAGkE,EAAU,KACbT,GAAIS,EAAU,MAElBO,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCqrD,KAAM,CACFC,IAAK,EACLC,IAAK,KAtJyBpgE,CAAQ,EAAQ,8FCDlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wEAAwE/6C,MAC5E,KAEJg7C,YAAa,wEAAwEh7C,MACjF,KAEJi7C,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,wCAAwCl7C,MAAM,KAC7Dm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,wBACTC,QAAS,sBACTC,SAAU,uBACVC,QAAS,sBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,OACHqiD,GAAI,WACJzqD,EAAG,QACH0qD,GAAI,WACJC,EAAG,OACHC,GAAI,WACJzmC,EAAG,MACH0mC,GAAI,UACJC,EAAG,MACHC,GAAI,UACJxD,EAAG,MACHyD,GAAI,YAERI,KAAM,CACFC,IAAK,EACLC,IAAK,MApDyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPV,EAAa,SAAUhgD,GACnB,OAAa,IAANA,EACD,EACM,IAANA,EACA,EACM,IAANA,EACA,EACAA,EAAI,KAAO,GAAKA,EAAI,KAAO,GAC3B,EACAA,EAAI,KAAO,GACX,EACA,GAEVigD,EAAU,CACNpjD,EAAG,CACC,eACA,cACA,CAAC,UAAW,WACZ,UACA,WACA,YAEJpI,EAAG,CACC,eACA,cACA,CAAC,UAAW,WACZ,WACA,WACA,YAEJ2qD,EAAG,CACC,cACA,aACA,CAAC,SAAU,UACX,WACA,UACA,WAEJxmC,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,UACA,WACA,UAEJ2mC,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,UACA,UACA,UAEJvD,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,WACA,WACA,WAGRkE,EAAY,SAAUC,GAClB,OAAO,SAAUP,EAAQQ,EAAep7D,EAAQq7D,GAC5C,IAAIzK,EAAIoK,EAAWJ,GACfnvD,EAAMwvD,EAAQE,GAAGH,EAAWJ,IAIhC,OAHU,IAANhK,IACAnlD,EAAMA,EAAI2vD,EAAgB,EAAI,IAE3B3vD,EAAI+D,QAAQ,MAAOorD,KAGlCtC,EAAS,CACL,QACA,SACA,OACA,QACA,OACA,QACA,QACA,QACA,SACA,SACA,SACA,UAGGxb,EAAOub,aAAa,QAAS,CACpCC,OAAQA,EACRC,YAAaD,EACbE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,wCAAwCl7C,MAAM,KAC7Dm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVZ,cAAe,MACfC,KAAM,SAAUvrD,GACZ,MAAO,MAAQA,GAEnBwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,IAEA,KAGf/B,SAAU,CACNC,QAAS,wBACTC,QAAS,uBACTC,SAAU,uBACVC,QAAS,sBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,SACNpiD,EAAGqjD,EAAU,KACbhB,GAAIgB,EAAU,KACdzrD,EAAGyrD,EAAU,KACbf,GAAIe,EAAU,KACdd,EAAGc,EAAU,KACbb,GAAIa,EAAU,KACdtnC,EAAGsnC,EAAU,KACbZ,GAAIY,EAAU,KACdX,EAAGW,EAAU,KACbV,GAAIU,EAAU,KACdlE,EAAGkE,EAAU,KACbT,GAAIS,EAAU,MAElBS,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCisD,WAAY,SAAUz7D,GAClB,OAAOA,EACFwP,QAAQ,OAAO,SAAUiH,GACtB,OAAOilD,EAAUjlD,MAEpBjH,QAAQ,KAAM,MAEvBqrD,KAAM,CACFC,IAAK,EACLC,IAAK,MAzKyBpgE,CAAQ,EAAQ,8FCIlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wEAAwE/6C,MAC5E,KAEJg7C,YAAa,wEAAwEh7C,MACjF,KAEJi7C,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,wCAAwCl7C,MAAM,KAC7Dm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,wBACTC,QAAS,sBACTC,SAAU,uBACVC,QAAS,sBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,OACHqiD,GAAI,WACJzqD,EAAG,QACH0qD,GAAI,WACJC,EAAG,OACHC,GAAI,WACJzmC,EAAG,MACH0mC,GAAI,UACJC,EAAG,MACHC,GAAI,UACJxD,EAAG,MACHyD,GAAI,YAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KApDyBpgE,CAAQ,EAAQ,8FCElD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGF9e,EAAOub,aAAa,QAAS,CACpCC,OAAQ,6EAA6E/6C,MACjF,KAEJg7C,YAAa,6EAA6Eh7C,MACtF,KAEJi7C,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,wCAAwCl7C,MAAM,KAC7Dm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVZ,cAAe,MACfC,KAAM,SAAUvrD,GACZ,MAAO,MAAQA,GAEnBwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,IAEA,KAGf/B,SAAU,CACNC,QAAS,wBACTC,QAAS,sBACTC,SAAU,uBACVC,QAAS,sBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,OACHqiD,GAAI,WACJzqD,EAAG,QACH0qD,GAAI,WACJC,EAAG,OACHC,GAAI,WACJzmC,EAAG,MACH0mC,GAAI,UACJC,EAAG,MACHC,GAAI,UACJxD,EAAG,MACHyD,GAAI,YAERkB,SAAU,SAAU37D,GAChB,OAAOA,EACFwP,QAAQ,iBAAiB,SAAUiH,GAChC,OAAOmlD,EAAUnlD,MAEpBjH,QAAQ,KAAM,MAEvBisD,WAAY,SAAUz7D,GAClB,OAAOA,EACFwP,QAAQ,OAAO,SAAUiH,GACtB,OAAOilD,EAAUjlD,MAEpBjH,QAAQ,KAAM,MAEvBqrD,KAAM,CACFC,IAAK,EACLC,IAAK,KAtGyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,yEAAyE/6C,MAC7E,KAEJg7C,YAAa,yEAAyEh7C,MAClF,KAEJi7C,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,wCAAwCl7C,MAAM,KAC7Dm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,wBACTC,QAAS,sBACTC,SAAU,uBACVC,QAAS,sBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,OACHqiD,GAAI,WACJzqD,EAAG,QACH0qD,GAAI,WACJC,EAAG,OACHC,GAAI,WACJzmC,EAAG,MACH0mC,GAAI,UACJC,EAAG,MACHC,GAAI,UACJxD,EAAG,MACHyD,GAAI,YAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KApDyBpgE,CAAQ,EAAQ,2FCKlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAETZ,EAAa,SAAUhgD,GACnB,OAAa,IAANA,EACD,EACM,IAANA,EACA,EACM,IAANA,EACA,EACAA,EAAI,KAAO,GAAKA,EAAI,KAAO,GAC3B,EACAA,EAAI,KAAO,GACX,EACA,GAEVigD,EAAU,CACNpjD,EAAG,CACC,eACA,cACA,CAAC,UAAW,WACZ,UACA,WACA,YAEJpI,EAAG,CACC,eACA,cACA,CAAC,UAAW,WACZ,WACA,WACA,YAEJ2qD,EAAG,CACC,cACA,aACA,CAAC,SAAU,UACX,WACA,UACA,WAEJxmC,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,UACA,WACA,UAEJ2mC,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,UACA,UACA,UAEJvD,EAAG,CACC,aACA,WACA,CAAC,QAAS,SACV,WACA,WACA,WAGRkE,EAAY,SAAUC,GAClB,OAAO,SAAUP,EAAQQ,EAAep7D,EAAQq7D,GAC5C,IAAIzK,EAAIoK,EAAWJ,GACfnvD,EAAMwvD,EAAQE,GAAGH,EAAWJ,IAIhC,OAHU,IAANhK,IACAnlD,EAAMA,EAAI2vD,EAAgB,EAAI,IAE3B3vD,EAAI+D,QAAQ,MAAOorD,KAGlCtC,EAAS,CACL,QACA,SACA,OACA,QACA,OACA,QACA,QACA,QACA,SACA,SACA,SACA,UAGCxb,EAAOub,aAAa,KAAM,CAC/BC,OAAQA,EACRC,YAAaD,EACbE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,wCAAwCl7C,MAAM,KAC7Dm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVZ,cAAe,MACfC,KAAM,SAAUvrD,GACZ,MAAO,MAAQA,GAEnBwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,IAEA,KAGf/B,SAAU,CACNC,QAAS,wBACTC,QAAS,uBACTC,SAAU,uBACVC,QAAS,sBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,SACNpiD,EAAGqjD,EAAU,KACbhB,GAAIgB,EAAU,KACdzrD,EAAGyrD,EAAU,KACbf,GAAIe,EAAU,KACdd,EAAGc,EAAU,KACbb,GAAIa,EAAU,KACdtnC,EAAGsnC,EAAU,KACbZ,GAAIY,EAAU,KACdX,EAAGW,EAAU,KACbV,GAAIU,EAAU,KACdlE,EAAGkE,EAAU,KACbT,GAAIS,EAAU,MAElBS,SAAU,SAAU37D,GAChB,OAAOA,EACFwP,QAAQ,iBAAiB,SAAUiH,GAChC,OAAOmlD,EAAUnlD,MAEpBjH,QAAQ,KAAM,MAEvBisD,WAAY,SAAUz7D,GAClB,OAAOA,EACFwP,QAAQ,OAAO,SAAUiH,GACtB,OAAOilD,EAAUjlD,MAEpBjH,QAAQ,KAAM,MAEvBqrD,KAAM,CACFC,IAAK,EACLC,IAAK,MAzLyBpgE,CAAQ,EAAQ,2FCClD,SAAWmiD,GAAU,aAIzB,IAAI+e,EAAW,CACX,EAAG,QACH,EAAG,QACH,EAAG,QACH,GAAI,QACJ,GAAI,QACJ,EAAG,OACH,EAAG,OACH,GAAI,OACJ,GAAI,OACJ,EAAG,QACH,EAAG,QACH,IAAK,QACL,EAAG,OACH,EAAG,QACH,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,SAGC/e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,+EAA+E/6C,MACnF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,qEAAqEj7C,MAC3E,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,kBACTC,QAAS,kBACTC,SAAU,+BACVC,QAAS,aACTC,SAAU,+BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,WACNpiD,EAAG,kBACHqiD,GAAI,YACJzqD,EAAG,aACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,QACJxD,EAAG,SACHyD,GAAI,SAER9B,cAAe,0BACfC,KAAM,SAAUvrD,GACZ,MAAO,mBAAmBuQ,KAAKvQ,IAEnCwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,OACAA,EAAO,GACP,QACAA,EAAO,GACP,SAEA,SAGfb,uBAAwB,wCACxBC,QAAS,SAAUC,GACf,GAAe,IAAXA,EAEA,OAAOA,EAAS,QAEpB,IAAI1iD,EAAI0iD,EAAS,GAGjB,OAAOA,GAAUiB,EAAS3jD,IAAM2jD,EAFvBjB,EAAS,IAAO1iD,IAEsB2jD,EADvCjB,GAAU,IAAM,IAAM,QAGlCC,KAAM,CACFC,IAAK,EACLC,IAAK,KAnGyBpgE,CAAQ,EAAQ,2FCKlD,SAAWmiD,GAAU,aAYzB,SAASgf,EAAuBlB,EAAQQ,EAAe96D,GASnD,MAAY,MAARA,EACO86D,EAAgB,UAAY,UACpB,MAAR96D,EACA86D,EAAgB,UAAY,UAE5BR,EAAS,KAtBFmB,GAsB6BnB,EArB3CoB,EAQS,CACT9B,GAAIkB,EAAgB,yBAA2B,yBAC/CjB,GAAIiB,EAAgB,yBAA2B,yBAC/Cf,GAAIe,EAAgB,yBAA2B,yBAC/Cd,GAAI,iBACJE,GAAI,uBACJC,GAAI,kBAOgCn6D,GArBvBid,MAAM,KAChBw+C,EAAM,IAAO,GAAKA,EAAM,KAAQ,GACjCC,EAAM,GACND,EAAM,IAAM,GAAKA,EAAM,IAAM,IAAMA,EAAM,IAAM,IAAMA,EAAM,KAAO,IAClEC,EAAM,GACNA,EAAM,IANhB,IAAsBD,EACdC,EAyBClf,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,CACJj2C,OAAQ,uGAAuG9E,MAC3G,KAEJ0+C,WAAY,qGAAqG1+C,MAC7G,MAGRg7C,YAAa,0DAA0Dh7C,MACnE,KAEJi7C,SAAU,CACNn2C,OAAQ,0DAA0D9E,MAC9D,KAEJ0+C,WAAY,0DAA0D1+C,MAClE,KAEJ2+C,SAAU,+CAEdzD,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,iBACJC,IAAK,wBACLC,KAAM,+BAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,gBACTE,QAAS,eACTD,SAAU,WACN,MAAO,mBAEXE,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,0BACX,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,2BAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,UACNpiD,EAAG,kBACHpI,EAAGqsD,EACH3B,GAAI2B,EACJ1B,EAAG0B,EACHzB,GAAIyB,EACJloC,EAAG,QACH0mC,GAAIwB,EACJvB,EAAG,QACHC,GAAIsB,EACJ9E,EAAG,MACHyD,GAAIqB,GAERnD,cAAe,yBACfC,KAAM,SAAUvrD,GACZ,MAAO,iBAAiBuQ,KAAKvQ,IAEjCwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,OACAA,EAAO,GACP,SACAA,EAAO,GACP,MAEA,UAGfb,uBAAwB,mBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACL,IAAK,IACL,IAAK,IACD,OAAQxB,EAAS,IAAO,GAAKA,EAAS,IAAO,GACzCA,EAAS,KAAQ,IACjBA,EAAS,KAAQ,GAEfA,EAAS,KADTA,EAAS,KAEnB,IAAK,IACD,OAAOA,EAAS,MACpB,QACI,OAAOA,IAGnBC,KAAM,CACFC,IAAK,EACLC,IAAK,KAzIyBpgE,CAAQ,EAAQ,2FCClD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,oFAAoF/6C,MACxF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,yDAAyDj7C,MAC/D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,YACHC,GAAI,cACJC,IAAK,mBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,cACTC,QAAS,cACTC,SAAU,cACVC,QAAS,eACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,yBACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,0BAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,WACNpiD,EAAG,kBACHqiD,GAAI,aACJzqD,EAAG,SACH0qD,GAAI,YACJC,EAAG,MACHC,GAAI,UACJzmC,EAAG,MACH0mC,GAAI,UACJ+B,EAAG,UACHC,GAAI,aACJ/B,EAAG,QACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,aAERC,uBAAwB,8BACxBC,QAAS,SAAUC,GACf,IAAI2B,EAAY3B,EAAS,GACrB4B,EAAc5B,EAAS,IAC3B,OAAe,IAAXA,EACOA,EAAS,MACO,IAAhB4B,EACA5B,EAAS,MACT4B,EAAc,IAAMA,EAAc,GAClC5B,EAAS,MACK,IAAd2B,EACA3B,EAAS,MACK,IAAd2B,EACA3B,EAAS,MACK,IAAd2B,GAAiC,IAAdA,EACnB3B,EAAS,MAETA,EAAS,OAGxBC,KAAM,CACFC,IAAK,EACLC,IAAK,KArFyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,8IAA8I/6C,MAClJ,KAEJg7C,YAAa,iDAAiDh7C,MAAM,KACpEi7C,SAAU,+CAA+Cj7C,MAAM,KAC/Dk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,2BACJC,IAAK,wCACLC,KAAM,8CAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,iBACTC,SAAU,qBACVC,QAAS,iBACTC,SAAU,yBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,aACNpiD,EAAG,kBACHqiD,GAAI,aACJzqD,EAAG,eACH0qD,GAAI,YACJC,EAAG,aACHC,GAAI,UACJzmC,EAAG,aACH0mC,GAAI,UACJC,EAAG,aACHC,GAAI,UACJxD,EAAG,YACHyD,GAAI,UAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KAjDyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGF9e,EAAOub,aAAa,QAAS,CACpCC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,mEAAmEh7C,MAC5E,KAEJi7C,SAAU,4DAA4Dj7C,MAClE,KAEJk7C,cAAe,uCAAuCl7C,MAAM,KAC5Dm7C,YAAa,kCAAkCn7C,MAAM,KACrD07C,eAAgB,CACZC,GAAI,aACJC,IAAK,gBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,0BACLC,KAAM,iCAEVC,SAAU,CACNC,QAAS,UACTC,QAAS,gBACTC,SAAU,WACVC,QAAS,aACTC,SAAU,gBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,SACNpiD,EAAG,eACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,WACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,SACJxD,EAAG,SACHyD,GAAI,UAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAIzBkiD,cAAe,uCACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,QAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,QAAb1C,GAEa,SAAbA,EADA0C,EAGa,UAAb1C,EACA0C,GAAQ,EAAIA,EAAOA,EAAO,GACb,UAAb1C,GAEa,YAAbA,EADA0C,EAAO,QACX,GAKX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,MACAA,EAAO,EACP,MACAA,EAAO,GACP,OACAA,EAAO,GACP,QACAA,EAAO,GACP,QACAA,EAAO,GACP,UAEA,OAGfV,KAAM,CACFC,IAAK,EACLC,IAAK,KA9HyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,mEAAmEh7C,MAC5E,KAEJi7C,SAAU,4DAA4Dj7C,MAClE,KAEJk7C,cAAe,uCAAuCl7C,MAAM,KAC5Dm7C,YAAa,kCAAkCn7C,MAAM,KACrD07C,eAAgB,CACZC,GAAI,aACJC,IAAK,gBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,0BACLC,KAAM,iCAEVC,SAAU,CACNC,QAAS,UACTC,QAAS,gBACTC,SAAU,WACVC,QAAS,aACTC,SAAU,gBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,SACNpiD,EAAG,eACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,WACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,SACJxD,EAAG,SACHyD,GAAI,UAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAGzBkiD,cAAe,2BACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAGO,QAAb1C,GAAsB0C,GAAQ,GACjB,UAAb1C,GAAwB0C,EAAO,GACnB,UAAb1C,EAEO0C,EAAO,GAEPA,GAGf1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,MACAA,EAAO,GACP,OACAA,EAAO,GACP,QACAA,EAAO,GACP,QAEA,OAGfV,KAAM,CACFC,IAAK,EACLC,IAAK,KApHyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qJAAqJ/6C,MACzJ,KAEJg7C,YAAa,iEAAiEh7C,MAC1E,KAEJm/C,iBAAkB,gBAClBC,kBAAkB,EAClBnE,SAAU,gFAAgFj7C,MACtF,KAEJk7C,cAAe,oDAAoDl7C,MAC/D,KAEJm7C,YAAa,6BAA6Bn7C,MAAM,KAChD07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,sBACLC,KAAM,6BAEVC,SAAU,CACNC,QAAS,cACTC,QAAS,cACTC,SAAU,wBACVC,QAAS,YACTC,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAAG,QACHqiD,GAAI,YACJzqD,EAAG,aACH0qD,GAAI,WACJC,EAAG,cACHC,GAAI,YACJzmC,EAAG,WACH0mC,GAAI,UACJC,EAAG,YACHC,GAAI,UACJxD,EAAG,UACHyD,GAAI,SAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAGzBkiD,cAAe,wCACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAGO,WAAb1C,GAAyB0C,GAAQ,GACpB,YAAb1C,GAA0B0C,EAAO,GACrB,YAAb1C,EAEO0C,EAAO,GAEPA,GAGf1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,SACAA,EAAO,GACP,UACAA,EAAO,GACP,UACAA,EAAO,GACP,UAEA,UAGfV,KAAM,CACFC,IAAK,EACLC,IAAK,KAxHyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,SAAS8f,EAAyBhC,EAAQQ,EAAe96D,GAMrD,OAAOs6D,EAAS,IAoBpB,SAAkBv9C,EAAMu9C,GACpB,OAAe,IAAXA,EAKR,SAAsBv9C,GAClB,IAAIw/C,EAAgB,CAChBptD,EAAG,IACH4J,EAAG,IACHua,EAAG,KAEP,YAAsChlB,IAAlCiuD,EAAcx/C,EAAKnd,OAAO,IACnBmd,EAEJw/C,EAAcx/C,EAAKnd,OAAO,IAAMmd,EAAKqX,UAAU,GAb3CooC,CAAaz/C,GAEjBA,EAxBe0/C,CALT,CACT5C,GAAI,WACJK,GAAI,MACJF,GAAI,UAE8Bh6D,GAAMs6D,GAchD,SAASoC,EAAWpC,GAChB,OAAIA,EAAS,EACFoC,EAAWpC,EAAS,IAExBA,EAoBX,IAAIqC,EAAc,CACV,QACA,cACA,QACA,QACA,QACA,cACA,QACA,QACA,QACA,QACA,OACA,SAEJC,EAAc,6IAqBdC,EAAmB,CACf,OACA,OACA,eACA,QACA,OACA,OACA,QAGCrgB,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,gFAAgF/6C,MACpF,KAEJg7C,YAAa,mDAAmDh7C,MAAM,KACtEi7C,SAAU,6CAA6Cj7C,MAAM,KAC7Dk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,wBAAwBn7C,MAAM,KAC3C6/C,cAAeD,EACfE,kBArCoB,CAChB,QACA,QACA,WACA,iBACA,SACA,WACA,YA+BJC,mBA7BqB,CACjB,QACA,QACA,QACA,QACA,QACA,QACA,SAuBJH,iBAAkBA,EAElBD,YAAaA,EACbR,iBAAkBQ,EAClBK,kBA7CoB,wFA8CpBC,uBA7CyB,2DA8CzBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAElBhE,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,sBACJC,IAAK,4BACLC,KAAM,mCAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,qBACTC,SAAU,eACVC,QAAS,gBACTC,SAAU,qBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,SACNpiD,EAAG,wBACHqiD,GAAI,YACJzqD,EAAG,cACH0qD,GAAIyC,EACJxC,EAAG,SACHC,GAAI,SACJzmC,EAAG,YACH0mC,GAAIsC,EACJrC,EAAG,SACHC,GAAIoC,EACJ5F,EAAG,WACHyD,GApIR,SAAiCG,GAC7B,OAAQoC,EAAWpC,IACf,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,OAAOA,EAAS,SACpB,QACI,OAAOA,EAAS,YA6HxBF,uBAAwB,kBACxBC,QAAS,SAAUC,GAEf,OAAOA,GADiB,IAAXA,EAAe,KAAO,QAGvCC,KAAM,CACFC,IAAK,EACLC,IAAK,GAETpC,cAAe,YACfC,KAAM,SAAU58C,GACZ,MAAiB,SAAVA,GAEX68C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAOuC,EAAO,GAAK,OAAS,UAnKE5gE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIzB,SAAS6gB,EAAU/C,EAAQQ,EAAe96D,GACtC,IAAIS,EAAS65D,EAAS,IACtB,OAAQt6D,GACJ,IAAK,KAQD,OANIS,GADW,IAAX65D,EACU,UACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,UAEA,WAGlB,IAAK,IACD,OAAOQ,EAAgB,eAAiB,eAC5C,IAAK,KAQD,OANIr6D,GADW,IAAX65D,EACU,SACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,SAEA,UAGlB,IAAK,IACD,OAAOQ,EAAgB,YAAc,cACzC,IAAK,KAQD,OANIr6D,GADW,IAAX65D,EACU,MACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,OAEA,QAGlB,IAAK,KAMD,OAJI75D,GADW,IAAX65D,EACU,MAEA,QAGlB,IAAK,KAQD,OANI75D,GADW,IAAX65D,EACU,SACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,UAEA,WAGlB,IAAK,KAQD,OANI75D,GADW,IAAX65D,EACU,SACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,SAEA,WAMjB9d,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qFAAqF/6C,MACzF,KAEJg7C,YAAa,8DAA8Dh7C,MACvE,KAEJo/C,kBAAkB,EAClBnE,SAAU,4DAA4Dj7C,MAClE,KAEJk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,eACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,eACTC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,wBACX,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,sBACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,oBAGnBvC,QAAS,eACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACL,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,2BACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,yBAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAAG,cACHqiD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAGuD,EACHtD,GAAIsD,EACJ/pC,EAAG,MACH0mC,GAAIqD,EACJpD,EAAG,SACHC,GAAImD,EACJ3G,EAAG,SACHyD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAlJyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,CACJ2D,WAAY,oFAAoF1+C,MAC5F,KAEJ8E,OAAQ,qHAAqH9E,MACzH,KAEJ2+C,SAAU,mBAEd3D,YAAa,8DAA8Dh7C,MACvE,KAEJo/C,kBAAkB,EAClBnE,SAAU,8DAA8Dj7C,MACpE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,mBACJuE,GAAI,aACJtE,IAAK,gCACLuE,IAAK,mBACLtE,KAAM,qCACNuE,KAAM,wBAEVtE,SAAU,CACNC,QAAS,WACL,MAAO,YAA+B,IAAjBh/D,KAAKq+D,QAAgB,MAAQ,MAAQ,QAE9DY,QAAS,WACL,MAAO,YAA+B,IAAjBj/D,KAAKq+D,QAAgB,MAAQ,MAAQ,QAE9Da,SAAU,WACN,MAAO,YAA+B,IAAjBl/D,KAAKq+D,QAAgB,MAAQ,MAAQ,QAE9Dc,QAAS,WACL,MAAO,YAA+B,IAAjBn/D,KAAKq+D,QAAgB,MAAQ,MAAQ,QAE9De,SAAU,WACN,MACI,wBACkB,IAAjBp/D,KAAKq+D,QAAgB,MAAQ,MAC9B,QAGRgB,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,QACNpiD,EAAG,aACHqiD,GAAI,YACJzqD,EAAG,WACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJC,EAAG,SACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERC,uBAAwB,qBACxBC,QAAS,SAAUC,EAAQwB,GACvB,IAAI2B,EACW,IAAXnD,EACM,IACW,IAAXA,EACA,IACW,IAAXA,EACA,IACW,IAAXA,EACA,IACA,IAIV,MAHe,MAAXwB,GAA6B,MAAXA,IAClB2B,EAAS,KAENnD,EAASmD,GAEpBlD,KAAM,CACFC,IAAK,EACLC,IAAK,KA/FyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAIwb,EAAS,oFAAoF/6C,MACzF,KAEJg7C,EAAc,kDAAkDh7C,MAAM,KACtE0/C,EAAc,CACV,QACA,QACA,QACA,QACA,QACA,yBACA,4BACA,QACA,QACA,QACA,QACA,SAIJC,EAAc,wJAElB,SAASc,EAAOhjD,GACZ,OAAOA,EAAI,GAAKA,EAAI,GAAoB,MAAZA,EAAI,IAEpC,SAAS2iD,EAAU/C,EAAQQ,EAAe96D,EAAK+6D,GAC3C,IAAIt6D,EAAS65D,EAAS,IACtB,OAAQt6D,GACJ,IAAK,IACD,OAAO86D,GAAiBC,EAAW,aAAe,gBACtD,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,UAAY,UAEvC75D,EAAS,YAExB,IAAK,IACD,OAAOq6D,EAAgB,SAAWC,EAAW,SAAW,UAC5D,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,SAAW,SAEtC75D,EAAS,WAExB,IAAK,IACD,OAAOq6D,EAAgB,SAAWC,EAAW,SAAW,UAC5D,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,SAAW,SAEtC75D,EAAS,WAExB,IAAK,IACD,OAAOq6D,GAAiBC,EAAW,MAAQ,OAC/C,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,MAAQ,OAEnC75D,EAAS,MAExB,IAAK,IACD,OAAOq6D,GAAiBC,EAAW,QAAU,UACjD,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,SAAW,UAEtC75D,EAAS,SAExB,IAAK,IACD,OAAOq6D,GAAiBC,EAAW,MAAQ,QAC/C,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,OAAS,OAEpC75D,EAAS,QAKvB+7C,EAAOub,aAAa,KAAM,CAC/BC,OAAQA,EACRC,YAAaA,EACb2E,YAAaA,EACbR,iBAAkBQ,EAGlBK,kBAAmB,uKACnBC,uBAAwB,sDACxBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAClBzE,SAAU,mDAAmDj7C,MAAM,KACnEk7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,eACJC,IAAK,oBACLC,KAAM,yBACNrsC,EAAG,cAEPssC,SAAU,CACNC,QAAS,cACTC,QAAS,eACTC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,kBACX,KAAK,EACL,KAAK,EACD,MAAO,kBACX,KAAK,EACD,MAAO,mBACX,KAAK,EACD,MAAO,oBACX,KAAK,EACD,MAAO,iBACX,KAAK,EACD,MAAO,oBAGnBvC,QAAS,eACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACD,MAAO,wBACX,KAAK,EACL,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,wBACX,KAAK,EACL,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,0BAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG8lD,EACHzD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAGuD,EACHtD,GAAIsD,EACJ/pC,EAAG+pC,EACHrD,GAAIqD,EACJpD,EAAGoD,EACHnD,GAAImD,EACJ3G,EAAG2G,EACHlD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAzKyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,gEAAgE/6C,MACpE,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,oEAAoEj7C,MAC1E,KAEJk7C,cAAe,6BAA6Bl7C,MAAM,KAClDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,sCACJC,IAAK,6CACLC,KAAM,oDAEVC,SAAU,CACNC,QAAS,sBACTC,QAAS,sBACTE,QAAS,sBACTD,SAAU,4BACVE,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SAAU+D,GAMd,OAAOA,GALK,UAAU75D,KAAK65D,GACrB,MACA,QAAQ75D,KAAK65D,GACb,MACA,QAGV9D,KAAM,YACNpiD,EAAG,iBACHqiD,GAAI,aACJzqD,EAAG,YACH0qD,GAAI,WACJC,EAAG,YACHC,GAAI,WACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,WACHC,GAAI,UACJxD,EAAG,UACHyD,GAAI,UAERC,uBAAwB,cACxBC,QAAS,SACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA5DyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yFAAyF/6C,MAC7F,KAEJg7C,YAAa,qDAAqDh7C,MAC9D,KAEJi7C,SAAU,+EAA+Ej7C,MACrF,KAEJk7C,cAAe,+BAA+Bl7C,MAAM,KACpDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EAEpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,gBACTC,SAAU,eACVC,QAAS,eACTC,SAAU,wBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,WACNpiD,EAAG,mBACHqiD,GAAI,YACJzqD,EAAG,QACH0qD,GAAI,WACJC,EAAG,MACHC,GAAI,SACJzmC,EAAG,UACH0mC,GAAI,aACJC,EAAG,MACHC,GAAI,SACJxD,EAAG,WACHyD,GAAI,cAERC,uBAAwB,mCAExBC,QAAS,SAAUC,GACf,IACImD,EAAS,GAiCb,OAlCQnD,EAyBA,GAEAmD,EADM,KA1BNnD,GA0BkB,KA1BlBA,GA0B8B,KA1B9BA,GA0B0C,KA1B1CA,GA0BsD,MA1BtDA,EA2BS,MAEA,MA7BTA,EA+BO,IACXmD,EA9BS,CACL,GACA,KACA,KACA,MACA,MACA,KACA,KACA,KACA,MACA,MACA,MACA,KACA,MACA,KACA,KACA,MACA,KACA,KACA,MACA,KACA,OAvBAnD,IAkCDA,EAASmD,GAEpBlD,KAAM,CACFC,IAAK,EACLC,IAAK,KA9FyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,sFAAsF/6C,MAC1F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,qDAAqDj7C,MAAM,KACrEk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,eACJC,IAAK,qBACLC,KAAM,sCAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,oBACTC,SAAU,mBACVC,QAAS,iBACTC,SAAU,qBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAAG,cACHqiD,GAAI,cACJzqD,EAAG,WACH0qD,GAAI,cACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJC,EAAG,WACHC,GAAI,aACJxD,EAAG,QACHyD,GAAI,SAERC,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAnDyBpgE,CAAQ,EAAQ,8FCMlD,SAAWmiD,GAAU,aAIzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIh5C,EAAS,CACT5S,EAAG,CAAC,cAAe,gBACnB2qD,EAAG,CAAC,cAAe,gBACnBxmC,EAAG,CAAC,UAAW,aACf0mC,GAAI,CAACM,EAAS,QAASA,EAAS,UAChCyB,EAAG,CAAC,aAAc,eAClB9B,EAAG,CAAC,YAAa,eACjBC,GAAI,CAACI,EAAS,UAAWA,EAAS,YAClC5D,EAAG,CAAC,WAAY,cAChByD,GAAI,CAACG,EAAS,SAAUA,EAAS,YAErC,OAAOQ,EAAgB/4C,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAG7Cw8C,EAAOub,aAAa,QAAS,CACpCC,OAAQ,qFAAqF/6C,MACzF,KAEJg7C,YAAa,6DAA6Dh7C,MACtE,KAEJo/C,kBAAkB,EAClBnE,SAAU,8DAA8Dj7C,MACpE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,eACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,sBACTK,SAAU,IACVJ,QAAS,uBACTC,SAAU,qBACVC,QAAS,wBACTC,SAAU,gCAEdE,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,oBACHqiD,GAAI,cACJzqD,EAAGwuD,EACH9D,GAAI,aACJC,EAAG6D,EACH5D,GAAI,aACJzmC,EAAGqqC,EACH3D,GAAI2D,EACJ5B,EAAG4B,EACH3B,GAAI,YACJ/B,EAAG0D,EACHzD,GAAIyD,EACJjH,EAAGiH,EACHxD,GAAIwD,GAERvD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA1EyBpgE,CAAQ,EAAQ,8FCAlD,SAAWmiD,GAAU,aAIzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIh5C,EAAS,CACT5S,EAAG,CAAC,cAAe,gBACnB2qD,EAAG,CAAC,cAAe,gBACnBxmC,EAAG,CAAC,UAAW,aACf0mC,GAAI,CAACM,EAAS,QAASA,EAAS,UAChCyB,EAAG,CAAC,aAAc,eAClB9B,EAAG,CAAC,YAAa,eACjBC,GAAI,CAACI,EAAS,UAAWA,EAAS,YAClC5D,EAAG,CAAC,WAAY,cAChByD,GAAI,CAACG,EAAS,SAAUA,EAAS,YAErC,OAAOQ,EAAgB/4C,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAG7Cw8C,EAAOub,aAAa,QAAS,CACpCC,OAAQ,qFAAqF/6C,MACzF,KAEJg7C,YAAa,6DAA6Dh7C,MACtE,KAEJo/C,kBAAkB,EAClBnE,SAAU,8DAA8Dj7C,MACpE,KAEJk7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,eACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,sBACTK,SAAU,IACVJ,QAAS,uBACTC,SAAU,qBACVC,QAAS,wBACTC,SAAU,gCAEdE,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,oBACHqiD,GAAI,cACJzqD,EAAGwuD,EACH9D,GAAI,aACJC,EAAG6D,EACH5D,GAAI,aACJzmC,EAAGqqC,EACH3D,GAAI2D,EACJ5B,EAAG4B,EACH3B,GAAI,YACJ/B,EAAG0D,EACHzD,GAAIyD,EACJjH,EAAGiH,EACHxD,GAAIwD,GAERvD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA1EyBpgE,CAAQ,EAAQ,2FCKlD,SAAWmiD,GAAU,aAIzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIh5C,EAAS,CACT5S,EAAG,CAAC,cAAe,gBACnB2qD,EAAG,CAAC,cAAe,gBACnBxmC,EAAG,CAAC,UAAW,aACf0mC,GAAI,CAACM,EAAS,QAASA,EAAS,UAChCyB,EAAG,CAAC,aAAc,eAClB9B,EAAG,CAAC,YAAa,eACjBC,GAAI,CAACI,EAAS,UAAWA,EAAS,YAClC5D,EAAG,CAAC,WAAY,cAChByD,GAAI,CAACG,EAAS,SAAUA,EAAS,YAErC,OAAOQ,EAAgB/4C,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAG/Cw8C,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qFAAqF/6C,MACzF,KAEJg7C,YAAa,6DAA6Dh7C,MACtE,KAEJo/C,kBAAkB,EAClBnE,SAAU,8DAA8Dj7C,MACpE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,eACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,sBACTK,SAAU,IACVJ,QAAS,uBACTC,SAAU,qBACVC,QAAS,wBACTC,SAAU,gCAEdE,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,oBACHqiD,GAAI,cACJzqD,EAAGwuD,EACH9D,GAAI,aACJC,EAAG6D,EACH5D,GAAI,aACJzmC,EAAGqqC,EACH3D,GAAI2D,EACJ5B,EAAG4B,EACH3B,GAAI,YACJ/B,EAAG0D,EACHzD,GAAIyD,EACJjH,EAAGiH,EACHxD,GAAIwD,GAERvD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA1EyBpgE,CAAQ,EAAQ,2FCClD,SAAWmiD,GAAU,aAIzB,IAAIwb,EAAS,CACL,WACA,aACA,SACA,WACA,KACA,OACA,SACA,WACA,eACA,aACA,aACA,cAEJE,EAAW,CACP,WACA,OACA,WACA,OACA,aACA,SACA,YAGC1b,EAAOub,aAAa,KAAM,CAC/BC,OAAQA,EACRC,YAAaD,EACbE,SAAUA,EACVC,cAAeD,EACfE,YAAa,qCAAqCn7C,MAAM,KACxD07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,WACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVZ,cAAe,QACfC,KAAM,SAAUvrD,GACZ,MAAO,OAASA,GAEpBwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,KAEA,MAGf/B,SAAU,CACNC,QAAS,cACTC,QAAS,cACTC,SAAU,UACVC,QAAS,cACTC,SAAU,qBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,cACRC,KAAM,YACNpiD,EAAG,iBACHqiD,GAAI,cACJzqD,EAAG,WACH0qD,GAAI,YACJC,EAAG,aACHC,GAAI,cACJzmC,EAAG,WACH0mC,GAAI,YACJC,EAAG,SACHC,GAAI,UACJxD,EAAG,WACHyD,GAAI,aAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCisD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCqrD,KAAM,CACFC,IAAK,EACLC,IAAK,MAxFyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAWhBA,EAAOub,aAAa,KAAM,CAC/B6F,mBAAoB,qHAAqH3gD,MACrI,KAEJ4gD,iBAAkB,qHAAqH5gD,MACnI,KAEJ+6C,OAAQ,SAAU8F,EAAgB/7C,GAC9B,OAAK+7C,EAGiB,iBAAX/7C,GACP,IAAIzE,KAAKyE,EAAOqS,UAAU,EAAGrS,EAAO1Z,QAAQ,UAGrClO,KAAK4jE,kBAAkBD,EAAeE,SAEtC7jE,KAAK8jE,oBAAoBH,EAAeE,SARxC7jE,KAAK8jE,qBAWpBhG,YAAa,oDAAoDh7C,MAAM,KACvEi7C,SAAU,yDAAyDj7C,MAC/D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1Cs7C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACDE,EAAU,KAAO,KAEjBA,EAAU,KAAO,MAGhCJ,KAAM,SAAUvrD,GACZ,MAAyC,OAAjCA,EAAQ,IAAIsU,cAAc,IAEtCg3C,cAAe,gBACfM,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,qBACLC,KAAM,4BAEViF,WAAY,CACR/E,QAAS,iBACTC,QAAS,gBACTC,SAAU,eACVC,QAAS,eACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACD,MAAO,gCACX,QACI,MAAO,mCAGnBrC,SAAU,KAEdN,SAAU,SAAUl5D,EAAKm+D,GACrB,IApEYpxD,EAoER0wD,EAAStjE,KAAKikE,YAAYp+D,GAC1Bw4D,EAAQ2F,GAAOA,EAAI3F,QAIvB,OAzEYzrD,EAsEG0wD,GApEM,oBAAb58C,UAA4B9T,aAAiB8T,UACX,sBAA1CnT,OAAO1R,UAAUiT,SAAS/S,KAAK6Q,MAoE3B0wD,EAASA,EAAOnhE,MAAM6hE,IAEnBV,EAAOvuD,QAAQ,KAAMspD,EAAQ,IAAO,EAAI,MAAQ,SAE3DiB,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG,oBACHqiD,GAAI,kBACJzqD,EAAG,YACH0qD,GAAI,WACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,WACH0mC,GAAI,WACJC,EAAG,aACHC,GAAI,WACJxD,EAAG,cACHyD,GAAI,aAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAtGyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,mBACTC,SAAU,eACVC,QAAS,oBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,OAGlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KAlEyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,eACJC,IAAK,sBACLC,KAAM,6BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,mBACTC,SAAU,eACVC,QAAS,oBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,SA7DgB1e,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,mBACTC,SAAU,eACVC,QAAS,oBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,OAGlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KAlEyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,mBACTC,SAAU,eACVC,QAAS,oBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,OAGlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KAlEyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,mBACTC,SAAU,eACVC,QAAS,oBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,SA7DgB1e,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,mBACTC,SAAU,eACVC,QAAS,oBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,OAGlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KAlEyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,mBACTC,SAAU,eACVC,QAAS,oBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,OAGlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KAlEyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,mBACTC,SAAU,eACVC,QAAS,oBACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,OAGlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KAlEyBpgE,CAAQ,EAAQ,2FCMlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,6FAA6F/6C,MACjG,KAEJg7C,YAAa,oDAAoDh7C,MAAM,KACvEi7C,SAAU,qDAAqDj7C,MAAM,KACrEk7C,cAAe,gCAAgCl7C,MAAM,KACrDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,4BACJC,IAAK,kCACLC,KAAM,2CACNuE,KAAM,uCAEVnF,cAAe,cACfC,KAAM,SAAUvrD,GACZ,MAAyC,MAAlCA,EAAMnN,OAAO,GAAGyhB,eAE3Bk3C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACDE,EAAU,SAAW,SAErBA,EAAU,SAAW,UAGpCQ,SAAU,CACNC,QAAS,iBACTC,QAAS,iBACTC,SAAU,gBACVC,QAAS,iBACTC,SAAU,2BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,WACNpiD,EAAG,kBACHqiD,GAAI,cACJzqD,EAAG,aACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,WACH0mC,GAAI,WACJC,EAAG,aACHC,GAAI,aACJxD,EAAG,WACHyD,GAAI,YAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA/DyBpgE,CAAQ,EAAQ,8FCDlD,SAAWmiD,GAAU,aAIzB,IAAI6hB,EAAiB,8DAA8DphD,MAC3E,KAEJg7C,EAAc,kDAAkDh7C,MAAM,KACtE0/C,EAAc,CACV,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SAEJC,EAAc,mLAEPpgB,EAAOub,aAAa,QAAS,CACpCC,OAAQ,2FAA2F/6C,MAC/F,KAEJg7C,YAAa,SAAU9oD,EAAG4S,GACtB,OAAK5S,EAEM,QAAQmO,KAAKyE,GACbk2C,EAAY9oD,EAAE6uD,SAEdK,EAAelvD,EAAE6uD,SAJjBK,GAOfzB,YAAaA,EACbR,iBAAkBQ,EAClBK,kBAAmB,+FACnBC,uBAAwB,0FACxBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAClBzE,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,+BACLC,KAAM,sCAEVC,SAAU,CACNC,QAAS,WACL,MAAO,aAAgC,IAAjBh/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE3DY,QAAS,WACL,MAAO,gBAAmC,IAAjBj/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE9Da,SAAU,WACN,MAAO,cAAiC,IAAjBl/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE5Dc,QAAS,WACL,MAAO,cAAiC,IAAjBn/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE5De,SAAU,WACN,MACI,0BACkB,IAAjBp/D,KAAKq+D,QAAgB,IAAM,IAC5B,QAGRgB,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG,gBACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJ+B,EAAG,aACHC,GAAI,aACJ/B,EAAG,SACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAvGyBpgE,CAAQ,EAAQ,8FCIlD,SAAWmiD,GAAU,aAIzB,IAAI6hB,EAAiB,8DAA8DphD,MAC3E,KAEJg7C,EAAc,kDAAkDh7C,MAAM,KACtE0/C,EAAc,CACV,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SAEJC,EAAc,mLAEPpgB,EAAOub,aAAa,QAAS,CACpCC,OAAQ,2FAA2F/6C,MAC/F,KAEJg7C,YAAa,SAAU9oD,EAAG4S,GACtB,OAAK5S,EAEM,QAAQmO,KAAKyE,GACbk2C,EAAY9oD,EAAE6uD,SAEdK,EAAelvD,EAAE6uD,SAJjBK,GAOfzB,YAAaA,EACbR,iBAAkBQ,EAClBK,kBAAmB,+FACnBC,uBAAwB,0FACxBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAClBzE,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,6BACLC,KAAM,oCAEVC,SAAU,CACNC,QAAS,WACL,MAAO,aAAgC,IAAjBh/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE3DY,QAAS,WACL,MAAO,gBAAmC,IAAjBj/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE9Da,SAAU,WACN,MAAO,cAAiC,IAAjBl/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE5Dc,QAAS,WACL,MAAO,cAAiC,IAAjBn/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE5De,SAAU,WACN,MACI,0BACkB,IAAjBp/D,KAAKq+D,QAAgB,IAAM,IAC5B,QAGRgB,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG,gBACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJ+B,EAAG,aACHC,GAAI,aACJ/B,EAAG,SACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,GAET6D,YAAa,mBAzGqBjkE,CAAQ,EAAQ,8FCIlD,SAAWmiD,GAAU,aAIzB,IAAI6hB,EAAiB,8DAA8DphD,MAC3E,KAEJg7C,EAAc,kDAAkDh7C,MAAM,KACtE0/C,EAAc,CACV,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SAEJC,EAAc,mLAEPpgB,EAAOub,aAAa,QAAS,CACpCC,OAAQ,2FAA2F/6C,MAC/F,KAEJg7C,YAAa,SAAU9oD,EAAG4S,GACtB,OAAK5S,EAEM,QAAQmO,KAAKyE,GACbk2C,EAAY9oD,EAAE6uD,SAEdK,EAAelvD,EAAE6uD,SAJjBK,GAOfzB,YAAaA,EACbR,iBAAkBQ,EAClBK,kBAAmB,+FACnBC,uBAAwB,0FACxBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAClBzE,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,+BACLC,KAAM,sCAEVC,SAAU,CACNC,QAAS,WACL,MAAO,aAAgC,IAAjBh/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE3DY,QAAS,WACL,MAAO,gBAAmC,IAAjBj/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE9Da,SAAU,WACN,MAAO,cAAiC,IAAjBl/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE5Dc,QAAS,WACL,MAAO,cAAiC,IAAjBn/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE5De,SAAU,WACN,MACI,0BACkB,IAAjBp/D,KAAKq+D,QAAgB,IAAM,IAC5B,QAGRgB,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG,gBACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJ+B,EAAG,aACHC,GAAI,aACJ/B,EAAG,SACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAvGyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIzB,IAAI6hB,EAAiB,8DAA8DphD,MAC3E,KAEJg7C,EAAc,kDAAkDh7C,MAAM,KACtE0/C,EAAc,CACV,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SAEJC,EAAc,mLAETpgB,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,2FAA2F/6C,MAC/F,KAEJg7C,YAAa,SAAU9oD,EAAG4S,GACtB,OAAK5S,EAEM,QAAQmO,KAAKyE,GACbk2C,EAAY9oD,EAAE6uD,SAEdK,EAAelvD,EAAE6uD,SAJjBK,GAOfzB,YAAaA,EACbR,iBAAkBQ,EAClBK,kBAAmB,+FACnBC,uBAAwB,0FACxBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAClBzE,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,6BACLC,KAAM,oCAEVC,SAAU,CACNC,QAAS,WACL,MAAO,aAAgC,IAAjBh/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE3DY,QAAS,WACL,MAAO,gBAAmC,IAAjBj/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE9Da,SAAU,WACN,MAAO,cAAiC,IAAjBl/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE5Dc,QAAS,WACL,MAAO,cAAiC,IAAjBn/D,KAAKq+D,QAAgB,IAAM,IAAM,QAE5De,SAAU,WACN,MACI,0BACkB,IAAjBp/D,KAAKq+D,QAAgB,IAAM,IAC5B,QAGRgB,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG,gBACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJ+B,EAAG,aACHC,GAAI,aACJ/B,EAAG,SACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,GAET6D,YAAa,mBAzGqBjkE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIh5C,EAAS,CACTxK,EAAG,CAAC,eAAgB,cAAe,iBACnCqiD,GAAI,CAACU,EAAS,UAAWA,EAAS,YAClCnrD,EAAG,CAAC,aAAc,aAClB0qD,GAAI,CAACS,EAAS,UAAWA,EAAS,YAClCR,EAAG,CAAC,YAAa,YAAa,YAC9BC,GAAI,CAACO,EAAS,SAAUA,EAAS,UACjChnC,EAAG,CAAC,YAAa,YACjB2mC,EAAG,CAAC,UAAW,WAAY,WAC3BC,GAAI,CAACI,EAAS,OAAQA,EAAS,SAC/B5D,EAAG,CAAC,YAAa,QAAS,aAC1ByD,GAAI,CAACG,EAAS,SAAUA,EAAS,YAErC,OAAIQ,EACO/4C,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAElD+6D,EAAWh5C,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAG1Cw8C,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,6FAA6F/6C,MACjG,KAEJg7C,YAAa,6DAA6Dh7C,MACtE,KAEJi7C,SAAU,iEAAiEj7C,MACvE,KAEJk7C,cAAe,gBAAgBl7C,MAAM,KACrCm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,eACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,aACTC,QAAS,cACTC,SAAU,qBACVC,QAAS,aACTC,SAAU,oBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,YACNpiD,EAAGomD,EACH/D,GAAI+D,EACJxuD,EAAGwuD,EACH9D,GAAI8D,EACJ7D,EAAG6D,EACH5D,GAAI4D,EACJrqC,EAAGqqC,EACH3D,GAAI,WACJC,EAAG0D,EACHzD,GAAIyD,EACJjH,EAAGiH,EACHxD,GAAIwD,GAERvD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA3EyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,+FAA+F/6C,MACnG,KAEJg7C,YAAa,8DAA8Dh7C,MACvE,KAEJo/C,kBAAkB,EAClBnE,SAAU,sEAAsEj7C,MAC5E,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,0BACJC,IAAK,gCACLC,KAAM,sCACNrsC,EAAG,WACH0wC,GAAI,oBACJC,IAAK,0BACLC,KAAM,gCAEVtE,SAAU,CACNC,QAAS,kBACTC,QAAS,mBACTC,SAAU,gBACVC,QAAS,kBACTC,SAAU,0BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,WACNpiD,EAAG,iBACHqiD,GAAI,aACJzqD,EAAG,aACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,WACH0mC,GAAI,UACJC,EAAG,eACHC,GAAI,cACJxD,EAAG,WACHyD,GAAI,WAERC,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA7DyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,wEAAwE/6C,MAC5E,KAEJg7C,YAAa,wEAAwEh7C,MACjF,KAEJi7C,SAAU,qDAAoEj7C,MAC1E,KAEJk7C,cAAe,qDAAoEl7C,MAC/E,KAEJm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVZ,cAAe,wBACfC,KAAM,SAAUvrD,GACZ,MAAO,aAAauQ,KAAKvQ,IAE7BwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,aAEA,cAGf/B,SAAU,CACNC,QAAS,kBACTC,QAAS,iBACTC,SAAU,iBACVC,QAAS,kBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,YACHqiD,GAAI,WACJzqD,EAAG,WACH0qD,GAAI,WACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,SACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,SACJxD,EAAG,SACHyD,GAAI,UAERkB,SAAU,SAAU37D,GAChB,OAAOA,EACFwP,QAAQ,UAAU,SAAUiH,GACzB,OAAOmlD,EAAUnlD,MAEpBjH,QAAQ,KAAM,MAEvBisD,WAAY,SAAUz7D,GAClB,OAAOA,EACFwP,QAAQ,OAAO,SAAUiH,GACtB,OAAOilD,EAAUjlD,MAEpBjH,QAAQ,KAAM,MAEvBkrD,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,MA5GyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI+hB,EAAc,wEAAwEthD,MAClF,KAEJuhD,EAAgB,CACZ,QACA,QACA,SACA,SACA,SACA,SACA,SACAD,EAAY,GACZA,EAAY,GACZA,EAAY,IAEpB,SAASlB,EAAU/C,EAAQQ,EAAe96D,EAAK+6D,GAC3C,IAAIt6D,EAAS,GACb,OAAQT,GACJ,IAAK,IACD,OAAO+6D,EAAW,oBAAsB,kBAC5C,IAAK,KACDt6D,EAASs6D,EAAW,WAAa,WACjC,MACJ,IAAK,IACD,OAAOA,EAAW,WAAa,WACnC,IAAK,KACDt6D,EAASs6D,EAAW,WAAa,YACjC,MACJ,IAAK,IACD,OAAOA,EAAW,SAAW,QACjC,IAAK,KACDt6D,EAASs6D,EAAW,SAAW,SAC/B,MACJ,IAAK,IACD,OAAOA,EAAW,SAAW,QACjC,IAAK,KACDt6D,EAASs6D,EAAW,SAAW,SAC/B,MACJ,IAAK,IACD,OAAOA,EAAW,YAAc,WACpC,IAAK,KACDt6D,EAASs6D,EAAW,YAAc,YAClC,MACJ,IAAK,IACD,OAAOA,EAAW,SAAW,QACjC,IAAK,KACDt6D,EAASs6D,EAAW,SAAW,SAIvC,OAEJ,SAAsBT,EAAQS,GAC1B,OAAOT,EAAS,GACVS,EACIyD,EAAclE,GACdiE,EAAYjE,GAChBA,EARGmE,CAAanE,EAAQS,GAAY,IAAMt6D,EAW3C+7C,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,2GAA2G/6C,MAC/G,KAEJg7C,YAAa,uEAAuEh7C,MAChF,KAEJi7C,SAAU,qEAAqEj7C,MAC3E,KAEJk7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,mBACJC,IAAK,gCACLC,KAAM,sCACNrsC,EAAG,WACH0wC,GAAI,cACJC,IAAK,2BACLC,KAAM,iCAEVtE,SAAU,CACNC,QAAS,oBACTC,QAAS,sBACTC,SAAU,gBACVC,QAAS,mBACTC,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,YACNpiD,EAAG8lD,EACHzD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAGuD,EACHtD,GAAIsD,EACJ/pC,EAAG+pC,EACHrD,GAAIqD,EACJpD,EAAGoD,EACHnD,GAAImD,EACJ3G,EAAG2G,EACHlD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAvHyBpgE,CAAQ,EAAQ,4FCIlD,SAAWmiD,GAAU,aAIfA,EAAOub,aAAa,MAAO,CACjCC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,yDAAyDj7C,MAC/D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,wBAAwBn7C,MAAM,KAC3C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,YACHC,GAAI,eACJC,IAAK,qBACLC,KAAM,6BAEVC,SAAU,CACNC,QAAS,oBACTC,QAAS,gBACTC,SAAU,0BACVC,QAAS,eACTC,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,gBACRC,KAAM,mBACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,eACH0qD,GAAI,YACJC,EAAG,aACHC,GAAI,UACJzmC,EAAG,aACH0mC,GAAI,UACJC,EAAG,cACHC,GAAI,WACJxD,EAAG,aACHyD,GAAI,WAERC,uBAAwB,UACxBC,QAAS,SAAUC,GACf,OAAOA,GAEXC,KAAM,CACFC,IAAK,EACLC,IAAK,KAvDyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qFAAqF/6C,MACzF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,4EAA4Ej7C,MAClF,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,oBACTC,SAAU,gBACVC,QAAS,kBACTC,SAAU,wBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,YACNpiD,EAAG,YACHqiD,GAAI,cACJzqD,EAAG,eACH0qD,GAAI,cACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,YACH0mC,GAAI,WACJC,EAAG,cACHC,GAAI,aACJxD,EAAG,UACHyD,GAAI,SAERC,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KArDyBpgE,CAAQ,EAAQ,8FCElD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,uFAAuF/6C,MAC3F,KAEJg7C,YAAa,iEAAiEh7C,MAC1E,KAEJo/C,kBAAkB,EAClBnE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,qBACTC,QAAS,gBACTC,SAAU,cACVC,QAAS,cACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,YACNpiD,EAAG,oBACHqiD,GAAI,cACJzqD,EAAG,aACH0qD,GAAI,aACJC,EAAG,YACHC,GAAI,YACJzmC,EAAG,UACH0mC,GAAI,WACJC,EAAG,UACHC,GAAI,UACJxD,EAAG,QACHyD,GAAI,UAERC,uBAAwB,gBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GAEJ,QACA,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,MACL,IAAK,IACD,OAAOxB,GAAqB,IAAXA,EAAe,KAAO,KAG3C,IAAK,IACL,IAAK,IACD,OAAOA,GAAqB,IAAXA,EAAe,KAAO,SAlEjBjgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,uFAAuF/6C,MAC3F,KAEJg7C,YAAa,iEAAiEh7C,MAC1E,KAEJo/C,kBAAkB,EAClBnE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,qBACTC,QAAS,gBACTC,SAAU,cACVC,QAAS,cACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,YACNpiD,EAAG,oBACHqiD,GAAI,cACJzqD,EAAG,aACH0qD,GAAI,aACJC,EAAG,YACHC,GAAI,YACJzmC,EAAG,UACH0mC,GAAI,WACJC,EAAG,UACHC,GAAI,UACJxD,EAAG,QACHyD,GAAI,UAERC,uBAAwB,gBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GAEJ,QACA,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,MACL,IAAK,IACD,OAAOxB,GAAqB,IAAXA,EAAe,KAAO,KAG3C,IAAK,IACL,IAAK,IACD,OAAOA,GAAqB,IAAXA,EAAe,KAAO,OAGnDC,KAAM,CACFC,IAAK,EACLC,IAAK,KAvEyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAEIogB,EAAc,yKACdD,EAAc,CACV,SACA,SACA,SACA,QACA,QACA,SACA,SACA,SACA,SACA,QACA,QACA,SAGCngB,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,uFAAuF/6C,MAC3F,KAEJg7C,YAAa,iEAAiEh7C,MAC1E,KAEJ2/C,YAAaA,EACbR,iBAAkBQ,EAClBK,kBA3BoB,2FA4BpBC,uBA3ByB,oFA4BzBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAClBzE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,qBACTC,QAAS,gBACTC,SAAU,cACVC,QAAS,cACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,YACNpiD,EAAG,oBACHqiD,GAAI,cACJzqD,EAAG,aACH0qD,GAAI,aACJC,EAAG,YACHC,GAAI,YACJzmC,EAAG,UACH0mC,GAAI,WACJ+B,EAAG,cACHC,GAAI,cACJ/B,EAAG,UACHC,GAAI,UACJxD,EAAG,QACHyD,GAAI,UAERC,uBAAwB,eACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GAIJ,IAAK,IACD,OAAOxB,GAAqB,IAAXA,EAAe,KAAO,IAG3C,QACA,IAAK,IACL,IAAK,IACL,IAAK,MACL,IAAK,IACD,OAAOA,GAAqB,IAAXA,EAAe,KAAO,KAG3C,IAAK,IACL,IAAK,IACD,OAAOA,GAAqB,IAAXA,EAAe,KAAO,OAGnDC,KAAM,CACFC,IAAK,EACLC,IAAK,KAtGyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAIkiB,EAAsB,6DAA6DzhD,MAC/E,KAEJ0hD,EAAyB,kDAAkD1hD,MACvE,KAGCu/B,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,iGAAiG/6C,MACrG,KAEJg7C,YAAa,SAAU9oD,EAAG4S,GACtB,OAAK5S,EAEM,QAAQmO,KAAKyE,GACb48C,EAAuBxvD,EAAE6uD,SAEzBU,EAAoBvvD,EAAE6uD,SAJtBU,GAOfrC,kBAAkB,EAClBnE,SAAU,wDAAwDj7C,MAC9D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,gBACTC,SAAU,eACVC,QAAS,iBACTC,SAAU,wBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,SACNpiD,EAAG,mBACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,UACH0mC,GAAI,WACJC,EAAG,aACHC,GAAI,aACJxD,EAAG,WACHyD,GAAI,cAERC,uBAAwB,kBACxBC,QAAS,SAAUC,GACf,OACIA,GACY,IAAXA,GAA2B,IAAXA,GAAgBA,GAAU,GAAK,MAAQ,OAGhEC,KAAM,CACFC,IAAK,EACLC,IAAK,KA3EyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aA4ChBA,EAAOub,aAAa,KAAM,CAC/BC,OAzCS,CACL,SACA,UACA,QACA,UACA,YACA,YACA,OACA,SACA,eACA,mBACA,UACA,WA8BJC,YA5Bc,CACV,MACA,QACA,OACA,MACA,OACA,QACA,OACA,MACA,OACA,OACA,OACA,QAiBJoE,kBAAkB,EAClBnE,SAhBW,CACP,eACA,WACA,WACA,cACA,YACA,YACA,eAUJC,cARgB,CAAC,OAAQ,OAAQ,QAAS,OAAQ,OAAQ,QAAS,QASnEC,YARc,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,IAAK,MASlDO,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,kBACTC,SAAU,eACVC,QAAS,eACTC,SAAU,2BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,OACRC,KAAM,YACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,UACH0qD,GAAI,aACJC,EAAG,iBACHC,GAAI,oBACJzmC,EAAG,KACH0mC,GAAI,QACJC,EAAG,KACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,aAERC,uBAAwB,mBACxBC,QAAS,SAAUC,GAEf,OAAOA,GADiB,IAAXA,EAAe,IAAMA,EAAS,IAAO,EAAI,KAAO,OAGjEC,KAAM,CACFC,IAAK,EACLC,IAAK,KA7FyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aA4ChBA,EAAOub,aAAa,KAAM,CAC/BC,OAzCS,CACL,gBACA,aACA,UACA,aACA,aACA,eACA,cACA,cACA,eACA,aACA,eACA,gBA8BJC,YA5Bc,CACV,OACA,OACA,OACA,OACA,OACA,OACA,OACA,MACA,OACA,OACA,OACA,QAiBJoE,kBAAkB,EAClBnE,SAhBW,CACP,cACA,UACA,UACA,YACA,YACA,WACA,eAUJC,cARgB,CAAC,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,OAS3DC,YARc,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,MASnDO,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,oBACTC,QAAS,sBACTC,SAAU,gBACVC,QAAS,iBACTC,SAAU,6BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,gBACNpiD,EAAG,gBACHqiD,GAAI,YACJzqD,EAAG,UACH0qD,GAAI,gBACJC,EAAG,OACHC,GAAI,aACJzmC,EAAG,QACH0mC,GAAI,WACJC,EAAG,OACHC,GAAI,YACJxD,EAAG,WACHyD,GAAI,eAERC,uBAAwB,mBACxBC,QAAS,SAAUC,GAEf,OAAOA,GADiB,IAAXA,EAAe,IAAMA,EAAS,IAAO,EAAI,KAAO,OAGjEC,KAAM,CACFC,IAAK,EACLC,IAAK,KA7FyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yFAAyF/6C,MAC7F,KAEJg7C,YAAa,8DAA8Dh7C,MACvE,KAEJo/C,kBAAkB,EAClBnE,SAAU,mDAAmDj7C,MAAM,KACnEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,6BACLC,KAAM,oCAEVC,SAAU,CACNC,QAAS,WACL,MAAO,UAA6B,IAAjBh/D,KAAKq+D,QAAgB,KAAO,KAAO,QAE1DY,QAAS,WACL,MAAO,UAA6B,IAAjBj/D,KAAKq+D,QAAgB,KAAO,KAAO,QAE1Da,SAAU,WACN,MAAO,UAA6B,IAAjBl/D,KAAKq+D,QAAgB,KAAO,KAAO,QAE1Dc,QAAS,WACL,MAAO,UAA6B,IAAjBn/D,KAAKq+D,QAAgB,IAAM,KAAO,QAEzDe,SAAU,WACN,MACI,qBAAwC,IAAjBp/D,KAAKq+D,QAAgB,KAAO,KAAO,QAGlEgB,SAAU,KAEdC,aAAc,CACVC,OAAQ,SAAUvuD,GACd,OAA0B,IAAtBA,EAAI9C,QAAQ,MACL,IAAM8C,EAEV,MAAQA,GAEnBwuD,KAAM,SACNpiD,EAAG,eACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,aACJC,EAAG,YACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJC,EAAG,SACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAxEyBpgE,CAAQ,EAAQ,iGCGlD,SAAWmiD,GAAU,aAIzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIh5C,EAAS,CACTxK,EAAG,CAAC,kBAAmB,cACvBqiD,GAAI,CAACU,EAAS,aAAcA,EAAS,UACrCnrD,EAAG,CAAC,aAAc,YAClB0qD,GAAI,CAACS,EAAS,YAAaA,EAAS,WACpCR,EAAG,CAAC,WAAY,SAChBC,GAAI,CAACO,EAAS,UAAWA,EAAS,SAClChnC,EAAG,CAAC,YAAa,UACjB0mC,GAAI,CAACM,EAAS,WAAYA,EAAS,QACnCL,EAAG,CAAC,gBAAiB,aACrBC,GAAI,CAACI,EAAS,cAAeA,EAAS,WACtC5D,EAAG,CAAC,aAAc,WAClByD,GAAI,CAACG,EAAS,YAAaA,EAAS,YAExC,OAAOS,EAAWh5C,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAGrCw8C,EAAOub,aAAa,WAAY,CAC1CC,OAAQ,CACJ2D,WAAY,wFAAwF1+C,MAChG,KAEJ8E,OAAQ,mJAAmJ9E,MACvJ,KAEJ2+C,SAAU,mBAEd3D,YAAa,4EAA4Eh7C,MACrF,KAEJo/C,kBAAkB,EAClBnE,SAAU,qDAAqDj7C,MAAM,KACrEk7C,cAAe,4CAA4Cl7C,MAAM,KACjEm7C,YAAa,wBAAwBn7C,MAAM,KAC3C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,kBACJC,IAAK,qBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,8BACLC,KAAM,uCACNuE,KAAM,oCAEVtE,SAAU,CACNC,QAAS,WACTC,QAAS,eACTC,SAAU,qBACVC,QAAS,WACTC,SAAU,qBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,KACRC,KAAM,UACNpiD,EAAGomD,EACH/D,GAAI+D,EACJxuD,EAAGwuD,EACH9D,GAAI8D,EACJ7D,EAAG6D,EACH5D,GAAI4D,EACJrqC,EAAGqqC,EACH3D,GAAI2D,EACJ1D,EAAG0D,EACHzD,GAAIyD,EACJjH,EAAGiH,EACHxD,GAAIwD,GAERvD,uBAAwB,eACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GAEJ,IAAK,IACD,OAAOxB,EAAS,MACpB,QACA,IAAK,IACL,IAAK,IACL,IAAK,MACL,IAAK,IACL,IAAK,IACL,IAAK,IACD,OAAOA,IAGnBC,KAAM,CACFC,IAAK,EACLC,IAAK,GAETpC,cAAe,4BACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,SAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,WAAb1C,EACA0C,EACa,YAAb1C,EACA0C,EAAO,GAAKA,EAAOA,EAAO,GACb,UAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,OACAA,EAAO,GACP,SACAA,EAAO,GACP,UACAA,EAAO,GACP,QAEA,UAzHmB5gE,CAAQ,EAAQ,iGCGlD,SAAWmiD,GAAU,aAIzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIh5C,EAAS,CACTxK,EAAG,CAAC,qBAAsB,iBAC1BqiD,GAAI,CAACU,EAAS,cAAeA,EAAS,WACtCnrD,EAAG,CAAC,aAAc,YAClB0qD,GAAI,CAACS,EAAS,YAAaA,EAAS,WACpCR,EAAG,CAAC,YAAa,UACjBC,GAAI,CAACO,EAAS,WAAYA,EAAS,UACnChnC,EAAG,CAAC,YAAa,UACjB0mC,GAAI,CAACM,EAAS,WAAYA,EAAS,QACnCL,EAAG,CAAC,eAAgB,aACpBC,GAAI,CAACI,EAAS,cAAeA,EAAS,WACtC5D,EAAG,CAAC,aAAc,YAClByD,GAAI,CAACG,EAAS,YAAaA,EAAS,YAExC,OAAOS,EAAWh5C,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAGrCw8C,EAAOub,aAAa,WAAY,CAC1CC,OAAQ,CACJ2D,WAAY,4EAA4E1+C,MACpF,KAEJ8E,OAAQ,wIAAwI9E,MAC5I,KAEJ2+C,SAAU,mBAEd3D,YAAa,4DAA4Dh7C,MACrE,KAEJo/C,kBAAkB,EAClBnE,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,iBACJC,IAAK,oBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,6BACLC,KAAM,sCACNuE,KAAM,mCAEVtE,SAAU,CACNC,QAAS,WACTC,QAAS,cACTC,SAAU,sBACVC,QAAS,WACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,KACRC,KAAM,UACNpiD,EAAGomD,EACH/D,GAAI+D,EACJxuD,EAAGwuD,EACH9D,GAAI8D,EACJ7D,EAAG6D,EACH5D,GAAI4D,EACJrqC,EAAGqqC,EACH3D,GAAI2D,EACJ1D,EAAG0D,EACHzD,GAAIyD,EACJjH,EAAGiH,EACHxD,GAAIwD,GAERvD,uBAAwB,cACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GAEJ,IAAK,IACD,OAAOxB,EAAS,KACpB,QACA,IAAK,IACL,IAAK,IACL,IAAK,MACL,IAAK,IACL,IAAK,IACL,IAAK,IACD,OAAOA,IAGnBC,KAAM,CACFC,IAAK,EACLC,IAAK,GAETpC,cAAe,+BACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,SAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,aAAb1C,EACA0C,EACa,aAAb1C,EACA0C,EAAO,GAAKA,EAAOA,EAAO,GACb,UAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,OACAA,EAAO,GACP,WACAA,EAAO,GACP,WACAA,EAAO,GACP,QAEA,UAzHmB5gE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yFAAyF/6C,MAC7F,KAEJg7C,YAAa,yEAAyEh7C,MAClF,KAEJo/C,kBAAkB,EAClBnE,SAAU,wDAAwDj7C,MAC9D,KAEJk7C,cAAe,mCAAmCl7C,MAAM,KACxDm7C,YAAa,qBAAqBn7C,MAAM,KACxC07C,eAAgB,CACZC,GAAI,gBACJC,IAAK,mBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,6BACLC,KAAM,oCAEVC,SAAU,CACNC,QAAS,UACTC,QAAS,YACTC,SAAU,WACVC,QAAS,cACTC,SAAU,mBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAAG,WACHqiD,GAAI,WACJzqD,EAAG,WACH0qD,GAAI,WACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,UACJC,EAAG,WACHC,GAAI,WACJxD,EAAG,UACHyD,GAAI,WAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAKzBkiD,cAAe,qBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,QAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,SAAb1C,EACA0C,EACa,SAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,SAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,MACAA,EAAO,GACP,OACAA,EAAO,GACP,OACAA,EAAO,GACP,OAEA,OAGfV,KAAM,CACFC,IAAK,EACLC,IAAK,KAvHyBpgE,CAAQ,EAAQ,2FCKlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,0EAA0E/6C,MAC9E,KAEJg7C,YAAa,4DAA4Dh7C,MACrE,KAEJi7C,SAAU,uCAAuCj7C,MAAM,KACvDk7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,iBACJC,IAAK,uBACLC,KAAM,6BACNrsC,EAAG,WACH0wC,GAAI,aACJC,IAAK,mBACLC,KAAM,yBAEVtE,SAAU,CACNC,QAAS,cACTC,QAAS,aACTC,SAAU,iBACVC,QAAS,eACTC,SAAU,+BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,UACNpiD,EAAG,aACHqiD,GAAI,WACJzqD,EAAG,MACH0qD,GAAI,UACJC,EAAG,MACHC,GAAI,SAAUO,GACV,OAAe,IAAXA,EACO,SAEJA,EAAS,SAEpBhnC,EAAG,MACH0mC,GAAI,SAAUM,GACV,OAAe,IAAXA,EACO,SAEJA,EAAS,SAEpBL,EAAG,OACHC,GAAI,SAAUI,GACV,OAAe,IAAXA,EACO,UAEJA,EAAS,WAEpB5D,EAAG,MACHyD,GAAI,SAAUG,GACV,OAAe,IAAXA,EACO,SACAA,EAAS,IAAO,GAAgB,KAAXA,EACrBA,EAAS,OAEbA,EAAS,UAGxBjC,cAAe,gEACfC,KAAM,SAAUvrD,GACZ,MAAO,8BAA8BuQ,KAAKvQ,IAE9CwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,aACAA,EAAO,GACP,QACAA,EAAO,GACPvC,EAAU,SAAW,eACrBuC,EAAO,GACPvC,EAAU,QAAU,eAEpB,UAzFmBr+D,CAAQ,EAAQ,2FCClD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAETqB,EAAc,CACV,OACA,WACA,UACA,UACA,OACA,QACA,QACA,OACA,aACA,UACA,WACA,cAiBCngB,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,CACJj2C,OAAQ,8EAA8E9E,MAClF,KAEJ0+C,WAAY,0EAA0E1+C,MAClF,MAGRg7C,YAAa,6DAA6Dh7C,MACtE,KAEJi7C,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,kCAAkCl7C,MAAM,KACvDm7C,YAAa,qBAAqBn7C,MAAM,KACxC07C,eAAgB,CACZC,GAAI,aACJC,IAAK,gBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,0BACLC,KAAM,iCAGV0D,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAzCmB,CACf,OACA,QACA,UACA,UACA,OACA,QACA,QACA,OACA,QACA,UACA,OACA,SA+BJR,YAAa,+KAEbR,iBAAkB,+KAElBa,kBAAmB,uIAEnBC,uBAAwB,sFAExBhE,SAAU,CACNC,QAAS,UACTC,QAAS,UACTC,SAAU,WACVC,QAAS,UACTC,SAAU,mBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,UACNpiD,EAAG,cACHqiD,GAAI,WACJzqD,EAAG,UACH0qD,GAAI,UACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,SACH0mC,GAAI,SACJC,EAAG,WACHC,GAAI,WACJxD,EAAG,UACHyD,GAAI,WAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAKzBkiD,cAAe,qBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,QAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,SAAb1C,EACA0C,EACa,UAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,QAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,MACAA,EAAO,GACP,OACAA,EAAO,GACP,QACAA,EAAO,GACP,MAEA,OAGfV,KAAM,CACFC,IAAK,EACLC,IAAK,KAlKyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,SAAS6gB,EAAU/C,EAAQQ,EAAe96D,GACtC,IAAIS,EAAS65D,EAAS,IACtB,OAAQt6D,GACJ,IAAK,KAQD,OANIS,GADW,IAAX65D,EACU,UACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,UAEA,WAGlB,IAAK,IACD,OAAOQ,EAAgB,eAAiB,eAC5C,IAAK,KAQD,OANIr6D,GADW,IAAX65D,EACU,SACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,SAEA,UAGlB,IAAK,IACD,OAAOQ,EAAgB,YAAc,cACzC,IAAK,KAQD,OANIr6D,GADW,IAAX65D,EACU,MACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,OAEA,QAGlB,IAAK,KAMD,OAJI75D,GADW,IAAX65D,EACU,MAEA,QAGlB,IAAK,KAQD,OANI75D,GADW,IAAX65D,EACU,SACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,UAEA,WAGlB,IAAK,KAQD,OANI75D,GADW,IAAX65D,EACU,SACQ,IAAXA,GAA2B,IAAXA,GAA2B,IAAXA,EAC7B,SAEA,WAMjB9d,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,CACJj2C,OAAQ,oGAAoG9E,MACxG,KAEJ0+C,WAAY,gGAAgG1+C,MACxG,MAGRg7C,YAAa,+DAA+Dh7C,MACxE,KAEJo/C,kBAAkB,EAClBnE,SAAU,4DAA4Dj7C,MAClE,KAEJk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,eACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,eACTC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,wBACX,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,sBACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,oBAGnBvC,QAAS,eACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACD,MAAO,6BACX,KAAK,EACD,MAAO,4BACX,KAAK,EACD,MAAO,2BACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,yBAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAAG,cACHqiD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAGuD,EACHtD,GAAIsD,EACJ/pC,EAAG,MACH0mC,GAAIqD,EACJpD,EAAG,SACHC,GAAImD,EACJ3G,EAAG,SACHyD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAxJyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIzB,IAAIoiB,EAAc,gEAAgE3hD,MAC9E,KAEJ,SAASogD,EAAU/C,EAAQQ,EAAe96D,EAAK+6D,GAC3C,IAAIU,EAAMnB,EACV,OAAQt6D,GACJ,IAAK,IACD,OAAO+6D,GAAYD,EACb,mBACA,oBACV,IAAK,KACD,OAAOW,GAAOV,GAAYD,GACpB,aACA,cACV,IAAK,IACD,MAAO,OAASC,GAAYD,EAAgB,QAAU,UAC1D,IAAK,KACD,OAAOW,GAAOV,GAAYD,EAAgB,QAAU,UACxD,IAAK,IACD,MAAO,OAASC,GAAYD,EAAgB,OAAS,UACzD,IAAK,KACD,OAAOW,GAAOV,GAAYD,EAAgB,OAAS,UACvD,IAAK,IACD,MAAO,OAASC,GAAYD,EAAgB,OAAS,UACzD,IAAK,KACD,OAAOW,GAAOV,GAAYD,EAAgB,OAAS,UACvD,IAAK,IACD,MAAO,OAASC,GAAYD,EAAgB,SAAW,YAC3D,IAAK,KACD,OAAOW,GAAOV,GAAYD,EAAgB,SAAW,YACzD,IAAK,IACD,MAAO,OAASC,GAAYD,EAAgB,MAAQ,QACxD,IAAK,KACD,OAAOW,GAAOV,GAAYD,EAAgB,MAAQ,QAE1D,MAAO,GAEX,SAASP,EAAKQ,GACV,OACKA,EAAW,GAAK,WACjB,IACA6D,EAAYzkE,KAAK0hE,OACjB,aAICrf,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,oGAAoG/6C,MACxG,KAEJg7C,YAAa,iEAAiEh7C,MAC1E,KAEJo/C,kBAAkB,EAClBnE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,gCAAgCl7C,MAAM,KACrDm7C,YAAa,qBAAqBn7C,MAAM,KACxC07C,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,cACHC,GAAI,gBACJC,IAAK,qBACLC,KAAM,4BAEVZ,cAAe,SACfC,KAAM,SAAUvrD,GACZ,MAAyC,MAAlCA,EAAMnN,OAAO,GAAGyhB,eAE3Bk3C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,IACW,IAAZE,EAAmB,KAAO,MAEd,IAAZA,EAAmB,KAAO,MAGzCQ,SAAU,CACNC,QAAS,gBACTC,QAAS,oBACTC,SAAU,WACN,OAAOkB,EAAKr+D,KAAK/B,MAAM,IAE3Bm/D,QAAS,oBACTC,SAAU,WACN,OAAOgB,EAAKr+D,KAAK/B,MAAM,IAE3Bq/D,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,KACNpiD,EAAG8lD,EACHzD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAGuD,EACHtD,GAAIsD,EACJ/pC,EAAG+pC,EACHrD,GAAIqD,EACJpD,EAAGoD,EACHnD,GAAImD,EACJ3G,EAAG2G,EACHlD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAnHyBpgE,CAAQ,EAAQ,8FCElD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,CACJj2C,OAAQ,4GAA4G9E,MAChH,KAEJ0+C,WAAY,gGAAgG1+C,MACxG,MAGRg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,gEAAgEj7C,MACtE,KAEJk7C,cAAe,+BAA+Bl7C,MAAM,KACpDm7C,YAAa,+BAA+Bn7C,MAAM,KAClD07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,iBACJC,IAAK,wBACLC,KAAM,+BAEVC,SAAU,CACNC,QAAS,aACTC,QAAS,YACTE,QAAS,YACTD,SAAU,WACN,MAAO,sBAEXE,SAAU,WACN,MAAO,8BAEXC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,UACNpiD,EAAG,mBACHqiD,GAAI,cACJzqD,EAAG,OACH0qD,GAAI,UACJC,EAAG,MACHC,GAAI,SACJzmC,EAAG,KACH0mC,GAAI,QACJC,EAAG,OACHC,GAAI,UACJxD,EAAG,OACHyD,GAAI,WAER9B,cAAe,oCACfC,KAAM,SAAUvrD,GACZ,MAAO,uBAAuBuQ,KAAKvQ,IAEvCwrD,SAAU,SAAU0C,GAChB,OAAIA,EAAO,EACA,UACAA,EAAO,GACP,WACAA,EAAO,GACP,UAEA,YAGfb,uBAAwB,0BACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,MACL,IAAK,IACL,IAAK,IACL,IAAK,OACD,OAAe,IAAXxB,EACOA,EAAS,MAEbA,EAAS,MACpB,QACI,OAAOA,IAGnBC,KAAM,CACFC,IAAK,EACLC,IAAK,KA1FyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yFAAyF/6C,MAC7F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,6CAA6Cj7C,MAAM,KAC7Dk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,4BACLC,KAAM,mCAEVZ,cAAe,wBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,SAAb1C,EACO0C,EACa,UAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,SAAb1C,GAAoC,UAAbA,EACvB0C,EAAO,QADX,GAIX1C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACD,OACAA,EAAQ,GACR,QACAA,EAAQ,GACR,OAEA,SAGfU,SAAU,CACNC,QAAS,sBACTC,QAAS,mBACTC,SAAU,kBACVC,QAAS,qBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,eACNpiD,EAAG,iBACHqiD,GAAI,WACJzqD,EAAG,UACH0qD,GAAI,WACJC,EAAG,QACHC,GAAI,SACJzmC,EAAG,SACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,WACJxD,EAAG,UACHyD,GAAI,YAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KAzEyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIzB,SAASkhB,EAAOhjD,GACZ,OAAIA,EAAI,KAAQ,IAELA,EAAI,IAAO,EAK1B,SAAS2iD,EAAU/C,EAAQQ,EAAe96D,EAAK+6D,GAC3C,IAAIt6D,EAAS65D,EAAS,IACtB,OAAQt6D,GACJ,IAAK,IACD,OAAO86D,GAAiBC,EAClB,mBACA,mBACV,IAAK,KACD,OAAI2C,EAAOpD,GAEH75D,GACCq6D,GAAiBC,EAAW,WAAa,YAG3Ct6D,EAAS,UACpB,IAAK,IACD,OAAOq6D,EAAgB,SAAW,SACtC,IAAK,KACD,OAAI4C,EAAOpD,GAEH75D,GAAUq6D,GAAiBC,EAAW,UAAY,WAE/CD,EACAr6D,EAAS,SAEbA,EAAS,SACpB,IAAK,KACD,OAAIi9D,EAAOpD,GAEH75D,GACCq6D,GAAiBC,EACZ,gBACA,iBAGPt6D,EAAS,cACpB,IAAK,IACD,OAAIq6D,EACO,QAEJC,EAAW,MAAQ,OAC9B,IAAK,KACD,OAAI2C,EAAOpD,GACHQ,EACOr6D,EAAS,QAEbA,GAAUs6D,EAAW,OAAS,SAC9BD,EACAr6D,EAAS,QAEbA,GAAUs6D,EAAW,MAAQ,QACxC,IAAK,IACD,OAAID,EACO,UAEJC,EAAW,QAAU,SAChC,IAAK,KACD,OAAI2C,EAAOpD,GACHQ,EACOr6D,EAAS,UAEbA,GAAUs6D,EAAW,SAAW,WAChCD,EACAr6D,EAAS,UAEbA,GAAUs6D,EAAW,QAAU,UAC1C,IAAK,IACD,OAAOD,GAAiBC,EAAW,KAAO,MAC9C,IAAK,KACD,OAAI2C,EAAOpD,GACA75D,GAAUq6D,GAAiBC,EAAW,KAAO,QAEjDt6D,GAAUq6D,GAAiBC,EAAW,KAAO,QAIvDve,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,oFAAoF/6C,MACxF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,mFAAmFj7C,MACzF,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,eACJC,IAAK,0BACLC,KAAM,iCAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,oBACTC,SAAU,gBACVC,QAAS,iBACTC,SAAU,0BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,iBACNpiD,EAAG8lD,EACHzD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAG,cACHC,GAAIsD,EACJ/pC,EAAG+pC,EACHrD,GAAIqD,EACJpD,EAAGoD,EACHnD,GAAImD,EACJ3G,EAAG2G,EACHlD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAzIyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,gGAAgG/6C,MACpG,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,mBACTC,SAAU,iBACVC,QAAS,iBACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACD,MAAO,6BACX,QACI,MAAO,+BAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SAAUniD,GACd,OAAQ,YAAY+F,KAAK/F,GAAK,MAAQ,MAAQ,IAAMA,GAExDoiD,KAAM,QACNpiD,EAAG,iBACHqiD,GAAI,aACJzqD,EAAG,YACH0qD,GAAI,YACJC,EAAG,SACHC,GAAI,SACJzmC,EAAG,YACH0mC,GAAI,YACJC,EAAG,UACHC,GAAI,UACJxD,EAAG,UACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA9DyBpgE,CAAQ,EAAQ,2FCKlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,gGAAgG/6C,MACpG,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,WACL,MACI,WACCh/D,KAAKq+D,QAAU,EAAI,OAA0B,IAAjBr+D,KAAKq+D,QAAgB,IAAM,OACxD,OAGRY,QAAS,WACL,MACI,aACCj/D,KAAKq+D,QAAU,EAAI,OAA0B,IAAjBr+D,KAAKq+D,QAAgB,IAAM,OACxD,OAGRa,SAAU,WACN,MACI,WACCl/D,KAAKq+D,QAAU,EAAI,OAA0B,IAAjBr+D,KAAKq+D,QAAgB,IAAM,OACxD,OAGRc,QAAS,WACL,MACI,WACCn/D,KAAKq+D,QAAU,EAAI,OAA0B,IAAjBr+D,KAAKq+D,QAAgB,IAAM,OACxD,OAGRe,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACD,MACI,uBACC1hE,KAAKq+D,QAAU,EACV,OACiB,IAAjBr+D,KAAKq+D,QACL,IACA,OACN,MAER,QACI,MACI,uBACCr+D,KAAKq+D,QAAU,EACV,OACiB,IAAjBr+D,KAAKq+D,QACL,IACA,OACN,QAIhBgB,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,QACNpiD,EAAG,iBACHqiD,GAAI,aACJzqD,EAAG,YACH0qD,GAAI,YACJC,EAAG,SACHC,GAAI,SACJzmC,EAAG,YACH0mC,GAAI,YACJ+B,EAAG,gBACHC,GAAI,eACJ/B,EAAG,UACHC,GAAI,UACJxD,EAAG,UACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAtGyBpgE,CAAQ,EAAQ,2FCClD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/B8G,KAAM,CACF,CACIC,MAAO,aACPC,OAAQ,EACRp/D,KAAM,KACNq/D,OAAQ,IACRC,KAAM,KAEV,CACIH,MAAO,aACPI,MAAO,aACPH,OAAQ,EACRp/D,KAAM,KACNq/D,OAAQ,IACRC,KAAM,KAEV,CACIH,MAAO,aACPI,MAAO,aACPH,OAAQ,EACRp/D,KAAM,KACNq/D,OAAQ,IACRC,KAAM,KAEV,CACIH,MAAO,aACPI,MAAO,aACPH,OAAQ,EACRp/D,KAAM,KACNq/D,OAAQ,IACRC,KAAM,KAEV,CACIH,MAAO,aACPI,MAAO,aACPH,OAAQ,EACRp/D,KAAM,KACNq/D,OAAQ,IACRC,KAAM,KAEV,CACIH,MAAO,aACPI,MAAO,aACPH,OAAQ,EACRp/D,KAAM,KACNq/D,OAAQ,KACRC,KAAM,MAEV,CACIH,MAAO,aACPI,OAAO,IACPH,OAAQ,EACRp/D,KAAM,MACNq/D,OAAQ,KACRC,KAAM,OAGdE,oBAAqB,WACrBC,oBAAqB,SAAUryD,EAAOoJ,GAClC,MAAoB,MAAbA,EAAM,GAAa,EAAIqN,SAASrN,EAAM,IAAMpJ,EAAO,KAE9DirD,OAAQ,yCAAyC/6C,MAAM,KACvDg7C,YAAa,yCAAyCh7C,MAClD,KAEJi7C,SAAU,8BAA8Bj7C,MAAM,KAC9Ck7C,cAAe,gBAAgBl7C,MAAM,KACrCm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,YACJC,IAAK,kBACLC,KAAM,uBACNrsC,EAAG,aACH0wC,GAAI,YACJC,IAAK,kBACLC,KAAM,wBAEVnF,cAAe,SACfC,KAAM,SAAUvrD,GACZ,MAAiB,OAAVA,GAEXwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,KAEA,MAGf/B,SAAU,CACNC,QAAS,UACTC,QAAS,UACTC,SAAU,SAAU3U,GAChB,OAAIA,EAAI6V,SAAWpgE,KAAKogE,OACb,cAEA,WAGfjB,QAAS,UACTC,SAAU,SAAU7U,GAChB,OAAIvqD,KAAKogE,SAAW7V,EAAI6V,OACb,cAEA,WAGff,SAAU,KAEdY,uBAAwB,WACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACD,OAAkB,IAAXxB,EAAe,KAAOA,EAAS,IAC1C,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOA,EAAS,IACpB,QACI,OAAOA,IAGnBb,aAAc,CACVC,OAAQ,MACRC,KAAM,MACNpiD,EAAG,KACHqiD,GAAI,MACJzqD,EAAG,KACH0qD,GAAI,MACJC,EAAG,MACHC,GAAI,OACJzmC,EAAG,KACH0mC,GAAI,MACJC,EAAG,MACHC,GAAI,OACJxD,EAAG,KACHyD,GAAI,SAlJ0B9/D,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yFAAyF/6C,MAC7F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,+CAA+Cj7C,MAAM,KAC/Dk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,4BACLC,KAAM,mCAEVZ,cAAe,6BACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,WAAb1C,EACO0C,EACa,WAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,WAAb1C,GAAsC,UAAbA,EACzB0C,EAAO,QADX,GAIX1C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACD,SACAA,EAAQ,GACR,SACAA,EAAQ,GACR,SAEA,SAGfU,SAAU,CACNC,QAAS,2BACTC,QAAS,sBACTC,SAAU,kBACVC,QAAS,wBACTC,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,gBACRC,KAAM,uBACNpiD,EAAG,kBACHqiD,GAAI,WACJzqD,EAAG,kBACH0qD,GAAI,WACJC,EAAG,gBACHC,GAAI,SACJzmC,EAAG,WACH0mC,GAAI,YACJC,EAAG,UACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KAzEyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qGAAqG/6C,MACzG,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,CACNyD,WAAY,gEAAgE1+C,MACxE,KAEJ8E,OAAQ,iEAAiE9E,MACrE,KAEJ2+C,SAAU,iBAEdzD,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,iBACTE,QAAS,kBACTD,SAAU,wBACVE,SAAU,oBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SAAUniD,GACd,OAAOA,EAAErI,QAAQ,iCAAiC,SAC9CmwD,EACAj+C,EACAk+C,GAEA,MAAc,MAAPA,EAAal+C,EAAK,KAAOA,EAAKk+C,EAAK,SAGlD3F,KAAM,SAAUpiD,GACZ,MAAI,4BAA4B+F,KAAK/F,GAC1BA,EAAErI,QAAQ,SAAU,UAE3B,OAAOoO,KAAK/F,GACLA,EAAErI,QAAQ,QAAS,YAEvBqI,GAEXA,EAAG,iBACHqiD,GAAI,UACJzqD,EAAG,OACH0qD,GAAI,UACJC,EAAG,QACHC,GAAI,WACJzmC,EAAG,MACH0mC,GAAI,SACJC,EAAG,MACHC,GAAI,SACJxD,EAAG,OACHyD,GAAI,WAERC,uBAAwB,8BACxBC,QAAS,SAAUC,GACf,OAAe,IAAXA,EACOA,EAEI,IAAXA,EACOA,EAAS,MAGhBA,EAAS,IACRA,GAAU,KAAOA,EAAS,IAAO,GAClCA,EAAS,KAAQ,EAEV,MAAQA,EAEZA,EAAS,MAEpBC,KAAM,CACFC,IAAK,EACLC,IAAK,KA1FyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI+e,EAAW,CACX,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,IAAK,OAGA/e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qFAAqF/6C,MACzF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,0DAA0Dj7C,MAChE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,mBACTC,QAAS,mBACTC,SAAU,kBACVC,QAAS,kBACTC,SAAU,kCACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,WACNpiD,EAAG,iBACHqiD,GAAI,YACJzqD,EAAG,YACH0qD,GAAI,WACJC,EAAG,YACHC,GAAI,WACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,QACJxD,EAAG,UACHyD,GAAI,UAERC,uBAAwB,kBACxBC,QAAS,SAAUC,GAGf,OAAOA,GAAUiB,EAASjB,IAAWiB,EAF7BjB,EAAS,KAEmCiB,EAD5CjB,GAAU,IAAM,IAAM,QAGlCC,KAAM,CACFC,IAAK,EACLC,IAAK,KAhFyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yEAAyE/6C,MAC7E,KAEJg7C,YAAa,yEAAyEh7C,MAClF,KAEJi7C,SAAU,iDAAiDj7C,MAAM,KACjEk7C,cAAe,oBAAoBl7C,MAAM,KACzCm7C,YAAa,oBAAoBn7C,MAAM,KACvC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVZ,cAAe,cACfC,KAAM,SAAUvrD,GACZ,MAAiB,UAAVA,GAEXwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,QAEA,SAGf/B,SAAU,CACNC,QAAS,oBACTC,QAAS,kBACTC,SAAU,iBACVC,QAAS,qBACTC,SAAU,8BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,QACNpiD,EAAG,iBACHqiD,GAAI,YACJzqD,EAAG,UACH0qD,GAAI,UACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,UACJC,EAAG,QACHC,GAAI,QACJxD,EAAG,WACHyD,GAAI,YAERC,uBAAwB,YACxBC,QAAS,OACTgB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAGzBokD,KAAM,CACFC,IAAK,EACLC,IAAK,KApGyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,6FAA6F/6C,MACjG,KAEJg7C,YAAa,2EAA2Eh7C,MACpF,KAEJo/C,kBAAkB,EAClBnE,SAAU,0DAA0Dj7C,MAChE,KAEJk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,wBAAwBn7C,MAAM,KAC3C07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,sBACLC,KAAM,6BAEVC,SAAU,CACNC,QAAS,YACTC,QAAS,YACTC,SAAU,WACVC,QAAS,cACTC,SAAU,oBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,WACNpiD,EAAG,gBACHqiD,GAAI,gBACJzqD,EAAG,aACH0qD,GAAI,WACJC,EAAG,YACHC,GAAI,UACJzmC,EAAG,WACH0mC,GAAI,SACJC,EAAG,cACHC,GAAI,YACJxD,EAAG,YACHyD,GAAI,WAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAGzBkiD,cAAe,gCACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,WAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,aAAb1C,EACA0C,EACa,aAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,SAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,SACAA,EAAO,GACP,WACAA,EAAO,GACP,WACAA,EAAO,GACP,OAEA,UAGfb,uBAAwB,eACxBC,QAAS,SAAUC,GACf,OAAOA,EAAS,OAEpBC,KAAM,CACFC,IAAK,EACLC,IAAK,KAzHyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yCAAyC/6C,MAAM,KACvDg7C,YAAa,yCAAyCh7C,MAClD,KAEJi7C,SAAU,8BAA8Bj7C,MAAM,KAC9Ck7C,cAAe,gBAAgBl7C,MAAM,KACrCm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,cACHC,GAAI,gBACJC,IAAK,uBACLC,KAAM,4BACNrsC,EAAG,cACH0wC,GAAI,gBACJC,IAAK,uBACLC,KAAM,6BAEVtE,SAAU,CACNC,QAAS,QACTC,QAAS,QACTC,SAAU,UACVC,QAAS,QACTC,SAAU,cACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,OACRC,KAAM,OACNpiD,EAAG,MACHqiD,GAAI,MACJzqD,EAAG,KACH0qD,GAAI,MACJC,EAAG,OACHC,GAAI,OACJzmC,EAAG,KACH0mC,GAAI,MACJC,EAAG,MACHC,GAAI,MACJxD,EAAG,MACHyD,GAAI,OAERC,uBAAwB,iBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOxB,EAAS,IACpB,IAAK,IACD,OAAOA,EAAS,IACpB,IAAK,IACL,IAAK,IACD,OAAOA,EAAS,IACpB,QACI,OAAOA,IAGnBjC,cAAe,QACfC,KAAM,SAAU58C,GACZ,MAAiB,OAAVA,GAEX68C,SAAU,SAAU0C,EAAMC,EAAQqE,GAC9B,OAAOtE,EAAO,GAAK,KAAO,QAxEI5gE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAETtD,EAAS,CACL,eACA,QACA,QACA,QACA,QACA,WACA,SACA,MACA,UACA,eACA,eACA,gBAGCxb,EAAOub,aAAa,KAAM,CAC/BC,OAAQA,EACRC,YAAaD,EACbE,SAAU,0EAA0Ej7C,MAChF,KAEJk7C,cAAe,2DAA2Dl7C,MACtE,KAEJm7C,YAAa,gBAAgBn7C,MAAM,KACnC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVZ,cAAe,kBACfC,KAAM,SAAUvrD,GACZ,MAAO,UAAUuQ,KAAKvQ,IAE1BwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,UAEA,WAGf/B,SAAU,CACNC,QAAS,sBACTC,QAAS,uBACTC,SAAU,oBACVC,QAAS,qBACTC,SAAU,oBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,KACNpiD,EAAG,kBACHqiD,GAAI,WACJzqD,EAAG,cACH0qD,GAAI,YACJC,EAAG,eACHC,GAAI,aACJzmC,EAAG,WACH0mC,GAAI,SACJC,EAAG,YACHC,GAAI,UACJxD,EAAG,WACHyD,GAAI,UAERkB,SAAU,SAAU37D,GAChB,OAAOA,EACFwP,QAAQ,iBAAiB,SAAUiH,GAChC,OAAOmlD,EAAUnlD,MAEpBjH,QAAQ,KAAM,MAEvBisD,WAAY,SAAUz7D,GAClB,OAAOA,EACFwP,QAAQ,OAAO,SAAUiH,GACtB,OAAOilD,EAAUjlD,MAEpBjH,QAAQ,KAAM,MAEvBqrD,KAAM,CACFC,IAAK,EACLC,IAAK,MApHyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI+e,EAAW,CACX,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,IAAK,OAGA/e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,kFAAkF/6C,MACtF,KAEJg7C,YAAa,qDAAqDh7C,MAC9D,KAEJi7C,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,kBACTC,QAAS,kBACTC,SAAU,iBACVC,QAAS,kBACTC,SAAU,wCACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,WACNpiD,EAAG,iBACHqiD,GAAI,YACJzqD,EAAG,YACH0qD,GAAI,WACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,QACJxD,EAAG,UACHyD,GAAI,UAERC,uBAAwB,wBACxBC,QAAS,SAAUC,GAGf,OAAOA,GAAUiB,EAASjB,IAAWiB,EAF7BjB,EAAS,KAEmCiB,EAD5CjB,GAAU,IAAM,IAAM,QAGlCC,KAAM,CACFC,IAAK,EACLC,IAAK,KAlFyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIh5C,EAAS,CACT5S,EAAG,CAAC,aAAc,gBAClB2qD,EAAG,CAAC,YAAa,eACjBxmC,EAAG,CAAC,UAAW,aACf2mC,EAAG,CAAC,WAAY,eAChBvD,EAAG,CAAC,UAAW,eAEnB,OAAOoE,EAAgB/4C,EAAO/hB,GAAK,GAAK+hB,EAAO/hB,GAAK,GAuBxD,SAASw/D,EAA4BlF,GAEjC,GADAA,EAAS92C,SAAS82C,EAAQ,IACtB72C,MAAM62C,GACN,OAAO,EAEX,GAAIA,EAAS,EAET,OAAO,EACJ,GAAIA,EAAS,GAEhB,OAAI,GAAKA,GAAUA,GAAU,EAI1B,GAAIA,EAAS,IAAK,CAErB,IAAI2B,EAAY3B,EAAS,GAEzB,OACWkF,EADO,IAAdvD,EADa3B,EAAS,GAIS2B,GAChC,GAAI3B,EAAS,IAAO,CAEvB,KAAOA,GAAU,IACbA,GAAkB,GAEtB,OAAOkF,EAA4BlF,GAInC,OAAOkF,EADPlF,GAAkB,KAKjB9d,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,uFAAuF/6C,MAC3F,KAEJg7C,YAAa,+DAA+Dh7C,MACxE,KAEJo/C,kBAAkB,EAClBnE,SAAU,mEAAmEj7C,MACzE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,cACJC,IAAK,iBACLC,EAAG,aACHC,GAAI,eACJC,IAAK,2BACLC,KAAM,kCAEVC,SAAU,CACNC,QAAS,eACTK,SAAU,IACVJ,QAAS,eACTC,SAAU,eACVC,QAAS,mBACTC,SAAU,WAEN,OAAQp/D,KAAK0hE,OACT,KAAK,EACL,KAAK,EACD,MAAO,0BACX,QACI,MAAO,4BAIvBpC,aAAc,CACVC,OAhGR,SAA2Bh6D,GAEvB,OAAI8/D,EADS9/D,EAAOwhB,OAAO,EAAGxhB,EAAO2I,QAAQ,OAElC,KAAO3I,EAEX,MAAQA,GA4FXi6D,KA1FR,SAAyBj6D,GAErB,OAAI8/D,EADS9/D,EAAOwhB,OAAO,EAAGxhB,EAAO2I,QAAQ,OAElC,QAAU3I,EAEd,SAAWA,GAsFd6X,EAAG,kBACHqiD,GAAI,cACJzqD,EAAGwuD,EACH9D,GAAI,cACJC,EAAG6D,EACH5D,GAAI,aACJzmC,EAAGqqC,EACH3D,GAAI,UACJC,EAAG0D,EACHzD,GAAI,WACJxD,EAAGiH,EACHxD,GAAI,WAERC,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KApIyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,6EAA6E/6C,MACjF,KAEJg7C,YAAa,6EAA6Eh7C,MACtF,KAEJi7C,SAAU,sCAAsCj7C,MAAM,KACtDk7C,cAAe,oCAAoCl7C,MAAM,KACzDm7C,YAAa,mBAAmBn7C,MAAM,KACtC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,6BAEVZ,cAAe,kBACfC,KAAM,SAAUvrD,GACZ,MAAiB,WAAVA,GAEXwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,WAEA,UAGf/B,SAAU,CACNC,QAAS,kBACTC,QAAS,mBACTC,SAAU,wBACVC,QAAS,qBACTC,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,WACNpiD,EAAG,mBACHqiD,GAAI,YACJzqD,EAAG,SACH0qD,GAAI,UACJC,EAAG,YACHC,GAAI,aACJzmC,EAAG,QACH0mC,GAAI,SACJC,EAAG,UACHC,GAAI,WACJxD,EAAG,OACHyD,GAAI,SAERC,uBAAwB,eACxBC,QAAS,SAAUC,GACf,MAAO,MAAQA,KA/DejgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAIijB,EAAQ,CACR7F,GAAI,6BACJzqD,EAAG,wBACH0qD,GAAI,0BACJC,EAAG,2BACHC,GAAI,4BACJzmC,EAAG,qBACH0mC,GAAI,sBACJC,EAAG,uBACHC,GAAI,4BACJxD,EAAG,mBACHyD,GAAI,oBASR,SAASuF,EAAkBpF,EAAQQ,EAAe96D,EAAK+6D,GACnD,OAAOD,EACDY,EAAM17D,GAAK,GACX+6D,EACAW,EAAM17D,GAAK,GACX07D,EAAM17D,GAAK,GAErB,SAAS2/D,EAAQrF,GACb,OAAOA,EAAS,IAAO,GAAMA,EAAS,IAAMA,EAAS,GAEzD,SAASoB,EAAM17D,GACX,OAAOy/D,EAAMz/D,GAAKid,MAAM,KAE5B,SAASogD,EAAU/C,EAAQQ,EAAe96D,EAAK+6D,GAC3C,IAAIt6D,EAAS65D,EAAS,IACtB,OAAe,IAAXA,EAEI75D,EAASi/D,EAAkBpF,EAAQQ,EAAe96D,EAAI,GAAI+6D,GAEvDD,EACAr6D,GAAUk/D,EAAQrF,GAAUoB,EAAM17D,GAAK,GAAK07D,EAAM17D,GAAK,IAE1D+6D,EACOt6D,EAASi7D,EAAM17D,GAAK,GAEpBS,GAAUk/D,EAAQrF,GAAUoB,EAAM17D,GAAK,GAAK07D,EAAM17D,GAAK,IAIjEw8C,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,CACJj2C,OAAQ,oGAAoG9E,MACxG,KAEJ0+C,WAAY,kGAAkG1+C,MAC1G,KAEJ2+C,SAAU,+DAEd3D,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,CACNn2C,OAAQ,oFAAoF9E,MACxF,KAEJ0+C,WAAY,2FAA2F1+C,MACnG,KAEJ2+C,SAAU,cAEdzD,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,iBAAiBn7C,MAAM,KACpC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,sCACLC,KAAM,4CACNrsC,EAAG,aACH0wC,GAAI,wBACJC,IAAK,sCACLC,KAAM,4CAEVtE,SAAU,CACNC,QAAS,gBACTC,QAAS,aACTC,SAAU,UACVC,QAAS,aACTC,SAAU,qBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAlFR,SAA0B+iD,EAAQQ,EAAe96D,EAAK+6D,GAClD,OAAID,EACO,kBAEAC,EAAW,kBAAoB,mBA+EtCnB,GAAIyD,EACJluD,EAAGuwD,EACH7F,GAAIwD,EACJvD,EAAG4F,EACH3F,GAAIsD,EACJ/pC,EAAGosC,EACH1F,GAAIqD,EACJpD,EAAGyF,EACHxF,GAAImD,EACJ3G,EAAGgJ,EACHvF,GAAIkD,GAERjD,uBAAwB,cACxBC,QAAS,SAAUC,GACf,OAAOA,EAAS,QAEpBC,KAAM,CACFC,IAAK,EACLC,IAAK,KAzHyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIzB,IAAIijB,EAAQ,CACR7F,GAAI,qCAAqC38C,MAAM,KAC/C9N,EAAG,iCAAiC8N,MAAM,KAC1C48C,GAAI,iCAAiC58C,MAAM,KAC3C68C,EAAG,iCAAiC78C,MAAM,KAC1C88C,GAAI,iCAAiC98C,MAAM,KAC3CqW,EAAG,6BAA6BrW,MAAM,KACtC+8C,GAAI,6BAA6B/8C,MAAM,KACvCg9C,EAAG,iCAAiCh9C,MAAM,KAC1Ci9C,GAAI,iCAAiCj9C,MAAM,KAC3Cy5C,EAAG,wBAAwBz5C,MAAM,KACjCk9C,GAAI,wBAAwBl9C,MAAM,MAKtC,SAAS8E,EAAO25C,EAAOpB,EAAQQ,GAC3B,OAAIA,EAEOR,EAAS,IAAO,GAAKA,EAAS,KAAQ,GAAKoB,EAAM,GAAKA,EAAM,GAI5DpB,EAAS,IAAO,GAAKA,EAAS,KAAQ,GAAKoB,EAAM,GAAKA,EAAM,GAG3E,SAASF,EAAuBlB,EAAQQ,EAAe96D,GACnD,OAAOs6D,EAAS,IAAMv4C,EAAO09C,EAAMz/D,GAAMs6D,EAAQQ,GAErD,SAAS8E,EAAyBtF,EAAQQ,EAAe96D,GACrD,OAAO+hB,EAAO09C,EAAMz/D,GAAMs6D,EAAQQ,GAM7Bte,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,uGAAuG/6C,MAC3G,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,0EAA0Ej7C,MAChF,KAEJk7C,cAAe,kBAAkBl7C,MAAM,KACvCm7C,YAAa,kBAAkBn7C,MAAM,KACrC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,cACHC,GAAI,uBACJC,IAAK,8BACLC,KAAM,qCAEVC,SAAU,CACNC,QAAS,uBACTC,QAAS,oBACTC,SAAU,qBACVC,QAAS,sBACTC,SAAU,gCACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,WACNpiD,EAlCR,SAAyB+iD,EAAQQ,GAC7B,OAAOA,EAAgB,iBAAmB,kBAkCtClB,GAAI4B,EACJrsD,EAAGywD,EACH/F,GAAI2B,EACJ1B,EAAG8F,EACH7F,GAAIyB,EACJloC,EAAGssC,EACH5F,GAAIwB,EACJvB,EAAG2F,EACH1F,GAAIsB,EACJ9E,EAAGkJ,EACHzF,GAAIqB,GAERpB,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA1FyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIzB,IAAIqjB,EAAa,CACbC,MAAO,CAEHlG,GAAI,CAAC,SAAU,UAAW,WAC1BzqD,EAAG,CAAC,cAAe,iBACnB0qD,GAAI,CAAC,QAAS,SAAU,UACxBC,EAAG,CAAC,YAAa,eACjBC,GAAI,CAAC,MAAO,OAAQ,QACpBC,GAAI,CAAC,MAAO,OAAQ,QACpBE,GAAI,CAAC,SAAU,UAAW,WAC1BC,GAAI,CAAC,SAAU,SAAU,WAE7B4F,uBAAwB,SAAUzF,EAAQ0F,GACtC,OAAkB,IAAX1F,EACD0F,EAAQ,GACR1F,GAAU,GAAKA,GAAU,EACzB0F,EAAQ,GACRA,EAAQ,IAElB3C,UAAW,SAAU/C,EAAQQ,EAAe96D,GACxC,IAAIggE,EAAUH,EAAWC,MAAM9/D,GAC/B,OAAmB,IAAfA,EAAIuJ,OACGuxD,EAAgBkF,EAAQ,GAAKA,EAAQ,GAGxC1F,EACA,IACAuF,EAAWE,uBAAuBzF,EAAQ0F,KAMjDxjB,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,mFAAmF/6C,MACvF,KAEJg7C,YAAa,2DAA2Dh7C,MACpE,KAEJo/C,kBAAkB,EAClBnE,SAAU,4DAA4Dj7C,MAClE,KAEJk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,eACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,gBAETC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,wBACX,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,sBACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,oBAGnBvC,QAAS,cACTC,SAAU,WAUN,MATmB,CACf,6BACA,iCACA,4BACA,4BACA,8BACA,2BACA,4BAEgBp/D,KAAK0hE,QAE7BrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAAG,mBACHqiD,GAAIiG,EAAWxC,UACfluD,EAAG0wD,EAAWxC,UACdxD,GAAIgG,EAAWxC,UACfvD,EAAG+F,EAAWxC,UACdtD,GAAI8F,EAAWxC,UACf/pC,EAAG,MACH0mC,GAAI6F,EAAWxC,UACfpD,EAAG,SACHC,GAAI2F,EAAWxC,UACf3G,EAAG,SACHyD,GAAI0F,EAAWxC,WAEnBjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KApHyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,8IAA8I/6C,MAClJ,KAEJg7C,YAAa,iEAAiEh7C,MAC1E,KAEJ2/C,YAAa,yCACbK,kBAAmB,yCACnBb,iBAAkB,yCAClBc,uBAAwB,yCACxBhF,SAAU,kDAAkDj7C,MAAM,KAClEk7C,cAAe,wBAAwBl7C,MAAM,KAC7Cm7C,YAAa,wBAAwBn7C,MAAM,KAC3C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,wBACLC,KAAM,+BAEVC,SAAU,CACNC,QAAS,wBACTC,QAAS,eACTC,SAAU,cACVC,QAAS,iBACTC,SAAU,2BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,cACRC,KAAM,WACNpiD,EAAG,mBACHqiD,GAAI,YACJzqD,EAAG,YACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,QACH0mC,GAAI,QACJC,EAAG,YACHC,GAAI,YACJxD,EAAG,SACHyD,GAAI,UAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAzDyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,uFAAuF/6C,MAC3F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,wDAAwDj7C,MAC9D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,YACHC,GAAI,cACJC,IAAK,mBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,eACTC,SAAU,oBACVC,QAAS,gBACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,4BACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,8BAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG,kBACHqiD,GAAI,aACJzqD,EAAG,cACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,WACH0mC,GAAI,UACJC,EAAG,aACHC,GAAI,YACJxD,EAAG,cACHyD,GAAI,aAERC,uBAAwB,8BACxBC,QAAS,SAAUC,GACf,IAAI2B,EAAY3B,EAAS,GACrB4B,EAAc5B,EAAS,IAC3B,OAAe,IAAXA,EACOA,EAAS,MACO,IAAhB4B,EACA5B,EAAS,MACT4B,EAAc,IAAMA,EAAc,GAClC5B,EAAS,MACK,IAAd2B,EACA3B,EAAS,MACK,IAAd2B,EACA3B,EAAS,MACK,IAAd2B,GAAiC,IAAdA,EACnB3B,EAAS,MAETA,EAAS,OAGxBC,KAAM,CACFC,IAAK,EACLC,IAAK,KAnFyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yFAAyF/6C,MAC7F,KAEJg7C,YAAa,yEAAyEh7C,MAClF,KAEJo/C,kBAAkB,EAClBnE,SAAU,wEAAwEj7C,MAC9E,KAEJk7C,cAAe,2CAA2Cl7C,MAAM,KAChEm7C,YAAa,wBAAwBn7C,MAAM,KAC3C07C,eAAgB,CACZC,GAAI,aACJC,IAAK,gBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,0BACLC,KAAM,iCAEVC,SAAU,CACNC,QAAS,aACTC,QAAS,YACTC,SAAU,WACVC,QAAS,cACTC,SAAU,oBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,aACRC,KAAM,WACNpiD,EAAG,gBACHqiD,GAAI,cACJzqD,EAAG,eACH0qD,GAAI,cACJC,EAAG,eACHC,GAAI,cACJzmC,EAAG,YACH0mC,GAAI,WACJC,EAAG,WACHC,GAAI,UACJxD,EAAG,WACHyD,GAAI,WAER9B,cAAe,gDACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAGO,WAAb1C,GAAyB0C,GAAQ,GACrB,iBAAb1C,GACa,eAAbA,EAEO0C,EAAO,GAEPA,GAGf1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,SACAA,EAAO,GACP,SACAA,EAAO,GACP,eACAA,EAAO,GACP,aAEA,YA7EmB5gE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,SAAS6gB,EAAU/C,EAAQQ,EAAe96D,EAAK+6D,GAC3C,OAAQ/6D,GACJ,IAAK,IACD,OAAO86D,EAAgB,gBAAkB,kBAC7C,IAAK,KACD,OAAOR,GAAUQ,EAAgB,UAAY,aACjD,IAAK,IACL,IAAK,KACD,OAAOR,GAAUQ,EAAgB,SAAW,YAChD,IAAK,IACL,IAAK,KACD,OAAOR,GAAUQ,EAAgB,OAAS,WAC9C,IAAK,IACL,IAAK,KACD,OAAOR,GAAUQ,EAAgB,QAAU,WAC/C,IAAK,IACL,IAAK,KACD,OAAOR,GAAUQ,EAAgB,OAAS,UAC9C,IAAK,IACL,IAAK,KACD,OAAOR,GAAUQ,EAAgB,OAAS,WAC9C,QACI,OAAOR,GAIV9d,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,+LAA+L/6C,MACnM,KAEJg7C,YAAa,6EAA6Eh7C,MACtF,KAEJo/C,kBAAkB,EAClBnE,SAAU,6CAA6Cj7C,MAAM,KAC7Dk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,oBACJC,IAAK,0BACLC,KAAM,iCAEVZ,cAAe,SACfC,KAAM,SAAUvrD,GACZ,MAAiB,OAAVA,GAEXwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,KAEA,MAGf/B,SAAU,CACNC,QAAS,eACTC,QAAS,eACTC,SAAU,iBACVC,QAAS,eACTC,SAAU,qBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,UACNpiD,EAAG8lD,EACHzD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAGuD,EACHtD,GAAIsD,EACJ/pC,EAAG+pC,EACHrD,GAAIqD,EACJpD,EAAGoD,EACHnD,GAAImD,EACJ3G,EAAG2G,EACHlD,GAAIkD,GAERjD,uBAAwB,eACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOxB,EAAS,QACpB,QACI,OAAOA,MAhGejgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGb,SAAS2E,EAAe3F,EAAQQ,EAAep7D,EAAQq7D,GACnD,IAAI0C,EAAS,GACb,GAAI3C,EACA,OAAQp7D,GACJ,IAAK,IACD+9D,EAAS,aACT,MACJ,IAAK,KACDA,EAAS,WACT,MACJ,IAAK,IACDA,EAAS,WACT,MACJ,IAAK,KACDA,EAAS,YACT,MACJ,IAAK,IACDA,EAAS,SACT,MACJ,IAAK,KACDA,EAAS,SACT,MACJ,IAAK,IACDA,EAAS,UACT,MACJ,IAAK,KACDA,EAAS,UACT,MACJ,IAAK,IACDA,EAAS,WACT,MACJ,IAAK,KACDA,EAAS,WACT,MACJ,IAAK,IACDA,EAAS,UACT,MACJ,IAAK,KACDA,EAAS,gBAIjB,OAAQ/9D,GACJ,IAAK,IACD+9D,EAAS,eACT,MACJ,IAAK,KACDA,EAAS,aACT,MACJ,IAAK,IACDA,EAAS,aACT,MACJ,IAAK,KACDA,EAAS,aACT,MACJ,IAAK,IACDA,EAAS,WACT,MACJ,IAAK,KACDA,EAAS,WACT,MACJ,IAAK,IACDA,EAAS,YACT,MACJ,IAAK,KACDA,EAAS,YACT,MACJ,IAAK,IACDA,EAAS,cACT,MACJ,IAAK,KACDA,EAAS,cACT,MACJ,IAAK,IACDA,EAAS,YACT,MACJ,IAAK,KACDA,EAAS,YAIrB,OAAOA,EAAOvuD,QAAQ,MAAOorD,GAGxB9d,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,gFAAgFh7C,MACzF,KAEJo/C,kBAAkB,EAClBnE,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,kCAAkCl7C,MAAM,KACvDm7C,YAAa,qBAAqBn7C,MAAM,KACxC07C,eAAgB,CACZC,GAAI,eACJC,IAAK,kBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,4BACLC,KAAM,mCAEVC,SAAU,CACNC,QAAS,UACTC,QAAS,aACTC,SAAU,WACVC,QAAS,WACTC,SAAU,mBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,WACNpiD,EAAG0oD,EACHrG,GAAIqG,EACJ9wD,EAAG8wD,EACHpG,GAAIoG,EACJnG,EAAGmG,EACHlG,GAAIkG,EACJ3sC,EAAG2sC,EACHjG,GAAIiG,EACJhG,EAAGgG,EACH/F,GAAI+F,EACJvJ,EAAGuJ,EACH9F,GAAI8F,GAER5E,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAGzBkiD,cAAe,qCACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,UAAb1C,GAAqC,UAAbA,EACjB0C,EAEM,WAAb1C,GACa,aAAbA,GACa,WAAbA,EAEO0C,GAAQ,GAAKA,EAAOA,EAAO,QAL/B,GAQX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,GAAQ,GAAKA,EAAO,EACb,QACAA,EAAO,GACP,QACAA,EAAO,GACP,SACAA,EAAO,GACP,WAEA,UAGfV,KAAM,CACFC,IAAK,EACLC,IAAK,KAvMyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,oFAAoF/6C,MACxF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,6CAA6Cj7C,MAAM,KAC7Dk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,4BACLC,KAAM,mCAEVZ,cAAe,8BACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,SAAb1C,EACO0C,EACa,cAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,WAAb1C,GAAsC,UAAbA,EACzB0C,EAAO,QADX,GAIX1C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACD,OACAA,EAAQ,GACR,YACAA,EAAQ,GACR,SAEA,SAGfU,SAAU,CACNC,QAAS,sBACTC,QAAS,kBACTC,SAAU,kBACVC,QAAS,sBACTC,SAAU,wBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,gBACNpiD,EAAG,gBACHqiD,GAAI,UACJzqD,EAAG,UACH0qD,GAAI,WACJC,EAAG,QACHC,GAAI,SACJzmC,EAAG,SACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,WACJxD,EAAG,UACHyD,GAAI,YAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KAzEyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,oFAAoF/6C,MACxF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,6CAA6Cj7C,MAAM,KAC7Dk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,4BACLC,KAAM,mCAEVZ,cAAe,8BACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,SAAb1C,EACO0C,EACa,cAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,WAAb1C,GAAsC,UAAbA,EACzB0C,EAAO,QADX,GAIX1C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACD,OACAA,EAAQ,GACR,YACAA,EAAQ,GACR,SAEA,SAGfU,SAAU,CACNC,QAAS,sBACTC,QAAS,kBACTC,SAAU,kBACVC,QAAS,sBACTC,SAAU,wBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,gBACNpiD,EAAG,gBACHqiD,GAAI,UACJzqD,EAAG,UACH0qD,GAAI,WACJC,EAAG,QACHC,GAAI,SACJzmC,EAAG,SACH0mC,GAAI,UACJC,EAAG,UACHC,GAAI,WACJxD,EAAG,UACHyD,GAAI,YAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KAzEyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,iEAAiEj7C,MACvE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,iBACTC,SAAU,gBACVC,QAAS,qBACTC,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,eACHqiD,GAAI,aACJzqD,EAAG,SACH0qD,GAAI,YACJC,EAAG,SACHC,GAAI,aACJzmC,EAAG,UACH0mC,GAAI,YACJC,EAAG,QACHC,GAAI,UACJxD,EAAG,OACHyD,GAAI,UAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KArDyBpgE,CAAQ,EAAQ,2FCKlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,2FAA2F/6C,MAC/F,KAEJg7C,YAAa,mDAAmDh7C,MAAM,KACtEi7C,SAAU,wDAAwDj7C,MAC9D,KAEJk7C,cAAe,2BAA2Bl7C,MAAM,KAChDm7C,YAAa,2BAA2Bn7C,MAAM,KAE9C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,kBACTC,QAAS,sBACTC,SAAU,gBACVC,QAAS,mBACTC,SAAU,6BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,gBACRC,KAAM,kBACNpiD,EAAG,kBACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,WACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,SACH0mC,GAAI,SACJC,EAAG,OACHC,GAAI,OACJxD,EAAG,UACHyD,GAAI,WAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAGzBokD,KAAM,CACFC,IAAK,EACLC,IAAK,KAvFyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qFAAqF/6C,MACzF,KAEJg7C,YAAa,6DAA6Dh7C,MACtE,KAEJo/C,kBAAkB,EAClBnE,SAAU,qDAAqDj7C,MAAM,KACrEk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,eACJC,IAAK,2BACLC,KAAM,iCAEVC,SAAU,CACNC,QAAS,iBACTC,QAAS,oBACTC,SAAU,gBACVC,QAAS,iBACTC,SAAU,0BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAAG,gBACHqiD,GAAI,cACJzqD,EAAG,aACH0qD,GAAI,cACJC,EAAG,UACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,WACJ+B,EAAG,SACHC,GAAI,UACJ/B,EAAG,WACHC,GAAI,aACJxD,EAAG,SACHyD,GAAI,SAERC,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAzDyBpgE,CAAQ,EAAQ,2FCClD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,uFAAuF/6C,MAC3F,KAEJg7C,YAAa,uEAAuEh7C,MAChF,KAEJo/C,kBAAkB,EAClBnE,SAAU,wDAAwDj7C,MAC9D,KAEJk7C,cAAe,0CAA0Cl7C,MAAM,KAC/Dm7C,YAAa,4BAA4Bn7C,MAAM,KAC/C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,eACJC,IAAK,kBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,4BACLC,KAAM,mCAEVoC,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAGzBkiD,cAAe,yBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,SAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,UAAb1C,EACA0C,EACa,WAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,SAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,OACAA,EAAO,GACP,QACAA,EAAO,GACP,SACAA,EAAO,GACP,OAEA,QAGf/B,SAAU,CACNC,QAAS,UACTC,QAAS,YACTC,SAAU,qBACVC,QAAS,YACTC,SAAU,oBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,OACRC,KAAM,WACNpiD,EAAG,YACHqiD,GAAI,aACJzqD,EAAG,WACH0qD,GAAI,WACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,SACJC,EAAG,WACHC,GAAI,WACJxD,EAAG,UACHyD,GAAI,WAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KAtHyBpgE,CAAQ,EAAQ,8FCIlD,SAAWmiD,GAAU,aAIzB,IAAIkiB,EAAsB,6DAA6DzhD,MAC/E,KAEJ0hD,EAAyB,kDAAkD1hD,MACvE,KAEJ0/C,EAAc,CACV,QACA,QACA,iBACA,QACA,SACA,cACA,cACA,QACA,QACA,QACA,QACA,SAEJC,EAAc,qKAEPpgB,EAAOub,aAAa,QAAS,CACpCC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,SAAU9oD,EAAG4S,GACtB,OAAK5S,EAEM,QAAQmO,KAAKyE,GACb48C,EAAuBxvD,EAAE6uD,SAEzBU,EAAoBvvD,EAAE6uD,SAJtBU,GAQf9B,YAAaA,EACbR,iBAAkBQ,EAClBK,kBAAmB,4FACnBC,uBAAwB,mFAExBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAElBzE,SAAU,6DAA6Dj7C,MACnE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,kBACTC,QAAS,iBACTC,SAAU,eACVC,QAAS,mBACTC,SAAU,2BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,aACNpiD,EAAG,oBACHqiD,GAAI,cACJzqD,EAAG,aACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,SACJzmC,EAAG,UACH0mC,GAAI,WACJC,EAAG,YACHC,GAAI,aACJxD,EAAG,WACHyD,GAAI,WAERC,uBAAwB,kBACxBC,QAAS,SAAUC,GACf,OACIA,GACY,IAAXA,GAA2B,IAAXA,GAAgBA,GAAU,GAAK,MAAQ,OAGhEC,KAAM,CACFC,IAAK,EACLC,IAAK,KAnGyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAIkiB,EAAsB,6DAA6DzhD,MAC/E,KAEJ0hD,EAAyB,kDAAkD1hD,MACvE,KAEJ0/C,EAAc,CACV,QACA,QACA,iBACA,QACA,SACA,cACA,cACA,QACA,QACA,QACA,QACA,SAEJC,EAAc,qKAETpgB,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,SAAU9oD,EAAG4S,GACtB,OAAK5S,EAEM,QAAQmO,KAAKyE,GACb48C,EAAuBxvD,EAAE6uD,SAEzBU,EAAoBvvD,EAAE6uD,SAJtBU,GAQf9B,YAAaA,EACbR,iBAAkBQ,EAClBK,kBAAmB,4FACnBC,uBAAwB,mFAExBP,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAElBzE,SAAU,6DAA6Dj7C,MACnE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,kBACTC,QAAS,iBACTC,SAAU,eACVC,QAAS,mBACTC,SAAU,2BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,aACNpiD,EAAG,oBACHqiD,GAAI,cACJzqD,EAAG,aACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,SACJzmC,EAAG,UACH0mC,GAAI,WACJ+B,EAAG,WACHC,GAAI,WACJ/B,EAAG,YACHC,GAAI,aACJxD,EAAG,WACHyD,GAAI,WAERC,uBAAwB,kBACxBC,QAAS,SAAUC,GACf,OACIA,GACY,IAAXA,GAA2B,IAAXA,GAAgBA,GAAU,GAAK,MAAQ,OAGhEC,KAAM,CACFC,IAAK,EACLC,IAAK,KArGyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qFAAqF/6C,MACzF,KAEJg7C,YAAa,6DAA6Dh7C,MACtE,KAEJo/C,kBAAkB,EAClBnE,SAAU,qDAAqDj7C,MAAM,KACrEk7C,cAAe,+BAA+Bl7C,MAAM,KACpDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,eACJC,IAAK,0BACLC,KAAM,iCAEVC,SAAU,CACNC,QAAS,oBACTC,QAAS,uBACTC,SAAU,mBACVC,QAAS,oBACTC,SAAU,gCACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,WACNpiD,EAAG,eACHqiD,GAAI,YACJzqD,EAAG,aACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,UACH0mC,GAAI,WACJ+B,EAAG,UACHC,GAAI,WACJ/B,EAAG,YACHC,GAAI,aACJxD,EAAG,SACHyD,GAAI,SAERC,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAzDyBpgE,CAAQ,EAAQ,+FCElD,SAAWmiD,GAAU,aAIbA,EAAOub,aAAa,SAAU,CACtCC,OAAQ,CACJ2D,WAAY,qFAAqF1+C,MAC7F,KAEJ8E,OAAQ,sHAAsH9E,MAC1H,KAEJ2+C,SAAU,mBAEd3D,YAAa,+DAA+Dh7C,MACxE,KAEJo/C,kBAAkB,EAClBnE,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,mBACJuE,GAAI,aACJtE,IAAK,4BACLuE,IAAK,mBACLtE,KAAM,iCACNuE,KAAM,wBAEVtE,SAAU,CACNC,QAAS,aACTC,QAAS,eACTC,SAAU,cACVC,QAAS,aACTC,SAAU,qBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,QACNpiD,EAAG,gBACHqiD,GAAI,cACJzqD,EAAG,aACH0qD,GAAI,aACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,WACJC,EAAG,SACHC,GAAI,WACJxD,EAAG,QACHyD,GAAI,UAERC,uBAAwB,qBACxBC,QAAS,SAAUC,EAAQwB,GACvB,IAAI2B,EACW,IAAXnD,EACM,IACW,IAAXA,EACA,IACW,IAAXA,EACA,IACW,IAAXA,EACA,IACA,IAIV,MAHe,MAAXwB,GAA6B,MAAXA,IAClB2B,EAAS,KAENnD,EAASmD,GAEpBlD,KAAM,CACFC,IAAK,EACLC,IAAK,KAjFyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGF9e,EAAOub,aAAa,QAAS,CAEpCC,OAAQ,sEAAsE/6C,MAC1E,KAEJg7C,YAAa,sEAAsEh7C,MAC/E,KAEJi7C,SAAU,yDAAyDj7C,MAC/D,KAEJk7C,cAAe,iCAAiCl7C,MAAM,KACtDm7C,YAAa,iCAAiCn7C,MAAM,KACpD07C,eAAgB,CACZC,GAAI,aACJC,IAAK,gBACLC,EAAG,aACHC,GAAI,cACJC,IAAK,0BACLC,KAAM,iCAEVC,SAAU,CACNC,QAAS,UACTC,QAAS,UACTC,SAAU,kBACVC,QAAS,UACTC,SAAU,mBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,UACRC,KAAM,WACNpiD,EAAG,YACHqiD,GAAI,WACJzqD,EAAG,UACH0qD,GAAI,UACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,YACHC,GAAI,WACJxD,EAAG,UACHyD,GAAI,UAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAKzBkiD,cAAe,uBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,QAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,SAAb1C,EACA0C,EACa,WAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,SAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,MACAA,EAAO,GACP,OACAA,EAAO,GACP,SACAA,EAAO,GACP,OAEA,OAGfV,KAAM,CACFC,IAAK,EACLC,IAAK,KAvHyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI0jB,EAAmB,mGAAmGjjD,MAClH,KAEJkjD,EAAmB,qGAAqGljD,MACpH,KAEJ0/C,EAAc,CACV,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SAER,SAASe,EAAOhjD,GACZ,OAAOA,EAAI,GAAK,GAAKA,EAAI,GAAK,MAAQA,EAAI,IAAM,IAAO,EAE3D,SAAS2iD,EAAU/C,EAAQQ,EAAe96D,GACtC,IAAIS,EAAS65D,EAAS,IACtB,OAAQt6D,GACJ,IAAK,KACD,OAAOS,GAAUi9D,EAAOpD,GAAU,UAAY,UAClD,IAAK,IACD,OAAOQ,EAAgB,SAAW,SACtC,IAAK,KACD,OAAOr6D,GAAUi9D,EAAOpD,GAAU,SAAW,SACjD,IAAK,IACD,OAAOQ,EAAgB,UAAY,UACvC,IAAK,KACD,OAAOr6D,GAAUi9D,EAAOpD,GAAU,UAAY,UAClD,IAAK,KACD,OAAO75D,GAAUi9D,EAAOpD,GAAU,WAAa,WACnD,IAAK,KACD,OAAO75D,GAAUi9D,EAAOpD,GAAU,WAAa,YACnD,IAAK,KACD,OAAO75D,GAAUi9D,EAAOpD,GAAU,OAAS,QAI9C9d,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,SAAU8F,EAAgB/7C,GAC9B,OAAK+7C,EAEM,SAASxgD,KAAKyE,GACdo+C,EAAiBrC,EAAeE,SAEhCkC,EAAiBpC,EAAeE,SAJhCkC,GAOfjI,YAAa,kDAAkDh7C,MAAM,KACrE0/C,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAClBzE,SAAU,6DAA6Dj7C,MACnE,KAEJk7C,cAAe,2BAA2Bl7C,MAAM,KAChDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,cACTC,QAAS,eACTC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,qBAEX,KAAK,EACD,MAAO,mBAEX,KAAK,EACD,MAAO,iBAEX,KAAK,EACD,MAAO,kBAEX,QACI,MAAO,oBAGnBvC,QAAS,iBACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACD,MAAO,4BACX,KAAK,EACD,MAAO,wBACX,KAAK,EACD,MAAO,yBACX,QACI,MAAO,2BAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG,eACHqiD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAGuD,EACHtD,GAAIsD,EACJ/pC,EAAG,UACH0mC,GAAI,SACJ+B,EAAG,UACHC,GAAIqB,EACJpD,EAAG,UACHC,GAAImD,EACJ3G,EAAG,MACHyD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAzIyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,2FAA2F/6C,MAC/F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,iFAAiFj7C,MACvF,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,mCACLC,KAAM,0CAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,iBACTC,SAAU,eACVC,QAAS,gBACTC,SAAU,WACN,OAAsB,IAAfp/D,KAAK0hE,OAA8B,IAAf1hE,KAAK0hE,MAC1B,wBACA,yBAEVrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,QACNpiD,EAAG,kBACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJC,EAAG,SACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTiE,YAAa,kBAxDqBjkE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,2FAA2F/6C,MAC/F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,iFAAiFj7C,MACvF,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,8BACLC,KAAM,qCAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,iBACTC,SAAU,eACVC,QAAS,gBACTC,SAAU,WACN,OAAsB,IAAfp/D,KAAK0hE,OAA8B,IAAf1hE,KAAK0hE,MAC1B,wBACA,yBAEVrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,QACNpiD,EAAG,WACHqiD,GAAI,cACJzqD,EAAG,YACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,UACJ+B,EAAG,aACHC,GAAI,aACJ/B,EAAG,SACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,WAERC,uBAAwB,WACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA5DyBpgE,CAAQ,EAAQ,2FCKlD,SAAWmiD,GAAU,aAIzB,SAASgf,EAAuBlB,EAAQQ,EAAe96D,GACnD,IASIogE,EAAY,IAIhB,OAHI9F,EAAS,KAAO,IAAOA,GAAU,KAAOA,EAAS,KAAQ,KACzD8F,EAAY,QAET9F,EAAS8F,EAbH,CACLxG,GAAI,UACJC,GAAI,SACJE,GAAI,MACJC,GAAI,OACJgC,GAAI,YACJ9B,GAAI,OACJC,GAAI,OAMuBn6D,GAG9Bw8C,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,oGAAoG/6C,MACxG,KAEJg7C,YAAa,+DAA+Dh7C,MACxE,KAEJo/C,kBAAkB,EAClBnE,SAAU,kDAAkDj7C,MAAM,KAClEk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,cACJC,IAAK,mBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,cACTC,QAAS,gBACTC,SAAU,eACVC,QAAS,eACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,aACNpiD,EAAG,iBACHqiD,GAAI4B,EACJrsD,EAAG,WACH0qD,GAAI2B,EACJ1B,EAAG,QACHC,GAAIyB,EACJloC,EAAG,OACH0mC,GAAIwB,EACJO,EAAG,cACHC,GAAIR,EACJvB,EAAG,SACHC,GAAIsB,EACJ9E,EAAG,QACHyD,GAAIqB,GAERjB,KAAM,CACFC,IAAK,EACLC,IAAK,KAvEyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAYzB,SAASgf,EAAuBlB,EAAQQ,EAAe96D,GAUnD,MAAY,MAARA,EACO86D,EAAgB,SAAW,SAE3BR,EAAS,KArBFmB,GAqB6BnB,EApB3CoB,EAQS,CACT9B,GAAIkB,EAAgB,yBAA2B,yBAC/CjB,GAAIiB,EAAgB,sBAAwB,sBAC5Cf,GAAI,iBACJC,GAAI,gBACJgC,GAAI,uBACJ9B,GAAI,uBACJC,GAAI,gBAKgCn6D,GApBvBid,MAAM,KAChBw+C,EAAM,IAAO,GAAKA,EAAM,KAAQ,GACjCC,EAAM,GACND,EAAM,IAAM,GAAKA,EAAM,IAAM,IAAMA,EAAM,IAAM,IAAMA,EAAM,KAAO,IAClEC,EAAM,GACNA,EAAM,IANhB,IAAsBD,EACdC,EAuBR,IAAIiB,EAAc,CACd,QACA,QACA,QACA,QACA,WACA,QACA,QACA,QACA,QACA,QACA,QACA,SAMKngB,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,CACJj2C,OAAQ,oFAAoF9E,MACxF,KAEJ0+C,WAAY,kFAAkF1+C,MAC1F,MAGRg7C,YAAa,CAETl2C,OAAQ,gEAAgE9E,MACpE,KAEJ0+C,WAAY,gEAAgE1+C,MACxE,MAGRi7C,SAAU,CACNyD,WAAY,gEAAgE1+C,MACxE,KAEJ8E,OAAQ,gEAAgE9E,MACpE,KAEJ2+C,SAAU,iDAEdzD,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C0/C,YAAaA,EACbQ,gBAAiBR,EACjBS,iBAAkBT,EAGlBC,YAAa,2MAGbR,iBAAkB,2MAGlBa,kBAAmB,wHAGnBC,uBAAwB,6FACxBvE,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,iBACJC,IAAK,uBACLC,KAAM,8BAEVC,SAAU,CACNC,QAAS,kBACTC,QAAS,iBACTE,QAAS,gBACTD,SAAU,SAAU3U,GAChB,GAAIA,EAAI6V,SAAWpgE,KAAKogE,OAcpB,OAAmB,IAAfpgE,KAAK0hE,MACE,oBAEA,mBAhBX,OAAQ1hE,KAAK0hE,OACT,KAAK,EACD,MAAO,6BACX,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,6BACX,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,+BAUvBtC,SAAU,SAAU7U,GAChB,GAAIA,EAAI6V,SAAWpgE,KAAKogE,OAcpB,OAAmB,IAAfpgE,KAAK0hE,MACE,oBAEA,mBAhBX,OAAQ1hE,KAAK0hE,OACT,KAAK,EACD,MAAO,2BACX,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,2BACX,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,6BAUvBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,WACNpiD,EAAG,mBACHqiD,GAAI4B,EACJrsD,EAAGqsD,EACH3B,GAAI2B,EACJ1B,EAAG,MACHC,GAAIyB,EACJloC,EAAG,OACH0mC,GAAIwB,EACJO,EAAG,SACHC,GAAIR,EACJvB,EAAG,QACHC,GAAIsB,EACJ9E,EAAG,MACHyD,GAAIqB,GAERnD,cAAe,wBACfC,KAAM,SAAUvrD,GACZ,MAAO,iBAAiBuQ,KAAKvQ,IAEjCwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,OACAA,EAAO,GACP,OACAA,EAAO,GACP,MAEA,UAGfb,uBAAwB,mBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOxB,EAAS,KACpB,IAAK,IACD,OAAOA,EAAS,MACpB,IAAK,IACL,IAAK,IACD,OAAOA,EAAS,KACpB,QACI,OAAOA,IAGnBC,KAAM,CACFC,IAAK,EACLC,IAAK,KA1MyBpgE,CAAQ,EAAQ,2FCClD,SAAWmiD,GAAU,aAIzB,IAAIwb,EAAS,CACL,QACA,UACA,OACA,QACA,MACA,MACA,SACA,OACA,UACA,SACA,QACA,SAEJqI,EAAO,CAAC,MAAO,OAAQ,QAAS,OAAQ,OAAQ,MAAO,QAElD7jB,EAAOub,aAAa,KAAM,CAC/BC,OAAQA,EACRC,YAAaD,EACbE,SAAUmI,EACVlI,cAAekI,EACfjI,YAAaiI,EACb1H,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVZ,cAAe,UACfC,KAAM,SAAUvrD,GACZ,MAAO,QAAUA,GAErBwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,MAEJ,OAEX/B,SAAU,CACNC,QAAS,UACTC,QAAS,aACTC,SAAU,yBACVC,QAAS,aACTC,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,QACNpiD,EAAG,YACHqiD,GAAI,WACJzqD,EAAG,SACH0qD,GAAI,SACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,WACH0mC,GAAI,WACJC,EAAG,WACHC,GAAI,WACJxD,EAAG,SACHyD,GAAI,UAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCisD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCqrD,KAAM,CACFC,IAAK,EACLC,IAAK,KA/EyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,mJAAmJ/6C,MACvJ,KAEJg7C,YAAa,6DAA6Dh7C,MACtE,KAEJi7C,SAAU,6EAA6Ej7C,MACnF,KAEJk7C,cAAe,mCAAmCl7C,MAAM,KACxDm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,oBACJC,IAAK,gCACLC,KAAM,uCAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,iBACTC,SAAU,eACVC,QAAS,eACTC,SAAU,wBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,WACNpiD,EAAG,mBACHqiD,GAAI,eACJzqD,EAAG,eACH0qD,GAAI,cACJC,EAAG,cACHC,GAAI,aACJzmC,EAAG,cACH0mC,GAAI,cACJC,EAAG,aACHC,GAAI,WACJxD,EAAG,aACHyD,GAAI,YAERC,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAvDyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAKhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,kGAAkG/6C,MACtG,KAEJg7C,YAAa,wDAAwDh7C,MACjE,KAEJi7C,SAAU,gEAAgEj7C,MACtE,KAEJk7C,cAAe,gCAAgCl7C,MAAM,KACrDm7C,YAAa,qBAAqBn7C,MAAM,KACxC+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,sBACLC,KAAM,sCAEVC,SAAU,CACNC,QAAS,aACTC,QAAS,cACTC,SAAU,aACVC,QAAS,cACTC,SAAU,sBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,WACNpiD,EAAG,eACHqiD,GAAI,WACJzqD,EAAG,YACH0qD,GAAI,cACJC,EAAG,MACHC,GAAI,SACJzmC,EAAG,OACH0mC,GAAI,SACJC,EAAG,OACHC,GAAI,SACJxD,EAAG,MACHyD,GAAI,UAERC,uBAAwB,eACxBC,QAAS,SAAUC,GACf,OAAOA,EAAS,SAEpBjC,cAAe,4BACfC,KAAM,SAAUvrD,GACZ,MAAiB,SAAVA,GAA8B,YAAVA,GAE/BwrD,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACDE,EAAU,OAAS,UAEnBA,EAAU,QAAU,aAjEDr+D,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIzB,IAAIwb,EAAS,oFAAoF/6C,MACzF,KAEJg7C,EAAc,kDAAkDh7C,MAAM,KAC1E,SAASygD,EAAOhjD,GACZ,OAAOA,EAAI,GAAKA,EAAI,EAExB,SAAS2iD,EAAU/C,EAAQQ,EAAe96D,EAAK+6D,GAC3C,IAAIt6D,EAAS65D,EAAS,IACtB,OAAQt6D,GACJ,IAAK,IACD,OAAO86D,GAAiBC,EAAW,aAAe,gBACtD,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,UAAY,UAEvC75D,EAAS,YAExB,IAAK,IACD,OAAOq6D,EAAgB,SAAWC,EAAW,SAAW,UAC5D,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,SAAW,SAEtC75D,EAAS,WAExB,IAAK,IACD,OAAOq6D,EAAgB,SAAWC,EAAW,SAAW,UAC5D,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,SAAW,SAEtC75D,EAAS,WAExB,IAAK,IACD,OAAOq6D,GAAiBC,EAAW,MAAQ,OAC/C,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,MAAQ,OAEnC75D,EAAS,QAExB,IAAK,IACD,OAAOq6D,GAAiBC,EAAW,SAAW,WAClD,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,UAAY,YAEvC75D,EAAS,WAExB,IAAK,IACD,OAAOq6D,GAAiBC,EAAW,MAAQ,QAC/C,IAAK,KACD,OAAID,GAAiBC,EACVt6D,GAAUi9D,EAAOpD,GAAU,OAAS,SAEpC75D,EAAS,SAKvB+7C,EAAOub,aAAa,KAAM,CAC/BC,OAAQA,EACRC,YAAaA,EACbC,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,eACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,cACTC,QAAS,gBACTC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,kBACX,KAAK,EACL,KAAK,EACD,MAAO,kBACX,KAAK,EACD,MAAO,kBACX,KAAK,EACD,MAAO,oBACX,KAAK,EACD,MAAO,kBACX,KAAK,EACD,MAAO,oBAGnBvC,QAAS,eACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACD,MAAO,uBACX,KAAK,EACL,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,uBACX,KAAK,EACL,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,yBAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG8lD,EACHzD,GAAIyD,EACJluD,EAAGkuD,EACHxD,GAAIwD,EACJvD,EAAGuD,EACHtD,GAAIsD,EACJ/pC,EAAG+pC,EACHrD,GAAIqD,EACJpD,EAAGoD,EACHnD,GAAImD,EACJ3G,EAAG2G,EACHlD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA7IyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIt6D,EAAS65D,EAAS,IACtB,OAAQt6D,GACJ,IAAK,IACD,OAAO86D,GAAiBC,EAClB,eACA,kBACV,IAAK,KAUD,OARIt6D,GADW,IAAX65D,EACUQ,EAAgB,UAAY,UACpB,IAAXR,EACGQ,GAAiBC,EAAW,UAAY,WAC3CT,EAAS,EACNQ,GAAiBC,EAAW,UAAY,WAExC,UAGlB,IAAK,IACD,OAAOD,EAAgB,aAAe,aAC1C,IAAK,KAUD,OARIr6D,GADW,IAAX65D,EACUQ,EAAgB,SAAW,SACnB,IAAXR,EACGQ,GAAiBC,EAAW,SAAW,WAC1CT,EAAS,EACNQ,GAAiBC,EAAW,SAAW,WAEvCD,GAAiBC,EAAW,QAAU,YAGxD,IAAK,IACD,OAAOD,EAAgB,UAAY,UACvC,IAAK,KAUD,OARIr6D,GADW,IAAX65D,EACUQ,EAAgB,MAAQ,MAChB,IAAXR,EACGQ,GAAiBC,EAAW,MAAQ,QACvCT,EAAS,EACNQ,GAAiBC,EAAW,MAAQ,QAEpCD,GAAiBC,EAAW,KAAO,SAGrD,IAAK,IACD,OAAOD,GAAiBC,EAAW,SAAW,YAClD,IAAK,KAQD,OANIt6D,GADW,IAAX65D,EACUQ,GAAiBC,EAAW,MAAQ,OAC5B,IAAXT,EACGQ,GAAiBC,EAAW,MAAQ,UAEpCD,GAAiBC,EAAW,MAAQ,SAGtD,IAAK,IACD,OAAOD,GAAiBC,EAAW,WAAa,eACpD,IAAK,KAUD,OARIt6D,GADW,IAAX65D,EACUQ,GAAiBC,EAAW,QAAU,UAC9B,IAAXT,EACGQ,GAAiBC,EAAW,SAAW,WAC1CT,EAAS,EACNQ,GAAiBC,EAAW,SAAW,SAEvCD,GAAiBC,EAAW,UAAY,UAG1D,IAAK,IACD,OAAOD,GAAiBC,EAAW,WAAa,aACpD,IAAK,KAUD,OARIt6D,GADW,IAAX65D,EACUQ,GAAiBC,EAAW,OAAS,QAC7B,IAAXT,EACGQ,GAAiBC,EAAW,OAAS,SACxCT,EAAS,EACNQ,GAAiBC,EAAW,OAAS,OAErCD,GAAiBC,EAAW,MAAQ,SAMrDve,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,8DAA8Dh7C,MACvE,KAEJo/C,kBAAkB,EAClBnE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,eACHC,GAAI,eACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,gBAETC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,wBACX,KAAK,EACD,MAAO,sBACX,KAAK,EACD,MAAO,uBACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,qBAGnBvC,QAAS,iBACTC,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACD,MAAO,+BACX,KAAK,EACD,MAAO,6BACX,KAAK,EACD,MAAO,8BACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,4BAGnBrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,UACNpiD,EAAGomD,EACH/D,GAAI+D,EACJxuD,EAAGwuD,EACH9D,GAAI8D,EACJ7D,EAAG6D,EACH5D,GAAI4D,EACJrqC,EAAGqqC,EACH3D,GAAI2D,EACJ1D,EAAG0D,EACHzD,GAAIyD,EACJjH,EAAGiH,EACHxD,GAAIwD,GAERvD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAxKyBpgE,CAAQ,EAAQ,2FCKlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,gFAAgF/6C,MACpF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,4DAA4Dj7C,MAClE,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,mBAAmBn7C,MAAM,KACtC+9C,oBAAoB,EACpB3C,cAAe,QACfC,KAAM,SAAUvrD,GACZ,MAA2B,MAApBA,EAAMnN,OAAO,IAExB24D,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAOF,EAAQ,GAAK,KAAO,MAE/BG,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,cACTC,QAAS,gBACTC,SAAU,eACVC,QAAS,cACTC,SAAU,wBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,aACNpiD,EAAG,eACHqiD,GAAI,aACJzqD,EAAG,aACH0qD,GAAI,YACJC,EAAG,UACHC,GAAI,SACJzmC,EAAG,WACH0mC,GAAI,UACJC,EAAG,WACHC,GAAI,UACJxD,EAAG,UACHyD,GAAI,WAERC,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA7DyBpgE,CAAQ,EAAQ,gGCElD,SAAWmiD,GAAU,aAIzB,IAAIqjB,EAAa,CACbC,MAAO,CAEHlG,GAAI,CAAC,UAAW,UAAW,WAC3BzqD,EAAG,CAAC,cAAe,gBACnB0qD,GAAI,CAAC,QAAS,SAAU,UACxBC,EAAG,CAAC,YAAa,eACjBC,GAAI,CAAC,MAAO,OAAQ,QACpBC,GAAI,CAAC,MAAO,OAAQ,QACpBE,GAAI,CAAC,QAAS,SAAU,UACxBC,GAAI,CAAC,SAAU,SAAU,WAE7B4F,uBAAwB,SAAUzF,EAAQ0F,GACtC,OAAkB,IAAX1F,EACD0F,EAAQ,GACR1F,GAAU,GAAKA,GAAU,EACzB0F,EAAQ,GACRA,EAAQ,IAElB3C,UAAW,SAAU/C,EAAQQ,EAAe96D,GACxC,IAAIggE,EAAUH,EAAWC,MAAM9/D,GAC/B,OAAmB,IAAfA,EAAIuJ,OACGuxD,EAAgBkF,EAAQ,GAAKA,EAAQ,GAGxC1F,EACA,IACAuF,EAAWE,uBAAuBzF,EAAQ0F,KAM7CxjB,EAAOub,aAAa,UAAW,CACxCC,OAAQ,mFAAmF/6C,MACvF,KAEJg7C,YAAa,2DAA2Dh7C,MACpE,KAEJo/C,kBAAkB,EAClBnE,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,cACHC,GAAI,gBACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,eACTC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,sBACX,KAAK,EACD,MAAO,qBACX,KAAK,EACD,MAAO,sBACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,oBAGnBvC,QAAS,cACTC,SAAU,WAUN,MATmB,CACf,2BACA,+BACA,4BACA,0BACA,8BACA,2BACA,4BAEgBp/D,KAAK0hE,QAE7BrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,mBACHqiD,GAAIiG,EAAWxC,UACfluD,EAAG0wD,EAAWxC,UACdxD,GAAIgG,EAAWxC,UACfvD,EAAG+F,EAAWxC,UACdtD,GAAI8F,EAAWxC,UACf/pC,EAAG,MACH0mC,GAAI6F,EAAWxC,UACfpD,EAAG,QACHC,GAAI2F,EAAWxC,UACf3G,EAAG,SACHyD,GAAI0F,EAAWxC,WAEnBjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAjHyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAIqjB,EAAa,CACbC,MAAO,CAEHlG,GAAI,CAAC,UAAW,UAAW,WAC3BzqD,EAAG,CAAC,cAAe,gBACnB0qD,GAAI,CAAC,QAAS,SAAU,UACxBC,EAAG,CAAC,YAAa,eACjBC,GAAI,CAAC,MAAO,OAAQ,QACpBC,GAAI,CAAC,MAAO,OAAQ,QACpBE,GAAI,CAAC,QAAS,SAAU,UACxBC,GAAI,CAAC,SAAU,SAAU,WAE7B4F,uBAAwB,SAAUzF,EAAQ0F,GACtC,OAAkB,IAAX1F,EACD0F,EAAQ,GACR1F,GAAU,GAAKA,GAAU,EACzB0F,EAAQ,GACRA,EAAQ,IAElB3C,UAAW,SAAU/C,EAAQQ,EAAe96D,GACxC,IAAIggE,EAAUH,EAAWC,MAAM9/D,GAC/B,OAAmB,IAAfA,EAAIuJ,OACGuxD,EAAgBkF,EAAQ,GAAKA,EAAQ,GAGxC1F,EACA,IACAuF,EAAWE,uBAAuBzF,EAAQ0F,KAMjDxjB,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,mFAAmF/6C,MACvF,KAEJg7C,YAAa,2DAA2Dh7C,MACpE,KAEJo/C,kBAAkB,EAClBnE,SAAU,wDAAwDj7C,MAC9D,KAEJk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,cACHC,GAAI,gBACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,eACTC,SAAU,WACN,OAAQl/D,KAAK0hE,OACT,KAAK,EACD,MAAO,uBACX,KAAK,EACD,MAAO,qBACX,KAAK,EACD,MAAO,sBACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,MAAO,oBAGnBvC,QAAS,cACTC,SAAU,WAUN,MATmB,CACf,4BACA,gCACA,4BACA,0BACA,8BACA,2BACA,4BAEgBp/D,KAAK0hE,QAE7BrC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,SACNpiD,EAAG,mBACHqiD,GAAIiG,EAAWxC,UACfluD,EAAG0wD,EAAWxC,UACdxD,GAAIgG,EAAWxC,UACfvD,EAAG+F,EAAWxC,UACdtD,GAAI8F,EAAWxC,UACf/pC,EAAG,MACH0mC,GAAI6F,EAAWxC,UACfpD,EAAG,QACHC,GAAI2F,EAAWxC,UACf3G,EAAG,SACHyD,GAAI0F,EAAWxC,WAEnBjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAnHyBpgE,CAAQ,EAAQ,2FCElD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,mHAAmH/6C,MACvH,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,sEAAsEj7C,MAC5E,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,mBACTC,QAAS,kBACTC,SAAU,gBACVC,QAAS,iBACTC,SAAU,8BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,iBACNpiD,EAAG,qBACHqiD,GAAI,cACJzqD,EAAG,SACH0qD,GAAI,aACJC,EAAG,SACHC,GAAI,aACJzmC,EAAG,UACH0mC,GAAI,cACJC,EAAG,UACHC,GAAI,cACJxD,EAAG,UACHyD,GAAI,eAER9B,cAAe,mCACfE,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACD,UACAA,EAAQ,GACR,QACAA,EAAQ,GACR,aAEA,WAGf2D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,YAAb1C,EACO0C,EACa,UAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,eAAb1C,GAA0C,YAAbA,EACvB,IAAT0C,EACO,EAEJA,EAAO,QAJX,GAOXb,uBAAwB,UACxBC,QAAS,KACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAjFyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,oDAAoDj7C,MAAM,KACpEk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,0BACLC,KAAM,+BACNsE,IAAK,mBACLC,KAAM,wBAEVtE,SAAU,CACNC,QAAS,YACTC,QAAS,eACTE,QAAS,YACTD,SAAU,eACVE,SAAU,iBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,eACNpiD,EAAG,iBACHqiD,GAAI,cACJzqD,EAAG,WACH0qD,GAAI,aACJC,EAAG,WACHC,GAAI,YACJzmC,EAAG,SACH0mC,GAAI,WACJC,EAAG,WACHC,GAAI,aACJxD,EAAG,SACHyD,GAAI,SAERC,uBAAwB,mBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,GAEM,IAANA,EADA,KAIA,OAIlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KAlEyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,sFAAsF/6C,MAC1F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,8DAA8Dj7C,MACpE,KAEJk7C,cAAe,kCAAkCl7C,MAAM,KACvDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,UACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,iBACTC,SAAU,8BACVC,QAAS,YACTC,SAAU,kCACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,aACRC,KAAM,WACNpiD,EAAG,aACHqiD,GAAI,aACJzqD,EAAG,cACH0qD,GAAI,YACJC,EAAG,aACHC,GAAI,WACJzmC,EAAG,YACH0mC,GAAI,UACJC,EAAG,cACHC,GAAI,WACJxD,EAAG,cACHyD,GAAI,YAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KApDyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI4e,EAAY,CACR,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,IACH,EAAG,KAEPE,EAAY,CACR,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KAGJ9e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,0FAA0Fh7C,MACnG,KAEJi7C,SAAU,8FAA8Fj7C,MACpG,KAEJk7C,cAAe,mDAAmDl7C,MAC9D,KAEJm7C,YAAa,sBAAsBn7C,MAAM,KACzC07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,aACTC,QAAS,YACTC,SAAU,WACVC,QAAS,cACTC,SAAU,yBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,UACNpiD,EAAG,oBACHqiD,GAAI,eACJzqD,EAAG,cACH0qD,GAAI,gBACJC,EAAG,gBACHC,GAAI,eACJzmC,EAAG,WACH0mC,GAAI,aACJC,EAAG,YACHC,GAAI,cACJxD,EAAG,aACHyD,GAAI,eAERC,uBAAwB,aACxBC,QAAS,SAAUC,GACf,OAAOA,EAAS,OAEpBe,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,iBAAiB,SAAUiH,GAC7C,OAAOmlD,EAAUnlD,OAGzBglD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,OAAO,SAAUiH,GACnC,OAAOilD,EAAUjlD,OAIzBkiD,cAAe,wCACfE,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,SACAA,EAAO,EACP,SACAA,EAAO,GACP,QACAA,EAAO,GACP,WACAA,EAAO,GACP,WACAA,EAAO,GACP,QAEA,UAGfkB,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,UAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,UAAb1C,GAAqC,SAAbA,GAEX,YAAbA,GACA0C,GAAQ,GAFRA,EAIAA,EAAO,IAGtBV,KAAM,CACFC,IAAK,EACLC,IAAK,KA/HyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,mEAAmEh7C,MAC5E,KAEJo/C,kBAAkB,EAClBnE,SAAU,8DAA8Dj7C,MACpE,KAEJk7C,cAAe,kCAAkCl7C,MAAM,KACvDm7C,YAAa,qBAAqBn7C,MAAM,KACxC07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,sBACLC,KAAM,6BAEVC,SAAU,CACNC,QAAS,YACTC,QAAS,YACTC,SAAU,WACVC,QAAS,aACTC,SAAU,gBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,YACNpiD,EAAG,iBACHqiD,GAAI,aACJzqD,EAAG,YACH0qD,GAAI,cACJC,EAAG,SACHC,GAAI,WACJzmC,EAAG,UACH0mC,GAAI,YACJC,EAAG,SACHC,GAAI,WACJxD,EAAG,cACHyD,GAAI,iBAERC,uBAAwB,WACxBC,QAAS,MACThC,cAAe,iCACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,WAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,SAAb1C,EACA0C,EACa,cAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,aAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,SACAA,EAAO,GACP,OACAA,EAAO,GACP,YACAA,EAAO,GACP,WAEA,UAGfV,KAAM,CACFC,IAAK,EACLC,IAAK,KApFyBpgE,CAAQ,EAAQ,4FCKlD,SAAWmiD,GAAU,aAIfA,EAAOub,aAAa,MAAO,CACjCC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,kDAAkDj7C,MAAM,KAClEk7C,cAAe,iCAAiCl7C,MAAM,KACtDm7C,YAAa,yBAAyBn7C,MAAM,KAC5C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,gBACTC,SAAU,gBACVC,QAAS,oBACTC,SAAU,+BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,WACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,aACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,YACH0mC,GAAI,WACJC,EAAG,YACHC,GAAI,WACJxD,EAAG,YACHyD,GAAI,YAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,OAGlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KAhEyBpgE,CAAQ,EAAQ,2FCClD,SAAWmiD,GAAU,aAIzB,IAAI+e,EAAW,CACX,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,EAAG,MACH,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,GAAI,MACJ,IAAK,OAGA/e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,CACJj2C,OAAQ,qFAAqF9E,MACzF,KAEJ0+C,WAAY,yEAAyE1+C,MACjF,MAGRg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,yDAAyDj7C,MAC/D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,mBACTC,QAAS,mBACTE,QAAS,mBACTD,SAAU,kCACVE,SAAU,oCACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,SACNpiD,EAAG,eACHpI,EAAG,YACH0qD,GAAI,YACJC,EAAG,UACHC,GAAI,UACJzmC,EAAG,SACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,SACJxD,EAAG,SACHyD,GAAI,UAER9B,cAAe,qBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,QAAb1C,EACO0C,EAAO,EAAIA,EAAOA,EAAO,GACZ,SAAb1C,EACA0C,EACa,QAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,UAAb1C,EACA0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,MACAA,EAAO,GACP,OACAA,EAAO,GACP,MACAA,EAAO,GACP,QAEA,OAGfb,uBAAwB,kBACxBC,QAAS,SAAUC,GAGf,OAAOA,GAAUiB,EAASjB,IAAWiB,EAF7BjB,EAAS,KAEmCiB,EAD5CjB,GAAU,IAAM,IAAM,QAGlCC,KAAM,CACFC,IAAK,EACLC,IAAK,KAlHyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,oGAAoG/6C,MACxG,KAEJg7C,YAAa,iEAAiEh7C,MAC1E,KAEJo/C,kBAAkB,EAClBnE,SAAU,iDAAiDj7C,MAAM,KACjEk7C,cAAe,8CAA8Cl7C,MAAM,KACnEm7C,YAAa,yBAAyBn7C,MAAM,KAC5C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,OACJC,IAAK,UACLC,EAAG,aACHC,GAAI,cACJC,IAAK,wBACLC,KAAM,oCAEVZ,cAAe,wBACfC,KAAM,SAAUvrD,GACZ,MAAiB,eAAVA,GAEXwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,aAEA,cAGf/B,SAAU,CACNC,QAAS,mBACTC,QAAS,qBACTC,SAAU,qBACVC,QAAS,wBACTC,SAAU,6BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,YACNpiD,EAAG,eACHqiD,GAAI,YACJzqD,EAAG,SACH0qD,GAAI,UACJC,EAAG,YACHC,GAAI,aACJzmC,EAAG,QACH0mC,GAAI,SACJ+B,EAAG,YACHC,GAAI,aACJ/B,EAAG,UACHC,GAAI,WACJxD,EAAG,OACHyD,GAAI,WA9D0B9/D,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAI+e,EAAW,CACX,EAAG,QACH,EAAG,QACH,EAAG,QACH,GAAI,QACJ,GAAI,QACJ,EAAG,OACH,EAAG,OACH,GAAI,OACJ,GAAI,OACJ,EAAG,QACH,EAAG,QACH,IAAK,QACL,EAAG,OACH,EAAG,QACH,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,SAGC/e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,+EAA+E/6C,MACnF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,wDAAwDj7C,MAC9D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,mBACTC,QAAS,mBACTC,SAAU,2BACVC,QAAS,YACTC,SAAU,0BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,QACNpiD,EAAG,iBACHpI,EAAG,YACH0qD,GAAI,WACJC,EAAG,YACHC,GAAI,WACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,QACJxD,EAAG,UACHyD,GAAI,UAERE,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,KACL,IAAK,KACD,OAAOxB,EACX,QACI,GAAe,IAAXA,EAEA,OAAOA,EAAS,QAEpB,IAAI1iD,EAAI0iD,EAAS,GAGjB,OAAOA,GAAUiB,EAAS3jD,IAAM2jD,EAFvBjB,EAAS,IAAO1iD,IAEsB2jD,EADvCjB,GAAU,IAAM,IAAM,SAI1CC,KAAM,CACFC,IAAK,EACLC,IAAK,KAzFyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,yDAAyDj7C,MAC/D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,wBAAwBn7C,MAAM,KAC3C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,YACHC,GAAI,eACJC,IAAK,qBACLC,KAAM,6BAEVC,SAAU,CACNC,QAAS,oBACTC,QAAS,gBACTC,SAAU,0BACVC,QAAS,eACTC,SAAU,4BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,gBACRC,KAAM,mBACNpiD,EAAG,gBACHqiD,GAAI,aACJzqD,EAAG,eACH0qD,GAAI,YACJC,EAAG,aACHC,GAAI,UACJzmC,EAAG,aACH0mC,GAAI,UACJC,EAAG,cACHC,GAAI,WACJxD,EAAG,aACHyD,GAAI,WAERC,uBAAwB,UACxBC,QAAS,SAAUC,GACf,OAAOA,GAEXC,KAAM,CACFC,IAAK,EACLC,IAAK,KAvDyBpgE,CAAQ,EAAQ,4FCGlD,SAAWmiD,GAAU,aAIzB,IAAI8jB,EAAe,iDAAiDrjD,MAAM,KA4B1E,SAASogD,EAAU/C,EAAQQ,EAAep7D,EAAQq7D,GAC9C,IAAIwF,EAiBR,SAAsBjG,GAClB,IAAIkG,EAAUvkD,KAAKmtC,MAAOkR,EAAS,IAAQ,KACvCmG,EAAMxkD,KAAKmtC,MAAOkR,EAAS,IAAO,IAClCoG,EAAMpG,EAAS,GACfqG,EAAO,GAUX,OATIH,EAAU,IACVG,GAAQL,EAAaE,GAAW,SAEhCC,EAAM,IACNE,IAAkB,KAATA,EAAc,IAAM,IAAML,EAAaG,GAAO,OAEvDC,EAAM,IACNC,IAAkB,KAATA,EAAc,IAAM,IAAML,EAAaI,IAEpC,KAATC,EAAc,OAASA,EA/BbC,CAAatG,GAC9B,OAAQ56D,GACJ,IAAK,KACD,OAAO6gE,EAAa,OACxB,IAAK,KACD,OAAOA,EAAa,OACxB,IAAK,KACD,OAAOA,EAAa,OACxB,IAAK,KACD,OAAOA,EAAa,OACxB,IAAK,KACD,OAAOA,EAAa,OACxB,IAAK,KACD,OAAOA,EAAa,QAqBtB/jB,EAAOub,aAAa,MAAO,CACjCC,OAAQ,kMAAkM/6C,MACtM,KAEJg7C,YAAa,0HAA0Hh7C,MACnI,KAEJo/C,kBAAkB,EAClBnE,SAAU,2DAA2Dj7C,MACjE,KAEJk7C,cAAe,2DAA2Dl7C,MACtE,KAEJm7C,YAAa,2DAA2Dn7C,MACpE,KAEJ07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,cACTC,QAAS,cACTC,SAAU,MACVC,QAAS,cACTC,SAAU,MACVC,SAAU,KAEdC,aAAc,CACVC,OA/FR,SAAyB+D,GACrB,IAAItU,EAAOsU,EASX,OAP+B,IAA3BA,EAAOp1D,QAAQ,OACT8gD,EAAKltD,MAAM,GAAI,GAAK,OACO,IAA3BwhE,EAAOp1D,QAAQ,OACf8gD,EAAKltD,MAAM,GAAI,GAAK,OACO,IAA3BwhE,EAAOp1D,QAAQ,OACf8gD,EAAKltD,MAAM,GAAI,GAAK,MACpBktD,EAAO,QAuFbwQ,KAnFR,SAAuB8D,GACnB,IAAItU,EAAOsU,EASX,OAP+B,IAA3BA,EAAOp1D,QAAQ,OACT8gD,EAAKltD,MAAM,GAAI,GAAK,OACO,IAA3BwhE,EAAOp1D,QAAQ,OACf8gD,EAAKltD,MAAM,GAAI,GAAK,OACO,IAA3BwhE,EAAOp1D,QAAQ,OACf8gD,EAAKltD,MAAM,GAAI,GAAK,MACpBktD,EAAO,QA2Eb5xC,EAAG,UACHqiD,GAAIyD,EACJluD,EAAG,UACH0qD,GAAIwD,EACJvD,EAAG,UACHC,GAAIsD,EACJ/pC,EAAG,UACH0mC,GAAIqD,EACJpD,EAAG,UACHC,GAAImD,EACJ3G,EAAG,UACHyD,GAAIkD,GAERjD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KA3HyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIzB,IAAI+e,EAAW,CACX,EAAG,QACH,EAAG,QACH,EAAG,QACH,GAAI,QACJ,GAAI,QACJ,EAAG,OACH,EAAG,OACH,GAAI,OACJ,GAAI,OACJ,EAAG,QACH,EAAG,QACH,IAAK,QACL,EAAG,OACH,EAAG,QACH,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,SAGC/e,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,6EAA6E/6C,MACjF,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,wDAAwDj7C,MAC9D,KAEJk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1Cs7C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACDE,EAAU,KAAO,KAEjBA,EAAU,KAAO,MAGhCL,cAAe,cACfC,KAAM,SAAUvrD,GACZ,MAAiB,OAAVA,GAA4B,OAAVA,GAE7B4rD,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,kBACTC,QAAS,kBACTC,SAAU,2BACVC,QAAS,WACTC,SAAU,yBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,UACNpiD,EAAG,gBACHqiD,GAAI,YACJzqD,EAAG,aACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,SACJ+B,EAAG,YACHC,GAAI,WACJ/B,EAAG,SACHC,GAAI,QACJxD,EAAG,UACHyD,GAAI,UAERE,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,KACL,IAAK,KACD,OAAOxB,EACX,QACI,GAAe,IAAXA,EAEA,OAAOA,EAAS,QAEpB,IAAI1iD,EAAI0iD,EAAS,GAGjB,OAAOA,GAAUiB,EAAS3jD,IAAM2jD,EAFvBjB,EAAS,IAAO1iD,IAEsB2jD,EADvCjB,GAAU,IAAM,IAAM,SAI1CC,KAAM,CACFC,IAAK,EACLC,IAAK,KAvGyBpgE,CAAQ,EAAQ,4FCGlD,SAAWmiD,GAAU,aAiEzB,SAASmhB,EAAoBrD,EAAQQ,EAAe96D,EAAK+6D,GACrD,IAAIh5C,EAAS,CACTxK,EAAG,CAAC,kBAAmB,mBACvBqiD,GAAI,CAACU,EAAS,WAAiBA,EAAS,YACxCnrD,EAAG,CAAC,UAAW,cACf0qD,GAAI,CAACS,EAAS,SAAeA,EAAS,UACtCR,EAAG,CAAC,UAAW,eACfC,GAAI,CAACO,EAAS,SAAeA,EAAS,UACtChnC,EAAG,CAAC,UAAW,eACf0mC,GAAI,CAACM,EAAS,SAAeA,EAAS,UACtCL,EAAG,CAAC,SAAU,aACdC,GAAI,CAACI,EAAS,SAAeA,EAAS,UACtC5D,EAAG,CAAC,QAAS,YACbyD,GAAI,CAACG,EAAS,OAAaA,EAAS,SAExC,OAAOS,GAEDD,EADA/4C,EAAO/hB,GAAK,GAGZ+hB,EAAO/hB,GAAK,GA9EZw8C,EAAOub,aAAa,MAAO,CACjCC,OAAQ,sFAAsF/6C,MAC1F,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,sDAAsDj7C,MAAM,KACtEk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,wBACJC,IAAK,8BACLC,KAAM,0CAEVZ,cAAe,aACfC,KAAM,SAAUvrD,GACZ,MAAO,QAAUA,EAAMsU,eAE3Bk3C,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACDE,EAAU,MAAQ,MAElBA,EAAU,MAAQ,OAGjCQ,SAAU,CACNC,QAAS,cACTC,QAAS,cACTC,SAAU,cACVC,QAAS,eACTC,SAAU,8BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,YACRC,KAAM,OACNpiD,EAAGomD,EACH/D,GAAI+D,EACJxuD,EAAGwuD,EACH9D,GAAI8D,EACJ7D,EAAG6D,EACH5D,GAAI4D,EACJrqC,EAAGqqC,EACH3D,GAAI2D,EACJ1D,EAAG0D,EACHzD,GAAIyD,EACJjH,EAAGiH,EACHxD,GAAIwD,GAERvD,uBAAwB,YACxBC,QAAS,MACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAhEyBpgE,CAAQ,EAAQ,iGCElD,SAAWmiD,GAAU,aAIXA,EAAOub,aAAa,WAAY,CAC1CC,OAAQ,wFAAwF/6C,MAC5F,KAEJg7C,YAAa,wFAAwFh7C,MACjG,KAEJi7C,SAAU,kDAAkDj7C,MAAM,KAClEk7C,cAAe,kDAAkDl7C,MAAM,KACvEm7C,YAAa,kDAAkDn7C,MAAM,KACrE07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,eACTC,QAAS,cACTC,SAAU,cACVC,QAAS,gBACTC,SAAU,cACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,iBACRC,KAAM,SACNpiD,EAAG,OACHqiD,GAAI,UACJzqD,EAAG,QACH0qD,GAAI,WACJC,EAAG,OACHC,GAAI,cACJzmC,EAAG,MACH0mC,GAAI,WACJC,EAAG,QACHC,GAAI,YACJxD,EAAG,QACHyD,GAAI,aAERI,KAAM,CACFC,IAAK,EACLC,IAAK,MAnDyBpgE,CAAQ,EAAQ,4FCGlD,SAAWmiD,GAAU,aAIfA,EAAOub,aAAa,MAAO,CACjCC,OAAQ,kFAAkF/6C,MACtF,KAEJg7C,YAAa,kFAAkFh7C,MAC3F,KAEJi7C,SAAU,kDAAkDj7C,MAAM,KAClEk7C,cAAe,kDAAkDl7C,MAAM,KACvEm7C,YAAa,kDAAkDn7C,MAAM,KACrE07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,0BAEVC,SAAU,CACNC,QAAS,cACTC,QAAS,cACTC,SAAU,cACVC,QAAS,eACTC,SAAU,cACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,gBACRC,KAAM,SACNpiD,EAAG,OACHqiD,GAAI,UACJzqD,EAAG,QACH0qD,GAAI,WACJC,EAAG,OACHC,GAAI,cACJzmC,EAAG,MACH0mC,GAAI,WACJC,EAAG,QACHC,GAAI,YACJxD,EAAG,QACHyD,GAAI,aAERI,KAAM,CACFC,IAAK,EACLC,IAAK,MAnDyBpgE,CAAQ,EAAQ,8FCGlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,sFAAsF/6C,MAC1F,KAEJg7C,YAAa,sFAAsFh7C,MAC/F,KAEJi7C,SAAU,yDAAyDj7C,MAC/D,KAEJk7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,0BACJC,IAAK,iCACLC,KAAM,wCAEVZ,cAAe,qDACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAGM,eAAb1C,GACa,UAAbA,GACa,iBAAbA,EAEO0C,EACa,iBAAb1C,GAA4C,QAAbA,EAC/B0C,EAAO,GAEPA,GAAQ,GAAKA,EAAOA,EAAO,IAG1C1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,IAAImI,EAAY,IAAP5F,EAAaC,EACtB,OAAI2F,EAAK,IACE,aACAA,EAAK,IACL,QACAA,EAAK,KACL,eACAA,EAAK,KACL,MACAA,EAAK,KACL,eAEA,OAGf3H,SAAU,CACNC,QAAS,mBACTC,QAAS,kBACTC,SAAU,4BACVC,QAAS,eACTC,SAAU,6BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,WACRC,KAAM,WACNpiD,EAAG,eACHqiD,GAAI,YACJzqD,EAAG,YACH0qD,GAAI,WACJC,EAAG,YACHC,GAAI,WACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,UACHC,GAAI,SACJxD,EAAG,UACHyD,GAAI,UAGRC,uBAAwB,6BACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOxB,EAAS,QACpB,IAAK,IACL,IAAK,IACD,OAAOA,EAAS,SACpB,QACI,OAAOA,IAGnBe,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCisD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCqrD,KAAM,CAEFC,IAAK,EACLC,IAAK,KA5GyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAYzB,SAASgf,EAAuBlB,EAAQQ,EAAe96D,GASnD,MAAY,MAARA,EACO86D,EAAgB,UAAY,UACpB,MAAR96D,EACA86D,EAAgB,SAAW,SAE3BR,EAAS,KAtBFmB,GAsB6BnB,EArB3CoB,EAQS,CACT9B,GAAIkB,EAAgB,yBAA2B,yBAC/CjB,GAAIiB,EAAgB,yBAA2B,yBAC/Cf,GAAIe,EAAgB,sBAAwB,sBAC5Cd,GAAI,gBACJE,GAAI,wBACJC,GAAI,kBAOgCn6D,GArBvBid,MAAM,KAChBw+C,EAAM,IAAO,GAAKA,EAAM,KAAQ,GACjCC,EAAM,GACND,EAAM,IAAM,GAAKA,EAAM,IAAM,IAAMA,EAAM,IAAM,IAAMA,EAAM,KAAO,IAClEC,EAAM,GACNA,EAAM,IANhB,IAAsBD,EACdC,EAsDR,SAASoF,EAAqB31D,GAC1B,OAAO,WACH,OAAOA,EAAM,KAAwB,KAAjBhR,KAAKq+D,QAAiB,IAAM,IAAM,QAIrDhc,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,CACJj2C,OAAQ,yFAAyF9E,MAC7F,KAEJ0+C,WAAY,iGAAiG1+C,MACzG,MAGRg7C,YAAa,yDAAyDh7C,MAClE,KAEJi7C,SAhDJ,SAA6B/oD,EAAG4S,GAC5B,IAAIm2C,EAAW,CACP6I,WAAY,0DAA0D9jD,MAClE,KAEJ+jD,WAAY,0DAA0D/jD,MAClE,KAEJgkD,SAAU,4DAA4DhkD,MAClE,MAKZ,OAAU,IAAN9N,EACO+oD,EAAqB,WACvBj8D,MAAM,EAAG,GACTM,OAAO27D,EAAqB,WAAEj8D,MAAM,EAAG,IAE3CkT,EASE+oD,EALI,qBAAqB56C,KAAKyE,GAC/B,aACA,sCAAsCzE,KAAKyE,GAC3C,WACA,cACoB5S,EAAE0sD,OARjB3D,EAAqB,YA6BhCC,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,iBACJC,IAAK,wBACLC,KAAM,+BAEVC,SAAU,CACNC,QAAS2H,EAAqB,cAC9B1H,QAAS0H,EAAqB,YAC9BxH,QAASwH,EAAqB,WAC9BzH,SAAUyH,EAAqB,cAC/BvH,SAAU,WACN,OAAQp/D,KAAK0hE,OACT,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACD,OAAOiF,EAAqB,oBAAoB5kE,KAAK/B,MACzD,KAAK,EACL,KAAK,EACL,KAAK,EACD,OAAO2mE,EAAqB,qBAAqB5kE,KAAK/B,QAGlEq/D,SAAU,KAEdC,aAAc,CACVC,OAAQ,QACRC,KAAM,UACNpiD,EAAG,kBACHqiD,GAAI4B,EACJrsD,EAAGqsD,EACH3B,GAAI2B,EACJ1B,EAAG,SACHC,GAAIyB,EACJloC,EAAG,OACH0mC,GAAIwB,EACJvB,EAAG,SACHC,GAAIsB,EACJ9E,EAAG,MACHyD,GAAIqB,GAGRnD,cAAe,wBACfC,KAAM,SAAUvrD,GACZ,MAAO,iBAAiBuQ,KAAKvQ,IAEjCwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,EACA,OACAA,EAAO,GACP,QACAA,EAAO,GACP,MAEA,UAGfb,uBAAwB,iBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACL,IAAK,IACL,IAAK,IACD,OAAOxB,EAAS,KACpB,IAAK,IACD,OAAOA,EAAS,MACpB,QACI,OAAOA,IAGnBC,KAAM,CACFC,IAAK,EACLC,IAAK,KAhKyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIzB,IAAIwb,EAAS,CACL,QACA,QACA,OACA,QACA,MACA,MACA,SACA,OACA,QACA,SACA,QACA,SAEJqI,EAAO,CAAC,QAAS,MAAO,OAAQ,MAAO,SAAU,OAAQ,QAEpD7jB,EAAOub,aAAa,KAAM,CAC/BC,OAAQA,EACRC,YAAaD,EACbE,SAAUmI,EACVlI,cAAekI,EACfjI,YAAaiI,EACb1H,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVZ,cAAe,UACfC,KAAM,SAAUvrD,GACZ,MAAO,QAAUA,GAErBwrD,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,OAAIuC,EAAO,GACA,MAEJ,OAEX/B,SAAU,CACNC,QAAS,eACTC,QAAS,eACTC,SAAU,iBACVC,QAAS,sBACTC,SAAU,yBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,SACNpiD,EAAG,YACHqiD,GAAI,WACJzqD,EAAG,UACH0qD,GAAI,SACJC,EAAG,YACHC,GAAI,WACJzmC,EAAG,SACH0mC,GAAI,QACJC,EAAG,UACHC,GAAI,SACJxD,EAAG,UACHyD,GAAI,UAERkB,SAAU,SAAU37D,GAChB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCisD,WAAY,SAAUz7D,GAClB,OAAOA,EAAOwP,QAAQ,KAAM,MAEhCqrD,KAAM,CACFC,IAAK,EACLC,IAAK,KA/EyBpgE,CAAQ,EAAQ,gGCElD,SAAWmiD,GAAU,aAIZA,EAAOub,aAAa,UAAW,CACxCC,OAAQ,6EAA6E/6C,MACjF,KAEJg7C,YAAa,oDAAoDh7C,MAAM,KACvEi7C,SAAU,+DAA+Dj7C,MACrE,KAEJk7C,cAAe,kCAAkCl7C,MAAM,KACvDm7C,YAAa,yBAAyBn7C,MAAM,KAC5C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,uBACTC,QAAS,mBACTC,SAAU,2BACVC,QAAS,uBACTC,SAAU,oCACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,kBACRC,KAAM,qBACNpiD,EAAG,SACHqiD,GAAI,YACJzqD,EAAG,aACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,QACJxD,EAAG,UACHyD,GAAI,UAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KAnDyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,yEAAyE/6C,MAC7E,KAEJg7C,YAAa,kDAAkDh7C,MAAM,KACrEi7C,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,8BAA8Bl7C,MAAM,KACnDm7C,YAAa,uBAAuBn7C,MAAM,KAC1C07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,uBACTC,QAAS,mBACTC,SAAU,2BACVC,QAAS,sBACTC,SAAU,mCACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,gBACRC,KAAM,oBACNpiD,EAAG,SACHqiD,GAAI,YACJzqD,EAAG,aACH0qD,GAAI,YACJC,EAAG,WACHC,GAAI,UACJzmC,EAAG,UACH0mC,GAAI,SACJC,EAAG,SACHC,GAAI,QACJxD,EAAG,UACHyD,GAAI,UAERI,KAAM,CACFC,IAAK,EACLC,IAAK,KAjDyBpgE,CAAQ,EAAQ,2FCIlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,qGAAqG/6C,MACzG,KAEJg7C,YAAa,sFAAsFh7C,MAC/F,KAEJo/C,kBAAkB,EAClBnE,SAAU,yDAAyDj7C,MAC/D,KAEJk7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,uBAAuBn7C,MAAM,KAC1C+9C,oBAAoB,EACpB3C,cAAe,SACfC,KAAM,SAAUvrD,GACZ,MAAO,QAAQuQ,KAAKvQ,IAExBwrD,SAAU,SAAUC,EAAOC,EAASC,GAChC,OAAIF,EAAQ,GACDE,EAAU,KAAO,KAEjBA,EAAU,KAAO,MAGhCC,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,oBACJC,IAAK,0BACLC,KAAM,gCACNrsC,EAAG,YACH0wC,GAAI,aACJC,IAAK,mBACLC,KAAM,yBAEVtE,SAAU,CACNC,QAAS,mBACTC,QAAS,oBACTC,SAAU,yBACVC,QAAS,mBACTC,SAAU,2BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,WACNpiD,EAAG,WACHqiD,GAAI,UACJzqD,EAAG,WACH0qD,GAAI,UACJC,EAAG,UACHC,GAAI,SACJzmC,EAAG,WACH0mC,GAAI,UACJ+B,EAAG,WACHC,GAAI,UACJ/B,EAAG,YACHC,GAAI,WACJxD,EAAG,UACHyD,GAAI,UAERC,uBAAwB,UACxBC,QAAS,SAAUC,GACf,OAAOA,GAEXC,KAAM,CACFC,IAAK,EACLC,IAAK,KA5EyBpgE,CAAQ,EAAQ,iGCElD,SAAWmiD,GAAU,aAIXA,EAAOub,aAAa,WAAY,CAC1CC,OAAQ,6GAA6G/6C,MACjH,KAEJg7C,YAAa,8DAA8Dh7C,MACvE,KAEJo/C,kBAAkB,EAClBnE,SAAU,yEAAyEj7C,MAC/E,KAEJk7C,cAAe,qCAAqCl7C,MAAM,KAC1Dm7C,YAAa,4BAA4Bn7C,MAAM,KAC/C+9C,oBAAoB,EACpBrC,eAAgB,CACZC,GAAI,QACJE,EAAG,aACHC,GAAI,cACJC,IAAK,oBACLC,KAAM,2BAEVC,SAAU,CACNC,QAAS,kBACTC,QAAS,sBACTC,SAAU,eACVC,QAAS,uBACTC,SAAU,uBACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,UACNpiD,EAAG,mBACHqiD,GAAI,eACJzqD,EAAG,aACH0qD,GAAI,eACJC,EAAG,YACHC,GAAI,YACJzmC,EAAG,SACH0mC,GAAI,WACJC,EAAG,YACHC,GAAI,cACJxD,EAAG,UACHyD,GAAI,aAERC,uBAAwB,uBACxBC,QAAS,SAAUC,GACf,IAAIvhD,EAAIuhD,EAAS,GAWjB,OAAOA,GAT6B,MAAxBA,EAAS,IAAO,IACd,KACM,IAANvhD,EACA,KACM,IAANA,EACA,KACM,IAANA,EACA,KACA,OAGlBwhD,KAAM,CACFC,IAAK,EACLC,IAAK,KArEyBpgE,CAAQ,EAAQ,2FCGlD,SAAWmiD,GAAU,aAIhBA,EAAOub,aAAa,KAAM,CAC/BC,OAAQ,0FAA0F/6C,MAC9F,KAEJg7C,YAAa,gEAAgEh7C,MAAM,KACnFi7C,SAAU,uDAAuDj7C,MAAM,KACvEk7C,cAAe,sCAAsCl7C,MAAM,KAC3Dm7C,YAAa,2BAA2Bn7C,MAAM,KAC9C07C,eAAgB,CACZC,GAAI,SACJC,IAAK,YACLC,EAAG,aACHC,GAAI,cACJC,IAAK,qBACLC,KAAM,4BAEVC,SAAU,CACNC,QAAS,gBACTC,QAAS,eACTC,SAAU,8BACVC,QAAS,eACTC,SAAU,6BACVC,SAAU,KAEdC,aAAc,CACVC,OAAQ,SACRC,KAAM,WACNpiD,EAAG,oBACHqiD,GAAI,WACJzqD,EAAG,cACH0qD,GAAI,aACJC,EAAG,cACHC,GAAI,aACJzmC,EAAG,WACH0mC,GAAI,UACJC,EAAG,WACHC,GAAI,UACJxD,EAAG,YACHyD,GAAI,YAERC,uBAAwB,gBACxBC,QAAS,UACTE,KAAM,CACFC,IAAK,EACLC,IAAK,KAnDyBpgE,CAAQ,EAAQ,8FCKlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wCAAwC/6C,MAC5C,KAEJg7C,YAAa,yCAAyCh7C,MAClD,KAEJi7C,SAAU,8BAA8Bj7C,MAAM,KAC9Ck7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,YACJC,IAAK,kBACLC,KAAM,sBACNrsC,EAAG,WACH0wC,GAAI,YACJC,IAAK,kBACLC,KAAM,uBAEVnF,cAAe,oBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,OAAb1C,GAAkC,OAAbA,GAAkC,OAAbA,EACnC0C,EACa,OAAb1C,GAAkC,OAAbA,EACrB0C,EAAO,GAGPA,GAAQ,GAAKA,EAAOA,EAAO,IAG1C1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,IAAImI,EAAY,IAAP5F,EAAaC,EACtB,OAAI2F,EAAK,IACE,KACAA,EAAK,IACL,KACAA,EAAK,KACL,KACAA,EAAK,KACL,KACAA,EAAK,KACL,KAEA,MAGf3H,SAAU,CACNC,QAAS,SACTC,QAAS,SACTC,SAAU,SAAU3U,GAChB,OAAIA,EAAI6V,SAAWpgE,KAAKogE,OACb,WAEA,YAGfjB,QAAS,SACTC,SAAU,SAAU7U,GAChB,OAAIvqD,KAAKogE,SAAW7V,EAAI6V,OACb,WAEA,YAGff,SAAU,KAEdY,uBAAwB,iBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOxB,EAAS,IACpB,IAAK,IACD,OAAOA,EAAS,IACpB,IAAK,IACL,IAAK,IACD,OAAOA,EAAS,IACpB,QACI,OAAOA,IAGnBb,aAAc,CACVC,OAAQ,MACRC,KAAM,MACNpiD,EAAG,KACHqiD,GAAI,OACJzqD,EAAG,OACH0qD,GAAI,QACJC,EAAG,OACHC,GAAI,QACJzmC,EAAG,MACH0mC,GAAI,OACJ+B,EAAG,MACHC,GAAI,OACJ/B,EAAG,OACHC,GAAI,QACJxD,EAAG,MACHyD,GAAI,QAERI,KAAM,CAEFC,IAAK,EACLC,IAAK,KApHyBpgE,CAAQ,EAAQ,8FCIlD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wCAAwC/6C,MAC5C,KAEJg7C,YAAa,yCAAyCh7C,MAClD,KAEJi7C,SAAU,8BAA8Bj7C,MAAM,KAC9Ck7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,YACJC,IAAK,kBACLC,KAAM,sBACNrsC,EAAG,WACH0wC,GAAI,YACJC,IAAK,kBACLC,KAAM,uBAEVnF,cAAe,oBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,OAAb1C,GAAkC,OAAbA,GAAkC,OAAbA,EACnC0C,EACa,OAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,OAAb1C,GAAkC,OAAbA,EACrB0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,IAAImI,EAAY,IAAP5F,EAAaC,EACtB,OAAI2F,EAAK,IACE,KACAA,EAAK,IACL,KACAA,EAAK,KACL,KACO,OAAPA,EACA,KACAA,EAAK,KACL,KAEA,MAGf3H,SAAU,CACNC,QAAS,SACTC,QAAS,SACTC,SAAU,YACVC,QAAS,SACTC,SAAU,YACVC,SAAU,KAEdY,uBAAwB,iBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOxB,EAAS,IACpB,IAAK,IACD,OAAOA,EAAS,IACpB,IAAK,IACL,IAAK,IACD,OAAOA,EAAS,IACpB,QACI,OAAOA,IAGnBb,aAAc,CACVC,OAAQ,MACRC,KAAM,MACNpiD,EAAG,KACHqiD,GAAI,OACJzqD,EAAG,OACH0qD,GAAI,QACJC,EAAG,OACHC,GAAI,QACJzmC,EAAG,MACH0mC,GAAI,OACJC,EAAG,OACHC,GAAI,QACJxD,EAAG,MACHyD,GAAI,UAhG0B9/D,CAAQ,EAAQ,8FCElD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wCAAwC/6C,MAC5C,KAEJg7C,YAAa,yCAAyCh7C,MAClD,KAEJi7C,SAAU,8BAA8Bj7C,MAAM,KAC9Ck7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,YACJC,IAAK,kBACLC,KAAM,sBACNrsC,EAAG,WACH0wC,GAAI,YACJC,IAAK,kBACLC,KAAM,uBAEVnF,cAAe,oBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,OAAb1C,GAAkC,OAAbA,GAAkC,OAAbA,EACnC0C,EACa,OAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,OAAb1C,GAAkC,OAAbA,EACrB0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,IAAImI,EAAY,IAAP5F,EAAaC,EACtB,OAAI2F,EAAK,IACE,KACAA,EAAK,IACL,KACAA,EAAK,KACL,KACAA,EAAK,KACL,KACAA,EAAK,KACL,KAEA,MAGf3H,SAAU,CACNC,QAAS,UACTC,QAAS,UACTC,SAAU,aACVC,QAAS,UACTC,SAAU,aACVC,SAAU,KAEdY,uBAAwB,iBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOxB,EAAS,IACpB,IAAK,IACD,OAAOA,EAAS,IACpB,IAAK,IACL,IAAK,IACD,OAAOA,EAAS,IACpB,QACI,OAAOA,IAGnBb,aAAc,CACVC,OAAQ,MACRC,KAAM,MACNpiD,EAAG,KACHqiD,GAAI,OACJzqD,EAAG,OACH0qD,GAAI,QACJC,EAAG,OACHC,GAAI,QACJzmC,EAAG,MACH0mC,GAAI,OACJC,EAAG,OACHC,GAAI,QACJxD,EAAG,MACHyD,GAAI,UAhG0B9/D,CAAQ,EAAQ,8FCElD,SAAWmiD,GAAU,aAIdA,EAAOub,aAAa,QAAS,CACpCC,OAAQ,wCAAwC/6C,MAC5C,KAEJg7C,YAAa,yCAAyCh7C,MAClD,KAEJi7C,SAAU,8BAA8Bj7C,MAAM,KAC9Ck7C,cAAe,uBAAuBl7C,MAAM,KAC5Cm7C,YAAa,gBAAgBn7C,MAAM,KACnC07C,eAAgB,CACZC,GAAI,QACJC,IAAK,WACLC,EAAG,aACHC,GAAI,YACJC,IAAK,kBACLC,KAAM,sBACNrsC,EAAG,WACH0wC,GAAI,YACJC,IAAK,kBACLC,KAAM,uBAEVnF,cAAe,oBACf8D,aAAc,SAAUlB,EAAM1C,GAI1B,OAHa,KAAT0C,IACAA,EAAO,GAEM,OAAb1C,GAAkC,OAAbA,GAAkC,OAAbA,EACnC0C,EACa,OAAb1C,EACA0C,GAAQ,GAAKA,EAAOA,EAAO,GACd,OAAb1C,GAAkC,OAAbA,EACrB0C,EAAO,QADX,GAIX1C,SAAU,SAAU0C,EAAMC,EAAQxC,GAC9B,IAAImI,EAAY,IAAP5F,EAAaC,EACtB,OAAI2F,EAAK,IACE,KACAA,EAAK,IACL,KACAA,EAAK,KACL,KACAA,EAAK,KACL,KACAA,EAAK,KACL,KAEA,MAGf3H,SAAU,CACNC,QAAS,UACTC,QAAS,UACTC,SAAU,aACVC,QAAS,UACTC,SAAU,aACVC,SAAU,KAEdY,uBAAwB,iBACxBC,QAAS,SAAUC,EAAQwB,GACvB,OAAQA,GACJ,IAAK,IACL,IAAK,IACL,IAAK,MACD,OAAOxB,EAAS,IACpB,IAAK,IACD,OAAOA,EAAS,IACpB,IAAK,IACL,IAAK,IACD,OAAOA,EAAS,IACpB,QACI,OAAOA,IAGnBb,aAAc,CACVC,OAAQ,MACRC,KAAM,MACNpiD,EAAG,KACHqiD,GAAI,OACJzqD,EAAG,OACH0qD,GAAI,QACJC,EAAG,OACHC,GAAI,QACJzmC,EAAG,MACH0mC,GAAI,OACJC,EAAG,OACHC,GAAI,QACJxD,EAAG,MACHyD,GAAI,UAhG0B9/D,CAAQ,EAAQ,wGCP1D,IAAIyO,EAAM,CACT,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,QAAS,sCACT,WAAY,sCACZ,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,aAAc,2CACd,gBAAiB,2CACjB,aAAc,2CACd,gBAAiB,2CACjB,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,UAAW,wCACX,aAAc,wCACd,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,WAAY,yCACZ,cAAe,yCACf,UAAW,wCACX,aAAc,wCACd,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,wCACX,aAAc,wCACd,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,YAAa,0CACb,eAAgB,0CAChB,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,QAAS,sCACT,WAAY,sCACZ,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,UAAW,wCACX,aAAc,wCACd,QAAS,sCACT,WAAY,sCACZ,OAAQ,qCACR,UAAW,qCACX,QAAS,sCACT,WAAY,sCACZ,QAAS,sCACT,aAAc,2CACd,gBAAiB,2CACjB,WAAY,sCACZ,UAAW,wCACX,aAAc,wCACd,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,OAAQ,qCACR,YAAa,0CACb,eAAgB,0CAChB,UAAW,qCACX,OAAQ,qCACR,UAAW,qCACX,aAAc,2CACd,gBAAiB,2CACjB,OAAQ,qCACR,UAAW,qCACX,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,wCACd,UAAW,wCACX,aAAc,yCAIf,SAASo4D,EAAeC,GACvB,IAAI37D,EAAK47D,EAAsBD,GAC/B,OAAOE,EAAoB77D,GAE5B,SAAS47D,EAAsBD,GAC9B,IAAIE,EAAoBtiD,EAAEjW,EAAKq4D,GAAM,CACpC,IAAI1kD,EAAI,IAAI7P,MAAM,uBAAyBu0D,EAAM,KAEjD,MADA1kD,EAAEklC,KAAO,mBACHllC,EAEP,OAAO3T,EAAIq4D,GAEZD,EAAevzD,KAAO,WACrB,OAAOD,OAAOC,KAAK7E,IAEpBo4D,EAAep6D,QAAUs6D,EACzBnnE,EAAO6xD,QAAUoV,EACjBA,EAAe17D,GAAK,8GClSnB,IAASoS,EAAAA,EAAqiI8I,OAAOF,SAAziIxmB,QAAQC,OAAO,eAAe,IAAI0E,MAAM,eAAe,CAACo5C,OAAM,IAAKryC,OAAO,CAAC,mBAAmB,SAASkS,GAAG5d,QAAQ+M,UAAU6Q,EAAE0pD,0BAA0B1pD,EAAE0pD,yBAAyB,sCAAsC1pD,EAAE2pD,2BAA2B,yCAAyCvnE,QAAQC,OAAO,mBAAmB,CAAC,mBAAmBD,QAAQC,OAAO,iBAAiB,IAAID,QAAQC,OAAO,QAAQ,CAAC,eAAe,iBAAiB,mBAAmB,eAAwEA,EAAO6xD,UAAUA,IAAU7xD,EAAO6xD,QAAQ,SAAS9xD,QAAQC,OAAO,kBAAkB2X,QAAQ,MAAM,CAAC,KAAK,SAASgG,GAAG,IAAImB,EAAE,OAAaua,EAAE,CAAC,MAAM,KAAI,MAAM,KAAK,MAAM,KAAI,MAAM,KAAK,MAAM,MAAMn5B,KAAKqnE,eAAe,SAAS5pD,EAAEmB,GAAG,MAAM,WAAWA,EAAE0oD,YAAYtnE,KAAKunE,QAAQ9pD,GAAGA,EAAE+pD,iBAAiB,MAAM5oD,EAAE0oD,YAAYtnE,KAAKunE,QAAQ9pD,GAAGA,EAAE3I,WAAWC,QAAQ,IAAI6J,EAAE0oD,YAAY,iBAAiB7pD,GAAGA,EAAEA,EAAE1I,QAAQ,KAAK,OAAO6J,EAAE6oD,cAAchqD,EAAEvP,QAAQ,MAAM,GAAGuP,EAAEvP,QAAQ,OAAO,GAAGuP,EAAEvP,QAAQ,OAAO,KAAKuP,EAAEmB,EAAE8oD,SAASjqD,EAAEmB,EAAE8oD,UAAUjqD,GAAG,kBAAkBA,EAAEA,EAAE,OAAO,QAAQA,GAAGzd,KAAKunE,QAAQ,SAAS9pD,GAAG,OAAOA,IAAIA,KAAKkqD,SAASlqD,IAAIwU,QAAQxU,EAAE,KAAKzd,KAAKke,UAAU,SAASib,EAAE7W,GAAG,IAAI6zC,EAAE14C,EAAExR,QAAQ4R,EAAE7d,KAAK2/D,EAAE,GAAGtiD,EAAE,GAAGK,EAAED,EAAExN,KAAKkpB,GAAGpuB,MAAK,SAAS0S,GAA6C,IAAI0b,EAAEzb,EAA7C7d,QAAQ+M,UAAU0V,EAAEslD,SAAStlD,EAAEslD,SAAgBzuC,EAAE,GAAGt5B,QAAQkB,QAAQuhB,EAAEslD,QAAO,SAASnqD,GAAGzd,KAAKS,KAAKod,EAAEwpD,eAAe5pD,EAAE6E,MAAK6W,GAAGzb,EAAEyb,EAAElmB,KAAKqP,EAAEulD,SAASvlD,EAAEulD,SAAS,KAAKxqD,GAAGK,EAAEkB,GAAE,IAAsI6T,EAAEzd,EAApIwI,EAAE,GAAM3d,QAAQmS,QAAQyL,GAAGD,EAAEC,EAAE5d,QAAQuN,WAAWqQ,KAAKD,EAAEC,KAAK5d,QAAQ+M,UAAU0V,EAAEwlD,QAAQxlD,EAAEwlD,OAAO,kBAAkBxlD,EAAEwlD,QAAer1C,EAAE,GAAG5yB,QAAQkB,QAAQyc,EAAE,IAAG,SAASC,EAAEmB,GAAG5e,KAAKS,KAAKod,EAAEwpD,eAAezoD,EAAE0D,MAAKmQ,GAAGzd,EAAEyd,EAAExf,KAAKqP,EAAEulD,SAASvlD,EAAEulD,SAAS,KAAKxqD,GAAGrI,EAAE4J,GAAE/e,QAAQkB,QAAQyc,GAAE,SAASC,EAAEsqD,GAAG,IAAI5uC,EAAEg9B,EAAEwJ,EAAE9/D,QAAQoiB,KAAKzE,EAAEuqD,IAAI5R,EAAE,GAAG,IAAIz4C,EAAE4E,EAAE0lD,YAAY1lD,EAAE0lD,YAAYrI,EAAE9/D,QAAQkB,QAAQ2c,GAAE,SAASD,GAAG,IAAImB,EAAE0D,EAAE0lD,YAAYrI,EAAEliD,GAAGA,EAAEzd,KAAKS,KAAKod,EAAEwpD,eAAezoD,EAAE0D,MAAK6zC,GAAGh9B,EAAEg9B,EAAEljD,KAAKqP,EAAEulD,SAASvlD,EAAEulD,SAAS,KAAKxqD,GAAG0qD,EAAEvqD,EAAEpO,OAAO+pB,EAAEva,EAAEua,KAAI7W,EAAE2lD,qBAAqBtI,GAA9wC,UAAoxCA,GAAGtiD,EAAE84C,EAAExpD,QAAQgzD,MAAK,MAAM,mBAAmBjiD,EAAS,OAAGA,EAAS,OAAE,SAASD,GAAG04C,EAAE9hB,OAAO52B,MAAK04C,EAAE1yD,SAASzD,KAAKkoE,cAAc,SAASzqD,GAAG,YAAO,IAAS0b,EAAE1b,IAAIzd,KAAKmoE,eAAe,SAAS1qD,GAAG,OAAO0b,EAAE1b,OAAO5d,QAAQC,OAAO,oBAAoB+C,UAAU,QAAQ,CAAC,SAAS,KAAK,MAAM,YAAY,WAAW,SAAS+b,EAAEmpD,EAAE5uC,EAAE7W,EAAE6zC,GAAG,MAAM,CAAChvD,SAAS,KAAKrE,MAAM,CAAC6E,KAAK,SAASygE,SAAS,YAAYR,OAAO,aAAaI,YAAY,kBAAkBN,SAAS,iBAAiBJ,WAAW,oBAAoBG,aAAa,gBAAgBI,SAAS,kBAAkBz7C,SAAS,YAAY67C,mBAAmB,UAAUxtB,QAAQ,IAAI4tB,QAAQ,WAAWP,MAAM,aAAa9mE,WAAW,CAAC,SAAS,WAAW,SAAS,cAAc,SAASyc,EAAEmB,EAAE0D,GAAwe7E,EAAE6qD,IAAI,GAAGzoE,QAAQ+M,UAAU6Q,EAAE2O,WAAW,QAAQ3O,EAAE2O,UAAUvsB,QAAQmS,QAAQyL,EAAE9V,OAAO8V,EAAElZ,OAAO,QAAO,WAAWkZ,EAAE8qD,cAAY,GAAI9qD,EAAE+qD,YAAY,WAAW,OAAO/qD,EAAE2qD,UAAU,gBAAgB3qD,EAAE8qD,SAAS,WAAW,IAAI1qD,EAAEkqD,EAAE97D,QAAQ,OAAO2S,EAAE6pD,SAASnmD,EAAEomD,mBAAmB,kBAAkBvvC,EAAEjb,UAAUT,EAAE9V,OAAhxB,WAAa,IAAIiX,EAAE,CAAC8oD,SAASjqD,EAAEiqD,SAASjqD,EAAEiqD,SAAS,IAAIJ,WAAW7pD,EAAE6pD,WAAW7pD,EAAE6pD,WAAW,IAAIG,aAAahqD,EAAEgqD,aAAaQ,mBAAmBxqD,EAAEwqD,oBAAoB,OAAOpoE,QAAQ+M,UAAU0V,EAAEqmD,aAAa/pD,EAAEgpD,OAAOnqD,EAAEpc,MAAMoc,EAAEmqD,SAAS/nE,QAAQ+M,UAAU0V,EAAEsmD,kBAAkBhqD,EAAEopD,YAAYvqD,EAAEpc,MAAMoc,EAAEuqD,cAAcnoE,QAAQ+M,UAAU0V,EAAEumD,YAAYjqD,EAAEkpD,MAAMrqD,EAAEpc,MAAMoc,EAAEqqD,QAAQlpD,EAAEipD,SAASpqD,EAAEoqD,SAASpqD,EAAEoqD,SAAS,IAAIjpD,EAAEipD,SAAS1uC,EAAE+uC,cAActpD,EAAEipD,UAAU1uC,EAAEgvC,eAAevpD,EAAEipD,UAAUjpD,EAAEipD,SAASjpD,EAAoTu3C,IAAKprD,MAAK,SAASg9D,GAAGtqD,EAAE6qD,IAAIP,EAAEnpD,EAAEkqD,YAAYxmD,EAAEomD,mBAAmB,kBAAkB7qD,EAAElR,QAAQo7D,MAAKtqD,EAAExZ,SAAS4Z,EAAEpa,WAAW8E,KAAK,SAASqW,EAAEmpD,GAA8bA,EAAEzkE,KAAK,SAAQ,WAAWsb,EAAE2pD,WAAWx9D,MAAK,YAAve,WAAa,IAAIg9D,EAAEnpD,EAAEypD,SAAS,QAAQlvC,EAAE,IAAIwjC,KAAK,CAAC/9C,EAAE0pD,KAAK,CAACp5D,KAAK,oBAAoB64D,EAAE,MAAM,GAAGtqD,EAAEo+B,UAAUktB,iBAAiBltB,UAAUmtB,WAAW7vC,EAAEva,EAAE4pD,mBAAmB,CAAC,IAAI3qD,EAAEhe,QAAQkD,QAAQ,+CAA+C48D,EAAE9/D,QAAQkD,QAAQ8a,EAAEjV,WAAW,IAAI+2D,EAAE7sD,KAAK,OAAO2K,EAAE2uC,IAAIC,gBAAgBlzB,IAAIwmC,EAAE7sD,KAAK,WAAW8L,EAAE4pD,eAAe7I,EAAE7sD,KAAK,SAAS,UAAUwP,EAAExB,KAAK,QAAQuZ,OAAOxc,GAAGs4C,GAAE,WAAWwJ,EAAE,GAAG/P,QAAQ+P,EAAE9yD,WAAU,OAA8DssB,MAAMva,EAAE3a","sources":["webpack://motion-chat/./node_modules/@flowjs/ng-flow/dist/ng-flow.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/locationServices.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/services.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js","webpack://motion-chat/./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/common.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/coreservices.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/glob.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/hof.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/predicates.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/queue.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/safeConsole.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/strings.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/common/trace.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/globals.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/params/param.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/params/paramType.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/params/paramTypes.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/params/stateParams.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/path/pathNode.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/path/pathUtils.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/resolve/interface.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/router.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/state/stateObject.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/state/targetState.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/transition/interface.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/resolve.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/views.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/url.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/transition/transitionService.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/url/urlConfig.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/url/urlRouter.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/url/urlRule.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/url/urlRules.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/url/urlService.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/q.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/vanilla/utils.js","webpack://motion-chat/./node_modules/@uirouter/core/lib-esm/view/view.js","webpack://motion-chat/./node_modules/angular-aria/angular-aria.js","webpack://motion-chat/./node_modules/angular-rateit/dist/ng-rateit.js","webpack://motion-chat/./src/js/index.controller.js","webpack://motion-chat/./src/js/index.route.js","webpack://motion-chat/./src/js/closing/closing.controller.js","webpack://motion-chat/./src/js/index.factory.js","webpack://motion-chat/./src/js/chat/chat.controller.js","webpack://motion-chat/./src/js/common/remote-storage.service.js","webpack://motion-chat/./src/js/audio-player/audio-player.controller.js","webpack://motion-chat/./src/js/common/typeFromMimeType.filter.js","webpack://motion-chat/./src/js/document-wrapper/document-wrapper.controller.js","webpack://motion-chat/./src/js/index.module.js","webpack://motion-chat/./node_modules/core-js/internals/a-function.js","webpack://motion-chat/./node_modules/core-js/internals/a-possible-prototype.js","webpack://motion-chat/./node_modules/core-js/internals/an-object.js","webpack://motion-chat/./node_modules/core-js/internals/array-buffer-native.js","webpack://motion-chat/./node_modules/core-js/internals/array-buffer-view-core.js","webpack://motion-chat/./node_modules/core-js/internals/array-sort.js","webpack://motion-chat/./node_modules/core-js/internals/classof-raw.js","webpack://motion-chat/./node_modules/core-js/internals/classof.js","webpack://motion-chat/./node_modules/core-js/internals/correct-prototype-getter.js","webpack://motion-chat/./node_modules/core-js/internals/create-non-enumerable-property.js","webpack://motion-chat/./node_modules/core-js/internals/create-property-descriptor.js","webpack://motion-chat/./node_modules/core-js/internals/descriptors.js","webpack://motion-chat/./node_modules/core-js/internals/document-create-element.js","webpack://motion-chat/./node_modules/core-js/internals/engine-ff-version.js","webpack://motion-chat/./node_modules/core-js/internals/engine-is-ie-or-edge.js","webpack://motion-chat/./node_modules/core-js/internals/engine-user-agent.js","webpack://motion-chat/./node_modules/core-js/internals/engine-v8-version.js","webpack://motion-chat/./node_modules/core-js/internals/engine-webkit-version.js","webpack://motion-chat/./node_modules/core-js/internals/fails.js","webpack://motion-chat/./node_modules/core-js/internals/get-built-in.js","webpack://motion-chat/./node_modules/core-js/internals/global.js","webpack://motion-chat/./node_modules/core-js/internals/has.js","webpack://motion-chat/./node_modules/core-js/internals/hidden-keys.js","webpack://motion-chat/./node_modules/core-js/internals/ie8-dom-define.js","webpack://motion-chat/./node_modules/core-js/internals/inspect-source.js","webpack://motion-chat/./node_modules/core-js/internals/internal-state.js","webpack://motion-chat/./node_modules/core-js/internals/is-object.js","webpack://motion-chat/./node_modules/core-js/internals/is-pure.js","webpack://motion-chat/./node_modules/core-js/internals/is-symbol.js","webpack://motion-chat/./node_modules/core-js/internals/native-symbol.js","webpack://motion-chat/./node_modules/core-js/internals/native-weak-map.js","webpack://motion-chat/./node_modules/core-js/internals/object-define-property.js","webpack://motion-chat/./node_modules/core-js/internals/object-get-prototype-of.js","webpack://motion-chat/./node_modules/core-js/internals/object-set-prototype-of.js","webpack://motion-chat/./node_modules/core-js/internals/ordinary-to-primitive.js","webpack://motion-chat/./node_modules/core-js/internals/redefine.js","webpack://motion-chat/./node_modules/core-js/internals/require-object-coercible.js","webpack://motion-chat/./node_modules/core-js/internals/set-global.js","webpack://motion-chat/./node_modules/core-js/internals/shared-key.js","webpack://motion-chat/./node_modules/core-js/internals/shared-store.js","webpack://motion-chat/./node_modules/core-js/internals/shared.js","webpack://motion-chat/./node_modules/core-js/internals/to-integer.js","webpack://motion-chat/./node_modules/core-js/internals/to-length.js","webpack://motion-chat/./node_modules/core-js/internals/to-object.js","webpack://motion-chat/./node_modules/core-js/internals/to-primitive.js","webpack://motion-chat/./node_modules/core-js/internals/to-property-key.js","webpack://motion-chat/./node_modules/core-js/internals/to-string-tag-support.js","webpack://motion-chat/./node_modules/core-js/internals/uid.js","webpack://motion-chat/./node_modules/core-js/internals/use-symbol-as-uid.js","webpack://motion-chat/./node_modules/core-js/internals/well-known-symbol.js","webpack://motion-chat/./node_modules/core-js/modules/es.typed-array.at.js","webpack://motion-chat/./node_modules/core-js/modules/es.typed-array.sort.js","webpack://motion-chat/./node_modules/core-js/modules/esnext.typed-array.at.js","webpack://motion-chat/./node_modules/expose-loader/dist/runtime/getGlobalThis.js","webpack://motion-chat/./node_modules/json-form-data/src/jsonToFormData.js","webpack://motion-chat/./node_modules/moment/locale/af.js","webpack://motion-chat/./node_modules/moment/locale/ar-dz.js","webpack://motion-chat/./node_modules/moment/locale/ar-kw.js","webpack://motion-chat/./node_modules/moment/locale/ar-ly.js","webpack://motion-chat/./node_modules/moment/locale/ar-ma.js","webpack://motion-chat/./node_modules/moment/locale/ar-sa.js","webpack://motion-chat/./node_modules/moment/locale/ar-tn.js","webpack://motion-chat/./node_modules/moment/locale/ar.js","webpack://motion-chat/./node_modules/moment/locale/az.js","webpack://motion-chat/./node_modules/moment/locale/be.js","webpack://motion-chat/./node_modules/moment/locale/bg.js","webpack://motion-chat/./node_modules/moment/locale/bm.js","webpack://motion-chat/./node_modules/moment/locale/bn-bd.js","webpack://motion-chat/./node_modules/moment/locale/bn.js","webpack://motion-chat/./node_modules/moment/locale/bo.js","webpack://motion-chat/./node_modules/moment/locale/br.js","webpack://motion-chat/./node_modules/moment/locale/bs.js","webpack://motion-chat/./node_modules/moment/locale/ca.js","webpack://motion-chat/./node_modules/moment/locale/cs.js","webpack://motion-chat/./node_modules/moment/locale/cv.js","webpack://motion-chat/./node_modules/moment/locale/cy.js","webpack://motion-chat/./node_modules/moment/locale/da.js","webpack://motion-chat/./node_modules/moment/locale/de-at.js","webpack://motion-chat/./node_modules/moment/locale/de-ch.js","webpack://motion-chat/./node_modules/moment/locale/de.js","webpack://motion-chat/./node_modules/moment/locale/dv.js","webpack://motion-chat/./node_modules/moment/locale/el.js","webpack://motion-chat/./node_modules/moment/locale/en-au.js","webpack://motion-chat/./node_modules/moment/locale/en-ca.js","webpack://motion-chat/./node_modules/moment/locale/en-gb.js","webpack://motion-chat/./node_modules/moment/locale/en-ie.js","webpack://motion-chat/./node_modules/moment/locale/en-il.js","webpack://motion-chat/./node_modules/moment/locale/en-in.js","webpack://motion-chat/./node_modules/moment/locale/en-nz.js","webpack://motion-chat/./node_modules/moment/locale/en-sg.js","webpack://motion-chat/./node_modules/moment/locale/eo.js","webpack://motion-chat/./node_modules/moment/locale/es-do.js","webpack://motion-chat/./node_modules/moment/locale/es-mx.js","webpack://motion-chat/./node_modules/moment/locale/es-us.js","webpack://motion-chat/./node_modules/moment/locale/es.js","webpack://motion-chat/./node_modules/moment/locale/et.js","webpack://motion-chat/./node_modules/moment/locale/eu.js","webpack://motion-chat/./node_modules/moment/locale/fa.js","webpack://motion-chat/./node_modules/moment/locale/fi.js","webpack://motion-chat/./node_modules/moment/locale/fil.js","webpack://motion-chat/./node_modules/moment/locale/fo.js","webpack://motion-chat/./node_modules/moment/locale/fr-ca.js","webpack://motion-chat/./node_modules/moment/locale/fr-ch.js","webpack://motion-chat/./node_modules/moment/locale/fr.js","webpack://motion-chat/./node_modules/moment/locale/fy.js","webpack://motion-chat/./node_modules/moment/locale/ga.js","webpack://motion-chat/./node_modules/moment/locale/gd.js","webpack://motion-chat/./node_modules/moment/locale/gl.js","webpack://motion-chat/./node_modules/moment/locale/gom-deva.js","webpack://motion-chat/./node_modules/moment/locale/gom-latn.js","webpack://motion-chat/./node_modules/moment/locale/gu.js","webpack://motion-chat/./node_modules/moment/locale/he.js","webpack://motion-chat/./node_modules/moment/locale/hi.js","webpack://motion-chat/./node_modules/moment/locale/hr.js","webpack://motion-chat/./node_modules/moment/locale/hu.js","webpack://motion-chat/./node_modules/moment/locale/hy-am.js","webpack://motion-chat/./node_modules/moment/locale/id.js","webpack://motion-chat/./node_modules/moment/locale/is.js","webpack://motion-chat/./node_modules/moment/locale/it-ch.js","webpack://motion-chat/./node_modules/moment/locale/it.js","webpack://motion-chat/./node_modules/moment/locale/ja.js","webpack://motion-chat/./node_modules/moment/locale/jv.js","webpack://motion-chat/./node_modules/moment/locale/ka.js","webpack://motion-chat/./node_modules/moment/locale/kk.js","webpack://motion-chat/./node_modules/moment/locale/km.js","webpack://motion-chat/./node_modules/moment/locale/kn.js","webpack://motion-chat/./node_modules/moment/locale/ko.js","webpack://motion-chat/./node_modules/moment/locale/ku.js","webpack://motion-chat/./node_modules/moment/locale/ky.js","webpack://motion-chat/./node_modules/moment/locale/lb.js","webpack://motion-chat/./node_modules/moment/locale/lo.js","webpack://motion-chat/./node_modules/moment/locale/lt.js","webpack://motion-chat/./node_modules/moment/locale/lv.js","webpack://motion-chat/./node_modules/moment/locale/me.js","webpack://motion-chat/./node_modules/moment/locale/mi.js","webpack://motion-chat/./node_modules/moment/locale/mk.js","webpack://motion-chat/./node_modules/moment/locale/ml.js","webpack://motion-chat/./node_modules/moment/locale/mn.js","webpack://motion-chat/./node_modules/moment/locale/mr.js","webpack://motion-chat/./node_modules/moment/locale/ms-my.js","webpack://motion-chat/./node_modules/moment/locale/ms.js","webpack://motion-chat/./node_modules/moment/locale/mt.js","webpack://motion-chat/./node_modules/moment/locale/my.js","webpack://motion-chat/./node_modules/moment/locale/nb.js","webpack://motion-chat/./node_modules/moment/locale/ne.js","webpack://motion-chat/./node_modules/moment/locale/nl-be.js","webpack://motion-chat/./node_modules/moment/locale/nl.js","webpack://motion-chat/./node_modules/moment/locale/nn.js","webpack://motion-chat/./node_modules/moment/locale/oc-lnc.js","webpack://motion-chat/./node_modules/moment/locale/pa-in.js","webpack://motion-chat/./node_modules/moment/locale/pl.js","webpack://motion-chat/./node_modules/moment/locale/pt-br.js","webpack://motion-chat/./node_modules/moment/locale/pt.js","webpack://motion-chat/./node_modules/moment/locale/ro.js","webpack://motion-chat/./node_modules/moment/locale/ru.js","webpack://motion-chat/./node_modules/moment/locale/sd.js","webpack://motion-chat/./node_modules/moment/locale/se.js","webpack://motion-chat/./node_modules/moment/locale/si.js","webpack://motion-chat/./node_modules/moment/locale/sk.js","webpack://motion-chat/./node_modules/moment/locale/sl.js","webpack://motion-chat/./node_modules/moment/locale/sq.js","webpack://motion-chat/./node_modules/moment/locale/sr-cyrl.js","webpack://motion-chat/./node_modules/moment/locale/sr.js","webpack://motion-chat/./node_modules/moment/locale/ss.js","webpack://motion-chat/./node_modules/moment/locale/sv.js","webpack://motion-chat/./node_modules/moment/locale/sw.js","webpack://motion-chat/./node_modules/moment/locale/ta.js","webpack://motion-chat/./node_modules/moment/locale/te.js","webpack://motion-chat/./node_modules/moment/locale/tet.js","webpack://motion-chat/./node_modules/moment/locale/tg.js","webpack://motion-chat/./node_modules/moment/locale/th.js","webpack://motion-chat/./node_modules/moment/locale/tk.js","webpack://motion-chat/./node_modules/moment/locale/tl-ph.js","webpack://motion-chat/./node_modules/moment/locale/tlh.js","webpack://motion-chat/./node_modules/moment/locale/tr.js","webpack://motion-chat/./node_modules/moment/locale/tzl.js","webpack://motion-chat/./node_modules/moment/locale/tzm-latn.js","webpack://motion-chat/./node_modules/moment/locale/tzm.js","webpack://motion-chat/./node_modules/moment/locale/ug-cn.js","webpack://motion-chat/./node_modules/moment/locale/uk.js","webpack://motion-chat/./node_modules/moment/locale/ur.js","webpack://motion-chat/./node_modules/moment/locale/uz-latn.js","webpack://motion-chat/./node_modules/moment/locale/uz.js","webpack://motion-chat/./node_modules/moment/locale/vi.js","webpack://motion-chat/./node_modules/moment/locale/x-pseudo.js","webpack://motion-chat/./node_modules/moment/locale/yo.js","webpack://motion-chat/./node_modules/moment/locale/zh-cn.js","webpack://motion-chat/./node_modules/moment/locale/zh-hk.js","webpack://motion-chat/./node_modules/moment/locale/zh-mo.js","webpack://motion-chat/./node_modules/moment/locale/zh-tw.js","webpack://motion-chat//home/fabio/Work/Xenialab/MotionV3/motion-server/motion-chat/node_modules/moment/locale|sync|/^\\.\\/.*$/","webpack://motion-chat/./node_modules/ng-csv/build/ng-csv.min.js"],"names":["angular","module","provider","this","defaults","factory","options","Flow","events","on","event","callback","push","$get","fn","opts","flow","extend","forEach","controller","$scope","$attrs","$parse","flowFactory","$eval","flowInit","flowObject","create","catchAllHandler","eventName","args","Array","prototype","slice","call","arguments","shift","$broadcast","apply","concat","$applyAsync","defaultPrevented","$on","off","$flow","hasOwnProperty","flowName","assign","directive","scope","element","attrs","isDirectory","isSingleFile","inputAttrs","flowAttrs","assignBrowse","bind","preventDefault","$timeout","promise","enter","dragEvent","fileDrag","dataTransfer","originalEvent","types","val","$apply","flowDragEnter","cancel","flowDragLeave","assignDrop","flowDropEnabled","$watch","value","unAssignDrop","fileSuccess","fileProgress","fileAdded","filesAdded","filesSubmitted","fileRetry","fileRemoved","fileError","uploadStart","complete","progress","error","eventArgs","string","name","charAt","toUpperCase","require","funcArgs","key","file","flowImg","fileReader","FileReader","readAsDataURL","onload","$set","target","result","transfers","files","uiView","$ViewDirectiveFill","$compile","$controller","$transitions","$view","$q","getControllerAs","parse","getResolveAs","restrict","priority","compile","tElement","initial","html","empty","$element","data","contents","cfg","$cfg","viewDecl","getTemplate","noop","resolveCtx","path","ResolveContext","trace","$uiView","link","controllerAs","resolveAs","locals","controllerInstance","children","registerControllerCallbacks","isString","component","kebobName","kebobString","tagRegexp_1","RegExp","deregisterWatch_1","directiveEl","filter","el","tagName","exec","ctrlInstance","$animate","$uiViewScroll","$interpolate","rootData","$context","_pluginapi","_rootViewContext","count","terminal","transclude","tAttrs","$transclude","previousEl","currentEl","currentScope","viewConfig","onloadExp","autoScrollExp","renderer","cb","then","leave","inherited","inheritedData","activeUIView","$type","id","fqn","config","configUpdated","updateView","fromParentTagConfig","fromParentTag","unregister","registerUIView","newScope","$new","animEnter","defer","animLeave","$uiViewData","$uiViewAnim","$animEnter","$animLeave","$$animLeave","$emit","cloned","clone","resolve","isDefined","remove","$destroy","_viewData_1","cleanupLastView","$inject","hasComponentImpl","_uiCanExitId","isFunction","$onInit","componentProvider","viewState","tail","state","self","hookOptions","uiOnParamsChanged","viewCreationTrans_1","getResolvable","onSuccess","$transition$","exiting","indexOf","toParams","params","fromParams","getNodeSchema","node","paramSchema","toSchema","treeChanges","map","reduce","unnestR","fromSchema","changedToParams","param","idx","type","equals","length","changedKeys_1","x","newValues","uiCanExit","id_1","cacheProp_1","prevTruthyAnswer_1","trans","redirectedFrom","criteria","onBefore","ids","when","TemplateFactory","_this","_useHttp","$http","$templateCache","$injector","$templateRequest","has","get","useHttpService","fromConfig","context","asTemplate","services","str","template","asComponent","fromString","templateUrl","fromUrl","templateProvider","fromProvider","fromComponentProvider","url","cache","headers","Accept","response","deps","providerFn","isArray","Resolvable","makeComponentTemplate","bindings","prefix","kebob","camelCase","kebobed","cmpDefs","Error","getBindings","getComponentBindings","input","attrName","attr","resolveName","res","join","def","isObject","bindToController","scopeBindings","bindingsObj","Object","keys","tuple","getStateHookBuilder","hookName","stateObject","hook","pathname","subContext","$$state","getLocals","$state$","undefined","Ng1LocationServices","$locationProvider","_urlListeners","_lp","createProxyFunctions","monkeyPatchPathParameterType","router","pathType","urlMatcherFactory","encode","toString","replace","m","decode","dispose","onChange","removeFrom","html5Mode","enabled","$sniffer","history","baseHref","_baseHref","$browser","$window","location","newUrl","$location","_runtimeServices","$rootScope","evt","_loc","mod_init","mod_util","mod_rtr","mod_state","mod_main","$uiRouterProvider","UIRouter","stateProvider","stateRegistry","stateService","decorator","viewService","_viewConfigFactory","urlService","_decodeParams","ng1LocationService","locationService","locationConfig","getProviderFor","serviceName","$urp","service","runBlock","$uiRouter","invoke","checkStrictDi","strictDi","resolvables","resolvable","annotate","resolveFn","watchDigests","uiRouter","urlRouterProvider","globals","run","$urlMatcherFactory","$state","$urlRouter","ctx","getTokens","getPolicy","async","applyPairs","$IsStateFilter","isFilter","is","$stateful","$IncludedByStateFilter","includesFilter","includes","StateProvider","func","definition","register","onInvalid","getNg1ViewConfigFactory","templateFactory","view","Ng1ViewConfig","hasAnyKey","obj","acc","ng1ViewsBuilder","parent","compKeys","nonCompKeys","allViewKeys","views","viewsObject","$default","pick","$name","normalized","ViewService","$uiViewName","uiViewName","$uiViewContextAnchor","uiViewContextAnchor","$id","loaded","load","paramValues","promises","getController","all","results","controllerProvider","isInjectable","UrlRouterProvider","injectableHandler","handler","match","$match","$stateParams","urlRouter","update","interceptDeferred","listen","rule","ruleFn","BaseUrlRule","identity","rules","otherwise","urlRules","what","deferIntercept","useAnchorScroll","$anchorScroll","scrollIntoView","__spreadArrays","s","i","il","r","k","a","j","jl","root","g","global","fromJson","JSON","toJson","stringify","toObj","_equals","o1","o2","t1","a1","a2","tup","arrayTuples","b","t","getTime","source","fnNames","latebind","bindFunction","fnName","inherit","extra","inArray","array","splice","pushTo","arr","deregAll","functions","defaultsList","_i","defaultVals","reverse","mergeR","memo","item","ancestors","first","second","n","propNames","objCopy","_prop","omit","collection","accept","find","mapObj","values","allTrueR","elem","anyTrueR","flattenR","pushR","uniqR","token","unnest","assertPredicate","predicateOrMap","errMsg","maxArrayLen","min","Math","_loop_1","keyValTuple","copy","src","dest","silenceUncaughtInPromise","catch","e","silentRejection","makeStub","methods","fnname","Glob","text","glob","split","regexpString","seg","regexp","matches","test","curry","curried","compose","start","pipe","funcs","prop","propEq","_val","not","and","fn1","fn2","or","any","ctor","constructor","v","pattern","struct","toStr","tis","isUndefined","isNull","o","isNullOrUndefined","isNumber","isDate","isRegExp","head","isPromise","Queue","_items","_limit","_evictListeners","onEvict","enqueue","items","evict","dequeue","size","clear","current","peekTail","peekHead","noopConsoleStub","log","table","safeConsole","document","documentMode","window","console","bound","Function","ie9Console","fallbackConsole","maxLength","max","substr","padString","$1","toLowerCase","functionToString","fnStr","fnToString","namedFunctionMatch","_fn","isRejection","stringifyPattern","_transitionRejection","seen","format","beforeAfterSubstr","char","stripLastPathElement","splitHash","splitQuery","splitEqual","trimHashVal","splitOnDelim","delim","re","joinNeighborsR","Category","uiViewString","uiview","creationContext","normalizedCat","_tid","_rid","transLbl","Trace","_enabled","approximateDigests","_set","categories","parseInt","isNaN","category","enable","disable","traceTransitionStart","TRANSITION","traceTransitionIgnored","traceHookInvocation","step","HOOK","registeredHook","traceHookResult","hookResult","transitionOptions","traceResolvePath","RESOLVE","traceResolvableResolved","traceError","reason","traceSuccess","finalState","traceUIViewEvent","viewData","UIVIEW","traceUIViewConfigUpdated","traceUIViewFill","traceViewSync","pairs","VIEWCONFIG","uivheader","mapping","_a","_b","uiv","sort","localeCompare","traceViewServiceEvent","viewConfigString","traceViewServiceUIViewEvent","UIRouterGlobals","lastStartedTransitionId","transitionHistory","successfulTransitions","transition","lazyLoadHook","entering","lazyLoad","lazyLoadState","originalTransition","orig","targetState","identifier","$url","parts","sync","registerLazyLoadHook","transitionService","lazyLoadFn","states","_state","err","DefType","hasOwn","Param","urlConfig","paramName","noReloadOnSearch","reloadOnSearch","SEARCH","dynamic","defaultConfig","paramConfig","getStaticDefaultValue","isShorthand","$$fn","unwrapShorthand","getParamDeclaration","urlType","paramTypes","CONFIG","PATH","getType","arrayDefaults","arrayParamNomenclature","arrayMode","$asArray","isOptional","raw","squash","defaultPolicy","getSquashPolicy","defaultSquashPolicy","from","to","configuredKeys","getReplace","params_1","changed","values1","values2","validates","isDefaultValue","replaceSpecialValues","_defaultValueCache","defaultValue","getDefaultValue","$normalize","isSearch","encoded","ParamType","$subPattern","sub","mode","ArrayType","arrayWrap","arrayHandler","allTruthyMode","arrayUnwrap","arrayEqualsHandler","val1","val2","left","right","paramTypeFn","wrapperFn","$arrayMode","makeDefaultType","ParamTypes","typeQueue","defaultTypes","definitionFn","_flushTypeQueue","valToString","defaultTypeBase","String","query","hash","int","bool","Boolean","date","getFullYear","getMonth","getDate","capture","Date","valueOf","l","json","StateParams","$inherit","newParams","$current","$to","parentParams","parents","inheritList","PathNode","stateOrNode","parameters","applyRawParams","pDef","paramDef","parameter","paramsFn","diff","PathUtils","makeTargetState","registry","buildPath","buildToPath","fromPath","toPath","inheritParams","applyViewConfigs","viewDecls","subPath","viewConfigs","createViewConfig","toKeys","noInherit","toNode","toParamVals","incomingParamVals","fromParamVals","ownParamVals","reloadState","node1","node2","retained","keep","nonDynamicParams","retainedWithToParams","retainedNode","matching","pathA","pathB","done","nodeA","nodeB","predicate","elementIdx","resolvePolicies","LAZY","EAGER","WAIT","NOWAIT","arg1","policy","resolved","literal","thisPolicy","statePolicy","resolvePolicy","resolveContext","findNode","asyncPolicy","customAsyncPolicy","getDependencies","resolvedDeps","resolvedValue","fromData","whens","ALL_WHENS","EAGER_WHENS","_path","addResolvables","newResolvables","resolvePath","matchedWhens","matchesPolicy","acceptedVals","whenOrAsync","nodeResolvables","nowait","wait","getResult","injector","_injector","UIInjectorImpl","availableResolvables","_node","fromInjector","getNative","native","getAsync","_routerInstance","locationServiceStub","locationConfigStub","_disposed","_disposables","_plugins","disposable","d","ignored","plugin","pluginInstance","getPlugin","pluginName","nameBuilder","selfBuilder","dataBuilder","getUrlBuilder","$urlMatcherFactoryProvider","stateDec","newStateDec","parsed","substring","parseUrl","isMatcher","navigable","append","getNavigableBuilder","isRoot","pathBuilder","includesBuilder","resolvablesBuilder","resolveObj","getToken","p","provide","literal2Resolvable","useFactory","dependencies","useClass","useValue","useExisting","tuple2Resolvable","item2Resolvable","decl","StateBuilder","matcher","paramFactory","builders","parentName","urlParams","nonUrlParams","builder","build","chain","parentFn","segments","pop","StateMatcher","_states","isRelative","stateName","stateOrName","base","matchGlob","isStr","__stateObjectCache","nameGlob","baseState","splitName","pathLength","relName","StateObject","stateDecl","isStateClass","ref","matchingKeys","isStateDeclaration","isState","StateQueueManager","listeners","queue","flush","registered","orphans","previousQueueLength","getState","notifyListeners","listener","name_1","orphanIdx","existingState","existingFutureState","deregister","attachRoute","prev","abstract","rulesApi","urlRuleFactory","StateRegistry","stateQueue","_registerRoot","_root","onStatesChanged","stateDefinition","_deregisterTree","getChildren","_children","deregistered","removeRule","deregisteredStates","found","property","builderFunction","TargetState","_stateRegistry","_identifier","_params","_options","_definition","relative","exists","valid","withState","withParams","withOptions","newOpts","isDef","HookBuilder","buildHooksForPhase","phase","_getEvents","buildHooks","hookType","matchingHooks","getMatchingHooks","reverseDepthSort","baseHookOptions","criteriaMatchPath","traceData","transitionHook","reverseSort","factor","depthDelta","isCreate","hookPhase","reg","getHooks","matchState","criterion","toMatch","globStrings","RegisteredHook","tranSvc","eventType","matchCriteria","removeHookFromRegistry","invokeCount","_deregistered","invokeLimit","_matchingNodes","nodes","_getDefaultMatchCriteria","_getPathTypes","_getMatchingNodes","mn","pathtype","isStateHook","every","makeEvent","hooks","_registeredHooks","removeHookFn","hookRegistrationFn","matchObject","TransitionHookPhase","TransitionHookScope","RejectType","Rejection","message","detail","isRejectionPromise","superseded","rejection","SUPERSEDED","redirected","invalid","INVALID","IGNORED","aborted","ABORTED","errored","ERROR","normalize","toPromise","TransitionEventType","hookOrder","getResultHandler","getErrorHandler","synchronous","defaultOptions","TransitionHook","stateContext","isSuperseded","isActive","waitFor","nextHook","invokeHook","invokeHooks","doneCallback","remainingHooks","runAllHooks","logError","defaultErrorHandler","notCurrent","getNotCurrentRejection","handleError","handleResult","handleHookResult","isTargetState","_aborted","HANDLE_RESULT","LOG_REJECTED_RESULT","LOG_ERROR","REJECT_ERROR","THROW_ERROR","addCoreResolvables","addResolvable","TRANSITION_TOKENS","isTransition","treeChangesCleanup","replaceTransitionWithNull","redirectToHook","redirect","redirectTo","makeEnterExitRetainHook","hookFn","onExitHook","onRetainHook","onEnterHook","RESOLVE_HOOK_PRIORITY","eagerResolvePath","lazyResolveState","resolveRemaining","loadEnteringViews","enteringViews","activateViews","exitingViews","vc","deactivateViewConfig","activateViewConfig","updateGlobalState","clearCurrentTransition","updateUrl","urlOptions","ignoredHook","ignoredReason","_ignoredReason","pending","abort","invalidTransitionHook","defaultTransOpts","notify","reload","supercede","custom","TransitionService","_router","_transitionCount","_eventTypes","_criteriaPaths","_deregisterHookFns","_defineCorePaths","_defineCoreEvents","_registerCoreTransitionHooks","onCreate","onStart","onExit","onRetain","onEnter","onFinish","onError","hooksArray","Phase","TH","paths","NORMAL_SORT","SYNCHRONOUS","_defineEvent","CREATE","BEFORE","RUN","SUCCESS","STATE","_definePathType","cmpByPhase","hookScope","fns","addCoreResolves","registerInvalidTransitionHook","registerRedirectToHook","registerOnExitHook","registerOnRetainHook","registerOnEnterHook","eagerResolve","registerEagerResolvePath","lazyResolve","registerLazyResolveState","resolveAll","registerResolveRemaining","loadViews","registerLoadEnteringViews","registerActivateViews","updateGlobals","registerUpdateGlobalState","registerUpdateUrl","UrlConfig","_isCaseInsensitive","_isStrictMode","_defaultSquashPolicy","hashPrefix","newprefix","host","port","protocol","caseInsensitive","strictMode","__assign","ParamFactory","fromSearch","UrlMatcherFactory","UrlMatcher","globalConfig","strict","decodeParams","object","UrlRouter","urlParts","compareFn","read","urlMatcher","href","absolute","isHtml5","appendBasePath","slash","cfgPort","defineProperty","enumerable","configurable","UrlRuleFactory","makeRule","_what","fromUrlMatcher","fromState","fromRegExp","_handler","details","matchPriority","optional","search","stateOrDecl","transitionTo","sticky","Number","isUrlRule","defaultRuleSortFn","getHandlerFn","cmp","prioritySort","weights","URLMATCHER","REGEXP","RAW","OTHER","typeSort","urlMatcherSort","useMatchPriority","idSort","UrlRules","_sortFn","_rules","_id","_otherwiseFn","handlerFn","_sorted","ensureSorted","sorted","stableSort","group","_group","arrOfWrapper","wrapperA","wrapperB","cmpDiff","wrapper","UrlService","newurl","best","go","applyResult","_stopListeningFn","weight","BaseLocationServices","fireAfterUpdate","_listeners","_listener","_get","_location","_history","BrowserLocationConfig","_isHtml5","_hashPrefix","hostname","getBaseHref","baseTag","getElementsByTagName","extendStatics","__extends","setPrototypeOf","__proto__","__","HashLocationService","_super","title","MemoryLocationConfig","_port","_protocol","_host","newval","MemoryLocationService","_url","PushStateLocationService","_config","_getBasePrefix","basePrefix","exactBaseHrefMatch","startsWithBase","fullUrl","replaceState","pushState","Promise","reject","deferred","keyValsToObjectR","accum","getParams","queryString","orEmptyString","beforehash","buildUrl","loc","searchObject","locationPluginFactory","serviceClass","configurationClass","configuration","_uiViews","_viewConfigs","_viewConfigFactories","_registeredUIView","_registeredUIViews","_activeViewConfigs","_onSync","normalizeUIViewTarget","rawViewName","viewAtContext","relativeViewNameSugar","anchorState","anchor","_rootContext","viewType","cfgFactory","cfgs","uiViewsByFqn","viewConfigDepth","depthCompare","depthFn","posNeg","uiViewTuples","stateDepth","matchingConfigs","matchedViewConfigs","unmatchedConfigTuples","allTuples","uiViews","available","active","vcSegments","uivSegments","negOffset","fqnToFirstSegment","uiViewContext","ARIA_DISABLE_ATTR","ngAriaModule","info","angularVersion","ariaHidden","ariaChecked","ariaReadonly","ariaDisabled","ariaRequired","ariaInvalid","ariaValue","tabindex","bindKeydown","bindRoleForClick","watchExpr","ariaAttr","nativeAriaNodeNames","negate","ariaCamelName","isNodeOneOf","boolVal","newConfig","$$watchExpr","nodeTypeArray","nodeName","$aria","shouldAttachAttr","normalizedAttr","allowNonAriaNodes","shouldAttachRole","role","shape","getShape","post","ngModel","needsTabIndex","ngAriaWatchModelValue","$modelValue","newVal","$viewValue","$isEmpty","needsAriaValuemin","needsAriaValuemax","needsAriaValuenow","$observe","$validators","required","$invalid","ngMessages","ngClick","ngKeydown","ngKeypress","ngKeyup","keyCode","which","isContentEditable","$event","readOnly","pristine","resetable","starWidth","starHeight","canelWidth","cancelHeight","rated","reset","beforeRated","beforeReset","isTouch","navigator","msMaxTouchPoints","orgValue","starPartWidth","steps","garbage","getValue","index","getStartParts","getStarOffset","ratio","isSelected","removeRating","rating","setValue","tmpValue","put","IndexController","$mdDialog","RemoteStorageService","api","STORAGE_LAYOUT","STORAGE_VISITOR","vm","toggle","up","updateStorage","cmd","layout","postMessage","onStorageError","debug","visitor","status","div_color","settings","color","text_color","textColor","text_button_color","textButtonColor","button_color","color_button","background_color","backgroundColor","client_height","documentElement","clientHeight","innerHeight","client_width","clientWidth","style","setProperty","tg","getStoredValueWithLocation","visitorStoragePromise","getItem","layoutStoragePromise","visitorValue","layoutValue","interaction","alignment","online","exceeded","maxInteractions","openedInteractions","isOnline","hideWhenOffline","createElement","appendChild","sheet","insertRule","close","confirm","querySelector","clickOutsideToClose","closingQuestion","ok","show","chatInteraction","customUpdate","closed","closeReason","$promise","download","getMessages","intid","includeAll","forceDownload","_map","rows","row","sender","direction","customerAlias","ContactId","agentIdentifier","UserId","agentAlias","User","alias","fullname","body","createdAt","moment","getHeaderShape","header_shape","CHAT_STATUSES","offline","defaultTitle","header_online","header_offline","addEventListener","routeRun","cursor","hide","_forIn","_isNil","routeConfig","$stateProvider","$httpProvider","localStorageServiceProvider","STORAGE_PREFIX","Pragma","setPrefix","waitingTemplate","onlineTemplate","offlineTemplate","chatTemplate","unmanagedTemplate","closingTemplate","ClosingController","$mdToast","errors","toast","simple","textContent","formSubmitFailureMessage","toastClass","position","stopLoading","loading","goToIfTime","form","upColor","downColor","userForm","$setPristine","$setUntouched","enableDownload","removeItem","submit","_merge","ratingType","customer","formSubmitSuccessMessage","finally","skip","apiService","$resource","paramDefaults","baseUrl","remote","chatWebsite","method","getFields","uploadAttachment","transformRequest","downloadAttachment","abandon","chatMessage","ChatController","$interval","$document","InputRecorderService","emojiArea","getMessagesInterval","getInteractionInterval","lastMessageId","isSendingMessage","clearStorage","scrollToBottomOfChat","getElementsByClassName","scrollTop","scrollHeight","toolbarMessage","handleSizeError","code","outOfInterval","sendMessage","updateRootscope","interactionStarted","emojioneArea","setText","getInteraction","disposition","reply","getText","shiftKey","includeAgent","added","_find","messages","AttachmentId","startsWith","urlFromBody","emojiOptions","watchEmbedData","fontSmiley","emoji","linkTarget","ngFlow","ngFlowOptions","allowDuplicateUploads","showMenu","replyMessage","$","placeholder","placeholderMessage","keyup","editor","ready","setFocus","reply_button","maxFileSizeMb","fd","FormData","recording","recordingStopped","recordedAudioUrl","onRecordingStart","init","startRecording","recordStartTime","now","stream","mediaStream","audioCtx","AudioContext","createMediaStreamSource","analyser","createAnalyser","connect","fftSize","frequencyData","Uint8Array","frequencyBinCount","recordRippleEl","recordTimeEl","transform","innerText","requestAnimationFrame","getByteFrequencyData","sum","percents","ms","formatted","toHHMMSS","round","e0","onRecordingStop","stopRecording","audioURL","URL","createObjectURL","onRecordingSend","addFile","onRecordingDelete","_values","remoteAddress","address","origin","setItem","action","storage","expectedAction","removeEventListener","stringData","warn","AudioPlayerController","showCurrentTime","$onDestroy","$postLink","draggableClasses","currentlyDragged","handleMethodOnMouseMove","audio","onloadedmetadata","duration","Infinity","currentTime","ontimeupdate","timeupdate","onloadeddata","oncanplay","makePlay","onended","playPause","$digest","togglePlay","paused","play","pause","updateProgress","percent","sliderTime","formatTime","time","floor","sec","onSliderTimeChanged","disposeSource","revokeObjectURL","groups","DocumentWrapperController","documentName","documentExtension","documentClassExtension","downloadDocument","click","toTrustedFilter","$sce","trustAsHtml","constant","ngEnter","div","startTime","sentAt","createTextNode","myWindow","open","write","referer","innerHTML","focus","print","printElement","$mdGestureProvider","skipClickHijack","OfflineController","OnlineController","UnmanagedController","WaitingController","AudioPlayerTemplate","typeFromMimeType","MediaViewerTemplate","MediaViewerController","DocumentWrapperTemplate","mediaViewerController","adjustImgSize","exports","it","TypeError","ArrayBuffer","DataView","NAME","Constructor","Prototype","NATIVE_ARRAY_BUFFER","DESCRIPTORS","classof","createNonEnumerableProperty","redefine","getPrototypeOf","wellKnownSymbol","uid","Int8Array","Int8ArrayPrototype","Uint8ClampedArray","Uint8ClampedArrayPrototype","TypedArray","TypedArrayPrototype","ObjectPrototype","isPrototypeOf","TO_STRING_TAG","TYPED_ARRAY_TAG","TYPED_ARRAY_CONSTRUCTOR","NATIVE_ARRAY_BUFFER_VIEWS","opera","TYPED_ARRAY_TAG_REQIRED","TypedArrayConstructorsList","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigIntArrayConstructorsList","BigInt64Array","BigUint64Array","isTypedArray","klass","aTypedArray","aTypedArrayConstructor","C","exportTypedArrayMethod","KEY","forced","ARRAY","TypedArrayConstructor","exportTypedArrayStaticMethod","isView","mergeSort","comparefn","middle","insertionSort","merge","llength","rlength","lindex","rindex","TO_STRING_TAG_SUPPORT","classofRaw","CORRECT_ARGUMENTS","O","tag","tryGet","callee","fails","F","definePropertyModule","createPropertyDescriptor","f","bitmap","writable","EXISTS","firefox","UA","getBuiltIn","version","userAgent","process","Deno","versions","v8","webkit","aFunction","variable","namespace","check","globalThis","toObject","store","inspectSource","set","NATIVE_WEAK_MAP","objectHas","shared","sharedKey","hiddenKeys","OBJECT_ALREADY_INITIALIZED","WeakMap","wmget","wmhas","wmset","metadata","facade","enforce","getterFor","TYPE","USE_SYMBOL_AS_UID","$Symbol","V8_VERSION","getOwnPropertySymbols","symbol","Symbol","sham","IE8_DOM_DEFINE","anObject","toPropertyKey","$defineProperty","P","Attributes","CORRECT_PROTOTYPE_GETTER","IE_PROTO","aPossiblePrototype","setter","CORRECT_SETTER","getOwnPropertyDescriptor","proto","pref","setGlobal","InternalStateModule","getInternalState","enforceInternalState","TEMPLATE","unsafe","noTargetGet","SHARED","IS_PURE","copyright","ceil","argument","toInteger","requireObjectCoercible","isSymbol","ordinaryToPrimitive","TO_PRIMITIVE","exoticToPrim","toPrimitive","postfix","random","NATIVE_SYMBOL","iterator","WellKnownSymbolsStore","createWellKnownSymbol","withoutSetter","ArrayBufferViewCore","toLength","len","relativeIndex","internalSort","FF","IE_OR_EDGE","V8","WEBKIT","nativeSort","ACCEPT_INCORRECT_ARGUMENTS","STABLE_SORT","mod","expected","arrayLength","y","getSortCompare","jsonToFormData","isJsonObject","Blob","isGlobalFormDataPresent","getDefaultFormData","convertRecursively","jsonObject","formData","parentKey","propName","showLeafArrayIndexes","FileList","toISOString","includeNullValues","initialFormData","mergedOptions","carry","objectToMerge","objectKey","defineLocale","months","monthsShort","weekdays","weekdaysShort","weekdaysMin","meridiemParse","isPM","meridiem","hours","minutes","isLower","longDateFormat","LT","LTS","L","LL","LLL","LLLL","calendar","sameDay","nextDay","nextWeek","lastDay","lastWeek","sameElse","relativeTime","future","past","ss","mm","h","hh","dd","M","MM","yy","dayOfMonthOrdinalParse","ordinal","number","week","dow","doy","pluralForm","plurals","pluralize","u","withoutSuffix","isFuture","weekdaysParseExact","hour","minute","postformat","symbolMap","preparse","numberMap","suffixes","relativeTimeWithPlural","num","forms","standalone","isFormat","day","period","w","ww","lastDigit","last2Digits","meridiemHour","monthsShortRegex","monthsParseExact","relativeTimeWithMutation","mutationTable","softMutation","mutation","lastNumber","monthsParse","monthsRegex","minWeekdaysParse","weekdaysParse","fullWeekdaysParse","shortWeekdaysParse","monthsStrictRegex","monthsShortStrictRegex","longMonthsParse","shortMonthsParse","translate","ll","lll","llll","output","plural","processRelativeTime","monthsNominativeEl","monthsGenitiveEl","momentToFormat","_monthsGenitiveEl","month","_monthsNominativeEl","calendarEl","mom","_calendarEl","monthsShortDot","invalidDate","numbersPast","numbersFuture","verbalNumber","monthsShortWithDots","monthsShortWithoutDots","weekEndings","eras","since","offset","narrow","abbr","until","eraYearOrdinalRegex","eraYearOrdinalParse","$0","$2","isUpper","eifelerRegelAppliesToNumber","units","translateSingular","special","relativeTimeWithSingular","translator","words","correctGrammaticalCase","wordKey","relativeTimeMr","monthsNominative","monthsSubjective","separator","days","numbersNouns","numberNoun","hundred","ten","one","word","numberAsNoun","hm","processHoursFunction","nominative","accusative","genitive","webpackContext","req","webpackContextResolve","__webpack_require__","urlSanitizationWhitelist","aHrefSanitizationWhitelist","stringifyField","decimalSep","isFloat","toLocaleString","quoteStrings","txtDelim","isFinite","header","fieldSep","label","c","columnOrder","addByteOrderMarker","isSpecialChar","getSpecialChar","filename","charset","csv","buildCSV","getFilename","addClass","ngCsvLoadingClass","csvHeader","csvColumnOrder","csvLabel","removeClass","msSaveOrOpenBlob","msSaveBlob"],"sourceRoot":""} \ No newline at end of file diff --git a/snippet/3.8.0/scripts/chat-fecd0807.js b/snippet/3.8.0/scripts/chat-fecd0807.js deleted file mode 100644 index 08bb36a..0000000 --- a/snippet/3.8.0/scripts/chat-fecd0807.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["chat-fecd0807"],{"./src/js/input-recorder/input-recorder.service.js":(e,t,o)=>{function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}o.d(t,{t:()=>n});class n{constructor(){i(this,"conf",{}),i(this,"recordedBlobs",[]),i(this,"mediaStream",null),i(this,"mediaRecorder",null),this.initProps()}initProps(){this.conf={},this.recordedBlobs=[],this.mediaStream=null,this.mediaRecorder=null}clear(){this.initProps()}async init(){return this.initProps(),this.initMediaDevices()}async initMediaDevices(){if(console.log("initMediaDevices"),this.initDeviceInProgress=!0,"https:"!==location.protocol&&!location.host.includes("localhost"))return void alert("https or localhost required!");const e={audio:!0,video:!1};try{try{const t=await navigator.mediaDevices.getUserMedia(e);this.mediaStream=t}catch(e){console.error("Audio device not available"),console.error(e)}}finally{this.initDeviceInProgress=!1}}startRecording(){const e={mimeType:"audio/webm;codecs=opus"};this.recordedBlobs=[];try{this.mediaRecorder=new MediaRecorder(this.mediaStream,e)}catch(t){console.log("Unable to create MediaRecorder with options Object: ",e,t);try{this.mediaRecorder=new MediaRecorder(this.mediaStream)}catch(e){return alert("MediaRecorder is not supported by this browser."),alert('');c.videoServices.push(i)}))}return e},dailymotionEmbed:function(e,a){var o=e.match(d.dailymotion);if(o){var n=i(o),r=b.calcDimensions(a);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.videoServices.push(i)}))}return e},tedEmbed:function(e,a){var o=e.match(d.ted);if(o){var n=i(o),r=b.calcDimensions(a);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.videoServices.push(i)}))}return e},dotsubEmbed:function(e,a){var o=e.match(d.dotsub);if(o){var n=i(o),r=b.calcDimensions(a);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.videoServices.push(i)}))}return e},liveleakEmbed:function(e,a){var o=e.match(d.liveleak);if(o){var n=i(o),r=b.calcDimensions(a);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.videoServices.push(i)}))}return e},ustreamEmbed:function(e,a){var o=e.match(d.ustream);if(o){var n=i(o),r=b.calcDimensions(a);angular.forEach(n,(function(e){var i=e.split("/");i.indexOf("embed")<0&&i.splice(1,0,"embed");var a=t.trustAsHtml('');c.videoServices.push(a)}))}return e}},v={encode:function(e){var t,i=(t={"&":"&",">":">","<":"<"},e.replace(/&(amp|gt|lt);/g,(function(e){return t[e]})));return i.replace(/&/gm,"")},getCode:function(e){return(e+"").replace(d.highlightCode,(function(e,t,i,a){var o=a;o=o.replace(/^([ \t]*)/g,"").replace(/[ \t]*$/g,""),o=(o=v.encode(o)).replace(/:\/\//g,"~P");var n,r=i.split("\n")[0];return r?n=hljs.highlightAuto(o,[r]):r=(n=hljs.highlightAuto(o)).language,'
'+n.value+"
"}))}};function w(e){c.video={},c.image={},c.pdf={},c.audio={},c.videoServices=[],c.audioServices=[],c.codeServices=[],c.gist=[],angular.isString(e)&&0!==e.length||(e=" ");var a,o=m(e,f).$$unwrapTrustedValue();f.video.embed&&(f.gdevAuth?b.embed(o,f).then((function(e){c.video=e})):console.error("Youtube authentication key is required to get data from youtube.")),o=f.basicVideo?b.embedBasic(o):o,o=f.audio.embed?((a=o).match(d.basicAudio)&&(c.audio.url=t.trustAsResourceUrl(RegExp.$1)),a):o,o=f.image.embed?function(e){return e.match(d.basicImage)&&(c.image.url=RegExp.$1),e}(o):o,o=f.pdf.embed?function(e){return e.match(d.pdf)&&(c.pdf.url=t.trustAsResourceUrl(RegExp.$1)),e}(o):o,o=f.tweetEmbed?function(e,a){if(!window.twttr)return console.error(new ReferenceError("twttr is not defined. Load http://platform.twitter.com/widgets.js")),data;c.tweets=[];var o=e.match(d.twitter);if(o){var n=i(o);angular.forEach(n,(function(e){var i="https://api.twitter.com/1/statuses/oembed.json?omit_script=true&&url="+e+"&maxwidth="+a.tweetOptions.maxWidth+"&hide_media="+a.tweetOptions.hideMedia+"&hide_thread="+a.tweetOptions.hideThread+"&align="+a.tweetOptions.align+"&lang="+a.tweetOptions.lang;(parseInt(angular.version.major)>=1&&parseInt(angular.version.minor)>=6?r.jsonp(t.trustAsResourceUrl(i),{callbackParam:"JSON_CALLBACK"}):r.jsonp(i+"&callback=JSON_CALLBACK")).then((function(e){c.tweets.push(e.data.html),c.tweets.length==n.length&&s((function(){twttr.widgets.load()}),10)})).catch((function(e){console.error(e)}))}))}return e}(o,f):o,o=f.twitchtvEmbed?b.twitchtvEmbed(o,f):o,o=f.dailymotionEmbed?b.dailymotionEmbed(o,f):o,o=f.tedEmbed?b.tedEmbed(o,f):o,o=f.dotsubEmbed?b.dotsubEmbed(o,f):o,o=f.liveleakEmbed?b.liveleakEmbed(o,f):o,o=f.ustreamEmbed?b.ustreamEmbed(o,f):o,o=f.soundCloudEmbed?function(e,a){var o=e.match(d.soundCloud);if(o){var n=i(o);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.videoServices.push(i)}))}return e}(o,f):o,o=f.spotifyEmbed?function(e){var a=e.match(d.spotify);if(a){var o=i(a);angular.forEach(o,(function(e){var i=t.trustAsHtml('');c.audioServices.push(i)}))}return e}(o):o,o=f.code.highlight?function(e,t){return window.hljs?(e=v.getCode(e),s((function(){if(t.code.lineNumbers){var e=h.find(".ne-code");e.length>0&&angular.forEach(e,(function(e){for(var t=angular.element(e).addClass("has-numbering"),i=t.text().split("\n").length,a=angular.element("
    ").addClass("pre-numbering"),o=1;o<=i;o++){var n=angular.element("
  • ").text(o);a.append(n)}t.parent().append(a)}))}}),20),e):(console.error(new ReferenceError("hlsj (Highlight JS is not defined.")),e)}(o,f):o,o=f.codepenEmbed?function(e,a){var o=e.match(d.codepen);if(o){var n=i(o);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.codeServices.push(i)}))}return e}(o,f):o,o=f.jsfiddleEmbed?function(e,a){var o=e.match(d.jsfiddle);if(o){var n=i(o);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.codeServices.push(i)}))}return e}(o,f):o,o=f.jsbinEmbed?function(e,a){var o=e.match(d.jsbin);if(o){var n=i(o);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.codeServices.push(i)}))}return e}(o,f):o,o=f.plunkerEmbed?function(e,a){var o=e.match(d.plunker);if(o){var n=i(o);angular.forEach(n,(function(e){var i=e.split("/")[2],o=-1===e.indexOf("?")?i:i.split("?")[0],n=t.trustAsHtml('');c.codeServices.push(n)}))}return e}(o,f):o,o=f.githubgistEmbed?function(e){var t=e.match(d.gist);if(t){var a=[];angular.forEach(t,(function(e){a.push(e.split("/")[2])})),c.gist=i(a)}return e}(o):o,o=f.ideoneEmbed?function(e,a){var o=e.match(d.ideone);if(o){var n=i(o);angular.forEach(n,(function(e){var i=t.trustAsHtml('');c.codeServices.push(i)}))}return e}(o,f):o,s((function(e){c.neText=t.trustAsHtml(e)}),0,!0,o)}f.watchEmbedData?c.$watch(_.embedData,w):w(c.$eval(_.embedData))}}}function t(e,t,i,a,r){var s=new RegExp(":("+i.join("|")+"):","gi");return function(i,l){var c,d,u,h={};if(angular.copy(r,h),o(h,l),null!=i)return"object"==typeof i?i:(angular.isNumber(i)||(i=i.toString()),h.sanitizeHtml&&(c={"&":"&",">":">","<":"<"},i=i.replace(/[&<>]/g,(function(e){return c[e]}))),h.fontSmiley&&(d=t,u=i.split(" "),angular.forEach(u,(function(e,t){var i=d[e];i&&(u[t]='&#x'+i.code+"")})),i=u.join(" ")),h.emoji&&(i=function(e,t){return e.replace(t,(function(e,t){return""}))}(i,s)),h.link&&(i=function(e,t,i,a){return e.replace(i,(function(e){var i=e;return a.test(e)||(i=n()+"//"+e),"cordova"==t?'"+e+"":''+e+""}))}(i,h.linkTarget,a.url,a.protocol)),e.trustAsHtml(i))}}function i(e){for(var t={},i=[],a=0;at,o=a?e.substr(0,t-1):e;return o=i&&a?o.substr(0,o.lastIndexOf(" ")):o,a?o+"...":o}function o(e){return angular.forEach(arguments,(function(t){t!==e&&angular.forEach(t,(function(t,i){e[i]&&e[i].constructor&&e[i].constructor===Object?o(e[i],t):e[i]=t}))})),e}function n(){return window.location.protocol.match(/https/)?"https:":"http:"}angular.module("ngEmbed",["ngSanitize"]).constant("NG_EMBED_BASIC_EMOTICONS",{":)":{text:":)",class:"smiley",code:"e60a"},":D":{text:":D",class:"happy",code:"e608"},":d":{text:":d",class:"happy",code:"e608"},":(":{text:":(",class:"sad",code:"e60e"},":/":{text:":/",class:"wondering",code:"e620"},":P":{text:":P",class:"tongue",code:"e60c"},":p":{text:":p",class:"tongue",code:"e60c"},"3:)":{text:"3:)",class:"evil",code:"e618"},"(^)":{text:"(^)",class:"thumbsup2",code:"e607"},";)":{text:";)",class:"wink",code:"e610"},":o":{text:":o",class:"shocked",code:"e61a"},"-_-":{text:"-_-",class:"neutral",code:"e61e"},"(y)":{text:"(y)",class:"thumbs-up",code:"e606"},":*":{text:":*",class:"heart",code:"e604"},"<3":{text:"<3",class:"heart",code:"e604"},"<3":{text:"<3",class:"heart",code:"e604"},"</3":{text:"</3",class:"heart-broken",code:"e605"},"
    {{video.description}}
    {{video.views}} {{video.likes}}
    ')}]).directive("ngEmbed",e).directive("neGist",(function(){return{restrict:"EA",replace:!0,template:"
    ",link:function(e,t,i){!function(e,t){var i=document.createElement("iframe");i.setAttribute("width","100%"),i.setAttribute("frameborder","0"),i.id="gist-"+t,e.appendChild(i);var a=' + + + + + + + +
    +
    + + +
    +
    + +
    + + + {{ actualTitle }} + + + + + + + +
    + +
    + + + +
    + +
    + +
    +
    + + + + + + + +
    +
    + + + + + + + + + + + + + + + diff --git a/snippet/3.8.1/scripts/app.js b/snippet/3.8.1/scripts/app.js new file mode 100644 index 0000000..7c3a8af --- /dev/null +++ b/snippet/3.8.1/scripts/app.js @@ -0,0 +1,42 @@ +/*! + * ************************************************************************* + * * * + * * xCALLY Motion - The Omnichannel Contact Center * + * * Copyright (c) Xenialab s.r.l. All Rights Reserved * + * * * + * ************************************************************************* + * * * + * * Email: info@xcally.com * + * * Website: https://www.xcally.com * + * * * + * ************************************************************************* + * * * + * * The SOFTWARE PRODUCT is protected by copyright laws and international * + * * copyright treaties, as well as other intellectual property laws and * + * * treaties. The SOFTWARE PRODUCT is licensed, not sold. * + * * * + * ************************************************************************* + */ +"use strict"; +(self["webpackChunkmotion_chat"] = self["webpackChunkmotion_chat"] || []).push([["app"],{ + +/***/ "./src/styles/app.scss": +/*!*****************************!*\ + !*** ./src/styles/app.scss ***! + \*****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }) + +}, +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ __webpack_require__.O(0, ["chat"], () => (__webpack_exec__("./src/styles/app.scss"))); +/******/ var __webpack_exports__ = __webpack_require__.O(); +/******/ } +]); +//# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/snippet/3.8.1/scripts/app.js.map b/snippet/3.8.1/scripts/app.js.map new file mode 100644 index 0000000..9b8ff55 --- /dev/null +++ b/snippet/3.8.1/scripts/app.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scripts/app.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA","sources":["webpack://motion-chat/./src/styles/app.scss?077d"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport {};"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/snippet/3.8.1/scripts/chat.js b/snippet/3.8.1/scripts/chat.js new file mode 100644 index 0000000..88f8354 --- /dev/null +++ b/snippet/3.8.1/scripts/chat.js @@ -0,0 +1,149351 @@ +(self["webpackChunkmotion_chat"] = self["webpackChunkmotion_chat"] || []).push([["chat"],{ + +/***/ "./node_modules/@flowjs/flow.js/src/flow.js": +/*!**************************************************!*\ + !*** ./node_modules/@flowjs/flow.js/src/flow.js ***! + \**************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +/* module decorator */ module = __webpack_require__.nmd(module); +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** + * @license MIT + */ +(function(window, document, undefined) {'use strict'; + if (!window || !document) { + console.warn('Flowjs needs window and document objects to work'); + return; + } + // ie10+ + var ie10plus = window.navigator.msPointerEnabled; + /** + * Flow.js is a library providing multiple simultaneous, stable and + * resumable uploads via the HTML5 File API. + * @param [opts] + * @param {number|Function} [opts.chunkSize] + * @param {bool} [opts.forceChunkSize] + * @param {number} [opts.simultaneousUploads] + * @param {bool} [opts.singleFile] + * @param {string} [opts.fileParameterName] + * @param {number} [opts.progressCallbacksInterval] + * @param {number} [opts.speedSmoothingFactor] + * @param {Object|Function} [opts.query] + * @param {Object|Function} [opts.headers] + * @param {bool} [opts.withCredentials] + * @param {Function} [opts.preprocess] + * @param {string} [opts.method] + * @param {string|Function} [opts.testMethod] + * @param {string|Function} [opts.uploadMethod] + * @param {bool} [opts.prioritizeFirstAndLastChunk] + * @param {bool} [opts.allowDuplicateUploads] + * @param {string|Function} [opts.target] + * @param {number} [opts.maxChunkRetries] + * @param {number} [opts.chunkRetryInterval] + * @param {Array.} [opts.permanentErrors] + * @param {Array.} [opts.successStatuses] + * @param {Function} [opts.initFileFn] + * @param {Function} [opts.readFileFn] + * @param {Function} [opts.generateUniqueIdentifier] + * @constructor + */ + function Flow(opts) { + /** + * Supported by browser? + * @type {boolean} + */ + this.support = ( + typeof File !== 'undefined' && + typeof Blob !== 'undefined' && + typeof FileList !== 'undefined' && + ( + !!Blob.prototype.slice || !!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice || + false + ) // slicing files support + ); + + if (!this.support) { + return ; + } + + /** + * Check if directory upload is supported + * @type {boolean} + */ + this.supportDirectory = ( + /Chrome/.test(window.navigator.userAgent) || + /Firefox/.test(window.navigator.userAgent) || + /Edge/.test(window.navigator.userAgent) + ); + + /** + * List of FlowFile objects + * @type {Array.} + */ + this.files = []; + + /** + * Default options for flow.js + * @type {Object} + */ + this.defaults = { + chunkSize: 1024 * 1024, + forceChunkSize: false, + simultaneousUploads: 3, + singleFile: false, + fileParameterName: 'file', + progressCallbacksInterval: 500, + speedSmoothingFactor: 0.1, + query: {}, + headers: {}, + withCredentials: false, + preprocess: null, + changeRawDataBeforeSend: null, + method: 'multipart', + testMethod: 'GET', + uploadMethod: 'POST', + prioritizeFirstAndLastChunk: false, + allowDuplicateUploads: false, + target: '/', + testChunks: true, + generateUniqueIdentifier: null, + maxChunkRetries: 0, + chunkRetryInterval: null, + permanentErrors: [404, 413, 415, 500, 501], + successStatuses: [200, 201, 202], + onDropStopPropagation: false, + initFileFn: null, + readFileFn: webAPIFileRead + }; + + /** + * Current options + * @type {Object} + */ + this.opts = {}; + + /** + * List of events: + * key stands for event name + * value array list of callbacks + * @type {} + */ + this.events = {}; + + var $ = this; + + /** + * On drop event + * @function + * @param {MouseEvent} event + */ + this.onDrop = function (event) { + if ($.opts.onDropStopPropagation) { + event.stopPropagation(); + } + event.preventDefault(); + var dataTransfer = event.dataTransfer; + if (dataTransfer.items && dataTransfer.items[0] && + dataTransfer.items[0].webkitGetAsEntry) { + $.webkitReadDataTransfer(event); + } else { + $.addFiles(dataTransfer.files, event); + } + }; + + /** + * Prevent default + * @function + * @param {MouseEvent} event + */ + this.preventEvent = function (event) { + event.preventDefault(); + }; + + + /** + * Current options + * @type {Object} + */ + this.opts = Flow.extend({}, this.defaults, opts || {}); + + } + + Flow.prototype = { + /** + * Set a callback for an event, possible events: + * fileSuccess(file), fileProgress(file), fileAdded(file, event), + * fileRemoved(file), fileRetry(file), fileError(file, message), + * complete(), progress(), error(message, file), pause() + * @function + * @param {string} event + * @param {Function} callback + */ + on: function (event, callback) { + event = event.toLowerCase(); + if (!this.events.hasOwnProperty(event)) { + this.events[event] = []; + } + this.events[event].push(callback); + }, + + /** + * Remove event callback + * @function + * @param {string} [event] removes all events if not specified + * @param {Function} [fn] removes all callbacks of event if not specified + */ + off: function (event, fn) { + if (event !== undefined) { + event = event.toLowerCase(); + if (fn !== undefined) { + if (this.events.hasOwnProperty(event)) { + arrayRemove(this.events[event], fn); + } + } else { + delete this.events[event]; + } + } else { + this.events = {}; + } + }, + + /** + * Fire an event + * @function + * @param {string} event event name + * @param {...} args arguments of a callback + * @return {bool} value is false if at least one of the event handlers which handled this event + * returned false. Otherwise it returns true. + */ + fire: function (event, args) { + // `arguments` is an object, not array, in FF, so: + args = Array.prototype.slice.call(arguments); + event = event.toLowerCase(); + var preventDefault = false; + if (this.events.hasOwnProperty(event)) { + each(this.events[event], function (callback) { + preventDefault = callback.apply(this, args.slice(1)) === false || preventDefault; + }, this); + } + if (event != 'catchall') { + args.unshift('catchAll'); + preventDefault = this.fire.apply(this, args) === false || preventDefault; + } + return !preventDefault; + }, + + /** + * Read webkit dataTransfer object + * @param event + */ + webkitReadDataTransfer: function (event) { + var $ = this; + var queue = event.dataTransfer.items.length; + var files = []; + each(event.dataTransfer.items, function (item) { + var entry = item.webkitGetAsEntry(); + if (!entry) { + decrement(); + return ; + } + if (entry.isFile) { + // due to a bug in Chrome's File System API impl - #149735 + fileReadSuccess(item.getAsFile(), entry.fullPath); + } else { + readDirectory(entry.createReader()); + } + }); + function readDirectory(reader) { + reader.readEntries(function (entries) { + if (entries.length) { + queue += entries.length; + each(entries, function(entry) { + if (entry.isFile) { + var fullPath = entry.fullPath; + entry.file(function (file) { + fileReadSuccess(file, fullPath); + }, readError); + } else if (entry.isDirectory) { + readDirectory(entry.createReader()); + } + }); + readDirectory(reader); + } else { + decrement(); + } + }, readError); + } + function fileReadSuccess(file, fullPath) { + // relative path should not start with "/" + file.relativePath = fullPath.substring(1); + files.push(file); + decrement(); + } + function readError(fileError) { + decrement(); + throw fileError; + } + function decrement() { + if (--queue == 0) { + $.addFiles(files, event); + } + } + }, + + /** + * Generate unique identifier for a file + * @function + * @param {FlowFile} file + * @returns {string} + */ + generateUniqueIdentifier: function (file) { + var custom = this.opts.generateUniqueIdentifier; + if (typeof custom === 'function') { + return custom(file); + } + // Some confusion in different versions of Firefox + var relativePath = file.relativePath || file.webkitRelativePath || file.fileName || file.name; + return file.size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''); + }, + + /** + * Upload next chunk from the queue + * @function + * @returns {boolean} + * @private + */ + uploadNextChunk: function (preventEvents) { + // In some cases (such as videos) it's really handy to upload the first + // and last chunk of a file quickly; this let's the server check the file's + // metadata and determine if there's even a point in continuing. + var found = false; + if (this.opts.prioritizeFirstAndLastChunk) { + each(this.files, function (file) { + if (!file.paused && file.chunks.length && + file.chunks[0].status() === 'pending') { + file.chunks[0].send(); + found = true; + return false; + } + if (!file.paused && file.chunks.length > 1 && + file.chunks[file.chunks.length - 1].status() === 'pending') { + file.chunks[file.chunks.length - 1].send(); + found = true; + return false; + } + }); + if (found) { + return found; + } + } + + // Now, simply look for the next, best thing to upload + each(this.files, function (file) { + if (!file.paused) { + each(file.chunks, function (chunk) { + if (chunk.status() === 'pending') { + chunk.send(); + found = true; + return false; + } + }); + } + if (found) { + return false; + } + }); + if (found) { + return true; + } + + // The are no more outstanding chunks to upload, check is everything is done + var outstanding = false; + each(this.files, function (file) { + if (!file.isComplete()) { + outstanding = true; + return false; + } + }); + if (!outstanding && !preventEvents) { + // All chunks have been uploaded, complete + async(function () { + this.fire('complete'); + }, this); + } + return false; + }, + + + /** + * Assign a browse action to one or more DOM nodes. + * @function + * @param {Element|Array.} domNodes + * @param {boolean} isDirectory Pass in true to allow directories to + * @param {boolean} singleFile prevent multi file upload + * @param {Object} attributes set custom attributes: + * http://www.w3.org/TR/html-markup/input.file.html#input.file-attributes + * eg: accept: 'image/*' + * be selected (Chrome only). + */ + assignBrowse: function (domNodes, isDirectory, singleFile, attributes) { + if (domNodes instanceof Element) { + domNodes = [domNodes]; + } + + each(domNodes, function (domNode) { + var input; + if (domNode.tagName === 'INPUT' && domNode.type === 'file') { + input = domNode; + } else { + input = document.createElement('input'); + input.setAttribute('type', 'file'); + // display:none - not working in opera 12 + extend(input.style, { + visibility: 'hidden', + position: 'absolute', + width: '1px', + height: '1px' + }); + // for opera 12 browser, input must be assigned to a document + domNode.appendChild(input); + // https://developer.mozilla.org/en/using_files_from_web_applications) + // event listener is executed two times + // first one - original mouse click event + // second - input.click(), input is inside domNode + domNode.addEventListener('click', function() { + input.click(); + }, false); + } + if (!this.opts.singleFile && !singleFile) { + input.setAttribute('multiple', 'multiple'); + } + if (isDirectory) { + input.setAttribute('webkitdirectory', 'webkitdirectory'); + } + each(attributes, function (value, key) { + input.setAttribute(key, value); + }); + // When new files are added, simply append them to the overall list + var $ = this; + input.addEventListener('change', function (e) { + if (e.target.value) { + $.addFiles(e.target.files, e); + e.target.value = ''; + } + }, false); + }, this); + }, + + /** + * Assign one or more DOM nodes as a drop target. + * @function + * @param {Element|Array.} domNodes + */ + assignDrop: function (domNodes) { + if (typeof domNodes.length === 'undefined') { + domNodes = [domNodes]; + } + each(domNodes, function (domNode) { + domNode.addEventListener('dragover', this.preventEvent, false); + domNode.addEventListener('dragenter', this.preventEvent, false); + domNode.addEventListener('drop', this.onDrop, false); + }, this); + }, + + /** + * Un-assign drop event from DOM nodes + * @function + * @param domNodes + */ + unAssignDrop: function (domNodes) { + if (typeof domNodes.length === 'undefined') { + domNodes = [domNodes]; + } + each(domNodes, function (domNode) { + domNode.removeEventListener('dragover', this.preventEvent); + domNode.removeEventListener('dragenter', this.preventEvent); + domNode.removeEventListener('drop', this.onDrop); + }, this); + }, + + /** + * Returns a boolean indicating whether or not the instance is currently + * uploading anything. + * @function + * @returns {boolean} + */ + isUploading: function () { + var uploading = false; + each(this.files, function (file) { + if (file.isUploading()) { + uploading = true; + return false; + } + }); + return uploading; + }, + + /** + * should upload next chunk + * @function + * @returns {boolean|number} + */ + _shouldUploadNext: function () { + var num = 0; + var should = true; + var simultaneousUploads = this.opts.simultaneousUploads; + each(this.files, function (file) { + each(file.chunks, function(chunk) { + if (chunk.status() === 'uploading') { + num++; + if (num >= simultaneousUploads) { + should = false; + return false; + } + } + }); + }); + // if should is true then return uploading chunks's length + return should && num; + }, + + /** + * Start or resume uploading. + * @function + */ + upload: function () { + // Make sure we don't start too many uploads at once + var ret = this._shouldUploadNext(); + if (ret === false) { + return; + } + // Kick off the queue + this.fire('uploadStart'); + var started = false; + for (var num = 1; num <= this.opts.simultaneousUploads - ret; num++) { + started = this.uploadNextChunk(true) || started; + } + if (!started) { + async(function () { + this.fire('complete'); + }, this); + } + }, + + /** + * Resume uploading. + * @function + */ + resume: function () { + each(this.files, function (file) { + if (!file.isComplete()) { + file.resume(); + } + }); + }, + + /** + * Pause uploading. + * @function + */ + pause: function () { + each(this.files, function (file) { + file.pause(); + }); + }, + + /** + * Cancel upload of all FlowFile objects and remove them from the list. + * @function + */ + cancel: function () { + for (var i = this.files.length - 1; i >= 0; i--) { + this.files[i].cancel(); + } + }, + + /** + * Returns a number between 0 and 1 indicating the current upload progress + * of all files. + * @function + * @returns {number} + */ + progress: function () { + var totalDone = 0; + var totalSize = 0; + // Resume all chunks currently being uploaded + each(this.files, function (file) { + totalDone += file.progress() * file.size; + totalSize += file.size; + }); + return totalSize > 0 ? totalDone / totalSize : 0; + }, + + /** + * Add a HTML5 File object to the list of files. + * @function + * @param {File} file + * @param {Event} [event] event is optional + */ + addFile: function (file, event) { + this.addFiles([file], event); + }, + + /** + * Add a HTML5 File object to the list of files. + * @function + * @param {FileList|Array} fileList + * @param {Event} [event] event is optional + */ + addFiles: function (fileList, event) { + var files = []; + each(fileList, function (file) { + // https://github.com/flowjs/flow.js/issues/55 + if ((!ie10plus || ie10plus && file.size > 0) && !(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.'))) { + var uniqueIdentifier = this.generateUniqueIdentifier(file); + if (this.opts.allowDuplicateUploads || !this.getFromUniqueIdentifier(uniqueIdentifier)) { + var f = new FlowFile(this, file, uniqueIdentifier); + if (this.fire('fileAdded', f, event)) { + files.push(f); + } + } + } + }, this); + if (this.fire('filesAdded', files, event)) { + each(files, function (file) { + if (this.opts.singleFile && this.files.length > 0) { + this.removeFile(this.files[0]); + } + this.files.push(file); + }, this); + this.fire('filesSubmitted', files, event); + } + }, + + + /** + * Cancel upload of a specific FlowFile object from the list. + * @function + * @param {FlowFile} file + */ + removeFile: function (file) { + for (var i = this.files.length - 1; i >= 0; i--) { + if (this.files[i] === file) { + this.files.splice(i, 1); + file.abort(); + this.fire('fileRemoved', file); + } + } + }, + + /** + * Look up a FlowFile object by its unique identifier. + * @function + * @param {string} uniqueIdentifier + * @returns {boolean|FlowFile} false if file was not found + */ + getFromUniqueIdentifier: function (uniqueIdentifier) { + var ret = false; + each(this.files, function (file) { + if (file.uniqueIdentifier === uniqueIdentifier) { + ret = file; + } + }); + return ret; + }, + + /** + * Returns the total size of all files in bytes. + * @function + * @returns {number} + */ + getSize: function () { + var totalSize = 0; + each(this.files, function (file) { + totalSize += file.size; + }); + return totalSize; + }, + + /** + * Returns the total size uploaded of all files in bytes. + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = 0; + each(this.files, function (file) { + size += file.sizeUploaded(); + }); + return size; + }, + + /** + * Returns remaining time to upload all files in seconds. Accuracy is based on average speed. + * If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY` + * @function + * @returns {number} + */ + timeRemaining: function () { + var sizeDelta = 0; + var averageSpeed = 0; + each(this.files, function (file) { + if (!file.paused && !file.error) { + sizeDelta += file.size - file.sizeUploaded(); + averageSpeed += file.averageSpeed; + } + }); + if (sizeDelta && !averageSpeed) { + return Number.POSITIVE_INFINITY; + } + if (!sizeDelta && !averageSpeed) { + return 0; + } + return Math.floor(sizeDelta / averageSpeed); + } + }; + + + + + + + /** + * FlowFile class + * @name FlowFile + * @param {Flow} flowObj + * @param {File} file + * @param {string} uniqueIdentifier + * @constructor + */ + function FlowFile(flowObj, file, uniqueIdentifier) { + + /** + * Reference to parent Flow instance + * @type {Flow} + */ + this.flowObj = flowObj; + + /** + * Used to store the bytes read + * @type {Blob|string} + */ + this.bytes = null; + + /** + * Reference to file + * @type {File} + */ + this.file = file; + + /** + * File name. Some confusion in different versions of Firefox + * @type {string} + */ + this.name = file.fileName || file.name; + + /** + * File size + * @type {number} + */ + this.size = file.size; + + /** + * Relative file path + * @type {string} + */ + this.relativePath = file.relativePath || file.webkitRelativePath || this.name; + + /** + * File unique identifier + * @type {string} + */ + this.uniqueIdentifier = (uniqueIdentifier === undefined ? flowObj.generateUniqueIdentifier(file) : uniqueIdentifier); + + /** + * Size of Each Chunk + * @type {number} + */ + this.chunkSize = 0; + + /** + * List of chunks + * @type {Array.} + */ + this.chunks = []; + + /** + * Indicated if file is paused + * @type {boolean} + */ + this.paused = false; + + /** + * Indicated if file has encountered an error + * @type {boolean} + */ + this.error = false; + + /** + * Average upload speed + * @type {number} + */ + this.averageSpeed = 0; + + /** + * Current upload speed + * @type {number} + */ + this.currentSpeed = 0; + + /** + * Date then progress was called last time + * @type {number} + * @private + */ + this._lastProgressCallback = Date.now(); + + /** + * Previously uploaded file size + * @type {number} + * @private + */ + this._prevUploadedSize = 0; + + /** + * Holds previous progress + * @type {number} + * @private + */ + this._prevProgress = 0; + + this.bootstrap(); + } + + FlowFile.prototype = { + /** + * Update speed parameters + * @link http://stackoverflow.com/questions/2779600/how-to-estimate-download-time-remaining-accurately + * @function + */ + measureSpeed: function () { + var timeSpan = Date.now() - this._lastProgressCallback; + if (!timeSpan) { + return ; + } + var smoothingFactor = this.flowObj.opts.speedSmoothingFactor; + var uploaded = this.sizeUploaded(); + // Prevent negative upload speed after file upload resume + this.currentSpeed = Math.max((uploaded - this._prevUploadedSize) / timeSpan * 1000, 0); + this.averageSpeed = smoothingFactor * this.currentSpeed + (1 - smoothingFactor) * this.averageSpeed; + this._prevUploadedSize = uploaded; + }, + + /** + * For internal usage only. + * Callback when something happens within the chunk. + * @function + * @param {FlowChunk} chunk + * @param {string} event can be 'progress', 'success', 'error' or 'retry' + * @param {string} [message] + */ + chunkEvent: function (chunk, event, message) { + switch (event) { + case 'progress': + if (Date.now() - this._lastProgressCallback < + this.flowObj.opts.progressCallbacksInterval) { + break; + } + this.measureSpeed(); + this.flowObj.fire('fileProgress', this, chunk); + this.flowObj.fire('progress'); + this._lastProgressCallback = Date.now(); + break; + case 'error': + this.error = true; + this.abort(true); + this.flowObj.fire('fileError', this, message, chunk); + this.flowObj.fire('error', message, this, chunk); + break; + case 'success': + if (this.error) { + return; + } + this.measureSpeed(); + this.flowObj.fire('fileProgress', this, chunk); + this.flowObj.fire('progress'); + this._lastProgressCallback = Date.now(); + if (this.isComplete()) { + this.currentSpeed = 0; + this.averageSpeed = 0; + this.flowObj.fire('fileSuccess', this, message, chunk); + } + break; + case 'retry': + this.flowObj.fire('fileRetry', this, chunk); + break; + } + }, + + /** + * Pause file upload + * @function + */ + pause: function() { + this.paused = true; + this.abort(); + }, + + /** + * Resume file upload + * @function + */ + resume: function() { + this.paused = false; + this.flowObj.upload(); + }, + + /** + * Abort current upload + * @function + */ + abort: function (reset) { + this.currentSpeed = 0; + this.averageSpeed = 0; + var chunks = this.chunks; + if (reset) { + this.chunks = []; + } + each(chunks, function (c) { + if (c.status() === 'uploading') { + c.abort(); + this.flowObj.uploadNextChunk(); + } + }, this); + }, + + /** + * Cancel current upload and remove from a list + * @function + */ + cancel: function () { + this.flowObj.removeFile(this); + }, + + /** + * Retry aborted file upload + * @function + */ + retry: function () { + this.bootstrap(); + this.flowObj.upload(); + }, + + /** + * Clear current chunks and slice file again + * @function + */ + bootstrap: function () { + if (typeof this.flowObj.opts.initFileFn === "function") { + this.flowObj.opts.initFileFn(this); + } + + this.abort(true); + this.error = false; + // Rebuild stack of chunks from file + this._prevProgress = 0; + var round = this.flowObj.opts.forceChunkSize ? Math.ceil : Math.floor; + this.chunkSize = evalOpts(this.flowObj.opts.chunkSize, this); + var chunks = Math.max( + round(this.size / this.chunkSize), 1 + ); + for (var offset = 0; offset < chunks; offset++) { + this.chunks.push( + new FlowChunk(this.flowObj, this, offset) + ); + } + }, + + /** + * Get current upload progress status + * @function + * @returns {number} from 0 to 1 + */ + progress: function () { + if (this.error) { + return 1; + } + if (this.chunks.length === 1) { + this._prevProgress = Math.max(this._prevProgress, this.chunks[0].progress()); + return this._prevProgress; + } + // Sum up progress across everything + var bytesLoaded = 0; + each(this.chunks, function (c) { + // get chunk progress relative to entire file + bytesLoaded += c.progress() * (c.endByte - c.startByte); + }); + var percent = bytesLoaded / this.size; + // We don't want to lose percentages when an upload is paused + this._prevProgress = Math.max(this._prevProgress, percent > 0.9999 ? 1 : percent); + return this._prevProgress; + }, + + /** + * Indicates if file is being uploaded at the moment + * @function + * @returns {boolean} + */ + isUploading: function () { + var uploading = false; + each(this.chunks, function (chunk) { + if (chunk.status() === 'uploading') { + uploading = true; + return false; + } + }); + return uploading; + }, + + /** + * Indicates if file is has finished uploading and received a response + * @function + * @returns {boolean} + */ + isComplete: function () { + var outstanding = false; + each(this.chunks, function (chunk) { + var status = chunk.status(); + if (status === 'pending' || status === 'uploading' || status === 'reading' || chunk.preprocessState === 1 || chunk.readState === 1) { + outstanding = true; + return false; + } + }); + return !outstanding; + }, + + /** + * Count total size uploaded + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = 0; + each(this.chunks, function (chunk) { + size += chunk.sizeUploaded(); + }); + return size; + }, + + /** + * Returns remaining time to finish upload file in seconds. Accuracy is based on average speed. + * If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY` + * @function + * @returns {number} + */ + timeRemaining: function () { + if (this.paused || this.error) { + return 0; + } + var delta = this.size - this.sizeUploaded(); + if (delta && !this.averageSpeed) { + return Number.POSITIVE_INFINITY; + } + if (!delta && !this.averageSpeed) { + return 0; + } + return Math.floor(delta / this.averageSpeed); + }, + + /** + * Get file type + * @function + * @returns {string} + */ + getType: function () { + return this.file.type && this.file.type.split('/')[1]; + }, + + /** + * Get file extension + * @function + * @returns {string} + */ + getExtension: function () { + return this.name.substr((~-this.name.lastIndexOf(".") >>> 0) + 2).toLowerCase(); + } + }; + + /** + * Default read function using the webAPI + * + * @function webAPIFileRead(fileObj, startByte, endByte, fileType, chunk) + * + */ + function webAPIFileRead(fileObj, startByte, endByte, fileType, chunk) { + var function_name = 'slice'; + + if (fileObj.file.slice) + function_name = 'slice'; + else if (fileObj.file.mozSlice) + function_name = 'mozSlice'; + else if (fileObj.file.webkitSlice) + function_name = 'webkitSlice'; + + chunk.readFinished(fileObj.file[function_name](startByte, endByte, fileType)); + } + + + /** + * Class for storing a single chunk + * @name FlowChunk + * @param {Flow} flowObj + * @param {FlowFile} fileObj + * @param {number} offset + * @constructor + */ + function FlowChunk(flowObj, fileObj, offset) { + + /** + * Reference to parent flow object + * @type {Flow} + */ + this.flowObj = flowObj; + + /** + * Reference to parent FlowFile object + * @type {FlowFile} + */ + this.fileObj = fileObj; + + /** + * File offset + * @type {number} + */ + this.offset = offset; + + /** + * Indicates if chunk existence was checked on the server + * @type {boolean} + */ + this.tested = false; + + /** + * Number of retries performed + * @type {number} + */ + this.retries = 0; + + /** + * Pending retry + * @type {boolean} + */ + this.pendingRetry = false; + + /** + * Preprocess state + * @type {number} 0 = unprocessed, 1 = processing, 2 = finished + */ + this.preprocessState = 0; + + /** + * Read state + * @type {number} 0 = not read, 1 = reading, 2 = finished + */ + this.readState = 0; + + + /** + * Bytes transferred from total request size + * @type {number} + */ + this.loaded = 0; + + /** + * Total request size + * @type {number} + */ + this.total = 0; + + /** + * Size of a chunk + * @type {number} + */ + this.chunkSize = this.fileObj.chunkSize; + + /** + * Chunk start byte in a file + * @type {number} + */ + this.startByte = this.offset * this.chunkSize; + + /** + * A specific filename for this chunk which otherwise default to the main name + * @type {string} + */ + this.filename = null; + + /** + * Compute the endbyte in a file + * + */ + this.computeEndByte = function() { + var endByte = Math.min(this.fileObj.size, (this.offset + 1) * this.chunkSize); + if (this.fileObj.size - endByte < this.chunkSize && !this.flowObj.opts.forceChunkSize) { + // The last chunk will be bigger than the chunk size, + // but less than 2 * this.chunkSize + endByte = this.fileObj.size; + } + return endByte; + } + + /** + * Chunk end byte in a file + * @type {number} + */ + this.endByte = this.computeEndByte(); + + /** + * XMLHttpRequest + * @type {XMLHttpRequest} + */ + this.xhr = null; + + var $ = this; + + /** + * Send chunk event + * @param event + * @param {...} args arguments of a callback + */ + this.event = function (event, args) { + args = Array.prototype.slice.call(arguments); + args.unshift($); + $.fileObj.chunkEvent.apply($.fileObj, args); + }; + /** + * Catch progress event + * @param {ProgressEvent} event + */ + this.progressHandler = function(event) { + if (event.lengthComputable) { + $.loaded = event.loaded ; + $.total = event.total; + } + $.event('progress', event); + }; + + /** + * Catch test event + * @param {Event} event + */ + this.testHandler = function(event) { + var status = $.status(true); + if (status === 'error') { + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (status === 'success') { + $.tested = true; + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (!$.fileObj.paused) { + // Error might be caused by file pause method + // Chunks does not exist on the server side + $.tested = true; + $.send(); + } + }; + + /** + * Upload has stopped + * @param {Event} event + */ + this.doneHandler = function(event) { + var status = $.status(); + if (status === 'success' || status === 'error') { + delete this.data; + $.event(status, $.message()); + $.flowObj.uploadNextChunk(); + } else if (!$.fileObj.paused) { + $.event('retry', $.message()); + $.pendingRetry = true; + $.abort(); + $.retries++; + var retryInterval = $.flowObj.opts.chunkRetryInterval; + if (retryInterval !== null) { + setTimeout(function () { + $.send(); + }, retryInterval); + } else { + $.send(); + } + } + }; + } + + FlowChunk.prototype = { + /** + * Get params for a request + * @function + */ + getParams: function () { + return { + flowChunkNumber: this.offset + 1, + flowChunkSize: this.chunkSize, + flowCurrentChunkSize: this.endByte - this.startByte, + flowTotalSize: this.fileObj.size, + flowIdentifier: this.fileObj.uniqueIdentifier, + flowFilename: this.fileObj.name, + flowRelativePath: this.fileObj.relativePath, + flowTotalChunks: this.fileObj.chunks.length + }; + }, + + /** + * Get target option with query params + * @function + * @param params + * @returns {string} + */ + getTarget: function(target, params){ + if (params.length == 0) { + return target; + } + + if(target.indexOf('?') < 0) { + target += '?'; + } else { + target += '&'; + } + return target + params.join('&'); + }, + + /** + * Makes a GET request without any data to see if the chunk has already + * been uploaded in a previous session + * @function + */ + test: function () { + // Set up request and listen for event + this.xhr = new XMLHttpRequest(); + this.xhr.addEventListener("load", this.testHandler, false); + this.xhr.addEventListener("error", this.testHandler, false); + var testMethod = evalOpts(this.flowObj.opts.testMethod, this.fileObj, this); + var data = this.prepareXhrRequest(testMethod, true); + this.xhr.send(data); + }, + + /** + * Finish preprocess state + * @function + */ + preprocessFinished: function () { + // Re-compute the endByte after the preprocess function to allow an + // implementer of preprocess to set the fileObj size + this.endByte = this.computeEndByte(); + + this.preprocessState = 2; + this.send(); + }, + + /** + * Finish read state + * @function + */ + readFinished: function (bytes) { + this.readState = 2; + this.bytes = bytes; + this.send(); + }, + + + /** + * Uploads the actual data in a POST call + * @function + */ + send: function () { + var preprocess = this.flowObj.opts.preprocess; + var read = this.flowObj.opts.readFileFn; + if (typeof preprocess === 'function') { + switch (this.preprocessState) { + case 0: + this.preprocessState = 1; + preprocess(this); + return; + case 1: + return; + } + } + switch (this.readState) { + case 0: + this.readState = 1; + read(this.fileObj, this.startByte, this.endByte, this.fileObj.file.type, this); + return; + case 1: + return; + } + if (this.flowObj.opts.testChunks && !this.tested) { + this.test(); + return; + } + + this.loaded = 0; + this.total = 0; + this.pendingRetry = false; + + // Set up request and listen for event + this.xhr = new XMLHttpRequest(); + this.xhr.upload.addEventListener('progress', this.progressHandler, false); + this.xhr.addEventListener("load", this.doneHandler, false); + this.xhr.addEventListener("error", this.doneHandler, false); + + var uploadMethod = evalOpts(this.flowObj.opts.uploadMethod, this.fileObj, this); + var data = this.prepareXhrRequest(uploadMethod, false, this.flowObj.opts.method, this.bytes); + var changeRawDataBeforeSend = this.flowObj.opts.changeRawDataBeforeSend; + if (typeof changeRawDataBeforeSend === 'function') { + data = changeRawDataBeforeSend(this, data); + } + this.xhr.send(data); + }, + + /** + * Abort current xhr request + * @function + */ + abort: function () { + // Abort and reset + var xhr = this.xhr; + this.xhr = null; + if (xhr) { + xhr.abort(); + } + }, + + /** + * Retrieve current chunk upload status + * @function + * @returns {string} 'pending', 'uploading', 'success', 'error' + */ + status: function (isTest) { + if (this.readState === 1) { + return 'reading'; + } else if (this.pendingRetry || this.preprocessState === 1) { + // if pending retry then that's effectively the same as actively uploading, + // there might just be a slight delay before the retry starts + return 'uploading'; + } else if (!this.xhr) { + return 'pending'; + } else if (this.xhr.readyState < 4) { + // Status is really 'OPENED', 'HEADERS_RECEIVED' + // or 'LOADING' - meaning that stuff is happening + return 'uploading'; + } else { + if (this.flowObj.opts.successStatuses.indexOf(this.xhr.status) > -1) { + // HTTP 200, perfect + // HTTP 202 Accepted - The request has been accepted for processing, but the processing has not been completed. + return 'success'; + } else if (this.flowObj.opts.permanentErrors.indexOf(this.xhr.status) > -1 || + !isTest && this.retries >= this.flowObj.opts.maxChunkRetries) { + // HTTP 413/415/500/501, permanent error + return 'error'; + } else { + // this should never happen, but we'll reset and queue a retry + // a likely case for this would be 503 service unavailable + this.abort(); + return 'pending'; + } + } + }, + + /** + * Get response from xhr request + * @function + * @returns {String} + */ + message: function () { + return this.xhr ? this.xhr.responseText : ''; + }, + + /** + * Get upload progress + * @function + * @returns {number} + */ + progress: function () { + if (this.pendingRetry) { + return 0; + } + var s = this.status(); + if (s === 'success' || s === 'error') { + return 1; + } else if (s === 'pending') { + return 0; + } else { + return this.total > 0 ? this.loaded / this.total : 0; + } + }, + + /** + * Count total size uploaded + * @function + * @returns {number} + */ + sizeUploaded: function () { + var size = this.endByte - this.startByte; + // can't return only chunk.loaded value, because it is bigger than chunk size + if (this.status() !== 'success') { + size = this.progress() * size; + } + return size; + }, + + /** + * Prepare Xhr request. Set query, headers and data + * @param {string} method GET or POST + * @param {bool} isTest is this a test request + * @param {string} [paramsMethod] octet or form + * @param {Blob} [blob] to send + * @returns {FormData|Blob|Null} data to send + */ + prepareXhrRequest: function(method, isTest, paramsMethod, blob) { + // Add data from the query options + var query = evalOpts(this.flowObj.opts.query, this.fileObj, this, isTest); + query = extend(query || {}, this.getParams()); + + var target = evalOpts(this.flowObj.opts.target, this.fileObj, this, isTest); + var data = null; + if (method === 'GET' || paramsMethod === 'octet') { + // Add data from the query options + var params = []; + each(query, function (v, k) { + params.push([encodeURIComponent(k), encodeURIComponent(v)].join('=')); + }); + target = this.getTarget(target, params); + data = blob || null; + } else { + // Add data from the query options + data = new FormData(); + each(query, function (v, k) { + data.append(k, v); + }); + if (typeof blob !== "undefined") { + data.append(this.flowObj.opts.fileParameterName, blob, this.filename || this.fileObj.file.name); + } + } + + this.xhr.open(method, target, true); + this.xhr.withCredentials = this.flowObj.opts.withCredentials; + + // Add data from header options + each(evalOpts(this.flowObj.opts.headers, this.fileObj, this, isTest), function (v, k) { + this.xhr.setRequestHeader(k, v); + }, this); + + return data; + } + }; + + /** + * Remove value from array + * @param array + * @param value + */ + function arrayRemove(array, value) { + var index = array.indexOf(value); + if (index > -1) { + array.splice(index, 1); + } + } + + /** + * If option is a function, evaluate it with given params + * @param {*} data + * @param {...} args arguments of a callback + * @returns {*} + */ + function evalOpts(data, args) { + if (typeof data === "function") { + // `arguments` is an object, not array, in FF, so: + args = Array.prototype.slice.call(arguments); + data = data.apply(null, args.slice(1)); + } + return data; + } + Flow.evalOpts = evalOpts; + + /** + * Execute function asynchronously + * @param fn + * @param context + */ + function async(fn, context) { + setTimeout(fn.bind(context), 0); + } + + /** + * Extends the destination object `dst` by copying all of the properties from + * the `src` object(s) to `dst`. You can specify multiple `src` objects. + * @function + * @param {Object} dst Destination object. + * @param {...Object} src Source object(s). + * @returns {Object} Reference to `dst`. + */ + function extend(dst, src) { + each(arguments, function(obj) { + if (obj !== dst) { + each(obj, function(value, key){ + dst[key] = value; + }); + } + }); + return dst; + } + Flow.extend = extend; + + /** + * Iterate each element of an object + * @function + * @param {Array|Object} obj object or an array to iterate + * @param {Function} callback first argument is a value and second is a key. + * @param {Object=} context Object to become context (`this`) for the iterator function. + */ + function each(obj, callback, context) { + if (!obj) { + return ; + } + var key; + // Is Array? + // Array.isArray won't work, not only arrays can be iterated by index https://github.com/flowjs/ng-flow/issues/236# + if (typeof(obj.length) !== 'undefined') { + for (key = 0; key < obj.length; key++) { + if (callback.call(context, obj[key], key) === false) { + return ; + } + } + } else { + for (key in obj) { + if (obj.hasOwnProperty(key) && callback.call(context, obj[key], key) === false) { + return ; + } + } + } + } + Flow.each = each; + + /** + * FlowFile constructor + * @type {FlowFile} + */ + Flow.FlowFile = FlowFile; + + /** + * FlowFile constructor + * @type {FlowChunk} + */ + Flow.FlowChunk = FlowChunk; + + /** + * Library version + * @type {string} + */ + Flow.version = '<%= version %>'; + + if ( true && module && typeof module.exports === "object" ) { + // Expose Flow as module.exports in loaders that implement the Node + // module pattern (including browserify). Do not create the global, since + // the user will be storing it themselves locally, and globals are frowned + // upon in the Node module world. + module.exports = Flow; + } else { + // Otherwise expose Flow to the global object as usual + window.Flow = Flow; + + // Register as a named AMD module, since Flow can be concatenated with other + // files that may use define, but not via a proper concatenation script that + // understands anonymous AMD modules. A named AMD is safest and most robust + // way to register. Lowercase flow is used because AMD module names are + // derived from file names, and Flow is normally delivered in a lowercase + // file name. Do this after creating the global so that if an AMD module wants + // to call noConflict to hide this version of Flow, it will work. + if ( true ) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return Flow; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } + } +})(typeof window !== 'undefined' && window, typeof document !== 'undefined' && document); + + +/***/ }), + +/***/ "./node_modules/@flowjs/ng-flow/dist/ng-flow.js": +/*!******************************************************!*\ + !*** ./node_modules/@flowjs/ng-flow/dist/ng-flow.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/* provided dependency */ var Flow = __webpack_require__(/*! @flowjs/flow.js */ "./node_modules/@flowjs/flow.js/src/flow.js"); +/** + * @description + * var app = angular.module('App', ['flow.provider'], function(flowFactoryProvider){ + * flowFactoryProvider.defaults = {target: '/'}; + * }); + * @name flowFactoryProvider + */ +angular.module('flow.provider', []) +.provider('flowFactory', function() { + 'use strict'; + /** + * Define the default properties for flow.js + * @name flowFactoryProvider.defaults + * @type {Object} + */ + this.defaults = {}; + + /** + * Flow, MaybeFlow or NotFlow + * @name flowFactoryProvider.factory + * @type {function} + * @return {Flow} + */ + this.factory = function (options) { + return new Flow(options); + }; + + /** + * Define the default events + * @name flowFactoryProvider.events + * @type {Array} + * @private + */ + this.events = []; + + /** + * Add default events + * @name flowFactoryProvider.on + * @function + * @param {string} event + * @param {Function} callback + */ + this.on = function (event, callback) { + this.events.push([event, callback]); + }; + + this.$get = function() { + var fn = this.factory; + var defaults = this.defaults; + var events = this.events; + return { + 'create': function(opts) { + // combine default options with global options and options + var flow = fn(angular.extend({}, defaults, opts)); + angular.forEach(events, function (event) { + flow.on(event[0], event[1]); + }); + return flow; + } + }; + }; +}); +angular.module('flow.init', ['flow.provider']) + .controller('flowCtrl', ['$scope', '$attrs', '$parse', 'flowFactory', + function ($scope, $attrs, $parse, flowFactory) { + + var options = angular.extend({}, $scope.$eval($attrs.flowInit)); + + // use existing flow object or create a new one + var flow = $scope.$eval($attrs.flowObject) || flowFactory.create(options); + + var catchAllHandler = function(eventName){ + var args = Array.prototype.slice.call(arguments); + args.shift(); + var event = $scope.$broadcast.apply($scope, ['flow::' + eventName, flow].concat(args)); + if ({ + 'progress':1, 'filesSubmitted':1, 'fileSuccess': 1, 'fileError': 1, 'complete': 1 + }[eventName]) { + $scope.$applyAsync(); + } + if (event.defaultPrevented) { + return false; + } + }; + + flow.on('catchAll', catchAllHandler); + $scope.$on('$destroy', function(){ + flow.off('catchAll', catchAllHandler); + }); + + $scope.$flow = flow; + + if ($attrs.hasOwnProperty('flowName')) { + $parse($attrs.flowName).assign($scope, flow); + $scope.$on('$destroy', function () { + $parse($attrs.flowName).assign($scope); + }); + } + }]) + .directive('flowInit', [function() { + return { + scope: true, + controller: 'flowCtrl' + }; + }]); +angular.module('flow.btn', ['flow.init']) +.directive('flowBtn', [function() { + return { + 'restrict': 'EA', + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + var isDirectory = attrs.hasOwnProperty('flowDirectory'); + var isSingleFile = attrs.hasOwnProperty('flowSingleFile'); + var inputAttrs = attrs.hasOwnProperty('flowAttrs') && scope.$eval(attrs.flowAttrs); + scope.$flow.assignBrowse(element, isDirectory, isSingleFile, inputAttrs); + } + }; +}]); +angular.module('flow.dragEvents', ['flow.init']) +/** + * @name flowPreventDrop + * Prevent loading files then dropped on element + */ + .directive('flowPreventDrop', function() { + return { + 'scope': false, + 'link': function(scope, element, attrs) { + element.bind('drop dragover', function (event) { + event.preventDefault(); + }); + } + }; + }) +/** + * @name flowDragEnter + * executes `flowDragEnter` and `flowDragLeave` events + */ + .directive('flowDragEnter', ['$timeout', function($timeout) { + return { + 'scope': false, + 'link': function(scope, element, attrs) { + var promise; + var enter = false; + element.bind('dragover', function (event) { + if (!isFileDrag(event)) { + return ; + } + if (!enter) { + scope.$apply(attrs.flowDragEnter); + enter = true; + } + $timeout.cancel(promise); + event.preventDefault(); + }); + element.bind('dragleave drop', function (event) { + $timeout.cancel(promise); + promise = $timeout(function () { + scope.$eval(attrs.flowDragLeave); + promise = null; + enter = false; + }, 100); + }); + function isFileDrag(dragEvent) { + var fileDrag = false; + var dataTransfer = dragEvent.dataTransfer || dragEvent.originalEvent.dataTransfer; + angular.forEach(dataTransfer && dataTransfer.types, function(val) { + if (val === 'Files') { + fileDrag = true; + } + }); + return fileDrag; + } + } + }; + }]); + +angular.module('flow.drop', ['flow.init']) +.directive('flowDrop', function() { + return { + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + if (attrs.flowDropEnabled) { + scope.$watch(attrs.flowDropEnabled, function (value) { + if (value) { + assignDrop(); + } else { + unAssignDrop(); + } + }); + } else { + assignDrop(); + } + function assignDrop() { + scope.$flow.assignDrop(element); + } + function unAssignDrop() { + scope.$flow.unAssignDrop(element); + } + } + }; +}); + +!function (angular) {'use strict'; + var module = angular.module('flow.events', ['flow.init']); + var events = { + fileSuccess: ['$file', '$message'], + fileProgress: ['$file'], + fileAdded: ['$file', '$event'], + filesAdded: ['$files', '$event'], + filesSubmitted: ['$files', '$event'], + fileRetry: ['$file'], + fileRemoved: ['$file'], + fileError: ['$file', '$message'], + uploadStart: [], + complete: [], + progress: [], + error: ['$message', '$file'] + }; + + angular.forEach(events, function (eventArgs, eventName) { + var name = 'flow' + capitaliseFirstLetter(eventName); + if (name == 'flowUploadStart') { + name = 'flowUploadStarted';// event alias + } + module.directive(name, [function() { + return { + require: '^flowInit', + controller: ['$scope', '$attrs', function ($scope, $attrs) { + $scope.$on('flow::' + eventName, function () { + var funcArgs = Array.prototype.slice.call(arguments); + var event = funcArgs.shift();// remove angular event + // remove flow object and ignore event if it is from parent directive + if ($scope.$flow !== funcArgs.shift()) { + return ; + } + var args = {}; + angular.forEach(eventArgs, function(value, key) { + args[value] = funcArgs[key]; + }); + if ($scope.$eval($attrs[name], args) === false) { + event.preventDefault(); + } + }); + }] + }; + }]); + }); + + function capitaliseFirstLetter(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + } +}(angular); + +angular.module('flow.img', ['flow.init']) +.directive('flowImg', [function() { + return { + 'scope': false, + 'require': '^flowInit', + 'link': function(scope, element, attrs) { + var file = attrs.flowImg; + scope.$watch(file, function (file) { + if (!file) { + return ; + } + var fileReader = new FileReader(); + fileReader.readAsDataURL(file.file); + fileReader.onload = function (event) { + scope.$apply(function () { + attrs.$set('src', event.target.result); + }); + }; + }); + } + }; +}]); +angular.module('flow.transfers', ['flow.init']) +.directive('flowTransfers', [function() { + return { + 'scope': true, + 'require': '^flowInit', + 'link': function(scope) { + scope.transfers = scope.$flow.files; + } + }; +}]); +angular.module('flow', ['flow.provider', 'flow.init', 'flow.events', 'flow.btn', + 'flow.drop', 'flow.transfers', 'flow.img', 'flow.dragEvents']); + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/angular.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/angular.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ng": () => (/* binding */ ng) +/* harmony export */ }); +/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! angular */ "./node_modules/angular/index-exposed.js"); +/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_0__); +/** @publicapi @module ng1 */ /** */ + +/** @hidden */ var ng_from_global = angular; +/** @hidden */ var ng = angular__WEBPACK_IMPORTED_MODULE_0__ && angular__WEBPACK_IMPORTED_MODULE_0__.module ? angular__WEBPACK_IMPORTED_MODULE_0__ : ng_from_global; +//# sourceMappingURL=angular.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* eslint-disable @typescript-eslint/no-empty-interface */ +/* eslint-disable prefer-const */ +/** + * # Angular 1 Directives + * + * These are the directives included in UI-Router for Angular 1. + * These directives are used in templates to create viewports and link/navigate to states. + * + * @preferred @publicapi @module directives + */ /** */ + + +/** @hidden */ +function parseStateRef(ref) { + var paramsOnly = ref.match(/^\s*({[^}]*})\s*$/); + if (paramsOnly) + ref = '(' + paramsOnly[1] + ')'; + var parsed = ref.replace(/\n/g, ' ').match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/); + if (!parsed || parsed.length !== 4) + throw new Error("Invalid state ref '" + ref + "'"); + return { state: parsed[1] || null, paramExpr: parsed[3] || null }; +} +/** @hidden */ +function stateContext(el) { + var $uiView = el.parent().inheritedData('$uiView'); + var path = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.parse)('$cfg.path')($uiView); + return path ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(path).state.name : undefined; +} +/** @hidden */ +function processedDef($state, $element, def) { + var uiState = def.uiState || $state.current.name; + var uiStateOpts = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)(defaultOpts($element, $state), def.uiStateOpts || {}); + var href = $state.href(uiState, def.uiStateParams, uiStateOpts); + return { uiState: uiState, uiStateParams: def.uiStateParams, uiStateOpts: uiStateOpts, href: href }; +} +/** @hidden */ +function getTypeInfo(el) { + // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. + var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]'; + var isForm = el[0].nodeName === 'FORM'; + return { + attr: isForm ? 'action' : isSvg ? 'xlink:href' : 'href', + isAnchor: el.prop('tagName').toUpperCase() === 'A', + clickable: !isForm, + }; +} +/** @hidden */ +function clickHook(el, $state, $timeout, type, getDef) { + return function (e) { + var button = e.which || e.button, target = getDef(); + if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || el.attr('target'))) { + // HACK: This is to allow ng-clicks to be processed before the transition is initiated: + var transition_1 = $timeout(function () { + if (!el.attr('disabled')) { + $state.go(target.uiState, target.uiStateParams, target.uiStateOpts); + } + }); + e.preventDefault(); + // if the state has no URL, ignore one preventDefault from the directive. + var ignorePreventDefaultCount_1 = type.isAnchor && !target.href ? 1 : 0; + e.preventDefault = function () { + if (ignorePreventDefaultCount_1-- <= 0) + $timeout.cancel(transition_1); + }; + } + }; +} +/** @hidden */ +function defaultOpts(el, $state) { + return { + relative: stateContext(el) || $state.$current, + inherit: true, + source: 'sref', + }; +} +/** @hidden */ +function bindEvents(element, scope, hookFn, uiStateOpts) { + var events; + if (uiStateOpts) { + events = uiStateOpts.events; + } + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(events)) { + events = ['click']; + } + var on = element.on ? 'on' : 'bind'; + for (var _i = 0, events_1 = events; _i < events_1.length; _i++) { + var event_1 = events_1[_i]; + element[on](event_1, hookFn); + } + scope.$on('$destroy', function () { + var off = element.off ? 'off' : 'unbind'; + for (var _i = 0, events_2 = events; _i < events_2.length; _i++) { + var event_2 = events_2[_i]; + element[off](event_2, hookFn); + } + }); +} +/** + * `ui-sref`: A directive for linking to a state + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * ### Linked State + * The attribute value of the `ui-sref` is the name of the state to link to. + * + * #### Example: + * This will activate the `home` state when the link is clicked. + * ```html + * Home + * ``` + * + * ### Relative Links + * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]). + * You just need to be aware that the path is relative to the state that *created* the link. + * This allows a state to create a relative `ui-sref` which always targets the same destination. + * + * #### Example: + * Both these links are relative to the parent state, even when a child state is currently active. + * ```html + * child 1 state + * child 2 state + * ``` + * + * This link activates the parent state. + * ```html + * Return + * ``` + * + * ### hrefs + * If the linked state has a URL, the directive will automatically generate and + * update the `href` attribute (using the [[StateService.href]] method). + * + * #### Example: + * Assuming the `users` state has a url of `/users/` + * ```html + * Users + * ``` + * + * ### Parameter Values + * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state. + * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses. + * The content inside the parentheses is an expression, evaluated to the parameter values. + * + * #### Example: + * This example renders a list of links to users. + * The state's `userId` parameter value comes from each user's `user.id` property. + * ```html + *
  • + * {{ user.displayName }} + *
  • + * ``` + * + * Note: + * The parameter values expression is `$watch`ed for updates. + * + * ### Transition Options + * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute. + * Options are restricted to `location`, `inherit`, and `reload`. + * + * #### Example: + * ```html + * Home + * ``` + * + * ### Other DOM Events + * + * You can also customize which DOM events to respond to (instead of `click`) by + * providing an `events` array in the `ui-sref-opts` attribute. + * + * #### Example: + * ```html + * + * ``` + * + * ### Highlighting the active link + * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. + * + * ### Examples + * If you have the following template: + * + * ```html + * Home + * About + * Next page + * + * + * ``` + * + * Then (assuming the current state is `contacts`) the rendered html including hrefs would be: + * + * ```html + * Home + * About + * Next page + * + *
      + *
    • + * Joe + *
    • + *
    • + * Alice + *
    • + *
    • + * Bob + *
    • + *
    + * + * Home + * ``` + * + * ### Notes + * + * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses. + * #### Example: + * Sets the `lang` parameter to `en` and remains on the same state. + * + * ```html + * English + * ``` + * + * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. + * + * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons). + * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive. + */ +var uiSrefDirective; +uiSrefDirective = [ + '$uiRouter', + '$timeout', + function $StateRefDirective($uiRouter, $timeout) { + var $state = $uiRouter.stateService; + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function (scope, element, attrs, uiSrefActive) { + var type = getTypeInfo(element); + var active = uiSrefActive[1] || uiSrefActive[0]; + var unlinkInfoFn = null; + var rawDef = {}; + var getDef = function () { return processedDef($state, element, rawDef); }; + var ref = parseStateRef(attrs.uiSref); + rawDef.uiState = ref.state; + rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {}; + function update() { + var def = getDef(); + if (unlinkInfoFn) + unlinkInfoFn(); + if (active) + unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); + if (def.href != null) + attrs.$set(type.attr, def.href); + } + if (ref.paramExpr) { + scope.$watch(ref.paramExpr, function (val) { + rawDef.uiStateParams = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)({}, val); + update(); + }, true); + rawDef.uiStateParams = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)({}, scope.$eval(ref.paramExpr)); + } + update(); + scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); + scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); + if (!type.clickable) + return; + var hookFn = clickHook(element, $state, $timeout, type, getDef); + bindEvents(element, scope, hookFn, rawDef.uiStateOpts); + }, + }; + }, +]; +/** + * `ui-state`: A fully dynamic directive for linking to a state + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.** + * + * A directive which links to a state (and optionally, parameters). + * When clicked, this directive activates the linked state with the supplied parameter values. + * + * ### Linked State + * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to. + * **This is in contrast with `ui-sref`, which takes a state name as a string literal.** + * + * #### Example: + * Create a list of links. + * ```html + *
  • + * {{ link.displayName }} + *
  • + * ``` + * + * ### Relative Links + * If the expression evaluates to a relative path, it is processed like [[uiSref]]. + * You just need to be aware that the path is relative to the state that *created* the link. + * This allows a state to create relative `ui-state` which always targets the same destination. + * + * ### hrefs + * If the linked state has a URL, the directive will automatically generate and + * update the `href` attribute (using the [[StateService.href]] method). + * + * ### Parameter Values + * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state. + * Param values should be provided using the `ui-state-params` attribute. + * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression. + * + * #### Example: + * This example renders a list of links with param values. + * The state's `userId` parameter value comes from each user's `user.id` property. + * ```html + *
  • + * {{ link.displayName }} + *
  • + * ``` + * + * ### Transition Options + * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute. + * Options are restricted to `location`, `inherit`, and `reload`. + * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression. + * + * #### Example: + * ```html + * Home + * ``` + * + * ### Other DOM Events + * + * You can also customize which DOM events to respond to (instead of `click`) by + * providing an `events` array in the `ui-state-opts` attribute. + * + * #### Example: + * ```html + * + * ``` + * + * ### Highlighting the active link + * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. + * + * ### Notes + * + * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`. + * However, it might be simpler to use [[uiSref]] parameter-only links. + * + * #### Example: + * Sets the `lang` parameter to `en` and remains on the same state. + * + * ```html + * English + * ``` + * + * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. + * ``` + */ +var uiStateDirective; +uiStateDirective = [ + '$uiRouter', + '$timeout', + function $StateRefDynamicDirective($uiRouter, $timeout) { + var $state = $uiRouter.stateService; + return { + restrict: 'A', + require: ['?^uiSrefActive', '?^uiSrefActiveEq'], + link: function (scope, element, attrs, uiSrefActive) { + var type = getTypeInfo(element); + var active = uiSrefActive[1] || uiSrefActive[0]; + var unlinkInfoFn = null; + var hookFn; + var rawDef = {}; + var getDef = function () { return processedDef($state, element, rawDef); }; + var inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts']; + var watchDeregFns = inputAttrs.reduce(function (acc, attr) { return ((acc[attr] = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.noop), acc); }, {}); + function update() { + var def = getDef(); + if (unlinkInfoFn) + unlinkInfoFn(); + if (active) + unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); + if (def.href != null) + attrs.$set(type.attr, def.href); + } + inputAttrs.forEach(function (field) { + rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null; + attrs.$observe(field, function (expr) { + watchDeregFns[field](); + watchDeregFns[field] = scope.$watch(expr, function (newval) { + rawDef[field] = newval; + update(); + }, true); + }); + }); + update(); + scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); + scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); + if (!type.clickable) + return; + hookFn = clickHook(element, $state, $timeout, type, getDef); + bindEvents(element, scope, hookFn, rawDef.uiStateOpts); + }, + }; + }, +]; +/** + * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active + * + * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the + * related directive's state is active (and remove them when it is inactive). + * + * The primary use-case is to highlight the active link in navigation menus, + * distinguishing it from the inactive menu items. + * + * ### Linking to a `ui-sref` or `ui-state` + * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element. + * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**. + * + * ### Matching + * + * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**. + * This is a "fuzzy match" which uses [[StateService.includes]]. + * + * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active). + * This is an "exact match" which uses [[StateService.is]]. + * + * ### Parameter values + * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted. + * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted. + * + * #### Example: + * ```html + *
  • + * {{ user.lastName }} + *
  • + * ``` + * + * ### Examples + * + * Given the following template: + * #### Example: + * ```html + * + * ``` + * + * When the app state is `app.user` (or any child state), + * and contains the state parameter "user" with value "bilbobaggins", + * the resulting HTML will appear as (note the 'active' class): + * + * ```html + * + * ``` + * + * ### Glob mode + * + * It is possible to pass `ui-sref-active` an expression that evaluates to an object. + * The objects keys represent active class names and values represent the respective state names/globs. + * `ui-sref-active` will match if the current active state **includes** any of + * the specified state names/globs, even the abstract ones. + * + * #### Example: + * Given the following template, with "admin" being an abstract state: + * ```html + *
    + * Roles + *
    + * ``` + * + * Arrays are also supported as values in the `ngClass`-like interface. + * This allows multiple states to add `active` class. + * + * #### Example: + * Given the following template, with "admin.roles" being the current state, the class will be added too: + * ```html + *
    + * Roles + *
    + * ``` + * + * When the current state is "admin.roles" the "active" class will be applied to both the `
    ` and `` elements. + * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`. + * + * ### Notes: + * + * - The class name is interpolated **once** during the directives link time (any further changes to the + * interpolated value are ignored). + * + * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'` + */ +var uiSrefActiveDirective; +uiSrefActiveDirective = [ + '$state', + '$stateParams', + '$interpolate', + '$uiRouter', + function $StateRefActiveDirective($state, $stateParams, $interpolate, $uiRouter) { + return { + restrict: 'A', + controller: [ + '$scope', + '$element', + '$attrs', + function ($scope, $element, $attrs) { + var states = []; + var activeEqClass; + var uiSrefActive; + // There probably isn't much point in $observing this + // uiSrefActive and uiSrefActiveEq share the same directive object with some + // slight difference in logic routing + activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope); + try { + uiSrefActive = $scope.$eval($attrs.uiSrefActive); + } + catch (e) { + // Do nothing. uiSrefActive is not a valid expression. + // Fall back to using $interpolate below + } + uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope); + setStatesFromDefinitionObject(uiSrefActive); + // Allow uiSref to communicate with uiSrefActive[Equals] + this.$$addStateInfo = function (newState, newParams) { + // we already got an explicit state provided by ui-sref-active, so we + // shadow the one that comes from ui-sref + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(uiSrefActive) && states.length > 0) { + return; + } + var deregister = addState(newState, newParams, uiSrefActive); + update(); + return deregister; + }; + function updateAfterTransition(trans) { + trans.promise.then(update, _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.noop); + } + $scope.$on('$destroy', setupEventListeners()); + if ($uiRouter.globals.transition) { + updateAfterTransition($uiRouter.globals.transition); + } + function setupEventListeners() { + var deregisterStatesChangedListener = $uiRouter.stateRegistry.onStatesChanged(handleStatesChanged); + var deregisterOnStartListener = $uiRouter.transitionService.onStart({}, updateAfterTransition); + var deregisterStateChangeSuccessListener = $scope.$on('$stateChangeSuccess', update); + return function cleanUp() { + deregisterStatesChangedListener(); + deregisterOnStartListener(); + deregisterStateChangeSuccessListener(); + }; + } + function handleStatesChanged() { + setStatesFromDefinitionObject(uiSrefActive); + } + function setStatesFromDefinitionObject(statesDefinition) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(statesDefinition)) { + states = []; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.forEach)(statesDefinition, function (stateOrName, activeClass) { + // Helper function to abstract adding state. + var addStateForClass = function (stateOrName, activeClass) { + var ref = parseStateRef(stateOrName); + addState(ref.state, $scope.$eval(ref.paramExpr), activeClass); + }; + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isString)(stateOrName)) { + // If state is string, just add it. + addStateForClass(stateOrName, activeClass); + } + else if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(stateOrName)) { + // If state is an array, iterate over it and add each array item individually. + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.forEach)(stateOrName, function (stateOrName) { + addStateForClass(stateOrName, activeClass); + }); + } + }); + } + } + function addState(stateName, stateParams, activeClass) { + var state = $state.get(stateName, stateContext($element)); + var stateInfo = { + state: state || { name: stateName }, + params: stateParams, + activeClass: activeClass, + }; + states.push(stateInfo); + return function removeState() { + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.removeFrom)(states)(stateInfo); + }; + } + // Update route state + function update() { + var splitClasses = function (str) { return str.split(/\s/).filter(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.identity); }; + var getClasses = function (stateList) { + return stateList + .map(function (x) { return x.activeClass; }) + .map(splitClasses) + .reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []); + }; + var allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.uniqR, []); + var fuzzyClasses = getClasses(states.filter(function (x) { return $state.includes(x.state.name, x.params); })); + var exactlyMatchesAny = !!states.filter(function (x) { return $state.is(x.state.name, x.params); }).length; + var exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : []; + var addClasses = fuzzyClasses.concat(exactClasses).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.uniqR, []); + var removeClasses = allClasses.filter(function (cls) { return !(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.inArray)(addClasses, cls); }); + $scope.$evalAsync(function () { + addClasses.forEach(function (className) { return $element.addClass(className); }); + removeClasses.forEach(function (className) { return $element.removeClass(className); }); + }); + } + update(); + }, + ], + }; + }, +]; +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state') + .directive('uiSref', uiSrefDirective) + .directive('uiSrefActive', uiSrefActiveDirective) + .directive('uiSrefActiveEq', uiSrefActiveDirective) + .directive('uiState', uiStateDirective); +//# sourceMappingURL=stateDirectives.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "uiView": () => (/* binding */ uiView) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/** @publicapi @module directives */ /** */ + + + + +/** + * `ui-view`: A viewport directive which is filled in by a view from the active state. + * + * ### Attributes + * + * - `name`: (Optional) A view name. + * The name should be unique amongst the other views in the same state. + * You can have views of the same name that live in different states. + * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]). + * + * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated. + * Uses [[$uiViewScroll]] to do the scrolling. + * + * - `onload`: Expression to evaluate whenever the view updates. + * + * #### Example: + * A view can be unnamed or named. + * ```html + * + *
    + * + * + *
    + * + * + * + * ``` + * + * You can only have one unnamed view within any template (or root html). If you are only using a + * single view and it is unnamed then you can populate it like so: + * + * ```html + *
    + * $stateProvider.state("home", { + * template: "

    HELLO!

    " + * }) + * ``` + * + * The above is a convenient shortcut equivalent to specifying your view explicitly with the + * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name: + * + * ```js + * $stateProvider.state("home", { + * views: { + * "": { + * template: "

    HELLO!

    " + * } + * } + * }) + * ``` + * + * But typically you'll only use the views property if you name your view or have more than one view + * in the same template. There's not really a compelling reason to name a view if its the only one, + * but you could if you wanted, like so: + * + * ```html + *
    + * ``` + * + * ```js + * $stateProvider.state("home", { + * views: { + * "main": { + * template: "

    HELLO!

    " + * } + * } + * }) + * ``` + * + * Really though, you'll use views to set up multiple views: + * + * ```html + *
    + *
    + *
    + * ``` + * + * ```js + * $stateProvider.state("home", { + * views: { + * "": { + * template: "

    HELLO!

    " + * }, + * "chart": { + * template: "" + * }, + * "data": { + * template: "" + * } + * } + * }) + * ``` + * + * #### Examples for `autoscroll`: + * ```html + * + * + * + * + * + * + * + * ``` + * + * Resolve data: + * + * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this + * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template. + * + * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the + * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which + * depends on `$resolve` data. + * + * #### Example: + * ```js + * $stateProvider.state('home', { + * template: '', + * resolve: { + * user: function(UserService) { return UserService.fetchUser(); } + * } + * }); + * ``` + */ +var uiView; +// eslint-disable-next-line prefer-const +uiView = [ + '$view', + '$animate', + '$uiViewScroll', + '$interpolate', + '$q', + function $ViewDirective($view, $animate, $uiViewScroll, $interpolate, $q) { + function getRenderer() { + return { + enter: function (element, target, cb) { + if (_angular__WEBPACK_IMPORTED_MODULE_1__.ng.version.minor > 2) { + $animate.enter(element, null, target).then(cb); + } + else { + $animate.enter(element, null, target, cb); + } + }, + leave: function (element, cb) { + if (_angular__WEBPACK_IMPORTED_MODULE_1__.ng.version.minor > 2) { + $animate.leave(element).then(cb); + } + else { + $animate.leave(element, cb); + } + }, + }; + } + function configsEqual(config1, config2) { + return config1 === config2; + } + var rootData = { + $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } }, + $uiView: {}, + }; + var directive = { + count: 0, + restrict: 'ECA', + terminal: true, + priority: 400, + transclude: 'element', + compile: function (tElement, tAttrs, $transclude) { + return function (scope, $element, attrs) { + var onloadExp = attrs['onload'] || '', autoScrollExp = attrs['autoscroll'], renderer = getRenderer(), inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default'; + var previousEl, currentEl, currentScope, viewConfig; + var activeUIView = { + $type: 'ng1', + id: directive.count++, + name: name, + fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, + config: null, + configUpdated: configUpdatedCallback, + get creationContext() { + // The context in which this ui-view "tag" was created + var fromParentTagConfig = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('$cfg.viewDecl.$context')(inherited); + // Allow + // See https://github.com/angular-ui/ui-router/issues/3355 + var fromParentTag = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('$uiView.creationContext')(inherited); + return fromParentTagConfig || fromParentTag; + }, + }; + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Linking', activeUIView); + function configUpdatedCallback(config) { + if (config && !(config instanceof _statebuilders_views__WEBPACK_IMPORTED_MODULE_3__.Ng1ViewConfig)) + return; + if (configsEqual(viewConfig, config)) + return; + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context); + viewConfig = config; + updateView(config); + } + $element.data('$uiView', { $uiView: activeUIView }); + updateView(); + var unregister = $view.registerUIView(activeUIView); + scope.$on('$destroy', function () { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Destroying/Unregistering', activeUIView); + unregister(); + }); + function cleanupLastView() { + if (previousEl) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView')); + previousEl.remove(); + previousEl = null; + } + if (currentScope) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Destroying scope', activeUIView); + currentScope.$destroy(); + currentScope = null; + } + if (currentEl) { + var _viewData_1 = currentEl.data('$uiViewAnim'); + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Animate out', _viewData_1); + renderer.leave(currentEl, function () { + _viewData_1.$$animLeave.resolve(); + previousEl = null; + }); + previousEl = currentEl; + currentEl = null; + } + } + function updateView(config) { + var newScope = scope.$new(); + var animEnter = $q.defer(), animLeave = $q.defer(); + var $uiViewData = { + $cfg: config, + $uiView: activeUIView, + }; + var $uiViewAnim = { + $animEnter: animEnter.promise, + $animLeave: animLeave.promise, + $$animLeave: animLeave, + }; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoading + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description + * + * Fired once the view **begins loading**, *before* the DOM is rendered. + * + * @param {Object} event Event object. + * @param {string} viewName Name of the view. + */ + newScope.$emit('$viewContentLoading', name); + var cloned = $transclude(newScope, function (clone) { + clone.data('$uiViewAnim', $uiViewAnim); + clone.data('$uiView', $uiViewData); + renderer.enter(clone, $element, function onUIViewEnter() { + animEnter.resolve(); + if (currentScope) + currentScope.$emit('$viewContentAnimationEnded'); + if (((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(autoScrollExp) && !autoScrollExp) || scope.$eval(autoScrollExp)) { + $uiViewScroll(clone); + } + }); + cleanupLastView(); + }); + currentEl = cloned; + currentScope = newScope; + /** + * @ngdoc event + * @name ui.router.state.directive:ui-view#$viewContentLoaded + * @eventOf ui.router.state.directive:ui-view + * @eventType emits on ui-view directive scope + * @description * + * Fired once the view is **loaded**, *after* the DOM is rendered. + * + * @param {Object} event Event object. + */ + currentScope.$emit('$viewContentLoaded', config || viewConfig); + currentScope.$eval(onloadExp); + } + }; + }, + }; + return directive; + }, +]; +$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q']; +/** @hidden */ +function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) { + var getControllerAs = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('viewDecl.controllerAs'); + var getResolveAs = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('viewDecl.resolveAs'); + return { + restrict: 'ECA', + priority: -400, + compile: function (tElement) { + var initial = tElement.html(); + tElement.empty(); + return function (scope, $element) { + var data = $element.data('$uiView'); + if (!data) { + $element.html(initial); + $compile($element.contents())(scope); + return; + } + var cfg = data.$cfg || { viewDecl: {}, getTemplate: _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.noop }; + var resolveCtx = cfg.path && new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(cfg.path); + $element.html(cfg.getTemplate($element, resolveCtx) || initial); + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewFill(data.$uiView, $element.html()); + var link = $compile($element.contents()); + var controller = cfg.controller; + var controllerAs = getControllerAs(cfg); + var resolveAs = getResolveAs(cfg); + var locals = resolveCtx && (0,_services__WEBPACK_IMPORTED_MODULE_2__.getLocals)(resolveCtx); + scope[resolveAs] = locals; + if (controller) { + var controllerInstance = ($controller(controller, (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)({}, locals, { $scope: scope, $element: $element }))); + if (controllerAs) { + scope[controllerAs] = controllerInstance; + scope[controllerAs][resolveAs] = locals; + } + // TODO: Use $view service as a central point for registering component-level hooks + // Then, when a component is created, tell the $view service, so it can invoke hooks + // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element }); + // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element })); + $element.data('$ngControllerController', controllerInstance); + $element.children().data('$ngControllerController', controllerInstance); + registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg); + } + // Wait for the component to appear in the DOM + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(cfg.component)) { + var kebobName = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.kebobString)(cfg.component); + var tagRegexp_1 = new RegExp("^(x-|data-)?" + kebobName + "$", 'i'); + var getComponentController = function () { + var directiveEl = [].slice + .call($element[0].children) + .filter(function (el) { return el && el.tagName && tagRegexp_1.exec(el.tagName); }); + return directiveEl && _angular__WEBPACK_IMPORTED_MODULE_1__.ng.element(directiveEl).data("$" + cfg.component + "Controller"); + }; + var deregisterWatch_1 = scope.$watch(getComponentController, function (ctrlInstance) { + if (!ctrlInstance) + return; + registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg); + deregisterWatch_1(); + }); + } + link(scope); + }; + }, + }; +} +/** @hidden */ +var hasComponentImpl = typeof _angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router')['component'] === 'function'; +/** @hidden incrementing id */ +var _uiCanExitId = 0; +/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */ +function registerControllerCallbacks($q, $transitions, controllerInstance, $scope, cfg) { + // Call $onInit() ASAP + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.$onInit) && + !((cfg.viewDecl.component || cfg.viewDecl.componentProvider) && hasComponentImpl)) { + controllerInstance.$onInit(); + } + var viewState = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.tail)(cfg.path).state.self; + var hookOptions = { bind: controllerInstance }; + // Add component-level hook for onUiParamsChanged + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.uiOnParamsChanged)) { + var resolveContext = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(cfg.path); + var viewCreationTrans_1 = resolveContext.getResolvable('$transition$').data; + // Fire callback on any successful transition + var paramsUpdated = function ($transition$) { + // Exit early if the $transition$ is the same as the view was created within. + // Exit early if the $transition$ will exit the state the view is for. + if ($transition$ === viewCreationTrans_1 || $transition$.exiting().indexOf(viewState) !== -1) + return; + var toParams = $transition$.params('to'); + var fromParams = $transition$.params('from'); + var getNodeSchema = function (node) { return node.paramSchema; }; + var toSchema = $transition$.treeChanges('to').map(getNodeSchema).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + var fromSchema = $transition$.treeChanges('from').map(getNodeSchema).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + // Find the to params that have different values than the from params + var changedToParams = toSchema.filter(function (param) { + var idx = fromSchema.indexOf(param); + return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]); + }); + // Only trigger callback if a to param has changed or is new + if (changedToParams.length) { + var changedKeys_1 = changedToParams.map(function (x) { return x.id; }); + // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params. + var newValues = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.filter)(toParams, function (val, key) { return changedKeys_1.indexOf(key) !== -1; }); + controllerInstance.uiOnParamsChanged(newValues, $transition$); + } + }; + $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions)); + } + // Add component-level hook for uiCanExit + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.uiCanExit)) { + var id_1 = _uiCanExitId++; + var cacheProp_1 = '_uiCanExitIds'; + // Returns true if a redirect transition already answered truthy + var prevTruthyAnswer_1 = function (trans) { + return !!trans && ((trans[cacheProp_1] && trans[cacheProp_1][id_1] === true) || prevTruthyAnswer_1(trans.redirectedFrom())); + }; + // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition + var wrappedHook = function (trans) { + var promise; + var ids = (trans[cacheProp_1] = trans[cacheProp_1] || {}); + if (!prevTruthyAnswer_1(trans)) { + promise = $q.when(controllerInstance.uiCanExit(trans)); + promise.then(function (val) { return (ids[id_1] = val !== false); }); + } + return promise; + }; + var criteria = { exiting: viewState.name }; + $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions)); + } +} +_angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router.state').directive('uiView', uiView); +_angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router.state').directive('uiView', $ViewDirectiveFill); +//# sourceMappingURL=viewDirective.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getLocals": () => (/* reexport safe */ _services__WEBPACK_IMPORTED_MODULE_1__.getLocals), +/* harmony export */ "watchDigests": () => (/* reexport safe */ _services__WEBPACK_IMPORTED_MODULE_1__.watchDigests), +/* harmony export */ "Ng1ViewConfig": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.Ng1ViewConfig), +/* harmony export */ "getNg1ViewConfigFactory": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.getNg1ViewConfigFactory), +/* harmony export */ "ng1ViewsBuilder": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.ng1ViewsBuilder), +/* harmony export */ "StateProvider": () => (/* reexport safe */ _stateProvider__WEBPACK_IMPORTED_MODULE_3__.StateProvider), +/* harmony export */ "UrlRouterProvider": () => (/* reexport safe */ _urlRouterProvider__WEBPACK_IMPORTED_MODULE_4__.UrlRouterProvider), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ "core": () => (/* reexport module object */ _uirouter_core__WEBPACK_IMPORTED_MODULE_10__) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/angularjs/lib-esm/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(["default","core"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/* harmony import */ var _stateProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateProvider */ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"); +/* harmony import */ var _urlRouterProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./urlRouterProvider */ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"); +/* harmony import */ var _injectables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./injectables */ "./node_modules/@uirouter/angularjs/lib-esm/injectables.js"); +/* harmony import */ var _injectables__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_injectables__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _directives_stateDirectives__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./directives/stateDirectives */ "./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js"); +/* harmony import */ var _stateFilters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stateFilters */ "./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js"); +/* harmony import */ var _directives_viewDirective__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./directives/viewDirective */ "./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js"); +/* harmony import */ var _viewScroll__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./viewScroll */ "./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _uirouter_core__WEBPACK_IMPORTED_MODULE_10__) if(["default","core","getLocals","watchDigests","Ng1ViewConfig","getNg1ViewConfigFactory","ng1ViewsBuilder","StateProvider","UrlRouterProvider"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _uirouter_core__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/** + * Main entry point for angular 1.x build + * @publicapi @module ng1 + */ /** */ + + + + + + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ('ui.router'); + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/injectables.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/injectables.js ***! + \*****************************************************************/ +/***/ (() => { + +/** + * The current (or pending) State Parameters + * + * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition. + * + * The values are not updated until *after* a `Transition` successfully completes. + * + * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running. + * + * ### Deprecation warning: + * + * The value injected for `$stateParams` is different depending on where it is injected. + * + * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`. + * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`. + * + * Because of these confusing details, this service is deprecated. + * + * ### Instead of using the global `$stateParams` service object, + * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]] + * + * ```js + * MyService.$inject = ['$uiRouterGlobals']; + * function MyService($uiRouterGlobals) { + * return { + * paramValues: function () { + * return $uiRouterGlobals.params; + * } + * } + * } + * ``` + * + * ### Instead of using the per-transition `$stateParams` object, + * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]] + * + * ```js + * MyController.$inject = ['$transition$']; + * function MyController($transition$) { + * var username = $transition$.params().username; + * // .. do something with username + * } + * ``` + * + * --- + * + * This object can be injected into other services. + * + * #### Deprecated Example: + * ```js + * SomeService.$inject = ['$http', '$stateParams']; + * function SomeService($http, $stateParams) { + * return { + * getUser: function() { + * return $http.get('/api/users/' + $stateParams.username); + * } + * } + * }; + * angular.service('SomeService', SomeService); + * ``` + * @deprecated + */ +var $stateParams; +/** + * Global UI-Router variables + * + * The router global state as a **Service Object** (injectable during runtime). + * + * This object contains globals such as the current state and current parameter values. + */ +var $uiRouterGlobals; +/** + * The UI-Router instance + * + * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime). + * + * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap. + * It has references to the other UI-Router services + * + * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time. + */ +var $uiRouter; +/** + * The UI-Router instance + * + * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase). + * + * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap. + * It has references to the other UI-Router services + * + * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime. + */ +var $uiRouterProvider; +/** + * Transition debug/tracing + * + * The [[Trace]] singleton as a **Service Object** (injectable during runtime). + * + * Enables or disables Transition tracing which can help to debug issues. + */ +var $trace; +/** + * The Transition Service + * + * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime). + * + * This angular service exposes the [[TransitionService]] singleton, which is primarily + * used to register global transition hooks. + * + * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase. + */ +var $transitions; +/** + * The Transition Service + * + * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase) + * + * This angular service exposes the [[TransitionService]] singleton, which is primarily + * used to register global transition hooks. + * + * #### Note: This object is also exposed as [[$transitions]] for injection during runtime. + */ +var $transitionsProvider; +/** + * The current [[Transition]] object + * + * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers) + * + * This object returns information about the current transition, including: + * + * - To/from states + * - To/from parameters + * - Transition options + * - States being entered, exited, and retained + * - Resolve data + * - A Promise for the transition + * - Any transition failure information + * - An injector for both Service and Per-Transition Objects + */ +var $transition$; +/** + * The State Service + * + * The [[StateService]] singleton as a **Service Object** (injectable during runtime). + * + * This service used to manage and query information on registered states. + * It exposes state related APIs including: + * + * - Start a [[Transition]] + * - Imperatively lazy load states + * - Check if a state is currently active + * - Look up states by name + * - Build URLs for a state+parameters + * - Configure the global Transition error handler + * + * This angular service exposes the [[StateService]] singleton. + */ +var $state; +/** + * The State Registry + * + * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime). + * + * This service is used to register/deregister states. + * It has state registration related APIs including: + * + * - Register/deregister states + * - Listen for state registration/deregistration + * - Get states by name + * - Add state decorators (to customize the state creation process) + * + * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase. + */ +var $stateRegistry; +/** + * The State Registry + * + * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time). + * + * This service is used to register/deregister states. + * It has state registration related APIs including: + * + * - Register/deregister states + * - Listen for state registration/deregistration + * - Get states by name + * - Add state decorators (to customize the state creation process) + * + * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime. + */ +var $stateRegistryProvider; +/** + * The View Scroll provider + * + * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time). + * + * This angular service exposes the [[UIViewScrollProvider]] singleton and is + * used to disable UI-Router's scroll behavior. + */ +var $uiViewScrollProvider; +/** + * The View Scroll function + * + * The View Scroll function as a **Service Object** (injectable during runtime). + * + * This is a function that scrolls an element into view. + * The element is scrolled after a `$timeout` so the DOM has time to refresh. + * + * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor, + * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]]. + * + * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true. + */ +var $uiViewScroll; +/** + * The StateProvider + * + * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time). + * + * This angular service exposes the [[StateProvider]] singleton. + * + * The `StateProvider` is primarily used to register states or add custom state decorators. + * + * ##### Note: This provider is a ng1 vestige. + * It is a passthrough to [[$stateRegistry]] and [[$state]]. + */ +var $stateProvider; +/** + * The URL Service Provider + * + * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase). + * + * A service used to configure and interact with the URL. + * It has URL related APIs including: + * + * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]]) + * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]]) + * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]]) + * - delay initial URL synchronization [[UrlService.deferIntercept]]. + * - get or set the current url: [[UrlService.url]] + * + * ##### Note: This service can also be injected during runtime as [[$urlService]]. + */ +var $urlServiceProvider; +/** + * The URL Service + * + * The [[UrlService]] singleton as a **Service Object** (injectable during runtime). + * + * Note: This service can also be injected during the config phase as [[$urlServiceProvider]]. + * + * Used to configure the URL. + * It has URL related APIs including: + * + * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]]) + * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]]) + * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]]) + * - delay initial URL synchronization [[UrlService.deferIntercept]]. + * - get or set the current url: [[UrlService.url]] + * + * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]]. + */ +var $urlService; +/** + * The URL Router Provider + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead. + * + * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time). + * + * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime. + * + * @deprecated + */ +var $urlRouterProvider; +/** + * The Url Router + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime). + * + * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time. + * + * @deprecated + */ +var $urlRouter; +/** + * The URL Matcher Factory + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime). + * + * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects. + * + * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time. + * + * @deprecated + */ +var $urlMatcherFactory; +/** + * The URL Matcher Factory + * + * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. + * + * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time). + * + * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects. + * + * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime. + * + * @deprecated + */ +var $urlMatcherFactoryProvider; +//# sourceMappingURL=injectables.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/interface.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/interface.js ***! + \***************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/locationServices.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/locationServices.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Ng1LocationServices": () => (/* binding */ Ng1LocationServices) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + + +/** + * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service + * @internalapi + */ +var Ng1LocationServices = /** @class */ (function () { + function Ng1LocationServices($locationProvider) { + // .onChange() registry + this._urlListeners = []; + this.$locationProvider = $locationProvider; + var _lp = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)($locationProvider); + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_lp, this, _lp, ['hashPrefix']); + } + /** + * Applys ng1-specific path parameter encoding + * + * The Angular 1 `$location` service is a bit weird. + * It doesn't allow slashes to be encoded/decoded bi-directionally. + * + * See the writeup at https://github.com/angular-ui/ui-router/issues/2598 + * + * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F + * + * @param router + */ + Ng1LocationServices.monkeyPatchPathParameterType = function (router) { + var pathType = router.urlMatcherFactory.type('path'); + pathType.encode = function (x) { + return x != null ? x.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : x; + }; + pathType.decode = function (x) { + return x != null ? x.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : x; + }; + }; + // eslint-disable-next-line @typescript-eslint/no-empty-function + Ng1LocationServices.prototype.dispose = function () { }; + Ng1LocationServices.prototype.onChange = function (callback) { + var _this = this; + this._urlListeners.push(callback); + return function () { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._urlListeners)(callback); }; + }; + Ng1LocationServices.prototype.html5Mode = function () { + var html5Mode = this.$locationProvider.html5Mode(); + html5Mode = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isObject)(html5Mode) ? html5Mode.enabled : html5Mode; + return html5Mode && this.$sniffer.history; + }; + Ng1LocationServices.prototype.baseHref = function () { + return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname); + }; + Ng1LocationServices.prototype.url = function (newUrl, replace, state) { + if (replace === void 0) { replace = false; } + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newUrl)) + this.$location.url(newUrl); + if (replace) + this.$location.replace(); + if (state) + this.$location.state(state); + return this.$location.url(); + }; + Ng1LocationServices.prototype._runtimeServices = function ($rootScope, $location, $sniffer, $browser, $window) { + var _this = this; + this.$location = $location; + this.$sniffer = $sniffer; + this.$browser = $browser; + this.$window = $window; + // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange + $rootScope.$on('$locationChangeSuccess', function (evt) { return _this._urlListeners.forEach(function (fn) { return fn(evt); }); }); + var _loc = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)($location); + // Bind these LocationService functions to $location + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_loc, this, _loc, ['replace', 'path', 'search', 'hash']); + // Bind these LocationConfig functions to $location + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_loc, this, _loc, ['port', 'protocol', 'host']); + }; + return Ng1LocationServices; +}()); + +//# sourceMappingURL=locationServices.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/services.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/services.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "watchDigests": () => (/* binding */ watchDigests), +/* harmony export */ "getLocals": () => (/* binding */ getLocals) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); +/* harmony import */ var _templateFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./templateFactory */ "./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js"); +/* harmony import */ var _stateProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateProvider */ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"); +/* harmony import */ var _statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./statebuilders/onEnterExitRetain */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js"); +/* harmony import */ var _locationServices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./locationServices */ "./node_modules/@uirouter/angularjs/lib-esm/locationServices.js"); +/* harmony import */ var _urlRouterProvider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./urlRouterProvider */ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"); +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/** + * # Angular 1 types + * + * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc. + * The customizations to the core types for Angular UI-Router are documented here. + * + * The optional [[$resolve]] service is also documented here. + * + * @preferred @publicapi @module ng1 + */ /** */ + + + + + + + + +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.angular1', []); +var mod_init = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.init', ['ng']); +var mod_util = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.util', ['ui.router.init']); +var mod_rtr = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.router', ['ui.router.util']); +var mod_state = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']); +var mod_main = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']); +var mod_cmpt = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.compat', ['ui.router']); +var router = null; +$uiRouterProvider.$inject = ['$locationProvider']; +/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */ +function $uiRouterProvider($locationProvider) { + // Create a new instance of the Router when the $uiRouterProvider is initialized + router = this.router = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.UIRouter(); + router.stateProvider = new _stateProvider__WEBPACK_IMPORTED_MODULE_4__.StateProvider(router.stateRegistry, router.stateService); + // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties + router.stateRegistry.decorator('views', _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.ng1ViewsBuilder); + router.stateRegistry.decorator('onExit', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onExit')); + router.stateRegistry.decorator('onRetain', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onRetain')); + router.stateRegistry.decorator('onEnter', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onEnter')); + router.viewService._pluginapi._viewConfigFactory('ng1', (0,_statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.getNg1ViewConfigFactory)()); + // Disable decoding of params by UrlMatcherFactory because $location already handles this + router.urlService.config._decodeParams = false; + var ng1LocationService = (router.locationService = router.locationConfig = new _locationServices__WEBPACK_IMPORTED_MODULE_6__.Ng1LocationServices($locationProvider)); + _locationServices__WEBPACK_IMPORTED_MODULE_6__.Ng1LocationServices.monkeyPatchPathParameterType(router); + // backwards compat: also expose router instance as $uiRouterProvider.router + router['router'] = router; + router['$get'] = $get; + $get.$inject = ['$location', '$browser', '$window', '$sniffer', '$rootScope', '$http', '$templateCache']; + function $get($location, $browser, $window, $sniffer, $rootScope, $http, $templateCache) { + ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser, $window); + delete router['router']; + delete router['$get']; + return router; + } + return router; +} +var getProviderFor = function (serviceName) { return [ + '$uiRouterProvider', + function ($urp) { + var service = $urp.router[serviceName]; + service['$get'] = function () { return service; }; + return service; + }, +]; }; +// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime) +runBlock.$inject = ['$injector', '$q', '$uiRouter']; +function runBlock($injector, $q, $uiRouter) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector = $injector; + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q = $q; + // https://github.com/angular-ui/ui-router/issues/3678 + if (!Object.prototype.hasOwnProperty.call($injector, 'strictDi')) { + try { + $injector.invoke(function (checkStrictDi) { }); + } + catch (error) { + $injector.strictDi = !!/strict mode/.exec(error && error.toString()); + } + } + // The $injector is now available. + // Find any resolvables that had dependency annotation deferred + $uiRouter.stateRegistry + .get() + .map(function (x) { return x.$$state().resolvables; }) + .reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []) + .filter(function (x) { return x.deps === 'deferred'; }) + .forEach(function (resolvable) { return (resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi)); }); +} +// $urlRouter service and $urlRouterProvider +var getUrlRouterProvider = function (uiRouter) { return (uiRouter.urlRouterProvider = new _urlRouterProvider__WEBPACK_IMPORTED_MODULE_7__.UrlRouterProvider(uiRouter)); }; +// $state service and $stateProvider +// $urlRouter service and $urlRouterProvider +var getStateProvider = function () { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)(router.stateProvider, { $get: function () { return router.stateService; } }); }; +watchDigests.$inject = ['$rootScope']; +function watchDigests($rootScope) { + $rootScope.$watch(function () { + _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.trace.approximateDigests++; + }); +} +mod_init.provider('$uiRouter', $uiRouterProvider); +mod_rtr.provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]); +mod_util.provider('$urlService', getProviderFor('urlService')); +mod_util.provider('$urlMatcherFactory', ['$uiRouterProvider', function () { return router.urlMatcherFactory; }]); +mod_util.provider('$templateFactory', function () { return new _templateFactory__WEBPACK_IMPORTED_MODULE_3__.TemplateFactory(); }); +mod_state.provider('$stateRegistry', getProviderFor('stateRegistry')); +mod_state.provider('$uiRouterGlobals', getProviderFor('globals')); +mod_state.provider('$transitions', getProviderFor('transitionService')); +mod_state.provider('$state', ['$uiRouterProvider', getStateProvider]); +mod_state.factory('$stateParams', ['$uiRouter', function ($uiRouter) { return $uiRouter.globals.params; }]); +mod_main.factory('$view', function () { return router.viewService; }); +mod_main.service('$trace', function () { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.trace; }); +mod_main.run(watchDigests); +mod_util.run(['$urlMatcherFactory', function ($urlMatcherFactory) { }]); +mod_state.run(['$state', function ($state) { }]); +mod_rtr.run(['$urlRouter', function ($urlRouter) { }]); +mod_init.run(runBlock); +/** @hidden TODO: find a place to move this */ +var getLocals = function (ctx) { + var tokens = ctx.getTokens().filter(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isString); + var tuples = tokens.map(function (key) { + var resolvable = ctx.getResolvable(key); + var waitPolicy = ctx.getPolicy(resolvable).async; + return [key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data]; + }); + return tuples.reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.applyPairs, {}); +}; +//# sourceMappingURL=services.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$IsStateFilter": () => (/* binding */ $IsStateFilter), +/* harmony export */ "$IncludedByStateFilter": () => (/* binding */ $IncludedByStateFilter) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/** @publicapi @module ng1 */ /** */ + +/** + * `isState` Filter: truthy if the current state is the parameter + * + * Translates to [[StateService.is]] `$state.is("stateName")`. + * + * #### Example: + * ```html + *
    show if state is 'stateName'
    + * ``` + */ +$IsStateFilter.$inject = ['$state']; +function $IsStateFilter($state) { + var isFilter = function (state, params, options) { + return $state.is(state, params, options); + }; + isFilter.$stateful = true; + return isFilter; +} +/** + * `includedByState` Filter: truthy if the current state includes the parameter + * + * Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`. + * + * #### Example: + * ```html + *
    show if state includes 'fullOrPartialStateName'
    + * ``` + */ +$IncludedByStateFilter.$inject = ['$state']; +function $IncludedByStateFilter($state) { + var includesFilter = function (state, params, options) { + return $state.includes(state, params, options); + }; + includesFilter.$stateful = true; + return includesFilter; +} +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state').filter('isState', $IsStateFilter).filter('includedByState', $IncludedByStateFilter); + +//# sourceMappingURL=stateFilters.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateProvider": () => (/* binding */ StateProvider) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + +/** + * The Angular 1 `StateProvider` + * + * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely + * on state. + * + * A state corresponds to a "place" in the application in terms of the overall UI and + * navigation. A state describes (via the controller / template / view properties) what + * the UI looks like and does at that place. + * + * States often have things in common, and the primary way of factoring out these + * commonalities in this model is via the state hierarchy, i.e. parent/child states aka + * nested states. + * + * The `$stateProvider` provides interfaces to declare these states for your app. + */ +var StateProvider = /** @class */ (function () { + function StateProvider(stateRegistry, stateService) { + this.stateRegistry = stateRegistry; + this.stateService = stateService; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)(StateProvider.prototype), this, (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)(this)); + } + /** + * Decorates states when they are registered + * + * Allows you to extend (carefully) or override (at your own peril) the + * `stateBuilder` object used internally by [[StateRegistry]]. + * This can be used to add custom functionality to ui-router, + * for example inferring templateUrl based on the state name. + * + * When passing only a name, it returns the current (original or decorated) builder + * function that matches `name`. + * + * The builder functions that can be decorated are listed below. Though not all + * necessarily have a good use case for decoration, that is up to you to decide. + * + * In addition, users can attach custom decorators, which will generate new + * properties within the state's internal definition. There is currently no clear + * use-case for this beyond accessing internal states (i.e. $state.$current), + * however, expect this to become increasingly relevant as we introduce additional + * meta-programming features. + * + * **Warning**: Decorators should not be interdependent because the order of + * execution of the builder functions in non-deterministic. Builder functions + * should only be dependent on the state definition object and super function. + * + * + * Existing builder functions and current return values: + * + * - **parent** `{object}` - returns the parent state object. + * - **data** `{object}` - returns state data, including any inherited data that is not + * overridden by own values (if any). + * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher} + * or `null`. + * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is + * navigable). + * - **params** `{object}` - returns an array of state params that are ensured to + * be a super-set of parent's params. + * - **views** `{object}` - returns a views object where each key is an absolute view + * name (i.e. "viewName@stateName") and each value is the config object + * (template, controller) for the view. Even when you don't use the views object + * explicitly on a state config, one is still created for you internally. + * So by decorating this builder function you have access to decorating template + * and controller properties. + * - **ownParams** `{object}` - returns an array of params that belong to the state, + * not including any params defined by ancestor states. + * - **path** `{string}` - returns the full path from the root down to this state. + * Needed for state activation. + * - **includes** `{object}` - returns an object that includes every state that + * would pass a `$state.includes()` test. + * + * #### Example: + * Override the internal 'views' builder with a function that takes the state + * definition, and a reference to the internal function being overridden: + * ```js + * $stateProvider.decorator('views', function (state, parent) { + * let result = {}, + * views = parent(state); + * + * angular.forEach(views, function (config, name) { + * let autoName = (state.name + '.' + name).replace('.', '/'); + * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html'; + * result[name] = config; + * }); + * return result; + * }); + * + * $stateProvider.state('home', { + * views: { + * 'contact.list': { controller: 'ListController' }, + * 'contact.item': { controller: 'ItemController' } + * } + * }); + * ``` + * + * + * ```js + * // Auto-populates list and item views with /partials/home/contact/list.html, + * // and /partials/home/contact/item.html, respectively. + * $state.go('home'); + * ``` + * + * @param {string} name The name of the builder function to decorate. + * @param {object} func A function that is responsible for decorating the original + * builder function. The function receives two parameters: + * + * - `{object}` - state - The state config object. + * - `{object}` - super - The original builder function. + * + * @return {object} $stateProvider - $stateProvider instance + */ + StateProvider.prototype.decorator = function (name, func) { + return this.stateRegistry.decorator(name, func) || this; + }; + StateProvider.prototype.state = function (name, definition) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isObject)(name)) { + definition = name; + } + else { + definition.name = name; + } + this.stateRegistry.register(definition); + return this; + }; + /** + * Registers an invalid state handler + * + * This is a passthrough to [[StateService.onInvalid]] for ng1. + */ + StateProvider.prototype.onInvalid = function (callback) { + return this.stateService.onInvalid(callback); + }; + return StateProvider; +}()); + +//# sourceMappingURL=stateProvider.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getStateHookBuilder": () => (/* binding */ getStateHookBuilder) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); +/** @publicapi @module ng1 */ /** */ + + +/** + * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`, + * `onRetain` callback hooks on a [[Ng1StateDeclaration]]. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * ensures that those hooks are injectable for @uirouter/angularjs (ng1). + * + * @internalapi + */ +var getStateHookBuilder = function (hookName) { + return function stateHookBuilder(stateObject) { + var hook = stateObject[hookName]; + var pathname = hookName === 'onExit' ? 'from' : 'to'; + function decoratedNg1Hook(trans, state) { + var resolveContext = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(trans.treeChanges(pathname)); + var subContext = resolveContext.subContext(state.$$state()); + var locals = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)((0,_services__WEBPACK_IMPORTED_MODULE_1__.getLocals)(subContext), { $state$: state, $transition$: trans }); + return _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.invoke(hook, this, locals); + } + return hook ? decoratedNg1Hook : undefined; + }; +}; +//# sourceMappingURL=onEnterExitRetain.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getNg1ViewConfigFactory": () => (/* binding */ getNg1ViewConfigFactory), +/* harmony export */ "ng1ViewsBuilder": () => (/* binding */ ng1ViewsBuilder), +/* harmony export */ "Ng1ViewConfig": () => (/* binding */ Ng1ViewConfig) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module ng1 */ /** */ + +/** @internalapi */ +function getNg1ViewConfigFactory() { + var templateFactory = null; + return function (path, view) { + templateFactory = templateFactory || _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.get('$templateFactory'); + return [new Ng1ViewConfig(path, view, templateFactory)]; + }; +} +/** @internalapi */ +var hasAnyKey = function (keys, obj) { return keys.reduce(function (acc, key) { return acc || (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(obj[key]); }, false); }; +/** + * This is a [[StateBuilder.builder]] function for angular1 `views`. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * handles the `views` property with logic specific to @uirouter/angularjs (ng1). + * + * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object + * and applies the state-level configuration to a view named `$default`. + * + * @internalapi + */ +function ng1ViewsBuilder(state) { + // Do not process root state + if (!state.parent) + return {}; + var tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'], ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'], compKeys = ['component', 'bindings', 'componentProvider'], nonCompKeys = tplKeys.concat(ctrlKeys), allViewKeys = compKeys.concat(nonCompKeys); + // Do not allow a state to have both state-level props and also a `views: {}` property. + // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state. + // However, the `$default` approach should not be mixed with a separate `views: ` block. + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(state.views) && hasAnyKey(allViewKeys, state)) { + throw new Error("State '" + state.name + "' has a 'views' object. " + + "It cannot also have \"view properties\" at the state level. " + + "Move the following properties into a view (in the 'views' object): " + + (" " + allViewKeys.filter(function (key) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(state[key]); }).join(', '))); + } + var views = {}, viewsObject = state.views || { $default: (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.pick)(state, allViewKeys) }; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.forEach)(viewsObject, function (config, name) { + // Account for views: { "": { template... } } + name = name || '$default'; + // Account for views: { header: "headerComponent" } + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(config)) + config = { component: config }; + // Make a shallow copy of the config object + config = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)({}, config); + // Do not allow a view to mix props for component-style view with props for template/controller-style view + if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) { + throw new Error("Cannot combine: " + compKeys.join('|') + " with: " + nonCompKeys.join('|') + " in stateview: '" + name + "@" + state.name + "'"); + } + config.resolveAs = config.resolveAs || '$resolve'; + config.$type = 'ng1'; + config.$context = state; + config.$name = name; + var normalized = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ViewService.normalizeUIViewTarget(config.$context, config.$name); + config.$uiViewName = normalized.uiViewName; + config.$uiViewContextAnchor = normalized.uiViewContextAnchor; + views[name] = config; + }); + return views; +} +/** @hidden */ +var id = 0; +/** @internalapi */ +var Ng1ViewConfig = /** @class */ (function () { + function Ng1ViewConfig(path, viewDecl, factory) { + var _this = this; + this.path = path; + this.viewDecl = viewDecl; + this.factory = factory; + this.$id = id++; + this.loaded = false; + this.getTemplate = function (uiView, context) { + return _this.component + ? _this.factory.makeComponentTemplate(uiView, context, _this.component, _this.viewDecl.bindings) + : _this.template; + }; + } + Ng1ViewConfig.prototype.load = function () { + var _this = this; + var $q = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$q; + var context = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(this.path); + var params = this.path.reduce(function (acc, node) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)(acc, node.paramValues); }, {}); + var promises = { + template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)), + controller: $q.when(this.getController(context)), + }; + return $q.all(promises).then(function (results) { + _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceViewServiceEvent('Loaded', _this); + _this.controller = results.controller; + (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)(_this, results.template); // Either { template: "tpl" } or { component: "cmpName" } + return _this; + }); + }; + /** + * Gets the controller for a view configuration. + * + * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller. + */ + Ng1ViewConfig.prototype.getController = function (context) { + var provider = this.viewDecl.controllerProvider; + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isInjectable)(provider)) + return this.viewDecl.controller; + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + return Ng1ViewConfig; +}()); + +//# sourceMappingURL=views.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TemplateFactory": () => (/* binding */ TemplateFactory) +/* harmony export */ }); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module view */ /** */ + + +/** + * Service which manages loading of templates from a ViewConfig. + */ +var TemplateFactory = /** @class */ (function () { + function TemplateFactory() { + var _this = this; + /** @hidden */ this._useHttp = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.version.minor < 3; + /** @hidden */ this.$get = [ + '$http', + '$templateCache', + '$injector', + function ($http, $templateCache, $injector) { + _this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest'); + _this.$http = $http; + _this.$templateCache = $templateCache; + return _this; + }, + ]; + } + /** @hidden */ + TemplateFactory.prototype.useHttpService = function (value) { + this._useHttp = value; + }; + /** + * Creates a template from a configuration object. + * + * @param config Configuration object for which to load a template. + * The following properties are search in the specified order, and the first one + * that is defined is used to create the template: + * + * @param params Parameters to pass to the template function. + * @param context The resolve context associated with the template's view + * + * @return {string|object} The template html as a string, or a promise for + * that string,or `null` if no template is configured. + */ + TemplateFactory.prototype.fromConfig = function (config, params, context) { + var defaultTemplate = ''; + var asTemplate = function (result) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(result).then(function (str) { return ({ template: str }); }); }; + var asComponent = function (result) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(result).then(function (str) { return ({ component: str }); }); }; + return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.template) + ? asTemplate(this.fromString(config.template, params)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.templateUrl) + ? asTemplate(this.fromUrl(config.templateUrl, params)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.templateProvider) + ? asTemplate(this.fromProvider(config.templateProvider, params, context)) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.component) + ? asComponent(config.component) + : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.componentProvider) + ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) + : asTemplate(defaultTemplate); + }; + /** + * Creates a template from a string or a function returning a string. + * + * @param template html template as a string or function that returns an html template as a string. + * @param params Parameters to pass to the template function. + * + * @return {string|object} The template html as a string, or a promise for that + * string. + */ + TemplateFactory.prototype.fromString = function (template, params) { + return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isFunction)(template) ? template(params) : template; + }; + /** + * Loads a template from the a URL via `$http` and `$templateCache`. + * + * @param {string|Function} url url of the template to load, or a function + * that returns a url. + * @param {Object} params Parameters to pass to the url function. + * @return {string|Promise.} The template html as a string, or a promise + * for that string. + */ + TemplateFactory.prototype.fromUrl = function (url, params) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isFunction)(url)) + url = url(params); + if (url == null) + return null; + if (this._useHttp) { + return this.$http + .get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } }) + .then(function (response) { + return response.data; + }); + } + return this.$templateRequest(url); + }; + /** + * Creates a template by invoking an injectable provider function. + * + * @param provider Function to invoke via `locals` + * @param {Function} injectFn a function used to invoke the template provider + * @return {string|Promise.} The template html as a string, or a promise + * for that string. + */ + TemplateFactory.prototype.fromProvider = function (provider, params, context) { + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + /** + * Creates a component's template by invoking an injectable provider function. + * + * @param provider Function to invoke via `locals` + * @param {Function} injectFn a function used to invoke the template provider + * @return {string} The template html as a string: "". + */ + TemplateFactory.prototype.fromComponentProvider = function (provider, params, context) { + var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(provider); + var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(provider) : provider; + var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.Resolvable('', providerFn, deps); + return resolvable.get(context); + }; + /** + * Creates a template from a component's name + * + * This implements route-to-component. + * It works by retrieving the component (directive) metadata from the injector. + * It analyses the component's bindings, then constructs a template that instantiates the component. + * The template wires input and output bindings to resolves or from the parent component. + * + * @param uiView {object} The parent ui-view (for binding outputs to callbacks) + * @param context The ResolveContext (for binding outputs to callbacks returned from resolves) + * @param component {string} Component's name in camel case. + * @param bindings An object defining the component's bindings: {foo: '<'} + * @return {string} The template as a string: "". + */ + TemplateFactory.prototype.makeComponentTemplate = function (uiView, context, component, bindings) { + bindings = bindings || {}; + // Bind once prefix + var prefix = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.version.minor >= 3 ? '::' : ''; + // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-` + var kebob = function (camelCase) { + var kebobed = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.kebobString)(camelCase); + return /^(x|data)-/.exec(kebobed) ? "x-" + kebobed : kebobed; + }; + var attributeTpl = function (input) { + var name = input.name, type = input.type; + var attrName = kebob(name); + // If the ui-view has an attribute which matches a binding on the routed component + // then pass that attribute through to the routed component template. + // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:` + if (uiView.attr(attrName) && !bindings[name]) + return attrName + "='" + uiView.attr(attrName) + "'"; + var resolveName = bindings[name] || name; + // Pre-evaluate the expression for "@" bindings by enclosing in {{ }} + // some-attr="{{ ::$resolve.someResolveName }}" + if (type === '@') + return attrName + "='{{" + prefix + "$resolve." + resolveName + "}}'"; + // Wire "&" callbacks to resolves that return a callback function + // Get the result of the resolve (should be a function) and annotate it to get its arguments. + // some-attr="$resolve.someResolveResultName(foo, bar)" + if (type === '&') { + var res = context.getResolvable(resolveName); + var fn = res && res.data; + var args = (fn && _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(fn)) || []; + // account for array style injection, i.e., ['foo', function(foo) {}] + var arrayIdxStr = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(fn) ? "[" + (fn.length - 1) + "]" : ''; + return attrName + "='$resolve." + resolveName + arrayIdxStr + "(" + args.join(',') + ")'"; + } + // some-attr="::$resolve.someResolveName" + return attrName + "='" + prefix + "$resolve." + resolveName + "'"; + }; + var attrs = getComponentBindings(component).map(attributeTpl).join(' '); + var kebobName = kebob(component); + return "<" + kebobName + " " + attrs + ">"; + }; + return TemplateFactory; +}()); + +// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&') +function getComponentBindings(name) { + var cmpDefs = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.get(name + 'Directive'); // could be multiple + if (!cmpDefs || !cmpDefs.length) + throw new Error("Unable to find component named '" + name + "'"); + return cmpDefs.map(getBindings).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []); +} +// Given a directive definition, find its object input attributes +// Use different properties, depending on the type of directive (component, bindToController, normal) +var getBindings = function (def) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(def.bindToController)) + return scopeBindings(def.bindToController); + return scopeBindings(def.scope); +}; +// for ng 1.2 style, process the scope: { input: "=foo" } +// for ng 1.3 through ng 1.5, process the component's bindToController: { input: "=foo" } object +var scopeBindings = function (bindingsObj) { + return Object.keys(bindingsObj || {}) + // [ 'input', [ '=foo', '=', 'foo' ] ] + .map(function (key) { return [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])]; }) + // skip malformed values + .filter(function (tuple) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(tuple) && (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(tuple[1]); }) + // { name: ('foo' || 'input'), type: '=' } + .map(function (tuple) { return ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] }); }); +}; +//# sourceMappingURL=templateFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRouterProvider": () => (/* binding */ UrlRouterProvider) +/* harmony export */ }); +/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); +/** @publicapi @module url */ /** */ + + +/** + * Manages rules for client-side URL + * + * ### Deprecation warning: + * This class is now considered to be an internal API + * Use the [[UrlService]] instead. + * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]]. + * + * This class manages the router rules for what to do when the URL changes. + * + * This provider remains for backwards compatibility. + * + * @internalapi + * @deprecated + */ +var UrlRouterProvider = /** @class */ (function () { + /** @hidden */ + function UrlRouterProvider(/** @hidden */ router) { + this.router = router; + } + UrlRouterProvider.injectableHandler = function (router, handler) { + return function (match) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); }; + }; + /** @hidden */ + UrlRouterProvider.prototype.$get = function () { + var urlService = this.router.urlService; + this.router.urlRouter.update(true); + if (!urlService.interceptDeferred) + urlService.listen(); + return this.router.urlRouter; + }; + /** + * Registers a url handler function. + * + * Registers a low level url handler (a `rule`). + * A rule detects specific URL patterns and returns a redirect, or performs some action. + * + * If a rule returns a string, the URL is replaced with the string, and all rules are fired again. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // Here's an example of how you might allow case insensitive urls + * $urlRouterProvider.rule(function ($injector, $location) { + * var path = $location.path(), + * normalized = path.toLowerCase(); + * + * if (path !== normalized) { + * return normalized; + * } + * }); + * }); + * ``` + * + * @param ruleFn + * Handler function that takes `$injector` and `$location` services as arguments. + * You can use them to detect a url and return a different url as a string. + * + * @return [[UrlRouterProvider]] (`this`) + */ + UrlRouterProvider.prototype.rule = function (ruleFn) { + var _this = this; + if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(ruleFn)) + throw new Error("'rule' must be a function"); + var match = function () { return ruleFn(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector, _this.router.locationService); }; + var rule = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.BaseUrlRule(match, _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.identity); + this.router.urlService.rules.rule(rule); + return this; + }; + /** + * Defines the path or behavior to use when no url can be matched. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * // if the path doesn't match any of the urls you configured + * // otherwise will take care of routing the user to the + * // specified url + * $urlRouterProvider.otherwise('/index'); + * + * // Example of using function rule as param + * $urlRouterProvider.otherwise(function ($injector, $location) { + * return '/a/valid/url'; + * }); + * }); + * ``` + * + * @param rule + * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`. + * The function version is passed two params: `$injector` and `$location` services, and should return a url string. + * + * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance + */ + UrlRouterProvider.prototype.otherwise = function (rule) { + var _this = this; + var urlRules = this.router.urlService.rules; + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(rule)) { + urlRules.otherwise(rule); + } + else if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(rule)) { + urlRules.otherwise(function () { return rule(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector, _this.router.locationService); }); + } + else { + throw new Error("'rule' must be a string or function"); + } + return this; + }; + /** + * Registers a handler for a given url matching. + * + * If the handler is a string, it is + * treated as a redirect, and is interpolated according to the syntax of match + * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise). + * + * If the handler is a function, it is injectable. + * It gets invoked if `$location` matches. + * You have the option of inject the match object as `$match`. + * + * The handler can return + * + * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter` + * will continue trying to find another one that matches. + * - **string** which is treated as a redirect and passed to `$location.url()` + * - **void** or any **truthy** value tells `$urlRouter` that the url was handled. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router.router']); + * + * app.config(function ($urlRouterProvider) { + * $urlRouterProvider.when($state.url, function ($match, $stateParams) { + * if ($state.$current.navigable !== state || + * !equalForKeys($match, $stateParams) { + * $state.transitionTo(state, $match, false); + * } + * }); + * }); + * ``` + * + * @param what A pattern string to match, compiled as a [[UrlMatcher]]. + * @param handler The path (or function that returns a path) that you want to redirect your user to. + * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]] + * + * Note: the handler may also invoke arbitrary code, such as `$state.go()` + */ + UrlRouterProvider.prototype.when = function (what, handler) { + if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isArray)(handler) || (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handler)) { + handler = UrlRouterProvider.injectableHandler(this.router, handler); + } + this.router.urlService.rules.when(what, handler); + return this; + }; + /** + * Disables monitoring of the URL. + * + * Call this method before UI-Router has bootstrapped. + * It will stop UI-Router from performing the initial url sync. + * + * This can be useful to perform some asynchronous initialization before the router starts. + * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. + * + * #### Example: + * ```js + * var app = angular.module('app', ['ui.router']); + * + * app.config(function ($urlRouterProvider) { + * // Prevent $urlRouter from automatically intercepting URL changes; + * $urlRouterProvider.deferIntercept(); + * }) + * + * app.run(function (MyService, $urlRouter, $http) { + * $http.get("/stuff").then(function(resp) { + * MyService.doStuff(resp.data); + * $urlRouter.listen(); + * $urlRouter.sync(); + * }); + * }); + * ``` + * + * @param defer Indicates whether to defer location change interception. + * Passing no parameter is equivalent to `true`. + */ + UrlRouterProvider.prototype.deferIntercept = function (defer) { + this.router.urlService.deferIntercept(defer); + }; + return UrlRouterProvider; +}()); + +//# sourceMappingURL=urlRouterProvider.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); +/** @publicapi @module ng1 */ /** */ + +/** @hidden */ +function $ViewScrollProvider() { + var useAnchorScroll = false; + this.useAnchorScroll = function () { + useAnchorScroll = true; + }; + this.$get = [ + '$anchorScroll', + '$timeout', + function ($anchorScroll, $timeout) { + if (useAnchorScroll) { + return $anchorScroll; + } + return function ($element) { + return $timeout(function () { + $element[0].scrollIntoView(); + }, 0, false); + }; + }, + ]; +} +_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider); +//# sourceMappingURL=viewScroll.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/common.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/common.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "root": () => (/* binding */ root), +/* harmony export */ "fromJson": () => (/* binding */ fromJson), +/* harmony export */ "toJson": () => (/* binding */ toJson), +/* harmony export */ "forEach": () => (/* binding */ forEach), +/* harmony export */ "extend": () => (/* binding */ extend), +/* harmony export */ "equals": () => (/* binding */ equals), +/* harmony export */ "identity": () => (/* binding */ identity), +/* harmony export */ "noop": () => (/* binding */ noop), +/* harmony export */ "createProxyFunctions": () => (/* binding */ createProxyFunctions), +/* harmony export */ "inherit": () => (/* binding */ inherit), +/* harmony export */ "inArray": () => (/* binding */ inArray), +/* harmony export */ "_inArray": () => (/* binding */ _inArray), +/* harmony export */ "removeFrom": () => (/* binding */ removeFrom), +/* harmony export */ "_removeFrom": () => (/* binding */ _removeFrom), +/* harmony export */ "pushTo": () => (/* binding */ pushTo), +/* harmony export */ "_pushTo": () => (/* binding */ _pushTo), +/* harmony export */ "deregAll": () => (/* binding */ deregAll), +/* harmony export */ "defaults": () => (/* binding */ defaults), +/* harmony export */ "mergeR": () => (/* binding */ mergeR), +/* harmony export */ "ancestors": () => (/* binding */ ancestors), +/* harmony export */ "pick": () => (/* binding */ pick), +/* harmony export */ "omit": () => (/* binding */ omit), +/* harmony export */ "pluck": () => (/* binding */ pluck), +/* harmony export */ "filter": () => (/* binding */ filter), +/* harmony export */ "find": () => (/* binding */ find), +/* harmony export */ "mapObj": () => (/* binding */ mapObj), +/* harmony export */ "map": () => (/* binding */ map), +/* harmony export */ "values": () => (/* binding */ values), +/* harmony export */ "allTrueR": () => (/* binding */ allTrueR), +/* harmony export */ "anyTrueR": () => (/* binding */ anyTrueR), +/* harmony export */ "unnestR": () => (/* binding */ unnestR), +/* harmony export */ "flattenR": () => (/* binding */ flattenR), +/* harmony export */ "pushR": () => (/* binding */ pushR), +/* harmony export */ "uniqR": () => (/* binding */ uniqR), +/* harmony export */ "unnest": () => (/* binding */ unnest), +/* harmony export */ "flatten": () => (/* binding */ flatten), +/* harmony export */ "assertPredicate": () => (/* binding */ assertPredicate), +/* harmony export */ "assertMap": () => (/* binding */ assertMap), +/* harmony export */ "assertFn": () => (/* binding */ assertFn), +/* harmony export */ "pairs": () => (/* binding */ pairs), +/* harmony export */ "arrayTuples": () => (/* binding */ arrayTuples), +/* harmony export */ "applyPairs": () => (/* binding */ applyPairs), +/* harmony export */ "tail": () => (/* binding */ tail), +/* harmony export */ "copy": () => (/* binding */ copy), +/* harmony export */ "_extend": () => (/* binding */ _extend), +/* harmony export */ "silenceUncaughtInPromise": () => (/* binding */ silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* binding */ silentRejection) +/* harmony export */ }); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _coreservices__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; +/** + * Random utility functions used in the UI-Router code + * + * These functions are exported, but are subject to change without notice. + * + * @packageDocumentation + * @preferred + */ + + + +var root = (typeof self === 'object' && self.self === self && self) || + (typeof __webpack_require__.g === 'object' && __webpack_require__.g.global === __webpack_require__.g && __webpack_require__.g) || + undefined; +var angular = root.angular || {}; +var fromJson = angular.fromJson || JSON.parse.bind(JSON); +var toJson = angular.toJson || JSON.stringify.bind(JSON); +var forEach = angular.forEach || _forEach; +var extend = Object.assign || _extend; +var equals = angular.equals || _equals; +function identity(x) { + return x; +} +function noop() { } +/** + * Builds proxy functions on the `to` object which pass through to the `from` object. + * + * For each key in `fnNames`, creates a proxy function on the `to` object. + * The proxy function calls the real function on the `from` object. + * + * + * #### Example: + * This example creates an new class instance whose functions are prebound to the new'd object. + * ```js + * class Foo { + * constructor(data) { + * // Binds all functions from Foo.prototype to 'this', + * // then copies them to 'this' + * bindFunctions(Foo.prototype, this, this); + * this.data = data; + * } + * + * log() { + * console.log(this.data); + * } + * } + * + * let myFoo = new Foo([1,2,3]); + * var logit = myFoo.log; + * logit(); // logs [1, 2, 3] from the myFoo 'this' instance + * ``` + * + * #### Example: + * This example creates a bound version of a service function, and copies it to another object + * ``` + * + * var SomeService = { + * this.data = [3, 4, 5]; + * this.log = function() { + * console.log(this.data); + * } + * } + * + * // Constructor fn + * function OtherThing() { + * // Binds all functions from SomeService to SomeService, + * // then copies them to 'this' + * bindFunctions(SomeService, this, SomeService); + * } + * + * let myOtherThing = new OtherThing(); + * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this' + * ``` + * + * @param source A function that returns the source object which contains the original functions to be bound + * @param target A function that returns the target object which will receive the bound functions + * @param bind A function that returns the object which the functions will be bound to + * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object) + * @param latebind If true, the binding of the function is delayed until the first time it's invoked + */ +function createProxyFunctions(source, target, bind, fnNames, latebind) { + if (latebind === void 0) { latebind = false; } + var bindFunction = function (fnName) { return source()[fnName].bind(bind()); }; + var makeLateRebindFn = function (fnName) { + return function lateRebindFunction() { + target[fnName] = bindFunction(fnName); + return target[fnName].apply(null, arguments); + }; + }; + fnNames = fnNames || Object.keys(source()); + return fnNames.reduce(function (acc, name) { + acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name); + return acc; + }, target); +} +/** + * prototypal inheritance helper. + * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it + */ +var inherit = function (parent, extra) { return extend(Object.create(parent), extra); }; +/** Given an array, returns true if the object is found in the array, (using indexOf) */ +var inArray = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_inArray); +function _inArray(array, obj) { + return array.indexOf(obj) !== -1; +} +/** + * Given an array, and an item, if the item is found in the array, it removes it (in-place). + * The same array is returned + */ +var removeFrom = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_removeFrom); +function _removeFrom(array, obj) { + var idx = array.indexOf(obj); + if (idx >= 0) + array.splice(idx, 1); + return array; +} +/** pushes a values to an array and returns the value */ +var pushTo = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_pushTo); +function _pushTo(arr, val) { + return arr.push(val), val; +} +/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */ +var deregAll = function (functions) { + return functions.slice().forEach(function (fn) { + typeof fn === 'function' && fn(); + removeFrom(functions, fn); + }); +}; +/** + * Applies a set of defaults to an options object. The options object is filtered + * to only those properties of the objects in the defaultsList. + * Earlier objects in the defaultsList take precedence when applying defaults. + */ +function defaults(opts) { + var defaultsList = []; + for (var _i = 1; _i < arguments.length; _i++) { + defaultsList[_i - 1] = arguments[_i]; + } + var defaultVals = extend.apply(void 0, __spreadArrays([{}], defaultsList.reverse())); + return extend(defaultVals, pick(opts || {}, Object.keys(defaultVals))); +} +/** Reduce function that merges each element of the list into a single object, using extend */ +var mergeR = function (memo, item) { return extend(memo, item); }; +/** + * Finds the common ancestor path between two states. + * + * @param {Object} first The first state. + * @param {Object} second The second state. + * @return {Array} Returns an array of state names in descending order, not including the root. + */ +function ancestors(first, second) { + var path = []; + // tslint:disable-next-line:forin + for (var n in first.path) { + if (first.path[n] !== second.path[n]) + break; + path.push(first.path[n]); + } + return path; +} +/** + * Return a copy of the object only containing the whitelisted properties. + * + * #### Example: + * ``` + * var foo = { a: 1, b: 2, c: 3 }; + * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 } + * ``` + * @param obj the source object + * @param propNames an Array of strings, which are the whitelisted property names + */ +function pick(obj, propNames) { + var objCopy = {}; + for (var _prop in obj) { + if (propNames.indexOf(_prop) !== -1) { + objCopy[_prop] = obj[_prop]; + } + } + return objCopy; +} +/** + * Return a copy of the object omitting the blacklisted properties. + * + * @example + * ``` + * + * var foo = { a: 1, b: 2, c: 3 }; + * var ab = omit(foo, ['a', 'b']); // { c: 3 } + * ``` + * @param obj the source object + * @param propNames an Array of strings, which are the blacklisted property names + */ +function omit(obj, propNames) { + return Object.keys(obj) + .filter((0,_hof__WEBPACK_IMPORTED_MODULE_1__.not)(inArray(propNames))) + .reduce(function (acc, key) { return ((acc[key] = obj[key]), acc); }, {}); +} +/** + * Maps an array, or object to a property (by name) + */ +function pluck(collection, propName) { + return map(collection, (0,_hof__WEBPACK_IMPORTED_MODULE_1__.prop)(propName)); +} +/** Filters an Array or an Object's properties based on a predicate */ +function filter(collection, callback) { + var arr = (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(collection), result = arr ? [] : {}; + var accept = arr ? function (x) { return result.push(x); } : function (x, key) { return (result[key] = x); }; + forEach(collection, function (item, i) { + if (callback(item, i)) + accept(item, i); + }); + return result; +} +/** Finds an object from an array, or a property of an object, that matches a predicate */ +function find(collection, callback) { + var result; + forEach(collection, function (item, i) { + if (result) + return; + if (callback(item, i)) + result = item; + }); + return result; +} +/** Given an object, returns a new object, where each property is transformed by the callback function */ +var mapObj = map; +/** Maps an array or object properties using a callback function */ +function map(collection, callback, target) { + target = target || ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(collection) ? [] : {}); + forEach(collection, function (item, i) { return (target[i] = callback(item, i)); }); + return target; +} +/** + * Given an object, return its enumerable property values + * + * @example + * ``` + * + * let foo = { a: 1, b: 2, c: 3 } + * let vals = values(foo); // [ 1, 2, 3 ] + * ``` + */ +var values = function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); }; +/** + * Reduce function that returns true if all of the values are truthy. + * + * @example + * ``` + * + * let vals = [ 1, true, {}, "hello world"]; + * vals.reduce(allTrueR, true); // true + * + * vals.push(0); + * vals.reduce(allTrueR, true); // false + * ``` + */ +var allTrueR = function (memo, elem) { return memo && elem; }; +/** + * Reduce function that returns true if any of the values are truthy. + * + * * @example + * ``` + * + * let vals = [ 0, null, undefined ]; + * vals.reduce(anyTrueR, true); // false + * + * vals.push("hello world"); + * vals.reduce(anyTrueR, true); // true + * ``` + */ +var anyTrueR = function (memo, elem) { return memo || elem; }; +/** + * Reduce function which un-nests a single level of arrays + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * input.reduce(unnestR, []) // [ "a", "b", "c", "d", [ "double, "nested" ] ] + * ``` + */ +var unnestR = function (memo, elem) { return memo.concat(elem); }; +/** + * Reduce function which recursively un-nests all arrays + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ] + * ``` + */ +var flattenR = function (memo, elem) { + return (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem); +}; +/** + * Reduce function that pushes an object to an array, then returns the array. + * Mostly just for [[flattenR]] and [[uniqR]] + */ +function pushR(arr, obj) { + arr.push(obj); + return arr; +} +/** Reduce function that filters out duplicates */ +var uniqR = function (acc, token) { return (inArray(acc, token) ? acc : pushR(acc, token)); }; +/** + * Return a new array with a single level of arrays unnested. + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * unnest(input) // [ "a", "b", "c", "d", [ "double, "nested" ] ] + * ``` + */ +var unnest = function (arr) { return arr.reduce(unnestR, []); }; +/** + * Return a completely flattened version of an array. + * + * @example + * ``` + * + * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; + * flatten(input) // [ "a", "b", "c", "d", "double, "nested" ] + * ``` + */ +var flatten = function (arr) { return arr.reduce(flattenR, []); }; +/** + * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass. + * @example + * ``` + * + * let isNumber = (obj) => typeof(obj) === 'number'; + * let allNumbers = [ 1, 2, 3, 4, 5 ]; + * allNumbers.filter(assertPredicate(isNumber)); //OK + * + * let oneString = [ 1, 2, 3, 4, "5" ]; + * oneString.filter(assertPredicate(isNumber, "Not all numbers")); // throws Error(""Not all numbers""); + * ``` + */ +var assertPredicate = assertFn; +/** + * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test. + * @example + * ``` + * + * var data = { foo: 1, bar: 2 }; + * + * let keys = [ 'foo', 'bar' ] + * let values = keys.map(assertMap(key => data[key], "Key not found")); + * // values is [1, 2] + * + * let keys = [ 'foo', 'bar', 'baz' ] + * let values = keys.map(assertMap(key => data[key], "Key not found")); + * // throws Error("Key not found") + * ``` + */ +var assertMap = assertFn; +function assertFn(predicateOrMap, errMsg) { + if (errMsg === void 0) { errMsg = 'assert failure'; } + return function (obj) { + var result = predicateOrMap(obj); + if (!result) { + throw new Error((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(errMsg) ? errMsg(obj) : errMsg); + } + return result; + }; +} +/** + * Like _.pairs: Given an object, returns an array of key/value pairs + * + * @example + * ``` + * + * pairs({ foo: "FOO", bar: "BAR }) // [ [ "foo", "FOO" ], [ "bar": "BAR" ] ] + * ``` + */ +var pairs = function (obj) { return Object.keys(obj).map(function (key) { return [key, obj[key]]; }); }; +/** + * Given two or more parallel arrays, returns an array of tuples where + * each tuple is composed of [ a[i], b[i], ... z[i] ] + * + * @example + * ``` + * + * let foo = [ 0, 2, 4, 6 ]; + * let bar = [ 1, 3, 5, 7 ]; + * let baz = [ 10, 30, 50, 70 ]; + * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ] + * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ] + * ``` + */ +function arrayTuples() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (args.length === 0) + return []; + var maxArrayLen = args.reduce(function (min, arr) { return Math.min(arr.length, min); }, 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER + var result = []; + var _loop_1 = function (i) { + // This is a hot function + // Unroll when there are 1-4 arguments + switch (args.length) { + case 1: + result.push([args[0][i]]); + break; + case 2: + result.push([args[0][i], args[1][i]]); + break; + case 3: + result.push([args[0][i], args[1][i], args[2][i]]); + break; + case 4: + result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); + break; + default: + result.push(args.map(function (array) { return array[i]; })); + break; + } + }; + for (var i = 0; i < maxArrayLen; i++) { + _loop_1(i); + } + return result; +} +/** + * Reduce function which builds an object from an array of [key, value] pairs. + * + * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration. + * + * Each keyValueTuple should be an array with values [ key: string, value: any ] + * + * @example + * ``` + * + * var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ] + * + * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {}) + * // pairsToObj == { fookey: "fooval", barkey: "barval" } + * + * // Or, more simply: + * var pairsToObj = pairs.reduce(applyPairs, {}) + * // pairsToObj == { fookey: "fooval", barkey: "barval" } + * ``` + */ +function applyPairs(memo, keyValTuple) { + var key, value; + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(keyValTuple)) + key = keyValTuple[0], value = keyValTuple[1]; + if (!(0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(key)) + throw new Error('invalid parameters to applyPairs'); + memo[key] = value; + return memo; +} +/** Get the last element of an array */ +function tail(arr) { + return (arr.length && arr[arr.length - 1]) || undefined; +} +/** + * shallow copy from src to dest + */ +function copy(src, dest) { + if (dest) + Object.keys(dest).forEach(function (key) { return delete dest[key]; }); + if (!dest) + dest = {}; + return extend(dest, src); +} +/** Naive forEach implementation works with Objects or Arrays */ +function _forEach(obj, cb, _this) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(obj)) + return obj.forEach(cb, _this); + Object.keys(obj).forEach(function (key) { return cb(obj[key], key); }); +} +function _extend(toObj) { + for (var i = 1; i < arguments.length; i++) { + var obj = arguments[i]; + if (!obj) + continue; + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; j++) { + toObj[keys[j]] = obj[keys[j]]; + } + } + return toObj; +} +function _equals(o1, o2) { + if (o1 === o2) + return true; + if (o1 === null || o2 === null) + return false; + if (o1 !== o1 && o2 !== o2) + return true; // NaN === NaN + var t1 = typeof o1, t2 = typeof o2; + if (t1 !== t2 || t1 !== 'object') + return false; + var tup = [o1, o2]; + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(tup)) + return _arraysEq(o1, o2); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isDate)(tup)) + return o1.getTime() === o2.getTime(); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isRegExp)(tup)) + return o1.toString() === o2.toString(); + if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(tup)) + return true; // meh + var predicates = [_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction, _predicates__WEBPACK_IMPORTED_MODULE_0__.isArray, _predicates__WEBPACK_IMPORTED_MODULE_0__.isDate, _predicates__WEBPACK_IMPORTED_MODULE_0__.isRegExp]; + if (predicates.map(_hof__WEBPACK_IMPORTED_MODULE_1__.any).reduce(function (b, fn) { return b || !!fn(tup); }, false)) + return false; + var keys = {}; + // tslint:disable-next-line:forin + for (var key in o1) { + if (!_equals(o1[key], o2[key])) + return false; + keys[key] = true; + } + for (var key in o2) { + if (!keys[key]) + return false; + } + return true; +} +function _arraysEq(a1, a2) { + if (a1.length !== a2.length) + return false; + return arrayTuples(a1, a2).reduce(function (b, t) { return b && _equals(t[0], t[1]); }, true); +} +// issue #2676 +var silenceUncaughtInPromise = function (promise) { return promise.catch(function (e) { return 0; }) && promise; }; +var silentRejection = function (error) { return silenceUncaughtInPromise(_coreservices__WEBPACK_IMPORTED_MODULE_2__.services.$q.reject(error)); }; +//# sourceMappingURL=common.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/coreservices.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "makeStub": () => (/* binding */ makeStub), +/* harmony export */ "services": () => (/* binding */ services) +/* harmony export */ }); +var noImpl = function (fnname) { return function () { + throw new Error("No implementation for " + fnname + ". The framework specific code did not implement this method."); +}; }; +var makeStub = function (service, methods) { + return methods.reduce(function (acc, key) { return ((acc[key] = noImpl(service + "." + key + "()")), acc); }, {}); +}; +var services = { + $q: undefined, + $injector: undefined, +}; + +//# sourceMappingURL=coreservices.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/glob.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/glob.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Glob": () => (/* binding */ Glob) +/* harmony export */ }); +/** + * Matches state names using glob-like pattern strings. + * + * Globs can be used in specific APIs including: + * + * - [[StateService.is]] + * - [[StateService.includes]] + * - The first argument to Hook Registration functions like [[TransitionService.onStart]] + * - [[HookMatchCriteria]] and [[HookMatchCriterion]] + * + * A `Glob` string is a pattern which matches state names. + * Nested state names are split into segments (separated by a dot) when processing. + * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz'] + * + * Globs work according to the following rules: + * + * ### Exact match: + * + * The glob `'A.B'` matches the state named exactly `'A.B'`. + * + * | Glob |Matches states named|Does not match state named| + * |:------------|:--------------------|:---------------------| + * | `'A'` | `'A'` | `'B'` , `'A.C'` | + * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` | + * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`| + * + * ### Single star (`*`) + * + * A single star (`*`) is a wildcard that matches exactly one segment. + * + * | Glob |Matches states named |Does not match state named | + * |:------------|:---------------------|:--------------------------| + * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` | + * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` | + * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`| + * + * ### Double star (`**`) + * + * A double star (`'**'`) is a wildcard that matches *zero or more segments* + * + * | Glob |Matches states named |Does not match state named | + * |:------------|:----------------------------------------------|:----------------------------------| + * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) | + * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` | + * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` | + * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` | + * + * @packageDocumentation + */ +var Glob = /** @class */ (function () { + function Glob(text) { + this.text = text; + this.glob = text.split('.'); + var regexpString = this.text + .split('.') + .map(function (seg) { + if (seg === '**') + return '(?:|(?:\\.[^.]*)*)'; + if (seg === '*') + return '\\.[^.]*'; + return '\\.' + seg; + }) + .join(''); + this.regexp = new RegExp('^' + regexpString + '$'); + } + /** Returns true if the string has glob-like characters in it */ + Glob.is = function (text) { + return !!/[!,*]+/.exec(text); + }; + /** Returns a glob from the string, or null if the string isn't Glob-like */ + Glob.fromString = function (text) { + return Glob.is(text) ? new Glob(text) : null; + }; + Glob.prototype.matches = function (name) { + return this.regexp.test('.' + name); + }; + return Glob; +}()); + +//# sourceMappingURL=glob.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/hof.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/hof.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "curry": () => (/* binding */ curry), +/* harmony export */ "compose": () => (/* binding */ compose), +/* harmony export */ "pipe": () => (/* binding */ pipe), +/* harmony export */ "prop": () => (/* binding */ prop), +/* harmony export */ "propEq": () => (/* binding */ propEq), +/* harmony export */ "parse": () => (/* binding */ parse), +/* harmony export */ "not": () => (/* binding */ not), +/* harmony export */ "and": () => (/* binding */ and), +/* harmony export */ "or": () => (/* binding */ or), +/* harmony export */ "all": () => (/* binding */ all), +/* harmony export */ "any": () => (/* binding */ any), +/* harmony export */ "is": () => (/* binding */ is), +/* harmony export */ "eq": () => (/* binding */ eq), +/* harmony export */ "val": () => (/* binding */ val), +/* harmony export */ "invoke": () => (/* binding */ invoke), +/* harmony export */ "pattern": () => (/* binding */ pattern) +/* harmony export */ }); +/** + * Higher order functions + * + * These utility functions are exported, but are subject to change without notice. + * + * @packageDocumentation + */ +var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; +/** + * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function. + * + * Given a function with N parameters, returns a new function that supports partial application. + * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters, + * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to + * accept more parameters until all N parameters have been supplied. + * + * + * This contrived example uses a partially applied function as an predicate, which returns true + * if an object is found in both arrays. + * @example + * ``` + * // returns true if an object is in both of the two arrays + * function inBoth(array1, array2, object) { + * return array1.indexOf(object) !== -1 && + * array2.indexOf(object) !== 1; + * } + * let obj1, obj2, obj3, obj4, obj5, obj6, obj7 + * let foos = [obj1, obj3] + * let bars = [obj3, obj4, obj5] + * + * // A curried "copy" of inBoth + * let curriedInBoth = curry(inBoth); + * // Partially apply both the array1 and array2 + * let inFoosAndBars = curriedInBoth(foos, bars); + * + * // Supply the final argument; since all arguments are + * // supplied, the original inBoth function is then called. + * let obj1InBoth = inFoosAndBars(obj1); // false + * + * // Use the inFoosAndBars as a predicate. + * // Filter, on each iteration, supplies the final argument + * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ]; + * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ] + * + * ``` + * + * @param fn + * @returns {*|function(): (*|any)} + */ +function curry(fn) { + return function curried() { + if (arguments.length >= fn.length) { + return fn.apply(this, arguments); + } + var args = Array.prototype.slice.call(arguments); + return curried.bind.apply(curried, __spreadArrays([this], args)); + }; +} +/** + * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left + * given: f(x), g(x), h(x) + * let composed = compose(f,g,h) + * then, composed is: f(g(h(x))) + */ +function compose() { + var args = arguments; + var start = args.length - 1; + return function () { + var i = start, result = args[start].apply(this, arguments); + while (i--) + result = args[i].call(this, result); + return result; + }; +} +/** + * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right + * given: f(x), g(x), h(x) + * let piped = pipe(f,g,h); + * then, piped is: h(g(f(x))) + */ +function pipe() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i] = arguments[_i]; + } + return compose.apply(null, [].slice.call(arguments).reverse()); +} +/** + * Given a property name, returns a function that returns that property from an object + * let obj = { foo: 1, name: "blarg" }; + * let getName = prop("name"); + * getName(obj) === "blarg" + */ +var prop = function (name) { return function (obj) { return obj && obj[name]; }; }; +/** + * Given a property name and a value, returns a function that returns a boolean based on whether + * the passed object has a property that matches the value + * let obj = { foo: 1, name: "blarg" }; + * let getName = propEq("name", "blarg"); + * getName(obj) === true + */ +var propEq = curry(function (name, _val, obj) { return obj && obj[name] === _val; }); +/** + * Given a dotted property name, returns a function that returns a nested property from an object, or undefined + * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, }; + * let getName = prop("nestedObj.name"); + * getName(obj) === "blarg" + * let propNotFound = prop("this.property.doesnt.exist"); + * propNotFound(obj) === undefined + */ +var parse = function (name) { return pipe.apply(null, name.split('.').map(prop)); }; +/** + * Given a function that returns a truthy or falsey value, returns a + * function that returns the opposite (falsey or truthy) value given the same inputs + */ +var not = function (fn) { return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return !fn.apply(null, args); +}; }; +/** + * Given two functions that return truthy or falsey values, returns a function that returns truthy + * if both functions return truthy for the given arguments + */ +function and(fn1, fn2) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn1.apply(null, args) && fn2.apply(null, args); + }; +} +/** + * Given two functions that return truthy or falsey values, returns a function that returns truthy + * if at least one of the functions returns truthy for the given arguments + */ +function or(fn1, fn2) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn1.apply(null, args) || fn2.apply(null, args); + }; +} +/** + * Check if all the elements of an array match a predicate function + * + * @param fn1 a predicate function `fn1` + * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array + */ +var all = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b && !!fn1(x); }, true); }; }; +// tslint:disable-next-line:variable-name +var any = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b || !!fn1(x); }, false); }; }; +/** Given a class, returns a Predicate function that returns true if the object is of that class */ +var is = function (ctor) { return function (obj) { + return (obj != null && obj.constructor === ctor) || obj instanceof ctor; +}; }; +/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */ +var eq = function (value) { return function (other) { return value === other; }; }; +/** Given a value, returns a function which returns the value */ +var val = function (v) { return function () { return v; }; }; +function invoke(fnName, args) { + return function (obj) { return obj[fnName].apply(obj, args); }; +} +/** + * Sorta like Pattern Matching (a functional programming conditional construct) + * + * See http://c2.com/cgi/wiki?PatternMatching + * + * This is a conditional construct which allows a series of predicates and output functions + * to be checked and then applied. Each predicate receives the input. If the predicate + * returns truthy, then its matching output function (mapping function) is provided with + * the input and, then the result is returned. + * + * Each combination (2-tuple) of predicate + output function should be placed in an array + * of size 2: [ predicate, mapFn ] + * + * These 2-tuples should be put in an outer array. + * + * @example + * ``` + * + * // Here's a 2-tuple where the first element is the isString predicate + * // and the second element is a function that returns a description of the input + * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ]; + * + * // Second tuple: predicate "isNumber", mapfn returns a description + * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ]; + * + * let third = [ (input) => input === null, (input) => `Oh, null...` ]; + * + * let fourth = [ (input) => input === undefined, (input) => `notdefined` ]; + * + * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]); + * + * console.log(descriptionOf(undefined)); // 'notdefined' + * console.log(descriptionOf(55)); // '(55) That's a number!' + * console.log(descriptionOf("foo")); // 'Here's your string foo' + * ``` + * + * @param struct A 2D array. Each element of the array should be an array, a 2-tuple, + * with a Predicate and a mapping/output function + * @returns {function(any): *} + */ +function pattern(struct) { + return function (x) { + for (var i = 0; i < struct.length; i++) { + if (struct[i][0](x)) + return struct[i][1](x); + } + }; +} +//# sourceMappingURL=hof.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/index.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "_extend": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._extend), +/* harmony export */ "_inArray": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._inArray), +/* harmony export */ "_pushTo": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._pushTo), +/* harmony export */ "_removeFrom": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._removeFrom), +/* harmony export */ "allTrueR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.allTrueR), +/* harmony export */ "ancestors": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.ancestors), +/* harmony export */ "anyTrueR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.anyTrueR), +/* harmony export */ "applyPairs": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.applyPairs), +/* harmony export */ "arrayTuples": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples), +/* harmony export */ "assertFn": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertFn), +/* harmony export */ "assertMap": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertMap), +/* harmony export */ "assertPredicate": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertPredicate), +/* harmony export */ "copy": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.copy), +/* harmony export */ "createProxyFunctions": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions), +/* harmony export */ "defaults": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.defaults), +/* harmony export */ "deregAll": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.deregAll), +/* harmony export */ "equals": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.equals), +/* harmony export */ "extend": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.extend), +/* harmony export */ "filter": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.filter), +/* harmony export */ "find": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.find), +/* harmony export */ "flatten": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.flatten), +/* harmony export */ "flattenR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.flattenR), +/* harmony export */ "forEach": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.forEach), +/* harmony export */ "fromJson": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.fromJson), +/* harmony export */ "identity": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.identity), +/* harmony export */ "inArray": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.inArray), +/* harmony export */ "inherit": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.inherit), +/* harmony export */ "map": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.map), +/* harmony export */ "mapObj": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.mapObj), +/* harmony export */ "mergeR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.mergeR), +/* harmony export */ "noop": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.noop), +/* harmony export */ "omit": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.omit), +/* harmony export */ "pairs": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pairs), +/* harmony export */ "pick": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pick), +/* harmony export */ "pluck": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pluck), +/* harmony export */ "pushR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pushR), +/* harmony export */ "pushTo": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pushTo), +/* harmony export */ "removeFrom": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.removeFrom), +/* harmony export */ "root": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.root), +/* harmony export */ "silenceUncaughtInPromise": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.silentRejection), +/* harmony export */ "tail": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.tail), +/* harmony export */ "toJson": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.toJson), +/* harmony export */ "uniqR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.uniqR), +/* harmony export */ "unnest": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.unnest), +/* harmony export */ "unnestR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.unnestR), +/* harmony export */ "values": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.values), +/* harmony export */ "makeStub": () => (/* reexport safe */ _coreservices__WEBPACK_IMPORTED_MODULE_1__.makeStub), +/* harmony export */ "services": () => (/* reexport safe */ _coreservices__WEBPACK_IMPORTED_MODULE_1__.services), +/* harmony export */ "Glob": () => (/* reexport safe */ _glob__WEBPACK_IMPORTED_MODULE_2__.Glob), +/* harmony export */ "all": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.all), +/* harmony export */ "and": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.and), +/* harmony export */ "any": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.any), +/* harmony export */ "compose": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.compose), +/* harmony export */ "curry": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.curry), +/* harmony export */ "eq": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.eq), +/* harmony export */ "invoke": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.invoke), +/* harmony export */ "is": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.is), +/* harmony export */ "not": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.not), +/* harmony export */ "or": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.or), +/* harmony export */ "parse": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.parse), +/* harmony export */ "pattern": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.pattern), +/* harmony export */ "pipe": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.pipe), +/* harmony export */ "prop": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.prop), +/* harmony export */ "propEq": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.propEq), +/* harmony export */ "val": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.val), +/* harmony export */ "isArray": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isArray), +/* harmony export */ "isDate": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isDate), +/* harmony export */ "isDefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isDefined), +/* harmony export */ "isFunction": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction), +/* harmony export */ "isInjectable": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isInjectable), +/* harmony export */ "isNull": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNull), +/* harmony export */ "isNullOrUndefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNullOrUndefined), +/* harmony export */ "isNumber": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNumber), +/* harmony export */ "isObject": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isObject), +/* harmony export */ "isPromise": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isPromise), +/* harmony export */ "isRegExp": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isRegExp), +/* harmony export */ "isString": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isString), +/* harmony export */ "isUndefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isUndefined), +/* harmony export */ "Queue": () => (/* reexport safe */ _queue__WEBPACK_IMPORTED_MODULE_5__.Queue), +/* harmony export */ "beforeAfterSubstr": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.beforeAfterSubstr), +/* harmony export */ "fnToString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.fnToString), +/* harmony export */ "functionToString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.functionToString), +/* harmony export */ "hostRegex": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.hostRegex), +/* harmony export */ "joinNeighborsR": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.joinNeighborsR), +/* harmony export */ "kebobString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.kebobString), +/* harmony export */ "maxLength": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.maxLength), +/* harmony export */ "padString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.padString), +/* harmony export */ "splitEqual": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitEqual), +/* harmony export */ "splitHash": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitHash), +/* harmony export */ "splitOnDelim": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitOnDelim), +/* harmony export */ "splitQuery": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitQuery), +/* harmony export */ "stringify": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.stringify), +/* harmony export */ "stripLastPathElement": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.stripLastPathElement), +/* harmony export */ "trimHashVal": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.trimHashVal), +/* harmony export */ "Category": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.Category), +/* harmony export */ "Trace": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.Trace), +/* harmony export */ "trace": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.trace) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _glob__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _queue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); +/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _trace__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/predicates.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/predicates.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "isUndefined": () => (/* binding */ isUndefined), +/* harmony export */ "isDefined": () => (/* binding */ isDefined), +/* harmony export */ "isNull": () => (/* binding */ isNull), +/* harmony export */ "isNullOrUndefined": () => (/* binding */ isNullOrUndefined), +/* harmony export */ "isFunction": () => (/* binding */ isFunction), +/* harmony export */ "isNumber": () => (/* binding */ isNumber), +/* harmony export */ "isString": () => (/* binding */ isString), +/* harmony export */ "isObject": () => (/* binding */ isObject), +/* harmony export */ "isArray": () => (/* binding */ isArray), +/* harmony export */ "isDate": () => (/* binding */ isDate), +/* harmony export */ "isRegExp": () => (/* binding */ isRegExp), +/* harmony export */ "isInjectable": () => (/* binding */ isInjectable), +/* harmony export */ "isPromise": () => (/* binding */ isPromise) +/* harmony export */ }); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/** + * Predicates + * + * These predicates return true/false based on the input. + * Although these functions are exported, they are subject to change without notice. + * + * @packageDocumentation + */ + +var toStr = Object.prototype.toString; +var tis = function (t) { return function (x) { return typeof x === t; }; }; +var isUndefined = tis('undefined'); +var isDefined = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isUndefined); +var isNull = function (o) { return o === null; }; +var isNullOrUndefined = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.or)(isNull, isUndefined); +var isFunction = tis('function'); +var isNumber = tis('number'); +var isString = tis('string'); +var isObject = function (x) { return x !== null && typeof x === 'object'; }; +var isArray = Array.isArray; +var isDate = (function (x) { return toStr.call(x) === '[object Date]'; }); +var isRegExp = (function (x) { return toStr.call(x) === '[object RegExp]'; }); +/** + * Predicate which checks if a value is injectable + * + * A value is "injectable" if it is a function, or if it is an ng1 array-notation-style array + * where all the elements in the array are Strings, except the last one, which is a Function + */ +function isInjectable(val) { + if (isArray(val) && val.length) { + var head = val.slice(0, -1), tail = val.slice(-1); + return !(head.filter((0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isString)).length || tail.filter((0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isFunction)).length); + } + return isFunction(val); +} +/** + * Predicate which checks if a value looks like a Promise + * + * It is probably a Promise if it's an object, and it has a `then` property which is a Function + */ +var isPromise = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.and)(isObject, (0,_hof__WEBPACK_IMPORTED_MODULE_0__.pipe)((0,_hof__WEBPACK_IMPORTED_MODULE_0__.prop)('then'), isFunction)); +//# sourceMappingURL=predicates.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/queue.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/queue.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Queue": () => (/* binding */ Queue) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +var Queue = /** @class */ (function () { + function Queue(_items, _limit) { + if (_items === void 0) { _items = []; } + if (_limit === void 0) { _limit = null; } + this._items = _items; + this._limit = _limit; + this._evictListeners = []; + this.onEvict = (0,_common__WEBPACK_IMPORTED_MODULE_0__.pushTo)(this._evictListeners); + } + Queue.prototype.enqueue = function (item) { + var items = this._items; + items.push(item); + if (this._limit && items.length > this._limit) + this.evict(); + return item; + }; + Queue.prototype.evict = function () { + var item = this._items.shift(); + this._evictListeners.forEach(function (fn) { return fn(item); }); + return item; + }; + Queue.prototype.dequeue = function () { + if (this.size()) + return this._items.splice(0, 1)[0]; + }; + Queue.prototype.clear = function () { + var current = this._items; + this._items = []; + return current; + }; + Queue.prototype.size = function () { + return this._items.length; + }; + Queue.prototype.remove = function (item) { + var idx = this._items.indexOf(item); + return idx > -1 && this._items.splice(idx, 1)[0]; + }; + Queue.prototype.peekTail = function () { + return this._items[this._items.length - 1]; + }; + Queue.prototype.peekHead = function () { + if (this.size()) + return this._items[0]; + }; + return Queue; +}()); + +//# sourceMappingURL=queue.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/safeConsole.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "safeConsole": () => (/* binding */ safeConsole) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/** + * workaround for missing console object in IE9 when dev tools haven't been opened o_O + * @packageDocumentation + */ +/* tslint:disable:no-console */ + +var noopConsoleStub = { log: _common__WEBPACK_IMPORTED_MODULE_0__.noop, error: _common__WEBPACK_IMPORTED_MODULE_0__.noop, table: _common__WEBPACK_IMPORTED_MODULE_0__.noop }; +function ie9Console(console) { + var bound = function (fn) { return Function.prototype.bind.call(fn, console); }; + return { + log: bound(console.log), + error: bound(console.log), + table: bound(console.log), + }; +} +function fallbackConsole(console) { + var log = console.log.bind(console); + var error = console.error ? console.error.bind(console) : log; + var table = console.table ? console.table.bind(console) : log; + return { log: log, error: error, table: table }; +} +function getSafeConsole() { + // @ts-ignore + var isIE9 = typeof document !== 'undefined' && document.documentMode && document.documentMode === 9; + if (isIE9) { + return window && window.console ? ie9Console(window.console) : noopConsoleStub; + } + else if (!console.table || !console.error) { + return fallbackConsole(console); + } + else { + return console; + } +} +var safeConsole = getSafeConsole(); +//# sourceMappingURL=safeConsole.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/strings.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/strings.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "maxLength": () => (/* binding */ maxLength), +/* harmony export */ "padString": () => (/* binding */ padString), +/* harmony export */ "kebobString": () => (/* binding */ kebobString), +/* harmony export */ "functionToString": () => (/* binding */ functionToString), +/* harmony export */ "fnToString": () => (/* binding */ fnToString), +/* harmony export */ "stringify": () => (/* binding */ stringify), +/* harmony export */ "beforeAfterSubstr": () => (/* binding */ beforeAfterSubstr), +/* harmony export */ "hostRegex": () => (/* binding */ hostRegex), +/* harmony export */ "stripLastPathElement": () => (/* binding */ stripLastPathElement), +/* harmony export */ "splitHash": () => (/* binding */ splitHash), +/* harmony export */ "splitQuery": () => (/* binding */ splitQuery), +/* harmony export */ "splitEqual": () => (/* binding */ splitEqual), +/* harmony export */ "trimHashVal": () => (/* binding */ trimHashVal), +/* harmony export */ "splitOnDelim": () => (/* binding */ splitOnDelim), +/* harmony export */ "joinNeighborsR": () => (/* binding */ joinNeighborsR) +/* harmony export */ }); +/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/** + * Functions that manipulate strings + * + * Although these functions are exported, they are subject to change without notice. + * + * @packageDocumentation + */ + + + + +/** + * Returns a string shortened to a maximum length + * + * If the string is already less than the `max` length, return the string. + * Else return the string, shortened to `max - 3` and append three dots ("..."). + * + * @param max the maximum length of the string to return + * @param str the input string + */ +function maxLength(max, str) { + if (str.length <= max) + return str; + return str.substr(0, max - 3) + '...'; +} +/** + * Returns a string, with spaces added to the end, up to a desired str length + * + * If the string is already longer than the desired length, return the string. + * Else returns the string, with extra spaces on the end, such that it reaches `length` characters. + * + * @param length the desired length of the string to return + * @param str the input string + */ +function padString(length, str) { + while (str.length < length) + str += ' '; + return str; +} +function kebobString(camelCase) { + return camelCase + .replace(/^([A-Z])/, function ($1) { return $1.toLowerCase(); }) // replace first char + .replace(/([A-Z])/g, function ($1) { return '-' + $1.toLowerCase(); }); // replace rest +} +function functionToString(fn) { + var fnStr = fnToString(fn); + var namedFunctionMatch = fnStr.match(/^(function [^ ]+\([^)]*\))/); + var toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr; + var fnName = fn['name'] || ''; + if (fnName && toStr.match(/function \(/)) { + return 'function ' + fnName + toStr.substr(9); + } + return toStr; +} +function fnToString(fn) { + var _fn = (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(fn) ? fn.slice(-1)[0] : fn; + return (_fn && _fn.toString()) || 'undefined'; +} +var isRejection = _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__.Rejection.isRejectionPromise; +var hasToString = function (obj) { + return (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(obj) && !(0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(obj) && obj.constructor !== Object && (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(obj.toString); +}; +var stringifyPattern = (0,_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('undefined')], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isNull, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('null')], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isPromise, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('[Promise]')], + [isRejection, function (x) { return x._transitionRejection.toString(); }], + [hasToString, function (x) { return x.toString(); }], + [_predicates__WEBPACK_IMPORTED_MODULE_0__.isInjectable, functionToString], + [(0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)(true), _common__WEBPACK_IMPORTED_MODULE_2__.identity], +]); +function stringify(o) { + var seen = []; + function format(value) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(value)) { + if (seen.indexOf(value) !== -1) + return '[circular ref]'; + seen.push(value); + } + return stringifyPattern(value); + } + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(o)) { + // Workaround for IE & Edge Spec incompatibility where replacer function would not be called when JSON.stringify + // is given `undefined` as value. To work around that, we simply detect `undefined` and bail out early by + // manually stringifying it. + return format(o); + } + return JSON.stringify(o, function (key, value) { return format(value); }).replace(/\\"/g, '"'); +} +/** Returns a function that splits a string on a character or substring */ +var beforeAfterSubstr = function (char) { return function (str) { + if (!str) + return ['', '']; + var idx = str.indexOf(char); + if (idx === -1) + return [str, '']; + return [str.substr(0, idx), str.substr(idx + 1)]; +}; }; +var hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/'); +var stripLastPathElement = function (str) { return str.replace(/\/[^/]*$/, ''); }; +var splitHash = beforeAfterSubstr('#'); +var splitQuery = beforeAfterSubstr('?'); +var splitEqual = beforeAfterSubstr('='); +var trimHashVal = function (str) { return (str ? str.replace(/^#/, '') : ''); }; +/** + * Splits on a delimiter, but returns the delimiters in the array + * + * #### Example: + * ```js + * var splitOnSlashes = splitOnDelim('/'); + * splitOnSlashes("/foo"); // ["/", "foo"] + * splitOnSlashes("/foo/"); // ["/", "foo", "/"] + * ``` + */ +function splitOnDelim(delim) { + var re = new RegExp('(' + delim + ')', 'g'); + return function (str) { return str.split(re).filter(_common__WEBPACK_IMPORTED_MODULE_2__.identity); }; +} +/** + * Reduce fn that joins neighboring strings + * + * Given an array of strings, returns a new array + * where all neighboring strings have been joined. + * + * #### Example: + * ```js + * let arr = ["foo", "bar", 1, "baz", "", "qux" ]; + * arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ] + * ``` + */ +function joinNeighborsR(acc, x) { + if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)((0,_common__WEBPACK_IMPORTED_MODULE_2__.tail)(acc)) && (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(x)) + return acc.slice(0, -1).concat((0,_common__WEBPACK_IMPORTED_MODULE_2__.tail)(acc) + x); + return (0,_common__WEBPACK_IMPORTED_MODULE_2__.pushR)(acc, x); +} +//# sourceMappingURL=strings.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/common/trace.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/common/trace.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Category": () => (/* binding */ Category), +/* harmony export */ "Trace": () => (/* binding */ Trace), +/* harmony export */ "trace": () => (/* binding */ trace) +/* harmony export */ }); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _safeConsole__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./safeConsole */ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"); +/** + * # Transition tracing (debug) + * + * Enable transition tracing to print transition information to the console, + * in order to help debug your application. + * Tracing logs detailed information about each Transition to your console. + * + * To enable tracing, import the [[Trace]] singleton and enable one or more categories. + * + * ### ES6 + * ```js + * import {trace} from "@uirouter/core"; + * trace.enable(1, 5); // TRANSITION and VIEWCONFIG + * ``` + * + * ### CJS + * ```js + * let trace = require("@uirouter/core").trace; + * trace.enable("TRANSITION", "VIEWCONFIG"); + * ``` + * + * ### Globals + * ```js + * let trace = window["@uirouter/core"].trace; + * trace.enable(); // Trace everything (very verbose) + * ``` + * + * ### Angular 1: + * ```js + * app.run($trace => $trace.enable()); + * ``` + * + * @packageDocumentation + */ + + + + +function uiViewString(uiview) { + if (!uiview) + return 'ui-view (defunct)'; + var state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)'; + return "[ui-view#" + uiview.id + " " + uiview.$type + ":" + uiview.fqn + " (" + uiview.name + "@" + state + ")]"; +} +var viewConfigString = function (viewConfig) { + var view = viewConfig.viewDecl; + var state = view.$context.name || '(root)'; + return "[View#" + viewConfig.$id + " from '" + state + "' state]: target ui-view: '" + view.$uiViewName + "@" + view.$uiViewContextAnchor + "'"; +}; +function normalizedCat(input) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isNumber)(input) ? Category[input] : Category[Category[input]]; +} +/** + * Trace categories Enum + * + * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]] + * + * `trace.enable(Category.TRANSITION)` + * + * These can also be provided using a matching string, or position ordinal + * + * `trace.enable("TRANSITION")` + * + * `trace.enable(1)` + */ +var Category; +(function (Category) { + Category[Category["RESOLVE"] = 0] = "RESOLVE"; + Category[Category["TRANSITION"] = 1] = "TRANSITION"; + Category[Category["HOOK"] = 2] = "HOOK"; + Category[Category["UIVIEW"] = 3] = "UIVIEW"; + Category[Category["VIEWCONFIG"] = 4] = "VIEWCONFIG"; +})(Category || (Category = {})); + +var _tid = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('$id'); +var _rid = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('router.$id'); +var transLbl = function (trans) { return "Transition #" + _tid(trans) + "-" + _rid(trans); }; +/** + * Prints UI-Router Transition trace information to the console. + */ +var Trace = /** @class */ (function () { + /** @internal */ + function Trace() { + /** @internal */ + this._enabled = {}; + this.approximateDigests = 0; + } + /** @internal */ + Trace.prototype._set = function (enabled, categories) { + var _this = this; + if (!categories.length) { + categories = Object.keys(Category) + .map(function (k) { return parseInt(k, 10); }) + .filter(function (k) { return !isNaN(k); }) + .map(function (key) { return Category[key]; }); + } + categories.map(normalizedCat).forEach(function (category) { return (_this._enabled[category] = enabled); }); + }; + Trace.prototype.enable = function () { + var categories = []; + for (var _i = 0; _i < arguments.length; _i++) { + categories[_i] = arguments[_i]; + } + this._set(true, categories); + }; + Trace.prototype.disable = function () { + var categories = []; + for (var _i = 0; _i < arguments.length; _i++) { + categories[_i] = arguments[_i]; + } + this._set(false, categories); + }; + /** + * Retrieves the enabled stateus of a [[Category]] + * + * ```js + * trace.enabled("VIEWCONFIG"); // true or false + * ``` + * + * @returns boolean true if the category is enabled + */ + Trace.prototype.enabled = function (category) { + return !!this._enabled[normalizedCat(category)]; + }; + /** @internal called by ui-router code */ + Trace.prototype.traceTransitionStart = function (trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Started -> " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceTransitionIgnored = function (trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Ignored <> " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceHookInvocation = function (step, trans, options) { + if (!this.enabled(Category.HOOK)) + return; + var event = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.hookType')(options) || 'internal', context = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.context.state.name')(options) || (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.context')(options) || 'unknown', name = (0,_strings__WEBPACK_IMPORTED_MODULE_2__.functionToString)(step.registeredHook.callback); + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Hook -> " + event + " context: " + context + ", " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, name)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceHookResult = function (hookResult, trans, transitionOptions) { + if (!this.enabled(Category.HOOK)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Hook returned: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(hookResult))); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceResolvePath = function (path, when, trans) { + if (!this.enabled(Category.RESOLVE)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Resolving " + path + " (" + when + ")"); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceResolvableResolved = function (resolvable, trans) { + if (!this.enabled(Category.RESOLVE)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Resolved " + resolvable + " to: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(resolvable.data))); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceError = function (reason, trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Rejected " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans) + ", reason: " + reason); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceSuccess = function (finalState, trans) { + if (!this.enabled(Category.TRANSITION)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Success " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans) + ", final state: " + finalState.name); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewEvent = function (event, viewData, extra) { + if (extra === void 0) { extra = ''; } + if (!this.enabled(Category.UIVIEW)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("ui-view: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.padString)(30, event) + " " + uiViewString(viewData) + extra); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewConfigUpdated = function (viewData, context) { + if (!this.enabled(Category.UIVIEW)) + return; + this.traceUIViewEvent('Updating', viewData, " with ViewConfig from context='" + context + "'"); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceUIViewFill = function (viewData, html) { + if (!this.enabled(Category.UIVIEW)) + return; + this.traceUIViewEvent('Fill', viewData, " with: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, html)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewSync = function (pairs) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + var uivheader = 'uiview component fqn'; + var cfgheader = 'view config state (view name)'; + var mapping = pairs + .map(function (_a) { + var _b; + var uiView = _a.uiView, viewConfig = _a.viewConfig; + var uiv = uiView && uiView.fqn; + var cfg = viewConfig && viewConfig.viewDecl.$context.name + ": (" + viewConfig.viewDecl.$name + ")"; + return _b = {}, _b[uivheader] = uiv, _b[cfgheader] = cfg, _b; + }) + .sort(function (a, b) { return (a[uivheader] || '').localeCompare(b[uivheader] || ''); }); + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.table(mapping); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewServiceEvent = function (event, viewConfig) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("VIEWCONFIG: " + event + " " + viewConfigString(viewConfig)); + }; + /** @internal called by ui-router code */ + Trace.prototype.traceViewServiceUIViewEvent = function (event, viewData) { + if (!this.enabled(Category.VIEWCONFIG)) + return; + _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("VIEWCONFIG: " + event + " " + uiViewString(viewData)); + }; + return Trace; +}()); + +/** + * The [[Trace]] singleton + * + * #### Example: + * ```js + * import {trace} from "@uirouter/core"; + * trace.enable(1, 5); + * ``` + */ +var trace = new Trace(); + +//# sourceMappingURL=trace.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/globals.js": +/*!********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/globals.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouterGlobals": () => (/* binding */ UIRouterGlobals) +/* harmony export */ }); +/* harmony import */ var _params_stateParams__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./params/stateParams */ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js"); +/* harmony import */ var _common_queue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./common/queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); + + +/** + * Global router state + * + * This is where we hold the global mutable state such as current state, current + * params, current transition, etc. + */ +var UIRouterGlobals = /** @class */ (function () { + function UIRouterGlobals() { + /** + * Current parameter values + * + * The parameter values from the latest successful transition + */ + this.params = new _params_stateParams__WEBPACK_IMPORTED_MODULE_0__.StateParams(); + /** @internal */ + this.lastStartedTransitionId = -1; + /** @internal */ + this.transitionHistory = new _common_queue__WEBPACK_IMPORTED_MODULE_1__.Queue([], 1); + /** @internal */ + this.successfulTransitions = new _common_queue__WEBPACK_IMPORTED_MODULE_1__.Queue([], 1); + } + UIRouterGlobals.prototype.dispose = function () { + this.transitionHistory.clear(); + this.successfulTransitions.clear(); + this.transition = null; + }; + return UIRouterGlobals; +}()); + +//# sourceMappingURL=globals.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerAddCoreResolvables": () => (/* binding */ registerAddCoreResolvables), +/* harmony export */ "treeChangesCleanup": () => (/* binding */ treeChangesCleanup) +/* harmony export */ }); +/* harmony import */ var _transition_transition__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transition/transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../router */ "./node_modules/@uirouter/core/lib-esm/router.js"); +/* harmony import */ var _resolve__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../resolve */ "./node_modules/@uirouter/core/lib-esm/resolve/index.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + +function addCoreResolvables(trans) { + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(_router__WEBPACK_IMPORTED_MODULE_1__.UIRouter, trans.router), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(_transition_transition__WEBPACK_IMPORTED_MODULE_0__.Transition, trans), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$transition$', trans), ''); + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$stateParams', trans.params()), ''); + trans.entering().forEach(function (state) { + trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$state$', state), state); + }); +} +var registerAddCoreResolvables = function (transitionService) { + return transitionService.onCreate({}, addCoreResolvables); +}; +var TRANSITION_TOKENS = ['$transition$', _transition_transition__WEBPACK_IMPORTED_MODULE_0__.Transition]; +var isTransition = (0,_common__WEBPACK_IMPORTED_MODULE_3__.inArray)(TRANSITION_TOKENS); +// References to Transition in the treeChanges pathnodes makes all +// previous Transitions reachable in memory, causing a memory leak +// This function removes resolves for '$transition$' and `Transition` from the treeChanges. +// Do not use this on current transitions, only on old ones. +var treeChangesCleanup = function (trans) { + var nodes = (0,_common__WEBPACK_IMPORTED_MODULE_3__.values)(trans.treeChanges()).reduce(_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []).reduce(_common__WEBPACK_IMPORTED_MODULE_3__.uniqR, []); + // If the resolvable is a Transition, return a new resolvable with null data + var replaceTransitionWithNull = function (r) { + return isTransition(r.token) ? _resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(r.token, null) : r; + }; + nodes.forEach(function (node) { + node.resolvables = node.resolvables.map(replaceTransitionWithNull); + }); +}; +//# sourceMappingURL=coreResolvables.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerIgnoredTransitionHook": () => (/* binding */ registerIgnoredTransitionHook) +/* harmony export */ }); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); + + +/** + * A [[TransitionHookFn]] that skips a transition if it should be ignored + * + * This hook is invoked at the end of the onBefore phase. + * + * If the transition should be ignored (because no parameter or states changed) + * then the transition is ignored and not processed. + */ +function ignoredHook(trans) { + var ignoredReason = trans._ignoredReason(); + if (!ignoredReason) + return; + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceTransitionIgnored(trans); + var pending = trans.router.globals.transition; + // The user clicked a link going back to the *current state* ('A') + // However, there is also a pending transition in flight (to 'B') + // Abort the transition to 'B' because the user now wants to be back at 'A'. + if (ignoredReason === 'SameAsCurrent' && pending) { + pending.abort(); + } + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__.Rejection.ignored().toPromise(); +} +var registerIgnoredTransitionHook = function (transitionService) { + return transitionService.onBefore({}, ignoredHook, { priority: -9999 }); +}; +//# sourceMappingURL=ignoredTransition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerInvalidTransitionHook": () => (/* binding */ registerInvalidTransitionHook) +/* harmony export */ }); +/** + * A [[TransitionHookFn]] that rejects the Transition if it is invalid + * + * This hook is invoked at the end of the onBefore phase. + * If the transition is invalid (for example, param values do not validate) + * then the transition is rejected. + */ +function invalidTransitionHook(trans) { + if (!trans.valid()) { + throw new Error(trans.error().toString()); + } +} +var registerInvalidTransitionHook = function (transitionService) { + return transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 }); +}; +//# sourceMappingURL=invalidTransition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerLazyLoadHook": () => (/* binding */ registerLazyLoadHook), +/* harmony export */ "lazyLoadState": () => (/* binding */ lazyLoadState) +/* harmony export */ }); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + +/** + * A [[TransitionHookFn]] that performs lazy loading + * + * When entering a state "abc" which has a `lazyLoad` function defined: + * - Invoke the `lazyLoad` function (unless it is already in process) + * - Flag the hook function as "in process" + * - The function should return a promise (that resolves when lazy loading is complete) + * - Wait for the promise to settle + * - If the promise resolves to a [[LazyLoadResult]], then register those states + * - Flag the hook function as "not in process" + * - If the hook was successful + * - Remove the `lazyLoad` function from the state declaration + * - If all the hooks were successful + * - Retry the transition (by returning a TargetState) + * + * ``` + * .state('abc', { + * component: 'fooComponent', + * lazyLoad: () => import('./fooComponent') + * }); + * ``` + * + * See [[StateDeclaration.lazyLoad]] + */ +var lazyLoadHook = function (transition) { + var router = transition.router; + function retryTransition() { + if (transition.originalTransition().options().source !== 'url') { + // The original transition was not triggered via url sync + // The lazy state should be loaded now, so re-try the original transition + var orig = transition.targetState(); + return router.stateService.target(orig.identifier(), orig.params(), orig.options()); + } + // The original transition was triggered via url sync + // Run the URL rules and find the best match + var $url = router.urlService; + var result = $url.match($url.parts()); + var rule = result && result.rule; + // If the best match is a state, redirect the transition (instead + // of calling sync() which supersedes the current transition) + if (rule && rule.type === 'STATE') { + var state = rule.state; + var params = result.match; + return router.stateService.target(state, params, transition.options()); + } + // No matching state found, so let .sync() choose the best non-state match/otherwise + router.urlService.sync(); + } + var promises = transition + .entering() + .filter(function (state) { return !!state.$$state().lazyLoad; }) + .map(function (state) { return lazyLoadState(transition, state); }); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.all(promises).then(retryTransition); +}; +var registerLazyLoadHook = function (transitionService) { + return transitionService.onBefore({ entering: function (state) { return !!state.lazyLoad; } }, lazyLoadHook); +}; +/** + * Invokes a state's lazy load function + * + * @param transition a Transition context + * @param state the state to lazy load + * @returns A promise for the lazy load result + */ +function lazyLoadState(transition, state) { + var lazyLoadFn = state.$$state().lazyLoad; + // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked + var promise = lazyLoadFn['_promise']; + if (!promise) { + var success = function (result) { + delete state.lazyLoad; + delete state.$$state().lazyLoad; + delete lazyLoadFn['_promise']; + return result; + }; + var error = function (err) { + delete lazyLoadFn['_promise']; + return _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.reject(err); + }; + promise = lazyLoadFn['_promise'] = _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.when(lazyLoadFn(transition, state)) + .then(updateStateRegistry) + .then(success, error); + } + /** Register any lazy loaded state definitions */ + function updateStateRegistry(result) { + if (result && Array.isArray(result.states)) { + result.states.forEach(function (_state) { return transition.router.stateRegistry.register(_state); }); + } + return result; + } + return promise; +} +//# sourceMappingURL=lazyLoad.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerOnExitHook": () => (/* binding */ registerOnExitHook), +/* harmony export */ "registerOnRetainHook": () => (/* binding */ registerOnRetainHook), +/* harmony export */ "registerOnEnterHook": () => (/* binding */ registerOnEnterHook) +/* harmony export */ }); +/** + * A factory which creates an onEnter, onExit or onRetain transition hook function + * + * The returned function invokes the (for instance) state.onEnter hook when the + * state is being entered. + */ +function makeEnterExitRetainHook(hookName) { + return function (transition, state) { + var _state = state.$$state(); + var hookFn = _state[hookName]; + return hookFn(transition, state); + }; +} +/** + * The [[TransitionStateHookFn]] for onExit + * + * When the state is being exited, the state's .onExit function is invoked. + * + * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);` + * + * See: [[IHookRegistry.onExit]] + */ +var onExitHook = makeEnterExitRetainHook('onExit'); +var registerOnExitHook = function (transitionService) { + return transitionService.onExit({ exiting: function (state) { return !!state.onExit; } }, onExitHook); +}; +/** + * The [[TransitionStateHookFn]] for onRetain + * + * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked. + * + * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);` + * + * See: [[IHookRegistry.onRetain]] + */ +var onRetainHook = makeEnterExitRetainHook('onRetain'); +var registerOnRetainHook = function (transitionService) { + return transitionService.onRetain({ retained: function (state) { return !!state.onRetain; } }, onRetainHook); +}; +/** + * The [[TransitionStateHookFn]] for onEnter + * + * When the state is being entered, the state's .onEnter function is invoked. + * + * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);` + * + * See: [[IHookRegistry.onEnter]] + */ +var onEnterHook = makeEnterExitRetainHook('onEnter'); +var registerOnEnterHook = function (transitionService) { + return transitionService.onEnter({ entering: function (state) { return !!state.onEnter; } }, onEnterHook); +}; +//# sourceMappingURL=onEnterExitRetain.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerRedirectToHook": () => (/* binding */ registerRedirectToHook) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); + + + +/** + * A [[TransitionHookFn]] that redirects to a different state or params + * + * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);` + * + * See [[StateDeclaration.redirectTo]] + */ +var redirectToHook = function (trans) { + var redirect = trans.to().redirectTo; + if (!redirect) + return; + var $state = trans.router.stateService; + function handleResult(result) { + if (!result) + return; + if (result instanceof _state_targetState__WEBPACK_IMPORTED_MODULE_2__.TargetState) + return result; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(result)) + return $state.target(result, trans.params(), trans.options()); + if (result['state'] || result['params']) + return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options()); + } + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(redirect)) { + return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(redirect(trans)).then(handleResult); + } + return handleResult(redirect); +}; +var registerRedirectToHook = function (transitionService) { + return transitionService.onStart({ to: function (state) { return !!state.redirectTo; } }, redirectToHook); +}; +//# sourceMappingURL=redirectTo.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/resolve.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/resolve.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RESOLVE_HOOK_PRIORITY": () => (/* binding */ RESOLVE_HOOK_PRIORITY), +/* harmony export */ "registerEagerResolvePath": () => (/* binding */ registerEagerResolvePath), +/* harmony export */ "registerLazyResolveState": () => (/* binding */ registerLazyResolveState), +/* harmony export */ "registerResolveRemaining": () => (/* binding */ registerResolveRemaining) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + +var RESOLVE_HOOK_PRIORITY = 1000; +/** + * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path + * + * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });` + * + * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for. + * + * See [[StateDeclaration.resolve]] + */ +var eagerResolvePath = function (trans) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).resolvePath('EAGER', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerEagerResolvePath = function (transitionService) { + return transitionService.onStart({}, eagerResolvePath, { priority: RESOLVE_HOOK_PRIORITY }); +}; +/** + * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path + * + * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });` + * + * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for. + * + * See [[StateDeclaration.resolve]] + */ +var lazyResolveState = function (trans, state) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).subContext(state.$$state()).resolvePath('LAZY', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerLazyResolveState = function (transitionService) { + return transitionService.onEnter({ entering: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.val)(true) }, lazyResolveState, { priority: RESOLVE_HOOK_PRIORITY }); +}; +/** + * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables. + * + * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });` + * + * After all entering states have been entered, this hook resolves any remaining Resolvables. + * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]]. + * + * See [[StateDeclaration.resolve]] + */ +var resolveRemaining = function (trans) { + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).resolvePath('LAZY', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerResolveRemaining = function (transitionService) { + return transitionService.onFinish({}, resolveRemaining, { priority: RESOLVE_HOOK_PRIORITY }); +}; +//# sourceMappingURL=resolve.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerUpdateGlobalState": () => (/* binding */ registerUpdateGlobalState) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +/** + * A [[TransitionHookFn]] which updates global UI-Router state + * + * Registered using `transitionService.onBefore({}, updateGlobalState);` + * + * Before a [[Transition]] starts, updates the global value of "the current transition" ([[Globals.transition]]). + * After a successful [[Transition]], updates the global values of "the current state" + * ([[Globals.current]] and [[Globals.$current]]) and "the current param values" ([[Globals.params]]). + * + * See also the deprecated properties: + * [[StateService.transition]], [[StateService.current]], [[StateService.params]] + */ +var updateGlobalState = function (trans) { + var globals = trans.router.globals; + var transitionSuccessful = function () { + globals.successfulTransitions.enqueue(trans); + globals.$current = trans.$to(); + globals.current = globals.$current.self; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.copy)(trans.params(), globals.params); + }; + var clearCurrentTransition = function () { + // Do not clear globals.transition if a different transition has started in the meantime + if (globals.transition === trans) + globals.transition = null; + }; + trans.onSuccess({}, transitionSuccessful, { priority: 10000 }); + trans.promise.then(clearCurrentTransition, clearCurrentTransition); +}; +var registerUpdateGlobalState = function (transitionService) { + return transitionService.onCreate({}, updateGlobalState); +}; +//# sourceMappingURL=updateGlobals.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/url.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/url.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerUpdateUrl": () => (/* binding */ registerUpdateUrl) +/* harmony export */ }); +/** + * A [[TransitionHookFn]] which updates the URL after a successful transition + * + * Registered using `transitionService.onSuccess({}, updateUrl);` + */ +var updateUrl = function (transition) { + var options = transition.options(); + var $state = transition.router.stateService; + var $urlRouter = transition.router.urlRouter; + // Dont update the url in these situations: + // The transition was triggered by a URL sync (options.source === 'url') + // The user doesn't want the url to update (options.location === false) + // The destination state, and all parents have no navigable url + if (options.source !== 'url' && options.location && $state.$current.navigable) { + var urlOptions = { replace: options.location === 'replace' }; + $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions); + } + $urlRouter.update(true); +}; +var registerUpdateUrl = function (transitionService) { + return transitionService.onSuccess({}, updateUrl, { priority: 9999 }); +}; +//# sourceMappingURL=url.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/hooks/views.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/hooks/views.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "registerLoadEnteringViews": () => (/* binding */ registerLoadEnteringViews), +/* harmony export */ "registerActivateViews": () => (/* binding */ registerActivateViews) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + +/** + * A [[TransitionHookFn]] which waits for the views to load + * + * Registered using `transitionService.onStart({}, loadEnteringViews);` + * + * Allows the views to do async work in [[ViewConfig.load]] before the transition continues. + * In angular 1, this includes loading the templates. + */ +var loadEnteringViews = function (transition) { + var $q = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q; + var enteringViews = transition.views('entering'); + if (!enteringViews.length) + return; + return $q.all(enteringViews.map(function (view) { return $q.when(view.load()); })).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); +}; +var registerLoadEnteringViews = function (transitionService) { + return transitionService.onFinish({}, loadEnteringViews); +}; +/** + * A [[TransitionHookFn]] which activates the new views when a transition is successful. + * + * Registered using `transitionService.onSuccess({}, activateViews);` + * + * After a transition is complete, this hook deactivates the old views from the previous state, + * and activates the new views from the destination state. + * + * See [[ViewService]] + */ +var activateViews = function (transition) { + var enteringViews = transition.views('entering'); + var exitingViews = transition.views('exiting'); + if (!enteringViews.length && !exitingViews.length) + return; + var $view = transition.router.viewService; + exitingViews.forEach(function (vc) { return $view.deactivateViewConfig(vc); }); + enteringViews.forEach(function (vc) { return $view.activateViewConfig(vc); }); + $view.sync(); +}; +var registerActivateViews = function (transitionService) { + return transitionService.onSuccess({}, activateViews); +}; +//# sourceMappingURL=views.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/index.js": +/*!******************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/index.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Category": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Category), +/* harmony export */ "Glob": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Glob), +/* harmony export */ "Queue": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Queue), +/* harmony export */ "Trace": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Trace), +/* harmony export */ "_extend": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._extend), +/* harmony export */ "_inArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._inArray), +/* harmony export */ "_pushTo": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._pushTo), +/* harmony export */ "_removeFrom": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._removeFrom), +/* harmony export */ "all": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.all), +/* harmony export */ "allTrueR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.allTrueR), +/* harmony export */ "ancestors": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.ancestors), +/* harmony export */ "and": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.and), +/* harmony export */ "any": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.any), +/* harmony export */ "anyTrueR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.anyTrueR), +/* harmony export */ "applyPairs": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.applyPairs), +/* harmony export */ "arrayTuples": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.arrayTuples), +/* harmony export */ "assertFn": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertFn), +/* harmony export */ "assertMap": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertMap), +/* harmony export */ "assertPredicate": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertPredicate), +/* harmony export */ "beforeAfterSubstr": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.beforeAfterSubstr), +/* harmony export */ "compose": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.compose), +/* harmony export */ "copy": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.copy), +/* harmony export */ "createProxyFunctions": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions), +/* harmony export */ "curry": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.curry), +/* harmony export */ "defaults": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.defaults), +/* harmony export */ "deregAll": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.deregAll), +/* harmony export */ "eq": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.eq), +/* harmony export */ "equals": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.equals), +/* harmony export */ "extend": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.extend), +/* harmony export */ "filter": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.filter), +/* harmony export */ "find": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.find), +/* harmony export */ "flatten": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.flatten), +/* harmony export */ "flattenR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.flattenR), +/* harmony export */ "fnToString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.fnToString), +/* harmony export */ "forEach": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.forEach), +/* harmony export */ "fromJson": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.fromJson), +/* harmony export */ "functionToString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.functionToString), +/* harmony export */ "hostRegex": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.hostRegex), +/* harmony export */ "identity": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.identity), +/* harmony export */ "inArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.inArray), +/* harmony export */ "inherit": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.inherit), +/* harmony export */ "invoke": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.invoke), +/* harmony export */ "is": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.is), +/* harmony export */ "isArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isArray), +/* harmony export */ "isDate": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isDate), +/* harmony export */ "isDefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isDefined), +/* harmony export */ "isFunction": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isFunction), +/* harmony export */ "isInjectable": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isInjectable), +/* harmony export */ "isNull": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNull), +/* harmony export */ "isNullOrUndefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNullOrUndefined), +/* harmony export */ "isNumber": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNumber), +/* harmony export */ "isObject": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isObject), +/* harmony export */ "isPromise": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isPromise), +/* harmony export */ "isRegExp": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isRegExp), +/* harmony export */ "isString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isString), +/* harmony export */ "isUndefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isUndefined), +/* harmony export */ "joinNeighborsR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.joinNeighborsR), +/* harmony export */ "kebobString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.kebobString), +/* harmony export */ "makeStub": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.makeStub), +/* harmony export */ "map": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.map), +/* harmony export */ "mapObj": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.mapObj), +/* harmony export */ "maxLength": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.maxLength), +/* harmony export */ "mergeR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.mergeR), +/* harmony export */ "noop": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.noop), +/* harmony export */ "not": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.not), +/* harmony export */ "omit": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.omit), +/* harmony export */ "or": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.or), +/* harmony export */ "padString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.padString), +/* harmony export */ "pairs": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pairs), +/* harmony export */ "parse": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.parse), +/* harmony export */ "pattern": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pattern), +/* harmony export */ "pick": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pick), +/* harmony export */ "pipe": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pipe), +/* harmony export */ "pluck": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pluck), +/* harmony export */ "prop": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.prop), +/* harmony export */ "propEq": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.propEq), +/* harmony export */ "pushR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pushR), +/* harmony export */ "pushTo": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pushTo), +/* harmony export */ "removeFrom": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.removeFrom), +/* harmony export */ "root": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.root), +/* harmony export */ "services": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.services), +/* harmony export */ "silenceUncaughtInPromise": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise), +/* harmony export */ "silentRejection": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.silentRejection), +/* harmony export */ "splitEqual": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitEqual), +/* harmony export */ "splitHash": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitHash), +/* harmony export */ "splitOnDelim": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitOnDelim), +/* harmony export */ "splitQuery": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitQuery), +/* harmony export */ "stringify": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.stringify), +/* harmony export */ "stripLastPathElement": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.stripLastPathElement), +/* harmony export */ "tail": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.tail), +/* harmony export */ "toJson": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.toJson), +/* harmony export */ "trace": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.trace), +/* harmony export */ "trimHashVal": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.trimHashVal), +/* harmony export */ "uniqR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.uniqR), +/* harmony export */ "unnest": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.unnest), +/* harmony export */ "unnestR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.unnestR), +/* harmony export */ "val": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.val), +/* harmony export */ "values": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.values), +/* harmony export */ "PathNode": () => (/* reexport safe */ _path_index__WEBPACK_IMPORTED_MODULE_2__.PathNode), +/* harmony export */ "PathUtils": () => (/* reexport safe */ _path_index__WEBPACK_IMPORTED_MODULE_2__.PathUtils), +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.NATIVE_INJECTOR_TOKEN), +/* harmony export */ "Resolvable": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.Resolvable), +/* harmony export */ "ResolveContext": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.ResolveContext), +/* harmony export */ "defaultResolvePolicy": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.defaultResolvePolicy), +/* harmony export */ "resolvePolicies": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.resolvePolicies), +/* harmony export */ "HookBuilder": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.HookBuilder), +/* harmony export */ "RegisteredHook": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.RegisteredHook), +/* harmony export */ "RejectType": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.RejectType), +/* harmony export */ "Rejection": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.Rejection), +/* harmony export */ "Transition": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.Transition), +/* harmony export */ "TransitionEventType": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionEventType), +/* harmony export */ "TransitionHook": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHook), +/* harmony export */ "TransitionHookPhase": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHookScope), +/* harmony export */ "TransitionService": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionService), +/* harmony export */ "defaultTransOpts": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.defaultTransOpts), +/* harmony export */ "makeEvent": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.makeEvent), +/* harmony export */ "matchState": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.matchState), +/* harmony export */ "UIRouterGlobals": () => (/* reexport safe */ _globals__WEBPACK_IMPORTED_MODULE_8__.UIRouterGlobals), +/* harmony export */ "UIRouter": () => (/* reexport safe */ _router__WEBPACK_IMPORTED_MODULE_9__.UIRouter), +/* harmony export */ "UIRouterPluginBase": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_11__.UIRouterPluginBase) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _params_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./params/index */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _params_index__WEBPACK_IMPORTED_MODULE_1__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _params_index__WEBPACK_IMPORTED_MODULE_1__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _path_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./path/index */ "./node_modules/@uirouter/core/lib-esm/path/index.js"); +/* harmony import */ var _resolve_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./resolve/index */ "./node_modules/@uirouter/core/lib-esm/resolve/index.js"); +/* harmony import */ var _state_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state/index */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _state_index__WEBPACK_IMPORTED_MODULE_4__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _state_index__WEBPACK_IMPORTED_MODULE_4__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _transition_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transition/index */ "./node_modules/@uirouter/core/lib-esm/transition/index.js"); +/* harmony import */ var _url_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./url/index */ "./node_modules/@uirouter/core/lib-esm/url/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _url_index__WEBPACK_IMPORTED_MODULE_6__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _url_index__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _view_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./view/index */ "./node_modules/@uirouter/core/lib-esm/view/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _view_index__WEBPACK_IMPORTED_MODULE_7__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState","BaseUrlRule","ParamFactory","UrlConfig","UrlMatcher","UrlMatcherFactory","UrlRouter","UrlRuleFactory","UrlRules","UrlService"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _view_index__WEBPACK_IMPORTED_MODULE_7__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./globals */ "./node_modules/@uirouter/core/lib-esm/globals.js"); +/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./router */ "./node_modules/@uirouter/core/lib-esm/router.js"); +/* harmony import */ var _vanilla__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./vanilla */ "./node_modules/@uirouter/core/lib-esm/vanilla.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _vanilla__WEBPACK_IMPORTED_MODULE_10__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState","BaseUrlRule","ParamFactory","UrlConfig","UrlMatcher","UrlMatcherFactory","UrlRouter","UrlRuleFactory","UrlRules","UrlService","ViewService","UIRouterGlobals","UIRouter"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _vanilla__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/interface.js"); + + + + + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/interface.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/interface.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouterPluginBase": () => (/* binding */ UIRouterPluginBase) +/* harmony export */ }); +var UIRouterPluginBase = /** @class */ (function () { + function UIRouterPluginBase() { + } + UIRouterPluginBase.prototype.dispose = function (router) { }; + return UIRouterPluginBase; +}()); + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/index.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "DefType": () => (/* reexport safe */ _param__WEBPACK_IMPORTED_MODULE_1__.DefType), +/* harmony export */ "Param": () => (/* reexport safe */ _param__WEBPACK_IMPORTED_MODULE_1__.Param), +/* harmony export */ "ParamTypes": () => (/* reexport safe */ _paramTypes__WEBPACK_IMPORTED_MODULE_2__.ParamTypes), +/* harmony export */ "StateParams": () => (/* reexport safe */ _stateParams__WEBPACK_IMPORTED_MODULE_3__.StateParams), +/* harmony export */ "ParamType": () => (/* reexport safe */ _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/params/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _param__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _paramTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./paramTypes */ "./node_modules/@uirouter/core/lib-esm/params/paramTypes.js"); +/* harmony import */ var _stateParams__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateParams */ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); +/** + * This module contains code for State Parameters. + * + * See [[ParamDeclaration]] + * + * @packageDocumentation @preferred + */ + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/interface.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/interface.js ***! + \*****************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/param.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/param.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "DefType": () => (/* binding */ DefType), +/* harmony export */ "Param": () => (/* binding */ Param) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); + + + + + +var hasOwn = Object.prototype.hasOwnProperty; +var isShorthand = function (cfg) { + return ['value', 'type', 'squash', 'array', 'dynamic'].filter(hasOwn.bind(cfg || {})).length === 0; +}; +var DefType; +(function (DefType) { + DefType[DefType["PATH"] = 0] = "PATH"; + DefType[DefType["SEARCH"] = 1] = "SEARCH"; + DefType[DefType["CONFIG"] = 2] = "CONFIG"; +})(DefType || (DefType = {})); + +function getParamDeclaration(paramName, location, state) { + var noReloadOnSearch = (state.reloadOnSearch === false && location === DefType.SEARCH) || undefined; + var dynamic = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)([state.dynamic, noReloadOnSearch], _common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined); + var defaultConfig = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(dynamic) ? { dynamic: dynamic } : {}; + var paramConfig = unwrapShorthand(state && state.params && state.params[paramName]); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(defaultConfig, paramConfig); +} +function unwrapShorthand(cfg) { + cfg = isShorthand(cfg) ? { value: cfg } : cfg; + getStaticDefaultValue['__cacheable'] = true; + function getStaticDefaultValue() { + return cfg.value; + } + var $$fn = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isInjectable)(cfg.value) ? cfg.value : getStaticDefaultValue; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(cfg, { $$fn: $$fn }); +} +function getType(cfg, urlType, location, id, paramTypes) { + if (cfg.type && urlType && urlType.name !== 'string') + throw new Error("Param '" + id + "' has two type configurations."); + if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type)) + return paramTypes.type(cfg.type); + if (urlType) + return urlType; + if (!cfg.type) { + var type = location === DefType.CONFIG + ? 'any' + : location === DefType.PATH + ? 'path' + : location === DefType.SEARCH + ? 'query' + : 'string'; + return paramTypes.type(type); + } + return cfg.type instanceof _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType ? cfg.type : paramTypes.type(cfg.type); +} +/** returns false, true, or the squash value to indicate the "default parameter url squash policy". */ +function getSquashPolicy(config, isOptional, defaultPolicy) { + var squash = config.squash; + if (!isOptional || squash === false) + return false; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(squash) || squash == null) + return defaultPolicy; + if (squash === true || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + return squash; + throw new Error("Invalid squash policy: '" + squash + "'. Valid policies: false, true, or arbitrary string"); +} +function getReplace(config, arrayMode, isOptional, squash) { + var defaultPolicy = [ + { from: '', to: isOptional || arrayMode ? undefined : '' }, + { from: null, to: isOptional || arrayMode ? undefined : '' }, + ]; + var replace = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(config.replace) ? config.replace : []; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + replace.push({ from: squash, to: undefined }); + var configuredKeys = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(replace, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('from')); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.filter)(defaultPolicy, function (item) { return configuredKeys.indexOf(item.from) === -1; }).concat(replace); +} +var Param = /** @class */ (function () { + function Param(id, type, location, urlConfig, state) { + var config = getParamDeclaration(id, location, state); + type = getType(config, type, location, id, urlConfig.paramTypes); + var arrayMode = getArrayMode(); + type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type; + var isOptional = config.value !== undefined || location === DefType.SEARCH; + var dynamic = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.dynamic) ? !!config.dynamic : !!type.dynamic; + var raw = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.raw) ? !!config.raw : !!type.raw; + var squash = getSquashPolicy(config, isOptional, urlConfig.defaultSquashPolicy()); + var replace = getReplace(config, arrayMode, isOptional, squash); + var inherit = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.inherit) ? !!config.inherit : !!type.inherit; + // array config: param name (param[]) overrides default settings. explicit config overrides param name. + function getArrayMode() { + var arrayDefaults = { array: location === DefType.SEARCH ? 'auto' : false }; + var arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {}; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(arrayDefaults, arrayParamNomenclature, config).array; + } + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, { id: id, type: type, location: location, isOptional: isOptional, dynamic: dynamic, raw: raw, squash: squash, replace: replace, inherit: inherit, array: arrayMode, config: config }); + } + Param.values = function (params, values) { + if (values === void 0) { values = {}; } + var paramValues = {}; + for (var _i = 0, params_1 = params; _i < params_1.length; _i++) { + var param = params_1[_i]; + paramValues[param.id] = param.value(values[param.id]); + } + return paramValues; + }; + /** + * Finds [[Param]] objects which have different param values + * + * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects + * + * @param params: The list of Param objects to filter + * @param values1: The first set of parameter values + * @param values2: the second set of parameter values + * + * @returns any Param objects whose values were different between values1 and values2 + */ + Param.changed = function (params, values1, values2) { + if (values1 === void 0) { values1 = {}; } + if (values2 === void 0) { values2 = {}; } + return params.filter(function (param) { return !param.type.equals(values1[param.id], values2[param.id]); }); + }; + /** + * Checks if two param value objects are equal (for a set of [[Param]] objects) + * + * @param params The list of [[Param]] objects to check + * @param values1 The first set of param values + * @param values2 The second set of param values + * + * @returns true if the param values in values1 and values2 are equal + */ + Param.equals = function (params, values1, values2) { + if (values1 === void 0) { values1 = {}; } + if (values2 === void 0) { values2 = {}; } + return Param.changed(params, values1, values2).length === 0; + }; + /** Returns true if a the parameter values are valid, according to the Param definitions */ + Param.validates = function (params, values) { + if (values === void 0) { values = {}; } + return params.map(function (param) { return param.validates(values[param.id]); }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.allTrueR, true); + }; + Param.prototype.isDefaultValue = function (value) { + return this.isOptional && this.type.equals(this.value(), value); + }; + /** + * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the + * default value, which may be the result of an injectable function. + */ + Param.prototype.value = function (value) { + var _this = this; + /** + * [Internal] Get the default value of a parameter, which may be an injectable function. + */ + var getDefaultValue = function () { + if (_this._defaultValueCache) + return _this._defaultValueCache.defaultValue; + if (!_common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector) + throw new Error('Injectable functions cannot be called at configuration time'); + var defaultValue = _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector.invoke(_this.config.$$fn); + if (defaultValue !== null && defaultValue !== undefined && !_this.type.is(defaultValue)) + throw new Error("Default value (" + defaultValue + ") for parameter '" + _this.id + "' is not an instance of ParamType (" + _this.type.name + ")"); + if (_this.config.$$fn['__cacheable']) { + _this._defaultValueCache = { defaultValue: defaultValue }; + } + return defaultValue; + }; + var replaceSpecialValues = function (val) { + for (var _i = 0, _a = _this.replace; _i < _a.length; _i++) { + var tuple = _a[_i]; + if (tuple.from === val) + return tuple.to; + } + return val; + }; + value = replaceSpecialValues(value); + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isUndefined)(value) ? getDefaultValue() : this.type.$normalize(value); + }; + Param.prototype.isSearch = function () { + return this.location === DefType.SEARCH; + }; + Param.prototype.validates = function (value) { + // There was no parameter value, but the param is optional + if (((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isUndefined)(value) || value === null) && this.isOptional) + return true; + // The value was not of the correct ParamType, and could not be decoded to the correct ParamType + var normalized = this.type.$normalize(value); + if (!this.type.is(normalized)) + return false; + // The value was of the correct type, but when encoded, did not match the ParamType's regexp + var encoded = this.type.encode(normalized); + return !((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(encoded) && !this.type.pattern.exec(encoded)); + }; + Param.prototype.toString = function () { + return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}"; + }; + return Param; +}()); + +//# sourceMappingURL=param.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/paramType.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/paramType.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamType": () => (/* binding */ ParamType) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + +/** + * An internal class which implements [[ParamTypeDefinition]]. + * + * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types. + * When a param type definition is registered, an instance of this class is created internally. + * + * This class has naive implementations for all the [[ParamTypeDefinition]] methods. + * + * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values. + * + * #### Example: + * ```js + * var paramTypeDef = { + * decode: function(val) { return parseInt(val, 10); }, + * encode: function(val) { return val && val.toString(); }, + * equals: function(a, b) { return this.is(a) && a === b; }, + * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; }, + * pattern: /\d+/ + * } + * + * var paramType = new ParamType(paramTypeDef); + * ``` + */ +var ParamType = /** @class */ (function () { + /** + * @param def A configuration object which contains the custom type definition. The object's + * properties will override the default methods and/or pattern in `ParamType`'s public interface. + * @returns a new ParamType object + */ + function ParamType(def) { + /** @inheritdoc */ + this.pattern = /.*/; + /** @inheritdoc */ + this.inherit = true; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, def); + } + // consider these four methods to be "abstract methods" that should be overridden + /** @inheritdoc */ + ParamType.prototype.is = function (val, key) { + return true; + }; + /** @inheritdoc */ + ParamType.prototype.encode = function (val, key) { + return val; + }; + /** @inheritdoc */ + ParamType.prototype.decode = function (val, key) { + return val; + }; + /** @inheritdoc */ + ParamType.prototype.equals = function (a, b) { + // tslint:disable-next-line:triple-equals + return a == b; + }; + ParamType.prototype.$subPattern = function () { + var sub = this.pattern.toString(); + return sub.substr(1, sub.length - 2); + }; + ParamType.prototype.toString = function () { + return "{ParamType:" + this.name + "}"; + }; + /** Given an encoded string, or a decoded object, returns a decoded object */ + ParamType.prototype.$normalize = function (val) { + return this.is(val) ? val : this.decode(val); + }; + /** + * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'. + * e.g.: + * - urlmatcher pattern "/path?{queryParam[]:int}" + * - url: "/path?queryParam=1&queryParam=2 + * - $stateParams.queryParam will be [1, 2] + * if `mode` is "auto", then + * - url: "/path?queryParam=1 will create $stateParams.queryParam: 1 + * - url: "/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2] + */ + ParamType.prototype.$asArray = function (mode, isSearch) { + if (!mode) + return this; + if (mode === 'auto' && !isSearch) + throw new Error("'auto' array mode is for query parameters only"); + return new ArrayType(this, mode); + }; + return ParamType; +}()); + +/** Wraps up a `ParamType` object to handle array values. */ +function ArrayType(type, mode) { + var _this = this; + // Wrap non-array value as array + function arrayWrap(val) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(val) ? val : (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(val) ? [val] : []; + } + // Unwrap array value for "auto" mode. Return undefined for empty array. + function arrayUnwrap(val) { + switch (val.length) { + case 0: + return undefined; + case 1: + return mode === 'auto' ? val[0] : val; + default: + return val; + } + } + // Wraps type (.is/.encode/.decode) functions to operate on each value of an array + function arrayHandler(callback, allTruthyMode) { + return function handleArray(val) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(val) && val.length === 0) + return val; + var arr = arrayWrap(val); + var result = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(arr, callback); + return allTruthyMode === true ? (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.filter)(result, function (x) { return !x; }).length === 0 : arrayUnwrap(result); + }; + } + // Wraps type (.equals) functions to operate on each value of an array + function arrayEqualsHandler(callback) { + return function handleArray(val1, val2) { + var left = arrayWrap(val1), right = arrayWrap(val2); + if (left.length !== right.length) + return false; + for (var i = 0; i < left.length; i++) { + if (!callback(left[i], right[i])) + return false; + } + return true; + }; + } + ['encode', 'decode', 'equals', '$normalize'].forEach(function (name) { + var paramTypeFn = type[name].bind(type); + var wrapperFn = name === 'equals' ? arrayEqualsHandler : arrayHandler; + _this[name] = wrapperFn(paramTypeFn); + }); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, { + dynamic: type.dynamic, + name: type.name, + pattern: type.pattern, + inherit: type.inherit, + raw: type.raw, + is: arrayHandler(type.is.bind(type), true), + $arrayMode: mode, + }); +} +//# sourceMappingURL=paramType.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/paramTypes.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/paramTypes.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamTypes": () => (/* binding */ ParamTypes) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); + + + + + +/** + * A registry for parameter types. + * + * This registry manages the built-in (and custom) parameter types. + * + * The built-in parameter types are: + * + * - [[string]] + * - [[path]] + * - [[query]] + * - [[hash]] + * - [[int]] + * - [[bool]] + * - [[date]] + * - [[json]] + * - [[any]] + * + * To register custom parameter types, use [[UrlConfig.type]], i.e., + * + * ```js + * router.urlService.config.type(customType) + * ``` + */ +var ParamTypes = /** @class */ (function () { + function ParamTypes() { + this.enqueue = true; + this.typeQueue = []; + this.defaultTypes = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.pick)(ParamTypes.prototype, [ + 'hash', + 'string', + 'query', + 'path', + 'int', + 'bool', + 'date', + 'json', + 'any', + ]); + // Register default types. Store them in the prototype of this.types. + var makeType = function (definition, name) { return new _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ name: name }, definition)); }; + this.types = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(this.defaultTypes, makeType), {}); + } + ParamTypes.prototype.dispose = function () { + this.types = {}; + }; + /** + * Registers a parameter type + * + * End users should call [[UrlMatcherFactory.type]], which delegates to this method. + */ + ParamTypes.prototype.type = function (name, definition, definitionFn) { + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(definition)) + return this.types[name]; + if (this.types.hasOwnProperty(name)) + throw new Error("A type named '" + name + "' has already been defined."); + this.types[name] = new _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ name: name }, definition)); + if (definitionFn) { + this.typeQueue.push({ name: name, def: definitionFn }); + if (!this.enqueue) + this._flushTypeQueue(); + } + return this; + }; + ParamTypes.prototype._flushTypeQueue = function () { + while (this.typeQueue.length) { + var type = this.typeQueue.shift(); + if (type.pattern) + throw new Error("You cannot override a type's .pattern at runtime."); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this.types[type.name], _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector.invoke(type.def)); + } + }; + return ParamTypes; +}()); + +function initDefaultTypes() { + var makeDefaultType = function (def) { + var valToString = function (val) { return (val != null ? val.toString() : val); }; + var defaultTypeBase = { + encode: valToString, + decode: valToString, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(String), + pattern: /.*/, + // tslint:disable-next-line:triple-equals + equals: function (a, b) { return a == b; }, + }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, defaultTypeBase, def); + }; + // Default Parameter Type Definitions + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(ParamTypes.prototype, { + string: makeDefaultType({}), + path: makeDefaultType({ + pattern: /[^/]*/, + }), + query: makeDefaultType({}), + hash: makeDefaultType({ + inherit: false, + }), + int: makeDefaultType({ + decode: function (val) { return parseInt(val, 10); }, + is: function (val) { + return !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isNullOrUndefined)(val) && this.decode(val.toString()) === val; + }, + pattern: /-?\d+/, + }), + bool: makeDefaultType({ + encode: function (val) { return (val && 1) || 0; }, + decode: function (val) { return parseInt(val, 10) !== 0; }, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Boolean), + pattern: /0|1/, + }), + date: makeDefaultType({ + encode: function (val) { + return !this.is(val) + ? undefined + : [val.getFullYear(), ('0' + (val.getMonth() + 1)).slice(-2), ('0' + val.getDate()).slice(-2)].join('-'); + }, + decode: function (val) { + if (this.is(val)) + return val; + var match = this.capture.exec(val); + return match ? new Date(match[1], match[2] - 1, match[3]) : undefined; + }, + is: function (val) { return val instanceof Date && !isNaN(val.valueOf()); }, + equals: function (l, r) { + return ['getFullYear', 'getMonth', 'getDate'].reduce(function (acc, fn) { return acc && l[fn]() === r[fn](); }, true); + }, + pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/, + capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/, + }), + json: makeDefaultType({ + encode: _common_common__WEBPACK_IMPORTED_MODULE_0__.toJson, + decode: _common_common__WEBPACK_IMPORTED_MODULE_0__.fromJson, + is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Object), + equals: _common_common__WEBPACK_IMPORTED_MODULE_0__.equals, + pattern: /[^/]*/, + }), + // does not encode/decode + any: makeDefaultType({ + encode: _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, + decode: _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, + is: function () { return true; }, + equals: _common_common__WEBPACK_IMPORTED_MODULE_0__.equals, + }), + }); +} +initDefaultTypes(); +//# sourceMappingURL=paramTypes.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/params/stateParams.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateParams": () => (/* binding */ StateParams) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + +var StateParams = /** @class */ (function () { + function StateParams(params) { + if (params === void 0) { params = {}; } + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, params); + } + /** + * Merges a set of parameters with all parameters inherited between the common parents of the + * current state and a given destination state. + * + * @param {Object} newParams The set of parameters which will be composited with inherited params. + * @param {Object} $current Internal definition of object representing the current state. + * @param {Object} $to Internal definition of object representing state to transition to. + */ + StateParams.prototype.$inherit = function (newParams, $current, $to) { + var parentParams; + var parents = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.ancestors)($current, $to), inherited = {}, inheritList = []; + for (var i in parents) { + if (!parents[i] || !parents[i].params) + continue; + parentParams = Object.keys(parents[i].params); + if (!parentParams.length) + continue; + for (var j in parentParams) { + if (inheritList.indexOf(parentParams[j]) >= 0) + continue; + inheritList.push(parentParams[j]); + inherited[parentParams[j]] = this[parentParams[j]]; + } + } + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, inherited, newParams); + }; + return StateParams; +}()); + +//# sourceMappingURL=stateParams.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathNode": () => (/* reexport safe */ _pathNode__WEBPACK_IMPORTED_MODULE_0__.PathNode), +/* harmony export */ "PathUtils": () => (/* reexport safe */ _pathUtils__WEBPACK_IMPORTED_MODULE_1__.PathUtils) +/* harmony export */ }); +/* harmony import */ var _pathNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); +/* harmony import */ var _pathUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/pathNode.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathNode": () => (/* binding */ PathNode) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); + + + +/** + * A node in a [[TreeChanges]] path + * + * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path. + * Each PathNode corresponds to a state being entered, exited, or retained. + * The stateful information includes parameter values and resolve data. + */ +var PathNode = /** @class */ (function () { + function PathNode(stateOrNode) { + if (stateOrNode instanceof PathNode) { + var node = stateOrNode; + this.state = node.state; + this.paramSchema = node.paramSchema.slice(); + this.paramValues = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, node.paramValues); + this.resolvables = node.resolvables.slice(); + this.views = node.views && node.views.slice(); + } + else { + var state = stateOrNode; + this.state = state; + this.paramSchema = state.parameters({ inherit: false }); + this.paramValues = {}; + this.resolvables = state.resolvables.map(function (res) { return res.clone(); }); + } + } + PathNode.prototype.clone = function () { + return new PathNode(this); + }; + /** Sets [[paramValues]] for the node, from the values of an object hash */ + PathNode.prototype.applyRawParams = function (params) { + var getParamVal = function (paramDef) { return [paramDef.id, paramDef.value(params[paramDef.id])]; }; + this.paramValues = this.paramSchema.reduce(function (memo, pDef) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs)(memo, getParamVal(pDef)); }, {}); + return this; + }; + /** Gets a specific [[Param]] metadata that belongs to the node */ + PathNode.prototype.parameter = function (name) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this.paramSchema, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', name)); + }; + /** + * @returns true if the state and parameter values for another PathNode are + * equal to the state and param values for this PathNode + */ + PathNode.prototype.equals = function (node, paramsFn) { + var diff = this.diff(node, paramsFn); + return diff && diff.length === 0; + }; + /** + * Finds Params with different parameter values on another PathNode. + * + * Given another node (of the same state), finds the parameter values which differ. + * Returns the [[Param]] (schema objects) whose parameter values differ. + * + * Given another node for a different state, returns `false` + * + * @param node The node to compare to + * @param paramsFn A function that returns which parameters should be compared. + * @returns The [[Param]]s which differ, or null if the two nodes are for different states + */ + PathNode.prototype.diff = function (node, paramsFn) { + if (this.state !== node.state) + return false; + var params = paramsFn ? paramsFn(this) : this.paramSchema; + return _params_param__WEBPACK_IMPORTED_MODULE_2__.Param.changed(params, this.paramValues, node.paramValues); + }; + /** + * Returns a clone of the PathNode + * @deprecated use instance method `node.clone()` + */ + PathNode.clone = function (node) { return node.clone(); }; + return PathNode; +}()); + +//# sourceMappingURL=pathNode.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/path/pathUtils.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PathUtils": () => (/* binding */ PathUtils) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/* harmony import */ var _pathNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); + + + + +/** + * This class contains functions which convert TargetStates, Nodes and paths from one type to another. + */ +var PathUtils = /** @class */ (function () { + function PathUtils() { + } + /** Given a PathNode[], create an TargetState */ + PathUtils.makeTargetState = function (registry, path) { + var state = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(path).state; + return new _state_targetState__WEBPACK_IMPORTED_MODULE_2__.TargetState(registry, state, path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.mergeR, {}), {}); + }; + PathUtils.buildPath = function (targetState) { + var toParams = targetState.params(); + return targetState.$state().path.map(function (state) { return new _pathNode__WEBPACK_IMPORTED_MODULE_3__.PathNode(state).applyRawParams(toParams); }); + }; + /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */ + PathUtils.buildToPath = function (fromPath, targetState) { + var toPath = PathUtils.buildPath(targetState); + if (targetState.options().inherit) { + return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params())); + } + return toPath; + }; + /** + * Creates ViewConfig objects and adds to nodes. + * + * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state + */ + PathUtils.applyViewConfigs = function ($view, path, states) { + // Only apply the viewConfigs to the nodes for the given states + path + .filter(function (node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(states, node.state); }) + .forEach(function (node) { + var viewDecls = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(node.state.views || {}); + var subPath = PathUtils.subPath(path, function (n) { return n === node; }); + var viewConfigs = viewDecls.map(function (view) { return $view.createViewConfig(subPath, view); }); + node.views = viewConfigs.reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); + }); + }; + /** + * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath + * + * For a parameter in a node to be inherited from the from path: + * - The toPath's node must have a matching node in the fromPath (by state). + * - The parameter name must not be found in the toKeys parameter array. + * + * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some + * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams, + * it is not inherited from the fromPath. + */ + PathUtils.inheritParams = function (fromPath, toPath, toKeys) { + if (toKeys === void 0) { toKeys = []; } + function nodeParamVals(path, state) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(path, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('state', state)); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, node && node.paramValues); + } + var noInherit = fromPath + .map(function (node) { return node.paramSchema; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (param) { return !param.inherit; }) + .map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('id')); + /** + * Given an [[PathNode]] "toNode", return a new [[PathNode]] with param values inherited from the + * matching node in fromPath. Only inherit keys that aren't found in "toKeys" from the node in "fromPath"" + */ + function makeInheritedParamsNode(toNode) { + // All param values for the node (may include default key/vals, when key was not found in toParams) + var toParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, toNode && toNode.paramValues); + // limited to only those keys found in toParams + var incomingParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.pick)(toParamVals, toKeys); + toParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(toParamVals, toKeys); + var fromParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(nodeParamVals(fromPath, toNode.state) || {}, noInherit); + // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals + var ownParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(toParamVals, fromParamVals, incomingParamVals); + return new _pathNode__WEBPACK_IMPORTED_MODULE_3__.PathNode(toNode.state).applyRawParams(ownParamVals); + } + // The param keys specified by the incoming toParams + return toPath.map(makeInheritedParamsNode); + }; + /** + * Computes the tree changes (entering, exiting) between a fromPath and toPath. + */ + PathUtils.treeChanges = function (fromPath, toPath, reloadState) { + var max = Math.min(fromPath.length, toPath.length); + var keep = 0; + var nodesMatch = function (node1, node2) { return node1.equals(node2, PathUtils.nonDynamicParams); }; + while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) { + keep++; + } + /** Given a retained node, return a new node which uses the to node's param values */ + function applyToParams(retainedNode, idx) { + var cloned = retainedNode.clone(); + cloned.paramValues = toPath[idx].paramValues; + return cloned; + } + var from, retained, exiting, entering, to; + from = fromPath; + retained = from.slice(0, keep); + exiting = from.slice(keep); + // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped + var retainedWithToParams = retained.map(applyToParams); + entering = toPath.slice(keep); + to = retainedWithToParams.concat(entering); + return { from: from, to: to, retained: retained, retainedWithToParams: retainedWithToParams, exiting: exiting, entering: entering }; + }; + /** + * Returns a new path which is: the subpath of the first path which matches the second path. + * + * The new path starts from root and contains any nodes that match the nodes in the second path. + * It stops before the first non-matching node. + * + * Nodes are compared using their state property and their parameter values. + * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes. + * + * @param pathA the first path + * @param pathB the second path + * @param paramsFn a function which returns the parameters to consider when comparing + * + * @returns an array of PathNodes from the first path which match the nodes in the second path + */ + PathUtils.matching = function (pathA, pathB, paramsFn) { + var done = false; + var tuples = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(pathA, pathB); + return tuples.reduce(function (matching, _a) { + var nodeA = _a[0], nodeB = _a[1]; + done = done || !nodeA.equals(nodeB, paramsFn); + return done ? matching : matching.concat(nodeA); + }, []); + }; + /** + * Returns true if two paths are identical. + * + * @param pathA + * @param pathB + * @param paramsFn a function which returns the parameters to consider when comparing + * @returns true if the the states and parameter values for both paths are identical + */ + PathUtils.equals = function (pathA, pathB, paramsFn) { + return pathA.length === pathB.length && PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length; + }; + /** + * Return a subpath of a path, which stops at the first matching node + * + * Given an array of nodes, returns a subset of the array starting from the first node, + * stopping when the first node matches the predicate. + * + * @param path a path of [[PathNode]]s + * @param predicate a [[Predicate]] fn that matches [[PathNode]]s + * @returns a subpath up to the matching node, or undefined if no match is found + */ + PathUtils.subPath = function (path, predicate) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(path, predicate); + var elementIdx = path.indexOf(node); + return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1); + }; + PathUtils.nonDynamicParams = function (node) { + return node.state.parameters({ inherit: false }).filter(function (param) { return !param.dynamic; }); + }; + /** Gets the raw parameter values from a path */ + PathUtils.paramValues = function (path) { return path.reduce(function (acc, node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(acc, node.paramValues); }, {}); }; + return PathUtils; +}()); + +//# sourceMappingURL=pathUtils.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvePolicies": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.resolvePolicies), +/* harmony export */ "Resolvable": () => (/* reexport safe */ _resolvable__WEBPACK_IMPORTED_MODULE_1__.Resolvable), +/* harmony export */ "defaultResolvePolicy": () => (/* reexport safe */ _resolvable__WEBPACK_IMPORTED_MODULE_1__.defaultResolvePolicy), +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* reexport safe */ _resolveContext__WEBPACK_IMPORTED_MODULE_2__.NATIVE_INJECTOR_TOKEN), +/* harmony export */ "ResolveContext": () => (/* reexport safe */ _resolveContext__WEBPACK_IMPORTED_MODULE_2__.ResolveContext) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js"); +/* harmony import */ var _resolvable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _resolveContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/interface.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvePolicies": () => (/* binding */ resolvePolicies) +/* harmony export */ }); +var resolvePolicies = { + when: { + LAZY: 'LAZY', + EAGER: 'EAGER', + }, + async: { + WAIT: 'WAIT', + NOWAIT: 'NOWAIT', + }, +}; +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "defaultResolvePolicy": () => (/* binding */ defaultResolvePolicy), +/* harmony export */ "Resolvable": () => (/* binding */ Resolvable) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + + + + + +// TODO: explicitly make this user configurable +var defaultResolvePolicy = { + when: 'LAZY', + async: 'WAIT', +}; +/** + * The basic building block for the resolve system. + * + * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise), + * and the unwrapped-when-complete (.data) result of the resolveFn. + * + * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the + * resolveFn) and returns the resulting promise. + * + * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first + * parameter to those fns. + */ +var Resolvable = /** @class */ (function () { + function Resolvable(arg1, resolveFn, deps, policy, data) { + this.resolved = false; + this.promise = undefined; + if (arg1 instanceof Resolvable) { + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, arg1); + } + else if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(resolveFn)) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isNullOrUndefined)(arg1)) + throw new Error('new Resolvable(): token argument is required'); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(resolveFn)) + throw new Error('new Resolvable(): resolveFn argument must be a function'); + this.token = arg1; + this.policy = policy; + this.resolveFn = resolveFn; + this.deps = deps || []; + this.data = data; + this.resolved = data !== undefined; + this.promise = this.resolved ? _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(this.data) : undefined; + } + else if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(arg1) && arg1.token && (arg1.hasOwnProperty('resolveFn') || arg1.hasOwnProperty('data'))) { + var literal = arg1; + return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data); + } + } + Resolvable.prototype.getPolicy = function (state) { + var thisPolicy = this.policy || {}; + var statePolicy = (state && state.resolvePolicy) || {}; + return { + when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when, + async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async, + }; + }; + /** + * Asynchronously resolve this Resolvable's data + * + * Given a ResolveContext that this Resolvable is found in: + * Wait for this Resolvable's dependencies, then invoke this Resolvable's function + * and update the Resolvable's state + */ + Resolvable.prototype.resolve = function (resolveContext, trans) { + var _this = this; + var $q = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q; + // Gets all dependencies from ResolveContext and wait for them to be resolved + var getResolvableDependencies = function () { + return $q.all(resolveContext.getDependencies(_this).map(function (resolvable) { return resolvable.get(resolveContext, trans); })); + }; + // Invokes the resolve function passing the resolved dependencies as arguments + var invokeResolveFn = function (resolvedDeps) { return _this.resolveFn.apply(null, resolvedDeps); }; + var node = resolveContext.findNode(this); + var state = node && node.state; + var asyncPolicy = this.getPolicy(state).async; + var customAsyncPolicy = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(asyncPolicy) ? asyncPolicy : _common_common__WEBPACK_IMPORTED_MODULE_0__.identity; + // After the final value has been resolved, update the state of the Resolvable + var applyResolvedValue = function (resolvedValue) { + _this.data = resolvedValue; + _this.resolved = true; + _this.resolveFn = null; + _common_trace__WEBPACK_IMPORTED_MODULE_2__.trace.traceResolvableResolved(_this, trans); + return _this.data; + }; + // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick. + return (this.promise = $q + .when() + .then(getResolvableDependencies) + .then(invokeResolveFn) + .then(customAsyncPolicy) + .then(applyResolvedValue)); + }; + /** + * Gets a promise for this Resolvable's data. + * + * Fetches the data and returns a promise. + * Returns the existing promise if it has already been fetched once. + */ + Resolvable.prototype.get = function (resolveContext, trans) { + return this.promise || this.resolve(resolveContext, trans); + }; + Resolvable.prototype.toString = function () { + return "Resolvable(token: " + (0,_common_strings__WEBPACK_IMPORTED_MODULE_3__.stringify)(this.token) + ", requires: [" + this.deps.map(_common_strings__WEBPACK_IMPORTED_MODULE_3__.stringify) + "])"; + }; + Resolvable.prototype.clone = function () { + return new Resolvable(this); + }; + Resolvable.fromData = function (token, data) { return new Resolvable(token, function () { return data; }, null, null, data); }; + return Resolvable; +}()); + +//# sourceMappingURL=resolvable.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* binding */ NATIVE_INJECTOR_TOKEN), +/* harmony export */ "ResolveContext": () => (/* binding */ ResolveContext) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js"); +/* harmony import */ var _resolvable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + + + +var whens = _interface__WEBPACK_IMPORTED_MODULE_4__.resolvePolicies.when; +var ALL_WHENS = [whens.EAGER, whens.LAZY]; +var EAGER_WHENS = [whens.EAGER]; +// tslint:disable-next-line:no-inferrable-types +var NATIVE_INJECTOR_TOKEN = 'Native Injector'; +/** + * Encapsulates Dependency Injection for a path of nodes + * + * UI-Router states are organized as a tree. + * A nested state has a path of ancestors to the root of the tree. + * When a state is being activated, each element in the path is wrapped as a [[PathNode]]. + * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated. + * + * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path. + */ +var ResolveContext = /** @class */ (function () { + function ResolveContext(_path) { + this._path = _path; + } + /** Gets all the tokens found in the resolve context, de-duplicated */ + ResolveContext.prototype.getTokens = function () { + return this._path.reduce(function (acc, node) { return acc.concat(node.resolvables.map(function (r) { return r.token; })); }, []).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.uniqR, []); + }; + /** + * Gets the Resolvable that matches the token + * + * Gets the last Resolvable that matches the token in this context, or undefined. + * Throws an error if it doesn't exist in the ResolveContext + */ + ResolveContext.prototype.getResolvable = function (token) { + var matching = this._path + .map(function (node) { return node.resolvables; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (r) { return r.token === token; }); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(matching); + }; + /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */ + ResolveContext.prototype.getPolicy = function (resolvable) { + var node = this.findNode(resolvable); + return resolvable.getPolicy(node.state); + }; + /** + * Returns a ResolveContext that includes a portion of this one + * + * Given a state, this method creates a new ResolveContext from this one. + * The new context starts at the first node (root) and stops at the node for the `state` parameter. + * + * #### Why + * + * When a transition is created, the nodes in the "To Path" are injected from a ResolveContext. + * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables. + * The "To State" can inject values from its own resolvables, as well as those from all its ancestor state's (node's). + * This method is used to create a narrower context when injecting ancestor nodes. + * + * @example + * `let ABCD = new ResolveContext([A, B, C, D]);` + * + * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`: + * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`. + * However, `B` should only be able to access resolvables from `A`, `B`. + * + * When resolving for the `B` node, first take the full "To Path" Context `[A,B,C,D]` and limit to the subpath `[A,B]`. + * `let AB = ABCD.subcontext(a)` + */ + ResolveContext.prototype.subContext = function (state) { + return new ResolveContext(_path_pathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.subPath(this._path, function (node) { return node.state === state; })); + }; + /** + * Adds Resolvables to the node that matches the state + * + * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block). + * The resolvable is added to the node matching the `state` parameter. + * + * These new resolvables are not automatically fetched. + * The calling code should either fetch them, fetch something that depends on them, + * or rely on [[resolvePath]] being called when some state is being entered. + * + * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default. + * + * @param newResolvables the new Resolvables + * @param state Used to find the node to put the resolvable on + */ + ResolveContext.prototype.addResolvables = function (newResolvables, state) { + var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this._path, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('state', state)); + var keys = newResolvables.map(function (r) { return r.token; }); + node.resolvables = node.resolvables.filter(function (r) { return keys.indexOf(r.token) === -1; }).concat(newResolvables); + }; + /** + * Returns a promise for an array of resolved path Element promises + * + * @param when + * @param trans + * @returns {Promise|any} + */ + ResolveContext.prototype.resolvePath = function (when, trans) { + var _this = this; + if (when === void 0) { when = 'LAZY'; } + // This option determines which 'when' policy Resolvables we are about to fetch. + var whenOption = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(ALL_WHENS, when) ? when : 'LAZY'; + // If the caller specified EAGER, only the EAGER Resolvables are fetched. + // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.` + var matchedWhens = whenOption === _interface__WEBPACK_IMPORTED_MODULE_4__.resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS; + // get the subpath to the state argument, if provided + _common_trace__WEBPACK_IMPORTED_MODULE_2__.trace.traceResolvePath(this._path, when, trans); + var matchesPolicy = function (acceptedVals, whenOrAsync) { return function (resolvable) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(acceptedVals, _this.getPolicy(resolvable)[whenOrAsync]); + }; }; + // Trigger all the (matching) Resolvables in the path + // Reduce all the "WAIT" Resolvables into an array + var promises = this._path.reduce(function (acc, node) { + var nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when')); + var nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async')); + var wait = nodeResolvables.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.not)(matchesPolicy(['NOWAIT'], 'async'))); + // For the matching Resolvables, start their async fetch process. + var subContext = _this.subContext(node.state); + var getResult = function (r) { + return r + .get(subContext, trans) + // Return a tuple that includes the Resolvable's token + .then(function (value) { return ({ token: r.token, value: value }); }); + }; + nowait.forEach(getResult); + return acc.concat(wait.map(getResult)); + }, []); + // Wait for all the "WAIT" resolvables + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.all(promises); + }; + ResolveContext.prototype.injector = function () { + return this._injector || (this._injector = new UIInjectorImpl(this)); + }; + ResolveContext.prototype.findNode = function (resolvable) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this._path, function (node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(node.resolvables, resolvable); }); + }; + /** + * Gets the async dependencies of a Resolvable + * + * Given a Resolvable, returns its dependencies as a Resolvable[] + */ + ResolveContext.prototype.getDependencies = function (resolvable) { + var _this = this; + var node = this.findNode(resolvable); + // Find which other resolvables are "visible" to the `resolvable` argument + // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path) + var subPath = _path_pathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.subPath(this._path, function (x) { return x === node; }) || this._path; + var availableResolvables = subPath + .reduce(function (acc, _node) { return acc.concat(_node.resolvables); }, []) // all of subpath's resolvables + .filter(function (res) { return res !== resolvable; }); // filter out the `resolvable` argument + var getDependency = function (token) { + var matching = availableResolvables.filter(function (r) { return r.token === token; }); + if (matching.length) + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(matching); + var fromInjector = _this.injector().getNative(token); + if ((0,_common__WEBPACK_IMPORTED_MODULE_8__.isUndefined)(fromInjector)) { + throw new Error('Could not find Dependency Injection token: ' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_7__.stringify)(token)); + } + return new _resolvable__WEBPACK_IMPORTED_MODULE_5__.Resolvable(token, function () { return fromInjector; }, [], fromInjector); + }; + return resolvable.deps.map(getDependency); + }; + return ResolveContext; +}()); + +/** @internal */ +var UIInjectorImpl = /** @class */ (function () { + function UIInjectorImpl(context) { + this.context = context; + this.native = this.get(NATIVE_INJECTOR_TOKEN) || _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector; + } + UIInjectorImpl.prototype.get = function (token) { + var resolvable = this.context.getResolvable(token); + if (resolvable) { + if (this.context.getPolicy(resolvable).async === 'NOWAIT') { + return resolvable.get(this.context); + } + if (!resolvable.resolved) { + throw new Error('Resolvable async .get() not complete:' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_7__.stringify)(resolvable.token)); + } + return resolvable.data; + } + return this.getNative(token); + }; + UIInjectorImpl.prototype.getAsync = function (token) { + var resolvable = this.context.getResolvable(token); + if (resolvable) + return resolvable.get(this.context); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(this.native.get(token)); + }; + UIInjectorImpl.prototype.getNative = function (token) { + return this.native && this.native.get(token); + }; + return UIInjectorImpl; +}()); +//# sourceMappingURL=resolveContext.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/router.js": +/*!*******************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/router.js ***! + \*******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UIRouter": () => (/* binding */ UIRouter) +/* harmony export */ }); +/* harmony import */ var _url_urlMatcherFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url/urlMatcherFactory */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"); +/* harmony import */ var _url_urlRouter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./url/urlRouter */ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"); +/* harmony import */ var _transition_transitionService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./transition/transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/* harmony import */ var _view_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./view/view */ "./node_modules/@uirouter/core/lib-esm/view/view.js"); +/* harmony import */ var _state_stateRegistry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state/stateRegistry */ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"); +/* harmony import */ var _state_stateService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./state/stateService */ "./node_modules/@uirouter/core/lib-esm/state/stateService.js"); +/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./globals */ "./node_modules/@uirouter/core/lib-esm/globals.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _url_urlService__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./url/urlService */ "./node_modules/@uirouter/core/lib-esm/url/urlService.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + + + + + + +/** @internal */ +var _routerInstance = 0; +/** @internal */ +var locSvcFns = ['url', 'path', 'search', 'hash', 'onChange']; +/** @internal */ +var locCfgFns = ['port', 'protocol', 'host', 'baseHref', 'html5Mode', 'hashPrefix']; +/** @internal */ +var locationServiceStub = (0,_common__WEBPACK_IMPORTED_MODULE_11__.makeStub)('LocationServices', locSvcFns); +/** @internal */ +var locationConfigStub = (0,_common__WEBPACK_IMPORTED_MODULE_11__.makeStub)('LocationConfig', locCfgFns); +/** + * An instance of UI-Router. + * + * This object contains references to service APIs which define your application's routing behavior. + */ +var UIRouter = /** @class */ (function () { + /** + * Creates a new `UIRouter` object + * + * @param locationService a [[LocationServices]] implementation + * @param locationConfig a [[LocationConfig]] implementation + * @internal + */ + function UIRouter(locationService, locationConfig) { + if (locationService === void 0) { locationService = locationServiceStub; } + if (locationConfig === void 0) { locationConfig = locationConfigStub; } + this.locationService = locationService; + this.locationConfig = locationConfig; + /** @internal */ this.$id = _routerInstance++; + /** @internal */ this._disposed = false; + /** @internal */ this._disposables = []; + /** Enable/disable tracing to the javascript console */ + this.trace = _common_trace__WEBPACK_IMPORTED_MODULE_10__.trace; + /** Provides services related to ui-view synchronization */ + this.viewService = new _view_view__WEBPACK_IMPORTED_MODULE_3__.ViewService(this); + /** An object that contains global router state, such as the current state and params */ + this.globals = new _globals__WEBPACK_IMPORTED_MODULE_6__.UIRouterGlobals(); + /** A service that exposes global Transition Hooks */ + this.transitionService = new _transition_transitionService__WEBPACK_IMPORTED_MODULE_2__.TransitionService(this); + /** + * Deprecated for public use. Use [[urlService]] instead. + * @deprecated Use [[urlService]] instead + */ + this.urlMatcherFactory = new _url_urlMatcherFactory__WEBPACK_IMPORTED_MODULE_0__.UrlMatcherFactory(this); + /** + * Deprecated for public use. Use [[urlService]] instead. + * @deprecated Use [[urlService]] instead + */ + this.urlRouter = new _url_urlRouter__WEBPACK_IMPORTED_MODULE_1__.UrlRouter(this); + /** Provides services related to the URL */ + this.urlService = new _url_urlService__WEBPACK_IMPORTED_MODULE_9__.UrlService(this); + /** Provides a registry for states, and related registration services */ + this.stateRegistry = new _state_stateRegistry__WEBPACK_IMPORTED_MODULE_4__.StateRegistry(this); + /** Provides services related to states */ + this.stateService = new _state_stateService__WEBPACK_IMPORTED_MODULE_5__.StateService(this); + /** @internal plugin instances are registered here */ + this._plugins = {}; + this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()); + this.globals.$current = this.stateRegistry.root(); + this.globals.current = this.globals.$current.self; + this.disposable(this.globals); + this.disposable(this.stateService); + this.disposable(this.stateRegistry); + this.disposable(this.transitionService); + this.disposable(this.urlService); + this.disposable(locationService); + this.disposable(locationConfig); + } + /** Registers an object to be notified when the router is disposed */ + UIRouter.prototype.disposable = function (disposable) { + this._disposables.push(disposable); + }; + /** + * Disposes this router instance + * + * When called, clears resources retained by the router by calling `dispose(this)` on all + * registered [[disposable]] objects. + * + * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only. + * + * @internal + * @param disposable (optional) the disposable to dispose + */ + UIRouter.prototype.dispose = function (disposable) { + var _this = this; + if (disposable && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_8__.isFunction)(disposable.dispose)) { + disposable.dispose(this); + return undefined; + } + this._disposed = true; + this._disposables.slice().forEach(function (d) { + try { + typeof d.dispose === 'function' && d.dispose(_this); + (0,_common_common__WEBPACK_IMPORTED_MODULE_7__.removeFrom)(_this._disposables, d); + } + catch (ignored) { } + }); + }; + /** + * Adds a plugin to UI-Router + * + * This method adds a UI-Router Plugin. + * A plugin can enhance or change UI-Router behavior using any public API. + * + * #### Example: + * ```js + * import { MyCoolPlugin } from "ui-router-cool-plugin"; + * + * var plugin = router.addPlugin(MyCoolPlugin); + * ``` + * + * ### Plugin authoring + * + * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object. + * + * The plugin can implement its functionality using any of the public APIs of [[UIRouter]]. + * For example, it may configure router options or add a Transition Hook. + * + * The plugin can then be published as a separate module. + * + * #### Example: + * ```js + * export class MyAuthPlugin implements UIRouterPlugin { + * constructor(router: UIRouter, options: any) { + * this.name = "MyAuthPlugin"; + * let $transitions = router.transitionService; + * let $state = router.stateService; + * + * let authCriteria = { + * to: (state) => state.data && state.data.requiresAuth + * }; + * + * function authHook(transition: Transition) { + * let authService = transition.injector().get('AuthService'); + * if (!authService.isAuthenticated()) { + * return $state.target('login'); + * } + * } + * + * $transitions.onStart(authCriteria, authHook); + * } + * } + * ``` + * + * @param plugin one of: + * - a plugin class which implements [[UIRouterPlugin]] + * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance + * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance + * @param options options to pass to the plugin class/factory + * @returns the registered plugin instance + */ + UIRouter.prototype.plugin = function (plugin, options) { + if (options === void 0) { options = {}; } + var pluginInstance = new plugin(this, options); + if (!pluginInstance.name) + throw new Error('Required property `name` missing on plugin: ' + pluginInstance); + this._disposables.push(pluginInstance); + return (this._plugins[pluginInstance.name] = pluginInstance); + }; + UIRouter.prototype.getPlugin = function (pluginName) { + return pluginName ? this._plugins[pluginName] : (0,_common_common__WEBPACK_IMPORTED_MODULE_7__.values)(this._plugins); + }; + return UIRouter; +}()); + +//# sourceMappingURL=router.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/index.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateBuilder": () => (/* reexport safe */ _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.StateBuilder), +/* harmony export */ "resolvablesBuilder": () => (/* reexport safe */ _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.resolvablesBuilder), +/* harmony export */ "StateObject": () => (/* reexport safe */ _stateObject__WEBPACK_IMPORTED_MODULE_2__.StateObject), +/* harmony export */ "StateMatcher": () => (/* reexport safe */ _stateMatcher__WEBPACK_IMPORTED_MODULE_3__.StateMatcher), +/* harmony export */ "StateQueueManager": () => (/* reexport safe */ _stateQueueManager__WEBPACK_IMPORTED_MODULE_4__.StateQueueManager), +/* harmony export */ "StateRegistry": () => (/* reexport safe */ _stateRegistry__WEBPACK_IMPORTED_MODULE_5__.StateRegistry), +/* harmony export */ "StateService": () => (/* reexport safe */ _stateService__WEBPACK_IMPORTED_MODULE_6__.StateService), +/* harmony export */ "TargetState": () => (/* reexport safe */ _targetState__WEBPACK_IMPORTED_MODULE_7__.TargetState) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/state/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _stateBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateBuilder */ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"); +/* harmony import */ var _stateObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); +/* harmony import */ var _stateMatcher__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateMatcher */ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"); +/* harmony import */ var _stateQueueManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateQueueManager */ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"); +/* harmony import */ var _stateRegistry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stateRegistry */ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"); +/* harmony import */ var _stateService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stateService */ "./node_modules/@uirouter/core/lib-esm/state/stateService.js"); +/* harmony import */ var _targetState__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/** + * # The state subsystem + * + * This subsystem implements the ui-router state tree + * + * - The [[StateService]] has state-related service methods such as: + * - [[StateService.get]]: Get a registered [[StateDeclaration]] object + * - [[StateService.go]]: Transition from the current state to a new state + * - [[StateService.reload]]: Reload the current state + * - [[StateService.target]]: Get a [[TargetState]] (useful when redirecting from a Transition Hook) + * - [[StateService.onInvalid]]: Register a callback for when a transition to an invalid state is started + * - [[StateService.defaultErrorHandler]]: Register a global callback for when a transition errors + * - The [[StateDeclaration]] interface defines the shape of a state declaration + * - The [[StateRegistry]] contains all the registered states + * - States can be added/removed using the [[StateRegistry.register]] and [[StateRegistry.deregister]] + * - Note: Bootstrap state registration differs by front-end framework. + * - Get notified of state registration/deregistration using [[StateRegistry.onStatesChanged]]. + * + * @packageDocumentation + */ + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/interface.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/interface.js ***! + \****************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "resolvablesBuilder": () => (/* binding */ resolvablesBuilder), +/* harmony export */ "StateBuilder": () => (/* binding */ StateBuilder) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../resolve/resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + + + + + +var parseUrl = function (url) { + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(url)) + return false; + var root = url.charAt(0) === '^'; + return { val: root ? url.substring(1) : url, root: root }; +}; +function nameBuilder(state) { + return state.name; +} +function selfBuilder(state) { + state.self.$$state = function () { return state; }; + return state.self; +} +function dataBuilder(state) { + if (state.parent && state.parent.data) { + state.data = state.self.data = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(state.parent.data, state.data); + } + return state.data; +} +var getUrlBuilder = function ($urlMatcherFactoryProvider, root) { + return function urlBuilder(stateObject) { + var stateDec = stateObject.self; + // For future states, i.e., states whose name ends with `.**`, + // match anything that starts with the url prefix + if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\.\*\*$/)) { + var newStateDec = {}; + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.copy)(stateDec, newStateDec); + newStateDec.url += '{remainder:any}'; // match any path (.*) + stateDec = newStateDec; + } + var parent = stateObject.parent; + var parsed = parseUrl(stateDec.url); + var url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, { state: stateDec }); + if (!url) + return null; + if (!$urlMatcherFactoryProvider.isMatcher(url)) + throw new Error("Invalid url '" + url + "' in state '" + stateObject + "'"); + return parsed && parsed.root ? url : ((parent && parent.navigable) || root()).url.append(url); + }; +}; +var getNavigableBuilder = function (isRoot) { + return function navigableBuilder(state) { + return !isRoot(state) && state.url ? state : state.parent ? state.parent.navigable : null; + }; +}; +var getParamsBuilder = function (paramFactory) { + return function paramsBuilder(state) { + var makeConfigParam = function (config, id) { return paramFactory.fromConfig(id, null, state.self); }; + var urlParams = (state.url && state.url.parameters({ inherit: false })) || []; + var nonUrlParams = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.mapObj)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(state.params || {}, urlParams.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('id'))), makeConfigParam)); + return urlParams + .concat(nonUrlParams) + .map(function (p) { return [p.id, p]; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs, {}); + }; +}; +function pathBuilder(state) { + return state.parent ? state.parent.path.concat(state) : /*root*/ [state]; +} +function includesBuilder(state) { + var includes = state.parent ? (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, state.parent.includes) : {}; + includes[state.name] = true; + return includes; +} +/** + * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]]. + * + * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder + * validates the `resolve` property and converts it to a [[Resolvable]] array. + * + * resolve: input value can be: + * + * { + * // analyzed but not injected + * myFooResolve: function() { return "myFooData"; }, + * + * // function.toString() parsed, "DependencyName" dep as string (not min-safe) + * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() }, + * + * // Array split; "DependencyName" dep as string + * myBazResolve: [ "DependencyName", function(dep) { return dep.fetchSomethingAsPromise() }, + * + * // Array split; DependencyType dep as token (compared using ===) + * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() }, + * + * // val.$inject used as deps + * // where: + * // corgeResolve.$inject = ["DependencyName"]; + * // function corgeResolve(dep) { dep.fetchSometingAsPromise() } + * // then "DependencyName" dep as string + * myCorgeResolve: corgeResolve, + * + * // inject service by name + * // When a string is found, desugar creating a resolve that injects the named service + * myGraultResolve: "SomeService" + * } + * + * or: + * + * [ + * new Resolvable("myFooResolve", function() { return "myFooData" }), + * new Resolvable("myBarResolve", function(dep) { return dep.fetchSomethingAsPromise() }, [ "DependencyName" ]), + * { provide: "myBazResolve", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ "DependencyName" ] } + * ] + */ +function resolvablesBuilder(state) { + /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */ + var objects2Tuples = function (resolveObj, resolvePolicies) { + return Object.keys(resolveObj || {}).map(function (token) { return ({ + token: token, + val: resolveObj[token], + deps: undefined, + policy: resolvePolicies[token], + }); }); + }; + /** fetch DI annotations from a function or ng1-style array */ + var annotate = function (fn) { + var $injector = _common_coreservices__WEBPACK_IMPORTED_MODULE_5__.services.$injector; + // ng1 doesn't have an $injector until runtime. + // If the $injector doesn't exist, use "deferred" literal as a + // marker indicating they should be annotated when runtime starts + return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || 'deferred'; + }; + /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */ + var isResolveLiteral = function (obj) { return !!(obj.token && obj.resolveFn); }; + /** true if the object looks like a provide literal, or a ng2 Provider */ + var isLikeNg2Provider = function (obj) { + return !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass)); + }; + /** true if the object looks like a tuple from obj2Tuples */ + var isTupleFromObj = function (obj) { + return !!(obj && obj.val && ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(obj.val) || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(obj.val) || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction)(obj.val))); + }; + /** extracts the token from a Provider or provide literal */ + var getToken = function (p) { return p.provide || p.token; }; + // prettier-ignore: Given a literal resolve or provider object, returns a Resolvable + var literal2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('resolveFn'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), p.resolveFn, p.deps, p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useFactory'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), p.useFactory, p.deps || p.dependencies, p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useClass'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), function () { return new p.useClass(); }, [], p.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useValue'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), function () { return p.useValue; }, [], p.policy, p.useValue); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useExisting'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, [p.useExisting], p.policy); }], + ]); + // prettier-ignore + var tuple2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, [tuple.val], tuple.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(tuple.val), tuple.val.slice(0, -1), tuple.policy); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy); }], + ]); + // prettier-ignore + var item2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable), function (r) { return r; }], + [isResolveLiteral, literal2Resolvable], + [isLikeNg2Provider, literal2Resolvable], + [isTupleFromObj, tuple2Resolvable], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.val)(true), function (obj) { throw new Error('Invalid resolve value: ' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(obj)); },], + ]); + // If resolveBlock is already an array, use it as-is. + // Otherwise, assume it's an object and convert to an Array of tuples + var decl = state.resolve; + var items = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {}); + return items.map(item2Resolvable); +} +/** + * A internal global service + * + * StateBuilder is a factory for the internal [[StateObject]] objects. + * + * When you register a state with the [[StateRegistry]], you register a plain old javascript object which + * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding + * [[StateObject]] object, which has an API and is used internally. + * + * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function + * using the [[builder]] method. + */ +var StateBuilder = /** @class */ (function () { + function StateBuilder(matcher, urlMatcherFactory) { + this.matcher = matcher; + var self = this; + var root = function () { return matcher.find(''); }; + var isRoot = function (state) { return state.name === ''; }; + function parentBuilder(state) { + if (isRoot(state)) + return null; + return matcher.find(self.parentName(state)) || root(); + } + this.builders = { + name: [nameBuilder], + self: [selfBuilder], + parent: [parentBuilder], + data: [dataBuilder], + // Build a URLMatcher if necessary, either via a relative or absolute URL + url: [getUrlBuilder(urlMatcherFactory, root)], + // Keep track of the closest ancestor state that has a URL (i.e. is navigable) + navigable: [getNavigableBuilder(isRoot)], + params: [getParamsBuilder(urlMatcherFactory.paramFactory)], + // Each framework-specific ui-router implementation should define its own `views` builder + // e.g., src/ng1/statebuilders/views.ts + views: [], + // Keep a full path from the root down to this state as this is needed for state activation. + path: [pathBuilder], + // Speed up $state.includes() as it's used a lot + includes: [includesBuilder], + resolvables: [resolvablesBuilder], + }; + } + StateBuilder.prototype.builder = function (name, fn) { + var builders = this.builders; + var array = builders[name] || []; + // Backwards compat: if only one builder exists, return it, else return whole arary. + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(name) && !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(fn)) + return array.length > 1 ? array : array[0]; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(name) || !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction)(fn)) + return; + builders[name] = array; + builders[name].push(fn); + return function () { return builders[name].splice(builders[name].indexOf(fn, 1)) && null; }; + }; + /** + * Builds all of the properties on an essentially blank State object, returning a State object which has all its + * properties and API built. + * + * @param state an uninitialized State object + * @returns the built State object + */ + StateBuilder.prototype.build = function (state) { + var _a = this, matcher = _a.matcher, builders = _a.builders; + var parent = this.parentName(state); + if (parent && !matcher.find(parent, undefined, false)) { + return null; + } + for (var key in builders) { + if (!builders.hasOwnProperty(key)) + continue; + var chain = builders[key].reduce(function (parentFn, step) { return function (_state) { return step(_state, parentFn); }; }, _common_common__WEBPACK_IMPORTED_MODULE_0__.noop); + state[key] = chain(state); + } + return state; + }; + StateBuilder.prototype.parentName = function (state) { + // name = 'foo.bar.baz.**' + var name = state.name || ''; + // segments = ['foo', 'bar', 'baz', '.**'] + var segments = name.split('.'); + // segments = ['foo', 'bar', 'baz'] + var lastSegment = segments.pop(); + // segments = ['foo', 'bar'] (ignore .** segment for future states) + if (lastSegment === '**') + segments.pop(); + if (segments.length) { + if (state.parent) { + throw new Error("States that specify the 'parent:' property should not have a '.' in their name (" + name + ")"); + } + // 'foo.bar' + return segments.join('.'); + } + if (!state.parent) + return ''; + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(state.parent) ? state.parent : state.parent.name; + }; + StateBuilder.prototype.name = function (state) { + var name = state.name; + if (name.indexOf('.') !== -1 || !state.parent) + return name; + var parentName = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(state.parent) ? state.parent : state.parent.name; + return parentName ? parentName + '.' + name : name; + }; + return StateBuilder; +}()); + +//# sourceMappingURL=stateBuilder.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateMatcher": () => (/* binding */ StateMatcher) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_safeConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/safeConsole */ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"); + + + +var StateMatcher = /** @class */ (function () { + function StateMatcher(_states) { + this._states = _states; + } + StateMatcher.prototype.isRelative = function (stateName) { + stateName = stateName || ''; + return stateName.indexOf('.') === 0 || stateName.indexOf('^') === 0; + }; + StateMatcher.prototype.find = function (stateOrName, base, matchGlob) { + if (matchGlob === void 0) { matchGlob = true; } + if (!stateOrName && stateOrName !== '') + return undefined; + var isStr = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(stateOrName); + var name = isStr ? stateOrName : stateOrName.name; + if (this.isRelative(name)) + name = this.resolvePath(name, base); + var state = this._states[name]; + if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) { + return state; + } + else if (isStr && matchGlob) { + var _states = (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.values)(this._states); + var matches = _states.filter(function (_state) { return _state.__stateObjectCache.nameGlob && _state.__stateObjectCache.nameGlob.matches(name); }); + if (matches.length > 1) { + _common_safeConsole__WEBPACK_IMPORTED_MODULE_2__.safeConsole.error("stateMatcher.find: Found multiple matches for " + name + " using glob: ", matches.map(function (match) { return match.name; })); + } + return matches[0]; + } + return undefined; + }; + StateMatcher.prototype.resolvePath = function (name, base) { + if (!base) + throw new Error("No reference point given for path '" + name + "'"); + var baseState = this.find(base); + var splitName = name.split('.'); + var pathLength = splitName.length; + var i = 0, current = baseState; + for (; i < pathLength; i++) { + if (splitName[i] === '' && i === 0) { + current = baseState; + continue; + } + if (splitName[i] === '^') { + if (!current.parent) + throw new Error("Path '" + name + "' not valid for state '" + baseState.name + "'"); + current = current.parent; + continue; + } + break; + } + var relName = splitName.slice(i).join('.'); + return current.name + (current.name && relName ? '.' : '') + relName; + }; + return StateMatcher; +}()); + +//# sourceMappingURL=stateMatcher.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateObject.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateObject": () => (/* binding */ StateObject) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_glob__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + + + + +/** + * Internal representation of a UI-Router state. + * + * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]]. + * + * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object. + * + * This class prototypally inherits from the corresponding [[StateDeclaration]]. + * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]]. + */ +var StateObject = /** @class */ (function () { + /** @deprecated use State.create() */ + function StateObject(config) { + return StateObject.create(config || {}); + } + /** + * Create a state object to put the private/internal implementation details onto. + * The object's prototype chain looks like: + * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...) + * + * @param stateDecl the user-supplied State Declaration + * @returns {StateObject} an internal State object + */ + StateObject.create = function (stateDecl) { + stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl; + var state = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(stateDecl, StateObject.prototype)); + stateDecl.$$state = function () { return state; }; + state.self = stateDecl; + state.__stateObjectCache = { + nameGlob: _common_glob__WEBPACK_IMPORTED_MODULE_2__.Glob.fromString(state.name), + }; + return state; + }; + /** + * Returns true if the provided parameter is the same state. + * + * Compares the identity of the state against the passed value, which is either an object + * reference to the actual `State` instance, the original definition object passed to + * `$stateProvider.state()`, or the fully-qualified name. + * + * @param ref Can be one of (a) a `State` instance, (b) an object that was passed + * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string. + * @returns Returns `true` if `ref` matches the current `State` instance. + */ + StateObject.prototype.is = function (ref) { + return this === ref || this.self === ref || this.fqn() === ref; + }; + /** + * @deprecated this does not properly handle dot notation + * @returns Returns a dot-separated name of the state. + */ + StateObject.prototype.fqn = function () { + if (!this.parent || !(this.parent instanceof this.constructor)) + return this.name; + var name = this.parent.fqn(); + return name ? name + '.' + this.name : this.name; + }; + /** + * Returns the root node of this state's tree. + * + * @returns The root of this state's tree. + */ + StateObject.prototype.root = function () { + return (this.parent && this.parent.root()) || this; + }; + /** + * Gets the state's `Param` objects + * + * Gets the list of [[Param]] objects owned by the state. + * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects. + * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object + * + * @param opts options + */ + StateObject.prototype.parameters = function (opts) { + opts = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(opts, { inherit: true, matchingKeys: null }); + var inherited = (opts.inherit && this.parent && this.parent.parameters()) || []; + return inherited + .concat((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.params)) + .filter(function (param) { return !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id); }); + }; + /** + * Returns a single [[Param]] that is owned by the state + * + * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s. + * @param id the name of the [[Param]] to return + * @param opts options + */ + StateObject.prototype.parameter = function (id, opts) { + if (opts === void 0) { opts = {}; } + return ((this.url && this.url.parameter(id, opts)) || + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.params), (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', id)) || + (opts.inherit && this.parent && this.parent.parameter(id))); + }; + StateObject.prototype.toString = function () { + return this.fqn(); + }; + /** Predicate which returns true if the object is an class with @State() decorator */ + StateObject.isStateClass = function (stateDecl) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isFunction)(stateDecl) && stateDecl['__uiRouterState'] === true; + }; + /** Predicate which returns true if the object is a [[StateDeclaration]] object */ + StateObject.isStateDeclaration = function (obj) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isFunction)(obj['$$state']); }; + /** Predicate which returns true if the object is an internal [[StateObject]] object */ + StateObject.isState = function (obj) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isObject)(obj['__stateObjectCache']); }; + return StateObject; +}()); + +//# sourceMappingURL=stateObject.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateQueueManager": () => (/* binding */ StateQueueManager) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _stateObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); + + +var StateQueueManager = /** @class */ (function () { + function StateQueueManager(router, states, builder, listeners) { + this.router = router; + this.states = states; + this.builder = builder; + this.listeners = listeners; + this.queue = []; + } + StateQueueManager.prototype.dispose = function () { + this.queue = []; + }; + StateQueueManager.prototype.register = function (stateDecl) { + var queue = this.queue; + var state = _stateObject__WEBPACK_IMPORTED_MODULE_1__.StateObject.create(stateDecl); + var name = state.name; + if (!(0,_common__WEBPACK_IMPORTED_MODULE_0__.isString)(name)) + throw new Error('State must have a valid name'); + if (this.states.hasOwnProperty(name) || (0,_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(queue.map((0,_common__WEBPACK_IMPORTED_MODULE_0__.prop)('name')), name)) + throw new Error("State '" + name + "' is already defined"); + queue.push(state); + this.flush(); + return state; + }; + StateQueueManager.prototype.flush = function () { + var _this = this; + var _a = this, queue = _a.queue, states = _a.states, builder = _a.builder; + var registered = [], // states that got registered + orphans = [], // states that don't yet have a parent registered + previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered + var getState = function (name) { return _this.states.hasOwnProperty(name) && _this.states[name]; }; + var notifyListeners = function () { + if (registered.length) { + _this.listeners.forEach(function (listener) { + return listener('registered', registered.map(function (s) { return s.self; })); + }); + } + }; + while (queue.length > 0) { + var state = queue.shift(); + var name_1 = state.name; + var result = builder.build(state); + var orphanIdx = orphans.indexOf(state); + if (result) { + var existingState = getState(name_1); + if (existingState && existingState.name === name_1) { + throw new Error("State '" + name_1 + "' is already defined"); + } + var existingFutureState = getState(name_1 + '.**'); + if (existingFutureState) { + // Remove future state of the same name + this.router.stateRegistry.deregister(existingFutureState); + } + states[name_1] = state; + this.attachRoute(state); + if (orphanIdx >= 0) + orphans.splice(orphanIdx, 1); + registered.push(state); + continue; + } + var prev = previousQueueLength[name_1]; + previousQueueLength[name_1] = queue.length; + if (orphanIdx >= 0 && prev === queue.length) { + // Wait until two consecutive iterations where no additional states were dequeued successfully. + // throw new Error(`Cannot register orphaned state '${name}'`); + queue.push(state); + notifyListeners(); + return states; + } + else if (orphanIdx < 0) { + orphans.push(state); + } + queue.push(state); + } + notifyListeners(); + return states; + }; + StateQueueManager.prototype.attachRoute = function (state) { + if (state.abstract || !state.url) + return; + var rulesApi = this.router.urlService.rules; + rulesApi.rule(rulesApi.urlRuleFactory.create(state)); + }; + return StateQueueManager; +}()); + +//# sourceMappingURL=stateQueueManager.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js": +/*!********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateRegistry": () => (/* binding */ StateRegistry) +/* harmony export */ }); +/* harmony import */ var _stateMatcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./stateMatcher */ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"); +/* harmony import */ var _stateBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateBuilder */ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"); +/* harmony import */ var _stateQueueManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateQueueManager */ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + + +/** + * A registry for all of the application's [[StateDeclaration]]s + * + * This API is found at `router.stateRegistry` ([[UIRouter.stateRegistry]]) + */ +var StateRegistry = /** @class */ (function () { + /** @internal */ + function StateRegistry(router) { + this.router = router; + this.states = {}; + /** @internal */ + this.listeners = []; + this.matcher = new _stateMatcher__WEBPACK_IMPORTED_MODULE_0__.StateMatcher(this.states); + this.builder = new _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.StateBuilder(this.matcher, router.urlMatcherFactory); + this.stateQueue = new _stateQueueManager__WEBPACK_IMPORTED_MODULE_2__.StateQueueManager(router, this.states, this.builder, this.listeners); + this._registerRoot(); + } + /** @internal */ + StateRegistry.prototype._registerRoot = function () { + var rootStateDef = { + name: '', + url: '^', + views: null, + params: { + '#': { value: null, type: 'hash', dynamic: true }, + }, + abstract: true, + }; + var _root = (this._root = this.stateQueue.register(rootStateDef)); + _root.navigable = null; + }; + /** @internal */ + StateRegistry.prototype.dispose = function () { + var _this = this; + this.stateQueue.dispose(); + this.listeners = []; + this.get().forEach(function (state) { return _this.get(state) && _this.deregister(state); }); + }; + /** + * Listen for a State Registry events + * + * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry. + * + * #### Example: + * ```js + * let allStates = registry.get(); + * + * // Later, invoke deregisterFn() to remove the listener + * let deregisterFn = registry.onStatesChanged((event, states) => { + * switch(event) { + * case: 'registered': + * states.forEach(state => allStates.push(state)); + * break; + * case: 'deregistered': + * states.forEach(state => { + * let idx = allStates.indexOf(state); + * if (idx !== -1) allStates.splice(idx, 1); + * }); + * break; + * } + * }); + * ``` + * + * @param listener a callback function invoked when the registered states changes. + * The function receives two parameters, `event` and `state`. + * See [[StateRegistryListener]] + * @return a function that deregisters the listener + */ + StateRegistry.prototype.onStatesChanged = function (listener) { + this.listeners.push(listener); + return function deregisterListener() { + (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.removeFrom)(this.listeners)(listener); + }.bind(this); + }; + /** + * Gets the implicit root state + * + * Gets the root of the state tree. + * The root state is implicitly created by UI-Router. + * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]] + * + * @return the root [[StateObject]] + */ + StateRegistry.prototype.root = function () { + return this._root; + }; + /** + * Adds a state to the registry + * + * Registers a [[StateDeclaration]] or queues it for registration. + * + * Note: a state will be queued if the state's parent isn't yet registered. + * + * @param stateDefinition the definition of the state to register. + * @returns the internal [[StateObject]] object. + * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]). + * If the state was only queued, then the object is not fully built. + */ + StateRegistry.prototype.register = function (stateDefinition) { + return this.stateQueue.register(stateDefinition); + }; + /** @internal */ + StateRegistry.prototype._deregisterTree = function (state) { + var _this = this; + var all = this.get().map(function (s) { return s.$$state(); }); + var getChildren = function (states) { + var _children = all.filter(function (s) { return states.indexOf(s.parent) !== -1; }); + return _children.length === 0 ? _children : _children.concat(getChildren(_children)); + }; + var children = getChildren([state]); + var deregistered = [state].concat(children).reverse(); + deregistered.forEach(function (_state) { + var rulesApi = _this.router.urlService.rules; + // Remove URL rule + rulesApi + .rules() + .filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.propEq)('state', _state)) + .forEach(function (rule) { return rulesApi.removeRule(rule); }); + // Remove state from registry + delete _this.states[_state.name]; + }); + return deregistered; + }; + /** + * Removes a state from the registry + * + * This removes a state from the registry. + * If the state has children, they are are also removed from the registry. + * + * @param stateOrName the state's name or object representation + * @returns {StateObject[]} a list of removed states + */ + StateRegistry.prototype.deregister = function (stateOrName) { + var _state = this.get(stateOrName); + if (!_state) + throw new Error("Can't deregister state; not found: " + stateOrName); + var deregisteredStates = this._deregisterTree(_state.$$state()); + this.listeners.forEach(function (listener) { + return listener('deregistered', deregisteredStates.map(function (s) { return s.self; })); + }); + return deregisteredStates; + }; + StateRegistry.prototype.get = function (stateOrName, base) { + var _this = this; + if (arguments.length === 0) + return Object.keys(this.states).map(function (name) { return _this.states[name].self; }); + var found = this.matcher.find(stateOrName, base); + return (found && found.self) || null; + }; + /** + * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`). + * More than one BuilderFunction can be registered for a given property. + * + * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects. + * + * @param property The name of the State property being registered for. + * @param builderFunction The BuilderFunction which will be used to build the State property + * @returns a function which deregisters the BuilderFunction + */ + StateRegistry.prototype.decorator = function (property, builderFunction) { + return this.builder.builder(property, builderFunction); + }; + return StateRegistry; +}()); + +//# sourceMappingURL=stateRegistry.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/stateService.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/stateService.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "StateService": () => (/* binding */ StateService) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_queue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _path_pathNode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../path/pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); +/* harmony import */ var _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../transition/transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _targetState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _common_glob__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../common/glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../hooks/lazyLoad */ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + + + + + + + + + + + +/** + * Provides services related to ui-router states. + * + * This API is located at `router.stateService` ([[UIRouter.stateService]]) + */ +var StateService = /** @class */ (function () { + /** @internal */ + function StateService(/** @internal */ router) { + this.router = router; + /** @internal */ + this.invalidCallbacks = []; + /** @internal */ + this._defaultErrorHandler = function $defaultErrorHandler($error$) { + if ($error$ instanceof Error && $error$.stack) { + console.error($error$); + console.error($error$.stack); + } + else if ($error$ instanceof _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection) { + console.error($error$.toString()); + if ($error$.detail && $error$.detail.stack) + console.error($error$.detail.stack); + } + else { + console.error($error$); + } + }; + var getters = ['current', '$current', 'params', 'transition']; + var boundFns = Object.keys(StateService.prototype).filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.not)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(getters))); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)((0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.val)(StateService.prototype), this, (0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.val)(this), boundFns); + } + Object.defineProperty(StateService.prototype, "transition", { + /** + * The [[Transition]] currently in progress (or null) + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.transition]] + */ + get: function () { + return this.router.globals.transition; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "params", { + /** + * The latest successful state parameters + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.params]] + */ + get: function () { + return this.router.globals.params; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "current", { + /** + * The current [[StateDeclaration]] + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.current]] + */ + get: function () { + return this.router.globals.current; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StateService.prototype, "$current", { + /** + * The current [[StateObject]] (an internal API) + * + * @deprecated This is a passthrough through to [[UIRouterGlobals.$current]] + */ + get: function () { + return this.router.globals.$current; + }, + enumerable: false, + configurable: true + }); + /** @internal */ + StateService.prototype.dispose = function () { + this.defaultErrorHandler(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); + this.invalidCallbacks = []; + }; + /** + * Handler for when [[transitionTo]] is called with an invalid state. + * + * Invokes the [[onInvalid]] callbacks, in natural order. + * Each callback's return value is checked in sequence until one of them returns an instance of TargetState. + * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises. + * + * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned. + * + * @internal + */ + StateService.prototype._handleInvalidTargetState = function (fromPath, toState) { + var _this = this; + var fromState = _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__.PathUtils.makeTargetState(this.router.stateRegistry, fromPath); + var globals = this.router.globals; + var latestThing = function () { return globals.transitionHistory.peekTail(); }; + var latest = latestThing(); + var callbackQueue = new _common_queue__WEBPACK_IMPORTED_MODULE_2__.Queue(this.invalidCallbacks.slice()); + var injector = new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_11__.ResolveContext(fromPath).injector(); + var checkForRedirect = function (result) { + if (!(result instanceof _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState)) { + return; + } + var target = result; + // Recreate the TargetState, in case the state is now defined. + target = _this.target(target.identifier(), target.params(), target.options()); + if (!target.valid()) { + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.invalid(target.error()).toPromise(); + } + if (latestThing() !== latest) { + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.superseded().toPromise(); + } + return _this.transitionTo(target.identifier(), target.params(), target.options()); + }; + function invokeNextCallback() { + var nextCallback = callbackQueue.dequeue(); + if (nextCallback === undefined) + return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.invalid(toState.error()).toPromise(); + var callbackResult = _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(nextCallback(toState, fromState, injector)); + return callbackResult.then(checkForRedirect).then(function (result) { return result || invokeNextCallback(); }); + } + return invokeNextCallback(); + }; + /** + * Registers an Invalid State handler + * + * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]] + * has been called with an invalid state reference parameter + * + * Example: + * ```js + * stateService.onInvalid(function(to, from, injector) { + * if (to.name() === 'foo') { + * let lazyLoader = injector.get('LazyLoadService'); + * return lazyLoader.load('foo') + * .then(() => stateService.target('foo')); + * } + * }); + * ``` + * + * @param {function} callback invoked when the toState is invalid + * This function receives the (invalid) toState, the fromState, and an injector. + * The function may optionally return a [[TargetState]] or a Promise for a TargetState. + * If one is returned, it is treated as a redirect. + * + * @returns a function which deregisters the callback + */ + StateService.prototype.onInvalid = function (callback) { + this.invalidCallbacks.push(callback); + return function deregisterListener() { + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(this.invalidCallbacks)(callback); + }.bind(this); + }; + /** + * Reloads the current state + * + * A method that force reloads the current state, or a partial state hierarchy. + * All resolves are re-resolved, and components reinstantiated. + * + * #### Example: + * ```js + * let app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * $state.reload(); + * } + * }); + * ``` + * + * Note: `reload()` is just an alias for: + * + * ```js + * $state.transitionTo($state.current, $state.params, { + * reload: true, inherit: false + * }); + * ``` + * + * @param reloadState A state name or a state object. + * If present, this state and all its children will be reloaded, but ancestors will not reload. + * + * #### Example: + * ```js + * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item' + * //and current state is 'contacts.detail.item' + * let app angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.reload = function(){ + * //will reload 'contact.detail' and nested 'contact.detail.item' states + * $state.reload('contact.detail'); + * } + * }); + * ``` + * + * @returns A promise representing the state of the new transition. See [[StateService.go]] + */ + StateService.prototype.reload = function (reloadState) { + return this.transitionTo(this.current, this.params, { + reload: (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(reloadState) ? reloadState : true, + inherit: false, + notify: false, + }); + }; + /** + * Transition to a different state and/or parameters + * + * Convenience method for transitioning to a new state. + * + * `$state.go` calls `$state.transitionTo` internally but automatically sets options to + * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`. + * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`). + * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters + * inherit from the current parameter values (because of `inherit: true`). + * + * #### Example: + * ```js + * let app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.go('contact.detail'); + * }; + * }); + * ``` + * + * @param to Absolute state name, state object, or relative state path (relative to current state). + * + * Some examples: + * + * - `$state.go('contact.detail')` - will go to the `contact.detail` state + * - `$state.go('^')` - will go to the parent state + * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state + * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state + * + * @param params A map of the parameters that will be sent to the state, will populate $stateParams. + * + * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`). + * This allows, for example, going to a sibling state that shares parameters defined by a parent state. + * + * @param options Transition options + * + * @returns {promise} A promise representing the state of the new transition. + */ + StateService.prototype.go = function (to, params, options) { + var defautGoOpts = { relative: this.$current, inherit: true }; + var transOpts = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, defautGoOpts, _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__.defaultTransOpts); + return this.transitionTo(to, params, transOpts); + }; + /** + * Creates a [[TargetState]] + * + * This is a factory method for creating a TargetState + * + * This may be returned from a Transition Hook to redirect a transition, for example. + */ + StateService.prototype.target = function (identifier, params, options) { + if (options === void 0) { options = {}; } + // If we're reloading, find the state object to reload from + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isObject)(options.reload) && !options.reload.name) + throw new Error('Invalid reload state object'); + var reg = this.router.stateRegistry; + options.reloadState = + options.reload === true ? reg.root() : reg.matcher.find(options.reload, options.relative); + if (options.reload && !options.reloadState) + throw new Error("No such reload state '" + ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(options.reload) ? options.reload : options.reload.name) + "'"); + return new _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState(this.router.stateRegistry, identifier, params, options); + }; + /** @internal */ + StateService.prototype.getCurrentPath = function () { + var _this = this; + var globals = this.router.globals; + var latestSuccess = globals.successfulTransitions.peekTail(); + var rootPath = function () { return [new _path_pathNode__WEBPACK_IMPORTED_MODULE_5__.PathNode(_this.router.stateRegistry.root())]; }; + return latestSuccess ? latestSuccess.treeChanges().to : rootPath(); + }; + /** + * Low-level method for transitioning to a new state. + * + * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations. + * + * #### Example: + * ```js + * let app = angular.module('app', ['ui.router']); + * + * app.controller('ctrl', function ($scope, $state) { + * $scope.changeState = function () { + * $state.transitionTo('contact.detail'); + * }; + * }); + * ``` + * + * @param to State name or state object. + * @param toParams A map of the parameters that will be sent to the state, + * will populate $stateParams. + * @param options Transition options + * + * @returns A promise representing the state of the new transition. See [[go]] + */ + StateService.prototype.transitionTo = function (to, toParams, options) { + var _this = this; + if (toParams === void 0) { toParams = {}; } + if (options === void 0) { options = {}; } + var router = this.router; + var globals = router.globals; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__.defaultTransOpts); + var getCurrent = function () { return globals.transition; }; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(options, { current: getCurrent }); + var ref = this.target(to, toParams, options); + var currentPath = this.getCurrentPath(); + if (!ref.exists()) + return this._handleInvalidTargetState(currentPath, ref); + if (!ref.valid()) + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silentRejection)(ref.error()); + if (options.supercede === false && getCurrent()) { + return (_transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.ignored('Another transition is in progress and supercede has been set to false in TransitionOptions for the transition. So the transition was ignored in favour of the existing one in progress.').toPromise()); + } + /** + * Special handling for Ignored, Aborted, and Redirected transitions + * + * The semantics for the transition.run() promise and the StateService.transitionTo() + * promise differ. For instance, the run() promise may be rejected because it was + * IGNORED, but the transitionTo() promise is resolved because from the user perspective + * no error occurred. Likewise, the transition.run() promise may be rejected because of + * a Redirect, but the transitionTo() promise is chained to the new Transition's promise. + */ + var rejectedTransitionHandler = function (trans) { return function (error) { + if (error instanceof _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection) { + var isLatest = router.globals.lastStartedTransitionId <= trans.$id; + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.IGNORED) { + isLatest && router.urlRouter.update(); + // Consider ignored `Transition.run()` as a successful `transitionTo` + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(globals.current); + } + var detail = error.detail; + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.SUPERSEDED && error.redirected && detail instanceof _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState) { + // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully + // by returning the promise for the new (redirect) `Transition.run()`. + var redirect = trans.redirect(detail); + return redirect.run().catch(rejectedTransitionHandler(redirect)); + } + if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.ABORTED) { + isLatest && router.urlRouter.update(); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.reject(error); + } + } + var errorHandler = _this.defaultErrorHandler(); + errorHandler(error); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.reject(error); + }; }; + var transition = this.router.transitionService.create(currentPath, ref); + var transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition)); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise)(transitionToPromise); // issue #2676 + // Return a promise for the transition, which also has the transition object on it. + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(transitionToPromise, { transition: transition }); + }; + /** + * Checks if the current state *is* the provided state + * + * Similar to [[includes]] but only checks for the full state name. + * If params is supplied then it will be tested for strict equality against the current + * active params object, so all params must match with none missing and no extras. + * + * #### Example: + * ```js + * $state.$current.name = 'contacts.details.item'; + * + * // absolute name + * $state.is('contact.details.item'); // returns true + * $state.is(contactDetailItemStateObject); // returns true + * ``` + * + * // relative name (. and ^), typically from a template + * // E.g. from the 'contacts.details' template + * ```html + *
    Item
    + * ``` + * + * @param stateOrName The state name (absolute or relative) or state object you'd like to check. + * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like + * to test against the current active state. + * @param options An options object. The options are: + * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns Returns true if it is the state. + */ + StateService.prototype.is = function (stateOrName, params, options) { + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, { relative: this.$current }); + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return undefined; + if (this.$current !== state) + return false; + if (!params) + return true; + var schema = state.parameters({ inherit: true, matchingKeys: params }); + return _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.equals(schema, _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.values(schema, params), this.params); + }; + /** + * Checks if the current state *includes* the provided state + * + * A method to determine if the current active state is equal to or is the child of the + * state stateName. If any params are passed then they will be tested for a match as well. + * Not all the parameters need to be passed, just the ones you'd like to test for equality. + * + * #### Example when `$state.$current.name === 'contacts.details.item'` + * ```js + * // Using partial names + * $state.includes("contacts"); // returns true + * $state.includes("contacts.details"); // returns true + * $state.includes("contacts.details.item"); // returns true + * $state.includes("contacts.list"); // returns false + * $state.includes("about"); // returns false + * ``` + * + * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`: + * ```js + * $state.includes("*.details.*.*"); // returns true + * $state.includes("*.details.**"); // returns true + * $state.includes("**.item.**"); // returns true + * $state.includes("*.details.item.url"); // returns true + * $state.includes("*.details.*.url"); // returns true + * $state.includes("*.details.*"); // returns false + * $state.includes("item.**"); // returns false + * ``` + * + * @param stateOrName A partial name, relative name, glob pattern, + * or state object to be searched for within the current state name. + * @param params A param object, e.g. `{sectionId: section.id}`, + * that you'd like to test against the current active state. + * @param options An options object. The options are: + * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will + * test relative to `options.relative` state (or name). + * + * @returns {boolean} Returns true if it does include the state + */ + StateService.prototype.includes = function (stateOrName, params, options) { + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, { relative: this.$current }); + var glob = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(stateOrName) && _common_glob__WEBPACK_IMPORTED_MODULE_10__.Glob.fromString(stateOrName); + if (glob) { + if (!glob.matches(this.$current.name)) + return false; + stateOrName = this.$current.name; + } + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return undefined; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(include[state.name])) + return false; + if (!params) + return true; + var schema = state.parameters({ inherit: true, matchingKeys: params }); + return _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.equals(schema, _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.values(schema, params), this.params); + }; + /** + * Generates a URL for a state and parameters + * + * Returns the url for the given state populated with the given params. + * + * #### Example: + * ```js + * expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob"); + * ``` + * + * @param stateOrName The state name or state object you'd like to generate a url from. + * @param params An object of parameter values to fill the state's required parameters. + * @param options Options object. The options are: + * + * @returns {string} compiled state url + */ + StateService.prototype.href = function (stateOrName, params, options) { + var defaultHrefOpts = { + lossy: true, + inherit: true, + absolute: false, + relative: this.$current, + }; + options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, defaultHrefOpts); + params = params || {}; + var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) + return null; + if (options.inherit) + params = this.params.$inherit(params, this.$current, state); + var nav = state && options.lossy ? state.navigable : state; + if (!nav || nav.url === undefined || nav.url === null) { + return null; + } + return this.router.urlRouter.href(nav.url, params, { absolute: options.absolute }); + }; + /** + * Sets or gets the default [[transitionTo]] error handler. + * + * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition. + * This includes errors caused by resolves and transition hooks. + * + * Note: + * This handler does not receive certain Transition rejections. + * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]]. + * + * The built-in default error handler logs the error to the console. + * + * You can provide your own custom handler. + * + * #### Example: + * ```js + * stateService.defaultErrorHandler(function() { + * // Do not log transitionTo errors + * }); + * ``` + * + * @param handler a global error handler function + * @returns the current global error handler + */ + StateService.prototype.defaultErrorHandler = function (handler) { + return (this._defaultErrorHandler = handler || this._defaultErrorHandler); + }; + StateService.prototype.get = function (stateOrName, base) { + var reg = this.router.stateRegistry; + if (arguments.length === 0) + return reg.get(); + return reg.get(stateOrName, base || this.$current); + }; + /** + * Lazy loads a state + * + * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function. + * + * @param stateOrName the state that should be lazy loaded + * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc) + * Note: If no transition is provided, a noop transition is created using the from the current state to the current state. + * This noop transition is not actually run. + * + * @returns a promise to lazy load + */ + StateService.prototype.lazyLoad = function (stateOrName, transition) { + var state = this.get(stateOrName); + if (!state || !state.lazyLoad) + throw new Error('Can not lazy load ' + stateOrName); + var currentPath = this.getCurrentPath(); + var target = _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__.PathUtils.makeTargetState(this.router.stateRegistry, currentPath); + transition = transition || this.router.transitionService.create(currentPath, target); + return (0,_hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_12__.lazyLoadState)(transition, state); + }; + return StateService; +}()); + +//# sourceMappingURL=stateService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/state/targetState.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/state/targetState.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TargetState": () => (/* binding */ TargetState) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + +/** + * Encapsulate the target (destination) state/params/options of a [[Transition]]. + * + * This class is frequently used to redirect a transition to a new destination. + * + * See: + * + * - [[HookResult]] + * - [[TransitionHookFn]] + * - [[TransitionService.onStart]] + * + * To create a `TargetState`, use [[StateService.target]]. + * + * --- + * + * This class wraps: + * + * 1) an identifier for a state + * 2) a set of parameters + * 3) and transition options + * 4) the registered state object (the [[StateDeclaration]]) + * + * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can + * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string). + * The `TargetState` class normalizes those options. + * + * A `TargetState` may be valid (the state being targeted exists in the registry) + * or invalid (the state being targeted is not registered). + */ +var TargetState = /** @class */ (function () { + /** + * The TargetState constructor + * + * Note: Do not construct a `TargetState` manually. + * To create a `TargetState`, use the [[StateService.target]] factory method. + * + * @param _stateRegistry The StateRegistry to use to look up the _definition + * @param _identifier An identifier for a state. + * Either a fully-qualified state name, or the object used to define the state. + * @param _params Parameters for the target state + * @param _options Transition options. + * + * @internal + */ + function TargetState(_stateRegistry, _identifier, _params, _options) { + this._stateRegistry = _stateRegistry; + this._identifier = _identifier; + this._identifier = _identifier; + this._params = (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, _params || {}); + this._options = (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, _options || {}); + this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative); + } + /** The name of the state this object targets */ + TargetState.prototype.name = function () { + return (this._definition && this._definition.name) || this._identifier; + }; + /** The identifier used when creating this TargetState */ + TargetState.prototype.identifier = function () { + return this._identifier; + }; + /** The target parameter values */ + TargetState.prototype.params = function () { + return this._params; + }; + /** The internal state object (if it was found) */ + TargetState.prototype.$state = function () { + return this._definition; + }; + /** The internal state declaration (if it was found) */ + TargetState.prototype.state = function () { + return this._definition && this._definition.self; + }; + /** The target options */ + TargetState.prototype.options = function () { + return this._options; + }; + /** True if the target state was found */ + TargetState.prototype.exists = function () { + return !!(this._definition && this._definition.self); + }; + /** True if the object is valid */ + TargetState.prototype.valid = function () { + return !this.error(); + }; + /** If the object is invalid, returns the reason why */ + TargetState.prototype.error = function () { + var base = this.options().relative; + if (!this._definition && !!base) { + var stateName = base.name ? base.name : base; + return "Could not resolve '" + this.name() + "' from state '" + stateName + "'"; + } + if (!this._definition) + return "No such state '" + this.name() + "'"; + if (!this._definition.self) + return "State '" + this.name() + "' has an invalid definition"; + }; + TargetState.prototype.toString = function () { + return "'" + this.name() + "'" + (0,_common_strings__WEBPACK_IMPORTED_MODULE_1__.stringify)(this.params()); + }; + /** + * Returns a copy of this TargetState which targets a different state. + * The new TargetState has the same parameter values and transition options. + * + * @param state The new state that should be targeted + */ + TargetState.prototype.withState = function (state) { + return new TargetState(this._stateRegistry, state, this._params, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified parameter values. + * + * @param params the new parameter values to use + * @param replace When false (default) the new parameter values will be merged with the current values. + * When true the parameter values will be used instead of the current values. + */ + TargetState.prototype.withParams = function (params, replace) { + if (replace === void 0) { replace = false; } + var newParams = replace ? params : (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, this._params, params); + return new TargetState(this._stateRegistry, this._identifier, newParams, this._options); + }; + /** + * Returns a copy of this TargetState, using the specified Transition Options. + * + * @param options the new options to use + * @param replace When false (default) the new options will be merged with the current options. + * When true the options will be used instead of the current options. + */ + TargetState.prototype.withOptions = function (options, replace) { + if (replace === void 0) { replace = false; } + var newOpts = replace ? options : (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, this._options, options); + return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts); + }; + /** Returns true if the object has a state property that might be a state or state name */ + TargetState.isDef = function (obj) { + return obj && obj.state && ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(obj.state) || ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(obj.state) && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(obj.state.name))); + }; + return TargetState; +}()); + +//# sourceMappingURL=targetState.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "HookBuilder": () => (/* binding */ HookBuilder) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); + + + + +/** + * This class returns applicable TransitionHooks for a specific Transition instance. + * + * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g. + * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is + * determined by the type of hook) + * + * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition. + * + * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder + * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private + * in the Transition class, so we must also provide the Transition's _treeChanges) + */ +var HookBuilder = /** @class */ (function () { + function HookBuilder(transition) { + this.transition = transition; + } + HookBuilder.prototype.buildHooksForPhase = function (phase) { + var _this = this; + var $transitions = this.transition.router.transitionService; + return $transitions._pluginapi + ._getEvents(phase) + .map(function (type) { return _this.buildHooks(type); }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(_common_common__WEBPACK_IMPORTED_MODULE_0__.identity); + }; + /** + * Returns an array of newly built TransitionHook objects. + * + * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]]. + * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s) + * - For each of the [[PathNode]]s, creates a TransitionHook + * + * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'. + */ + HookBuilder.prototype.buildHooks = function (hookType) { + var transition = this.transition; + var treeChanges = transition.treeChanges(); + // Find all the matching registered hooks for a given hook type + var matchingHooks = this.getMatchingHooks(hookType, treeChanges, transition); + if (!matchingHooks) + return []; + var baseHookOptions = { + transition: transition, + current: transition.options().current, + }; + var makeTransitionHooks = function (hook) { + // Fetch the Nodes that caused this hook to match. + var matches = hook.matches(treeChanges, transition); + // Select the PathNode[] that will be used as TransitionHook context objects + var matchingNodes = matches[hookType.criteriaMatchPath.name]; + // Return an array of HookTuples + return matchingNodes.map(function (node) { + var _options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ + bind: hook.bind, + traceData: { hookType: hookType.name, context: node }, + }, baseHookOptions); + var state = hookType.criteriaMatchPath.scope === _interface__WEBPACK_IMPORTED_MODULE_2__.TransitionHookScope.STATE ? node.state.self : null; + var transitionHook = new _transitionHook__WEBPACK_IMPORTED_MODULE_3__.TransitionHook(transition, state, hook, _options); + return { hook: hook, node: node, transitionHook: transitionHook }; + }); + }; + return matchingHooks + .map(makeTransitionHooks) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .sort(tupleSort(hookType.reverseSort)) + .map(function (tuple) { return tuple.transitionHook; }); + }; + /** + * Finds all RegisteredHooks from: + * - The Transition object instance hook registry + * - The TransitionService ($transitions) global hook registry + * + * which matched: + * - the eventType + * - the matchCriteria (to, from, exiting, retained, entering) + * + * @returns an array of matched [[RegisteredHook]]s + */ + HookBuilder.prototype.getMatchingHooks = function (hookType, treeChanges, transition) { + var isCreate = hookType.hookPhase === _interface__WEBPACK_IMPORTED_MODULE_2__.TransitionHookPhase.CREATE; + // Instance and Global hook registries + var $transitions = this.transition.router.transitionService; + var registries = isCreate ? [$transitions] : [this.transition, $transitions]; + return registries + .map(function (reg) { return reg.getHooks(hookType.name); }) // Get named hooks from registries + .filter((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.assertPredicate)(_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray, "broken event named: " + hookType.name)) // Sanity check + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array + .filter(function (hook) { return hook.matches(treeChanges, transition); }); // Only those satisfying matchCriteria + }; + return HookBuilder; +}()); + +/** + * A factory for a sort function for HookTuples. + * + * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares + * the EventHook priority. + * + * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth + * @returns a tuple sort function + */ +function tupleSort(reverseDepthSort) { + if (reverseDepthSort === void 0) { reverseDepthSort = false; } + return function nodeDepthThenPriority(l, r) { + var factor = reverseDepthSort ? -1 : 1; + var depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor; + return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority; + }; +} +//# sourceMappingURL=hookBuilder.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js": +/*!************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "matchState": () => (/* binding */ matchState), +/* harmony export */ "RegisteredHook": () => (/* binding */ RegisteredHook), +/* harmony export */ "makeEvent": () => (/* binding */ makeEvent) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); + + +/** + * Determines if the given state matches the matchCriteria + * + * @internal + * + * @param state a State Object to test against + * @param criterion + * - If a string, matchState uses the string as a glob-matcher against the state name + * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name + * and returns a positive match if any of the globs match. + * - If a function, matchState calls the function with the state and returns true if the function's result is truthy. + * @returns {boolean} + */ +function matchState(state, criterion, transition) { + var toMatch = (0,_common__WEBPACK_IMPORTED_MODULE_0__.isString)(criterion) ? [criterion] : criterion; + function matchGlobs(_state) { + var globStrings = toMatch; + for (var i = 0; i < globStrings.length; i++) { + var glob = new _common__WEBPACK_IMPORTED_MODULE_0__.Glob(globStrings[i]); + if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) { + return true; + } + } + return false; + } + var matchFn = ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(toMatch) ? toMatch : matchGlobs); + return !!matchFn(state, transition); +} +/** + * The registration data for a registered transition hook + */ +var RegisteredHook = /** @class */ (function () { + function RegisteredHook(tranSvc, eventType, callback, matchCriteria, removeHookFromRegistry, options) { + if (options === void 0) { options = {}; } + this.tranSvc = tranSvc; + this.eventType = eventType; + this.callback = callback; + this.matchCriteria = matchCriteria; + this.removeHookFromRegistry = removeHookFromRegistry; + this.invokeCount = 0; + this._deregistered = false; + this.priority = options.priority || 0; + this.bind = options.bind || null; + this.invokeLimit = options.invokeLimit; + } + /** + * Gets the matching [[PathNode]]s + * + * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing + * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes. + * + * Returning `null` is significant to distinguish between the default + * "match-all criterion value" of `true` compared to a `() => true` function, + * when the nodes is an empty array. + * + * This is useful to allow a transition match criteria of `entering: true` + * to still match a transition, even when `entering === []`. Contrast that + * with `entering: (state) => true` which only matches when a state is actually + * being entered. + */ + RegisteredHook.prototype._matchingNodes = function (nodes, criterion, transition) { + if (criterion === true) + return nodes; + var matching = nodes.filter(function (node) { return matchState(node.state, criterion, transition); }); + return matching.length ? matching : null; + }; + /** + * Gets the default match criteria (all `true`) + * + * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.: + * + * ```js + * { + * to: true, + * from: true, + * entering: true, + * exiting: true, + * retained: true, + * } + */ + RegisteredHook.prototype._getDefaultMatchCriteria = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.mapObj)(this.tranSvc._pluginapi._getPathTypes(), function () { return true; }); + }; + /** + * Gets matching nodes as [[IMatchingNodes]] + * + * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to: + * + * ```js + * let matches: IMatchingNodes = { + * to: _matchingNodes([tail(treeChanges.to)], mc.to), + * from: _matchingNodes([tail(treeChanges.from)], mc.from), + * exiting: _matchingNodes(treeChanges.exiting, mc.exiting), + * retained: _matchingNodes(treeChanges.retained, mc.retained), + * entering: _matchingNodes(treeChanges.entering, mc.entering), + * }; + * ``` + */ + RegisteredHook.prototype._getMatchingNodes = function (treeChanges, transition) { + var _this = this; + var criteria = (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this._getDefaultMatchCriteria(), this.matchCriteria); + var paths = (0,_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.tranSvc._pluginapi._getPathTypes()); + return paths.reduce(function (mn, pathtype) { + // STATE scope criteria matches against every node in the path. + // TRANSITION scope criteria matches against only the last node in the path + var isStateHook = pathtype.scope === _interface__WEBPACK_IMPORTED_MODULE_1__.TransitionHookScope.STATE; + var path = treeChanges[pathtype.name] || []; + var nodes = isStateHook ? path : [(0,_common__WEBPACK_IMPORTED_MODULE_0__.tail)(path)]; + mn[pathtype.name] = _this._matchingNodes(nodes, criteria[pathtype.name], transition); + return mn; + }, {}); + }; + /** + * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]] + * + * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values + * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering) + */ + RegisteredHook.prototype.matches = function (treeChanges, transition) { + var matches = this._getMatchingNodes(treeChanges, transition); + // Check if all the criteria matched the TreeChanges object + var allMatched = (0,_common__WEBPACK_IMPORTED_MODULE_0__.values)(matches).every(_common__WEBPACK_IMPORTED_MODULE_0__.identity); + return allMatched ? matches : null; + }; + RegisteredHook.prototype.deregister = function () { + this.removeHookFromRegistry(this); + this._deregistered = true; + }; + return RegisteredHook; +}()); + +/** Return a registration function of the requested type. */ +function makeEvent(registry, transitionService, eventType) { + // Create the object which holds the registered transition hooks. + var _registeredHooks = (registry._registeredHooks = registry._registeredHooks || {}); + var hooks = (_registeredHooks[eventType.name] = []); + var removeHookFn = (0,_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(hooks); + // Create hook registration function on the IHookRegistry for the event + registry[eventType.name] = hookRegistrationFn; + function hookRegistrationFn(matchObject, callback, options) { + if (options === void 0) { options = {}; } + var registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options); + hooks.push(registeredHook); + return registeredHook.deregister.bind(registeredHook); + } + return hookRegistrationFn; +} +//# sourceMappingURL=hookRegistry.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHookPhase": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope), +/* harmony export */ "HookBuilder": () => (/* reexport safe */ _hookBuilder__WEBPACK_IMPORTED_MODULE_1__.HookBuilder), +/* harmony export */ "RegisteredHook": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.RegisteredHook), +/* harmony export */ "makeEvent": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.makeEvent), +/* harmony export */ "matchState": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.matchState), +/* harmony export */ "RejectType": () => (/* reexport safe */ _rejectFactory__WEBPACK_IMPORTED_MODULE_3__.RejectType), +/* harmony export */ "Rejection": () => (/* reexport safe */ _rejectFactory__WEBPACK_IMPORTED_MODULE_3__.Rejection), +/* harmony export */ "Transition": () => (/* reexport safe */ _transition__WEBPACK_IMPORTED_MODULE_4__.Transition), +/* harmony export */ "TransitionHook": () => (/* reexport safe */ _transitionHook__WEBPACK_IMPORTED_MODULE_5__.TransitionHook), +/* harmony export */ "TransitionEventType": () => (/* reexport safe */ _transitionEventType__WEBPACK_IMPORTED_MODULE_6__.TransitionEventType), +/* harmony export */ "TransitionService": () => (/* reexport safe */ _transitionService__WEBPACK_IMPORTED_MODULE_7__.TransitionService), +/* harmony export */ "defaultTransOpts": () => (/* reexport safe */ _transitionService__WEBPACK_IMPORTED_MODULE_7__.defaultTransOpts) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _hookBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hookBuilder */ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _transition__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _transitionEventType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transitionEventType */ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"); +/* harmony import */ var _transitionService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); +/** + * # Transition subsystem + * + * This module contains APIs related to a Transition. + * + * See: + * - [[TransitionService]] + * - [[Transition]] + * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]] + * + * @packageDocumentation @preferred + */ + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/interface.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/interface.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHookPhase": () => (/* binding */ TransitionHookPhase), +/* harmony export */ "TransitionHookScope": () => (/* binding */ TransitionHookScope) +/* harmony export */ }); +var TransitionHookPhase; +(function (TransitionHookPhase) { + TransitionHookPhase[TransitionHookPhase["CREATE"] = 0] = "CREATE"; + TransitionHookPhase[TransitionHookPhase["BEFORE"] = 1] = "BEFORE"; + TransitionHookPhase[TransitionHookPhase["RUN"] = 2] = "RUN"; + TransitionHookPhase[TransitionHookPhase["SUCCESS"] = 3] = "SUCCESS"; + TransitionHookPhase[TransitionHookPhase["ERROR"] = 4] = "ERROR"; +})(TransitionHookPhase || (TransitionHookPhase = {})); +var TransitionHookScope; +(function (TransitionHookScope) { + TransitionHookScope[TransitionHookScope["TRANSITION"] = 0] = "TRANSITION"; + TransitionHookScope[TransitionHookScope["STATE"] = 1] = "STATE"; +})(TransitionHookScope || (TransitionHookScope = {})); + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "RejectType": () => (/* binding */ RejectType), +/* harmony export */ "Rejection": () => (/* binding */ Rejection) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); + + + + +/** An enum for Transition Rejection reasons */ +var RejectType; +(function (RejectType) { + /** + * A new transition superseded this one. + * + * While this transition was running, a new transition started. + * This transition is cancelled because it was superseded by new transition. + */ + RejectType[RejectType["SUPERSEDED"] = 2] = "SUPERSEDED"; + /** + * The transition was aborted + * + * The transition was aborted by a hook which returned `false` + */ + RejectType[RejectType["ABORTED"] = 3] = "ABORTED"; + /** + * The transition was invalid + * + * The transition was never started because it was invalid + */ + RejectType[RejectType["INVALID"] = 4] = "INVALID"; + /** + * The transition was ignored + * + * The transition was ignored because it would have no effect. + * + * Either: + * + * - The transition is targeting the current state and parameter values + * - The transition is targeting the same state and parameter values as the currently running transition. + */ + RejectType[RejectType["IGNORED"] = 5] = "IGNORED"; + /** + * The transition errored. + * + * This generally means a hook threw an error or returned a rejected promise + */ + RejectType[RejectType["ERROR"] = 6] = "ERROR"; +})(RejectType || (RejectType = {})); + +/** @internal */ +var id = 0; +var Rejection = /** @class */ (function () { + function Rejection(type, message, detail) { + /** @internal */ + this.$id = id++; + this.type = type; + this.message = message; + this.detail = detail; + } + /** Returns true if the obj is a rejected promise created from the `asPromise` factory */ + Rejection.isRejectionPromise = function (obj) { + return obj && typeof obj.then === 'function' && (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Rejection)(obj._transitionRejection); + }; + /** Returns a Rejection due to transition superseded */ + Rejection.superseded = function (detail, options) { + var message = 'The transition has been superseded by a different transition'; + var rejection = new Rejection(RejectType.SUPERSEDED, message, detail); + if (options && options.redirected) { + rejection.redirected = true; + } + return rejection; + }; + /** Returns a Rejection due to redirected transition */ + Rejection.redirected = function (detail) { + return Rejection.superseded(detail, { redirected: true }); + }; + /** Returns a Rejection due to invalid transition */ + Rejection.invalid = function (detail) { + var message = 'This transition is invalid'; + return new Rejection(RejectType.INVALID, message, detail); + }; + /** Returns a Rejection due to ignored transition */ + Rejection.ignored = function (detail) { + var message = 'The transition was ignored'; + return new Rejection(RejectType.IGNORED, message, detail); + }; + /** Returns a Rejection due to aborted transition */ + Rejection.aborted = function (detail) { + var message = 'The transition has been aborted'; + return new Rejection(RejectType.ABORTED, message, detail); + }; + /** Returns a Rejection due to aborted transition */ + Rejection.errored = function (detail) { + var message = 'The transition errored'; + return new Rejection(RejectType.ERROR, message, detail); + }; + /** + * Returns a Rejection + * + * Normalizes a value as a Rejection. + * If the value is already a Rejection, returns it. + * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR). + * + * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection. + */ + Rejection.normalize = function (detail) { + return (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Rejection)(detail) ? detail : Rejection.errored(detail); + }; + Rejection.prototype.toString = function () { + var detailString = function (d) { return (d && d.toString !== Object.prototype.toString ? d.toString() : (0,_common_strings__WEBPACK_IMPORTED_MODULE_1__.stringify)(d)); }; + var detail = detailString(this.detail); + var _a = this, $id = _a.$id, type = _a.type, message = _a.message; + return "Transition Rejection($id: " + $id + " type: " + type + ", message: " + message + ", detail: " + detail + ")"; + }; + Rejection.prototype.toPromise = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silentRejection)(this), { _transitionRejection: this }); + }; + return Rejection; +}()); + +//# sourceMappingURL=rejectFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transition.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transition.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Transition": () => (/* binding */ Transition) +/* harmony export */ }); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _hookBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./hookBuilder */ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"); +/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../resolve/resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); +/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + + // has or is using + + + + + + + + + +/** @internal */ +var stateSelf = (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('self'); +/** + * Represents a transition between two states. + * + * When navigating to a state, we are transitioning **from** the current state **to** the new state. + * + * This object contains all contextual information about the to/from states, parameters, resolves. + * It has information about all states being entered and exited as a result of the transition. + */ +var Transition = /** @class */ (function () { + /** + * Creates a new Transition object. + * + * If the target state is not valid, an error is thrown. + * + * @internal + * + * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath` + * encapsulates the "from state". + * @param targetState The target state and parameters being transitioned to (also, the transition options) + * @param router The [[UIRouter]] instance + * @internal + */ + function Transition(fromPath, targetState, router) { + var _this = this; + /** @internal */ + this._deferred = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.defer(); + /** + * This promise is resolved or rejected based on the outcome of the Transition. + * + * When the transition is successful, the promise is resolved + * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error + */ + this.promise = this._deferred.promise; + /** @internal Holds the hook registration functions such as those passed to Transition.onStart() */ + this._registeredHooks = {}; + /** @internal */ + this._hookBuilder = new _hookBuilder__WEBPACK_IMPORTED_MODULE_9__.HookBuilder(this); + /** Checks if this transition is currently active/running. */ + this.isActive = function () { return _this.router.globals.transition === _this; }; + this.router = router; + this._targetState = targetState; + if (!targetState.valid()) { + throw new Error(targetState.error()); + } + // current() is assumed to come from targetState.options, but provide a naive implementation otherwise. + this._options = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.extend)({ current: (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.val)(this) }, targetState.options()); + this.$id = router.transitionService._transitionCount++; + var toPath = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.buildToPath(fromPath, targetState); + this._treeChanges = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.treeChanges(fromPath, toPath, this._options.reloadState); + this.createTransitionHookRegFns(); + var onCreateHooks = this._hookBuilder.buildHooksForPhase(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.CREATE); + _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(onCreateHooks, function () { return null; }); + this.applyViewConfigs(router); + } + /** @internal */ + Transition.prototype.onBefore = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onStart = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onExit = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onRetain = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onEnter = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onFinish = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onSuccess = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + Transition.prototype.onError = function (criteria, callback, options) { + return; + }; + /** @internal + * Creates the transition-level hook registration functions + * (which can then be used to register hooks) + */ + Transition.prototype.createTransitionHookRegFns = function () { + var _this = this; + this.router.transitionService._pluginapi + ._getEvents() + .filter(function (type) { return type.hookPhase !== _interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.CREATE; }) + .forEach(function (type) { return (0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.makeEvent)(_this, _this.router.transitionService, type); }); + }; + /** @internal */ + Transition.prototype.getHooks = function (hookName) { + return this._registeredHooks[hookName]; + }; + Transition.prototype.applyViewConfigs = function (router) { + var enteringStates = this._treeChanges.entering.map(function (node) { return node.state; }); + _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates); + }; + /** + * @internal + * @returns the internal from [State] object + */ + Transition.prototype.$from = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.tail)(this._treeChanges.from).state; + }; + /** + * @internal + * @returns the internal to [State] object + */ + Transition.prototype.$to = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.tail)(this._treeChanges.to).state; + }; + /** + * Returns the "from state" + * + * Returns the state that the transition is coming *from*. + * + * @returns The state declaration object for the Transition's ("from state"). + */ + Transition.prototype.from = function () { + return this.$from().self; + }; + /** + * Returns the "to state" + * + * Returns the state that the transition is going *to*. + * + * @returns The state declaration object for the Transition's target state ("to state"). + */ + Transition.prototype.to = function () { + return this.$to().self; + }; + /** + * Gets the Target State + * + * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object. + * + * @returns the [[TargetState]] of this Transition + */ + Transition.prototype.targetState = function () { + return this._targetState; + }; + /** + * Determines whether two transitions are equivalent. + * @deprecated + */ + Transition.prototype.is = function (compare) { + if (compare instanceof Transition) { + // TODO: Also compare parameters + return this.is({ to: compare.$to().name, from: compare.$from().name }); + } + return !((compare.to && !(0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.matchState)(this.$to(), compare.to, this)) || + (compare.from && !(0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.matchState)(this.$from(), compare.from, this))); + }; + Transition.prototype.params = function (pathname) { + if (pathname === void 0) { pathname = 'to'; } + return Object.freeze(this._treeChanges[pathname].map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.mergeR, {})); + }; + Transition.prototype.paramsChanged = function () { + var fromParams = this.params('from'); + var toParams = this.params('to'); + // All the parameters declared on both the "to" and "from" paths + var allParamDescriptors = [] + .concat(this._treeChanges.to) + .concat(this._treeChanges.from) + .map(function (pathNode) { return pathNode.paramSchema; }) + .reduce(_common__WEBPACK_IMPORTED_MODULE_15__.flattenR, []) + .reduce(_common__WEBPACK_IMPORTED_MODULE_15__.uniqR, []); + var changedParamDescriptors = _params_param__WEBPACK_IMPORTED_MODULE_11__.Param.changed(allParamDescriptors, fromParams, toParams); + return changedParamDescriptors.reduce(function (changedValues, descriptor) { + changedValues[descriptor.id] = toParams[descriptor.id]; + return changedValues; + }, {}); + }; + /** + * Creates a [[UIInjector]] Dependency Injector + * + * Returns a Dependency Injector for the Transition's target state (to state). + * The injector provides resolve values which the target state has access to. + * + * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2). + * + * #### Example: + * ```js + * .onEnter({ entering: 'myState' }, trans => { + * var myResolveValue = trans.injector().get('myResolve'); + * // Inject a global service from the global/native injector (if it exists) + * var MyService = trans.injector().get('MyService'); + * }) + * ``` + * + * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched. + * You can use [[UIInjector.getAsync]] to get a promise for the data. + * #### Example: + * ```js + * .onBefore({}, trans => { + * return trans.injector().getAsync('myResolve').then(myResolveValue => + * return myResolveValue !== 'ABORT'; + * }); + * }); + * ``` + * + * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to. + * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`. + * #### Example: + * ```js + * .onEnter({ to: 'foo.bar' }, trans => { + * // returns result of `foo` state's `myResolve` resolve + * // even though `foo.bar` also has a `myResolve` resolve + * var fooData = trans.injector('foo').get('myResolve'); + * }); + * ``` + * + * If you need resolve data from the exiting states, pass `'from'` as `pathName`. + * The resolve data from the `from` path will be returned. + * #### Example: + * ```js + * .onExit({ exiting: 'foo.bar' }, trans => { + * // Gets the resolve value of `myResolve` from the state being exited + * var fooData = trans.injector(null, 'from').get('myResolve'); + * }); + * ``` + * + * + * @param state Limits the resolves provided to only the resolves the provided state has access to. + * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states. + * + * @returns a [[UIInjector]] + */ + Transition.prototype.injector = function (state, pathName) { + if (pathName === void 0) { pathName = 'to'; } + var path = this._treeChanges[pathName]; + if (state) + path = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.subPath(path, function (node) { return node.state === state || node.state.name === state; }); + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(path).injector(); + }; + /** + * Gets all available resolve tokens (keys) + * + * This method can be used in conjunction with [[injector]] to inspect the resolve values + * available to the Transition. + * + * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states + * in the Transition's [[TreeChanges.to]] path. + * + * #### Example: + * This example logs all resolve values + * ```js + * let tokens = trans.getResolveTokens(); + * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token))); + * ``` + * + * #### Example: + * This example creates promises for each resolve value. + * This triggers fetches of resolves (if any have not yet been fetched). + * When all promises have all settled, it logs the resolve values. + * ```js + * let tokens = trans.getResolveTokens(); + * let promise = tokens.map(token => trans.injector().getAsync(token)); + * Promise.all(promises).then(values => console.log("Resolved values: " + values)); + * ``` + * + * Note: Angular 1 users whould use `$q.all()` + * + * @param pathname resolve context's path name (e.g., `to` or `from`) + * + * @returns an array of resolve tokens (keys) + */ + Transition.prototype.getResolveTokens = function (pathname) { + if (pathname === void 0) { pathname = 'to'; } + return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(this._treeChanges[pathname]).getTokens(); + }; + /** + * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition. + * + * Allows a transition hook to dynamically add a Resolvable to this Transition. + * + * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]). + * + * If a `state` argument is provided, the Resolvable is processed when that state is being entered. + * If no `state` is provided then the root state is used. + * If the given `state` has already been entered, the Resolvable is processed when any child state is entered. + * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition. + * + * The `state` argument also scopes the resolved data. + * The resolved data is available from the injector for that `state` and any children states. + * + * #### Example: + * ```js + * transitionService.onBefore({}, transition => { + * transition.addResolvable({ + * token: 'myResolve', + * deps: ['MyService'], + * resolveFn: myService => myService.getData() + * }); + * }); + * ``` + * + * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]]) + * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state) + */ + Transition.prototype.addResolvable = function (resolvable, state) { + if (state === void 0) { state = ''; } + resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.is)(_resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__.Resolvable)(resolvable) ? resolvable : new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__.Resolvable(resolvable); + var stateName = typeof state === 'string' ? state : state.name; + var topath = this._treeChanges.to; + var targetNode = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.find)(topath, function (node) { return node.state.name === stateName; }); + var resolveContext = new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(topath); + resolveContext.addResolvables([resolvable], targetNode.state); + }; + /** + * Gets the transition from which this transition was redirected. + * + * If the current transition is a redirect, this method returns the transition that was redirected. + * + * #### Example: + * ```js + * let transitionA = $state.go('A').transition + * transitionA.onStart({}, () => $state.target('B')); + * $transitions.onSuccess({ to: 'B' }, (trans) => { + * trans.to().name === 'B'; // true + * trans.redirectedFrom() === transitionA; // true + * }); + * ``` + * + * @returns The previous Transition, or null if this Transition is not the result of a redirection + */ + Transition.prototype.redirectedFrom = function () { + return this._options.redirectedFrom || null; + }; + /** + * Gets the original transition in a redirect chain + * + * A transition might belong to a long chain of multiple redirects. + * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain. + * + * #### Example: + * ```js + * // states + * registry.register({ name: 'A', redirectTo: 'B' }); + * registry.register({ name: 'B', redirectTo: 'C' }); + * registry.register({ name: 'C', redirectTo: 'D' }); + * registry.register({ name: 'D' }); + * + * let transitionA = $state.go('A').transition + * + * $transitions.onSuccess({ to: 'D' }, (trans) => { + * trans.to().name === 'D'; // true + * trans.redirectedFrom().to().name === 'C'; // true + * trans.originalTransition() === transitionA; // true + * trans.originalTransition().to().name === 'A'; // true + * }); + * ``` + * + * @returns The original Transition that started a redirect chain + */ + Transition.prototype.originalTransition = function () { + var rf = this.redirectedFrom(); + return (rf && rf.originalTransition()) || this; + }; + /** + * Get the transition options + * + * @returns the options for this Transition. + */ + Transition.prototype.options = function () { + return this._options; + }; + /** + * Gets the states being entered. + * + * @returns an array of states that will be entered during this transition. + */ + Transition.prototype.entering = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.entering, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf); + }; + /** + * Gets the states being exited. + * + * @returns an array of states that will be exited during this transition. + */ + Transition.prototype.exiting = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.exiting, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf).reverse(); + }; + /** + * Gets the states being retained. + * + * @returns an array of states that are already entered from a previous Transition, that will not be + * exited during this Transition + */ + Transition.prototype.retained = function () { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.retained, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf); + }; + /** + * Get the [[ViewConfig]]s associated with this Transition + * + * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects. + * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering"). + * + * @param pathname the name of the path to fetch views for: + * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`) + * @param state If provided, only returns the `ViewConfig`s for a single state in the path + * + * @returns a list of ViewConfig objects for the given path. + */ + Transition.prototype.views = function (pathname, state) { + if (pathname === void 0) { pathname = 'entering'; } + var path = this._treeChanges[pathname]; + path = !state ? path : path.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.propEq)('state', state)); + return path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('views')).filter(_common_common__WEBPACK_IMPORTED_MODULE_3__.identity).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []); + }; + Transition.prototype.treeChanges = function (pathname) { + return pathname ? this._treeChanges[pathname] : this._treeChanges; + }; + /** + * Creates a new transition that is a redirection of the current one. + * + * This transition can be returned from a [[TransitionService]] hook to + * redirect a transition to a new state and/or set of parameters. + * + * @internal + * + * @returns Returns a new [[Transition]] instance. + */ + Transition.prototype.redirect = function (targetState) { + var redirects = 1, trans = this; + // tslint:disable-next-line:no-conditional-assignment + while ((trans = trans.redirectedFrom()) != null) { + if (++redirects > 20) + throw new Error("Too many consecutive Transition redirects (20+)"); + } + var redirectOpts = { redirectedFrom: this, source: 'redirect' }; + // If the original transition was caused by URL sync, then use { location: 'replace' } + // on the new transition (unless the target state explicitly specifies location: false). + // This causes the original url to be replaced with the url for the redirect target + // so the original url disappears from the browser history. + if (this.options().source === 'url' && targetState.options().location !== false) { + redirectOpts.location = 'replace'; + } + var newOptions = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.extend)({}, this.options(), targetState.options(), redirectOpts); + targetState = targetState.withOptions(newOptions, true); + var newTransition = this.router.transitionService.create(this._treeChanges.from, targetState); + var originalEnteringNodes = this._treeChanges.entering; + var redirectEnteringNodes = newTransition._treeChanges.entering; + // --- Re-use resolve data from original transition --- + // When redirecting from a parent state to a child state where the parent parameter values haven't changed + // (because of the redirect), the resolves fetched by the original transition are still valid in the + // redirected transition. + // + // This allows you to define a redirect on a parent state which depends on an async resolve value. + // You can wait for the resolve, then redirect to a child state based on the result. + // The redirected transition does not have to re-fetch the resolve. + // --------------------------------------------------------- + var nodeIsReloading = function (reloadState) { return function (node) { + return reloadState && node.state.includes[reloadState.name]; + }; }; + // Find any "entering" nodes in the redirect path that match the original path and aren't being reloaded + var matchingEnteringNodes = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.nonDynamicParams).filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.not)(nodeIsReloading(targetState.options().reloadState))); + // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes. + matchingEnteringNodes.forEach(function (node, idx) { + node.resolvables = originalEnteringNodes[idx].resolvables; + }); + return newTransition; + }; + /** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */ + Transition.prototype._changedParams = function () { + var tc = this._treeChanges; + /** Return undefined if it's not a "dynamic" transition, for the following reasons */ + // If user explicitly wants a reload + if (this._options.reload) + return undefined; + // If any states are exiting or entering + if (tc.exiting.length || tc.entering.length) + return undefined; + // If to/from path lengths differ + if (tc.to.length !== tc.from.length) + return undefined; + // If the to/from paths are different + var pathsDiffer = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.arrayTuples)(tc.to, tc.from) + .map(function (tuple) { return tuple[0].state !== tuple[1].state; }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.anyTrueR, false); + if (pathsDiffer) + return undefined; + // Find any parameter values that differ + var nodeSchemas = tc.to.map(function (node) { return node.paramSchema; }); + var _a = [tc.to, tc.from].map(function (path) { return path.map(function (x) { return x.paramValues; }); }), toValues = _a[0], fromValues = _a[1]; + var tuples = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.arrayTuples)(nodeSchemas, toValues, fromValues); + return tuples.map(function (_a) { + var schema = _a[0], toVals = _a[1], fromVals = _a[2]; + return _params_param__WEBPACK_IMPORTED_MODULE_11__.Param.changed(schema, toVals, fromVals); + }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []); + }; + /** + * Returns true if the transition is dynamic. + * + * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed. + * + * @returns true if the Transition is dynamic + */ + Transition.prototype.dynamic = function () { + var changes = this._changedParams(); + return !changes ? false : changes.map(function (x) { return x.dynamic; }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.anyTrueR, false); + }; + /** + * Returns true if the transition is ignored. + * + * A transition is ignored if no states are entered nor exited, and no parameter values have changed. + * + * @returns true if the Transition is ignored. + */ + Transition.prototype.ignored = function () { + return !!this._ignoredReason(); + }; + /** @internal */ + Transition.prototype._ignoredReason = function () { + var pending = this.router.globals.transition; + var reloadState = this._options.reloadState; + var same = function (pathA, pathB) { + if (pathA.length !== pathB.length) + return false; + var matching = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.matching(pathA, pathB); + return pathA.length === matching.filter(function (node) { return !reloadState || !node.state.includes[reloadState.name]; }).length; + }; + var newTC = this.treeChanges(); + var pendTC = pending && pending.treeChanges(); + if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) + return 'SameAsPending'; + if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) + return 'SameAsCurrent'; + }; + /** + * Runs the transition + * + * This method is generally called from the [[StateService.transitionTo]] + * + * @internal + * + * @returns a promise for a successful transition. + */ + Transition.prototype.run = function () { + var _this = this; + var runAllHooks = _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.runAllHooks; + // Gets transition hooks array for the given phase + var getHooksFor = function (phase) { return _this._hookBuilder.buildHooksForPhase(phase); }; + // When the chain is complete, then resolve or reject the deferred + var transitionSuccess = function () { + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceSuccess(_this.$to(), _this); + _this.success = true; + _this._deferred.resolve(_this.to()); + runAllHooks(getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.SUCCESS)); + }; + var transitionError = function (reason) { + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceError(reason, _this); + _this.success = false; + _this._deferred.reject(reason); + _this._error = reason; + runAllHooks(getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.ERROR)); + }; + var runTransition = function () { + // Wait to build the RUN hook chain until the BEFORE hooks are done + // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object. + var allRunHooks = getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.RUN); + var done = function () { return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(undefined); }; + return _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(allRunHooks, done); + }; + var startTransition = function () { + var globals = _this.router.globals; + globals.lastStartedTransitionId = _this.$id; + globals.transition = _this; + globals.transitionHistory.enqueue(_this); + _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceTransitionStart(_this); + return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(undefined); + }; + var allBeforeHooks = getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.BEFORE); + _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(allBeforeHooks, startTransition) + .then(runTransition) + .then(transitionSuccess, transitionError); + return this.promise; + }; + /** + * Checks if the Transition is valid + * + * @returns true if the Transition is valid + */ + Transition.prototype.valid = function () { + return !this.error() || this.success !== undefined; + }; + /** + * Aborts this transition + * + * Imperative API to abort a Transition. + * This only applies to Transitions that are not yet complete. + */ + Transition.prototype.abort = function () { + // Do not set flag if the transition is already complete + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isUndefined)(this.success)) { + this._aborted = true; + } + }; + /** + * The Transition error reason. + * + * If the transition is invalid (and could not be run), returns the reason the transition is invalid. + * If the transition was valid and ran, but was not successful, returns the reason the transition failed. + * + * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed. + */ + Transition.prototype.error = function () { + var state = this.$to(); + if (state.self.abstract) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_14__.Rejection.invalid("Cannot transition to abstract state '" + state.name + "'"); + } + var paramDefs = state.parameters(); + var values = this.params(); + var invalidParams = paramDefs.filter(function (param) { return !param.validates(values[param.id]); }); + if (invalidParams.length) { + var invalidValues = invalidParams.map(function (param) { return "[" + param.id + ":" + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(values[param.id]) + "]"; }).join(', '); + var detail = "The following parameter values are not valid for state '" + state.name + "': " + invalidValues; + return _rejectFactory__WEBPACK_IMPORTED_MODULE_14__.Rejection.invalid(detail); + } + if (this.success === false) + return this._error; + }; + /** + * A string representation of the Transition + * + * @returns A string representation of the Transition + */ + Transition.prototype.toString = function () { + var fromStateOrName = this.from(); + var toStateOrName = this.to(); + var avoidEmptyHash = function (params) { + return params['#'] !== null && params['#'] !== undefined ? params : (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.omit)(params, ['#']); + }; + // (X) means the to state is invalid. + var id = this.$id, from = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(avoidEmptyHash(this._treeChanges.from.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.mergeR, {}))), toValid = this.valid() ? '' : '(X) ', to = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(avoidEmptyHash(this.params())); + return "Transition#" + id + "( '" + from + "'" + fromParams + " -> " + toValid + "'" + to + "'" + toParams + " )"; + }; + /** @internal */ + Transition.diToken = Transition; + return Transition; +}()); + +//# sourceMappingURL=transition.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionEventType": () => (/* binding */ TransitionEventType) +/* harmony export */ }); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); + +/** + * This class defines a type of hook, such as `onBefore` or `onEnter`. + * Plugins can define custom hook types, such as sticky states does for `onInactive`. + */ +var TransitionEventType = /** @class */ (function () { + /* tslint:disable:no-inferrable-types */ + function TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { + if (reverseSort === void 0) { reverseSort = false; } + if (getResultHandler === void 0) { getResultHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_0__.TransitionHook.HANDLE_RESULT; } + if (getErrorHandler === void 0) { getErrorHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_0__.TransitionHook.REJECT_ERROR; } + if (synchronous === void 0) { synchronous = false; } + this.name = name; + this.hookPhase = hookPhase; + this.hookOrder = hookOrder; + this.criteriaMatchPath = criteriaMatchPath; + this.reverseSort = reverseSort; + this.getResultHandler = getResultHandler; + this.getErrorHandler = getErrorHandler; + this.synchronous = synchronous; + } + return TransitionEventType; +}()); + +//# sourceMappingURL=transitionEventType.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TransitionHook": () => (/* binding */ TransitionHook) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); +/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); +/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); + + + + + + + + + +var defaultOptions = { + current: _common_common__WEBPACK_IMPORTED_MODULE_1__.noop, + transition: null, + traceData: {}, + bind: null, +}; +var TransitionHook = /** @class */ (function () { + function TransitionHook(transition, stateContext, registeredHook, options) { + var _this = this; + this.transition = transition; + this.stateContext = stateContext; + this.registeredHook = registeredHook; + this.options = options; + this.isSuperseded = function () { return _this.type.hookPhase === _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase.RUN && !_this.options.transition.isActive(); }; + this.options = (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.defaults)(options, defaultOptions); + this.type = registeredHook.eventType; + } + /** + * Chains together an array of TransitionHooks. + * + * Given a list of [[TransitionHook]] objects, chains them together. + * Each hook is invoked after the previous one completes. + * + * #### Example: + * ```js + * var hooks: TransitionHook[] = getHooks(); + * let promise: Promise = TransitionHook.chain(hooks); + * + * promise.then(handleSuccess, handleError); + * ``` + * + * @param hooks the list of hooks to chain together + * @param waitFor if provided, the chain is `.then()`'ed off this promise + * @returns a `Promise` for sequentially invoking the hooks (in order) + */ + TransitionHook.chain = function (hooks, waitFor) { + // Chain the next hook off the previous + var createHookChainR = function (prev, nextHook) { return prev.then(function () { return nextHook.invokeHook(); }); }; + return hooks.reduce(createHookChainR, waitFor || _common_coreservices__WEBPACK_IMPORTED_MODULE_6__.services.$q.when()); + }; + /** + * Invokes all the provided TransitionHooks, in order. + * Each hook's return value is checked. + * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned. + * If no hook returns a promise, then all hooks are processed synchronously. + * + * @param hooks the list of TransitionHooks to invoke + * @param doneCallback a callback that is invoked after all the hooks have successfully completed + * + * @returns a promise for the async result, or the result of the callback + */ + TransitionHook.invokeHooks = function (hooks, doneCallback) { + for (var idx = 0; idx < hooks.length; idx++) { + var hookResult = hooks[idx].invokeHook(); + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(hookResult)) { + var remainingHooks = hooks.slice(idx + 1); + return TransitionHook.chain(remainingHooks, hookResult).then(doneCallback); + } + } + return doneCallback(); + }; + /** + * Run all TransitionHooks, ignoring their return value. + */ + TransitionHook.runAllHooks = function (hooks) { + hooks.forEach(function (hook) { return hook.invokeHook(); }); + }; + TransitionHook.prototype.logError = function (err) { + this.transition.router.stateService.defaultErrorHandler()(err); + }; + TransitionHook.prototype.invokeHook = function () { + var _this = this; + var hook = this.registeredHook; + if (hook._deregistered) + return; + var notCurrent = this.getNotCurrentRejection(); + if (notCurrent) + return notCurrent; + var options = this.options; + _common_trace__WEBPACK_IMPORTED_MODULE_5__.trace.traceHookInvocation(this, this.transition, options); + var invokeCallback = function () { return hook.callback.call(options.bind, _this.transition, _this.stateContext); }; + var normalizeErr = function (err) { return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err).toPromise(); }; + var handleError = function (err) { return hook.eventType.getErrorHandler(_this)(err); }; + var handleResult = function (result) { return hook.eventType.getResultHandler(_this)(result); }; + try { + var result = invokeCallback(); + if (!this.type.synchronous && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result)) { + return result.catch(normalizeErr).then(handleResult, handleError); + } + else { + return handleResult(result); + } + } + catch (err) { + // If callback throws (synchronously) + return handleError(_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err)); + } + finally { + if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) { + hook.deregister(); + } + } + }; + /** + * This method handles the return value of a Transition Hook. + * + * A hook can return false (cancel), a TargetState (redirect), + * or a promise (which may later resolve to false or a redirect) + * + * This also handles "transition superseded" -- when a new transition + * was started while the hook was still running + */ + TransitionHook.prototype.handleHookResult = function (result) { + var _this = this; + var notCurrent = this.getNotCurrentRejection(); + if (notCurrent) + return notCurrent; + // Hook returned a promise + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result)) { + // Wait for the promise, then reprocess with the resulting value + return result.then(function (val) { return _this.handleHookResult(val); }); + } + _common_trace__WEBPACK_IMPORTED_MODULE_5__.trace.traceHookResult(result, this.transition, this.options); + // Hook returned false + if (result === false) { + // Abort this Transition + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted('Hook aborted transition').toPromise(); + } + var isTargetState = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.is)(_state_targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState); + // hook returned a TargetState + if (isTargetState(result)) { + // Halt the current Transition and redirect (a new Transition) to the TargetState. + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.redirected(result).toPromise(); + } + }; + /** + * Return a Rejection promise if the transition is no longer current due + * to a stopped router (disposed), or a new transition has started and superseded this one. + */ + TransitionHook.prototype.getNotCurrentRejection = function () { + var router = this.transition.router; + // The router is stopped + if (router._disposed) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted("UIRouter instance #" + router.$id + " has been stopped (disposed)").toPromise(); + } + if (this.transition._aborted) { + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted().toPromise(); + } + // This transition is no longer current. + // Another transition started while this hook was still running. + if (this.isSuperseded()) { + // Abort this transition + return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.superseded(this.options.current()).toPromise(); + } + }; + TransitionHook.prototype.toString = function () { + var _a = this, options = _a.options, registeredHook = _a.registeredHook; + var event = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.hookType')(options) || 'internal', context = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.context.state.name')(options) || (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.context')(options) || 'unknown', name = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.fnToString)(registeredHook.callback); + return event + " context: " + context + ", " + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, name); + }; + /** + * These GetResultHandler(s) are used by [[invokeHook]] below + * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]]) + */ + TransitionHook.HANDLE_RESULT = function (hook) { return function (result) { + return hook.handleHookResult(result); + }; }; + /** + * If the result is a promise rejection, log it. + * Otherwise, ignore the result. + */ + TransitionHook.LOG_REJECTED_RESULT = function (hook) { return function (result) { + (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result) && result.catch(function (err) { return hook.logError(_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err)); }); + return undefined; + }; }; + /** + * These GetErrorHandler(s) are used by [[invokeHook]] below + * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]]) + */ + TransitionHook.LOG_ERROR = function (hook) { return function (error) { return hook.logError(error); }; }; + TransitionHook.REJECT_ERROR = function (hook) { return function (error) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.silentRejection)(error); }; }; + TransitionHook.THROW_ERROR = function (hook) { return function (error) { + throw error; + }; }; + return TransitionHook; +}()); + +//# sourceMappingURL=transitionHook.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionService.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "defaultTransOpts": () => (/* binding */ defaultTransOpts), +/* harmony export */ "TransitionService": () => (/* binding */ TransitionService) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); +/* harmony import */ var _transition__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); +/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); +/* harmony import */ var _hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks/coreResolvables */ "./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js"); +/* harmony import */ var _hooks_redirectTo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks/redirectTo */ "./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js"); +/* harmony import */ var _hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../hooks/onEnterExitRetain */ "./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js"); +/* harmony import */ var _hooks_resolve__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../hooks/resolve */ "./node_modules/@uirouter/core/lib-esm/hooks/resolve.js"); +/* harmony import */ var _hooks_views__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../hooks/views */ "./node_modules/@uirouter/core/lib-esm/hooks/views.js"); +/* harmony import */ var _hooks_updateGlobals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../hooks/updateGlobals */ "./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js"); +/* harmony import */ var _hooks_url__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../hooks/url */ "./node_modules/@uirouter/core/lib-esm/hooks/url.js"); +/* harmony import */ var _hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../hooks/lazyLoad */ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"); +/* harmony import */ var _transitionEventType__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./transitionEventType */ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"); +/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _hooks_ignoredTransition__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../hooks/ignoredTransition */ "./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js"); +/* harmony import */ var _hooks_invalidTransition__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../hooks/invalidTransition */ "./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js"); + + + + + + + + + + + + + + + + + + +/** + * The default [[Transition]] options. + * + * Include this object when applying custom defaults: + * let reloadOpts = { reload: true, notify: true } + * let options = defaults(theirOpts, customDefaults, defaultOptions); + */ +var defaultTransOpts = { + location: true, + relative: null, + inherit: false, + notify: true, + reload: false, + supercede: true, + custom: {}, + current: function () { return null; }, + source: 'unknown', +}; +/** + * This class provides services related to Transitions. + * + * - Most importantly, it allows global Transition Hooks to be registered. + * - It allows the default transition error handler to be set. + * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]). + * + * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class. + * + * This API is located at `router.transitionService` ([[UIRouter.transitionService]]) + */ +var TransitionService = /** @class */ (function () { + /** @internal */ + function TransitionService(_router) { + /** @internal */ + this._transitionCount = 0; + /** The transition hook types, such as `onEnter`, `onStart`, etc */ + this._eventTypes = []; + /** @internal The registered transition hooks */ + this._registeredHooks = {}; + /** The paths on a criteria object */ + this._criteriaPaths = {}; + this._router = _router; + this.$view = _router.viewService; + this._deregisterHookFns = {}; + this._pluginapi = ((0,_common_common__WEBPACK_IMPORTED_MODULE_14__.createProxyFunctions)((0,_common_hof__WEBPACK_IMPORTED_MODULE_15__.val)(this), {}, (0,_common_hof__WEBPACK_IMPORTED_MODULE_15__.val)(this), [ + '_definePathType', + '_defineEvent', + '_getPathTypes', + '_getEvents', + 'getHooks', + ])); + this._defineCorePaths(); + this._defineCoreEvents(); + this._registerCoreTransitionHooks(); + _router.globals.successfulTransitions.onEvict(_hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__.treeChangesCleanup); + } + /** + * Registers a [[TransitionHookFn]], called *while a transition is being constructed*. + * + * Registers a transition lifecycle hook, which is invoked during transition construction. + * + * This low level hook should only be used by plugins. + * This can be a useful time for plugins to add resolves or mutate the transition as needed. + * The Sticky States plugin uses this hook to modify the treechanges. + * + * ### Lifecycle + * + * `onCreate` hooks are invoked *while a transition is being constructed*. + * + * ### Return value + * + * The hook's return value is ignored + * + * @internal + * @param criteria defines which Transitions the Hook should be invoked for. + * @param callback the hook function which will be invoked. + * @param options the registration options + * @returns a function which deregisters the hook. + */ + TransitionService.prototype.onCreate = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onBefore = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onStart = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onExit = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onRetain = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onEnter = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onFinish = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onSuccess = function (criteria, callback, options) { + return; + }; + /** @inheritdoc */ + TransitionService.prototype.onError = function (criteria, callback, options) { + return; + }; + /** + * dispose + * @internal + */ + TransitionService.prototype.dispose = function (router) { + (0,_common_common__WEBPACK_IMPORTED_MODULE_14__.values)(this._registeredHooks).forEach(function (hooksArray) { + return hooksArray.forEach(function (hook) { + hook._deregistered = true; + (0,_common_common__WEBPACK_IMPORTED_MODULE_14__.removeFrom)(hooksArray, hook); + }); + }); + }; + /** + * Creates a new [[Transition]] object + * + * This is a factory function for creating new Transition objects. + * It is used internally by the [[StateService]] and should generally not be called by application code. + * + * @internal + * @param fromPath the path to the current state (the from state) + * @param targetState the target state (destination) + * @returns a Transition + */ + TransitionService.prototype.create = function (fromPath, targetState) { + return new _transition__WEBPACK_IMPORTED_MODULE_1__.Transition(fromPath, targetState, this._router); + }; + /** @internal */ + TransitionService.prototype._defineCoreEvents = function () { + var Phase = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase; + var TH = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook; + var paths = this._criteriaPaths; + var NORMAL_SORT = false, REVERSE_SORT = true; + var SYNCHRONOUS = true; + this._defineEvent('onCreate', Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS); + this._defineEvent('onBefore', Phase.BEFORE, 0, paths.to); + this._defineEvent('onStart', Phase.RUN, 0, paths.to); + this._defineEvent('onExit', Phase.RUN, 100, paths.exiting, REVERSE_SORT); + this._defineEvent('onRetain', Phase.RUN, 200, paths.retained); + this._defineEvent('onEnter', Phase.RUN, 300, paths.entering); + this._defineEvent('onFinish', Phase.RUN, 400, paths.to); + this._defineEvent('onSuccess', Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + this._defineEvent('onError', Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); + }; + /** @internal */ + TransitionService.prototype._defineCorePaths = function () { + var STATE = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope.STATE, TRANSITION = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope.TRANSITION; + this._definePathType('to', TRANSITION); + this._definePathType('from', TRANSITION); + this._definePathType('exiting', STATE); + this._definePathType('retained', STATE); + this._definePathType('entering', STATE); + }; + /** @internal */ + TransitionService.prototype._defineEvent = function (name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { + if (reverseSort === void 0) { reverseSort = false; } + if (getResultHandler === void 0) { getResultHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook.HANDLE_RESULT; } + if (getErrorHandler === void 0) { getErrorHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook.REJECT_ERROR; } + if (synchronous === void 0) { synchronous = false; } + var eventType = new _transitionEventType__WEBPACK_IMPORTED_MODULE_11__.TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous); + this._eventTypes.push(eventType); + (0,_hookRegistry__WEBPACK_IMPORTED_MODULE_2__.makeEvent)(this, this, eventType); + }; + /** @internal */ + TransitionService.prototype._getEvents = function (phase) { + var transitionHookTypes = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_13__.isDefined)(phase) + ? this._eventTypes.filter(function (type) { return type.hookPhase === phase; }) + : this._eventTypes.slice(); + return transitionHookTypes.sort(function (l, r) { + var cmpByPhase = l.hookPhase - r.hookPhase; + return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase; + }); + }; + /** + * Adds a Path to be used as a criterion against a TreeChanges path + * + * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path. + * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)` + * Each state in the exiting path is checked against the criteria and returned as part of the match. + * + * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path. + * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)` + * Only the tail of the `to` path is checked against the criteria and returned as part of the match. + * + * @internal + */ + TransitionService.prototype._definePathType = function (name, hookScope) { + this._criteriaPaths[name] = { name: name, scope: hookScope }; + }; + /** @internal */ + // tslint:disable-next-line + TransitionService.prototype._getPathTypes = function () { + return this._criteriaPaths; + }; + /** @internal */ + TransitionService.prototype.getHooks = function (hookName) { + return this._registeredHooks[hookName]; + }; + /** @internal */ + TransitionService.prototype._registerCoreTransitionHooks = function () { + var fns = this._deregisterHookFns; + fns.addCoreResolves = (0,_hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__.registerAddCoreResolvables)(this); + fns.ignored = (0,_hooks_ignoredTransition__WEBPACK_IMPORTED_MODULE_16__.registerIgnoredTransitionHook)(this); + fns.invalid = (0,_hooks_invalidTransition__WEBPACK_IMPORTED_MODULE_17__.registerInvalidTransitionHook)(this); + // Wire up redirectTo hook + fns.redirectTo = (0,_hooks_redirectTo__WEBPACK_IMPORTED_MODULE_4__.registerRedirectToHook)(this); + // Wire up onExit/Retain/Enter state hooks + fns.onExit = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnExitHook)(this); + fns.onRetain = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnRetainHook)(this); + fns.onEnter = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnEnterHook)(this); + // Wire up Resolve hooks + fns.eagerResolve = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerEagerResolvePath)(this); + fns.lazyResolve = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerLazyResolveState)(this); + fns.resolveAll = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerResolveRemaining)(this); + // Wire up the View management hooks + fns.loadViews = (0,_hooks_views__WEBPACK_IMPORTED_MODULE_7__.registerLoadEnteringViews)(this); + fns.activateViews = (0,_hooks_views__WEBPACK_IMPORTED_MODULE_7__.registerActivateViews)(this); + // Updates global state after a transition + fns.updateGlobals = (0,_hooks_updateGlobals__WEBPACK_IMPORTED_MODULE_8__.registerUpdateGlobalState)(this); + // After globals.current is updated at priority: 10000 + fns.updateUrl = (0,_hooks_url__WEBPACK_IMPORTED_MODULE_9__.registerUpdateUrl)(this); + // Lazy load state trees + fns.lazyLoad = (0,_hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_10__.registerLazyLoadHook)(this); + }; + return TransitionService; +}()); + +//# sourceMappingURL=transitionService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/index.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlMatcher": () => (/* reexport safe */ _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher), +/* harmony export */ "ParamFactory": () => (/* reexport safe */ _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__.ParamFactory), +/* harmony export */ "UrlMatcherFactory": () => (/* reexport safe */ _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__.UrlMatcherFactory), +/* harmony export */ "UrlRouter": () => (/* reexport safe */ _urlRouter__WEBPACK_IMPORTED_MODULE_3__.UrlRouter), +/* harmony export */ "BaseUrlRule": () => (/* reexport safe */ _urlRule__WEBPACK_IMPORTED_MODULE_4__.BaseUrlRule), +/* harmony export */ "UrlRuleFactory": () => (/* reexport safe */ _urlRule__WEBPACK_IMPORTED_MODULE_4__.UrlRuleFactory), +/* harmony export */ "UrlService": () => (/* reexport safe */ _urlService__WEBPACK_IMPORTED_MODULE_5__.UrlService), +/* harmony export */ "UrlRules": () => (/* reexport safe */ _urlRules__WEBPACK_IMPORTED_MODULE_6__.UrlRules), +/* harmony export */ "UrlConfig": () => (/* reexport safe */ _urlConfig__WEBPACK_IMPORTED_MODULE_7__.UrlConfig) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/url/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(["default","UrlRules","UrlConfig"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./urlMatcherFactory */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"); +/* harmony import */ var _urlRouter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./urlRouter */ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); +/* harmony import */ var _urlService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./urlService */ "./node_modules/@uirouter/core/lib-esm/url/urlService.js"); +/* harmony import */ var _urlRules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./urlRules */ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js"); +/* harmony import */ var _urlConfig__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./urlConfig */ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"); + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/interface.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/interface.js ***! + \**************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlConfig.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlConfig": () => (/* binding */ UrlConfig) +/* harmony export */ }); +/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../params */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + +/** + * An API to customize the URL behavior and retrieve URL configuration + * + * This API is used to customize the behavior of the URL. + * This includes optional trailing slashes ([[strictMode]]), case sensitivity ([[caseInsensitive]]), + * and custom parameter encoding (custom [[type]]). + * + * It also has information about the location (url) configuration such as [[port]] and [[baseHref]]. + * This information can be used to build absolute URLs, such as + * `https://example.com:443/basepath/state/substate?param1=a#hashvalue`; + * + * This API is found at `router.urlService.config` (see: [[UIRouter.urlService]], [[URLService.config]]) + */ +var UrlConfig = /** @class */ (function () { + /** @internal */ function UrlConfig(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this.paramTypes = new _params__WEBPACK_IMPORTED_MODULE_0__.ParamTypes(); + /** @internal */ this._decodeParams = true; + /** @internal */ this._isCaseInsensitive = false; + /** @internal */ this._isStrictMode = true; + /** @internal */ this._defaultSquashPolicy = false; + /** @internal */ this.dispose = function () { return _this.paramTypes.dispose(); }; + // Delegate these calls to the current LocationConfig implementation + /** + * Gets the base Href, e.g., `http://localhost/approot/` + * + * @return the application's base href + */ + this.baseHref = function () { return _this.router.locationConfig.baseHref(); }; + /** + * Gets or sets the hashPrefix + * + * This only applies when not running in [[html5Mode]] (pushstate mode) + * + * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the "hashbang" portion. + * + * @return the hash prefix + */ + this.hashPrefix = function (newprefix) { return _this.router.locationConfig.hashPrefix(newprefix); }; + /** + * Gets the host, e.g., `localhost` + * + * @return the protocol + */ + this.host = function () { return _this.router.locationConfig.host(); }; + /** + * Returns true when running in pushstate mode + * + * @return true when running in html5 mode (pushstate mode). + */ + this.html5Mode = function () { return _this.router.locationConfig.html5Mode(); }; + /** + * Gets the port, e.g., `80` + * + * @return the port number + */ + this.port = function () { return _this.router.locationConfig.port(); }; + /** + * Gets the protocol, e.g., `http` + * + * @return the protocol + */ + this.protocol = function () { return _this.router.locationConfig.protocol(); }; + } + /** + * Defines whether URL matching should be case sensitive (the default behavior), or not. + * + * #### Example: + * ```js + * // Allow case insensitive url matches + * urlService.config.caseInsensitive(true); + * ``` + * + * @param value `false` to match URL in a case sensitive manner; otherwise `true`; + * @returns the current value of caseInsensitive + */ + UrlConfig.prototype.caseInsensitive = function (value) { + return (this._isCaseInsensitive = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._isCaseInsensitive); + }; + /** + * Sets the default behavior when generating or matching URLs with default parameter values. + * + * #### Example: + * ```js + * // Remove default parameter values from the url + * urlService.config.defaultSquashPolicy(true); + * ``` + * + * @param value A string that defines the default parameter URL squashing behavior. + * - `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL + * - `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the + * parameter is surrounded by slashes, squash (remove) one slash from the URL + * - any other string, e.g. "~": When generating an href with a default parameter value, squash (remove) + * the parameter value from the URL and replace it with this string. + * @returns the current value of defaultSquashPolicy + */ + UrlConfig.prototype.defaultSquashPolicy = function (value) { + if ((0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) && value !== true && value !== false && !(0,_common__WEBPACK_IMPORTED_MODULE_1__.isString)(value)) + throw new Error("Invalid squash policy: " + value + ". Valid policies: false, true, arbitrary-string"); + return (this._defaultSquashPolicy = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._defaultSquashPolicy); + }; + /** + * Defines whether URLs should match trailing slashes, or not (the default behavior). + * + * #### Example: + * ```js + * // Allow optional trailing slashes + * urlService.config.strictMode(false); + * ``` + * + * @param value `false` to match trailing slashes in URLs, otherwise `true`. + * @returns the current value of strictMode + */ + UrlConfig.prototype.strictMode = function (value) { + return (this._isStrictMode = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._isStrictMode); + }; + /** + * Creates and registers a custom [[ParamType]] object + * + * A custom parameter type can be used to generate URLs with typed parameters or custom encoding/decoding. + * + * #### Note: Register custom types *before using them* in a state definition. + * + * #### Example: + * ```js + * // Encode object parameter as JSON string + * urlService.config.type('myjson', { + * encode: (obj) => JSON.stringify(obj), + * decode: (str) => JSON.parse(str), + * is: (val) => typeof(val) === 'object', + * pattern: /[^/]+/, + * equals: (a, b) => _.isEqual(a, b), + * }); + * ``` + * + * See [[ParamTypeDefinition]] for more examples + * + * @param name The type name. + * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted. + * @param definitionFn A function that is injected before the app runtime starts. + * The result of this function should be a [[ParamTypeDefinition]]. + * The result is merged into the existing `definition`. + * See [[ParamType]] for information on the values accepted. + * + * @returns if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined + */ + UrlConfig.prototype.type = function (name, definition, definitionFn) { + var type = this.paramTypes.type(name, definition, definitionFn); + return !(0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(definition) ? type : this; + }; + return UrlConfig; +}()); + +//# sourceMappingURL=urlConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlMatcher": () => (/* binding */ UrlMatcher) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); +/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + + + + + + +function quoteRegExp(str, param) { + var surroundPattern = ['', ''], result = str.replace(/[\\\[\]\^$*+?.()|{}]/g, '\\$&'); + if (!param) + return result; + switch (param.squash) { + case false: + surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; + break; + case true: + result = result.replace(/\/$/, ''); + surroundPattern = ['(?:/(', ')|/)?']; + break; + default: + surroundPattern = ["(" + param.squash + "|", ')?']; + break; + } + return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1]; +} +var memoizeTo = function (obj, _prop, fn) { return (obj[_prop] = obj[_prop] || fn()); }; +var splitOnSlash = (0,_common_strings__WEBPACK_IMPORTED_MODULE_4__.splitOnDelim)('/'); +var defaultConfig = { + state: { params: {} }, + strict: true, + caseInsensitive: true, + decodeParams: true, +}; +/** + * Matches URLs against patterns. + * + * Matches URLs against patterns and extracts named parameters from the path or the search + * part of the URL. + * + * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query) + * parameters. Multiple search parameter names are separated by '&'. Search parameters + * do not influence whether or not a URL is matched, but their values are passed through into + * the matched parameters returned by [[UrlMatcher.exec]]. + * + * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`) + * or colon placeholders (`/somePath/:param`). + * + * - *A parameter RegExp* may be defined for a param after a colon + * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder. + * The regexp must match for the url to be matched. + * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash. + * + * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]]. + * + * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters. + * See [[UrlMatcherFactory.type]] for more information. + * + * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`). + * A catch-all * parameter value will contain the remainder of the URL. + * + * --- + * + * Parameter names may contain only word characters (latin letters, digits, and underscore) and + * must be unique within the pattern (across both path and search parameters). + * A path parameter matches any number of characters other than '/'. For catch-all + * placeholders the path parameter matches any number of characters. + * + * Examples: + * + * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for + * trailing slashes, and patterns have to match the entire path, not just a prefix. + * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or + * '/user/bob/details'. The second path segment will be captured as the parameter 'id'. + * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax. + * * `'/user/{id:[^/]*}'` - Same as the previous example. + * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id + * parameter consists of 1 to 8 hex digits. + * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the + * path into the parameter 'path'. + * * `'/files/*path'` - ditto. + * * `'/calendar/{start:date}'` - Matches "/calendar/2014-11-12" (because the pattern defined + * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start + * + */ +var UrlMatcher = /** @class */ (function () { + /** + * @param pattern The pattern to compile into a matcher. + * @param paramTypes The [[ParamTypes]] registry + * @param paramFactory A [[ParamFactory]] object + * @param config A [[UrlMatcherCompileConfig]] configuration object + */ + function UrlMatcher(pattern, paramTypes, paramFactory, config) { + var _this = this; + /** @internal */ + this._cache = { path: [this] }; + /** @internal */ + this._children = []; + /** @internal */ + this._params = []; + /** @internal */ + this._segments = []; + /** @internal */ + this._compiled = []; + this.config = config = (0,_common__WEBPACK_IMPORTED_MODULE_5__.defaults)(config, defaultConfig); + this.pattern = pattern; + // Find all placeholders and create a compiled pattern, using either classic or curly syntax: + // '*' name + // ':' name + // '{' name '}' + // '{' name ':' regexp '}' + // The regular expression is somewhat complicated due to the need to allow curly braces + // inside the regular expression. The placeholder regexp breaks down as follows: + // ([:*])([\w\[\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case) + // \{([\w\[\]]+)(?:\:\s*( ... ))?\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case + // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either + // [^{}\\]+ - anything other than curly braces or backslash + // \\. - a backslash escape + // \{(?:[^{}\\]+|\\.)*\} - a matched set of curly braces containing other atoms + var placeholder = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + var searchPlaceholder = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; + var patterns = []; + var last = 0; + var matchArray; + var checkParamErrors = function (id) { + if (!UrlMatcher.nameValidator.test(id)) + throw new Error("Invalid parameter name '" + id + "' in pattern '" + pattern + "'"); + if ((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(_this._params, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', id))) + throw new Error("Duplicate parameter name '" + id + "' in pattern '" + pattern + "'"); + }; + // Split into static segments separated by path parameter placeholders. + // The number of segments is always 1 more than the number of parameters. + var matchDetails = function (m, isSearch) { + // IE[78] returns '' for unmatched groups instead of null + var id = m[2] || m[3]; + var regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\s\\S]*' : null); + var makeRegexpType = function (str) { + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(paramTypes.type(isSearch ? 'query' : 'path'), { + pattern: new RegExp(str, _this.config.caseInsensitive ? 'i' : undefined), + }); + }; + return { + id: id, + regexp: regexp, + segment: pattern.substring(last, m.index), + type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp), + }; + }; + var details; + var segment; + // tslint:disable-next-line:no-conditional-assignment + while ((matchArray = placeholder.exec(pattern))) { + details = matchDetails(matchArray, false); + if (details.segment.indexOf('?') >= 0) + break; // we're into the search part + checkParamErrors(details.id); + this._params.push(paramFactory.fromPath(details.id, details.type, config.state)); + this._segments.push(details.segment); + patterns.push([details.segment, (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(this._params)]); + last = placeholder.lastIndex; + } + segment = pattern.substring(last); + // Find any search parameter names and remove them from the last segment + var i = segment.indexOf('?'); + if (i >= 0) { + var search = segment.substring(i); + segment = segment.substring(0, i); + if (search.length > 0) { + last = 0; + // tslint:disable-next-line:no-conditional-assignment + while ((matchArray = searchPlaceholder.exec(search))) { + details = matchDetails(matchArray, true); + checkParamErrors(details.id); + this._params.push(paramFactory.fromSearch(details.id, details.type, config.state)); + last = placeholder.lastIndex; + // check if ?& + } + } + } + this._segments.push(segment); + this._compiled = patterns.map(function (_pattern) { return quoteRegExp.apply(null, _pattern); }).concat(quoteRegExp(segment)); + } + /** @internal */ + UrlMatcher.encodeDashes = function (str) { + // Replace dashes with encoded "\-" + return encodeURIComponent(str).replace(/-/g, function (c) { return "%5C%" + c.charCodeAt(0).toString(16).toUpperCase(); }); + }; + /** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */ + UrlMatcher.pathSegmentsAndParams = function (matcher) { + var staticSegments = matcher._segments; + var pathParams = matcher._params.filter(function (p) { return p.location === _params_param__WEBPACK_IMPORTED_MODULE_3__.DefType.PATH; }); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(staticSegments, pathParams.concat(undefined)) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .filter(function (x) { return x !== '' && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(x); }); + }; + /** @internal Given a matcher, return an array with the matcher's query params */ + UrlMatcher.queryParams = function (matcher) { + return matcher._params.filter(function (p) { return p.location === _params_param__WEBPACK_IMPORTED_MODULE_3__.DefType.SEARCH; }); + }; + /** + * Compare two UrlMatchers + * + * This comparison function converts a UrlMatcher into static and dynamic path segments. + * Each static path segment is a static string between a path separator (slash character). + * Each dynamic segment is a path parameter. + * + * The comparison function sorts static segments before dynamic ones. + */ + UrlMatcher.compare = function (a, b) { + /** + * Turn a UrlMatcher and all its parent matchers into an array + * of slash literals '/', string literals, and Param objects + * + * This example matcher matches strings like "/foo/:param/tail": + * var matcher = $umf.compile("/foo").append($umf.compile("/:param")).append($umf.compile("/")).append($umf.compile("tail")); + * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ] + * + * Caches the result as `matcher._cache.segments` + */ + var segments = function (matcher) { + return (matcher._cache.segments = + matcher._cache.segments || + matcher._cache.path + .map(UrlMatcher.pathSegmentsAndParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .reduce(_common_strings__WEBPACK_IMPORTED_MODULE_4__.joinNeighborsR, []) + .map(function (x) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x) ? splitOnSlash(x) : x); }) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, [])); + }; + /** + * Gets the sort weight for each segment of a UrlMatcher + * + * Caches the result as `matcher._cache.weights` + */ + var weights = function (matcher) { + return (matcher._cache.weights = + matcher._cache.weights || + segments(matcher).map(function (segment) { + // Sort slashes first, then static strings, the Params + if (segment === '/') + return 1; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(segment)) + return 2; + if (segment instanceof _params_param__WEBPACK_IMPORTED_MODULE_3__.Param) + return 3; + })); + }; + /** + * Pads shorter array in-place (mutates) + */ + var padArrays = function (l, r, padVal) { + var len = Math.max(l.length, r.length); + while (l.length < len) + l.push(padVal); + while (r.length < len) + r.push(padVal); + }; + var weightsA = weights(a), weightsB = weights(b); + padArrays(weightsA, weightsB, 0); + var _pairs = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(weightsA, weightsB); + var cmp, i; + for (i = 0; i < _pairs.length; i++) { + cmp = _pairs[i][0] - _pairs[i][1]; + if (cmp !== 0) + return cmp; + } + return 0; + }; + /** + * Creates a new concatenated UrlMatcher + * + * Builds a new UrlMatcher by appending another UrlMatcher to this one. + * + * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`. + */ + UrlMatcher.prototype.append = function (url) { + this._children.push(url); + url._cache = { + path: this._cache.path.concat(url), + parent: this, + pattern: null, + }; + return url; + }; + /** @internal */ + UrlMatcher.prototype.isRoot = function () { + return this._cache.path[0] === this; + }; + /** Returns the input pattern string */ + UrlMatcher.prototype.toString = function () { + return this.pattern; + }; + UrlMatcher.prototype._getDecodedParamValue = function (value, param) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(value)) { + if (this.config.decodeParams && !param.type.raw) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(value)) { + value = value.map(function (paramValue) { return decodeURIComponent(paramValue); }); + } + else { + value = decodeURIComponent(value); + } + } + value = param.type.decode(value); + } + return param.value(value); + }; + /** + * Tests the specified url/path against this matcher. + * + * Tests if the given url matches this matcher's pattern, and returns an object containing the captured + * parameter values. Returns null if the path does not match. + * + * The returned object contains the values + * of any search parameters that are mentioned in the pattern, but their value may be null if + * they are not present in `search`. This means that search parameters are always treated + * as optional. + * + * #### Example: + * ```js + * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { + * x: '1', q: 'hello' + * }); + * // returns { id: 'bob', q: 'hello', r: null } + * ``` + * + * @param path The URL path to match, e.g. `$location.path()`. + * @param search URL search parameters, e.g. `$location.search()`. + * @param hash URL hash e.g. `$location.hash()`. + * @param options + * + * @returns The captured parameter values. + */ + UrlMatcher.prototype.exec = function (path, search, hash, options) { + var _this = this; + if (search === void 0) { search = {}; } + if (options === void 0) { options = {}; } + var match = memoizeTo(this._cache, 'pattern', function () { + return new RegExp([ + '^', + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.unnest)(_this._cache.path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('_compiled'))).join(''), + _this.config.strict === false ? '/?' : '', + '$', + ].join(''), _this.config.caseInsensitive ? 'i' : undefined); + }).exec(path); + if (!match) + return null; + // options = defaults(options, { isolate: false }); + var allParams = this.parameters(), pathParams = allParams.filter(function (param) { return !param.isSearch(); }), searchParams = allParams.filter(function (param) { return param.isSearch(); }), nPathSegments = this._cache.path.map(function (urlm) { return urlm._segments.length - 1; }).reduce(function (a, x) { return a + x; }), values = {}; + if (nPathSegments !== match.length - 1) + throw new Error("Unbalanced capture group in route '" + this.pattern + "'"); + function decodePathArray(paramVal) { + var reverseString = function (str) { return str.split('').reverse().join(''); }; + var unquoteDashes = function (str) { return str.replace(/\\-/g, '-'); }; + var split = reverseString(paramVal).split(/-(?!\\)/); + var allReversed = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(split, reverseString); + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(allReversed, unquoteDashes).reverse(); + } + for (var i = 0; i < nPathSegments; i++) { + var param = pathParams[i]; + var value = match[i + 1]; + // if the param value matches a pre-replace pair, replace the value before decoding. + for (var j = 0; j < param.replace.length; j++) { + if (param.replace[j].from === value) + value = param.replace[j].to; + } + if (value && param.array === true) + value = decodePathArray(value); + values[param.id] = this._getDecodedParamValue(value, param); + } + searchParams.forEach(function (param) { + var value = search[param.id]; + for (var j = 0; j < param.replace.length; j++) { + if (param.replace[j].from === value) + value = param.replace[j].to; + } + values[param.id] = _this._getDecodedParamValue(value, param); + }); + if (hash) + values['#'] = hash; + return values; + }; + /** + * @internal + * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance. + * + * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the + * pattern has no parameters, an empty array is returned. + */ + UrlMatcher.prototype.parameters = function (opts) { + if (opts === void 0) { opts = {}; } + if (opts.inherit === false) + return this._params; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.unnest)(this._cache.path.map(function (matcher) { return matcher._params; })); + }; + /** + * @internal + * Returns a single parameter from this UrlMatcher by id + * + * @param id + * @param opts + * @returns {T|Param|any|boolean|UrlMatcher|null} + */ + UrlMatcher.prototype.parameter = function (id, opts) { + var _this = this; + if (opts === void 0) { opts = {}; } + var findParam = function () { + for (var _i = 0, _a = _this._params; _i < _a.length; _i++) { + var param = _a[_i]; + if (param.id === id) + return param; + } + }; + var parent = this._cache.parent; + return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null; + }; + /** + * Validates the input parameter values against this UrlMatcher + * + * Checks an object hash of parameters to validate their correctness according to the parameter + * types of this `UrlMatcher`. + * + * @param params The object hash of parameters to validate. + * @returns Returns `true` if `params` validates, otherwise `false`. + */ + UrlMatcher.prototype.validates = function (params) { + var validParamVal = function (param, val) { return !param || param.validates(val); }; + params = params || {}; + // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher + var paramSchema = this.parameters().filter(function (paramDef) { return params.hasOwnProperty(paramDef.id); }); + return paramSchema.map(function (paramDef) { return validParamVal(paramDef, params[paramDef.id]); }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.allTrueR, true); + }; + /** + * Given a set of parameter values, creates a URL from this UrlMatcher. + * + * Creates a URL that matches this pattern by substituting the specified values + * for the path and search parameters. + * + * #### Example: + * ```js + * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' }); + * // returns '/user/bob?q=yes' + * ``` + * + * @param values the values to substitute for the parameters in this pattern. + * @returns the formatted URL (path and optionally search part). + */ + UrlMatcher.prototype.format = function (values) { + if (values === void 0) { values = {}; } + // Build the full path of UrlMatchers (including all parent UrlMatchers) + var urlMatchers = this._cache.path; + // Extract all the static segments and Params (processed as ParamDetails) + // into an ordered array + var pathSegmentsAndParams = urlMatchers + .map(UrlMatcher.pathSegmentsAndParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .map(function (x) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x) ? x : getDetails(x)); }); + // Extract the query params into a separate array + var queryParams = urlMatchers + .map(UrlMatcher.queryParams) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .map(getDetails); + var isInvalid = function (param) { return param.isValid === false; }; + if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) { + return null; + } + /** + * Given a Param, applies the parameter value, then returns detailed information about it + */ + function getDetails(param) { + // Normalize to typed value + var value = param.value(values[param.id]); + var isValid = param.validates(value); + var isDefaultValue = param.isDefaultValue(value); + // Check if we're in squash mode for the parameter + var squash = isDefaultValue ? param.squash : false; + // Allow the Parameter's Type to encode the value + var encoded = param.type.encode(value); + return { param: param, value: value, isValid: isValid, isDefaultValue: isDefaultValue, squash: squash, encoded: encoded }; + } + // Build up the path-portion from the list of static segments and parameters + var pathString = pathSegmentsAndParams.reduce(function (acc, x) { + // The element is a static segment (a raw string); just append it + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x)) + return acc + x; + // Otherwise, it's a ParamDetails. + var squash = x.squash, encoded = x.encoded, param = x.param; + // If squash is === true, try to remove a slash from the path + if (squash === true) + return acc.match(/\/$/) ? acc.slice(0, -1) : acc; + // If squash is a string, use the string for the param value + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) + return acc + squash; + if (squash !== false) + return acc; // ? + if (encoded == null) + return acc; + // If this parameter value is an array, encode the value using encodeDashes + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(encoded)) + return acc + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(encoded, UrlMatcher.encodeDashes).join('-'); + // If the parameter type is "raw", then do not encodeURIComponent + if (param.raw) + return acc + encoded; + // Encode the value + return acc + encodeURIComponent(encoded); + }, ''); + // Build the query string by applying parameter values (array or regular) + // then mapping to key=value, then flattening and joining using "&" + var queryString = queryParams + .map(function (paramDetails) { + var param = paramDetails.param, squash = paramDetails.squash, encoded = paramDetails.encoded, isDefaultValue = paramDetails.isDefaultValue; + if (encoded == null || (isDefaultValue && squash !== false)) + return; + if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(encoded)) + encoded = [encoded]; + if (encoded.length === 0) + return; + if (!param.raw) + encoded = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(encoded, encodeURIComponent); + return encoded.map(function (val) { return param.id + "=" + val; }); + }) + .filter(_common_common__WEBPACK_IMPORTED_MODULE_0__.identity) + .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .join('&'); + // Concat the pathstring with the queryString (if exists) and the hashString (if exists) + return pathString + (queryString ? "?" + queryString : '') + (values['#'] ? '#' + values['#'] : ''); + }; + /** @internal */ + UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/; + return UrlMatcher; +}()); + +//# sourceMappingURL=urlMatcher.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ParamFactory": () => (/* binding */ ParamFactory), +/* harmony export */ "UrlMatcherFactory": () => (/* binding */ UrlMatcherFactory) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../params */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); +var __assign = (undefined && undefined.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; + + + +var ParamFactory = /** @class */ (function () { + function ParamFactory(router) { + this.router = router; + } + ParamFactory.prototype.fromConfig = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.CONFIG, this.router.urlService.config, state); + }; + ParamFactory.prototype.fromPath = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.PATH, this.router.urlService.config, state); + }; + ParamFactory.prototype.fromSearch = function (id, type, state) { + return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.SEARCH, this.router.urlService.config, state); + }; + return ParamFactory; +}()); + +/** + * Factory for [[UrlMatcher]] instances. + * + * The factory is available to ng1 services as + * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`. + */ +var UrlMatcherFactory = /** @class */ (function () { + // TODO: move implementations to UrlConfig (urlService.config) + function UrlMatcherFactory(/** @internal */ router) { + var _this = this; + this.router = router; + /** Creates a new [[Param]] for a given location (DefType) */ + this.paramFactory = new ParamFactory(this.router); + // TODO: Check if removal of this will break anything, then remove these + this.UrlMatcher = _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher; + this.Param = _params__WEBPACK_IMPORTED_MODULE_2__.Param; + /** @deprecated use [[UrlConfig.caseInsensitive]] */ + this.caseInsensitive = function (value) { return _this.router.urlService.config.caseInsensitive(value); }; + /** @deprecated use [[UrlConfig.defaultSquashPolicy]] */ + this.defaultSquashPolicy = function (value) { return _this.router.urlService.config.defaultSquashPolicy(value); }; + /** @deprecated use [[UrlConfig.strictMode]] */ + this.strictMode = function (value) { return _this.router.urlService.config.strictMode(value); }; + /** @deprecated use [[UrlConfig.type]] */ + this.type = function (name, definition, definitionFn) { + return _this.router.urlService.config.type(name, definition, definitionFn) || _this; + }; + } + /** + * Creates a [[UrlMatcher]] for the specified pattern. + * + * @param pattern The URL pattern. + * @param config The config object hash. + * @returns The UrlMatcher. + */ + UrlMatcherFactory.prototype.compile = function (pattern, config) { + var urlConfig = this.router.urlService.config; + // backward-compatible support for config.params -> config.state.params + var params = config && !config.state && config.params; + config = params ? __assign({ state: { params: params } }, config) : config; + var globalConfig = { + strict: urlConfig._isStrictMode, + caseInsensitive: urlConfig._isCaseInsensitive, + decodeParams: urlConfig._decodeParams, + }; + return new _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher(pattern, urlConfig.paramTypes, this.paramFactory, (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)(globalConfig, config)); + }; + /** + * Returns true if the specified object is a [[UrlMatcher]], or false otherwise. + * + * @param object The object to perform the type check against. + * @returns `true` if the object matches the `UrlMatcher` interface, by + * implementing all the same methods. + */ + UrlMatcherFactory.prototype.isMatcher = function (object) { + // TODO: typeof? + if (!(0,_common__WEBPACK_IMPORTED_MODULE_0__.isObject)(object)) + return false; + var result = true; + (0,_common__WEBPACK_IMPORTED_MODULE_0__.forEach)(_urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher.prototype, function (val, name) { + if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(val)) + result = result && (0,_common__WEBPACK_IMPORTED_MODULE_0__.isDefined)(object[name]) && (0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(object[name]); + }); + return result; + }; + /** @internal */ + UrlMatcherFactory.prototype.$get = function () { + var urlConfig = this.router.urlService.config; + urlConfig.paramTypes.enqueue = false; + urlConfig.paramTypes._flushTypeQueue(); + return this; + }; + return UrlMatcherFactory; +}()); + +//# sourceMappingURL=urlMatcherFactory.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRouter.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRouter": () => (/* binding */ UrlRouter) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); + + +function appendBasePath(url, isHtml5, absolute, baseHref) { + if (baseHref === '/') + return url; + if (isHtml5) + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.stripLastPathElement)(baseHref) + url; + if (absolute) + return baseHref.slice(1) + url; + return url; +} +/** + * Updates URL and responds to URL changes + * + * ### Deprecation warning: + * This class is now considered to be an internal API + * Use the [[UrlService]] instead. + * For configuring URL rules, use the [[UrlRules]] which can be found as [[UrlService.rules]]. + */ +var UrlRouter = /** @class */ (function () { + /** @internal */ + function UrlRouter(/** @internal */ router) { + var _this = this; + this.router = router; + // Delegate these calls to [[UrlService]] + /** @deprecated use [[UrlService.sync]]*/ + this.sync = function (evt) { return _this.router.urlService.sync(evt); }; + /** @deprecated use [[UrlService.listen]]*/ + this.listen = function (enabled) { return _this.router.urlService.listen(enabled); }; + /** @deprecated use [[UrlService.deferIntercept]]*/ + this.deferIntercept = function (defer) { return _this.router.urlService.deferIntercept(defer); }; + /** @deprecated use [[UrlService.match]]*/ + this.match = function (urlParts) { return _this.router.urlService.match(urlParts); }; + // Delegate these calls to [[UrlRules]] + /** @deprecated use [[UrlRules.initial]]*/ + this.initial = function (handler) { + return _this.router.urlService.rules.initial(handler); + }; + /** @deprecated use [[UrlRules.otherwise]]*/ + this.otherwise = function (handler) { + return _this.router.urlService.rules.otherwise(handler); + }; + /** @deprecated use [[UrlRules.removeRule]]*/ + this.removeRule = function (rule) { return _this.router.urlService.rules.removeRule(rule); }; + /** @deprecated use [[UrlRules.rule]]*/ + this.rule = function (rule) { return _this.router.urlService.rules.rule(rule); }; + /** @deprecated use [[UrlRules.rules]]*/ + this.rules = function () { return _this.router.urlService.rules.rules(); }; + /** @deprecated use [[UrlRules.sort]]*/ + this.sort = function (compareFn) { return _this.router.urlService.rules.sort(compareFn); }; + /** @deprecated use [[UrlRules.when]]*/ + this.when = function (matcher, handler, options) { return _this.router.urlService.rules.when(matcher, handler, options); }; + this.urlRuleFactory = new _urlRule__WEBPACK_IMPORTED_MODULE_1__.UrlRuleFactory(router); + } + /** Internal API. */ + UrlRouter.prototype.update = function (read) { + var $url = this.router.locationService; + if (read) { + this.location = $url.url(); + return; + } + if ($url.url() === this.location) + return; + $url.url(this.location, true); + }; + /** + * Internal API. + * + * Pushes a new location to the browser history. + * + * @internal + * @param urlMatcher + * @param params + * @param options + */ + UrlRouter.prototype.push = function (urlMatcher, params, options) { + var replace = options && !!options.replace; + this.router.urlService.url(urlMatcher.format(params || {}), replace); + }; + /** + * Builds and returns a URL with interpolated parameters + * + * #### Example: + * ```js + * matcher = $umf.compile("/about/:person"); + * params = { person: "bob" }; + * $bob = $urlRouter.href(matcher, params); + * // $bob == "/about/bob"; + * ``` + * + * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate. + * @param params An object of parameter values to fill the matcher's required parameters. + * @param options Options object. The options are: + * + * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl". + * + * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher` + */ + UrlRouter.prototype.href = function (urlMatcher, params, options) { + var url = urlMatcher.format(params); + if (url == null) + return null; + options = options || { absolute: false }; + var cfg = this.router.urlService.config; + var isHtml5 = cfg.html5Mode(); + if (!isHtml5 && url !== null) { + url = '#' + cfg.hashPrefix() + url; + } + url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref()); + if (!options.absolute || !url) { + return url; + } + var slash = !isHtml5 && url ? '/' : ''; + var cfgPort = cfg.port(); + var port = (cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort); + return [cfg.protocol(), '://', cfg.host(), port, slash, url].join(''); + }; + Object.defineProperty(UrlRouter.prototype, "interceptDeferred", { + /** @deprecated use [[UrlService.interceptDeferred]]*/ + get: function () { + return this.router.urlService.interceptDeferred; + }, + enumerable: false, + configurable: true + }); + return UrlRouter; +}()); + +//# sourceMappingURL=urlRouter.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js": +/*!************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRule.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRuleFactory": () => (/* binding */ UrlRuleFactory), +/* harmony export */ "BaseUrlRule": () => (/* binding */ BaseUrlRule) +/* harmony export */ }); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _state_stateObject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../state/stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); + + + + + +/** + * Creates a [[UrlRule]] + * + * Creates a [[UrlRule]] from a: + * + * - `string` + * - [[UrlMatcher]] + * - `RegExp` + * - [[StateObject]] + */ +var UrlRuleFactory = /** @class */ (function () { + function UrlRuleFactory(router) { + this.router = router; + } + UrlRuleFactory.prototype.compile = function (str) { + return this.router.urlMatcherFactory.compile(str); + }; + UrlRuleFactory.prototype.create = function (what, handler) { + var _this = this; + var isState = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isState, isStateDeclaration = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isStateDeclaration; + var makeRule = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ + [_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString, function (_what) { return makeRule(_this.compile(_what)); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_urlMatcher__WEBPACK_IMPORTED_MODULE_0__.UrlMatcher), function (_what) { return _this.fromUrlMatcher(_what, handler); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.or)(isState, isStateDeclaration), function (_what) { return _this.fromState(_what, _this.router); }], + [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(RegExp), function (_what) { return _this.fromRegExp(_what, handler); }], + [_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction, function (_what) { return new BaseUrlRule(_what, handler); }], + ]); + var rule = makeRule(what); + if (!rule) + throw new Error("invalid 'what' in when()"); + return rule; + }; + /** + * A UrlRule which matches based on a UrlMatcher + * + * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]] + * + * ## Handler as a function + * + * If `handler` is a function, the function is invoked with: + * + * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]]) + * - url: the current Url ([[UrlParts]]) + * - router: the router object ([[UIRouter]]) + * + * #### Example: + * ```js + * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); + * var rule = factory.fromUrlMatcher(urlMatcher, match => "/home/" + match.fooId + "/" + match.barId); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); // '/home/123/456' + * ``` + * + * ## Handler as UrlMatcher + * + * If `handler` is a UrlMatcher, the handler matcher is used to create the new url. + * The `handler` UrlMatcher is formatted using the matched param from the first matcher. + * The url is replaced with the result. + * + * #### Example: + * ```js + * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); + * var handler = $umf.compile("/home/:fooId/:barId"); + * var rule = factory.fromUrlMatcher(urlMatcher, handler); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); // '/home/123/456' + * ``` + */ + UrlRuleFactory.prototype.fromUrlMatcher = function (urlMatcher, handler) { + var _handler = handler; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(handler)) + handler = this.router.urlMatcherFactory.compile(handler); + if ((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_urlMatcher__WEBPACK_IMPORTED_MODULE_0__.UrlMatcher)(handler)) + _handler = function (match) { return handler.format(match); }; + function matchUrlParamters(url) { + var params = urlMatcher.exec(url.path, url.search, url.hash); + return urlMatcher.validates(params) && params; + } + // Prioritize URLs, lowest to highest: + // - Some optional URL parameters, but none matched + // - No optional parameters in URL + // - Some optional parameters, some matched + // - Some optional parameters, all matched + function matchPriority(params) { + var optional = urlMatcher.parameters().filter(function (param) { return param.isOptional; }); + if (!optional.length) + return 0.000001; + var matched = optional.filter(function (param) { return params[param.id]; }); + return matched.length / optional.length; + } + var details = { urlMatcher: urlMatcher, matchPriority: matchPriority, type: 'URLMATCHER' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(new BaseUrlRule(matchUrlParamters, _handler), details); + }; + /** + * A UrlRule which matches a state by its url + * + * #### Example: + * ```js + * var rule = factory.fromState($state.get('foo'), router); + * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } + * var result = rule.handler(match); + * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' } + * ``` + */ + UrlRuleFactory.prototype.fromState = function (stateOrDecl, router) { + var state = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isStateDeclaration(stateOrDecl) ? stateOrDecl.$$state() : stateOrDecl; + /** + * Handles match by transitioning to matched state + * + * First checks if the router should start a new transition. + * A new transition is not required if the current state's URL + * and the new URL are already identical + */ + var handler = function (match) { + var $state = router.stateService; + var globals = router.globals; + if ($state.href(state, match) !== $state.href(globals.current, globals.params)) { + $state.transitionTo(state, match, { inherit: true, source: 'url' }); + } + }; + var details = { state: state, type: 'STATE' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(this.fromUrlMatcher(state.url, handler), details); + }; + /** + * A UrlRule which matches based on a regular expression + * + * The `handler` may be either a [[UrlRuleHandlerFn]] or a string. + * + * ## Handler as a function + * + * If `handler` is a function, the function is invoked with: + * + * - regexp match array (from `regexp`) + * - url: the current Url ([[UrlParts]]) + * - router: the router object ([[UIRouter]]) + * + * #### Example: + * ```js + * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, match => "/home/" + match[1]) + * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] + * var result = rule.handler(match); // '/home/bar' + * ``` + * + * ## Handler as string + * + * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked. + * The string is first interpolated using `string.replace()` style pattern. + * + * #### Example: + * ```js + * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, "/home/$1") + * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] + * var result = rule.handler(match); // '/home/bar' + * ``` + */ + UrlRuleFactory.prototype.fromRegExp = function (regexp, handler) { + if (regexp.global || regexp.sticky) + throw new Error('Rule RegExp must not be global or sticky'); + /** + * If handler is a string, the url will be replaced by the string. + * If the string has any String.replace() style variables in it (like `$2`), + * they will be replaced by the captures from [[match]] + */ + var redirectUrlTo = function (match) { + // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern + return handler.replace(/\$(\$|\d{1,2})/, function (m, what) { return match[what === '$' ? 0 : Number(what)]; }); + }; + var _handler = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(handler) ? redirectUrlTo : handler; + var matchParamsFromRegexp = function (url) { return regexp.exec(url.path); }; + var details = { regexp: regexp, type: 'REGEXP' }; + return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(new BaseUrlRule(matchParamsFromRegexp, _handler), details); + }; + UrlRuleFactory.isUrlRule = function (obj) { return obj && ['type', 'match', 'handler'].every(function (key) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(obj[key]); }); }; + return UrlRuleFactory; +}()); + +/** + * A base rule which calls `match` + * + * The value from the `match` function is passed through to the `handler`. + * @internal + */ +var BaseUrlRule = /** @class */ (function () { + function BaseUrlRule(match, handler) { + var _this = this; + this.match = match; + this.type = 'RAW'; + this.matchPriority = function (match) { return 0 - _this.$id; }; + this.handler = handler || _common_common__WEBPACK_IMPORTED_MODULE_2__.identity; + } + return BaseUrlRule; +}()); + +//# sourceMappingURL=urlRule.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js": +/*!*************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlRules.js ***! + \*************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlRules": () => (/* binding */ UrlRules) +/* harmony export */ }); +/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../state */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); +/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); + + + + +var prioritySort = function (a, b) { return (b.priority || 0) - (a.priority || 0); }; +var typeSort = function (a, b) { + var weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 }; + return (weights[a.type] || 0) - (weights[b.type] || 0); +}; +var urlMatcherSort = function (a, b) { + return !a.urlMatcher || !b.urlMatcher ? 0 : _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher.compare(a.urlMatcher, b.urlMatcher); +}; +var idSort = function (a, b) { + // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL + var useMatchPriority = { STATE: true, URLMATCHER: true }; + var equal = useMatchPriority[a.type] && useMatchPriority[b.type]; + return equal ? 0 : (a.$id || 0) - (b.$id || 0); +}; +/** + * Default rule priority sorting function. + * + * Sorts rules by: + * + * - Explicit priority (set rule priority using [[UrlRules.when]]) + * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1) + * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule. + * - Rule registration order (for rule types other than STATE and URLMATCHER) + * - Equally sorted State and UrlMatcher rules will each match the URL. + * Then, the *best* match is chosen based on how many parameter values were matched. + */ +var defaultRuleSortFn; +defaultRuleSortFn = function (a, b) { + var cmp = prioritySort(a, b); + if (cmp !== 0) + return cmp; + cmp = typeSort(a, b); + if (cmp !== 0) + return cmp; + cmp = urlMatcherSort(a, b); + if (cmp !== 0) + return cmp; + return idSort(a, b); +}; +function getHandlerFn(handler) { + if (!(0,_common__WEBPACK_IMPORTED_MODULE_2__.isFunction)(handler) && !(0,_common__WEBPACK_IMPORTED_MODULE_2__.isString)(handler) && !(0,_common__WEBPACK_IMPORTED_MODULE_2__.is)(_state__WEBPACK_IMPORTED_MODULE_0__.TargetState)(handler) && !_state__WEBPACK_IMPORTED_MODULE_0__.TargetState.isDef(handler)) { + throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property"); + } + return (0,_common__WEBPACK_IMPORTED_MODULE_2__.isFunction)(handler) ? handler : (0,_common__WEBPACK_IMPORTED_MODULE_2__.val)(handler); +} +/** + * API for managing URL rules + * + * This API is used to create and manage URL rules. + * URL rules are a mechanism to respond to specific URL patterns. + * + * The most commonly used methods are [[otherwise]] and [[when]]. + * + * This API is found at `router.urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]]) + */ +var UrlRules = /** @class */ (function () { + /** @internal */ + function UrlRules(/** @internal */ router) { + this.router = router; + /** @internal */ this._sortFn = defaultRuleSortFn; + /** @internal */ this._rules = []; + /** @internal */ this._id = 0; + this.urlRuleFactory = new _urlRule__WEBPACK_IMPORTED_MODULE_3__.UrlRuleFactory(router); + } + /** @internal */ + UrlRules.prototype.dispose = function (router) { + this._rules = []; + delete this._otherwiseFn; + }; + /** + * Defines the initial state, path, or behavior to use when the app starts. + * + * This rule defines the initial/starting state for the application. + * + * This rule is triggered the first time the URL is checked (when the app initially loads). + * The rule is triggered only when the url matches either `""` or `"/"`. + * + * Note: The rule is intended to be used when the root of the application is directly linked to. + * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered. + * This allows 404-like behavior when an unknown URL is deep-linked. + * + * #### Example: + * Start app at `home` state. + * ```js + * .initial({ state: 'home' }); + * ``` + * + * #### Example: + * Start app at `/home` (by url) + * ```js + * .initial('/home'); + * ``` + * + * #### Example: + * When no other url rule matches, go to `home` state + * ```js + * .initial((matchValue, url, router) => { + * console.log('initial state'); + * return { state: 'home' }; + * }) + * ``` + * + * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic). + */ + UrlRules.prototype.initial = function (handler) { + var handlerFn = getHandlerFn(handler); + var matchFn = function (urlParts, router) { + return router.globals.transitionHistory.size() === 0 && !!/^\/?$/.exec(urlParts.path); + }; + this.rule(this.urlRuleFactory.create(matchFn, handlerFn)); + }; + /** + * Defines the state, url, or behavior to use when no other rule matches the URL. + * + * This rule is matched when *no other rule* matches. + * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side). + * + * - If `handler` a string, it is treated as a url redirect + * + * #### Example: + * When no other url rule matches, redirect to `/index` + * ```js + * .otherwise('/index'); + * ``` + * + * - If `handler` is an object with a `state` property, the state is activated. + * + * #### Example: + * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value. + * ```js + * .otherwise({ state: 'home', params: { dashboard: 'default' } }); + * ``` + * + * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object. + * The function can perform actions, and/or return a value. + * + * #### Example: + * When no other url rule matches, manually trigger a transition to the `home` state + * ```js + * .otherwise((matchValue, urlParts, router) => { + * router.stateService.go('home'); + * }); + * ``` + * + * #### Example: + * When no other url rule matches, go to `home` state + * ```js + * .otherwise((matchValue, urlParts, router) => { + * return { state: 'home' }; + * }); + * ``` + * + * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic). + */ + UrlRules.prototype.otherwise = function (handler) { + var handlerFn = getHandlerFn(handler); + this._otherwiseFn = this.urlRuleFactory.create((0,_common__WEBPACK_IMPORTED_MODULE_2__.val)(true), handlerFn); + this._sorted = false; + }; + /** + * Remove a rule previously registered + * + * @param rule the matcher rule that was previously registered using [[rule]] + */ + UrlRules.prototype.removeRule = function (rule) { + (0,_common__WEBPACK_IMPORTED_MODULE_2__.removeFrom)(this._rules, rule); + }; + /** + * Manually adds a URL Rule. + * + * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]]. + * This api can be used directly for more control (to register a [[BaseUrlRule]], for example). + * Rules can be created using [[urlRuleFactory]], or created manually as simple objects. + * + * A rule should have a `match` function which returns truthy if the rule matched. + * It should also have a `handler` function which is invoked if the rule is the best match. + * + * @return a function that deregisters the rule + */ + UrlRules.prototype.rule = function (rule) { + var _this = this; + if (!_urlRule__WEBPACK_IMPORTED_MODULE_3__.UrlRuleFactory.isUrlRule(rule)) + throw new Error('invalid rule'); + rule.$id = this._id++; + rule.priority = rule.priority || 0; + this._rules.push(rule); + this._sorted = false; + return function () { return _this.removeRule(rule); }; + }; + /** + * Gets all registered rules + * + * @returns an array of all the registered rules + */ + UrlRules.prototype.rules = function () { + this.ensureSorted(); + return this._rules.concat(this._otherwiseFn ? [this._otherwiseFn] : []); + }; + /** + * Defines URL Rule priorities + * + * More than one rule ([[UrlRule]]) might match a given URL. + * This `compareFn` is used to sort the rules by priority. + * Higher priority rules should sort earlier. + * + * The [[defaultRuleSortFn]] is used by default. + * + * You only need to call this function once. + * The `compareFn` will be used to sort the rules as each is registered. + * + * If called without any parameter, it will re-sort the rules. + * + * --- + * + * Url rules may come from multiple sources: states's urls ([[StateDeclaration.url]]), [[when]], and [[rule]]. + * Each rule has a (user-provided) [[UrlRule.priority]], a [[UrlRule.type]], and a [[UrlRule.$id]] + * The `$id` is is the order in which the rule was registered. + * + * The sort function should use these data, or data found on a specific type + * of [[UrlRule]] (such as [[StateRule.state]]), to order the rules as desired. + * + * #### Example: + * This compare function prioritizes rules by the order in which the rules were registered. + * A rule registered earlier has higher priority. + * + * ```js + * function compareFn(a, b) { + * return a.$id - b.$id; + * } + * ``` + * + * @param compareFn a function that compares to [[UrlRule]] objects. + * The `compareFn` should abide by the `Array.sort` compare function rules. + * Given two rules, `a` and `b`, return a negative number if `a` should be higher priority. + * Return a positive number if `b` should be higher priority. + * Return `0` if the rules are identical. + * + * See the [mozilla reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description) + * for details. + */ + UrlRules.prototype.sort = function (compareFn) { + var sorted = this.stableSort(this._rules, (this._sortFn = compareFn || this._sortFn)); + // precompute _sortGroup values and apply to each rule + var group = 0; + for (var i = 0; i < sorted.length; i++) { + sorted[i]._group = group; + if (i < sorted.length - 1 && this._sortFn(sorted[i], sorted[i + 1]) !== 0) { + group++; + } + } + this._rules = sorted; + this._sorted = true; + }; + /** @internal */ + UrlRules.prototype.ensureSorted = function () { + this._sorted || this.sort(); + }; + /** @internal */ + UrlRules.prototype.stableSort = function (arr, compareFn) { + var arrOfWrapper = arr.map(function (elem, idx) { return ({ elem: elem, idx: idx }); }); + arrOfWrapper.sort(function (wrapperA, wrapperB) { + var cmpDiff = compareFn(wrapperA.elem, wrapperB.elem); + return cmpDiff === 0 ? wrapperA.idx - wrapperB.idx : cmpDiff; + }); + return arrOfWrapper.map(function (wrapper) { return wrapper.elem; }); + }; + /** + * Registers a `matcher` and `handler` for custom URLs handling. + * + * The `matcher` can be: + * + * - a [[UrlMatcher]]: See: [[UrlMatcherFactory.compile]] + * - a `string`: The string is compiled to a [[UrlMatcher]] + * - a `RegExp`: The regexp is used to match the url. + * + * The `handler` can be: + * + * - a string: The url is redirected to the value of the string. + * - a function: The url is redirected to the return value of the function. + * + * --- + * + * When the `handler` is a `string` and the `matcher` is a `UrlMatcher` (or string), the redirect + * string is interpolated with parameter values. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when("/foo/:param1", "/bar/:param1") + * ``` + * + * --- + * + * When the `handler` is a string and the `matcher` is a `RegExp`, the redirect string is + * interpolated with capture groups from the RegExp. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when(new RegExp("^/foo/(.*)$"), "/bar/$1"); + * ``` + * + * --- + * + * When the handler is a function, it receives the matched value, the current URL, and the `UIRouter` object (See [[UrlRuleHandlerFn]]). + * The "matched value" differs based on the `matcher`. + * For [[UrlMatcher]]s, it will be the matched state params. + * For `RegExp`, it will be the match array from `regexp.exec()`. + * + * If the handler returns a string, the URL is redirected to the string. + * + * #### Example: + * When the URL is `/foo/123` the rule will redirect to `/bar/123`. + * ```js + * .when(new RegExp("^/foo/(.*)$"), match => "/bar/" + match[1]); + * ``` + * + * Note: the `handler` may also invoke arbitrary code, such as `$state.go()` + * + * @param matcher A pattern `string` to match, compiled as a [[UrlMatcher]], or a `RegExp`. + * @param handler The path to redirect to, or a function that returns the path. + * @param options `{ priority: number }` + * + * @return the registered [[UrlRule]] + */ + UrlRules.prototype.when = function (matcher, handler, options) { + var rule = this.urlRuleFactory.create(matcher, handler); + if ((0,_common__WEBPACK_IMPORTED_MODULE_2__.isDefined)(options && options.priority)) + rule.priority = options.priority; + this.rule(rule); + return rule; + }; + return UrlRules; +}()); + +//# sourceMappingURL=urlRules.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/url/urlService.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/url/urlService.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "UrlService": () => (/* binding */ UrlService) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _urlRules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlRules */ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js"); +/* harmony import */ var _urlConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./urlConfig */ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"); +/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../state */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); + + + + +/** + * API for URL management + */ +var UrlService = /** @class */ (function () { + /** @internal */ + function UrlService(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this.interceptDeferred = false; + /** + * The nested [[UrlRules]] API for managing URL rules and rewrites + * + * See: [[UrlRules]] for details + */ + this.rules = new _urlRules__WEBPACK_IMPORTED_MODULE_1__.UrlRules(this.router); + /** + * The nested [[UrlConfig]] API to configure the URL and retrieve URL information + * + * See: [[UrlConfig]] for details + */ + this.config = new _urlConfig__WEBPACK_IMPORTED_MODULE_2__.UrlConfig(this.router); + // Delegate these calls to the current LocationServices implementation + /** + * Gets the current url, or updates the url + * + * ### Getting the current URL + * + * When no arguments are passed, returns the current URL. + * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values. + * + * For example, the URL may be stored in the hash ([[HashLocationServices]]) or + * have a base HREF prepended ([[PushStateLocationServices]]). + * + * The raw URL in the browser might be: + * + * ``` + * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor + * ``` + * + * or + * + * ``` + * http://mysite.com/basepath/internal/path/123?param1=foo#anchor + * ``` + * + * then this method returns: + * + * ``` + * /internal/path/123?param1=foo#anchor + * ``` + * + * + * #### Example: + * ```js + * locationServices.url(); // "/some/path?query=value#anchor" + * ``` + * + * ### Updating the URL + * + * When `newurl` arguments is provided, changes the URL to reflect `newurl` + * + * #### Example: + * ```js + * locationServices.url("/some/path?query=value#anchor", true); + * ``` + * + * @param newurl The new value for the URL. + * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values. + * It should not include the protocol, site, port, or base path of an absolute HREF. + * @param replace When true, replaces the current history entry (instead of appending it) with this new url + * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it) + * + * @return the url (after potentially being processed) + */ + this.url = function (newurl, replace, state) { + return _this.router.locationService.url(newurl, replace, state); + }; + /** + * Gets the path part of the current url + * + * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path` + * + * @return the path portion of the url + */ + this.path = function () { return _this.router.locationService.path(); }; + /** + * Gets the search part of the current url as an object + * + * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }` + * + * @return the search (query) portion of the url, as an object + */ + this.search = function () { return _this.router.locationService.search(); }; + /** + * Gets the hash part of the current url + * + * If the current URL is `/some/path?query=value#anchor`, this returns `anchor` + * + * @return the hash (anchor) portion of the url + */ + this.hash = function () { return _this.router.locationService.hash(); }; + /** + * @internal + * + * Registers a low level url change handler + * + * Note: Because this is a low level handler, it's not recommended for general use. + * + * #### Example: + * ```js + * let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt)); + * ``` + * + * @param callback a function that will be called when the url is changing + * @return a function that de-registers the callback + */ + this.onChange = function (callback) { return _this.router.locationService.onChange(callback); }; + } + /** @internal */ + UrlService.prototype.dispose = function () { + this.listen(false); + this.rules.dispose(); + }; + /** + * Gets the current URL parts + * + * This method returns the different parts of the current URL (the [[path]], [[search]], and [[hash]]) as a [[UrlParts]] object. + */ + UrlService.prototype.parts = function () { + return { path: this.path(), search: this.search(), hash: this.hash() }; + }; + /** + * Activates the best rule for the current URL + * + * Checks the current URL for a matching [[UrlRule]], then invokes that rule's handler. + * This method is called internally any time the URL has changed. + * + * This effectively activates the state (or redirect, etc) which matches the current URL. + * + * #### Example: + * ```js + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * urlService.listen(); + * // Find the matching URL and invoke the handler. + * urlService.sync(); + * }); + * ``` + */ + UrlService.prototype.sync = function (evt) { + if (evt && evt.defaultPrevented) + return; + var _a = this.router, urlService = _a.urlService, stateService = _a.stateService; + var url = { path: urlService.path(), search: urlService.search(), hash: urlService.hash() }; + var best = this.match(url); + var applyResult = (0,_common__WEBPACK_IMPORTED_MODULE_0__.pattern)([ + [_common__WEBPACK_IMPORTED_MODULE_0__.isString, function (newurl) { return urlService.url(newurl, true); }], + [_state__WEBPACK_IMPORTED_MODULE_3__.TargetState.isDef, function (def) { return stateService.go(def.state, def.params, def.options); }], + [(0,_common__WEBPACK_IMPORTED_MODULE_0__.is)(_state__WEBPACK_IMPORTED_MODULE_3__.TargetState), function (target) { return stateService.go(target.state(), target.params(), target.options()); }], + ]); + applyResult(best && best.rule.handler(best.match, url, this.router)); + }; + /** + * Starts or stops listening for URL changes + * + * Call this sometime after calling [[deferIntercept]] to start monitoring the url. + * This causes UI-Router to start listening for changes to the URL, if it wasn't already listening. + * + * If called with `false`, UI-Router will stop listening (call listen(true) to start listening again). + * + * #### Example: + * ```js + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * // Start responding to URL changes + * urlService.listen(); + * urlService.sync(); + * }); + * ``` + * + * @param enabled `true` or `false` to start or stop listening to URL changes + */ + UrlService.prototype.listen = function (enabled) { + var _this = this; + if (enabled === false) { + this._stopListeningFn && this._stopListeningFn(); + delete this._stopListeningFn; + } + else { + return (this._stopListeningFn = + this._stopListeningFn || this.router.urlService.onChange(function (evt) { return _this.sync(evt); })); + } + }; + /** + * Disables monitoring of the URL. + * + * Call this method before UI-Router has bootstrapped. + * It will stop UI-Router from performing the initial url sync. + * + * This can be useful to perform some asynchronous initialization before the router starts. + * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. + * + * #### Example: + * ```js + * // Prevent UI-Router from automatically intercepting URL changes when it starts; + * urlService.deferIntercept(); + * + * fetch('/states.json').then(resp => resp.json()).then(data => { + * data.forEach(state => $stateRegistry.register(state)); + * urlService.listen(); + * urlService.sync(); + * }); + * ``` + * + * @param defer Indicates whether to defer location change interception. + * Passing no parameter is equivalent to `true`. + */ + UrlService.prototype.deferIntercept = function (defer) { + if (defer === undefined) + defer = true; + this.interceptDeferred = defer; + }; + /** + * Matches a URL + * + * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule. + * Return the result as a [[MatchResult]]. + */ + UrlService.prototype.match = function (url) { + var _this = this; + url = (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ path: '', search: {}, hash: '' }, url); + var rules = this.rules.rules(); + // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined + var checkRule = function (rule) { + var match = rule.match(url, _this.router); + return match && { match: match, rule: rule, weight: rule.matchPriority(match) }; + }; + // The rules are pre-sorted. + // - Find the first matching rule. + // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`. + // - Choose the rule with the highest match weight. + var best; + for (var i = 0; i < rules.length; i++) { + // Stop when there is a 'best' rule and the next rule sorts differently than it. + if (best && best.rule._group !== rules[i]._group) + break; + var current = checkRule(rules[i]); + // Pick the best MatchResult + best = !best || (current && current.weight > best.weight) ? current : best; + } + return best; + }; + return UrlService; +}()); + +//# sourceMappingURL=urlService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla.js": +/*!********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _vanilla_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vanilla/index */ "./node_modules/@uirouter/core/lib-esm/vanilla/index.js"); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _vanilla_index__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _vanilla_index__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); + +//# sourceMappingURL=vanilla.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "BaseLocationServices": () => (/* binding */ BaseLocationServices) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); + + +/** A base `LocationServices` */ +var BaseLocationServices = /** @class */ (function () { + function BaseLocationServices(router, fireAfterUpdate) { + var _this = this; + this.fireAfterUpdate = fireAfterUpdate; + this._listeners = []; + this._listener = function (evt) { return _this._listeners.forEach(function (cb) { return cb(evt); }); }; + this.hash = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).hash; }; + this.path = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).path; }; + this.search = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getParams)((0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).search); }; + this._location = _common__WEBPACK_IMPORTED_MODULE_0__.root.location; + this._history = _common__WEBPACK_IMPORTED_MODULE_0__.root.history; + } + BaseLocationServices.prototype.url = function (url, replace) { + if (replace === void 0) { replace = true; } + if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isDefined)(url) && url !== this._get()) { + this._set(null, null, url, replace); + if (this.fireAfterUpdate) { + this._listeners.forEach(function (cb) { return cb({ url: url }); }); + } + } + return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.buildUrl)(this); + }; + BaseLocationServices.prototype.onChange = function (cb) { + var _this = this; + this._listeners.push(cb); + return function () { return (0,_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._listeners, cb); }; + }; + BaseLocationServices.prototype.dispose = function (router) { + (0,_common__WEBPACK_IMPORTED_MODULE_0__.deregAll)(this._listeners); + }; + return BaseLocationServices; +}()); + +//# sourceMappingURL=baseLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "BrowserLocationConfig": () => (/* binding */ BrowserLocationConfig) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); + +/** A `LocationConfig` that delegates to the browser's `location` object */ +var BrowserLocationConfig = /** @class */ (function () { + function BrowserLocationConfig(router, _isHtml5) { + if (_isHtml5 === void 0) { _isHtml5 = false; } + this._isHtml5 = _isHtml5; + this._baseHref = undefined; + this._hashPrefix = ''; + } + BrowserLocationConfig.prototype.port = function () { + if (location.port) { + return Number(location.port); + } + return this.protocol() === 'https' ? 443 : 80; + }; + BrowserLocationConfig.prototype.protocol = function () { + return location.protocol.replace(/:/g, ''); + }; + BrowserLocationConfig.prototype.host = function () { + return location.hostname; + }; + BrowserLocationConfig.prototype.html5Mode = function () { + return this._isHtml5; + }; + BrowserLocationConfig.prototype.hashPrefix = function (newprefix) { + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newprefix) ? (this._hashPrefix = newprefix) : this._hashPrefix; + }; + BrowserLocationConfig.prototype.baseHref = function (href) { + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(href)) + this._baseHref = href; + if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(this._baseHref)) + this._baseHref = this.getBaseHref(); + return this._baseHref; + }; + BrowserLocationConfig.prototype.getBaseHref = function () { + var baseTag = document.getElementsByTagName('base')[0]; + if (baseTag && baseTag.href) { + return baseTag.href.replace(/^([^/:]*:)?\/\/[^/]*/, ''); + } + return this._isHtml5 ? '/' : location.pathname || '/'; + }; + BrowserLocationConfig.prototype.dispose = function () { }; + return BrowserLocationConfig; +}()); + +//# sourceMappingURL=browserLocationConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "HashLocationService": () => (/* binding */ HashLocationService) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + +/** A `LocationServices` that uses the browser hash "#" to get/set the current location */ +var HashLocationService = /** @class */ (function (_super) { + __extends(HashLocationService, _super); + function HashLocationService(router) { + var _this = _super.call(this, router, false) || this; + _common__WEBPACK_IMPORTED_MODULE_0__.root.addEventListener('hashchange', _this._listener, false); + return _this; + } + HashLocationService.prototype._get = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_0__.trimHashVal)(this._location.hash); + }; + HashLocationService.prototype._set = function (state, title, url, replace) { + this._location.hash = url; + }; + HashLocationService.prototype.dispose = function (router) { + _super.prototype.dispose.call(this, router); + _common__WEBPACK_IMPORTED_MODULE_0__.root.removeEventListener('hashchange', this._listener); + }; + return HashLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_1__.BaseLocationServices)); + +//# sourceMappingURL=hashLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/index.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$q": () => (/* reexport safe */ _q__WEBPACK_IMPORTED_MODULE_1__.$q), +/* harmony export */ "$injector": () => (/* reexport safe */ _injector__WEBPACK_IMPORTED_MODULE_2__.$injector), +/* harmony export */ "BaseLocationServices": () => (/* reexport safe */ _baseLocationService__WEBPACK_IMPORTED_MODULE_3__.BaseLocationServices), +/* harmony export */ "HashLocationService": () => (/* reexport safe */ _hashLocationService__WEBPACK_IMPORTED_MODULE_4__.HashLocationService), +/* harmony export */ "MemoryLocationService": () => (/* reexport safe */ _memoryLocationService__WEBPACK_IMPORTED_MODULE_5__.MemoryLocationService), +/* harmony export */ "PushStateLocationService": () => (/* reexport safe */ _pushStateLocationService__WEBPACK_IMPORTED_MODULE_6__.PushStateLocationService), +/* harmony export */ "MemoryLocationConfig": () => (/* reexport safe */ _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_7__.MemoryLocationConfig), +/* harmony export */ "BrowserLocationConfig": () => (/* reexport safe */ _browserLocationConfig__WEBPACK_IMPORTED_MODULE_8__.BrowserLocationConfig), +/* harmony export */ "buildUrl": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.buildUrl), +/* harmony export */ "getParams": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.getParams), +/* harmony export */ "keyValsToObjectR": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.keyValsToObjectR), +/* harmony export */ "locationPluginFactory": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.locationPluginFactory), +/* harmony export */ "parseUrl": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.parseUrl), +/* harmony export */ "hashLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.hashLocationPlugin), +/* harmony export */ "memoryLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.memoryLocationPlugin), +/* harmony export */ "pushStateLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.pushStateLocationPlugin), +/* harmony export */ "servicesPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.servicesPlugin) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/vanilla/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _q__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./q */ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js"); +/* harmony import */ var _injector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./injector */ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +/* harmony import */ var _hashLocationService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hashLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"); +/* harmony import */ var _memoryLocationService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./memoryLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"); +/* harmony import */ var _pushStateLocationService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pushStateLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"); +/* harmony import */ var _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./memoryLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js"); +/* harmony import */ var _browserLocationConfig__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./browserLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); +/* harmony import */ var _plugins__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./plugins */ "./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js"); +/** + * Naive, pure JS implementation of core ui-router services + * + * @packageDocumentation + */ + + + + + + + + + + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/injector.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$injector": () => (/* binding */ $injector) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +// globally available injectables +var globals = {}; +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm; +var ARGUMENT_NAMES = /([^\s,]+)/g; +/** + * A basic angular1-like injector api + * + * This object implements four methods similar to the + * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector) + * + * UI-Router evolved from an angular 1 library to a framework agnostic library. + * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. + * + * This object provides a naive implementation of a globally scoped dependency injection system. + * It supports the following DI approaches: + * + * ### Function parameter names + * + * A function's `.toString()` is called, and the parameter names are parsed. + * This only works when the parameter names aren't "mangled" by a minifier such as UglifyJS. + * + * ```js + * function injectedFunction(FooService, BarService) { + * // FooService and BarService are injected + * } + * ``` + * + * ### Function annotation + * + * A function may be annotated with an array of dependency names as the `$inject` property. + * + * ```js + * injectedFunction.$inject = [ 'FooService', 'BarService' ]; + * function injectedFunction(fs, bs) { + * // FooService and BarService are injected as fs and bs parameters + * } + * ``` + * + * ### Array notation + * + * An array provides the names of the dependencies to inject (as strings). + * The function is the last element of the array. + * + * ```js + * [ 'FooService', 'BarService', function (fs, bs) { + * // FooService and BarService are injected as fs and bs parameters + * }] + * ``` + * + * @type {$InjectorLike} + */ +var $injector = { + /** Gets an object from DI based on a string token */ + get: function (name) { return globals[name]; }, + /** Returns true if an object named `name` exists in global DI */ + has: function (name) { return $injector.get(name) != null; }, + /** + * Injects a function + * + * @param fn the function to inject + * @param context the function's `this` binding + * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }` + */ + invoke: function (fn, context, locals) { + var all = (0,_common_index__WEBPACK_IMPORTED_MODULE_0__.extend)({}, globals, locals || {}); + var params = $injector.annotate(fn); + var ensureExist = (0,_common_index__WEBPACK_IMPORTED_MODULE_0__.assertPredicate)(function (key) { return all.hasOwnProperty(key); }, function (key) { return "DI can't find injectable: '" + key + "'"; }); + var args = params.filter(ensureExist).map(function (x) { return all[x]; }); + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isFunction)(fn)) + return fn.apply(context, args); + else + return fn.slice(-1)[0].apply(context, args); + }, + /** + * Returns a function's dependencies + * + * Analyzes a function (or array) and returns an array of DI tokens that the function requires. + * @return an array of `string`s + */ + annotate: function (fn) { + if (!(0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isInjectable)(fn)) + throw new Error("Not an injectable function: " + fn); + if (fn && fn.$inject) + return fn.$inject; + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isArray)(fn)) + return fn.slice(0, -1); + var fnStr = fn.toString().replace(STRIP_COMMENTS, ''); + var result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); + return result || []; + }, +}; +//# sourceMappingURL=injector.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/interface.js": +/*!******************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/interface.js ***! + \******************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MemoryLocationConfig": () => (/* binding */ MemoryLocationConfig) +/* harmony export */ }); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); + + +/** A `LocationConfig` mock that gets/sets all config from an in-memory object */ +var MemoryLocationConfig = /** @class */ (function () { + function MemoryLocationConfig() { + var _this = this; + this.dispose = _common_common__WEBPACK_IMPORTED_MODULE_1__.noop; + this._baseHref = ''; + this._port = 80; + this._protocol = 'http'; + this._host = 'localhost'; + this._hashPrefix = ''; + this.port = function () { return _this._port; }; + this.protocol = function () { return _this._protocol; }; + this.host = function () { return _this._host; }; + this.baseHref = function () { return _this._baseHref; }; + this.html5Mode = function () { return false; }; + this.hashPrefix = function (newval) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newval) ? (_this._hashPrefix = newval) : _this._hashPrefix); }; + } + return MemoryLocationConfig; +}()); + +//# sourceMappingURL=memoryLocationConfig.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "MemoryLocationService": () => (/* binding */ MemoryLocationService) +/* harmony export */ }); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + +/** A `LocationServices` that gets/sets the current location from an in-memory object */ +var MemoryLocationService = /** @class */ (function (_super) { + __extends(MemoryLocationService, _super); + function MemoryLocationService(router) { + return _super.call(this, router, true) || this; + } + MemoryLocationService.prototype._get = function () { + return this._url; + }; + MemoryLocationService.prototype._set = function (state, title, url, replace) { + this._url = url; + }; + return MemoryLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_0__.BaseLocationServices)); + +//# sourceMappingURL=memoryLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js": +/*!****************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "servicesPlugin": () => (/* binding */ servicesPlugin), +/* harmony export */ "hashLocationPlugin": () => (/* binding */ hashLocationPlugin), +/* harmony export */ "pushStateLocationPlugin": () => (/* binding */ pushStateLocationPlugin), +/* harmony export */ "memoryLocationPlugin": () => (/* binding */ memoryLocationPlugin) +/* harmony export */ }); +/* harmony import */ var _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./browserLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"); +/* harmony import */ var _hashLocationService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); +/* harmony import */ var _pushStateLocationService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pushStateLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"); +/* harmony import */ var _memoryLocationService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./memoryLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"); +/* harmony import */ var _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./memoryLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js"); +/* harmony import */ var _injector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./injector */ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"); +/* harmony import */ var _q__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./q */ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js"); +/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); + + + + + + + + + +function servicesPlugin(router) { + _common_coreservices__WEBPACK_IMPORTED_MODULE_8__.services.$injector = _injector__WEBPACK_IMPORTED_MODULE_6__.$injector; + _common_coreservices__WEBPACK_IMPORTED_MODULE_8__.services.$q = _q__WEBPACK_IMPORTED_MODULE_7__.$q; + return { name: 'vanilla.services', $q: _q__WEBPACK_IMPORTED_MODULE_7__.$q, $injector: _injector__WEBPACK_IMPORTED_MODULE_6__.$injector, dispose: function () { return null; } }; +} +/** A `UIRouterPlugin` uses the browser hash to get/set the current location */ +var hashLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.hashBangLocation', false, _hashLocationService__WEBPACK_IMPORTED_MODULE_1__.HashLocationService, _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__.BrowserLocationConfig); +/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */ +var pushStateLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.pushStateLocation', true, _pushStateLocationService__WEBPACK_IMPORTED_MODULE_3__.PushStateLocationService, _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__.BrowserLocationConfig); +/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */ +var memoryLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.memoryLocation', false, _memoryLocationService__WEBPACK_IMPORTED_MODULE_4__.MemoryLocationService, _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_5__.MemoryLocationConfig); +//# sourceMappingURL=plugins.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PushStateLocationService": () => (/* binding */ PushStateLocationService) +/* harmony export */ }); +/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); +var __extends = (undefined && undefined.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); + + +/** + * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis + * + * Uses `history.pushState` and `history.replaceState` + */ +var PushStateLocationService = /** @class */ (function (_super) { + __extends(PushStateLocationService, _super); + function PushStateLocationService(router) { + var _this = _super.call(this, router, true) || this; + _this._config = router.urlService.config; + _common__WEBPACK_IMPORTED_MODULE_1__.root.addEventListener('popstate', _this._listener, false); + return _this; + } + /** + * Gets the base prefix without: + * - trailing slash + * - trailing filename + * - protocol and hostname + * + * If , this returns '/base'. + * If , this returns '/foo/base'. + * If , this returns '/base'. + * If , this returns '/base'. + * If , this returns ''. + * If , this returns ''. + * If , this returns ''. + * + * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element + */ + PushStateLocationService.prototype._getBasePrefix = function () { + return (0,_common__WEBPACK_IMPORTED_MODULE_1__.stripLastPathElement)(this._config.baseHref()); + }; + PushStateLocationService.prototype._get = function () { + var _a = this._location, pathname = _a.pathname, hash = _a.hash, search = _a.search; + search = (0,_common__WEBPACK_IMPORTED_MODULE_1__.splitQuery)(search)[1]; // strip ? if found + hash = (0,_common__WEBPACK_IMPORTED_MODULE_1__.splitHash)(hash)[1]; // strip # if found + var basePrefix = this._getBasePrefix(); + var exactBaseHrefMatch = pathname === this._config.baseHref(); + var startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix; + pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname; + return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : ''); + }; + PushStateLocationService.prototype._set = function (state, title, url, replace) { + var basePrefix = this._getBasePrefix(); + var slash = url && url[0] !== '/' ? '/' : ''; + var fullUrl = url === '' || url === '/' ? this._config.baseHref() : basePrefix + slash + url; + if (replace) { + this._history.replaceState(state, title, fullUrl); + } + else { + this._history.pushState(state, title, fullUrl); + } + }; + PushStateLocationService.prototype.dispose = function (router) { + _super.prototype.dispose.call(this, router); + _common__WEBPACK_IMPORTED_MODULE_1__.root.removeEventListener('popstate', this._listener); + }; + return PushStateLocationService; +}(_baseLocationService__WEBPACK_IMPORTED_MODULE_0__.BaseLocationServices)); + +//# sourceMappingURL=pushStateLocationService.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/q.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "$q": () => (/* binding */ $q) +/* harmony export */ }); +/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +/** + * An angular1-like promise api + * + * This object implements four methods similar to the + * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q) + * + * UI-Router evolved from an angular 1 library to a framework agnostic library. + * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. + * + * This API provides native ES6 promise support wrapped as a $q-like API. + * Internally, UI-Router uses this $q object to perform promise operations. + * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular. + * + * $q-like promise api + */ +var $q = { + /** Normalizes a value as a promise */ + when: function (val) { return new Promise(function (resolve, reject) { return resolve(val); }); }, + /** Normalizes a value as a promise rejection */ + reject: function (val) { + return new Promise(function (resolve, reject) { + reject(val); + }); + }, + /** @returns a deferred object, which has `resolve` and `reject` functions */ + defer: function () { + var deferred = {}; + deferred.promise = new Promise(function (resolve, reject) { + deferred.resolve = resolve; + deferred.reject = reject; + }); + return deferred; + }, + /** Like Promise.all(), but also supports object key/promise notation like $q */ + all: function (promises) { + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isArray)(promises)) { + return Promise.all(promises); + } + if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isObject)(promises)) { + // Convert promises map to promises array. + // When each promise resolves, map it to a tuple { key: key, val: val } + var chain = Object.keys(promises).map(function (key) { return promises[key].then(function (val) { return ({ key: key, val: val }); }); }); + // Then wait for all promises to resolve, and convert them back to an object + return $q.all(chain).then(function (values) { + return values.reduce(function (acc, tuple) { + acc[tuple.key] = tuple.val; + return acc; + }, {}); + }); + } + }, +}; +//# sourceMappingURL=q.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js": +/*!**************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/vanilla/utils.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "keyValsToObjectR": () => (/* binding */ keyValsToObjectR), +/* harmony export */ "getParams": () => (/* binding */ getParams), +/* harmony export */ "parseUrl": () => (/* binding */ parseUrl), +/* harmony export */ "buildUrl": () => (/* binding */ buildUrl), +/* harmony export */ "locationPluginFactory": () => (/* binding */ locationPluginFactory) +/* harmony export */ }); +/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); + +var keyValsToObjectR = function (accum, _a) { + var key = _a[0], val = _a[1]; + if (!accum.hasOwnProperty(key)) { + accum[key] = val; + } + else if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isArray)(accum[key])) { + accum[key].push(val); + } + else { + accum[key] = [accum[key], val]; + } + return accum; +}; +var getParams = function (queryString) { + return queryString.split('&').filter(_common__WEBPACK_IMPORTED_MODULE_0__.identity).map(_common__WEBPACK_IMPORTED_MODULE_0__.splitEqual).reduce(keyValsToObjectR, {}); +}; +function parseUrl(url) { + var orEmptyString = function (x) { return x || ''; }; + var _a = (0,_common__WEBPACK_IMPORTED_MODULE_0__.splitHash)(url).map(orEmptyString), beforehash = _a[0], hash = _a[1]; + var _b = (0,_common__WEBPACK_IMPORTED_MODULE_0__.splitQuery)(beforehash).map(orEmptyString), path = _b[0], search = _b[1]; + return { path: path, search: search, hash: hash, url: url }; +} +var buildUrl = function (loc) { + var path = loc.path(); + var searchObject = loc.search(); + var hash = loc.hash(); + var search = Object.keys(searchObject) + .map(function (key) { + var param = searchObject[key]; + var vals = (0,_common__WEBPACK_IMPORTED_MODULE_0__.isArray)(param) ? param : [param]; + return vals.map(function (val) { return key + '=' + val; }); + }) + .reduce(_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) + .join('&'); + return path + (search ? '?' + search : '') + (hash ? '#' + hash : ''); +}; +function locationPluginFactory(name, isHtml5, serviceClass, configurationClass) { + return function (uiRouter) { + var service = (uiRouter.locationService = new serviceClass(uiRouter)); + var configuration = (uiRouter.locationConfig = new configurationClass(uiRouter, isHtml5)); + function dispose(router) { + router.dispose(service); + router.dispose(configuration); + } + return { name: name, service: service, configuration: configuration, dispose: dispose }; + }; +} +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/index.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ViewService": () => (/* reexport safe */ _view__WEBPACK_IMPORTED_MODULE_1__.ViewService) +/* harmony export */ }); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/view/interface.js"); +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; +/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] +/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); +/* harmony import */ var _view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./view */ "./node_modules/@uirouter/core/lib-esm/view/view.js"); + + +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/interface.js": +/*!***************************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/interface.js ***! + \***************************************************************/ +/***/ (() => { + +//# sourceMappingURL=interface.js.map + +/***/ }), + +/***/ "./node_modules/@uirouter/core/lib-esm/view/view.js": +/*!**********************************************************!*\ + !*** ./node_modules/@uirouter/core/lib-esm/view/view.js ***! + \**********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ViewService": () => (/* binding */ ViewService) +/* harmony export */ }); +/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); +/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); +/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); +/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); + + + + +/** + * The View service + * + * This service pairs existing `ui-view` components (which live in the DOM) + * with view configs (from the state declaration objects: [[StateDeclaration.views]]). + * + * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]]. + * The views from exited states are deactivated via [[deactivateViewConfig]]. + * (See: the [[registerActivateViews]] Transition Hook) + * + * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]]. + * + * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]]) + * are configured with the matching [[ViewConfig]](s) + * + */ +var ViewService = /** @class */ (function () { + /** @internal */ + function ViewService(/** @internal */ router) { + var _this = this; + this.router = router; + /** @internal */ this._uiViews = []; + /** @internal */ this._viewConfigs = []; + /** @internal */ this._viewConfigFactories = {}; + /** @internal */ this._listeners = []; + /** @internal */ + this._pluginapi = { + _rootViewContext: this._rootViewContext.bind(this), + _viewConfigFactory: this._viewConfigFactory.bind(this), + _registeredUIView: function (id) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(_this._uiViews, function (view) { return _this.router.$id + "." + view.id === id; }); }, + _registeredUIViews: function () { return _this._uiViews; }, + _activeViewConfigs: function () { return _this._viewConfigs; }, + _onSync: function (listener) { + _this._listeners.push(listener); + return function () { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._listeners, listener); }; + }, + }; + } + /** + * Normalizes a view's name from a state.views configuration block. + * + * This should be used by a framework implementation to calculate the values for + * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]]. + * + * @param context the context object (state declaration) that the view belongs to + * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]] + * + * @returns the normalized uiViewName and uiViewContextAnchor that the view targets + */ + ViewService.normalizeUIViewTarget = function (context, rawViewName) { + if (rawViewName === void 0) { rawViewName = ''; } + // TODO: Validate incoming view name with a regexp to allow: + // ex: "view.name@foo.bar" , "^.^.view.name" , "view.name@^.^" , "" , + // "@" , "$default@^" , "!$default.$default" , "!foo.bar" + var viewAtContext = rawViewName.split('@'); + var uiViewName = viewAtContext[0] || '$default'; // default to unnamed view + var uiViewContextAnchor = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(viewAtContext[1]) ? viewAtContext[1] : '^'; // default to parent context + // Handle relative view-name sugar syntax. + // Matches rawViewName "^.^.^.foo.bar" into array: ["^.^.^.foo.bar", "^.^.^", "foo.bar"], + var relativeViewNameSugar = /^(\^(?:\.\^)*)\.(.*$)/.exec(uiViewName); + if (relativeViewNameSugar) { + // Clobbers existing contextAnchor (rawViewName validation will fix this) + uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to "^.^.^" + uiViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar" + } + if (uiViewName.charAt(0) === '!') { + uiViewName = uiViewName.substr(1); + uiViewContextAnchor = ''; // target absolutely from root + } + // handle parent relative targeting "^.^.^" + var relativeMatch = /^(\^(?:\.\^)*)$/; + if (relativeMatch.exec(uiViewContextAnchor)) { + var anchorState = uiViewContextAnchor.split('.').reduce(function (anchor, x) { return anchor.parent; }, context); + uiViewContextAnchor = anchorState.name; + } + else if (uiViewContextAnchor === '.') { + uiViewContextAnchor = context.name; + } + return { uiViewName: uiViewName, uiViewContextAnchor: uiViewContextAnchor }; + }; + /** @internal */ + ViewService.prototype._rootViewContext = function (context) { + return (this._rootContext = context || this._rootContext); + }; + /** @internal */ + ViewService.prototype._viewConfigFactory = function (viewType, factory) { + this._viewConfigFactories[viewType] = factory; + }; + ViewService.prototype.createViewConfig = function (path, decl) { + var cfgFactory = this._viewConfigFactories[decl.$type]; + if (!cfgFactory) + throw new Error('ViewService: No view config factory registered for type ' + decl.$type); + var cfgs = cfgFactory(path, decl); + return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(cfgs) ? cfgs : [cfgs]; + }; + /** + * Deactivates a ViewConfig. + * + * This function deactivates a `ViewConfig`. + * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired. + * + * @param viewConfig The ViewConfig view to deregister. + */ + ViewService.prototype.deactivateViewConfig = function (viewConfig) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceEvent('<- Removing', viewConfig); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(this._viewConfigs, viewConfig); + }; + ViewService.prototype.activateViewConfig = function (viewConfig) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceEvent('-> Registering', viewConfig); + this._viewConfigs.push(viewConfig); + }; + ViewService.prototype.sync = function () { + var _this = this; + var uiViewsByFqn = this._uiViews.map(function (uiv) { return [uiv.fqn, uiv]; }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs, {}); + // Return a weighted depth value for a uiView. + // The depth is the nesting depth of ui-views (based on FQN; times 10,000) + // plus the depth of the state that is populating the uiView + function uiViewDepth(uiView) { + var stateDepth = function (context) { return (context && context.parent ? stateDepth(context.parent) + 1 : 1); }; + return uiView.fqn.split('.').length * 10000 + stateDepth(uiView.creationContext); + } + // Return the ViewConfig's context's depth in the context tree. + function viewConfigDepth(config) { + var context = config.viewDecl.$context, count = 0; + while (++count && context.parent) + context = context.parent; + return count; + } + // Given a depth function, returns a compare function which can return either ascending or descending order + var depthCompare = (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(function (depthFn, posNeg, left, right) { return posNeg * (depthFn(left) - depthFn(right)); }); + var matchingConfigPair = function (uiView) { + var matchingConfigs = _this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView)); + if (matchingConfigs.length > 1) { + // This is OK. Child states can target a ui-view that the parent state also targets (the child wins) + // Sort by depth and return the match from the deepest child + // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs); + matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending + } + return { uiView: uiView, viewConfig: matchingConfigs[0] }; + }; + var configureUIView = function (tuple) { + // If a parent ui-view is reconfigured, it could destroy child ui-views. + // Before configuring a child ui-view, make sure it's still in the active uiViews array. + if (_this._uiViews.indexOf(tuple.uiView) !== -1) + tuple.uiView.configUpdated(tuple.viewConfig); + }; + // Sort views by FQN and state depth. Process uiviews nearest the root first. + var uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair); + var matchedViewConfigs = uiViewTuples.map(function (tuple) { return tuple.viewConfig; }); + var unmatchedConfigTuples = this._viewConfigs + .filter(function (config) { return !(0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(matchedViewConfigs, config); }) + .map(function (viewConfig) { return ({ uiView: undefined, viewConfig: viewConfig }); }); + uiViewTuples.forEach(configureUIView); + var allTuples = uiViewTuples.concat(unmatchedConfigTuples); + this._listeners.forEach(function (cb) { return cb(allTuples); }); + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewSync(allTuples); + }; + /** + * Registers a `ui-view` component + * + * When a `ui-view` component is created, it uses this method to register itself. + * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]]. + * + * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`, + * and what the view's state context is. + * + * Note: There is no corresponding `deregisterUIView`. + * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself. + * + * @param uiView The metadata for a UIView + * @return a de-registration function used when the view is destroyed. + */ + ViewService.prototype.registerUIView = function (uiView) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('-> Registering', uiView); + var uiViews = this._uiViews; + var fqnAndTypeMatches = function (uiv) { return uiv.fqn === uiView.fqn && uiv.$type === uiView.$type; }; + if (uiViews.filter(fqnAndTypeMatches).length) + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('!!!! duplicate uiView named:', uiView); + uiViews.push(uiView); + this.sync(); + return function () { + var idx = uiViews.indexOf(uiView); + if (idx === -1) { + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('Tried removing non-registered uiView', uiView); + return; + } + _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('<- Deregistering', uiView); + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(uiViews)(uiView); + }; + }; + /** + * Returns the list of views currently available on the page, by fully-qualified name. + * + * @return {Array} Returns an array of fully-qualified view names. + */ + ViewService.prototype.available = function () { + return this._uiViews.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('fqn')); + }; + /** + * Returns the list of views on the page containing loaded content. + * + * @return {Array} Returns an array of fully-qualified view names. + */ + ViewService.prototype.active = function () { + return this._uiViews.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('$config')).map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('name')); + }; + /** + * Given a ui-view and a ViewConfig, determines if they "match". + * + * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in + * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of. + * + * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or + * can be a segmented ui-view path, describing a portion of a ui-view fqn. + * + * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type + * + * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if: + * - the ui-view's name matches the ViewConfig's target name + * - the ui-view's context matches the ViewConfig's anchor + * + * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if: + * - There exists a parent ui-view where: + * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name + * - the parent ui-view's context matches the ViewConfig's anchor + * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn + * + * Example: + * + * DOM: + * + * + * + * + * + * + * + * + * + * uiViews: [ + * { fqn: "$default", creationContext: { name: "" } }, + * { fqn: "$default.foo", creationContext: { name: "A" } }, + * { fqn: "$default.foo.$default", creationContext: { name: "A.B" } } + * { fqn: "$default.foo.$default.bar", creationContext: { name: "A.B.C" } } + * ] + * + * These four view configs all match the ui-view with the fqn: "$default.foo.$default.bar": + * + * - ViewConfig1: { uiViewName: "bar", uiViewContextAnchor: "A.B.C" } + * - ViewConfig2: { uiViewName: "$default.bar", uiViewContextAnchor: "A.B" } + * - ViewConfig3: { uiViewName: "foo.$default.bar", uiViewContextAnchor: "A" } + * - ViewConfig4: { uiViewName: "$default.foo.$default.bar", uiViewContextAnchor: "" } + * + * Using ViewConfig3 as an example, it matches the ui-view with fqn "$default.foo.$default.bar" because: + * - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ] + * - There exists a parent ui-view (which has fqn: "$default.foo") where: + * - the parent ui-view's name "foo" matches the first segment "foo" of the ViewConfig's target name + * - the parent ui-view's context "A" matches the ViewConfig's anchor context "A" + * - And the remaining segments [ "$default", "bar" ].join("."_ of the ViewConfig's target name match + * the tail of the ui-view's fqn "default.bar" + * + * @internal + */ + ViewService.matches = function (uiViewsByFqn, uiView) { return function (viewConfig) { + // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc + if (uiView.$type !== viewConfig.viewDecl.$type) + return false; + // Split names apart from both viewConfig and uiView into segments + var vc = viewConfig.viewDecl; + var vcSegments = vc.$uiViewName.split('.'); + var uivSegments = uiView.fqn.split('.'); + // Check if the tails of the segment arrays match. ex, these arrays' tails match: + // vc: ["foo", "bar"], uiv fqn: ["$default", "foo", "bar"] + if (!(0,_common_common__WEBPACK_IMPORTED_MODULE_0__.equals)(vcSegments, uivSegments.slice(0 - vcSegments.length))) + return false; + // Now check if the fqn ending at the first segment of the viewConfig matches the context: + // ["$default", "foo"].join(".") == "$default.foo", does the ui-view $default.foo context match? + var negOffset = 1 - vcSegments.length || undefined; + var fqnToFirstSegment = uivSegments.slice(0, negOffset).join('.'); + var uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext; + return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name); + }; }; + return ViewService; +}()); + +//# sourceMappingURL=view.js.map + +/***/ }), + +/***/ "./node_modules/angular-animate/angular-animate.js": +/*!*********************************************************!*\ + !*** ./node_modules/angular-animate/angular-animate.js ***! + \*********************************************************/ +/***/ (() => { + +/** + * @license AngularJS v1.8.2 + * (c) 2010-2020 Google LLC. http://angularjs.org + * License: MIT + */ +(function(window, angular) {'use strict'; + +var ELEMENT_NODE = 1; +var COMMENT_NODE = 8; + +var ADD_CLASS_SUFFIX = '-add'; +var REMOVE_CLASS_SUFFIX = '-remove'; +var EVENT_CLASS_PREFIX = 'ng-'; +var ACTIVE_CLASS_SUFFIX = '-active'; +var PREPARE_CLASS_SUFFIX = '-prepare'; + +var NG_ANIMATE_CLASSNAME = 'ng-animate'; +var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren'; + +// Detect proper transitionend/animationend event names. +var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT; + +// If unprefixed events are not supported but webkit-prefixed are, use the latter. +// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them. +// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend` +// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`. +// Register both events in case `window.onanimationend` is not supported because of that, +// do the same for `transitionend` as Safari is likely to exhibit similar behavior. +// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit +// therefore there is no reason to test anymore for other vendor prefixes: +// http://caniuse.com/#search=transition +if ((window.ontransitionend === undefined) && (window.onwebkittransitionend !== undefined)) { + CSS_PREFIX = '-webkit-'; + TRANSITION_PROP = 'WebkitTransition'; + TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend'; +} else { + TRANSITION_PROP = 'transition'; + TRANSITIONEND_EVENT = 'transitionend'; +} + +if ((window.onanimationend === undefined) && (window.onwebkitanimationend !== undefined)) { + CSS_PREFIX = '-webkit-'; + ANIMATION_PROP = 'WebkitAnimation'; + ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend'; +} else { + ANIMATION_PROP = 'animation'; + ANIMATIONEND_EVENT = 'animationend'; +} + +var DURATION_KEY = 'Duration'; +var PROPERTY_KEY = 'Property'; +var DELAY_KEY = 'Delay'; +var TIMING_KEY = 'TimingFunction'; +var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount'; +var ANIMATION_PLAYSTATE_KEY = 'PlayState'; +var SAFE_FAST_FORWARD_DURATION_VALUE = 9999; + +var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY; +var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY; +var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY; +var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY; + +var ngMinErr = angular.$$minErr('ng'); +function assertArg(arg, name, reason) { + if (!arg) { + throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required')); + } + return arg; +} + +function mergeClasses(a,b) { + if (!a && !b) return ''; + if (!a) return b; + if (!b) return a; + if (isArray(a)) a = a.join(' '); + if (isArray(b)) b = b.join(' '); + return a + ' ' + b; +} + +function packageStyles(options) { + var styles = {}; + if (options && (options.to || options.from)) { + styles.to = options.to; + styles.from = options.from; + } + return styles; +} + +function pendClasses(classes, fix, isPrefix) { + var className = ''; + classes = isArray(classes) + ? classes + : classes && isString(classes) && classes.length + ? classes.split(/\s+/) + : []; + forEach(classes, function(klass, i) { + if (klass && klass.length > 0) { + className += (i > 0) ? ' ' : ''; + className += isPrefix ? fix + klass + : klass + fix; + } + }); + return className; +} + +function removeFromArray(arr, val) { + var index = arr.indexOf(val); + if (val >= 0) { + arr.splice(index, 1); + } +} + +function stripCommentsFromElement(element) { + if (element instanceof jqLite) { + switch (element.length) { + case 0: + return element; + + case 1: + // there is no point of stripping anything if the element + // is the only element within the jqLite wrapper. + // (it's important that we retain the element instance.) + if (element[0].nodeType === ELEMENT_NODE) { + return element; + } + break; + + default: + return jqLite(extractElementNode(element)); + } + } + + if (element.nodeType === ELEMENT_NODE) { + return jqLite(element); + } +} + +function extractElementNode(element) { + if (!element[0]) return element; + for (var i = 0; i < element.length; i++) { + var elm = element[i]; + if (elm.nodeType === ELEMENT_NODE) { + return elm; + } + } +} + +function $$addClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.addClass(elm, className); + }); +} + +function $$removeClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.removeClass(elm, className); + }); +} + +function applyAnimationClassesFactory($$jqLite) { + return function(element, options) { + if (options.addClass) { + $$addClass($$jqLite, element, options.addClass); + options.addClass = null; + } + if (options.removeClass) { + $$removeClass($$jqLite, element, options.removeClass); + options.removeClass = null; + } + }; +} + +function prepareAnimationOptions(options) { + options = options || {}; + if (!options.$$prepared) { + var domOperation = options.domOperation || noop; + options.domOperation = function() { + options.$$domOperationFired = true; + domOperation(); + domOperation = noop; + }; + options.$$prepared = true; + } + return options; +} + +function applyAnimationStyles(element, options) { + applyAnimationFromStyles(element, options); + applyAnimationToStyles(element, options); +} + +function applyAnimationFromStyles(element, options) { + if (options.from) { + element.css(options.from); + options.from = null; + } +} + +function applyAnimationToStyles(element, options) { + if (options.to) { + element.css(options.to); + options.to = null; + } +} + +function mergeAnimationDetails(element, oldAnimation, newAnimation) { + var target = oldAnimation.options || {}; + var newOptions = newAnimation.options || {}; + + var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || ''); + var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || ''); + var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove); + + if (newOptions.preparationClasses) { + target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses); + delete newOptions.preparationClasses; + } + + // noop is basically when there is no callback; otherwise something has been set + var realDomOperation = target.domOperation !== noop ? target.domOperation : null; + + extend(target, newOptions); + + // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this. + if (realDomOperation) { + target.domOperation = realDomOperation; + } + + if (classes.addClass) { + target.addClass = classes.addClass; + } else { + target.addClass = null; + } + + if (classes.removeClass) { + target.removeClass = classes.removeClass; + } else { + target.removeClass = null; + } + + oldAnimation.addClass = target.addClass; + oldAnimation.removeClass = target.removeClass; + + return target; +} + +function resolveElementClasses(existing, toAdd, toRemove) { + var ADD_CLASS = 1; + var REMOVE_CLASS = -1; + + var flags = {}; + existing = splitClassesToLookup(existing); + + toAdd = splitClassesToLookup(toAdd); + forEach(toAdd, function(value, key) { + flags[key] = ADD_CLASS; + }); + + toRemove = splitClassesToLookup(toRemove); + forEach(toRemove, function(value, key) { + flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS; + }); + + var classes = { + addClass: '', + removeClass: '' + }; + + forEach(flags, function(val, klass) { + var prop, allow; + if (val === ADD_CLASS) { + prop = 'addClass'; + allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX]; + } else if (val === REMOVE_CLASS) { + prop = 'removeClass'; + allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX]; + } + if (allow) { + if (classes[prop].length) { + classes[prop] += ' '; + } + classes[prop] += klass; + } + }); + + function splitClassesToLookup(classes) { + if (isString(classes)) { + classes = classes.split(' '); + } + + var obj = {}; + forEach(classes, function(klass) { + // sometimes the split leaves empty string values + // incase extra spaces were applied to the options + if (klass.length) { + obj[klass] = true; + } + }); + return obj; + } + + return classes; +} + +function getDomNode(element) { + return (element instanceof jqLite) ? element[0] : element; +} + +function applyGeneratedPreparationClasses($$jqLite, element, event, options) { + var classes = ''; + if (event) { + classes = pendClasses(event, EVENT_CLASS_PREFIX, true); + } + if (options.addClass) { + classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX)); + } + if (options.removeClass) { + classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX)); + } + if (classes.length) { + options.preparationClasses = classes; + element.addClass(classes); + } +} + +function clearGeneratedClasses(element, options) { + if (options.preparationClasses) { + element.removeClass(options.preparationClasses); + options.preparationClasses = null; + } + if (options.activeClasses) { + element.removeClass(options.activeClasses); + options.activeClasses = null; + } +} + +function blockKeyframeAnimations(node, applyBlock) { + var value = applyBlock ? 'paused' : ''; + var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY; + applyInlineStyle(node, [key, value]); + return [key, value]; +} + +function applyInlineStyle(node, styleTuple) { + var prop = styleTuple[0]; + var value = styleTuple[1]; + node.style[prop] = value; +} + +function concatWithSpace(a,b) { + if (!a) return b; + if (!b) return a; + return a + ' ' + b; +} + +var helpers = { + blockTransitions: function(node, duration) { + // we use a negative delay value since it performs blocking + // yet it doesn't kill any existing transitions running on the + // same element which makes this safe for class-based animations + var value = duration ? '-' + duration + 's' : ''; + applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]); + return [TRANSITION_DELAY_PROP, value]; + } +}; + +var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) { + var queue, cancelFn; + + function scheduler(tasks) { + // we make a copy since RAFScheduler mutates the state + // of the passed in array variable and this would be difficult + // to track down on the outside code + queue = queue.concat(tasks); + nextTick(); + } + + queue = scheduler.queue = []; + + /* waitUntilQuiet does two things: + * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through + * 2. It will delay the next wave of tasks from running until the quiet `fn` has run. + * + * The motivation here is that animation code can request more time from the scheduler + * before the next wave runs. This allows for certain DOM properties such as classes to + * be resolved in time for the next animation to run. + */ + scheduler.waitUntilQuiet = function(fn) { + if (cancelFn) cancelFn(); + + cancelFn = $$rAF(function() { + cancelFn = null; + fn(); + nextTick(); + }); + }; + + return scheduler; + + function nextTick() { + if (!queue.length) return; + + var items = queue.shift(); + for (var i = 0; i < items.length; i++) { + items[i](); + } + + if (!cancelFn) { + $$rAF(function() { + if (!cancelFn) nextTick(); + }); + } + } +}]; + +/** + * @ngdoc directive + * @name ngAnimateChildren + * @restrict AE + * @element ANY + * + * @description + * + * ngAnimateChildren allows you to specify that children of this element should animate even if any + * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move` + * (structural) animation, child elements that also have an active structural animation are not animated. + * + * Note that even if `ngAnimateChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation). + * + * + * @param {string} ngAnimateChildren If the value is empty, `true` or `on`, + * then child animations are allowed. If the value is `false`, child animations are not allowed. + * + * @example + * + +
    + + +
    +
    +
    + List of items: +
    Item {{item}}
    +
    +
    +
    +
    + + + .container.ng-enter, + .container.ng-leave { + transition: all ease 1.5s; + } + + .container.ng-enter, + .container.ng-leave-active { + opacity: 0; + } + + .container.ng-leave, + .container.ng-enter-active { + opacity: 1; + } + + .item { + background: firebrick; + color: #FFF; + margin-bottom: 10px; + } + + .item.ng-enter, + .item.ng-leave { + transition: transform 1.5s ease; + } + + .item.ng-enter { + transform: translateX(50px); + } + + .item.ng-enter-active { + transform: translateX(0); + } + + + angular.module('ngAnimateChildren', ['ngAnimate']) + .controller('MainController', function MainController() { + this.animateChildren = false; + this.enterElement = false; + }); + +
    + */ +var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) { + return { + link: function(scope, element, attrs) { + var val = attrs.ngAnimateChildren; + if (isString(val) && val.length === 0) { //empty attribute + element.data(NG_ANIMATE_CHILDREN_DATA, true); + } else { + // Interpolate and set the value, so that it is available to + // animations that run right after compilation + setData($interpolate(val)(scope)); + attrs.$observe('ngAnimateChildren', setData); + } + + function setData(value) { + value = value === 'on' || value === 'true'; + element.data(NG_ANIMATE_CHILDREN_DATA, value); + } + } + }; +}]; + +/* exported $AnimateCssProvider */ + +var ANIMATE_TIMER_KEY = '$$animateCss'; + +/** + * @ngdoc service + * @name $animateCss + * @kind object + * + * @description + * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes + * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT + * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or + * directives to create more complex animations that can be purely driven using CSS code. + * + * Note that only browsers that support CSS transitions and/or keyframe animations are capable of + * rendering animations triggered via `$animateCss` (bad news for IE9 and lower). + * + * ## General Use + * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that + * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however, + * any automatic control over cancelling animations and/or preventing animations from being run on + * child elements will not be handled by AngularJS. For this to work as expected, please use `$animate` to + * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger + * the CSS animation. + * + * The example below shows how we can create a folding animation on an element using `ng-if`: + * + * ```html + * + *
    + * This element will go BOOM + *
    + * + * ``` + * + * Now we create the **JavaScript animation** that will trigger the CSS transition: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * ## More Advanced Uses + * + * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks + * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code. + * + * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation, + * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with + * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order + * to provide a working animation that will run in CSS. + * + * The example below showcases a more advanced version of the `.fold-animation` from the example above: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * addClass: 'red large-text pulse-twice', + * easing: 'ease-out', + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * Since we're adding/removing CSS classes then the CSS transition will also pick those up: + * + * ```css + * /* since a hardcoded duration value of 1 was provided in the JavaScript animation code, + * the CSS classes below will be transitioned despite them being defined as regular CSS classes */ + * .red { background:red; } + * .large-text { font-size:20px; } + * + * /* we can also use a keyframe animation and $animateCss will make it work alongside the transition */ + * .pulse-twice { + * animation: 0.5s pulse linear 2; + * -webkit-animation: 0.5s pulse linear 2; + * } + * + * @keyframes pulse { + * from { transform: scale(0.5); } + * to { transform: scale(1.5); } + * } + * + * @-webkit-keyframes pulse { + * from { -webkit-transform: scale(0.5); } + * to { -webkit-transform: scale(1.5); } + * } + * ``` + * + * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen. + * + * ## How the Options are handled + * + * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation + * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline + * styles using the `from` and `to` properties. + * + * ```js + * var animator = $animateCss(element, { + * from: { background:'red' }, + * to: { background:'blue' } + * }); + * animator.start(); + * ``` + * + * ```css + * .rotating-animation { + * animation:0.5s rotate linear; + * -webkit-animation:0.5s rotate linear; + * } + * + * @keyframes rotate { + * from { transform: rotate(0deg); } + * to { transform: rotate(360deg); } + * } + * + * @-webkit-keyframes rotate { + * from { -webkit-transform: rotate(0deg); } + * to { -webkit-transform: rotate(360deg); } + * } + * ``` + * + * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is + * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition + * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition + * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied + * and spread across the transition and keyframe animation. + * + * ## What is returned + * + * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually + * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are + * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties: + * + * ```js + * var animator = $animateCss(element, { ... }); + * ``` + * + * Now what do the contents of our `animator` variable look like: + * + * ```js + * { + * // starts the animation + * start: Function, + * + * // ends (aborts) the animation + * end: Function + * } + * ``` + * + * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends. + * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been + * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties + * and that changing them will not reconfigure the parameters of the animation. + * + * ### runner.done() vs runner.then() + * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the + * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**. + * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()` + * unless you really need a digest to kick off afterwards. + * + * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss + * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code). + * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works. + * + * @param {DOMElement} element the element that will be animated + * @param {object} options the animation-related options that will be applied during the animation + * + * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied + * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.) + * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and + * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted. + * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both). + * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`). + * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`). + * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation. + * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. + * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation. + * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation. + * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0` + * is provided then the animation will be skipped entirely. + * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is + * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value + * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same + * CSS delay value. + * * `stagger` - A numeric time value representing the delay between successively animated elements + * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.}) + * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a + * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`) + * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.) + * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once + * the animation is closed. This is useful for when the styles are used purely for the sake of + * the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation). + * By default this value is set to `false`. + * + * @return {object} an object with start and end methods and details about the animation. + * + * * `start` - The method to start the animation. This will return a `Promise` when called. + * * `end` - This method will cancel the animation and remove all applied CSS classes and styles. + */ +var ONE_SECOND = 1000; + +var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; +var CLOSING_TIME_BUFFER = 1.5; + +var DETECT_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + transitionProperty: TRANSITION_PROP + PROPERTY_KEY, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP, + animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY +}; + +var DETECT_STAGGER_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP +}; + +function getCssKeyframeDurationStyle(duration) { + return [ANIMATION_DURATION_PROP, duration + 's']; +} + +function getCssDelayStyle(delay, isKeyframeAnimation) { + var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP; + return [prop, delay + 's']; +} + +function computeCssStyles($window, element, properties) { + var styles = Object.create(null); + var detectedStyles = $window.getComputedStyle(element) || {}; + forEach(properties, function(formalStyleName, actualStyleName) { + var val = detectedStyles[formalStyleName]; + if (val) { + var c = val.charAt(0); + + // only numerical-based values have a negative sign or digit as the first value + if (c === '-' || c === '+' || c >= 0) { + val = parseMaxTime(val); + } + + // by setting this to null in the event that the delay is not set or is set directly as 0 + // then we can still allow for negative values to be used later on and not mistake this + // value for being greater than any other negative value. + if (val === 0) { + val = null; + } + styles[actualStyleName] = val; + } + }); + + return styles; +} + +function parseMaxTime(str) { + var maxValue = 0; + var values = str.split(/\s*,\s*/); + forEach(values, function(value) { + // it's always safe to consider only second values and omit `ms` values since + // getComputedStyle will always handle the conversion for us + if (value.charAt(value.length - 1) === 's') { + value = value.substring(0, value.length - 1); + } + value = parseFloat(value) || 0; + maxValue = maxValue ? Math.max(value, maxValue) : value; + }); + return maxValue; +} + +function truthyTimingValue(val) { + return val === 0 || val != null; +} + +function getCssTransitionDurationStyle(duration, applyOnlyDuration) { + var style = TRANSITION_PROP; + var value = duration + 's'; + if (applyOnlyDuration) { + style += DURATION_KEY; + } else { + value += ' linear all'; + } + return [style, value]; +} + +// we do not reassign an already present style value since +// if we detect the style property value again we may be +// detecting styles that were added via the `from` styles. +// We make use of `isDefined` here since an empty string +// or null value (which is what getPropertyValue will return +// for a non-existing style) will still be marked as a valid +// value for the style (a falsy value implies that the style +// is to be removed at the end of the animation). If we had a simple +// "OR" statement then it would not be enough to catch that. +function registerRestorableStyles(backup, node, properties) { + forEach(properties, function(prop) { + backup[prop] = isDefined(backup[prop]) + ? backup[prop] + : node.style.getPropertyValue(prop); + }); +} + +var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animateProvider) { + + this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout', '$$animateCache', + '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue', + function($window, $$jqLite, $$AnimateRunner, $timeout, $$animateCache, + $$forceReflow, $sniffer, $$rAFScheduler, $$animateQueue) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function computeCachedCssStyles(node, className, cacheKey, allowNoDuration, properties) { + var timings = $$animateCache.get(cacheKey); + + if (!timings) { + timings = computeCssStyles($window, node, properties); + if (timings.animationIterationCount === 'infinite') { + timings.animationIterationCount = 1; + } + } + + // if a css animation has no duration we + // should mark that so that repeated addClass/removeClass calls are skipped + var hasDuration = allowNoDuration || (timings.transitionDuration > 0 || timings.animationDuration > 0); + + // we keep putting this in multiple times even though the value and the cacheKey are the same + // because we're keeping an internal tally of how many duplicate animations are detected. + $$animateCache.put(cacheKey, timings, hasDuration); + + return timings; + } + + function computeCachedCssStaggerStyles(node, className, cacheKey, properties) { + var stagger; + var staggerCacheKey = 'stagger-' + cacheKey; + + // if we have one or more existing matches of matching elements + // containing the same parent + CSS styles (which is how cacheKey works) + // then staggering is possible + if ($$animateCache.count(cacheKey) > 0) { + stagger = $$animateCache.get(staggerCacheKey); + + if (!stagger) { + var staggerClassName = pendClasses(className, '-stagger'); + + $$jqLite.addClass(node, staggerClassName); + + stagger = computeCssStyles($window, node, properties); + + // force the conversion of a null value to zero incase not set + stagger.animationDuration = Math.max(stagger.animationDuration, 0); + stagger.transitionDuration = Math.max(stagger.transitionDuration, 0); + + $$jqLite.removeClass(node, staggerClassName); + + $$animateCache.put(staggerCacheKey, stagger, true); + } + } + + return stagger || {}; + } + + var rafWaitQueue = []; + function waitUntilQuiet(callback) { + rafWaitQueue.push(callback); + $$rAFScheduler.waitUntilQuiet(function() { + $$animateCache.flush(); + + // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. + // PLEASE EXAMINE THE `$$forceReflow` service to understand why. + var pageWidth = $$forceReflow(); + + // we use a for loop to ensure that if the queue is changed + // during this looping then it will consider new requests + for (var i = 0; i < rafWaitQueue.length; i++) { + rafWaitQueue[i](pageWidth); + } + rafWaitQueue.length = 0; + }); + } + + function computeTimings(node, className, cacheKey, allowNoDuration) { + var timings = computeCachedCssStyles(node, className, cacheKey, allowNoDuration, DETECT_CSS_PROPERTIES); + var aD = timings.animationDelay; + var tD = timings.transitionDelay; + timings.maxDelay = aD && tD + ? Math.max(aD, tD) + : (aD || tD); + timings.maxDuration = Math.max( + timings.animationDuration * timings.animationIterationCount, + timings.transitionDuration); + + return timings; + } + + return function init(element, initialOptions) { + // all of the animation functions should create + // a copy of the options data, however, if a + // parent service has already created a copy then + // we should stick to using that + var options = initialOptions || {}; + if (!options.$$prepared) { + options = prepareAnimationOptions(copy(options)); + } + + var restoreStyles = {}; + var node = getDomNode(element); + if (!node + || !node.parentNode + || !$$animateQueue.enabled()) { + return closeAndReturnNoopAnimator(); + } + + var temporaryStyles = []; + var classes = element.attr('class'); + var styles = packageStyles(options); + var animationClosed; + var animationPaused; + var animationCompleted; + var runner; + var runnerHost; + var maxDelay; + var maxDelayTime; + var maxDuration; + var maxDurationTime; + var startTime; + var events = []; + + if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) { + return closeAndReturnNoopAnimator(); + } + + var method = options.event && isArray(options.event) + ? options.event.join(' ') + : options.event; + + var isStructural = method && options.structural; + var structuralClassName = ''; + var addRemoveClassName = ''; + + if (isStructural) { + structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true); + } else if (method) { + structuralClassName = method; + } + + if (options.addClass) { + addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX); + } + + if (options.removeClass) { + if (addRemoveClassName.length) { + addRemoveClassName += ' '; + } + addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX); + } + + // there may be a situation where a structural animation is combined together + // with CSS classes that need to resolve before the animation is computed. + // However this means that there is no explicit CSS code to block the animation + // from happening (by setting 0s none in the class name). If this is the case + // we need to apply the classes before the first rAF so we know to continue if + // there actually is a detected transition or keyframe animation + if (options.applyClassesEarly && addRemoveClassName.length) { + applyAnimationClasses(element, options); + } + + var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim(); + var fullClassName = classes + ' ' + preparationClasses; + var hasToStyles = styles.to && Object.keys(styles.to).length > 0; + var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0; + + // there is no way we can trigger an animation if no styles and + // no classes are being applied which would then trigger a transition, + // unless there a is raw keyframe value that is applied to the element. + if (!containsKeyframeAnimation + && !hasToStyles + && !preparationClasses) { + return closeAndReturnNoopAnimator(); + } + + var stagger, cacheKey = $$animateCache.cacheKey(node, method, options.addClass, options.removeClass); + if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { + preparationClasses = null; + return closeAndReturnNoopAnimator(); + } + + if (options.stagger > 0) { + var staggerVal = parseFloat(options.stagger); + stagger = { + transitionDelay: staggerVal, + animationDelay: staggerVal, + transitionDuration: 0, + animationDuration: 0 + }; + } else { + stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES); + } + + if (!options.$$skipPreparationClasses) { + $$jqLite.addClass(element, preparationClasses); + } + + var applyOnlyDuration; + + if (options.transitionStyle) { + var transitionStyle = [TRANSITION_PROP, options.transitionStyle]; + applyInlineStyle(node, transitionStyle); + temporaryStyles.push(transitionStyle); + } + + if (options.duration >= 0) { + applyOnlyDuration = node.style[TRANSITION_PROP].length > 0; + var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration); + + // we set the duration so that it will be picked up by getComputedStyle later + applyInlineStyle(node, durationStyle); + temporaryStyles.push(durationStyle); + } + + if (options.keyframeStyle) { + var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle]; + applyInlineStyle(node, keyframeStyle); + temporaryStyles.push(keyframeStyle); + } + + var itemIndex = stagger + ? options.staggerIndex >= 0 + ? options.staggerIndex + : $$animateCache.count(cacheKey) + : 0; + + var isFirst = itemIndex === 0; + + // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY + // without causing any combination of transitions to kick in. By adding a negative delay value + // it forces the setup class' transition to end immediately. We later then remove the negative + // transition delay to allow for the transition to naturally do it's thing. The beauty here is + // that if there is no transition defined then nothing will happen and this will also allow + // other transitions to be stacked on top of each other without any chopping them out. + if (isFirst && !options.skipBlocking) { + helpers.blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE); + } + + var timings = computeTimings(node, fullClassName, cacheKey, !isStructural); + var relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + var flags = {}; + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + flags.hasTransitionAll = flags.hasTransitions && timings.transitionProperty === 'all'; + flags.applyTransitionDuration = hasToStyles && ( + (flags.hasTransitions && !flags.hasTransitionAll) + || (flags.hasAnimations && !flags.hasTransitions)); + flags.applyAnimationDuration = options.duration && flags.hasAnimations; + flags.applyTransitionDelay = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions); + flags.applyAnimationDelay = truthyTimingValue(options.delay) && flags.hasAnimations; + flags.recalculateTimingStyles = addRemoveClassName.length > 0; + + if (flags.applyTransitionDuration || flags.applyAnimationDuration) { + maxDuration = options.duration ? parseFloat(options.duration) : maxDuration; + + if (flags.applyTransitionDuration) { + flags.hasTransitions = true; + timings.transitionDuration = maxDuration; + applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0; + temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration)); + } + + if (flags.applyAnimationDuration) { + flags.hasAnimations = true; + timings.animationDuration = maxDuration; + temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration)); + } + } + + if (maxDuration === 0 && !flags.recalculateTimingStyles) { + return closeAndReturnNoopAnimator(); + } + + var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX); + + if (options.delay != null) { + var delayStyle; + if (typeof options.delay !== 'boolean') { + delayStyle = parseFloat(options.delay); + // number in options.delay means we have to recalculate the delay for the closing timeout + maxDelay = Math.max(delayStyle, 0); + } + + if (flags.applyTransitionDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle)); + } + + if (flags.applyAnimationDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle, true)); + } + } + + // we need to recalculate the delay value since we used a pre-emptive negative + // delay value and the delay value is required for the final event checking. This + // property will ensure that this will happen after the RAF phase has passed. + if (options.duration == null && timings.transitionDuration > 0) { + flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + if (!options.skipBlocking) { + flags.blockTransition = timings.transitionDuration > 0; + flags.blockKeyframeAnimation = timings.animationDuration > 0 && + stagger.animationDelay > 0 && + stagger.animationDuration === 0; + } + + if (options.from) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.from)); + } + applyAnimationFromStyles(element, options); + } + + if (flags.blockTransition || flags.blockKeyframeAnimation) { + applyBlocking(maxDuration); + } else if (!options.skipBlocking) { + helpers.blockTransitions(node, false); + } + + // TODO(matsko): for 1.5 change this code to have an animator object for better debugging + return { + $$willAnimate: true, + end: endFn, + start: function() { + if (animationClosed) return; + + runnerHost = { + end: endFn, + cancel: cancelFn, + resume: null, //this will be set during the start() phase + pause: null + }; + + runner = new $$AnimateRunner(runnerHost); + + waitUntilQuiet(start); + + // we don't have access to pause/resume the animation + // since it hasn't run yet. AnimateRunner will therefore + // set noop functions for resume and pause and they will + // later be overridden once the animation is triggered + return runner; + } + }; + + function endFn() { + close(); + } + + function cancelFn() { + close(true); + } + + function close(rejected) { + // if the promise has been called already then we shouldn't close + // the animation again + if (animationClosed || (animationCompleted && animationPaused)) return; + animationClosed = true; + animationPaused = false; + + if (preparationClasses && !options.$$skipPreparationClasses) { + $$jqLite.removeClass(element, preparationClasses); + } + + if (activeClasses) { + $$jqLite.removeClass(element, activeClasses); + } + + blockKeyframeAnimations(node, false); + helpers.blockTransitions(node, false); + + forEach(temporaryStyles, function(entry) { + // There is only one way to remove inline style properties entirely from elements. + // By using `removeProperty` this works, but we need to convert camel-cased CSS + // styles down to hyphenated values. + node.style[entry[0]] = ''; + }); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + + if (Object.keys(restoreStyles).length) { + forEach(restoreStyles, function(value, prop) { + if (value) { + node.style.setProperty(prop, value); + } else { + node.style.removeProperty(prop); + } + }); + } + + // the reason why we have this option is to allow a synchronous closing callback + // that is fired as SOON as the animation ends (when the CSS is removed) or if + // the animation never takes off at all. A good example is a leave animation since + // the element must be removed just after the animation is over or else the element + // will appear on screen for one animation frame causing an overbearing flicker. + if (options.onDone) { + options.onDone(); + } + + if (events && events.length) { + // Remove the transitionend / animationend listener(s) + element.off(events.join(' '), onAnimationProgress); + } + + //Cancel the fallback closing timeout and remove the timer data + var animationTimerData = element.data(ANIMATE_TIMER_KEY); + if (animationTimerData) { + $timeout.cancel(animationTimerData[0].timer); + element.removeData(ANIMATE_TIMER_KEY); + } + + // if the preparation function fails then the promise is not setup + if (runner) { + runner.complete(!rejected); + } + } + + function applyBlocking(duration) { + if (flags.blockTransition) { + helpers.blockTransitions(node, duration); + } + + if (flags.blockKeyframeAnimation) { + blockKeyframeAnimations(node, !!duration); + } + } + + function closeAndReturnNoopAnimator() { + runner = new $$AnimateRunner({ + end: endFn, + cancel: cancelFn + }); + + // should flush the cache animation + waitUntilQuiet(noop); + close(); + + return { + $$willAnimate: false, + start: function() { + return runner; + }, + end: endFn + }; + } + + function onAnimationProgress(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + + if (ev.target !== node) { + // Since TransitionEvent / AnimationEvent bubble up, + // we have to ignore events by finished child animations + return; + } + + // we now always use `Date.now()` due to the recent changes with + // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info) + var timeStamp = ev.$manualTimeStamp || Date.now(); + + /* Firefox (or possibly just Gecko) likes to not round values up + * when a ms measurement is used for the animation */ + var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); + + /* $manualTimeStamp is a mocked timeStamp value which is set + * within browserTrigger(). This is only here so that tests can + * mock animations properly. Real events fallback to event.timeStamp, + * or, if they don't, then a timeStamp is automatically created for them. + * We're checking to see if the timeStamp surpasses the expected delay, + * but we're using elapsedTime instead of the timeStamp on the 2nd + * pre-condition since animationPauseds sometimes close off early */ + if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { + // we set this flag to ensure that if the transition is paused then, when resumed, + // the animation will automatically close itself since transitions cannot be paused. + animationCompleted = true; + close(); + } + } + + function start() { + if (animationClosed) return; + if (!node.parentNode) { + close(); + return; + } + + // even though we only pause keyframe animations here the pause flag + // will still happen when transitions are used. Only the transition will + // not be paused since that is not possible. If the animation ends when + // paused then it will not complete until unpaused or cancelled. + var playPause = function(playAnimation) { + if (!animationCompleted) { + animationPaused = !playAnimation; + if (timings.animationDuration) { + var value = blockKeyframeAnimations(node, animationPaused); + if (animationPaused) { + temporaryStyles.push(value); + } else { + removeFromArray(temporaryStyles, value); + } + } + } else if (animationPaused && playAnimation) { + animationPaused = false; + close(); + } + }; + + // checking the stagger duration prevents an accidentally cascade of the CSS delay style + // being inherited from the parent. If the transition duration is zero then we can safely + // rely that the delay value is an intentional stagger delay style. + var maxStagger = itemIndex > 0 + && ((timings.transitionDuration && stagger.transitionDuration === 0) || + (timings.animationDuration && stagger.animationDuration === 0)) + && Math.max(stagger.animationDelay, stagger.transitionDelay); + if (maxStagger) { + $timeout(triggerAnimationStart, + Math.floor(maxStagger * itemIndex * ONE_SECOND), + false); + } else { + triggerAnimationStart(); + } + + // this will decorate the existing promise runner with pause/resume methods + runnerHost.resume = function() { + playPause(true); + }; + + runnerHost.pause = function() { + playPause(false); + }; + + function triggerAnimationStart() { + // just incase a stagger animation kicks in when the animation + // itself was cancelled entirely + if (animationClosed) return; + + applyBlocking(false); + + forEach(temporaryStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[key] = value; + }); + + applyAnimationClasses(element, options); + $$jqLite.addClass(element, activeClasses); + + if (flags.recalculateTimingStyles) { + fullClassName = node.getAttribute('class') + ' ' + preparationClasses; + cacheKey = $$animateCache.cacheKey(node, method, options.addClass, options.removeClass); + + timings = computeTimings(node, fullClassName, cacheKey, false); + relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + if (maxDuration === 0) { + close(); + return; + } + + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + } + + if (flags.applyAnimationDelay) { + relativeDelay = typeof options.delay !== 'boolean' && truthyTimingValue(options.delay) + ? parseFloat(options.delay) + : relativeDelay; + + maxDelay = Math.max(relativeDelay, 0); + timings.animationDelay = relativeDelay; + delayStyle = getCssDelayStyle(relativeDelay, true); + temporaryStyles.push(delayStyle); + node.style[delayStyle[0]] = delayStyle[1]; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + + if (options.easing) { + var easeProp, easeVal = options.easing; + if (flags.hasTransitions) { + easeProp = TRANSITION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + if (flags.hasAnimations) { + easeProp = ANIMATION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + } + + if (timings.transitionDuration) { + events.push(TRANSITIONEND_EVENT); + } + + if (timings.animationDuration) { + events.push(ANIMATIONEND_EVENT); + } + + startTime = Date.now(); + var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime; + var endTime = startTime + timerTime; + + var animationsData = element.data(ANIMATE_TIMER_KEY) || []; + var setupFallbackTimer = true; + if (animationsData.length) { + var currentTimerData = animationsData[0]; + setupFallbackTimer = endTime > currentTimerData.expectedEndTime; + if (setupFallbackTimer) { + $timeout.cancel(currentTimerData.timer); + } else { + animationsData.push(close); + } + } + + if (setupFallbackTimer) { + var timer = $timeout(onAnimationExpired, timerTime, false); + animationsData[0] = { + timer: timer, + expectedEndTime: endTime + }; + animationsData.push(close); + element.data(ANIMATE_TIMER_KEY, animationsData); + } + + if (events.length) { + element.on(events.join(' '), onAnimationProgress); + } + + if (options.to) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.to)); + } + applyAnimationToStyles(element, options); + } + } + + function onAnimationExpired() { + var animationsData = element.data(ANIMATE_TIMER_KEY); + + // this will be false in the event that the element was + // removed from the DOM (via a leave animation or something + // similar) + if (animationsData) { + for (var i = 1; i < animationsData.length; i++) { + animationsData[i](); + } + element.removeData(ANIMATE_TIMER_KEY); + } + } + } + }; + }]; +}]; + +var $$AnimateCssDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) { + $$animationProvider.drivers.push('$$animateCssDriver'); + + var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim'; + var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor'; + + var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out'; + var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in'; + + function isDocumentFragment(node) { + return node.parentNode && node.parentNode.nodeType === 11; + } + + this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document', + function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $sniffer, $$jqLite, $document) { + + // only browsers that support these properties can render animations + if (!$sniffer.animations && !$sniffer.transitions) return noop; + + var bodyNode = $document[0].body; + var rootNode = getDomNode($rootElement); + + var rootBodyElement = jqLite( + // this is to avoid using something that exists outside of the body + // we also special case the doc fragment case because our unit test code + // appends the $rootElement to the body after the app has been bootstrapped + isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode + ); + + return function initDriverFn(animationDetails) { + return animationDetails.from && animationDetails.to + ? prepareFromToAnchorAnimation(animationDetails.from, + animationDetails.to, + animationDetails.classes, + animationDetails.anchors) + : prepareRegularAnimation(animationDetails); + }; + + function filterCssClasses(classes) { + //remove all the `ng-` stuff + return classes.replace(/\bng-\S+\b/g, ''); + } + + function getUniqueValues(a, b) { + if (isString(a)) a = a.split(' '); + if (isString(b)) b = b.split(' '); + return a.filter(function(val) { + return b.indexOf(val) === -1; + }).join(' '); + } + + function prepareAnchoredAnimation(classes, outAnchor, inAnchor) { + var clone = jqLite(getDomNode(outAnchor).cloneNode(true)); + var startingClasses = filterCssClasses(getClassVal(clone)); + + outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + + clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME); + + rootBodyElement.append(clone); + + var animatorIn, animatorOut = prepareOutAnimation(); + + // the user may not end up using the `out` animation and + // only making use of the `in` animation or vice-versa. + // In either case we should allow this and not assume the + // animation is over unless both animations are not used. + if (!animatorOut) { + animatorIn = prepareInAnimation(); + if (!animatorIn) { + return end(); + } + } + + var startingAnimator = animatorOut || animatorIn; + + return { + start: function() { + var runner; + + var currentAnimation = startingAnimator.start(); + currentAnimation.done(function() { + currentAnimation = null; + if (!animatorIn) { + animatorIn = prepareInAnimation(); + if (animatorIn) { + currentAnimation = animatorIn.start(); + currentAnimation.done(function() { + currentAnimation = null; + end(); + runner.complete(); + }); + return currentAnimation; + } + } + // in the event that there is no `in` animation + end(); + runner.complete(); + }); + + runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn + }); + + return runner; + + function endFn() { + if (currentAnimation) { + currentAnimation.end(); + } + } + } + }; + + function calculateAnchorStyles(anchor) { + var styles = {}; + + var coords = getDomNode(anchor).getBoundingClientRect(); + + // we iterate directly since safari messes up and doesn't return + // all the keys for the coords object when iterated + forEach(['width','height','top','left'], function(key) { + var value = coords[key]; + switch (key) { + case 'top': + value += bodyNode.scrollTop; + break; + case 'left': + value += bodyNode.scrollLeft; + break; + } + styles[key] = Math.floor(value) + 'px'; + }); + return styles; + } + + function prepareOutAnimation() { + var animator = $animateCss(clone, { + addClass: NG_OUT_ANCHOR_CLASS_NAME, + delay: true, + from: calculateAnchorStyles(outAnchor) + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function getClassVal(element) { + return element.attr('class') || ''; + } + + function prepareInAnimation() { + var endingClasses = filterCssClasses(getClassVal(inAnchor)); + var toAdd = getUniqueValues(endingClasses, startingClasses); + var toRemove = getUniqueValues(startingClasses, endingClasses); + + var animator = $animateCss(clone, { + to: calculateAnchorStyles(inAnchor), + addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd, + removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove, + delay: true + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function end() { + clone.remove(); + outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + } + } + + function prepareFromToAnchorAnimation(from, to, classes, anchors) { + var fromAnimation = prepareRegularAnimation(from, noop); + var toAnimation = prepareRegularAnimation(to, noop); + + var anchorAnimations = []; + forEach(anchors, function(anchor) { + var outElement = anchor['out']; + var inElement = anchor['in']; + var animator = prepareAnchoredAnimation(classes, outElement, inElement); + if (animator) { + anchorAnimations.push(animator); + } + }); + + // no point in doing anything when there are no elements to animate + if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + forEach(anchorAnimations, function(animation) { + animationRunners.push(animation.start()); + }); + + var runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn // CSS-driven animations cannot be cancelled, only ended + }); + + $$AnimateRunner.all(animationRunners, function(status) { + runner.complete(status); + }); + + return runner; + + function endFn() { + forEach(animationRunners, function(runner) { + runner.end(); + }); + } + } + }; + } + + function prepareRegularAnimation(animationDetails) { + var element = animationDetails.element; + var options = animationDetails.options || {}; + + if (animationDetails.structural) { + options.event = animationDetails.event; + options.structural = true; + options.applyClassesEarly = true; + + // we special case the leave animation since we want to ensure that + // the element is removed as soon as the animation is over. Otherwise + // a flicker might appear or the element may not be removed at all + if (animationDetails.event === 'leave') { + options.onDone = options.domOperation; + } + } + + // We assign the preparationClasses as the actual animation event since + // the internals of $animateCss will just suffix the event token values + // with `-active` to trigger the animation. + if (options.preparationClasses) { + options.event = concatWithSpace(options.event, options.preparationClasses); + } + + var animator = $animateCss(element, options); + + // the driver lookup code inside of $$animation attempts to spawn a + // driver one by one until a driver returns a.$$willAnimate animator object. + // $animateCss will always return an object, however, it will pass in + // a flag as a hint as to whether an animation was detected or not + return animator.$$willAnimate ? animator : null; + } + }]; +}]; + +// TODO(matsko): use caching here to speed things up for detection +// TODO(matsko): add documentation +// by the time... + +var $$AnimateJsProvider = ['$animateProvider', /** @this */ function($animateProvider) { + this.$get = ['$injector', '$$AnimateRunner', '$$jqLite', + function($injector, $$AnimateRunner, $$jqLite) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + // $animateJs(element, 'enter'); + return function(element, event, classes, options) { + var animationClosed = false; + + // the `classes` argument is optional and if it is not used + // then the classes will be resolved from the element's className + // property as well as options.addClass/options.removeClass. + if (arguments.length === 3 && isObject(classes)) { + options = classes; + classes = null; + } + + options = prepareAnimationOptions(options); + if (!classes) { + classes = element.attr('class') || ''; + if (options.addClass) { + classes += ' ' + options.addClass; + } + if (options.removeClass) { + classes += ' ' + options.removeClass; + } + } + + var classesToAdd = options.addClass; + var classesToRemove = options.removeClass; + + // the lookupAnimations function returns a series of animation objects that are + // matched up with one or more of the CSS classes. These animation objects are + // defined via the module.animation factory function. If nothing is detected then + // we don't return anything which then makes $animation query the next driver. + var animations = lookupAnimations(classes); + var before, after; + if (animations.length) { + var afterFn, beforeFn; + if (event === 'leave') { + beforeFn = 'leave'; + afterFn = 'afterLeave'; // TODO(matsko): get rid of this + } else { + beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1); + afterFn = event; + } + + if (event !== 'enter' && event !== 'move') { + before = packageAnimations(element, event, options, animations, beforeFn); + } + after = packageAnimations(element, event, options, animations, afterFn); + } + + // no matching animations + if (!before && !after) return; + + function applyOptions() { + options.domOperation(); + applyAnimationClasses(element, options); + } + + function close() { + animationClosed = true; + applyOptions(); + applyAnimationStyles(element, options); + } + + var runner; + + return { + $$willAnimate: true, + end: function() { + if (runner) { + runner.end(); + } else { + close(); + runner = new $$AnimateRunner(); + runner.complete(true); + } + return runner; + }, + start: function() { + if (runner) { + return runner; + } + + runner = new $$AnimateRunner(); + var closeActiveAnimations; + var chain = []; + + if (before) { + chain.push(function(fn) { + closeActiveAnimations = before(fn); + }); + } + + if (chain.length) { + chain.push(function(fn) { + applyOptions(); + fn(true); + }); + } else { + applyOptions(); + } + + if (after) { + chain.push(function(fn) { + closeActiveAnimations = after(fn); + }); + } + + runner.setHost({ + end: function() { + endAnimations(); + }, + cancel: function() { + endAnimations(true); + } + }); + + $$AnimateRunner.chain(chain, onComplete); + return runner; + + function onComplete(success) { + close(success); + runner.complete(success); + } + + function endAnimations(cancelled) { + if (!animationClosed) { + (closeActiveAnimations || noop)(cancelled); + onComplete(cancelled); + } + } + } + }; + + function executeAnimationFn(fn, element, event, options, onDone) { + var args; + switch (event) { + case 'animate': + args = [element, options.from, options.to, onDone]; + break; + + case 'setClass': + args = [element, classesToAdd, classesToRemove, onDone]; + break; + + case 'addClass': + args = [element, classesToAdd, onDone]; + break; + + case 'removeClass': + args = [element, classesToRemove, onDone]; + break; + + default: + args = [element, onDone]; + break; + } + + args.push(options); + + var value = fn.apply(fn, args); + if (value) { + if (isFunction(value.start)) { + value = value.start(); + } + + if (value instanceof $$AnimateRunner) { + value.done(onDone); + } else if (isFunction(value)) { + // optional onEnd / onCancel callback + return value; + } + } + + return noop; + } + + function groupEventedAnimations(element, event, options, animations, fnName) { + var operations = []; + forEach(animations, function(ani) { + var animation = ani[fnName]; + if (!animation) return; + + // note that all of these animations will run in parallel + operations.push(function() { + var runner; + var endProgressCb; + + var resolved = false; + var onAnimationComplete = function(rejected) { + if (!resolved) { + resolved = true; + (endProgressCb || noop)(rejected); + runner.complete(!rejected); + } + }; + + runner = new $$AnimateRunner({ + end: function() { + onAnimationComplete(); + }, + cancel: function() { + onAnimationComplete(true); + } + }); + + endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { + var cancelled = result === false; + onAnimationComplete(cancelled); + }); + + return runner; + }); + }); + + return operations; + } + + function packageAnimations(element, event, options, animations, fnName) { + var operations = groupEventedAnimations(element, event, options, animations, fnName); + if (operations.length === 0) { + var a, b; + if (fnName === 'beforeSetClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass'); + } else if (fnName === 'setClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass'); + } + + if (a) { + operations = operations.concat(a); + } + if (b) { + operations = operations.concat(b); + } + } + + if (operations.length === 0) return; + + // TODO(matsko): add documentation + return function startAnimation(callback) { + var runners = []; + if (operations.length) { + forEach(operations, function(animateFn) { + runners.push(animateFn()); + }); + } + + if (runners.length) { + $$AnimateRunner.all(runners, callback); + } else { + callback(); + } + + return function endFn(reject) { + forEach(runners, function(runner) { + if (reject) { + runner.cancel(); + } else { + runner.end(); + } + }); + }; + }; + } + }; + + function lookupAnimations(classes) { + classes = isArray(classes) ? classes : classes.split(' '); + var matches = [], flagMap = {}; + for (var i = 0; i < classes.length; i++) { + var klass = classes[i], + animationFactory = $animateProvider.$$registeredAnimations[klass]; + if (animationFactory && !flagMap[klass]) { + matches.push($injector.get(animationFactory)); + flagMap[klass] = true; + } + } + return matches; + } + }]; +}]; + +var $$AnimateJsDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) { + $$animationProvider.drivers.push('$$animateJsDriver'); + this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) { + return function initDriverFn(animationDetails) { + if (animationDetails.from && animationDetails.to) { + var fromAnimation = prepareAnimation(animationDetails.from); + var toAnimation = prepareAnimation(animationDetails.to); + if (!fromAnimation && !toAnimation) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + $$AnimateRunner.all(animationRunners, done); + + var runner = new $$AnimateRunner({ + end: endFnFactory(), + cancel: endFnFactory() + }); + + return runner; + + function endFnFactory() { + return function() { + forEach(animationRunners, function(runner) { + // at this point we cannot cancel animations for groups just yet. 1.5+ + runner.end(); + }); + }; + } + + function done(status) { + runner.complete(status); + } + } + }; + } else { + return prepareAnimation(animationDetails); + } + }; + + function prepareAnimation(animationDetails) { + // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations + var element = animationDetails.element; + var event = animationDetails.event; + var options = animationDetails.options; + var classes = animationDetails.classes; + return $$animateJs(element, event, classes, options); + } + }]; +}]; + +var NG_ANIMATE_ATTR_NAME = 'data-ng-animate'; +var NG_ANIMATE_PIN_DATA = '$ngAnimatePin'; +var $$AnimateQueueProvider = ['$animateProvider', /** @this */ function($animateProvider) { + var PRE_DIGEST_STATE = 1; + var RUNNING_STATE = 2; + var ONE_SPACE = ' '; + + var rules = this.rules = { + skip: [], + cancel: [], + join: [] + }; + + function getEventData(options) { + return { + addClass: options.addClass, + removeClass: options.removeClass, + from: options.from, + to: options.to + }; + } + + function makeTruthyCssClassMap(classString) { + if (!classString) { + return null; + } + + var keys = classString.split(ONE_SPACE); + var map = Object.create(null); + + forEach(keys, function(key) { + map[key] = true; + }); + return map; + } + + function hasMatchingClasses(newClassString, currentClassString) { + if (newClassString && currentClassString) { + var currentClassMap = makeTruthyCssClassMap(currentClassString); + return newClassString.split(ONE_SPACE).some(function(className) { + return currentClassMap[className]; + }); + } + } + + function isAllowed(ruleType, currentAnimation, previousAnimation) { + return rules[ruleType].some(function(fn) { + return fn(currentAnimation, previousAnimation); + }); + } + + function hasAnimationClasses(animation, and) { + var a = (animation.addClass || '').length > 0; + var b = (animation.removeClass || '').length > 0; + return and ? a && b : a || b; + } + + rules.join.push(function(newAnimation, currentAnimation) { + // if the new animation is class-based then we can just tack that on + return !newAnimation.structural && hasAnimationClasses(newAnimation); + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // there is no need to animate anything if no classes are being added and + // there is no structural animation that will be triggered + return !newAnimation.structural && !hasAnimationClasses(newAnimation); + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // why should we trigger a new structural animation if the element will + // be removed from the DOM anyway? + return currentAnimation.event === 'leave' && newAnimation.structural; + }); + + rules.skip.push(function(newAnimation, currentAnimation) { + // if there is an ongoing current animation then don't even bother running the class-based animation + return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // there can never be two structural animations running at the same time + return currentAnimation.structural && newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // if the previous animation is already running, but the new animation will + // be triggered, but the new animation is structural + return currentAnimation.state === RUNNING_STATE && newAnimation.structural; + }); + + rules.cancel.push(function(newAnimation, currentAnimation) { + // cancel the animation if classes added / removed in both animation cancel each other out, + // but only if the current animation isn't structural + + if (currentAnimation.structural) return false; + + var nA = newAnimation.addClass; + var nR = newAnimation.removeClass; + var cA = currentAnimation.addClass; + var cR = currentAnimation.removeClass; + + // early detection to save the global CPU shortage :) + if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) { + return false; + } + + return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA); + }); + + this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$Map', + '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow', + '$$isDocumentHidden', + function($$rAF, $rootScope, $rootElement, $document, $$Map, + $$animation, $$AnimateRunner, $templateRequest, $$jqLite, $$forceReflow, + $$isDocumentHidden) { + + var activeAnimationsLookup = new $$Map(); + var disabledElementsLookup = new $$Map(); + var animationsEnabled = null; + + function removeFromDisabledElementsLookup(evt) { + disabledElementsLookup.delete(evt.target); + } + + function postDigestTaskFactory() { + var postDigestCalled = false; + return function(fn) { + // we only issue a call to postDigest before + // it has first passed. This prevents any callbacks + // from not firing once the animation has completed + // since it will be out of the digest cycle. + if (postDigestCalled) { + fn(); + } else { + $rootScope.$$postDigest(function() { + postDigestCalled = true; + fn(); + }); + } + }; + } + + // Wait until all directive and route-related templates are downloaded and + // compiled. The $templateRequest.totalPendingRequests variable keeps track of + // all of the remote templates being currently downloaded. If there are no + // templates currently downloading then the watcher will still fire anyway. + var deregisterWatch = $rootScope.$watch( + function() { return $templateRequest.totalPendingRequests === 0; }, + function(isEmpty) { + if (!isEmpty) return; + deregisterWatch(); + + // Now that all templates have been downloaded, $animate will wait until + // the post digest queue is empty before enabling animations. By having two + // calls to $postDigest calls we can ensure that the flag is enabled at the + // very end of the post digest queue. Since all of the animations in $animate + // use $postDigest, it's important that the code below executes at the end. + // This basically means that the page is fully downloaded and compiled before + // any animations are triggered. + $rootScope.$$postDigest(function() { + $rootScope.$$postDigest(function() { + // we check for null directly in the event that the application already called + // .enabled() with whatever arguments that it provided it with + if (animationsEnabled === null) { + animationsEnabled = true; + } + }); + }); + } + ); + + var callbackRegistry = Object.create(null); + + // remember that the `customFilter`/`classNameFilter` are set during the + // provider/config stage therefore we can optimize here and setup helper functions + var customFilter = $animateProvider.customFilter(); + var classNameFilter = $animateProvider.classNameFilter(); + var returnTrue = function() { return true; }; + + var isAnimatableByFilter = customFilter || returnTrue; + var isAnimatableClassName = !classNameFilter ? returnTrue : function(node, options) { + var className = [node.getAttribute('class'), options.addClass, options.removeClass].join(' '); + return classNameFilter.test(className); + }; + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function normalizeAnimationDetails(element, animation) { + return mergeAnimationDetails(element, animation, {}); + } + + // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. + var contains = window.Node.prototype.contains || /** @this */ function(arg) { + // eslint-disable-next-line no-bitwise + return this === arg || !!(this.compareDocumentPosition(arg) & 16); + }; + + function findCallbacks(targetParentNode, targetNode, event) { + var matches = []; + var entries = callbackRegistry[event]; + if (entries) { + forEach(entries, function(entry) { + if (contains.call(entry.node, targetNode)) { + matches.push(entry.callback); + } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) { + matches.push(entry.callback); + } + }); + } + + return matches; + } + + function filterFromRegistry(list, matchContainer, matchCallback) { + var containerNode = extractElementNode(matchContainer); + return list.filter(function(entry) { + var isMatch = entry.node === containerNode && + (!matchCallback || entry.callback === matchCallback); + return !isMatch; + }); + } + + function cleanupEventListeners(phase, node) { + if (phase === 'close' && !node.parentNode) { + // If the element is not attached to a parentNode, it has been removed by + // the domOperation, and we can safely remove the event callbacks + $animate.off(node); + } + } + + var $animate = { + on: function(event, container, callback) { + var node = extractElementNode(container); + callbackRegistry[event] = callbackRegistry[event] || []; + callbackRegistry[event].push({ + node: node, + callback: callback + }); + + // Remove the callback when the element is removed from the DOM + jqLite(container).on('$destroy', function() { + var animationDetails = activeAnimationsLookup.get(node); + + if (!animationDetails) { + // If there's an animation ongoing, the callback calling code will remove + // the event listeners. If we'd remove here, the callbacks would be removed + // before the animation ends + $animate.off(event, container, callback); + } + }); + }, + + off: function(event, container, callback) { + if (arguments.length === 1 && !isString(arguments[0])) { + container = arguments[0]; + for (var eventType in callbackRegistry) { + callbackRegistry[eventType] = filterFromRegistry(callbackRegistry[eventType], container); + } + + return; + } + + var entries = callbackRegistry[event]; + if (!entries) return; + + callbackRegistry[event] = arguments.length === 1 + ? null + : filterFromRegistry(entries, container, callback); + }, + + pin: function(element, parentElement) { + assertArg(isElement(element), 'element', 'not an element'); + assertArg(isElement(parentElement), 'parentElement', 'not an element'); + element.data(NG_ANIMATE_PIN_DATA, parentElement); + }, + + push: function(element, event, options, domOperation) { + options = options || {}; + options.domOperation = domOperation; + return queueAnimation(element, event, options); + }, + + // this method has four signatures: + // () - global getter + // (bool) - global setter + // (element) - element getter + // (element, bool) - element setter + enabled: function(element, bool) { + var argCount = arguments.length; + + if (argCount === 0) { + // () - Global getter + bool = !!animationsEnabled; + } else { + var hasElement = isElement(element); + + if (!hasElement) { + // (bool) - Global setter + bool = animationsEnabled = !!element; + } else { + var node = getDomNode(element); + + if (argCount === 1) { + // (element) - Element getter + bool = !disabledElementsLookup.get(node); + } else { + // (element, bool) - Element setter + if (!disabledElementsLookup.has(node)) { + // The element is added to the map for the first time. + // Create a listener to remove it on `$destroy` (to avoid memory leak). + jqLite(element).on('$destroy', removeFromDisabledElementsLookup); + } + disabledElementsLookup.set(node, !bool); + } + } + } + + return bool; + } + }; + + return $animate; + + function queueAnimation(originalElement, event, initialOptions) { + // we always make a copy of the options since + // there should never be any side effects on + // the input data when running `$animateCss`. + var options = copy(initialOptions); + + var element = stripCommentsFromElement(originalElement); + var node = getDomNode(element); + var parentNode = node && node.parentNode; + + options = prepareAnimationOptions(options); + + // we create a fake runner with a working promise. + // These methods will become available after the digest has passed + var runner = new $$AnimateRunner(); + + // this is used to trigger callbacks in postDigest mode + var runInNextPostDigestOrNow = postDigestTaskFactory(); + + if (isArray(options.addClass)) { + options.addClass = options.addClass.join(' '); + } + + if (options.addClass && !isString(options.addClass)) { + options.addClass = null; + } + + if (isArray(options.removeClass)) { + options.removeClass = options.removeClass.join(' '); + } + + if (options.removeClass && !isString(options.removeClass)) { + options.removeClass = null; + } + + if (options.from && !isObject(options.from)) { + options.from = null; + } + + if (options.to && !isObject(options.to)) { + options.to = null; + } + + // If animations are hard-disabled for the whole application there is no need to continue. + // There are also situations where a directive issues an animation for a jqLite wrapper that + // contains only comment nodes. In this case, there is no way we can perform an animation. + if (!animationsEnabled || + !node || + !isAnimatableByFilter(node, event, initialOptions) || + !isAnimatableClassName(node, options)) { + close(); + return runner; + } + + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + var documentHidden = $$isDocumentHidden(); + + // This is a hard disable of all animations the element itself, therefore there is no need to + // continue further past this point if not enabled + // Animations are also disabled if the document is currently hidden (page is not visible + // to the user), because browsers slow down or do not flush calls to requestAnimationFrame + var skipAnimations = documentHidden || disabledElementsLookup.get(node); + var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {}; + var hasExistingAnimation = !!existingAnimation.state; + + // there is no point in traversing the same collection of parent ancestors if a followup + // animation will be run on the same element that already did all that checking work + if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state !== PRE_DIGEST_STATE)) { + skipAnimations = !areAnimationsAllowed(node, parentNode, event); + } + + if (skipAnimations) { + // Callbacks should fire even if the document is hidden (regression fix for issue #14120) + if (documentHidden) notifyProgress(runner, event, 'start', getEventData(options)); + close(); + if (documentHidden) notifyProgress(runner, event, 'close', getEventData(options)); + return runner; + } + + if (isStructural) { + closeChildAnimations(node); + } + + var newAnimation = { + structural: isStructural, + element: element, + event: event, + addClass: options.addClass, + removeClass: options.removeClass, + close: close, + options: options, + runner: runner + }; + + if (hasExistingAnimation) { + var skipAnimationFlag = isAllowed('skip', newAnimation, existingAnimation); + if (skipAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + close(); + return runner; + } else { + mergeAnimationDetails(element, existingAnimation, newAnimation); + return existingAnimation.runner; + } + } + var cancelAnimationFlag = isAllowed('cancel', newAnimation, existingAnimation); + if (cancelAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + // this will end the animation right away and it is safe + // to do so since the animation is already running and the + // runner callback code will run in async + existingAnimation.runner.end(); + } else if (existingAnimation.structural) { + // this means that the animation is queued into a digest, but + // hasn't started yet. Therefore it is safe to run the close + // method which will call the runner methods in async. + existingAnimation.close(); + } else { + // this will merge the new animation options into existing animation options + mergeAnimationDetails(element, existingAnimation, newAnimation); + + return existingAnimation.runner; + } + } else { + // a joined animation means that this animation will take over the existing one + // so an example would involve a leave animation taking over an enter. Then when + // the postDigest kicks in the enter will be ignored. + var joinAnimationFlag = isAllowed('join', newAnimation, existingAnimation); + if (joinAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + normalizeAnimationDetails(element, newAnimation); + } else { + applyGeneratedPreparationClasses($$jqLite, element, isStructural ? event : null, options); + + event = newAnimation.event = existingAnimation.event; + options = mergeAnimationDetails(element, existingAnimation, newAnimation); + + //we return the same runner since only the option values of this animation will + //be fed into the `existingAnimation`. + return existingAnimation.runner; + } + } + } + } else { + // normalization in this case means that it removes redundant CSS classes that + // already exist (addClass) or do not exist (removeClass) on the element + normalizeAnimationDetails(element, newAnimation); + } + + // when the options are merged and cleaned up we may end up not having to do + // an animation at all, therefore we should check this before issuing a post + // digest callback. Structural animations will always run no matter what. + var isValidAnimation = newAnimation.structural; + if (!isValidAnimation) { + // animate (from/to) can be quickly checked first, otherwise we check if any classes are present + isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0) + || hasAnimationClasses(newAnimation); + } + + if (!isValidAnimation) { + close(); + clearElementAnimationState(node); + return runner; + } + + // the counter keeps track of cancelled animations + var counter = (existingAnimation.counter || 0) + 1; + newAnimation.counter = counter; + + markElementAnimationState(node, PRE_DIGEST_STATE, newAnimation); + + $rootScope.$$postDigest(function() { + // It is possible that the DOM nodes inside `originalElement` have been replaced. This can + // happen if the animated element is a transcluded clone and also has a `templateUrl` + // directive on it. Therefore, we must recreate `element` in order to interact with the + // actual DOM nodes. + // Note: We still need to use the old `node` for certain things, such as looking up in + // HashMaps where it was used as the key. + + element = stripCommentsFromElement(originalElement); + + var animationDetails = activeAnimationsLookup.get(node); + var animationCancelled = !animationDetails; + animationDetails = animationDetails || {}; + + // if addClass/removeClass is called before something like enter then the + // registered parent element may not be present. The code below will ensure + // that a final value for parent element is obtained + var parentElement = element.parent() || []; + + // animate/structural/class-based animations all have requirements. Otherwise there + // is no point in performing an animation. The parent node must also be set. + var isValidAnimation = parentElement.length > 0 + && (animationDetails.event === 'animate' + || animationDetails.structural + || hasAnimationClasses(animationDetails)); + + // this means that the previous animation was cancelled + // even if the follow-up animation is the same event + if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) { + // if another animation did not take over then we need + // to make sure that the domOperation and options are + // handled accordingly + if (animationCancelled) { + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + } + + // if the event changed from something like enter to leave then we do + // it, otherwise if it's the same then the end result will be the same too + if (animationCancelled || (isStructural && animationDetails.event !== event)) { + options.domOperation(); + runner.end(); + } + + // in the event that the element animation was not cancelled or a follow-up animation + // isn't allowed to animate from here then we need to clear the state of the element + // so that any future animations won't read the expired animation data. + if (!isValidAnimation) { + clearElementAnimationState(node); + } + + return; + } + + // this combined multiple class to addClass / removeClass into a setClass event + // so long as a structural event did not take over the animation + event = !animationDetails.structural && hasAnimationClasses(animationDetails, true) + ? 'setClass' + : animationDetails.event; + + markElementAnimationState(node, RUNNING_STATE); + var realRunner = $$animation(element, event, animationDetails.options); + + // this will update the runner's flow-control events based on + // the `realRunner` object. + runner.setHost(realRunner); + notifyProgress(runner, event, 'start', getEventData(options)); + + realRunner.done(function(status) { + close(!status); + var animationDetails = activeAnimationsLookup.get(node); + if (animationDetails && animationDetails.counter === counter) { + clearElementAnimationState(node); + } + notifyProgress(runner, event, 'close', getEventData(options)); + }); + }); + + return runner; + + function notifyProgress(runner, event, phase, data) { + runInNextPostDigestOrNow(function() { + var callbacks = findCallbacks(parentNode, node, event); + if (callbacks.length) { + // do not optimize this call here to RAF because + // we don't know how heavy the callback code here will + // be and if this code is buffered then this can + // lead to a performance regression. + $$rAF(function() { + forEach(callbacks, function(callback) { + callback(element, phase, data); + }); + cleanupEventListeners(phase, node); + }); + } else { + cleanupEventListeners(phase, node); + } + }); + runner.progress(event, phase, data); + } + + function close(reject) { + clearGeneratedClasses(element, options); + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + runner.complete(!reject); + } + } + + function closeChildAnimations(node) { + var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']'); + forEach(children, function(child) { + var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME), 10); + var animationDetails = activeAnimationsLookup.get(child); + if (animationDetails) { + switch (state) { + case RUNNING_STATE: + animationDetails.runner.end(); + /* falls through */ + case PRE_DIGEST_STATE: + activeAnimationsLookup.delete(child); + break; + } + } + }); + } + + function clearElementAnimationState(node) { + node.removeAttribute(NG_ANIMATE_ATTR_NAME); + activeAnimationsLookup.delete(node); + } + + /** + * This fn returns false if any of the following is true: + * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed + * b) a parent element has an ongoing structural animation, and animateChildren is false + * c) the element is not a child of the body + * d) the element is not a child of the $rootElement + */ + function areAnimationsAllowed(node, parentNode, event) { + var bodyNode = $document[0].body; + var rootNode = getDomNode($rootElement); + + var bodyNodeDetected = (node === bodyNode) || node.nodeName === 'HTML'; + var rootNodeDetected = (node === rootNode); + var parentAnimationDetected = false; + var elementDisabled = disabledElementsLookup.get(node); + var animateChildren; + + var parentHost = jqLite.data(node, NG_ANIMATE_PIN_DATA); + if (parentHost) { + parentNode = getDomNode(parentHost); + } + + while (parentNode) { + if (!rootNodeDetected) { + // AngularJS doesn't want to attempt to animate elements outside of the application + // therefore we need to ensure that the rootElement is an ancestor of the current element + rootNodeDetected = (parentNode === rootNode); + } + + if (parentNode.nodeType !== ELEMENT_NODE) { + // no point in inspecting the #document element + break; + } + + var details = activeAnimationsLookup.get(parentNode) || {}; + // either an enter, leave or move animation will commence + // therefore we can't allow any animations to take place + // but if a parent animation is class-based then that's ok + if (!parentAnimationDetected) { + var parentNodeDisabled = disabledElementsLookup.get(parentNode); + + if (parentNodeDisabled === true && elementDisabled !== false) { + // disable animations if the user hasn't explicitly enabled animations on the + // current element + elementDisabled = true; + // element is disabled via parent element, no need to check anything else + break; + } else if (parentNodeDisabled === false) { + elementDisabled = false; + } + parentAnimationDetected = details.structural; + } + + if (isUndefined(animateChildren) || animateChildren === true) { + var value = jqLite.data(parentNode, NG_ANIMATE_CHILDREN_DATA); + if (isDefined(value)) { + animateChildren = value; + } + } + + // there is no need to continue traversing at this point + if (parentAnimationDetected && animateChildren === false) break; + + if (!bodyNodeDetected) { + // we also need to ensure that the element is or will be a part of the body element + // otherwise it is pointless to even issue an animation to be rendered + bodyNodeDetected = (parentNode === bodyNode); + } + + if (bodyNodeDetected && rootNodeDetected) { + // If both body and root have been found, any other checks are pointless, + // as no animation data should live outside the application + break; + } + + if (!rootNodeDetected) { + // If `rootNode` is not detected, check if `parentNode` is pinned to another element + parentHost = jqLite.data(parentNode, NG_ANIMATE_PIN_DATA); + if (parentHost) { + // The pin target element becomes the next parent element + parentNode = getDomNode(parentHost); + continue; + } + } + + parentNode = parentNode.parentNode; + } + + var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true; + return allowAnimation && rootNodeDetected && bodyNodeDetected; + } + + function markElementAnimationState(node, state, details) { + details = details || {}; + details.state = state; + + node.setAttribute(NG_ANIMATE_ATTR_NAME, state); + + var oldValue = activeAnimationsLookup.get(node); + var newValue = oldValue + ? extend(oldValue, details) + : details; + activeAnimationsLookup.set(node, newValue); + } + }]; +}]; + +/** @this */ +var $$AnimateCacheProvider = function() { + + var KEY = '$$ngAnimateParentKey'; + var parentCounter = 0; + var cache = Object.create(null); + + this.$get = [function() { + return { + cacheKey: function(node, method, addClass, removeClass) { + var parentNode = node.parentNode; + var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter); + var parts = [parentID, method, node.getAttribute('class')]; + if (addClass) { + parts.push(addClass); + } + if (removeClass) { + parts.push(removeClass); + } + return parts.join(' '); + }, + + containsCachedAnimationWithoutDuration: function(key) { + var entry = cache[key]; + + // nothing cached, so go ahead and animate + // otherwise it should be a valid animation + return (entry && !entry.isValid) || false; + }, + + flush: function() { + cache = Object.create(null); + }, + + count: function(key) { + var entry = cache[key]; + return entry ? entry.total : 0; + }, + + get: function(key) { + var entry = cache[key]; + return entry && entry.value; + }, + + put: function(key, value, isValid) { + if (!cache[key]) { + cache[key] = { total: 1, value: value, isValid: isValid }; + } else { + cache[key].total++; + cache[key].value = value; + } + } + }; + }]; +}; + +/* exported $$AnimationProvider */ + +var $$AnimationProvider = ['$animateProvider', /** @this */ function($animateProvider) { + var NG_ANIMATE_REF_ATTR = 'ng-animate-ref'; + + var drivers = this.drivers = []; + + var RUNNER_STORAGE_KEY = '$$animationRunner'; + var PREPARE_CLASSES_KEY = '$$animatePrepareClasses'; + + function setRunner(element, runner) { + element.data(RUNNER_STORAGE_KEY, runner); + } + + function removeRunner(element) { + element.removeData(RUNNER_STORAGE_KEY); + } + + function getRunner(element) { + return element.data(RUNNER_STORAGE_KEY); + } + + this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$Map', '$$rAFScheduler', '$$animateCache', + function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$Map, $$rAFScheduler, $$animateCache) { + + var animationQueue = []; + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function sortAnimations(animations) { + var tree = { children: [] }; + var i, lookup = new $$Map(); + + // this is done first beforehand so that the map + // is filled with a list of the elements that will be animated + for (i = 0; i < animations.length; i++) { + var animation = animations[i]; + lookup.set(animation.domNode, animations[i] = { + domNode: animation.domNode, + element: animation.element, + fn: animation.fn, + children: [] + }); + } + + for (i = 0; i < animations.length; i++) { + processNode(animations[i]); + } + + return flatten(tree); + + function processNode(entry) { + if (entry.processed) return entry; + entry.processed = true; + + var elementNode = entry.domNode; + var parentNode = elementNode.parentNode; + lookup.set(elementNode, entry); + + var parentEntry; + while (parentNode) { + parentEntry = lookup.get(parentNode); + if (parentEntry) { + if (!parentEntry.processed) { + parentEntry = processNode(parentEntry); + } + break; + } + parentNode = parentNode.parentNode; + } + + (parentEntry || tree).children.push(entry); + return entry; + } + + function flatten(tree) { + var result = []; + var queue = []; + var i; + + for (i = 0; i < tree.children.length; i++) { + queue.push(tree.children[i]); + } + + var remainingLevelEntries = queue.length; + var nextLevelEntries = 0; + var row = []; + + for (i = 0; i < queue.length; i++) { + var entry = queue[i]; + if (remainingLevelEntries <= 0) { + remainingLevelEntries = nextLevelEntries; + nextLevelEntries = 0; + result.push(row); + row = []; + } + row.push(entry); + entry.children.forEach(function(childEntry) { + nextLevelEntries++; + queue.push(childEntry); + }); + remainingLevelEntries--; + } + + if (row.length) { + result.push(row); + } + + return result; + } + } + + // TODO(matsko): document the signature in a better way + return function(element, event, options) { + options = prepareAnimationOptions(options); + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + // there is no animation at the current moment, however + // these runner methods will get later updated with the + // methods leading into the driver's end/cancel methods + // for now they just stop the animation from starting + var runner = new $$AnimateRunner({ + end: function() { close(); }, + cancel: function() { close(true); } + }); + + if (!drivers.length) { + close(); + return runner; + } + + var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass)); + var tempClasses = options.tempClasses; + if (tempClasses) { + classes += ' ' + tempClasses; + options.tempClasses = null; + } + + if (isStructural) { + element.data(PREPARE_CLASSES_KEY, 'ng-' + event + PREPARE_CLASS_SUFFIX); + } + + setRunner(element, runner); + + animationQueue.push({ + // this data is used by the postDigest code and passed into + // the driver step function + element: element, + classes: classes, + event: event, + structural: isStructural, + options: options, + beforeStart: beforeStart, + close: close + }); + + element.on('$destroy', handleDestroyedElement); + + // we only want there to be one function called within the post digest + // block. This way we can group animations for all the animations that + // were apart of the same postDigest flush call. + if (animationQueue.length > 1) return runner; + + $rootScope.$$postDigest(function() { + var animations = []; + forEach(animationQueue, function(entry) { + // the element was destroyed early on which removed the runner + // form its storage. This means we can't animate this element + // at all and it already has been closed due to destruction. + if (getRunner(entry.element)) { + animations.push(entry); + } else { + entry.close(); + } + }); + + // now any future animations will be in another postDigest + animationQueue.length = 0; + + var groupedAnimations = groupAnimations(animations); + var toBeSortedAnimations = []; + + forEach(groupedAnimations, function(animationEntry) { + var element = animationEntry.from ? animationEntry.from.element : animationEntry.element; + var extraClasses = options.addClass; + + extraClasses = (extraClasses ? (extraClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; + var cacheKey = $$animateCache.cacheKey(element[0], animationEntry.event, extraClasses, options.removeClass); + + toBeSortedAnimations.push({ + element: element, + domNode: getDomNode(element), + fn: function triggerAnimationStart() { + var startAnimationFn, closeFn = animationEntry.close; + + // in the event that we've cached the animation status for this element + // and it's in fact an invalid animation (something that has duration = 0) + // then we should skip all the heavy work from here on + if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { + closeFn(); + return; + } + + // it's important that we apply the `ng-animate` CSS class and the + // temporary classes before we do any driver invoking since these + // CSS classes may be required for proper CSS detection. + animationEntry.beforeStart(); + + // in the event that the element was removed before the digest runs or + // during the RAF sequencing then we should not trigger the animation. + var targetElement = animationEntry.anchors + ? (animationEntry.from.element || animationEntry.to.element) + : animationEntry.element; + + if (getRunner(targetElement)) { + var operation = invokeFirstDriver(animationEntry); + if (operation) { + startAnimationFn = operation.start; + } + } + + if (!startAnimationFn) { + closeFn(); + } else { + var animationRunner = startAnimationFn(); + animationRunner.done(function(status) { + closeFn(!status); + }); + updateAnimationRunners(animationEntry, animationRunner); + } + } + }); + }); + + // we need to sort each of the animations in order of parent to child + // relationships. This ensures that the child classes are applied at the + // right time. + var finalAnimations = sortAnimations(toBeSortedAnimations); + for (var i = 0; i < finalAnimations.length; i++) { + var innerArray = finalAnimations[i]; + for (var j = 0; j < innerArray.length; j++) { + var entry = innerArray[j]; + var element = entry.element; + + // the RAFScheduler code only uses functions + finalAnimations[i][j] = entry.fn; + + // the first row of elements shouldn't have a prepare-class added to them + // since the elements are at the top of the animation hierarchy and they + // will be applied without a RAF having to pass... + if (i === 0) { + element.removeData(PREPARE_CLASSES_KEY); + continue; + } + + var prepareClassName = element.data(PREPARE_CLASSES_KEY); + if (prepareClassName) { + $$jqLite.addClass(element, prepareClassName); + } + } + } + + $$rAFScheduler(finalAnimations); + }); + + return runner; + + // TODO(matsko): change to reference nodes + function getAnchorNodes(node) { + var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']'; + var items = node.hasAttribute(NG_ANIMATE_REF_ATTR) + ? [node] + : node.querySelectorAll(SELECTOR); + var anchors = []; + forEach(items, function(node) { + var attr = node.getAttribute(NG_ANIMATE_REF_ATTR); + if (attr && attr.length) { + anchors.push(node); + } + }); + return anchors; + } + + function groupAnimations(animations) { + var preparedAnimations = []; + var refLookup = {}; + forEach(animations, function(animation, index) { + var element = animation.element; + var node = getDomNode(element); + var event = animation.event; + var enterOrMove = ['enter', 'move'].indexOf(event) >= 0; + var anchorNodes = animation.structural ? getAnchorNodes(node) : []; + + if (anchorNodes.length) { + var direction = enterOrMove ? 'to' : 'from'; + + forEach(anchorNodes, function(anchor) { + var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR); + refLookup[key] = refLookup[key] || {}; + refLookup[key][direction] = { + animationID: index, + element: jqLite(anchor) + }; + }); + } else { + preparedAnimations.push(animation); + } + }); + + var usedIndicesLookup = {}; + var anchorGroups = {}; + forEach(refLookup, function(operations, key) { + var from = operations.from; + var to = operations.to; + + if (!from || !to) { + // only one of these is set therefore we can't have an + // anchor animation since all three pieces are required + var index = from ? from.animationID : to.animationID; + var indexKey = index.toString(); + if (!usedIndicesLookup[indexKey]) { + usedIndicesLookup[indexKey] = true; + preparedAnimations.push(animations[index]); + } + return; + } + + var fromAnimation = animations[from.animationID]; + var toAnimation = animations[to.animationID]; + var lookupKey = from.animationID.toString(); + if (!anchorGroups[lookupKey]) { + var group = anchorGroups[lookupKey] = { + structural: true, + beforeStart: function() { + fromAnimation.beforeStart(); + toAnimation.beforeStart(); + }, + close: function() { + fromAnimation.close(); + toAnimation.close(); + }, + classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes), + from: fromAnimation, + to: toAnimation, + anchors: [] // TODO(matsko): change to reference nodes + }; + + // the anchor animations require that the from and to elements both have at least + // one shared CSS class which effectively marries the two elements together to use + // the same animation driver and to properly sequence the anchor animation. + if (group.classes.length) { + preparedAnimations.push(group); + } else { + preparedAnimations.push(fromAnimation); + preparedAnimations.push(toAnimation); + } + } + + anchorGroups[lookupKey].anchors.push({ + 'out': from.element, 'in': to.element + }); + }); + + return preparedAnimations; + } + + function cssClassesIntersection(a,b) { + a = a.split(' '); + b = b.split(' '); + var matches = []; + + for (var i = 0; i < a.length; i++) { + var aa = a[i]; + if (aa.substring(0,3) === 'ng-') continue; + + for (var j = 0; j < b.length; j++) { + if (aa === b[j]) { + matches.push(aa); + break; + } + } + } + + return matches.join(' '); + } + + function invokeFirstDriver(animationDetails) { + // we loop in reverse order since the more general drivers (like CSS and JS) + // may attempt more elements, but custom drivers are more particular + for (var i = drivers.length - 1; i >= 0; i--) { + var driverName = drivers[i]; + var factory = $injector.get(driverName); + var driver = factory(animationDetails); + if (driver) { + return driver; + } + } + } + + function beforeStart() { + tempClasses = (tempClasses ? (tempClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; + $$jqLite.addClass(element, tempClasses); + + var prepareClassName = element.data(PREPARE_CLASSES_KEY); + if (prepareClassName) { + $$jqLite.removeClass(element, prepareClassName); + prepareClassName = null; + } + } + + function updateAnimationRunners(animation, newRunner) { + if (animation.from && animation.to) { + update(animation.from.element); + update(animation.to.element); + } else { + update(animation.element); + } + + function update(element) { + var runner = getRunner(element); + if (runner) runner.setHost(newRunner); + } + } + + function handleDestroyedElement() { + var runner = getRunner(element); + if (runner && (event !== 'leave' || !options.$$domOperationFired)) { + runner.end(); + } + } + + function close(rejected) { + element.off('$destroy', handleDestroyedElement); + removeRunner(element); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + + if (tempClasses) { + $$jqLite.removeClass(element, tempClasses); + } + + runner.complete(!rejected); + } + }; + }]; +}]; + +/** + * @ngdoc directive + * @name ngAnimateSwap + * @restrict A + * @scope + * + * @description + * + * ngAnimateSwap is a animation-oriented directive that allows for the container to + * be removed and entered in whenever the associated expression changes. A + * common usecase for this directive is a rotating banner or slider component which + * contains one image being present at a time. When the active image changes + * then the old image will perform a `leave` animation and the new element + * will be inserted via an `enter` animation. + * + * @animations + * | Animation | Occurs | + * |----------------------------------|--------------------------------------| + * | {@link ng.$animate#enter enter} | when the new element is inserted to the DOM | + * | {@link ng.$animate#leave leave} | when the old element is removed from the DOM | + * + * @example + * + * + *
    + *
    + * {{ number }} + *
    + *
    + *
    + * + * angular.module('ngAnimateSwapExample', ['ngAnimate']) + * .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) { + * $scope.number = 0; + * $interval(function() { + * $scope.number++; + * }, 1000); + * + * var colors = ['red','blue','green','yellow','orange']; + * $scope.colorClass = function(number) { + * return colors[number % colors.length]; + * }; + * }]); + * + * + * .container { + * height:250px; + * width:250px; + * position:relative; + * overflow:hidden; + * border:2px solid black; + * } + * .container .cell { + * font-size:150px; + * text-align:center; + * line-height:250px; + * position:absolute; + * top:0; + * left:0; + * right:0; + * border-bottom:2px solid black; + * } + * .swap-animation.ng-enter, .swap-animation.ng-leave { + * transition:0.5s linear all; + * } + * .swap-animation.ng-enter { + * top:-250px; + * } + * .swap-animation.ng-enter-active { + * top:0px; + * } + * .swap-animation.ng-leave { + * top:0px; + * } + * .swap-animation.ng-leave-active { + * top:250px; + * } + * .red { background:red; } + * .green { background:green; } + * .blue { background:blue; } + * .yellow { background:yellow; } + * .orange { background:orange; } + * + *
    + */ +var ngAnimateSwapDirective = ['$animate', function($animate) { + return { + restrict: 'A', + transclude: 'element', + terminal: true, + priority: 550, // We use 550 here to ensure that the directive is caught before others, + // but after `ngIf` (at priority 600). + link: function(scope, $element, attrs, ctrl, $transclude) { + var previousElement, previousScope; + scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) { + if (previousElement) { + $animate.leave(previousElement); + } + if (previousScope) { + previousScope.$destroy(); + previousScope = null; + } + if (value || value === 0) { + $transclude(function(clone, childScope) { + previousElement = clone; + previousScope = childScope; + $animate.enter(clone, null, $element); + }); + } + }); + } + }; +}]; + +/** + * @ngdoc module + * @name ngAnimate + * @description + * + * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via + * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an AngularJS app. + * + * ## Usage + * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based + * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For + * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within + * the HTML element that the animation will be triggered on. + * + * ## Directive Support + * The following directives are "animation aware": + * + * | Directive | Supported Animations | + * |-------------------------------------------------------------------------------|---------------------------------------------------------------------------| + * | {@link ng.directive:form#animations form / ngForm} | add and remove ({@link ng.directive:form#css-classes various classes}) | + * | {@link ngAnimate.directive:ngAnimateSwap#animations ngAnimateSwap} | enter and leave | + * | {@link ng.directive:ngClass#animations ngClass / {{class}​}} | add and remove | + * | {@link ng.directive:ngClassEven#animations ngClassEven} | add and remove | + * | {@link ng.directive:ngClassOdd#animations ngClassOdd} | add and remove | + * | {@link ng.directive:ngHide#animations ngHide} | add and remove (the `ng-hide` class) | + * | {@link ng.directive:ngIf#animations ngIf} | enter and leave | + * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave | + * | {@link module:ngMessages#animations ngMessage / ngMessageExp} | enter and leave | + * | {@link module:ngMessages#animations ngMessages} | add and remove (the `ng-active`/`ng-inactive` classes) | + * | {@link ng.directive:ngModel#animations ngModel} | add and remove ({@link ng.directive:ngModel#css-classes various classes}) | + * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave, and move | + * | {@link ng.directive:ngShow#animations ngShow} | add and remove (the `ng-hide` class) | + * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave | + * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave | + * + * (More information can be found by visiting the documentation associated with each directive.) + * + * For a full breakdown of the steps involved during each animation event, refer to the + * {@link ng.$animate `$animate` API docs}. + * + * ## CSS-based Animations + * + * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML + * and CSS code we can create an animation that will be picked up by AngularJS when an underlying directive performs an operation. + * + * The example below shows how an `enter` animation can be made possible on an element using `ng-if`: + * + * ```html + *
    + * Fade me in out + *
    + * + * + * ``` + * + * Notice the CSS class **fade**? We can now create the CSS transition code that references this class: + * + * ```css + * /* The starting CSS styles for the enter animation */ + * .fade.ng-enter { + * transition:0.5s linear all; + * opacity:0; + * } + * + * /* The finishing CSS styles for the enter animation */ + * .fade.ng-enter.ng-enter-active { + * opacity:1; + * } + * ``` + * + * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two + * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition + * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards. + * + * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions: + * + * ```css + * /* now the element will fade out before it is removed from the DOM */ + * .fade.ng-leave { + * transition:0.5s linear all; + * opacity:1; + * } + * .fade.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class: + * + * ```css + * /* there is no need to define anything inside of the destination + * CSS class since the keyframe will take charge of the animation */ + * .fade.ng-leave { + * animation: my_fade_animation 0.5s linear; + * -webkit-animation: my_fade_animation 0.5s linear; + * } + * + * @keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * + * @-webkit-keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * ``` + * + * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element. + * + * ### CSS Class-based Animations + * + * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different + * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added + * and removed. + * + * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class: + * + * ```html + *
    + * Show and hide me + *
    + * + * + * + * ``` + * + * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since + * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest. + * + * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation + * with CSS styles. + * + * ```html + *
    + * Highlight this box + *
    + * + * + * + * ``` + * + * We can also make use of CSS keyframes by placing them within the CSS classes. + * + * + * ### CSS Staggering Animations + * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a + * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be + * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for + * the animation. The style property expected within the stagger class can either be a **transition-delay** or an + * **animation-delay** property (or both if your animation contains both transitions and keyframe animations). + * + * ```css + * .my-animation.ng-enter { + * /* standard transition code */ + * transition: 1s linear all; + * opacity:0; + * } + * .my-animation.ng-enter-stagger { + * /* this will have a 100ms delay between each successive leave animation */ + * transition-delay: 0.1s; + * + * /* As of 1.4.4, this must always be set: it signals ngAnimate + * to not accidentally inherit a delay property from another CSS class */ + * transition-duration: 0s; + * + * /* if you are using animations instead of transitions you should configure as follows: + * animation-delay: 0.1s; + * animation-duration: 0s; */ + * } + * .my-animation.ng-enter.ng-enter-active { + * /* standard transition styles */ + * opacity:1; + * } + * ``` + * + * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations + * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this + * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation + * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired. + * + * The following code will issue the **ng-leave-stagger** event on the element provided: + * + * ```js + * var kids = parent.children(); + * + * $animate.leave(kids[0]); //stagger index=0 + * $animate.leave(kids[1]); //stagger index=1 + * $animate.leave(kids[2]); //stagger index=2 + * $animate.leave(kids[3]); //stagger index=3 + * $animate.leave(kids[4]); //stagger index=4 + * + * window.requestAnimationFrame(function() { + * //stagger has reset itself + * $animate.leave(kids[5]); //stagger index=0 + * $animate.leave(kids[6]); //stagger index=1 + * + * $scope.$digest(); + * }); + * ``` + * + * Stagger animations are currently only supported within CSS-defined animations. + * + * ### The `ng-animate` CSS class + * + * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation. + * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations). + * + * Therefore, animations can be applied to an element using this temporary class directly via CSS. + * + * ```css + * .zipper.ng-animate { + * transition:0.5s linear all; + * } + * .zipper.ng-enter { + * opacity:0; + * } + * .zipper.ng-enter.ng-enter-active { + * opacity:1; + * } + * .zipper.ng-leave { + * opacity:1; + * } + * .zipper.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove + * the CSS class once an animation has completed.) + * + * + * ### The `ng-[event]-prepare` class + * + * This is a special class that can be used to prevent unwanted flickering / flash of content before + * the actual animation starts. The class is added as soon as an animation is initialized, but removed + * before the actual animation starts (after waiting for a $digest). + * It is also only added for *structural* animations (`enter`, `move`, and `leave`). + * + * In practice, flickering can appear when nesting elements with structural animations such as `ngIf` + * into elements that have class-based animations such as `ngClass`. + * + * ```html + *
    + *
    + *
    + *
    + *
    + * ``` + * + * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating. + * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts: + * + * ```css + * .message.ng-enter-prepare { + * opacity: 0; + * } + * ``` + * + * ### Animating between value changes + * + * Sometimes you need to animate between different expression states, whose values + * don't necessary need to be known or referenced in CSS styles. + * Unless possible with another {@link ngAnimate#directive-support "animation aware" directive}, + * that specific use case can always be covered with {@link ngAnimate.directive:ngAnimateSwap} as + * can be seen in {@link ngAnimate.directive:ngAnimateSwap#examples this example}. + * + * Note that {@link ngAnimate.directive:ngAnimateSwap} is a *structural directive*, which means it + * creates a new instance of the element (including any other/child directives it may have) and + * links it to a new scope every time *swap* happens. In some cases this might not be desirable + * (e.g. for performance reasons, or when you wish to retain internal state on the original + * element instance). + * + * ## JavaScript-based Animations + * + * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared + * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the + * `module.animation()` module function we can register the animation. + * + * Let's see an example of a enter/leave animation using `ngRepeat`: + * + * ```html + *
    + * {{ item }} + *
    + * ``` + * + * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`: + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * // make note that other events (like addClass/removeClass) + * // have different function input parameters + * enter: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * + * // remember to call doneFn so that AngularJS + * // knows that the animation has concluded + * }, + * + * move: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * }, + * + * leave: function(element, doneFn) { + * jQuery(element).fadeOut(1000, doneFn); + * } + * } + * }]); + * ``` + * + * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as + * greensock.js and velocity.js. + * + * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define + * our animations inside of the same registered animation, however, the function input arguments are a bit different: + * + * ```html + *
    + * this box is moody + *
    + * + * + * + * ``` + * + * ```js + * myModule.animation('.colorful', [function() { + * return { + * addClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * removeClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * setClass: function(element, addedClass, removedClass, doneFn) { + * // do some cool animation and call the doneFn + * } + * } + * }]); + * ``` + * + * ## CSS + JS Animations Together + * + * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of AngularJS, + * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking + * charge of the animation**: + * + * ```html + *
    + * Slide in and out + *
    + * ``` + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * enter: function(element, doneFn) { + * jQuery(element).slideIn(1000, doneFn); + * } + * } + * }]); + * ``` + * + * ```css + * .slide.ng-enter { + * transition:0.5s linear all; + * transform:translateY(-100px); + * } + * .slide.ng-enter.ng-enter-active { + * transform:translateY(0); + * } + * ``` + * + * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the + * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from + * our own JS-based animation code: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { +* // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`. + * return $animateCss(element, { + * event: 'enter', + * structural: true + * }); + * } + * } + * }]); + * ``` + * + * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework. + * + * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or + * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that + * data into `$animateCss` directly: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { + * return $animateCss(element, { + * event: 'enter', + * structural: true, + * addClass: 'maroon-setting', + * from: { height:0 }, + * to: { height: 200 } + * }); + * } + * } + * }]); + * ``` + * + * Now we can fill in the rest via our transition CSS code: + * + * ```css + * /* the transition tells ngAnimate to make the animation happen */ + * .slide.ng-enter { transition:0.5s linear all; } + * + * /* this extra CSS class will be absorbed into the transition + * since the $animateCss code is adding the class */ + * .maroon-setting { background:red; } + * ``` + * + * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over. + * + * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}. + * + * ## Animation Anchoring (via `ng-animate-ref`) + * + * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between + * structural areas of an application (like views) by pairing up elements using an attribute + * called `ng-animate-ref`. + * + * Let's say for example we have two views that are managed by `ng-view` and we want to show + * that there is a relationship between two components situated in within these views. By using the + * `ng-animate-ref` attribute we can identify that the two components are paired together and we + * can then attach an animation, which is triggered when the view changes. + * + * Say for example we have the following template code: + * + * ```html + * + *
    + *
    + * + * + *
    + * + * + * + * + * + * ``` + * + * Now, when the view changes (once the link is clicked), ngAnimate will examine the + * HTML contents to see if there is a match reference between any components in the view + * that is leaving and the view that is entering. It will scan both the view which is being + * removed (leave) and inserted (enter) to see if there are any paired DOM elements that + * contain a matching ref value. + * + * The two images match since they share the same ref value. ngAnimate will now create a + * transport element (which is a clone of the first image element) and it will then attempt + * to animate to the position of the second image element in the next view. For the animation to + * work a special CSS class called `ng-anchor` will be added to the transported element. + * + * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then + * ngAnimate will handle the entire transition for us as well as the addition and removal of + * any changes of CSS classes between the elements: + * + * ```css + * .banner.ng-anchor { + * /* this animation will last for 1 second since there are + * two phases to the animation (an `in` and an `out` phase) */ + * transition:0.5s linear all; + * } + * ``` + * + * We also **must** include animations for the views that are being entered and removed + * (otherwise anchoring wouldn't be possible since the new view would be inserted right away). + * + * ```css + * .view-animation.ng-enter, .view-animation.ng-leave { + * transition:0.5s linear all; + * position:fixed; + * left:0; + * top:0; + * width:100%; + * } + * .view-animation.ng-enter { + * transform:translateX(100%); + * } + * .view-animation.ng-leave, + * .view-animation.ng-enter.ng-enter-active { + * transform:translateX(0%); + * } + * .view-animation.ng-leave.ng-leave-active { + * transform:translateX(-100%); + * } + * ``` + * + * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur: + * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away + * from its origin. Once that animation is over then the `in` stage occurs which animates the + * element to its destination. The reason why there are two animations is to give enough time + * for the enter animation on the new element to be ready. + * + * The example above sets up a transition for both the in and out phases, but we can also target the out or + * in phases directly via `ng-anchor-out` and `ng-anchor-in`. + * + * ```css + * .banner.ng-anchor-out { + * transition: 0.5s linear all; + * + * /* the scale will be applied during the out animation, + * but will be animated away when the in animation runs */ + * transform: scale(1.2); + * } + * + * .banner.ng-anchor-in { + * transition: 1s linear all; + * } + * ``` + * + * + * + * + * ### Anchoring Demo + * + + + Home +
    +
    +
    +
    +
    + + angular.module('anchoringExample', ['ngAnimate', 'ngRoute']) + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/', { + templateUrl: 'home.html', + controller: 'HomeController as home' + }); + $routeProvider.when('/profile/:id', { + templateUrl: 'profile.html', + controller: 'ProfileController as profile' + }); + }]) + .run(['$rootScope', function($rootScope) { + $rootScope.records = [ + { id: 1, title: 'Miss Beulah Roob' }, + { id: 2, title: 'Trent Morissette' }, + { id: 3, title: 'Miss Ava Pouros' }, + { id: 4, title: 'Rod Pouros' }, + { id: 5, title: 'Abdul Rice' }, + { id: 6, title: 'Laurie Rutherford Sr.' }, + { id: 7, title: 'Nakia McLaughlin' }, + { id: 8, title: 'Jordon Blanda DVM' }, + { id: 9, title: 'Rhoda Hand' }, + { id: 10, title: 'Alexandrea Sauer' } + ]; + }]) + .controller('HomeController', [function() { + //empty + }]) + .controller('ProfileController', ['$rootScope', '$routeParams', + function ProfileController($rootScope, $routeParams) { + var index = parseInt($routeParams.id, 10); + var record = $rootScope.records[index - 1]; + + this.title = record.title; + this.id = record.id; + }]); + + +

    Welcome to the home page

    +

    Please click on an element

    + + {{ record.title }} + +
    + +
    + {{ profile.title }} +
    +
    + + .record { + display:block; + font-size:20px; + } + .profile { + background:black; + color:white; + font-size:100px; + } + .view-container { + position:relative; + } + .view-container > .view.ng-animate { + position:absolute; + top:0; + left:0; + width:100%; + min-height:500px; + } + .view.ng-enter, .view.ng-leave, + .record.ng-anchor { + transition:0.5s linear all; + } + .view.ng-enter { + transform:translateX(100%); + } + .view.ng-enter.ng-enter-active, .view.ng-leave { + transform:translateX(0%); + } + .view.ng-leave.ng-leave-active { + transform:translateX(-100%); + } + .record.ng-anchor-out { + background:red; + } + +
    + * + * ### How is the element transported? + * + * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting + * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element + * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The + * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match + * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied + * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class + * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element + * will become visible since the shim class will be removed. + * + * ### How is the morphing handled? + * + * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out + * what CSS classes differ between the starting element and the destination element. These different CSS classes + * will be added/removed on the anchor element and a transition will be applied (the transition that is provided + * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will + * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that + * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since + * the cloned element is placed inside of root element which is likely close to the body element). + * + * Note that if the root element is on the `` element then the cloned node will be placed inside of body. + * + * + * ## Using $animate in your directive code + * + * So far we've explored how to feed in animations into an AngularJS application, but how do we trigger animations within our own directives in our application? + * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's + * imagine we have a greeting box that shows and hides itself when the data changes + * + * ```html + * Hi there + * ``` + * + * ```js + * ngModule.directive('greetingBox', ['$animate', function($animate) { + * return function(scope, element, attrs) { + * attrs.$observe('active', function(value) { + * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on'); + * }); + * }); + * }]); + * ``` + * + * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element + * in our HTML code then we can trigger a CSS or JS animation to happen. + * + * ```css + * /* normally we would create a CSS class to reference on the element */ + * greeting-box.on { transition:0.5s linear all; background:green; color:white; } + * ``` + * + * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's + * possible be sure to visit the {@link ng.$animate $animate service API page}. + * + * + * ## Callbacks and Promises + * + * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger + * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has + * ended by chaining onto the returned promise that animation method returns. + * + * ```js + * // somewhere within the depths of the directive + * $animate.enter(element, parent).then(function() { + * //the animation has completed + * }); + * ``` + * + * (Note that earlier versions of AngularJS prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case + * anymore.) + * + * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering + * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view + * routing controller to hook into that: + * + * ```js + * ngModule.controller('HomePageController', ['$animate', function($animate) { + * $animate.on('enter', ngViewElement, function(element) { + * // the animation for this route has completed + * }]); + * }]) + * ``` + * + * (Note that you will need to trigger a digest within the callback to get AngularJS to notice any scope-related changes.) + */ + +var copy; +var extend; +var forEach; +var isArray; +var isDefined; +var isElement; +var isFunction; +var isObject; +var isString; +var isUndefined; +var jqLite; +var noop; + +/** + * @ngdoc service + * @name $animate + * @kind object + * + * @description + * The ngAnimate `$animate` service documentation is the same for the core `$animate` service. + * + * Click here {@link ng.$animate to learn more about animations with `$animate`}. + */ +angular.module('ngAnimate', [], function initAngularHelpers() { + // Access helpers from AngularJS core. + // Do it inside a `config` block to ensure `window.angular` is available. + noop = angular.noop; + copy = angular.copy; + extend = angular.extend; + jqLite = angular.element; + forEach = angular.forEach; + isArray = angular.isArray; + isString = angular.isString; + isObject = angular.isObject; + isUndefined = angular.isUndefined; + isDefined = angular.isDefined; + isFunction = angular.isFunction; + isElement = angular.isElement; +}) + .info({ angularVersion: '1.8.2' }) + .directive('ngAnimateSwap', ngAnimateSwapDirective) + + .directive('ngAnimateChildren', $$AnimateChildrenDirective) + .factory('$$rAFScheduler', $$rAFSchedulerFactory) + + .provider('$$animateQueue', $$AnimateQueueProvider) + .provider('$$animateCache', $$AnimateCacheProvider) + .provider('$$animation', $$AnimationProvider) + + .provider('$animateCss', $AnimateCssProvider) + .provider('$$animateCssDriver', $$AnimateCssDriverProvider) + + .provider('$$animateJs', $$AnimateJsProvider) + .provider('$$animateJsDriver', $$AnimateJsDriverProvider); + + +})(window, window.angular); + + +/***/ }), + +/***/ "./node_modules/angular-animate/index.js": +/*!***********************************************!*\ + !*** ./node_modules/angular-animate/index.js ***! + \***********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./angular-animate */ "./node_modules/angular-animate/angular-animate.js"); +module.exports = 'ngAnimate'; + + +/***/ }), + +/***/ "./node_modules/angular-aria/angular-aria.js": +/*!***************************************************!*\ + !*** ./node_modules/angular-aria/angular-aria.js ***! + \***************************************************/ +/***/ (() => { + +/** + * @license AngularJS v1.8.2 + * (c) 2010-2020 Google LLC. http://angularjs.org + * License: MIT + */ +(function(window, angular) {'use strict'; + +/** + * @ngdoc module + * @name ngAria + * @description + * + * The `ngAria` module provides support for common + * [ARIA](http://www.w3.org/TR/wai-aria/) + * attributes that convey state or semantic information about the application for users + * of assistive technologies, such as screen readers. + * + * ## Usage + * + * For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following + * directives are supported: + * `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, + * `ngClick`, `ngDblClick`, and `ngMessages`. + * + * Below is a more detailed breakdown of the attributes handled by ngAria: + * + * | Directive | Supported Attributes | + * |---------------------------------------------|-----------------------------------------------------------------------------------------------------| + * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles | + * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled | + * | {@link ng.directive:ngRequired ngRequired} | aria-required | + * | {@link ng.directive:ngChecked ngChecked} | aria-checked | + * | {@link ng.directive:ngReadonly ngReadonly} | aria-readonly | + * | {@link ng.directive:ngValue ngValue} | aria-checked | + * | {@link ng.directive:ngShow ngShow} | aria-hidden | + * | {@link ng.directive:ngHide ngHide} | aria-hidden | + * | {@link ng.directive:ngDblclick ngDblclick} | tabindex | + * | {@link module:ngMessages ngMessages} | aria-live | + * | {@link ng.directive:ngClick ngClick} | tabindex, keydown event, button role | + * + * Find out more information about each directive by reading the + * {@link guide/accessibility ngAria Developer Guide}. + * + * ## Example + * Using ngDisabled with ngAria: + * ```html + * + * ``` + * Becomes: + * ```html + * + * ``` + * + * ## Disabling Specific Attributes + * It is possible to disable individual attributes added by ngAria with the + * {@link ngAria.$ariaProvider#config config} method. For more details, see the + * {@link guide/accessibility Developer Guide}. + * + * ## Disabling `ngAria` on Specific Elements + * It is possible to make `ngAria` ignore a specific element, by adding the `ng-aria-disable` + * attribute on it. Note that only the element itself (and not its child elements) will be ignored. + */ +var ARIA_DISABLE_ATTR = 'ngAriaDisable'; + +var ngAriaModule = angular.module('ngAria', ['ng']). + info({ angularVersion: '1.8.2' }). + provider('$aria', $AriaProvider); + +/** +* Internal Utilities +*/ +var nativeAriaNodeNames = ['BUTTON', 'A', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS', 'SUMMARY']; + +var isNodeOneOf = function(elem, nodeTypeArray) { + if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) { + return true; + } +}; +/** + * @ngdoc provider + * @name $ariaProvider + * @this + * + * @description + * + * Used for configuring the ARIA attributes injected and managed by ngAria. + * + * ```js + * angular.module('myApp', ['ngAria'], function config($ariaProvider) { + * $ariaProvider.config({ + * ariaValue: true, + * tabindex: false + * }); + * }); + *``` + * + * ## Dependencies + * Requires the {@link ngAria} module to be installed. + * + */ +function $AriaProvider() { + var config = { + ariaHidden: true, + ariaChecked: true, + ariaReadonly: true, + ariaDisabled: true, + ariaRequired: true, + ariaInvalid: true, + ariaValue: true, + tabindex: true, + bindKeydown: true, + bindRoleForClick: true + }; + + /** + * @ngdoc method + * @name $ariaProvider#config + * + * @param {object} config object to enable/disable specific ARIA attributes + * + * - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags + * - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags + * - **ariaReadonly** – `{boolean}` – Enables/disables aria-readonly tags + * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags + * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags + * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags + * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and + * aria-valuenow tags + * - **tabindex** – `{boolean}` – Enables/disables tabindex tags + * - **bindKeydown** – `{boolean}` – Enables/disables keyboard event binding on non-interactive + * elements (such as `div` or `li`) using ng-click, making them more accessible to users of + * assistive technologies + * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements (such as + * `div` or `li`) using ng-click, making them more accessible to users of assistive + * technologies + * + * @description + * Enables/disables various ARIA attributes + */ + this.config = function(newConfig) { + config = angular.extend(config, newConfig); + }; + + function watchExpr(attrName, ariaAttr, nativeAriaNodeNames, negate) { + return function(scope, elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var ariaCamelName = attr.$normalize(ariaAttr); + if (config[ariaCamelName] && !isNodeOneOf(elem, nativeAriaNodeNames) && !attr[ariaCamelName]) { + scope.$watch(attr[attrName], function(boolVal) { + // ensure boolean value + boolVal = negate ? !boolVal : !!boolVal; + elem.attr(ariaAttr, boolVal); + }); + } + }; + } + /** + * @ngdoc service + * @name $aria + * + * @description + * + * The $aria service contains helper methods for applying common + * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives. + * + * ngAria injects common accessibility attributes that tell assistive technologies when HTML + * elements are enabled, selected, hidden, and more. To see how this is performed with ngAria, + * let's review a code snippet from ngAria itself: + * + *```js + * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) { + * return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false); + * }]) + *``` + * Shown above, the ngAria module creates a directive with the same signature as the + * traditional `ng-disabled` directive. But this ngAria version is dedicated to + * solely managing accessibility attributes on custom elements. The internal `$aria` service is + * used to watch the boolean attribute `ngDisabled`. If it has not been explicitly set by the + * developer, `aria-disabled` is injected as an attribute with its value synchronized to the + * value in `ngDisabled`. + * + * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do + * anything to enable this feature. The `aria-disabled` attribute is automatically managed + * simply as a silent side-effect of using `ng-disabled` with the ngAria module. + * + * The full list of directives that interface with ngAria: + * * **ngModel** + * * **ngChecked** + * * **ngReadonly** + * * **ngRequired** + * * **ngDisabled** + * * **ngValue** + * * **ngShow** + * * **ngHide** + * * **ngClick** + * * **ngDblclick** + * * **ngMessages** + * + * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each + * directive. + * + * + * ## Dependencies + * Requires the {@link ngAria} module to be installed. + */ + this.$get = function() { + return { + config: function(key) { + return config[key]; + }, + $$watchExpr: watchExpr + }; + }; +} + + +ngAriaModule.directive('ngShow', ['$aria', function($aria) { + return $aria.$$watchExpr('ngShow', 'aria-hidden', [], true); +}]) +.directive('ngHide', ['$aria', function($aria) { + return $aria.$$watchExpr('ngHide', 'aria-hidden', [], false); +}]) +.directive('ngValue', ['$aria', function($aria) { + return $aria.$$watchExpr('ngValue', 'aria-checked', nativeAriaNodeNames, false); +}]) +.directive('ngChecked', ['$aria', function($aria) { + return $aria.$$watchExpr('ngChecked', 'aria-checked', nativeAriaNodeNames, false); +}]) +.directive('ngReadonly', ['$aria', function($aria) { + return $aria.$$watchExpr('ngReadonly', 'aria-readonly', nativeAriaNodeNames, false); +}]) +.directive('ngRequired', ['$aria', function($aria) { + return $aria.$$watchExpr('ngRequired', 'aria-required', nativeAriaNodeNames, false); +}]) +.directive('ngModel', ['$aria', function($aria) { + + function shouldAttachAttr(attr, normalizedAttr, elem, allowNonAriaNodes) { + return $aria.config(normalizedAttr) && + !elem.attr(attr) && + (allowNonAriaNodes || !isNodeOneOf(elem, nativeAriaNodeNames)) && + (elem.attr('type') !== 'hidden' || elem[0].nodeName !== 'INPUT'); + } + + function shouldAttachRole(role, elem) { + // if element does not have role attribute + // AND element type is equal to role (if custom element has a type equaling shape) <-- remove? + // AND element is not in nativeAriaNodeNames + return !elem.attr('role') && (elem.attr('type') === role) && !isNodeOneOf(elem, nativeAriaNodeNames); + } + + function getShape(attr, elem) { + var type = attr.type, + role = attr.role; + + return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' : + ((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' : + (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' : ''; + } + + return { + restrict: 'A', + require: 'ngModel', + priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value + compile: function(elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var shape = getShape(attr, elem); + + return { + post: function(scope, elem, attr, ngModel) { + var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem, false); + + function ngAriaWatchModelValue() { + return ngModel.$modelValue; + } + + function getRadioReaction(newVal) { + // Strict comparison would cause a BC + // eslint-disable-next-line eqeqeq + var boolVal = (attr.value == ngModel.$viewValue); + elem.attr('aria-checked', boolVal); + } + + function getCheckboxReaction() { + elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue)); + } + + switch (shape) { + case 'radio': + case 'checkbox': + if (shouldAttachRole(shape, elem)) { + elem.attr('role', shape); + } + if (shouldAttachAttr('aria-checked', 'ariaChecked', elem, false)) { + scope.$watch(ngAriaWatchModelValue, shape === 'radio' ? + getRadioReaction : getCheckboxReaction); + } + if (needsTabIndex) { + elem.attr('tabindex', 0); + } + break; + case 'range': + if (shouldAttachRole(shape, elem)) { + elem.attr('role', 'slider'); + } + if ($aria.config('ariaValue')) { + var needsAriaValuemin = !elem.attr('aria-valuemin') && + (attr.hasOwnProperty('min') || attr.hasOwnProperty('ngMin')); + var needsAriaValuemax = !elem.attr('aria-valuemax') && + (attr.hasOwnProperty('max') || attr.hasOwnProperty('ngMax')); + var needsAriaValuenow = !elem.attr('aria-valuenow'); + + if (needsAriaValuemin) { + attr.$observe('min', function ngAriaValueMinReaction(newVal) { + elem.attr('aria-valuemin', newVal); + }); + } + if (needsAriaValuemax) { + attr.$observe('max', function ngAriaValueMinReaction(newVal) { + elem.attr('aria-valuemax', newVal); + }); + } + if (needsAriaValuenow) { + scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) { + elem.attr('aria-valuenow', newVal); + }); + } + } + if (needsTabIndex) { + elem.attr('tabindex', 0); + } + break; + } + + if (!attr.hasOwnProperty('ngRequired') && ngModel.$validators.required + && shouldAttachAttr('aria-required', 'ariaRequired', elem, false)) { + // ngModel.$error.required is undefined on custom controls + attr.$observe('required', function() { + elem.attr('aria-required', !!attr['required']); + }); + } + + if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem, true)) { + scope.$watch(function ngAriaInvalidWatch() { + return ngModel.$invalid; + }, function ngAriaInvalidReaction(newVal) { + elem.attr('aria-invalid', !!newVal); + }); + } + } + }; + } + }; +}]) +.directive('ngDisabled', ['$aria', function($aria) { + return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false); +}]) +.directive('ngMessages', function() { + return { + restrict: 'A', + require: '?ngMessages', + link: function(scope, elem, attr, ngMessages) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + if (!elem.attr('aria-live')) { + elem.attr('aria-live', 'assertive'); + } + } + }; +}) +.directive('ngClick',['$aria', '$parse', function($aria, $parse) { + return { + restrict: 'A', + compile: function(elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + var fn = $parse(attr.ngClick); + return function(scope, elem, attr) { + + if (!isNodeOneOf(elem, nativeAriaNodeNames)) { + + if ($aria.config('bindRoleForClick') && !elem.attr('role')) { + elem.attr('role', 'button'); + } + + if ($aria.config('tabindex') && !elem.attr('tabindex')) { + elem.attr('tabindex', 0); + } + + if ($aria.config('bindKeydown') && !attr.ngKeydown && !attr.ngKeypress && !attr.ngKeyup) { + elem.on('keydown', function(event) { + var keyCode = event.which || event.keyCode; + + if (keyCode === 13 || keyCode === 32) { + // If the event is triggered on a non-interactive element ... + if (nativeAriaNodeNames.indexOf(event.target.nodeName) === -1 && !event.target.isContentEditable) { + // ... prevent the default browser behavior (e.g. scrolling when pressing spacebar) + // See https://github.com/angular/angular.js/issues/16664 + event.preventDefault(); + } + scope.$apply(callback); + } + + function callback() { + fn(scope, { $event: event }); + } + }); + } + } + }; + } + }; +}]) +.directive('ngDblclick', ['$aria', function($aria) { + return function(scope, elem, attr) { + if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; + + if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nativeAriaNodeNames)) { + elem.attr('tabindex', 0); + } + }; +}]); + + +})(window, window.angular); + + +/***/ }), + +/***/ "./node_modules/angular-aria/index.js": +/*!********************************************!*\ + !*** ./node_modules/angular-aria/index.js ***! + \********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./angular-aria */ "./node_modules/angular-aria/angular-aria.js"); +module.exports = 'ngAria'; + + +/***/ }), + +/***/ "./node_modules/angular-local-storage/dist/angular-local-storage.js": +/*!**************************************************************************!*\ + !*** ./node_modules/angular-local-storage/dist/angular-local-storage.js ***! + \**************************************************************************/ +/***/ (() => { + +/** + * An Angular module that gives you access to the browsers local storage + * @version v0.7.1 - 2017-06-21 + * @link https://github.com/grevory/angular-local-storage + * @author grevory + * @license MIT License, http://www.opensource.org/licenses/MIT + */ +(function (window, angular) { +var isDefined = angular.isDefined, + isUndefined = angular.isUndefined, + isNumber = angular.isNumber, + isObject = angular.isObject, + isArray = angular.isArray, + isString = angular.isString, + extend = angular.extend, + toJson = angular.toJson; + +angular + .module('LocalStorageModule', []) + .provider('localStorageService', function() { + // You should set a prefix to avoid overwriting any local storage variables from the rest of your app + // e.g. localStorageServiceProvider.setPrefix('yourAppName'); + // With provider you can use config as this: + // myApp.config(function (localStorageServiceProvider) { + // localStorageServiceProvider.prefix = 'yourAppName'; + // }); + this.prefix = 'ls'; + + // You could change web storage type localstorage or sessionStorage + this.storageType = 'localStorage'; + + // Cookie options (usually in case of fallback) + // expiry = Number of days before cookies expire // 0 = Does not expire + // path = The web path the cookie represents + // secure = Wether the cookies should be secure (i.e only sent on HTTPS requests) + this.cookie = { + expiry: 30, + path: '/', + secure: false + }; + + // Decides wether we should default to cookies if localstorage is not supported. + this.defaultToCookie = true; + + // Send signals for each of the following actions? + this.notify = { + setItem: true, + removeItem: false + }; + + // Setter for the prefix + this.setPrefix = function(prefix) { + this.prefix = prefix; + return this; + }; + + // Setter for the storageType + this.setStorageType = function(storageType) { + this.storageType = storageType; + return this; + }; + // Setter for defaultToCookie value, default is true. + this.setDefaultToCookie = function (shouldDefault) { + this.defaultToCookie = !!shouldDefault; // Double-not to make sure it's a bool value. + return this; + }; + // Setter for cookie config + this.setStorageCookie = function(exp, path, secure) { + this.cookie.expiry = exp; + this.cookie.path = path; + this.cookie.secure = secure; + return this; + }; + + // Setter for cookie domain + this.setStorageCookieDomain = function(domain) { + this.cookie.domain = domain; + return this; + }; + + // Setter for notification config + // itemSet & itemRemove should be booleans + this.setNotify = function(itemSet, itemRemove) { + this.notify = { + setItem: itemSet, + removeItem: itemRemove + }; + return this; + }; + + this.$get = ['$rootScope', '$window', '$document', '$parse','$timeout', function($rootScope, $window, $document, $parse, $timeout) { + var self = this; + var prefix = self.prefix; + var cookie = self.cookie; + var notify = self.notify; + var storageType = self.storageType; + var webStorage; + + // When Angular's $document is not available + if (!$document) { + $document = document; + } else if ($document[0]) { + $document = $document[0]; + } + + // If there is a prefix set in the config lets use that with an appended period for readability + if (prefix.substr(-1) !== '.') { + prefix = !!prefix ? prefix + '.' : ''; + } + var deriveQualifiedKey = function(key) { + return prefix + key; + }; + + // Removes prefix from the key. + var underiveQualifiedKey = function (key) { + return key.replace(new RegExp('^' + prefix, 'g'), ''); + }; + + // Check if the key is within our prefix namespace. + var isKeyPrefixOurs = function (key) { + return key.indexOf(prefix) === 0; + }; + + // Checks the browser to see if local storage is supported + var checkSupport = function () { + try { + var supported = (storageType in $window && $window[storageType] !== null); + + // When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage + // is available, but trying to call .setItem throws an exception. + // + // "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage + // that exceeded the quota." + var key = deriveQualifiedKey('__' + Math.round(Math.random() * 1e7)); + if (supported) { + webStorage = $window[storageType]; + webStorage.setItem(key, ''); + webStorage.removeItem(key); + } + + return supported; + } catch (e) { + // Only change storageType to cookies if defaulting is enabled. + if (self.defaultToCookie) + storageType = 'cookie'; + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + }; + var browserSupportsLocalStorage = checkSupport(); + + // Directly adds a value to local storage + // If local storage is not available in the browser use cookies + // Example use: localStorageService.add('library','angular'); + var addToLocalStorage = function (key, value, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + // Let's convert undefined values to null to get the value consistent + if (isUndefined(value)) { + value = null; + } else { + value = toJson(value); + } + + // If this browser does not support local storage use cookies + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + if (notify.setItem) { + $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'}); + } + return addToCookies(key, value); + } + + try { + if (webStorage) { + webStorage.setItem(deriveQualifiedKey(key), value); + } + if (notify.setItem) { + $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: self.storageType}); + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return addToCookies(key, value); + } + return true; + } finally { + setStorageType(previousType); + } + }; + + // Directly get a value from local storage + // Example use: localStorageService.get('library'); // returns 'angular' + var getFromLocalStorage = function (key, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + return getFromCookies(key); + } + + var item = webStorage ? webStorage.getItem(deriveQualifiedKey(key)) : null; + // angular.toJson will convert null to 'null', so a proper conversion is needed + // FIXME not a perfect solution, since a valid 'null' string can't be stored + if (!item || item === 'null') { + return null; + } + + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } finally { + setStorageType(previousType); + } + }; + + // Remove an item from local storage + // Example use: localStorageService.remove('library'); // removes the key/value pair of library='angular' + // + // This is var-arg removal, check the last argument to see if it is a storageType + // and set type accordingly before removing. + // + var removeFromLocalStorage = function () { + var previousType = getStorageType(); + + try { + // can't pop on arguments, so we do this + var consumed = 0; + if (arguments.length >= 1 && + (arguments[arguments.length - 1] === 'localStorage' || + arguments[arguments.length - 1] === 'sessionStorage')) { + consumed = 1; + setStorageType(arguments[arguments.length - 1]); + } + + var i, key; + for (i = 0; i < arguments.length - consumed; i++) { + key = arguments[i]; + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + + if (notify.removeItem) { + $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'cookie'}); + } + removeFromCookies(key); + } + else { + try { + webStorage.removeItem(deriveQualifiedKey(key)); + if (notify.removeItem) { + $rootScope.$broadcast('LocalStorageModule.notification.removeitem', { + key: key, + storageType: self.storageType + }); + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + removeFromCookies(key); + } + } + } + } finally { + setStorageType(previousType); + } + }; + + // Return array of keys for local storage + // Example use: var keys = localStorageService.keys() + var getKeysForLocalStorage = function (type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + return []; + } + + var prefixLength = prefix.length; + var keys = []; + for (var key in webStorage) { + // Only return keys that are for this app + if (key.substr(0, prefixLength) === prefix) { + try { + keys.push(key.substr(prefixLength)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.Description); + return []; + } + } + } + + return keys; + } finally { + setStorageType(previousType); + } + }; + + // Remove all data for this app from local storage + // Also optionally takes a regular expression string and removes the matching key-value pairs + // Example use: localStorageService.clearAll(); + // Should be used mostly for development purposes + var clearAllFromLocalStorage = function (regularExpression, type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + // Setting both regular expressions independently + // Empty strings result in catchall RegExp + var prefixRegex = !!prefix ? new RegExp('^' + prefix) : new RegExp(); + var testRegex = !!regularExpression ? new RegExp(regularExpression) : new RegExp(); + + if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { + if (!browserSupportsLocalStorage) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + } + return clearAllFromCookies(); + } + if (!browserSupportsLocalStorage && !self.defaultToCookie) + return false; + var prefixLength = prefix.length; + + for (var key in webStorage) { + // Only remove items that are for this app and match the regular expression + if (prefixRegex.test(key) && testRegex.test(key.substr(prefixLength))) { + try { + removeFromLocalStorage(key.substr(prefixLength)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return clearAllFromCookies(); + } + } + } + + return true; + } finally { + setStorageType(previousType); + } + }; + + // Checks the browser to see if cookies are supported + var browserSupportsCookies = (function() { + try { + return $window.navigator.cookieEnabled || + ("cookie" in $document && ($document.cookie.length > 0 || + ($document.cookie = "test").indexOf.call($document.cookie, "test") > -1)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + }()); + + // Directly adds a value to cookies + // Typically used as a fallback if local storage is not available in the browser + // Example use: localStorageService.cookie.add('library','angular'); + var addToCookies = function (key, value, daysToExpiry, secure) { + + if (isUndefined(value)) { + return false; + } else if(isArray(value) || isObject(value)) { + value = toJson(value); + } + + if (!browserSupportsCookies) { + $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); + return false; + } + + try { + var expiry = '', + expiryDate = new Date(), + cookieDomain = ''; + + if (value === null) { + // Mark that the cookie has expired one day ago + expiryDate.setTime(expiryDate.getTime() + (-1 * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + value = ''; + } else if (isNumber(daysToExpiry) && daysToExpiry !== 0) { + expiryDate.setTime(expiryDate.getTime() + (daysToExpiry * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + } else if (cookie.expiry !== 0) { + expiryDate.setTime(expiryDate.getTime() + (cookie.expiry * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + } + if (!!key) { + var cookiePath = "; path=" + cookie.path; + if (cookie.domain) { + cookieDomain = "; domain=" + cookie.domain; + } + /* Providing the secure parameter always takes precedence over config + * (allows developer to mix and match secure + non-secure) */ + if (typeof secure === 'boolean') { + if (secure === true) { + /* We've explicitly specified secure, + * add the secure attribute to the cookie (after domain) */ + cookieDomain += "; secure"; + } + // else - secure has been supplied but isn't true - so don't set secure flag, regardless of what config says + } + else if (cookie.secure === true) { + // secure parameter wasn't specified, get default from config + cookieDomain += "; secure"; + } + $document.cookie = deriveQualifiedKey(key) + "=" + encodeURIComponent(value) + expiry + cookiePath + cookieDomain; + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + return true; + }; + + // Directly get a value from a cookie + // Example use: localStorageService.cookie.get('library'); // returns 'angular' + var getFromCookies = function (key) { + if (!browserSupportsCookies) { + $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); + return false; + } + + var cookies = $document.cookie && $document.cookie.split(';') || []; + for(var i=0; i < cookies.length; i++) { + var thisCookie = cookies[i]; + while (thisCookie.charAt(0) === ' ') { + thisCookie = thisCookie.substring(1,thisCookie.length); + } + if (thisCookie.indexOf(deriveQualifiedKey(key) + '=') === 0) { + var storedValues = decodeURIComponent(thisCookie.substring(prefix.length + key.length + 1, thisCookie.length)); + try { + var parsedValue = JSON.parse(storedValues); + return typeof(parsedValue) === 'number' ? storedValues : parsedValue; + } catch(e) { + return storedValues; + } + } + } + return null; + }; + + var removeFromCookies = function (key) { + addToCookies(key,null); + }; + + var clearAllFromCookies = function () { + var thisCookie = null; + var prefixLength = prefix.length; + var cookies = $document.cookie.split(';'); + for(var i = 0; i < cookies.length; i++) { + thisCookie = cookies[i]; + + while (thisCookie.charAt(0) === ' ') { + thisCookie = thisCookie.substring(1, thisCookie.length); + } + + var key = thisCookie.substring(prefixLength, thisCookie.indexOf('=')); + removeFromCookies(key); + } + }; + + var getStorageType = function() { + return storageType; + }; + + var setStorageType = function(type) { + if (type && storageType !== type) { + storageType = type; + browserSupportsLocalStorage = checkSupport(); + } + return browserSupportsLocalStorage; + }; + + // Add a listener on scope variable to save its changes to local storage + // Return a function which when called cancels binding + var bindToScope = function(scope, key, def, lsKey, type) { + lsKey = lsKey || key; + var value = getFromLocalStorage(lsKey, type); + + if (value === null && isDefined(def)) { + value = def; + } else if (isObject(value) && isObject(def)) { + value = extend(value, def); + } + + $parse(key).assign(scope, value); + + return scope.$watch(key, function(newVal) { + addToLocalStorage(lsKey, newVal, type); + }, isObject(scope[key])); + }; + + // Add listener to local storage, for update callbacks. + if (browserSupportsLocalStorage) { + if ($window.addEventListener) { + $window.addEventListener("storage", handleStorageChangeCallback, false); + $rootScope.$on('$destroy', function() { + $window.removeEventListener("storage", handleStorageChangeCallback); + }); + } else if($window.attachEvent){ + // attachEvent and detachEvent are proprietary to IE v6-10 + $window.attachEvent("onstorage", handleStorageChangeCallback); + $rootScope.$on('$destroy', function() { + $window.detachEvent("onstorage", handleStorageChangeCallback); + }); + } + } + + // Callback handler for storage changed. + function handleStorageChangeCallback(e) { + if (!e) { e = $window.event; } + if (notify.setItem) { + if (isString(e.key) && isKeyPrefixOurs(e.key)) { + var key = underiveQualifiedKey(e.key); + // Use timeout, to avoid using $rootScope.$apply. + $timeout(function () { + $rootScope.$broadcast('LocalStorageModule.notification.changed', { key: key, newvalue: e.newValue, storageType: self.storageType }); + }); + } + } + } + + // Return localStorageService.length + // ignore keys that not owned + var lengthOfLocalStorage = function(type) { + var previousType = getStorageType(); + + try { + setStorageType(type); + + var count = 0; + var storage = $window[storageType]; + for(var i = 0; i < storage.length; i++) { + if(storage.key(i).indexOf(prefix) === 0 ) { + count++; + } + } + + return count; + } finally { + setStorageType(previousType); + } + }; + + var changePrefix = function(localStoragePrefix) { + prefix = localStoragePrefix; + }; + + return { + isSupported: browserSupportsLocalStorage, + getStorageType: getStorageType, + setStorageType: setStorageType, + setPrefix: changePrefix, + set: addToLocalStorage, + add: addToLocalStorage, //DEPRECATED + get: getFromLocalStorage, + keys: getKeysForLocalStorage, + remove: removeFromLocalStorage, + clearAll: clearAllFromLocalStorage, + bind: bindToScope, + deriveKey: deriveQualifiedKey, + underiveKey: underiveQualifiedKey, + length: lengthOfLocalStorage, + defaultToCookie: this.defaultToCookie, + cookie: { + isSupported: browserSupportsCookies, + set: addToCookies, + add: addToCookies, //DEPRECATED + get: getFromCookies, + remove: removeFromCookies, + clearAll: clearAllFromCookies + } + }; + }]; + }); +})(window, window.angular); + +/***/ }), + +/***/ "./node_modules/angular-local-storage/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/angular-local-storage/index.js ***! + \*****************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +__webpack_require__(/*! ./dist/angular-local-storage.js */ "./node_modules/angular-local-storage/dist/angular-local-storage.js"); +module.exports = 'LocalStorageModule'; + + +/***/ }), + +/***/ "./node_modules/angular-material/angular-material.js": +/*!***********************************************************!*\ + !*** ./node_modules/angular-material/angular-material.js ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/* provided dependency */ var __webpack_provided_window_dot_jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); +/*! + * AngularJS Material Design + * https://github.com/angular/material + * @license MIT + * v1.2.3 + */ +(function( window, angular, undefined ){ +"use strict"; + +(function(){ +"use strict"; + +angular.module('ngMaterial', ["ng","ngAnimate","ngAria","material.core","material.core.animate","material.core.gestures","material.core.interaction","material.core.layout","material.core.meta","material.core.theming.palette","material.core.theming","material.components.autocomplete","material.components.backdrop","material.components.bottomSheet","material.components.button","material.components.card","material.components.checkbox","material.components.chips","material.components.colors","material.components.content","material.components.datepicker","material.components.dialog","material.components.divider","material.components.fabActions","material.components.fabShared","material.components.fabSpeedDial","material.components.fabToolbar","material.components.gridList","material.components.icon","material.components.input","material.components.list","material.components.menu","material.components.menuBar","material.components.navBar","material.components.panel","material.components.progressCircular","material.components.progressLinear","material.components.radioButton","material.components.select","material.components.showHide","material.components.sidenav","material.components.slider","material.components.sticky","material.components.subheader","material.components.swipe","material.components.switch","material.components.tabs","material.components.toast","material.components.toolbar","material.components.tooltip","material.components.truncate","material.components.virtualRepeat","material.components.whiteframe"]); +})(); +(function(){ +"use strict"; + +/** + * Initialization function that validates environment + * requirements. + */ +DetectNgTouch.$inject = ["$log", "$injector"]; +MdCoreConfigure.$inject = ["$provide", "$mdThemingProvider"]; +rAFDecorator.$inject = ["$delegate"]; +qDecorator.$inject = ["$delegate"]; +angular + .module('material.core', [ + 'ngAnimate', + 'material.core.animate', + 'material.core.layout', + 'material.core.interaction', + 'material.core.gestures', + 'material.core.theming' + ]) + .config(MdCoreConfigure) + .run(DetectNgTouch); + + +/** + * Detect if the ng-Touch module is also being used. + * Warn if detected. + * @ngInject + */ +function DetectNgTouch($log, $injector) { + if ($injector.has('$swipe')) { + var msg = "" + + "You are using the ngTouch module. \n" + + "AngularJS Material already has mobile click, tap, and swipe support... \n" + + "ngTouch is not supported with AngularJS Material!"; + $log.warn(msg); + } +} + +/** + * @ngInject + */ +function MdCoreConfigure($provide, $mdThemingProvider) { + + $provide.decorator('$$rAF', ['$delegate', rAFDecorator]); + $provide.decorator('$q', ['$delegate', qDecorator]); + + $mdThemingProvider.theme('default') + .primaryPalette('indigo') + .accentPalette('pink') + .warnPalette('deep-orange') + .backgroundPalette('grey'); +} + +/** + * @ngInject + */ +function rAFDecorator($delegate) { + /** + * Use this to throttle events that come in often. + * The throttled function will always use the *last* invocation before the + * coming frame. + * + * For example, window resize events that fire many times a second: + * If we set to use an raf-throttled callback on window resize, then + * our callback will only be fired once per frame, with the last resize + * event that happened before that frame. + * + * @param {function} cb function to debounce + */ + $delegate.throttle = function(cb) { + var queuedArgs, alreadyQueued, queueCb, context; + return function debounced() { + queuedArgs = arguments; + context = this; + queueCb = cb; + if (!alreadyQueued) { + alreadyQueued = true; + $delegate(function() { + queueCb.apply(context, Array.prototype.slice.call(queuedArgs)); + alreadyQueued = false; + }); + } + }; + }; + return $delegate; +} + +/** + * @ngInject + */ +function qDecorator($delegate) { + /** + * Adds a shim for $q.resolve for AngularJS version that don't have it, + * so we don't have to think about it. + * + * via https://github.com/angular/angular.js/pull/11987 + */ + + // TODO(crisbeto): this won't be necessary once we drop AngularJS 1.3 + if (!$delegate.resolve) { + $delegate.resolve = $delegate.when; + } + return $delegate; +} + +})(); +(function(){ +"use strict"; + + +MdAutofocusDirective.$inject = ["$parse"];angular.module('material.core') + .directive('mdAutofocus', MdAutofocusDirective); + +/** + * @ngdoc directive + * @name mdAutofocus + * @module material.core.util + * + * @description + * + * `[md-autofocus]` provides an optional way to identify the focused element when a `$mdDialog`, + * `$mdBottomSheet`, `$mdMenu` or `$mdSidenav` opens or upon page load for input-like elements. + * + * When one of these opens, it will find the first nested element with the `[md-autofocus]` + * attribute directive and optional expression. An expression may be specified as the directive + * value to enable conditional activation of the autofocus. + * + * @usage + * + * ### Dialog + * + * + *
    + * + * + * + * + *
    + *
    + *
    + * + * ### Bottomsheet + * + * + * Comment Actions + * + * + * + * + * + * {{ item.name }} + * + * + * + * + * + * + * + * ### Autocomplete + * + * + * {{item.display}} + * + * + * + * ### Sidenav + * + *
    + * + * Left Nav! + * + * + * + * Center Content + * + * Open Left Menu + * + * + * + * + *
    + * + * + * + * + *
    + *
    + *
    + *
    + **/ +function MdAutofocusDirective($parse) { + return { + restrict: 'A', + link: { + pre: preLink + } + }; + + function preLink(scope, element, attr) { + var attrExp = attr.mdAutoFocus || attr.mdAutofocus || attr.mdSidenavFocus; + + // Initially update the expression by manually parsing the expression as per $watch source. + updateExpression($parse(attrExp)(scope)); + + // Only watch the expression if it is not empty. + if (attrExp) { + scope.$watch(attrExp, updateExpression); + } + + /** + * Updates the autofocus class which is used to determine whether the attribute + * expression evaluates to true or false. + * @param {string|boolean} value Attribute Value + */ + function updateExpression(value) { + + // Rather than passing undefined to the jqLite toggle class function we explicitly set the + // value to true. Otherwise the class will be just toggled instead of being forced. + if (angular.isUndefined(value)) { + value = true; + } + + element.toggleClass('md-autofocus', !!value); + } + } + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.colorUtil + * @description + * Color Util + */ +angular + .module('material.core') + .factory('$mdColorUtil', ColorUtilFactory); + +function ColorUtilFactory() { + /** + * Converts hex value to RGBA string + * @param color {string} + * @returns {string} + */ + function hexToRgba (color) { + var hex = color[ 0 ] === '#' ? color.substr(1) : color, + dig = hex.length / 3, + red = hex.substr(0, dig), + green = hex.substr(dig, dig), + blue = hex.substr(dig * 2); + if (dig === 1) { + red += red; + green += green; + blue += blue; + } + return 'rgba(' + parseInt(red, 16) + ',' + parseInt(green, 16) + ',' + parseInt(blue, 16) + ',0.1)'; + } + + /** + * Converts rgba value to hex string + * @param {string} color + * @returns {string} + */ + function rgbaToHex(color) { + color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); + + var hex = (color && color.length === 4) ? "#" + + ("0" + parseInt(color[1],10).toString(16)).slice(-2) + + ("0" + parseInt(color[2],10).toString(16)).slice(-2) + + ("0" + parseInt(color[3],10).toString(16)).slice(-2) : ''; + + return hex.toUpperCase(); + } + + /** + * Converts an RGB color to RGBA + * @param {string} color + * @returns {string} + */ + function rgbToRgba (color) { + return color.replace(')', ', 0.1)').replace('(', 'a('); + } + + /** + * Converts an RGBA color to RGB + * @param {string} color + * @returns {string} + */ + function rgbaToRgb (color) { + return color + ? color.replace('rgba', 'rgb').replace(/,[^),]+\)/, ')') + : 'rgb(0,0,0)'; + } + + return { + rgbaToHex: rgbaToHex, + hexToRgba: hexToRgba, + rgbToRgba: rgbToRgba, + rgbaToRgb: rgbaToRgb + }; +} + +})(); +(function(){ +"use strict"; + +angular.module('material.core') +.factory('$mdConstant', MdConstantFactory); + +/** + * Factory function that creates the grab-bag $mdConstant service. + * @ngInject + */ +function MdConstantFactory() { + + var prefixTestEl = document.createElement('div'); + var vendorPrefix = getVendorPrefix(prefixTestEl); + var isWebkit = /webkit/i.test(vendorPrefix); + var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; + + /** + * @param {string} name CSS property name + * @return {string} the property name supported by the browser + */ + function vendorProperty(name) { + // Add a dash between the prefix and name, to be able to transform the string into camelcase. + var prefixedName = vendorPrefix + '-' + name; + var ucPrefix = camelCase(prefixedName); + var lcPrefix = ucPrefix.charAt(0).toLowerCase() + ucPrefix.substring(1); + + return hasStyleProperty(prefixTestEl, name) ? name : // The current browser supports the un-prefixed property + hasStyleProperty(prefixTestEl, ucPrefix) ? ucPrefix : // The current browser only supports the prefixed property. + hasStyleProperty(prefixTestEl, lcPrefix) ? lcPrefix : name; // Some browsers are only supporting the prefix in lowercase. + } + + function hasStyleProperty(testElement, property) { + return angular.isDefined(testElement.style[property]); + } + + /** + * @param {!string} input value to convert to camelCase + * @return {string} camelCased version of the input string + */ + function camelCase(input) { + return input.replace(SPECIAL_CHARS_REGEXP, function(matches, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }); + } + + function getVendorPrefix(testElement) { + var prop, match; + var vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/; + + for (prop in testElement.style) { + if (match = vendorRegex.exec(prop)) { + return match[0]; + } + } + } + + var self = { + isInputKey : function(e) { return (e.keyCode >= 31 && e.keyCode <= 90); }, + isNumPadKey : function(e) { return (3 === e.location && e.keyCode >= 97 && e.keyCode <= 105); }, + isMetaKey: function(e) { return (e.keyCode >= 91 && e.keyCode <= 93); }, + isFnLockKey: function(e) { return (e.keyCode >= 112 && e.keyCode <= 145); }, + isNavigationKey : function(e) { + var kc = self.KEY_CODE, NAVIGATION_KEYS = [kc.SPACE, kc.ENTER, kc.UP_ARROW, kc.DOWN_ARROW]; + return (NAVIGATION_KEYS.indexOf(e.keyCode) != -1); + }, + hasModifierKey: function(e) { + return e.ctrlKey || e.metaKey || e.altKey; + }, + + /** + * Maximum size, in pixels, that can be explicitly set to an element. The actual value varies + * between browsers, but IE11 has the very lowest size at a mere 1,533,917px. Ideally we could + * compute this value, but Firefox always reports an element to have a size of zero if it + * goes over the max, meaning that we'd have to binary search for the value. + */ + ELEMENT_MAX_PIXELS: 1533917, + + /** + * Priority for a directive that should run before the directives from ngAria. + */ + BEFORE_NG_ARIA: 210, + + /** + * Common Keyboard actions and their associated keycode. + */ + KEY_CODE: { + COMMA: 188, + SEMICOLON : 186, + ENTER: 13, + ESCAPE: 27, + SPACE: 32, + PAGE_UP: 33, + PAGE_DOWN: 34, + END: 35, + HOME: 36, + LEFT_ARROW : 37, + UP_ARROW : 38, + RIGHT_ARROW : 39, + DOWN_ARROW : 40, + TAB : 9, + BACKSPACE: 8, + DELETE: 46 + }, + + /** + * Vendor prefixed CSS properties to be used to support the given functionality in older browsers + * as well. + */ + CSS: { + /* Constants */ + TRANSITIONEND: 'transitionend' + (isWebkit ? ' webkitTransitionEnd' : ''), + ANIMATIONEND: 'animationend' + (isWebkit ? ' webkitAnimationEnd' : ''), + + TRANSFORM: vendorProperty('transform'), + TRANSFORM_ORIGIN: vendorProperty('transformOrigin'), + TRANSITION: vendorProperty('transition'), + TRANSITION_DURATION: vendorProperty('transitionDuration'), + ANIMATION_PLAY_STATE: vendorProperty('animationPlayState'), + ANIMATION_DURATION: vendorProperty('animationDuration'), + ANIMATION_NAME: vendorProperty('animationName'), + ANIMATION_TIMING: vendorProperty('animationTimingFunction'), + ANIMATION_DIRECTION: vendorProperty('animationDirection') + }, + + /** + * As defined in core/style/_variables.scss + * + * $layout-breakpoint-xs: 600px !default; + * $layout-breakpoint-sm: 960px !default; + * $layout-breakpoint-md: 1280px !default; + * $layout-breakpoint-lg: 1920px !default; + * + */ + MEDIA: { + 'xs' : '(max-width: 599px)' , + 'gt-xs' : '(min-width: 600px)' , + 'sm' : '(min-width: 600px) and (max-width: 959px)' , + 'gt-sm' : '(min-width: 960px)' , + 'md' : '(min-width: 960px) and (max-width: 1279px)' , + 'gt-md' : '(min-width: 1280px)' , + 'lg' : '(min-width: 1280px) and (max-width: 1919px)', + 'gt-lg' : '(min-width: 1920px)' , + 'xl' : '(min-width: 1920px)' , + 'landscape' : '(orientation: landscape)' , + 'portrait' : '(orientation: portrait)' , + 'print' : 'print' + }, + + MEDIA_PRIORITY: [ + 'xl', + 'gt-lg', + 'lg', + 'gt-md', + 'md', + 'gt-sm', + 'sm', + 'gt-xs', + 'xs', + 'landscape', + 'portrait', + 'print' + ] + }; + + return self; +} + +})(); +(function(){ +"use strict"; + + angular + .module('material.core') + .config(["$provide", function($provide){ + $provide.decorator('$mdUtil', ['$delegate', function ($delegate){ + /** + * Inject the iterator facade to easily support iteration and accessors + * @see iterator below + */ + $delegate.iterator = MdIterator; + + return $delegate; + } + ]); + }]); + + /** + * iterator is a list facade to easily support iteration and accessors/ + * + * @param {any[]} items Array list which this iterator will enumerate + * @param {boolean=} reloop enables iterator to consider the list as an endless loop + * @return {{add: add, next: (function()), last: (function(): any|null), previous: (function()), count: (function(): number), hasNext: (function(*=): Array.length|*|number|boolean), inRange: (function(*): boolean), remove: remove, contains: (function(*=): *|boolean), itemAt: (function(*=): any|null), findBy: (function(*, *): *[]), hasPrevious: (function(*=): Array.length|*|number|boolean), items: (function(): *[]), indexOf: (function(*=): number), first: (function(): any|null)}} + * @constructor + */ + function MdIterator(items, reloop) { + var trueFn = function() { return true; }; + + if (items && !angular.isArray(items)) { + items = Array.prototype.slice.call(items); + } + + reloop = !!reloop; + var _items = items || []; + + // Published API + return { + items: getItems, + count: count, + + inRange: inRange, + contains: contains, + indexOf: indexOf, + itemAt: itemAt, + + findBy: findBy, + + add: add, + remove: remove, + + first: first, + last: last, + next: angular.bind(null, findSubsequentItem, false), + previous: angular.bind(null, findSubsequentItem, true), + + hasPrevious: hasPrevious, + hasNext: hasNext + }; + + /** + * Publish copy of the enumerable set + * @returns {Array|*} + */ + function getItems() { + return [].concat(_items); + } + + /** + * Determine length of the list + * @returns {Array.length|*|number} + */ + function count() { + return _items.length; + } + + /** + * Is the index specified valid + * @param index + * @returns {Array.length|*|number|boolean} + */ + function inRange(index) { + return _items.length && (index > -1) && (index < _items.length); + } + + /** + * Can the iterator proceed to the next item in the list; relative to + * the specified item. + * + * @param item + * @returns {Array.length|*|number|boolean} + */ + function hasNext(item) { + return item ? inRange(indexOf(item) + 1) : false; + } + + /** + * Can the iterator proceed to the previous item in the list; relative to + * the specified item. + * + * @param item + * @returns {Array.length|*|number|boolean} + */ + function hasPrevious(item) { + return item ? inRange(indexOf(item) - 1) : false; + } + + /** + * Get item at specified index/position + * @param index + * @returns {*} + */ + function itemAt(index) { + return inRange(index) ? _items[index] : null; + } + + /** + * Find all elements matching the key/value pair + * otherwise return null + * + * @param val + * @param key + * + * @return array + */ + function findBy(key, val) { + return _items.filter(function(item) { + return item[key] === val; + }); + } + + /** + * Add item to list + * @param item + * @param index + * @returns {*} + */ + function add(item, index) { + if (!item) return -1; + + if (!angular.isNumber(index)) { + index = _items.length; + } + + _items.splice(index, 0, item); + + return indexOf(item); + } + + /** + * Remove item from list... + * @param item + */ + function remove(item) { + if (contains(item)){ + _items.splice(indexOf(item), 1); + } + } + + /** + * Get the zero-based index of the target item + * @param item + * @returns {*} + */ + function indexOf(item) { + return _items.indexOf(item); + } + + /** + * Boolean existence check + * @param item + * @returns {boolean} + */ + function contains(item) { + return item && (indexOf(item) > -1); + } + + /** + * Return first item in the list + * @returns {*} + */ + function first() { + return _items.length ? _items[0] : null; + } + + /** + * Return last item in the list... + * @returns {*} + */ + function last() { + return _items.length ? _items[_items.length - 1] : null; + } + + /** + * Find the next item. If reloop is true and at the end of the list, it will go back to the + * first item. If given, the `validate` callback will be used to determine whether the next item + * is valid. If not valid, it will try to find the next item again. + * + * @param {boolean} backwards Specifies the direction of searching (forwards/backwards) + * @param {*} item The item whose subsequent item we are looking for + * @param {Function=} validate The `validate` function + * @param {integer=} limit The recursion limit + * + * @returns {*} The subsequent item or null + */ + function findSubsequentItem(backwards, item, validate, limit) { + validate = validate || trueFn; + + var curIndex = indexOf(item); + while (true) { + if (!inRange(curIndex)) return null; + + var nextIndex = curIndex + (backwards ? -1 : 1); + var foundItem = null; + if (inRange(nextIndex)) { + foundItem = _items[nextIndex]; + } else if (reloop) { + foundItem = backwards ? last() : first(); + nextIndex = indexOf(foundItem); + } + + if ((foundItem === null) || (nextIndex === limit)) return null; + if (validate(foundItem)) return foundItem; + + if (angular.isUndefined(limit)) limit = nextIndex; + + curIndex = nextIndex; + } + } + } + + +})(); +(function(){ +"use strict"; + + +mdMediaFactory.$inject = ["$mdConstant", "$rootScope", "$window"];angular.module('material.core') +.factory('$mdMedia', mdMediaFactory); + +/** + * @ngdoc service + * @name $mdMedia + * @module material.core + * + * @description + * `$mdMedia` is used to evaluate whether a given media query is true or false given the + * current device's screen / window size. The media query will be re-evaluated on resize, allowing + * you to register a watch. + * + * `$mdMedia` also has pre-programmed support for media queries that match the layout breakpoints: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    BreakpointmediaQuery
    xs(max-width: 599px)
    gt-xs(min-width: 600px)
    sm(min-width: 600px) and (max-width: 959px)
    gt-sm(min-width: 960px)
    md(min-width: 960px) and (max-width: 1279px)
    gt-md(min-width: 1280px)
    lg(min-width: 1280px) and (max-width: 1919px)
    gt-lg(min-width: 1920px)
    xl(min-width: 1920px)
    landscapelandscape
    portraitportrait
    printprint
    + * + * See Material Design's Layout - Adaptive UI for more details. + * + * + * + * + * + * @returns {boolean} a boolean representing whether or not the given media query is true or false. + * + * @usage + * + * app.controller('MyController', function($mdMedia, $scope) { + * $scope.$watch(function() { return $mdMedia('lg'); }, function(big) { + * $scope.bigScreen = big; + * }); + * + * $scope.screenIsSmall = $mdMedia('sm'); + * $scope.customQuery = $mdMedia('(min-width: 1234px)'); + * $scope.anotherCustom = $mdMedia('max-width: 300px'); + * }); + * + */ + +/* @ngInject */ +function mdMediaFactory($mdConstant, $rootScope, $window) { + var queries = {}; + var mqls = {}; + var results = {}; + var normalizeCache = {}; + + $mdMedia.getResponsiveAttribute = getResponsiveAttribute; + $mdMedia.getQuery = getQuery; + $mdMedia.watchResponsiveAttributes = watchResponsiveAttributes; + + return $mdMedia; + + function $mdMedia(query) { + var validated = queries[query]; + if (angular.isUndefined(validated)) { + validated = queries[query] = validate(query); + } + + var result = results[validated]; + if (angular.isUndefined(result)) { + result = add(validated); + } + + return result; + } + + function validate(query) { + return $mdConstant.MEDIA[query] || + ((query.charAt(0) !== '(') ? ('(' + query + ')') : query); + } + + function add(query) { + var result = mqls[query]; + if (!result) { + result = mqls[query] = $window.matchMedia(query); + } + + result.addListener(onQueryChange); + return (results[result.media] = !!result.matches); + } + + function onQueryChange(query) { + $rootScope.$evalAsync(function() { + results[query.media] = !!query.matches; + }); + } + + function getQuery(name) { + return mqls[name]; + } + + function getResponsiveAttribute(attrs, attrName) { + for (var i = 0; i < $mdConstant.MEDIA_PRIORITY.length; i++) { + var mediaName = $mdConstant.MEDIA_PRIORITY[i]; + if (!mqls[queries[mediaName]].matches) { + continue; + } + + var normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); + if (attrs[normalizedName]) { + return attrs[normalizedName]; + } + } + + // fallback on unprefixed + return attrs[getNormalizedName(attrs, attrName)]; + } + + function watchResponsiveAttributes(attrNames, attrs, watchFn) { + var unwatchFns = []; + attrNames.forEach(function(attrName) { + var normalizedName = getNormalizedName(attrs, attrName); + if (angular.isDefined(attrs[normalizedName])) { + unwatchFns.push( + attrs.$observe(normalizedName, angular.bind(void 0, watchFn, null))); + } + + for (var mediaName in $mdConstant.MEDIA) { + normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); + if (angular.isDefined(attrs[normalizedName])) { + unwatchFns.push( + attrs.$observe(normalizedName, angular.bind(void 0, watchFn, mediaName))); + } + } + }); + + return function unwatch() { + unwatchFns.forEach(function(fn) { fn(); }); + }; + } + + // Improves performance dramatically + function getNormalizedName(attrs, attrName) { + return normalizeCache[attrName] || + (normalizeCache[attrName] = attrs.$normalize(attrName)); + } +} + +})(); +(function(){ +"use strict"; + +angular + .module('material.core') + .config(["$provide", function($provide) { + $provide.decorator('$mdUtil', ['$delegate', function ($delegate) { + + // Inject the prefixer into our original $mdUtil service. + $delegate.prefixer = MdPrefixer; + + return $delegate; + }]); + }]); + +/** + * @param {string|string[]} initialAttributes + * @param {boolean} buildSelector + * @return {string|string[]|{buildSelector: (function(string|string[]): string), + * buildList: (function(string|string[]): string[]), + * hasAttribute: (function(JQLite|Element, string): HTMLElement), + * removeAttribute: (function(JQLite|Element, string): void)}} + * @constructor + */ +function MdPrefixer(initialAttributes, buildSelector) { + var PREFIXES = ['data', 'x']; + + if (initialAttributes) { + // The prefixer also accepts attributes as a parameter, and immediately builds a list or selector for + // the specified attributes. + return buildSelector ? _buildSelector(initialAttributes) : _buildList(initialAttributes); + } + + return { + buildList: _buildList, + buildSelector: _buildSelector, + hasAttribute: _hasAttribute, + removeAttribute: _removeAttribute + }; + + function _buildList(attributes) { + attributes = angular.isArray(attributes) ? attributes : [attributes]; + + attributes.forEach(function(item) { + PREFIXES.forEach(function(prefix) { + attributes.push(prefix + '-' + item); + }); + }); + + return attributes; + } + + function _buildSelector(attributes) { + attributes = angular.isArray(attributes) ? attributes : [attributes]; + + return _buildList(attributes) + .map(function(item) { + return '[' + item + ']'; + }) + .join(','); + } + + function _hasAttribute(element, attribute) { + element = _getNativeElement(element); + + if (!element) { + return false; + } + + var prefixedAttrs = _buildList(attribute); + + for (var i = 0; i < prefixedAttrs.length; i++) { + if (element.hasAttribute(prefixedAttrs[i])) { + return true; + } + } + + return false; + } + + function _removeAttribute(element, attribute) { + element = _getNativeElement(element); + + if (!element) { + return; + } + + _buildList(attribute).forEach(function(prefixedAttribute) { + element.removeAttribute(prefixedAttribute); + }); + } + + /** + * Transforms a jqLite or DOM element into a HTML element. + * This is useful when supporting jqLite elements and DOM elements at + * same time. + * @param element {JQLite|Element} Element to be parsed + * @returns {HTMLElement} Parsed HTMLElement + */ + function _getNativeElement(element) { + element = element[0] || element; + + if (element.nodeType) { + return element; + } + } + +} + +})(); +(function(){ +"use strict"; + +/* + * This var has to be outside the angular factory, otherwise when + * there are multiple material apps on the same page, each app + * will create its own instance of this array and the app's IDs + * will not be unique. + */ +UtilFactory.$inject = ["$document", "$timeout", "$compile", "$rootScope", "$$mdAnimate", "$interpolate", "$log", "$rootElement", "$window", "$$rAF"]; +var nextUniqueId = 0, isIos, isAndroid, isFirefox; + +// Support material-tools builds. +if (window.navigator) { + var userAgent = window.navigator.userAgent || window.navigator.vendor || window.opera; + isIos = userAgent.match(/ipad|iphone|ipod/i); + isAndroid = userAgent.match(/android/i); + isFirefox = userAgent.match(/(firefox|minefield)/i); +} + +/** + * @ngdoc module + * @name material.core.util + * @description + * Util + */ +angular +.module('material.core') +.factory('$mdUtil', UtilFactory); + +/** + * @ngInject + */ +function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $interpolate, $log, + $rootElement, $window, $$rAF) { + // Setup some core variables for the processTemplate method + var startSymbol = $interpolate.startSymbol(), + endSymbol = $interpolate.endSymbol(), + usesStandardSymbols = ((startSymbol === '{{') && (endSymbol === '}}')); + + // Polyfill document.contains for IE11. + document.contains || (document.contains = function (node) { + return document.body.contains(node); + }); + + /** + * Checks if the target element has the requested style by key + * @param {DOMElement|JQLite} target Target element + * @param {string} key Style key + * @param {string=} expectedVal Optional expected value + * @returns {boolean} Whether the target element has the style or not + */ + var hasComputedStyle = function (target, key, expectedVal) { + var hasValue = false; + + if (target && target.length) { + var computedStyles = $window.getComputedStyle(target[0]); + hasValue = angular.isDefined(computedStyles[key]) && + (expectedVal ? computedStyles[key] == expectedVal : true); + } + + return hasValue; + }; + + function validateCssValue(value) { + return !value ? '0' : + hasPx(value) || hasPercent(value) ? value : value + 'px'; + } + + function hasPx(value) { + return String(value).indexOf('px') > -1; + } + + function hasPercent(value) { + return String(value).indexOf('%') > -1; + } + + var $mdUtil = { + dom: {}, + isIos: isIos, + isAndroid: isAndroid, + now: window.performance && window.performance.now ? + angular.bind(window.performance, window.performance.now) : Date.now || function() { + return new Date().getTime(); + }, + + /** + * Cross-version compatibility method to retrieve an option of a ngModel controller, + * which supports the breaking changes in the AngularJS snapshot (SHA 87a2ff76af5d0a9268d8eb84db5755077d27c84c). + * @param {!ngModel.NgModelController} ngModelCtrl + * @param {!string} optionName + * @returns {string|number|boolean|Object|undefined} + */ + getModelOption: function (ngModelCtrl, optionName) { + if (!ngModelCtrl.$options) { + return; + } + + var $options = ngModelCtrl.$options; + + // The newer versions of AngularJS introduced a getOption function and made the option values + // no longer visible on the $options object. + return $options.getOption ? $options.getOption(optionName) : $options[optionName]; + }, + + /** + * Determines the current 'dir'ectional value based on the value of 'dir' + * attribute of the element. If that is not defined, it will try to use + * a 'dir' attribute of the body or html tag. + * + * @param {Object=} attrs a hash object with key-value pairs of normalized + * attribute names and their corresponding attribute values. + * @returns {boolean} true if the element's passed in attributes, + * the document, or the body indicates RTL mode, false otherwise. + */ + isRtl: function(attrs) { + var dir = angular.isDefined(attrs) && attrs.hasOwnProperty('dir') && attrs.dir; + + switch (dir) { + case 'ltr': + return false; + + case 'rtl': + return true; + } + + return ($document[0].dir === 'rtl' || $document[0].body.dir === 'rtl'); + }, + + /** + * Bi-directional accessor/mutator used to easily update an element's + * property based on the current 'dir'ectional value. + */ + bidi: function(element, property, lValue, rValue) { + var ltr = !this.isRtl(); + + // If accessor + if (arguments.length == 0) return ltr ? 'ltr' : 'rtl'; + + // If mutator + var elem = angular.element(element); + + if (ltr && angular.isDefined(lValue)) { + elem.css(property, validateCssValue(lValue)); + } + else if (!ltr && angular.isDefined(rValue)) { + elem.css(property, validateCssValue(rValue)); + } + }, + + bidiProperty: function (element, lProperty, rProperty, value) { + var ltr = !this.isRtl(); + + var elem = angular.element(element); + + if (ltr && angular.isDefined(lProperty)) { + elem.css(lProperty, validateCssValue(value)); + elem.css(rProperty, ''); + } + else if (!ltr && angular.isDefined(rProperty)) { + elem.css(rProperty, validateCssValue(value)); + elem.css(lProperty, ''); + } + }, + + clientRect: function(element, offsetParent, isOffsetRect) { + var node = getNode(element); + offsetParent = getNode(offsetParent || node.offsetParent || document.body); + var nodeRect = node.getBoundingClientRect(); + + // The user can ask for an offsetRect: a rect relative to the offsetParent, + // or a clientRect: a rect relative to the page + var offsetRect = isOffsetRect ? + offsetParent.getBoundingClientRect() : + {left: 0, top: 0, width: 0, height: 0}; + return { + left: nodeRect.left - offsetRect.left, + top: nodeRect.top - offsetRect.top, + width: nodeRect.width, + height: nodeRect.height + }; + }, + offsetRect: function(element, offsetParent) { + return $mdUtil.clientRect(element, offsetParent, true); + }, + + /** + * Annoying method to copy nodes to an array, thanks to IE. + * @param nodes + * @return {Array} + */ + nodesToArray: function(nodes) { + var results = [], i; + nodes = nodes || []; + + for (i = 0; i < nodes.length; ++i) { + results.push(nodes.item(i)); + } + return results; + }, + + /** + * Determines the absolute position of the viewport. + * Useful when making client rectangles absolute. + * @returns {number} + */ + getViewportTop: function() { + // If body scrolling is disabled, then use the cached viewport top value, otherwise get it + // fresh from the $window. + if ($mdUtil.disableScrollAround._count && $mdUtil.disableScrollAround._viewPortTop) { + return $mdUtil.disableScrollAround._viewPortTop; + } else { + return $window.scrollY || $window.pageYOffset || 0; + } + }, + + /** + * Finds the proper focus target by searching the DOM. + * + * @param {!JQLite} containerEl + * @param {string=} attributeVal + * @returns {JQLite|undefined} + */ + findFocusTarget: function(containerEl, attributeVal) { + var AUTO_FOCUS = this.prefixer('md-autofocus', true); + var elToFocus; + + elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS); + + // Scan for fallback to 'universal' API + if (!elToFocus) { + elToFocus = scanForFocusable(containerEl, AUTO_FOCUS); + } + + return elToFocus; + + /** + * Can target and nested children for specified Selector (attribute) + * whose value may be an expression that evaluates to True/False. + * @param {!JQLite} target + * @param {!string} selector + * @return {JQLite|undefined} + */ + function scanForFocusable(target, selector) { + var elFound, items = target[0].querySelectorAll(selector); + + // Find the last child element with the focus attribute + if (items && items.length) { + items.length && angular.forEach(items, function(it) { + it = angular.element(it); + + // Check the element for the md-autofocus class to ensure any associated expression + // evaluated to true. + var isFocusable = it.hasClass('md-autofocus'); + if (isFocusable) elFound = it; + }); + } + return elFound; + } + }, + + /** + * Disables scroll around the passed parent element. + * @param {Element|JQLite=} element Origin Element (not used) + * @param {Element|JQLite=} parent Element to disable scrolling within. + * Defaults to body if none supplied. + * @param {Object=} options Object of options to modify functionality + * - disableScrollMask Boolean of whether or not to create a scroll mask element or + * use the passed parent element. + */ + disableScrollAround: function(element, parent, options) { + options = options || {}; + + $mdUtil.disableScrollAround._count = Math.max(0, $mdUtil.disableScrollAround._count || 0); + $mdUtil.disableScrollAround._count++; + + if ($mdUtil.disableScrollAround._restoreScroll) { + return $mdUtil.disableScrollAround._restoreScroll; + } + + var body = $document[0].body; + var restoreBody = disableBodyScroll(); + var restoreElement = disableElementScroll(parent, options); + + return $mdUtil.disableScrollAround._restoreScroll = function() { + if (--$mdUtil.disableScrollAround._count <= 0) { + delete $mdUtil.disableScrollAround._viewPortTop; + restoreBody(); + restoreElement(); + delete $mdUtil.disableScrollAround._restoreScroll; + } + }; + + /** + * Creates a virtual scrolling mask to prevent touchmove, keyboard, scrollbar clicking, + * and wheel events. + * @param {!Element|!JQLite} elementToDisable + * @param {Object=} scrollMaskOptions Object of options to modify functionality + * - disableScrollMask Boolean of whether or not to create a scroll mask element or + * use the passed parent element. + * @returns {Function} + */ + function disableElementScroll(elementToDisable, scrollMaskOptions) { + var scrollMask; + var wrappedElementToDisable = angular.element(elementToDisable || body); + + if (scrollMaskOptions.disableScrollMask) { + scrollMask = wrappedElementToDisable; + } else { + scrollMask = angular.element( + '
    ' + + '
    ' + + '
    '); + wrappedElementToDisable.append(scrollMask); + } + + /** + * @param {Event} $event + */ + function preventDefault($event) { + $event.preventDefault(); + } + + scrollMask.on('wheel touchmove', preventDefault); + + return function restoreElementScroll() { + scrollMask.off('wheel touchmove', preventDefault); + + if (!scrollMaskOptions.disableScrollMask && scrollMask[0].parentNode) { + scrollMask[0].parentNode.removeChild(scrollMask[0]); + } + }; + } + + // Converts the body to a position fixed block and translate it to the proper scroll position + function disableBodyScroll() { + var documentElement = $document[0].documentElement; + + var prevDocumentStyle = documentElement.style.cssText || ''; + var prevBodyStyle = body.style.cssText || ''; + + var viewportTop = $mdUtil.getViewportTop(); + $mdUtil.disableScrollAround._viewPortTop = viewportTop; + var clientWidth = body.clientWidth; + var hasVerticalScrollbar = body.scrollHeight > body.clientHeight + 1; + + // Scroll may be set on element (for example by overflow-y: scroll) + // but Chrome is reporting the scrollTop position always on . + // scrollElement will allow to restore the scrollTop position to proper target. + var scrollElement = documentElement.scrollTop > 0 ? documentElement : body; + + if (hasVerticalScrollbar) { + angular.element(body).css({ + position: 'fixed', + width: '100%', + top: -viewportTop + 'px' + }); + } + + if (body.clientWidth < clientWidth) { + body.style.overflow = 'hidden'; + } + + return function restoreScroll() { + // Reset the inline style CSS to the previous. + body.style.cssText = prevBodyStyle; + documentElement.style.cssText = prevDocumentStyle; + + // The scroll position while being fixed + scrollElement.scrollTop = viewportTop; + }; + } + + }, + + enableScrolling: function() { + var restoreFn = this.disableScrollAround._restoreScroll; + restoreFn && restoreFn(); + }, + + floatingScrollbars: function() { + if (this.floatingScrollbars.cached === undefined) { + var tempNode = angular.element('
    ').css({ + width: '100%', + 'z-index': -1, + position: 'absolute', + height: '35px', + 'overflow-y': 'scroll' + }); + tempNode.children().css('height', '60px'); + + $document[0].body.appendChild(tempNode[0]); + this.floatingScrollbars.cached = + (tempNode[0].offsetWidth === tempNode[0].childNodes[0].offsetWidth); + tempNode.remove(); + } + return this.floatingScrollbars.cached; + }, + + /** + * Mobile safari only allows you to set focus in click event listeners. + * @param {Element|JQLite} element to focus + */ + forceFocus: function(element) { + var node = element[0] || element; + + document.addEventListener('click', function focusOnClick(ev) { + if (ev.target === node && ev.$focus) { + node.focus(); + ev.stopImmediatePropagation(); + ev.preventDefault(); + node.removeEventListener('click', focusOnClick); + } + }, true); + + var newEvent = document.createEvent('MouseEvents'); + newEvent.initMouseEvent('click', false, true, window, {}, 0, 0, 0, 0, + false, false, false, false, 0, null); + newEvent.$material = true; + newEvent.$focus = true; + node.dispatchEvent(newEvent); + }, + + /** + * facade to build md-backdrop element with desired styles + * NOTE: Use $compile to trigger backdrop postLink function + */ + createBackdrop: function(scope, addClass) { + return $compile($mdUtil.supplant('', [addClass]))(scope); + }, + + /** + * supplant() method from Crockford's `Remedial Javascript` + * Equivalent to use of $interpolate; without dependency on + * interpolation symbols and scope. Note: the '{}' can + * be property names, property chains, or array indices. + */ + supplant: function(template, values, pattern) { + pattern = pattern || /\{([^{}]*)\}/g; + return template.replace(pattern, function(a, b) { + var p = b.split('.'), + r = values; + try { + for (var s in p) { + if (p.hasOwnProperty(s)) { + r = r[p[s]]; + } + } + } catch (e) { + r = a; + } + return (typeof r === 'string' || typeof r === 'number') ? r : a; + }); + }, + + fakeNgModel: function() { + return { + $fake: true, + $setTouched: angular.noop, + $setViewValue: function(value) { + this.$viewValue = value; + this.$render(value); + this.$viewChangeListeners.forEach(function(cb) { + cb(); + }); + }, + $isEmpty: function(value) { + return ('' + value).length === 0; + }, + $parsers: [], + $formatters: [], + $viewChangeListeners: [], + $render: angular.noop + }; + }, + + /** + * @param {Function} func original function to be debounced + * @param {number} wait number of milliseconds to delay (since last debounce reset). + * Default value 10 msecs. + * @param {Object} scope in which to apply the function after debouncing ends + * @param {boolean} invokeApply should the $timeout trigger $digest() dirty checking + * @return {Function} A function, that, as long as it continues to be invoked, will not be + * triggered. The function will be called after it stops being called for N milliseconds. + */ + debounce: function(func, wait, scope, invokeApply) { + var timer; + + return function debounced() { + var context = scope, + args = Array.prototype.slice.call(arguments); + + $timeout.cancel(timer); + timer = $timeout(function() { + + timer = undefined; + func.apply(context, args); + + }, wait || 10, invokeApply); + }; + }, + + /** + * The function will not be called unless it has been more than `delay` milliseconds since the + * last call. + * @param {Function} func original function to throttle + * @param {number} delay number of milliseconds to delay + * @return {Function} a function that can only be triggered every `delay` milliseconds. + */ + throttle: function throttle(func, delay) { + var recent; + return function throttled() { + var context = this; + var args = arguments; + var now = $mdUtil.now(); + + if (!recent || (now - recent > delay)) { + func.apply(context, args); + recent = now; + } + }; + }, + + /** + * Measures the number of milliseconds taken to run the provided callback + * function. Uses a high-precision timer if available. + */ + time: function time(cb) { + var start = $mdUtil.now(); + cb(); + return $mdUtil.now() - start; + }, + + /** + * Create an implicit getter that caches its `getter()` + * lookup value + */ + valueOnUse : function (scope, key, getter) { + var value = null, args = Array.prototype.slice.call(arguments); + var params = (args.length > 3) ? args.slice(3) : []; + + Object.defineProperty(scope, key, { + get: function () { + if (value === null) value = getter.apply(scope, params); + return value; + } + }); + }, + + /** + * Get a unique ID. + * + * @returns {string} an unique numeric string + */ + nextUid: function() { + return '' + nextUniqueId++; + }, + + /** + * Stop watchers and events from firing on a scope without destroying it, + * by disconnecting it from its parent and its siblings' linked lists. + * @param {Object} scope to disconnect + */ + disconnectScope: function disconnectScope(scope) { + if (!scope) return; + + // we can't destroy the root scope or a scope that has been already destroyed + if (scope.$root === scope) return; + if (scope.$$destroyed) return; + + var parent = scope.$parent; + scope.$$disconnected = true; + + // See Scope.$destroy + if (parent.$$childHead === scope) parent.$$childHead = scope.$$nextSibling; + if (parent.$$childTail === scope) parent.$$childTail = scope.$$prevSibling; + if (scope.$$prevSibling) scope.$$prevSibling.$$nextSibling = scope.$$nextSibling; + if (scope.$$nextSibling) scope.$$nextSibling.$$prevSibling = scope.$$prevSibling; + + scope.$$nextSibling = scope.$$prevSibling = null; + + }, + + /** + * Undo the effects of disconnectScope(). + * @param {Object} scope to reconnect + */ + reconnectScope: function reconnectScope(scope) { + if (!scope) return; + + // we can't disconnect the root node or scope already disconnected + if (scope.$root === scope) return; + if (!scope.$$disconnected) return; + + var child = scope; + + var parent = child.$parent; + child.$$disconnected = false; + // See Scope.$new for this logic... + child.$$prevSibling = parent.$$childTail; + if (parent.$$childHead) { + parent.$$childTail.$$nextSibling = child; + parent.$$childTail = child; + } else { + parent.$$childHead = parent.$$childTail = child; + } + }, + + /** + * Get an element's siblings matching a given tag name. + * + * @param {JQLite|angular.element|HTMLElement} element Element to start walking the DOM from + * @param {string} tagName HTML tag name to match against + * @returns {Object[]} JQLite + */ + getSiblings: function getSiblings(element, tagName) { + var upperCasedTagName = tagName.toUpperCase(); + if (element instanceof angular.element) { + element = element[0]; + } + var siblings = Array.prototype.filter.call(element.parentNode.children, function(node) { + return element !== node && node.tagName.toUpperCase() === upperCasedTagName; + }); + return siblings.map(function (sibling) { + return angular.element(sibling); + }); + }, + + /** + * getClosest replicates jQuery.closest() to walk up the DOM tree until it finds a matching + * nodeName. + * + * @param {Node} el Element to start walking the DOM from + * @param {string|function} validateWith If a string is passed, it will be evaluated against + * each of the parent nodes' tag name. If a function is passed, the loop will call it with each + * of the parents and will use the return value to determine whether the node is a match. + * @param {boolean=} onlyParent Only start checking from the parent element, not `el`. + * @returns {Node|null} closest matching parent Node or null if not found + */ + getClosest: function getClosest(el, validateWith, onlyParent) { + if (angular.isString(validateWith)) { + var tagName = validateWith.toUpperCase(); + validateWith = function(el) { + return el.nodeName.toUpperCase() === tagName; + }; + } + + if (el instanceof angular.element) el = el[0]; + if (onlyParent) el = el.parentNode; + if (!el) return null; + + do { + if (validateWith(el)) { + return el; + } + } while (el = el.parentNode); + + return null; + }, + + /** + * Build polyfill for the Node.contains feature (if needed) + * @param {Node} node + * @param {Node} child + * @returns {Node} + */ + elementContains: function(node, child) { + var hasContains = (window.Node && window.Node.prototype && Node.prototype.contains); + var findFn = hasContains ? angular.bind(node, node.contains) : angular.bind(node, function(arg) { + // compares the positions of two nodes and returns a bitmask + return (node === child) || !!(this.compareDocumentPosition(arg) & 16); + }); + + return findFn(child); + }, + + /** + * Functional equivalent for $element.filter(‘md-bottom-sheet’) + * useful with interimElements where the element and its container are important... + * + * @param {JQLite} element to scan + * @param {string} nodeName of node to find (e.g. 'md-dialog') + * @param {boolean=} scanDeep optional flag to allow deep scans; defaults to 'false'. + * @param {boolean=} warnNotFound optional flag to enable log warnings; defaults to false + */ + extractElementByName: function(element, nodeName, scanDeep, warnNotFound) { + var found = scanTree(element); + if (!found && !!warnNotFound) { + $log.warn($mdUtil.supplant("Unable to find node '{0}' in element '{1}'.",[nodeName, element[0].outerHTML])); + } + + return angular.element(found || element); + + /** + * Breadth-First tree scan for element with matching `nodeName` + */ + function scanTree(element) { + return scanLevel(element) || (scanDeep ? scanChildren(element) : null); + } + + /** + * Case-insensitive scan of current elements only (do not descend). + */ + function scanLevel(element) { + if (element) { + for (var i = 0, len = element.length; i < len; i++) { + if (element[i].nodeName.toLowerCase() === nodeName) { + return element[i]; + } + } + } + return null; + } + + /** + * Scan children of specified node + */ + function scanChildren(element) { + var found; + if (element) { + for (var i = 0, len = element.length; i < len; i++) { + var target = element[i]; + if (!found) { + for (var j = 0, numChild = target.childNodes.length; j < numChild; j++) { + found = found || scanTree([target.childNodes[j]]); + } + } + } + } + return found; + } + + }, + + /** + * Give optional properties with no value a boolean true if attr provided or false otherwise + */ + initOptionalProperties: function(scope, attr, defaults) { + defaults = defaults || {}; + angular.forEach(scope.$$isolateBindings, function(binding, key) { + if (binding.optional && angular.isUndefined(scope[key])) { + var attrIsDefined = angular.isDefined(attr[binding.attrName]); + scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined; + } + }); + }, + + /** + * Alternative to $timeout calls with 0 delay. + * nextTick() coalesces all calls within a single frame + * to minimize $digest thrashing + * + * @param {Function} callback function to be called after the tick + * @param {boolean=} digest true to call $rootScope.$digest() after callback + * @param {Object=} scope associated with callback. If the scope is destroyed, the callback will + * be skipped. + * @returns {*} + */ + nextTick: function(callback, digest, scope) { + // grab function reference for storing state details + var nextTick = $mdUtil.nextTick; + var timeout = nextTick.timeout; + var queue = nextTick.queue || []; + + // add callback to the queue + queue.push({scope: scope, callback: callback}); + + // set default value for digest + if (digest == null) digest = true; + + // store updated digest/queue values + nextTick.digest = nextTick.digest || digest; + nextTick.queue = queue; + + // either return existing timeout or create a new one + return timeout || (nextTick.timeout = $timeout(processQueue, 0, false)); + + /** + * Grab a copy of the current queue + * Clear the queue for future use + * Process the existing queue + * Trigger digest if necessary + */ + function processQueue() { + var queue = nextTick.queue; + var digest = nextTick.digest; + + nextTick.queue = []; + nextTick.timeout = null; + nextTick.digest = false; + + queue.forEach(function(queueItem) { + var skip = queueItem.scope && queueItem.scope.$$destroyed; + if (!skip) { + queueItem.callback(); + } + }); + + if (digest) $rootScope.$digest(); + } + }, + + /** + * Processes a template and replaces the start/end symbols if the application has + * overridden them. + * + * @param template The template to process whose start/end tags may be replaced. + * @returns {*} + */ + processTemplate: function(template) { + if (usesStandardSymbols) { + return template; + } else { + if (!template || !angular.isString(template)) return template; + return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); + } + }, + + /** + * Scan up dom hierarchy for enabled parent; + */ + getParentWithPointerEvents: function (element) { + var parent = element.parent(); + + // jqLite might return a non-null, but still empty, parent; so check for parent and length + while (hasComputedStyle(parent, 'pointer-events', 'none')) { + parent = parent.parent(); + } + + return parent; + }, + + getNearestContentElement: function (element) { + var current = element.parent()[0]; + // Look for the nearest parent md-content, stopping at the rootElement. + while (current && current !== $rootElement[0] && current !== document.body && current.nodeName.toUpperCase() !== 'MD-CONTENT') { + current = current.parentNode; + } + return current; + }, + + /** + * Checks if the current browser is natively supporting the `sticky` position. + * @returns {string} supported sticky property name + */ + checkStickySupport: function() { + var stickyProp; + var testEl = angular.element('
    '); + $document[0].body.appendChild(testEl[0]); + + var stickyProps = ['sticky', '-webkit-sticky']; + for (var i = 0; i < stickyProps.length; ++i) { + testEl.css({ + position: stickyProps[i], + top: 0, + 'z-index': 2 + }); + + if (testEl.css('position') == stickyProps[i]) { + stickyProp = stickyProps[i]; + break; + } + } + + testEl.remove(); + + return stickyProp; + }, + + /** + * Parses an attribute value, mostly a string. + * By default checks for negated values and returns `false´ if present. + * Negated values are: (native falsy) and negative strings like: + * `false` or `0`. + * @param value Attribute value which should be parsed. + * @param negatedCheck When set to false, won't check for negated values. + * @returns {boolean} + */ + parseAttributeBoolean: function(value, negatedCheck) { + return value === '' || !!value && (negatedCheck === false || value !== 'false' && value !== '0'); + }, + + hasComputedStyle: hasComputedStyle, + + /** + * Returns true if the parent form of the element has been submitted. + * @param element An AngularJS or HTML5 element. + * @returns {boolean} + */ + isParentFormSubmitted: function(element) { + var parent = $mdUtil.getClosest(element, 'form'); + var form = parent ? angular.element(parent).controller('form') : null; + + return form ? form.$submitted : false; + }, + + /** + * Animate the requested element's scrollTop to the requested scrollPosition with basic easing. + * @param {!Element} element The element to scroll. + * @param {number} scrollEnd The new/final scroll position. + * @param {number=} duration Duration of the scroll. Default is 1000ms. + */ + animateScrollTo: function(element, scrollEnd, duration) { + var scrollStart = element.scrollTop; + var scrollChange = scrollEnd - scrollStart; + var scrollingDown = scrollStart < scrollEnd; + var startTime = $mdUtil.now(); + + $$rAF(scrollChunk); + + function scrollChunk() { + var newPosition = calculateNewPosition(); + + element.scrollTop = newPosition; + + if (scrollingDown ? newPosition < scrollEnd : newPosition > scrollEnd) { + $$rAF(scrollChunk); + } + } + + function calculateNewPosition() { + var easeDuration = duration || 1000; + var currentTime = $mdUtil.now() - startTime; + + return ease(currentTime, scrollStart, scrollChange, easeDuration); + } + + function ease(currentTime, start, change, duration) { + // If the duration has passed (which can occur if our app loses focus due to $$rAF), jump + // straight to the proper position + if (currentTime > duration) { + return start + change; + } + + var ts = (currentTime /= duration) * currentTime; + var tc = ts * currentTime; + + return start + change * (-2 * tc + 3 * ts); + } + }, + + /** + * Provides an easy mechanism for removing duplicates from an array. + * + * var myArray = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]; + * + * $mdUtil.uniq(myArray) => [1, 2, 3, 4] + * + * @param {Array} array The array whose unique values should be returned. + * @returns {Array|void} A copy of the array containing only unique values. + */ + uniq: function(array) { + if (!array) { return; } + + return array.filter(function(value, index, self) { + return self.indexOf(value) === index; + }); + }, + + /** + * Gets the inner HTML content of the given HTMLElement. + * Only intended for use with SVG or Symbol elements in IE11. + * @param {Element} element + * @returns {string} the inner HTML of the element passed in + */ + getInnerHTML: function(element) { + // For SVG or Symbol elements, innerHTML returns `undefined` in IE. + // Reference: https://stackoverflow.com/q/28129956/633107 + // The XMLSerializer API is supported on IE11 and is the recommended workaround. + var serializer = new XMLSerializer(); + + return Array.prototype.map.call(element.childNodes, function (child) { + return serializer.serializeToString(child); + }).join(''); + }, + + /** + * Gets the outer HTML content of the given HTMLElement. + * Only intended for use with SVG or Symbol elements in IE11. + * @param {Element} element + * @returns {string} the outer HTML of the element passed in + */ + getOuterHTML: function(element) { + // For SVG or Symbol elements, outerHTML returns `undefined` in IE. + // Reference: https://stackoverflow.com/q/29888050/633107 + // The XMLSerializer API is supported on IE11 and is the recommended workaround. + var serializer = new XMLSerializer(); + return serializer.serializeToString(element); + }, + + /** + * Support: IE 9-11 only + * documentMode is an IE-only property + * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx + */ + msie: window.document.documentMode, + + getTouchAction: function() { + var testEl = document.createElement('div'); + var vendorPrefixes = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; + + for (var i = 0; i < vendorPrefixes.length; i++) { + var prefix = vendorPrefixes[i]; + var property = prefix ? prefix + 'TouchAction' : 'touchAction'; + if (angular.isDefined(testEl.style[property])) { + return property; + } + } + }, + + /** + * @param {Event} event the event to calculate the bubble path for + * @return {EventTarget[]} the set of nodes that this event could bubble up to + */ + getEventPath: function(event) { + var path = []; + var currentTarget = event.target; + while (currentTarget) { + path.push(currentTarget); + currentTarget = currentTarget.parentElement; + } + if (path.indexOf(window) === -1 && path.indexOf(document) === -1) + path.push(document); + if (path.indexOf(window) === -1) + path.push(window); + return path; + }, + + /** + * Gets the string the user has entered and removes Regex identifiers + * @param {string} term + * @returns {string} sanitized string + */ + sanitize: function(term) { + if (!term) return term; + return term.replace(/[\\^$*+?.()|{}[]/g, '\\$&'); + }, + + /********************************************************************************************** + * The following functions were sourced from + * https://github.com/angular/components/blob/3c37e4b1c1cb74a3d0a90d173240fc730d21d9d4/src/cdk/a11y/interactivity-checker/interactivity-checker.ts + **********************************************************************************************/ + + /** + * Gets whether an element is disabled. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is disabled. + */ + isDisabled: function(element) { + // This does not capture some cases, such as a non-form control with a disabled attribute or + // a form control inside of a disabled form, but should capture the most common cases. + return element.hasAttribute('disabled'); + }, + + /** + * Gets whether an element is visible for the purposes of interactivity. + * + * This will capture states like `display: none` and `visibility: hidden`, but not things like + * being clipped by an `overflow: hidden` parent or being outside the viewport. + * + * @param {HTMLElement} element + * @returns {boolean} Whether the element is visible. + */ + isVisible: function(element) { + return $mdUtil.hasGeometry(element) && getComputedStyle(element).visibility === 'visible'; + }, + + /** + * Gets whether an element can be reached via Tab key. + * Assumes that the element has already been checked with isFocusable. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is tabbable. + */ + isTabbable: function(element) { + var frameElement = $mdUtil.getFrameElement($mdUtil.getWindow(element)); + + if (frameElement) { + // Frame elements inherit their tabindex onto all child elements. + if ($mdUtil.getTabIndexValue(frameElement) === -1) { + return false; + } + + // Browsers disable tabbing to an element inside of an invisible frame. + if (!$mdUtil.isVisible(frameElement)) { + return false; + } + } + + var nodeName = element.nodeName.toLowerCase(); + var tabIndexValue = $mdUtil.getTabIndexValue(element); + + if (element.hasAttribute('contenteditable')) { + return tabIndexValue !== -1; + } + + if (nodeName === 'iframe' || nodeName === 'object') { + // The frame or object's content may be tabbable depending on the content, but it's + // not possibly to reliably detect the content of the frames. We always consider such + // elements as non-tabbable. + return false; + } + + // In iOS, the browser only considers some specific elements as tabbable. + if (isIos && !$mdUtil.isPotentiallyTabbableIOS(element)) { + return false; + } + + if (nodeName === 'audio') { + // Audio elements without controls enabled are never tabbable, regardless + // of the tabindex attribute explicitly being set. + if (!element.hasAttribute('controls')) { + return false; + } + // Audio elements with controls are by default tabbable unless the + // tabindex attribute is set to `-1` explicitly. + return tabIndexValue !== -1; + } + + if (nodeName === 'video') { + // For all video elements, if the tabindex attribute is set to `-1`, the video + // is not tabbable. Note: We cannot rely on the default `HTMLElement.tabIndex` + // property as that one is set to `-1` in Chrome, Edge and Safari v13.1. The + // tabindex attribute is the source of truth here. + if (tabIndexValue === -1) { + return false; + } + // If the tabindex is explicitly set, and not `-1` (as per check before), the + // video element is always tabbable (regardless of whether it has controls or not). + if (tabIndexValue !== null) { + return true; + } + // Otherwise (when no explicit tabindex is set), a video is only tabbable if it + // has controls enabled. Firefox is special as videos are always tabbable regardless + // of whether there are controls or not. + return isFirefox || element.hasAttribute('controls'); + } + + return element.tabIndex >= 0; + }, + + /** + * Gets whether an element can be focused by the user. + * @param {HTMLElement} element Element to be checked. + * @returns {boolean} Whether the element is focusable. + */ + isFocusable: function(element) { + // Perform checks in order of left to most expensive. + // Again, naive approach that does not capture many edge cases and browser quirks. + return $mdUtil.isPotentiallyFocusable(element) && !$mdUtil.isDisabled(element) && + $mdUtil.isVisible(element); + }, + + /** + * Gets whether an element is potentially focusable without taking current visible/disabled + * state into account. + * @param {HTMLElement} element + * @returns {boolean} + */ + isPotentiallyFocusable: function(element) { + // Inputs are potentially focusable *unless* they're type="hidden". + if ($mdUtil.isHiddenInput(element)) { + return false; + } + + return $mdUtil.isNativeFormElement(element) || + $mdUtil.isAnchorWithHref(element) || + element.hasAttribute('contenteditable') || + $mdUtil.hasValidTabIndex(element); + }, + + /** + * Checks whether the specified element is potentially tabbable on iOS. + * @param {HTMLElement} element + * @returns {boolean} + */ + isPotentiallyTabbableIOS: function(element) { + var nodeName = element.nodeName.toLowerCase(); + var inputType = nodeName === 'input' && element.type; + + return inputType === 'text' + || inputType === 'password' + || nodeName === 'select' + || nodeName === 'textarea'; + }, + + /** + * Returns the parsed tabindex from the element attributes instead of returning the + * evaluated tabindex from the browsers defaults. + * @param {HTMLElement} element + * @returns {null|number} + */ + getTabIndexValue: function(element) { + if (!$mdUtil.hasValidTabIndex(element)) { + return null; + } + + // See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054 + var tabIndex = parseInt(element.getAttribute('tabindex') || '', 10); + + return isNaN(tabIndex) ? -1 : tabIndex; + }, + + /** + * Gets whether an element has a valid tabindex. + * @param {HTMLElement} element + * @returns {boolean} + */ + hasValidTabIndex: function(element) { + if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) { + return false; + } + + var tabIndex = element.getAttribute('tabindex'); + + // IE11 parses tabindex="" as the value "-32768" + if (tabIndex == '-32768') { + return false; + } + + return !!(tabIndex && !isNaN(parseInt(tabIndex, 10))); + }, + + /** + * Checks whether the specified element has any geometry / rectangles. + * @param {HTMLElement} element + * @returns {boolean} + */ + hasGeometry: function(element) { + // Use logic from jQuery to check for an invisible element. + // See https://github.com/jquery/jquery/blob/8969732518470a7f8e654d5bc5be0b0076cb0b87/src/css/hiddenVisibleSelectors.js#L9 + return !!(element.offsetWidth || element.offsetHeight || + (typeof element.getClientRects === 'function' && element.getClientRects().length)); + }, + + /** + * Returns the frame element from a window object. Since browsers like MS Edge throw errors if + * the frameElement property is being accessed from a different host address, this property + * should be accessed carefully. + * @param {Window} window + * @returns {null|HTMLElement} + */ + getFrameElement: function(window) { + try { + return window.frameElement; + } catch (error) { + return null; + } + }, + + /** + * Gets the parent window of a DOM node with regards of being inside of an iframe. + * @param {HTMLElement} node + * @returns {Window} + */ + getWindow: function(node) { + // ownerDocument is null if `node` itself *is* a document. + return node.ownerDocument && node.ownerDocument.defaultView || window; + }, + + /** + * Gets whether an element's + * @param {Node} element + * @returns {boolean} + */ + isNativeFormElement: function(element) { + var nodeName = element.nodeName.toLowerCase(); + return nodeName === 'input' || + nodeName === 'select' || + nodeName === 'button' || + nodeName === 'textarea'; + }, + + /** + * Gets whether an element is an ``. + * @param {HTMLElement} element + * @returns {boolean} + */ + isHiddenInput: function(element) { + return $mdUtil.isInputElement(element) && element.type == 'hidden'; + }, + + /** + * Gets whether an element is an anchor that has an href attribute. + * @param {HTMLElement} element + * @returns {boolean} + */ + isAnchorWithHref: function(element) { + return $mdUtil.isAnchorElement(element) && element.hasAttribute('href'); + }, + + /** + * Gets whether an element is an input element. + * @param {HTMLElement} element + * @returns {boolean} + */ + isInputElement: function(element) { + return element.nodeName.toLowerCase() == 'input'; + }, + + /** + * Gets whether an element is an anchor element. + * @param {HTMLElement} element + * @returns {boolean} + */ + isAnchorElement: function(element) { + return element.nodeName.toLowerCase() == 'a'; + }, + + /********************************************************************************************** + * The following two functions were sourced from + * https://github.com/angular/components/blob/3c37e4b1c1cb74a3d0a90d173240fc730d21d9d4/src/cdk/a11y/focus-trap/focus-trap.ts#L268-L311 + **********************************************************************************************/ + + /** + * Get the first tabbable element from a DOM subtree (inclusive). + * @param {HTMLElement} root + * @returns {HTMLElement|null} + */ + getFirstTabbableElement: function(root) { + if ($mdUtil.isFocusable(root) && $mdUtil.isTabbable(root)) { + return root; + } + + // Iterate in DOM order. Note that IE doesn't have `children` for SVG so we fall + // back to `childNodes` which includes text nodes, comments etc. + var children = root.children || root.childNodes; + + for (var i = 0; i < children.length; i++) { + var tabbableChild = children[i].nodeType === $document[0].ELEMENT_NODE ? + $mdUtil.getFirstTabbableElement(children[i]) : null; + + if (tabbableChild) { + return tabbableChild; + } + } + + return null; + }, + + /** + * Get the last tabbable element from a DOM subtree (inclusive). + * @param {HTMLElement} root + * @returns {HTMLElement|null} + */ + getLastTabbableElement: function(root) { + if ($mdUtil.isFocusable(root) && $mdUtil.isTabbable(root)) { + return root; + } + + // Iterate in reverse DOM order. + var children = root.children || root.childNodes; + + for (var i = children.length - 1; i >= 0; i--) { + var tabbableChild = children[i].nodeType === $document[0].ELEMENT_NODE ? + $mdUtil.getLastTabbableElement(children[i]) : null; + + if (tabbableChild) { + return tabbableChild; + } + } + + return null; + } + }; + + // Instantiate other namespace utility methods + + $mdUtil.dom.animator = $$mdAnimate($mdUtil); + + return $mdUtil; + + function getNode(el) { + return el[0] || el; + } +} + +/** + * Since removing jQuery from the demos, some code that uses `element.focus()` is broken. + * We need to add `element.focus()`, because it's testable unlike `element[0].focus`. + */ +angular.element.prototype.focus = angular.element.prototype.focus || function() { + if (this.length) { + this[0].focus(); + } + return this; +}; + +angular.element.prototype.blur = angular.element.prototype.blur || function() { + if (this.length) { + this[0].blur(); + } + return this; +}; + +})(); +(function(){ +"use strict"; + +// Polyfill angular < 1.4 (provide $animateCss) +angular + .module('material.core') + .factory('$$mdAnimate', ["$q", "$timeout", "$mdConstant", "$animateCss", function($q, $timeout, $mdConstant, $animateCss) { + // Since $$mdAnimate is injected into $mdUtil... use a wrapper function + // to subsequently inject $mdUtil as an argument to the AnimateDomUtils + return function($mdUtil) { + return AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss); + }; + }]); + +/** + * Factory function that requires special injections + */ +function AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss) { + var self; + return self = { + translate3d : function(target, from, to, options) { + return $animateCss(target, { + from: from, + to: to, + addClass: options.transitionInClass, + removeClass: options.transitionOutClass, + duration: options.duration + }) + .start() + .then(function() { + // Resolve with reverser function... + return reverseTranslate; + }); + + /** + * Specific reversal of the request translate animation above... + */ + function reverseTranslate (newFrom) { + return $animateCss(target, { + to: newFrom || from, + addClass: options.transitionOutClass, + removeClass: options.transitionInClass, + duration: options.duration + }).start(); + } + }, + + /** + * Listen for transitionEnd event (with optional timeout) + * Announce completion or failure via promise handlers + */ + waitTransitionEnd: function (element, opts) { + var TIMEOUT = 3000; // fallback is 3 secs + + return $q(function(resolve, reject){ + opts = opts || { }; + + // If there is no transition is found, resolve immediately + // + // NOTE: using $mdUtil.nextTick() causes delays/issues + if (noTransitionFound(opts.cachedTransitionStyles)) { + TIMEOUT = 0; + } + + var timer = $timeout(finished, opts.timeout || TIMEOUT); + element.on($mdConstant.CSS.TRANSITIONEND, finished); + + /** + * Upon timeout or transitionEnd, reject or resolve (respectively) this promise. + * NOTE: Make sure this transitionEnd didn't bubble up from a child + */ + function finished(ev) { + if (ev && ev.target !== element[0]) return; + + if (ev) $timeout.cancel(timer); + element.off($mdConstant.CSS.TRANSITIONEND, finished); + + // Never reject since ngAnimate may cause timeouts due missed transitionEnd events + resolve(); + } + + /** + * Checks whether or not there is a transition. + * + * @param styles The cached styles to use for the calculation. If null, getComputedStyle() + * will be used. + * + * @returns {boolean} True if there is no transition/duration; false otherwise. + */ + function noTransitionFound(styles) { + styles = styles || window.getComputedStyle(element[0]); + + return styles.transitionDuration === '0s' || + (!styles.transition && !styles.transitionProperty); + } + }); + }, + + calculateTransformValues: function (element, originator) { + var origin = originator.element; + var bounds = originator.bounds; + + if (origin || bounds) { + var originBnds = origin ? self.clientRect(origin) || currentBounds() : self.copyRect(bounds); + var dialogRect = self.copyRect(element[0].getBoundingClientRect()); + var dialogCenterPt = self.centerPointFor(dialogRect); + var originCenterPt = self.centerPointFor(originBnds); + + return { + centerX: originCenterPt.x - dialogCenterPt.x, + centerY: originCenterPt.y - dialogCenterPt.y, + scaleX: Math.round(100 * Math.min(0.5, originBnds.width / dialogRect.width)) / 100, + scaleY: Math.round(100 * Math.min(0.5, originBnds.height / dialogRect.height)) / 100 + }; + } + return {centerX: 0, centerY: 0, scaleX: 0.5, scaleY: 0.5}; + + /** + * This is a fallback if the origin information is no longer valid, then the + * origin bounds simply becomes the current bounds for the dialogContainer's parent. + * @returns {null|DOMRect} + */ + function currentBounds() { + var container = element ? element.parent() : null; + var parent = container ? container.parent() : null; + + return parent ? self.clientRect(parent) : null; + } + }, + + /** + * Calculate the zoom transform from dialog to origin. + * + * We use this to set the dialog position immediately; + * then the md-transition-in actually translates back to + * `translate3d(0,0,0) scale(1.0)`... + * + * NOTE: all values are rounded to the nearest integer + */ + calculateZoomToOrigin: function (element, originator) { + var zoomTemplate = "translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )"; + var buildZoom = angular.bind(null, $mdUtil.supplant, zoomTemplate); + + return buildZoom(self.calculateTransformValues(element, originator)); + }, + + /** + * Calculate the slide transform from panel to origin. + * NOTE: all values are rounded to the nearest integer + */ + calculateSlideToOrigin: function (element, originator) { + var slideTemplate = "translate3d( {centerX}px, {centerY}px, 0 )"; + var buildSlide = angular.bind(null, $mdUtil.supplant, slideTemplate); + + return buildSlide(self.calculateTransformValues(element, originator)); + }, + + /** + * Enhance raw values to represent valid css stylings... + */ + toCss : function(raw) { + var css = { }; + var lookups = 'left top right bottom width height x y min-width min-height max-width max-height'; + + angular.forEach(raw, function(value,key) { + if (angular.isUndefined(value)) return; + + if (lookups.indexOf(key) >= 0) { + css[key] = value + 'px'; + } else { + switch (key) { + case 'transition': + convertToVendor(key, $mdConstant.CSS.TRANSITION, value); + break; + case 'transform': + convertToVendor(key, $mdConstant.CSS.TRANSFORM, value); + break; + case 'transformOrigin': + convertToVendor(key, $mdConstant.CSS.TRANSFORM_ORIGIN, value); + break; + case 'font-size': + css['font-size'] = value; // font sizes aren't always in px + break; + } + } + }); + + return css; + + function convertToVendor(key, vendor, value) { + angular.forEach(vendor.split(' '), function (key) { + css[key] = value; + }); + } + }, + + /** + * Convert the translate CSS value to key/value pair(s). + * @param {string} transform + * @param {boolean=} addTransition + * @param {string=} transition + * @return {Object} object containing CSS translate key/value pair(s) + */ + toTransformCss: function (transform, addTransition, transition) { + var css = {}; + angular.forEach($mdConstant.CSS.TRANSFORM.split(' '), function (key) { + css[key] = transform; + }); + + if (addTransition) { + transition = transition || "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important"; + css.transition = transition; + } + + return css; + }, + + /** + * Clone the Rect and calculate the height/width if needed. + * @param {DOMRect} source + * @param {DOMRect=} destination + * @returns {null|DOMRect} + */ + copyRect: function (source, destination) { + if (!source) return null; + + destination = destination || {}; + + angular.forEach('left top right bottom width height'.split(' '), function (key) { + destination[key] = Math.round(source[key]); + }); + + destination.width = destination.width || (destination.right - destination.left); + destination.height = destination.height || (destination.bottom - destination.top); + + return destination; + }, + + /** + * Calculate ClientRect of element; return null if hidden or zero size. + * @param {Element|string} element + * @returns {null|DOMRect} + */ + clientRect: function (element) { + var bounds = angular.element(element)[0].getBoundingClientRect(); + var isPositiveSizeClientRect = function (rect) { + return rect && (rect.width > 0) && (rect.height > 0); + }; + + // If the event origin element has zero size, it has probably been hidden. + return isPositiveSizeClientRect(bounds) ? self.copyRect(bounds) : null; + }, + + /** + * Calculate 'rounded' center point of Rect + * @param {DOMRect} targetRect + * @returns {{x: number, y: number}} + */ + centerPointFor: function (targetRect) { + return targetRect ? { + x: Math.round(targetRect.left + (targetRect.width / 2)), + y: Math.round(targetRect.top + (targetRect.height / 2)) + } : { x : 0, y : 0 }; + } + }; +} + + +})(); +(function(){ +"use strict"; + +if (angular.version.minor >= 4) { + angular.module('material.core.animate', []); +} else { +(function() { + "use strict"; + + var forEach = angular.forEach; + + var WEBKIT = angular.isDefined(document.documentElement.style.WebkitAppearance); + var TRANSITION_PROP = WEBKIT ? 'WebkitTransition' : 'transition'; + var ANIMATION_PROP = WEBKIT ? 'WebkitAnimation' : 'animation'; + var PREFIX = WEBKIT ? '-webkit-' : ''; + + var TRANSITION_EVENTS = (WEBKIT ? 'webkitTransitionEnd ' : '') + 'transitionend'; + var ANIMATION_EVENTS = (WEBKIT ? 'webkitAnimationEnd ' : '') + 'animationend'; + + var $$ForceReflowFactory = ['$document', function($document) { + return function() { + return $document[0].body.clientWidth + 1; + }; + }]; + + var $$rAFMutexFactory = ['$$rAF', function($$rAF) { + return function() { + var passed = false; + $$rAF(function() { + passed = true; + }); + return function(fn) { + passed ? fn() : $$rAF(fn); + }; + }; + }]; + + var $$AnimateRunnerFactory = ['$q', '$$rAFMutex', function($q, $$rAFMutex) { + var INITIAL_STATE = 0; + var DONE_PENDING_STATE = 1; + var DONE_COMPLETE_STATE = 2; + + function AnimateRunner(host) { + this.setHost(host); + + this._doneCallbacks = []; + this._runInAnimationFrame = $$rAFMutex(); + this._state = 0; + } + + AnimateRunner.prototype = { + setHost: function(host) { + this.host = host || {}; + }, + + done: function(fn) { + if (this._state === DONE_COMPLETE_STATE) { + fn(); + } else { + this._doneCallbacks.push(fn); + } + }, + + progress: angular.noop, + + getPromise: function() { + if (!this.promise) { + var self = this; + this.promise = $q(function(resolve, reject) { + self.done(function(status) { + status === false ? reject() : resolve(); + }); + }); + } + return this.promise; + }, + + then: function(resolveHandler, rejectHandler) { + return this.getPromise().then(resolveHandler, rejectHandler); + }, + + 'catch': function(handler) { + return this.getPromise()['catch'](handler); + }, + + 'finally': function(handler) { + return this.getPromise()['finally'](handler); + }, + + pause: function() { + if (this.host.pause) { + this.host.pause(); + } + }, + + resume: function() { + if (this.host.resume) { + this.host.resume(); + } + }, + + end: function() { + if (this.host.end) { + this.host.end(); + } + this._resolve(true); + }, + + cancel: function() { + if (this.host.cancel) { + this.host.cancel(); + } + this._resolve(false); + }, + + complete: function(response) { + var self = this; + if (self._state === INITIAL_STATE) { + self._state = DONE_PENDING_STATE; + self._runInAnimationFrame(function() { + self._resolve(response); + }); + } + }, + + _resolve: function(response) { + if (this._state !== DONE_COMPLETE_STATE) { + forEach(this._doneCallbacks, function(fn) { + fn(response); + }); + this._doneCallbacks.length = 0; + this._state = DONE_COMPLETE_STATE; + } + } + }; + + // Polyfill AnimateRunner.all which is used by input animations + AnimateRunner.all = function(runners, callback) { + var count = 0; + var status = true; + forEach(runners, function(runner) { + runner.done(onProgress); + }); + + function onProgress(response) { + status = status && response; + if (++count === runners.length) { + callback(status); + } + } + }; + + return AnimateRunner; + }]; + + angular + .module('material.core.animate', []) + .factory('$$forceReflow', $$ForceReflowFactory) + .factory('$$AnimateRunner', $$AnimateRunnerFactory) + .factory('$$rAFMutex', $$rAFMutexFactory) + .factory('$animateCss', ['$window', '$$rAF', '$$AnimateRunner', '$$forceReflow', '$$jqLite', '$timeout', '$animate', + function($window, $$rAF, $$AnimateRunner, $$forceReflow, $$jqLite, $timeout, $animate) { + + function init(element, options) { + + var temporaryStyles = []; + var node = getDomNode(element); + var areAnimationsAllowed = node && $animate.enabled(); + + var hasCompleteStyles = false; + var hasCompleteClasses = false; + + if (areAnimationsAllowed) { + if (options.transitionStyle) { + temporaryStyles.push([PREFIX + 'transition', options.transitionStyle]); + } + + if (options.keyframeStyle) { + temporaryStyles.push([PREFIX + 'animation', options.keyframeStyle]); + } + + if (options.delay) { + temporaryStyles.push([PREFIX + 'transition-delay', options.delay + 's']); + } + + if (options.duration) { + temporaryStyles.push([PREFIX + 'transition-duration', options.duration + 's']); + } + + hasCompleteStyles = options.keyframeStyle || + (options.to && (options.duration > 0 || options.transitionStyle)); + hasCompleteClasses = !!options.addClass || !!options.removeClass; + + blockTransition(element, true); + } + + var hasCompleteAnimation = areAnimationsAllowed && (hasCompleteStyles || hasCompleteClasses); + + applyAnimationFromStyles(element, options); + + var animationClosed = false; + var events, eventFn; + + return { + close: $window.close, + start: function() { + var runner = new $$AnimateRunner(); + waitUntilQuiet(function() { + blockTransition(element, false); + if (!hasCompleteAnimation) { + return close(); + } + + forEach(temporaryStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[camelCase(key)] = value; + }); + + applyClasses(element, options); + + var timings = computeTimings(element); + if (timings.duration === 0) { + return close(); + } + + var moreStyles = []; + + if (options.easing) { + if (timings.transitionDuration) { + moreStyles.push([PREFIX + 'transition-timing-function', options.easing]); + } + if (timings.animationDuration) { + moreStyles.push([PREFIX + 'animation-timing-function', options.easing]); + } + } + + if (options.delay && timings.animationDelay) { + moreStyles.push([PREFIX + 'animation-delay', options.delay + 's']); + } + + if (options.duration && timings.animationDuration) { + moreStyles.push([PREFIX + 'animation-duration', options.duration + 's']); + } + + forEach(moreStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[camelCase(key)] = value; + temporaryStyles.push(entry); + }); + + var maxDelay = timings.delay; + var maxDelayTime = maxDelay * 1000; + var maxDuration = timings.duration; + var maxDurationTime = maxDuration * 1000; + var startTime = Date.now(); + + events = []; + if (timings.transitionDuration) { + events.push(TRANSITION_EVENTS); + } + if (timings.animationDuration) { + events.push(ANIMATION_EVENTS); + } + events = events.join(' '); + eventFn = function(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + var timeStamp = ev.timeStamp || Date.now(); + var elapsedTime = parseFloat(ev.elapsedTime.toFixed(3)); + if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { + close(); + } + }; + element.on(events, eventFn); + + applyAnimationToStyles(element, options); + + $timeout(close, maxDelayTime + maxDurationTime * 1.5, false); + }); + + return runner; + + function close() { + if (animationClosed) return; + animationClosed = true; + + if (events && eventFn) { + element.off(events, eventFn); + } + applyClasses(element, options); + applyAnimationStyles(element, options); + forEach(temporaryStyles, function(entry) { + node.style[camelCase(entry[0])] = ''; + }); + runner.complete(true); + return runner; + } + } + }; + } + + function applyClasses(element, options) { + if (options.addClass) { + $$jqLite.addClass(element, options.addClass); + options.addClass = null; + } + if (options.removeClass) { + $$jqLite.removeClass(element, options.removeClass); + options.removeClass = null; + } + } + + function computeTimings(element) { + var node = getDomNode(element); + var cs = $window.getComputedStyle(node); + var tdr = parseMaxTime(cs[prop('transitionDuration')]); + var adr = parseMaxTime(cs[prop('animationDuration')]); + var tdy = parseMaxTime(cs[prop('transitionDelay')]); + var ady = parseMaxTime(cs[prop('animationDelay')]); + + adr *= (parseInt(cs[prop('animationIterationCount')], 10) || 1); + var duration = Math.max(adr, tdr); + var delay = Math.max(ady, tdy); + + return { + duration: duration, + delay: delay, + animationDuration: adr, + transitionDuration: tdr, + animationDelay: ady, + transitionDelay: tdy + }; + + function prop(key) { + return WEBKIT ? 'Webkit' + key.charAt(0).toUpperCase() + key.substr(1) + : key; + } + } + + function parseMaxTime(str) { + var maxValue = 0; + var values = (str || "").split(/\s*,\s*/); + forEach(values, function(value) { + // it's always safe to consider only second values and omit `ms` values since + // getComputedStyle will always handle the conversion for us + if (value.charAt(value.length - 1) == 's') { + value = value.substring(0, value.length - 1); + } + value = parseFloat(value) || 0; + maxValue = maxValue ? Math.max(value, maxValue) : value; + }); + return maxValue; + } + + var cancelLastRAFRequest; + var rafWaitQueue = []; + function waitUntilQuiet(callback) { + if (cancelLastRAFRequest) { + cancelLastRAFRequest(); // cancels the request + } + rafWaitQueue.push(callback); + cancelLastRAFRequest = $$rAF(function() { + cancelLastRAFRequest = null; + + // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. + // PLEASE EXAMINE THE `$$forceReflow` service to understand why. + var pageWidth = $$forceReflow(); + + // we use a for loop to ensure that if the queue is changed + // during this looping then it will consider new requests + for (var i = 0; i < rafWaitQueue.length; i++) { + rafWaitQueue[i](pageWidth); + } + rafWaitQueue.length = 0; + }); + } + + function applyAnimationStyles(element, options) { + applyAnimationFromStyles(element, options); + applyAnimationToStyles(element, options); + } + + function applyAnimationFromStyles(element, options) { + if (options.from) { + element.css(options.from); + options.from = null; + } + } + + function applyAnimationToStyles(element, options) { + if (options.to) { + element.css(options.to); + options.to = null; + } + } + + function getDomNode(element) { + for (var i = 0; i < element.length; i++) { + if (element[i].nodeType === 1) return element[i]; + } + } + + function blockTransition(element, bool) { + var node = getDomNode(element); + var key = camelCase(PREFIX + 'transition-delay'); + node.style[key] = bool ? '-9999s' : ''; + } + + return init; + }]); + + /** + * Older browsers [FF31] expect camelCase + * property keys. + * e.g. + * animation-duration --> animationDuration + */ + function camelCase(str) { + return str.replace(/-[a-z]/g, function(str) { + return str.charAt(1).toUpperCase(); + }); + } + +})(); + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.aria + * @description + * Aria Expectations for AngularJS Material components. + */ +MdAriaService.$inject = ["$$rAF", "$log", "$window", "$interpolate"]; +angular + .module('material.core') + .provider('$mdAria', MdAriaProvider); + +/** + * @ngdoc service + * @name $mdAriaProvider + * @module material.core.aria + * + * @description + * + * Modify options of the `$mdAria` service, which will be used by most of the AngularJS Material + * components. + * + * You are able to disable `$mdAria` warnings, by using the following markup. + * + * + * app.config(function($mdAriaProvider) { + * // Globally disables all ARIA warnings. + * $mdAriaProvider.disableWarnings(); + * }); + * + * + */ +function MdAriaProvider() { + + var config = { + /** Whether we should show ARIA warnings in the console if labels are missing on the element */ + showWarnings: true + }; + + return { + disableWarnings: disableWarnings, + $get: ["$$rAF", "$log", "$window", "$interpolate", function($$rAF, $log, $window, $interpolate) { + return MdAriaService.apply(config, arguments); + }] + }; + + /** + * @ngdoc method + * @name $mdAriaProvider#disableWarnings + * @description Disables all ARIA warnings generated by AngularJS Material. + */ + function disableWarnings() { + config.showWarnings = false; + } +} + +/* + * @ngInject + */ +function MdAriaService($$rAF, $log, $window, $interpolate) { + + // Load the showWarnings option from the current context and store it inside of a scope variable, + // because the context will be probably lost in some function calls. + var showWarnings = this.showWarnings; + + return { + expect: expect, + expectAsync: expectAsync, + expectWithText: expectWithText, + expectWithoutText: expectWithoutText, + getText: getText, + hasAriaLabel: hasAriaLabel, + parentHasAriaLabel: parentHasAriaLabel + }; + + /** + * Check if expected attribute has been specified on the target element or child + * @param {string|JQLite} element + * @param {string} attrName + * @param {string=} defaultValue What to set the attr to if no value is found + */ + function expect(element, attrName, defaultValue) { + + var node = angular.element(element)[0] || element; + + // if node exists and neither it nor its children have the attribute + if (node && + ((!node.hasAttribute(attrName) || + node.getAttribute(attrName).length === 0) && + !childHasAttribute(node, attrName))) { + + defaultValue = angular.isString(defaultValue) ? defaultValue.trim() : ''; + if (defaultValue.length) { + element.attr(attrName, defaultValue); + } else if (showWarnings) { + $log.warn('ARIA: Attribute "', attrName, '", required for accessibility, is missing on node:', node); + } + + } + } + + function expectAsync(element, attrName, defaultValueGetter) { + // Problem: when retrieving the element's contents synchronously to find the label, + // the text may not be defined yet in the case of a binding. + // There is a higher chance that a binding will be defined if we wait one frame. + $$rAF(function() { + expect(element, attrName, defaultValueGetter()); + }); + } + + function expectWithText(element, attrName) { + var content = getText(element) || ""; + var hasBinding = content.indexOf($interpolate.startSymbol()) > -1; + + if (hasBinding) { + expectAsync(element, attrName, function() { + return getText(element); + }); + } else { + expect(element, attrName, content); + } + } + + function expectWithoutText(element, attrName) { + var content = getText(element); + var hasBinding = content.indexOf($interpolate.startSymbol()) > -1; + + if (!hasBinding && !content) { + expect(element, attrName, content); + } + } + + /** + * @param {Element|JQLite} element + * @returns {string} + */ + function getText(element) { + element = element[0] || element; + var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT, null, false); + var text = ''; + + var node; + while (node = walker.nextNode()) { + if (!isAriaHiddenNode(node)) { + text += node.textContent; + } + } + + return text.trim() || ''; + + /** + * @param {Node} node + * @returns {boolean} + */ + function isAriaHiddenNode(node) { + while (node.parentNode && (node = node.parentNode) !== element) { + if (node.getAttribute && node.getAttribute('aria-hidden') === 'true') { + return true; + } + } + } + } + + function childHasAttribute(node, attrName) { + var hasChildren = node.hasChildNodes(), + hasAttr = false; + + function isHidden(el) { + var style = el.currentStyle ? el.currentStyle : $window.getComputedStyle(el); + return (style.display === 'none'); + } + + if (hasChildren) { + var children = node.childNodes; + for (var i=0; i < children.length; i++) { + var child = children[i]; + if (child.nodeType === 1 && child.hasAttribute(attrName)) { + if (!isHidden(child)) { + hasAttr = true; + } + } + } + } + return hasAttr; + } + + /** + * Check if expected element has aria label attribute + * @param element + */ + function hasAriaLabel(element) { + var node = angular.element(element)[0] || element; + + /* Check if compatible node type (ie: not HTML Document node) */ + if (!node.hasAttribute) { + return false; + } + + /* Check label or description attributes */ + return node.hasAttribute('aria-label') || node.hasAttribute('aria-labelledby') || node.hasAttribute('aria-describedby'); + } + + /** + * Check if expected element's parent has aria label attribute and has valid role and tagName + * @param {string|JQLite|Node & ParentNode} element + * @param {number=} level Number of levels deep search should be performed + */ + function parentHasAriaLabel(element, level) { + level = level || 1; + var node = angular.element(element)[0] || element; + if (!node.parentNode) { + return false; + } + if (performCheck(node.parentNode)) { + return true; + } + level--; + if (level) { + return parentHasAriaLabel(node.parentNode, level); + } + return false; + + function performCheck(parentNode) { + if (!hasAriaLabel(parentNode)) { + return false; + } + /* Perform role block-list check */ + if (parentNode.hasAttribute('role')) { + switch (parentNode.getAttribute('role').toLowerCase()) { + case 'command': + case 'definition': + case 'directory': + case 'grid': + case 'list': + case 'listitem': + case 'log': + case 'marquee': + case 'menu': + case 'menubar': + case 'note': + case 'presentation': + case 'separator': + case 'scrollbar': + case 'status': + case 'tablist': + return false; + } + } + /* Perform tagName block-list check */ + switch (parentNode.tagName.toLowerCase()) { + case 'abbr': + case 'acronym': + case 'address': + case 'applet': + case 'audio': + case 'b': + case 'bdi': + case 'bdo': + case 'big': + case 'blockquote': + case 'br': + case 'canvas': + case 'caption': + case 'center': + case 'cite': + case 'code': + case 'col': + case 'data': + case 'dd': + case 'del': + case 'dfn': + case 'dir': + case 'div': + case 'dl': + case 'em': + case 'embed': + case 'fieldset': + case 'figcaption': + case 'font': + case 'h1': + case 'h2': + case 'h3': + case 'h4': + case 'h5': + case 'h6': + case 'hgroup': + case 'html': + case 'i': + case 'ins': + case 'isindex': + case 'kbd': + case 'keygen': + case 'label': + case 'legend': + case 'li': + case 'map': + case 'mark': + case 'menu': + case 'object': + case 'ol': + case 'output': + case 'pre': + case 'presentation': + case 'q': + case 'rt': + case 'ruby': + case 'samp': + case 'small': + case 'source': + case 'span': + case 'status': + case 'strike': + case 'strong': + case 'sub': + case 'sup': + case 'svg': + case 'tbody': + case 'td': + case 'th': + case 'thead': + case 'time': + case 'tr': + case 'track': + case 'tt': + case 'ul': + case 'var': + return false; + } + return true; + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.compiler + * @description + * AngularJS Material template and element compiler. + */ +angular + .module('material.core') + .provider('$mdCompiler', MdCompilerProvider); + +MdCompilerProvider.$inject = ['$compileProvider']; +function MdCompilerProvider() { + + this.$get = ["$q", "$templateRequest", "$injector", "$compile", "$controller", + function($q, $templateRequest, $injector, $compile, $controller) { + return new MdCompilerService($q, $templateRequest, $injector, $compile, $controller); + }]; + + /** + * @ngdoc service + * @name $mdCompiler + * @module material.core.compiler + * @description + * The $mdCompiler service is an abstraction of AngularJS's compiler, that allows developers + * to compile an element with options like in a Directive Definition Object. + * + * > The compiler powers a lot of components inside of AngularJS Material. + * > Like the `$mdPanel` or `$mdDialog` services. + * + * @usage + * + * Basic Usage with a template + * + * + * $mdCompiler.compile({ + * templateUrl: 'modal.html', + * controller: 'ModalCtrl', + * locals: { + * modal: myModalInstance; + * } + * }).then(function (compileData) { + * compileData.element; // Compiled DOM element + * compileData.link(myScope); // Instantiate controller and link element to scope. + * }); + * + * + * Example with a content element + * + * + * + * // Create a virtual element and link it manually. + * // The compiler doesn't need to recompile the element each time. + * var myElement = $compile('Test')(myScope); + * + * $mdCompiler.compile({ + * contentElement: myElement + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + * > Content Element is a significant performance improvement when the developer already knows + * > that the compiled element will be always the same and the scope will not change either. + * + * The `contentElement` option also supports DOM elements which will be temporary removed and + * restored at its old position. + * + * + * var domElement = document.querySelector('#myElement'); + * + * $mdCompiler.compile({ + * contentElement: myElement + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + * The `$mdCompiler` can also query for the element in the DOM itself. + * + * + * $mdCompiler.compile({ + * contentElement: '#myElement' + * }).then(function (compileData) { + * compileData.element // Content Element (same as above) + * compileData.link // This does nothing when using a contentElement. + * }); + * + * + */ + function MdCompilerService($q, $templateRequest, $injector, $compile, $controller) { + + /** + * @private @const + * @type {!IQService} + */ + this.$q = $q; + + /** + * @private @const + * @type {!ITemplateRequestService} + */ + this.$templateRequest = $templateRequest; + + /** + * @private @const + * @type {!IInjectorService} + */ + this.$injector = $injector; + + /** + * @private @const + * @type{!ICompileService} + */ + this.$compile = $compile; + + /** + * @private @const + * @type {!IControllerService} + */ + this.$controller = $controller; + } + + /** + * @ngdoc method + * @name $mdCompiler#compile + * @description + * + * A method to compile a HTML template with the AngularJS compiler. + * The `$mdCompiler` is wrapper around the AngularJS compiler and provides extra functionality + * like controller instantiation or async resolves. + * + * @param {!Object} options An options object, with the following properties: + * + * - `controller` - `{string|function}` Controller fn that should be associated with + * newly created scope or the name of a registered controller if passed as a string. + * - `controllerAs` - `{string=}` A controller alias name. If present the controller will be + * published to scope under the `controllerAs` name. + * - `contentElement` - `{string|Element}`: Instead of using a template, which will be + * compiled each time, you can also use a DOM element.
    + * - `template` - `{string=}` An html template as a string. + * - `templateUrl` - `{string=}` A path to an html template. + * - `transformTemplate` - `{function(template)=}` A function which transforms the template after + * it is loaded. It will be given the template string as a parameter, and should + * return a a new string representing the transformed template. + * - `resolve` - `{Object.=}` - An optional map of dependencies which should + * be injected into the controller. If any of these dependencies are promises, the compiler + * will wait for them all to be resolved, or if one is rejected before the controller is + * instantiated `compile()` will fail.. + * * `key` - `{string}`: a name of a dependency to be injected into the controller. + * * `factory` - `{string|function}`: If `string` then it is an alias for a service. + * Otherwise if function, then it is injected and the return value is treated as the + * dependency. If the result is a promise, it is resolved before its value is + * injected into the controller. + * + * @returns {Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any, + * controller: Object=}>} promise A promise, which will be resolved with a `compileData` object. + * `compileData` has the following properties: + * + * - `element` - `{JQLite}`: an uncompiled element matching the provided template. + * - `link` - `{function(scope)}`: A link function, which, when called, will compile + * the element and instantiate the provided controller (if given). + * - `locals` - `{Object}`: The locals which will be passed into the controller once `link` is + * called. If `bindToController` is true, they will be copied to the ctrl instead + */ + MdCompilerService.prototype.compile = function(options) { + if (options.contentElement) { + return this._prepareContentElement(options); + } else { + return this._compileTemplate(options); + } + }; + + /** + * Instead of compiling any template, the compiler just fetches an existing HTML element from the + * DOM and provides a restore function to put the element back it old DOM position. + * @param {!Object} options Options to be used for the compiler. + * @returns {Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any}>} + */ + MdCompilerService.prototype._prepareContentElement = function(options) { + + var contentElement = this._fetchContentElement(options); + + return this.$q.resolve({ + element: contentElement.element, + cleanup: contentElement.restore, + locals: {}, + link: function() { + return contentElement.element; + } + }); + + }; + + /** + * Compiles a template by considering all options and waiting for all resolves to be ready. + * @param {!Object} options Compile options + * @returns {!Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any}>} Compile + * data with link function. + */ + MdCompilerService.prototype._compileTemplate = function(options) { + + var self = this; + var templateUrl = options.templateUrl; + var template = options.template || ''; + var resolve = angular.extend({}, options.resolve); + var locals = angular.extend({}, options.locals); + var transformTemplate = options.transformTemplate || angular.identity; + + // Take resolve values and invoke them. + // Resolves can either be a string (value: 'MyRegisteredAngularConst'), + // or an invokable 'factory' of sorts: (value: function ValueGetter($dependency) {}) + angular.forEach(resolve, function(value, key) { + if (angular.isString(value)) { + resolve[key] = self.$injector.get(value); + } else { + resolve[key] = self.$injector.invoke(value); + } + }); + + // Add the locals, which are just straight values to inject + // eg locals: { three: 3 }, will inject three into the controller + angular.extend(resolve, locals); + + if (templateUrl) { + resolve.$$ngTemplate = this.$templateRequest(templateUrl); + } else { + resolve.$$ngTemplate = this.$q.when(template); + } + + + // Wait for all the resolves to finish if they are promises + return this.$q.all(resolve).then(function(locals) { + + var template = transformTemplate(locals.$$ngTemplate, options); + var element = options.element || angular.element('
    ').html(template.trim()).contents(); + + return self._compileElement(locals, element, options); + }); + + }; + + /** + * Method to compile an element with the given options. + * @param {!Object} locals Locals to be injected to the controller if present + * @param {!JQLite} element Element to be compiled and linked + * @param {!Object} options Options to be used for linking. + * @returns {!{element: JQLite, link: Function, locals: Object, cleanup: any, controller: Object}} Compile data with link function. + */ + MdCompilerService.prototype._compileElement = function(locals, element, options) { + var self = this; + var ngLinkFn = this.$compile(element); + + var compileData = { + element: element, + cleanup: element.remove.bind(element), + locals: locals, + link: linkFn + }; + + function linkFn(scope) { + locals.$scope = scope; + + // Instantiate controller if the developer provided one. + if (options.controller) { + + var injectLocals = angular.extend({}, locals, { + $element: element + }); + + // Create the specified controller instance. + var ctrl = self._createController(options, injectLocals, locals); + + // Registering extra $destroy listeners should be avoided. + // Only register the listener if the controller implements a $onDestroy hook. + if (angular.isFunction(ctrl.$onDestroy)) { + scope.$on('$destroy', function() { + // Call the $onDestroy hook if it's present on the controller. + angular.isFunction(ctrl.$onDestroy) && ctrl.$onDestroy(); + }); + } + + // Unique identifier for AngularJS Route ngView controllers. + element.data('$ngControllerController', ctrl); + element.children().data('$ngControllerController', ctrl); + + // Expose the instantiated controller to the compile data + compileData.controller = ctrl; + } + + // Invoke the AngularJS $compile link function. + return ngLinkFn(scope); + } + + return compileData; + + }; + + /** + * Creates and instantiates a new controller with the specified options. + * @param {!Object} options Options that include the controller function or string. + * @param {!Object} injectLocals Locals to to be provided in the controller DI. + * @param {!Object} locals Locals to be injected to the controller. + * @returns {!Object} Created controller instance. + */ + MdCompilerService.prototype._createController = function(options, injectLocals, locals) { + var ctrl = this.$controller(options.controller, injectLocals); + + if (options.bindToController) { + angular.extend(ctrl, locals); + } + + if (options.controllerAs) { + injectLocals.$scope[options.controllerAs] = ctrl; + } + + // Call the $onInit hook if it's present on the controller. + angular.isFunction(ctrl.$onInit) && ctrl.$onInit(); + + return ctrl; + }; + + /** + * Fetches an element removing it from the DOM and using it temporary for the compiler. + * Elements which were fetched will be restored after use. + * @param {!Object} options Options to be used for the compilation. + * @returns {{element: !JQLite, restore: !function}} + */ + MdCompilerService.prototype._fetchContentElement = function(options) { + var contentEl = options.contentElement; + var restoreFn; + + if (angular.isString(contentEl)) { + contentEl = document.querySelector(contentEl); + restoreFn = createRestoreFn(contentEl); + } else { + contentEl = contentEl[0] || contentEl; + + // When the element is visible in the DOM, then we restore it at close of the dialog. + // Otherwise it will be removed from the DOM after close. + if (document.contains(contentEl)) { + restoreFn = createRestoreFn(contentEl); + } else { + restoreFn = function() { + if (contentEl.parentNode) { + contentEl.parentNode.removeChild(contentEl); + } + }; + } + } + + return { + element: angular.element(contentEl), + restore: restoreFn + }; + + function createRestoreFn(element) { + var parent = element.parentNode; + var nextSibling = element.nextElementSibling; + + return function() { + if (!nextSibling) { + // When the element didn't had any sibling, then it can be simply appended to the + // parent, because it plays no role, which index it had before. + parent.appendChild(element); + } else { + // When the element had a sibling, which marks the previous position of the element + // in the DOM, we insert it correctly before the sibling, to have the same index as + // before. + parent.insertBefore(element, nextSibling); + } + }; + } + }; +} + + +})(); +(function(){ +"use strict"; + + +MdGesture.$inject = ["$$MdGestureHandler", "$$rAF", "$timeout", "$mdUtil"]; +attachToDocument.$inject = ["$mdGesture", "$$MdGestureHandler", "$mdUtil"];var HANDLERS = {}; + +/** + * The state of the current 'pointer'. The pointer represents the state of the current touch. + * It contains normalized x and y coordinates from DOM events, + * as well as other information abstracted from the DOM. + */ +var pointer, lastPointer, maxClickDistance = 6; +var forceSkipClickHijack = false, disableAllGestures = false; + +/** + * The position of the most recent click if that click was on a label element. + * @type {{x: number, y: number}|null} + */ +var lastLabelClickPos = null; + +/** + * Used to attach event listeners once when multiple ng-apps are running. + * @type {boolean} + */ +var isInitialized = false; + +/** + * @ngdoc module + * @name material.core.gestures + * @description + * AngularJS Material Gesture handling for touch devices. + * This module replaced the usage of the HammerJS library. + */ +angular + .module('material.core.gestures', []) + .provider('$mdGesture', MdGestureProvider) + .factory('$$MdGestureHandler', MdGestureHandler) + .run(attachToDocument); + +/** + * @ngdoc service + * @name $mdGestureProvider + * @module material.core.gestures + * + * @description + * In some scenarios on mobile devices (without jQuery), the click events should NOT be hijacked. + * `$mdGestureProvider` is used to configure the Gesture module to ignore or skip click hijacking + * on mobile devices. + * + * You can also change the max click distance, `6px` by default, if you have issues on some touch + * screens. + * + * + * app.config(function($mdGestureProvider) { + * + * // For mobile devices without jQuery loaded, do not + * // intercept click events during the capture phase. + * $mdGestureProvider.skipClickHijack(); + * + * // If hijacking clicks, you may want to change the default click distance + * $mdGestureProvider.setMaxClickDistance(12); + * }); + * + * + */ +function MdGestureProvider() { } + +MdGestureProvider.prototype = { + + /** + * @ngdoc method + * @name $mdGestureProvider#disableAll + * + * @description + * Disable all gesture detection. This can be beneficial to application performance + * and memory usage. + */ + disableAll: function () { + disableAllGestures = true; + }, + + // Publish access to setter to configure a variable BEFORE the + // $mdGesture service is instantiated... + /** + * @ngdoc method + * @name $mdGestureProvider#skipClickHijack + * + * @description + * Tell the AngularJS Material Gesture module to skip (or ignore) click hijacking on mobile devices. + */ + skipClickHijack: function() { + return forceSkipClickHijack = true; + }, + + /** + * @ngdoc method + * @name $mdGestureProvider#setMaxClickDistance + * @param clickDistance {string} Distance in pixels. I.e. `12px`. + * @description + * Set the max distance from the origin of the touch event to trigger touch handlers. + */ + setMaxClickDistance: function(clickDistance) { + maxClickDistance = parseInt(clickDistance); + }, + + /** + * $get is used to build an instance of $mdGesture + * @ngInject + */ + $get : ["$$MdGestureHandler", "$$rAF", "$timeout", "$mdUtil", function($$MdGestureHandler, $$rAF, $timeout, $mdUtil) { + return new MdGesture($$MdGestureHandler, $$rAF, $timeout, $mdUtil); + }] +}; + + + +/** + * MdGesture factory construction function + * @ngInject + */ +function MdGesture($$MdGestureHandler, $$rAF, $timeout, $mdUtil) { + var touchActionProperty = $mdUtil.getTouchAction(); + var hasJQuery = (typeof __webpack_provided_window_dot_jQuery !== 'undefined') && (angular.element === __webpack_provided_window_dot_jQuery); + + var self = { + handler: addHandler, + register: register, + isAndroid: $mdUtil.isAndroid, + isIos: $mdUtil.isIos, + // On mobile w/out jQuery, we normally intercept clicks. Should we skip that? + isHijackingClicks: ($mdUtil.isIos || $mdUtil.isAndroid) && !hasJQuery && !forceSkipClickHijack + }; + + if (self.isHijackingClicks) { + self.handler('click', { + options: { + maxDistance: maxClickDistance + }, + onEnd: checkDistanceAndEmit('click') + }); + + self.handler('focus', { + options: { + maxDistance: maxClickDistance + }, + onEnd: function(ev, pointer) { + if (pointer.distance < this.state.options.maxDistance && canFocus(ev.target)) { + this.dispatchEvent(ev, 'focus', pointer); + ev.target.focus(); + } + } + }); + + self.handler('mouseup', { + options: { + maxDistance: maxClickDistance + }, + onEnd: checkDistanceAndEmit('mouseup') + }); + + self.handler('mousedown', { + onStart: function(ev) { + this.dispatchEvent(ev, 'mousedown'); + } + }); + } + + function checkDistanceAndEmit(eventName) { + return function(ev, pointer) { + if (pointer.distance < this.state.options.maxDistance) { + this.dispatchEvent(ev, eventName, pointer); + } + }; + } + + /** + * Register an element to listen for a handler. + * This allows an element to override the default options for a handler. + * Additionally, some handlers like drag and hold only dispatch events if + * the domEvent happens inside an element that's registered to listen for these events. + * + * @see GestureHandler for how overriding of default options works. + * @example $mdGesture.register(myElement, 'drag', { minDistance: 20, horizontal: false }) + */ + function register(element, handlerName, options) { + var handler = HANDLERS[handlerName.replace(/^\$md./, '')]; + if (!handler) { + throw new Error('Failed to register element with handler ' + handlerName + '. ' + + 'Available handlers: ' + Object.keys(HANDLERS).join(', ')); + } + return handler.registerElement(element, options); + } + + /* + * add a handler to $mdGesture. see below. + */ + function addHandler(name, definition) { + var handler = new $$MdGestureHandler(name); + angular.extend(handler, definition); + HANDLERS[name] = handler; + + return self; + } + + /** + * Register handlers. These listen to touch/start/move events, interpret them, + * and dispatch gesture events depending on options & conditions. These are all + * instances of GestureHandler. + * @see GestureHandler + */ + return self + /* + * The press handler dispatches an event on touchdown/touchend. + * It's a simple abstraction of touch/mouse/pointer start and end. + */ + .handler('press', { + onStart: function (ev, pointer) { + this.dispatchEvent(ev, '$md.pressdown'); + }, + onEnd: function (ev, pointer) { + this.dispatchEvent(ev, '$md.pressup'); + } + }) + + /* + * The hold handler dispatches an event if the user keeps their finger within + * the same area for ms. + * The hold handler will only run if a parent of the touch target is registered + * to listen for hold events through $mdGesture.register() + */ + .handler('hold', { + options: { + maxDistance: 6, + delay: 500 + }, + onCancel: function () { + $timeout.cancel(this.state.timeout); + }, + onStart: function (ev, pointer) { + // For hold, require a parent to be registered with $mdGesture.register() + // Because we prevent scroll events, this is necessary. + if (!this.state.registeredParent) return this.cancel(); + + this.state.pos = {x: pointer.x, y: pointer.y}; + this.state.timeout = $timeout(angular.bind(this, function holdDelayFn() { + this.dispatchEvent(ev, '$md.hold'); + this.cancel(); // we're done! + }), this.state.options.delay, false); + }, + onMove: function (ev, pointer) { + // Don't scroll while waiting for hold. + // If we don't preventDefault touchmove events here, Android will assume we don't + // want to listen to anymore touch events. It will start scrolling and stop sending + // touchmove events. + if (!touchActionProperty && ev.type === 'touchmove') ev.preventDefault(); + + // If the user moves greater than pixels, stop the hold timer + // set in onStart + var dx = this.state.pos.x - pointer.x; + var dy = this.state.pos.y - pointer.y; + if (Math.sqrt(dx * dx + dy * dy) > this.options.maxDistance) { + this.cancel(); + } + }, + onEnd: function () { + this.onCancel(); + } + }) + + /* + * The drag handler dispatches a drag event if the user holds and moves his finger greater than + * px in the x or y direction, depending on options.horizontal. + * The drag will be cancelled if the user moves his finger greater than * in + * the perpendicular direction. Eg if the drag is horizontal and the user moves his finger * + * pixels vertically, this handler won't consider the move part of a drag. + */ + .handler('drag', { + options: { + minDistance: 6, + horizontal: true, + cancelMultiplier: 1.5 + }, + /** + * @param {angular.JQLite} element where touch action styles need to be adjusted + * @param {{horizontal: boolean}=} options object whose horizontal property can specify to + * apply 'pan-y' or 'pan-x' touch actions. + */ + onSetup: function(element, options) { + if (touchActionProperty) { + // We check for horizontal to be false, because otherwise we would overwrite the default opts. + this.oldTouchAction = element[0].style[touchActionProperty]; + element[0].style[touchActionProperty] = options.horizontal ? 'pan-y' : 'pan-x'; + } + }, + /** + * @param {angular.JQLite} element where styles need to be cleaned up + */ + onCleanup: function(element) { + if (this.oldTouchAction) { + element[0].style[touchActionProperty] = this.oldTouchAction; + } else { + element[0].style[touchActionProperty] = null; + } + }, + onStart: function (ev) { + // For drag, require a parent to be registered with $mdGesture.register() + if (!this.state.registeredParent) this.cancel(); + }, + onMove: function (ev, pointer) { + var shouldStartDrag, shouldCancel; + // Don't scroll while deciding if this touchmove qualifies as a drag event. + // If we don't preventDefault touchmove events here, Android will assume we don't + // want to listen to anymore touch events. It will start scrolling and stop sending + // touchmove events. + if (!touchActionProperty && ev.type === 'touchmove') ev.preventDefault(); + + if (!this.state.dragPointer) { + if (this.state.options.horizontal) { + shouldStartDrag = Math.abs(pointer.distanceX) > this.state.options.minDistance; + shouldCancel = Math.abs(pointer.distanceY) > this.state.options.minDistance * this.state.options.cancelMultiplier; + } else { + shouldStartDrag = Math.abs(pointer.distanceY) > this.state.options.minDistance; + shouldCancel = Math.abs(pointer.distanceX) > this.state.options.minDistance * this.state.options.cancelMultiplier; + } + + if (shouldStartDrag) { + // Create a new pointer representing this drag, starting at this point where the drag started. + this.state.dragPointer = makeStartPointer(ev); + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.dragstart', this.state.dragPointer); + + } else if (shouldCancel) { + this.cancel(); + } + } else { + this.dispatchDragMove(ev); + } + }, + // Only dispatch dragmove events every frame; any more is unnecessary + dispatchDragMove: $$rAF.throttle(function (ev) { + // Make sure the drag didn't stop while waiting for the next frame + if (this.state.isRunning) { + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.drag', this.state.dragPointer); + } + }), + onEnd: function (ev, pointer) { + if (this.state.dragPointer) { + updatePointerState(ev, this.state.dragPointer); + this.dispatchEvent(ev, '$md.dragend', this.state.dragPointer); + } + } + }) + + /* + * The swipe handler will dispatch a swipe event if, on the end of a touch, + * the velocity and distance were high enough. + */ + .handler('swipe', { + options: { + minVelocity: 0.65, + minDistance: 10 + }, + onEnd: function (ev, pointer) { + var eventType; + + if (Math.abs(pointer.velocityX) > this.state.options.minVelocity && + Math.abs(pointer.distanceX) > this.state.options.minDistance) { + eventType = pointer.directionX == 'left' ? '$md.swipeleft' : '$md.swiperight'; + this.dispatchEvent(ev, eventType); + } + else if (Math.abs(pointer.velocityY) > this.state.options.minVelocity && + Math.abs(pointer.distanceY) > this.state.options.minDistance) { + eventType = pointer.directionY == 'up' ? '$md.swipeup' : '$md.swipedown'; + this.dispatchEvent(ev, eventType); + } + } + }); +} + +/** + * MdGestureHandler + * A GestureHandler is an object which is able to dispatch custom dom events + * based on native dom {touch,pointer,mouse}{start,move,end} events. + * + * A gesture will manage its lifecycle through the start,move,end, and cancel + * functions, which are called by native dom events. + * + * A gesture has the concept of 'options' (eg. a swipe's required velocity), which can be + * overridden by elements registering through $mdGesture.register(). + */ +function GestureHandler (name) { + this.name = name; + this.state = {}; +} + +function MdGestureHandler() { + var hasJQuery = (typeof __webpack_provided_window_dot_jQuery !== 'undefined') && (angular.element === __webpack_provided_window_dot_jQuery); + + GestureHandler.prototype = { + options: {}, + // jQuery listeners don't work with custom DOMEvents, so we have to dispatch events + // differently when jQuery is loaded + dispatchEvent: hasJQuery ? jQueryDispatchEvent : nativeDispatchEvent, + + // These are overridden by the registered handler + onSetup: angular.noop, + onCleanup: angular.noop, + onStart: angular.noop, + onMove: angular.noop, + onEnd: angular.noop, + onCancel: angular.noop, + + // onStart sets up a new state for the handler, which includes options from the + // nearest registered parent element of ev.target. + start: function (ev, pointer) { + if (this.state.isRunning) return; + var parentTarget = this.getNearestParent(ev.target); + // Get the options from the nearest registered parent + var parentTargetOptions = parentTarget && parentTarget.$mdGesture[this.name] || {}; + + this.state = { + isRunning: true, + // Override the default options with the nearest registered parent's options + options: angular.extend({}, this.options, parentTargetOptions), + // Pass in the registered parent node to the state so the onStart listener can use + registeredParent: parentTarget + }; + this.onStart(ev, pointer); + }, + move: function (ev, pointer) { + if (!this.state.isRunning) return; + this.onMove(ev, pointer); + }, + end: function (ev, pointer) { + if (!this.state.isRunning) return; + this.state.isRunning = false; + this.onEnd(ev, pointer); + }, + cancel: function (ev, pointer) { + this.onCancel(ev, pointer); + this.state = {}; + }, + + // Find and return the nearest parent element that has been registered to + // listen for this handler via $mdGesture.register(element, 'handlerName'). + getNearestParent: function (node) { + var current = node; + while (current) { + if ((current.$mdGesture || {})[this.name]) { + return current; + } + current = current.parentNode; + } + return null; + }, + + // Called from $mdGesture.register when an element registers itself with a handler. + // Store the options the user gave on the DOMElement itself. These options will + // be retrieved with getNearestParent when the handler starts. + registerElement: function (element, options) { + var self = this; + element[0].$mdGesture = element[0].$mdGesture || {}; + element[0].$mdGesture[this.name] = options || {}; + element.on('$destroy', onDestroy); + + self.onSetup(element, options || {}); + + return onDestroy; + + function onDestroy() { + delete element[0].$mdGesture[self.name]; + element.off('$destroy', onDestroy); + + self.onCleanup(element, options || {}); + } + } + }; + + return GestureHandler; + + /** + * Dispatch an event with jQuery + * TODO: Make sure this sends bubbling events + * + * @param srcEvent the original DOM touch event that started this. + * @param eventType the name of the custom event to send (eg 'click' or '$md.drag') + * @param eventPointer the pointer object that matches this event. + */ + function jQueryDispatchEvent(srcEvent, eventType, eventPointer) { + eventPointer = eventPointer || pointer; + var eventObj = new angular.element.Event(eventType); + + eventObj.$material = true; + eventObj.pointer = eventPointer; + eventObj.srcEvent = srcEvent; + + angular.extend(eventObj, { + clientX: eventPointer.x, + clientY: eventPointer.y, + screenX: eventPointer.x, + screenY: eventPointer.y, + pageX: eventPointer.x, + pageY: eventPointer.y, + ctrlKey: srcEvent.ctrlKey, + altKey: srcEvent.altKey, + shiftKey: srcEvent.shiftKey, + metaKey: srcEvent.metaKey + }); + angular.element(eventPointer.target).trigger(eventObj); + } + + /** + * NOTE: nativeDispatchEvent is very performance sensitive. + * @param srcEvent the original DOM touch event that started this. + * @param eventType the name of the custom event to send (eg 'click' or '$md.drag') + * @param eventPointer the pointer object that matches this event. + */ + function nativeDispatchEvent(srcEvent, eventType, eventPointer) { + eventPointer = eventPointer || pointer; + var eventObj; + + if (eventType === 'click' || eventType === 'mouseup' || eventType === 'mousedown') { + if (typeof window.MouseEvent === "function") { + eventObj = new MouseEvent(eventType, { + bubbles: true, + cancelable: true, + screenX: Number(srcEvent.screenX), + screenY: Number(srcEvent.screenY), + clientX: Number(eventPointer.x), + clientY: Number(eventPointer.y), + ctrlKey: srcEvent.ctrlKey, + altKey: srcEvent.altKey, + shiftKey: srcEvent.shiftKey, + metaKey: srcEvent.metaKey, + button: srcEvent.button, + buttons: srcEvent.buttons, + relatedTarget: srcEvent.relatedTarget || null + }); + } else { + eventObj = document.createEvent('MouseEvents'); + // This has been deprecated + // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent + eventObj.initMouseEvent( + eventType, true, true, window, srcEvent.detail, + eventPointer.x, eventPointer.y, eventPointer.x, eventPointer.y, + srcEvent.ctrlKey, srcEvent.altKey, srcEvent.shiftKey, srcEvent.metaKey, + srcEvent.button, srcEvent.relatedTarget || null + ); + } + } else { + if (typeof window.CustomEvent === "function") { + eventObj = new CustomEvent(eventType, { + bubbles: true, + cancelable: true, + detail: {} + }); + } else { + // This has been deprecated + // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent + eventObj = document.createEvent('CustomEvent'); + eventObj.initCustomEvent(eventType, true, true, {}); + } + } + eventObj.$material = true; + eventObj.pointer = eventPointer; + eventObj.srcEvent = srcEvent; + eventPointer.target.dispatchEvent(eventObj); + } +} + +/** + * Attach Gestures: hook document and check shouldHijack clicks + * @ngInject + */ +function attachToDocument($mdGesture, $$MdGestureHandler, $mdUtil) { + if (disableAllGestures) { + return; + } + + if (!isInitialized && $mdGesture.isHijackingClicks) { + /* + * If hijack clicks is true, we preventDefault any click that wasn't + * sent by AngularJS Material. This is because on older Android & iOS, a false, or 'ghost', + * click event will be sent ~400ms after a touchend event happens. + * The only way to know if this click is real is to prevent any normal + * click events, and add a flag to events sent by material so we know not to prevent those. + * + * Two exceptions to click events that should be prevented are: + * - click events sent by the keyboard (eg form submit) + * - events that originate from an Ionic app + */ + document.addEventListener('click' , clickHijacker , true); + document.addEventListener('mouseup' , mouseInputHijacker, true); + document.addEventListener('mousedown', mouseInputHijacker, true); + document.addEventListener('focus' , mouseInputHijacker, true); + + isInitialized = true; + } + + function mouseInputHijacker(ev) { + var isKeyClick = !ev.clientX && !ev.clientY; + + if ( + !isKeyClick && + !ev.$material && + !ev.isIonicTap && + !isInputEventFromLabelClick(ev) && + (ev.type !== 'mousedown' || (!canFocus(ev.target) && !canFocus(document.activeElement))) + ) { + ev.preventDefault(); + ev.stopPropagation(); + } + } + + /** + * Ignore click events that don't come from AngularJS Material, Ionic, Input Label clicks, + * or key presses that generate click events. This helps to ignore the ghost tap events on + * older mobile browsers that get sent after a 300-400ms delay. + * @param ev MouseEvent or modified MouseEvent with $material, pointer, and other fields + */ + function clickHijacker(ev) { + var isKeyClick; + if ($mdUtil.isIos) { + isKeyClick = angular.isDefined(ev.webkitForce) && ev.webkitForce === 0; + } else { + isKeyClick = ev.clientX === 0 && ev.clientY === 0; + } + if (!isKeyClick && !ev.$material && !ev.isIonicTap && !isInputEventFromLabelClick(ev)) { + ev.preventDefault(); + ev.stopPropagation(); + lastLabelClickPos = null; + } else { + lastLabelClickPos = null; + if (ev.target.tagName.toLowerCase() === 'label') { + lastLabelClickPos = {x: ev.x, y: ev.y}; + } + } + } + + + // Listen to all events to cover all platforms. + var START_EVENTS = 'mousedown touchstart pointerdown'; + var MOVE_EVENTS = 'mousemove touchmove pointermove'; + var END_EVENTS = 'mouseup mouseleave touchend touchcancel pointerup pointercancel'; + + angular.element(document) + .on(START_EVENTS, gestureStart) + .on(MOVE_EVENTS, gestureMove) + .on(END_EVENTS, gestureEnd) + // For testing + .on('$$mdGestureReset', function gestureClearCache () { + lastPointer = pointer = null; + }); + + /** + * When a DOM event happens, run all registered gesture handlers' lifecycle + * methods which match the DOM event. + * Eg. when a 'touchstart' event happens, runHandlers('start') will call and + * run `handler.cancel()` and `handler.start()` on all registered handlers. + */ + function runHandlers(handlerEvent, event) { + var handler; + for (var name in HANDLERS) { + handler = HANDLERS[name]; + if (handler instanceof $$MdGestureHandler) { + + if (handlerEvent === 'start') { + // Run cancel to reset any handlers' state + handler.cancel(); + } + handler[handlerEvent](event, pointer); + } + } + } + + /* + * gestureStart vets if a start event is legitimate (and not part of a 'ghost click' from iOS/Android) + * If it is legitimate, we initiate the pointer state and mark the current pointer's type + * For example, for a touchstart event, mark the current pointer as a 'touch' pointer, so mouse events + * won't effect it. + */ + function gestureStart(ev) { + // If we're already touched down, abort + if (pointer) return; + + var now = +Date.now(); + + // iOS & old android bug: after a touch event, a click event is sent 350 ms later. + // If <400ms have passed, don't allow an event of a different type than the previous event + if (lastPointer && !typesMatch(ev, lastPointer) && (now - lastPointer.endTime < 1500)) { + return; + } + + pointer = makeStartPointer(ev); + + runHandlers('start', ev); + } + + /** + * If a move event happens of the right type, update the pointer and run all the move handlers. + * "of the right type": if a mousemove happens but our pointer started with a touch event, do + * nothing. + */ + function gestureMove(ev) { + if (!pointer || !typesMatch(ev, pointer)) return; + + updatePointerState(ev, pointer); + runHandlers('move', ev); + } + + /** + * If an end event happens of the right type, update the pointer, run endHandlers, and save the + * pointer as 'lastPointer'. + */ + function gestureEnd(ev) { + if (!pointer || !typesMatch(ev, pointer)) return; + + updatePointerState(ev, pointer); + pointer.endTime = +Date.now(); + + if (ev.type !== 'pointercancel') { + runHandlers('end', ev); + } + + lastPointer = pointer; + pointer = null; + } + +} + +// ******************** +// Module Functions +// ******************** + +/* + * Initiate the pointer. x, y, and the pointer's type. + */ +function makeStartPointer(ev) { + var point = getEventPoint(ev); + var startPointer = { + startTime: +Date.now(), + target: ev.target, + // 'p' for pointer events, 'm' for mouse, 't' for touch + type: ev.type.charAt(0) + }; + startPointer.startX = startPointer.x = point.pageX; + startPointer.startY = startPointer.y = point.pageY; + return startPointer; +} + +/* + * return whether the pointer's type matches the event's type. + * Eg if a touch event happens but the pointer has a mouse type, return false. + */ +function typesMatch(ev, pointer) { + return ev && pointer && ev.type.charAt(0) === pointer.type; +} + +/** + * Gets whether the given event is an input event that was caused by clicking on an + * associated label element. + * + * This is necessary because the browser will, upon clicking on a label element, fire an + * *extra* click event on its associated input (if any). mdGesture is able to flag the label + * click as with `$material` correctly, but not the second input click. + * + * In order to determine whether an input event is from a label click, we compare the (x, y) for + * the event to the (x, y) for the most recent label click (which is cleared whenever a non-label + * click occurs). Unfortunately, there are no event properties that tie the input and the label + * together (such as relatedTarget). + * + * @param {MouseEvent} event + * @returns {boolean} + */ +function isInputEventFromLabelClick(event) { + return lastLabelClickPos + && lastLabelClickPos.x === event.x + && lastLabelClickPos.y === event.y; +} + +/* + * Update the given pointer based upon the given DOMEvent. + * Distance, velocity, direction, duration, etc + */ +function updatePointerState(ev, pointer) { + var point = getEventPoint(ev); + var x = pointer.x = point.pageX; + var y = pointer.y = point.pageY; + + pointer.distanceX = x - pointer.startX; + pointer.distanceY = y - pointer.startY; + pointer.distance = Math.sqrt( + pointer.distanceX * pointer.distanceX + pointer.distanceY * pointer.distanceY + ); + + pointer.directionX = pointer.distanceX > 0 ? 'right' : pointer.distanceX < 0 ? 'left' : ''; + pointer.directionY = pointer.distanceY > 0 ? 'down' : pointer.distanceY < 0 ? 'up' : ''; + + pointer.duration = +Date.now() - pointer.startTime; + pointer.velocityX = pointer.distanceX / pointer.duration; + pointer.velocityY = pointer.distanceY / pointer.duration; +} + +/** + * Normalize the point where the DOM event happened whether it's touch or mouse. + * @returns point event obj with pageX and pageY on it. + */ +function getEventPoint(ev) { + ev = ev.originalEvent || ev; // support jQuery events + return (ev.touches && ev.touches[0]) || + (ev.changedTouches && ev.changedTouches[0]) || + ev; +} + +/** Checks whether an element can be focused. */ +function canFocus(element) { + return ( + !!element && + element.getAttribute('tabindex') !== '-1' && + !element.hasAttribute('disabled') && + ( + element.hasAttribute('tabindex') || + element.hasAttribute('href') || + element.isContentEditable || + ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA', 'VIDEO', 'AUDIO'].indexOf(element.nodeName) !== -1 + ) + ); +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.interaction + * @description + * User interaction detection to provide proper accessibility. + */ +MdInteractionService.$inject = ["$timeout", "$mdUtil", "$rootScope"]; +angular + .module('material.core.interaction', []) + .service('$mdInteraction', MdInteractionService); + + +/** + * @ngdoc service + * @name $mdInteraction + * @module material.core.interaction + * + * @description + * + * Service which keeps track of the last interaction type and validates them for several browsers. + * The service hooks into the document's body and listens for touch, mouse and keyboard events. + * + * The most recent interaction type can be retrieved by calling the `getLastInteractionType` method. + * + * Here is an example markup for using the interaction service. + * + * + * var lastType = $mdInteraction.getLastInteractionType(); + * + * if (lastType === 'keyboard') { + * // We only restore the focus for keyboard users. + * restoreFocus(); + * } + * + * + */ +function MdInteractionService($timeout, $mdUtil, $rootScope) { + this.$timeout = $timeout; + this.$mdUtil = $mdUtil; + this.$rootScope = $rootScope; + + // IE browsers can also trigger pointer events, which also leads to an interaction. + this.pointerEvent = 'MSPointerEvent' in window ? 'MSPointerDown' : 'PointerEvent' in window ? 'pointerdown' : null; + this.bodyElement = angular.element(document.body); + this.isBuffering = false; + this.bufferTimeout = null; + this.lastInteractionType = null; + this.lastInteractionTime = null; + this.inputHandler = this.onInputEvent.bind(this); + this.bufferedInputHandler = this.onBufferInputEvent.bind(this); + + // Type Mappings for the different events + // There will be three three interaction types + // `keyboard`, `mouse` and `touch` + // type `pointer` will be evaluated in `pointerMap` for IE Browser events + this.inputEventMap = { + 'keydown': 'keyboard', + 'mousedown': 'mouse', + 'mouseenter': 'mouse', + 'touchstart': 'touch', + 'pointerdown': 'pointer', + 'MSPointerDown': 'pointer' + }; + + // IE PointerDown events will be validated in `touch` or `mouse` + // Index numbers referenced here: https://msdn.microsoft.com/library/windows/apps/hh466130.aspx + this.iePointerMap = { + 2: 'touch', + 3: 'touch', + 4: 'mouse' + }; + + this.initializeEvents(); + this.$rootScope.$on('$destroy', this.deregister.bind(this)); +} + +/** + * Removes all event listeners created by $mdInteration on the + * body element. + */ +MdInteractionService.prototype.deregister = function() { + + this.bodyElement.off('keydown mousedown', this.inputHandler); + + if ('ontouchstart' in document.documentElement) { + this.bodyElement.off('touchstart', this.bufferedInputHandler); + } + + if (this.pointerEvent) { + this.bodyElement.off(this.pointerEvent, this.inputHandler); + } + +}; + +/** + * Initializes the interaction service, by registering all interaction events to the + * body element. + */ +MdInteractionService.prototype.initializeEvents = function() { + + this.bodyElement.on('keydown mousedown', this.inputHandler); + + if ('ontouchstart' in document.documentElement) { + this.bodyElement.on('touchstart', this.bufferedInputHandler); + } + + if (this.pointerEvent) { + this.bodyElement.on(this.pointerEvent, this.inputHandler); + } + +}; + +/** + * Event listener for normal interaction events, which should be tracked. + * @param event {MouseEvent|KeyboardEvent|PointerEvent|TouchEvent} + */ +MdInteractionService.prototype.onInputEvent = function(event) { + if (this.isBuffering) { + return; + } + + var type = this.inputEventMap[event.type]; + + if (type === 'pointer') { + type = this.iePointerMap[event.pointerType] || event.pointerType; + } + + this.lastInteractionType = type; + this.lastInteractionTime = this.$mdUtil.now(); +}; + +/** + * Event listener for interaction events which should be buffered (touch events). + * @param event {TouchEvent} + */ +MdInteractionService.prototype.onBufferInputEvent = function(event) { + this.$timeout.cancel(this.bufferTimeout); + + this.onInputEvent(event); + this.isBuffering = true; + + // The timeout of 650ms is needed to delay the touchstart, because otherwise the touch will call + // the `onInput` function multiple times. + this.bufferTimeout = this.$timeout(function() { + this.isBuffering = false; + }.bind(this), 650, false); + +}; + +/** + * @ngdoc method + * @name $mdInteraction#getLastInteractionType + * @description Retrieves the last interaction type triggered in body. + * @returns {string|null} Last interaction type. + */ +MdInteractionService.prototype.getLastInteractionType = function() { + return this.lastInteractionType; +}; + +/** + * @ngdoc method + * @name $mdInteraction#isUserInvoked + * @description Method to detect whether any interaction happened recently or not. + * @param {number=} checkDelay Time to check for any interaction to have been triggered. + * @returns {boolean} Whether there was any interaction or not. + */ +MdInteractionService.prototype.isUserInvoked = function(checkDelay) { + var delay = angular.isNumber(checkDelay) ? checkDelay : 15; + + // Check for any interaction to be within the specified check time. + return this.lastInteractionTime >= this.$mdUtil.now() - delay; +}; + +})(); +(function(){ +"use strict"; + +angular.module('material.core') + .provider('$$interimElement', InterimElementProvider); + +/** + * @ngdoc service + * @name $$interimElementProvider + * @module material.core.interimElement + * + * @description + * + * Factory that constructs `$$interimElement.$service` services. + * Used internally in material design for elements that appear on screen temporarily. + * The service provides a promise-like API for interacting with the temporary + * elements. + * + * + * app.service('$mdToast', function($$interimElement) { + * var $mdToast = $$interimElement(toastDefaultOptions); + * return $mdToast; + * }); + * + * + * @param {object=} defaultOptions Options used by default for the `show` method on the service. + * + * @returns {$$interimElement.$service} + */ + +function InterimElementProvider() { + InterimElementFactory.$inject = ["$document", "$q", "$rootScope", "$timeout", "$rootElement", "$animate", "$mdUtil", "$mdCompiler", "$mdTheming", "$injector", "$exceptionHandler"]; + createInterimElementProvider.$get = InterimElementFactory; + return createInterimElementProvider; + + /** + * Returns a new provider which allows configuration of a new interimElement + * service. Allows configuration of default options & methods for options, + * as well as configuration of 'preset' methods (eg dialog.basic(): basic is a preset method) + */ + function createInterimElementProvider(interimFactoryName) { + factory.$inject = ["$$interimElement", "$injector"]; + var EXPOSED_METHODS = ['onHide', 'onShow', 'onRemove']; + + var customMethods = {}; + var providerConfig = { + presets: {} + }; + + var provider = { + setDefaults: setDefaults, + addPreset: addPreset, + addMethod: addMethod, + $get: factory + }; + + /** + * all interim elements will come with the 'build' preset + */ + provider.addPreset('build', { + methods: ['controller', 'controllerAs', 'resolve', 'multiple', + 'template', 'templateUrl', 'themable', 'transformTemplate', 'parent', 'contentElement'] + }); + + return provider; + + /** + * Save the configured defaults to be used when the factory is instantiated + */ + function setDefaults(definition) { + providerConfig.optionsFactory = definition.options; + providerConfig.methods = (definition.methods || []).concat(EXPOSED_METHODS); + return provider; + } + + /** + * Add a method to the factory that isn't specific to any interim element operations + */ + function addMethod(name, fn) { + customMethods[name] = fn; + return provider; + } + + /** + * Save the configured preset to be used when the factory is instantiated + */ + function addPreset(name, definition) { + definition = definition || {}; + definition.methods = definition.methods || []; + definition.options = definition.options || function() { return {}; }; + + if (/^cancel|hide|show$/.test(name)) { + throw new Error("Preset '" + name + "' in " + interimFactoryName + " is reserved!"); + } + if (definition.methods.indexOf('_options') > -1) { + throw new Error("Method '_options' in " + interimFactoryName + " is reserved!"); + } + providerConfig.presets[name] = { + methods: definition.methods.concat(EXPOSED_METHODS), + optionsFactory: definition.options, + argOption: definition.argOption + }; + return provider; + } + + function addPresetMethod(presetName, methodName, method) { + providerConfig.presets[presetName][methodName] = method; + } + + /** + * Create a factory that has the given methods & defaults implementing interimElement + */ + /* @ngInject */ + function factory($$interimElement, $injector) { + var defaultMethods; + var defaultOptions; + var interimElementService = $$interimElement(); + + /* + * publicService is what the developer will be using. + * It has methods hide(), cancel(), show(), build(), and any other + * presets which were set during the config phase. + */ + var publicService = { + hide: interimElementService.hide, + cancel: interimElementService.cancel, + show: showInterimElement, + + // Special internal method to destroy an interim element without animations + // used when navigation changes causes a $scope.$destroy() action + destroy : destroyInterimElement + }; + + + defaultMethods = providerConfig.methods || []; + // This must be invoked after the publicService is initialized + defaultOptions = invokeFactory(providerConfig.optionsFactory, {}); + + // Copy over the simple custom methods + angular.forEach(customMethods, function(fn, name) { + publicService[name] = fn; + }); + + angular.forEach(providerConfig.presets, function(definition, name) { + var presetDefaults = invokeFactory(definition.optionsFactory, {}); + var presetMethods = (definition.methods || []).concat(defaultMethods); + + // Every interimElement built with a preset has a field called `$type`, + // which matches the name of the preset. + // Eg in preset 'confirm', options.$type === 'confirm' + angular.extend(presetDefaults, { $type: name }); + + // This creates a preset class which has setter methods for every + // method given in the `.addPreset()` function, as well as every + // method given in the `.setDefaults()` function. + // + // @example + // .setDefaults({ + // methods: ['hasBackdrop', 'clickOutsideToClose', 'escapeToClose', 'targetEvent'], + // options: dialogDefaultOptions + // }) + // .addPreset('alert', { + // methods: ['title', 'ok'], + // options: alertDialogOptions + // }) + // + // Set values will be passed to the options when interimElement.show() is called. + function Preset(opts) { + this._options = angular.extend({}, presetDefaults, opts); + } + angular.forEach(presetMethods, function(name) { + Preset.prototype[name] = function(value) { + this._options[name] = value; + return this; + }; + }); + + // Create shortcut method for one-linear methods + if (definition.argOption) { + var methodName = 'show' + name.charAt(0).toUpperCase() + name.slice(1); + publicService[methodName] = function(arg) { + var config = publicService[name](arg); + return publicService.show(config); + }; + } + + // eg $mdDialog.alert() will return a new alert preset + publicService[name] = function(arg) { + // If argOption is supplied, eg `argOption: 'content'`, then we assume + // if the argument is not an options object then it is the `argOption` option. + // + // @example `$mdToast.simple('hello')` // sets options.content to hello + // // because argOption === 'content' + if (arguments.length && definition.argOption && + !angular.isObject(arg) && !angular.isArray(arg)) { + + return (new Preset())[definition.argOption](arg); + + } else { + return new Preset(arg); + } + + }; + }); + + return publicService; + + /** + * + */ + function showInterimElement(opts) { + // opts is either a preset which stores its options on an _options field, + // or just an object made up of options + opts = opts || { }; + if (opts._options) opts = opts._options; + + return interimElementService.show( + angular.extend({}, defaultOptions, opts) + ); + } + + /** + * Special method to hide and destroy an interimElement WITHOUT + * any 'leave` or hide animations ( an immediate force hide/remove ) + * + * NOTE: This calls the onRemove() subclass method for each component... + * which must have code to respond to `options.$destroy == true` + */ + function destroyInterimElement(opts) { + return interimElementService.destroy(opts); + } + + /** + * Helper to call $injector.invoke with a local of the factory name for + * this provider. + * If an $mdDialog is providing options for a dialog and tries to inject + * $mdDialog, a circular dependency error will happen. + * We get around that by manually injecting $mdDialog as a local. + */ + function invokeFactory(factory, defaultVal) { + var locals = {}; + locals[interimFactoryName] = publicService; + return $injector.invoke(factory || function() { return defaultVal; }, {}, locals); + } + } + } + + /* @ngInject */ + function InterimElementFactory($document, $q, $rootScope, $timeout, $rootElement, $animate, + $mdUtil, $mdCompiler, $mdTheming, $injector, $exceptionHandler) { + return function createInterimElementService() { + var SHOW_CANCELLED = false; + + /** + * @ngdoc service + * @name $$interimElementProvider.$service + * + * @description + * A service used to control inserting and removing of an element from the DOM. + * It is used by $mdBottomSheet, $mdDialog, $mdToast, $mdMenu, $mdPanel, and $mdSelect. + */ + var service; + + var showPromises = []; // Promises for the interim's which are currently opening. + var hidePromises = []; // Promises for the interim's which are currently hiding. + var showingInterims = []; // Interim elements which are currently showing up. + + // Publish instance $$interimElement service; + return service = { + show: show, + hide: waitForInterim(hide), + cancel: waitForInterim(cancel), + destroy : destroy, + $injector_: $injector + }; + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#show + * @kind function + * + * @description + * Adds the `$interimElement` to the DOM and returns a special promise that will be resolved + * or rejected with hide or cancel, respectively. + * + * @param {Object} options map of options and values + * @returns {Promise} a Promise that will be resolved when hide() is called or rejected when + * cancel() is called. + */ + function show(options) { + options = options || {}; + var interimElement = new InterimElement(options || {}); + + // When an interim element is currently showing, we have to cancel it. + // Just hiding it, will resolve the InterimElement's promise, the promise should be + // rejected instead. + var hideAction = options.multiple ? $q.resolve() : $q.all(showPromises); + + if (!options.multiple) { + // Wait for all opening interim's to finish their transition. + hideAction = hideAction.then(function() { + // Wait for all closing and showing interim's to be completely closed. + var promiseArray = hidePromises.concat(showingInterims.map(service.cancel)); + return $q.all(promiseArray); + }); + } + + var showAction = hideAction.then(function() { + + return interimElement + .show() + .then(function () { + showingInterims.push(interimElement); + }) + .catch(function (reason) { + return reason; + }) + .finally(function() { + showPromises.splice(showPromises.indexOf(showAction), 1); + }); + + }); + + showPromises.push(showAction); + + // In AngularJS 1.6+, exceptions inside promises will cause a rejection. We need to handle + // the rejection and only log it if it's an error. + interimElement.deferred.promise.catch(function(fault) { + if (fault instanceof Error) { + $exceptionHandler(fault); + } + + return fault; + }); + + // Return a promise that will be resolved when the interim + // element is hidden or cancelled... + return interimElement.deferred.promise; + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#hide + * @kind function + * + * @description + * Removes the `$interimElement` from the DOM and resolves the Promise returned from `show()`. + * + * @param {*} reason Data used to resolve the Promise + * @param {object} options map of options and values + * @returns {Promise} a Promise that will be resolved after the element has been removed + * from the DOM. + */ + function hide(reason, options) { + options = options || {}; + + if (options.closeAll) { + // We have to make a shallow copy of the array, because otherwise the map will break. + return $q.all(showingInterims.slice().reverse().map(closeElement)); + } else if (options.closeTo !== undefined) { + return $q.all(showingInterims.slice(options.closeTo).map(closeElement)); + } + + // Hide the latest showing interim element. + return closeElement(showingInterims[showingInterims.length - 1]); + + /** + * @param {InterimElement} interim element to close + * @returns {Promise} + */ + function closeElement(interim) { + if (!interim) { + return $q.when(reason); + } + + var hideAction = interim + .remove(reason, false, options || { }) + .catch(function(reason) { return reason; }) + .finally(function() { + hidePromises.splice(hidePromises.indexOf(hideAction), 1); + }); + + showingInterims.splice(showingInterims.indexOf(interim), 1); + hidePromises.push(hideAction); + + return interim.deferred.promise; + } + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#cancel + * @kind function + * + * @description + * Removes the `$interimElement` from the DOM and rejects the Promise returned from `show()`. + * + * @param {*} reason Data used to resolve the Promise + * @param {object} options map of options and values + * @returns {Promise} Promise that will be resolved after the element has been removed + * from the DOM. + */ + function cancel(reason, options) { + var interim = showingInterims.pop(); + if (!interim) { + return $q.when(reason); + } + + var cancelAction = interim + .remove(reason, true, options || {}) + .catch(function(reason) { return reason; }) + .finally(function() { + hidePromises.splice(hidePromises.indexOf(cancelAction), 1); + }); + + hidePromises.push(cancelAction); + + // Since AngularJS 1.6.7, promises will be logged to $exceptionHandler when the promise + // is not handling the rejection. We create a pseudo catch handler, which will prevent the + // promise from being logged to the $exceptionHandler. + return interim.deferred.promise.catch(angular.noop); + } + + /** + * Creates a function to wait for at least one interim element to be available. + * @param callbackFn Function to be used as callback + * @returns {Function} + */ + function waitForInterim(callbackFn) { + return function() { + var fnArguments = arguments; + + if (!showingInterims.length) { + // When there are still interim's opening, then wait for the first interim element to + // finish its open animation. + if (showPromises.length) { + return showPromises[0].finally(function () { + return callbackFn.apply(service, fnArguments); + }); + } + + return $q.when("No interim elements currently showing up."); + } + + return callbackFn.apply(service, fnArguments); + }; + } + + /** + * @ngdoc method + * @name $$interimElementProvider.$service#destroy + * @kind function + * + * Special method to quick-remove the interim element without running animations. This is + * useful when the parent component has been or is being destroyed. + * + * Note: interim elements are in "interim containers". + */ + function destroy(targetEl) { + var interim = !targetEl ? showingInterims.shift() : null; + + var parentEl = angular.element(targetEl).length && angular.element(targetEl)[0].parentNode; + + if (parentEl) { + // Try to find the interim in the stack which corresponds to the supplied DOM element. + var filtered = showingInterims.filter(function(entry) { + return entry.options.element[0] === parentEl; + }); + + // Note: This function might be called when the element already has been removed, + // in which case we won't find any matches. + if (filtered.length) { + interim = filtered[0]; + showingInterims.splice(showingInterims.indexOf(interim), 1); + } + } + + return interim ? interim.remove(SHOW_CANCELLED, false, { '$destroy': true }) : + $q.when(SHOW_CANCELLED); + } + + /* + * Internal Interim Element Object + * Used internally to manage the DOM element and related data + */ + function InterimElement(options) { + var self, element, showAction = $q.when(true); + + options = configureScopeAndTransitions(options); + + return self = { + options : options, + deferred: $q.defer(), + show : createAndTransitionIn, + remove : transitionOutAndRemove + }; + + /** + * Compile, link, and show this interim element. Use optional autoHide and transition-in + * effects. + * @return {Q.Promise} + */ + function createAndTransitionIn() { + return $q(function(resolve, reject) { + + // Trigger onCompiling callback before the compilation starts. + // This is useful, when modifying options, which can be influenced by developers. + options.onCompiling && options.onCompiling(options); + + compileElement(options) + .then(function(compiledData) { + element = linkElement(compiledData, options); + + // Expose the cleanup function from the compiler. + options.cleanupElement = compiledData.cleanup; + + showAction = showElement(element, options, compiledData.controller) + .then(resolve, rejectAll); + }).catch(rejectAll); + + function rejectAll(fault) { + // Force the '$md.show()' promise to reject + self.deferred.reject(fault); + + // Continue rejection propagation + reject(fault); + } + }); + } + + /** + * After the show process has finished/rejected: + * - announce 'removing', + * - perform the transition-out, and + * - perform optional clean up scope. + */ + function transitionOutAndRemove(response, isCancelled, opts) { + + // abort if the show() and compile failed + if (!element) return $q.when(false); + + options = angular.extend(options || {}, opts || {}); + options.cancelAutoHide && options.cancelAutoHide(); + options.element.triggerHandler('$mdInterimElementRemove'); + + if (options.$destroy === true) { + + return hideElement(options.element, options).then(function(){ + (isCancelled && rejectAll(response)) || resolveAll(response); + }); + + } else { + $q.when(showAction).finally(function() { + hideElement(options.element, options).then(function() { + isCancelled ? rejectAll(response) : resolveAll(response); + }, rejectAll); + }); + + return self.deferred.promise; + } + + + /** + * The `show()` returns a promise that will be resolved when the interim + * element is hidden or cancelled... + */ + function resolveAll(response) { + self.deferred.resolve(response); + } + + /** + * Force the '$md.show()' promise to reject + */ + function rejectAll(fault) { + self.deferred.reject(fault); + } + } + + /** + * Prepare optional isolated scope and prepare $animate with default enter and leave + * transitions for the new element instance. + */ + function configureScopeAndTransitions(options) { + options = options || { }; + if (options.template) { + options.template = $mdUtil.processTemplate(options.template); + } + + return angular.extend({ + preserveScope: false, + cancelAutoHide : angular.noop, + scope: options.scope || $rootScope.$new(options.isolateScope), + + /** + * Default usage to enable $animate to transition-in; can be easily overridden via 'options' + */ + onShow: function transitionIn(scope, element, options) { + return $animate.enter(element, options.parent); + }, + + /** + * Default usage to enable $animate to transition-out; can be easily overridden via 'options' + */ + onRemove: function transitionOut(scope, element) { + // Element could be undefined if a new element is shown before + // the old one finishes compiling. + return element && $animate.leave(element) || $q.when(); + } + }, options); + + } + + /** + * Compile an element with a templateUrl, controller, and locals + * @param {Object} options + * @return {Q.Promise<{element: JQLite=, link: Function, locals: Object, cleanup: any=, + * controller: Object=}>} + */ + function compileElement(options) { + + var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null; + + return compiled || $q(function (resolve) { + resolve({ + locals: {}, + link: function () { + return options.element; + } + }); + }); + } + + /** + * Link an element with compiled configuration + * @param {{element: JQLite=, link: Function, locals: Object, controller: Object=}} compileData + * @param {Object} options + * @return {JQLite} + */ + function linkElement(compileData, options) { + angular.extend(compileData.locals, options); + + var element = compileData.link(options.scope); + + // Search for parent at insertion time, if not specified + options.element = element; + options.parent = findParent(element, options); + if (options.themable) $mdTheming(element); + + return element; + } + + /** + * Search for parent at insertion time, if not specified. + * @param {JQLite} element + * @param {Object} options + * @return {JQLite} + */ + function findParent(element, options) { + var parent = options.parent; + + // Search for parent at insertion time, if not specified + if (angular.isFunction(parent)) { + parent = parent(options.scope, element, options); + } else if (angular.isString(parent)) { + parent = angular.element($document[0].querySelector(parent)); + } else { + parent = angular.element(parent); + } + + // If parent querySelector/getter function fails, or it's just null, + // find a default. + if (!(parent || {}).length) { + var el; + if ($rootElement[0] && $rootElement[0].querySelector) { + el = $rootElement[0].querySelector(':not(svg) > body'); + } + if (!el) el = $rootElement[0]; + if (el.nodeName === '#comment') { + el = $document[0].body; + } + return angular.element(el); + } + + return parent; + } + + /** + * If auto-hide is enabled, start timer and prepare cancel function + */ + function startAutoHide() { + var autoHideTimer, cancelAutoHide = angular.noop; + + if (options.hideDelay) { + autoHideTimer = $timeout(service.hide, options.hideDelay) ; + cancelAutoHide = function() { + $timeout.cancel(autoHideTimer); + }; + } + + // Cache for subsequent use + options.cancelAutoHide = function() { + cancelAutoHide(); + options.cancelAutoHide = undefined; + }; + } + + /** + * Show the element (with transitions), notify complete and start optional auto hiding + * timer. + * @param {JQLite} element + * @param {Object} options + * @param {Object} controller + * @return {Q.Promise} + */ + function showElement(element, options, controller) { + // Trigger onShowing callback before the `show()` starts + var notifyShowing = options.onShowing || angular.noop; + // Trigger onComplete callback when the `show()` finishes + var notifyComplete = options.onComplete || angular.noop; + + // Necessary for consistency between AngularJS 1.5 and 1.6. + try { + // This fourth controller parameter is used by $mdDialog in beforeShow(). + notifyShowing(options.scope, element, options, controller); + } catch (e) { + return $q.reject(e); + } + + return $q(function (resolve, reject) { + try { + // Start transitionIn + $q.when(options.onShow(options.scope, element, options)) + .then(function () { + notifyComplete(options.scope, element, options); + startAutoHide(); + + resolve(element); + }, reject); + + } catch (e) { + reject(e.message); + } + }); + } + + function hideElement(element, options) { + var announceRemoving = options.onRemoving || angular.noop; + + return $q(function (resolve, reject) { + try { + // Start transitionIn + var action = $q.when(options.onRemove(options.scope, element, options) || true); + + // Trigger callback *before* the remove operation starts + announceRemoving(element, action); + + if (options.$destroy) { + // For $destroy, onRemove should be synchronous + resolve(element); + + if (!options.preserveScope && options.scope) { + // scope destroy should still be be done after the current digest is done + action.then(function() { options.scope.$destroy(); }); + } + } else { + // Wait until transition-out is done + action.then(function () { + if (!options.preserveScope && options.scope) { + options.scope.$destroy(); + } + + resolve(element); + }, reject); + } + } catch (e) { + reject(e.message); + } + }); + } + + } + }; + } +} + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + var $mdUtil, $interpolate, $log; + + var SUFFIXES = /(-gt)?-(sm|md|lg|print)/g; + var WHITESPACE = /\s+/g; + + var FLEX_OPTIONS = ['grow', 'initial', 'auto', 'none', 'noshrink', 'nogrow']; + var LAYOUT_OPTIONS = ['row', 'column']; + var ALIGNMENT_MAIN_AXIS= ["", "start", "center", "end", "stretch", "space-around", "space-between"]; + var ALIGNMENT_CROSS_AXIS= ["", "start", "center", "end", "stretch"]; + + var config = { + /** + * Enable directive attribute-to-class conversions + * Developers can use `` to quickly + * disable the Layout directives and prohibit the injection of Layout classNames + */ + enabled: true, + + /** + * List of mediaQuery breakpoints and associated suffixes + * [ + * { suffix: "sm", mediaQuery: "screen and (max-width: 599px)" }, + * { suffix: "md", mediaQuery: "screen and (min-width: 600px) and (max-width: 959px)" } + * ] + */ + breakpoints: [] + }; + + registerLayoutAPI(angular.module('material.core.layout', ['ng'])); + + /** + * registerLayoutAPI() + * + * The original AngularJS Material Layout solution used attribute selectors and CSS. + * + * ```html + *
    My Content
    + * ``` + * + * ```css + * [layout] { + * box-sizing: border-box; + * display:flex; + * } + * [layout=column] { + * flex-direction : column + * } + * ``` + * + * Use of attribute selectors creates significant performance impacts in some + * browsers... mainly IE. + * + * This module registers directives that allow the same layout attributes to be + * interpreted and converted to class selectors. The directive will add equivalent classes to + * each element that contains a Layout directive. + * + * ```html + *
    My Content
    + * ``` + * + * ```css + * .layout { + * box-sizing: border-box; + * display:flex; + * } + * .layout-column { + * flex-direction : column + * } + * ``` + */ + function registerLayoutAPI(module){ + var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; + var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; + + // NOTE: these are also defined in constants::MEDIA_PRIORITY and constants::MEDIA + var BREAKPOINTS = ["", "xs", "gt-xs", "sm", "gt-sm", "md", "gt-md", "lg", "gt-lg", "xl", "print"]; + var API_WITH_VALUES = ["layout", "flex", "flex-order", "flex-offset", "layout-align"]; + var API_NO_VALUES = ["show", "hide", "layout-padding", "layout-margin"]; + + + // Build directive registration functions for the standard Layout API... for all breakpoints. + angular.forEach(BREAKPOINTS, function(mqb) { + + // Attribute directives with expected, observable value(s) + angular.forEach(API_WITH_VALUES, function(name){ + var fullName = mqb ? name + "-" + mqb : name; + module.directive(directiveNormalize(fullName), attributeWithObserve(fullName)); + }); + + // Attribute directives with no expected value(s) + angular.forEach(API_NO_VALUES, function(name){ + var fullName = mqb ? name + "-" + mqb : name; + module.directive(directiveNormalize(fullName), attributeWithoutValue(fullName)); + }); + + }); + + // Register other, special directive functions for the Layout features: + module + .provider('$$mdLayout', function() { + // Publish internal service for Layouts + return { + $get : angular.noop, + validateAttributeValue : validateAttributeValue, + validateAttributeUsage : validateAttributeUsage, + /** + * Easy way to disable/enable the Layout API. + * When disabled, this stops all attribute-to-classname generations + */ + disableLayouts : function(isDisabled) { + config.enabled = (isDisabled !== true); + } + }; + }) + + .directive('mdLayoutCss' , disableLayoutDirective) + .directive('ngCloak' , buildCloakInterceptor('ng-cloak')) + + .directive('layoutWrap' , attributeWithoutValue('layout-wrap')) + .directive('layoutNowrap' , attributeWithoutValue('layout-nowrap')) + .directive('layoutNoWrap' , attributeWithoutValue('layout-no-wrap')) + .directive('layoutFill' , attributeWithoutValue('layout-fill')) + + // Determine if + .config(detectDisabledLayouts); + + /** + * Converts snake_case to camelCase. + * Also there is special case for Moz prefix starting with upper case letter. + * @param name Name to normalize + */ + function directiveNormalize(name) { + return name + .replace(PREFIX_REGEXP, '') + .replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { + return offset ? letter.toUpperCase() : letter; + }); + } + } + + + /** + * Detect if any of the HTML tags has a [md-layouts-disabled] attribute; + * If yes, then immediately disable all layout API features + * + * Note: this attribute should be specified on either the HTML or BODY tags + * @ngInject + */ + function detectDisabledLayouts() { + var isDisabled = !!document.querySelector('[md-layouts-disabled]'); + config.enabled = !isDisabled; + } + + /** + * Special directive that will disable ALL Layout conversions of layout + * attribute(s) to classname(s). + * + * + * + * + * + * ... + * + * + * Note: Using md-layout-css directive requires the developer to load the Material + * Layout Attribute stylesheet (which only uses attribute selectors): + * + * `angular-material.layout.css` + * + * Another option is to use the LayoutProvider to configure and disable the attribute + * conversions; this would obviate the use of the `md-layout-css` directive + */ + function disableLayoutDirective() { + // Return a 1x-only, first-match attribute directive + config.enabled = false; + + return { + restrict : 'A', + priority : '900' + }; + } + + /** + * Tail-hook ngCloak to delay the uncloaking while Layout transformers + * finish processing. Eliminates flicker with Material.Layouts + */ + function buildCloakInterceptor(className) { + return ['$timeout', function($timeout){ + return { + restrict : 'A', + priority : -10, // run after normal ng-cloak + compile : function(element) { + if (!config.enabled) return angular.noop; + + // Re-add the cloak + element.addClass(className); + + return function(scope, element) { + // Wait while layout injectors configure, then uncloak + // NOTE: $rAF does not delay enough... and this is a 1x-only event, + // $timeout is acceptable. + $timeout(function(){ + element.removeClass(className); + }, 10, false); + }; + } + }; + }]; + } + + + // ********************************************************************************* + // + // These functions create registration functions for AngularJS Material Layout attribute + // directives. This provides easy translation to switch AngularJS Material attribute selectors to + // CLASS selectors and directives; which has huge performance implications for IE Browsers. + // + // ********************************************************************************* + + /** + * Creates a directive registration function where a possible dynamic attribute + * value will be observed/watched. + * @param {string} className attribute name; eg `layout-gt-md` with value ="row" + */ + function attributeWithObserve(className) { + + return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) { + $mdUtil = _$mdUtil_; + $interpolate = _$interpolate_; + $log = _$log_; + + return { + restrict: 'A', + compile: function(element, attr) { + var linkFn; + if (config.enabled) { + // immediately replace static (non-interpolated) invalid values... + + validateAttributeUsage(className, attr, element, $log); + + validateAttributeValue(className, + getNormalizedAttrValue(className, attr, ""), + buildUpdateFn(element, className, attr) + ); + + linkFn = translateWithValueToCssClass; + } + + // Use for postLink to account for transforms after ng-transclude. + return linkFn || angular.noop; + } + }; + }]; + + /** + * Observe deprecated layout attributes and update the element's layout classes to match. + */ + function translateWithValueToCssClass(scope, element, attrs) { + var updateFn = updateClassWithValue(element, className, attrs); + var unwatch = attrs.$observe(attrs.$normalize(className), updateFn); + + updateFn(getNormalizedAttrValue(className, attrs, "")); + scope.$on("$destroy", function() { unwatch(); }); + } + } + + /** + * Creates a registration function for AngularJS Material Layout attribute directive. + * This is a `simple` transpose of attribute usage to class usage; where we ignore + * any attribute value. + */ + function attributeWithoutValue(className) { + return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) { + $mdUtil = _$mdUtil_; + $interpolate = _$interpolate_; + $log = _$log_; + + return { + restrict: 'A', + compile: function(element, attr) { + var linkFn; + if (config.enabled) { + // immediately replace static (non-interpolated) invalid values... + + validateAttributeValue(className, + getNormalizedAttrValue(className, attr, ""), + buildUpdateFn(element, className, attr) + ); + + translateToCssClass(null, element); + + // Use for postLink to account for transforms after ng-transclude. + linkFn = translateToCssClass; + } + + return linkFn || angular.noop; + } + }; + }]; + + /** + * Add transformed class selector. + */ + function translateToCssClass(scope, element) { + element.addClass(className); + } + } + + /** + * After link-phase, do NOT remove deprecated layout attribute selector. + * Instead watch the attribute so interpolated data-bindings to layout + * selectors will continue to be supported. + * + * $observe() the className and update with new class (after removing the last one) + * + * e.g. `layout="{{layoutDemo.direction}}"` will update... + * + * NOTE: The value must match one of the specified styles in the CSS. + * For example `flex-gt-md="{{size}}` where `scope.size == 47` will NOT work since + * only breakpoints for 0, 5, 10, 15... 100, 33, 34, 66, 67 are defined. + */ + function updateClassWithValue(element, className) { + var lastClass; + + return function updateClassFn(newValue) { + var value = validateAttributeValue(className, newValue || ""); + if (angular.isDefined(value)) { + if (lastClass) element.removeClass(lastClass); + lastClass = !value ? className : className + "-" + value.trim().replace(WHITESPACE, "-"); + element.addClass(lastClass); + } + }; + } + + /** + * Centralize warnings for known flexbox issues (especially IE-related issues) + */ + function validateAttributeUsage(className, attr, element, $log){ + var message, usage, url; + var nodeName = element[0].nodeName.toLowerCase(); + + switch (className.replace(SUFFIXES,"")) { + case "flex": + if ((nodeName === "md-button") || (nodeName === "fieldset")){ + // @see https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers + // Use
    wrapper inside (preferred) or outside + + usage = "<" + nodeName + " " + className + ">"; + url = "https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers"; + message = "Markup '{0}' may not work as expected in IE Browsers. Consult '{1}' for details."; + + $log.warn($mdUtil.supplant(message, [usage, url])); + } + } + } + + + /** + * For the Layout attribute value, validate or replace with default fallback value. + */ + function validateAttributeValue(className, value, updateFn) { + var origValue = value; + + if (!needsInterpolation(value)) { + switch (className.replace(SUFFIXES,"")) { + case 'layout' : + if (!findIn(value, LAYOUT_OPTIONS)) { + value = LAYOUT_OPTIONS[0]; // 'row'; + } + break; + + case 'flex' : + if (!findIn(value, FLEX_OPTIONS)) { + if (isNaN(value)) { + value = ''; + } + } + break; + + case 'flex-offset' : + case 'flex-order' : + if (!value || isNaN(+value)) { + value = '0'; + } + break; + + case 'layout-align' : + var axis = extractAlignAxis(value); + value = $mdUtil.supplant("{main}-{cross}",axis); + break; + + case 'layout-padding' : + case 'layout-margin' : + case 'layout-fill' : + case 'layout-wrap' : + case 'layout-nowrap' : + value = ''; + break; + } + + if (value !== origValue) { + (updateFn || angular.noop)(value); + } + } + + return value ? value.trim() : ""; + } + + /** + * Replace current attribute value with fallback value + */ + function buildUpdateFn(element, className, attrs) { + return function updateAttrValue(fallback) { + if (!needsInterpolation(fallback)) { + // Do not modify the element's attribute value; so + // uses '' will not + // be affected. Just update the attrs value. + attrs[attrs.$normalize(className)] = fallback; + } + }; + } + + /** + * See if the original value has interpolation symbols: + * e.g. flex-gt-md="{{triggerPoint}}" + */ + function needsInterpolation(value) { + return (value || "").indexOf($interpolate.startSymbol()) > -1; + } + + function getNormalizedAttrValue(className, attrs, defaultVal) { + var normalizedAttr = attrs.$normalize(className); + return attrs[normalizedAttr] ? attrs[normalizedAttr].trim().replace(WHITESPACE, "-") : + defaultVal || null; + } + + function findIn(item, list, replaceWith) { + item = replaceWith && item ? item.replace(WHITESPACE, replaceWith) : item; + + var found = false; + if (item) { + list.forEach(function(it) { + it = replaceWith ? it.replace(WHITESPACE, replaceWith) : it; + found = found || (it === item); + }); + } + return found; + } + + function extractAlignAxis(attrValue) { + var axis = { + main : "start", + cross: "stretch" + }, values; + + attrValue = (attrValue || ""); + + if (attrValue.indexOf("-") === 0 || attrValue.indexOf(" ") === 0) { + // For missing main-axis values + attrValue = "none" + attrValue; + } + + values = attrValue.toLowerCase().trim().replace(WHITESPACE, "-").split("-"); + if (values.length && (values[0] === "space")) { + // for main-axis values of "space-around" or "space-between" + values = [values[0]+"-"+values[1],values[2]]; + } + + if (values.length > 0) axis.main = values[0] || axis.main; + if (values.length > 1) axis.cross = values[1] || axis.cross; + + if (ALIGNMENT_MAIN_AXIS.indexOf(axis.main) < 0) axis.main = "start"; + if (ALIGNMENT_CROSS_AXIS.indexOf(axis.cross) < 0) axis.cross = "stretch"; + + return axis; + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.liveannouncer + * @description + * AngularJS Material Live Announcer to provide accessibility for Voice Readers. + */ +MdLiveAnnouncer.$inject = ["$timeout"]; +angular + .module('material.core') + .service('$mdLiveAnnouncer', MdLiveAnnouncer); + +/** + * @ngdoc service + * @name $mdLiveAnnouncer + * @module material.core.liveannouncer + * + * @description + * + * Service to announce messages to supported screenreaders. + * + * > The `$mdLiveAnnouncer` service is internally used for components to provide proper accessibility. + * + * + * module.controller('AppCtrl', function($mdLiveAnnouncer) { + * // Basic announcement (Polite Mode) + * $mdLiveAnnouncer.announce('Hey Google'); + * + * // Custom announcement (Assertive Mode) + * $mdLiveAnnouncer.announce('Hey Google', 'assertive'); + * }); + * + * + */ +function MdLiveAnnouncer($timeout) { + /** @private @const @type {!angular.$timeout} */ + this._$timeout = $timeout; + + /** @private @const @type {!HTMLElement} */ + this._liveElement = this._createLiveElement(); + + /** @private @const @type {!number} */ + this._announceTimeout = 100; +} + +/** + * @ngdoc method + * @name $mdLiveAnnouncer#announce + * @description Announces messages to supported screenreaders. + * @param {string} message Message to be announced to the screenreader + * @param {'off'|'polite'|'assertive'} politeness The politeness of the announcer element. + */ +MdLiveAnnouncer.prototype.announce = function(message, politeness) { + if (!politeness) { + politeness = 'polite'; + } + + var self = this; + + self._liveElement.textContent = ''; + self._liveElement.setAttribute('aria-live', politeness); + + // This 100ms timeout is necessary for some browser + screen-reader combinations: + // - Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout. + // - With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a + // second time without clearing and then using a non-zero delay. + // (using JAWS 17 at time of this writing). + self._$timeout(function() { + self._liveElement.textContent = message; + }, self._announceTimeout, false); +}; + +/** + * Creates a live announcer element, which listens for DOM changes and announces them + * to the screenreaders. + * @returns {!HTMLElement} + * @private + */ +MdLiveAnnouncer.prototype._createLiveElement = function() { + var liveEl = document.createElement('div'); + + liveEl.classList.add('md-visually-hidden'); + liveEl.setAttribute('role', 'status'); + liveEl.setAttribute('aria-atomic', 'true'); + liveEl.setAttribute('aria-live', 'polite'); + + document.body.appendChild(liveEl); + + return liveEl; +}; + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc service + * @name $$mdMeta + * @module material.core.meta + * + * @description + * + * A provider and a service that simplifies meta tags access + * + * Note: This is intended only for use with dynamic meta tags such as browser color and title. + * Tags that are only processed when the page is rendered (such as `charset`, and `http-equiv`) + * will not work since `$$mdMeta` adds the tags after the page has already been loaded. + * + * ```js + * app.config(function($$mdMetaProvider) { + * var removeMeta = $$mdMetaProvider.setMeta('meta-name', 'content'); + * var metaValue = $$mdMetaProvider.getMeta('meta-name'); // -> 'content' + * + * removeMeta(); + * }); + * + * app.controller('myController', function($$mdMeta) { + * var removeMeta = $$mdMeta.setMeta('meta-name', 'content'); + * var metaValue = $$mdMeta.getMeta('meta-name'); // -> 'content' + * + * removeMeta(); + * }); + * ``` + * + * @returns {$$mdMeta.$service} + * + */ +angular.module('material.core.meta', []) + .provider('$$mdMeta', function () { + var head = angular.element(document.head); + var metaElements = {}; + + /** + * Checks if the requested element was written manually and maps it + * + * @param {string} name meta tag 'name' attribute value + * @returns {boolean} returns true if there is an element with the requested name + */ + function mapExistingElement(name) { + if (metaElements[name]) { + return true; + } + + var element = document.getElementsByName(name)[0]; + + if (!element) { + return false; + } + + metaElements[name] = angular.element(element); + + return true; + } + + /** + * @ngdoc method + * @name $$mdMeta#setMeta + * + * @description + * Creates meta element with the 'name' and 'content' attributes, + * if the meta tag is already created than we replace the 'content' value + * + * @param {string} name meta tag 'name' attribute value + * @param {string} content meta tag 'content' attribute value + * @returns {function} remove function + * + */ + function setMeta(name, content) { + mapExistingElement(name); + + if (!metaElements[name]) { + var newMeta = angular.element(''); + head.append(newMeta); + metaElements[name] = newMeta; + } + else { + metaElements[name].attr('content', content); + } + + return function () { + metaElements[name].attr('content', ''); + metaElements[name].remove(); + delete metaElements[name]; + }; + } + + /** + * @ngdoc method + * @name $$mdMeta#getMeta + * + * @description + * Gets the 'content' attribute value of the wanted meta element + * + * @param {string} name meta tag 'name' attribute value + * @returns {string} content attribute value + */ + function getMeta(name) { + if (!mapExistingElement(name)) { + throw Error('$$mdMeta: could not find a meta tag with the name \'' + name + '\''); + } + + return metaElements[name].attr('content'); + } + + var module = { + setMeta: setMeta, + getMeta: getMeta + }; + + return angular.extend({}, module, { + $get: function () { + return module; + } + }); + }); +})(); +(function(){ +"use strict"; + + /** + * @ngdoc module + * @name material.core.componentRegistry + * + * @description + * A component instance registration service. + * Note: currently this as a private service in the SideNav component. + */ + ComponentRegistry.$inject = ["$log", "$q"]; + angular.module('material.core') + .factory('$mdComponentRegistry', ComponentRegistry); + + /* + * @private + * @ngdoc factory + * @name ComponentRegistry + * @module material.core.componentRegistry + * + */ + function ComponentRegistry($log, $q) { + + var self; + var instances = []; + var pendings = { }; + + return self = { + /** + * Used to print an error when an instance for a handle isn't found. + */ + notFoundError: function(handle, msgContext) { + $log.error((msgContext || "") + 'No instance found for handle', handle); + }, + /** + * Return all registered instances as an array. + */ + getInstances: function() { + return instances; + }, + + /** + * Get a registered instance. + * @param handle the String handle to look up for a registered instance. + */ + get: function(handle) { + if (!isValidID(handle)) return null; + + var i, j, instance; + for (i = 0, j = instances.length; i < j; i++) { + instance = instances[i]; + if (instance.$$mdHandle === handle) { + return instance; + } + } + return null; + }, + + /** + * Register an instance. + * @param instance the instance to register + * @param handle the handle to identify the instance under. + */ + register: function(instance, handle) { + if (!handle) return angular.noop; + + instance.$$mdHandle = handle; + instances.push(instance); + resolveWhen(); + + return deregister; + + /** + * Remove registration for an instance + */ + function deregister() { + var index = instances.indexOf(instance); + if (index !== -1) { + instances.splice(index, 1); + } + } + + /** + * Resolve any pending promises for this instance + */ + function resolveWhen() { + var dfd = pendings[handle]; + if (dfd) { + dfd.forEach(function (promise) { + promise.resolve(instance); + }); + delete pendings[handle]; + } + } + }, + + /** + * Async accessor to registered component instance + * If not available then a promise is created to notify + * all listeners when the instance is registered. + */ + when : function(handle) { + if (isValidID(handle)) { + var deferred = $q.defer(); + var instance = self.get(handle); + + if (instance) { + deferred.resolve(instance); + } else { + if (pendings[handle] === undefined) { + pendings[handle] = []; + } + pendings[handle].push(deferred); + } + + return deferred.promise; + } + return $q.reject("Invalid `md-component-id` value."); + } + + }; + + function isValidID(handle){ + return handle && (handle !== ""); + } + + } + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdButtonInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-button. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the default ripple configuration + */ + + MdButtonInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdButtonInkRipple', MdButtonInkRipple); + + function MdButtonInkRipple($mdInkRipple) { + return { + attach: function attachRipple(scope, element, options) { + options = angular.extend(optionsForElement(element), options); + + return $mdInkRipple.attach(scope, element, options); + } + }; + + function optionsForElement(element) { + if (element.hasClass('md-icon-button')) { + return { + isMenuItem: element.hasClass('md-menu-item'), + fitRipple: true, + center: true + }; + } else { + return { + isMenuItem: element.hasClass('md-menu-item'), + dimBackground: true + }; + } + } + } +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdCheckboxInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-checkbox. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdCheckboxInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdCheckboxInkRipple', MdCheckboxInkRipple); + + function MdCheckboxInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: true, + dimBackground: false, + fitRipple: true + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdListInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-list. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdListInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdListInkRipple', MdListInkRipple); + + function MdListInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: false, + dimBackground: true, + outline: false, + rippleSize: 'full' + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.core.ripple + * @description + * Ripple + */ +InkRippleCtrl.$inject = ["$scope", "$element", "rippleOptions", "$window", "$timeout", "$mdUtil", "$mdColorUtil"]; +InkRippleDirective.$inject = ["$mdButtonInkRipple", "$mdCheckboxInkRipple"]; +angular.module('material.core') + .provider('$mdInkRipple', InkRippleProvider) + .directive('mdInkRipple', InkRippleDirective) + .directive('mdNoInk', attrNoDirective) + .directive('mdNoBar', attrNoDirective) + .directive('mdNoStretch', attrNoDirective); + +var DURATION = 450; + +/** + * @ngdoc directive + * @name mdInkRipple + * @module material.core.ripple + * + * @description + * The `md-ink-ripple` directive allows you to specify the ripple color or if a ripple is allowed. + * + * @param {string|boolean} md-ink-ripple A color string `#FF0000` or boolean (`false` or `0`) for + * preventing ripple + * + * @usage + * ### String values + * + * + * Ripples in red + * + * + * + * Not rippling + * + * + * + * ### Interpolated values + * + * + * Ripples with the return value of 'randomColor' function + * + * + * + * Ripples if 'canRipple' function return value is not 'false' or '0' + * + * + */ +function InkRippleDirective ($mdButtonInkRipple, $mdCheckboxInkRipple) { + return { + controller: angular.noop, + link: function (scope, element, attr) { + attr.hasOwnProperty('mdInkRippleCheckbox') + ? $mdCheckboxInkRipple.attach(scope, element) + : $mdButtonInkRipple.attach(scope, element); + } + }; +} + +/** + * @ngdoc service + * @name $mdInkRipple + * @module material.core.ripple + * + * @description + * `$mdInkRipple` is a service for adding ripples to any element. + * + * @usage + * + * app.factory('$myElementInkRipple', function($mdInkRipple) { + * return { + * attach: function (scope, element, options) { + * return $mdInkRipple.attach(scope, element, angular.extend({ + * center: false, + * dimBackground: true + * }, options)); + * } + * }; + * }); + * + * app.controller('myController', function ($scope, $element, $myElementInkRipple) { + * $scope.onClick = function (ev) { + * $myElementInkRipple.attach($scope, angular.element(ev.target), { center: true }); + * } + * }); + * + */ + +/** + * @ngdoc service + * @name $mdInkRippleProvider + * @module material.core.ripple + * + * @description + * If you want to disable ink ripples globally, for all components, you can call the + * `disableInkRipple` method in your app's config. + * + * + * @usage + * + * app.config(function ($mdInkRippleProvider) { + * $mdInkRippleProvider.disableInkRipple(); + * }); + * + */ + +function InkRippleProvider () { + var isDisabledGlobally = false; + + return { + disableInkRipple: disableInkRipple, + $get: ["$injector", function($injector) { + return { attach: attach }; + + /** + * @ngdoc method + * @name $mdInkRipple#attach + * + * @description + * Attaching given scope, element and options to inkRipple controller + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultRipple configuration + * * `center` - Whether the ripple should start from the center of the container element + * * `dimBackground` - Whether the background should be dimmed with the ripple color + * * `colorElement` - The element the ripple should take its color from, defined by css property `color` + * * `fitRipple` - Whether the ripple should fill the element + */ + function attach (scope, element, options) { + if (isDisabledGlobally || element.controller('mdNoInk')) return angular.noop; + return $injector.instantiate(InkRippleCtrl, { + $scope: scope, + $element: element, + rippleOptions: options + }); + } + }] + }; + + /** + * @ngdoc method + * @name $mdInkRippleProvider#disableInkRipple + * + * @description + * A config-time method that, when called, disables ripples globally. + */ + function disableInkRipple () { + isDisabledGlobally = true; + } +} + +/** + * Controller used by the ripple service in order to apply ripples + * @ngInject + */ +function InkRippleCtrl ($scope, $element, rippleOptions, $window, $timeout, $mdUtil, $mdColorUtil) { + this.$window = $window; + this.$timeout = $timeout; + this.$mdUtil = $mdUtil; + this.$mdColorUtil = $mdColorUtil; + this.$scope = $scope; + this.$element = $element; + this.options = rippleOptions; + this.mousedown = false; + this.ripples = []; + this.timeout = null; // Stores a reference to the most-recent ripple timeout + this.lastRipple = null; + + $mdUtil.valueOnUse(this, 'container', this.createContainer); + + this.$element.addClass('md-ink-ripple'); + + // attach method for unit tests + ($element.controller('mdInkRipple') || {}).createRipple = angular.bind(this, this.createRipple); + ($element.controller('mdInkRipple') || {}).setColor = angular.bind(this, this.color); + + this.bindEvents(); +} + + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (either by + * mouseup or mouseleave event) + */ +function autoCleanup (self, cleanupFn) { + if (self.mousedown || self.lastRipple) { + self.mousedown = false; + self.$mdUtil.nextTick(angular.bind(self, cleanupFn), false); + } +} + + +/** + * Returns the color that the ripple should be (either based on CSS or hard-coded) + * @returns {string} + */ +InkRippleCtrl.prototype.color = function (value) { + var self = this; + + // If assigning a color value, apply it to background and the ripple color + if (angular.isDefined(value)) { + self._color = self._parseColor(value); + } + + // If color lookup, use assigned, defined, or inherited + return self._color || self._parseColor(self.inkRipple()) || self._parseColor(getElementColor()); + + /** + * Finds the color element and returns its text color for use as default ripple color + * @returns {string} + */ + function getElementColor () { + var items = self.options && self.options.colorElement ? self.options.colorElement : []; + var elem = items.length ? items[ 0 ] : self.$element[ 0 ]; + + return elem ? self.$window.getComputedStyle(elem).color : 'rgb(0,0,0)'; + } +}; + +/** + * Updating the ripple colors based on the current inkRipple value + * or the element's computed style color + */ +InkRippleCtrl.prototype.calculateColor = function () { + return this.color(); +}; + + +/** + * Takes a string color and converts it to RGBA format + * @param {string} color + * @param {number} multiplier + * @returns {string} + */ +InkRippleCtrl.prototype._parseColor = function parseColor (color, multiplier) { + multiplier = multiplier || 1; + var colorUtil = this.$mdColorUtil; + + if (!color) return; + if (color.indexOf('rgba') === 0) return color.replace(/\d?\.?\d*\s*\)\s*$/, (0.1 * multiplier).toString() + ')'); + if (color.indexOf('rgb') === 0) return colorUtil.rgbToRgba(color); + if (color.indexOf('#') === 0) return colorUtil.hexToRgba(color); + +}; + +/** + * Binds events to the root element for + */ +InkRippleCtrl.prototype.bindEvents = function () { + this.$element.on('mousedown', angular.bind(this, this.handleMousedown)); + this.$element.on('mouseup touchend', angular.bind(this, this.handleMouseup)); + this.$element.on('mouseleave', angular.bind(this, this.handleMouseup)); + this.$element.on('touchmove', angular.bind(this, this.handleTouchmove)); +}; + +/** + * Create a new ripple on every mousedown event from the root element + * @param event {MouseEvent} + */ +InkRippleCtrl.prototype.handleMousedown = function (event) { + if (this.mousedown) return; + + // When jQuery is loaded, we have to get the original event + if (event.hasOwnProperty('originalEvent')) event = event.originalEvent; + this.mousedown = true; + if (this.options.center) { + this.createRipple(this.container.prop('clientWidth') / 2, this.container.prop('clientWidth') / 2); + } else { + + // We need to calculate the relative coordinates if the target is a sublayer of the ripple element + if (event.srcElement !== this.$element[0]) { + var layerRect = this.$element[0].getBoundingClientRect(); + var layerX = event.clientX - layerRect.left; + var layerY = event.clientY - layerRect.top; + + this.createRipple(layerX, layerY); + } else { + this.createRipple(event.offsetX, event.offsetY); + } + } +}; + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (either by + * mouseup, touchend or mouseleave event) + */ +InkRippleCtrl.prototype.handleMouseup = function () { + this.$timeout(function () { + autoCleanup(this, this.clearRipples); + }.bind(this)); +}; + +/** + * Either remove or unlock any remaining ripples when the user mouses off of the element (by + * touchmove) + */ +InkRippleCtrl.prototype.handleTouchmove = function () { + autoCleanup(this, this.deleteRipples); +}; + +/** + * Cycles through all ripples and attempts to remove them. + */ +InkRippleCtrl.prototype.deleteRipples = function () { + for (var i = 0; i < this.ripples.length; i++) { + this.ripples[ i ].remove(); + } +}; + +/** + * Cycles through all ripples and attempts to remove them with fade. + * Depending on logic within `fadeInComplete`, some removals will be postponed. + */ +InkRippleCtrl.prototype.clearRipples = function () { + for (var i = 0; i < this.ripples.length; i++) { + this.fadeInComplete(this.ripples[ i ]); + } +}; + +/** + * Creates the ripple container element + * @returns {*} + */ +InkRippleCtrl.prototype.createContainer = function () { + var container = angular.element('
    '); + this.$element.append(container); + return container; +}; + +InkRippleCtrl.prototype.clearTimeout = function () { + if (this.timeout) { + this.$timeout.cancel(this.timeout); + this.timeout = null; + } +}; + +InkRippleCtrl.prototype.isRippleAllowed = function () { + var element = this.$element[0]; + do { + if (!element.tagName || element.tagName === 'BODY') break; + + if (element && angular.isFunction(element.hasAttribute)) { + if (element.hasAttribute('disabled')) return false; + if (this.inkRipple() === 'false' || this.inkRipple() === '0') return false; + } + + } while (element = element.parentNode); + return true; +}; + +/** + * The attribute `md-ink-ripple` may be a static or interpolated + * color value OR a boolean indicator (used to disable ripples) + */ +InkRippleCtrl.prototype.inkRipple = function () { + return this.$element.attr('md-ink-ripple'); +}; + +/** + * Creates a new ripple and adds it to the container. Also tracks ripple in `this.ripples`. + * @param left + * @param top + */ +InkRippleCtrl.prototype.createRipple = function (left, top) { + if (!this.isRippleAllowed()) return; + + var ctrl = this; + var colorUtil = ctrl.$mdColorUtil; + var ripple = angular.element('
    '); + var width = this.$element.prop('clientWidth'); + var height = this.$element.prop('clientHeight'); + var x = Math.max(Math.abs(width - left), left) * 2; + var y = Math.max(Math.abs(height - top), top) * 2; + var size = getSize(this.options.fitRipple, x, y); + var color = this.calculateColor(); + + ripple.css({ + left: left + 'px', + top: top + 'px', + background: 'black', + width: size + 'px', + height: size + 'px', + backgroundColor: colorUtil.rgbaToRgb(color), + borderColor: colorUtil.rgbaToRgb(color) + }); + this.lastRipple = ripple; + + // we only want one timeout to be running at a time + this.clearTimeout(); + this.timeout = this.$timeout(function () { + ctrl.clearTimeout(); + if (!ctrl.mousedown) ctrl.fadeInComplete(ripple); + }, DURATION * 0.35, false); + + if (this.options.dimBackground) this.container.css({ backgroundColor: color }); + this.container.append(ripple); + this.ripples.push(ripple); + ripple.addClass('md-ripple-placed'); + + this.$mdUtil.nextTick(function () { + + ripple.addClass('md-ripple-scaled md-ripple-active'); + ctrl.$timeout(function () { + ctrl.clearRipples(); + }, DURATION, false); + + }, false); + + function getSize (fit, x, y) { + return fit + ? Math.max(x, y) + : Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); + } +}; + + + +/** + * After fadeIn finishes, either kicks off the fade-out animation or queues the element for removal on mouseup + * @param ripple + */ +InkRippleCtrl.prototype.fadeInComplete = function (ripple) { + if (this.lastRipple === ripple) { + if (!this.timeout && !this.mousedown) { + this.removeRipple(ripple); + } + } else { + this.removeRipple(ripple); + } +}; + +/** + * Kicks off the animation for removing a ripple + * @param ripple {Element} + */ +InkRippleCtrl.prototype.removeRipple = function (ripple) { + var ctrl = this; + var index = this.ripples.indexOf(ripple); + if (index < 0) return; + this.ripples.splice(this.ripples.indexOf(ripple), 1); + ripple.removeClass('md-ripple-active'); + ripple.addClass('md-ripple-remove'); + if (this.ripples.length === 0) this.container.css({ backgroundColor: '' }); + // use a 2-second timeout in order to allow for the animation to finish + // we don't actually care how long the animation takes + this.$timeout(function () { + ctrl.fadeOutComplete(ripple); + }, DURATION, false); +}; + +/** + * Removes the provided ripple from the DOM + * @param ripple + */ +InkRippleCtrl.prototype.fadeOutComplete = function (ripple) { + ripple.remove(); + this.lastRipple = null; +}; + +/** + * Used to create an empty directive. This is used to track flag-directives whose children may have + * functionality based on them. + * + * Example: `md-no-ink` will potentially be used by all child directives. + */ +function attrNoDirective () { + return { controller: angular.noop }; +} + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdTabInkRipple + * @module material.core + * + * @description + * Provides ripple effects for md-tabs. See $mdInkRipple service for all possible configuration options. + * + * @param {object=} scope Scope within the current context + * @param {object=} element The element the ripple effect should be applied to + * @param {object=} options (Optional) Configuration options to override the defaultripple configuration + */ + + MdTabInkRipple.$inject = ["$mdInkRipple"]; + angular.module('material.core') + .factory('$mdTabInkRipple', MdTabInkRipple); + + function MdTabInkRipple($mdInkRipple) { + return { + attach: attach + }; + + function attach(scope, element, options) { + return $mdInkRipple.attach(scope, element, angular.extend({ + center: false, + dimBackground: true, + outline: false, + rippleSize: 'full' + }, options)); + } + } +})(); + +})(); +(function(){ +"use strict"; + +angular.module('material.core.theming.palette', []) +.constant('$mdColorPalette', { + 'red': { + '50': '#ffebee', + '100': '#ffcdd2', + '200': '#ef9a9a', + '300': '#e57373', + '400': '#ef5350', + '500': '#f44336', + '600': '#e53935', + '700': '#d32f2f', + '800': '#c62828', + '900': '#b71c1c', + 'A100': '#ff8a80', + 'A200': '#ff5252', + 'A400': '#ff1744', + 'A700': '#d50000', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 500 600 A100 A200 A400', + 'contrastStrongLightColors': '700 800 900 A700' + }, + 'pink': { + '50': '#fce4ec', + '100': '#f8bbd0', + '200': '#f48fb1', + '300': '#f06292', + '400': '#ec407a', + '500': '#e91e63', + '600': '#d81b60', + '700': '#c2185b', + '800': '#ad1457', + '900': '#880e4f', + 'A100': '#ff80ab', + 'A200': '#ff4081', + 'A400': '#f50057', + 'A700': '#c51162', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 A100 A200 A400', + // White on 500 does not meet the minimum 4.5 contrast ratio (at 4.34), + // but it's worse with a dark foreground (3.61). + 'contrastStrongLightColors': '500 600 700 800 900 A700' + }, + 'purple': { + '50': '#f3e5f5', + '100': '#e1bee7', + '200': '#ce93d8', + '300': '#ba68c8', + '400': '#ab47bc', + '500': '#9c27b0', + '600': '#8e24aa', + '700': '#7b1fa2', + '800': '#6a1b9a', + '900': '#4a148c', + 'A100': '#ea80fc', + 'A200': '#e040fb', + 'A400': '#d500f9', + 'A700': '#aa00ff', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200 A400', + 'contrastStrongLightColors': '400 500 600 700 800 900 A700' + }, + 'deep-purple': { + '50': '#ede7f6', + '100': '#d1c4e9', + '200': '#b39ddb', + '300': '#9575cd', + '400': '#7e57c2', + '500': '#673ab7', + '600': '#5e35b1', + '700': '#512da8', + '800': '#4527a0', + '900': '#311b92', + 'A100': '#b388ff', + 'A200': '#7c4dff', + 'A400': '#651fff', + 'A700': '#6200ea', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100', + 'contrastStrongLightColors': '400 500 600 700 800 900 A200 A400 A700' + }, + 'indigo': { + '50': '#e8eaf6', + '100': '#c5cae9', + '200': '#9fa8da', + '300': '#7986cb', + '400': '#5c6bc0', + '500': '#3f51b5', + '600': '#3949ab', + '700': '#303f9f', + '800': '#283593', + '900': '#1a237e', + 'A100': '#8c9eff', + 'A200': '#536dfe', + 'A400': '#3d5afe', + 'A700': '#304ffe', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200', + 'contrastStrongLightColors': '400 500 600 700 800 900 A400 A700' + }, + 'blue': { + '50': '#e3f2fd', + '100': '#bbdefb', + '200': '#90caf9', + '300': '#64b5f6', + '400': '#42a5f5', + '500': '#2196f3', + '600': '#1e88e5', + '700': '#1976d2', + '800': '#1565c0', + '900': '#0d47a1', + 'A100': '#82b1ff', + 'A200': '#448aff', + 'A400': '#2979ff', + 'A700': '#2962ff', + 'contrastDefaultColor': 'light', + // White on A400 does not meet the minimum 4.5 contrast ratio (at 3.98), + // but it's worse with a dark foreground (3.94). + 'contrastDarkColors': '50 100 200 300 400 500 600 A100 A200', + 'contrastStrongLightColors': '700 800 900 A400 A700' + }, + 'light-blue': { + '50': '#e1f5fe', + '100': '#b3e5fc', + '200': '#81d4fa', + '300': '#4fc3f7', + '400': '#29b6f6', + '500': '#03a9f4', + '600': '#039be5', + '700': '#0288d1', + '800': '#0277bd', + '900': '#01579b', + 'A100': '#80d8ff', + 'A200': '#40c4ff', + 'A400': '#00b0ff', + 'A700': '#0091ea', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.07), + // but it's worse with a white foreground (3.85). + 'contrastStrongLightColors': '800 900 A700' + }, + 'cyan': { + '50': '#e0f7fa', + '100': '#b2ebf2', + '200': '#80deea', + '300': '#4dd0e1', + '400': '#26c6da', + '500': '#00bcd4', + '600': '#00acc1', + '700': '#0097a7', + '800': '#00838f', + '900': '#006064', + 'A100': '#84ffff', + 'A200': '#18ffff', + 'A400': '#00e5ff', + 'A700': '#00b8d4', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.47), + // but it's worse with a white foreground (3.5). + 'contrastStrongLightColors': '800 900' + }, + 'teal': { + '50': '#e0f2f1', + '100': '#b2dfdb', + '200': '#80cbc4', + '300': '#4db6ac', + '400': '#26a69a', + '500': '#009688', + '600': '#00897b', + '700': '#00796b', + '800': '#00695c', + '900': '#004d40', + 'A100': '#a7ffeb', + 'A200': '#64ffda', + 'A400': '#1de9b6', + 'A700': '#00bfa5', + 'contrastDefaultColor': 'dark', + // Dark on 500 does not meet the minimum 4.5 contrast ratio (at 4.27), + // but it's worse with a white foreground (3.67). + // White on 600 does not meet the minimum 4.5 contrast ratio (at 4.31), + // but it's worse with a dark foreground (3.64). + 'contrastStrongLightColors': '600 700 800 900' + }, + 'green': { + '50': '#e8f5e9', + '100': '#c8e6c9', + '200': '#a5d6a7', + '300': '#81c784', + '400': '#66bb6a', + '500': '#4caf50', + '600': '#43a047', + '700': '#388e3c', + '800': '#2e7d32', + '900': '#1b5e20', + 'A100': '#b9f6ca', + 'A200': '#69f0ae', + 'A400': '#00e676', + 'A700': '#00c853', + 'contrastDefaultColor': 'dark', + // White on 700 does not meet the minimum 4.5 contrast ratio (at 4.11), + // but it's worse with a dark foreground (3.81). + 'contrastStrongLightColors': '700 800 900' + }, + 'light-green': { + '50': '#f1f8e9', + '100': '#dcedc8', + '200': '#c5e1a5', + '300': '#aed581', + '400': '#9ccc65', + '500': '#8bc34a', + '600': '#7cb342', + '700': '#689f38', + '800': '#558b2f', + '900': '#33691e', + 'A100': '#ccff90', + 'A200': '#b2ff59', + 'A400': '#76ff03', + 'A700': '#64dd17', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '800 900' + }, + 'lime': { + '50': '#f9fbe7', + '100': '#f0f4c3', + '200': '#e6ee9c', + '300': '#dce775', + '400': '#d4e157', + '500': '#cddc39', + '600': '#c0ca33', + '700': '#afb42b', + '800': '#9e9d24', + '900': '#827717', + 'A100': '#f4ff81', + 'A200': '#eeff41', + 'A400': '#c6ff00', + 'A700': '#aeea00', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '900' + }, + 'yellow': { + '50': '#fffde7', + '100': '#fff9c4', + '200': '#fff59d', + '300': '#fff176', + '400': '#ffee58', + '500': '#ffeb3b', + '600': '#fdd835', + '700': '#fbc02d', + '800': '#f9a825', + '900': '#f57f17', + 'A100': '#ffff8d', + 'A200': '#ffff00', + 'A400': '#ffea00', + 'A700': '#ffd600', + 'contrastDefaultColor': 'dark' + }, + 'amber': { + '50': '#fff8e1', + '100': '#ffecb3', + '200': '#ffe082', + '300': '#ffd54f', + '400': '#ffca28', + '500': '#ffc107', + '600': '#ffb300', + '700': '#ffa000', + '800': '#ff8f00', + '900': '#ff6f00', + 'A100': '#ffe57f', + 'A200': '#ffd740', + 'A400': '#ffc400', + 'A700': '#ffab00', + 'contrastDefaultColor': 'dark' + }, + 'orange': { + '50': '#fff3e0', + '100': '#ffe0b2', + '200': '#ffcc80', + '300': '#ffb74d', + '400': '#ffa726', + '500': '#ff9800', + '600': '#fb8c00', + '700': '#f57c00', + '800': '#ef6c00', + '900': '#e65100', + 'A100': '#ffd180', + 'A200': '#ffab40', + 'A400': '#ff9100', + 'A700': '#ff6d00', + 'contrastDefaultColor': 'dark', + 'contrastStrongLightColors': '900' + }, + 'deep-orange': { + '50': '#fbe9e7', + '100': '#ffccbc', + '200': '#ffab91', + '300': '#ff8a65', + '400': '#ff7043', + '500': '#ff5722', + '600': '#f4511e', + '700': '#e64a19', + '800': '#d84315', + '900': '#bf360c', + 'A100': '#ff9e80', + 'A200': '#ff6e40', + 'A400': '#ff3d00', + 'A700': '#dd2c00', + 'contrastDefaultColor': 'dark', + // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.01), + // but it's worse with a white foreground (3.91). + // White on 800 does not meet the minimum 4.5 contrast ratio (at 4.43), + // but it's worse with a dark foreground (3.54). + 'contrastStrongLightColors': '800 900 A400 A700', + }, + 'brown': { + '50': '#efebe9', + '100': '#d7ccc8', + '200': '#bcaaa4', + '300': '#a1887f', + '400': '#8d6e63', + '500': '#795548', + '600': '#6d4c41', + '700': '#5d4037', + '800': '#4e342e', + '900': '#3e2723', + 'A100': '#d7ccc8', + 'A200': '#bcaaa4', + 'A400': '#8d6e63', + 'A700': '#5d4037', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 A100 A200', + 'contrastStrongLightColors': '400 500 600 700 800 900 A400 A700' + }, + 'grey': { + '50': '#fafafa', + '100': '#f5f5f5', + '200': '#eeeeee', + '300': '#e0e0e0', + '400': '#bdbdbd', + '500': '#9e9e9e', + '600': '#757575', + '700': '#616161', + '800': '#424242', + '900': '#212121', + 'A100': '#ffffff', + 'A200': '#000000', + 'A400': '#303030', + 'A700': '#616161', + 'contrastDefaultColor': 'dark', + 'contrastLightColors': '700 800 900 A200 A400 A700', + 'contrastStrongLightColors': '600' + }, + 'blue-grey': { + '50': '#eceff1', + '100': '#cfd8dc', + '200': '#b0bec5', + '300': '#90a4ae', + '400': '#78909c', + '500': '#607d8b', + '600': '#546e7a', + '700': '#455a64', + '800': '#37474f', + '900': '#263238', + 'A100': '#cfd8dc', + 'A200': '#b0bec5', + 'A400': '#78909c', + 'A700': '#455a64', + 'contrastDefaultColor': 'light', + 'contrastDarkColors': '50 100 200 300 400 A100 A200 A400', + // White on 500 does not meet the minimum 4.5 contrast ratio (at 4.37), + // but it's worse with a dark foreground. + 'contrastStrongLightColors': '500 600 700 800 900 A700' + } +}); + +})(); +(function(){ +"use strict"; + +(function(angular) { + 'use strict'; +/** + * @ngdoc module + * @name material.core.theming + * @description + * Theming + */ +detectDisabledThemes.$inject = ["$mdThemingProvider"]; +ThemingDirective.$inject = ["$mdTheming", "$interpolate", "$parse", "$mdUtil", "$q", "$log"]; +ThemableDirective.$inject = ["$mdTheming"]; +ThemingProvider.$inject = ["$mdColorPalette", "$$mdMetaProvider"]; +generateAllThemes.$inject = ["$injector", "$mdTheming"]; +angular.module('material.core.theming', ['material.core.theming.palette', 'material.core.meta']) + .directive('mdTheme', ThemingDirective) + .directive('mdThemable', ThemableDirective) + .directive('mdThemesDisabled', disableThemesDirective) + .provider('$mdTheming', ThemingProvider) + .config(detectDisabledThemes) + .run(generateAllThemes); + +/** + * Detect if the HTML or the BODY tags has a [md-themes-disabled] attribute + * If yes, then immediately disable all theme stylesheet generation and DOM injection + */ +/** + * @ngInject + */ +function detectDisabledThemes($mdThemingProvider) { + var isDisabled = !!document.querySelector('[md-themes-disabled]'); + $mdThemingProvider.disableTheming(isDisabled); +} + +/** + * @ngdoc service + * @name $mdThemingProvider + * @module material.core.theming + * + * @description Provider to configure the `$mdTheming` service. + * + * ### Default Theme + * The `$mdThemingProvider` uses by default the following theme configuration: + * + * - Primary Palette: `Blue` + * - Accent Palette: `Pink` + * - Warn Palette: `Deep-Orange` + * - Background Palette: `Grey` + * + * If you don't want to use the `md-theme` directive on the elements itself, you may want to overwrite + * the default theme.
    + * This can be done by using the following markup. + * + * + * myAppModule.config(function($mdThemingProvider) { + * $mdThemingProvider + * .theme('default') + * .primaryPalette('blue') + * .accentPalette('teal') + * .warnPalette('red') + * .backgroundPalette('grey'); + * }); + * + * + + * ### Dynamic Themes + * + * By default, if you change a theme at runtime, the `$mdTheming` service will not detect those changes.
    + * If you have an application, which changes its theme on runtime, you have to enable theme watching. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Enable theme watching. + * $mdThemingProvider.alwaysWatchTheme(true); + * }); + * + * + * ### Custom Theme Styles + * + * Sometimes you may want to use your own theme styles for some custom components.
    + * You are able to register your own styles by using the following markup. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Register our custom stylesheet into the theming provider. + * $mdThemingProvider.registerStyles(STYLESHEET); + * }); + * + * + * The `registerStyles` method only accepts strings as value, so you're actually not able to load an external + * stylesheet file into the `$mdThemingProvider`. + * + * If it's necessary to load an external stylesheet, we suggest using a bundler, which supports including raw content, + * like [raw-loader](https://github.com/webpack/raw-loader) for `webpack`. + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Register your custom stylesheet into the theming provider. + * $mdThemingProvider.registerStyles(require('../styles/my-component.theme.css')); + * }); + * + * + * ### Browser color + * + * Enables browser header coloring + * for more info please visit: + * https://developers.google.com/web/fundamentals/design-and-ui/browser-customization/theme-color + * + * Options parameter:
    + * `theme` - A defined theme via `$mdThemeProvider` to use the palettes from. Default is `default` theme.
    + * `palette` - Can be any one of the basic material design palettes, extended defined palettes and 'primary', + * 'accent', 'background' and 'warn'. Default is `primary`.
    + * `hue` - The hue from the selected palette. Default is `800`
    + * + * + * myAppModule.config(function($mdThemingProvider) { + * // Enable browser color + * $mdThemingProvider.enableBrowserColor({ + * theme: 'myTheme', // Default is 'default' + * palette: 'accent', // Default is 'primary', any basic material palette and extended palettes are available + * hue: '200' // Default is '800' + * }); + * }); + * + */ + +/** + * Some Example Valid Theming Expressions + * ======================================= + * + * Intention group expansion: (valid for primary, accent, warn, background) + * + * {{primary-100}} - grab shade 100 from the primary palette + * {{primary-100-0.7}} - grab shade 100, apply opacity of 0.7 + * {{primary-100-contrast}} - grab shade 100's contrast color + * {{primary-hue-1}} - grab the shade assigned to hue-1 from the primary palette + * {{primary-hue-1-0.7}} - apply 0.7 opacity to primary-hue-1 + * {{primary-color}} - Generates .md-hue-1, .md-hue-2, .md-hue-3 with configured shades set for each hue + * {{primary-color-0.7}} - Apply 0.7 opacity to each of the above rules + * {{primary-contrast}} - Generates .md-hue-1, .md-hue-2, .md-hue-3 with configured contrast (ie. text) color shades set for each hue + * {{primary-contrast-0.7}} - Apply 0.7 opacity to each of the above rules + * {{primary-contrast-divider}} - Apply divider opacity to contrast color + * + * Foreground expansion: Applies rgba to black/white foreground text + * + * Old Foreground Expressions: + * {{foreground-1}} - used for primary text + * {{foreground-2}} - used for secondary text/divider + * {{foreground-3}} - used for disabled text + * {{foreground-4}} - used for dividers + * + * New Foreground Expressions: + * + * Apply primary text color for contrasting with default background + * {{background-default-contrast}} - default opacity + * {{background-default-contrast-secondary}} - opacity for secondary text + * {{background-default-contrast-hint}} - opacity for hints and placeholders + * {{background-default-contrast-disabled}} - opacity for disabled text + * {{background-default-contrast-divider}} - opacity for dividers + * + * Apply contrast color for specific shades + * {{background-50-contrast-icon}} - Apply contrast color for icon on background's shade 50 hue + */ + +// In memory generated CSS rules; registered by theme.name +var GENERATED = { }; + +// In memory storage of defined themes and color palettes (both loaded by CSS, and user specified) +var PALETTES; + +// Text colors are automatically generated based on background color when not specified +// Custom palettes can provide override colors +// @see https://material.io/archive/guidelines/style/color.html#color-usability +var DARK_FOREGROUND = { + name: 'dark', +}; +var LIGHT_FOREGROUND = { + name: 'light', +}; + +var DARK_SHADOW = '1px 1px 0px rgba(0,0,0,0.4), -1px -1px 0px rgba(0,0,0,0.4)'; +var LIGHT_SHADOW = ''; + +var DARK_CONTRAST_COLOR = colorToRgbaArray('rgba(0,0,0,0.87)'); +var LIGHT_CONTRAST_COLOR = colorToRgbaArray('rgba(255,255,255,0.87)'); +var STRONG_LIGHT_CONTRAST_COLOR = colorToRgbaArray('rgb(255,255,255)'); + +var THEME_COLOR_TYPES = ['primary', 'accent', 'warn', 'background']; +var DEFAULT_COLOR_TYPE = 'primary'; + +// A color in a theme will use these hues by default, if not specified by user. +var LIGHT_DEFAULT_HUES = { + 'accent': { + 'default': 'A200', + 'hue-1': 'A100', + 'hue-2': 'A400', + 'hue-3': 'A700' + }, + 'background': { + 'default': '50', + 'hue-1': 'A100', + 'hue-2': '100', + 'hue-3': '300' + } +}; + +var DARK_DEFAULT_HUES = { + 'background': { + 'default': 'A400', + 'hue-1': '800', + 'hue-2': '900', + 'hue-3': 'A200' + } +}; + +// Icon opacity values (active/inactive) from +// https://material.io/archive/guidelines/style/color.html#color-usability +var DARK_CONTRAST_OPACITY = { + 'icon': 0.54, + 'secondary': 0.54, + 'disabled': 0.38, + 'hint': 0.38, + 'divider': 0.12, +}; + +var LIGHT_CONTRAST_OPACITY = { + 'icon': 0.87, + 'secondary': 0.7, + 'disabled': 0.5, + 'hint': 0.5, + 'divider': 0.12 +}; + +// Icon opacity values (active/inactive) from +// https://material.io/archive/guidelines/style/color.html#color-usability +var STRONG_LIGHT_CONTRAST_OPACITY = { + 'icon': 1.0, + 'secondary': 0.7, + 'disabled': 0.5, + 'hint': 0.5, + 'divider': 0.12 +}; + +THEME_COLOR_TYPES.forEach(function(colorType) { + // Color types with unspecified default hues will use these default hue values + var defaultDefaultHues = { + 'default': '500', + 'hue-1': '300', + 'hue-2': '800', + 'hue-3': 'A100' + }; + if (!LIGHT_DEFAULT_HUES[colorType]) LIGHT_DEFAULT_HUES[colorType] = defaultDefaultHues; + if (!DARK_DEFAULT_HUES[colorType]) DARK_DEFAULT_HUES[colorType] = defaultDefaultHues; +}); + +var VALID_HUE_VALUES = [ + '50', '100', '200', '300', '400', '500', '600', + '700', '800', '900', 'A100', 'A200', 'A400', 'A700' +]; + +var themeConfig = { + disableTheming : false, // Generate our themes at run time; also disable stylesheet DOM injection + generateOnDemand : false, // Whether or not themes are to be generated on-demand (vs. eagerly). + registeredStyles : [], // Custom styles registered to be used in the theming of custom components. + nonce : null // Nonce to be added as an attribute to the generated themes style tags. +}; + +/** + * + */ +function ThemingProvider($mdColorPalette, $$mdMetaProvider) { + ThemingService.$inject = ["$rootScope", "$mdUtil", "$q", "$log"]; + PALETTES = { }; + var THEMES = { }; + + var themingProvider; + + var alwaysWatchTheme = false; + var defaultTheme = 'default'; + + // Load JS Defined Palettes + angular.extend(PALETTES, $mdColorPalette); + + // Default theme defined in core.js + + /** + * Adds `theme-color` and `msapplication-navbutton-color` meta tags with the color parameter + * @param {string} color Hex value of the wanted browser color + * @returns {function} Remove function of the meta tags + */ + var setBrowserColor = function (color) { + // Chrome, Firefox OS and Opera + var removeChrome = $$mdMetaProvider.setMeta('theme-color', color); + // Windows Phone + var removeWindows = $$mdMetaProvider.setMeta('msapplication-navbutton-color', color); + + return function () { + removeChrome(); + removeWindows(); + }; + }; + + /** + * @ngdoc method + * @name $mdThemingProvider#enableBrowserColor + * @description + * Enables browser header coloring. For more info please visit + * + * Web Fundamentals. + * @param {object=} options Options for the browser color, which include:
    + * - `theme` - `{string}`: A defined theme via `$mdThemeProvider` to use the palettes from. Default is `default` theme.
    + * - `palette` - `{string}`: Can be any one of the basic material design palettes, extended defined palettes, or `primary`, + * `accent`, `background`, and `warn`. Default is `primary`.
    + * - `hue` - `{string}`: The hue from the selected palette. Default is `800`.
    + * @returns {function} Function that removes the browser coloring when called. + */ + var enableBrowserColor = function (options) { + options = angular.isObject(options) ? options : {}; + + var theme = options.theme || 'default'; + var hue = options.hue || '800'; + + var palette = PALETTES[options.palette] || + PALETTES[THEMES[theme].colors[options.palette || 'primary'].name]; + + var color = angular.isObject(palette[hue]) ? palette[hue].hex : palette[hue]; + if (color.substr(0, 1) !== '#') color = '#' + color; + + return setBrowserColor(color); + }; + + return themingProvider = { + definePalette: definePalette, + extendPalette: extendPalette, + theme: registerTheme, + + /** + * return a read-only clone of the current theme configuration + */ + configuration : function() { + return angular.extend({ }, themeConfig, { + defaultTheme : defaultTheme, + alwaysWatchTheme : alwaysWatchTheme, + registeredStyles : [].concat(themeConfig.registeredStyles) + }); + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#disableTheming + * @description + * An easier way to disable theming without having to use `.constant("$MD_THEME_CSS","");`. + * This disables all dynamic theme style sheet generations and injections. + * @param {boolean=} isDisabled Disable all dynamic theme style sheet generations and injections + * if `true` or `undefined`. + */ + disableTheming: function(isDisabled) { + themeConfig.disableTheming = angular.isUndefined(isDisabled) || !!isDisabled; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#registerStyles + * @param {string} styles The styles to be appended to AngularJS Material's built in theme CSS. + */ + registerStyles: function(styles) { + themeConfig.registeredStyles.push(styles); + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#setNonce + * @param {string} nonceValue The nonce to be added as an attribute to the theme style tags. + * Setting a value allows the use of CSP policy without using the `'unsafe-inline'` directive. + * The string must already be base64 encoded. You can use `btoa(string)` to do this encoding. + * In your CSP's `style-src`, you would then add an entry for `'nonce-nonceValue'`. + */ + setNonce: function(nonceValue) { + themeConfig.nonce = nonceValue; + }, + + generateThemesOnDemand: function(onDemand) { + themeConfig.generateOnDemand = onDemand; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#setDefaultTheme + * @param {string} theme Default theme name to be applied to elements. + * Default value is `default`. + */ + setDefaultTheme: function(theme) { + defaultTheme = theme; + }, + + /** + * @ngdoc method + * @name $mdThemingProvider#alwaysWatchTheme + * @param {boolean} alwaysWatch Whether or not to always watch themes for changes and re-apply + * classes when they change. Default is `false`. Enabling can reduce performance. + */ + alwaysWatchTheme: function(alwaysWatch) { + alwaysWatchTheme = alwaysWatch; + }, + + enableBrowserColor: enableBrowserColor, + + $get: ThemingService, + _LIGHT_DEFAULT_HUES: LIGHT_DEFAULT_HUES, + _DARK_DEFAULT_HUES: DARK_DEFAULT_HUES, + _PALETTES: PALETTES, + _THEMES: THEMES, + _parseRules: parseRules, + _rgba: rgba + }; + + /** + * @ngdoc method + * @name $mdThemingProvider#definePalette + * @description + * In the event that you need to define a custom color palette, you can use this function to + * make it available to your theme for use in its intention groups.
    + * Note that you must specify all hues in the definition map. + * @param {string} name Name of palette being defined + * @param {object} map Palette definition that includes hue definitions and contrast colors: + * - `'50'` - `{string}`: HEX color + * - `'100'` - `{string}`: HEX color + * - `'200'` - `{string}`: HEX color + * - `'300'` - `{string}`: HEX color + * - `'400'` - `{string}`: HEX color + * - `'500'` - `{string}`: HEX color + * - `'600'` - `{string}`: HEX color + * - `'700'` - `{string}`: HEX color + * - `'800'` - `{string}`: HEX color + * - `'900'` - `{string}`: HEX color + * - `'A100'` - `{string}`: HEX color + * - `'A200'` - `{string}`: HEX color + * - `'A400'` - `{string}`: HEX color + * - `'A700'` - `{string}`: HEX color + * - `'contrastDefaultColor'` - `{string}`: `light` or `dark` + * - `'contrastDarkColors'` - `{string[]}`: Hues which should use dark contrast colors (i.e. raised button text). + * For example: `['50', '100', '200', '300', '400', 'A100']`. + * - `'contrastLightColors'` - `{string[]}`: Hues which should use light contrast colors (i.e. raised button text). + * For example: `['500', '600', '700', '800', '900', 'A200', 'A400', 'A700']`. + */ + function definePalette(name, map) { + map = map || {}; + PALETTES[name] = checkPaletteValid(name, map); + return themingProvider; + } + + /** + * @ngdoc method + * @name $mdThemingProvider#extendPalette + * @description + * Sometimes it is easier to extend an existing color palette and then change a few properties, + * rather than defining a whole new palette. + * @param {string} name Name of palette being extended + * @param {object} map Palette definition that includes optional hue definitions and contrast colors: + * - `'50'` - `{string}`: HEX color + * - `'100'` - `{string}`: HEX color + * - `'200'` - `{string}`: HEX color + * - `'300'` - `{string}`: HEX color + * - `'400'` - `{string}`: HEX color + * - `'500'` - `{string}`: HEX color + * - `'600'` - `{string}`: HEX color + * - `'700'` - `{string}`: HEX color + * - `'800'` - `{string}`: HEX color + * - `'900'` - `{string}`: HEX color + * - `'A100'` - `{string}`: HEX color + * - `'A200'` - `{string}`: HEX color + * - `'A400'` - `{string}`: HEX color + * - `'A700'` - `{string}`: HEX color + * - `'contrastDefaultColor'` - `{string}`: `light` or `dark` + * - `'contrastDarkColors'` - `{string[]}`: Hues which should use dark contrast colors (i.e. raised button text). + * For example: `['50', '100', '200', '300', '400', 'A100']`. + * - `'contrastLightColors'` - `{string[]}`: Hues which should use light contrast colors (i.e. raised button text). + * For example: `['500', '600', '700', '800', '900', 'A200', 'A400', 'A700']`. + * @returns {object} A new object which is a copy of the given palette, `name`, + * with variables from `map` overwritten. + */ + function extendPalette(name, map) { + return checkPaletteValid(name, angular.extend({}, PALETTES[name] || {}, map)); + } + + // Make sure that palette has all required hues + function checkPaletteValid(name, map) { + var missingColors = VALID_HUE_VALUES.filter(function(field) { + return !map[field]; + }); + if (missingColors.length) { + throw new Error("Missing colors %1 in palette %2!" + .replace('%1', missingColors.join(', ')) + .replace('%2', name)); + } + + return map; + } + + /** + * @ngdoc method + * @name $mdThemingProvider#theme + * @description + * Register a theme (which is a collection of color palettes); i.e. `warn`, `accent`, + * `background`, and `primary`.
    + * Optionally inherit from an existing theme. + * @param {string} name Name of theme being registered + * @param {string=} inheritFrom Existing theme name to inherit from + */ + function registerTheme(name, inheritFrom) { + if (THEMES[name]) return THEMES[name]; + + inheritFrom = inheritFrom || 'default'; + + var parentTheme = typeof inheritFrom === 'string' ? THEMES[inheritFrom] : inheritFrom; + var theme = new Theme(name); + + if (parentTheme) { + angular.forEach(parentTheme.colors, function(color, colorType) { + theme.colors[colorType] = { + name: color.name, + // Make sure a COPY of the hues is given to the child color, + // not the same reference. + hues: angular.extend({}, color.hues) + }; + }); + } + THEMES[name] = theme; + + return theme; + } + + function Theme(name) { + var self = this; + self.name = name; + self.colors = {}; + + self.dark = setDark; + setDark(false); + + function setDark(isDark) { + isDark = arguments.length === 0 ? true : !!isDark; + + // If no change, abort + if (isDark === self.isDark) return; + + self.isDark = isDark; + + self.foregroundPalette = self.isDark ? LIGHT_FOREGROUND : DARK_FOREGROUND; + self.foregroundShadow = self.isDark ? DARK_SHADOW : LIGHT_SHADOW; + + // Light and dark themes have different default hues. + // Go through each existing color type for this theme, and for every + // hue value that is still the default hue value from the previous light/dark setting, + // set it to the default hue value from the new light/dark setting. + var newDefaultHues = self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES; + var oldDefaultHues = self.isDark ? LIGHT_DEFAULT_HUES : DARK_DEFAULT_HUES; + angular.forEach(newDefaultHues, function(newDefaults, colorType) { + var color = self.colors[colorType]; + var oldDefaults = oldDefaultHues[colorType]; + if (color) { + for (var hueName in color.hues) { + if (color.hues[hueName] === oldDefaults[hueName]) { + color.hues[hueName] = newDefaults[hueName]; + } + } + } + }); + + return self; + } + + THEME_COLOR_TYPES.forEach(function(colorType) { + var defaultHues = (self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES)[colorType]; + self[colorType + 'Palette'] = function setPaletteType(paletteName, hues) { + var color = self.colors[colorType] = { + name: paletteName, + hues: angular.extend({}, defaultHues, hues) + }; + + Object.keys(color.hues).forEach(function(name) { + if (!defaultHues[name]) { + throw new Error("Invalid hue name '%1' in theme %2's %3 color %4. Available hue names: %4" + .replace('%1', name) + .replace('%2', self.name) + .replace('%3', paletteName) + .replace('%4', Object.keys(defaultHues).join(', ')) + ); + } + }); + Object.keys(color.hues).map(function(key) { + return color.hues[key]; + }).forEach(function(hueValue) { + if (VALID_HUE_VALUES.indexOf(hueValue) === -1) { + throw new Error("Invalid hue value '%1' in theme %2's %3 color %4. Available hue values: %5" + .replace('%1', hueValue) + .replace('%2', self.name) + .replace('%3', colorType) + .replace('%4', paletteName) + .replace('%5', VALID_HUE_VALUES.join(', ')) + ); + } + }); + return self; + }; + }); + } + + /** + * @ngdoc service + * @name $mdTheming + * @module material.core.theming + * @description + * Service that makes an element apply theming related classes to itself. + * + * For more information on the hue objects, their default values, as well as valid hue values, please visit the custom hues section of Configuring a Theme. + * + * + * // Example component directive that we want to apply theming classes to. + * app.directive('myFancyDirective', function($mdTheming) { + * return { + * restrict: 'AE', + * link: function(scope, element, attrs) { + * // Initialize the service using our directive's element + * $mdTheming(element); + * + * $mdTheming.defineTheme('myTheme', { + * primary: 'blue', + * primaryHues: { + * default: '500', + * hue-1: '300', + * hue-2: '900', + * hue-3: 'A100' + * }, + * accent: 'pink', + * accentHues: { + * default: '600', + * hue-1: '300', + * hue-2: '200', + * hue-3: 'A500' + * }, + * warn: 'red', + * // It's not necessary to specify all hues in the object. + * warnHues: { + * default: '200', + * hue-3: 'A100' + * }, + * // It's not necessary to specify custom hues at all. + * background: 'grey', + * dark: true + * }); + * // Your directive's custom code here. + * } + * }; + * }); + * + * @param {element=} element Element that will have theming classes applied to it. + */ + + /** + * @ngdoc property + * @name $mdTheming#THEMES + * @description + * Property to get all the themes defined + * @returns {object} All the themes defined with their properties. + */ + + /** + * @ngdoc property + * @name $mdTheming#PALETTES + * @description + * Property to get all the palettes defined + * @returns {object} All the palettes defined with their colors. + */ + + /** + * @ngdoc method + * @name $mdTheming#registered + * @description + * Determine is specified theme name is a valid, registered theme + * @param {string} themeName the theme to check if registered + * @returns {boolean} whether the theme is registered or not + */ + + /** + * @ngdoc method + * @name $mdTheming#defaultTheme + * @description + * Returns the default theme + * @returns {string} The default theme + */ + + /** + * @ngdoc method + * @name $mdTheming#generateTheme + * @description + * Lazy generate themes - by default, every theme is generated when defined. + * You can disable this in the configuration section using the + * `$mdThemingProvider.generateThemesOnDemand(true);` + * + * The theme name that is passed in must match the name of the theme that was defined as part of + * the configuration block. + * + * @param {string} name theme name to generate + */ + + /** + * @ngdoc method + * @name $mdTheming#setBrowserColor + * @description + * Enables browser header coloring. For more info please visit + * + * Web Fundamentals. + * @param {object=} options Options for the browser color, which include:
    + * - `theme` - `{string}`: A defined theme via `$mdThemeProvider` to use the palettes from. + * Default is `default` theme.
    + * - `palette` - `{string}`: Can be any one of the basic material design palettes, extended + * defined palettes, or `primary`, `accent`, `background`, and `warn`. Default is `primary`. + *
    + * - `hue` - `{string}`: The hue from the selected palette. Default is `800`.
    + * @returns {function} Function that removes the browser coloring when called. + */ + + /** + * @ngdoc method + * @name $mdTheming#defineTheme + * @description + * Dynamically define a theme by using an options object that contains palette names. + * + * @param {string} name Theme name to define + * @param {object} options Theme definition options + * + * Options are:
    + * - `primary` - `{string}`: The name of the primary palette to use in the theme.
    + * - `primaryHues` - `{object=}`: Override hues for primary palette.
    + * - `accent` - `{string}`: The name of the accent palette to use in the theme.
    + * - `accentHues` - `{object=}`: Override hues for accent palette.
    + * - `warn` - `{string}`: The name of the warn palette to use in the theme.
    + * - `warnHues` - `{object=}`: Override hues for warn palette.
    + * - `background` - `{string}`: The name of the background palette to use in the theme.
    + * - `backgroundHues` - `{object=}`: Override hues for background palette.
    + * - `dark` - `{boolean}`: Indicates if it's a dark theme.
    + * @returns {Promise} A resolved promise with the new theme name. + */ + + /* @ngInject */ + function ThemingService($rootScope, $mdUtil, $q, $log) { + // Allow us to be invoked via a linking function signature. + var applyTheme = function (scope, el) { + if (el === undefined) { el = scope; scope = undefined; } + if (scope === undefined) { scope = $rootScope; } + applyTheme.inherit(el, el); + }; + + Object.defineProperty(applyTheme, 'THEMES', { + get: function () { + return angular.extend({}, THEMES); + } + }); + Object.defineProperty(applyTheme, 'PALETTES', { + get: function () { + return angular.extend({}, PALETTES); + } + }); + Object.defineProperty(applyTheme, 'ALWAYS_WATCH', { + get: function () { + return alwaysWatchTheme; + } + }); + applyTheme.inherit = inheritTheme; + applyTheme.registered = registered; + applyTheme.defaultTheme = function() { return defaultTheme; }; + applyTheme.generateTheme = function(name) { generateTheme(THEMES[name], name, themeConfig.nonce); }; + applyTheme.defineTheme = function(name, options) { + options = options || {}; + + var theme = registerTheme(name); + + if (options.primary) { + theme.primaryPalette(options.primary, options.primaryHues); + } + if (options.accent) { + theme.accentPalette(options.accent, options.accentHues); + } + if (options.warn) { + theme.warnPalette(options.warn, options.warnHues); + } + if (options.background) { + theme.backgroundPalette(options.background, options.backgroundHues); + } + if (options.dark){ + theme.dark(); + } + + this.generateTheme(name); + + return $q.resolve(name); + }; + applyTheme.setBrowserColor = enableBrowserColor; + + return applyTheme; + + /** + * Determine is specified theme name is a valid, registered theme + */ + function registered(themeName) { + if (themeName === undefined || themeName === '') return true; + return applyTheme.THEMES[themeName] !== undefined; + } + + /** + * Get theme name for the element, then update with Theme CSS class + */ + function inheritTheme (el, parent) { + var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController'); + var scope = el.scope(); + + updateThemeClass(lookupThemeName()); + + if (ctrl) { + var watchTheme = alwaysWatchTheme || + ctrl.$shouldWatch || + $mdUtil.parseAttributeBoolean(el.attr('md-theme-watch')); + + if (watchTheme || ctrl.isAsyncTheme) { + var clearNameWatcher = function () { + if (unwatch) { + unwatch(); + unwatch = undefined; + } + }; + + var unwatch = ctrl.registerChanges(function(name) { + updateThemeClass(name); + + if (!watchTheme) { + clearNameWatcher(); + } + }); + + if (scope) { + scope.$on('$destroy', clearNameWatcher); + } else { + el.on('$destroy', clearNameWatcher); + } + } + } + + /** + * Find the theme name from the parent controller or element data + */ + function lookupThemeName() { + // As a few components (dialog) add their controllers later, we should also watch for a controller init. + return ctrl && ctrl.$mdTheme || (defaultTheme === 'default' ? '' : defaultTheme); + } + + /** + * Remove old theme class and apply a new one + * NOTE: if not a valid theme name, then the current name is not changed + */ + function updateThemeClass(theme) { + if (!theme) return; + if (!registered(theme)) { + $log.warn('Attempted to use unregistered theme \'' + theme + '\'. ' + + 'Register it with $mdThemingProvider.theme().'); + } + + var oldTheme = el.data('$mdThemeName'); + if (oldTheme) el.removeClass('md-' + oldTheme +'-theme'); + el.addClass('md-' + theme + '-theme'); + el.data('$mdThemeName', theme); + if (ctrl) { + el.data('$mdThemeController', ctrl); + } + } + } + + } +} + +function ThemingDirective($mdTheming, $interpolate, $parse, $mdUtil, $q, $log) { + return { + priority: 101, // has to be more than 100 to be before interpolation (issue on IE) + link: { + pre: function(scope, el, attrs) { + var registeredCallbacks = []; + + var startSymbol = $interpolate.startSymbol(); + var endSymbol = $interpolate.endSymbol(); + + var theme = attrs.mdTheme.trim(); + + var hasInterpolation = + theme.substr(0, startSymbol.length) === startSymbol && + theme.lastIndexOf(endSymbol) === theme.length - endSymbol.length; + + var oneTimeOperator = '::'; + var oneTimeBind = attrs.mdTheme + .split(startSymbol).join('') + .split(endSymbol).join('') + .trim() + .substr(0, oneTimeOperator.length) === oneTimeOperator; + + var getTheme = function () { + var interpolation = $interpolate(attrs.mdTheme)(scope); + return $parse(interpolation)(scope) || interpolation; + }; + + var ctrl = { + isAsyncTheme: angular.isFunction(getTheme()) || angular.isFunction(getTheme().then), + registerChanges: function (cb, context) { + if (context) { + cb = angular.bind(context, cb); + } + + registeredCallbacks.push(cb); + + return function () { + var index = registeredCallbacks.indexOf(cb); + + if (index > -1) { + registeredCallbacks.splice(index, 1); + } + }; + }, + $setTheme: function (theme) { + if (!$mdTheming.registered(theme)) { + $log.warn('attempted to use unregistered theme \'' + theme + '\''); + } + + ctrl.$mdTheme = theme; + + // Iterating backwards to support unregistering during iteration + // http://stackoverflow.com/a/9882349/890293 + // we don't use `reverse()` of array because it mutates the array and we don't want it + // to get re-indexed + for (var i = registeredCallbacks.length; i--;) { + registeredCallbacks[i](theme); + } + }, + $shouldWatch: $mdUtil.parseAttributeBoolean(el.attr('md-theme-watch')) || + $mdTheming.ALWAYS_WATCH || + (hasInterpolation && !oneTimeBind) + }; + + el.data('$mdThemeController', ctrl); + + var setParsedTheme = function (theme) { + if (typeof theme === 'string') { + return ctrl.$setTheme(theme); + } + + $q.when(angular.isFunction(theme) ? theme() : theme) + .then(function(name) { + ctrl.$setTheme(name); + }); + }; + + setParsedTheme(getTheme()); + + var unwatch = scope.$watch(getTheme, function(theme) { + if (theme) { + setParsedTheme(theme); + + if (!ctrl.$shouldWatch) { + unwatch(); + } + } + }); + } + } + }; +} + +/** + * Special directive that will disable ALL runtime Theme style generation and DOM injection + * + * + * + * + * + * ... + * + * + * Note: Using md-themes-css directive requires the developer to load external + * theme stylesheets; e.g. custom themes from Material-Tools: + * + * `angular-material.themes.css` + * + * Another option is to use the ThemingProvider to configure and disable the attribute + * conversions; this would obviate the use of the `md-themes-css` directive + * + */ +function disableThemesDirective() { + themeConfig.disableTheming = true; + + // Return a 1x-only, first-match attribute directive + return { + restrict : 'A', + priority : '900' + }; +} + +function ThemableDirective($mdTheming) { + return $mdTheming; +} + +function parseRules(theme, colorType, rules) { + checkValidPalette(theme, colorType); + + rules = rules.replace(/THEME_NAME/g, theme.name); + var themeNameRegex = new RegExp('\\.md-' + theme.name + '-theme', 'g'); + // Matches '{{ primary-color }}', etc + var hueRegex = new RegExp('([\'"])?{{\\s*([a-zA-Z]+)-?(color|default)?-?(contrast)?-?((?:\\d\\.?\\d*)|(?:[a-zA-Z]+))?\\s*}}(["\'])?','g'); + var simpleVariableRegex = /'?"?{{\s*([a-zA-Z]+)-(A?\d+|hue-[0-3]|shadow|default)-?(contrast)?-?((?:\d\.?\d*)|(?:[a-zA-Z]+))?\s*}}'?"?/g; + var defaultBgHue = theme.colors['background'].hues['default']; + var defaultBgContrastType = PALETTES[theme.colors['background'].name][defaultBgHue].contrastType; + + // find and replace simple variables where we use a specific hue, not an entire palette + // eg. "{{primary-100}}" + // \(' + THEME_COLOR_TYPES.join('\|') + '\)' + rules = rules.replace(simpleVariableRegex, function(match, colorType, hue, contrast, opacity) { + var regexColorType = colorType; + if (colorType === 'foreground') { + if (hue === 'shadow') { + return theme.foregroundShadow; + } else if (theme.foregroundPalette[hue]) { + // Use user defined palette number (ie: foreground-2) + return rgba(colorToRgbaArray(theme.foregroundPalette[hue])); + } else if (theme.foregroundPalette['1']){ + return rgba(colorToRgbaArray(theme.foregroundPalette['1'])); + } + // Default to background-default-contrast-{opacity} + colorType = 'background'; + contrast = 'contrast'; + if (!opacity && hue) { + // Convert references to legacy hues to opacities (i.e. foreground-4 to *-divider) + switch (hue) { + // hue-1 uses default opacity + case '2': + opacity = 'secondary'; + break; + case '3': + opacity = 'disabled'; + break; + case '4': + opacity = 'divider'; + } + } + hue = 'default'; + } + + // `default` is also accepted as a hue-value, because the background palettes are + // using it as a name for the default hue. + if (hue.indexOf('hue') === 0 || hue === 'default') { + hue = theme.colors[colorType].hues[hue]; + } + + var colorDetails = (PALETTES[ theme.colors[colorType].name ][hue] || ''); + + // If user has specified a foreground color, use those + if (colorType === 'background' && contrast && regexColorType !== 'foreground' && + colorDetails.contrastType === defaultBgContrastType) { + // Don't process if colorType was changed + switch (opacity) { + case 'secondary': + case 'icon': + if (theme.foregroundPalette['2']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['2'])); + } + break; + case 'disabled': + case 'hint': + if (theme.foregroundPalette['3']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['3'])); + } + break; + case 'divider': + if (theme.foregroundPalette['4']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['4'])); + } + break; + default: + if (theme.foregroundPalette['1']) { + return rgba(colorToRgbaArray(theme.foregroundPalette['1'])); + } + break; + } + } + + if (contrast && opacity) { + opacity = colorDetails.opacity[opacity] || opacity; + } + + return rgba(colorDetails[contrast ? 'contrast' : 'value'], opacity); + }); + + var generatedRules = []; + + // For each type, generate rules for each hue (ie. default, md-hue-1, md-hue-2, md-hue-3) + angular.forEach(['default', 'hue-1', 'hue-2', 'hue-3'], function(hueName) { + var newRule = rules + .replace(hueRegex, function(match, _, matchedColorType, hueType, contrast, opacity) { + var color = theme.colors[matchedColorType]; + var palette = PALETTES[color.name]; + var hueValue = color.hues[hueName]; + if (contrast && opacity) { + opacity = palette[hueValue].opacity[opacity] || opacity; + } + return rgba(palette[hueValue][hueType === 'color' ? 'value' : 'contrast'], opacity); + }); + if (hueName !== 'default') { + newRule = newRule.replace(themeNameRegex, '.md-' + theme.name + '-theme.md-' + hueName); + } + + // Don't apply a selector rule to the default theme, making it easier to override + // styles of the base-component + if (theme.name === 'default') { + var themeRuleRegex = /((?:\s|>|\.|\w|-|:|\(|\)|\[|]|"|'|=)*)\.md-default-theme((?:\s|>|\.|\w|-|:|\(|\)|\[|]|"|'|=)*)/g; + + newRule = newRule.replace(themeRuleRegex, function(match, start, end) { + return match + ', ' + start + end; + }); + } + generatedRules.push(newRule); + }); + + return generatedRules; +} + +var rulesByType = {}; + +// Generate our themes at run time given the state of THEMES and PALETTES +function generateAllThemes($injector, $mdTheming) { + var head = document.head; + var firstChild = head ? head.firstElementChild : null; + var themeCss = !themeConfig.disableTheming && $injector.has('$MD_THEME_CSS') ? $injector.get('$MD_THEME_CSS') : ''; + + // Append our custom registered styles to the theme stylesheet. + themeCss += themeConfig.registeredStyles.join(''); + + if (!firstChild) return; + if (themeCss.length === 0) return; // no rules, so no point in running this expensive task + + // Expose contrast colors for palettes to ensure that text is always readable + angular.forEach(PALETTES, sanitizePalette); + + // MD_THEME_CSS is a string generated by the build process that includes all the themeable + // components as templates + + // Break the CSS into individual rules + var rules = splitCss(themeCss).map(function(rule) { + return rule.trim(); + }); + + THEME_COLOR_TYPES.forEach(function(type) { + rulesByType[type] = ''; + }); + + // Sort the rules based on type, allowing us to do color substitution on a per-type basis + rules.forEach(function(rule) { + // First: test that if the rule has '.md-accent', it goes into the accent set of rules + for (var i = 0, type; type = THEME_COLOR_TYPES[i]; i++) { + if (rule.indexOf('.md-' + type) > -1) { + return rulesByType[type] += rule; + } + } + + // If no eg 'md-accent' class is found, try to just find 'accent' in the rule and guess from + // there + for (i = 0; type = THEME_COLOR_TYPES[i]; i++) { + if (rule.indexOf(type) > -1) { + return rulesByType[type] += rule; + } + } + + // Default to the primary array + return rulesByType[DEFAULT_COLOR_TYPE] += rule; + }); + + // If themes are being generated on-demand, quit here. The user will later manually + // call generateTheme to do this on a theme-by-theme basis. + if (themeConfig.generateOnDemand) return; + + angular.forEach($mdTheming.THEMES, function(theme) { + if (!GENERATED[theme.name] && !($mdTheming.defaultTheme() !== 'default' && theme.name === 'default')) { + generateTheme(theme, theme.name, themeConfig.nonce); + } + }); + + + // ************************* + // Internal functions + // ************************* + + /** + * The user specifies a 'default' contrast color as either light or dark, then explicitly lists + * which hues are the opposite contrast (eg. A100 has dark, A200 has light). + * @param {!object} palette to sanitize + */ + function sanitizePalette(palette) { + var defaultContrast = palette.contrastDefaultColor; + var lightColors = palette.contrastLightColors || []; + var strongLightColors = palette.contrastStrongLightColors || []; + var darkColors = palette.contrastDarkColors || []; + + // These colors are provided as space-separated lists + if (typeof lightColors === 'string') lightColors = lightColors.split(' '); + if (typeof strongLightColors === 'string') strongLightColors = strongLightColors.split(' '); + if (typeof darkColors === 'string') darkColors = darkColors.split(' '); + + // Cleanup after ourselves + delete palette.contrastDefaultColor; + delete palette.contrastLightColors; + delete palette.contrastStrongLightColors; + delete palette.contrastDarkColors; + + /** + * @param {string} hueName + * @return {'dark'|'light'|'strongLight'} + */ + function getContrastType(hueName) { + if (defaultContrast === 'light' ? darkColors.indexOf(hueName) !== -1 : + (lightColors.indexOf(hueName) === -1 && strongLightColors.indexOf(hueName) === -1)) { + return 'dark'; + } + if (strongLightColors.indexOf(hueName) !== -1) { + return 'strongLight'; + } + return 'light'; + } + + /** + * @param {'dark'|'light'|'strongLight'} contrastType + * @return {[number, number, number]} [red, green, blue] array + */ + function getContrastColor(contrastType) { + switch (contrastType) { + default: + case 'strongLight': + return STRONG_LIGHT_CONTRAST_COLOR; + case 'light': + return LIGHT_CONTRAST_COLOR; + case 'dark': + return DARK_CONTRAST_COLOR; + } + } + + /** + * @param {'dark'|'light'|'strongLight'} contrastType + * @return {{secondary: number, divider: number, hint: number, icon: number, disabled: number}} + */ + function getOpacityValues(contrastType) { + switch (contrastType) { + default: + case 'strongLight': + return STRONG_LIGHT_CONTRAST_OPACITY; + case 'light': + return LIGHT_CONTRAST_OPACITY; + case 'dark': + return DARK_CONTRAST_OPACITY; + } + } + // Change { 'A100': '#fffeee' } to { 'A100': { value: '#fffeee', contrast:DARK_CONTRAST_COLOR } + angular.forEach(palette, function(hueValue, hueName) { + if (angular.isObject(hueValue)) return; // Already converted + // Map everything to rgb colors + var rgbValue = colorToRgbaArray(hueValue); + if (!rgbValue) { + throw new Error("Color %1, in palette %2's hue %3, is invalid. Hex or rgb(a) color expected." + .replace('%1', hueValue) + .replace('%2', palette.name) + .replace('%3', hueName)); + } + + var contrastType = getContrastType(hueName); + palette[hueName] = { + hex: palette[hueName], + value: rgbValue, + contrastType: contrastType, + contrast: getContrastColor(contrastType), + opacity: getOpacityValues(contrastType) + }; + }); + } + + /** + * @param {string} themeCss + * @returns {[]} a string representing a CSS file that is split, producing an array with a rule + * at each index. + */ + function splitCss(themeCss) { + var result = []; + var currentRule = ''; + var openedCurlyBrackets = 0; + var closedCurlyBrackets = 0; + + for (var i = 0; i < themeCss.length; i++) { + var character = themeCss.charAt(i); + + // Check for content in quotes + if (character === '\'' || character === '"') { + // Append text in quotes to current rule + var textInQuotes = themeCss.substring(i, themeCss.indexOf(character, i + 1)); + currentRule += textInQuotes; + + // Jump to the closing quote char + i += textInQuotes.length; + } else { + currentRule += character; + + if (character === '}') { + closedCurlyBrackets++; + if (closedCurlyBrackets === openedCurlyBrackets) { + closedCurlyBrackets = 0; + openedCurlyBrackets = 0; + result.push(currentRule); + currentRule = ''; + } + } else if (character === '{') { + openedCurlyBrackets++; + } + } + } + // Add comments added after last valid rule. + if (currentRule !== '') { + result.push(currentRule); + } + + return result; + } +} + +function generateTheme(theme, name, nonce) { + var head = document.head; + var firstChild = head ? head.firstElementChild : null; + + if (!GENERATED[name]) { + // For each theme, use the color palettes specified for + // `primary`, `warn` and `accent` to generate CSS rules. + THEME_COLOR_TYPES.forEach(function(colorType) { + var styleStrings = parseRules(theme, colorType, rulesByType[colorType]); + while (styleStrings.length) { + var styleContent = styleStrings.shift(); + if (styleContent) { + var style = document.createElement('style'); + style.setAttribute('md-theme-style', ''); + if (nonce) { + style.setAttribute('nonce', nonce); + } + style.appendChild(document.createTextNode(styleContent)); + head.insertBefore(style, firstChild); + } + } + }); + + GENERATED[theme.name] = true; + } + +} + + +function checkValidPalette(theme, colorType) { + // If theme attempts to use a palette that doesnt exist, throw error + if (!PALETTES[ (theme.colors[colorType] || {}).name ]) { + throw new Error( + "You supplied an invalid color palette for theme %1's %2 palette. Available palettes: %3" + .replace('%1', theme.name) + .replace('%2', colorType) + .replace('%3', Object.keys(PALETTES).join(', ')) + ); + } +} + +/** + * @param {string} clr rbg or rgba color + * @return {number[]|undefined} [red, green, blue] array if it can be computed + */ +function colorToRgbaArray(clr) { + if (angular.isArray(clr) && clr.length === 3) return clr; + if (/^rgb/.test(clr)) { + return clr.replace(/(^\s*rgba?\(|\)\s*$)/g, '').split(',').map(function(value, i) { + return i === 3 ? parseFloat(value) : parseInt(value, 10); + }); + } + if (clr.charAt(0) === '#') clr = clr.substring(1); + if (!/^([a-fA-F0-9]{3}){1,2}$/g.test(clr)) return; + + var dig = clr.length / 3; + var red = clr.substr(0, dig); + var grn = clr.substr(dig, dig); + var blu = clr.substr(dig * 2); + if (dig === 1) { + red += red; + grn += grn; + blu += blu; + } + return [parseInt(red, 16), parseInt(grn, 16), parseInt(blu, 16)]; +} + +function rgba(rgbArray, opacity) { + if (!rgbArray) return "rgb('0,0,0')"; + + if (rgbArray.length === 4) { + rgbArray = angular.copy(rgbArray); + opacity ? rgbArray.pop() : opacity = rgbArray.pop(); + } + return opacity && (typeof opacity == 'number' || (typeof opacity == 'string' && opacity.length)) ? + 'rgba(' + rgbArray.join(',') + ',' + opacity + ')' : + 'rgb(' + rgbArray.join(',') + ')'; +} + + +})(window.angular); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.autocomplete + */ +/* + * @see js folder for autocomplete implementation + */ +angular.module('material.components.autocomplete', [ + 'material.core', + 'material.components.icon', + 'material.components.virtualRepeat' +]); + +})(); +(function(){ +"use strict"; + + +MdAutocompleteCtrl.$inject = ["$scope", "$element", "$mdUtil", "$mdConstant", "$mdTheming", "$window", "$animate", "$rootElement", "$attrs", "$q", "$log", "$mdLiveAnnouncer"];angular + .module('material.components.autocomplete') + .controller('MdAutocompleteCtrl', MdAutocompleteCtrl); + +var ITEM_HEIGHT = 48, + MAX_ITEMS = 5, + MENU_PADDING = 8, + INPUT_PADDING = 2, // Padding provided by `md-input-container` + MODE_STANDARD = 'standard', + MODE_VIRTUAL = 'virtual'; + +function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming, $window, + $animate, $rootElement, $attrs, $q, $log, $mdLiveAnnouncer) { + + // Internal Variables. + var ctrl = this, + itemParts = $scope.itemsExpr.split(/ in /i), + itemExpr = itemParts[ 1 ], + elements = null, + cache = {}, + noBlur = false, + selectedItemWatchers = [], + hasFocus = false, + fetchesInProgress = 0, + enableWrapScroll = null, + inputModelCtrl = null, + debouncedOnResize = $mdUtil.debounce(onWindowResize), + mode = MODE_VIRTUAL; // default + + /** + * The root document element. This is used for attaching a top-level click handler to + * close the options panel when a click outside said panel occurs. We use `documentElement` + * instead of body because, when scrolling is disabled, some browsers consider the body element + * to be completely off the screen and propagate events directly to the html element. + * @type {!Object} angular.JQLite + */ + ctrl.documentElement = angular.element(document.documentElement); + + // Public Exported Variables with handlers + defineProperty('hidden', handleHiddenChange, true); + + // Public Exported Variables + ctrl.scope = $scope; + ctrl.parent = $scope.$parent; + ctrl.itemName = itemParts[0]; + ctrl.matches = []; + ctrl.loading = false; + ctrl.hidden = true; + ctrl.index = -1; + ctrl.activeOption = null; + ctrl.id = $mdUtil.nextUid(); + ctrl.isDisabled = null; + ctrl.isRequired = null; + ctrl.isReadonly = null; + ctrl.hasNotFound = false; + ctrl.selectedMessage = $scope.selectedMessage || 'selected'; + ctrl.noMatchMessage = $scope.noMatchMessage || 'There are no matches available.'; + ctrl.singleMatchMessage = $scope.singleMatchMessage || 'There is 1 match available.'; + ctrl.multipleMatchStartMessage = $scope.multipleMatchStartMessage || 'There are '; + ctrl.multipleMatchEndMessage = $scope.multipleMatchEndMessage || ' matches available.'; + ctrl.defaultEscapeOptions = 'clear'; + + // Public Exported Methods + ctrl.keydown = keydown; + ctrl.blur = blur; + ctrl.focus = focus; + ctrl.clear = clearValue; + ctrl.select = select; + ctrl.listEnter = onListEnter; + ctrl.listLeave = onListLeave; + ctrl.focusInput = focusInputElement; + ctrl.getCurrentDisplayValue = getCurrentDisplayValue; + ctrl.registerSelectedItemWatcher = registerSelectedItemWatcher; + ctrl.unregisterSelectedItemWatcher = unregisterSelectedItemWatcher; + ctrl.notFoundVisible = notFoundVisible; + ctrl.loadingIsVisible = loadingIsVisible; + ctrl.positionDropdown = positionDropdown; + + /** + * Report types to be used for the $mdLiveAnnouncer + * @enum {number} Unique flag id. + */ + var ReportType = { + Count: 1, + Selected: 2 + }; + + return init(); + + // initialization methods + + /** + * Initialize the controller, setup watchers, gather elements + */ + function init () { + + $mdUtil.initOptionalProperties($scope, $attrs, { + searchText: '', + selectedItem: null, + clearButton: false, + disableVirtualRepeat: false, + }); + + $mdTheming($element); + configureWatchers(); + $mdUtil.nextTick(function () { + + gatherElements(); + moveDropdown(); + + // Touch devices often do not send a click event on tap. We still want to focus the input + // and open the options pop-up in these cases. + $element.on('touchstart', focusInputElement); + + // Forward all focus events to the input element when autofocus is enabled + if ($scope.autofocus) { + $element.on('focus', focusInputElement); + } + if ($scope.inputAriaDescribedBy) { + elements.input.setAttribute('aria-describedby', $scope.inputAriaDescribedBy); + } + if (!$scope.floatingLabel) { + if ($scope.inputAriaLabel) { + elements.input.setAttribute('aria-label', $scope.inputAriaLabel); + } else if ($scope.inputAriaLabelledBy) { + elements.input.setAttribute('aria-labelledby', $scope.inputAriaLabelledBy); + } else if ($scope.placeholder) { + // If no aria-label or aria-labelledby references are defined, then just label using the + // placeholder. + elements.input.setAttribute('aria-label', $scope.placeholder); + } + } + }); + } + + function updateModelValidators() { + if (!$scope.requireMatch || !inputModelCtrl) return; + + inputModelCtrl.$setValidity('md-require-match', !!$scope.selectedItem || !$scope.searchText); + } + + /** + * Calculates the dropdown's position and applies the new styles to the menu element + * @returns {*} + */ + function positionDropdown () { + if (!elements) { + return $mdUtil.nextTick(positionDropdown, false, $scope); + } + + var dropdownHeight = ($scope.dropdownItems || MAX_ITEMS) * ITEM_HEIGHT; + var hrect = elements.wrap.getBoundingClientRect(), + vrect = elements.snap.getBoundingClientRect(), + root = elements.root.getBoundingClientRect(), + top = vrect.bottom - root.top, + bot = root.bottom - vrect.top, + left = hrect.left - root.left, + width = hrect.width, + offset = getVerticalOffset(), + position = $scope.dropdownPosition, + styles, enoughBottomSpace, enoughTopSpace; + var bottomSpace = root.bottom - vrect.bottom - MENU_PADDING + $mdUtil.getViewportTop(); + var topSpace = vrect.top - MENU_PADDING; + + // Automatically determine dropdown placement based on available space in viewport. + if (!position) { + enoughTopSpace = topSpace > dropdownHeight; + enoughBottomSpace = bottomSpace > dropdownHeight; + if (enoughBottomSpace) { + position = 'bottom'; + } else if (enoughTopSpace) { + position = 'top'; + } else { + position = topSpace > bottomSpace ? 'top' : 'bottom'; + } + } + // Adjust the width to account for the padding provided by `md-input-container` + if ($attrs.mdFloatingLabel) { + left += INPUT_PADDING; + width -= INPUT_PADDING * 2; + } + styles = { + left: left + 'px', + minWidth: width + 'px', + maxWidth: Math.max(hrect.right - root.left, root.right - hrect.left) - MENU_PADDING + 'px' + }; + + if (position === 'top') { + styles.top = 'auto'; + styles.bottom = bot + 'px'; + styles.maxHeight = Math.min(dropdownHeight, topSpace) + 'px'; + } else { + bottomSpace = root.bottom - hrect.bottom - MENU_PADDING + $mdUtil.getViewportTop(); + + styles.top = (top - offset) + 'px'; + styles.bottom = 'auto'; + styles.maxHeight = Math.min(dropdownHeight, bottomSpace) + 'px'; + } + + elements.$.scrollContainer.css(styles); + $mdUtil.nextTick(correctHorizontalAlignment, false, $scope); + + /** + * Calculates the vertical offset for floating label examples to account for ngMessages + * @returns {number} + */ + function getVerticalOffset () { + var offset = 0; + var inputContainer = $element.find('md-input-container'); + if (inputContainer.length) { + var input = inputContainer.find('input'); + offset = inputContainer.prop('offsetHeight'); + offset -= input.prop('offsetTop'); + offset -= input.prop('offsetHeight'); + // add in the height left up top for the floating label text + offset += inputContainer.prop('offsetTop'); + } + return offset; + } + + /** + * Makes sure that the menu doesn't go off of the screen on either side. + */ + function correctHorizontalAlignment () { + var dropdown = elements.scrollContainer.getBoundingClientRect(), + styles = {}; + if (dropdown.right > root.right) { + styles.left = (hrect.right - dropdown.width) + 'px'; + } + elements.$.scrollContainer.css(styles); + } + } + + /** + * Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues. + */ + function moveDropdown () { + if (!elements.$.root.length) return; + $mdTheming(elements.$.scrollContainer); + elements.$.scrollContainer.detach(); + elements.$.root.append(elements.$.scrollContainer); + if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement); + } + + /** + * Sends focus to the input element. + */ + function focusInputElement () { + elements.input.focus(); + } + + /** + * Update the activeOption based on the selected item in the listbox. + * The activeOption is used in the template to set the aria-activedescendant attribute, which + * enables screen readers to properly handle visual focus within the listbox and announce the + * item's place in the list. I.e. "List item 3 of 50". Anytime that `ctrl.index` changes, this + * function needs to be called to update the activeOption. + */ + function updateActiveOption() { + var selectedOption = elements.scroller.querySelector('.selected'); + if (selectedOption) { + ctrl.activeOption = selectedOption.id; + } else { + ctrl.activeOption = null; + } + } + + /** + * Sets up any watchers used by autocomplete + */ + function configureWatchers () { + var wait = parseInt($scope.delay, 10) || 0; + + $attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); }); + $attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); }); + $attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); }); + + $scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText); + $scope.$watch('selectedItem', selectedItemChange); + + angular.element($window).on('resize', debouncedOnResize); + + $scope.$on('$destroy', cleanup); + } + + /** + * Removes any events or leftover elements created by this controller + */ + function cleanup () { + if (!ctrl.hidden) { + $mdUtil.enableScrolling(); + } + + angular.element($window).off('resize', debouncedOnResize); + + if (elements){ + var items = ['ul', 'scroller', 'scrollContainer', 'input']; + angular.forEach(items, function(key){ + elements.$[key].remove(); + }); + } + } + + /** + * Event handler to be called whenever the window resizes. + */ + function onWindowResize() { + if (!ctrl.hidden) { + positionDropdown(); + } + } + + /** + * Gathers all of the elements needed for this controller + */ + function gatherElements () { + + var snapWrap = gatherSnapWrap(); + + elements = { + main: $element[0], + scrollContainer: $element[0].querySelector('.md-virtual-repeat-container, .md-standard-list-container'), + scroller: $element[0].querySelector('.md-virtual-repeat-scroller, .md-standard-list-scroller'), + ul: $element.find('ul')[0], + input: $element.find('input')[0], + wrap: snapWrap.wrap, + snap: snapWrap.snap, + root: document.body, + }; + + elements.li = elements.ul.getElementsByTagName('li'); + elements.$ = getAngularElements(elements); + mode = elements.scrollContainer.classList.contains('md-standard-list-container') ? MODE_STANDARD : MODE_VIRTUAL; + inputModelCtrl = elements.$.input.controller('ngModel'); + } + + /** + * Gathers the snap and wrap elements + * + */ + function gatherSnapWrap() { + var element; + var value; + for (element = $element; element.length; element = element.parent()) { + value = element.attr('md-autocomplete-snap'); + if (angular.isDefined(value)) break; + } + + if (element.length) { + return { + snap: element[0], + wrap: (value.toLowerCase() === 'width') ? element[0] : $element.find('md-autocomplete-wrap')[0] + }; + } + + var wrap = $element.find('md-autocomplete-wrap')[0]; + return { + snap: wrap, + wrap: wrap + }; + } + + /** + * Gathers angular-wrapped versions of each element + * @param elements + * @returns {{}} + */ + function getAngularElements (elements) { + var obj = {}; + for (var key in elements) { + if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]); + } + return obj; + } + + // event/change handlers + + /** + * @param {Event} $event + */ + function preventDefault($event) { + $event.preventDefault(); + } + + /** + * @param {Event} $event + */ + function stopPropagation($event) { + $event.stopPropagation(); + } + + /** + * Handles changes to the `hidden` property. + * @param {boolean} hidden true to hide the options pop-up, false to show it. + * @param {boolean} oldHidden the previous value of hidden + */ + function handleHiddenChange (hidden, oldHidden) { + var scrollContainerElement; + + if (elements) { + scrollContainerElement = angular.element(elements.scrollContainer); + } + if (!hidden && oldHidden) { + positionDropdown(); + + // Report in polite mode, because the screen reader should finish the default description of + // the input element. + reportMessages(true, ReportType.Count | ReportType.Selected); + + if (elements) { + $mdUtil.disableScrollAround(elements.scrollContainer); + enableWrapScroll = disableElementScrollEvents(elements.wrap); + if ($mdUtil.isIos) { + ctrl.documentElement.on('touchend', handleTouchOutsidePanel); + if (scrollContainerElement) { + scrollContainerElement.on('touchstart touchmove touchend', stopPropagation); + } + } + ctrl.index = getDefaultIndex(); + $mdUtil.nextTick(function() { + updateActiveOption(); + updateScroll(); + }); + } + } else if (hidden && !oldHidden) { + if ($mdUtil.isIos) { + ctrl.documentElement.off('touchend', handleTouchOutsidePanel); + if (scrollContainerElement) { + scrollContainerElement.off('touchstart touchmove touchend', stopPropagation); + } + } + $mdUtil.enableScrolling(); + + if (enableWrapScroll) { + enableWrapScroll(); + enableWrapScroll = null; + } + } + } + + /** + * Handling touch events that bubble up to the document is required for closing the dropdown + * panel on touch outside of the options pop-up panel on iOS. + * @param {Event} $event + */ + function handleTouchOutsidePanel($event) { + ctrl.hidden = true; + // iOS does not blur the pop-up for touches on the scroll mask, so we have to do it. + doBlur(true); + } + + /** + * Disables scrolling for a specific element. + * @param {!string|!DOMElement} element to disable scrolling + * @return {Function} function to call to re-enable scrolling for the element + */ + function disableElementScrollEvents(element) { + var elementToDisable = angular.element(element); + elementToDisable.on('wheel touchmove', preventDefault); + + return function() { + elementToDisable.off('wheel touchmove', preventDefault); + }; + } + + /** + * When the user mouses over the dropdown menu, ignore blur events. + */ + function onListEnter () { + noBlur = true; + } + + /** + * When the user's mouse leaves the menu, blur events may hide the menu again. + */ + function onListLeave () { + if (!hasFocus && !ctrl.hidden) elements.input.focus(); + noBlur = false; + ctrl.hidden = shouldHide(); + } + + /** + * Handles changes to the selected item. + * @param selectedItem + * @param previousSelectedItem + */ + function selectedItemChange (selectedItem, previousSelectedItem) { + + updateModelValidators(); + + if (selectedItem) { + getDisplayValue(selectedItem).then(function (val) { + $scope.searchText = val; + handleSelectedItemChange(selectedItem, previousSelectedItem); + }); + } else if (previousSelectedItem && $scope.searchText) { + getDisplayValue(previousSelectedItem).then(function(displayValue) { + // Clear the searchText, when the selectedItem is set to null. + // Do not clear the searchText, when the searchText isn't matching with the previous + // selected item. + if (angular.isString($scope.searchText) + && displayValue.toString().toLowerCase() === $scope.searchText.toLowerCase()) { + $scope.searchText = ''; + } + }); + } + + if (selectedItem !== previousSelectedItem) { + announceItemChange(); + } + } + + /** + * Use the user-defined expression to announce changes each time a new item is selected + */ + function announceItemChange () { + angular.isFunction($scope.itemChange) && + $scope.itemChange(getItemAsNameVal($scope.selectedItem)); + } + + /** + * Use the user-defined expression to announce changes each time the search text is changed + */ + function announceTextChange () { + angular.isFunction($scope.textChange) && $scope.textChange(); + } + + /** + * Calls any external watchers listening for the selected item. Used in conjunction with + * `registerSelectedItemWatcher`. + * @param selectedItem + * @param previousSelectedItem + */ + function handleSelectedItemChange (selectedItem, previousSelectedItem) { + selectedItemWatchers.forEach(function (watcher) { + watcher(selectedItem, previousSelectedItem); + }); + } + + /** + * Register a function to be called when the selected item changes. + * @param cb + */ + function registerSelectedItemWatcher (cb) { + if (selectedItemWatchers.indexOf(cb) === -1) { + selectedItemWatchers.push(cb); + } + } + + /** + * Unregister a function previously registered for selected item changes. + * @param cb + */ + function unregisterSelectedItemWatcher (cb) { + var i = selectedItemWatchers.indexOf(cb); + if (i !== -1) { + selectedItemWatchers.splice(i, 1); + } + } + + /** + * Handles changes to the searchText property. + * @param {string} searchText + * @param {string} previousSearchText + */ + function handleSearchText (searchText, previousSearchText) { + ctrl.index = getDefaultIndex(); + + // do nothing on init + if (searchText === previousSearchText) return; + + updateModelValidators(); + + getDisplayValue($scope.selectedItem).then(function (val) { + // clear selected item if search text no longer matches it + if (searchText !== val) { + $scope.selectedItem = null; + + // trigger change event if available + if (searchText !== previousSearchText) { + announceTextChange(); + } + + // cancel results if search text is not long enough + if (!isMinLengthMet()) { + ctrl.matches = []; + + setLoading(false); + reportMessages(true, ReportType.Count); + + } else { + handleQuery(); + } + } + }); + + } + + /** + * Handles input blur event, determines if the dropdown should hide. + * @param {Event=} $event + */ + function blur($event) { + hasFocus = false; + + if (!noBlur) { + ctrl.hidden = shouldHide(); + evalAttr('ngBlur', { $event: $event }); + } else if (angular.isObject($event)) { + $event.stopImmediatePropagation(); + } + } + + /** + * Force blur on input element + * @param {boolean} forceBlur + */ + function doBlur(forceBlur) { + if (forceBlur) { + noBlur = false; + hasFocus = false; + } + elements.input.blur(); + } + + /** + * Handles input focus event, determines if the dropdown should show. + */ + function focus($event) { + hasFocus = true; + + if (isSearchable() && isMinLengthMet()) { + handleQuery(); + } + + ctrl.hidden = shouldHide(); + + evalAttr('ngFocus', { $event: $event }); + } + + /** + * Handles keyboard input. + * @param event + */ + function keydown (event) { + switch (event.keyCode) { + case $mdConstant.KEY_CODE.DOWN_ARROW: + if (ctrl.loading || hasSelection()) return; + event.stopPropagation(); + event.preventDefault(); + ctrl.index = ctrl.index + 1 > ctrl.matches.length - 1 ? 0 : Math.min(ctrl.index + 1, ctrl.matches.length - 1); + $mdUtil.nextTick(updateActiveOption); + updateScroll(); + break; + case $mdConstant.KEY_CODE.UP_ARROW: + if (ctrl.loading || hasSelection()) return; + event.stopPropagation(); + event.preventDefault(); + ctrl.index = ctrl.index - 1 < 0 ? ctrl.matches.length - 1 : Math.max(0, ctrl.index - 1); + $mdUtil.nextTick(updateActiveOption); + updateScroll(); + break; + case $mdConstant.KEY_CODE.TAB: + // If we hit tab, assume that we've left the list so it will close + onListLeave(); + + if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return; + select(ctrl.index); + break; + case $mdConstant.KEY_CODE.ENTER: + if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return; + if (hasSelection()) return; + event.stopImmediatePropagation(); + event.preventDefault(); + select(ctrl.index); + break; + case $mdConstant.KEY_CODE.ESCAPE: + event.preventDefault(); // Prevent browser from always clearing input + if (!shouldProcessEscape()) return; + event.stopPropagation(); + + clearSelectedItem(); + if ($scope.searchText && hasEscapeOption('clear')) { + clearSearchText(); + } + + // Manually hide (needed for mdNotFound support) + ctrl.hidden = true; + + if (hasEscapeOption('blur')) { + // Force the component to blur if they hit escape + doBlur(true); + } + + break; + default: + } + } + + // getters + + /** + * Returns the minimum length needed to display the dropdown. + * @returns {*} + */ + function getMinLength () { + return angular.isNumber($scope.minLength) ? $scope.minLength : 1; + } + + /** + * Returns the display value for an item. + * @param {*} item + * @returns {*} + */ + function getDisplayValue (item) { + return $q.when(getItemText(item) || item).then(function(itemText) { + if (itemText && !angular.isString(itemText)) { + $log.warn('md-autocomplete: Could not resolve display value to a string. ' + + 'Please check the `md-item-text` attribute.'); + } + + return itemText; + }); + + /** + * Getter function to invoke user-defined expression (in the directive) + * to convert your object to a single string. + * @param {*} item + * @returns {string|null} + */ + function getItemText (item) { + return (item && $scope.itemText) ? $scope.itemText(getItemAsNameVal(item)) : null; + } + } + + /** + * Returns the locals object for compiling item templates. + * @param {*} item + * @returns {Object|undefined} + */ + function getItemAsNameVal (item) { + if (!item) { + return undefined; + } + + var locals = {}; + if (ctrl.itemName) { + locals[ ctrl.itemName ] = item; + } + + return locals; + } + + /** + * Returns the default index based on whether or not autoselect is enabled. + * @returns {number} 0 if autoselect is enabled, -1 if not. + */ + function getDefaultIndex () { + return $scope.autoselect ? 0 : -1; + } + + /** + * Sets the loading parameter and updates the hidden state. + * @param value {boolean} Whether or not the component is currently loading. + */ + function setLoading(value) { + if (ctrl.loading !== value) { + ctrl.loading = value; + } + + // Always refresh the hidden variable as something else might have changed + ctrl.hidden = shouldHide(); + } + + /** + * Determines if the menu should be hidden. + * @returns {boolean} true if the menu should be hidden + */ + function shouldHide () { + return !shouldShow(); + } + + /** + * Determines whether the autocomplete is able to query within the current state. + * @returns {boolean} true if the query can be run + */ + function isSearchable() { + if (ctrl.loading && !hasMatches()) { + // No query when query is in progress. + return false; + } else if (hasSelection()) { + // No query if there is already a selection + return false; + } + else if (!hasFocus) { + // No query if the input does not have focus + return false; + } + return true; + } + + /** + * @returns {boolean} if the escape keydown should be processed, return true. + * Otherwise return false. + */ + function shouldProcessEscape() { + return hasEscapeOption('blur') || !ctrl.hidden || ctrl.loading || hasEscapeOption('clear') && $scope.searchText; + } + + /** + * @param {string} option check if this option is set + * @returns {boolean} if the specified escape option is set, return true. Return false otherwise. + */ + function hasEscapeOption(option) { + if (!angular.isString($scope.escapeOptions)) { + return ctrl.defaultEscapeOptions.indexOf(option) !== -1; + } else { + return $scope.escapeOptions.toLowerCase().indexOf(option) !== -1; + } + } + + /** + * Determines if the menu should be shown. + * @returns {boolean} true if the menu should be shown + */ + function shouldShow() { + if (ctrl.isReadonly) { + // Don't show if read only is set + return false; + } else if (!isSearchable()) { + // Don't show if a query is in progress, there is already a selection, + // or the input is not focused. + return false; + } + return (isMinLengthMet() && hasMatches()) || notFoundVisible(); + } + + /** + * @returns {boolean} true if the search text has matches. + */ + function hasMatches() { + return ctrl.matches.length ? true : false; + } + + /** + * @returns {boolean} true if the autocomplete has a valid selection. + */ + function hasSelection() { + return ctrl.scope.selectedItem ? true : false; + } + + /** + * @returns {boolean} true if the loading indicator is, or should be, visible. + */ + function loadingIsVisible() { + return ctrl.loading && !hasSelection(); + } + + /** + * @returns {*} the display value of the current item. + */ + function getCurrentDisplayValue () { + return getDisplayValue(ctrl.matches[ ctrl.index ]); + } + + /** + * Determines if the minimum length is met by the search text. + * @returns {*} true if the minimum length is met by the search text + */ + function isMinLengthMet () { + return ($scope.searchText || '').length >= getMinLength(); + } + + // actions + + /** + * Defines a public property with a handler and a default value. + * @param {string} key + * @param {Function} handler function + * @param {*} defaultValue default value + */ + function defineProperty (key, handler, defaultValue) { + Object.defineProperty(ctrl, key, { + get: function () { return defaultValue; }, + set: function (newValue) { + var oldValue = defaultValue; + defaultValue = newValue; + handler(newValue, oldValue); + } + }); + } + + /** + * Selects the item at the given index. + * @param {number} index to select + */ + function select (index) { + // force form to update state for validation + $mdUtil.nextTick(function () { + getDisplayValue(ctrl.matches[ index ]).then(function (val) { + var ngModel = elements.$.input.controller('ngModel'); + $mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive'); + ngModel.$setViewValue(val); + ngModel.$render(); + }).finally(function () { + $scope.selectedItem = ctrl.matches[ index ]; + setLoading(false); + }); + }, false); + } + + /** + * Clears the searchText value and selected item. + * @param {Event} $event + */ + function clearValue ($event) { + if ($event) { + $event.stopPropagation(); + } + clearSelectedItem(); + clearSearchText(); + } + + /** + * Clears the selected item + */ + function clearSelectedItem () { + // Reset our variables + ctrl.index = -1; + $mdUtil.nextTick(updateActiveOption); + ctrl.matches = []; + } + + /** + * Clears the searchText value + */ + function clearSearchText () { + // Set the loading to true so we don't see flashes of content. + // The flashing will only occur when an async request is running. + // So the loading process will stop when the results had been retrieved. + setLoading(true); + + $scope.searchText = ''; + + // Normally, triggering the change / input event is unnecessary, because the browser detects it properly. + // But some browsers are not detecting it properly, which means that we have to trigger the event. + // Using the `input` is not working properly, because for example IE11 is not supporting the `input` event. + // The `change` event is a good alternative and is supported by all supported browsers. + var eventObj = document.createEvent('CustomEvent'); + eventObj.initCustomEvent('change', true, true, { value: '' }); + elements.input.dispatchEvent(eventObj); + + // For some reason, firing the above event resets the value of $scope.searchText if + // $scope.searchText has a space character at the end, so we blank it one more time and then + // focus. + elements.input.blur(); + $scope.searchText = ''; + elements.input.focus(); + } + + /** + * Fetches the results for the provided search text. + * @param searchText + */ + function fetchResults (searchText) { + var items = $scope.$parent.$eval(itemExpr), + term = searchText.toLowerCase(), + isList = angular.isArray(items), + isPromise = !!items.then; // Every promise should contain a `then` property + + if (isList) onResultsRetrieved(items); + else if (isPromise) handleAsyncResults(items); + + function handleAsyncResults(items) { + if (!items) return; + + items = $q.when(items); + fetchesInProgress++; + setLoading(true); + + $mdUtil.nextTick(function () { + items + .then(onResultsRetrieved) + .finally(function(){ + if (--fetchesInProgress === 0) { + setLoading(false); + } + }); + },true, $scope); + } + + function onResultsRetrieved(matches) { + cache[term] = matches; + + // Just cache the results if the request is now outdated. + // The request becomes outdated, when the new searchText has changed during the result fetching. + if ((searchText || '') !== ($scope.searchText || '')) { + return; + } + + handleResults(matches); + } + } + + + /** + * Reports given message types to supported screen readers. + * @param {boolean} isPolite Whether the announcement should be polite. + * @param {!number} types Message flags to be reported to the screen reader. + */ + function reportMessages(isPolite, types) { + var politeness = isPolite ? 'polite' : 'assertive'; + var messages = []; + + if (types & ReportType.Selected && ctrl.index !== -1) { + messages.push(getCurrentDisplayValue()); + } + + if (types & ReportType.Count) { + messages.push($q.resolve(getCountMessage())); + } + + $q.all(messages).then(function(data) { + $mdLiveAnnouncer.announce(data.join(' '), politeness); + }); + } + + /** + * @returns {string} the ARIA message for how many results match the current query. + */ + function getCountMessage () { + switch (ctrl.matches.length) { + case 0: + return ctrl.noMatchMessage; + case 1: + return ctrl.singleMatchMessage; + default: + return ctrl.multipleMatchStartMessage + ctrl.matches.length + ctrl.multipleMatchEndMessage; + } + } + + /** + * Makes sure that the focused element is within view. + */ + function updateScroll () { + if (!elements.li[0]) return; + if (mode === MODE_STANDARD) { + updateStandardScroll(); + } else { + updateVirtualScroll(); + } + } + + function updateVirtualScroll() { + // elements in virtual scroll have consistent heights + var optionHeight = elements.li[0].offsetHeight, + top = optionHeight * Math.max(0, ctrl.index), + bottom = top + optionHeight, + containerHeight = elements.scroller.clientHeight, + scrollTop = elements.scroller.scrollTop; + + if (top < scrollTop) { + scrollTo(top); + } else if (bottom > scrollTop + containerHeight) { + scrollTo(bottom - containerHeight); + } + } + + function updateStandardScroll() { + // elements in standard scroll have variable heights + var selected = elements.li[Math.max(0, ctrl.index)]; + var containerHeight = elements.scrollContainer.offsetHeight, + top = selected && selected.offsetTop || 0, + bottom = top + selected.clientHeight, + scrollTop = elements.scrollContainer.scrollTop; + + if (top < scrollTop) { + scrollTo(top); + } else if (bottom > scrollTop + containerHeight) { + scrollTo(bottom - containerHeight); + } + } + + function isPromiseFetching() { + return fetchesInProgress !== 0; + } + + function scrollTo (offset) { + if (mode === MODE_STANDARD) { + elements.scrollContainer.scrollTop = offset; + } else { + elements.$.scrollContainer.controller('mdVirtualRepeatContainer').scrollTo(offset); + } + } + + function notFoundVisible () { + var textLength = (ctrl.scope.searchText || '').length; + + return ctrl.hasNotFound && !hasMatches() && (!ctrl.loading || isPromiseFetching()) && textLength >= getMinLength() && (hasFocus || noBlur) && !hasSelection(); + } + + /** + * Starts the query to gather the results for the current searchText. Attempts to return cached + * results first, then forwards the process to `fetchResults` if necessary. + */ + function handleQuery () { + var searchText = $scope.searchText || ''; + var term = searchText.toLowerCase(); + + // If caching is enabled and the current searchText is stored in the cache + if (!$scope.noCache && cache[term]) { + // The results should be handled as same as a normal un-cached request does. + handleResults(cache[term]); + } else { + fetchResults(searchText); + } + + ctrl.hidden = shouldHide(); + } + + /** + * Handles the retrieved results by showing them in the autocompletes dropdown. + * @param results Retrieved results + */ + function handleResults(results) { + ctrl.matches = results; + ctrl.hidden = shouldHide(); + + // If loading is in progress, then we'll end the progress. This is needed for example, + // when the `clear` button was clicked, because there we always show the loading process, to prevent flashing. + if (ctrl.loading) setLoading(false); + + if ($scope.selectOnMatch) selectItemOnMatch(); + + positionDropdown(); + reportMessages(true, ReportType.Count); + } + + /** + * If there is only one matching item and the search text matches its display value exactly, + * automatically select that item. Note: This function is only called if the user uses the + * `md-select-on-match` flag. + */ + function selectItemOnMatch () { + var searchText = $scope.searchText, + matches = ctrl.matches, + item = matches[ 0 ]; + if (matches.length === 1) getDisplayValue(item).then(function (displayValue) { + var isMatching = searchText === displayValue; + if ($scope.matchInsensitive && !isMatching) { + isMatching = searchText.toLowerCase() === displayValue.toLowerCase(); + } + + if (isMatching) { + select(0); + } + }); + } + + /** + * Evaluates an attribute expression against the parent scope. + * @param {String} attr Name of the attribute to be evaluated. + * @param {Object?} locals Properties to be injected into the evaluation context. + */ + function evalAttr(attr, locals) { + if ($attrs[attr]) { + $scope.$parent.$eval($attrs[attr], locals || {}); + } + } + +} + +})(); +(function(){ +"use strict"; + + +MdAutocomplete.$inject = ["$$mdSvgRegistry"];angular + .module('material.components.autocomplete') + .directive('mdAutocomplete', MdAutocomplete); + +/** + * @ngdoc directive + * @name mdAutocomplete + * @module material.components.autocomplete + * + * @description + * `` is a special input component with a drop-down of all possible matches to a + * custom query. This component allows you to provide real-time suggestions as the user types + * in the input area. + * + * To start, you will need to specify the required parameters and provide a template for your + * results. The content inside `md-autocomplete` will be treated as a template. + * + * In more complex cases, you may want to include other content such as a message to display when + * no matches were found. You can do this by wrapping your template in `md-item-template` and + * adding a tag for `md-not-found`. An example of this is shown below. + * + * To reset the displayed value you must clear both values for `md-search-text` and + * `md-selected-item`. + * + * ### Validation + * + * You can use `ng-messages` to include validation the same way that you would normally validate; + * however, if you want to replicate a standard input with a floating label, you will have to + * do the following: + * + * - Make sure that your template is wrapped in `md-item-template` + * - Add your `ng-messages` code inside of `md-autocomplete` + * - Add your validation properties to `md-autocomplete` (ie. `required`) + * - Add a `name` to `md-autocomplete` (to be used on the generated `input`) + * + * There is an example below of how this should look. + * + * ### Snapping Drop-Down + * + * You can cause the autocomplete drop-down to snap to an ancestor element by applying the + * `md-autocomplete-snap` attribute to that element. You can also snap to the width of + * the `md-autocomplete-snap` element by setting the attribute's value to `width` + * (ie. `md-autocomplete-snap="width"`). + * + * ### Notes + * + * **Autocomplete Dropdown Items Rendering** + * + * The `md-autocomplete` uses the the + * mdVirtualRepeat directive for displaying the results inside of the dropdown.
    + * + * > When encountering issues regarding the item template please take a look at the + * VirtualRepeatContainer documentation. + * + * **Autocomplete inside of a Virtual Repeat** + * + * When using the `md-autocomplete` directive inside of a + * VirtualRepeatContainer the dropdown items + * might not update properly, because caching of the results is enabled by default. + * + * The autocomplete will then show invalid dropdown items, because the Virtual Repeat only updates + * the scope bindings rather than re-creating the `md-autocomplete`. This means that the previous + * cached results will be used. + * + * > To avoid such problems, ensure that the autocomplete does not cache any results via + * `md-no-cache="true"`: + * + * + * + * {{ item.display }} + * + * + * + * + * @param {expression} md-items An expression in the format of `item in results` to iterate over + * matches for your search.

    + * The `results` expression can be also a function, which returns the results synchronously + * or asynchronously (per Promise). + * @param {expression=} md-selected-item-change An expression to be run each time a new item is + * selected. + * @param {expression=} md-search-text-change An expression to be run each time the search text + * updates. + * @param {expression=} md-search-text A model to bind the search query text to. + * @param {object=} md-selected-item A model to bind the selected item to. + * @param {expression=} md-item-text An expression that will convert your object to a single string. + * @param {string=} placeholder Placeholder text that will be forwarded to the input. + * @param {boolean=} md-no-cache Disables the internal caching that happens in autocomplete. + * @param {boolean=} ng-disabled Determines whether or not to disable the input field. + * @param {boolean=} md-require-match When set to true, the autocomplete will add a validator, + * which will evaluate to false, when no item is currently selected. + * @param {number=} md-min-length Specifies the minimum length of text before autocomplete will + * make suggestions. + * @param {number=} md-delay Specifies the amount of time (in milliseconds) to wait before looking + * for results. + * @param {boolean=} md-clear-button Whether the clear button for the autocomplete input should show + * up or not. When `md-floating-label` is set, defaults to false, defaults to true otherwise. + * @param {boolean=} md-autofocus If true, the autocomplete will be automatically focused when a + * `$mdDialog`, `$mdBottomsheet` or `$mdSidenav`, which contains the autocomplete, is opening. + *

    + * Also the autocomplete will immediately focus the input element. + * @param {boolean=} md-no-asterisk When present, asterisk will not be appended to the floating + * label. + * @param {boolean=} md-autoselect If set to true, the first item will be automatically selected + * in the dropdown upon open. + * @param {string=} md-input-name The name attribute given to the input element to be used with + * FormController. + * @param {string=} md-menu-class This class will be applied to the dropdown menu for styling. + * @param {string=} md-menu-container-class This class will be applied to the parent container + * of the dropdown panel. + * @param {string=} md-input-class This will be applied to the input for styling. This attribute + * is only valid when a `md-floating-label` is defined. + * @param {string=} md-floating-label This will add a floating label to autocomplete and wrap it in + * `md-input-container`. + * @param {string=} md-select-on-focus When present the input's text will be automatically selected + * on focus. + * @param {string=} md-input-id An ID to be added to the input element. + * @param {number=} md-input-minlength The minimum length for the input's value for validation. + * @param {number=} md-input-maxlength The maximum length for the input's value for validation. + * @param {boolean=} md-select-on-match When set, autocomplete will automatically select + * the item if the search text is an exact match.

    + * An exact match is when only one match is displayed. + * @param {boolean=} md-match-case-insensitive When set and using `md-select-on-match`, autocomplete + * will select on case-insensitive match. + * @param {string=} md-escape-options Override escape key logic. Default is `clear`.
    + * Options: `blur`, `clear`, `none`. + * @param {string=} md-dropdown-items Specifies the maximum amount of items to be shown in + * the dropdown.

    + * When the dropdown doesn't fit into the viewport, the dropdown will shrink + * as much as possible. + * @param {string=} md-dropdown-position Overrides the default dropdown position. Options: `top`, + * `bottom`. + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this autocomplete. Screen readers will read the + * content of these elements at the end of announcing that the autocomplete has been selected + * and describing its current state. The descriptive elements do not need to be visible on the + * page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use case + * is that this would contain the ID of a `
    ' : ''; + } + + function getRepeatType(repeatMode) { + return isVirtualRepeatDisabled(repeatMode) ? + 'ng-repeat' : 'md-virtual-repeat'; + } + + function isVirtualRepeatDisabled(repeatMode) { + // ensure we have a valid repeat mode + var correctedRepeatMode = getRepeatMode(repeatMode); + return correctedRepeatMode !== REPEAT_VIRTUAL; + } + + function getInputElement () { + if (attr.mdFloatingLabel) { + return '\ + \ + \ + \ +
    ' + leftover + '
    \ +
    '; + } else { + return '\ + '; + } + } + + function getClearButton() { + return '' + + ''; + } + } + }; +} + +})(); +(function(){ +"use strict"; + + +MdAutocompleteItemScopeDirective.$inject = ["$compile", "$mdUtil"];angular + .module('material.components.autocomplete') + .directive('mdAutocompleteParentScope', MdAutocompleteItemScopeDirective); + +function MdAutocompleteItemScopeDirective($compile, $mdUtil) { + return { + restrict: 'AE', + compile: compile, + terminal: true, + transclude: 'element' + }; + + function compile(tElement, tAttr, transclude) { + return function postLink(scope, element, attr) { + var ctrl = scope.$mdAutocompleteCtrl; + var newScope = ctrl.parent.$new(); + var itemName = ctrl.itemName; + + // Watch for changes to our scope's variables and copy them to the new scope + watchVariable('$index', '$index'); + watchVariable('item', itemName); + + // Ensure that $digest calls on our scope trigger $digest on newScope. + connectScopes(); + + // Link the element against newScope. + transclude(newScope, function(clone) { + element.after(clone); + }); + + /** + * Creates a watcher for variables that are copied from the parent scope + * @param variable + * @param alias + */ + function watchVariable(variable, alias) { + newScope[alias] = scope[variable]; + + scope.$watch(variable, function(value) { + $mdUtil.nextTick(function() { + newScope[alias] = value; + }); + }); + } + + /** + * Creates watchers on scope and newScope that ensure that for any + * $digest of scope, newScope is also $digested. + */ + function connectScopes() { + var scopeDigesting = false; + var newScopeDigesting = false; + + scope.$watch(function() { + if (newScopeDigesting || scopeDigesting) { + return; + } + + scopeDigesting = true; + scope.$$postDigest(function() { + if (!newScopeDigesting) { + newScope.$digest(); + } + + scopeDigesting = newScopeDigesting = false; + }); + }); + + newScope.$watch(function() { + newScopeDigesting = true; + }); + } + }; + } +} +})(); +(function(){ +"use strict"; + + +MdHighlightCtrl.$inject = ["$scope", "$element", "$attrs", "$mdUtil"];angular + .module('material.components.autocomplete') + .controller('MdHighlightCtrl', MdHighlightCtrl); + +function MdHighlightCtrl ($scope, $element, $attrs, $mdUtil) { + this.$scope = $scope; + this.$element = $element; + this.$attrs = $attrs; + this.$mdUtil = $mdUtil; + + // Cache the Regex to avoid rebuilding each time. + this.regex = null; +} + +MdHighlightCtrl.prototype.init = function(unsafeTermFn, unsafeContentFn) { + + this.flags = this.$attrs.mdHighlightFlags || ''; + + this.unregisterFn = this.$scope.$watch(function($scope) { + return { + term: unsafeTermFn($scope), + contentText: unsafeContentFn($scope) + }; + }.bind(this), this.onRender.bind(this), true); + + this.$element.on('$destroy', this.unregisterFn); +}; + +/** + * Triggered once a new change has been recognized and the highlighted + * text needs to be updated. + */ +MdHighlightCtrl.prototype.onRender = function(state, prevState) { + + var contentText = state.contentText; + + /* Update the regex if it's outdated, because we don't want to rebuilt it constantly. */ + if (this.regex === null || state.term !== prevState.term) { + this.regex = this.createRegex(state.term, this.flags); + } + + /* If a term is available apply the regex to the content */ + if (state.term) { + this.applyRegex(contentText); + } else { + this.$element.text(contentText); + } + +}; + +/** + * Decomposes the specified text into different tokens (whether match or not). + * Breaking down the string guarantees proper XSS protection due to the native browser + * escaping of unsafe text. + */ +MdHighlightCtrl.prototype.applyRegex = function(text) { + var tokens = this.resolveTokens(text); + + this.$element.empty(); + + tokens.forEach(function (token) { + + if (token.isMatch) { + var tokenEl = angular.element('').text(token.text); + + this.$element.append(tokenEl); + } else { + this.$element.append(document.createTextNode(token)); + } + + }.bind(this)); + +}; + + /** + * Decomposes the specified text into different tokens by running the regex against the text. + */ +MdHighlightCtrl.prototype.resolveTokens = function(string) { + var tokens = []; + var lastIndex = 0; + + // Use replace here, because it supports global and single regular expressions at same time. + string.replace(this.regex, function(match, index) { + appendToken(lastIndex, index); + + tokens.push({ + text: match, + isMatch: true + }); + + lastIndex = index + match.length; + }); + + // Append the missing text as a token. + appendToken(lastIndex); + + return tokens; + + function appendToken(from, to) { + var targetText = string.slice(from, to); + targetText && tokens.push(targetText); + } +}; + +/** Creates a regex for the specified text with the given flags. */ +MdHighlightCtrl.prototype.createRegex = function(term, flags) { + var startFlag = '', endFlag = ''; + var regexTerm = this.$mdUtil.sanitize(term); + + if (flags.indexOf('^') >= 0) startFlag = '^'; + if (flags.indexOf('$') >= 0) endFlag = '$'; + + return new RegExp(startFlag + regexTerm + endFlag, flags.replace(/[$^]/g, '')); +}; + +})(); +(function(){ +"use strict"; + + +MdHighlight.$inject = ["$interpolate", "$parse"];angular + .module('material.components.autocomplete') + .directive('mdHighlightText', MdHighlight); + +/** + * @ngdoc directive + * @name mdHighlightText + * @module material.components.autocomplete + * + * @description + * The `md-highlight-text` directive allows you to specify text that should be highlighted within + * an element. Highlighted text will be wrapped in `` which can + * be styled through CSS. Please note that child elements may not be used with this directive. + * + * @param {string} md-highlight-text A model to be searched for + * @param {string=} md-highlight-flags A list of flags (loosely based on JavaScript RexExp flags). + * #### **Supported flags**: + * - `g`: Find all matches within the provided text + * - `i`: Ignore case when searching for matches + * - `$`: Only match if the text ends with the search term + * - `^`: Only match if the text begins with the search term + * + * @usage + * + * + *
      + *
    • + * {{result.text}} + *
    • + *
    + *
    + */ + +function MdHighlight ($interpolate, $parse) { + return { + terminal: true, + controller: 'MdHighlightCtrl', + compile: function mdHighlightCompile(tElement, tAttr) { + var termExpr = $parse(tAttr.mdHighlightText); + var unsafeContentExpr = $interpolate(tElement.html()); + + return function mdHighlightLink(scope, element, attr, ctrl) { + ctrl.init(termExpr, unsafeContentExpr); + }; + } + }; +} + +})(); +(function(){ +"use strict"; + +/* + * @ngdoc module + * @name material.components.backdrop + * @description Backdrop + */ + +/** + * @ngdoc directive + * @name mdBackdrop + * @module material.components.backdrop + * + * @restrict E + * + * @description + * `` is a backdrop element used by other components, such as dialog and bottom sheet. + * Apply class `opaque` to make the backdrop use the theme backdrop color. + * + */ + +angular + .module('material.components.backdrop', ['material.core']) + .directive('mdBackdrop', ["$mdTheming", "$mdUtil", "$animate", "$rootElement", "$window", "$log", "$$rAF", "$document", function BackdropDirective($mdTheming, $mdUtil, $animate, $rootElement, $window, $log, $$rAF, $document) { + var ERROR_CSS_POSITION = ' may not work properly in a scrolled, static-positioned parent container.'; + + return { + restrict: 'E', + link: postLink + }; + + function postLink(scope, element, attrs) { + // backdrop may be outside the $rootElement, tell ngAnimate to animate regardless + if ($animate.pin) $animate.pin(element, $rootElement); + + var bodyStyles; + + $$rAF(function() { + // If body scrolling has been disabled using mdUtil.disableBodyScroll(), + // adjust the 'backdrop' height to account for the fixed 'body' top offset. + // Note that this can be pretty expensive and is better done inside the $$rAF. + bodyStyles = $window.getComputedStyle($document[0].body); + + if (bodyStyles.position === 'fixed') { + var resizeHandler = $mdUtil.debounce(function(){ + bodyStyles = $window.getComputedStyle($document[0].body); + resize(); + }, 60, null, false); + + resize(); + angular.element($window).on('resize', resizeHandler); + + scope.$on('$destroy', function() { + angular.element($window).off('resize', resizeHandler); + }); + } + + // Often $animate.enter() is used to append the backDrop element + // so let's wait until $animate is done... + var parent = element.parent(); + + if (parent.length) { + if (parent[0].nodeName === 'BODY') { + element.css('position', 'fixed'); + } + + var styles = $window.getComputedStyle(parent[0]); + + if (styles.position === 'static') { + // backdrop uses position:absolute and will not work properly with parent position:static (default) + $log.warn(ERROR_CSS_POSITION); + } + + // Only inherit the parent if the backdrop has a parent. + $mdTheming.inherit(element, parent); + } + }); + + function resize() { + var viewportHeight = parseInt(bodyStyles.height, 10) + Math.abs(parseInt(bodyStyles.top, 10)); + element.css('height', viewportHeight + 'px'); + } + } + + }]); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.bottomSheet + * @description + * BottomSheet + */ +MdBottomSheetDirective.$inject = ["$mdBottomSheet"]; +MdBottomSheetProvider.$inject = ["$$interimElementProvider"]; +angular + .module('material.components.bottomSheet', [ + 'material.core', + 'material.components.backdrop' + ]) + .directive('mdBottomSheet', MdBottomSheetDirective) + .provider('$mdBottomSheet', MdBottomSheetProvider); + +/* @ngInject */ +function MdBottomSheetDirective($mdBottomSheet) { + return { + restrict: 'E', + link : function postLink(scope, element) { + element.addClass('_md'); // private md component indicator for styling + + // When navigation force destroys an interimElement, then + // listen and $destroy() that interim instance... + scope.$on('$destroy', function() { + $mdBottomSheet.destroy(); + }); + } + }; +} + + +/** + * @ngdoc service + * @name $mdBottomSheet + * @module material.components.bottomSheet + * + * @description + * `$mdBottomSheet` opens a bottom sheet over the app and provides a simple promise API. + * + * ## Restrictions + * + * - The bottom sheet's template must have an outer `` element. + * - Add the `md-grid` class to the bottom sheet for a grid layout. + * - Add the `md-list` class to the bottom sheet for a list layout. + * + * @usage + * + *
    + * + * Open a Bottom Sheet! + * + *
    + *
    + * + * var app = angular.module('app', ['ngMaterial']); + * app.controller('MyController', function($scope, $mdBottomSheet) { + * $scope.openBottomSheet = function() { + * $mdBottomSheet.show({ + * template: '' + + * 'Hello! Close' + + * '' + * }) + * + * // Fires when the hide() method is used + * .then(function() { + * console.log('You clicked the button to close the bottom sheet!'); + * }) + * + * // Fires when the cancel() method is used + * .catch(function() { + * console.log('You hit escape or clicked the backdrop to close.'); + * }); + * }; + * + * $scope.closeBottomSheet = function($scope, $mdBottomSheet) { + * $mdBottomSheet.hide(); + * } + * + * }); + * + * + * ### Custom Presets + * Developers are also able to create their own preset, which can be easily used without repeating + * their options each time. + * + * + * $mdBottomSheetProvider.addPreset('testPreset', { + * options: function() { + * return { + * template: + * '' + + * 'This is a custom preset' + + * '', + * controllerAs: 'bottomSheet', + * bindToController: true, + * clickOutsideToClose: true, + * escapeToClose: true + * }; + * } + * }); + * + * + * After you create your preset during the config phase, you can easily access it. + * + * + * $mdBottomSheet.show( + * $mdBottomSheet.testPreset() + * ); + * + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#show + * + * @description + * Show a bottom sheet with the specified options. + * + * Note: You should always provide a `.catch()` method in case the user hits the + * `esc` key or clicks the background to close. In this case, the `cancel()` method will + * automatically be called on the bottom sheet which will `reject()` the promise. See the @usage + * section above for an example. + * + * Newer versions of Angular will throw a `Possibly unhandled rejection` exception if you forget + * this. + * + * @param {Object} optionsOrPreset Either provide an `$mdBottomSheetPreset` defined during the + * config phase or an options object, with the following properties: + * + * - `templateUrl` - `{string=}`: The url of an html template file that will + * be used as the content of the bottom sheet. Restrictions: the template must + * have an outer `md-bottom-sheet` element. + * - `template` - `{string=}`: Same as templateUrl, except this is an actual + * template string. + * - `scope` - `{Object=}`: the scope to link the template / controller to. If none is specified, + * it will create a new child scope. This scope will be destroyed when the bottom sheet is + * removed unless `preserveScope` is set to true. + * - `preserveScope` - `{boolean=}`: whether to preserve the scope when the element is removed. + * Default is false + * - `controller` - `{string=}`: The controller to associate with this bottom sheet. + * - `locals` - `{string=}`: An object containing key/value pairs. The keys will be used as names + * of values to inject into the controller. For example, `locals: {three: 3}` would inject + * `three` into the controller with the value of 3. + * - `clickOutsideToClose` - `{boolean=}`: Whether the user can click outside the bottom sheet to + * close it. Default true. + * - `bindToController` - `{boolean=}`: When set to true, the locals will be bound to the + * controller instance and available in it's $onInit function. + * - `disableBackdrop` - `{boolean=}`: When set to true, the bottomsheet will not show a backdrop. + * - `escapeToClose` - `{boolean=}`: Whether the user can press escape to close the bottom sheet. + * Default true. + * - `isLockedOpen` - `{boolean=}`: Disables all default ways of closing the bottom sheet. + * **Note:** this will override the `clickOutsideToClose` and `escapeToClose` options, leaving + * only the `hide` and `cancel` methods as ways of closing the bottom sheet. Defaults to false. + * - `resolve` - `{Object=}`: Similar to locals, except it takes promises as values + * and the bottom sheet will not open until the promises resolve. + * - `controllerAs` - `{string=}`: An alias to assign the controller to on the scope. + * - `parent` - `{element=}`: The element to append the bottom sheet to. The `parent` may be a + * `function`, `string`, `Object`, or null. Defaults to appending to the body of the root element + * (or the root element) of the application. + * e.g. angular.element(document.getElementById('content')) or "#content" + * - `disableParentScroll` - `{boolean=}`: Whether to disable scrolling while the bottom sheet is + * open. Default true. + * + * @returns {promise} A promise that can be resolved with `$mdBottomSheet.hide()` or + * rejected with `$mdBottomSheet.cancel()`. + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#hide + * + * @description + * Hide the existing bottom sheet and resolve the promise returned from + * `$mdBottomSheet.show()`. This call will close the most recently opened/current bottom sheet (if + * any). + * + * Note: Use a `.then()` on your `.show()` to handle this callback. + * + * @param {*=} response An argument for the resolved promise. + * + */ + +/** + * @ngdoc method + * @name $mdBottomSheet#cancel + * + * @description + * Hide the existing bottom sheet and reject the promise returned from + * `$mdBottomSheet.show()`. + * + * Note: Use a `.catch()` on your `.show()` to handle this callback. + * + * @param {*=} response An argument for the rejected promise. + * + */ + +function MdBottomSheetProvider($$interimElementProvider) { + // how fast we need to flick down to close the sheet, pixels/ms + bottomSheetDefaults.$inject = ["$animate", "$mdConstant", "$mdUtil", "$mdTheming", "$mdBottomSheet", "$rootElement", "$mdGesture", "$log"]; + var CLOSING_VELOCITY = 0.5; + var PADDING = 80; // same as css + + return $$interimElementProvider('$mdBottomSheet') + .setDefaults({ + methods: ['disableParentScroll', 'escapeToClose', 'clickOutsideToClose'], + options: bottomSheetDefaults + }); + + /* @ngInject */ + function bottomSheetDefaults($animate, $mdConstant, $mdUtil, $mdTheming, $mdBottomSheet, $rootElement, + $mdGesture, $log) { + var backdrop; + + return { + themable: true, + onShow: onShow, + onRemove: onRemove, + disableBackdrop: false, + escapeToClose: true, + clickOutsideToClose: true, + disableParentScroll: true, + isLockedOpen: false + }; + + function onShow(scope, element, options) { + element = $mdUtil.extractElementByName(element, 'md-bottom-sheet'); + + // prevent tab focus or click focus on the bottom-sheet container + element.attr('tabindex', '-1'); + + // Once the md-bottom-sheet has `ng-cloak` applied on his template the opening animation will not work properly. + // This is a very common problem, so we have to notify the developer about this. + if (element.hasClass('ng-cloak')) { + var message = '$mdBottomSheet: using `` will affect the bottom-sheet opening animations.'; + $log.warn(message, element[0]); + } + + if (options.isLockedOpen) { + options.clickOutsideToClose = false; + options.escapeToClose = false; + } else { + options.cleanupGestures = registerGestures(element, options.parent); + } + + if (!options.disableBackdrop) { + // Add a backdrop that will close on click + backdrop = $mdUtil.createBackdrop(scope, "md-bottom-sheet-backdrop md-opaque"); + + // Prevent mouse focus on backdrop; ONLY programmatic focus allowed. + // This allows clicks on backdrop to propagate to the $rootElement and + // ESC key events to be detected properly. + backdrop[0].tabIndex = -1; + + if (options.clickOutsideToClose) { + backdrop.on('click', function() { + $mdUtil.nextTick($mdBottomSheet.cancel, true); + }); + } + + $mdTheming.inherit(backdrop, options.parent); + + $animate.enter(backdrop, options.parent, null); + } + + $mdTheming.inherit(element, options.parent); + + if (options.disableParentScroll) { + options.restoreScroll = $mdUtil.disableScrollAround(element, options.parent); + } + + return $animate.enter(element, options.parent, backdrop) + .then(function() { + var focusable = $mdUtil.findFocusTarget(element) || angular.element( + element[0].querySelector('button') || + element[0].querySelector('a') || + element[0].querySelector($mdUtil.prefixer('ng-click', true)) + ) || backdrop; + + if (options.escapeToClose) { + options.rootElementKeyupCallback = function(e) { + if (e.keyCode === $mdConstant.KEY_CODE.ESCAPE) { + $mdUtil.nextTick($mdBottomSheet.cancel, true); + } + }; + + $rootElement.on('keyup', options.rootElementKeyupCallback); + focusable && focusable.focus(); + } + }); + + } + + function onRemove(scope, element, options) { + if (!options.disableBackdrop) $animate.leave(backdrop); + + return $animate.leave(element).then(function() { + if (options.disableParentScroll) { + options.restoreScroll(); + delete options.restoreScroll; + } + + options.cleanupGestures && options.cleanupGestures(); + }); + } + + /** + * Adds the drag gestures to the bottom sheet. + * @param {JQLite} element where CSS transitions will be applied + * @param {JQLite} parent used for registering gesture listeners + * @return {Function} function that removes gesture listeners that were set up by + * registerGestures() + */ + function registerGestures(element, parent) { + var deregister = $mdGesture.register(parent, 'drag', { horizontal: false }); + parent.on('$md.dragstart', onDragStart) + .on('$md.drag', onDrag) + .on('$md.dragend', onDragEnd); + + return function cleanupGestures() { + deregister(); + parent.off('$md.dragstart', onDragStart); + parent.off('$md.drag', onDrag); + parent.off('$md.dragend', onDragEnd); + }; + + function onDragStart() { + // Disable transitions on transform so that it feels fast + element.css($mdConstant.CSS.TRANSITION_DURATION, '0ms'); + } + + function onDrag(ev) { + var transform = ev.pointer.distanceY; + if (transform < 5) { + // Slow down drag when trying to drag up, and stop after PADDING + transform = Math.max(-PADDING, transform / 2); + } + element.css($mdConstant.CSS.TRANSFORM, 'translate3d(0,' + (PADDING + transform) + 'px,0)'); + } + + function onDragEnd(ev) { + if (ev.pointer.distanceY > 0 && + (ev.pointer.distanceY > 20 || Math.abs(ev.pointer.velocityY) > CLOSING_VELOCITY)) { + var distanceRemaining = element.prop('offsetHeight') - ev.pointer.distanceY; + var transitionDuration = Math.min(distanceRemaining / ev.pointer.velocityY * 0.75, 500); + element.css($mdConstant.CSS.TRANSITION_DURATION, transitionDuration + 'ms'); + $mdUtil.nextTick($mdBottomSheet.cancel, true); + } else { + element.css($mdConstant.CSS.TRANSITION_DURATION, ''); + element.css($mdConstant.CSS.TRANSFORM, ''); + } + } + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.button + * @description + * + * Button + */ +MdButtonDirective.$inject = ["$mdButtonInkRipple", "$mdTheming", "$mdAria", "$mdInteraction"]; +MdAnchorDirective.$inject = ["$mdTheming"]; +angular + .module('material.components.button', ['material.core']) + .directive('mdButton', MdButtonDirective) + .directive('a', MdAnchorDirective); + + +/** + * @private + * @restrict E + * + * @description + * `a` is an anchor directive used to inherit theme colors for md-primary, md-accent, etc. + * + * @usage + * + * + * + * + * + * + */ +function MdAnchorDirective($mdTheming) { + return { + restrict : 'E', + link : function postLink(scope, element) { + // Make sure to inherit theme so stand-alone anchors + // support theme colors for md-primary, md-accent, etc. + $mdTheming(element); + } + }; +} + + +/** + * @ngdoc directive + * @name mdButton + * @module material.components.button + * + * @restrict E + * + * @description + * `` is a button directive with optional ink ripples (default enabled). + * + * If you supply a `href` or `ng-href` attribute, it will become an `` element. Otherwise, it + * will become a `'; + } + } + + function postLink(scope, element, attr) { + $mdTheming(element); + $mdButtonInkRipple.attach(scope, element); + + // Use async expect to support possible bindings in the button label + $mdAria.expectWithoutText(element, 'aria-label'); + + // For anchor elements, we have to set tabindex manually when the element is disabled. + // We don't do this for md-nav-bar anchors as the component manages its own tabindex values. + if (isAnchor(attr) && angular.isDefined(attr.ngDisabled) && + !element.hasClass('_md-nav-button')) { + scope.$watch(attr.ngDisabled, function(isDisabled) { + element.attr('tabindex', isDisabled ? -1 : 0); + }); + } + + // disabling click event when disabled is true + element.on('click', function(e){ + if (attr.disabled === true) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + }); + + if (!element.hasClass('md-no-focus')) { + + element.on('focus', function() { + + // Only show the focus effect when being focused through keyboard interaction or programmatically + if (!$mdInteraction.isUserInvoked() || $mdInteraction.getLastInteractionType() === 'keyboard') { + element.addClass('md-focused'); + } + + }); + + element.on('blur', function() { + element.removeClass('md-focused'); + }); + } + + } + +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.card + * + * @description + * Card components. + */ +mdCardDirective.$inject = ["$mdTheming"]; +angular.module('material.components.card', [ + 'material.core' + ]) + .directive('mdCard', mdCardDirective); + + +/** + * @ngdoc directive + * @name mdCard + * @module material.components.card + * + * @restrict E + * + * @description + * The `` directive is a container element used within `` containers. + * + * An image included as a direct descendant will fill the card's width. If you want to avoid this, + * you can add the `md-image-no-fill` class to the parent element. The `` + * container will wrap text content and provide padding. An `` element can be + * optionally included to put content flush against the bottom edge of the card. + * + * Action buttons can be included in an `` element, similar to ``. + * You can then position buttons using layout attributes. + * + * Card is built with: + * * `` - Header for the card, holds avatar, text and squared image + * - `` - Card avatar + * - `md-user-avatar` - Class for user image + * - `` + * - `` - Contains elements for the card description + * - `md-title` - Class for the card title + * - `md-subhead` - Class for the card sub header + * * `` - Image for the card + * * `` - Card content title + * - `` + * - `md-headline` - Class for the card content title + * - `md-subhead` - Class for the card content sub header + * - `` - Squared image within the title + * - `md-media-sm` - Class for small image + * - `md-media-md` - Class for medium image + * - `md-media-lg` - Class for large image + * - `md-media-xl` - Class for extra large image + * * `` - Card content + * * `` - Card actions + * - `` - Icon actions + * + * Cards have constant width and variable heights; where the maximum height is limited to what can + * fit within a single view on a platform, but it can temporarily expand as needed. + * + * @usage + * ### Card with optional footer + * + * + * image caption + * + *

    Card headline

    + *

    Card content

    + *
    + * + * Card footer + * + *
    + *
    + * + * ### Card with actions + * + * + * image caption + * + *

    Card headline

    + *

    Card content

    + *
    + * + * Action 1 + * Action 2 + * + *
    + *
    + * + * ### Card with header, image, title actions and content + * + * + * + * + * + * + * + * Title + * Sub header + * + * + * image caption + * + * + * Card headline + * Card subheader + * + * + * + * Action 1 + * Action 2 + * + * + * + * + * + * + * + *

    + * Card content + *

    + *
    + *
    + *
    + */ +function mdCardDirective($mdTheming) { + return { + restrict: 'E', + link: function ($scope, $element, attr) { + $element.addClass('_md'); // private md component indicator for styling + $mdTheming($element); + } + }; +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.checkbox + * @description Checkbox module! + */ +MdCheckboxDirective.$inject = ["inputDirective", "$mdAria", "$mdConstant", "$mdTheming", "$mdUtil", "$mdInteraction"]; +angular + .module('material.components.checkbox', ['material.core']) + .directive('mdCheckbox', MdCheckboxDirective); + +/** + * @ngdoc directive + * @name mdCheckbox + * @module material.components.checkbox + * @restrict E + * + * @description + * The checkbox directive is used like the normal + * [angular checkbox](https://docs.angularjs.org/api/ng/input/input%5Bcheckbox%5D). + * + * As per the [Material Design spec](https://material.io/archive/guidelines/style/color.html#color-color-palette) + * the checkbox is in the accent color by default. The primary color palette may be used with + * the `md-primary` class. + * + * @param {expression} ng-model Assignable angular expression to data-bind to. + * @param {string=} name Property name of the form under which the control is published. + * @param {expression=} ng-true-value The value to which the expression should be set when selected. + * @param {expression=} ng-false-value The value to which the expression should be set when not + * selected. + * @param {expression=} ng-change Expression to be executed when the model value changes. + * @param {boolean=} md-no-ink If present, disable ink ripple effects. + * @param {string=} aria-label Adds label to checkbox for accessibility. + * Defaults to checkbox's text. If no default text is found, a warning will be logged. + * @param {expression=} md-indeterminate This determines when the checkbox should be rendered as + * 'indeterminate'. If a truthy expression or no value is passed in the checkbox renders in the + * md-indeterminate state. If falsy expression is passed in it just looks like a normal unchecked + * checkbox. The indeterminate, checked, and unchecked states are mutually exclusive. A box + * cannot be in any two states at the same time. Adding the 'md-indeterminate' attribute + * overrides any checked/unchecked rendering logic. When using the 'md-indeterminate' attribute + * use 'ng-checked' to define rendering logic instead of using 'ng-model'. + * @param {expression=} ng-checked If this expression evaluates as truthy, the 'md-checked' css + * class is added to the checkbox and it will appear checked. + * + * @usage + * + * + * Finished ? + * + * + * + * No Ink Effects + * + * + * + * Disabled + * + * + * + * + */ +function MdCheckboxDirective(inputDirective, $mdAria, $mdConstant, $mdTheming, $mdUtil, $mdInteraction) { + inputDirective = inputDirective[0]; + + return { + restrict: 'E', + transclude: true, + require: ['^?mdInputContainer', '?ngModel', '?^form'], + priority: $mdConstant.BEFORE_NG_ARIA, + template: + '
    ' + + '
    ' + + '
    ' + + '
    ', + compile: compile + }; + + // ********************************************************** + // Private Methods + // ********************************************************** + + function compile (tElement, tAttrs) { + tAttrs.$set('tabindex', tAttrs.tabindex || '0'); + tAttrs.$set('type', 'checkbox'); + tAttrs.$set('role', tAttrs.type); + tElement.addClass('md-auto-horizontal-margin'); + + return { + pre: function(scope, element) { + // Attach a click handler during preLink, in order to immediately stop propagation + // (especially for ng-click) when the checkbox is disabled. + element.on('click', function(e) { + if (this.hasAttribute('disabled')) { + e.stopImmediatePropagation(); + } + }); + }, + post: postLink + }; + + function postLink(scope, element, attr, ctrls) { + var isIndeterminate; + var containerCtrl = ctrls[0]; + var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel(); + var formCtrl = ctrls[2]; + var labelHasLink = element.find('a').length > 0; + + // The original component structure is not accessible when the checkbox's label contains a link. + // In order to keep backwards compatibility, we're only changing the structure of the component + // when we detect a link within the label. Using a span after the md-checkbox and attaching it + // via aria-labelledby allows screen readers to find and work with the link within the label. + if (labelHasLink) { + var labelId = 'label-' + $mdUtil.nextUid(); + attr.$set('aria-labelledby', labelId); + + var label = element.children()[1]; + // Use jQLite here since ChildNode.remove() is not supported in IE11. + angular.element(label).remove(); + label.removeAttribute('ng-transclude'); + label.className = 'md-checkbox-link-label'; + label.setAttribute('id', labelId); + element.after(label); + // Make sure that clicking on the label still causes the checkbox to be toggled, when appropriate. + var externalLabel = element.next(); + externalLabel.on('click', listener); + } + + if (containerCtrl) { + var isErrorGetter = containerCtrl.isErrorGetter || function() { + return ngModelCtrl.$invalid && (ngModelCtrl.$touched || (formCtrl && formCtrl.$submitted)); + }; + + containerCtrl.input = element; + + scope.$watch(isErrorGetter, containerCtrl.setInvalid); + } + + $mdTheming(element); + + // Redirect focus events to the root element, because IE11 is always focusing the container element instead + // of the md-checkbox element. This causes issues when using ngModelOptions: `updateOnBlur` + element.children().on('focus', function() { + element.focus(); + }); + + if ($mdUtil.parseAttributeBoolean(attr.mdIndeterminate)) { + setIndeterminateState(); + scope.$watch(attr.mdIndeterminate, setIndeterminateState); + } + + if (attr.ngChecked) { + scope.$watch(scope.$eval.bind(scope, attr.ngChecked), function(value) { + ngModelCtrl.$setViewValue(value); + ngModelCtrl.$render(); + }); + } + + $$watchExpr('ngDisabled', 'tabindex', { + true: '-1', + false: attr.tabindex + }); + + // Don't emit a warning when the label has a link within it. In that case we'll use + // aria-labelledby to point to another span that should be read as the label. + if (!labelHasLink) { + $mdAria.expectWithText(element, 'aria-label'); + } + + // Reuse the original input[type=checkbox] directive from AngularJS core. + // This is a bit hacky as we need our own event listener and own render + // function. + inputDirective.link.pre(scope, { + on: angular.noop, + 0: {} + }, attr, [ngModelCtrl]); + + element.on('click', listener) + .on('keypress', keypressHandler) + .on('focus', function() { + if ($mdInteraction.getLastInteractionType() === 'keyboard') { + element.addClass('md-focused'); + } + }) + .on('blur', function() { + element.removeClass('md-focused'); + }); + + ngModelCtrl.$render = render; + + function $$watchExpr(expr, htmlAttr, valueOpts) { + if (attr[expr]) { + scope.$watch(attr[expr], function(val) { + if (valueOpts[val]) { + element.attr(htmlAttr, valueOpts[val]); + } + }); + } + } + + /** + * @param {KeyboardEvent} ev 'keypress' event to handle + */ + function keypressHandler(ev) { + var keyCode = ev.which || ev.keyCode; + var submit, form; + + ev.preventDefault(); + switch (keyCode) { + case $mdConstant.KEY_CODE.SPACE: + element.addClass('md-focused'); + listener(ev); + break; + case $mdConstant.KEY_CODE.ENTER: + // Match the behavior of the native . + // When the enter key is pressed while focusing a native checkbox inside a form, + // the browser will trigger a `click` on the first non-disabled submit button/input + // in the form. Note that this is different from text inputs, which + // will directly submit the form without needing a submit button/input to be present. + form = $mdUtil.getClosest(ev.target, 'form'); + if (form) { + submit = form.querySelector('button[type="submit"]:enabled, input[type="submit"]:enabled'); + if (submit) { + submit.click(); + } + } + break; + } + } + + function listener(ev) { + // skipToggle boolean is used by the switch directive to prevent the click event + // when releasing the drag. There will be always a click if releasing the drag over the checkbox. + // If the click came from a link in the checkbox, don't toggle the value. + // We want the link to be opened without changing the value in this case. + if (element[0].hasAttribute('disabled') || scope.skipToggle || ev.target.tagName === 'A') { + return; + } + + scope.$apply(function() { + // Toggle the checkbox value... + var viewValue = attr.ngChecked && attr.ngClick ? attr.checked : !ngModelCtrl.$viewValue; + + ngModelCtrl.$setViewValue(viewValue, ev && ev.type); + ngModelCtrl.$render(); + }); + } + + function render() { + // Cast the $viewValue to a boolean since it could be undefined + var checked = !!ngModelCtrl.$viewValue && !isIndeterminate; + element.toggleClass('md-checked', checked); + if (!isIndeterminate) { + if (checked) { + element.attr('aria-checked', 'true'); + } else { + element.attr('aria-checked', 'false'); + } + } + } + + /** + * @param {string=} newValue + */ + function setIndeterminateState(newValue) { + isIndeterminate = newValue !== false; + if (isIndeterminate) { + element.attr('aria-checked', 'mixed'); + } + element.toggleClass('md-indeterminate', isIndeterminate); + ngModelCtrl.$render(); + } + } + } +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.chips + */ +/* + * @see js folder for chips implementation + */ +angular.module('material.components.chips', [ + 'material.core', + 'material.components.autocomplete' +]); + +})(); +(function(){ +"use strict"; + + +MdChipCtrl.$inject = ["$scope", "$element", "$mdConstant", "$timeout", "$mdUtil"];angular + .module('material.components.chips') + .controller('MdChipCtrl', MdChipCtrl); + +/** + * Controller for the MdChip component. Responsible for handling keyboard + * events and editing the chip if needed. + * + * @param $scope + * @param $element + * @param $mdConstant + * @param $timeout + * @param $mdUtil + * @constructor + */ +function MdChipCtrl ($scope, $element, $mdConstant, $timeout, $mdUtil) { + /** + * @type {$scope} + */ + this.$scope = $scope; + + /** + * @type {$element} + */ + this.$element = $element; + + /** + * @type {$mdConstant} + */ + this.$mdConstant = $mdConstant; + + /** + * @type {$timeout} + */ + this.$timeout = $timeout; + + /** + * @type {$mdUtil} + */ + this.$mdUtil = $mdUtil; + + /** + * @type {boolean} + */ + this.isEditing = false; + + /** + * @type {MdChipsCtrl} + */ + this.parentController = undefined; + + /** + * @type {boolean} + */ + this.enableChipEdit = false; +} + + +/** + * @param {MdChipsCtrl} controller + */ +MdChipCtrl.prototype.init = function(controller) { + this.parentController = controller; + this.enableChipEdit = this.parentController.enableChipEdit; + + if (this.enableChipEdit) { + this.$element.on('keydown', this.chipKeyDown.bind(this)); + this.$element.on('dblclick', this.chipMouseDoubleClick.bind(this)); + this.getChipContent().addClass('_md-chip-content-edit-is-enabled'); + } +}; + + +/** + * @return {Object} first element with the md-chip-content class + */ +MdChipCtrl.prototype.getChipContent = function() { + var chipContents = this.$element[0].getElementsByClassName('md-chip-content'); + return angular.element(chipContents[0]); +}; + + +/** + * When editing the chip, if the user modifies the existing contents, we'll get a span back and + * need to ignore text elements as they only contain blank space. + * `children()` ignores text elements. + * + * When editing the chip, if the user deletes the contents and then enters some new content + * we'll only get a text element back. + * @return {Object} jQuery object representing the content element of the chip + */ +MdChipCtrl.prototype.getContentElement = function() { + var contentElement = angular.element(this.getChipContent().children()[0]); + if (!contentElement || contentElement.length === 0) { + contentElement = angular.element(this.getChipContent().contents()[0]); + } + return contentElement; +}; + + +/** + * @return {number} index of this chip + */ +MdChipCtrl.prototype.getChipIndex = function() { + return parseInt(this.$element.attr('index')); +}; + + +/** + * Update the chip's contents, focus the chip if it's selected, and exit edit mode. + * If the contents were updated to be empty, remove the chip and re-focus the input element. + */ +MdChipCtrl.prototype.goOutOfEditMode = function() { + if (!this.isEditing) { + return; + } + + this.isEditing = false; + this.$element.removeClass('_md-chip-editing'); + this.getChipContent()[0].contentEditable = 'false'; + var chipIndex = this.getChipIndex(); + + var content = this.getContentElement().text(); + if (content) { + this.parentController.updateChipContents(chipIndex, content); + + this.$mdUtil.nextTick(function() { + if (this.parentController.selectedChip === chipIndex) { + this.parentController.focusChip(chipIndex); + } + }.bind(this)); + } else { + this.parentController.removeChipAndFocusInput(chipIndex); + } +}; + + +/** + * Given an HTML element. Selects contents of it. + * @param {Element} node + */ +MdChipCtrl.prototype.selectNodeContents = function(node) { + var range, selection; + if (document.body.createTextRange) { + range = document.body.createTextRange(); + range.moveToElementText(node); + range.select(); + } else if (window.getSelection) { + selection = window.getSelection(); + range = document.createRange(); + range.selectNodeContents(node); + selection.removeAllRanges(); + selection.addRange(range); + } +}; + + +/** + * Presents an input element to edit the contents of the chip. + */ +MdChipCtrl.prototype.goInEditMode = function() { + this.isEditing = true; + this.$element.addClass('_md-chip-editing'); + this.getChipContent()[0].contentEditable = 'true'; + this.getChipContent().on('blur', function() { + this.goOutOfEditMode(); + }.bind(this)); + + this.selectNodeContents(this.getChipContent()[0]); +}; + + +/** + * Handles the keydown event on the chip element. If enable-chip-edit attribute is + * set to true, space or enter keys can trigger going into edit mode. Enter can also + * trigger submitting if the chip is already being edited. + * @param {KeyboardEvent} event + */ +MdChipCtrl.prototype.chipKeyDown = function(event) { + if (!this.isEditing && + (event.keyCode === this.$mdConstant.KEY_CODE.ENTER || + event.keyCode === this.$mdConstant.KEY_CODE.SPACE)) { + event.preventDefault(); + this.goInEditMode(); + } else if (this.isEditing && event.keyCode === this.$mdConstant.KEY_CODE.ENTER) { + event.preventDefault(); + this.goOutOfEditMode(); + } +}; + + +/** + * Enter edit mode if we're not already editing and the enable-chip-edit attribute is enabled. + */ +MdChipCtrl.prototype.chipMouseDoubleClick = function() { + if (this.enableChipEdit && !this.isEditing) { + this.goInEditMode(); + } +}; + +})(); +(function(){ +"use strict"; + + +MdChip.$inject = ["$mdTheming", "$mdUtil", "$compile", "$timeout"];angular + .module('material.components.chips') + .directive('mdChip', MdChip); + +/** + * @ngdoc directive + * @name mdChip + * @module material.components.chips + * + * @description + * `` is a component used within ``. It is responsible for rendering an + * individual chip. + * + * + * @usage + * + * + * {{$chip}} + * + * + * + */ + +/** + * MDChip Directive Definition + * + * @param $mdTheming + * @param $mdUtil + * @param $compile + * @param $timeout + * @ngInject + */ +function MdChip($mdTheming, $mdUtil, $compile, $timeout) { + return { + restrict: 'E', + require: ['^?mdChips', 'mdChip'], + link: postLink, + controller: 'MdChipCtrl' + }; + + function postLink(scope, element, attr, ctrls) { + var chipsController = ctrls.shift(); + var chipController = ctrls.shift(); + var chipContentElement = angular.element(element[0].querySelector('.md-chip-content')); + + $mdTheming(element); + + if (chipsController) { + chipController.init(chipsController); + + // When a chip is blurred, make sure to unset (or reset) the selected chip so that tabbing + // through elements works properly + chipContentElement.on('blur', function() { + chipsController.resetSelectedChip(); + chipsController.$scope.$applyAsync(); + }); + } + + // Use $timeout to ensure we run AFTER the element has been added to the DOM so we can focus it. + $timeout(function() { + if (!chipsController) { + return; + } + + if (chipsController.shouldFocusLastChip) { + chipsController.focusLastChipThenInput(); + } + }); + } +} + +})(); +(function(){ +"use strict"; + + +MdChipRemove.$inject = ["$timeout"];angular + .module('material.components.chips') + .directive('mdChipRemove', MdChipRemove); + +/** + * @ngdoc directive + * @name mdChipRemove + * @restrict A + * @module material.components.chips + * + * @description + * Indicates that the associated element should be used as the delete button template for all chips. + * The associated element must be a child of `md-chips`. + * + * The provided button template will be appended to each chip and will remove the associated chip + * on click. + * + * The button is not styled or themed based on the theme set on the `md-chips` component. A theme + * class and custom icon can be specified in your template. + * + * You can also specify the `type` of the button in your template. + * + * @usage + * ### With Standard Chips + * + * + * + * + * + * + * ### With Object Chips + * + * + * + * + * + */ + + +/** + * MdChipRemove Directive Definition. + * + * @param $timeout + * @returns {{restrict: string, require: string[], link: Function, scope: boolean}} + * @constructor + */ +function MdChipRemove ($timeout) { + return { + restrict: 'A', + require: '^mdChips', + scope: false, + link: postLink + }; + + function postLink(scope, element, attr, ctrl) { + element.on('click', function() { + scope.$apply(function() { + ctrl.removeChip(scope.$$replacedScope.$index); + }); + }); + + // Child elements aren't available until after a $timeout tick as they are hidden by an + // `ng-if`. see http://goo.gl/zIWfuw + $timeout(function() { + element.attr({ 'tabindex': '-1', 'aria-hidden': 'true' }); + element.find('button').attr('tabindex', '-1'); + }); + } +} + +})(); +(function(){ +"use strict"; + + +MdChipTransclude.$inject = ["$compile"];angular + .module('material.components.chips') + .directive('mdChipTransclude', MdChipTransclude); + +function MdChipTransclude ($compile) { + return { + restrict: 'EA', + terminal: true, + link: link, + scope: false + }; + function link (scope, element, attr) { + var ctrl = scope.$parent.$mdChipsCtrl, + newScope = ctrl.parent.$new(false, ctrl.parent); + newScope.$$replacedScope = scope; + newScope.$chip = scope.$chip; + newScope.$index = scope.$index; + newScope.$mdChipsCtrl = ctrl; + + var newHtml = ctrl.$scope.$eval(attr.mdChipTransclude); + + element.html(newHtml); + $compile(element.contents())(newScope); + } +} + +})(); +(function(){ +"use strict"; + +/** + * The default chip append delay. + * + * @type {number} + */ +MdChipsCtrl.$inject = ["$scope", "$attrs", "$mdConstant", "$log", "$element", "$timeout", "$mdUtil", "$mdLiveAnnouncer", "$exceptionHandler"]; +var DEFAULT_CHIP_APPEND_DELAY = 300; + +angular + .module('material.components.chips') + .controller('MdChipsCtrl', MdChipsCtrl); + +/** + * Controller for the MdChips component. Responsible for adding to and + * removing from the list of chips, marking chips as selected, and binding to + * the models of various input components. + * + * @param $scope + * @param $attrs + * @param $mdConstant + * @param $log + * @param $element + * @param $timeout + * @param $mdUtil + * @param $mdLiveAnnouncer + * @param $exceptionHandler + * @constructor + */ +function MdChipsCtrl ($scope, $attrs, $mdConstant, $log, $element, $timeout, $mdUtil, + $mdLiveAnnouncer, $exceptionHandler) { + /** @type {Function} **/ + this.$timeout = $timeout; + + /** @type {Object} */ + this.$mdConstant = $mdConstant; + + /** @type {angular.$scope} */ + this.$scope = $scope; + + /** @type {angular.$scope} */ + this.parent = $scope.$parent; + + /** @type {$mdUtil} */ + this.$mdUtil = $mdUtil; + + /** @type {$log} */ + this.$log = $log; + + /** @type {$mdLiveAnnouncer} */ + this.$mdLiveAnnouncer = $mdLiveAnnouncer; + + /** @type {$exceptionHandler} */ + this.$exceptionHandler = $exceptionHandler; + + /** @type {$element} */ + this.$element = $element; + + /** @type {$attrs} */ + this.$attrs = $attrs; + + /** @type {angular.NgModelController} */ + this.ngModelCtrl = null; + + /** @type {angular.NgModelController} */ + this.userInputNgModelCtrl = null; + + /** @type {MdAutocompleteCtrl} */ + this.autocompleteCtrl = null; + + /** @type {Element} */ + this.userInputElement = null; + + /** @type {Array.} */ + this.items = []; + + /** @type {number} */ + this.selectedChip = -1; + + /** @type {string} */ + this.enableChipEdit = $mdUtil.parseAttributeBoolean($attrs.mdEnableChipEdit); + + /** @type {string} */ + this.addOnBlur = $mdUtil.parseAttributeBoolean($attrs.mdAddOnBlur); + + /** + * The class names to apply to the autocomplete or input. + * @type {string} + */ + this.inputClass = ''; + + /** + * The text to be used as the aria-label for the input. + * @type {string} + */ + this.inputAriaLabel = 'Chips input.'; + + /** + * Label text to describe the chips container. Used to give context and instructions to screen + * reader users when the chips container is selected. + * @type {string} + */ + this.containerHint = 'Chips container. Use arrow keys to select chips.'; + + /** + * Label text to describe the chips container when it is empty. Used to give context and + * instructions to screen reader users when the chips container is selected and it contains + * no chips. + * @type {string} + */ + this.containerEmptyHint = + 'Chips container. Enter the text area, then type text, and press enter to add a chip.'; + + /** + * Hidden hint text for how to delete a chip. Used to give context to screen readers. + * @type {string} + */ + this.deleteHint = 'Press delete to remove this chip.'; + + /** + * Hidden label for the delete button. Used to give context to screen readers. + * @type {string} + */ + this.deleteButtonLabel = 'Remove'; + + /** + * Model used by the input element. + * @type {string} + */ + this.chipBuffer = ''; + + /** + * Whether to use the transformChip expression to transform the chip buffer + * before appending it to the list. + * @type {boolean} + */ + this.useTransformChip = false; + + /** + * Whether to use the onAdd expression to notify of chip additions. + * @type {boolean} + */ + this.useOnAdd = false; + + /** + * Whether to use the onRemove expression to notify of chip removals. + * @type {boolean} + */ + this.useOnRemove = false; + + /** + * The ID of the chips wrapper which is used to build unique IDs for the chips and the aria-owns + * attribute. + * + * Defaults to '_md-chips-wrapper-' plus a unique number. + * + * @type {string} + */ + this.wrapperId = ''; + + /** + * Array of unique numbers which will be auto-generated any time the items change, and is used to + * create unique IDs for the aria-owns attribute. + * + * @type {Array} + */ + this.contentIds = []; + + /** + * The index of the chip that should have it's `tabindex` property set to `0` so it is selectable + * via the keyboard. + * + * @type {number|null} + */ + this.ariaTabIndex = null; + + /** + * After appending a chip, the chip will be focused for this number of milliseconds before the + * input is refocused. + * + * **Note:** This is **required** for compatibility with certain screen readers in order for + * them to properly allow keyboard access. + * + * @type {number} + */ + this.chipAppendDelay = DEFAULT_CHIP_APPEND_DELAY; + + /** + * Collection of functions to call to un-register watchers + * + * @type {Array} + */ + this.deRegister = []; + + /** + * The screen reader will announce the chip content followed by this message when a chip is added. + * @type {string} + */ + this.addedMessage = 'added'; + + /** + * The screen reader will announce the chip content followed by this message when a chip is + * removed. + * @type {string} + */ + this.removedMessage = 'removed'; + + this.init(); +} + +/** + * Initializes variables and sets up watchers + */ +MdChipsCtrl.prototype.init = function() { + var ctrl = this; + + // Set the wrapper ID + this.wrapperId = '_md-chips-wrapper-' + this.$mdUtil.nextUid(); + + // If we're using static chips, then we need to initialize a few things. + if (!this.$element.attr('ng-model')) { + this.setupStaticChips(); + } + + // Setup a watcher which manages the role and aria-owns attributes. + // This is never called for static chips since items is not defined. + this.deRegister.push( + this.$scope.$watchCollection('$mdChipsCtrl.items', function() { + // Make sure our input and wrapper have the correct ARIA attributes + ctrl.setupInputAria(); + ctrl.setupWrapperAria(); + }) + ); + + this.deRegister.push( + this.$attrs.$observe('mdChipAppendDelay', function(newValue) { + ctrl.chipAppendDelay = parseInt(newValue) || DEFAULT_CHIP_APPEND_DELAY; + }) + ); +}; + +/** + * Destructor for cleanup + */ +MdChipsCtrl.prototype.$onDestroy = function $onDestroy() { + var $destroyFn; + while (($destroyFn = this.deRegister.pop())) { + $destroyFn.call(this); + } +}; + +/** + * If we have an input, ensure it has the appropriate ARIA attributes. + */ +MdChipsCtrl.prototype.setupInputAria = function() { + var input = this.$element.find('input'); + + // If we have no input, just return + if (!input) { + return; + } + + input.attr('role', 'textbox'); + input.attr('aria-multiline', true); + if (this.inputAriaDescribedBy) { + input.attr('aria-describedby', this.inputAriaDescribedBy); + } + if (this.inputAriaLabelledBy) { + input.attr('aria-labelledby', this.inputAriaLabelledBy); + input.removeAttr('aria-label'); + } else { + input.attr('aria-label', this.inputAriaLabel); + } +}; + +/** + * Ensure our wrapper has the appropriate ARIA attributes. + */ +MdChipsCtrl.prototype.setupWrapperAria = function() { + var ctrl = this, + wrapper = this.$element.find('md-chips-wrap'); + + if (this.items && this.items.length) { + // Dynamically add the listbox role on every change because it must be removed when there are + // no items. + wrapper.attr('role', 'listbox'); + + // Generate some random (but unique) IDs for each chip + this.contentIds = this.items.map(function() { + return ctrl.wrapperId + '-chip-' + ctrl.$mdUtil.nextUid(); + }); + + // Use the contentIDs above to generate the aria-owns attribute + wrapper.attr('aria-owns', this.contentIds.join(' ')); + wrapper.attr('aria-label', this.containerHint); + } else { + // If we have no items, then the role and aria-owns attributes MUST be removed + wrapper.removeAttr('role'); + wrapper.removeAttr('aria-owns'); + wrapper.attr('aria-label', this.containerEmptyHint); + } +}; + +/** + * Apply specific roles and aria attributes for static chips + */ +MdChipsCtrl.prototype.setupStaticChips = function() { + var ctrl = this, i, staticChips; + var wrapper = this.$element.find('md-chips-wrap'); + + this.$timeout(function() { + wrapper.attr('role', 'list'); + staticChips = wrapper[0].children; + for (i = 0; i < staticChips.length; i++) { + staticChips[i].setAttribute('role', 'listitem'); + staticChips[i].setAttribute('aria-setsize', staticChips.length); + } + if (ctrl.inputAriaDescribedBy) { + wrapper.attr('aria-describedby', ctrl.inputAriaDescribedBy); + } + if (ctrl.inputAriaLabelledBy) { + wrapper.attr('aria-labelledby', ctrl.inputAriaLabelledBy); + wrapper.removeAttr('aria-label'); + } else { + wrapper.attr('aria-label', ctrl.inputAriaLabel); + } + }, 10); +}; + +/** + * Handles the keydown event on the input element: by default appends + * the buffer to the chip list, while backspace removes the last chip in the + * list if the current buffer is empty. + * @param {jQuery.Event|KeyboardEvent} event + */ +MdChipsCtrl.prototype.inputKeydown = function(event) { + var chipBuffer = this.getChipBuffer(); + + // If we have an autocomplete, and it handled the event, we have nothing to do + if (this.autocompleteCtrl && event.isDefaultPrevented && event.isDefaultPrevented()) { + return; + } + + if (event.keyCode === this.$mdConstant.KEY_CODE.BACKSPACE) { + // Only select and focus the previous chip, if the current caret position of the + // input element is at the beginning. + if (this.getCursorPosition(event.target) !== 0) { + return; + } + + event.preventDefault(); + event.stopPropagation(); + + if (this.items.length) { + this.selectAndFocusChipSafe(this.items.length - 1); + } + + return; + } + + // By default appends the buffer to the chip list. + if (!this.separatorKeys || this.separatorKeys.length < 1) { + this.separatorKeys = [this.$mdConstant.KEY_CODE.ENTER]; + } + + // Support additional separator key codes in an array of `md-separator-keys`. + if (this.separatorKeys.indexOf(event.keyCode) !== -1) { + if ((this.autocompleteCtrl && this.requireMatch) || !chipBuffer) return; + event.preventDefault(); + + // Only append the chip and reset the chip buffer if the max chips limit isn't reached. + if (this.hasMaxChipsReached()) return; + + this.appendChip(chipBuffer.trim()); + this.resetChipBuffer(); + + return false; + } +}; + +/** + * Returns the cursor position of the specified input element. + * @param {HTMLInputElement} element relevant input element + * @returns {Number} Cursor Position of the input. + */ +MdChipsCtrl.prototype.getCursorPosition = function(element) { + /* + * Figure out whether the current input for the chips buffer is valid for using + * the selectionStart / end property to retrieve the cursor position. + * Some browsers do not allow the use of those attributes, on different input types. + */ + try { + if (element.selectionStart === element.selectionEnd) { + return element.selectionStart; + } + } catch (e) { + if (!element.value) { + return 0; + } + } +}; + + +/** + * Updates the content of the chip at given index + * @param {number} chipIndex + * @param {string} chipContents + */ +MdChipsCtrl.prototype.updateChipContents = function(chipIndex, chipContents) { + if (chipIndex >= 0 && chipIndex < this.items.length) { + this.items[chipIndex] = chipContents; + this.updateNgModel(true); + } +}; + + +/** + * @return {boolean} true if a chip is currently being edited. False otherwise. + */ +MdChipsCtrl.prototype.isEditingChip = function() { + return !!this.$element[0].querySelector('._md-chip-editing'); +}; + +/** + * @param {string|Object} chip contents of a single chip + * @returns {boolean} true if the chip is an Object, false otherwise. + * @private + */ +MdChipsCtrl.prototype._isChipObject = function(chip) { + return angular.isObject(chip); +}; + +/** + * @returns {boolean} true if chips can be removed, false otherwise. + */ +MdChipsCtrl.prototype.isRemovable = function() { + // Return false if we have static chips + if (!this.ngModelCtrl) { + return false; + } + + return this.readonly ? this.removable : + angular.isDefined(this.removable) ? this.removable : true; +}; + +/** + * Handles the keydown event on the chip elements: backspace removes the selected chip, arrow + * keys switch which chip is active. + * @param {KeyboardEvent} event + */ +MdChipsCtrl.prototype.chipKeydown = function (event) { + if (this.getChipBuffer()) return; + if (this.isEditingChip()) return; + + switch (event.keyCode) { + case this.$mdConstant.KEY_CODE.BACKSPACE: + case this.$mdConstant.KEY_CODE.DELETE: + if (this.selectedChip < 0) return; + event.preventDefault(); + // Cancel the delete action only after the event cancel. Otherwise the page will go back. + if (!this.isRemovable()) return; + this.removeAndSelectAdjacentChip(this.selectedChip, event); + break; + case this.$mdConstant.KEY_CODE.LEFT_ARROW: + event.preventDefault(); + // By default, allow selection of -1 which will focus the input; if we're readonly, don't go + // below 0. + if (this.selectedChip < 0 || (this.readonly && this.selectedChip === 0)) { + this.selectedChip = this.items.length; + } + if (this.items.length) this.selectAndFocusChipSafe(this.selectedChip - 1); + break; + case this.$mdConstant.KEY_CODE.RIGHT_ARROW: + event.preventDefault(); + this.selectAndFocusChipSafe(this.selectedChip + 1); + break; + case this.$mdConstant.KEY_CODE.ESCAPE: + case this.$mdConstant.KEY_CODE.TAB: + if (this.selectedChip < 0) return; + event.preventDefault(); + this.onFocus(); + break; + } +}; + +/** + * Get the input's placeholder - uses `placeholder` when list is empty and `secondary-placeholder` + * when the list is non-empty. If `secondary-placeholder` is not provided, `placeholder` is used + * always. + * @returns {string} + */ +MdChipsCtrl.prototype.getPlaceholder = function() { + // Allow `secondary-placeholder` to be blank. + var useSecondary = (this.items && this.items.length && + (this.secondaryPlaceholder === '' || this.secondaryPlaceholder)); + return useSecondary ? this.secondaryPlaceholder : this.placeholder; +}; + +/** + * Removes chip at {@code index} and selects the adjacent chip. + * @param {number} index adjacent chip to select + * @param {Event=} event + */ +MdChipsCtrl.prototype.removeAndSelectAdjacentChip = function(index, event) { + var self = this; + var selIndex = self.getAdjacentChipIndex(index); + var wrap = this.$element[0].querySelector('md-chips-wrap'); + var chip = this.$element[0].querySelector('md-chip[index="' + index + '"]'); + + self.removeChip(index, event); + + // The double-timeout is currently necessary to ensure that the DOM has finalized and the select() + // will find the proper chip since the selection is index-based. + // + // TODO: Investigate calling from within chip $scope.$on('$destroy') to reduce/remove timeouts + self.$timeout(function() { + self.$timeout(function() { + self.selectAndFocusChipSafe(selIndex); + }); + }); +}; + +/** + * Sets the selected chip index to -1. + */ +MdChipsCtrl.prototype.resetSelectedChip = function() { + this.selectedChip = -1; + this.ariaTabIndex = null; +}; + +/** + * Gets the index of an adjacent chip to select after deletion. Adjacency is + * determined as the next chip in the list, unless the target chip is the + * last in the list, then it is the chip immediately preceding the target. If + * there is only one item in the list, -1 is returned (select none). + * The number returned is the index to select AFTER the target has been removed. + * If the current chip is not selected, then -1 is returned to select none. + * @param {number} index + * @returns {number} + */ +MdChipsCtrl.prototype.getAdjacentChipIndex = function(index) { + var len = this.items.length - 1; + return (len === 0) ? -1 : + (index === len) ? index - 1 : index; +}; + +/** + * Append the contents of the buffer to the chip list. This method will first + * call out to the md-transform-chip method, if provided. + * @param {string} newChip chip buffer contents that will be used to create the new chip + */ +MdChipsCtrl.prototype.appendChip = function(newChip) { + this.shouldFocusLastChip = !this.addOnBlur; + if (this.useTransformChip && this.transformChip) { + var transformedChip = this.transformChip({'$chip': newChip}); + + // Check to make sure the chip is defined before assigning it, otherwise, we'll just assume + // they want the string version. + if (angular.isDefined(transformedChip)) { + newChip = transformedChip; + } + } + + // If items contains an identical object to newChip, do not append + if (angular.isObject(newChip)) { + var identical = this.items.some(function(item) { + return angular.equals(newChip, item); + }); + if (identical) return; + } + + // Check for a null (but not undefined), or existing chip and cancel appending + if (newChip == null || this.items.indexOf(newChip) + 1) return; + + // Append the new chip onto our list + var length = this.items.push(newChip); + var index = length - 1; + + this.updateNgModel(); + + // Tell screen reader users that the chip was successfully added. + // TODO add a way for developers to specify which field of the object should be announced here. + var chipContent = angular.isObject(newChip) ? '' : newChip; + this.$mdLiveAnnouncer.announce(chipContent + ' ' + this.addedMessage, 'assertive'); + + // If the md-on-add attribute is specified, send a chip addition event + if (this.useOnAdd && this.onAdd) { + this.onAdd({ '$chip': newChip, '$index': index }); + } +}; + +/** + * Sets whether to use the md-transform-chip expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code transformChip}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useTransformChipExpression = function() { + this.useTransformChip = true; +}; + +/** + * Sets whether to use the md-on-add expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onAdd}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnAddExpression = function() { + this.useOnAdd = true; +}; + +/** + * Sets whether to use the md-on-remove expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onRemove}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnRemoveExpression = function() { + this.useOnRemove = true; +}; + +/** + * Sets whether to use the md-on-select expression. This expression is + * bound to scope and controller in {@code MdChipsDirective} as + * {@code onSelect}. Due to the nature of directive scope bindings, the + * controller cannot know on its own/from the scope whether an expression was + * actually provided. + */ +MdChipsCtrl.prototype.useOnSelectExpression = function() { + this.useOnSelect = true; +}; + +/** + * Gets the input buffer. The input buffer can be the model bound to the + * default input item {@code this.chipBuffer}, the {@code selectedItem} + * model of an {@code md-autocomplete}, or, through some magic, the model + * bound to any input or text area element found within a + * {@code md-input-container} element. + * @return {string} the input buffer + */ +MdChipsCtrl.prototype.getChipBuffer = function() { + var chipBuffer = !this.userInputElement ? this.chipBuffer : + this.userInputNgModelCtrl ? this.userInputNgModelCtrl.$viewValue : + this.userInputElement[0].value; + + // Ensure that the chip buffer is always a string. For example, the input element buffer + // might be falsy. + return angular.isString(chipBuffer) ? chipBuffer : ''; +}; + +/** + * Resets the input buffer for either the internal input or user provided input element. + */ +MdChipsCtrl.prototype.resetChipBuffer = function() { + if (this.userInputElement) { + if (this.userInputNgModelCtrl) { + this.userInputNgModelCtrl.$setViewValue(''); + this.userInputNgModelCtrl.$render(); + } else { + this.userInputElement[0].value = ''; + } + } else { + this.chipBuffer = ''; + } +}; + +/** + * @returns {boolean} true if the max chips limit has been reached, false otherwise. + */ +MdChipsCtrl.prototype.hasMaxChipsReached = function() { + if (angular.isString(this.maxChips)) { + this.maxChips = parseInt(this.maxChips, 10) || 0; + } + + return this.maxChips > 0 && this.items.length >= this.maxChips; +}; + +/** + * Updates the validity properties for the ngModel. + * + * TODO add the md-max-chips validator to this.ngModelCtrl.validators so that the validation will + * be performed automatically. + */ +MdChipsCtrl.prototype.validateModel = function() { + this.ngModelCtrl.$setValidity('md-max-chips', !this.hasMaxChipsReached()); + this.ngModelCtrl.$validate(); // rerun any registered validators +}; + +/** + * Function to handle updating the model, validation, and change notification when a chip + * is added, removed, or changed. + * @param {boolean=} skipValidation true to skip calling validateModel() + */ +MdChipsCtrl.prototype.updateNgModel = function(skipValidation) { + if (!skipValidation) { + this.validateModel(); + } + // This will trigger ng-change to fire, even in cases where $setViewValue() would not. + angular.forEach(this.ngModelCtrl.$viewChangeListeners, function(listener) { + try { + listener(); + } catch (e) { + this.$exceptionHandler(e); + } + }); +}; + +/** + * Removes the chip at the given index. + * @param {number} index of chip to remove + * @param {Event=} event optionally passed to the onRemove callback + */ +MdChipsCtrl.prototype.removeChip = function(index, event) { + var removed = this.items.splice(index, 1); + + this.updateNgModel(); + this.ngModelCtrl.$setDirty(); + + // Tell screen reader users that the chip was successfully removed. + // TODO add a way for developers to specify which field of the object should be announced here. + var chipContent = angular.isObject(removed[0]) ? '' : removed[0]; + this.$mdLiveAnnouncer.announce(chipContent + ' ' + this.removedMessage, 'assertive'); + + if (removed && removed.length && this.useOnRemove && this.onRemove) { + this.onRemove({ '$chip': removed[0], '$index': index, '$event': event }); + } +}; + +/** + * @param {number} index location of chip to remove + * @param {Event=} $event + */ +MdChipsCtrl.prototype.removeChipAndFocusInput = function (index, $event) { + this.removeChip(index, $event); + + if (this.autocompleteCtrl) { + // Always hide the autocomplete dropdown before focusing the autocomplete input. + // Wait for the input to move horizontally, because the chip was removed. + // This can lead to an incorrect dropdown position. + this.autocompleteCtrl.hidden = true; + this.$mdUtil.nextTick(this.onFocus.bind(this)); + } else { + this.onFocus(); + } + +}; +/** + * Selects the chip at `index`, + * @param {number} index location of chip to select and focus + */ +MdChipsCtrl.prototype.selectAndFocusChipSafe = function(index) { + // If we have no chips, or are asked to select a chip before the first, just focus the input + if (!this.items.length || index === -1) { + return this.focusInput(); + } + + // If we are asked to select a chip greater than the number of chips... + if (index >= this.items.length) { + if (this.readonly) { + // If we are readonly, jump back to the start (because we have no input) + index = 0; + } else { + // If we are not readonly, we should attempt to focus the input + return this.onFocus(); + } + } + + index = Math.max(index, 0); + index = Math.min(index, this.items.length - 1); + + this.selectChip(index); + this.focusChip(index); +}; + +/** + * Focus last chip, then focus the input. This is needed for screen reader support. + */ +MdChipsCtrl.prototype.focusLastChipThenInput = function() { + var ctrl = this; + + ctrl.shouldFocusLastChip = false; + + ctrl.focusChip(this.items.length - 1); + + ctrl.$timeout(function() { + ctrl.focusInput(); + }, ctrl.chipAppendDelay); +}; + +/** + * Focus the input element. + */ +MdChipsCtrl.prototype.focusInput = function() { + this.selectChip(-1); + this.onFocus(); +}; + +/** + * Marks the chip at the given index as selected. + * @param {number} index location of chip to select + */ +MdChipsCtrl.prototype.selectChip = function(index) { + if (index >= -1 && index <= this.items.length) { + this.selectedChip = index; + + // Fire the onSelect if provided + if (this.useOnSelect && this.onSelect) { + this.onSelect({'$chip': this.items[index] }); + } + } else { + this.$log.warn('Selected Chip index out of bounds; ignoring.'); + } +}; + +/** + * Call {@code focus()} on the chip at {@code index} + * @param {number} index location of chip to focus + */ +MdChipsCtrl.prototype.focusChip = function(index) { + var chipContent = this.$element[0].querySelector( + 'md-chip[index="' + index + '"] .md-chip-content' + ); + + this.ariaTabIndex = index; + + chipContent.focus(); +}; + +/** + * Configures the required interactions with the ngModel Controller. + * Specifically, set {@code this.items} to the {@code NgModelController#$viewValue}. + * @param {NgModelController} ngModelCtrl + */ +MdChipsCtrl.prototype.configureNgModel = function(ngModelCtrl) { + this.ngModelCtrl = ngModelCtrl; + + var self = this; + + // in chips the meaning of $isEmpty changes + ngModelCtrl.$isEmpty = function(value) { + return !value || value.length === 0; + }; + + ngModelCtrl.$render = function() { + // model is updated. do something. + self.items = self.ngModelCtrl.$viewValue; + }; +}; + +MdChipsCtrl.prototype.onFocus = function () { + var input = this.$element[0].querySelector('input'); + input && input.focus(); + this.resetSelectedChip(); +}; + +MdChipsCtrl.prototype.onInputFocus = function () { + this.inputHasFocus = true; + + // Make sure we have the appropriate ARIA attributes + this.setupInputAria(); + + // Make sure we don't have any chips selected + this.resetSelectedChip(); +}; + +MdChipsCtrl.prototype.onInputBlur = function () { + this.inputHasFocus = false; + + if (this.shouldAddOnBlur()) { + this.appendChip(this.getChipBuffer().trim()); + this.resetChipBuffer(); + } +}; + +/** + * Configure event bindings on input element. + * @param {angular.element} inputElement + */ +MdChipsCtrl.prototype.configureInput = function configureInput(inputElement) { + // Find the NgModelCtrl for the input element + var ngModelCtrl = inputElement.controller('ngModel'); + var ctrl = this; + + if (ngModelCtrl) { + + // sync touched-state from inner input to chips-element + this.deRegister.push( + this.$scope.$watch( + function() { + return ngModelCtrl.$touched; + }, + function(isTouched) { + isTouched && ctrl.ngModelCtrl.$setTouched(); + } + ) + ); + + // sync dirty-state from inner input to chips-element + this.deRegister.push( + this.$scope.$watch( + function() { + return ngModelCtrl.$dirty; + }, + function(isDirty) { + isDirty && ctrl.ngModelCtrl.$setDirty(); + } + ) + ); + } +}; + +/** + * Configure event bindings on a user-provided input element. + * @param {angular.element} inputElement + */ +MdChipsCtrl.prototype.configureUserInput = function(inputElement) { + this.userInputElement = inputElement; + + // Find the NgModelCtrl for the input element + var ngModelCtrl = inputElement.controller('ngModel'); + // `.controller` will look in the parent as well. + if (ngModelCtrl !== this.ngModelCtrl) { + this.userInputNgModelCtrl = ngModelCtrl; + } + + var scope = this.$scope; + var ctrl = this; + + // Run all of the events using evalAsync because a focus may fire a blur in the same digest loop + var scopeApplyFn = function(event, fn) { + scope.$evalAsync(angular.bind(ctrl, fn, event)); + }; + + // Bind to keydown and focus events of input + inputElement + .attr({ tabindex: 0 }) + .on('keydown', function(event) { scopeApplyFn(event, ctrl.inputKeydown); }) + .on('focus', function(event) { scopeApplyFn(event, ctrl.onInputFocus); }) + .on('blur', function(event) { scopeApplyFn(event, ctrl.onInputBlur); }); +}; + +/** + * @param {MdAutocompleteCtrl} ctrl controller from the autocomplete component + */ +MdChipsCtrl.prototype.configureAutocomplete = function(ctrl) { + if (ctrl) { + this.autocompleteCtrl = ctrl; + // Update the default container empty hint when we're inside of an autocomplete. + if (!this.$element.attr('container-empty-hint')) { + this.containerEmptyHint = 'Chips container with autocompletion. Enter the text area, ' + + 'type text to search, and then use the up and down arrow keys to select an option. ' + + 'Press enter to add the selected option as a chip.'; + this.setupWrapperAria(); + } + + ctrl.registerSelectedItemWatcher(angular.bind(this, function (item) { + if (item) { + // Only append the chip and reset the chip buffer if the max chips limit isn't reached. + if (this.hasMaxChipsReached()) return; + + this.appendChip(item); + this.resetChipBuffer(); + } + })); + + this.$element.find('input') + .on('focus',angular.bind(this, this.onInputFocus)) + .on('blur', angular.bind(this, this.onInputBlur)); + } +}; + +/** + * @returns {boolean} Whether the current chip buffer should be added on input blur or not. + */ +MdChipsCtrl.prototype.shouldAddOnBlur = function() { + + // Update the custom ngModel validators from the chips component. + this.validateModel(); + + var chipBuffer = this.getChipBuffer().trim(); + // If the model value is empty and required is set on the element, then the model will be invalid. + // In that case, we still want to allow adding the chip. The main (but not only) case we want + // to disallow is adding a chip on blur when md-max-chips validation fails. + var isModelValid = this.ngModelCtrl.$isEmpty(this.ngModelCtrl.$modelValue) || + this.ngModelCtrl.$valid; + var isAutocompleteShowing = this.autocompleteCtrl && !this.autocompleteCtrl.hidden; + + if (this.userInputNgModelCtrl) { + isModelValid = isModelValid && this.userInputNgModelCtrl.$valid; + } + + return this.addOnBlur && !this.requireMatch && chipBuffer && isModelValid && + !isAutocompleteShowing; +}; + +/** + * @returns {boolean} true if the input or a chip is focused. False otherwise. + */ +MdChipsCtrl.prototype.hasFocus = function () { + return this.inputHasFocus || this.selectedChip >= 0; +}; + +/** + * @param {number} index location of content id + * @returns {number} unique id for the aria-owns attribute + */ +MdChipsCtrl.prototype.contentIdFor = function(index) { + return this.contentIds[index]; +}; + +})(); +(function(){ +"use strict"; + + + MdChips.$inject = ["$mdTheming", "$mdUtil", "$compile", "$log", "$timeout", "$$mdSvgRegistry"];angular + .module('material.components.chips') + .directive('mdChips', MdChips); + + /** + * @ngdoc directive + * @name mdChips + * @module material.components.chips + * + * @description + * `` is an input component for building lists of strings or objects. The list items are + * displayed as 'chips'. This component can make use of an `` element or an + * `` element. + * + * ### Custom templates + * A custom template may be provided to render the content of each chip. This is achieved by + * specifying an `` element containing the custom content as a child of + * ``. + * + * Note: Any attributes on + * `` will be dropped as only the innerHTML is used for the chip template. The + * variables `$chip` and `$index` are available in the scope of ``, representing + * the chip object and its index in the list of chips, respectively. + * To override the chip delete control, include an element (ideally a button) with the attribute + * `md-chip-remove`. A click listener to remove the chip will be added automatically. The element + * is also placed as a sibling to the chip content (on which there are also click listeners) to + * avoid a nested ng-click situation. + * + * + * + * Sometimes developers want to limit the amount of possible chips.
    + * You can specify the maximum amount of chips by using the following markup. + * + * + * + * + * + * + * In some cases, you have an autocomplete inside of the `md-chips`.
    + * When the maximum amount of chips has been reached, you can also disable the autocomplete + * selection.
    + * Here is an example markup. + * + * + * + * + * + * + * + * ### Accessibility + * + * The `md-chips` component supports keyboard and screen reader users since Version 1.1.2. In + * order to achieve this, we modified the chips behavior to select newly appended chips for + * `300ms` before re-focusing the input and allowing the user to type. + * + * For most users, this delay is small enough that it will not be noticeable but allows certain + * screen readers to function properly (JAWS and NVDA in particular). + * + * We introduced a new `md-chip-append-delay` option to allow developers to better control this + * behavior. + * + * Please refer to the documentation of this option (below) for more information. + * + * @param {expression} ng-model Assignable AngularJS expression to be data-bound to the list of + * chips. The expression should evaluate to a `string` or `Object` Array. The type of this + * array should align with the return value of `md-transform-chip`. + * @param {expression=} ng-change AngularJS expression to be executed on chip addition, removal, + * or content change. + * @param {string=} placeholder Placeholder text that will be forwarded to the input. + * @param {string=} secondary-placeholder Placeholder text that will be forwarded to the input, + * displayed when there is at least one item in the list + * @param {boolean=} md-removable Enables or disables the deletion of chips through the + * removal icon or the Delete/Backspace key. Defaults to true. + * @param {boolean=} readonly Disables list manipulation (deleting or adding list items), hiding + * the input and delete buttons. If no `ng-model` is provided, the chips will automatically be + * marked as readonly.

    + * When `md-removable` is not defined, the `md-remove` behavior will be overwritten and + * disabled. + * @param {boolean=} md-enable-chip-edit Set this to `"true"` to enable editing of chip contents. + * The user can go into edit mode by pressing the `space` or `enter` keys, or by double + * clicking on the chip. Chip editing is only supported for chips using the basic template. + * **Note:** This attribute is only evaluated once; it is not watched. + * @param {boolean=} ng-required Whether ng-model is allowed to be empty or not. + * @param {number=} md-max-chips The maximum number of chips allowed to add through user input. + *

    The validation property `md-max-chips` can be used when the max chips + * amount is reached. + * @param {boolean=} md-add-on-blur When set to `"true"`, the remaining text inside of the input + * will be converted into a new chip on blur. + * **Note:** This attribute is only evaluated once; it is not watched. + * @param {expression} md-transform-chip An expression of form `myFunction($chip)` that when + * called expects one of the following return values: + * - an object representing the `$chip` input string + * - `undefined` to simply add the `$chip` input string, or + * - `null` to prevent the chip from being appended + * @param {expression=} md-on-add An expression which will be called when a chip has been + * added with `$chip` and `$index` available as parameters. + * @param {expression=} md-on-remove An expression which will be called when a chip has been + * removed with `$chip`, `$index`, and `$event` available as parameters. + * @param {expression=} md-on-select An expression which will be called when a chip is selected. + * @param {boolean=} md-require-match If true, and the chips template contains an autocomplete, + * only allow selection of pre-defined chips (i.e. you cannot add new ones). + * @param {string=} md-input-class This class will be applied to the child input for custom + * styling. If you are using an `md-autocomplete`, then you need to put this attribute on the + * `md-autocomplete` rather than the `md-chips`. + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this autocomplete. Screen readers will read + * the content of these elements at the end of announcing that the chips input has been + * selected and describing its current state. The descriptive elements do not need to be + * visible on the page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use + * case is that this would contain the ID of a `
    \ + \ +
    \ + {{$chip[$mdContactChipsCtrl.contactName]}}\ +
    \ +
    \ + {{$chip[$mdContactChipsCtrl.contactName]}}\ +
    \ +
    \ +
    '; + + +/** + * MDContactChips Directive Definition + * + * @param $mdTheming + * @param $mdUtil + * @returns {*} + * @ngInject + */ +function MdContactChips($mdTheming, $mdUtil) { + return { + template: function(element, attrs) { + return MD_CONTACT_CHIPS_TEMPLATE; + }, + restrict: 'E', + controller: 'MdContactChipsCtrl', + controllerAs: '$mdContactChipsCtrl', + bindToController: true, + compile: compile, + scope: { + contactQuery: '&mdContacts', + placeholder: '@?', + secondaryPlaceholder: '@?', + contactName: '@mdContactName', + contactImage: '@mdContactImage', + contactEmail: '@mdContactEmail', + contacts: '=ngModel', + ngChange: '&?', + requireMatch: '=?mdRequireMatch', + minLength: '=?mdMinLength', + maxChips: '=?mdMaxChips', + highlightFlags: '@?mdHighlightFlags', + chipAppendDelay: '@?mdChipAppendDelay', + separatorKeys: '=?mdSeparatorKeys', + removedMessage: '@?mdRemovedMessage', + inputClass: '@?mdInputClass', + inputAriaDescribedBy: '@?inputAriaDescribedby', + inputAriaLabelledBy: '@?inputAriaLabelledby', + inputAriaLabel: '@?', + containerHint: '@?', + containerEmptyHint: '@?', + deleteHint: '@?' + } + }; + + function compile(element, attr) { + return function postLink(scope, element, attrs, controllers) { + var contactChipsController = controllers; + + $mdUtil.initOptionalProperties(scope, attr); + $mdTheming(element); + + element.attr('tabindex', '-1'); + + attrs.$observe('mdChipAppendDelay', function(newValue) { + contactChipsController.chipAppendDelay = newValue; + }); + }; + } +} + +})(); +(function(){ +"use strict"; + +(function () { + "use strict"; + + /** + * Use a RegExp to check if the `md-colors=""` is static string + * or one that should be observed and dynamically interpolated. + */ + MdColorsDirective.$inject = ["$mdColors", "$mdUtil", "$log", "$parse"]; + MdColorsService.$inject = ["$mdTheming", "$mdUtil", "$log"]; + var STATIC_COLOR_EXPRESSION = /^{((\s|,)*?["'a-zA-Z-]+?\s*?:\s*?(['"])[a-zA-Z0-9-.]*(['"]))+\s*}$/; + var colorPalettes = null; + + /** + * @ngdoc module + * @name material.components.colors + * + * @description + * Define $mdColors service and a `md-colors=""` attribute directive + */ + angular + .module('material.components.colors', ['material.core']) + .directive('mdColors', MdColorsDirective) + .service('$mdColors', MdColorsService); + + /** + * @ngdoc service + * @name $mdColors + * @module material.components.colors + * + * @description + * By default, defining a theme does not make its colors available for applying to non AngularJS + * Material elements. The `$mdColors` service is used by the `md-color` directive to convert a + * set of color expressions to RGBA values and then apply those values to the element as CSS + * property values. + * + * @usage + * Getting a color based on a theme + * + * + * angular.controller('myCtrl', function ($mdColors) { + * var color = $mdColors.getThemeColor('myTheme-primary-900-0.5'); + * ... + * }); + * + * + * Applying a color from a palette to an element + * + * app.directive('myDirective', function($mdColors) { + * return { + * ... + * link: function (scope, elem) { + * $mdColors.applyThemeColors(elem, {color: 'red-A200-0.2'}); + * } + * } + * }); + * + */ + function MdColorsService($mdTheming, $mdUtil, $log) { + colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES); + + // Publish service instance + return { + applyThemeColors: applyThemeColors, + getThemeColor: getThemeColor, + hasTheme: hasTheme + }; + + // ******************************************** + // Internal Methods + // ******************************************** + + /** + * @ngdoc method + * @name $mdColors#applyThemeColors + * + * @description + * Lookup a set of colors by hue, theme, and palette, then apply those colors + * with the provided opacity (via `rgba()`) to the specified CSS property. + * + * @param {angular.element} element the element to apply the styles to + * @param {Object} colorExpression Keys are CSS properties and values are strings representing + * the `theme-palette-hue-opacity` of the desired color. For example: + * `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and + * opacity are optional. + */ + function applyThemeColors(element, colorExpression) { + try { + if (colorExpression) { + // Assign the calculate RGBA color values directly as inline CSS + element.css(interpolateColors(colorExpression)); + } + } catch (e) { + $log.error(e.message); + } + } + + /** + * @ngdoc method + * @name $mdColors#getThemeColor + * + * @description + * Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the + * desired color. + * + * @param {string} expression color expression like `'red-A200-0.3'` or + * `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional. + * @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)` + */ + function getThemeColor(expression) { + var color = extractColorOptions(expression); + + return parseColor(color); + } + + /** + * Return the parsed color + * @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color + * definitions + * @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. + * @returns {string} rgba color string + */ + function parseColor(color, contrast) { + contrast = contrast || false; + var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; + + rgbValues = contrast ? rgbValues.contrast : rgbValues.value; + + return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', + [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] + ); + } + + /** + * Convert the color expression into an object with scope-interpolated values + * Then calculate the rgba() values based on the theme color parts + * @param {Object} themeColors json object, keys are css properties and values are string of + * the wanted color, for example: `{color: 'red-A200-0.3'}`. + * @return {Object} Hashmap of CSS properties with associated `rgba()` string values + */ + function interpolateColors(themeColors) { + var rgbColors = {}; + + var hasColorProperty = themeColors.hasOwnProperty('color'); + + angular.forEach(themeColors, function (value, key) { + var color = extractColorOptions(value); + var hasBackground = key.indexOf('background') > -1; + + rgbColors[key] = parseColor(color); + if (hasBackground && !hasColorProperty) { + rgbColors.color = parseColor(color, true); + } + }); + + return rgbColors; + } + + /** + * Check if expression has defined theme + * For instance: + * 'myTheme-primary' => true + * 'red-800' => false + * @param {string} expression color expression like 'red-800', 'red-A200-0.3', + * 'myTheme-primary', or 'myTheme-primary-400' + * @return {boolean} true if the expression has a theme part, false otherwise. + */ + function hasTheme(expression) { + return angular.isDefined($mdTheming.THEMES[expression.split('-')[0]]); + } + + /** + * For the evaluated expression, extract the color parts into a hash map + * @param {string} expression color expression like 'red-800', 'red-A200-0.3', + * 'myTheme-primary', or 'myTheme-primary-400' + * @returns {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} + */ + function extractColorOptions(expression) { + var parts = expression.split('-'); + var hasTheme = angular.isDefined($mdTheming.THEMES[parts[0]]); + var theme = hasTheme ? parts.splice(0, 1)[0] : $mdTheming.defaultTheme(); + + return { + theme: theme, + palette: extractPalette(parts, theme), + hue: extractHue(parts, theme), + opacity: parts[2] || 1 + }; + } + + /** + * Calculate the theme palette name + * @param {Array} parts + * @param {string} theme name + * @return {string} + */ + function extractPalette(parts, theme) { + // If the next section is one of the palettes we assume it's a two word palette + // Two word palette can be also written in camelCase, forming camelCase to dash-case + + var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1; + var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); + + if (isTwoWord) palette = parts[0] + '-' + parts.splice(1, 1); + + if (colorPalettes.indexOf(palette) === -1) { + // If the palette is not in the palette list it's one of primary/accent/warn/background + var scheme = $mdTheming.THEMES[theme].colors[palette]; + if (!scheme) { + throw new Error($mdUtil.supplant( + 'mdColors: couldn\'t find \'{palette}\' in the palettes.', + {palette: palette})); + } + palette = scheme.name; + } + + return palette; + } + + /** + * @param {Array} parts + * @param {string} theme name + * @return {*} + */ + function extractHue(parts, theme) { + var themeColors = $mdTheming.THEMES[theme].colors; + + if (parts[1] === 'hue') { + var hueNumber = parseInt(parts.splice(2, 1)[0], 10); + + if (hueNumber < 1 || hueNumber > 3) { + throw new Error($mdUtil.supplant( + 'mdColors: \'hue-{hueNumber}\' is not a valid hue, can be only \'hue-1\', \'hue-2\' and \'hue-3\'', + {hueNumber: hueNumber})); + } + parts[1] = 'hue-' + hueNumber; + + if (!(parts[0] in themeColors)) { + throw new Error($mdUtil.supplant( + 'mdColors: \'hue-x\' can only be used with [{availableThemes}], but was used with \'{usedTheme}\'', + { + availableThemes: Object.keys(themeColors).join(', '), + usedTheme: parts[0] + })); + } + + return themeColors[parts[0]].hues[parts[1]]; + } + + return parts[1] || themeColors[parts[0] in themeColors ? parts[0] : 'primary'].hues['default']; + } + } + + /** + * @ngdoc directive + * @name mdColors + * @module material.components.colors + * + * @restrict A + * + * @description + * `mdColors` directive will apply the theme-based color expression as RGBA CSS style values. + * + * The format will be similar to the colors defined in the Sass files: + * + * ## `[?theme]-[palette]-[?hue]-[?opacity]` + * - [theme] - default value is the default theme + * - [palette] - can be either palette name or primary/accent/warn/background + * - [hue] - default is 500 (hue-x can be used with primary/accent/warn/background) + * - [opacity] - default is 1 + * + * + * > `?` indicates optional parameter + * + * @usage + * + *
    + *
    + * Color demo + *
    + *
    + *
    + * + * The `mdColors` directive will automatically watch for changes in the expression if it recognizes + * an interpolation expression or a function. For performance options, you can use `::` prefix to + * the `md-colors` expression to indicate a one-time data binding. + * + * + * + * + * + */ + function MdColorsDirective($mdColors, $mdUtil, $log, $parse) { + return { + restrict: 'A', + require: ['^?mdTheme'], + compile: function (tElem, tAttrs) { + var shouldWatch = shouldColorsWatch(); + + return function (scope, element, attrs, ctrl) { + var mdThemeController = ctrl[0]; + + var lastColors = {}; + + /** + * @param {string=} theme + * @return {Object} colors found in the specified theme + */ + var parseColors = function (theme) { + if (typeof theme !== 'string') { + theme = ''; + } + + if (!attrs.mdColors) { + attrs.mdColors = '{}'; + } + + /** + * Json.parse() does not work because the keys are not quoted; + * use $parse to convert to a hash map + */ + var colors = $parse(attrs.mdColors)(scope); + + /** + * If mdTheme is defined higher up the DOM tree, + * we add mdTheme's theme to the colors which don't specify a theme. + * + * @example + * + *
    + *
    + * Color demo + *
    + *
    + *
    + * + * 'primary-600' will be changed to 'myTheme-primary-600', + * but 'mySecondTheme-accent-200' will not be changed since it has a theme defined. + */ + if (mdThemeController) { + Object.keys(colors).forEach(function (prop) { + var color = colors[prop]; + if (!$mdColors.hasTheme(color)) { + colors[prop] = (theme || mdThemeController.$mdTheme) + '-' + color; + } + }); + } + + cleanElement(colors); + + return colors; + }; + + /** + * @param {Object} colors + */ + var cleanElement = function (colors) { + if (!angular.equals(colors, lastColors)) { + var keys = Object.keys(lastColors); + + if (lastColors.background && !keys.color) { + keys.push('color'); + } + + keys.forEach(function (key) { + element.css(key, ''); + }); + } + + lastColors = colors; + }; + + /** + * Registering for mgTheme changes and asking mdTheme controller run our callback whenever + * a theme changes. + */ + var unregisterChanges = angular.noop; + + if (mdThemeController) { + unregisterChanges = mdThemeController.registerChanges(function (theme) { + $mdColors.applyThemeColors(element, parseColors(theme)); + }); + } + + scope.$on('$destroy', function () { + unregisterChanges(); + }); + + try { + if (shouldWatch) { + scope.$watch(parseColors, angular.bind(this, + $mdColors.applyThemeColors, element + ), true); + } + else { + $mdColors.applyThemeColors(element, parseColors()); + } + + } + catch (e) { + $log.error(e.message); + } + + }; + + /** + * @return {boolean} + */ + function shouldColorsWatch() { + // Simulate 1x binding and mark mdColorsWatch == false + var rawColorExpression = tAttrs.mdColors; + var bindOnce = rawColorExpression.indexOf('::') > -1; + var isStatic = bindOnce ? true : STATIC_COLOR_EXPRESSION.test(tAttrs.mdColors); + + // Remove it for the postLink... + tAttrs.mdColors = rawColorExpression.replace('::', ''); + + var hasWatchAttr = angular.isDefined(tAttrs.mdColorsWatch); + + return (bindOnce || isStatic) ? false : + hasWatchAttr ? $mdUtil.parseAttributeBoolean(tAttrs.mdColorsWatch) : true; + } + } + }; + } +})(); + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.content + * + * @description + * Scrollable content + */ +mdContentDirective.$inject = ["$mdTheming"]; +angular.module('material.components.content', [ + 'material.core' +]) + .directive('mdContent', mdContentDirective); + +/** + * @ngdoc directive + * @name mdContent + * @module material.components.content + * + * @restrict E + * + * @description + * + * The `` directive is a container element useful for scrollable content. It achieves + * this by setting the CSS `overflow` property to `auto` so that content can properly scroll. + * + * In general, `` components are not designed to be nested inside one another. If + * possible, it is better to make them siblings. This often results in a better user experience as + * having nested scrollbars may confuse the user. + * + * ## Troubleshooting + * + * In some cases, you may wish to apply the `md-no-momentum` class to ensure that Safari's + * momentum scrolling is disabled. Momentum scrolling can cause flickering issues while scrolling + * SVG icons and some other components. + * + * Additionally, we now also offer the `md-no-flicker` class which can be applied to any element + * and uses a Webkit-specific filter of `blur(0px)` that forces GPU rendering of all elements + * inside (which eliminates the flicker on iOS devices). + * + * _Note: Forcing an element to render on the GPU can have unintended side-effects, especially + * related to the z-index of elements. Please use with caution and only on the elements needed._ + * + * @usage + * + * Add the `[layout-padding]` attribute to make the content padded. + * + * + * + * Lorem ipsum dolor sit amet, ne quod novum mei. + * + * + */ + +function mdContentDirective($mdTheming) { + return { + restrict: 'E', + controller: ['$scope', '$element', ContentController], + link: function(scope, element) { + element.addClass('_md'); // private md component indicator for styling + + $mdTheming(element); + scope.$broadcast('$mdContentLoaded', element); + + iosScrollFix(element[0]); + } + }; + + function ContentController($scope, $element) { + this.$scope = $scope; + this.$element = $element; + } +} + +function iosScrollFix(node) { + // IOS FIX: + // If we scroll where there is no more room for the webview to scroll, + // by default the webview itself will scroll up and down, this looks really + // bad. So if we are scrolling to the very top or bottom, add/subtract one + angular.element(node).on('$md.pressdown', function(ev) { + // Only touch events + if (ev.pointer.type !== 't') return; + // Don't let a child content's touchstart ruin it for us. + if (ev.$materialScrollFixed) return; + ev.$materialScrollFixed = true; + + if (node.scrollTop === 0) { + node.scrollTop = 1; + } else if (node.scrollHeight === node.scrollTop + node.offsetHeight) { + node.scrollTop -= 1; + } + }); +} + +})(); +(function(){ +"use strict"; + +/** + * @ngdoc module + * @name material.components.datepicker + * @description Module for the datepicker component. + */ + +angular.module('material.components.datepicker', [ + 'material.core', + 'material.components.icon', + 'material.components.virtualRepeat' +]); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc directive + * @name mdCalendar + * @module material.components.datepicker + * + * @param {Date} ng-model The component's model. Should be a Date object. + * @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being + * updated. Also allows for a timezone to be specified. + * Read more at the + * ngModelOptions docs. + * @param {Date=} md-min-date Expression representing the minimum date. + * @param {Date=} md-max-date Expression representing the maximum date. + * @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a + * boolean whether it can be selected in "day" mode or not. + * @param {(function(Date): boolean)=} md-month-filter Function expecting a date and returning a + * boolean whether it can be selected in "month" mode or not. + * @param {String=} md-current-view Current view of the calendar. Can be either "month" or "year". + * @param {String=} md-mode Restricts the user to only selecting a value from a particular view. + * This option can be used if the user is only supposed to choose from a certain date type + * (e.g. only selecting the month). Can be either "month" or "day". **Note** that this will + * overwrite the `md-current-view` value. + * + * @description + * `` is a component that renders a calendar that can be used to select a date. + * It is a part of the `` pane, however it can also be used on it's own. + * + * @usage + * + * + * + * + */ + CalendarCtrl.$inject = ["$element", "$scope", "$$mdDateUtil", "$mdUtil", "$mdConstant", "$mdTheming", "$$rAF", "$attrs", "$mdDateLocale", "$filter", "$document"]; + calendarDirective.$inject = ["inputDirective"]; + angular.module('material.components.datepicker') + .directive('mdCalendar', calendarDirective); + + // TODO(jelbourn): Mac Cmd + left / right == Home / End + // TODO(jelbourn): Refactor month element creation to use cloneNode (performance). + // TODO(jelbourn): Define virtual scrolling constants (compactness) users can override. + // TODO(jelbourn): Animated month transition on ng-model change (virtual-repeat) + // TODO(jelbourn): Scroll snapping (virtual repeat) + // TODO(jelbourn): Remove superfluous row from short months (virtual-repeat) + // TODO(jelbourn): Month headers stick to top when scrolling. + // TODO(jelbourn): Previous month opacity is lowered when partially scrolled out of view. + // TODO(jelbourn): Support md-calendar standalone on a page (as a tabstop w/ aria-live + // announcement and key handling). + // TODO Read-only calendar (not just date-picker). + + function calendarDirective(inputDirective) { + return { + template: function(tElement, tAttr) { + // This allows the calendar to work, without a datepicker. This ensures that the virtual + // repeater scrolls to the proper place on load by deferring the execution until the next + // digest. It's necessary only if the calendar is used without a datepicker, otherwise it's + // already wrapped in an ngIf. + var extraAttrs = tAttr.hasOwnProperty('ngIf') ? '' : 'ng-if="calendarCtrl.isInitialized"'; + return '' + + '
    ' + + '' + + '' + + '
    '; + }, + scope: { + minDate: '=mdMinDate', + maxDate: '=mdMaxDate', + dateFilter: '=mdDateFilter', + monthFilter: '=mdMonthFilter', + + // These need to be prefixed, because Angular resets + // any changes to the value due to bindToController. + _mode: '@mdMode', + _currentView: '@mdCurrentView' + }, + require: ['ngModel', 'mdCalendar'], + controller: CalendarCtrl, + controllerAs: 'calendarCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var ngModelCtrl = controllers[0]; + var mdCalendarCtrl = controllers[1]; + mdCalendarCtrl.configureNgModel(ngModelCtrl, inputDirective); + } + }; + } + + /** + * Occasionally the hideVerticalScrollbar method might read an element's + * width as 0, because it hasn't been laid out yet. This value will be used + * as a fallback, in order to prevent scenarios where the element's width + * would otherwise have been set to 0. This value is the "usual" width of a + * calendar within a floating calendar pane. + */ + var FALLBACK_WIDTH = 340; + + /** Next identifier for calendar instance. */ + var nextUniqueId = 0; + + /** Maps the `md-mode` values to their corresponding calendar views. */ + var MODE_MAP = { + day: 'month', + month: 'year' + }; + + /** + * Controller for the mdCalendar component. + * @ngInject @constructor + */ + function CalendarCtrl($element, $scope, $$mdDateUtil, $mdUtil, $mdConstant, $mdTheming, $$rAF, + $attrs, $mdDateLocale, $filter, $document) { + $mdTheming($element); + + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** + * @final + * @type {!angular.Scope} + */ + this.$scope = $scope; + + /** + * @final + * @type {!angular.$attrs} Current attributes object for the element + */ + this.$attrs = $attrs; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.$mdUtil = $mdUtil; + + /** @final */ + this.keyCode = $mdConstant.KEY_CODE; + + /** @final */ + this.$$rAF = $$rAF; + + /** @final */ + this.$mdDateLocale = $mdDateLocale; + + /** @final The built-in Angular date filter. */ + this.ngDateFilter = $filter('date'); + + /** + * @final + * @type {Date} + */ + this.today = this.dateUtil.createDateAtMidnight(); + + /** @type {!ngModel.NgModelController} */ + this.ngModelCtrl = undefined; + + /** @type {string} Class applied to the selected date cell. */ + this.SELECTED_DATE_CLASS = 'md-calendar-selected-date'; + + /** @type {string} Class applied to the cell for today. */ + this.TODAY_CLASS = 'md-calendar-date-today'; + + /** @type {string} Class applied to the focused cell. */ + this.FOCUSED_DATE_CLASS = 'md-focus'; + + /** + * @final + * @type {number} Unique ID for this calendar instance. + */ + this.id = nextUniqueId++; + + /** + * The date that is currently focused or showing in the calendar. This will initially be set + * to the ng-model value if set, otherwise to today. It will be updated as the user navigates + * to other months. The cell corresponding to the displayDate does not necessarily always have + * focus in the document (such as for cases when the user is scrolling the calendar). + * @type {Date} + */ + this.displayDate = null; + + /** + * Allows restricting the calendar to only allow selecting a month or a day. + * @type {'month'|'day'|null} + */ + this.mode = null; + + /** + * The selected date. Keep track of this separately from the ng-model value so that we + * can know, when the ng-model value changes, what the previous value was before it's updated + * in the component's UI. + * + * @type {Date} + */ + this.selectedDate = null; + + /** + * The first date that can be rendered by the calendar. The default is taken + * from the mdDateLocale provider and is limited by the mdMinDate. + * @type {Date} + */ + this.firstRenderableDate = null; + + /** + * The last date that can be rendered by the calendar. The default comes + * from the mdDateLocale provider and is limited by the maxDate. + * @type {Date} + */ + this.lastRenderableDate = null; + + /** + * Used to toggle initialize the root element in the next digest. + * @type {boolean} + */ + this.isInitialized = false; + + /** + * Cache for the width of the element without a scrollbar. Used to hide the scrollbar later on + * and to avoid extra reflows when switching between views. + * @type {number} + */ + this.width = 0; + + /** + * Caches the width of the scrollbar in order to be used when hiding it and to avoid extra reflows. + * @type {number} + */ + this.scrollbarWidth = 0; + + /** + * @type {boolean} set to true if the calendar is being used "standalone" (outside of a + * md-datepicker). + */ + this.standaloneMode = false; + + // Unless the user specifies so, the calendar should not be a tab stop. + // This is necessary because ngAria might add a tabindex to anything with an ng-model + // (based on whether or not the user has turned that particular feature on/off). + if (!$attrs.tabindex) { + $element.attr('tabindex', '-1'); + } + + var boundKeyHandler = angular.bind(this, this.handleKeyEvent); + + // If use the md-calendar directly in the body without datepicker, + // handleKeyEvent will disable other inputs on the page. + // So only apply the handleKeyEvent on the body when the md-calendar inside datepicker, + // otherwise apply on the calendar element only. + + var handleKeyElement; + if ($element.parent().hasClass('md-datepicker-calendar')) { + handleKeyElement = angular.element($document[0].body); + } else { + this.standaloneMode = true; + handleKeyElement = $element; + } + + // Bind the keydown handler to the body, in order to handle cases where the focused + // element gets removed from the DOM and stops propagating click events. + handleKeyElement.on('keydown', boundKeyHandler); + + $scope.$on('$destroy', function() { + handleKeyElement.off('keydown', boundKeyHandler); + }); + + // For AngularJS 1.4 and older, where there are no lifecycle hooks but bindings are pre-assigned, + // manually call the $onInit hook. + if (angular.version.major === 1 && angular.version.minor <= 4) { + this.$onInit(); + } + } + + /** + * AngularJS Lifecycle hook for newer AngularJS versions. + * Bindings are not guaranteed to have been assigned in the controller, but they are in the + * $onInit hook. + */ + CalendarCtrl.prototype.$onInit = function() { + /** + * The currently visible calendar view. Note the prefix on the scope value, + * which is necessary, because the datepicker seems to reset the real one value if the + * calendar is open, but the `currentView` on the datepicker's scope is empty. + * @type {String} + */ + if (this._mode && MODE_MAP.hasOwnProperty(this._mode)) { + this.currentView = MODE_MAP[this._mode]; + this.mode = this._mode; + } else { + this.currentView = this._currentView || 'month'; + this.mode = null; + } + + if (this.minDate && this.minDate > this.$mdDateLocale.firstRenderableDate) { + this.firstRenderableDate = this.minDate; + } else { + this.firstRenderableDate = this.$mdDateLocale.firstRenderableDate; + } + + if (this.maxDate && this.maxDate < this.$mdDateLocale.lastRenderableDate) { + this.lastRenderableDate = this.maxDate; + } else { + this.lastRenderableDate = this.$mdDateLocale.lastRenderableDate; + } + }; + + /** + * Sets up the controller's reference to ngModelController. + * @param {!ngModel.NgModelController} ngModelCtrl Instance of the ngModel controller. + * @param {Object} inputDirective Config for AngularJS's `input` directive. + */ + CalendarCtrl.prototype.configureNgModel = function(ngModelCtrl, inputDirective) { + var self = this; + self.ngModelCtrl = ngModelCtrl; + + // The component needs to be [type="date"] in order to be picked up by AngularJS. + this.$attrs.$set('type', 'date'); + + // Invoke the `input` directive link function, adding a stub for the element. + // This allows us to re-use AngularJS' logic for setting the timezone via ng-model-options. + // It works by calling the link function directly which then adds the proper `$parsers` and + // `$formatters` to the NgModelController. + inputDirective[0].link.pre(this.$scope, { + on: angular.noop, + val: angular.noop, + 0: {} + }, this.$attrs, [ngModelCtrl]); + + ngModelCtrl.$render = function() { + var value = this.$viewValue, convertedDate; + + // In the case where a conversion is needed, the $viewValue here will be a string like + // "2020-05-10" instead of a Date object. + if (!self.dateUtil.isValidDate(value)) { + convertedDate = self.dateUtil.removeLocalTzAndReparseDate(new Date(value)); + if (self.dateUtil.isValidDate(convertedDate)) { + value = convertedDate; + } + } + + // Notify the child scopes of any changes. + self.$scope.$broadcast('md-calendar-parent-changed', value); + + // Set up the selectedDate if it hasn't been already. + if (!self.selectedDate) { + self.selectedDate = value; + } + + // Also set up the displayDate. + if (!self.displayDate) { + self.displayDate = self.selectedDate || self.today; + } + }; + + self.$mdUtil.nextTick(function() { + self.isInitialized = true; + }); + }; + + /** + * Sets the ng-model value for the calendar and emits a change event. + * @param {Date} date new value for the calendar + */ + CalendarCtrl.prototype.setNgModelValue = function(date) { + var timezone = this.$mdUtil.getModelOption(this.ngModelCtrl, 'timezone'); + var value = this.dateUtil.createDateAtMidnight(date); + this.focusDate(value); + this.$scope.$emit('md-calendar-change', value); + // Using the timezone when the offset is negative (GMT+X) causes the previous day to be + // selected here. This check avoids that. + if (timezone == null || value.getTimezoneOffset() < 0) { + this.ngModelCtrl.$setViewValue(this.ngDateFilter(value, 'yyyy-MM-dd'), 'default'); + } else { + this.ngModelCtrl.$setViewValue(this.ngDateFilter(value, 'yyyy-MM-dd', timezone), 'default'); + } + this.ngModelCtrl.$render(); + return value; + }; + + /** + * Sets the current view that should be visible in the calendar + * @param {string} newView View name to be set. + * @param {number|Date} time Date object or a timestamp for the new display date. + */ + CalendarCtrl.prototype.setCurrentView = function(newView, time) { + var self = this; + + self.$mdUtil.nextTick(function() { + self.currentView = newView; + + if (time) { + self.displayDate = angular.isDate(time) ? time : new Date(time); + } + }); + }; + + /** + * Focus the cell corresponding to the given date. + * @param {Date=} date The date to be focused. + */ + CalendarCtrl.prototype.focusDate = function(date) { + if (this.dateUtil.isValidDate(date)) { + var previousFocus = this.$element[0].querySelector('.' + this.FOCUSED_DATE_CLASS); + if (previousFocus) { + previousFocus.classList.remove(this.FOCUSED_DATE_CLASS); + } + + var cellId = this.getDateId(date, this.currentView); + var cell = document.getElementById(cellId); + if (cell) { + cell.classList.add(this.FOCUSED_DATE_CLASS); + cell.focus(); + this.displayDate = date; + } + } else { + var rootElement = this.$element[0].querySelector('[ng-switch]'); + + if (rootElement) { + rootElement.focus(); + } + } + }; + + /** + * Highlights a date cell on the calendar and changes the selected date. + * @param {Date=} date Date to be marked as selected. + */ + CalendarCtrl.prototype.changeSelectedDate = function(date) { + var selectedDateClass = this.SELECTED_DATE_CLASS; + var prevDateCell = this.$element[0].querySelector('.' + selectedDateClass); + + // Remove the selected class from the previously selected date, if any. + if (prevDateCell) { + prevDateCell.classList.remove(selectedDateClass); + prevDateCell.setAttribute('aria-selected', 'false'); + } + + // Apply the select class to the new selected date if it is set. + if (date) { + var dateCell = document.getElementById(this.getDateId(date, this.currentView)); + if (dateCell) { + dateCell.classList.add(selectedDateClass); + dateCell.setAttribute('aria-selected', 'true'); + } + } + + this.selectedDate = date; + }; + + /** + * Normalizes the key event into an action name. The action will be broadcast + * to the child controllers. + * @param {KeyboardEvent} event + * @returns {string} The action that should be taken, or null if the key + * does not match a calendar shortcut. + */ + CalendarCtrl.prototype.getActionFromKeyEvent = function(event) { + var keyCode = this.keyCode; + + switch (event.which) { + case keyCode.ENTER: return 'select'; + + case keyCode.RIGHT_ARROW: return 'move-right'; + case keyCode.LEFT_ARROW: return 'move-left'; + + case keyCode.DOWN_ARROW: return event.metaKey ? 'move-page-down' : 'move-row-down'; + case keyCode.UP_ARROW: return event.metaKey ? 'move-page-up' : 'move-row-up'; + + case keyCode.PAGE_DOWN: return 'move-page-down'; + case keyCode.PAGE_UP: return 'move-page-up'; + + case keyCode.HOME: return 'start'; + case keyCode.END: return 'end'; + + default: return null; + } + }; + + /** + * Handles a key event in the calendar with the appropriate action. + * The action will either + * - select the focused date + * - navigate to focus a new date + * - emit a md-calendar-close event if in a md-datepicker panel + * - emit a md-calendar-parent-action + * - delegate to normal tab order if the TAB key is pressed in standalone mode + * @param {KeyboardEvent} event + */ + CalendarCtrl.prototype.handleKeyEvent = function(event) { + var self = this; + + this.$scope.$apply(function() { + // Capture escape and emit back up so that a wrapping component + // (such as a date-picker) can decide to close. + if (event.which === self.keyCode.ESCAPE || + (event.which === self.keyCode.TAB && !self.standaloneMode)) { + self.$scope.$emit('md-calendar-close'); + + if (event.which === self.keyCode.TAB) { + event.preventDefault(); + } + + return; + } else if (event.which === self.keyCode.TAB && self.standaloneMode) { + // delegate to the normal tab order if the TAB key is pressed in standalone mode + return; + } + + // Broadcast the action that any child controllers should take. + var action = self.getActionFromKeyEvent(event); + if (action) { + event.preventDefault(); + event.stopPropagation(); + self.$scope.$broadcast('md-calendar-parent-action', action); + } + }); + }; + + /** + * Hides the vertical scrollbar on the calendar scroller of a child controller by + * setting the width on the calendar scroller and the `overflow: hidden` wrapper + * around the scroller, and then setting a padding-right on the scroller equal + * to the width of the browser's scrollbar. + * + * This will cause a reflow. + * + * @param {object} childCtrl The child controller whose scrollbar should be hidden. + */ + CalendarCtrl.prototype.hideVerticalScrollbar = function(childCtrl) { + var self = this; + var element = childCtrl.$element[0]; + var scrollMask = element.querySelector('.md-calendar-scroll-mask'); + + if (self.width > 0) { + setWidth(); + } else { + self.$$rAF(function() { + var scroller = childCtrl.calendarScroller; + + self.scrollbarWidth = scroller.offsetWidth - scroller.clientWidth; + self.width = element.querySelector('table').offsetWidth; + setWidth(); + }); + } + + function setWidth() { + var width = self.width || FALLBACK_WIDTH; + var scrollbarWidth = self.scrollbarWidth; + var scroller = childCtrl.calendarScroller; + + scrollMask.style.width = width + 'px'; + scroller.style.width = (width + scrollbarWidth) + 'px'; + scroller.style.paddingRight = scrollbarWidth + 'px'; + } + }; + + /** + * Gets an identifier for a date unique to the calendar instance for internal + * purposes. Not to be displayed. + * @param {Date} date The date for which the id is being generated + * @param {string} namespace Namespace for the id. (month, year etc.) + * @returns {string} + */ + CalendarCtrl.prototype.getDateId = function(date, namespace) { + if (!namespace) { + throw new Error('A namespace for the date id has to be specified.'); + } + + return [ + 'md', + this.id, + namespace, + date.getFullYear(), + date.getMonth(), + date.getDate() + ].join('-'); + }; + + /** + * Util to trigger an extra digest on a parent scope, in order to to ensure that + * any child virtual repeaters have updated. This is necessary, because the virtual + * repeater doesn't update the $index the first time around since the content isn't + * in place yet. The case, in which this is an issue, is when the repeater has less + * than a page of content (e.g. a month or year view has a min or max date). + */ + CalendarCtrl.prototype.updateVirtualRepeat = function() { + var scope = this.$scope; + var virtualRepeatResizeListener = scope.$on('$md-resize-enable', function() { + if (!scope.$$phase) { + scope.$apply(); + } + + virtualRepeatResizeListener(); + }); + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarMonthCtrl.$inject = ["$element", "$scope", "$animate", "$q", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarMonth', calendarDirective); + + /** + * Height of one calendar month tbody. This must be made known to the virtual-repeat and is + * subsequently used for scrolling to specific months. + */ + var TBODY_HEIGHT = 265; + + /** + * Height of a calendar month with a single row. This is needed to calculate the offset for + * rendering an extra month in virtual-repeat that only contains one row. + */ + var TBODY_SINGLE_ROW_HEIGHT = 45; + + /** Private directive that represents a list of months inside the calendar. */ + function calendarDirective() { + return { + template: + '' + + '
    ' + + '' + + '' + + '' + + + // The ensures that the will always have the + // proper height, even if it's empty. If it's content is + // compiled, the will be overwritten. + '' + + '' + + '
    ' + + '
    ' + + '
    ', + require: ['^^mdCalendar', 'mdCalendarMonth'], + controller: CalendarMonthCtrl, + controllerAs: 'monthCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var monthCtrl = controllers[1]; + monthCtrl.initialize(calendarCtrl); + } + }; + } + + /** + * Controller for the calendar month component. + * @ngInject @constructor + */ + function CalendarMonthCtrl($element, $scope, $animate, $q, + $$mdDateUtil, $mdDateLocale) { + + /** @final {!angular.JQLite} */ + this.$element = $element; + + /** @final {!angular.Scope} */ + this.$scope = $scope; + + /** @final {!angular.$animate} */ + this.$animate = $animate; + + /** @final {!angular.$q} */ + this.$q = $q; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @final {HTMLElement} */ + this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); + + /** @type {boolean} */ + this.isInitialized = false; + + /** @type {boolean} */ + this.isMonthTransitionInProgress = false; + + var self = this; + + /** + * Handles a click event on a date cell. + * Created here so that every cell can use the same function instance. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.cellClickHandler = function() { + var timestamp = $$mdDateUtil.getTimestampFromNode(this); + self.$scope.$apply(function() { + // The timestamp has to be converted to a valid date. + self.calendarCtrl.setNgModelValue(new Date(timestamp)); + }); + }; + + /** + * Handles click events on the month headers. Switches + * the calendar to the year view. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.headerClickHandler = function() { + self.calendarCtrl.setCurrentView('year', $$mdDateUtil.getTimestampFromNode(this)); + }; + } + + /** Initialization **/ + + /** + * Initialize the controller by saving a reference to the calendar and + * setting up the object that will be iterated by the virtual repeater. + */ + CalendarMonthCtrl.prototype.initialize = function(calendarCtrl) { + /** + * Dummy array-like object for virtual-repeat to iterate over. The length is the total + * number of months that can be viewed. We add 2 months: one to include the current month + * and one for the last dummy month. + * + * This is shorter than ideal because of a (potential) Firefox bug + * https://bugzilla.mozilla.org/show_bug.cgi?id=1181658. + */ + + this.items = { + length: this.dateUtil.getMonthDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.lastRenderableDate + ) + 2 + }; + + this.calendarCtrl = calendarCtrl; + this.attachScopeListeners(); + calendarCtrl.updateVirtualRepeat(); + + // Fire the initial render, since we might have missed it the first time it fired. + calendarCtrl.ngModelCtrl && calendarCtrl.ngModelCtrl.$render(); + }; + + /** + * Gets the "index" of the currently selected date as it would be in the virtual-repeat. + * @returns {number} the "index" of the currently selected date + */ + CalendarMonthCtrl.prototype.getSelectedMonthIndex = function() { + var calendarCtrl = this.calendarCtrl; + + return this.dateUtil.getMonthDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.displayDate || calendarCtrl.selectedDate || calendarCtrl.today + ); + }; + + /** + * Change the date that is being shown in the calendar. If the given date is in a different + * month, the displayed month will be transitioned. + * @param {Date} date + */ + CalendarMonthCtrl.prototype.changeDisplayDate = function(date) { + // Initialization is deferred until this function is called because we want to reflect + // the starting value of ngModel. + if (!this.isInitialized) { + this.buildWeekHeader(); + this.calendarCtrl.hideVerticalScrollbar(this); + this.isInitialized = true; + return this.$q.when(); + } + + // If trying to show an invalid date or a transition is in progress, do nothing. + if (!this.dateUtil.isValidDate(date) || this.isMonthTransitionInProgress) { + return this.$q.when(); + } + + this.isMonthTransitionInProgress = true; + var animationPromise = this.animateDateChange(date); + + this.calendarCtrl.displayDate = date; + + var self = this; + animationPromise.then(function() { + self.isMonthTransitionInProgress = false; + }); + + return animationPromise; + }; + + /** + * Animates the transition from the calendar's current month to the given month. + * @param {Date} date + * @returns {angular.$q.Promise} The animation promise. + */ + CalendarMonthCtrl.prototype.animateDateChange = function(date) { + if (this.dateUtil.isValidDate(date)) { + var monthDistance = this.dateUtil.getMonthDistance(this.calendarCtrl.firstRenderableDate, date); + this.calendarScroller.scrollTop = monthDistance * TBODY_HEIGHT; + } + + return this.$q.when(); + }; + + /** + * Builds and appends a day-of-the-week header to the calendar. + * This should only need to be called once during initialization. + */ + CalendarMonthCtrl.prototype.buildWeekHeader = function() { + var firstDayOfWeek = this.dateLocale.firstDayOfWeek; + var shortDays = this.dateLocale.shortDays; + + var row = document.createElement('tr'); + for (var i = 0; i < 7; i++) { + var th = document.createElement('th'); + th.textContent = shortDays[(i + firstDayOfWeek) % 7]; + row.appendChild(th); + } + + this.$element.find('thead').append(row); + }; + + /** + * Attaches listeners for the scope events that are broadcast by the calendar. + */ + CalendarMonthCtrl.prototype.attachScopeListeners = function() { + var self = this; + + self.$scope.$on('md-calendar-parent-changed', function(event, value) { + self.calendarCtrl.changeSelectedDate(value); + self.changeDisplayDate(value); + }); + + self.$scope.$on('md-calendar-parent-action', angular.bind(this, this.handleKeyEvent)); + }; + + /** + * Handles the month-specific keyboard interactions. + * @param {Object} event Scope event object passed by the calendar. + * @param {String} action Action, corresponding to the key that was pressed. + */ + CalendarMonthCtrl.prototype.handleKeyEvent = function(event, action) { + var calendarCtrl = this.calendarCtrl; + var displayDate = calendarCtrl.displayDate; + + if (action === 'select') { + calendarCtrl.setNgModelValue(displayDate); + } else { + var date = null; + var dateUtil = this.dateUtil; + + switch (action) { + case 'move-right': date = dateUtil.incrementDays(displayDate, 1); break; + case 'move-left': date = dateUtil.incrementDays(displayDate, -1); break; + + case 'move-page-down': date = dateUtil.incrementMonths(displayDate, 1); break; + case 'move-page-up': date = dateUtil.incrementMonths(displayDate, -1); break; + + case 'move-row-down': date = dateUtil.incrementDays(displayDate, 7); break; + case 'move-row-up': date = dateUtil.incrementDays(displayDate, -7); break; + + case 'start': date = dateUtil.getFirstDateOfMonth(displayDate); break; + case 'end': date = dateUtil.getLastDateOfMonth(displayDate); break; + } + + if (date) { + date = this.dateUtil.clampDate(date, calendarCtrl.minDate, calendarCtrl.maxDate); + + this.changeDisplayDate(date).then(function() { + calendarCtrl.focusDate(date); + }); + } + } + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + mdCalendarMonthBodyDirective.$inject = ["$compile", "$$mdSvgRegistry"]; + CalendarMonthBodyCtrl.$inject = ["$element", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarMonthBody', mdCalendarMonthBodyDirective); + + /** + * Private directive consumed by md-calendar-month. Having this directive lets the calender use + * md-virtual-repeat and also cleanly separates the month DOM construction functions from + * the rest of the calendar controller logic. + * @ngInject + */ + function mdCalendarMonthBodyDirective($compile, $$mdSvgRegistry) { + var ARROW_ICON = $compile('')({})[0]; + + return { + require: ['^^mdCalendar', '^^mdCalendarMonth', 'mdCalendarMonthBody'], + scope: { offset: '=mdMonthOffset' }, + controller: CalendarMonthBodyCtrl, + controllerAs: 'mdMonthBodyCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var monthCtrl = controllers[1]; + var monthBodyCtrl = controllers[2]; + + monthBodyCtrl.calendarCtrl = calendarCtrl; + monthBodyCtrl.monthCtrl = monthCtrl; + monthBodyCtrl.arrowIcon = ARROW_ICON.cloneNode(true); + + // The virtual-repeat re-uses the same DOM elements, so there are only a limited number + // of repeated items that are linked, and then those elements have their bindings updated. + // Since the months are not generated by bindings, we simply regenerate the entire thing + // when the binding (offset) changes. + scope.$watch(function() { return monthBodyCtrl.offset; }, function(offset) { + if (angular.isNumber(offset)) { + monthBodyCtrl.generateContent(); + } + }); + } + }; + } + + /** + * Controller for a single calendar month. + * @ngInject @constructor + */ + function CalendarMonthBodyCtrl($element, $$mdDateUtil, $mdDateLocale) { + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @type {Object} Reference to the month view. */ + this.monthCtrl = null; + + /** @type {Object} Reference to the calendar. */ + this.calendarCtrl = null; + + /** + * Number of months from the start of the month "items" that the currently rendered month + * occurs. Set via angular data binding. + * @type {number|null} + */ + this.offset = null; + + /** + * Date cell to focus after appending the month to the document. + * @type {HTMLElement} + */ + this.focusAfterAppend = null; + } + + /** Generate and append the content for this month to the directive element. */ + CalendarMonthBodyCtrl.prototype.generateContent = function() { + var date = this.dateUtil.incrementMonths(this.calendarCtrl.firstRenderableDate, this.offset); + + this.$element + .empty() + .append(this.buildCalendarForMonth(date)); + + if (this.focusAfterAppend) { + this.focusAfterAppend.classList.add(this.calendarCtrl.FOCUSED_DATE_CLASS); + this.focusAfterAppend = null; + } + }; + + /** + * Creates a single cell to contain a date in the calendar with all appropriate + * attributes and classes added. If a date is given, the cell content will be set + * based on the date. + * @param {Date=} opt_date + * @returns {HTMLElement} + */ + CalendarMonthBodyCtrl.prototype.buildDateCell = function(opt_date) { + var monthCtrl = this.monthCtrl; + var calendarCtrl = this.calendarCtrl; + + // TODO(jelbourn): cloneNode is likely a faster way of doing this. + var cell = document.createElement('td'); + cell.tabIndex = -1; + cell.classList.add('md-calendar-date'); + cell.setAttribute('role', 'gridcell'); + + if (opt_date) { + cell.setAttribute('tabindex', '-1'); + cell.setAttribute('aria-label', this.dateLocale.longDateFormatter(opt_date)); + cell.id = calendarCtrl.getDateId(opt_date, 'month'); + + // Use `data-timestamp` attribute because IE10 does not support the `dataset` property. + cell.setAttribute('data-timestamp', opt_date.getTime()); + + // TODO(jelourn): Doing these comparisons for class addition during generation might be slow. + // It may be better to finish the construction and then query the node and add the class. + if (this.dateUtil.isSameDay(opt_date, calendarCtrl.today)) { + cell.classList.add(calendarCtrl.TODAY_CLASS); + } + + if (this.dateUtil.isValidDate(calendarCtrl.selectedDate) && + this.dateUtil.isSameDay(opt_date, calendarCtrl.selectedDate)) { + cell.classList.add(calendarCtrl.SELECTED_DATE_CLASS); + cell.setAttribute('aria-selected', 'true'); + } + + var cellText = this.dateLocale.dates[opt_date.getDate()]; + + if (this.isDateEnabled(opt_date)) { + // Add a indicator for select, hover, and focus states. + var selectionIndicator = document.createElement('span'); + selectionIndicator.classList.add('md-calendar-date-selection-indicator'); + selectionIndicator.textContent = cellText; + cell.appendChild(selectionIndicator); + cell.addEventListener('click', monthCtrl.cellClickHandler); + + if (calendarCtrl.displayDate && this.dateUtil.isSameDay(opt_date, calendarCtrl.displayDate)) { + this.focusAfterAppend = cell; + } + } else { + cell.classList.add('md-calendar-date-disabled'); + cell.textContent = cellText; + } + } + + return cell; + }; + + /** + * Check whether date is in range and enabled + * @param {Date=} opt_date + * @return {boolean} Whether the date is enabled. + */ + CalendarMonthBodyCtrl.prototype.isDateEnabled = function(opt_date) { + return this.dateUtil.isDateWithinRange(opt_date, + this.calendarCtrl.minDate, this.calendarCtrl.maxDate) && + (!angular.isFunction(this.calendarCtrl.dateFilter) + || this.calendarCtrl.dateFilter(opt_date)); + }; + + /** + * Builds a `tr` element for the calendar grid. + * @param rowNumber The week number within the month. + * @returns {HTMLElement} + */ + CalendarMonthBodyCtrl.prototype.buildDateRow = function(rowNumber) { + var row = document.createElement('tr'); + row.setAttribute('role', 'row'); + + // Because of an NVDA bug (with Firefox), the row needs an aria-label in order + // to prevent the entire row being read aloud when the user moves between rows. + // See http://community.nvda-project.org/ticket/4643. + row.setAttribute('aria-label', this.dateLocale.weekNumberFormatter(rowNumber)); + + return row; + }; + + /** + * Builds the content for the given date's month. + * @param {Date=} opt_dateInMonth + * @returns {DocumentFragment} A document fragment containing the elements. + */ + CalendarMonthBodyCtrl.prototype.buildCalendarForMonth = function(opt_dateInMonth) { + var date = this.dateUtil.isValidDate(opt_dateInMonth) ? opt_dateInMonth : new Date(); + + var firstDayOfMonth = this.dateUtil.getFirstDateOfMonth(date); + var firstDayOfTheWeek = this.getLocaleDay_(firstDayOfMonth); + var numberOfDaysInMonth = this.dateUtil.getNumberOfDaysInMonth(date); + + // Store rows for the month in a document fragment so that we can append them all at once. + var monthBody = document.createDocumentFragment(); + + var rowNumber = 1; + var row = this.buildDateRow(rowNumber); + monthBody.appendChild(row); + + // If this is the final month in the list of items, only the first week should render, + // so we should return immediately after the first row is complete and has been + // attached to the body. + var isFinalMonth = this.offset === this.monthCtrl.items.length - 1; + + // Add a label for the month. If the month starts on a Sun/Mon/Tues, the month label + // goes on a row above the first of the month. Otherwise, the month label takes up the first + // two cells of the first row. + var blankCellOffset = 0; + var monthLabelCell = document.createElement('td'); + var monthLabelCellContent = document.createElement('span'); + var calendarCtrl = this.calendarCtrl; + + monthLabelCellContent.textContent = this.dateLocale.monthHeaderFormatter(date); + monthLabelCell.appendChild(monthLabelCellContent); + monthLabelCell.classList.add('md-calendar-month-label'); + // If the entire month is after the max date, render the label as a disabled state. + if (calendarCtrl.maxDate && firstDayOfMonth > calendarCtrl.maxDate) { + monthLabelCell.classList.add('md-calendar-month-label-disabled'); + // If the user isn't supposed to be able to change views, render the + // label as usual, but disable the clicking functionality. + } else if (!calendarCtrl.mode) { + monthLabelCell.addEventListener('click', this.monthCtrl.headerClickHandler); + monthLabelCell.setAttribute('data-timestamp', firstDayOfMonth.getTime()); + monthLabelCell.setAttribute('aria-label', this.dateLocale.monthFormatter(date)); + monthLabelCell.classList.add('md-calendar-label-clickable'); + monthLabelCell.appendChild(this.arrowIcon.cloneNode(true)); + } + + if (firstDayOfTheWeek <= 2) { + monthLabelCell.setAttribute('colspan', '7'); + + var monthLabelRow = this.buildDateRow(); + monthLabelRow.appendChild(monthLabelCell); + monthBody.insertBefore(monthLabelRow, row); + + if (isFinalMonth) { + return monthBody; + } + } else { + blankCellOffset = 3; + monthLabelCell.setAttribute('colspan', '3'); + row.appendChild(monthLabelCell); + } + + // Add a blank cell for each day of the week that occurs before the first of the month. + // For example, if the first day of the month is a Tuesday, add blank cells for Sun and Mon. + // The blankCellOffset is needed in cases where the first N cells are used by the month label. + for (var i = blankCellOffset; i < firstDayOfTheWeek; i++) { + row.appendChild(this.buildDateCell()); + } + + // Add a cell for each day of the month, keeping track of the day of the week so that + // we know when to start a new row. + var dayOfWeek = firstDayOfTheWeek; + var iterationDate = firstDayOfMonth; + for (var d = 1; d <= numberOfDaysInMonth; d++) { + // If we've reached the end of the week, start a new row. + if (dayOfWeek === 7) { + // We've finished the first row, so we're done if this is the final month. + if (isFinalMonth) { + return monthBody; + } + dayOfWeek = 0; + rowNumber++; + row = this.buildDateRow(rowNumber); + monthBody.appendChild(row); + } + + iterationDate.setDate(d); + var cell = this.buildDateCell(iterationDate); + row.appendChild(cell); + + dayOfWeek++; + } + + // Ensure that the last row of the month has 7 cells. + while (row.childNodes.length < 7) { + row.appendChild(this.buildDateCell()); + } + + // Ensure that all months have 6 rows. This is necessary for now because the virtual-repeat + // requires that all items have exactly the same height. + while (monthBody.childNodes.length < 6) { + var whitespaceRow = this.buildDateRow(); + for (var j = 0; j < 7; j++) { + whitespaceRow.appendChild(this.buildDateCell()); + } + monthBody.appendChild(whitespaceRow); + } + + return monthBody; + }; + + /** + * Gets the day-of-the-week index for a date for the current locale. + * @private + * @param {Date} date + * @returns {number} The column index of the date in the calendar. + */ + CalendarMonthBodyCtrl.prototype.getLocaleDay_ = function(date) { + return (date.getDay() + (7 - this.dateLocale.firstDayOfWeek)) % 7; + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarYearCtrl.$inject = ["$element", "$scope", "$animate", "$q", "$$mdDateUtil", "$mdUtil"]; + angular.module('material.components.datepicker') + .directive('mdCalendarYear', calendarDirective); + + /** + * Height of one calendar year tbody. This must be made known to the virtual-repeat and is + * subsequently used for scrolling to specific years. + */ + var TBODY_HEIGHT = 88; + + /** Private component, representing a list of years in the calendar. */ + function calendarDirective() { + return { + template: + '
    ' + + '' + + '' + + '' + + // The ensures that the will have the proper + // height, even though it may be empty. + '' + + '' + + '
    ' + + '
    ' + + '
    ', + require: ['^^mdCalendar', 'mdCalendarYear'], + controller: CalendarYearCtrl, + controllerAs: 'yearCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var yearCtrl = controllers[1]; + yearCtrl.initialize(calendarCtrl); + } + }; + } + + /** + * Controller for the mdCalendar component. + * @ngInject @constructor + */ + function CalendarYearCtrl($element, $scope, $animate, $q, $$mdDateUtil, $mdUtil) { + + /** @final {!angular.JQLite} */ + this.$element = $element; + + /** @final {!angular.Scope} */ + this.$scope = $scope; + + /** @final {!angular.$animate} */ + this.$animate = $animate; + + /** @final {!angular.$q} */ + this.$q = $q; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final {HTMLElement} */ + this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); + + /** @type {boolean} */ + this.isInitialized = false; + + /** @type {boolean} */ + this.isMonthTransitionInProgress = false; + + /** @final */ + this.$mdUtil = $mdUtil; + + var self = this; + + /** + * Handles a click event on a date cell. + * Created here so that every cell can use the same function instance. + * @this {HTMLTableCellElement} The cell that was clicked. + */ + this.cellClickHandler = function() { + self.onTimestampSelected($$mdDateUtil.getTimestampFromNode(this)); + }; + } + + /** + * Initialize the controller by saving a reference to the calendar and + * setting up the object that will be iterated by the virtual repeater. + */ + CalendarYearCtrl.prototype.initialize = function(calendarCtrl) { + /** + * Dummy array-like object for virtual-repeat to iterate over. The length is the total + * number of years that can be viewed. We add 1 extra in order to include the current year. + */ + + this.items = { + length: this.dateUtil.getYearDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.lastRenderableDate + ) + 1 + }; + + this.calendarCtrl = calendarCtrl; + this.attachScopeListeners(); + calendarCtrl.updateVirtualRepeat(); + + // Fire the initial render, since we might have missed it the first time it fired. + calendarCtrl.ngModelCtrl && calendarCtrl.ngModelCtrl.$render(); + }; + + /** + * Gets the "index" of the currently selected date as it would be in the virtual-repeat. + * @returns {number} + */ + CalendarYearCtrl.prototype.getFocusedYearIndex = function() { + var calendarCtrl = this.calendarCtrl; + + return this.dateUtil.getYearDistance( + calendarCtrl.firstRenderableDate, + calendarCtrl.displayDate || calendarCtrl.selectedDate || calendarCtrl.today + ); + }; + + /** + * Change the date that is highlighted in the calendar. + * @param {Date} date + */ + CalendarYearCtrl.prototype.changeDate = function(date) { + // Initialization is deferred until this function is called because we want to reflect + // the starting value of ngModel. + if (!this.isInitialized) { + this.calendarCtrl.hideVerticalScrollbar(this); + this.isInitialized = true; + return this.$q.when(); + } else if (this.dateUtil.isValidDate(date) && !this.isMonthTransitionInProgress) { + var self = this; + var animationPromise = this.animateDateChange(date); + + self.isMonthTransitionInProgress = true; + self.calendarCtrl.displayDate = date; + + return animationPromise.then(function() { + self.isMonthTransitionInProgress = false; + }); + } + }; + + /** + * Animates the transition from the calendar's current month to the given month. + * @param {Date} date + * @returns {angular.$q.Promise} The animation promise. + */ + CalendarYearCtrl.prototype.animateDateChange = function(date) { + if (this.dateUtil.isValidDate(date)) { + var monthDistance = this.dateUtil.getYearDistance(this.calendarCtrl.firstRenderableDate, date); + this.calendarScroller.scrollTop = monthDistance * TBODY_HEIGHT; + } + + return this.$q.when(); + }; + + /** + * Handles the year-view-specific keyboard interactions. + * @param {Object} event Scope event object passed by the calendar. + * @param {String} action Action, corresponding to the key that was pressed. + */ + CalendarYearCtrl.prototype.handleKeyEvent = function(event, action) { + var self = this; + var calendarCtrl = self.calendarCtrl; + var displayDate = calendarCtrl.displayDate; + + if (action === 'select') { + self.changeDate(displayDate).then(function() { + self.onTimestampSelected(displayDate); + }); + } else { + var date = null; + var dateUtil = self.dateUtil; + + switch (action) { + case 'move-right': date = dateUtil.incrementMonths(displayDate, 1); break; + case 'move-left': date = dateUtil.incrementMonths(displayDate, -1); break; + + case 'move-row-down': date = dateUtil.incrementMonths(displayDate, 6); break; + case 'move-row-up': date = dateUtil.incrementMonths(displayDate, -6); break; + } + + if (date) { + var min = calendarCtrl.minDate ? dateUtil.getFirstDateOfMonth(calendarCtrl.minDate) : null; + var max = calendarCtrl.maxDate ? dateUtil.getFirstDateOfMonth(calendarCtrl.maxDate) : null; + date = dateUtil.getFirstDateOfMonth(self.dateUtil.clampDate(date, min, max)); + + self.changeDate(date).then(function() { + calendarCtrl.focusDate(date); + }); + } + } + }; + + /** + * Attaches listeners for the scope events that are broadcast by the calendar. + */ + CalendarYearCtrl.prototype.attachScopeListeners = function() { + var self = this; + + self.$scope.$on('md-calendar-parent-changed', function(event, value) { + self.calendarCtrl.changeSelectedDate(value ? self.dateUtil.getFirstDateOfMonth(value) : value); + self.changeDate(value); + }); + + self.$scope.$on('md-calendar-parent-action', angular.bind(self, self.handleKeyEvent)); + }; + + /** + * Handles the behavior when a date is selected. Depending on the `mode` + * of the calendar, this can either switch back to the calendar view or + * set the model value. + * @param {number} timestamp The selected timestamp. + */ + CalendarYearCtrl.prototype.onTimestampSelected = function(timestamp) { + var calendarCtrl = this.calendarCtrl; + + if (calendarCtrl.mode) { + this.$mdUtil.nextTick(function() { + // The timestamp has to be converted to a valid date. + calendarCtrl.setNgModelValue(new Date(timestamp)); + }); + } else { + calendarCtrl.setCurrentView('month', timestamp); + } + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + CalendarYearBodyCtrl.$inject = ["$element", "$$mdDateUtil", "$mdDateLocale"]; + angular.module('material.components.datepicker') + .directive('mdCalendarYearBody', mdCalendarYearDirective); + + /** + * Private component, consumed by the md-calendar-year, which separates the DOM construction logic + * and allows for the year view to use md-virtual-repeat. + */ + function mdCalendarYearDirective() { + return { + require: ['^^mdCalendar', '^^mdCalendarYear', 'mdCalendarYearBody'], + scope: { offset: '=mdYearOffset' }, + controller: CalendarYearBodyCtrl, + controllerAs: 'mdYearBodyCtrl', + bindToController: true, + link: function(scope, element, attrs, controllers) { + var calendarCtrl = controllers[0]; + var yearCtrl = controllers[1]; + var yearBodyCtrl = controllers[2]; + + yearBodyCtrl.calendarCtrl = calendarCtrl; + yearBodyCtrl.yearCtrl = yearCtrl; + + scope.$watch(function() { return yearBodyCtrl.offset; }, function(offset) { + if (angular.isNumber(offset)) { + yearBodyCtrl.generateContent(); + } + }); + } + }; + } + + /** + * Controller for a single year. + * @ngInject @constructor + */ + function CalendarYearBodyCtrl($element, $$mdDateUtil, $mdDateLocale) { + /** + * @final + * @type {!JQLite} + */ + this.$element = $element; + + /** @final */ + this.dateUtil = $$mdDateUtil; + + /** @final */ + this.dateLocale = $mdDateLocale; + + /** @type {Object} Reference to the calendar. */ + this.calendarCtrl = null; + + /** @type {Object} Reference to the year view. */ + this.yearCtrl = null; + + /** + * Number of months from the start of the month "items" that the currently rendered month + * occurs. Set via angular data binding. + * @type {number|null} + */ + this.offset = null; + + /** + * Date cell to focus after appending the month to the document. + * @type {HTMLElement} + */ + this.focusAfterAppend = null; + } + + /** Generate and append the content for this year to the directive element. */ + CalendarYearBodyCtrl.prototype.generateContent = function() { + var date = this.dateUtil.incrementYears(this.calendarCtrl.firstRenderableDate, this.offset); + + this.$element + .empty() + .append(this.buildCalendarForYear(date)); + + if (this.focusAfterAppend) { + this.focusAfterAppend.classList.add(this.calendarCtrl.FOCUSED_DATE_CLASS); + this.focusAfterAppend = null; + } + }; + + /** + * Creates a single cell to contain a year in the calendar. + * @param {number} year Four-digit year. + * @param {number} month Zero-indexed month. + * @returns {HTMLElement} + */ + CalendarYearBodyCtrl.prototype.buildMonthCell = function(year, month) { + var calendarCtrl = this.calendarCtrl; + var yearCtrl = this.yearCtrl; + var cell = this.buildBlankCell(); + + // Represent this month/year as a date. + var firstOfMonth = new Date(year, month, 1); + cell.setAttribute('aria-label', this.dateLocale.monthFormatter(firstOfMonth)); + cell.id = calendarCtrl.getDateId(firstOfMonth, 'year'); + + // Use `data-timestamp` attribute because IE10 does not support the `dataset` property. + cell.setAttribute('data-timestamp', String(firstOfMonth.getTime())); + + if (this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.today)) { + cell.classList.add(calendarCtrl.TODAY_CLASS); + } + + if (this.dateUtil.isValidDate(calendarCtrl.selectedDate) && + this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.selectedDate)) { + cell.classList.add(calendarCtrl.SELECTED_DATE_CLASS); + cell.setAttribute('aria-selected', 'true'); + } + + var cellText = this.dateLocale.shortMonths[month]; + + if (this.dateUtil.isMonthWithinRange( + firstOfMonth, calendarCtrl.minDate, calendarCtrl.maxDate) && + (!angular.isFunction(calendarCtrl.monthFilter) || + calendarCtrl.monthFilter(firstOfMonth))) { + var selectionIndicator = document.createElement('span'); + selectionIndicator.classList.add('md-calendar-date-selection-indicator'); + selectionIndicator.textContent = cellText; + cell.appendChild(selectionIndicator); + cell.addEventListener('click', yearCtrl.cellClickHandler); + + if (calendarCtrl.displayDate && + this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.displayDate)) { + this.focusAfterAppend = cell; + } + } else { + cell.classList.add('md-calendar-date-disabled'); + cell.textContent = cellText; + } + + return cell; + }; + + /** + * Builds a blank cell. + * @return {HTMLElement} + */ + CalendarYearBodyCtrl.prototype.buildBlankCell = function() { + var cell = document.createElement('td'); + cell.tabIndex = -1; + cell.classList.add('md-calendar-date'); + cell.setAttribute('role', 'gridcell'); + + cell.setAttribute('tabindex', '-1'); + return cell; + }; + + /** + * Builds the content for the given year. + * @param {Date} date Date for which the content should be built. + * @returns {DocumentFragment} A document fragment containing the months within the year. + */ + CalendarYearBodyCtrl.prototype.buildCalendarForYear = function(date) { + // Store rows for the month in a document fragment so that we can append them all at once. + var year = date.getFullYear(); + var yearBody = document.createDocumentFragment(); + + var monthCell, i; + // First row contains label and Jan-Jun. + var firstRow = document.createElement('tr'); + var labelCell = document.createElement('td'); + labelCell.className = 'md-calendar-month-label'; + labelCell.textContent = String(year); + firstRow.appendChild(labelCell); + + for (i = 0; i < 6; i++) { + firstRow.appendChild(this.buildMonthCell(year, i)); + } + yearBody.appendChild(firstRow); + + // Second row contains a blank cell and Jul-Dec. + var secondRow = document.createElement('tr'); + secondRow.appendChild(this.buildBlankCell()); + for (i = 6; i < 12; i++) { + secondRow.appendChild(this.buildMonthCell(year, i)); + } + yearBody.appendChild(secondRow); + + return yearBody; + }; +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * @ngdoc service + * @name $mdDateLocaleProvider + * @module material.components.datepicker + * + * @description + * The `$mdDateLocaleProvider` is the provider that creates the `$mdDateLocale` service. + * This provider that allows the user to specify messages, formatters, and parsers for date + * internationalization. The `$mdDateLocale` service itself is consumed by AngularJS Material + * components that deal with dates + * (i.e. mdDatepicker). + * + * @property {Array} months Array of month names (in order). + * @property {Array} shortMonths Array of abbreviated month names. + * @property {Array} days Array of the days of the week (in order). + * @property {Array} shortDays Array of abbreviated days of the week. + * @property {Array} dates Array of dates of the month. Only necessary for locales + * using a numeral system other than [1, 2, 3...]. + * @property {Array} firstDayOfWeek The first day of the week. Sunday = 0, Monday = 1, + * etc. + * @property {function(string): Date} parseDate Function that converts a date string to a Date + * object (the date portion). + * @property {function(Date, string): string} formatDate Function to format a date object to a + * string. The datepicker directive also provides the time zone, if it was specified. + * @property {function(Date): string} monthHeaderFormatter Function that returns the label for + * a month given a date. + * @property {function(Date): string} monthFormatter Function that returns the full name of a month + * for a given date. + * @property {function(number): string} weekNumberFormatter Function that returns a label for + * a week given the week number. + * @property {function(Date): string} longDateFormatter Function that formats a date into a long + * `aria-label` that is read by the screen reader when the focused date changes. + * @property {string} msgCalendar Translation of the label "Calendar" for the current locale. + * @property {string} msgOpenCalendar Translation of the button label "Open calendar" for the + * current locale. + * @property {Date} firstRenderableDate The date from which the datepicker calendar will begin + * rendering. Note that this will be ignored if a minimum date is set. + * Defaults to January 1st 1880. + * @property {Date} lastRenderableDate The last date that will be rendered by the datepicker + * calendar. Note that this will be ignored if a maximum date is set. + * Defaults to January 1st 2130. + * @property {function(string): boolean} isDateComplete Function to determine whether a string + * makes sense to be parsed to a `Date` object. Returns `true` if the date appears to be complete + * and parsing should occur. By default, this checks for 3 groups of text or numbers separated + * by delimiters. This means that by default, date strings must include a month, day, and year + * to be parsed and for the model to be updated. + * + * @usage + * + * myAppModule.config(function($mdDateLocaleProvider) { + * + * // Example of a French localization. + * $mdDateLocaleProvider.months = ['janvier', 'février', 'mars', ...]; + * $mdDateLocaleProvider.shortMonths = ['janv', 'févr', 'mars', ...]; + * $mdDateLocaleProvider.days = ['dimanche', 'lundi', 'mardi', ...]; + * $mdDateLocaleProvider.shortDays = ['Di', 'Lu', 'Ma', ...]; + * + * // Can change week display to start on Monday. + * $mdDateLocaleProvider.firstDayOfWeek = 1; + * + * // Optional. + * $mdDateLocaleProvider.dates = [1, 2, 3, 4, 5, 6, ...]; + * + * // Example uses moment.js to parse and format dates. + * $mdDateLocaleProvider.parseDate = function(dateString) { + * var m = moment(dateString, 'L', true); + * return m.isValid() ? m.toDate() : new Date(NaN); + * }; + * + * $mdDateLocaleProvider.formatDate = function(date) { + * var m = moment(date); + * return m.isValid() ? m.format('L') : ''; + * }; + * + * // Allow only a day and month to be specified. + * // This is required if using the 'M/D' format with moment.js. + * $mdDateLocaleProvider.isDateComplete = function(dateString) { + * dateString = dateString.trim(); + * + * // Look for two chunks of content (either numbers or text) separated by delimiters. + * var re = /^(([a-zA-Z]{3,}|[0-9]{1,4})([ .,]+|[/-]))([a-zA-Z]{3,}|[0-9]{1,4})/; + * return re.test(dateString); + * }; + * + * $mdDateLocaleProvider.monthHeaderFormatter = function(date) { + * return myShortMonths[date.getMonth()] + ' ' + date.getFullYear(); + * }; + * + * // In addition to date display, date components also need localized messages + * // for aria-labels for screen-reader users. + * + * $mdDateLocaleProvider.weekNumberFormatter = function(weekNumber) { + * return 'Semaine ' + weekNumber; + * }; + * + * $mdDateLocaleProvider.msgCalendar = 'Calendrier'; + * $mdDateLocaleProvider.msgOpenCalendar = 'Ouvrir le calendrier'; + * + * // You can also set when your calendar begins and ends. + * $mdDateLocaleProvider.firstRenderableDate = new Date(1776, 6, 4); + * $mdDateLocaleProvider.lastRenderableDate = new Date(2012, 11, 21); + * }); + * + * + */ + angular.module('material.components.datepicker').config(["$provide", function($provide) { + // TODO(jelbourn): Assert provided values are correctly formatted. Need assertions. + + /** @constructor */ + function DateLocaleProvider() { + /** Array of full month names. E.g., ['January', 'February', ...] */ + this.months = null; + + /** Array of abbreviated month names. E.g., ['Jan', 'Feb', ...] */ + this.shortMonths = null; + + /** Array of full day of the week names. E.g., ['Monday', 'Tuesday', ...] */ + this.days = null; + + /** Array of abbreviated dat of the week names. E.g., ['M', 'T', ...] */ + this.shortDays = null; + + /** Array of dates of a month (1 - 31). Characters might be different in some locales. */ + this.dates = null; + + /** Index of the first day of the week. 0 = Sunday, 1 = Monday, etc. */ + this.firstDayOfWeek = 0; + + /** + * Function that converts the date portion of a Date to a string. + * @type {(function(Date): string)} + */ + this.formatDate = null; + + /** + * Function that converts a date string to a Date object (the date portion) + * @type {function(string): Date} + */ + this.parseDate = null; + + /** + * Function that formats a Date into a month header string. + * @type {function(Date): string} + */ + this.monthHeaderFormatter = null; + + /** + * Function that formats a week number into a label for the week. + * @type {function(number): string} + */ + this.weekNumberFormatter = null; + + /** + * Function that formats a date into a long aria-label that is read + * when the focused date changes. + * @type {function(Date): string} + */ + this.longDateFormatter = null; + + /** + * Function to determine whether a string makes sense to be + * parsed to a Date object. + * @type {function(string): boolean} + */ + this.isDateComplete = null; + + /** + * ARIA label for the calendar "dialog" used in the datepicker. + * @type {string} + */ + this.msgCalendar = ''; + + /** + * ARIA label for the datepicker's "Open calendar" buttons. + * @type {string} + */ + this.msgOpenCalendar = ''; + } + + /** + * Factory function that returns an instance of the dateLocale service. + * @ngInject + * @param $locale + * @param $filter + * @returns {DateLocale} + */ + DateLocaleProvider.prototype.$get = function($locale, $filter) { + /** + * Default date-to-string formatting function. + * @param {!Date} date + * @param {string=} timezone + * @returns {string} + */ + function defaultFormatDate(date, timezone) { + if (!date) { + return ''; + } + + // All of the dates created through ng-material *should* be set to midnight. + // If we encounter a date where the localeTime shows at 11pm instead of midnight, + // we have run into an issue with DST where we need to increment the hour by one: + // var d = new Date(1992, 9, 8, 0, 0, 0); + // d.toLocaleString(); // == "10/7/1992, 11:00:00 PM" + var localeTime = date.toLocaleTimeString(); + var formatDate = date; + if (date.getHours() === 0 && + (localeTime.indexOf('11:') !== -1 || localeTime.indexOf('23:') !== -1)) { + formatDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 1, 0, 0); + } + + return $filter('date')(formatDate, 'M/d/yyyy', timezone); + } + + /** + * Default string-to-date parsing function. + * @param {string|number} dateString + * @returns {!Date} + */ + function defaultParseDate(dateString) { + return new Date(dateString); + } + + /** + * Default function to determine whether a string makes sense to be + * parsed to a Date object. + * + * This is very permissive and is just a basic check to ensure that + * things like single integers aren't able to be parsed into dates. + * @param {string} dateString + * @returns {boolean} + */ + function defaultIsDateComplete(dateString) { + dateString = dateString.trim(); + + // Looks for three chunks of content (either numbers or text) separated + // by delimiters. + var re = /^(([a-zA-Z]{3,}|[0-9]{1,4})([ .,]+|[/-])){2}([a-zA-Z]{3,}|[0-9]{1,4})$/; + return re.test(dateString); + } + + /** + * Default date-to-string formatter to get a month header. + * @param {!Date} date + * @returns {string} + */ + function defaultMonthHeaderFormatter(date) { + return service.shortMonths[date.getMonth()] + ' ' + date.getFullYear(); + } + + /** + * Default formatter for a month. + * @param {!Date} date + * @returns {string} + */ + function defaultMonthFormatter(date) { + return service.months[date.getMonth()] + ' ' + date.getFullYear(); + } + + /** + * Default week number formatter. + * @param number + * @returns {string} + */ + function defaultWeekNumberFormatter(number) { + return 'Week ' + number; + } + + /** + * Default formatter for date cell aria-labels. + * @param {!Date} date + * @returns {string} + */ + function defaultLongDateFormatter(date) { + // Example: 'Thursday June 18 2015' + return [ + service.days[date.getDay()], + service.months[date.getMonth()], + service.dates[date.getDate()], + date.getFullYear() + ].join(' '); + } + + // The default "short" day strings are the first character of each day, + // e.g., "Monday" => "M". + var defaultShortDays = $locale.DATETIME_FORMATS.SHORTDAY.map(function(day) { + return day.substring(0, 1); + }); + + // The default dates are simply the numbers 1 through 31. + var defaultDates = Array(32); + for (var i = 1; i <= 31; i++) { + defaultDates[i] = i; + } + + // Default ARIA messages are in English (US). + var defaultMsgCalendar = 'Calendar'; + var defaultMsgOpenCalendar = 'Open calendar'; + + // Default start/end dates that are rendered in the calendar. + var defaultFirstRenderableDate = new Date(1880, 0, 1); + var defaultLastRendereableDate = new Date(defaultFirstRenderableDate.getFullYear() + 250, 0, 1); + + var service = { + months: this.months || $locale.DATETIME_FORMATS.MONTH, + shortMonths: this.shortMonths || $locale.DATETIME_FORMATS.SHORTMONTH, + days: this.days || $locale.DATETIME_FORMATS.DAY, + shortDays: this.shortDays || defaultShortDays, + dates: this.dates || defaultDates, + firstDayOfWeek: this.firstDayOfWeek || 0, + formatDate: this.formatDate || defaultFormatDate, + parseDate: this.parseDate || defaultParseDate, + isDateComplete: this.isDateComplete || defaultIsDateComplete, + monthHeaderFormatter: this.monthHeaderFormatter || defaultMonthHeaderFormatter, + monthFormatter: this.monthFormatter || defaultMonthFormatter, + weekNumberFormatter: this.weekNumberFormatter || defaultWeekNumberFormatter, + longDateFormatter: this.longDateFormatter || defaultLongDateFormatter, + msgCalendar: this.msgCalendar || defaultMsgCalendar, + msgOpenCalendar: this.msgOpenCalendar || defaultMsgOpenCalendar, + firstRenderableDate: this.firstRenderableDate || defaultFirstRenderableDate, + lastRenderableDate: this.lastRenderableDate || defaultLastRendereableDate + }; + + return service; + }; + DateLocaleProvider.prototype.$get.$inject = ["$locale", "$filter"]; + + $provide.provider('$mdDateLocale', new DateLocaleProvider()); + }]); +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + /** + * Utility for performing date calculations to facilitate operation of the calendar and + * datepicker. + */ + angular.module('material.components.datepicker').factory('$$mdDateUtil', ["$mdDateLocale", function($mdDateLocale) { + return { + getFirstDateOfMonth: getFirstDateOfMonth, + getNumberOfDaysInMonth: getNumberOfDaysInMonth, + getDateInNextMonth: getDateInNextMonth, + getDateInPreviousMonth: getDateInPreviousMonth, + isInNextMonth: isInNextMonth, + isInPreviousMonth: isInPreviousMonth, + getDateMidpoint: getDateMidpoint, + isSameMonthAndYear: isSameMonthAndYear, + getWeekOfMonth: getWeekOfMonth, + incrementDays: incrementDays, + incrementMonths: incrementMonths, + getLastDateOfMonth: getLastDateOfMonth, + isSameDay: isSameDay, + getMonthDistance: getMonthDistance, + isValidDate: isValidDate, + setDateTimeToMidnight: setDateTimeToMidnight, + createDateAtMidnight: createDateAtMidnight, + isDateWithinRange: isDateWithinRange, + incrementYears: incrementYears, + getYearDistance: getYearDistance, + clampDate: clampDate, + getTimestampFromNode: getTimestampFromNode, + isMonthWithinRange: isMonthWithinRange, + removeLocalTzAndReparseDate: removeLocalTzAndReparseDate + }; + + /** + * Gets the first day of the month for the given date's month. + * @param {Date} date + * @returns {Date} + */ + function getFirstDateOfMonth(date) { + return new Date(date.getFullYear(), date.getMonth(), 1); + } + + /** + * Gets the number of days in the month for the given date's month. + * @param date + * @returns {number} + */ + function getNumberOfDaysInMonth(date) { + return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(); + } + + /** + * Get an arbitrary date in the month after the given date's month. + * @param date + * @returns {Date} + */ + function getDateInNextMonth(date) { + return new Date(date.getFullYear(), date.getMonth() + 1, 1); + } + + /** + * Get an arbitrary date in the month before the given date's month. + * @param date + * @returns {Date} + */ + function getDateInPreviousMonth(date) { + return new Date(date.getFullYear(), date.getMonth() - 1, 1); + } + + /** + * Gets whether two dates have the same month and year. + * @param {Date} d1 + * @param {Date} d2 + * @returns {boolean} + */ + function isSameMonthAndYear(d1, d2) { + return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth(); + } + + /** + * Gets whether two dates are the same day (not not necessarily the same time). + * @param {Date} d1 + * @param {Date} d2 + * @returns {boolean} + */ + function isSameDay(d1, d2) { + return d1.getDate() == d2.getDate() && isSameMonthAndYear(d1, d2); + } + + /** + * Gets whether a date is in the month immediately after some date. + * @param {Date} startDate The date from which to compare. + * @param {Date} endDate The date to check. + * @returns {boolean} + */ + function isInNextMonth(startDate, endDate) { + var nextMonth = getDateInNextMonth(startDate); + return isSameMonthAndYear(nextMonth, endDate); + } + + /** + * Gets whether a date is in the month immediately before some date. + * @param {Date} startDate The date from which to compare. + * @param {Date} endDate The date to check. + * @returns {boolean} + */ + function isInPreviousMonth(startDate, endDate) { + var previousMonth = getDateInPreviousMonth(startDate); + return isSameMonthAndYear(endDate, previousMonth); + } + + /** + * Gets the midpoint between two dates. + * @param {Date} d1 + * @param {Date} d2 + * @returns {Date} + */ + function getDateMidpoint(d1, d2) { + return createDateAtMidnight((d1.getTime() + d2.getTime()) / 2); + } + + /** + * Gets the week of the month that a given date occurs in. + * @param {Date} date + * @returns {number} Index of the week of the month (zero-based). + */ + function getWeekOfMonth(date) { + var firstDayOfMonth = getFirstDateOfMonth(date); + return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7); + } + + /** + * Gets a new date incremented by the given number of days. Number of days can be negative. + * @param {Date} date + * @param {number} numberOfDays + * @returns {Date} + */ + function incrementDays(date, numberOfDays) { + return new Date(date.getFullYear(), date.getMonth(), date.getDate() + numberOfDays); + } + + /** + * Gets a new date incremented by the given number of months. Number of months can be negative. + * If the date of the given month does not match the target month, the date will be set to the + * last day of the month. + * @param {Date} date + * @param {number} numberOfMonths + * @returns {Date} + */ + function incrementMonths(date, numberOfMonths) { + // If the same date in the target month does not actually exist, the Date object will + // automatically advance *another* month by the number of missing days. + // For example, if you try to go from Jan. 30 to Feb. 30, you'll end up on March 2. + // So, we check if the month overflowed and go to the last day of the target month instead. + var dateInTargetMonth = new Date(date.getFullYear(), date.getMonth() + numberOfMonths, 1); + var numberOfDaysInMonth = getNumberOfDaysInMonth(dateInTargetMonth); + if (numberOfDaysInMonth < date.getDate()) { + dateInTargetMonth.setDate(numberOfDaysInMonth); + } else { + dateInTargetMonth.setDate(date.getDate()); + } + + return dateInTargetMonth; + } + + /** + * Get the integer distance between two months. This *only* considers the month and year + * portion of the Date instances. + * + * @param {Date} start + * @param {Date} end + * @returns {number} Number of months between `start` and `end`. If `end` is before `start` + * chronologically, this number will be negative. + */ + function getMonthDistance(start, end) { + return (12 * (end.getFullYear() - start.getFullYear())) + (end.getMonth() - start.getMonth()); + } + + /** + * Gets the last day of the month for the given date. + * @param {Date} date + * @returns {Date} + */ + function getLastDateOfMonth(date) { + return new Date(date.getFullYear(), date.getMonth(), getNumberOfDaysInMonth(date)); + } + + /** + * Checks whether a date is valid. + * @param {Date} date + * @return {boolean} Whether the date is a valid Date. + */ + function isValidDate(date) { + return date && date.getTime && !isNaN(date.getTime()); + } + + /** + * Sets a date's time to midnight. + * @param {Date} date + */ + function setDateTimeToMidnight(date) { + if (isValidDate(date)) { + date.setHours(0, 0, 0, 0); + } + } + + /** + * Creates a date with the time set to midnight. + * Drop-in replacement for two forms of the Date constructor via opt_value. + * @param {number|Date=} opt_value Leave undefined for a Date representing now. Or use a + * single value representing the number of seconds since the Unix Epoch or a Date object. + * @return {Date} New date with time set to midnight. + */ + function createDateAtMidnight(opt_value) { + var date; + if (angular.isDate(opt_value)) { + date = opt_value; + } else if (angular.isNumber(opt_value)) { + date = new Date(opt_value); + } else { + date = new Date(); + } + setDateTimeToMidnight(date); + return date; + } + + /** + * Checks if a date is within a min and max range, ignoring the time component. + * If minDate or maxDate are not dates, they are ignored. + * @param {Date} date + * @param {Date} minDate + * @param {Date} maxDate + */ + function isDateWithinRange(date, minDate, maxDate) { + var dateAtMidnight = createDateAtMidnight(date); + var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null; + var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null; + return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) && + (!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight); + } + + /** + * Gets a new date incremented by the given number of years. Number of years can be negative. + * See `incrementMonths` for notes on overflow for specific dates. + * @param {Date} date + * @param {number} numberOfYears + * @returns {Date} + */ + function incrementYears(date, numberOfYears) { + return incrementMonths(date, numberOfYears * 12); + } + + /** + * Get the integer distance between two years. This *only* considers the year portion of the + * Date instances. + * + * @param {Date} start + * @param {Date} end + * @returns {number} Number of months between `start` and `end`. If `end` is before `start` + * chronologically, this number will be negative. + */ + function getYearDistance(start, end) { + return end.getFullYear() - start.getFullYear(); + } + + /** + * Clamps a date between a minimum and a maximum date. + * @param {Date} date Date to be clamped + * @param {Date=} minDate Minimum date + * @param {Date=} maxDate Maximum date + * @return {Date} + */ + function clampDate(date, minDate, maxDate) { + var boundDate = date; + if (minDate && date < minDate) { + boundDate = new Date(minDate.getTime()); + } + if (maxDate && date > maxDate) { + boundDate = new Date(maxDate.getTime()); + } + return boundDate; + } + + /** + * Extracts and parses the timestamp from a DOM node. + * @param {HTMLElement} node Node from which the timestamp will be extracted. + * @return {number} Time since epoch. + */ + function getTimestampFromNode(node) { + if (node && node.hasAttribute('data-timestamp')) { + return Number(node.getAttribute('data-timestamp')); + } + } + + /** + * Checks if a month is within a min and max range, ignoring the date and time components. + * If minDate or maxDate are not dates, they are ignored. + * @param {Date} date + * @param {Date} minDate + * @param {Date} maxDate + */ + function isMonthWithinRange(date, minDate, maxDate) { + var month = date.getMonth(); + var year = date.getFullYear(); + + return (!minDate || minDate.getFullYear() < year || minDate.getMonth() <= month) && + (!maxDate || maxDate.getFullYear() > year || maxDate.getMonth() >= month); + } + + /** + * @param {Date} value date in local timezone + * @return {Date} date with local timezone offset removed + */ + function removeLocalTzAndReparseDate(value) { + var dateValue, formattedDate; + // Remove the local timezone offset before calling formatDate. + dateValue = new Date(value.getTime() + 60000 * value.getTimezoneOffset()); + formattedDate = $mdDateLocale.formatDate(dateValue); + // parseDate only works with a date formatted by formatDate when using Moment validation. + return $mdDateLocale.parseDate(formattedDate); + } + }]); +})(); + +})(); +(function(){ +"use strict"; + +(function() { + 'use strict'; + + // TODO(jelbourn): forward more attributes to the internal input (required, autofocus, etc.) + // TODO(jelbourn): something better for mobile (calendar panel takes up entire screen?) + // TODO(jelbourn): input behavior (masking? auto-complete?) + + DatePickerCtrl.$inject = ["$scope", "$element", "$attrs", "$window", "$mdConstant", "$mdTheming", "$mdUtil", "$mdDateLocale", "$$mdDateUtil", "$$rAF", "$filter", "$timeout"]; + datePickerDirective.$inject = ["$$mdSvgRegistry", "$mdUtil", "$mdAria", "inputDirective"]; + angular.module('material.components.datepicker') + .directive('mdDatepicker', datePickerDirective); + + /** + * @ngdoc directive + * @name mdDatepicker + * @module material.components.datepicker + * + * @param {Date} ng-model The component's model. Expects either a JavaScript Date object or a + * value that can be parsed into one (e.g. a ISO 8601 string). + * @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being + * updated. Also allows for a timezone to be specified. + * + * Read more at the ngModelOptions docs. + * @param {expression=} ng-change Expression evaluated when the model value changes. + * @param {expression=} ng-focus Expression evaluated when the input is focused or the calendar + * is opened. + * @param {expression=} ng-blur Expression evaluated when focus is removed from the input or the + * calendar is closed. + * @param {boolean=} ng-disabled Whether the datepicker is disabled. + * @param {boolean=} ng-required Whether a value is required for the datepicker. + * @param {Date=} md-min-date Expression representing a min date (inclusive). + * @param {Date=} md-max-date Expression representing a max date (inclusive). + * @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a + * boolean whether it can be selected in "day" mode or not. Returning false will also trigger a + * `filtered` model validation error. + * @param {(function(Date): boolean)=} md-month-filter Function expecting a date and returning a + * boolean whether it can be selected in "month" mode or not. Returning false will also trigger a + * `filtered` model validation error. + * @param {string=} md-placeholder The date input placeholder value. + * @param {string=} md-open-on-focus When present, the calendar will be opened when the input + * is focused. + * @param {Boolean=} md-is-open Expression that can be used to open the datepicker's calendar + * on-demand. + * @param {string=} md-current-view Default open view of the calendar pane. Can be either + * "month" or "year". + * @param {string=} md-mode Restricts the user to only selecting a value from a particular view. + * This option can be used if the user is only supposed to choose from a certain date type + * (e.g. only selecting the month). + * Can be either "month" or "day". **Note** that this will overwrite the `md-current-view` value. + * @param {string=} md-hide-icons Determines which datepicker icons should be hidden. Note that + * this may cause the datepicker to not align properly with other components. + * **Use at your own risk.** Possible values are: + * * `"all"` - Hides all icons. + * * `"calendar"` - Only hides the calendar icon. + * * `"triangle"` - Only hides the triangle icon. + * @param {Object=} md-date-locale Allows for the values from the `$mdDateLocaleProvider` to be + * overwritten on a per-element basis (e.g. `msgOpenCalendar` can be overwritten with + * `md-date-locale="{ msgOpenCalendar: 'Open a special calendar' }"`). + * @param {string=} input-aria-describedby A space-separated list of element IDs. This should + * contain the IDs of any elements that describe this datepicker. Screen readers will read the + * content of these elements at the end of announcing that the datepicker has been selected + * and describing its current state. The descriptive elements do not need to be visible on the + * page. + * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use + * case is that this would contain the ID of a `